From: Andrea Amorese Date: Fri, 10 Sep 2021 12:20:30 +0000 (+0200) Subject: Built motion from commit fb0188bc.|2.5.34 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%22javascript:;/%22?a=commitdiff_plain;h=058c4aa0d1e3b48d7ec583b05feb19b45feea419;p=motion2.git Built motion from commit fb0188bc.|2.5.34 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index f012e98..cdb4ab9 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-09-10T11:50:18.270Z", + "time": "2021-09-10T12:06:29.290Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index c42a2e9..9dfdcd3 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-09-10T11:50:18.270Z", + "time": "2021-09-10T12:06:29.290Z", "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 d2c464b..a579f36 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 _0x5334=['jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','STRING','integration','motionbar','bot'];(function(_0xd5c88,_0x508cda){var _0xa786d0=function(_0x4d1ffc){while(--_0x4d1ffc){_0xd5c88['push'](_0xd5c88['shift']());}};_0xa786d0(++_0x508cda);}(_0x5334,0x84));var _0x4533=function(_0x3ca4c1,_0x404c12){_0x3ca4c1=_0x3ca4c1-0x0;var _0x566ab5=_0x5334[_0x3ca4c1];return _0x566ab5;};'use strict';var Sequelize=require(_0x4533('0x0'));module[_0x4533('0x1')]={'name':{'type':Sequelize[_0x4533('0x2')],'get':function(_0x35fb80){return this[_0x4533('0x3')]('action');}},'action':{'type':Sequelize[_0x4533('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x4533('0x5'),_0x4533('0x6'),'jscripty','urlForward','browser',_0x4533('0x7'),'script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x4533('0x4')](0x1000),'comment':_0x4533('0x8')},'data2':{'type':Sequelize[_0x4533('0x4')](0x1000),'comment':_0x4533('0x9')},'data3':{'type':Sequelize[_0x4533('0x4')](0x1000),'comment':_0x4533('0xa')},'data4':{'type':Sequelize[_0x4533('0x4')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x4533('0x4')](0x1000),'comments':_0x4533('0xb')},'data6':{'type':Sequelize[_0x4533('0x4')],'comments':_0x4533('0xc')},'data7':{'type':Sequelize['TEXT'],'comments':_0x4533('0xd')}}; \ No newline at end of file +var _0x1224=['browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','contactManager','integration','motionbar','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','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)]'];(function(_0x3f2ecf,_0x4ccad6){var _0xa6dd7e=function(_0x5e04c3){while(--_0x5e04c3){_0x3f2ecf['push'](_0x3f2ecf['shift']());}};_0xa6dd7e(++_0x4ccad6);}(_0x1224,0x10d));var _0x4122=function(_0x417d02,_0x4c0a6a){_0x417d02=_0x417d02-0x0;var _0x4d7758=_0x1224[_0x417d02];return _0x4d7758;};'use strict';var Sequelize=require(_0x4122('0x0'));module[_0x4122('0x1')]={'name':{'type':Sequelize[_0x4122('0x2')],'get':function(_0x4122fd){return this[_0x4122('0x3')](_0x4122('0x4'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x4122('0x5'),_0x4122('0x6'),_0x4122('0x7'),'jscripty',_0x4122('0x8'),_0x4122('0x9'),_0x4122('0xa'),_0x4122('0xb')]],'msg':_0x4122('0xc')}},'comment':_0x4122('0xc')},'data1':{'type':Sequelize[_0x4122('0xd')](0x1000),'comment':_0x4122('0xe')},'data2':{'type':Sequelize[_0x4122('0xd')](0x1000),'comment':_0x4122('0xf')},'data3':{'type':Sequelize[_0x4122('0xd')](0x1000),'comment':_0x4122('0x10')},'data4':{'type':Sequelize[_0x4122('0xd')](0x1000),'comments':_0x4122('0x11')},'data5':{'type':Sequelize[_0x4122('0xd')](0x1000),'comments':_0x4122('0x12')},'data6':{'type':Sequelize[_0x4122('0xd')],'comments':_0x4122('0x13')},'data7':{'type':Sequelize[_0x4122('0x14')],'comments':_0x4122('0x15')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 3cb79de..d4efb37 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 _0x4cf2=['stack','name','send','Action','params','body','catch','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','end','error'];(function(_0x29db36,_0x410ae9){var _0x234e87=function(_0x48697b){while(--_0x48697b){_0x29db36['push'](_0x29db36['shift']());}};_0x234e87(++_0x410ae9);}(_0x4cf2,0xcc));var _0x24cf=function(_0x4314d7,_0x355218){_0x4314d7=_0x4314d7-0x0;var _0x5c599b=_0x4cf2[_0x4314d7];return _0x5c599b;};'use strict';var emlformat=require(_0x24cf('0x0'));var rimraf=require(_0x24cf('0x1'));var zipdir=require(_0x24cf('0x2'));var jsonpatch=require(_0x24cf('0x3'));var rp=require(_0x24cf('0x4'));var moment=require('moment');var BPromise=require(_0x24cf('0x5'));var Mustache=require(_0x24cf('0x6'));var util=require(_0x24cf('0x7'));var path=require('path');var sox=require(_0x24cf('0x8'));var csv=require(_0x24cf('0x9'));var ejs=require(_0x24cf('0xa'));var fs=require('fs');var fs_extra=require(_0x24cf('0xb'));var _=require(_0x24cf('0xc'));var squel=require(_0x24cf('0xd'));var crypto=require(_0x24cf('0xe'));var jsforce=require(_0x24cf('0xf'));var deskjs=require(_0x24cf('0x10'));var toCsv=require(_0x24cf('0x9'));var querystring=require('querystring');var Papa=require(_0x24cf('0x11'));var Redis=require(_0x24cf('0x12'));var authService=require(_0x24cf('0x13'));var qs=require(_0x24cf('0x14'));var as=require(_0x24cf('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x24cf('0x16'))(_0x24cf('0x17'));var utils=require(_0x24cf('0x18'));var config=require(_0x24cf('0x19'));var licenseUtil=require(_0x24cf('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ab8bd,_0x4b3e04){_0x4b3e04=_0x4b3e04||0xcc;return function(_0x48df55){if(_0x48df55){return _0x1ab8bd[_0x24cf('0x1b')](_0x4b3e04);}return _0x1ab8bd[_0x24cf('0x1c')](_0x4b3e04)['end']();};}function respondWithResult(_0x4c7512,_0x47d175){_0x47d175=_0x47d175||0xc8;return function(_0x2203aa){if(_0x2203aa){return _0x4c7512[_0x24cf('0x1c')](_0x47d175)['json'](_0x2203aa);}};}function respondWithFilteredResult(_0x4c270a,_0x5daa9c){return function(_0x1ebe44){if(_0x1ebe44){var _0x38c198=typeof _0x5daa9c['offset']===_0x24cf('0x1d')&&typeof _0x5daa9c[_0x24cf('0x1e')]===_0x24cf('0x1d');var _0x3718e9=_0x1ebe44[_0x24cf('0x1f')];var _0x2f3335=_0x38c198?0x0:_0x5daa9c[_0x24cf('0x20')];var _0x32274e=_0x38c198?_0x1ebe44[_0x24cf('0x1f')]:_0x5daa9c[_0x24cf('0x20')]+_0x5daa9c[_0x24cf('0x1e')];var _0x3466ea;if(_0x32274e>=_0x3718e9){_0x32274e=_0x3718e9;_0x3466ea=0xc8;}else{_0x3466ea=0xce;}_0x4c270a[_0x24cf('0x1c')](_0x3466ea);return _0x4c270a[_0x24cf('0x21')](_0x24cf('0x22'),_0x2f3335+'-'+_0x32274e+'/'+_0x3718e9)['json'](_0x1ebe44);}return null;};}function patchUpdates(_0xf896fb){return function(_0x159255){try{jsonpatch[_0x24cf('0x23')](_0x159255,_0xf896fb,!![]);}catch(_0x37ebb1){return BPromise['reject'](_0x37ebb1);}return _0x159255['save']();};}function saveUpdates(_0x1579b6,_0x2e0927){return function(_0x5ee3e2){if(_0x5ee3e2){return _0x5ee3e2[_0x24cf('0x24')](_0x1579b6)[_0x24cf('0x25')](function(_0x194a3f){return _0x194a3f;});}return null;};}function removeEntity(_0x93c49b,_0x119f5e){return function(_0x2d81fa){if(_0x2d81fa){return _0x2d81fa[_0x24cf('0x26')]()['then'](function(){_0x93c49b[_0x24cf('0x1c')](0xcc)[_0x24cf('0x27')]();});}};}function handleEntityNotFound(_0x280d8d,_0xdfef90){return function(_0x5e3ddb){if(!_0x5e3ddb){_0x280d8d[_0x24cf('0x1b')](0x194);}return _0x5e3ddb;};}function handleError(_0x304241,_0x48450f){_0x48450f=_0x48450f||0x1f4;return function(_0x3ffbda){logger[_0x24cf('0x28')](_0x3ffbda[_0x24cf('0x29')]);if(_0x3ffbda[_0x24cf('0x2a')]){delete _0x3ffbda[_0x24cf('0x2a')];}_0x304241[_0x24cf('0x1c')](_0x48450f)[_0x24cf('0x2b')](_0x3ffbda);};}exports[_0x24cf('0x24')]=function(_0x4c3e78,_0x16a748){if(_0x4c3e78['body']['id']){delete _0x4c3e78['body']['id'];}return db[_0x24cf('0x2c')]['find']({'where':{'id':_0x4c3e78[_0x24cf('0x2d')]['id']}})['then'](handleEntityNotFound(_0x16a748,null))[_0x24cf('0x25')](saveUpdates(_0x4c3e78[_0x24cf('0x2e')],null))[_0x24cf('0x25')](respondWithResult(_0x16a748,null))[_0x24cf('0x2f')](handleError(_0x16a748,null));};exports[_0x24cf('0x26')]=function(_0x2210d0,_0x5d8f27){return db[_0x24cf('0x2c')][_0x24cf('0x30')]({'where':{'id':_0x2210d0['params']['id']}})[_0x24cf('0x25')](handleEntityNotFound(_0x5d8f27,null))[_0x24cf('0x25')](removeEntity(_0x5d8f27,null))[_0x24cf('0x2f')](handleError(_0x5d8f27,null));}; \ No newline at end of file +var _0x32de=['status','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','end','error','stack','name','send','update','body','Action','find','catch','destroy','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus'];(function(_0x4cc13d,_0x52d8a0){var _0x3fee04=function(_0x25a0a0){while(--_0x25a0a0){_0x4cc13d['push'](_0x4cc13d['shift']());}};_0x3fee04(++_0x52d8a0);}(_0x32de,0x1cf));var _0xe32d=function(_0x16ce18,_0x4c67b9){_0x16ce18=_0x16ce18-0x0;var _0x4f3b2e=_0x32de[_0x16ce18];return _0x4f3b2e;};'use strict';var emlformat=require(_0xe32d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe32d('0x1'));var jsonpatch=require(_0xe32d('0x2'));var rp=require(_0xe32d('0x3'));var moment=require(_0xe32d('0x4'));var BPromise=require(_0xe32d('0x5'));var Mustache=require(_0xe32d('0x6'));var util=require(_0xe32d('0x7'));var path=require(_0xe32d('0x8'));var sox=require(_0xe32d('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe32d('0xa'));var _=require(_0xe32d('0xb'));var squel=require('squel');var crypto=require(_0xe32d('0xc'));var jsforce=require(_0xe32d('0xd'));var deskjs=require(_0xe32d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe32d('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe32d('0x10'));var logger=require(_0xe32d('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xe32d('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xe32d('0x13'))['db'];function respondWithStatusCode(_0x35a5c1,_0xc78f88){_0xc78f88=_0xc78f88||0xcc;return function(_0xb55518){if(_0xb55518){return _0x35a5c1[_0xe32d('0x14')](_0xc78f88);}return _0x35a5c1[_0xe32d('0x15')](_0xc78f88)['end']();};}function respondWithResult(_0x3367f7,_0x3e704a){_0x3e704a=_0x3e704a||0xc8;return function(_0xa2cba8){if(_0xa2cba8){return _0x3367f7['status'](_0x3e704a)[_0xe32d('0x16')](_0xa2cba8);}};}function respondWithFilteredResult(_0x4d7cca,_0x2e37b8){return function(_0x54bc3d){if(_0x54bc3d){var _0x4f983b=typeof _0x2e37b8[_0xe32d('0x17')]==='undefined'&&typeof _0x2e37b8['limit']===_0xe32d('0x18');var _0x127f83=_0x54bc3d[_0xe32d('0x19')];var _0x2da06e=_0x4f983b?0x0:_0x2e37b8[_0xe32d('0x17')];var _0x46b964=_0x4f983b?_0x54bc3d[_0xe32d('0x19')]:_0x2e37b8[_0xe32d('0x17')]+_0x2e37b8[_0xe32d('0x1a')];var _0x6b6cea;if(_0x46b964>=_0x127f83){_0x46b964=_0x127f83;_0x6b6cea=0xc8;}else{_0x6b6cea=0xce;}_0x4d7cca[_0xe32d('0x15')](_0x6b6cea);return _0x4d7cca[_0xe32d('0x1b')](_0xe32d('0x1c'),_0x2da06e+'-'+_0x46b964+'/'+_0x127f83)[_0xe32d('0x16')](_0x54bc3d);}return null;};}function patchUpdates(_0x3feb50){return function(_0x538ad4){try{jsonpatch['apply'](_0x538ad4,_0x3feb50,!![]);}catch(_0x1742a8){return BPromise[_0xe32d('0x1d')](_0x1742a8);}return _0x538ad4[_0xe32d('0x1e')]();};}function saveUpdates(_0x3fc64b,_0x1015db){return function(_0xe5f397){if(_0xe5f397){return _0xe5f397['update'](_0x3fc64b)[_0xe32d('0x1f')](function(_0x5050b0){return _0x5050b0;});}return null;};}function removeEntity(_0x4cbee5,_0x20eb21){return function(_0x42a285){if(_0x42a285){return _0x42a285['destroy']()[_0xe32d('0x1f')](function(){_0x4cbee5[_0xe32d('0x15')](0xcc)[_0xe32d('0x20')]();});}};}function handleEntityNotFound(_0x3667e3,_0x4f6c84){return function(_0x55473b){if(!_0x55473b){_0x3667e3[_0xe32d('0x14')](0x194);}return _0x55473b;};}function handleError(_0x26df3f,_0x3ebaf2){_0x3ebaf2=_0x3ebaf2||0x1f4;return function(_0x46701b){logger[_0xe32d('0x21')](_0x46701b[_0xe32d('0x22')]);if(_0x46701b[_0xe32d('0x23')]){delete _0x46701b[_0xe32d('0x23')];}_0x26df3f[_0xe32d('0x15')](_0x3ebaf2)[_0xe32d('0x24')](_0x46701b);};}exports[_0xe32d('0x25')]=function(_0xc11f87,_0x190c4d){if(_0xc11f87[_0xe32d('0x26')]['id']){delete _0xc11f87[_0xe32d('0x26')]['id'];}return db[_0xe32d('0x27')][_0xe32d('0x28')]({'where':{'id':_0xc11f87['params']['id']}})['then'](handleEntityNotFound(_0x190c4d,null))['then'](saveUpdates(_0xc11f87[_0xe32d('0x26')],null))[_0xe32d('0x1f')](respondWithResult(_0x190c4d,null))[_0xe32d('0x29')](handleError(_0x190c4d,null));};exports[_0xe32d('0x2a')]=function(_0x581c3f,_0x88c9c2){return db['Action']['find']({'where':{'id':_0x581c3f[_0xe32d('0x2b')]['id']}})[_0xe32d('0x1f')](handleEntityNotFound(_0x88c9c2,null))[_0xe32d('0x1f')](removeEntity(_0x88c9c2,null))[_0xe32d('0x29')](handleError(_0x88c9c2,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index b091f6d..aa36acb 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 _0xcbf3=['exports','tools_actions','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x379daf,_0x57135f){var _0x438198=function(_0x32a69e){while(--_0x32a69e){_0x379daf['push'](_0x379daf['shift']());}};_0x438198(++_0x57135f);}(_0xcbf3,0xf2));var _0x3cbf=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xcbf3[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x3cbf('0x0'));var util=require(_0x3cbf('0x1'));var logger=require(_0x3cbf('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3cbf('0x3'));var rp=require(_0x3cbf('0x4'));var fs=require('fs');var path=require(_0x3cbf('0x5'));var rimraf=require(_0x3cbf('0x6'));var config=require(_0x3cbf('0x7'));var attributes=require('./action.attributes');module[_0x3cbf('0x8')]=function(_0x12d916,_0x32505e){return _0x12d916['define']('Action',attributes,{'tableName':_0x3cbf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x030d=['request-promise','path','exports','define','Action','tools_actions','lodash','util','../../config/logger','api','bluebird'];(function(_0x2ca9d4,_0x51d5c6){var _0x258956=function(_0x47a0e5){while(--_0x47a0e5){_0x2ca9d4['push'](_0x2ca9d4['shift']());}};_0x258956(++_0x51d5c6);}(_0x030d,0x1c9));var _0xd030=function(_0x168057,_0x18fae0){_0x168057=_0x168057-0x0;var _0x470c2f=_0x030d[_0x168057];return _0x470c2f;};'use strict';var _=require(_0xd030('0x0'));var util=require(_0xd030('0x1'));var logger=require(_0xd030('0x2'))(_0xd030('0x3'));var moment=require('moment');var BPromise=require(_0xd030('0x4'));var rp=require(_0xd030('0x5'));var fs=require('fs');var path=require(_0xd030('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./action.attributes');module[_0xd030('0x7')]=function(_0x19b5ae,_0x397e7d){return _0x19b5ae[_0xd030('0x8')](_0xd030('0x9'),attributes,{'tableName':_0xd030('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index f1d238f..d9ec80f 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 _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x42c916,_0x456eed){var _0x54f7e9=function(_0x23e4bf){while(--_0x23e4bf){_0x42c916['push'](_0x42c916['shift']());}};_0x54f7e9(++_0x456eed);}(_0xabce,0x103));var _0xeabc=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xabce[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Action,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});} \ No newline at end of file +var _0x7fbe=['request','then','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x6451f0,_0x140639){var _0x39163c=function(_0x546679){while(--_0x546679){_0x6451f0['push'](_0x6451f0['shift']());}};_0x39163c(++_0x140639);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x134cab,_0xdcaa87){_0x134cab=_0x134cab-0x0;var _0xe5a8ab=_0x7fbe[_0x134cab];return _0xe5a8ab;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 67e38bf..17038e7 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 _0xfa4c=['./action.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0xfa4c,0x108));var _0xcfa4=function(_0x14dbf5,_0x2ec47f){_0x14dbf5=_0x14dbf5-0x0;var _0x161348=_0xfa4c[_0x14dbf5];return _0x161348;};'use strict';var multer=require(_0xcfa4('0x0'));var util=require(_0xcfa4('0x1'));var path=require(_0xcfa4('0x2'));var timeout=require(_0xcfa4('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xcfa4('0x4'));var auth=require(_0xcfa4('0x5'));var interaction=require(_0xcfa4('0x6'));var config=require(_0xcfa4('0x7'));var controller=require(_0xcfa4('0x8'));router[_0xcfa4('0x9')](_0xcfa4('0xa'),auth[_0xcfa4('0xb')](),controller[_0xcfa4('0xc')]);router[_0xcfa4('0xd')](_0xcfa4('0xa'),auth[_0xcfa4('0xb')](),controller[_0xcfa4('0xe')]);module[_0xcfa4('0xf')]=router; \ No newline at end of file +var _0xceec=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete','destroy','multer'];(function(_0x610f96,_0x30ccf5){var _0x38f0c9=function(_0x39b2e1){while(--_0x39b2e1){_0x610f96['push'](_0x610f96['shift']());}};_0x38f0c9(++_0x30ccf5);}(_0xceec,0x1bf));var _0xccee=function(_0x3bd528,_0x4503cd){_0x3bd528=_0x3bd528-0x0;var _0x2752b9=_0xceec[_0x3bd528];return _0x2752b9;};'use strict';var multer=require(_0xccee('0x0'));var util=require(_0xccee('0x1'));var path=require(_0xccee('0x2'));var timeout=require(_0xccee('0x3'));var express=require(_0xccee('0x4'));var router=express[_0xccee('0x5')]();var fs_extra=require(_0xccee('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xccee('0x7'));var config=require(_0xccee('0x8'));var controller=require(_0xccee('0x9'));router[_0xccee('0xa')](_0xccee('0xb'),auth[_0xccee('0xc')](),controller[_0xccee('0xd')]);router[_0xccee('0xe')](_0xccee('0xb'),auth[_0xccee('0xc')](),controller[_0xccee('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 7d9c1b8..4b112e3 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 _0x3eea=['STRING','TEXT','sequelize'];(function(_0x3330c,_0x3bd322){var _0x345555=function(_0x599928){while(--_0x599928){_0x3330c['push'](_0x3330c['shift']());}};_0x345555(++_0x3bd322);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x2a83b1,_0x12ba87){_0x2a83b1=_0x2a83b1-0x0;var _0x4d17b5=_0x3eea[_0x2a83b1];return _0x4d17b5;};'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 +var _0xda19=['exports','STRING','TEXT'];(function(_0x26c79f,_0x59d3fc){var _0x17a46e=function(_0x2f799c){while(--_0x2f799c){_0x26c79f['push'](_0x26c79f['shift']());}};_0x17a46e(++_0x59d3fc);}(_0xda19,0xd5));var _0x9da1=function(_0x411b75,_0x4de4ca){_0x411b75=_0x411b75-0x0;var _0x5a9239=_0xda19[_0x411b75];return _0x5a9239;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'name':{'type':Sequelize[_0x9da1('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x9da1('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x9da1('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 1a881b9..a54c8da 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 _0x4dee=['groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','HOUR(%s)','ROUND(%s)','operator','getFields','keyBy','foreignKey','web','fullPath','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','runReport','IS\x20EMPTY','IS\x20NOT\x20EMPTY','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','destroy','then','get','CustomReports','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','AnalyticCustomReport','findAll','rows','catch','show','keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','find','userProfileId','autoAssociation','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)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','MetricId','metric','function','replace','format'];(function(_0x6f6f18,_0x406aee){var _0x57c18c=function(_0x289369){while(--_0x289369){_0x6f6f18['push'](_0x6f6f18['shift']());}};_0x57c18c(++_0x406aee);}(_0x4dee,0x172));var _0xe4de=function(_0x4aa667,_0x179830){_0x4aa667=_0x4aa667-0x0;var _0x3ca1b2=_0x4dee[_0x4aa667];return _0x3ca1b2;};'use strict';var emlformat=require(_0xe4de('0x0'));var rimraf=require(_0xe4de('0x1'));var zipdir=require(_0xe4de('0x2'));var jsonpatch=require(_0xe4de('0x3'));var rp=require(_0xe4de('0x4'));var moment=require(_0xe4de('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe4de('0x6'));var util=require(_0xe4de('0x7'));var path=require(_0xe4de('0x8'));var sox=require(_0xe4de('0x9'));var csv=require('to-csv');var ejs=require(_0xe4de('0xa'));var fs=require('fs');var fs_extra=require(_0xe4de('0xb'));var _=require(_0xe4de('0xc'));var squel=require(_0xe4de('0xd'));var crypto=require('crypto');var jsforce=require(_0xe4de('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe4de('0xf'));var authService=require(_0xe4de('0x10'));var qs=require(_0xe4de('0x11'));var as=require(_0xe4de('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe4de('0x13'));var utils=require(_0xe4de('0x14'));var config=require(_0xe4de('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe4de('0x16'))['db'];var dbH=require('../../mysqldb')[_0xe4de('0x17')];function respondWithStatusCode(_0x258b4e,_0xbe0d50){_0xbe0d50=_0xbe0d50||0xcc;return function(_0x26f1eb){if(_0x26f1eb){return _0x258b4e[_0xe4de('0x18')](_0xbe0d50);}return _0x258b4e[_0xe4de('0x19')](_0xbe0d50)[_0xe4de('0x1a')]();};}function respondWithResult(_0x51eeed,_0x36f3f0){_0x36f3f0=_0x36f3f0||0xc8;return function(_0x279104){if(_0x279104){return _0x51eeed[_0xe4de('0x19')](_0x36f3f0)['json'](_0x279104);}};}function respondWithFilteredResult(_0x4f892c,_0x53e52b){return function(_0x141ad5){if(_0x141ad5){var _0x1fa341=typeof _0x53e52b[_0xe4de('0x1b')]===_0xe4de('0x1c')&&typeof _0x53e52b[_0xe4de('0x1d')]===_0xe4de('0x1c');var _0x43b47d=_0x141ad5[_0xe4de('0x1e')];var _0x1c6c1a=_0x1fa341?0x0:_0x53e52b[_0xe4de('0x1b')];var _0x4f1e9a=_0x1fa341?_0x141ad5[_0xe4de('0x1e')]:_0x53e52b[_0xe4de('0x1b')]+_0x53e52b['limit'];var _0x28712d;if(_0x4f1e9a>=_0x43b47d){_0x4f1e9a=_0x43b47d;_0x28712d=0xc8;}else{_0x28712d=0xce;}_0x4f892c[_0xe4de('0x19')](_0x28712d);return _0x4f892c[_0xe4de('0x1f')](_0xe4de('0x20'),_0x1c6c1a+'-'+_0x4f1e9a+'/'+_0x43b47d)[_0xe4de('0x21')](_0x141ad5);}return null;};}function patchUpdates(_0x1a8784){return function(_0x2a8bd8){try{jsonpatch['apply'](_0x2a8bd8,_0x1a8784,!![]);}catch(_0x218a73){return BPromise['reject'](_0x218a73);}return _0x2a8bd8[_0xe4de('0x22')]();};}function saveUpdates(_0x3e571d,_0x3349c2){return function(_0x5a2c18){if(_0x5a2c18){return _0x5a2c18[_0xe4de('0x23')](_0x3e571d)['then'](function(_0xe35f0d){return _0xe35f0d;});}return null;};}function removeEntity(_0xb75ef,_0x145f00){return function(_0x5d26da){if(_0x5d26da){return _0x5d26da[_0xe4de('0x24')]()[_0xe4de('0x25')](function(){var _0x59d5ac=_0x5d26da[_0xe4de('0x26')]({'plain':!![]});var _0x4c8530=_0xe4de('0x27');return db[_0xe4de('0x28')]['destroy']({'where':{'type':_0x4c8530,'resourceId':_0x59d5ac['id']}})[_0xe4de('0x25')](function(){return _0x5d26da;});})['then'](function(){_0xb75ef[_0xe4de('0x19')](0xcc)[_0xe4de('0x1a')]();});}};}function handleEntityNotFound(_0x29f20b,_0x68ed21){return function(_0x46ed77){if(!_0x46ed77){_0x29f20b[_0xe4de('0x18')](0x194);}return _0x46ed77;};}function handleError(_0xae7e08,_0x26657b){_0x26657b=_0x26657b||0x1f4;return function(_0x1a2ca5){logger[_0xe4de('0x29')](_0x1a2ca5[_0xe4de('0x2a')]);if(_0x1a2ca5[_0xe4de('0x2b')]){delete _0x1a2ca5[_0xe4de('0x2b')];}_0xae7e08[_0xe4de('0x19')](_0x26657b)[_0xe4de('0x2c')](_0x1a2ca5);};}exports[_0xe4de('0x2d')]=function(_0x135a66,_0x3fc25a){var _0x286dd6={},_0x5b56e3={},_0x6fdc4={'count':0x0,'rows':[]};var _0x56980d=_[_0xe4de('0x2e')](db['AnalyticCustomReport'][_0xe4de('0x2f')],function(_0x4ff82a){return{'name':_0x4ff82a['fieldName'],'type':_0x4ff82a[_0xe4de('0x30')][_0xe4de('0x31')]};});_0x5b56e3['model']=_[_0xe4de('0x2e')](_0x56980d,_0xe4de('0x2b'));_0x5b56e3[_0xe4de('0x32')]=_['keys'](_0x135a66[_0xe4de('0x32')]);_0x5b56e3[_0xe4de('0x33')]=_[_0xe4de('0x34')](_0x5b56e3[_0xe4de('0x35')],_0x5b56e3[_0xe4de('0x32')]);_0x286dd6[_0xe4de('0x36')]=_[_0xe4de('0x34')](_0x5b56e3[_0xe4de('0x35')],qs[_0xe4de('0x37')](_0x135a66[_0xe4de('0x32')][_0xe4de('0x37')]));_0x286dd6['attributes']=_0x286dd6[_0xe4de('0x36')][_0xe4de('0x38')]?_0x286dd6[_0xe4de('0x36')]:_0x5b56e3[_0xe4de('0x35')];if(!_0x135a66[_0xe4de('0x32')]['hasOwnProperty'](_0xe4de('0x39'))){_0x286dd6[_0xe4de('0x1d')]=qs[_0xe4de('0x1d')](_0x135a66[_0xe4de('0x32')][_0xe4de('0x1d')]);_0x286dd6[_0xe4de('0x1b')]=qs[_0xe4de('0x1b')](_0x135a66[_0xe4de('0x32')][_0xe4de('0x1b')]);}_0x286dd6[_0xe4de('0x3a')]=qs[_0xe4de('0x3b')](_0x135a66[_0xe4de('0x32')]['sort']);_0x286dd6[_0xe4de('0x3c')]=qs[_0xe4de('0x33')](_[_0xe4de('0x3d')](_0x135a66[_0xe4de('0x32')],_0x5b56e3[_0xe4de('0x33')]),_0x56980d);if(_0x135a66['query'][_0xe4de('0x3e')]){_0x286dd6[_0xe4de('0x3c')]=_['merge'](_0x286dd6[_0xe4de('0x3c')],{'$or':_[_0xe4de('0x2e')](_0x56980d,function(_0x55e5a7){if(_0x55e5a7[_0xe4de('0x30')]!==_0xe4de('0x3f')){var _0x4d7e6b={};_0x4d7e6b[_0x55e5a7[_0xe4de('0x2b')]]={'$like':'%'+_0x135a66[_0xe4de('0x32')]['filter']+'%'};return _0x4d7e6b;}})});}_0x286dd6=_[_0xe4de('0x40')]({},_0x286dd6,_0x135a66[_0xe4de('0x41')]);var _0x497878={'where':_0x286dd6[_0xe4de('0x3c')]};return db['AnalyticCustomReport'][_0xe4de('0x1e')](_0x497878)[_0xe4de('0x25')](function(_0x4308eb){_0x6fdc4['count']=_0x4308eb;if(_0x135a66[_0xe4de('0x32')]['includeAll']){_0x286dd6[_0xe4de('0x42')]=[{'all':!![]}];}return db[_0xe4de('0x43')][_0xe4de('0x44')](_0x286dd6);})[_0xe4de('0x25')](function(_0x578356){_0x6fdc4[_0xe4de('0x45')]=_0x578356;return _0x6fdc4;})[_0xe4de('0x25')](respondWithFilteredResult(_0x3fc25a,_0x286dd6))[_0xe4de('0x46')](handleError(_0x3fc25a,null));};exports[_0xe4de('0x47')]=function(_0x1d571c,_0x5354e6){var _0x3c11ae={'raw':![],'where':{'id':_0x1d571c['params']['id']}},_0x49149e={};_0x49149e[_0xe4de('0x35')]=_[_0xe4de('0x48')](db[_0xe4de('0x43')][_0xe4de('0x2f')]);_0x49149e[_0xe4de('0x32')]=_[_0xe4de('0x48')](_0x1d571c[_0xe4de('0x32')]);_0x49149e[_0xe4de('0x33')]=_['intersection'](_0x49149e[_0xe4de('0x35')],_0x49149e[_0xe4de('0x32')]);_0x3c11ae['attributes']=_['intersection'](_0x49149e[_0xe4de('0x35')],qs[_0xe4de('0x37')](_0x1d571c['query'][_0xe4de('0x37')]));_0x3c11ae[_0xe4de('0x36')]=_0x3c11ae[_0xe4de('0x36')][_0xe4de('0x38')]?_0x3c11ae[_0xe4de('0x36')]:_0x49149e['model'];if(_0x1d571c[_0xe4de('0x32')][_0xe4de('0x49')]){_0x3c11ae[_0xe4de('0x42')]=[{'all':!![]}];}_0x3c11ae=_[_0xe4de('0x40')]({},_0x3c11ae,_0x1d571c[_0xe4de('0x41')]);return db['AnalyticCustomReport']['find'](_0x3c11ae)['then'](handleEntityNotFound(_0x5354e6,null))[_0xe4de('0x25')](respondWithResult(_0x5354e6,null))[_0xe4de('0x46')](handleError(_0x5354e6,null));};exports[_0xe4de('0x4a')]=function(_0x518946,_0x42bbf2){return db[_0xe4de('0x43')][_0xe4de('0x4a')](_0x518946[_0xe4de('0x4b')],{})['then'](function(_0x52d305){var _0x2f5f4d=_0x518946[_0xe4de('0x4c')][_0xe4de('0x26')]({'plain':!![]});if(!_0x2f5f4d)throw new Error(_0xe4de('0x4d'));if(_0x2f5f4d['role']===_0xe4de('0x4c')){var _0x4ab531=_0x52d305[_0xe4de('0x26')]({'plain':!![]});var _0x439823=_0xe4de('0x4e');return db[_0xe4de('0x4f')][_0xe4de('0x50')]({'where':{'name':_0x439823,'userProfileId':_0x2f5f4d[_0xe4de('0x51')]},'raw':!![]})[_0xe4de('0x25')](function(_0x13f883){if(_0x13f883&&_0x13f883[_0xe4de('0x52')]===0x0){return db[_0xe4de('0x28')][_0xe4de('0x4a')]({'name':_0x4ab531['name'],'resourceId':_0x4ab531['id'],'type':_0xe4de('0x27'),'sectionId':_0x13f883['id']},{})[_0xe4de('0x25')](function(){return _0x52d305;});}else{return _0x52d305;}})['catch'](function(_0x11a50f){logger[_0xe4de('0x29')](_0xe4de('0x53'),_0x11a50f);throw _0x11a50f;});}return _0x52d305;})[_0xe4de('0x25')](respondWithResult(_0x42bbf2,0xc9))[_0xe4de('0x46')](handleError(_0x42bbf2,null));};exports[_0xe4de('0x23')]=function(_0x443506,_0x39a901){if(_0x443506[_0xe4de('0x4b')]['id']){delete _0x443506[_0xe4de('0x4b')]['id'];}return db[_0xe4de('0x43')][_0xe4de('0x50')]({'where':{'id':_0x443506[_0xe4de('0x54')]['id']}})[_0xe4de('0x25')](handleEntityNotFound(_0x39a901,null))['then'](saveUpdates(_0x443506[_0xe4de('0x4b')],null))[_0xe4de('0x25')](respondWithResult(_0x39a901,null))['catch'](handleError(_0x39a901,null));};exports[_0xe4de('0x24')]=function(_0x5d241f,_0x2fc3fe){return db[_0xe4de('0x43')]['find']({'where':{'id':_0x5d241f[_0xe4de('0x54')]['id']}})[_0xe4de('0x25')](handleEntityNotFound(_0x2fc3fe,null))[_0xe4de('0x25')](removeEntity(_0x2fc3fe,null))[_0xe4de('0x46')](handleError(_0x2fc3fe,null));};exports[_0xe4de('0x55')]=function(_0x2e0aab,_0xac7c5){var _0x7e84f7=0xa;var _0x19514a=[_0xe4de('0x56'),_0xe4de('0x57'),_0xe4de('0x58'),_0xe4de('0x59')];var _0xdb8337={'SUM':_0xe4de('0x5a'),'COUNT':_0xe4de('0x5b'),'COUNT DISTINCT':_0xe4de('0x5c'),'MAX':_0xe4de('0x5d'),'MIN':_0xe4de('0x5e'),'AVG':_0xe4de('0x5f'),'GROUP_CONCAT':_0xe4de('0x60'),'GROUP_CONCAT ASC':_0xe4de('0x61'),'GROUP_CONCAT DESC':_0xe4de('0x62')};var _0x37ee3d={'SEC_TO_TIME':_0xe4de('0x63'),'DATE':_0xe4de('0x64'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xe4de('0x65')};var _0x28b299=function(_0x2da856){return!_[_0xe4de('0x66')]([_0xe4de('0x67'),_0xe4de('0x68'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x2da856);};var _0x4ee4d4=function(_0x2682e6){if(!_0x2682e6||!_0x2682e6[_0xe4de('0x69')][_0xe4de('0x38')]){return'';}for(var _0x37b52c='(',_0x5a07c7=0x0;_0x5a07c7<_0x2682e6[_0xe4de('0x69')][_0xe4de('0x38')];_0x5a07c7+=0x1){_0x5a07c7>0x0&&(_0x37b52c+='\x20'+_0x2682e6['operator']+'\x20');_0x37b52c+=_0x2682e6[_0xe4de('0x69')][_0x5a07c7][_0xe4de('0x6a')]?_0x4ee4d4(_0x2682e6['rules'][_0x5a07c7][_0xe4de('0x6a')]):_0x2682e6[_0xe4de('0x69')][_0x5a07c7][_0xe4de('0x6b')]+'\x20'+_0x2682e6[_0xe4de('0x69')][_0x5a07c7][_0xe4de('0x6c')]+(_0x28b299(_0x2682e6[_0xe4de('0x69')][_0x5a07c7][_0xe4de('0x6c')])?'\x20'+_0x2682e6[_0xe4de('0x69')][_0x5a07c7][_0xe4de('0x6d')]:'');}return _0x37b52c+')';};var _0xe26c45={'where':{'id':_0x2e0aab[_0xe4de('0x54')]['id']}},_0x4c9eea,_0x434c0f,_0x4a94f3,_0x258ac4,_0xde93c2;_0xe26c45=_[_0xe4de('0x40')]({},_0xe26c45,_0x2e0aab[_0xe4de('0x41')]);return db[_0xe4de('0x43')][_0xe4de('0x50')](_0xe26c45)[_0xe4de('0x25')](function(_0x231f5b){if(_0x231f5b){_0x4c9eea=_0x231f5b;return _0x231f5b['getFields']();}return null;})[_0xe4de('0x25')](function(_0x476990){if(_0x476990){if(!_0x476990['length']){throw new db[(_0xe4de('0x6e'))][(_0xe4de('0x6f'))](_0xe4de('0x70'),0x193);}_0x434c0f=_0x476990;return db[_0xe4de('0x71')]['findAll']({'raw':!![]});}return null;})[_0xe4de('0x25')](function(_0x50adb3){if(_0x50adb3){_0x4a94f3=_['keyBy'](_0x50adb3,'id');var _0x431172;var _0x3008a2=squel[_0xe4de('0x72')]();_0x3008a2[_0xe4de('0x73')](_0x4c9eea[_0xe4de('0x74')]);for(var _0x489a72=0x0;_0x489a72<_0x434c0f[_0xe4de('0x38')];_0x489a72+=0x1){_0x431172=_0x434c0f[_0x489a72]['MetricId']?_0x4a94f3[_0x434c0f[_0x489a72][_0xe4de('0x75')]][_0xe4de('0x76')]:_0x434c0f[_0x489a72]['field'];_0x431172=_0x434c0f[_0x489a72][_0xe4de('0x77')]?_[_0xe4de('0x78')](_0xdb8337[_0x434c0f[_0x489a72]['function']],'%s',_0x431172):_0x431172;_0x431172=_0x434c0f[_0x489a72]['format']?_[_0xe4de('0x78')](_0x37ee3d[_0x434c0f[_0x489a72][_0xe4de('0x79')]],'%s',_0x431172):_0x431172;if(_0x434c0f[_0x489a72][_0xe4de('0x7a')]){_0x3008a2[_0xe4de('0x6a')](_0x431172);}_0x434c0f[_0x489a72][_0xe4de('0x7b')]&&_0x3008a2[_0xe4de('0x3a')](_0x431172,_0x434c0f[_0x489a72][_0xe4de('0x7b')]===_0xe4de('0x7c')?![]:!![]);_0x3008a2[_0xe4de('0x6b')](_0x431172,_0x434c0f[_0x489a72][_0xe4de('0x7d')]||_0x431172);}if(_0x4c9eea[_0xe4de('0x7e')]){_0x4c9eea[_0xe4de('0x7e')]=JSON[_0xe4de('0x7f')](_0x4c9eea['joins']);for(var _0x3e0e29=0x0;_0x3e0e29<_0x4c9eea[_0xe4de('0x7e')][_0xe4de('0x38')];_0x3e0e29+=0x1){if(_0x4c9eea['joins'][_0x3e0e29][_0xe4de('0x30')]&&_['includes'](_0x19514a,_0x4c9eea[_0xe4de('0x7e')][_0x3e0e29][_0xe4de('0x30')])&&_0x4c9eea[_0xe4de('0x7e')][_0x3e0e29][_0xe4de('0x80')]&&_0x4c9eea[_0xe4de('0x7e')][_0x3e0e29][_0xe4de('0x81')]&&_0x4c9eea['joins'][_0x3e0e29]['foreignKey']){_0x3008a2[_0x4c9eea[_0xe4de('0x7e')][_0x3e0e29][_0xe4de('0x30')]](_0x4c9eea['joins'][_0x3e0e29][_0xe4de('0x81')],null,util[_0xe4de('0x79')](_0xe4de('0x82'),_0x4c9eea[_0xe4de('0x74')],_0x4c9eea[_0xe4de('0x7e')][_0x3e0e29][_0xe4de('0x80')],_0x4c9eea['joins'][_0x3e0e29][_0xe4de('0x81')],_0x4c9eea[_0xe4de('0x7e')][_0x3e0e29]['foreignKey']));}}}if(_0x4c9eea[_0xe4de('0x83')]){_0x4c9eea[_0xe4de('0x83')]=JSON[_0xe4de('0x7f')](_0x4c9eea[_0xe4de('0x83')]);_0x3008a2[_0xe4de('0x3c')](_0x4ee4d4(_0x4c9eea['conditions'][_0xe4de('0x6a')]));}_0xde93c2=_0x3008a2[_0xe4de('0x84')]();_0x3008a2[_0xe4de('0x1d')](_0x7e84f7);_0x3008a2[_0xe4de('0x1b')](0x0);logger[_0xe4de('0x85')](_0xe4de('0x86'),_0x3008a2[_0xe4de('0x87')]());return dbH['sequelize'][_0xe4de('0x32')](_0x3008a2['toString'](),{'type':dbH[_0xe4de('0x88')][_0xe4de('0x89')][_0xe4de('0x8a')]});}})[_0xe4de('0x25')](respondWithResult(_0xac7c5,null))[_0xe4de('0x46')](handleError(_0xac7c5,null));};function runReport(_0x37ac82,_0x598b24,_0x58f787){var _0x41a2af=_0x598b24['name'];var _0x2f00e2=0xa;var _0x40f535=[_0xe4de('0x56'),'left_join',_0xe4de('0x58'),_0xe4de('0x59')];var _0x559d91={'SUM':'SUM(%s)','COUNT':_0xe4de('0x5b'),'COUNT DISTINCT':_0xe4de('0x5c'),'MAX':_0xe4de('0x5d'),'MIN':_0xe4de('0x5e'),'AVG':_0xe4de('0x5f'),'GROUP_CONCAT':_0xe4de('0x60'),'GROUP_CONCAT ASC':_0xe4de('0x61'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5098fd={'SEC_TO_TIME':_0xe4de('0x63'),'DATE':'DATE(%s)','HOUR':_0xe4de('0x8b'),'ROUND':_0xe4de('0x8c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x13aa2b=function(_0x20ce59){return!_[_0xe4de('0x66')]([_0xe4de('0x67'),_0xe4de('0x68'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x20ce59);};var _0x169817=function(_0x4649bd){if(!_0x4649bd||!_0x4649bd[_0xe4de('0x69')][_0xe4de('0x38')]){return'';}for(var _0x33040a='(',_0x28ea9f=0x0;_0x28ea9f<_0x4649bd[_0xe4de('0x69')][_0xe4de('0x38')];_0x28ea9f+=0x1){_0x28ea9f>0x0&&(_0x33040a+='\x20'+_0x4649bd[_0xe4de('0x8d')]+'\x20');_0x33040a+=_0x4649bd[_0xe4de('0x69')][_0x28ea9f][_0xe4de('0x6a')]?_0x169817(_0x4649bd[_0xe4de('0x69')][_0x28ea9f][_0xe4de('0x6a')]):_0x4649bd[_0xe4de('0x69')][_0x28ea9f][_0xe4de('0x6b')]+'\x20'+_0x4649bd[_0xe4de('0x69')][_0x28ea9f][_0xe4de('0x6c')]+(_0x13aa2b(_0x4649bd[_0xe4de('0x69')][_0x28ea9f][_0xe4de('0x6c')])?'\x20'+_0x4649bd[_0xe4de('0x69')][_0x28ea9f][_0xe4de('0x6d')]:'');}return _0x33040a+')';};var _0x42e858={'where':{'id':_0x37ac82['id']}},_0x43993b,_0x539173,_0x5cdf7d,_0x2af21a,_0x91f81b;_0x42e858=_[_0xe4de('0x40')]({},_0x42e858,_0x58f787);return db[_0xe4de('0x43')][_0xe4de('0x50')](_0x42e858)[_0xe4de('0x25')](function(_0x350611){if(_0x350611){_0x43993b=_0x350611;return _0x350611[_0xe4de('0x8e')]();}return null;})[_0xe4de('0x25')](function(_0x32a796){if(_0x32a796){if(!_0x32a796[_0xe4de('0x38')]){throw new db[(_0xe4de('0x6e'))][(_0xe4de('0x6f'))](_0xe4de('0x70'),0x193);}_0x539173=_0x32a796;return db['AnalyticMetric'][_0xe4de('0x44')]({'raw':!![]});}return null;})[_0xe4de('0x25')](function(_0x1a7417){if(_0x1a7417){_0x5cdf7d=_[_0xe4de('0x8f')](_0x1a7417,'id');var _0x37e3cd;var _0x18ca02=squel['select']();_0x18ca02['from'](_0x43993b[_0xe4de('0x74')]);for(var _0x4f6925=0x0;_0x4f6925<_0x539173[_0xe4de('0x38')];_0x4f6925+=0x1){_0x37e3cd=_0x539173[_0x4f6925]['MetricId']?_0x5cdf7d[_0x539173[_0x4f6925][_0xe4de('0x75')]]['metric']:_0x539173[_0x4f6925][_0xe4de('0x6b')];_0x37e3cd=_0x539173[_0x4f6925][_0xe4de('0x77')]?_[_0xe4de('0x78')](_0x559d91[_0x539173[_0x4f6925][_0xe4de('0x77')]],'%s',_0x37e3cd):_0x37e3cd;_0x37e3cd=_0x539173[_0x4f6925][_0xe4de('0x79')]?_[_0xe4de('0x78')](_0x5098fd[_0x539173[_0x4f6925][_0xe4de('0x79')]],'%s',_0x37e3cd):_0x37e3cd;if(_0x539173[_0x4f6925]['groupBy']){_0x18ca02[_0xe4de('0x6a')](_0x37e3cd);}_0x539173[_0x4f6925]['orderBy']&&_0x18ca02[_0xe4de('0x3a')](_0x37e3cd,_0x539173[_0x4f6925][_0xe4de('0x7b')]==='DESC'?![]:!![]);_0x18ca02[_0xe4de('0x6b')](_0x37e3cd,_0x539173[_0x4f6925][_0xe4de('0x7d')]||_0x37e3cd);}if(_0x43993b[_0xe4de('0x7e')]){_0x43993b['joins']=JSON['parse'](_0x43993b['joins']);for(var _0x4bce62=0x0;_0x4bce62<_0x43993b[_0xe4de('0x7e')][_0xe4de('0x38')];_0x4bce62+=0x1){if(_0x43993b['joins'][_0x4bce62][_0xe4de('0x30')]&&_['includes'](_0x40f535,_0x43993b[_0xe4de('0x7e')][_0x4bce62]['type'])&&_0x43993b['joins'][_0x4bce62]['parentKey']&&_0x43993b[_0xe4de('0x7e')][_0x4bce62][_0xe4de('0x81')]&&_0x43993b[_0xe4de('0x7e')][_0x4bce62][_0xe4de('0x90')]){_0x18ca02[_0x43993b['joins'][_0x4bce62][_0xe4de('0x30')]](_0x43993b[_0xe4de('0x7e')][_0x4bce62][_0xe4de('0x81')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x43993b[_0xe4de('0x74')],_0x43993b[_0xe4de('0x7e')][_0x4bce62]['parentKey'],_0x43993b[_0xe4de('0x7e')][_0x4bce62][_0xe4de('0x81')],_0x43993b[_0xe4de('0x7e')][_0x4bce62][_0xe4de('0x90')]));}}}if(_0x43993b[_0xe4de('0x83')]){_0x43993b[_0xe4de('0x83')]=JSON[_0xe4de('0x7f')](_0x43993b[_0xe4de('0x83')]);_0x18ca02[_0xe4de('0x3c')](_0x169817(_0x43993b[_0xe4de('0x83')][_0xe4de('0x6a')]));}_0x91f81b=_0x18ca02[_0xe4de('0x84')]();_0x18ca02[_0xe4de('0x1d')](_0x2f00e2);_0x18ca02[_0xe4de('0x1b')](0x0);return;}})[_0xe4de('0x25')](function(){if(_0x598b24['output']===_0xe4de('0x91')){return null;}var _0x27eca1=_[_0xe4de('0x40')](_0x598b24,{'name':_0x598b24[_0xe4de('0x92')]||_0x598b24['name']||_0x43993b[_0xe4de('0x2b')],'basename':_0x41a2af,'savename':util[_0xe4de('0x79')]('%s-%s.%s',_0x598b24['name']||_0x43993b[_0xe4de('0x2b')],require(_0xe4de('0x93'))[_0xe4de('0x94')](0x4),_0x598b24['output']||_0xe4de('0x95')),'reportId':_0x43993b['id'],'reportType':_0xe4de('0x96')});return db[_0xe4de('0x97')][_0xe4de('0x4a')](_0x27eca1,{'raw':!![]});})[_0xe4de('0x25')](function(_0x4ac93){if(_0x43993b[_0xe4de('0x74')]==='cdr'){_0x91f81b[_0xe4de('0x3c')](_0x43993b[_0xe4de('0x74')]+_0xe4de('0x98'),_0x598b24[_0xe4de('0x99')],_0x598b24[_0xe4de('0x9a')]);}else{_0x91f81b['where'](_0x43993b[_0xe4de('0x74')]+_0xe4de('0x9b'),_0x598b24[_0xe4de('0x99')],_0x598b24[_0xe4de('0x9a')]);}if(_0x4ac93){logger[_0xe4de('0x9c')]('Run\x20Query:',_0x91f81b['toString']());require(_0xe4de('0x9d'))[_0xe4de('0x9e')](path['join'](__dirname,_0xe4de('0x9f'),_0x4ac93['output']),[_0x4ac93['id'],_0x91f81b[_0xe4de('0x87')](),path[_0xe4de('0x56')](__dirname,_0xe4de('0xa0'),_0x4ac93['savename']),_0x41a2af]);return _0x4ac93;}else{var _0x35b343=squel['select']();_0x35b343['from']('('+_0x91f81b[_0xe4de('0x87')]()+')','countTable');_0x35b343[_0xe4de('0x6b')]('COUNT(*)',_0xe4de('0x1e'));_0x91f81b[_0xe4de('0x1d')](_0x598b24['limit']||_0x2f00e2);_0x91f81b[_0xe4de('0x1b')](_0x598b24['offset']||0x0);return dbH['sequelize'][_0xe4de('0x32')](_0x35b343[_0xe4de('0x87')](),{'type':dbH[_0xe4de('0x88')][_0xe4de('0x89')]['SELECT']})[_0xe4de('0x25')](function(_0xc504df){if(!_0xc504df[_0xe4de('0x38')]){_0x2af21a=0x0;}else{_0x2af21a=_0xc504df[0x0][_0xe4de('0x1e')]||0x0;}return dbH[_0xe4de('0x88')][_0xe4de('0x32')](_0x91f81b['toString'](),{'type':dbH[_0xe4de('0x88')]['QueryTypes'][_0xe4de('0x8a')]});})[_0xe4de('0x25')](function(_0x4f6a3d){return{'rows':_0x4f6a3d||[],'count':_0x2af21a};});}});}exports['run']=function(_0x268b00,_0x63b0c8){return runReport(_0x268b00[_0xe4de('0x54')],_0x268b00[_0xe4de('0x32')],_0x268b00[_0xe4de('0x41')])[_0xe4de('0x25')](respondWithResult(_0x63b0c8,null))[_0xe4de('0x46')](handleError(_0x63b0c8,null));};exports[_0xe4de('0xa1')]=runReport;exports[_0xe4de('0x32')]=function(_0x50b4f8,_0x46d8df){var _0x38926b=0xa;var _0x4b57d9=[_0xe4de('0x56'),_0xe4de('0x57'),'right_join',_0xe4de('0x59')];var _0xf5d9fd={'SUM':_0xe4de('0x5a'),'COUNT':_0xe4de('0x5b'),'COUNT DISTINCT':_0xe4de('0x5c'),'MAX':_0xe4de('0x5d'),'MIN':_0xe4de('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xe4de('0x61'),'GROUP_CONCAT DESC':_0xe4de('0x62')};var _0x115a90={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xe4de('0x64'),'HOUR':_0xe4de('0x8b'),'ROUND':_0xe4de('0x8c'),'UNIX_TIMESTAMP':_0xe4de('0x65')};var _0x4527ac=function(_0x2bbb37){return!_[_0xe4de('0x66')]([_0xe4de('0x67'),_0xe4de('0x68'),_0xe4de('0xa2'),_0xe4de('0xa3')],_0x2bbb37);};var _0x1b4084=function(_0x2bc938){if(!_0x2bc938||!_0x2bc938[_0xe4de('0x69')][_0xe4de('0x38')]){return'';}for(var _0x33818b='(',_0x4e5db0=0x0;_0x4e5db0<_0x2bc938[_0xe4de('0x69')]['length'];_0x4e5db0+=0x1){_0x4e5db0>0x0&&(_0x33818b+='\x20'+_0x2bc938[_0xe4de('0x8d')]+'\x20');_0x33818b+=_0x2bc938['rules'][_0x4e5db0][_0xe4de('0x6a')]?_0x1b4084(_0x2bc938[_0xe4de('0x69')][_0x4e5db0][_0xe4de('0x6a')]):_0x2bc938[_0xe4de('0x69')][_0x4e5db0][_0xe4de('0x6b')]+'\x20'+_0x2bc938['rules'][_0x4e5db0]['condition']+(_0x4527ac(_0x2bc938[_0xe4de('0x69')][_0x4e5db0]['condition'])?'\x20'+_0x2bc938[_0xe4de('0x69')][_0x4e5db0][_0xe4de('0x6d')]:'');}return _0x33818b+')';};var _0x53a699={'where':{'id':_0x50b4f8[_0xe4de('0x54')]['id']}},_0x213c06,_0xfc17a8,_0x442946,_0x11f4fe,_0x46e2e6;_0x53a699=_[_0xe4de('0x40')]({},_0x53a699,_0x50b4f8[_0xe4de('0x41')]);return db[_0xe4de('0x43')]['find'](_0x53a699)[_0xe4de('0x25')](function(_0x12dc51){if(_0x12dc51){_0x213c06=_0x12dc51;return _0x12dc51['getFields']();}return null;})[_0xe4de('0x25')](function(_0x424809){if(_0x424809){if(!_0x424809[_0xe4de('0x38')]){throw new db['Sequelize']['ValidationErrorItem'](_0xe4de('0x70'),0x193);}_0xfc17a8=_0x424809;return db['AnalyticMetric'][_0xe4de('0x44')]({'raw':!![]});}return null;})[_0xe4de('0x25')](function(_0x1fe8f6){if(_0x1fe8f6){_0x442946=_[_0xe4de('0x8f')](_0x1fe8f6,'id');var _0x41e67f;var _0x3f7734=squel[_0xe4de('0x72')]();_0x3f7734['from'](_0x213c06[_0xe4de('0x74')]);for(var _0x4ef007=0x0;_0x4ef007<_0xfc17a8['length'];_0x4ef007+=0x1){_0x41e67f=_0xfc17a8[_0x4ef007][_0xe4de('0x75')]?_0x442946[_0xfc17a8[_0x4ef007][_0xe4de('0x75')]][_0xe4de('0x76')]:_0xfc17a8[_0x4ef007][_0xe4de('0x6b')];_0x41e67f=_0xfc17a8[_0x4ef007]['function']?_[_0xe4de('0x78')](_0xf5d9fd[_0xfc17a8[_0x4ef007][_0xe4de('0x77')]],'%s',_0x41e67f):_0x41e67f;_0x41e67f=_0xfc17a8[_0x4ef007][_0xe4de('0x79')]?_[_0xe4de('0x78')](_0x115a90[_0xfc17a8[_0x4ef007]['format']],'%s',_0x41e67f):_0x41e67f;if(_0xfc17a8[_0x4ef007]['groupBy']){_0x3f7734['group'](_0x41e67f);}_0xfc17a8[_0x4ef007]['orderBy']&&_0x3f7734[_0xe4de('0x3a')](_0x41e67f,_0xfc17a8[_0x4ef007][_0xe4de('0x7b')]==='DESC'?![]:!![]);_0x3f7734['field'](_0x41e67f,_0xfc17a8[_0x4ef007][_0xe4de('0x7d')]||_0x41e67f);}if(_0x213c06[_0xe4de('0x7e')]){_0x213c06[_0xe4de('0x7e')]=JSON[_0xe4de('0x7f')](_0x213c06[_0xe4de('0x7e')]);for(var _0x5cf01d=0x0;_0x5cf01d<_0x213c06[_0xe4de('0x7e')][_0xe4de('0x38')];_0x5cf01d+=0x1){if(_0x213c06['joins'][_0x5cf01d]['type']&&_[_0xe4de('0x66')](_0x4b57d9,_0x213c06['joins'][_0x5cf01d][_0xe4de('0x30')])&&_0x213c06[_0xe4de('0x7e')][_0x5cf01d][_0xe4de('0x80')]&&_0x213c06[_0xe4de('0x7e')][_0x5cf01d][_0xe4de('0x81')]&&_0x213c06[_0xe4de('0x7e')][_0x5cf01d]['foreignKey']){_0x3f7734[_0x213c06[_0xe4de('0x7e')][_0x5cf01d][_0xe4de('0x30')]](_0x213c06['joins'][_0x5cf01d]['foreignTable'],null,util[_0xe4de('0x79')](_0xe4de('0x82'),_0x213c06[_0xe4de('0x74')],_0x213c06[_0xe4de('0x7e')][_0x5cf01d][_0xe4de('0x80')],_0x213c06[_0xe4de('0x7e')][_0x5cf01d][_0xe4de('0x81')],_0x213c06['joins'][_0x5cf01d][_0xe4de('0x90')]));}}}if(_0x213c06[_0xe4de('0x83')]){_0x213c06[_0xe4de('0x83')]=JSON[_0xe4de('0x7f')](_0x213c06[_0xe4de('0x83')]);_0x3f7734[_0xe4de('0x3c')](_0x1b4084(_0x213c06[_0xe4de('0x83')][_0xe4de('0x6a')]));}_0x46e2e6=_0x3f7734[_0xe4de('0x84')]();_0x3f7734['limit'](_0x38926b);_0x3f7734[_0xe4de('0x1b')](0x0);logger['debug'](_0xe4de('0x86'),_0x3f7734['toString']());return dbH['sequelize'][_0xe4de('0x32')](_0x3f7734['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0xe4de('0x8a')]});}})['then'](function(){return{'sql':_0x46e2e6[_0xe4de('0x87')]()};})[_0xe4de('0x25')](respondWithResult(_0x46d8df,null))[_0xe4de('0x46')](handleError(_0x46d8df,null));}; \ No newline at end of file +var _0x1409=['update','then','destroy','get','CustomReports','UserProfileResource','error','stack','name','send','index','map','AnalyticCustomReport','fieldName','type','key','intersection','model','query','attributes','fields','nolimit','sort','where','pick','filter','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','length','merge','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','find','userProfileId','body','join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from','table','MetricId','function','replace','format','groupBy','orderBy','order','alias','joins','includes','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','operator','ValidationErrorItem','metric','parse','output','web','fullPath','csv','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','select','countTable','COUNT(*)','run','runReport','AnalyticMetric','DESC','debug','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save'];(function(_0x9d639c,_0x524dbe){var _0x1671de=function(_0x27888e){while(--_0x27888e){_0x9d639c['push'](_0x9d639c['shift']());}};_0x1671de(++_0x524dbe);}(_0x1409,0x79));var _0x9140=function(_0x21729a,_0x374c08){_0x21729a=_0x21729a-0x0;var _0x2db545=_0x1409[_0x21729a];return _0x2db545;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9140('0x0'));var zipdir=require(_0x9140('0x1'));var jsonpatch=require(_0x9140('0x2'));var rp=require(_0x9140('0x3'));var moment=require(_0x9140('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9140('0x5'));var util=require(_0x9140('0x6'));var path=require(_0x9140('0x7'));var sox=require(_0x9140('0x8'));var csv=require(_0x9140('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9140('0xa'));var _=require(_0x9140('0xb'));var squel=require('squel');var crypto=require(_0x9140('0xc'));var jsforce=require(_0x9140('0xd'));var deskjs=require(_0x9140('0xe'));var toCsv=require(_0x9140('0x9'));var querystring=require('querystring');var Papa=require(_0x9140('0xf'));var Redis=require(_0x9140('0x10'));var authService=require(_0x9140('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9140('0x12'));var hardwareService=require(_0x9140('0x13'));var logger=require(_0x9140('0x14'))(_0x9140('0x15'));var utils=require(_0x9140('0x16'));var config=require(_0x9140('0x17'));var licenseUtil=require(_0x9140('0x18'));var db=require(_0x9140('0x19'))['db'];var dbH=require(_0x9140('0x19'))['dbH'];function respondWithStatusCode(_0x4d6996,_0x5d1ab1){_0x5d1ab1=_0x5d1ab1||0xcc;return function(_0x5bcc06){if(_0x5bcc06){return _0x4d6996[_0x9140('0x1a')](_0x5d1ab1);}return _0x4d6996[_0x9140('0x1b')](_0x5d1ab1)['end']();};}function respondWithResult(_0xe3e26,_0x3969d5){_0x3969d5=_0x3969d5||0xc8;return function(_0x23ac20){if(_0x23ac20){return _0xe3e26[_0x9140('0x1b')](_0x3969d5)[_0x9140('0x1c')](_0x23ac20);}};}function respondWithFilteredResult(_0x56bea4,_0x56e5b2){return function(_0x2c3879){if(_0x2c3879){var _0x4fce66=typeof _0x56e5b2[_0x9140('0x1d')]===_0x9140('0x1e')&&typeof _0x56e5b2[_0x9140('0x1f')]===_0x9140('0x1e');var _0x4102f5=_0x2c3879[_0x9140('0x20')];var _0x628bc8=_0x4fce66?0x0:_0x56e5b2[_0x9140('0x1d')];var _0x545256=_0x4fce66?_0x2c3879[_0x9140('0x20')]:_0x56e5b2['offset']+_0x56e5b2[_0x9140('0x1f')];var _0x2ce3a1;if(_0x545256>=_0x4102f5){_0x545256=_0x4102f5;_0x2ce3a1=0xc8;}else{_0x2ce3a1=0xce;}_0x56bea4[_0x9140('0x1b')](_0x2ce3a1);return _0x56bea4['set'](_0x9140('0x21'),_0x628bc8+'-'+_0x545256+'/'+_0x4102f5)[_0x9140('0x1c')](_0x2c3879);}return null;};}function patchUpdates(_0x4d757d){return function(_0x4b5c03){try{jsonpatch['apply'](_0x4b5c03,_0x4d757d,!![]);}catch(_0x460415){return BPromise[_0x9140('0x22')](_0x460415);}return _0x4b5c03[_0x9140('0x23')]();};}function saveUpdates(_0x2f36f3,_0x28c67e){return function(_0x5e21c4){if(_0x5e21c4){return _0x5e21c4[_0x9140('0x24')](_0x2f36f3)[_0x9140('0x25')](function(_0x283e5c){return _0x283e5c;});}return null;};}function removeEntity(_0x436851,_0x316c9b){return function(_0x1cd781){if(_0x1cd781){return _0x1cd781[_0x9140('0x26')]()[_0x9140('0x25')](function(){var _0x5e7c5e=_0x1cd781[_0x9140('0x27')]({'plain':!![]});var _0x26d5b9=_0x9140('0x28');return db[_0x9140('0x29')][_0x9140('0x26')]({'where':{'type':_0x26d5b9,'resourceId':_0x5e7c5e['id']}})[_0x9140('0x25')](function(){return _0x1cd781;});})[_0x9140('0x25')](function(){_0x436851[_0x9140('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50c523,_0x4024a0){return function(_0x35e4ec){if(!_0x35e4ec){_0x50c523[_0x9140('0x1a')](0x194);}return _0x35e4ec;};}function handleError(_0x312748,_0x58b483){_0x58b483=_0x58b483||0x1f4;return function(_0x2c255d){logger[_0x9140('0x2a')](_0x2c255d[_0x9140('0x2b')]);if(_0x2c255d[_0x9140('0x2c')]){delete _0x2c255d[_0x9140('0x2c')];}_0x312748[_0x9140('0x1b')](_0x58b483)[_0x9140('0x2d')](_0x2c255d);};}exports[_0x9140('0x2e')]=function(_0x544dee,_0x9a9ae4){var _0x161749={},_0x4f49e0={},_0x307eca={'count':0x0,'rows':[]};var _0x160a8a=_[_0x9140('0x2f')](db[_0x9140('0x30')]['rawAttributes'],function(_0x34fe6a){return{'name':_0x34fe6a[_0x9140('0x31')],'type':_0x34fe6a[_0x9140('0x32')][_0x9140('0x33')]};});_0x4f49e0['model']=_[_0x9140('0x2f')](_0x160a8a,_0x9140('0x2c'));_0x4f49e0['query']=_['keys'](_0x544dee['query']);_0x4f49e0['filters']=_[_0x9140('0x34')](_0x4f49e0[_0x9140('0x35')],_0x4f49e0[_0x9140('0x36')]);_0x161749[_0x9140('0x37')]=_[_0x9140('0x34')](_0x4f49e0[_0x9140('0x35')],qs[_0x9140('0x38')](_0x544dee['query'][_0x9140('0x38')]));_0x161749[_0x9140('0x37')]=_0x161749[_0x9140('0x37')]['length']?_0x161749[_0x9140('0x37')]:_0x4f49e0[_0x9140('0x35')];if(!_0x544dee[_0x9140('0x36')]['hasOwnProperty'](_0x9140('0x39'))){_0x161749[_0x9140('0x1f')]=qs[_0x9140('0x1f')](_0x544dee[_0x9140('0x36')][_0x9140('0x1f')]);_0x161749['offset']=qs[_0x9140('0x1d')](_0x544dee[_0x9140('0x36')]['offset']);}_0x161749['order']=qs[_0x9140('0x3a')](_0x544dee[_0x9140('0x36')][_0x9140('0x3a')]);_0x161749[_0x9140('0x3b')]=qs['filters'](_[_0x9140('0x3c')](_0x544dee['query'],_0x4f49e0['filters']),_0x160a8a);if(_0x544dee[_0x9140('0x36')][_0x9140('0x3d')]){_0x161749[_0x9140('0x3b')]=_['merge'](_0x161749['where'],{'$or':_[_0x9140('0x2f')](_0x160a8a,function(_0x452fd7){if(_0x452fd7['type']!=='VIRTUAL'){var _0x507ef5={};_0x507ef5[_0x452fd7['name']]={'$like':'%'+_0x544dee[_0x9140('0x36')][_0x9140('0x3d')]+'%'};return _0x507ef5;}})});}_0x161749=_['merge']({},_0x161749,_0x544dee[_0x9140('0x3e')]);var _0x198e46={'where':_0x161749[_0x9140('0x3b')]};return db[_0x9140('0x30')][_0x9140('0x20')](_0x198e46)['then'](function(_0x2f8581){_0x307eca['count']=_0x2f8581;if(_0x544dee[_0x9140('0x36')][_0x9140('0x3f')]){_0x161749['include']=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x9140('0x40')](_0x161749);})[_0x9140('0x25')](function(_0x1d3457){_0x307eca[_0x9140('0x41')]=_0x1d3457;return _0x307eca;})['then'](respondWithFilteredResult(_0x9a9ae4,_0x161749))[_0x9140('0x42')](handleError(_0x9a9ae4,null));};exports['show']=function(_0x696ff2,_0x5329bc){var _0x1de01d={'raw':![],'where':{'id':_0x696ff2[_0x9140('0x43')]['id']}},_0x3f0332={};_0x3f0332[_0x9140('0x35')]=_[_0x9140('0x44')](db['AnalyticCustomReport'][_0x9140('0x45')]);_0x3f0332[_0x9140('0x36')]=_[_0x9140('0x44')](_0x696ff2[_0x9140('0x36')]);_0x3f0332['filters']=_[_0x9140('0x34')](_0x3f0332[_0x9140('0x35')],_0x3f0332[_0x9140('0x36')]);_0x1de01d[_0x9140('0x37')]=_[_0x9140('0x34')](_0x3f0332[_0x9140('0x35')],qs['fields'](_0x696ff2['query'][_0x9140('0x38')]));_0x1de01d[_0x9140('0x37')]=_0x1de01d[_0x9140('0x37')][_0x9140('0x46')]?_0x1de01d[_0x9140('0x37')]:_0x3f0332[_0x9140('0x35')];if(_0x696ff2['query'][_0x9140('0x3f')]){_0x1de01d['include']=[{'all':!![]}];}_0x1de01d=_[_0x9140('0x47')]({},_0x1de01d,_0x696ff2[_0x9140('0x3e')]);return db[_0x9140('0x30')]['find'](_0x1de01d)[_0x9140('0x25')](handleEntityNotFound(_0x5329bc,null))[_0x9140('0x25')](respondWithResult(_0x5329bc,null))[_0x9140('0x42')](handleError(_0x5329bc,null));};exports['create']=function(_0x23ff70,_0x76b97e){return db[_0x9140('0x30')][_0x9140('0x48')](_0x23ff70['body'],{})[_0x9140('0x25')](function(_0x3cab74){var _0x5e4640=_0x23ff70[_0x9140('0x49')][_0x9140('0x27')]({'plain':!![]});if(!_0x5e4640)throw new Error(_0x9140('0x4a'));if(_0x5e4640['role']===_0x9140('0x49')){var _0x2efd86=_0x3cab74[_0x9140('0x27')]({'plain':!![]});var _0x2167b6=_0x9140('0x4b');return db[_0x9140('0x4c')][_0x9140('0x4d')]({'where':{'name':_0x2167b6,'userProfileId':_0x5e4640[_0x9140('0x4e')]},'raw':!![]})[_0x9140('0x25')](function(_0x3bad42){if(_0x3bad42&&_0x3bad42['autoAssociation']===0x0){return db['UserProfileResource'][_0x9140('0x48')]({'name':_0x2efd86['name'],'resourceId':_0x2efd86['id'],'type':_0x9140('0x28'),'sectionId':_0x3bad42['id']},{})['then'](function(){return _0x3cab74;});}else{return _0x3cab74;}})['catch'](function(_0x25c720){logger[_0x9140('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x25c720);throw _0x25c720;});}return _0x3cab74;})[_0x9140('0x25')](respondWithResult(_0x76b97e,0xc9))[_0x9140('0x42')](handleError(_0x76b97e,null));};exports[_0x9140('0x24')]=function(_0x25d2fa,_0x1848f9){if(_0x25d2fa[_0x9140('0x4f')]['id']){delete _0x25d2fa[_0x9140('0x4f')]['id'];}return db['AnalyticCustomReport']['find']({'where':{'id':_0x25d2fa[_0x9140('0x43')]['id']}})[_0x9140('0x25')](handleEntityNotFound(_0x1848f9,null))[_0x9140('0x25')](saveUpdates(_0x25d2fa[_0x9140('0x4f')],null))[_0x9140('0x25')](respondWithResult(_0x1848f9,null))[_0x9140('0x42')](handleError(_0x1848f9,null));};exports['destroy']=function(_0x1a1976,_0x583143){return db[_0x9140('0x30')][_0x9140('0x4d')]({'where':{'id':_0x1a1976[_0x9140('0x43')]['id']}})[_0x9140('0x25')](handleEntityNotFound(_0x583143,null))[_0x9140('0x25')](removeEntity(_0x583143,null))[_0x9140('0x42')](handleError(_0x583143,null));};exports['preview']=function(_0x1b8ff4,_0x503daf){var _0x4dd09b=0xa;var _0x461913=[_0x9140('0x50'),'left_join',_0x9140('0x51'),_0x9140('0x52')];var _0x397794={'SUM':'SUM(%s)','COUNT':_0x9140('0x53'),'COUNT DISTINCT':_0x9140('0x54'),'MAX':_0x9140('0x55'),'MIN':_0x9140('0x56'),'AVG':_0x9140('0x57'),'GROUP_CONCAT':_0x9140('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9140('0x59')};var _0x3e997c={'SEC_TO_TIME':_0x9140('0x5a'),'DATE':_0x9140('0x5b'),'HOUR':_0x9140('0x5c'),'ROUND':_0x9140('0x5d'),'UNIX_TIMESTAMP':_0x9140('0x5e')};var _0x4ed230=function(_0x1eeeec){return!_['includes']([_0x9140('0x5f'),_0x9140('0x60'),_0x9140('0x61'),_0x9140('0x62')],_0x1eeeec);};var _0x1c0612=function(_0x566443){if(!_0x566443||!_0x566443['rules'][_0x9140('0x46')]){return'';}for(var _0xbc10d2='(',_0x30fbe8=0x0;_0x30fbe8<_0x566443[_0x9140('0x63')]['length'];_0x30fbe8+=0x1){_0x30fbe8>0x0&&(_0xbc10d2+='\x20'+_0x566443['operator']+'\x20');_0xbc10d2+=_0x566443[_0x9140('0x63')][_0x30fbe8][_0x9140('0x64')]?_0x1c0612(_0x566443[_0x9140('0x63')][_0x30fbe8]['group']):_0x566443[_0x9140('0x63')][_0x30fbe8][_0x9140('0x65')]+'\x20'+_0x566443[_0x9140('0x63')][_0x30fbe8]['condition']+(_0x4ed230(_0x566443[_0x9140('0x63')][_0x30fbe8][_0x9140('0x66')])?'\x20'+_0x566443['rules'][_0x30fbe8][_0x9140('0x67')]:'');}return _0xbc10d2+')';};var _0x129ea6={'where':{'id':_0x1b8ff4['params']['id']}},_0x3bdcd7,_0x2776b0,_0x1bdbfb,_0x3a30b6,_0x2d1e80;_0x129ea6=_[_0x9140('0x47')]({},_0x129ea6,_0x1b8ff4[_0x9140('0x3e')]);return db[_0x9140('0x30')][_0x9140('0x4d')](_0x129ea6)[_0x9140('0x25')](function(_0x5f2254){if(_0x5f2254){_0x3bdcd7=_0x5f2254;return _0x5f2254[_0x9140('0x68')]();}return null;})[_0x9140('0x25')](function(_0x328d1f){if(_0x328d1f){if(!_0x328d1f[_0x9140('0x46')]){throw new db[(_0x9140('0x69'))]['ValidationErrorItem'](_0x9140('0x6a'),0x193);}_0x2776b0=_0x328d1f;return db['AnalyticMetric'][_0x9140('0x40')]({'raw':!![]});}return null;})[_0x9140('0x25')](function(_0x564de0){if(_0x564de0){_0x1bdbfb=_[_0x9140('0x6b')](_0x564de0,'id');var _0xad25d6;var _0x1c63d2=squel['select']();_0x1c63d2[_0x9140('0x6c')](_0x3bdcd7[_0x9140('0x6d')]);for(var _0x40caee=0x0;_0x40caee<_0x2776b0[_0x9140('0x46')];_0x40caee+=0x1){_0xad25d6=_0x2776b0[_0x40caee]['MetricId']?_0x1bdbfb[_0x2776b0[_0x40caee][_0x9140('0x6e')]]['metric']:_0x2776b0[_0x40caee]['field'];_0xad25d6=_0x2776b0[_0x40caee][_0x9140('0x6f')]?_[_0x9140('0x70')](_0x397794[_0x2776b0[_0x40caee][_0x9140('0x6f')]],'%s',_0xad25d6):_0xad25d6;_0xad25d6=_0x2776b0[_0x40caee][_0x9140('0x71')]?_[_0x9140('0x70')](_0x3e997c[_0x2776b0[_0x40caee][_0x9140('0x71')]],'%s',_0xad25d6):_0xad25d6;if(_0x2776b0[_0x40caee][_0x9140('0x72')]){_0x1c63d2[_0x9140('0x64')](_0xad25d6);}_0x2776b0[_0x40caee][_0x9140('0x73')]&&_0x1c63d2[_0x9140('0x74')](_0xad25d6,_0x2776b0[_0x40caee][_0x9140('0x73')]==='DESC'?![]:!![]);_0x1c63d2[_0x9140('0x65')](_0xad25d6,_0x2776b0[_0x40caee][_0x9140('0x75')]||_0xad25d6);}if(_0x3bdcd7[_0x9140('0x76')]){_0x3bdcd7[_0x9140('0x76')]=JSON['parse'](_0x3bdcd7[_0x9140('0x76')]);for(var _0x2aa9ff=0x0;_0x2aa9ff<_0x3bdcd7[_0x9140('0x76')][_0x9140('0x46')];_0x2aa9ff+=0x1){if(_0x3bdcd7[_0x9140('0x76')][_0x2aa9ff][_0x9140('0x32')]&&_[_0x9140('0x77')](_0x461913,_0x3bdcd7[_0x9140('0x76')][_0x2aa9ff][_0x9140('0x32')])&&_0x3bdcd7[_0x9140('0x76')][_0x2aa9ff][_0x9140('0x78')]&&_0x3bdcd7[_0x9140('0x76')][_0x2aa9ff]['foreignTable']&&_0x3bdcd7[_0x9140('0x76')][_0x2aa9ff][_0x9140('0x79')]){_0x1c63d2[_0x3bdcd7['joins'][_0x2aa9ff][_0x9140('0x32')]](_0x3bdcd7[_0x9140('0x76')][_0x2aa9ff][_0x9140('0x7a')],null,util['format'](_0x9140('0x7b'),_0x3bdcd7[_0x9140('0x6d')],_0x3bdcd7[_0x9140('0x76')][_0x2aa9ff][_0x9140('0x78')],_0x3bdcd7['joins'][_0x2aa9ff][_0x9140('0x7a')],_0x3bdcd7[_0x9140('0x76')][_0x2aa9ff][_0x9140('0x79')]));}}}if(_0x3bdcd7[_0x9140('0x7c')]){_0x3bdcd7[_0x9140('0x7c')]=JSON['parse'](_0x3bdcd7[_0x9140('0x7c')]);_0x1c63d2[_0x9140('0x3b')](_0x1c0612(_0x3bdcd7[_0x9140('0x7c')][_0x9140('0x64')]));}_0x2d1e80=_0x1c63d2[_0x9140('0x7d')]();_0x1c63d2[_0x9140('0x1f')](_0x4dd09b);_0x1c63d2[_0x9140('0x1d')](0x0);logger['debug'](_0x9140('0x7e'),_0x1c63d2[_0x9140('0x7f')]());return dbH[_0x9140('0x80')][_0x9140('0x36')](_0x1c63d2[_0x9140('0x7f')](),{'type':dbH[_0x9140('0x80')][_0x9140('0x81')][_0x9140('0x82')]});}})[_0x9140('0x25')](respondWithResult(_0x503daf,null))[_0x9140('0x42')](handleError(_0x503daf,null));};function runReport(_0xe9d458,_0x535f9c,_0x28436d){var _0x466e63=_0x535f9c[_0x9140('0x2c')];var _0x4e8825=0xa;var _0x260d86=[_0x9140('0x50'),_0x9140('0x83'),_0x9140('0x51'),_0x9140('0x52')];var _0x555589={'SUM':'SUM(%s)','COUNT':_0x9140('0x53'),'COUNT DISTINCT':_0x9140('0x54'),'MAX':'MAX(%s)','MIN':_0x9140('0x56'),'AVG':_0x9140('0x57'),'GROUP_CONCAT':_0x9140('0x58'),'GROUP_CONCAT ASC':_0x9140('0x84'),'GROUP_CONCAT DESC':_0x9140('0x59')};var _0x3cbbd7={'SEC_TO_TIME':_0x9140('0x5a'),'DATE':'DATE(%s)','HOUR':_0x9140('0x5c'),'ROUND':_0x9140('0x5d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x47a891=function(_0x153350){return!_[_0x9140('0x77')]([_0x9140('0x5f'),_0x9140('0x60'),_0x9140('0x61'),_0x9140('0x62')],_0x153350);};var _0x53aa8c=function(_0x385ef5){if(!_0x385ef5||!_0x385ef5[_0x9140('0x63')]['length']){return'';}for(var _0x54b2e7='(',_0x1cadbc=0x0;_0x1cadbc<_0x385ef5[_0x9140('0x63')][_0x9140('0x46')];_0x1cadbc+=0x1){_0x1cadbc>0x0&&(_0x54b2e7+='\x20'+_0x385ef5[_0x9140('0x85')]+'\x20');_0x54b2e7+=_0x385ef5[_0x9140('0x63')][_0x1cadbc][_0x9140('0x64')]?_0x53aa8c(_0x385ef5['rules'][_0x1cadbc]['group']):_0x385ef5[_0x9140('0x63')][_0x1cadbc][_0x9140('0x65')]+'\x20'+_0x385ef5['rules'][_0x1cadbc]['condition']+(_0x47a891(_0x385ef5[_0x9140('0x63')][_0x1cadbc][_0x9140('0x66')])?'\x20'+_0x385ef5[_0x9140('0x63')][_0x1cadbc][_0x9140('0x67')]:'');}return _0x54b2e7+')';};var _0x2ec93f={'where':{'id':_0xe9d458['id']}},_0x599937,_0x200c3a,_0x19195e,_0x578f34,_0x475800;_0x2ec93f=_[_0x9140('0x47')]({},_0x2ec93f,_0x28436d);return db[_0x9140('0x30')][_0x9140('0x4d')](_0x2ec93f)[_0x9140('0x25')](function(_0x4bc0b6){if(_0x4bc0b6){_0x599937=_0x4bc0b6;return _0x4bc0b6[_0x9140('0x68')]();}return null;})[_0x9140('0x25')](function(_0x3bb84a){if(_0x3bb84a){if(!_0x3bb84a[_0x9140('0x46')]){throw new db['Sequelize'][(_0x9140('0x86'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x200c3a=_0x3bb84a;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x9140('0x25')](function(_0x2bfd25){if(_0x2bfd25){_0x19195e=_[_0x9140('0x6b')](_0x2bfd25,'id');var _0x157448;var _0x203c79=squel['select']();_0x203c79[_0x9140('0x6c')](_0x599937['table']);for(var _0x9dacf5=0x0;_0x9dacf5<_0x200c3a[_0x9140('0x46')];_0x9dacf5+=0x1){_0x157448=_0x200c3a[_0x9dacf5][_0x9140('0x6e')]?_0x19195e[_0x200c3a[_0x9dacf5]['MetricId']][_0x9140('0x87')]:_0x200c3a[_0x9dacf5][_0x9140('0x65')];_0x157448=_0x200c3a[_0x9dacf5]['function']?_[_0x9140('0x70')](_0x555589[_0x200c3a[_0x9dacf5][_0x9140('0x6f')]],'%s',_0x157448):_0x157448;_0x157448=_0x200c3a[_0x9dacf5][_0x9140('0x71')]?_[_0x9140('0x70')](_0x3cbbd7[_0x200c3a[_0x9dacf5]['format']],'%s',_0x157448):_0x157448;if(_0x200c3a[_0x9dacf5][_0x9140('0x72')]){_0x203c79['group'](_0x157448);}_0x200c3a[_0x9dacf5]['orderBy']&&_0x203c79['order'](_0x157448,_0x200c3a[_0x9dacf5][_0x9140('0x73')]==='DESC'?![]:!![]);_0x203c79[_0x9140('0x65')](_0x157448,_0x200c3a[_0x9dacf5][_0x9140('0x75')]||_0x157448);}if(_0x599937[_0x9140('0x76')]){_0x599937[_0x9140('0x76')]=JSON[_0x9140('0x88')](_0x599937[_0x9140('0x76')]);for(var _0x500e9b=0x0;_0x500e9b<_0x599937[_0x9140('0x76')][_0x9140('0x46')];_0x500e9b+=0x1){if(_0x599937[_0x9140('0x76')][_0x500e9b][_0x9140('0x32')]&&_[_0x9140('0x77')](_0x260d86,_0x599937['joins'][_0x500e9b][_0x9140('0x32')])&&_0x599937[_0x9140('0x76')][_0x500e9b][_0x9140('0x78')]&&_0x599937['joins'][_0x500e9b][_0x9140('0x7a')]&&_0x599937[_0x9140('0x76')][_0x500e9b][_0x9140('0x79')]){_0x203c79[_0x599937[_0x9140('0x76')][_0x500e9b][_0x9140('0x32')]](_0x599937[_0x9140('0x76')][_0x500e9b][_0x9140('0x7a')],null,util[_0x9140('0x71')]('%s.%s\x20=\x20%s.%s',_0x599937[_0x9140('0x6d')],_0x599937[_0x9140('0x76')][_0x500e9b][_0x9140('0x78')],_0x599937[_0x9140('0x76')][_0x500e9b][_0x9140('0x7a')],_0x599937[_0x9140('0x76')][_0x500e9b][_0x9140('0x79')]));}}}if(_0x599937[_0x9140('0x7c')]){_0x599937[_0x9140('0x7c')]=JSON[_0x9140('0x88')](_0x599937[_0x9140('0x7c')]);_0x203c79['where'](_0x53aa8c(_0x599937['conditions']['group']));}_0x475800=_0x203c79[_0x9140('0x7d')]();_0x203c79[_0x9140('0x1f')](_0x4e8825);_0x203c79['offset'](0x0);return;}})[_0x9140('0x25')](function(){if(_0x535f9c[_0x9140('0x89')]===_0x9140('0x8a')){return null;}var _0x2a82ac=_[_0x9140('0x47')](_0x535f9c,{'name':_0x535f9c[_0x9140('0x8b')]||_0x535f9c[_0x9140('0x2c')]||_0x599937[_0x9140('0x2c')],'basename':_0x466e63,'savename':util[_0x9140('0x71')]('%s-%s.%s',_0x535f9c[_0x9140('0x2c')]||_0x599937[_0x9140('0x2c')],require('randomstring')['generate'](0x4),_0x535f9c['output']||_0x9140('0x8c')),'reportId':_0x599937['id'],'reportType':'custom'});return db[_0x9140('0x8d')][_0x9140('0x48')](_0x2a82ac,{'raw':!![]});})[_0x9140('0x25')](function(_0x4bd201){if(_0x599937['table']==='cdr'){_0x475800[_0x9140('0x3b')](_0x599937[_0x9140('0x6d')]+_0x9140('0x8e'),_0x535f9c[_0x9140('0x8f')],_0x535f9c[_0x9140('0x90')]);}else{_0x475800['where'](_0x599937[_0x9140('0x6d')]+_0x9140('0x91'),_0x535f9c[_0x9140('0x8f')],_0x535f9c['endDate']);}if(_0x4bd201){logger[_0x9140('0x92')]('Run\x20Query:',_0x475800[_0x9140('0x7f')]());require(_0x9140('0x93'))[_0x9140('0x94')](path['join'](__dirname,'../../components/export/',_0x4bd201[_0x9140('0x89')]),[_0x4bd201['id'],_0x475800[_0x9140('0x7f')](),path[_0x9140('0x50')](__dirname,'../../files/reports',_0x4bd201['savename']),_0x466e63]);return _0x4bd201;}else{var _0x2dcdc4=squel[_0x9140('0x95')]();_0x2dcdc4[_0x9140('0x6c')]('('+_0x475800[_0x9140('0x7f')]()+')',_0x9140('0x96'));_0x2dcdc4[_0x9140('0x65')](_0x9140('0x97'),'count');_0x475800[_0x9140('0x1f')](_0x535f9c[_0x9140('0x1f')]||_0x4e8825);_0x475800['offset'](_0x535f9c[_0x9140('0x1d')]||0x0);return dbH[_0x9140('0x80')][_0x9140('0x36')](_0x2dcdc4[_0x9140('0x7f')](),{'type':dbH[_0x9140('0x80')]['QueryTypes'][_0x9140('0x82')]})[_0x9140('0x25')](function(_0x5ef896){if(!_0x5ef896[_0x9140('0x46')]){_0x578f34=0x0;}else{_0x578f34=_0x5ef896[0x0][_0x9140('0x20')]||0x0;}return dbH['sequelize'][_0x9140('0x36')](_0x475800[_0x9140('0x7f')](),{'type':dbH[_0x9140('0x80')][_0x9140('0x81')][_0x9140('0x82')]});})[_0x9140('0x25')](function(_0xf60651){return{'rows':_0xf60651||[],'count':_0x578f34};});}});}exports[_0x9140('0x98')]=function(_0x3bea0e,_0x57a535){return runReport(_0x3bea0e[_0x9140('0x43')],_0x3bea0e[_0x9140('0x36')],_0x3bea0e[_0x9140('0x3e')])[_0x9140('0x25')](respondWithResult(_0x57a535,null))['catch'](handleError(_0x57a535,null));};exports[_0x9140('0x99')]=runReport;exports[_0x9140('0x36')]=function(_0x1ae889,_0x97f6c4){var _0x2440e9=0xa;var _0x3377fe=[_0x9140('0x50'),_0x9140('0x83'),_0x9140('0x51'),'cross_join'];var _0x312a06={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x9140('0x54'),'MAX':_0x9140('0x55'),'MIN':_0x9140('0x56'),'AVG':_0x9140('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x9140('0x84'),'GROUP_CONCAT DESC':_0x9140('0x59')};var _0x57ef27={'SEC_TO_TIME':_0x9140('0x5a'),'DATE':_0x9140('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0x9140('0x5d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4b1cf2=function(_0x3fb192){return!_[_0x9140('0x77')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0x9140('0x62')],_0x3fb192);};var _0x44cc87=function(_0x479104){if(!_0x479104||!_0x479104[_0x9140('0x63')]['length']){return'';}for(var _0x3553e3='(',_0x58377f=0x0;_0x58377f<_0x479104[_0x9140('0x63')][_0x9140('0x46')];_0x58377f+=0x1){_0x58377f>0x0&&(_0x3553e3+='\x20'+_0x479104[_0x9140('0x85')]+'\x20');_0x3553e3+=_0x479104['rules'][_0x58377f][_0x9140('0x64')]?_0x44cc87(_0x479104[_0x9140('0x63')][_0x58377f][_0x9140('0x64')]):_0x479104[_0x9140('0x63')][_0x58377f][_0x9140('0x65')]+'\x20'+_0x479104[_0x9140('0x63')][_0x58377f][_0x9140('0x66')]+(_0x4b1cf2(_0x479104['rules'][_0x58377f]['condition'])?'\x20'+_0x479104[_0x9140('0x63')][_0x58377f][_0x9140('0x67')]:'');}return _0x3553e3+')';};var _0x4060d9={'where':{'id':_0x1ae889[_0x9140('0x43')]['id']}},_0x4d481d,_0x35bc14,_0xbbd268,_0x28efdb,_0x300933;_0x4060d9=_[_0x9140('0x47')]({},_0x4060d9,_0x1ae889[_0x9140('0x3e')]);return db[_0x9140('0x30')][_0x9140('0x4d')](_0x4060d9)[_0x9140('0x25')](function(_0x1ed422){if(_0x1ed422){_0x4d481d=_0x1ed422;return _0x1ed422[_0x9140('0x68')]();}return null;})['then'](function(_0x421acd){if(_0x421acd){if(!_0x421acd[_0x9140('0x46')]){throw new db[(_0x9140('0x69'))][(_0x9140('0x86'))](_0x9140('0x6a'),0x193);}_0x35bc14=_0x421acd;return db[_0x9140('0x9a')]['findAll']({'raw':!![]});}return null;})[_0x9140('0x25')](function(_0x4eac0f){if(_0x4eac0f){_0xbbd268=_[_0x9140('0x6b')](_0x4eac0f,'id');var _0x3b7359;var _0x44093a=squel[_0x9140('0x95')]();_0x44093a['from'](_0x4d481d[_0x9140('0x6d')]);for(var _0x5ccd9d=0x0;_0x5ccd9d<_0x35bc14['length'];_0x5ccd9d+=0x1){_0x3b7359=_0x35bc14[_0x5ccd9d][_0x9140('0x6e')]?_0xbbd268[_0x35bc14[_0x5ccd9d]['MetricId']][_0x9140('0x87')]:_0x35bc14[_0x5ccd9d][_0x9140('0x65')];_0x3b7359=_0x35bc14[_0x5ccd9d]['function']?_[_0x9140('0x70')](_0x312a06[_0x35bc14[_0x5ccd9d]['function']],'%s',_0x3b7359):_0x3b7359;_0x3b7359=_0x35bc14[_0x5ccd9d][_0x9140('0x71')]?_[_0x9140('0x70')](_0x57ef27[_0x35bc14[_0x5ccd9d]['format']],'%s',_0x3b7359):_0x3b7359;if(_0x35bc14[_0x5ccd9d]['groupBy']){_0x44093a[_0x9140('0x64')](_0x3b7359);}_0x35bc14[_0x5ccd9d]['orderBy']&&_0x44093a[_0x9140('0x74')](_0x3b7359,_0x35bc14[_0x5ccd9d][_0x9140('0x73')]===_0x9140('0x9b')?![]:!![]);_0x44093a['field'](_0x3b7359,_0x35bc14[_0x5ccd9d][_0x9140('0x75')]||_0x3b7359);}if(_0x4d481d[_0x9140('0x76')]){_0x4d481d[_0x9140('0x76')]=JSON[_0x9140('0x88')](_0x4d481d[_0x9140('0x76')]);for(var _0x306afb=0x0;_0x306afb<_0x4d481d['joins'][_0x9140('0x46')];_0x306afb+=0x1){if(_0x4d481d[_0x9140('0x76')][_0x306afb][_0x9140('0x32')]&&_['includes'](_0x3377fe,_0x4d481d[_0x9140('0x76')][_0x306afb][_0x9140('0x32')])&&_0x4d481d[_0x9140('0x76')][_0x306afb][_0x9140('0x78')]&&_0x4d481d[_0x9140('0x76')][_0x306afb][_0x9140('0x7a')]&&_0x4d481d[_0x9140('0x76')][_0x306afb][_0x9140('0x79')]){_0x44093a[_0x4d481d[_0x9140('0x76')][_0x306afb][_0x9140('0x32')]](_0x4d481d[_0x9140('0x76')][_0x306afb][_0x9140('0x7a')],null,util[_0x9140('0x71')]('%s.%s\x20=\x20%s.%s',_0x4d481d['table'],_0x4d481d[_0x9140('0x76')][_0x306afb][_0x9140('0x78')],_0x4d481d['joins'][_0x306afb][_0x9140('0x7a')],_0x4d481d[_0x9140('0x76')][_0x306afb][_0x9140('0x79')]));}}}if(_0x4d481d[_0x9140('0x7c')]){_0x4d481d['conditions']=JSON['parse'](_0x4d481d[_0x9140('0x7c')]);_0x44093a['where'](_0x44cc87(_0x4d481d[_0x9140('0x7c')][_0x9140('0x64')]));}_0x300933=_0x44093a[_0x9140('0x7d')]();_0x44093a[_0x9140('0x1f')](_0x2440e9);_0x44093a[_0x9140('0x1d')](0x0);logger[_0x9140('0x9c')](_0x9140('0x7e'),_0x44093a[_0x9140('0x7f')]());return dbH[_0x9140('0x80')][_0x9140('0x36')](_0x44093a['toString'](),{'type':dbH[_0x9140('0x80')]['QueryTypes'][_0x9140('0x82')]});}})['then'](function(){return{'sql':_0x300933[_0x9140('0x7f')]()};})[_0x9140('0x25')](respondWithResult(_0x97f6c4,null))['catch'](handleError(_0x97f6c4,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 2443d4a..2bbba66 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 _0x093a=['moment','bluebird','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger'];(function(_0x4e0c31,_0x208e9f){var _0x3fd7df=function(_0x5ee817){while(--_0x5ee817){_0x4e0c31['push'](_0x4e0c31['shift']());}};_0x3fd7df(++_0x208e9f);}(_0x093a,0x1b6));var _0xa093=function(_0x456a4b,_0x51df8){_0x456a4b=_0x456a4b-0x0;var _0x42957c=_0x093a[_0x456a4b];return _0x42957c;};'use strict';var _=require(_0xa093('0x0'));var util=require('util');var logger=require(_0xa093('0x1'))('api');var moment=require(_0xa093('0x2'));var BPromise=require(_0xa093('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa093('0x4'));var config=require(_0xa093('0x5'));var attributes=require(_0xa093('0x6'));module[_0xa093('0x7')]=function(_0x4cbff8,_0x123144){return _0x4cbff8[_0xa093('0x8')](_0xa093('0x9'),attributes,{'tableName':_0xa093('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b6b=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','analytics_custom_reports'];(function(_0x680821,_0x23e67f){var _0x3f132c=function(_0x1bbcea){while(--_0x1bbcea){_0x680821['push'](_0x680821['shift']());}};_0x3f132c(++_0x23e67f);}(_0x8b6b,0x15e));var _0xb8b6=function(_0x2afb28,_0x19e8b0){_0x2afb28=_0x2afb28-0x0;var _0x41d764=_0x8b6b[_0x2afb28];return _0x41d764;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb8b6('0x0'))('api');var moment=require(_0xb8b6('0x1'));var BPromise=require(_0xb8b6('0x2'));var rp=require(_0xb8b6('0x3'));var fs=require('fs');var path=require(_0xb8b6('0x4'));var rimraf=require(_0xb8b6('0x5'));var config=require(_0xb8b6('0x6'));var attributes=require(_0xb8b6('0x7'));module[_0xb8b6('0x8')]=function(_0x452ddb,_0xd0564){return _0x452ddb['define']('AnalyticCustomReport',attributes,{'tableName':_0xb8b6('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index d8c747c..820dbf6 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 _0xdc46=['../../config/environment','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x14e517,_0x56cee3){var _0x52bdde=function(_0x3e7ca4){while(--_0x3e7ca4){_0x14e517['push'](_0x14e517['shift']());}};_0x52bdde(++_0x56cee3);}(_0xdc46,0xcb));var _0x6dc4=function(_0x4176c5,_0x497677){_0x4176c5=_0x4176c5-0x0;var _0x305a70=_0xdc46[_0x4176c5];return _0x305a70;};'use strict';var _=require(_0x6dc4('0x0'));var util=require(_0x6dc4('0x1'));var moment=require(_0x6dc4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6dc4('0x3'))['db'];var utils=require(_0x6dc4('0x4'));var logger=require(_0x6dc4('0x5'))(_0x6dc4('0x6'));var config=require(_0x6dc4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6dc4('0x8')][_0x6dc4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x328bd3,_0x54260a,_0x20bc90){return new BPromise(function(_0x274833,_0x394266){return client[_0x6dc4('0xa')](_0x328bd3,_0x20bc90)[_0x6dc4('0xb')](function(_0x192093){logger[_0x6dc4('0xc')](_0x6dc4('0xd'),_0x54260a,'request\x20sent');logger['debug'](_0x6dc4('0xe'),_0x54260a,_0x6dc4('0xf'),JSON['stringify'](_0x192093));if(_0x192093['error']){if(_0x192093[_0x6dc4('0x10')][_0x6dc4('0x11')]===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x54260a,_0x192093[_0x6dc4('0x10')][_0x6dc4('0x12')]);return _0x394266(_0x192093[_0x6dc4('0x10')][_0x6dc4('0x12')]);}logger[_0x6dc4('0x10')](_0x6dc4('0xd'),_0x54260a,_0x192093[_0x6dc4('0x10')][_0x6dc4('0x12')]);return _0x274833(_0x192093[_0x6dc4('0x10')]['message']);}else{logger[_0x6dc4('0xc')](_0x6dc4('0xd'),_0x54260a,_0x6dc4('0xf'));_0x274833(_0x192093[_0x6dc4('0x13')][_0x6dc4('0x12')]);}})[_0x6dc4('0x14')](function(_0x2f9b10){logger[_0x6dc4('0x10')](_0x6dc4('0xd'),_0x54260a,_0x2f9b10);_0x394266(_0x2f9b10);});});} \ No newline at end of file +var _0xb701=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x192099,_0x38a593){var _0x3d6ccc=function(_0x541fff){while(--_0x541fff){_0x192099['push'](_0x192099['shift']());}};_0x3d6ccc(++_0x38a593);}(_0xb701,0x1c6));var _0x1b70=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xb701[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x1b70('0x0'));var util=require(_0x1b70('0x1'));var moment=require(_0x1b70('0x2'));var BPromise=require(_0x1b70('0x3'));var rs=require(_0x1b70('0x4'));var fs=require('fs');var Redis=require(_0x1b70('0x5'));var db=require(_0x1b70('0x6'))['db'];var utils=require(_0x1b70('0x7'));var logger=require(_0x1b70('0x8'))(_0x1b70('0x9'));var config=require(_0x1b70('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x1b70('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b9d91,_0x26648b,_0x30e717){return new BPromise(function(_0x2a94aa,_0x354d35){return client['request'](_0x5b9d91,_0x30e717)[_0x1b70('0xc')](function(_0x4a4dcc){logger[_0x1b70('0xd')](_0x1b70('0xe'),_0x26648b,'request\x20sent');logger[_0x1b70('0xf')](_0x1b70('0x10'),_0x26648b,'request\x20sent',JSON[_0x1b70('0x11')](_0x4a4dcc));if(_0x4a4dcc[_0x1b70('0x12')]){if(_0x4a4dcc[_0x1b70('0x12')][_0x1b70('0x13')]===0x1f4){logger[_0x1b70('0x12')](_0x1b70('0xe'),_0x26648b,_0x4a4dcc[_0x1b70('0x12')][_0x1b70('0x14')]);return _0x354d35(_0x4a4dcc[_0x1b70('0x12')][_0x1b70('0x14')]);}logger[_0x1b70('0x12')](_0x1b70('0xe'),_0x26648b,_0x4a4dcc['error'][_0x1b70('0x14')]);return _0x2a94aa(_0x4a4dcc[_0x1b70('0x12')][_0x1b70('0x14')]);}else{logger[_0x1b70('0xd')](_0x1b70('0xe'),_0x26648b,_0x1b70('0x15'));_0x2a94aa(_0x4a4dcc['result'][_0x1b70('0x14')]);}})[_0x1b70('0x16')](function(_0x573580){logger['error'](_0x1b70('0xe'),_0x26648b,_0x573580);_0x354d35(_0x573580);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 2227ea0..39e6109 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 _0x037e=['/:id/preview','preview','put','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x037e,0x136));var _0xe037=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x037e[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xe037('0x0'));var util=require(_0xe037('0x1'));var path=require(_0xe037('0x2'));var timeout=require(_0xe037('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe037('0x4'));var auth=require(_0xe037('0x5'));var interaction=require(_0xe037('0x6'));var config=require(_0xe037('0x7'));var controller=require(_0xe037('0x8'));router[_0xe037('0x9')]('/',auth[_0xe037('0xa')](),controller[_0xe037('0xb')]);router[_0xe037('0x9')](_0xe037('0xc'),auth[_0xe037('0xa')](),controller['show']);router['get'](_0xe037('0xd'),auth['isAuthenticated'](),controller[_0xe037('0xe')]);router[_0xe037('0x9')]('/:id/run',auth['isAuthenticated'](),controller['run']);router['get']('/:id/query',auth['isAuthenticated'](),controller['query']);router['post']('/',auth[_0xe037('0xa')](),controller['create']);router[_0xe037('0xf')](_0xe037('0xc'),auth[_0xe037('0xa')](),controller[_0xe037('0x10')]);router[_0xe037('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xe037('0x12')]=router; \ No newline at end of file +var _0x3133=['destroy','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','index','isAuthenticated','show','/:id/preview','preview','run','/:id/query','query','post','create','put','/:id','update','delete'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x3133,0x9b));var _0x3313=function(_0x555e2f,_0x1e1550){_0x555e2f=_0x555e2f-0x0;var _0x3e2fbd=_0x3133[_0x555e2f];return _0x3e2fbd;};'use strict';var multer=require(_0x3313('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3313('0x1')]();var fs_extra=require(_0x3313('0x2'));var auth=require(_0x3313('0x3'));var interaction=require(_0x3313('0x4'));var config=require('../../config/environment');var controller=require(_0x3313('0x5'));router[_0x3313('0x6')]('/',auth['isAuthenticated'](),controller[_0x3313('0x7')]);router[_0x3313('0x6')]('/:id',auth[_0x3313('0x8')](),controller[_0x3313('0x9')]);router[_0x3313('0x6')](_0x3313('0xa'),auth[_0x3313('0x8')](),controller[_0x3313('0xb')]);router['get']('/:id/run',auth[_0x3313('0x8')](),controller[_0x3313('0xc')]);router[_0x3313('0x6')](_0x3313('0xd'),auth[_0x3313('0x8')](),controller[_0x3313('0xe')]);router[_0x3313('0xf')]('/',auth[_0x3313('0x8')](),controller[_0x3313('0x10')]);router[_0x3313('0x11')](_0x3313('0x12'),auth[_0x3313('0x8')](),controller[_0x3313('0x13')]);router[_0x3313('0x14')]('/:id',auth[_0x3313('0x8')](),controller[_0x3313('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index f552608..9377580 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 _0x46ed=['sequelize','exports','STRING','TEXT'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x46ed,0x168));var _0xd46e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x46ed[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd46e('0x2')]},'parent':{'type':Sequelize[_0xd46e('0x2')]},'table':{'type':Sequelize[_0xd46e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xd46e('0x3')]}}; \ No newline at end of file +var _0x5d17=['sequelize','exports','STRING','TEXT'];(function(_0x415b65,_0x108c91){var _0x253100=function(_0x34398f){while(--_0x34398f){_0x415b65['push'](_0x415b65['shift']());}};_0x253100(++_0x108c91);}(_0x5d17,0x114));var _0x75d1=function(_0x18be96,_0x15e628){_0x18be96=_0x18be96-0x0;var _0x4b9baa=_0x5d17[_0x18be96];return _0x4b9baa;};'use strict';var Sequelize=require(_0x75d1('0x0'));module[_0x75d1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x75d1('0x2')]},'table':{'type':Sequelize[_0x75d1('0x2')]},'conditions':{'type':Sequelize[_0x75d1('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 b5edaa6..568b2ef 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 _0x3f8a=['get','DefaultReports','end','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','keys','intersection','model','attributes','fields','query','order','sort','filters','pick','filter','merge','VIRTUAL','options','where','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','length','operator','group','field','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','Limited\x20Query:','sequelize','toString','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NULL','condition','ValidationErrorItem','metric','DESC','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','QueryTypes','run','runReport','%s.%s\x20=\x20%s.%s','debug','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','then'];(function(_0x2dbe55,_0x117ce0){var _0x47687e=function(_0x5a676c){while(--_0x5a676c){_0x2dbe55['push'](_0x2dbe55['shift']());}};_0x47687e(++_0x117ce0);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x20909c,_0x3ffc7c){_0x20909c=_0x20909c-0x0;var _0x4fc341=_0x3f8a[_0x20909c];return _0x4fc341;};'use strict';var emlformat=require(_0xa3f8('0x0'));var rimraf=require(_0xa3f8('0x1'));var zipdir=require(_0xa3f8('0x2'));var jsonpatch=require(_0xa3f8('0x3'));var rp=require('request-promise');var moment=require(_0xa3f8('0x4'));var BPromise=require(_0xa3f8('0x5'));var Mustache=require(_0xa3f8('0x6'));var util=require(_0xa3f8('0x7'));var path=require(_0xa3f8('0x8'));var sox=require(_0xa3f8('0x9'));var csv=require(_0xa3f8('0xa'));var ejs=require(_0xa3f8('0xb'));var fs=require('fs');var fs_extra=require(_0xa3f8('0xc'));var _=require(_0xa3f8('0xd'));var squel=require(_0xa3f8('0xe'));var crypto=require(_0xa3f8('0xf'));var jsforce=require(_0xa3f8('0x10'));var deskjs=require(_0xa3f8('0x11'));var toCsv=require(_0xa3f8('0xa'));var querystring=require(_0xa3f8('0x12'));var Papa=require(_0xa3f8('0x13'));var Redis=require('ioredis');var authService=require(_0xa3f8('0x14'));var qs=require(_0xa3f8('0x15'));var as=require(_0xa3f8('0x16'));var hardwareService=require(_0xa3f8('0x17'));var logger=require('../../config/logger')(_0xa3f8('0x18'));var utils=require(_0xa3f8('0x19'));var config=require(_0xa3f8('0x1a'));var licenseUtil=require(_0xa3f8('0x1b'));var db=require(_0xa3f8('0x1c'))['db'];var dbH=require(_0xa3f8('0x1c'))[_0xa3f8('0x1d')];function respondWithStatusCode(_0x63de8b,_0x324aa8){_0x324aa8=_0x324aa8||0xcc;return function(_0x36b1b8){if(_0x36b1b8){return _0x63de8b[_0xa3f8('0x1e')](_0x324aa8);}return _0x63de8b[_0xa3f8('0x1f')](_0x324aa8)['end']();};}function respondWithResult(_0x2d8f74,_0xe55848){_0xe55848=_0xe55848||0xc8;return function(_0x45014f){if(_0x45014f){return _0x2d8f74[_0xa3f8('0x1f')](_0xe55848)['json'](_0x45014f);}};}function respondWithFilteredResult(_0x39c450,_0x33b98e){return function(_0x46a8d9){if(_0x46a8d9){var _0x8cd130=typeof _0x33b98e[_0xa3f8('0x20')]===_0xa3f8('0x21')&&typeof _0x33b98e[_0xa3f8('0x22')]===_0xa3f8('0x21');var _0x2cb49f=_0x46a8d9[_0xa3f8('0x23')];var _0x54b870=_0x8cd130?0x0:_0x33b98e[_0xa3f8('0x20')];var _0x5a0e18=_0x8cd130?_0x46a8d9[_0xa3f8('0x23')]:_0x33b98e[_0xa3f8('0x20')]+_0x33b98e[_0xa3f8('0x22')];var _0x46042d;if(_0x5a0e18>=_0x2cb49f){_0x5a0e18=_0x2cb49f;_0x46042d=0xc8;}else{_0x46042d=0xce;}_0x39c450['status'](_0x46042d);return _0x39c450[_0xa3f8('0x24')]('Content-Range',_0x54b870+'-'+_0x5a0e18+'/'+_0x2cb49f)[_0xa3f8('0x25')](_0x46a8d9);}return null;};}function patchUpdates(_0x58336d){return function(_0x4066bb){try{jsonpatch[_0xa3f8('0x26')](_0x4066bb,_0x58336d,!![]);}catch(_0x353daa){return BPromise[_0xa3f8('0x27')](_0x353daa);}return _0x4066bb[_0xa3f8('0x28')]();};}function saveUpdates(_0x1e5f30,_0x187352){return function(_0x490717){if(_0x490717){return _0x490717[_0xa3f8('0x29')](_0x1e5f30)['then'](function(_0x3ce57b){return _0x3ce57b;});}return null;};}function removeEntity(_0xa5a697,_0x24985a){return function(_0x37b290){if(_0x37b290){return _0x37b290[_0xa3f8('0x2a')]()[_0xa3f8('0x2b')](function(){var _0x6e3cb4=_0x37b290[_0xa3f8('0x2c')]({'plain':!![]});var _0x1e22b8=_0xa3f8('0x2d');return db['UserProfileResource'][_0xa3f8('0x2a')]({'where':{'type':_0x1e22b8,'resourceId':_0x6e3cb4['id']}})[_0xa3f8('0x2b')](function(){return _0x37b290;});})[_0xa3f8('0x2b')](function(){_0xa5a697['status'](0xcc)[_0xa3f8('0x2e')]();});}};}function handleEntityNotFound(_0x57f6be,_0xbad6a6){return function(_0x3a3746){if(!_0x3a3746){_0x57f6be[_0xa3f8('0x1e')](0x194);}return _0x3a3746;};}function handleError(_0x4ea213,_0x458824){_0x458824=_0x458824||0x1f4;return function(_0x5e69e2){logger[_0xa3f8('0x2f')](_0x5e69e2[_0xa3f8('0x30')]);if(_0x5e69e2[_0xa3f8('0x31')]){delete _0x5e69e2[_0xa3f8('0x31')];}_0x4ea213[_0xa3f8('0x1f')](_0x458824)[_0xa3f8('0x32')](_0x5e69e2);};}exports[_0xa3f8('0x33')]=function(_0x424a3e,_0x25f9f5){var _0x290a4e={},_0x6e83b0={},_0x57c465={'count':0x0,'rows':[]};var _0x4404da=_[_0xa3f8('0x34')](db[_0xa3f8('0x35')][_0xa3f8('0x36')],function(_0x3bb4b0){return{'name':_0x3bb4b0['fieldName'],'type':_0x3bb4b0[_0xa3f8('0x37')][_0xa3f8('0x38')]};});_0x6e83b0['model']=_[_0xa3f8('0x34')](_0x4404da,_0xa3f8('0x31'));_0x6e83b0['query']=_[_0xa3f8('0x39')](_0x424a3e['query']);_0x6e83b0['filters']=_[_0xa3f8('0x3a')](_0x6e83b0[_0xa3f8('0x3b')],_0x6e83b0['query']);_0x290a4e[_0xa3f8('0x3c')]=_['intersection'](_0x6e83b0[_0xa3f8('0x3b')],qs[_0xa3f8('0x3d')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x3d')]));_0x290a4e['attributes']=_0x290a4e[_0xa3f8('0x3c')]['length']?_0x290a4e[_0xa3f8('0x3c')]:_0x6e83b0['model'];if(!_0x424a3e[_0xa3f8('0x3e')]['hasOwnProperty']('nolimit')){_0x290a4e['limit']=qs[_0xa3f8('0x22')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x22')]);_0x290a4e[_0xa3f8('0x20')]=qs['offset'](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x20')]);}_0x290a4e[_0xa3f8('0x3f')]=qs[_0xa3f8('0x40')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x40')]);_0x290a4e['where']=qs[_0xa3f8('0x41')](_[_0xa3f8('0x42')](_0x424a3e[_0xa3f8('0x3e')],_0x6e83b0['filters']),_0x4404da);if(_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x43')]){_0x290a4e['where']=_[_0xa3f8('0x44')](_0x290a4e['where'],{'$or':_[_0xa3f8('0x34')](_0x4404da,function(_0x5a077c){if(_0x5a077c[_0xa3f8('0x37')]!==_0xa3f8('0x45')){var _0x9a00e7={};_0x9a00e7[_0x5a077c[_0xa3f8('0x31')]]={'$like':'%'+_0x424a3e[_0xa3f8('0x3e')]['filter']+'%'};return _0x9a00e7;}})});}_0x290a4e=_[_0xa3f8('0x44')]({},_0x290a4e,_0x424a3e[_0xa3f8('0x46')]);var _0x4db9c5={'where':_0x290a4e[_0xa3f8('0x47')]};return db['AnalyticDefaultReport'][_0xa3f8('0x23')](_0x4db9c5)[_0xa3f8('0x2b')](function(_0x1542cc){_0x57c465[_0xa3f8('0x23')]=_0x1542cc;if(_0x424a3e[_0xa3f8('0x3e')]['includeAll']){_0x290a4e[_0xa3f8('0x48')]=[{'all':!![]}];}return db[_0xa3f8('0x35')][_0xa3f8('0x49')](_0x290a4e);})[_0xa3f8('0x2b')](function(_0x337808){_0x57c465['rows']=_0x337808;return _0x57c465;})[_0xa3f8('0x2b')](respondWithFilteredResult(_0x25f9f5,_0x290a4e))[_0xa3f8('0x4a')](handleError(_0x25f9f5,null));};exports[_0xa3f8('0x4b')]=function(_0x32e371,_0x2a124b){var _0x314dba={'raw':!![],'where':{'id':_0x32e371[_0xa3f8('0x4c')]['id']}},_0x497217={};_0x497217[_0xa3f8('0x3b')]=_[_0xa3f8('0x39')](db[_0xa3f8('0x35')][_0xa3f8('0x36')]);_0x497217[_0xa3f8('0x3e')]=_['keys'](_0x32e371['query']);_0x497217['filters']=_[_0xa3f8('0x3a')](_0x497217[_0xa3f8('0x3b')],_0x497217[_0xa3f8('0x3e')]);_0x314dba[_0xa3f8('0x3c')]=_[_0xa3f8('0x3a')](_0x497217[_0xa3f8('0x3b')],qs['fields'](_0x32e371[_0xa3f8('0x3e')][_0xa3f8('0x3d')]));_0x314dba[_0xa3f8('0x3c')]=_0x314dba[_0xa3f8('0x3c')]['length']?_0x314dba[_0xa3f8('0x3c')]:_0x497217[_0xa3f8('0x3b')];if(_0x32e371[_0xa3f8('0x3e')]['includeAll']){_0x314dba['include']=[{'all':!![]}];}_0x314dba=_['merge']({},_0x314dba,_0x32e371[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')]['find'](_0x314dba)[_0xa3f8('0x2b')](handleEntityNotFound(_0x2a124b,null))[_0xa3f8('0x2b')](respondWithResult(_0x2a124b,null))[_0xa3f8('0x4a')](handleError(_0x2a124b,null));};exports[_0xa3f8('0x4d')]=function(_0x14932f,_0x3c74b5){return db[_0xa3f8('0x35')][_0xa3f8('0x4d')](_0x14932f[_0xa3f8('0x4e')],{})[_0xa3f8('0x2b')](function(_0x338554){var _0x29d8f5=_0x14932f[_0xa3f8('0x4f')][_0xa3f8('0x2c')]({'plain':!![]});if(!_0x29d8f5)throw new Error(_0xa3f8('0x50'));if(_0x29d8f5[_0xa3f8('0x51')]===_0xa3f8('0x4f')){var _0x559ae7=_0x338554['get']({'plain':!![]});var _0x1fad80=_0xa3f8('0x52');return db['UserProfileSection'][_0xa3f8('0x53')]({'where':{'name':_0x1fad80,'userProfileId':_0x29d8f5[_0xa3f8('0x54')]},'raw':!![]})[_0xa3f8('0x2b')](function(_0xaff79b){if(_0xaff79b&&_0xaff79b[_0xa3f8('0x55')]===0x0){return db[_0xa3f8('0x56')][_0xa3f8('0x4d')]({'name':_0x559ae7[_0xa3f8('0x31')],'resourceId':_0x559ae7['id'],'type':_0xa3f8('0x2d'),'sectionId':_0xaff79b['id']},{})[_0xa3f8('0x2b')](function(){return _0x338554;});}else{return _0x338554;}})[_0xa3f8('0x4a')](function(_0x3752fa){logger[_0xa3f8('0x2f')](_0xa3f8('0x57'),_0x3752fa);throw _0x3752fa;});}return _0x338554;})[_0xa3f8('0x2b')](respondWithResult(_0x3c74b5,0xc9))[_0xa3f8('0x4a')](handleError(_0x3c74b5,null));};exports['update']=function(_0x593614,_0xd0628e){if(_0x593614['body']['id']){delete _0x593614[_0xa3f8('0x4e')]['id'];}return db[_0xa3f8('0x35')][_0xa3f8('0x53')]({'where':{'id':_0x593614['params']['id']}})[_0xa3f8('0x2b')](handleEntityNotFound(_0xd0628e,null))[_0xa3f8('0x2b')](saveUpdates(_0x593614[_0xa3f8('0x4e')],null))[_0xa3f8('0x2b')](respondWithResult(_0xd0628e,null))['catch'](handleError(_0xd0628e,null));};exports[_0xa3f8('0x2a')]=function(_0x47cc0c,_0x392e1e){return db[_0xa3f8('0x35')][_0xa3f8('0x53')]({'where':{'id':_0x47cc0c['params']['id']}})['then'](handleEntityNotFound(_0x392e1e,null))[_0xa3f8('0x2b')](removeEntity(_0x392e1e,null))[_0xa3f8('0x4a')](handleError(_0x392e1e,null));};exports[_0xa3f8('0x58')]=function(_0x6ad40a,_0x48f5a6){var _0x36eac9=0xa;var _0x3478e8=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x5d7877={'SUM':_0xa3f8('0x5c'),'COUNT':_0xa3f8('0x5d'),'COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x521719={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x27de61=function(_0x356643){return!_[_0xa3f8('0x68')](['IS\x20NULL',_0xa3f8('0x69'),_0xa3f8('0x6a'),_0xa3f8('0x6b')],_0x356643);};var _0x42e3f8=function(_0x27c5aa){if(!_0x27c5aa||!_0x27c5aa[_0xa3f8('0x6c')][_0xa3f8('0x6d')]){return'';}for(var _0x4d0404='(',_0x33ea06=0x0;_0x33ea06<_0x27c5aa[_0xa3f8('0x6c')]['length'];_0x33ea06+=0x1){_0x33ea06>0x0&&(_0x4d0404+='\x20'+_0x27c5aa[_0xa3f8('0x6e')]+'\x20');_0x4d0404+=_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x6f')]?_0x42e3f8(_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x6f')]):_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x70')]+'\x20'+_0x27c5aa['rules'][_0x33ea06]['condition']+(_0x27de61(_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06]['condition'])?'\x20'+_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x71')]:'');}return _0x4d0404+')';};var _0x3ff369={'where':{'id':_0x6ad40a[_0xa3f8('0x4c')]['id']}},_0x1dba7e,_0x452e99,_0x35d4d6,_0xeca2dc,_0x14508d;_0x3ff369=_[_0xa3f8('0x44')]({},_0x3ff369,_0x6ad40a[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x3ff369)['then'](function(_0x5efdcf){if(_0x5efdcf){_0x1dba7e=_0x5efdcf;return _0x5efdcf[_0xa3f8('0x72')]();}return null;})[_0xa3f8('0x2b')](function(_0x1688ca){if(_0x1688ca){if(!_0x1688ca[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))]['ValidationErrorItem'](_0xa3f8('0x74'),0x193);}_0x452e99=_0x1688ca;return db[_0xa3f8('0x75')][_0xa3f8('0x49')]({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0x28d359){if(_0x28d359){_0x35d4d6=_[_0xa3f8('0x76')](_0x28d359,'id');var _0x3d45ae;var _0x3a2362=squel[_0xa3f8('0x77')]();_0x3a2362[_0xa3f8('0x78')](_0x1dba7e[_0xa3f8('0x79')]);for(var _0x5d4fe5=0x0;_0x5d4fe5<_0x452e99[_0xa3f8('0x6d')];_0x5d4fe5+=0x1){_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7a')]?_0x35d4d6[_0x452e99[_0x5d4fe5]['MetricId']]['metric']:_0x452e99[_0x5d4fe5][_0xa3f8('0x70')];_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7b')]?_[_0xa3f8('0x7c')](_0x5d7877[_0x452e99[_0x5d4fe5][_0xa3f8('0x7b')]],'%s',_0x3d45ae):_0x3d45ae;_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x521719[_0x452e99[_0x5d4fe5][_0xa3f8('0x7d')]],'%s',_0x3d45ae):_0x3d45ae;if(_0x452e99[_0x5d4fe5][_0xa3f8('0x7e')]){_0x3a2362['group'](_0x3d45ae);}_0x452e99[_0x5d4fe5][_0xa3f8('0x7f')]&&_0x3a2362[_0xa3f8('0x3f')](_0x3d45ae,_0x452e99[_0x5d4fe5][_0xa3f8('0x7f')]==='DESC'?![]:!![]);_0x3a2362[_0xa3f8('0x70')](_0x3d45ae,_0x452e99[_0x5d4fe5][_0xa3f8('0x80')]||_0x3d45ae);}if(_0x1dba7e['joins']){_0x1dba7e[_0xa3f8('0x81')]=JSON[_0xa3f8('0x82')](_0x1dba7e[_0xa3f8('0x81')]);for(var _0x14a5b5=0x0;_0x14a5b5<_0x1dba7e[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x14a5b5+=0x1){if(_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x3478e8,_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x37')])&&_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x83')]&&_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x84')]&&_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x85')]){_0x3a2362[_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x37')]](_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x84')],null,util[_0xa3f8('0x7d')]('%s.%s\x20=\x20%s.%s',_0x1dba7e[_0xa3f8('0x79')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x83')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x84')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5]['foreignKey']));}}}if(_0x1dba7e[_0xa3f8('0x86')]){_0x1dba7e[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x1dba7e['conditions']);_0x3a2362[_0xa3f8('0x47')](_0x42e3f8(_0x1dba7e['conditions'][_0xa3f8('0x6f')]));}_0x14508d=_0x3a2362['clone']();_0x3a2362['limit'](_0x36eac9);_0x3a2362[_0xa3f8('0x20')](0x0);logger['debug'](_0xa3f8('0x87'),_0x3a2362['toString']());return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0x3a2362[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')]['QueryTypes'][_0xa3f8('0x8a')]});}})[_0xa3f8('0x2b')](respondWithResult(_0x48f5a6,null))['catch'](handleError(_0x48f5a6,null));};function runReport(_0x3187e0,_0xd0d568,_0x3715ea){var _0x345089=_0xd0d568[_0xa3f8('0x31')];var _0x20ae51=0xa;var _0x190ce8=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x7dc5ec={'SUM':_0xa3f8('0x5c'),'COUNT':_0xa3f8('0x5d'),'COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':_0xa3f8('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2e2d99={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x599484=function(_0x24fe62){return!_[_0xa3f8('0x68')]([_0xa3f8('0x8c'),_0xa3f8('0x69'),'IS\x20EMPTY',_0xa3f8('0x6b')],_0x24fe62);};var _0x427830=function(_0x3c5091){if(!_0x3c5091||!_0x3c5091[_0xa3f8('0x6c')][_0xa3f8('0x6d')]){return'';}for(var _0x2db7dd='(',_0x12fe03=0x0;_0x12fe03<_0x3c5091[_0xa3f8('0x6c')][_0xa3f8('0x6d')];_0x12fe03+=0x1){_0x12fe03>0x0&&(_0x2db7dd+='\x20'+_0x3c5091[_0xa3f8('0x6e')]+'\x20');_0x2db7dd+=_0x3c5091[_0xa3f8('0x6c')][_0x12fe03]['group']?_0x427830(_0x3c5091[_0xa3f8('0x6c')][_0x12fe03]['group']):_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x70')]+'\x20'+_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x8d')]+(_0x599484(_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x8d')])?'\x20'+_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x71')]:'');}return _0x2db7dd+')';};var _0x4bb7dd={'where':{'id':_0x3187e0['id']}},_0x2c6efe,_0x4f9513,_0x39bd5c,_0x52fcc3,_0x2d2883;_0x4bb7dd=_['merge']({},_0x4bb7dd,_0x3715ea);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x4bb7dd)[_0xa3f8('0x2b')](function(_0xe3cc6a){if(_0xe3cc6a){_0x2c6efe=_0xe3cc6a;return _0xe3cc6a['getFields']();}return null;})[_0xa3f8('0x2b')](function(_0x3d343f){if(_0x3d343f){if(!_0x3d343f[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))][(_0xa3f8('0x8e'))](_0xa3f8('0x74'),0x193);}_0x4f9513=_0x3d343f;return db['AnalyticMetric'][_0xa3f8('0x49')]({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0xbe1a54){if(_0xbe1a54){_0x39bd5c=_[_0xa3f8('0x76')](_0xbe1a54,'id');var _0x477b0a;var _0x565a10=squel[_0xa3f8('0x77')]();_0x565a10[_0xa3f8('0x78')](_0x2c6efe['table']);for(var _0x4494a5=0x0;_0x4494a5<_0x4f9513[_0xa3f8('0x6d')];_0x4494a5+=0x1){_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7a')]?_0x39bd5c[_0x4f9513[_0x4494a5]['MetricId']][_0xa3f8('0x8f')]:_0x4f9513[_0x4494a5][_0xa3f8('0x70')];_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7b')]?_[_0xa3f8('0x7c')](_0x7dc5ec[_0x4f9513[_0x4494a5][_0xa3f8('0x7b')]],'%s',_0x477b0a):_0x477b0a;_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x2e2d99[_0x4f9513[_0x4494a5]['format']],'%s',_0x477b0a):_0x477b0a;if(_0x4f9513[_0x4494a5][_0xa3f8('0x7e')]){_0x565a10[_0xa3f8('0x6f')](_0x477b0a);}_0x4f9513[_0x4494a5]['orderBy']&&_0x565a10[_0xa3f8('0x3f')](_0x477b0a,_0x4f9513[_0x4494a5][_0xa3f8('0x7f')]===_0xa3f8('0x90')?![]:!![]);_0x565a10[_0xa3f8('0x70')](_0x477b0a,_0x4f9513[_0x4494a5][_0xa3f8('0x80')]||_0x477b0a);}if(_0x2c6efe[_0xa3f8('0x81')]){_0x2c6efe[_0xa3f8('0x81')]=JSON['parse'](_0x2c6efe[_0xa3f8('0x81')]);for(var _0x151bab=0x0;_0x151bab<_0x2c6efe[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x151bab+=0x1){if(_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x190ce8,_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x37')])&&_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x83')]&&_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignTable']&&_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x85')]){_0x565a10[_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x37')]](_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x84')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x2c6efe[_0xa3f8('0x79')],_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x83')],_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignTable'],_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignKey']));}}}if(_0x2c6efe[_0xa3f8('0x86')]){_0x2c6efe[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x2c6efe['conditions']);_0x565a10['where'](_0x427830(_0x2c6efe['conditions'][_0xa3f8('0x6f')]));}_0x2d2883=_0x565a10[_0xa3f8('0x91')]();_0x565a10[_0xa3f8('0x22')](_0x20ae51);_0x565a10[_0xa3f8('0x20')](0x0);return;}})[_0xa3f8('0x2b')](function(){if(_0xd0d568[_0xa3f8('0x92')]===_0xa3f8('0x93')){return null;}var _0x18890e=_['merge'](_0xd0d568,{'name':_0xd0d568[_0xa3f8('0x94')]||_0xd0d568[_0xa3f8('0x31')]||_0x2c6efe[_0xa3f8('0x31')],'basename':_0x345089,'savename':util['format'](_0xa3f8('0x95'),_0xd0d568[_0xa3f8('0x31')]||_0x2c6efe['name'],require(_0xa3f8('0x96'))[_0xa3f8('0x97')](0x4),_0xd0d568['output']||_0xa3f8('0x98')),'reportId':_0x2c6efe['id'],'reportType':_0xa3f8('0x99')});return db['AnalyticExtractedReport'][_0xa3f8('0x4d')](_0x18890e,{'raw':!![]});})[_0xa3f8('0x2b')](function(_0x21cc1d){if(_0x2c6efe['table']===_0xa3f8('0x9a')){_0x2d2883[_0xa3f8('0x47')](_0x2c6efe[_0xa3f8('0x79')]+_0xa3f8('0x9b'),_0xd0d568[_0xa3f8('0x9c')],_0xd0d568['endDate']);}else{_0x2d2883['where'](_0x2c6efe[_0xa3f8('0x79')]+_0xa3f8('0x9d'),_0xd0d568[_0xa3f8('0x9c')],_0xd0d568[_0xa3f8('0x9e')]);}if(_0x21cc1d){logger['info'](_0xa3f8('0x9f'),_0x2d2883[_0xa3f8('0x89')]());require(_0xa3f8('0xa0'))[_0xa3f8('0xa1')](path[_0xa3f8('0x59')](__dirname,_0xa3f8('0xa2'),_0x21cc1d[_0xa3f8('0x92')]),[_0x21cc1d['id'],_0x2d2883[_0xa3f8('0x89')](),path['join'](__dirname,_0xa3f8('0xa3'),_0x21cc1d['savename']),_0x345089]);return _0x21cc1d;}else{var _0xe9842=squel['select']();_0xe9842['from']('('+_0x2d2883[_0xa3f8('0x89')]()+')',_0xa3f8('0xa4'));_0xe9842[_0xa3f8('0x70')](_0xa3f8('0xa5'),_0xa3f8('0x23'));_0x2d2883['limit'](_0xd0d568['limit']||_0x20ae51);_0x2d2883[_0xa3f8('0x20')](_0xd0d568[_0xa3f8('0x20')]||0x0);return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0xe9842[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')]['QueryTypes'][_0xa3f8('0x8a')]})[_0xa3f8('0x2b')](function(_0x5a4f4a){if(!_0x5a4f4a['length']){_0x52fcc3=0x0;}else{_0x52fcc3=_0x5a4f4a[0x0][_0xa3f8('0x23')]||0x0;}return dbH[_0xa3f8('0x88')]['query'](_0x2d2883[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')][_0xa3f8('0xa6')][_0xa3f8('0x8a')]});})[_0xa3f8('0x2b')](function(_0x52f592){return{'rows':_0x52f592||[],'count':_0x52fcc3};});}});}exports[_0xa3f8('0xa7')]=function(_0x59026b,_0x234636){return runReport(_0x59026b[_0xa3f8('0x4c')],_0x59026b['query'],_0x59026b['options'])[_0xa3f8('0x2b')](respondWithResult(_0x234636,null))[_0xa3f8('0x4a')](handleError(_0x234636,null));};exports[_0xa3f8('0xa8')]=runReport;exports[_0xa3f8('0x3e')]=function(_0x26ec07,_0x2c9db8){var _0x18ab67=0xa;var _0x1f21a2=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x15a11c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':_0xa3f8('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x481b70={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x1f776a=function(_0x5b1527){return!_['includes']([_0xa3f8('0x8c'),_0xa3f8('0x69'),_0xa3f8('0x6a'),_0xa3f8('0x6b')],_0x5b1527);};var _0x4670cc=function(_0xfde509){if(!_0xfde509||!_0xfde509['rules']['length']){return'';}for(var _0x3d81fe='(',_0x15111a=0x0;_0x15111a<_0xfde509[_0xa3f8('0x6c')]['length'];_0x15111a+=0x1){_0x15111a>0x0&&(_0x3d81fe+='\x20'+_0xfde509[_0xa3f8('0x6e')]+'\x20');_0x3d81fe+=_0xfde509[_0xa3f8('0x6c')][_0x15111a]['group']?_0x4670cc(_0xfde509[_0xa3f8('0x6c')][_0x15111a]['group']):_0xfde509[_0xa3f8('0x6c')][_0x15111a]['field']+'\x20'+_0xfde509['rules'][_0x15111a][_0xa3f8('0x8d')]+(_0x1f776a(_0xfde509[_0xa3f8('0x6c')][_0x15111a][_0xa3f8('0x8d')])?'\x20'+_0xfde509[_0xa3f8('0x6c')][_0x15111a]['value']:'');}return _0x3d81fe+')';};var _0x2e694e={'where':{'id':_0x26ec07[_0xa3f8('0x4c')]['id']}},_0x1669be,_0x4f248f,_0x6ef1ad,_0xae3a31,_0x31d45c;_0x2e694e=_[_0xa3f8('0x44')]({},_0x2e694e,_0x26ec07[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x2e694e)[_0xa3f8('0x2b')](function(_0x529021){if(_0x529021){_0x1669be=_0x529021;return _0x529021[_0xa3f8('0x72')]();}return null;})[_0xa3f8('0x2b')](function(_0x35c498){if(_0x35c498){if(!_0x35c498[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))][(_0xa3f8('0x8e'))](_0xa3f8('0x74'),0x193);}_0x4f248f=_0x35c498;return db[_0xa3f8('0x75')]['findAll']({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0x286490){if(_0x286490){_0x6ef1ad=_['keyBy'](_0x286490,'id');var _0x16e98d;var _0x3be5c9=squel['select']();_0x3be5c9[_0xa3f8('0x78')](_0x1669be[_0xa3f8('0x79')]);for(var _0x5260e0=0x0;_0x5260e0<_0x4f248f[_0xa3f8('0x6d')];_0x5260e0+=0x1){_0x16e98d=_0x4f248f[_0x5260e0][_0xa3f8('0x7a')]?_0x6ef1ad[_0x4f248f[_0x5260e0]['MetricId']][_0xa3f8('0x8f')]:_0x4f248f[_0x5260e0][_0xa3f8('0x70')];_0x16e98d=_0x4f248f[_0x5260e0]['function']?_['replace'](_0x15a11c[_0x4f248f[_0x5260e0][_0xa3f8('0x7b')]],'%s',_0x16e98d):_0x16e98d;_0x16e98d=_0x4f248f[_0x5260e0][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x481b70[_0x4f248f[_0x5260e0]['format']],'%s',_0x16e98d):_0x16e98d;if(_0x4f248f[_0x5260e0]['groupBy']){_0x3be5c9[_0xa3f8('0x6f')](_0x16e98d);}_0x4f248f[_0x5260e0][_0xa3f8('0x7f')]&&_0x3be5c9['order'](_0x16e98d,_0x4f248f[_0x5260e0][_0xa3f8('0x7f')]==='DESC'?![]:!![]);_0x3be5c9[_0xa3f8('0x70')](_0x16e98d,_0x4f248f[_0x5260e0]['alias']||_0x16e98d);}if(_0x1669be[_0xa3f8('0x81')]){_0x1669be['joins']=JSON['parse'](_0x1669be[_0xa3f8('0x81')]);for(var _0x5ac693=0x0;_0x5ac693<_0x1669be[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x5ac693+=0x1){if(_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x1f21a2,_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')])&&_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x83')]&&_0x1669be['joins'][_0x5ac693][_0xa3f8('0x84')]&&_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x85')]){_0x3be5c9[_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')]](_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x84')],null,util[_0xa3f8('0x7d')](_0xa3f8('0xa9'),_0x1669be[_0xa3f8('0x79')],_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x83')],_0x1669be[_0xa3f8('0x81')][_0x5ac693]['foreignTable'],_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x85')]));}}}if(_0x1669be[_0xa3f8('0x86')]){_0x1669be[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x1669be[_0xa3f8('0x86')]);_0x3be5c9['where'](_0x4670cc(_0x1669be[_0xa3f8('0x86')][_0xa3f8('0x6f')]));}_0x31d45c=_0x3be5c9[_0xa3f8('0x91')]();_0x3be5c9[_0xa3f8('0x22')](_0x18ab67);_0x3be5c9[_0xa3f8('0x20')](0x0);logger[_0xa3f8('0xaa')](_0xa3f8('0x87'),_0x3be5c9[_0xa3f8('0x89')]());return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0x3be5c9[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')][_0xa3f8('0xa6')][_0xa3f8('0x8a')]});}})[_0xa3f8('0x2b')](function(){return{'sql':_0x31d45c[_0xa3f8('0x89')]()};})[_0xa3f8('0x2b')](respondWithResult(_0x2c9db8,null))[_0xa3f8('0x4a')](handleError(_0x2c9db8,null));}; \ No newline at end of file +var _0x4975=['set','Content-Range','save','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','index','AnalyticDefaultReport','rawAttributes','type','key','map','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','body','role','user','Reports','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','SUM(%s)','COUNT(%s)','MAX(%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)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','joins','includes','parentKey','foreignKey','foreignTable','conditions','parse','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','HOUR(%s)','operator','Please\x20insert\x20at\x20least\x20one\x20field','alias','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','toString','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','cross_join','getFields','replace','clone','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x49fcb4,_0xce3f11){var _0x275daf=function(_0x512bda){while(--_0x512bda){_0x49fcb4['push'](_0x49fcb4['shift']());}};_0x275daf(++_0xce3f11);}(_0x4975,0x86));var _0x5497=function(_0x5425b5,_0x5c6d4f){_0x5425b5=_0x5425b5-0x0;var _0x314dea=_0x4975[_0x5425b5];return _0x314dea;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];var dbH=require(_0x5497('0x17'))[_0x5497('0x18')];function respondWithStatusCode(_0x984990,_0x747dc7){_0x747dc7=_0x747dc7||0xcc;return function(_0x365144){if(_0x365144){return _0x984990[_0x5497('0x19')](_0x747dc7);}return _0x984990[_0x5497('0x1a')](_0x747dc7)[_0x5497('0x1b')]();};}function respondWithResult(_0x1a4c74,_0x55f590){_0x55f590=_0x55f590||0xc8;return function(_0x11b0a9){if(_0x11b0a9){return _0x1a4c74['status'](_0x55f590)[_0x5497('0x1c')](_0x11b0a9);}};}function respondWithFilteredResult(_0x2bfd8a,_0x19e5f3){return function(_0x3ce50b){if(_0x3ce50b){var _0x37c18e=typeof _0x19e5f3[_0x5497('0x1d')]===_0x5497('0x1e')&&typeof _0x19e5f3['limit']==='undefined';var _0x3f4d20=_0x3ce50b[_0x5497('0x1f')];var _0x3a47fd=_0x37c18e?0x0:_0x19e5f3['offset'];var _0xbf1ba7=_0x37c18e?_0x3ce50b[_0x5497('0x1f')]:_0x19e5f3[_0x5497('0x1d')]+_0x19e5f3[_0x5497('0x20')];var _0x1b1b43;if(_0xbf1ba7>=_0x3f4d20){_0xbf1ba7=_0x3f4d20;_0x1b1b43=0xc8;}else{_0x1b1b43=0xce;}_0x2bfd8a[_0x5497('0x1a')](_0x1b1b43);return _0x2bfd8a[_0x5497('0x21')](_0x5497('0x22'),_0x3a47fd+'-'+_0xbf1ba7+'/'+_0x3f4d20)[_0x5497('0x1c')](_0x3ce50b);}return null;};}function patchUpdates(_0x3f54ef){return function(_0x186065){try{jsonpatch['apply'](_0x186065,_0x3f54ef,!![]);}catch(_0x720767){return BPromise['reject'](_0x720767);}return _0x186065[_0x5497('0x23')]();};}function saveUpdates(_0xd0868d,_0x44265c){return function(_0x2f587d){if(_0x2f587d){return _0x2f587d[_0x5497('0x24')](_0xd0868d)[_0x5497('0x25')](function(_0x5018fa){return _0x5018fa;});}return null;};}function removeEntity(_0x54043a,_0x1eefce){return function(_0x34b97f){if(_0x34b97f){return _0x34b97f[_0x5497('0x26')]()[_0x5497('0x25')](function(){var _0x5223b5=_0x34b97f[_0x5497('0x27')]({'plain':!![]});var _0x57268c=_0x5497('0x28');return db[_0x5497('0x29')][_0x5497('0x26')]({'where':{'type':_0x57268c,'resourceId':_0x5223b5['id']}})[_0x5497('0x25')](function(){return _0x34b97f;});})[_0x5497('0x25')](function(){_0x54043a[_0x5497('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4af5f4,_0x5406e2){return function(_0x583d06){if(!_0x583d06){_0x4af5f4['sendStatus'](0x194);}return _0x583d06;};}function handleError(_0x39a2b7,_0x48d146){_0x48d146=_0x48d146||0x1f4;return function(_0x5e9356){logger[_0x5497('0x2a')](_0x5e9356[_0x5497('0x2b')]);if(_0x5e9356[_0x5497('0x2c')]){delete _0x5e9356['name'];}_0x39a2b7['status'](_0x48d146)['send'](_0x5e9356);};}exports[_0x5497('0x2d')]=function(_0x471e0b,_0xf4c117){var _0x5b8f79={},_0x489f71={},_0x594866={'count':0x0,'rows':[]};var _0xa28dd8=_['map'](db[_0x5497('0x2e')][_0x5497('0x2f')],function(_0x77c575){return{'name':_0x77c575['fieldName'],'type':_0x77c575[_0x5497('0x30')][_0x5497('0x31')]};});_0x489f71['model']=_[_0x5497('0x32')](_0xa28dd8,_0x5497('0x2c'));_0x489f71[_0x5497('0x33')]=_['keys'](_0x471e0b[_0x5497('0x33')]);_0x489f71[_0x5497('0x34')]=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],_0x489f71[_0x5497('0x33')]);_0x5b8f79['attributes']=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],qs['fields'](_0x471e0b[_0x5497('0x33')][_0x5497('0x37')]));_0x5b8f79[_0x5497('0x38')]=_0x5b8f79[_0x5497('0x38')][_0x5497('0x39')]?_0x5b8f79[_0x5497('0x38')]:_0x489f71['model'];if(!_0x471e0b[_0x5497('0x33')]['hasOwnProperty'](_0x5497('0x3a'))){_0x5b8f79[_0x5497('0x20')]=qs[_0x5497('0x20')](_0x471e0b['query']['limit']);_0x5b8f79[_0x5497('0x1d')]=qs[_0x5497('0x1d')](_0x471e0b[_0x5497('0x33')][_0x5497('0x1d')]);}_0x5b8f79[_0x5497('0x3b')]=qs[_0x5497('0x3c')](_0x471e0b['query'][_0x5497('0x3c')]);_0x5b8f79[_0x5497('0x3d')]=qs[_0x5497('0x34')](_[_0x5497('0x3e')](_0x471e0b[_0x5497('0x33')],_0x489f71[_0x5497('0x34')]),_0xa28dd8);if(_0x471e0b[_0x5497('0x33')][_0x5497('0x3f')]){_0x5b8f79[_0x5497('0x3d')]=_['merge'](_0x5b8f79[_0x5497('0x3d')],{'$or':_[_0x5497('0x32')](_0xa28dd8,function(_0x1e9616){if(_0x1e9616[_0x5497('0x30')]!==_0x5497('0x40')){var _0xa5ebe6={};_0xa5ebe6[_0x1e9616[_0x5497('0x2c')]]={'$like':'%'+_0x471e0b['query'][_0x5497('0x3f')]+'%'};return _0xa5ebe6;}})});}_0x5b8f79=_[_0x5497('0x41')]({},_0x5b8f79,_0x471e0b[_0x5497('0x42')]);var _0x35993c={'where':_0x5b8f79[_0x5497('0x3d')]};return db[_0x5497('0x2e')][_0x5497('0x1f')](_0x35993c)['then'](function(_0x2137bd){_0x594866[_0x5497('0x1f')]=_0x2137bd;if(_0x471e0b[_0x5497('0x33')][_0x5497('0x43')]){_0x5b8f79[_0x5497('0x44')]=[{'all':!![]}];}return db[_0x5497('0x2e')][_0x5497('0x45')](_0x5b8f79);})[_0x5497('0x25')](function(_0x2021ae){_0x594866[_0x5497('0x46')]=_0x2021ae;return _0x594866;})['then'](respondWithFilteredResult(_0xf4c117,_0x5b8f79))[_0x5497('0x47')](handleError(_0xf4c117,null));};exports['show']=function(_0x40822a,_0x9fc24){var _0x26ef01={'raw':!![],'where':{'id':_0x40822a[_0x5497('0x48')]['id']}},_0x3602ec={};_0x3602ec['model']=_[_0x5497('0x49')](db[_0x5497('0x2e')]['rawAttributes']);_0x3602ec[_0x5497('0x33')]=_['keys'](_0x40822a[_0x5497('0x33')]);_0x3602ec['filters']=_[_0x5497('0x35')](_0x3602ec[_0x5497('0x36')],_0x3602ec[_0x5497('0x33')]);_0x26ef01[_0x5497('0x38')]=_[_0x5497('0x35')](_0x3602ec['model'],qs['fields'](_0x40822a['query']['fields']));_0x26ef01[_0x5497('0x38')]=_0x26ef01[_0x5497('0x38')][_0x5497('0x39')]?_0x26ef01[_0x5497('0x38')]:_0x3602ec[_0x5497('0x36')];if(_0x40822a[_0x5497('0x33')][_0x5497('0x43')]){_0x26ef01[_0x5497('0x44')]=[{'all':!![]}];}_0x26ef01=_[_0x5497('0x41')]({},_0x26ef01,_0x40822a['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x26ef01)[_0x5497('0x25')](handleEntityNotFound(_0x9fc24,null))['then'](respondWithResult(_0x9fc24,null))[_0x5497('0x47')](handleError(_0x9fc24,null));};exports['create']=function(_0x12ffbc,_0x31f1ba){return db[_0x5497('0x2e')]['create'](_0x12ffbc[_0x5497('0x4b')],{})[_0x5497('0x25')](function(_0x515c3e){var _0x3abc92=_0x12ffbc['user'][_0x5497('0x27')]({'plain':!![]});if(!_0x3abc92)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3abc92[_0x5497('0x4c')]===_0x5497('0x4d')){var _0x26fd9f=_0x515c3e[_0x5497('0x27')]({'plain':!![]});var _0x25e80c=_0x5497('0x4e');return db[_0x5497('0x4f')][_0x5497('0x4a')]({'where':{'name':_0x25e80c,'userProfileId':_0x3abc92['userProfileId']},'raw':!![]})[_0x5497('0x25')](function(_0x5b2c22){if(_0x5b2c22&&_0x5b2c22['autoAssociation']===0x0){return db[_0x5497('0x29')][_0x5497('0x50')]({'name':_0x26fd9f['name'],'resourceId':_0x26fd9f['id'],'type':_0x5497('0x28'),'sectionId':_0x5b2c22['id']},{})[_0x5497('0x25')](function(){return _0x515c3e;});}else{return _0x515c3e;}})[_0x5497('0x47')](function(_0x3094c7){logger['error'](_0x5497('0x51'),_0x3094c7);throw _0x3094c7;});}return _0x515c3e;})['then'](respondWithResult(_0x31f1ba,0xc9))['catch'](handleError(_0x31f1ba,null));};exports[_0x5497('0x24')]=function(_0x33dd07,_0x2f7ec8){if(_0x33dd07['body']['id']){delete _0x33dd07['body']['id'];}return db[_0x5497('0x2e')]['find']({'where':{'id':_0x33dd07[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x2f7ec8,null))[_0x5497('0x25')](saveUpdates(_0x33dd07['body'],null))[_0x5497('0x25')](respondWithResult(_0x2f7ec8,null))[_0x5497('0x47')](handleError(_0x2f7ec8,null));};exports['destroy']=function(_0x418f17,_0x5dccfb){return db['AnalyticDefaultReport'][_0x5497('0x4a')]({'where':{'id':_0x418f17[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x5dccfb,null))[_0x5497('0x25')](removeEntity(_0x5dccfb,null))[_0x5497('0x47')](handleError(_0x5dccfb,null));};exports[_0x5497('0x52')]=function(_0x28b2a3,_0x3fca40){var _0x25c75e=0xa;var _0x590be7=[_0x5497('0x53'),'left_join','right_join','cross_join'];var _0x1f3965={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5497('0x56'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x25f349={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x425995=function(_0xc783ce){return!_['includes']([_0x5497('0x5e'),_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0xc783ce);};var _0x5823f6=function(_0x31271c){if(!_0x31271c||!_0x31271c[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x542bcf='(',_0x1ab48f=0x0;_0x1ab48f<_0x31271c['rules']['length'];_0x1ab48f+=0x1){_0x1ab48f>0x0&&(_0x542bcf+='\x20'+_0x31271c['operator']+'\x20');_0x542bcf+=_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x63')]?_0x5823f6(_0x31271c[_0x5497('0x62')][_0x1ab48f]['group']):_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x64')]+'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x65')]+(_0x425995(_0x31271c['rules'][_0x1ab48f][_0x5497('0x65')])?'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x66')]:'');}return _0x542bcf+')';};var _0x49617c={'where':{'id':_0x28b2a3[_0x5497('0x48')]['id']}},_0x164de1,_0x465bed,_0xb3eec2,_0x4368e3,_0x1467c4;_0x49617c=_[_0x5497('0x41')]({},_0x49617c,_0x28b2a3['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x49617c)[_0x5497('0x25')](function(_0x20efea){if(_0x20efea){_0x164de1=_0x20efea;return _0x20efea['getFields']();}return null;})['then'](function(_0x4a7360){if(_0x4a7360){if(!_0x4a7360[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x465bed=_0x4a7360;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x464df3){if(_0x464df3){_0xb3eec2=_[_0x5497('0x6a')](_0x464df3,'id');var _0x4338d4;var _0x3f38bf=squel[_0x5497('0x6b')]();_0x3f38bf[_0x5497('0x6c')](_0x164de1[_0x5497('0x6d')]);for(var _0x1fc6ad=0x0;_0x1fc6ad<_0x465bed['length'];_0x1fc6ad+=0x1){_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x6e')]?_0xb3eec2[_0x465bed[_0x1fc6ad][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x465bed[_0x1fc6ad]['field'];_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x70')]?_['replace'](_0x1f3965[_0x465bed[_0x1fc6ad][_0x5497('0x70')]],'%s',_0x4338d4):_0x4338d4;_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x71')]?_['replace'](_0x25f349[_0x465bed[_0x1fc6ad][_0x5497('0x71')]],'%s',_0x4338d4):_0x4338d4;if(_0x465bed[_0x1fc6ad][_0x5497('0x72')]){_0x3f38bf[_0x5497('0x63')](_0x4338d4);}_0x465bed[_0x1fc6ad][_0x5497('0x73')]&&_0x3f38bf['order'](_0x4338d4,_0x465bed[_0x1fc6ad][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x3f38bf[_0x5497('0x64')](_0x4338d4,_0x465bed[_0x1fc6ad]['alias']||_0x4338d4);}if(_0x164de1[_0x5497('0x75')]){_0x164de1[_0x5497('0x75')]=JSON['parse'](_0x164de1[_0x5497('0x75')]);for(var _0xebe694=0x0;_0xebe694<_0x164de1[_0x5497('0x75')]['length'];_0xebe694+=0x1){if(_0x164de1['joins'][_0xebe694][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x590be7,_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x30')])&&_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x77')]&&_0x164de1[_0x5497('0x75')][_0xebe694]['foreignTable']&&_0x164de1['joins'][_0xebe694][_0x5497('0x78')]){_0x3f38bf[_0x164de1[_0x5497('0x75')][_0xebe694]['type']](_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],null,util[_0x5497('0x71')]('%s.%s\x20=\x20%s.%s',_0x164de1[_0x5497('0x6d')],_0x164de1[_0x5497('0x75')][_0xebe694]['parentKey'],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x78')]));}}}if(_0x164de1[_0x5497('0x7a')]){_0x164de1['conditions']=JSON[_0x5497('0x7b')](_0x164de1[_0x5497('0x7a')]);_0x3f38bf[_0x5497('0x3d')](_0x5823f6(_0x164de1[_0x5497('0x7a')][_0x5497('0x63')]));}_0x1467c4=_0x3f38bf['clone']();_0x3f38bf[_0x5497('0x20')](_0x25c75e);_0x3f38bf[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')](_0x5497('0x7d'),_0x3f38bf['toString']());return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x3f38bf['toString'](),{'type':dbH[_0x5497('0x7e')][_0x5497('0x7f')][_0x5497('0x80')]});}})[_0x5497('0x25')](respondWithResult(_0x3fca40,null))['catch'](handleError(_0x3fca40,null));};function runReport(_0x547de7,_0x4ff64f,_0x5343d5){var _0x594761=_0x4ff64f[_0x5497('0x2c')];var _0x2375cc=0xa;var _0x15d0da=[_0x5497('0x53'),_0x5497('0x81'),'right_join','cross_join'];var _0x392987={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x4c41c4={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x22b019=function(_0x4aa4ba){return!_[_0x5497('0x76')](['IS\x20NULL',_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0x4aa4ba);};var _0x5b0f9d=function(_0x59960b){if(!_0x59960b||!_0x59960b[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x953b31='(',_0xeb52c9=0x0;_0xeb52c9<_0x59960b[_0x5497('0x62')][_0x5497('0x39')];_0xeb52c9+=0x1){_0xeb52c9>0x0&&(_0x953b31+='\x20'+_0x59960b[_0x5497('0x86')]+'\x20');_0x953b31+=_0x59960b[_0x5497('0x62')][_0xeb52c9]['group']?_0x5b0f9d(_0x59960b['rules'][_0xeb52c9]['group']):_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x64')]+'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x65')]+(_0x22b019(_0x59960b['rules'][_0xeb52c9]['condition'])?'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x66')]:'');}return _0x953b31+')';};var _0x5dd9bc={'where':{'id':_0x547de7['id']}},_0x83b240,_0x2fc11a,_0x3ce2ee,_0x36c09f,_0x51e9fb;_0x5dd9bc=_['merge']({},_0x5dd9bc,_0x5343d5);return db['AnalyticDefaultReport']['find'](_0x5dd9bc)['then'](function(_0x497295){if(_0x497295){_0x83b240=_0x497295;return _0x497295['getFields']();}return null;})[_0x5497('0x25')](function(_0x5aa5e1){if(_0x5aa5e1){if(!_0x5aa5e1[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))](_0x5497('0x87'),0x193);}_0x2fc11a=_0x5aa5e1;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})['then'](function(_0x77d52c){if(_0x77d52c){_0x3ce2ee=_['keyBy'](_0x77d52c,'id');var _0x15a67d;var _0x2721b2=squel[_0x5497('0x6b')]();_0x2721b2[_0x5497('0x6c')](_0x83b240[_0x5497('0x6d')]);for(var _0x38fa59=0x0;_0x38fa59<_0x2fc11a[_0x5497('0x39')];_0x38fa59+=0x1){_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x6e')]?_0x3ce2ee[_0x2fc11a[_0x38fa59][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x2fc11a[_0x38fa59]['field'];_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x70')]?_['replace'](_0x392987[_0x2fc11a[_0x38fa59][_0x5497('0x70')]],'%s',_0x15a67d):_0x15a67d;_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x71')]?_['replace'](_0x4c41c4[_0x2fc11a[_0x38fa59][_0x5497('0x71')]],'%s',_0x15a67d):_0x15a67d;if(_0x2fc11a[_0x38fa59][_0x5497('0x72')]){_0x2721b2[_0x5497('0x63')](_0x15a67d);}_0x2fc11a[_0x38fa59][_0x5497('0x73')]&&_0x2721b2[_0x5497('0x3b')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x2721b2[_0x5497('0x64')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x88')]||_0x15a67d);}if(_0x83b240[_0x5497('0x75')]){_0x83b240[_0x5497('0x75')]=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x75')]);for(var _0x22426e=0x0;_0x22426e<_0x83b240['joins'][_0x5497('0x39')];_0x22426e+=0x1){if(_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x15d0da,_0x83b240[_0x5497('0x75')][_0x22426e]['type'])&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')]&&_0x83b240['joins'][_0x22426e]['foreignTable']&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]){_0x2721b2[_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]](_0x83b240[_0x5497('0x75')][_0x22426e]['foreignTable'],null,util['format'](_0x5497('0x89'),_0x83b240['table'],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x79')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]));}}}if(_0x83b240['conditions']){_0x83b240['conditions']=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x7a')]);_0x2721b2[_0x5497('0x3d')](_0x5b0f9d(_0x83b240['conditions'][_0x5497('0x63')]));}_0x51e9fb=_0x2721b2['clone']();_0x2721b2[_0x5497('0x20')](_0x2375cc);_0x2721b2['offset'](0x0);return;}})['then'](function(){if(_0x4ff64f[_0x5497('0x8a')]===_0x5497('0x8b')){return null;}var _0x4ce768=_[_0x5497('0x41')](_0x4ff64f,{'name':_0x4ff64f[_0x5497('0x8c')]||_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],'basename':_0x594761,'savename':util['format'](_0x5497('0x8d'),_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],require(_0x5497('0x8e'))[_0x5497('0x8f')](0x4),_0x4ff64f['output']||_0x5497('0x90')),'reportId':_0x83b240['id'],'reportType':'default'});return db[_0x5497('0x91')][_0x5497('0x50')](_0x4ce768,{'raw':!![]});})[_0x5497('0x25')](function(_0x314db4){if(_0x83b240[_0x5497('0x6d')]===_0x5497('0x92')){_0x51e9fb[_0x5497('0x3d')](_0x83b240[_0x5497('0x6d')]+_0x5497('0x93'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}else{_0x51e9fb['where'](_0x83b240[_0x5497('0x6d')]+_0x5497('0x96'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}if(_0x314db4){logger[_0x5497('0x97')](_0x5497('0x98'),_0x51e9fb[_0x5497('0x99')]());require(_0x5497('0x9a'))[_0x5497('0x9b')](path[_0x5497('0x53')](__dirname,_0x5497('0x9c'),_0x314db4['output']),[_0x314db4['id'],_0x51e9fb[_0x5497('0x99')](),path[_0x5497('0x53')](__dirname,_0x5497('0x9d'),_0x314db4[_0x5497('0x9e')]),_0x594761]);return _0x314db4;}else{var _0x46be08=squel[_0x5497('0x6b')]();_0x46be08[_0x5497('0x6c')]('('+_0x51e9fb[_0x5497('0x99')]()+')',_0x5497('0x9f'));_0x46be08[_0x5497('0x64')](_0x5497('0xa0'),_0x5497('0x1f'));_0x51e9fb[_0x5497('0x20')](_0x4ff64f[_0x5497('0x20')]||_0x2375cc);_0x51e9fb['offset'](_0x4ff64f['offset']||0x0);return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x46be08[_0x5497('0x99')](),{'type':dbH['sequelize'][_0x5497('0x7f')][_0x5497('0x80')]})[_0x5497('0x25')](function(_0x2bd48c){if(!_0x2bd48c[_0x5497('0x39')]){_0x36c09f=0x0;}else{_0x36c09f=_0x2bd48c[0x0][_0x5497('0x1f')]||0x0;}return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x51e9fb['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5497('0x80')]});})[_0x5497('0x25')](function(_0x4dab6a){return{'rows':_0x4dab6a||[],'count':_0x36c09f};});}});}exports[_0x5497('0xa1')]=function(_0x27f42b,_0x1bef85){return runReport(_0x27f42b['params'],_0x27f42b[_0x5497('0x33')],_0x27f42b['options'])[_0x5497('0x25')](respondWithResult(_0x1bef85,null))[_0x5497('0x47')](handleError(_0x1bef85,null));};exports[_0x5497('0xa2')]=runReport;exports['query']=function(_0x1c3dad,_0xfba062){var _0x494cc3=0xa;var _0x401f04=[_0x5497('0x53'),_0x5497('0x81'),'right_join',_0x5497('0xa3')];var _0x1a5c32={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x1dfb76={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x5c2517=function(_0x367929){return!_[_0x5497('0x76')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5497('0x60'),_0x5497('0x61')],_0x367929);};var _0x2fd2e3=function(_0x2fe770){if(!_0x2fe770||!_0x2fe770['rules'][_0x5497('0x39')]){return'';}for(var _0x1299cd='(',_0x4c2b14=0x0;_0x4c2b14<_0x2fe770['rules'][_0x5497('0x39')];_0x4c2b14+=0x1){_0x4c2b14>0x0&&(_0x1299cd+='\x20'+_0x2fe770[_0x5497('0x86')]+'\x20');_0x1299cd+=_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x63')]?_0x2fd2e3(_0x2fe770[_0x5497('0x62')][_0x4c2b14]['group']):_0x2fe770['rules'][_0x4c2b14][_0x5497('0x64')]+'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14]['condition']+(_0x5c2517(_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x65')])?'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x66')]:'');}return _0x1299cd+')';};var _0x358ec5={'where':{'id':_0x1c3dad['params']['id']}},_0x5cddbc,_0x188d21,_0xf92129,_0x2d5cc1,_0x4f9228;_0x358ec5=_[_0x5497('0x41')]({},_0x358ec5,_0x1c3dad[_0x5497('0x42')]);return db[_0x5497('0x2e')]['find'](_0x358ec5)[_0x5497('0x25')](function(_0x30a248){if(_0x30a248){_0x5cddbc=_0x30a248;return _0x30a248[_0x5497('0xa4')]();}return null;})['then'](function(_0x1d4c76){if(_0x1d4c76){if(!_0x1d4c76[_0x5497('0x39')]){throw new db['Sequelize']['ValidationErrorItem'](_0x5497('0x87'),0x193);}_0x188d21=_0x1d4c76;return db[_0x5497('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x5001d5){if(_0x5001d5){_0xf92129=_[_0x5497('0x6a')](_0x5001d5,'id');var _0x2c58e6;var _0x300f3e=squel[_0x5497('0x6b')]();_0x300f3e[_0x5497('0x6c')](_0x5cddbc[_0x5497('0x6d')]);for(var _0x23732d=0x0;_0x23732d<_0x188d21['length'];_0x23732d+=0x1){_0x2c58e6=_0x188d21[_0x23732d]['MetricId']?_0xf92129[_0x188d21[_0x23732d][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x188d21[_0x23732d]['field'];_0x2c58e6=_0x188d21[_0x23732d]['function']?_[_0x5497('0xa5')](_0x1a5c32[_0x188d21[_0x23732d][_0x5497('0x70')]],'%s',_0x2c58e6):_0x2c58e6;_0x2c58e6=_0x188d21[_0x23732d][_0x5497('0x71')]?_[_0x5497('0xa5')](_0x1dfb76[_0x188d21[_0x23732d][_0x5497('0x71')]],'%s',_0x2c58e6):_0x2c58e6;if(_0x188d21[_0x23732d][_0x5497('0x72')]){_0x300f3e['group'](_0x2c58e6);}_0x188d21[_0x23732d][_0x5497('0x73')]&&_0x300f3e[_0x5497('0x3b')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x300f3e[_0x5497('0x64')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x88')]||_0x2c58e6);}if(_0x5cddbc['joins']){_0x5cddbc[_0x5497('0x75')]=JSON['parse'](_0x5cddbc[_0x5497('0x75')]);for(var _0x261804=0x0;_0x261804<_0x5cddbc[_0x5497('0x75')]['length'];_0x261804+=0x1){if(_0x5cddbc[_0x5497('0x75')][_0x261804]['type']&&_['includes'](_0x401f04,_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')])&&_0x5cddbc['joins'][_0x261804][_0x5497('0x77')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]){_0x300f3e[_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')]](_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],null,util['format'](_0x5497('0x89'),_0x5cddbc[_0x5497('0x6d')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x77')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]));}}}if(_0x5cddbc[_0x5497('0x7a')]){_0x5cddbc[_0x5497('0x7a')]=JSON[_0x5497('0x7b')](_0x5cddbc[_0x5497('0x7a')]);_0x300f3e[_0x5497('0x3d')](_0x2fd2e3(_0x5cddbc[_0x5497('0x7a')][_0x5497('0x63')]));}_0x4f9228=_0x300f3e[_0x5497('0xa6')]();_0x300f3e[_0x5497('0x20')](_0x494cc3);_0x300f3e[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')]('Limited\x20Query:',_0x300f3e[_0x5497('0x99')]());return dbH[_0x5497('0x7e')]['query'](_0x300f3e['toString'](),{'type':dbH[_0x5497('0x7e')]['QueryTypes'][_0x5497('0x80')]});}})[_0x5497('0x25')](function(){return{'sql':_0x4f9228[_0x5497('0x99')]()};})[_0x5497('0x25')](respondWithResult(_0xfba062,null))[_0x5497('0x47')](handleError(_0xfba062,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 57c4d07..2861d5b 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 _0xae8d=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport'];(function(_0xb4564c,_0x4fcb88){var _0x4e8dab=function(_0x32be0a){while(--_0x32be0a){_0xb4564c['push'](_0xb4564c['shift']());}};_0x4e8dab(++_0x4fcb88);}(_0xae8d,0x180));var _0xdae8=function(_0x4fda04,_0x503892){_0x4fda04=_0x4fda04-0x0;var _0x1d98f9=_0xae8d[_0x4fda04];return _0x1d98f9;};'use strict';var _=require(_0xdae8('0x0'));var util=require(_0xdae8('0x1'));var logger=require('../../config/logger')(_0xdae8('0x2'));var moment=require(_0xdae8('0x3'));var BPromise=require(_0xdae8('0x4'));var rp=require(_0xdae8('0x5'));var fs=require('fs');var path=require(_0xdae8('0x6'));var rimraf=require(_0xdae8('0x7'));var config=require('../../config/environment');var attributes=require(_0xdae8('0x8'));module[_0xdae8('0x9')]=function(_0x22a0d9,_0x108987){return _0x22a0d9[_0xdae8('0xa')](_0xdae8('0xb'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c05=['path','rimraf','../../config/environment','./analyticDefaultReport.attributes','AnalyticDefaultReport','analytics_default_reports','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4b231b,_0x1bc086){var _0x157264=function(_0x2a0bb7){while(--_0x2a0bb7){_0x4b231b['push'](_0x4b231b['shift']());}};_0x157264(++_0x1bc086);}(_0x1c05,0xc6));var _0x51c0=function(_0x2df3c9,_0x3d34a4){_0x2df3c9=_0x2df3c9-0x0;var _0x23696c=_0x1c05[_0x2df3c9];return _0x23696c;};'use strict';var _=require('lodash');var util=require(_0x51c0('0x0'));var logger=require(_0x51c0('0x1'))(_0x51c0('0x2'));var moment=require(_0x51c0('0x3'));var BPromise=require(_0x51c0('0x4'));var rp=require(_0x51c0('0x5'));var fs=require('fs');var path=require(_0x51c0('0x6'));var rimraf=require(_0x51c0('0x7'));var config=require(_0x51c0('0x8'));var attributes=require(_0x51c0('0x9'));module['exports']=function(_0x1af283,_0x5afe1e){return _0x1af283['define'](_0x51c0('0xa'),attributes,{'tableName':_0x51c0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 0fc027d..bab7186 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 _0x31b7=['message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4bfb4d,_0x404c40){var _0x3488f2=function(_0x204c9e){while(--_0x204c9e){_0x4bfb4d['push'](_0x4bfb4d['shift']());}};_0x3488f2(++_0x404c40);}(_0x31b7,0x13a));var _0x731b=function(_0xc51c1e,_0x495721){_0xc51c1e=_0xc51c1e-0x0;var _0x808ca7=_0x31b7[_0xc51c1e];return _0x808ca7;};'use strict';var _=require(_0x731b('0x0'));var util=require(_0x731b('0x1'));var moment=require('moment');var BPromise=require(_0x731b('0x2'));var rs=require(_0x731b('0x3'));var fs=require('fs');var Redis=require(_0x731b('0x4'));var db=require(_0x731b('0x5'))['db'];var utils=require(_0x731b('0x6'));var logger=require(_0x731b('0x7'))(_0x731b('0x8'));var config=require(_0x731b('0x9'));var jayson=require(_0x731b('0xa'));var client=jayson[_0x731b('0xb')][_0x731b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c010c,_0x34fb96,_0xe250b1){return new BPromise(function(_0x16b18e,_0x259659){return client[_0x731b('0xd')](_0x4c010c,_0xe250b1)[_0x731b('0xe')](function(_0x540e47){logger[_0x731b('0xf')](_0x731b('0x10'),_0x34fb96,_0x731b('0x11'));logger[_0x731b('0x12')](_0x731b('0x13'),_0x34fb96,_0x731b('0x11'),JSON[_0x731b('0x14')](_0x540e47));if(_0x540e47[_0x731b('0x15')]){if(_0x540e47[_0x731b('0x15')]['code']===0x1f4){logger[_0x731b('0x15')](_0x731b('0x10'),_0x34fb96,_0x540e47[_0x731b('0x15')]['message']);return _0x259659(_0x540e47['error'][_0x731b('0x16')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x34fb96,_0x540e47[_0x731b('0x15')][_0x731b('0x16')]);return _0x16b18e(_0x540e47[_0x731b('0x15')][_0x731b('0x16')]);}else{logger[_0x731b('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x34fb96,_0x731b('0x11'));_0x16b18e(_0x540e47['result'][_0x731b('0x16')]);}})[_0x731b('0x17')](function(_0x4fccc3){logger[_0x731b('0x15')](_0x731b('0x10'),_0x34fb96,_0x4fccc3);_0x259659(_0x4fccc3);});});} \ No newline at end of file +var _0xfa54=['http','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xfa54,0xe9));var _0x4fa5=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xfa54[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x4fa5('0x0'));var util=require(_0x4fa5('0x1'));var moment=require(_0x4fa5('0x2'));var BPromise=require('bluebird');var rs=require(_0x4fa5('0x3'));var fs=require('fs');var Redis=require(_0x4fa5('0x4'));var db=require(_0x4fa5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4fa5('0x6'))(_0x4fa5('0x7'));var config=require(_0x4fa5('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4fa5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39a5fc,_0x565080,_0x4b9d9a){return new BPromise(function(_0x11b6b5,_0x2a31b0){return client[_0x4fa5('0xa')](_0x39a5fc,_0x4b9d9a)['then'](function(_0x4e2448){logger[_0x4fa5('0xb')](_0x4fa5('0xc'),_0x565080,_0x4fa5('0xd'));logger[_0x4fa5('0xe')](_0x4fa5('0xf'),_0x565080,_0x4fa5('0xd'),JSON[_0x4fa5('0x10')](_0x4e2448));if(_0x4e2448[_0x4fa5('0x11')]){if(_0x4e2448[_0x4fa5('0x11')][_0x4fa5('0x12')]===0x1f4){logger[_0x4fa5('0x11')](_0x4fa5('0xc'),_0x565080,_0x4e2448[_0x4fa5('0x11')]['message']);return _0x2a31b0(_0x4e2448[_0x4fa5('0x11')]['message']);}logger[_0x4fa5('0x11')](_0x4fa5('0xc'),_0x565080,_0x4e2448[_0x4fa5('0x11')][_0x4fa5('0x13')]);return _0x11b6b5(_0x4e2448[_0x4fa5('0x11')]['message']);}else{logger[_0x4fa5('0xb')](_0x4fa5('0xc'),_0x565080,'request\x20sent');_0x11b6b5(_0x4e2448[_0x4fa5('0x14')][_0x4fa5('0x13')]);}})[_0x4fa5('0x15')](function(_0x238f54){logger['error'](_0x4fa5('0xc'),_0x565080,_0x238f54);_0x2a31b0(_0x238f54);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 9d400fd..8f01033 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 _0xd39b=['preview','/:id/run','run','/:id/query','post','create','put','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview'];(function(_0x1c1509,_0x2dfa81){var _0xf11b7=function(_0x17949e){while(--_0x17949e){_0x1c1509['push'](_0x1c1509['shift']());}};_0xf11b7(++_0x2dfa81);}(_0xd39b,0x181));var _0xbd39=function(_0x267df9,_0x58a4a7){_0x267df9=_0x267df9-0x0;var _0x4054a1=_0xd39b[_0x267df9];return _0x4054a1;};'use strict';var multer=require(_0xbd39('0x0'));var util=require('util');var path=require(_0xbd39('0x1'));var timeout=require(_0xbd39('0x2'));var express=require(_0xbd39('0x3'));var router=express['Router']();var fs_extra=require(_0xbd39('0x4'));var auth=require(_0xbd39('0x5'));var interaction=require(_0xbd39('0x6'));var config=require('../../config/environment');var controller=require(_0xbd39('0x7'));router[_0xbd39('0x8')]('/',auth[_0xbd39('0x9')](),controller[_0xbd39('0xa')]);router['get'](_0xbd39('0xb'),auth['isAuthenticated'](),controller[_0xbd39('0xc')]);router[_0xbd39('0x8')](_0xbd39('0xd'),auth[_0xbd39('0x9')](),controller[_0xbd39('0xe')]);router[_0xbd39('0x8')](_0xbd39('0xf'),auth[_0xbd39('0x9')](),controller[_0xbd39('0x10')]);router[_0xbd39('0x8')](_0xbd39('0x11'),auth[_0xbd39('0x9')](),controller['query']);router[_0xbd39('0x12')]('/',auth[_0xbd39('0x9')](),controller[_0xbd39('0x13')]);router[_0xbd39('0x14')](_0xbd39('0xb'),auth[_0xbd39('0x9')](),controller['update']);router['delete'](_0xbd39('0xb'),auth[_0xbd39('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x83ff=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','get','/:id','show','/:id/preview','preview','run','/:id/query','post','create','put','delete','destroy','exports','util'];(function(_0x2b755b,_0x1d1daf){var _0x62c945=function(_0x18abc1){while(--_0x18abc1){_0x2b755b['push'](_0x2b755b['shift']());}};_0x62c945(++_0x1d1daf);}(_0x83ff,0x17f));var _0xf83f=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x83ff[_0x138adb];return _0x1b27f2;};'use strict';var multer=require('multer');var util=require(_0xf83f('0x0'));var path=require(_0xf83f('0x1'));var timeout=require(_0xf83f('0x2'));var express=require(_0xf83f('0x3'));var router=express[_0xf83f('0x4')]();var fs_extra=require(_0xf83f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf83f('0x6'));var config=require(_0xf83f('0x7'));var controller=require(_0xf83f('0x8'));router['get']('/',auth[_0xf83f('0x9')](),controller[_0xf83f('0xa')]);router[_0xf83f('0xb')](_0xf83f('0xc'),auth[_0xf83f('0x9')](),controller[_0xf83f('0xd')]);router[_0xf83f('0xb')](_0xf83f('0xe'),auth[_0xf83f('0x9')](),controller[_0xf83f('0xf')]);router['get']('/:id/run',auth[_0xf83f('0x9')](),controller[_0xf83f('0x10')]);router[_0xf83f('0xb')](_0xf83f('0x11'),auth[_0xf83f('0x9')](),controller['query']);router[_0xf83f('0x12')]('/',auth['isAuthenticated'](),controller[_0xf83f('0x13')]);router[_0xf83f('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf83f('0x15')](_0xf83f('0xc'),auth['isAuthenticated'](),controller[_0xf83f('0x16')]);module[_0xf83f('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 88b76df..a0d458a 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 _0xf660=['ENUM','csv','pdf','DATE','Loading','scheduled','manual','INTEGER','UNSIGNED','moment','STRING'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0xf660,0x106));var _0x0f66=function(_0x4843f9,_0x4af459){_0x4843f9=_0x4843f9-0x0;var _0x193c6a=_0xf660[_0x4843f9];return _0x193c6a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0f66('0x0'));module['exports']={'name':{'type':Sequelize[_0x0f66('0x1')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x0f66('0x2')](_0x0f66('0x3'),_0x0f66('0x4'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x0f66('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x0f66('0x5')]},'endDate':{'type':Sequelize[_0x0f66('0x5')]},'status':{'type':Sequelize[_0x0f66('0x1')],'defaultValue':_0x0f66('0x6')},'type':{'type':Sequelize[_0x0f66('0x2')]('manual',_0x0f66('0x7')),'allowNull':![],'defaultValue':_0x0f66('0x8')},'reportId':{'type':Sequelize[_0x0f66('0x9')](0xb)[_0x0f66('0xa')]},'reportType':{'type':Sequelize[_0x0f66('0x1')]}}; \ No newline at end of file +var _0x2acf=['DATE','Loading','manual','INTEGER','UNSIGNED','moment','exports','ENUM','pdf','xlsx','csv','STRING'];(function(_0x155200,_0x228087){var _0x354c3a=function(_0xb986be){while(--_0xb986be){_0x155200['push'](_0x155200['shift']());}};_0x354c3a(++_0x228087);}(_0x2acf,0x101));var _0xf2ac=function(_0x595604,_0x2cc998){_0x595604=_0x595604-0x0;var _0x1466f3=_0x2acf[_0x595604];return _0x1466f3;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf2ac('0x0'));module[_0xf2ac('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xf2ac('0x2')]('csv',_0xf2ac('0x3'),_0xf2ac('0x4')),'allowNull':![],'defaultValue':_0xf2ac('0x5')},'savename':{'type':Sequelize[_0xf2ac('0x6')],'allowNull':![]},'startDate':{'type':Sequelize[_0xf2ac('0x7')]},'endDate':{'type':Sequelize[_0xf2ac('0x7')]},'status':{'type':Sequelize[_0xf2ac('0x6')],'defaultValue':_0xf2ac('0x8')},'type':{'type':Sequelize['ENUM'](_0xf2ac('0x9'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xf2ac('0xa')](0xb)[_0xf2ac('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 7288968..2d99c4b 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 _0x3e28=['name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','download','basename','output','existsSync','join','server/files/reports','Sequelize','ValidationError','exists','root','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','stack'];(function(_0xc7fbe7,_0x553b01){var _0x7c4e0c=function(_0x228441){while(--_0x228441){_0xc7fbe7['push'](_0xc7fbe7['shift']());}};_0x7c4e0c(++_0x553b01);}(_0x3e28,0x14a));var _0x83e2=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x3e28[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require(_0x83e2('0x0'));var rimraf=require(_0x83e2('0x1'));var zipdir=require(_0x83e2('0x2'));var jsonpatch=require(_0x83e2('0x3'));var rp=require(_0x83e2('0x4'));var moment=require(_0x83e2('0x5'));var BPromise=require(_0x83e2('0x6'));var Mustache=require(_0x83e2('0x7'));var util=require('util');var path=require('path');var sox=require(_0x83e2('0x8'));var csv=require(_0x83e2('0x9'));var ejs=require(_0x83e2('0xa'));var fs=require('fs');var fs_extra=require(_0x83e2('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x83e2('0xc'));var jsforce=require(_0x83e2('0xd'));var deskjs=require(_0x83e2('0xe'));var toCsv=require(_0x83e2('0x9'));var querystring=require(_0x83e2('0xf'));var Papa=require(_0x83e2('0x10'));var Redis=require(_0x83e2('0x11'));var authService=require(_0x83e2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x83e2('0x13'));var hardwareService=require(_0x83e2('0x14'));var logger=require(_0x83e2('0x15'))('api');var utils=require(_0x83e2('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x160a0d,_0x26dfce){_0x26dfce=_0x26dfce||0xcc;return function(_0x53a340){if(_0x53a340){return _0x160a0d[_0x83e2('0x17')](_0x26dfce);}return _0x160a0d[_0x83e2('0x18')](_0x26dfce)[_0x83e2('0x19')]();};}function respondWithResult(_0x5606b6,_0x3b2f99){_0x3b2f99=_0x3b2f99||0xc8;return function(_0x3f50ef){if(_0x3f50ef){return _0x5606b6[_0x83e2('0x18')](_0x3b2f99)[_0x83e2('0x1a')](_0x3f50ef);}};}function respondWithFilteredResult(_0xd8d6ca,_0xd40fc8){return function(_0x2e6c37){if(_0x2e6c37){var _0x38e9f6=typeof _0xd40fc8[_0x83e2('0x1b')]==='undefined'&&typeof _0xd40fc8['limit']===_0x83e2('0x1c');var _0x3466db=_0x2e6c37[_0x83e2('0x1d')];var _0xcb2c5e=_0x38e9f6?0x0:_0xd40fc8[_0x83e2('0x1b')];var _0x4565e5=_0x38e9f6?_0x2e6c37[_0x83e2('0x1d')]:_0xd40fc8[_0x83e2('0x1b')]+_0xd40fc8[_0x83e2('0x1e')];var _0x3a4c6f;if(_0x4565e5>=_0x3466db){_0x4565e5=_0x3466db;_0x3a4c6f=0xc8;}else{_0x3a4c6f=0xce;}_0xd8d6ca['status'](_0x3a4c6f);return _0xd8d6ca[_0x83e2('0x1f')]('Content-Range',_0xcb2c5e+'-'+_0x4565e5+'/'+_0x3466db)['json'](_0x2e6c37);}return null;};}function patchUpdates(_0x44593f){return function(_0x4f4d2d){try{jsonpatch[_0x83e2('0x20')](_0x4f4d2d,_0x44593f,!![]);}catch(_0x10686d){return BPromise[_0x83e2('0x21')](_0x10686d);}return _0x4f4d2d[_0x83e2('0x22')]();};}function saveUpdates(_0x3839ad,_0x22ff35){return function(_0x5c42fa){if(_0x5c42fa){return _0x5c42fa[_0x83e2('0x23')](_0x3839ad)[_0x83e2('0x24')](function(_0x2257c4){return _0x2257c4;});}return null;};}function removeEntity(_0x2add80,_0x2f3a5f){return function(_0x1d4db3){if(_0x1d4db3){return _0x1d4db3[_0x83e2('0x25')]()[_0x83e2('0x24')](function(){var _0x2d293d=_0x1d4db3[_0x83e2('0x26')]({'plain':!![]});var _0x2b52a4=_0x83e2('0x27');return db[_0x83e2('0x28')][_0x83e2('0x25')]({'where':{'type':_0x2b52a4,'resourceId':_0x2d293d['id']}})[_0x83e2('0x24')](function(){return _0x1d4db3;});})[_0x83e2('0x24')](function(){_0x2add80[_0x83e2('0x18')](0xcc)[_0x83e2('0x19')]();});}};}function handleEntityNotFound(_0x33dcb8,_0x34957a){return function(_0x14c144){if(!_0x14c144){_0x33dcb8['sendStatus'](0x194);}return _0x14c144;};}function handleError(_0x332f47,_0x1b49e1){_0x1b49e1=_0x1b49e1||0x1f4;return function(_0x158b7f){logger['error'](_0x158b7f[_0x83e2('0x29')]);if(_0x158b7f[_0x83e2('0x2a')]){delete _0x158b7f[_0x83e2('0x2a')];}_0x332f47['status'](_0x1b49e1)[_0x83e2('0x2b')](_0x158b7f);};}exports[_0x83e2('0x2c')]=function(_0x14bad7,_0x1f000e){var _0x13dd2f={},_0x478893={},_0x2d2533={'count':0x0,'rows':[]};var _0x2a78dd=_[_0x83e2('0x2d')](db[_0x83e2('0x2e')][_0x83e2('0x2f')],function(_0x5ee8dc){return{'name':_0x5ee8dc[_0x83e2('0x30')],'type':_0x5ee8dc[_0x83e2('0x31')][_0x83e2('0x32')]};});_0x478893[_0x83e2('0x33')]=_['map'](_0x2a78dd,'name');_0x478893[_0x83e2('0x34')]=_['keys'](_0x14bad7[_0x83e2('0x34')]);_0x478893[_0x83e2('0x35')]=_['intersection'](_0x478893[_0x83e2('0x33')],_0x478893[_0x83e2('0x34')]);_0x13dd2f[_0x83e2('0x36')]=_[_0x83e2('0x37')](_0x478893[_0x83e2('0x33')],qs[_0x83e2('0x38')](_0x14bad7[_0x83e2('0x34')][_0x83e2('0x38')]));_0x13dd2f[_0x83e2('0x36')]=_0x13dd2f[_0x83e2('0x36')]['length']?_0x13dd2f[_0x83e2('0x36')]:_0x478893[_0x83e2('0x33')];if(!_0x14bad7['query'][_0x83e2('0x39')](_0x83e2('0x3a'))){_0x13dd2f[_0x83e2('0x1e')]=qs['limit'](_0x14bad7[_0x83e2('0x34')][_0x83e2('0x1e')]);_0x13dd2f[_0x83e2('0x1b')]=qs['offset'](_0x14bad7['query'][_0x83e2('0x1b')]);}_0x13dd2f['order']=qs[_0x83e2('0x3b')](_0x14bad7['query']['sort']);_0x13dd2f[_0x83e2('0x3c')]=qs[_0x83e2('0x35')](_[_0x83e2('0x3d')](_0x14bad7[_0x83e2('0x34')],_0x478893[_0x83e2('0x35')]),_0x2a78dd);if(_0x14bad7[_0x83e2('0x34')][_0x83e2('0x3e')]){_0x13dd2f['where']=_['merge'](_0x13dd2f['where'],{'$or':_[_0x83e2('0x2d')](_0x2a78dd,function(_0x50d53e){if(_0x50d53e[_0x83e2('0x31')]!=='VIRTUAL'){var _0x2135e5={};_0x2135e5[_0x50d53e[_0x83e2('0x2a')]]={'$like':'%'+_0x14bad7[_0x83e2('0x34')]['filter']+'%'};return _0x2135e5;}})});}_0x13dd2f=_[_0x83e2('0x3f')]({},_0x13dd2f,_0x14bad7[_0x83e2('0x40')]);var _0xe141fe={'where':_0x13dd2f[_0x83e2('0x3c')]};return db[_0x83e2('0x2e')][_0x83e2('0x1d')](_0xe141fe)[_0x83e2('0x24')](function(_0x77f616){_0x2d2533[_0x83e2('0x1d')]=_0x77f616;if(_0x14bad7['query'][_0x83e2('0x41')]){_0x13dd2f[_0x83e2('0x42')]=[{'all':!![]}];}return db[_0x83e2('0x2e')][_0x83e2('0x43')](_0x13dd2f);})[_0x83e2('0x24')](function(_0x26eb0a){_0x2d2533['rows']=_0x26eb0a;return _0x2d2533;})['then'](respondWithFilteredResult(_0x1f000e,_0x13dd2f))[_0x83e2('0x44')](handleError(_0x1f000e,null));};exports[_0x83e2('0x45')]=function(_0x3f952e,_0x552815){var _0x3ba007={'raw':!![],'where':{'id':_0x3f952e[_0x83e2('0x46')]['id']}},_0x4621f9={};_0x4621f9[_0x83e2('0x33')]=_['keys'](db[_0x83e2('0x2e')]['rawAttributes']);_0x4621f9['query']=_[_0x83e2('0x47')](_0x3f952e[_0x83e2('0x34')]);_0x4621f9[_0x83e2('0x35')]=_[_0x83e2('0x37')](_0x4621f9['model'],_0x4621f9[_0x83e2('0x34')]);_0x3ba007['attributes']=_[_0x83e2('0x37')](_0x4621f9[_0x83e2('0x33')],qs[_0x83e2('0x38')](_0x3f952e[_0x83e2('0x34')][_0x83e2('0x38')]));_0x3ba007[_0x83e2('0x36')]=_0x3ba007[_0x83e2('0x36')][_0x83e2('0x48')]?_0x3ba007[_0x83e2('0x36')]:_0x4621f9[_0x83e2('0x33')];if(_0x3f952e[_0x83e2('0x34')][_0x83e2('0x41')]){_0x3ba007[_0x83e2('0x42')]=[{'all':!![]}];}_0x3ba007=_['merge']({},_0x3ba007,_0x3f952e[_0x83e2('0x40')]);return db[_0x83e2('0x2e')][_0x83e2('0x49')](_0x3ba007)[_0x83e2('0x24')](handleEntityNotFound(_0x552815,null))['then'](respondWithResult(_0x552815,null))['catch'](handleError(_0x552815,null));};exports[_0x83e2('0x4a')]=function(_0x3f2942,_0x573077){return db[_0x83e2('0x2e')][_0x83e2('0x4a')](_0x3f2942[_0x83e2('0x4b')],{})['then'](function(_0x10402f){var _0x1f41a6=_0x3f2942[_0x83e2('0x4c')][_0x83e2('0x26')]({'plain':!![]});if(!_0x1f41a6)throw new Error(_0x83e2('0x4d'));if(_0x1f41a6['role']===_0x83e2('0x4c')){var _0x353ac7=_0x10402f['get']({'plain':!![]});var _0x396d5e=_0x83e2('0x27');return db[_0x83e2('0x4e')]['find']({'where':{'name':_0x396d5e,'userProfileId':_0x1f41a6[_0x83e2('0x4f')]},'raw':!![]})['then'](function(_0x4c308b){if(_0x4c308b&&_0x4c308b['autoAssociation']===0x0){return db[_0x83e2('0x28')][_0x83e2('0x4a')]({'name':_0x353ac7[_0x83e2('0x2a')],'resourceId':_0x353ac7['id'],'type':_0x4c308b[_0x83e2('0x2a')],'sectionId':_0x4c308b['id']},{})['then'](function(){return _0x10402f;});}else{return _0x10402f;}})[_0x83e2('0x44')](function(_0x23a573){logger[_0x83e2('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23a573);throw _0x23a573;});}return _0x10402f;})[_0x83e2('0x24')](respondWithResult(_0x573077,0xc9))[_0x83e2('0x44')](handleError(_0x573077,null));};exports['update']=function(_0x13e7f4,_0x461850){if(_0x13e7f4['body']['id']){delete _0x13e7f4['body']['id'];}return db[_0x83e2('0x2e')][_0x83e2('0x49')]({'where':{'id':_0x13e7f4[_0x83e2('0x46')]['id']}})['then'](handleEntityNotFound(_0x461850,null))['then'](saveUpdates(_0x13e7f4[_0x83e2('0x4b')],null))['then'](respondWithResult(_0x461850,null))['catch'](handleError(_0x461850,null));};exports[_0x83e2('0x25')]=function(_0x26e24b,_0xb6322c){return db[_0x83e2('0x2e')]['find']({'where':{'id':_0x26e24b[_0x83e2('0x46')]['id']}})[_0x83e2('0x24')](handleEntityNotFound(_0xb6322c,null))['then'](removeEntity(_0xb6322c,null))[_0x83e2('0x44')](handleError(_0xb6322c,null));};exports[_0x83e2('0x51')]=function(_0x32d6d8,_0x2c3cda,_0x24c951){return db[_0x83e2('0x2e')]['find']({'where':{'id':_0x32d6d8['params']['id']},'attributes':['name',_0x83e2('0x52'),'savename',_0x83e2('0x53')],'raw':!![]})[_0x83e2('0x24')](handleEntityNotFound(_0x2c3cda,null))[_0x83e2('0x24')](function(_0x26fceb){if(_0x26fceb){if(!fs[_0x83e2('0x54')](path[_0x83e2('0x55')](config['root'],_0x83e2('0x56'),_0x26fceb['savename']))){throw new db[(_0x83e2('0x57'))][(_0x83e2('0x58'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x32d6d8['query'][_0x83e2('0x59')]){return _0x2c3cda[_0x83e2('0x17')](0xc8);}return _0x2c3cda['download'](path[_0x83e2('0x55')](config[_0x83e2('0x5a')],_0x83e2('0x56'),_0x26fceb['savename']),util['format'](_0x83e2('0x5b'),_0x26fceb[_0x83e2('0x52')]||_0x26fceb[_0x83e2('0x2a')],_0x26fceb['output'][_0x83e2('0x5c')]()));}})[_0x83e2('0x44')](handleError(_0x2c3cda,null));}; \ No newline at end of file +var _0x56b9=['format','%s.%s','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','ExtractedReports','destroy','error','stack','name','send','AnalyticExtractedReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','catch','show','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','exists','sendStatus','savename'];(function(_0x8e4e8,_0x158fc4){var _0x21fa1b=function(_0x56eb9c){while(--_0x56eb9c){_0x8e4e8['push'](_0x8e4e8['shift']());}};_0x21fa1b(++_0x158fc4);}(_0x56b9,0xc2));var _0x956b=function(_0x4f2540,_0x10e19b){_0x4f2540=_0x4f2540-0x0;var _0x151dd6=_0x56b9[_0x4f2540];return _0x151dd6;};'use strict';var emlformat=require(_0x956b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x956b('0x1'));var jsonpatch=require(_0x956b('0x2'));var rp=require(_0x956b('0x3'));var moment=require('moment');var BPromise=require(_0x956b('0x4'));var Mustache=require(_0x956b('0x5'));var util=require('util');var path=require(_0x956b('0x6'));var sox=require(_0x956b('0x7'));var csv=require(_0x956b('0x8'));var ejs=require(_0x956b('0x9'));var fs=require('fs');var fs_extra=require(_0x956b('0xa'));var _=require(_0x956b('0xb'));var squel=require(_0x956b('0xc'));var crypto=require('crypto');var jsforce=require(_0x956b('0xd'));var deskjs=require(_0x956b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x956b('0xf'));var Papa=require(_0x956b('0x10'));var Redis=require('ioredis');var authService=require(_0x956b('0x11'));var qs=require(_0x956b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x956b('0x13'));var logger=require(_0x956b('0x14'))('api');var utils=require(_0x956b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x956b('0x16'));var db=require(_0x956b('0x17'))['db'];function respondWithStatusCode(_0x5dc731,_0x2ab95b){_0x2ab95b=_0x2ab95b||0xcc;return function(_0x4540b6){if(_0x4540b6){return _0x5dc731['sendStatus'](_0x2ab95b);}return _0x5dc731[_0x956b('0x18')](_0x2ab95b)[_0x956b('0x19')]();};}function respondWithResult(_0x56bf2d,_0x3fff1f){_0x3fff1f=_0x3fff1f||0xc8;return function(_0x50f5a2){if(_0x50f5a2){return _0x56bf2d[_0x956b('0x18')](_0x3fff1f)[_0x956b('0x1a')](_0x50f5a2);}};}function respondWithFilteredResult(_0x168045,_0x2a21a1){return function(_0x12146b){if(_0x12146b){var _0x59d02d=typeof _0x2a21a1['offset']===_0x956b('0x1b')&&typeof _0x2a21a1[_0x956b('0x1c')]===_0x956b('0x1b');var _0x1feaee=_0x12146b[_0x956b('0x1d')];var _0x418f6a=_0x59d02d?0x0:_0x2a21a1[_0x956b('0x1e')];var _0x5d08a1=_0x59d02d?_0x12146b[_0x956b('0x1d')]:_0x2a21a1[_0x956b('0x1e')]+_0x2a21a1[_0x956b('0x1c')];var _0x4b252b;if(_0x5d08a1>=_0x1feaee){_0x5d08a1=_0x1feaee;_0x4b252b=0xc8;}else{_0x4b252b=0xce;}_0x168045['status'](_0x4b252b);return _0x168045[_0x956b('0x1f')](_0x956b('0x20'),_0x418f6a+'-'+_0x5d08a1+'/'+_0x1feaee)['json'](_0x12146b);}return null;};}function patchUpdates(_0xe8caaa){return function(_0x37ba88){try{jsonpatch[_0x956b('0x21')](_0x37ba88,_0xe8caaa,!![]);}catch(_0x55d161){return BPromise[_0x956b('0x22')](_0x55d161);}return _0x37ba88[_0x956b('0x23')]();};}function saveUpdates(_0x36b853,_0x236b6e){return function(_0x10a513){if(_0x10a513){return _0x10a513[_0x956b('0x24')](_0x36b853)[_0x956b('0x25')](function(_0x66135f){return _0x66135f;});}return null;};}function removeEntity(_0xc88bce,_0x197f5c){return function(_0x52b030){if(_0x52b030){return _0x52b030['destroy']()['then'](function(){var _0x4e462e=_0x52b030[_0x956b('0x26')]({'plain':!![]});var _0x27e6a2=_0x956b('0x27');return db['UserProfileResource'][_0x956b('0x28')]({'where':{'type':_0x27e6a2,'resourceId':_0x4e462e['id']}})[_0x956b('0x25')](function(){return _0x52b030;});})['then'](function(){_0xc88bce['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x592259,_0x4d2089){return function(_0x2e6770){if(!_0x2e6770){_0x592259['sendStatus'](0x194);}return _0x2e6770;};}function handleError(_0x57a020,_0x8f52db){_0x8f52db=_0x8f52db||0x1f4;return function(_0x12aa8c){logger[_0x956b('0x29')](_0x12aa8c[_0x956b('0x2a')]);if(_0x12aa8c[_0x956b('0x2b')]){delete _0x12aa8c['name'];}_0x57a020['status'](_0x8f52db)[_0x956b('0x2c')](_0x12aa8c);};}exports['index']=function(_0x3d7945,_0x1bb348){var _0x136461={},_0x10cdf6={},_0x470155={'count':0x0,'rows':[]};var _0x22dbfd=_['map'](db[_0x956b('0x2d')][_0x956b('0x2e')],function(_0x4682aa){return{'name':_0x4682aa[_0x956b('0x2f')],'type':_0x4682aa[_0x956b('0x30')][_0x956b('0x31')]};});_0x10cdf6['model']=_[_0x956b('0x32')](_0x22dbfd,'name');_0x10cdf6[_0x956b('0x33')]=_[_0x956b('0x34')](_0x3d7945[_0x956b('0x33')]);_0x10cdf6[_0x956b('0x35')]=_[_0x956b('0x36')](_0x10cdf6[_0x956b('0x37')],_0x10cdf6['query']);_0x136461[_0x956b('0x38')]=_[_0x956b('0x36')](_0x10cdf6[_0x956b('0x37')],qs[_0x956b('0x39')](_0x3d7945[_0x956b('0x33')][_0x956b('0x39')]));_0x136461[_0x956b('0x38')]=_0x136461[_0x956b('0x38')][_0x956b('0x3a')]?_0x136461[_0x956b('0x38')]:_0x10cdf6[_0x956b('0x37')];if(!_0x3d7945[_0x956b('0x33')]['hasOwnProperty'](_0x956b('0x3b'))){_0x136461[_0x956b('0x1c')]=qs[_0x956b('0x1c')](_0x3d7945['query'][_0x956b('0x1c')]);_0x136461[_0x956b('0x1e')]=qs[_0x956b('0x1e')](_0x3d7945[_0x956b('0x33')][_0x956b('0x1e')]);}_0x136461[_0x956b('0x3c')]=qs[_0x956b('0x3d')](_0x3d7945[_0x956b('0x33')][_0x956b('0x3d')]);_0x136461[_0x956b('0x3e')]=qs[_0x956b('0x35')](_['pick'](_0x3d7945[_0x956b('0x33')],_0x10cdf6[_0x956b('0x35')]),_0x22dbfd);if(_0x3d7945['query'][_0x956b('0x3f')]){_0x136461[_0x956b('0x3e')]=_[_0x956b('0x40')](_0x136461[_0x956b('0x3e')],{'$or':_['map'](_0x22dbfd,function(_0x4f2f84){if(_0x4f2f84['type']!==_0x956b('0x41')){var _0x5058be={};_0x5058be[_0x4f2f84['name']]={'$like':'%'+_0x3d7945['query'][_0x956b('0x3f')]+'%'};return _0x5058be;}})});}_0x136461=_[_0x956b('0x40')]({},_0x136461,_0x3d7945[_0x956b('0x42')]);var _0x4c76e5={'where':_0x136461[_0x956b('0x3e')]};return db[_0x956b('0x2d')][_0x956b('0x1d')](_0x4c76e5)['then'](function(_0x380ff3){_0x470155[_0x956b('0x1d')]=_0x380ff3;if(_0x3d7945[_0x956b('0x33')][_0x956b('0x43')]){_0x136461['include']=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x136461);})['then'](function(_0x2a29e6){_0x470155['rows']=_0x2a29e6;return _0x470155;})['then'](respondWithFilteredResult(_0x1bb348,_0x136461))[_0x956b('0x44')](handleError(_0x1bb348,null));};exports[_0x956b('0x45')]=function(_0x5898dc,_0x43474e){var _0x72a99e={'raw':!![],'where':{'id':_0x5898dc['params']['id']}},_0x221b27={};_0x221b27[_0x956b('0x37')]=_[_0x956b('0x34')](db['AnalyticExtractedReport'][_0x956b('0x2e')]);_0x221b27[_0x956b('0x33')]=_[_0x956b('0x34')](_0x5898dc[_0x956b('0x33')]);_0x221b27[_0x956b('0x35')]=_[_0x956b('0x36')](_0x221b27['model'],_0x221b27[_0x956b('0x33')]);_0x72a99e['attributes']=_['intersection'](_0x221b27[_0x956b('0x37')],qs[_0x956b('0x39')](_0x5898dc[_0x956b('0x33')][_0x956b('0x39')]));_0x72a99e[_0x956b('0x38')]=_0x72a99e[_0x956b('0x38')][_0x956b('0x3a')]?_0x72a99e[_0x956b('0x38')]:_0x221b27[_0x956b('0x37')];if(_0x5898dc[_0x956b('0x33')][_0x956b('0x43')]){_0x72a99e[_0x956b('0x46')]=[{'all':!![]}];}_0x72a99e=_[_0x956b('0x40')]({},_0x72a99e,_0x5898dc[_0x956b('0x42')]);return db['AnalyticExtractedReport'][_0x956b('0x47')](_0x72a99e)[_0x956b('0x25')](handleEntityNotFound(_0x43474e,null))[_0x956b('0x25')](respondWithResult(_0x43474e,null))[_0x956b('0x44')](handleError(_0x43474e,null));};exports[_0x956b('0x48')]=function(_0x5aad3f,_0x49c17b){return db[_0x956b('0x2d')][_0x956b('0x48')](_0x5aad3f[_0x956b('0x49')],{})[_0x956b('0x25')](function(_0x1230c3){var _0x48dee5=_0x5aad3f[_0x956b('0x4a')][_0x956b('0x26')]({'plain':!![]});if(!_0x48dee5)throw new Error(_0x956b('0x4b'));if(_0x48dee5[_0x956b('0x4c')]==='user'){var _0x11d79a=_0x1230c3[_0x956b('0x26')]({'plain':!![]});var _0x331bcb=_0x956b('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x331bcb,'userProfileId':_0x48dee5[_0x956b('0x4d')]},'raw':!![]})[_0x956b('0x25')](function(_0x23ba26){if(_0x23ba26&&_0x23ba26[_0x956b('0x4e')]===0x0){return db[_0x956b('0x4f')]['create']({'name':_0x11d79a[_0x956b('0x2b')],'resourceId':_0x11d79a['id'],'type':_0x23ba26[_0x956b('0x2b')],'sectionId':_0x23ba26['id']},{})[_0x956b('0x25')](function(){return _0x1230c3;});}else{return _0x1230c3;}})[_0x956b('0x44')](function(_0x53e3e3){logger[_0x956b('0x29')](_0x956b('0x50'),_0x53e3e3);throw _0x53e3e3;});}return _0x1230c3;})[_0x956b('0x25')](respondWithResult(_0x49c17b,0xc9))[_0x956b('0x44')](handleError(_0x49c17b,null));};exports[_0x956b('0x24')]=function(_0x1d3c73,_0x31eac6){if(_0x1d3c73['body']['id']){delete _0x1d3c73[_0x956b('0x49')]['id'];}return db[_0x956b('0x2d')][_0x956b('0x47')]({'where':{'id':_0x1d3c73[_0x956b('0x51')]['id']}})[_0x956b('0x25')](handleEntityNotFound(_0x31eac6,null))[_0x956b('0x25')](saveUpdates(_0x1d3c73[_0x956b('0x49')],null))['then'](respondWithResult(_0x31eac6,null))[_0x956b('0x44')](handleError(_0x31eac6,null));};exports['destroy']=function(_0x3e2fee,_0xbda9ab){return db['AnalyticExtractedReport'][_0x956b('0x47')]({'where':{'id':_0x3e2fee['params']['id']}})[_0x956b('0x25')](handleEntityNotFound(_0xbda9ab,null))[_0x956b('0x25')](removeEntity(_0xbda9ab,null))['catch'](handleError(_0xbda9ab,null));};exports[_0x956b('0x52')]=function(_0x5be939,_0x2974e0,_0x5b62f7){return db[_0x956b('0x2d')]['find']({'where':{'id':_0x5be939['params']['id']},'attributes':[_0x956b('0x2b'),_0x956b('0x53'),'savename',_0x956b('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x2974e0,null))[_0x956b('0x25')](function(_0x49d89f){if(_0x49d89f){if(!fs[_0x956b('0x55')](path[_0x956b('0x56')](config[_0x956b('0x57')],_0x956b('0x58'),_0x49d89f['savename']))){throw new db[(_0x956b('0x59'))][(_0x956b('0x5a'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x5be939['query'][_0x956b('0x5b')]){return _0x2974e0[_0x956b('0x5c')](0xc8);}return _0x2974e0[_0x956b('0x52')](path[_0x956b('0x56')](config[_0x956b('0x57')],_0x956b('0x58'),_0x49d89f[_0x956b('0x5d')]),util[_0x956b('0x5e')](_0x956b('0x5f'),_0x49d89f['basename']||_0x49d89f[_0x956b('0x2b')],_0x49d89f['output']['toLowerCase']()));}})['catch'](handleError(_0x2974e0,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 83d9ae1..6cd808c 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 _0x5169=['AnalyticExtractedReport','analytics_extracted_reports','lodash','util','api','moment','rimraf','../../config/environment','exports','define'];(function(_0x1187ee,_0x11f291){var _0x4ff316=function(_0x10691c){while(--_0x10691c){_0x1187ee['push'](_0x1187ee['shift']());}};_0x4ff316(++_0x11f291);}(_0x5169,0x16a));var _0x9516=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x5169[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0x9516('0x0'));var util=require(_0x9516('0x1'));var logger=require('../../config/logger')(_0x9516('0x2'));var moment=require(_0x9516('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9516('0x4'));var config=require(_0x9516('0x5'));var attributes=require('./analyticExtractedReport.attributes');module[_0x9516('0x6')]=function(_0x1d8ba7,_0x171855){return _0x1d8ba7[_0x9516('0x7')](_0x9516('0x8'),attributes,{'tableName':_0x9516('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce97=['rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x284609,_0x386b54){var _0x55116b=function(_0x3cdc4e){while(--_0x3cdc4e){_0x284609['push'](_0x284609['shift']());}};_0x55116b(++_0x386b54);}(_0xce97,0x118));var _0x7ce9=function(_0x10c680,_0x50c234){_0x10c680=_0x10c680-0x0;var _0x399c3b=_0xce97[_0x10c680];return _0x399c3b;};'use strict';var _=require(_0x7ce9('0x0'));var util=require(_0x7ce9('0x1'));var logger=require(_0x7ce9('0x2'))(_0x7ce9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7ce9('0x4'));var fs=require('fs');var path=require(_0x7ce9('0x5'));var rimraf=require(_0x7ce9('0x6'));var config=require(_0x7ce9('0x7'));var attributes=require(_0x7ce9('0x8'));module[_0x7ce9('0x9')]=function(_0x4f2ef7,_0x5a7d79){return _0x4f2ef7[_0x7ce9('0xa')](_0x7ce9('0xb'),attributes,{'tableName':_0x7ce9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index f364ee9..5424b13 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 _0x1b8f=['catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result'];(function(_0x510cd9,_0x551300){var _0x2b1f61=function(_0x345249){while(--_0x345249){_0x510cd9['push'](_0x510cd9['shift']());}};_0x2b1f61(++_0x551300);}(_0x1b8f,0x8b));var _0xf1b8=function(_0x3d685b,_0x13b983){_0x3d685b=_0x3d685b-0x0;var _0x4fb0d4=_0x1b8f[_0x3d685b];return _0x4fb0d4;};'use strict';var _=require('lodash');var util=require(_0xf1b8('0x0'));var moment=require('moment');var BPromise=require(_0xf1b8('0x1'));var rs=require(_0xf1b8('0x2'));var fs=require('fs');var Redis=require(_0xf1b8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf1b8('0x4'));var logger=require(_0xf1b8('0x5'))(_0xf1b8('0x6'));var config=require(_0xf1b8('0x7'));var jayson=require(_0xf1b8('0x8'));var client=jayson[_0xf1b8('0x9')][_0xf1b8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58f761,_0x5a2087,_0x26538e){return new BPromise(function(_0x1b8c35,_0x2c9f56){return client[_0xf1b8('0xb')](_0x58f761,_0x26538e)[_0xf1b8('0xc')](function(_0x2967b3){logger['info'](_0xf1b8('0xd'),_0x5a2087,_0xf1b8('0xe'));logger[_0xf1b8('0xf')](_0xf1b8('0x10'),_0x5a2087,_0xf1b8('0xe'),JSON['stringify'](_0x2967b3));if(_0x2967b3[_0xf1b8('0x11')]){if(_0x2967b3[_0xf1b8('0x11')][_0xf1b8('0x12')]===0x1f4){logger[_0xf1b8('0x11')](_0xf1b8('0xd'),_0x5a2087,_0x2967b3['error'][_0xf1b8('0x13')]);return _0x2c9f56(_0x2967b3[_0xf1b8('0x11')][_0xf1b8('0x13')]);}logger['error'](_0xf1b8('0xd'),_0x5a2087,_0x2967b3['error'][_0xf1b8('0x13')]);return _0x1b8c35(_0x2967b3[_0xf1b8('0x11')][_0xf1b8('0x13')]);}else{logger[_0xf1b8('0x14')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5a2087,_0xf1b8('0xe'));_0x1b8c35(_0x2967b3[_0xf1b8('0x15')][_0xf1b8('0x13')]);}})[_0xf1b8('0x16')](function(_0x4621ba){logger['error'](_0xf1b8('0xd'),_0x5a2087,_0x4621ba);_0x2c9f56(_0x4621ba);});});} \ No newline at end of file +var _0xc5dc=['error','code','message','catch','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x491cbe,_0x45c8ba){var _0x59449d=function(_0x21b463){while(--_0x21b463){_0x491cbe['push'](_0x491cbe['shift']());}};_0x59449d(++_0x45c8ba);}(_0xc5dc,0xc2));var _0xcc5d=function(_0x3dbec3,_0x4e4b3b){_0x3dbec3=_0x3dbec3-0x0;var _0x61a2ec=_0xc5dc[_0x3dbec3];return _0x61a2ec;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcc5d('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcc5d('0x1'));var db=require(_0xcc5d('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc5d('0x3'))('rpc');var config=require(_0xcc5d('0x4'));var jayson=require(_0xcc5d('0x5'));var client=jayson[_0xcc5d('0x6')][_0xcc5d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x176398,_0x3145db,_0x4ceb49){return new BPromise(function(_0x56ebc1,_0x2a8647){return client[_0xcc5d('0x8')](_0x176398,_0x4ceb49)['then'](function(_0x55b3fd){logger[_0xcc5d('0x9')](_0xcc5d('0xa'),_0x3145db,_0xcc5d('0xb'));logger[_0xcc5d('0xc')](_0xcc5d('0xd'),_0x3145db,'request\x20sent',JSON[_0xcc5d('0xe')](_0x55b3fd));if(_0x55b3fd[_0xcc5d('0xf')]){if(_0x55b3fd['error'][_0xcc5d('0x10')]===0x1f4){logger[_0xcc5d('0xf')](_0xcc5d('0xa'),_0x3145db,_0x55b3fd[_0xcc5d('0xf')][_0xcc5d('0x11')]);return _0x2a8647(_0x55b3fd[_0xcc5d('0xf')][_0xcc5d('0x11')]);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x3145db,_0x55b3fd[_0xcc5d('0xf')][_0xcc5d('0x11')]);return _0x56ebc1(_0x55b3fd[_0xcc5d('0xf')][_0xcc5d('0x11')]);}else{logger[_0xcc5d('0x9')](_0xcc5d('0xa'),_0x3145db,_0xcc5d('0xb'));_0x56ebc1(_0x55b3fd['result'][_0xcc5d('0x11')]);}})[_0xcc5d('0x12')](function(_0x1a9619){logger['error'](_0xcc5d('0xa'),_0x3145db,_0x1a9619);_0x2a8647(_0x1a9619);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 21ca81f..dce0341 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 _0x3da4=['download','post','put','update','delete','destroy','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download'];(function(_0x4955fa,_0x2e654c){var _0x9a2fd7=function(_0x3f3756){while(--_0x3f3756){_0x4955fa['push'](_0x4955fa['shift']());}};_0x9a2fd7(++_0x2e654c);}(_0x3da4,0x182));var _0x43da=function(_0xe15f5a,_0x2e028e){_0xe15f5a=_0xe15f5a-0x0;var _0xef92a1=_0x3da4[_0xe15f5a];return _0xef92a1;};'use strict';var multer=require(_0x43da('0x0'));var util=require(_0x43da('0x1'));var path=require(_0x43da('0x2'));var timeout=require('connect-timeout');var express=require(_0x43da('0x3'));var router=express['Router']();var fs_extra=require(_0x43da('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x43da('0x5'));var config=require(_0x43da('0x6'));var controller=require(_0x43da('0x7'));router[_0x43da('0x8')]('/',auth[_0x43da('0x9')](),controller[_0x43da('0xa')]);router[_0x43da('0x8')](_0x43da('0xb'),auth[_0x43da('0x9')](),controller[_0x43da('0xc')]);router[_0x43da('0x8')](_0x43da('0xd'),auth['isAuthenticated'](),controller[_0x43da('0xe')]);router[_0x43da('0xf')]('/',auth[_0x43da('0x9')](),controller['create']);router[_0x43da('0x10')](_0x43da('0xb'),auth[_0x43da('0x9')](),controller[_0x43da('0x11')]);router[_0x43da('0x12')](_0x43da('0xb'),auth['isAuthenticated'](),controller[_0x43da('0x13')]);module['exports']=router; \ No newline at end of file +var _0x040d=['get','isAuthenticated','/:id','download','create','put','update','delete','destroy','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller'];(function(_0x450eae,_0x2ad04d){var _0x2379d3=function(_0x4d7f9a){while(--_0x4d7f9a){_0x450eae['push'](_0x450eae['shift']());}};_0x2379d3(++_0x2ad04d);}(_0x040d,0xd5));var _0xd040=function(_0x1b2bd2,_0x491f68){_0x1b2bd2=_0x1b2bd2-0x0;var _0x34a271=_0x040d[_0x1b2bd2];return _0x34a271;};'use strict';var multer=require('multer');var util=require(_0xd040('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd040('0x1'));var router=express[_0xd040('0x2')]();var fs_extra=require(_0xd040('0x3'));var auth=require(_0xd040('0x4'));var interaction=require(_0xd040('0x5'));var config=require(_0xd040('0x6'));var controller=require(_0xd040('0x7'));router[_0xd040('0x8')]('/',auth[_0xd040('0x9')](),controller['index']);router[_0xd040('0x8')](_0xd040('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xd040('0x8')]('/:id/download',auth[_0xd040('0x9')](),controller[_0xd040('0xb')]);router['post']('/',auth[_0xd040('0x9')](),controller[_0xd040('0xc')]);router[_0xd040('0xd')]('/:id',auth[_0xd040('0x9')](),controller[_0xd040('0xe')]);router[_0xd040('0xf')](_0xd040('0xa'),auth[_0xd040('0x9')](),controller[_0xd040('0x10')]);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 88439df..b286619 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 _0x1dee=['BOOLEAN','sequelize','exports','STRING'];(function(_0x3f07d1,_0x90c878){var _0x19502c=function(_0x971b0d){while(--_0x971b0d){_0x3f07d1['push'](_0x3f07d1['shift']());}};_0x19502c(++_0x90c878);}(_0x1dee,0xe1));var _0xe1de=function(_0x3c5ce3,_0x18c28e){_0x3c5ce3=_0x3c5ce3-0x0;var _0x4dc6dd=_0x1dee[_0x3c5ce3];return _0x4dc6dd;};'use strict';var Sequelize=require(_0xe1de('0x0'));module[_0xe1de('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xe1de('0x2')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xe1de('0x2')]},'groupBy':{'type':Sequelize[_0xe1de('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xe1de('0x2')]},'custom':{'type':Sequelize[_0xe1de('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xc53a=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x1a3689,_0x3d233f){var _0xc59e17=function(_0x1b2293){while(--_0x1b2293){_0x1a3689['push'](_0x1a3689['shift']());}};_0xc59e17(++_0x3d233f);}(_0xc53a,0xaf));var _0xac53=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xc53a[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0xac53('0x0'));module[_0xac53('0x1')]={'field':{'type':Sequelize[_0xac53('0x2')]},'alias':{'type':Sequelize[_0xac53('0x3')]},'function':{'type':Sequelize[_0xac53('0x3')]},'format':{'type':Sequelize[_0xac53('0x3')]},'groupBy':{'type':Sequelize[_0xac53('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xac53('0x3')]},'custom':{'type':Sequelize[_0xac53('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 40663e1..a15a28f 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 _0xf7a0=['end','json','limit','count','offset','set','Content-Range','apply','then','destroy','stack','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','include','params','keys','create','body','bulkCreate','catch','update','find','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','transaction','findAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0xf7a0,0x80));var _0x0f7a=function(_0x351914,_0x1d4fe5){_0x351914=_0x351914-0x0;var _0x23707c=_0xf7a0[_0x351914];return _0x23707c;};'use strict';var emlformat=require(_0x0f7a('0x0'));var rimraf=require(_0x0f7a('0x1'));var zipdir=require(_0x0f7a('0x2'));var jsonpatch=require(_0x0f7a('0x3'));var rp=require('request-promise');var moment=require(_0x0f7a('0x4'));var BPromise=require(_0x0f7a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0f7a('0x6'));var sox=require(_0x0f7a('0x7'));var csv=require(_0x0f7a('0x8'));var ejs=require(_0x0f7a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0f7a('0xa'));var crypto=require('crypto');var jsforce=require(_0x0f7a('0xb'));var deskjs=require(_0x0f7a('0xc'));var toCsv=require(_0x0f7a('0x8'));var querystring=require(_0x0f7a('0xd'));var Papa=require(_0x0f7a('0xe'));var Redis=require('ioredis');var authService=require(_0x0f7a('0xf'));var qs=require(_0x0f7a('0x10'));var as=require(_0x0f7a('0x11'));var hardwareService=require(_0x0f7a('0x12'));var logger=require(_0x0f7a('0x13'))(_0x0f7a('0x14'));var utils=require(_0x0f7a('0x15'));var config=require(_0x0f7a('0x16'));var licenseUtil=require(_0x0f7a('0x17'));var db=require(_0x0f7a('0x18'))['db'];function respondWithStatusCode(_0xa1d94,_0x3f40b3){_0x3f40b3=_0x3f40b3||0xcc;return function(_0x5e1c1e){if(_0x5e1c1e){return _0xa1d94['sendStatus'](_0x3f40b3);}return _0xa1d94[_0x0f7a('0x19')](_0x3f40b3)[_0x0f7a('0x1a')]();};}function respondWithResult(_0xc43c4b,_0x532bf9){_0x532bf9=_0x532bf9||0xc8;return function(_0x274d0d){if(_0x274d0d){return _0xc43c4b[_0x0f7a('0x19')](_0x532bf9)[_0x0f7a('0x1b')](_0x274d0d);}};}function respondWithFilteredResult(_0xb4f8ec,_0x80bc50){return function(_0x3c4a72){if(_0x3c4a72){var _0x156532=typeof _0x80bc50['offset']==='undefined'&&typeof _0x80bc50[_0x0f7a('0x1c')]==='undefined';var _0x152714=_0x3c4a72[_0x0f7a('0x1d')];var _0x25e443=_0x156532?0x0:_0x80bc50[_0x0f7a('0x1e')];var _0x21245f=_0x156532?_0x3c4a72[_0x0f7a('0x1d')]:_0x80bc50[_0x0f7a('0x1e')]+_0x80bc50[_0x0f7a('0x1c')];var _0x272cec;if(_0x21245f>=_0x152714){_0x21245f=_0x152714;_0x272cec=0xc8;}else{_0x272cec=0xce;}_0xb4f8ec[_0x0f7a('0x19')](_0x272cec);return _0xb4f8ec[_0x0f7a('0x1f')](_0x0f7a('0x20'),_0x25e443+'-'+_0x21245f+'/'+_0x152714)[_0x0f7a('0x1b')](_0x3c4a72);}return null;};}function patchUpdates(_0x4436ce){return function(_0x12c3ae){try{jsonpatch[_0x0f7a('0x21')](_0x12c3ae,_0x4436ce,!![]);}catch(_0x1c16d9){return BPromise['reject'](_0x1c16d9);}return _0x12c3ae['save']();};}function saveUpdates(_0x25893d,_0xe300d6){return function(_0x48d487){if(_0x48d487){return _0x48d487['update'](_0x25893d)[_0x0f7a('0x22')](function(_0x4b49f2){return _0x4b49f2;});}return null;};}function removeEntity(_0x3e71d3,_0x178c66){return function(_0x39d187){if(_0x39d187){return _0x39d187[_0x0f7a('0x23')]()[_0x0f7a('0x22')](function(){_0x3e71d3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x333c50,_0x592f0a){return function(_0x247688){if(!_0x247688){_0x333c50['sendStatus'](0x194);}return _0x247688;};}function handleError(_0x4cfab0,_0x3fc0c7){_0x3fc0c7=_0x3fc0c7||0x1f4;return function(_0x152530){logger['error'](_0x152530[_0x0f7a('0x24')]);if(_0x152530[_0x0f7a('0x25')]){delete _0x152530[_0x0f7a('0x25')];}_0x4cfab0[_0x0f7a('0x19')](_0x3fc0c7)['send'](_0x152530);};}exports[_0x0f7a('0x26')]=function(_0x8f927d,_0x431a14){var _0x21e8d9={},_0x3b09cd={},_0x2bf9dc={'count':0x0,'rows':[]};var _0x5f4cdb=_[_0x0f7a('0x27')](db[_0x0f7a('0x28')][_0x0f7a('0x29')],function(_0x1461ac){return{'name':_0x1461ac[_0x0f7a('0x2a')],'type':_0x1461ac['type'][_0x0f7a('0x2b')]};});_0x3b09cd[_0x0f7a('0x2c')]=_[_0x0f7a('0x27')](_0x5f4cdb,'name');_0x3b09cd[_0x0f7a('0x2d')]=_['keys'](_0x8f927d['query']);_0x3b09cd['filters']=_[_0x0f7a('0x2e')](_0x3b09cd[_0x0f7a('0x2c')],_0x3b09cd[_0x0f7a('0x2d')]);_0x21e8d9[_0x0f7a('0x2f')]=_[_0x0f7a('0x2e')](_0x3b09cd[_0x0f7a('0x2c')],qs[_0x0f7a('0x30')](_0x8f927d[_0x0f7a('0x2d')][_0x0f7a('0x30')]));_0x21e8d9[_0x0f7a('0x2f')]=_0x21e8d9['attributes']['length']?_0x21e8d9[_0x0f7a('0x2f')]:_0x3b09cd[_0x0f7a('0x2c')];if(!_0x8f927d[_0x0f7a('0x2d')]['hasOwnProperty'](_0x0f7a('0x31'))){_0x21e8d9['limit']=qs[_0x0f7a('0x1c')](_0x8f927d[_0x0f7a('0x2d')][_0x0f7a('0x1c')]);_0x21e8d9[_0x0f7a('0x1e')]=qs[_0x0f7a('0x1e')](_0x8f927d[_0x0f7a('0x2d')][_0x0f7a('0x1e')]);}_0x21e8d9[_0x0f7a('0x32')]=qs[_0x0f7a('0x33')](_0x8f927d['query'][_0x0f7a('0x33')]);_0x21e8d9[_0x0f7a('0x34')]=qs[_0x0f7a('0x35')](_[_0x0f7a('0x36')](_0x8f927d['query'],_0x3b09cd[_0x0f7a('0x35')]),_0x5f4cdb);if(_0x8f927d['query']['filter']){_0x21e8d9[_0x0f7a('0x34')]=_[_0x0f7a('0x37')](_0x21e8d9[_0x0f7a('0x34')],{'$or':_[_0x0f7a('0x27')](_0x5f4cdb,function(_0xa2a1c){if(_0xa2a1c[_0x0f7a('0x38')]!==_0x0f7a('0x39')){var _0x367908={};_0x367908[_0xa2a1c[_0x0f7a('0x25')]]={'$like':'%'+_0x8f927d['query'][_0x0f7a('0x3a')]+'%'};return _0x367908;}})});}_0x21e8d9=_[_0x0f7a('0x37')]({},_0x21e8d9,_0x8f927d[_0x0f7a('0x3b')]);var _0x12c2dd={'where':_0x21e8d9[_0x0f7a('0x34')]};return db['AnalyticFieldReport']['count'](_0x12c2dd)['then'](function(_0x26737f){_0x2bf9dc[_0x0f7a('0x1d')]=_0x26737f;if(_0x8f927d[_0x0f7a('0x2d')][_0x0f7a('0x3c')]){_0x21e8d9[_0x0f7a('0x3d')]=[{'all':!![]}];}return db[_0x0f7a('0x28')]['findAll'](_0x21e8d9);})[_0x0f7a('0x22')](function(_0xe9786f){_0x2bf9dc['rows']=_0xe9786f;return _0x2bf9dc;})[_0x0f7a('0x22')](respondWithFilteredResult(_0x431a14,_0x21e8d9))['catch'](handleError(_0x431a14,null));};exports['show']=function(_0x16831c,_0x240e04){var _0x4bb95f={'raw':![],'where':{'id':_0x16831c[_0x0f7a('0x3e')]['id']}},_0x3c4be={};_0x3c4be[_0x0f7a('0x2c')]=_[_0x0f7a('0x3f')](db['AnalyticFieldReport'][_0x0f7a('0x29')]);_0x3c4be[_0x0f7a('0x2d')]=_[_0x0f7a('0x3f')](_0x16831c[_0x0f7a('0x2d')]);_0x3c4be['filters']=_[_0x0f7a('0x2e')](_0x3c4be[_0x0f7a('0x2c')],_0x3c4be['query']);_0x4bb95f[_0x0f7a('0x2f')]=_[_0x0f7a('0x2e')](_0x3c4be[_0x0f7a('0x2c')],qs[_0x0f7a('0x30')](_0x16831c[_0x0f7a('0x2d')][_0x0f7a('0x30')]));_0x4bb95f['attributes']=_0x4bb95f[_0x0f7a('0x2f')]['length']?_0x4bb95f[_0x0f7a('0x2f')]:_0x3c4be['model'];if(_0x16831c['query']['includeAll']){_0x4bb95f['include']=[{'all':!![]}];}_0x4bb95f=_[_0x0f7a('0x37')]({},_0x4bb95f,_0x16831c[_0x0f7a('0x3b')]);return db[_0x0f7a('0x28')]['find'](_0x4bb95f)[_0x0f7a('0x22')](handleEntityNotFound(_0x240e04,null))[_0x0f7a('0x22')](respondWithResult(_0x240e04,null))['catch'](handleError(_0x240e04,null));};exports[_0x0f7a('0x40')]=function(_0x935d13,_0x47311b){return db[_0x0f7a('0x28')][_0x0f7a('0x40')](_0x935d13[_0x0f7a('0x41')],{})['then'](respondWithResult(_0x47311b,0xc9))['catch'](handleError(_0x47311b,null));};exports[_0x0f7a('0x42')]=function(_0x210c3a,_0x32fb22){return db[_0x0f7a('0x28')][_0x0f7a('0x42')](_0x210c3a[_0x0f7a('0x41')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x32fb22,0xc9))[_0x0f7a('0x43')](handleError(_0x32fb22,null));};exports[_0x0f7a('0x44')]=function(_0x2a0fdd,_0x73650e){if(_0x2a0fdd[_0x0f7a('0x41')]['id']){delete _0x2a0fdd[_0x0f7a('0x41')]['id'];}return db[_0x0f7a('0x28')][_0x0f7a('0x45')]({'where':{'id':_0x2a0fdd['params']['id']}})[_0x0f7a('0x22')](handleEntityNotFound(_0x73650e,null))[_0x0f7a('0x22')](saveUpdates(_0x2a0fdd[_0x0f7a('0x41')],null))[_0x0f7a('0x22')](respondWithResult(_0x73650e,null))[_0x0f7a('0x43')](handleError(_0x73650e,null));};exports[_0x0f7a('0x23')]=function(_0x6553f,_0x408b56){return db['AnalyticFieldReport'][_0x0f7a('0x45')]({'where':{'id':_0x6553f['params']['id']}})[_0x0f7a('0x22')](handleEntityNotFound(_0x408b56,null))[_0x0f7a('0x22')](removeEntity(_0x408b56,null))['catch'](handleError(_0x408b56,null));};exports[_0x0f7a('0x46')]=function(_0x1e1490,_0x3024b0){return db['AnalyticFieldReport'][_0x0f7a('0x23')]({'where':{'id':_0x1e1490[_0x0f7a('0x2d')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x0f7a('0x22')](respondWithResult(_0x3024b0,0xcc))[_0x0f7a('0x43')](handleError(_0x3024b0,null));};exports[_0x0f7a('0x47')]=function(_0x4ed131,_0x5a88bd,_0x2cb69e){return db[_0x0f7a('0x48')][_0x0f7a('0x49')]({'where':{'id':_0x4ed131[_0x0f7a('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5a88bd,null))[_0x0f7a('0x22')](function(_0x1c516e){if(_0x1c516e){return db[_0x0f7a('0x4a')][_0x0f7a('0x4b')](function(_0x3ef56a){return db[_0x0f7a('0x28')][_0x0f7a('0x23')]({'where':{'CustomReportId':_0x4ed131[_0x0f7a('0x3e')]['id']},'transaction':_0x3ef56a})[_0x0f7a('0x22')](function(_0x30a93a){var _0x2286fb=_['map'](_0x4ed131[_0x0f7a('0x41')],function(_0x15fabe){delete _0x15fabe['id'];_0x15fabe['CustomReportId']=_0x4ed131['params']['id'];return _0x15fabe;});return db['AnalyticFieldReport'][_0x0f7a('0x42')](_0x2286fb,{'transaction':_0x3ef56a});});})[_0x0f7a('0x22')](function(){return db[_0x0f7a('0x28')][_0x0f7a('0x4c')]({'where':{'CustomReportId':_0x4ed131[_0x0f7a('0x3e')]['id']}});});}})[_0x0f7a('0x22')](respondWithResult(_0x5a88bd,null))[_0x0f7a('0x43')](handleError(_0x5a88bd,null));}; \ No newline at end of file +var _0xe65a=['attributes','length','hasOwnProperty','limit','order','sort','filter','where','merge','VIRTUAL','options','include','params','fields','includeAll','find','catch','body','bulkCreate','addFields','AnalyticCustomReport','findOne','sequelize','findAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','AnalyticFieldReport','rawAttributes','fieldName','type','model','map','name','query','keys','filters','intersection'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xe65a,0x148));var _0xae65=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xe65a[_0x5cb1af];return _0x8d7940;};'use strict';var emlformat=require(_0xae65('0x0'));var rimraf=require(_0xae65('0x1'));var zipdir=require(_0xae65('0x2'));var jsonpatch=require(_0xae65('0x3'));var rp=require('request-promise');var moment=require(_0xae65('0x4'));var BPromise=require(_0xae65('0x5'));var Mustache=require(_0xae65('0x6'));var util=require(_0xae65('0x7'));var path=require(_0xae65('0x8'));var sox=require(_0xae65('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xae65('0xa'));var _=require('lodash');var squel=require(_0xae65('0xb'));var crypto=require(_0xae65('0xc'));var jsforce=require(_0xae65('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xae65('0xe'));var querystring=require(_0xae65('0xf'));var Papa=require('papaparse');var Redis=require(_0xae65('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xae65('0x11'));var as=require(_0xae65('0x12'));var hardwareService=require(_0xae65('0x13'));var logger=require(_0xae65('0x14'))('api');var utils=require(_0xae65('0x15'));var config=require(_0xae65('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38f7f7,_0x220468){_0x220468=_0x220468||0xcc;return function(_0x395ca0){if(_0x395ca0){return _0x38f7f7[_0xae65('0x17')](_0x220468);}return _0x38f7f7[_0xae65('0x18')](_0x220468)[_0xae65('0x19')]();};}function respondWithResult(_0x4b64fd,_0xe9a53d){_0xe9a53d=_0xe9a53d||0xc8;return function(_0x2c58d5){if(_0x2c58d5){return _0x4b64fd[_0xae65('0x18')](_0xe9a53d)[_0xae65('0x1a')](_0x2c58d5);}};}function respondWithFilteredResult(_0x39cde1,_0x4e0040){return function(_0x2308b3){if(_0x2308b3){var _0x3a5b0d=typeof _0x4e0040[_0xae65('0x1b')]===_0xae65('0x1c')&&typeof _0x4e0040['limit']==='undefined';var _0x4f992e=_0x2308b3[_0xae65('0x1d')];var _0x249f60=_0x3a5b0d?0x0:_0x4e0040[_0xae65('0x1b')];var _0x4a26ec=_0x3a5b0d?_0x2308b3[_0xae65('0x1d')]:_0x4e0040['offset']+_0x4e0040['limit'];var _0x5e6e4d;if(_0x4a26ec>=_0x4f992e){_0x4a26ec=_0x4f992e;_0x5e6e4d=0xc8;}else{_0x5e6e4d=0xce;}_0x39cde1['status'](_0x5e6e4d);return _0x39cde1['set'](_0xae65('0x1e'),_0x249f60+'-'+_0x4a26ec+'/'+_0x4f992e)[_0xae65('0x1a')](_0x2308b3);}return null;};}function patchUpdates(_0x317791){return function(_0x19ceb8){try{jsonpatch[_0xae65('0x1f')](_0x19ceb8,_0x317791,!![]);}catch(_0x44c252){return BPromise[_0xae65('0x20')](_0x44c252);}return _0x19ceb8[_0xae65('0x21')]();};}function saveUpdates(_0x4ea83b,_0x143891){return function(_0x16cf17){if(_0x16cf17){return _0x16cf17[_0xae65('0x22')](_0x4ea83b)[_0xae65('0x23')](function(_0x2fb670){return _0x2fb670;});}return null;};}function removeEntity(_0x15deea,_0x1c1840){return function(_0x203d76){if(_0x203d76){return _0x203d76[_0xae65('0x24')]()['then'](function(){_0x15deea[_0xae65('0x18')](0xcc)[_0xae65('0x19')]();});}};}function handleEntityNotFound(_0x34c667,_0x33574a){return function(_0x5c0720){if(!_0x5c0720){_0x34c667[_0xae65('0x17')](0x194);}return _0x5c0720;};}function handleError(_0x1f8f39,_0x2aad67){_0x2aad67=_0x2aad67||0x1f4;return function(_0x97a75b){logger[_0xae65('0x25')](_0x97a75b[_0xae65('0x26')]);if(_0x97a75b['name']){delete _0x97a75b['name'];}_0x1f8f39[_0xae65('0x18')](_0x2aad67)[_0xae65('0x27')](_0x97a75b);};}exports[_0xae65('0x28')]=function(_0x3b6106,_0x15e904){var _0x2a6dcb={},_0x2af31e={},_0x38f57b={'count':0x0,'rows':[]};var _0x13ea04=_['map'](db[_0xae65('0x29')][_0xae65('0x2a')],function(_0x21601e){return{'name':_0x21601e[_0xae65('0x2b')],'type':_0x21601e[_0xae65('0x2c')]['key']};});_0x2af31e[_0xae65('0x2d')]=_[_0xae65('0x2e')](_0x13ea04,_0xae65('0x2f'));_0x2af31e[_0xae65('0x30')]=_[_0xae65('0x31')](_0x3b6106[_0xae65('0x30')]);_0x2af31e[_0xae65('0x32')]=_[_0xae65('0x33')](_0x2af31e[_0xae65('0x2d')],_0x2af31e[_0xae65('0x30')]);_0x2a6dcb['attributes']=_['intersection'](_0x2af31e[_0xae65('0x2d')],qs['fields'](_0x3b6106['query']['fields']));_0x2a6dcb[_0xae65('0x34')]=_0x2a6dcb[_0xae65('0x34')][_0xae65('0x35')]?_0x2a6dcb[_0xae65('0x34')]:_0x2af31e[_0xae65('0x2d')];if(!_0x3b6106[_0xae65('0x30')][_0xae65('0x36')]('nolimit')){_0x2a6dcb[_0xae65('0x37')]=qs[_0xae65('0x37')](_0x3b6106[_0xae65('0x30')][_0xae65('0x37')]);_0x2a6dcb[_0xae65('0x1b')]=qs['offset'](_0x3b6106['query'][_0xae65('0x1b')]);}_0x2a6dcb[_0xae65('0x38')]=qs['sort'](_0x3b6106[_0xae65('0x30')][_0xae65('0x39')]);_0x2a6dcb['where']=qs[_0xae65('0x32')](_['pick'](_0x3b6106[_0xae65('0x30')],_0x2af31e[_0xae65('0x32')]),_0x13ea04);if(_0x3b6106[_0xae65('0x30')][_0xae65('0x3a')]){_0x2a6dcb[_0xae65('0x3b')]=_[_0xae65('0x3c')](_0x2a6dcb[_0xae65('0x3b')],{'$or':_[_0xae65('0x2e')](_0x13ea04,function(_0x397f36){if(_0x397f36['type']!==_0xae65('0x3d')){var _0x26c648={};_0x26c648[_0x397f36[_0xae65('0x2f')]]={'$like':'%'+_0x3b6106['query'][_0xae65('0x3a')]+'%'};return _0x26c648;}})});}_0x2a6dcb=_[_0xae65('0x3c')]({},_0x2a6dcb,_0x3b6106[_0xae65('0x3e')]);var _0x4b297c={'where':_0x2a6dcb[_0xae65('0x3b')]};return db[_0xae65('0x29')]['count'](_0x4b297c)[_0xae65('0x23')](function(_0x4c5bcb){_0x38f57b[_0xae65('0x1d')]=_0x4c5bcb;if(_0x3b6106[_0xae65('0x30')]['includeAll']){_0x2a6dcb[_0xae65('0x3f')]=[{'all':!![]}];}return db[_0xae65('0x29')]['findAll'](_0x2a6dcb);})[_0xae65('0x23')](function(_0x38b9bb){_0x38f57b['rows']=_0x38b9bb;return _0x38f57b;})[_0xae65('0x23')](respondWithFilteredResult(_0x15e904,_0x2a6dcb))['catch'](handleError(_0x15e904,null));};exports['show']=function(_0x37b92b,_0x198e07){var _0x4b7f4c={'raw':![],'where':{'id':_0x37b92b[_0xae65('0x40')]['id']}},_0x4f5be1={};_0x4f5be1[_0xae65('0x2d')]=_[_0xae65('0x31')](db[_0xae65('0x29')]['rawAttributes']);_0x4f5be1['query']=_[_0xae65('0x31')](_0x37b92b[_0xae65('0x30')]);_0x4f5be1['filters']=_[_0xae65('0x33')](_0x4f5be1[_0xae65('0x2d')],_0x4f5be1['query']);_0x4b7f4c[_0xae65('0x34')]=_[_0xae65('0x33')](_0x4f5be1['model'],qs[_0xae65('0x41')](_0x37b92b[_0xae65('0x30')][_0xae65('0x41')]));_0x4b7f4c[_0xae65('0x34')]=_0x4b7f4c[_0xae65('0x34')]['length']?_0x4b7f4c['attributes']:_0x4f5be1['model'];if(_0x37b92b['query'][_0xae65('0x42')]){_0x4b7f4c[_0xae65('0x3f')]=[{'all':!![]}];}_0x4b7f4c=_[_0xae65('0x3c')]({},_0x4b7f4c,_0x37b92b[_0xae65('0x3e')]);return db[_0xae65('0x29')][_0xae65('0x43')](_0x4b7f4c)['then'](handleEntityNotFound(_0x198e07,null))['then'](respondWithResult(_0x198e07,null))[_0xae65('0x44')](handleError(_0x198e07,null));};exports['create']=function(_0x221b46,_0x49179d){return db['AnalyticFieldReport']['create'](_0x221b46[_0xae65('0x45')],{})['then'](respondWithResult(_0x49179d,0xc9))['catch'](handleError(_0x49179d,null));};exports[_0xae65('0x46')]=function(_0x40660d,_0x32de81){return db['AnalyticFieldReport'][_0xae65('0x46')](_0x40660d[_0xae65('0x45')],{'raw':![],'individualHooks':!![]})[_0xae65('0x23')](respondWithResult(_0x32de81,0xc9))[_0xae65('0x44')](handleError(_0x32de81,null));};exports[_0xae65('0x22')]=function(_0x11f5d1,_0x3c87c8){if(_0x11f5d1['body']['id']){delete _0x11f5d1['body']['id'];}return db[_0xae65('0x29')][_0xae65('0x43')]({'where':{'id':_0x11f5d1[_0xae65('0x40')]['id']}})[_0xae65('0x23')](handleEntityNotFound(_0x3c87c8,null))['then'](saveUpdates(_0x11f5d1[_0xae65('0x45')],null))['then'](respondWithResult(_0x3c87c8,null))[_0xae65('0x44')](handleError(_0x3c87c8,null));};exports[_0xae65('0x24')]=function(_0x5e88d6,_0x10beca){return db['AnalyticFieldReport'][_0xae65('0x43')]({'where':{'id':_0x5e88d6[_0xae65('0x40')]['id']}})[_0xae65('0x23')](handleEntityNotFound(_0x10beca,null))[_0xae65('0x23')](removeEntity(_0x10beca,null))['catch'](handleError(_0x10beca,null));};exports['bulkDestroy']=function(_0x5a2346,_0x182e58){return db[_0xae65('0x29')]['destroy']({'where':{'id':_0x5a2346['query']['ids']||[]},'raw':![],'individualHooks':!![]})[_0xae65('0x23')](respondWithResult(_0x182e58,0xcc))[_0xae65('0x44')](handleError(_0x182e58,null));};exports[_0xae65('0x47')]=function(_0x1c1206,_0x3bd0c9,_0xb43654){return db[_0xae65('0x48')][_0xae65('0x49')]({'where':{'id':_0x1c1206[_0xae65('0x40')]['id']}})['then'](handleEntityNotFound(_0x3bd0c9,null))[_0xae65('0x23')](function(_0x1650f0){if(_0x1650f0){return db[_0xae65('0x4a')]['transaction'](function(_0x34c1dd){return db['AnalyticFieldReport'][_0xae65('0x24')]({'where':{'CustomReportId':_0x1c1206[_0xae65('0x40')]['id']},'transaction':_0x34c1dd})[_0xae65('0x23')](function(_0x1cccde){var _0xe72154=_[_0xae65('0x2e')](_0x1c1206['body'],function(_0x2f0390){delete _0x2f0390['id'];_0x2f0390['CustomReportId']=_0x1c1206['params']['id'];return _0x2f0390;});return db[_0xae65('0x29')][_0xae65('0x46')](_0xe72154,{'transaction':_0x34c1dd});});})[_0xae65('0x23')](function(){return db[_0xae65('0x29')][_0xae65('0x4b')]({'where':{'CustomReportId':_0x1c1206[_0xae65('0x40')]['id']}});});}})[_0xae65('0x23')](respondWithResult(_0x3bd0c9,null))[_0xae65('0x44')](handleError(_0x3bd0c9,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index b62600f..bc8a4b3 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 _0x6fce=['path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2f2360,_0x151089){var _0x1cc8d3=function(_0x5e356f){while(--_0x5e356f){_0x2f2360['push'](_0x2f2360['shift']());}};_0x1cc8d3(++_0x151089);}(_0x6fce,0x1ac));var _0xe6fc=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x6fce[_0x11005e];return _0x29338f;};'use strict';var _=require(_0xe6fc('0x0'));var util=require(_0xe6fc('0x1'));var logger=require(_0xe6fc('0x2'))(_0xe6fc('0x3'));var moment=require('moment');var BPromise=require(_0xe6fc('0x4'));var rp=require(_0xe6fc('0x5'));var fs=require('fs');var path=require(_0xe6fc('0x6'));var rimraf=require(_0xe6fc('0x7'));var config=require(_0xe6fc('0x8'));var attributes=require(_0xe6fc('0x9'));module[_0xe6fc('0xa')]=function(_0x1c4783,_0x10a668){return _0x1c4783[_0xe6fc('0xb')](_0xe6fc('0xc'),attributes,{'tableName':_0xe6fc('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5312=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','util','../../config/logger'];(function(_0xd98d94,_0x520f4a){var _0x1c4142=function(_0x58fa82){while(--_0x58fa82){_0xd98d94['push'](_0xd98d94['shift']());}};_0x1c4142(++_0x520f4a);}(_0x5312,0x186));var _0x2531=function(_0x32ae44,_0x52fe4d){_0x32ae44=_0x32ae44-0x0;var _0x5bac3f=_0x5312[_0x32ae44];return _0x5bac3f;};'use strict';var _=require('lodash');var util=require(_0x2531('0x0'));var logger=require(_0x2531('0x1'))(_0x2531('0x2'));var moment=require(_0x2531('0x3'));var BPromise=require(_0x2531('0x4'));var rp=require(_0x2531('0x5'));var fs=require('fs');var path=require(_0x2531('0x6'));var rimraf=require(_0x2531('0x7'));var config=require(_0x2531('0x8'));var attributes=require(_0x2531('0x9'));module[_0x2531('0xa')]=function(_0x324487,_0x53bb34){return _0x324487[_0x2531('0xb')](_0x2531('0xc'),attributes,{'tableName':_0x2531('0xd'),'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 363b44c..a8977da 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 _0xd6ec=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x23add2,_0x59a127){var _0x2fdc91=function(_0x28671c){while(--_0x28671c){_0x23add2['push'](_0x23add2['shift']());}};_0x2fdc91(++_0x59a127);}(_0xd6ec,0x1df));var _0xcd6e=function(_0x5b60e3,_0x181ac2){_0x5b60e3=_0x5b60e3-0x0;var _0x2ea378=_0xd6ec[_0x5b60e3];return _0x2ea378;};'use strict';var _=require(_0xcd6e('0x0'));var util=require(_0xcd6e('0x1'));var moment=require(_0xcd6e('0x2'));var BPromise=require(_0xcd6e('0x3'));var rs=require(_0xcd6e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd6e('0x5'))['db'];var utils=require(_0xcd6e('0x6'));var logger=require(_0xcd6e('0x7'))(_0xcd6e('0x8'));var config=require(_0xcd6e('0x9'));var jayson=require(_0xcd6e('0xa'));var client=jayson[_0xcd6e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x573daf,_0x7ca5cb,_0x4caf10){return new BPromise(function(_0x211b81,_0x4d1ca9){return client[_0xcd6e('0xc')](_0x573daf,_0x4caf10)[_0xcd6e('0xd')](function(_0x186ebb){logger[_0xcd6e('0xe')](_0xcd6e('0xf'),_0x7ca5cb,_0xcd6e('0x10'));logger[_0xcd6e('0x11')](_0xcd6e('0x12'),_0x7ca5cb,_0xcd6e('0x10'),JSON['stringify'](_0x186ebb));if(_0x186ebb[_0xcd6e('0x13')]){if(_0x186ebb[_0xcd6e('0x13')]['code']===0x1f4){logger['error'](_0xcd6e('0xf'),_0x7ca5cb,_0x186ebb[_0xcd6e('0x13')][_0xcd6e('0x14')]);return _0x4d1ca9(_0x186ebb[_0xcd6e('0x13')][_0xcd6e('0x14')]);}logger[_0xcd6e('0x13')](_0xcd6e('0xf'),_0x7ca5cb,_0x186ebb[_0xcd6e('0x13')][_0xcd6e('0x14')]);return _0x211b81(_0x186ebb['error'][_0xcd6e('0x14')]);}else{logger[_0xcd6e('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x7ca5cb,'request\x20sent');_0x211b81(_0x186ebb[_0xcd6e('0x15')][_0xcd6e('0x14')]);}})[_0xcd6e('0x16')](function(_0x3ed544){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x7ca5cb,_0x3ed544);_0x4d1ca9(_0x3ed544);});});} \ No newline at end of file +var _0x2f76=['http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5cabfd,_0x5dea47){var _0x4bc06c=function(_0x4a2fea){while(--_0x4a2fea){_0x5cabfd['push'](_0x5cabfd['shift']());}};_0x4bc06c(++_0x5dea47);}(_0x2f76,0x1f1));var _0x62f7=function(_0x2d9c96,_0x5b12f0){_0x2d9c96=_0x2d9c96-0x0;var _0x44bf16=_0x2f76[_0x2d9c96];return _0x44bf16;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x62f7('0x0'));var rs=require(_0x62f7('0x1'));var fs=require('fs');var Redis=require(_0x62f7('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x62f7('0x3'));var logger=require(_0x62f7('0x4'))(_0x62f7('0x5'));var config=require(_0x62f7('0x6'));var jayson=require(_0x62f7('0x7'));var client=jayson[_0x62f7('0x8')][_0x62f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a09e3,_0x4adccc,_0x3cf3c1){return new BPromise(function(_0xf25145,_0x5b382d){return client[_0x62f7('0xa')](_0x1a09e3,_0x3cf3c1)[_0x62f7('0xb')](function(_0x4b830f){logger[_0x62f7('0xc')](_0x62f7('0xd'),_0x4adccc,'request\x20sent');logger[_0x62f7('0xe')](_0x62f7('0xf'),_0x4adccc,_0x62f7('0x10'),JSON[_0x62f7('0x11')](_0x4b830f));if(_0x4b830f[_0x62f7('0x12')]){if(_0x4b830f['error'][_0x62f7('0x13')]===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x4adccc,_0x4b830f['error']['message']);return _0x5b382d(_0x4b830f['error'][_0x62f7('0x14')]);}logger[_0x62f7('0x12')](_0x62f7('0xd'),_0x4adccc,_0x4b830f['error'][_0x62f7('0x14')]);return _0xf25145(_0x4b830f['error']['message']);}else{logger[_0x62f7('0xc')](_0x62f7('0xd'),_0x4adccc,_0x62f7('0x10'));_0xf25145(_0x4b830f[_0x62f7('0x15')][_0x62f7('0x14')]);}})[_0x62f7('0x16')](function(_0x4cd60d){logger[_0x62f7('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4adccc,_0x4cd60d);_0x5b382d(_0x4cd60d);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index fa96f2a..5155407 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(_0x4690d2,_0x32bf1e){var _0x4a19fe=function(_0x7ee1a){while(--_0x7ee1a){_0x4690d2['push'](_0x4690d2['shift']());}};_0x4a19fe(++_0x32bf1e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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(_0x1d3215,_0x55184b){var _0x591f69=function(_0x41a9cb){while(--_0x41a9cb){_0x1d3215['push'](_0x1d3215['shift']());}};_0x591f69(++_0x55184b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 8a49f9e..ac6bf7d 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 _0x049e=['TEXT','STRING','sequelize','exports','name'];(function(_0xb953a,_0x3d230e){var _0x27ea69=function(_0x4c9b9e){while(--_0x4c9b9e){_0xb953a['push'](_0xb953a['shift']());}};_0x27ea69(++_0x3d230e);}(_0x049e,0x16a));var _0xe049=function(_0x1857d0,_0x6eade0){_0x1857d0=_0x1857d0-0x0;var _0x3e3c46=_0x049e[_0x1857d0];return _0x3e3c46;};'use strict';var Sequelize=require(_0xe049('0x0'));module[_0xe049('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe049('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xe049('0x3')]},'description':{'type':Sequelize[_0xe049('0x4')]}}; \ No newline at end of file +var _0x705f=['TEXT','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x705f,0x75));var _0xf705=function(_0x3720d1,_0x968d8b){_0x3720d1=_0x3720d1-0x0;var _0x14a1e8=_0x705f[_0x3720d1];return _0x14a1e8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf705('0x0')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xf705('0x0')]},'metric':{'type':Sequelize[_0xf705('0x1')]},'description':{'type':Sequelize[_0xf705('0x0')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index f85619f..d53a416 100644 --- a/server/api/analyticMetric/analyticMetric.controller.js +++ b/server/api/analyticMetric/analyticMetric.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','Metrics','UserProfileResource','end','error','name','map','type','key','model','keys','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','AnalyticMetric','include','findAll','rawAttributes','intersection','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x507403,_0x3f954d){var _0x1327c=function(_0x2aea1b){while(--_0x2aea1b){_0x507403['push'](_0x507403['shift']());}};_0x1327c(++_0x3f954d);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){var _0x472195=_0x563799['get']({'plain':!![]});var _0x39df42=_0x7995('0x28');return db[_0x7995('0x29')][_0x7995('0x27')]({'where':{'type':_0x39df42,'resourceId':_0x472195['id']}})[_0x7995('0x26')](function(){return _0x563799;});})[_0x7995('0x26')](function(){_0x204507['status'](0xcc)[_0x7995('0x2a')]();});}};}function handleEntityNotFound(_0x5911c3,_0x229742){return function(_0x49bc7e){if(!_0x49bc7e){_0x5911c3[_0x7995('0x1b')](0x194);}return _0x49bc7e;};}function handleError(_0x132a42,_0x11c1eb){_0x11c1eb=_0x11c1eb||0x1f4;return function(_0x4b6f99){logger[_0x7995('0x2b')](_0x4b6f99['stack']);if(_0x4b6f99[_0x7995('0x2c')]){delete _0x4b6f99[_0x7995('0x2c')];}_0x132a42[_0x7995('0x1c')](_0x11c1eb)['send'](_0x4b6f99);};}exports['index']=function(_0x48e573,_0x3573be){var _0xe6b0b3={},_0x327a81={},_0x2b874d={'count':0x0,'rows':[]};var _0x2e3493=_[_0x7995('0x2d')](db['AnalyticMetric']['rawAttributes'],function(_0xfa8f15){return{'name':_0xfa8f15['fieldName'],'type':_0xfa8f15[_0x7995('0x2e')][_0x7995('0x2f')]};});_0x327a81[_0x7995('0x30')]=_[_0x7995('0x2d')](_0x2e3493,_0x7995('0x2c'));_0x327a81['query']=_[_0x7995('0x31')](_0x48e573[_0x7995('0x32')]);_0x327a81['filters']=_['intersection'](_0x327a81['model'],_0x327a81[_0x7995('0x32')]);_0xe6b0b3[_0x7995('0x33')]=_['intersection'](_0x327a81[_0x7995('0x30')],qs['fields'](_0x48e573[_0x7995('0x32')][_0x7995('0x34')]));_0xe6b0b3[_0x7995('0x33')]=_0xe6b0b3['attributes']['length']?_0xe6b0b3[_0x7995('0x33')]:_0x327a81['model'];if(!_0x48e573['query'][_0x7995('0x35')](_0x7995('0x36'))){_0xe6b0b3['limit']=qs[_0x7995('0x21')](_0x48e573[_0x7995('0x32')][_0x7995('0x21')]);_0xe6b0b3[_0x7995('0x20')]=qs[_0x7995('0x20')](_0x48e573['query'][_0x7995('0x20')]);}_0xe6b0b3[_0x7995('0x37')]=qs[_0x7995('0x38')](_0x48e573[_0x7995('0x32')]['sort']);_0xe6b0b3[_0x7995('0x39')]=qs[_0x7995('0x3a')](_[_0x7995('0x3b')](_0x48e573[_0x7995('0x32')],_0x327a81[_0x7995('0x3a')]),_0x2e3493);if(_0x48e573[_0x7995('0x32')]['filter']){_0xe6b0b3[_0x7995('0x39')]=_[_0x7995('0x3c')](_0xe6b0b3[_0x7995('0x39')],{'$or':_[_0x7995('0x2d')](_0x2e3493,function(_0x2e04cd){if(_0x2e04cd[_0x7995('0x2e')]!==_0x7995('0x3d')){var _0x270c0e={};_0x270c0e[_0x2e04cd[_0x7995('0x2c')]]={'$like':'%'+_0x48e573[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x270c0e;}})});}_0xe6b0b3=_[_0x7995('0x3c')]({},_0xe6b0b3,_0x48e573[_0x7995('0x3f')]);var _0x53cda2={'where':_0xe6b0b3['where']};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x53cda2)['then'](function(_0x4b0855){_0x2b874d[_0x7995('0x1f')]=_0x4b0855;if(_0x48e573['query']['includeAll']){_0xe6b0b3[_0x7995('0x41')]=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x42')](_0xe6b0b3);})['then'](function(_0x46ac4f){_0x2b874d['rows']=_0x46ac4f;return _0x2b874d;})[_0x7995('0x26')](respondWithFilteredResult(_0x3573be,_0xe6b0b3))['catch'](handleError(_0x3573be,null));};exports['show']=function(_0x39c5b8,_0x403f54){var _0xc04e5={'raw':!![],'where':{'id':_0x39c5b8['params']['id']}},_0x3f1c35={};_0x3f1c35[_0x7995('0x30')]=_[_0x7995('0x31')](db[_0x7995('0x40')][_0x7995('0x43')]);_0x3f1c35['query']=_['keys'](_0x39c5b8[_0x7995('0x32')]);_0x3f1c35['filters']=_[_0x7995('0x44')](_0x3f1c35['model'],_0x3f1c35[_0x7995('0x32')]);_0xc04e5['attributes']=_[_0x7995('0x44')](_0x3f1c35[_0x7995('0x30')],qs['fields'](_0x39c5b8[_0x7995('0x32')][_0x7995('0x34')]));_0xc04e5[_0x7995('0x33')]=_0xc04e5[_0x7995('0x33')]['length']?_0xc04e5[_0x7995('0x33')]:_0x3f1c35[_0x7995('0x30')];if(_0x39c5b8[_0x7995('0x32')]['includeAll']){_0xc04e5[_0x7995('0x41')]=[{'all':!![]}];}_0xc04e5=_[_0x7995('0x3c')]({},_0xc04e5,_0x39c5b8[_0x7995('0x3f')]);return db[_0x7995('0x40')][_0x7995('0x45')](_0xc04e5)['then'](handleEntityNotFound(_0x403f54,null))[_0x7995('0x26')](respondWithResult(_0x403f54,null))[_0x7995('0x46')](handleError(_0x403f54,null));};exports['create']=function(_0x3d1dbb,_0x5843ba){return db[_0x7995('0x40')][_0x7995('0x47')](_0x3d1dbb[_0x7995('0x48')],{})[_0x7995('0x26')](function(_0xddf537){var _0x14b537=_0x3d1dbb[_0x7995('0x49')]['get']({'plain':!![]});if(!_0x14b537)throw new Error(_0x7995('0x4a'));if(_0x14b537[_0x7995('0x4b')]===_0x7995('0x49')){var _0x4ffc8a=_0xddf537[_0x7995('0x4c')]({'plain':!![]});var _0x1fe77e=_0x7995('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x1fe77e,'userProfileId':_0x14b537['userProfileId']},'raw':!![]})[_0x7995('0x26')](function(_0x1fd1ca){if(_0x1fd1ca&&_0x1fd1ca['autoAssociation']===0x0){return db[_0x7995('0x29')][_0x7995('0x47')]({'name':_0x4ffc8a[_0x7995('0x2c')],'resourceId':_0x4ffc8a['id'],'type':_0x1fd1ca[_0x7995('0x2c')],'sectionId':_0x1fd1ca['id']},{})[_0x7995('0x26')](function(){return _0xddf537;});}else{return _0xddf537;}})['catch'](function(_0x29ee32){logger['error'](_0x7995('0x4d'),_0x29ee32);throw _0x29ee32;});}return _0xddf537;})[_0x7995('0x26')](respondWithResult(_0x5843ba,0xc9))[_0x7995('0x46')](handleError(_0x5843ba,null));};exports['update']=function(_0x5e1f34,_0x54e2b1){if(_0x5e1f34['body']['id']){delete _0x5e1f34[_0x7995('0x48')]['id'];}return db[_0x7995('0x40')][_0x7995('0x45')]({'where':{'id':_0x5e1f34[_0x7995('0x4e')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x54e2b1,null))[_0x7995('0x26')](saveUpdates(_0x5e1f34[_0x7995('0x48')],null))[_0x7995('0x26')](respondWithResult(_0x54e2b1,null))[_0x7995('0x46')](handleError(_0x54e2b1,null));};exports[_0x7995('0x27')]=function(_0xa7af8c,_0x133c63){return db[_0x7995('0x40')][_0x7995('0x45')]({'where':{'id':_0xa7af8c[_0x7995('0x4e')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x133c63,null))[_0x7995('0x26')](removeEntity(_0x133c63,null))[_0x7995('0x46')](handleError(_0x133c63,null));}; \ No newline at end of file +var _0x8d0e=['then','get','Metrics','UserProfileResource','end','sendStatus','error','stack','name','send','AnalyticMetric','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','fields','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','set','apply','reject','save','update','destroy'];(function(_0x207301,_0x235203){var _0x10be14=function(_0x203ac4){while(--_0x203ac4){_0x207301['push'](_0x207301['shift']());}};_0x10be14(++_0x235203);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x35c2e7,_0x4071cc){_0x35c2e7=_0x35c2e7-0x0;var _0x211088=_0x8d0e[_0x35c2e7];return _0x211088;};'use strict';var emlformat=require(_0xe8d0('0x0'));var rimraf=require(_0xe8d0('0x1'));var zipdir=require(_0xe8d0('0x2'));var jsonpatch=require(_0xe8d0('0x3'));var rp=require(_0xe8d0('0x4'));var moment=require(_0xe8d0('0x5'));var BPromise=require(_0xe8d0('0x6'));var Mustache=require(_0xe8d0('0x7'));var util=require(_0xe8d0('0x8'));var path=require('path');var sox=require(_0xe8d0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8d0('0xa'));var _=require(_0xe8d0('0xb'));var squel=require(_0xe8d0('0xc'));var crypto=require(_0xe8d0('0xd'));var jsforce=require(_0xe8d0('0xe'));var deskjs=require(_0xe8d0('0xf'));var toCsv=require(_0xe8d0('0x10'));var querystring=require(_0xe8d0('0x11'));var Papa=require('papaparse');var Redis=require(_0xe8d0('0x12'));var authService=require(_0xe8d0('0x13'));var qs=require(_0xe8d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8d0('0x15'))(_0xe8d0('0x16'));var utils=require(_0xe8d0('0x17'));var config=require(_0xe8d0('0x18'));var licenseUtil=require(_0xe8d0('0x19'));var db=require(_0xe8d0('0x1a'))['db'];function respondWithStatusCode(_0x5934b2,_0x38fac0){_0x38fac0=_0x38fac0||0xcc;return function(_0x15b9e5){if(_0x15b9e5){return _0x5934b2['sendStatus'](_0x38fac0);}return _0x5934b2[_0xe8d0('0x1b')](_0x38fac0)['end']();};}function respondWithResult(_0x59b4b7,_0x90a1ea){_0x90a1ea=_0x90a1ea||0xc8;return function(_0x2aa906){if(_0x2aa906){return _0x59b4b7[_0xe8d0('0x1b')](_0x90a1ea)[_0xe8d0('0x1c')](_0x2aa906);}};}function respondWithFilteredResult(_0x15d3a1,_0x7151c6){return function(_0x52818a){if(_0x52818a){var _0x6ccffa=typeof _0x7151c6['offset']===_0xe8d0('0x1d')&&typeof _0x7151c6[_0xe8d0('0x1e')]===_0xe8d0('0x1d');var _0x4d1db4=_0x52818a['count'];var _0x47c67a=_0x6ccffa?0x0:_0x7151c6[_0xe8d0('0x1f')];var _0x384854=_0x6ccffa?_0x52818a[_0xe8d0('0x20')]:_0x7151c6[_0xe8d0('0x1f')]+_0x7151c6[_0xe8d0('0x1e')];var _0x588133;if(_0x384854>=_0x4d1db4){_0x384854=_0x4d1db4;_0x588133=0xc8;}else{_0x588133=0xce;}_0x15d3a1[_0xe8d0('0x1b')](_0x588133);return _0x15d3a1[_0xe8d0('0x21')]('Content-Range',_0x47c67a+'-'+_0x384854+'/'+_0x4d1db4)['json'](_0x52818a);}return null;};}function patchUpdates(_0x554402){return function(_0x384a60){try{jsonpatch[_0xe8d0('0x22')](_0x384a60,_0x554402,!![]);}catch(_0x25363b){return BPromise[_0xe8d0('0x23')](_0x25363b);}return _0x384a60[_0xe8d0('0x24')]();};}function saveUpdates(_0x23a945,_0x1bd25c){return function(_0x28a6b5){if(_0x28a6b5){return _0x28a6b5[_0xe8d0('0x25')](_0x23a945)['then'](function(_0xed8f2e){return _0xed8f2e;});}return null;};}function removeEntity(_0x9f747,_0x572c25){return function(_0x106614){if(_0x106614){return _0x106614[_0xe8d0('0x26')]()[_0xe8d0('0x27')](function(){var _0xd86c76=_0x106614[_0xe8d0('0x28')]({'plain':!![]});var _0x149dfd=_0xe8d0('0x29');return db[_0xe8d0('0x2a')][_0xe8d0('0x26')]({'where':{'type':_0x149dfd,'resourceId':_0xd86c76['id']}})[_0xe8d0('0x27')](function(){return _0x106614;});})[_0xe8d0('0x27')](function(){_0x9f747['status'](0xcc)[_0xe8d0('0x2b')]();});}};}function handleEntityNotFound(_0x26dd52,_0x10dec2){return function(_0x486f49){if(!_0x486f49){_0x26dd52[_0xe8d0('0x2c')](0x194);}return _0x486f49;};}function handleError(_0x343b08,_0x526240){_0x526240=_0x526240||0x1f4;return function(_0x1519e2){logger[_0xe8d0('0x2d')](_0x1519e2[_0xe8d0('0x2e')]);if(_0x1519e2[_0xe8d0('0x2f')]){delete _0x1519e2[_0xe8d0('0x2f')];}_0x343b08['status'](_0x526240)[_0xe8d0('0x30')](_0x1519e2);};}exports['index']=function(_0x5d3276,_0x50ad3c){var _0x547a2b={},_0x13cd4c={},_0x36ccec={'count':0x0,'rows':[]};var _0x5151fa=_['map'](db[_0xe8d0('0x31')]['rawAttributes'],function(_0x3b5d31){return{'name':_0x3b5d31[_0xe8d0('0x32')],'type':_0x3b5d31[_0xe8d0('0x33')][_0xe8d0('0x34')]};});_0x13cd4c[_0xe8d0('0x35')]=_['map'](_0x5151fa,_0xe8d0('0x2f'));_0x13cd4c[_0xe8d0('0x36')]=_[_0xe8d0('0x37')](_0x5d3276[_0xe8d0('0x36')]);_0x13cd4c['filters']=_[_0xe8d0('0x38')](_0x13cd4c[_0xe8d0('0x35')],_0x13cd4c['query']);_0x547a2b[_0xe8d0('0x39')]=_['intersection'](_0x13cd4c[_0xe8d0('0x35')],qs['fields'](_0x5d3276[_0xe8d0('0x36')]['fields']));_0x547a2b[_0xe8d0('0x39')]=_0x547a2b[_0xe8d0('0x39')][_0xe8d0('0x3a')]?_0x547a2b[_0xe8d0('0x39')]:_0x13cd4c['model'];if(!_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x3b')](_0xe8d0('0x3c'))){_0x547a2b['limit']=qs[_0xe8d0('0x1e')](_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x1e')]);_0x547a2b[_0xe8d0('0x1f')]=qs[_0xe8d0('0x1f')](_0x5d3276['query'][_0xe8d0('0x1f')]);}_0x547a2b[_0xe8d0('0x3d')]=qs[_0xe8d0('0x3e')](_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x3e')]);_0x547a2b[_0xe8d0('0x3f')]=qs[_0xe8d0('0x40')](_[_0xe8d0('0x41')](_0x5d3276['query'],_0x13cd4c['filters']),_0x5151fa);if(_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x42')]){_0x547a2b[_0xe8d0('0x3f')]=_[_0xe8d0('0x43')](_0x547a2b[_0xe8d0('0x3f')],{'$or':_['map'](_0x5151fa,function(_0x2e4362){if(_0x2e4362['type']!==_0xe8d0('0x44')){var _0x458294={};_0x458294[_0x2e4362[_0xe8d0('0x2f')]]={'$like':'%'+_0x5d3276['query'][_0xe8d0('0x42')]+'%'};return _0x458294;}})});}_0x547a2b=_[_0xe8d0('0x43')]({},_0x547a2b,_0x5d3276[_0xe8d0('0x45')]);var _0x230a90={'where':_0x547a2b[_0xe8d0('0x3f')]};return db['AnalyticMetric']['count'](_0x230a90)['then'](function(_0x4cf0da){_0x36ccec[_0xe8d0('0x20')]=_0x4cf0da;if(_0x5d3276['query'][_0xe8d0('0x46')]){_0x547a2b[_0xe8d0('0x47')]=[{'all':!![]}];}return db[_0xe8d0('0x31')][_0xe8d0('0x48')](_0x547a2b);})[_0xe8d0('0x27')](function(_0x1156da){_0x36ccec[_0xe8d0('0x49')]=_0x1156da;return _0x36ccec;})[_0xe8d0('0x27')](respondWithFilteredResult(_0x50ad3c,_0x547a2b))['catch'](handleError(_0x50ad3c,null));};exports[_0xe8d0('0x4a')]=function(_0x1da8b2,_0x4a3740){var _0x4bcdff={'raw':!![],'where':{'id':_0x1da8b2[_0xe8d0('0x4b')]['id']}},_0x3825a1={};_0x3825a1[_0xe8d0('0x35')]=_['keys'](db[_0xe8d0('0x31')][_0xe8d0('0x4c')]);_0x3825a1['query']=_[_0xe8d0('0x37')](_0x1da8b2[_0xe8d0('0x36')]);_0x3825a1['filters']=_[_0xe8d0('0x38')](_0x3825a1[_0xe8d0('0x35')],_0x3825a1[_0xe8d0('0x36')]);_0x4bcdff[_0xe8d0('0x39')]=_[_0xe8d0('0x38')](_0x3825a1[_0xe8d0('0x35')],qs[_0xe8d0('0x4d')](_0x1da8b2[_0xe8d0('0x36')]['fields']));_0x4bcdff[_0xe8d0('0x39')]=_0x4bcdff[_0xe8d0('0x39')][_0xe8d0('0x3a')]?_0x4bcdff[_0xe8d0('0x39')]:_0x3825a1[_0xe8d0('0x35')];if(_0x1da8b2[_0xe8d0('0x36')][_0xe8d0('0x46')]){_0x4bcdff[_0xe8d0('0x47')]=[{'all':!![]}];}_0x4bcdff=_[_0xe8d0('0x43')]({},_0x4bcdff,_0x1da8b2[_0xe8d0('0x45')]);return db[_0xe8d0('0x31')][_0xe8d0('0x4e')](_0x4bcdff)['then'](handleEntityNotFound(_0x4a3740,null))[_0xe8d0('0x27')](respondWithResult(_0x4a3740,null))[_0xe8d0('0x4f')](handleError(_0x4a3740,null));};exports[_0xe8d0('0x50')]=function(_0xad7d94,_0x34047c){return db[_0xe8d0('0x31')][_0xe8d0('0x50')](_0xad7d94['body'],{})[_0xe8d0('0x27')](function(_0x424764){var _0x151cf4=_0xad7d94[_0xe8d0('0x51')]['get']({'plain':!![]});if(!_0x151cf4)throw new Error(_0xe8d0('0x52'));if(_0x151cf4['role']===_0xe8d0('0x51')){var _0x382ae9=_0x424764[_0xe8d0('0x28')]({'plain':!![]});var _0x158d24=_0xe8d0('0x29');return db[_0xe8d0('0x53')][_0xe8d0('0x4e')]({'where':{'name':_0x158d24,'userProfileId':_0x151cf4['userProfileId']},'raw':!![]})[_0xe8d0('0x27')](function(_0x55f93d){if(_0x55f93d&&_0x55f93d['autoAssociation']===0x0){return db[_0xe8d0('0x2a')]['create']({'name':_0x382ae9[_0xe8d0('0x2f')],'resourceId':_0x382ae9['id'],'type':_0x55f93d['name'],'sectionId':_0x55f93d['id']},{})[_0xe8d0('0x27')](function(){return _0x424764;});}else{return _0x424764;}})[_0xe8d0('0x4f')](function(_0x13713c){logger[_0xe8d0('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13713c);throw _0x13713c;});}return _0x424764;})[_0xe8d0('0x27')](respondWithResult(_0x34047c,0xc9))[_0xe8d0('0x4f')](handleError(_0x34047c,null));};exports[_0xe8d0('0x25')]=function(_0x2e3f1d,_0x18cc14){if(_0x2e3f1d['body']['id']){delete _0x2e3f1d[_0xe8d0('0x54')]['id'];}return db[_0xe8d0('0x31')][_0xe8d0('0x4e')]({'where':{'id':_0x2e3f1d['params']['id']}})[_0xe8d0('0x27')](handleEntityNotFound(_0x18cc14,null))['then'](saveUpdates(_0x2e3f1d['body'],null))[_0xe8d0('0x27')](respondWithResult(_0x18cc14,null))[_0xe8d0('0x4f')](handleError(_0x18cc14,null));};exports['destroy']=function(_0xcb6ce2,_0x3a8074){return db['AnalyticMetric'][_0xe8d0('0x4e')]({'where':{'id':_0xcb6ce2[_0xe8d0('0x4b')]['id']}})[_0xe8d0('0x27')](handleEntityNotFound(_0x3a8074,null))[_0xe8d0('0x27')](removeEntity(_0x3a8074,null))['catch'](handleError(_0x3a8074,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index eec9353..2f68b55 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 _0x8b8e=['lodash','../../config/logger','moment','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics'];(function(_0x1a77bc,_0x1e48de){var _0x5d1aec=function(_0x1e9673){while(--_0x1e9673){_0x1a77bc['push'](_0x1a77bc['shift']());}};_0x5d1aec(++_0x1e48de);}(_0x8b8e,0x108));var _0xe8b8=function(_0x49bf07,_0x3cd323){_0x49bf07=_0x49bf07-0x0;var _0x4e9276=_0x8b8e[_0x49bf07];return _0x4e9276;};'use strict';var _=require(_0xe8b8('0x0'));var util=require('util');var logger=require(_0xe8b8('0x1'))('api');var moment=require(_0xe8b8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe8b8('0x3'));var rimraf=require(_0xe8b8('0x4'));var config=require(_0xe8b8('0x5'));var attributes=require(_0xe8b8('0x6'));module[_0xe8b8('0x7')]=function(_0x3f5dd7,_0x1c0548){return _0x3f5dd7[_0xe8b8('0x8')](_0xe8b8('0x9'),attributes,{'tableName':_0xe8b8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf981=['exports','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticMetric.attributes'];(function(_0xf95ac1,_0x253c5d){var _0x101165=function(_0x23490c){while(--_0x23490c){_0xf95ac1['push'](_0xf95ac1['shift']());}};_0x101165(++_0x253c5d);}(_0xf981,0xe6));var _0x1f98=function(_0x4992ff,_0x354b44){_0x4992ff=_0x4992ff-0x0;var _0x1772ed=_0xf981[_0x4992ff];return _0x1772ed;};'use strict';var _=require(_0x1f98('0x0'));var util=require(_0x1f98('0x1'));var logger=require(_0x1f98('0x2'))(_0x1f98('0x3'));var moment=require(_0x1f98('0x4'));var BPromise=require(_0x1f98('0x5'));var rp=require(_0x1f98('0x6'));var fs=require('fs');var path=require(_0x1f98('0x7'));var rimraf=require('rimraf');var config=require(_0x1f98('0x8'));var attributes=require(_0x1f98('0x9'));module[_0x1f98('0xa')]=function(_0x14bb19,_0x285cdc){return _0x14bb19['define']('AnalyticMetric',attributes,{'tableName':_0x1f98('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 0d8c05f..ccb92dc 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 _0x051a=['jayson/promise','client','request','then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticMetric,\x20%s,\x20%s','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x051a,0x198));var _0xa051=function(_0x4b4a8f,_0x73c713){_0x4b4a8f=_0x4b4a8f-0x0;var _0x562df5=_0x051a[_0x4b4a8f];return _0x562df5;};'use strict';var _=require(_0xa051('0x0'));var util=require(_0xa051('0x1'));var moment=require(_0xa051('0x2'));var BPromise=require('bluebird');var rs=require(_0xa051('0x3'));var fs=require('fs');var Redis=require(_0xa051('0x4'));var db=require(_0xa051('0x5'))['db'];var utils=require(_0xa051('0x6'));var logger=require(_0xa051('0x7'))(_0xa051('0x8'));var config=require(_0xa051('0x9'));var jayson=require(_0xa051('0xa'));var client=jayson[_0xa051('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ec0c7,_0x26de82,_0x26324e){return new BPromise(function(_0x2fbce6,_0x84dd93){return client[_0xa051('0xc')](_0x5ec0c7,_0x26324e)[_0xa051('0xd')](function(_0x171850){logger[_0xa051('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x26de82,_0xa051('0xf'));logger[_0xa051('0x10')](_0xa051('0x11'),_0x26de82,_0xa051('0xf'),JSON[_0xa051('0x12')](_0x171850));if(_0x171850[_0xa051('0x13')]){if(_0x171850[_0xa051('0x13')]['code']===0x1f4){logger[_0xa051('0x13')](_0xa051('0x14'),_0x26de82,_0x171850[_0xa051('0x13')][_0xa051('0x15')]);return _0x84dd93(_0x171850[_0xa051('0x13')][_0xa051('0x15')]);}logger[_0xa051('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x26de82,_0x171850[_0xa051('0x13')][_0xa051('0x15')]);return _0x2fbce6(_0x171850[_0xa051('0x13')][_0xa051('0x15')]);}else{logger[_0xa051('0xe')](_0xa051('0x14'),_0x26de82,_0xa051('0xf'));_0x2fbce6(_0x171850['result']['message']);}})['catch'](function(_0x36dbcc){logger[_0xa051('0x13')](_0xa051('0x14'),_0x26de82,_0x36dbcc);_0x84dd93(_0x36dbcc);});});} \ No newline at end of file +var _0x0c78=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','catch','moment'];(function(_0x20a5df,_0x4e1567){var _0x2124e4=function(_0x174f7d){while(--_0x174f7d){_0x20a5df['push'](_0x20a5df['shift']());}};_0x2124e4(++_0x4e1567);}(_0x0c78,0x1c7));var _0x80c7=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x0c78[_0x468b0f];return _0x3e74d9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x80c7('0x0'));var BPromise=require('bluebird');var rs=require(_0x80c7('0x1'));var fs=require('fs');var Redis=require(_0x80c7('0x2'));var db=require(_0x80c7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x80c7('0x4'))(_0x80c7('0x5'));var config=require(_0x80c7('0x6'));var jayson=require(_0x80c7('0x7'));var client=jayson['client'][_0x80c7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f39c4,_0x22ae08,_0x4ffc81){return new BPromise(function(_0x200df3,_0x51144b){return client[_0x80c7('0x9')](_0x5f39c4,_0x4ffc81)['then'](function(_0x5bc4f8){logger[_0x80c7('0xa')]('AnalyticMetric,\x20%s,\x20%s',_0x22ae08,_0x80c7('0xb'));logger[_0x80c7('0xc')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x22ae08,'request\x20sent',JSON[_0x80c7('0xd')](_0x5bc4f8));if(_0x5bc4f8[_0x80c7('0xe')]){if(_0x5bc4f8[_0x80c7('0xe')][_0x80c7('0xf')]===0x1f4){logger[_0x80c7('0xe')](_0x80c7('0x10'),_0x22ae08,_0x5bc4f8[_0x80c7('0xe')]['message']);return _0x51144b(_0x5bc4f8[_0x80c7('0xe')][_0x80c7('0x11')]);}logger[_0x80c7('0xe')](_0x80c7('0x10'),_0x22ae08,_0x5bc4f8[_0x80c7('0xe')][_0x80c7('0x11')]);return _0x200df3(_0x5bc4f8[_0x80c7('0xe')][_0x80c7('0x11')]);}else{logger[_0x80c7('0xa')](_0x80c7('0x10'),_0x22ae08,_0x80c7('0xb'));_0x200df3(_0x5bc4f8['result'][_0x80c7('0x11')]);}})[_0x80c7('0x12')](function(_0x1dfc36){logger[_0x80c7('0xe')](_0x80c7('0x10'),_0x22ae08,_0x1dfc36);_0x51144b(_0x1dfc36);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 6324ecc..8fb48da 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 _0xa4dc=['put','/:id','update','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','isAuthenticated','show','post'];(function(_0x1492b1,_0x1a7f9a){var _0x4fff7c=function(_0x1175bf){while(--_0x1175bf){_0x1492b1['push'](_0x1492b1['shift']());}};_0x4fff7c(++_0x1a7f9a);}(_0xa4dc,0x16a));var _0xca4d=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0xa4dc[_0x4e7d25];return _0x526fe6;};'use strict';var multer=require(_0xca4d('0x0'));var util=require(_0xca4d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xca4d('0x2'));var router=express[_0xca4d('0x3')]();var fs_extra=require(_0xca4d('0x4'));var auth=require(_0xca4d('0x5'));var interaction=require(_0xca4d('0x6'));var config=require('../../config/environment');var controller=require(_0xca4d('0x7'));router[_0xca4d('0x8')]('/',auth[_0xca4d('0x9')](),controller['index']);router[_0xca4d('0x8')]('/:id',auth[_0xca4d('0x9')](),controller[_0xca4d('0xa')]);router[_0xca4d('0xb')]('/',auth[_0xca4d('0x9')](),controller['create']);router[_0xca4d('0xc')](_0xca4d('0xd'),auth['isAuthenticated'](),controller[_0xca4d('0xe')]);router['delete'](_0xca4d('0xd'),auth[_0xca4d('0x9')](),controller[_0xca4d('0xf')]);module[_0xca4d('0x10')]=router; \ No newline at end of file +var _0xb491=['express','Router','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1c1791,_0x15ac03){var _0x1ecc4f=function(_0x5c68ae){while(--_0x5c68ae){_0x1c1791['push'](_0x1c1791['shift']());}};_0x1ecc4f(++_0x15ac03);}(_0xb491,0x18c));var _0x1b49=function(_0x4a6cf8,_0x5534ef){_0x4a6cf8=_0x4a6cf8-0x0;var _0x22205e=_0xb491[_0x4a6cf8];return _0x22205e;};'use strict';var multer=require(_0x1b49('0x0'));var util=require(_0x1b49('0x1'));var path=require(_0x1b49('0x2'));var timeout=require(_0x1b49('0x3'));var express=require(_0x1b49('0x4'));var router=express[_0x1b49('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1b49('0x6'));var interaction=require(_0x1b49('0x7'));var config=require('../../config/environment');var controller=require(_0x1b49('0x8'));router[_0x1b49('0x9')]('/',auth[_0x1b49('0xa')](),controller['index']);router[_0x1b49('0x9')]('/:id',auth[_0x1b49('0xa')](),controller[_0x1b49('0xb')]);router[_0x1b49('0xc')]('/',auth[_0x1b49('0xa')](),controller[_0x1b49('0xd')]);router[_0x1b49('0xe')](_0x1b49('0xf'),auth[_0x1b49('0xa')](),controller[_0x1b49('0x10')]);router[_0x1b49('0x11')](_0x1b49('0xf'),auth[_0x1b49('0xa')](),controller[_0x1b49('0x12')]);module[_0x1b49('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index e2298f7..b2d847d 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 _0xf7b1=['sequelize'];(function(_0x5f52a4,_0x5706d9){var _0xde1bce=function(_0x16ef65){while(--_0x16ef65){_0x5f52a4['push'](_0x5f52a4['shift']());}};_0xde1bce(++_0x5706d9);}(_0xf7b1,0x197));var _0x1f7b=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xf7b1[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require(_0x1f7b('0x0'));module['exports']={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x7b24=['sequelize','exports','TEXT'];(function(_0x5f746f,_0x5b05ab){var _0x198d15=function(_0x58c7e7){while(--_0x58c7e7){_0x5f746f['push'](_0x5f746f['shift']());}};_0x198d15(++_0x5b05ab);}(_0x7b24,0x183));var _0x47b2=function(_0x374731,_0x382d68){_0x374731=_0x374731-0x0;var _0x11dd89=_0x7b24[_0x374731];return _0x11dd89;};'use strict';var Sequelize=require(_0x47b2('0x0'));module[_0x47b2('0x1')]={'tree':{'type':Sequelize[_0x47b2('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 6ced81a..e3a1590 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 _0x301c=['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','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','then','sendStatus','error','send','index','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x4e46fd,_0x55dcbb){var _0x2b4a68=function(_0x3a0551){while(--_0x3a0551){_0x4e46fd['push'](_0x4e46fd['shift']());}};_0x2b4a68(++_0x55dcbb);}(_0x301c,0x93));var _0xc301=function(_0x2563e4,_0x456262){_0x2563e4=_0x2563e4-0x0;var _0x53e6d8=_0x301c[_0x2563e4];return _0x53e6d8;};'use strict';var emlformat=require(_0xc301('0x0'));var rimraf=require(_0xc301('0x1'));var zipdir=require(_0xc301('0x2'));var jsonpatch=require(_0xc301('0x3'));var rp=require(_0xc301('0x4'));var moment=require(_0xc301('0x5'));var BPromise=require(_0xc301('0x6'));var Mustache=require('mustache');var util=require(_0xc301('0x7'));var path=require(_0xc301('0x8'));var sox=require(_0xc301('0x9'));var csv=require(_0xc301('0xa'));var ejs=require(_0xc301('0xb'));var fs=require('fs');var fs_extra=require(_0xc301('0xc'));var _=require(_0xc301('0xd'));var squel=require(_0xc301('0xe'));var crypto=require(_0xc301('0xf'));var jsforce=require(_0xc301('0x10'));var deskjs=require(_0xc301('0x11'));var toCsv=require(_0xc301('0xa'));var querystring=require('querystring');var Papa=require(_0xc301('0x12'));var Redis=require(_0xc301('0x13'));var authService=require(_0xc301('0x14'));var qs=require(_0xc301('0x15'));var as=require(_0xc301('0x16'));var hardwareService=require(_0xc301('0x17'));var logger=require(_0xc301('0x18'))(_0xc301('0x19'));var utils=require(_0xc301('0x1a'));var config=require(_0xc301('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xc301('0x1c'))['db'];function respondWithStatusCode(_0x5e9336,_0x1332c7){_0x1332c7=_0x1332c7||0xcc;return function(_0x39a239){if(_0x39a239){return _0x5e9336['sendStatus'](_0x1332c7);}return _0x5e9336['status'](_0x1332c7)[_0xc301('0x1d')]();};}function respondWithResult(_0x163346,_0x558c1a){_0x558c1a=_0x558c1a||0xc8;return function(_0x49e0da){if(_0x49e0da){return _0x163346[_0xc301('0x1e')](_0x558c1a)['json'](_0x49e0da);}};}function respondWithFilteredResult(_0x18fa2d,_0xf8e652){return function(_0x1ecead){if(_0x1ecead){var _0x57db74=typeof _0xf8e652[_0xc301('0x1f')]===_0xc301('0x20')&&typeof _0xf8e652[_0xc301('0x21')]===_0xc301('0x20');var _0x381a6f=_0x1ecead[_0xc301('0x22')];var _0x1c4c56=_0x57db74?0x0:_0xf8e652[_0xc301('0x1f')];var _0x3aeed2=_0x57db74?_0x1ecead[_0xc301('0x22')]:_0xf8e652[_0xc301('0x1f')]+_0xf8e652[_0xc301('0x21')];var _0x20d94b;if(_0x3aeed2>=_0x381a6f){_0x3aeed2=_0x381a6f;_0x20d94b=0xc8;}else{_0x20d94b=0xce;}_0x18fa2d['status'](_0x20d94b);return _0x18fa2d[_0xc301('0x23')](_0xc301('0x24'),_0x1c4c56+'-'+_0x3aeed2+'/'+_0x381a6f)[_0xc301('0x25')](_0x1ecead);}return null;};}function patchUpdates(_0x1d040f){return function(_0x366f38){try{jsonpatch[_0xc301('0x26')](_0x366f38,_0x1d040f,!![]);}catch(_0x5c3b98){return BPromise[_0xc301('0x27')](_0x5c3b98);}return _0x366f38['save']();};}function saveUpdates(_0x8e048c,_0x5cbd99){return function(_0x2e50dc){if(_0x2e50dc){return _0x2e50dc[_0xc301('0x28')](_0x8e048c)['then'](function(_0x490610){return _0x490610;});}return null;};}function removeEntity(_0xfe4ec1,_0x3a9a48){return function(_0x2090b9){if(_0x2090b9){return _0x2090b9[_0xc301('0x29')]()[_0xc301('0x2a')](function(){_0xfe4ec1[_0xc301('0x1e')](0xcc)[_0xc301('0x1d')]();});}};}function handleEntityNotFound(_0x35240d,_0x3b16c2){return function(_0x5da12f){if(!_0x5da12f){_0x35240d[_0xc301('0x2b')](0x194);}return _0x5da12f;};}function handleError(_0x2941f3,_0x56a525){_0x56a525=_0x56a525||0x1f4;return function(_0x4d2022){logger[_0xc301('0x2c')](_0x4d2022['stack']);if(_0x4d2022['name']){delete _0x4d2022['name'];}_0x2941f3['status'](_0x56a525)[_0xc301('0x2d')](_0x4d2022);};}exports[_0xc301('0x2e')]=function(_0x2072c2,_0x3a2b99){var _0x1c970b={},_0x26edc4={},_0x1f4cea={'count':0x0,'rows':[]};var _0x1c0eed=_['map'](db[_0xc301('0x2f')][_0xc301('0x30')],function(_0x33e095){return{'name':_0x33e095[_0xc301('0x31')],'type':_0x33e095[_0xc301('0x32')][_0xc301('0x33')]};});_0x26edc4[_0xc301('0x34')]=_[_0xc301('0x35')](_0x1c0eed,_0xc301('0x36'));_0x26edc4[_0xc301('0x37')]=_[_0xc301('0x38')](_0x2072c2['query']);_0x26edc4[_0xc301('0x39')]=_[_0xc301('0x3a')](_0x26edc4[_0xc301('0x34')],_0x26edc4['query']);_0x1c970b['attributes']=_['intersection'](_0x26edc4[_0xc301('0x34')],qs[_0xc301('0x3b')](_0x2072c2['query'][_0xc301('0x3b')]));_0x1c970b[_0xc301('0x3c')]=_0x1c970b['attributes'][_0xc301('0x3d')]?_0x1c970b[_0xc301('0x3c')]:_0x26edc4['model'];if(!_0x2072c2[_0xc301('0x37')][_0xc301('0x3e')]('nolimit')){_0x1c970b[_0xc301('0x21')]=qs[_0xc301('0x21')](_0x2072c2[_0xc301('0x37')]['limit']);_0x1c970b['offset']=qs[_0xc301('0x1f')](_0x2072c2['query'][_0xc301('0x1f')]);}_0x1c970b[_0xc301('0x3f')]=qs[_0xc301('0x40')](_0x2072c2['query'][_0xc301('0x40')]);_0x1c970b['where']=qs[_0xc301('0x39')](_[_0xc301('0x41')](_0x2072c2['query'],_0x26edc4[_0xc301('0x39')]),_0x1c0eed);if(_0x2072c2[_0xc301('0x37')][_0xc301('0x42')]){_0x1c970b['where']=_['merge'](_0x1c970b[_0xc301('0x43')],{'$or':_[_0xc301('0x35')](_0x1c0eed,function(_0x2583de){if(_0x2583de['type']!==_0xc301('0x44')){var _0x50ef06={};_0x50ef06[_0x2583de[_0xc301('0x36')]]={'$like':'%'+_0x2072c2[_0xc301('0x37')][_0xc301('0x42')]+'%'};return _0x50ef06;}})});}_0x1c970b=_[_0xc301('0x45')]({},_0x1c970b,_0x2072c2[_0xc301('0x46')]);var _0x1aa554={'where':_0x1c970b['where']};return db[_0xc301('0x2f')][_0xc301('0x22')](_0x1aa554)[_0xc301('0x2a')](function(_0x2f871b){_0x1f4cea['count']=_0x2f871b;if(_0x2072c2[_0xc301('0x37')][_0xc301('0x47')]){_0x1c970b[_0xc301('0x48')]=[{'all':!![]}];}return db[_0xc301('0x2f')][_0xc301('0x49')](_0x1c970b);})[_0xc301('0x2a')](function(_0x1dcc39){_0x1f4cea['rows']=_0x1dcc39;return _0x1f4cea;})[_0xc301('0x2a')](respondWithFilteredResult(_0x3a2b99,_0x1c970b))['catch'](handleError(_0x3a2b99,null));};exports[_0xc301('0x4a')]=function(_0x2d426e,_0xdb01e){var _0x4b46d8={'raw':!![],'where':{'id':_0x2d426e[_0xc301('0x4b')]['id']}},_0x15eb94={};_0x15eb94[_0xc301('0x34')]=_['keys'](db[_0xc301('0x2f')][_0xc301('0x30')]);_0x15eb94[_0xc301('0x37')]=_[_0xc301('0x38')](_0x2d426e['query']);_0x15eb94['filters']=_[_0xc301('0x3a')](_0x15eb94[_0xc301('0x34')],_0x15eb94[_0xc301('0x37')]);_0x4b46d8['attributes']=_[_0xc301('0x3a')](_0x15eb94['model'],qs[_0xc301('0x3b')](_0x2d426e[_0xc301('0x37')]['fields']));_0x4b46d8[_0xc301('0x3c')]=_0x4b46d8[_0xc301('0x3c')]['length']?_0x4b46d8['attributes']:_0x15eb94[_0xc301('0x34')];if(_0x2d426e[_0xc301('0x37')][_0xc301('0x47')]){_0x4b46d8[_0xc301('0x48')]=[{'all':!![]}];}_0x4b46d8=_['merge']({},_0x4b46d8,_0x2d426e[_0xc301('0x46')]);return db[_0xc301('0x2f')][_0xc301('0x4c')](_0x4b46d8)[_0xc301('0x2a')](handleEntityNotFound(_0xdb01e,null))[_0xc301('0x2a')](respondWithResult(_0xdb01e,null))['catch'](handleError(_0xdb01e,null));};exports[_0xc301('0x4d')]=function(_0x6f8bf4,_0x122e4e){return db[_0xc301('0x2f')][_0xc301('0x4d')](_0x6f8bf4['body'],{})[_0xc301('0x2a')](respondWithResult(_0x122e4e,0xc9))['catch'](handleError(_0x122e4e,null));};exports[_0xc301('0x28')]=function(_0x3a19ca,_0x140472){if(_0x3a19ca['body']['id']){delete _0x3a19ca[_0xc301('0x4e')]['id'];}return db[_0xc301('0x2f')]['find']({'where':{'id':_0x3a19ca[_0xc301('0x4b')]['id']}})[_0xc301('0x2a')](handleEntityNotFound(_0x140472,null))['then'](saveUpdates(_0x3a19ca[_0xc301('0x4e')],null))[_0xc301('0x2a')](respondWithResult(_0x140472,null))[_0xc301('0x4f')](handleError(_0x140472,null));};exports[_0xc301('0x29')]=function(_0x21dc4e,_0x49dbf1){return db[_0xc301('0x2f')][_0xc301('0x4c')]({'where':{'id':_0x21dc4e[_0xc301('0x4b')]['id']}})[_0xc301('0x2a')](handleEntityNotFound(_0x49dbf1,null))[_0xc301('0x2a')](removeEntity(_0x49dbf1,null))[_0xc301('0x4f')](handleError(_0x49dbf1,null));}; \ No newline at end of file +var _0x1535=['crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','update','then','destroy','stack','name','send','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','map','VIRTUAL','options','AnalyticTreeReport','findAll','rows','catch','params','merge','find','create','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1535,0x144));var _0x5153=function(_0x5222d7,_0x473f09){_0x5222d7=_0x5222d7-0x0;var _0x421737=_0x1535[_0x5222d7];return _0x421737;};'use strict';var emlformat=require(_0x5153('0x0'));var rimraf=require(_0x5153('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5153('0x2'));var moment=require(_0x5153('0x3'));var BPromise=require(_0x5153('0x4'));var Mustache=require(_0x5153('0x5'));var util=require('util');var path=require(_0x5153('0x6'));var sox=require(_0x5153('0x7'));var csv=require(_0x5153('0x8'));var ejs=require(_0x5153('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5153('0xa'));var crypto=require(_0x5153('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5153('0xc'));var toCsv=require(_0x5153('0x8'));var querystring=require(_0x5153('0xd'));var Papa=require('papaparse');var Redis=require(_0x5153('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5153('0xf'));var hardwareService=require(_0x5153('0x10'));var logger=require(_0x5153('0x11'))('api');var utils=require(_0x5153('0x12'));var config=require(_0x5153('0x13'));var licenseUtil=require(_0x5153('0x14'));var db=require(_0x5153('0x15'))['db'];function respondWithStatusCode(_0x204128,_0x397ddb){_0x397ddb=_0x397ddb||0xcc;return function(_0x33554d){if(_0x33554d){return _0x204128[_0x5153('0x16')](_0x397ddb);}return _0x204128['status'](_0x397ddb)[_0x5153('0x17')]();};}function respondWithResult(_0x57ed7b,_0x331e02){_0x331e02=_0x331e02||0xc8;return function(_0x2abe26){if(_0x2abe26){return _0x57ed7b[_0x5153('0x18')](_0x331e02)[_0x5153('0x19')](_0x2abe26);}};}function respondWithFilteredResult(_0x33c0cb,_0x196515){return function(_0x3bc69f){if(_0x3bc69f){var _0x3d87d7=typeof _0x196515[_0x5153('0x1a')]===_0x5153('0x1b')&&typeof _0x196515[_0x5153('0x1c')]===_0x5153('0x1b');var _0x329eea=_0x3bc69f[_0x5153('0x1d')];var _0x51fe76=_0x3d87d7?0x0:_0x196515[_0x5153('0x1a')];var _0x2aa053=_0x3d87d7?_0x3bc69f[_0x5153('0x1d')]:_0x196515[_0x5153('0x1a')]+_0x196515[_0x5153('0x1c')];var _0x21c065;if(_0x2aa053>=_0x329eea){_0x2aa053=_0x329eea;_0x21c065=0xc8;}else{_0x21c065=0xce;}_0x33c0cb[_0x5153('0x18')](_0x21c065);return _0x33c0cb[_0x5153('0x1e')]('Content-Range',_0x51fe76+'-'+_0x2aa053+'/'+_0x329eea)[_0x5153('0x19')](_0x3bc69f);}return null;};}function patchUpdates(_0x5bf6d3){return function(_0x5becda){try{jsonpatch[_0x5153('0x1f')](_0x5becda,_0x5bf6d3,!![]);}catch(_0x4f6fff){return BPromise['reject'](_0x4f6fff);}return _0x5becda['save']();};}function saveUpdates(_0x345fb9,_0x32af90){return function(_0xfb483c){if(_0xfb483c){return _0xfb483c[_0x5153('0x20')](_0x345fb9)[_0x5153('0x21')](function(_0x148e05){return _0x148e05;});}return null;};}function removeEntity(_0x2f67eb,_0x3a1094){return function(_0x169fea){if(_0x169fea){return _0x169fea[_0x5153('0x22')]()['then'](function(){_0x2f67eb[_0x5153('0x18')](0xcc)[_0x5153('0x17')]();});}};}function handleEntityNotFound(_0xc096d3,_0x22ba69){return function(_0x24893f){if(!_0x24893f){_0xc096d3[_0x5153('0x16')](0x194);}return _0x24893f;};}function handleError(_0x319a5f,_0x392d4f){_0x392d4f=_0x392d4f||0x1f4;return function(_0x841566){logger['error'](_0x841566[_0x5153('0x23')]);if(_0x841566[_0x5153('0x24')]){delete _0x841566['name'];}_0x319a5f['status'](_0x392d4f)[_0x5153('0x25')](_0x841566);};}exports['index']=function(_0x59c7bc,_0x1d5f46){var _0x26dd34={},_0x148e58={},_0x2f3913={'count':0x0,'rows':[]};var _0x27a027=_['map'](db['AnalyticTreeReport'][_0x5153('0x26')],function(_0x389935){return{'name':_0x389935[_0x5153('0x27')],'type':_0x389935[_0x5153('0x28')][_0x5153('0x29')]};});_0x148e58[_0x5153('0x2a')]=_['map'](_0x27a027,'name');_0x148e58[_0x5153('0x2b')]=_[_0x5153('0x2c')](_0x59c7bc['query']);_0x148e58[_0x5153('0x2d')]=_[_0x5153('0x2e')](_0x148e58[_0x5153('0x2a')],_0x148e58['query']);_0x26dd34[_0x5153('0x2f')]=_[_0x5153('0x2e')](_0x148e58['model'],qs[_0x5153('0x30')](_0x59c7bc['query'][_0x5153('0x30')]));_0x26dd34[_0x5153('0x2f')]=_0x26dd34['attributes']['length']?_0x26dd34[_0x5153('0x2f')]:_0x148e58[_0x5153('0x2a')];if(!_0x59c7bc[_0x5153('0x2b')][_0x5153('0x31')](_0x5153('0x32'))){_0x26dd34[_0x5153('0x1c')]=qs[_0x5153('0x1c')](_0x59c7bc[_0x5153('0x2b')][_0x5153('0x1c')]);_0x26dd34[_0x5153('0x1a')]=qs['offset'](_0x59c7bc[_0x5153('0x2b')][_0x5153('0x1a')]);}_0x26dd34[_0x5153('0x33')]=qs[_0x5153('0x34')](_0x59c7bc[_0x5153('0x2b')][_0x5153('0x34')]);_0x26dd34[_0x5153('0x35')]=qs['filters'](_['pick'](_0x59c7bc['query'],_0x148e58['filters']),_0x27a027);if(_0x59c7bc['query'][_0x5153('0x36')]){_0x26dd34[_0x5153('0x35')]=_['merge'](_0x26dd34[_0x5153('0x35')],{'$or':_[_0x5153('0x37')](_0x27a027,function(_0x52a147){if(_0x52a147['type']!==_0x5153('0x38')){var _0x13e08f={};_0x13e08f[_0x52a147[_0x5153('0x24')]]={'$like':'%'+_0x59c7bc[_0x5153('0x2b')][_0x5153('0x36')]+'%'};return _0x13e08f;}})});}_0x26dd34=_['merge']({},_0x26dd34,_0x59c7bc[_0x5153('0x39')]);var _0xb05020={'where':_0x26dd34[_0x5153('0x35')]};return db['AnalyticTreeReport'][_0x5153('0x1d')](_0xb05020)['then'](function(_0x31c6a5){_0x2f3913['count']=_0x31c6a5;if(_0x59c7bc[_0x5153('0x2b')]['includeAll']){_0x26dd34['include']=[{'all':!![]}];}return db[_0x5153('0x3a')][_0x5153('0x3b')](_0x26dd34);})['then'](function(_0x3e8c07){_0x2f3913[_0x5153('0x3c')]=_0x3e8c07;return _0x2f3913;})['then'](respondWithFilteredResult(_0x1d5f46,_0x26dd34))[_0x5153('0x3d')](handleError(_0x1d5f46,null));};exports['show']=function(_0xadd7e0,_0x1f331e){var _0x370bea={'raw':!![],'where':{'id':_0xadd7e0[_0x5153('0x3e')]['id']}},_0x596738={};_0x596738[_0x5153('0x2a')]=_['keys'](db[_0x5153('0x3a')][_0x5153('0x26')]);_0x596738[_0x5153('0x2b')]=_[_0x5153('0x2c')](_0xadd7e0[_0x5153('0x2b')]);_0x596738[_0x5153('0x2d')]=_['intersection'](_0x596738['model'],_0x596738['query']);_0x370bea[_0x5153('0x2f')]=_[_0x5153('0x2e')](_0x596738[_0x5153('0x2a')],qs[_0x5153('0x30')](_0xadd7e0[_0x5153('0x2b')][_0x5153('0x30')]));_0x370bea[_0x5153('0x2f')]=_0x370bea[_0x5153('0x2f')]['length']?_0x370bea[_0x5153('0x2f')]:_0x596738[_0x5153('0x2a')];if(_0xadd7e0[_0x5153('0x2b')]['includeAll']){_0x370bea['include']=[{'all':!![]}];}_0x370bea=_[_0x5153('0x3f')]({},_0x370bea,_0xadd7e0[_0x5153('0x39')]);return db[_0x5153('0x3a')][_0x5153('0x40')](_0x370bea)[_0x5153('0x21')](handleEntityNotFound(_0x1f331e,null))[_0x5153('0x21')](respondWithResult(_0x1f331e,null))[_0x5153('0x3d')](handleError(_0x1f331e,null));};exports[_0x5153('0x41')]=function(_0xce6bea,_0x472101){return db['AnalyticTreeReport'][_0x5153('0x41')](_0xce6bea['body'],{})['then'](respondWithResult(_0x472101,0xc9))[_0x5153('0x3d')](handleError(_0x472101,null));};exports['update']=function(_0x488a3a,_0x276b18){if(_0x488a3a[_0x5153('0x42')]['id']){delete _0x488a3a[_0x5153('0x42')]['id'];}return db[_0x5153('0x3a')][_0x5153('0x40')]({'where':{'id':_0x488a3a[_0x5153('0x3e')]['id']}})[_0x5153('0x21')](handleEntityNotFound(_0x276b18,null))[_0x5153('0x21')](saveUpdates(_0x488a3a[_0x5153('0x42')],null))[_0x5153('0x21')](respondWithResult(_0x276b18,null))[_0x5153('0x3d')](handleError(_0x276b18,null));};exports[_0x5153('0x22')]=function(_0x233795,_0x329e0d){return db['AnalyticTreeReport']['find']({'where':{'id':_0x233795[_0x5153('0x3e')]['id']}})[_0x5153('0x21')](handleEntityNotFound(_0x329e0d,null))[_0x5153('0x21')](removeEntity(_0x329e0d,null))[_0x5153('0x3d')](handleError(_0x329e0d,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index ba78822..f0e0f3b 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 _0xd350=['exports','AnalyticTreeReport','analytics_report_trees','lodash','api','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes'];(function(_0x3709ca,_0x2a026b){var _0x44e1a8=function(_0x4ac820){while(--_0x4ac820){_0x3709ca['push'](_0x3709ca['shift']());}};_0x44e1a8(++_0x2a026b);}(_0xd350,0x1cf));var _0x0d35=function(_0x3cc05d,_0x4b8f88){_0x3cc05d=_0x3cc05d-0x0;var _0x28b736=_0xd350[_0x3cc05d];return _0x28b736;};'use strict';var _=require(_0x0d35('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0d35('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0d35('0x2'));var fs=require('fs');var path=require(_0x0d35('0x3'));var rimraf=require(_0x0d35('0x4'));var config=require(_0x0d35('0x5'));var attributes=require(_0x0d35('0x6'));module[_0x0d35('0x7')]=function(_0x45b590,_0x29c5a6){return _0x45b590['define'](_0x0d35('0x8'),attributes,{'tableName':_0x0d35('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0184=['./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x329a42,_0x735890){var _0x412fc3=function(_0x38562f){while(--_0x38562f){_0x329a42['push'](_0x329a42['shift']());}};_0x412fc3(++_0x735890);}(_0x0184,0xe0));var _0x4018=function(_0x27b3df,_0x34a01a){_0x27b3df=_0x27b3df-0x0;var _0x275390=_0x0184[_0x27b3df];return _0x275390;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4018('0x0'))('api');var moment=require(_0x4018('0x1'));var BPromise=require(_0x4018('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4018('0x3'));var rimraf=require(_0x4018('0x4'));var config=require(_0x4018('0x5'));var attributes=require(_0x4018('0x6'));module[_0x4018('0x7')]=function(_0x4c6815,_0x272ddf){return _0x4c6815[_0x4018('0x8')](_0x4018('0x9'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 1c1821d..da032e4 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x3382e2,_0x6fbda2){var _0x25381b=function(_0x28cabc){while(--_0x28cabc){_0x3382e2['push'](_0x3382e2['shift']());}};_0x25381b(++_0x6fbda2);}(_0x2ef3,0xba));var _0x32ef=function(_0xd6f43d,_0x583ec3){_0xd6f43d=_0xd6f43d-0x0;var _0x12ea0=_0x2ef3[_0xd6f43d];return _0x12ea0;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x572532,_0x3e2f17){var _0x6d4902=function(_0x35ad26){while(--_0x35ad26){_0x572532['push'](_0x572532['shift']());}};_0x6d4902(++_0x3e2f17);}(_0x5f2f,0x73));var _0xf5f2=function(_0x925aff,_0x43dc77){_0x925aff=_0x925aff-0x0;var _0x519702=_0x5f2f[_0x925aff];return _0x519702;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index f1aae76..0c7dd7a 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 _0x9b26=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','show','post','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x16ad45,_0x4bcf1d){var _0x51f76c=function(_0x790f59){while(--_0x790f59){_0x16ad45['push'](_0x16ad45['shift']());}};_0x51f76c(++_0x4bcf1d);}(_0x9b26,0x1d7));var _0x69b2=function(_0x362099,_0x19e68f){_0x362099=_0x362099-0x0;var _0x43adb7=_0x9b26[_0x362099];return _0x43adb7;};'use strict';var multer=require(_0x69b2('0x0'));var util=require(_0x69b2('0x1'));var path=require(_0x69b2('0x2'));var timeout=require(_0x69b2('0x3'));var express=require(_0x69b2('0x4'));var router=express[_0x69b2('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x69b2('0x6'));var interaction=require(_0x69b2('0x7'));var config=require(_0x69b2('0x8'));var controller=require(_0x69b2('0x9'));router[_0x69b2('0xa')]('/',auth[_0x69b2('0xb')](),controller[_0x69b2('0xc')]);router[_0x69b2('0xa')]('/:id',auth[_0x69b2('0xb')](),controller[_0x69b2('0xd')]);router[_0x69b2('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x69b2('0xf')]('/:id',auth[_0x69b2('0xb')](),controller[_0x69b2('0x10')]);router[_0x69b2('0x11')]('/:id',auth[_0x69b2('0xb')](),controller[_0x69b2('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5808=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete'];(function(_0x3aa1bc,_0x48147f){var _0x302650=function(_0x319da1){while(--_0x319da1){_0x3aa1bc['push'](_0x3aa1bc['shift']());}};_0x302650(++_0x48147f);}(_0x5808,0xf8));var _0x8580=function(_0x16337a,_0x4789a1){_0x16337a=_0x16337a-0x0;var _0x422365=_0x5808[_0x16337a];return _0x422365;};'use strict';var multer=require(_0x8580('0x0'));var util=require(_0x8580('0x1'));var path=require(_0x8580('0x2'));var timeout=require(_0x8580('0x3'));var express=require(_0x8580('0x4'));var router=express[_0x8580('0x5')]();var fs_extra=require(_0x8580('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8580('0x7'));var controller=require(_0x8580('0x8'));router[_0x8580('0x9')]('/',auth[_0x8580('0xa')](),controller[_0x8580('0xb')]);router[_0x8580('0x9')](_0x8580('0xc'),auth[_0x8580('0xa')](),controller['show']);router[_0x8580('0xd')]('/',auth[_0x8580('0xa')](),controller[_0x8580('0xe')]);router[_0x8580('0xf')](_0x8580('0xc'),auth[_0x8580('0xa')](),controller[_0x8580('0x10')]);router[_0x8580('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x8580('0x12')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index f0e4e2e..fd2ad65 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 _0xfa2f=['STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfa2f,0xe8));var _0xffa2=function(_0x2f4217,_0x397e98){_0x2f4217=_0x2f4217-0x0;var _0x3fffd9=_0xfa2f[_0x2f4217];return _0x3fffd9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xffa2('0x0')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xffa2('0x0')]}}; \ No newline at end of file +var _0xf9f7=['STRING','sequelize','exports'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xf9f7,0xdf));var _0x7f9f=function(_0x5a9b6c,_0x30ccd0){_0x5a9b6c=_0x5a9b6c-0x0;var _0x72bed=_0xf9f7[_0x5a9b6c];return _0x72bed;};'use strict';var Sequelize=require(_0x7f9f('0x0'));module[_0x7f9f('0x1')]={'name':{'type':Sequelize[_0x7f9f('0x2')]},'basename':{'type':Sequelize[_0x7f9f('0x2')]},'type':{'type':Sequelize[_0x7f9f('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 44deaea..31b4131 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 _0xd2fd=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','find','clone','get','omit','body','createdAt','updatedAt','create','file','originalname','basename','filename','mimetype','download','findOne','join','server/files/attachments/','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model'];(function(_0x30b045,_0x5cea47){var _0x290a8b=function(_0x3997cd){while(--_0x3997cd){_0x30b045['push'](_0x30b045['shift']());}};_0x290a8b(++_0x5cea47);}(_0xd2fd,0x1da));var _0xdd2f=function(_0x5a3d74,_0x546dc6){_0x5a3d74=_0x5a3d74-0x0;var _0x5db855=_0xd2fd[_0x5a3d74];return _0x5db855;};'use strict';var emlformat=require(_0xdd2f('0x0'));var rimraf=require(_0xdd2f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdd2f('0x2'));var moment=require(_0xdd2f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdd2f('0x4'));var util=require(_0xdd2f('0x5'));var path=require(_0xdd2f('0x6'));var sox=require(_0xdd2f('0x7'));var csv=require(_0xdd2f('0x8'));var ejs=require(_0xdd2f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdd2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xdd2f('0xb'));var deskjs=require(_0xdd2f('0xc'));var toCsv=require(_0xdd2f('0x8'));var querystring=require(_0xdd2f('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdd2f('0xe'));var qs=require(_0xdd2f('0xf'));var as=require(_0xdd2f('0x10'));var hardwareService=require(_0xdd2f('0x11'));var logger=require(_0xdd2f('0x12'))(_0xdd2f('0x13'));var utils=require(_0xdd2f('0x14'));var config=require(_0xdd2f('0x15'));var licenseUtil=require(_0xdd2f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24f753,_0x4e0e55){_0x4e0e55=_0x4e0e55||0xcc;return function(_0x322995){if(_0x322995){return _0x24f753[_0xdd2f('0x17')](_0x4e0e55);}return _0x24f753[_0xdd2f('0x18')](_0x4e0e55)[_0xdd2f('0x19')]();};}function respondWithResult(_0x1b0f9d,_0x2b277a){_0x2b277a=_0x2b277a||0xc8;return function(_0x560329){if(_0x560329){return _0x1b0f9d['status'](_0x2b277a)[_0xdd2f('0x1a')](_0x560329);}};}function respondWithFilteredResult(_0x5d99dc,_0xaa3a22){return function(_0x4de182){if(_0x4de182){var _0x3e2a21=typeof _0xaa3a22[_0xdd2f('0x1b')]===_0xdd2f('0x1c')&&typeof _0xaa3a22[_0xdd2f('0x1d')]===_0xdd2f('0x1c');var _0x24790b=_0x4de182['count'];var _0x521747=_0x3e2a21?0x0:_0xaa3a22[_0xdd2f('0x1b')];var _0x581905=_0x3e2a21?_0x4de182['count']:_0xaa3a22[_0xdd2f('0x1b')]+_0xaa3a22[_0xdd2f('0x1d')];var _0x24e2fc;if(_0x581905>=_0x24790b){_0x581905=_0x24790b;_0x24e2fc=0xc8;}else{_0x24e2fc=0xce;}_0x5d99dc[_0xdd2f('0x18')](_0x24e2fc);return _0x5d99dc[_0xdd2f('0x1e')](_0xdd2f('0x1f'),_0x521747+'-'+_0x581905+'/'+_0x24790b)['json'](_0x4de182);}return null;};}function patchUpdates(_0x1066fb){return function(_0x4992d8){try{jsonpatch[_0xdd2f('0x20')](_0x4992d8,_0x1066fb,!![]);}catch(_0x19eb9f){return BPromise['reject'](_0x19eb9f);}return _0x4992d8['save']();};}function saveUpdates(_0x31e470,_0x30be65){return function(_0x5bf912){if(_0x5bf912){return _0x5bf912[_0xdd2f('0x21')](_0x31e470)[_0xdd2f('0x22')](function(_0x3b350d){return _0x3b350d;});}return null;};}function removeEntity(_0x2db51a,_0x788678){return function(_0x2b736b){if(_0x2b736b){return _0x2b736b[_0xdd2f('0x23')]()['then'](function(){_0x2db51a[_0xdd2f('0x18')](0xcc)[_0xdd2f('0x19')]();});}};}function handleEntityNotFound(_0x460ca1,_0x554cd8){return function(_0xd6cf33){if(!_0xd6cf33){_0x460ca1['sendStatus'](0x194);}return _0xd6cf33;};}function handleError(_0x4b8c6b,_0x36e2ef){_0x36e2ef=_0x36e2ef||0x1f4;return function(_0x4607ac){logger[_0xdd2f('0x24')](_0x4607ac[_0xdd2f('0x25')]);if(_0x4607ac[_0xdd2f('0x26')]){delete _0x4607ac['name'];}_0x4b8c6b[_0xdd2f('0x18')](_0x36e2ef)[_0xdd2f('0x27')](_0x4607ac);};}exports[_0xdd2f('0x28')]=function(_0xfc4e8c,_0x35262d){var _0x5a8a63={},_0x307f5e={},_0x5a99dd={'count':0x0,'rows':[]};var _0x482bcc=_[_0xdd2f('0x29')](db[_0xdd2f('0x2a')][_0xdd2f('0x2b')],function(_0x3a0037){return{'name':_0x3a0037[_0xdd2f('0x2c')],'type':_0x3a0037[_0xdd2f('0x2d')][_0xdd2f('0x2e')]};});_0x307f5e[_0xdd2f('0x2f')]=_[_0xdd2f('0x29')](_0x482bcc,_0xdd2f('0x26'));_0x307f5e[_0xdd2f('0x30')]=_[_0xdd2f('0x31')](_0xfc4e8c[_0xdd2f('0x30')]);_0x307f5e[_0xdd2f('0x32')]=_[_0xdd2f('0x33')](_0x307f5e['model'],_0x307f5e['query']);_0x5a8a63['attributes']=_[_0xdd2f('0x33')](_0x307f5e[_0xdd2f('0x2f')],qs[_0xdd2f('0x34')](_0xfc4e8c[_0xdd2f('0x30')][_0xdd2f('0x34')]));_0x5a8a63['attributes']=_0x5a8a63[_0xdd2f('0x35')][_0xdd2f('0x36')]?_0x5a8a63[_0xdd2f('0x35')]:_0x307f5e[_0xdd2f('0x2f')];if(!_0xfc4e8c[_0xdd2f('0x30')][_0xdd2f('0x37')](_0xdd2f('0x38'))){_0x5a8a63[_0xdd2f('0x1d')]=qs['limit'](_0xfc4e8c[_0xdd2f('0x30')][_0xdd2f('0x1d')]);_0x5a8a63[_0xdd2f('0x1b')]=qs[_0xdd2f('0x1b')](_0xfc4e8c[_0xdd2f('0x30')][_0xdd2f('0x1b')]);}_0x5a8a63['order']=qs[_0xdd2f('0x39')](_0xfc4e8c[_0xdd2f('0x30')][_0xdd2f('0x39')]);_0x5a8a63[_0xdd2f('0x3a')]=qs['filters'](_['pick'](_0xfc4e8c[_0xdd2f('0x30')],_0x307f5e[_0xdd2f('0x32')]),_0x482bcc);if(_0xfc4e8c[_0xdd2f('0x30')][_0xdd2f('0x3b')]){_0x5a8a63[_0xdd2f('0x3a')]=_[_0xdd2f('0x3c')](_0x5a8a63[_0xdd2f('0x3a')],{'$or':_['map'](_0x482bcc,function(_0x10d0ff){if(_0x10d0ff[_0xdd2f('0x2d')]!=='VIRTUAL'){var _0x57b5aa={};_0x57b5aa[_0x10d0ff[_0xdd2f('0x26')]]={'$like':'%'+_0xfc4e8c[_0xdd2f('0x30')][_0xdd2f('0x3b')]+'%'};return _0x57b5aa;}})});}_0x5a8a63=_[_0xdd2f('0x3c')]({},_0x5a8a63,_0xfc4e8c[_0xdd2f('0x3d')]);var _0x3f4371={'where':_0x5a8a63[_0xdd2f('0x3a')]};return db[_0xdd2f('0x2a')][_0xdd2f('0x3e')](_0x3f4371)[_0xdd2f('0x22')](function(_0x5c6381){_0x5a99dd['count']=_0x5c6381;if(_0xfc4e8c[_0xdd2f('0x30')][_0xdd2f('0x3f')]){_0x5a8a63[_0xdd2f('0x40')]=[{'all':!![]}];}return db['Attachment'][_0xdd2f('0x41')](_0x5a8a63);})[_0xdd2f('0x22')](function(_0x6c681){_0x5a99dd[_0xdd2f('0x42')]=_0x6c681;return _0x5a99dd;})['then'](respondWithFilteredResult(_0x35262d,_0x5a8a63))[_0xdd2f('0x43')](handleError(_0x35262d,null));};exports[_0xdd2f('0x44')]=function(_0x499cd0,_0x3f188b){var _0x526d86={'raw':!![],'where':{'id':_0x499cd0[_0xdd2f('0x45')]['id']}},_0x2e1821={};_0x2e1821['model']=_[_0xdd2f('0x31')](db[_0xdd2f('0x2a')][_0xdd2f('0x2b')]);_0x2e1821[_0xdd2f('0x30')]=_['keys'](_0x499cd0[_0xdd2f('0x30')]);_0x2e1821[_0xdd2f('0x32')]=_['intersection'](_0x2e1821[_0xdd2f('0x2f')],_0x2e1821[_0xdd2f('0x30')]);_0x526d86[_0xdd2f('0x35')]=_[_0xdd2f('0x33')](_0x2e1821[_0xdd2f('0x2f')],qs[_0xdd2f('0x34')](_0x499cd0[_0xdd2f('0x30')][_0xdd2f('0x34')]));_0x526d86['attributes']=_0x526d86[_0xdd2f('0x35')]['length']?_0x526d86[_0xdd2f('0x35')]:_0x2e1821[_0xdd2f('0x2f')];if(_0x499cd0[_0xdd2f('0x30')]['includeAll']){_0x526d86['include']=[{'all':!![]}];}_0x526d86=_['merge']({},_0x526d86,_0x499cd0[_0xdd2f('0x3d')]);return db[_0xdd2f('0x2a')][_0xdd2f('0x46')](_0x526d86)[_0xdd2f('0x22')](handleEntityNotFound(_0x3f188b,null))[_0xdd2f('0x22')](respondWithResult(_0x3f188b,null))[_0xdd2f('0x43')](handleError(_0x3f188b,null));};exports[_0xdd2f('0x47')]=function(_0x4d91b1,_0x44b17a){var _0xb83f42={'where':{'id':_0x4d91b1[_0xdd2f('0x45')]['id']}},_0x2f79b4={};_0x2f79b4[_0xdd2f('0x2f')]=_[_0xdd2f('0x31')](db[_0xdd2f('0x2a')]['rawAttributes']);_0xb83f42['attributes']=_['intersection'](_0x2f79b4[_0xdd2f('0x2f')],qs[_0xdd2f('0x34')](_0x4d91b1[_0xdd2f('0x30')][_0xdd2f('0x34')]));_0xb83f42['attributes']=_0xb83f42[_0xdd2f('0x35')][_0xdd2f('0x36')]?_0xb83f42[_0xdd2f('0x35')]:_0x2f79b4['model'];if(_0x4d91b1[_0xdd2f('0x30')][_0xdd2f('0x3f')]){_0xb83f42[_0xdd2f('0x40')]=[{'all':!![]}];}_0xb83f42=_['merge']({},_0xb83f42,_0x4d91b1[_0xdd2f('0x3d')]);return db[_0xdd2f('0x2a')][_0xdd2f('0x46')](_0xb83f42)[_0xdd2f('0x22')](handleEntityNotFound(_0x44b17a,null))[_0xdd2f('0x22')](function(_0x2ce70c){if(_0x2ce70c){var _0x2d6b9d=_0x2ce70c[_0xdd2f('0x48')]({'plain':!![]});_0x2d6b9d=qs[_0xdd2f('0x49')](_0x2d6b9d,['id','createdAt','updatedAt']);_0x4d91b1[_0xdd2f('0x4a')]=_['omit'](_0x4d91b1[_0xdd2f('0x4a')],['id',_0xdd2f('0x4b'),_0xdd2f('0x4c')]);return db[_0xdd2f('0x2a')][_0xdd2f('0x4d')](_[_0xdd2f('0x3c')](_0x2d6b9d,_0x4d91b1['body']),{'include':_0x4d91b1[_0xdd2f('0x30')][_0xdd2f('0x3f')]?[{'all':!![]}]:undefined});}})[_0xdd2f('0x22')](respondWithResult(_0x44b17a,0xc9))['catch'](handleError(_0x44b17a,null));};exports[_0xdd2f('0x21')]=function(_0x2b7001,_0x55d53d){if(_0x2b7001[_0xdd2f('0x4a')]['id']){delete _0x2b7001[_0xdd2f('0x4a')]['id'];}return db[_0xdd2f('0x2a')][_0xdd2f('0x46')]({'where':{'id':_0x2b7001[_0xdd2f('0x45')]['id']}})[_0xdd2f('0x22')](handleEntityNotFound(_0x55d53d,null))['then'](saveUpdates(_0x2b7001[_0xdd2f('0x4a')],null))[_0xdd2f('0x22')](respondWithResult(_0x55d53d,null))[_0xdd2f('0x43')](handleError(_0x55d53d,null));};exports['destroy']=function(_0x2bb77d,_0x15771e){return db[_0xdd2f('0x2a')][_0xdd2f('0x46')]({'where':{'id':_0x2bb77d['params']['id']}})['then'](handleEntityNotFound(_0x15771e,null))[_0xdd2f('0x22')](removeEntity(_0x15771e,null))[_0xdd2f('0x43')](handleError(_0x15771e,null));};exports['create']=function(_0x445d7f,_0x28691a,_0x37795e){_0x445d7f['body'][_0xdd2f('0x26')]=_0x445d7f[_0xdd2f('0x4e')][_0xdd2f('0x4f')];_0x445d7f['body'][_0xdd2f('0x50')]=_0x445d7f['file'][_0xdd2f('0x51')];_0x445d7f[_0xdd2f('0x4a')][_0xdd2f('0x2d')]=_0x445d7f['file'][_0xdd2f('0x52')];return db['Attachment']['create'](_0x445d7f[_0xdd2f('0x4a')])[_0xdd2f('0x22')](respondWithResult(_0x28691a,0xc9))[_0xdd2f('0x43')](handleError(_0x28691a,null));};exports[_0xdd2f('0x53')]=function(_0x1200fb,_0x2431e5,_0x6ea29f){return db[_0xdd2f('0x2a')][_0xdd2f('0x54')]({'where':{'id':_0x1200fb[_0xdd2f('0x45')]['id']},'raw':!![]})[_0xdd2f('0x22')](handleEntityNotFound(_0x2431e5,null))[_0xdd2f('0x22')](function(_0x210763){if(_0x210763){var _0x1bda05=_0x210763['ChatOfflineMessageId']!==null;var _0x17d933=path[_0xdd2f('0x55')](config['root'],_0xdd2f('0x56'));if(_0x1bda05){_0x17d933=path[_0xdd2f('0x55')](_0x17d933,'offline-chat/');}var _0x1a2a3a=path[_0xdd2f('0x55')](_0x17d933,_0x210763[_0xdd2f('0x50')]);return _0x2431e5['download'](_0x1a2a3a);}})[_0xdd2f('0x43')](handleError(_0x2431e5,null));}; \ No newline at end of file +var _0xa90b=['json','undefined','limit','count','offset','set','Content-Range','apply','update','destroy','then','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','model','keys','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','clone','params','find','get','omit','body','updatedAt','create','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','server/files/attachments/','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa90b,0xf3));var _0xba90=function(_0x51b0dc,_0x5307b7){_0x51b0dc=_0x51b0dc-0x0;var _0x13fa89=_0xa90b[_0x51b0dc];return _0x13fa89;};'use strict';var emlformat=require(_0xba90('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xba90('0x1'));var jsonpatch=require(_0xba90('0x2'));var rp=require(_0xba90('0x3'));var moment=require('moment');var BPromise=require(_0xba90('0x4'));var Mustache=require(_0xba90('0x5'));var util=require(_0xba90('0x6'));var path=require('path');var sox=require(_0xba90('0x7'));var csv=require('to-csv');var ejs=require(_0xba90('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xba90('0x9'));var squel=require(_0xba90('0xa'));var crypto=require(_0xba90('0xb'));var jsforce=require(_0xba90('0xc'));var deskjs=require(_0xba90('0xd'));var toCsv=require(_0xba90('0xe'));var querystring=require(_0xba90('0xf'));var Papa=require('papaparse');var Redis=require(_0xba90('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xba90('0x11'));var as=require(_0xba90('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xba90('0x13'))(_0xba90('0x14'));var utils=require(_0xba90('0x15'));var config=require(_0xba90('0x16'));var licenseUtil=require(_0xba90('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19911e,_0x462a18){_0x462a18=_0x462a18||0xcc;return function(_0x4d54a3){if(_0x4d54a3){return _0x19911e[_0xba90('0x18')](_0x462a18);}return _0x19911e[_0xba90('0x19')](_0x462a18)[_0xba90('0x1a')]();};}function respondWithResult(_0x488d29,_0x1a921a){_0x1a921a=_0x1a921a||0xc8;return function(_0x25cbc1){if(_0x25cbc1){return _0x488d29[_0xba90('0x19')](_0x1a921a)[_0xba90('0x1b')](_0x25cbc1);}};}function respondWithFilteredResult(_0x820164,_0x348503){return function(_0x3bad0f){if(_0x3bad0f){var _0x4f16d2=typeof _0x348503['offset']===_0xba90('0x1c')&&typeof _0x348503[_0xba90('0x1d')]===_0xba90('0x1c');var _0xf1dc15=_0x3bad0f[_0xba90('0x1e')];var _0x427db4=_0x4f16d2?0x0:_0x348503[_0xba90('0x1f')];var _0x58c480=_0x4f16d2?_0x3bad0f['count']:_0x348503[_0xba90('0x1f')]+_0x348503[_0xba90('0x1d')];var _0x5b719f;if(_0x58c480>=_0xf1dc15){_0x58c480=_0xf1dc15;_0x5b719f=0xc8;}else{_0x5b719f=0xce;}_0x820164[_0xba90('0x19')](_0x5b719f);return _0x820164[_0xba90('0x20')](_0xba90('0x21'),_0x427db4+'-'+_0x58c480+'/'+_0xf1dc15)[_0xba90('0x1b')](_0x3bad0f);}return null;};}function patchUpdates(_0x424490){return function(_0x519681){try{jsonpatch[_0xba90('0x22')](_0x519681,_0x424490,!![]);}catch(_0x1c5d38){return BPromise['reject'](_0x1c5d38);}return _0x519681['save']();};}function saveUpdates(_0x1cb25c,_0x374a6d){return function(_0x12c5eb){if(_0x12c5eb){return _0x12c5eb[_0xba90('0x23')](_0x1cb25c)['then'](function(_0x283d05){return _0x283d05;});}return null;};}function removeEntity(_0x522d29,_0x1239b9){return function(_0x31dcec){if(_0x31dcec){return _0x31dcec[_0xba90('0x24')]()[_0xba90('0x25')](function(){_0x522d29[_0xba90('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f4b9c,_0x1f9350){return function(_0x165c55){if(!_0x165c55){_0x5f4b9c[_0xba90('0x18')](0x194);}return _0x165c55;};}function handleError(_0x2a9c5b,_0x193c72){_0x193c72=_0x193c72||0x1f4;return function(_0xc61dbb){logger[_0xba90('0x26')](_0xc61dbb[_0xba90('0x27')]);if(_0xc61dbb[_0xba90('0x28')]){delete _0xc61dbb[_0xba90('0x28')];}_0x2a9c5b['status'](_0x193c72)[_0xba90('0x29')](_0xc61dbb);};}exports[_0xba90('0x2a')]=function(_0x1c70f8,_0x1e6dfe){var _0x558d97={},_0x4ee152={},_0x52aada={'count':0x0,'rows':[]};var _0xc932f9=_[_0xba90('0x2b')](db[_0xba90('0x2c')][_0xba90('0x2d')],function(_0x8a7454){return{'name':_0x8a7454[_0xba90('0x2e')],'type':_0x8a7454[_0xba90('0x2f')]['key']};});_0x4ee152[_0xba90('0x30')]=_[_0xba90('0x2b')](_0xc932f9,_0xba90('0x28'));_0x4ee152['query']=_[_0xba90('0x31')](_0x1c70f8['query']);_0x4ee152[_0xba90('0x32')]=_[_0xba90('0x33')](_0x4ee152['model'],_0x4ee152['query']);_0x558d97['attributes']=_[_0xba90('0x33')](_0x4ee152[_0xba90('0x30')],qs[_0xba90('0x34')](_0x1c70f8[_0xba90('0x35')]['fields']));_0x558d97[_0xba90('0x36')]=_0x558d97[_0xba90('0x36')][_0xba90('0x37')]?_0x558d97[_0xba90('0x36')]:_0x4ee152[_0xba90('0x30')];if(!_0x1c70f8[_0xba90('0x35')][_0xba90('0x38')](_0xba90('0x39'))){_0x558d97[_0xba90('0x1d')]=qs['limit'](_0x1c70f8['query'][_0xba90('0x1d')]);_0x558d97[_0xba90('0x1f')]=qs['offset'](_0x1c70f8[_0xba90('0x35')][_0xba90('0x1f')]);}_0x558d97[_0xba90('0x3a')]=qs[_0xba90('0x3b')](_0x1c70f8[_0xba90('0x35')][_0xba90('0x3b')]);_0x558d97['where']=qs['filters'](_[_0xba90('0x3c')](_0x1c70f8[_0xba90('0x35')],_0x4ee152[_0xba90('0x32')]),_0xc932f9);if(_0x1c70f8[_0xba90('0x35')][_0xba90('0x3d')]){_0x558d97['where']=_[_0xba90('0x3e')](_0x558d97[_0xba90('0x3f')],{'$or':_[_0xba90('0x2b')](_0xc932f9,function(_0x3315af){if(_0x3315af['type']!==_0xba90('0x40')){var _0x327858={};_0x327858[_0x3315af['name']]={'$like':'%'+_0x1c70f8[_0xba90('0x35')][_0xba90('0x3d')]+'%'};return _0x327858;}})});}_0x558d97=_[_0xba90('0x3e')]({},_0x558d97,_0x1c70f8[_0xba90('0x41')]);var _0x20e8bf={'where':_0x558d97[_0xba90('0x3f')]};return db[_0xba90('0x2c')][_0xba90('0x1e')](_0x20e8bf)['then'](function(_0x3ee454){_0x52aada[_0xba90('0x1e')]=_0x3ee454;if(_0x1c70f8[_0xba90('0x35')]['includeAll']){_0x558d97[_0xba90('0x42')]=[{'all':!![]}];}return db[_0xba90('0x2c')][_0xba90('0x43')](_0x558d97);})[_0xba90('0x25')](function(_0x550f03){_0x52aada[_0xba90('0x44')]=_0x550f03;return _0x52aada;})[_0xba90('0x25')](respondWithFilteredResult(_0x1e6dfe,_0x558d97))[_0xba90('0x45')](handleError(_0x1e6dfe,null));};exports[_0xba90('0x46')]=function(_0x51feb7,_0x111831){var _0x1befdb={'raw':!![],'where':{'id':_0x51feb7['params']['id']}},_0x219c73={};_0x219c73[_0xba90('0x30')]=_[_0xba90('0x31')](db[_0xba90('0x2c')]['rawAttributes']);_0x219c73[_0xba90('0x35')]=_[_0xba90('0x31')](_0x51feb7[_0xba90('0x35')]);_0x219c73[_0xba90('0x32')]=_[_0xba90('0x33')](_0x219c73[_0xba90('0x30')],_0x219c73[_0xba90('0x35')]);_0x1befdb[_0xba90('0x36')]=_[_0xba90('0x33')](_0x219c73['model'],qs[_0xba90('0x34')](_0x51feb7['query']['fields']));_0x1befdb['attributes']=_0x1befdb['attributes']['length']?_0x1befdb[_0xba90('0x36')]:_0x219c73['model'];if(_0x51feb7[_0xba90('0x35')][_0xba90('0x47')]){_0x1befdb[_0xba90('0x42')]=[{'all':!![]}];}_0x1befdb=_[_0xba90('0x3e')]({},_0x1befdb,_0x51feb7[_0xba90('0x41')]);return db[_0xba90('0x2c')]['find'](_0x1befdb)[_0xba90('0x25')](handleEntityNotFound(_0x111831,null))[_0xba90('0x25')](respondWithResult(_0x111831,null))['catch'](handleError(_0x111831,null));};exports[_0xba90('0x48')]=function(_0x174f8c,_0x2cd497){var _0x515297={'where':{'id':_0x174f8c[_0xba90('0x49')]['id']}},_0x5a8dea={};_0x5a8dea['model']=_['keys'](db[_0xba90('0x2c')][_0xba90('0x2d')]);_0x515297[_0xba90('0x36')]=_['intersection'](_0x5a8dea[_0xba90('0x30')],qs[_0xba90('0x34')](_0x174f8c['query'][_0xba90('0x34')]));_0x515297[_0xba90('0x36')]=_0x515297[_0xba90('0x36')][_0xba90('0x37')]?_0x515297[_0xba90('0x36')]:_0x5a8dea['model'];if(_0x174f8c[_0xba90('0x35')][_0xba90('0x47')]){_0x515297[_0xba90('0x42')]=[{'all':!![]}];}_0x515297=_['merge']({},_0x515297,_0x174f8c['options']);return db['Attachment'][_0xba90('0x4a')](_0x515297)[_0xba90('0x25')](handleEntityNotFound(_0x2cd497,null))[_0xba90('0x25')](function(_0x5c33f1){if(_0x5c33f1){var _0x330b2d=_0x5c33f1[_0xba90('0x4b')]({'plain':!![]});_0x330b2d=qs[_0xba90('0x4c')](_0x330b2d,['id','createdAt','updatedAt']);_0x174f8c['body']=_[_0xba90('0x4c')](_0x174f8c[_0xba90('0x4d')],['id','createdAt',_0xba90('0x4e')]);return db[_0xba90('0x2c')][_0xba90('0x4f')](_[_0xba90('0x3e')](_0x330b2d,_0x174f8c[_0xba90('0x4d')]),{'include':_0x174f8c[_0xba90('0x35')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xba90('0x25')](respondWithResult(_0x2cd497,0xc9))[_0xba90('0x45')](handleError(_0x2cd497,null));};exports[_0xba90('0x23')]=function(_0x1a02ec,_0x44f457){if(_0x1a02ec[_0xba90('0x4d')]['id']){delete _0x1a02ec['body']['id'];}return db[_0xba90('0x2c')][_0xba90('0x4a')]({'where':{'id':_0x1a02ec[_0xba90('0x49')]['id']}})[_0xba90('0x25')](handleEntityNotFound(_0x44f457,null))['then'](saveUpdates(_0x1a02ec[_0xba90('0x4d')],null))[_0xba90('0x25')](respondWithResult(_0x44f457,null))[_0xba90('0x45')](handleError(_0x44f457,null));};exports[_0xba90('0x24')]=function(_0x133453,_0x81a3af){return db[_0xba90('0x2c')][_0xba90('0x4a')]({'where':{'id':_0x133453['params']['id']}})[_0xba90('0x25')](handleEntityNotFound(_0x81a3af,null))[_0xba90('0x25')](removeEntity(_0x81a3af,null))['catch'](handleError(_0x81a3af,null));};exports[_0xba90('0x4f')]=function(_0x2bfc81,_0x597066,_0x21d93a){_0x2bfc81[_0xba90('0x4d')][_0xba90('0x28')]=_0x2bfc81[_0xba90('0x50')][_0xba90('0x51')];_0x2bfc81[_0xba90('0x4d')][_0xba90('0x52')]=_0x2bfc81[_0xba90('0x50')][_0xba90('0x53')];_0x2bfc81[_0xba90('0x4d')][_0xba90('0x2f')]=_0x2bfc81[_0xba90('0x50')][_0xba90('0x54')];return db[_0xba90('0x2c')][_0xba90('0x4f')](_0x2bfc81[_0xba90('0x4d')])['then'](respondWithResult(_0x597066,0xc9))[_0xba90('0x45')](handleError(_0x597066,null));};exports[_0xba90('0x55')]=function(_0x2b4737,_0x3492e4,_0x493533){return db[_0xba90('0x2c')][_0xba90('0x56')]({'where':{'id':_0x2b4737[_0xba90('0x49')]['id']},'raw':!![]})[_0xba90('0x25')](handleEntityNotFound(_0x3492e4,null))[_0xba90('0x25')](function(_0x390b8a){if(_0x390b8a){var _0x1d82e5=_0x390b8a[_0xba90('0x57')]!==null;var _0xb18b3b=path[_0xba90('0x58')](config['root'],_0xba90('0x59'));if(_0x1d82e5){_0xb18b3b=path[_0xba90('0x58')](_0xb18b3b,'offline-chat/');}var _0x406c2f=path[_0xba90('0x58')](_0xb18b3b,_0x390b8a['basename']);return _0x3492e4['download'](_0x406c2f);}})[_0xba90('0x45')](handleError(_0x3492e4,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 75b338e..7403170 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 _0xed1a=['../../config/logger','api','moment','path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xed1a,0x6b));var _0xaed1=function(_0x4a8f91,_0x462fa6){_0x4a8f91=_0x4a8f91-0x0;var _0x445b73=_0xed1a[_0x4a8f91];return _0x445b73;};'use strict';var _=require(_0xaed1('0x0'));var util=require('util');var logger=require(_0xaed1('0x1'))(_0xaed1('0x2'));var moment=require(_0xaed1('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xaed1('0x4'));var rimraf=require(_0xaed1('0x5'));var config=require(_0xaed1('0x6'));var attributes=require(_0xaed1('0x7'));module[_0xaed1('0x8')]=function(_0x39da32,_0xe3fa64){return _0x39da32[_0xaed1('0x9')](_0xaed1('0xa'),attributes,{'tableName':_0xaed1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba7b=['Attachment','attachments','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','exports'];(function(_0x401234,_0xfd4275){var _0x12842c=function(_0x1286df){while(--_0x1286df){_0x401234['push'](_0x401234['shift']());}};_0x12842c(++_0xfd4275);}(_0xba7b,0x14c));var _0xbba7=function(_0xda3f7,_0x589235){_0xda3f7=_0xda3f7-0x0;var _0x308866=_0xba7b[_0xda3f7];return _0x308866;};'use strict';var _=require(_0xbba7('0x0'));var util=require(_0xbba7('0x1'));var logger=require(_0xbba7('0x2'))('api');var moment=require(_0xbba7('0x3'));var BPromise=require(_0xbba7('0x4'));var rp=require(_0xbba7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbba7('0x6'));var attributes=require('./attachment.attributes');module[_0xbba7('0x7')]=function(_0x16df83,_0x57706){return _0x16df83['define'](_0xbba7('0x8'),attributes,{'tableName':_0xbba7('0x9'),'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 8eb38bc..cf0cf2b 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 _0x80df=['catch','CreateAttachment','Attachment','create','options','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x5951e8,_0x42b9a7){var _0x20a1f5=function(_0x2bc968){while(--_0x2bc968){_0x5951e8['push'](_0x5951e8['shift']());}};_0x20a1f5(++_0x42b9a7);}(_0x80df,0x17e));var _0xf80d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x80df[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf80d('0x0'));var util=require(_0xf80d('0x1'));var moment=require(_0xf80d('0x2'));var BPromise=require(_0xf80d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf80d('0x4'));var db=require(_0xf80d('0x5'))['db'];var utils=require(_0xf80d('0x6'));var logger=require(_0xf80d('0x7'))(_0xf80d('0x8'));var config=require(_0xf80d('0x9'));var jayson=require(_0xf80d('0xa'));var client=jayson[_0xf80d('0xb')][_0xf80d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x62e50f,_0x5068d4,_0x30e2b3){return new BPromise(function(_0x16b219,_0x2f56b3){return client[_0xf80d('0xd')](_0x62e50f,_0x30e2b3)[_0xf80d('0xe')](function(_0x186339){logger[_0xf80d('0xf')](_0xf80d('0x10'),_0x5068d4,_0xf80d('0x11'));logger[_0xf80d('0x12')](_0xf80d('0x13'),_0x5068d4,_0xf80d('0x11'),JSON[_0xf80d('0x14')](_0x186339));if(_0x186339[_0xf80d('0x15')]){if(_0x186339['error']['code']===0x1f4){logger[_0xf80d('0x15')](_0xf80d('0x10'),_0x5068d4,_0x186339['error'][_0xf80d('0x16')]);return _0x2f56b3(_0x186339['error'][_0xf80d('0x16')]);}logger['error'](_0xf80d('0x10'),_0x5068d4,_0x186339['error'][_0xf80d('0x16')]);return _0x16b219(_0x186339[_0xf80d('0x15')][_0xf80d('0x16')]);}else{logger[_0xf80d('0xf')](_0xf80d('0x10'),_0x5068d4,_0xf80d('0x11'));_0x16b219(_0x186339[_0xf80d('0x17')][_0xf80d('0x16')]);}})[_0xf80d('0x18')](function(_0x3b8a82){logger[_0xf80d('0x15')](_0xf80d('0x10'),_0x5068d4,_0x3b8a82);_0x2f56b3(_0x3b8a82);});});}exports[_0xf80d('0x19')]=function(_0x1d104a){var _0x34b49d=this;return new Promise(function(_0x2ea2c1,_0x7ba89c){return db[_0xf80d('0x1a')][_0xf80d('0x1b')](_0x1d104a['body'],{'raw':_0x1d104a[_0xf80d('0x1c')]?_0x1d104a[_0xf80d('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xf80d('0xe')](function(_0x539c80){logger[_0xf80d('0xf')](_0xf80d('0x19'),_0x1d104a);logger[_0xf80d('0x12')](_0xf80d('0x19'),_0x1d104a,JSON[_0xf80d('0x14')](_0x539c80));_0x2ea2c1(_0x539c80);})[_0xf80d('0x18')](function(_0x446153){logger[_0xf80d('0x15')](_0xf80d('0x19'),_0x446153[_0xf80d('0x16')],_0x1d104a);_0x7ba89c(_0x34b49d[_0xf80d('0x15')](0x1f4,_0x446153[_0xf80d('0x16')]));});});}; \ No newline at end of file +var _0x5d70=['jayson/promise','client','http','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Attachment','create','body','options','raw','then','CreateAttachment','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x291f8b,_0x3b5591){var _0x275171=function(_0xb33d67){while(--_0xb33d67){_0x291f8b['push'](_0x291f8b['shift']());}};_0x275171(++_0x3b5591);}(_0x5d70,0x8d));var _0x05d7=function(_0x5a31bd,_0x4977f9){_0x5a31bd=_0x5a31bd-0x0;var _0x3dc4e8=_0x5d70[_0x5a31bd];return _0x3dc4e8;};'use strict';var _=require(_0x05d7('0x0'));var util=require(_0x05d7('0x1'));var moment=require('moment');var BPromise=require(_0x05d7('0x2'));var rs=require(_0x05d7('0x3'));var fs=require('fs');var Redis=require(_0x05d7('0x4'));var db=require(_0x05d7('0x5'))['db'];var utils=require(_0x05d7('0x6'));var logger=require(_0x05d7('0x7'))('rpc');var config=require(_0x05d7('0x8'));var jayson=require(_0x05d7('0x9'));var client=jayson[_0x05d7('0xa')][_0x05d7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b155c,_0x54d5be,_0x1e1254){return new BPromise(function(_0x29a5e0,_0x147340){return client['request'](_0x4b155c,_0x1e1254)['then'](function(_0x1cc0a3){logger[_0x05d7('0xc')](_0x05d7('0xd'),_0x54d5be,_0x05d7('0xe'));logger[_0x05d7('0xf')](_0x05d7('0x10'),_0x54d5be,_0x05d7('0xe'),JSON[_0x05d7('0x11')](_0x1cc0a3));if(_0x1cc0a3[_0x05d7('0x12')]){if(_0x1cc0a3[_0x05d7('0x12')][_0x05d7('0x13')]===0x1f4){logger[_0x05d7('0x12')](_0x05d7('0xd'),_0x54d5be,_0x1cc0a3[_0x05d7('0x12')][_0x05d7('0x14')]);return _0x147340(_0x1cc0a3[_0x05d7('0x12')][_0x05d7('0x14')]);}logger[_0x05d7('0x12')](_0x05d7('0xd'),_0x54d5be,_0x1cc0a3[_0x05d7('0x12')][_0x05d7('0x14')]);return _0x29a5e0(_0x1cc0a3[_0x05d7('0x12')][_0x05d7('0x14')]);}else{logger['info'](_0x05d7('0xd'),_0x54d5be,'request\x20sent');_0x29a5e0(_0x1cc0a3[_0x05d7('0x15')][_0x05d7('0x14')]);}})['catch'](function(_0x559545){logger['error']('Attachment,\x20%s,\x20%s',_0x54d5be,_0x559545);_0x147340(_0x559545);});});}exports['CreateAttachment']=function(_0x3e364b){var _0x9e84b2=this;return new Promise(function(_0x292d48,_0x248d88){return db[_0x05d7('0x16')][_0x05d7('0x17')](_0x3e364b[_0x05d7('0x18')],{'raw':_0x3e364b[_0x05d7('0x19')]?_0x3e364b[_0x05d7('0x19')][_0x05d7('0x1a')]===undefined?!![]:![]:!![]})[_0x05d7('0x1b')](function(_0x31199b){logger['info'](_0x05d7('0x1c'),_0x3e364b);logger['debug']('CreateAttachment',_0x3e364b,JSON[_0x05d7('0x11')](_0x31199b));_0x292d48(_0x31199b);})[_0x05d7('0x1d')](function(_0xd1e51b){logger[_0x05d7('0x12')](_0x05d7('0x1c'),_0xd1e51b[_0x05d7('0x14')],_0x3e364b);_0x248d88(_0x9e84b2[_0x05d7('0x12')](0x1f4,_0xd1e51b[_0x05d7('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 0aa459e..5e57b7c 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x113aeb,_0x215442){var _0xc0a75f=function(_0x4bbc76){while(--_0x4bbc76){_0x113aeb['push'](_0x113aeb['shift']());}};_0xc0a75f(++_0x215442);}(_0xb10b,0x12a));var _0xbb10=function(_0x163691,_0x3d10c4){_0x163691=_0x163691-0x0;var _0x543ae5=_0xb10b[_0x163691];return _0x543ae5;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file +var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x37a66e,_0x1a169f){var _0x1a3329=function(_0x3d657b){while(--_0x3d657b){_0x37a66e['push'](_0x37a66e['shift']());}};_0x1a3329(++_0x1a169f);}(_0xadb5,0xad));var _0x5adb=function(_0x13de80,_0x51d47f){_0x13de80=_0x13de80-0x0;var _0x14138e=_0xadb5[_0x13de80];return _0x14138e;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index ddbee83..b23dfe5 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 _0x9daf=['authenticate','google','/login','profile','email','callback','use','secret','findOne','allowedLoginAttempts','blockDuration','then','find','emails','value','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','Strategy','moment','../../mysqldb','../../components/auth/service','signToken','../../config/utils','login'];(function(_0x2938b9,_0x52e916){var _0x20b12a=function(_0x11c439){while(--_0x11c439){_0x2938b9['push'](_0x2938b9['shift']());}};_0x20b12a(++_0x52e916);}(_0x9daf,0x16d));var _0xf9da=function(_0xaa7629,_0x219723){_0xaa7629=_0xaa7629-0x0;var _0x487c07=_0x9daf[_0xaa7629];return _0x487c07;};'use strict';var _=require(_0xf9da('0x0'));var passport=require(_0xf9da('0x1'));var GoogleStrategy=require('passport-google-oauth20')[_0xf9da('0x2')];var moment=require(_0xf9da('0x3'));var db=require(_0xf9da('0x4'))['db'];var config=require('../../config/environment');var signToken=require(_0xf9da('0x5'))[_0xf9da('0x6')];var utils=require(_0xf9da('0x7'));exports[_0xf9da('0x8')]=passport[_0xf9da('0x9')](_0xf9da('0xa'),{'failureRedirect':_0xf9da('0xb'),'scope':[_0xf9da('0xc'),_0xf9da('0xd')],'session':![]});exports[_0xf9da('0xe')]=passport[_0xf9da('0x9')](_0xf9da('0xa'),{'failureRedirect':_0xf9da('0xb'),'session':![]});passport[_0xf9da('0xf')](new GoogleStrategy({'clientID':config[_0xf9da('0xa')]?config[_0xf9da('0xa')]['clientID']:'id','clientSecret':config['google']?config[_0xf9da('0xa')]['clientSecret']:_0xf9da('0x10'),'callbackURL':config[_0xf9da('0xa')]?config[_0xf9da('0xa')]['callbackURL']:''},function(_0x5925e8,_0x5f5b0f,_0x5a843b,_0x250a01){var _0x396adf,_0x32fabb;return db['Setting'][_0xf9da('0x11')]({'where':{'id':0x1},'attributes':[_0xf9da('0x12'),_0xf9da('0x13')],'raw':!![]})[_0xf9da('0x14')](function(_0x205a0a){_0x396adf=_0x205a0a;return db['User'][_0xf9da('0x15')]({'where':{'email':_['map'](_0x5a843b[_0xf9da('0x16')],_0xf9da('0x17')),'role':{'$or':[_0xf9da('0x18'),_0xf9da('0x19'),_0xf9da('0x1a')]}}});})['then'](function(_0x187cc3){_0x32fabb=_0x187cc3;if(_0x32fabb){if(_0x32fabb[_0xf9da('0x1b')]){return _0x250a01(_0xf9da('0x1c'));}else if(_0x396adf['blockDuration']>0x0){if(_0x32fabb['blocked']){if(moment(_0x32fabb['blockedAt'])[_0xf9da('0x1d')](_0x396adf[_0xf9da('0x13')],_0xf9da('0x1e'))>moment()){return _0x250a01(_0xf9da('0x1c'));}else{return utils[_0xf9da('0x1f')](_0x32fabb,0x0,![],null)['then'](function(){return utils[_0xf9da('0x20')](_0x32fabb);})['then'](function(){return _0x250a01(null,_0x32fabb);});}}else{return utils['getLicense'](_0x32fabb)[_0xf9da('0x14')](function(){return _0x250a01(null,_0x32fabb);});}}else{return utils[_0xf9da('0x20')](_0x32fabb)[_0xf9da('0x14')](function(){return _0x250a01(null,_0x32fabb);});}}return _0x250a01(_0xf9da('0x1c'));})[_0xf9da('0x21')](function(_0x47d605){_0x250a01(_0x47d605);});})); \ No newline at end of file +var _0xd961=['admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','blockDuration','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../config/environment','../../components/auth/service','signToken','../../config/utils','google','/login','profile','email','use','secret','callbackURL','Setting','findOne','allowedLoginAttempts','then','User','find','map','emails','value'];(function(_0x5d7726,_0x57adac){var _0x521e1c=function(_0x3799a1){while(--_0x3799a1){_0x5d7726['push'](_0x5d7726['shift']());}};_0x521e1c(++_0x57adac);}(_0xd961,0x174));var _0x1d96=function(_0x4c3904,_0x56db61){_0x4c3904=_0x4c3904-0x0;var _0x44fd48=_0xd961[_0x4c3904];return _0x44fd48;};'use strict';var _=require(_0x1d96('0x0'));var passport=require(_0x1d96('0x1'));var GoogleStrategy=require(_0x1d96('0x2'))['Strategy'];var moment=require(_0x1d96('0x3'));var db=require('../../mysqldb')['db'];var config=require(_0x1d96('0x4'));var signToken=require(_0x1d96('0x5'))[_0x1d96('0x6')];var utils=require(_0x1d96('0x7'));exports['login']=passport['authenticate'](_0x1d96('0x8'),{'failureRedirect':_0x1d96('0x9'),'scope':[_0x1d96('0xa'),_0x1d96('0xb')],'session':![]});exports['callback']=passport['authenticate'](_0x1d96('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x1d96('0xc')](new GoogleStrategy({'clientID':config['google']?config[_0x1d96('0x8')]['clientID']:'id','clientSecret':config['google']?config[_0x1d96('0x8')]['clientSecret']:_0x1d96('0xd'),'callbackURL':config[_0x1d96('0x8')]?config['google'][_0x1d96('0xe')]:''},function(_0x2c427a,_0x45d39f,_0x48c593,_0x3535b4){var _0x4e7eae,_0x45783b;return db[_0x1d96('0xf')][_0x1d96('0x10')]({'where':{'id':0x1},'attributes':[_0x1d96('0x11'),'blockDuration'],'raw':!![]})[_0x1d96('0x12')](function(_0x33dc13){_0x4e7eae=_0x33dc13;return db[_0x1d96('0x13')][_0x1d96('0x14')]({'where':{'email':_[_0x1d96('0x15')](_0x48c593[_0x1d96('0x16')],_0x1d96('0x17')),'role':{'$or':[_0x1d96('0x18'),_0x1d96('0x19'),_0x1d96('0x1a')]}}});})[_0x1d96('0x12')](function(_0x40344f){_0x45783b=_0x40344f;if(_0x45783b){if(_0x45783b[_0x1d96('0x1b')]){return _0x3535b4(_0x1d96('0x1c'));}else if(_0x4e7eae['blockDuration']>0x0){if(_0x45783b[_0x1d96('0x1d')]){if(moment(_0x45783b[_0x1d96('0x1e')])[_0x1d96('0x1f')](_0x4e7eae[_0x1d96('0x20')],'minutes')>moment()){return _0x3535b4(_0x1d96('0x1c'));}else{return utils[_0x1d96('0x21')](_0x45783b,0x0,![],null)[_0x1d96('0x12')](function(){return utils[_0x1d96('0x22')](_0x45783b);})[_0x1d96('0x12')](function(){return _0x3535b4(null,_0x45783b);});}}else{return utils[_0x1d96('0x22')](_0x45783b)['then'](function(){return _0x3535b4(null,_0x45783b);});}}else{return utils[_0x1d96('0x22')](_0x45783b)['then'](function(){return _0x3535b4(null,_0x45783b);});}}return _0x3535b4(_0x1d96('0x1c'));})[_0x1d96('0x23')](function(_0xd96368){_0x3535b4(_0xd96368);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index b25af48..54dfe59 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 _0x7649=['get','/callback','callback','isMiddleware','setTokenCookie','exports','express','Router','./authGoogle.controller','../../components/auth/service','login'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x7649,0x1df));var _0x9764=function(_0x522d1f,_0x9246e2){_0x522d1f=_0x522d1f-0x0;var _0x2d652d=_0x7649[_0x522d1f];return _0x2d652d;};'use strict';var express=require(_0x9764('0x0'));var passport=require('passport');var router=express[_0x9764('0x1')]();var controller=require(_0x9764('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0x9764('0x3'));router['get']('/',controller[_0x9764('0x4')]);router[_0x9764('0x5')](_0x9764('0x6'),controller[_0x9764('0x7')],authService[_0x9764('0x8')],userController[_0x9764('0x4')],authService[_0x9764('0x9')]);module[_0x9764('0xa')]=router; \ No newline at end of file +var _0xb539=['get','/callback','callback','isMiddleware','login','setTokenCookie','exports','express','passport','../user/user.controller.js','../../components/auth/service'];(function(_0x5570ac,_0x44b319){var _0x83ebc4=function(_0x512c4c){while(--_0x512c4c){_0x5570ac['push'](_0x5570ac['shift']());}};_0x83ebc4(++_0x44b319);}(_0xb539,0x8b));var _0x9b53=function(_0x412ed6,_0x5ac827){_0x412ed6=_0x412ed6-0x0;var _0x3883d2=_0xb539[_0x412ed6];return _0x3883d2;};'use strict';var express=require(_0x9b53('0x0'));var passport=require(_0x9b53('0x1'));var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require(_0x9b53('0x2'));var authService=require(_0x9b53('0x3'));router['get']('/',controller['login']);router[_0x9b53('0x4')](_0x9b53('0x5'),controller[_0x9b53('0x6')],authService[_0x9b53('0x7')],userController[_0x9b53('0x8')],authService[_0x9b53('0x9')]);module[_0x9b53('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 65d0e96..f4fffe2 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 _0x2ec8=['MailAccount','find','MailServerOut','Smtp','service','host','port','secure','authentication','auth','user','pass','merge','format','\x22%s\x22\x20<%s>','email','request','SendMail','error','message','stringify','status','send','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','Setting','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport','passport-local','Strategy','lodash','../../mysqldb','../../config/utils','client','findOne','allowedLoginAttempts','then','name','password','role','disabled','blocked','loginAttempts','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockDuration','blockedAt','add','clearBlockUser','minutes','getLicense','catch'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x2ec8,0x188));var _0x82ec=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x2ec8[_0xbca1b1];return _0x4e1686;};'use strict';var util=require(_0x82ec('0x0'));var passport=require(_0x82ec('0x1'));var LocalStrategy=require(_0x82ec('0x2'))[_0x82ec('0x3')];var jayson=require('jayson/promise');var _=require(_0x82ec('0x4'));var rs=require('randomstring');var moment=require('moment');var db=require(_0x82ec('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x82ec('0x6'));var client=jayson[_0x82ec('0x7')]['http']({'port':0x232b});function localAuthenticate(_0x4c9400,_0x5c786a,_0x527476,_0x3af0cf){var _0x3ceabc,_0x4dd14f;return db['Setting'][_0x82ec('0x8')]({'where':{'id':0x1},'attributes':[_0x82ec('0x9'),'blockDuration'],'raw':!![]})[_0x82ec('0xa')](function(_0xf1ab6c){_0x3ceabc=_0xf1ab6c;return _0x4c9400[_0x82ec('0x8')]({'attributes':['id',_0x82ec('0xb'),_0x82ec('0xc'),'salt',_0x82ec('0xd'),_0x82ec('0xe'),_0x82ec('0xf'),'blockedAt',_0x82ec('0x10')],'where':{'name':_0x5c786a,'role':{'$or':[_0x82ec('0x11'),'user',_0x82ec('0x12')]}}});})['then'](function(_0x2a57c2){if(!_0x2a57c2||_0x2a57c2&&_0x2a57c2[_0x82ec('0xb')]!==_0x5c786a){throw new Error(_0x82ec('0x13'));}else{_0x4dd14f=_0x2a57c2;return _0x4dd14f;}})['then'](function(){_0x4dd14f[_0x82ec('0x14')](_0x527476,function(_0x58c4d5,_0x1f0b2c){var _0x4ce834=_0x4dd14f['loginAttempts']+0x1;if(_0x58c4d5){return _0x3af0cf(_0x58c4d5);}else if(!_0x1f0b2c){if(_0x4dd14f['disabled']){return _0x3af0cf(null,![],{'message':_0x82ec('0x13')});}else if(_0x3ceabc[_0x82ec('0x9')]>0x0){if(_0x4dd14f[_0x82ec('0xf')]){if(_0x3ceabc[_0x82ec('0x15')]>0x0){if(moment(_0x4dd14f[_0x82ec('0x16')])[_0x82ec('0x17')](_0x3ceabc[_0x82ec('0x15')],'minutes')>moment()){return _0x3af0cf(null,![],{'message':_0x82ec('0x13')});}else{return utils[_0x82ec('0x18')](_0x4dd14f,_0x4ce834,![],null)['then'](function(){return _0x3af0cf(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x3af0cf(null,![],{'message':_0x82ec('0x13')});}}else{if(_0x4ce834>=_0x3ceabc[_0x82ec('0x9')]){return utils['clearBlockUser'](_0x4dd14f,0x0,!![],moment())[_0x82ec('0xa')](function(){return _0x3af0cf(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x82ec('0x18')](_0x4dd14f,_0x4ce834,![],null)['then'](function(){return _0x3af0cf(null,![],{'message':_0x82ec('0x13')});});}}}else{return _0x3af0cf(null,![],{'message':_0x82ec('0x13')});}}else{if(_0x4dd14f[_0x82ec('0xe')]){return _0x3af0cf(null,![],{'message':_0x82ec('0x13')});}else if(_0x3ceabc[_0x82ec('0x9')]>0x0){if(_0x4dd14f[_0x82ec('0xf')]){if(_0x3ceabc[_0x82ec('0x15')]>0x0){if(moment(_0x4dd14f['blockedAt'])[_0x82ec('0x17')](_0x3ceabc['blockDuration'],_0x82ec('0x19'))>moment()){return _0x3af0cf(null,![],{'message':_0x82ec('0x13')});}else{return utils[_0x82ec('0x18')](_0x4dd14f,0x0,![],null)[_0x82ec('0xa')](function(){return utils[_0x82ec('0x1a')](_0x4dd14f);})['then'](function(){return _0x3af0cf(null,_0x4dd14f);});}}else{return _0x3af0cf(null,![],{'message':_0x82ec('0x13')});}}else{return utils[_0x82ec('0x18')](_0x4dd14f,0x0,![],null)[_0x82ec('0xa')](function(){return utils[_0x82ec('0x1a')](_0x4dd14f);})['then'](function(){return _0x3af0cf(null,_0x4dd14f);})[_0x82ec('0x1b')](function(_0x533a2e){return _0x3af0cf(null,![],_0x533a2e);});}}else{if(_0x4dd14f[_0x82ec('0xf')]){return _0x3af0cf(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x82ec('0x1a')](_0x4dd14f)[_0x82ec('0xa')](function(){return _0x3af0cf(null,_0x4dd14f);});}}}});})[_0x82ec('0x1b')](function(_0x96d96a){return _0x3af0cf(null,![],_0x96d96a);});}function sendServiceMail(_0x2fe135){return db[_0x82ec('0x1c')][_0x82ec('0x1d')]({'where':{'service':!![]},'attributes':['id',_0x82ec('0xb'),'email'],'include':[{'model':db[_0x82ec('0x1e')],'as':_0x82ec('0x1f')}]})[_0x82ec('0xa')](function(_0x278016){if(!_0x278016){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x35b4f3={'tls':{'rejectUnauthorized':![]}};if(_0x278016[_0x82ec('0x1f')]['service']){_0x35b4f3[_0x82ec('0x20')]=_0x278016[_0x82ec('0x1f')][_0x82ec('0x20')];}else{_0x35b4f3[_0x82ec('0x21')]=_0x278016[_0x82ec('0x1f')]['host'];_0x35b4f3[_0x82ec('0x22')]=_0x278016[_0x82ec('0x1f')]['port'];_0x35b4f3[_0x82ec('0x23')]=_0x278016[_0x82ec('0x1f')][_0x82ec('0x23')];}if(_0x278016['Smtp'][_0x82ec('0x24')]){_0x35b4f3[_0x82ec('0x25')]={'user':_0x278016['Smtp'][_0x82ec('0x26')],'pass':_0x278016[_0x82ec('0x1f')][_0x82ec('0x27')]};}var _0x5ac03a={'account':_0x35b4f3,'message':_[_0x82ec('0x28')]({'from':util[_0x82ec('0x29')](_0x82ec('0x2a'),_0x278016[_0x82ec('0xb')],_0x278016[_0x82ec('0x2b')]||_0x278016['Smtp'][_0x82ec('0x26')])},_0x2fe135)};return client[_0x82ec('0x2c')](_0x82ec('0x2d'),_0x5ac03a);})[_0x82ec('0xa')](function(_0x88e244){if(_0x88e244[_0x82ec('0x2e')]){throw new Error(util[_0x82ec('0x29')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x88e244[_0x82ec('0x2e')][_0x82ec('0x2f')]||JSON[_0x82ec('0x30')](_0x88e244[_0x82ec('0x2e')])));}return!![];});}function handleError(_0x3bf738,_0x14563d,_0x41d47c){return _0x3bf738[_0x82ec('0x31')](_0x14563d||0x1f4)[_0x82ec('0x32')]({'message':_0x41d47c?_0x41d47c[_0x82ec('0x2f')]||_0x41d47c:''});}exports['login']=function(_0x4d89ba,_0x4ab41a,_0x1300f2){passport[_0x82ec('0x14')]('local',function(_0x2e3f7e,_0x1ee571,_0x16d509){var _0x80a185=_0x2e3f7e||_0x16d509;if(_0x80a185){return handleError(_0x4ab41a,0x191,_0x80a185);}if(!_0x1ee571){return handleError(_0x4ab41a,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x1c6208={'payload':{'id':_0x1ee571['id'],'role':_0x1ee571[_0x82ec('0xd')]},'options':{'expiresIn':0x15180}};return authService[_0x82ec('0x33')](_0x1c6208)[_0x82ec('0xa')](function(_0x151958){_0x4ab41a[_0x82ec('0x34')]({'id':_0x1ee571['id'],'token':_0x151958,'statusCall':'','isAlreadyLogged':_0x1ee571[_0x82ec('0x35')]});});}})(_0x4d89ba,_0x4ab41a,_0x1300f2);};exports[_0x82ec('0x36')]=function(_0x25c515,_0x2d22d9,_0x434645){if(!_0x25c515[_0x82ec('0x37')][_0x82ec('0x2b')]){return handleError(_0x2d22d9,0x1f4,{'message':_0x82ec('0x38')});}var _0x4cad21=rs[_0x82ec('0x39')]();_0x25c515[_0x82ec('0x37')]['email']=_0x25c515['body']['email'][_0x82ec('0x3a')]()['toLowerCase']();var _0x2017e7;return db[_0x82ec('0x3b')][_0x82ec('0x8')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x82ec('0x15')],'raw':!![]})[_0x82ec('0xa')](function(_0x28d803){_0x2017e7=_0x28d803;return db[_0x82ec('0x3c')][_0x82ec('0x1d')]({'where':{'email':_0x25c515[_0x82ec('0x37')][_0x82ec('0x2b')]}});})[_0x82ec('0xa')](function(_0x4a3712){if(!_0x4a3712){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x4a3712['disabled']){throw new Error(_0x82ec('0x3d'));}if(_0x4a3712[_0x82ec('0xf')]){if(moment(_0x4a3712[_0x82ec('0x16')])[_0x82ec('0x17')](_0x2017e7[_0x82ec('0x15')],_0x82ec('0x19'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x4a3712[_0x82ec('0xf')]=![];_0x4a3712[_0x82ec('0x16')]=null;}}_0x4a3712[_0x82ec('0x3e')]=_0x4cad21;_0x4a3712[_0x82ec('0x3f')]=Date[_0x82ec('0x40')]()+0x36ee80;return _0x4a3712[_0x82ec('0x41')]();})[_0x82ec('0xa')](function(){return sendServiceMail({'to':_0x25c515['body'][_0x82ec('0x2b')],'subject':_0x82ec('0x42'),'text':_0x82ec('0x43')+_0x82ec('0x44')+_0x82ec('0x45')+_0x25c515[_0x82ec('0x46')][_0x82ec('0x21')]+'/reset/'+_0x4cad21+'\x0a\x0a'+_0x82ec('0x47')});})[_0x82ec('0xa')](function(){_0x2d22d9[_0x82ec('0x31')](0xc8)[_0x82ec('0x32')]({'message':_0x82ec('0x48')});})[_0x82ec('0x1b')](function(_0x4a9901){return handleError(_0x2d22d9,0x1f4,_0x4a9901);});};exports[_0x82ec('0x49')]=function(_0x1b707f,_0x3ac2d3,_0x3c6f7b){return db[_0x82ec('0x3c')][_0x82ec('0x1d')]({'where':{'resetPasswordToken':_0x1b707f[_0x82ec('0x4a')]['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x1c6964){if(!_0x1c6964){throw new Error(_0x82ec('0x4b'));}return db['Setting']['findOne']({'attributes':['id',_0x82ec('0x4c'),_0x82ec('0x4d'),_0x82ec('0x4e')]})[_0x82ec('0xa')](function(_0x4c13f5){if(_0x4c13f5[_0x82ec('0x4c')])authService[_0x82ec('0x4f')](_0x1b707f[_0x82ec('0x37')][_0x82ec('0xc')]);if(!_0x4c13f5['enforcePasswordHistory']||!_0x1c6964[_0x82ec('0x50')])return _0x1c6964;authService[_0x82ec('0x51')](_0x1b707f['body'][_0x82ec('0xc')],_0x1c6964['previousPasswords'],_0x4c13f5['passwordHistoryLimit']);return _0x1c6964;})['then'](function(){_0x1c6964[_0x82ec('0xc')]=_0x1b707f[_0x82ec('0x37')][_0x82ec('0xc')];_0x1c6964[_0x82ec('0x3e')]=null;_0x1c6964[_0x82ec('0x3f')]=null;return _0x1c6964[_0x82ec('0x41')]();});})[_0x82ec('0xa')](function(){_0x3ac2d3[_0x82ec('0x31')](0xc8)[_0x82ec('0x32')]({'message':_0x82ec('0x52')});})[_0x82ec('0x1b')](function(_0x5efd84){return handleError(_0x3ac2d3,0x1f4,_0x5efd84);});};passport[_0x82ec('0x53')](new LocalStrategy({'usernameField':_0x82ec('0xb'),'passwordField':_0x82ec('0xc')},function(_0x18afe4,_0x32d3ab,_0x18df3b){return localAuthenticate(db[_0x82ec('0x3c')],_0x18afe4,_0x32d3ab,_0x18df3b);})); \ No newline at end of file +var _0x453b=['now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset','token','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','Password\x20reset!','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','findOne','blockDuration','then','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','name','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','add','clearBlockUser','minutes','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','secure','authentication','auth','merge','request','SendMail','error','message','stringify','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires'];(function(_0x410e4e,_0x54f0ad){var _0x13e214=function(_0x11528a){while(--_0x11528a){_0x410e4e['push'](_0x410e4e['shift']());}};_0x13e214(++_0x54f0ad);}(_0x453b,0x164));var _0xb453=function(_0x3cb86b,_0x3c75f6){_0x3cb86b=_0x3cb86b-0x0;var _0x3c10a0=_0x453b[_0x3cb86b];return _0x3c10a0;};'use strict';var util=require(_0xb453('0x0'));var passport=require(_0xb453('0x1'));var LocalStrategy=require(_0xb453('0x2'))[_0xb453('0x3')];var jayson=require(_0xb453('0x4'));var _=require(_0xb453('0x5'));var rs=require(_0xb453('0x6'));var moment=require(_0xb453('0x7'));var db=require(_0xb453('0x8'))['db'];var authService=require(_0xb453('0x9'));var utils=require(_0xb453('0xa'));var client=jayson[_0xb453('0xb')][_0xb453('0xc')]({'port':0x232b});function localAuthenticate(_0x4d7c1e,_0x1ab841,_0x2436a7,_0x4fdd93){var _0x12c490,_0x3486a8;return db['Setting'][_0xb453('0xd')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xb453('0xe')],'raw':!![]})[_0xb453('0xf')](function(_0x446cd3){_0x12c490=_0x446cd3;return _0x4d7c1e[_0xb453('0xd')]({'attributes':['id','name',_0xb453('0x10'),_0xb453('0x11'),_0xb453('0x12'),_0xb453('0x13'),_0xb453('0x14'),_0xb453('0x15'),_0xb453('0x16')],'where':{'name':_0x1ab841,'role':{'$or':[_0xb453('0x17'),_0xb453('0x18'),'agent']}}});})['then'](function(_0x4e930c){if(!_0x4e930c||_0x4e930c&&_0x4e930c[_0xb453('0x19')]!==_0x1ab841){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x3486a8=_0x4e930c;return _0x3486a8;}})[_0xb453('0xf')](function(){_0x3486a8[_0xb453('0x1a')](_0x2436a7,function(_0x1cb023,_0x4b3d05){var _0x5ee747=_0x3486a8[_0xb453('0x16')]+0x1;if(_0x1cb023){return _0x4fdd93(_0x1cb023);}else if(!_0x4b3d05){if(_0x3486a8[_0xb453('0x13')]){return _0x4fdd93(null,![],{'message':_0xb453('0x1b')});}else if(_0x12c490[_0xb453('0x1c')]>0x0){if(_0x3486a8[_0xb453('0x14')]){if(_0x12c490[_0xb453('0xe')]>0x0){if(moment(_0x3486a8[_0xb453('0x15')])[_0xb453('0x1d')](_0x12c490[_0xb453('0xe')],'minutes')>moment()){return _0x4fdd93(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x3486a8,_0x5ee747,![],null)['then'](function(){return _0x4fdd93(null,![],{'message':_0xb453('0x1b')});});}}else{return _0x4fdd93(null,![],{'message':_0xb453('0x1b')});}}else{if(_0x5ee747>=_0x12c490[_0xb453('0x1c')]){return utils[_0xb453('0x1e')](_0x3486a8,0x0,!![],moment())[_0xb453('0xf')](function(){return _0x4fdd93(null,![],{'message':_0xb453('0x1b')});});}else{return utils['clearBlockUser'](_0x3486a8,_0x5ee747,![],null)['then'](function(){return _0x4fdd93(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x4fdd93(null,![],{'message':_0xb453('0x1b')});}}else{if(_0x3486a8['disabled']){return _0x4fdd93(null,![],{'message':_0xb453('0x1b')});}else if(_0x12c490[_0xb453('0x1c')]>0x0){if(_0x3486a8[_0xb453('0x14')]){if(_0x12c490[_0xb453('0xe')]>0x0){if(moment(_0x3486a8[_0xb453('0x15')])[_0xb453('0x1d')](_0x12c490[_0xb453('0xe')],_0xb453('0x1f'))>moment()){return _0x4fdd93(null,![],{'message':_0xb453('0x1b')});}else{return utils['clearBlockUser'](_0x3486a8,0x0,![],null)[_0xb453('0xf')](function(){return utils[_0xb453('0x20')](_0x3486a8);})[_0xb453('0xf')](function(){return _0x4fdd93(null,_0x3486a8);});}}else{return _0x4fdd93(null,![],{'message':_0xb453('0x1b')});}}else{return utils[_0xb453('0x1e')](_0x3486a8,0x0,![],null)[_0xb453('0xf')](function(){return utils[_0xb453('0x20')](_0x3486a8);})[_0xb453('0xf')](function(){return _0x4fdd93(null,_0x3486a8);})[_0xb453('0x21')](function(_0x1e65cc){return _0x4fdd93(null,![],_0x1e65cc);});}}else{if(_0x3486a8[_0xb453('0x14')]){return _0x4fdd93(null,![],{'message':_0xb453('0x1b')});}else{return utils[_0xb453('0x20')](_0x3486a8)['then'](function(){return _0x4fdd93(null,_0x3486a8);});}}}});})[_0xb453('0x21')](function(_0x170809){return _0x4fdd93(null,![],_0x170809);});}function sendServiceMail(_0x9da2f4){return db[_0xb453('0x22')][_0xb453('0x23')]({'where':{'service':!![]},'attributes':['id',_0xb453('0x19'),_0xb453('0x24')],'include':[{'model':db[_0xb453('0x25')],'as':_0xb453('0x26')}]})['then'](function(_0x3e7418){if(!_0x3e7418){throw new Error(_0xb453('0x27'));}var _0x3e386d={'tls':{'rejectUnauthorized':![]}};if(_0x3e7418['Smtp']['service']){_0x3e386d[_0xb453('0x28')]=_0x3e7418[_0xb453('0x26')][_0xb453('0x28')];}else{_0x3e386d[_0xb453('0x29')]=_0x3e7418['Smtp']['host'];_0x3e386d['port']=_0x3e7418[_0xb453('0x26')]['port'];_0x3e386d['secure']=_0x3e7418[_0xb453('0x26')][_0xb453('0x2a')];}if(_0x3e7418[_0xb453('0x26')][_0xb453('0x2b')]){_0x3e386d[_0xb453('0x2c')]={'user':_0x3e7418[_0xb453('0x26')][_0xb453('0x18')],'pass':_0x3e7418[_0xb453('0x26')]['pass']};}var _0x49250f={'account':_0x3e386d,'message':_[_0xb453('0x2d')]({'from':util['format']('\x22%s\x22\x20<%s>',_0x3e7418[_0xb453('0x19')],_0x3e7418[_0xb453('0x24')]||_0x3e7418['Smtp'][_0xb453('0x18')])},_0x9da2f4)};return client[_0xb453('0x2e')](_0xb453('0x2f'),_0x49250f);})[_0xb453('0xf')](function(_0x174711){if(_0x174711['error']){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x174711[_0xb453('0x30')][_0xb453('0x31')]||JSON[_0xb453('0x32')](_0x174711['error'])));}return!![];});}function handleError(_0x39be10,_0x5e5dce,_0x246843){return _0x39be10['status'](_0x5e5dce||0x1f4)[_0xb453('0x33')]({'message':_0x246843?_0x246843[_0xb453('0x31')]||_0x246843:''});}exports[_0xb453('0x34')]=function(_0x3bd4e9,_0x362c16,_0x3ef32f){passport[_0xb453('0x1a')](_0xb453('0x35'),function(_0x17f851,_0x413b6e,_0x542b6e){var _0x5461e8=_0x17f851||_0x542b6e;if(_0x5461e8){return handleError(_0x362c16,0x191,_0x5461e8);}if(!_0x413b6e){return handleError(_0x362c16,0x194,{'message':_0xb453('0x36')});}else{var _0x1b8de9={'payload':{'id':_0x413b6e['id'],'role':_0x413b6e[_0xb453('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0xb453('0x37')](_0x1b8de9)['then'](function(_0x49a4f2){_0x362c16['json']({'id':_0x413b6e['id'],'token':_0x49a4f2,'statusCall':'','isAlreadyLogged':_0x413b6e[_0xb453('0x38')]});});}})(_0x3bd4e9,_0x362c16,_0x3ef32f);};exports[_0xb453('0x39')]=function(_0x4d8178,_0x562120,_0x1a1d4e){if(!_0x4d8178[_0xb453('0x3a')]['email']){return handleError(_0x562120,0x1f4,{'message':_0xb453('0x3b')});}var _0x4227ae=rs[_0xb453('0x3c')]();_0x4d8178[_0xb453('0x3a')][_0xb453('0x24')]=_0x4d8178[_0xb453('0x3a')]['email']['trim']()[_0xb453('0x3d')]();var _0x19fb6e;return db[_0xb453('0x3e')][_0xb453('0xd')]({'where':{'id':0x1},'attributes':[_0xb453('0x1c'),_0xb453('0xe')],'raw':!![]})[_0xb453('0xf')](function(_0x14fb82){_0x19fb6e=_0x14fb82;return db[_0xb453('0x3f')][_0xb453('0x23')]({'where':{'email':_0x4d8178[_0xb453('0x3a')][_0xb453('0x24')]}});})[_0xb453('0xf')](function(_0x574a1d){if(!_0x574a1d){throw new Error(_0xb453('0x40'));}if(_0x574a1d['disabled']){throw new Error(_0xb453('0x41'));}if(_0x574a1d[_0xb453('0x14')]){if(moment(_0x574a1d[_0xb453('0x15')])[_0xb453('0x1d')](_0x19fb6e[_0xb453('0xe')],_0xb453('0x1f'))>moment()){throw new Error(_0xb453('0x42'));}else{_0x574a1d[_0xb453('0x14')]=![];_0x574a1d['blockedAt']=null;}}_0x574a1d[_0xb453('0x43')]=_0x4227ae;_0x574a1d[_0xb453('0x44')]=Date[_0xb453('0x45')]()+0x36ee80;return _0x574a1d[_0xb453('0x46')]();})[_0xb453('0xf')](function(){return sendServiceMail({'to':_0x4d8178[_0xb453('0x3a')][_0xb453('0x24')],'subject':_0xb453('0x47'),'text':_0xb453('0x48')+_0xb453('0x49')+'https://'+_0x4d8178[_0xb453('0x4a')][_0xb453('0x29')]+'/reset/'+_0x4227ae+'\x0a\x0a'+_0xb453('0x4b')});})[_0xb453('0xf')](function(){_0x562120[_0xb453('0x4c')](0xc8)[_0xb453('0x33')]({'message':_0xb453('0x4d')});})['catch'](function(_0xf9ed81){return handleError(_0x562120,0x1f4,_0xf9ed81);});};exports[_0xb453('0x4e')]=function(_0x4c2a74,_0x24ba2c,_0x5f02ca){return db[_0xb453('0x3f')][_0xb453('0x23')]({'where':{'resetPasswordToken':_0x4c2a74['params'][_0xb453('0x4f')],'resetPasswordExpires':{'$gt':Date[_0xb453('0x45')]()}}})[_0xb453('0xf')](function(_0x21557d){if(!_0x21557d){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0xb453('0xd')]({'attributes':['id','securePassword','enforcePasswordHistory',_0xb453('0x50')]})[_0xb453('0xf')](function(_0x5572bb){if(_0x5572bb[_0xb453('0x51')])authService[_0xb453('0x52')](_0x4c2a74['body'][_0xb453('0x10')]);if(!_0x5572bb['enforcePasswordHistory']||!_0x21557d['previousPasswords'])return _0x21557d;authService['validatePasswordHistory'](_0x4c2a74[_0xb453('0x3a')][_0xb453('0x10')],_0x21557d[_0xb453('0x53')],_0x5572bb['passwordHistoryLimit']);return _0x21557d;})[_0xb453('0xf')](function(){_0x21557d['password']=_0x4c2a74[_0xb453('0x3a')][_0xb453('0x10')];_0x21557d['resetPasswordToken']=null;_0x21557d[_0xb453('0x44')]=null;return _0x21557d['save']();});})[_0xb453('0xf')](function(){_0x24ba2c[_0xb453('0x4c')](0xc8)['send']({'message':_0xb453('0x54')});})[_0xb453('0x21')](function(_0x3d8e0a){return handleError(_0x24ba2c,0x1f4,_0x3d8e0a);});};passport['use'](new LocalStrategy({'usernameField':_0xb453('0x19'),'passwordField':'password'},function(_0x555c1a,_0x134833,_0x455851){return localAuthenticate(db['User'],_0x555c1a,_0x134833,_0x455851);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 6f3db79..426c3fd 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 _0x9ce0=['./authLocal.controller','post','/forgot','reset','exports','express','Router'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x9ce0,0x108));var _0x09ce=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9ce0[_0x1ac595];return _0x455fff;};'use strict';var express=require(_0x09ce('0x0'));var router=express[_0x09ce('0x1')]();var controller=require(_0x09ce('0x2'));router[_0x09ce('0x3')]('/',controller['login']);router[_0x09ce('0x3')](_0x09ce('0x4'),controller['forgot']);router[_0x09ce('0x3')]('/reset/:token',controller[_0x09ce('0x5')]);module[_0x09ce('0x6')]=router; \ No newline at end of file +var _0x8f83=['reset','express','Router','./authLocal.controller','post','login','/forgot','forgot','/reset/:token'];(function(_0xda631a,_0x34d21f){var _0x48d7aa=function(_0x3ff034){while(--_0x3ff034){_0xda631a['push'](_0xda631a['shift']());}};_0x48d7aa(++_0x34d21f);}(_0x8f83,0x1d5));var _0x38f8=function(_0xf1b942,_0x373db6){_0xf1b942=_0xf1b942-0x0;var _0x1b7756=_0x8f83[_0xf1b942];return _0x1b7756;};'use strict';var express=require(_0x38f8('0x0'));var router=express[_0x38f8('0x1')]();var controller=require(_0x38f8('0x2'));router[_0x38f8('0x3')]('/',controller[_0x38f8('0x4')]);router[_0x38f8('0x3')](_0x38f8('0x5'),controller[_0x38f8('0x6')]);router['post'](_0x38f8('0x7'),controller[_0x38f8('0x8')]);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 d00ad35..92c8a1b 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 _0x63a4=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x63a4,0x1b4));var _0x463a=function(_0x4256c5,_0x288cee){_0x4256c5=_0x4256c5-0x0;var _0x3c8bfd=_0x63a4[_0x4256c5];return _0x3c8bfd;};'use strict';var Sequelize=require(_0x463a('0x0'));module[_0x463a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x463a('0x2')]},'description':{'type':Sequelize[_0x463a('0x2')]},'status':{'type':Sequelize[_0x463a('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x463a('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x7c18=['INTEGER','exports','STRING','BOOLEAN'];(function(_0x166287,_0x3f467d){var _0x11ebfa=function(_0x2d3f32){while(--_0x2d3f32){_0x166287['push'](_0x166287['shift']());}};_0x11ebfa(++_0x3f467d);}(_0x7c18,0x15d));var _0x87c1=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x7c18[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x87c1('0x0')]={'name':{'type':Sequelize[_0x87c1('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x87c1('0x1')]},'description':{'type':Sequelize[_0x87c1('0x1')]},'status':{'type':Sequelize[_0x87c1('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x87c1('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 b559a13..af8d6b4 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 _0x6139=['desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','destroy','then','error','stack','name','index','Automation','rawAttributes','fieldName','key','model','map','keys','query','attributes','intersection','fields','length','nolimit','sort','where','filters','filter','merge','type','options','count','includeAll','include','findAll','rows','show','params','find','catch','create','body','addConditions','Condition','ids','omit','getConditions','pick','Action','addActions','findOne','order','getActions','hasOwnProperty','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','squel'];(function(_0x4f3964,_0x33df88){var _0xf98636=function(_0x565a2c){while(--_0x565a2c){_0x4f3964['push'](_0x4f3964['shift']());}};_0xf98636(++_0x33df88);}(_0x6139,0xef));var _0x9613=function(_0xfec4f,_0x516119){_0xfec4f=_0xfec4f-0x0;var _0x4d8bad=_0x6139[_0xfec4f];return _0x4d8bad;};'use strict';var emlformat=require(_0x9613('0x0'));var rimraf=require(_0x9613('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9613('0x2'));var rp=require(_0x9613('0x3'));var moment=require(_0x9613('0x4'));var BPromise=require(_0x9613('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9613('0x6'));var sox=require(_0x9613('0x7'));var csv=require(_0x9613('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9613('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9613('0xa'));var toCsv=require(_0x9613('0x8'));var querystring=require(_0x9613('0xb'));var Papa=require('papaparse');var Redis=require(_0x9613('0xc'));var authService=require(_0x9613('0xd'));var qs=require(_0x9613('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9613('0xf'));var logger=require(_0x9613('0x10'))(_0x9613('0x11'));var utils=require(_0x9613('0x12'));var config=require(_0x9613('0x13'));var licenseUtil=require(_0x9613('0x14'));var db=require(_0x9613('0x15'))['db'];function respondWithStatusCode(_0x16d41b,_0x1bc9ba){_0x1bc9ba=_0x1bc9ba||0xcc;return function(_0x5319eb){if(_0x5319eb){return _0x16d41b[_0x9613('0x16')](_0x1bc9ba);}return _0x16d41b[_0x9613('0x17')](_0x1bc9ba)[_0x9613('0x18')]();};}function respondWithResult(_0x16ec05,_0x40b51b){_0x40b51b=_0x40b51b||0xc8;return function(_0x5d4b74){if(_0x5d4b74){return _0x16ec05[_0x9613('0x17')](_0x40b51b)[_0x9613('0x19')](_0x5d4b74);}};}function respondWithFilteredResult(_0x4dd580,_0x2c13f3){return function(_0x2c2b4d){if(_0x2c2b4d){var _0x44e1ea=typeof _0x2c13f3[_0x9613('0x1a')]===_0x9613('0x1b')&&typeof _0x2c13f3['limit']===_0x9613('0x1b');var _0x4e8a9c=_0x2c2b4d['count'];var _0x15559a=_0x44e1ea?0x0:_0x2c13f3[_0x9613('0x1a')];var _0x87db25=_0x44e1ea?_0x2c2b4d['count']:_0x2c13f3[_0x9613('0x1a')]+_0x2c13f3[_0x9613('0x1c')];var _0x1a2ee8;if(_0x87db25>=_0x4e8a9c){_0x87db25=_0x4e8a9c;_0x1a2ee8=0xc8;}else{_0x1a2ee8=0xce;}_0x4dd580[_0x9613('0x17')](_0x1a2ee8);return _0x4dd580[_0x9613('0x1d')]('Content-Range',_0x15559a+'-'+_0x87db25+'/'+_0x4e8a9c)['json'](_0x2c2b4d);}return null;};}function patchUpdates(_0x36dda6){return function(_0x5d12e5){try{jsonpatch[_0x9613('0x1e')](_0x5d12e5,_0x36dda6,!![]);}catch(_0x140f4b){return BPromise[_0x9613('0x1f')](_0x140f4b);}return _0x5d12e5[_0x9613('0x20')]();};}function saveUpdates(_0x270327,_0x33ff16){return function(_0x31b2ac){if(_0x31b2ac){return _0x31b2ac[_0x9613('0x21')](_0x270327)['then'](function(_0x4486de){return _0x4486de;});}return null;};}function removeEntity(_0x37e1b2,_0x3d1baa){return function(_0xc19af){if(_0xc19af){return _0xc19af[_0x9613('0x22')]()[_0x9613('0x23')](function(){_0x37e1b2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x14bfe1,_0x2d93b1){return function(_0x5971a9){if(!_0x5971a9){_0x14bfe1[_0x9613('0x16')](0x194);}return _0x5971a9;};}function handleError(_0x2bcd75,_0x5468e1){_0x5468e1=_0x5468e1||0x1f4;return function(_0x3a3391){logger[_0x9613('0x24')](_0x3a3391[_0x9613('0x25')]);if(_0x3a3391[_0x9613('0x26')]){delete _0x3a3391['name'];}_0x2bcd75[_0x9613('0x17')](_0x5468e1)['send'](_0x3a3391);};}exports[_0x9613('0x27')]=function(_0x2d4416,_0x2a826c){var _0x474f47={},_0x27297f={},_0x33fedb={'count':0x0,'rows':[]};var _0x2f7a39=_['map'](db[_0x9613('0x28')][_0x9613('0x29')],function(_0xd661e){return{'name':_0xd661e[_0x9613('0x2a')],'type':_0xd661e['type'][_0x9613('0x2b')]};});_0x27297f[_0x9613('0x2c')]=_[_0x9613('0x2d')](_0x2f7a39,_0x9613('0x26'));_0x27297f['query']=_[_0x9613('0x2e')](_0x2d4416[_0x9613('0x2f')]);_0x27297f['filters']=_['intersection'](_0x27297f[_0x9613('0x2c')],_0x27297f[_0x9613('0x2f')]);_0x474f47[_0x9613('0x30')]=_[_0x9613('0x31')](_0x27297f[_0x9613('0x2c')],qs['fields'](_0x2d4416['query'][_0x9613('0x32')]));_0x474f47[_0x9613('0x30')]=_0x474f47['attributes'][_0x9613('0x33')]?_0x474f47[_0x9613('0x30')]:_0x27297f['model'];if(!_0x2d4416['query']['hasOwnProperty'](_0x9613('0x34'))){_0x474f47[_0x9613('0x1c')]=qs[_0x9613('0x1c')](_0x2d4416['query'][_0x9613('0x1c')]);_0x474f47['offset']=qs[_0x9613('0x1a')](_0x2d4416[_0x9613('0x2f')][_0x9613('0x1a')]);}_0x474f47['order']=qs['sort'](_0x2d4416['query'][_0x9613('0x35')]);_0x474f47[_0x9613('0x36')]=qs['filters'](_['pick'](_0x2d4416[_0x9613('0x2f')],_0x27297f[_0x9613('0x37')]),_0x2f7a39);if(_0x2d4416['query'][_0x9613('0x38')]){_0x474f47[_0x9613('0x36')]=_[_0x9613('0x39')](_0x474f47['where'],{'$or':_['map'](_0x2f7a39,function(_0x460dc0){if(_0x460dc0[_0x9613('0x3a')]!=='VIRTUAL'){var _0x1981e6={};_0x1981e6[_0x460dc0[_0x9613('0x26')]]={'$like':'%'+_0x2d4416[_0x9613('0x2f')][_0x9613('0x38')]+'%'};return _0x1981e6;}})});}_0x474f47=_[_0x9613('0x39')]({},_0x474f47,_0x2d4416[_0x9613('0x3b')]);var _0x573d77={'where':_0x474f47[_0x9613('0x36')]};return db['Automation']['count'](_0x573d77)[_0x9613('0x23')](function(_0x580758){_0x33fedb[_0x9613('0x3c')]=_0x580758;if(_0x2d4416[_0x9613('0x2f')][_0x9613('0x3d')]){_0x474f47[_0x9613('0x3e')]=[{'all':!![]}];}return db[_0x9613('0x28')][_0x9613('0x3f')](_0x474f47);})['then'](function(_0xa2a883){_0x33fedb[_0x9613('0x40')]=_0xa2a883;return _0x33fedb;})[_0x9613('0x23')](respondWithFilteredResult(_0x2a826c,_0x474f47))['catch'](handleError(_0x2a826c,null));};exports[_0x9613('0x41')]=function(_0x46a27d,_0x2da1c9){var _0x14e7a5={'raw':![],'where':{'id':_0x46a27d[_0x9613('0x42')]['id']}},_0x39c164={};_0x39c164[_0x9613('0x2c')]=_[_0x9613('0x2e')](db['Automation'][_0x9613('0x29')]);_0x39c164[_0x9613('0x2f')]=_['keys'](_0x46a27d[_0x9613('0x2f')]);_0x39c164[_0x9613('0x37')]=_[_0x9613('0x31')](_0x39c164[_0x9613('0x2c')],_0x39c164['query']);_0x14e7a5[_0x9613('0x30')]=_['intersection'](_0x39c164['model'],qs[_0x9613('0x32')](_0x46a27d[_0x9613('0x2f')][_0x9613('0x32')]));_0x14e7a5[_0x9613('0x30')]=_0x14e7a5[_0x9613('0x30')][_0x9613('0x33')]?_0x14e7a5[_0x9613('0x30')]:_0x39c164[_0x9613('0x2c')];if(_0x46a27d['query']['includeAll']){_0x14e7a5[_0x9613('0x3e')]=[{'all':!![]}];}_0x14e7a5=_[_0x9613('0x39')]({},_0x14e7a5,_0x46a27d[_0x9613('0x3b')]);return db['Automation'][_0x9613('0x43')](_0x14e7a5)[_0x9613('0x23')](handleEntityNotFound(_0x2da1c9,null))[_0x9613('0x23')](respondWithResult(_0x2da1c9,null))[_0x9613('0x44')](handleError(_0x2da1c9,null));};exports[_0x9613('0x45')]=function(_0x47a6a8,_0x194a2c){return db['Automation']['create'](_0x47a6a8[_0x9613('0x46')],{})[_0x9613('0x23')](respondWithResult(_0x194a2c,0xc9))[_0x9613('0x44')](handleError(_0x194a2c,null));};exports[_0x9613('0x21')]=function(_0x498cad,_0x3a8021){if(_0x498cad['body']['id']){delete _0x498cad[_0x9613('0x46')]['id'];}return db[_0x9613('0x28')][_0x9613('0x43')]({'where':{'id':_0x498cad[_0x9613('0x42')]['id']}})[_0x9613('0x23')](handleEntityNotFound(_0x3a8021,null))[_0x9613('0x23')](saveUpdates(_0x498cad['body'],null))[_0x9613('0x23')](respondWithResult(_0x3a8021,null))['catch'](handleError(_0x3a8021,null));};exports['destroy']=function(_0x59d074,_0x46c77d){return db[_0x9613('0x28')][_0x9613('0x43')]({'where':{'id':_0x59d074['params']['id']}})[_0x9613('0x23')](handleEntityNotFound(_0x46c77d,null))[_0x9613('0x23')](removeEntity(_0x46c77d,null))[_0x9613('0x44')](handleError(_0x46c77d,null));};exports[_0x9613('0x47')]=function(_0x5cccfa,_0x24f92b,_0x5b8fdb){return db[_0x9613('0x48')]['find']({'where':{'id':_0x5cccfa['params']['id']}})[_0x9613('0x23')](handleEntityNotFound(_0x24f92b,null))[_0x9613('0x23')](function(_0x2bc7fe){if(_0x2bc7fe){return _0x2bc7fe[_0x9613('0x47')](_0x5cccfa['body'][_0x9613('0x49')],_[_0x9613('0x4a')](_0x5cccfa['body'],[_0x9613('0x49'),'id'])||{});}})['then'](respondWithResult(_0x24f92b,null))['catch'](handleError(_0x24f92b,null));};exports[_0x9613('0x4b')]=function(_0x2adc07,_0x29f57f,_0x2477ea){var _0x42a1a1={};var _0x33d3a0={};var _0x4454e4;var _0x523c68;return db['Automation']['findOne']({'where':{'id':_0x2adc07[_0x9613('0x42')]['id']}})[_0x9613('0x23')](handleEntityNotFound(_0x29f57f,null))[_0x9613('0x23')](function(_0x4f6c27){if(_0x4f6c27){_0x4454e4=_0x4f6c27;_0x33d3a0[_0x9613('0x2c')]=_['keys'](db[_0x9613('0x48')]['rawAttributes']);_0x33d3a0[_0x9613('0x2f')]=_[_0x9613('0x2e')](_0x2adc07[_0x9613('0x2f')]);_0x33d3a0[_0x9613('0x37')]=_[_0x9613('0x31')](_0x33d3a0[_0x9613('0x2c')],_0x33d3a0[_0x9613('0x2f')]);_0x42a1a1[_0x9613('0x30')]=_[_0x9613('0x31')](_0x33d3a0[_0x9613('0x2c')],qs[_0x9613('0x32')](_0x2adc07[_0x9613('0x2f')]['fields']));_0x42a1a1[_0x9613('0x30')]=_0x42a1a1['attributes'][_0x9613('0x33')]?_0x42a1a1[_0x9613('0x30')]:_0x33d3a0[_0x9613('0x2c')];_0x42a1a1['order']=qs[_0x9613('0x35')](_0x2adc07[_0x9613('0x2f')][_0x9613('0x35')]);_0x42a1a1['where']=qs[_0x9613('0x37')](_[_0x9613('0x4c')](_0x2adc07[_0x9613('0x2f')],_0x33d3a0[_0x9613('0x37')]));if(_0x2adc07[_0x9613('0x2f')]['filter']){_0x42a1a1[_0x9613('0x36')]=_[_0x9613('0x39')](_0x42a1a1['where'],{'$or':_[_0x9613('0x2d')](_0x42a1a1[_0x9613('0x30')],function(_0x148793){var _0x1deb05={};_0x1deb05[_0x148793]={'$like':'%'+_0x2adc07['query'][_0x9613('0x38')]+'%'};return _0x1deb05;})});}_0x42a1a1=_['merge']({},_0x42a1a1,_0x2adc07[_0x9613('0x3b')]);return _0x4454e4[_0x9613('0x4b')](_0x42a1a1);}})[_0x9613('0x23')](function(_0x281f9e){if(_0x281f9e){_0x523c68=_0x281f9e['length'];if(!_0x2adc07['query']['hasOwnProperty'](_0x9613('0x34'))){_0x42a1a1[_0x9613('0x1c')]=qs[_0x9613('0x1c')](_0x2adc07[_0x9613('0x2f')][_0x9613('0x1c')]);_0x42a1a1[_0x9613('0x1a')]=qs[_0x9613('0x1a')](_0x2adc07[_0x9613('0x2f')][_0x9613('0x1a')]);}return _0x4454e4[_0x9613('0x4b')](_0x42a1a1);}})[_0x9613('0x23')](function(_0x5dc858){if(_0x5dc858){return _0x5dc858?{'count':_0x523c68,'rows':_0x5dc858}:null;}})[_0x9613('0x23')](respondWithResult(_0x29f57f,null))[_0x9613('0x44')](handleError(_0x29f57f,null));};exports['addActions']=function(_0x4d2502,_0x10f7e3,_0x5430a6){return db[_0x9613('0x4d')][_0x9613('0x43')]({'where':{'id':_0x4d2502[_0x9613('0x42')]['id']}})[_0x9613('0x23')](handleEntityNotFound(_0x10f7e3,null))[_0x9613('0x23')](function(_0x251f67){if(_0x251f67){return _0x251f67[_0x9613('0x4e')](_0x4d2502[_0x9613('0x46')][_0x9613('0x49')],_[_0x9613('0x4a')](_0x4d2502[_0x9613('0x46')],['ids','id'])||{});}})['then'](respondWithResult(_0x10f7e3,null))[_0x9613('0x44')](handleError(_0x10f7e3,null));};exports['getActions']=function(_0x12c247,_0x133fe9,_0x45ab8d){var _0x460d3b={};var _0x12dd2b={};var _0x38b6f3;var _0x116232;return db[_0x9613('0x28')][_0x9613('0x4f')]({'where':{'id':_0x12c247[_0x9613('0x42')]['id']}})[_0x9613('0x23')](handleEntityNotFound(_0x133fe9,null))[_0x9613('0x23')](function(_0xe63c33){if(_0xe63c33){_0x38b6f3=_0xe63c33;_0x12dd2b[_0x9613('0x2c')]=_['keys'](db[_0x9613('0x4d')][_0x9613('0x29')]);_0x12dd2b[_0x9613('0x2f')]=_['keys'](_0x12c247[_0x9613('0x2f')]);_0x12dd2b[_0x9613('0x37')]=_[_0x9613('0x31')](_0x12dd2b[_0x9613('0x2c')],_0x12dd2b[_0x9613('0x2f')]);_0x460d3b['attributes']=_[_0x9613('0x31')](_0x12dd2b['model'],qs[_0x9613('0x32')](_0x12c247[_0x9613('0x2f')][_0x9613('0x32')]));_0x460d3b[_0x9613('0x30')]=_0x460d3b[_0x9613('0x30')][_0x9613('0x33')]?_0x460d3b['attributes']:_0x12dd2b[_0x9613('0x2c')];_0x460d3b[_0x9613('0x50')]=qs[_0x9613('0x35')](_0x12c247[_0x9613('0x2f')][_0x9613('0x35')]);_0x460d3b[_0x9613('0x36')]=qs[_0x9613('0x37')](_[_0x9613('0x4c')](_0x12c247[_0x9613('0x2f')],_0x12dd2b[_0x9613('0x37')]));if(_0x12c247[_0x9613('0x2f')][_0x9613('0x38')]){_0x460d3b[_0x9613('0x36')]=_[_0x9613('0x39')](_0x460d3b['where'],{'$or':_[_0x9613('0x2d')](_0x460d3b['attributes'],function(_0x5ef84c){var _0x2b27cf={};_0x2b27cf[_0x5ef84c]={'$like':'%'+_0x12c247[_0x9613('0x2f')][_0x9613('0x38')]+'%'};return _0x2b27cf;})});}_0x460d3b=_[_0x9613('0x39')]({},_0x460d3b,_0x12c247[_0x9613('0x3b')]);return _0x38b6f3[_0x9613('0x51')](_0x460d3b);}})['then'](function(_0x940206){if(_0x940206){_0x116232=_0x940206[_0x9613('0x33')];if(!_0x12c247[_0x9613('0x2f')][_0x9613('0x52')]('nolimit')){_0x460d3b['limit']=qs[_0x9613('0x1c')](_0x12c247[_0x9613('0x2f')]['limit']);_0x460d3b[_0x9613('0x1a')]=qs[_0x9613('0x1a')](_0x12c247[_0x9613('0x2f')][_0x9613('0x1a')]);}return _0x38b6f3[_0x9613('0x51')](_0x460d3b);}})[_0x9613('0x23')](function(_0x49faf8){if(_0x49faf8){return _0x49faf8?{'count':_0x116232,'rows':_0x49faf8}:null;}})[_0x9613('0x23')](respondWithResult(_0x133fe9,null))[_0x9613('0x44')](handleError(_0x133fe9,null));}; \ No newline at end of file +var _0xe5da=['findOne','Condition','addActions','Action','getActions','rawAttributes','order','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','reject','update','then','destroy','error','stack','name','send','index','map','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','Automation','includeAll','include','rows','show','params','find','catch','create','body','addConditions','ids','omit','getConditions'];(function(_0xf9e76,_0x2e6b9a){var _0x119a9b=function(_0x146396){while(--_0x146396){_0xf9e76['push'](_0xf9e76['shift']());}};_0x119a9b(++_0x2e6b9a);}(_0xe5da,0xb3));var _0xae5d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe5da[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xae5d('0x0'));var rimraf=require(_0xae5d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xae5d('0x2'));var rp=require(_0xae5d('0x3'));var moment=require(_0xae5d('0x4'));var BPromise=require(_0xae5d('0x5'));var Mustache=require('mustache');var util=require(_0xae5d('0x6'));var path=require(_0xae5d('0x7'));var sox=require(_0xae5d('0x8'));var csv=require(_0xae5d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xae5d('0xa'));var _=require(_0xae5d('0xb'));var squel=require(_0xae5d('0xc'));var crypto=require(_0xae5d('0xd'));var jsforce=require(_0xae5d('0xe'));var deskjs=require(_0xae5d('0xf'));var toCsv=require(_0xae5d('0x9'));var querystring=require(_0xae5d('0x10'));var Papa=require(_0xae5d('0x11'));var Redis=require('ioredis');var authService=require(_0xae5d('0x12'));var qs=require(_0xae5d('0x13'));var as=require(_0xae5d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xae5d('0x15'))(_0xae5d('0x16'));var utils=require(_0xae5d('0x17'));var config=require(_0xae5d('0x18'));var licenseUtil=require(_0xae5d('0x19'));var db=require(_0xae5d('0x1a'))['db'];function respondWithStatusCode(_0x28f54f,_0x2a0126){_0x2a0126=_0x2a0126||0xcc;return function(_0x4bfe11){if(_0x4bfe11){return _0x28f54f[_0xae5d('0x1b')](_0x2a0126);}return _0x28f54f[_0xae5d('0x1c')](_0x2a0126)[_0xae5d('0x1d')]();};}function respondWithResult(_0x2aa3e9,_0x3dac6a){_0x3dac6a=_0x3dac6a||0xc8;return function(_0x359108){if(_0x359108){return _0x2aa3e9['status'](_0x3dac6a)[_0xae5d('0x1e')](_0x359108);}};}function respondWithFilteredResult(_0x7aad17,_0x3c974f){return function(_0x1aa168){if(_0x1aa168){var _0x2ae99d=typeof _0x3c974f['offset']==='undefined'&&typeof _0x3c974f[_0xae5d('0x1f')]===_0xae5d('0x20');var _0x1062b2=_0x1aa168[_0xae5d('0x21')];var _0xc7fe5a=_0x2ae99d?0x0:_0x3c974f[_0xae5d('0x22')];var _0x3dbb09=_0x2ae99d?_0x1aa168[_0xae5d('0x21')]:_0x3c974f[_0xae5d('0x22')]+_0x3c974f[_0xae5d('0x1f')];var _0x821aca;if(_0x3dbb09>=_0x1062b2){_0x3dbb09=_0x1062b2;_0x821aca=0xc8;}else{_0x821aca=0xce;}_0x7aad17[_0xae5d('0x1c')](_0x821aca);return _0x7aad17[_0xae5d('0x23')]('Content-Range',_0xc7fe5a+'-'+_0x3dbb09+'/'+_0x1062b2)[_0xae5d('0x1e')](_0x1aa168);}return null;};}function patchUpdates(_0xbed0f){return function(_0x41a85b){try{jsonpatch['apply'](_0x41a85b,_0xbed0f,!![]);}catch(_0x13722f){return BPromise[_0xae5d('0x24')](_0x13722f);}return _0x41a85b['save']();};}function saveUpdates(_0xb5497e,_0x28500b){return function(_0x42ebc8){if(_0x42ebc8){return _0x42ebc8[_0xae5d('0x25')](_0xb5497e)[_0xae5d('0x26')](function(_0x21e8d3){return _0x21e8d3;});}return null;};}function removeEntity(_0x3399e0,_0x15065d){return function(_0x226c8a){if(_0x226c8a){return _0x226c8a[_0xae5d('0x27')]()[_0xae5d('0x26')](function(){_0x3399e0[_0xae5d('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x271c14,_0x59b8fc){return function(_0x490d10){if(!_0x490d10){_0x271c14[_0xae5d('0x1b')](0x194);}return _0x490d10;};}function handleError(_0x3ae7f3,_0x301c84){_0x301c84=_0x301c84||0x1f4;return function(_0x353acf){logger[_0xae5d('0x28')](_0x353acf[_0xae5d('0x29')]);if(_0x353acf[_0xae5d('0x2a')]){delete _0x353acf[_0xae5d('0x2a')];}_0x3ae7f3[_0xae5d('0x1c')](_0x301c84)[_0xae5d('0x2b')](_0x353acf);};}exports[_0xae5d('0x2c')]=function(_0x1a17af,_0x516e8d){var _0x15a21f={},_0x4e7692={},_0x1ab853={'count':0x0,'rows':[]};var _0x1f3795=_[_0xae5d('0x2d')](db['Automation']['rawAttributes'],function(_0x2584de){return{'name':_0x2584de[_0xae5d('0x2e')],'type':_0x2584de[_0xae5d('0x2f')]['key']};});_0x4e7692[_0xae5d('0x30')]=_[_0xae5d('0x2d')](_0x1f3795,_0xae5d('0x2a'));_0x4e7692['query']=_[_0xae5d('0x31')](_0x1a17af[_0xae5d('0x32')]);_0x4e7692[_0xae5d('0x33')]=_[_0xae5d('0x34')](_0x4e7692['model'],_0x4e7692['query']);_0x15a21f[_0xae5d('0x35')]=_[_0xae5d('0x34')](_0x4e7692[_0xae5d('0x30')],qs[_0xae5d('0x36')](_0x1a17af['query'][_0xae5d('0x36')]));_0x15a21f[_0xae5d('0x35')]=_0x15a21f[_0xae5d('0x35')][_0xae5d('0x37')]?_0x15a21f[_0xae5d('0x35')]:_0x4e7692[_0xae5d('0x30')];if(!_0x1a17af['query'][_0xae5d('0x38')](_0xae5d('0x39'))){_0x15a21f[_0xae5d('0x1f')]=qs[_0xae5d('0x1f')](_0x1a17af[_0xae5d('0x32')][_0xae5d('0x1f')]);_0x15a21f[_0xae5d('0x22')]=qs[_0xae5d('0x22')](_0x1a17af[_0xae5d('0x32')][_0xae5d('0x22')]);}_0x15a21f['order']=qs[_0xae5d('0x3a')](_0x1a17af[_0xae5d('0x32')][_0xae5d('0x3a')]);_0x15a21f[_0xae5d('0x3b')]=qs[_0xae5d('0x33')](_[_0xae5d('0x3c')](_0x1a17af[_0xae5d('0x32')],_0x4e7692[_0xae5d('0x33')]),_0x1f3795);if(_0x1a17af[_0xae5d('0x32')][_0xae5d('0x3d')]){_0x15a21f[_0xae5d('0x3b')]=_[_0xae5d('0x3e')](_0x15a21f[_0xae5d('0x3b')],{'$or':_[_0xae5d('0x2d')](_0x1f3795,function(_0x6cba13){if(_0x6cba13[_0xae5d('0x2f')]!==_0xae5d('0x3f')){var _0x161f7a={};_0x161f7a[_0x6cba13[_0xae5d('0x2a')]]={'$like':'%'+_0x1a17af[_0xae5d('0x32')][_0xae5d('0x3d')]+'%'};return _0x161f7a;}})});}_0x15a21f=_[_0xae5d('0x3e')]({},_0x15a21f,_0x1a17af[_0xae5d('0x40')]);var _0x33281f={'where':_0x15a21f[_0xae5d('0x3b')]};return db[_0xae5d('0x41')][_0xae5d('0x21')](_0x33281f)[_0xae5d('0x26')](function(_0x27f959){_0x1ab853[_0xae5d('0x21')]=_0x27f959;if(_0x1a17af[_0xae5d('0x32')][_0xae5d('0x42')]){_0x15a21f[_0xae5d('0x43')]=[{'all':!![]}];}return db[_0xae5d('0x41')]['findAll'](_0x15a21f);})[_0xae5d('0x26')](function(_0x18722b){_0x1ab853[_0xae5d('0x44')]=_0x18722b;return _0x1ab853;})['then'](respondWithFilteredResult(_0x516e8d,_0x15a21f))['catch'](handleError(_0x516e8d,null));};exports[_0xae5d('0x45')]=function(_0x1ea62e,_0x2c0216){var _0x7db5fd={'raw':![],'where':{'id':_0x1ea62e[_0xae5d('0x46')]['id']}},_0x415f7a={};_0x415f7a['model']=_[_0xae5d('0x31')](db[_0xae5d('0x41')]['rawAttributes']);_0x415f7a[_0xae5d('0x32')]=_['keys'](_0x1ea62e[_0xae5d('0x32')]);_0x415f7a[_0xae5d('0x33')]=_[_0xae5d('0x34')](_0x415f7a[_0xae5d('0x30')],_0x415f7a[_0xae5d('0x32')]);_0x7db5fd[_0xae5d('0x35')]=_['intersection'](_0x415f7a[_0xae5d('0x30')],qs[_0xae5d('0x36')](_0x1ea62e[_0xae5d('0x32')][_0xae5d('0x36')]));_0x7db5fd[_0xae5d('0x35')]=_0x7db5fd[_0xae5d('0x35')]['length']?_0x7db5fd[_0xae5d('0x35')]:_0x415f7a[_0xae5d('0x30')];if(_0x1ea62e[_0xae5d('0x32')][_0xae5d('0x42')]){_0x7db5fd[_0xae5d('0x43')]=[{'all':!![]}];}_0x7db5fd=_[_0xae5d('0x3e')]({},_0x7db5fd,_0x1ea62e['options']);return db[_0xae5d('0x41')][_0xae5d('0x47')](_0x7db5fd)[_0xae5d('0x26')](handleEntityNotFound(_0x2c0216,null))[_0xae5d('0x26')](respondWithResult(_0x2c0216,null))[_0xae5d('0x48')](handleError(_0x2c0216,null));};exports['create']=function(_0x35a802,_0x481fef){return db['Automation'][_0xae5d('0x49')](_0x35a802[_0xae5d('0x4a')],{})['then'](respondWithResult(_0x481fef,0xc9))[_0xae5d('0x48')](handleError(_0x481fef,null));};exports['update']=function(_0x54752b,_0x374347){if(_0x54752b[_0xae5d('0x4a')]['id']){delete _0x54752b['body']['id'];}return db['Automation'][_0xae5d('0x47')]({'where':{'id':_0x54752b['params']['id']}})[_0xae5d('0x26')](handleEntityNotFound(_0x374347,null))[_0xae5d('0x26')](saveUpdates(_0x54752b[_0xae5d('0x4a')],null))[_0xae5d('0x26')](respondWithResult(_0x374347,null))[_0xae5d('0x48')](handleError(_0x374347,null));};exports[_0xae5d('0x27')]=function(_0x375fab,_0x20250){return db[_0xae5d('0x41')][_0xae5d('0x47')]({'where':{'id':_0x375fab[_0xae5d('0x46')]['id']}})['then'](handleEntityNotFound(_0x20250,null))[_0xae5d('0x26')](removeEntity(_0x20250,null))['catch'](handleError(_0x20250,null));};exports[_0xae5d('0x4b')]=function(_0x229777,_0x219399,_0xfe60d4){return db['Condition'][_0xae5d('0x47')]({'where':{'id':_0x229777[_0xae5d('0x46')]['id']}})['then'](handleEntityNotFound(_0x219399,null))['then'](function(_0x2d6b6d){if(_0x2d6b6d){return _0x2d6b6d[_0xae5d('0x4b')](_0x229777[_0xae5d('0x4a')][_0xae5d('0x4c')],_[_0xae5d('0x4d')](_0x229777[_0xae5d('0x4a')],['ids','id'])||{});}})[_0xae5d('0x26')](respondWithResult(_0x219399,null))[_0xae5d('0x48')](handleError(_0x219399,null));};exports[_0xae5d('0x4e')]=function(_0x452fb3,_0x45500c,_0x2e6916){var _0x1bcf4c={};var _0x3c034a={};var _0x46c016;var _0x32774c;return db['Automation'][_0xae5d('0x4f')]({'where':{'id':_0x452fb3[_0xae5d('0x46')]['id']}})[_0xae5d('0x26')](handleEntityNotFound(_0x45500c,null))[_0xae5d('0x26')](function(_0x2a86ab){if(_0x2a86ab){_0x46c016=_0x2a86ab;_0x3c034a[_0xae5d('0x30')]=_['keys'](db[_0xae5d('0x50')]['rawAttributes']);_0x3c034a[_0xae5d('0x32')]=_[_0xae5d('0x31')](_0x452fb3[_0xae5d('0x32')]);_0x3c034a[_0xae5d('0x33')]=_[_0xae5d('0x34')](_0x3c034a[_0xae5d('0x30')],_0x3c034a[_0xae5d('0x32')]);_0x1bcf4c['attributes']=_[_0xae5d('0x34')](_0x3c034a['model'],qs[_0xae5d('0x36')](_0x452fb3[_0xae5d('0x32')][_0xae5d('0x36')]));_0x1bcf4c[_0xae5d('0x35')]=_0x1bcf4c[_0xae5d('0x35')][_0xae5d('0x37')]?_0x1bcf4c[_0xae5d('0x35')]:_0x3c034a[_0xae5d('0x30')];_0x1bcf4c['order']=qs[_0xae5d('0x3a')](_0x452fb3[_0xae5d('0x32')][_0xae5d('0x3a')]);_0x1bcf4c[_0xae5d('0x3b')]=qs['filters'](_[_0xae5d('0x3c')](_0x452fb3[_0xae5d('0x32')],_0x3c034a[_0xae5d('0x33')]));if(_0x452fb3[_0xae5d('0x32')][_0xae5d('0x3d')]){_0x1bcf4c[_0xae5d('0x3b')]=_[_0xae5d('0x3e')](_0x1bcf4c[_0xae5d('0x3b')],{'$or':_[_0xae5d('0x2d')](_0x1bcf4c['attributes'],function(_0x55cf90){var _0x3adba9={};_0x3adba9[_0x55cf90]={'$like':'%'+_0x452fb3[_0xae5d('0x32')][_0xae5d('0x3d')]+'%'};return _0x3adba9;})});}_0x1bcf4c=_[_0xae5d('0x3e')]({},_0x1bcf4c,_0x452fb3[_0xae5d('0x40')]);return _0x46c016[_0xae5d('0x4e')](_0x1bcf4c);}})[_0xae5d('0x26')](function(_0x2d9488){if(_0x2d9488){_0x32774c=_0x2d9488[_0xae5d('0x37')];if(!_0x452fb3[_0xae5d('0x32')][_0xae5d('0x38')]('nolimit')){_0x1bcf4c['limit']=qs[_0xae5d('0x1f')](_0x452fb3[_0xae5d('0x32')]['limit']);_0x1bcf4c[_0xae5d('0x22')]=qs[_0xae5d('0x22')](_0x452fb3[_0xae5d('0x32')]['offset']);}return _0x46c016[_0xae5d('0x4e')](_0x1bcf4c);}})[_0xae5d('0x26')](function(_0x4d58ff){if(_0x4d58ff){return _0x4d58ff?{'count':_0x32774c,'rows':_0x4d58ff}:null;}})[_0xae5d('0x26')](respondWithResult(_0x45500c,null))[_0xae5d('0x48')](handleError(_0x45500c,null));};exports[_0xae5d('0x51')]=function(_0x1887f2,_0x2995c6,_0x337360){return db[_0xae5d('0x52')][_0xae5d('0x47')]({'where':{'id':_0x1887f2['params']['id']}})[_0xae5d('0x26')](handleEntityNotFound(_0x2995c6,null))[_0xae5d('0x26')](function(_0x5f3f9a){if(_0x5f3f9a){return _0x5f3f9a[_0xae5d('0x51')](_0x1887f2[_0xae5d('0x4a')][_0xae5d('0x4c')],_[_0xae5d('0x4d')](_0x1887f2[_0xae5d('0x4a')],['ids','id'])||{});}})[_0xae5d('0x26')](respondWithResult(_0x2995c6,null))[_0xae5d('0x48')](handleError(_0x2995c6,null));};exports[_0xae5d('0x53')]=function(_0x222247,_0x892881,_0x28c9d3){var _0x476f59={};var _0x1d43a6={};var _0x1083d7;var _0x2f085b;return db[_0xae5d('0x41')][_0xae5d('0x4f')]({'where':{'id':_0x222247[_0xae5d('0x46')]['id']}})['then'](handleEntityNotFound(_0x892881,null))['then'](function(_0x4f96b0){if(_0x4f96b0){_0x1083d7=_0x4f96b0;_0x1d43a6[_0xae5d('0x30')]=_[_0xae5d('0x31')](db[_0xae5d('0x52')][_0xae5d('0x54')]);_0x1d43a6[_0xae5d('0x32')]=_[_0xae5d('0x31')](_0x222247['query']);_0x1d43a6['filters']=_['intersection'](_0x1d43a6[_0xae5d('0x30')],_0x1d43a6[_0xae5d('0x32')]);_0x476f59['attributes']=_[_0xae5d('0x34')](_0x1d43a6[_0xae5d('0x30')],qs[_0xae5d('0x36')](_0x222247[_0xae5d('0x32')][_0xae5d('0x36')]));_0x476f59[_0xae5d('0x35')]=_0x476f59[_0xae5d('0x35')][_0xae5d('0x37')]?_0x476f59[_0xae5d('0x35')]:_0x1d43a6[_0xae5d('0x30')];_0x476f59[_0xae5d('0x55')]=qs['sort'](_0x222247['query'][_0xae5d('0x3a')]);_0x476f59[_0xae5d('0x3b')]=qs['filters'](_['pick'](_0x222247[_0xae5d('0x32')],_0x1d43a6[_0xae5d('0x33')]));if(_0x222247[_0xae5d('0x32')][_0xae5d('0x3d')]){_0x476f59[_0xae5d('0x3b')]=_[_0xae5d('0x3e')](_0x476f59[_0xae5d('0x3b')],{'$or':_['map'](_0x476f59[_0xae5d('0x35')],function(_0xfbae34){var _0x2c9a53={};_0x2c9a53[_0xfbae34]={'$like':'%'+_0x222247[_0xae5d('0x32')][_0xae5d('0x3d')]+'%'};return _0x2c9a53;})});}_0x476f59=_[_0xae5d('0x3e')]({},_0x476f59,_0x222247[_0xae5d('0x40')]);return _0x1083d7[_0xae5d('0x53')](_0x476f59);}})[_0xae5d('0x26')](function(_0x3a7d96){if(_0x3a7d96){_0x2f085b=_0x3a7d96[_0xae5d('0x37')];if(!_0x222247['query'][_0xae5d('0x38')](_0xae5d('0x39'))){_0x476f59[_0xae5d('0x1f')]=qs[_0xae5d('0x1f')](_0x222247[_0xae5d('0x32')][_0xae5d('0x1f')]);_0x476f59[_0xae5d('0x22')]=qs[_0xae5d('0x22')](_0x222247[_0xae5d('0x32')][_0xae5d('0x22')]);}return _0x1083d7[_0xae5d('0x53')](_0x476f59);}})['then'](function(_0x6b65ac){if(_0x6b65ac){return _0x6b65ac?{'count':_0x2f085b,'rows':_0x6b65ac}:null;}})[_0xae5d('0x26')](respondWithResult(_0x892881,null))['catch'](handleError(_0x892881,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 53c350a..3525404 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 _0x634d=['tools_automations','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x284ca5,_0x2ac104){var _0x2a8e36=function(_0x55b040){while(--_0x55b040){_0x284ca5['push'](_0x284ca5['shift']());}};_0x2a8e36(++_0x2ac104);}(_0x634d,0x91));var _0xd634=function(_0x36f1a9,_0x4ff6c0){_0x36f1a9=_0x36f1a9-0x0;var _0x12d802=_0x634d[_0x36f1a9];return _0x12d802;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xd634('0x0'));var BPromise=require('bluebird');var rp=require(_0xd634('0x1'));var fs=require('fs');var path=require(_0xd634('0x2'));var rimraf=require(_0xd634('0x3'));var config=require(_0xd634('0x4'));var attributes=require('./automation.attributes');module[_0xd634('0x5')]=function(_0x12142c,_0x32ca1f){return _0x12142c[_0xd634('0x6')]('Automation',attributes,{'tableName':_0xd634('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf72e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','lodash','../../config/logger'];(function(_0x25adb4,_0x5582f7){var _0x588c67=function(_0x2f5a56){while(--_0x2f5a56){_0x25adb4['push'](_0x25adb4['shift']());}};_0x588c67(++_0x5582f7);}(_0xf72e,0xa7));var _0xef72=function(_0x4f0c59,_0xdcce7d){_0x4f0c59=_0x4f0c59-0x0;var _0xa36d16=_0xf72e[_0x4f0c59];return _0xa36d16;};'use strict';var _=require(_0xef72('0x0'));var util=require('util');var logger=require(_0xef72('0x1'))('api');var moment=require(_0xef72('0x2'));var BPromise=require(_0xef72('0x3'));var rp=require(_0xef72('0x4'));var fs=require('fs');var path=require(_0xef72('0x5'));var rimraf=require(_0xef72('0x6'));var config=require(_0xef72('0x7'));var attributes=require(_0xef72('0x8'));module[_0xef72('0x9')]=function(_0x1129d8,_0x36f745){return _0x1129d8[_0xef72('0xa')](_0xef72('0xb'),attributes,{'tableName':_0xef72('0xc'),'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 de680d3..672c9ea 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 _0x20d8=['stringify','error','code','Automation,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent','Automation,\x20%s,\x20%s,\x20%s'];(function(_0x467efe,_0x18a682){var _0x2ba774=function(_0x15da4b){while(--_0x15da4b){_0x467efe['push'](_0x467efe['shift']());}};_0x2ba774(++_0x18a682);}(_0x20d8,0xee));var _0x820d=function(_0x192249,_0x59b0e0){_0x192249=_0x192249-0x0;var _0x37efc8=_0x20d8[_0x192249];return _0x37efc8;};'use strict';var _=require(_0x820d('0x0'));var util=require(_0x820d('0x1'));var moment=require(_0x820d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x820d('0x3'));var db=require(_0x820d('0x4'))['db'];var utils=require(_0x820d('0x5'));var logger=require(_0x820d('0x6'))(_0x820d('0x7'));var config=require('../../config/environment');var jayson=require(_0x820d('0x8'));var client=jayson[_0x820d('0x9')][_0x820d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e23e3,_0x435a84,_0xa2751d){return new BPromise(function(_0x3b084c,_0x485bde){return client[_0x820d('0xb')](_0x4e23e3,_0xa2751d)['then'](function(_0x45fdd7){logger['info']('Automation,\x20%s,\x20%s',_0x435a84,_0x820d('0xc'));logger['debug'](_0x820d('0xd'),_0x435a84,_0x820d('0xc'),JSON[_0x820d('0xe')](_0x45fdd7));if(_0x45fdd7['error']){if(_0x45fdd7[_0x820d('0xf')][_0x820d('0x10')]===0x1f4){logger['error'](_0x820d('0x11'),_0x435a84,_0x45fdd7['error'][_0x820d('0x12')]);return _0x485bde(_0x45fdd7[_0x820d('0xf')][_0x820d('0x12')]);}logger[_0x820d('0xf')](_0x820d('0x11'),_0x435a84,_0x45fdd7[_0x820d('0xf')]['message']);return _0x3b084c(_0x45fdd7['error'][_0x820d('0x12')]);}else{logger['info'](_0x820d('0x11'),_0x435a84,_0x820d('0xc'));_0x3b084c(_0x45fdd7[_0x820d('0x13')]['message']);}})[_0x820d('0x14')](function(_0x3466c1){logger[_0x820d('0xf')](_0x820d('0x11'),_0x435a84,_0x3466c1);_0x485bde(_0x3466c1);});});} \ No newline at end of file +var _0x0a48=['request','info','Automation,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0xdd40fb,_0xe18a2){var _0x360d68=function(_0x32c27f){while(--_0x32c27f){_0xdd40fb['push'](_0xdd40fb['shift']());}};_0x360d68(++_0xe18a2);}(_0x0a48,0x95));var _0x80a4=function(_0x130a52,_0x1880c9){_0x130a52=_0x130a52-0x0;var _0x6f239a=_0x0a48[_0x130a52];return _0x6f239a;};'use strict';var _=require(_0x80a4('0x0'));var util=require(_0x80a4('0x1'));var moment=require('moment');var BPromise=require(_0x80a4('0x2'));var rs=require(_0x80a4('0x3'));var fs=require('fs');var Redis=require(_0x80a4('0x4'));var db=require(_0x80a4('0x5'))['db'];var utils=require(_0x80a4('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x80a4('0x7'));var jayson=require(_0x80a4('0x8'));var client=jayson[_0x80a4('0x9')][_0x80a4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f3ac0,_0x3ccc33,_0x55bd77){return new BPromise(function(_0x5c7c37,_0x338d47){return client[_0x80a4('0xb')](_0x5f3ac0,_0x55bd77)['then'](function(_0x5dfe4a){logger[_0x80a4('0xc')](_0x80a4('0xd'),_0x3ccc33,_0x80a4('0xe'));logger[_0x80a4('0xf')]('Automation,\x20%s,\x20%s,\x20%s',_0x3ccc33,_0x80a4('0xe'),JSON['stringify'](_0x5dfe4a));if(_0x5dfe4a[_0x80a4('0x10')]){if(_0x5dfe4a['error'][_0x80a4('0x11')]===0x1f4){logger[_0x80a4('0x10')]('Automation,\x20%s,\x20%s',_0x3ccc33,_0x5dfe4a[_0x80a4('0x10')][_0x80a4('0x12')]);return _0x338d47(_0x5dfe4a[_0x80a4('0x10')][_0x80a4('0x12')]);}logger[_0x80a4('0x10')](_0x80a4('0xd'),_0x3ccc33,_0x5dfe4a[_0x80a4('0x10')]['message']);return _0x5c7c37(_0x5dfe4a['error'][_0x80a4('0x12')]);}else{logger[_0x80a4('0xc')](_0x80a4('0xd'),_0x3ccc33,_0x80a4('0xe'));_0x5c7c37(_0x5dfe4a['result'][_0x80a4('0x12')]);}})[_0x80a4('0x13')](function(_0x38ba44){logger[_0x80a4('0x10')](_0x80a4('0xd'),_0x3ccc33,_0x38ba44);_0x338d47(_0x38ba44);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index b43e298..ebce5bb 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 _0x3cb7=['post','create','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/conditions','getConditions','/:id/actions','getActions'];(function(_0x39f34f,_0x298f45){var _0x59fee1=function(_0x6ebbb7){while(--_0x6ebbb7){_0x39f34f['push'](_0x39f34f['shift']());}};_0x59fee1(++_0x298f45);}(_0x3cb7,0x1a8));var _0x73cb=function(_0x3b6648,_0x2d723a){_0x3b6648=_0x3b6648-0x0;var _0x5a0a0d=_0x3cb7[_0x3b6648];return _0x5a0a0d;};'use strict';var multer=require(_0x73cb('0x0'));var util=require(_0x73cb('0x1'));var path=require('path');var timeout=require(_0x73cb('0x2'));var express=require(_0x73cb('0x3'));var router=express[_0x73cb('0x4')]();var fs_extra=require(_0x73cb('0x5'));var auth=require(_0x73cb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x73cb('0x7'));var controller=require('./automation.controller');router[_0x73cb('0x8')]('/',auth[_0x73cb('0x9')](),controller[_0x73cb('0xa')]);router[_0x73cb('0x8')](_0x73cb('0xb'),auth[_0x73cb('0x9')](),controller['show']);router[_0x73cb('0x8')](_0x73cb('0xc'),auth[_0x73cb('0x9')](),controller[_0x73cb('0xd')]);router[_0x73cb('0x8')](_0x73cb('0xe'),auth[_0x73cb('0x9')](),controller[_0x73cb('0xf')]);router[_0x73cb('0x10')]('/',auth[_0x73cb('0x9')](),controller[_0x73cb('0x11')]);router[_0x73cb('0x10')](_0x73cb('0xc'),auth[_0x73cb('0x9')](),controller['addConditions']);router[_0x73cb('0x10')](_0x73cb('0xe'),auth[_0x73cb('0x9')](),controller['addActions']);router['put'](_0x73cb('0xb'),auth[_0x73cb('0x9')](),controller[_0x73cb('0x12')]);router['delete'](_0x73cb('0xb'),auth[_0x73cb('0x9')](),controller['destroy']);module[_0x73cb('0x13')]=router; \ No newline at end of file +var _0xfd28=['isAuthenticated','index','show','/:id/conditions','getConditions','/:id/actions','getActions','post','addConditions','addActions','put','/:id','update','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./automation.controller','get'];(function(_0x27b1f0,_0x3185ec){var _0x27cfec=function(_0x528dc3){while(--_0x528dc3){_0x27b1f0['push'](_0x27b1f0['shift']());}};_0x27cfec(++_0x3185ec);}(_0xfd28,0x148));var _0x8fd2=function(_0x1d70db,_0x142b63){_0x1d70db=_0x1d70db-0x0;var _0x3060c6=_0xfd28[_0x1d70db];return _0x3060c6;};'use strict';var multer=require('multer');var util=require(_0x8fd2('0x0'));var path=require(_0x8fd2('0x1'));var timeout=require('connect-timeout');var express=require(_0x8fd2('0x2'));var router=express['Router']();var fs_extra=require(_0x8fd2('0x3'));var auth=require(_0x8fd2('0x4'));var interaction=require(_0x8fd2('0x5'));var config=require('../../config/environment');var controller=require(_0x8fd2('0x6'));router[_0x8fd2('0x7')]('/',auth[_0x8fd2('0x8')](),controller[_0x8fd2('0x9')]);router[_0x8fd2('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x8fd2('0xa')]);router[_0x8fd2('0x7')](_0x8fd2('0xb'),auth['isAuthenticated'](),controller[_0x8fd2('0xc')]);router['get'](_0x8fd2('0xd'),auth['isAuthenticated'](),controller[_0x8fd2('0xe')]);router['post']('/',auth[_0x8fd2('0x8')](),controller['create']);router[_0x8fd2('0xf')]('/:id/conditions',auth[_0x8fd2('0x8')](),controller[_0x8fd2('0x10')]);router[_0x8fd2('0xf')](_0x8fd2('0xd'),auth[_0x8fd2('0x8')](),controller[_0x8fd2('0x11')]);router[_0x8fd2('0x12')](_0x8fd2('0x13'),auth[_0x8fd2('0x8')](),controller[_0x8fd2('0x14')]);router[_0x8fd2('0x15')](_0x8fd2('0x13'),auth[_0x8fd2('0x8')](),controller[_0x8fd2('0x16')]);module[_0x8fd2('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 94872d3..8c1b886 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 _0xf1cb=['name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING'];(function(_0x420990,_0x2031bd){var _0x533411=function(_0x42b118){while(--_0x42b118){_0x420990['push'](_0x420990['shift']());}};_0x533411(++_0x2031bd);}(_0xf1cb,0x6d));var _0xbf1c=function(_0x11c471,_0x1f9001){_0x11c471=_0x11c471-0x0;var _0x18285e=_0xf1cb[_0x11c471];return _0x18285e;};'use strict';var Sequelize=require(_0xbf1c('0x0'));module['exports']={'name':{'type':Sequelize[_0xbf1c('0x1')],'unique':_0xbf1c('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xbf1c('0x3')]('ivr'),'allowNull':![],'defaultValue':_0xbf1c('0x4')},'description':{'type':Sequelize[_0xbf1c('0x1')]},'active':{'type':Sequelize[_0xbf1c('0x5')],'defaultValue':0x0,'comment':_0xbf1c('0x6')},'limitCalls':{'type':Sequelize[_0xbf1c('0x7')](0x4)[_0xbf1c('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xbf1c('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0xbf1c('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xbf1c('0x7')](0x3)[_0xbf1c('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbf1c('0xa')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xbf1c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xbf1c('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbf1c('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xbf1c('0x7')](0x3)[_0xbf1c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xbf1c('0x7')](0x5)[_0xbf1c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbf1c('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xbf1c('0x7')](0x3)[_0xbf1c('0x8')],'defaultValue':0x3,'comment':_0xbf1c('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbf1c('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0xbf1c('0x7')](0x3)[_0xbf1c('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xbf1c('0xf')},'dialTimezone':{'type':Sequelize[_0xbf1c('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xbf1c('0x1')],'defaultValue':_0xbf1c('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xbf1c('0x3')](_0xbf1c('0x11'),_0xbf1c('0x12'),_0xbf1c('0x13')),'defaultValue':_0xbf1c('0x11')},'dialAMDActive':{'type':Sequelize[_0xbf1c('0x5')],'defaultValue':0x0,'comment':_0xbf1c('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0xbf1c('0x7')](0x9)[_0xbf1c('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xbf1c('0x15')},'dialAMDGreeting':{'type':Sequelize[_0xbf1c('0x7')](0x9)[_0xbf1c('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xbf1c('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xbf1c('0x7')](0x9)[_0xbf1c('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xbf1c('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xbf1c('0x7')](0x9)[_0xbf1c('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xbf1c('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0xbf1c('0x7')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xbf1c('0x7')](0x9)[_0xbf1c('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xbf1c('0x7')](0x9)[_0xbf1c('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xbf1c('0x7')](0x5)[_0xbf1c('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xbf1c('0x7')](0x9)[_0xbf1c('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xbf1c('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0xbf1c('0x3')](_0xbf1c('0x1a'),'ASC'),'defaultValue':_0xbf1c('0x1a')},'dialPrefix':{'type':Sequelize[_0xbf1c('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xbf1c('0x7')](0x3)[_0xbf1c('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbf1c('0x1b')},'dialCutDigit':{'type':Sequelize[_0xbf1c('0x7')](0x3)[_0xbf1c('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbf1c('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xbf1c('0x7')](0x3)[_0xbf1c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbf1c('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xbf1c('0x7')](0x5)[_0xbf1c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbf1c('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0xbf1c('0x7')](0x3)[_0xbf1c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbf1c('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0xbf1c('0x7')](0x5)[_0xbf1c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbf1c('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xbf1c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xbf1c('0x7')](0x5)[_0xbf1c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbf1c('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0xbf1c('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbf1c('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0xbf1c('0x7')](0x5)[_0xbf1c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xbf1c('0x7')](0x3)[_0xbf1c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbf1c('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbf1c('0x24')}}; \ No newline at end of file +var _0x3f75=['ASC','DESC','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','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\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length'];(function(_0x1dbd64,_0x2abb00){var _0x261351=function(_0x392b7a){while(--_0x392b7a){_0x1dbd64['push'](_0x1dbd64['shift']());}};_0x261351(++_0x2abb00);}(_0x3f75,0xc8));var _0x53f7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f75[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x53f7('0x0'));module['exports']={'name':{'type':Sequelize[_0x53f7('0x1')],'unique':_0x53f7('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x53f7('0x3')](_0x53f7('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x53f7('0x5')],'defaultValue':0x0,'comment':_0x53f7('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x53f7('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x53f7('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x53f7('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x53f7('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x53f7('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x53f7('0x9')](0x3)[_0x53f7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x53f7('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x53f7('0x9')](0x5)[_0x53f7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x53f7('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x53f7('0xb')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x53f7('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x53f7('0x9')](0x3)[_0x53f7('0x7')],'defaultValue':0x3,'comment':_0x53f7('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x53f7('0x9')](0x5)[_0x53f7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x53f7('0xe')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x53f7('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x53f7('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x53f7('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x53f7('0x3')](_0x53f7('0x10'),_0x53f7('0x11'),_0x53f7('0x12')),'defaultValue':_0x53f7('0x10')},'dialAMDActive':{'type':Sequelize[_0x53f7('0x5')],'defaultValue':0x0,'comment':_0x53f7('0x13')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x53f7('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x53f7('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x53f7('0x9')](0x9)[_0x53f7('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x53f7('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x53f7('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x53f7('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x53f7('0x9')](0x9)[_0x53f7('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x53f7('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x53f7('0x9')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x53f7('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x53f7('0x9')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x53f7('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x53f7('0x9')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x53f7('0x9')](0x5)[_0x53f7('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x53f7('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x53f7('0x9')](0x9)[_0x53f7('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x53f7('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x53f7('0x3')]('DESC',_0x53f7('0x1c')),'defaultValue':_0x53f7('0x1d')},'dialPrefix':{'type':Sequelize[_0x53f7('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x53f7('0x9')](0x3)[_0x53f7('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x53f7('0x9')](0x3)[_0x53f7('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x53f7('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x53f7('0x9')](0x3)[_0x53f7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x53f7('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x53f7('0x9')](0x5)[_0x53f7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x53f7('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0x53f7('0x9')](0x3)[_0x53f7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x53f7('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0x53f7('0x9')](0x5)[_0x53f7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x53f7('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x53f7('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x53f7('0x9')](0x5)[_0x53f7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x53f7('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0x53f7('0x9')](0x3)[_0x53f7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x53f7('0x9')](0x5)[_0x53f7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x53f7('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x53f7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x53f7('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x53f7('0x9')](0x5)[_0x53f7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 6d02b3e..29c7e0d 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 _0x66a4=['map','Campaign','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','userProfileId','UserProfileResource','clone','omit','createdAt','updatedAt','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','pick','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','insert','cm_hopper','fromQuery','phone','ContactId','ListId','select','field','NOW()','scheduledAt','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','toString','COALESCE(calleridnum,\x27\x27)','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','phone\x20IS\x20NOT\x20NULL','CampaignId\x20=\x20?','push','all','removeLists','getBlackLists','addBlackLists','into','cm_hopper_black','sequelize','removeBlackLists','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','get','end','error','stack','name','index'];(function(_0x4ce0fa,_0x42443b){var _0x1a2457=function(_0x4b19ee){while(--_0x4b19ee){_0x4ce0fa['push'](_0x4ce0fa['shift']());}};_0x1a2457(++_0x42443b);}(_0x66a4,0x161));var _0x466a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x66a4[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x466a('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x466a('0x1'));var BPromise=require(_0x466a('0x2'));var Mustache=require(_0x466a('0x3'));var util=require(_0x466a('0x4'));var path=require(_0x466a('0x5'));var sox=require(_0x466a('0x6'));var csv=require(_0x466a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x466a('0x8'));var squel=require('squel');var crypto=require(_0x466a('0x9'));var jsforce=require(_0x466a('0xa'));var deskjs=require(_0x466a('0xb'));var toCsv=require('to-csv');var querystring=require(_0x466a('0xc'));var Papa=require(_0x466a('0xd'));var Redis=require(_0x466a('0xe'));var authService=require(_0x466a('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x466a('0x10'));var logger=require(_0x466a('0x11'))('api');var utils=require(_0x466a('0x12'));var config=require(_0x466a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x466a('0x14'))['db'];function respondWithStatusCode(_0x47d3e9,_0x51b051){_0x51b051=_0x51b051||0xcc;return function(_0x119506){if(_0x119506){return _0x47d3e9[_0x466a('0x15')](_0x51b051);}return _0x47d3e9[_0x466a('0x16')](_0x51b051)['end']();};}function respondWithResult(_0x1069b9,_0x4635c3){_0x4635c3=_0x4635c3||0xc8;return function(_0xe3701){if(_0xe3701){return _0x1069b9[_0x466a('0x16')](_0x4635c3)[_0x466a('0x17')](_0xe3701);}};}function respondWithFilteredResult(_0x460c47,_0x42eea8){return function(_0x50e9fd){if(_0x50e9fd){var _0x3d6528=typeof _0x42eea8[_0x466a('0x18')]===_0x466a('0x19')&&typeof _0x42eea8[_0x466a('0x1a')]===_0x466a('0x19');var _0x43bacd=_0x50e9fd[_0x466a('0x1b')];var _0xa71cb7=_0x3d6528?0x0:_0x42eea8['offset'];var _0x197021=_0x3d6528?_0x50e9fd[_0x466a('0x1b')]:_0x42eea8[_0x466a('0x18')]+_0x42eea8[_0x466a('0x1a')];var _0x33910b;if(_0x197021>=_0x43bacd){_0x197021=_0x43bacd;_0x33910b=0xc8;}else{_0x33910b=0xce;}_0x460c47[_0x466a('0x16')](_0x33910b);return _0x460c47[_0x466a('0x1c')](_0x466a('0x1d'),_0xa71cb7+'-'+_0x197021+'/'+_0x43bacd)[_0x466a('0x17')](_0x50e9fd);}return null;};}function patchUpdates(_0x34ccf9){return function(_0x40b27f){try{jsonpatch['apply'](_0x40b27f,_0x34ccf9,!![]);}catch(_0x216d83){return BPromise['reject'](_0x216d83);}return _0x40b27f[_0x466a('0x1e')]();};}function saveUpdates(_0x51289f,_0x1dc4a4){return function(_0x417939){if(_0x417939){return _0x417939[_0x466a('0x1f')](_0x51289f)[_0x466a('0x20')](function(_0x480e27){return _0x480e27;});}return null;};}function removeEntity(_0x38d151,_0x1c471d){return function(_0x3d8df5){if(_0x3d8df5){return _0x3d8df5[_0x466a('0x21')]()[_0x466a('0x20')](function(){var _0x41ced6=_0x3d8df5[_0x466a('0x22')]({'plain':!![]});var _0x8c582b='IvrCampaigns';return db['UserProfileResource']['destroy']({'where':{'type':_0x8c582b,'resourceId':_0x41ced6['id']}})[_0x466a('0x20')](function(){return _0x3d8df5;});})[_0x466a('0x20')](function(){_0x38d151[_0x466a('0x16')](0xcc)[_0x466a('0x23')]();});}};}function handleEntityNotFound(_0x51cac7,_0x4964fa){return function(_0x174e6c){if(!_0x174e6c){_0x51cac7[_0x466a('0x15')](0x194);}return _0x174e6c;};}function handleError(_0x320cba,_0x50a2a4){_0x50a2a4=_0x50a2a4||0x1f4;return function(_0xe1cdbe){logger[_0x466a('0x24')](_0xe1cdbe[_0x466a('0x25')]);if(_0xe1cdbe['name']){delete _0xe1cdbe[_0x466a('0x26')];}_0x320cba[_0x466a('0x16')](_0x50a2a4)['send'](_0xe1cdbe);};}exports[_0x466a('0x27')]=function(_0x2b675a,_0x581dcc){var _0x15a9f8={},_0x5edc76={},_0x4a9f83={'count':0x0,'rows':[]};var _0x5e754b=_[_0x466a('0x28')](db[_0x466a('0x29')][_0x466a('0x2a')],function(_0x4788d9){return{'name':_0x4788d9[_0x466a('0x2b')],'type':_0x4788d9['type'][_0x466a('0x2c')]};});_0x5edc76[_0x466a('0x2d')]=_[_0x466a('0x28')](_0x5e754b,'name');_0x5edc76[_0x466a('0x2e')]=_['keys'](_0x2b675a['query']);_0x5edc76[_0x466a('0x2f')]=_[_0x466a('0x30')](_0x5edc76[_0x466a('0x2d')],_0x5edc76[_0x466a('0x2e')]);_0x15a9f8['attributes']=_[_0x466a('0x30')](_0x5edc76[_0x466a('0x2d')],qs[_0x466a('0x31')](_0x2b675a['query'][_0x466a('0x31')]));_0x15a9f8[_0x466a('0x32')]=_0x15a9f8[_0x466a('0x32')][_0x466a('0x33')]?_0x15a9f8['attributes']:_0x5edc76['model'];if(!_0x2b675a[_0x466a('0x2e')][_0x466a('0x34')](_0x466a('0x35'))){_0x15a9f8[_0x466a('0x1a')]=qs['limit'](_0x2b675a[_0x466a('0x2e')]['limit']);_0x15a9f8[_0x466a('0x18')]=qs[_0x466a('0x18')](_0x2b675a[_0x466a('0x2e')][_0x466a('0x18')]);}_0x15a9f8[_0x466a('0x36')]=qs[_0x466a('0x37')](_0x2b675a[_0x466a('0x2e')]['sort']);_0x15a9f8['where']=qs['filters'](_['pick'](_0x2b675a[_0x466a('0x2e')],_0x5edc76[_0x466a('0x2f')]),_0x5e754b);if(_0x2b675a['query']['filter']){_0x15a9f8[_0x466a('0x38')]=_[_0x466a('0x39')](_0x15a9f8[_0x466a('0x38')],{'$or':_[_0x466a('0x28')](_0x5e754b,function(_0x4753f8){if(_0x4753f8[_0x466a('0x3a')]!==_0x466a('0x3b')){var _0x2570f2={};_0x2570f2[_0x4753f8['name']]={'$like':'%'+_0x2b675a[_0x466a('0x2e')][_0x466a('0x3c')]+'%'};return _0x2570f2;}})});}_0x15a9f8=_[_0x466a('0x39')]({},_0x15a9f8,_0x2b675a[_0x466a('0x3d')]);var _0x41a272={'where':_0x15a9f8['where']};return db[_0x466a('0x29')][_0x466a('0x1b')](_0x41a272)['then'](function(_0x424b12){_0x4a9f83[_0x466a('0x1b')]=_0x424b12;if(_0x2b675a['query'][_0x466a('0x3e')]){_0x15a9f8[_0x466a('0x3f')]=[{'all':!![]}];}return db[_0x466a('0x29')][_0x466a('0x40')](_0x15a9f8);})['then'](function(_0x29e1a3){_0x4a9f83[_0x466a('0x41')]=_0x29e1a3;return _0x4a9f83;})[_0x466a('0x20')](respondWithFilteredResult(_0x581dcc,_0x15a9f8))[_0x466a('0x42')](handleError(_0x581dcc,null));};exports[_0x466a('0x43')]=function(_0x4c1ee5,_0xb2809d){var _0x495c12={'raw':![],'where':{'id':_0x4c1ee5[_0x466a('0x44')]['id']}},_0x5ba6a7={};_0x5ba6a7[_0x466a('0x2d')]=_['keys'](db[_0x466a('0x29')][_0x466a('0x2a')]);_0x5ba6a7[_0x466a('0x2e')]=_[_0x466a('0x45')](_0x4c1ee5[_0x466a('0x2e')]);_0x5ba6a7['filters']=_[_0x466a('0x30')](_0x5ba6a7[_0x466a('0x2d')],_0x5ba6a7[_0x466a('0x2e')]);_0x495c12[_0x466a('0x32')]=_[_0x466a('0x30')](_0x5ba6a7[_0x466a('0x2d')],qs[_0x466a('0x31')](_0x4c1ee5['query'][_0x466a('0x31')]));_0x495c12[_0x466a('0x32')]=_0x495c12[_0x466a('0x32')]['length']?_0x495c12[_0x466a('0x32')]:_0x5ba6a7[_0x466a('0x2d')];if(_0x4c1ee5[_0x466a('0x2e')]['includeAll']){_0x495c12[_0x466a('0x3f')]=[{'all':!![]}];}_0x495c12=_[_0x466a('0x39')]({},_0x495c12,_0x4c1ee5[_0x466a('0x3d')]);return db[_0x466a('0x29')][_0x466a('0x46')](_0x495c12)[_0x466a('0x20')](handleEntityNotFound(_0xb2809d,null))[_0x466a('0x20')](respondWithResult(_0xb2809d,null))[_0x466a('0x42')](handleError(_0xb2809d,null));};exports[_0x466a('0x47')]=function(_0x627b93,_0xd473d2){return db[_0x466a('0x29')][_0x466a('0x47')](_0x627b93[_0x466a('0x48')],{})[_0x466a('0x20')](function(_0x4aa6cd){var _0x7abe2=_0x627b93['user']['get']({'plain':!![]});if(!_0x7abe2)throw new Error(_0x466a('0x49'));if(_0x7abe2[_0x466a('0x4a')]==='user'){var _0x56ee30=_0x4aa6cd[_0x466a('0x22')]({'plain':!![]});var _0x5f141d=_0x466a('0x4b');return db[_0x466a('0x4c')]['find']({'where':{'name':_0x5f141d,'userProfileId':_0x7abe2[_0x466a('0x4d')]},'raw':!![]})[_0x466a('0x20')](function(_0x1c8083){if(_0x1c8083&&_0x1c8083['autoAssociation']===0x0){return db[_0x466a('0x4e')][_0x466a('0x47')]({'name':_0x56ee30[_0x466a('0x26')],'resourceId':_0x56ee30['id'],'type':_0x1c8083['name'],'sectionId':_0x1c8083['id']},{})[_0x466a('0x20')](function(){return _0x4aa6cd;});}else{return _0x4aa6cd;}})[_0x466a('0x42')](function(_0x2cbbb4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2cbbb4);throw _0x2cbbb4;});}return _0x4aa6cd;})[_0x466a('0x20')](respondWithResult(_0xd473d2,0xc9))[_0x466a('0x42')](handleError(_0xd473d2,null));};exports[_0x466a('0x4f')]=function(_0x396164,_0x3e3ff1){var _0x402fdb={'where':{'id':_0x396164[_0x466a('0x44')]['id']}},_0xfe14d5={};_0xfe14d5[_0x466a('0x2d')]=_[_0x466a('0x45')](db['Campaign'][_0x466a('0x2a')]);_0x402fdb['attributes']=_['intersection'](_0xfe14d5[_0x466a('0x2d')],qs[_0x466a('0x31')](_0x396164[_0x466a('0x2e')][_0x466a('0x31')]));_0x402fdb[_0x466a('0x32')]=_0x402fdb['attributes'][_0x466a('0x33')]?_0x402fdb[_0x466a('0x32')]:_0xfe14d5[_0x466a('0x2d')];if(_0x396164[_0x466a('0x2e')][_0x466a('0x3e')]){_0x402fdb[_0x466a('0x3f')]=[{'all':!![]}];}_0x402fdb=_[_0x466a('0x39')]({},_0x402fdb,_0x396164[_0x466a('0x3d')]);return db[_0x466a('0x29')][_0x466a('0x46')](_0x402fdb)[_0x466a('0x20')](handleEntityNotFound(_0x3e3ff1,null))[_0x466a('0x20')](function(_0x17e875){if(_0x17e875){var _0x24afdd=_0x17e875['get']({'plain':!![]});_0x24afdd=qs[_0x466a('0x50')](_0x24afdd,['id',_0x466a('0x51'),'updatedAt']);_0x396164['body']=_['omit'](_0x396164[_0x466a('0x48')],['id',_0x466a('0x51'),_0x466a('0x52')]);return db[_0x466a('0x29')][_0x466a('0x47')](_[_0x466a('0x39')](_0x24afdd,_0x396164['body']),{'include':_0x396164[_0x466a('0x2e')][_0x466a('0x3e')]?[{'all':!![]}]:undefined})['then'](function(_0x3046a3){var _0x41cc6c=_0x396164['user']['get']({'plain':!![]});if(!_0x41cc6c)throw new Error(_0x466a('0x49'));if(_0x41cc6c['role']===_0x466a('0x53')){var _0xd02bca=_0x3046a3[_0x466a('0x22')]({'plain':!![]});var _0x23549f=_0x466a('0x4b');return db[_0x466a('0x4c')][_0x466a('0x46')]({'where':{'name':_0x23549f,'userProfileId':_0x41cc6c[_0x466a('0x4d')]},'raw':!![]})['then'](function(_0x37d4d7){if(_0x37d4d7&&_0x37d4d7[_0x466a('0x54')]===0x0){return db[_0x466a('0x4e')][_0x466a('0x47')]({'name':_0xd02bca[_0x466a('0x26')],'resourceId':_0xd02bca['id'],'type':_0x37d4d7[_0x466a('0x26')],'sectionId':_0x37d4d7['id']},{})[_0x466a('0x20')](function(){return _0x3046a3;});}else{return _0x3046a3;}})[_0x466a('0x42')](function(_0x1b22b2){logger[_0x466a('0x24')](_0x466a('0x55'),_0x1b22b2);throw _0x1b22b2;});}return _0x3046a3;});}})['then'](respondWithResult(_0x3e3ff1,0xc9))[_0x466a('0x42')](handleError(_0x3e3ff1,null));};exports['update']=function(_0x5927b4,_0x1e86cb){if(_0x5927b4[_0x466a('0x48')]['id']){delete _0x5927b4['body']['id'];}return db[_0x466a('0x29')][_0x466a('0x46')]({'where':{'id':_0x5927b4[_0x466a('0x44')]['id']}})[_0x466a('0x20')](handleEntityNotFound(_0x1e86cb,null))[_0x466a('0x20')](saveUpdates(_0x5927b4['body'],null))[_0x466a('0x20')](respondWithResult(_0x1e86cb,null))[_0x466a('0x42')](handleError(_0x1e86cb,null));};exports[_0x466a('0x21')]=function(_0x244b3f,_0x5d98a1){return db['Campaign']['find']({'where':{'id':_0x244b3f['params']['id']}})[_0x466a('0x20')](handleEntityNotFound(_0x5d98a1,null))[_0x466a('0x20')](removeEntity(_0x5d98a1,null))[_0x466a('0x42')](handleError(_0x5d98a1,null));};exports[_0x466a('0x56')]=function(_0x25a0a2,_0x2edf30,_0x428df3){var _0x2a2961={'raw':!![],'where':{}};var _0x1e82bd={};var _0x13bb13={'count':0x0,'rows':[]};return db[_0x466a('0x29')][_0x466a('0x57')]({'where':{'id':_0x25a0a2[_0x466a('0x44')]['id']}})[_0x466a('0x20')](handleEntityNotFound(_0x2edf30,null))[_0x466a('0x20')](function(_0x552ab8){if(_0x552ab8){_0x1e82bd[_0x466a('0x2d')]=_['keys'](db[_0x466a('0x58')]['rawAttributes']);_0x1e82bd['query']=_['keys'](_0x25a0a2['query']);_0x1e82bd[_0x466a('0x2f')]=_[_0x466a('0x30')](_0x1e82bd[_0x466a('0x2d')],_0x1e82bd[_0x466a('0x2e')]);_0x2a2961[_0x466a('0x32')]=_['intersection'](_0x1e82bd['model'],qs['fields'](_0x25a0a2[_0x466a('0x2e')][_0x466a('0x31')]));_0x2a2961[_0x466a('0x32')]=_0x2a2961[_0x466a('0x32')][_0x466a('0x33')]?_0x2a2961[_0x466a('0x32')]:_0x1e82bd['model'];if(!_0x25a0a2[_0x466a('0x2e')][_0x466a('0x34')]('nolimit')){_0x2a2961[_0x466a('0x1a')]=qs[_0x466a('0x1a')](_0x25a0a2['query'][_0x466a('0x1a')]);_0x2a2961[_0x466a('0x18')]=qs['offset'](_0x25a0a2[_0x466a('0x2e')][_0x466a('0x18')]);}_0x2a2961[_0x466a('0x36')]=qs['sort'](_0x25a0a2['query'][_0x466a('0x37')]);_0x2a2961[_0x466a('0x38')]=qs[_0x466a('0x2f')](_[_0x466a('0x59')](_0x25a0a2[_0x466a('0x2e')],_0x1e82bd[_0x466a('0x2f')]));_0x2a2961[_0x466a('0x38')][_0x466a('0x5a')]=_0x552ab8['id'];if(_0x25a0a2['query'][_0x466a('0x3c')]){_0x2a2961[_0x466a('0x38')]=_['merge'](_0x2a2961['where'],{'$or':_['map'](_0x2a2961[_0x466a('0x32')],function(_0x2dbc14){var _0x4c74e5={};_0x4c74e5[_0x2dbc14]={'$like':'%'+_0x25a0a2[_0x466a('0x2e')][_0x466a('0x3c')]+'%'};return _0x4c74e5;})});}_0x2a2961=_[_0x466a('0x39')]({},_0x2a2961,_0x25a0a2[_0x466a('0x3d')]);return db[_0x466a('0x58')]['count']({'where':_0x2a2961[_0x466a('0x38')]})[_0x466a('0x20')](function(_0x5b676c){_0x13bb13[_0x466a('0x1b')]=_0x5b676c;if(_0x25a0a2[_0x466a('0x2e')]['includeAll']){_0x2a2961['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x2a2961);})['then'](function(_0x4d81a0){_0x13bb13[_0x466a('0x41')]=_0x4d81a0;return _0x13bb13;});}})[_0x466a('0x20')](respondWithFilteredResult(_0x2edf30,_0x2a2961))[_0x466a('0x42')](handleError(_0x2edf30,null));};exports[_0x466a('0x5b')]=function(_0x3e2b3c,_0x227295,_0x41e2bc){var _0x2716da={'raw':!![],'where':{}};var _0x25e2c5={};var _0x50cda8={'count':0x0,'rows':[]};return db[_0x466a('0x29')][_0x466a('0x57')]({'where':{'id':_0x3e2b3c[_0x466a('0x44')]['id']}})[_0x466a('0x20')](handleEntityNotFound(_0x227295,null))[_0x466a('0x20')](function(_0x20aa66){if(_0x20aa66){_0x25e2c5[_0x466a('0x2d')]=_[_0x466a('0x45')](db[_0x466a('0x5c')][_0x466a('0x2a')]);_0x25e2c5[_0x466a('0x2e')]=_[_0x466a('0x45')](_0x3e2b3c[_0x466a('0x2e')]);_0x25e2c5[_0x466a('0x2f')]=_[_0x466a('0x30')](_0x25e2c5['model'],_0x25e2c5[_0x466a('0x2e')]);_0x2716da['attributes']=_[_0x466a('0x30')](_0x25e2c5[_0x466a('0x2d')],qs[_0x466a('0x31')](_0x3e2b3c['query'][_0x466a('0x31')]));_0x2716da[_0x466a('0x32')]=_0x2716da[_0x466a('0x32')][_0x466a('0x33')]?_0x2716da[_0x466a('0x32')]:_0x25e2c5[_0x466a('0x2d')];if(!_0x3e2b3c['query'][_0x466a('0x34')](_0x466a('0x35'))){_0x2716da[_0x466a('0x1a')]=qs['limit'](_0x3e2b3c[_0x466a('0x2e')][_0x466a('0x1a')]);_0x2716da[_0x466a('0x18')]=qs[_0x466a('0x18')](_0x3e2b3c['query']['offset']);}_0x2716da[_0x466a('0x36')]=qs[_0x466a('0x37')](_0x3e2b3c['query'][_0x466a('0x37')]);_0x2716da['where']=qs[_0x466a('0x2f')](_[_0x466a('0x59')](_0x3e2b3c['query'],_0x25e2c5[_0x466a('0x2f')]));_0x2716da[_0x466a('0x38')]['CampaignId']=_0x20aa66['id'];if(_0x3e2b3c['query'][_0x466a('0x3c')]){_0x2716da[_0x466a('0x38')]=_[_0x466a('0x39')](_0x2716da['where'],{'$or':_[_0x466a('0x28')](_0x2716da[_0x466a('0x32')],function(_0x320028){var _0x5a2399={};_0x5a2399[_0x320028]={'$like':'%'+_0x3e2b3c['query'][_0x466a('0x3c')]+'%'};return _0x5a2399;})});}_0x2716da=_[_0x466a('0x39')]({},_0x2716da,_0x3e2b3c[_0x466a('0x3d')]);return db['CmHopperHistory'][_0x466a('0x1b')]({'where':_0x2716da[_0x466a('0x38')]})[_0x466a('0x20')](function(_0x4e0909){_0x50cda8[_0x466a('0x1b')]=_0x4e0909;if(_0x3e2b3c[_0x466a('0x2e')][_0x466a('0x3e')]){_0x2716da[_0x466a('0x3f')]=[{'all':!![]}];}return db[_0x466a('0x5c')][_0x466a('0x40')](_0x2716da);})['then'](function(_0x5f5845){_0x50cda8['rows']=_0x5f5845;return _0x50cda8;});}})[_0x466a('0x20')](respondWithFilteredResult(_0x227295,_0x2716da))[_0x466a('0x42')](handleError(_0x227295,null));};exports[_0x466a('0x5d')]=function(_0x17658d,_0x4d2974,_0x18e0e6){var _0x15479c={'raw':!![],'where':{}};var _0x5da76a={};var _0x3bf3ae={'count':0x0,'rows':[]};return db[_0x466a('0x29')][_0x466a('0x57')]({'where':{'id':_0x17658d[_0x466a('0x44')]['id']}})[_0x466a('0x20')](handleEntityNotFound(_0x4d2974,null))[_0x466a('0x20')](function(_0x4b22a3){if(_0x4b22a3){_0x5da76a[_0x466a('0x2d')]=_[_0x466a('0x45')](db[_0x466a('0x5e')]['rawAttributes']);_0x5da76a[_0x466a('0x2e')]=_['keys'](_0x17658d['query']);_0x5da76a[_0x466a('0x2f')]=_[_0x466a('0x30')](_0x5da76a['model'],_0x5da76a['query']);_0x15479c[_0x466a('0x32')]=_[_0x466a('0x30')](_0x5da76a[_0x466a('0x2d')],qs[_0x466a('0x31')](_0x17658d[_0x466a('0x2e')][_0x466a('0x31')]));_0x15479c[_0x466a('0x32')]=_0x15479c[_0x466a('0x32')][_0x466a('0x33')]?_0x15479c[_0x466a('0x32')]:_0x5da76a[_0x466a('0x2d')];if(!_0x17658d[_0x466a('0x2e')][_0x466a('0x34')](_0x466a('0x35'))){_0x15479c[_0x466a('0x1a')]=qs[_0x466a('0x1a')](_0x17658d[_0x466a('0x2e')][_0x466a('0x1a')]);_0x15479c[_0x466a('0x18')]=qs[_0x466a('0x18')](_0x17658d[_0x466a('0x2e')][_0x466a('0x18')]);}_0x15479c['order']=qs[_0x466a('0x37')](_0x17658d['query'][_0x466a('0x37')]);_0x15479c[_0x466a('0x38')]=qs[_0x466a('0x2f')](_['pick'](_0x17658d[_0x466a('0x2e')],_0x5da76a['filters']));_0x15479c[_0x466a('0x38')][_0x466a('0x5a')]=_0x4b22a3['id'];if(_0x17658d['query'][_0x466a('0x3c')]){_0x15479c[_0x466a('0x38')]=_[_0x466a('0x39')](_0x15479c[_0x466a('0x38')],{'$or':_[_0x466a('0x28')](_0x15479c[_0x466a('0x32')],function(_0x1176e7){var _0x5cde25={};_0x5cde25[_0x1176e7]={'$like':'%'+_0x17658d[_0x466a('0x2e')]['filter']+'%'};return _0x5cde25;})});}_0x15479c=_[_0x466a('0x39')]({},_0x15479c,_0x17658d['options']);return db[_0x466a('0x5e')][_0x466a('0x1b')]({'where':_0x15479c['where']})[_0x466a('0x20')](function(_0x159200){_0x3bf3ae[_0x466a('0x1b')]=_0x159200;if(_0x17658d[_0x466a('0x2e')][_0x466a('0x3e')]){_0x15479c[_0x466a('0x3f')]=[{'all':!![]}];}return db[_0x466a('0x5e')]['findAll'](_0x15479c);})[_0x466a('0x20')](function(_0xcd6449){_0x3bf3ae[_0x466a('0x41')]=_0xcd6449;return _0x3bf3ae;});}})[_0x466a('0x20')](respondWithFilteredResult(_0x4d2974,_0x15479c))[_0x466a('0x42')](handleError(_0x4d2974,null));};exports['getHopperBlacks']=function(_0x3633d5,_0x7fec4e,_0x217809){var _0x1509f7={'raw':!![],'where':{}};var _0x37b6b3={};var _0x4fdc40={'count':0x0,'rows':[]};return db['Campaign'][_0x466a('0x57')]({'where':{'id':_0x3633d5[_0x466a('0x44')]['id']}})[_0x466a('0x20')](handleEntityNotFound(_0x7fec4e,null))[_0x466a('0x20')](function(_0x6038f7){if(_0x6038f7){_0x37b6b3[_0x466a('0x2d')]=_[_0x466a('0x45')](db[_0x466a('0x5f')][_0x466a('0x2a')]);_0x37b6b3[_0x466a('0x2e')]=_[_0x466a('0x45')](_0x3633d5[_0x466a('0x2e')]);_0x37b6b3[_0x466a('0x2f')]=_[_0x466a('0x30')](_0x37b6b3['model'],_0x37b6b3['query']);_0x1509f7['attributes']=_[_0x466a('0x30')](_0x37b6b3[_0x466a('0x2d')],qs[_0x466a('0x31')](_0x3633d5[_0x466a('0x2e')]['fields']));_0x1509f7['attributes']=_0x1509f7[_0x466a('0x32')][_0x466a('0x33')]?_0x1509f7[_0x466a('0x32')]:_0x37b6b3[_0x466a('0x2d')];if(!_0x3633d5['query']['hasOwnProperty']('nolimit')){_0x1509f7['limit']=qs[_0x466a('0x1a')](_0x3633d5[_0x466a('0x2e')][_0x466a('0x1a')]);_0x1509f7['offset']=qs[_0x466a('0x18')](_0x3633d5[_0x466a('0x2e')]['offset']);}_0x1509f7['order']=qs[_0x466a('0x37')](_0x3633d5[_0x466a('0x2e')]['sort']);_0x1509f7[_0x466a('0x38')]=qs[_0x466a('0x2f')](_[_0x466a('0x59')](_0x3633d5[_0x466a('0x2e')],_0x37b6b3[_0x466a('0x2f')]));_0x1509f7[_0x466a('0x38')][_0x466a('0x5a')]=_0x6038f7['id'];if(_0x3633d5[_0x466a('0x2e')][_0x466a('0x3c')]){_0x1509f7['where']=_[_0x466a('0x39')](_0x1509f7[_0x466a('0x38')],{'$or':_['map'](_0x1509f7[_0x466a('0x32')],function(_0x18eb6a){var _0x21a260={};_0x21a260[_0x18eb6a]={'$like':'%'+_0x3633d5['query'][_0x466a('0x3c')]+'%'};return _0x21a260;})});}_0x1509f7=_['merge']({},_0x1509f7,_0x3633d5[_0x466a('0x3d')]);return db[_0x466a('0x5f')]['count']({'where':_0x1509f7[_0x466a('0x38')]})['then'](function(_0x36defa){_0x4fdc40[_0x466a('0x1b')]=_0x36defa;if(_0x3633d5[_0x466a('0x2e')][_0x466a('0x3e')]){_0x1509f7[_0x466a('0x3f')]=[{'all':!![]}];}return db[_0x466a('0x5f')][_0x466a('0x40')](_0x1509f7);})[_0x466a('0x20')](function(_0x25c65c){_0x4fdc40[_0x466a('0x41')]=_0x25c65c;return _0x4fdc40;});}})[_0x466a('0x20')](respondWithFilteredResult(_0x7fec4e,_0x1509f7))['catch'](handleError(_0x7fec4e,null));};exports[_0x466a('0x60')]=function(_0x47b5aa,_0x125741,_0x590b23){var _0x2403f1={};var _0x3e3ce8={};var _0x19a85b;var _0x1bac1a;return db[_0x466a('0x29')][_0x466a('0x57')]({'where':{'id':_0x47b5aa[_0x466a('0x44')]['id']}})[_0x466a('0x20')](handleEntityNotFound(_0x125741,null))['then'](function(_0x4796dd){if(_0x4796dd){_0x19a85b=_0x4796dd;_0x3e3ce8[_0x466a('0x2d')]=_[_0x466a('0x45')](db['CmList'][_0x466a('0x2a')]);_0x3e3ce8[_0x466a('0x2e')]=_[_0x466a('0x45')](_0x47b5aa[_0x466a('0x2e')]);_0x3e3ce8['filters']=_['intersection'](_0x3e3ce8[_0x466a('0x2d')],_0x3e3ce8['query']);_0x2403f1[_0x466a('0x32')]=_[_0x466a('0x30')](_0x3e3ce8[_0x466a('0x2d')],qs[_0x466a('0x31')](_0x47b5aa[_0x466a('0x2e')][_0x466a('0x31')]));_0x2403f1[_0x466a('0x32')]=_0x2403f1[_0x466a('0x32')][_0x466a('0x33')]?_0x2403f1[_0x466a('0x32')]:_0x3e3ce8[_0x466a('0x2d')];_0x2403f1[_0x466a('0x36')]=qs['sort'](_0x47b5aa['query'][_0x466a('0x37')]);_0x2403f1[_0x466a('0x38')]=qs['filters'](_[_0x466a('0x59')](_0x47b5aa[_0x466a('0x2e')],_0x3e3ce8[_0x466a('0x2f')]));if(_0x47b5aa['query'][_0x466a('0x3c')]){_0x2403f1[_0x466a('0x38')]=_['merge'](_0x2403f1[_0x466a('0x38')],{'$or':_[_0x466a('0x28')](_0x2403f1[_0x466a('0x32')],function(_0x3dfbef){var _0x30d7b2={};_0x30d7b2[_0x3dfbef]={'$like':'%'+_0x47b5aa[_0x466a('0x2e')][_0x466a('0x3c')]+'%'};return _0x30d7b2;})});}_0x2403f1=_[_0x466a('0x39')]({},_0x2403f1,_0x47b5aa[_0x466a('0x3d')]);return _0x19a85b[_0x466a('0x60')](_0x2403f1);}})[_0x466a('0x20')](function(_0x5b02d1){if(_0x5b02d1){_0x1bac1a=_0x5b02d1[_0x466a('0x33')];if(!_0x47b5aa[_0x466a('0x2e')][_0x466a('0x34')](_0x466a('0x35'))){_0x2403f1[_0x466a('0x1a')]=qs[_0x466a('0x1a')](_0x47b5aa['query']['limit']);_0x2403f1['offset']=qs[_0x466a('0x18')](_0x47b5aa[_0x466a('0x2e')][_0x466a('0x18')]);}return _0x19a85b[_0x466a('0x60')](_0x2403f1);}})[_0x466a('0x20')](function(_0x3d0edf){if(_0x3d0edf){return _0x3d0edf?{'count':_0x1bac1a,'rows':_0x3d0edf}:null;}})[_0x466a('0x20')](respondWithResult(_0x125741,null))['catch'](handleError(_0x125741,null));};exports[_0x466a('0x61')]=function(_0x4be424,_0x38bb7e,_0x549ff5){var _0x2636f2,_0x3d794b;return db[_0x466a('0x29')]['find']({'where':{'id':_0x4be424[_0x466a('0x44')]['id']}})[_0x466a('0x20')](handleEntityNotFound(_0x38bb7e,null))[_0x466a('0x20')](function(_0x5248ab){if(_0x5248ab){_0x3d794b=_0x5248ab;return _0x5248ab[_0x466a('0x61')](_0x4be424[_0x466a('0x48')][_0x466a('0x62')],_[_0x466a('0x50')](_0x4be424[_0x466a('0x48')],[_0x466a('0x62'),'id'])||{});}return null;})[_0x466a('0x63')](function(_0x484aae){var _0x287c3b;_0x2636f2=_0x484aae||[];var _0x465528=[];if(_0x484aae){for(var _0x52a09a=0x0;_0x52a09a<_0x484aae[_0x466a('0x33')];_0x52a09a+=0x1){var _0x4f32eb=_0x484aae[_0x52a09a][_0x466a('0x22')]({'plain':!![]});_0x3d794b['dialCheckDuplicateType']=_0x4be424[_0x466a('0x48')][_0x466a('0x64')]?_0x4be424[_0x466a('0x48')][_0x466a('0x64')]:_0x3d794b[_0x466a('0x64')];switch(_0x3d794b['dialCheckDuplicateType']){case'always':_0x287c3b=squel[_0x466a('0x65')]()['into'](_0x466a('0x66'))[_0x466a('0x67')]([_0x466a('0x68'),'scheduledAt',_0x466a('0x69'),_0x466a('0x6a'),_0x466a('0x5a'),_0x466a('0x51'),_0x466a('0x52')],squel[_0x466a('0x6b')]()[_0x466a('0x6c')](_0x466a('0x68'),_0x466a('0x68'))['field'](_0x466a('0x6d'),_0x466a('0x6e'))['field']('id',_0x466a('0x69'))['field'](_0x4f32eb[_0x466a('0x6f')]['toString'](),_0x466a('0x6a'))[_0x466a('0x6c')](_0x4be424[_0x466a('0x44')]['id']['toString'](),'CampaignId')[_0x466a('0x6c')]('NOW()',_0x466a('0x51'))[_0x466a('0x6c')](_0x466a('0x6d'),_0x466a('0x52'))[_0x466a('0x70')](_0x466a('0x71'))[_0x466a('0x38')](_0x466a('0x72'))[_0x466a('0x38')](_0x466a('0x73'),_0x4f32eb[_0x466a('0x6f')][_0x466a('0x74')]())[_0x466a('0x38')]('phone\x20IS\x20NOT\x20NULL')[_0x466a('0x38')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x466a('0x6c')](_0x466a('0x75'))['from']('cm_hopper_final')['where']('CampaignId\x20=\x20?',_0x4be424[_0x466a('0x44')]['id']['toString']()))['where'](_0x466a('0x76'),squel[_0x466a('0x6b')]()[_0x466a('0x6c')]('COALESCE(phone,\x27\x27)')[_0x466a('0x70')](_0x466a('0x66'))[_0x466a('0x38')]('CampaignId\x20=\x20?',_0x4be424[_0x466a('0x44')]['id'][_0x466a('0x74')]())))[_0x466a('0x74')]();break;case _0x466a('0x77'):_0x287c3b=squel[_0x466a('0x65')]()['into'](_0x466a('0x66'))[_0x466a('0x67')]([_0x466a('0x68'),_0x466a('0x6e'),_0x466a('0x69'),_0x466a('0x6a'),_0x466a('0x5a'),'createdAt',_0x466a('0x52')],squel[_0x466a('0x6b')]()[_0x466a('0x6c')](_0x466a('0x68'),_0x466a('0x68'))[_0x466a('0x6c')](_0x466a('0x6d'),_0x466a('0x6e'))['field']('id','ContactId')[_0x466a('0x6c')](_0x4f32eb[_0x466a('0x6f')][_0x466a('0x74')](),_0x466a('0x6a'))['field'](_0x4be424[_0x466a('0x44')]['id']['toString'](),'CampaignId')['field'](_0x466a('0x6d'),_0x466a('0x51'))[_0x466a('0x6c')](_0x466a('0x6d'),_0x466a('0x52'))[_0x466a('0x70')](_0x466a('0x71'))[_0x466a('0x38')](_0x466a('0x72'))['where'](_0x466a('0x73'),_0x4f32eb['CmListId']['toString']())[_0x466a('0x38')](_0x466a('0x78'))[_0x466a('0x38')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x466a('0x6c')]('COALESCE(phone,\x27\x27)')['from'](_0x466a('0x66'))['where'](_0x466a('0x79'),_0x4be424['params']['id'][_0x466a('0x74')]())))[_0x466a('0x74')]();break;default:_0x287c3b=squel[_0x466a('0x65')]()['into'](_0x466a('0x66'))[_0x466a('0x67')]([_0x466a('0x68'),_0x466a('0x6e'),_0x466a('0x69'),_0x466a('0x6a'),_0x466a('0x5a'),_0x466a('0x51'),_0x466a('0x52')],squel['select']()[_0x466a('0x6c')](_0x466a('0x68'),_0x466a('0x68'))[_0x466a('0x6c')]('NOW()',_0x466a('0x6e'))[_0x466a('0x6c')]('id',_0x466a('0x69'))[_0x466a('0x6c')](_0x4f32eb[_0x466a('0x6f')][_0x466a('0x74')](),_0x466a('0x6a'))[_0x466a('0x6c')](_0x4be424[_0x466a('0x44')]['id'][_0x466a('0x74')](),_0x466a('0x5a'))['field']('NOW()',_0x466a('0x51'))[_0x466a('0x6c')](_0x466a('0x6d'),_0x466a('0x52'))[_0x466a('0x70')]('cm_contacts')[_0x466a('0x38')]('deletedAt\x20IS\x20NULL')[_0x466a('0x38')](_0x466a('0x73'),_0x4f32eb[_0x466a('0x6f')][_0x466a('0x74')]())[_0x466a('0x38')](_0x466a('0x78')))['toString']();}_0x465528[_0x466a('0x7a')](db['sequelize'][_0x466a('0x2e')](_0x287c3b));}return BPromise[_0x466a('0x7b')](_0x465528);}})[_0x466a('0x20')](function(){return _0x2636f2;})[_0x466a('0x20')](respondWithResult(_0x38bb7e,null))[_0x466a('0x42')](handleError(_0x38bb7e,null));};exports[_0x466a('0x7c')]=function(_0x901c82,_0x300971,_0x1140f6){return db[_0x466a('0x29')][_0x466a('0x46')]({'where':{'id':_0x901c82[_0x466a('0x44')]['id']}})[_0x466a('0x20')](handleEntityNotFound(_0x300971,null))[_0x466a('0x20')](function(_0x125d92){if(_0x125d92){return _0x125d92['removeLists'](_0x901c82['query'][_0x466a('0x62')]);}})['then'](function(_0xe751b0){if(_0xe751b0){return db[_0x466a('0x58')]['destroy']({'where':{'ListId':_0x901c82[_0x466a('0x2e')]['ids'],'CampaignId':_0x901c82[_0x466a('0x44')]['id']}})[_0x466a('0x20')](function(){return _0xe751b0;});}})[_0x466a('0x20')](respondWithStatusCode(_0x300971,null))[_0x466a('0x42')](handleError(_0x300971,null));};exports['getBlackLists']=function(_0x491710,_0x3f29f7,_0x39e530){var _0x79ad8a={};var _0x28e937={};var _0x19a973;var _0x3a7fbe;return db['Campaign'][_0x466a('0x57')]({'where':{'id':_0x491710[_0x466a('0x44')]['id']}})[_0x466a('0x20')](handleEntityNotFound(_0x3f29f7,null))[_0x466a('0x20')](function(_0x495bad){if(_0x495bad){_0x19a973=_0x495bad;_0x28e937[_0x466a('0x2d')]=_[_0x466a('0x45')](db['CmList']['rawAttributes']);_0x28e937[_0x466a('0x2e')]=_['keys'](_0x491710['query']);_0x28e937[_0x466a('0x2f')]=_[_0x466a('0x30')](_0x28e937[_0x466a('0x2d')],_0x28e937['query']);_0x79ad8a['attributes']=_[_0x466a('0x30')](_0x28e937[_0x466a('0x2d')],qs[_0x466a('0x31')](_0x491710[_0x466a('0x2e')][_0x466a('0x31')]));_0x79ad8a[_0x466a('0x32')]=_0x79ad8a[_0x466a('0x32')]['length']?_0x79ad8a[_0x466a('0x32')]:_0x28e937[_0x466a('0x2d')];_0x79ad8a['order']=qs[_0x466a('0x37')](_0x491710[_0x466a('0x2e')][_0x466a('0x37')]);_0x79ad8a[_0x466a('0x38')]=qs[_0x466a('0x2f')](_[_0x466a('0x59')](_0x491710['query'],_0x28e937[_0x466a('0x2f')]));if(_0x491710[_0x466a('0x2e')][_0x466a('0x3c')]){_0x79ad8a[_0x466a('0x38')]=_[_0x466a('0x39')](_0x79ad8a[_0x466a('0x38')],{'$or':_[_0x466a('0x28')](_0x79ad8a[_0x466a('0x32')],function(_0x1edf6f){var _0x57562c={};_0x57562c[_0x1edf6f]={'$like':'%'+_0x491710[_0x466a('0x2e')]['filter']+'%'};return _0x57562c;})});}_0x79ad8a=_[_0x466a('0x39')]({},_0x79ad8a,_0x491710[_0x466a('0x3d')]);return _0x19a973[_0x466a('0x7d')](_0x79ad8a);}})[_0x466a('0x20')](function(_0xee5e35){if(_0xee5e35){_0x3a7fbe=_0xee5e35[_0x466a('0x33')];if(!_0x491710[_0x466a('0x2e')][_0x466a('0x34')](_0x466a('0x35'))){_0x79ad8a[_0x466a('0x1a')]=qs[_0x466a('0x1a')](_0x491710[_0x466a('0x2e')]['limit']);_0x79ad8a[_0x466a('0x18')]=qs[_0x466a('0x18')](_0x491710[_0x466a('0x2e')][_0x466a('0x18')]);}return _0x19a973[_0x466a('0x7d')](_0x79ad8a);}})['then'](function(_0x3fff0e){if(_0x3fff0e){return _0x3fff0e?{'count':_0x3a7fbe,'rows':_0x3fff0e}:null;}})[_0x466a('0x20')](respondWithResult(_0x3f29f7,null))[_0x466a('0x42')](handleError(_0x3f29f7,null));};exports['addBlackLists']=function(_0x385416,_0x1572b5,_0x2ff91c){var _0x252d85,_0x4815ef;return db[_0x466a('0x29')][_0x466a('0x46')]({'where':{'id':_0x385416[_0x466a('0x44')]['id']}})[_0x466a('0x20')](handleEntityNotFound(_0x1572b5,null))[_0x466a('0x20')](function(_0x2db913){if(_0x2db913){_0x4815ef=_0x2db913;return _0x2db913[_0x466a('0x7e')](_0x385416[_0x466a('0x48')][_0x466a('0x62')],_[_0x466a('0x50')](_0x385416['body'],[_0x466a('0x62'),'id'])||{});}return null;})[_0x466a('0x63')](function(_0x3f5ff3){var _0x982559;_0x252d85=_0x3f5ff3||[];var _0x2ed016=[];if(_0x3f5ff3){for(var _0x4827dc=0x0;_0x4827dc<_0x3f5ff3[_0x466a('0x33')];_0x4827dc+=0x1){var _0x3d82e1=_0x3f5ff3[_0x4827dc][_0x466a('0x22')]({'plain':!![]});_0x982559=squel[_0x466a('0x65')]()[_0x466a('0x7f')](_0x466a('0x80'))[_0x466a('0x67')]([_0x466a('0x68'),'ContactId',_0x466a('0x6a'),'CampaignId',_0x466a('0x51'),_0x466a('0x52')],squel['select']()[_0x466a('0x6c')](_0x466a('0x68'),_0x466a('0x68'))['field']('id',_0x466a('0x69'))[_0x466a('0x6c')](_0x3d82e1[_0x466a('0x6f')][_0x466a('0x74')](),_0x466a('0x6a'))['field'](_0x385416['params']['id']['toString'](),_0x466a('0x5a'))[_0x466a('0x6c')](_0x466a('0x6d'),'createdAt')[_0x466a('0x6c')]('NOW()',_0x466a('0x52'))['from']('cm_contacts')[_0x466a('0x38')](_0x466a('0x72'))[_0x466a('0x38')](_0x466a('0x73'),_0x3d82e1[_0x466a('0x6f')]['toString']())[_0x466a('0x38')](_0x466a('0x78')))[_0x466a('0x74')]();_0x2ed016[_0x466a('0x7a')](db[_0x466a('0x81')][_0x466a('0x2e')](_0x982559));}return BPromise['all'](_0x2ed016);}})[_0x466a('0x20')](function(){return _0x252d85;})[_0x466a('0x20')](respondWithResult(_0x1572b5,null))[_0x466a('0x42')](handleError(_0x1572b5,null));};exports[_0x466a('0x82')]=function(_0x557317,_0x4d3f5f,_0x12eed0){return db[_0x466a('0x29')][_0x466a('0x46')]({'where':{'id':_0x557317['params']['id']}})[_0x466a('0x20')](handleEntityNotFound(_0x4d3f5f,null))['then'](function(_0x157e66){if(_0x157e66){return _0x157e66['removeBlackLists'](_0x557317[_0x466a('0x2e')][_0x466a('0x62')]);}})[_0x466a('0x20')](function(_0x5d69cc){if(_0x5d69cc){return db[_0x466a('0x5f')]['destroy']({'where':{'ListId':_0x557317[_0x466a('0x2e')]['ids'],'CampaignId':_0x557317[_0x466a('0x44')]['id']}})[_0x466a('0x20')](function(){return _0x5d69cc;});}})[_0x466a('0x20')](respondWithStatusCode(_0x4d3f5f,null))[_0x466a('0x42')](handleError(_0x4d3f5f,null));}; \ No newline at end of file +var _0xb7b6=['util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','index','map','Campaign','rawAttributes','type','keys','query','filters','attributes','model','fields','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','body','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','findOne','CmHopper','pick','CampaignId','getHopperHistories','CmHopperHistory','length','order','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','ids','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','cm_contacts','COALESCE(phone,\x27\x27)','sequelize','all','removeLists','getBlackLists','addBlackLists','spread','into','cm_hopper_black','push','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','mustache'];(function(_0x3d339f,_0x5e6668){var _0x2120f0=function(_0xfb0ed){while(--_0xfb0ed){_0x3d339f['push'](_0x3d339f['shift']());}};_0x2120f0(++_0x5e6668);}(_0xb7b6,0x193));var _0x6b7b=function(_0x465270,_0x3b32e7){_0x465270=_0x465270-0x0;var _0x2855ce=_0xb7b6[_0x465270];return _0x2855ce;};'use strict';var emlformat=require(_0x6b7b('0x0'));var rimraf=require(_0x6b7b('0x1'));var zipdir=require(_0x6b7b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6b7b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6b7b('0x4'));var util=require(_0x6b7b('0x5'));var path=require('path');var sox=require(_0x6b7b('0x6'));var csv=require(_0x6b7b('0x7'));var ejs=require(_0x6b7b('0x8'));var fs=require('fs');var fs_extra=require(_0x6b7b('0x9'));var _=require(_0x6b7b('0xa'));var squel=require(_0x6b7b('0xb'));var crypto=require(_0x6b7b('0xc'));var jsforce=require(_0x6b7b('0xd'));var deskjs=require(_0x6b7b('0xe'));var toCsv=require(_0x6b7b('0x7'));var querystring=require(_0x6b7b('0xf'));var Papa=require('papaparse');var Redis=require(_0x6b7b('0x10'));var authService=require(_0x6b7b('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6b7b('0x12'));var logger=require('../../config/logger')(_0x6b7b('0x13'));var utils=require(_0x6b7b('0x14'));var config=require(_0x6b7b('0x15'));var licenseUtil=require(_0x6b7b('0x16'));var db=require(_0x6b7b('0x17'))['db'];function respondWithStatusCode(_0x7e0865,_0x4f6220){_0x4f6220=_0x4f6220||0xcc;return function(_0x57d6cf){if(_0x57d6cf){return _0x7e0865[_0x6b7b('0x18')](_0x4f6220);}return _0x7e0865[_0x6b7b('0x19')](_0x4f6220)[_0x6b7b('0x1a')]();};}function respondWithResult(_0x3c6cf3,_0x2cc9ad){_0x2cc9ad=_0x2cc9ad||0xc8;return function(_0x114be1){if(_0x114be1){return _0x3c6cf3[_0x6b7b('0x19')](_0x2cc9ad)['json'](_0x114be1);}};}function respondWithFilteredResult(_0x300922,_0x42e230){return function(_0x229357){if(_0x229357){var _0x5baa48=typeof _0x42e230[_0x6b7b('0x1b')]===_0x6b7b('0x1c')&&typeof _0x42e230[_0x6b7b('0x1d')]===_0x6b7b('0x1c');var _0x2f4bd8=_0x229357[_0x6b7b('0x1e')];var _0x45f0a2=_0x5baa48?0x0:_0x42e230[_0x6b7b('0x1b')];var _0x2099f0=_0x5baa48?_0x229357[_0x6b7b('0x1e')]:_0x42e230[_0x6b7b('0x1b')]+_0x42e230[_0x6b7b('0x1d')];var _0x66e356;if(_0x2099f0>=_0x2f4bd8){_0x2099f0=_0x2f4bd8;_0x66e356=0xc8;}else{_0x66e356=0xce;}_0x300922[_0x6b7b('0x19')](_0x66e356);return _0x300922[_0x6b7b('0x1f')]('Content-Range',_0x45f0a2+'-'+_0x2099f0+'/'+_0x2f4bd8)['json'](_0x229357);}return null;};}function patchUpdates(_0x3d3d61){return function(_0x28b385){try{jsonpatch[_0x6b7b('0x20')](_0x28b385,_0x3d3d61,!![]);}catch(_0x1bc0f2){return BPromise[_0x6b7b('0x21')](_0x1bc0f2);}return _0x28b385[_0x6b7b('0x22')]();};}function saveUpdates(_0x27b470,_0x309de4){return function(_0x4858ce){if(_0x4858ce){return _0x4858ce[_0x6b7b('0x23')](_0x27b470)[_0x6b7b('0x24')](function(_0x3fb671){return _0x3fb671;});}return null;};}function removeEntity(_0x23af29,_0x47cc28){return function(_0x220cc1){if(_0x220cc1){return _0x220cc1[_0x6b7b('0x25')]()['then'](function(){var _0xb72029=_0x220cc1[_0x6b7b('0x26')]({'plain':!![]});var _0x3cace9='IvrCampaigns';return db[_0x6b7b('0x27')][_0x6b7b('0x25')]({'where':{'type':_0x3cace9,'resourceId':_0xb72029['id']}})[_0x6b7b('0x24')](function(){return _0x220cc1;});})[_0x6b7b('0x24')](function(){_0x23af29[_0x6b7b('0x19')](0xcc)[_0x6b7b('0x1a')]();});}};}function handleEntityNotFound(_0x35f8dd,_0x37ca13){return function(_0x217297){if(!_0x217297){_0x35f8dd[_0x6b7b('0x18')](0x194);}return _0x217297;};}function handleError(_0x462e57,_0x2abdec){_0x2abdec=_0x2abdec||0x1f4;return function(_0x39b719){logger[_0x6b7b('0x28')](_0x39b719['stack']);if(_0x39b719[_0x6b7b('0x29')]){delete _0x39b719[_0x6b7b('0x29')];}_0x462e57[_0x6b7b('0x19')](_0x2abdec)[_0x6b7b('0x2a')](_0x39b719);};}exports[_0x6b7b('0x2b')]=function(_0x5ec64c,_0x3a2fad){var _0x20c262={},_0x358f5c={},_0x31d66b={'count':0x0,'rows':[]};var _0x31a5a6=_[_0x6b7b('0x2c')](db[_0x6b7b('0x2d')][_0x6b7b('0x2e')],function(_0x3f87b5){return{'name':_0x3f87b5['fieldName'],'type':_0x3f87b5[_0x6b7b('0x2f')]['key']};});_0x358f5c['model']=_[_0x6b7b('0x2c')](_0x31a5a6,_0x6b7b('0x29'));_0x358f5c['query']=_[_0x6b7b('0x30')](_0x5ec64c[_0x6b7b('0x31')]);_0x358f5c[_0x6b7b('0x32')]=_['intersection'](_0x358f5c['model'],_0x358f5c[_0x6b7b('0x31')]);_0x20c262[_0x6b7b('0x33')]=_['intersection'](_0x358f5c[_0x6b7b('0x34')],qs[_0x6b7b('0x35')](_0x5ec64c[_0x6b7b('0x31')][_0x6b7b('0x35')]));_0x20c262[_0x6b7b('0x33')]=_0x20c262[_0x6b7b('0x33')]['length']?_0x20c262['attributes']:_0x358f5c[_0x6b7b('0x34')];if(!_0x5ec64c[_0x6b7b('0x31')][_0x6b7b('0x36')](_0x6b7b('0x37'))){_0x20c262[_0x6b7b('0x1d')]=qs['limit'](_0x5ec64c[_0x6b7b('0x31')][_0x6b7b('0x1d')]);_0x20c262['offset']=qs[_0x6b7b('0x1b')](_0x5ec64c['query'][_0x6b7b('0x1b')]);}_0x20c262['order']=qs[_0x6b7b('0x38')](_0x5ec64c['query']['sort']);_0x20c262['where']=qs['filters'](_['pick'](_0x5ec64c[_0x6b7b('0x31')],_0x358f5c[_0x6b7b('0x32')]),_0x31a5a6);if(_0x5ec64c[_0x6b7b('0x31')][_0x6b7b('0x39')]){_0x20c262[_0x6b7b('0x3a')]=_[_0x6b7b('0x3b')](_0x20c262['where'],{'$or':_[_0x6b7b('0x2c')](_0x31a5a6,function(_0x424076){if(_0x424076['type']!==_0x6b7b('0x3c')){var _0xdb1005={};_0xdb1005[_0x424076['name']]={'$like':'%'+_0x5ec64c[_0x6b7b('0x31')]['filter']+'%'};return _0xdb1005;}})});}_0x20c262=_[_0x6b7b('0x3b')]({},_0x20c262,_0x5ec64c[_0x6b7b('0x3d')]);var _0x373cb5={'where':_0x20c262[_0x6b7b('0x3a')]};return db[_0x6b7b('0x2d')][_0x6b7b('0x1e')](_0x373cb5)[_0x6b7b('0x24')](function(_0x3c137a){_0x31d66b[_0x6b7b('0x1e')]=_0x3c137a;if(_0x5ec64c['query'][_0x6b7b('0x3e')]){_0x20c262[_0x6b7b('0x3f')]=[{'all':!![]}];}return db[_0x6b7b('0x2d')][_0x6b7b('0x40')](_0x20c262);})['then'](function(_0x34f4d2){_0x31d66b[_0x6b7b('0x41')]=_0x34f4d2;return _0x31d66b;})[_0x6b7b('0x24')](respondWithFilteredResult(_0x3a2fad,_0x20c262))[_0x6b7b('0x42')](handleError(_0x3a2fad,null));};exports[_0x6b7b('0x43')]=function(_0x546ba4,_0x6136fc){var _0x41c5ce={'raw':![],'where':{'id':_0x546ba4[_0x6b7b('0x44')]['id']}},_0x4efd91={};_0x4efd91[_0x6b7b('0x34')]=_[_0x6b7b('0x30')](db['Campaign'][_0x6b7b('0x2e')]);_0x4efd91[_0x6b7b('0x31')]=_[_0x6b7b('0x30')](_0x546ba4['query']);_0x4efd91[_0x6b7b('0x32')]=_[_0x6b7b('0x45')](_0x4efd91['model'],_0x4efd91[_0x6b7b('0x31')]);_0x41c5ce[_0x6b7b('0x33')]=_[_0x6b7b('0x45')](_0x4efd91['model'],qs[_0x6b7b('0x35')](_0x546ba4[_0x6b7b('0x31')][_0x6b7b('0x35')]));_0x41c5ce[_0x6b7b('0x33')]=_0x41c5ce[_0x6b7b('0x33')]['length']?_0x41c5ce[_0x6b7b('0x33')]:_0x4efd91[_0x6b7b('0x34')];if(_0x546ba4[_0x6b7b('0x31')]['includeAll']){_0x41c5ce[_0x6b7b('0x3f')]=[{'all':!![]}];}_0x41c5ce=_[_0x6b7b('0x3b')]({},_0x41c5ce,_0x546ba4[_0x6b7b('0x3d')]);return db[_0x6b7b('0x2d')][_0x6b7b('0x46')](_0x41c5ce)[_0x6b7b('0x24')](handleEntityNotFound(_0x6136fc,null))[_0x6b7b('0x24')](respondWithResult(_0x6136fc,null))[_0x6b7b('0x42')](handleError(_0x6136fc,null));};exports[_0x6b7b('0x47')]=function(_0x23fdb7,_0x1b6b8a){return db[_0x6b7b('0x2d')][_0x6b7b('0x47')](_0x23fdb7['body'],{})[_0x6b7b('0x24')](function(_0x48d846){var _0x55138a=_0x23fdb7[_0x6b7b('0x48')][_0x6b7b('0x26')]({'plain':!![]});if(!_0x55138a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x55138a['role']===_0x6b7b('0x48')){var _0x372cea=_0x48d846[_0x6b7b('0x26')]({'plain':!![]});var _0x102e6a='IvrCampaigns';return db['UserProfileSection']['find']({'where':{'name':_0x102e6a,'userProfileId':_0x55138a[_0x6b7b('0x49')]},'raw':!![]})[_0x6b7b('0x24')](function(_0x454438){if(_0x454438&&_0x454438[_0x6b7b('0x4a')]===0x0){return db[_0x6b7b('0x27')][_0x6b7b('0x47')]({'name':_0x372cea['name'],'resourceId':_0x372cea['id'],'type':_0x454438[_0x6b7b('0x29')],'sectionId':_0x454438['id']},{})['then'](function(){return _0x48d846;});}else{return _0x48d846;}})[_0x6b7b('0x42')](function(_0xed4d7b){logger[_0x6b7b('0x28')](_0x6b7b('0x4b'),_0xed4d7b);throw _0xed4d7b;});}return _0x48d846;})['then'](respondWithResult(_0x1b6b8a,0xc9))[_0x6b7b('0x42')](handleError(_0x1b6b8a,null));};exports[_0x6b7b('0x4c')]=function(_0x4f089c,_0x319089){var _0x49d847={'where':{'id':_0x4f089c[_0x6b7b('0x44')]['id']}},_0x419200={};_0x419200[_0x6b7b('0x34')]=_[_0x6b7b('0x30')](db[_0x6b7b('0x2d')][_0x6b7b('0x2e')]);_0x49d847[_0x6b7b('0x33')]=_[_0x6b7b('0x45')](_0x419200[_0x6b7b('0x34')],qs[_0x6b7b('0x35')](_0x4f089c[_0x6b7b('0x31')][_0x6b7b('0x35')]));_0x49d847[_0x6b7b('0x33')]=_0x49d847['attributes']['length']?_0x49d847['attributes']:_0x419200[_0x6b7b('0x34')];if(_0x4f089c[_0x6b7b('0x31')]['includeAll']){_0x49d847[_0x6b7b('0x3f')]=[{'all':!![]}];}_0x49d847=_[_0x6b7b('0x3b')]({},_0x49d847,_0x4f089c[_0x6b7b('0x3d')]);return db['Campaign'][_0x6b7b('0x46')](_0x49d847)[_0x6b7b('0x24')](handleEntityNotFound(_0x319089,null))[_0x6b7b('0x24')](function(_0x2d0bc9){if(_0x2d0bc9){var _0x2c69b6=_0x2d0bc9[_0x6b7b('0x26')]({'plain':!![]});_0x2c69b6=qs[_0x6b7b('0x4d')](_0x2c69b6,['id','createdAt',_0x6b7b('0x4e')]);_0x4f089c[_0x6b7b('0x4f')]=_[_0x6b7b('0x4d')](_0x4f089c[_0x6b7b('0x4f')],['id',_0x6b7b('0x50'),_0x6b7b('0x4e')]);return db[_0x6b7b('0x2d')][_0x6b7b('0x47')](_[_0x6b7b('0x3b')](_0x2c69b6,_0x4f089c[_0x6b7b('0x4f')]),{'include':_0x4f089c[_0x6b7b('0x31')][_0x6b7b('0x3e')]?[{'all':!![]}]:undefined})[_0x6b7b('0x24')](function(_0x52381d){var _0x2c6e15=_0x4f089c[_0x6b7b('0x48')][_0x6b7b('0x26')]({'plain':!![]});if(!_0x2c6e15)throw new Error(_0x6b7b('0x51'));if(_0x2c6e15[_0x6b7b('0x52')]===_0x6b7b('0x48')){var _0x4601e8=_0x52381d['get']({'plain':!![]});var _0x2ff914=_0x6b7b('0x53');return db[_0x6b7b('0x54')][_0x6b7b('0x46')]({'where':{'name':_0x2ff914,'userProfileId':_0x2c6e15[_0x6b7b('0x49')]},'raw':!![]})[_0x6b7b('0x24')](function(_0x270a51){if(_0x270a51&&_0x270a51[_0x6b7b('0x4a')]===0x0){return db[_0x6b7b('0x27')][_0x6b7b('0x47')]({'name':_0x4601e8['name'],'resourceId':_0x4601e8['id'],'type':_0x270a51[_0x6b7b('0x29')],'sectionId':_0x270a51['id']},{})[_0x6b7b('0x24')](function(){return _0x52381d;});}else{return _0x52381d;}})[_0x6b7b('0x42')](function(_0x1b0cf4){logger[_0x6b7b('0x28')](_0x6b7b('0x4b'),_0x1b0cf4);throw _0x1b0cf4;});}return _0x52381d;});}})[_0x6b7b('0x24')](respondWithResult(_0x319089,0xc9))['catch'](handleError(_0x319089,null));};exports['update']=function(_0x506f6e,_0x2c4637){if(_0x506f6e['body']['id']){delete _0x506f6e['body']['id'];}return db[_0x6b7b('0x2d')][_0x6b7b('0x46')]({'where':{'id':_0x506f6e[_0x6b7b('0x44')]['id']}})[_0x6b7b('0x24')](handleEntityNotFound(_0x2c4637,null))[_0x6b7b('0x24')](saveUpdates(_0x506f6e[_0x6b7b('0x4f')],null))[_0x6b7b('0x24')](respondWithResult(_0x2c4637,null))['catch'](handleError(_0x2c4637,null));};exports[_0x6b7b('0x25')]=function(_0x3f141f,_0x18cb47){return db['Campaign'][_0x6b7b('0x46')]({'where':{'id':_0x3f141f[_0x6b7b('0x44')]['id']}})[_0x6b7b('0x24')](handleEntityNotFound(_0x18cb47,null))[_0x6b7b('0x24')](removeEntity(_0x18cb47,null))[_0x6b7b('0x42')](handleError(_0x18cb47,null));};exports['getHoppers']=function(_0x22ff56,_0xf92e26,_0x10e828){var _0x363134={'raw':!![],'where':{}};var _0x4e37d2={};var _0x1f0c85={'count':0x0,'rows':[]};return db[_0x6b7b('0x2d')][_0x6b7b('0x55')]({'where':{'id':_0x22ff56[_0x6b7b('0x44')]['id']}})[_0x6b7b('0x24')](handleEntityNotFound(_0xf92e26,null))[_0x6b7b('0x24')](function(_0x3329e1){if(_0x3329e1){_0x4e37d2['model']=_[_0x6b7b('0x30')](db[_0x6b7b('0x56')]['rawAttributes']);_0x4e37d2[_0x6b7b('0x31')]=_[_0x6b7b('0x30')](_0x22ff56[_0x6b7b('0x31')]);_0x4e37d2[_0x6b7b('0x32')]=_[_0x6b7b('0x45')](_0x4e37d2[_0x6b7b('0x34')],_0x4e37d2['query']);_0x363134['attributes']=_[_0x6b7b('0x45')](_0x4e37d2[_0x6b7b('0x34')],qs[_0x6b7b('0x35')](_0x22ff56['query'][_0x6b7b('0x35')]));_0x363134[_0x6b7b('0x33')]=_0x363134[_0x6b7b('0x33')]['length']?_0x363134[_0x6b7b('0x33')]:_0x4e37d2[_0x6b7b('0x34')];if(!_0x22ff56[_0x6b7b('0x31')][_0x6b7b('0x36')]('nolimit')){_0x363134['limit']=qs['limit'](_0x22ff56[_0x6b7b('0x31')][_0x6b7b('0x1d')]);_0x363134[_0x6b7b('0x1b')]=qs[_0x6b7b('0x1b')](_0x22ff56[_0x6b7b('0x31')][_0x6b7b('0x1b')]);}_0x363134['order']=qs[_0x6b7b('0x38')](_0x22ff56['query'][_0x6b7b('0x38')]);_0x363134[_0x6b7b('0x3a')]=qs[_0x6b7b('0x32')](_[_0x6b7b('0x57')](_0x22ff56[_0x6b7b('0x31')],_0x4e37d2[_0x6b7b('0x32')]));_0x363134[_0x6b7b('0x3a')][_0x6b7b('0x58')]=_0x3329e1['id'];if(_0x22ff56[_0x6b7b('0x31')][_0x6b7b('0x39')]){_0x363134['where']=_['merge'](_0x363134[_0x6b7b('0x3a')],{'$or':_[_0x6b7b('0x2c')](_0x363134[_0x6b7b('0x33')],function(_0x2810ad){var _0x4c6627={};_0x4c6627[_0x2810ad]={'$like':'%'+_0x22ff56[_0x6b7b('0x31')][_0x6b7b('0x39')]+'%'};return _0x4c6627;})});}_0x363134=_[_0x6b7b('0x3b')]({},_0x363134,_0x22ff56[_0x6b7b('0x3d')]);return db[_0x6b7b('0x56')]['count']({'where':_0x363134[_0x6b7b('0x3a')]})['then'](function(_0x30daf5){_0x1f0c85[_0x6b7b('0x1e')]=_0x30daf5;if(_0x22ff56[_0x6b7b('0x31')][_0x6b7b('0x3e')]){_0x363134[_0x6b7b('0x3f')]=[{'all':!![]}];}return db[_0x6b7b('0x56')][_0x6b7b('0x40')](_0x363134);})['then'](function(_0x4d637b){_0x1f0c85['rows']=_0x4d637b;return _0x1f0c85;});}})[_0x6b7b('0x24')](respondWithFilteredResult(_0xf92e26,_0x363134))['catch'](handleError(_0xf92e26,null));};exports[_0x6b7b('0x59')]=function(_0x31b4d3,_0x44d01d,_0x25ec62){var _0xadff80={'raw':!![],'where':{}};var _0x52d85d={};var _0x5edfc2={'count':0x0,'rows':[]};return db[_0x6b7b('0x2d')][_0x6b7b('0x55')]({'where':{'id':_0x31b4d3['params']['id']}})[_0x6b7b('0x24')](handleEntityNotFound(_0x44d01d,null))[_0x6b7b('0x24')](function(_0x118b87){if(_0x118b87){_0x52d85d['model']=_[_0x6b7b('0x30')](db[_0x6b7b('0x5a')][_0x6b7b('0x2e')]);_0x52d85d[_0x6b7b('0x31')]=_[_0x6b7b('0x30')](_0x31b4d3[_0x6b7b('0x31')]);_0x52d85d[_0x6b7b('0x32')]=_[_0x6b7b('0x45')](_0x52d85d[_0x6b7b('0x34')],_0x52d85d[_0x6b7b('0x31')]);_0xadff80['attributes']=_[_0x6b7b('0x45')](_0x52d85d[_0x6b7b('0x34')],qs[_0x6b7b('0x35')](_0x31b4d3[_0x6b7b('0x31')][_0x6b7b('0x35')]));_0xadff80[_0x6b7b('0x33')]=_0xadff80['attributes'][_0x6b7b('0x5b')]?_0xadff80[_0x6b7b('0x33')]:_0x52d85d[_0x6b7b('0x34')];if(!_0x31b4d3[_0x6b7b('0x31')][_0x6b7b('0x36')](_0x6b7b('0x37'))){_0xadff80[_0x6b7b('0x1d')]=qs['limit'](_0x31b4d3[_0x6b7b('0x31')]['limit']);_0xadff80[_0x6b7b('0x1b')]=qs[_0x6b7b('0x1b')](_0x31b4d3[_0x6b7b('0x31')][_0x6b7b('0x1b')]);}_0xadff80[_0x6b7b('0x5c')]=qs[_0x6b7b('0x38')](_0x31b4d3[_0x6b7b('0x31')][_0x6b7b('0x38')]);_0xadff80[_0x6b7b('0x3a')]=qs[_0x6b7b('0x32')](_[_0x6b7b('0x57')](_0x31b4d3[_0x6b7b('0x31')],_0x52d85d[_0x6b7b('0x32')]));_0xadff80[_0x6b7b('0x3a')][_0x6b7b('0x58')]=_0x118b87['id'];if(_0x31b4d3[_0x6b7b('0x31')][_0x6b7b('0x39')]){_0xadff80[_0x6b7b('0x3a')]=_['merge'](_0xadff80[_0x6b7b('0x3a')],{'$or':_[_0x6b7b('0x2c')](_0xadff80[_0x6b7b('0x33')],function(_0x25934c){var _0x306411={};_0x306411[_0x25934c]={'$like':'%'+_0x31b4d3[_0x6b7b('0x31')][_0x6b7b('0x39')]+'%'};return _0x306411;})});}_0xadff80=_[_0x6b7b('0x3b')]({},_0xadff80,_0x31b4d3[_0x6b7b('0x3d')]);return db[_0x6b7b('0x5a')][_0x6b7b('0x1e')]({'where':_0xadff80[_0x6b7b('0x3a')]})['then'](function(_0x2d6fa1){_0x5edfc2[_0x6b7b('0x1e')]=_0x2d6fa1;if(_0x31b4d3[_0x6b7b('0x31')][_0x6b7b('0x3e')]){_0xadff80[_0x6b7b('0x3f')]=[{'all':!![]}];}return db[_0x6b7b('0x5a')]['findAll'](_0xadff80);})[_0x6b7b('0x24')](function(_0x25ee8e){_0x5edfc2[_0x6b7b('0x41')]=_0x25ee8e;return _0x5edfc2;});}})[_0x6b7b('0x24')](respondWithFilteredResult(_0x44d01d,_0xadff80))[_0x6b7b('0x42')](handleError(_0x44d01d,null));};exports[_0x6b7b('0x5d')]=function(_0x42af17,_0x1a4f66,_0x4dbbf9){var _0x44a8c1={'raw':!![],'where':{}};var _0x28e77b={};var _0x536a7e={'count':0x0,'rows':[]};return db[_0x6b7b('0x2d')][_0x6b7b('0x55')]({'where':{'id':_0x42af17[_0x6b7b('0x44')]['id']}})['then'](handleEntityNotFound(_0x1a4f66,null))[_0x6b7b('0x24')](function(_0x222a51){if(_0x222a51){_0x28e77b[_0x6b7b('0x34')]=_[_0x6b7b('0x30')](db[_0x6b7b('0x5e')][_0x6b7b('0x2e')]);_0x28e77b[_0x6b7b('0x31')]=_['keys'](_0x42af17[_0x6b7b('0x31')]);_0x28e77b['filters']=_['intersection'](_0x28e77b[_0x6b7b('0x34')],_0x28e77b[_0x6b7b('0x31')]);_0x44a8c1['attributes']=_[_0x6b7b('0x45')](_0x28e77b[_0x6b7b('0x34')],qs[_0x6b7b('0x35')](_0x42af17[_0x6b7b('0x31')][_0x6b7b('0x35')]));_0x44a8c1[_0x6b7b('0x33')]=_0x44a8c1[_0x6b7b('0x33')][_0x6b7b('0x5b')]?_0x44a8c1[_0x6b7b('0x33')]:_0x28e77b[_0x6b7b('0x34')];if(!_0x42af17[_0x6b7b('0x31')][_0x6b7b('0x36')](_0x6b7b('0x37'))){_0x44a8c1['limit']=qs[_0x6b7b('0x1d')](_0x42af17[_0x6b7b('0x31')][_0x6b7b('0x1d')]);_0x44a8c1[_0x6b7b('0x1b')]=qs[_0x6b7b('0x1b')](_0x42af17[_0x6b7b('0x31')][_0x6b7b('0x1b')]);}_0x44a8c1[_0x6b7b('0x5c')]=qs[_0x6b7b('0x38')](_0x42af17['query'][_0x6b7b('0x38')]);_0x44a8c1[_0x6b7b('0x3a')]=qs[_0x6b7b('0x32')](_[_0x6b7b('0x57')](_0x42af17[_0x6b7b('0x31')],_0x28e77b[_0x6b7b('0x32')]));_0x44a8c1[_0x6b7b('0x3a')]['CampaignId']=_0x222a51['id'];if(_0x42af17[_0x6b7b('0x31')]['filter']){_0x44a8c1['where']=_[_0x6b7b('0x3b')](_0x44a8c1[_0x6b7b('0x3a')],{'$or':_[_0x6b7b('0x2c')](_0x44a8c1['attributes'],function(_0x4883ca){var _0x89f23a={};_0x89f23a[_0x4883ca]={'$like':'%'+_0x42af17[_0x6b7b('0x31')][_0x6b7b('0x39')]+'%'};return _0x89f23a;})});}_0x44a8c1=_[_0x6b7b('0x3b')]({},_0x44a8c1,_0x42af17[_0x6b7b('0x3d')]);return db[_0x6b7b('0x5e')][_0x6b7b('0x1e')]({'where':_0x44a8c1[_0x6b7b('0x3a')]})[_0x6b7b('0x24')](function(_0x469826){_0x536a7e['count']=_0x469826;if(_0x42af17[_0x6b7b('0x31')][_0x6b7b('0x3e')]){_0x44a8c1[_0x6b7b('0x3f')]=[{'all':!![]}];}return db[_0x6b7b('0x5e')][_0x6b7b('0x40')](_0x44a8c1);})[_0x6b7b('0x24')](function(_0x4f4359){_0x536a7e[_0x6b7b('0x41')]=_0x4f4359;return _0x536a7e;});}})[_0x6b7b('0x24')](respondWithFilteredResult(_0x1a4f66,_0x44a8c1))[_0x6b7b('0x42')](handleError(_0x1a4f66,null));};exports[_0x6b7b('0x5f')]=function(_0xcad0f8,_0x1a0e06,_0x55ddb0){var _0x3301a4={'raw':!![],'where':{}};var _0x4755b2={};var _0x371493={'count':0x0,'rows':[]};return db[_0x6b7b('0x2d')]['findOne']({'where':{'id':_0xcad0f8['params']['id']}})[_0x6b7b('0x24')](handleEntityNotFound(_0x1a0e06,null))[_0x6b7b('0x24')](function(_0x2abeb1){if(_0x2abeb1){_0x4755b2[_0x6b7b('0x34')]=_[_0x6b7b('0x30')](db['CmHopperBlack']['rawAttributes']);_0x4755b2[_0x6b7b('0x31')]=_[_0x6b7b('0x30')](_0xcad0f8['query']);_0x4755b2[_0x6b7b('0x32')]=_[_0x6b7b('0x45')](_0x4755b2['model'],_0x4755b2[_0x6b7b('0x31')]);_0x3301a4['attributes']=_[_0x6b7b('0x45')](_0x4755b2[_0x6b7b('0x34')],qs[_0x6b7b('0x35')](_0xcad0f8[_0x6b7b('0x31')][_0x6b7b('0x35')]));_0x3301a4[_0x6b7b('0x33')]=_0x3301a4[_0x6b7b('0x33')]['length']?_0x3301a4[_0x6b7b('0x33')]:_0x4755b2[_0x6b7b('0x34')];if(!_0xcad0f8[_0x6b7b('0x31')][_0x6b7b('0x36')](_0x6b7b('0x37'))){_0x3301a4['limit']=qs[_0x6b7b('0x1d')](_0xcad0f8[_0x6b7b('0x31')][_0x6b7b('0x1d')]);_0x3301a4['offset']=qs['offset'](_0xcad0f8[_0x6b7b('0x31')][_0x6b7b('0x1b')]);}_0x3301a4[_0x6b7b('0x5c')]=qs[_0x6b7b('0x38')](_0xcad0f8[_0x6b7b('0x31')][_0x6b7b('0x38')]);_0x3301a4['where']=qs[_0x6b7b('0x32')](_[_0x6b7b('0x57')](_0xcad0f8[_0x6b7b('0x31')],_0x4755b2[_0x6b7b('0x32')]));_0x3301a4[_0x6b7b('0x3a')][_0x6b7b('0x58')]=_0x2abeb1['id'];if(_0xcad0f8[_0x6b7b('0x31')][_0x6b7b('0x39')]){_0x3301a4[_0x6b7b('0x3a')]=_[_0x6b7b('0x3b')](_0x3301a4[_0x6b7b('0x3a')],{'$or':_[_0x6b7b('0x2c')](_0x3301a4[_0x6b7b('0x33')],function(_0x37622e){var _0x481b5e={};_0x481b5e[_0x37622e]={'$like':'%'+_0xcad0f8[_0x6b7b('0x31')][_0x6b7b('0x39')]+'%'};return _0x481b5e;})});}_0x3301a4=_['merge']({},_0x3301a4,_0xcad0f8['options']);return db[_0x6b7b('0x60')][_0x6b7b('0x1e')]({'where':_0x3301a4[_0x6b7b('0x3a')]})[_0x6b7b('0x24')](function(_0xa8e5e7){_0x371493[_0x6b7b('0x1e')]=_0xa8e5e7;if(_0xcad0f8[_0x6b7b('0x31')][_0x6b7b('0x3e')]){_0x3301a4[_0x6b7b('0x3f')]=[{'all':!![]}];}return db[_0x6b7b('0x60')][_0x6b7b('0x40')](_0x3301a4);})[_0x6b7b('0x24')](function(_0x147e73){_0x371493[_0x6b7b('0x41')]=_0x147e73;return _0x371493;});}})[_0x6b7b('0x24')](respondWithFilteredResult(_0x1a0e06,_0x3301a4))[_0x6b7b('0x42')](handleError(_0x1a0e06,null));};exports['getLists']=function(_0x3ce84d,_0x57ce41,_0x24dbd7){var _0x386d52={};var _0x4c88a4={};var _0x35edc2;var _0x1d171a;return db['Campaign'][_0x6b7b('0x55')]({'where':{'id':_0x3ce84d[_0x6b7b('0x44')]['id']}})[_0x6b7b('0x24')](handleEntityNotFound(_0x57ce41,null))[_0x6b7b('0x24')](function(_0x1f16f9){if(_0x1f16f9){_0x35edc2=_0x1f16f9;_0x4c88a4['model']=_['keys'](db[_0x6b7b('0x61')][_0x6b7b('0x2e')]);_0x4c88a4[_0x6b7b('0x31')]=_[_0x6b7b('0x30')](_0x3ce84d['query']);_0x4c88a4['filters']=_[_0x6b7b('0x45')](_0x4c88a4['model'],_0x4c88a4['query']);_0x386d52['attributes']=_[_0x6b7b('0x45')](_0x4c88a4[_0x6b7b('0x34')],qs['fields'](_0x3ce84d['query'][_0x6b7b('0x35')]));_0x386d52[_0x6b7b('0x33')]=_0x386d52[_0x6b7b('0x33')]['length']?_0x386d52[_0x6b7b('0x33')]:_0x4c88a4['model'];_0x386d52['order']=qs[_0x6b7b('0x38')](_0x3ce84d[_0x6b7b('0x31')]['sort']);_0x386d52['where']=qs[_0x6b7b('0x32')](_[_0x6b7b('0x57')](_0x3ce84d['query'],_0x4c88a4[_0x6b7b('0x32')]));if(_0x3ce84d[_0x6b7b('0x31')][_0x6b7b('0x39')]){_0x386d52['where']=_['merge'](_0x386d52['where'],{'$or':_['map'](_0x386d52[_0x6b7b('0x33')],function(_0x44be44){var _0x4fbd9c={};_0x4fbd9c[_0x44be44]={'$like':'%'+_0x3ce84d[_0x6b7b('0x31')]['filter']+'%'};return _0x4fbd9c;})});}_0x386d52=_['merge']({},_0x386d52,_0x3ce84d[_0x6b7b('0x3d')]);return _0x35edc2[_0x6b7b('0x62')](_0x386d52);}})['then'](function(_0x53815a){if(_0x53815a){_0x1d171a=_0x53815a[_0x6b7b('0x5b')];if(!_0x3ce84d[_0x6b7b('0x31')][_0x6b7b('0x36')](_0x6b7b('0x37'))){_0x386d52['limit']=qs[_0x6b7b('0x1d')](_0x3ce84d['query'][_0x6b7b('0x1d')]);_0x386d52[_0x6b7b('0x1b')]=qs['offset'](_0x3ce84d[_0x6b7b('0x31')][_0x6b7b('0x1b')]);}return _0x35edc2[_0x6b7b('0x62')](_0x386d52);}})['then'](function(_0x5cef6e){if(_0x5cef6e){return _0x5cef6e?{'count':_0x1d171a,'rows':_0x5cef6e}:null;}})[_0x6b7b('0x24')](respondWithResult(_0x57ce41,null))[_0x6b7b('0x42')](handleError(_0x57ce41,null));};exports[_0x6b7b('0x63')]=function(_0x19c62e,_0x2b4807,_0x2a2c47){var _0x2af1ef,_0x4bef28;return db[_0x6b7b('0x2d')][_0x6b7b('0x46')]({'where':{'id':_0x19c62e[_0x6b7b('0x44')]['id']}})[_0x6b7b('0x24')](handleEntityNotFound(_0x2b4807,null))['then'](function(_0x58d663){if(_0x58d663){_0x4bef28=_0x58d663;return _0x58d663[_0x6b7b('0x63')](_0x19c62e['body'][_0x6b7b('0x64')],_[_0x6b7b('0x4d')](_0x19c62e[_0x6b7b('0x4f')],[_0x6b7b('0x64'),'id'])||{});}return null;})['spread'](function(_0x5c62c1){var _0x5f4745;_0x2af1ef=_0x5c62c1||[];var _0x28518b=[];if(_0x5c62c1){for(var _0x8fdc86=0x0;_0x8fdc86<_0x5c62c1['length'];_0x8fdc86+=0x1){var _0x20b65e=_0x5c62c1[_0x8fdc86][_0x6b7b('0x26')]({'plain':!![]});_0x4bef28[_0x6b7b('0x65')]=_0x19c62e[_0x6b7b('0x4f')][_0x6b7b('0x65')]?_0x19c62e[_0x6b7b('0x4f')]['dialCheckDuplicateType']:_0x4bef28[_0x6b7b('0x65')];switch(_0x4bef28[_0x6b7b('0x65')]){case _0x6b7b('0x66'):_0x5f4745=squel[_0x6b7b('0x67')]()['into'](_0x6b7b('0x68'))[_0x6b7b('0x69')]([_0x6b7b('0x6a'),_0x6b7b('0x6b'),_0x6b7b('0x6c'),_0x6b7b('0x6d'),_0x6b7b('0x58'),_0x6b7b('0x50'),'updatedAt'],squel['select']()[_0x6b7b('0x6e')](_0x6b7b('0x6a'),_0x6b7b('0x6a'))[_0x6b7b('0x6e')](_0x6b7b('0x6f'),_0x6b7b('0x6b'))[_0x6b7b('0x6e')]('id','ContactId')[_0x6b7b('0x6e')](_0x20b65e[_0x6b7b('0x70')][_0x6b7b('0x71')](),_0x6b7b('0x6d'))[_0x6b7b('0x6e')](_0x19c62e[_0x6b7b('0x44')]['id']['toString'](),_0x6b7b('0x58'))[_0x6b7b('0x6e')](_0x6b7b('0x6f'),_0x6b7b('0x50'))[_0x6b7b('0x6e')](_0x6b7b('0x6f'),_0x6b7b('0x4e'))[_0x6b7b('0x72')]('cm_contacts')[_0x6b7b('0x3a')](_0x6b7b('0x73'))[_0x6b7b('0x3a')](_0x6b7b('0x74'),_0x20b65e[_0x6b7b('0x70')][_0x6b7b('0x71')]())[_0x6b7b('0x3a')](_0x6b7b('0x75'))[_0x6b7b('0x3a')](_0x6b7b('0x76'),squel[_0x6b7b('0x77')]()['field'](_0x6b7b('0x78'))[_0x6b7b('0x72')](_0x6b7b('0x79'))['where'](_0x6b7b('0x7a'),_0x19c62e[_0x6b7b('0x44')]['id'][_0x6b7b('0x71')]()))[_0x6b7b('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x6b7b('0x6e')]('COALESCE(phone,\x27\x27)')[_0x6b7b('0x72')](_0x6b7b('0x68'))[_0x6b7b('0x3a')]('CampaignId\x20=\x20?',_0x19c62e[_0x6b7b('0x44')]['id']['toString']())))[_0x6b7b('0x71')]();break;case _0x6b7b('0x7b'):_0x5f4745=squel['insert']()['into'](_0x6b7b('0x68'))['fromQuery']([_0x6b7b('0x6a'),_0x6b7b('0x6b'),_0x6b7b('0x6c'),'ListId',_0x6b7b('0x58'),_0x6b7b('0x50'),_0x6b7b('0x4e')],squel[_0x6b7b('0x77')]()[_0x6b7b('0x6e')](_0x6b7b('0x6a'),_0x6b7b('0x6a'))[_0x6b7b('0x6e')](_0x6b7b('0x6f'),_0x6b7b('0x6b'))[_0x6b7b('0x6e')]('id',_0x6b7b('0x6c'))[_0x6b7b('0x6e')](_0x20b65e[_0x6b7b('0x70')][_0x6b7b('0x71')](),_0x6b7b('0x6d'))[_0x6b7b('0x6e')](_0x19c62e[_0x6b7b('0x44')]['id'][_0x6b7b('0x71')](),_0x6b7b('0x58'))['field'](_0x6b7b('0x6f'),'createdAt')[_0x6b7b('0x6e')](_0x6b7b('0x6f'),_0x6b7b('0x4e'))[_0x6b7b('0x72')](_0x6b7b('0x7c'))[_0x6b7b('0x3a')](_0x6b7b('0x73'))['where']('ListId\x20=\x20?',_0x20b65e[_0x6b7b('0x70')][_0x6b7b('0x71')]())[_0x6b7b('0x3a')](_0x6b7b('0x75'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x6b7b('0x77')]()['field'](_0x6b7b('0x7d'))['from']('cm_hopper')[_0x6b7b('0x3a')](_0x6b7b('0x7a'),_0x19c62e[_0x6b7b('0x44')]['id'][_0x6b7b('0x71')]())))[_0x6b7b('0x71')]();break;default:_0x5f4745=squel[_0x6b7b('0x67')]()['into'](_0x6b7b('0x68'))['fromQuery']([_0x6b7b('0x6a'),'scheduledAt',_0x6b7b('0x6c'),_0x6b7b('0x6d'),_0x6b7b('0x58'),_0x6b7b('0x50'),_0x6b7b('0x4e')],squel[_0x6b7b('0x77')]()['field']('phone','phone')['field'](_0x6b7b('0x6f'),_0x6b7b('0x6b'))[_0x6b7b('0x6e')]('id',_0x6b7b('0x6c'))['field'](_0x20b65e[_0x6b7b('0x70')]['toString'](),'ListId')[_0x6b7b('0x6e')](_0x19c62e[_0x6b7b('0x44')]['id'][_0x6b7b('0x71')](),'CampaignId')[_0x6b7b('0x6e')](_0x6b7b('0x6f'),_0x6b7b('0x50'))['field'](_0x6b7b('0x6f'),_0x6b7b('0x4e'))['from'](_0x6b7b('0x7c'))['where'](_0x6b7b('0x73'))[_0x6b7b('0x3a')](_0x6b7b('0x74'),_0x20b65e[_0x6b7b('0x70')][_0x6b7b('0x71')]())[_0x6b7b('0x3a')](_0x6b7b('0x75')))['toString']();}_0x28518b['push'](db[_0x6b7b('0x7e')]['query'](_0x5f4745));}return BPromise[_0x6b7b('0x7f')](_0x28518b);}})[_0x6b7b('0x24')](function(){return _0x2af1ef;})['then'](respondWithResult(_0x2b4807,null))[_0x6b7b('0x42')](handleError(_0x2b4807,null));};exports[_0x6b7b('0x80')]=function(_0x5182d5,_0x303ee4,_0xfddd7d){return db[_0x6b7b('0x2d')][_0x6b7b('0x46')]({'where':{'id':_0x5182d5['params']['id']}})['then'](handleEntityNotFound(_0x303ee4,null))['then'](function(_0x484ee7){if(_0x484ee7){return _0x484ee7[_0x6b7b('0x80')](_0x5182d5[_0x6b7b('0x31')][_0x6b7b('0x64')]);}})[_0x6b7b('0x24')](function(_0x2aecbe){if(_0x2aecbe){return db[_0x6b7b('0x56')]['destroy']({'where':{'ListId':_0x5182d5['query'][_0x6b7b('0x64')],'CampaignId':_0x5182d5[_0x6b7b('0x44')]['id']}})[_0x6b7b('0x24')](function(){return _0x2aecbe;});}})[_0x6b7b('0x24')](respondWithStatusCode(_0x303ee4,null))[_0x6b7b('0x42')](handleError(_0x303ee4,null));};exports['getBlackLists']=function(_0x36440b,_0x108e73,_0xd365f3){var _0x4ef756={};var _0x3fc692={};var _0x1adad1;var _0x25f554;return db[_0x6b7b('0x2d')][_0x6b7b('0x55')]({'where':{'id':_0x36440b[_0x6b7b('0x44')]['id']}})[_0x6b7b('0x24')](handleEntityNotFound(_0x108e73,null))[_0x6b7b('0x24')](function(_0x319209){if(_0x319209){_0x1adad1=_0x319209;_0x3fc692[_0x6b7b('0x34')]=_[_0x6b7b('0x30')](db[_0x6b7b('0x61')]['rawAttributes']);_0x3fc692[_0x6b7b('0x31')]=_[_0x6b7b('0x30')](_0x36440b[_0x6b7b('0x31')]);_0x3fc692[_0x6b7b('0x32')]=_['intersection'](_0x3fc692[_0x6b7b('0x34')],_0x3fc692['query']);_0x4ef756['attributes']=_[_0x6b7b('0x45')](_0x3fc692['model'],qs[_0x6b7b('0x35')](_0x36440b[_0x6b7b('0x31')]['fields']));_0x4ef756[_0x6b7b('0x33')]=_0x4ef756[_0x6b7b('0x33')][_0x6b7b('0x5b')]?_0x4ef756['attributes']:_0x3fc692[_0x6b7b('0x34')];_0x4ef756['order']=qs[_0x6b7b('0x38')](_0x36440b['query'][_0x6b7b('0x38')]);_0x4ef756[_0x6b7b('0x3a')]=qs['filters'](_[_0x6b7b('0x57')](_0x36440b[_0x6b7b('0x31')],_0x3fc692[_0x6b7b('0x32')]));if(_0x36440b['query'][_0x6b7b('0x39')]){_0x4ef756[_0x6b7b('0x3a')]=_[_0x6b7b('0x3b')](_0x4ef756[_0x6b7b('0x3a')],{'$or':_['map'](_0x4ef756[_0x6b7b('0x33')],function(_0x2a10d5){var _0x506398={};_0x506398[_0x2a10d5]={'$like':'%'+_0x36440b[_0x6b7b('0x31')]['filter']+'%'};return _0x506398;})});}_0x4ef756=_[_0x6b7b('0x3b')]({},_0x4ef756,_0x36440b[_0x6b7b('0x3d')]);return _0x1adad1[_0x6b7b('0x81')](_0x4ef756);}})[_0x6b7b('0x24')](function(_0x244131){if(_0x244131){_0x25f554=_0x244131[_0x6b7b('0x5b')];if(!_0x36440b['query'][_0x6b7b('0x36')]('nolimit')){_0x4ef756['limit']=qs[_0x6b7b('0x1d')](_0x36440b[_0x6b7b('0x31')]['limit']);_0x4ef756['offset']=qs[_0x6b7b('0x1b')](_0x36440b['query'][_0x6b7b('0x1b')]);}return _0x1adad1['getBlackLists'](_0x4ef756);}})[_0x6b7b('0x24')](function(_0x506088){if(_0x506088){return _0x506088?{'count':_0x25f554,'rows':_0x506088}:null;}})[_0x6b7b('0x24')](respondWithResult(_0x108e73,null))[_0x6b7b('0x42')](handleError(_0x108e73,null));};exports[_0x6b7b('0x82')]=function(_0x29286d,_0x5a8c56,_0x1ea42d){var _0x11c26a,_0x5d1712;return db[_0x6b7b('0x2d')]['find']({'where':{'id':_0x29286d[_0x6b7b('0x44')]['id']}})[_0x6b7b('0x24')](handleEntityNotFound(_0x5a8c56,null))[_0x6b7b('0x24')](function(_0x5f1ff8){if(_0x5f1ff8){_0x5d1712=_0x5f1ff8;return _0x5f1ff8[_0x6b7b('0x82')](_0x29286d['body'][_0x6b7b('0x64')],_[_0x6b7b('0x4d')](_0x29286d[_0x6b7b('0x4f')],[_0x6b7b('0x64'),'id'])||{});}return null;})[_0x6b7b('0x83')](function(_0x580ebb){var _0x4b366c;_0x11c26a=_0x580ebb||[];var _0x6ac5c2=[];if(_0x580ebb){for(var _0x441ca3=0x0;_0x441ca3<_0x580ebb[_0x6b7b('0x5b')];_0x441ca3+=0x1){var _0x2a46f2=_0x580ebb[_0x441ca3]['get']({'plain':!![]});_0x4b366c=squel[_0x6b7b('0x67')]()[_0x6b7b('0x84')](_0x6b7b('0x85'))['fromQuery'](['phone',_0x6b7b('0x6c'),_0x6b7b('0x6d'),_0x6b7b('0x58'),'createdAt',_0x6b7b('0x4e')],squel[_0x6b7b('0x77')]()['field'](_0x6b7b('0x6a'),_0x6b7b('0x6a'))[_0x6b7b('0x6e')]('id',_0x6b7b('0x6c'))[_0x6b7b('0x6e')](_0x2a46f2[_0x6b7b('0x70')][_0x6b7b('0x71')](),'ListId')[_0x6b7b('0x6e')](_0x29286d[_0x6b7b('0x44')]['id'][_0x6b7b('0x71')](),_0x6b7b('0x58'))['field'](_0x6b7b('0x6f'),_0x6b7b('0x50'))[_0x6b7b('0x6e')]('NOW()',_0x6b7b('0x4e'))[_0x6b7b('0x72')]('cm_contacts')[_0x6b7b('0x3a')](_0x6b7b('0x73'))['where'](_0x6b7b('0x74'),_0x2a46f2[_0x6b7b('0x70')][_0x6b7b('0x71')]())['where'](_0x6b7b('0x75')))['toString']();_0x6ac5c2[_0x6b7b('0x86')](db[_0x6b7b('0x7e')][_0x6b7b('0x31')](_0x4b366c));}return BPromise[_0x6b7b('0x7f')](_0x6ac5c2);}})['then'](function(){return _0x11c26a;})['then'](respondWithResult(_0x5a8c56,null))[_0x6b7b('0x42')](handleError(_0x5a8c56,null));};exports[_0x6b7b('0x87')]=function(_0x5287c3,_0x6db5f5,_0x15a464){return db['Campaign'][_0x6b7b('0x46')]({'where':{'id':_0x5287c3['params']['id']}})['then'](handleEntityNotFound(_0x6db5f5,null))[_0x6b7b('0x24')](function(_0x357daa){if(_0x357daa){return _0x357daa[_0x6b7b('0x87')](_0x5287c3[_0x6b7b('0x31')][_0x6b7b('0x64')]);}})['then'](function(_0x3a7516){if(_0x3a7516){return db[_0x6b7b('0x60')][_0x6b7b('0x25')]({'where':{'ListId':_0x5287c3[_0x6b7b('0x31')][_0x6b7b('0x64')],'CampaignId':_0x5287c3[_0x6b7b('0x44')]['id']}})[_0x6b7b('0x24')](function(){return _0x3a7516;});}})[_0x6b7b('0x24')](respondWithStatusCode(_0x6db5f5,null))[_0x6b7b('0x42')](handleError(_0x6db5f5,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 28d0fb3..57086f8 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(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index df8edfd..e497c50 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 _0xef38=['include','info','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCampaign','Campaign','findAll','options','raw','attributes','limit','map','model'];(function(_0x2d5116,_0x4a8bb5){var _0x44808d=function(_0x482ed2){while(--_0x482ed2){_0x2d5116['push'](_0x2d5116['shift']());}};_0x44808d(++_0x4a8bb5);}(_0xef38,0x122));var _0x8ef3=function(_0x103b66,_0x483f12){_0x103b66=_0x103b66-0x0;var _0x4e8417=_0xef38[_0x103b66];return _0x4e8417;};'use strict';var _=require('lodash');var util=require(_0x8ef3('0x0'));var moment=require(_0x8ef3('0x1'));var BPromise=require(_0x8ef3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ef3('0x3'))['db'];var utils=require(_0x8ef3('0x4'));var logger=require(_0x8ef3('0x5'))(_0x8ef3('0x6'));var config=require(_0x8ef3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8ef3('0x8')][_0x8ef3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50ee13,_0x2c9ccd,_0x26107d){return new BPromise(function(_0x217874,_0x12b6c0){return client[_0x8ef3('0xa')](_0x50ee13,_0x26107d)[_0x8ef3('0xb')](function(_0xc4b3b3){logger['info'](_0x8ef3('0xc'),_0x2c9ccd,_0x8ef3('0xd'));logger[_0x8ef3('0xe')](_0x8ef3('0xf'),_0x2c9ccd,_0x8ef3('0xd'),JSON[_0x8ef3('0x10')](_0xc4b3b3));if(_0xc4b3b3[_0x8ef3('0x11')]){if(_0xc4b3b3[_0x8ef3('0x11')][_0x8ef3('0x12')]===0x1f4){logger[_0x8ef3('0x11')](_0x8ef3('0xc'),_0x2c9ccd,_0xc4b3b3[_0x8ef3('0x11')][_0x8ef3('0x13')]);return _0x12b6c0(_0xc4b3b3[_0x8ef3('0x11')][_0x8ef3('0x13')]);}logger[_0x8ef3('0x11')](_0x8ef3('0xc'),_0x2c9ccd,_0xc4b3b3[_0x8ef3('0x11')][_0x8ef3('0x13')]);return _0x217874(_0xc4b3b3['error'][_0x8ef3('0x13')]);}else{logger['info'](_0x8ef3('0xc'),_0x2c9ccd,'request\x20sent');_0x217874(_0xc4b3b3[_0x8ef3('0x14')][_0x8ef3('0x13')]);}})['catch'](function(_0x56884c){logger[_0x8ef3('0x11')](_0x8ef3('0xc'),_0x2c9ccd,_0x56884c);_0x12b6c0(_0x56884c);});});}exports[_0x8ef3('0x15')]=function(_0x434aa9){var _0x5296f2=this;return new Promise(function(_0x5cbed2,_0x29025b){return db[_0x8ef3('0x16')][_0x8ef3('0x17')]({'raw':_0x434aa9[_0x8ef3('0x18')]?_0x434aa9['options'][_0x8ef3('0x19')]===undefined?!![]:![]:!![],'where':_0x434aa9[_0x8ef3('0x18')]?_0x434aa9[_0x8ef3('0x18')]['where']||null:null,'attributes':_0x434aa9['options']?_0x434aa9[_0x8ef3('0x18')][_0x8ef3('0x1a')]||null:null,'limit':_0x434aa9[_0x8ef3('0x18')]?_0x434aa9[_0x8ef3('0x18')][_0x8ef3('0x1b')]||null:null,'include':_0x434aa9[_0x8ef3('0x18')]?_0x434aa9[_0x8ef3('0x18')]['include']?_[_0x8ef3('0x1c')](_0x434aa9[_0x8ef3('0x18')]['include'],function(_0xa9829e){return{'model':db[_0xa9829e[_0x8ef3('0x1d')]],'as':_0xa9829e['as'],'attributes':_0xa9829e[_0x8ef3('0x1a')],'include':_0xa9829e[_0x8ef3('0x1e')]?_[_0x8ef3('0x1c')](_0xa9829e['include'],function(_0x18ef45){return{'model':db[_0x18ef45[_0x8ef3('0x1d')]],'as':_0x18ef45['as'],'attributes':_0x18ef45[_0x8ef3('0x1a')],'include':_0x18ef45[_0x8ef3('0x1e')]?_['map'](_0x18ef45[_0x8ef3('0x1e')],function(_0x28637a){return{'model':db[_0x28637a[_0x8ef3('0x1d')]],'as':_0x28637a['as'],'attributes':_0x28637a[_0x8ef3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8ef3('0xb')](function(_0x28748f){logger[_0x8ef3('0x1f')](_0x8ef3('0x15'),_0x434aa9);logger[_0x8ef3('0xe')](_0x8ef3('0x15'),_0x434aa9,JSON[_0x8ef3('0x10')](_0x28748f));_0x5cbed2(_0x28748f);})['catch'](function(_0x4408f9){logger[_0x8ef3('0x11')](_0x8ef3('0x15'),_0x4408f9[_0x8ef3('0x13')],_0x434aa9);_0x29025b(_0x5296f2[_0x8ef3('0x11')](0x1f4,_0x4408f9[_0x8ef3('0x13')]));});});}; \ No newline at end of file +var _0xd04b=['request\x20sent','debug','stringify','error','message','result','GetCampaign','findAll','options','attributes','limit','include','map','model','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xd04b,0x145));var _0xbd04=function(_0x129a3b,_0x41e316){_0x129a3b=_0x129a3b-0x0;var _0x5d1641=_0xd04b[_0x129a3b];return _0x5d1641;};'use strict';var _=require(_0xbd04('0x0'));var util=require(_0xbd04('0x1'));var moment=require(_0xbd04('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd04('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd04('0x4'))['db'];var utils=require(_0xbd04('0x5'));var logger=require(_0xbd04('0x6'))(_0xbd04('0x7'));var config=require(_0xbd04('0x8'));var jayson=require(_0xbd04('0x9'));var client=jayson[_0xbd04('0xa')][_0xbd04('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xaf5d,_0x3d949f,_0x421a71){return new BPromise(function(_0x5c3d7a,_0x67fdcd){return client[_0xbd04('0xc')](_0xaf5d,_0x421a71)[_0xbd04('0xd')](function(_0x24f7de){logger[_0xbd04('0xe')](_0xbd04('0xf'),_0x3d949f,_0xbd04('0x10'));logger[_0xbd04('0x11')]('Campaign,\x20%s,\x20%s,\x20%s',_0x3d949f,_0xbd04('0x10'),JSON[_0xbd04('0x12')](_0x24f7de));if(_0x24f7de[_0xbd04('0x13')]){if(_0x24f7de[_0xbd04('0x13')]['code']===0x1f4){logger[_0xbd04('0x13')](_0xbd04('0xf'),_0x3d949f,_0x24f7de[_0xbd04('0x13')]['message']);return _0x67fdcd(_0x24f7de['error']['message']);}logger['error'](_0xbd04('0xf'),_0x3d949f,_0x24f7de[_0xbd04('0x13')][_0xbd04('0x14')]);return _0x5c3d7a(_0x24f7de['error']['message']);}else{logger[_0xbd04('0xe')]('Campaign,\x20%s,\x20%s',_0x3d949f,_0xbd04('0x10'));_0x5c3d7a(_0x24f7de[_0xbd04('0x15')]['message']);}})['catch'](function(_0x4b001a){logger[_0xbd04('0x13')](_0xbd04('0xf'),_0x3d949f,_0x4b001a);_0x67fdcd(_0x4b001a);});});}exports[_0xbd04('0x16')]=function(_0x45e341){var _0x61161c=this;return new Promise(function(_0x6f0345,_0x48828f){return db['Campaign'][_0xbd04('0x17')]({'raw':_0x45e341[_0xbd04('0x18')]?_0x45e341['options']['raw']===undefined?!![]:![]:!![],'where':_0x45e341['options']?_0x45e341[_0xbd04('0x18')]['where']||null:null,'attributes':_0x45e341[_0xbd04('0x18')]?_0x45e341['options'][_0xbd04('0x19')]||null:null,'limit':_0x45e341[_0xbd04('0x18')]?_0x45e341['options'][_0xbd04('0x1a')]||null:null,'include':_0x45e341[_0xbd04('0x18')]?_0x45e341['options'][_0xbd04('0x1b')]?_[_0xbd04('0x1c')](_0x45e341[_0xbd04('0x18')][_0xbd04('0x1b')],function(_0x19d792){return{'model':db[_0x19d792['model']],'as':_0x19d792['as'],'attributes':_0x19d792[_0xbd04('0x19')],'include':_0x19d792[_0xbd04('0x1b')]?_[_0xbd04('0x1c')](_0x19d792[_0xbd04('0x1b')],function(_0x3d3e5b){return{'model':db[_0x3d3e5b['model']],'as':_0x3d3e5b['as'],'attributes':_0x3d3e5b[_0xbd04('0x19')],'include':_0x3d3e5b['include']?_[_0xbd04('0x1c')](_0x3d3e5b[_0xbd04('0x1b')],function(_0x45923c){return{'model':db[_0x45923c[_0xbd04('0x1d')]],'as':_0x45923c['as'],'attributes':_0x45923c[_0xbd04('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbd04('0xd')](function(_0x104036){logger[_0xbd04('0xe')](_0xbd04('0x16'),_0x45e341);logger[_0xbd04('0x11')]('GetCampaign',_0x45e341,JSON['stringify'](_0x104036));_0x6f0345(_0x104036);})[_0xbd04('0x1e')](function(_0x2230f9){logger[_0xbd04('0x13')](_0xbd04('0x16'),_0x2230f9[_0xbd04('0x14')],_0x45e341);_0x48828f(_0x61161c['error'](0x1f4,_0x2230f9[_0xbd04('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 9662af2..124f936 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 _0x569b=['getHoppers','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addBlackLists','put','update','destroy','delete','removeLists','removeBlackLists','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','/:id','show','/:id/hoppers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x569b,0x173));var _0xb569=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x569b[_0x2c7618];return _0x5ce3f0;};'use strict';var multer=require(_0xb569('0x0'));var util=require(_0xb569('0x1'));var path=require('path');var timeout=require(_0xb569('0x2'));var express=require(_0xb569('0x3'));var router=express[_0xb569('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb569('0x5'));var interaction=require(_0xb569('0x6'));var config=require('../../config/environment');var controller=require(_0xb569('0x7'));router[_0xb569('0x8')]('/',auth[_0xb569('0x9')](),controller['index']);router[_0xb569('0x8')](_0xb569('0xa'),auth[_0xb569('0x9')](),controller[_0xb569('0xb')]);router['get'](_0xb569('0xc'),auth['isAuthenticated'](),controller[_0xb569('0xd')]);router[_0xb569('0x8')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0xb569('0xe')]);router[_0xb569('0x8')](_0xb569('0xf'),auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0xb569('0x10'),auth[_0xb569('0x9')](),controller[_0xb569('0x11')]);router[_0xb569('0x8')](_0xb569('0x12'),auth[_0xb569('0x9')](),controller[_0xb569('0x13')]);router['get'](_0xb569('0x14'),auth[_0xb569('0x9')](),controller[_0xb569('0x15')]);router[_0xb569('0x16')]('/',auth['isAuthenticated'](),controller[_0xb569('0x17')]);router[_0xb569('0x16')](_0xb569('0x18'),auth[_0xb569('0x9')](),controller['clone']);router['post']('/:id/lists',auth[_0xb569('0x9')](),controller['addLists']);router[_0xb569('0x16')](_0xb569('0x14'),auth['isAuthenticated'](),controller[_0xb569('0x19')]);router[_0xb569('0x1a')](_0xb569('0xa'),auth[_0xb569('0x9')](),controller[_0xb569('0x1b')]);router['delete'](_0xb569('0xa'),auth[_0xb569('0x9')](),controller[_0xb569('0x1c')]);router[_0xb569('0x1d')](_0xb569('0x12'),auth[_0xb569('0x9')](),controller[_0xb569('0x1e')]);router[_0xb569('0x1d')](_0xb569('0x14'),auth[_0xb569('0x9')](),controller[_0xb569('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x8743=['destroy','removeBlackLists','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./campaign.controller','index','get','isAuthenticated','show','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','clone','addLists','addBlackLists','put','/:id','delete'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x8743,0x7a));var _0x3874=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x8743[_0x134c2e];return _0x2825db;};'use strict';var multer=require(_0x3874('0x0'));var util=require(_0x3874('0x1'));var path=require(_0x3874('0x2'));var timeout=require('connect-timeout');var express=require(_0x3874('0x3'));var router=express[_0x3874('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3874('0x5'));var config=require(_0x3874('0x6'));var controller=require(_0x3874('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x3874('0x8')]);router[_0x3874('0x9')]('/:id',auth[_0x3874('0xa')](),controller[_0x3874('0xb')]);router[_0x3874('0x9')]('/:id/hoppers',auth['isAuthenticated'](),controller['getHoppers']);router[_0x3874('0x9')]('/:id/hopper_histories',auth[_0x3874('0xa')](),controller[_0x3874('0xc')]);router['get']('/:id/hopper_finals',auth[_0x3874('0xa')](),controller[_0x3874('0xd')]);router[_0x3874('0x9')](_0x3874('0xe'),auth[_0x3874('0xa')](),controller[_0x3874('0xf')]);router['get'](_0x3874('0x10'),auth[_0x3874('0xa')](),controller[_0x3874('0x11')]);router[_0x3874('0x9')](_0x3874('0x12'),auth[_0x3874('0xa')](),controller['getBlackLists']);router[_0x3874('0x13')]('/',auth[_0x3874('0xa')](),controller[_0x3874('0x14')]);router[_0x3874('0x13')](_0x3874('0x15'),auth['isAuthenticated'](),controller[_0x3874('0x16')]);router[_0x3874('0x13')]('/:id/lists',auth[_0x3874('0xa')](),controller[_0x3874('0x17')]);router[_0x3874('0x13')](_0x3874('0x12'),auth[_0x3874('0xa')](),controller[_0x3874('0x18')]);router[_0x3874('0x19')](_0x3874('0x1a'),auth['isAuthenticated'](),controller['update']);router[_0x3874('0x1b')](_0x3874('0x1a'),auth[_0x3874('0xa')](),controller[_0x3874('0x1c')]);router[_0x3874('0x1b')](_0x3874('0x10'),auth[_0x3874('0xa')](),controller['removeLists']);router[_0x3874('0x1b')]('/:id/blacklists',auth[_0x3874('0xa')](),controller[_0x3874('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 48d98da..447bfe4 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 _0x8bc3=['getDataValue','key','STRING'];(function(_0x4bcd88,_0x36dc32){var _0x19b254=function(_0x1f7acf){while(--_0x1f7acf){_0x4bcd88['push'](_0x4bcd88['shift']());}};_0x19b254(++_0x36dc32);}(_0x8bc3,0x1a6));var _0x38bc=function(_0x448255,_0x2e681d){_0x448255=_0x448255-0x0;var _0x55d7ec=_0x8bc3[_0x448255];return _0x55d7ec;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize[_0x38bc('0x0')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x38bc('0x0')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x38bc('0x1')](_0x38bc('0x2'));}}}; \ No newline at end of file +var _0x6a7b=['STRING','TEXT','exports'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x6a7b,0x1d0));var _0xb6a7=function(_0x598f07,_0x1d91de){_0x598f07=_0x598f07-0x0;var _0x428a9b=_0x6a7b[_0x598f07];return _0x428a9b;};'use strict';var Sequelize=require('sequelize');module[_0xb6a7('0x0')]={'key':{'type':Sequelize[_0xb6a7('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xb6a7('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb6a7('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 8d4ce40..0400bd5 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 _0xde49=['filters','intersection','attributes','model','length','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','show','params','fields','catch','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','query','keys'];(function(_0x34eb31,_0x8f0f70){var _0x254994=function(_0xbec9a3){while(--_0xbec9a3){_0x34eb31['push'](_0x34eb31['shift']());}};_0x254994(++_0x8f0f70);}(_0xde49,0x1f1));var _0x9de4=function(_0x2293cf,_0x4747ac){_0x2293cf=_0x2293cf-0x0;var _0x14f93f=_0xde49[_0x2293cf];return _0x14f93f;};'use strict';var emlformat=require(_0x9de4('0x0'));var rimraf=require(_0x9de4('0x1'));var zipdir=require(_0x9de4('0x2'));var jsonpatch=require(_0x9de4('0x3'));var rp=require(_0x9de4('0x4'));var moment=require(_0x9de4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x9de4('0x6'));var sox=require(_0x9de4('0x7'));var csv=require(_0x9de4('0x8'));var ejs=require(_0x9de4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9de4('0xa'));var squel=require(_0x9de4('0xb'));var crypto=require(_0x9de4('0xc'));var jsforce=require(_0x9de4('0xd'));var deskjs=require(_0x9de4('0xe'));var toCsv=require(_0x9de4('0x8'));var querystring=require(_0x9de4('0xf'));var Papa=require(_0x9de4('0x10'));var Redis=require(_0x9de4('0x11'));var authService=require(_0x9de4('0x12'));var qs=require(_0x9de4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9de4('0x14'));var logger=require(_0x9de4('0x15'))('api');var utils=require(_0x9de4('0x16'));var config=require(_0x9de4('0x17'));var licenseUtil=require(_0x9de4('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7ca7aa,_0x3a1bd3){_0x3a1bd3=_0x3a1bd3||0xcc;return function(_0x1cdb4b){if(_0x1cdb4b){return _0x7ca7aa[_0x9de4('0x19')](_0x3a1bd3);}return _0x7ca7aa['status'](_0x3a1bd3)[_0x9de4('0x1a')]();};}function respondWithResult(_0x1ec39b,_0x315ba3){_0x315ba3=_0x315ba3||0xc8;return function(_0x5f64f8){if(_0x5f64f8){return _0x1ec39b[_0x9de4('0x1b')](_0x315ba3)[_0x9de4('0x1c')](_0x5f64f8);}};}function respondWithFilteredResult(_0xb75ff7,_0x15d96f){return function(_0x20ed3f){if(_0x20ed3f){var _0x3fce8a=typeof _0x15d96f[_0x9de4('0x1d')]==='undefined'&&typeof _0x15d96f[_0x9de4('0x1e')]==='undefined';var _0x203a34=_0x20ed3f[_0x9de4('0x1f')];var _0x32d8ed=_0x3fce8a?0x0:_0x15d96f['offset'];var _0x167f04=_0x3fce8a?_0x20ed3f[_0x9de4('0x1f')]:_0x15d96f[_0x9de4('0x1d')]+_0x15d96f[_0x9de4('0x1e')];var _0x57fcaa;if(_0x167f04>=_0x203a34){_0x167f04=_0x203a34;_0x57fcaa=0xc8;}else{_0x57fcaa=0xce;}_0xb75ff7['status'](_0x57fcaa);return _0xb75ff7['set'](_0x9de4('0x20'),_0x32d8ed+'-'+_0x167f04+'/'+_0x203a34)[_0x9de4('0x1c')](_0x20ed3f);}return null;};}function patchUpdates(_0x4f0472){return function(_0x15ced7){try{jsonpatch[_0x9de4('0x21')](_0x15ced7,_0x4f0472,!![]);}catch(_0x1cc0d9){return BPromise[_0x9de4('0x22')](_0x1cc0d9);}return _0x15ced7[_0x9de4('0x23')]();};}function saveUpdates(_0x504c4b,_0x518448){return function(_0x1444ea){if(_0x1444ea){return _0x1444ea[_0x9de4('0x24')](_0x504c4b)[_0x9de4('0x25')](function(_0x5d6a55){return _0x5d6a55;});}return null;};}function removeEntity(_0x26e834,_0x3f3de8){return function(_0x3819b0){if(_0x3819b0){return _0x3819b0[_0x9de4('0x26')]()['then'](function(){var _0x182a1e=_0x3819b0[_0x9de4('0x27')]({'plain':!![]});var _0x2e626a=_0x9de4('0x28');return db[_0x9de4('0x29')][_0x9de4('0x26')]({'where':{'type':_0x2e626a,'resourceId':_0x182a1e['id']}})['then'](function(){return _0x3819b0;});})[_0x9de4('0x25')](function(){_0x26e834[_0x9de4('0x1b')](0xcc)[_0x9de4('0x1a')]();});}};}function handleEntityNotFound(_0x589f22,_0xf9c205){return function(_0x76e5f7){if(!_0x76e5f7){_0x589f22['sendStatus'](0x194);}return _0x76e5f7;};}function handleError(_0x2d9fa9,_0x3bcd01){_0x3bcd01=_0x3bcd01||0x1f4;return function(_0x1bfcfd){logger[_0x9de4('0x2a')](_0x1bfcfd[_0x9de4('0x2b')]);if(_0x1bfcfd['name']){delete _0x1bfcfd[_0x9de4('0x2c')];}_0x2d9fa9[_0x9de4('0x1b')](_0x3bcd01)[_0x9de4('0x2d')](_0x1bfcfd);};}exports[_0x9de4('0x2e')]=function(_0x413816,_0x553f81){var _0x351378={},_0x1474c8={},_0x257f6d={'count':0x0,'rows':[]};var _0xca76d5=_[_0x9de4('0x2f')](db[_0x9de4('0x30')][_0x9de4('0x31')],function(_0x39267b){return{'name':_0x39267b[_0x9de4('0x32')],'type':_0x39267b[_0x9de4('0x33')][_0x9de4('0x34')]};});_0x1474c8['model']=_[_0x9de4('0x2f')](_0xca76d5,_0x9de4('0x2c'));_0x1474c8[_0x9de4('0x35')]=_[_0x9de4('0x36')](_0x413816['query']);_0x1474c8[_0x9de4('0x37')]=_[_0x9de4('0x38')](_0x1474c8['model'],_0x1474c8['query']);_0x351378[_0x9de4('0x39')]=_[_0x9de4('0x38')](_0x1474c8[_0x9de4('0x3a')],qs['fields'](_0x413816[_0x9de4('0x35')]['fields']));_0x351378[_0x9de4('0x39')]=_0x351378['attributes'][_0x9de4('0x3b')]?_0x351378[_0x9de4('0x39')]:_0x1474c8['model'];if(!_0x413816['query']['hasOwnProperty'](_0x9de4('0x3c'))){_0x351378[_0x9de4('0x1e')]=qs['limit'](_0x413816[_0x9de4('0x35')]['limit']);_0x351378[_0x9de4('0x1d')]=qs[_0x9de4('0x1d')](_0x413816[_0x9de4('0x35')][_0x9de4('0x1d')]);}_0x351378[_0x9de4('0x3d')]=qs['sort'](_0x413816['query'][_0x9de4('0x3e')]);_0x351378[_0x9de4('0x3f')]=qs['filters'](_[_0x9de4('0x40')](_0x413816['query'],_0x1474c8[_0x9de4('0x37')]),_0xca76d5);if(_0x413816['query']['filter']){_0x351378[_0x9de4('0x3f')]=_[_0x9de4('0x41')](_0x351378['where'],{'$or':[{'key':{'$like':'%'+_0x413816[_0x9de4('0x35')][_0x9de4('0x42')]+'%'}},{'value':{'$like':'%'+_0x413816['query']['filter']+'%'}}]});}_0x351378=_[_0x9de4('0x41')]({},_0x351378,_0x413816[_0x9de4('0x43')]);var _0x4cbd21={'where':_0x351378[_0x9de4('0x3f')]};return db[_0x9de4('0x30')][_0x9de4('0x1f')](_0x4cbd21)[_0x9de4('0x25')](function(_0x5292f8){_0x257f6d[_0x9de4('0x1f')]=_0x5292f8;if(_0x413816[_0x9de4('0x35')][_0x9de4('0x44')]){_0x351378[_0x9de4('0x45')]=[{'all':!![]}];}return db[_0x9de4('0x30')][_0x9de4('0x46')](_0x351378);})[_0x9de4('0x25')](function(_0x458077){_0x257f6d[_0x9de4('0x47')]=_0x458077;return _0x257f6d;})[_0x9de4('0x25')](respondWithFilteredResult(_0x553f81,_0x351378))['catch'](handleError(_0x553f81,null));};exports[_0x9de4('0x48')]=function(_0x7b758b,_0x2ab672){var _0x57fed0={'raw':!![],'where':{'id':_0x7b758b[_0x9de4('0x49')]['id']}},_0x4b61cd={};_0x4b61cd[_0x9de4('0x3a')]=_[_0x9de4('0x36')](db[_0x9de4('0x30')][_0x9de4('0x31')]);_0x4b61cd[_0x9de4('0x35')]=_[_0x9de4('0x36')](_0x7b758b[_0x9de4('0x35')]);_0x4b61cd[_0x9de4('0x37')]=_[_0x9de4('0x38')](_0x4b61cd[_0x9de4('0x3a')],_0x4b61cd[_0x9de4('0x35')]);_0x57fed0[_0x9de4('0x39')]=_[_0x9de4('0x38')](_0x4b61cd[_0x9de4('0x3a')],qs['fields'](_0x7b758b[_0x9de4('0x35')][_0x9de4('0x4a')]));_0x57fed0[_0x9de4('0x39')]=_0x57fed0[_0x9de4('0x39')][_0x9de4('0x3b')]?_0x57fed0[_0x9de4('0x39')]:_0x4b61cd[_0x9de4('0x3a')];if(_0x7b758b[_0x9de4('0x35')][_0x9de4('0x44')]){_0x57fed0[_0x9de4('0x45')]=[{'all':!![]}];}_0x57fed0=_[_0x9de4('0x41')]({},_0x57fed0,_0x7b758b[_0x9de4('0x43')]);return db[_0x9de4('0x30')]['find'](_0x57fed0)[_0x9de4('0x25')](handleEntityNotFound(_0x2ab672,null))[_0x9de4('0x25')](respondWithResult(_0x2ab672,null))[_0x9de4('0x4b')](handleError(_0x2ab672,null));};exports['update']=function(_0x152760,_0x2cd163){if(_0x152760[_0x9de4('0x4c')]['id']){delete _0x152760[_0x9de4('0x4c')]['id'];}return db[_0x9de4('0x30')][_0x9de4('0x4d')]({'where':{'id':_0x152760[_0x9de4('0x49')]['id']}})[_0x9de4('0x25')](handleEntityNotFound(_0x2cd163,null))[_0x9de4('0x25')](saveUpdates(_0x152760[_0x9de4('0x4c')],null))[_0x9de4('0x25')](respondWithResult(_0x2cd163,null))['catch'](handleError(_0x2cd163,null));};exports[_0x9de4('0x26')]=function(_0x4400f0,_0x487a1a){return db[_0x9de4('0x30')][_0x9de4('0x4d')]({'where':{'id':_0x4400f0[_0x9de4('0x49')]['id']}})['then'](handleEntityNotFound(_0x487a1a,null))[_0x9de4('0x25')](removeEntity(_0x487a1a,null))[_0x9de4('0x4b')](handleError(_0x487a1a,null));};exports[_0x9de4('0x4e')]=function(_0x540dd8,_0x355d4f){var _0x56f202={'key':_0x540dd8[_0x9de4('0x4c')][_0x9de4('0x34')]};if(_0x540dd8[_0x9de4('0x4c')][_0x9de4('0x4f')]){_0x56f202[_0x9de4('0x4f')]=_0x540dd8['body']['MailAccountId'];}else if(_0x540dd8['body'][_0x9de4('0x50')]){_0x56f202['SmsAccountId']=_0x540dd8[_0x9de4('0x4c')][_0x9de4('0x50')];}else if(_0x540dd8[_0x9de4('0x4c')][_0x9de4('0x51')]){_0x56f202['OpenchannelAccountId']=_0x540dd8[_0x9de4('0x4c')][_0x9de4('0x51')];}else if(_0x540dd8[_0x9de4('0x4c')][_0x9de4('0x52')]){_0x56f202['ChatWebsiteId']=_0x540dd8[_0x9de4('0x4c')][_0x9de4('0x52')];}return db[_0x9de4('0x30')][_0x9de4('0x4d')]({'where':_0x56f202})[_0x9de4('0x25')](function(_0x20e9d2){if(_0x20e9d2){throw new db[(_0x9de4('0x53'))][(_0x9de4('0x54'))](_0x9de4('0x55'));}return db['CannedAnswer']['create'](_0x540dd8['body']);})['then'](function(_0x418bbc){var _0x462536=_0x540dd8[_0x9de4('0x56')]['get']({'plain':!![]});if(!_0x462536)throw new Error(_0x9de4('0x57'));if(_0x462536[_0x9de4('0x58')]===_0x9de4('0x56')){var _0x120f26=_0x418bbc[_0x9de4('0x27')]({'plain':!![]});return db[_0x9de4('0x59')][_0x9de4('0x4d')]({'where':{'name':'CannedAnswers','userProfileId':_0x462536[_0x9de4('0x5a')]},'raw':!![]})[_0x9de4('0x25')](function(_0x539437){if(_0x539437&&_0x539437['autoAssociation']===0x0){return db[_0x9de4('0x29')][_0x9de4('0x4e')]({'name':_0x120f26['name'],'resourceId':_0x120f26['id'],'type':_0x539437[_0x9de4('0x2c')],'sectionId':_0x539437['id']},{})[_0x9de4('0x25')](function(){return _0x418bbc;});}else{return _0x418bbc;}})[_0x9de4('0x4b')](function(_0x53015d){logger[_0x9de4('0x2a')](_0x9de4('0x5b'),_0x53015d);throw _0x53015d;});}return _0x418bbc;})['then'](respondWithResult(_0x355d4f,0xc9))[_0x9de4('0x4b')](handleError(_0x355d4f,null));}; \ No newline at end of file +var _0x1542=['type','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','filter','merge','include','findAll','rows','catch','show','includeAll','options','body','params','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','get','CannedAnswers','UserProfileResource','destroy','error','stack','name','send','index','map','CannedAnswer','rawAttributes'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x1542,0x134));var _0x2154=function(_0x51a105,_0x1f25ca){_0x51a105=_0x51a105-0x0;var _0x2366c9=_0x1542[_0x51a105];return _0x2366c9;};'use strict';var emlformat=require(_0x2154('0x0'));var rimraf=require(_0x2154('0x1'));var zipdir=require(_0x2154('0x2'));var jsonpatch=require(_0x2154('0x3'));var rp=require(_0x2154('0x4'));var moment=require(_0x2154('0x5'));var BPromise=require(_0x2154('0x6'));var Mustache=require(_0x2154('0x7'));var util=require(_0x2154('0x8'));var path=require('path');var sox=require(_0x2154('0x9'));var csv=require(_0x2154('0xa'));var ejs=require(_0x2154('0xb'));var fs=require('fs');var fs_extra=require(_0x2154('0xc'));var _=require('lodash');var squel=require(_0x2154('0xd'));var crypto=require(_0x2154('0xe'));var jsforce=require(_0x2154('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2154('0xa'));var querystring=require(_0x2154('0x10'));var Papa=require(_0x2154('0x11'));var Redis=require(_0x2154('0x12'));var authService=require(_0x2154('0x13'));var qs=require(_0x2154('0x14'));var as=require(_0x2154('0x15'));var hardwareService=require(_0x2154('0x16'));var logger=require('../../config/logger')(_0x2154('0x17'));var utils=require('../../config/utils');var config=require(_0x2154('0x18'));var licenseUtil=require(_0x2154('0x19'));var db=require(_0x2154('0x1a'))['db'];function respondWithStatusCode(_0x2344a2,_0x4ec10d){_0x4ec10d=_0x4ec10d||0xcc;return function(_0x2ef5d9){if(_0x2ef5d9){return _0x2344a2[_0x2154('0x1b')](_0x4ec10d);}return _0x2344a2['status'](_0x4ec10d)[_0x2154('0x1c')]();};}function respondWithResult(_0x33d1dd,_0x2cc7f5){_0x2cc7f5=_0x2cc7f5||0xc8;return function(_0xa2564f){if(_0xa2564f){return _0x33d1dd[_0x2154('0x1d')](_0x2cc7f5)[_0x2154('0x1e')](_0xa2564f);}};}function respondWithFilteredResult(_0x317a1d,_0x22a863){return function(_0x400b08){if(_0x400b08){var _0x30611c=typeof _0x22a863[_0x2154('0x1f')]==='undefined'&&typeof _0x22a863[_0x2154('0x20')]===_0x2154('0x21');var _0x21cdca=_0x400b08[_0x2154('0x22')];var _0x486836=_0x30611c?0x0:_0x22a863[_0x2154('0x1f')];var _0x3d680a=_0x30611c?_0x400b08[_0x2154('0x22')]:_0x22a863[_0x2154('0x1f')]+_0x22a863[_0x2154('0x20')];var _0x493781;if(_0x3d680a>=_0x21cdca){_0x3d680a=_0x21cdca;_0x493781=0xc8;}else{_0x493781=0xce;}_0x317a1d[_0x2154('0x1d')](_0x493781);return _0x317a1d['set'](_0x2154('0x23'),_0x486836+'-'+_0x3d680a+'/'+_0x21cdca)[_0x2154('0x1e')](_0x400b08);}return null;};}function patchUpdates(_0x2ea075){return function(_0x3abb04){try{jsonpatch['apply'](_0x3abb04,_0x2ea075,!![]);}catch(_0x134255){return BPromise[_0x2154('0x24')](_0x134255);}return _0x3abb04[_0x2154('0x25')]();};}function saveUpdates(_0x3b26c1,_0x440b34){return function(_0x287494){if(_0x287494){return _0x287494[_0x2154('0x26')](_0x3b26c1)['then'](function(_0x2dfad0){return _0x2dfad0;});}return null;};}function removeEntity(_0x19524e,_0x3f1212){return function(_0x513dc0){if(_0x513dc0){return _0x513dc0['destroy']()[_0x2154('0x27')](function(){var _0x40b244=_0x513dc0[_0x2154('0x28')]({'plain':!![]});var _0xe1f9db=_0x2154('0x29');return db[_0x2154('0x2a')][_0x2154('0x2b')]({'where':{'type':_0xe1f9db,'resourceId':_0x40b244['id']}})[_0x2154('0x27')](function(){return _0x513dc0;});})[_0x2154('0x27')](function(){_0x19524e[_0x2154('0x1d')](0xcc)[_0x2154('0x1c')]();});}};}function handleEntityNotFound(_0xffc073,_0x158680){return function(_0x38b3ec){if(!_0x38b3ec){_0xffc073[_0x2154('0x1b')](0x194);}return _0x38b3ec;};}function handleError(_0x20c0a4,_0x2d885a){_0x2d885a=_0x2d885a||0x1f4;return function(_0x3b0a4a){logger[_0x2154('0x2c')](_0x3b0a4a[_0x2154('0x2d')]);if(_0x3b0a4a[_0x2154('0x2e')]){delete _0x3b0a4a[_0x2154('0x2e')];}_0x20c0a4[_0x2154('0x1d')](_0x2d885a)[_0x2154('0x2f')](_0x3b0a4a);};}exports[_0x2154('0x30')]=function(_0x47fc08,_0x488ef4){var _0x122881={},_0xfd83ef={},_0xdd491d={'count':0x0,'rows':[]};var _0x580be8=_[_0x2154('0x31')](db[_0x2154('0x32')][_0x2154('0x33')],function(_0x2344f8){return{'name':_0x2344f8['fieldName'],'type':_0x2344f8[_0x2154('0x34')]['key']};});_0xfd83ef[_0x2154('0x35')]=_[_0x2154('0x31')](_0x580be8,_0x2154('0x2e'));_0xfd83ef['query']=_[_0x2154('0x36')](_0x47fc08['query']);_0xfd83ef['filters']=_[_0x2154('0x37')](_0xfd83ef[_0x2154('0x35')],_0xfd83ef[_0x2154('0x38')]);_0x122881[_0x2154('0x39')]=_['intersection'](_0xfd83ef[_0x2154('0x35')],qs[_0x2154('0x3a')](_0x47fc08[_0x2154('0x38')][_0x2154('0x3a')]));_0x122881[_0x2154('0x39')]=_0x122881[_0x2154('0x39')][_0x2154('0x3b')]?_0x122881[_0x2154('0x39')]:_0xfd83ef[_0x2154('0x35')];if(!_0x47fc08[_0x2154('0x38')][_0x2154('0x3c')](_0x2154('0x3d'))){_0x122881[_0x2154('0x20')]=qs['limit'](_0x47fc08[_0x2154('0x38')][_0x2154('0x20')]);_0x122881[_0x2154('0x1f')]=qs['offset'](_0x47fc08[_0x2154('0x38')][_0x2154('0x1f')]);}_0x122881[_0x2154('0x3e')]=qs['sort'](_0x47fc08['query']['sort']);_0x122881[_0x2154('0x3f')]=qs[_0x2154('0x40')](_['pick'](_0x47fc08[_0x2154('0x38')],_0xfd83ef[_0x2154('0x40')]),_0x580be8);if(_0x47fc08[_0x2154('0x38')]['filter']){_0x122881['where']=_['merge'](_0x122881[_0x2154('0x3f')],{'$or':[{'key':{'$like':'%'+_0x47fc08['query'][_0x2154('0x41')]+'%'}},{'value':{'$like':'%'+_0x47fc08[_0x2154('0x38')][_0x2154('0x41')]+'%'}}]});}_0x122881=_[_0x2154('0x42')]({},_0x122881,_0x47fc08['options']);var _0x536ced={'where':_0x122881[_0x2154('0x3f')]};return db['CannedAnswer'][_0x2154('0x22')](_0x536ced)[_0x2154('0x27')](function(_0x380946){_0xdd491d[_0x2154('0x22')]=_0x380946;if(_0x47fc08[_0x2154('0x38')]['includeAll']){_0x122881[_0x2154('0x43')]=[{'all':!![]}];}return db['CannedAnswer'][_0x2154('0x44')](_0x122881);})[_0x2154('0x27')](function(_0x3b9982){_0xdd491d[_0x2154('0x45')]=_0x3b9982;return _0xdd491d;})['then'](respondWithFilteredResult(_0x488ef4,_0x122881))[_0x2154('0x46')](handleError(_0x488ef4,null));};exports[_0x2154('0x47')]=function(_0x30988f,_0x45d570){var _0x20ed35={'raw':!![],'where':{'id':_0x30988f['params']['id']}},_0x2332ce={};_0x2332ce[_0x2154('0x35')]=_['keys'](db[_0x2154('0x32')]['rawAttributes']);_0x2332ce[_0x2154('0x38')]=_[_0x2154('0x36')](_0x30988f[_0x2154('0x38')]);_0x2332ce[_0x2154('0x40')]=_[_0x2154('0x37')](_0x2332ce['model'],_0x2332ce[_0x2154('0x38')]);_0x20ed35[_0x2154('0x39')]=_[_0x2154('0x37')](_0x2332ce[_0x2154('0x35')],qs[_0x2154('0x3a')](_0x30988f[_0x2154('0x38')][_0x2154('0x3a')]));_0x20ed35[_0x2154('0x39')]=_0x20ed35[_0x2154('0x39')]['length']?_0x20ed35[_0x2154('0x39')]:_0x2332ce[_0x2154('0x35')];if(_0x30988f[_0x2154('0x38')][_0x2154('0x48')]){_0x20ed35[_0x2154('0x43')]=[{'all':!![]}];}_0x20ed35=_[_0x2154('0x42')]({},_0x20ed35,_0x30988f[_0x2154('0x49')]);return db['CannedAnswer']['find'](_0x20ed35)[_0x2154('0x27')](handleEntityNotFound(_0x45d570,null))['then'](respondWithResult(_0x45d570,null))['catch'](handleError(_0x45d570,null));};exports[_0x2154('0x26')]=function(_0x4de0c9,_0x35eb4e){if(_0x4de0c9[_0x2154('0x4a')]['id']){delete _0x4de0c9['body']['id'];}return db['CannedAnswer']['find']({'where':{'id':_0x4de0c9[_0x2154('0x4b')]['id']}})[_0x2154('0x27')](handleEntityNotFound(_0x35eb4e,null))[_0x2154('0x27')](saveUpdates(_0x4de0c9[_0x2154('0x4a')],null))[_0x2154('0x27')](respondWithResult(_0x35eb4e,null))[_0x2154('0x46')](handleError(_0x35eb4e,null));};exports[_0x2154('0x2b')]=function(_0x585208,_0x48a8fe){return db[_0x2154('0x32')][_0x2154('0x4c')]({'where':{'id':_0x585208[_0x2154('0x4b')]['id']}})[_0x2154('0x27')](handleEntityNotFound(_0x48a8fe,null))['then'](removeEntity(_0x48a8fe,null))[_0x2154('0x46')](handleError(_0x48a8fe,null));};exports[_0x2154('0x4d')]=function(_0x3eb3de,_0x548dfa){var _0x213a41={'key':_0x3eb3de[_0x2154('0x4a')]['key']};if(_0x3eb3de[_0x2154('0x4a')][_0x2154('0x4e')]){_0x213a41[_0x2154('0x4e')]=_0x3eb3de[_0x2154('0x4a')][_0x2154('0x4e')];}else if(_0x3eb3de['body'][_0x2154('0x4f')]){_0x213a41[_0x2154('0x4f')]=_0x3eb3de[_0x2154('0x4a')][_0x2154('0x4f')];}else if(_0x3eb3de[_0x2154('0x4a')][_0x2154('0x50')]){_0x213a41[_0x2154('0x50')]=_0x3eb3de[_0x2154('0x4a')][_0x2154('0x50')];}else if(_0x3eb3de[_0x2154('0x4a')][_0x2154('0x51')]){_0x213a41[_0x2154('0x51')]=_0x3eb3de[_0x2154('0x4a')][_0x2154('0x51')];}return db[_0x2154('0x32')]['find']({'where':_0x213a41})['then'](function(_0x46910d){if(_0x46910d){throw new db['Sequelize'][(_0x2154('0x52'))](_0x2154('0x53'));}return db[_0x2154('0x32')][_0x2154('0x4d')](_0x3eb3de[_0x2154('0x4a')]);})[_0x2154('0x27')](function(_0x9a78d1){var _0x432a2e=_0x3eb3de['user']['get']({'plain':!![]});if(!_0x432a2e)throw new Error(_0x2154('0x54'));if(_0x432a2e['role']===_0x2154('0x55')){var _0x57b401=_0x9a78d1[_0x2154('0x28')]({'plain':!![]});return db[_0x2154('0x56')][_0x2154('0x4c')]({'where':{'name':_0x2154('0x29'),'userProfileId':_0x432a2e[_0x2154('0x57')]},'raw':!![]})['then'](function(_0x343151){if(_0x343151&&_0x343151[_0x2154('0x58')]===0x0){return db[_0x2154('0x2a')][_0x2154('0x4d')]({'name':_0x57b401[_0x2154('0x2e')],'resourceId':_0x57b401['id'],'type':_0x343151[_0x2154('0x2e')],'sectionId':_0x343151['id']},{})[_0x2154('0x27')](function(){return _0x9a78d1;});}else{return _0x9a78d1;}})[_0x2154('0x46')](function(_0xf3d88d){logger[_0x2154('0x2c')](_0x2154('0x59'),_0xf3d88d);throw _0xf3d88d;});}return _0x9a78d1;})[_0x2154('0x27')](respondWithResult(_0x548dfa,0xc9))[_0x2154('0x46')](handleError(_0x548dfa,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index c512e4e..d7869e6 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 _0xeaa7=['request-promise','exports','define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird'];(function(_0x398175,_0x363721){var _0x7cb4fc=function(_0x454fd4){while(--_0x454fd4){_0x398175['push'](_0x398175['shift']());}};_0x7cb4fc(++_0x363721);}(_0xeaa7,0x13a));var _0x7eaa=function(_0x11a55c,_0x4eced9){_0x11a55c=_0x11a55c-0x0;var _0x26c390=_0xeaa7[_0x11a55c];return _0x26c390;};'use strict';var _=require('lodash');var util=require(_0x7eaa('0x0'));var logger=require(_0x7eaa('0x1'))(_0x7eaa('0x2'));var moment=require(_0x7eaa('0x3'));var BPromise=require(_0x7eaa('0x4'));var rp=require(_0x7eaa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cannedAnswer.attributes');module[_0x7eaa('0x6')]=function(_0x21ce95,_0x3f0a3e){return _0x21ce95[_0x7eaa('0x7')](_0x7eaa('0x8'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7eaa('0x9'),'collate':_0x7eaa('0xa')});}; \ No newline at end of file +var _0xe844=['CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./cannedAnswer.attributes','define'];(function(_0x1536ab,_0x44ac02){var _0x2e16ae=function(_0x10532d){while(--_0x10532d){_0x1536ab['push'](_0x1536ab['shift']());}};_0x2e16ae(++_0x44ac02);}(_0xe844,0xba));var _0x4e84=function(_0x3a2d12,_0x2dc2c2){_0x3a2d12=_0x3a2d12-0x0;var _0x22e212=_0xe844[_0x3a2d12];return _0x22e212;};'use strict';var _=require(_0x4e84('0x0'));var util=require(_0x4e84('0x1'));var logger=require(_0x4e84('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4e84('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e84('0x4'));var rimraf=require(_0x4e84('0x5'));var config=require(_0x4e84('0x6'));var attributes=require(_0x4e84('0x7'));module['exports']=function(_0x455042,_0x245309){return _0x455042[_0x4e84('0x8')](_0x4e84('0x9'),attributes,{'tableName':_0x4e84('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4e84('0xb'),'collate':_0x4e84('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 3891807..5fd1986 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(_0x227a73,_0xb55b36){var _0x99dc57=function(_0x14ffa3){while(--_0x14ffa3){_0x227a73['push'](_0x227a73['shift']());}};_0x99dc57(++_0xb55b36);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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(_0x5675a8,_0x20cf73){var _0x401165=function(_0xeb8fbe){while(--_0xeb8fbe){_0x5675a8['push'](_0x5675a8['shift']());}};_0x401165(++_0x20cf73);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 1a8e836..71436da 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 _0x9ae7=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer','path'];(function(_0x31157d,_0x4ce3e2){var _0x48a2ab=function(_0x347894){while(--_0x347894){_0x31157d['push'](_0x31157d['shift']());}};_0x48a2ab(++_0x4ce3e2);}(_0x9ae7,0x8e));var _0x79ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ae7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x79ae('0x0'));var util=require('util');var path=require(_0x79ae('0x1'));var timeout=require(_0x79ae('0x2'));var express=require(_0x79ae('0x3'));var router=express[_0x79ae('0x4')]();var fs_extra=require(_0x79ae('0x5'));var auth=require(_0x79ae('0x6'));var interaction=require(_0x79ae('0x7'));var config=require('../../config/environment');var controller=require(_0x79ae('0x8'));router['get']('/',auth[_0x79ae('0x9')](),controller[_0x79ae('0xa')]);router['get'](_0x79ae('0xb'),auth[_0x79ae('0x9')](),controller[_0x79ae('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x79ae('0xd')]);router[_0x79ae('0xe')](_0x79ae('0xb'),auth[_0x79ae('0x9')](),controller['update']);router[_0x79ae('0xf')]('/:id',auth[_0x79ae('0x9')](),controller[_0x79ae('0x10')]);module[_0x79ae('0x11')]=router; \ No newline at end of file +var _0x6bb0=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','get','post','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0xb1b7b,_0x13eaa0){var _0x339c3b=function(_0x5ca153){while(--_0x5ca153){_0xb1b7b['push'](_0xb1b7b['shift']());}};_0x339c3b(++_0x13eaa0);}(_0x6bb0,0xb2));var _0x06bb=function(_0x3414b2,_0x38fedb){_0x3414b2=_0x3414b2-0x0;var _0x295550=_0x6bb0[_0x3414b2];return _0x295550;};'use strict';var multer=require(_0x06bb('0x0'));var util=require(_0x06bb('0x1'));var path=require(_0x06bb('0x2'));var timeout=require(_0x06bb('0x3'));var express=require(_0x06bb('0x4'));var router=express[_0x06bb('0x5')]();var fs_extra=require(_0x06bb('0x6'));var auth=require(_0x06bb('0x7'));var interaction=require(_0x06bb('0x8'));var config=require(_0x06bb('0x9'));var controller=require(_0x06bb('0xa'));router['get']('/',auth[_0x06bb('0xb')](),controller['index']);router[_0x06bb('0xc')]('/:id',auth[_0x06bb('0xb')](),controller['show']);router[_0x06bb('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x06bb('0xe')](_0x06bb('0xf'),auth[_0x06bb('0xb')](),controller[_0x06bb('0x10')]);router[_0x06bb('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x06bb('0x12')]);module[_0x06bb('0x13')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 18e9901..695efd3 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 _0x7b10=['STRING','INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7b10,0x1ac));var _0x07b1=function(_0x268db2,_0x136711){_0x268db2=_0x268db2-0x0;var _0x1d77c7=_0x7b10[_0x268db2];return _0x1d77c7;};'use strict';var Sequelize=require(_0x07b1('0x0'));module[_0x07b1('0x1')]={'calldate':{'type':Sequelize[_0x07b1('0x2')],'allowNull':![],'defaultValue':_0x07b1('0x3')},'clid':{'type':Sequelize[_0x07b1('0x4')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x07b1('0x4')]},'dcontext':{'type':Sequelize[_0x07b1('0x4')]},'channel':{'type':Sequelize[_0x07b1('0x4')]},'dstchannel':{'type':Sequelize[_0x07b1('0x4')]},'lastapp':{'type':Sequelize[_0x07b1('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x07b1('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x07b1('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x07b1('0x4')]},'amaflags':{'type':Sequelize[_0x07b1('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x07b1('0x4')]},'userfield':{'type':Sequelize[_0x07b1('0x4')]},'uniqueid':{'type':Sequelize[_0x07b1('0x4')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x07b1('0x4')]}}; \ No newline at end of file +var _0x9993=['sequelize','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x53dc7e,_0x4e032a){var _0x6645ea=function(_0x6ab792){while(--_0x6ab792){_0x53dc7e['push'](_0x53dc7e['shift']());}};_0x6645ea(++_0x4e032a);}(_0x9993,0x109));var _0x3999=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x9993[_0x25e7cb];return _0x375d92;};'use strict';var Sequelize=require(_0x3999('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x3999('0x1')],'allowNull':![],'defaultValue':_0x3999('0x2')},'clid':{'type':Sequelize[_0x3999('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x3999('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3999('0x3')]},'dstchannel':{'type':Sequelize[_0x3999('0x3')]},'lastapp':{'type':Sequelize[_0x3999('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x3999('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x3999('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x3999('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x3999('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x3999('0x3')]},'linkedid':{'type':Sequelize[_0x3999('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x3999('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x3999('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 1253ae5..99c3987 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 _0xcb66=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','end','name','send','index','Cdr','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','find','create','body','catch','params','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0xaf29da,_0x117f5a){var _0x295c51=function(_0x3feaf4){while(--_0x3feaf4){_0xaf29da['push'](_0xaf29da['shift']());}};_0x295c51(++_0x117f5a);}(_0xcb66,0x19f));var _0x6cb6=function(_0x4db46b,_0xadcb1a){_0x4db46b=_0x4db46b-0x0;var _0x565be8=_0xcb66[_0x4db46b];return _0x565be8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6cb6('0x0'));var zipdir=require(_0x6cb6('0x1'));var jsonpatch=require(_0x6cb6('0x2'));var rp=require(_0x6cb6('0x3'));var moment=require(_0x6cb6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6cb6('0x5'));var util=require(_0x6cb6('0x6'));var path=require(_0x6cb6('0x7'));var sox=require(_0x6cb6('0x8'));var csv=require(_0x6cb6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6cb6('0xa'));var squel=require(_0x6cb6('0xb'));var crypto=require(_0x6cb6('0xc'));var jsforce=require(_0x6cb6('0xd'));var deskjs=require(_0x6cb6('0xe'));var toCsv=require(_0x6cb6('0x9'));var querystring=require(_0x6cb6('0xf'));var Papa=require(_0x6cb6('0x10'));var Redis=require(_0x6cb6('0x11'));var authService=require(_0x6cb6('0x12'));var qs=require(_0x6cb6('0x13'));var as=require(_0x6cb6('0x14'));var hardwareService=require(_0x6cb6('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6cb6('0x16'));var db=require(_0x6cb6('0x17'))['db'];function respondWithStatusCode(_0xad49d9,_0x2604e7){_0x2604e7=_0x2604e7||0xcc;return function(_0x585233){if(_0x585233){return _0xad49d9[_0x6cb6('0x18')](_0x2604e7);}return _0xad49d9[_0x6cb6('0x19')](_0x2604e7)['end']();};}function respondWithResult(_0x1e5468,_0x14a581){_0x14a581=_0x14a581||0xc8;return function(_0x5af476){if(_0x5af476){return _0x1e5468[_0x6cb6('0x19')](_0x14a581)[_0x6cb6('0x1a')](_0x5af476);}};}function respondWithFilteredResult(_0x492629,_0x5ab865){return function(_0x505b4d){if(_0x505b4d){var _0x5dd4cd=typeof _0x5ab865[_0x6cb6('0x1b')]===_0x6cb6('0x1c')&&typeof _0x5ab865[_0x6cb6('0x1d')]===_0x6cb6('0x1c');var _0x432e48=_0x505b4d[_0x6cb6('0x1e')];var _0x5b8a17=_0x5dd4cd?0x0:_0x5ab865[_0x6cb6('0x1b')];var _0xc0bdea=_0x5dd4cd?_0x505b4d['count']:_0x5ab865['offset']+_0x5ab865['limit'];var _0x5b5dab;if(_0xc0bdea>=_0x432e48){_0xc0bdea=_0x432e48;_0x5b5dab=0xc8;}else{_0x5b5dab=0xce;}_0x492629['status'](_0x5b5dab);return _0x492629['set'](_0x6cb6('0x1f'),_0x5b8a17+'-'+_0xc0bdea+'/'+_0x432e48)[_0x6cb6('0x1a')](_0x505b4d);}return null;};}function patchUpdates(_0x407455){return function(_0x2d41c4){try{jsonpatch[_0x6cb6('0x20')](_0x2d41c4,_0x407455,!![]);}catch(_0x5e14c8){return BPromise['reject'](_0x5e14c8);}return _0x2d41c4[_0x6cb6('0x21')]();};}function saveUpdates(_0x1d35d1,_0x1c4bcd){return function(_0x153915){if(_0x153915){return _0x153915['update'](_0x1d35d1)[_0x6cb6('0x22')](function(_0x19837e){return _0x19837e;});}return null;};}function removeEntity(_0x58a6ed,_0x5ad4f2){return function(_0xea5ee5){if(_0xea5ee5){return _0xea5ee5['destroy']()[_0x6cb6('0x22')](function(){_0x58a6ed[_0x6cb6('0x19')](0xcc)[_0x6cb6('0x23')]();});}};}function handleEntityNotFound(_0x18ecb9,_0x299830){return function(_0x16db1d){if(!_0x16db1d){_0x18ecb9[_0x6cb6('0x18')](0x194);}return _0x16db1d;};}function handleError(_0xcae6af,_0x1cc1ed){_0x1cc1ed=_0x1cc1ed||0x1f4;return function(_0x112e47){logger['error'](_0x112e47['stack']);if(_0x112e47['name']){delete _0x112e47[_0x6cb6('0x24')];}_0xcae6af[_0x6cb6('0x19')](_0x1cc1ed)[_0x6cb6('0x25')](_0x112e47);};}exports[_0x6cb6('0x26')]=function(_0x1f8c9d,_0x3b62e6){var _0x57cd74={},_0x124291={},_0x4d4ad9={'count':0x0,'rows':[]};var _0x2b2c4b=_['map'](db[_0x6cb6('0x27')][_0x6cb6('0x28')],function(_0x32c373){return{'name':_0x32c373['fieldName'],'type':_0x32c373[_0x6cb6('0x29')][_0x6cb6('0x2a')]};});_0x124291[_0x6cb6('0x2b')]=_['map'](_0x2b2c4b,_0x6cb6('0x24'));_0x124291[_0x6cb6('0x2c')]=_[_0x6cb6('0x2d')](_0x1f8c9d['query']);_0x124291[_0x6cb6('0x2e')]=_[_0x6cb6('0x2f')](_0x124291['model'],_0x124291[_0x6cb6('0x2c')]);_0x57cd74[_0x6cb6('0x30')]=_[_0x6cb6('0x2f')](_0x124291[_0x6cb6('0x2b')],qs[_0x6cb6('0x31')](_0x1f8c9d[_0x6cb6('0x2c')][_0x6cb6('0x31')]));_0x57cd74[_0x6cb6('0x30')]=_0x57cd74[_0x6cb6('0x30')][_0x6cb6('0x32')]?_0x57cd74['attributes']:_0x124291[_0x6cb6('0x2b')];if(!_0x1f8c9d[_0x6cb6('0x2c')][_0x6cb6('0x33')](_0x6cb6('0x34'))){_0x57cd74['limit']=qs['limit'](_0x1f8c9d['query'][_0x6cb6('0x1d')]);_0x57cd74[_0x6cb6('0x1b')]=qs[_0x6cb6('0x1b')](_0x1f8c9d[_0x6cb6('0x2c')][_0x6cb6('0x1b')]);}_0x57cd74[_0x6cb6('0x35')]=qs[_0x6cb6('0x36')](_0x1f8c9d[_0x6cb6('0x2c')]['sort']);_0x57cd74[_0x6cb6('0x37')]=qs['filters'](_[_0x6cb6('0x38')](_0x1f8c9d[_0x6cb6('0x2c')],_0x124291[_0x6cb6('0x2e')]),_0x2b2c4b);if(_0x1f8c9d[_0x6cb6('0x2c')][_0x6cb6('0x39')]){_0x57cd74[_0x6cb6('0x37')]=_[_0x6cb6('0x3a')](_0x57cd74['where'],{'$or':_[_0x6cb6('0x3b')](_0x2b2c4b,function(_0x58a304){if(_0x58a304[_0x6cb6('0x29')]!==_0x6cb6('0x3c')){var _0x3bb13d={};_0x3bb13d[_0x58a304['name']]={'$like':'%'+_0x1f8c9d['query'][_0x6cb6('0x39')]+'%'};return _0x3bb13d;}})});}_0x57cd74=_['merge']({},_0x57cd74,_0x1f8c9d[_0x6cb6('0x3d')]);var _0x296a3b={'where':_0x57cd74[_0x6cb6('0x37')]};return db[_0x6cb6('0x27')][_0x6cb6('0x1e')](_0x296a3b)[_0x6cb6('0x22')](function(_0x3652ca){_0x4d4ad9['count']=_0x3652ca;if(_0x1f8c9d[_0x6cb6('0x2c')][_0x6cb6('0x3e')]){_0x57cd74['include']=[{'all':!![]}];}return db[_0x6cb6('0x27')][_0x6cb6('0x3f')](_0x57cd74);})[_0x6cb6('0x22')](function(_0x31a391){_0x4d4ad9[_0x6cb6('0x40')]=_0x31a391;return _0x4d4ad9;})[_0x6cb6('0x22')](respondWithFilteredResult(_0x3b62e6,_0x57cd74))['catch'](handleError(_0x3b62e6,null));};exports['show']=function(_0x1f4e94,_0x5d3770){var _0x588ea4={'raw':!![],'where':{'id':_0x1f4e94['params']['id']}},_0x605673={};_0x605673[_0x6cb6('0x2b')]=_[_0x6cb6('0x2d')](db['Cdr']['rawAttributes']);_0x605673[_0x6cb6('0x2c')]=_['keys'](_0x1f4e94[_0x6cb6('0x2c')]);_0x605673[_0x6cb6('0x2e')]=_['intersection'](_0x605673[_0x6cb6('0x2b')],_0x605673[_0x6cb6('0x2c')]);_0x588ea4['attributes']=_[_0x6cb6('0x2f')](_0x605673['model'],qs[_0x6cb6('0x31')](_0x1f4e94[_0x6cb6('0x2c')]['fields']));_0x588ea4[_0x6cb6('0x30')]=_0x588ea4[_0x6cb6('0x30')]['length']?_0x588ea4['attributes']:_0x605673[_0x6cb6('0x2b')];if(_0x1f4e94[_0x6cb6('0x2c')][_0x6cb6('0x3e')]){_0x588ea4['include']=[{'all':!![]}];}_0x588ea4=_[_0x6cb6('0x3a')]({},_0x588ea4,_0x1f4e94[_0x6cb6('0x3d')]);return db['Cdr'][_0x6cb6('0x41')](_0x588ea4)[_0x6cb6('0x22')](handleEntityNotFound(_0x5d3770,null))[_0x6cb6('0x22')](respondWithResult(_0x5d3770,null))['catch'](handleError(_0x5d3770,null));};exports[_0x6cb6('0x42')]=function(_0x4444a4,_0x42dc72){return db[_0x6cb6('0x27')][_0x6cb6('0x42')](_0x4444a4[_0x6cb6('0x43')],{})['then'](respondWithResult(_0x42dc72,0xc9))[_0x6cb6('0x44')](handleError(_0x42dc72,null));};exports['update']=function(_0x4c3a3a,_0x29cb39){if(_0x4c3a3a[_0x6cb6('0x43')]['id']){delete _0x4c3a3a['body']['id'];}return db[_0x6cb6('0x27')]['find']({'where':{'id':_0x4c3a3a[_0x6cb6('0x45')]['id']}})[_0x6cb6('0x22')](handleEntityNotFound(_0x29cb39,null))[_0x6cb6('0x22')](saveUpdates(_0x4c3a3a['body'],null))[_0x6cb6('0x22')](respondWithResult(_0x29cb39,null))[_0x6cb6('0x44')](handleError(_0x29cb39,null));};exports[_0x6cb6('0x46')]=function(_0x567d52,_0x2668a3){return db['Cdr'][_0x6cb6('0x41')]({'where':{'id':_0x567d52[_0x6cb6('0x45')]['id']}})[_0x6cb6('0x22')](handleEntityNotFound(_0x2668a3,null))['then'](removeEntity(_0x2668a3,null))['catch'](handleError(_0x2668a3,null));};exports[_0x6cb6('0x47')]=function(_0x3dca6c,_0x1d12da){return db['Cdr'][_0x6cb6('0x47')]()[_0x6cb6('0x22')](respondWithResult(_0x1d12da,null))[_0x6cb6('0x44')](handleError(_0x1d12da,null));}; \ No newline at end of file +var _0xce50=['api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','name','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xce50,0x1d8));var _0x0ce5=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xce50[_0x1ccdf7];return _0x52a0ae;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0ce5('0x0'));var zipdir=require(_0x0ce5('0x1'));var jsonpatch=require(_0x0ce5('0x2'));var rp=require(_0x0ce5('0x3'));var moment=require(_0x0ce5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0ce5('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x0ce5('0x6'));var ejs=require(_0x0ce5('0x7'));var fs=require('fs');var fs_extra=require(_0x0ce5('0x8'));var _=require(_0x0ce5('0x9'));var squel=require('squel');var crypto=require(_0x0ce5('0xa'));var jsforce=require(_0x0ce5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0ce5('0x6'));var querystring=require('querystring');var Papa=require(_0x0ce5('0xc'));var Redis=require(_0x0ce5('0xd'));var authService=require(_0x0ce5('0xe'));var qs=require(_0x0ce5('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0ce5('0x10'));var logger=require(_0x0ce5('0x11'))(_0x0ce5('0x12'));var utils=require(_0x0ce5('0x13'));var config=require(_0x0ce5('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x529265,_0x59c22e){_0x59c22e=_0x59c22e||0xcc;return function(_0xb530fa){if(_0xb530fa){return _0x529265[_0x0ce5('0x15')](_0x59c22e);}return _0x529265[_0x0ce5('0x16')](_0x59c22e)['end']();};}function respondWithResult(_0x85bbb,_0x117fa9){_0x117fa9=_0x117fa9||0xc8;return function(_0x5f4317){if(_0x5f4317){return _0x85bbb[_0x0ce5('0x16')](_0x117fa9)['json'](_0x5f4317);}};}function respondWithFilteredResult(_0x1ece6f,_0x1dd856){return function(_0x3b5a36){if(_0x3b5a36){var _0x13ce5a=typeof _0x1dd856[_0x0ce5('0x17')]===_0x0ce5('0x18')&&typeof _0x1dd856[_0x0ce5('0x19')]===_0x0ce5('0x18');var _0x5eab29=_0x3b5a36[_0x0ce5('0x1a')];var _0x4292ce=_0x13ce5a?0x0:_0x1dd856['offset'];var _0x4f5e0b=_0x13ce5a?_0x3b5a36[_0x0ce5('0x1a')]:_0x1dd856['offset']+_0x1dd856[_0x0ce5('0x19')];var _0x477451;if(_0x4f5e0b>=_0x5eab29){_0x4f5e0b=_0x5eab29;_0x477451=0xc8;}else{_0x477451=0xce;}_0x1ece6f[_0x0ce5('0x16')](_0x477451);return _0x1ece6f[_0x0ce5('0x1b')](_0x0ce5('0x1c'),_0x4292ce+'-'+_0x4f5e0b+'/'+_0x5eab29)[_0x0ce5('0x1d')](_0x3b5a36);}return null;};}function patchUpdates(_0x57d9da){return function(_0x2cc733){try{jsonpatch[_0x0ce5('0x1e')](_0x2cc733,_0x57d9da,!![]);}catch(_0x1a1b8a){return BPromise[_0x0ce5('0x1f')](_0x1a1b8a);}return _0x2cc733['save']();};}function saveUpdates(_0x20f520,_0x4e8e46){return function(_0x16ff16){if(_0x16ff16){return _0x16ff16[_0x0ce5('0x20')](_0x20f520)[_0x0ce5('0x21')](function(_0x78be90){return _0x78be90;});}return null;};}function removeEntity(_0x334e7d,_0xbb1a2c){return function(_0x3ca9de){if(_0x3ca9de){return _0x3ca9de[_0x0ce5('0x22')]()[_0x0ce5('0x21')](function(){_0x334e7d[_0x0ce5('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5392a4,_0x2332d4){return function(_0x56ef06){if(!_0x56ef06){_0x5392a4['sendStatus'](0x194);}return _0x56ef06;};}function handleError(_0x73f240,_0x564276){_0x564276=_0x564276||0x1f4;return function(_0x2c7414){logger[_0x0ce5('0x23')](_0x2c7414['stack']);if(_0x2c7414['name']){delete _0x2c7414[_0x0ce5('0x24')];}_0x73f240[_0x0ce5('0x16')](_0x564276)['send'](_0x2c7414);};}exports[_0x0ce5('0x25')]=function(_0x470fb6,_0x3d7153){var _0x54a385={},_0x55aa97={},_0x343137={'count':0x0,'rows':[]};var _0x28080b=_[_0x0ce5('0x26')](db[_0x0ce5('0x27')][_0x0ce5('0x28')],function(_0x44dabc){return{'name':_0x44dabc[_0x0ce5('0x29')],'type':_0x44dabc[_0x0ce5('0x2a')][_0x0ce5('0x2b')]};});_0x55aa97[_0x0ce5('0x2c')]=_[_0x0ce5('0x26')](_0x28080b,_0x0ce5('0x24'));_0x55aa97[_0x0ce5('0x2d')]=_[_0x0ce5('0x2e')](_0x470fb6[_0x0ce5('0x2d')]);_0x55aa97[_0x0ce5('0x2f')]=_[_0x0ce5('0x30')](_0x55aa97[_0x0ce5('0x2c')],_0x55aa97[_0x0ce5('0x2d')]);_0x54a385[_0x0ce5('0x31')]=_[_0x0ce5('0x30')](_0x55aa97[_0x0ce5('0x2c')],qs['fields'](_0x470fb6[_0x0ce5('0x2d')][_0x0ce5('0x32')]));_0x54a385[_0x0ce5('0x31')]=_0x54a385['attributes'][_0x0ce5('0x33')]?_0x54a385[_0x0ce5('0x31')]:_0x55aa97[_0x0ce5('0x2c')];if(!_0x470fb6[_0x0ce5('0x2d')]['hasOwnProperty'](_0x0ce5('0x34'))){_0x54a385[_0x0ce5('0x19')]=qs[_0x0ce5('0x19')](_0x470fb6[_0x0ce5('0x2d')][_0x0ce5('0x19')]);_0x54a385[_0x0ce5('0x17')]=qs[_0x0ce5('0x17')](_0x470fb6[_0x0ce5('0x2d')][_0x0ce5('0x17')]);}_0x54a385[_0x0ce5('0x35')]=qs[_0x0ce5('0x36')](_0x470fb6[_0x0ce5('0x2d')]['sort']);_0x54a385[_0x0ce5('0x37')]=qs[_0x0ce5('0x2f')](_[_0x0ce5('0x38')](_0x470fb6['query'],_0x55aa97[_0x0ce5('0x2f')]),_0x28080b);if(_0x470fb6[_0x0ce5('0x2d')][_0x0ce5('0x39')]){_0x54a385[_0x0ce5('0x37')]=_['merge'](_0x54a385[_0x0ce5('0x37')],{'$or':_['map'](_0x28080b,function(_0x27cbee){if(_0x27cbee['type']!=='VIRTUAL'){var _0x3b30a4={};_0x3b30a4[_0x27cbee[_0x0ce5('0x24')]]={'$like':'%'+_0x470fb6[_0x0ce5('0x2d')]['filter']+'%'};return _0x3b30a4;}})});}_0x54a385=_[_0x0ce5('0x3a')]({},_0x54a385,_0x470fb6[_0x0ce5('0x3b')]);var _0x245ac6={'where':_0x54a385[_0x0ce5('0x37')]};return db['Cdr'][_0x0ce5('0x1a')](_0x245ac6)[_0x0ce5('0x21')](function(_0x238f52){_0x343137[_0x0ce5('0x1a')]=_0x238f52;if(_0x470fb6[_0x0ce5('0x2d')][_0x0ce5('0x3c')]){_0x54a385['include']=[{'all':!![]}];}return db[_0x0ce5('0x27')][_0x0ce5('0x3d')](_0x54a385);})[_0x0ce5('0x21')](function(_0x1fa06f){_0x343137[_0x0ce5('0x3e')]=_0x1fa06f;return _0x343137;})[_0x0ce5('0x21')](respondWithFilteredResult(_0x3d7153,_0x54a385))[_0x0ce5('0x3f')](handleError(_0x3d7153,null));};exports[_0x0ce5('0x40')]=function(_0xa9b36a,_0x48ebfc){var _0x5e280c={'raw':!![],'where':{'id':_0xa9b36a[_0x0ce5('0x41')]['id']}},_0x1a16b7={};_0x1a16b7['model']=_['keys'](db[_0x0ce5('0x27')][_0x0ce5('0x28')]);_0x1a16b7[_0x0ce5('0x2d')]=_[_0x0ce5('0x2e')](_0xa9b36a[_0x0ce5('0x2d')]);_0x1a16b7[_0x0ce5('0x2f')]=_[_0x0ce5('0x30')](_0x1a16b7[_0x0ce5('0x2c')],_0x1a16b7[_0x0ce5('0x2d')]);_0x5e280c[_0x0ce5('0x31')]=_['intersection'](_0x1a16b7['model'],qs['fields'](_0xa9b36a[_0x0ce5('0x2d')][_0x0ce5('0x32')]));_0x5e280c[_0x0ce5('0x31')]=_0x5e280c[_0x0ce5('0x31')][_0x0ce5('0x33')]?_0x5e280c[_0x0ce5('0x31')]:_0x1a16b7['model'];if(_0xa9b36a[_0x0ce5('0x2d')][_0x0ce5('0x3c')]){_0x5e280c[_0x0ce5('0x42')]=[{'all':!![]}];}_0x5e280c=_[_0x0ce5('0x3a')]({},_0x5e280c,_0xa9b36a['options']);return db[_0x0ce5('0x27')]['find'](_0x5e280c)['then'](handleEntityNotFound(_0x48ebfc,null))[_0x0ce5('0x21')](respondWithResult(_0x48ebfc,null))[_0x0ce5('0x3f')](handleError(_0x48ebfc,null));};exports[_0x0ce5('0x43')]=function(_0xf1fc01,_0x3a3ec5){return db[_0x0ce5('0x27')][_0x0ce5('0x43')](_0xf1fc01[_0x0ce5('0x44')],{})[_0x0ce5('0x21')](respondWithResult(_0x3a3ec5,0xc9))[_0x0ce5('0x3f')](handleError(_0x3a3ec5,null));};exports[_0x0ce5('0x20')]=function(_0x40e47c,_0x5629f4){if(_0x40e47c[_0x0ce5('0x44')]['id']){delete _0x40e47c['body']['id'];}return db[_0x0ce5('0x27')]['find']({'where':{'id':_0x40e47c['params']['id']}})['then'](handleEntityNotFound(_0x5629f4,null))[_0x0ce5('0x21')](saveUpdates(_0x40e47c['body'],null))['then'](respondWithResult(_0x5629f4,null))['catch'](handleError(_0x5629f4,null));};exports[_0x0ce5('0x22')]=function(_0x3cd81a,_0x1a9ce4){return db[_0x0ce5('0x27')]['find']({'where':{'id':_0x3cd81a['params']['id']}})[_0x0ce5('0x21')](handleEntityNotFound(_0x1a9ce4,null))[_0x0ce5('0x21')](removeEntity(_0x1a9ce4,null))[_0x0ce5('0x3f')](handleError(_0x1a9ce4,null));};exports[_0x0ce5('0x45')]=function(_0x4256e3,_0x30571c){return db[_0x0ce5('0x27')][_0x0ce5('0x45')]()[_0x0ce5('0x21')](respondWithResult(_0x30571c,null))[_0x0ce5('0x3f')](handleError(_0x30571c,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 4a1a925..833ae21 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(_0x5431d5,_0x580386){var _0x542470=function(_0x2c8969){while(--_0x2c8969){_0x5431d5['push'](_0x5431d5['shift']());}};_0x542470(++_0x580386);}(_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':'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(_0x4c9441,_0x912e8d){var _0x34b58a=function(_0x5b9086){while(--_0x5b9086){_0x4c9441['push'](_0x4c9441['shift']());}};_0x34b58a(++_0x912e8d);}(_0x7a54,0x106));var _0x47a5=function(_0x4e1840,_0xb78018){_0x4e1840=_0x4e1840-0x0;var _0x5f183e=_0x7a54[_0x4e1840];return _0x5f183e;};'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 4655a27..9b63f05 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 _0xd81d=['lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0xd81d,0x1e4));var _0xdd81=function(_0x32f181,_0x2c8c66){_0x32f181=_0x32f181-0x0;var _0x5b4745=_0xd81d[_0x32f181];return _0x5b4745;};'use strict';var _=require(_0xdd81('0x0'));var util=require('util');var moment=require(_0xdd81('0x1'));var BPromise=require('bluebird');var rs=require(_0xdd81('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd81('0x3'))['db'];var utils=require(_0xdd81('0x4'));var logger=require(_0xdd81('0x5'))(_0xdd81('0x6'));var config=require(_0xdd81('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdd81('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e1c46,_0x26ddc7,_0x5f4af6){return new BPromise(function(_0x603e7a,_0x4c1f1c){return client[_0xdd81('0x9')](_0x1e1c46,_0x5f4af6)[_0xdd81('0xa')](function(_0x338330){logger[_0xdd81('0xb')](_0xdd81('0xc'),_0x26ddc7,_0xdd81('0xd'));logger[_0xdd81('0xe')](_0xdd81('0xf'),_0x26ddc7,_0xdd81('0xd'),JSON[_0xdd81('0x10')](_0x338330));if(_0x338330['error']){if(_0x338330['error'][_0xdd81('0x11')]===0x1f4){logger[_0xdd81('0x12')](_0xdd81('0xc'),_0x26ddc7,_0x338330['error']['message']);return _0x4c1f1c(_0x338330[_0xdd81('0x12')][_0xdd81('0x13')]);}logger[_0xdd81('0x12')](_0xdd81('0xc'),_0x26ddc7,_0x338330[_0xdd81('0x12')][_0xdd81('0x13')]);return _0x603e7a(_0x338330[_0xdd81('0x12')][_0xdd81('0x13')]);}else{logger[_0xdd81('0xb')](_0xdd81('0xc'),_0x26ddc7,'request\x20sent');_0x603e7a(_0x338330[_0xdd81('0x14')][_0xdd81('0x13')]);}})[_0xdd81('0x15')](function(_0x2493cb){logger[_0xdd81('0x12')](_0xdd81('0xc'),_0x26ddc7,_0x2493cb);_0x4c1f1c(_0x2493cb);});});} \ No newline at end of file +var _0xf22d=['info','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Cdr,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x1204f9,_0x3a09e2){var _0x5e6d0a=function(_0xa1ff8){while(--_0xa1ff8){_0x1204f9['push'](_0x1204f9['shift']());}};_0x5e6d0a(++_0x3a09e2);}(_0xf22d,0x1ab));var _0xdf22=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xf22d[_0x411add];return _0x238242;};'use strict';var _=require(_0xdf22('0x0'));var util=require(_0xdf22('0x1'));var moment=require(_0xdf22('0x2'));var BPromise=require(_0xdf22('0x3'));var rs=require(_0xdf22('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf22('0x5'))['db'];var utils=require(_0xdf22('0x6'));var logger=require('../../config/logger')(_0xdf22('0x7'));var config=require(_0xdf22('0x8'));var jayson=require(_0xdf22('0x9'));var client=jayson['client'][_0xdf22('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x394fdd,_0x40bcb5,_0x27826c){return new BPromise(function(_0x511686,_0x21af77){return client[_0xdf22('0xb')](_0x394fdd,_0x27826c)[_0xdf22('0xc')](function(_0x3acc75){logger[_0xdf22('0xd')]('Cdr,\x20%s,\x20%s',_0x40bcb5,'request\x20sent');logger[_0xdf22('0xe')](_0xdf22('0xf'),_0x40bcb5,_0xdf22('0x10'),JSON[_0xdf22('0x11')](_0x3acc75));if(_0x3acc75[_0xdf22('0x12')]){if(_0x3acc75['error']['code']===0x1f4){logger[_0xdf22('0x12')](_0xdf22('0x13'),_0x40bcb5,_0x3acc75[_0xdf22('0x12')][_0xdf22('0x14')]);return _0x21af77(_0x3acc75['error'][_0xdf22('0x14')]);}logger[_0xdf22('0x12')](_0xdf22('0x13'),_0x40bcb5,_0x3acc75[_0xdf22('0x12')][_0xdf22('0x14')]);return _0x511686(_0x3acc75[_0xdf22('0x12')]['message']);}else{logger[_0xdf22('0xd')](_0xdf22('0x13'),_0x40bcb5,_0xdf22('0x10'));_0x511686(_0x3acc75['result'][_0xdf22('0x14')]);}})[_0xdf22('0x15')](function(_0x1eabf6){logger[_0xdf22('0x12')](_0xdf22('0x13'),_0x40bcb5,_0x1eabf6);_0x21af77(_0x1eabf6);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index ad79669..af0e12d 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x1d2bbb,_0x202267){var _0x38082b=function(_0x27d153){while(--_0x27d153){_0x1d2bbb['push'](_0x1d2bbb['shift']());}};_0x38082b(++_0x202267);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x2132a3,_0x4639e9){var _0x21890c=function(_0x34b73d){while(--_0x34b73d){_0x2132a3['push'](_0x2132a3['shift']());}};_0x21890c(++_0x4639e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index ff63720..47234d7 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 _0xb81e=['TEXT','*,*,*,*','STRING','noop'];(function(_0x57c2eb,_0x1a2432){var _0x2d62b4=function(_0x5995f5){while(--_0x5995f5){_0x57c2eb['push'](_0x57c2eb['shift']());}};_0x2d62b4(++_0x1a2432);}(_0xb81e,0xee));var _0xeb81=function(_0x385df1,_0x39ca6c){_0x385df1=_0x385df1-0x0;var _0x3ee07e=_0xb81e[_0x385df1];return _0x3ee07e;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xeb81('0x0')],'allowNull':![],'defaultValue':_0xeb81('0x1')},'appdata':{'type':Sequelize[_0xeb81('0x2')]()},'description':{'type':Sequelize[_0xeb81('0x0')]},'interval':{'type':Sequelize[_0xeb81('0x0')],'defaultValue':_0xeb81('0x3')}}; \ No newline at end of file +var _0x4b92=['noop','TEXT','sequelize','STRING'];(function(_0x5deea8,_0x58117f){var _0x1d4b0e=function(_0x47e735){while(--_0x47e735){_0x5deea8['push'](_0x5deea8['shift']());}};_0x1d4b0e(++_0x58117f);}(_0x4b92,0x126));var _0x24b9=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x4b92[_0x513aa5];return _0x1a1a7c;};'use strict';var Sequelize=require(_0x24b9('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x24b9('0x1')],'allowNull':![],'defaultValue':_0x24b9('0x2')},'appdata':{'type':Sequelize[_0x24b9('0x3')]()},'description':{'type':Sequelize[_0x24b9('0x1')]},'interval':{'type':Sequelize[_0x24b9('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 009041f..4202bb6 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 _0x94d2=['destroy','error','stack','name','show','params','model','keys','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','options','ChatApplication','catch','body','find','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','count','offset','Content-Range','apply','reject','save','update','then'];(function(_0x5a766f,_0x135d23){var _0xebfcf3=function(_0x1d5bb5){while(--_0x1d5bb5){_0x5a766f['push'](_0x5a766f['shift']());}};_0xebfcf3(++_0x135d23);}(_0x94d2,0x1cd));var _0x294d=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x94d2[_0x1b2ff7];return _0x31656a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x294d('0x0'));var jsonpatch=require(_0x294d('0x1'));var rp=require(_0x294d('0x2'));var moment=require(_0x294d('0x3'));var BPromise=require(_0x294d('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x294d('0x5'));var sox=require(_0x294d('0x6'));var csv=require(_0x294d('0x7'));var ejs=require(_0x294d('0x8'));var fs=require('fs');var fs_extra=require(_0x294d('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x294d('0xa'));var jsforce=require(_0x294d('0xb'));var deskjs=require(_0x294d('0xc'));var toCsv=require(_0x294d('0x7'));var querystring=require(_0x294d('0xd'));var Papa=require('papaparse');var Redis=require(_0x294d('0xe'));var authService=require(_0x294d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x294d('0x10'));var hardwareService=require(_0x294d('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x294d('0x12'));var config=require(_0x294d('0x13'));var licenseUtil=require(_0x294d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d44ba,_0x3f0f3a){_0x3f0f3a=_0x3f0f3a||0xcc;return function(_0x4119da){if(_0x4119da){return _0x3d44ba[_0x294d('0x15')](_0x3f0f3a);}return _0x3d44ba['status'](_0x3f0f3a)[_0x294d('0x16')]();};}function respondWithResult(_0x49c38f,_0x5adc9c){_0x5adc9c=_0x5adc9c||0xc8;return function(_0xed0e10){if(_0xed0e10){return _0x49c38f[_0x294d('0x17')](_0x5adc9c)[_0x294d('0x18')](_0xed0e10);}};}function respondWithFilteredResult(_0x28f7f6,_0x4bf3ae){return function(_0x42d290){if(_0x42d290){var _0x4fddfe=typeof _0x4bf3ae['offset']==='undefined'&&typeof _0x4bf3ae['limit']===_0x294d('0x19');var _0x15dce0=_0x42d290[_0x294d('0x1a')];var _0x46d9c5=_0x4fddfe?0x0:_0x4bf3ae[_0x294d('0x1b')];var _0x26563e=_0x4fddfe?_0x42d290[_0x294d('0x1a')]:_0x4bf3ae[_0x294d('0x1b')]+_0x4bf3ae['limit'];var _0x3ccc78;if(_0x26563e>=_0x15dce0){_0x26563e=_0x15dce0;_0x3ccc78=0xc8;}else{_0x3ccc78=0xce;}_0x28f7f6[_0x294d('0x17')](_0x3ccc78);return _0x28f7f6['set'](_0x294d('0x1c'),_0x46d9c5+'-'+_0x26563e+'/'+_0x15dce0)[_0x294d('0x18')](_0x42d290);}return null;};}function patchUpdates(_0x429da3){return function(_0xffe147){try{jsonpatch[_0x294d('0x1d')](_0xffe147,_0x429da3,!![]);}catch(_0x31fd1c){return BPromise[_0x294d('0x1e')](_0x31fd1c);}return _0xffe147[_0x294d('0x1f')]();};}function saveUpdates(_0x82ad78,_0x11df11){return function(_0x419717){if(_0x419717){return _0x419717[_0x294d('0x20')](_0x82ad78)[_0x294d('0x21')](function(_0x2b2a1e){return _0x2b2a1e;});}return null;};}function removeEntity(_0x4aa60,_0x524ff2){return function(_0x546a59){if(_0x546a59){return _0x546a59[_0x294d('0x22')]()[_0x294d('0x21')](function(){_0x4aa60[_0x294d('0x17')](0xcc)[_0x294d('0x16')]();});}};}function handleEntityNotFound(_0x1cf383,_0x1ba06c){return function(_0x4da072){if(!_0x4da072){_0x1cf383[_0x294d('0x15')](0x194);}return _0x4da072;};}function handleError(_0x5cac01,_0x4670ae){_0x4670ae=_0x4670ae||0x1f4;return function(_0x233212){logger[_0x294d('0x23')](_0x233212[_0x294d('0x24')]);if(_0x233212[_0x294d('0x25')]){delete _0x233212[_0x294d('0x25')];}_0x5cac01[_0x294d('0x17')](_0x4670ae)['send'](_0x233212);};}exports[_0x294d('0x26')]=function(_0x2b2072,_0x37cf9f){var _0x340ae5={'raw':!![],'where':{'id':_0x2b2072[_0x294d('0x27')]['id']}},_0xdfcde1={};_0xdfcde1[_0x294d('0x28')]=_[_0x294d('0x29')](db['ChatApplication'][_0x294d('0x2a')]);_0xdfcde1[_0x294d('0x2b')]=_[_0x294d('0x29')](_0x2b2072[_0x294d('0x2b')]);_0xdfcde1['filters']=_['intersection'](_0xdfcde1[_0x294d('0x28')],_0xdfcde1[_0x294d('0x2b')]);_0x340ae5[_0x294d('0x2c')]=_[_0x294d('0x2d')](_0xdfcde1[_0x294d('0x28')],qs[_0x294d('0x2e')](_0x2b2072[_0x294d('0x2b')][_0x294d('0x2e')]));_0x340ae5[_0x294d('0x2c')]=_0x340ae5['attributes'][_0x294d('0x2f')]?_0x340ae5[_0x294d('0x2c')]:_0xdfcde1[_0x294d('0x28')];if(_0x2b2072['query'][_0x294d('0x30')]){_0x340ae5[_0x294d('0x31')]=[{'all':!![]}];}_0x340ae5=_['merge']({},_0x340ae5,_0x2b2072[_0x294d('0x32')]);return db[_0x294d('0x33')]['find'](_0x340ae5)['then'](handleEntityNotFound(_0x37cf9f,null))[_0x294d('0x21')](respondWithResult(_0x37cf9f,null))[_0x294d('0x34')](handleError(_0x37cf9f,null));};exports[_0x294d('0x20')]=function(_0x5260a5,_0x37aa78){if(_0x5260a5[_0x294d('0x35')]['id']){delete _0x5260a5[_0x294d('0x35')]['id'];}return db[_0x294d('0x33')][_0x294d('0x36')]({'where':{'id':_0x5260a5[_0x294d('0x27')]['id']}})[_0x294d('0x21')](handleEntityNotFound(_0x37aa78,null))[_0x294d('0x21')](saveUpdates(_0x5260a5[_0x294d('0x35')],null))[_0x294d('0x21')](respondWithResult(_0x37aa78,null))[_0x294d('0x34')](handleError(_0x37aa78,null));};exports[_0x294d('0x22')]=function(_0x496941,_0x3e9576){return db[_0x294d('0x33')][_0x294d('0x36')]({'where':{'id':_0x496941['params']['id']}})[_0x294d('0x21')](handleEntityNotFound(_0x3e9576,null))[_0x294d('0x21')](removeEntity(_0x3e9576,null))[_0x294d('0x34')](handleError(_0x3e9576,null));}; \ No newline at end of file +var _0x0901=['model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','then','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','stack','name','send','show','params'];(function(_0x43c8de,_0x4ac946){var _0x17430a=function(_0x3b0199){while(--_0x3b0199){_0x43c8de['push'](_0x43c8de['shift']());}};_0x17430a(++_0x4ac946);}(_0x0901,0x134));var _0x1090=function(_0x455233,_0x4aeab0){_0x455233=_0x455233-0x0;var _0x56b92b=_0x0901[_0x455233];return _0x56b92b;};'use strict';var emlformat=require(_0x1090('0x0'));var rimraf=require(_0x1090('0x1'));var zipdir=require(_0x1090('0x2'));var jsonpatch=require(_0x1090('0x3'));var rp=require(_0x1090('0x4'));var moment=require(_0x1090('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1090('0x6'));var path=require(_0x1090('0x7'));var sox=require(_0x1090('0x8'));var csv=require(_0x1090('0x9'));var ejs=require(_0x1090('0xa'));var fs=require('fs');var fs_extra=require(_0x1090('0xb'));var _=require('lodash');var squel=require(_0x1090('0xc'));var crypto=require(_0x1090('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1090('0xe'));var toCsv=require(_0x1090('0x9'));var querystring=require(_0x1090('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1090('0x10'));var as=require(_0x1090('0x11'));var hardwareService=require(_0x1090('0x12'));var logger=require('../../config/logger')(_0x1090('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1090('0x14'));var db=require(_0x1090('0x15'))['db'];function respondWithStatusCode(_0x43f1b6,_0x2c0afa){_0x2c0afa=_0x2c0afa||0xcc;return function(_0x4250c6){if(_0x4250c6){return _0x43f1b6[_0x1090('0x16')](_0x2c0afa);}return _0x43f1b6[_0x1090('0x17')](_0x2c0afa)[_0x1090('0x18')]();};}function respondWithResult(_0x1cbc74,_0x897055){_0x897055=_0x897055||0xc8;return function(_0x477a41){if(_0x477a41){return _0x1cbc74[_0x1090('0x17')](_0x897055)[_0x1090('0x19')](_0x477a41);}};}function respondWithFilteredResult(_0x4dadef,_0x465cbd){return function(_0x28a09a){if(_0x28a09a){var _0x14e6dc=typeof _0x465cbd['offset']===_0x1090('0x1a')&&typeof _0x465cbd[_0x1090('0x1b')]===_0x1090('0x1a');var _0x31ef2f=_0x28a09a[_0x1090('0x1c')];var _0x496fb1=_0x14e6dc?0x0:_0x465cbd[_0x1090('0x1d')];var _0x2ea64c=_0x14e6dc?_0x28a09a[_0x1090('0x1c')]:_0x465cbd[_0x1090('0x1d')]+_0x465cbd[_0x1090('0x1b')];var _0x392fcc;if(_0x2ea64c>=_0x31ef2f){_0x2ea64c=_0x31ef2f;_0x392fcc=0xc8;}else{_0x392fcc=0xce;}_0x4dadef[_0x1090('0x17')](_0x392fcc);return _0x4dadef[_0x1090('0x1e')](_0x1090('0x1f'),_0x496fb1+'-'+_0x2ea64c+'/'+_0x31ef2f)['json'](_0x28a09a);}return null;};}function patchUpdates(_0x57dfc5){return function(_0x8df216){try{jsonpatch['apply'](_0x8df216,_0x57dfc5,!![]);}catch(_0x304e6d){return BPromise[_0x1090('0x20')](_0x304e6d);}return _0x8df216[_0x1090('0x21')]();};}function saveUpdates(_0xa48311,_0x211b39){return function(_0x29633c){if(_0x29633c){return _0x29633c[_0x1090('0x22')](_0xa48311)['then'](function(_0x505d09){return _0x505d09;});}return null;};}function removeEntity(_0x4c7434,_0x48b5c0){return function(_0x4d187a){if(_0x4d187a){return _0x4d187a['destroy']()['then'](function(){_0x4c7434[_0x1090('0x17')](0xcc)[_0x1090('0x18')]();});}};}function handleEntityNotFound(_0x54eeec,_0x3face7){return function(_0x50267d){if(!_0x50267d){_0x54eeec[_0x1090('0x16')](0x194);}return _0x50267d;};}function handleError(_0x33dc42,_0x3a2123){_0x3a2123=_0x3a2123||0x1f4;return function(_0x5e2859){logger['error'](_0x5e2859[_0x1090('0x23')]);if(_0x5e2859['name']){delete _0x5e2859[_0x1090('0x24')];}_0x33dc42['status'](_0x3a2123)[_0x1090('0x25')](_0x5e2859);};}exports[_0x1090('0x26')]=function(_0x124ac,_0x3b7f54){var _0x257645={'raw':!![],'where':{'id':_0x124ac[_0x1090('0x27')]['id']}},_0x5bd6ab={};_0x5bd6ab[_0x1090('0x28')]=_[_0x1090('0x29')](db[_0x1090('0x2a')][_0x1090('0x2b')]);_0x5bd6ab[_0x1090('0x2c')]=_[_0x1090('0x29')](_0x124ac[_0x1090('0x2c')]);_0x5bd6ab[_0x1090('0x2d')]=_[_0x1090('0x2e')](_0x5bd6ab['model'],_0x5bd6ab['query']);_0x257645[_0x1090('0x2f')]=_[_0x1090('0x2e')](_0x5bd6ab[_0x1090('0x28')],qs['fields'](_0x124ac[_0x1090('0x2c')][_0x1090('0x30')]));_0x257645[_0x1090('0x2f')]=_0x257645[_0x1090('0x2f')][_0x1090('0x31')]?_0x257645['attributes']:_0x5bd6ab[_0x1090('0x28')];if(_0x124ac[_0x1090('0x2c')][_0x1090('0x32')]){_0x257645[_0x1090('0x33')]=[{'all':!![]}];}_0x257645=_[_0x1090('0x34')]({},_0x257645,_0x124ac[_0x1090('0x35')]);return db['ChatApplication'][_0x1090('0x36')](_0x257645)['then'](handleEntityNotFound(_0x3b7f54,null))[_0x1090('0x37')](respondWithResult(_0x3b7f54,null))[_0x1090('0x38')](handleError(_0x3b7f54,null));};exports[_0x1090('0x22')]=function(_0x1b1d3a,_0x5ae313){if(_0x1b1d3a[_0x1090('0x39')]['id']){delete _0x1b1d3a[_0x1090('0x39')]['id'];}return db[_0x1090('0x2a')]['find']({'where':{'id':_0x1b1d3a['params']['id']}})[_0x1090('0x37')](handleEntityNotFound(_0x5ae313,null))['then'](saveUpdates(_0x1b1d3a[_0x1090('0x39')],null))['then'](respondWithResult(_0x5ae313,null))[_0x1090('0x38')](handleError(_0x5ae313,null));};exports['destroy']=function(_0x18cc57,_0x3f910f){return db['ChatApplication'][_0x1090('0x36')]({'where':{'id':_0x18cc57[_0x1090('0x27')]['id']}})[_0x1090('0x37')](handleEntityNotFound(_0x3f910f,null))[_0x1090('0x37')](removeEntity(_0x3f910f,null))[_0x1090('0x38')](handleError(_0x3f910f,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 5fd33a6..a8c2db4 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 _0xe43c=['path','../../config/environment','./chatApplication.attributes','exports','define','chat_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x52dfb2,_0x1a7a8e){var _0xf5b55b=function(_0x392f19){while(--_0x392f19){_0x52dfb2['push'](_0x52dfb2['shift']());}};_0xf5b55b(++_0x1a7a8e);}(_0xe43c,0x180));var _0xce43=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe43c[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xce43('0x0'));var util=require(_0xce43('0x1'));var logger=require(_0xce43('0x2'))(_0xce43('0x3'));var moment=require(_0xce43('0x4'));var BPromise=require(_0xce43('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce43('0x6'));var rimraf=require('rimraf');var config=require(_0xce43('0x7'));var attributes=require(_0xce43('0x8'));module[_0xce43('0x9')]=function(_0x3557d0,_0x5d6e5c){return _0x3557d0[_0xce43('0xa')]('ChatApplication',attributes,{'tableName':_0xce43('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xce43('0xc')});}; \ No newline at end of file +var _0x8a30=['util','api','moment','bluebird','rimraf','../../config/environment','./chatApplication.attributes','define','ChatApplication','utf8mb4','lodash'];(function(_0x2a5d6f,_0x17aa81){var _0x3fe1b4=function(_0x5681be){while(--_0x5681be){_0x2a5d6f['push'](_0x2a5d6f['shift']());}};_0x3fe1b4(++_0x17aa81);}(_0x8a30,0x1a1));var _0x08a3=function(_0x102e14,_0x59557f){_0x102e14=_0x102e14-0x0;var _0x3bea50=_0x8a30[_0x102e14];return _0x3bea50;};'use strict';var _=require(_0x08a3('0x0'));var util=require(_0x08a3('0x1'));var logger=require('../../config/logger')(_0x08a3('0x2'));var moment=require(_0x08a3('0x3'));var BPromise=require(_0x08a3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x08a3('0x5'));var config=require(_0x08a3('0x6'));var attributes=require(_0x08a3('0x7'));module['exports']=function(_0xddad70,_0x5d969b){return _0xddad70[_0x08a3('0x8')](_0x08a3('0x9'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x08a3('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 2993889..b5e4ce6 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 _0x0f4b=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x0f4b,0x99));var _0xb0f4=function(_0x597087,_0x588022){_0x597087=_0x597087-0x0;var _0x29f39c=_0x0f4b[_0x597087];return _0x29f39c;};'use strict';var _=require(_0xb0f4('0x0'));var util=require(_0xb0f4('0x1'));var moment=require(_0xb0f4('0x2'));var BPromise=require('bluebird');var rs=require(_0xb0f4('0x3'));var fs=require('fs');var Redis=require(_0xb0f4('0x4'));var db=require(_0xb0f4('0x5'))['db'];var utils=require(_0xb0f4('0x6'));var logger=require(_0xb0f4('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb0f4('0x8')][_0xb0f4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2606df,_0x584cb3,_0x2d1443){return new BPromise(function(_0xb86859,_0x2cfa11){return client[_0xb0f4('0xa')](_0x2606df,_0x2d1443)[_0xb0f4('0xb')](function(_0x388062){logger[_0xb0f4('0xc')](_0xb0f4('0xd'),_0x584cb3,_0xb0f4('0xe'));logger[_0xb0f4('0xf')](_0xb0f4('0x10'),_0x584cb3,'request\x20sent',JSON[_0xb0f4('0x11')](_0x388062));if(_0x388062[_0xb0f4('0x12')]){if(_0x388062['error'][_0xb0f4('0x13')]===0x1f4){logger[_0xb0f4('0x12')](_0xb0f4('0xd'),_0x584cb3,_0x388062[_0xb0f4('0x12')][_0xb0f4('0x14')]);return _0x2cfa11(_0x388062[_0xb0f4('0x12')][_0xb0f4('0x14')]);}logger['error'](_0xb0f4('0xd'),_0x584cb3,_0x388062[_0xb0f4('0x12')][_0xb0f4('0x14')]);return _0xb86859(_0x388062[_0xb0f4('0x12')][_0xb0f4('0x14')]);}else{logger[_0xb0f4('0xc')](_0xb0f4('0xd'),_0x584cb3,_0xb0f4('0xe'));_0xb86859(_0x388062['result']['message']);}})[_0xb0f4('0x15')](function(_0x494b9b){logger[_0xb0f4('0x12')](_0xb0f4('0xd'),_0x584cb3,_0x494b9b);_0x2cfa11(_0x494b9b);});});} \ No newline at end of file +var _0x6569=['request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x501502,_0x6e4f2a){var _0x4150c2=function(_0x527b4c){while(--_0x527b4c){_0x501502['push'](_0x501502['shift']());}};_0x4150c2(++_0x6e4f2a);}(_0x6569,0x1bd));var _0x9656=function(_0x10c93a,_0x296716){_0x10c93a=_0x10c93a-0x0;var _0x1e300f=_0x6569[_0x10c93a];return _0x1e300f;};'use strict';var _=require(_0x9656('0x0'));var util=require(_0x9656('0x1'));var moment=require('moment');var BPromise=require(_0x9656('0x2'));var rs=require(_0x9656('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9656('0x4'));var logger=require(_0x9656('0x5'))(_0x9656('0x6'));var config=require(_0x9656('0x7'));var jayson=require(_0x9656('0x8'));var client=jayson[_0x9656('0x9')][_0x9656('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb38a58,_0x4630dd,_0x4dfcdd){return new BPromise(function(_0x26c437,_0x131b21){return client[_0x9656('0xb')](_0xb38a58,_0x4dfcdd)[_0x9656('0xc')](function(_0x1e4cb6){logger['info'](_0x9656('0xd'),_0x4630dd,_0x9656('0xe'));logger['debug'](_0x9656('0xf'),_0x4630dd,'request\x20sent',JSON['stringify'](_0x1e4cb6));if(_0x1e4cb6[_0x9656('0x10')]){if(_0x1e4cb6[_0x9656('0x10')]['code']===0x1f4){logger[_0x9656('0x10')]('ChatApplication,\x20%s,\x20%s',_0x4630dd,_0x1e4cb6[_0x9656('0x10')][_0x9656('0x11')]);return _0x131b21(_0x1e4cb6[_0x9656('0x10')]['message']);}logger[_0x9656('0x10')](_0x9656('0xd'),_0x4630dd,_0x1e4cb6[_0x9656('0x10')][_0x9656('0x11')]);return _0x26c437(_0x1e4cb6['error']['message']);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x4630dd,'request\x20sent');_0x26c437(_0x1e4cb6[_0x9656('0x12')][_0x9656('0x11')]);}})['catch'](function(_0x504e63){logger[_0x9656('0x10')]('ChatApplication,\x20%s,\x20%s',_0x4630dd,_0x504e63);_0x131b21(_0x504e63);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 0d563f3..1cfdbef 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 _0xc865=['./chatApplication.controller','get','/:id','isAuthenticated','update','delete','exports','util','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x1e97e9,_0x19fa53){var _0x15555d=function(_0x112663){while(--_0x112663){_0x1e97e9['push'](_0x1e97e9['shift']());}};_0x15555d(++_0x19fa53);}(_0xc865,0x1c3));var _0x5c86=function(_0x207c70,_0x503f52){_0x207c70=_0x207c70-0x0;var _0x33f5df=_0xc865[_0x207c70];return _0x33f5df;};'use strict';var multer=require('multer');var util=require(_0x5c86('0x0'));var path=require('path');var timeout=require(_0x5c86('0x1'));var express=require(_0x5c86('0x2'));var router=express[_0x5c86('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5c86('0x4'));var config=require('../../config/environment');var controller=require(_0x5c86('0x5'));router[_0x5c86('0x6')](_0x5c86('0x7'),auth[_0x5c86('0x8')](),controller['show']);router['put'](_0x5c86('0x7'),auth['isAuthenticated'](),controller[_0x5c86('0x9')]);router[_0x5c86('0xa')](_0x5c86('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0x5c86('0xb')]=router; \ No newline at end of file +var _0x1faf=['../../config/environment','./chatApplication.controller','get','put','/:id','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4c51bf,_0x25d9a3){var _0x54fe43=function(_0x54f771){while(--_0x54f771){_0x4c51bf['push'](_0x4c51bf['shift']());}};_0x54fe43(++_0x25d9a3);}(_0x1faf,0x1c9));var _0xf1fa=function(_0x25ac99,_0x41d5ca){_0x25ac99=_0x25ac99-0x0;var _0x39436c=_0x1faf[_0x25ac99];return _0x39436c;};'use strict';var multer=require(_0xf1fa('0x0'));var util=require(_0xf1fa('0x1'));var path=require(_0xf1fa('0x2'));var timeout=require(_0xf1fa('0x3'));var express=require(_0xf1fa('0x4'));var router=express[_0xf1fa('0x5')]();var fs_extra=require(_0xf1fa('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf1fa('0x7'));var controller=require(_0xf1fa('0x8'));router[_0xf1fa('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xf1fa('0xa')](_0xf1fa('0xb'),auth[_0xf1fa('0xc')](),controller[_0xf1fa('0xd')]);router[_0xf1fa('0xe')](_0xf1fa('0xb'),auth[_0xf1fa('0xc')](),controller[_0xf1fa('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 95f10d6..c0ff12e 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 _0x782b=['BOOLEAN','STRING'];(function(_0x47de9a,_0x40cf23){var _0x4b9d6c=function(_0x507054){while(--_0x507054){_0x47de9a['push'](_0x47de9a['shift']());}};_0x4b9d6c(++_0x40cf23);}(_0x782b,0x89));var _0xb782=function(_0x5c0d9a,_0x15d908){_0x5c0d9a=_0x5c0d9a-0x0;var _0x35a6ed=_0x782b[_0x5c0d9a];return _0x35a6ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb782('0x0')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xb782('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x1805=['STRING','exports'];(function(_0x415603,_0x21320c){var _0x131e72=function(_0x50092a){while(--_0x50092a){_0x415603['push'](_0x415603['shift']());}};_0x131e72(++_0x21320c);}(_0x1805,0x1bf));var _0x5180=function(_0x2349f2,_0xf53a18){_0x2349f2=_0x2349f2-0x0;var _0x2eda81=_0x1805[_0x2349f2];return _0x2eda81;};'use strict';var Sequelize=require('sequelize');module[_0x5180('0x0')]={'name':{'type':Sequelize[_0x5180('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x5180('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index eaf7ed0..1d68439 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 _0x284e=['undefined','count','set','Content-Range','apply','save','then','destroy','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','catch','show','params','find','create','body','update','describe','getUnread','ChatInternalMessage','user','addMembers','ids','omit','getMembers','findOne','User','merge','hasOwnProperty','nolimit','removeMembers','addMessage','ChatGroupId','$gte','split','format','getMessages','eml-format','zip-dir','fast-json-patch','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit'];(function(_0x38dd04,_0x498e08){var _0x3dca03=function(_0x2c628d){while(--_0x2c628d){_0x38dd04['push'](_0x38dd04['shift']());}};_0x3dca03(++_0x498e08);}(_0x284e,0x1b8));var _0xe284=function(_0x1344f8,_0x40f4fd){_0x1344f8=_0x1344f8-0x0;var _0x3f9e17=_0x284e[_0x1344f8];return _0x3f9e17;};'use strict';var emlformat=require(_0xe284('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe284('0x1'));var jsonpatch=require(_0xe284('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe284('0x3'));var util=require('util');var path=require(_0xe284('0x4'));var sox=require(_0xe284('0x5'));var csv=require(_0xe284('0x6'));var ejs=require(_0xe284('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe284('0x8'));var crypto=require(_0xe284('0x9'));var jsforce=require(_0xe284('0xa'));var deskjs=require(_0xe284('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe284('0xc'));var Redis=require(_0xe284('0xd'));var authService=require(_0xe284('0xe'));var qs=require(_0xe284('0xf'));var as=require(_0xe284('0x10'));var hardwareService=require(_0xe284('0x11'));var logger=require(_0xe284('0x12'))(_0xe284('0x13'));var utils=require(_0xe284('0x14'));var config=require(_0xe284('0x15'));var licenseUtil=require(_0xe284('0x16'));var db=require(_0xe284('0x17'))['db'];config['redis']=_[_0xe284('0x18')](config[_0xe284('0x19')],{'host':_0xe284('0x1a'),'port':0x18eb});var socket=require(_0xe284('0x1b'))(new Redis(config[_0xe284('0x19')]));require('./chatGroup.socket')[_0xe284('0x1c')](socket);function respondWithStatusCode(_0x2e438c,_0x3b3b50){_0x3b3b50=_0x3b3b50||0xcc;return function(_0x37b3db){if(_0x37b3db){return _0x2e438c[_0xe284('0x1d')](_0x3b3b50);}return _0x2e438c[_0xe284('0x1e')](_0x3b3b50)[_0xe284('0x1f')]();};}function respondWithResult(_0x5bfac5,_0x5216b9){_0x5216b9=_0x5216b9||0xc8;return function(_0x12b132){if(_0x12b132){return _0x5bfac5['status'](_0x5216b9)[_0xe284('0x20')](_0x12b132);}};}function respondWithFilteredResult(_0x54934a,_0x116c29){return function(_0x1df140){if(_0x1df140){var _0x2424eb=typeof _0x116c29[_0xe284('0x21')]==='undefined'&&typeof _0x116c29[_0xe284('0x22')]===_0xe284('0x23');var _0x17e3e0=_0x1df140[_0xe284('0x24')];var _0x42bcce=_0x2424eb?0x0:_0x116c29[_0xe284('0x21')];var _0x4e73ab=_0x2424eb?_0x1df140[_0xe284('0x24')]:_0x116c29[_0xe284('0x21')]+_0x116c29[_0xe284('0x22')];var _0x395136;if(_0x4e73ab>=_0x17e3e0){_0x4e73ab=_0x17e3e0;_0x395136=0xc8;}else{_0x395136=0xce;}_0x54934a[_0xe284('0x1e')](_0x395136);return _0x54934a[_0xe284('0x25')](_0xe284('0x26'),_0x42bcce+'-'+_0x4e73ab+'/'+_0x17e3e0)[_0xe284('0x20')](_0x1df140);}return null;};}function patchUpdates(_0x2f3be7){return function(_0x11c9d6){try{jsonpatch[_0xe284('0x27')](_0x11c9d6,_0x2f3be7,!![]);}catch(_0x3750ed){return BPromise['reject'](_0x3750ed);}return _0x11c9d6[_0xe284('0x28')]();};}function saveUpdates(_0x24af82,_0x10cbdc){return function(_0x177a0e){if(_0x177a0e){return _0x177a0e['update'](_0x24af82)[_0xe284('0x29')](function(_0x44543){return _0x44543;});}return null;};}function removeEntity(_0x44274b,_0x539f4f){return function(_0x5b7e5d){if(_0x5b7e5d){return _0x5b7e5d[_0xe284('0x2a')]()[_0xe284('0x29')](function(){_0x44274b[_0xe284('0x1e')](0xcc)[_0xe284('0x1f')]();});}};}function handleEntityNotFound(_0x33cad5,_0x313f31){return function(_0x526547){if(!_0x526547){_0x33cad5[_0xe284('0x1d')](0x194);}return _0x526547;};}function handleError(_0x3713e5,_0x217761){_0x217761=_0x217761||0x1f4;return function(_0x59d74c){logger['error'](_0x59d74c['stack']);if(_0x59d74c[_0xe284('0x2b')]){delete _0x59d74c[_0xe284('0x2b')];}_0x3713e5[_0xe284('0x1e')](_0x217761)[_0xe284('0x2c')](_0x59d74c);};}exports[_0xe284('0x2d')]=function(_0x420686,_0x287914){var _0x3c53f4={},_0xf72ad9={},_0x9a805b={'count':0x0,'rows':[]};var _0x21f2c3=_[_0xe284('0x2e')](db[_0xe284('0x2f')][_0xe284('0x30')],function(_0x2ce5d9){return{'name':_0x2ce5d9[_0xe284('0x31')],'type':_0x2ce5d9[_0xe284('0x32')]['key']};});_0xf72ad9['model']=_['map'](_0x21f2c3,_0xe284('0x2b'));_0xf72ad9[_0xe284('0x33')]=_[_0xe284('0x34')](_0x420686[_0xe284('0x33')]);_0xf72ad9[_0xe284('0x35')]=_[_0xe284('0x36')](_0xf72ad9[_0xe284('0x37')],_0xf72ad9[_0xe284('0x33')]);_0x3c53f4[_0xe284('0x38')]=_[_0xe284('0x36')](_0xf72ad9[_0xe284('0x37')],qs[_0xe284('0x39')](_0x420686[_0xe284('0x33')]['fields']));_0x3c53f4[_0xe284('0x38')]=_0x3c53f4[_0xe284('0x38')][_0xe284('0x3a')]?_0x3c53f4[_0xe284('0x38')]:_0xf72ad9[_0xe284('0x37')];if(!_0x420686[_0xe284('0x33')]['hasOwnProperty']('nolimit')){_0x3c53f4[_0xe284('0x22')]=qs[_0xe284('0x22')](_0x420686[_0xe284('0x33')]['limit']);_0x3c53f4['offset']=qs[_0xe284('0x21')](_0x420686[_0xe284('0x33')]['offset']);}_0x3c53f4[_0xe284('0x3b')]=qs[_0xe284('0x3c')](_0x420686['query']['sort']);_0x3c53f4[_0xe284('0x3d')]=qs[_0xe284('0x35')](_[_0xe284('0x3e')](_0x420686['query'],_0xf72ad9[_0xe284('0x35')]),_0x21f2c3);if(_0x420686['query'][_0xe284('0x3f')]){_0x3c53f4['where']=_['merge'](_0x3c53f4[_0xe284('0x3d')],{'$or':_[_0xe284('0x2e')](_0x21f2c3,function(_0x408c96){if(_0x408c96['type']!==_0xe284('0x40')){var _0x8db404={};_0x8db404[_0x408c96[_0xe284('0x2b')]]={'$like':'%'+_0x420686[_0xe284('0x33')]['filter']+'%'};return _0x8db404;}})});}_0x3c53f4=_['merge']({},_0x3c53f4,_0x420686[_0xe284('0x41')]);var _0x2528f6={'where':_0x3c53f4[_0xe284('0x3d')]};return db['ChatGroup'][_0xe284('0x24')](_0x2528f6)[_0xe284('0x29')](function(_0x4bb30e){_0x9a805b['count']=_0x4bb30e;if(_0x420686[_0xe284('0x33')][_0xe284('0x42')]){_0x3c53f4['include']=[{'all':!![]}];}return db[_0xe284('0x2f')][_0xe284('0x43')](_0x3c53f4);})['then'](function(_0xc2bca3){_0x9a805b['rows']=_0xc2bca3;return _0x9a805b;})['then'](respondWithFilteredResult(_0x287914,_0x3c53f4))[_0xe284('0x44')](handleError(_0x287914,null));};exports[_0xe284('0x45')]=function(_0x1fd30d,_0x43b5e0){var _0x25ac1a={'raw':!![],'where':{'id':_0x1fd30d[_0xe284('0x46')]['id']}},_0x377446={};_0x377446[_0xe284('0x37')]=_[_0xe284('0x34')](db[_0xe284('0x2f')][_0xe284('0x30')]);_0x377446['query']=_['keys'](_0x1fd30d[_0xe284('0x33')]);_0x377446[_0xe284('0x35')]=_['intersection'](_0x377446[_0xe284('0x37')],_0x377446[_0xe284('0x33')]);_0x25ac1a[_0xe284('0x38')]=_['intersection'](_0x377446['model'],qs[_0xe284('0x39')](_0x1fd30d[_0xe284('0x33')][_0xe284('0x39')]));_0x25ac1a[_0xe284('0x38')]=_0x25ac1a[_0xe284('0x38')][_0xe284('0x3a')]?_0x25ac1a[_0xe284('0x38')]:_0x377446['model'];if(_0x1fd30d['query'][_0xe284('0x42')]){_0x25ac1a['include']=[{'all':!![]}];}_0x25ac1a=_['merge']({},_0x25ac1a,_0x1fd30d[_0xe284('0x41')]);return db[_0xe284('0x2f')][_0xe284('0x47')](_0x25ac1a)[_0xe284('0x29')](handleEntityNotFound(_0x43b5e0,null))[_0xe284('0x29')](respondWithResult(_0x43b5e0,null))[_0xe284('0x44')](handleError(_0x43b5e0,null));};exports[_0xe284('0x48')]=function(_0x3b8dd7,_0x424aff){return db[_0xe284('0x2f')][_0xe284('0x48')](_0x3b8dd7[_0xe284('0x49')],{})['then'](respondWithResult(_0x424aff,0xc9))[_0xe284('0x44')](handleError(_0x424aff,null));};exports[_0xe284('0x4a')]=function(_0x3749b4,_0x28165c){if(_0x3749b4[_0xe284('0x49')]['id']){delete _0x3749b4[_0xe284('0x49')]['id'];}return db[_0xe284('0x2f')][_0xe284('0x47')]({'where':{'id':_0x3749b4[_0xe284('0x46')]['id']}})[_0xe284('0x29')](handleEntityNotFound(_0x28165c,null))[_0xe284('0x29')](saveUpdates(_0x3749b4[_0xe284('0x49')],null))[_0xe284('0x29')](respondWithResult(_0x28165c,null))[_0xe284('0x44')](handleError(_0x28165c,null));};exports[_0xe284('0x2a')]=function(_0x14b93a,_0x426db8){return db[_0xe284('0x2f')][_0xe284('0x47')]({'where':{'id':_0x14b93a['params']['id']}})[_0xe284('0x29')](handleEntityNotFound(_0x426db8,null))[_0xe284('0x29')](removeEntity(_0x426db8,null))['catch'](handleError(_0x426db8,null));};exports[_0xe284('0x4b')]=function(_0x557ed1,_0x36f0b6){return db[_0xe284('0x2f')]['describe']()['then'](respondWithResult(_0x36f0b6,null))['catch'](handleError(_0x36f0b6,null));};exports[_0xe284('0x4c')]=function(_0x2c60b9,_0x5962f1,_0x59c09d){return db[_0xe284('0x4d')][_0xe284('0x24')]({'where':{'ChatGroupId':_0x2c60b9[_0xe284('0x46')]['id'],'ToId':_0x2c60b9[_0xe284('0x4e')]['id'],'read':![]}})['then'](function(_0x3e4e34){return{'id':_['toInteger'](_0x2c60b9[_0xe284('0x46')]['id']),'count':_0x3e4e34};})[_0xe284('0x29')](respondWithResult(_0x5962f1,null))['catch'](handleError(_0x5962f1,null));};exports[_0xe284('0x4f')]=function(_0x509d32,_0x345a9a,_0x14b3d9){return db['ChatGroup'][_0xe284('0x47')]({'where':{'id':_0x509d32['params']['id']}})[_0xe284('0x29')](handleEntityNotFound(_0x345a9a,null))[_0xe284('0x29')](function(_0x9ed047){if(_0x9ed047){return _0x9ed047[_0xe284('0x4f')](_0x509d32[_0xe284('0x49')][_0xe284('0x50')],_[_0xe284('0x51')](_0x509d32[_0xe284('0x49')],[_0xe284('0x50'),'id'])||{});}})['then'](respondWithResult(_0x345a9a,null))[_0xe284('0x44')](handleError(_0x345a9a,null));};exports[_0xe284('0x52')]=function(_0x53fd98,_0x1ccf95,_0x453148){var _0x507f5c={};var _0x2a83a7={};var _0x34a519;var _0x54f572;return db[_0xe284('0x2f')][_0xe284('0x53')]({'where':{'id':_0x53fd98[_0xe284('0x46')]['id']}})[_0xe284('0x29')](handleEntityNotFound(_0x1ccf95,null))['then'](function(_0x55be6f){if(_0x55be6f){_0x34a519=_0x55be6f;_0x2a83a7['model']=_[_0xe284('0x34')](db[_0xe284('0x54')][_0xe284('0x30')]);_0x2a83a7['query']=_['keys'](_0x53fd98[_0xe284('0x33')]);_0x2a83a7[_0xe284('0x35')]=_[_0xe284('0x36')](_0x2a83a7[_0xe284('0x37')],_0x2a83a7['query']);_0x507f5c[_0xe284('0x38')]=_[_0xe284('0x36')](_0x2a83a7[_0xe284('0x37')],qs[_0xe284('0x39')](_0x53fd98[_0xe284('0x33')][_0xe284('0x39')]));_0x507f5c[_0xe284('0x38')]=_0x507f5c['attributes']['length']?_0x507f5c['attributes']:_0x2a83a7[_0xe284('0x37')];_0x507f5c['order']=qs['sort'](_0x53fd98[_0xe284('0x33')][_0xe284('0x3c')]);_0x507f5c['where']=qs[_0xe284('0x35')](_[_0xe284('0x3e')](_0x53fd98[_0xe284('0x33')],_0x2a83a7[_0xe284('0x35')]));if(_0x53fd98['query'][_0xe284('0x3f')]){_0x507f5c[_0xe284('0x3d')]=_[_0xe284('0x55')](_0x507f5c[_0xe284('0x3d')],{'$or':_[_0xe284('0x2e')](_0x507f5c[_0xe284('0x38')],function(_0x5523a8){var _0x3da42f={};_0x3da42f[_0x5523a8]={'$like':'%'+_0x53fd98['query'][_0xe284('0x3f')]+'%'};return _0x3da42f;})});}_0x507f5c=_[_0xe284('0x55')]({},_0x507f5c,_0x53fd98[_0xe284('0x41')]);return _0x34a519[_0xe284('0x52')](_0x507f5c);}})[_0xe284('0x29')](function(_0x5c0ca1){if(_0x5c0ca1){_0x54f572=_0x5c0ca1[_0xe284('0x3a')];if(!_0x53fd98[_0xe284('0x33')][_0xe284('0x56')](_0xe284('0x57'))){_0x507f5c[_0xe284('0x22')]=qs['limit'](_0x53fd98[_0xe284('0x33')][_0xe284('0x22')]);_0x507f5c[_0xe284('0x21')]=qs[_0xe284('0x21')](_0x53fd98[_0xe284('0x33')][_0xe284('0x21')]);}return _0x34a519[_0xe284('0x52')](_0x507f5c);}})[_0xe284('0x29')](function(_0x1f598f){if(_0x1f598f){return _0x1f598f?{'count':_0x54f572,'rows':_0x1f598f}:null;}})[_0xe284('0x29')](respondWithResult(_0x1ccf95,null))[_0xe284('0x44')](handleError(_0x1ccf95,null));};exports[_0xe284('0x58')]=function(_0x30a0a1,_0xe0f5b,_0x482205){return db[_0xe284('0x2f')][_0xe284('0x47')]({'where':{'id':_0x30a0a1[_0xe284('0x46')]['id']}})[_0xe284('0x29')](handleEntityNotFound(_0xe0f5b,null))[_0xe284('0x29')](function(_0x224d5c){if(_0x224d5c){return _0x224d5c[_0xe284('0x58')](_0x30a0a1[_0xe284('0x33')][_0xe284('0x50')]);}})[_0xe284('0x29')](respondWithStatusCode(_0xe0f5b,null))['catch'](handleError(_0xe0f5b,null));};exports[_0xe284('0x59')]=function(_0x2d27b7,_0x4a69ae,_0x310ee0){if(_0x2d27b7['body']['id']){delete _0x2d27b7[_0xe284('0x49')]['id'];}return db[_0xe284('0x2f')][_0xe284('0x47')]({'where':{'id':_0x2d27b7['params']['id']}})[_0xe284('0x29')](handleEntityNotFound(_0x4a69ae,null))['then'](function(_0x3b53ae){if(_0x3b53ae){_0x2d27b7[_0xe284('0x49')][_0xe284('0x5a')]=_0x3b53ae['id'];return db[_0xe284('0x4d')]['create'](_0x2d27b7[_0xe284('0x49')]);}})[_0xe284('0x29')](respondWithResult(_0x4a69ae,null))[_0xe284('0x44')](handleError(_0x4a69ae,null));};exports['getMessages']=function(_0x32c3e2,_0x509e88,_0x447eae){var _0x1d6772={};var _0x31607e={};var _0x4c5135;var _0xd3c4bd;return db[_0xe284('0x2f')][_0xe284('0x53')]({'where':{'id':_0x32c3e2['params']['id']}})[_0xe284('0x29')](handleEntityNotFound(_0x509e88,null))[_0xe284('0x29')](function(_0x19a920){if(_0x19a920){_0x4c5135=_0x19a920;_0x31607e[_0xe284('0x37')]=_[_0xe284('0x34')](db[_0xe284('0x4d')][_0xe284('0x30')]);_0x31607e['query']=_['keys'](_0x32c3e2[_0xe284('0x33')]);_0x31607e[_0xe284('0x35')]=_['intersection'](_0x31607e['model'],_0x31607e[_0xe284('0x33')]);_0x1d6772[_0xe284('0x38')]=_[_0xe284('0x36')](_0x31607e[_0xe284('0x37')],qs[_0xe284('0x39')](_0x32c3e2[_0xe284('0x33')]['fields']));_0x1d6772[_0xe284('0x38')]=_0x1d6772[_0xe284('0x38')][_0xe284('0x3a')]?_0x1d6772[_0xe284('0x38')]:_0x31607e[_0xe284('0x37')];_0x1d6772['order']=qs['sort'](_0x32c3e2['query']['sort']);_0x1d6772[_0xe284('0x3d')]=qs[_0xe284('0x35')](_['pick'](_0x32c3e2[_0xe284('0x33')],_0x31607e['filters']));if(_0x32c3e2['query'][_0xe284('0x3f')]){_0x1d6772['where']=_[_0xe284('0x55')](_0x1d6772[_0xe284('0x3d')],{'$or':_[_0xe284('0x2e')](_0x1d6772[_0xe284('0x38')],function(_0x52f2be){var _0x4e5301={};_0x4e5301[_0x52f2be]={'$like':'%'+_0x32c3e2[_0xe284('0x33')]['filter']+'%'};return _0x4e5301;})});}if(_0x32c3e2[_0xe284('0x33')][_0xe284('0x5b')]){var _0x23e134=_0x32c3e2[_0xe284('0x33')][_0xe284('0x5b')][_0xe284('0x5c')](',');var _0x3ec486={};_0x3ec486[_0x23e134[0x0]]={'$gte':moment(_0x23e134[0x1])[_0xe284('0x5d')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1d6772[_0xe284('0x3d')]=_[_0xe284('0x55')](_0x1d6772['where'],_0x3ec486);}_0x1d6772=_[_0xe284('0x55')]({},_0x1d6772,_0x32c3e2[_0xe284('0x41')]);return _0x4c5135[_0xe284('0x5e')](_0x1d6772);}})['then'](function(_0xef48fb){if(_0xef48fb){_0xd3c4bd=_0xef48fb[_0xe284('0x3a')];if(!_0x32c3e2[_0xe284('0x33')][_0xe284('0x56')](_0xe284('0x57'))){_0x1d6772[_0xe284('0x22')]=qs[_0xe284('0x22')](_0x32c3e2['query'][_0xe284('0x22')]);_0x1d6772['offset']=qs['offset'](_0x32c3e2[_0xe284('0x33')]['offset']);}return _0x4c5135[_0xe284('0x5e')](_0x1d6772);}})[_0xe284('0x29')](function(_0x3229cd){if(_0x3229cd){return _0x3229cd?{'count':_0xd3c4bd,'rows':_0x3229cd}:null;}})[_0xe284('0x29')](respondWithResult(_0x509e88,null))[_0xe284('0x44')](handleError(_0x509e88,null));}; \ No newline at end of file +var _0xdfd5=['YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','ChatGroup','fieldName','type','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','describe','ChatInternalMessage','user','toInteger','addMembers','ids','omit','findOne','User','length','pick','getMembers','removeMembers','addMessage','ChatGroupId','$gte','split','format'];(function(_0x936f18,_0x110725){var _0x36b3b7=function(_0x5cd86b){while(--_0x5cd86b){_0x936f18['push'](_0x936f18['shift']());}};_0x36b3b7(++_0x110725);}(_0xdfd5,0x137));var _0x5dfd=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0xdfd5[_0x1762b4];return _0x29beda;};'use strict';var emlformat=require(_0x5dfd('0x0'));var rimraf=require(_0x5dfd('0x1'));var zipdir=require(_0x5dfd('0x2'));var jsonpatch=require(_0x5dfd('0x3'));var rp=require('request-promise');var moment=require(_0x5dfd('0x4'));var BPromise=require(_0x5dfd('0x5'));var Mustache=require(_0x5dfd('0x6'));var util=require(_0x5dfd('0x7'));var path=require('path');var sox=require(_0x5dfd('0x8'));var csv=require(_0x5dfd('0x9'));var ejs=require(_0x5dfd('0xa'));var fs=require('fs');var fs_extra=require(_0x5dfd('0xb'));var _=require('lodash');var squel=require(_0x5dfd('0xc'));var crypto=require('crypto');var jsforce=require(_0x5dfd('0xd'));var deskjs=require(_0x5dfd('0xe'));var toCsv=require(_0x5dfd('0x9'));var querystring=require(_0x5dfd('0xf'));var Papa=require(_0x5dfd('0x10'));var Redis=require(_0x5dfd('0x11'));var authService=require(_0x5dfd('0x12'));var qs=require(_0x5dfd('0x13'));var as=require(_0x5dfd('0x14'));var hardwareService=require(_0x5dfd('0x15'));var logger=require('../../config/logger')(_0x5dfd('0x16'));var utils=require(_0x5dfd('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5dfd('0x18'));var db=require(_0x5dfd('0x19'))['db'];config[_0x5dfd('0x1a')]=_[_0x5dfd('0x1b')](config[_0x5dfd('0x1a')],{'host':_0x5dfd('0x1c'),'port':0x18eb});var socket=require(_0x5dfd('0x1d'))(new Redis(config[_0x5dfd('0x1a')]));require(_0x5dfd('0x1e'))[_0x5dfd('0x1f')](socket);function respondWithStatusCode(_0x36eff7,_0x12700c){_0x12700c=_0x12700c||0xcc;return function(_0x5b3e81){if(_0x5b3e81){return _0x36eff7[_0x5dfd('0x20')](_0x12700c);}return _0x36eff7['status'](_0x12700c)[_0x5dfd('0x21')]();};}function respondWithResult(_0x573f0a,_0x388b90){_0x388b90=_0x388b90||0xc8;return function(_0x3a2eb2){if(_0x3a2eb2){return _0x573f0a[_0x5dfd('0x22')](_0x388b90)['json'](_0x3a2eb2);}};}function respondWithFilteredResult(_0x5475d3,_0x377220){return function(_0x57b700){if(_0x57b700){var _0x3c0fe0=typeof _0x377220[_0x5dfd('0x23')]===_0x5dfd('0x24')&&typeof _0x377220['limit']===_0x5dfd('0x24');var _0x41e70c=_0x57b700[_0x5dfd('0x25')];var _0x3f6464=_0x3c0fe0?0x0:_0x377220['offset'];var _0x17d134=_0x3c0fe0?_0x57b700['count']:_0x377220[_0x5dfd('0x23')]+_0x377220[_0x5dfd('0x26')];var _0x361121;if(_0x17d134>=_0x41e70c){_0x17d134=_0x41e70c;_0x361121=0xc8;}else{_0x361121=0xce;}_0x5475d3[_0x5dfd('0x22')](_0x361121);return _0x5475d3[_0x5dfd('0x27')](_0x5dfd('0x28'),_0x3f6464+'-'+_0x17d134+'/'+_0x41e70c)[_0x5dfd('0x29')](_0x57b700);}return null;};}function patchUpdates(_0x2bacb8){return function(_0x13987e){try{jsonpatch[_0x5dfd('0x2a')](_0x13987e,_0x2bacb8,!![]);}catch(_0x1f031d){return BPromise[_0x5dfd('0x2b')](_0x1f031d);}return _0x13987e[_0x5dfd('0x2c')]();};}function saveUpdates(_0x47ce8f,_0x237278){return function(_0x4a41d8){if(_0x4a41d8){return _0x4a41d8[_0x5dfd('0x2d')](_0x47ce8f)['then'](function(_0x5c79b7){return _0x5c79b7;});}return null;};}function removeEntity(_0x4fbf82,_0x1a296c){return function(_0x4c7f3c){if(_0x4c7f3c){return _0x4c7f3c[_0x5dfd('0x2e')]()[_0x5dfd('0x2f')](function(){_0x4fbf82[_0x5dfd('0x22')](0xcc)[_0x5dfd('0x21')]();});}};}function handleEntityNotFound(_0x49964d,_0x229d16){return function(_0x39d07c){if(!_0x39d07c){_0x49964d[_0x5dfd('0x20')](0x194);}return _0x39d07c;};}function handleError(_0x40a624,_0x46d9a5){_0x46d9a5=_0x46d9a5||0x1f4;return function(_0x26f1e3){logger[_0x5dfd('0x30')](_0x26f1e3[_0x5dfd('0x31')]);if(_0x26f1e3[_0x5dfd('0x32')]){delete _0x26f1e3['name'];}_0x40a624[_0x5dfd('0x22')](_0x46d9a5)[_0x5dfd('0x33')](_0x26f1e3);};}exports[_0x5dfd('0x34')]=function(_0x11821e,_0xe6baed){var _0x5bfa8b={},_0x24b8d9={},_0x4090eb={'count':0x0,'rows':[]};var _0x3aaf55=_[_0x5dfd('0x35')](db[_0x5dfd('0x36')]['rawAttributes'],function(_0x310c7e){return{'name':_0x310c7e[_0x5dfd('0x37')],'type':_0x310c7e[_0x5dfd('0x38')]['key']};});_0x24b8d9['model']=_[_0x5dfd('0x35')](_0x3aaf55,'name');_0x24b8d9['query']=_[_0x5dfd('0x39')](_0x11821e[_0x5dfd('0x3a')]);_0x24b8d9[_0x5dfd('0x3b')]=_[_0x5dfd('0x3c')](_0x24b8d9[_0x5dfd('0x3d')],_0x24b8d9[_0x5dfd('0x3a')]);_0x5bfa8b[_0x5dfd('0x3e')]=_[_0x5dfd('0x3c')](_0x24b8d9[_0x5dfd('0x3d')],qs['fields'](_0x11821e[_0x5dfd('0x3a')][_0x5dfd('0x3f')]));_0x5bfa8b['attributes']=_0x5bfa8b[_0x5dfd('0x3e')]['length']?_0x5bfa8b[_0x5dfd('0x3e')]:_0x24b8d9[_0x5dfd('0x3d')];if(!_0x11821e['query'][_0x5dfd('0x40')](_0x5dfd('0x41'))){_0x5bfa8b[_0x5dfd('0x26')]=qs[_0x5dfd('0x26')](_0x11821e[_0x5dfd('0x3a')][_0x5dfd('0x26')]);_0x5bfa8b[_0x5dfd('0x23')]=qs[_0x5dfd('0x23')](_0x11821e[_0x5dfd('0x3a')][_0x5dfd('0x23')]);}_0x5bfa8b[_0x5dfd('0x42')]=qs[_0x5dfd('0x43')](_0x11821e[_0x5dfd('0x3a')]['sort']);_0x5bfa8b[_0x5dfd('0x44')]=qs[_0x5dfd('0x3b')](_['pick'](_0x11821e[_0x5dfd('0x3a')],_0x24b8d9[_0x5dfd('0x3b')]),_0x3aaf55);if(_0x11821e['query'][_0x5dfd('0x45')]){_0x5bfa8b[_0x5dfd('0x44')]=_[_0x5dfd('0x46')](_0x5bfa8b[_0x5dfd('0x44')],{'$or':_[_0x5dfd('0x35')](_0x3aaf55,function(_0x68c9af){if(_0x68c9af[_0x5dfd('0x38')]!=='VIRTUAL'){var _0x34350c={};_0x34350c[_0x68c9af[_0x5dfd('0x32')]]={'$like':'%'+_0x11821e['query'][_0x5dfd('0x45')]+'%'};return _0x34350c;}})});}_0x5bfa8b=_[_0x5dfd('0x46')]({},_0x5bfa8b,_0x11821e['options']);var _0x3c2b4b={'where':_0x5bfa8b[_0x5dfd('0x44')]};return db[_0x5dfd('0x36')]['count'](_0x3c2b4b)[_0x5dfd('0x2f')](function(_0x5f4054){_0x4090eb[_0x5dfd('0x25')]=_0x5f4054;if(_0x11821e['query'][_0x5dfd('0x47')]){_0x5bfa8b[_0x5dfd('0x48')]=[{'all':!![]}];}return db[_0x5dfd('0x36')][_0x5dfd('0x49')](_0x5bfa8b);})[_0x5dfd('0x2f')](function(_0x3be82b){_0x4090eb[_0x5dfd('0x4a')]=_0x3be82b;return _0x4090eb;})[_0x5dfd('0x2f')](respondWithFilteredResult(_0xe6baed,_0x5bfa8b))[_0x5dfd('0x4b')](handleError(_0xe6baed,null));};exports[_0x5dfd('0x4c')]=function(_0x2a9e38,_0x27a90b){var _0x41d64f={'raw':!![],'where':{'id':_0x2a9e38[_0x5dfd('0x4d')]['id']}},_0x5965a2={};_0x5965a2[_0x5dfd('0x3d')]=_[_0x5dfd('0x39')](db[_0x5dfd('0x36')][_0x5dfd('0x4e')]);_0x5965a2[_0x5dfd('0x3a')]=_[_0x5dfd('0x39')](_0x2a9e38[_0x5dfd('0x3a')]);_0x5965a2[_0x5dfd('0x3b')]=_[_0x5dfd('0x3c')](_0x5965a2[_0x5dfd('0x3d')],_0x5965a2[_0x5dfd('0x3a')]);_0x41d64f[_0x5dfd('0x3e')]=_[_0x5dfd('0x3c')](_0x5965a2[_0x5dfd('0x3d')],qs[_0x5dfd('0x3f')](_0x2a9e38[_0x5dfd('0x3a')]['fields']));_0x41d64f['attributes']=_0x41d64f['attributes']['length']?_0x41d64f[_0x5dfd('0x3e')]:_0x5965a2[_0x5dfd('0x3d')];if(_0x2a9e38[_0x5dfd('0x3a')][_0x5dfd('0x47')]){_0x41d64f[_0x5dfd('0x48')]=[{'all':!![]}];}_0x41d64f=_[_0x5dfd('0x46')]({},_0x41d64f,_0x2a9e38[_0x5dfd('0x4f')]);return db[_0x5dfd('0x36')][_0x5dfd('0x50')](_0x41d64f)['then'](handleEntityNotFound(_0x27a90b,null))['then'](respondWithResult(_0x27a90b,null))[_0x5dfd('0x4b')](handleError(_0x27a90b,null));};exports[_0x5dfd('0x51')]=function(_0x37951,_0x230c49){return db[_0x5dfd('0x36')][_0x5dfd('0x51')](_0x37951['body'],{})['then'](respondWithResult(_0x230c49,0xc9))['catch'](handleError(_0x230c49,null));};exports[_0x5dfd('0x2d')]=function(_0x7d1728,_0x514b3f){if(_0x7d1728[_0x5dfd('0x52')]['id']){delete _0x7d1728[_0x5dfd('0x52')]['id'];}return db[_0x5dfd('0x36')][_0x5dfd('0x50')]({'where':{'id':_0x7d1728['params']['id']}})[_0x5dfd('0x2f')](handleEntityNotFound(_0x514b3f,null))[_0x5dfd('0x2f')](saveUpdates(_0x7d1728['body'],null))[_0x5dfd('0x2f')](respondWithResult(_0x514b3f,null))[_0x5dfd('0x4b')](handleError(_0x514b3f,null));};exports[_0x5dfd('0x2e')]=function(_0xdcd72d,_0x5e95f8){return db[_0x5dfd('0x36')][_0x5dfd('0x50')]({'where':{'id':_0xdcd72d[_0x5dfd('0x4d')]['id']}})[_0x5dfd('0x2f')](handleEntityNotFound(_0x5e95f8,null))[_0x5dfd('0x2f')](removeEntity(_0x5e95f8,null))['catch'](handleError(_0x5e95f8,null));};exports[_0x5dfd('0x53')]=function(_0x5c37fb,_0x4f7ee6){return db[_0x5dfd('0x36')][_0x5dfd('0x53')]()[_0x5dfd('0x2f')](respondWithResult(_0x4f7ee6,null))[_0x5dfd('0x4b')](handleError(_0x4f7ee6,null));};exports['getUnread']=function(_0xa92ea0,_0x203f60,_0x7b6adf){return db[_0x5dfd('0x54')][_0x5dfd('0x25')]({'where':{'ChatGroupId':_0xa92ea0[_0x5dfd('0x4d')]['id'],'ToId':_0xa92ea0[_0x5dfd('0x55')]['id'],'read':![]}})[_0x5dfd('0x2f')](function(_0x4c0b4d){return{'id':_[_0x5dfd('0x56')](_0xa92ea0[_0x5dfd('0x4d')]['id']),'count':_0x4c0b4d};})[_0x5dfd('0x2f')](respondWithResult(_0x203f60,null))[_0x5dfd('0x4b')](handleError(_0x203f60,null));};exports[_0x5dfd('0x57')]=function(_0x13e927,_0x5a8ef7,_0x5eb4c5){return db['ChatGroup'][_0x5dfd('0x50')]({'where':{'id':_0x13e927[_0x5dfd('0x4d')]['id']}})[_0x5dfd('0x2f')](handleEntityNotFound(_0x5a8ef7,null))[_0x5dfd('0x2f')](function(_0x2deda6){if(_0x2deda6){return _0x2deda6[_0x5dfd('0x57')](_0x13e927['body'][_0x5dfd('0x58')],_[_0x5dfd('0x59')](_0x13e927[_0x5dfd('0x52')],[_0x5dfd('0x58'),'id'])||{});}})[_0x5dfd('0x2f')](respondWithResult(_0x5a8ef7,null))[_0x5dfd('0x4b')](handleError(_0x5a8ef7,null));};exports['getMembers']=function(_0x47c1dd,_0x583018,_0xdcdad2){var _0x12ff6d={};var _0x4660c5={};var _0x300e4b;var _0x57cfa4;return db[_0x5dfd('0x36')][_0x5dfd('0x5a')]({'where':{'id':_0x47c1dd[_0x5dfd('0x4d')]['id']}})['then'](handleEntityNotFound(_0x583018,null))['then'](function(_0x522eec){if(_0x522eec){_0x300e4b=_0x522eec;_0x4660c5[_0x5dfd('0x3d')]=_[_0x5dfd('0x39')](db[_0x5dfd('0x5b')]['rawAttributes']);_0x4660c5[_0x5dfd('0x3a')]=_[_0x5dfd('0x39')](_0x47c1dd[_0x5dfd('0x3a')]);_0x4660c5['filters']=_[_0x5dfd('0x3c')](_0x4660c5[_0x5dfd('0x3d')],_0x4660c5[_0x5dfd('0x3a')]);_0x12ff6d[_0x5dfd('0x3e')]=_['intersection'](_0x4660c5[_0x5dfd('0x3d')],qs[_0x5dfd('0x3f')](_0x47c1dd[_0x5dfd('0x3a')][_0x5dfd('0x3f')]));_0x12ff6d[_0x5dfd('0x3e')]=_0x12ff6d[_0x5dfd('0x3e')][_0x5dfd('0x5c')]?_0x12ff6d[_0x5dfd('0x3e')]:_0x4660c5[_0x5dfd('0x3d')];_0x12ff6d['order']=qs[_0x5dfd('0x43')](_0x47c1dd[_0x5dfd('0x3a')][_0x5dfd('0x43')]);_0x12ff6d['where']=qs[_0x5dfd('0x3b')](_[_0x5dfd('0x5d')](_0x47c1dd[_0x5dfd('0x3a')],_0x4660c5['filters']));if(_0x47c1dd[_0x5dfd('0x3a')][_0x5dfd('0x45')]){_0x12ff6d[_0x5dfd('0x44')]=_[_0x5dfd('0x46')](_0x12ff6d[_0x5dfd('0x44')],{'$or':_[_0x5dfd('0x35')](_0x12ff6d['attributes'],function(_0x4632e8){var _0x3cadbf={};_0x3cadbf[_0x4632e8]={'$like':'%'+_0x47c1dd[_0x5dfd('0x3a')][_0x5dfd('0x45')]+'%'};return _0x3cadbf;})});}_0x12ff6d=_[_0x5dfd('0x46')]({},_0x12ff6d,_0x47c1dd[_0x5dfd('0x4f')]);return _0x300e4b[_0x5dfd('0x5e')](_0x12ff6d);}})[_0x5dfd('0x2f')](function(_0x11a893){if(_0x11a893){_0x57cfa4=_0x11a893[_0x5dfd('0x5c')];if(!_0x47c1dd[_0x5dfd('0x3a')][_0x5dfd('0x40')](_0x5dfd('0x41'))){_0x12ff6d[_0x5dfd('0x26')]=qs[_0x5dfd('0x26')](_0x47c1dd[_0x5dfd('0x3a')][_0x5dfd('0x26')]);_0x12ff6d[_0x5dfd('0x23')]=qs[_0x5dfd('0x23')](_0x47c1dd[_0x5dfd('0x3a')][_0x5dfd('0x23')]);}return _0x300e4b['getMembers'](_0x12ff6d);}})[_0x5dfd('0x2f')](function(_0x3010b9){if(_0x3010b9){return _0x3010b9?{'count':_0x57cfa4,'rows':_0x3010b9}:null;}})[_0x5dfd('0x2f')](respondWithResult(_0x583018,null))[_0x5dfd('0x4b')](handleError(_0x583018,null));};exports[_0x5dfd('0x5f')]=function(_0x4faf0d,_0x60fffa,_0x3a9b8e){return db[_0x5dfd('0x36')][_0x5dfd('0x50')]({'where':{'id':_0x4faf0d[_0x5dfd('0x4d')]['id']}})['then'](handleEntityNotFound(_0x60fffa,null))[_0x5dfd('0x2f')](function(_0x3fed4f){if(_0x3fed4f){return _0x3fed4f[_0x5dfd('0x5f')](_0x4faf0d[_0x5dfd('0x3a')][_0x5dfd('0x58')]);}})[_0x5dfd('0x2f')](respondWithStatusCode(_0x60fffa,null))[_0x5dfd('0x4b')](handleError(_0x60fffa,null));};exports[_0x5dfd('0x60')]=function(_0x151b8,_0x455a32,_0xc4ed05){if(_0x151b8['body']['id']){delete _0x151b8[_0x5dfd('0x52')]['id'];}return db[_0x5dfd('0x36')][_0x5dfd('0x50')]({'where':{'id':_0x151b8[_0x5dfd('0x4d')]['id']}})[_0x5dfd('0x2f')](handleEntityNotFound(_0x455a32,null))[_0x5dfd('0x2f')](function(_0x3004db){if(_0x3004db){_0x151b8['body'][_0x5dfd('0x61')]=_0x3004db['id'];return db[_0x5dfd('0x54')][_0x5dfd('0x51')](_0x151b8['body']);}})[_0x5dfd('0x2f')](respondWithResult(_0x455a32,null))[_0x5dfd('0x4b')](handleError(_0x455a32,null));};exports['getMessages']=function(_0x275d1a,_0x5c60fb,_0xe2a169){var _0x3de52b={};var _0x4cae30={};var _0x304fa2;var _0x12e161;return db[_0x5dfd('0x36')][_0x5dfd('0x5a')]({'where':{'id':_0x275d1a[_0x5dfd('0x4d')]['id']}})[_0x5dfd('0x2f')](handleEntityNotFound(_0x5c60fb,null))[_0x5dfd('0x2f')](function(_0x28ebc3){if(_0x28ebc3){_0x304fa2=_0x28ebc3;_0x4cae30[_0x5dfd('0x3d')]=_[_0x5dfd('0x39')](db['ChatInternalMessage'][_0x5dfd('0x4e')]);_0x4cae30[_0x5dfd('0x3a')]=_['keys'](_0x275d1a[_0x5dfd('0x3a')]);_0x4cae30[_0x5dfd('0x3b')]=_['intersection'](_0x4cae30[_0x5dfd('0x3d')],_0x4cae30[_0x5dfd('0x3a')]);_0x3de52b[_0x5dfd('0x3e')]=_[_0x5dfd('0x3c')](_0x4cae30['model'],qs[_0x5dfd('0x3f')](_0x275d1a[_0x5dfd('0x3a')][_0x5dfd('0x3f')]));_0x3de52b[_0x5dfd('0x3e')]=_0x3de52b[_0x5dfd('0x3e')][_0x5dfd('0x5c')]?_0x3de52b['attributes']:_0x4cae30['model'];_0x3de52b['order']=qs[_0x5dfd('0x43')](_0x275d1a['query'][_0x5dfd('0x43')]);_0x3de52b[_0x5dfd('0x44')]=qs[_0x5dfd('0x3b')](_[_0x5dfd('0x5d')](_0x275d1a['query'],_0x4cae30[_0x5dfd('0x3b')]));if(_0x275d1a[_0x5dfd('0x3a')][_0x5dfd('0x45')]){_0x3de52b[_0x5dfd('0x44')]=_[_0x5dfd('0x46')](_0x3de52b[_0x5dfd('0x44')],{'$or':_['map'](_0x3de52b['attributes'],function(_0x322f64){var _0x1d058d={};_0x1d058d[_0x322f64]={'$like':'%'+_0x275d1a[_0x5dfd('0x3a')][_0x5dfd('0x45')]+'%'};return _0x1d058d;})});}if(_0x275d1a[_0x5dfd('0x3a')][_0x5dfd('0x62')]){var _0x38d440=_0x275d1a[_0x5dfd('0x3a')][_0x5dfd('0x62')][_0x5dfd('0x63')](',');var _0xe58f46={};_0xe58f46[_0x38d440[0x0]]={'$gte':moment(_0x38d440[0x1])[_0x5dfd('0x64')](_0x5dfd('0x65'))};_0x3de52b['where']=_[_0x5dfd('0x46')](_0x3de52b['where'],_0xe58f46);}_0x3de52b=_['merge']({},_0x3de52b,_0x275d1a['options']);return _0x304fa2[_0x5dfd('0x66')](_0x3de52b);}})['then'](function(_0x25c1ee){if(_0x25c1ee){_0x12e161=_0x25c1ee[_0x5dfd('0x5c')];if(!_0x275d1a['query']['hasOwnProperty'](_0x5dfd('0x41'))){_0x3de52b[_0x5dfd('0x26')]=qs[_0x5dfd('0x26')](_0x275d1a[_0x5dfd('0x3a')][_0x5dfd('0x26')]);_0x3de52b[_0x5dfd('0x23')]=qs[_0x5dfd('0x23')](_0x275d1a[_0x5dfd('0x3a')][_0x5dfd('0x23')]);}return _0x304fa2[_0x5dfd('0x66')](_0x3de52b);}})[_0x5dfd('0x2f')](function(_0x5d4f03){if(_0x5d4f03){return _0x5d4f03?{'count':_0x12e161,'rows':_0x5d4f03}:null;}})['then'](respondWithResult(_0x5c60fb,null))[_0x5dfd('0x4b')](handleError(_0x5c60fb,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 3a9c67e..381783e 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 _0x847f=['hook','exports','events','../../mysqldb','setMaxListeners','save','hasOwnProperty'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x847f,0xb8));var _0xf847=function(_0x27125a,_0x252d0d){_0x27125a=_0x27125a-0x0;var _0x391f7a=_0x847f[_0x27125a];return _0x391f7a;};'use strict';var EventEmitter=require(_0xf847('0x0'));var ChatGroup=require(_0xf847('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xf847('0x2')](0x0);var events={'afterCreate':_0xf847('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x50e00b){return function(_0x8d0a9c,_0x4fe7b9,_0x3299b1){ChatGroupEvents['emit'](_0x50e00b+':'+_0x8d0a9c['id'],_0x8d0a9c);ChatGroupEvents['emit'](_0x50e00b,_0x8d0a9c);_0x3299b1(null);};}for(var e in events){if(events[_0xf847('0x4')](e)){var event=events[e];ChatGroup[_0xf847('0x5')](e,emitEvent(event));}}module[_0xf847('0x6')]=ChatGroupEvents; \ No newline at end of file +var _0xa3f8=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x51af28,_0x3c5545){var _0x5437d2=function(_0x2531f9){while(--_0x2531f9){_0x51af28['push'](_0x51af28['shift']());}};_0x5437d2(++_0x3c5545);}(_0xa3f8,0x1f4));var _0x8a3f=function(_0x1be3b3,_0x4335ee){_0x1be3b3=_0x1be3b3-0x0;var _0x4f8b2d=_0xa3f8[_0x1be3b3];return _0x4f8b2d;};'use strict';var EventEmitter=require(_0x8a3f('0x0'));var ChatGroup=require(_0x8a3f('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x8a3f('0x2')](0x0);var events={'afterCreate':_0x8a3f('0x3'),'afterUpdate':_0x8a3f('0x4'),'afterDestroy':_0x8a3f('0x5')};function emitEvent(_0x5d9346){return function(_0x219980,_0xb49e92,_0x20cb2b){ChatGroupEvents[_0x8a3f('0x6')](_0x5d9346+':'+_0x219980['id'],_0x219980);ChatGroupEvents[_0x8a3f('0x6')](_0x5d9346,_0x219980);_0x20cb2b(null);};}for(var e in events){if(events[_0x8a3f('0x7')](e)){var event=events[e];ChatGroup[_0x8a3f('0x8')](e,emitEvent(event));}}module[_0x8a3f('0x9')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index f3be36f..7904b60 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 _0xff47=['bluebird','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','../../config/logger','moment'];(function(_0x415e37,_0x35dff9){var _0x29153d=function(_0x1e3af2){while(--_0x1e3af2){_0x415e37['push'](_0x415e37['shift']());}};_0x29153d(++_0x35dff9);}(_0xff47,0x13d));var _0x7ff4=function(_0x1dc2b4,_0x573a04){_0x1dc2b4=_0x1dc2b4-0x0;var _0x18af92=_0xff47[_0x1dc2b4];return _0x18af92;};'use strict';var _=require(_0x7ff4('0x0'));var util=require('util');var logger=require(_0x7ff4('0x1'))('api');var moment=require(_0x7ff4('0x2'));var BPromise=require(_0x7ff4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7ff4('0x4'));var attributes=require(_0x7ff4('0x5'));module[_0x7ff4('0x6')]=function(_0x3f4fe2,_0x5b6c4e){return _0x3f4fe2[_0x7ff4('0x7')](_0x7ff4('0x8'),attributes,{'tableName':_0x7ff4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbcc9=['../../config/environment','exports','define','chat_groups','util','bluebird','path','rimraf'];(function(_0x4c3851,_0xbebbfd){var _0x43a1e2=function(_0x271b9f){while(--_0x271b9f){_0x4c3851['push'](_0x4c3851['shift']());}};_0x43a1e2(++_0xbebbfd);}(_0xbcc9,0x13c));var _0x9bcc=function(_0x3d0c89,_0x39a2fa){_0x3d0c89=_0x3d0c89-0x0;var _0xd17883=_0xbcc9[_0x3d0c89];return _0xd17883;};'use strict';var _=require('lodash');var util=require(_0x9bcc('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x9bcc('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9bcc('0x2'));var rimraf=require(_0x9bcc('0x3'));var config=require(_0x9bcc('0x4'));var attributes=require('./chatGroup.attributes');module[_0x9bcc('0x5')]=function(_0x16110c,_0x594ab1){return _0x16110c[_0x9bcc('0x6')]('ChatGroup',attributes,{'tableName':_0x9bcc('0x7'),'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 8cffe65..8b6a10a 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 _0xcd3a=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','./chatGroup.socket','register','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x32eb18,_0x332131){var _0x5d9f6c=function(_0x56cd9b){while(--_0x56cd9b){_0x32eb18['push'](_0x32eb18['shift']());}};_0x5d9f6c(++_0x332131);}(_0xcd3a,0xcf));var _0xacd3=function(_0x14253d,_0x5e5b44){_0x14253d=_0x14253d-0x0;var _0x1ab618=_0xcd3a[_0x14253d];return _0x1ab618;};'use strict';var _=require(_0xacd3('0x0'));var util=require(_0xacd3('0x1'));var moment=require(_0xacd3('0x2'));var BPromise=require(_0xacd3('0x3'));var rs=require(_0xacd3('0x4'));var fs=require('fs');var Redis=require(_0xacd3('0x5'));var db=require(_0xacd3('0x6'))['db'];var utils=require(_0xacd3('0x7'));var logger=require('../../config/logger')(_0xacd3('0x8'));var config=require(_0xacd3('0x9'));var jayson=require(_0xacd3('0xa'));var client=jayson[_0xacd3('0xb')]['http']({'port':0x232a});config['redis']=_[_0xacd3('0xc')](config[_0xacd3('0xd')],{'host':_0xacd3('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xacd3('0xd')]));require(_0xacd3('0xf'))[_0xacd3('0x10')](socket);function respondWithRpcPromise(_0x2b5702,_0x5c0e56,_0x106fee){return new BPromise(function(_0x5c85b5,_0x29d379){return client[_0xacd3('0x11')](_0x2b5702,_0x106fee)[_0xacd3('0x12')](function(_0x198184){logger['info'](_0xacd3('0x13'),_0x5c0e56,_0xacd3('0x14'));logger[_0xacd3('0x15')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x5c0e56,'request\x20sent',JSON[_0xacd3('0x16')](_0x198184));if(_0x198184[_0xacd3('0x17')]){if(_0x198184['error'][_0xacd3('0x18')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x5c0e56,_0x198184[_0xacd3('0x17')][_0xacd3('0x19')]);return _0x29d379(_0x198184['error'][_0xacd3('0x19')]);}logger[_0xacd3('0x17')](_0xacd3('0x13'),_0x5c0e56,_0x198184['error'][_0xacd3('0x19')]);return _0x5c85b5(_0x198184[_0xacd3('0x17')]['message']);}else{logger[_0xacd3('0x1a')](_0xacd3('0x13'),_0x5c0e56,_0xacd3('0x14'));_0x5c85b5(_0x198184[_0xacd3('0x1b')][_0xacd3('0x19')]);}})[_0xacd3('0x1c')](function(_0x477b60){logger[_0xacd3('0x17')]('ChatGroup,\x20%s,\x20%s',_0x5c0e56,_0x477b60);_0x29d379(_0x477b60);});});} \ No newline at end of file +var _0xe94a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xe94a,0x1c7));var _0xae94=function(_0x3186aa,_0x34c21e){_0x3186aa=_0x3186aa-0x0;var _0x2d8c36=_0xe94a[_0x3186aa];return _0x2d8c36;};'use strict';var _=require(_0xae94('0x0'));var util=require(_0xae94('0x1'));var moment=require(_0xae94('0x2'));var BPromise=require('bluebird');var rs=require(_0xae94('0x3'));var fs=require('fs');var Redis=require(_0xae94('0x4'));var db=require(_0xae94('0x5'))['db'];var utils=require(_0xae94('0x6'));var logger=require(_0xae94('0x7'))(_0xae94('0x8'));var config=require('../../config/environment');var jayson=require(_0xae94('0x9'));var client=jayson[_0xae94('0xa')][_0xae94('0xb')]({'port':0x232a});config[_0xae94('0xc')]=_[_0xae94('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xae94('0xe'))(new Redis(config[_0xae94('0xc')]));require('./chatGroup.socket')[_0xae94('0xf')](socket);function respondWithRpcPromise(_0x35cd04,_0x3a5a57,_0x2fa556){return new BPromise(function(_0x1cb23d,_0x3fdafe){return client[_0xae94('0x10')](_0x35cd04,_0x2fa556)[_0xae94('0x11')](function(_0x4cb724){logger['info'](_0xae94('0x12'),_0x3a5a57,_0xae94('0x13'));logger['debug'](_0xae94('0x14'),_0x3a5a57,'request\x20sent',JSON[_0xae94('0x15')](_0x4cb724));if(_0x4cb724[_0xae94('0x16')]){if(_0x4cb724[_0xae94('0x16')][_0xae94('0x17')]===0x1f4){logger[_0xae94('0x16')]('ChatGroup,\x20%s,\x20%s',_0x3a5a57,_0x4cb724[_0xae94('0x16')][_0xae94('0x18')]);return _0x3fdafe(_0x4cb724[_0xae94('0x16')]['message']);}logger[_0xae94('0x16')]('ChatGroup,\x20%s,\x20%s',_0x3a5a57,_0x4cb724[_0xae94('0x16')]['message']);return _0x1cb23d(_0x4cb724[_0xae94('0x16')][_0xae94('0x18')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x3a5a57,_0xae94('0x13'));_0x1cb23d(_0x4cb724[_0xae94('0x19')][_0xae94('0x18')]);}})[_0xae94('0x1a')](function(_0x5d4379){logger[_0xae94('0x16')](_0xae94('0x12'),_0x3a5a57,_0x5d4379);_0x3fdafe(_0x5d4379);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 94a5a1d..f78d7e9 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 _0xb96d=['remove','update','emit','removeListener','register','length','./chatGroup.events','save'];(function(_0x529fd0,_0x17a79b){var _0x11ad54=function(_0x22964e){while(--_0x22964e){_0x529fd0['push'](_0x529fd0['shift']());}};_0x11ad54(++_0x17a79b);}(_0xb96d,0x1d6));var _0xdb96=function(_0x29d6e6,_0x264220){_0x29d6e6=_0x29d6e6-0x0;var _0xc75ff0=_0xb96d[_0x29d6e6];return _0xc75ff0;};'use strict';var ChatGroupEvents=require(_0xdb96('0x0'));var events=[_0xdb96('0x1'),_0xdb96('0x2'),_0xdb96('0x3')];function createListener(_0x51338c,_0x1d3fce){return function(_0x36192b){_0x1d3fce[_0xdb96('0x4')](_0x51338c,_0x36192b);};}function removeListener(_0x360852,_0x337129){return function(){ChatGroupEvents[_0xdb96('0x5')](_0x360852,_0x337129);};}exports[_0xdb96('0x6')]=function(_0x49279f){for(var _0x318232=0x0,_0x11722b=events[_0xdb96('0x7')];_0x318232<_0x11722b;_0x318232++){var _0xc8df95=events[_0x318232];var _0x429e3a=createListener('chatGroup:'+_0xc8df95,_0x49279f);ChatGroupEvents['on'](_0xc8df95,_0x429e3a);}}; \ No newline at end of file +var _0x1512=['emit','removeListener','length','chatGroup:','./chatGroup.events','save','remove','update'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0x1512,0x184));var _0x2151=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1512[_0x20a584];return _0x4b41a8;};'use strict';var ChatGroupEvents=require(_0x2151('0x0'));var events=[_0x2151('0x1'),_0x2151('0x2'),_0x2151('0x3')];function createListener(_0x1beae2,_0x1e4dae){return function(_0x593cce){_0x1e4dae[_0x2151('0x4')](_0x1beae2,_0x593cce);};}function removeListener(_0x37a729,_0x21fbd0){return function(){ChatGroupEvents[_0x2151('0x5')](_0x37a729,_0x21fbd0);};}exports['register']=function(_0x377b32){for(var _0x289826=0x0,_0x535a16=events[_0x2151('0x6')];_0x289826<_0x535a16;_0x289826++){var _0x2f093e=events[_0x289826];var _0x1aa98a=createListener(_0x2151('0x7')+_0x2f093e,_0x377b32);ChatGroupEvents['on'](_0x2f093e,_0x1aa98a);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 9813a78..339db54 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 _0xe292=['index','/describe','/:id','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','addMembers','addMessage','delete','destroy','removeMembers','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated'];(function(_0x5a435c,_0x455012){var _0x31a14f=function(_0xa6ffcd){while(--_0xa6ffcd){_0x5a435c['push'](_0x5a435c['shift']());}};_0x31a14f(++_0x455012);}(_0xe292,0x144));var _0x2e29=function(_0x1580fe,_0x17a64c){_0x1580fe=_0x1580fe-0x0;var _0x510c7b=_0xe292[_0x1580fe];return _0x510c7b;};'use strict';var multer=require(_0x2e29('0x0'));var util=require('util');var path=require(_0x2e29('0x1'));var timeout=require(_0x2e29('0x2'));var express=require(_0x2e29('0x3'));var router=express[_0x2e29('0x4')]();var fs_extra=require(_0x2e29('0x5'));var auth=require(_0x2e29('0x6'));var interaction=require(_0x2e29('0x7'));var config=require(_0x2e29('0x8'));var controller=require(_0x2e29('0x9'));router[_0x2e29('0xa')]('/',auth[_0x2e29('0xb')](),controller[_0x2e29('0xc')]);router[_0x2e29('0xa')](_0x2e29('0xd'),auth[_0x2e29('0xb')](),controller['describe']);router[_0x2e29('0xa')](_0x2e29('0xe'),auth['isAuthenticated'](),controller['show']);router['get'](_0x2e29('0xf'),auth['isAuthenticated'](),controller[_0x2e29('0x10')]);router['get'](_0x2e29('0x11'),auth[_0x2e29('0xb')](),controller[_0x2e29('0x12')]);router[_0x2e29('0xa')](_0x2e29('0x13'),auth[_0x2e29('0xb')](),controller[_0x2e29('0x14')]);router[_0x2e29('0x15')]('/',auth[_0x2e29('0xb')](),controller['create']);router['post'](_0x2e29('0x11'),auth['isAuthenticated'](),controller[_0x2e29('0x16')]);router[_0x2e29('0x15')](_0x2e29('0x13'),auth[_0x2e29('0xb')](),controller[_0x2e29('0x17')]);router['put'](_0x2e29('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x2e29('0x18')](_0x2e29('0xe'),auth[_0x2e29('0xb')](),controller[_0x2e29('0x19')]);router['delete'](_0x2e29('0x11'),auth['isAuthenticated'](),controller[_0x2e29('0x1a')]);module[_0x2e29('0x1b')]=router; \ No newline at end of file +var _0xeaa8=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','get','describe','/:id','show','getUnread','/:id/members','getMessages','post','create','addMembers','put','update','delete','destroy','exports','util','path'];(function(_0x44359e,_0x5f4b28){var _0x114834=function(_0x434939){while(--_0x434939){_0x44359e['push'](_0x44359e['shift']());}};_0x114834(++_0x5f4b28);}(_0xeaa8,0xc6));var _0x8eaa=function(_0x191649,_0x1d5896){_0x191649=_0x191649-0x0;var _0x330388=_0xeaa8[_0x191649];return _0x330388;};'use strict';var multer=require('multer');var util=require(_0x8eaa('0x0'));var path=require(_0x8eaa('0x1'));var timeout=require('connect-timeout');var express=require(_0x8eaa('0x2'));var router=express['Router']();var fs_extra=require(_0x8eaa('0x3'));var auth=require(_0x8eaa('0x4'));var interaction=require(_0x8eaa('0x5'));var config=require(_0x8eaa('0x6'));var controller=require(_0x8eaa('0x7'));router['get']('/',auth[_0x8eaa('0x8')](),controller[_0x8eaa('0x9')]);router[_0x8eaa('0xa')]('/describe',auth[_0x8eaa('0x8')](),controller[_0x8eaa('0xb')]);router['get'](_0x8eaa('0xc'),auth['isAuthenticated'](),controller[_0x8eaa('0xd')]);router[_0x8eaa('0xa')]('/:id/unread',auth[_0x8eaa('0x8')](),controller[_0x8eaa('0xe')]);router[_0x8eaa('0xa')](_0x8eaa('0xf'),auth[_0x8eaa('0x8')](),controller['getMembers']);router[_0x8eaa('0xa')]('/:id/messages',auth[_0x8eaa('0x8')](),controller[_0x8eaa('0x10')]);router[_0x8eaa('0x11')]('/',auth[_0x8eaa('0x8')](),controller[_0x8eaa('0x12')]);router[_0x8eaa('0x11')](_0x8eaa('0xf'),auth[_0x8eaa('0x8')](),controller[_0x8eaa('0x13')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0x8eaa('0x14')](_0x8eaa('0xc'),auth[_0x8eaa('0x8')](),controller[_0x8eaa('0x15')]);router[_0x8eaa('0x16')](_0x8eaa('0xc'),auth[_0x8eaa('0x8')](),controller[_0x8eaa('0x17')]);router[_0x8eaa('0x16')](_0x8eaa('0xf'),auth[_0x8eaa('0x8')](),controller['removeMembers']);module[_0x8eaa('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 2e9bf4d..c2b4a15 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 _0xdb94=['long','DATE','out','sequelize','exports','BOOLEAN','INTEGER','ENUM','thumb','star','STRING','TEXT'];(function(_0x8f2c7a,_0x2fb180){var _0x212e6d=function(_0x2f20b0){while(--_0x2f20b0){_0x8f2c7a['push'](_0x8f2c7a['shift']());}};_0x212e6d(++_0x2fb180);}(_0xdb94,0xab));var _0x4db9=function(_0x105a64,_0x53ab60){_0x105a64=_0x105a64-0x0;var _0x32b896=_0xdb94[_0x105a64];return _0x32b896;};'use strict';var Sequelize=require(_0x4db9('0x0'));module[_0x4db9('0x1')]={'closed':{'type':Sequelize[_0x4db9('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x4db9('0x3')]},'ratingType':{'type':Sequelize[_0x4db9('0x4')]('star',_0x4db9('0x5')),'defaultValue':_0x4db9('0x6')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x4db9('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x4db9('0x7')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x4db9('0x7')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x4db9('0x7')]},'osName':{'type':Sequelize[_0x4db9('0x7')]},'osVersion':{'type':Sequelize[_0x4db9('0x7')]},'deviceModel':{'type':Sequelize[_0x4db9('0x7')]},'deviceVendor':{'type':Sequelize[_0x4db9('0x7')]},'deviceType':{'type':Sequelize[_0x4db9('0x7')]},'referer':{'type':Sequelize[_0x4db9('0x8')]},'customerIp':{'type':Sequelize[_0x4db9('0x7')]},'formData':{'type':Sequelize[_0x4db9('0x8')](_0x4db9('0x9'))},'read1stAt':{'type':Sequelize[_0x4db9('0xa')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x4db9('0x4')]('in',_0x4db9('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x4db9('0x8')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xe5fb=['ENUM','star','TEXT','STRING','DATE','long','out','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x1a9f6f,_0x4f2bc9){var _0x1e6f1d=function(_0x5339ce){while(--_0x5339ce){_0x1a9f6f['push'](_0x1a9f6f['shift']());}};_0x1e6f1d(++_0x4f2bc9);}(_0xe5fb,0xce));var _0xbe5f=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0xe5fb[_0x397cfb];return _0x15fed9;};'use strict';var Sequelize=require(_0xbe5f('0x0'));module[_0xbe5f('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xbe5f('0x2')]},'ratingType':{'type':Sequelize[_0xbe5f('0x3')](_0xbe5f('0x4'),'thumb'),'defaultValue':_0xbe5f('0x4')},'ratingMessage':{'type':Sequelize[_0xbe5f('0x5')]},'pathTranscript':{'type':Sequelize[_0xbe5f('0x5')]},'mailTranscript':{'type':Sequelize[_0xbe5f('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xbe5f('0x7')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xbe5f('0x6')]},'thirdDisposition':{'type':Sequelize[_0xbe5f('0x6')]},'note':{'type':Sequelize[_0xbe5f('0x6')]},'browserName':{'type':Sequelize[_0xbe5f('0x6')]},'browserVersion':{'type':Sequelize[_0xbe5f('0x6')]},'osName':{'type':Sequelize[_0xbe5f('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xbe5f('0x6')]},'deviceVendor':{'type':Sequelize[_0xbe5f('0x6')]},'deviceType':{'type':Sequelize[_0xbe5f('0x6')]},'referer':{'type':Sequelize[_0xbe5f('0x5')]},'customerIp':{'type':Sequelize[_0xbe5f('0x6')]},'formData':{'type':Sequelize[_0xbe5f('0x5')](_0xbe5f('0x8'))},'read1stAt':{'type':Sequelize[_0xbe5f('0x7')]},'lastMsgAt':{'type':Sequelize[_0xbe5f('0x7')]},'lastMsgDirection':{'type':Sequelize[_0xbe5f('0x3')]('in',_0xbe5f('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xbe5f('0x6')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xbe5f('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0xbe5f('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 5aaf625..459581e 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 _0xb10b=['querystring','papaparse','ioredis','../../components/auth/service','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','update','stack','name','send','body','contact','interaction','account','Users','map','fullname','TagIds','Tags','forEach','push','index','ChatInteraction','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','buildExpression','some','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','isEmpty','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','catch','show','params','keys','includeAll','include','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooNote','email','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','isNull','follow','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','file','filename','mimetype','attachmentDownload','closed','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','basename','close','mailTranscript','root','now','Messages','format','%s%d','System','customer','Visitor','agentIdentifier','website_alias','agentAlias','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','ids','omit','getMessages','split','YYYY-MM-DD\x20HH:mm:ss','includeAgent','alias','findAll','setTags','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','disposition','osName','referer','customerPort','tail','existsSync','pipe','createWriteStream','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x2f4d7f,_0x62f4b7){var _0x147ba1=function(_0x14ef36){while(--_0x14ef36){_0x2f4d7f['push'](_0x2f4d7f['shift']());}};_0x147ba1(++_0x62f4b7);}(_0xb10b,0x12a));var _0xbb10=function(_0x541a67,_0x50728d){_0x541a67=_0x541a67-0x0;var _0x45da2a=_0xb10b[_0x541a67];return _0x45da2a;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xbb10('0x13'));var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))('api');var utils=require(_0xbb10('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb10('0x17'));var db=require(_0xbb10('0x18'))['db'];config[_0xbb10('0x19')]=_[_0xbb10('0x1a')](config[_0xbb10('0x19')],{'host':_0xbb10('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbb10('0x19')]));require(_0xbb10('0x1c'))[_0xbb10('0x1d')](socket);var jayson=require(_0xbb10('0x1e'));var client=jayson[_0xbb10('0x1f')][_0xbb10('0x20')]({'port':0x232b});var client9004=jayson[_0xbb10('0x1f')][_0xbb10('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x3e26f4,_0x2b184e,_0x4a2bfc,_0x2eca0f){return new BPromise(function(_0x1145f1,_0x133ac2){var _0x42db98=_0x2eca0f||client;return _0x42db98[_0xbb10('0x21')](_0x3e26f4,_0x4a2bfc)[_0xbb10('0x22')](function(_0x575cca){logger[_0xbb10('0x23')](_0xbb10('0x24'),_0x2b184e,_0xbb10('0x25'));logger['debug'](_0xbb10('0x26'),_0x2b184e,_0xbb10('0x25'),JSON[_0xbb10('0x27')](_0x575cca));if(_0x575cca[_0xbb10('0x28')]){if(_0x575cca[_0xbb10('0x28')][_0xbb10('0x29')]===0x1f4){logger['error'](_0xbb10('0x24'),_0x2b184e,_0x575cca[_0xbb10('0x28')]['message']);return _0x133ac2(_0x575cca['error'][_0xbb10('0x2a')]);}logger[_0xbb10('0x28')](_0xbb10('0x24'),_0x2b184e,_0x575cca[_0xbb10('0x28')][_0xbb10('0x2a')]);return _0x1145f1(_0x575cca[_0xbb10('0x28')][_0xbb10('0x2a')]);}else{logger[_0xbb10('0x23')](_0xbb10('0x24'),_0x2b184e,_0xbb10('0x25'));_0x1145f1(_0x575cca[_0xbb10('0x2b')][_0xbb10('0x2a')]);}})['catch'](function(_0x4fedac){logger['error'](_0xbb10('0x24'),_0x2b184e,_0x4fedac);_0x133ac2(_0x4fedac);});});}function respondWithStatusCode(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0xcc;return function(_0x4e25ff){if(_0x4e25ff){return _0x3c5ae7[_0xbb10('0x2c')](_0x2c89b9);}return _0x3c5ae7[_0xbb10('0x2d')](_0x2c89b9)[_0xbb10('0x2e')]();};}function respondWithResult(_0x1d5e95,_0x1acce9){_0x1acce9=_0x1acce9||0xc8;return function(_0x20d946){if(_0x20d946){return _0x1d5e95[_0xbb10('0x2d')](_0x1acce9)['json'](_0x20d946);}};}function respondWithFilteredResult(_0x3796c7,_0x21ac54){return function(_0xfc3595){if(_0xfc3595){var _0x2e0249=typeof _0x21ac54[_0xbb10('0x2f')]===_0xbb10('0x30')&&typeof _0x21ac54['limit']===_0xbb10('0x30');var _0x4ee02e=_0xfc3595[_0xbb10('0x31')];var _0x56f2da=_0x2e0249?0x0:_0x21ac54[_0xbb10('0x2f')];var _0x1dcc9c=_0x2e0249?_0xfc3595[_0xbb10('0x31')]:_0x21ac54['offset']+_0x21ac54['limit'];var _0x4c3744;if(_0x1dcc9c>=_0x4ee02e){_0x1dcc9c=_0x4ee02e;_0x4c3744=0xc8;}else{_0x4c3744=0xce;}_0x3796c7[_0xbb10('0x2d')](_0x4c3744);return _0x3796c7['set'](_0xbb10('0x32'),_0x56f2da+'-'+_0x1dcc9c+'/'+_0x4ee02e)[_0xbb10('0x33')](_0xfc3595);}return null;};}function patchUpdates(_0x2f653f){return function(_0x1c0b57){try{jsonpatch[_0xbb10('0x34')](_0x1c0b57,_0x2f653f,!![]);}catch(_0x138bc6){return BPromise[_0xbb10('0x35')](_0x138bc6);}return _0x1c0b57['save']();};}function saveUpdates(_0x25acb3,_0x1da9c9){return function(_0x441d15){if(_0x441d15){return _0x441d15[_0xbb10('0x36')](_0x25acb3)[_0xbb10('0x22')](function(_0x9de708){return _0x9de708;});}return null;};}function removeEntity(_0x188cbd,_0x10202c){return function(_0x3c8d7d){if(_0x3c8d7d){return _0x3c8d7d['destroy']()[_0xbb10('0x22')](function(){_0x188cbd[_0xbb10('0x2d')](0xcc)[_0xbb10('0x2e')]();});}};}function handleEntityNotFound(_0x3c3c45,_0x570f5a){return function(_0x111762){if(!_0x111762){_0x3c3c45['sendStatus'](0x194);}return _0x111762;};}function handleError(_0x4e2754,_0x3eb3cc){_0x3eb3cc=_0x3eb3cc||0x1f4;return function(_0x40c164){logger[_0xbb10('0x28')](_0x40c164[_0xbb10('0x37')]);if(_0x40c164[_0xbb10('0x38')]){delete _0x40c164[_0xbb10('0x38')];}_0x4e2754['status'](_0x3eb3cc)[_0xbb10('0x39')](_0x40c164);};}function getMustacheRender(_0x25d72f,_0x52de31){return Mustache['render'](_0x25d72f,_['merge'](_0x52de31[_0xbb10('0x3a')],{'contact':_0x52de31[_0xbb10('0x3b')],'message':_0x52de31[_0xbb10('0x2a')],'agent':_0x52de31['agent'],'interaction':_0x52de31[_0xbb10('0x3c')],'account':_0x52de31[_0xbb10('0x3d')]}))||'';}function getInteractionUsers(_0x4345f3,_0x4d1a83){return new BPromise(function(_0x17b6c5,_0x12238a){try{if(_0x4d1a83[_0x4345f3['id']]){_0x4345f3[_0xbb10('0x3e')]=_[_0xbb10('0x3f')](_0x4d1a83[_0x4345f3['id']],function(_0x4f1cdd){return{'id':_0x4f1cdd['id'],'fullname':_0x4f1cdd[_0xbb10('0x40')]};});}}catch(_0x110eb5){_0x12238a(_0x110eb5);}_0x17b6c5(_0x4345f3);});}function getInteractionTags(_0x5835fd,_0xe2040f){return new BPromise(function(_0x2e3214,_0x44d6ae){try{if(_0x5835fd[_0xbb10('0x41')]){_0x5835fd[_0xbb10('0x42')]=[];_0x5835fd[_0xbb10('0x41')]['split'](',')[_0xbb10('0x43')](function(_0x1c7fae){_0x5835fd[_0xbb10('0x42')][_0xbb10('0x44')](_0xe2040f[_0x1c7fae]);});}delete _0x5835fd['TagIds'];}catch(_0x3fff6c){_0x44d6ae(_0x3fff6c);}_0x2e3214(_0x5835fd);});}function updateChatInteraction(_0x331751,_0x23dc18,_0x403beb){return new BPromise(function(_0x5e2cfa,_0x351484){return getInteractionUsers(_0x331751,_0x403beb)[_0xbb10('0x22')](function(_0x54ac18){return getInteractionTags(_0x54ac18,_0x23dc18);})['then'](function(_0x38d78f){_0x5e2cfa(_0x38d78f);})['catch'](function(_0x318984){_0x351484(_0x318984);});});}exports[_0xbb10('0x45')]=function(_0x4c66d8,_0x366608){var _0x1d82bf={},_0x474e99={},_0x5cf4f8={'count':0x0,'rows':[]};var _0x2dd02b=_[_0xbb10('0x3f')](db[_0xbb10('0x46')][_0xbb10('0x47')],function(_0x36e1fa){return{'name':_0x36e1fa[_0xbb10('0x48')],'type':_0x36e1fa[_0xbb10('0x49')][_0xbb10('0x4a')]};});_0x474e99[_0xbb10('0x4b')]=_[_0xbb10('0x3f')](_0x2dd02b,_0xbb10('0x38'));_0x474e99[_0xbb10('0x4c')]=_['keys'](_0x4c66d8[_0xbb10('0x4c')]);_0x474e99[_0xbb10('0x4d')]=_['intersection'](_0x474e99[_0xbb10('0x4b')],_0x474e99[_0xbb10('0x4c')]);_0x1d82bf[_0xbb10('0x4e')]=_[_0xbb10('0x4f')](_0x474e99[_0xbb10('0x4b')],qs[_0xbb10('0x50')](_0x4c66d8[_0xbb10('0x4c')]['fields']));_0x1d82bf['attributes']=_0x1d82bf[_0xbb10('0x4e')][_0xbb10('0x51')]?_0x1d82bf[_0xbb10('0x4e')]:_0x474e99['model'];if(!_0x4c66d8['query'][_0xbb10('0x52')](_0xbb10('0x53'))){_0x1d82bf[_0xbb10('0x54')]=qs[_0xbb10('0x54')](_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x54')]);_0x1d82bf[_0xbb10('0x2f')]=qs[_0xbb10('0x2f')](_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x2f')]);}_0x1d82bf['order']=qs['sort'](_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x55')]);_0x1d82bf[_0xbb10('0x56')]=qs[_0xbb10('0x4d')](_[_0xbb10('0x57')](_0x4c66d8[_0xbb10('0x4c')],_0x474e99[_0xbb10('0x4d')]),_0x2dd02b);var _0x445870=[];var _0x1c0d8f=squel[_0xbb10('0x58')]()[_0xbb10('0x59')]('id')[_0xbb10('0x59')](_0xbb10('0x38'))[_0xbb10('0x59')](_0xbb10('0x5a'))['from'](_0xbb10('0x5b'));var _0x5bd44d=squel[_0xbb10('0x58')]()[_0xbb10('0x59')](_0xbb10('0x5c'))[_0xbb10('0x59')](_0xbb10('0x5d'))[_0xbb10('0x59')](_0xbb10('0x5e'))[_0xbb10('0x5f')](_0xbb10('0x60'),'ui')[_0xbb10('0x61')](_0xbb10('0x62'),'u',_0xbb10('0x63'));var _0x1d49e1=squel[_0xbb10('0x58')]()[_0xbb10('0x5f')]('chat_interactions','i')[_0xbb10('0x61')](_0xbb10('0x64'),'c',_0xbb10('0x65'))[_0xbb10('0x61')](_0xbb10('0x62'),'o',_0xbb10('0x66'))['left_join'](_0xbb10('0x67'),'a',_0xbb10('0x68'))[_0xbb10('0x61')](_0xbb10('0x69'),'me',_0xbb10('0x6a'))[_0xbb10('0x61')](_0xbb10('0x6b'),'it',_0xbb10('0x6c'))[_0xbb10('0x61')](_0xbb10('0x5b'),'t',_0xbb10('0x6d'));var _0x2a1ce1=squel[_0xbb10('0x6e')]();var _0x4e7fac=[];var _0x4ea1a6=squel[_0xbb10('0x6e')]();var _0x3e6338;if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x6f')]){_0x3e6338=as['parseSearch'](_0x4c66d8['query'][_0xbb10('0x6f')]);var _0xaf2cc3=_0x3e6338[_0xbb10('0x70')];for(var _0x2dd150=0x0;_0x2dd150<_0x3e6338[_0xbb10('0x71')][_0xbb10('0x51')];_0x2dd150++){var _0x45c0dc=_0x3e6338['conditions'][_0x2dd150];var _0x117e84='i';var _0x216cff=_['find'](_0x2dd02b,['name',_0x45c0dc['field']]);if(!_0x216cff){switch(_0x45c0dc[_0xbb10('0x59')]){case _0xbb10('0x72'):if(_0x45c0dc[_0xbb10('0x73')]==0x1){_0x1d49e1['having']('`'+_0x45c0dc['field']+'`\x20=\x200');}else{_0x1d49e1[_0xbb10('0x74')]('`'+_0x45c0dc[_0xbb10('0x59')]+_0xbb10('0x75'));}break;case'Contact':if(_0x45c0dc[_0xbb10('0x76')]===_0xbb10('0x77')){if(_0x45c0dc['value']['split']('\x20')[_0xbb10('0x51')]>0x1){_0x2a1ce1[_0xaf2cc3](_0xbb10('0x78'),qs[_0xbb10('0x79')](_0x45c0dc[_0xbb10('0x73')]),null);}else{var _0x54b7c5='%'+_0x45c0dc[_0xbb10('0x73')]+'%';_0x2a1ce1[_0xaf2cc3](_0xbb10('0x7a'),_0x54b7c5,_0x54b7c5,_0x54b7c5);}}else{_0x216cff=_[_0xbb10('0x7b')](_0x2dd02b,['name',_0xbb10('0x7c')]);_0x45c0dc[_0xbb10('0x59')]=_0xbb10('0x7c');_0x329da7=as['buildExpression'](_0x117e84,_0x216cff[_0xbb10('0x49')],_0x45c0dc);_0x2a1ce1[_0xaf2cc3](_0x329da7[_0xbb10('0x7d')],_0x329da7[_0xbb10('0x73')][_0xbb10('0x7e')],_0x329da7['value'][_0xbb10('0x2e')]);}break;case _0xbb10('0x7f'):var _0x108e5b=_0x45c0dc[_0xbb10('0x73')]['split'](',')[_0xbb10('0x3f')](function(_0x277fe7){return Number(_0x277fe7);});_0x108e5b[_0xbb10('0x43')](function(_0x2ceb3e){_0x4ea1a6['or'](_0xbb10('0x80'),'%,'+_0x2ceb3e+',%');});_0x4e7fac=_[_0xbb10('0x81')](_0x4e7fac,_0x108e5b);break;case _0xbb10('0x82'):if(_0x45c0dc['operator']==='$substring'){_0x2a1ce1[_0xaf2cc3]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x45c0dc[_0xbb10('0x73')]+'%',null);}else{_0x216cff=_[_0xbb10('0x7b')](_0x2dd02b,[_0xbb10('0x38'),'UserId']);_0x45c0dc['field']=_0xbb10('0x83');_0x329da7=as[_0xbb10('0x84')](_0x117e84,_0x216cff[_0xbb10('0x49')],_0x45c0dc);_0x2a1ce1[_0xaf2cc3](_0x329da7[_0xbb10('0x7d')],_0x329da7[_0xbb10('0x73')][_0xbb10('0x7e')],_0x329da7['value'][_0xbb10('0x2e')]);}break;case _0xbb10('0x3a'):_0x329da7=as[_0xbb10('0x84')]('me',null,_0x45c0dc);_0x2a1ce1[_0xaf2cc3](_0x329da7[_0xbb10('0x7d')],_0x329da7[_0xbb10('0x73')]['start'],_0x329da7['value']['end']);break;}}else{var _0x329da7=as[_0xbb10('0x84')](_0x117e84,_0x216cff[_0xbb10('0x49')],_0x45c0dc);_0x2a1ce1[_0xaf2cc3](_0x329da7[_0xbb10('0x7d')],_0x329da7[_0xbb10('0x73')][_0xbb10('0x7e')],_0x329da7['value'][_0xbb10('0x2e')]);}}}else{var _0x4bc316=_(_0x4c66d8['query'])['keys']()[_0xbb10('0x3f')](function(_0x13040d){return _[_0xbb10('0x85')](_0x2dd02b,[_0xbb10('0x38'),_0x13040d])?_0x13040d:undefined;})['compact']()[_0xbb10('0x73')]();if(!_['isEmpty'](_0x4bc316)){_0x4bc316['forEach'](function(_0x165fe9){if(_0x165fe9===_0xbb10('0x86')){_0x1d49e1[_0xbb10('0x56')](_0xbb10('0x87'),[][_0xbb10('0x88')](_0x4c66d8['query'][_0x165fe9]));}else if(_0x165fe9===_0xbb10('0x89')){var _0x19fcec=JSON[_0xbb10('0x8a')](_0x4c66d8[_0xbb10('0x4c')][_0x165fe9])[_0xbb10('0x8b')];var _0x27f42f=JSON[_0xbb10('0x8a')](_0x4c66d8['query'][_0x165fe9])[_0xbb10('0x8c')];_0x1d49e1[_0xbb10('0x56')](_0xbb10('0x8d'),_0x19fcec,_0x27f42f);}else{if(_0x4c66d8[_0xbb10('0x4c')][_0x165fe9]===_0xbb10('0x8e')){_0x1d49e1[_0xbb10('0x56')]('i.'+_0x165fe9+_0xbb10('0x8f'));}else{_0x1d49e1[_0xbb10('0x56')]('i.'+_0x165fe9+'\x20=\x20?',_0x4c66d8[_0xbb10('0x4c')][_0x165fe9]);}}});}if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x90')]){if(_0x4c66d8['query']['read']==0x1){_0x1d49e1['having'](_0xbb10('0x91'));}else{_0x1d49e1['having']('`unreadMessages`\x20>\x200');}}if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x92')]){_0x4e7fac=_[_0xbb10('0x93')](_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x92')])?_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x92')]:new Array(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x92')]);_0x4e7fac['forEach'](function(_0x318a14){_0x4ea1a6['or'](_0xbb10('0x80'),'%,'+_0x318a14+',%');});}if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x94')]){var _0x5c8eb8=_0x4c66d8['query'][_0xbb10('0x94')][_0xbb10('0x95')]('\x5c','\x5c\x5c')[_0xbb10('0x95')](/'/g,'\x27\x27');if(qs[_0xbb10('0x96')](_0x5c8eb8)){_0x2a1ce1['or']('i.id\x20LIKE\x20?',_0x5c8eb8+'%');}else{_0x2a1ce1['or'](_0xbb10('0x97'),qs[_0xbb10('0x79')](_0x5c8eb8))['or'](_0xbb10('0x98'),_0x5c8eb8+'%');}}}_0x1d49e1[_0xbb10('0x56')](_0x2a1ce1);_0x1d49e1[_0xbb10('0x99')]('i.id');var _0x5f0691={'type':db[_0xbb10('0x9a')][_0xbb10('0x9b')][_0xbb10('0x9c')],'raw':!![]};var _0x5239da=_0x1d49e1[_0xbb10('0x9d')]();_0x5239da[_0xbb10('0x59')]('i.id');_0x5239da['field'](_0xbb10('0x9e'),_0xbb10('0x72'));if(_0x1d82bf[_0xbb10('0x9f')]){_0x1d82bf['order'][_0xbb10('0x43')](function(_0x3a17fc){var _0xfbb365=_0x3a17fc[0x0]===_0xbb10('0xa0')?_0x3a17fc[0x0]:'i.'+_0x3a17fc[0x0];_0x1d49e1[_0xbb10('0x9f')](_0xfbb365,_0x3a17fc[0x1]===_0xbb10('0xa1')?![]:!![]);});}if(!_[_0xbb10('0xa2')](_0x4e7fac)){_0x1d49e1[_0xbb10('0x74')](_0x4ea1a6);_0x5239da[_0xbb10('0x56')]('t.id\x20IN\x20?',_0x4e7fac);}BPromise[_0xbb10('0xa3')]()[_0xbb10('0x22')](function(){if(!_0x3e6338){if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x86')])return;_0x5239da[_0xbb10('0x56')](_0xbb10('0xa4'));_0x1d49e1[_0xbb10('0x56')](_0xbb10('0xa4'));return;}if(_0x4c66d8[_0xbb10('0xa5')][_0xbb10('0xa6')]!==_0xbb10('0xa7'))return;return _0x4c66d8[_0xbb10('0xa5')]['getChatWebsites']({'attributes':['id'],'raw':!![]})['then'](function(_0xe1fc51){if(_[_0xbb10('0xa2')](_0xe1fc51)){_0x5239da[_0xbb10('0x56')](_0xbb10('0xa8'));_0x1d49e1[_0xbb10('0x56')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x5239da[_0xbb10('0x56')](_0xbb10('0x87'),_[_0xbb10('0x3f')](_0xe1fc51,'id'));_0x1d49e1[_0xbb10('0x56')](_0xbb10('0x87'),_[_0xbb10('0x3f')](_0xe1fc51,'id'));}});})['then'](function(){if(_0x4c66d8[_0xbb10('0xa5')][_0xbb10('0xa6')]==='agent'&&!_0x3e6338&&!_0x4c66d8[_0xbb10('0x4c')]['ChatWebsiteId'])return[];return db[_0xbb10('0xa9')][_0xbb10('0x4c')](_0x5239da[_0xbb10('0xaa')](),_0x5f0691);})[_0xbb10('0x22')](function(_0x3a4a6e){_0x5cf4f8['count']=_0x3a4a6e[_0xbb10('0x51')];if(_0x5cf4f8['count']===0x0)return[];return db[_0xbb10('0xa9')][_0xbb10('0x4c')](_0x1c0d8f['toString'](),_0x5f0691)['then'](function(_0x415407){_0x445870=_[_0xbb10('0xab')](_0x415407,'id');_0x5f0691=_[_0xbb10('0xac')](_0x5f0691,{'model':db[_0xbb10('0x46')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x50')]){_0x1d82bf[_0xbb10('0x4e')][_0xbb10('0x43')](function(_0x252ab8){_0x1d49e1[_0xbb10('0x59')]('i.'+_0x252ab8);});}else{_0x1d49e1[_0xbb10('0x59')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xbb10('0x72'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xad'),_0xbb10('0xae'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xaf'),_0xbb10('0xb0'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb1'),_0xbb10('0xa0'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb2'));_0x1d49e1['field'](_0xbb10('0xb3'),'Contact.firstName');_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb4'),_0xbb10('0xb5'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb6'),'Contact.email');_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb7'),_0xbb10('0xb8'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb9'),_0xbb10('0xba'));_0x1d49e1['field']('c.fax',_0xbb10('0xbb'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xbc'),'Owner.fullname');_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xbd'),'Owner.internal');_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xbe'),'TagIds');}if(_0x1d82bf[_0xbb10('0x54')])_0x1d49e1['limit'](_0x1d82bf[_0xbb10('0x54')]);if(_0x1d82bf[_0xbb10('0x2f')])_0x1d49e1['offset'](_0x1d82bf[_0xbb10('0x2f')]);return db[_0xbb10('0xa9')]['query'](_0x1d49e1['toString'](),_0x5f0691);})[_0xbb10('0x22')](function(_0x13ae83){if(_0x13ae83[_0xbb10('0x51')]>0x0)_0x5bd44d[_0xbb10('0x56')](_0xbb10('0xbf'),_['map'](_0x13ae83,'id'));return db[_0xbb10('0xa9')][_0xbb10('0x4c')](_0x5bd44d[_0xbb10('0xaa')](),_0x5f0691)['then'](function(_0xd68afa){var _0x4f90e6=_[_0xbb10('0xc0')](_0xd68afa,_0xbb10('0xc1'));var _0x44a3e1=[];_0x13ae83[_0xbb10('0x43')](function(_0x1f55d3){_0x44a3e1[_0xbb10('0x44')](updateChatInteraction(_0x1f55d3,_0x445870,_0x4f90e6));});return BPromise[_0xbb10('0xc2')](_0x44a3e1);});});})['then'](function(_0x4fc544){_0x5cf4f8[_0xbb10('0xc3')]=_0x4fc544;return _0x5cf4f8;})[_0xbb10('0x22')](respondWithFilteredResult(_0x366608,_0x1d82bf))[_0xbb10('0xc4')](handleError(_0x366608,null));};exports[_0xbb10('0xc5')]=function(_0x20b585,_0x363b81){var _0x1cccec={'raw':![],'where':{'id':_0x20b585[_0xbb10('0xc6')]['id']}},_0x1674f7={};_0x1674f7[_0xbb10('0x4b')]=_[_0xbb10('0xc7')](db[_0xbb10('0x46')][_0xbb10('0x47')]);_0x1674f7['query']=_[_0xbb10('0xc7')](_0x20b585[_0xbb10('0x4c')]);_0x1674f7[_0xbb10('0x4d')]=_[_0xbb10('0x4f')](_0x1674f7[_0xbb10('0x4b')],_0x1674f7[_0xbb10('0x4c')]);_0x1cccec[_0xbb10('0x4e')]=_[_0xbb10('0x4f')](_0x1674f7[_0xbb10('0x4b')],qs[_0xbb10('0x50')](_0x20b585[_0xbb10('0x4c')]['fields']));_0x1cccec[_0xbb10('0x4e')]=_0x1cccec['attributes'][_0xbb10('0x51')]?_0x1cccec[_0xbb10('0x4e')]:_0x1674f7[_0xbb10('0x4b')];if(_0x20b585[_0xbb10('0x4c')][_0xbb10('0xc8')]){_0x1cccec[_0xbb10('0xc9')]=[{'all':!![]}];}_0x1cccec=_['merge']({},_0x1cccec,_0x20b585[_0xbb10('0xca')]);return db['ChatInteraction'][_0xbb10('0x7b')](_0x1cccec)[_0xbb10('0x22')](handleEntityNotFound(_0x363b81,null))[_0xbb10('0x22')](respondWithResult(_0x363b81,null))[_0xbb10('0xc4')](handleError(_0x363b81,null));};exports[_0xbb10('0xcb')]=function(_0x31907e,_0x4f06c){return db[_0xbb10('0x46')][_0xbb10('0xcb')](_0x31907e[_0xbb10('0x3a')],{})[_0xbb10('0x22')](respondWithResult(_0x4f06c,0xc9))[_0xbb10('0xc4')](handleError(_0x4f06c,null));};exports['update']=function(_0x3696b3,_0x516520){if(_0x3696b3[_0xbb10('0x3a')]['id']){delete _0x3696b3[_0xbb10('0x3a')]['id'];}return db[_0xbb10('0x46')][_0xbb10('0x7b')]({'where':{'id':_0x3696b3[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x516520,null))[_0xbb10('0x22')](saveUpdates(_0x3696b3['body'],null))[_0xbb10('0x22')](respondWithResult(_0x516520,null))['catch'](handleError(_0x516520,null));};exports['destroy']=function(_0x1513e0,_0x35cbb9){return db[_0xbb10('0x46')][_0xbb10('0x7b')]({'where':{'id':_0x1513e0[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x35cbb9,null))['then'](removeEntity(_0x35cbb9,null))[_0xbb10('0xc4')](handleError(_0x35cbb9,null));};exports[_0xbb10('0xcc')]=function(_0x39aa9e,_0xb1b7c8){return db[_0xbb10('0x46')][_0xbb10('0xcc')]()['then'](respondWithResult(_0xb1b7c8,null))[_0xbb10('0xc4')](handleError(_0xb1b7c8,null));};exports[_0xbb10('0xcd')]=function(_0xb7c454,_0xa8b7c3){var _0x31718f=_0xb7c454[_0xbb10('0xc6')]['id'];var _0x2764e1;var _0x5e405b;var _0x33a43e;return db['ChatInteraction'][_0xbb10('0xce')]({'where':{'id':_0x31718f}})['then'](function(_0x4c8b68){_0x2764e1=_0x4c8b68;return db[_0xbb10('0xcf')][_0xbb10('0xce')]({'where':{'id':_0x4c8b68[_0xbb10('0x86')]},'attributes':['id',_0xbb10('0xd0'),_0xbb10('0xd1'),'vidaooTopic',_0xbb10('0xd2'),'vidaooMetadata'],'raw':!![]});})['then'](function(_0x4dd138){if(_0x4dd138&&_0x4dd138[_0xbb10('0xd0')]&&_0x4dd138[_0xbb10('0xd1')]){_0x5e405b=_0x4dd138;var _0x1b9012={'interaction':{'id':_0x31718f},'agent':{'id':_0xb7c454[_0xbb10('0xa5')]['id'],'name':_0xb7c454[_0xbb10('0xa5')]['name'],'fullname':_0xb7c454[_0xbb10('0xa5')][_0xbb10('0x40')],'email':_0xb7c454[_0xbb10('0xa5')][_0xbb10('0xd3')]},'contact':_0xb7c454[_0xbb10('0x3a')][_0xbb10('0x3b')],'account':_0xb7c454[_0xbb10('0x3a')]['account']};var _0x4c95c2={'rejectUnauthorized':![],'method':'POST','url':_0xbb10('0xd4'),'headers':{'X-APIKEY':_0x4dd138[_0xbb10('0xd0')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0xb7c454[_0xbb10('0xa5')][_0xbb10('0xd3')]],'buttons':null,'topic':_0x5e405b[_0xbb10('0xd5')],'note':_[_0xbb10('0xd6')](_0x5e405b[_0xbb10('0xd2')])?null:getMustacheRender(_0x5e405b[_0xbb10('0xd2')],_0x1b9012),'metadata':null},'redirect':_0xbb10('0xd7'),'json':!![]};try{if(!_[_0xbb10('0xd6')](_0x5e405b['vidaooMetadata'])){var _0x58295f=getMustacheRender(_0x5e405b['vidaooMetadata'],_0x1b9012);var _0x3d4b89=JSON[_0xbb10('0x8a')](_0x58295f);_0x4c95c2[_0xbb10('0x3a')]['metadata']=_0x3d4b89;}}catch(_0x2bfa8e){throw new db[(_0xbb10('0x9a'))][(_0xbb10('0xd8'))](_0xbb10('0xd9'));}return rp(_0x4c95c2);}else{throw new db[(_0xbb10('0x9a'))][(_0xbb10('0xd8'))]('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x356660){_0x33a43e=_0x356660;if(_0x33a43e['id']){var _0x48889b={'body':_0x33a43e[_0xbb10('0xda')],'ChatWebsiteId':_0x5e405b['id'],'ChatInteractionId':_0x2764e1['id'],'direction':_0xbb10('0xdb'),'UserId':_0xb7c454[_0xbb10('0xa5')]['id']};return db[_0xbb10('0xdc')][_0xbb10('0xcb')](_0x48889b,{});}else{throw new db[(_0xbb10('0x9a'))][(_0xbb10('0xd8'))](_0xbb10('0xdd'));}})[_0xbb10('0x22')](function(){return _0x2764e1[_0xbb10('0xde')]({'vidaooSessionId':_0x33a43e['id']});})['then'](respondWithResult(_0xa8b7c3,null))[_0xbb10('0xc4')](handleError(_0xa8b7c3,null));};exports['customUpdate']=function(_0x27bed2,_0x5547fa){if(_0x27bed2[_0xbb10('0x3a')]['id']){delete _0x27bed2[_0xbb10('0x3a')]['id'];}return db[_0xbb10('0x46')][_0xbb10('0x7b')]({'where':{'id':_0x27bed2['params']['id']},'include':[{'model':db[_0xbb10('0xdf')],'as':'Contact'}]})[_0xbb10('0x22')](handleEntityNotFound(_0x5547fa,null))[_0xbb10('0x22')](saveUpdates(_0x27bed2[_0xbb10('0x3a')],null))['then'](respondWithResult(_0x5547fa,null))[_0xbb10('0xc4')](handleError(_0x5547fa,null));};exports[_0xbb10('0xe0')]=function(_0x140173,_0x18a44f,_0x11d31b){if(_0x140173[_0xbb10('0x3a')]['id']){delete _0x140173['body']['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x140173[_0xbb10('0xc6')]['id']}})['then'](function(_0x318908){if(!_0x318908){logger['error'](_0xbb10('0xe1'),_0xbb10('0xe0'),0x194,_0xbb10('0xe2'));_0x18a44f['sendStatus'](0x194);}else{if(_0x318908['UserId']){throw new db[(_0xbb10('0x9a'))][(_0xbb10('0xd8'))](_0xbb10('0xe3'));}}return _0x318908;})['then'](function(_0x440108){if(_0x440108){return _0x440108[_0xbb10('0x36')]({'closed':_0x140173[_0xbb10('0x3a')]['closed'],'disposition':_0x140173['body']['disposition']})[_0xbb10('0x22')](function(_0x55aa03){return _0x55aa03;});}})[_0xbb10('0x22')](function(_0x1c2c95){return respondWithRpcPromise(_0xbb10('0xe4'),_0xbb10('0xe0'),_0x140173[_0xbb10('0x3a')],client9004);})[_0xbb10('0x22')](respondWithResult(_0x18a44f,null))[_0xbb10('0xc4')](handleError(_0x18a44f,null));};exports[_0xbb10('0xe5')]=function(_0x2746eb,_0x431792,_0x2e2710){_0x2746eb['body'][_0xbb10('0x38')]=_0x2746eb[_0xbb10('0xe6')]['originalname'];_0x2746eb[_0xbb10('0x3a')]['basename']=_0x2746eb['file'][_0xbb10('0xe7')];_0x2746eb[_0xbb10('0x3a')][_0xbb10('0x49')]=_0x2746eb[_0xbb10('0xe6')][_0xbb10('0xe8')];return db['Attachment'][_0xbb10('0xcb')](_0x2746eb[_0xbb10('0x3a')])['then'](respondWithResult(_0x431792,0xc9))[_0xbb10('0xc4')](handleError(_0x431792,null));};exports[_0xbb10('0xe9')]=function(_0x5a82e7,_0x424c96,_0x4c769b){return db[_0xbb10('0x46')][_0xbb10('0xce')]({'where':{'id':_0x5a82e7[_0xbb10('0xc6')]['id']},'raw':!![]})[_0xbb10('0x22')](handleEntityNotFound(_0x424c96,null))[_0xbb10('0x22')](function(_0x20b312){if(_0x20b312){if(_0x20b312[_0xbb10('0xea')]){return _0x424c96['status'](0x193)[_0xbb10('0x33')]({'status':0x193,'message':_0xbb10('0xeb')});}return db[_0xbb10('0xec')][_0xbb10('0xce')]({'where':{'id':_0x5a82e7[_0xbb10('0x4c')][_0xbb10('0xed')]},'raw':!![]})['then'](handleEntityNotFound(_0x424c96,null));}})['then'](function(_0x5a40e8){if(_0x5a40e8){var _0x23849e=_0x5a40e8[_0xbb10('0xee')]!==null;var _0x3e1a86=path[_0xbb10('0xef')](config['root'],_0xbb10('0xf0'));if(_0x23849e){_0x3e1a86=path[_0xbb10('0xef')](_0x3e1a86,_0xbb10('0xf1'));}var _0x577d27=path['join'](_0x3e1a86,_0x5a40e8[_0xbb10('0xf2')]);return _0x424c96['download'](_0x577d27);}})[_0xbb10('0xc4')](handleError(_0x424c96,null));};exports[_0xbb10('0xf3')]=function(_0xb9bc5a,_0x42276f){var _0x425505=null;var _0xcb61bb=null;var _0x1fe250=null;var _0x57933f=null;if(_0xb9bc5a[_0xbb10('0x3a')]['id']){delete _0xb9bc5a[_0xbb10('0x3a')]['id'];}if(_0xb9bc5a['body'][_0xbb10('0xf4')]){_0x57933f=path[_0xbb10('0xef')](config[_0xbb10('0xf5')],'server/files/chat/upload/',util['format']('transcript-%s.txt',Date[_0xbb10('0xf6')]()));_0xb9bc5a[_0xbb10('0x3a')]['pathTranscript']=_0x57933f;}return db[_0xbb10('0x46')][_0xbb10('0x7b')]({'where':{'id':_0xb9bc5a[_0xbb10('0xc6')]['id']},'include':[{'model':db[_0xbb10('0xdc')],'as':_0xbb10('0xf7'),'include':[{'model':db[_0xbb10('0x82')],'as':_0xbb10('0x82')}]}]})['then'](handleEntityNotFound(_0x42276f,null))[_0xbb10('0x22')](saveUpdates(_0xb9bc5a['body'],null))['then'](function(_0x4aa0d7){if(_0x4aa0d7){_0x425505=_0x4aa0d7;return db[_0xbb10('0xcf')][_0xbb10('0x7b')]({'where':{'id':_0x425505['ChatWebsiteId']}});}})[_0xbb10('0x22')](function(_0x49f324){if(_0x49f324){_0x1fe250=_0x49f324;return db[_0xbb10('0xdf')][_0xbb10('0x7b')]({'where':{'id':_0x425505[_0xbb10('0x7c')]}});}})['then'](function(_0x4d10ea){if(_0x4d10ea){_0xcb61bb=_0x4d10ea;if(_0x57933f){var _0x447c0d=null;for(var _0x502e73=0x1;_0x502e73<_0x425505[_0xbb10('0xf7')][_0xbb10('0x51')];++_0x502e73){_0x447c0d=_0x425505['Messages'][_0x502e73];var _0x50cd00=_0x447c0d[_0xbb10('0x83')]?util[_0xbb10('0xf8')](_0xbb10('0xf9'),_0x1fe250['agentAlias'],_0x447c0d[_0xbb10('0x83')]):_0xbb10('0xfa');var _0x22f153=_0xb9bc5a['body'][_0xbb10('0xfb')]||util[_0xbb10('0xf8')](_0xbb10('0xf9'),_0xbb10('0xfc'),_0x447c0d[_0xbb10('0x7c')]);switch(_0x1fe250[_0xbb10('0xfd')]){case _0xbb10('0xfe'):_0x50cd00=_0x447c0d[_0xbb10('0x83')]?util[_0xbb10('0xf8')](_0xbb10('0xf9'),_0x1fe250[_0xbb10('0xff')],_0x447c0d[_0xbb10('0x83')]):_0xbb10('0xfa');break;case'agent_alias':_0x50cd00=_0x447c0d['UserId']?_0x447c0d[_0xbb10('0x82')]['alias']||_0x447c0d[_0xbb10('0x82')][_0xbb10('0x40')]:_0xbb10('0xfa');break;case'agent_fullname':_0x50cd00=_0x447c0d[_0xbb10('0x83')]?_0x447c0d[_0xbb10('0x82')][_0xbb10('0x40')]:_0xbb10('0xfa');break;default:_0x50cd00=_0x447c0d[_0xbb10('0x83')]?util['format'](_0xbb10('0xf9'),_0x1fe250[_0xbb10('0xff')],_0x447c0d[_0xbb10('0x83')]):_0xbb10('0xfa');}var _0x150d4c=util[_0xbb10('0xf8')]('[%s]\x20%s:\x20%s\x0a',moment(_0x447c0d[_0xbb10('0x89')])[_0xbb10('0xf8')]('MM/DD/YYYY\x20HH:mm:ss'),_0x447c0d[_0xbb10('0x100')]==='in'?_0x22f153:_0x50cd00,_0x447c0d[_0xbb10('0x3a')]);if(!_0x447c0d[_0xbb10('0x101')]){fs[_0xbb10('0x102')](_0x57933f,_0x150d4c);}}return db[_0xbb10('0x103')][_0xbb10('0xce')]({'where':{'service':!![]},'include':[{'model':db[_0xbb10('0x104')],'as':_0xbb10('0x105'),'raw':!![]}]});}}})[_0xbb10('0x22')](function(_0x33d1b7){if(_0x33d1b7&&_0x33d1b7[_0xbb10('0x105')]&&_0xb9bc5a[_0xbb10('0x3a')]){var _0x1db646={'tls':{'rejectUnauthorized':![]}};if(_0x33d1b7[_0xbb10('0x105')][_0xbb10('0x106')]){_0x1db646['service']=_0x33d1b7[_0xbb10('0x105')][_0xbb10('0x106')];}else{_0x1db646['host']=_0x33d1b7['Smtp'][_0xbb10('0x107')];_0x1db646[_0xbb10('0x108')]=_0x33d1b7[_0xbb10('0x105')][_0xbb10('0x108')];_0x1db646[_0xbb10('0x109')]=_0x33d1b7[_0xbb10('0x105')][_0xbb10('0x109')];}if(_0x33d1b7[_0xbb10('0x105')][_0xbb10('0x10a')]){_0x1db646['auth']={'user':_0x33d1b7['Smtp']['user'],'pass':_0x33d1b7['Smtp']['pass']};}return respondWithRpcPromise('SendMail',_0xbb10('0x10b'),{'account':_0x1db646,'message':{'from':util[_0xbb10('0xf8')](_0xbb10('0x10c'),_0x33d1b7[_0xbb10('0x38')],_0x33d1b7['email']||_0x33d1b7[_0xbb10('0x105')][_0xbb10('0xa5')]),'to':_0xb9bc5a[_0xbb10('0x3a')][_0xbb10('0xf4')],'subject':'Mail\x20Transcript','text':util['format'](_0xbb10('0x10d'),_0xb9bc5a[_0xbb10('0x3a')]['mailTranscript']),'attachments':[{'path':_0x57933f}]}})['then'](function(){return _0x425505;})[_0xbb10('0xc4')](function(_0xf1371a){console[_0xbb10('0x28')](_0xf1371a);});}else{return _0x425505;}})[_0xbb10('0x22')](respondWithStatusCode(_0x42276f,0xc8))[_0xbb10('0xc4')](handleError(_0x42276f,null));};exports['addMessage']=function(_0x4744f4,_0x5382e9,_0x4c97b9){return db[_0xbb10('0xdc')][_0xbb10('0x7b')]({'where':{'id':_0x4744f4[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x5382e9,null))[_0xbb10('0x22')](function(_0x21c0fd){if(_0x21c0fd){return _0x21c0fd['addMessage'](_0x4744f4[_0xbb10('0x3a')][_0xbb10('0x10e')],_[_0xbb10('0x10f')](_0x4744f4[_0xbb10('0x3a')],[_0xbb10('0x10e'),'id'])||{});}})[_0xbb10('0x22')](respondWithResult(_0x5382e9,null))[_0xbb10('0xc4')](handleError(_0x5382e9,null));};exports[_0xbb10('0x110')]=function(_0x233d5e,_0x16f3ce,_0xbae19c){var _0x26f4b0={'raw':![],'where':{}};var _0x1dbf7b={};var _0x117e95={'count':0x0,'rows':[]};return db[_0xbb10('0x46')][_0xbb10('0xce')]({'where':{'id':_0x233d5e[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x16f3ce,null))[_0xbb10('0x22')](function(_0x43a203){if(_0x43a203){_0x1dbf7b[_0xbb10('0x4b')]=_[_0xbb10('0xc7')](db['ChatMessage'][_0xbb10('0x47')]);_0x1dbf7b['query']=_[_0xbb10('0xc7')](_0x233d5e[_0xbb10('0x4c')]);_0x1dbf7b[_0xbb10('0x4d')]=_[_0xbb10('0x4f')](_0x1dbf7b[_0xbb10('0x4b')],_0x1dbf7b['query']);_0x26f4b0['attributes']=_['intersection'](_0x1dbf7b[_0xbb10('0x4b')],qs[_0xbb10('0x50')](_0x233d5e['query'][_0xbb10('0x50')]));_0x26f4b0[_0xbb10('0x4e')]=_0x26f4b0[_0xbb10('0x4e')]['length']?_0x26f4b0[_0xbb10('0x4e')]:_0x1dbf7b[_0xbb10('0x4b')];if(!_0x233d5e[_0xbb10('0x4c')]['hasOwnProperty'](_0xbb10('0x53'))){_0x26f4b0['limit']=qs[_0xbb10('0x54')](_0x233d5e['query']['limit']);_0x26f4b0['offset']=qs['offset'](_0x233d5e['query']['offset']);}_0x26f4b0[_0xbb10('0x9f')]=qs[_0xbb10('0x55')](_0x233d5e[_0xbb10('0x4c')][_0xbb10('0x55')]);_0x26f4b0['where']=qs[_0xbb10('0x4d')](_[_0xbb10('0x57')](_0x233d5e[_0xbb10('0x4c')],_0x1dbf7b[_0xbb10('0x4d')]));_0x26f4b0[_0xbb10('0x56')][_0xbb10('0xc1')]=_0x43a203['id'];if(_0x233d5e[_0xbb10('0x4c')][_0xbb10('0x94')]){_0x26f4b0[_0xbb10('0x56')]=_[_0xbb10('0xac')](_0x26f4b0['where'],{'$or':_[_0xbb10('0x3f')](_0x26f4b0[_0xbb10('0x4e')],function(_0x288ccc){var _0x5c5ecc={};_0x5c5ecc[_0x288ccc]={'$like':'%'+_0x233d5e[_0xbb10('0x4c')][_0xbb10('0x94')]+'%'};return _0x5c5ecc;})});}if(_0x233d5e[_0xbb10('0x4c')][_0xbb10('0x8b')]){var _0x5b2292=_0x233d5e[_0xbb10('0x4c')][_0xbb10('0x8b')][_0xbb10('0x111')](',');var _0x22ec50={};_0x22ec50[_0x5b2292[0x0]]={'$gte':moment(_0x5b2292[0x1])[_0xbb10('0xf8')](_0xbb10('0x112'))};_0x26f4b0[_0xbb10('0x56')]=_[_0xbb10('0xac')](_0x26f4b0[_0xbb10('0x56')],_0x22ec50);}_0x26f4b0=_[_0xbb10('0xac')]({},_0x26f4b0,_0x233d5e[_0xbb10('0xca')]);return db['ChatMessage'][_0xbb10('0x31')]({'where':_0x26f4b0[_0xbb10('0x56')]})['then'](function(_0x5eb1fb){_0x117e95[_0xbb10('0x31')]=_0x5eb1fb;if(_0x233d5e[_0xbb10('0x4c')]['includeAll']){_0x26f4b0[_0xbb10('0xc9')]=[{'all':!![]}];}return db[_0xbb10('0xdc')]['findAll'](_0x26f4b0);})[_0xbb10('0x22')](function(_0x42441e){_0x117e95[_0xbb10('0xc3')]=_0x42441e;return _0x117e95;});}})[_0xbb10('0x22')](respondWithFilteredResult(_0x16f3ce,_0x26f4b0))[_0xbb10('0xc4')](handleError(_0x16f3ce,null));};exports['getMyMessages']=function(_0x4fc260,_0x5a502c,_0xaeaa51){var _0x4db9ad={'where':{}},_0x43deea={},_0x53e73e={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xbb10('0xce')]({'where':{'id':_0x4fc260[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x5a502c,null))[_0xbb10('0x22')](function(_0x2527f4){if(_0x2527f4){_0x43deea[_0xbb10('0x4b')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x43deea[_0xbb10('0x4c')]=_[_0xbb10('0xc7')](_0x4fc260[_0xbb10('0x4c')]);_0x43deea[_0xbb10('0x4d')]=_[_0xbb10('0x4f')](_0x43deea[_0xbb10('0x4b')],_0x43deea[_0xbb10('0x4c')]);_0x4db9ad['attributes']=_[_0xbb10('0x4f')](_0x43deea[_0xbb10('0x4b')],qs[_0xbb10('0x50')](_0x4fc260[_0xbb10('0x4c')]['fields']));_0x4db9ad[_0xbb10('0x4e')]=_0x4db9ad['attributes']['length']?_0x4db9ad[_0xbb10('0x4e')]:_0x43deea[_0xbb10('0x4b')];if(!_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x52')](_0xbb10('0x53'))){_0x4db9ad[_0xbb10('0x54')]=qs['limit'](_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x54')]);_0x4db9ad[_0xbb10('0x2f')]=qs[_0xbb10('0x2f')](_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x2f')]);}_0x4db9ad[_0xbb10('0x9f')]=qs['sort'](_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x55')]);_0x4db9ad[_0xbb10('0x56')]=qs['filters'](_['pick'](_0x4fc260[_0xbb10('0x4c')],_0x43deea[_0xbb10('0x4d')]));_0x4db9ad[_0xbb10('0x56')][_0xbb10('0xc1')]=_0x2527f4['id'];if(_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x94')]){_0x4db9ad[_0xbb10('0x56')]=_['merge'](_0x4db9ad[_0xbb10('0x56')],{'$or':_[_0xbb10('0x3f')](_0x4db9ad[_0xbb10('0x4e')],function(_0x55ba78){var _0x5e195a={};_0x5e195a[_0x55ba78]={'$like':'%'+_0x4fc260['query']['filter']+'%'};return _0x5e195a;})});}_0x4db9ad[_0xbb10('0x56')][_0xbb10('0x101')]=![];if(_0x4fc260[_0xbb10('0x4c')]['id']){_0x4db9ad[_0xbb10('0x56')]['id']={'$gt':_0x4fc260['query']['id']};}_0x4db9ad=_[_0xbb10('0xac')]({},_0x4db9ad,_0x4fc260['options']);return db[_0xbb10('0xdc')][_0xbb10('0x31')]({'where':_0x4db9ad[_0xbb10('0x56')]})[_0xbb10('0x22')](function(_0xa16287){_0x53e73e[_0xbb10('0x31')]=_0xa16287;_0x4db9ad[_0xbb10('0xc9')]=[];if(_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x113')]){_0x4db9ad[_0xbb10('0xc9')][_0xbb10('0x44')]({'model':db[_0xbb10('0x82')],'as':'User','attributes':['id',_0xbb10('0x40'),_0xbb10('0x114')]});}if(_0x4fc260[_0xbb10('0x4c')]['includeAll']){_0x4db9ad[_0xbb10('0xc9')]=[{'all':!![]}];}return db['ChatMessage'][_0xbb10('0x115')](_0x4db9ad);})[_0xbb10('0x22')](function(_0x280119){_0x53e73e[_0xbb10('0xc3')]=_0x280119;return _0x53e73e;});}})[_0xbb10('0x22')](respondWithFilteredResult(_0x5a502c,_0x4db9ad))['catch'](handleError(_0x5a502c,null));};exports['addTags']=function(_0x842d94,_0x4cf5cc,_0x553bb8){return db[_0xbb10('0x46')]['find']({'where':{'id':_0x842d94[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x4cf5cc,null))[_0xbb10('0x22')](function(_0x4469c4){if(_0x4469c4){return _0x4469c4[_0xbb10('0x116')](_0x842d94[_0xbb10('0x3a')][_0xbb10('0x10e')],_[_0xbb10('0x10f')](_0x842d94['body'],[_0xbb10('0x10e'),'id'])||{})['spread'](function(){return db[_0xbb10('0x7f')]['findAll']({'attributes':['id',_0xbb10('0x38'),_0xbb10('0x5a')],'where':{'id':_0x842d94['body'][_0xbb10('0x10e')]}});})[_0xbb10('0x22')](function(_0x1bb072){socket['emit'](_0xbb10('0x117'),{'id':Number(_0x842d94[_0xbb10('0xc6')]['id']),'tags':_0x1bb072||[]});return{'id':Number(_0x842d94[_0xbb10('0xc6')]['id']),'tags':_0x1bb072||[]};});}})['then'](respondWithResult(_0x4cf5cc,null))[_0xbb10('0xc4')](handleError(_0x4cf5cc,null));};exports[_0xbb10('0x118')]=function(_0x46df90,_0x4b781e,_0x3e6756){return db['ChatInteraction'][_0xbb10('0x7b')]({'where':{'id':_0x46df90[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x4b781e,null))[_0xbb10('0x22')](function(_0x583a3e){if(_0x583a3e){return _0x583a3e[_0xbb10('0x118')](_0x46df90[_0xbb10('0x4c')][_0xbb10('0x10e')]);}})[_0xbb10('0x22')](respondWithStatusCode(_0x4b781e,null))[_0xbb10('0xc4')](handleError(_0x4b781e,null));};exports['download']=function(_0x4b10ed,_0x40b5da){var _0x4739a6=moment()[_0xbb10('0x119')]()['toString']();var _0x3d5870=path[_0xbb10('0xef')](config[_0xbb10('0xf5')],_0xbb10('0x11a'),_0xbb10('0x11b'),_0xbb10('0x11c'));var _0x81d970=path[_0xbb10('0xef')](config[_0xbb10('0xf5')],'server',_0xbb10('0x11b'),_0xbb10('0x11d'));var _0x4102af=path[_0xbb10('0xef')](_0x3d5870,_0x4739a6);var _0x4d49a7=util[_0xbb10('0xf8')](_0xbb10('0x11e'),_0x4b10ed[_0xbb10('0xc6')]['id'],_0x4739a6);var _0x59fef2=path['join'](_0x3d5870,_0x4d49a7);var _0x3b45c4=[];_0x3b45c4['push']({'model':db[_0xbb10('0x82')],'as':'User','attributes':['id',_0xbb10('0x40')],'raw':!![]});_0x3b45c4[_0xbb10('0x44')]({'model':db[_0xbb10('0xdf')],'as':_0xbb10('0x11f'),'attributes':['id',_0xbb10('0x120'),_0xbb10('0x121')],'raw':!![]});if(_0x4b10ed[_0xbb10('0x4c')]['attachments']){_0x3b45c4[_0xbb10('0x44')]({'model':db[_0xbb10('0xec')],'as':_0xbb10('0xec'),'raw':!![]});}var _0x2807d2=[{'model':db[_0xbb10('0xdc')],'as':_0xbb10('0xf7'),'attributes':['id','body',_0xbb10('0x89'),_0xbb10('0x100'),_0xbb10('0x101'),_0xbb10('0x90')],'include':_0x3b45c4}];_0x2807d2[_0xbb10('0x44')]({'model':db[_0xbb10('0xcf')],'as':_0xbb10('0x122'),'attributes':['id','name']});_0x2807d2[_0xbb10('0x44')]({'model':db[_0xbb10('0x82')],'as':_0xbb10('0x123'),'attributes':['id','fullname']});return db[_0xbb10('0x46')]['find']({'where':{'id':_0x4b10ed[_0xbb10('0xc6')]['id']},'include':_0x2807d2})[_0xbb10('0x22')](handleEntityNotFound(_0x40b5da,null))[_0xbb10('0x22')](function(_0x58a447){if(_0x58a447){var _0x50fa4e=_0x58a447[_0xbb10('0x124')]({'plain':!![]});fs[_0xbb10('0x125')](_0x4102af);var _0xbb410e={'channel':_0xbb10('0x126'),'account':_0x50fa4e[_0xbb10('0x122')][_0xbb10('0x38')],'agent':_0x50fa4e[_0xbb10('0x123')]?_0x50fa4e[_0xbb10('0x123')][_0xbb10('0x40')]:_0xbb10('0x127'),'createdAt':moment(_0x50fa4e[_0xbb10('0x89')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xbb10('0xaa')](),'closedAt':_0x50fa4e[_0xbb10('0xea')]?moment(_0x50fa4e['closedAt'])['format'](_0xbb10('0x112'))[_0xbb10('0xaa')]():'','disposition':_0x50fa4e[_0xbb10('0x128')],'chatInfo':{'browser':_0x50fa4e['browserName'],'os':_0x50fa4e[_0xbb10('0x129')],'referer':_0x50fa4e[_0xbb10('0x12a')],'customerIp':_0x50fa4e['customerIp'],'customerPort':_0x50fa4e[_0xbb10('0x12b')]?_0x50fa4e[_0xbb10('0x12b')]:'N.A.'},'messages':_(_0x50fa4e['Messages'])[_0xbb10('0x12c')]()[_0xbb10('0x94')]({'secret':![]})[_0xbb10('0x3f')](function(_0x5cab64){if(_0x5cab64['Attachment']){var _0x58ee41=path[_0xbb10('0xef')](_0x81d970,_0x5cab64['Attachment'][_0xbb10('0xf2')]);if(fs[_0xbb10('0x12d')](_0x58ee41)){fs['createReadStream'](_0x58ee41)[_0xbb10('0x12e')](fs[_0xbb10('0x12f')](path[_0xbb10('0xef')](_0x4102af,_0x5cab64[_0xbb10('0xec')]['basename'])));}}return{'date':moment(_0x5cab64[_0xbb10('0x89')])['format'](_0xbb10('0x112'))[_0xbb10('0xaa')](),'sender':_0x5cab64[_0xbb10('0x100')]===_0xbb10('0xdb')?_0x5cab64[_0xbb10('0x82')]?_0x5cab64[_0xbb10('0x82')][_0xbb10('0x40')]:_0xbb10('0xfa'):_0x5cab64['Contact'][_0xbb10('0x120')]+(_0x5cab64[_0xbb10('0x11f')][_0xbb10('0x121')]?'\x20'+_0x5cab64[_0xbb10('0x11f')]['lastName']:''),'body':_0x5cab64['Attachment']?_0x5cab64[_0xbb10('0xec')][_0xbb10('0xf2')]:_0x5cab64[_0xbb10('0x3a')],'direction':_0x5cab64[_0xbb10('0x100')]==='out'?'A':'C','secret':_0x5cab64[_0xbb10('0x101')],'read':_0x5cab64[_0xbb10('0x90')],'attachment':_0x5cab64['Attachment']};})[_0xbb10('0x73')]()};return ejs['renderFile'](path['join'](config[_0xbb10('0xf5')],_0xbb10('0x11a'),_0xbb10('0x130'),_0xbb10('0x131')),{'interaction':_0xbb410e})[_0xbb10('0x22')](function(_0x4aa76a){var _0x38403e=path[_0xbb10('0xef')](_0x4102af,_0xbb10('0x132')+_0x50fa4e['id']+'-'+_0x4739a6+_0xbb10('0x133'));var _0x1b7274={'path':_0x38403e,'channel':_0xbb10('0x126'),'interactionId':_0x50fa4e['id']};return pdf[_0xbb10('0x134')](_0x4aa76a,_0x1b7274);})[_0xbb10('0x22')](function(){return new BPromise(function(_0x34f4d6,_0x254b6e){zipdir(_0x4102af,{'saveTo':_0x59fef2},function(_0x368adb,_0xef4ccf){if(_0x368adb)return _0x254b6e(_0x368adb);return _0x34f4d6(_0xef4ccf);});})[_0xbb10('0x22')](function(){return new BPromise(function(_0x9fcc26,_0x111fd4){rimraf(_0x4102af,function(_0x256ce9){if(_0x256ce9)_0x111fd4(_0x256ce9);return _0x9fcc26();});});})[_0xbb10('0x22')](function(){return _0x40b5da[_0xbb10('0x135')](_0x59fef2,_0x4d49a7,function(_0x27e0c5){if(_0x27e0c5){console[_0xbb10('0x136')](_0xbb10('0x137'),_0x27e0c5);}else{fs[_0xbb10('0x138')](_0x59fef2);}});});});}else{return _0x40b5da[_0xbb10('0x2c')](0xc8);}})[_0xbb10('0xc4')](handleError(_0x40b5da,null));}; \ No newline at end of file +var _0x955f=['CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','resolve','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','keyBy','ChatInteraction','a.key','Account.key','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','groupBy','ChatInteractionId','all','rows','includeAll','include','options','create','params','describe','createVidaooSession','ChatWebsite','vidaooApiKey','vidaooNote','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','follow','isNull','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','update','disposition','AbandonInteraction','attachmentUpload','originalname','file','mimetype','attachmentDownload','findOne','closed','Unauthorized','Attachment','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','basename','download','close','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','%s%d','agentAlias','System','customer','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','MailAccount','MailServerOut','Smtp','service','host','port','secure','auth','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','pick','includeAgent','findAll','addTags','setTags','spread','Tag','chatInteractionTags:save','removeTags','unix','server','files','attachments','transcript-%d-%s.zip','firstName','direction','Account','get','mkdirSync','Chat','Owner','N.A.','closedAt','browserName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','YYYY-MM-DD\x20HH:mm:ss','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatInteraction,\x20%s,\x20%s','result','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','stack','name','merge','body','contact','agent','interaction','account','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','field','color','from','tools_tags','select','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','keys','some','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)'];(function(_0x123d20,_0x4932fa){var _0x3879c0=function(_0x5c83f6){while(--_0x5c83f6){_0x123d20['push'](_0x123d20['shift']());}};_0x3879c0(++_0x4932fa);}(_0x955f,0x1eb));var _0xf955=function(_0x3f7417,_0x1d921d){_0x3f7417=_0x3f7417-0x0;var _0x2b1603=_0x955f[_0x3f7417];return _0x2b1603;};'use strict';var emlformat=require(_0xf955('0x0'));var rimraf=require(_0xf955('0x1'));var zipdir=require(_0xf955('0x2'));var jsonpatch=require(_0xf955('0x3'));var rp=require(_0xf955('0x4'));var moment=require('moment');var BPromise=require(_0xf955('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf955('0x6'));var sox=require('sox');var csv=require(_0xf955('0x7'));var ejs=require(_0xf955('0x8'));var fs=require('fs');var fs_extra=require(_0xf955('0x9'));var _=require('lodash');var squel=require(_0xf955('0xa'));var crypto=require(_0xf955('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf955('0xc'));var toCsv=require(_0xf955('0x7'));var querystring=require(_0xf955('0xd'));var Papa=require(_0xf955('0xe'));var Redis=require(_0xf955('0xf'));var authService=require(_0xf955('0x10'));var qs=require(_0xf955('0x11'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xf955('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf955('0x13'))(_0xf955('0x14'));var utils=require(_0xf955('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf955('0x16'));var db=require('../../mysqldb')['db'];config[_0xf955('0x17')]=_['defaults'](config[_0xf955('0x17')],{'host':_0xf955('0x18'),'port':0x18eb});var socket=require(_0xf955('0x19'))(new Redis(config[_0xf955('0x17')]));require(_0xf955('0x1a'))[_0xf955('0x1b')](socket);var jayson=require(_0xf955('0x1c'));var client=jayson[_0xf955('0x1d')][_0xf955('0x1e')]({'port':0x232b});var client9004=jayson[_0xf955('0x1d')]['http']({'port':0x232c});function respondWithRpcPromise(_0xc29b35,_0x54e60b,_0x3139d5,_0x3a814f){return new BPromise(function(_0x2f881b,_0x15c07c){var _0x50930d=_0x3a814f||client;return _0x50930d['request'](_0xc29b35,_0x3139d5)[_0xf955('0x1f')](function(_0xe6de5c){logger[_0xf955('0x20')]('ChatInteraction,\x20%s,\x20%s',_0x54e60b,_0xf955('0x21'));logger[_0xf955('0x22')](_0xf955('0x23'),_0x54e60b,_0xf955('0x21'),JSON[_0xf955('0x24')](_0xe6de5c));if(_0xe6de5c['error']){if(_0xe6de5c[_0xf955('0x25')][_0xf955('0x26')]===0x1f4){logger[_0xf955('0x25')]('ChatInteraction,\x20%s,\x20%s',_0x54e60b,_0xe6de5c[_0xf955('0x25')]['message']);return _0x15c07c(_0xe6de5c[_0xf955('0x25')][_0xf955('0x27')]);}logger[_0xf955('0x25')](_0xf955('0x28'),_0x54e60b,_0xe6de5c[_0xf955('0x25')]['message']);return _0x2f881b(_0xe6de5c[_0xf955('0x25')][_0xf955('0x27')]);}else{logger[_0xf955('0x20')](_0xf955('0x28'),_0x54e60b,_0xf955('0x21'));_0x2f881b(_0xe6de5c[_0xf955('0x29')][_0xf955('0x27')]);}})['catch'](function(_0x18f435){logger[_0xf955('0x25')](_0xf955('0x28'),_0x54e60b,_0x18f435);_0x15c07c(_0x18f435);});});}function respondWithStatusCode(_0x406632,_0x2dcd55){_0x2dcd55=_0x2dcd55||0xcc;return function(_0x13a86d){if(_0x13a86d){return _0x406632[_0xf955('0x2a')](_0x2dcd55);}return _0x406632['status'](_0x2dcd55)[_0xf955('0x2b')]();};}function respondWithResult(_0x145098,_0x41c9f6){_0x41c9f6=_0x41c9f6||0xc8;return function(_0xbd0b74){if(_0xbd0b74){return _0x145098[_0xf955('0x2c')](_0x41c9f6)[_0xf955('0x2d')](_0xbd0b74);}};}function respondWithFilteredResult(_0x4d4af0,_0x2232a7){return function(_0x1e5d37){if(_0x1e5d37){var _0x4ec3e8=typeof _0x2232a7[_0xf955('0x2e')]===_0xf955('0x2f')&&typeof _0x2232a7[_0xf955('0x30')]===_0xf955('0x2f');var _0x59bfb5=_0x1e5d37[_0xf955('0x31')];var _0x518fb3=_0x4ec3e8?0x0:_0x2232a7[_0xf955('0x2e')];var _0x2c222a=_0x4ec3e8?_0x1e5d37[_0xf955('0x31')]:_0x2232a7[_0xf955('0x2e')]+_0x2232a7[_0xf955('0x30')];var _0x32121b;if(_0x2c222a>=_0x59bfb5){_0x2c222a=_0x59bfb5;_0x32121b=0xc8;}else{_0x32121b=0xce;}_0x4d4af0[_0xf955('0x2c')](_0x32121b);return _0x4d4af0[_0xf955('0x32')]('Content-Range',_0x518fb3+'-'+_0x2c222a+'/'+_0x59bfb5)[_0xf955('0x2d')](_0x1e5d37);}return null;};}function patchUpdates(_0x165cc4){return function(_0x3964d3){try{jsonpatch[_0xf955('0x33')](_0x3964d3,_0x165cc4,!![]);}catch(_0x4fea0c){return BPromise[_0xf955('0x34')](_0x4fea0c);}return _0x3964d3[_0xf955('0x35')]();};}function saveUpdates(_0x3c81bc,_0xe1b436){return function(_0xdbc53e){if(_0xdbc53e){return _0xdbc53e['update'](_0x3c81bc)['then'](function(_0x5480db){return _0x5480db;});}return null;};}function removeEntity(_0x2626cb,_0x3783dc){return function(_0x374e95){if(_0x374e95){return _0x374e95[_0xf955('0x36')]()[_0xf955('0x1f')](function(){_0x2626cb[_0xf955('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3acc4b,_0x515dc6){return function(_0x8f842f){if(!_0x8f842f){_0x3acc4b[_0xf955('0x2a')](0x194);}return _0x8f842f;};}function handleError(_0xe33ef2,_0x51762d){_0x51762d=_0x51762d||0x1f4;return function(_0x60a421){logger['error'](_0x60a421[_0xf955('0x37')]);if(_0x60a421[_0xf955('0x38')]){delete _0x60a421[_0xf955('0x38')];}_0xe33ef2[_0xf955('0x2c')](_0x51762d)['send'](_0x60a421);};}function getMustacheRender(_0xf35170,_0x118c92){return Mustache['render'](_0xf35170,_[_0xf955('0x39')](_0x118c92[_0xf955('0x3a')],{'contact':_0x118c92[_0xf955('0x3b')],'message':_0x118c92['message'],'agent':_0x118c92[_0xf955('0x3c')],'interaction':_0x118c92[_0xf955('0x3d')],'account':_0x118c92[_0xf955('0x3e')]}))||'';}function getInteractionUsers(_0x488b6e,_0x97e8ff){return new BPromise(function(_0x195faa,_0x21e4a6){try{if(_0x97e8ff[_0x488b6e['id']]){_0x488b6e[_0xf955('0x3f')]=_[_0xf955('0x40')](_0x97e8ff[_0x488b6e['id']],function(_0x3c4b29){return{'id':_0x3c4b29['id'],'fullname':_0x3c4b29[_0xf955('0x41')]};});}}catch(_0x228dae){_0x21e4a6(_0x228dae);}_0x195faa(_0x488b6e);});}function getInteractionTags(_0x5671c7,_0x8fa41b){return new BPromise(function(_0x7123c1,_0x2aacdf){try{if(_0x5671c7[_0xf955('0x42')]){_0x5671c7[_0xf955('0x43')]=[];_0x5671c7[_0xf955('0x42')][_0xf955('0x44')](',')[_0xf955('0x45')](function(_0x47651b){_0x5671c7[_0xf955('0x43')][_0xf955('0x46')](_0x8fa41b[_0x47651b]);});}delete _0x5671c7[_0xf955('0x42')];}catch(_0x40d7e9){_0x2aacdf(_0x40d7e9);}_0x7123c1(_0x5671c7);});}function updateChatInteraction(_0x159ae3,_0x3557b5,_0x248f60){return new BPromise(function(_0x356ec2,_0x34f0f1){return getInteractionUsers(_0x159ae3,_0x248f60)[_0xf955('0x1f')](function(_0x5dd300){return getInteractionTags(_0x5dd300,_0x3557b5);})[_0xf955('0x1f')](function(_0x25d809){_0x356ec2(_0x25d809);})[_0xf955('0x47')](function(_0x5f0ef9){_0x34f0f1(_0x5f0ef9);});});}exports[_0xf955('0x48')]=function(_0x485e77,_0x398224){var _0x56a4ca={},_0x103ac2={},_0x24cb74={'count':0x0,'rows':[]};var _0x213136=_[_0xf955('0x40')](db['ChatInteraction'][_0xf955('0x49')],function(_0xdb1cc){return{'name':_0xdb1cc[_0xf955('0x4a')],'type':_0xdb1cc['type']['key']};});_0x103ac2[_0xf955('0x4b')]=_[_0xf955('0x40')](_0x213136,_0xf955('0x38'));_0x103ac2[_0xf955('0x4c')]=_['keys'](_0x485e77[_0xf955('0x4c')]);_0x103ac2[_0xf955('0x4d')]=_[_0xf955('0x4e')](_0x103ac2['model'],_0x103ac2[_0xf955('0x4c')]);_0x56a4ca['attributes']=_[_0xf955('0x4e')](_0x103ac2[_0xf955('0x4b')],qs[_0xf955('0x4f')](_0x485e77['query'][_0xf955('0x4f')]));_0x56a4ca[_0xf955('0x50')]=_0x56a4ca[_0xf955('0x50')][_0xf955('0x51')]?_0x56a4ca['attributes']:_0x103ac2[_0xf955('0x4b')];if(!_0x485e77[_0xf955('0x4c')][_0xf955('0x52')](_0xf955('0x53'))){_0x56a4ca[_0xf955('0x30')]=qs['limit'](_0x485e77[_0xf955('0x4c')]['limit']);_0x56a4ca[_0xf955('0x2e')]=qs['offset'](_0x485e77[_0xf955('0x4c')]['offset']);}_0x56a4ca['order']=qs[_0xf955('0x54')](_0x485e77[_0xf955('0x4c')]['sort']);_0x56a4ca[_0xf955('0x55')]=qs['filters'](_['pick'](_0x485e77['query'],_0x103ac2['filters']),_0x213136);var _0x3c37e2=[];var _0x1abe1c=squel['select']()['field']('id')[_0xf955('0x56')](_0xf955('0x38'))[_0xf955('0x56')](_0xf955('0x57'))[_0xf955('0x58')](_0xf955('0x59'));var _0x190500=squel[_0xf955('0x5a')]()[_0xf955('0x56')](_0xf955('0x5b'))[_0xf955('0x56')](_0xf955('0x5c'))['field'](_0xf955('0x5d'))[_0xf955('0x58')](_0xf955('0x5e'),'ui')[_0xf955('0x5f')](_0xf955('0x60'),'u','u.id\x20=\x20ui.UserId');var _0xf5d575=squel[_0xf955('0x5a')]()[_0xf955('0x58')](_0xf955('0x61'),'i')[_0xf955('0x5f')](_0xf955('0x62'),'c',_0xf955('0x63'))[_0xf955('0x5f')](_0xf955('0x60'),'o',_0xf955('0x64'))['left_join'](_0xf955('0x65'),'a',_0xf955('0x66'))[_0xf955('0x5f')](_0xf955('0x67'),'me',_0xf955('0x68'))[_0xf955('0x5f')](_0xf955('0x69'),'it',_0xf955('0x6a'))[_0xf955('0x5f')](_0xf955('0x59'),'t',_0xf955('0x6b'));var _0x2b8173=squel['expr']();var _0x1388a0=[];var _0x452de9=squel[_0xf955('0x6c')]();var _0x3eb727;if(_0x485e77[_0xf955('0x4c')][_0xf955('0x6d')]){_0x3eb727=as[_0xf955('0x6e')](_0x485e77['query']['search']);var _0x5e73ff=_0x3eb727[_0xf955('0x6f')];for(var _0x530ec7=0x0;_0x530ec7<_0x3eb727['conditions'][_0xf955('0x51')];_0x530ec7++){var _0x533e0f=_0x3eb727[_0xf955('0x70')][_0x530ec7];var _0x3fa5b5='i';var _0x158469=_[_0xf955('0x71')](_0x213136,['name',_0x533e0f[_0xf955('0x56')]]);if(!_0x158469){switch(_0x533e0f[_0xf955('0x56')]){case _0xf955('0x72'):if(_0x533e0f[_0xf955('0x73')]==0x1){_0xf5d575[_0xf955('0x74')]('`'+_0x533e0f['field']+_0xf955('0x75'));}else{_0xf5d575['having']('`'+_0x533e0f[_0xf955('0x56')]+_0xf955('0x76'));}break;case _0xf955('0x77'):if(_0x533e0f['operator']===_0xf955('0x78')){if(_0x533e0f[_0xf955('0x73')][_0xf955('0x44')]('\x20')[_0xf955('0x51')]>0x1){_0x2b8173[_0x5e73ff](_0xf955('0x79'),qs[_0xf955('0x7a')](_0x533e0f[_0xf955('0x73')]),null);}else{var _0x47e5de='%'+_0x533e0f['value']+'%';_0x2b8173[_0x5e73ff](_0xf955('0x7b'),_0x47e5de,_0x47e5de,_0x47e5de);}}else{_0x158469=_[_0xf955('0x71')](_0x213136,[_0xf955('0x38'),_0xf955('0x7c')]);_0x533e0f[_0xf955('0x56')]=_0xf955('0x7c');_0x4b85c2=as[_0xf955('0x7d')](_0x3fa5b5,_0x158469[_0xf955('0x7e')],_0x533e0f);_0x2b8173[_0x5e73ff](_0x4b85c2[_0xf955('0x7f')],_0x4b85c2[_0xf955('0x73')][_0xf955('0x80')],_0x4b85c2['value'][_0xf955('0x2b')]);}break;case'Tag':var _0x431729=_0x533e0f['value']['split'](',')[_0xf955('0x40')](function(_0x20f11c){return Number(_0x20f11c);});_0x431729['forEach'](function(_0x1e95c3){_0x452de9['or'](_0xf955('0x81'),'%,'+_0x1e95c3+',%');});_0x1388a0=_['union'](_0x1388a0,_0x431729);break;case'User':if(_0x533e0f[_0xf955('0x82')]===_0xf955('0x78')){_0x2b8173[_0x5e73ff](_0xf955('0x83'),'%'+_0x533e0f['value']+'%',null);}else{_0x158469=_[_0xf955('0x71')](_0x213136,[_0xf955('0x38'),_0xf955('0x84')]);_0x533e0f[_0xf955('0x56')]=_0xf955('0x84');_0x4b85c2=as[_0xf955('0x7d')](_0x3fa5b5,_0x158469[_0xf955('0x7e')],_0x533e0f);_0x2b8173[_0x5e73ff](_0x4b85c2[_0xf955('0x7f')],_0x4b85c2['value'][_0xf955('0x80')],_0x4b85c2[_0xf955('0x73')]['end']);}break;case _0xf955('0x3a'):_0x4b85c2=as[_0xf955('0x7d')]('me',null,_0x533e0f);_0x2b8173[_0x5e73ff](_0x4b85c2[_0xf955('0x7f')],_0x4b85c2[_0xf955('0x73')]['start'],_0x4b85c2[_0xf955('0x73')][_0xf955('0x2b')]);break;}}else{var _0x4b85c2=as['buildExpression'](_0x3fa5b5,_0x158469[_0xf955('0x7e')],_0x533e0f);_0x2b8173[_0x5e73ff](_0x4b85c2[_0xf955('0x7f')],_0x4b85c2[_0xf955('0x73')][_0xf955('0x80')],_0x4b85c2['value'][_0xf955('0x2b')]);}}}else{var _0x430571=_(_0x485e77[_0xf955('0x4c')])[_0xf955('0x85')]()[_0xf955('0x40')](function(_0x3e9c6e){return _[_0xf955('0x86')](_0x213136,[_0xf955('0x38'),_0x3e9c6e])?_0x3e9c6e:undefined;})[_0xf955('0x87')]()[_0xf955('0x73')]();if(!_[_0xf955('0x88')](_0x430571)){_0x430571[_0xf955('0x45')](function(_0x4254a2){if(_0x4254a2==='ChatWebsiteId'){_0xf5d575[_0xf955('0x55')](_0xf955('0x89'),[][_0xf955('0x8a')](_0x485e77[_0xf955('0x4c')][_0x4254a2]));}else if(_0x4254a2==='createdAt'){var _0xcf6900=JSON[_0xf955('0x8b')](_0x485e77[_0xf955('0x4c')][_0x4254a2])[_0xf955('0x8c')];var _0x2b266d=JSON[_0xf955('0x8b')](_0x485e77[_0xf955('0x4c')][_0x4254a2])[_0xf955('0x8d')];_0xf5d575[_0xf955('0x55')](_0xf955('0x8e'),_0xcf6900,_0x2b266d);}else{if(_0x485e77[_0xf955('0x4c')][_0x4254a2]==='null'){_0xf5d575[_0xf955('0x55')]('i.'+_0x4254a2+_0xf955('0x8f'));}else{_0xf5d575[_0xf955('0x55')]('i.'+_0x4254a2+_0xf955('0x90'),_0x485e77[_0xf955('0x4c')][_0x4254a2]);}}});}if(_0x485e77[_0xf955('0x4c')][_0xf955('0x91')]){if(_0x485e77['query'][_0xf955('0x91')]==0x1){_0xf5d575['having'](_0xf955('0x92'));}else{_0xf5d575['having'](_0xf955('0x93'));}}if(_0x485e77[_0xf955('0x4c')][_0xf955('0x94')]){_0x1388a0=_[_0xf955('0x95')](_0x485e77[_0xf955('0x4c')][_0xf955('0x94')])?_0x485e77['query'][_0xf955('0x94')]:new Array(_0x485e77[_0xf955('0x4c')][_0xf955('0x94')]);_0x1388a0['forEach'](function(_0x526346){_0x452de9['or'](_0xf955('0x81'),'%,'+_0x526346+',%');});}if(_0x485e77[_0xf955('0x4c')][_0xf955('0x96')]){var _0x595d60=_0x485e77[_0xf955('0x4c')]['filter'][_0xf955('0x97')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xf955('0x98')](_0x595d60)){_0x2b8173['or'](_0xf955('0x99'),_0x595d60+'%');}else{_0x2b8173['or'](_0xf955('0x9a'),qs['getFullTextValue'](_0x595d60))['or'](_0xf955('0x9b'),_0x595d60+'%');}}}_0xf5d575[_0xf955('0x55')](_0x2b8173);_0xf5d575[_0xf955('0x9c')]('i.id');var _0xba62d0={'type':db[_0xf955('0x9d')][_0xf955('0x9e')][_0xf955('0x9f')],'raw':!![]};var _0x419da5=_0xf5d575[_0xf955('0xa0')]();_0x419da5[_0xf955('0x56')]('i.id');_0x419da5[_0xf955('0x56')](_0xf955('0xa1'),_0xf955('0x72'));if(_0x56a4ca[_0xf955('0xa2')]){_0x56a4ca[_0xf955('0xa2')]['forEach'](function(_0x15c3e1){var _0x23f90c=_0x15c3e1[0x0]==='contactName'?_0x15c3e1[0x0]:'i.'+_0x15c3e1[0x0];_0xf5d575['order'](_0x23f90c,_0x15c3e1[0x1]===_0xf955('0xa3')?![]:!![]);});}if(!_[_0xf955('0x88')](_0x1388a0)){_0xf5d575[_0xf955('0x74')](_0x452de9);_0x419da5[_0xf955('0x55')]('t.id\x20IN\x20?',_0x1388a0);}BPromise[_0xf955('0xa4')]()['then'](function(){if(!_0x3eb727){if(_0x485e77['query'][_0xf955('0xa5')])return;_0x419da5[_0xf955('0x55')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0xf5d575['where'](_0xf955('0xa6'));return;}if(_0x485e77[_0xf955('0xa7')][_0xf955('0xa8')]!=='agent')return;return _0x485e77['user'][_0xf955('0xa9')]({'attributes':['id'],'raw':!![]})[_0xf955('0x1f')](function(_0x15fc7e){if(_['isEmpty'](_0x15fc7e)){_0x419da5['where']('i.ChatWebsiteId\x20IS\x20NULL');_0xf5d575['where'](_0xf955('0xaa'));}else{_0x419da5['where'](_0xf955('0x89'),_[_0xf955('0x40')](_0x15fc7e,'id'));_0xf5d575[_0xf955('0x55')](_0xf955('0x89'),_[_0xf955('0x40')](_0x15fc7e,'id'));}});})['then'](function(){if(_0x485e77[_0xf955('0xa7')][_0xf955('0xa8')]===_0xf955('0x3c')&&!_0x3eb727&&!_0x485e77[_0xf955('0x4c')]['ChatWebsiteId'])return[];return db[_0xf955('0xab')][_0xf955('0x4c')](_0x419da5['toString'](),_0xba62d0);})[_0xf955('0x1f')](function(_0x1819f6){_0x24cb74[_0xf955('0x31')]=_0x1819f6[_0xf955('0x51')];if(_0x24cb74[_0xf955('0x31')]===0x0)return[];return db[_0xf955('0xab')]['query'](_0x1abe1c['toString'](),_0xba62d0)[_0xf955('0x1f')](function(_0x545275){_0x3c37e2=_[_0xf955('0xac')](_0x545275,'id');_0xba62d0=_[_0xf955('0x39')](_0xba62d0,{'model':db[_0xf955('0xad')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x485e77[_0xf955('0x4c')]['fields']){_0x56a4ca['attributes'][_0xf955('0x45')](function(_0x12b9f8){_0xf5d575[_0xf955('0x56')]('i.'+_0x12b9f8);});}else{_0xf5d575[_0xf955('0x56')](_0xf955('0xa1'),'unreadMessages');_0xf5d575[_0xf955('0x56')](_0xf955('0xae'),_0xf955('0xaf'));_0xf5d575[_0xf955('0x56')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0xf5d575[_0xf955('0x56')](_0xf955('0xb0'),'contactName');_0xf5d575[_0xf955('0x56')](_0xf955('0xb1'));_0xf5d575[_0xf955('0x56')](_0xf955('0xb2'),'Contact.firstName');_0xf5d575[_0xf955('0x56')](_0xf955('0xb3'),_0xf955('0xb4'));_0xf5d575[_0xf955('0x56')](_0xf955('0xb5'),_0xf955('0xb6'));_0xf5d575[_0xf955('0x56')]('c.phone','Contact.phone');_0xf5d575['field'](_0xf955('0xb7'),_0xf955('0xb8'));_0xf5d575[_0xf955('0x56')](_0xf955('0xb9'),_0xf955('0xba'));_0xf5d575[_0xf955('0x56')](_0xf955('0xbb'),'Owner.fullname');_0xf5d575[_0xf955('0x56')](_0xf955('0xbc'),'Owner.internal');_0xf5d575[_0xf955('0x56')](_0xf955('0xbd'),_0xf955('0x42'));}if(_0x56a4ca[_0xf955('0x30')])_0xf5d575[_0xf955('0x30')](_0x56a4ca[_0xf955('0x30')]);if(_0x56a4ca[_0xf955('0x2e')])_0xf5d575[_0xf955('0x2e')](_0x56a4ca['offset']);return db['sequelize']['query'](_0xf5d575[_0xf955('0xbe')](),_0xba62d0);})[_0xf955('0x1f')](function(_0x210666){if(_0x210666[_0xf955('0x51')]>0x0)_0x190500[_0xf955('0x55')]('ui.ChatInteractionId\x20IN\x20?',_[_0xf955('0x40')](_0x210666,'id'));return db[_0xf955('0xab')][_0xf955('0x4c')](_0x190500[_0xf955('0xbe')](),_0xba62d0)[_0xf955('0x1f')](function(_0x36731b){var _0x11f6f8=_[_0xf955('0xbf')](_0x36731b,_0xf955('0xc0'));var _0x4a71e5=[];_0x210666[_0xf955('0x45')](function(_0x47daca){_0x4a71e5[_0xf955('0x46')](updateChatInteraction(_0x47daca,_0x3c37e2,_0x11f6f8));});return BPromise[_0xf955('0xc1')](_0x4a71e5);});});})[_0xf955('0x1f')](function(_0x427ab9){_0x24cb74[_0xf955('0xc2')]=_0x427ab9;return _0x24cb74;})[_0xf955('0x1f')](respondWithFilteredResult(_0x398224,_0x56a4ca))[_0xf955('0x47')](handleError(_0x398224,null));};exports['show']=function(_0x1ef189,_0x4bb590){var _0x222df2={'raw':![],'where':{'id':_0x1ef189['params']['id']}},_0x40d7c7={};_0x40d7c7[_0xf955('0x4b')]=_[_0xf955('0x85')](db[_0xf955('0xad')][_0xf955('0x49')]);_0x40d7c7[_0xf955('0x4c')]=_[_0xf955('0x85')](_0x1ef189[_0xf955('0x4c')]);_0x40d7c7['filters']=_[_0xf955('0x4e')](_0x40d7c7[_0xf955('0x4b')],_0x40d7c7['query']);_0x222df2[_0xf955('0x50')]=_[_0xf955('0x4e')](_0x40d7c7['model'],qs['fields'](_0x1ef189[_0xf955('0x4c')][_0xf955('0x4f')]));_0x222df2[_0xf955('0x50')]=_0x222df2['attributes'][_0xf955('0x51')]?_0x222df2[_0xf955('0x50')]:_0x40d7c7[_0xf955('0x4b')];if(_0x1ef189[_0xf955('0x4c')][_0xf955('0xc3')]){_0x222df2[_0xf955('0xc4')]=[{'all':!![]}];}_0x222df2=_[_0xf955('0x39')]({},_0x222df2,_0x1ef189[_0xf955('0xc5')]);return db[_0xf955('0xad')][_0xf955('0x71')](_0x222df2)[_0xf955('0x1f')](handleEntityNotFound(_0x4bb590,null))[_0xf955('0x1f')](respondWithResult(_0x4bb590,null))[_0xf955('0x47')](handleError(_0x4bb590,null));};exports[_0xf955('0xc6')]=function(_0x490981,_0x58464d){return db[_0xf955('0xad')][_0xf955('0xc6')](_0x490981[_0xf955('0x3a')],{})[_0xf955('0x1f')](respondWithResult(_0x58464d,0xc9))[_0xf955('0x47')](handleError(_0x58464d,null));};exports['update']=function(_0x161d06,_0x3bab0d){if(_0x161d06['body']['id']){delete _0x161d06[_0xf955('0x3a')]['id'];}return db[_0xf955('0xad')][_0xf955('0x71')]({'where':{'id':_0x161d06[_0xf955('0xc7')]['id']}})['then'](handleEntityNotFound(_0x3bab0d,null))[_0xf955('0x1f')](saveUpdates(_0x161d06['body'],null))[_0xf955('0x1f')](respondWithResult(_0x3bab0d,null))[_0xf955('0x47')](handleError(_0x3bab0d,null));};exports[_0xf955('0x36')]=function(_0xe9f9a8,_0x5aff59){return db[_0xf955('0xad')][_0xf955('0x71')]({'where':{'id':_0xe9f9a8[_0xf955('0xc7')]['id']}})[_0xf955('0x1f')](handleEntityNotFound(_0x5aff59,null))[_0xf955('0x1f')](removeEntity(_0x5aff59,null))['catch'](handleError(_0x5aff59,null));};exports[_0xf955('0xc8')]=function(_0x1f38db,_0x395013){return db['ChatInteraction'][_0xf955('0xc8')]()[_0xf955('0x1f')](respondWithResult(_0x395013,null))[_0xf955('0x47')](handleError(_0x395013,null));};exports[_0xf955('0xc9')]=function(_0x19665c,_0x437020){var _0x12d158=_0x19665c['params']['id'];var _0x5a6abe;var _0x4e3013;var _0x345a7c;return db[_0xf955('0xad')]['findOne']({'where':{'id':_0x12d158}})[_0xf955('0x1f')](function(_0x42ba43){_0x5a6abe=_0x42ba43;return db[_0xf955('0xca')]['findOne']({'where':{'id':_0x42ba43[_0xf955('0xa5')]},'attributes':['id',_0xf955('0xcb'),'vidaooEscalation','vidaooTopic',_0xf955('0xcc'),_0xf955('0xcd')],'raw':!![]});})[_0xf955('0x1f')](function(_0x30baa1){if(_0x30baa1&&_0x30baa1[_0xf955('0xcb')]&&_0x30baa1['vidaooEscalation']){_0x4e3013=_0x30baa1;var _0xc881d4={'interaction':{'id':_0x12d158},'agent':{'id':_0x19665c[_0xf955('0xa7')]['id'],'name':_0x19665c[_0xf955('0xa7')][_0xf955('0x38')],'fullname':_0x19665c[_0xf955('0xa7')]['fullname'],'email':_0x19665c[_0xf955('0xa7')][_0xf955('0xce')]},'contact':_0x19665c[_0xf955('0x3a')][_0xf955('0x3b')],'account':_0x19665c['body'][_0xf955('0x3e')]};var _0x410d1f={'rejectUnauthorized':![],'method':_0xf955('0xcf'),'url':_0xf955('0xd0'),'headers':{'X-APIKEY':_0x30baa1[_0xf955('0xcb')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x19665c['user'][_0xf955('0xce')]],'buttons':null,'topic':_0x4e3013[_0xf955('0xd1')],'note':_['isNull'](_0x4e3013[_0xf955('0xcc')])?null:getMustacheRender(_0x4e3013[_0xf955('0xcc')],_0xc881d4),'metadata':null},'redirect':_0xf955('0xd2'),'json':!![]};try{if(!_[_0xf955('0xd3')](_0x4e3013[_0xf955('0xcd')])){var _0x38e031=getMustacheRender(_0x4e3013[_0xf955('0xcd')],_0xc881d4);var _0x4f53ef=JSON[_0xf955('0x8b')](_0x38e031);_0x410d1f[_0xf955('0x3a')]['metadata']=_0x4f53ef;}}catch(_0x5395aa){throw new db[(_0xf955('0x9d'))][(_0xf955('0xd4'))](_0xf955('0xd5'));}return rp(_0x410d1f);}else{throw new db[(_0xf955('0x9d'))]['ValidationError'](_0xf955('0xd6'));}})[_0xf955('0x1f')](function(_0x57e0d7){_0x345a7c=_0x57e0d7;if(_0x345a7c['id']){var _0x54903a={'body':_0x345a7c[_0xf955('0xd7')],'ChatWebsiteId':_0x4e3013['id'],'ChatInteractionId':_0x5a6abe['id'],'direction':_0xf955('0xd8'),'UserId':_0x19665c[_0xf955('0xa7')]['id']};return db[_0xf955('0xd9')]['create'](_0x54903a,{});}else{throw new db[(_0xf955('0x9d'))][(_0xf955('0xd4'))](_0xf955('0xda'));}})[_0xf955('0x1f')](function(){return _0x5a6abe[_0xf955('0xdb')]({'vidaooSessionId':_0x345a7c['id']});})[_0xf955('0x1f')](respondWithResult(_0x437020,null))[_0xf955('0x47')](handleError(_0x437020,null));};exports[_0xf955('0xdc')]=function(_0x4c7a54,_0xde084e){if(_0x4c7a54[_0xf955('0x3a')]['id']){delete _0x4c7a54[_0xf955('0x3a')]['id'];}return db[_0xf955('0xad')][_0xf955('0x71')]({'where':{'id':_0x4c7a54[_0xf955('0xc7')]['id']},'include':[{'model':db[_0xf955('0xdd')],'as':_0xf955('0x77')}]})[_0xf955('0x1f')](handleEntityNotFound(_0xde084e,null))[_0xf955('0x1f')](saveUpdates(_0x4c7a54['body'],null))[_0xf955('0x1f')](respondWithResult(_0xde084e,null))[_0xf955('0x47')](handleError(_0xde084e,null));};exports[_0xf955('0xde')]=function(_0x27391f,_0x269ae2,_0x3250df){if(_0x27391f[_0xf955('0x3a')]['id']){delete _0x27391f['body']['id'];}return db[_0xf955('0xad')]['find']({'where':{'id':_0x27391f[_0xf955('0xc7')]['id']}})[_0xf955('0x1f')](function(_0x14cde9){if(!_0x14cde9){logger[_0xf955('0x25')](_0xf955('0xdf'),_0xf955('0xde'),0x194,_0xf955('0xe0'));_0x269ae2[_0xf955('0x2a')](0x194);}else{if(_0x14cde9[_0xf955('0x84')]){throw new db['Sequelize'][(_0xf955('0xd4'))](_0xf955('0xe1'));}}return _0x14cde9;})[_0xf955('0x1f')](function(_0x3d5c15){if(_0x3d5c15){return _0x3d5c15[_0xf955('0xe2')]({'closed':_0x27391f[_0xf955('0x3a')]['closed'],'disposition':_0x27391f[_0xf955('0x3a')][_0xf955('0xe3')]})[_0xf955('0x1f')](function(_0x5c8a3f){return _0x5c8a3f;});}})[_0xf955('0x1f')](function(_0x471223){return respondWithRpcPromise(_0xf955('0xe4'),_0xf955('0xde'),_0x27391f[_0xf955('0x3a')],client9004);})[_0xf955('0x1f')](respondWithResult(_0x269ae2,null))['catch'](handleError(_0x269ae2,null));};exports[_0xf955('0xe5')]=function(_0x4775bd,_0x2a862f,_0x42e3eb){_0x4775bd[_0xf955('0x3a')][_0xf955('0x38')]=_0x4775bd['file'][_0xf955('0xe6')];_0x4775bd['body']['basename']=_0x4775bd['file']['filename'];_0x4775bd[_0xf955('0x3a')]['type']=_0x4775bd[_0xf955('0xe7')][_0xf955('0xe8')];return db['Attachment'][_0xf955('0xc6')](_0x4775bd['body'])[_0xf955('0x1f')](respondWithResult(_0x2a862f,0xc9))['catch'](handleError(_0x2a862f,null));};exports[_0xf955('0xe9')]=function(_0x267963,_0x28ce39,_0x43a5c3){return db['ChatInteraction'][_0xf955('0xea')]({'where':{'id':_0x267963['params']['id']},'raw':!![]})[_0xf955('0x1f')](handleEntityNotFound(_0x28ce39,null))[_0xf955('0x1f')](function(_0x30fd01){if(_0x30fd01){if(_0x30fd01[_0xf955('0xeb')]){return _0x28ce39[_0xf955('0x2c')](0x193)[_0xf955('0x2d')]({'status':0x193,'message':_0xf955('0xec')});}return db[_0xf955('0xed')][_0xf955('0xea')]({'where':{'id':_0x267963[_0xf955('0x4c')]['attachId']},'raw':!![]})[_0xf955('0x1f')](handleEntityNotFound(_0x28ce39,null));}})[_0xf955('0x1f')](function(_0x444e24){if(_0x444e24){var _0x2fb11a=_0x444e24[_0xf955('0xee')]!==null;var _0x2ce35c=path[_0xf955('0xef')](config['root'],_0xf955('0xf0'));if(_0x2fb11a){_0x2ce35c=path[_0xf955('0xef')](_0x2ce35c,_0xf955('0xf1'));}var _0x1e35d7=path[_0xf955('0xef')](_0x2ce35c,_0x444e24[_0xf955('0xf2')]);return _0x28ce39[_0xf955('0xf3')](_0x1e35d7);}})[_0xf955('0x47')](handleError(_0x28ce39,null));};exports[_0xf955('0xf4')]=function(_0x38016a,_0x52ad4d){var _0x1620ec=null;var _0x2c8e49=null;var _0x2b3deb=null;var _0x1ae12a=null;if(_0x38016a[_0xf955('0x3a')]['id']){delete _0x38016a[_0xf955('0x3a')]['id'];}if(_0x38016a[_0xf955('0x3a')][_0xf955('0xf5')]){_0x1ae12a=path['join'](config[_0xf955('0xf6')],_0xf955('0xf7'),util[_0xf955('0xf8')](_0xf955('0xf9'),Date[_0xf955('0xfa')]()));_0x38016a[_0xf955('0x3a')][_0xf955('0xfb')]=_0x1ae12a;}return db[_0xf955('0xad')]['find']({'where':{'id':_0x38016a['params']['id']},'include':[{'model':db[_0xf955('0xd9')],'as':_0xf955('0xfc'),'include':[{'model':db[_0xf955('0xfd')],'as':_0xf955('0xfd')}]}]})['then'](handleEntityNotFound(_0x52ad4d,null))['then'](saveUpdates(_0x38016a[_0xf955('0x3a')],null))[_0xf955('0x1f')](function(_0x4860ad){if(_0x4860ad){_0x1620ec=_0x4860ad;return db[_0xf955('0xca')][_0xf955('0x71')]({'where':{'id':_0x1620ec[_0xf955('0xa5')]}});}})[_0xf955('0x1f')](function(_0x1c0211){if(_0x1c0211){_0x2b3deb=_0x1c0211;return db['CmContact'][_0xf955('0x71')]({'where':{'id':_0x1620ec[_0xf955('0x7c')]}});}})[_0xf955('0x1f')](function(_0x106640){if(_0x106640){_0x2c8e49=_0x106640;if(_0x1ae12a){var _0x101722=null;for(var _0x479dc0=0x1;_0x479dc0<_0x1620ec[_0xf955('0xfc')]['length'];++_0x479dc0){_0x101722=_0x1620ec[_0xf955('0xfc')][_0x479dc0];var _0x570005=_0x101722[_0xf955('0x84')]?util[_0xf955('0xf8')](_0xf955('0xfe'),_0x2b3deb[_0xf955('0xff')],_0x101722[_0xf955('0x84')]):_0xf955('0x100');var _0x85661f=_0x38016a[_0xf955('0x3a')][_0xf955('0x101')]||util[_0xf955('0xf8')]('%s%d','Visitor',_0x101722[_0xf955('0x7c')]);switch(_0x2b3deb[_0xf955('0x102')]){case _0xf955('0x103'):_0x570005=_0x101722[_0xf955('0x84')]?util['format']('%s%d',_0x2b3deb[_0xf955('0xff')],_0x101722['UserId']):'System';break;case _0xf955('0x104'):_0x570005=_0x101722['UserId']?_0x101722[_0xf955('0xfd')][_0xf955('0x105')]||_0x101722['User']['fullname']:_0xf955('0x100');break;case _0xf955('0x106'):_0x570005=_0x101722[_0xf955('0x84')]?_0x101722[_0xf955('0xfd')][_0xf955('0x41')]:'System';break;default:_0x570005=_0x101722[_0xf955('0x84')]?util['format']('%s%d',_0x2b3deb['agentAlias'],_0x101722[_0xf955('0x84')]):_0xf955('0x100');}var _0x23d382=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x101722[_0xf955('0x107')])['format'](_0xf955('0x108')),_0x101722['direction']==='in'?_0x85661f:_0x570005,_0x101722[_0xf955('0x3a')]);if(!_0x101722[_0xf955('0x109')]){fs['appendFileSync'](_0x1ae12a,_0x23d382);}}return db[_0xf955('0x10a')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xf955('0x10b')],'as':_0xf955('0x10c'),'raw':!![]}]});}}})[_0xf955('0x1f')](function(_0x1e6165){if(_0x1e6165&&_0x1e6165[_0xf955('0x10c')]&&_0x38016a['body']){var _0x4a6338={'tls':{'rejectUnauthorized':![]}};if(_0x1e6165[_0xf955('0x10c')][_0xf955('0x10d')]){_0x4a6338[_0xf955('0x10d')]=_0x1e6165[_0xf955('0x10c')][_0xf955('0x10d')];}else{_0x4a6338[_0xf955('0x10e')]=_0x1e6165[_0xf955('0x10c')][_0xf955('0x10e')];_0x4a6338[_0xf955('0x10f')]=_0x1e6165['Smtp'][_0xf955('0x10f')];_0x4a6338[_0xf955('0x110')]=_0x1e6165[_0xf955('0x10c')][_0xf955('0x110')];}if(_0x1e6165[_0xf955('0x10c')]['authentication']){_0x4a6338[_0xf955('0x111')]={'user':_0x1e6165[_0xf955('0x10c')]['user'],'pass':_0x1e6165[_0xf955('0x10c')]['pass']};}return respondWithRpcPromise('SendMail',_0xf955('0x112'),{'account':_0x4a6338,'message':{'from':util[_0xf955('0xf8')](_0xf955('0x113'),_0x1e6165[_0xf955('0x38')],_0x1e6165['email']||_0x1e6165[_0xf955('0x10c')][_0xf955('0xa7')]),'to':_0x38016a[_0xf955('0x3a')][_0xf955('0xf5')],'subject':'Mail\x20Transcript','text':util[_0xf955('0xf8')](_0xf955('0x114'),_0x38016a['body'][_0xf955('0xf5')]),'attachments':[{'path':_0x1ae12a}]}})[_0xf955('0x1f')](function(){return _0x1620ec;})[_0xf955('0x47')](function(_0x50502a){console[_0xf955('0x25')](_0x50502a);});}else{return _0x1620ec;}})[_0xf955('0x1f')](respondWithStatusCode(_0x52ad4d,0xc8))[_0xf955('0x47')](handleError(_0x52ad4d,null));};exports['addMessage']=function(_0x1d2e9c,_0x49718e,_0x5aeba7){return db['ChatMessage'][_0xf955('0x71')]({'where':{'id':_0x1d2e9c[_0xf955('0xc7')]['id']}})[_0xf955('0x1f')](handleEntityNotFound(_0x49718e,null))[_0xf955('0x1f')](function(_0x10cd8e){if(_0x10cd8e){return _0x10cd8e[_0xf955('0x115')](_0x1d2e9c['body'][_0xf955('0x116')],_[_0xf955('0x117')](_0x1d2e9c[_0xf955('0x3a')],[_0xf955('0x116'),'id'])||{});}})[_0xf955('0x1f')](respondWithResult(_0x49718e,null))[_0xf955('0x47')](handleError(_0x49718e,null));};exports[_0xf955('0x118')]=function(_0x287adf,_0x38177d,_0x56a307){var _0x49c6ca={'raw':![],'where':{}};var _0x36f3b3={};var _0x252118={'count':0x0,'rows':[]};return db[_0xf955('0xad')]['findOne']({'where':{'id':_0x287adf['params']['id']}})[_0xf955('0x1f')](handleEntityNotFound(_0x38177d,null))['then'](function(_0x1dd4b4){if(_0x1dd4b4){_0x36f3b3[_0xf955('0x4b')]=_[_0xf955('0x85')](db[_0xf955('0xd9')]['rawAttributes']);_0x36f3b3[_0xf955('0x4c')]=_[_0xf955('0x85')](_0x287adf[_0xf955('0x4c')]);_0x36f3b3['filters']=_[_0xf955('0x4e')](_0x36f3b3['model'],_0x36f3b3[_0xf955('0x4c')]);_0x49c6ca[_0xf955('0x50')]=_[_0xf955('0x4e')](_0x36f3b3[_0xf955('0x4b')],qs['fields'](_0x287adf[_0xf955('0x4c')][_0xf955('0x4f')]));_0x49c6ca[_0xf955('0x50')]=_0x49c6ca['attributes'][_0xf955('0x51')]?_0x49c6ca['attributes']:_0x36f3b3[_0xf955('0x4b')];if(!_0x287adf['query'][_0xf955('0x52')]('nolimit')){_0x49c6ca[_0xf955('0x30')]=qs['limit'](_0x287adf['query']['limit']);_0x49c6ca[_0xf955('0x2e')]=qs['offset'](_0x287adf['query'][_0xf955('0x2e')]);}_0x49c6ca[_0xf955('0xa2')]=qs[_0xf955('0x54')](_0x287adf[_0xf955('0x4c')][_0xf955('0x54')]);_0x49c6ca[_0xf955('0x55')]=qs[_0xf955('0x4d')](_[_0xf955('0x119')](_0x287adf['query'],_0x36f3b3[_0xf955('0x4d')]));_0x49c6ca[_0xf955('0x55')][_0xf955('0xc0')]=_0x1dd4b4['id'];if(_0x287adf[_0xf955('0x4c')][_0xf955('0x96')]){_0x49c6ca[_0xf955('0x55')]=_[_0xf955('0x39')](_0x49c6ca[_0xf955('0x55')],{'$or':_[_0xf955('0x40')](_0x49c6ca['attributes'],function(_0x1d1df4){var _0x1b7a62={};_0x1b7a62[_0x1d1df4]={'$like':'%'+_0x287adf[_0xf955('0x4c')][_0xf955('0x96')]+'%'};return _0x1b7a62;})});}if(_0x287adf[_0xf955('0x4c')][_0xf955('0x8c')]){var _0x547464=_0x287adf[_0xf955('0x4c')][_0xf955('0x8c')][_0xf955('0x44')](',');var _0x280d1c={};_0x280d1c[_0x547464[0x0]]={'$gte':moment(_0x547464[0x1])[_0xf955('0xf8')]('YYYY-MM-DD\x20HH:mm:ss')};_0x49c6ca[_0xf955('0x55')]=_[_0xf955('0x39')](_0x49c6ca['where'],_0x280d1c);}_0x49c6ca=_['merge']({},_0x49c6ca,_0x287adf['options']);return db[_0xf955('0xd9')][_0xf955('0x31')]({'where':_0x49c6ca[_0xf955('0x55')]})[_0xf955('0x1f')](function(_0x14bed6){_0x252118[_0xf955('0x31')]=_0x14bed6;if(_0x287adf[_0xf955('0x4c')][_0xf955('0xc3')]){_0x49c6ca[_0xf955('0xc4')]=[{'all':!![]}];}return db[_0xf955('0xd9')]['findAll'](_0x49c6ca);})[_0xf955('0x1f')](function(_0x7996b8){_0x252118[_0xf955('0xc2')]=_0x7996b8;return _0x252118;});}})[_0xf955('0x1f')](respondWithFilteredResult(_0x38177d,_0x49c6ca))[_0xf955('0x47')](handleError(_0x38177d,null));};exports['getMyMessages']=function(_0xac8cdf,_0x70fa9f,_0x5e650f){var _0x39d911={'where':{}},_0x2fbf0c={},_0x1612e4={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xf955('0xea')]({'where':{'id':_0xac8cdf[_0xf955('0xc7')]['id']}})[_0xf955('0x1f')](handleEntityNotFound(_0x70fa9f,null))[_0xf955('0x1f')](function(_0x1a7da8){if(_0x1a7da8){_0x2fbf0c[_0xf955('0x4b')]=_[_0xf955('0x85')](db['ChatMessage'][_0xf955('0x49')]);_0x2fbf0c['query']=_['keys'](_0xac8cdf['query']);_0x2fbf0c[_0xf955('0x4d')]=_[_0xf955('0x4e')](_0x2fbf0c[_0xf955('0x4b')],_0x2fbf0c[_0xf955('0x4c')]);_0x39d911[_0xf955('0x50')]=_[_0xf955('0x4e')](_0x2fbf0c[_0xf955('0x4b')],qs['fields'](_0xac8cdf['query'][_0xf955('0x4f')]));_0x39d911[_0xf955('0x50')]=_0x39d911['attributes']['length']?_0x39d911[_0xf955('0x50')]:_0x2fbf0c[_0xf955('0x4b')];if(!_0xac8cdf[_0xf955('0x4c')]['hasOwnProperty']('nolimit')){_0x39d911[_0xf955('0x30')]=qs[_0xf955('0x30')](_0xac8cdf[_0xf955('0x4c')][_0xf955('0x30')]);_0x39d911[_0xf955('0x2e')]=qs['offset'](_0xac8cdf['query'][_0xf955('0x2e')]);}_0x39d911[_0xf955('0xa2')]=qs[_0xf955('0x54')](_0xac8cdf[_0xf955('0x4c')]['sort']);_0x39d911[_0xf955('0x55')]=qs[_0xf955('0x4d')](_[_0xf955('0x119')](_0xac8cdf[_0xf955('0x4c')],_0x2fbf0c[_0xf955('0x4d')]));_0x39d911[_0xf955('0x55')]['ChatInteractionId']=_0x1a7da8['id'];if(_0xac8cdf['query'][_0xf955('0x96')]){_0x39d911['where']=_[_0xf955('0x39')](_0x39d911[_0xf955('0x55')],{'$or':_['map'](_0x39d911['attributes'],function(_0x4a3d8c){var _0x170ea7={};_0x170ea7[_0x4a3d8c]={'$like':'%'+_0xac8cdf[_0xf955('0x4c')][_0xf955('0x96')]+'%'};return _0x170ea7;})});}_0x39d911[_0xf955('0x55')][_0xf955('0x109')]=![];if(_0xac8cdf[_0xf955('0x4c')]['id']){_0x39d911[_0xf955('0x55')]['id']={'$gt':_0xac8cdf[_0xf955('0x4c')]['id']};}_0x39d911=_[_0xf955('0x39')]({},_0x39d911,_0xac8cdf['options']);return db[_0xf955('0xd9')]['count']({'where':_0x39d911['where']})[_0xf955('0x1f')](function(_0x36327c){_0x1612e4[_0xf955('0x31')]=_0x36327c;_0x39d911[_0xf955('0xc4')]=[];if(_0xac8cdf['query'][_0xf955('0x11a')]){_0x39d911['include'][_0xf955('0x46')]({'model':db[_0xf955('0xfd')],'as':_0xf955('0xfd'),'attributes':['id',_0xf955('0x41'),'alias']});}if(_0xac8cdf[_0xf955('0x4c')][_0xf955('0xc3')]){_0x39d911[_0xf955('0xc4')]=[{'all':!![]}];}return db[_0xf955('0xd9')][_0xf955('0x11b')](_0x39d911);})[_0xf955('0x1f')](function(_0x3e4239){_0x1612e4[_0xf955('0xc2')]=_0x3e4239;return _0x1612e4;});}})[_0xf955('0x1f')](respondWithFilteredResult(_0x70fa9f,_0x39d911))['catch'](handleError(_0x70fa9f,null));};exports[_0xf955('0x11c')]=function(_0x11a228,_0x2d37c2,_0x932b98){return db[_0xf955('0xad')]['find']({'where':{'id':_0x11a228[_0xf955('0xc7')]['id']}})[_0xf955('0x1f')](handleEntityNotFound(_0x2d37c2,null))[_0xf955('0x1f')](function(_0x147f3c){if(_0x147f3c){return _0x147f3c[_0xf955('0x11d')](_0x11a228[_0xf955('0x3a')]['ids'],_[_0xf955('0x117')](_0x11a228[_0xf955('0x3a')],[_0xf955('0x116'),'id'])||{})[_0xf955('0x11e')](function(){return db[_0xf955('0x11f')]['findAll']({'attributes':['id',_0xf955('0x38'),_0xf955('0x57')],'where':{'id':_0x11a228[_0xf955('0x3a')]['ids']}});})[_0xf955('0x1f')](function(_0xfcaf21){socket['emit'](_0xf955('0x120'),{'id':Number(_0x11a228[_0xf955('0xc7')]['id']),'tags':_0xfcaf21||[]});return{'id':Number(_0x11a228[_0xf955('0xc7')]['id']),'tags':_0xfcaf21||[]};});}})[_0xf955('0x1f')](respondWithResult(_0x2d37c2,null))[_0xf955('0x47')](handleError(_0x2d37c2,null));};exports['removeTags']=function(_0x572efd,_0x357dbc,_0x2b9880){return db[_0xf955('0xad')][_0xf955('0x71')]({'where':{'id':_0x572efd[_0xf955('0xc7')]['id']}})[_0xf955('0x1f')](handleEntityNotFound(_0x357dbc,null))['then'](function(_0x23968f){if(_0x23968f){return _0x23968f[_0xf955('0x121')](_0x572efd[_0xf955('0x4c')][_0xf955('0x116')]);}})['then'](respondWithStatusCode(_0x357dbc,null))[_0xf955('0x47')](handleError(_0x357dbc,null));};exports[_0xf955('0xf3')]=function(_0x3842e1,_0x204e4e){var _0x47b877=moment()[_0xf955('0x122')]()[_0xf955('0xbe')]();var _0x1624e9=path[_0xf955('0xef')](config[_0xf955('0xf6')],_0xf955('0x123'),_0xf955('0x124'),'tmp');var _0x3ccc35=path[_0xf955('0xef')](config[_0xf955('0xf6')],_0xf955('0x123'),_0xf955('0x124'),_0xf955('0x125'));var _0x72b500=path[_0xf955('0xef')](_0x1624e9,_0x47b877);var _0x1d4aa6=util[_0xf955('0xf8')](_0xf955('0x126'),_0x3842e1[_0xf955('0xc7')]['id'],_0x47b877);var _0x4896ae=path[_0xf955('0xef')](_0x1624e9,_0x1d4aa6);var _0x3b67e3=[];_0x3b67e3[_0xf955('0x46')]({'model':db['User'],'as':_0xf955('0xfd'),'attributes':['id','fullname'],'raw':!![]});_0x3b67e3[_0xf955('0x46')]({'model':db[_0xf955('0xdd')],'as':_0xf955('0x77'),'attributes':['id',_0xf955('0x127'),'lastName'],'raw':!![]});if(_0x3842e1['query']['attachments']){_0x3b67e3[_0xf955('0x46')]({'model':db[_0xf955('0xed')],'as':_0xf955('0xed'),'raw':!![]});}var _0x21b589=[{'model':db[_0xf955('0xd9')],'as':'Messages','attributes':['id',_0xf955('0x3a'),_0xf955('0x107'),_0xf955('0x128'),_0xf955('0x109'),'read'],'include':_0x3b67e3}];_0x21b589[_0xf955('0x46')]({'model':db[_0xf955('0xca')],'as':_0xf955('0x129'),'attributes':['id',_0xf955('0x38')]});_0x21b589[_0xf955('0x46')]({'model':db[_0xf955('0xfd')],'as':'Owner','attributes':['id',_0xf955('0x41')]});return db['ChatInteraction'][_0xf955('0x71')]({'where':{'id':_0x3842e1['params']['id']},'include':_0x21b589})[_0xf955('0x1f')](handleEntityNotFound(_0x204e4e,null))[_0xf955('0x1f')](function(_0x1ed31c){if(_0x1ed31c){var _0x2e8dc2=_0x1ed31c[_0xf955('0x12a')]({'plain':!![]});fs[_0xf955('0x12b')](_0x72b500);var _0x58b727={'channel':_0xf955('0x12c'),'account':_0x2e8dc2[_0xf955('0x129')][_0xf955('0x38')],'agent':_0x2e8dc2[_0xf955('0x12d')]?_0x2e8dc2[_0xf955('0x12d')][_0xf955('0x41')]:_0xf955('0x12e'),'createdAt':moment(_0x2e8dc2['createdAt'])[_0xf955('0xf8')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf955('0xbe')](),'closedAt':_0x2e8dc2['closed']?moment(_0x2e8dc2[_0xf955('0x12f')])[_0xf955('0xf8')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf955('0xbe')]():'','disposition':_0x2e8dc2['disposition'],'chatInfo':{'browser':_0x2e8dc2[_0xf955('0x130')],'os':_0x2e8dc2['osName'],'referer':_0x2e8dc2[_0xf955('0x131')],'customerIp':_0x2e8dc2[_0xf955('0x132')],'customerPort':_0x2e8dc2[_0xf955('0x133')]?_0x2e8dc2[_0xf955('0x133')]:'N.A.'},'messages':_(_0x2e8dc2[_0xf955('0xfc')])[_0xf955('0x134')]()[_0xf955('0x96')]({'secret':![]})[_0xf955('0x40')](function(_0x1307a6){if(_0x1307a6[_0xf955('0xed')]){var _0x3328b9=path[_0xf955('0xef')](_0x3ccc35,_0x1307a6['Attachment'][_0xf955('0xf2')]);if(fs[_0xf955('0x135')](_0x3328b9)){fs[_0xf955('0x136')](_0x3328b9)[_0xf955('0x137')](fs['createWriteStream'](path[_0xf955('0xef')](_0x72b500,_0x1307a6[_0xf955('0xed')][_0xf955('0xf2')])));}}return{'date':moment(_0x1307a6[_0xf955('0x107')])[_0xf955('0xf8')](_0xf955('0x138'))['toString'](),'sender':_0x1307a6[_0xf955('0x128')]===_0xf955('0xd8')?_0x1307a6['User']?_0x1307a6[_0xf955('0xfd')][_0xf955('0x41')]:_0xf955('0x100'):_0x1307a6[_0xf955('0x77')][_0xf955('0x127')]+(_0x1307a6[_0xf955('0x77')][_0xf955('0x139')]?'\x20'+_0x1307a6['Contact'][_0xf955('0x139')]:''),'body':_0x1307a6[_0xf955('0xed')]?_0x1307a6[_0xf955('0xed')][_0xf955('0xf2')]:_0x1307a6[_0xf955('0x3a')],'direction':_0x1307a6[_0xf955('0x128')]===_0xf955('0xd8')?'A':'C','secret':_0x1307a6['secret'],'read':_0x1307a6[_0xf955('0x91')],'attachment':_0x1307a6[_0xf955('0xed')]};})[_0xf955('0x73')]()};return ejs[_0xf955('0x13a')](path[_0xf955('0xef')](config[_0xf955('0xf6')],'server',_0xf955('0x13b'),_0xf955('0x13c')),{'interaction':_0x58b727})[_0xf955('0x1f')](function(_0x385676){var _0x5a9193=path['join'](_0x72b500,_0xf955('0x13d')+_0x2e8dc2['id']+'-'+_0x47b877+_0xf955('0x13e'));var _0x157508={'path':_0x5a9193,'channel':'Chat','interactionId':_0x2e8dc2['id']};return pdf[_0xf955('0x13f')](_0x385676,_0x157508);})['then'](function(){return new BPromise(function(_0x37bdd4,_0x4f8fc8){zipdir(_0x72b500,{'saveTo':_0x4896ae},function(_0x5f3e0f,_0x4ad147){if(_0x5f3e0f)return _0x4f8fc8(_0x5f3e0f);return _0x37bdd4(_0x4ad147);});})[_0xf955('0x1f')](function(){return new BPromise(function(_0x2dc607,_0x355871){rimraf(_0x72b500,function(_0x1c5b1d){if(_0x1c5b1d)_0x355871(_0x1c5b1d);return _0x2dc607();});});})[_0xf955('0x1f')](function(){return _0x204e4e[_0xf955('0xf3')](_0x4896ae,_0x1d4aa6,function(_0x5eac2b){if(_0x5eac2b){console[_0xf955('0x140')](_0xf955('0x141'),_0x5eac2b);}else{fs[_0xf955('0x142')](_0x4896ae);}});});});}else{return _0x204e4e[_0xf955('0x2a')](0xc8);}})[_0xf955('0x47')](handleError(_0x204e4e,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index cd062cf..bfaa69d 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 _0xc474=['remove','getUsers','then','setDataValue','Users','map','length','emit','catch','hasOwnProperty','hook','exports','events','ChatInteraction','setMaxListeners','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc474,0xfa));var _0x4c47=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xc474[_0x4a53d];return _0x27410e;};'use strict';var EventEmitter=require(_0x4c47('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x4c47('0x1')];var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x4c47('0x2')](0x0);var events={'afterCreate':_0x4c47('0x3'),'afterUpdate':_0x4c47('0x4'),'afterDestroy':_0x4c47('0x5')};function emitEvent(_0x39781a){return function(_0x45e89a,_0x19ef61,_0x547555){_0x45e89a[_0x4c47('0x6')]({'attributes':['id'],'raw':!![]})[_0x4c47('0x7')](function(_0x478301){_0x45e89a[_0x4c47('0x8')](_0x4c47('0x9'),_0x478301[_0x4c47('0xa')](function(_0xf48715){return{'id':_0xf48715['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x45e89a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4c47('0x7')](function(_0x4e9eed){_0x45e89a['setDataValue']('unreadMessages',_0x4e9eed[_0x4c47('0xb')]);ChatInteractionEvents[_0x4c47('0xc')](_0x39781a+':'+_0x45e89a['id'],_0x45e89a);ChatInteractionEvents['emit'](_0x39781a,_0x45e89a);_0x547555(null);})[_0x4c47('0xd')](_0x547555(null));};}for(var e in events){if(events[_0x4c47('0xe')](e)){var event=events[e];ChatInteraction[_0x4c47('0xf')](e,emitEvent(event));}}module[_0x4c47('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0x2732=['Users','map','findAll','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','getUsers','setDataValue'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x2732,0x1e8));var _0x2273=function(_0x499418,_0x58ca32){_0x499418=_0x499418-0x0;var _0xa0e702=_0x2732[_0x499418];return _0xa0e702;};'use strict';var EventEmitter=require(_0x2273('0x0'));var ChatInteraction=require(_0x2273('0x1'))['db'][_0x2273('0x2')];var ChatMessage=require(_0x2273('0x1'))['db'][_0x2273('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x2273('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3a5061){return function(_0x3a809d,_0x19a0c9,_0x16e5c3){_0x3a809d[_0x2273('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x23fbf1){_0x3a809d[_0x2273('0x6')](_0x2273('0x7'),_0x23fbf1[_0x2273('0x8')](function(_0x37a650){return{'id':_0x37a650['id']};}));return ChatMessage[_0x2273('0x9')]({'where':{'ChatInteractionId':_0x3a809d['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x559a7d){_0x3a809d['setDataValue']('unreadMessages',_0x559a7d[_0x2273('0xa')]);ChatInteractionEvents[_0x2273('0xb')](_0x3a5061+':'+_0x3a809d['id'],_0x3a809d);ChatInteractionEvents[_0x2273('0xb')](_0x3a5061,_0x3a809d);_0x16e5c3(null);})[_0x2273('0xc')](_0x16e5c3(null));};}for(var e in events){if(events[_0x2273('0xd')](e)){var event=events[e];ChatInteraction[_0x2273('0xe')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 926ec2b..81000e6 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 _0xa306=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','../../config/logger','api','moment','bluebird','path','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed'];(function(_0x3454ba,_0x777f81){var _0x42f42c=function(_0x273591){while(--_0x273591){_0x3454ba['push'](_0x3454ba['shift']());}};_0x42f42c(++_0x777f81);}(_0xa306,0xd0));var _0x6a30=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0xa306[_0x31ced5];return _0x10d9e5;};'use strict';var _=require(_0x6a30('0x0'));var util=require('util');var logger=require(_0x6a30('0x1'))(_0x6a30('0x2'));var moment=require(_0x6a30('0x3'));var BPromise=require(_0x6a30('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6a30('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6a30('0x6'));module[_0x6a30('0x7')]=function(_0x56fd46,_0x529feb){return _0x56fd46[_0x6a30('0x8')](_0x6a30('0x9'),attributes,{'tableName':_0x6a30('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x52d88e,_0x559dfe,_0x1ebf69){if(_0x52d88e[_0x6a30('0xb')](_0x6a30('0xc'))){_0x52d88e[_0x6a30('0xd')]=moment()[_0x6a30('0xe')](_0x6a30('0xf'));}_0x1ebf69(null,_0x52d88e);}},'charset':_0x6a30('0x10'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4a4c=['moment','request-promise','rimraf','../../config/environment','exports','define','ChatInteraction','chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0xa26a0e,_0x84fb14){var _0x51011d=function(_0xcfe96d){while(--_0xcfe96d){_0xa26a0e['push'](_0xa26a0e['shift']());}};_0x51011d(++_0x84fb14);}(_0x4a4c,0x16d));var _0xc4a4=function(_0x4f9a6f,_0x2a1c06){_0x4f9a6f=_0x4f9a6f-0x0;var _0x1a933a=_0x4a4c[_0x4f9a6f];return _0x1a933a;};'use strict';var _=require('lodash');var util=require(_0xc4a4('0x0'));var logger=require(_0xc4a4('0x1'))(_0xc4a4('0x2'));var moment=require(_0xc4a4('0x3'));var BPromise=require('bluebird');var rp=require(_0xc4a4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc4a4('0x5'));var config=require(_0xc4a4('0x6'));var attributes=require('./chatInteraction.attributes');module[_0xc4a4('0x7')]=function(_0x8f108c,_0x109eeb){return _0x8f108c[_0xc4a4('0x8')](_0xc4a4('0x9'),attributes,{'tableName':_0xc4a4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4860de,_0x5b1c4e,_0x5406f8){if(_0x4860de[_0xc4a4('0xb')](_0xc4a4('0xc'))){_0x4860de['closedAt']=moment()[_0xc4a4('0xd')](_0xc4a4('0xe'));}_0x5406f8(null,_0x4860de);}},'charset':'utf8mb4','collate':_0xc4a4('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index b0258f8..b2c6f64 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 _0x93c6=['body','options','raw','where','limit','find','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update'];(function(_0x11da31,_0x5d576f){var _0x6bb4c8=function(_0x1680a3){while(--_0x1680a3){_0x11da31['push'](_0x11da31['shift']());}};_0x6bb4c8(++_0x5d576f);}(_0x93c6,0x88));var _0x693c=function(_0x5d18fc,_0x1de58d){_0x5d18fc=_0x5d18fc-0x0;var _0x2444dd=_0x93c6[_0x5d18fc];return _0x2444dd;};'use strict';var _=require(_0x693c('0x0'));var util=require(_0x693c('0x1'));var moment=require(_0x693c('0x2'));var BPromise=require(_0x693c('0x3'));var rs=require(_0x693c('0x4'));var fs=require('fs');var Redis=require(_0x693c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x693c('0x6'));var logger=require(_0x693c('0x7'))(_0x693c('0x8'));var config=require(_0x693c('0x9'));var jayson=require(_0x693c('0xa'));var client=jayson[_0x693c('0xb')][_0x693c('0xc')]({'port':0x232a});config[_0x693c('0xd')]=_[_0x693c('0xe')](config[_0x693c('0xd')],{'host':_0x693c('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x693c('0xd')]));require(_0x693c('0x10'))[_0x693c('0x11')](socket);function respondWithRpcPromise(_0x577f32,_0x5f26ce,_0x33d2f7){return new BPromise(function(_0x31e357,_0x1c1c69){return client[_0x693c('0x12')](_0x577f32,_0x33d2f7)[_0x693c('0x13')](function(_0x5e94ff){logger[_0x693c('0x14')](_0x693c('0x15'),_0x5f26ce,_0x693c('0x16'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x5f26ce,_0x693c('0x16'),JSON[_0x693c('0x17')](_0x5e94ff));if(_0x5e94ff['error']){if(_0x5e94ff[_0x693c('0x18')][_0x693c('0x19')]===0x1f4){logger[_0x693c('0x18')](_0x693c('0x15'),_0x5f26ce,_0x5e94ff['error'][_0x693c('0x1a')]);return _0x1c1c69(_0x5e94ff[_0x693c('0x18')]['message']);}logger['error'](_0x693c('0x15'),_0x5f26ce,_0x5e94ff[_0x693c('0x18')]['message']);return _0x31e357(_0x5e94ff[_0x693c('0x18')][_0x693c('0x1a')]);}else{logger[_0x693c('0x14')](_0x693c('0x15'),_0x5f26ce,_0x693c('0x16'));_0x31e357(_0x5e94ff[_0x693c('0x1b')]['message']);}})[_0x693c('0x1c')](function(_0x3cf1b0){logger['error'](_0x693c('0x15'),_0x5f26ce,_0x3cf1b0);_0x1c1c69(_0x3cf1b0);});});}exports[_0x693c('0x1d')]=function(_0x21aa18){var _0x2c8a6d=this;return new Promise(function(_0xca7140,_0x2ba1d5){return db[_0x693c('0x1e')][_0x693c('0x1f')](_0x21aa18[_0x693c('0x20')],{'raw':_0x21aa18[_0x693c('0x21')]?_0x21aa18[_0x693c('0x21')][_0x693c('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21aa18[_0x693c('0x21')]?_0x21aa18[_0x693c('0x21')][_0x693c('0x23')]||null:null,'attributes':_0x21aa18[_0x693c('0x21')]?_0x21aa18[_0x693c('0x21')]['attributes']||null:null,'limit':_0x21aa18[_0x693c('0x21')]?_0x21aa18[_0x693c('0x21')][_0x693c('0x24')]||null:null})[_0x693c('0x13')](function(_0x2e2db7){logger[_0x693c('0x14')](_0x693c('0x1d'),_0x21aa18);logger['debug'](_0x693c('0x1d'),_0x21aa18,JSON[_0x693c('0x17')](_0x2e2db7));_0xca7140(_0x2e2db7);})[_0x693c('0x1c')](function(_0x5284fb){logger[_0x693c('0x18')]('UpdateChatInteraction',_0x5284fb['message'],_0x21aa18);_0x2ba1d5(_0x2c8a6d[_0x693c('0x18')](0x1f4,_0x5284fb[_0x693c('0x1a')]));});});};exports['AddTagsToChatInteraction']=function(_0x5d8b2d){return new Promise(function(_0x3090e6,_0x5d6622){return db[_0x693c('0x1e')][_0x693c('0x25')]({'where':_0x5d8b2d[_0x693c('0x21')]?_0x5d8b2d[_0x693c('0x21')][_0x693c('0x23')]||null:null})['then'](function(_0x54fcce){if(_0x54fcce){return _0x54fcce[_0x693c('0x26')](_0x5d8b2d[_0x693c('0x20')][_0x693c('0x27')],_[_0x693c('0x28')](_0x5d8b2d[_0x693c('0x20')],[_0x693c('0x27'),'id'])||{});}})['spread'](function(_0x1245b6){logger[_0x693c('0x14')](_0x693c('0x29'),_0x5d8b2d);logger['debug']('AddTags',_0x5d8b2d,JSON[_0x693c('0x17')](_0x1245b6));_0x3090e6(_0x1245b6);})['catch'](function(_0x12afe1){logger[_0x693c('0x18')]('AddTags',_0x12afe1[_0x693c('0x1a')],_0x5d8b2d);_0x5d6622(_this[_0x693c('0x18')](0x1f4,_0x12afe1[_0x693c('0x1a')]));});});}; \ No newline at end of file +var _0xed28=['ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ChatInteraction','update','options','raw','where','limit','UpdateChatInteraction','stringify','find','addTags','body','omit','ids','spread','info','AddTags','debug','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','ChatInteraction,\x20%s,\x20%s'];(function(_0x71185f,_0x371d74){var _0x160ffe=function(_0x57feba){while(--_0x57feba){_0x71185f['push'](_0x71185f['shift']());}};_0x160ffe(++_0x371d74);}(_0xed28,0x14c));var _0x8ed2=function(_0x35f9e7,_0x1b5f66){_0x35f9e7=_0x35f9e7-0x0;var _0x36254a=_0xed28[_0x35f9e7];return _0x36254a;};'use strict';var _=require(_0x8ed2('0x0'));var util=require(_0x8ed2('0x1'));var moment=require(_0x8ed2('0x2'));var BPromise=require(_0x8ed2('0x3'));var rs=require(_0x8ed2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8ed2('0x5'));var logger=require(_0x8ed2('0x6'))(_0x8ed2('0x7'));var config=require(_0x8ed2('0x8'));var jayson=require(_0x8ed2('0x9'));var client=jayson[_0x8ed2('0xa')][_0x8ed2('0xb')]({'port':0x232a});config['redis']=_[_0x8ed2('0xc')](config[_0x8ed2('0xd')],{'host':_0x8ed2('0xe'),'port':0x18eb});var socket=require(_0x8ed2('0xf'))(new Redis(config[_0x8ed2('0xd')]));require(_0x8ed2('0x10'))[_0x8ed2('0x11')](socket);function respondWithRpcPromise(_0x13f928,_0x1ff1b1,_0x5a9877){return new BPromise(function(_0x5839fe,_0x371f1b){return client[_0x8ed2('0x12')](_0x13f928,_0x5a9877)['then'](function(_0x1c79b5){logger['info'](_0x8ed2('0x13'),_0x1ff1b1,'request\x20sent');logger['debug'](_0x8ed2('0x14'),_0x1ff1b1,_0x8ed2('0x15'),JSON['stringify'](_0x1c79b5));if(_0x1c79b5['error']){if(_0x1c79b5[_0x8ed2('0x16')][_0x8ed2('0x17')]===0x1f4){logger[_0x8ed2('0x16')](_0x8ed2('0x13'),_0x1ff1b1,_0x1c79b5['error'][_0x8ed2('0x18')]);return _0x371f1b(_0x1c79b5[_0x8ed2('0x16')][_0x8ed2('0x18')]);}logger[_0x8ed2('0x16')](_0x8ed2('0x13'),_0x1ff1b1,_0x1c79b5['error']['message']);return _0x5839fe(_0x1c79b5[_0x8ed2('0x16')]['message']);}else{logger['info'](_0x8ed2('0x13'),_0x1ff1b1,_0x8ed2('0x15'));_0x5839fe(_0x1c79b5[_0x8ed2('0x19')]['message']);}})[_0x8ed2('0x1a')](function(_0x27c75b){logger[_0x8ed2('0x16')](_0x8ed2('0x13'),_0x1ff1b1,_0x27c75b);_0x371f1b(_0x27c75b);});});}exports['UpdateChatInteraction']=function(_0x38346e){var _0x1deb72=this;return new Promise(function(_0x994270,_0x100d1e){return db[_0x8ed2('0x1b')][_0x8ed2('0x1c')](_0x38346e['body'],{'raw':_0x38346e[_0x8ed2('0x1d')]?_0x38346e[_0x8ed2('0x1d')][_0x8ed2('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38346e[_0x8ed2('0x1d')]?_0x38346e[_0x8ed2('0x1d')][_0x8ed2('0x1f')]||null:null,'attributes':_0x38346e[_0x8ed2('0x1d')]?_0x38346e['options']['attributes']||null:null,'limit':_0x38346e[_0x8ed2('0x1d')]?_0x38346e[_0x8ed2('0x1d')][_0x8ed2('0x20')]||null:null})['then'](function(_0x149c42){logger['info'](_0x8ed2('0x21'),_0x38346e);logger['debug'](_0x8ed2('0x21'),_0x38346e,JSON[_0x8ed2('0x22')](_0x149c42));_0x994270(_0x149c42);})[_0x8ed2('0x1a')](function(_0x3d81ed){logger[_0x8ed2('0x16')](_0x8ed2('0x21'),_0x3d81ed[_0x8ed2('0x18')],_0x38346e);_0x100d1e(_0x1deb72['error'](0x1f4,_0x3d81ed['message']));});});};exports['AddTagsToChatInteraction']=function(_0x2361e5){return new Promise(function(_0x36a549,_0x2ae596){return db[_0x8ed2('0x1b')][_0x8ed2('0x23')]({'where':_0x2361e5[_0x8ed2('0x1d')]?_0x2361e5['options'][_0x8ed2('0x1f')]||null:null})['then'](function(_0x2f12ce){if(_0x2f12ce){return _0x2f12ce[_0x8ed2('0x24')](_0x2361e5[_0x8ed2('0x25')]['ids'],_[_0x8ed2('0x26')](_0x2361e5['body'],[_0x8ed2('0x27'),'id'])||{});}})[_0x8ed2('0x28')](function(_0xd65804){logger[_0x8ed2('0x29')](_0x8ed2('0x2a'),_0x2361e5);logger[_0x8ed2('0x2b')](_0x8ed2('0x2a'),_0x2361e5,JSON[_0x8ed2('0x22')](_0xd65804));_0x36a549(_0xd65804);})[_0x8ed2('0x1a')](function(_0x4b0593){logger[_0x8ed2('0x16')]('AddTags',_0x4b0593['message'],_0x2361e5);_0x2ae596(_this[_0x8ed2('0x16')](0x1f4,_0x4b0593['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 713a797..cad934e 100644 --- a/server/api/chatInteraction/chatInteraction.socket.js +++ b/server/api/chatInteraction/chatInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5458=['register','length','chatInteraction:','./chatInteraction.events','save','remove','update','emit','removeListener'];(function(_0x3d84ae,_0x56cf1c){var _0x499806=function(_0x117534){while(--_0x117534){_0x3d84ae['push'](_0x3d84ae['shift']());}};_0x499806(++_0x56cf1c);}(_0x5458,0x1d7));var _0x8545=function(_0x4fd7b2,_0x753108){_0x4fd7b2=_0x4fd7b2-0x0;var _0x3ea112=_0x5458[_0x4fd7b2];return _0x3ea112;};'use strict';var ChatInteractionEvents=require(_0x8545('0x0'));var events=[_0x8545('0x1'),_0x8545('0x2'),_0x8545('0x3')];function createListener(_0x4f3961,_0x4eaacb){return function(_0x5a7ab7){_0x4eaacb[_0x8545('0x4')](_0x4f3961,_0x5a7ab7);};}function removeListener(_0x77a398,_0x3e5b3c){return function(){ChatInteractionEvents[_0x8545('0x5')](_0x77a398,_0x3e5b3c);};}exports[_0x8545('0x6')]=function(_0x2cebbb){for(var _0x3c53d0=0x0,_0x5bb9e=events[_0x8545('0x7')];_0x3c53d0<_0x5bb9e;_0x3c53d0++){var _0x17e822=events[_0x3c53d0];var _0x410082=createListener(_0x8545('0x8')+_0x17e822,_0x2cebbb);ChatInteractionEvents['on'](_0x17e822,_0x410082);}}; \ No newline at end of file +var _0xcdde=['remove','update','removeListener','register','length','chatInteraction:'];(function(_0x47ad4f,_0x321a17){var _0x5b8f53=function(_0x271ee0){while(--_0x271ee0){_0x47ad4f['push'](_0x47ad4f['shift']());}};_0x5b8f53(++_0x321a17);}(_0xcdde,0xcc));var _0xecdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdde[_0x3dd15e];return _0x231fd0;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0xecdd('0x0'),_0xecdd('0x1')];function createListener(_0x31896a,_0x16fa58){return function(_0xbaa439){_0x16fa58['emit'](_0x31896a,_0xbaa439);};}function removeListener(_0x56a179,_0x13a725){return function(){ChatInteractionEvents[_0xecdd('0x2')](_0x56a179,_0x13a725);};}exports[_0xecdd('0x3')]=function(_0x4ad31c){for(var _0x4079d0=0x0,_0x34153a=events[_0xecdd('0x4')];_0x4079d0<_0x34153a;_0x4079d0++){var _0x2a7820=events[_0x4079d0];var _0x72c7c4=createListener(_0xecdd('0x5')+_0x2a7820,_0x4ad31c);ChatInteractionEvents['on'](_0x2a7820,_0x72c7c4);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 48754aa..4198b82 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 _0x3553=['delete','chatinteraction:destroy','destroy','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','/:id/vidaoo','diskStorage','join','server/files/attachments/','format','now','originalname','replace','/:id/attachment_upload','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','customUpdate','/:id/abandon','/:id/close','close'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x3553,0xc7));var _0x3355=function(_0x144051,_0xde7701){_0x144051=_0x144051-0x0;var _0x1c0dc1=_0x3553[_0x144051];return _0x1c0dc1;};'use strict';var multer=require('multer');var util=require(_0x3355('0x0'));var path=require(_0x3355('0x1'));var timeout=require('connect-timeout');var express=require(_0x3355('0x2'));var router=express['Router']();var fs_extra=require(_0x3355('0x3'));var auth=require(_0x3355('0x4'));var interaction=require(_0x3355('0x5'));var config=require('../../config/environment');var controller=require(_0x3355('0x6'));router[_0x3355('0x7')]('/',auth['isAuthenticated'](),controller[_0x3355('0x8')]);router['get'](_0x3355('0x9'),auth[_0x3355('0xa')](),controller[_0x3355('0xb')]);router['get'](_0x3355('0xc'),auth[_0x3355('0xd')](),controller[_0x3355('0xe')]);router['get'](_0x3355('0xf'),auth[_0x3355('0xd')](),controller[_0x3355('0x10')]);router['get'](_0x3355('0x11'),auth['isAuthenticated'](),controller[_0x3355('0x12')]);router[_0x3355('0x7')](_0x3355('0x13'),auth['isChatInteractionAuthorized'](),controller[_0x3355('0x14')]);router[_0x3355('0x7')](_0x3355('0x15'),auth[_0x3355('0xa')](),controller[_0x3355('0x16')]);router[_0x3355('0x17')]('/',auth[_0x3355('0xa')](),controller['create']);router[_0x3355('0x17')](_0x3355('0x18'),auth[_0x3355('0xa')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x3355('0x19')]({'destination':function(_0x2ae531,_0x40071a,_0x526f20){_0x526f20(null,path[_0x3355('0x1a')](config['root'],_0x3355('0x1b')));},'filename':function(_0x52efce,_0x218abf,_0x476067){_0x476067(null,util[_0x3355('0x1c')]('%s-%s',Date[_0x3355('0x1d')](),_0x218abf[_0x3355('0x1e')][_0x3355('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x3355('0x17')](_0x3355('0x20'),upload['single'](_0x3355('0x21')),controller[_0x3355('0x22')]);router['post']('/:id/messages',auth['isChatInteractionAuthorized'](),controller[_0x3355('0x23')]);router[_0x3355('0x17')](_0x3355('0x24'),auth['isAuthenticated'](),interaction[_0x3355('0x25')](_0x3355('0x26'),_0x3355('0x27')),controller[_0x3355('0x28')]);router[_0x3355('0x29')](_0x3355('0xc'),auth[_0x3355('0xa')](),interaction['tracked'](_0x3355('0x26'),'chatinteraction:update'),controller['update']);router[_0x3355('0x29')]('/:id/custom_update',controller[_0x3355('0x2a')]);router[_0x3355('0x29')](_0x3355('0x2b'),auth[_0x3355('0xd')](),controller['abandon']);router[_0x3355('0x29')](_0x3355('0x2c'),controller[_0x3355('0x2d')]);router[_0x3355('0x2e')](_0x3355('0xc'),auth[_0x3355('0xa')](),interaction[_0x3355('0x25')](_0x3355('0x26'),_0x3355('0x2f')),controller[_0x3355('0x30')]);router['delete'](_0x3355('0x24'),auth[_0x3355('0xa')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x308b=['server/files/attachments/','format','now','originalname','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','customUpdate','abandon','close','delete','chatinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','download','post','/:id/vidaoo','createVidaooSession','join','root'];(function(_0x4ecc60,_0x29b89f){var _0x23aba2=function(_0x2b0b1e){while(--_0x2b0b1e){_0x4ecc60['push'](_0x4ecc60['shift']());}};_0x23aba2(++_0x29b89f);}(_0x308b,0x82));var _0xb308=function(_0x396648,_0x422e03){_0x396648=_0x396648-0x0;var _0x5d5db2=_0x308b[_0x396648];return _0x5d5db2;};'use strict';var multer=require(_0xb308('0x0'));var util=require(_0xb308('0x1'));var path=require(_0xb308('0x2'));var timeout=require(_0xb308('0x3'));var express=require(_0xb308('0x4'));var router=express[_0xb308('0x5')]();var fs_extra=require(_0xb308('0x6'));var auth=require(_0xb308('0x7'));var interaction=require(_0xb308('0x8'));var config=require(_0xb308('0x9'));var controller=require(_0xb308('0xa'));router[_0xb308('0xb')]('/',auth[_0xb308('0xc')](),controller[_0xb308('0xd')]);router[_0xb308('0xb')]('/describe',auth['isAuthenticated'](),controller[_0xb308('0xe')]);router['get'](_0xb308('0xf'),auth[_0xb308('0x10')](),controller[_0xb308('0x11')]);router[_0xb308('0xb')](_0xb308('0x12'),auth[_0xb308('0x10')](),controller[_0xb308('0x13')]);router[_0xb308('0xb')](_0xb308('0x14'),auth['isAuthenticated'](),controller['getMessages']);router[_0xb308('0xb')](_0xb308('0x15'),auth[_0xb308('0x10')](),controller[_0xb308('0x16')]);router['get']('/:id/download',auth[_0xb308('0xc')](),controller[_0xb308('0x17')]);router[_0xb308('0x18')]('/',auth[_0xb308('0xc')](),controller['create']);router[_0xb308('0x18')](_0xb308('0x19'),auth[_0xb308('0xc')](),controller[_0xb308('0x1a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x386293,_0x1ab1fd,_0x12f74d){_0x12f74d(null,path[_0xb308('0x1b')](config[_0xb308('0x1c')],_0xb308('0x1d')));},'filename':function(_0x46d771,_0x2694f0,_0x510bf1){_0x510bf1(null,util[_0xb308('0x1e')]('%s-%s',Date[_0xb308('0x1f')](),_0x2694f0[_0xb308('0x20')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xb308('0x18')](_0xb308('0x21'),upload[_0xb308('0x22')](_0xb308('0x23')),controller[_0xb308('0x24')]);router[_0xb308('0x18')]('/:id/messages',auth[_0xb308('0x10')](),controller[_0xb308('0x25')]);router[_0xb308('0x18')](_0xb308('0x26'),auth[_0xb308('0xc')](),interaction[_0xb308('0x27')](_0xb308('0x28'),_0xb308('0x29')),controller[_0xb308('0x2a')]);router[_0xb308('0x2b')](_0xb308('0xf'),auth[_0xb308('0xc')](),interaction[_0xb308('0x27')](_0xb308('0x28'),_0xb308('0x2c')),controller[_0xb308('0x2d')]);router['put']('/:id/custom_update',controller[_0xb308('0x2e')]);router['put']('/:id/abandon',auth[_0xb308('0x10')](),controller[_0xb308('0x2f')]);router[_0xb308('0x2b')]('/:id/close',controller[_0xb308('0x30')]);router[_0xb308('0x31')]('/:id',auth[_0xb308('0xc')](),interaction[_0xb308('0x27')](_0xb308('0x28'),_0xb308('0x32')),controller[_0xb308('0x33')]);router[_0xb308('0x31')](_0xb308('0x26'),auth[_0xb308('0xc')](),controller[_0xb308('0x34')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 87013a7..ddd952e 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 _0x0ede=['INTEGER','BOOLEAN'];(function(_0x50c0a0,_0x29e026){var _0x561aa7=function(_0x453ed3){while(--_0x453ed3){_0x50c0a0['push'](_0x50c0a0['shift']());}};_0x561aa7(++_0x29e026);}(_0x0ede,0x119));var _0xe0ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0ede[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe0ed('0x0')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xe0ed('0x1')]}}; \ No newline at end of file +var _0x5507=['BOOLEAN','exports','TEXT','medium'];(function(_0x23b9cb,_0x4c09f9){var _0x128f3a=function(_0x42714a){while(--_0x42714a){_0x23b9cb['push'](_0x23b9cb['shift']());}};_0x128f3a(++_0x4c09f9);}(_0x5507,0xf5));var _0x7550=function(_0x4be52a,_0x5548d4){_0x4be52a=_0x4be52a-0x0;var _0x5e24e7=_0x5507[_0x4be52a];return _0x5e24e7;};'use strict';var Sequelize=require('sequelize');module[_0x7550('0x0')]={'body':{'type':Sequelize[_0x7550('0x1')](_0x7550('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x7550('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 36b6cc0..62ef5b7 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 _0x6fbf=['save','update','then','destroy','end','error','name','send','map','ChatInternalMessage','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length','limit','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','params','keys','intersection','includeAll','find','create','body','describe','get','lastMessageAt','createdAt','lastMessage','getUsers','agent','admin','user','fullname','userpic','internal','lastLoginAt','showWebBar','-online','VoiceQueues','role','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','resourceId','push','messages','ToId','-createdAt','all','eml-format','rimraf','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject'];(function(_0x1f1876,_0x53c2f8){var _0xf5ba8c=function(_0x3748e5){while(--_0x3748e5){_0x1f1876['push'](_0x1f1876['shift']());}};_0xf5ba8c(++_0x53c2f8);}(_0x6fbf,0x11d));var _0xf6fb=function(_0x137d1d,_0x35c663){_0x137d1d=_0x137d1d-0x0;var _0x485108=_0x6fbf[_0x137d1d];return _0x485108;};'use strict';var emlformat=require(_0xf6fb('0x0'));var rimraf=require(_0xf6fb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf6fb('0x2'));var rp=require(_0xf6fb('0x3'));var moment=require(_0xf6fb('0x4'));var BPromise=require(_0xf6fb('0x5'));var Mustache=require('mustache');var util=require(_0xf6fb('0x6'));var path=require(_0xf6fb('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf6fb('0x8'));var fs=require('fs');var fs_extra=require(_0xf6fb('0x9'));var _=require(_0xf6fb('0xa'));var squel=require(_0xf6fb('0xb'));var crypto=require(_0xf6fb('0xc'));var jsforce=require(_0xf6fb('0xd'));var deskjs=require(_0xf6fb('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf6fb('0xf'));var Papa=require(_0xf6fb('0x10'));var Redis=require(_0xf6fb('0x11'));var authService=require(_0xf6fb('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf6fb('0x13'));var hardwareService=require(_0xf6fb('0x14'));var logger=require(_0xf6fb('0x15'))(_0xf6fb('0x16'));var utils=require(_0xf6fb('0x17'));var config=require(_0xf6fb('0x18'));var licenseUtil=require(_0xf6fb('0x19'));var db=require(_0xf6fb('0x1a'))['db'];config[_0xf6fb('0x1b')]=_[_0xf6fb('0x1c')](config['redis'],{'host':_0xf6fb('0x1d'),'port':0x18eb});var socket=require(_0xf6fb('0x1e'))(new Redis(config[_0xf6fb('0x1b')]));require(_0xf6fb('0x1f'))['register'](socket);function respondWithStatusCode(_0x10e883,_0x18ccd5){_0x18ccd5=_0x18ccd5||0xcc;return function(_0x2f6892){if(_0x2f6892){return _0x10e883[_0xf6fb('0x20')](_0x18ccd5);}return _0x10e883[_0xf6fb('0x21')](_0x18ccd5)['end']();};}function respondWithResult(_0x3cf911,_0x179b55){_0x179b55=_0x179b55||0xc8;return function(_0x51f586){if(_0x51f586){return _0x3cf911[_0xf6fb('0x21')](_0x179b55)[_0xf6fb('0x22')](_0x51f586);}};}function respondWithFilteredResult(_0x51549c,_0x3d5a35){return function(_0x3f6a1f){if(_0x3f6a1f){var _0x5e4eb5=typeof _0x3d5a35[_0xf6fb('0x23')]===_0xf6fb('0x24')&&typeof _0x3d5a35['limit']===_0xf6fb('0x24');var _0x4f30b6=_0x3f6a1f[_0xf6fb('0x25')];var _0x313919=_0x5e4eb5?0x0:_0x3d5a35['offset'];var _0x4a00bf=_0x5e4eb5?_0x3f6a1f[_0xf6fb('0x25')]:_0x3d5a35[_0xf6fb('0x23')]+_0x3d5a35['limit'];var _0x192fb8;if(_0x4a00bf>=_0x4f30b6){_0x4a00bf=_0x4f30b6;_0x192fb8=0xc8;}else{_0x192fb8=0xce;}_0x51549c[_0xf6fb('0x21')](_0x192fb8);return _0x51549c[_0xf6fb('0x26')](_0xf6fb('0x27'),_0x313919+'-'+_0x4a00bf+'/'+_0x4f30b6)[_0xf6fb('0x22')](_0x3f6a1f);}return null;};}function patchUpdates(_0x46132d){return function(_0x5294a6){try{jsonpatch[_0xf6fb('0x28')](_0x5294a6,_0x46132d,!![]);}catch(_0x3462b9){return BPromise[_0xf6fb('0x29')](_0x3462b9);}return _0x5294a6[_0xf6fb('0x2a')]();};}function saveUpdates(_0x945a23,_0xcf6d49){return function(_0x34c5b5){if(_0x34c5b5){return _0x34c5b5[_0xf6fb('0x2b')](_0x945a23)[_0xf6fb('0x2c')](function(_0x1bb41e){return _0x1bb41e;});}return null;};}function removeEntity(_0x21cb5b,_0x1d1f39){return function(_0x40d98e){if(_0x40d98e){return _0x40d98e[_0xf6fb('0x2d')]()[_0xf6fb('0x2c')](function(){_0x21cb5b[_0xf6fb('0x21')](0xcc)[_0xf6fb('0x2e')]();});}};}function handleEntityNotFound(_0x4c6a34,_0x51a9a7){return function(_0x5c478b){if(!_0x5c478b){_0x4c6a34['sendStatus'](0x194);}return _0x5c478b;};}function handleError(_0x353371,_0x2d8eb2){_0x2d8eb2=_0x2d8eb2||0x1f4;return function(_0x3854c9){logger[_0xf6fb('0x2f')](_0x3854c9['stack']);if(_0x3854c9[_0xf6fb('0x30')]){delete _0x3854c9[_0xf6fb('0x30')];}_0x353371[_0xf6fb('0x21')](_0x2d8eb2)[_0xf6fb('0x31')](_0x3854c9);};}exports['index']=function(_0x2f3321,_0x36e848){var _0x4b54e0={},_0x12d944={},_0x470793={'count':0x0,'rows':[]};var _0x5e48ed=_[_0xf6fb('0x32')](db[_0xf6fb('0x33')][_0xf6fb('0x34')],function(_0x4a613d){return{'name':_0x4a613d[_0xf6fb('0x35')],'type':_0x4a613d['type'][_0xf6fb('0x36')]};});_0x12d944[_0xf6fb('0x37')]=_[_0xf6fb('0x32')](_0x5e48ed,_0xf6fb('0x30'));_0x12d944[_0xf6fb('0x38')]=_['keys'](_0x2f3321[_0xf6fb('0x38')]);_0x12d944[_0xf6fb('0x39')]=_['intersection'](_0x12d944[_0xf6fb('0x37')],_0x12d944['query']);_0x4b54e0[_0xf6fb('0x3a')]=_['intersection'](_0x12d944[_0xf6fb('0x37')],qs[_0xf6fb('0x3b')](_0x2f3321[_0xf6fb('0x38')][_0xf6fb('0x3b')]));_0x4b54e0[_0xf6fb('0x3a')]=_0x4b54e0[_0xf6fb('0x3a')][_0xf6fb('0x3c')]?_0x4b54e0[_0xf6fb('0x3a')]:_0x12d944[_0xf6fb('0x37')];if(!_0x2f3321[_0xf6fb('0x38')]['hasOwnProperty']('nolimit')){_0x4b54e0[_0xf6fb('0x3d')]=qs[_0xf6fb('0x3d')](_0x2f3321[_0xf6fb('0x38')][_0xf6fb('0x3d')]);_0x4b54e0[_0xf6fb('0x23')]=qs['offset'](_0x2f3321['query'][_0xf6fb('0x23')]);}_0x4b54e0[_0xf6fb('0x3e')]=qs[_0xf6fb('0x3f')](_0x2f3321[_0xf6fb('0x38')][_0xf6fb('0x3f')]);_0x4b54e0[_0xf6fb('0x40')]=qs[_0xf6fb('0x39')](_['pick'](_0x2f3321[_0xf6fb('0x38')],_0x12d944[_0xf6fb('0x39')]),_0x5e48ed);if(_0x2f3321['query'][_0xf6fb('0x41')]){_0x4b54e0[_0xf6fb('0x40')]=_[_0xf6fb('0x42')](_0x4b54e0[_0xf6fb('0x40')],{'$or':_[_0xf6fb('0x32')](_0x5e48ed,function(_0x1cad53){if(_0x1cad53[_0xf6fb('0x43')]!==_0xf6fb('0x44')){var _0x170002={};_0x170002[_0x1cad53[_0xf6fb('0x30')]]={'$like':'%'+_0x2f3321[_0xf6fb('0x38')][_0xf6fb('0x41')]+'%'};return _0x170002;}})});}_0x4b54e0=_[_0xf6fb('0x42')]({},_0x4b54e0,_0x2f3321[_0xf6fb('0x45')]);var _0x238495={'where':_0x4b54e0[_0xf6fb('0x40')]};return db[_0xf6fb('0x33')][_0xf6fb('0x25')](_0x238495)[_0xf6fb('0x2c')](function(_0x17ab5b){_0x470793['count']=_0x17ab5b;if(_0x2f3321['query']['includeAll']){_0x4b54e0[_0xf6fb('0x46')]=[{'all':!![]}];}return db[_0xf6fb('0x33')][_0xf6fb('0x47')](_0x4b54e0);})[_0xf6fb('0x2c')](function(_0x436899){_0x470793[_0xf6fb('0x48')]=_0x436899;return _0x470793;})[_0xf6fb('0x2c')](respondWithFilteredResult(_0x36e848,_0x4b54e0))[_0xf6fb('0x49')](handleError(_0x36e848,null));};exports['show']=function(_0x511127,_0x4e39fd){var _0x25f910={'raw':!![],'where':{'id':_0x511127[_0xf6fb('0x4a')]['id']}},_0x384ba9={};_0x384ba9[_0xf6fb('0x37')]=_[_0xf6fb('0x4b')](db['ChatInternalMessage'][_0xf6fb('0x34')]);_0x384ba9[_0xf6fb('0x38')]=_[_0xf6fb('0x4b')](_0x511127[_0xf6fb('0x38')]);_0x384ba9[_0xf6fb('0x39')]=_[_0xf6fb('0x4c')](_0x384ba9['model'],_0x384ba9[_0xf6fb('0x38')]);_0x25f910[_0xf6fb('0x3a')]=_[_0xf6fb('0x4c')](_0x384ba9['model'],qs[_0xf6fb('0x3b')](_0x511127[_0xf6fb('0x38')][_0xf6fb('0x3b')]));_0x25f910[_0xf6fb('0x3a')]=_0x25f910[_0xf6fb('0x3a')][_0xf6fb('0x3c')]?_0x25f910[_0xf6fb('0x3a')]:_0x384ba9[_0xf6fb('0x37')];if(_0x511127[_0xf6fb('0x38')][_0xf6fb('0x4d')]){_0x25f910[_0xf6fb('0x46')]=[{'all':!![]}];}_0x25f910=_[_0xf6fb('0x42')]({},_0x25f910,_0x511127['options']);return db['ChatInternalMessage'][_0xf6fb('0x4e')](_0x25f910)[_0xf6fb('0x2c')](handleEntityNotFound(_0x4e39fd,null))[_0xf6fb('0x2c')](respondWithResult(_0x4e39fd,null))[_0xf6fb('0x49')](handleError(_0x4e39fd,null));};exports[_0xf6fb('0x4f')]=function(_0x33ea97,_0x8e3fd4){return db[_0xf6fb('0x33')][_0xf6fb('0x4f')](_0x33ea97[_0xf6fb('0x50')],{})[_0xf6fb('0x2c')](respondWithResult(_0x8e3fd4,0xc9))[_0xf6fb('0x49')](handleError(_0x8e3fd4,null));};exports[_0xf6fb('0x2b')]=function(_0x550274,_0x3f1c8b){if(_0x550274[_0xf6fb('0x50')]['id']){delete _0x550274[_0xf6fb('0x50')]['id'];}return db[_0xf6fb('0x33')][_0xf6fb('0x4e')]({'where':{'id':_0x550274[_0xf6fb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3f1c8b,null))[_0xf6fb('0x2c')](saveUpdates(_0x550274[_0xf6fb('0x50')],null))['then'](respondWithResult(_0x3f1c8b,null))[_0xf6fb('0x49')](handleError(_0x3f1c8b,null));};exports[_0xf6fb('0x2d')]=function(_0x252a6a,_0x537a62){return db['ChatInternalMessage'][_0xf6fb('0x4e')]({'where':{'id':_0x252a6a[_0xf6fb('0x4a')]['id']}})[_0xf6fb('0x2c')](handleEntityNotFound(_0x537a62,null))[_0xf6fb('0x2c')](removeEntity(_0x537a62,null))[_0xf6fb('0x49')](handleError(_0x537a62,null));};exports[_0xf6fb('0x51')]=function(_0x3be39f,_0x45f674){return db[_0xf6fb('0x33')][_0xf6fb('0x51')]()[_0xf6fb('0x2c')](respondWithResult(_0x45f674,null))['catch'](handleError(_0x45f674,null));};function wrapUser(_0x53b0a8){return function(_0x34c953){var _0x488e61=_0x53b0a8[_0xf6fb('0x52')]({'plain':!![]});_0x488e61['messages']=[];if(_0x34c953){_0x488e61[_0xf6fb('0x53')]=_0x34c953[_0xf6fb('0x54')];_0x488e61[_0xf6fb('0x55')]=_0x34c953;}else{_0x488e61['lastMessageAt']=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x488e61[_0xf6fb('0x55')]={};}return _0x488e61;};}exports[_0xf6fb('0x56')]=function(_0x157baf,_0x5db440,_0x2bbb66){var _0x1ce3d3=[];return db['User'][_0xf6fb('0x47')]({'where':{'role':[_0xf6fb('0x57'),_0xf6fb('0x58'),_0xf6fb('0x59')]},'attributes':['id',_0xf6fb('0x5a'),_0xf6fb('0x30'),'role',_0xf6fb('0x5b'),_0xf6fb('0x5c'),'online',_0xf6fb('0x5d'),'allowmessenger',_0xf6fb('0x5e')],'order':qs[_0xf6fb('0x3f')](_0xf6fb('0x5f')),'include':[{'model':db['VoiceQueue'],'as':_0xf6fb('0x60'),'attributes':['id',_0xf6fb('0x30'),_0xf6fb('0x43')],'through':{'attributes':[]}}]})[_0xf6fb('0x2c')](function(_0x1be8fb){if(_0x1be8fb){var _0x5ccc5e=_0x157baf[_0xf6fb('0x59')][_0xf6fb('0x52')]({'plain':!![]});if(!_0x5ccc5e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ccc5e[_0xf6fb('0x61')]===_0xf6fb('0x59')){return db[_0xf6fb('0x62')][_0xf6fb('0x4e')]({'where':{'name':_0xf6fb('0x63'),'userProfileId':_0x5ccc5e['userProfileId']},'raw':!![]})[_0xf6fb('0x2c')](function(_0x1dd05a){if(_0x1dd05a){if(_0x1dd05a[_0xf6fb('0x64')]===0x0){return db[_0xf6fb('0x65')][_0xf6fb('0x47')]({'where':{'sectionId':_0x1dd05a['id']},'raw':!![]})['then'](function(_0x2afe00){var _0x13b231=[];if(_[_0xf6fb('0x66')](_0x2afe00)){_0x13b231=_[_0xf6fb('0x41')](_0x1be8fb,function(_0x3fc14b){if(_0x3fc14b[_0xf6fb('0x61')]!=='agent'){return _0x3fc14b;}});return _0x13b231;}else{for(var _0x58e273=0x0;_0x58e273<_0x1be8fb[_0xf6fb('0x3c')];_0x58e273++){var _0x2fa617=_0x1be8fb[_0x58e273];if(_0x2fa617[_0xf6fb('0x61')]===_0xf6fb('0x57')){var _0x145634=_[_0xf6fb('0x4e')](_0x2afe00,function(_0x322829){return _0x322829[_0xf6fb('0x67')]===_0x2fa617['id'];});if(_0x145634)_0x13b231[_0xf6fb('0x68')](_0x2fa617);}else{_0x13b231[_0xf6fb('0x68')](_0x2fa617);}}return _0x13b231;}});}else{return _0x1be8fb;}}else{var _0x1dc214=_['filter'](_0x1be8fb,function(_0x4aa93c){if(_0x4aa93c[_0xf6fb('0x61')]!==_0xf6fb('0x57')){return _0x4aa93c;}});return _0x1dc214;}});}else{return _0x1be8fb;}}})[_0xf6fb('0x2c')](function(_0x576b86){var _0x46dbe6=[];if(_0x576b86){_0x1ce3d3=_0x576b86;for(var _0x1ccce1=0x0;_0x1ccce1<_0x576b86[_0xf6fb('0x3c')];_0x1ccce1+=0x1){_0x1ce3d3[_0x1ccce1][_0xf6fb('0x69')]=[];_0x46dbe6['push'](db[_0xf6fb('0x33')]['find']({'where':{'FromId':[_0x157baf[_0xf6fb('0x59')]['id'],_0x576b86[_0x1ccce1]['id']],'ToId':[_0x157baf[_0xf6fb('0x59')]['id'],_0x576b86[_0x1ccce1]['id']],'ChatGroupId':null},'attributes':['id',_0xf6fb('0x54'),'FromId',_0xf6fb('0x6a'),'read',_0xf6fb('0x50')],'order':qs[_0xf6fb('0x3f')](_0xf6fb('0x6b')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x576b86[_0x1ccce1])));}return BPromise[_0xf6fb('0x6c')](_0x46dbe6);}return[];})[_0xf6fb('0x2c')](function(_0x38e996){return{'rows':_0x38e996,'count':_0x38e996['length']};})[_0xf6fb('0x2c')](respondWithResult(_0x5db440,null))[_0xf6fb('0x49')](handleError(_0x5db440,null));}; \ No newline at end of file +var _0xed0f=['userProfileId','resourceId','push','createdAt','read','-createdAt','all','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','ChatInternalMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','messages','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','agent','admin','internal','online','lastLoginAt','showWebBar','-online','VoiceQueue','VoiceQueues','user','get','role','UserProfileSection','Agents'];(function(_0x9be9b3,_0x3b663f){var _0x54a65f=function(_0x293aff){while(--_0x293aff){_0x9be9b3['push'](_0x9be9b3['shift']());}};_0x54a65f(++_0x3b663f);}(_0xed0f,0x142));var _0xfed0=function(_0x2be0ad,_0x1604b2){_0x2be0ad=_0x2be0ad-0x0;var _0x3c1eac=_0xed0f[_0x2be0ad];return _0x3c1eac;};'use strict';var emlformat=require(_0xfed0('0x0'));var rimraf=require(_0xfed0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfed0('0x2'));var rp=require(_0xfed0('0x3'));var moment=require(_0xfed0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfed0('0x5'));var util=require(_0xfed0('0x6'));var path=require(_0xfed0('0x7'));var sox=require('sox');var csv=require(_0xfed0('0x8'));var ejs=require(_0xfed0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfed0('0xa'));var squel=require(_0xfed0('0xb'));var crypto=require(_0xfed0('0xc'));var jsforce=require(_0xfed0('0xd'));var deskjs=require(_0xfed0('0xe'));var toCsv=require(_0xfed0('0x8'));var querystring=require('querystring');var Papa=require(_0xfed0('0xf'));var Redis=require(_0xfed0('0x10'));var authService=require(_0xfed0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfed0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfed0('0x13'))(_0xfed0('0x14'));var utils=require(_0xfed0('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xfed0('0x16'));var db=require('../../mysqldb')['db'];config[_0xfed0('0x17')]=_[_0xfed0('0x18')](config[_0xfed0('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xfed0('0x19'))(new Redis(config[_0xfed0('0x17')]));require(_0xfed0('0x1a'))[_0xfed0('0x1b')](socket);function respondWithStatusCode(_0x234fdf,_0x2bafb2){_0x2bafb2=_0x2bafb2||0xcc;return function(_0x50b54d){if(_0x50b54d){return _0x234fdf['sendStatus'](_0x2bafb2);}return _0x234fdf[_0xfed0('0x1c')](_0x2bafb2)['end']();};}function respondWithResult(_0x33da9c,_0x129590){_0x129590=_0x129590||0xc8;return function(_0x1e8428){if(_0x1e8428){return _0x33da9c['status'](_0x129590)[_0xfed0('0x1d')](_0x1e8428);}};}function respondWithFilteredResult(_0x15625a,_0x4410ef){return function(_0xf710b3){if(_0xf710b3){var _0x1b1b58=typeof _0x4410ef[_0xfed0('0x1e')]===_0xfed0('0x1f')&&typeof _0x4410ef['limit']===_0xfed0('0x1f');var _0x148ecc=_0xf710b3[_0xfed0('0x20')];var _0x16661d=_0x1b1b58?0x0:_0x4410ef['offset'];var _0x2bc6bb=_0x1b1b58?_0xf710b3[_0xfed0('0x20')]:_0x4410ef[_0xfed0('0x1e')]+_0x4410ef[_0xfed0('0x21')];var _0x1be748;if(_0x2bc6bb>=_0x148ecc){_0x2bc6bb=_0x148ecc;_0x1be748=0xc8;}else{_0x1be748=0xce;}_0x15625a[_0xfed0('0x1c')](_0x1be748);return _0x15625a[_0xfed0('0x22')](_0xfed0('0x23'),_0x16661d+'-'+_0x2bc6bb+'/'+_0x148ecc)[_0xfed0('0x1d')](_0xf710b3);}return null;};}function patchUpdates(_0x246eee){return function(_0x4529d2){try{jsonpatch['apply'](_0x4529d2,_0x246eee,!![]);}catch(_0x1a044b){return BPromise['reject'](_0x1a044b);}return _0x4529d2['save']();};}function saveUpdates(_0x338e85,_0x2fdc43){return function(_0x44745f){if(_0x44745f){return _0x44745f[_0xfed0('0x24')](_0x338e85)[_0xfed0('0x25')](function(_0x3ba047){return _0x3ba047;});}return null;};}function removeEntity(_0x2b2ad4,_0x2e0d38){return function(_0x152cf9){if(_0x152cf9){return _0x152cf9[_0xfed0('0x26')]()[_0xfed0('0x25')](function(){_0x2b2ad4[_0xfed0('0x1c')](0xcc)[_0xfed0('0x27')]();});}};}function handleEntityNotFound(_0x540a6c,_0x1f8121){return function(_0xe8fd74){if(!_0xe8fd74){_0x540a6c[_0xfed0('0x28')](0x194);}return _0xe8fd74;};}function handleError(_0x253370,_0x2c79a7){_0x2c79a7=_0x2c79a7||0x1f4;return function(_0x5c9999){logger[_0xfed0('0x29')](_0x5c9999[_0xfed0('0x2a')]);if(_0x5c9999[_0xfed0('0x2b')]){delete _0x5c9999[_0xfed0('0x2b')];}_0x253370[_0xfed0('0x1c')](_0x2c79a7)[_0xfed0('0x2c')](_0x5c9999);};}exports['index']=function(_0x2e18ea,_0x10d905){var _0x4b9634={},_0x1005d7={},_0x25a27b={'count':0x0,'rows':[]};var _0x38f9c6=_['map'](db[_0xfed0('0x2d')][_0xfed0('0x2e')],function(_0x133f0c){return{'name':_0x133f0c[_0xfed0('0x2f')],'type':_0x133f0c[_0xfed0('0x30')][_0xfed0('0x31')]};});_0x1005d7[_0xfed0('0x32')]=_[_0xfed0('0x33')](_0x38f9c6,_0xfed0('0x2b'));_0x1005d7[_0xfed0('0x34')]=_[_0xfed0('0x35')](_0x2e18ea[_0xfed0('0x34')]);_0x1005d7[_0xfed0('0x36')]=_[_0xfed0('0x37')](_0x1005d7[_0xfed0('0x32')],_0x1005d7['query']);_0x4b9634[_0xfed0('0x38')]=_[_0xfed0('0x37')](_0x1005d7[_0xfed0('0x32')],qs['fields'](_0x2e18ea[_0xfed0('0x34')][_0xfed0('0x39')]));_0x4b9634['attributes']=_0x4b9634[_0xfed0('0x38')][_0xfed0('0x3a')]?_0x4b9634[_0xfed0('0x38')]:_0x1005d7[_0xfed0('0x32')];if(!_0x2e18ea[_0xfed0('0x34')][_0xfed0('0x3b')](_0xfed0('0x3c'))){_0x4b9634[_0xfed0('0x21')]=qs[_0xfed0('0x21')](_0x2e18ea[_0xfed0('0x34')]['limit']);_0x4b9634[_0xfed0('0x1e')]=qs[_0xfed0('0x1e')](_0x2e18ea['query'][_0xfed0('0x1e')]);}_0x4b9634[_0xfed0('0x3d')]=qs[_0xfed0('0x3e')](_0x2e18ea[_0xfed0('0x34')][_0xfed0('0x3e')]);_0x4b9634[_0xfed0('0x3f')]=qs[_0xfed0('0x36')](_[_0xfed0('0x40')](_0x2e18ea[_0xfed0('0x34')],_0x1005d7[_0xfed0('0x36')]),_0x38f9c6);if(_0x2e18ea[_0xfed0('0x34')]['filter']){_0x4b9634[_0xfed0('0x3f')]=_[_0xfed0('0x41')](_0x4b9634['where'],{'$or':_[_0xfed0('0x33')](_0x38f9c6,function(_0x3ec75d){if(_0x3ec75d[_0xfed0('0x30')]!=='VIRTUAL'){var _0x50eb47={};_0x50eb47[_0x3ec75d[_0xfed0('0x2b')]]={'$like':'%'+_0x2e18ea[_0xfed0('0x34')][_0xfed0('0x42')]+'%'};return _0x50eb47;}})});}_0x4b9634=_[_0xfed0('0x41')]({},_0x4b9634,_0x2e18ea[_0xfed0('0x43')]);var _0x3ccd02={'where':_0x4b9634[_0xfed0('0x3f')]};return db[_0xfed0('0x2d')][_0xfed0('0x20')](_0x3ccd02)[_0xfed0('0x25')](function(_0xebb2d){_0x25a27b[_0xfed0('0x20')]=_0xebb2d;if(_0x2e18ea['query'][_0xfed0('0x44')]){_0x4b9634[_0xfed0('0x45')]=[{'all':!![]}];}return db[_0xfed0('0x2d')][_0xfed0('0x46')](_0x4b9634);})[_0xfed0('0x25')](function(_0x106d8e){_0x25a27b[_0xfed0('0x47')]=_0x106d8e;return _0x25a27b;})['then'](respondWithFilteredResult(_0x10d905,_0x4b9634))['catch'](handleError(_0x10d905,null));};exports[_0xfed0('0x48')]=function(_0xefd7c4,_0xa3c075){var _0x339d7c={'raw':!![],'where':{'id':_0xefd7c4[_0xfed0('0x49')]['id']}},_0x2ac1ce={};_0x2ac1ce['model']=_[_0xfed0('0x35')](db['ChatInternalMessage'][_0xfed0('0x2e')]);_0x2ac1ce[_0xfed0('0x34')]=_['keys'](_0xefd7c4['query']);_0x2ac1ce[_0xfed0('0x36')]=_['intersection'](_0x2ac1ce[_0xfed0('0x32')],_0x2ac1ce[_0xfed0('0x34')]);_0x339d7c['attributes']=_['intersection'](_0x2ac1ce[_0xfed0('0x32')],qs['fields'](_0xefd7c4['query'][_0xfed0('0x39')]));_0x339d7c[_0xfed0('0x38')]=_0x339d7c[_0xfed0('0x38')][_0xfed0('0x3a')]?_0x339d7c['attributes']:_0x2ac1ce[_0xfed0('0x32')];if(_0xefd7c4[_0xfed0('0x34')][_0xfed0('0x44')]){_0x339d7c['include']=[{'all':!![]}];}_0x339d7c=_[_0xfed0('0x41')]({},_0x339d7c,_0xefd7c4[_0xfed0('0x43')]);return db[_0xfed0('0x2d')][_0xfed0('0x4a')](_0x339d7c)[_0xfed0('0x25')](handleEntityNotFound(_0xa3c075,null))['then'](respondWithResult(_0xa3c075,null))[_0xfed0('0x4b')](handleError(_0xa3c075,null));};exports['create']=function(_0x24667f,_0xddb5e9){return db[_0xfed0('0x2d')][_0xfed0('0x4c')](_0x24667f['body'],{})[_0xfed0('0x25')](respondWithResult(_0xddb5e9,0xc9))[_0xfed0('0x4b')](handleError(_0xddb5e9,null));};exports[_0xfed0('0x24')]=function(_0x11fa29,_0x1efcaf){if(_0x11fa29[_0xfed0('0x4d')]['id']){delete _0x11fa29[_0xfed0('0x4d')]['id'];}return db[_0xfed0('0x2d')]['find']({'where':{'id':_0x11fa29[_0xfed0('0x49')]['id']}})[_0xfed0('0x25')](handleEntityNotFound(_0x1efcaf,null))[_0xfed0('0x25')](saveUpdates(_0x11fa29[_0xfed0('0x4d')],null))[_0xfed0('0x25')](respondWithResult(_0x1efcaf,null))[_0xfed0('0x4b')](handleError(_0x1efcaf,null));};exports[_0xfed0('0x26')]=function(_0x2f77f6,_0x4a4fe5){return db['ChatInternalMessage'][_0xfed0('0x4a')]({'where':{'id':_0x2f77f6[_0xfed0('0x49')]['id']}})[_0xfed0('0x25')](handleEntityNotFound(_0x4a4fe5,null))[_0xfed0('0x25')](removeEntity(_0x4a4fe5,null))[_0xfed0('0x4b')](handleError(_0x4a4fe5,null));};exports[_0xfed0('0x4e')]=function(_0x35564f,_0x5af5f5){return db[_0xfed0('0x2d')][_0xfed0('0x4e')]()[_0xfed0('0x25')](respondWithResult(_0x5af5f5,null))[_0xfed0('0x4b')](handleError(_0x5af5f5,null));};function wrapUser(_0x1faa85){return function(_0x7520d8){var _0x195822=_0x1faa85['get']({'plain':!![]});_0x195822[_0xfed0('0x4f')]=[];if(_0x7520d8){_0x195822['lastMessageAt']=_0x7520d8['createdAt'];_0x195822['lastMessage']=_0x7520d8;}else{_0x195822['lastMessageAt']=moment(0x0)[_0xfed0('0x50')](_0xfed0('0x51'));_0x195822[_0xfed0('0x52')]={};}return _0x195822;};}exports[_0xfed0('0x53')]=function(_0x550de5,_0x251bf0,_0x35515b){var _0x2035af=[];return db['User']['findAll']({'where':{'role':[_0xfed0('0x54'),_0xfed0('0x55'),'user']},'attributes':['id','fullname',_0xfed0('0x2b'),'role','userpic',_0xfed0('0x56'),_0xfed0('0x57'),_0xfed0('0x58'),'allowmessenger',_0xfed0('0x59')],'order':qs['sort'](_0xfed0('0x5a')),'include':[{'model':db[_0xfed0('0x5b')],'as':_0xfed0('0x5c'),'attributes':['id',_0xfed0('0x2b'),_0xfed0('0x30')],'through':{'attributes':[]}}]})[_0xfed0('0x25')](function(_0x369bfe){if(_0x369bfe){var _0x445e54=_0x550de5[_0xfed0('0x5d')][_0xfed0('0x5e')]({'plain':!![]});if(!_0x445e54)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x445e54[_0xfed0('0x5f')]===_0xfed0('0x5d')){return db[_0xfed0('0x60')][_0xfed0('0x4a')]({'where':{'name':_0xfed0('0x61'),'userProfileId':_0x445e54[_0xfed0('0x62')]},'raw':!![]})[_0xfed0('0x25')](function(_0x163375){if(_0x163375){if(_0x163375['autoAssociation']===0x0){return db['UserProfileResource'][_0xfed0('0x46')]({'where':{'sectionId':_0x163375['id']},'raw':!![]})[_0xfed0('0x25')](function(_0x4e7184){var _0x520925=[];if(_['isEmpty'](_0x4e7184)){_0x520925=_[_0xfed0('0x42')](_0x369bfe,function(_0x2b7a74){if(_0x2b7a74[_0xfed0('0x5f')]!=='agent'){return _0x2b7a74;}});return _0x520925;}else{for(var _0x28ecd5=0x0;_0x28ecd5<_0x369bfe[_0xfed0('0x3a')];_0x28ecd5++){var _0x70223d=_0x369bfe[_0x28ecd5];if(_0x70223d[_0xfed0('0x5f')]===_0xfed0('0x54')){var _0x51a4ee=_[_0xfed0('0x4a')](_0x4e7184,function(_0x88098b){return _0x88098b[_0xfed0('0x63')]===_0x70223d['id'];});if(_0x51a4ee)_0x520925[_0xfed0('0x64')](_0x70223d);}else{_0x520925[_0xfed0('0x64')](_0x70223d);}}return _0x520925;}});}else{return _0x369bfe;}}else{var _0x39cd75=_[_0xfed0('0x42')](_0x369bfe,function(_0x12a79e){if(_0x12a79e[_0xfed0('0x5f')]!==_0xfed0('0x54')){return _0x12a79e;}});return _0x39cd75;}});}else{return _0x369bfe;}}})[_0xfed0('0x25')](function(_0x58b11e){var _0x45e775=[];if(_0x58b11e){_0x2035af=_0x58b11e;for(var _0x2e6521=0x0;_0x2e6521<_0x58b11e[_0xfed0('0x3a')];_0x2e6521+=0x1){_0x2035af[_0x2e6521]['messages']=[];_0x45e775['push'](db[_0xfed0('0x2d')]['find']({'where':{'FromId':[_0x550de5['user']['id'],_0x58b11e[_0x2e6521]['id']],'ToId':[_0x550de5['user']['id'],_0x58b11e[_0x2e6521]['id']],'ChatGroupId':null},'attributes':['id',_0xfed0('0x65'),'FromId','ToId',_0xfed0('0x66'),_0xfed0('0x4d')],'order':qs['sort'](_0xfed0('0x67')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xfed0('0x25')](wrapUser(_0x58b11e[_0x2e6521])));}return BPromise[_0xfed0('0x68')](_0x45e775);}return[];})[_0xfed0('0x25')](function(_0x1e33a9){return{'rows':_0x1e33a9,'count':_0x1e33a9['length']};})['then'](respondWithResult(_0x251bf0,null))['catch'](handleError(_0x251bf0,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 041bdbf..a187864 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 _0x3c42=['emit','hook','ChatInternalMessage','save'];(function(_0x4ce4dc,_0x264735){var _0x1c5e8d=function(_0x21feb1){while(--_0x21feb1){_0x4ce4dc['push'](_0x4ce4dc['shift']());}};_0x1c5e8d(++_0x264735);}(_0x3c42,0x1ee));var _0x23c4=function(_0x12adf0,_0x320e4e){_0x12adf0=_0x12adf0-0x0;var _0x46a439=_0x3c42[_0x12adf0];return _0x46a439;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require('../../mysqldb')['db'][_0x23c4('0x0')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x23c4('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x320354){return function(_0x295219,_0x4bd5c8,_0x3175e3){ChatInternalMessageEvents[_0x23c4('0x2')](_0x320354+':'+_0x295219['id'],_0x295219);ChatInternalMessageEvents[_0x23c4('0x2')](_0x320354,_0x295219);_0x3175e3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x23c4('0x3')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0xb22f=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb22f,0x141));var _0xfb22=function(_0x30022c,_0x3f3cc5){_0x30022c=_0x30022c-0x0;var _0x57d99d=_0xb22f[_0x30022c];return _0x57d99d;};'use strict';var EventEmitter=require(_0xfb22('0x0'));var ChatInternalMessage=require(_0xfb22('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xfb22('0x2')](0x0);var events={'afterCreate':_0xfb22('0x3'),'afterUpdate':'update','afterDestroy':_0xfb22('0x4')};function emitEvent(_0x1bf9de){return function(_0x45ea6d,_0x1170a6,_0x456600){ChatInternalMessageEvents[_0xfb22('0x5')](_0x1bf9de+':'+_0x45ea6d['id'],_0x45ea6d);ChatInternalMessageEvents[_0xfb22('0x5')](_0x1bf9de,_0x45ea6d);_0x456600(null);};}for(var e in events){if(events[_0xfb22('0x6')](e)){var event=events[e];ChatInternalMessage[_0xfb22('0x7')](e,emitEvent(event));}}module[_0xfb22('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 068eb0f..56be012 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 _0x0e53=['util','bluebird','path','rimraf','../../config/environment','./chatInternalMessage.attributes','ChatInternalMessage','utf8mb4'];(function(_0x58b5d7,_0x79ca8a){var _0x817269=function(_0x58dd9f){while(--_0x58dd9f){_0x58b5d7['push'](_0x58b5d7['shift']());}};_0x817269(++_0x79ca8a);}(_0x0e53,0x1c0));var _0x30e5=function(_0x4ba7eb,_0x27a677){_0x4ba7eb=_0x4ba7eb-0x0;var _0x7e002b=_0x0e53[_0x4ba7eb];return _0x7e002b;};'use strict';var _=require('lodash');var util=require(_0x30e5('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x30e5('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x30e5('0x2'));var rimraf=require(_0x30e5('0x3'));var config=require(_0x30e5('0x4'));var attributes=require(_0x30e5('0x5'));module['exports']=function(_0xcd1a73,_0x277ad8){return _0xcd1a73['define'](_0x30e5('0x6'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x30e5('0x7'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6661=['chat_internal_messages','utf8mb4','util','../../config/logger','moment','path','rimraf','../../config/environment','exports','define','ChatInternalMessage'];(function(_0x3a97ad,_0x2a9a24){var _0x112c8a=function(_0x1d9f63){while(--_0x1d9f63){_0x3a97ad['push'](_0x3a97ad['shift']());}};_0x112c8a(++_0x2a9a24);}(_0x6661,0x10a));var _0x1666=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x6661[_0x5f309e];return _0x487b5e;};'use strict';var _=require('lodash');var util=require(_0x1666('0x0'));var logger=require(_0x1666('0x1'))('api');var moment=require(_0x1666('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1666('0x3'));var rimraf=require(_0x1666('0x4'));var config=require(_0x1666('0x5'));var attributes=require('./chatInternalMessage.attributes');module[_0x1666('0x6')]=function(_0x30c28f,_0x1cb858){return _0x30c28f[_0x1666('0x7')](_0x1666('0x8'),attributes,{'tableName':_0x1666('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1666('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 864e8a7..105f24e 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 _0x590b=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x590b,0x1cc));var _0xb590=function(_0x54363d,_0x161cf6){_0x54363d=_0x54363d-0x0;var _0x50edf4=_0x590b[_0x54363d];return _0x50edf4;};'use strict';var _=require(_0xb590('0x0'));var util=require(_0xb590('0x1'));var moment=require(_0xb590('0x2'));var BPromise=require(_0xb590('0x3'));var rs=require(_0xb590('0x4'));var fs=require('fs');var Redis=require(_0xb590('0x5'));var db=require(_0xb590('0x6'))['db'];var utils=require(_0xb590('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xb590('0x8'));var jayson=require(_0xb590('0x9'));var client=jayson[_0xb590('0xa')][_0xb590('0xb')]({'port':0x232a});config[_0xb590('0xc')]=_[_0xb590('0xd')](config[_0xb590('0xc')],{'host':_0xb590('0xe'),'port':0x18eb});var socket=require(_0xb590('0xf'))(new Redis(config['redis']));require(_0xb590('0x10'))['register'](socket);function respondWithRpcPromise(_0x1f965a,_0x2fb4d6,_0x170cff){return new BPromise(function(_0x321b18,_0x337c99){return client['request'](_0x1f965a,_0x170cff)['then'](function(_0x469924){logger[_0xb590('0x11')](_0xb590('0x12'),_0x2fb4d6,_0xb590('0x13'));logger[_0xb590('0x14')](_0xb590('0x15'),_0x2fb4d6,'request\x20sent',JSON[_0xb590('0x16')](_0x469924));if(_0x469924[_0xb590('0x17')]){if(_0x469924['error']['code']===0x1f4){logger['error'](_0xb590('0x12'),_0x2fb4d6,_0x469924[_0xb590('0x17')][_0xb590('0x18')]);return _0x337c99(_0x469924[_0xb590('0x17')][_0xb590('0x18')]);}logger[_0xb590('0x17')](_0xb590('0x12'),_0x2fb4d6,_0x469924[_0xb590('0x17')][_0xb590('0x18')]);return _0x321b18(_0x469924['error']['message']);}else{logger[_0xb590('0x11')](_0xb590('0x12'),_0x2fb4d6,_0xb590('0x13'));_0x321b18(_0x469924[_0xb590('0x19')][_0xb590('0x18')]);}})[_0xb590('0x1a')](function(_0x1fb67b){logger['error'](_0xb590('0x12'),_0x2fb4d6,_0x1fb67b);_0x337c99(_0x1fb67b);});});} \ No newline at end of file +var _0x7d3b=['redis','defaults','localhost','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http'];(function(_0x120202,_0x254120){var _0xc5f215=function(_0x13d2be){while(--_0x13d2be){_0x120202['push'](_0x120202['shift']());}};_0xc5f215(++_0x254120);}(_0x7d3b,0x1d9));var _0xb7d3=function(_0x19a38e,_0x5cc39f){_0x19a38e=_0x19a38e-0x0;var _0x30a6f7=_0x7d3b[_0x19a38e];return _0x30a6f7;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb7d3('0x0'));var rs=require(_0xb7d3('0x1'));var fs=require('fs');var Redis=require(_0xb7d3('0x2'));var db=require(_0xb7d3('0x3'))['db'];var utils=require(_0xb7d3('0x4'));var logger=require(_0xb7d3('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb7d3('0x6')]({'port':0x232a});config[_0xb7d3('0x7')]=_[_0xb7d3('0x8')](config[_0xb7d3('0x7')],{'host':_0xb7d3('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb7d3('0x7')]));require(_0xb7d3('0xa'))[_0xb7d3('0xb')](socket);function respondWithRpcPromise(_0x290f22,_0x5d98fc,_0x5729f9){return new BPromise(function(_0x4888fb,_0x2add8a){return client[_0xb7d3('0xc')](_0x290f22,_0x5729f9)[_0xb7d3('0xd')](function(_0x3df2c9){logger[_0xb7d3('0xe')](_0xb7d3('0xf'),_0x5d98fc,_0xb7d3('0x10'));logger[_0xb7d3('0x11')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x5d98fc,_0xb7d3('0x10'),JSON[_0xb7d3('0x12')](_0x3df2c9));if(_0x3df2c9[_0xb7d3('0x13')]){if(_0x3df2c9['error'][_0xb7d3('0x14')]===0x1f4){logger[_0xb7d3('0x13')](_0xb7d3('0xf'),_0x5d98fc,_0x3df2c9[_0xb7d3('0x13')][_0xb7d3('0x15')]);return _0x2add8a(_0x3df2c9['error'][_0xb7d3('0x15')]);}logger[_0xb7d3('0x13')](_0xb7d3('0xf'),_0x5d98fc,_0x3df2c9[_0xb7d3('0x13')]['message']);return _0x4888fb(_0x3df2c9[_0xb7d3('0x13')][_0xb7d3('0x15')]);}else{logger[_0xb7d3('0xe')](_0xb7d3('0xf'),_0x5d98fc,_0xb7d3('0x10'));_0x4888fb(_0x3df2c9[_0xb7d3('0x16')][_0xb7d3('0x15')]);}})[_0xb7d3('0x17')](function(_0x2cbdbb){logger['error'](_0xb7d3('0xf'),_0x5d98fc,_0x2cbdbb);_0x2add8a(_0x2cbdbb);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index ce8cf7a..ce2fc4d 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 _0xd5cc=['emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','remove','update'];(function(_0x1ad258,_0x508d58){var _0x2a6b4a=function(_0x3bf0fe){while(--_0x3bf0fe){_0x1ad258['push'](_0x1ad258['shift']());}};_0x2a6b4a(++_0x508d58);}(_0xd5cc,0x17d));var _0xcd5c=function(_0x22ec55,_0x382deb){_0x22ec55=_0x22ec55-0x0;var _0x179c23=_0xd5cc[_0x22ec55];return _0x179c23;};'use strict';var ChatInternalMessageEvents=require(_0xcd5c('0x0'));var events=['save',_0xcd5c('0x1'),_0xcd5c('0x2')];function createListener(_0xc776a3,_0x1a6284){return function(_0x3bd4ba){_0x1a6284[_0xcd5c('0x3')](_0xc776a3,_0x3bd4ba);};}function removeListener(_0x3f6c84,_0x4cc893){return function(){ChatInternalMessageEvents[_0xcd5c('0x4')](_0x3f6c84,_0x4cc893);};}exports[_0xcd5c('0x5')]=function(_0x38d0e0){for(var _0x2b6a76=0x0,_0x3fd452=events[_0xcd5c('0x6')];_0x2b6a76<_0x3fd452;_0x2b6a76++){var _0x3f62e0=events[_0x2b6a76];var _0x391b23=createListener(_0xcd5c('0x7')+_0x3f62e0,_0x38d0e0);ChatInternalMessageEvents['on'](_0x3f62e0,_0x391b23);}}; \ No newline at end of file +var _0xffe8=['emit','removeListener','length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update'];(function(_0x37807f,_0x409cb8){var _0x5cafd0=function(_0x51b1bd){while(--_0x51b1bd){_0x37807f['push'](_0x37807f['shift']());}};_0x5cafd0(++_0x409cb8);}(_0xffe8,0xec));var _0x8ffe=function(_0x49a697,_0x47ba26){_0x49a697=_0x49a697-0x0;var _0x26448d=_0xffe8[_0x49a697];return _0x26448d;};'use strict';var ChatInternalMessageEvents=require(_0x8ffe('0x0'));var events=[_0x8ffe('0x1'),_0x8ffe('0x2'),_0x8ffe('0x3')];function createListener(_0x5cb339,_0x1885dd){return function(_0x5c0470){_0x1885dd[_0x8ffe('0x4')](_0x5cb339,_0x5c0470);};}function removeListener(_0x421907,_0x451043){return function(){ChatInternalMessageEvents[_0x8ffe('0x5')](_0x421907,_0x451043);};}exports['register']=function(_0x3b9e32){for(var _0x15af12=0x0,_0xd752e6=events[_0x8ffe('0x6')];_0x15af12<_0xd752e6;_0x15af12++){var _0xfa1cf4=events[_0x15af12];var _0xbd5ce1=createListener(_0x8ffe('0x7')+_0xfa1cf4,_0x3b9e32);ChatInternalMessageEvents['on'](_0xfa1cf4,_0xbd5ce1);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index e9f1e26..8c7f520 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 _0xd451=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','getUsers','/:id','show','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x42db3e,_0x4e0e33){var _0x1c86e2=function(_0xf701de){while(--_0xf701de){_0x42db3e['push'](_0x42db3e['shift']());}};_0x1c86e2(++_0x4e0e33);}(_0xd451,0x195));var _0x1d45=function(_0x1f783d,_0x33876d){_0x1f783d=_0x1f783d-0x0;var _0xbb8303=_0xd451[_0x1f783d];return _0xbb8303;};'use strict';var multer=require(_0x1d45('0x0'));var util=require(_0x1d45('0x1'));var path=require(_0x1d45('0x2'));var timeout=require(_0x1d45('0x3'));var express=require(_0x1d45('0x4'));var router=express[_0x1d45('0x5')]();var fs_extra=require(_0x1d45('0x6'));var auth=require(_0x1d45('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1d45('0x8'));var controller=require(_0x1d45('0x9'));router[_0x1d45('0xa')]('/',auth[_0x1d45('0xb')](),controller[_0x1d45('0xc')]);router[_0x1d45('0xa')](_0x1d45('0xd'),auth[_0x1d45('0xb')](),controller[_0x1d45('0xe')]);router[_0x1d45('0xa')]('/users',auth[_0x1d45('0xb')](),controller[_0x1d45('0xf')]);router[_0x1d45('0xa')](_0x1d45('0x10'),auth[_0x1d45('0xb')](),controller[_0x1d45('0x11')]);router[_0x1d45('0x12')]('/',auth[_0x1d45('0xb')](),controller[_0x1d45('0x13')]);router[_0x1d45('0x14')](_0x1d45('0x10'),controller[_0x1d45('0x15')]);router['delete'](_0x1d45('0x10'),auth[_0x1d45('0xb')](),controller[_0x1d45('0x16')]);module[_0x1d45('0x17')]=router; \ No newline at end of file +var _0x5b90=['../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','getUsers','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','fs-extra'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x5b90,0x19d));var _0x05b9=function(_0x188a1d,_0x2249fc){_0x188a1d=_0x188a1d-0x0;var _0x43d0db=_0x5b90[_0x188a1d];return _0x43d0db;};'use strict';var multer=require(_0x05b9('0x0'));var util=require(_0x05b9('0x1'));var path=require(_0x05b9('0x2'));var timeout=require('connect-timeout');var express=require(_0x05b9('0x3'));var router=express['Router']();var fs_extra=require(_0x05b9('0x4'));var auth=require(_0x05b9('0x5'));var interaction=require(_0x05b9('0x6'));var config=require('../../config/environment');var controller=require(_0x05b9('0x7'));router[_0x05b9('0x8')]('/',auth[_0x05b9('0x9')](),controller[_0x05b9('0xa')]);router['get'](_0x05b9('0xb'),auth['isAuthenticated'](),controller['describe']);router['get']('/users',auth[_0x05b9('0x9')](),controller[_0x05b9('0xc')]);router[_0x05b9('0x8')]('/:id',auth[_0x05b9('0x9')](),controller[_0x05b9('0xd')]);router[_0x05b9('0xe')]('/',auth['isAuthenticated'](),controller[_0x05b9('0xf')]);router[_0x05b9('0x10')](_0x05b9('0x11'),controller[_0x05b9('0x12')]);router[_0x05b9('0x13')](_0x05b9('0x11'),auth['isAuthenticated'](),controller[_0x05b9('0x14')]);module[_0x05b9('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 1823c5c..c10b69b 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 _0x88c3=['DATE','STRING','sequelize','TEXT','BOOLEAN','out'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x88c3,0x1ee));var _0x388c=function(_0x35d192,_0x3556f6){_0x35d192=_0x35d192-0x0;var _0x1c0638=_0x88c3[_0x35d192];return _0x1c0638;};'use strict';var Sequelize=require(_0x388c('0x0'));module['exports']={'body':{'type':Sequelize[_0x388c('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x388c('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x388c('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x388c('0x4')]},'providerName':{'type':Sequelize[_0x388c('0x5')]},'providerResponse':{'type':Sequelize[_0x388c('0x1')]}}; \ No newline at end of file +var _0xb7e7=['DATE','STRING','sequelize','TEXT','BOOLEAN','ENUM','out'];(function(_0x3cec8c,_0x3f6c1d){var _0x38032e=function(_0x4ef75b){while(--_0x4ef75b){_0x3cec8c['push'](_0x3cec8c['shift']());}};_0x38032e(++_0x3f6c1d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0xb7e7[_0x45f951];return _0x24756c;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'body':{'type':Sequelize[_0x7b7e('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x7b7e('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x7b7e('0x3')]('in','out'),'defaultValue':_0x7b7e('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x7b7e('0x5')]},'providerName':{'type':Sequelize[_0x7b7e('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 083244b..728e7e6 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 _0xa9e0=['interaction','[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','sequelize','contact','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','chat','ChatInteraction','RejectMessage','rejectMessage','Sequelize','QueryTypes','SELECT','fullname','rejectmessage','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','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','map','ChatMessage','fieldName','type','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','body','find','describe','../../config/logger','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteractionId','isNil','read1stAt','format'];(function(_0x13ad07,_0x29bed6){var _0x3c0ddd=function(_0x5a5500){while(--_0x5a5500){_0x13ad07['push'](_0x13ad07['shift']());}};_0x3c0ddd(++_0x29bed6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5d0880,_0x1985b6,_0x519dfd,_0x16033c){return new BPromise(function(_0x12066b,_0x48f32d){var _0x225616=_0x16033c||client;return _0x225616['request'](_0x5d0880,_0x519dfd)[_0x0a9e('0x1d')](function(_0x478723){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x1985b6,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x478723));if(_0x478723[_0x0a9e('0x24')]){if(_0x478723[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')]['message']);return _0x48f32d(_0x478723[_0x0a9e('0x24')]['message']);}logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x12066b(_0x478723[_0x0a9e('0x24')]['message']);}else{logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));_0x12066b(_0x478723[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x16b1ca){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1985b6,_0x16b1ca);_0x48f32d(_0x16b1ca);});});}function respondWithStatusCode(_0x197ec0,_0x3a8e58){_0x3a8e58=_0x3a8e58||0xcc;return function(_0x40c424){if(_0x40c424){return _0x197ec0[_0x0a9e('0x29')](_0x3a8e58);}return _0x197ec0['status'](_0x3a8e58)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x479bc4,_0x45a1e7){_0x45a1e7=_0x45a1e7||0xc8;return function(_0x5bfb33){if(_0x5bfb33){return _0x479bc4[_0x0a9e('0x2b')](_0x45a1e7)[_0x0a9e('0x2c')](_0x5bfb33);}};}function respondWithFilteredResult(_0x25fba9,_0x14433c){return function(_0x140511){if(_0x140511){var _0x1538a4=typeof _0x14433c[_0x0a9e('0x2d')]===_0x0a9e('0x2e')&&typeof _0x14433c['limit']===_0x0a9e('0x2e');var _0x468813=_0x140511[_0x0a9e('0x2f')];var _0x2ec755=_0x1538a4?0x0:_0x14433c['offset'];var _0x15b200=_0x1538a4?_0x140511[_0x0a9e('0x2f')]:_0x14433c[_0x0a9e('0x2d')]+_0x14433c[_0x0a9e('0x30')];var _0x58b06f;if(_0x15b200>=_0x468813){_0x15b200=_0x468813;_0x58b06f=0xc8;}else{_0x58b06f=0xce;}_0x25fba9[_0x0a9e('0x2b')](_0x58b06f);return _0x25fba9[_0x0a9e('0x31')](_0x0a9e('0x32'),_0x2ec755+'-'+_0x15b200+'/'+_0x468813)[_0x0a9e('0x2c')](_0x140511);}return null;};}function patchUpdates(_0x540530){return function(_0x426950){try{jsonpatch['apply'](_0x426950,_0x540530,!![]);}catch(_0x2407f9){return BPromise[_0x0a9e('0x33')](_0x2407f9);}return _0x426950[_0x0a9e('0x34')]();};}function saveUpdates(_0x33bdb7,_0x25ce3a){return function(_0x5180f1){if(_0x5180f1){return _0x5180f1[_0x0a9e('0x35')](_0x33bdb7)[_0x0a9e('0x1d')](function(_0x40cb85){return _0x40cb85;});}return null;};}function removeEntity(_0x2da5c0,_0x2b45ea){return function(_0x409319){if(_0x409319){return _0x409319[_0x0a9e('0x36')]()[_0x0a9e('0x1d')](function(){_0x2da5c0['status'](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x5e7238,_0x2cc7a0){return function(_0x14b13f){if(!_0x14b13f){_0x5e7238[_0x0a9e('0x29')](0x194);}return _0x14b13f;};}function handleError(_0x3f3d41,_0x567193){_0x567193=_0x567193||0x1f4;return function(_0x191e91){logger[_0x0a9e('0x24')](_0x191e91[_0x0a9e('0x37')]);if(_0x191e91[_0x0a9e('0x38')]){delete _0x191e91['name'];}_0x3f3d41['status'](_0x567193)[_0x0a9e('0x39')](_0x191e91);};}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x31916f=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x1dbf74){return{'name':_0x1dbf74[_0x0a9e('0x3c')],'type':_0x1dbf74[_0x0a9e('0x3d')]['key']};});_0x1ef87a['model']=_[_0x0a9e('0x3a')](_0x31916f,_0x0a9e('0x38'));_0x1ef87a['query']=_[_0x0a9e('0x3e')](_0x24936a[_0x0a9e('0x3f')]);_0x1ef87a[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],_0x1ef87a['query']);_0x381c37[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],qs[_0x0a9e('0x43')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x381c37['attributes']=_0x381c37[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x381c37[_0x0a9e('0x42')]:_0x1ef87a[_0x0a9e('0x45')];if(!_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x46')](_0x0a9e('0x47'))){_0x381c37[_0x0a9e('0x30')]=qs[_0x0a9e('0x30')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x30')]);_0x381c37[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x2d')]);}_0x381c37['order']=qs['sort'](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x381c37[_0x0a9e('0x49')]=qs[_0x0a9e('0x40')](_[_0x0a9e('0x4a')](_0x24936a[_0x0a9e('0x3f')],_0x1ef87a[_0x0a9e('0x40')]),_0x31916f);if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]){_0x381c37[_0x0a9e('0x49')]=_[_0x0a9e('0x4c')](_0x381c37[_0x0a9e('0x49')],{'$or':_['map'](_0x31916f,function(_0x117c99){if(_0x117c99[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0xfbd5ad={};_0xfbd5ad[_0x117c99[_0x0a9e('0x38')]]={'$like':'%'+_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]+'%'};return _0xfbd5ad;}})});}_0x381c37=_[_0x0a9e('0x4c')]({},_0x381c37,_0x24936a['options']);var _0x2e9d90={'where':_0x381c37['where']};return db[_0x0a9e('0x3b')][_0x0a9e('0x2f')](_0x2e9d90)[_0x0a9e('0x1d')](function(_0x562fb4){_0x4f41ae[_0x0a9e('0x2f')]=_0x562fb4;if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4e')]){_0x381c37[_0x0a9e('0x4f')]=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x381c37);})[_0x0a9e('0x1d')](function(_0x5bbcde){_0x4f41ae[_0x0a9e('0x51')]=_0x5bbcde;return _0x4f41ae;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x28')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x52')]=function(_0x409789,_0x992c77){var _0x6054ee={'raw':!![],'where':{'id':_0x409789[_0x0a9e('0x53')]['id']}},_0x19383e={};_0x19383e['model']=_[_0x0a9e('0x3e')](db[_0x0a9e('0x3b')]['rawAttributes']);_0x19383e['query']=_['keys'](_0x409789[_0x0a9e('0x3f')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],_0x19383e[_0x0a9e('0x3f')]);_0x6054ee[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],qs['fields'](_0x409789['query']['fields']));_0x6054ee[_0x0a9e('0x42')]=_0x6054ee[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x6054ee['attributes']:_0x19383e[_0x0a9e('0x45')];if(_0x409789[_0x0a9e('0x3f')]['includeAll']){_0x6054ee['include']=[{'all':!![]}];}_0x6054ee=_[_0x0a9e('0x4c')]({},_0x6054ee,_0x409789['options']);return db[_0x0a9e('0x3b')]['find'](_0x6054ee)[_0x0a9e('0x1d')](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x1d')](respondWithResult(_0x992c77,null))[_0x0a9e('0x28')](handleError(_0x992c77,null));};exports['create']=function(_0x2f82da,_0x1bf38a){return db['ChatMessage']['create'](_0x2f82da[_0x0a9e('0x54')],{})[_0x0a9e('0x1d')](respondWithResult(_0x1bf38a,0xc9))['catch'](handleError(_0x1bf38a,null));};exports[_0x0a9e('0x35')]=function(_0x5ce9ac,_0x211ef9){if(_0x5ce9ac['body']['id']){delete _0x5ce9ac[_0x0a9e('0x54')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x5ce9ac['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x211ef9,null))['then'](saveUpdates(_0x5ce9ac[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](respondWithResult(_0x211ef9,null))[_0x0a9e('0x28')](handleError(_0x211ef9,null));};exports[_0x0a9e('0x36')]=function(_0x232830,_0x272738){return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x232830['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x1d')](removeEntity(_0x272738,null))[_0x0a9e('0x28')](handleError(_0x272738,null));};exports[_0x0a9e('0x56')]=function(_0xb83dfd,_0x156662){return db['ChatMessage'][_0x0a9e('0x56')]()[_0x0a9e('0x1d')](respondWithResult(_0x156662,null))['catch'](handleError(_0x156662,null));};var interaction_log=require(_0x0a9e('0x57'))('chat-interactions');exports[_0x0a9e('0x58')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'agent':{},'channel':'chat'};if(_0x5ba1f9[_0x0a9e('0x54')]['id']){delete _0x5ba1f9[_0x0a9e('0x54')]['id'];}_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x59')]=!![];_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5a')]=moment()['format'](_0x0a9e('0x5b'));_0x5ba1f9['body'][_0x0a9e('0x5c')]=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')]||_0x5ba1f9['user']['id'];_0x273cb5[_0x0a9e('0x5d')]['id']=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5ba1f9[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](saveUpdates(_0x5ba1f9[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](function(_0x88dcbf){if(_0x88dcbf){_0x273cb5[_0x0a9e('0x26')]=_0x88dcbf[_0x0a9e('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0x0a9e('0x55')]({'where':{'id':_0x88dcbf[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](function(_0x3528b7){if(_0x3528b7){return _0x3528b7['update']({'UserId':_0x5ba1f9['body'][_0x0a9e('0x5c')],'read1stAt':_[_0x0a9e('0x60')](_0x3528b7[_0x0a9e('0x61')])?moment()[_0x0a9e('0x62')](_0x0a9e('0x5b')):undefined});}return null;})[_0x0a9e('0x1d')](function(_0x387489){if(_0x387489){_0x273cb5[_0x0a9e('0x63')]=_0x387489[_0x0a9e('0x5e')]({'plain':!![]});interaction_log[_0x0a9e('0x1e')](_0x0a9e('0x64'),_0x5ba1f9[_0x0a9e('0x65')]['id'],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x66')],_0x273cb5[_0x0a9e('0x63')]['id'],_0x5ba1f9[_0x0a9e('0x54')]?JSON['stringify'](_0x5ba1f9[_0x0a9e('0x54')]):_0x0a9e('0x67'));return respondWithRpcPromise(_0x0a9e('0x68'),'acceptMessage',_0x273cb5);}return null;})[_0x0a9e('0x1d')](function(_0x30944e){var _0x4b341d=_0x0a9e('0x69')+_0x30944e[_0x0a9e('0x26')][_0x0a9e('0x6a')];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0x4b341d,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x0a9e('0x1d')](function(_0x18bf5d){return _0x18bf5d;});})[_0x0a9e('0x1d')](function(_0x23a7d3){if(_0x23a7d3){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x23a7d3[0x0];if(!_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),'fullname',_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})['then'](function(_0x2ed01e){if(!_0x2ed01e)return null;_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x2ed01e;return _0x273cb5;})[_0x0a9e('0x1d')](function(_0x542ece){if(_0x542ece){if(_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x6f')]){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x70')]=util['format'](_0x0a9e('0x71'),_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')]);_0x273cb5[_0x0a9e('0x26')]['channel']=_0x273cb5[_0x0a9e('0x72')];_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x58');return respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x75'),'message':_[_0x0a9e('0x4c')](_0x273cb5[_0x0a9e('0x26')],JSON[_0x0a9e('0x76')](_0x273cb5[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002)[_0x0a9e('0x1d')](function(){return _0x273cb5;});}return _0x273cb5;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x4b3c1a,null))['catch'](handleError(_0x4b3c1a,null));};var interaction_log=require(_0x0a9e('0x57'))(_0x0a9e('0x78'));exports[_0x0a9e('0x33')]=function(_0x563627,_0x3736e0,_0x33dda0){var _0x8cea96={'agent':{},'channel':_0x0a9e('0x79')};if(_0x563627['body']['id']){delete _0x563627['body']['id'];}_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')]=_0x563627['body'][_0x0a9e('0x5c')]||_0x563627['user']['id'];_0x8cea96[_0x0a9e('0x5d')]['id']=_0x563627[_0x0a9e('0x54')]['UserId'];return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))[_0x0a9e('0x1d')](function(_0x1f42a0){if(_0x1f42a0){_0x8cea96[_0x0a9e('0x26')]=_0x1f42a0['get']({'plain':!![]});return db[_0x0a9e('0x7a')][_0x0a9e('0x55')]({'where':{'id':_0x1f42a0[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))['then'](function(_0xf51744){if(_0xf51744){_0x8cea96[_0x0a9e('0x63')]=_0xf51744['get']({'plain':!![]});interaction_log[_0x0a9e('0x1e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x563627[_0x0a9e('0x65')]['id'],_0x563627[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x563627[_0x0a9e('0x65')]['role'],_0x8cea96['interaction']['id'],_0x563627[_0x0a9e('0x54')]?JSON[_0x0a9e('0x23')](_0x563627[_0x0a9e('0x54')]):'null');return respondWithRpcPromise(_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x8cea96);}return null;})['then'](function(_0x4e46b2){var _0xf0a802='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e46b2['message']['ContactId'];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0xf0a802,{'type':db[_0x0a9e('0x7d')][_0x0a9e('0x7e')][_0x0a9e('0x7f')],'raw':!![]})[_0x0a9e('0x1d')](function(_0x5a8854){return _0x5a8854;});})[_0x0a9e('0x1d')](function(_0x5955f1){if(_0x5955f1){_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x5955f1[0x0];if(!_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),_0x0a9e('0x80'),_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})[_0x0a9e('0x1d')](function(_0x1910bf){if(!_0x1910bf)return null;_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x1910bf;return _0x8cea96;})['then'](function(_0x2645d6){if(_0x2645d6){_0x2645d6[_0x0a9e('0x26')]['interface']=util[_0x0a9e('0x62')](_0x0a9e('0x71'),_0x563627[_0x0a9e('0x65')]['name']);_0x2645d6[_0x0a9e('0x26')]['channel']=_0x8cea96[_0x0a9e('0x72')];_0x2645d6[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x33');respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x81'),'message':_[_0x0a9e('0x4c')](_0x8cea96['message'],JSON[_0x0a9e('0x76')](_0x8cea96[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002);return _0x8cea96;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x3736e0,null))[_0x0a9e('0x28')](handleError(_0x3736e0,null));}; \ No newline at end of file +var _0xa9e0=['interaction','[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','sequelize','contact','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','chat','ChatInteraction','RejectMessage','rejectMessage','Sequelize','QueryTypes','SELECT','fullname','rejectmessage','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','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','map','ChatMessage','fieldName','type','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','body','find','describe','../../config/logger','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteractionId','isNil','read1stAt','format'];(function(_0x75c655,_0x1ca2d6){var _0x356d9f=function(_0x11a6cb){while(--_0x11a6cb){_0x75c655['push'](_0x75c655['shift']());}};_0x356d9f(++_0x1ca2d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5d0880,_0x1985b6,_0x519dfd,_0x16033c){return new BPromise(function(_0x12066b,_0x48f32d){var _0x225616=_0x16033c||client;return _0x225616['request'](_0x5d0880,_0x519dfd)[_0x0a9e('0x1d')](function(_0x478723){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x1985b6,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x478723));if(_0x478723[_0x0a9e('0x24')]){if(_0x478723[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')]['message']);return _0x48f32d(_0x478723[_0x0a9e('0x24')]['message']);}logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x12066b(_0x478723[_0x0a9e('0x24')]['message']);}else{logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));_0x12066b(_0x478723[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x16b1ca){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1985b6,_0x16b1ca);_0x48f32d(_0x16b1ca);});});}function respondWithStatusCode(_0x197ec0,_0x3a8e58){_0x3a8e58=_0x3a8e58||0xcc;return function(_0x40c424){if(_0x40c424){return _0x197ec0[_0x0a9e('0x29')](_0x3a8e58);}return _0x197ec0['status'](_0x3a8e58)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x479bc4,_0x45a1e7){_0x45a1e7=_0x45a1e7||0xc8;return function(_0x5bfb33){if(_0x5bfb33){return _0x479bc4[_0x0a9e('0x2b')](_0x45a1e7)[_0x0a9e('0x2c')](_0x5bfb33);}};}function respondWithFilteredResult(_0x25fba9,_0x14433c){return function(_0x140511){if(_0x140511){var _0x1538a4=typeof _0x14433c[_0x0a9e('0x2d')]===_0x0a9e('0x2e')&&typeof _0x14433c['limit']===_0x0a9e('0x2e');var _0x468813=_0x140511[_0x0a9e('0x2f')];var _0x2ec755=_0x1538a4?0x0:_0x14433c['offset'];var _0x15b200=_0x1538a4?_0x140511[_0x0a9e('0x2f')]:_0x14433c[_0x0a9e('0x2d')]+_0x14433c[_0x0a9e('0x30')];var _0x58b06f;if(_0x15b200>=_0x468813){_0x15b200=_0x468813;_0x58b06f=0xc8;}else{_0x58b06f=0xce;}_0x25fba9[_0x0a9e('0x2b')](_0x58b06f);return _0x25fba9[_0x0a9e('0x31')](_0x0a9e('0x32'),_0x2ec755+'-'+_0x15b200+'/'+_0x468813)[_0x0a9e('0x2c')](_0x140511);}return null;};}function patchUpdates(_0x540530){return function(_0x426950){try{jsonpatch['apply'](_0x426950,_0x540530,!![]);}catch(_0x2407f9){return BPromise[_0x0a9e('0x33')](_0x2407f9);}return _0x426950[_0x0a9e('0x34')]();};}function saveUpdates(_0x33bdb7,_0x25ce3a){return function(_0x5180f1){if(_0x5180f1){return _0x5180f1[_0x0a9e('0x35')](_0x33bdb7)[_0x0a9e('0x1d')](function(_0x40cb85){return _0x40cb85;});}return null;};}function removeEntity(_0x2da5c0,_0x2b45ea){return function(_0x409319){if(_0x409319){return _0x409319[_0x0a9e('0x36')]()[_0x0a9e('0x1d')](function(){_0x2da5c0['status'](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x5e7238,_0x2cc7a0){return function(_0x14b13f){if(!_0x14b13f){_0x5e7238[_0x0a9e('0x29')](0x194);}return _0x14b13f;};}function handleError(_0x3f3d41,_0x567193){_0x567193=_0x567193||0x1f4;return function(_0x191e91){logger[_0x0a9e('0x24')](_0x191e91[_0x0a9e('0x37')]);if(_0x191e91[_0x0a9e('0x38')]){delete _0x191e91['name'];}_0x3f3d41['status'](_0x567193)[_0x0a9e('0x39')](_0x191e91);};}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x31916f=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x1dbf74){return{'name':_0x1dbf74[_0x0a9e('0x3c')],'type':_0x1dbf74[_0x0a9e('0x3d')]['key']};});_0x1ef87a['model']=_[_0x0a9e('0x3a')](_0x31916f,_0x0a9e('0x38'));_0x1ef87a['query']=_[_0x0a9e('0x3e')](_0x24936a[_0x0a9e('0x3f')]);_0x1ef87a[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],_0x1ef87a['query']);_0x381c37[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],qs[_0x0a9e('0x43')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x381c37['attributes']=_0x381c37[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x381c37[_0x0a9e('0x42')]:_0x1ef87a[_0x0a9e('0x45')];if(!_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x46')](_0x0a9e('0x47'))){_0x381c37[_0x0a9e('0x30')]=qs[_0x0a9e('0x30')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x30')]);_0x381c37[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x2d')]);}_0x381c37['order']=qs['sort'](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x381c37[_0x0a9e('0x49')]=qs[_0x0a9e('0x40')](_[_0x0a9e('0x4a')](_0x24936a[_0x0a9e('0x3f')],_0x1ef87a[_0x0a9e('0x40')]),_0x31916f);if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]){_0x381c37[_0x0a9e('0x49')]=_[_0x0a9e('0x4c')](_0x381c37[_0x0a9e('0x49')],{'$or':_['map'](_0x31916f,function(_0x117c99){if(_0x117c99[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0xfbd5ad={};_0xfbd5ad[_0x117c99[_0x0a9e('0x38')]]={'$like':'%'+_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]+'%'};return _0xfbd5ad;}})});}_0x381c37=_[_0x0a9e('0x4c')]({},_0x381c37,_0x24936a['options']);var _0x2e9d90={'where':_0x381c37['where']};return db[_0x0a9e('0x3b')][_0x0a9e('0x2f')](_0x2e9d90)[_0x0a9e('0x1d')](function(_0x562fb4){_0x4f41ae[_0x0a9e('0x2f')]=_0x562fb4;if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4e')]){_0x381c37[_0x0a9e('0x4f')]=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x381c37);})[_0x0a9e('0x1d')](function(_0x5bbcde){_0x4f41ae[_0x0a9e('0x51')]=_0x5bbcde;return _0x4f41ae;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x28')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x52')]=function(_0x409789,_0x992c77){var _0x6054ee={'raw':!![],'where':{'id':_0x409789[_0x0a9e('0x53')]['id']}},_0x19383e={};_0x19383e['model']=_[_0x0a9e('0x3e')](db[_0x0a9e('0x3b')]['rawAttributes']);_0x19383e['query']=_['keys'](_0x409789[_0x0a9e('0x3f')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],_0x19383e[_0x0a9e('0x3f')]);_0x6054ee[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],qs['fields'](_0x409789['query']['fields']));_0x6054ee[_0x0a9e('0x42')]=_0x6054ee[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x6054ee['attributes']:_0x19383e[_0x0a9e('0x45')];if(_0x409789[_0x0a9e('0x3f')]['includeAll']){_0x6054ee['include']=[{'all':!![]}];}_0x6054ee=_[_0x0a9e('0x4c')]({},_0x6054ee,_0x409789['options']);return db[_0x0a9e('0x3b')]['find'](_0x6054ee)[_0x0a9e('0x1d')](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x1d')](respondWithResult(_0x992c77,null))[_0x0a9e('0x28')](handleError(_0x992c77,null));};exports['create']=function(_0x2f82da,_0x1bf38a){return db['ChatMessage']['create'](_0x2f82da[_0x0a9e('0x54')],{})[_0x0a9e('0x1d')](respondWithResult(_0x1bf38a,0xc9))['catch'](handleError(_0x1bf38a,null));};exports[_0x0a9e('0x35')]=function(_0x5ce9ac,_0x211ef9){if(_0x5ce9ac['body']['id']){delete _0x5ce9ac[_0x0a9e('0x54')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x5ce9ac['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x211ef9,null))['then'](saveUpdates(_0x5ce9ac[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](respondWithResult(_0x211ef9,null))[_0x0a9e('0x28')](handleError(_0x211ef9,null));};exports[_0x0a9e('0x36')]=function(_0x232830,_0x272738){return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x232830['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x1d')](removeEntity(_0x272738,null))[_0x0a9e('0x28')](handleError(_0x272738,null));};exports[_0x0a9e('0x56')]=function(_0xb83dfd,_0x156662){return db['ChatMessage'][_0x0a9e('0x56')]()[_0x0a9e('0x1d')](respondWithResult(_0x156662,null))['catch'](handleError(_0x156662,null));};var interaction_log=require(_0x0a9e('0x57'))('chat-interactions');exports[_0x0a9e('0x58')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'agent':{},'channel':'chat'};if(_0x5ba1f9[_0x0a9e('0x54')]['id']){delete _0x5ba1f9[_0x0a9e('0x54')]['id'];}_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x59')]=!![];_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5a')]=moment()['format'](_0x0a9e('0x5b'));_0x5ba1f9['body'][_0x0a9e('0x5c')]=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')]||_0x5ba1f9['user']['id'];_0x273cb5[_0x0a9e('0x5d')]['id']=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5ba1f9[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](saveUpdates(_0x5ba1f9[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](function(_0x88dcbf){if(_0x88dcbf){_0x273cb5[_0x0a9e('0x26')]=_0x88dcbf[_0x0a9e('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0x0a9e('0x55')]({'where':{'id':_0x88dcbf[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](function(_0x3528b7){if(_0x3528b7){return _0x3528b7['update']({'UserId':_0x5ba1f9['body'][_0x0a9e('0x5c')],'read1stAt':_[_0x0a9e('0x60')](_0x3528b7[_0x0a9e('0x61')])?moment()[_0x0a9e('0x62')](_0x0a9e('0x5b')):undefined});}return null;})[_0x0a9e('0x1d')](function(_0x387489){if(_0x387489){_0x273cb5[_0x0a9e('0x63')]=_0x387489[_0x0a9e('0x5e')]({'plain':!![]});interaction_log[_0x0a9e('0x1e')](_0x0a9e('0x64'),_0x5ba1f9[_0x0a9e('0x65')]['id'],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x66')],_0x273cb5[_0x0a9e('0x63')]['id'],_0x5ba1f9[_0x0a9e('0x54')]?JSON['stringify'](_0x5ba1f9[_0x0a9e('0x54')]):_0x0a9e('0x67'));return respondWithRpcPromise(_0x0a9e('0x68'),'acceptMessage',_0x273cb5);}return null;})[_0x0a9e('0x1d')](function(_0x30944e){var _0x4b341d=_0x0a9e('0x69')+_0x30944e[_0x0a9e('0x26')][_0x0a9e('0x6a')];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0x4b341d,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x0a9e('0x1d')](function(_0x18bf5d){return _0x18bf5d;});})[_0x0a9e('0x1d')](function(_0x23a7d3){if(_0x23a7d3){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x23a7d3[0x0];if(!_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),'fullname',_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})['then'](function(_0x2ed01e){if(!_0x2ed01e)return null;_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x2ed01e;return _0x273cb5;})[_0x0a9e('0x1d')](function(_0x542ece){if(_0x542ece){if(_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x6f')]){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x70')]=util['format'](_0x0a9e('0x71'),_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')]);_0x273cb5[_0x0a9e('0x26')]['channel']=_0x273cb5[_0x0a9e('0x72')];_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x58');return respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x75'),'message':_[_0x0a9e('0x4c')](_0x273cb5[_0x0a9e('0x26')],JSON[_0x0a9e('0x76')](_0x273cb5[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002)[_0x0a9e('0x1d')](function(){return _0x273cb5;});}return _0x273cb5;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x4b3c1a,null))['catch'](handleError(_0x4b3c1a,null));};var interaction_log=require(_0x0a9e('0x57'))(_0x0a9e('0x78'));exports[_0x0a9e('0x33')]=function(_0x563627,_0x3736e0,_0x33dda0){var _0x8cea96={'agent':{},'channel':_0x0a9e('0x79')};if(_0x563627['body']['id']){delete _0x563627['body']['id'];}_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')]=_0x563627['body'][_0x0a9e('0x5c')]||_0x563627['user']['id'];_0x8cea96[_0x0a9e('0x5d')]['id']=_0x563627[_0x0a9e('0x54')]['UserId'];return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))[_0x0a9e('0x1d')](function(_0x1f42a0){if(_0x1f42a0){_0x8cea96[_0x0a9e('0x26')]=_0x1f42a0['get']({'plain':!![]});return db[_0x0a9e('0x7a')][_0x0a9e('0x55')]({'where':{'id':_0x1f42a0[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))['then'](function(_0xf51744){if(_0xf51744){_0x8cea96[_0x0a9e('0x63')]=_0xf51744['get']({'plain':!![]});interaction_log[_0x0a9e('0x1e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x563627[_0x0a9e('0x65')]['id'],_0x563627[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x563627[_0x0a9e('0x65')]['role'],_0x8cea96['interaction']['id'],_0x563627[_0x0a9e('0x54')]?JSON[_0x0a9e('0x23')](_0x563627[_0x0a9e('0x54')]):'null');return respondWithRpcPromise(_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x8cea96);}return null;})['then'](function(_0x4e46b2){var _0xf0a802='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e46b2['message']['ContactId'];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0xf0a802,{'type':db[_0x0a9e('0x7d')][_0x0a9e('0x7e')][_0x0a9e('0x7f')],'raw':!![]})[_0x0a9e('0x1d')](function(_0x5a8854){return _0x5a8854;});})[_0x0a9e('0x1d')](function(_0x5955f1){if(_0x5955f1){_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x5955f1[0x0];if(!_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),_0x0a9e('0x80'),_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})[_0x0a9e('0x1d')](function(_0x1910bf){if(!_0x1910bf)return null;_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x1910bf;return _0x8cea96;})['then'](function(_0x2645d6){if(_0x2645d6){_0x2645d6[_0x0a9e('0x26')]['interface']=util[_0x0a9e('0x62')](_0x0a9e('0x71'),_0x563627[_0x0a9e('0x65')]['name']);_0x2645d6[_0x0a9e('0x26')]['channel']=_0x8cea96[_0x0a9e('0x72')];_0x2645d6[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x33');respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x81'),'message':_[_0x0a9e('0x4c')](_0x8cea96['message'],JSON[_0x0a9e('0x76')](_0x8cea96[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002);return _0x8cea96;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x3736e0,null))[_0x0a9e('0x28')](handleError(_0x3736e0,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 137472f..07212d1 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 _0xf7c2=['emit','hook','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x3f87b3,_0x584a90){var _0x6c3822=function(_0x9b0b5c){while(--_0x9b0b5c){_0x3f87b3['push'](_0x3f87b3['shift']());}};_0x6c3822(++_0x584a90);}(_0xf7c2,0x9a));var _0x2f7c=function(_0x22ea66,_0x30123a){_0x22ea66=_0x22ea66-0x0;var _0x529757=_0xf7c2[_0x22ea66];return _0x529757;};'use strict';var EventEmitter=require(_0x2f7c('0x0'));var ChatMessage=require(_0x2f7c('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x2f7c('0x2')](0x0);var events={'afterCreate':_0x2f7c('0x3'),'afterUpdate':_0x2f7c('0x4'),'afterDestroy':_0x2f7c('0x5')};function emitEvent(_0x11cddf){return function(_0x6af83c,_0x39f661,_0x48f739){ChatMessageEvents['emit'](_0x11cddf+':'+_0x6af83c['id'],_0x6af83c);ChatMessageEvents[_0x2f7c('0x6')](_0x11cddf,_0x6af83c);_0x48f739(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x2f7c('0x7')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0xd59b=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0xd59b,0x136));var _0xbd59=function(_0x22eff2,_0x240c9f){_0x22eff2=_0x22eff2-0x0;var _0x2771e2=_0xd59b[_0x22eff2];return _0x2771e2;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xbd59('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xbd59('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbd59('0x2'),'afterDestroy':_0xbd59('0x3')};function emitEvent(_0x23aec4){return function(_0x4e372c,_0xad4e3e,_0x22d264){ChatMessageEvents[_0xbd59('0x4')](_0x23aec4+':'+_0x4e372c['id'],_0x4e372c);ChatMessageEvents[_0xbd59('0x4')](_0x23aec4,_0x4e372c);_0x22d264(null);};}for(var e in events){if(events[_0xbd59('0x5')](e)){var event=events[e];ChatMessage[_0xbd59('0x6')](e,emitEvent(event));}}module[_0xbd59('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 1f48a07..8140bc9 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 _0xadae=['exports','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','ChatInteractionId','then','update','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','../../config/environment'];(function(_0x549853,_0x5c07ec){var _0x549671=function(_0x3f1a3b){while(--_0x3f1a3b){_0x549853['push'](_0x549853['shift']());}};_0x549671(++_0x5c07ec);}(_0xadae,0x134));var _0xeada=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xadae[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xeada('0x0'));var util=require(_0xeada('0x1'));var logger=require(_0xeada('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xeada('0x3'));var attributes=require('./chatMessage.attributes');module[_0xeada('0x4')]=function(_0x5ef766,_0x5967e6){return _0x5ef766['define'](_0xeada('0x5'),attributes,{'tableName':_0xeada('0x6'),'paranoid':![],'indexes':[{'name':_0xeada('0x7'),'fields':[_0xeada('0x8')],'type':_0xeada('0x9')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x195f55,_0x389142,_0x6674fd){var _0x137583=_0x5ef766[_0xeada('0xa')];var _0x285f12=_0x195f55[_0xeada('0xb')]({'plain':!![]});if(_0x285f12[_0xeada('0xc')]['toLowerCase']()==='in'||_0x285f12['direction'][_0xeada('0xd')]()===_0xeada('0xe')&&!_0x285f12[_0xeada('0xf')]&&!_[_0xeada('0x10')](_0x285f12[_0xeada('0x11')])){_0x137583['ChatInteraction'][_0xeada('0x12')]({'where':{'id':_0x285f12[_0xeada('0x13')]}})[_0xeada('0x14')](function(_0x476f24){if(_0x476f24){_0x476f24[_0xeada('0x15')]({'lastMsgAt':_0x285f12['createdAt'],'lastMsgDirection':_0x285f12[_0xeada('0xc')]['toLowerCase']()});}})['catch'](function(_0x51f7b6){console['error'](_0x51f7b6);});}_0x6674fd();}},'charset':_0xeada('0x16'),'collate':_0xeada('0x17')});}; \ No newline at end of file +var _0x7497=['update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','ChatMessage','fti_chat_messages','body','models','direction','toLowerCase','isNil','UserId','findOne','ChatInteractionId','then'];(function(_0x17b1a8,_0x2172de){var _0x18409d=function(_0x59c8c3){while(--_0x59c8c3){_0x17b1a8['push'](_0x17b1a8['shift']());}};_0x18409d(++_0x2172de);}(_0x7497,0xef));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7749('0x0'));var util=require(_0x7749('0x1'));var logger=require(_0x7749('0x2'))(_0x7749('0x3'));var moment=require(_0x7749('0x4'));var BPromise=require(_0x7749('0x5'));var rp=require(_0x7749('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7749('0x7'));var config=require(_0x7749('0x8'));var attributes=require('./chatMessage.attributes');module[_0x7749('0x9')]=function(_0x5a458e,_0x59e560){return _0x5a458e['define'](_0x7749('0xa'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x7749('0xb'),'fields':[_0x7749('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3a3d76,_0x582b3a,_0x1cd851){var _0x5c936f=_0x5a458e[_0x7749('0xd')];var _0x45cfea=_0x3a3d76['get']({'plain':!![]});if(_0x45cfea[_0x7749('0xe')][_0x7749('0xf')]()==='in'||_0x45cfea[_0x7749('0xe')]['toLowerCase']()==='out'&&!_0x45cfea['secret']&&!_[_0x7749('0x10')](_0x45cfea[_0x7749('0x11')])){_0x5c936f['ChatInteraction'][_0x7749('0x12')]({'where':{'id':_0x45cfea[_0x7749('0x13')]}})[_0x7749('0x14')](function(_0x189fbd){if(_0x189fbd){_0x189fbd[_0x7749('0x15')]({'lastMsgAt':_0x45cfea['createdAt'],'lastMsgDirection':_0x45cfea['direction']['toLowerCase']()});}})[_0x7749('0x16')](function(_0x3b1758){console[_0x7749('0x17')](_0x3b1758);});}_0x1cd851();}},'charset':_0x7749('0x18'),'collate':_0x7749('0x19')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index f245a80..6d2f7f6 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 _0x936b=['lodash','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','register','then','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','info','result','catch','CreateChatMessage','ChatMessage','body','options','raw'];(function(_0x14a585,_0x42fc19){var _0x3b1ebe=function(_0x18f0df){while(--_0x18f0df){_0x14a585['push'](_0x14a585['shift']());}};_0x3b1ebe(++_0x42fc19);}(_0x936b,0x179));var _0xb936=function(_0x576898,_0x119dff){_0x576898=_0x576898-0x0;var _0x425d72=_0x936b[_0x576898];return _0x425d72;};'use strict';var _=require(_0xb936('0x0'));var util=require('util');var moment=require(_0xb936('0x1'));var BPromise=require(_0xb936('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb936('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb936('0x4'));var config=require(_0xb936('0x5'));var jayson=require(_0xb936('0x6'));var client=jayson[_0xb936('0x7')]['http']({'port':0x232a});config[_0xb936('0x8')]=_[_0xb936('0x9')](config[_0xb936('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xb936('0xa'))(new Redis(config[_0xb936('0x8')]));require('./chatMessage.socket')[_0xb936('0xb')](socket);function respondWithRpcPromise(_0x11eb4f,_0x26d22c,_0x23bbde){return new BPromise(function(_0x559d30,_0x3cf58b){return client['request'](_0x11eb4f,_0x23bbde)[_0xb936('0xc')](function(_0x3a0da2){logger['info']('ChatMessage,\x20%s,\x20%s',_0x26d22c,_0xb936('0xd'));logger[_0xb936('0xe')](_0xb936('0xf'),_0x26d22c,_0xb936('0xd'),JSON[_0xb936('0x10')](_0x3a0da2));if(_0x3a0da2[_0xb936('0x11')]){if(_0x3a0da2[_0xb936('0x11')][_0xb936('0x12')]===0x1f4){logger[_0xb936('0x11')](_0xb936('0x13'),_0x26d22c,_0x3a0da2[_0xb936('0x11')][_0xb936('0x14')]);return _0x3cf58b(_0x3a0da2['error'][_0xb936('0x14')]);}logger[_0xb936('0x11')](_0xb936('0x13'),_0x26d22c,_0x3a0da2[_0xb936('0x11')]['message']);return _0x559d30(_0x3a0da2[_0xb936('0x11')][_0xb936('0x14')]);}else{logger[_0xb936('0x15')](_0xb936('0x13'),_0x26d22c,_0xb936('0xd'));_0x559d30(_0x3a0da2[_0xb936('0x16')][_0xb936('0x14')]);}})[_0xb936('0x17')](function(_0x29a8bb){logger[_0xb936('0x11')](_0xb936('0x13'),_0x26d22c,_0x29a8bb);_0x3cf58b(_0x29a8bb);});});}exports[_0xb936('0x18')]=function(_0x1351b3){var _0x5797f8=this;return new Promise(function(_0x16d42e,_0x1d3852){return db[_0xb936('0x19')]['create'](_0x1351b3[_0xb936('0x1a')],{'raw':_0x1351b3['options']?_0x1351b3[_0xb936('0x1b')][_0xb936('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x72ad8b){logger[_0xb936('0x15')]('CreateChatMessage',_0x1351b3);logger['debug']('CreateChatMessage',_0x1351b3,JSON['stringify'](_0x72ad8b));_0x16d42e(_0x72ad8b);})[_0xb936('0x17')](function(_0x51fce8){logger[_0xb936('0x11')](_0xb936('0x18'),_0x51fce8[_0xb936('0x14')],_0x1351b3);_0x1d3852(_0x5797f8['error'](0x1f4,_0x51fce8[_0xb936('0x14')]));});});}; \ No newline at end of file +var _0x4299=['bluebird','randomstring','rpc','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','options','raw','lodash','util','moment'];(function(_0xf26344,_0x248f92){var _0x2045a3=function(_0x28da23){while(--_0x28da23){_0xf26344['push'](_0xf26344['shift']());}};_0x2045a3(++_0x248f92);}(_0x4299,0x1cd));var _0x9429=function(_0x14bc00,_0x5c7c2c){_0x14bc00=_0x14bc00-0x0;var _0x3ffcdf=_0x4299[_0x14bc00];return _0x3ffcdf;};'use strict';var _=require(_0x9429('0x0'));var util=require(_0x9429('0x1'));var moment=require(_0x9429('0x2'));var BPromise=require(_0x9429('0x3'));var rs=require(_0x9429('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9429('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9429('0x6')][_0x9429('0x7')]({'port':0x232a});config[_0x9429('0x8')]=_[_0x9429('0x9')](config[_0x9429('0x8')],{'host':_0x9429('0xa'),'port':0x18eb});var socket=require(_0x9429('0xb'))(new Redis(config[_0x9429('0x8')]));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x52c3f4,_0x409ff0,_0x1788ec){return new BPromise(function(_0x1a642a,_0xd24f35){return client[_0x9429('0xc')](_0x52c3f4,_0x1788ec)[_0x9429('0xd')](function(_0x21b874){logger[_0x9429('0xe')](_0x9429('0xf'),_0x409ff0,_0x9429('0x10'));logger[_0x9429('0x11')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x409ff0,_0x9429('0x10'),JSON[_0x9429('0x12')](_0x21b874));if(_0x21b874[_0x9429('0x13')]){if(_0x21b874[_0x9429('0x13')][_0x9429('0x14')]===0x1f4){logger[_0x9429('0x13')]('ChatMessage,\x20%s,\x20%s',_0x409ff0,_0x21b874[_0x9429('0x13')][_0x9429('0x15')]);return _0xd24f35(_0x21b874[_0x9429('0x13')][_0x9429('0x15')]);}logger[_0x9429('0x13')](_0x9429('0xf'),_0x409ff0,_0x21b874['error'][_0x9429('0x15')]);return _0x1a642a(_0x21b874[_0x9429('0x13')][_0x9429('0x15')]);}else{logger[_0x9429('0xe')](_0x9429('0xf'),_0x409ff0,_0x9429('0x10'));_0x1a642a(_0x21b874[_0x9429('0x16')]['message']);}})[_0x9429('0x17')](function(_0x308680){logger[_0x9429('0x13')](_0x9429('0xf'),_0x409ff0,_0x308680);_0xd24f35(_0x308680);});});}exports[_0x9429('0x18')]=function(_0x289b5f){var _0x30287e=this;return new Promise(function(_0x107e74,_0x460437){return db[_0x9429('0x19')][_0x9429('0x1a')](_0x289b5f['body'],{'raw':_0x289b5f[_0x9429('0x1b')]?_0x289b5f['options'][_0x9429('0x1c')]===undefined?!![]:![]:!![]})[_0x9429('0xd')](function(_0x511ead){logger[_0x9429('0xe')](_0x9429('0x18'),_0x289b5f);logger[_0x9429('0x11')](_0x9429('0x18'),_0x289b5f,JSON[_0x9429('0x12')](_0x511ead));_0x107e74(_0x511ead);})[_0x9429('0x17')](function(_0x3003c1){logger[_0x9429('0x13')](_0x9429('0x18'),_0x3003c1[_0x9429('0x15')],_0x289b5f);_0x460437(_0x30287e[_0x9429('0x13')](0x1f4,_0x3003c1[_0x9429('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index cee3be2..6d55732 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 _0xf725=['./chatMessage.events','save','remove','update','emit','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf725,0x7e));var _0x5f72=function(_0x4c81e0,_0x2ae328){_0x4c81e0=_0x4c81e0-0x0;var _0x5ace0e=_0xf725[_0x4c81e0];return _0x5ace0e;};'use strict';var ChatMessageEvents=require(_0x5f72('0x0'));var events=[_0x5f72('0x1'),_0x5f72('0x2'),_0x5f72('0x3')];function createListener(_0x1ab380,_0x2fb465){return function(_0x3f7b69){_0x2fb465[_0x5f72('0x4')](_0x1ab380,_0x3f7b69);};}function removeListener(_0x4200ff,_0x17a5bc){return function(){ChatMessageEvents['removeListener'](_0x4200ff,_0x17a5bc);};}exports[_0x5f72('0x5')]=function(_0x14a92d){for(var _0x3f2ca7=0x0,_0x193393=events[_0x5f72('0x6')];_0x3f2ca7<_0x193393;_0x3f2ca7++){var _0x4961d1=events[_0x3f2ca7];var _0x158aa3=createListener('chatMessage:'+_0x4961d1,_0x14a92d);ChatMessageEvents['on'](_0x4961d1,_0x158aa3);}}; \ No newline at end of file +var _0xdad2=['save','remove','register','chatMessage:'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xdad2,0x14c));var _0x2dad=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xdad2[_0x122ef9];return _0x42fba0;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x2dad('0x0'),_0x2dad('0x1'),'update'];function createListener(_0x22b0a0,_0x15946a){return function(_0x3988ca){_0x15946a['emit'](_0x22b0a0,_0x3988ca);};}function removeListener(_0x3212a5,_0x1437b9){return function(){ChatMessageEvents['removeListener'](_0x3212a5,_0x1437b9);};}exports[_0x2dad('0x2')]=function(_0x36a054){for(var _0x27ca04=0x0,_0xf0022b=events['length'];_0x27ca04<_0xf0022b;_0x27ca04++){var _0x5b6aa2=events[_0x27ca04];var _0x217e41=createListener(_0x2dad('0x3')+_0x5b6aa2,_0x36a054);ChatMessageEvents['on'](_0x5b6aa2,_0x217e41);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 21f5855..78fe1a1 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 _0x8765=['get','isAuthenticated','describe','/:id','show','post','chat','create','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller'];(function(_0x595604,_0x2cc998){var _0x1466f3=function(_0x4e1d9b){while(--_0x4e1d9b){_0x595604['push'](_0x595604['shift']());}};_0x1466f3(++_0x2cc998);}(_0x8765,0xc6));var _0x5876=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x8765[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require(_0x5876('0x0'));var util=require(_0x5876('0x1'));var path=require(_0x5876('0x2'));var timeout=require(_0x5876('0x3'));var express=require(_0x5876('0x4'));var router=express[_0x5876('0x5')]();var fs_extra=require(_0x5876('0x6'));var auth=require(_0x5876('0x7'));var interaction=require(_0x5876('0x8'));var config=require('../../config/environment');var controller=require(_0x5876('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5876('0xa')]('/describe',auth[_0x5876('0xb')](),controller[_0x5876('0xc')]);router[_0x5876('0xa')](_0x5876('0xd'),auth[_0x5876('0xb')](),controller[_0x5876('0xe')]);router[_0x5876('0xf')]('/',auth[_0x5876('0xb')](),interaction['tracked'](_0x5876('0x10'),'chatmessage:create'),controller[_0x5876('0x11')]);router[_0x5876('0x12')](_0x5876('0xd'),controller[_0x5876('0x13')]);router['put'](_0x5876('0x14'),auth[_0x5876('0xb')](),controller['accept']);router[_0x5876('0x12')](_0x5876('0x15'),auth[_0x5876('0xb')](),controller[_0x5876('0x16')]);router[_0x5876('0x17')](_0x5876('0xd'),auth[_0x5876('0xb')](),controller[_0x5876('0x18')]);module[_0x5876('0x19')]=router; \ No newline at end of file +var _0x3e1f=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/:id','show','post','tracked','chat','create','put','update','accept','/:id/reject','reject','delete','multer','util','path','connect-timeout'];(function(_0x243b34,_0x254691){var _0x188a58=function(_0x5e0e4c){while(--_0x5e0e4c){_0x243b34['push'](_0x243b34['shift']());}};_0x188a58(++_0x254691);}(_0x3e1f,0x1ea));var _0xf3e1=function(_0x4327fe,_0x4f8040){_0x4327fe=_0x4327fe-0x0;var _0x138651=_0x3e1f[_0x4327fe];return _0x138651;};'use strict';var multer=require(_0xf3e1('0x0'));var util=require(_0xf3e1('0x1'));var path=require(_0xf3e1('0x2'));var timeout=require(_0xf3e1('0x3'));var express=require(_0xf3e1('0x4'));var router=express[_0xf3e1('0x5')]();var fs_extra=require(_0xf3e1('0x6'));var auth=require(_0xf3e1('0x7'));var interaction=require(_0xf3e1('0x8'));var config=require(_0xf3e1('0x9'));var controller=require(_0xf3e1('0xa'));router[_0xf3e1('0xb')]('/',auth[_0xf3e1('0xc')](),controller[_0xf3e1('0xd')]);router[_0xf3e1('0xb')]('/describe',auth[_0xf3e1('0xc')](),controller['describe']);router['get'](_0xf3e1('0xe'),auth[_0xf3e1('0xc')](),controller[_0xf3e1('0xf')]);router[_0xf3e1('0x10')]('/',auth[_0xf3e1('0xc')](),interaction[_0xf3e1('0x11')](_0xf3e1('0x12'),'chatmessage:create'),controller[_0xf3e1('0x13')]);router[_0xf3e1('0x14')]('/:id',controller[_0xf3e1('0x15')]);router[_0xf3e1('0x14')]('/:id/accept',auth[_0xf3e1('0xc')](),controller[_0xf3e1('0x16')]);router[_0xf3e1('0x14')](_0xf3e1('0x17'),auth[_0xf3e1('0xc')](),controller[_0xf3e1('0x18')]);router[_0xf3e1('0x19')](_0xf3e1('0xe'),auth[_0xf3e1('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 87a3d05..51b88d3 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 _0x7533=['medium','TEXT'];(function(_0x56b98e,_0x2225f0){var _0x474f84=function(_0x58f6c7){while(--_0x58f6c7){_0x56b98e['push'](_0x56b98e['shift']());}};_0x474f84(++_0x2225f0);}(_0x7533,0x1b3));var _0x3753=function(_0x1bedfd,_0x3d34c2){_0x1bedfd=_0x1bedfd-0x0;var _0x1716d2=_0x7533[_0x1bedfd];return _0x1716d2;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x3753('0x0')](_0x3753('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x4524=['sequelize','TEXT','medium'];(function(_0x242b28,_0x482ddb){var _0x2fffe3=function(_0x430ada){while(--_0x430ada){_0x242b28['push'](_0x242b28['shift']());}};_0x2fffe3(++_0x482ddb);}(_0x4524,0x17a));var _0x4452=function(_0x54c0cb,_0x2eb98e){_0x54c0cb=_0x54c0cb-0x0;var _0xbebe88=_0x4524[_0x54c0cb];return _0xbebe88;};'use strict';var Sequelize=require(_0x4452('0x0'));module['exports']={'body':{'type':Sequelize[_0x4452('0x1')](_0x4452('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index bfc6642..a1330e9 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(_0x253f38,_0x2d0a33){var _0x5cac53=function(_0x2dbde4){while(--_0x2dbde4){_0x253f38['push'](_0x253f38['shift']());}};_0x5cac53(++_0x2d0a33);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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(_0x2c240b,_0x395224){var _0x6bb604=function(_0x1b889d){while(--_0x1b889d){_0x2c240b['push'](_0x2c240b['shift']());}};_0x6bb604(++_0x395224);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 5074bba..7f021e9 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 _0x8fff=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x16c763,_0x46a958){var _0x492039=function(_0x4539d5){while(--_0x4539d5){_0x16c763['push'](_0x16c763['shift']());}};_0x492039(++_0x46a958);}(_0x8fff,0x116));var _0xf8ff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8fff[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf8ff('0x0'));var util=require(_0xf8ff('0x1'));var logger=require('../../config/logger')(_0xf8ff('0x2'));var moment=require(_0xf8ff('0x3'));var BPromise=require(_0xf8ff('0x4'));var rp=require(_0xf8ff('0x5'));var fs=require('fs');var path=require(_0xf8ff('0x6'));var rimraf=require(_0xf8ff('0x7'));var config=require(_0xf8ff('0x8'));var attributes=require(_0xf8ff('0x9'));module[_0xf8ff('0xa')]=function(_0x3496f9,_0x120b9d){return _0x3496f9['define']('ChatOfflineMessage',attributes,{'tableName':_0xf8ff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf8ff('0xc'),'collate':_0xf8ff('0xd')});}; \ No newline at end of file +var _0xb501=['rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x29d6e6,_0x264220){var _0xc75ff0=function(_0x214f6b){while(--_0x214f6b){_0x29d6e6['push'](_0x29d6e6['shift']());}};_0xc75ff0(++_0x264220);}(_0xb501,0xd9));var _0x1b50=function(_0x4718d0,_0x52ca54){_0x4718d0=_0x4718d0-0x0;var _0x363882=_0xb501[_0x4718d0];return _0x363882;};'use strict';var _=require(_0x1b50('0x0'));var util=require(_0x1b50('0x1'));var logger=require(_0x1b50('0x2'))(_0x1b50('0x3'));var moment=require(_0x1b50('0x4'));var BPromise=require(_0x1b50('0x5'));var rp=require(_0x1b50('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1b50('0x7'));var config=require(_0x1b50('0x8'));var attributes=require(_0x1b50('0x9'));module[_0x1b50('0xa')]=function(_0x3fb582,_0x2b033d){return _0x3fb582[_0x1b50('0xb')](_0x1b50('0xc'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1b50('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index ad83637..70a4b68 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 _0xc090=['info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x1b222a,_0x4643d3){var _0x11745a=function(_0x28fa4a){while(--_0x28fa4a){_0x1b222a['push'](_0x1b222a['shift']());}};_0x11745a(++_0x4643d3);}(_0xc090,0x129));var _0x0c09=function(_0xb6316b,_0x2eb4a2){_0xb6316b=_0xb6316b-0x0;var _0x16b932=_0xc090[_0xb6316b];return _0x16b932;};'use strict';var _=require('lodash');var util=require(_0x0c09('0x0'));var moment=require(_0x0c09('0x1'));var BPromise=require(_0x0c09('0x2'));var rs=require(_0x0c09('0x3'));var fs=require('fs');var Redis=require(_0x0c09('0x4'));var db=require(_0x0c09('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0c09('0x6'))(_0x0c09('0x7'));var config=require('../../config/environment');var jayson=require(_0x0c09('0x8'));var client=jayson[_0x0c09('0x9')][_0x0c09('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x168f10,_0x5e3dfb,_0x1123a3){return new BPromise(function(_0x2fa89c,_0x150d88){return client['request'](_0x168f10,_0x1123a3)['then'](function(_0x402120){logger[_0x0c09('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5e3dfb,_0x0c09('0xc'));logger[_0x0c09('0xd')](_0x0c09('0xe'),_0x5e3dfb,'request\x20sent',JSON[_0x0c09('0xf')](_0x402120));if(_0x402120['error']){if(_0x402120[_0x0c09('0x10')][_0x0c09('0x11')]===0x1f4){logger[_0x0c09('0x10')](_0x0c09('0x12'),_0x5e3dfb,_0x402120[_0x0c09('0x10')][_0x0c09('0x13')]);return _0x150d88(_0x402120[_0x0c09('0x10')][_0x0c09('0x13')]);}logger[_0x0c09('0x10')](_0x0c09('0x12'),_0x5e3dfb,_0x402120['error'][_0x0c09('0x13')]);return _0x2fa89c(_0x402120[_0x0c09('0x10')][_0x0c09('0x13')]);}else{logger[_0x0c09('0xb')](_0x0c09('0x12'),_0x5e3dfb,_0x0c09('0xc'));_0x2fa89c(_0x402120[_0x0c09('0x14')][_0x0c09('0x13')]);}})[_0x0c09('0x15')](function(_0x1f3b94){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x5e3dfb,_0x1f3b94);_0x150d88(_0x1f3b94);});});} \ No newline at end of file +var _0x514e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x514e,0x146));var _0xe514=function(_0x5a43aa,_0x1a007c){_0x5a43aa=_0x5a43aa-0x0;var _0x17314a=_0x514e[_0x5a43aa];return _0x17314a;};'use strict';var _=require(_0xe514('0x0'));var util=require(_0xe514('0x1'));var moment=require(_0xe514('0x2'));var BPromise=require(_0xe514('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe514('0x4'));var db=require(_0xe514('0x5'))['db'];var utils=require(_0xe514('0x6'));var logger=require(_0xe514('0x7'))(_0xe514('0x8'));var config=require(_0xe514('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe514('0xa')][_0xe514('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3532be,_0x35c38c,_0x1c0098){return new BPromise(function(_0x5a7fe2,_0x5a5044){return client[_0xe514('0xc')](_0x3532be,_0x1c0098)[_0xe514('0xd')](function(_0x4b89f6){logger[_0xe514('0xe')](_0xe514('0xf'),_0x35c38c,_0xe514('0x10'));logger['debug'](_0xe514('0x11'),_0x35c38c,_0xe514('0x10'),JSON['stringify'](_0x4b89f6));if(_0x4b89f6[_0xe514('0x12')]){if(_0x4b89f6['error'][_0xe514('0x13')]===0x1f4){logger[_0xe514('0x12')](_0xe514('0xf'),_0x35c38c,_0x4b89f6[_0xe514('0x12')]['message']);return _0x5a5044(_0x4b89f6[_0xe514('0x12')]['message']);}logger[_0xe514('0x12')](_0xe514('0xf'),_0x35c38c,_0x4b89f6['error'][_0xe514('0x14')]);return _0x5a7fe2(_0x4b89f6['error'][_0xe514('0x14')]);}else{logger[_0xe514('0xe')](_0xe514('0xf'),_0x35c38c,_0xe514('0x10'));_0x5a7fe2(_0x4b89f6[_0xe514('0x15')][_0xe514('0x14')]);}})['catch'](function(_0xc922bb){logger[_0xe514('0x12')](_0xe514('0xf'),_0x35c38c,_0xc922bb);_0x5a5044(_0xc922bb);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index c6867a2..349b85b 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 _0xac1c=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','show','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x158c7e,_0x2da006){var _0x155379=function(_0x35af46){while(--_0x35af46){_0x158c7e['push'](_0x158c7e['shift']());}};_0x155379(++_0x2da006);}(_0xac1c,0xa0));var _0xcac1=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xac1c[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0xcac1('0x0'));var util=require('util');var path=require(_0xcac1('0x1'));var timeout=require(_0xcac1('0x2'));var express=require(_0xcac1('0x3'));var router=express[_0xcac1('0x4')]();var fs_extra=require(_0xcac1('0x5'));var auth=require(_0xcac1('0x6'));var interaction=require(_0xcac1('0x7'));var config=require(_0xcac1('0x8'));var controller=require(_0xcac1('0x9'));router[_0xcac1('0xa')]('/',auth[_0xcac1('0xb')](),controller[_0xcac1('0xc')]);router[_0xcac1('0xa')](_0xcac1('0xd'),auth['isAuthenticated'](),controller[_0xcac1('0xe')]);router[_0xcac1('0xa')]('/:id',auth[_0xcac1('0xb')](),controller[_0xcac1('0xf')]);router['post']('/',auth[_0xcac1('0xb')](),controller[_0xcac1('0x10')]);router[_0xcac1('0x11')](_0xcac1('0x12'),auth[_0xcac1('0xb')](),controller[_0xcac1('0x13')]);router[_0xcac1('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xcac1('0x15')]);module[_0xcac1('0x16')]=router; \ No newline at end of file +var _0x127d=['put','update','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create'];(function(_0x768458,_0x3d0933){var _0x31385c=function(_0xf11dad){while(--_0xf11dad){_0x768458['push'](_0x768458['shift']());}};_0x31385c(++_0x3d0933);}(_0x127d,0x146));var _0xd127=function(_0x2fb66d,_0x266d45){_0x2fb66d=_0x2fb66d-0x0;var _0x2c36fd=_0x127d[_0x2fb66d];return _0x2c36fd;};'use strict';var multer=require(_0xd127('0x0'));var util=require(_0xd127('0x1'));var path=require(_0xd127('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd127('0x3')]();var fs_extra=require(_0xd127('0x4'));var auth=require(_0xd127('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd127('0x6'));var controller=require(_0xd127('0x7'));router[_0xd127('0x8')]('/',auth[_0xd127('0x9')](),controller['index']);router[_0xd127('0x8')](_0xd127('0xa'),auth['isAuthenticated'](),controller[_0xd127('0xb')]);router[_0xd127('0x8')](_0xd127('0xc'),auth[_0xd127('0x9')](),controller[_0xd127('0xd')]);router[_0xd127('0xe')]('/',auth[_0xd127('0x9')](),controller[_0xd127('0xf')]);router[_0xd127('0x10')](_0xd127('0xc'),auth[_0xd127('0x9')](),controller[_0xd127('0x11')]);router['delete'](_0xd127('0xc'),auth[_0xd127('0x9')](),controller[_0xd127('0x12')]);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 305a8b3..d42120e 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 _0x8e7c=['sequelize','ENUM','mouseOver','timeout','STRING','INTEGER'];(function(_0x4fc4fb,_0x2c3677){var _0x237d21=function(_0x5c1aeb){while(--_0x5c1aeb){_0x4fc4fb['push'](_0x4fc4fb['shift']());}};_0x237d21(++_0x2c3677);}(_0x8e7c,0xa8));var _0xc8e7=function(_0x2626a3,_0x3c0a9f){_0x2626a3=_0x2626a3-0x0;var _0x1a0d17=_0x8e7c[_0x2626a3];return _0x1a0d17;};'use strict';var Sequelize=require(_0xc8e7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xc8e7('0x1')](_0xc8e7('0x2'),_0xc8e7('0x3')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0xc8e7('0x4')]},'timeout':{'type':Sequelize[_0xc8e7('0x5')]}}; \ No newline at end of file +var _0x8fb3=['INTEGER','STRING','mouseOver','timeout'];(function(_0xc4376d,_0x2e6841){var _0x291524=function(_0x235c70){while(--_0x235c70){_0xc4376d['push'](_0xc4376d['shift']());}};_0x291524(++_0x2e6841);}(_0x8fb3,0x199));var _0x38fb=function(_0x16ca59,_0x258531){_0x16ca59=_0x16ca59-0x0;var _0x5505f1=_0x8fb3[_0x16ca59];return _0x5505f1;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x38fb('0x0')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x38fb('0x1'),_0x38fb('0x2')),'defaultValue':_0x38fb('0x1')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x38fb('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 3b4c735..b91e3e0 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 _0x4ab0=['undefined','limit','count','set','Content-Range','apply','reject','destroy','then','sendStatus','error','stack','name','send','params','ChatProactiveAction','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','catch','update','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x4ab0,0xd5));var _0x04ab=function(_0x17be96,_0x1aa8bf){_0x17be96=_0x17be96-0x0;var _0x17d987=_0x4ab0[_0x17be96];return _0x17d987;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x04ab('0x0'));var zipdir=require(_0x04ab('0x1'));var jsonpatch=require(_0x04ab('0x2'));var rp=require(_0x04ab('0x3'));var moment=require(_0x04ab('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x04ab('0x5'));var path=require(_0x04ab('0x6'));var sox=require('sox');var csv=require(_0x04ab('0x7'));var ejs=require(_0x04ab('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x04ab('0x9'));var squel=require(_0x04ab('0xa'));var crypto=require(_0x04ab('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04ab('0xc'));var toCsv=require(_0x04ab('0x7'));var querystring=require(_0x04ab('0xd'));var Papa=require(_0x04ab('0xe'));var Redis=require('ioredis');var authService=require(_0x04ab('0xf'));var qs=require(_0x04ab('0x10'));var as=require(_0x04ab('0x11'));var hardwareService=require(_0x04ab('0x12'));var logger=require('../../config/logger')(_0x04ab('0x13'));var utils=require(_0x04ab('0x14'));var config=require(_0x04ab('0x15'));var licenseUtil=require(_0x04ab('0x16'));var db=require(_0x04ab('0x17'))['db'];function respondWithStatusCode(_0x386d0a,_0x4a6b39){_0x4a6b39=_0x4a6b39||0xcc;return function(_0x710503){if(_0x710503){return _0x386d0a['sendStatus'](_0x4a6b39);}return _0x386d0a[_0x04ab('0x18')](_0x4a6b39)[_0x04ab('0x19')]();};}function respondWithResult(_0x2abdf8,_0x428798){_0x428798=_0x428798||0xc8;return function(_0x4f0da1){if(_0x4f0da1){return _0x2abdf8['status'](_0x428798)['json'](_0x4f0da1);}};}function respondWithFilteredResult(_0x103ca8,_0x3cee44){return function(_0x149fd2){if(_0x149fd2){var _0x2b10b0=typeof _0x3cee44[_0x04ab('0x1a')]===_0x04ab('0x1b')&&typeof _0x3cee44[_0x04ab('0x1c')]===_0x04ab('0x1b');var _0x1f3251=_0x149fd2[_0x04ab('0x1d')];var _0x5ce43c=_0x2b10b0?0x0:_0x3cee44[_0x04ab('0x1a')];var _0x83ab27=_0x2b10b0?_0x149fd2[_0x04ab('0x1d')]:_0x3cee44[_0x04ab('0x1a')]+_0x3cee44[_0x04ab('0x1c')];var _0x10669a;if(_0x83ab27>=_0x1f3251){_0x83ab27=_0x1f3251;_0x10669a=0xc8;}else{_0x10669a=0xce;}_0x103ca8[_0x04ab('0x18')](_0x10669a);return _0x103ca8[_0x04ab('0x1e')](_0x04ab('0x1f'),_0x5ce43c+'-'+_0x83ab27+'/'+_0x1f3251)['json'](_0x149fd2);}return null;};}function patchUpdates(_0x75a04e){return function(_0x4a6679){try{jsonpatch[_0x04ab('0x20')](_0x4a6679,_0x75a04e,!![]);}catch(_0x1d04c2){return BPromise[_0x04ab('0x21')](_0x1d04c2);}return _0x4a6679['save']();};}function saveUpdates(_0x15a36b,_0x1c08f4){return function(_0xf6275e){if(_0xf6275e){return _0xf6275e['update'](_0x15a36b)['then'](function(_0xc8358e){return _0xc8358e;});}return null;};}function removeEntity(_0x2f614a,_0x5885bd){return function(_0x551583){if(_0x551583){return _0x551583[_0x04ab('0x22')]()[_0x04ab('0x23')](function(){_0x2f614a[_0x04ab('0x18')](0xcc)[_0x04ab('0x19')]();});}};}function handleEntityNotFound(_0x26bb81,_0xa3838a){return function(_0x21d9b7){if(!_0x21d9b7){_0x26bb81[_0x04ab('0x24')](0x194);}return _0x21d9b7;};}function handleError(_0x222557,_0x5cf1e5){_0x5cf1e5=_0x5cf1e5||0x1f4;return function(_0x86bf80){logger[_0x04ab('0x25')](_0x86bf80[_0x04ab('0x26')]);if(_0x86bf80[_0x04ab('0x27')]){delete _0x86bf80['name'];}_0x222557['status'](_0x5cf1e5)[_0x04ab('0x28')](_0x86bf80);};}exports['show']=function(_0x404eae,_0x30db64){var _0x2e069d={'raw':!![],'where':{'id':_0x404eae[_0x04ab('0x29')]['id']}},_0x3c25fb={};_0x3c25fb['model']=_['keys'](db[_0x04ab('0x2a')][_0x04ab('0x2b')]);_0x3c25fb[_0x04ab('0x2c')]=_[_0x04ab('0x2d')](_0x404eae[_0x04ab('0x2c')]);_0x3c25fb[_0x04ab('0x2e')]=_[_0x04ab('0x2f')](_0x3c25fb[_0x04ab('0x30')],_0x3c25fb[_0x04ab('0x2c')]);_0x2e069d[_0x04ab('0x31')]=_[_0x04ab('0x2f')](_0x3c25fb[_0x04ab('0x30')],qs[_0x04ab('0x32')](_0x404eae['query'][_0x04ab('0x32')]));_0x2e069d[_0x04ab('0x31')]=_0x2e069d['attributes'][_0x04ab('0x33')]?_0x2e069d[_0x04ab('0x31')]:_0x3c25fb['model'];if(_0x404eae[_0x04ab('0x2c')][_0x04ab('0x34')]){_0x2e069d['include']=[{'all':!![]}];}_0x2e069d=_[_0x04ab('0x35')]({},_0x2e069d,_0x404eae[_0x04ab('0x36')]);return db[_0x04ab('0x2a')][_0x04ab('0x37')](_0x2e069d)[_0x04ab('0x23')](handleEntityNotFound(_0x30db64,null))[_0x04ab('0x23')](respondWithResult(_0x30db64,null))['catch'](handleError(_0x30db64,null));};exports[_0x04ab('0x38')]=function(_0x3f4d83,_0x2ad8ee){return db['ChatProactiveAction'][_0x04ab('0x38')](_0x3f4d83['body'],{})['then'](respondWithResult(_0x2ad8ee,0xc9))[_0x04ab('0x39')](handleError(_0x2ad8ee,null));};exports[_0x04ab('0x3a')]=function(_0x5569ba,_0x40995c){if(_0x5569ba['body']['id']){delete _0x5569ba[_0x04ab('0x3b')]['id'];}return db[_0x04ab('0x2a')][_0x04ab('0x37')]({'where':{'id':_0x5569ba[_0x04ab('0x29')]['id']}})[_0x04ab('0x23')](handleEntityNotFound(_0x40995c,null))[_0x04ab('0x23')](saveUpdates(_0x5569ba[_0x04ab('0x3b')],null))[_0x04ab('0x23')](respondWithResult(_0x40995c,null))[_0x04ab('0x39')](handleError(_0x40995c,null));};exports[_0x04ab('0x22')]=function(_0x2b79f8,_0x3f145){return db['ChatProactiveAction'][_0x04ab('0x37')]({'where':{'id':_0x2b79f8[_0x04ab('0x29')]['id']}})['then'](handleEntityNotFound(_0x3f145,null))['then'](removeEntity(_0x3f145,null))[_0x04ab('0x39')](handleError(_0x3f145,null));}; \ No newline at end of file +var _0xd1f9=['query','filters','intersection','model','fields','attributes','includeAll','merge','find','catch','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','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','undefined','limit','count','set','reject','save','update','then','destroy','error','stack','send','show','params','keys','ChatProactiveAction','rawAttributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd1f9,0x88));var _0x9d1f=function(_0x1436d8,_0x5135aa){_0x1436d8=_0x1436d8-0x0;var _0x252c31=_0xd1f9[_0x1436d8];return _0x252c31;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9d1f('0x0'));var jsonpatch=require(_0x9d1f('0x1'));var rp=require(_0x9d1f('0x2'));var moment=require(_0x9d1f('0x3'));var BPromise=require(_0x9d1f('0x4'));var Mustache=require(_0x9d1f('0x5'));var util=require(_0x9d1f('0x6'));var path=require(_0x9d1f('0x7'));var sox=require(_0x9d1f('0x8'));var csv=require('to-csv');var ejs=require(_0x9d1f('0x9'));var fs=require('fs');var fs_extra=require(_0x9d1f('0xa'));var _=require(_0x9d1f('0xb'));var squel=require(_0x9d1f('0xc'));var crypto=require(_0x9d1f('0xd'));var jsforce=require(_0x9d1f('0xe'));var deskjs=require(_0x9d1f('0xf'));var toCsv=require(_0x9d1f('0x10'));var querystring=require(_0x9d1f('0x11'));var Papa=require(_0x9d1f('0x12'));var Redis=require(_0x9d1f('0x13'));var authService=require(_0x9d1f('0x14'));var qs=require(_0x9d1f('0x15'));var as=require(_0x9d1f('0x16'));var hardwareService=require(_0x9d1f('0x17'));var logger=require(_0x9d1f('0x18'))(_0x9d1f('0x19'));var utils=require(_0x9d1f('0x1a'));var config=require(_0x9d1f('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d1f('0x1c'))['db'];function respondWithStatusCode(_0x15a999,_0x7edbfa){_0x7edbfa=_0x7edbfa||0xcc;return function(_0x5a4d43){if(_0x5a4d43){return _0x15a999[_0x9d1f('0x1d')](_0x7edbfa);}return _0x15a999['status'](_0x7edbfa)['end']();};}function respondWithResult(_0x71e9c9,_0x38395d){_0x38395d=_0x38395d||0xc8;return function(_0x25c0b0){if(_0x25c0b0){return _0x71e9c9[_0x9d1f('0x1e')](_0x38395d)[_0x9d1f('0x1f')](_0x25c0b0);}};}function respondWithFilteredResult(_0x40a87f,_0x9f8cfc){return function(_0x2488a3){if(_0x2488a3){var _0x24cd8a=typeof _0x9f8cfc[_0x9d1f('0x20')]===_0x9d1f('0x21')&&typeof _0x9f8cfc[_0x9d1f('0x22')]===_0x9d1f('0x21');var _0x57ba11=_0x2488a3[_0x9d1f('0x23')];var _0x42a2b4=_0x24cd8a?0x0:_0x9f8cfc['offset'];var _0x329b69=_0x24cd8a?_0x2488a3['count']:_0x9f8cfc['offset']+_0x9f8cfc['limit'];var _0x2d39f3;if(_0x329b69>=_0x57ba11){_0x329b69=_0x57ba11;_0x2d39f3=0xc8;}else{_0x2d39f3=0xce;}_0x40a87f[_0x9d1f('0x1e')](_0x2d39f3);return _0x40a87f[_0x9d1f('0x24')]('Content-Range',_0x42a2b4+'-'+_0x329b69+'/'+_0x57ba11)[_0x9d1f('0x1f')](_0x2488a3);}return null;};}function patchUpdates(_0x4cfcf5){return function(_0x1c0280){try{jsonpatch['apply'](_0x1c0280,_0x4cfcf5,!![]);}catch(_0x552a84){return BPromise[_0x9d1f('0x25')](_0x552a84);}return _0x1c0280[_0x9d1f('0x26')]();};}function saveUpdates(_0x35a80d,_0x2d861b){return function(_0x44ef15){if(_0x44ef15){return _0x44ef15[_0x9d1f('0x27')](_0x35a80d)[_0x9d1f('0x28')](function(_0x3b10f7){return _0x3b10f7;});}return null;};}function removeEntity(_0x2c6417,_0xc05aa){return function(_0x1ab0f4){if(_0x1ab0f4){return _0x1ab0f4[_0x9d1f('0x29')]()[_0x9d1f('0x28')](function(){_0x2c6417[_0x9d1f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b234d,_0xa2392f){return function(_0x48245c){if(!_0x48245c){_0x2b234d['sendStatus'](0x194);}return _0x48245c;};}function handleError(_0x1f2b0e,_0xfdd4ae){_0xfdd4ae=_0xfdd4ae||0x1f4;return function(_0x3ca450){logger[_0x9d1f('0x2a')](_0x3ca450[_0x9d1f('0x2b')]);if(_0x3ca450['name']){delete _0x3ca450['name'];}_0x1f2b0e[_0x9d1f('0x1e')](_0xfdd4ae)[_0x9d1f('0x2c')](_0x3ca450);};}exports[_0x9d1f('0x2d')]=function(_0x44515d,_0x1df1b8){var _0x1d8ffe={'raw':!![],'where':{'id':_0x44515d[_0x9d1f('0x2e')]['id']}},_0x48fbf5={};_0x48fbf5['model']=_[_0x9d1f('0x2f')](db[_0x9d1f('0x30')][_0x9d1f('0x31')]);_0x48fbf5[_0x9d1f('0x32')]=_[_0x9d1f('0x2f')](_0x44515d['query']);_0x48fbf5[_0x9d1f('0x33')]=_[_0x9d1f('0x34')](_0x48fbf5[_0x9d1f('0x35')],_0x48fbf5['query']);_0x1d8ffe['attributes']=_[_0x9d1f('0x34')](_0x48fbf5[_0x9d1f('0x35')],qs['fields'](_0x44515d[_0x9d1f('0x32')][_0x9d1f('0x36')]));_0x1d8ffe[_0x9d1f('0x37')]=_0x1d8ffe[_0x9d1f('0x37')]['length']?_0x1d8ffe[_0x9d1f('0x37')]:_0x48fbf5[_0x9d1f('0x35')];if(_0x44515d[_0x9d1f('0x32')][_0x9d1f('0x38')]){_0x1d8ffe['include']=[{'all':!![]}];}_0x1d8ffe=_[_0x9d1f('0x39')]({},_0x1d8ffe,_0x44515d['options']);return db[_0x9d1f('0x30')][_0x9d1f('0x3a')](_0x1d8ffe)[_0x9d1f('0x28')](handleEntityNotFound(_0x1df1b8,null))['then'](respondWithResult(_0x1df1b8,null))[_0x9d1f('0x3b')](handleError(_0x1df1b8,null));};exports[_0x9d1f('0x3c')]=function(_0x324242,_0x236ca3){return db[_0x9d1f('0x30')]['create'](_0x324242[_0x9d1f('0x3d')],{})[_0x9d1f('0x28')](respondWithResult(_0x236ca3,0xc9))[_0x9d1f('0x3b')](handleError(_0x236ca3,null));};exports[_0x9d1f('0x27')]=function(_0x245675,_0x381654){if(_0x245675[_0x9d1f('0x3d')]['id']){delete _0x245675['body']['id'];}return db[_0x9d1f('0x30')][_0x9d1f('0x3a')]({'where':{'id':_0x245675[_0x9d1f('0x2e')]['id']}})[_0x9d1f('0x28')](handleEntityNotFound(_0x381654,null))['then'](saveUpdates(_0x245675[_0x9d1f('0x3d')],null))['then'](respondWithResult(_0x381654,null))['catch'](handleError(_0x381654,null));};exports['destroy']=function(_0x3c9a17,_0x1253e2){return db['ChatProactiveAction'][_0x9d1f('0x3a')]({'where':{'id':_0x3c9a17[_0x9d1f('0x2e')]['id']}})[_0x9d1f('0x28')](handleEntityNotFound(_0x1253e2,null))[_0x9d1f('0x28')](removeEntity(_0x1253e2,null))[_0x9d1f('0x3b')](handleError(_0x1253e2,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 4c75843..de532c5 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 _0x32cf=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define'];(function(_0x3072ee,_0x40b136){var _0x47041d=function(_0x47c8ee){while(--_0x47c8ee){_0x3072ee['push'](_0x3072ee['shift']());}};_0x47041d(++_0x40b136);}(_0x32cf,0x9c));var _0xf32c=function(_0x43a37c,_0x25a567){_0x43a37c=_0x43a37c-0x0;var _0x5d1d40=_0x32cf[_0x43a37c];return _0x5d1d40;};'use strict';var _=require(_0xf32c('0x0'));var util=require(_0xf32c('0x1'));var logger=require(_0xf32c('0x2'))(_0xf32c('0x3'));var moment=require(_0xf32c('0x4'));var BPromise=require(_0xf32c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf32c('0x6'));var rimraf=require(_0xf32c('0x7'));var config=require(_0xf32c('0x8'));var attributes=require(_0xf32c('0x9'));module[_0xf32c('0xa')]=function(_0x46b9eb,_0x42fa78){return _0x46b9eb[_0xf32c('0xb')]('ChatProactiveAction',attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b2=['exports','define','chat_proactive_actions','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5685d6,_0x5cce18){var _0x267f31=function(_0x4ac0d4){while(--_0x4ac0d4){_0x5685d6['push'](_0x5685d6['shift']());}};_0x267f31(++_0x5cce18);}(_0xd8b2,0x1f2));var _0x2d8b=function(_0x444076,_0x527e9a){_0x444076=_0x444076-0x0;var _0x430bed=_0xd8b2[_0x444076];return _0x430bed;};'use strict';var _=require('lodash');var util=require(_0x2d8b('0x0'));var logger=require(_0x2d8b('0x1'))(_0x2d8b('0x2'));var moment=require(_0x2d8b('0x3'));var BPromise=require(_0x2d8b('0x4'));var rp=require(_0x2d8b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2d8b('0x6'));var config=require(_0x2d8b('0x7'));var attributes=require('./chatProactiveAction.attributes');module[_0x2d8b('0x8')]=function(_0x574789,_0x13268e){return _0x574789[_0x2d8b('0x9')]('ChatProactiveAction',attributes,{'tableName':_0x2d8b('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 497c3d3..33dc5bc 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 _0xc94a=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2d6197,_0x82ebfb){var _0x4d0e75=function(_0x577e7a){while(--_0x577e7a){_0x2d6197['push'](_0x2d6197['shift']());}};_0x4d0e75(++_0x82ebfb);}(_0xc94a,0x1b4));var _0xac94=function(_0x574257,_0x156faf){_0x574257=_0x574257-0x0;var _0x2de793=_0xc94a[_0x574257];return _0x2de793;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xac94('0x0'));var rs=require(_0xac94('0x1'));var fs=require('fs');var Redis=require(_0xac94('0x2'));var db=require(_0xac94('0x3'))['db'];var utils=require(_0xac94('0x4'));var logger=require(_0xac94('0x5'))(_0xac94('0x6'));var config=require(_0xac94('0x7'));var jayson=require(_0xac94('0x8'));var client=jayson['client'][_0xac94('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2cbe38,_0x326044,_0x7c1c7a){return new BPromise(function(_0x2284ab,_0x2c2bef){return client[_0xac94('0xa')](_0x2cbe38,_0x7c1c7a)['then'](function(_0x41a5f4){logger[_0xac94('0xb')](_0xac94('0xc'),_0x326044,'request\x20sent');logger[_0xac94('0xd')](_0xac94('0xe'),_0x326044,_0xac94('0xf'),JSON[_0xac94('0x10')](_0x41a5f4));if(_0x41a5f4[_0xac94('0x11')]){if(_0x41a5f4['error'][_0xac94('0x12')]===0x1f4){logger['error'](_0xac94('0xc'),_0x326044,_0x41a5f4['error']['message']);return _0x2c2bef(_0x41a5f4[_0xac94('0x11')][_0xac94('0x13')]);}logger[_0xac94('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x326044,_0x41a5f4[_0xac94('0x11')][_0xac94('0x13')]);return _0x2284ab(_0x41a5f4['error'][_0xac94('0x13')]);}else{logger[_0xac94('0xb')](_0xac94('0xc'),_0x326044,_0xac94('0xf'));_0x2284ab(_0x41a5f4['result'][_0xac94('0x13')]);}})['catch'](function(_0x8b31c7){logger['error'](_0xac94('0xc'),_0x326044,_0x8b31c7);_0x2c2bef(_0x8b31c7);});});} \ No newline at end of file +var _0x4eb2=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x163596,_0x513b53){var _0x2c4bfd=function(_0xc68cb5){while(--_0xc68cb5){_0x163596['push'](_0x163596['shift']());}};_0x2c4bfd(++_0x513b53);}(_0x4eb2,0xe4));var _0x24eb=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x4eb2[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0x24eb('0x0'));var util=require(_0x24eb('0x1'));var moment=require(_0x24eb('0x2'));var BPromise=require('bluebird');var rs=require(_0x24eb('0x3'));var fs=require('fs');var Redis=require(_0x24eb('0x4'));var db=require(_0x24eb('0x5'))['db'];var utils=require(_0x24eb('0x6'));var logger=require(_0x24eb('0x7'))(_0x24eb('0x8'));var config=require(_0x24eb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x24eb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd72ba7,_0x37ab74,_0x1801dd){return new BPromise(function(_0x1a1438,_0x5829d4){return client[_0x24eb('0xb')](_0xd72ba7,_0x1801dd)[_0x24eb('0xc')](function(_0x1d29e6){logger['info'](_0x24eb('0xd'),_0x37ab74,_0x24eb('0xe'));logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x37ab74,_0x24eb('0xe'),JSON['stringify'](_0x1d29e6));if(_0x1d29e6[_0x24eb('0xf')]){if(_0x1d29e6[_0x24eb('0xf')][_0x24eb('0x10')]===0x1f4){logger[_0x24eb('0xf')](_0x24eb('0xd'),_0x37ab74,_0x1d29e6['error'][_0x24eb('0x11')]);return _0x5829d4(_0x1d29e6[_0x24eb('0xf')]['message']);}logger[_0x24eb('0xf')](_0x24eb('0xd'),_0x37ab74,_0x1d29e6[_0x24eb('0xf')][_0x24eb('0x11')]);return _0x1a1438(_0x1d29e6[_0x24eb('0xf')][_0x24eb('0x11')]);}else{logger[_0x24eb('0x12')](_0x24eb('0xd'),_0x37ab74,_0x24eb('0xe'));_0x1a1438(_0x1d29e6[_0x24eb('0x13')][_0x24eb('0x11')]);}})[_0x24eb('0x14')](function(_0x1d4cd1){logger[_0x24eb('0xf')](_0x24eb('0xd'),_0x37ab74,_0x1d4cd1);_0x5829d4(_0x1d4cd1);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 3f13d9e..0f1f89f 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 _0x425d=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x425d,0x1e0));var _0xd425=function(_0x568669,_0x166190){_0x568669=_0x568669-0x0;var _0x45a6e7=_0x425d[_0x568669];return _0x45a6e7;};'use strict';var multer=require(_0xd425('0x0'));var util=require('util');var path=require(_0xd425('0x1'));var timeout=require(_0xd425('0x2'));var express=require(_0xd425('0x3'));var router=express[_0xd425('0x4')]();var fs_extra=require(_0xd425('0x5'));var auth=require(_0xd425('0x6'));var interaction=require(_0xd425('0x7'));var config=require('../../config/environment');var controller=require(_0xd425('0x8'));router[_0xd425('0x9')](_0xd425('0xa'),auth[_0xd425('0xb')](),controller[_0xd425('0xc')]);router[_0xd425('0xd')]('/',auth['isAuthenticated'](),controller[_0xd425('0xe')]);router[_0xd425('0xf')](_0xd425('0xa'),auth[_0xd425('0xb')](),controller[_0xd425('0x10')]);router[_0xd425('0x11')](_0xd425('0xa'),auth[_0xd425('0xb')](),controller[_0xd425('0x12')]);module[_0xd425('0x13')]=router; \ No newline at end of file +var _0xfdbd=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','/:id','isAuthenticated'];(function(_0x4e8b2b,_0x1126de){var _0x31de8a=function(_0x5f440a){while(--_0x5f440a){_0x4e8b2b['push'](_0x4e8b2b['shift']());}};_0x31de8a(++_0x1126de);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x14cb58,_0x214d62){_0x14cb58=_0x14cb58-0x0;var _0x5f097e=_0xfdbd[_0x14cb58];return _0x5f097e;};'use strict';var multer=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var path=require(_0xdfdb('0x2'));var timeout=require(_0xdfdb('0x3'));var express=require(_0xdfdb('0x4'));var router=express[_0xdfdb('0x5')]();var fs_extra=require(_0xdfdb('0x6'));var auth=require(_0xdfdb('0x7'));var interaction=require(_0xdfdb('0x8'));var config=require('../../config/environment');var controller=require(_0xdfdb('0x9'));router['get'](_0xdfdb('0xa'),auth[_0xdfdb('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xdfdb('0xc')]);router[_0xdfdb('0xd')]('/:id',auth[_0xdfdb('0xb')](),controller[_0xdfdb('0xe')]);router[_0xdfdb('0xf')](_0xdfdb('0xa'),auth[_0xdfdb('0xb')](),controller[_0xdfdb('0x10')]);module[_0xdfdb('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 bfa7431..e94aefe 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 _0xbb21=['beepall','roundrobin','exports','STRING','name','INTEGER','ENUM'];(function(_0x289abe,_0x4c67e3){var _0x8e39d8=function(_0x2c77f4){while(--_0x2c77f4){_0x289abe['push'](_0x289abe['shift']());}};_0x8e39d8(++_0x4c67e3);}(_0xbb21,0x183));var _0x1bb2=function(_0x44cf3a,_0x204f76){_0x44cf3a=_0x44cf3a-0x0;var _0x3fabc6=_0xbb21[_0x44cf3a];return _0x3fabc6;};'use strict';var Sequelize=require('sequelize');module[_0x1bb2('0x0')]={'name':{'type':Sequelize[_0x1bb2('0x1')],'unique':_0x1bb2('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x1bb2('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1bb2('0x4')]('rrmemory',_0x1bb2('0x5'),_0x1bb2('0x6'))}}; \ No newline at end of file +var _0x5380=['INTEGER','ENUM','beepall','roundrobin','exports','STRING'];(function(_0x848c55,_0x269495){var _0x4d7ad9=function(_0x139190){while(--_0x139190){_0x848c55['push'](_0x848c55['shift']());}};_0x4d7ad9(++_0x269495);}(_0x5380,0x148));var _0x0538=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5380[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');module[_0x0538('0x0')]={'name':{'type':Sequelize[_0x0538('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x0538('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0538('0x3')]('rrmemory',_0x0538('0x4'),_0x0538('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 7601836..bd57662 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 _0x1053=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','params','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','pick','ChatQueueId','User','UserId','agent','chatPause','updatedAt','format','SIP','getTeams','addTeams','ids','Team','online','voicePause','interface','flatMap','Agents','transaction','each','findOrCreate','forEach','emit','removeTeams','field','tq.TeamId','from','team_has_chat_queues','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','QueryTypes','SELECT','every','includes','all','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','spread','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','jayson/promise','client','http','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','get','ChatQueues','UserProfileResource','sendStatus','stack','name','send','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','includeAll','include','findAll','rows','show','keys','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x1053,0x163));var _0x3105=function(_0x51d99b,_0x40f96f){_0x51d99b=_0x51d99b-0x0;var _0x359a78=_0x1053[_0x51d99b];return _0x359a78;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3105('0x0'));var zipdir=require(_0x3105('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3105('0x2'));var moment=require(_0x3105('0x3'));var BPromise=require(_0x3105('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3105('0x5'));var sox=require(_0x3105('0x6'));var csv=require(_0x3105('0x7'));var ejs=require(_0x3105('0x8'));var fs=require('fs');var fs_extra=require(_0x3105('0x9'));var _=require(_0x3105('0xa'));var squel=require(_0x3105('0xb'));var crypto=require(_0x3105('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3105('0xd'));var toCsv=require(_0x3105('0x7'));var querystring=require(_0x3105('0xe'));var Papa=require(_0x3105('0xf'));var Redis=require(_0x3105('0x10'));var authService=require(_0x3105('0x11'));var qs=require(_0x3105('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3105('0x13'));var logger=require(_0x3105('0x14'))(_0x3105('0x15'));var utils=require(_0x3105('0x16'));var config=require(_0x3105('0x17'));var licenseUtil=require(_0x3105('0x18'));var db=require(_0x3105('0x19'))['db'];config[_0x3105('0x1a')]=_['defaults'](config[_0x3105('0x1a')],{'host':_0x3105('0x1b'),'port':0x18eb});var socket=require(_0x3105('0x1c'))(new Redis(config[_0x3105('0x1a')]));require(_0x3105('0x1d'))['register'](socket);var jayson=require(_0x3105('0x1e'));var client=jayson[_0x3105('0x1f')][_0x3105('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x45fd2c,_0xf7428,_0x4cc8c5,_0x57e4bc){return new BPromise(function(_0x3ba8c1,_0x190896){var _0x5039af=_0x57e4bc||client;return _0x5039af['request'](_0x45fd2c,_0x4cc8c5)[_0x3105('0x21')](function(_0x41a4bc){logger[_0x3105('0x22')](_0x3105('0x23'),_0xf7428,'request\x20sent');logger[_0x3105('0x24')](_0x3105('0x25'),_0xf7428,_0x3105('0x26'),JSON[_0x3105('0x27')](_0x41a4bc));if(_0x41a4bc[_0x3105('0x28')]){if(_0x41a4bc[_0x3105('0x28')][_0x3105('0x29')]===0x1f4){logger[_0x3105('0x28')](_0x3105('0x23'),_0xf7428,_0x41a4bc[_0x3105('0x28')][_0x3105('0x2a')]);return _0x190896(_0x41a4bc['error']['message']);}logger[_0x3105('0x28')](_0x3105('0x23'),_0xf7428,_0x41a4bc[_0x3105('0x28')]['message']);return _0x3ba8c1(_0x41a4bc[_0x3105('0x28')][_0x3105('0x2a')]);}else{logger[_0x3105('0x22')](_0x3105('0x23'),_0xf7428,_0x3105('0x26'));_0x3ba8c1(_0x41a4bc['result'][_0x3105('0x2a')]);}})[_0x3105('0x2b')](function(_0x27462c){logger[_0x3105('0x28')](_0x3105('0x23'),_0xf7428,_0x27462c);_0x190896(_0x27462c);});});}function respondWithStatusCode(_0x5c52b4,_0x5eac47){_0x5eac47=_0x5eac47||0xcc;return function(_0x335973){if(_0x335973){return _0x5c52b4['sendStatus'](_0x5eac47);}return _0x5c52b4[_0x3105('0x2c')](_0x5eac47)[_0x3105('0x2d')]();};}function respondWithResult(_0x5e2c79,_0x1eb493){_0x1eb493=_0x1eb493||0xc8;return function(_0x55752e){if(_0x55752e){return _0x5e2c79['status'](_0x1eb493)[_0x3105('0x2e')](_0x55752e);}};}function respondWithFilteredResult(_0x24e7ab,_0xbda9f){return function(_0xb75b03){if(_0xb75b03){var _0x33625a=typeof _0xbda9f[_0x3105('0x2f')]===_0x3105('0x30')&&typeof _0xbda9f[_0x3105('0x31')]===_0x3105('0x30');var _0x156539=_0xb75b03[_0x3105('0x32')];var _0x401593=_0x33625a?0x0:_0xbda9f[_0x3105('0x2f')];var _0x19dbb4=_0x33625a?_0xb75b03[_0x3105('0x32')]:_0xbda9f[_0x3105('0x2f')]+_0xbda9f['limit'];var _0x5781bf;if(_0x19dbb4>=_0x156539){_0x19dbb4=_0x156539;_0x5781bf=0xc8;}else{_0x5781bf=0xce;}_0x24e7ab[_0x3105('0x2c')](_0x5781bf);return _0x24e7ab[_0x3105('0x33')](_0x3105('0x34'),_0x401593+'-'+_0x19dbb4+'/'+_0x156539)[_0x3105('0x2e')](_0xb75b03);}return null;};}function patchUpdates(_0x30b306){return function(_0x44ef1c){try{jsonpatch[_0x3105('0x35')](_0x44ef1c,_0x30b306,!![]);}catch(_0x8e7f31){return BPromise[_0x3105('0x36')](_0x8e7f31);}return _0x44ef1c['save']();};}function saveUpdates(_0x464bdd,_0x117bf9){return function(_0x476f19){if(_0x476f19){return _0x476f19['update'](_0x464bdd)[_0x3105('0x21')](function(_0x2b5e1d){return _0x2b5e1d;});}return null;};}function removeEntity(_0x137ab5,_0x539869){return function(_0x3f5cee){if(_0x3f5cee){return _0x3f5cee['destroy']()[_0x3105('0x21')](function(){var _0x4b7b24=_0x3f5cee[_0x3105('0x37')]({'plain':!![]});var _0x255a8e=_0x3105('0x38');return db[_0x3105('0x39')]['destroy']({'where':{'type':_0x255a8e,'resourceId':_0x4b7b24['id']}})[_0x3105('0x21')](function(){return _0x3f5cee;});})[_0x3105('0x21')](function(){_0x137ab5[_0x3105('0x2c')](0xcc)[_0x3105('0x2d')]();});}};}function handleEntityNotFound(_0x4e1b1f,_0x20ae2a){return function(_0x41e4d8){if(!_0x41e4d8){_0x4e1b1f[_0x3105('0x3a')](0x194);}return _0x41e4d8;};}function handleError(_0x1da3a8,_0x4434fc){_0x4434fc=_0x4434fc||0x1f4;return function(_0x34a05a){logger['error'](_0x34a05a[_0x3105('0x3b')]);if(_0x34a05a[_0x3105('0x3c')]){delete _0x34a05a[_0x3105('0x3c')];}_0x1da3a8['status'](_0x4434fc)[_0x3105('0x3d')](_0x34a05a);};}exports['index']=function(_0x22c95c,_0x141fd2){var _0x338376={},_0x26283c={},_0x56e965={'count':0x0,'rows':[]};var _0x1274d1=_[_0x3105('0x3e')](db[_0x3105('0x3f')][_0x3105('0x40')],function(_0x47b509){return{'name':_0x47b509[_0x3105('0x41')],'type':_0x47b509[_0x3105('0x42')][_0x3105('0x43')]};});_0x26283c[_0x3105('0x44')]=_['map'](_0x1274d1,_0x3105('0x3c'));_0x26283c['query']=_['keys'](_0x22c95c[_0x3105('0x45')]);_0x26283c[_0x3105('0x46')]=_[_0x3105('0x47')](_0x26283c[_0x3105('0x44')],_0x26283c[_0x3105('0x45')]);_0x338376[_0x3105('0x48')]=_[_0x3105('0x47')](_0x26283c['model'],qs[_0x3105('0x49')](_0x22c95c[_0x3105('0x45')]['fields']));_0x338376['attributes']=_0x338376[_0x3105('0x48')][_0x3105('0x4a')]?_0x338376[_0x3105('0x48')]:_0x26283c[_0x3105('0x44')];if(!_0x22c95c[_0x3105('0x45')]['hasOwnProperty'](_0x3105('0x4b'))){_0x338376['limit']=qs['limit'](_0x22c95c[_0x3105('0x45')][_0x3105('0x31')]);_0x338376[_0x3105('0x2f')]=qs[_0x3105('0x2f')](_0x22c95c[_0x3105('0x45')][_0x3105('0x2f')]);}_0x338376[_0x3105('0x4c')]=qs[_0x3105('0x4d')](_0x22c95c[_0x3105('0x45')][_0x3105('0x4d')]);_0x338376[_0x3105('0x4e')]=qs[_0x3105('0x46')](_['pick'](_0x22c95c['query'],_0x26283c[_0x3105('0x46')]),_0x1274d1);if(_0x22c95c[_0x3105('0x45')][_0x3105('0x4f')]){_0x338376[_0x3105('0x4e')]=_['merge'](_0x338376[_0x3105('0x4e')],{'$or':_['map'](_0x1274d1,function(_0x1ae4f0){if(_0x1ae4f0['type']!=='VIRTUAL'){var _0x497bfa={};_0x497bfa[_0x1ae4f0[_0x3105('0x3c')]]={'$like':'%'+_0x22c95c[_0x3105('0x45')][_0x3105('0x4f')]+'%'};return _0x497bfa;}})});}_0x338376=_['merge']({},_0x338376,_0x22c95c['options']);var _0x38f790={'where':_0x338376[_0x3105('0x4e')]};return db[_0x3105('0x3f')][_0x3105('0x32')](_0x38f790)[_0x3105('0x21')](function(_0x10f425){_0x56e965[_0x3105('0x32')]=_0x10f425;if(_0x22c95c[_0x3105('0x45')][_0x3105('0x50')]){_0x338376[_0x3105('0x51')]=[{'all':!![]}];}return db[_0x3105('0x3f')][_0x3105('0x52')](_0x338376);})[_0x3105('0x21')](function(_0x4204fe){_0x56e965[_0x3105('0x53')]=_0x4204fe;return _0x56e965;})[_0x3105('0x21')](respondWithFilteredResult(_0x141fd2,_0x338376))['catch'](handleError(_0x141fd2,null));};exports[_0x3105('0x54')]=function(_0x38fea5,_0x3fdccd){var _0x4e5ca9={'raw':!![],'where':{'id':_0x38fea5['params']['id']}},_0x345f32={};_0x345f32[_0x3105('0x44')]=_[_0x3105('0x55')](db[_0x3105('0x3f')][_0x3105('0x40')]);_0x345f32[_0x3105('0x45')]=_['keys'](_0x38fea5[_0x3105('0x45')]);_0x345f32[_0x3105('0x46')]=_['intersection'](_0x345f32['model'],_0x345f32['query']);_0x4e5ca9[_0x3105('0x48')]=_[_0x3105('0x47')](_0x345f32[_0x3105('0x44')],qs[_0x3105('0x49')](_0x38fea5[_0x3105('0x45')][_0x3105('0x49')]));_0x4e5ca9[_0x3105('0x48')]=_0x4e5ca9['attributes'][_0x3105('0x4a')]?_0x4e5ca9[_0x3105('0x48')]:_0x345f32[_0x3105('0x44')];if(_0x38fea5['query'][_0x3105('0x50')]){_0x4e5ca9[_0x3105('0x51')]=[{'all':!![]}];}_0x4e5ca9=_[_0x3105('0x56')]({},_0x4e5ca9,_0x38fea5[_0x3105('0x57')]);return db[_0x3105('0x3f')][_0x3105('0x58')](_0x4e5ca9)[_0x3105('0x21')](handleEntityNotFound(_0x3fdccd,null))['then'](respondWithResult(_0x3fdccd,null))[_0x3105('0x2b')](handleError(_0x3fdccd,null));};exports[_0x3105('0x59')]=function(_0x2ffff7,_0x5493e2){return db[_0x3105('0x3f')]['create'](_0x2ffff7['body'],{})[_0x3105('0x21')](function(_0x3bbb2f){var _0x589039=_0x2ffff7[_0x3105('0x5a')][_0x3105('0x37')]({'plain':!![]});if(!_0x589039)throw new Error(_0x3105('0x5b'));if(_0x589039[_0x3105('0x5c')]===_0x3105('0x5a')){var _0x3bf7eb=_0x3bbb2f[_0x3105('0x37')]({'plain':!![]});var _0x325f19=_0x3105('0x38');return db[_0x3105('0x5d')]['find']({'where':{'name':_0x325f19,'userProfileId':_0x589039['userProfileId']},'raw':!![]})[_0x3105('0x21')](function(_0x472a03){if(_0x472a03&&_0x472a03[_0x3105('0x5e')]===0x0){return db[_0x3105('0x39')][_0x3105('0x59')]({'name':_0x3bf7eb[_0x3105('0x3c')],'resourceId':_0x3bf7eb['id'],'type':_0x472a03['name'],'sectionId':_0x472a03['id']},{})[_0x3105('0x21')](function(){return _0x3bbb2f;});}else{return _0x3bbb2f;}})['catch'](function(_0x779b48){logger[_0x3105('0x28')](_0x3105('0x5f'),_0x779b48);throw _0x779b48;});}return _0x3bbb2f;})['then'](respondWithResult(_0x5493e2,0xc9))['catch'](handleError(_0x5493e2,null));};exports[_0x3105('0x60')]=function(_0x5c8f6c,_0x1d1735){if(_0x5c8f6c['body']['id']){delete _0x5c8f6c['body']['id'];}return db[_0x3105('0x3f')][_0x3105('0x58')]({'where':{'id':_0x5c8f6c['params']['id']}})['then'](handleEntityNotFound(_0x1d1735,null))[_0x3105('0x21')](saveUpdates(_0x5c8f6c[_0x3105('0x61')],null))['then'](respondWithResult(_0x1d1735,null))[_0x3105('0x2b')](handleError(_0x1d1735,null));};exports[_0x3105('0x62')]=function(_0x3f3143,_0x237f26){return db['ChatQueue'][_0x3105('0x58')]({'where':{'id':_0x3f3143[_0x3105('0x63')]['id']}})[_0x3105('0x21')](handleEntityNotFound(_0x237f26,null))['then'](removeEntity(_0x237f26,null))[_0x3105('0x2b')](handleError(_0x237f26,null));};exports[_0x3105('0x64')]=function(_0x44c97f,_0x4d97e2){return db[_0x3105('0x3f')]['describe']()['then'](respondWithResult(_0x4d97e2,null))['catch'](handleError(_0x4d97e2,null));};exports[_0x3105('0x65')]=function(_0x4907f8,_0x1cf24d,_0x805f17){var _0x46d987={'raw':!![],'where':{}},_0x399e0a={},_0x426634;return db[_0x3105('0x3f')][_0x3105('0x66')]({'where':{'id':_0x4907f8[_0x3105('0x63')]['id']}})['then'](handleEntityNotFound(_0x1cf24d,null))[_0x3105('0x21')](function(_0x297b1e){if(_0x297b1e){_0x426634=_0x297b1e[_0x3105('0x37')]({'plain':!![]});_0x399e0a[_0x3105('0x44')]=_[_0x3105('0x55')](db[_0x3105('0x67')][_0x3105('0x40')]);_0x399e0a['query']=_[_0x3105('0x55')](_0x4907f8[_0x3105('0x45')]);_0x399e0a[_0x3105('0x46')]=_[_0x3105('0x47')](_0x399e0a[_0x3105('0x44')],_0x399e0a['query']);_0x46d987['attributes']=_[_0x3105('0x47')](_0x399e0a[_0x3105('0x44')],qs[_0x3105('0x49')](_0x4907f8['query']['fields']));_0x46d987['attributes']=_0x46d987[_0x3105('0x48')][_0x3105('0x4a')]?_0x46d987[_0x3105('0x48')]:_0x399e0a[_0x3105('0x44')];if(!_0x4907f8[_0x3105('0x45')][_0x3105('0x68')](_0x3105('0x4b'))){_0x46d987[_0x3105('0x31')]=qs[_0x3105('0x31')](_0x4907f8['query'][_0x3105('0x31')]);_0x46d987['offset']=qs[_0x3105('0x2f')](_0x4907f8[_0x3105('0x45')][_0x3105('0x2f')]);}_0x46d987[_0x3105('0x4c')]=qs['sort'](_0x4907f8[_0x3105('0x45')][_0x3105('0x4d')]);_0x46d987['where']=qs[_0x3105('0x46')](_[_0x3105('0x69')](_0x4907f8[_0x3105('0x45')],_0x399e0a['filters']));_0x46d987[_0x3105('0x4e')][_0x3105('0x6a')]=_0x297b1e['id'];if(_0x4907f8[_0x3105('0x45')][_0x3105('0x4f')]){_0x46d987[_0x3105('0x4e')]=_[_0x3105('0x56')](_0x46d987[_0x3105('0x4e')],{'$or':_[_0x3105('0x3e')](_0x46d987[_0x3105('0x48')],function(_0x446ecc){var _0x9e7524={};_0x9e7524[_0x446ecc]={'$like':'%'+_0x4907f8[_0x3105('0x45')]['filter']+'%'};return _0x9e7524;})});}_0x46d987=_['merge']({},_0x46d987,_0x4907f8[_0x3105('0x57')]);return db[_0x3105('0x67')]['findAll'](_0x46d987);}})[_0x3105('0x21')](function(_0x18bf2c){if(_0x18bf2c){return db[_0x3105('0x6b')]['findAndCountAll']({'where':{'id':_[_0x3105('0x3e')](_0x18bf2c,_0x3105('0x6c')),'role':_0x3105('0x6d')},'attributes':['id',_0x3105('0x3c'),_0x3105('0x6e'),_0x3105('0x6f'),'createdAt']});}})[_0x3105('0x21')](function(_0x4d0931){if(_0x4d0931){return{'count':_0x4d0931['count'],'rows':_[_0x3105('0x3e')](_0x4d0931['rows'],function(_0x340bf7){return{'membername':_0x340bf7[_0x3105('0x3c')],'UserId':_0x340bf7['id'],'queue_name':_0x426634[_0x3105('0x3c')],'ChatQueueId':_0x426634['id'],'interface':util[_0x3105('0x70')]('%s/%s',_0x3105('0x71'),_0x340bf7[_0x3105('0x3c')]),'penalty':0x0,'paused':_0x340bf7[_0x3105('0x6e')],'createdAt':_0x340bf7['createdAt'],'updatedAt':_0x340bf7[_0x3105('0x6f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3105('0x21')](respondWithFilteredResult(_0x1cf24d,_0x46d987))[_0x3105('0x2b')](handleError(_0x1cf24d,null));};exports[_0x3105('0x72')]=function(_0x37352e,_0x28afb1,_0x4d7566){var _0x8a0444={};var _0xb55fdb={};var _0x30316f;var _0x2d70f3;return db[_0x3105('0x3f')][_0x3105('0x66')]({'where':{'id':_0x37352e[_0x3105('0x63')]['id']}})[_0x3105('0x21')](handleEntityNotFound(_0x28afb1,null))[_0x3105('0x21')](function(_0x32cc80){if(_0x32cc80){_0x30316f=_0x32cc80;_0xb55fdb[_0x3105('0x44')]=_['keys'](db['Team'][_0x3105('0x40')]);_0xb55fdb['query']=_['keys'](_0x37352e[_0x3105('0x45')]);_0xb55fdb[_0x3105('0x46')]=_[_0x3105('0x47')](_0xb55fdb[_0x3105('0x44')],_0xb55fdb[_0x3105('0x45')]);_0x8a0444[_0x3105('0x48')]=_[_0x3105('0x47')](_0xb55fdb['model'],qs['fields'](_0x37352e['query'][_0x3105('0x49')]));_0x8a0444[_0x3105('0x48')]=_0x8a0444[_0x3105('0x48')]['length']?_0x8a0444[_0x3105('0x48')]:_0xb55fdb['model'];_0x8a0444[_0x3105('0x4c')]=qs[_0x3105('0x4d')](_0x37352e[_0x3105('0x45')][_0x3105('0x4d')]);_0x8a0444[_0x3105('0x4e')]=qs['filters'](_['pick'](_0x37352e[_0x3105('0x45')],_0xb55fdb[_0x3105('0x46')]));if(_0x37352e[_0x3105('0x45')]['filter']){_0x8a0444[_0x3105('0x4e')]=_[_0x3105('0x56')](_0x8a0444[_0x3105('0x4e')],{'$or':_['map'](_0x8a0444[_0x3105('0x48')],function(_0xcec602){var _0x2e992b={};_0x2e992b[_0xcec602]={'$like':'%'+_0x37352e[_0x3105('0x45')]['filter']+'%'};return _0x2e992b;})});}_0x8a0444=_[_0x3105('0x56')]({},_0x8a0444,_0x37352e['options']);return _0x30316f[_0x3105('0x72')](_0x8a0444);}})[_0x3105('0x21')](function(_0x5aa869){if(_0x5aa869){_0x2d70f3=_0x5aa869[_0x3105('0x4a')];if(!_0x37352e[_0x3105('0x45')][_0x3105('0x68')](_0x3105('0x4b'))){_0x8a0444[_0x3105('0x31')]=qs['limit'](_0x37352e[_0x3105('0x45')]['limit']);_0x8a0444[_0x3105('0x2f')]=qs[_0x3105('0x2f')](_0x37352e[_0x3105('0x45')]['offset']);}return _0x30316f[_0x3105('0x72')](_0x8a0444);}})[_0x3105('0x21')](function(_0x109a05){if(_0x109a05){return _0x109a05?{'count':_0x2d70f3,'rows':_0x109a05}:null;}})[_0x3105('0x21')](respondWithResult(_0x28afb1,null))[_0x3105('0x2b')](handleError(_0x28afb1,null));};exports[_0x3105('0x73')]=function(_0x59f5db,_0x518897,_0x7a66a6){var _0x2091ff=_0x59f5db['body'][_0x3105('0x74')];return db[_0x3105('0x75')][_0x3105('0x52')]({'where':{'id':_0x2091ff},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x3105('0x76'),_0x3105('0x77'),_0x3105('0x78')],'raw':!![]}]})[_0x3105('0x21')](function(_0x3b3a82){if(_0x3b3a82){var _0x510218=_[_0x3105('0x79')](_0x3b3a82,function(_0xf19676){var _0x46e742=_0xf19676['get']({'plain':!![]});return _0x46e742[_0x3105('0x7a')];});return db[_0x3105('0x3f')][_0x3105('0x58')]({'where':{'id':_0x59f5db[_0x3105('0x63')]['id']}})['then'](function(_0x533de0){return db['sequelize'][_0x3105('0x7b')](function(_0x2b1524){return _0x533de0[_0x3105('0x73')](_0x2091ff,{'transaction':_0x2b1524})['then'](function(){return BPromise[_0x3105('0x7c')](_0x510218,function(_0x1df23e){return db['UserChatQueue'][_0x3105('0x7d')]({'where':{'UserId':_0x1df23e['id'],'ChatQueueId':_0x59f5db[_0x3105('0x63')]['id']},'transaction':_0x2b1524});});})[_0x3105('0x21')](function(){_0x510218[_0x3105('0x7e')](function(_0x2c3bd5){socket[_0x3105('0x7f')]('userChatQueue:save',{'UserId':_0x2c3bd5['id'],'ChatQueueId':_0x533de0['id']});});});});});}})[_0x3105('0x21')](respondWithStatusCode(_0x518897,null))['catch'](handleError(_0x518897,null));};exports[_0x3105('0x80')]=function(_0x3c9622,_0x2fb1ea,_0x43c32f){return db[_0x3105('0x75')][_0x3105('0x52')]({'where':{'id':_0x3c9622[_0x3105('0x45')]['ids']},'attributes':['id'],'include':[{'model':db[_0x3105('0x6b')],'as':_0x3105('0x7a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2fb1ea,null))[_0x3105('0x21')](function(_0x58f676){var _0x28a718=_[_0x3105('0x3e')](_0x58f676,'id');var _0x529c3d=[];var _0x4726a8=[];var _0x2e62f3=squel['select']();_0x2e62f3[_0x3105('0x81')](_0x3105('0x82'))[_0x3105('0x83')](_0x3105('0x84'),'tq')['join']('user_has_teams','ut',_0x3105('0x85'))[_0x3105('0x4e')]('ChatQueueId\x20=\x20?',_0x3c9622['params']['id']);for(var _0x3167c6=0x0;_0x3167c6<_0x58f676[_0x3105('0x4a')];_0x3167c6+=0x1){let _0x51065c=_0x58f676[_0x3167c6];for(var _0x30a26a=0x0;_0x30a26a<_0x51065c['Agents']['length'];_0x30a26a+=0x1){let _0x37f2d0=_0x51065c[_0x3105('0x7a')][_0x30a26a];var _0x236155=_0x2e62f3[_0x3105('0x86')]();_0x236155['where']('ut.UserId\x20=\x20?',_0x37f2d0['id']);_0x4726a8[_0x3105('0x87')](db[_0x3105('0x88')][_0x3105('0x45')](_0x236155[_0x3105('0x89')](),{'type':db[_0x3105('0x88')][_0x3105('0x8a')][_0x3105('0x8b')]})['then'](function(_0x308de7){if(_0x308de7[_0x3105('0x4a')]===0x1){return _0x37f2d0['id'];}else{var _0x52ad00=_[_0x3105('0x8c')](_[_0x3105('0x3e')](_0x308de7,'TeamId'),function(_0x58a36d){return _[_0x3105('0x8d')](_0x28a718,_0x58a36d);});if(_0x52ad00){return _0x37f2d0['id'];}}}));}}return BPromise[_0x3105('0x8e')](_0x4726a8)[_0x3105('0x21')](function(_0x3b61d3){_0x529c3d=_(_0x529c3d)['union'](_0x3b61d3)['compact']()[_0x3105('0x8f')]();return db['ChatQueue'][_0x3105('0x58')]({'where':{'id':_0x3c9622[_0x3105('0x63')]['id']}})[_0x3105('0x21')](function(_0x4097d4){return db['sequelize'][_0x3105('0x7b')](function(_0x3be1ab){return _0x4097d4[_0x3105('0x80')](_0x3c9622[_0x3105('0x45')][_0x3105('0x74')],{'transaction':_0x3be1ab})[_0x3105('0x21')](function(){if(!_[_0x3105('0x90')](_0x529c3d)){return _0x4097d4[_0x3105('0x91')](_0x529c3d,{'transaction':_0x3be1ab});}})[_0x3105('0x21')](function(){_0x529c3d[_0x3105('0x7e')](function(_0x576a22){socket['emit'](_0x3105('0x92'),{'UserId':_0x576a22,'ChatQueueId':_0x4097d4['id']});});});});});});})[_0x3105('0x21')](respondWithStatusCode(_0x2fb1ea,null))['catch'](handleError(_0x2fb1ea,null));};exports[_0x3105('0x93')]=function(_0x7da054,_0x48cfe5,_0x1c4c66){return db[_0x3105('0x3f')][_0x3105('0x58')]({'where':{'id':_0x7da054[_0x3105('0x63')]['id']}})['then'](handleEntityNotFound(_0x48cfe5,null))['then'](function(_0x1a2695){if(_0x1a2695){return _0x1a2695[_0x3105('0x93')](_0x7da054[_0x3105('0x61')][_0x3105('0x74')],_['omit'](_0x7da054[_0x3105('0x61')],[_0x3105('0x74'),'id'])||{})[_0x3105('0x94')](function(_0x401364){for(var _0x22da98=0x0;_0x22da98<_0x7da054[_0x3105('0x61')]['ids'][_0x3105('0x4a')];_0x22da98+=0x1){socket[_0x3105('0x7f')]('userChatQueue:save',{'UserId':Number(_0x7da054[_0x3105('0x61')][_0x3105('0x74')][_0x22da98]),'ChatQueueId':Number(_0x7da054['params']['id'])});}return _0x401364;});}})[_0x3105('0x21')](respondWithResult(_0x48cfe5,null))[_0x3105('0x2b')](handleError(_0x48cfe5,null));};exports[_0x3105('0x91')]=function(_0x4c7c0c,_0x4ae6e9,_0x53d324){return db['ChatQueue'][_0x3105('0x58')]({'where':{'id':_0x4c7c0c['params']['id']}})['then'](handleEntityNotFound(_0x4ae6e9,null))['then'](function(_0x46dd59){if(_0x46dd59){return _0x46dd59[_0x3105('0x91')](_0x4c7c0c[_0x3105('0x45')][_0x3105('0x74')])[_0x3105('0x21')](function(){if(_['isArray'](_0x4c7c0c['query']['ids'])){for(var _0x2a1ed6=0x0;_0x2a1ed6<_0x4c7c0c[_0x3105('0x45')][_0x3105('0x74')][_0x3105('0x4a')];_0x2a1ed6+=0x1){socket[_0x3105('0x7f')](_0x3105('0x92'),{'UserId':Number(_0x4c7c0c[_0x3105('0x45')][_0x3105('0x74')][_0x2a1ed6]),'ChatQueueId':Number(_0x4c7c0c[_0x3105('0x63')]['id'])});}}else{socket[_0x3105('0x7f')]('userChatQueue:remove',{'UserId':Number(_0x4c7c0c[_0x3105('0x45')]['ids']),'ChatQueueId':Number(_0x4c7c0c[_0x3105('0x63')]['id'])});}});}})[_0x3105('0x21')](respondWithStatusCode(_0x4ae6e9,null))[_0x3105('0x2b')](handleError(_0x4ae6e9,null));};exports[_0x3105('0x95')]=function(_0x567b3c,_0x16d2e9,_0x1712a1){var _0x46e9b9={};var _0x35c032={};var _0x261297;var _0x21221b;return db[_0x3105('0x3f')][_0x3105('0x66')]({'where':{'id':_0x567b3c['params']['id']}})[_0x3105('0x21')](handleEntityNotFound(_0x16d2e9,null))['then'](function(_0x203092){if(_0x203092){_0x261297=_0x203092;_0x35c032['model']=_[_0x3105('0x55')](db[_0x3105('0x6b')][_0x3105('0x40')]);_0x35c032['query']=_[_0x3105('0x55')](_0x567b3c[_0x3105('0x45')]);_0x35c032[_0x3105('0x46')]=_[_0x3105('0x47')](_0x35c032[_0x3105('0x44')],_0x35c032[_0x3105('0x45')]);_0x46e9b9['attributes']=_[_0x3105('0x47')](_0x35c032[_0x3105('0x44')],qs['fields'](_0x567b3c['query'][_0x3105('0x49')]));_0x46e9b9['attributes']=_0x46e9b9[_0x3105('0x48')][_0x3105('0x4a')]?_0x46e9b9[_0x3105('0x48')]:_0x35c032[_0x3105('0x44')];_0x46e9b9[_0x3105('0x4c')]=qs['sort'](_0x567b3c['query'][_0x3105('0x4d')]);_0x46e9b9['where']=qs['filters'](_[_0x3105('0x69')](_0x567b3c[_0x3105('0x45')],_0x35c032[_0x3105('0x46')]));if(_0x567b3c[_0x3105('0x45')][_0x3105('0x4f')]){_0x46e9b9[_0x3105('0x4e')]=_[_0x3105('0x56')](_0x46e9b9['where'],{'$or':_['map'](_0x46e9b9[_0x3105('0x48')],function(_0xdb9a3a){var _0x4c3f01={};_0x4c3f01[_0xdb9a3a]={'$like':'%'+_0x567b3c[_0x3105('0x45')]['filter']+'%'};return _0x4c3f01;})});}_0x46e9b9=_['merge']({},_0x46e9b9,_0x567b3c['options']);return _0x261297[_0x3105('0x95')](_0x46e9b9);}})[_0x3105('0x21')](function(_0x5bb221){if(_0x5bb221){_0x21221b=_0x5bb221['length'];if(!_0x567b3c[_0x3105('0x45')][_0x3105('0x68')](_0x3105('0x4b'))){_0x46e9b9[_0x3105('0x31')]=qs[_0x3105('0x31')](_0x567b3c[_0x3105('0x45')][_0x3105('0x31')]);_0x46e9b9[_0x3105('0x2f')]=qs['offset'](_0x567b3c[_0x3105('0x45')]['offset']);}return _0x261297[_0x3105('0x95')](_0x46e9b9);}})[_0x3105('0x21')](function(_0x1fb0ad){if(_0x1fb0ad){return _0x1fb0ad?{'count':_0x21221b,'rows':_0x1fb0ad}:null;}})[_0x3105('0x21')](respondWithResult(_0x16d2e9,null))[_0x3105('0x2b')](handleError(_0x16d2e9,null));}; \ No newline at end of file +var _0x5117=['join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','userChatQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','hasOwnProperty','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','./chatQueue.socket','register','jayson/promise','client','request','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','then','sendStatus','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','model','query','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','rows','show','params','keys','length','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','ChatQueueId','findAll','User','findAndCountAll','agent','updatedAt','%s/%s','SIP','chatPause','createdAt','getTeams','Team','addTeams','Agents','voicePause','interface','flatMap','sequelize','transaction','each','forEach','emit','userChatQueue:save','removeTeams','ids','select','field','tq.TeamId','from'];(function(_0x36a616,_0x2fc36f){var _0x261241=function(_0x5ba5dc){while(--_0x5ba5dc){_0x36a616['push'](_0x36a616['shift']());}};_0x261241(++_0x2fc36f);}(_0x5117,0xb2));var _0x7511=function(_0x509273,_0x13fc9f){_0x509273=_0x509273-0x0;var _0x38ef40=_0x5117[_0x509273];return _0x38ef40;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7511('0x0'));var zipdir=require(_0x7511('0x1'));var jsonpatch=require(_0x7511('0x2'));var rp=require('request-promise');var moment=require(_0x7511('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7511('0x4'));var util=require(_0x7511('0x5'));var path=require(_0x7511('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7511('0x7'));var fs=require('fs');var fs_extra=require(_0x7511('0x8'));var _=require(_0x7511('0x9'));var squel=require('squel');var crypto=require(_0x7511('0xa'));var jsforce=require(_0x7511('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7511('0xc'));var querystring=require(_0x7511('0xd'));var Papa=require(_0x7511('0xe'));var Redis=require(_0x7511('0xf'));var authService=require(_0x7511('0x10'));var qs=require(_0x7511('0x11'));var as=require(_0x7511('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7511('0x13'))(_0x7511('0x14'));var utils=require(_0x7511('0x15'));var config=require(_0x7511('0x16'));var licenseUtil=require(_0x7511('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x7511('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7511('0x19')]));require(_0x7511('0x1a'))[_0x7511('0x1b')](socket);var jayson=require(_0x7511('0x1c'));var client=jayson[_0x7511('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40cc4b,_0x148e78,_0x2fa0d8,_0x22b583){return new BPromise(function(_0xd963ca,_0x1fcef2){var _0x2b3aa4=_0x22b583||client;return _0x2b3aa4[_0x7511('0x1e')](_0x40cc4b,_0x2fa0d8)['then'](function(_0x585652){logger['info'](_0x7511('0x1f'),_0x148e78,_0x7511('0x20'));logger[_0x7511('0x21')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x148e78,'request\x20sent',JSON[_0x7511('0x22')](_0x585652));if(_0x585652[_0x7511('0x23')]){if(_0x585652[_0x7511('0x23')][_0x7511('0x24')]===0x1f4){logger[_0x7511('0x23')](_0x7511('0x1f'),_0x148e78,_0x585652['error'][_0x7511('0x25')]);return _0x1fcef2(_0x585652['error']['message']);}logger[_0x7511('0x23')]('ChatQueue,\x20%s,\x20%s',_0x148e78,_0x585652[_0x7511('0x23')][_0x7511('0x25')]);return _0xd963ca(_0x585652[_0x7511('0x23')][_0x7511('0x25')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x148e78,_0x7511('0x20'));_0xd963ca(_0x585652[_0x7511('0x26')][_0x7511('0x25')]);}})[_0x7511('0x27')](function(_0x2fbc4e){logger[_0x7511('0x23')]('ChatQueue,\x20%s,\x20%s',_0x148e78,_0x2fbc4e);_0x1fcef2(_0x2fbc4e);});});}function respondWithStatusCode(_0x474913,_0x49e1f0){_0x49e1f0=_0x49e1f0||0xcc;return function(_0x8e6ef9){if(_0x8e6ef9){return _0x474913['sendStatus'](_0x49e1f0);}return _0x474913[_0x7511('0x28')](_0x49e1f0)[_0x7511('0x29')]();};}function respondWithResult(_0x189ec2,_0xe813fc){_0xe813fc=_0xe813fc||0xc8;return function(_0xd1ba91){if(_0xd1ba91){return _0x189ec2['status'](_0xe813fc)['json'](_0xd1ba91);}};}function respondWithFilteredResult(_0x46a98d,_0x4414ea){return function(_0x38aca2){if(_0x38aca2){var _0x5a4dae=typeof _0x4414ea[_0x7511('0x2a')]==='undefined'&&typeof _0x4414ea[_0x7511('0x2b')]==='undefined';var _0x435b8f=_0x38aca2['count'];var _0x3a1053=_0x5a4dae?0x0:_0x4414ea[_0x7511('0x2a')];var _0x760b48=_0x5a4dae?_0x38aca2['count']:_0x4414ea[_0x7511('0x2a')]+_0x4414ea[_0x7511('0x2b')];var _0x13ed8;if(_0x760b48>=_0x435b8f){_0x760b48=_0x435b8f;_0x13ed8=0xc8;}else{_0x13ed8=0xce;}_0x46a98d[_0x7511('0x28')](_0x13ed8);return _0x46a98d[_0x7511('0x2c')](_0x7511('0x2d'),_0x3a1053+'-'+_0x760b48+'/'+_0x435b8f)[_0x7511('0x2e')](_0x38aca2);}return null;};}function patchUpdates(_0x9e4967){return function(_0x130bfd){try{jsonpatch[_0x7511('0x2f')](_0x130bfd,_0x9e4967,!![]);}catch(_0x1ad464){return BPromise[_0x7511('0x30')](_0x1ad464);}return _0x130bfd[_0x7511('0x31')]();};}function saveUpdates(_0x2f7d01,_0x43a236){return function(_0x148619){if(_0x148619){return _0x148619[_0x7511('0x32')](_0x2f7d01)['then'](function(_0x2e1000){return _0x2e1000;});}return null;};}function removeEntity(_0x5420e3,_0x3ba8ba){return function(_0x166eb5){if(_0x166eb5){return _0x166eb5[_0x7511('0x33')]()['then'](function(){var _0x33ff63=_0x166eb5[_0x7511('0x34')]({'plain':!![]});var _0xce3664=_0x7511('0x35');return db[_0x7511('0x36')][_0x7511('0x33')]({'where':{'type':_0xce3664,'resourceId':_0x33ff63['id']}})['then'](function(){return _0x166eb5;});})[_0x7511('0x37')](function(){_0x5420e3['status'](0xcc)[_0x7511('0x29')]();});}};}function handleEntityNotFound(_0x24cac3,_0x10239a){return function(_0x481083){if(!_0x481083){_0x24cac3[_0x7511('0x38')](0x194);}return _0x481083;};}function handleError(_0x247011,_0x1a3222){_0x1a3222=_0x1a3222||0x1f4;return function(_0x2fae03){logger[_0x7511('0x23')](_0x2fae03[_0x7511('0x39')]);if(_0x2fae03[_0x7511('0x3a')]){delete _0x2fae03['name'];}_0x247011[_0x7511('0x28')](_0x1a3222)[_0x7511('0x3b')](_0x2fae03);};}exports[_0x7511('0x3c')]=function(_0x5d9f8d,_0x1d45ed){var _0x194a1c={},_0x52bc14={},_0x568d05={'count':0x0,'rows':[]};var _0x5f3683=_[_0x7511('0x3d')](db[_0x7511('0x3e')][_0x7511('0x3f')],function(_0x49e77b){return{'name':_0x49e77b[_0x7511('0x40')],'type':_0x49e77b['type']['key']};});_0x52bc14[_0x7511('0x41')]=_['map'](_0x5f3683,_0x7511('0x3a'));_0x52bc14['query']=_['keys'](_0x5d9f8d[_0x7511('0x42')]);_0x52bc14['filters']=_[_0x7511('0x43')](_0x52bc14[_0x7511('0x41')],_0x52bc14['query']);_0x194a1c['attributes']=_[_0x7511('0x43')](_0x52bc14['model'],qs[_0x7511('0x44')](_0x5d9f8d[_0x7511('0x42')][_0x7511('0x44')]));_0x194a1c[_0x7511('0x45')]=_0x194a1c[_0x7511('0x45')]['length']?_0x194a1c[_0x7511('0x45')]:_0x52bc14['model'];if(!_0x5d9f8d[_0x7511('0x42')]['hasOwnProperty'](_0x7511('0x46'))){_0x194a1c['limit']=qs[_0x7511('0x2b')](_0x5d9f8d[_0x7511('0x42')][_0x7511('0x2b')]);_0x194a1c[_0x7511('0x2a')]=qs[_0x7511('0x2a')](_0x5d9f8d[_0x7511('0x42')][_0x7511('0x2a')]);}_0x194a1c[_0x7511('0x47')]=qs['sort'](_0x5d9f8d[_0x7511('0x42')][_0x7511('0x48')]);_0x194a1c[_0x7511('0x49')]=qs[_0x7511('0x4a')](_[_0x7511('0x4b')](_0x5d9f8d['query'],_0x52bc14[_0x7511('0x4a')]),_0x5f3683);if(_0x5d9f8d[_0x7511('0x42')][_0x7511('0x4c')]){_0x194a1c[_0x7511('0x49')]=_[_0x7511('0x4d')](_0x194a1c[_0x7511('0x49')],{'$or':_[_0x7511('0x3d')](_0x5f3683,function(_0x11eba2){if(_0x11eba2[_0x7511('0x4e')]!==_0x7511('0x4f')){var _0x4177c7={};_0x4177c7[_0x11eba2[_0x7511('0x3a')]]={'$like':'%'+_0x5d9f8d['query'][_0x7511('0x4c')]+'%'};return _0x4177c7;}})});}_0x194a1c=_[_0x7511('0x4d')]({},_0x194a1c,_0x5d9f8d[_0x7511('0x50')]);var _0xa1d188={'where':_0x194a1c['where']};return db['ChatQueue']['count'](_0xa1d188)[_0x7511('0x37')](function(_0x6db2f4){_0x568d05[_0x7511('0x51')]=_0x6db2f4;if(_0x5d9f8d[_0x7511('0x42')]['includeAll']){_0x194a1c['include']=[{'all':!![]}];}return db[_0x7511('0x3e')]['findAll'](_0x194a1c);})[_0x7511('0x37')](function(_0x3fd2dc){_0x568d05[_0x7511('0x52')]=_0x3fd2dc;return _0x568d05;})['then'](respondWithFilteredResult(_0x1d45ed,_0x194a1c))[_0x7511('0x27')](handleError(_0x1d45ed,null));};exports[_0x7511('0x53')]=function(_0x53dea0,_0x3a351d){var _0x35a682={'raw':!![],'where':{'id':_0x53dea0[_0x7511('0x54')]['id']}},_0x2243ff={};_0x2243ff[_0x7511('0x41')]=_[_0x7511('0x55')](db[_0x7511('0x3e')]['rawAttributes']);_0x2243ff[_0x7511('0x42')]=_[_0x7511('0x55')](_0x53dea0[_0x7511('0x42')]);_0x2243ff['filters']=_[_0x7511('0x43')](_0x2243ff[_0x7511('0x41')],_0x2243ff['query']);_0x35a682[_0x7511('0x45')]=_[_0x7511('0x43')](_0x2243ff['model'],qs[_0x7511('0x44')](_0x53dea0['query']['fields']));_0x35a682['attributes']=_0x35a682[_0x7511('0x45')][_0x7511('0x56')]?_0x35a682[_0x7511('0x45')]:_0x2243ff[_0x7511('0x41')];if(_0x53dea0[_0x7511('0x42')][_0x7511('0x57')]){_0x35a682[_0x7511('0x58')]=[{'all':!![]}];}_0x35a682=_[_0x7511('0x4d')]({},_0x35a682,_0x53dea0[_0x7511('0x50')]);return db[_0x7511('0x3e')][_0x7511('0x59')](_0x35a682)['then'](handleEntityNotFound(_0x3a351d,null))[_0x7511('0x37')](respondWithResult(_0x3a351d,null))['catch'](handleError(_0x3a351d,null));};exports['create']=function(_0x4b71fd,_0xd99fca){return db[_0x7511('0x3e')][_0x7511('0x5a')](_0x4b71fd[_0x7511('0x5b')],{})['then'](function(_0x359c50){var _0x5613f0=_0x4b71fd[_0x7511('0x5c')][_0x7511('0x34')]({'plain':!![]});if(!_0x5613f0)throw new Error(_0x7511('0x5d'));if(_0x5613f0['role']==='user'){var _0x3467c3=_0x359c50[_0x7511('0x34')]({'plain':!![]});var _0x58fb23='ChatQueues';return db['UserProfileSection'][_0x7511('0x59')]({'where':{'name':_0x58fb23,'userProfileId':_0x5613f0[_0x7511('0x5e')]},'raw':!![]})[_0x7511('0x37')](function(_0x401c6e){if(_0x401c6e&&_0x401c6e[_0x7511('0x5f')]===0x0){return db[_0x7511('0x36')]['create']({'name':_0x3467c3[_0x7511('0x3a')],'resourceId':_0x3467c3['id'],'type':_0x401c6e[_0x7511('0x3a')],'sectionId':_0x401c6e['id']},{})['then'](function(){return _0x359c50;});}else{return _0x359c50;}})[_0x7511('0x27')](function(_0x399d47){logger[_0x7511('0x23')](_0x7511('0x60'),_0x399d47);throw _0x399d47;});}return _0x359c50;})[_0x7511('0x37')](respondWithResult(_0xd99fca,0xc9))[_0x7511('0x27')](handleError(_0xd99fca,null));};exports['update']=function(_0xbb3a74,_0x5c2877){if(_0xbb3a74[_0x7511('0x5b')]['id']){delete _0xbb3a74[_0x7511('0x5b')]['id'];}return db[_0x7511('0x3e')]['find']({'where':{'id':_0xbb3a74[_0x7511('0x54')]['id']}})[_0x7511('0x37')](handleEntityNotFound(_0x5c2877,null))[_0x7511('0x37')](saveUpdates(_0xbb3a74[_0x7511('0x5b')],null))[_0x7511('0x37')](respondWithResult(_0x5c2877,null))[_0x7511('0x27')](handleError(_0x5c2877,null));};exports['destroy']=function(_0x108586,_0x17c5aa){return db[_0x7511('0x3e')][_0x7511('0x59')]({'where':{'id':_0x108586[_0x7511('0x54')]['id']}})['then'](handleEntityNotFound(_0x17c5aa,null))['then'](removeEntity(_0x17c5aa,null))[_0x7511('0x27')](handleError(_0x17c5aa,null));};exports[_0x7511('0x61')]=function(_0x4dc692,_0x31e303){return db[_0x7511('0x3e')][_0x7511('0x61')]()[_0x7511('0x37')](respondWithResult(_0x31e303,null))[_0x7511('0x27')](handleError(_0x31e303,null));};exports[_0x7511('0x62')]=function(_0x40e0c9,_0x50f08d,_0x143fb6){var _0x25326d={'raw':!![],'where':{}},_0xa5223f={},_0x117293;return db['ChatQueue'][_0x7511('0x63')]({'where':{'id':_0x40e0c9[_0x7511('0x54')]['id']}})[_0x7511('0x37')](handleEntityNotFound(_0x50f08d,null))['then'](function(_0x480de0){if(_0x480de0){_0x117293=_0x480de0[_0x7511('0x34')]({'plain':!![]});_0xa5223f[_0x7511('0x41')]=_[_0x7511('0x55')](db[_0x7511('0x64')]['rawAttributes']);_0xa5223f[_0x7511('0x42')]=_['keys'](_0x40e0c9['query']);_0xa5223f[_0x7511('0x4a')]=_[_0x7511('0x43')](_0xa5223f[_0x7511('0x41')],_0xa5223f['query']);_0x25326d[_0x7511('0x45')]=_[_0x7511('0x43')](_0xa5223f['model'],qs[_0x7511('0x44')](_0x40e0c9['query']['fields']));_0x25326d[_0x7511('0x45')]=_0x25326d[_0x7511('0x45')][_0x7511('0x56')]?_0x25326d[_0x7511('0x45')]:_0xa5223f[_0x7511('0x41')];if(!_0x40e0c9[_0x7511('0x42')]['hasOwnProperty'](_0x7511('0x46'))){_0x25326d['limit']=qs[_0x7511('0x2b')](_0x40e0c9[_0x7511('0x42')][_0x7511('0x2b')]);_0x25326d[_0x7511('0x2a')]=qs[_0x7511('0x2a')](_0x40e0c9[_0x7511('0x42')][_0x7511('0x2a')]);}_0x25326d[_0x7511('0x47')]=qs[_0x7511('0x48')](_0x40e0c9[_0x7511('0x42')]['sort']);_0x25326d[_0x7511('0x49')]=qs['filters'](_['pick'](_0x40e0c9[_0x7511('0x42')],_0xa5223f[_0x7511('0x4a')]));_0x25326d['where'][_0x7511('0x65')]=_0x480de0['id'];if(_0x40e0c9[_0x7511('0x42')]['filter']){_0x25326d['where']=_[_0x7511('0x4d')](_0x25326d['where'],{'$or':_[_0x7511('0x3d')](_0x25326d[_0x7511('0x45')],function(_0x3db7ac){var _0x38230b={};_0x38230b[_0x3db7ac]={'$like':'%'+_0x40e0c9[_0x7511('0x42')][_0x7511('0x4c')]+'%'};return _0x38230b;})});}_0x25326d=_[_0x7511('0x4d')]({},_0x25326d,_0x40e0c9[_0x7511('0x50')]);return db[_0x7511('0x64')][_0x7511('0x66')](_0x25326d);}})['then'](function(_0x357886){if(_0x357886){return db[_0x7511('0x67')][_0x7511('0x68')]({'where':{'id':_[_0x7511('0x3d')](_0x357886,'UserId'),'role':_0x7511('0x69')},'attributes':['id',_0x7511('0x3a'),'chatPause',_0x7511('0x6a'),'createdAt']});}})['then'](function(_0x4e0ee4){if(_0x4e0ee4){return{'count':_0x4e0ee4[_0x7511('0x51')],'rows':_['map'](_0x4e0ee4['rows'],function(_0x1d74dc){return{'membername':_0x1d74dc[_0x7511('0x3a')],'UserId':_0x1d74dc['id'],'queue_name':_0x117293[_0x7511('0x3a')],'ChatQueueId':_0x117293['id'],'interface':util['format'](_0x7511('0x6b'),_0x7511('0x6c'),_0x1d74dc[_0x7511('0x3a')]),'penalty':0x0,'paused':_0x1d74dc[_0x7511('0x6d')],'createdAt':_0x1d74dc[_0x7511('0x6e')],'updatedAt':_0x1d74dc[_0x7511('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x50f08d,_0x25326d))[_0x7511('0x27')](handleError(_0x50f08d,null));};exports[_0x7511('0x6f')]=function(_0x405eb1,_0xbfd7f8,_0x1db159){var _0x281531={};var _0x3b7e0a={};var _0x4958b1;var _0x24ff29;return db[_0x7511('0x3e')][_0x7511('0x63')]({'where':{'id':_0x405eb1[_0x7511('0x54')]['id']}})['then'](handleEntityNotFound(_0xbfd7f8,null))[_0x7511('0x37')](function(_0x5bd8b1){if(_0x5bd8b1){_0x4958b1=_0x5bd8b1;_0x3b7e0a[_0x7511('0x41')]=_[_0x7511('0x55')](db[_0x7511('0x70')][_0x7511('0x3f')]);_0x3b7e0a[_0x7511('0x42')]=_[_0x7511('0x55')](_0x405eb1[_0x7511('0x42')]);_0x3b7e0a[_0x7511('0x4a')]=_['intersection'](_0x3b7e0a[_0x7511('0x41')],_0x3b7e0a[_0x7511('0x42')]);_0x281531[_0x7511('0x45')]=_[_0x7511('0x43')](_0x3b7e0a[_0x7511('0x41')],qs[_0x7511('0x44')](_0x405eb1[_0x7511('0x42')][_0x7511('0x44')]));_0x281531[_0x7511('0x45')]=_0x281531[_0x7511('0x45')][_0x7511('0x56')]?_0x281531[_0x7511('0x45')]:_0x3b7e0a[_0x7511('0x41')];_0x281531['order']=qs['sort'](_0x405eb1['query']['sort']);_0x281531[_0x7511('0x49')]=qs[_0x7511('0x4a')](_[_0x7511('0x4b')](_0x405eb1[_0x7511('0x42')],_0x3b7e0a[_0x7511('0x4a')]));if(_0x405eb1['query'][_0x7511('0x4c')]){_0x281531['where']=_['merge'](_0x281531['where'],{'$or':_[_0x7511('0x3d')](_0x281531[_0x7511('0x45')],function(_0x334fee){var _0x38fdf6={};_0x38fdf6[_0x334fee]={'$like':'%'+_0x405eb1[_0x7511('0x42')][_0x7511('0x4c')]+'%'};return _0x38fdf6;})});}_0x281531=_['merge']({},_0x281531,_0x405eb1[_0x7511('0x50')]);return _0x4958b1[_0x7511('0x6f')](_0x281531);}})[_0x7511('0x37')](function(_0x177c2d){if(_0x177c2d){_0x24ff29=_0x177c2d[_0x7511('0x56')];if(!_0x405eb1['query']['hasOwnProperty'](_0x7511('0x46'))){_0x281531[_0x7511('0x2b')]=qs[_0x7511('0x2b')](_0x405eb1['query'][_0x7511('0x2b')]);_0x281531[_0x7511('0x2a')]=qs['offset'](_0x405eb1[_0x7511('0x42')][_0x7511('0x2a')]);}return _0x4958b1[_0x7511('0x6f')](_0x281531);}})['then'](function(_0x520c61){if(_0x520c61){return _0x520c61?{'count':_0x24ff29,'rows':_0x520c61}:null;}})['then'](respondWithResult(_0xbfd7f8,null))[_0x7511('0x27')](handleError(_0xbfd7f8,null));};exports[_0x7511('0x71')]=function(_0x4e15f0,_0x581b89,_0x594872){var _0x1b5416=_0x4e15f0[_0x7511('0x5b')]['ids'];return db[_0x7511('0x70')][_0x7511('0x66')]({'where':{'id':_0x1b5416},'attributes':['id'],'include':[{'model':db[_0x7511('0x67')],'as':_0x7511('0x72'),'attributes':['id',_0x7511('0x3a'),'online',_0x7511('0x73'),_0x7511('0x74')],'raw':!![]}]})[_0x7511('0x37')](function(_0x3732fb){if(_0x3732fb){var _0x403bb6=_[_0x7511('0x75')](_0x3732fb,function(_0xe3d029){var _0x2bef8b=_0xe3d029[_0x7511('0x34')]({'plain':!![]});return _0x2bef8b[_0x7511('0x72')];});return db[_0x7511('0x3e')][_0x7511('0x59')]({'where':{'id':_0x4e15f0['params']['id']}})[_0x7511('0x37')](function(_0x42f3f8){return db[_0x7511('0x76')][_0x7511('0x77')](function(_0xc9a3d0){return _0x42f3f8['addTeams'](_0x1b5416,{'transaction':_0xc9a3d0})[_0x7511('0x37')](function(){return BPromise[_0x7511('0x78')](_0x403bb6,function(_0x19f97e){return db[_0x7511('0x64')]['findOrCreate']({'where':{'UserId':_0x19f97e['id'],'ChatQueueId':_0x4e15f0['params']['id']},'transaction':_0xc9a3d0});});})[_0x7511('0x37')](function(){_0x403bb6[_0x7511('0x79')](function(_0x51abc9){socket[_0x7511('0x7a')](_0x7511('0x7b'),{'UserId':_0x51abc9['id'],'ChatQueueId':_0x42f3f8['id']});});});});});}})[_0x7511('0x37')](respondWithStatusCode(_0x581b89,null))[_0x7511('0x27')](handleError(_0x581b89,null));};exports[_0x7511('0x7c')]=function(_0x3e264b,_0x8d1e43,_0x47e7d7){return db[_0x7511('0x70')][_0x7511('0x66')]({'where':{'id':_0x3e264b[_0x7511('0x42')][_0x7511('0x7d')]},'attributes':['id'],'include':[{'model':db[_0x7511('0x67')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x7511('0x37')](handleEntityNotFound(_0x8d1e43,null))[_0x7511('0x37')](function(_0x203f23){var _0x247260=_[_0x7511('0x3d')](_0x203f23,'id');var _0x28d37a=[];var _0x37f26e=[];var _0x187569=squel[_0x7511('0x7e')]();_0x187569[_0x7511('0x7f')](_0x7511('0x80'))[_0x7511('0x81')]('team_has_chat_queues','tq')[_0x7511('0x82')](_0x7511('0x83'),'ut',_0x7511('0x84'))[_0x7511('0x49')](_0x7511('0x85'),_0x3e264b[_0x7511('0x54')]['id']);for(var _0x34bff0=0x0;_0x34bff0<_0x203f23[_0x7511('0x56')];_0x34bff0+=0x1){let _0x4b3d58=_0x203f23[_0x34bff0];for(var _0x4cc3e3=0x0;_0x4cc3e3<_0x4b3d58[_0x7511('0x72')]['length'];_0x4cc3e3+=0x1){let _0x18c9b6=_0x4b3d58[_0x7511('0x72')][_0x4cc3e3];var _0x482b65=_0x187569[_0x7511('0x86')]();_0x482b65[_0x7511('0x49')](_0x7511('0x87'),_0x18c9b6['id']);_0x37f26e[_0x7511('0x88')](db[_0x7511('0x76')]['query'](_0x482b65[_0x7511('0x89')](),{'type':db[_0x7511('0x76')][_0x7511('0x8a')][_0x7511('0x8b')]})[_0x7511('0x37')](function(_0x1e6112){if(_0x1e6112[_0x7511('0x56')]===0x1){return _0x18c9b6['id'];}else{var _0x1d7332=_['every'](_[_0x7511('0x3d')](_0x1e6112,_0x7511('0x8c')),function(_0x20ec52){return _[_0x7511('0x8d')](_0x247260,_0x20ec52);});if(_0x1d7332){return _0x18c9b6['id'];}}}));}}return BPromise[_0x7511('0x8e')](_0x37f26e)[_0x7511('0x37')](function(_0x1b207e){_0x28d37a=_(_0x28d37a)[_0x7511('0x8f')](_0x1b207e)[_0x7511('0x90')]()[_0x7511('0x91')]();return db[_0x7511('0x3e')][_0x7511('0x59')]({'where':{'id':_0x3e264b[_0x7511('0x54')]['id']}})[_0x7511('0x37')](function(_0x5a6b1e){return db[_0x7511('0x76')][_0x7511('0x77')](function(_0x16d059){return _0x5a6b1e[_0x7511('0x7c')](_0x3e264b['query'][_0x7511('0x7d')],{'transaction':_0x16d059})['then'](function(){if(!_['isEmpty'](_0x28d37a)){return _0x5a6b1e['removeAgents'](_0x28d37a,{'transaction':_0x16d059});}})['then'](function(){_0x28d37a[_0x7511('0x79')](function(_0x12ca35){socket['emit'](_0x7511('0x92'),{'UserId':_0x12ca35,'ChatQueueId':_0x5a6b1e['id']});});});});});});})[_0x7511('0x37')](respondWithStatusCode(_0x8d1e43,null))[_0x7511('0x27')](handleError(_0x8d1e43,null));};exports[_0x7511('0x93')]=function(_0x5a7b24,_0x54efe4,_0x4b15ad){return db[_0x7511('0x3e')][_0x7511('0x59')]({'where':{'id':_0x5a7b24[_0x7511('0x54')]['id']}})[_0x7511('0x37')](handleEntityNotFound(_0x54efe4,null))[_0x7511('0x37')](function(_0x1844e3){if(_0x1844e3){return _0x1844e3['addAgents'](_0x5a7b24[_0x7511('0x5b')]['ids'],_[_0x7511('0x94')](_0x5a7b24[_0x7511('0x5b')],[_0x7511('0x7d'),'id'])||{})[_0x7511('0x95')](function(_0x30dd34){for(var _0x450103=0x0;_0x450103<_0x5a7b24[_0x7511('0x5b')][_0x7511('0x7d')]['length'];_0x450103+=0x1){socket[_0x7511('0x7a')]('userChatQueue:save',{'UserId':Number(_0x5a7b24['body'][_0x7511('0x7d')][_0x450103]),'ChatQueueId':Number(_0x5a7b24[_0x7511('0x54')]['id'])});}return _0x30dd34;});}})[_0x7511('0x37')](respondWithResult(_0x54efe4,null))['catch'](handleError(_0x54efe4,null));};exports[_0x7511('0x96')]=function(_0x59a09c,_0x3c9c7a,_0x296829){return db[_0x7511('0x3e')][_0x7511('0x59')]({'where':{'id':_0x59a09c['params']['id']}})[_0x7511('0x37')](handleEntityNotFound(_0x3c9c7a,null))[_0x7511('0x37')](function(_0x3a20f4){if(_0x3a20f4){return _0x3a20f4[_0x7511('0x96')](_0x59a09c['query'][_0x7511('0x7d')])[_0x7511('0x37')](function(){if(_[_0x7511('0x97')](_0x59a09c[_0x7511('0x42')]['ids'])){for(var _0x45c8f5=0x0;_0x45c8f5<_0x59a09c[_0x7511('0x42')]['ids'][_0x7511('0x56')];_0x45c8f5+=0x1){socket[_0x7511('0x7a')](_0x7511('0x92'),{'UserId':Number(_0x59a09c[_0x7511('0x42')]['ids'][_0x45c8f5]),'ChatQueueId':Number(_0x59a09c[_0x7511('0x54')]['id'])});}}else{socket[_0x7511('0x7a')]('userChatQueue:remove',{'UserId':Number(_0x59a09c[_0x7511('0x42')][_0x7511('0x7d')]),'ChatQueueId':Number(_0x59a09c[_0x7511('0x54')]['id'])});}});}})[_0x7511('0x37')](respondWithStatusCode(_0x3c9c7a,null))[_0x7511('0x27')](handleError(_0x3c9c7a,null));};exports[_0x7511('0x98')]=function(_0x2771c4,_0x3eb8d2,_0x9bb224){var _0x4921e6={};var _0x170580={};var _0x4974a3;var _0x174a7e;return db[_0x7511('0x3e')][_0x7511('0x63')]({'where':{'id':_0x2771c4[_0x7511('0x54')]['id']}})['then'](handleEntityNotFound(_0x3eb8d2,null))[_0x7511('0x37')](function(_0x14e6dc){if(_0x14e6dc){_0x4974a3=_0x14e6dc;_0x170580[_0x7511('0x41')]=_[_0x7511('0x55')](db['User']['rawAttributes']);_0x170580[_0x7511('0x42')]=_[_0x7511('0x55')](_0x2771c4[_0x7511('0x42')]);_0x170580['filters']=_[_0x7511('0x43')](_0x170580[_0x7511('0x41')],_0x170580[_0x7511('0x42')]);_0x4921e6[_0x7511('0x45')]=_[_0x7511('0x43')](_0x170580[_0x7511('0x41')],qs['fields'](_0x2771c4['query'][_0x7511('0x44')]));_0x4921e6['attributes']=_0x4921e6[_0x7511('0x45')][_0x7511('0x56')]?_0x4921e6[_0x7511('0x45')]:_0x170580[_0x7511('0x41')];_0x4921e6[_0x7511('0x47')]=qs['sort'](_0x2771c4[_0x7511('0x42')][_0x7511('0x48')]);_0x4921e6[_0x7511('0x49')]=qs[_0x7511('0x4a')](_[_0x7511('0x4b')](_0x2771c4[_0x7511('0x42')],_0x170580[_0x7511('0x4a')]));if(_0x2771c4['query']['filter']){_0x4921e6[_0x7511('0x49')]=_[_0x7511('0x4d')](_0x4921e6[_0x7511('0x49')],{'$or':_[_0x7511('0x3d')](_0x4921e6[_0x7511('0x45')],function(_0x189289){var _0x32e2a3={};_0x32e2a3[_0x189289]={'$like':'%'+_0x2771c4['query']['filter']+'%'};return _0x32e2a3;})});}_0x4921e6=_['merge']({},_0x4921e6,_0x2771c4[_0x7511('0x50')]);return _0x4974a3[_0x7511('0x98')](_0x4921e6);}})[_0x7511('0x37')](function(_0x4d1d03){if(_0x4d1d03){_0x174a7e=_0x4d1d03[_0x7511('0x56')];if(!_0x2771c4[_0x7511('0x42')][_0x7511('0x99')](_0x7511('0x46'))){_0x4921e6[_0x7511('0x2b')]=qs['limit'](_0x2771c4[_0x7511('0x42')]['limit']);_0x4921e6[_0x7511('0x2a')]=qs[_0x7511('0x2a')](_0x2771c4[_0x7511('0x42')][_0x7511('0x2a')]);}return _0x4974a3['getAgents'](_0x4921e6);}})[_0x7511('0x37')](function(_0x2bb4f7){if(_0x2bb4f7){return _0x2bb4f7?{'count':_0x174a7e,'rows':_0x2bb4f7}:null;}})[_0x7511('0x37')](respondWithResult(_0x3eb8d2,null))['catch'](handleError(_0x3eb8d2,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 18df898..ca1da3b 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 _0x9ac8=['ChatQueue','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x247453,_0x33d99d){var _0x5dd474=function(_0x501a0e){while(--_0x501a0e){_0x247453['push'](_0x247453['shift']());}};_0x5dd474(++_0x33d99d);}(_0x9ac8,0x184));var _0x89ac=function(_0x2b22fc,_0x55e38c){_0x2b22fc=_0x2b22fc-0x0;var _0x542b07=_0x9ac8[_0x2b22fc];return _0x542b07;};'use strict';var EventEmitter=require(_0x89ac('0x0'));var ChatQueue=require(_0x89ac('0x1'))['db'][_0x89ac('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x89ac('0x3'),'afterUpdate':_0x89ac('0x4'),'afterDestroy':_0x89ac('0x5')};function emitEvent(_0x32a208){return function(_0x3eb597,_0x3d0aa8,_0x494d3f){ChatQueueEvents[_0x89ac('0x6')](_0x32a208+':'+_0x3eb597['id'],_0x3eb597);ChatQueueEvents[_0x89ac('0x6')](_0x32a208,_0x3eb597);_0x494d3f(null);};}for(var e in events){if(events[_0x89ac('0x7')](e)){var event=events[e];ChatQueue[_0x89ac('0x8')](e,emitEvent(event));}}module[_0x89ac('0x9')]=ChatQueueEvents; \ No newline at end of file +var _0x2c35=['remove','emit','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','update'];(function(_0x14a3d1,_0x598705){var _0x5e647d=function(_0x2247dc){while(--_0x2247dc){_0x14a3d1['push'](_0x14a3d1['shift']());}};_0x5e647d(++_0x598705);}(_0x2c35,0xe5));var _0x52c3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c35[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x52c3('0x0'));var ChatQueue=require(_0x52c3('0x1'))['db'][_0x52c3('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x52c3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x52c3('0x4'),'afterDestroy':_0x52c3('0x5')};function emitEvent(_0x353239){return function(_0x42eb40,_0x437e8a,_0x5d28b5){ChatQueueEvents[_0x52c3('0x6')](_0x353239+':'+_0x42eb40['id'],_0x42eb40);ChatQueueEvents[_0x52c3('0x6')](_0x353239,_0x42eb40);_0x5d28b5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x52c3('0x7')](e,emitEvent(event));}}module[_0x52c3('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 7adffaf..1fed897 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 _0xdbab=['chat_queues','lodash','util','../../config/logger','moment','rimraf','../../config/environment','exports','define','ChatQueue'];(function(_0x2730f5,_0x3395e1){var _0x45b1b0=function(_0x5ffdf7){while(--_0x5ffdf7){_0x2730f5['push'](_0x2730f5['shift']());}};_0x45b1b0(++_0x3395e1);}(_0xdbab,0x97));var _0xbdba=function(_0x283a81,_0x42f033){_0x283a81=_0x283a81-0x0;var _0x57533f=_0xdbab[_0x283a81];return _0x57533f;};'use strict';var _=require(_0xbdba('0x0'));var util=require(_0xbdba('0x1'));var logger=require(_0xbdba('0x2'))('api');var moment=require(_0xbdba('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbdba('0x4'));var config=require(_0xbdba('0x5'));var attributes=require('./chatQueue.attributes');module[_0xbdba('0x6')]=function(_0x3652ce,_0x32c965){return _0x3652ce[_0xbdba('0x7')](_0xbdba('0x8'),attributes,{'tableName':_0xbdba('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2eb5=['request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0x535f88,_0x5d42de){var _0x2c006a=function(_0x205f38){while(--_0x205f38){_0x535f88['push'](_0x535f88['shift']());}};_0x2c006a(++_0x5d42de);}(_0x2eb5,0xe3));var _0x52eb=function(_0x1aa7b9,_0x176302){_0x1aa7b9=_0x1aa7b9-0x0;var _0x34f333=_0x2eb5[_0x1aa7b9];return _0x34f333;};'use strict';var _=require(_0x52eb('0x0'));var util=require(_0x52eb('0x1'));var logger=require(_0x52eb('0x2'))(_0x52eb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x52eb('0x4'));var fs=require('fs');var path=require(_0x52eb('0x5'));var rimraf=require(_0x52eb('0x6'));var config=require(_0x52eb('0x7'));var attributes=require(_0x52eb('0x8'));module[_0x52eb('0x9')]=function(_0x26d0d5,_0x58a2d4){return _0x26d0d5[_0x52eb('0xa')]('ChatQueue',attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 1b4d1d2..4b6fe53 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 _0xa282=['client','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowChatQueue','ChatQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0xa282,0x189));var _0x2a28=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa282[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x2a28('0x0'));var util=require(_0x2a28('0x1'));var moment=require(_0x2a28('0x2'));var BPromise=require(_0x2a28('0x3'));var rs=require(_0x2a28('0x4'));var fs=require('fs');var Redis=require(_0x2a28('0x5'));var db=require(_0x2a28('0x6'))['db'];var utils=require(_0x2a28('0x7'));var logger=require(_0x2a28('0x8'))(_0x2a28('0x9'));var config=require(_0x2a28('0xa'));var jayson=require(_0x2a28('0xb'));var client=jayson[_0x2a28('0xc')]['http']({'port':0x232a});config['redis']=_[_0x2a28('0xd')](config[_0x2a28('0xe')],{'host':_0x2a28('0xf'),'port':0x18eb});var socket=require(_0x2a28('0x10'))(new Redis(config['redis']));require(_0x2a28('0x11'))[_0x2a28('0x12')](socket);function respondWithRpcPromise(_0x2fb466,_0x1b602e,_0x253357){return new BPromise(function(_0x30c4d3,_0x478842){return client[_0x2a28('0x13')](_0x2fb466,_0x253357)['then'](function(_0x1d4e90){logger['info'](_0x2a28('0x14'),_0x1b602e,_0x2a28('0x15'));logger[_0x2a28('0x16')](_0x2a28('0x17'),_0x1b602e,_0x2a28('0x15'),JSON[_0x2a28('0x18')](_0x1d4e90));if(_0x1d4e90[_0x2a28('0x19')]){if(_0x1d4e90['error'][_0x2a28('0x1a')]===0x1f4){logger[_0x2a28('0x19')](_0x2a28('0x14'),_0x1b602e,_0x1d4e90[_0x2a28('0x19')][_0x2a28('0x1b')]);return _0x478842(_0x1d4e90['error'][_0x2a28('0x1b')]);}logger[_0x2a28('0x19')]('ChatQueue,\x20%s,\x20%s',_0x1b602e,_0x1d4e90[_0x2a28('0x19')][_0x2a28('0x1b')]);return _0x30c4d3(_0x1d4e90[_0x2a28('0x19')]['message']);}else{logger[_0x2a28('0x1c')](_0x2a28('0x14'),_0x1b602e,_0x2a28('0x15'));_0x30c4d3(_0x1d4e90[_0x2a28('0x1d')][_0x2a28('0x1b')]);}})[_0x2a28('0x1e')](function(_0x1d3ecf){logger[_0x2a28('0x19')](_0x2a28('0x14'),_0x1b602e,_0x1d3ecf);_0x478842(_0x1d3ecf);});});}exports[_0x2a28('0x1f')]=function(_0xab245){var _0x320b4=this;return new Promise(function(_0x11d3e5,_0x38f256){return db['ChatQueue'][_0x2a28('0x20')]({'raw':_0xab245[_0x2a28('0x21')]?_0xab245[_0x2a28('0x21')][_0x2a28('0x22')]===undefined?!![]:![]:!![],'where':_0xab245[_0x2a28('0x21')]?_0xab245[_0x2a28('0x21')][_0x2a28('0x23')]||null:null,'attributes':_0xab245[_0x2a28('0x21')]?_0xab245[_0x2a28('0x21')][_0x2a28('0x24')]||null:null,'limit':_0xab245[_0x2a28('0x21')]?_0xab245[_0x2a28('0x21')][_0x2a28('0x25')]||null:null,'include':_0xab245[_0x2a28('0x21')]?_0xab245[_0x2a28('0x21')][_0x2a28('0x26')]?_[_0x2a28('0x27')](_0xab245[_0x2a28('0x21')][_0x2a28('0x26')],function(_0xb7db8e){return{'model':db[_0xb7db8e[_0x2a28('0x28')]],'as':_0xb7db8e['as'],'attributes':_0xb7db8e['attributes'],'include':_0xb7db8e[_0x2a28('0x26')]?_[_0x2a28('0x27')](_0xb7db8e[_0x2a28('0x26')],function(_0x4ed138){return{'model':db[_0x4ed138['model']],'as':_0x4ed138['as'],'attributes':_0x4ed138[_0x2a28('0x24')],'include':_0x4ed138[_0x2a28('0x26')]?_[_0x2a28('0x27')](_0x4ed138[_0x2a28('0x26')],function(_0x406d3e){return{'model':db[_0x406d3e['model']],'as':_0x406d3e['as'],'attributes':_0x406d3e[_0x2a28('0x24')]};}):[]};}):[]};}):[]:[]})[_0x2a28('0x29')](function(_0x1ba395){logger[_0x2a28('0x1c')](_0x2a28('0x1f'),_0xab245);logger[_0x2a28('0x16')](_0x2a28('0x1f'),_0xab245,JSON['stringify'](_0x1ba395));_0x11d3e5(_0x1ba395);})[_0x2a28('0x1e')](function(_0x2e2ada){logger[_0x2a28('0x19')]('GetChatQueue',_0x2e2ada[_0x2a28('0x1b')],_0xab245);_0x38f256(_0x320b4['error'](0x1f4,_0x2e2ada[_0x2a28('0x1b')]));});});};exports[_0x2a28('0x2a')]=function(_0x3ad0fc){var _0x25deba=this;return new Promise(function(_0x3ca5f5,_0x1fd6d5){return db[_0x2a28('0x2b')][_0x2a28('0x2c')]({'raw':_0x3ad0fc['options']?_0x3ad0fc['options'][_0x2a28('0x22')]===undefined?!![]:![]:!![],'where':_0x3ad0fc['options']?_0x3ad0fc[_0x2a28('0x21')]['where']||null:null,'attributes':_0x3ad0fc[_0x2a28('0x21')]?_0x3ad0fc[_0x2a28('0x21')][_0x2a28('0x24')]||null:null,'include':_0x3ad0fc[_0x2a28('0x21')]?_0x3ad0fc['options'][_0x2a28('0x26')]?_['map'](_0x3ad0fc[_0x2a28('0x21')][_0x2a28('0x26')],function(_0x3d69fd){return{'model':db[_0x3d69fd['model']],'as':_0x3d69fd['as'],'attributes':_0x3d69fd[_0x2a28('0x24')],'include':_0x3d69fd[_0x2a28('0x26')]?_[_0x2a28('0x27')](_0x3d69fd[_0x2a28('0x26')],function(_0x2efb50){return{'model':db[_0x2efb50[_0x2a28('0x28')]],'as':_0x2efb50['as'],'attributes':_0x2efb50[_0x2a28('0x24')],'include':_0x2efb50[_0x2a28('0x26')]?_[_0x2a28('0x27')](_0x2efb50[_0x2a28('0x26')],function(_0x4f3824){return{'model':db[_0x4f3824[_0x2a28('0x28')]],'as':_0x4f3824['as'],'attributes':_0x4f3824[_0x2a28('0x24')]};}):[]};}):[]};}):[]:[]})[_0x2a28('0x29')](function(_0x169b81){logger[_0x2a28('0x1c')](_0x2a28('0x2a'),_0x3ad0fc);logger[_0x2a28('0x16')](_0x2a28('0x2a'),_0x3ad0fc,JSON['stringify'](_0x169b81));_0x3ca5f5(_0x169b81);})[_0x2a28('0x1e')](function(_0x6d2e76){logger[_0x2a28('0x19')]('ShowChatQueue',_0x6d2e76[_0x2a28('0x1b')],_0x3ad0fc);_0x1fd6d5(_0x25deba[_0x2a28('0x19')](0x1f4,_0x6d2e76['message']));});});}; \ No newline at end of file +var _0x4eb8=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetChatQueue','ChatQueue','findAll','options','raw','limit','include','map','model','attributes','ShowChatQueue','find','where','lodash','util','moment'];(function(_0x18efd3,_0x24f99e){var _0x36834b=function(_0x45f0b8){while(--_0x45f0b8){_0x18efd3['push'](_0x18efd3['shift']());}};_0x36834b(++_0x24f99e);}(_0x4eb8,0x1b5));var _0x84eb=function(_0x4c42ff,_0x3d3d75){_0x4c42ff=_0x4c42ff-0x0;var _0x27387f=_0x4eb8[_0x4c42ff];return _0x27387f;};'use strict';var _=require(_0x84eb('0x0'));var util=require(_0x84eb('0x1'));var moment=require(_0x84eb('0x2'));var BPromise=require(_0x84eb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x84eb('0x4'));var db=require(_0x84eb('0x5'))['db'];var utils=require(_0x84eb('0x6'));var logger=require(_0x84eb('0x7'))(_0x84eb('0x8'));var config=require(_0x84eb('0x9'));var jayson=require(_0x84eb('0xa'));var client=jayson[_0x84eb('0xb')][_0x84eb('0xc')]({'port':0x232a});config['redis']=_[_0x84eb('0xd')](config[_0x84eb('0xe')],{'host':_0x84eb('0xf'),'port':0x18eb});var socket=require(_0x84eb('0x10'))(new Redis(config[_0x84eb('0xe')]));require(_0x84eb('0x11'))[_0x84eb('0x12')](socket);function respondWithRpcPromise(_0x33e9cc,_0x2709d7,_0x4a04e6){return new BPromise(function(_0x15ee2b,_0xf0d060){return client[_0x84eb('0x13')](_0x33e9cc,_0x4a04e6)[_0x84eb('0x14')](function(_0x5b2d53){logger[_0x84eb('0x15')](_0x84eb('0x16'),_0x2709d7,_0x84eb('0x17'));logger[_0x84eb('0x18')](_0x84eb('0x19'),_0x2709d7,'request\x20sent',JSON[_0x84eb('0x1a')](_0x5b2d53));if(_0x5b2d53[_0x84eb('0x1b')]){if(_0x5b2d53[_0x84eb('0x1b')][_0x84eb('0x1c')]===0x1f4){logger[_0x84eb('0x1b')](_0x84eb('0x16'),_0x2709d7,_0x5b2d53[_0x84eb('0x1b')][_0x84eb('0x1d')]);return _0xf0d060(_0x5b2d53[_0x84eb('0x1b')][_0x84eb('0x1d')]);}logger[_0x84eb('0x1b')](_0x84eb('0x16'),_0x2709d7,_0x5b2d53['error'][_0x84eb('0x1d')]);return _0x15ee2b(_0x5b2d53[_0x84eb('0x1b')][_0x84eb('0x1d')]);}else{logger[_0x84eb('0x15')]('ChatQueue,\x20%s,\x20%s',_0x2709d7,'request\x20sent');_0x15ee2b(_0x5b2d53['result']['message']);}})[_0x84eb('0x1e')](function(_0x242bee){logger[_0x84eb('0x1b')]('ChatQueue,\x20%s,\x20%s',_0x2709d7,_0x242bee);_0xf0d060(_0x242bee);});});}exports[_0x84eb('0x1f')]=function(_0x183111){var _0xdaf548=this;return new Promise(function(_0x3f4ffe,_0x26dcfd){return db[_0x84eb('0x20')][_0x84eb('0x21')]({'raw':_0x183111['options']?_0x183111[_0x84eb('0x22')][_0x84eb('0x23')]===undefined?!![]:![]:!![],'where':_0x183111['options']?_0x183111[_0x84eb('0x22')]['where']||null:null,'attributes':_0x183111[_0x84eb('0x22')]?_0x183111[_0x84eb('0x22')]['attributes']||null:null,'limit':_0x183111[_0x84eb('0x22')]?_0x183111[_0x84eb('0x22')][_0x84eb('0x24')]||null:null,'include':_0x183111[_0x84eb('0x22')]?_0x183111[_0x84eb('0x22')][_0x84eb('0x25')]?_[_0x84eb('0x26')](_0x183111[_0x84eb('0x22')]['include'],function(_0x1e71f7){return{'model':db[_0x1e71f7[_0x84eb('0x27')]],'as':_0x1e71f7['as'],'attributes':_0x1e71f7[_0x84eb('0x28')],'include':_0x1e71f7[_0x84eb('0x25')]?_[_0x84eb('0x26')](_0x1e71f7[_0x84eb('0x25')],function(_0xd51ee6){return{'model':db[_0xd51ee6[_0x84eb('0x27')]],'as':_0xd51ee6['as'],'attributes':_0xd51ee6[_0x84eb('0x28')],'include':_0xd51ee6[_0x84eb('0x25')]?_[_0x84eb('0x26')](_0xd51ee6[_0x84eb('0x25')],function(_0x22e11c){return{'model':db[_0x22e11c[_0x84eb('0x27')]],'as':_0x22e11c['as'],'attributes':_0x22e11c['attributes']};}):[]};}):[]};}):[]:[]})[_0x84eb('0x14')](function(_0x105774){logger[_0x84eb('0x15')](_0x84eb('0x1f'),_0x183111);logger[_0x84eb('0x18')]('GetChatQueue',_0x183111,JSON[_0x84eb('0x1a')](_0x105774));_0x3f4ffe(_0x105774);})[_0x84eb('0x1e')](function(_0x2cc885){logger['error'](_0x84eb('0x1f'),_0x2cc885[_0x84eb('0x1d')],_0x183111);_0x26dcfd(_0xdaf548[_0x84eb('0x1b')](0x1f4,_0x2cc885['message']));});});};exports[_0x84eb('0x29')]=function(_0x5e0ee3){var _0x1b2966=this;return new Promise(function(_0x189841,_0xcd74e5){return db[_0x84eb('0x20')][_0x84eb('0x2a')]({'raw':_0x5e0ee3[_0x84eb('0x22')]?_0x5e0ee3[_0x84eb('0x22')][_0x84eb('0x23')]===undefined?!![]:![]:!![],'where':_0x5e0ee3['options']?_0x5e0ee3[_0x84eb('0x22')][_0x84eb('0x2b')]||null:null,'attributes':_0x5e0ee3['options']?_0x5e0ee3[_0x84eb('0x22')][_0x84eb('0x28')]||null:null,'include':_0x5e0ee3[_0x84eb('0x22')]?_0x5e0ee3[_0x84eb('0x22')][_0x84eb('0x25')]?_['map'](_0x5e0ee3[_0x84eb('0x22')][_0x84eb('0x25')],function(_0x3759c8){return{'model':db[_0x3759c8[_0x84eb('0x27')]],'as':_0x3759c8['as'],'attributes':_0x3759c8[_0x84eb('0x28')],'include':_0x3759c8[_0x84eb('0x25')]?_[_0x84eb('0x26')](_0x3759c8['include'],function(_0x5a925d){return{'model':db[_0x5a925d[_0x84eb('0x27')]],'as':_0x5a925d['as'],'attributes':_0x5a925d['attributes'],'include':_0x5a925d[_0x84eb('0x25')]?_[_0x84eb('0x26')](_0x5a925d[_0x84eb('0x25')],function(_0x4d7eab){return{'model':db[_0x4d7eab[_0x84eb('0x27')]],'as':_0x4d7eab['as'],'attributes':_0x4d7eab[_0x84eb('0x28')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1034a0){logger[_0x84eb('0x15')]('ShowChatQueue',_0x5e0ee3);logger[_0x84eb('0x18')](_0x84eb('0x29'),_0x5e0ee3,JSON[_0x84eb('0x1a')](_0x1034a0));_0x189841(_0x1034a0);})[_0x84eb('0x1e')](function(_0x24ba38){logger[_0x84eb('0x1b')](_0x84eb('0x29'),_0x24ba38[_0x84eb('0x1d')],_0x5e0ee3);_0xcd74e5(_0x1b2966['error'](0x1f4,_0x24ba38[_0x84eb('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 9a65b57..322feba 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 _0xbec5=['emit','removeListener','register','length','chatQueue:','./chatQueue.events','save','update'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xbec5,0xe5));var _0x5bec=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xbec5[_0x5cb1af];return _0x8d7940;};'use strict';var ChatQueueEvents=require(_0x5bec('0x0'));var events=[_0x5bec('0x1'),'remove',_0x5bec('0x2')];function createListener(_0x38c81a,_0x276b9e){return function(_0x3859a1){_0x276b9e[_0x5bec('0x3')](_0x38c81a,_0x3859a1);};}function removeListener(_0x4ee982,_0x1f8933){return function(){ChatQueueEvents[_0x5bec('0x4')](_0x4ee982,_0x1f8933);};}exports[_0x5bec('0x5')]=function(_0x4aaac6){for(var _0x3ed67a=0x0,_0x28a427=events[_0x5bec('0x6')];_0x3ed67a<_0x28a427;_0x3ed67a++){var _0x406e65=events[_0x3ed67a];var _0x43d96e=createListener(_0x5bec('0x7')+_0x406e65,_0x4aaac6);ChatQueueEvents['on'](_0x406e65,_0x43d96e);}}; \ No newline at end of file +var _0x0bde=['save','update','emit','removeListener','register','length','chatQueue:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0bde,0xe7));var _0xe0bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0bde[_0x321bb2];return _0x9c12ed;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0xe0bd('0x0'),'remove',_0xe0bd('0x1')];function createListener(_0x3dc984,_0x1d8922){return function(_0x1e198a){_0x1d8922[_0xe0bd('0x2')](_0x3dc984,_0x1e198a);};}function removeListener(_0x5541b9,_0x34df88){return function(){ChatQueueEvents[_0xe0bd('0x3')](_0x5541b9,_0x34df88);};}exports[_0xe0bd('0x4')]=function(_0x3b712a){for(var _0x22bfd1=0x0,_0x26393f=events[_0xe0bd('0x5')];_0x22bfd1<_0x26393f;_0x22bfd1++){var _0x491dc7=events[_0x22bfd1];var _0x40b36a=createListener(_0xe0bd('0x6')+_0x491dc7,_0x3b712a);ChatQueueEvents['on'](_0x491dc7,_0x40b36a);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 4473b72..eb62ecf 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 _0x814b=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x14c2e0,_0x1fb177){var _0x5a0569=function(_0x4410ef){while(--_0x4410ef){_0x14c2e0['push'](_0x14c2e0['shift']());}};_0x5a0569(++_0x1fb177);}(_0x814b,0x1a2));var _0xb814=function(_0x190c49,_0x103457){_0x190c49=_0x190c49-0x0;var _0x475b9a=_0x814b[_0x190c49];return _0x475b9a;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0x16')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0x16')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x18')]);router[_0xb814('0x16')](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller['destroy']);router[_0xb814('0x1c')]('/:id/teams',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x5abb2a,_0x4aca47){var _0x4950dc=function(_0x336279){while(--_0x336279){_0x5abb2a['push'](_0x5abb2a['shift']());}};_0x4950dc(++_0x4aca47);}(_0xe14b,0x93));var _0xbe14=function(_0x25be08,_0x17b425){_0x25be08=_0x25be08-0x0;var _0x5b8d94=_0xe14b[_0x25be08];return _0x5b8d94;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 4d66cc6..8bdd035 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 _0x9534=['exports','STRING','DATE','moment','sequelize'];(function(_0x437e7d,_0x5bde91){var _0x1d2b5b=function(_0x107a7d){while(--_0x107a7d){_0x437e7d['push'](_0x437e7d['shift']());}};_0x1d2b5b(++_0x5bde91);}(_0x9534,0xc6));var _0x4953=function(_0x3479af,_0x41f5a8){_0x3479af=_0x3479af-0x0;var _0xea457c=_0x9534[_0x3479af];return _0xea457c;};'use strict';var moment=require(_0x4953('0x0'));var Sequelize=require(_0x4953('0x1'));module[_0x4953('0x2')]={'uniqueid':{'type':Sequelize[_0x4953('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x4953('0x4')]},'leaveAt':{'type':Sequelize[_0x4953('0x4')]},'acceptAt':{'type':Sequelize[_0x4953('0x4')]},'exitAt':{'type':Sequelize[_0x4953('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd689=['STRING','DATE','exports'];(function(_0x1e9e43,_0x4d84c5){var _0x3be730=function(_0x2dff27){while(--_0x2dff27){_0x1e9e43['push'](_0x1e9e43['shift']());}};_0x3be730(++_0x4d84c5);}(_0xd689,0x188));var _0x9d68=function(_0x455161,_0x520f10){_0x455161=_0x455161-0x0;var _0x3e7c03=_0xd689[_0x455161];return _0x3e7c03;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x9d68('0x0')]={'uniqueid':{'type':Sequelize[_0x9d68('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x9d68('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x9d68('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9d68('0x2')]},'reason':{'type':Sequelize[_0x9d68('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 742660d..ad64919 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 _0x870d=['includeAll','findAll','rows','catch','show','keys','intersection','include','find','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','end','stack','name','index','rawAttributes','map','query','filters','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','ChatQueueReport'];(function(_0x2940d6,_0x2becba){var _0x5dbf83=function(_0x1ab32e){while(--_0x1ab32e){_0x2940d6['push'](_0x2940d6['shift']());}};_0x5dbf83(++_0x2becba);}(_0x870d,0xde));var _0xd870=function(_0x197503,_0x52ded5){_0x197503=_0x197503-0x0;var _0x2afe95=_0x870d[_0x197503];return _0x2afe95;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd870('0x0'));var zipdir=require(_0xd870('0x1'));var jsonpatch=require(_0xd870('0x2'));var rp=require(_0xd870('0x3'));var moment=require(_0xd870('0x4'));var BPromise=require(_0xd870('0x5'));var Mustache=require('mustache');var util=require(_0xd870('0x6'));var path=require(_0xd870('0x7'));var sox=require(_0xd870('0x8'));var csv=require(_0xd870('0x9'));var ejs=require(_0xd870('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd870('0xb'));var squel=require(_0xd870('0xc'));var crypto=require(_0xd870('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd870('0x9'));var querystring=require(_0xd870('0xe'));var Papa=require(_0xd870('0xf'));var Redis=require(_0xd870('0x10'));var authService=require(_0xd870('0x11'));var qs=require(_0xd870('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd870('0x13'))(_0xd870('0x14'));var utils=require(_0xd870('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd870('0x16'));var db=require(_0xd870('0x17'))['db'];function respondWithStatusCode(_0x51137f,_0xd66446){_0xd66446=_0xd66446||0xcc;return function(_0x434193){if(_0x434193){return _0x51137f['sendStatus'](_0xd66446);}return _0x51137f[_0xd870('0x18')](_0xd66446)['end']();};}function respondWithResult(_0x34e325,_0x161fde){_0x161fde=_0x161fde||0xc8;return function(_0x424f06){if(_0x424f06){return _0x34e325[_0xd870('0x18')](_0x161fde)['json'](_0x424f06);}};}function respondWithFilteredResult(_0x1929ef,_0xb2308b){return function(_0x57708e){if(_0x57708e){var _0x14e306=typeof _0xb2308b[_0xd870('0x19')]===_0xd870('0x1a')&&typeof _0xb2308b['limit']===_0xd870('0x1a');var _0xc1f658=_0x57708e['count'];var _0x2b7286=_0x14e306?0x0:_0xb2308b[_0xd870('0x19')];var _0x4ed8da=_0x14e306?_0x57708e[_0xd870('0x1b')]:_0xb2308b[_0xd870('0x19')]+_0xb2308b['limit'];var _0x2e33a2;if(_0x4ed8da>=_0xc1f658){_0x4ed8da=_0xc1f658;_0x2e33a2=0xc8;}else{_0x2e33a2=0xce;}_0x1929ef[_0xd870('0x18')](_0x2e33a2);return _0x1929ef[_0xd870('0x1c')](_0xd870('0x1d'),_0x2b7286+'-'+_0x4ed8da+'/'+_0xc1f658)['json'](_0x57708e);}return null;};}function patchUpdates(_0x53fade){return function(_0x3ea237){try{jsonpatch[_0xd870('0x1e')](_0x3ea237,_0x53fade,!![]);}catch(_0x4dd75e){return BPromise['reject'](_0x4dd75e);}return _0x3ea237[_0xd870('0x1f')]();};}function saveUpdates(_0x1300c,_0xc3e06b){return function(_0x247b90){if(_0x247b90){return _0x247b90[_0xd870('0x20')](_0x1300c)[_0xd870('0x21')](function(_0x134b84){return _0x134b84;});}return null;};}function removeEntity(_0x549b1e,_0x945d1){return function(_0x44787d){if(_0x44787d){return _0x44787d[_0xd870('0x22')]()[_0xd870('0x21')](function(){_0x549b1e[_0xd870('0x18')](0xcc)[_0xd870('0x23')]();});}};}function handleEntityNotFound(_0x3dbf19,_0xf22ff7){return function(_0x2fa5bd){if(!_0x2fa5bd){_0x3dbf19['sendStatus'](0x194);}return _0x2fa5bd;};}function handleError(_0x50d66f,_0x3fcb68){_0x3fcb68=_0x3fcb68||0x1f4;return function(_0x201c8f){logger['error'](_0x201c8f[_0xd870('0x24')]);if(_0x201c8f[_0xd870('0x25')]){delete _0x201c8f[_0xd870('0x25')];}_0x50d66f[_0xd870('0x18')](_0x3fcb68)['send'](_0x201c8f);};}exports[_0xd870('0x26')]=function(_0x401c9d,_0x5bfead){var _0x4413ad={},_0x5ed1d5={},_0x1efd8d={'count':0x0,'rows':[]};var _0x4ccbdb=_['map'](db['ChatQueueReport'][_0xd870('0x27')],function(_0x1061c5){return{'name':_0x1061c5['fieldName'],'type':_0x1061c5['type']['key']};});_0x5ed1d5['model']=_[_0xd870('0x28')](_0x4ccbdb,'name');_0x5ed1d5[_0xd870('0x29')]=_['keys'](_0x401c9d['query']);_0x5ed1d5[_0xd870('0x2a')]=_['intersection'](_0x5ed1d5[_0xd870('0x2b')],_0x5ed1d5[_0xd870('0x29')]);_0x4413ad[_0xd870('0x2c')]=_['intersection'](_0x5ed1d5[_0xd870('0x2b')],qs['fields'](_0x401c9d[_0xd870('0x29')][_0xd870('0x2d')]));_0x4413ad['attributes']=_0x4413ad[_0xd870('0x2c')][_0xd870('0x2e')]?_0x4413ad[_0xd870('0x2c')]:_0x5ed1d5[_0xd870('0x2b')];if(!_0x401c9d[_0xd870('0x29')]['hasOwnProperty'](_0xd870('0x2f'))){_0x4413ad['limit']=qs[_0xd870('0x30')](_0x401c9d[_0xd870('0x29')]['limit']);_0x4413ad[_0xd870('0x19')]=qs['offset'](_0x401c9d[_0xd870('0x29')][_0xd870('0x19')]);}_0x4413ad[_0xd870('0x31')]=qs[_0xd870('0x32')](_0x401c9d[_0xd870('0x29')][_0xd870('0x32')]);_0x4413ad[_0xd870('0x33')]=qs['filters'](_[_0xd870('0x34')](_0x401c9d[_0xd870('0x29')],_0x5ed1d5[_0xd870('0x2a')]),_0x4ccbdb);if(_0x401c9d['query'][_0xd870('0x35')]){_0x4413ad[_0xd870('0x33')]=_[_0xd870('0x36')](_0x4413ad[_0xd870('0x33')],{'$or':_['map'](_0x4ccbdb,function(_0x55daa8){if(_0x55daa8[_0xd870('0x37')]!==_0xd870('0x38')){var _0x171590={};_0x171590[_0x55daa8[_0xd870('0x25')]]={'$like':'%'+_0x401c9d[_0xd870('0x29')]['filter']+'%'};return _0x171590;}})});}_0x4413ad=_[_0xd870('0x36')]({},_0x4413ad,_0x401c9d['options']);var _0x326762={'where':_0x4413ad[_0xd870('0x33')]};return db[_0xd870('0x39')]['count'](_0x326762)['then'](function(_0x516332){_0x1efd8d[_0xd870('0x1b')]=_0x516332;if(_0x401c9d[_0xd870('0x29')][_0xd870('0x3a')]){_0x4413ad['include']=[{'all':!![]}];}return db[_0xd870('0x39')][_0xd870('0x3b')](_0x4413ad);})[_0xd870('0x21')](function(_0x5e04be){_0x1efd8d[_0xd870('0x3c')]=_0x5e04be;return _0x1efd8d;})['then'](respondWithFilteredResult(_0x5bfead,_0x4413ad))[_0xd870('0x3d')](handleError(_0x5bfead,null));};exports[_0xd870('0x3e')]=function(_0x389278,_0x53291d){var _0x3adbe4={'raw':!![],'where':{'id':_0x389278['params']['id']}},_0x5ead29={};_0x5ead29[_0xd870('0x2b')]=_[_0xd870('0x3f')](db[_0xd870('0x39')][_0xd870('0x27')]);_0x5ead29[_0xd870('0x29')]=_['keys'](_0x389278[_0xd870('0x29')]);_0x5ead29['filters']=_[_0xd870('0x40')](_0x5ead29[_0xd870('0x2b')],_0x5ead29[_0xd870('0x29')]);_0x3adbe4[_0xd870('0x2c')]=_[_0xd870('0x40')](_0x5ead29[_0xd870('0x2b')],qs[_0xd870('0x2d')](_0x389278[_0xd870('0x29')][_0xd870('0x2d')]));_0x3adbe4[_0xd870('0x2c')]=_0x3adbe4[_0xd870('0x2c')][_0xd870('0x2e')]?_0x3adbe4[_0xd870('0x2c')]:_0x5ead29[_0xd870('0x2b')];if(_0x389278[_0xd870('0x29')][_0xd870('0x3a')]){_0x3adbe4[_0xd870('0x41')]=[{'all':!![]}];}_0x3adbe4=_[_0xd870('0x36')]({},_0x3adbe4,_0x389278['options']);return db['ChatQueueReport'][_0xd870('0x42')](_0x3adbe4)[_0xd870('0x21')](handleEntityNotFound(_0x53291d,null))['then'](respondWithResult(_0x53291d,null))[_0xd870('0x3d')](handleError(_0x53291d,null));};exports['create']=function(_0x428c5f,_0x255ba5){return db['ChatQueueReport']['create'](_0x428c5f[_0xd870('0x43')],{})['then'](respondWithResult(_0x255ba5,0xc9))[_0xd870('0x3d')](handleError(_0x255ba5,null));};exports[_0xd870('0x20')]=function(_0x1c6635,_0x3459b1){if(_0x1c6635[_0xd870('0x43')]['id']){delete _0x1c6635[_0xd870('0x43')]['id'];}return db[_0xd870('0x39')]['find']({'where':{'id':_0x1c6635[_0xd870('0x44')]['id']}})[_0xd870('0x21')](handleEntityNotFound(_0x3459b1,null))[_0xd870('0x21')](saveUpdates(_0x1c6635[_0xd870('0x43')],null))[_0xd870('0x21')](respondWithResult(_0x3459b1,null))[_0xd870('0x3d')](handleError(_0x3459b1,null));};exports[_0xd870('0x22')]=function(_0x4ca6a6,_0x49ef39){return db[_0xd870('0x39')]['find']({'where':{'id':_0x4ca6a6[_0xd870('0x44')]['id']}})[_0xd870('0x21')](handleEntityNotFound(_0x49ef39,null))[_0xd870('0x21')](removeEntity(_0x49ef39,null))[_0xd870('0x3d')](handleError(_0x49ef39,null));};exports[_0xd870('0x45')]=function(_0x439e12,_0x477ee5){return db['ChatQueueReport'][_0xd870('0x45')]()[_0xd870('0x21')](respondWithResult(_0x477ee5,null))[_0xd870('0x3d')](handleError(_0x477ee5,null));}; \ No newline at end of file +var _0x46c1=['limit','status','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','count','offset'];(function(_0x3d8d04,_0x51536b){var _0x43b01a=function(_0x330909){while(--_0x330909){_0x3d8d04['push'](_0x3d8d04['shift']());}};_0x43b01a(++_0x51536b);}(_0x46c1,0x7c));var _0x146c=function(_0x442281,_0x1fa0d6){_0x442281=_0x442281-0x0;var _0xde9648=_0x46c1[_0x442281];return _0xde9648;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x146c('0x0'));var zipdir=require(_0x146c('0x1'));var jsonpatch=require(_0x146c('0x2'));var rp=require(_0x146c('0x3'));var moment=require(_0x146c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x146c('0x5'));var util=require(_0x146c('0x6'));var path=require(_0x146c('0x7'));var sox=require(_0x146c('0x8'));var csv=require(_0x146c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x146c('0xa'));var squel=require(_0x146c('0xb'));var crypto=require(_0x146c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x146c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x146c('0xe'));var Papa=require(_0x146c('0xf'));var Redis=require('ioredis');var authService=require(_0x146c('0x10'));var qs=require(_0x146c('0x11'));var as=require(_0x146c('0x12'));var hardwareService=require(_0x146c('0x13'));var logger=require('../../config/logger')(_0x146c('0x14'));var utils=require('../../config/utils');var config=require(_0x146c('0x15'));var licenseUtil=require(_0x146c('0x16'));var db=require(_0x146c('0x17'))['db'];function respondWithStatusCode(_0x5c661e,_0xae68cf){_0xae68cf=_0xae68cf||0xcc;return function(_0x5921d3){if(_0x5921d3){return _0x5c661e[_0x146c('0x18')](_0xae68cf);}return _0x5c661e['status'](_0xae68cf)[_0x146c('0x19')]();};}function respondWithResult(_0x138063,_0xc9bd2d){_0xc9bd2d=_0xc9bd2d||0xc8;return function(_0x1cd513){if(_0x1cd513){return _0x138063['status'](_0xc9bd2d)[_0x146c('0x1a')](_0x1cd513);}};}function respondWithFilteredResult(_0xa535fd,_0x552524){return function(_0x25a3b3){if(_0x25a3b3){var _0x50bdae=typeof _0x552524['offset']===_0x146c('0x1b')&&typeof _0x552524['limit']===_0x146c('0x1b');var _0x1543f4=_0x25a3b3[_0x146c('0x1c')];var _0x4b1f21=_0x50bdae?0x0:_0x552524[_0x146c('0x1d')];var _0x22cd97=_0x50bdae?_0x25a3b3[_0x146c('0x1c')]:_0x552524[_0x146c('0x1d')]+_0x552524[_0x146c('0x1e')];var _0x3d469f;if(_0x22cd97>=_0x1543f4){_0x22cd97=_0x1543f4;_0x3d469f=0xc8;}else{_0x3d469f=0xce;}_0xa535fd[_0x146c('0x1f')](_0x3d469f);return _0xa535fd[_0x146c('0x20')](_0x146c('0x21'),_0x4b1f21+'-'+_0x22cd97+'/'+_0x1543f4)['json'](_0x25a3b3);}return null;};}function patchUpdates(_0x1b33f2){return function(_0x2c44b5){try{jsonpatch[_0x146c('0x22')](_0x2c44b5,_0x1b33f2,!![]);}catch(_0x8e7792){return BPromise[_0x146c('0x23')](_0x8e7792);}return _0x2c44b5['save']();};}function saveUpdates(_0x5b5ada,_0x1dfd0f){return function(_0x26f5ed){if(_0x26f5ed){return _0x26f5ed[_0x146c('0x24')](_0x5b5ada)[_0x146c('0x25')](function(_0x4c6d56){return _0x4c6d56;});}return null;};}function removeEntity(_0x41f2a2,_0x3ee8d7){return function(_0xbe3d5f){if(_0xbe3d5f){return _0xbe3d5f[_0x146c('0x26')]()[_0x146c('0x25')](function(){_0x41f2a2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1257ff,_0x3651b3){return function(_0x393e6c){if(!_0x393e6c){_0x1257ff[_0x146c('0x18')](0x194);}return _0x393e6c;};}function handleError(_0x4eef57,_0x33617e){_0x33617e=_0x33617e||0x1f4;return function(_0x2a3cde){logger[_0x146c('0x27')](_0x2a3cde[_0x146c('0x28')]);if(_0x2a3cde[_0x146c('0x29')]){delete _0x2a3cde[_0x146c('0x29')];}_0x4eef57[_0x146c('0x1f')](_0x33617e)[_0x146c('0x2a')](_0x2a3cde);};}exports[_0x146c('0x2b')]=function(_0x5158b2,_0x7c336b){var _0x566d90={},_0x5c44ef={},_0x3a88f9={'count':0x0,'rows':[]};var _0x46480c=_[_0x146c('0x2c')](db[_0x146c('0x2d')][_0x146c('0x2e')],function(_0x2e07e3){return{'name':_0x2e07e3[_0x146c('0x2f')],'type':_0x2e07e3[_0x146c('0x30')][_0x146c('0x31')]};});_0x5c44ef[_0x146c('0x32')]=_[_0x146c('0x2c')](_0x46480c,'name');_0x5c44ef[_0x146c('0x33')]=_[_0x146c('0x34')](_0x5158b2['query']);_0x5c44ef[_0x146c('0x35')]=_[_0x146c('0x36')](_0x5c44ef[_0x146c('0x32')],_0x5c44ef[_0x146c('0x33')]);_0x566d90[_0x146c('0x37')]=_['intersection'](_0x5c44ef['model'],qs[_0x146c('0x38')](_0x5158b2[_0x146c('0x33')][_0x146c('0x38')]));_0x566d90[_0x146c('0x37')]=_0x566d90[_0x146c('0x37')]['length']?_0x566d90[_0x146c('0x37')]:_0x5c44ef[_0x146c('0x32')];if(!_0x5158b2[_0x146c('0x33')][_0x146c('0x39')]('nolimit')){_0x566d90[_0x146c('0x1e')]=qs[_0x146c('0x1e')](_0x5158b2[_0x146c('0x33')][_0x146c('0x1e')]);_0x566d90[_0x146c('0x1d')]=qs[_0x146c('0x1d')](_0x5158b2[_0x146c('0x33')][_0x146c('0x1d')]);}_0x566d90[_0x146c('0x3a')]=qs[_0x146c('0x3b')](_0x5158b2[_0x146c('0x33')][_0x146c('0x3b')]);_0x566d90[_0x146c('0x3c')]=qs[_0x146c('0x35')](_[_0x146c('0x3d')](_0x5158b2[_0x146c('0x33')],_0x5c44ef['filters']),_0x46480c);if(_0x5158b2[_0x146c('0x33')]['filter']){_0x566d90[_0x146c('0x3c')]=_[_0x146c('0x3e')](_0x566d90['where'],{'$or':_[_0x146c('0x2c')](_0x46480c,function(_0x5dc288){if(_0x5dc288['type']!==_0x146c('0x3f')){var _0x2c998d={};_0x2c998d[_0x5dc288[_0x146c('0x29')]]={'$like':'%'+_0x5158b2[_0x146c('0x33')][_0x146c('0x40')]+'%'};return _0x2c998d;}})});}_0x566d90=_['merge']({},_0x566d90,_0x5158b2[_0x146c('0x41')]);var _0x3f3dcc={'where':_0x566d90['where']};return db[_0x146c('0x2d')][_0x146c('0x1c')](_0x3f3dcc)[_0x146c('0x25')](function(_0x2e6471){_0x3a88f9[_0x146c('0x1c')]=_0x2e6471;if(_0x5158b2[_0x146c('0x33')][_0x146c('0x42')]){_0x566d90[_0x146c('0x43')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x146c('0x44')](_0x566d90);})[_0x146c('0x25')](function(_0x1c8cbe){_0x3a88f9[_0x146c('0x45')]=_0x1c8cbe;return _0x3a88f9;})[_0x146c('0x25')](respondWithFilteredResult(_0x7c336b,_0x566d90))[_0x146c('0x46')](handleError(_0x7c336b,null));};exports[_0x146c('0x47')]=function(_0x1b188f,_0x1ca7cb){var _0x29149a={'raw':!![],'where':{'id':_0x1b188f[_0x146c('0x48')]['id']}},_0x58d7ec={};_0x58d7ec[_0x146c('0x32')]=_[_0x146c('0x34')](db['ChatQueueReport'][_0x146c('0x2e')]);_0x58d7ec[_0x146c('0x33')]=_[_0x146c('0x34')](_0x1b188f['query']);_0x58d7ec[_0x146c('0x35')]=_[_0x146c('0x36')](_0x58d7ec['model'],_0x58d7ec[_0x146c('0x33')]);_0x29149a[_0x146c('0x37')]=_[_0x146c('0x36')](_0x58d7ec[_0x146c('0x32')],qs[_0x146c('0x38')](_0x1b188f['query']['fields']));_0x29149a[_0x146c('0x37')]=_0x29149a['attributes'][_0x146c('0x49')]?_0x29149a[_0x146c('0x37')]:_0x58d7ec[_0x146c('0x32')];if(_0x1b188f['query'][_0x146c('0x42')]){_0x29149a[_0x146c('0x43')]=[{'all':!![]}];}_0x29149a=_[_0x146c('0x3e')]({},_0x29149a,_0x1b188f[_0x146c('0x41')]);return db[_0x146c('0x2d')]['find'](_0x29149a)['then'](handleEntityNotFound(_0x1ca7cb,null))[_0x146c('0x25')](respondWithResult(_0x1ca7cb,null))[_0x146c('0x46')](handleError(_0x1ca7cb,null));};exports[_0x146c('0x4a')]=function(_0x46398e,_0xc6b7be){return db[_0x146c('0x2d')]['create'](_0x46398e[_0x146c('0x4b')],{})['then'](respondWithResult(_0xc6b7be,0xc9))[_0x146c('0x46')](handleError(_0xc6b7be,null));};exports[_0x146c('0x24')]=function(_0x5a6e88,_0x58f581){if(_0x5a6e88[_0x146c('0x4b')]['id']){delete _0x5a6e88['body']['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x5a6e88[_0x146c('0x48')]['id']}})[_0x146c('0x25')](handleEntityNotFound(_0x58f581,null))[_0x146c('0x25')](saveUpdates(_0x5a6e88[_0x146c('0x4b')],null))['then'](respondWithResult(_0x58f581,null))[_0x146c('0x46')](handleError(_0x58f581,null));};exports[_0x146c('0x26')]=function(_0x4d80b2,_0x2aa597){return db[_0x146c('0x2d')][_0x146c('0x4c')]({'where':{'id':_0x4d80b2[_0x146c('0x48')]['id']}})[_0x146c('0x25')](handleEntityNotFound(_0x2aa597,null))[_0x146c('0x25')](removeEntity(_0x2aa597,null))[_0x146c('0x46')](handleError(_0x2aa597,null));};exports['describe']=function(_0x57c4e5,_0x52bf40){return db[_0x146c('0x2d')]['describe']()[_0x146c('0x25')](respondWithResult(_0x52bf40,null))[_0x146c('0x46')](handleError(_0x52bf40,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 84ecbb2..2b3948f 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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x31e147,_0x146784){var _0x4fead9=function(_0x5f4b96){while(--_0x5f4b96){_0x31e147['push'](_0x31e147['shift']());}};_0x4fead9(++_0x146784);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xb7e7[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x595604,_0x2cc998){var _0x1466f3=function(_0x4e1d9b){while(--_0x4e1d9b){_0x595604['push'](_0x595604['shift']());}};_0x1466f3(++_0x2cc998);}(_0xb10b,0x12a));var _0xbb10=function(_0x53286a,_0x485c92){_0x53286a=_0x53286a-0x0;var _0x5730ff=_0xb10b[_0x53286a];return _0x5730ff;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('ChatQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'name':_0xbb10('0xc'),'fields':[_0xbb10('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 7f25198..fd4d729 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 _0xee7f=['attributes','limit','UpdateChatQueueReport','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatQueueReport','body','options','raw','update','where'];(function(_0x8261bb,_0x48e718){var _0x530867=function(_0x4b2b4e){while(--_0x4b2b4e){_0x8261bb['push'](_0x8261bb['shift']());}};_0x530867(++_0x48e718);}(_0xee7f,0xc3));var _0xfee7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xee7f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfee7('0x0'));var BPromise=require(_0xfee7('0x1'));var rs=require(_0xfee7('0x2'));var fs=require('fs');var Redis=require(_0xfee7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfee7('0x4'));var logger=require(_0xfee7('0x5'))(_0xfee7('0x6'));var config=require(_0xfee7('0x7'));var jayson=require(_0xfee7('0x8'));var client=jayson[_0xfee7('0x9')][_0xfee7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x482abf,_0x309e13,_0x216bfe){return new BPromise(function(_0x481f0e,_0x326255){return client[_0xfee7('0xb')](_0x482abf,_0x216bfe)[_0xfee7('0xc')](function(_0x40515e){logger[_0xfee7('0xd')](_0xfee7('0xe'),_0x309e13,_0xfee7('0xf'));logger[_0xfee7('0x10')](_0xfee7('0x11'),_0x309e13,_0xfee7('0xf'),JSON[_0xfee7('0x12')](_0x40515e));if(_0x40515e['error']){if(_0x40515e[_0xfee7('0x13')][_0xfee7('0x14')]===0x1f4){logger[_0xfee7('0x13')](_0xfee7('0xe'),_0x309e13,_0x40515e[_0xfee7('0x13')][_0xfee7('0x15')]);return _0x326255(_0x40515e[_0xfee7('0x13')]['message']);}logger['error'](_0xfee7('0xe'),_0x309e13,_0x40515e['error'][_0xfee7('0x15')]);return _0x481f0e(_0x40515e[_0xfee7('0x13')][_0xfee7('0x15')]);}else{logger[_0xfee7('0xd')](_0xfee7('0xe'),_0x309e13,_0xfee7('0xf'));_0x481f0e(_0x40515e['result'][_0xfee7('0x15')]);}})[_0xfee7('0x16')](function(_0x374fc0){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x309e13,_0x374fc0);_0x326255(_0x374fc0);});});}exports[_0xfee7('0x17')]=function(_0x329711){var _0x5295b1=this;return new Promise(function(_0x41e841,_0x18dde8){return db['ChatQueueReport']['create'](_0x329711[_0xfee7('0x18')],{'raw':_0x329711[_0xfee7('0x19')]?_0x329711[_0xfee7('0x19')][_0xfee7('0x1a')]===undefined?!![]:![]:!![]})[_0xfee7('0xc')](function(_0x555442){logger[_0xfee7('0xd')](_0xfee7('0x17'),_0x329711);logger[_0xfee7('0x10')](_0xfee7('0x17'),_0x329711,JSON['stringify'](_0x555442));_0x41e841(_0x555442);})[_0xfee7('0x16')](function(_0x58e8c1){logger[_0xfee7('0x13')](_0xfee7('0x17'),_0x58e8c1['message'],_0x329711);_0x18dde8(_0x5295b1[_0xfee7('0x13')](0x1f4,_0x58e8c1[_0xfee7('0x15')]));});});};exports['UpdateChatQueueReport']=function(_0x367a4e){var _0x157e86=this;return new Promise(function(_0x1a0a3a,_0x1c31dd){return db['ChatQueueReport'][_0xfee7('0x1b')](_0x367a4e[_0xfee7('0x18')],{'raw':_0x367a4e[_0xfee7('0x19')]?_0x367a4e['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x367a4e[_0xfee7('0x19')]?_0x367a4e[_0xfee7('0x19')][_0xfee7('0x1c')]||null:null,'attributes':_0x367a4e[_0xfee7('0x19')]?_0x367a4e[_0xfee7('0x19')][_0xfee7('0x1d')]||null:null,'limit':_0x367a4e['options']?_0x367a4e[_0xfee7('0x19')][_0xfee7('0x1e')]||null:null})['then'](function(_0x70f036){logger[_0xfee7('0xd')](_0xfee7('0x1f'),_0x367a4e);logger[_0xfee7('0x10')](_0xfee7('0x1f'),_0x367a4e,JSON[_0xfee7('0x12')](_0x70f036));_0x1a0a3a(_0x70f036);})['catch'](function(_0x52c90e){logger[_0xfee7('0x13')](_0xfee7('0x1f'),_0x52c90e['message'],_0x367a4e);_0x1c31dd(_0x157e86['error'](0x1f4,_0x52c90e['message']));});});}; \ No newline at end of file +var _0x1912=['CreateChatQueueReport','debug','update','attributes','UpdateChatQueueReport','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','error','code','message','ChatQueueReport,\x20%s,\x20%s','result','catch','ChatQueueReport','create','body','options','raw'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x1912,0x192));var _0x2191=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x1912[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x2191('0x0'));var util=require(_0x2191('0x1'));var moment=require(_0x2191('0x2'));var BPromise=require(_0x2191('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2191('0x4'));var db=require(_0x2191('0x5'))['db'];var utils=require(_0x2191('0x6'));var logger=require(_0x2191('0x7'))('rpc');var config=require(_0x2191('0x8'));var jayson=require(_0x2191('0x9'));var client=jayson[_0x2191('0xa')][_0x2191('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x539728,_0x1b27cf,_0x4f04d8){return new BPromise(function(_0x5a82f4,_0x3b91d6){return client[_0x2191('0xc')](_0x539728,_0x4f04d8)[_0x2191('0xd')](function(_0x1e0d15){logger[_0x2191('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x1b27cf,_0x2191('0xf'));logger['debug']('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x1b27cf,_0x2191('0xf'),JSON['stringify'](_0x1e0d15));if(_0x1e0d15[_0x2191('0x10')]){if(_0x1e0d15[_0x2191('0x10')][_0x2191('0x11')]===0x1f4){logger[_0x2191('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x1b27cf,_0x1e0d15[_0x2191('0x10')][_0x2191('0x12')]);return _0x3b91d6(_0x1e0d15[_0x2191('0x10')]['message']);}logger[_0x2191('0x10')](_0x2191('0x13'),_0x1b27cf,_0x1e0d15[_0x2191('0x10')][_0x2191('0x12')]);return _0x5a82f4(_0x1e0d15[_0x2191('0x10')]['message']);}else{logger[_0x2191('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x1b27cf,_0x2191('0xf'));_0x5a82f4(_0x1e0d15[_0x2191('0x14')]['message']);}})[_0x2191('0x15')](function(_0x2fc638){logger[_0x2191('0x10')](_0x2191('0x13'),_0x1b27cf,_0x2fc638);_0x3b91d6(_0x2fc638);});});}exports['CreateChatQueueReport']=function(_0x578dfa){var _0x4090e0=this;return new Promise(function(_0x37d320,_0x360ed2){return db[_0x2191('0x16')][_0x2191('0x17')](_0x578dfa[_0x2191('0x18')],{'raw':_0x578dfa[_0x2191('0x19')]?_0x578dfa[_0x2191('0x19')][_0x2191('0x1a')]===undefined?!![]:![]:!![]})[_0x2191('0xd')](function(_0x1d5b82){logger['info'](_0x2191('0x1b'),_0x578dfa);logger[_0x2191('0x1c')](_0x2191('0x1b'),_0x578dfa,JSON['stringify'](_0x1d5b82));_0x37d320(_0x1d5b82);})[_0x2191('0x15')](function(_0x1290cc){logger[_0x2191('0x10')](_0x2191('0x1b'),_0x1290cc[_0x2191('0x12')],_0x578dfa);_0x360ed2(_0x4090e0['error'](0x1f4,_0x1290cc[_0x2191('0x12')]));});});};exports['UpdateChatQueueReport']=function(_0x339905){var _0x386924=this;return new Promise(function(_0x2ffffc,_0x1ea581){return db[_0x2191('0x16')][_0x2191('0x1d')](_0x339905[_0x2191('0x18')],{'raw':_0x339905[_0x2191('0x19')]?_0x339905[_0x2191('0x19')][_0x2191('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x339905[_0x2191('0x19')]?_0x339905[_0x2191('0x19')]['where']||null:null,'attributes':_0x339905[_0x2191('0x19')]?_0x339905[_0x2191('0x19')][_0x2191('0x1e')]||null:null,'limit':_0x339905['options']?_0x339905[_0x2191('0x19')]['limit']||null:null})['then'](function(_0x32a823){logger[_0x2191('0xe')](_0x2191('0x1f'),_0x339905);logger[_0x2191('0x1c')](_0x2191('0x1f'),_0x339905,JSON[_0x2191('0x20')](_0x32a823));_0x2ffffc(_0x32a823);})[_0x2191('0x15')](function(_0x552d73){logger[_0x2191('0x10')]('UpdateChatQueueReport',_0x552d73[_0x2191('0x12')],_0x339905);_0x1ea581(_0x386924[_0x2191('0x10')](0x1f4,_0x552d73[_0x2191('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index bb744b7..58e365c 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 _0x3e15=['show','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','/describe','/:id'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x3e15,0xd8));var _0x53e1=function(_0x433cf1,_0x454307){_0x433cf1=_0x433cf1-0x0;var _0x149e64=_0x3e15[_0x433cf1];return _0x149e64;};'use strict';var multer=require(_0x53e1('0x0'));var util=require(_0x53e1('0x1'));var path=require(_0x53e1('0x2'));var timeout=require(_0x53e1('0x3'));var express=require(_0x53e1('0x4'));var router=express[_0x53e1('0x5')]();var fs_extra=require(_0x53e1('0x6'));var auth=require(_0x53e1('0x7'));var interaction=require(_0x53e1('0x8'));var config=require(_0x53e1('0x9'));var controller=require(_0x53e1('0xa'));router[_0x53e1('0xb')]('/',auth[_0x53e1('0xc')](),controller['index']);router[_0x53e1('0xb')](_0x53e1('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x53e1('0xb')](_0x53e1('0xe'),auth[_0x53e1('0xc')](),controller[_0x53e1('0xf')]);router[_0x53e1('0x10')]('/',auth['isAuthenticated'](),controller[_0x53e1('0x11')]);router[_0x53e1('0x12')](_0x53e1('0xe'),auth[_0x53e1('0xc')](),controller['update']);router[_0x53e1('0x13')](_0x53e1('0xe'),auth[_0x53e1('0xc')](),controller[_0x53e1('0x14')]);module['exports']=router; \ No newline at end of file +var _0x4543=['show','isAuthenticated','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','/describe','describe'];(function(_0x4b778a,_0x2a6d48){var _0x59562c=function(_0x322086){while(--_0x322086){_0x4b778a['push'](_0x4b778a['shift']());}};_0x59562c(++_0x2a6d48);}(_0x4543,0x12f));var _0x3454=function(_0x4916ca,_0x3d19c2){_0x4916ca=_0x4916ca-0x0;var _0x598fe8=_0x4543[_0x4916ca];return _0x598fe8;};'use strict';var multer=require(_0x3454('0x0'));var util=require('util');var path=require(_0x3454('0x1'));var timeout=require(_0x3454('0x2'));var express=require('express');var router=express[_0x3454('0x3')]();var fs_extra=require(_0x3454('0x4'));var auth=require(_0x3454('0x5'));var interaction=require(_0x3454('0x6'));var config=require(_0x3454('0x7'));var controller=require(_0x3454('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3454('0x9')](_0x3454('0xa'),auth['isAuthenticated'](),controller[_0x3454('0xb')]);router[_0x3454('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x3454('0xc')]);router['post']('/',auth[_0x3454('0xd')](),controller[_0x3454('0xe')]);router[_0x3454('0xf')](_0x3454('0x10'),auth[_0x3454('0xd')](),controller[_0x3454('0x11')]);router[_0x3454('0x12')](_0x3454('0x10'),auth['isAuthenticated'](),controller[_0x3454('0x13')]);module[_0x3454('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 60c707b..9f2eec3 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x3e88da,_0xbadca6){var _0xf768d8=function(_0x352054){while(--_0x352054){_0x3e88da['push'](_0x3e88da['shift']());}};_0xf768d8(++_0xbadca6);}(_0xedd9,0xfc));var _0x9edd=function(_0x28212d,_0x449ce4){_0x28212d=_0x28212d-0x0;var _0x15aca7=_0xedd9[_0x28212d];return _0x15aca7;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x42a2fd,_0x11002a){var _0xc7530=function(_0x22f4a4){while(--_0x22f4a4){_0x42a2fd['push'](_0x42a2fd['shift']());}};_0xc7530(++_0x11002a);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x00bb[_0x5c351c];return _0x26f3b3;};'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 diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 062ddf8..d098cfe 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 _0x5840=['pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5840,0x1cd));var _0x0584=function(_0x5efd4d,_0x428f2e){_0x5efd4d=_0x5efd4d-0x0;var _0x5d3540=_0x5840[_0x5efd4d];return _0x5d3540;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0584('0x0'));var zipdir=require(_0x0584('0x1'));var jsonpatch=require(_0x0584('0x2'));var rp=require(_0x0584('0x3'));var moment=require(_0x0584('0x4'));var BPromise=require(_0x0584('0x5'));var Mustache=require('mustache');var util=require(_0x0584('0x6'));var path=require('path');var sox=require(_0x0584('0x7'));var csv=require(_0x0584('0x8'));var ejs=require(_0x0584('0x9'));var fs=require('fs');var fs_extra=require(_0x0584('0xa'));var _=require('lodash');var squel=require(_0x0584('0xb'));var crypto=require('crypto');var jsforce=require(_0x0584('0xc'));var deskjs=require(_0x0584('0xd'));var toCsv=require(_0x0584('0x8'));var querystring=require(_0x0584('0xe'));var Papa=require(_0x0584('0xf'));var Redis=require('ioredis');var authService=require(_0x0584('0x10'));var qs=require(_0x0584('0x11'));var as=require(_0x0584('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x0584('0x13'));var config=require(_0x0584('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e20cc,_0x538921){_0x538921=_0x538921||0xcc;return function(_0x50ba2e){if(_0x50ba2e){return _0x4e20cc['sendStatus'](_0x538921);}return _0x4e20cc[_0x0584('0x15')](_0x538921)[_0x0584('0x16')]();};}function respondWithResult(_0x32d484,_0x1a1f7b){_0x1a1f7b=_0x1a1f7b||0xc8;return function(_0x1b9ee6){if(_0x1b9ee6){return _0x32d484[_0x0584('0x15')](_0x1a1f7b)['json'](_0x1b9ee6);}};}function respondWithFilteredResult(_0x77aef0,_0x5adac2){return function(_0x426dc9){if(_0x426dc9){var _0x32c7e5=typeof _0x5adac2[_0x0584('0x17')]===_0x0584('0x18')&&typeof _0x5adac2[_0x0584('0x19')]===_0x0584('0x18');var _0x369391=_0x426dc9[_0x0584('0x1a')];var _0x2a002d=_0x32c7e5?0x0:_0x5adac2[_0x0584('0x17')];var _0x4d74bb=_0x32c7e5?_0x426dc9['count']:_0x5adac2['offset']+_0x5adac2['limit'];var _0x3d2663;if(_0x4d74bb>=_0x369391){_0x4d74bb=_0x369391;_0x3d2663=0xc8;}else{_0x3d2663=0xce;}_0x77aef0[_0x0584('0x15')](_0x3d2663);return _0x77aef0[_0x0584('0x1b')](_0x0584('0x1c'),_0x2a002d+'-'+_0x4d74bb+'/'+_0x369391)[_0x0584('0x1d')](_0x426dc9);}return null;};}function patchUpdates(_0x2f2c54){return function(_0x5310db){try{jsonpatch['apply'](_0x5310db,_0x2f2c54,!![]);}catch(_0x5d113c){return BPromise[_0x0584('0x1e')](_0x5d113c);}return _0x5310db[_0x0584('0x1f')]();};}function saveUpdates(_0x431124,_0x5cba69){return function(_0x3ffa47){if(_0x3ffa47){return _0x3ffa47[_0x0584('0x20')](_0x431124)[_0x0584('0x21')](function(_0xa3c003){return _0xa3c003;});}return null;};}function removeEntity(_0x1a7ba9,_0x8bae74){return function(_0x13fbb7){if(_0x13fbb7){return _0x13fbb7[_0x0584('0x22')]()['then'](function(){_0x1a7ba9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cdcf6,_0x56f5cc){return function(_0x55e28f){if(!_0x55e28f){_0x3cdcf6[_0x0584('0x23')](0x194);}return _0x55e28f;};}function handleError(_0x156994,_0x3cedb0){_0x3cedb0=_0x3cedb0||0x1f4;return function(_0x39a0b1){logger['error'](_0x39a0b1[_0x0584('0x24')]);if(_0x39a0b1[_0x0584('0x25')]){delete _0x39a0b1[_0x0584('0x25')];}_0x156994[_0x0584('0x15')](_0x3cedb0)[_0x0584('0x26')](_0x39a0b1);};}exports[_0x0584('0x27')]=function(_0x28b51c,_0x1911a8){var _0x64fb74={},_0x139ad7={},_0x41b36e={'count':0x0,'rows':[]};var _0x46d6c4=_[_0x0584('0x28')](db[_0x0584('0x29')][_0x0584('0x2a')],function(_0x1323a3){return{'name':_0x1323a3[_0x0584('0x2b')],'type':_0x1323a3['type'][_0x0584('0x2c')]};});_0x139ad7['model']=_[_0x0584('0x28')](_0x46d6c4,_0x0584('0x25'));_0x139ad7[_0x0584('0x2d')]=_[_0x0584('0x2e')](_0x28b51c[_0x0584('0x2d')]);_0x139ad7[_0x0584('0x2f')]=_[_0x0584('0x30')](_0x139ad7[_0x0584('0x31')],_0x139ad7[_0x0584('0x2d')]);_0x64fb74[_0x0584('0x32')]=_[_0x0584('0x30')](_0x139ad7[_0x0584('0x31')],qs['fields'](_0x28b51c['query'][_0x0584('0x33')]));_0x64fb74[_0x0584('0x32')]=_0x64fb74[_0x0584('0x32')]['length']?_0x64fb74[_0x0584('0x32')]:_0x139ad7[_0x0584('0x31')];if(!_0x28b51c[_0x0584('0x2d')][_0x0584('0x34')](_0x0584('0x35'))){_0x64fb74['limit']=qs[_0x0584('0x19')](_0x28b51c[_0x0584('0x2d')]['limit']);_0x64fb74[_0x0584('0x17')]=qs[_0x0584('0x17')](_0x28b51c['query'][_0x0584('0x17')]);}_0x64fb74[_0x0584('0x36')]=qs[_0x0584('0x37')](_0x28b51c[_0x0584('0x2d')][_0x0584('0x37')]);_0x64fb74[_0x0584('0x38')]=qs[_0x0584('0x2f')](_[_0x0584('0x39')](_0x28b51c[_0x0584('0x2d')],_0x139ad7[_0x0584('0x2f')]),_0x46d6c4);if(_0x28b51c[_0x0584('0x2d')][_0x0584('0x3a')]){_0x64fb74[_0x0584('0x38')]=_[_0x0584('0x3b')](_0x64fb74[_0x0584('0x38')],{'$or':_['map'](_0x46d6c4,function(_0x5bb269){if(_0x5bb269[_0x0584('0x3c')]!==_0x0584('0x3d')){var _0x367a1a={};_0x367a1a[_0x5bb269[_0x0584('0x25')]]={'$like':'%'+_0x28b51c[_0x0584('0x2d')][_0x0584('0x3a')]+'%'};return _0x367a1a;}})});}_0x64fb74=_['merge']({},_0x64fb74,_0x28b51c[_0x0584('0x3e')]);var _0x4f8d9a={'where':_0x64fb74[_0x0584('0x38')]};return db[_0x0584('0x29')]['count'](_0x4f8d9a)[_0x0584('0x21')](function(_0x34ce68){_0x41b36e['count']=_0x34ce68;if(_0x28b51c['query'][_0x0584('0x3f')]){_0x64fb74[_0x0584('0x40')]=[{'all':!![]}];}return db[_0x0584('0x29')][_0x0584('0x41')](_0x64fb74);})[_0x0584('0x21')](function(_0x4f8bb4){_0x41b36e['rows']=_0x4f8bb4;return _0x41b36e;})[_0x0584('0x21')](respondWithFilteredResult(_0x1911a8,_0x64fb74))[_0x0584('0x42')](handleError(_0x1911a8,null));};exports[_0x0584('0x43')]=function(_0x5acd7f,_0x27b816){var _0x3c45ae={'raw':!![],'where':{'id':_0x5acd7f[_0x0584('0x44')]['id']}},_0x4d4166={};_0x4d4166[_0x0584('0x31')]=_[_0x0584('0x2e')](db[_0x0584('0x29')][_0x0584('0x2a')]);_0x4d4166['query']=_['keys'](_0x5acd7f[_0x0584('0x2d')]);_0x4d4166[_0x0584('0x2f')]=_[_0x0584('0x30')](_0x4d4166[_0x0584('0x31')],_0x4d4166[_0x0584('0x2d')]);_0x3c45ae[_0x0584('0x32')]=_[_0x0584('0x30')](_0x4d4166['model'],qs[_0x0584('0x33')](_0x5acd7f['query'][_0x0584('0x33')]));_0x3c45ae[_0x0584('0x32')]=_0x3c45ae[_0x0584('0x32')][_0x0584('0x45')]?_0x3c45ae[_0x0584('0x32')]:_0x4d4166[_0x0584('0x31')];if(_0x5acd7f[_0x0584('0x2d')]['includeAll']){_0x3c45ae['include']=[{'all':!![]}];}_0x3c45ae=_[_0x0584('0x3b')]({},_0x3c45ae,_0x5acd7f['options']);return db[_0x0584('0x29')][_0x0584('0x46')](_0x3c45ae)[_0x0584('0x21')](handleEntityNotFound(_0x27b816,null))[_0x0584('0x21')](respondWithResult(_0x27b816,null))[_0x0584('0x42')](handleError(_0x27b816,null));};exports[_0x0584('0x47')]=function(_0x42bc90,_0x26e746){return db[_0x0584('0x29')][_0x0584('0x47')](_0x42bc90['body'],{})[_0x0584('0x21')](respondWithResult(_0x26e746,0xc9))[_0x0584('0x42')](handleError(_0x26e746,null));};exports[_0x0584('0x20')]=function(_0x3de69e,_0x417415){if(_0x3de69e['body']['id']){delete _0x3de69e[_0x0584('0x48')]['id'];}return db[_0x0584('0x29')]['find']({'where':{'id':_0x3de69e['params']['id']}})[_0x0584('0x21')](handleEntityNotFound(_0x417415,null))['then'](saveUpdates(_0x3de69e[_0x0584('0x48')],null))[_0x0584('0x21')](respondWithResult(_0x417415,null))[_0x0584('0x42')](handleError(_0x417415,null));};exports['destroy']=function(_0x24816e,_0x5f4413){return db[_0x0584('0x29')]['find']({'where':{'id':_0x24816e[_0x0584('0x44')]['id']}})['then'](handleEntityNotFound(_0x5f4413,null))['then'](removeEntity(_0x5f4413,null))[_0x0584('0x42')](handleError(_0x5f4413,null));};exports[_0x0584('0x49')]=function(_0x3c2b9d,_0x356f26){return db['ChatTransferReport'][_0x0584('0x49')]()[_0x0584('0x21')](respondWithResult(_0x356f26,null))[_0x0584('0x42')](handleError(_0x356f26,null));}; \ No newline at end of file +var _0xa927=['hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','ChatTransferReport','includeAll','include','findAll','rows','params','intersection','options','create','body','find','catch','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','update','destroy','then','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length'];(function(_0x59e537,_0x139c12){var _0x3b9cc6=function(_0x3a4640){while(--_0x3a4640){_0x59e537['push'](_0x59e537['shift']());}};_0x3b9cc6(++_0x139c12);}(_0xa927,0x187));var _0x7a92=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa927[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7a92('0x0'));var jsonpatch=require(_0x7a92('0x1'));var rp=require(_0x7a92('0x2'));var moment=require(_0x7a92('0x3'));var BPromise=require(_0x7a92('0x4'));var Mustache=require(_0x7a92('0x5'));var util=require(_0x7a92('0x6'));var path=require('path');var sox=require(_0x7a92('0x7'));var csv=require(_0x7a92('0x8'));var ejs=require(_0x7a92('0x9'));var fs=require('fs');var fs_extra=require(_0x7a92('0xa'));var _=require(_0x7a92('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7a92('0xc'));var deskjs=require(_0x7a92('0xd'));var toCsv=require(_0x7a92('0x8'));var querystring=require(_0x7a92('0xe'));var Papa=require(_0x7a92('0xf'));var Redis=require(_0x7a92('0x10'));var authService=require(_0x7a92('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7a92('0x12'));var hardwareService=require(_0x7a92('0x13'));var logger=require('../../config/logger')(_0x7a92('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7a92('0x15'));var db=require(_0x7a92('0x16'))['db'];function respondWithStatusCode(_0x1f0ffa,_0x4cc63d){_0x4cc63d=_0x4cc63d||0xcc;return function(_0x39bc9e){if(_0x39bc9e){return _0x1f0ffa[_0x7a92('0x17')](_0x4cc63d);}return _0x1f0ffa['status'](_0x4cc63d)[_0x7a92('0x18')]();};}function respondWithResult(_0x3a9ef3,_0x38deaf){_0x38deaf=_0x38deaf||0xc8;return function(_0x4b923d){if(_0x4b923d){return _0x3a9ef3['status'](_0x38deaf)[_0x7a92('0x19')](_0x4b923d);}};}function respondWithFilteredResult(_0x3bc595,_0x4a0e7e){return function(_0xa41a16){if(_0xa41a16){var _0x10dc58=typeof _0x4a0e7e[_0x7a92('0x1a')]===_0x7a92('0x1b')&&typeof _0x4a0e7e[_0x7a92('0x1c')]===_0x7a92('0x1b');var _0x87e348=_0xa41a16[_0x7a92('0x1d')];var _0x31e388=_0x10dc58?0x0:_0x4a0e7e[_0x7a92('0x1a')];var _0x53841e=_0x10dc58?_0xa41a16[_0x7a92('0x1d')]:_0x4a0e7e['offset']+_0x4a0e7e[_0x7a92('0x1c')];var _0x4722e4;if(_0x53841e>=_0x87e348){_0x53841e=_0x87e348;_0x4722e4=0xc8;}else{_0x4722e4=0xce;}_0x3bc595[_0x7a92('0x1e')](_0x4722e4);return _0x3bc595[_0x7a92('0x1f')]('Content-Range',_0x31e388+'-'+_0x53841e+'/'+_0x87e348)[_0x7a92('0x19')](_0xa41a16);}return null;};}function patchUpdates(_0x3be6c9){return function(_0x29e13e){try{jsonpatch[_0x7a92('0x20')](_0x29e13e,_0x3be6c9,!![]);}catch(_0x2ca60f){return BPromise[_0x7a92('0x21')](_0x2ca60f);}return _0x29e13e['save']();};}function saveUpdates(_0x5bb946,_0x2f93d9){return function(_0x40462f){if(_0x40462f){return _0x40462f[_0x7a92('0x22')](_0x5bb946)['then'](function(_0xf24776){return _0xf24776;});}return null;};}function removeEntity(_0x6328fd,_0x336658){return function(_0x414388){if(_0x414388){return _0x414388[_0x7a92('0x23')]()[_0x7a92('0x24')](function(){_0x6328fd[_0x7a92('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21829b,_0x1b5f05){return function(_0x555881){if(!_0x555881){_0x21829b[_0x7a92('0x17')](0x194);}return _0x555881;};}function handleError(_0x242b4e,_0x2b5efb){_0x2b5efb=_0x2b5efb||0x1f4;return function(_0x1e1aaf){logger[_0x7a92('0x25')](_0x1e1aaf[_0x7a92('0x26')]);if(_0x1e1aaf[_0x7a92('0x27')]){delete _0x1e1aaf[_0x7a92('0x27')];}_0x242b4e[_0x7a92('0x1e')](_0x2b5efb)[_0x7a92('0x28')](_0x1e1aaf);};}exports[_0x7a92('0x29')]=function(_0x4e874d,_0x5ce345){var _0x597b27={},_0x39b84b={},_0x27b64f={'count':0x0,'rows':[]};var _0x2a00cf=_[_0x7a92('0x2a')](db['ChatTransferReport'][_0x7a92('0x2b')],function(_0x2ecff7){return{'name':_0x2ecff7['fieldName'],'type':_0x2ecff7[_0x7a92('0x2c')][_0x7a92('0x2d')]};});_0x39b84b[_0x7a92('0x2e')]=_['map'](_0x2a00cf,'name');_0x39b84b[_0x7a92('0x2f')]=_[_0x7a92('0x30')](_0x4e874d[_0x7a92('0x2f')]);_0x39b84b[_0x7a92('0x31')]=_['intersection'](_0x39b84b[_0x7a92('0x2e')],_0x39b84b[_0x7a92('0x2f')]);_0x597b27[_0x7a92('0x32')]=_['intersection'](_0x39b84b[_0x7a92('0x2e')],qs[_0x7a92('0x33')](_0x4e874d[_0x7a92('0x2f')]['fields']));_0x597b27[_0x7a92('0x32')]=_0x597b27['attributes'][_0x7a92('0x34')]?_0x597b27['attributes']:_0x39b84b[_0x7a92('0x2e')];if(!_0x4e874d[_0x7a92('0x2f')][_0x7a92('0x35')](_0x7a92('0x36'))){_0x597b27['limit']=qs[_0x7a92('0x1c')](_0x4e874d[_0x7a92('0x2f')]['limit']);_0x597b27[_0x7a92('0x1a')]=qs[_0x7a92('0x1a')](_0x4e874d[_0x7a92('0x2f')][_0x7a92('0x1a')]);}_0x597b27[_0x7a92('0x37')]=qs['sort'](_0x4e874d[_0x7a92('0x2f')]['sort']);_0x597b27[_0x7a92('0x38')]=qs[_0x7a92('0x31')](_[_0x7a92('0x39')](_0x4e874d[_0x7a92('0x2f')],_0x39b84b['filters']),_0x2a00cf);if(_0x4e874d[_0x7a92('0x2f')][_0x7a92('0x3a')]){_0x597b27[_0x7a92('0x38')]=_['merge'](_0x597b27[_0x7a92('0x38')],{'$or':_[_0x7a92('0x2a')](_0x2a00cf,function(_0x223757){if(_0x223757[_0x7a92('0x2c')]!==_0x7a92('0x3b')){var _0x230c7f={};_0x230c7f[_0x223757[_0x7a92('0x27')]]={'$like':'%'+_0x4e874d[_0x7a92('0x2f')][_0x7a92('0x3a')]+'%'};return _0x230c7f;}})});}_0x597b27=_[_0x7a92('0x3c')]({},_0x597b27,_0x4e874d['options']);var _0x579460={'where':_0x597b27['where']};return db[_0x7a92('0x3d')]['count'](_0x579460)[_0x7a92('0x24')](function(_0x31732f){_0x27b64f[_0x7a92('0x1d')]=_0x31732f;if(_0x4e874d[_0x7a92('0x2f')][_0x7a92('0x3e')]){_0x597b27[_0x7a92('0x3f')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x7a92('0x40')](_0x597b27);})[_0x7a92('0x24')](function(_0x54ae1d){_0x27b64f[_0x7a92('0x41')]=_0x54ae1d;return _0x27b64f;})[_0x7a92('0x24')](respondWithFilteredResult(_0x5ce345,_0x597b27))['catch'](handleError(_0x5ce345,null));};exports['show']=function(_0x4d102e,_0x18130e){var _0x28be63={'raw':!![],'where':{'id':_0x4d102e[_0x7a92('0x42')]['id']}},_0x47c203={};_0x47c203[_0x7a92('0x2e')]=_['keys'](db[_0x7a92('0x3d')][_0x7a92('0x2b')]);_0x47c203[_0x7a92('0x2f')]=_[_0x7a92('0x30')](_0x4d102e[_0x7a92('0x2f')]);_0x47c203['filters']=_[_0x7a92('0x43')](_0x47c203[_0x7a92('0x2e')],_0x47c203['query']);_0x28be63[_0x7a92('0x32')]=_['intersection'](_0x47c203[_0x7a92('0x2e')],qs['fields'](_0x4d102e['query'][_0x7a92('0x33')]));_0x28be63[_0x7a92('0x32')]=_0x28be63[_0x7a92('0x32')]['length']?_0x28be63[_0x7a92('0x32')]:_0x47c203[_0x7a92('0x2e')];if(_0x4d102e[_0x7a92('0x2f')][_0x7a92('0x3e')]){_0x28be63['include']=[{'all':!![]}];}_0x28be63=_['merge']({},_0x28be63,_0x4d102e[_0x7a92('0x44')]);return db[_0x7a92('0x3d')]['find'](_0x28be63)[_0x7a92('0x24')](handleEntityNotFound(_0x18130e,null))[_0x7a92('0x24')](respondWithResult(_0x18130e,null))['catch'](handleError(_0x18130e,null));};exports[_0x7a92('0x45')]=function(_0x1f1d8f,_0x225d93){return db[_0x7a92('0x3d')][_0x7a92('0x45')](_0x1f1d8f[_0x7a92('0x46')],{})[_0x7a92('0x24')](respondWithResult(_0x225d93,0xc9))['catch'](handleError(_0x225d93,null));};exports[_0x7a92('0x22')]=function(_0x85e8c9,_0x3d2a83){if(_0x85e8c9[_0x7a92('0x46')]['id']){delete _0x85e8c9[_0x7a92('0x46')]['id'];}return db[_0x7a92('0x3d')][_0x7a92('0x47')]({'where':{'id':_0x85e8c9['params']['id']}})['then'](handleEntityNotFound(_0x3d2a83,null))[_0x7a92('0x24')](saveUpdates(_0x85e8c9[_0x7a92('0x46')],null))[_0x7a92('0x24')](respondWithResult(_0x3d2a83,null))[_0x7a92('0x48')](handleError(_0x3d2a83,null));};exports['destroy']=function(_0xe111a9,_0x2b29bc){return db[_0x7a92('0x3d')][_0x7a92('0x47')]({'where':{'id':_0xe111a9[_0x7a92('0x42')]['id']}})[_0x7a92('0x24')](handleEntityNotFound(_0x2b29bc,null))[_0x7a92('0x24')](removeEntity(_0x2b29bc,null))[_0x7a92('0x48')](handleError(_0x2b29bc,null));};exports[_0x7a92('0x49')]=function(_0xef28b0,_0x3177c5){return db[_0x7a92('0x3d')][_0x7a92('0x49')]()[_0x7a92('0x24')](respondWithResult(_0x3177c5,null))[_0x7a92('0x48')](handleError(_0x3177c5,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 126dc1f..6f9c9f6 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 _0x12f5=['uniqueid','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./chatTransferReport.attributes','exports','define'];(function(_0x42299,_0x5e65cc){var _0xd2ebd1=function(_0x5486c1){while(--_0x5486c1){_0x42299['push'](_0x42299['shift']());}};_0xd2ebd1(++_0x5e65cc);}(_0x12f5,0x1c4));var _0x512f=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x12f5[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x512f('0x0'));var util=require(_0x512f('0x1'));var logger=require(_0x512f('0x2'))('api');var moment=require(_0x512f('0x3'));var BPromise=require('bluebird');var rp=require(_0x512f('0x4'));var fs=require('fs');var path=require(_0x512f('0x5'));var rimraf=require('rimraf');var config=require(_0x512f('0x6'));var attributes=require(_0x512f('0x7'));module[_0x512f('0x8')]=function(_0xf873bd,_0x147363){return _0xf873bd[_0x512f('0x9')]('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x512f('0xa'),'fields':[_0x512f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8886=['define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports'];(function(_0xfd7cb3,_0x7f7744){var _0x4a7f70=function(_0x27bf82){while(--_0x27bf82){_0xfd7cb3['push'](_0xfd7cb3['shift']());}};_0x4a7f70(++_0x7f7744);}(_0x8886,0x9a));var _0x6888=function(_0x426095,_0x2357f0){_0x426095=_0x426095-0x0;var _0x383d44=_0x8886[_0x426095];return _0x383d44;};'use strict';var _=require(_0x6888('0x0'));var util=require(_0x6888('0x1'));var logger=require('../../config/logger')(_0x6888('0x2'));var moment=require(_0x6888('0x3'));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(_0x216f40,_0x1b2e69){return _0x216f40[_0x6888('0xb')](_0x6888('0xc'),attributes,{'tableName':_0x6888('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x6888('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 5309726..974472c 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 _0x2130=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x37026d,_0x4323ad){var _0x4c2c88=function(_0x507a94){while(--_0x507a94){_0x37026d['push'](_0x37026d['shift']());}};_0x4c2c88(++_0x4323ad);}(_0x2130,0xf7));var _0x0213=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x2130[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0x0213('0x0'));var util=require(_0x0213('0x1'));var moment=require('moment');var BPromise=require(_0x0213('0x2'));var rs=require(_0x0213('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0213('0x4'))['db'];var utils=require(_0x0213('0x5'));var logger=require(_0x0213('0x6'))(_0x0213('0x7'));var config=require('../../config/environment');var jayson=require(_0x0213('0x8'));var client=jayson[_0x0213('0x9')][_0x0213('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bfd1c,_0x48b9f9,_0x53291){return new BPromise(function(_0x5d2aee,_0x387bb9){return client['request'](_0x2bfd1c,_0x53291)[_0x0213('0xb')](function(_0x561bff){logger[_0x0213('0xc')](_0x0213('0xd'),_0x48b9f9,_0x0213('0xe'));logger[_0x0213('0xf')](_0x0213('0x10'),_0x48b9f9,_0x0213('0xe'),JSON[_0x0213('0x11')](_0x561bff));if(_0x561bff[_0x0213('0x12')]){if(_0x561bff[_0x0213('0x12')]['code']===0x1f4){logger[_0x0213('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x48b9f9,_0x561bff['error'][_0x0213('0x13')]);return _0x387bb9(_0x561bff['error'][_0x0213('0x13')]);}logger['error'](_0x0213('0xd'),_0x48b9f9,_0x561bff[_0x0213('0x12')][_0x0213('0x13')]);return _0x5d2aee(_0x561bff[_0x0213('0x12')][_0x0213('0x13')]);}else{logger[_0x0213('0xc')](_0x0213('0xd'),_0x48b9f9,_0x0213('0xe'));_0x5d2aee(_0x561bff[_0x0213('0x14')][_0x0213('0x13')]);}})['catch'](function(_0x37ee63){logger[_0x0213('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x48b9f9,_0x37ee63);_0x387bb9(_0x37ee63);});});} \ No newline at end of file +var _0x1284=['request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x1284,0xa2));var _0x4128=function(_0x3b9d5f,_0x2e9039){_0x3b9d5f=_0x3b9d5f-0x0;var _0x39924e=_0x1284[_0x3b9d5f];return _0x39924e;};'use strict';var _=require(_0x4128('0x0'));var util=require('util');var moment=require(_0x4128('0x1'));var BPromise=require('bluebird');var rs=require(_0x4128('0x2'));var fs=require('fs');var Redis=require(_0x4128('0x3'));var db=require(_0x4128('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4128('0x5'));var config=require(_0x4128('0x6'));var jayson=require(_0x4128('0x7'));var client=jayson['client'][_0x4128('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e5a98,_0x44202e,_0x22be57){return new BPromise(function(_0x32b69d,_0x474067){return client[_0x4128('0x9')](_0x5e5a98,_0x22be57)[_0x4128('0xa')](function(_0x2a611b){logger[_0x4128('0xb')](_0x4128('0xc'),_0x44202e,_0x4128('0xd'));logger['debug'](_0x4128('0xe'),_0x44202e,_0x4128('0xd'),JSON['stringify'](_0x2a611b));if(_0x2a611b[_0x4128('0xf')]){if(_0x2a611b['error']['code']===0x1f4){logger['error'](_0x4128('0xc'),_0x44202e,_0x2a611b['error'][_0x4128('0x10')]);return _0x474067(_0x2a611b[_0x4128('0xf')][_0x4128('0x10')]);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x44202e,_0x2a611b['error'][_0x4128('0x10')]);return _0x32b69d(_0x2a611b[_0x4128('0xf')][_0x4128('0x10')]);}else{logger[_0x4128('0xb')](_0x4128('0xc'),_0x44202e,_0x4128('0xd'));_0x32b69d(_0x2a611b[_0x4128('0x11')][_0x4128('0x10')]);}})[_0x4128('0x12')](function(_0x6341ca){logger[_0x4128('0xf')](_0x4128('0xc'),_0x44202e,_0x6341ca);_0x474067(_0x6341ca);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index b9b0bc4..c744219 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 _0xc802=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatTransferReport.controller','index','get','isAuthenticated','describe','show','post','create','put','update','/:id','destroy','multer','util'];(function(_0x354d5c,_0x1c35f4){var _0x1a8b66=function(_0x40b980){while(--_0x40b980){_0x354d5c['push'](_0x354d5c['shift']());}};_0x1a8b66(++_0x1c35f4);}(_0xc802,0x1f2));var _0x2c80=function(_0x5ed846,_0x5e2ca8){_0x5ed846=_0x5ed846-0x0;var _0x567083=_0xc802[_0x5ed846];return _0x567083;};'use strict';var multer=require(_0x2c80('0x0'));var util=require(_0x2c80('0x1'));var path=require(_0x2c80('0x2'));var timeout=require(_0x2c80('0x3'));var express=require(_0x2c80('0x4'));var router=express[_0x2c80('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2c80('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2c80('0x7'));var controller=require(_0x2c80('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x2c80('0x9')]);router[_0x2c80('0xa')]('/describe',auth[_0x2c80('0xb')](),controller[_0x2c80('0xc')]);router[_0x2c80('0xa')]('/:id',auth[_0x2c80('0xb')](),controller[_0x2c80('0xd')]);router[_0x2c80('0xe')]('/',auth[_0x2c80('0xb')](),controller[_0x2c80('0xf')]);router[_0x2c80('0x10')]('/:id',auth[_0x2c80('0xb')](),controller[_0x2c80('0x11')]);router['delete'](_0x2c80('0x12'),auth['isAuthenticated'](),controller[_0x2c80('0x13')]);module['exports']=router; \ No newline at end of file +var _0xba5a=['isAuthenticated','/describe','describe','show','post','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get'];(function(_0x2407bd,_0x2efde4){var _0x470f2=function(_0x40f617){while(--_0x40f617){_0x2407bd['push'](_0x2407bd['shift']());}};_0x470f2(++_0x2efde4);}(_0xba5a,0x171));var _0xaba5=function(_0x21b359,_0x4dc80e){_0x21b359=_0x21b359-0x0;var _0x57b8e7=_0xba5a[_0x21b359];return _0x57b8e7;};'use strict';var multer=require(_0xaba5('0x0'));var util=require('util');var path=require(_0xaba5('0x1'));var timeout=require(_0xaba5('0x2'));var express=require(_0xaba5('0x3'));var router=express[_0xaba5('0x4')]();var fs_extra=require(_0xaba5('0x5'));var auth=require(_0xaba5('0x6'));var interaction=require(_0xaba5('0x7'));var config=require(_0xaba5('0x8'));var controller=require(_0xaba5('0x9'));router[_0xaba5('0xa')]('/',auth[_0xaba5('0xb')](),controller['index']);router[_0xaba5('0xa')](_0xaba5('0xc'),auth[_0xaba5('0xb')](),controller[_0xaba5('0xd')]);router[_0xaba5('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xaba5('0xe')]);router[_0xaba5('0xf')]('/',auth[_0xaba5('0xb')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xaba5('0x10')]);router[_0xaba5('0x11')]('/:id',auth[_0xaba5('0xb')](),controller['destroy']);module[_0xaba5('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index b6b9047..9a417f8 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 _0xff02=['Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','text','onlineForm','getDataValue','textarea','Leave\x20your\x20comments','parse','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.','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat'];(function(_0x1ac5e1,_0x43a483){var _0x3ae80e=function(_0x234518){while(--_0x234518){_0x1ac5e1['push'](_0x1ac5e1['shift']());}};_0x3ae80e(++_0x43a483);}(_0xff02,0x12f));var _0x2ff0=function(_0x2e4f74,_0x4c9771){_0x2e4f74=_0x2e4f74-0x0;var _0x2540c3=_0xff02[_0x2e4f74];return _0x2540c3;};'use strict';var Sequelize=require(_0x2ff0('0x0'));var rs=require(_0x2ff0('0x1'));module[_0x2ff0('0x2')]={'name':{'type':Sequelize[_0x2ff0('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x2ff0('0x3')],'allowNull':![],'unique':_0x2ff0('0x4')},'description':{'type':Sequelize[_0x2ff0('0x3')]},'mapKey':{'type':Sequelize[_0x2ff0('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x2ff0('0x3')],'defaultValue':_0x2ff0('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x2ff0('0x6')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x2ff0('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x2ff0('0x3')],'allowNull':![],'defaultValue':_0x2ff0('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x2ff0('0x3')],'allowNull':![],'defaultValue':_0x2ff0('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x2ff0('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x2ff0('0x3')]},'animation':{'type':Sequelize[_0x2ff0('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x2ff0('0xb')](_0x2ff0('0xc'),'squared'),'defaultValue':_0x2ff0('0xc')},'header_online':{'type':Sequelize[_0x2ff0('0x3')],'defaultValue':_0x2ff0('0xd')},'start_chat_button':{'type':Sequelize[_0x2ff0('0x3')],'defaultValue':_0x2ff0('0xe')},'offline_chat_button':{'type':Sequelize[_0x2ff0('0x3')],'defaultValue':_0x2ff0('0xf')},'header_offline':{'type':Sequelize[_0x2ff0('0x3')],'defaultValue':_0x2ff0('0x10')},'download_transcript':{'type':Sequelize[_0x2ff0('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x2ff0('0x11')},'defaultWhiteLabel':{'type':Sequelize[_0x2ff0('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x2ff0('0x12')]},'closingQuestion':{'type':Sequelize[_0x2ff0('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x2ff0('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0x2ff0('0x3')],'defaultValue':_0x2ff0('0x14')},'noteTitle':{'type':Sequelize[_0x2ff0('0x3')],'defaultValue':_0x2ff0('0x15')},'placeholderMessage':{'type':Sequelize[_0x2ff0('0x3')],'defaultValue':_0x2ff0('0x16')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x2ff0('0x17')},'closingMessageButton':{'type':Sequelize[_0x2ff0('0x3')],'defaultValue':_0x2ff0('0xf')},'skipMessageButton':{'type':Sequelize[_0x2ff0('0x3')],'defaultValue':_0x2ff0('0x18')},'conditionAgreement':{'type':Sequelize[_0x2ff0('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x2ff0('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x2ff0('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x2ff0('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x2ff0('0x3')],'defaultValue':_0x2ff0('0x19')},'ratingType':{'type':Sequelize['ENUM'](_0x2ff0('0x1a'),_0x2ff0('0x1b')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x2ff0('0x12')],'defaultValue':function(){return JSON[_0x2ff0('0x1c')]({'items':[{'type':_0x2ff0('0x1d'),'variable':null,'config':{'placeholder':_0x2ff0('0x1e'),'type':_0x2ff0('0x1f'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x2ff0('0x1d'),'props':{'title':_0x2ff0('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x2ff0('0x5'),'type':_0x2ff0('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x2ff0('0x20'))?JSON['parse'](this[_0x2ff0('0x21')]('onlineForm')):{};},'set':function(_0x27e7c8){return this['setDataValue']('onlineForm',JSON[_0x2ff0('0x1c')](_0x27e7c8));}},'offlineForm':{'type':Sequelize[_0x2ff0('0x12')],'defaultValue':function(){return JSON[_0x2ff0('0x1c')]({'items':[{'type':_0x2ff0('0x1d'),'props':{'title':_0x2ff0('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x2ff0('0x5'),'type':_0x2ff0('0x5')},'variable':null},{'type':_0x2ff0('0x22'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0x2ff0('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0x2ff0('0x21')]('offlineForm')?JSON[_0x2ff0('0x24')](this[_0x2ff0('0x21')](_0x2ff0('0x25'))):{};},'set':function(_0x5b8154){return this['setDataValue'](_0x2ff0('0x25'),JSON['stringify'](_0x5b8154));}},'token':{'type':Sequelize[_0x2ff0('0x3')],'defaultValue':function(){return rs[_0x2ff0('0x26')]();}},'autoclose':{'type':Sequelize[_0x2ff0('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x2ff0('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x2ff0('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x2ff0('0x3')]},'waitingTitle':{'type':Sequelize[_0x2ff0('0x3')],'defaultValue':_0x2ff0('0x27')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x2ff0('0x28')},'offlineMessageSubject':{'type':Sequelize[_0x2ff0('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x2ff0('0x3')],'defaultValue':_0x2ff0('0x29')},'skipUnmanaged':{'type':Sequelize[_0x2ff0('0x3')],'defaultValue':_0x2ff0('0x18')},'sendUnmanaged':{'type':Sequelize[_0x2ff0('0x3')],'defaultValue':_0x2ff0('0xf')},'enableCustomerAttachment':{'type':Sequelize[_0x2ff0('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x2ff0('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x2ff0('0x12')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x2ff0('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x2ff0('0x2a');}},'notificationSound':{'type':Sequelize[_0x2ff0('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2ff0('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x2ff0('0xa')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x2ff0('0x3')],'defaultValue':_0x2ff0('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x2ff0('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x2ff0('0x9')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x2ff0('0x3')],'defaultValue':_0x2ff0('0x2c')},'defaultTitle':{'type':Sequelize[_0x2ff0('0x3')]},'customerAvatar':{'type':Sequelize[_0x2ff0('0x12')]},'showCustomerAvatar':{'type':Sequelize[_0x2ff0('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x2ff0('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x2ff0('0x3')],'allowNull':![],'defaultValue':_0x2ff0('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x2ff0('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2ff0('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2ff0('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2ff0('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x2ff0('0x3')],'defaultValue':_0x2ff0('0x2e')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2ff0('0x9')],'comment':_0x2ff0('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0x2ff0('0xa')],'defaultValue':![],'comment':_0x2ff0('0x30'),'set':function(_0xcf9a84){if(!_0xcf9a84)this[_0x2ff0('0x31')](_0x2ff0('0x32'),null);this[_0x2ff0('0x31')]('mandatoryDisposition',_0xcf9a84);}},'vidaooEscalation':{'type':Sequelize[_0x2ff0('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x2ff0('0x3')]},'vidaooTopic':{'type':Sequelize[_0x2ff0('0x3')],'allowNull':![],'defaultValue':_0x2ff0('0x33')},'vidaooNote':{'type':Sequelize[_0x2ff0('0x3')],'defaultValue':function(){return _0x2ff0('0x34');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x2ff0('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x2ff0('0x12')]}}; \ No newline at end of file +var _0xa53b=['rounded','squared','Chat','Send','Powered\x20by\x20xCALLY','BOOLEAN','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','thumb','star','stringify','input','name','getDataValue','onlineForm','textarea','Leave\x20your\x20comments','offlineForm','parse','setDataValue','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','email','Agent','#011F6A','#ffffff','INTEGER'];(function(_0x39df08,_0x242920){var _0x2ea2e2=function(_0x4863db){while(--_0x4863db){_0x39df08['push'](_0x39df08['shift']());}};_0x2ea2e2(++_0x242920);}(_0xa53b,0xaf));var _0xba53=function(_0x1c3a65,_0x321ac0){_0x1c3a65=_0x1c3a65-0x0;var _0x2eb9d0=_0xa53b[_0x1c3a65];return _0x2eb9d0;};'use strict';var Sequelize=require(_0xba53('0x0'));var rs=require(_0xba53('0x1'));module[_0xba53('0x2')]={'name':{'type':Sequelize[_0xba53('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xba53('0x3')]},'mapKey':{'type':Sequelize[_0xba53('0x3')],'defaultValue':_0xba53('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xba53('0x5')},'customerAlias':{'type':Sequelize[_0xba53('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xba53('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xba53('0x3')],'allowNull':![],'defaultValue':_0xba53('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xba53('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xba53('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xba53('0x3')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xba53('0x9'),_0xba53('0xa')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xba53('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0xba53('0x3')],'defaultValue':_0xba53('0xb')},'offline_chat_button':{'type':Sequelize[_0xba53('0x3')],'defaultValue':_0xba53('0xc')},'header_offline':{'type':Sequelize[_0xba53('0x3')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xba53('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xba53('0x3')],'defaultValue':_0xba53('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0xba53('0xe')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xba53('0xf')]},'closingQuestion':{'type':Sequelize[_0xba53('0x3')],'defaultValue':_0xba53('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xba53('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xba53('0x3')],'defaultValue':_0xba53('0x11')},'noteTitle':{'type':Sequelize[_0xba53('0x3')],'defaultValue':_0xba53('0x12')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xba53('0x13')},'closingMessage':{'type':Sequelize[_0xba53('0x3')],'defaultValue':_0xba53('0x14')},'closingMessageButton':{'type':Sequelize[_0xba53('0x3')],'defaultValue':_0xba53('0xc')},'skipMessageButton':{'type':Sequelize[_0xba53('0x3')],'defaultValue':_0xba53('0x15')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xba53('0xe')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xba53('0xe')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xba53('0x3')],'defaultValue':_0xba53('0x16')},'ratingType':{'type':Sequelize[_0xba53('0x17')]('star',_0xba53('0x18')),'defaultValue':_0xba53('0x19')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xba53('0xf')],'defaultValue':function(){return JSON[_0xba53('0x1a')]({'items':[{'type':_0xba53('0x1b'),'variable':null,'config':{'placeholder':_0xba53('0x1c'),'type':'text','required':!![]},'props':{'title':_0xba53('0x1c'),'helpText':''}},{'type':_0xba53('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xba53('0x4'),'type':_0xba53('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON['parse'](this[_0xba53('0x1d')](_0xba53('0x1e'))):{};},'set':function(_0x57a7dd){return this['setDataValue']('onlineForm',JSON[_0xba53('0x1a')](_0x57a7dd));}},'offlineForm':{'type':Sequelize[_0xba53('0xf')],'defaultValue':function(){return JSON[_0xba53('0x1a')]({'items':[{'type':_0xba53('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xba53('0x4'),'type':_0xba53('0x4')},'variable':null},{'type':_0xba53('0x1f'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0xba53('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0xba53('0x1d')](_0xba53('0x21'))?JSON[_0xba53('0x22')](this['getDataValue'](_0xba53('0x21'))):{};},'set':function(_0x38e1f1){return this[_0xba53('0x23')](_0xba53('0x21'),JSON['stringify'](_0x38e1f1));}},'token':{'type':Sequelize[_0xba53('0x3')],'defaultValue':function(){return rs[_0xba53('0x24')]();}},'autoclose':{'type':Sequelize[_0xba53('0xe')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xba53('0xe')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xba53('0xe')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xba53('0x3')]},'forwardOffline':{'type':Sequelize[_0xba53('0xe')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xba53('0x3')]},'waitingTitle':{'type':Sequelize[_0xba53('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xba53('0x3')],'defaultValue':_0xba53('0x25')},'offlineMessageSubject':{'type':Sequelize[_0xba53('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xba53('0xe')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xba53('0x3')],'defaultValue':_0xba53('0x26')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xba53('0x3')],'defaultValue':_0xba53('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0xba53('0xe')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xba53('0xf')]},'showAgentAvatar':{'type':Sequelize[_0xba53('0xe')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xba53('0xf')],'defaultValue':function(){return _0xba53('0x27');}},'notificationSound':{'type':Sequelize[_0xba53('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xba53('0xe')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xba53('0xe')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xba53('0x3')],'defaultValue':_0xba53('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0xba53('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0xba53('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xba53('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xba53('0x3')]},'customerAvatar':{'type':Sequelize[_0xba53('0xf')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xba53('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xba53('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xba53('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xba53('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xba53('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xba53('0x8')],'comment':_0xba53('0x29')},'mandatoryDisposition':{'type':Sequelize[_0xba53('0xe')],'defaultValue':![],'comment':_0xba53('0x2a'),'set':function(_0x3c7608){if(!_0x3c7608)this[_0xba53('0x23')](_0xba53('0x2b'),null);this['setDataValue']('mandatoryDisposition',_0x3c7608);}},'vidaooEscalation':{'type':Sequelize[_0xba53('0xe')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xba53('0x3')]},'vidaooTopic':{'type':Sequelize[_0xba53('0x3')],'allowNull':![],'defaultValue':_0xba53('0x2c')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xba53('0x2d');}},'vidaooMetadata':{'type':Sequelize[_0xba53('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xba53('0xe')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xba53('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index a62ffaf..39fb9e7 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 _0x2563=['openNewInteraction','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','auth','sendMail','email','offlineMessageSubject','subjectOffline','Chat','MailAccountId','NotifyMailAccount','notifyMail','remove','addInteraction','omit','getInteractions','Contact','User','Owner','fullname','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','interval','ONLINE','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','getProactiveActions','getLicense','custom','License','all','some','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','virtual','replace','alignment','verticalAlignment','color_button','transaction','ChatApplication','findAndCountAll','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./chatWebsite.socket','jayson/promise','http','client','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','destroy','ChatWebsites','UserProfileResource','stack','name','send','Pause','map','ChatWebsite','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','include','findAll','rows','catch','show','params','mandatoryDispositionPause','keys','includeAll','find','create','body','user','get','role','UserProfileSection','userProfileId','describe','ChatWebsiteId','Disposition','getDispositions','findOne','order','options','removeDispositions','ids','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','isNil','existsSync','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','user-agent-parser','setUA','user-agent','getResult','chat','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','from','from\x20is\x20mandatory','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','List','Contacts','DESC','Applications','applications','list','orderBy','asc','account','defaults','CmContact','contact','headers','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','%s\x20%s\x20%s','vendor','threadId','externalUrl','ChatInteraction','interaction','spread','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','attachments','offline-chat','basename'];(function(_0x38c652,_0x1ea1b7){var _0x218a37=function(_0x5dcb2a){while(--_0x5dcb2a){_0x38c652['push'](_0x38c652['shift']());}};_0x218a37(++_0x1ea1b7);}(_0x2563,0x182));var _0x3256=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2563[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x3256('0x0'));var rimraf=require(_0x3256('0x1'));var zipdir=require(_0x3256('0x2'));var jsonpatch=require(_0x3256('0x3'));var rp=require(_0x3256('0x4'));var moment=require(_0x3256('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3256('0x6'));var util=require('util');var path=require(_0x3256('0x7'));var sox=require(_0x3256('0x8'));var csv=require(_0x3256('0x9'));var ejs=require(_0x3256('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3256('0xb'));var crypto=require(_0x3256('0xc'));var jsforce=require(_0x3256('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3256('0x9'));var querystring=require(_0x3256('0xe'));var Papa=require(_0x3256('0xf'));var Redis=require('ioredis');var authService=require(_0x3256('0x10'));var qs=require(_0x3256('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3256('0x12'))(_0x3256('0x13'));var utils=require(_0x3256('0x14'));var config=require(_0x3256('0x15'));var licenseUtil=require(_0x3256('0x16'));var db=require('../../mysqldb')['db'];config[_0x3256('0x17')]=_['defaults'](config[_0x3256('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x3256('0x18'))(new Redis(config['redis']));require(_0x3256('0x19'))['register'](socket);var jayson=require(_0x3256('0x1a'));var client=jayson['client'][_0x3256('0x1b')]({'port':0x232c});var client9002=jayson[_0x3256('0x1c')][_0x3256('0x1b')]({'port':0x232a});var client9003=jayson[_0x3256('0x1c')]['http']({'port':0x232b});var client9001=jayson['client']['http']({'port':0x2329});function respondWithRpcPromise(_0x2ceb70,_0x28dadb,_0x394ba3,_0x4e51a0){return new BPromise(function(_0x351e97,_0x1754af){var _0x12243f=_0x4e51a0||client;return _0x12243f[_0x3256('0x1d')](_0x2ceb70,_0x394ba3)[_0x3256('0x1e')](function(_0xdc2334){logger[_0x3256('0x1f')](_0x3256('0x20'),_0x28dadb,_0x3256('0x21'));logger[_0x3256('0x22')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x28dadb,_0x3256('0x21'),JSON[_0x3256('0x23')](_0xdc2334));if(_0xdc2334[_0x3256('0x24')]){if(_0xdc2334[_0x3256('0x24')][_0x3256('0x25')]===0x1f4){logger[_0x3256('0x24')](_0x3256('0x20'),_0x28dadb,_0xdc2334[_0x3256('0x24')][_0x3256('0x26')]);return _0x1754af(_0xdc2334[_0x3256('0x24')][_0x3256('0x26')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x28dadb,_0xdc2334['error'][_0x3256('0x26')]);return _0x351e97(_0xdc2334[_0x3256('0x24')][_0x3256('0x26')]);}else{logger[_0x3256('0x1f')](_0x3256('0x20'),_0x28dadb,_0x3256('0x21'));_0x351e97(_0xdc2334[_0x3256('0x27')][_0x3256('0x26')]);}})['catch'](function(_0x2a8d8d){logger['error'](_0x3256('0x20'),_0x28dadb,_0x2a8d8d);_0x1754af(_0x2a8d8d);});});}function respondWithStatusCode(_0x3a3915,_0x47cb98){_0x47cb98=_0x47cb98||0xcc;return function(_0x112bf5){if(_0x112bf5){return _0x3a3915[_0x3256('0x28')](_0x47cb98);}return _0x3a3915[_0x3256('0x29')](_0x47cb98)[_0x3256('0x2a')]();};}function respondWithResult(_0x2e21fc,_0x207c5d){_0x207c5d=_0x207c5d||0xc8;return function(_0x51ffaa){if(_0x51ffaa){return _0x2e21fc[_0x3256('0x29')](_0x207c5d)[_0x3256('0x2b')](_0x51ffaa);}};}function respondWithFilteredResult(_0x58e24a,_0x57d36e){return function(_0x22e3b1){if(_0x22e3b1){var _0x5d20ea=typeof _0x57d36e['offset']===_0x3256('0x2c')&&typeof _0x57d36e[_0x3256('0x2d')]===_0x3256('0x2c');var _0x1d597b=_0x22e3b1[_0x3256('0x2e')];var _0x4b1d5c=_0x5d20ea?0x0:_0x57d36e[_0x3256('0x2f')];var _0x2620c7=_0x5d20ea?_0x22e3b1[_0x3256('0x2e')]:_0x57d36e[_0x3256('0x2f')]+_0x57d36e[_0x3256('0x2d')];var _0x59900b;if(_0x2620c7>=_0x1d597b){_0x2620c7=_0x1d597b;_0x59900b=0xc8;}else{_0x59900b=0xce;}_0x58e24a[_0x3256('0x29')](_0x59900b);return _0x58e24a[_0x3256('0x30')](_0x3256('0x31'),_0x4b1d5c+'-'+_0x2620c7+'/'+_0x1d597b)[_0x3256('0x2b')](_0x22e3b1);}return null;};}function patchUpdates(_0x182193){return function(_0x339582){try{jsonpatch[_0x3256('0x32')](_0x339582,_0x182193,!![]);}catch(_0x51b9c5){return BPromise['reject'](_0x51b9c5);}return _0x339582['save']();};}function saveUpdates(_0x2d6deb,_0x27f7cf){return function(_0x3e0890){if(_0x3e0890){return _0x3e0890[_0x3256('0x33')](_0x2d6deb)['then'](function(_0x37b84d){return _0x37b84d;});}return null;};}function removeEntity(_0x283be1,_0x2dc911){return function(_0x5cbd9d){if(_0x5cbd9d){return _0x5cbd9d[_0x3256('0x34')]()[_0x3256('0x1e')](function(){var _0x437d68=_0x5cbd9d['get']({'plain':!![]});var _0x4b2227=_0x3256('0x35');return db[_0x3256('0x36')][_0x3256('0x34')]({'where':{'type':_0x4b2227,'resourceId':_0x437d68['id']}})[_0x3256('0x1e')](function(){return _0x5cbd9d;});})[_0x3256('0x1e')](function(){_0x283be1[_0x3256('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f983b,_0x3910db){return function(_0x229204){if(!_0x229204){_0x3f983b[_0x3256('0x28')](0x194);}return _0x229204;};}function handleError(_0x538dff,_0x16cdbc){_0x16cdbc=_0x16cdbc||0x1f4;return function(_0x32c6f2){logger['error'](_0x32c6f2[_0x3256('0x37')]);if(_0x32c6f2['name']){delete _0x32c6f2[_0x3256('0x38')];}_0x538dff['status'](_0x16cdbc)[_0x3256('0x39')](_0x32c6f2);};}exports['index']=function(_0x4ffdb1,_0x2372fc){var _0x56b82e={'include':[{'model':db[_0x3256('0x3a')],'as':'mandatoryDispositionPause'}]},_0x3862c4={},_0xed50a={'count':0x0,'rows':[]};var _0x12a1cf=_[_0x3256('0x3b')](db[_0x3256('0x3c')][_0x3256('0x3d')],function(_0x4a85c8){return{'name':_0x4a85c8[_0x3256('0x3e')],'type':_0x4a85c8[_0x3256('0x3f')][_0x3256('0x40')]};});_0x3862c4['model']=_[_0x3256('0x3b')](_0x12a1cf,'name');_0x3862c4[_0x3256('0x41')]=_['keys'](_0x4ffdb1[_0x3256('0x41')]);_0x3862c4[_0x3256('0x42')]=_['intersection'](_0x3862c4[_0x3256('0x43')],_0x3862c4['query']);_0x56b82e[_0x3256('0x44')]=_[_0x3256('0x45')](_0x3862c4[_0x3256('0x43')],qs[_0x3256('0x46')](_0x4ffdb1[_0x3256('0x41')][_0x3256('0x46')]));_0x56b82e[_0x3256('0x44')]=_0x56b82e[_0x3256('0x44')][_0x3256('0x47')]?_0x56b82e['attributes']:_0x3862c4['model'];if(!_0x4ffdb1[_0x3256('0x41')][_0x3256('0x48')](_0x3256('0x49'))){_0x56b82e[_0x3256('0x2d')]=qs[_0x3256('0x2d')](_0x4ffdb1[_0x3256('0x41')]['limit']);_0x56b82e[_0x3256('0x2f')]=qs[_0x3256('0x2f')](_0x4ffdb1['query'][_0x3256('0x2f')]);}_0x56b82e['order']=qs[_0x3256('0x4a')](_0x4ffdb1[_0x3256('0x41')][_0x3256('0x4a')]);_0x56b82e[_0x3256('0x4b')]=qs['filters'](_[_0x3256('0x4c')](_0x4ffdb1[_0x3256('0x41')],_0x3862c4[_0x3256('0x42')]),_0x12a1cf);if(_0x4ffdb1[_0x3256('0x41')]['filter']){_0x56b82e[_0x3256('0x4b')]=_[_0x3256('0x4d')](_0x56b82e[_0x3256('0x4b')],{'$or':_[_0x3256('0x3b')](_0x12a1cf,function(_0x4f9c86){if(_0x4f9c86[_0x3256('0x3f')]!=='VIRTUAL'){var _0x4be596={};_0x4be596[_0x4f9c86[_0x3256('0x38')]]={'$like':'%'+_0x4ffdb1[_0x3256('0x41')][_0x3256('0x4e')]+'%'};return _0x4be596;}})});}_0x56b82e=_[_0x3256('0x4d')]({},_0x56b82e,_0x4ffdb1['options']);var _0x2f0943={'where':_0x56b82e[_0x3256('0x4b')]};return db[_0x3256('0x3c')]['count'](_0x2f0943)['then'](function(_0x51ef92){_0xed50a[_0x3256('0x2e')]=_0x51ef92;if(_0x4ffdb1['query']['includeAll']){_0x56b82e[_0x3256('0x4f')]=[{'all':!![]}];}return db[_0x3256('0x3c')][_0x3256('0x50')](_0x56b82e);})[_0x3256('0x1e')](function(_0x25ef94){_0xed50a[_0x3256('0x51')]=_0x25ef94;return _0xed50a;})[_0x3256('0x1e')](respondWithFilteredResult(_0x2372fc,_0x56b82e))[_0x3256('0x52')](handleError(_0x2372fc,null));};exports[_0x3256('0x53')]=function(_0x406af6,_0x5af65d){var _0x1505de={'raw':![],'where':{'id':_0x406af6[_0x3256('0x54')]['id']},'include':[{'model':db[_0x3256('0x3a')],'as':_0x3256('0x55')}]},_0x3bafc1={};_0x3bafc1['model']=_[_0x3256('0x56')](db['ChatWebsite'][_0x3256('0x3d')]);_0x3bafc1[_0x3256('0x41')]=_[_0x3256('0x56')](_0x406af6['query']);_0x3bafc1[_0x3256('0x42')]=_[_0x3256('0x45')](_0x3bafc1[_0x3256('0x43')],_0x3bafc1['query']);_0x1505de[_0x3256('0x44')]=_[_0x3256('0x45')](_0x3bafc1['model'],qs[_0x3256('0x46')](_0x406af6[_0x3256('0x41')][_0x3256('0x46')]));_0x1505de[_0x3256('0x44')]=_0x1505de[_0x3256('0x44')][_0x3256('0x47')]?_0x1505de[_0x3256('0x44')]:_0x3bafc1[_0x3256('0x43')];if(_0x406af6[_0x3256('0x41')][_0x3256('0x57')]){_0x1505de['include']=[{'all':!![]}];}_0x1505de=_[_0x3256('0x4d')]({},_0x1505de,_0x406af6['options']);return db['ChatWebsite'][_0x3256('0x58')](_0x1505de)[_0x3256('0x1e')](handleEntityNotFound(_0x5af65d,null))[_0x3256('0x1e')](respondWithResult(_0x5af65d,null))[_0x3256('0x52')](handleError(_0x5af65d,null));};exports[_0x3256('0x59')]=function(_0x5cfc1c,_0x23f39e){return db[_0x3256('0x3c')][_0x3256('0x59')](_0x5cfc1c[_0x3256('0x5a')],{})[_0x3256('0x1e')](function(_0x5da708){var _0x3af3f8=_0x5cfc1c[_0x3256('0x5b')][_0x3256('0x5c')]({'plain':!![]});if(!_0x3af3f8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3af3f8[_0x3256('0x5d')]==='user'){var _0x3ff570=_0x5da708[_0x3256('0x5c')]({'plain':!![]});var _0x4c98b4='ChatWebsites';return db[_0x3256('0x5e')][_0x3256('0x58')]({'where':{'name':_0x4c98b4,'userProfileId':_0x3af3f8[_0x3256('0x5f')]},'raw':!![]})[_0x3256('0x1e')](function(_0x32a09d){if(_0x32a09d&&_0x32a09d['autoAssociation']===0x0){return db[_0x3256('0x36')][_0x3256('0x59')]({'name':_0x3ff570[_0x3256('0x38')],'resourceId':_0x3ff570['id'],'type':_0x32a09d[_0x3256('0x38')],'sectionId':_0x32a09d['id']},{})[_0x3256('0x1e')](function(){return _0x5da708;});}else{return _0x5da708;}})['catch'](function(_0x110cb6){logger[_0x3256('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x110cb6);throw _0x110cb6;});}return _0x5da708;})[_0x3256('0x1e')](respondWithResult(_0x23f39e,0xc9))['catch'](handleError(_0x23f39e,null));};exports[_0x3256('0x33')]=function(_0xcfd1e8,_0x2caf9f){if(_0xcfd1e8[_0x3256('0x5a')]['id']){delete _0xcfd1e8[_0x3256('0x5a')]['id'];}return db[_0x3256('0x3c')][_0x3256('0x58')]({'where':{'id':_0xcfd1e8['params']['id']},'include':[{'model':db[_0x3256('0x3a')],'as':_0x3256('0x55')}]})[_0x3256('0x1e')](handleEntityNotFound(_0x2caf9f,null))[_0x3256('0x1e')](saveUpdates(_0xcfd1e8[_0x3256('0x5a')],null))[_0x3256('0x1e')](respondWithResult(_0x2caf9f,null))[_0x3256('0x52')](handleError(_0x2caf9f,null));};exports['destroy']=function(_0x132470,_0x1e84fb){return db['ChatWebsite'][_0x3256('0x58')]({'where':{'id':_0x132470[_0x3256('0x54')]['id']}})[_0x3256('0x1e')](handleEntityNotFound(_0x1e84fb,null))[_0x3256('0x1e')](removeEntity(_0x1e84fb,null))[_0x3256('0x52')](handleError(_0x1e84fb,null));};exports[_0x3256('0x60')]=function(_0x386b5a,_0x840ccb){return db[_0x3256('0x3c')][_0x3256('0x60')]()[_0x3256('0x1e')](respondWithResult(_0x840ccb,null))['catch'](handleError(_0x840ccb,null));};exports['addDisposition']=function(_0x4b647b,_0x22aee9,_0x488ba7){if(_0x4b647b[_0x3256('0x5a')]['id']){delete _0x4b647b[_0x3256('0x5a')]['id'];}return db[_0x3256('0x3c')][_0x3256('0x58')]({'where':{'id':_0x4b647b[_0x3256('0x54')]['id']}})[_0x3256('0x1e')](handleEntityNotFound(_0x22aee9,null))[_0x3256('0x1e')](function(_0x559bc7){if(_0x559bc7){_0x4b647b[_0x3256('0x5a')][_0x3256('0x61')]=_0x559bc7['id'];return db[_0x3256('0x62')][_0x3256('0x59')](_0x4b647b['body']);}})[_0x3256('0x1e')](respondWithResult(_0x22aee9,null))[_0x3256('0x52')](handleError(_0x22aee9,null));};exports[_0x3256('0x63')]=function(_0x1aabd1,_0x5f18cc,_0xd1f55){var _0x4ba77c={'raw':![],'where':{}};var _0x4063b8={};var _0xd13029={'count':0x0,'rows':[]};return db[_0x3256('0x3c')][_0x3256('0x64')]({'where':{'id':_0x1aabd1[_0x3256('0x54')]['id']}})[_0x3256('0x1e')](handleEntityNotFound(_0x5f18cc,null))[_0x3256('0x1e')](function(_0x3c6f86){if(_0x3c6f86){_0x4063b8[_0x3256('0x43')]=_[_0x3256('0x56')](db[_0x3256('0x62')][_0x3256('0x3d')]);_0x4063b8[_0x3256('0x41')]=_[_0x3256('0x56')](_0x1aabd1['query']);_0x4063b8[_0x3256('0x42')]=_[_0x3256('0x45')](_0x4063b8[_0x3256('0x43')],_0x4063b8[_0x3256('0x41')]);_0x4ba77c[_0x3256('0x44')]=_[_0x3256('0x45')](_0x4063b8['model'],qs[_0x3256('0x46')](_0x1aabd1[_0x3256('0x41')][_0x3256('0x46')]));_0x4ba77c[_0x3256('0x44')]=_0x4ba77c[_0x3256('0x44')][_0x3256('0x47')]?_0x4ba77c[_0x3256('0x44')]:_0x4063b8[_0x3256('0x43')];if(!_0x1aabd1['query'][_0x3256('0x48')]('nolimit')){_0x4ba77c['limit']=qs['limit'](_0x1aabd1[_0x3256('0x41')][_0x3256('0x2d')]);_0x4ba77c[_0x3256('0x2f')]=qs[_0x3256('0x2f')](_0x1aabd1[_0x3256('0x41')][_0x3256('0x2f')]);}_0x4ba77c[_0x3256('0x65')]=qs[_0x3256('0x4a')](_0x1aabd1[_0x3256('0x41')][_0x3256('0x4a')]);_0x4ba77c[_0x3256('0x4b')]=qs[_0x3256('0x42')](_[_0x3256('0x4c')](_0x1aabd1[_0x3256('0x41')],_0x4063b8[_0x3256('0x42')]));_0x4ba77c[_0x3256('0x4b')]['ChatWebsiteId']=_0x3c6f86['id'];if(_0x1aabd1[_0x3256('0x41')][_0x3256('0x4e')]){_0x4ba77c[_0x3256('0x4b')]=_[_0x3256('0x4d')](_0x4ba77c[_0x3256('0x4b')],{'$or':_[_0x3256('0x3b')](_0x4ba77c[_0x3256('0x44')],function(_0x4bbc32){var _0x1aa174={};_0x1aa174[_0x4bbc32]={'$like':'%'+_0x1aabd1[_0x3256('0x41')][_0x3256('0x4e')]+'%'};return _0x1aa174;})});}_0x4ba77c=_[_0x3256('0x4d')]({},_0x4ba77c,_0x1aabd1[_0x3256('0x66')]);return db[_0x3256('0x62')]['count']({'where':_0x4ba77c[_0x3256('0x4b')]})[_0x3256('0x1e')](function(_0x3fc02a){_0xd13029[_0x3256('0x2e')]=_0x3fc02a;if(_0x1aabd1[_0x3256('0x41')][_0x3256('0x57')]){_0x4ba77c['include']=[{'all':!![]}];}return db[_0x3256('0x62')][_0x3256('0x50')](_0x4ba77c);})[_0x3256('0x1e')](function(_0x481efe){_0xd13029[_0x3256('0x51')]=_0x481efe;return _0xd13029;});}})[_0x3256('0x1e')](respondWithFilteredResult(_0x5f18cc,_0x4ba77c))['catch'](handleError(_0x5f18cc,null));};exports[_0x3256('0x67')]=function(_0x450279,_0x5464cc,_0x4bed17){return db[_0x3256('0x3c')]['find']({'where':{'id':_0x450279[_0x3256('0x54')]['id']}})['then'](handleEntityNotFound(_0x5464cc,null))[_0x3256('0x1e')](function(_0x26363c){if(_0x26363c){return _0x26363c[_0x3256('0x67')](_0x450279[_0x3256('0x41')][_0x3256('0x68')]);}})[_0x3256('0x1e')](respondWithStatusCode(_0x5464cc,null))[_0x3256('0x52')](handleError(_0x5464cc,null));};exports['addAnswer']=function(_0x1e0a5f,_0x372913,_0x5c98eb){if(_0x1e0a5f[_0x3256('0x5a')]['id']){delete _0x1e0a5f[_0x3256('0x5a')]['id'];}return db[_0x3256('0x3c')]['find']({'where':{'id':_0x1e0a5f['params']['id']}})[_0x3256('0x1e')](handleEntityNotFound(_0x372913,null))[_0x3256('0x1e')](function(_0x5763ff){if(_0x5763ff){_0x1e0a5f[_0x3256('0x5a')][_0x3256('0x61')]=_0x5763ff['id'];return db[_0x3256('0x69')][_0x3256('0x59')](_0x1e0a5f[_0x3256('0x5a')]);}})[_0x3256('0x1e')](respondWithResult(_0x372913,null))[_0x3256('0x52')](handleError(_0x372913,null));};exports['getAnswers']=function(_0x53cbbb,_0x3c8f0c,_0x469670){var _0x2bd321={'raw':![],'where':{}};var _0x4e55a5={};var _0x28dbc4={'count':0x0,'rows':[]};return db[_0x3256('0x3c')][_0x3256('0x64')]({'where':{'id':_0x53cbbb[_0x3256('0x54')]['id']}})[_0x3256('0x1e')](handleEntityNotFound(_0x3c8f0c,null))[_0x3256('0x1e')](function(_0x25524d){if(_0x25524d){_0x4e55a5[_0x3256('0x43')]=_['keys'](db['CannedAnswer'][_0x3256('0x3d')]);_0x4e55a5[_0x3256('0x41')]=_[_0x3256('0x56')](_0x53cbbb['query']);_0x4e55a5[_0x3256('0x42')]=_[_0x3256('0x45')](_0x4e55a5['model'],_0x4e55a5[_0x3256('0x41')]);_0x2bd321[_0x3256('0x44')]=_['intersection'](_0x4e55a5[_0x3256('0x43')],qs[_0x3256('0x46')](_0x53cbbb[_0x3256('0x41')]['fields']));_0x2bd321[_0x3256('0x44')]=_0x2bd321['attributes'][_0x3256('0x47')]?_0x2bd321[_0x3256('0x44')]:_0x4e55a5[_0x3256('0x43')];if(!_0x53cbbb[_0x3256('0x41')][_0x3256('0x48')]('nolimit')){_0x2bd321['limit']=qs[_0x3256('0x2d')](_0x53cbbb['query'][_0x3256('0x2d')]);_0x2bd321['offset']=qs[_0x3256('0x2f')](_0x53cbbb[_0x3256('0x41')][_0x3256('0x2f')]);}_0x2bd321['order']=qs['sort'](_0x53cbbb[_0x3256('0x41')][_0x3256('0x4a')]);_0x2bd321[_0x3256('0x4b')]=qs[_0x3256('0x42')](_[_0x3256('0x4c')](_0x53cbbb[_0x3256('0x41')],_0x4e55a5['filters']));_0x2bd321['where']['ChatWebsiteId']=_0x25524d['id'];if(_0x53cbbb['query'][_0x3256('0x4e')]){_0x2bd321[_0x3256('0x4b')]=_[_0x3256('0x4d')](_0x2bd321[_0x3256('0x4b')],{'$or':_[_0x3256('0x3b')](_0x2bd321[_0x3256('0x44')],function(_0x45b320){var _0x375d47={};_0x375d47[_0x45b320]={'$like':'%'+_0x53cbbb['query']['filter']+'%'};return _0x375d47;})});}_0x2bd321=_['merge']({},_0x2bd321,_0x53cbbb[_0x3256('0x66')]);return db['CannedAnswer'][_0x3256('0x2e')]({'where':_0x2bd321[_0x3256('0x4b')]})[_0x3256('0x1e')](function(_0x37485e){_0x28dbc4[_0x3256('0x2e')]=_0x37485e;if(_0x53cbbb[_0x3256('0x41')][_0x3256('0x57')]){_0x2bd321['include']=[{'all':!![]}];}return db[_0x3256('0x69')][_0x3256('0x50')](_0x2bd321);})[_0x3256('0x1e')](function(_0x34bf4c){_0x28dbc4[_0x3256('0x51')]=_0x34bf4c;return _0x28dbc4;});}})[_0x3256('0x1e')](respondWithFilteredResult(_0x3c8f0c,_0x2bd321))[_0x3256('0x52')](handleError(_0x3c8f0c,null));};exports['removeAnswers']=function(_0x31a908,_0x52d9db,_0x19629c){return db[_0x3256('0x3c')][_0x3256('0x58')]({'where':{'id':_0x31a908['params']['id']}})[_0x3256('0x1e')](handleEntityNotFound(_0x52d9db,null))[_0x3256('0x1e')](function(_0x1d72f7){if(_0x1d72f7){return _0x1d72f7[_0x3256('0x6a')](_0x31a908[_0x3256('0x41')][_0x3256('0x68')]);}})[_0x3256('0x1e')](respondWithStatusCode(_0x52d9db,null))['catch'](handleError(_0x52d9db,null));};exports[_0x3256('0x6b')]=function(_0x371429,_0x4a4293,_0x5cd6e1){_0x371429['body'][_0x3256('0x6c')]=_0x371429[_0x3256('0x6d')][_0x3256('0x6e')];return db['ChatWebsite'][_0x3256('0x58')]({'where':{'id':_0x371429['params']['id']}})['then'](handleEntityNotFound(_0x4a4293,null))['then'](saveUpdates(_0x371429[_0x3256('0x5a')],null))[_0x3256('0x1e')](respondWithResult(_0x4a4293,null))[_0x3256('0x52')](handleError(_0x4a4293,null));};exports['addAvatar']=function(_0x2b8e50,_0x226499,_0x5c8941){_0x2b8e50[_0x3256('0x5a')][_0x3256('0x6f')]=_0x2b8e50[_0x3256('0x6d')][_0x3256('0x6e')];return db[_0x3256('0x3c')][_0x3256('0x58')]({'where':{'id':_0x2b8e50[_0x3256('0x54')]['id']}})[_0x3256('0x1e')](handleEntityNotFound(_0x226499,null))['then'](saveUpdates(_0x2b8e50[_0x3256('0x5a')],null))['then'](respondWithResult(_0x226499,null))[_0x3256('0x52')](handleError(_0x226499,null));};exports[_0x3256('0x70')]=function(_0x42b3d0,_0x64e81f,_0x24cfff){_0x42b3d0['body'][_0x3256('0x71')]=_0x42b3d0[_0x3256('0x6d')]['filename'];return db[_0x3256('0x3c')][_0x3256('0x58')]({'where':{'id':_0x42b3d0[_0x3256('0x54')]['id']}})[_0x3256('0x1e')](handleEntityNotFound(_0x64e81f,null))['then'](saveUpdates(_0x42b3d0[_0x3256('0x5a')],null))[_0x3256('0x1e')](respondWithResult(_0x64e81f,null))[_0x3256('0x52')](handleError(_0x64e81f,null));};exports[_0x3256('0x72')]=function(_0x2d3827,_0x19a2fe,_0x376184){_0x2d3827[_0x3256('0x5a')]['systemAvatar']=_0x2d3827[_0x3256('0x6d')]['filename'];return db[_0x3256('0x3c')][_0x3256('0x58')]({'where':{'id':_0x2d3827[_0x3256('0x54')]['id']}})[_0x3256('0x1e')](handleEntityNotFound(_0x19a2fe,null))[_0x3256('0x1e')](saveUpdates(_0x2d3827['body'],null))['then'](respondWithResult(_0x19a2fe,null))[_0x3256('0x52')](handleError(_0x19a2fe,null));};exports[_0x3256('0x73')]=function(_0x44740a,_0x1894b3,_0x13fff4){var _0x523e5d=path[_0x3256('0x74')](config['root'],_0x3256('0x75'));var _0x21a82d={'where':{'id':_0x44740a[_0x3256('0x54')]['id']},'attributes':['id',_0x3256('0x6c')],'raw':!![]};var _0xf95e3=![];return require(_0x3256('0x16'))['getLicense']()['then'](function(_0xc2edf9){if(_0xc2edf9){_0xf95e3=_0xc2edf9['custom'];}})[_0x3256('0x1e')](function(){return db[_0x3256('0x3c')]['find'](_0x21a82d);})['then'](handleEntityNotFound(_0x1894b3,null))[_0x3256('0x1e')](function(_0x139f7a){if(_0x139f7a){if(!_[_0x3256('0x76')](_0x139f7a[_0x3256('0x6c')])){if(fs[_0x3256('0x77')](path[_0x3256('0x74')](config[_0x3256('0x78')],_0x3256('0x79'),_0x139f7a[_0x3256('0x6c')]))&&_0xf95e3){_0x523e5d=path[_0x3256('0x74')](config['root'],'server/files/images/logos/',_0x139f7a[_0x3256('0x6c')]);}}return _0x1894b3[_0x3256('0x7a')](_0x523e5d);}})['catch'](handleError(_0x1894b3,null));};exports[_0x3256('0x7b')]=function(_0x5ab6cc,_0x16666d,_0x30634f){var _0xcbe899=path[_0x3256('0x74')](config[_0x3256('0x78')],_0x3256('0x7c'));var _0x2eedb1={'where':{'id':_0x5ab6cc[_0x3256('0x54')]['id']},'attributes':['id',_0x3256('0x6f')],'raw':!![]};return db['ChatWebsite'][_0x3256('0x58')](_0x2eedb1)[_0x3256('0x1e')](handleEntityNotFound(_0x16666d,null))[_0x3256('0x1e')](function(_0x93f517){if(_0x93f517){if(!_[_0x3256('0x76')](_0x93f517[_0x3256('0x6f')])){if(fs[_0x3256('0x77')](path['join'](config[_0x3256('0x78')],'server/files/images/avatars/',_0x93f517[_0x3256('0x6f')]))){_0xcbe899=path['join'](config[_0x3256('0x78')],'server/files/images/avatars/',_0x93f517[_0x3256('0x6f')]);}}return _0x16666d['download'](_0xcbe899);}})[_0x3256('0x52')](handleError(_0x16666d,null));};exports[_0x3256('0x7d')]=function(_0x248587,_0x4ef400,_0x39fe2f){var _0xb41c7b=path[_0x3256('0x74')](config[_0x3256('0x78')],_0x3256('0x7e'));var _0x160f78={'where':{'id':_0x248587[_0x3256('0x54')]['id']},'attributes':['id',_0x3256('0x71'),_0x3256('0x7f')],'raw':!![]};return db[_0x3256('0x3c')][_0x3256('0x58')](_0x160f78)[_0x3256('0x1e')](handleEntityNotFound(_0x4ef400,null))[_0x3256('0x1e')](function(_0x4c3c13){if(_0x4c3c13){if(!_[_0x3256('0x76')](_0x4c3c13[_0x3256('0x71')])){if(fs[_0x3256('0x77')](path['join'](config[_0x3256('0x78')],_0x3256('0x80'),_0x4c3c13[_0x3256('0x71')]))&&_0x4c3c13[_0x3256('0x7f')]){_0xb41c7b=path['join'](config[_0x3256('0x78')],_0x3256('0x80'),_0x4c3c13[_0x3256('0x71')]);}}return _0x4ef400[_0x3256('0x7a')](_0xb41c7b);}})[_0x3256('0x52')](handleError(_0x4ef400,null));};exports[_0x3256('0x81')]=function(_0x2077b7,_0x5e95ee,_0x372107){var _0x41cc31=path['join'](config[_0x3256('0x78')],_0x3256('0x82'));var _0x5b2b98={'where':{'id':_0x2077b7[_0x3256('0x54')]['id']},'attributes':['id',_0x3256('0x83')],'raw':!![]};return db[_0x3256('0x3c')][_0x3256('0x58')](_0x5b2b98)[_0x3256('0x1e')](handleEntityNotFound(_0x5e95ee,null))[_0x3256('0x1e')](function(_0x14b608){if(_0x14b608){if(!_[_0x3256('0x76')](_0x14b608[_0x3256('0x83')])){if(fs[_0x3256('0x77')](path[_0x3256('0x74')](config[_0x3256('0x78')],_0x3256('0x80'),_0x14b608[_0x3256('0x83')]))){_0x41cc31=path[_0x3256('0x74')](config[_0x3256('0x78')],_0x3256('0x80'),_0x14b608[_0x3256('0x83')]);}}return _0x5e95ee[_0x3256('0x7a')](_0x41cc31);}})['catch'](handleError(_0x5e95ee,null));};exports[_0x3256('0x84')]=function(_0x38db9d,_0x3b44e7,_0x58fe33){var _0x1942ab=require(_0x3256('0x85'));var _0x917c11=new _0x1942ab();var _0x47c9f9=_0x917c11[_0x3256('0x86')](_0x38db9d['headers'][_0x3256('0x87')])[_0x3256('0x88')]();var _0x1503ee={'body':_0x38db9d[_0x3256('0x5a')],'channel':_0x3256('0x89')};var _0x4676a3=[];var _0x2fa144=[];var _0x5f4f93={};var _0xd9a862=![];return db['CmContact']['describe']()[_0x3256('0x1e')](function(_0x307b1c){if(!_0x307b1c){throw new db[(_0x3256('0x8a'))][(_0x3256('0x8b'))](_0x3256('0x8c'));}_0x4676a3=_['difference'](_['keys'](_0x307b1c),[_0x3256('0x8d'),_0x3256('0x8e')]);_0x2fa144=_[_0x3256('0x8f')](_[_0x3256('0x56')](_0x307b1c),[_0x3256('0x8d'),_0x3256('0x8e'),_0x3256('0x90'),_0x3256('0x91')]);if(_0x38db9d['body']['id']){delete _0x38db9d[_0x3256('0x5a')]['id'];}if(_['isNil'](_0x38db9d['body'][_0x3256('0x92')])){throw new db[(_0x3256('0x8a'))]['ValidationError'](_0x3256('0x93'));}if(_['isNil'](_0x38db9d['body'][_0x3256('0x5a')])||_0x38db9d['body'][_0x3256('0x5a')]===''){throw new db[(_0x3256('0x8a'))][(_0x3256('0x8b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x3256('0x76')](_0x38db9d[_0x3256('0x5a')]['mapKey'])){throw new db['Sequelize'][(_0x3256('0x8b'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2fa144);}if(!_[_0x3256('0x94')](_0x2fa144,_0x38db9d[_0x3256('0x5a')]['mapKey'])){throw new db[(_0x3256('0x8a'))][(_0x3256('0x8b'))](_0x3256('0x95')+_0x2fa144);}_0x5f4f93[_0x38db9d[_0x3256('0x5a')][_0x3256('0x96')]]=_0x38db9d['body'][_0x3256('0x92')];})['then'](function(){return db['ChatWebsite']['find']({'where':{'id':_0x38db9d[_0x3256('0x54')]['id']},'include':[{'model':db[_0x3256('0x97')],'as':_0x3256('0x98'),'include':[{'model':db['CmContact'],'as':_0x3256('0x99'),'where':_0x5f4f93,'limit':0x1,'order':[[_0x3256('0x8e'),_0x3256('0x9a')]]}]},{'model':db['ChatApplication'],'as':_0x3256('0x9b')}]});})[_0x3256('0x1e')](handleEntityNotFound(_0x3b44e7,null))[_0x3256('0x1e')](function(_0x1aa37f){if(_0x1aa37f&&_0x1aa37f['List']){_0x1503ee['account']=_0x1aa37f;_0x1503ee[_0x3256('0x9c')]=_0x1aa37f[_0x3256('0x9b')];_0x1503ee[_0x3256('0x9d')]=_0x1aa37f[_0x3256('0x98')];_0x1503ee[_0x3256('0x9c')]=_[_0x3256('0x9e')](_0x1503ee[_0x3256('0x9c')],['priority'],[_0x3256('0x9f')]);if(_0x1503ee[_0x3256('0xa0')][_0x3256('0x9b')]){delete _0x1503ee['account'][_0x3256('0x9b')];}if(_0x1503ee[_0x3256('0xa0')][_0x3256('0x98')]&&_0x1503ee['account'][_0x3256('0x98')][_0x3256('0x99')][_0x3256('0x47')]){return _0x1503ee[_0x3256('0xa0')][_0x3256('0x98')][_0x3256('0x99')][0x0];}var _0x1d0660=_[_0x3256('0xa1')](_0x38db9d['body'],{'firstName':_0x38db9d[_0x3256('0x5a')]['from'],'ListId':_0x1aa37f[_0x3256('0x91')]});_0x1d0660[_0x38db9d[_0x3256('0x5a')]['mapKey']]=_0x38db9d[_0x3256('0x5a')][_0x3256('0x92')];return db[_0x3256('0xa2')][_0x3256('0x59')](_0x1d0660,{'fields':_0x4676a3,'raw':!![]});}})[_0x3256('0x1e')](handleEntityNotFound(_0x3b44e7,null))['then'](function(_0x492050){_0x1503ee[_0x3256('0xa3')]=_0x492050;var _0x54cf13=_0x38db9d['body']['customerIp'];if(_0x38db9d[_0x3256('0xa4')][_0x3256('0xa5')]){_0x54cf13=_0x38db9d['headers']['cf-connecting-ip'];}else if(_0x38db9d[_0x3256('0xa4')][_0x3256('0xa6')]){_0x54cf13=_[_0x3256('0xa7')](_0x38db9d[_0x3256('0xa4')][_0x3256('0xa6')][_0x3256('0xa8')](','));}if(_0x492050){var _0x566c9c={'ContactId':_0x492050['id'],'ChatWebsiteId':_0x38db9d['params']['id'],'from':(_0x492050[_0x3256('0xa9')]||'')+'\x20'+(_0x492050[_0x3256('0xaa')]||''),'customerIp':_0x54cf13,'customerPort':_0x38db9d['headers']['x-real-port']?_0x38db9d[_0x3256('0xa4')][_0x3256('0xab')]:null,'referer':_0x38db9d[_0x3256('0x5a')][_0x3256('0xac')],'browserName':_0x47c9f9['browser'][_0x3256('0x38')]&&_0x47c9f9[_0x3256('0xad')][_0x3256('0xae')]?util[_0x3256('0xaf')](_0x3256('0xb0'),_0x47c9f9[_0x3256('0xad')][_0x3256('0x38')],_0x47c9f9[_0x3256('0xad')][_0x3256('0xae')]):_0x3256('0xb1'),'browserVersion':_0x47c9f9['browser']['version']||'unknown','osName':util[_0x3256('0xaf')](_0x3256('0xb0'),_0x47c9f9['os']['name'],_0x47c9f9['os'][_0x3256('0xae')]),'osVersion':_0x47c9f9['os'][_0x3256('0xae')],'deviceModel':_0x47c9f9[_0x3256('0xb2')][_0x3256('0x43')]&&_0x47c9f9[_0x3256('0xb2')]['vendor']?util[_0x3256('0xaf')](_0x3256('0xb3'),_0x47c9f9[_0x3256('0xb2')]['model'],_0x47c9f9[_0x3256('0xb2')]['vendor'],_0x47c9f9[_0x3256('0xb2')][_0x3256('0x3f')]):null,'deviceVendor':_0x47c9f9[_0x3256('0xb2')][_0x3256('0xb4')],'deviceType':_0x47c9f9[_0x3256('0xb2')][_0x3256('0x3f')],'formData':JSON[_0x3256('0x23')](_0x38db9d[_0x3256('0x5a')])};var _0x3ad65a={'ChatWebsiteId':_0x38db9d[_0x3256('0x54')]['id'],'closed':![]};if(_0x38db9d[_0x3256('0x5a')][_0x3256('0xb5')]){_0x3ad65a[_0x3256('0xb5')]=_0x38db9d['body']['threadId'];return db['ChatInteraction']['find']({'where':_0x3ad65a})['then'](function(_0x591f5c){if(_0x591f5c){return[_0x591f5c,![]];}_0x566c9c[_0x3256('0xb5')]=_0x38db9d[_0x3256('0x5a')][_0x3256('0xb5')];_0x566c9c[_0x3256('0xb6')]=_0x38db9d[_0x3256('0x5a')][_0x3256('0xb6')];return db[_0x3256('0xb7')][_0x3256('0x59')](_0x566c9c)[_0x3256('0x1e')](function(_0x3b55f6){return[_0x3b55f6,!![]];});});}_0x3ad65a['ContactId']=_0x492050['id'];if(_0x38db9d[_0x3256('0x5a')][_0x3256('0xb8')]&&_0x38db9d[_0x3256('0x5a')][_0x3256('0xb8')]['id']){_0x3ad65a['id']=_0x38db9d['body'][_0x3256('0xb8')]['id'];return db[_0x3256('0xb7')]['find']({'where':_0x3ad65a})['then'](function(_0x68048b){if(_0x68048b){return[_0x68048b,![]];}return db[_0x3256('0xb7')][_0x3256('0x59')](_0x566c9c)[_0x3256('0x1e')](function(_0x29c4e5){return[_0x29c4e5,!![]];});});}return db[_0x3256('0xb7')][_0x3256('0x59')](_0x566c9c)[_0x3256('0x1e')](function(_0x25e7fd){return[_0x25e7fd,!![]];});}})[_0x3256('0xb9')](function(_0x415e17,_0x17210f){if(_0x415e17){_0xd9a862=_0x17210f;if(!_0x17210f){var _0x43bafb={'from':(_0x1503ee[_0x3256('0xa3')][_0x3256('0xa9')]||'')+'\x20'+(_0x1503ee[_0x3256('0xa3')][_0x3256('0xaa')]||'')};if(_0x38db9d[_0x3256('0x5a')][_0x3256('0xb5')]&&_0x38db9d['body'][_0x3256('0xba')]&&_0x38db9d[_0x3256('0x5a')][_0x3256('0xb5')]!=_0x38db9d[_0x3256('0x5a')][_0x3256('0xba')]){_0x43bafb[_0x3256('0xb5')]=_0x38db9d[_0x3256('0x5a')][_0x3256('0xba')];}return _0x415e17[_0x3256('0x33')](_0x43bafb);}else{return _0x415e17;}}})[_0x3256('0x1e')](function(_0x1a504e){_0x1503ee[_0x3256('0xb8')]=_0x1a504e[_0x3256('0x5c')]({'plain':!![]});_0x1503ee['interaction'][_0x3256('0xbb')]=_0xd9a862;if(_0x1503ee['interaction']['created']){if(_0x1503ee[_0x3256('0xa0')][_0x3256('0xbc')]){_0x1503ee[_0x3256('0x9c')][_0x3256('0xbd')]({'id':0x0,'priority':_0x1503ee[_0x3256('0x9c')][_0x3256('0x47')]+0x1,'app':_0x3256('0xbe'),'appdata':_0x3256('0xbf'),'interval':_0x3256('0xc0')});}}return db[_0x3256('0xc1')][_0x3256('0x59')]({'body':_0x38db9d[_0x3256('0x5a')]['body'],'ChatWebsiteId':_0x38db9d[_0x3256('0x54')]['id'],'ChatInteractionId':_0x1a504e['id'],'direction':'in','ContactId':_0x1503ee[_0x3256('0xa3')]['id'],'AttachmentId':_0x38db9d[_0x3256('0x5a')][_0x3256('0xc2')]});})['then'](function(_0x1e61ee){_0x1503ee[_0x3256('0x26')]=_0x1e61ee;if(_0x1503ee[_0x3256('0xb8')][_0x3256('0xc3')]){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x1503ee[_0x3256('0xb8')][_0x3256('0xc3')]}})['then'](function(_0x1a545d){if(_0x1a545d){_0x1503ee[_0x3256('0x9c')][_0x3256('0xc4')]({'id':0x0,'priority':0x0,'app':_0x3256('0xc5'),'appdata':_0x1a545d[_0x3256('0x38')]+','+(_0x1503ee[_0x3256('0xa0')][_0x3256('0xc6')]||0xa),'interval':'*,*,*,*'});_0x1503ee[_0x3256('0xc7')]=!![];}return respondWithRpcPromise(_0x3256('0xc8'),'startRouting',_0x1503ee);});}return respondWithRpcPromise(_0x3256('0xc8'),_0x3256('0xc9'),_0x1503ee);})[_0x3256('0x1e')](function(_0x8f1ea9){respondWithRpcPromise(_0x3256('0xca'),_0x3256('0xca'),{'event':_0x3256('0x84'),'message':_0x8f1ea9},client9002);return _0x8f1ea9;})['then'](respondWithResult(_0x3b44e7,null))['catch'](handleError(_0x3b44e7,null));};exports[_0x3256('0xcb')]=function(_0x5a6f32,_0x4eee1e,_0x381919){var _0x10cbf2,_0x233fc8,_0x459ff0;var _0x46fa79=[];var _0x154ad6=[];var _0xaed7db={};var _0x4d880f=_0x5a6f32[_0x3256('0xcc')]||[];var _0x663949=[];var _0x470eda;return db[_0x3256('0xa2')][_0x3256('0x60')]()[_0x3256('0x1e')](function(_0x1fd0a2){if(!_0x1fd0a2){throw new db[(_0x3256('0x8a'))][(_0x3256('0x8b'))](_0x3256('0x8c'));}_0x154ad6=_[_0x3256('0x8f')](_[_0x3256('0x56')](_0x1fd0a2),['createdAt',_0x3256('0x8e')]);_0x46fa79=_[_0x3256('0x8f')](_[_0x3256('0x56')](_0x1fd0a2),[_0x3256('0x8d'),_0x3256('0x8e'),'CompanyId',_0x3256('0x91')]);if(_0x5a6f32[_0x3256('0x5a')]['id']){delete _0x5a6f32[_0x3256('0x5a')]['id'];}if(_[_0x3256('0x76')](_0x5a6f32[_0x3256('0x5a')]['from'])){throw _0x4eee1e[_0x3256('0x29')](0x1f4)[_0x3256('0x39')](new db['Sequelize']['ValidationError'](_0x3256('0x93')));}if(_[_0x3256('0x76')](_0x5a6f32[_0x3256('0x5a')][_0x3256('0x5a')])||_0x5a6f32['body'][_0x3256('0x5a')]===''){throw _0x4eee1e['status'](0x1f4)[_0x3256('0x39')](new db['Sequelize'][(_0x3256('0x8b'))](_0x3256('0xcd')));}if(_['isNil'](_0x5a6f32[_0x3256('0x5a')][_0x3256('0xce')])){throw _0x4eee1e[_0x3256('0x29')](0x1f4)[_0x3256('0x39')](new db['Sequelize']['ValidationError'](_0x3256('0xcf')+_0x46fa79));}if(!_[_0x3256('0x94')](_0x46fa79,_0x5a6f32[_0x3256('0x5a')][_0x3256('0xce')])){throw _0x4eee1e[_0x3256('0x29')](0x1f4)[_0x3256('0x39')](new db[(_0x3256('0x8a'))]['ValidationError'](_0x3256('0xd0')+_0x46fa79));}_0xaed7db[_0x5a6f32[_0x3256('0x5a')][_0x3256('0xce')]]=_0x5a6f32[_0x3256('0x5a')][_0x3256('0x92')];})[_0x3256('0x1e')](function(){return db[_0x3256('0x3c')][_0x3256('0x58')]({'where':{'id':_0x5a6f32[_0x3256('0x54')]['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db[_0x3256('0xd1')],'as':_0x3256('0xd1')}]});})[_0x3256('0x1e')](handleEntityNotFound(_0x4eee1e,null))[_0x3256('0x1e')](function(_0x215ca5){if(_0x215ca5&&_0x215ca5['List']){_0x233fc8=_0x215ca5;var _0x73d64a=_[_0x3256('0xa1')](_0x5a6f32[_0x3256('0x5a')],{'firstName':_0x5a6f32[_0x3256('0x5a')][_0x3256('0x92')],'phone':_0x5a6f32[_0x3256('0x5a')][_0x3256('0x92')],'ListId':_0x215ca5['ListId']});_0x73d64a[_0x5a6f32['body'][_0x3256('0xce')]]=_0x5a6f32[_0x3256('0x5a')][_0x3256('0x92')];return db[_0x3256('0xa2')][_0x3256('0xd2')]({'where':_0xaed7db,'defaults':_0x73d64a});}})['spread'](function(_0x573cd9){if(_0x573cd9){_0x459ff0=_0x573cd9;var _0x598721=fs[_0x3256('0xd3')](path[_0x3256('0x74')](config['root'],_0x3256('0xd4')),_0x3256('0xd5'));var _0x20b4b7=ejs[_0x3256('0xd6')](_0x598721,{'body':_[_0x3256('0xd7')](_0x5a6f32[_0x3256('0x5a')][_0x3256('0x5a')]),'bodyTitle':_0x233fc8[_0x3256('0xd8')]});return db[_0x3256('0xd9')][_0x3256('0x59')]({'body':_0x20b4b7,'ContactId':_0x573cd9['id'],'ChatWebsiteId':_0x233fc8['id']});}})['then'](function(_0x2a2d13){_0x470eda=_0x2a2d13;if(_0x4d880f[_0x3256('0x47')]){var _0x5f50bd=_0x4d880f['map'](function(_0x42508f){return{'name':_0x42508f[_0x3256('0xda')],'basename':_0x42508f['filename'],'type':_0x42508f[_0x3256('0xdb')],'ChatOfflineMessageId':_0x2a2d13['id']};});_0x663949=_0x5f50bd[_0x3256('0x3b')](_0x4edf95=>{var _0x479a03={'filename':_0x4edf95[_0x3256('0x38')],'path':path['join'](config[_0x3256('0x78')],_0x3256('0xdc'),_0x3256('0xcc'),_0x3256('0xdd'),_0x3256('0xde'),_0x4edf95[_0x3256('0xdf')])};return _0x479a03;});if(!_0x233fc8[_0x3256('0xe0')]){return db[_0x3256('0xe1')]['transaction'](function(_0x4eb54a){return db[_0x3256('0xe2')][_0x3256('0xe3')](_0x5f50bd,{'transaction':_0x4eb54a});});}}})['then'](function(){if(_0x470eda){_0x10cbf2=_0x470eda;return db[_0x3256('0xd1')][_0x3256('0x64')]({'where':{'active':!![]},'include':[{'model':db[_0x3256('0xe4')],'as':_0x3256('0xe5'),'raw':!![]}]});}})[_0x3256('0x1e')](function(_0x4d574e){if(_0x4d574e&&_0x4d574e['Smtp']&&_0x233fc8[_0x3256('0xe6')]&&_0x233fc8[_0x3256('0xe7')]){var _0x500ce1={'tls':{'rejectUnauthorized':![]}};if(_0x4d574e[_0x3256('0xe5')][_0x3256('0xe8')]){_0x500ce1[_0x3256('0xe8')]=_0x4d574e[_0x3256('0xe5')][_0x3256('0xe8')];}else{_0x500ce1[_0x3256('0xe9')]=_0x4d574e[_0x3256('0xe5')]['host'];_0x500ce1[_0x3256('0xea')]=_0x4d574e[_0x3256('0xe5')][_0x3256('0xea')];_0x500ce1[_0x3256('0xeb')]=_0x4d574e['Smtp'][_0x3256('0xeb')];}if(_0x4d574e[_0x3256('0xe5')]['authentication']){_0x500ce1[_0x3256('0xec')]={'user':_0x4d574e[_0x3256('0xe5')][_0x3256('0x5b')],'pass':_0x4d574e[_0x3256('0xe5')]['pass']};}return respondWithRpcPromise('SendMail',_0x3256('0xed'),{'account':_0x500ce1,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x4d574e[_0x3256('0x38')],_0x4d574e[_0x3256('0xee')]||_0x4d574e['Smtp'][_0x3256('0x5b')]),'to':_0x233fc8['forwardOfflineAddress'],'subject':_0x233fc8[_0x3256('0xef')],'html':_0x10cbf2[_0x3256('0x5a')],'attachments':_0x663949}},client9003)[_0x3256('0x1e')](function(){return _0x10cbf2;})['catch'](function(_0x7351e3){console[_0x3256('0x24')](_0x7351e3);});}})['then'](function(){if(_0x233fc8&&_0x233fc8[_0x3256('0xe0')]&&_0x233fc8['MailAccountId']){var _0x1c8065=[];if(_0x4d880f[_0x3256('0x47')]){_0x1c8065=_0x4d880f[_0x3256('0x3b')](function(_0x33f8c1){return{'name':_0x33f8c1[_0x3256('0xda')],'basename':_0x33f8c1[_0x3256('0x6e')],'type':_0x33f8c1[_0x3256('0xdb')],'ChatOfflineMessageId':_0x470eda['id']};});}var _0x2f3198;if(!_[_0x3256('0x76')](_0x233fc8[_0x3256('0xf0')])){var _0x4bc83c=_[_0x3256('0x3b')](_0x5a6f32[_0x3256('0x5a')],function(_0x4d88d7){return _0x4d88d7;});var _0x1bb59b=_['toPairsIn'](_0x4bc83c)[0x0];var _0x20f530=_['mapValues'](_0x1bb59b,function(_0x256d78){return _0x256d78;});_0x2f3198=_0x20f530[0x1][_0x233fc8[_0x3256('0xf0')]];}var _0x53dcdc={'from':_0x459ff0[_0x3256('0xee')],'firstName':_0x459ff0[_0x3256('0xa9')],'lastName':_0x459ff0[_0x3256('0xaa')],'mapKey':'email','message':{'from':_0x459ff0['email'],'to':_0x233fc8[_0x3256('0xd1')][_0x3256('0xee')],'cc':'','subject':_[_0x3256('0x76')](_0x2f3198)?_0x233fc8[_0x3256('0xef')]:_0x2f3198,'messageId':'','sentAt':new Date(),'attach':_0x1c8065[_0x3256('0x47')],'attachments':_0x1c8065,'originChannel':_0x3256('0xf1'),'ChatWebsiteId':_0x233fc8['id'],'ChatOfflineMessageId':_0x10cbf2['id'],'originTo':_0x233fc8['MailAccount'][_0x3256('0xee')]},'body':_0x10cbf2[_0x3256('0x5a')]};var _0x50df33={'account':{'id':_0x233fc8[_0x3256('0xf2')]},'body':_0x53dcdc,'log':_0x3256('0xf3')};return respondWithRpcPromise(_0x3256('0xf3'),_0x3256('0xf4'),_0x50df33,client9001)[_0x3256('0x1e')](function(){return _0x10cbf2;})[_0x3256('0x52')](function(_0x5edb86){console[_0x3256('0x24')](_0x5edb86);});}return;})['then'](function(){if(_0x10cbf2){return _0x10cbf2;}})[_0x3256('0x1e')](respondWithResult(_0x4eee1e,null))['catch'](function(_0x36ba02){console[_0x3256('0x24')](_0x3256('0x52'),_0x36ba02);for(var _0x479862 of _0x4d880f){var _0x48651d=path['join'](config[_0x3256('0x78')],'server',_0x3256('0xcc'),'attachments',_0x3256('0xde'),_0x479862[_0x3256('0x6e')]);fs_extra[_0x3256('0xf5')](_0x48651d)[_0x3256('0x52')](function(_0x236d64){console[_0x3256('0x24')]('Could\x20not\x20remove\x20attachment\x20file',_0x48651d,_0x236d64);});}});};exports['addInteraction']=function(_0x4360b5,_0x229858,_0x3468ad){return db['ChatInteraction'][_0x3256('0x58')]({'where':{'id':_0x4360b5['params']['id']}})['then'](handleEntityNotFound(_0x229858,null))['then'](function(_0x399a81){if(_0x399a81){return _0x399a81[_0x3256('0xf6')](_0x4360b5['body'][_0x3256('0x68')],_[_0x3256('0xf7')](_0x4360b5['body'],[_0x3256('0x68'),'id'])||{});}})[_0x3256('0x1e')](respondWithResult(_0x229858,null))[_0x3256('0x52')](handleError(_0x229858,null));};exports[_0x3256('0xf8')]=function(_0x450719,_0x15b088,_0xaf5f56){var _0x269118={'raw':![],'where':{}};var _0x5007ba={};var _0x4d84b9={'count':0x0,'rows':[]};return db[_0x3256('0x3c')][_0x3256('0x64')]({'where':{'id':_0x450719[_0x3256('0x54')]['id']}})[_0x3256('0x1e')](handleEntityNotFound(_0x15b088,null))[_0x3256('0x1e')](function(_0x5d343e){if(_0x5d343e){_0x5007ba['model']=_[_0x3256('0x56')](db[_0x3256('0xb7')][_0x3256('0x3d')]);_0x5007ba['query']=_[_0x3256('0x56')](_0x450719['query']);_0x5007ba[_0x3256('0x42')]=_[_0x3256('0x45')](_0x5007ba['model'],_0x5007ba[_0x3256('0x41')]);_0x269118[_0x3256('0x44')]=_['intersection'](_0x5007ba[_0x3256('0x43')],qs['fields'](_0x450719['query']['fields']));_0x269118['attributes']=_0x269118[_0x3256('0x44')][_0x3256('0x47')]?_0x269118[_0x3256('0x44')]:_0x5007ba[_0x3256('0x43')];if(!_0x450719['query']['hasOwnProperty'](_0x3256('0x49'))){_0x269118['limit']=qs[_0x3256('0x2d')](_0x450719[_0x3256('0x41')][_0x3256('0x2d')]);_0x269118[_0x3256('0x2f')]=qs['offset'](_0x450719[_0x3256('0x41')][_0x3256('0x2f')]);}_0x269118['order']=qs[_0x3256('0x4a')](_0x450719[_0x3256('0x41')][_0x3256('0x4a')]);_0x269118['where']=qs[_0x3256('0x42')](_[_0x3256('0x4c')](_0x450719[_0x3256('0x41')],_0x5007ba[_0x3256('0x42')]));_0x269118[_0x3256('0x4b')][_0x3256('0x61')]=_0x5d343e['id'];if(_0x450719[_0x3256('0x41')]['filter']){_0x269118[_0x3256('0x4b')]=_[_0x3256('0x4d')](_0x269118[_0x3256('0x4b')],{'$or':_[_0x3256('0x3b')](_0x269118[_0x3256('0x44')],function(_0x18aefa){var _0x3ed588={};_0x3ed588[_0x18aefa]={'$like':'%'+_0x450719[_0x3256('0x41')][_0x3256('0x4e')]+'%'};return _0x3ed588;})});}_0x269118=_[_0x3256('0x4d')]({},_0x269118,_0x450719[_0x3256('0x66')]);return db[_0x3256('0xb7')][_0x3256('0x2e')]({'where':_0x269118[_0x3256('0x4b')]})['then'](function(_0x57f8fb){_0x4d84b9[_0x3256('0x2e')]=_0x57f8fb;if(_0x450719['query'][_0x3256('0x57')]){_0x269118[_0x3256('0x4f')]=[{'model':db[_0x3256('0xa2')],'as':_0x3256('0xf9'),'required':![]},{'model':db[_0x3256('0xfa')],'as':_0x3256('0xfb'),'attributes':['name',_0x3256('0xfc'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x3256('0xfd'),'attributes':['id',_0x3256('0x38'),_0x3256('0xfe')],'where':_0x450719[_0x3256('0x41')]['tag']?{'id':_0x450719[_0x3256('0x41')]['tag']}:undefined,'required':_0x450719['query'][_0x3256('0xff')]?!![]:![]}];}return db['ChatInteraction'][_0x3256('0x50')](_0x269118);})[_0x3256('0x1e')](function(_0x4d6fe6){_0x4d84b9[_0x3256('0x51')]=_0x4d6fe6;return _0x4d84b9;});}})[_0x3256('0x1e')](respondWithFilteredResult(_0x15b088,_0x269118))[_0x3256('0x52')](handleError(_0x15b088,null));};function iftimePromise(_0x24f00f,_0x352aa9){return respondWithRpcPromise(_0x3256('0x100'),_0x3256('0x101'),{'command':_0x352aa9[_0x3256('0x102')]?util[_0x3256('0xaf')](_0x3256('0x103'),_0x24f00f['interval'],_0x352aa9[_0x3256('0x102')]):util[_0x3256('0xaf')](_0x3256('0x104'),_0x24f00f[_0x3256('0x105')])},client9002)[_0x3256('0x1e')](function(_0xcbfe47){var _0x44f49d=_0xcbfe47&&_0xcbfe47['indexOf']('true')>=0x0?!![]:![];logger[_0x3256('0x1f')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x352aa9['id'],_0x24f00f['id'],_0x24f00f[_0x3256('0x105')],_0x44f49d?_0x3256('0x106'):_0x3256('0x107'),_0x352aa9[_0x3256('0x102')]?_0x352aa9[_0x3256('0x102')]:_0x3256('0x108'));return _0x44f49d;})[_0x3256('0x52')](function(_0x14149c){logger[_0x3256('0x24')](_0x3256('0x109'),_0x352aa9['id'],_0x24f00f['id'],_0x24f00f[_0x3256('0x105')],util[_0x3256('0x10a')](_0x14149c,{'showHidden':![],'depth':null}),_0x352aa9['timezone']?_0x352aa9[_0x3256('0x102')]:'No\x20timezone');return![];});}exports['getSnippet']=function(_0x5ba3ad,_0x422bc4,_0x10d4a7){var _0x3567fe=0x0;var _0x3b4d7f=0x0;var _0x11e641=![];var _0xc9a6fe;var _0x2506cf;return db[_0x3256('0x3c')]['find']({'where':{'id':_0x5ba3ad[_0x3256('0x54')]['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0x3256('0x10b')],'as':_0x3256('0x10c'),'attributes':['id',_0x3256('0x105')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x422bc4,null))[_0x3256('0x1e')](function(_0x3a01f4){if(_0x3a01f4){_0xc9a6fe=_0x3a01f4;return _0x3a01f4[_0x3256('0x10d')]({'raw':!![]});}})['then'](function(_0x38c9a1){if(_0xc9a6fe){if(_0x38c9a1){_0x2506cf=_0x38c9a1;}}return require(_0x3256('0x16'))[_0x3256('0x10e')]();})[_0x3256('0x1e')](function(_0x476bed){if(_0x476bed){_0x3b4d7f=_0x476bed['virtual'];_0x11e641=_0x476bed[_0x3256('0x10f')];}})['then'](function(){return db[_0x3256('0xb7')][_0x3256('0x2e')]({'where':{'closed':![]}});})[_0x3256('0x1e')](function(_0x4e35fa){_0x3567fe=_0x4e35fa;if(_0x3b4d7f&&_0x4e35fa>_0x3b4d7f){return db[_0x3256('0x110')][_0x3256('0x64')]({'where':{'id':0x1}})[_0x3256('0x1e')](function(_0x4e72c2){if(_0x4e72c2){_0x4e72c2['increment']('chatLicenseExceeded');}});}})[_0x3256('0x1e')](function(){if(_0xc9a6fe['Interval']&&_0xc9a6fe['Interval'][_0x3256('0x10c')]){var _0x455e6c=[];for(var _0x58660a=0x0;_0x58660a<_0xc9a6fe[_0x3256('0x10b')][_0x3256('0x10c')][_0x3256('0x47')];_0x58660a++){var _0x48206c=_0xc9a6fe['Interval']['Intervals'][_0x58660a][_0x3256('0x5c')]({'plain':!![]});_0x455e6c['push'](iftimePromise(_0x48206c,_0xc9a6fe));}return BPromise[_0x3256('0x111')](_0x455e6c)[_0x3256('0x1e')](function(_0x511ed5){return _[_0x3256('0x112')](_0x511ed5);});}else{return!![];}})['then'](function(_0x2e4121){var _0x291151=fs[_0x3256('0xd3')](path[_0x3256('0x74')](config[_0x3256('0x78')],_0x3256('0x113')),_0x3256('0xd5'));var _0x2149a1={'remote':_0xc9a6fe[_0x3256('0x114')],'query':querystring[_0x3256('0x23')](_['merge'](_0xc9a6fe[_0x3256('0x5c')]({'plain':!![]}),{'customerIp':_0x5ba3ad[_0x3256('0xa4')][_0x3256('0xa6')]||_0x5ba3ad[_0x3256('0xa4')][_0x3256('0x115')]||_0x5ba3ad[_0x3256('0x116')][_0x3256('0x117')]||_0x5ba3ad['ip'],'referer':_0x5ba3ad['headers'][_0x3256('0xac')],'openedInteractions':_0x3567fe,'maxInteractions':_0x3b4d7f,'virtual':_0x11e641[_0x3256('0x118')],'online':_0x2e4121,'custom':_0x11e641}))[_0x3256('0x119')](/'/g,'\x5c\x27')};_0x422bc4['send'](ejs[_0x3256('0xd6')](Mustache['render'](_0x291151,_0x2149a1),{'proactiveActions':_0x2506cf,'alignment':_0xc9a6fe[_0x3256('0x11a')],'verticalAlignment':_0xc9a6fe[_0x3256('0x11b')],'div_color':_0xc9a6fe['color'],'text_color':_0xc9a6fe['textColor'],'button_color':_0xc9a6fe[_0x3256('0x11c')],'background_color':_0xc9a6fe['backgroundColor']}));})[_0x3256('0x52')](handleError(_0x422bc4,null));};exports['addApplications']=function(_0x342e26,_0x4c5e64,_0x1bc136){return db['ChatWebsite'][_0x3256('0x64')]({'where':{'id':_0x342e26['params']['id']}})[_0x3256('0x1e')](handleEntityNotFound(_0x4c5e64,null))['then'](function(_0x2e24a5){if(_0x2e24a5){return db['sequelize'][_0x3256('0x11d')](function(_0x1e4efb){return db[_0x3256('0x11e')][_0x3256('0x34')]({'where':{'ChatWebsiteId':_0x342e26[_0x3256('0x54')]['id']},'transaction':_0x1e4efb})[_0x3256('0x1e')](function(_0x446ba5){var _0x257b3f=_[_0x3256('0x3b')](_0x342e26['body'],function(_0x561d3d){_0x561d3d['ChatWebsiteId']=_0x342e26[_0x3256('0x54')]['id'];return _0x561d3d;});return db[_0x3256('0x11e')][_0x3256('0xe3')](_0x257b3f,{'transaction':_0x1e4efb});});})[_0x3256('0x1e')](function(){return db['ChatApplication'][_0x3256('0x11f')]({'where':{'ChatWebsiteId':_0x342e26[_0x3256('0x54')]['id']},'order':'priority'});});}})[_0x3256('0x1e')](respondWithResult(_0x4c5e64,null))['catch'](handleError(_0x4c5e64,null));};exports[_0x3256('0x120')]=function(_0x7ecf31,_0x3ffd9b,_0x2cbcff){var _0x3dc0d3={};var _0x58a681={};var _0x37a5e9;var _0x3870fe;return db[_0x3256('0x3c')][_0x3256('0x64')]({'where':{'id':_0x7ecf31[_0x3256('0x54')]['id']}})[_0x3256('0x1e')](handleEntityNotFound(_0x3ffd9b,null))[_0x3256('0x1e')](function(_0x37f02d){if(_0x37f02d){_0x37a5e9=_0x37f02d;_0x58a681[_0x3256('0x43')]=_[_0x3256('0x56')](db[_0x3256('0x11e')][_0x3256('0x3d')]);_0x58a681[_0x3256('0x41')]=_[_0x3256('0x56')](_0x7ecf31[_0x3256('0x41')]);_0x58a681[_0x3256('0x42')]=_[_0x3256('0x45')](_0x58a681[_0x3256('0x43')],_0x58a681['query']);_0x3dc0d3[_0x3256('0x44')]=_[_0x3256('0x45')](_0x58a681[_0x3256('0x43')],qs['fields'](_0x7ecf31[_0x3256('0x41')][_0x3256('0x46')]));_0x3dc0d3[_0x3256('0x44')]=_0x3dc0d3[_0x3256('0x44')][_0x3256('0x47')]?_0x3dc0d3['attributes']:_0x58a681[_0x3256('0x43')];_0x3dc0d3[_0x3256('0x65')]=qs[_0x3256('0x4a')](_0x7ecf31[_0x3256('0x41')][_0x3256('0x4a')]);_0x3dc0d3[_0x3256('0x4b')]=qs[_0x3256('0x42')](_[_0x3256('0x4c')](_0x7ecf31[_0x3256('0x41')],_0x58a681[_0x3256('0x42')]));if(_0x7ecf31[_0x3256('0x41')][_0x3256('0x4e')]){_0x3dc0d3[_0x3256('0x4b')]=_[_0x3256('0x4d')](_0x3dc0d3[_0x3256('0x4b')],{'$or':_[_0x3256('0x3b')](_0x3dc0d3['attributes'],function(_0x4d0f3d){var _0x3f1472={};_0x3f1472[_0x4d0f3d]={'$like':'%'+_0x7ecf31['query'][_0x3256('0x4e')]+'%'};return _0x3f1472;})});}_0x3dc0d3=_[_0x3256('0x4d')]({},_0x3dc0d3,_0x7ecf31['options']);return _0x37a5e9[_0x3256('0x120')](_0x3dc0d3);}})[_0x3256('0x1e')](function(_0x472bf9){if(_0x472bf9){_0x3870fe=_0x472bf9[_0x3256('0x47')];if(!_0x7ecf31[_0x3256('0x41')][_0x3256('0x48')]('nolimit')){_0x3dc0d3['limit']=qs[_0x3256('0x2d')](_0x7ecf31[_0x3256('0x41')][_0x3256('0x2d')]);_0x3dc0d3[_0x3256('0x2f')]=qs[_0x3256('0x2f')](_0x7ecf31[_0x3256('0x41')]['offset']);}return _0x37a5e9[_0x3256('0x120')](_0x3dc0d3);}})[_0x3256('0x1e')](function(_0x3afa09){if(_0x3afa09){return _0x3afa09?{'count':_0x3870fe,'rows':_0x3afa09}:null;}})['then'](respondWithResult(_0x3ffd9b,null))[_0x3256('0x52')](handleError(_0x3ffd9b,null));};exports[_0x3256('0x121')]=function(_0x43b2d7,_0x5632d2,_0xf3397d){return db['chatProactiveAction'][_0x3256('0x58')]({'where':{'id':_0x43b2d7[_0x3256('0x54')]['id']}})[_0x3256('0x1e')](handleEntityNotFound(_0x5632d2,null))['then'](function(_0x50ed67){if(_0x50ed67){return _0x50ed67[_0x3256('0x121')](_0x43b2d7[_0x3256('0x5a')][_0x3256('0x68')],_[_0x3256('0xf7')](_0x43b2d7[_0x3256('0x5a')],['ids','id'])||{});}})[_0x3256('0x1e')](respondWithResult(_0x5632d2,null))[_0x3256('0x52')](handleError(_0x5632d2,null));};exports[_0x3256('0x10d')]=function(_0x490ae7,_0x2db02d,_0x385fc4){var _0x5e75df={};var _0x3397e6={};var _0x4e8ab2;var _0x2ecacd;return db[_0x3256('0x3c')][_0x3256('0x64')]({'where':{'id':_0x490ae7[_0x3256('0x54')]['id']}})[_0x3256('0x1e')](handleEntityNotFound(_0x2db02d,null))[_0x3256('0x1e')](function(_0x55ef80){if(_0x55ef80){_0x4e8ab2=_0x55ef80;_0x3397e6[_0x3256('0x43')]=_['keys'](db[_0x3256('0x122')]['rawAttributes']);_0x3397e6[_0x3256('0x41')]=_[_0x3256('0x56')](_0x490ae7[_0x3256('0x41')]);_0x3397e6[_0x3256('0x42')]=_[_0x3256('0x45')](_0x3397e6['model'],_0x3397e6['query']);_0x5e75df[_0x3256('0x44')]=_[_0x3256('0x45')](_0x3397e6[_0x3256('0x43')],qs[_0x3256('0x46')](_0x490ae7[_0x3256('0x41')][_0x3256('0x46')]));_0x5e75df['attributes']=_0x5e75df[_0x3256('0x44')][_0x3256('0x47')]?_0x5e75df['attributes']:_0x3397e6[_0x3256('0x43')];_0x5e75df['order']=qs[_0x3256('0x4a')](_0x490ae7[_0x3256('0x41')][_0x3256('0x4a')]);_0x5e75df[_0x3256('0x4b')]=qs[_0x3256('0x42')](_[_0x3256('0x4c')](_0x490ae7['query'],_0x3397e6[_0x3256('0x42')]));if(_0x490ae7[_0x3256('0x41')][_0x3256('0x4e')]){_0x5e75df[_0x3256('0x4b')]=_['merge'](_0x5e75df[_0x3256('0x4b')],{'$or':_[_0x3256('0x3b')](_0x5e75df[_0x3256('0x44')],function(_0x365c36){var _0x26364e={};_0x26364e[_0x365c36]={'$like':'%'+_0x490ae7['query']['filter']+'%'};return _0x26364e;})});}_0x5e75df=_[_0x3256('0x4d')]({},_0x5e75df,_0x490ae7['options']);return _0x4e8ab2[_0x3256('0x10d')](_0x5e75df);}})['then'](function(_0x442449){if(_0x442449){_0x2ecacd=_0x442449[_0x3256('0x47')];if(!_0x490ae7[_0x3256('0x41')][_0x3256('0x48')](_0x3256('0x49'))){_0x5e75df[_0x3256('0x2d')]=qs['limit'](_0x490ae7[_0x3256('0x41')][_0x3256('0x2d')]);_0x5e75df[_0x3256('0x2f')]=qs[_0x3256('0x2f')](_0x490ae7[_0x3256('0x41')][_0x3256('0x2f')]);}return _0x4e8ab2['getProactiveActions'](_0x5e75df);}})[_0x3256('0x1e')](function(_0x5dab2b){if(_0x5dab2b){return _0x5dab2b?{'count':_0x2ecacd,'rows':_0x5dab2b}:null;}})['then'](respondWithResult(_0x2db02d,null))[_0x3256('0x52')](handleError(_0x2db02d,null));};exports[_0x3256('0x123')]=function(_0x206956,_0x5e5886,_0x5e1cca){var _0x144483=_0x206956['query'][_0x3256('0x124')]==='false'?_0x3256('0x125'):_0x3256('0x126');return db['ChatWebsite'][_0x3256('0x58')]({'attributes':['id',_0x144483],'where':{'id':_0x206956[_0x3256('0x54')]['id']}})['then'](handleEntityNotFound(_0x5e5886,null))[_0x3256('0x1e')](function(_0x8bdae4){if(_0x8bdae4){var _0x151b37=_0x8bdae4[_0x144483];var _0x4e4d0c=_0x151b37&&_0x151b37[_0x3256('0x127')]?_0x151b37[_0x3256('0x127')]:[];_0x5e5886['send']({'fromKey':_[_0x3256('0x76')](_0x151b37[_0x3256('0x128')])?undefined:_0x151b37[_0x3256('0x128')],'count':_0x4e4d0c[_0x3256('0x47')],'rows':_0x4e4d0c});}})[_0x3256('0x52')](handleError(_0x5e5886,null));};exports[_0x3256('0x129')]=function(_0x540e0c,_0x39d21c,_0x28f78c){var _0x1d2f44={'raw':![],'where':{}};var _0x51787c={};var _0x3aedce={'count':0x0,'rows':[]};return db[_0x3256('0x3c')][_0x3256('0x64')]({'where':{'id':_0x540e0c[_0x3256('0x54')]['id']}})[_0x3256('0x1e')](handleEntityNotFound(_0x39d21c,null))['then'](function(_0x43011f){if(_0x43011f){_0x51787c[_0x3256('0x43')]=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x51787c[_0x3256('0x41')]=_[_0x3256('0x56')](_0x540e0c[_0x3256('0x41')]);_0x51787c[_0x3256('0x42')]=_[_0x3256('0x45')](_0x51787c[_0x3256('0x43')],_0x51787c['query']);_0x1d2f44[_0x3256('0x44')]=_[_0x3256('0x45')](_0x51787c['model'],qs[_0x3256('0x46')](_0x540e0c[_0x3256('0x41')][_0x3256('0x46')]));_0x1d2f44[_0x3256('0x44')]=_0x1d2f44[_0x3256('0x44')][_0x3256('0x47')]?_0x1d2f44[_0x3256('0x44')]:_0x51787c[_0x3256('0x43')];if(!_0x540e0c[_0x3256('0x41')][_0x3256('0x48')](_0x3256('0x49'))){_0x1d2f44['limit']=qs[_0x3256('0x2d')](_0x540e0c[_0x3256('0x41')][_0x3256('0x2d')]);_0x1d2f44[_0x3256('0x2f')]=qs[_0x3256('0x2f')](_0x540e0c['query']['offset']);}_0x1d2f44[_0x3256('0x65')]=qs['sort'](_0x540e0c[_0x3256('0x41')][_0x3256('0x4a')]);_0x1d2f44[_0x3256('0x4b')]=qs[_0x3256('0x42')](_[_0x3256('0x4c')](_0x540e0c[_0x3256('0x41')],_0x51787c[_0x3256('0x42')]));_0x1d2f44[_0x3256('0x4b')]['ChatWebsiteId']=_0x43011f['id'];if(_0x540e0c[_0x3256('0x41')][_0x3256('0x4e')]){_0x1d2f44[_0x3256('0x4b')]=_[_0x3256('0x4d')](_0x1d2f44['where'],{'$or':_[_0x3256('0x3b')](_0x1d2f44[_0x3256('0x44')],function(_0x538960){var _0x3fc4d3={};_0x3fc4d3[_0x538960]={'$like':'%'+_0x540e0c[_0x3256('0x41')]['filter']+'%'};return _0x3fc4d3;})});}_0x1d2f44=_[_0x3256('0x4d')]({},_0x1d2f44,_0x540e0c[_0x3256('0x66')]);return db['ChatOfflineMessage'][_0x3256('0x2e')]({'where':_0x1d2f44['where']})['then'](function(_0x136421){_0x3aedce[_0x3256('0x2e')]=_0x136421;if(_0x540e0c[_0x3256('0x41')][_0x3256('0x57')]){_0x1d2f44[_0x3256('0x4f')]=[{'all':!![]}];}else{_0x1d2f44[_0x3256('0x4f')]=[{'model':db[_0x3256('0xa2')],'as':_0x3256('0xf9'),'required':![]},{'model':db[_0x3256('0xe2')],'as':_0x3256('0x12a'),'required':![]}];}return db[_0x3256('0xd9')][_0x3256('0x50')](_0x1d2f44);})[_0x3256('0x1e')](function(_0xa8cdef){_0x3aedce[_0x3256('0x51')]=_0xa8cdef;return _0x3aedce;});}})[_0x3256('0x1e')](respondWithFilteredResult(_0x39d21c,_0x1d2f44))[_0x3256('0x52')](handleError(_0x39d21c,null));};exports[_0x3256('0x12b')]=function(_0x5e6ce7,_0x554254,_0x100035){return db[_0x3256('0x3c')][_0x3256('0x58')]({'where':{'id':_0x5e6ce7[_0x3256('0x54')]['id']}})[_0x3256('0x1e')](handleEntityNotFound(_0x554254,null))[_0x3256('0x1e')](function(_0x3a72c4){if(_0x3a72c4){return _0x3a72c4[_0x3256('0x12b')](_0x5e6ce7[_0x3256('0x5a')][_0x3256('0x68')],_[_0x3256('0xf7')](_0x5e6ce7[_0x3256('0x5a')],[_0x3256('0x68'),'id'])||{})[_0x3256('0xb9')](function(_0x1bb4b6){for(var _0x16c5c7=0x0;_0x16c5c7<_0x5e6ce7[_0x3256('0x5a')][_0x3256('0x68')][_0x3256('0x47')];_0x16c5c7+=0x1){socket[_0x3256('0x12c')](_0x3256('0x12d'),{'UserId':Number(_0x5e6ce7[_0x3256('0x5a')][_0x3256('0x68')][_0x16c5c7]),'ChatWebsiteId':Number(_0x5e6ce7[_0x3256('0x54')]['id'])});}return _0x1bb4b6;});}})['then'](respondWithResult(_0x554254,null))[_0x3256('0x52')](handleError(_0x554254,null));};exports[_0x3256('0x12e')]=function(_0x1573ba,_0x3e0e13,_0x428ba3){return db[_0x3256('0x3c')][_0x3256('0x58')]({'where':{'id':_0x1573ba[_0x3256('0x54')]['id']}})['then'](handleEntityNotFound(_0x3e0e13,null))[_0x3256('0x1e')](function(_0x52fe2a){if(_0x52fe2a){return _0x52fe2a[_0x3256('0x12e')](_0x1573ba[_0x3256('0x41')][_0x3256('0x68')])[_0x3256('0x1e')](function(){if(_['isArray'](_0x1573ba[_0x3256('0x41')]['ids'])){for(var _0x1b0a6b=0x0;_0x1b0a6b<_0x1573ba[_0x3256('0x41')][_0x3256('0x68')]['length'];_0x1b0a6b+=0x1){socket['emit'](_0x3256('0x12f'),{'UserId':Number(_0x1573ba[_0x3256('0x41')][_0x3256('0x68')][_0x1b0a6b]),'ChatWebsiteId':Number(_0x1573ba[_0x3256('0x54')]['id'])});}}else{socket[_0x3256('0x12c')](_0x3256('0x12f'),{'UserId':Number(_0x1573ba[_0x3256('0x41')]['ids']),'ChatWebsiteId':Number(_0x1573ba[_0x3256('0x54')]['id'])});}});}})[_0x3256('0x1e')](respondWithStatusCode(_0x3e0e13,null))['catch'](handleError(_0x3e0e13,null));};exports[_0x3256('0x130')]=function(_0xf66eac,_0x156cf8,_0x4aaa99){var _0x262dae={};var _0x4e20c0={};var _0x4c4305;var _0x5c5216;return db['ChatWebsite']['findOne']({'where':{'id':_0xf66eac[_0x3256('0x54')]['id']}})[_0x3256('0x1e')](handleEntityNotFound(_0x156cf8,null))['then'](function(_0x48c9d8){if(_0x48c9d8){_0x4c4305=_0x48c9d8;_0x4e20c0[_0x3256('0x43')]=_[_0x3256('0x56')](db['User'][_0x3256('0x3d')]);_0x4e20c0['query']=_['keys'](_0xf66eac[_0x3256('0x41')]);_0x4e20c0[_0x3256('0x42')]=_[_0x3256('0x45')](_0x4e20c0[_0x3256('0x43')],_0x4e20c0[_0x3256('0x41')]);_0x262dae['attributes']=_[_0x3256('0x45')](_0x4e20c0[_0x3256('0x43')],qs[_0x3256('0x46')](_0xf66eac[_0x3256('0x41')][_0x3256('0x46')]));_0x262dae['attributes']=_0x262dae[_0x3256('0x44')]['length']?_0x262dae[_0x3256('0x44')]:_0x4e20c0[_0x3256('0x43')];_0x262dae[_0x3256('0x65')]=qs[_0x3256('0x4a')](_0xf66eac[_0x3256('0x41')][_0x3256('0x4a')]);_0x262dae[_0x3256('0x4b')]=qs[_0x3256('0x42')](_[_0x3256('0x4c')](_0xf66eac[_0x3256('0x41')],_0x4e20c0[_0x3256('0x42')]));if(_0xf66eac[_0x3256('0x41')][_0x3256('0x4e')]){_0x262dae['where']=_[_0x3256('0x4d')](_0x262dae[_0x3256('0x4b')],{'$or':_[_0x3256('0x3b')](_0x262dae[_0x3256('0x44')],function(_0x5576c5){var _0x47f7b0={};_0x47f7b0[_0x5576c5]={'$like':'%'+_0xf66eac['query']['filter']+'%'};return _0x47f7b0;})});}_0x262dae=_[_0x3256('0x4d')]({},_0x262dae,_0xf66eac[_0x3256('0x66')]);return _0x4c4305[_0x3256('0x130')](_0x262dae);}})[_0x3256('0x1e')](function(_0x33073e){if(_0x33073e){_0x5c5216=_0x33073e[_0x3256('0x47')];if(!_0xf66eac[_0x3256('0x41')][_0x3256('0x48')](_0x3256('0x49'))){_0x262dae[_0x3256('0x2d')]=qs[_0x3256('0x2d')](_0xf66eac[_0x3256('0x41')][_0x3256('0x2d')]);_0x262dae['offset']=qs[_0x3256('0x2f')](_0xf66eac[_0x3256('0x41')]['offset']);}return _0x4c4305[_0x3256('0x130')](_0x262dae);}})['then'](function(_0x8332df){if(_0x8332df){return _0x8332df?{'count':_0x5c5216,'rows':_0x8332df}:null;}})[_0x3256('0x1e')](respondWithResult(_0x156cf8,null))['catch'](handleError(_0x156cf8,null));}; \ No newline at end of file +var _0xbdf1=['%s\x20%s','version','device','vendor','format','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','lastName','messageId','created','close','unmanaged','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','offline','files','no\x20available\x20attributes','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','spread','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','server','attachments','offline-chat','openNewInteraction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','port','secure','authentication','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','mimetype','subjectOffline','toPairsIn','mapValues','MailAccountId','NotifyMailAccount','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','Tag','Tags','color','tag','Command','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','timezone','No\x20timezone','inspect','getSnippet','Interval','getProactiveActions','virtual','increment','Intervals','push','all','some','readFileSync','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','referer','alignment','verticalAlignment','textColor','backgroundColor','addApplications','sequelize','transaction','ChatApplication','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','online','false','offlineForm','onlineForm','items','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','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/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','jayson/promise','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','end','offset','undefined','count','limit','set','json','apply','reject','save','get','ChatWebsites','UserProfileResource','destroy','status','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','type','key','keys','query','filters','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','attributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','Disposition','getDispositions','findOne','rawAttributes','ChatWebsiteId','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','setUA','getResult','chat','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','Applications','account','list','orderBy','applications','priority','asc','ListId','contact','customerIp','cf-connecting-ip','headers','x-forwarded-for','first','split','firstName','x-real-port','browser','unknown'];(function(_0x29cd6a,_0x409b11){var _0x545b22=function(_0x2ef6eb){while(--_0x2ef6eb){_0x29cd6a['push'](_0x29cd6a['shift']());}};_0x545b22(++_0x409b11);}(_0xbdf1,0x86));var _0x1bdf=function(_0x46f016,_0x1821f3){_0x46f016=_0x46f016-0x0;var _0x482fe1=_0xbdf1[_0x46f016];return _0x482fe1;};'use strict';var emlformat=require(_0x1bdf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1bdf('0x1'));var jsonpatch=require(_0x1bdf('0x2'));var rp=require(_0x1bdf('0x3'));var moment=require(_0x1bdf('0x4'));var BPromise=require(_0x1bdf('0x5'));var Mustache=require(_0x1bdf('0x6'));var util=require(_0x1bdf('0x7'));var path=require('path');var sox=require(_0x1bdf('0x8'));var csv=require(_0x1bdf('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1bdf('0xa'));var _=require(_0x1bdf('0xb'));var squel=require(_0x1bdf('0xc'));var crypto=require(_0x1bdf('0xd'));var jsforce=require(_0x1bdf('0xe'));var deskjs=require(_0x1bdf('0xf'));var toCsv=require(_0x1bdf('0x9'));var querystring=require('querystring');var Papa=require(_0x1bdf('0x10'));var Redis=require(_0x1bdf('0x11'));var authService=require(_0x1bdf('0x12'));var qs=require(_0x1bdf('0x13'));var as=require(_0x1bdf('0x14'));var hardwareService=require(_0x1bdf('0x15'));var logger=require(_0x1bdf('0x16'))(_0x1bdf('0x17'));var utils=require('../../config/utils');var config=require(_0x1bdf('0x18'));var licenseUtil=require(_0x1bdf('0x19'));var db=require(_0x1bdf('0x1a'))['db'];config[_0x1bdf('0x1b')]=_[_0x1bdf('0x1c')](config[_0x1bdf('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x1bdf('0x1d'))(new Redis(config['redis']));require(_0x1bdf('0x1e'))['register'](socket);var jayson=require(_0x1bdf('0x1f'));var client=jayson[_0x1bdf('0x20')][_0x1bdf('0x21')]({'port':0x232c});var client9002=jayson[_0x1bdf('0x20')][_0x1bdf('0x21')]({'port':0x232a});var client9003=jayson[_0x1bdf('0x20')][_0x1bdf('0x21')]({'port':0x232b});var client9001=jayson['client'][_0x1bdf('0x21')]({'port':0x2329});function respondWithRpcPromise(_0x3b2cf2,_0x54a504,_0x25d7dc,_0x2c22f8){return new BPromise(function(_0x4fe0c9,_0x2d7d6f){var _0xbd7108=_0x2c22f8||client;return _0xbd7108[_0x1bdf('0x22')](_0x3b2cf2,_0x25d7dc)[_0x1bdf('0x23')](function(_0x291680){logger['info'](_0x1bdf('0x24'),_0x54a504,_0x1bdf('0x25'));logger[_0x1bdf('0x26')](_0x1bdf('0x27'),_0x54a504,_0x1bdf('0x25'),JSON['stringify'](_0x291680));if(_0x291680['error']){if(_0x291680['error'][_0x1bdf('0x28')]===0x1f4){logger['error'](_0x1bdf('0x24'),_0x54a504,_0x291680[_0x1bdf('0x29')][_0x1bdf('0x2a')]);return _0x2d7d6f(_0x291680[_0x1bdf('0x29')][_0x1bdf('0x2a')]);}logger[_0x1bdf('0x29')](_0x1bdf('0x24'),_0x54a504,_0x291680[_0x1bdf('0x29')][_0x1bdf('0x2a')]);return _0x4fe0c9(_0x291680[_0x1bdf('0x29')][_0x1bdf('0x2a')]);}else{logger[_0x1bdf('0x2b')](_0x1bdf('0x24'),_0x54a504,'request\x20sent');_0x4fe0c9(_0x291680[_0x1bdf('0x2c')][_0x1bdf('0x2a')]);}})[_0x1bdf('0x2d')](function(_0x392344){logger[_0x1bdf('0x29')]('ChatWebsite,\x20%s,\x20%s',_0x54a504,_0x392344);_0x2d7d6f(_0x392344);});});}function respondWithStatusCode(_0x37a83b,_0xece76d){_0xece76d=_0xece76d||0xcc;return function(_0x330451){if(_0x330451){return _0x37a83b['sendStatus'](_0xece76d);}return _0x37a83b['status'](_0xece76d)[_0x1bdf('0x2e')]();};}function respondWithResult(_0x481237,_0x4160be){_0x4160be=_0x4160be||0xc8;return function(_0x54efad){if(_0x54efad){return _0x481237['status'](_0x4160be)['json'](_0x54efad);}};}function respondWithFilteredResult(_0x55b021,_0x3cd522){return function(_0x47473a){if(_0x47473a){var _0x10a8aa=typeof _0x3cd522[_0x1bdf('0x2f')]==='undefined'&&typeof _0x3cd522['limit']===_0x1bdf('0x30');var _0x2dec06=_0x47473a['count'];var _0x126f03=_0x10a8aa?0x0:_0x3cd522[_0x1bdf('0x2f')];var _0x1f49af=_0x10a8aa?_0x47473a[_0x1bdf('0x31')]:_0x3cd522['offset']+_0x3cd522[_0x1bdf('0x32')];var _0x5303b9;if(_0x1f49af>=_0x2dec06){_0x1f49af=_0x2dec06;_0x5303b9=0xc8;}else{_0x5303b9=0xce;}_0x55b021['status'](_0x5303b9);return _0x55b021[_0x1bdf('0x33')]('Content-Range',_0x126f03+'-'+_0x1f49af+'/'+_0x2dec06)[_0x1bdf('0x34')](_0x47473a);}return null;};}function patchUpdates(_0x148946){return function(_0x25e054){try{jsonpatch[_0x1bdf('0x35')](_0x25e054,_0x148946,!![]);}catch(_0x1f026b){return BPromise[_0x1bdf('0x36')](_0x1f026b);}return _0x25e054[_0x1bdf('0x37')]();};}function saveUpdates(_0x3686d4,_0x53128c){return function(_0x21dda2){if(_0x21dda2){return _0x21dda2['update'](_0x3686d4)[_0x1bdf('0x23')](function(_0x28fe43){return _0x28fe43;});}return null;};}function removeEntity(_0xe30619,_0x5583db){return function(_0x939bbf){if(_0x939bbf){return _0x939bbf['destroy']()[_0x1bdf('0x23')](function(){var _0x331e01=_0x939bbf[_0x1bdf('0x38')]({'plain':!![]});var _0x1ab629=_0x1bdf('0x39');return db[_0x1bdf('0x3a')][_0x1bdf('0x3b')]({'where':{'type':_0x1ab629,'resourceId':_0x331e01['id']}})['then'](function(){return _0x939bbf;});})[_0x1bdf('0x23')](function(){_0xe30619[_0x1bdf('0x3c')](0xcc)[_0x1bdf('0x2e')]();});}};}function handleEntityNotFound(_0xd11000,_0x127f53){return function(_0x2230f6){if(!_0x2230f6){_0xd11000[_0x1bdf('0x3d')](0x194);}return _0x2230f6;};}function handleError(_0x14fce0,_0x1fa2a5){_0x1fa2a5=_0x1fa2a5||0x1f4;return function(_0x299c32){logger['error'](_0x299c32[_0x1bdf('0x3e')]);if(_0x299c32[_0x1bdf('0x3f')]){delete _0x299c32[_0x1bdf('0x3f')];}_0x14fce0[_0x1bdf('0x3c')](_0x1fa2a5)[_0x1bdf('0x40')](_0x299c32);};}exports[_0x1bdf('0x41')]=function(_0xb8088a,_0x3d5f8f){var _0x5d8521={'include':[{'model':db[_0x1bdf('0x42')],'as':_0x1bdf('0x43')}]},_0x12dc9f={},_0x2432ca={'count':0x0,'rows':[]};var _0x4a78ab=_[_0x1bdf('0x44')](db[_0x1bdf('0x45')]['rawAttributes'],function(_0x245fff){return{'name':_0x245fff['fieldName'],'type':_0x245fff[_0x1bdf('0x46')][_0x1bdf('0x47')]};});_0x12dc9f['model']=_[_0x1bdf('0x44')](_0x4a78ab,_0x1bdf('0x3f'));_0x12dc9f['query']=_[_0x1bdf('0x48')](_0xb8088a[_0x1bdf('0x49')]);_0x12dc9f[_0x1bdf('0x4a')]=_[_0x1bdf('0x4b')](_0x12dc9f[_0x1bdf('0x4c')],_0x12dc9f[_0x1bdf('0x49')]);_0x5d8521['attributes']=_[_0x1bdf('0x4b')](_0x12dc9f[_0x1bdf('0x4c')],qs['fields'](_0xb8088a[_0x1bdf('0x49')][_0x1bdf('0x4d')]));_0x5d8521['attributes']=_0x5d8521['attributes'][_0x1bdf('0x4e')]?_0x5d8521['attributes']:_0x12dc9f[_0x1bdf('0x4c')];if(!_0xb8088a[_0x1bdf('0x49')][_0x1bdf('0x4f')](_0x1bdf('0x50'))){_0x5d8521[_0x1bdf('0x32')]=qs[_0x1bdf('0x32')](_0xb8088a[_0x1bdf('0x49')][_0x1bdf('0x32')]);_0x5d8521[_0x1bdf('0x2f')]=qs[_0x1bdf('0x2f')](_0xb8088a[_0x1bdf('0x49')]['offset']);}_0x5d8521[_0x1bdf('0x51')]=qs[_0x1bdf('0x52')](_0xb8088a[_0x1bdf('0x49')]['sort']);_0x5d8521['where']=qs['filters'](_[_0x1bdf('0x53')](_0xb8088a[_0x1bdf('0x49')],_0x12dc9f[_0x1bdf('0x4a')]),_0x4a78ab);if(_0xb8088a['query'][_0x1bdf('0x54')]){_0x5d8521[_0x1bdf('0x55')]=_[_0x1bdf('0x56')](_0x5d8521[_0x1bdf('0x55')],{'$or':_[_0x1bdf('0x44')](_0x4a78ab,function(_0x4bf936){if(_0x4bf936[_0x1bdf('0x46')]!==_0x1bdf('0x57')){var _0xcbd33f={};_0xcbd33f[_0x4bf936['name']]={'$like':'%'+_0xb8088a[_0x1bdf('0x49')]['filter']+'%'};return _0xcbd33f;}})});}_0x5d8521=_[_0x1bdf('0x56')]({},_0x5d8521,_0xb8088a[_0x1bdf('0x58')]);var _0x3df760={'where':_0x5d8521['where']};return db[_0x1bdf('0x45')][_0x1bdf('0x31')](_0x3df760)[_0x1bdf('0x23')](function(_0x5350d0){_0x2432ca[_0x1bdf('0x31')]=_0x5350d0;if(_0xb8088a[_0x1bdf('0x49')][_0x1bdf('0x59')]){_0x5d8521[_0x1bdf('0x5a')]=[{'all':!![]}];}return db[_0x1bdf('0x45')][_0x1bdf('0x5b')](_0x5d8521);})[_0x1bdf('0x23')](function(_0x282335){_0x2432ca[_0x1bdf('0x5c')]=_0x282335;return _0x2432ca;})['then'](respondWithFilteredResult(_0x3d5f8f,_0x5d8521))['catch'](handleError(_0x3d5f8f,null));};exports[_0x1bdf('0x5d')]=function(_0x471fa7,_0x24d199){var _0x180043={'raw':![],'where':{'id':_0x471fa7[_0x1bdf('0x5e')]['id']},'include':[{'model':db[_0x1bdf('0x42')],'as':_0x1bdf('0x43')}]},_0x4b6ad0={};_0x4b6ad0[_0x1bdf('0x4c')]=_[_0x1bdf('0x48')](db[_0x1bdf('0x45')]['rawAttributes']);_0x4b6ad0[_0x1bdf('0x49')]=_['keys'](_0x471fa7[_0x1bdf('0x49')]);_0x4b6ad0[_0x1bdf('0x4a')]=_[_0x1bdf('0x4b')](_0x4b6ad0[_0x1bdf('0x4c')],_0x4b6ad0['query']);_0x180043['attributes']=_[_0x1bdf('0x4b')](_0x4b6ad0[_0x1bdf('0x4c')],qs[_0x1bdf('0x4d')](_0x471fa7[_0x1bdf('0x49')][_0x1bdf('0x4d')]));_0x180043[_0x1bdf('0x5f')]=_0x180043[_0x1bdf('0x5f')][_0x1bdf('0x4e')]?_0x180043[_0x1bdf('0x5f')]:_0x4b6ad0['model'];if(_0x471fa7[_0x1bdf('0x49')][_0x1bdf('0x59')]){_0x180043[_0x1bdf('0x5a')]=[{'all':!![]}];}_0x180043=_[_0x1bdf('0x56')]({},_0x180043,_0x471fa7[_0x1bdf('0x58')]);return db[_0x1bdf('0x45')][_0x1bdf('0x60')](_0x180043)[_0x1bdf('0x23')](handleEntityNotFound(_0x24d199,null))[_0x1bdf('0x23')](respondWithResult(_0x24d199,null))[_0x1bdf('0x2d')](handleError(_0x24d199,null));};exports[_0x1bdf('0x61')]=function(_0x4d079f,_0x413e48){return db[_0x1bdf('0x45')]['create'](_0x4d079f[_0x1bdf('0x62')],{})[_0x1bdf('0x23')](function(_0x4f45d3){var _0x1d8c05=_0x4d079f[_0x1bdf('0x63')][_0x1bdf('0x38')]({'plain':!![]});if(!_0x1d8c05)throw new Error(_0x1bdf('0x64'));if(_0x1d8c05[_0x1bdf('0x65')]===_0x1bdf('0x63')){var _0xf65c88=_0x4f45d3[_0x1bdf('0x38')]({'plain':!![]});var _0x3c7b60=_0x1bdf('0x39');return db[_0x1bdf('0x66')][_0x1bdf('0x60')]({'where':{'name':_0x3c7b60,'userProfileId':_0x1d8c05[_0x1bdf('0x67')]},'raw':!![]})[_0x1bdf('0x23')](function(_0x3361a8){if(_0x3361a8&&_0x3361a8['autoAssociation']===0x0){return db[_0x1bdf('0x3a')]['create']({'name':_0xf65c88[_0x1bdf('0x3f')],'resourceId':_0xf65c88['id'],'type':_0x3361a8['name'],'sectionId':_0x3361a8['id']},{})[_0x1bdf('0x23')](function(){return _0x4f45d3;});}else{return _0x4f45d3;}})[_0x1bdf('0x2d')](function(_0x308be1){logger[_0x1bdf('0x29')](_0x1bdf('0x68'),_0x308be1);throw _0x308be1;});}return _0x4f45d3;})[_0x1bdf('0x23')](respondWithResult(_0x413e48,0xc9))['catch'](handleError(_0x413e48,null));};exports[_0x1bdf('0x69')]=function(_0x2569e9,_0x10356d){if(_0x2569e9[_0x1bdf('0x62')]['id']){delete _0x2569e9[_0x1bdf('0x62')]['id'];}return db[_0x1bdf('0x45')][_0x1bdf('0x60')]({'where':{'id':_0x2569e9[_0x1bdf('0x5e')]['id']},'include':[{'model':db[_0x1bdf('0x42')],'as':'mandatoryDispositionPause'}]})[_0x1bdf('0x23')](handleEntityNotFound(_0x10356d,null))['then'](saveUpdates(_0x2569e9[_0x1bdf('0x62')],null))['then'](respondWithResult(_0x10356d,null))['catch'](handleError(_0x10356d,null));};exports['destroy']=function(_0x321922,_0x13ce65){return db['ChatWebsite'][_0x1bdf('0x60')]({'where':{'id':_0x321922[_0x1bdf('0x5e')]['id']}})['then'](handleEntityNotFound(_0x13ce65,null))[_0x1bdf('0x23')](removeEntity(_0x13ce65,null))[_0x1bdf('0x2d')](handleError(_0x13ce65,null));};exports[_0x1bdf('0x6a')]=function(_0xdab918,_0x5b127b){return db[_0x1bdf('0x45')][_0x1bdf('0x6a')]()[_0x1bdf('0x23')](respondWithResult(_0x5b127b,null))['catch'](handleError(_0x5b127b,null));};exports[_0x1bdf('0x6b')]=function(_0xbb91bf,_0x49ef01,_0x267604){if(_0xbb91bf[_0x1bdf('0x62')]['id']){delete _0xbb91bf[_0x1bdf('0x62')]['id'];}return db[_0x1bdf('0x45')][_0x1bdf('0x60')]({'where':{'id':_0xbb91bf[_0x1bdf('0x5e')]['id']}})['then'](handleEntityNotFound(_0x49ef01,null))[_0x1bdf('0x23')](function(_0x2631b4){if(_0x2631b4){_0xbb91bf[_0x1bdf('0x62')]['ChatWebsiteId']=_0x2631b4['id'];return db[_0x1bdf('0x6c')]['create'](_0xbb91bf[_0x1bdf('0x62')]);}})[_0x1bdf('0x23')](respondWithResult(_0x49ef01,null))[_0x1bdf('0x2d')](handleError(_0x49ef01,null));};exports[_0x1bdf('0x6d')]=function(_0x43b1dd,_0x4209b6,_0x1d43c4){var _0x404434={'raw':![],'where':{}};var _0xf0fb50={};var _0xb67c1={'count':0x0,'rows':[]};return db[_0x1bdf('0x45')][_0x1bdf('0x6e')]({'where':{'id':_0x43b1dd[_0x1bdf('0x5e')]['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x4209b6,null))[_0x1bdf('0x23')](function(_0x13f653){if(_0x13f653){_0xf0fb50['model']=_[_0x1bdf('0x48')](db[_0x1bdf('0x6c')][_0x1bdf('0x6f')]);_0xf0fb50[_0x1bdf('0x49')]=_['keys'](_0x43b1dd[_0x1bdf('0x49')]);_0xf0fb50['filters']=_['intersection'](_0xf0fb50['model'],_0xf0fb50[_0x1bdf('0x49')]);_0x404434['attributes']=_['intersection'](_0xf0fb50[_0x1bdf('0x4c')],qs[_0x1bdf('0x4d')](_0x43b1dd[_0x1bdf('0x49')][_0x1bdf('0x4d')]));_0x404434[_0x1bdf('0x5f')]=_0x404434[_0x1bdf('0x5f')][_0x1bdf('0x4e')]?_0x404434['attributes']:_0xf0fb50[_0x1bdf('0x4c')];if(!_0x43b1dd[_0x1bdf('0x49')]['hasOwnProperty'](_0x1bdf('0x50'))){_0x404434['limit']=qs[_0x1bdf('0x32')](_0x43b1dd[_0x1bdf('0x49')][_0x1bdf('0x32')]);_0x404434[_0x1bdf('0x2f')]=qs[_0x1bdf('0x2f')](_0x43b1dd['query'][_0x1bdf('0x2f')]);}_0x404434[_0x1bdf('0x51')]=qs[_0x1bdf('0x52')](_0x43b1dd['query'][_0x1bdf('0x52')]);_0x404434[_0x1bdf('0x55')]=qs[_0x1bdf('0x4a')](_[_0x1bdf('0x53')](_0x43b1dd[_0x1bdf('0x49')],_0xf0fb50[_0x1bdf('0x4a')]));_0x404434[_0x1bdf('0x55')][_0x1bdf('0x70')]=_0x13f653['id'];if(_0x43b1dd['query'][_0x1bdf('0x54')]){_0x404434[_0x1bdf('0x55')]=_['merge'](_0x404434[_0x1bdf('0x55')],{'$or':_[_0x1bdf('0x44')](_0x404434[_0x1bdf('0x5f')],function(_0x594792){var _0x25c10f={};_0x25c10f[_0x594792]={'$like':'%'+_0x43b1dd[_0x1bdf('0x49')][_0x1bdf('0x54')]+'%'};return _0x25c10f;})});}_0x404434=_[_0x1bdf('0x56')]({},_0x404434,_0x43b1dd['options']);return db[_0x1bdf('0x6c')]['count']({'where':_0x404434[_0x1bdf('0x55')]})[_0x1bdf('0x23')](function(_0x3d3ff0){_0xb67c1['count']=_0x3d3ff0;if(_0x43b1dd[_0x1bdf('0x49')]['includeAll']){_0x404434[_0x1bdf('0x5a')]=[{'all':!![]}];}return db['Disposition'][_0x1bdf('0x5b')](_0x404434);})['then'](function(_0x4f142a){_0xb67c1[_0x1bdf('0x5c')]=_0x4f142a;return _0xb67c1;});}})[_0x1bdf('0x23')](respondWithFilteredResult(_0x4209b6,_0x404434))[_0x1bdf('0x2d')](handleError(_0x4209b6,null));};exports[_0x1bdf('0x71')]=function(_0x123c6d,_0x56f61c,_0x3d023d){return db[_0x1bdf('0x45')][_0x1bdf('0x60')]({'where':{'id':_0x123c6d[_0x1bdf('0x5e')]['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x56f61c,null))['then'](function(_0x26c021){if(_0x26c021){return _0x26c021[_0x1bdf('0x71')](_0x123c6d[_0x1bdf('0x49')][_0x1bdf('0x72')]);}})[_0x1bdf('0x23')](respondWithStatusCode(_0x56f61c,null))[_0x1bdf('0x2d')](handleError(_0x56f61c,null));};exports[_0x1bdf('0x73')]=function(_0x239762,_0x21fe36,_0x5997db){if(_0x239762[_0x1bdf('0x62')]['id']){delete _0x239762[_0x1bdf('0x62')]['id'];}return db[_0x1bdf('0x45')][_0x1bdf('0x60')]({'where':{'id':_0x239762[_0x1bdf('0x5e')]['id']}})['then'](handleEntityNotFound(_0x21fe36,null))[_0x1bdf('0x23')](function(_0x43fba){if(_0x43fba){_0x239762[_0x1bdf('0x62')][_0x1bdf('0x70')]=_0x43fba['id'];return db['CannedAnswer'][_0x1bdf('0x61')](_0x239762[_0x1bdf('0x62')]);}})[_0x1bdf('0x23')](respondWithResult(_0x21fe36,null))[_0x1bdf('0x2d')](handleError(_0x21fe36,null));};exports[_0x1bdf('0x74')]=function(_0x2cc47d,_0x4b4b3a,_0x49f21f){var _0x55410c={'raw':![],'where':{}};var _0x17daf8={};var _0x44b241={'count':0x0,'rows':[]};return db[_0x1bdf('0x45')][_0x1bdf('0x6e')]({'where':{'id':_0x2cc47d[_0x1bdf('0x5e')]['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x4b4b3a,null))['then'](function(_0x54c7f6){if(_0x54c7f6){_0x17daf8[_0x1bdf('0x4c')]=_[_0x1bdf('0x48')](db[_0x1bdf('0x75')][_0x1bdf('0x6f')]);_0x17daf8[_0x1bdf('0x49')]=_[_0x1bdf('0x48')](_0x2cc47d[_0x1bdf('0x49')]);_0x17daf8[_0x1bdf('0x4a')]=_['intersection'](_0x17daf8['model'],_0x17daf8[_0x1bdf('0x49')]);_0x55410c[_0x1bdf('0x5f')]=_[_0x1bdf('0x4b')](_0x17daf8['model'],qs['fields'](_0x2cc47d['query']['fields']));_0x55410c['attributes']=_0x55410c['attributes'][_0x1bdf('0x4e')]?_0x55410c['attributes']:_0x17daf8['model'];if(!_0x2cc47d[_0x1bdf('0x49')]['hasOwnProperty'](_0x1bdf('0x50'))){_0x55410c['limit']=qs[_0x1bdf('0x32')](_0x2cc47d[_0x1bdf('0x49')][_0x1bdf('0x32')]);_0x55410c['offset']=qs[_0x1bdf('0x2f')](_0x2cc47d['query']['offset']);}_0x55410c['order']=qs[_0x1bdf('0x52')](_0x2cc47d[_0x1bdf('0x49')][_0x1bdf('0x52')]);_0x55410c[_0x1bdf('0x55')]=qs[_0x1bdf('0x4a')](_['pick'](_0x2cc47d['query'],_0x17daf8[_0x1bdf('0x4a')]));_0x55410c['where'][_0x1bdf('0x70')]=_0x54c7f6['id'];if(_0x2cc47d[_0x1bdf('0x49')]['filter']){_0x55410c[_0x1bdf('0x55')]=_[_0x1bdf('0x56')](_0x55410c[_0x1bdf('0x55')],{'$or':_[_0x1bdf('0x44')](_0x55410c[_0x1bdf('0x5f')],function(_0x6c4f71){var _0x3ce07f={};_0x3ce07f[_0x6c4f71]={'$like':'%'+_0x2cc47d[_0x1bdf('0x49')][_0x1bdf('0x54')]+'%'};return _0x3ce07f;})});}_0x55410c=_[_0x1bdf('0x56')]({},_0x55410c,_0x2cc47d[_0x1bdf('0x58')]);return db['CannedAnswer']['count']({'where':_0x55410c[_0x1bdf('0x55')]})['then'](function(_0x9bf6f9){_0x44b241['count']=_0x9bf6f9;if(_0x2cc47d[_0x1bdf('0x49')][_0x1bdf('0x59')]){_0x55410c[_0x1bdf('0x5a')]=[{'all':!![]}];}return db[_0x1bdf('0x75')][_0x1bdf('0x5b')](_0x55410c);})[_0x1bdf('0x23')](function(_0x242134){_0x44b241['rows']=_0x242134;return _0x44b241;});}})[_0x1bdf('0x23')](respondWithFilteredResult(_0x4b4b3a,_0x55410c))[_0x1bdf('0x2d')](handleError(_0x4b4b3a,null));};exports[_0x1bdf('0x76')]=function(_0x2eff17,_0x3c38a2,_0x2db6b9){return db[_0x1bdf('0x45')][_0x1bdf('0x60')]({'where':{'id':_0x2eff17[_0x1bdf('0x5e')]['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x3c38a2,null))[_0x1bdf('0x23')](function(_0x143b11){if(_0x143b11){return _0x143b11['removeAnswers'](_0x2eff17[_0x1bdf('0x49')][_0x1bdf('0x72')]);}})['then'](respondWithStatusCode(_0x3c38a2,null))['catch'](handleError(_0x3c38a2,null));};exports[_0x1bdf('0x77')]=function(_0x1370c5,_0x4d34f6,_0x3fbaa3){_0x1370c5['body'][_0x1bdf('0x78')]=_0x1370c5[_0x1bdf('0x79')][_0x1bdf('0x7a')];return db['ChatWebsite'][_0x1bdf('0x60')]({'where':{'id':_0x1370c5[_0x1bdf('0x5e')]['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x4d34f6,null))[_0x1bdf('0x23')](saveUpdates(_0x1370c5[_0x1bdf('0x62')],null))[_0x1bdf('0x23')](respondWithResult(_0x4d34f6,null))['catch'](handleError(_0x4d34f6,null));};exports[_0x1bdf('0x7b')]=function(_0x397d4c,_0x5b7629,_0x22c91d){_0x397d4c[_0x1bdf('0x62')][_0x1bdf('0x7c')]=_0x397d4c[_0x1bdf('0x79')]['filename'];return db[_0x1bdf('0x45')][_0x1bdf('0x60')]({'where':{'id':_0x397d4c[_0x1bdf('0x5e')]['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x5b7629,null))['then'](saveUpdates(_0x397d4c[_0x1bdf('0x62')],null))[_0x1bdf('0x23')](respondWithResult(_0x5b7629,null))[_0x1bdf('0x2d')](handleError(_0x5b7629,null));};exports[_0x1bdf('0x7d')]=function(_0x48337e,_0x3c5ec4,_0x266fee){_0x48337e[_0x1bdf('0x62')]['customerAvatar']=_0x48337e[_0x1bdf('0x79')][_0x1bdf('0x7a')];return db[_0x1bdf('0x45')][_0x1bdf('0x60')]({'where':{'id':_0x48337e['params']['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x3c5ec4,null))['then'](saveUpdates(_0x48337e[_0x1bdf('0x62')],null))[_0x1bdf('0x23')](respondWithResult(_0x3c5ec4,null))[_0x1bdf('0x2d')](handleError(_0x3c5ec4,null));};exports[_0x1bdf('0x7e')]=function(_0x430613,_0x177444,_0x1f6cd9){_0x430613[_0x1bdf('0x62')][_0x1bdf('0x7f')]=_0x430613[_0x1bdf('0x79')][_0x1bdf('0x7a')];return db[_0x1bdf('0x45')]['find']({'where':{'id':_0x430613[_0x1bdf('0x5e')]['id']}})['then'](handleEntityNotFound(_0x177444,null))['then'](saveUpdates(_0x430613['body'],null))['then'](respondWithResult(_0x177444,null))[_0x1bdf('0x2d')](handleError(_0x177444,null));};exports[_0x1bdf('0x80')]=function(_0x3e0135,_0x367333,_0x4d1a4f){var _0x5e35bb=path[_0x1bdf('0x81')](config[_0x1bdf('0x82')],_0x1bdf('0x83'));var _0x540c68={'where':{'id':_0x3e0135[_0x1bdf('0x5e')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x26e98d=![];return require(_0x1bdf('0x19'))[_0x1bdf('0x84')]()[_0x1bdf('0x23')](function(_0x19de22){if(_0x19de22){_0x26e98d=_0x19de22[_0x1bdf('0x85')];}})[_0x1bdf('0x23')](function(){return db[_0x1bdf('0x45')][_0x1bdf('0x60')](_0x540c68);})[_0x1bdf('0x23')](handleEntityNotFound(_0x367333,null))[_0x1bdf('0x23')](function(_0x3fe7f5){if(_0x3fe7f5){if(!_[_0x1bdf('0x86')](_0x3fe7f5[_0x1bdf('0x78')])){if(fs[_0x1bdf('0x87')](path['join'](config[_0x1bdf('0x82')],_0x1bdf('0x88'),_0x3fe7f5[_0x1bdf('0x78')]))&&_0x26e98d){_0x5e35bb=path[_0x1bdf('0x81')](config[_0x1bdf('0x82')],'server/files/images/logos/',_0x3fe7f5['sitepic']);}}return _0x367333[_0x1bdf('0x89')](_0x5e35bb);}})[_0x1bdf('0x2d')](handleError(_0x367333,null));};exports[_0x1bdf('0x8a')]=function(_0x315549,_0x214b6c,_0x5af3d0){var _0x4d1450=path['join'](config[_0x1bdf('0x82')],_0x1bdf('0x8b'));var _0x2e9b4a={'where':{'id':_0x315549[_0x1bdf('0x5e')]['id']},'attributes':['id',_0x1bdf('0x7c')],'raw':!![]};return db['ChatWebsite'][_0x1bdf('0x60')](_0x2e9b4a)[_0x1bdf('0x23')](handleEntityNotFound(_0x214b6c,null))['then'](function(_0x55b70b){if(_0x55b70b){if(!_[_0x1bdf('0x86')](_0x55b70b[_0x1bdf('0x7c')])){if(fs[_0x1bdf('0x87')](path[_0x1bdf('0x81')](config[_0x1bdf('0x82')],_0x1bdf('0x8c'),_0x55b70b['agentAvatar']))){_0x4d1450=path[_0x1bdf('0x81')](config[_0x1bdf('0x82')],_0x1bdf('0x8c'),_0x55b70b[_0x1bdf('0x7c')]);}}return _0x214b6c['download'](_0x4d1450);}})[_0x1bdf('0x2d')](handleError(_0x214b6c,null));};exports[_0x1bdf('0x8d')]=function(_0x222b36,_0x588a95,_0x456970){var _0x22fba4=path[_0x1bdf('0x81')](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x1a93dd={'where':{'id':_0x222b36[_0x1bdf('0x5e')]['id']},'attributes':['id',_0x1bdf('0x8e'),_0x1bdf('0x8f')],'raw':!![]};return db[_0x1bdf('0x45')]['find'](_0x1a93dd)['then'](handleEntityNotFound(_0x588a95,null))[_0x1bdf('0x23')](function(_0xed79fe){if(_0xed79fe){if(!_['isNil'](_0xed79fe[_0x1bdf('0x8e')])){if(fs[_0x1bdf('0x87')](path[_0x1bdf('0x81')](config[_0x1bdf('0x82')],_0x1bdf('0x8c'),_0xed79fe[_0x1bdf('0x8e')]))&&_0xed79fe['showCustomerAvatar']){_0x22fba4=path[_0x1bdf('0x81')](config[_0x1bdf('0x82')],'server/files/images/avatars/',_0xed79fe[_0x1bdf('0x8e')]);}}return _0x588a95[_0x1bdf('0x89')](_0x22fba4);}})['catch'](handleError(_0x588a95,null));};exports[_0x1bdf('0x90')]=function(_0x3d1a3b,_0x619705,_0x14fa85){var _0x416c9b=path['join'](config['root'],_0x1bdf('0x91'));var _0x1a9f09={'where':{'id':_0x3d1a3b[_0x1bdf('0x5e')]['id']},'attributes':['id',_0x1bdf('0x7f')],'raw':!![]};return db['ChatWebsite'][_0x1bdf('0x60')](_0x1a9f09)[_0x1bdf('0x23')](handleEntityNotFound(_0x619705,null))[_0x1bdf('0x23')](function(_0x1df604){if(_0x1df604){if(!_[_0x1bdf('0x86')](_0x1df604[_0x1bdf('0x7f')])){if(fs[_0x1bdf('0x87')](path[_0x1bdf('0x81')](config[_0x1bdf('0x82')],_0x1bdf('0x8c'),_0x1df604[_0x1bdf('0x7f')]))){_0x416c9b=path[_0x1bdf('0x81')](config[_0x1bdf('0x82')],'server/files/images/avatars/',_0x1df604['systemAvatar']);}}return _0x619705[_0x1bdf('0x89')](_0x416c9b);}})[_0x1bdf('0x2d')](handleError(_0x619705,null));};exports[_0x1bdf('0x92')]=function(_0x148408,_0x398164,_0x55d063){var _0x2609d8=require('user-agent-parser');var _0xbebc8a=new _0x2609d8();var _0x3a2123=_0xbebc8a[_0x1bdf('0x93')](_0x148408['headers']['user-agent'])[_0x1bdf('0x94')]();var _0x315215={'body':_0x148408[_0x1bdf('0x62')],'channel':_0x1bdf('0x95')};var _0x2999c4=[];var _0x5bb830=[];var _0x481f44={};var _0x3d632a=![];return db[_0x1bdf('0x96')]['describe']()['then'](function(_0x20813d){if(!_0x20813d){throw new db[(_0x1bdf('0x97'))][(_0x1bdf('0x98'))]('no\x20available\x20attributes');}_0x2999c4=_[_0x1bdf('0x99')](_[_0x1bdf('0x48')](_0x20813d),['createdAt','updatedAt']);_0x5bb830=_['difference'](_[_0x1bdf('0x48')](_0x20813d),[_0x1bdf('0x9a'),_0x1bdf('0x9b'),_0x1bdf('0x9c'),'ListId']);if(_0x148408[_0x1bdf('0x62')]['id']){delete _0x148408[_0x1bdf('0x62')]['id'];}if(_[_0x1bdf('0x86')](_0x148408['body'][_0x1bdf('0x9d')])){throw new db[(_0x1bdf('0x97'))][(_0x1bdf('0x98'))](_0x1bdf('0x9e'));}if(_[_0x1bdf('0x86')](_0x148408[_0x1bdf('0x62')][_0x1bdf('0x62')])||_0x148408[_0x1bdf('0x62')][_0x1bdf('0x62')]===''){throw new db[(_0x1bdf('0x97'))][(_0x1bdf('0x98'))](_0x1bdf('0x9f'));}if(_[_0x1bdf('0x86')](_0x148408['body'][_0x1bdf('0xa0')])){throw new db[(_0x1bdf('0x97'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5bb830);}if(!_[_0x1bdf('0xa1')](_0x5bb830,_0x148408[_0x1bdf('0x62')][_0x1bdf('0xa0')])){throw new db[(_0x1bdf('0x97'))][(_0x1bdf('0x98'))](_0x1bdf('0xa2')+_0x5bb830);}_0x481f44[_0x148408[_0x1bdf('0x62')]['mapKey']]=_0x148408[_0x1bdf('0x62')][_0x1bdf('0x9d')];})[_0x1bdf('0x23')](function(){return db[_0x1bdf('0x45')]['find']({'where':{'id':_0x148408[_0x1bdf('0x5e')]['id']},'include':[{'model':db[_0x1bdf('0xa3')],'as':_0x1bdf('0xa4'),'include':[{'model':db['CmContact'],'as':_0x1bdf('0xa5'),'where':_0x481f44,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['ChatApplication'],'as':_0x1bdf('0xa6')}]});})[_0x1bdf('0x23')](handleEntityNotFound(_0x398164,null))[_0x1bdf('0x23')](function(_0xdd8466){if(_0xdd8466&&_0xdd8466[_0x1bdf('0xa4')]){_0x315215[_0x1bdf('0xa7')]=_0xdd8466;_0x315215['applications']=_0xdd8466[_0x1bdf('0xa6')];_0x315215[_0x1bdf('0xa8')]=_0xdd8466[_0x1bdf('0xa4')];_0x315215['applications']=_[_0x1bdf('0xa9')](_0x315215[_0x1bdf('0xaa')],[_0x1bdf('0xab')],[_0x1bdf('0xac')]);if(_0x315215[_0x1bdf('0xa7')]['Applications']){delete _0x315215['account'][_0x1bdf('0xa6')];}if(_0x315215[_0x1bdf('0xa7')][_0x1bdf('0xa4')]&&_0x315215[_0x1bdf('0xa7')]['List']['Contacts'][_0x1bdf('0x4e')]){return _0x315215[_0x1bdf('0xa7')]['List'][_0x1bdf('0xa5')][0x0];}var _0x4bcae8=_[_0x1bdf('0x1c')](_0x148408[_0x1bdf('0x62')],{'firstName':_0x148408[_0x1bdf('0x62')][_0x1bdf('0x9d')],'ListId':_0xdd8466[_0x1bdf('0xad')]});_0x4bcae8[_0x148408[_0x1bdf('0x62')][_0x1bdf('0xa0')]]=_0x148408[_0x1bdf('0x62')][_0x1bdf('0x9d')];return db[_0x1bdf('0x96')][_0x1bdf('0x61')](_0x4bcae8,{'fields':_0x2999c4,'raw':!![]});}})[_0x1bdf('0x23')](handleEntityNotFound(_0x398164,null))['then'](function(_0x3e54c0){_0x315215[_0x1bdf('0xae')]=_0x3e54c0;var _0x5ef3e8=_0x148408['body'][_0x1bdf('0xaf')];if(_0x148408['headers'][_0x1bdf('0xb0')]){_0x5ef3e8=_0x148408[_0x1bdf('0xb1')][_0x1bdf('0xb0')];}else if(_0x148408['headers'][_0x1bdf('0xb2')]){_0x5ef3e8=_[_0x1bdf('0xb3')](_0x148408[_0x1bdf('0xb1')][_0x1bdf('0xb2')][_0x1bdf('0xb4')](','));}if(_0x3e54c0){var _0x33642={'ContactId':_0x3e54c0['id'],'ChatWebsiteId':_0x148408['params']['id'],'from':(_0x3e54c0[_0x1bdf('0xb5')]||'')+'\x20'+(_0x3e54c0['lastName']||''),'customerIp':_0x5ef3e8,'customerPort':_0x148408[_0x1bdf('0xb1')][_0x1bdf('0xb6')]?_0x148408[_0x1bdf('0xb1')][_0x1bdf('0xb6')]:null,'referer':_0x148408[_0x1bdf('0x62')]['referer'],'browserName':_0x3a2123[_0x1bdf('0xb7')]['name']&&_0x3a2123[_0x1bdf('0xb7')]['version']?util['format']('%s\x20%s',_0x3a2123[_0x1bdf('0xb7')]['name'],_0x3a2123[_0x1bdf('0xb7')]['version']):_0x1bdf('0xb8'),'browserVersion':_0x3a2123['browser']['version']||_0x1bdf('0xb8'),'osName':util['format'](_0x1bdf('0xb9'),_0x3a2123['os']['name'],_0x3a2123['os'][_0x1bdf('0xba')]),'osVersion':_0x3a2123['os']['version'],'deviceModel':_0x3a2123[_0x1bdf('0xbb')][_0x1bdf('0x4c')]&&_0x3a2123[_0x1bdf('0xbb')][_0x1bdf('0xbc')]?util[_0x1bdf('0xbd')]('%s\x20%s\x20%s',_0x3a2123[_0x1bdf('0xbb')][_0x1bdf('0x4c')],_0x3a2123['device'][_0x1bdf('0xbc')],_0x3a2123['device']['type']):null,'deviceVendor':_0x3a2123[_0x1bdf('0xbb')][_0x1bdf('0xbc')],'deviceType':_0x3a2123[_0x1bdf('0xbb')][_0x1bdf('0x46')],'formData':JSON[_0x1bdf('0xbe')](_0x148408[_0x1bdf('0x62')])};var _0x153f86={'ChatWebsiteId':_0x148408['params']['id'],'closed':![]};if(_0x148408[_0x1bdf('0x62')][_0x1bdf('0xbf')]){_0x153f86['threadId']=_0x148408[_0x1bdf('0x62')][_0x1bdf('0xbf')];return db[_0x1bdf('0xc0')][_0x1bdf('0x60')]({'where':_0x153f86})[_0x1bdf('0x23')](function(_0x288776){if(_0x288776){return[_0x288776,![]];}_0x33642['threadId']=_0x148408[_0x1bdf('0x62')][_0x1bdf('0xbf')];_0x33642[_0x1bdf('0xc1')]=_0x148408['body'][_0x1bdf('0xc1')];return db[_0x1bdf('0xc0')]['create'](_0x33642)[_0x1bdf('0x23')](function(_0x22bc1a){return[_0x22bc1a,!![]];});});}_0x153f86[_0x1bdf('0xc2')]=_0x3e54c0['id'];if(_0x148408[_0x1bdf('0x62')][_0x1bdf('0xc3')]&&_0x148408[_0x1bdf('0x62')][_0x1bdf('0xc3')]['id']){_0x153f86['id']=_0x148408['body']['interaction']['id'];return db[_0x1bdf('0xc0')]['find']({'where':_0x153f86})[_0x1bdf('0x23')](function(_0x1a4af3){if(_0x1a4af3){return[_0x1a4af3,![]];}return db[_0x1bdf('0xc0')][_0x1bdf('0x61')](_0x33642)[_0x1bdf('0x23')](function(_0x524bf7){return[_0x524bf7,!![]];});});}return db[_0x1bdf('0xc0')][_0x1bdf('0x61')](_0x33642)[_0x1bdf('0x23')](function(_0x3f6588){return[_0x3f6588,!![]];});}})['spread'](function(_0x51820b,_0x12fafd){if(_0x51820b){_0x3d632a=_0x12fafd;if(!_0x12fafd){var _0x389298={'from':(_0x315215[_0x1bdf('0xae')][_0x1bdf('0xb5')]||'')+'\x20'+(_0x315215[_0x1bdf('0xae')][_0x1bdf('0xc4')]||'')};if(_0x148408[_0x1bdf('0x62')][_0x1bdf('0xbf')]&&_0x148408[_0x1bdf('0x62')][_0x1bdf('0xc5')]&&_0x148408[_0x1bdf('0x62')][_0x1bdf('0xbf')]!=_0x148408[_0x1bdf('0x62')]['messageId']){_0x389298['threadId']=_0x148408[_0x1bdf('0x62')][_0x1bdf('0xc5')];}return _0x51820b[_0x1bdf('0x69')](_0x389298);}else{return _0x51820b;}}})[_0x1bdf('0x23')](function(_0x1f4bd8){_0x315215[_0x1bdf('0xc3')]=_0x1f4bd8[_0x1bdf('0x38')]({'plain':!![]});_0x315215[_0x1bdf('0xc3')]['created']=_0x3d632a;if(_0x315215[_0x1bdf('0xc3')][_0x1bdf('0xc6')]){if(_0x315215[_0x1bdf('0xa7')]['autoclose']){_0x315215[_0x1bdf('0xaa')]['push']({'id':0x0,'priority':_0x315215[_0x1bdf('0xaa')][_0x1bdf('0x4e')]+0x1,'app':_0x1bdf('0xc7'),'appdata':_0x1bdf('0xc8'),'interval':'*,*,*,*'});}}return db[_0x1bdf('0xc9')][_0x1bdf('0x61')]({'body':_0x148408[_0x1bdf('0x62')][_0x1bdf('0x62')],'ChatWebsiteId':_0x148408['params']['id'],'ChatInteractionId':_0x1f4bd8['id'],'direction':'in','ContactId':_0x315215['contact']['id'],'AttachmentId':_0x148408['body'][_0x1bdf('0xca')]});})['then'](function(_0x4fe142){_0x315215['message']=_0x4fe142;if(_0x315215[_0x1bdf('0xc3')][_0x1bdf('0xcb')]){return db[_0x1bdf('0xcc')][_0x1bdf('0x60')]({'attributes':['id','name'],'where':{'id':_0x315215['interaction']['UserId']}})[_0x1bdf('0x23')](function(_0xcc6f98){if(_0xcc6f98){_0x315215[_0x1bdf('0xaa')][_0x1bdf('0xcd')]({'id':0x0,'priority':0x0,'app':_0x1bdf('0xce'),'appdata':_0xcc6f98[_0x1bdf('0x3f')]+','+(_0x315215['account'][_0x1bdf('0xcf')]||0xa),'interval':_0x1bdf('0xd0')});_0x315215[_0x1bdf('0xd1')]=!![];}return respondWithRpcPromise(_0x1bdf('0xd2'),_0x1bdf('0xd3'),_0x315215);});}return respondWithRpcPromise(_0x1bdf('0xd2'),'startRouting',_0x315215);})[_0x1bdf('0x23')](function(_0x336e7f){respondWithRpcPromise(_0x1bdf('0xd4'),_0x1bdf('0xd4'),{'event':_0x1bdf('0x92'),'message':_0x336e7f},client9002);return _0x336e7f;})[_0x1bdf('0x23')](respondWithResult(_0x398164,null))[_0x1bdf('0x2d')](handleError(_0x398164,null));};exports[_0x1bdf('0xd5')]=function(_0x5c3889,_0x5631f3,_0x387f02){var _0x4e2c05,_0x18595d,_0x3ce3bc;var _0x13eb6c=[];var _0x3df6df=[];var _0x47a9dd={};var _0x530224=_0x5c3889[_0x1bdf('0xd6')]||[];var _0x37fa64=[];var _0x4fa481;return db[_0x1bdf('0x96')][_0x1bdf('0x6a')]()[_0x1bdf('0x23')](function(_0x2da616){if(!_0x2da616){throw new db[(_0x1bdf('0x97'))]['ValidationError'](_0x1bdf('0xd7'));}_0x3df6df=_['difference'](_['keys'](_0x2da616),[_0x1bdf('0x9a'),_0x1bdf('0x9b')]);_0x13eb6c=_['difference'](_[_0x1bdf('0x48')](_0x2da616),['createdAt','updatedAt',_0x1bdf('0x9c'),_0x1bdf('0xad')]);if(_0x5c3889[_0x1bdf('0x62')]['id']){delete _0x5c3889['body']['id'];}if(_[_0x1bdf('0x86')](_0x5c3889[_0x1bdf('0x62')][_0x1bdf('0x9d')])){throw _0x5631f3[_0x1bdf('0x3c')](0x1f4)[_0x1bdf('0x40')](new db[(_0x1bdf('0x97'))][(_0x1bdf('0x98'))](_0x1bdf('0x9e')));}if(_[_0x1bdf('0x86')](_0x5c3889[_0x1bdf('0x62')][_0x1bdf('0x62')])||_0x5c3889[_0x1bdf('0x62')][_0x1bdf('0x62')]===''){throw _0x5631f3[_0x1bdf('0x3c')](0x1f4)[_0x1bdf('0x40')](new db[(_0x1bdf('0x97'))][(_0x1bdf('0x98'))](_0x1bdf('0x9f')));}if(_[_0x1bdf('0x86')](_0x5c3889[_0x1bdf('0x62')]['mapKeyOffline'])){throw _0x5631f3[_0x1bdf('0x3c')](0x1f4)[_0x1bdf('0x40')](new db[(_0x1bdf('0x97'))]['ValidationError'](_0x1bdf('0xd8')+_0x13eb6c));}if(!_[_0x1bdf('0xa1')](_0x13eb6c,_0x5c3889['body'][_0x1bdf('0xd9')])){throw _0x5631f3[_0x1bdf('0x3c')](0x1f4)['send'](new db[(_0x1bdf('0x97'))][(_0x1bdf('0x98'))](_0x1bdf('0xda')+_0x13eb6c));}_0x47a9dd[_0x5c3889[_0x1bdf('0x62')]['mapKeyOffline']]=_0x5c3889['body']['from'];})[_0x1bdf('0x23')](function(){return db[_0x1bdf('0x45')]['find']({'where':{'id':_0x5c3889[_0x1bdf('0x5e')]['id']},'include':[{'model':db[_0x1bdf('0xa3')],'as':'List'},{'model':db['MailAccount'],'as':_0x1bdf('0xdb')}]});})['then'](handleEntityNotFound(_0x5631f3,null))['then'](function(_0x386152){if(_0x386152&&_0x386152[_0x1bdf('0xa4')]){_0x18595d=_0x386152;var _0x35a168=_['defaults'](_0x5c3889[_0x1bdf('0x62')],{'firstName':_0x5c3889[_0x1bdf('0x62')][_0x1bdf('0x9d')],'phone':_0x5c3889[_0x1bdf('0x62')][_0x1bdf('0x9d')],'ListId':_0x386152[_0x1bdf('0xad')]});_0x35a168[_0x5c3889[_0x1bdf('0x62')][_0x1bdf('0xd9')]]=_0x5c3889['body'][_0x1bdf('0x9d')];return db[_0x1bdf('0x96')]['findOrCreate']({'where':_0x47a9dd,'defaults':_0x35a168});}})[_0x1bdf('0xdc')](function(_0xf1455e){if(_0xf1455e){_0x3ce3bc=_0xf1455e;var _0x18e4d3=fs['readFileSync'](path[_0x1bdf('0x81')](config[_0x1bdf('0x82')],_0x1bdf('0xdd')),_0x1bdf('0xde'));var _0xc3aa4b=ejs[_0x1bdf('0xdf')](_0x18e4d3,{'body':_[_0x1bdf('0xe0')](_0x5c3889[_0x1bdf('0x62')][_0x1bdf('0x62')]),'bodyTitle':_0x18595d[_0x1bdf('0xe1')]});return db[_0x1bdf('0xe2')][_0x1bdf('0x61')]({'body':_0xc3aa4b,'ContactId':_0xf1455e['id'],'ChatWebsiteId':_0x18595d['id']});}})[_0x1bdf('0x23')](function(_0x5940cb){_0x4fa481=_0x5940cb;if(_0x530224[_0x1bdf('0x4e')]){var _0x56e9f8=_0x530224[_0x1bdf('0x44')](function(_0x24c731){return{'name':_0x24c731[_0x1bdf('0xe3')],'basename':_0x24c731[_0x1bdf('0x7a')],'type':_0x24c731['mimetype'],'ChatOfflineMessageId':_0x5940cb['id']};});_0x37fa64=_0x56e9f8[_0x1bdf('0x44')](_0x5f3741=>{var _0x3015a7={'filename':_0x5f3741[_0x1bdf('0x3f')],'path':path[_0x1bdf('0x81')](config['root'],_0x1bdf('0xe4'),_0x1bdf('0xd6'),_0x1bdf('0xe5'),_0x1bdf('0xe6'),_0x5f3741['basename'])};return _0x3015a7;});if(!_0x18595d[_0x1bdf('0xe7')]){return db['sequelize']['transaction'](function(_0x4468a7){return db[_0x1bdf('0xe8')][_0x1bdf('0xe9')](_0x56e9f8,{'transaction':_0x4468a7});});}}})[_0x1bdf('0x23')](function(){if(_0x4fa481){_0x4e2c05=_0x4fa481;return db[_0x1bdf('0xdb')]['findOne']({'where':{'active':!![]},'include':[{'model':db[_0x1bdf('0xea')],'as':_0x1bdf('0xeb'),'raw':!![]}]});}})[_0x1bdf('0x23')](function(_0x26e7e5){if(_0x26e7e5&&_0x26e7e5[_0x1bdf('0xeb')]&&_0x18595d[_0x1bdf('0xec')]&&_0x18595d[_0x1bdf('0xed')]){var _0x52eaa2={'tls':{'rejectUnauthorized':![]}};if(_0x26e7e5[_0x1bdf('0xeb')][_0x1bdf('0xee')]){_0x52eaa2['service']=_0x26e7e5[_0x1bdf('0xeb')]['service'];}else{_0x52eaa2['host']=_0x26e7e5[_0x1bdf('0xeb')]['host'];_0x52eaa2[_0x1bdf('0xef')]=_0x26e7e5[_0x1bdf('0xeb')][_0x1bdf('0xef')];_0x52eaa2[_0x1bdf('0xf0')]=_0x26e7e5['Smtp'][_0x1bdf('0xf0')];}if(_0x26e7e5[_0x1bdf('0xeb')][_0x1bdf('0xf1')]){_0x52eaa2['auth']={'user':_0x26e7e5[_0x1bdf('0xeb')]['user'],'pass':_0x26e7e5['Smtp'][_0x1bdf('0xf2')]};}return respondWithRpcPromise(_0x1bdf('0xf3'),_0x1bdf('0xf4'),{'account':_0x52eaa2,'message':{'from':util[_0x1bdf('0xbd')](_0x1bdf('0xf5'),_0x26e7e5['name'],_0x26e7e5[_0x1bdf('0xf6')]||_0x26e7e5[_0x1bdf('0xeb')][_0x1bdf('0x63')]),'to':_0x18595d[_0x1bdf('0xed')],'subject':_0x18595d[_0x1bdf('0xf7')],'html':_0x4e2c05[_0x1bdf('0x62')],'attachments':_0x37fa64}},client9003)['then'](function(){return _0x4e2c05;})[_0x1bdf('0x2d')](function(_0x804847){console[_0x1bdf('0x29')](_0x804847);});}})['then'](function(){if(_0x18595d&&_0x18595d['openNewInteraction']&&_0x18595d['MailAccountId']){var _0x5296da=[];if(_0x530224['length']){_0x5296da=_0x530224[_0x1bdf('0x44')](function(_0x137e1d){return{'name':_0x137e1d[_0x1bdf('0xe3')],'basename':_0x137e1d[_0x1bdf('0x7a')],'type':_0x137e1d[_0x1bdf('0xf8')],'ChatOfflineMessageId':_0x4fa481['id']};});}var _0x4926b8;if(!_[_0x1bdf('0x86')](_0x18595d[_0x1bdf('0xf9')])){var _0xba6499=_[_0x1bdf('0x44')](_0x5c3889[_0x1bdf('0x62')],function(_0x181306){return _0x181306;});var _0x48b075=_[_0x1bdf('0xfa')](_0xba6499)[0x0];var _0x3e305c=_[_0x1bdf('0xfb')](_0x48b075,function(_0x320798){return _0x320798;});_0x4926b8=_0x3e305c[0x1][_0x18595d[_0x1bdf('0xf9')]];}var _0x594b47={'from':_0x3ce3bc['email'],'firstName':_0x3ce3bc[_0x1bdf('0xb5')],'lastName':_0x3ce3bc[_0x1bdf('0xc4')],'mapKey':_0x1bdf('0xf6'),'message':{'from':_0x3ce3bc[_0x1bdf('0xf6')],'to':_0x18595d[_0x1bdf('0xdb')][_0x1bdf('0xf6')],'cc':'','subject':_['isNil'](_0x4926b8)?_0x18595d['offlineMessageSubject']:_0x4926b8,'messageId':'','sentAt':new Date(),'attach':_0x5296da['length'],'attachments':_0x5296da,'originChannel':'Chat','ChatWebsiteId':_0x18595d['id'],'ChatOfflineMessageId':_0x4e2c05['id'],'originTo':_0x18595d['MailAccount'][_0x1bdf('0xf6')]},'body':_0x4e2c05['body']};var _0x54eec6={'account':{'id':_0x18595d[_0x1bdf('0xfc')]},'body':_0x594b47,'log':_0x1bdf('0xfd')};return respondWithRpcPromise(_0x1bdf('0xfd'),'notifyMail',_0x54eec6,client9001)[_0x1bdf('0x23')](function(){return _0x4e2c05;})[_0x1bdf('0x2d')](function(_0x382e03){console[_0x1bdf('0x29')](_0x382e03);});}return;})[_0x1bdf('0x23')](function(){if(_0x4e2c05){return _0x4e2c05;}})['then'](respondWithResult(_0x5631f3,null))[_0x1bdf('0x2d')](function(_0x3db91d){console[_0x1bdf('0x29')]('catch',_0x3db91d);for(var _0x179ad8 of _0x530224){var _0x50a03d=path['join'](config[_0x1bdf('0x82')],_0x1bdf('0xe4'),_0x1bdf('0xd6'),_0x1bdf('0xe5'),_0x1bdf('0xe6'),_0x179ad8[_0x1bdf('0x7a')]);fs_extra[_0x1bdf('0xfe')](_0x50a03d)[_0x1bdf('0x2d')](function(_0x1fb769){console[_0x1bdf('0x29')](_0x1bdf('0xff'),_0x50a03d,_0x1fb769);});}});};exports[_0x1bdf('0x100')]=function(_0x53ec6b,_0x1f7f76,_0x1cd85e){return db['ChatInteraction'][_0x1bdf('0x60')]({'where':{'id':_0x53ec6b['params']['id']}})['then'](handleEntityNotFound(_0x1f7f76,null))['then'](function(_0x336c89){if(_0x336c89){return _0x336c89[_0x1bdf('0x100')](_0x53ec6b[_0x1bdf('0x62')]['ids'],_[_0x1bdf('0x101')](_0x53ec6b[_0x1bdf('0x62')],['ids','id'])||{});}})['then'](respondWithResult(_0x1f7f76,null))[_0x1bdf('0x2d')](handleError(_0x1f7f76,null));};exports[_0x1bdf('0x102')]=function(_0x265f9f,_0x3fe47e,_0x4ca5c3){var _0x1eb315={'raw':![],'where':{}};var _0x166769={};var _0x3b84f7={'count':0x0,'rows':[]};return db[_0x1bdf('0x45')][_0x1bdf('0x6e')]({'where':{'id':_0x265f9f[_0x1bdf('0x5e')]['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x3fe47e,null))[_0x1bdf('0x23')](function(_0x5b8301){if(_0x5b8301){_0x166769[_0x1bdf('0x4c')]=_[_0x1bdf('0x48')](db[_0x1bdf('0xc0')][_0x1bdf('0x6f')]);_0x166769[_0x1bdf('0x49')]=_[_0x1bdf('0x48')](_0x265f9f['query']);_0x166769['filters']=_['intersection'](_0x166769['model'],_0x166769['query']);_0x1eb315[_0x1bdf('0x5f')]=_['intersection'](_0x166769[_0x1bdf('0x4c')],qs[_0x1bdf('0x4d')](_0x265f9f[_0x1bdf('0x49')][_0x1bdf('0x4d')]));_0x1eb315[_0x1bdf('0x5f')]=_0x1eb315[_0x1bdf('0x5f')][_0x1bdf('0x4e')]?_0x1eb315[_0x1bdf('0x5f')]:_0x166769['model'];if(!_0x265f9f[_0x1bdf('0x49')][_0x1bdf('0x4f')](_0x1bdf('0x50'))){_0x1eb315[_0x1bdf('0x32')]=qs[_0x1bdf('0x32')](_0x265f9f['query']['limit']);_0x1eb315['offset']=qs[_0x1bdf('0x2f')](_0x265f9f[_0x1bdf('0x49')][_0x1bdf('0x2f')]);}_0x1eb315[_0x1bdf('0x51')]=qs[_0x1bdf('0x52')](_0x265f9f[_0x1bdf('0x49')][_0x1bdf('0x52')]);_0x1eb315[_0x1bdf('0x55')]=qs[_0x1bdf('0x4a')](_['pick'](_0x265f9f[_0x1bdf('0x49')],_0x166769[_0x1bdf('0x4a')]));_0x1eb315[_0x1bdf('0x55')][_0x1bdf('0x70')]=_0x5b8301['id'];if(_0x265f9f[_0x1bdf('0x49')][_0x1bdf('0x54')]){_0x1eb315[_0x1bdf('0x55')]=_[_0x1bdf('0x56')](_0x1eb315[_0x1bdf('0x55')],{'$or':_[_0x1bdf('0x44')](_0x1eb315['attributes'],function(_0x391064){var _0x2b4384={};_0x2b4384[_0x391064]={'$like':'%'+_0x265f9f[_0x1bdf('0x49')][_0x1bdf('0x54')]+'%'};return _0x2b4384;})});}_0x1eb315=_[_0x1bdf('0x56')]({},_0x1eb315,_0x265f9f['options']);return db[_0x1bdf('0xc0')][_0x1bdf('0x31')]({'where':_0x1eb315[_0x1bdf('0x55')]})['then'](function(_0x51c87d){_0x3b84f7['count']=_0x51c87d;if(_0x265f9f[_0x1bdf('0x49')][_0x1bdf('0x59')]){_0x1eb315[_0x1bdf('0x5a')]=[{'model':db[_0x1bdf('0x96')],'as':_0x1bdf('0x103'),'required':![]},{'model':db[_0x1bdf('0xcc')],'as':_0x1bdf('0x104'),'attributes':['name','fullname','internal'],'required':![]},{'model':db[_0x1bdf('0x105')],'as':_0x1bdf('0x106'),'attributes':['id','name',_0x1bdf('0x107')],'where':_0x265f9f[_0x1bdf('0x49')]['tag']?{'id':_0x265f9f[_0x1bdf('0x49')][_0x1bdf('0x108')]}:undefined,'required':_0x265f9f['query']['tag']?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x1eb315);})[_0x1bdf('0x23')](function(_0x2782db){_0x3b84f7[_0x1bdf('0x5c')]=_0x2782db;return _0x3b84f7;});}})[_0x1bdf('0x23')](respondWithFilteredResult(_0x3fe47e,_0x1eb315))[_0x1bdf('0x2d')](handleError(_0x3fe47e,null));};function iftimePromise(_0x4a34e2,_0x1d2372){return respondWithRpcPromise(_0x1bdf('0x109'),'getSnippet',{'command':_0x1d2372['timezone']?util[_0x1bdf('0xbd')](_0x1bdf('0x10a'),_0x4a34e2[_0x1bdf('0x10b')],_0x1d2372['timezone']):util[_0x1bdf('0xbd')](_0x1bdf('0x10c'),_0x4a34e2[_0x1bdf('0x10b')])},client9002)[_0x1bdf('0x23')](function(_0x5ef351){var _0x304572=_0x5ef351&&_0x5ef351[_0x1bdf('0x10d')](_0x1bdf('0x10e'))>=0x0?!![]:![];logger['info'](_0x1bdf('0x10f'),_0x1d2372['id'],_0x4a34e2['id'],_0x4a34e2['interval'],_0x304572?_0x1bdf('0x110'):_0x1bdf('0x111'),_0x1d2372[_0x1bdf('0x112')]?_0x1d2372[_0x1bdf('0x112')]:_0x1bdf('0x113'));return _0x304572;})[_0x1bdf('0x2d')](function(_0x316b9b){logger[_0x1bdf('0x29')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x1d2372['id'],_0x4a34e2['id'],_0x4a34e2[_0x1bdf('0x10b')],util[_0x1bdf('0x114')](_0x316b9b,{'showHidden':![],'depth':null}),_0x1d2372['timezone']?_0x1d2372[_0x1bdf('0x112')]:_0x1bdf('0x113'));return![];});}exports[_0x1bdf('0x115')]=function(_0x45723e,_0xfa1cd1,_0x38787d){var _0x4400cc=0x0;var _0xc59f7e=0x0;var _0x250597=![];var _0x1a425a;var _0xbe410b;return db['ChatWebsite'][_0x1bdf('0x60')]({'where':{'id':_0x45723e['params']['id']},'include':[{'model':db[_0x1bdf('0x116')],'as':_0x1bdf('0x116'),'include':[{'model':db[_0x1bdf('0x116')],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]})[_0x1bdf('0x23')](handleEntityNotFound(_0xfa1cd1,null))[_0x1bdf('0x23')](function(_0x57aba8){if(_0x57aba8){_0x1a425a=_0x57aba8;return _0x57aba8[_0x1bdf('0x117')]({'raw':!![]});}})['then'](function(_0x524348){if(_0x1a425a){if(_0x524348){_0xbe410b=_0x524348;}}return require(_0x1bdf('0x19'))[_0x1bdf('0x84')]();})['then'](function(_0xee9e11){if(_0xee9e11){_0xc59f7e=_0xee9e11[_0x1bdf('0x118')];_0x250597=_0xee9e11['custom'];}})[_0x1bdf('0x23')](function(){return db['ChatInteraction'][_0x1bdf('0x31')]({'where':{'closed':![]}});})['then'](function(_0x567a3f){_0x4400cc=_0x567a3f;if(_0xc59f7e&&_0x567a3f>_0xc59f7e){return db['License'][_0x1bdf('0x6e')]({'where':{'id':0x1}})[_0x1bdf('0x23')](function(_0x9dfcbd){if(_0x9dfcbd){_0x9dfcbd[_0x1bdf('0x119')]('chatLicenseExceeded');}});}})[_0x1bdf('0x23')](function(){if(_0x1a425a[_0x1bdf('0x116')]&&_0x1a425a[_0x1bdf('0x116')]['Intervals']){var _0x5c331e=[];for(var _0x22579e=0x0;_0x22579e<_0x1a425a[_0x1bdf('0x116')][_0x1bdf('0x11a')][_0x1bdf('0x4e')];_0x22579e++){var _0x272d2a=_0x1a425a[_0x1bdf('0x116')]['Intervals'][_0x22579e][_0x1bdf('0x38')]({'plain':!![]});_0x5c331e[_0x1bdf('0x11b')](iftimePromise(_0x272d2a,_0x1a425a));}return BPromise[_0x1bdf('0x11c')](_0x5c331e)['then'](function(_0x3f4bdf){return _[_0x1bdf('0x11d')](_0x3f4bdf);});}else{return!![];}})[_0x1bdf('0x23')](function(_0x54d9e2){var _0x5ba69c=fs[_0x1bdf('0x11e')](path['join'](config[_0x1bdf('0x82')],_0x1bdf('0x11f')),_0x1bdf('0xde'));var _0x5b3400={'remote':_0x1a425a[_0x1bdf('0x120')],'query':querystring[_0x1bdf('0xbe')](_[_0x1bdf('0x56')](_0x1a425a[_0x1bdf('0x38')]({'plain':!![]}),{'customerIp':_0x45723e['headers'][_0x1bdf('0xb2')]||_0x45723e[_0x1bdf('0xb1')][_0x1bdf('0x121')]||_0x45723e[_0x1bdf('0x122')][_0x1bdf('0x123')]||_0x45723e['ip'],'referer':_0x45723e[_0x1bdf('0xb1')][_0x1bdf('0x124')],'openedInteractions':_0x4400cc,'maxInteractions':_0xc59f7e,'virtual':_0x250597[_0x1bdf('0x118')],'online':_0x54d9e2,'custom':_0x250597}))['replace'](/'/g,'\x5c\x27')};_0xfa1cd1['send'](ejs[_0x1bdf('0xdf')](Mustache[_0x1bdf('0xdf')](_0x5ba69c,_0x5b3400),{'proactiveActions':_0xbe410b,'alignment':_0x1a425a[_0x1bdf('0x125')],'verticalAlignment':_0x1a425a[_0x1bdf('0x126')],'div_color':_0x1a425a[_0x1bdf('0x107')],'text_color':_0x1a425a[_0x1bdf('0x127')],'button_color':_0x1a425a['color_button'],'background_color':_0x1a425a[_0x1bdf('0x128')]}));})[_0x1bdf('0x2d')](handleError(_0xfa1cd1,null));};exports[_0x1bdf('0x129')]=function(_0x5c2493,_0x398dab,_0x4dbbe0){return db[_0x1bdf('0x45')][_0x1bdf('0x6e')]({'where':{'id':_0x5c2493[_0x1bdf('0x5e')]['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x398dab,null))['then'](function(_0x241dca){if(_0x241dca){return db[_0x1bdf('0x12a')][_0x1bdf('0x12b')](function(_0x1ab67a){return db[_0x1bdf('0x12c')][_0x1bdf('0x3b')]({'where':{'ChatWebsiteId':_0x5c2493[_0x1bdf('0x5e')]['id']},'transaction':_0x1ab67a})['then'](function(_0x507f1b){var _0x3980c7=_[_0x1bdf('0x44')](_0x5c2493[_0x1bdf('0x62')],function(_0x8425ef){_0x8425ef['ChatWebsiteId']=_0x5c2493['params']['id'];return _0x8425ef;});return db['ChatApplication'][_0x1bdf('0xe9')](_0x3980c7,{'transaction':_0x1ab67a});});})[_0x1bdf('0x23')](function(){return db[_0x1bdf('0x12c')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x5c2493[_0x1bdf('0x5e')]['id']},'order':_0x1bdf('0xab')});});}})[_0x1bdf('0x23')](respondWithResult(_0x398dab,null))[_0x1bdf('0x2d')](handleError(_0x398dab,null));};exports['getApplications']=function(_0x34c55f,_0xa255cb,_0x5f916b){var _0x4a10fe={};var _0x4902e9={};var _0x398c5f;var _0x1963d5;return db[_0x1bdf('0x45')][_0x1bdf('0x6e')]({'where':{'id':_0x34c55f[_0x1bdf('0x5e')]['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0xa255cb,null))[_0x1bdf('0x23')](function(_0xbacf2a){if(_0xbacf2a){_0x398c5f=_0xbacf2a;_0x4902e9[_0x1bdf('0x4c')]=_[_0x1bdf('0x48')](db[_0x1bdf('0x12c')][_0x1bdf('0x6f')]);_0x4902e9[_0x1bdf('0x49')]=_['keys'](_0x34c55f[_0x1bdf('0x49')]);_0x4902e9['filters']=_[_0x1bdf('0x4b')](_0x4902e9['model'],_0x4902e9[_0x1bdf('0x49')]);_0x4a10fe[_0x1bdf('0x5f')]=_[_0x1bdf('0x4b')](_0x4902e9[_0x1bdf('0x4c')],qs[_0x1bdf('0x4d')](_0x34c55f['query'][_0x1bdf('0x4d')]));_0x4a10fe[_0x1bdf('0x5f')]=_0x4a10fe[_0x1bdf('0x5f')][_0x1bdf('0x4e')]?_0x4a10fe[_0x1bdf('0x5f')]:_0x4902e9[_0x1bdf('0x4c')];_0x4a10fe['order']=qs['sort'](_0x34c55f[_0x1bdf('0x49')][_0x1bdf('0x52')]);_0x4a10fe['where']=qs[_0x1bdf('0x4a')](_[_0x1bdf('0x53')](_0x34c55f['query'],_0x4902e9['filters']));if(_0x34c55f[_0x1bdf('0x49')][_0x1bdf('0x54')]){_0x4a10fe[_0x1bdf('0x55')]=_['merge'](_0x4a10fe[_0x1bdf('0x55')],{'$or':_[_0x1bdf('0x44')](_0x4a10fe[_0x1bdf('0x5f')],function(_0x5b2d20){var _0x4212a6={};_0x4212a6[_0x5b2d20]={'$like':'%'+_0x34c55f[_0x1bdf('0x49')][_0x1bdf('0x54')]+'%'};return _0x4212a6;})});}_0x4a10fe=_[_0x1bdf('0x56')]({},_0x4a10fe,_0x34c55f[_0x1bdf('0x58')]);return _0x398c5f[_0x1bdf('0x12d')](_0x4a10fe);}})['then'](function(_0x148022){if(_0x148022){_0x1963d5=_0x148022['length'];if(!_0x34c55f[_0x1bdf('0x49')][_0x1bdf('0x4f')](_0x1bdf('0x50'))){_0x4a10fe[_0x1bdf('0x32')]=qs[_0x1bdf('0x32')](_0x34c55f['query'][_0x1bdf('0x32')]);_0x4a10fe[_0x1bdf('0x2f')]=qs[_0x1bdf('0x2f')](_0x34c55f[_0x1bdf('0x49')][_0x1bdf('0x2f')]);}return _0x398c5f[_0x1bdf('0x12d')](_0x4a10fe);}})[_0x1bdf('0x23')](function(_0x3e83a0){if(_0x3e83a0){return _0x3e83a0?{'count':_0x1963d5,'rows':_0x3e83a0}:null;}})[_0x1bdf('0x23')](respondWithResult(_0xa255cb,null))[_0x1bdf('0x2d')](handleError(_0xa255cb,null));};exports[_0x1bdf('0x12e')]=function(_0x49f57d,_0x329460,_0x4f6e0f){return db[_0x1bdf('0x12f')][_0x1bdf('0x60')]({'where':{'id':_0x49f57d[_0x1bdf('0x5e')]['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x329460,null))[_0x1bdf('0x23')](function(_0x4f0e42){if(_0x4f0e42){return _0x4f0e42[_0x1bdf('0x12e')](_0x49f57d[_0x1bdf('0x62')][_0x1bdf('0x72')],_[_0x1bdf('0x101')](_0x49f57d['body'],[_0x1bdf('0x72'),'id'])||{});}})['then'](respondWithResult(_0x329460,null))[_0x1bdf('0x2d')](handleError(_0x329460,null));};exports[_0x1bdf('0x117')]=function(_0x5c3eaf,_0x5b77ad,_0x556486){var _0x510f16={};var _0xe72f1a={};var _0x583dd6;var _0x5b7608;return db[_0x1bdf('0x45')][_0x1bdf('0x6e')]({'where':{'id':_0x5c3eaf[_0x1bdf('0x5e')]['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x5b77ad,null))[_0x1bdf('0x23')](function(_0x1b43f1){if(_0x1b43f1){_0x583dd6=_0x1b43f1;_0xe72f1a[_0x1bdf('0x4c')]=_[_0x1bdf('0x48')](db[_0x1bdf('0x130')]['rawAttributes']);_0xe72f1a['query']=_[_0x1bdf('0x48')](_0x5c3eaf['query']);_0xe72f1a['filters']=_[_0x1bdf('0x4b')](_0xe72f1a['model'],_0xe72f1a[_0x1bdf('0x49')]);_0x510f16[_0x1bdf('0x5f')]=_[_0x1bdf('0x4b')](_0xe72f1a[_0x1bdf('0x4c')],qs[_0x1bdf('0x4d')](_0x5c3eaf[_0x1bdf('0x49')][_0x1bdf('0x4d')]));_0x510f16[_0x1bdf('0x5f')]=_0x510f16[_0x1bdf('0x5f')][_0x1bdf('0x4e')]?_0x510f16[_0x1bdf('0x5f')]:_0xe72f1a[_0x1bdf('0x4c')];_0x510f16[_0x1bdf('0x51')]=qs[_0x1bdf('0x52')](_0x5c3eaf[_0x1bdf('0x49')]['sort']);_0x510f16[_0x1bdf('0x55')]=qs[_0x1bdf('0x4a')](_['pick'](_0x5c3eaf[_0x1bdf('0x49')],_0xe72f1a['filters']));if(_0x5c3eaf[_0x1bdf('0x49')][_0x1bdf('0x54')]){_0x510f16['where']=_[_0x1bdf('0x56')](_0x510f16[_0x1bdf('0x55')],{'$or':_[_0x1bdf('0x44')](_0x510f16[_0x1bdf('0x5f')],function(_0x270396){var _0x507577={};_0x507577[_0x270396]={'$like':'%'+_0x5c3eaf['query'][_0x1bdf('0x54')]+'%'};return _0x507577;})});}_0x510f16=_[_0x1bdf('0x56')]({},_0x510f16,_0x5c3eaf[_0x1bdf('0x58')]);return _0x583dd6[_0x1bdf('0x117')](_0x510f16);}})[_0x1bdf('0x23')](function(_0x507189){if(_0x507189){_0x5b7608=_0x507189[_0x1bdf('0x4e')];if(!_0x5c3eaf[_0x1bdf('0x49')]['hasOwnProperty']('nolimit')){_0x510f16[_0x1bdf('0x32')]=qs[_0x1bdf('0x32')](_0x5c3eaf[_0x1bdf('0x49')]['limit']);_0x510f16['offset']=qs[_0x1bdf('0x2f')](_0x5c3eaf['query'][_0x1bdf('0x2f')]);}return _0x583dd6[_0x1bdf('0x117')](_0x510f16);}})[_0x1bdf('0x23')](function(_0x189985){if(_0x189985){return _0x189985?{'count':_0x5b7608,'rows':_0x189985}:null;}})[_0x1bdf('0x23')](respondWithResult(_0x5b77ad,null))[_0x1bdf('0x2d')](handleError(_0x5b77ad,null));};exports['getFields']=function(_0x141be1,_0x125e20,_0x8b014b){var _0x26439f=_0x141be1[_0x1bdf('0x49')][_0x1bdf('0x131')]===_0x1bdf('0x132')?_0x1bdf('0x133'):_0x1bdf('0x134');return db[_0x1bdf('0x45')][_0x1bdf('0x60')]({'attributes':['id',_0x26439f],'where':{'id':_0x141be1['params']['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x125e20,null))[_0x1bdf('0x23')](function(_0x305ce5){if(_0x305ce5){var _0x3b4aeb=_0x305ce5[_0x26439f];var _0x2b5851=_0x3b4aeb&&_0x3b4aeb[_0x1bdf('0x135')]?_0x3b4aeb['items']:[];_0x125e20[_0x1bdf('0x40')]({'fromKey':_[_0x1bdf('0x86')](_0x3b4aeb['fromKey'])?undefined:_0x3b4aeb['fromKey'],'count':_0x2b5851[_0x1bdf('0x4e')],'rows':_0x2b5851});}})[_0x1bdf('0x2d')](handleError(_0x125e20,null));};exports[_0x1bdf('0x136')]=function(_0x32f3eb,_0x5262e5,_0x141821){var _0x4cb5f0={'raw':![],'where':{}};var _0x2c6806={};var _0x3740a7={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x1bdf('0x6e')]({'where':{'id':_0x32f3eb['params']['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x5262e5,null))['then'](function(_0x51fa02){if(_0x51fa02){_0x2c6806[_0x1bdf('0x4c')]=_['keys'](db[_0x1bdf('0xe2')]['rawAttributes']);_0x2c6806[_0x1bdf('0x49')]=_[_0x1bdf('0x48')](_0x32f3eb[_0x1bdf('0x49')]);_0x2c6806[_0x1bdf('0x4a')]=_[_0x1bdf('0x4b')](_0x2c6806[_0x1bdf('0x4c')],_0x2c6806[_0x1bdf('0x49')]);_0x4cb5f0[_0x1bdf('0x5f')]=_[_0x1bdf('0x4b')](_0x2c6806[_0x1bdf('0x4c')],qs[_0x1bdf('0x4d')](_0x32f3eb[_0x1bdf('0x49')][_0x1bdf('0x4d')]));_0x4cb5f0[_0x1bdf('0x5f')]=_0x4cb5f0[_0x1bdf('0x5f')][_0x1bdf('0x4e')]?_0x4cb5f0['attributes']:_0x2c6806['model'];if(!_0x32f3eb[_0x1bdf('0x49')]['hasOwnProperty'](_0x1bdf('0x50'))){_0x4cb5f0[_0x1bdf('0x32')]=qs[_0x1bdf('0x32')](_0x32f3eb[_0x1bdf('0x49')][_0x1bdf('0x32')]);_0x4cb5f0[_0x1bdf('0x2f')]=qs[_0x1bdf('0x2f')](_0x32f3eb[_0x1bdf('0x49')][_0x1bdf('0x2f')]);}_0x4cb5f0[_0x1bdf('0x51')]=qs['sort'](_0x32f3eb[_0x1bdf('0x49')][_0x1bdf('0x52')]);_0x4cb5f0[_0x1bdf('0x55')]=qs[_0x1bdf('0x4a')](_['pick'](_0x32f3eb[_0x1bdf('0x49')],_0x2c6806[_0x1bdf('0x4a')]));_0x4cb5f0[_0x1bdf('0x55')][_0x1bdf('0x70')]=_0x51fa02['id'];if(_0x32f3eb[_0x1bdf('0x49')]['filter']){_0x4cb5f0[_0x1bdf('0x55')]=_[_0x1bdf('0x56')](_0x4cb5f0[_0x1bdf('0x55')],{'$or':_[_0x1bdf('0x44')](_0x4cb5f0[_0x1bdf('0x5f')],function(_0x3fa75f){var _0x12dc71={};_0x12dc71[_0x3fa75f]={'$like':'%'+_0x32f3eb[_0x1bdf('0x49')]['filter']+'%'};return _0x12dc71;})});}_0x4cb5f0=_[_0x1bdf('0x56')]({},_0x4cb5f0,_0x32f3eb[_0x1bdf('0x58')]);return db[_0x1bdf('0xe2')][_0x1bdf('0x31')]({'where':_0x4cb5f0[_0x1bdf('0x55')]})[_0x1bdf('0x23')](function(_0x6a13bf){_0x3740a7[_0x1bdf('0x31')]=_0x6a13bf;if(_0x32f3eb['query']['includeAll']){_0x4cb5f0[_0x1bdf('0x5a')]=[{'all':!![]}];}else{_0x4cb5f0[_0x1bdf('0x5a')]=[{'model':db['CmContact'],'as':_0x1bdf('0x103'),'required':![]},{'model':db[_0x1bdf('0xe8')],'as':_0x1bdf('0x137'),'required':![]}];}return db[_0x1bdf('0xe2')][_0x1bdf('0x5b')](_0x4cb5f0);})[_0x1bdf('0x23')](function(_0x40a09a){_0x3740a7[_0x1bdf('0x5c')]=_0x40a09a;return _0x3740a7;});}})[_0x1bdf('0x23')](respondWithFilteredResult(_0x5262e5,_0x4cb5f0))[_0x1bdf('0x2d')](handleError(_0x5262e5,null));};exports[_0x1bdf('0x138')]=function(_0x38df5c,_0x49a729,_0x2d51a7){return db['ChatWebsite']['find']({'where':{'id':_0x38df5c['params']['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x49a729,null))[_0x1bdf('0x23')](function(_0x146ecb){if(_0x146ecb){return _0x146ecb[_0x1bdf('0x138')](_0x38df5c[_0x1bdf('0x62')][_0x1bdf('0x72')],_[_0x1bdf('0x101')](_0x38df5c[_0x1bdf('0x62')],[_0x1bdf('0x72'),'id'])||{})['spread'](function(_0x55235a){for(var _0x18cad2=0x0;_0x18cad2<_0x38df5c[_0x1bdf('0x62')][_0x1bdf('0x72')]['length'];_0x18cad2+=0x1){socket[_0x1bdf('0x139')](_0x1bdf('0x13a'),{'UserId':Number(_0x38df5c['body'][_0x1bdf('0x72')][_0x18cad2]),'ChatWebsiteId':Number(_0x38df5c[_0x1bdf('0x5e')]['id'])});}return _0x55235a;});}})[_0x1bdf('0x23')](respondWithResult(_0x49a729,null))[_0x1bdf('0x2d')](handleError(_0x49a729,null));};exports[_0x1bdf('0x13b')]=function(_0xa5f68b,_0x3b8797,_0x22afde){return db[_0x1bdf('0x45')][_0x1bdf('0x60')]({'where':{'id':_0xa5f68b[_0x1bdf('0x5e')]['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x3b8797,null))[_0x1bdf('0x23')](function(_0x134a53){if(_0x134a53){return _0x134a53[_0x1bdf('0x13b')](_0xa5f68b[_0x1bdf('0x49')][_0x1bdf('0x72')])[_0x1bdf('0x23')](function(){if(_[_0x1bdf('0x13c')](_0xa5f68b[_0x1bdf('0x49')][_0x1bdf('0x72')])){for(var _0x50643e=0x0;_0x50643e<_0xa5f68b[_0x1bdf('0x49')]['ids'][_0x1bdf('0x4e')];_0x50643e+=0x1){socket[_0x1bdf('0x139')](_0x1bdf('0x13d'),{'UserId':Number(_0xa5f68b[_0x1bdf('0x49')][_0x1bdf('0x72')][_0x50643e]),'ChatWebsiteId':Number(_0xa5f68b[_0x1bdf('0x5e')]['id'])});}}else{socket[_0x1bdf('0x139')](_0x1bdf('0x13d'),{'UserId':Number(_0xa5f68b[_0x1bdf('0x49')][_0x1bdf('0x72')]),'ChatWebsiteId':Number(_0xa5f68b[_0x1bdf('0x5e')]['id'])});}});}})[_0x1bdf('0x23')](respondWithStatusCode(_0x3b8797,null))[_0x1bdf('0x2d')](handleError(_0x3b8797,null));};exports[_0x1bdf('0x13e')]=function(_0x2230a0,_0x137241,_0x4a81fc){var _0x5be022={};var _0x2dbb11={};var _0xa0dee0;var _0x589293;return db[_0x1bdf('0x45')][_0x1bdf('0x6e')]({'where':{'id':_0x2230a0[_0x1bdf('0x5e')]['id']}})['then'](handleEntityNotFound(_0x137241,null))[_0x1bdf('0x23')](function(_0x46d544){if(_0x46d544){_0xa0dee0=_0x46d544;_0x2dbb11['model']=_['keys'](db['User'][_0x1bdf('0x6f')]);_0x2dbb11[_0x1bdf('0x49')]=_[_0x1bdf('0x48')](_0x2230a0[_0x1bdf('0x49')]);_0x2dbb11[_0x1bdf('0x4a')]=_['intersection'](_0x2dbb11[_0x1bdf('0x4c')],_0x2dbb11['query']);_0x5be022[_0x1bdf('0x5f')]=_['intersection'](_0x2dbb11['model'],qs[_0x1bdf('0x4d')](_0x2230a0[_0x1bdf('0x49')][_0x1bdf('0x4d')]));_0x5be022[_0x1bdf('0x5f')]=_0x5be022[_0x1bdf('0x5f')]['length']?_0x5be022[_0x1bdf('0x5f')]:_0x2dbb11[_0x1bdf('0x4c')];_0x5be022['order']=qs[_0x1bdf('0x52')](_0x2230a0['query'][_0x1bdf('0x52')]);_0x5be022[_0x1bdf('0x55')]=qs[_0x1bdf('0x4a')](_[_0x1bdf('0x53')](_0x2230a0['query'],_0x2dbb11['filters']));if(_0x2230a0['query'][_0x1bdf('0x54')]){_0x5be022['where']=_[_0x1bdf('0x56')](_0x5be022[_0x1bdf('0x55')],{'$or':_[_0x1bdf('0x44')](_0x5be022['attributes'],function(_0xf0deda){var _0x6ad04d={};_0x6ad04d[_0xf0deda]={'$like':'%'+_0x2230a0['query'][_0x1bdf('0x54')]+'%'};return _0x6ad04d;})});}_0x5be022=_[_0x1bdf('0x56')]({},_0x5be022,_0x2230a0[_0x1bdf('0x58')]);return _0xa0dee0[_0x1bdf('0x13e')](_0x5be022);}})['then'](function(_0x4085b3){if(_0x4085b3){_0x589293=_0x4085b3['length'];if(!_0x2230a0[_0x1bdf('0x49')]['hasOwnProperty'](_0x1bdf('0x50'))){_0x5be022[_0x1bdf('0x32')]=qs['limit'](_0x2230a0[_0x1bdf('0x49')][_0x1bdf('0x32')]);_0x5be022[_0x1bdf('0x2f')]=qs[_0x1bdf('0x2f')](_0x2230a0['query'][_0x1bdf('0x2f')]);}return _0xa0dee0[_0x1bdf('0x13e')](_0x5be022);}})['then'](function(_0x4e76ae){if(_0x4e76ae){return _0x4e76ae?{'count':_0x589293,'rows':_0x4e76ae}:null;}})[_0x1bdf('0x23')](respondWithResult(_0x137241,null))['catch'](handleError(_0x137241,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 44f87be..bccf6be 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 _0x0ef0=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x18eb51,_0x2106a6){var _0x168a91=function(_0x1239ec){while(--_0x1239ec){_0x18eb51['push'](_0x18eb51['shift']());}};_0x168a91(++_0x2106a6);}(_0x0ef0,0x80));var _0x00ef=function(_0xbbcb36,_0x586383){_0xbbcb36=_0xbbcb36-0x0;var _0x4278ff=_0x0ef0[_0xbbcb36];return _0x4278ff;};'use strict';var EventEmitter=require(_0x00ef('0x0'));var ChatWebsite=require(_0x00ef('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x00ef('0x2')](0x0);var events={'afterCreate':_0x00ef('0x3'),'afterUpdate':_0x00ef('0x4'),'afterDestroy':_0x00ef('0x5')};function emitEvent(_0xd4ab59){return function(_0x92e0b,_0x53bad3,_0x5743e8){ChatWebsiteEvents[_0x00ef('0x6')](_0xd4ab59+':'+_0x92e0b['id'],_0x92e0b);ChatWebsiteEvents[_0x00ef('0x6')](_0xd4ab59,_0x92e0b);_0x5743e8(null);};}for(var e in events){if(events[_0x00ef('0x7')](e)){var event=events[e];ChatWebsite[_0x00ef('0x8')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x95d9=['ChatWebsite','setMaxListeners','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x55c937,_0x4136f7){var _0xc45fad=function(_0xf2e4c){while(--_0xf2e4c){_0x55c937['push'](_0x55c937['shift']());}};_0xc45fad(++_0x4136f7);}(_0x95d9,0x97));var _0x995d=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x95d9[_0x2c91e9];return _0x13f0ff;};'use strict';var EventEmitter=require(_0x995d('0x0'));var ChatWebsite=require(_0x995d('0x1'))['db'][_0x995d('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x995d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x995d('0x4'),'afterDestroy':_0x995d('0x5')};function emitEvent(_0x1932c3){return function(_0x5b44d3,_0x225c17,_0x14e096){ChatWebsiteEvents[_0x995d('0x6')](_0x1932c3+':'+_0x5b44d3['id'],_0x5b44d3);ChatWebsiteEvents[_0x995d('0x6')](_0x1932c3,_0x5b44d3);_0x14e096(null);};}for(var e in events){if(events[_0x995d('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x995d('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index d209c41..a2b74bb 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 _0xb141=['request-promise','path','rimraf','../../config/environment','exports','define','ChatWebsite','chat_websites','util','../../config/logger','api','moment','bluebird'];(function(_0x1cfa05,_0x1e866c){var _0xbfed13=function(_0x1f92f7){while(--_0x1f92f7){_0x1cfa05['push'](_0x1cfa05['shift']());}};_0xbfed13(++_0x1e866c);}(_0xb141,0xff));var _0x1b14=function(_0x2d0733,_0x5a1e06){_0x2d0733=_0x2d0733-0x0;var _0x50ad90=_0xb141[_0x2d0733];return _0x50ad90;};'use strict';var _=require('lodash');var util=require(_0x1b14('0x0'));var logger=require(_0x1b14('0x1'))(_0x1b14('0x2'));var moment=require(_0x1b14('0x3'));var BPromise=require(_0x1b14('0x4'));var rp=require(_0x1b14('0x5'));var fs=require('fs');var path=require(_0x1b14('0x6'));var rimraf=require(_0x1b14('0x7'));var config=require(_0x1b14('0x8'));var attributes=require('./chatWebsite.attributes');module[_0x1b14('0x9')]=function(_0x4c4d84,_0x17dc71){return _0x4c4d84[_0x1b14('0xa')](_0x1b14('0xb'),attributes,{'tableName':_0x1b14('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf184=['exports','ChatWebsite','chat_websites','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf184,0x179));var _0x4f18=function(_0x4ce028,_0x526d4b){_0x4ce028=_0x4ce028-0x0;var _0x583d0c=_0xf184[_0x4ce028];return _0x583d0c;};'use strict';var _=require(_0x4f18('0x0'));var util=require(_0x4f18('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4f18('0x2'));var BPromise=require('bluebird');var rp=require(_0x4f18('0x3'));var fs=require('fs');var path=require(_0x4f18('0x4'));var rimraf=require(_0x4f18('0x5'));var config=require(_0x4f18('0x6'));var attributes=require(_0x4f18('0x7'));module[_0x4f18('0x8')]=function(_0x3eb330,_0x4688f5){return _0x3eb330['define'](_0x4f18('0x9'),attributes,{'tableName':_0x4f18('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index dc6583e..e8899a7 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 _0x1ac3=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','then','info','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x370157,_0x11077f){var _0x5495c6=function(_0x3f21d8){while(--_0x3f21d8){_0x370157['push'](_0x370157['shift']());}};_0x5495c6(++_0x11077f);}(_0x1ac3,0x13f));var _0x31ac=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x1ac3[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0x31ac('0x0'));var util=require('util');var moment=require(_0x31ac('0x1'));var BPromise=require('bluebird');var rs=require(_0x31ac('0x2'));var fs=require('fs');var Redis=require(_0x31ac('0x3'));var db=require(_0x31ac('0x4'))['db'];var utils=require(_0x31ac('0x5'));var logger=require(_0x31ac('0x6'))(_0x31ac('0x7'));var config=require(_0x31ac('0x8'));var jayson=require(_0x31ac('0x9'));var client=jayson[_0x31ac('0xa')]['http']({'port':0x232a});config[_0x31ac('0xb')]=_[_0x31ac('0xc')](config[_0x31ac('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x31ac('0xd'))(new Redis(config[_0x31ac('0xb')]));require(_0x31ac('0xe'))[_0x31ac('0xf')](socket);function respondWithRpcPromise(_0x581261,_0x4726c2,_0x154cac){return new BPromise(function(_0x21ad1e,_0x1cfd8d){return client['request'](_0x581261,_0x154cac)[_0x31ac('0x10')](function(_0x13b6f8){logger[_0x31ac('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x4726c2,'request\x20sent');logger[_0x31ac('0x12')](_0x31ac('0x13'),_0x4726c2,_0x31ac('0x14'),JSON[_0x31ac('0x15')](_0x13b6f8));if(_0x13b6f8[_0x31ac('0x16')]){if(_0x13b6f8[_0x31ac('0x16')][_0x31ac('0x17')]===0x1f4){logger[_0x31ac('0x16')](_0x31ac('0x18'),_0x4726c2,_0x13b6f8[_0x31ac('0x16')]['message']);return _0x1cfd8d(_0x13b6f8['error'][_0x31ac('0x19')]);}logger[_0x31ac('0x16')](_0x31ac('0x18'),_0x4726c2,_0x13b6f8[_0x31ac('0x16')][_0x31ac('0x19')]);return _0x21ad1e(_0x13b6f8[_0x31ac('0x16')][_0x31ac('0x19')]);}else{logger[_0x31ac('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x4726c2,_0x31ac('0x14'));_0x21ad1e(_0x13b6f8['result'][_0x31ac('0x19')]);}})[_0x31ac('0x1a')](function(_0x2c1532){logger['error'](_0x31ac('0x18'),_0x4726c2,_0x2c1532);_0x1cfd8d(_0x2c1532);});});} \ No newline at end of file +var _0xbe86=['debug','stringify','error','ChatWebsite,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','then','info'];(function(_0x20834a,_0x471f90){var _0x33da2d=function(_0x22a346){while(--_0x22a346){_0x20834a['push'](_0x20834a['shift']());}};_0x33da2d(++_0x471f90);}(_0xbe86,0x84));var _0x6be8=function(_0xab0515,_0x4b8ab2){_0xab0515=_0xab0515-0x0;var _0x443d59=_0xbe86[_0xab0515];return _0x443d59;};'use strict';var _=require(_0x6be8('0x0'));var util=require(_0x6be8('0x1'));var moment=require(_0x6be8('0x2'));var BPromise=require('bluebird');var rs=require(_0x6be8('0x3'));var fs=require('fs');var Redis=require(_0x6be8('0x4'));var db=require(_0x6be8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6be8('0x6'))('rpc');var config=require(_0x6be8('0x7'));var jayson=require(_0x6be8('0x8'));var client=jayson[_0x6be8('0x9')][_0x6be8('0xa')]({'port':0x232a});config[_0x6be8('0xb')]=_[_0x6be8('0xc')](config[_0x6be8('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6be8('0xd'))(new Redis(config[_0x6be8('0xb')]));require(_0x6be8('0xe'))[_0x6be8('0xf')](socket);function respondWithRpcPromise(_0x5136ff,_0x34c93e,_0x2f2144){return new BPromise(function(_0x55632d,_0x2a151e){return client['request'](_0x5136ff,_0x2f2144)[_0x6be8('0x10')](function(_0x3c3c4d){logger[_0x6be8('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x34c93e,'request\x20sent');logger[_0x6be8('0x12')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x34c93e,'request\x20sent',JSON[_0x6be8('0x13')](_0x3c3c4d));if(_0x3c3c4d[_0x6be8('0x14')]){if(_0x3c3c4d[_0x6be8('0x14')]['code']===0x1f4){logger['error'](_0x6be8('0x15'),_0x34c93e,_0x3c3c4d[_0x6be8('0x14')][_0x6be8('0x16')]);return _0x2a151e(_0x3c3c4d[_0x6be8('0x14')][_0x6be8('0x16')]);}logger[_0x6be8('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x34c93e,_0x3c3c4d[_0x6be8('0x14')][_0x6be8('0x16')]);return _0x55632d(_0x3c3c4d[_0x6be8('0x14')]['message']);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x34c93e,_0x6be8('0x17'));_0x55632d(_0x3c3c4d[_0x6be8('0x18')][_0x6be8('0x16')]);}})['catch'](function(_0x3e34de){logger[_0x6be8('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x34c93e,_0x3e34de);_0x2a151e(_0x3e34de);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index c4749ef..5ad8731 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 _0x33df=['chatWebsite:','./chatWebsite.events','save','remove','emit','removeListener','register'];(function(_0x301c34,_0x15701e){var _0x1a8c5a=function(_0x297b4f){while(--_0x297b4f){_0x301c34['push'](_0x301c34['shift']());}};_0x1a8c5a(++_0x15701e);}(_0x33df,0xe8));var _0xf33d=function(_0x4a9a17,_0x273a09){_0x4a9a17=_0x4a9a17-0x0;var _0x30e831=_0x33df[_0x4a9a17];return _0x30e831;};'use strict';var ChatWebsiteEvents=require(_0xf33d('0x0'));var events=[_0xf33d('0x1'),_0xf33d('0x2'),'update'];function createListener(_0x5ed991,_0x56e54a){return function(_0x784518){_0x56e54a[_0xf33d('0x3')](_0x5ed991,_0x784518);};}function removeListener(_0x39bc46,_0x28cdc4){return function(){ChatWebsiteEvents[_0xf33d('0x4')](_0x39bc46,_0x28cdc4);};}exports[_0xf33d('0x5')]=function(_0x3faa4d){for(var _0x44d3e1=0x0,_0x28ca1b=events['length'];_0x44d3e1<_0x28ca1b;_0x44d3e1++){var _0x4cc46a=events[_0x44d3e1];var _0x42d525=createListener(_0xf33d('0x6')+_0x4cc46a,_0x3faa4d);ChatWebsiteEvents['on'](_0x4cc46a,_0x42d525);}}; \ No newline at end of file +var _0x698a=['length','chatWebsite:','save','remove','update','emit','removeListener','register'];(function(_0x4475ce,_0xea730){var _0xf5f37a=function(_0x4a21e5){while(--_0x4a21e5){_0x4475ce['push'](_0x4475ce['shift']());}};_0xf5f37a(++_0xea730);}(_0x698a,0x1ca));var _0xa698=function(_0x45050c,_0x2c514e){_0x45050c=_0x45050c-0x0;var _0x43be36=_0x698a[_0x45050c];return _0x43be36;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xa698('0x0'),_0xa698('0x1'),_0xa698('0x2')];function createListener(_0x289d97,_0x45ea3e){return function(_0x3bd56d){_0x45ea3e[_0xa698('0x3')](_0x289d97,_0x3bd56d);};}function removeListener(_0x3bfcac,_0x519618){return function(){ChatWebsiteEvents[_0xa698('0x4')](_0x3bfcac,_0x519618);};}exports[_0xa698('0x5')]=function(_0x267a9c){for(var _0x1fe135=0x0,_0x1b6de6=events[_0xa698('0x6')];_0x1fe135<_0x1b6de6;_0x1fe135++){var _0x240f17=events[_0x1fe135];var _0x5832d0=createListener(_0xa698('0x7')+_0x240f17,_0x267a9c);ChatWebsiteEvents['on'](_0x240f17,_0x5832d0);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 9017043..f9193db 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 _0xbe67=['join','server/files','attachments','offline-chat','ensureDir','replace','/:id/offline','any','offline','/:id/interactions','addApplications','/:id/proactive_actions','addAgents','put','update','destroy','delete','removeAnswers','removeAgents','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','root','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','format','addCustomerAvatar'];(function(_0x2666b3,_0x18481e){var _0x2ab92a=function(_0x3139c9){while(--_0x3139c9){_0x2666b3['push'](_0x2666b3['shift']());}};_0x2ab92a(++_0x18481e);}(_0xbe67,0x1be));var _0x7be6=function(_0x415648,_0x34761f){_0x415648=_0x415648-0x0;var _0x5c8ded=_0xbe67[_0x415648];return _0x5c8ded;};'use strict';var multer=require(_0x7be6('0x0'));var util=require(_0x7be6('0x1'));var path=require(_0x7be6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x7be6('0x3'));var auth=require(_0x7be6('0x4'));var interaction=require(_0x7be6('0x5'));var config=require(_0x7be6('0x6'));var controller=require('./chatWebsite.controller');router['get']('/',auth[_0x7be6('0x7')](),controller[_0x7be6('0x8')]);router[_0x7be6('0x9')](_0x7be6('0xa'),auth[_0x7be6('0x7')](),controller['describe']);router['get'](_0x7be6('0xb'),auth[_0x7be6('0x7')](),controller[_0x7be6('0xc')]);router[_0x7be6('0x9')](_0x7be6('0xd'),auth[_0x7be6('0x7')](),controller[_0x7be6('0xe')]);router[_0x7be6('0x9')](_0x7be6('0xf'),auth[_0x7be6('0x7')](),controller[_0x7be6('0x10')]);router['get'](_0x7be6('0x11'),controller[_0x7be6('0x12')]);router[_0x7be6('0x9')](_0x7be6('0x13'),controller[_0x7be6('0x14')]);router['get'](_0x7be6('0x15'),controller[_0x7be6('0x16')]);router[_0x7be6('0x9')](_0x7be6('0x17'),controller[_0x7be6('0x18')]);router[_0x7be6('0x9')]('/:id/interactions',auth['isAuthenticated'](),controller['getInteractions']);router[_0x7be6('0x9')](_0x7be6('0x19'),controller[_0x7be6('0x1a')]);router[_0x7be6('0x9')](_0x7be6('0x1b'),auth[_0x7be6('0x7')](),controller[_0x7be6('0x1c')]);router['get']('/:id/proactive_actions',auth[_0x7be6('0x7')](),controller[_0x7be6('0x1d')]);router[_0x7be6('0x9')](_0x7be6('0x1e'),controller[_0x7be6('0x1f')]);router[_0x7be6('0x9')](_0x7be6('0x20'),auth[_0x7be6('0x7')](),controller[_0x7be6('0x21')]);router[_0x7be6('0x9')](_0x7be6('0x22'),auth['isAuthenticated'](),controller[_0x7be6('0x23')]);router[_0x7be6('0x24')]('/',auth['isAuthenticated'](),controller[_0x7be6('0x25')]);router[_0x7be6('0x24')]('/:id/dispositions',auth[_0x7be6('0x7')](),controller[_0x7be6('0x26')]);router[_0x7be6('0x24')](_0x7be6('0xf'),auth[_0x7be6('0x7')](),controller[_0x7be6('0x27')]);var upload=multer({'storage':multer[_0x7be6('0x28')]({'destination':function(_0x317bd7,_0x386aba,_0x1f6b3a){_0x1f6b3a(null,path['join'](config[_0x7be6('0x29')],'server/files/images/logos/'));},'filename':function(_0x46e511,_0xac4aa8,_0x342a69){_0x342a69(null,util['format'](_0x7be6('0x2a'),Date[_0x7be6('0x2b')](),_0xac4aa8[_0x7be6('0x2c')]));}})});router[_0x7be6('0x24')]('/:id/logo',upload[_0x7be6('0x2d')](_0x7be6('0x2e')),controller[_0x7be6('0x2f')]);var upload=multer({'storage':multer[_0x7be6('0x28')]({'destination':function(_0x35cfc4,_0x2f12c1,_0x5a4978){_0x5a4978(null,path['join'](config[_0x7be6('0x29')],_0x7be6('0x30')));},'filename':function(_0x1480b0,_0x4caf04,_0x4107ec){_0x4107ec(null,util[_0x7be6('0x31')](_0x7be6('0x2a'),Date[_0x7be6('0x2b')](),_0x4caf04[_0x7be6('0x2c')]));}})});router['post']('/:id/avatar',upload[_0x7be6('0x2d')](_0x7be6('0x2e')),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x492a5d,_0x159a3d,_0x1faf1e){_0x1faf1e(null,path['join'](config[_0x7be6('0x29')],_0x7be6('0x30')));},'filename':function(_0x8f2b0c,_0x22c21c,_0x3655a2){_0x3655a2(null,util[_0x7be6('0x31')]('%s-%s',Date[_0x7be6('0x2b')](),_0x22c21c[_0x7be6('0x2c')]));}})});router[_0x7be6('0x24')](_0x7be6('0x15'),upload['single'](_0x7be6('0x2e')),controller[_0x7be6('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d3dfb,_0x6b67e4,_0x3d2088){_0x3d2088(null,path[_0x7be6('0x33')](config[_0x7be6('0x29')],_0x7be6('0x30')));},'filename':function(_0x43a43,_0x519025,_0x4522c0){_0x4522c0(null,util[_0x7be6('0x31')]('%s-%s',Date[_0x7be6('0x2b')](),_0x519025['originalname']));}})});router[_0x7be6('0x24')]('/:id/system_avatar',upload[_0x7be6('0x2d')](_0x7be6('0x2e')),controller['addSystemAvatar']);router[_0x7be6('0x24')]('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x7be6('0x28')]({'destination':function(_0x406bb3,_0x37a2d7,_0x25f019){const _0x4282d1=path[_0x7be6('0x33')](config['root'],_0x7be6('0x34'),_0x7be6('0x35'),_0x7be6('0x36'));fs_extra[_0x7be6('0x37')](_0x4282d1,function(){_0x25f019(null,_0x4282d1);});},'filename':function(_0x2a63e5,_0x48ce01,_0x4b2a5c){const _0x36b4ad=_0x48ce01[_0x7be6('0x2c')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1ec921=path['extname'](_0x36b4ad);const _0x16efee=Date[_0x7be6('0x2b')]()+'-'+_0x36b4ad[_0x7be6('0x38')](_0x1ec921,'')+_0x1ec921;_0x4b2a5c(null,_0x16efee);}})});router['post'](_0x7be6('0x39'),offlineUploadMulter[_0x7be6('0x3a')](),controller[_0x7be6('0x3b')]);router['post'](_0x7be6('0x3c'),auth['isAuthenticated'](),controller['addInteraction']);router[_0x7be6('0x24')](_0x7be6('0x1b'),auth['isAuthenticated'](),controller[_0x7be6('0x3d')]);router[_0x7be6('0x24')](_0x7be6('0x3e'),auth[_0x7be6('0x7')](),controller['addProactiveActions']);router['post'](_0x7be6('0x22'),auth['isAuthenticated'](),controller[_0x7be6('0x3f')]);router[_0x7be6('0x40')]('/:id',auth[_0x7be6('0x7')](),controller[_0x7be6('0x41')]);router['delete']('/:id',auth[_0x7be6('0x7')](),controller[_0x7be6('0x42')]);router[_0x7be6('0x43')](_0x7be6('0xd'),auth[_0x7be6('0x7')](),controller['removeDispositions']);router['delete'](_0x7be6('0xf'),auth[_0x7be6('0x7')](),controller[_0x7be6('0x44')]);router[_0x7be6('0x43')]('/:id/users',auth['isAuthenticated'](),controller[_0x7be6('0x45')]);module[_0x7be6('0x46')]=router; \ No newline at end of file +var _0xa48d=['/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','now','originalname','file','single','addAvatar','addCustomerAvatar','server/files/images/avatars/','addSystemAvatar','/:id/notify','notify','join','server/files','ensureDir','extname','/:id/offline','offline','addApplications','addProactiveActions','put','update','delete','destroy','removeAnswers','exports','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo'];(function(_0x4bc221,_0x51adfe){var _0x188462=function(_0x147bee){while(--_0x147bee){_0x4bc221['push'](_0x4bc221['shift']());}};_0x188462(++_0x51adfe);}(_0xa48d,0xc2));var _0xda48=function(_0x4f53d8,_0x3c45fa){_0x4f53d8=_0x4f53d8-0x0;var _0x537643=_0xa48d[_0x4f53d8];return _0x537643;};'use strict';var multer=require('multer');var util=require(_0xda48('0x0'));var path=require(_0xda48('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xda48('0x2')]();var fs_extra=require(_0xda48('0x3'));var auth=require(_0xda48('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xda48('0x5'));var controller=require(_0xda48('0x6'));router[_0xda48('0x7')]('/',auth[_0xda48('0x8')](),controller[_0xda48('0x9')]);router['get'](_0xda48('0xa'),auth[_0xda48('0x8')](),controller[_0xda48('0xb')]);router[_0xda48('0x7')](_0xda48('0xc'),auth[_0xda48('0x8')](),controller[_0xda48('0xd')]);router[_0xda48('0x7')](_0xda48('0xe'),auth[_0xda48('0x8')](),controller[_0xda48('0xf')]);router['get']('/:id/canned_answers',auth[_0xda48('0x8')](),controller[_0xda48('0x10')]);router[_0xda48('0x7')](_0xda48('0x11'),controller[_0xda48('0x12')]);router['get'](_0xda48('0x13'),controller[_0xda48('0x14')]);router['get'](_0xda48('0x15'),controller['getCustomerAvatar']);router[_0xda48('0x7')](_0xda48('0x16'),controller[_0xda48('0x17')]);router['get'](_0xda48('0x18'),auth[_0xda48('0x8')](),controller[_0xda48('0x19')]);router[_0xda48('0x7')](_0xda48('0x1a'),controller[_0xda48('0x1b')]);router[_0xda48('0x7')](_0xda48('0x1c'),auth[_0xda48('0x8')](),controller[_0xda48('0x1d')]);router[_0xda48('0x7')](_0xda48('0x1e'),auth[_0xda48('0x8')](),controller[_0xda48('0x1f')]);router[_0xda48('0x7')](_0xda48('0x20'),controller[_0xda48('0x21')]);router['get'](_0xda48('0x22'),auth[_0xda48('0x8')](),controller[_0xda48('0x23')]);router[_0xda48('0x7')](_0xda48('0x24'),auth['isAuthenticated'](),controller[_0xda48('0x25')]);router[_0xda48('0x26')]('/',auth['isAuthenticated'](),controller[_0xda48('0x27')]);router['post'](_0xda48('0xe'),auth[_0xda48('0x8')](),controller[_0xda48('0x28')]);router[_0xda48('0x26')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xda48('0x29')]);var upload=multer({'storage':multer[_0xda48('0x2a')]({'destination':function(_0x110fd3,_0xebb5f3,_0x2dc021){_0x2dc021(null,path['join'](config[_0xda48('0x2b')],_0xda48('0x2c')));},'filename':function(_0x9a4a0b,_0x47ae40,_0x1b1b71){_0x1b1b71(null,util[_0xda48('0x2d')](_0xda48('0x2e'),Date[_0xda48('0x2f')](),_0x47ae40[_0xda48('0x30')]));}})});router[_0xda48('0x26')](_0xda48('0x11'),upload['single'](_0xda48('0x31')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x22b969,_0x1a18af,_0x3d99be){_0x3d99be(null,path['join'](config[_0xda48('0x2b')],'server/files/images/avatars/'));},'filename':function(_0x50515e,_0x5f1f8b,_0x4dffaa){_0x4dffaa(null,util[_0xda48('0x2d')](_0xda48('0x2e'),Date['now'](),_0x5f1f8b[_0xda48('0x30')]));}})});router[_0xda48('0x26')](_0xda48('0x13'),upload[_0xda48('0x32')](_0xda48('0x31')),controller[_0xda48('0x33')]);var upload=multer({'storage':multer[_0xda48('0x2a')]({'destination':function(_0x23d9b5,_0x4477a1,_0x1f0a65){_0x1f0a65(null,path['join'](config[_0xda48('0x2b')],'server/files/images/avatars/'));},'filename':function(_0x77a1f,_0x4d0e34,_0x5d5263){_0x5d5263(null,util['format']('%s-%s',Date[_0xda48('0x2f')](),_0x4d0e34[_0xda48('0x30')]));}})});router[_0xda48('0x26')](_0xda48('0x15'),upload['single'](_0xda48('0x31')),controller[_0xda48('0x34')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x48d38a,_0x508268,_0x3237d1){_0x3237d1(null,path['join'](config[_0xda48('0x2b')],_0xda48('0x35')));},'filename':function(_0x2bb4a5,_0x32f533,_0x11767e){_0x11767e(null,util[_0xda48('0x2d')](_0xda48('0x2e'),Date[_0xda48('0x2f')](),_0x32f533['originalname']));}})});router[_0xda48('0x26')](_0xda48('0x16'),upload[_0xda48('0x32')](_0xda48('0x31')),controller[_0xda48('0x36')]);router[_0xda48('0x26')](_0xda48('0x37'),controller[_0xda48('0x38')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x120be8,_0x5febbd,_0x5790f2){const _0x1b508e=path[_0xda48('0x39')](config[_0xda48('0x2b')],_0xda48('0x3a'),'attachments','offline-chat');fs_extra[_0xda48('0x3b')](_0x1b508e,function(){_0x5790f2(null,_0x1b508e);});},'filename':function(_0x2d19b4,_0x28d420,_0x3ae3ac){const _0x504d34=_0x28d420[_0xda48('0x30')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x3831f8=path[_0xda48('0x3c')](_0x504d34);const _0x544e45=Date['now']()+'-'+_0x504d34['replace'](_0x3831f8,'')+_0x3831f8;_0x3ae3ac(null,_0x544e45);}})});router[_0xda48('0x26')](_0xda48('0x3d'),offlineUploadMulter['any'](),controller[_0xda48('0x3e')]);router['post'](_0xda48('0x18'),auth['isAuthenticated'](),controller['addInteraction']);router[_0xda48('0x26')]('/:id/applications',auth[_0xda48('0x8')](),controller[_0xda48('0x3f')]);router[_0xda48('0x26')](_0xda48('0x1e'),auth[_0xda48('0x8')](),controller[_0xda48('0x40')]);router['post'](_0xda48('0x24'),auth[_0xda48('0x8')](),controller['addAgents']);router[_0xda48('0x41')]('/:id',auth[_0xda48('0x8')](),controller[_0xda48('0x42')]);router[_0xda48('0x43')](_0xda48('0xc'),auth[_0xda48('0x8')](),controller[_0xda48('0x44')]);router['delete'](_0xda48('0xe'),auth[_0xda48('0x8')](),controller['removeDispositions']);router[_0xda48('0x43')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xda48('0x45')]);router['delete'](_0xda48('0x24'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xda48('0x46')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index d4ef56f..1573591 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 _0x4e47=['ENUM','AmazonAWS','Google','STRING'];(function(_0x21973a,_0xef5df8){var _0x2fb112=function(_0x4cf4fb){while(--_0x4cf4fb){_0x21973a['push'](_0x21973a['shift']());}};_0x2fb112(++_0xef5df8);}(_0x4e47,0x17f));var _0x74e4=function(_0x488389,_0x31e284){_0x488389=_0x488389-0x0;var _0x5b28ac=_0x4e47[_0x488389];return _0x5b28ac;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x74e4('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x74e4('0x1')](_0x74e4('0x2'),_0x74e4('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x74e4('0x0')]},'data2':{'type':Sequelize[_0x74e4('0x0')]}}; \ No newline at end of file +var _0xf072=['exports','STRING','AmazonAWS','sequelize'];(function(_0x43d332,_0x1c31c3){var _0x386c3b=function(_0x40702b){while(--_0x40702b){_0x43d332['push'](_0x43d332['shift']());}};_0x386c3b(++_0x1c31c3);}(_0xf072,0x1cf));var _0x2f07=function(_0x471bc2,_0x55c430){_0x471bc2=_0x471bc2-0x0;var _0x16d4ce=_0xf072[_0x471bc2];return _0x16d4ce;};'use strict';var Sequelize=require(_0x2f07('0x0'));module[_0x2f07('0x1')]={'name':{'type':Sequelize[_0x2f07('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x2f07('0x3'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x2f07('0x2')]},'data2':{'type':Sequelize[_0x2f07('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index bad5b3f..858306e 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 _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','CloudProvider','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(_0x3faf85,_0x272107){var _0x496c38=function(_0x4500b0){while(--_0x4500b0){_0x3faf85['push'](_0x3faf85['shift']());}};_0x496c38(++_0x272107);}(_0x2ef3,0xba));var _0x32ef=function(_0x3c53b4,_0x242a4c){_0x3c53b4=_0x3c53b4-0x0;var _0x2e1c4a=_0x2ef3[_0x3c53b4];return _0x2e1c4a;};'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['CloudProvider'][_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['CloudProvider'][_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['CloudProvider']['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 +var _0x7a54=['offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','CloudProvider','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x228279,_0x15e195){var _0xc48574=function(_0x4f9e55){while(--_0x4f9e55){_0x228279['push'](_0x228279['shift']());}};_0xc48574(++_0x15e195);}(_0x7a54,0x106));var _0x47a5=function(_0x1c08f4,_0x2f2b7f){_0x1c08f4=_0x1c08f4-0x0;var _0x45e9b7=_0x7a54[_0x1c08f4];return _0x45e9b7;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['CloudProvider'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['CloudProvider']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['CloudProvider']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index cd08ad2..c85f376 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 _0x2b72=['CloudProvider','cloud_providers','lodash','util','api','moment','request-promise','path','rimraf','./cloudProvider.attributes','exports','define'];(function(_0xb4a44b,_0xb8870c){var _0x583792=function(_0x37cbdc){while(--_0x37cbdc){_0xb4a44b['push'](_0xb4a44b['shift']());}};_0x583792(++_0xb8870c);}(_0x2b72,0x13a));var _0x22b7=function(_0x18b4e8,_0x30e9e1){_0x18b4e8=_0x18b4e8-0x0;var _0x4b6265=_0x2b72[_0x18b4e8];return _0x4b6265;};'use strict';var _=require(_0x22b7('0x0'));var util=require(_0x22b7('0x1'));var logger=require('../../config/logger')(_0x22b7('0x2'));var moment=require(_0x22b7('0x3'));var BPromise=require('bluebird');var rp=require(_0x22b7('0x4'));var fs=require('fs');var path=require(_0x22b7('0x5'));var rimraf=require(_0x22b7('0x6'));var config=require('../../config/environment');var attributes=require(_0x22b7('0x7'));module[_0x22b7('0x8')]=function(_0x2727a3,_0x5dcfd5){return _0x2727a3[_0x22b7('0x9')](_0x22b7('0xa'),attributes,{'tableName':_0x22b7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x49f2=['api','moment','request-promise','path','../../config/environment','exports','define','cloud_providers','lodash','util','../../config/logger'];(function(_0x2dac34,_0x1aeb5e){var _0x7a0bf=function(_0x528fe5){while(--_0x528fe5){_0x2dac34['push'](_0x2dac34['shift']());}};_0x7a0bf(++_0x1aeb5e);}(_0x49f2,0x11b));var _0x249f=function(_0x167914,_0x1a5418){_0x167914=_0x167914-0x0;var _0x422c8e=_0x49f2[_0x167914];return _0x422c8e;};'use strict';var _=require(_0x249f('0x0'));var util=require(_0x249f('0x1'));var logger=require(_0x249f('0x2'))(_0x249f('0x3'));var moment=require(_0x249f('0x4'));var BPromise=require('bluebird');var rp=require(_0x249f('0x5'));var fs=require('fs');var path=require(_0x249f('0x6'));var rimraf=require('rimraf');var config=require(_0x249f('0x7'));var attributes=require('./cloudProvider.attributes');module[_0x249f('0x8')]=function(_0xf6d991,_0x627e1b){return _0xf6d991[_0x249f('0x9')]('CloudProvider',attributes,{'tableName':_0x249f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 08a076c..fe5588c 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 _0x1122=['CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x2d7bc0,_0x10d7b7){var _0x58fe96=function(_0x6eab7c){while(--_0x6eab7c){_0x2d7bc0['push'](_0x2d7bc0['shift']());}};_0x58fe96(++_0x10d7b7);}(_0x1122,0xac));var _0x2112=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1122[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2112('0x0'));var util=require('util');var moment=require(_0x2112('0x1'));var BPromise=require(_0x2112('0x2'));var rs=require(_0x2112('0x3'));var fs=require('fs');var Redis=require(_0x2112('0x4'));var db=require(_0x2112('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2112('0x6'));var config=require('../../config/environment');var jayson=require(_0x2112('0x7'));var client=jayson[_0x2112('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xcca285,_0x2ad731,_0x3f0a81){return new BPromise(function(_0x272bdb,_0x4190c7){return client[_0x2112('0x9')](_0xcca285,_0x3f0a81)[_0x2112('0xa')](function(_0x2f7142){logger[_0x2112('0xb')]('CloudProvider,\x20%s,\x20%s',_0x2ad731,_0x2112('0xc'));logger[_0x2112('0xd')](_0x2112('0xe'),_0x2ad731,_0x2112('0xc'),JSON['stringify'](_0x2f7142));if(_0x2f7142[_0x2112('0xf')]){if(_0x2f7142[_0x2112('0xf')][_0x2112('0x10')]===0x1f4){logger[_0x2112('0xf')](_0x2112('0x11'),_0x2ad731,_0x2f7142[_0x2112('0xf')][_0x2112('0x12')]);return _0x4190c7(_0x2f7142['error'][_0x2112('0x12')]);}logger['error'](_0x2112('0x11'),_0x2ad731,_0x2f7142[_0x2112('0xf')]['message']);return _0x272bdb(_0x2f7142[_0x2112('0xf')]['message']);}else{logger[_0x2112('0xb')]('CloudProvider,\x20%s,\x20%s',_0x2ad731,_0x2112('0xc'));_0x272bdb(_0x2f7142[_0x2112('0x13')]['message']);}})[_0x2112('0x14')](function(_0x4db5c3){logger[_0x2112('0xf')]('CloudProvider,\x20%s,\x20%s',_0x2ad731,_0x4db5c3);_0x4190c7(_0x4db5c3);});});} \ No newline at end of file +var _0xa958=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','error','message','lodash','moment','bluebird','randomstring'];(function(_0x2e15db,_0x5541ea){var _0x1d022e=function(_0x5097de){while(--_0x5097de){_0x2e15db['push'](_0x2e15db['shift']());}};_0x1d022e(++_0x5541ea);}(_0xa958,0x94));var _0x8a95=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xa958[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x8a95('0x0'));var util=require('util');var moment=require(_0x8a95('0x1'));var BPromise=require(_0x8a95('0x2'));var rs=require(_0x8a95('0x3'));var fs=require('fs');var Redis=require(_0x8a95('0x4'));var db=require(_0x8a95('0x5'))['db'];var utils=require(_0x8a95('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8a95('0x7'));var jayson=require(_0x8a95('0x8'));var client=jayson[_0x8a95('0x9')][_0x8a95('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x387db4,_0xdd54e1,_0x161f00){return new BPromise(function(_0x49287d,_0xe03b31){return client[_0x8a95('0xb')](_0x387db4,_0x161f00)[_0x8a95('0xc')](function(_0x240b22){logger[_0x8a95('0xd')](_0x8a95('0xe'),_0xdd54e1,_0x8a95('0xf'));logger['debug'](_0x8a95('0x10'),_0xdd54e1,_0x8a95('0xf'),JSON['stringify'](_0x240b22));if(_0x240b22[_0x8a95('0x11')]){if(_0x240b22['error']['code']===0x1f4){logger[_0x8a95('0x11')]('CloudProvider,\x20%s,\x20%s',_0xdd54e1,_0x240b22[_0x8a95('0x11')][_0x8a95('0x12')]);return _0xe03b31(_0x240b22['error'][_0x8a95('0x12')]);}logger[_0x8a95('0x11')]('CloudProvider,\x20%s,\x20%s',_0xdd54e1,_0x240b22[_0x8a95('0x11')][_0x8a95('0x12')]);return _0x49287d(_0x240b22[_0x8a95('0x11')][_0x8a95('0x12')]);}else{logger[_0x8a95('0xd')](_0x8a95('0xe'),_0xdd54e1,_0x8a95('0xf'));_0x49287d(_0x240b22['result'][_0x8a95('0x12')]);}})['catch'](function(_0x334b18){logger['error'](_0x8a95('0xe'),_0xdd54e1,_0x334b18);_0xe03b31(_0x334b18);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index fe905cb..b91642f 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 _0xc26f=['../../components/auth/service','../../components/interaction/service','./cloudProvider.controller','get','isAuthenticated','/:id','post','create','update','delete','destroy','multer','util','connect-timeout','fs-extra'];(function(_0x33759d,_0x1442ba){var _0x368ed7=function(_0x28868d){while(--_0x28868d){_0x33759d['push'](_0x33759d['shift']());}};_0x368ed7(++_0x1442ba);}(_0xc26f,0xdd));var _0xfc26=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc26f[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0xfc26('0x0'));var util=require(_0xfc26('0x1'));var path=require('path');var timeout=require(_0xfc26('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xfc26('0x3'));var auth=require(_0xfc26('0x4'));var interaction=require(_0xfc26('0x5'));var config=require('../../config/environment');var controller=require(_0xfc26('0x6'));router[_0xfc26('0x7')]('/',auth[_0xfc26('0x8')](),controller['index']);router[_0xfc26('0x7')](_0xfc26('0x9'),auth[_0xfc26('0x8')](),controller['show']);router[_0xfc26('0xa')]('/',auth[_0xfc26('0x8')](),controller[_0xfc26('0xb')]);router['put']('/:id',auth[_0xfc26('0x8')](),controller[_0xfc26('0xc')]);router[_0xfc26('0xd')]('/:id',auth[_0xfc26('0x8')](),controller[_0xfc26('0xe')]);module['exports']=router; \ No newline at end of file +var _0xbdb5=['update','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x178548,_0x247ed6){var _0x7fac10=function(_0x2e8045){while(--_0x2e8045){_0x178548['push'](_0x178548['shift']());}};_0x7fac10(++_0x247ed6);}(_0xbdb5,0x122));var _0x5bdb=function(_0x3411d9,_0x5b99c0){_0x3411d9=_0x3411d9-0x0;var _0x2dac66=_0xbdb5[_0x3411d9];return _0x2dac66;};'use strict';var multer=require(_0x5bdb('0x0'));var util=require(_0x5bdb('0x1'));var path=require(_0x5bdb('0x2'));var timeout=require(_0x5bdb('0x3'));var express=require('express');var router=express[_0x5bdb('0x4')]();var fs_extra=require(_0x5bdb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5bdb('0x6'));var config=require(_0x5bdb('0x7'));var controller=require('./cloudProvider.controller');router[_0x5bdb('0x8')]('/',auth[_0x5bdb('0x9')](),controller[_0x5bdb('0xa')]);router[_0x5bdb('0x8')](_0x5bdb('0xb'),auth[_0x5bdb('0x9')](),controller[_0x5bdb('0xc')]);router[_0x5bdb('0xd')]('/',auth['isAuthenticated'](),controller[_0x5bdb('0xe')]);router[_0x5bdb('0xf')](_0x5bdb('0xb'),auth['isAuthenticated'](),controller[_0x5bdb('0x10')]);router['delete'](_0x5bdb('0xb'),auth['isAuthenticated'](),controller[_0x5bdb('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index ac98eb2..45170a4 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 _0x177d=['sequelize','exports','STRING','name'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x177d,0x68));var _0xd177=function(_0x1cb7ea,_0x2496df){_0x1cb7ea=_0x1cb7ea-0x0;var _0x17991f=_0x177d[_0x1cb7ea];return _0x17991f;};'use strict';var Sequelize=require(_0xd177('0x0'));module[_0xd177('0x1')]={'name':{'type':Sequelize[_0xd177('0x2')],'unique':_0xd177('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xd177('0x2')]},'companyId':{'type':Sequelize[_0xd177('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xd177('0x2')]},'type':{'type':Sequelize[_0xd177('0x2')]},'street':{'type':Sequelize[_0xd177('0x2')]},'postalCode':{'type':Sequelize[_0xd177('0x2')]},'city':{'type':Sequelize[_0xd177('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xd177('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xd177('0x2')]},'sStreet':{'type':Sequelize[_0xd177('0x2')]},'sPostalCode':{'type':Sequelize[_0xd177('0x2')]},'sCity':{'type':Sequelize[_0xd177('0x2')]},'sCountry':{'type':Sequelize[_0xd177('0x2')]},'description':{'type':Sequelize[_0xd177('0x2')]}}; \ No newline at end of file +var _0x247a=['sequelize','STRING'];(function(_0x3ad951,_0x107473){var _0x5047cf=function(_0x411460){while(--_0x411460){_0x3ad951['push'](_0x3ad951['shift']());}};_0x5047cf(++_0x107473);}(_0x247a,0x162));var _0xa247=function(_0x463697,_0xccfdc4){_0x463697=_0x463697-0x0;var _0x33cfe1=_0x247a[_0x463697];return _0x33cfe1;};'use strict';var Sequelize=require(_0xa247('0x0'));module['exports']={'name':{'type':Sequelize[_0xa247('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xa247('0x1')]},'companyId':{'type':Sequelize[_0xa247('0x1')]},'website':{'type':Sequelize[_0xa247('0x1')]},'phone':{'type':Sequelize[_0xa247('0x1')]},'fax':{'type':Sequelize[_0xa247('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xa247('0x1')]},'city':{'type':Sequelize[_0xa247('0x1')]},'country':{'type':Sequelize[_0xa247('0x1')]},'email':{'type':Sequelize[_0xa247('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xa247('0x1')]},'sStreet':{'type':Sequelize[_0xa247('0x1')]},'sPostalCode':{'type':Sequelize[_0xa247('0x1')]},'sCity':{'type':Sequelize[_0xa247('0x1')]},'sCountry':{'type':Sequelize[_0xa247('0x1')]},'description':{'type':Sequelize[_0xa247('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 968a72a..aa028f5 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 _0xf999=['find','catch','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addContacts','ids','omit','CmContact','map','getContacts','eml-format','rimraf','request-promise','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','show','params','rawAttributes','merge'];(function(_0x5204e2,_0x29981c){var _0x5c51e9=function(_0x206ea1){while(--_0x206ea1){_0x5204e2['push'](_0x5204e2['shift']());}};_0x5c51e9(++_0x29981c);}(_0xf999,0x160));var _0x9f99=function(_0x5af480,_0xf286a2){_0x5af480=_0x5af480-0x0;var _0x50520f=_0xf999[_0x5af480];return _0x50520f;};'use strict';var emlformat=require(_0x9f99('0x0'));var rimraf=require(_0x9f99('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9f99('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9f99('0x3'));var util=require('util');var path=require('path');var sox=require(_0x9f99('0x4'));var csv=require(_0x9f99('0x5'));var ejs=require(_0x9f99('0x6'));var fs=require('fs');var fs_extra=require(_0x9f99('0x7'));var _=require(_0x9f99('0x8'));var squel=require(_0x9f99('0x9'));var crypto=require(_0x9f99('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9f99('0xb'));var toCsv=require(_0x9f99('0x5'));var querystring=require(_0x9f99('0xc'));var Papa=require(_0x9f99('0xd'));var Redis=require(_0x9f99('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9f99('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9f99('0x10'));var logger=require(_0x9f99('0x11'))(_0x9f99('0x12'));var utils=require('../../config/utils');var config=require(_0x9f99('0x13'));var licenseUtil=require(_0x9f99('0x14'));var db=require(_0x9f99('0x15'))['db'];function respondWithStatusCode(_0x1b05ed,_0x443d20){_0x443d20=_0x443d20||0xcc;return function(_0x5332a1){if(_0x5332a1){return _0x1b05ed[_0x9f99('0x16')](_0x443d20);}return _0x1b05ed[_0x9f99('0x17')](_0x443d20)[_0x9f99('0x18')]();};}function respondWithResult(_0x34a754,_0x32d9bc){_0x32d9bc=_0x32d9bc||0xc8;return function(_0x4323e2){if(_0x4323e2){return _0x34a754[_0x9f99('0x17')](_0x32d9bc)[_0x9f99('0x19')](_0x4323e2);}};}function respondWithFilteredResult(_0x201eb7,_0xc4f1ed){return function(_0x5d5460){if(_0x5d5460){var _0x594d9b=typeof _0xc4f1ed[_0x9f99('0x1a')]===_0x9f99('0x1b')&&typeof _0xc4f1ed[_0x9f99('0x1c')]===_0x9f99('0x1b');var _0x172561=_0x5d5460[_0x9f99('0x1d')];var _0x22e090=_0x594d9b?0x0:_0xc4f1ed[_0x9f99('0x1a')];var _0x5ea2e9=_0x594d9b?_0x5d5460[_0x9f99('0x1d')]:_0xc4f1ed[_0x9f99('0x1a')]+_0xc4f1ed[_0x9f99('0x1c')];var _0x4ec6ec;if(_0x5ea2e9>=_0x172561){_0x5ea2e9=_0x172561;_0x4ec6ec=0xc8;}else{_0x4ec6ec=0xce;}_0x201eb7[_0x9f99('0x17')](_0x4ec6ec);return _0x201eb7['set'](_0x9f99('0x1e'),_0x22e090+'-'+_0x5ea2e9+'/'+_0x172561)[_0x9f99('0x19')](_0x5d5460);}return null;};}function patchUpdates(_0x4f1c18){return function(_0x3a50ef){try{jsonpatch['apply'](_0x3a50ef,_0x4f1c18,!![]);}catch(_0x22c6ac){return BPromise[_0x9f99('0x1f')](_0x22c6ac);}return _0x3a50ef['save']();};}function saveUpdates(_0x276412,_0x1b8975){return function(_0x2b155e){if(_0x2b155e){return _0x2b155e[_0x9f99('0x20')](_0x276412)[_0x9f99('0x21')](function(_0x27f977){return _0x27f977;});}return null;};}function removeEntity(_0x2ec325,_0xb0b42b){return function(_0x2aa9f4){if(_0x2aa9f4){return _0x2aa9f4[_0x9f99('0x22')]()[_0x9f99('0x21')](function(){var _0x419361=_0x2aa9f4[_0x9f99('0x23')]({'plain':!![]});var _0x5de981=_0x9f99('0x24');return db[_0x9f99('0x25')]['destroy']({'where':{'type':_0x5de981,'resourceId':_0x419361['id']}})[_0x9f99('0x21')](function(){return _0x2aa9f4;});})['then'](function(){_0x2ec325[_0x9f99('0x17')](0xcc)[_0x9f99('0x18')]();});}};}function handleEntityNotFound(_0x50a9c6,_0x3ebad7){return function(_0x1d31ac){if(!_0x1d31ac){_0x50a9c6[_0x9f99('0x16')](0x194);}return _0x1d31ac;};}function handleError(_0x499ed7,_0x81bc6d){_0x81bc6d=_0x81bc6d||0x1f4;return function(_0x47fd1f){logger[_0x9f99('0x26')](_0x47fd1f[_0x9f99('0x27')]);if(_0x47fd1f['name']){delete _0x47fd1f[_0x9f99('0x28')];}_0x499ed7[_0x9f99('0x17')](_0x81bc6d)[_0x9f99('0x29')](_0x47fd1f);};}exports[_0x9f99('0x2a')]=function(_0x46ef9d,_0x4a2c8d){var _0x36a8e3={},_0x4c86b3={},_0x1d9f12={'count':0x0,'rows':[]};return db[_0x9f99('0x2b')][_0x9f99('0x2c')]()[_0x9f99('0x21')](function(_0x28b59a){_0x4c86b3[_0x9f99('0x2d')]=_[_0x9f99('0x2e')](_0x28b59a);_0x4c86b3[_0x9f99('0x2f')]=_[_0x9f99('0x2e')](_0x46ef9d[_0x9f99('0x2f')]);_0x4c86b3[_0x9f99('0x30')]=_[_0x9f99('0x31')](_0x4c86b3[_0x9f99('0x2d')],_0x4c86b3['query']);_0x36a8e3[_0x9f99('0x32')]=_['intersection'](_0x4c86b3[_0x9f99('0x2d')],qs[_0x9f99('0x33')](_0x46ef9d['query']['fields']));_0x36a8e3[_0x9f99('0x32')]=_0x36a8e3[_0x9f99('0x32')][_0x9f99('0x34')]?_0x36a8e3['attributes']:_0x4c86b3['model'];if(!_0x46ef9d['query'][_0x9f99('0x35')](_0x9f99('0x36'))){_0x36a8e3['limit']=qs[_0x9f99('0x1c')](_0x46ef9d[_0x9f99('0x2f')][_0x9f99('0x1c')]);_0x36a8e3[_0x9f99('0x1a')]=qs[_0x9f99('0x1a')](_0x46ef9d['query'][_0x9f99('0x1a')]);}_0x36a8e3[_0x9f99('0x37')]=qs[_0x9f99('0x38')](_0x46ef9d['query'][_0x9f99('0x38')]);_0x36a8e3[_0x9f99('0x39')]=qs['filters'](_[_0x9f99('0x3a')](_0x46ef9d[_0x9f99('0x2f')],_0x4c86b3[_0x9f99('0x30')]),_0x28b59a);if(_0x46ef9d['query']['filter']){_0x36a8e3[_0x9f99('0x39')]=_['merge'](_0x36a8e3[_0x9f99('0x39')],{'$or':_['map'](_0x36a8e3[_0x9f99('0x32')],function(_0x2860d0){var _0x4a91c6={};_0x4a91c6[_0x2860d0]={'$like':'%'+_0x46ef9d[_0x9f99('0x2f')][_0x9f99('0x3b')]+'%'};return _0x4a91c6;})});}_0x36a8e3=_['merge']({},_0x36a8e3,_0x46ef9d[_0x9f99('0x3c')]);var _0x29c858={'where':_0x36a8e3[_0x9f99('0x39')]};return db[_0x9f99('0x2b')][_0x9f99('0x1d')](_0x29c858)['then'](function(_0x138839){_0x1d9f12['count']=_0x138839;if(_0x46ef9d[_0x9f99('0x2f')][_0x9f99('0x3d')]){_0x36a8e3[_0x9f99('0x3e')]=[{'all':!![]}];}return db[_0x9f99('0x2b')][_0x9f99('0x3f')](_0x36a8e3);})[_0x9f99('0x21')](function(_0x493512){_0x1d9f12['rows']=_0x493512;return _0x1d9f12;})[_0x9f99('0x21')](respondWithFilteredResult(_0x4a2c8d,_0x36a8e3))['catch'](handleError(_0x4a2c8d,null));})['catch'](handleError(_0x4a2c8d,null));};exports[_0x9f99('0x40')]=function(_0x4342cc,_0x293913){var _0x3ab2c0={'raw':![],'where':{'id':_0x4342cc[_0x9f99('0x41')]['id']}},_0x53933f={};_0x53933f[_0x9f99('0x2d')]=_[_0x9f99('0x2e')](db['CmCompany'][_0x9f99('0x42')]);_0x53933f[_0x9f99('0x2f')]=_[_0x9f99('0x2e')](_0x4342cc[_0x9f99('0x2f')]);_0x53933f[_0x9f99('0x30')]=_[_0x9f99('0x31')](_0x53933f[_0x9f99('0x2d')],_0x53933f[_0x9f99('0x2f')]);_0x3ab2c0[_0x9f99('0x32')]=_[_0x9f99('0x31')](_0x53933f[_0x9f99('0x2d')],qs[_0x9f99('0x33')](_0x4342cc['query']['fields']));_0x3ab2c0[_0x9f99('0x32')]=_0x3ab2c0[_0x9f99('0x32')][_0x9f99('0x34')]?_0x3ab2c0[_0x9f99('0x32')]:_0x53933f[_0x9f99('0x2d')];if(_0x4342cc['query']['includeAll']){_0x3ab2c0[_0x9f99('0x3e')]=[{'all':!![]}];}_0x3ab2c0=_[_0x9f99('0x43')]({},_0x3ab2c0,_0x4342cc[_0x9f99('0x3c')]);return db[_0x9f99('0x2b')][_0x9f99('0x44')](_0x3ab2c0)[_0x9f99('0x21')](handleEntityNotFound(_0x293913,null))[_0x9f99('0x21')](respondWithResult(_0x293913,null))[_0x9f99('0x45')](handleError(_0x293913,null));};exports['create']=function(_0x2dab81,_0x5ac698){return db['CmCompany']['create'](_0x2dab81['body'],{})[_0x9f99('0x21')](function(_0x46f691){var _0x1d8fa8=_0x2dab81[_0x9f99('0x46')][_0x9f99('0x23')]({'plain':!![]});if(!_0x1d8fa8)throw new Error(_0x9f99('0x47'));if(_0x1d8fa8[_0x9f99('0x48')]===_0x9f99('0x46')){var _0x551db5=_0x46f691[_0x9f99('0x23')]({'plain':!![]});var _0x5eb175=_0x9f99('0x24');return db[_0x9f99('0x49')][_0x9f99('0x44')]({'where':{'name':_0x5eb175,'userProfileId':_0x1d8fa8['userProfileId']},'raw':!![]})[_0x9f99('0x21')](function(_0x2a0069){if(_0x2a0069&&_0x2a0069[_0x9f99('0x4a')]===0x0){return db[_0x9f99('0x25')][_0x9f99('0x4b')]({'name':_0x551db5[_0x9f99('0x28')],'resourceId':_0x551db5['id'],'type':_0x2a0069['name'],'sectionId':_0x2a0069['id']},{})['then'](function(){return _0x46f691;});}else{return _0x46f691;}})[_0x9f99('0x45')](function(_0x343345){logger['error'](_0x9f99('0x4c'),_0x343345);throw _0x343345;});}return _0x46f691;})[_0x9f99('0x21')](respondWithResult(_0x5ac698,0xc9))[_0x9f99('0x45')](handleError(_0x5ac698,null));};exports[_0x9f99('0x20')]=function(_0x36bd25,_0x1a00a6){if(_0x36bd25[_0x9f99('0x4d')]['id']){delete _0x36bd25[_0x9f99('0x4d')]['id'];}return db['CmCompany'][_0x9f99('0x44')]({'where':{'id':_0x36bd25[_0x9f99('0x41')]['id']}})[_0x9f99('0x21')](handleEntityNotFound(_0x1a00a6,null))[_0x9f99('0x21')](saveUpdates(_0x36bd25[_0x9f99('0x4d')],null))[_0x9f99('0x21')](respondWithResult(_0x1a00a6,null))['catch'](handleError(_0x1a00a6,null));};exports[_0x9f99('0x22')]=function(_0x1c0366,_0x1f93da){return db[_0x9f99('0x2b')][_0x9f99('0x44')]({'where':{'id':_0x1c0366[_0x9f99('0x41')]['id']}})['then'](handleEntityNotFound(_0x1f93da,null))['then'](removeEntity(_0x1f93da,null))[_0x9f99('0x45')](handleError(_0x1f93da,null));};exports[_0x9f99('0x2c')]=function(_0x401aec,_0x5f037e){return db['CmCompany'][_0x9f99('0x2c')]()['then'](respondWithResult(_0x5f037e,null))[_0x9f99('0x45')](handleError(_0x5f037e,null));};exports['addContacts']=function(_0x2541d6,_0x4e3102,_0x2011ea){return db['CmContact'][_0x9f99('0x44')]({'where':{'id':_0x2541d6[_0x9f99('0x41')]['id']}})[_0x9f99('0x21')](handleEntityNotFound(_0x4e3102,null))[_0x9f99('0x21')](function(_0x190219){if(_0x190219){return _0x190219[_0x9f99('0x4e')](_0x2541d6[_0x9f99('0x4d')][_0x9f99('0x4f')],_[_0x9f99('0x50')](_0x2541d6[_0x9f99('0x4d')],[_0x9f99('0x4f'),'id'])||{});}})[_0x9f99('0x21')](respondWithResult(_0x4e3102,null))[_0x9f99('0x45')](handleError(_0x4e3102,null));};exports['getContacts']=function(_0x48140b,_0x69ea9,_0x24383f){var _0x15ca22={};var _0x4bbcb6={};var _0x2e88f8;var _0x40b194;return db['CmCompany']['findOne']({'where':{'id':_0x48140b[_0x9f99('0x41')]['id']}})['then'](handleEntityNotFound(_0x69ea9,null))['then'](function(_0x2572ac){if(_0x2572ac){_0x2e88f8=_0x2572ac;_0x4bbcb6[_0x9f99('0x2d')]=_['keys'](db[_0x9f99('0x51')][_0x9f99('0x42')]);_0x4bbcb6['query']=_[_0x9f99('0x2e')](_0x48140b[_0x9f99('0x2f')]);_0x4bbcb6[_0x9f99('0x30')]=_[_0x9f99('0x31')](_0x4bbcb6['model'],_0x4bbcb6['query']);_0x15ca22['attributes']=_[_0x9f99('0x31')](_0x4bbcb6['model'],qs[_0x9f99('0x33')](_0x48140b['query'][_0x9f99('0x33')]));_0x15ca22[_0x9f99('0x32')]=_0x15ca22[_0x9f99('0x32')][_0x9f99('0x34')]?_0x15ca22[_0x9f99('0x32')]:_0x4bbcb6['model'];_0x15ca22['order']=qs['sort'](_0x48140b[_0x9f99('0x2f')][_0x9f99('0x38')]);_0x15ca22['where']=qs[_0x9f99('0x30')](_['pick'](_0x48140b[_0x9f99('0x2f')],_0x4bbcb6['filters']));if(_0x48140b[_0x9f99('0x2f')][_0x9f99('0x3b')]){_0x15ca22[_0x9f99('0x39')]=_['merge'](_0x15ca22[_0x9f99('0x39')],{'$or':_[_0x9f99('0x52')](_0x15ca22[_0x9f99('0x32')],function(_0x35a13e){var _0x4c3250={};_0x4c3250[_0x35a13e]={'$like':'%'+_0x48140b['query'][_0x9f99('0x3b')]+'%'};return _0x4c3250;})});}_0x15ca22=_['merge']({},_0x15ca22,_0x48140b[_0x9f99('0x3c')]);return _0x2e88f8[_0x9f99('0x53')](_0x15ca22);}})['then'](function(_0x308dac){if(_0x308dac){_0x40b194=_0x308dac[_0x9f99('0x34')];if(!_0x48140b[_0x9f99('0x2f')][_0x9f99('0x35')](_0x9f99('0x36'))){_0x15ca22['limit']=qs[_0x9f99('0x1c')](_0x48140b[_0x9f99('0x2f')]['limit']);_0x15ca22[_0x9f99('0x1a')]=qs[_0x9f99('0x1a')](_0x48140b[_0x9f99('0x2f')][_0x9f99('0x1a')]);}return _0x2e88f8['getContacts'](_0x15ca22);}})[_0x9f99('0x21')](function(_0x44550d){if(_0x44550d){return _0x44550d?{'count':_0x40b194,'rows':_0x44550d}:null;}})[_0x9f99('0x21')](respondWithResult(_0x69ea9,null))[_0x9f99('0x45')](handleError(_0x69ea9,null));}; \ No newline at end of file +var _0x49ba=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','addContacts','CmContact','ids','omit','getContacts','findOne','map','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','Companies','then','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find'];(function(_0x2c73c0,_0x54e3b5){var _0x593fee=function(_0x48ad81){while(--_0x48ad81){_0x2c73c0['push'](_0x2c73c0['shift']());}};_0x593fee(++_0x54e3b5);}(_0x49ba,0xc0));var _0xa49b=function(_0x308488,_0x6f7741){_0x308488=_0x308488-0x0;var _0x5451a9=_0x49ba[_0x308488];return _0x5451a9;};'use strict';var emlformat=require(_0xa49b('0x0'));var rimraf=require(_0xa49b('0x1'));var zipdir=require(_0xa49b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa49b('0x3'));var moment=require(_0xa49b('0x4'));var BPromise=require(_0xa49b('0x5'));var Mustache=require('mustache');var util=require(_0xa49b('0x6'));var path=require(_0xa49b('0x7'));var sox=require(_0xa49b('0x8'));var csv=require(_0xa49b('0x9'));var ejs=require(_0xa49b('0xa'));var fs=require('fs');var fs_extra=require(_0xa49b('0xb'));var _=require('lodash');var squel=require(_0xa49b('0xc'));var crypto=require(_0xa49b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa49b('0xe'));var Papa=require(_0xa49b('0xf'));var Redis=require(_0xa49b('0x10'));var authService=require(_0xa49b('0x11'));var qs=require(_0xa49b('0x12'));var as=require(_0xa49b('0x13'));var hardwareService=require(_0xa49b('0x14'));var logger=require(_0xa49b('0x15'))(_0xa49b('0x16'));var utils=require(_0xa49b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa49b('0x18'));var db=require(_0xa49b('0x19'))['db'];function respondWithStatusCode(_0x5bc76a,_0x5550ae){_0x5550ae=_0x5550ae||0xcc;return function(_0x2b1223){if(_0x2b1223){return _0x5bc76a[_0xa49b('0x1a')](_0x5550ae);}return _0x5bc76a['status'](_0x5550ae)[_0xa49b('0x1b')]();};}function respondWithResult(_0xc55014,_0xbcf66){_0xbcf66=_0xbcf66||0xc8;return function(_0x5d19ac){if(_0x5d19ac){return _0xc55014[_0xa49b('0x1c')](_0xbcf66)[_0xa49b('0x1d')](_0x5d19ac);}};}function respondWithFilteredResult(_0x2ba9d7,_0x4f4363){return function(_0x3bcae3){if(_0x3bcae3){var _0x3c207a=typeof _0x4f4363[_0xa49b('0x1e')]===_0xa49b('0x1f')&&typeof _0x4f4363[_0xa49b('0x20')]===_0xa49b('0x1f');var _0x1e0591=_0x3bcae3[_0xa49b('0x21')];var _0x5d1222=_0x3c207a?0x0:_0x4f4363['offset'];var _0x31bce3=_0x3c207a?_0x3bcae3[_0xa49b('0x21')]:_0x4f4363[_0xa49b('0x1e')]+_0x4f4363[_0xa49b('0x20')];var _0x1a440d;if(_0x31bce3>=_0x1e0591){_0x31bce3=_0x1e0591;_0x1a440d=0xc8;}else{_0x1a440d=0xce;}_0x2ba9d7[_0xa49b('0x1c')](_0x1a440d);return _0x2ba9d7[_0xa49b('0x22')](_0xa49b('0x23'),_0x5d1222+'-'+_0x31bce3+'/'+_0x1e0591)[_0xa49b('0x1d')](_0x3bcae3);}return null;};}function patchUpdates(_0x49a2db){return function(_0x52e356){try{jsonpatch[_0xa49b('0x24')](_0x52e356,_0x49a2db,!![]);}catch(_0x53027b){return BPromise['reject'](_0x53027b);}return _0x52e356[_0xa49b('0x25')]();};}function saveUpdates(_0x334947,_0x3cf010){return function(_0x1d3a17){if(_0x1d3a17){return _0x1d3a17[_0xa49b('0x26')](_0x334947)['then'](function(_0x5dbfba){return _0x5dbfba;});}return null;};}function removeEntity(_0x512c51,_0x3279ad){return function(_0x1ade1e){if(_0x1ade1e){return _0x1ade1e[_0xa49b('0x27')]()['then'](function(){var _0x35500b=_0x1ade1e[_0xa49b('0x28')]({'plain':!![]});var _0x4ab1f2=_0xa49b('0x29');return db['UserProfileResource'][_0xa49b('0x27')]({'where':{'type':_0x4ab1f2,'resourceId':_0x35500b['id']}})[_0xa49b('0x2a')](function(){return _0x1ade1e;});})[_0xa49b('0x2a')](function(){_0x512c51[_0xa49b('0x1c')](0xcc)[_0xa49b('0x1b')]();});}};}function handleEntityNotFound(_0x1c757a,_0x10b30d){return function(_0x2d11c4){if(!_0x2d11c4){_0x1c757a['sendStatus'](0x194);}return _0x2d11c4;};}function handleError(_0x3cab7f,_0x5c4e47){_0x5c4e47=_0x5c4e47||0x1f4;return function(_0x5bc66c){logger[_0xa49b('0x2b')](_0x5bc66c[_0xa49b('0x2c')]);if(_0x5bc66c[_0xa49b('0x2d')]){delete _0x5bc66c[_0xa49b('0x2d')];}_0x3cab7f[_0xa49b('0x1c')](_0x5c4e47)[_0xa49b('0x2e')](_0x5bc66c);};}exports[_0xa49b('0x2f')]=function(_0x3de112,_0x2051c8){var _0x46a0ee={},_0x3a6a8a={},_0x2fd5dd={'count':0x0,'rows':[]};return db[_0xa49b('0x30')][_0xa49b('0x31')]()[_0xa49b('0x2a')](function(_0x241ee5){_0x3a6a8a[_0xa49b('0x32')]=_[_0xa49b('0x33')](_0x241ee5);_0x3a6a8a[_0xa49b('0x34')]=_[_0xa49b('0x33')](_0x3de112[_0xa49b('0x34')]);_0x3a6a8a[_0xa49b('0x35')]=_[_0xa49b('0x36')](_0x3a6a8a['model'],_0x3a6a8a[_0xa49b('0x34')]);_0x46a0ee[_0xa49b('0x37')]=_[_0xa49b('0x36')](_0x3a6a8a['model'],qs[_0xa49b('0x38')](_0x3de112[_0xa49b('0x34')]['fields']));_0x46a0ee[_0xa49b('0x37')]=_0x46a0ee[_0xa49b('0x37')][_0xa49b('0x39')]?_0x46a0ee[_0xa49b('0x37')]:_0x3a6a8a[_0xa49b('0x32')];if(!_0x3de112[_0xa49b('0x34')][_0xa49b('0x3a')](_0xa49b('0x3b'))){_0x46a0ee[_0xa49b('0x20')]=qs[_0xa49b('0x20')](_0x3de112[_0xa49b('0x34')][_0xa49b('0x20')]);_0x46a0ee[_0xa49b('0x1e')]=qs[_0xa49b('0x1e')](_0x3de112['query'][_0xa49b('0x1e')]);}_0x46a0ee['order']=qs[_0xa49b('0x3c')](_0x3de112[_0xa49b('0x34')][_0xa49b('0x3c')]);_0x46a0ee[_0xa49b('0x3d')]=qs['filters'](_[_0xa49b('0x3e')](_0x3de112[_0xa49b('0x34')],_0x3a6a8a[_0xa49b('0x35')]),_0x241ee5);if(_0x3de112[_0xa49b('0x34')][_0xa49b('0x3f')]){_0x46a0ee[_0xa49b('0x3d')]=_[_0xa49b('0x40')](_0x46a0ee[_0xa49b('0x3d')],{'$or':_['map'](_0x46a0ee['attributes'],function(_0x592f43){var _0x2c7686={};_0x2c7686[_0x592f43]={'$like':'%'+_0x3de112['query'][_0xa49b('0x3f')]+'%'};return _0x2c7686;})});}_0x46a0ee=_[_0xa49b('0x40')]({},_0x46a0ee,_0x3de112[_0xa49b('0x41')]);var _0x4f078f={'where':_0x46a0ee[_0xa49b('0x3d')]};return db[_0xa49b('0x30')][_0xa49b('0x21')](_0x4f078f)[_0xa49b('0x2a')](function(_0x462536){_0x2fd5dd[_0xa49b('0x21')]=_0x462536;if(_0x3de112[_0xa49b('0x34')]['includeAll']){_0x46a0ee[_0xa49b('0x42')]=[{'all':!![]}];}return db[_0xa49b('0x30')][_0xa49b('0x43')](_0x46a0ee);})[_0xa49b('0x2a')](function(_0x3af918){_0x2fd5dd[_0xa49b('0x44')]=_0x3af918;return _0x2fd5dd;})[_0xa49b('0x2a')](respondWithFilteredResult(_0x2051c8,_0x46a0ee))[_0xa49b('0x45')](handleError(_0x2051c8,null));})[_0xa49b('0x45')](handleError(_0x2051c8,null));};exports[_0xa49b('0x46')]=function(_0x5679c0,_0x38a044){var _0x17eaa0={'raw':![],'where':{'id':_0x5679c0[_0xa49b('0x47')]['id']}},_0xc7f4df={};_0xc7f4df[_0xa49b('0x32')]=_[_0xa49b('0x33')](db['CmCompany'][_0xa49b('0x48')]);_0xc7f4df[_0xa49b('0x34')]=_[_0xa49b('0x33')](_0x5679c0['query']);_0xc7f4df[_0xa49b('0x35')]=_[_0xa49b('0x36')](_0xc7f4df[_0xa49b('0x32')],_0xc7f4df[_0xa49b('0x34')]);_0x17eaa0[_0xa49b('0x37')]=_[_0xa49b('0x36')](_0xc7f4df[_0xa49b('0x32')],qs[_0xa49b('0x38')](_0x5679c0[_0xa49b('0x34')][_0xa49b('0x38')]));_0x17eaa0[_0xa49b('0x37')]=_0x17eaa0[_0xa49b('0x37')][_0xa49b('0x39')]?_0x17eaa0[_0xa49b('0x37')]:_0xc7f4df[_0xa49b('0x32')];if(_0x5679c0[_0xa49b('0x34')][_0xa49b('0x49')]){_0x17eaa0[_0xa49b('0x42')]=[{'all':!![]}];}_0x17eaa0=_['merge']({},_0x17eaa0,_0x5679c0[_0xa49b('0x41')]);return db[_0xa49b('0x30')][_0xa49b('0x4a')](_0x17eaa0)[_0xa49b('0x2a')](handleEntityNotFound(_0x38a044,null))['then'](respondWithResult(_0x38a044,null))[_0xa49b('0x45')](handleError(_0x38a044,null));};exports[_0xa49b('0x4b')]=function(_0x39cb1a,_0x52bb8d){return db[_0xa49b('0x30')][_0xa49b('0x4b')](_0x39cb1a[_0xa49b('0x4c')],{})[_0xa49b('0x2a')](function(_0x17902e){var _0x25af1f=_0x39cb1a[_0xa49b('0x4d')]['get']({'plain':!![]});if(!_0x25af1f)throw new Error(_0xa49b('0x4e'));if(_0x25af1f['role']===_0xa49b('0x4d')){var _0x4b7e2d=_0x17902e[_0xa49b('0x28')]({'plain':!![]});var _0x448d51=_0xa49b('0x29');return db['UserProfileSection'][_0xa49b('0x4a')]({'where':{'name':_0x448d51,'userProfileId':_0x25af1f[_0xa49b('0x4f')]},'raw':!![]})[_0xa49b('0x2a')](function(_0x8e328b){if(_0x8e328b&&_0x8e328b[_0xa49b('0x50')]===0x0){return db[_0xa49b('0x51')][_0xa49b('0x4b')]({'name':_0x4b7e2d[_0xa49b('0x2d')],'resourceId':_0x4b7e2d['id'],'type':_0x8e328b[_0xa49b('0x2d')],'sectionId':_0x8e328b['id']},{})['then'](function(){return _0x17902e;});}else{return _0x17902e;}})[_0xa49b('0x45')](function(_0x278d58){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x278d58);throw _0x278d58;});}return _0x17902e;})[_0xa49b('0x2a')](respondWithResult(_0x52bb8d,0xc9))[_0xa49b('0x45')](handleError(_0x52bb8d,null));};exports[_0xa49b('0x26')]=function(_0x2a6314,_0x4632cc){if(_0x2a6314[_0xa49b('0x4c')]['id']){delete _0x2a6314['body']['id'];}return db[_0xa49b('0x30')]['find']({'where':{'id':_0x2a6314[_0xa49b('0x47')]['id']}})['then'](handleEntityNotFound(_0x4632cc,null))['then'](saveUpdates(_0x2a6314[_0xa49b('0x4c')],null))[_0xa49b('0x2a')](respondWithResult(_0x4632cc,null))[_0xa49b('0x45')](handleError(_0x4632cc,null));};exports[_0xa49b('0x27')]=function(_0x11ec0b,_0x553803){return db['CmCompany']['find']({'where':{'id':_0x11ec0b[_0xa49b('0x47')]['id']}})[_0xa49b('0x2a')](handleEntityNotFound(_0x553803,null))[_0xa49b('0x2a')](removeEntity(_0x553803,null))[_0xa49b('0x45')](handleError(_0x553803,null));};exports[_0xa49b('0x31')]=function(_0x24b8a6,_0x2b7551){return db[_0xa49b('0x30')][_0xa49b('0x31')]()[_0xa49b('0x2a')](respondWithResult(_0x2b7551,null))[_0xa49b('0x45')](handleError(_0x2b7551,null));};exports[_0xa49b('0x52')]=function(_0x5d912f,_0x31bc4f,_0x8e3f25){return db[_0xa49b('0x53')]['find']({'where':{'id':_0x5d912f[_0xa49b('0x47')]['id']}})['then'](handleEntityNotFound(_0x31bc4f,null))[_0xa49b('0x2a')](function(_0x4beadb){if(_0x4beadb){return _0x4beadb[_0xa49b('0x52')](_0x5d912f[_0xa49b('0x4c')][_0xa49b('0x54')],_[_0xa49b('0x55')](_0x5d912f[_0xa49b('0x4c')],['ids','id'])||{});}})[_0xa49b('0x2a')](respondWithResult(_0x31bc4f,null))[_0xa49b('0x45')](handleError(_0x31bc4f,null));};exports[_0xa49b('0x56')]=function(_0x3399d6,_0x26e638,_0x20614d){var _0x31bd98={};var _0x494f73={};var _0x35c4e6;var _0xb2b176;return db['CmCompany'][_0xa49b('0x57')]({'where':{'id':_0x3399d6[_0xa49b('0x47')]['id']}})[_0xa49b('0x2a')](handleEntityNotFound(_0x26e638,null))['then'](function(_0x8f9204){if(_0x8f9204){_0x35c4e6=_0x8f9204;_0x494f73[_0xa49b('0x32')]=_[_0xa49b('0x33')](db[_0xa49b('0x53')]['rawAttributes']);_0x494f73['query']=_[_0xa49b('0x33')](_0x3399d6[_0xa49b('0x34')]);_0x494f73[_0xa49b('0x35')]=_[_0xa49b('0x36')](_0x494f73[_0xa49b('0x32')],_0x494f73[_0xa49b('0x34')]);_0x31bd98['attributes']=_[_0xa49b('0x36')](_0x494f73[_0xa49b('0x32')],qs[_0xa49b('0x38')](_0x3399d6[_0xa49b('0x34')][_0xa49b('0x38')]));_0x31bd98[_0xa49b('0x37')]=_0x31bd98['attributes']['length']?_0x31bd98['attributes']:_0x494f73[_0xa49b('0x32')];_0x31bd98['order']=qs[_0xa49b('0x3c')](_0x3399d6[_0xa49b('0x34')]['sort']);_0x31bd98[_0xa49b('0x3d')]=qs[_0xa49b('0x35')](_['pick'](_0x3399d6['query'],_0x494f73[_0xa49b('0x35')]));if(_0x3399d6[_0xa49b('0x34')]['filter']){_0x31bd98[_0xa49b('0x3d')]=_[_0xa49b('0x40')](_0x31bd98[_0xa49b('0x3d')],{'$or':_[_0xa49b('0x58')](_0x31bd98[_0xa49b('0x37')],function(_0x3f2c5d){var _0x31b819={};_0x31b819[_0x3f2c5d]={'$like':'%'+_0x3399d6[_0xa49b('0x34')][_0xa49b('0x3f')]+'%'};return _0x31b819;})});}_0x31bd98=_['merge']({},_0x31bd98,_0x3399d6[_0xa49b('0x41')]);return _0x35c4e6['getContacts'](_0x31bd98);}})[_0xa49b('0x2a')](function(_0x23d26b){if(_0x23d26b){_0xb2b176=_0x23d26b['length'];if(!_0x3399d6[_0xa49b('0x34')][_0xa49b('0x3a')](_0xa49b('0x3b'))){_0x31bd98[_0xa49b('0x20')]=qs[_0xa49b('0x20')](_0x3399d6[_0xa49b('0x34')]['limit']);_0x31bd98[_0xa49b('0x1e')]=qs[_0xa49b('0x1e')](_0x3399d6[_0xa49b('0x34')][_0xa49b('0x1e')]);}return _0x35c4e6[_0xa49b('0x56')](_0x31bd98);}})[_0xa49b('0x2a')](function(_0x3eb1e9){if(_0x3eb1e9){return _0x3eb1e9?{'count':_0xb2b176,'rows':_0x3eb1e9}:null;}})['then'](respondWithResult(_0x26e638,null))['catch'](handleError(_0x26e638,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index a5e1b21..f386ff7 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 _0xad99=['CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./cmCompany.attributes'];(function(_0x2f9a4a,_0x93573e){var _0x1529f7=function(_0x206bfe){while(--_0x206bfe){_0x2f9a4a['push'](_0x2f9a4a['shift']());}};_0x1529f7(++_0x93573e);}(_0xad99,0xd3));var _0x9ad9=function(_0x475a8,_0x589d16){_0x475a8=_0x475a8-0x0;var _0x224501=_0xad99[_0x475a8];return _0x224501;};'use strict';var _=require(_0x9ad9('0x0'));var util=require(_0x9ad9('0x1'));var logger=require(_0x9ad9('0x2'))(_0x9ad9('0x3'));var moment=require(_0x9ad9('0x4'));var BPromise=require('bluebird');var rp=require(_0x9ad9('0x5'));var fs=require('fs');var path=require(_0x9ad9('0x6'));var rimraf=require(_0x9ad9('0x7'));var config=require('../../config/environment');var attributes=require(_0x9ad9('0x8'));module['exports']=function(_0x5c4027,_0x317e0a){return _0x5c4027['define'](_0x9ad9('0x9'),attributes,{'tableName':_0x9ad9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc546=['./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0xa87796,_0x2f96da){var _0x324722=function(_0x299126){while(--_0x299126){_0xa87796['push'](_0xa87796['shift']());}};_0x324722(++_0x2f96da);}(_0xc546,0x177));var _0x6c54=function(_0x1f632f,_0x30cd1b){_0x1f632f=_0x1f632f-0x0;var _0x78dd9=_0xc546[_0x1f632f];return _0x78dd9;};'use strict';var _=require(_0x6c54('0x0'));var util=require(_0x6c54('0x1'));var logger=require(_0x6c54('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6c54('0x3'));var rp=require(_0x6c54('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6c54('0x5'));module[_0x6c54('0x6')]=function(_0x2b28c6,_0x13fd4e){return _0x2b28c6[_0x6c54('0x7')](_0x6c54('0x8'),attributes,{'tableName':_0x6c54('0x9'),'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 62abe30..0651817 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 _0x7ec1=['info','CmCompany,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0x4ba4de,_0x5294d3){var _0x161c98=function(_0x334d44){while(--_0x334d44){_0x4ba4de['push'](_0x4ba4de['shift']());}};_0x161c98(++_0x5294d3);}(_0x7ec1,0x1d0));var _0x17ec=function(_0x292f12,_0x525719){_0x292f12=_0x292f12-0x0;var _0x1171a0=_0x7ec1[_0x292f12];return _0x1171a0;};'use strict';var _=require('lodash');var util=require(_0x17ec('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x17ec('0x1'));var fs=require('fs');var Redis=require(_0x17ec('0x2'));var db=require(_0x17ec('0x3'))['db'];var utils=require(_0x17ec('0x4'));var logger=require(_0x17ec('0x5'))(_0x17ec('0x6'));var config=require(_0x17ec('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x17ec('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36b509,_0x182ed6,_0x96f65d){return new BPromise(function(_0x570f78,_0x9b1da2){return client[_0x17ec('0x9')](_0x36b509,_0x96f65d)[_0x17ec('0xa')](function(_0xe4c24e){logger[_0x17ec('0xb')](_0x17ec('0xc'),_0x182ed6,_0x17ec('0xd'));logger['debug']('CmCompany,\x20%s,\x20%s,\x20%s',_0x182ed6,_0x17ec('0xd'),JSON[_0x17ec('0xe')](_0xe4c24e));if(_0xe4c24e['error']){if(_0xe4c24e[_0x17ec('0xf')][_0x17ec('0x10')]===0x1f4){logger['error'](_0x17ec('0xc'),_0x182ed6,_0xe4c24e[_0x17ec('0xf')][_0x17ec('0x11')]);return _0x9b1da2(_0xe4c24e[_0x17ec('0xf')]['message']);}logger['error'](_0x17ec('0xc'),_0x182ed6,_0xe4c24e[_0x17ec('0xf')][_0x17ec('0x11')]);return _0x570f78(_0xe4c24e[_0x17ec('0xf')]['message']);}else{logger[_0x17ec('0xb')](_0x17ec('0xc'),_0x182ed6,_0x17ec('0xd'));_0x570f78(_0xe4c24e['result']['message']);}})[_0x17ec('0x12')](function(_0xadcee4){logger[_0x17ec('0xf')](_0x17ec('0xc'),_0x182ed6,_0xadcee4);_0x9b1da2(_0xadcee4);});});} \ No newline at end of file +var _0x5f91=['lodash','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x3f9e45,_0x2d9fde){var _0x2635bf=function(_0x485103){while(--_0x485103){_0x3f9e45['push'](_0x3f9e45['shift']());}};_0x2635bf(++_0x2d9fde);}(_0x5f91,0xa8));var _0x15f9=function(_0x2ce0cf,_0x4a995a){_0x2ce0cf=_0x2ce0cf-0x0;var _0x2ae65f=_0x5f91[_0x2ce0cf];return _0x2ae65f;};'use strict';var _=require(_0x15f9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x15f9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x15f9('0x2'));var db=require(_0x15f9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x15f9('0x4'))('rpc');var config=require(_0x15f9('0x5'));var jayson=require(_0x15f9('0x6'));var client=jayson[_0x15f9('0x7')][_0x15f9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x277504,_0x595cf7,_0x2732f0){return new BPromise(function(_0x5f0591,_0x44213f){return client[_0x15f9('0x9')](_0x277504,_0x2732f0)['then'](function(_0x5c9675){logger[_0x15f9('0xa')](_0x15f9('0xb'),_0x595cf7,'request\x20sent');logger[_0x15f9('0xc')](_0x15f9('0xd'),_0x595cf7,_0x15f9('0xe'),JSON[_0x15f9('0xf')](_0x5c9675));if(_0x5c9675['error']){if(_0x5c9675[_0x15f9('0x10')][_0x15f9('0x11')]===0x1f4){logger[_0x15f9('0x10')](_0x15f9('0xb'),_0x595cf7,_0x5c9675[_0x15f9('0x10')][_0x15f9('0x12')]);return _0x44213f(_0x5c9675[_0x15f9('0x10')][_0x15f9('0x12')]);}logger[_0x15f9('0x10')]('CmCompany,\x20%s,\x20%s',_0x595cf7,_0x5c9675[_0x15f9('0x10')]['message']);return _0x5f0591(_0x5c9675[_0x15f9('0x10')][_0x15f9('0x12')]);}else{logger[_0x15f9('0xa')](_0x15f9('0xb'),_0x595cf7,_0x15f9('0xe'));_0x5f0591(_0x5c9675[_0x15f9('0x13')][_0x15f9('0x12')]);}})[_0x15f9('0x14')](function(_0x1ed611){logger[_0x15f9('0x10')](_0x15f9('0xb'),_0x595cf7,_0x1ed611);_0x44213f(_0x1ed611);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 9d8909f..ddcb009 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 _0xbcec=['/describe','isAuthenticated','/:id','show','getContacts','post','create','/:id/contacts','addContacts','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmCompany.controller','get'];(function(_0x537ef7,_0x1bd866){var _0x603c2e=function(_0x5a1cfa){while(--_0x5a1cfa){_0x537ef7['push'](_0x537ef7['shift']());}};_0x603c2e(++_0x1bd866);}(_0xbcec,0xbd));var _0xcbce=function(_0x84a97e,_0x59f2f2){_0x84a97e=_0x84a97e-0x0;var _0x3f980b=_0xbcec[_0x84a97e];return _0x3f980b;};'use strict';var multer=require('multer');var util=require(_0xcbce('0x0'));var path=require(_0xcbce('0x1'));var timeout=require(_0xcbce('0x2'));var express=require(_0xcbce('0x3'));var router=express[_0xcbce('0x4')]();var fs_extra=require(_0xcbce('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcbce('0x6'));var config=require('../../config/environment');var controller=require(_0xcbce('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xcbce('0x8')](_0xcbce('0x9'),auth[_0xcbce('0xa')](),controller['describe']);router[_0xcbce('0x8')](_0xcbce('0xb'),auth[_0xcbce('0xa')](),controller[_0xcbce('0xc')]);router[_0xcbce('0x8')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xcbce('0xd')]);router[_0xcbce('0xe')]('/',auth[_0xcbce('0xa')](),controller[_0xcbce('0xf')]);router['post'](_0xcbce('0x10'),auth[_0xcbce('0xa')](),controller[_0xcbce('0x11')]);router[_0xcbce('0x12')](_0xcbce('0xb'),auth[_0xcbce('0xa')](),controller[_0xcbce('0x13')]);router[_0xcbce('0x14')](_0xcbce('0xb'),auth[_0xcbce('0xa')](),controller[_0xcbce('0x15')]);module['exports']=router; \ No newline at end of file +var _0x896e=['../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts','put','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service'];(function(_0x111e94,_0x31c837){var _0x3de107=function(_0x65bd1e){while(--_0x65bd1e){_0x111e94['push'](_0x111e94['shift']());}};_0x3de107(++_0x31c837);}(_0x896e,0x6e));var _0xe896=function(_0x34a9d1,_0x42a7b1){_0x34a9d1=_0x34a9d1-0x0;var _0x493de9=_0x896e[_0x34a9d1];return _0x493de9;};'use strict';var multer=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe896('0x2')]();var fs_extra=require(_0xe896('0x3'));var auth=require(_0xe896('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe896('0x5'));var controller=require(_0xe896('0x6'));router[_0xe896('0x7')]('/',auth[_0xe896('0x8')](),controller[_0xe896('0x9')]);router[_0xe896('0x7')](_0xe896('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xe896('0x7')](_0xe896('0xb'),auth['isAuthenticated'](),controller[_0xe896('0xc')]);router[_0xe896('0x7')](_0xe896('0xd'),auth['isAuthenticated'](),controller[_0xe896('0xe')]);router[_0xe896('0xf')]('/',auth['isAuthenticated'](),controller[_0xe896('0x10')]);router[_0xe896('0xf')]('/:id/contacts',auth[_0xe896('0x8')](),controller[_0xe896('0x11')]);router[_0xe896('0x12')]('/:id',auth[_0xe896('0x8')](),controller[_0xe896('0x13')]);router[_0xe896('0x14')]('/:id',auth[_0xe896('0x8')](),controller[_0xe896('0x15')]);module[_0xe896('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index ff69cc5..c8726f7 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 _0x6bbc=['INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize','exports','STRING','TEXT'];(function(_0x19671a,_0x456e1e){var _0x33b179=function(_0xc26cc0){while(--_0xc26cc0){_0x19671a['push'](_0x19671a['shift']());}};_0x33b179(++_0x456e1e);}(_0x6bbc,0x1bd));var _0xc6bb=function(_0x485d47,_0x323593){_0x485d47=_0x485d47-0x0;var _0x342cb0=_0x6bbc[_0x485d47];return _0x342cb0;};'use strict';var _=require(_0xc6bb('0x0'));var Sequelize=require(_0xc6bb('0x1'));module[_0xc6bb('0x2')]={'firstName':{'type':Sequelize[_0xc6bb('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xc6bb('0x3')]},'street':{'type':Sequelize[_0xc6bb('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xc6bb('0x3')]},'country':{'type':Sequelize[_0xc6bb('0x3')]},'dateOfBirth':{'type':Sequelize[_0xc6bb('0x3')]},'description':{'type':Sequelize[_0xc6bb('0x4')]},'phone':{'type':Sequelize[_0xc6bb('0x3')]},'mobile':{'type':Sequelize[_0xc6bb('0x3')]},'fax':{'type':Sequelize[_0xc6bb('0x3')]},'email':{'type':Sequelize[_0xc6bb('0x3')]},'url':{'type':Sequelize[_0xc6bb('0x3')]},'facebook':{'type':Sequelize[_0xc6bb('0x3')]},'fb_data':{'type':Sequelize[_0xc6bb('0x3')]},'twitter':{'type':Sequelize[_0xc6bb('0x3')]},'skype':{'type':Sequelize[_0xc6bb('0x3')]},'teams':{'type':Sequelize[_0xc6bb('0x3')]},'viber':{'type':Sequelize[_0xc6bb('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xc6bb('0x3')]},'telegram':{'type':Sequelize[_0xc6bb('0x3')]},'UserId':{'type':Sequelize[_0xc6bb('0x5')]},'priority':{'type':Sequelize[_0xc6bb('0x5')](0x2)[_0xc6bb('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xc6bb('0x7')],'defaultValue':Sequelize[_0xc6bb('0x8')]}}; \ No newline at end of file +var _0x1cc2=['NOW','lodash','sequelize','STRING','TEXT','INTEGER','DATE'];(function(_0x22d138,_0x1fc968){var _0x25d611=function(_0x574d76){while(--_0x574d76){_0x22d138['push'](_0x22d138['shift']());}};_0x25d611(++_0x1fc968);}(_0x1cc2,0xda));var _0x21cc=function(_0xb7ed0,_0x3d1de9){_0xb7ed0=_0xb7ed0-0x0;var _0x543681=_0x1cc2[_0xb7ed0];return _0x543681;};'use strict';var _=require(_0x21cc('0x0'));var Sequelize=require(_0x21cc('0x1'));module['exports']={'firstName':{'type':Sequelize[_0x21cc('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x21cc('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x21cc('0x2')]},'city':{'type':Sequelize[_0x21cc('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x21cc('0x2')]},'description':{'type':Sequelize[_0x21cc('0x3')]},'phone':{'type':Sequelize[_0x21cc('0x2')]},'mobile':{'type':Sequelize[_0x21cc('0x2')]},'fax':{'type':Sequelize[_0x21cc('0x2')]},'email':{'type':Sequelize[_0x21cc('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x21cc('0x2')]},'fb_data':{'type':Sequelize[_0x21cc('0x2')]},'twitter':{'type':Sequelize[_0x21cc('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x21cc('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x21cc('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x21cc('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x21cc('0x5')],'defaultValue':Sequelize[_0x21cc('0x6')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 1b8f39b..ba5a928 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 _0x3d24=['params','tags','columnName','displayName','findAll','alias','values','body','get','mergeWith','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','CmHopperHistory','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','bulkCreate','each','duplicates','$or','findOrCreate','spread','show','$and','omit','format','cf_%d','table','cm_contacts','setFields','toParam','CmHopper','rawAttributes','intersection','fields','options','getTags','setTags','ids','getHoppers','nolimit','ContactId','includeAll','include','getHopperFinals','CmHopperFinal','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','binding_keys','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','phone','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','fork','CompanyId','json','File\x20uploaded\x20correctly!','pid','createReadStream','path','meta','import','binding','child_process','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','getJourney','chat','sms','openchannel','fax','whatsapp','voice','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20createdAt\x20filter','uniqueid','destination','callerid','endtime','note','createdAt','userSecondDisposition','userThirdDisposition','UserId','findAndCountAll','fullname','startCase','Account','closed','closedAt','secondDisposition','thirdDisposition','key','browserName','customerIp','deviceModel','ratingMessage','ratingType','ratingValue','referer','mail','subject','substatus','externalUrl','threadId','Interaction','Owner','all','flatten','sortBy','reverse','rimraf','zip-dir','request-promise','moment','mustache','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./cmContact.socket','register','sendStatus','end','status','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','CmContact','describe','keys','length','startsWith','cf_','CmCustomField','findOne','trimStart','fieldType','model','query','filters','attributes','hasOwnProperty','order','sort','where','pick','select','field','color','from','tools_tags','left_join','cm_user_has_contacts','cm_contact_has_tags','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','Tag','value','split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','and','uc.UserId\x20=\x20?','dateOfBirth','datetime','castTo','DATE','buildExpression','type','text','map','filter','isNil','Contact','push','isEmpty','ListId','c.ListId\x20IN\x20?','concat','tag','isArray','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','group','c.id','Sequelize','clone','DESC','resolve','user','role','agent','some','User','getLists','keyBy','merge','c.firstName','c.lastName','c.phone','c.mobile','c.fax','c.email','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','sequelize','toString','Tags','catch','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d24,0x94));var _0x43d2=function(_0x13fb26,_0x3c4c1e){_0x13fb26=_0x13fb26-0x0;var _0x4b38e1=_0x3d24[_0x13fb26];return _0x4b38e1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x43d2('0x0'));var zipdir=require(_0x43d2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x43d2('0x2'));var moment=require(_0x43d2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x43d2('0x4'));var util=require('util');var path=require('path');var sox=require(_0x43d2('0x5'));var csv=require(_0x43d2('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x43d2('0x7'));var _=require('lodash');var squel=require(_0x43d2('0x8'));var crypto=require(_0x43d2('0x9'));var jsforce=require(_0x43d2('0xa'));var deskjs=require(_0x43d2('0xb'));var toCsv=require(_0x43d2('0x6'));var querystring=require(_0x43d2('0xc'));var Papa=require(_0x43d2('0xd'));var Redis=require('ioredis');var authService=require(_0x43d2('0xe'));var qs=require(_0x43d2('0xf'));var as=require(_0x43d2('0x10'));var hardwareService=require(_0x43d2('0x11'));var logger=require(_0x43d2('0x12'))('api');var utils=require(_0x43d2('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x43d2('0x14'))['db'];config['redis']=_['defaults'](config[_0x43d2('0x15')],{'host':_0x43d2('0x16'),'port':0x18eb});var socket=require(_0x43d2('0x17'))(new Redis(config[_0x43d2('0x15')]));require(_0x43d2('0x18'))[_0x43d2('0x19')](socket);function respondWithStatusCode(_0x1a3650,_0x1bdd0f){_0x1bdd0f=_0x1bdd0f||0xcc;return function(_0x44574b){if(_0x44574b){return _0x1a3650[_0x43d2('0x1a')](_0x1bdd0f);}return _0x1a3650['status'](_0x1bdd0f)[_0x43d2('0x1b')]();};}function respondWithResult(_0x330da3,_0x361b1b){_0x361b1b=_0x361b1b||0xc8;return function(_0x3d2ce7){if(_0x3d2ce7){return _0x330da3[_0x43d2('0x1c')](_0x361b1b)['json'](_0x3d2ce7);}};}function respondWithFilteredResult(_0x1e33a4,_0x23bb76){return function(_0x12154e){if(_0x12154e){var _0x54b94e=typeof _0x23bb76[_0x43d2('0x1d')]===_0x43d2('0x1e')&&typeof _0x23bb76[_0x43d2('0x1f')]===_0x43d2('0x1e');var _0x1d1e21=_0x12154e[_0x43d2('0x20')];var _0xe3e28c=_0x54b94e?0x0:_0x23bb76[_0x43d2('0x1d')];var _0x10b221=_0x54b94e?_0x12154e[_0x43d2('0x20')]:_0x23bb76[_0x43d2('0x1d')]+_0x23bb76[_0x43d2('0x1f')];var _0x8ddb9d;if(_0x10b221>=_0x1d1e21){_0x10b221=_0x1d1e21;_0x8ddb9d=0xc8;}else{_0x8ddb9d=0xce;}_0x1e33a4[_0x43d2('0x1c')](_0x8ddb9d);return _0x1e33a4['set'](_0x43d2('0x21'),_0xe3e28c+'-'+_0x10b221+'/'+_0x1d1e21)['json'](_0x12154e);}return null;};}function patchUpdates(_0x44eb3d){return function(_0x1825af){try{jsonpatch[_0x43d2('0x22')](_0x1825af,_0x44eb3d,!![]);}catch(_0x3d4323){return BPromise[_0x43d2('0x23')](_0x3d4323);}return _0x1825af[_0x43d2('0x24')]();};}function saveUpdates(_0xc0388a,_0x4d38d8){return function(_0x58779c){if(_0x58779c){return _0x58779c[_0x43d2('0x25')](_0xc0388a)['then'](function(_0x47d45f){return _0x47d45f;});}return null;};}function removeEntity(_0x38c4b7,_0x4e3b1b){return function(_0xcbb2c3){if(_0xcbb2c3){return _0xcbb2c3[_0x43d2('0x26')]()[_0x43d2('0x27')](function(){_0x38c4b7[_0x43d2('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11ea56,_0x11917f){return function(_0x55634c){if(!_0x55634c){_0x11ea56[_0x43d2('0x1a')](0x194);}return _0x55634c;};}function handleError(_0xfd401b,_0x597658){_0x597658=_0x597658||0x1f4;return function(_0x2e2bc6){logger[_0x43d2('0x28')](_0x2e2bc6['stack']);if(_0x2e2bc6[_0x43d2('0x29')]){delete _0x2e2bc6[_0x43d2('0x29')];}_0xfd401b[_0x43d2('0x1c')](_0x597658)[_0x43d2('0x2a')](_0x2e2bc6);};}exports[_0x43d2('0x2b')]=function(_0x337114,_0x4aa22d){var _0x5ddb10={},_0x252453={},_0x43e556={'count':0x0,'rows':[]};return db[_0x43d2('0x2c')][_0x43d2('0x2d')]()[_0x43d2('0x27')](function(_0x48c512){var _0x456f1f=[];for(var _0x1cb115=0x0;_0x1cb1150x1){_0x10143e['or'](_0x43d2('0x69'),qs['getFullTextValue'](_0x239d38),null);}else{if(qs['isNumeric'](_0x239d38)){_0x10143e['or'](_0x43d2('0x6a'),_0x239d38+'%');_0x10143e['or']('c.phone\x20LIKE\x20?',_0x239d38+'%');_0x10143e['or'](_0x43d2('0x6b'),_0x239d38+'%');_0x10143e['or'](_0x43d2('0x6c'),_0x239d38+'%');}else if(qs['isEmail'](_0x239d38)){_0x10143e['or'](_0x43d2('0x6d'),_0x239d38+'%');}else{_0x10143e['or'](_0x43d2('0x6e'),'%'+_0x239d38+'%');_0x10143e['or']('c.lastName\x20LIKE\x20?','%'+_0x239d38+'%');_0x10143e['or']('c.email\x20LIKE\x20?','%'+_0x239d38+'%');}}}}_0x4dba54[_0x43d2('0x3d')](_0x10143e);_0x4dba54[_0x43d2('0x6f')](_0x43d2('0x70'));var _0x8611b8={'type':db[_0x43d2('0x71')]['QueryTypes']['SELECT'],'raw':!![]};var _0x3ce283=_0x4dba54[_0x43d2('0x72')]()[_0x43d2('0x40')]('c.id');if(_0x5ddb10['order']){_0x5ddb10[_0x43d2('0x3b')]['forEach'](function(_0x1cb573){_0x4dba54[_0x43d2('0x3b')]('c.'+_0x1cb573[0x0],_0x1cb573[0x1]===_0x43d2('0x73')?![]:!![]);});}if(!_[_0x43d2('0x62')](_0xdda4af)){_0x4dba54['having'](_0x5acda9);_0x3ce283[_0x43d2('0x3d')]('t.id\x20IN\x20?',_0xdda4af);}BPromise[_0x43d2('0x74')]()['then'](function(){if(!_0xd3cbe3)return;if(_0x337114[_0x43d2('0x75')][_0x43d2('0x76')]!==_0x43d2('0x77'))return;if(!_[_0x43d2('0x78')](_0xd3cbe3[_0x43d2('0x4d')],[_0x43d2('0x40'),_0x43d2('0x79')])){return _0x337114['user'][_0x43d2('0x7a')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1093f8){if(_[_0x43d2('0x62')](_0x1093f8)){_0x3ce283[_0x43d2('0x3d')]('c.ListId\x20IS\x20NULL');_0x4dba54[_0x43d2('0x3d')]('c.ListId\x20IS\x20NULL');}else{_0x3ce283[_0x43d2('0x3d')](_0x43d2('0x64'),_[_0x43d2('0x5d')](_0x1093f8,'id'));_0x4dba54['where'](_0x43d2('0x64'),_[_0x43d2('0x5d')](_0x1093f8,'id'));}});}})[_0x43d2('0x27')](function(){if(_0x337114[_0x43d2('0x75')][_0x43d2('0x76')]===_0x43d2('0x77')&&!_0xd3cbe3&&!_0x337114[_0x43d2('0x37')][_0x43d2('0x63')])return[];return db['sequelize'][_0x43d2('0x37')](_0x3ce283['toString'](),_0x8611b8);})[_0x43d2('0x27')](function(_0x187a4c){_0x43e556[_0x43d2('0x20')]=_0x187a4c[_0x43d2('0x2f')];if(_0x43e556['count']===0x0)return[];return db['sequelize'][_0x43d2('0x37')](_0x51750c['toString'](),_0x8611b8)[_0x43d2('0x27')](function(_0x43452b){_0x5bec5b=_[_0x43d2('0x7b')](_0x43452b,'id');_0x8611b8=_[_0x43d2('0x7c')](_0x8611b8,{'model':db[_0x43d2('0x2c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x337114['query']['fields']){_0x5ddb10['attributes'][_0x43d2('0x51')](function(_0x187245){_0x4dba54[_0x43d2('0x40')]('c.'+_0x187245);});}else{_0x4dba54[_0x43d2('0x40')](_0x43d2('0x70'));_0x4dba54['field'](_0x43d2('0x7d'));_0x4dba54['field'](_0x43d2('0x7e'));_0x4dba54[_0x43d2('0x40')](_0x43d2('0x7f'));_0x4dba54[_0x43d2('0x40')](_0x43d2('0x80'));_0x4dba54['field'](_0x43d2('0x81'));_0x4dba54[_0x43d2('0x40')](_0x43d2('0x82'));_0x4dba54['field'](_0x43d2('0x83'));_0x4dba54[_0x43d2('0x40')](_0x43d2('0x84'));_0x4dba54['field'](_0x43d2('0x85'));_0x4dba54[_0x43d2('0x40')](_0x43d2('0x86'));_0x4dba54[_0x43d2('0x40')](_0x43d2('0x87'),_0x43d2('0x88'));}if(_0x5ddb10['limit'])_0x4dba54['limit'](_0x5ddb10[_0x43d2('0x1f')]);if(_0x5ddb10['offset'])_0x4dba54[_0x43d2('0x1d')](_0x5ddb10[_0x43d2('0x1d')]);return db[_0x43d2('0x89')]['query'](_0x4dba54[_0x43d2('0x8a')](),_0x8611b8);});})[_0x43d2('0x27')](function(_0x17272c){_0x17272c[_0x43d2('0x51')](function(_0x59eb80){if(_0x59eb80['TagIds']){_0x59eb80[_0x43d2('0x8b')]=[];_0x59eb80[_0x43d2('0x88')][_0x43d2('0x50')](',')[_0x43d2('0x51')](function(_0x157097){_0x59eb80['Tags'][_0x43d2('0x61')](_0x5bec5b[_0x157097]);});}delete _0x59eb80[_0x43d2('0x88')];});_0x43e556['rows']=_0x17272c;return _0x43e556;})[_0x43d2('0x27')](respondWithFilteredResult(_0x4aa22d,_0x5ddb10));})[_0x43d2('0x8c')](handleError(_0x4aa22d,null));};exports[_0x43d2('0x26')]=function(_0x517baf,_0x54f0d6){return db[_0x43d2('0x2c')][_0x43d2('0x8d')]({'where':{'id':_0x517baf[_0x43d2('0x8e')]['id']}})[_0x43d2('0x27')](handleEntityNotFound(_0x54f0d6,null))[_0x43d2('0x27')](removeEntity(_0x54f0d6,null))[_0x43d2('0x8c')](handleError(_0x54f0d6,null));};exports[_0x43d2('0x2d')]=function(_0x361d4b,_0x4ca836){return db[_0x43d2('0x2c')][_0x43d2('0x2d')]()[_0x43d2('0x27')](function(_0x27f3b1){delete _0x27f3b1[_0x43d2('0x8f')];for(var _0x56d61d=0x0;_0x56d61d=_0x748b8){_0x4ee56b=_0x748b8;_0x23e9fd=0xc8;}else{_0x23e9fd=0xce;}_0x2eae5d[_0x9fe4('0x1f')](_0x23e9fd);return _0x2eae5d[_0x9fe4('0x25')](_0x9fe4('0x26'),_0x2fa1bb+'-'+_0x4ee56b+'/'+_0x748b8)['json'](_0x50ec9e);}return null;};}function patchUpdates(_0x45a9cd){return function(_0x3c247d){try{jsonpatch['apply'](_0x3c247d,_0x45a9cd,!![]);}catch(_0xc03da0){return BPromise[_0x9fe4('0x27')](_0xc03da0);}return _0x3c247d['save']();};}function saveUpdates(_0x11e0f5,_0x3ea8cc){return function(_0x295664){if(_0x295664){return _0x295664[_0x9fe4('0x28')](_0x11e0f5)[_0x9fe4('0x29')](function(_0x5bffda){return _0x5bffda;});}return null;};}function removeEntity(_0x574daf,_0x55bae1){return function(_0xf77905){if(_0xf77905){return _0xf77905[_0x9fe4('0x2a')]()[_0x9fe4('0x29')](function(){_0x574daf[_0x9fe4('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2892ef,_0x1fc5f5){return function(_0x4547c3){if(!_0x4547c3){_0x2892ef[_0x9fe4('0x1d')](0x194);}return _0x4547c3;};}function handleError(_0x169797,_0x32ef2b){_0x32ef2b=_0x32ef2b||0x1f4;return function(_0x4bc08c){logger[_0x9fe4('0x2b')](_0x4bc08c[_0x9fe4('0x2c')]);if(_0x4bc08c['name']){delete _0x4bc08c[_0x9fe4('0x2d')];}_0x169797['status'](_0x32ef2b)[_0x9fe4('0x2e')](_0x4bc08c);};}exports[_0x9fe4('0x2f')]=function(_0x5a9bcc,_0x584ef3){var _0x88f00b={},_0x120ec6={},_0x192142={'count':0x0,'rows':[]};return db[_0x9fe4('0x30')][_0x9fe4('0x31')]()['then'](function(_0x121f8d){var _0x6d66a4=[];for(var _0xb75e8=0x0;_0xb75e80x1){_0x1f761c['or'](_0x9fe4('0x73'),qs[_0x9fe4('0x74')](_0x566ad4),null);}else{if(qs[_0x9fe4('0x75')](_0x566ad4)){_0x1f761c['or'](_0x9fe4('0x76'),_0x566ad4+'%');_0x1f761c['or'](_0x9fe4('0x77'),_0x566ad4+'%');_0x1f761c['or']('c.mobile\x20LIKE\x20?',_0x566ad4+'%');_0x1f761c['or'](_0x9fe4('0x78'),_0x566ad4+'%');}else if(qs['isEmail'](_0x566ad4)){_0x1f761c['or']('c.email\x20LIKE\x20?',_0x566ad4+'%');}else{_0x1f761c['or'](_0x9fe4('0x79'),'%'+_0x566ad4+'%');_0x1f761c['or']('c.lastName\x20LIKE\x20?','%'+_0x566ad4+'%');_0x1f761c['or']('c.email\x20LIKE\x20?','%'+_0x566ad4+'%');}}}}_0x30434f['where'](_0x1f761c);_0x30434f['group'](_0x9fe4('0x7a'));var _0x4fc80c={'type':db[_0x9fe4('0x7b')][_0x9fe4('0x7c')][_0x9fe4('0x7d')],'raw':!![]};var _0x449987=_0x30434f[_0x9fe4('0x7e')]()[_0x9fe4('0x48')](_0x9fe4('0x7a'));if(_0x88f00b[_0x9fe4('0x44')]){_0x88f00b[_0x9fe4('0x44')][_0x9fe4('0x70')](function(_0x42d5e1){_0x30434f[_0x9fe4('0x44')]('c.'+_0x42d5e1[0x0],_0x42d5e1[0x1]===_0x9fe4('0x7f')?![]:!![]);});}if(!_[_0x9fe4('0x69')](_0x4c807f)){_0x30434f[_0x9fe4('0x80')](_0x2bb796);_0x449987[_0x9fe4('0x46')](_0x9fe4('0x81'),_0x4c807f);}BPromise['resolve']()[_0x9fe4('0x29')](function(){if(!_0x205ec6)return;if(_0x5a9bcc[_0x9fe4('0x82')]['role']!==_0x9fe4('0x83'))return;if(!_[_0x9fe4('0x84')](_0x205ec6[_0x9fe4('0x56')],[_0x9fe4('0x48'),_0x9fe4('0x5c')])){return _0x5a9bcc[_0x9fe4('0x82')][_0x9fe4('0x85')]({'attributes':['id'],'raw':!![]})[_0x9fe4('0x29')](function(_0x50156a){if(_[_0x9fe4('0x69')](_0x50156a)){_0x449987[_0x9fe4('0x46')](_0x9fe4('0x86'));_0x30434f[_0x9fe4('0x46')](_0x9fe4('0x86'));}else{_0x449987[_0x9fe4('0x46')](_0x9fe4('0x6b'),_['map'](_0x50156a,'id'));_0x30434f[_0x9fe4('0x46')]('c.ListId\x20IN\x20?',_[_0x9fe4('0x5a')](_0x50156a,'id'));}});}})[_0x9fe4('0x29')](function(){if(_0x5a9bcc['user'][_0x9fe4('0x87')]===_0x9fe4('0x83')&&!_0x205ec6&&!_0x5a9bcc[_0x9fe4('0x3d')][_0x9fe4('0x6a')])return[];return db[_0x9fe4('0x88')][_0x9fe4('0x3d')](_0x449987['toString'](),_0x4fc80c);})[_0x9fe4('0x29')](function(_0x4a6ac1){_0x192142[_0x9fe4('0x24')]=_0x4a6ac1[_0x9fe4('0x33')];if(_0x192142[_0x9fe4('0x24')]===0x0)return[];return db['sequelize'][_0x9fe4('0x3d')](_0x2a4b60[_0x9fe4('0x89')](),_0x4fc80c)[_0x9fe4('0x29')](function(_0x153ebc){_0x10a35e=_[_0x9fe4('0x8a')](_0x153ebc,'id');_0x4fc80c=_[_0x9fe4('0x8b')](_0x4fc80c,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5a9bcc['query'][_0x9fe4('0x41')]){_0x88f00b[_0x9fe4('0x40')][_0x9fe4('0x70')](function(_0x667ebf){_0x30434f['field']('c.'+_0x667ebf);});}else{_0x30434f[_0x9fe4('0x48')]('c.id');_0x30434f[_0x9fe4('0x48')](_0x9fe4('0x8c'));_0x30434f[_0x9fe4('0x48')]('c.lastName');_0x30434f[_0x9fe4('0x48')]('c.phone');_0x30434f[_0x9fe4('0x48')]('c.mobile');_0x30434f['field']('c.fax');_0x30434f['field'](_0x9fe4('0x8d'));_0x30434f[_0x9fe4('0x48')](_0x9fe4('0x8e'));_0x30434f['field'](_0x9fe4('0x8f'));_0x30434f[_0x9fe4('0x48')](_0x9fe4('0x90'));_0x30434f[_0x9fe4('0x48')](_0x9fe4('0x91'));_0x30434f['field'](_0x9fe4('0x92'),_0x9fe4('0x93'));}if(_0x88f00b[_0x9fe4('0x21')])_0x30434f[_0x9fe4('0x21')](_0x88f00b['limit']);if(_0x88f00b[_0x9fe4('0x23')])_0x30434f['offset'](_0x88f00b[_0x9fe4('0x23')]);return db[_0x9fe4('0x88')][_0x9fe4('0x3d')](_0x30434f[_0x9fe4('0x89')](),_0x4fc80c);});})[_0x9fe4('0x29')](function(_0x337315){_0x337315[_0x9fe4('0x70')](function(_0x55026e){if(_0x55026e[_0x9fe4('0x93')]){_0x55026e[_0x9fe4('0x94')]=[];_0x55026e[_0x9fe4('0x93')][_0x9fe4('0x72')](',')[_0x9fe4('0x70')](function(_0x11e9e1){_0x55026e[_0x9fe4('0x94')][_0x9fe4('0x34')](_0x10a35e[_0x11e9e1]);});}delete _0x55026e[_0x9fe4('0x93')];});_0x192142[_0x9fe4('0x95')]=_0x337315;return _0x192142;})[_0x9fe4('0x29')](respondWithFilteredResult(_0x584ef3,_0x88f00b));})[_0x9fe4('0x96')](handleError(_0x584ef3,null));};exports[_0x9fe4('0x2a')]=function(_0x3f4405,_0x338d02){return db[_0x9fe4('0x30')][_0x9fe4('0x57')]({'where':{'id':_0x3f4405[_0x9fe4('0x97')]['id']}})['then'](handleEntityNotFound(_0x338d02,null))[_0x9fe4('0x29')](removeEntity(_0x338d02,null))[_0x9fe4('0x96')](handleError(_0x338d02,null));};exports[_0x9fe4('0x31')]=function(_0x3346c3,_0x1f47a8){return db[_0x9fe4('0x30')][_0x9fe4('0x31')]()['then'](function(_0x131ad3){delete _0x131ad3['tags'];for(var _0x66e959=0x0;_0x66e959{}\s\\|]/g,'-');_0x532a2f(null,util[_0x3382('0x21')](_0x3382('0x22'),path[_0x3382('0x23')](_0x389a77[_0x3382('0x1f')],path[_0x3382('0x24')](_0x389a77['originalname'])),Date[_0x3382('0x25')](),path[_0x3382('0x24')](_0x389a77[_0x3382('0x1f')])));}})});router['post'](_0x3382('0x26'),upload[_0x3382('0x27')](_0x3382('0x28')),controller[_0x3382('0x29')]);var upload=multer({'storage':multer[_0x3382('0x2a')]({'destination':function(_0x3d1a23,_0x172810,_0x2af609){_0x2af609(null,path[_0x3382('0x2b')](config[_0x3382('0x1d')],_0x3382('0x1e')));},'filename':function(_0x59f34c,_0x14ea16,_0x216505){_0x14ea16[_0x3382('0x1f')]=_0x14ea16['originalname'][_0x3382('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x216505(null,util[_0x3382('0x21')](_0x3382('0x22'),path[_0x3382('0x23')](_0x14ea16['originalname'],path['extname'](_0x14ea16['originalname'])),Date[_0x3382('0x25')](),path[_0x3382('0x24')](_0x14ea16[_0x3382('0x1f')])));}})});router['post'](_0x3382('0x2c'),upload[_0x3382('0x27')](_0x3382('0x28')),controller['upload']);router[_0x3382('0x2d')](_0x3382('0x2e'),auth['isAuthenticated'](),controller[_0x3382('0x2f')]);router[_0x3382('0x30')](_0x3382('0xc'),auth[_0x3382('0x8')](),controller[_0x3382('0x31')]);router[_0x3382('0x32')](_0x3382('0xc'),auth[_0x3382('0x8')](),controller[_0x3382('0x33')]);module[_0x3382('0x34')]=router; \ No newline at end of file +var _0x49d7=['originalname','replace','%s-%s%s','basename','extname','now','/csv','single','file','server/files/tmp','format','/upload','upload','/upload/:id','import','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','post','/merge','merge','create','/create_many','bulkCreate','setTags','diskStorage','join','root'];(function(_0x165130,_0x37b671){var _0x7c6cf7=function(_0x4312b9){while(--_0x4312b9){_0x165130['push'](_0x165130['shift']());}};_0x7c6cf7(++_0x37b671);}(_0x49d7,0xe7));var _0x749d=function(_0x4dab14,_0x164ea0){_0x4dab14=_0x4dab14-0x0;var _0xf41aa=_0x49d7[_0x4dab14];return _0xf41aa;};'use strict';var multer=require(_0x749d('0x0'));var util=require('util');var path=require(_0x749d('0x1'));var timeout=require(_0x749d('0x2'));var express=require(_0x749d('0x3'));var router=express[_0x749d('0x4')]();var fs_extra=require(_0x749d('0x5'));var auth=require(_0x749d('0x6'));var interaction=require(_0x749d('0x7'));var config=require(_0x749d('0x8'));var controller=require('./cmContact.controller');router[_0x749d('0x9')]('/',auth['isAuthenticated'](),controller[_0x749d('0xa')]);router['get'](_0x749d('0xb'),auth[_0x749d('0xc')](),controller['describe']);router[_0x749d('0x9')](_0x749d('0xd'),auth['isAuthenticated'](),controller[_0x749d('0xe')]);router[_0x749d('0x9')]('/:id/tags',auth[_0x749d('0xc')](),controller[_0x749d('0xf')]);router[_0x749d('0x9')](_0x749d('0x10'),auth[_0x749d('0xc')](),controller[_0x749d('0x11')]);router[_0x749d('0x9')](_0x749d('0x12'),auth[_0x749d('0xc')](),controller[_0x749d('0x13')]);router[_0x749d('0x9')](_0x749d('0x14'),auth['isAuthenticated'](),controller[_0x749d('0x15')]);router[_0x749d('0x9')](_0x749d('0x16'),auth[_0x749d('0xc')](),controller[_0x749d('0x17')]);router[_0x749d('0x9')]('/:id/journey',auth[_0x749d('0xc')](),controller['getJourney']);router[_0x749d('0x18')](_0x749d('0x19'),auth[_0x749d('0xc')](),controller[_0x749d('0x1a')]);router[_0x749d('0x18')]('/',auth['isAuthenticated'](),controller[_0x749d('0x1b')]);router[_0x749d('0x18')](_0x749d('0x1c'),auth['isAuthenticated'](),controller[_0x749d('0x1d')]);router[_0x749d('0x18')]('/:id/tags',auth[_0x749d('0xc')](),controller[_0x749d('0x1e')]);var upload=multer({'storage':multer[_0x749d('0x1f')]({'destination':function(_0x3b6316,_0x555d9e,_0x23839b){_0x23839b(null,path[_0x749d('0x20')](config[_0x749d('0x21')],'server/files/tmp'));},'filename':function(_0x37f266,_0x5e8473,_0x5c99da){_0x5e8473['originalname']=_0x5e8473[_0x749d('0x22')][_0x749d('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5c99da(null,util['format'](_0x749d('0x24'),path[_0x749d('0x25')](_0x5e8473['originalname'],path[_0x749d('0x26')](_0x5e8473[_0x749d('0x22')])),Date[_0x749d('0x27')](),path[_0x749d('0x26')](_0x5e8473[_0x749d('0x22')])));}})});router[_0x749d('0x18')](_0x749d('0x28'),upload[_0x749d('0x29')](_0x749d('0x2a')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x749d('0x1f')]({'destination':function(_0x3fb3d4,_0x1fe566,_0x223487){_0x223487(null,path['join'](config[_0x749d('0x21')],_0x749d('0x2b')));},'filename':function(_0x4d6c18,_0x3cd08b,_0x1a2f99){_0x3cd08b[_0x749d('0x22')]=_0x3cd08b[_0x749d('0x22')][_0x749d('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1a2f99(null,util[_0x749d('0x2c')](_0x749d('0x24'),path[_0x749d('0x25')](_0x3cd08b[_0x749d('0x22')],path[_0x749d('0x26')](_0x3cd08b[_0x749d('0x22')])),Date[_0x749d('0x27')](),path[_0x749d('0x26')](_0x3cd08b[_0x749d('0x22')])));}})});router[_0x749d('0x18')](_0x749d('0x2d'),upload['single']('file'),controller[_0x749d('0x2e')]);router[_0x749d('0x18')](_0x749d('0x2f'),auth[_0x749d('0xc')](),controller[_0x749d('0x30')]);router[_0x749d('0x31')](_0x749d('0xd'),auth[_0x749d('0xc')](),controller[_0x749d('0x32')]);router[_0x749d('0x33')](_0x749d('0xd'),auth[_0x749d('0xc')](),controller[_0x749d('0x34')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 7747136..29ed862 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 _0xac65=['VIRTUAL','getDataValue','alias','name','TEXT','long','values','isArray','setDataValue','stringify','BOOLEAN','ENUM','voice','sequelize','exports'];(function(_0x29fb88,_0xb6d9f2){var _0x2b9dd7=function(_0x2e76fe){while(--_0x2e76fe){_0x29fb88['push'](_0x29fb88['shift']());}};_0x2b9dd7(++_0xb6d9f2);}(_0xac65,0xa3));var _0x5ac6=function(_0x4f687f,_0x2a28d4){_0x4f687f=_0x4f687f-0x0;var _0xa3371c=_0xac65[_0x4f687f];return _0xa3371c;};'use strict';var Sequelize=require(_0x5ac6('0x0'));var _=require('lodash');module[_0x5ac6('0x1')]={'name':{'type':Sequelize[_0x5ac6('0x2')],'get':function(_0x2422f6){return this[_0x5ac6('0x3')](_0x5ac6('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x3a124f){this['setDataValue'](_0x5ac6('0x4'),_0x3a124f?_0x3a124f:this[_0x5ac6('0x3')](_0x5ac6('0x5')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x5ac6('0x6')](_0x5ac6('0x7')),'get':function(){if(this[_0x5ac6('0x3')]('type')==='select'){return JSON['parse'](this['getDataValue'](_0x5ac6('0x8')));}else{return this[_0x5ac6('0x3')](_0x5ac6('0x8'));}},'set':function(_0x1a0c69){if(Array[_0x5ac6('0x9')](_0x1a0c69)){this[_0x5ac6('0xa')](_0x5ac6('0x8'),JSON[_0x5ac6('0xb')](_0x1a0c69));}else{this[_0x5ac6('0xa')](_0x5ac6('0x8'),_0x1a0c69);}}},'required':{'type':Sequelize[_0x5ac6('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x5ac6('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x5ac6('0xd')](_0x5ac6('0xe'))}}; \ No newline at end of file +var _0x345d=['sequelize','lodash','VIRTUAL','getDataValue','alias','setDataValue','STRING','type','parse','stringify','values','BOOLEAN','voice'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x345d,0x82));var _0xd345=function(_0x570c9b,_0x121183){_0x570c9b=_0x570c9b-0x0;var _0x1c3fd3=_0x345d[_0x570c9b];return _0x1c3fd3;};'use strict';var Sequelize=require(_0xd345('0x0'));var _=require(_0xd345('0x1'));module['exports']={'name':{'type':Sequelize[_0xd345('0x2')],'get':function(_0x58784a){return this[_0xd345('0x3')](_0xd345('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x17683a){this[_0xd345('0x5')](_0xd345('0x4'),_0x17683a?_0x17683a:this[_0xd345('0x3')]('name'));}},'type':{'type':Sequelize[_0xd345('0x6')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this['getDataValue'](_0xd345('0x7'))==='select'){return JSON[_0xd345('0x8')](this[_0xd345('0x3')]('values'));}else{return this['getDataValue']('values');}},'set':function(_0xe2b267){if(Array['isArray'](_0xe2b267)){this['setDataValue']('values',JSON[_0xd345('0x9')](_0xe2b267));}else{this[_0xd345('0x5')](_0xd345('0xa'),_0xe2b267);}}},'required':{'type':Sequelize[_0xd345('0xb')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xd345('0xc'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 4ed553f..1ebe8ff 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 _0x97bf=['sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','options','find','body','create','sequelize','transaction','TEXT','Sequelize','INTEGER','switch','defaultValue','queryInterface','addColumn','cm_contacts','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','count','offset','set','json','reject','update','then','destroy','stack','name','send','index','map','CmCustomField','type','key','model','query','intersection','fields','length','attributes','hasOwnProperty','order'];(function(_0x38889b,_0x6cf56b){var _0x4b3c97=function(_0x5acfaf){while(--_0x5acfaf){_0x38889b['push'](_0x38889b['shift']());}};_0x4b3c97(++_0x6cf56b);}(_0x97bf,0x74));var _0xf97b=function(_0x8c1f70,_0x1e3ee7){_0x8c1f70=_0x8c1f70-0x0;var _0x3ac123=_0x97bf[_0x8c1f70];return _0x3ac123;};'use strict';var emlformat=require(_0xf97b('0x0'));var rimraf=require(_0xf97b('0x1'));var zipdir=require(_0xf97b('0x2'));var jsonpatch=require(_0xf97b('0x3'));var rp=require(_0xf97b('0x4'));var moment=require(_0xf97b('0x5'));var BPromise=require(_0xf97b('0x6'));var Mustache=require(_0xf97b('0x7'));var util=require(_0xf97b('0x8'));var path=require(_0xf97b('0x9'));var sox=require(_0xf97b('0xa'));var csv=require(_0xf97b('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf97b('0xc'));var _=require('lodash');var squel=require(_0xf97b('0xd'));var crypto=require(_0xf97b('0xe'));var jsforce=require(_0xf97b('0xf'));var deskjs=require(_0xf97b('0x10'));var toCsv=require(_0xf97b('0xb'));var querystring=require(_0xf97b('0x11'));var Papa=require(_0xf97b('0x12'));var Redis=require(_0xf97b('0x13'));var authService=require(_0xf97b('0x14'));var qs=require(_0xf97b('0x15'));var as=require(_0xf97b('0x16'));var hardwareService=require(_0xf97b('0x17'));var logger=require(_0xf97b('0x18'))(_0xf97b('0x19'));var utils=require(_0xf97b('0x1a'));var config=require(_0xf97b('0x1b'));var licenseUtil=require(_0xf97b('0x1c'));var db=require(_0xf97b('0x1d'))['db'];function respondWithStatusCode(_0x398c97,_0xb932b6){_0xb932b6=_0xb932b6||0xcc;return function(_0x5c7f5b){if(_0x5c7f5b){return _0x398c97[_0xf97b('0x1e')](_0xb932b6);}return _0x398c97[_0xf97b('0x1f')](_0xb932b6)[_0xf97b('0x20')]();};}function respondWithResult(_0x52392e,_0x18a301){_0x18a301=_0x18a301||0xc8;return function(_0x5b9af9){if(_0x5b9af9){return _0x52392e['status'](_0x18a301)['json'](_0x5b9af9);}};}function respondWithFilteredResult(_0x336117,_0x339898){return function(_0x2617a1){if(_0x2617a1){var _0x193e01=typeof _0x339898['offset']==='undefined'&&typeof _0x339898[_0xf97b('0x21')]==='undefined';var _0x158992=_0x2617a1[_0xf97b('0x22')];var _0xab5eca=_0x193e01?0x0:_0x339898[_0xf97b('0x23')];var _0x7b3500=_0x193e01?_0x2617a1[_0xf97b('0x22')]:_0x339898['offset']+_0x339898[_0xf97b('0x21')];var _0x22c990;if(_0x7b3500>=_0x158992){_0x7b3500=_0x158992;_0x22c990=0xc8;}else{_0x22c990=0xce;}_0x336117['status'](_0x22c990);return _0x336117[_0xf97b('0x24')]('Content-Range',_0xab5eca+'-'+_0x7b3500+'/'+_0x158992)[_0xf97b('0x25')](_0x2617a1);}return null;};}function patchUpdates(_0x3a401c){return function(_0x3586ba){try{jsonpatch['apply'](_0x3586ba,_0x3a401c,!![]);}catch(_0x2ee6ff){return BPromise[_0xf97b('0x26')](_0x2ee6ff);}return _0x3586ba['save']();};}function saveUpdates(_0x483bc6,_0x4d675b){return function(_0x43affe){if(_0x43affe){return _0x43affe[_0xf97b('0x27')](_0x483bc6)[_0xf97b('0x28')](function(_0x560771){return _0x560771;});}return null;};}function removeEntity(_0x256474,_0x5a6c01){return function(_0x160d86){if(_0x160d86){return _0x160d86[_0xf97b('0x29')]()[_0xf97b('0x28')](function(){_0x256474[_0xf97b('0x1f')](0xcc)[_0xf97b('0x20')]();});}};}function handleEntityNotFound(_0x43023d,_0x5ce5a9){return function(_0x538b5a){if(!_0x538b5a){_0x43023d['sendStatus'](0x194);}return _0x538b5a;};}function handleError(_0x1ac73b,_0x199a86){_0x199a86=_0x199a86||0x1f4;return function(_0x595b41){logger['error'](_0x595b41[_0xf97b('0x2a')]);if(_0x595b41[_0xf97b('0x2b')]){delete _0x595b41[_0xf97b('0x2b')];}_0x1ac73b[_0xf97b('0x1f')](_0x199a86)[_0xf97b('0x2c')](_0x595b41);};}exports[_0xf97b('0x2d')]=function(_0x53d6e0,_0x3e99fb){var _0x286b03={},_0x4a9183={},_0x9cc1bc={'count':0x0,'rows':[]};var _0x2549a0=_[_0xf97b('0x2e')](db[_0xf97b('0x2f')]['rawAttributes'],function(_0x54a118){return{'name':_0x54a118['fieldName'],'type':_0x54a118[_0xf97b('0x30')][_0xf97b('0x31')]};});_0x4a9183[_0xf97b('0x32')]=_['differenceBy'](_[_0xf97b('0x2e')](_0x2549a0,_0xf97b('0x2b')),[_0xf97b('0x2b')]);_0x4a9183['query']=_['keys'](_0x53d6e0[_0xf97b('0x33')]);_0x4a9183['filters']=_[_0xf97b('0x34')](_0x4a9183[_0xf97b('0x32')],_0x4a9183[_0xf97b('0x33')]);_0x286b03['attributes']=_[_0xf97b('0x34')](_0x4a9183['model'],qs[_0xf97b('0x35')](_0x53d6e0['query'][_0xf97b('0x35')]));_0x286b03['attributes']=_0x286b03['attributes'][_0xf97b('0x36')]?_0x286b03[_0xf97b('0x37')]:_0x4a9183[_0xf97b('0x32')];if(!_0x53d6e0[_0xf97b('0x33')][_0xf97b('0x38')]('nolimit')){_0x286b03['limit']=qs[_0xf97b('0x21')](_0x53d6e0[_0xf97b('0x33')][_0xf97b('0x21')]);_0x286b03[_0xf97b('0x23')]=qs[_0xf97b('0x23')](_0x53d6e0['query'][_0xf97b('0x23')]);}_0x286b03[_0xf97b('0x39')]=qs[_0xf97b('0x3a')](_0x53d6e0['query'][_0xf97b('0x3a')]);_0x286b03[_0xf97b('0x3b')]=qs[_0xf97b('0x3c')](_[_0xf97b('0x3d')](_0x53d6e0[_0xf97b('0x33')],_0x4a9183[_0xf97b('0x3c')]),_0x2549a0);if(_0x53d6e0[_0xf97b('0x33')][_0xf97b('0x3e')]){_0x286b03[_0xf97b('0x3b')]=_[_0xf97b('0x3f')](_0x286b03[_0xf97b('0x3b')],{'$or':_[_0xf97b('0x2e')](_0x2549a0,function(_0x3f6ac8){if(_0x3f6ac8[_0xf97b('0x30')]!==_0xf97b('0x40')){var _0x24f887={};_0x24f887[_0x3f6ac8[_0xf97b('0x2b')]]={'$like':'%'+_0x53d6e0[_0xf97b('0x33')][_0xf97b('0x3e')]+'%'};return _0x24f887;}})});}_0x286b03=_[_0xf97b('0x3f')]({},_0x286b03,_0x53d6e0['options']);var _0x317ce9={'where':_0x286b03[_0xf97b('0x3b')]};return db[_0xf97b('0x2f')][_0xf97b('0x22')](_0x317ce9)[_0xf97b('0x28')](function(_0x3fc15a){_0x9cc1bc[_0xf97b('0x22')]=_0x3fc15a;if(_0x53d6e0[_0xf97b('0x33')][_0xf97b('0x41')]){_0x286b03[_0xf97b('0x42')]=[{'all':!![]}];}return db['CmCustomField'][_0xf97b('0x43')](_0x286b03);})[_0xf97b('0x28')](function(_0x215e7b){_0x9cc1bc[_0xf97b('0x44')]=_0x215e7b;return _0x9cc1bc;})['then'](respondWithFilteredResult(_0x3e99fb,_0x286b03))[_0xf97b('0x45')](handleError(_0x3e99fb,null));};exports['show']=function(_0x3ee74a,_0x374b38){var _0x39b31a={'raw':!![],'where':{'id':_0x3ee74a[_0xf97b('0x46')]['id']}},_0x47a552={};_0x47a552[_0xf97b('0x32')]=_[_0xf97b('0x47')](db[_0xf97b('0x2f')]['rawAttributes']);_0x47a552[_0xf97b('0x33')]=_[_0xf97b('0x47')](_0x3ee74a['query']);_0x47a552[_0xf97b('0x3c')]=_['intersection'](_0x47a552[_0xf97b('0x32')],_0x47a552['query']);_0x39b31a[_0xf97b('0x37')]=_[_0xf97b('0x34')](_0x47a552[_0xf97b('0x32')],qs[_0xf97b('0x35')](_0x3ee74a[_0xf97b('0x33')][_0xf97b('0x35')]));_0x39b31a[_0xf97b('0x37')]=_0x39b31a[_0xf97b('0x37')][_0xf97b('0x36')]?_0x39b31a[_0xf97b('0x37')]:_0x47a552['model'];if(_0x3ee74a[_0xf97b('0x33')]['includeAll']){_0x39b31a[_0xf97b('0x42')]=[{'all':!![]}];}_0x39b31a=_[_0xf97b('0x3f')]({},_0x39b31a,_0x3ee74a[_0xf97b('0x48')]);return db[_0xf97b('0x2f')][_0xf97b('0x49')](_0x39b31a)[_0xf97b('0x28')](handleEntityNotFound(_0x374b38,null))[_0xf97b('0x28')](respondWithResult(_0x374b38,null))[_0xf97b('0x45')](handleError(_0x374b38,null));};exports[_0xf97b('0x27')]=function(_0x2564f2,_0x2b897a){if(_0x2564f2[_0xf97b('0x4a')]['id']){delete _0x2564f2[_0xf97b('0x4a')]['id'];}return db[_0xf97b('0x2f')][_0xf97b('0x49')]({'where':{'id':_0x2564f2['params']['id']}})[_0xf97b('0x28')](handleEntityNotFound(_0x2b897a,null))[_0xf97b('0x28')](saveUpdates(_0x2564f2['body'],null))[_0xf97b('0x28')](respondWithResult(_0x2b897a,null))[_0xf97b('0x45')](handleError(_0x2b897a,null));};exports[_0xf97b('0x29')]=function(_0x4528bf,_0x43399e){return db[_0xf97b('0x2f')][_0xf97b('0x49')]({'where':{'id':_0x4528bf[_0xf97b('0x46')]['id']}})['then'](handleEntityNotFound(_0x43399e,null))[_0xf97b('0x28')](removeEntity(_0x43399e,null))[_0xf97b('0x45')](handleError(_0x43399e,null));};exports[_0xf97b('0x4b')]=function(_0x2dfd57,_0x2aaca1){var _0x1d31ca;return db[_0xf97b('0x4c')][_0xf97b('0x4d')](function(_0x2c1871){return db[_0xf97b('0x2f')][_0xf97b('0x4b')](_0x2dfd57['body'],{'transaction':_0x2c1871})[_0xf97b('0x28')](function(_0x3a6b83){_0x1d31ca=_0x3a6b83;var _0x514c61={'type':db['Sequelize'][_0xf97b('0x4e')],'transaction':_0x2c1871};switch(_0x2dfd57[_0xf97b('0x4a')][_0xf97b('0x30')]){case'text':_0x514c61[_0xf97b('0x30')]=db[_0xf97b('0x4f')]['TEXT'];break;case'number':_0x514c61[_0xf97b('0x30')]=db['Sequelize'][_0xf97b('0x50')];break;case _0xf97b('0x51'):_0x514c61[_0xf97b('0x30')]=db[_0xf97b('0x4f')]['BOOLEAN'];_0x514c61[_0xf97b('0x52')]=![];break;default:}return db[_0xf97b('0x4c')][_0xf97b('0x53')][_0xf97b('0x54')](_0xf97b('0x55'),util[_0xf97b('0x56')]('cf_%d',_0x1d31ca['id']),_0x514c61);})['then'](function(){return _0x1d31ca;});})[_0xf97b('0x28')](respondWithResult(_0x2aaca1,0xc9))[_0xf97b('0x45')](handleError(_0x2aaca1,null));}; \ No newline at end of file +var _0xa7bf=['rimraf','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','merge','filter','findAll','rows','catch','show','params','keys','length','include','options','find','body','create','sequelize','transaction','Sequelize','TEXT','number','BOOLEAN','defaultValue','queryInterface','cf_%d','eml-format'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa7bf,0x14b));var _0xfa7b=function(_0x31df10,_0x312458){_0x31df10=_0x31df10-0x0;var _0x3ce6e8=_0xa7bf[_0x31df10];return _0x3ce6e8;};'use strict';var emlformat=require(_0xfa7b('0x0'));var rimraf=require(_0xfa7b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfa7b('0x2'));var BPromise=require(_0xfa7b('0x3'));var Mustache=require(_0xfa7b('0x4'));var util=require(_0xfa7b('0x5'));var path=require(_0xfa7b('0x6'));var sox=require(_0xfa7b('0x7'));var csv=require(_0xfa7b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa7b('0x9'));var _=require(_0xfa7b('0xa'));var squel=require(_0xfa7b('0xb'));var crypto=require(_0xfa7b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfa7b('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfa7b('0xe'));var Papa=require(_0xfa7b('0xf'));var Redis=require(_0xfa7b('0x10'));var authService=require(_0xfa7b('0x11'));var qs=require(_0xfa7b('0x12'));var as=require(_0xfa7b('0x13'));var hardwareService=require(_0xfa7b('0x14'));var logger=require('../../config/logger')(_0xfa7b('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfa7b('0x16'));var db=require(_0xfa7b('0x17'))['db'];function respondWithStatusCode(_0x18033b,_0x475ee3){_0x475ee3=_0x475ee3||0xcc;return function(_0x2f69e9){if(_0x2f69e9){return _0x18033b[_0xfa7b('0x18')](_0x475ee3);}return _0x18033b[_0xfa7b('0x19')](_0x475ee3)['end']();};}function respondWithResult(_0x29bcb2,_0x408cfe){_0x408cfe=_0x408cfe||0xc8;return function(_0x31163e){if(_0x31163e){return _0x29bcb2[_0xfa7b('0x19')](_0x408cfe)['json'](_0x31163e);}};}function respondWithFilteredResult(_0x589f8f,_0x198c1e){return function(_0x5b5c83){if(_0x5b5c83){var _0x397b0d=typeof _0x198c1e[_0xfa7b('0x1a')]===_0xfa7b('0x1b')&&typeof _0x198c1e[_0xfa7b('0x1c')]==='undefined';var _0x4a800c=_0x5b5c83[_0xfa7b('0x1d')];var _0x49760f=_0x397b0d?0x0:_0x198c1e[_0xfa7b('0x1a')];var _0x3d2a59=_0x397b0d?_0x5b5c83[_0xfa7b('0x1d')]:_0x198c1e[_0xfa7b('0x1a')]+_0x198c1e[_0xfa7b('0x1c')];var _0x30a5d3;if(_0x3d2a59>=_0x4a800c){_0x3d2a59=_0x4a800c;_0x30a5d3=0xc8;}else{_0x30a5d3=0xce;}_0x589f8f[_0xfa7b('0x19')](_0x30a5d3);return _0x589f8f[_0xfa7b('0x1e')](_0xfa7b('0x1f'),_0x49760f+'-'+_0x3d2a59+'/'+_0x4a800c)[_0xfa7b('0x20')](_0x5b5c83);}return null;};}function patchUpdates(_0x2390c1){return function(_0x1e876e){try{jsonpatch[_0xfa7b('0x21')](_0x1e876e,_0x2390c1,!![]);}catch(_0x29125e){return BPromise[_0xfa7b('0x22')](_0x29125e);}return _0x1e876e[_0xfa7b('0x23')]();};}function saveUpdates(_0x15e509,_0x5d982f){return function(_0x1eb771){if(_0x1eb771){return _0x1eb771[_0xfa7b('0x24')](_0x15e509)[_0xfa7b('0x25')](function(_0x49bc35){return _0x49bc35;});}return null;};}function removeEntity(_0x423274,_0x4789cf){return function(_0xe33bec){if(_0xe33bec){return _0xe33bec[_0xfa7b('0x26')]()['then'](function(){_0x423274['status'](0xcc)[_0xfa7b('0x27')]();});}};}function handleEntityNotFound(_0x25f882,_0x141524){return function(_0xb4187b){if(!_0xb4187b){_0x25f882[_0xfa7b('0x18')](0x194);}return _0xb4187b;};}function handleError(_0x276aaf,_0x4a65d5){_0x4a65d5=_0x4a65d5||0x1f4;return function(_0x392dee){logger[_0xfa7b('0x28')](_0x392dee[_0xfa7b('0x29')]);if(_0x392dee[_0xfa7b('0x2a')]){delete _0x392dee[_0xfa7b('0x2a')];}_0x276aaf[_0xfa7b('0x19')](_0x4a65d5)[_0xfa7b('0x2b')](_0x392dee);};}exports[_0xfa7b('0x2c')]=function(_0x39e5c4,_0x47d445){var _0x490db2={},_0x5cdfc8={},_0x83c9a7={'count':0x0,'rows':[]};var _0x1c2e02=_[_0xfa7b('0x2d')](db[_0xfa7b('0x2e')][_0xfa7b('0x2f')],function(_0x521061){return{'name':_0x521061[_0xfa7b('0x30')],'type':_0x521061[_0xfa7b('0x31')]['key']};});_0x5cdfc8[_0xfa7b('0x32')]=_['differenceBy'](_[_0xfa7b('0x2d')](_0x1c2e02,_0xfa7b('0x2a')),['name']);_0x5cdfc8[_0xfa7b('0x33')]=_['keys'](_0x39e5c4['query']);_0x5cdfc8[_0xfa7b('0x34')]=_[_0xfa7b('0x35')](_0x5cdfc8[_0xfa7b('0x32')],_0x5cdfc8[_0xfa7b('0x33')]);_0x490db2[_0xfa7b('0x36')]=_[_0xfa7b('0x35')](_0x5cdfc8['model'],qs['fields'](_0x39e5c4[_0xfa7b('0x33')][_0xfa7b('0x37')]));_0x490db2[_0xfa7b('0x36')]=_0x490db2[_0xfa7b('0x36')]['length']?_0x490db2[_0xfa7b('0x36')]:_0x5cdfc8['model'];if(!_0x39e5c4[_0xfa7b('0x33')]['hasOwnProperty'](_0xfa7b('0x38'))){_0x490db2[_0xfa7b('0x1c')]=qs[_0xfa7b('0x1c')](_0x39e5c4[_0xfa7b('0x33')][_0xfa7b('0x1c')]);_0x490db2['offset']=qs[_0xfa7b('0x1a')](_0x39e5c4[_0xfa7b('0x33')]['offset']);}_0x490db2[_0xfa7b('0x39')]=qs[_0xfa7b('0x3a')](_0x39e5c4['query'][_0xfa7b('0x3a')]);_0x490db2[_0xfa7b('0x3b')]=qs['filters'](_['pick'](_0x39e5c4[_0xfa7b('0x33')],_0x5cdfc8[_0xfa7b('0x34')]),_0x1c2e02);if(_0x39e5c4[_0xfa7b('0x33')]['filter']){_0x490db2[_0xfa7b('0x3b')]=_[_0xfa7b('0x3c')](_0x490db2[_0xfa7b('0x3b')],{'$or':_[_0xfa7b('0x2d')](_0x1c2e02,function(_0x11a47a){if(_0x11a47a[_0xfa7b('0x31')]!=='VIRTUAL'){var _0x24cc0e={};_0x24cc0e[_0x11a47a[_0xfa7b('0x2a')]]={'$like':'%'+_0x39e5c4['query'][_0xfa7b('0x3d')]+'%'};return _0x24cc0e;}})});}_0x490db2=_[_0xfa7b('0x3c')]({},_0x490db2,_0x39e5c4['options']);var _0xf23ce0={'where':_0x490db2['where']};return db['CmCustomField'][_0xfa7b('0x1d')](_0xf23ce0)[_0xfa7b('0x25')](function(_0x59558b){_0x83c9a7[_0xfa7b('0x1d')]=_0x59558b;if(_0x39e5c4['query']['includeAll']){_0x490db2['include']=[{'all':!![]}];}return db['CmCustomField'][_0xfa7b('0x3e')](_0x490db2);})['then'](function(_0x2c9519){_0x83c9a7[_0xfa7b('0x3f')]=_0x2c9519;return _0x83c9a7;})[_0xfa7b('0x25')](respondWithFilteredResult(_0x47d445,_0x490db2))[_0xfa7b('0x40')](handleError(_0x47d445,null));};exports[_0xfa7b('0x41')]=function(_0x4bbde1,_0x7c54ce){var _0x5255a6={'raw':!![],'where':{'id':_0x4bbde1[_0xfa7b('0x42')]['id']}},_0x3ff069={};_0x3ff069['model']=_[_0xfa7b('0x43')](db[_0xfa7b('0x2e')]['rawAttributes']);_0x3ff069[_0xfa7b('0x33')]=_['keys'](_0x4bbde1['query']);_0x3ff069['filters']=_[_0xfa7b('0x35')](_0x3ff069[_0xfa7b('0x32')],_0x3ff069[_0xfa7b('0x33')]);_0x5255a6['attributes']=_[_0xfa7b('0x35')](_0x3ff069[_0xfa7b('0x32')],qs[_0xfa7b('0x37')](_0x4bbde1[_0xfa7b('0x33')][_0xfa7b('0x37')]));_0x5255a6[_0xfa7b('0x36')]=_0x5255a6[_0xfa7b('0x36')][_0xfa7b('0x44')]?_0x5255a6[_0xfa7b('0x36')]:_0x3ff069[_0xfa7b('0x32')];if(_0x4bbde1[_0xfa7b('0x33')]['includeAll']){_0x5255a6[_0xfa7b('0x45')]=[{'all':!![]}];}_0x5255a6=_[_0xfa7b('0x3c')]({},_0x5255a6,_0x4bbde1[_0xfa7b('0x46')]);return db[_0xfa7b('0x2e')][_0xfa7b('0x47')](_0x5255a6)[_0xfa7b('0x25')](handleEntityNotFound(_0x7c54ce,null))[_0xfa7b('0x25')](respondWithResult(_0x7c54ce,null))[_0xfa7b('0x40')](handleError(_0x7c54ce,null));};exports['update']=function(_0x1e8cbf,_0x38bce6){if(_0x1e8cbf['body']['id']){delete _0x1e8cbf[_0xfa7b('0x48')]['id'];}return db['CmCustomField'][_0xfa7b('0x47')]({'where':{'id':_0x1e8cbf[_0xfa7b('0x42')]['id']}})[_0xfa7b('0x25')](handleEntityNotFound(_0x38bce6,null))['then'](saveUpdates(_0x1e8cbf[_0xfa7b('0x48')],null))[_0xfa7b('0x25')](respondWithResult(_0x38bce6,null))[_0xfa7b('0x40')](handleError(_0x38bce6,null));};exports[_0xfa7b('0x26')]=function(_0x1b2bd9,_0x459a76){return db[_0xfa7b('0x2e')][_0xfa7b('0x47')]({'where':{'id':_0x1b2bd9[_0xfa7b('0x42')]['id']}})[_0xfa7b('0x25')](handleEntityNotFound(_0x459a76,null))['then'](removeEntity(_0x459a76,null))['catch'](handleError(_0x459a76,null));};exports[_0xfa7b('0x49')]=function(_0x5d234d,_0x3cba43){var _0x25d56b;return db[_0xfa7b('0x4a')][_0xfa7b('0x4b')](function(_0x3d9f68){return db['CmCustomField'][_0xfa7b('0x49')](_0x5d234d[_0xfa7b('0x48')],{'transaction':_0x3d9f68})[_0xfa7b('0x25')](function(_0x3b117e){_0x25d56b=_0x3b117e;var _0x5b7ada={'type':db[_0xfa7b('0x4c')][_0xfa7b('0x4d')],'transaction':_0x3d9f68};switch(_0x5d234d['body'][_0xfa7b('0x31')]){case'text':_0x5b7ada['type']=db[_0xfa7b('0x4c')]['TEXT'];break;case _0xfa7b('0x4e'):_0x5b7ada[_0xfa7b('0x31')]=db[_0xfa7b('0x4c')]['INTEGER'];break;case'switch':_0x5b7ada['type']=db[_0xfa7b('0x4c')][_0xfa7b('0x4f')];_0x5b7ada[_0xfa7b('0x50')]=![];break;default:}return db[_0xfa7b('0x4a')][_0xfa7b('0x51')]['addColumn']('cm_contacts',util['format'](_0xfa7b('0x52'),_0x25d56b['id']),_0x5b7ada);})['then'](function(){return _0x25d56b;});})[_0xfa7b('0x25')](respondWithResult(_0x3cba43,0xc9))[_0xfa7b('0x40')](handleError(_0x3cba43,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index cadeb87..a0d18c9 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 _0x7ca3=['moment','path','rimraf','../../config/environment','exports','define','CmCustomField','lodash','util','../../config/logger'];(function(_0x47e31c,_0xeef541){var _0x46794f=function(_0x4ee891){while(--_0x4ee891){_0x47e31c['push'](_0x47e31c['shift']());}};_0x46794f(++_0xeef541);}(_0x7ca3,0x115));var _0x37ca=function(_0x83f529,_0x3d55d7){_0x83f529=_0x83f529-0x0;var _0x4383b8=_0x7ca3[_0x83f529];return _0x4383b8;};'use strict';var _=require(_0x37ca('0x0'));var util=require(_0x37ca('0x1'));var logger=require(_0x37ca('0x2'))('api');var moment=require(_0x37ca('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x37ca('0x4'));var rimraf=require(_0x37ca('0x5'));var config=require(_0x37ca('0x6'));var attributes=require('./cmCustomField.attributes');module[_0x37ca('0x7')]=function(_0x187c15,_0xa7872b){return _0x187c15[_0x37ca('0x8')](_0x37ca('0x9'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ea0=['rimraf','../../config/environment','./cmCustomField.attributes','define','CmCustomField','cm_custom_fields','lodash','util','api','moment','bluebird','path'];(function(_0x25cabb,_0x46f3a8){var _0x284423=function(_0x4ff79f){while(--_0x4ff79f){_0x25cabb['push'](_0x25cabb['shift']());}};_0x284423(++_0x46f3a8);}(_0x1ea0,0xf6));var _0x01ea=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1ea0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x01ea('0x0'));var util=require(_0x01ea('0x1'));var logger=require('../../config/logger')(_0x01ea('0x2'));var moment=require(_0x01ea('0x3'));var BPromise=require(_0x01ea('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x01ea('0x5'));var rimraf=require(_0x01ea('0x6'));var config=require(_0x01ea('0x7'));var attributes=require(_0x01ea('0x8'));module['exports']=function(_0x1857d7,_0x20a427){return _0x1857d7[_0x01ea('0x9')](_0x01ea('0xa'),attributes,{'tableName':_0x01ea('0xb'),'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 1eb6220..4309279 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 _0x1716=['error','code','message','info','catch','lodash','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x1d70ed,_0x3e4f0a){var _0x189e62=function(_0x9ee3a2){while(--_0x9ee3a2){_0x1d70ed['push'](_0x1d70ed['shift']());}};_0x189e62(++_0x3e4f0a);}(_0x1716,0x122));var _0x6171=function(_0x22d9a2,_0x528b43){_0x22d9a2=_0x22d9a2-0x0;var _0xd59353=_0x1716[_0x22d9a2];return _0xd59353;};'use strict';var _=require(_0x6171('0x0'));var util=require('util');var moment=require(_0x6171('0x1'));var BPromise=require('bluebird');var rs=require(_0x6171('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6171('0x3'))(_0x6171('0x4'));var config=require(_0x6171('0x5'));var jayson=require(_0x6171('0x6'));var client=jayson['client'][_0x6171('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3bbece,_0x8ff657,_0x51c03c){return new BPromise(function(_0xfe9c9,_0x435f51){return client[_0x6171('0x8')](_0x3bbece,_0x51c03c)[_0x6171('0x9')](function(_0x255b30){logger['info'](_0x6171('0xa'),_0x8ff657,_0x6171('0xb'));logger[_0x6171('0xc')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x8ff657,'request\x20sent',JSON[_0x6171('0xd')](_0x255b30));if(_0x255b30[_0x6171('0xe')]){if(_0x255b30['error'][_0x6171('0xf')]===0x1f4){logger['error'](_0x6171('0xa'),_0x8ff657,_0x255b30[_0x6171('0xe')][_0x6171('0x10')]);return _0x435f51(_0x255b30[_0x6171('0xe')]['message']);}logger[_0x6171('0xe')](_0x6171('0xa'),_0x8ff657,_0x255b30[_0x6171('0xe')][_0x6171('0x10')]);return _0xfe9c9(_0x255b30['error'][_0x6171('0x10')]);}else{logger[_0x6171('0x11')](_0x6171('0xa'),_0x8ff657,_0x6171('0xb'));_0xfe9c9(_0x255b30['result']['message']);}})[_0x6171('0x12')](function(_0x5e5d0b){logger['error'](_0x6171('0xa'),_0x8ff657,_0x5e5d0b);_0x435f51(_0x5e5d0b);});});} \ No newline at end of file +var _0xa96e=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0xf34109,_0x380779){var _0x570bfc=function(_0x1ad086){while(--_0x1ad086){_0xf34109['push'](_0xf34109['shift']());}};_0x570bfc(++_0x380779);}(_0xa96e,0x127));var _0xea96=function(_0x21bb7b,_0x3284c3){_0x21bb7b=_0x21bb7b-0x0;var _0x1e05bf=_0xa96e[_0x21bb7b];return _0x1e05bf;};'use strict';var _=require(_0xea96('0x0'));var util=require('util');var moment=require(_0xea96('0x1'));var BPromise=require(_0xea96('0x2'));var rs=require(_0xea96('0x3'));var fs=require('fs');var Redis=require(_0xea96('0x4'));var db=require(_0xea96('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xea96('0x6'))('rpc');var config=require(_0xea96('0x7'));var jayson=require(_0xea96('0x8'));var client=jayson[_0xea96('0x9')][_0xea96('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46bd01,_0x26dbb7,_0x52d260){return new BPromise(function(_0x5dec21,_0xb63e06){return client[_0xea96('0xb')](_0x46bd01,_0x52d260)['then'](function(_0x5f0dd1){logger[_0xea96('0xc')](_0xea96('0xd'),_0x26dbb7,_0xea96('0xe'));logger[_0xea96('0xf')](_0xea96('0x10'),_0x26dbb7,_0xea96('0xe'),JSON[_0xea96('0x11')](_0x5f0dd1));if(_0x5f0dd1['error']){if(_0x5f0dd1[_0xea96('0x12')][_0xea96('0x13')]===0x1f4){logger['error'](_0xea96('0xd'),_0x26dbb7,_0x5f0dd1[_0xea96('0x12')][_0xea96('0x14')]);return _0xb63e06(_0x5f0dd1[_0xea96('0x12')][_0xea96('0x14')]);}logger[_0xea96('0x12')](_0xea96('0xd'),_0x26dbb7,_0x5f0dd1['error'][_0xea96('0x14')]);return _0x5dec21(_0x5f0dd1[_0xea96('0x12')]['message']);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x26dbb7,_0xea96('0xe'));_0x5dec21(_0x5f0dd1[_0xea96('0x15')][_0xea96('0x14')]);}})[_0xea96('0x16')](function(_0x666305){logger[_0xea96('0x12')](_0xea96('0xd'),_0x26dbb7,_0x666305);_0xb63e06(_0x666305);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 140bc96..3267a6b 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 _0xaa3f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','post','put','delete','destroy','exports','multer','util','path'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x429230,_0x5a85ca){_0x429230=_0x429230-0x0;var _0x330b27=_0xaa3f[_0x429230];return _0x330b27;};'use strict';var multer=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var path=require(_0xfaa3('0x2'));var timeout=require(_0xfaa3('0x3'));var express=require(_0xfaa3('0x4'));var router=express[_0xfaa3('0x5')]();var fs_extra=require(_0xfaa3('0x6'));var auth=require(_0xfaa3('0x7'));var interaction=require(_0xfaa3('0x8'));var config=require('../../config/environment');var controller=require('./cmCustomField.controller');router[_0xfaa3('0x9')]('/',auth['isAuthenticated'](),controller[_0xfaa3('0xa')]);router[_0xfaa3('0x9')](_0xfaa3('0xb'),auth[_0xfaa3('0xc')](),controller[_0xfaa3('0xd')]);router[_0xfaa3('0xe')]('/',auth[_0xfaa3('0xc')](),controller['create']);router[_0xfaa3('0xf')](_0xfaa3('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xfaa3('0x10')](_0xfaa3('0xb'),auth[_0xfaa3('0xc')](),controller[_0xfaa3('0x11')]);module[_0xfaa3('0x12')]=router; \ No newline at end of file +var _0x7ee4=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x321f4a,_0x841f18){var _0x4fc623=function(_0x1f9332){while(--_0x1f9332){_0x321f4a['push'](_0x321f4a['shift']());}};_0x4fc623(++_0x841f18);}(_0x7ee4,0xbc));var _0x47ee=function(_0x2b6235,_0xadfbcf){_0x2b6235=_0x2b6235-0x0;var _0x4cee7f=_0x7ee4[_0x2b6235];return _0x4cee7f;};'use strict';var multer=require(_0x47ee('0x0'));var util=require(_0x47ee('0x1'));var path=require('path');var timeout=require(_0x47ee('0x2'));var express=require(_0x47ee('0x3'));var router=express['Router']();var fs_extra=require(_0x47ee('0x4'));var auth=require(_0x47ee('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x47ee('0x6'));var controller=require('./cmCustomField.controller');router[_0x47ee('0x7')]('/',auth[_0x47ee('0x8')](),controller[_0x47ee('0x9')]);router[_0x47ee('0x7')](_0x47ee('0xa'),auth[_0x47ee('0x8')](),controller[_0x47ee('0xb')]);router[_0x47ee('0xc')]('/',auth['isAuthenticated'](),controller[_0x47ee('0xd')]);router[_0x47ee('0xe')](_0x47ee('0xa'),auth[_0x47ee('0x8')](),controller[_0x47ee('0xf')]);router[_0x47ee('0x10')](_0x47ee('0xa'),auth['isAuthenticated'](),controller[_0x47ee('0x11')]);module[_0x47ee('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 00f8c65..a940fbb 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 _0x575c=['BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','exports','STRING'];(function(_0x58381c,_0x3b9374){var _0x1a7440=function(_0x2bc7f1){while(--_0x2bc7f1){_0x58381c['push'](_0x58381c['shift']());}};_0x1a7440(++_0x3b9374);}(_0x575c,0x116));var _0xc575=function(_0x23a06f,_0x450ab3){_0x23a06f=_0x23a06f-0x0;var _0xa9a09a=_0x575c[_0x23a06f];return _0xa9a09a;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xc575('0x0')]={'phone':{'type':Sequelize[_0xc575('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0xc575('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xc575('0x3')],'defaultValue':moment()[_0xc575('0x4')](_0xc575('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc575('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc575('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xc575('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc575('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc575('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xc575('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xc575('0x6')],'unique':_0xc575('0x7')},'ListId':{'type':Sequelize[_0xc575('0x6')],'unique':_0xc575('0x7')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xc575('0x7')},'CampaignId':{'type':Sequelize[_0xc575('0x6')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc575('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc575('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc575('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd5e7=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','BOOLEAN','contactListQueue','moment','sequelize','exports'];(function(_0x2b2c3f,_0x4a630d){var _0x11703d=function(_0x45c6e1){while(--_0x45c6e1){_0x2b2c3f['push'](_0x2b2c3f['shift']());}};_0x11703d(++_0x4a630d);}(_0xd5e7,0x1e1));var _0x7d5e=function(_0x20c7f0,_0x401ee8){_0x20c7f0=_0x20c7f0-0x0;var _0x1040b6=_0xd5e7[_0x20c7f0];return _0x1040b6;};'use strict';var moment=require(_0x7d5e('0x0'));var Sequelize=require(_0x7d5e('0x1'));module[_0x7d5e('0x2')]={'phone':{'type':Sequelize[_0x7d5e('0x3')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x7d5e('0x4')],'defaultValue':moment()[_0x7d5e('0x5')](_0x7d5e('0x6'))},'countbusyretry':{'type':Sequelize[_0x7d5e('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7d5e('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7d5e('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7d5e('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7d5e('0x4')]},'priority':{'type':Sequelize[_0x7d5e('0x7')](0x2)[_0x7d5e('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x7d5e('0x9')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x7d5e('0x7')],'unique':_0x7d5e('0xa')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x7d5e('0xa')},'UserId':{'type':Sequelize[_0x7d5e('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x7d5e('0x7')],'unique':_0x7d5e('0xa')},'CampaignId':{'type':Sequelize[_0x7d5e('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7d5e('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7d5e('0x7')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index bc3f20f..1c6d7e5 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 _0x6050=['$in','$iLike','$notILike','$like','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','params','options','find','catch','create','body','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','dataValues','createdAt','state','statedesc','campaign','membername','user','deleted','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ivr','CmContact','firstName','lastName','isNil','finally','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','format','direction','isEmpty','hopperIds','priority','scheduledAt','ASC','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','LOCK','UPDATE','CmCompany','Company','CmList','List','Queue','dialActive','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','rimraf','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','CmHopper','key','query','keys','filters','intersection','model','concat','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$notBetween'];(function(_0x37a584,_0xa570c){var _0x1e46b7=function(_0x3882d8){while(--_0x3882d8){_0x37a584['push'](_0x37a584['shift']());}};_0x1e46b7(++_0xa570c);}(_0x6050,0x177));var _0x0605=function(_0x55b7dc,_0x4e0179){_0x55b7dc=_0x55b7dc-0x0;var _0x2af5f4=_0x6050[_0x55b7dc];return _0x2af5f4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0605('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0605('0x1'));var rp=require(_0x0605('0x2'));var moment=require(_0x0605('0x3'));var BPromise=require(_0x0605('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0605('0x5'));var sox=require('sox');var csv=require(_0x0605('0x6'));var ejs=require(_0x0605('0x7'));var fs=require('fs');var fs_extra=require(_0x0605('0x8'));var _=require(_0x0605('0x9'));var squel=require(_0x0605('0xa'));var crypto=require(_0x0605('0xb'));var jsforce=require(_0x0605('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0605('0x6'));var querystring=require('querystring');var Papa=require(_0x0605('0xd'));var Redis=require(_0x0605('0xe'));var authService=require(_0x0605('0xf'));var qs=require(_0x0605('0x10'));var as=require(_0x0605('0x11'));var hardwareService=require(_0x0605('0x12'));var logger=require(_0x0605('0x13'))('api');var utils=require(_0x0605('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0605('0x15'));var db=require(_0x0605('0x16'))['db'];function respondWithStatusCode(_0x32c614,_0x32d103){_0x32d103=_0x32d103||0xcc;return function(_0x5e2c0b){if(_0x5e2c0b){return _0x32c614[_0x0605('0x17')](_0x32d103);}return _0x32c614[_0x0605('0x18')](_0x32d103)[_0x0605('0x19')]();};}function respondWithResult(_0x5a9f22,_0x52716b){_0x52716b=_0x52716b||0xc8;return function(_0x9c6e8a){if(_0x9c6e8a){return _0x5a9f22['status'](_0x52716b)[_0x0605('0x1a')](_0x9c6e8a);}};}function respondWithFilteredResult(_0x52b1d9,_0x400324){return function(_0x39b82d){if(_0x39b82d){var _0x3f0187=typeof _0x400324[_0x0605('0x1b')]===_0x0605('0x1c')&&typeof _0x400324[_0x0605('0x1d')]===_0x0605('0x1c');var _0x35e538=_0x39b82d[_0x0605('0x1e')];var _0x1806dc=_0x3f0187?0x0:_0x400324[_0x0605('0x1b')];var _0x205e2b=_0x3f0187?_0x39b82d[_0x0605('0x1e')]:_0x400324[_0x0605('0x1b')]+_0x400324[_0x0605('0x1d')];var _0x76843a;if(_0x205e2b>=_0x35e538){_0x205e2b=_0x35e538;_0x76843a=0xc8;}else{_0x76843a=0xce;}_0x52b1d9['status'](_0x76843a);return _0x52b1d9[_0x0605('0x1f')](_0x0605('0x20'),_0x1806dc+'-'+_0x205e2b+'/'+_0x35e538)[_0x0605('0x1a')](_0x39b82d);}return null;};}function patchUpdates(_0x5b869e){return function(_0x1f4544){try{jsonpatch['apply'](_0x1f4544,_0x5b869e,!![]);}catch(_0xcf4f74){return BPromise[_0x0605('0x21')](_0xcf4f74);}return _0x1f4544[_0x0605('0x22')]();};}function saveUpdates(_0xf31b9d,_0x5d465b){return function(_0x1e8990){if(_0x1e8990){return _0x1e8990[_0x0605('0x23')](_0xf31b9d)[_0x0605('0x24')](function(_0x36a474){return _0x36a474;});}return null;};}function removeEntity(_0x58a377,_0x1465ae){return function(_0x1e2556){if(_0x1e2556){return _0x1e2556['destroy']()[_0x0605('0x24')](function(){_0x58a377['status'](0xcc)[_0x0605('0x19')]();});}};}function handleEntityNotFound(_0x55cec9,_0x4bc451){return function(_0x41d825){if(!_0x41d825){_0x55cec9['sendStatus'](0x194);}return _0x41d825;};}function handleError(_0x526057,_0x42e1fb){_0x42e1fb=_0x42e1fb||0x1f4;return function(_0x4523b6){logger[_0x0605('0x25')](_0x4523b6[_0x0605('0x26')]);if(_0x4523b6[_0x0605('0x27')]){delete _0x4523b6[_0x0605('0x27')];}_0x526057[_0x0605('0x18')](_0x42e1fb)[_0x0605('0x28')](_0x4523b6);};}exports[_0x0605('0x29')]=function(_0x3a4df8,_0x2bc518){var _0x5e9df4={},_0x4a544a={},_0x172f72={'count':0x0,'rows':[]};var _0x5b1628=_[_0x0605('0x2a')](db[_0x0605('0x2b')]['rawAttributes'],function(_0x42c76f){return{'name':_0x42c76f['fieldName'],'type':_0x42c76f['type'][_0x0605('0x2c')]};});_0x4a544a['model']=_[_0x0605('0x2a')](_0x5b1628,_0x0605('0x27'));_0x4a544a[_0x0605('0x2d')]=_[_0x0605('0x2e')](_0x3a4df8[_0x0605('0x2d')]);_0x4a544a[_0x0605('0x2f')]=_[_0x0605('0x30')](_0x4a544a[_0x0605('0x31')],_0x4a544a[_0x0605('0x2d')]);_0x4a544a[_0x0605('0x2f')]=_[_0x0605('0x32')](_0x4a544a['filters'],['$and',_0x0605('0x33'),_0x0605('0x34'),_0x0605('0x35'),_0x0605('0x36'),_0x0605('0x37'),_0x0605('0x38'),_0x0605('0x39'),_0x0605('0x3a'),'$between',_0x0605('0x3b'),_0x0605('0x3c'),'$notIn','$like','$notLike',_0x0605('0x3d'),_0x0605('0x3e'),_0x0605('0x3f'),_0x0605('0x40'),_0x0605('0x41'),_0x0605('0x42'),_0x0605('0x43')]);_0x5e9df4[_0x0605('0x44')]=_[_0x0605('0x30')](_0x4a544a['model'],qs['fields'](_0x3a4df8[_0x0605('0x2d')][_0x0605('0x45')]));_0x5e9df4[_0x0605('0x44')]=_0x5e9df4[_0x0605('0x44')][_0x0605('0x46')]?_0x5e9df4[_0x0605('0x44')]:_0x4a544a[_0x0605('0x31')];if(!_0x3a4df8['query'][_0x0605('0x47')](_0x0605('0x48'))){_0x5e9df4[_0x0605('0x1d')]=qs['limit'](_0x3a4df8[_0x0605('0x2d')][_0x0605('0x1d')]);_0x5e9df4['offset']=qs[_0x0605('0x1b')](_0x3a4df8[_0x0605('0x2d')][_0x0605('0x1b')]);}_0x5e9df4[_0x0605('0x49')]=qs[_0x0605('0x4a')](_0x3a4df8['query']['sort']);_0x5e9df4[_0x0605('0x4b')]=qs[_0x0605('0x2f')](_[_0x0605('0x4c')](_0x3a4df8[_0x0605('0x2d')],_0x4a544a['filters']),_0x5b1628);if(_0x3a4df8[_0x0605('0x2d')][_0x0605('0x4d')]){_0x5e9df4[_0x0605('0x4b')]=_[_0x0605('0x4e')](_0x5e9df4['where'],{'$or':_[_0x0605('0x2a')](_0x5b1628,function(_0x278e76){if(_0x278e76[_0x0605('0x4f')]!==_0x0605('0x50')){var _0x3dd98e={};_0x3dd98e[_0x278e76['name']]={'$like':'%'+_0x3a4df8['query'][_0x0605('0x4d')]+'%'};return _0x3dd98e;}})});}_0x5e9df4=_['merge']({},_0x5e9df4,_0x3a4df8['options']);var _0x17294f={'where':_0x5e9df4[_0x0605('0x4b')]};return db[_0x0605('0x2b')]['count'](_0x17294f)[_0x0605('0x24')](function(_0xf4f6b4){_0x172f72[_0x0605('0x1e')]=_0xf4f6b4;if(_0x3a4df8[_0x0605('0x2d')][_0x0605('0x51')]){_0x5e9df4[_0x0605('0x52')]=[{'all':!![]}];}return db[_0x0605('0x2b')][_0x0605('0x53')](_0x5e9df4);})[_0x0605('0x24')](function(_0x3505d3){_0x172f72[_0x0605('0x54')]=_0x3505d3;return _0x172f72;})['then'](respondWithFilteredResult(_0x2bc518,_0x5e9df4))['catch'](handleError(_0x2bc518,null));};exports['show']=function(_0x2bcf67,_0x443692){var _0x5af6ce={'raw':!![],'where':{'id':_0x2bcf67[_0x0605('0x55')]['id']}},_0x1270ec={};_0x1270ec[_0x0605('0x31')]=_[_0x0605('0x2e')](db[_0x0605('0x2b')]['rawAttributes']);_0x1270ec['query']=_[_0x0605('0x2e')](_0x2bcf67[_0x0605('0x2d')]);_0x1270ec[_0x0605('0x2f')]=_[_0x0605('0x30')](_0x1270ec[_0x0605('0x31')],_0x1270ec['query']);_0x5af6ce['attributes']=_[_0x0605('0x30')](_0x1270ec[_0x0605('0x31')],qs[_0x0605('0x45')](_0x2bcf67[_0x0605('0x2d')]['fields']));_0x5af6ce[_0x0605('0x44')]=_0x5af6ce[_0x0605('0x44')]['length']?_0x5af6ce[_0x0605('0x44')]:_0x1270ec[_0x0605('0x31')];if(_0x2bcf67['query']['includeAll']){_0x5af6ce[_0x0605('0x52')]=[{'all':!![]}];}_0x5af6ce=_[_0x0605('0x4e')]({},_0x5af6ce,_0x2bcf67[_0x0605('0x56')]);return db[_0x0605('0x2b')][_0x0605('0x57')](_0x5af6ce)['then'](handleEntityNotFound(_0x443692,null))[_0x0605('0x24')](respondWithResult(_0x443692,null))[_0x0605('0x58')](handleError(_0x443692,null));};exports[_0x0605('0x59')]=function(_0x206d66,_0x1cdb67){return db['CmHopper'][_0x0605('0x59')](_0x206d66[_0x0605('0x5a')],{})['then'](respondWithResult(_0x1cdb67,0xc9))[_0x0605('0x58')](handleError(_0x1cdb67,null));};exports[_0x0605('0x23')]=function(_0x1f21ca,_0x19f637){if(_0x1f21ca[_0x0605('0x5a')]['id']){delete _0x1f21ca['body']['id'];}return db['CmHopper'][_0x0605('0x57')]({'where':{'id':_0x1f21ca['params']['id']}})[_0x0605('0x24')](handleEntityNotFound(_0x19f637,null))[_0x0605('0x24')](saveUpdates(_0x1f21ca['body'],null))['then'](respondWithResult(_0x19f637,null))[_0x0605('0x58')](handleError(_0x19f637,null));};exports[_0x0605('0x5b')]=function(_0x104489,_0x3b5f3f){return db[_0x0605('0x2b')]['describe']()['then'](respondWithResult(_0x3b5f3f,null))[_0x0605('0x58')](handleError(_0x3b5f3f,null));};exports[_0x0605('0x5c')]=function(_0x25fb32,_0x2a5675){var _0x5840e0;return db[_0x0605('0x2b')][_0x0605('0x57')]({'where':{'id':_0x25fb32[_0x0605('0x55')]['id']}})[_0x0605('0x24')](handleEntityNotFound(_0x2a5675,null))[_0x0605('0x24')](function(_0x1043b7){if(_0x1043b7){return _0x1043b7[_0x0605('0x5c')]()[_0x0605('0x24')](function(_0x506e91){return _0x506e91;});}})['then'](function(_0x31be28){_0x5840e0=_0x31be28;if(_0x31be28){if(_0x31be28[_0x0605('0x5d')]||_0x31be28['CampaignId']){return db[_0x31be28[_0x0605('0x5d')]?_0x0605('0x5e'):_0x0605('0x5f')][_0x0605('0x57')]({'where':{'id':_0x31be28[_0x0605('0x5d')]?_0x31be28[_0x0605('0x5d')]:_0x31be28['CampaignId']},'attributes':['id',_0x0605('0x27')],'raw':!![]});}}})[_0x0605('0x24')](function(_0x5b1197){var _0x5ed0a7={};if(_0x5b1197){_[_0x0605('0x4e')](_0x5ed0a7,_['omit'](_0x5840e0[_0x0605('0x60')],[_0x0605('0x61'),'updatedAt','id']));_0x5ed0a7[_0x0605('0x62')]=0x15;_0x5ed0a7[_0x0605('0x63')]='deleted';_0x5ed0a7[_0x0605('0x64')]=_0x5b1197[_0x0605('0x27')];_0x5ed0a7[_0x0605('0x65')]=_0x25fb32[_0x0605('0x66')][_0x0605('0x27')];_0x5ed0a7['UserId']=_0x25fb32[_0x0605('0x66')]['id'];_0x5ed0a7[_0x0605('0x67')]=!![];_0x5ed0a7[_0x0605('0x68')]=moment()['format'](_0x0605('0x69'));_0x5ed0a7[_0x0605('0x6a')]=_0x5840e0['phone'];_0x5ed0a7[_0x0605('0x6b')]=_0x5840e0[_0x0605('0x5d')]?_0x0605('0x6c'):_0x0605('0x6d');return db[_0x0605('0x6e')][_0x0605('0x57')]({'where':{'id':_0x5ed0a7['ContactId']},'attributes':[_0x0605('0x6f'),_0x0605('0x70')]})['then'](function(_0x1b3c8c){if(!_[_0x0605('0x71')](_0x2a5675)&&!_[_0x0605('0x71')](_0x1b3c8c[_0x0605('0x6f')])){_0x5ed0a7['calleridname']=_0x1b3c8c[_0x0605('0x6f')];if(!_[_0x0605('0x71')](_0x1b3c8c[_0x0605('0x70')])){_0x5ed0a7['calleridname']+='\x20'+_0x1b3c8c[_0x0605('0x70')];}}})[_0x0605('0x72')](function(){return db['CmHopperFinal'][_0x0605('0x59')](_0x5ed0a7);});}})[_0x0605('0x24')](function(){return _0x2a5675['status'](0xcc)[_0x0605('0x19')]();})['catch'](handleError(_0x2a5675,null));};exports[_0x0605('0x73')]=function(_0x3b9492,_0x27718,_0x5880cc){var _0x19a9ce=[];return db[_0x0605('0x6e')]['describe']()[_0x0605('0x24')](function(_0x3a7923){_0x19a9ce=_[_0x0605('0x2e')](_0x3a7923);return _0x3b9492['user'][_0x0605('0x74')]({'where':{'type':_0x0605('0x75'),'dialActive':!![],'dialMethod':_0x0605('0x76')},'attributes':['id',_0x0605('0x77')],'raw':!![]});})[_0x0605('0x24')](function(_0x18992a){if(_0x18992a&&_0x18992a[_0x0605('0x46')]){return db[_0x0605('0x78')][_0x0605('0x79')](function(_0x4ed772){var _0x41ef3a={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x0605('0x7a')](_0x0605('0x69'))},'VoiceQueueId':{'$in':_[_0x0605('0x2a')](_0x18992a,'id')},'$or':[{'UserId':null},{'UserId':_0x3b9492['user']['id']}]};var _0x119b9a=[];if(_0x3b9492[_0x0605('0x5a')][_0x0605('0x7b')]&&_0x3b9492[_0x0605('0x5a')][_0x0605('0x7b')]==='prev'){if(!_[_0x0605('0x7c')](_0x3b9492[_0x0605('0x5a')]['hopperIds'])){_0x41ef3a['id']={'$in':_0x3b9492[_0x0605('0x5a')][_0x0605('0x7d')]};}_0x119b9a=[[_0x0605('0x7e'),'ASC'],[_0x0605('0x7f'),_0x18992a[0x0][_0x0605('0x77')]===_0x0605('0x80')?_0x0605('0x81'):_0x0605('0x80')],db['sequelize']['literal'](_0x0605('0x82')),['id',_0x0605('0x81')]];}else{if(!_[_0x0605('0x7c')](_0x3b9492[_0x0605('0x5a')][_0x0605('0x7d')])){_0x41ef3a['id']={'$notIn':_0x3b9492['body'][_0x0605('0x7d')]};}_0x119b9a=[[_0x0605('0x7e'),'DESC'],[_0x0605('0x7f'),_0x18992a[0x0][_0x0605('0x77')]],db[_0x0605('0x78')][_0x0605('0x83')](_0x0605('0x84')),['id',_0x0605('0x80')]];}return db[_0x0605('0x2b')][_0x0605('0x85')]({'attributes':['id','scheduledat'],'where':_0x41ef3a,'order':_0x119b9a,'transaction':_0x4ed772,'lock':_0x4ed772[_0x0605('0x86')][_0x0605('0x87')],'include':[{'model':db[_0x0605('0x6e')],'as':'Contact','attributes':_0x19a9ce,'include':[{'model':db[_0x0605('0x88')],'as':_0x0605('0x89'),'attributes':['id',_0x0605('0x27')]}]},{'model':db[_0x0605('0x8a')],'as':_0x0605('0x8b'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0x0605('0x8c'),'attributes':['id',_0x0605('0x27'),_0x0605('0x8d')]}]})['then'](function(_0x2fc82e){if(_0x2fc82e){return _0x2fc82e[_0x0605('0x23')]({'UserId':_0x3b9492[_0x0605('0x66')]['id']},{'transaction':_0x4ed772});}});});}})['then'](handleEntityNotFound(_0x27718,null))[_0x0605('0x24')](respondWithResult(_0x27718,null))[_0x0605('0x58')](handleError(_0x27718,null));};exports['getOpenContacts']=function(_0x396d82,_0x2bbf3a,_0x3e574b){return _0x396d82['user'][_0x0605('0x74')]({'where':{'type':_0x0605('0x75'),'dialActive':!![],'dialMethod':_0x0605('0x76')},'attributes':['id'],'raw':!![]})['then'](function(_0x2e55e6){if(_0x2e55e6&&_0x2e55e6[_0x0605('0x46')]){return db[_0x0605('0x2b')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x0605('0x7a')](_0x0605('0x69'))},'VoiceQueueId':{'$in':_[_0x0605('0x2a')](_0x2e55e6,'id')},'$or':[{'UserId':null},{'UserId':_0x396d82[_0x0605('0x66')]['id']}]}});}return 0x0;})[_0x0605('0x24')](function(_0x28a4f8){if(!_[_0x0605('0x71')](_0x28a4f8)&&_[_0x0605('0x8e')](_0x28a4f8)){return _0x2bbf3a[_0x0605('0x18')](0xc8)[_0x0605('0x1a')]({'contacts':_0x28a4f8});}else{logger[_0x0605('0x25')](_0x0605('0x8f'),'getOpenContacts',0x194,_0x0605('0x90'));_0x2bbf3a[_0x0605('0x17')](0x194);}})[_0x0605('0x58')](handleError(_0x2bbf3a,null));}; \ No newline at end of file +var _0x8bd6=['$gt','$gte','$lt','$ne','$eq','$not','$notBetween','$like','$iLike','$notILike','$contains','$any','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','CmHopper','includeAll','include','rows','catch','show','params','create','body','find','describe','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','updatedAt','state','deleted','campaign','membername','UserId','user','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','CmContact','dialOrderByScheduledAt','sequelize','transaction','format','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','findOne','scheduledat','LOCK','Contact','CmCompany','CmList','VoiceQueue','Queue','dialActive','getOpenContacts','getVoiceQueues','outbound','preview','isNumber','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','keys','query','filters','intersection','model','concat','$and','$or'];(function(_0x58b882,_0x3b28c2){var _0x2bf184=function(_0x5d97e3){while(--_0x5d97e3){_0x58b882['push'](_0x58b882['shift']());}};_0x2bf184(++_0x3b28c2);}(_0x8bd6,0xf0));var _0x68bd=function(_0x118395,_0x202258){_0x118395=_0x118395-0x0;var _0x5ccecd=_0x8bd6[_0x118395];return _0x5ccecd;};'use strict';var emlformat=require(_0x68bd('0x0'));var rimraf=require(_0x68bd('0x1'));var zipdir=require(_0x68bd('0x2'));var jsonpatch=require(_0x68bd('0x3'));var rp=require('request-promise');var moment=require(_0x68bd('0x4'));var BPromise=require(_0x68bd('0x5'));var Mustache=require('mustache');var util=require(_0x68bd('0x6'));var path=require('path');var sox=require(_0x68bd('0x7'));var csv=require('to-csv');var ejs=require(_0x68bd('0x8'));var fs=require('fs');var fs_extra=require(_0x68bd('0x9'));var _=require('lodash');var squel=require(_0x68bd('0xa'));var crypto=require(_0x68bd('0xb'));var jsforce=require(_0x68bd('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x68bd('0xd'));var querystring=require(_0x68bd('0xe'));var Papa=require(_0x68bd('0xf'));var Redis=require(_0x68bd('0x10'));var authService=require(_0x68bd('0x11'));var qs=require(_0x68bd('0x12'));var as=require(_0x68bd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x68bd('0x14'))(_0x68bd('0x15'));var utils=require('../../config/utils');var config=require(_0x68bd('0x16'));var licenseUtil=require(_0x68bd('0x17'));var db=require(_0x68bd('0x18'))['db'];function respondWithStatusCode(_0x59810b,_0x53d53f){_0x53d53f=_0x53d53f||0xcc;return function(_0x48bea1){if(_0x48bea1){return _0x59810b[_0x68bd('0x19')](_0x53d53f);}return _0x59810b['status'](_0x53d53f)['end']();};}function respondWithResult(_0x333039,_0x5bbdc9){_0x5bbdc9=_0x5bbdc9||0xc8;return function(_0x3a7d57){if(_0x3a7d57){return _0x333039[_0x68bd('0x1a')](_0x5bbdc9)[_0x68bd('0x1b')](_0x3a7d57);}};}function respondWithFilteredResult(_0x5c0cbc,_0x44e59d){return function(_0x46f4b2){if(_0x46f4b2){var _0x396118=typeof _0x44e59d[_0x68bd('0x1c')]===_0x68bd('0x1d')&&typeof _0x44e59d[_0x68bd('0x1e')]===_0x68bd('0x1d');var _0x1c8dcc=_0x46f4b2[_0x68bd('0x1f')];var _0x1c8642=_0x396118?0x0:_0x44e59d[_0x68bd('0x1c')];var _0x125016=_0x396118?_0x46f4b2[_0x68bd('0x1f')]:_0x44e59d[_0x68bd('0x1c')]+_0x44e59d['limit'];var _0x352d1e;if(_0x125016>=_0x1c8dcc){_0x125016=_0x1c8dcc;_0x352d1e=0xc8;}else{_0x352d1e=0xce;}_0x5c0cbc['status'](_0x352d1e);return _0x5c0cbc[_0x68bd('0x20')](_0x68bd('0x21'),_0x1c8642+'-'+_0x125016+'/'+_0x1c8dcc)[_0x68bd('0x1b')](_0x46f4b2);}return null;};}function patchUpdates(_0x40dc12){return function(_0x2ce493){try{jsonpatch[_0x68bd('0x22')](_0x2ce493,_0x40dc12,!![]);}catch(_0x19f194){return BPromise[_0x68bd('0x23')](_0x19f194);}return _0x2ce493[_0x68bd('0x24')]();};}function saveUpdates(_0x167af4,_0xfa5d0d){return function(_0x16e28c){if(_0x16e28c){return _0x16e28c[_0x68bd('0x25')](_0x167af4)[_0x68bd('0x26')](function(_0x2306fa){return _0x2306fa;});}return null;};}function removeEntity(_0x3eb7f4,_0x5443f9){return function(_0xc61a53){if(_0xc61a53){return _0xc61a53[_0x68bd('0x27')]()[_0x68bd('0x26')](function(){_0x3eb7f4['status'](0xcc)[_0x68bd('0x28')]();});}};}function handleEntityNotFound(_0x10c9c7,_0x2a81fe){return function(_0x29f08d){if(!_0x29f08d){_0x10c9c7[_0x68bd('0x19')](0x194);}return _0x29f08d;};}function handleError(_0x89068f,_0x5d6a31){_0x5d6a31=_0x5d6a31||0x1f4;return function(_0x37c92b){logger[_0x68bd('0x29')](_0x37c92b[_0x68bd('0x2a')]);if(_0x37c92b[_0x68bd('0x2b')]){delete _0x37c92b[_0x68bd('0x2b')];}_0x89068f[_0x68bd('0x1a')](_0x5d6a31)[_0x68bd('0x2c')](_0x37c92b);};}exports[_0x68bd('0x2d')]=function(_0x41cb67,_0x58391e){var _0x5d8517={},_0x43e088={},_0x4d325a={'count':0x0,'rows':[]};var _0x5cf70f=_[_0x68bd('0x2e')](db['CmHopper'][_0x68bd('0x2f')],function(_0x330ff9){return{'name':_0x330ff9[_0x68bd('0x30')],'type':_0x330ff9[_0x68bd('0x31')]['key']};});_0x43e088['model']=_[_0x68bd('0x2e')](_0x5cf70f,_0x68bd('0x2b'));_0x43e088['query']=_[_0x68bd('0x32')](_0x41cb67[_0x68bd('0x33')]);_0x43e088[_0x68bd('0x34')]=_[_0x68bd('0x35')](_0x43e088[_0x68bd('0x36')],_0x43e088['query']);_0x43e088[_0x68bd('0x34')]=_[_0x68bd('0x37')](_0x43e088[_0x68bd('0x34')],[_0x68bd('0x38'),_0x68bd('0x39'),_0x68bd('0x3a'),_0x68bd('0x3b'),_0x68bd('0x3c'),'$lte',_0x68bd('0x3d'),_0x68bd('0x3e'),_0x68bd('0x3f'),'$between',_0x68bd('0x40'),'$in','$notIn',_0x68bd('0x41'),'$notLike',_0x68bd('0x42'),_0x68bd('0x43'),_0x68bd('0x41'),'$overlap',_0x68bd('0x44'),'$contained',_0x68bd('0x45')]);_0x5d8517[_0x68bd('0x46')]=_[_0x68bd('0x35')](_0x43e088[_0x68bd('0x36')],qs[_0x68bd('0x47')](_0x41cb67[_0x68bd('0x33')][_0x68bd('0x47')]));_0x5d8517['attributes']=_0x5d8517[_0x68bd('0x46')][_0x68bd('0x48')]?_0x5d8517['attributes']:_0x43e088[_0x68bd('0x36')];if(!_0x41cb67[_0x68bd('0x33')]['hasOwnProperty'](_0x68bd('0x49'))){_0x5d8517['limit']=qs[_0x68bd('0x1e')](_0x41cb67['query'][_0x68bd('0x1e')]);_0x5d8517[_0x68bd('0x1c')]=qs['offset'](_0x41cb67[_0x68bd('0x33')]['offset']);}_0x5d8517['order']=qs[_0x68bd('0x4a')](_0x41cb67[_0x68bd('0x33')]['sort']);_0x5d8517[_0x68bd('0x4b')]=qs[_0x68bd('0x34')](_[_0x68bd('0x4c')](_0x41cb67[_0x68bd('0x33')],_0x43e088[_0x68bd('0x34')]),_0x5cf70f);if(_0x41cb67['query'][_0x68bd('0x4d')]){_0x5d8517[_0x68bd('0x4b')]=_[_0x68bd('0x4e')](_0x5d8517[_0x68bd('0x4b')],{'$or':_[_0x68bd('0x2e')](_0x5cf70f,function(_0x6e00b6){if(_0x6e00b6[_0x68bd('0x31')]!==_0x68bd('0x4f')){var _0x570e65={};_0x570e65[_0x6e00b6[_0x68bd('0x2b')]]={'$like':'%'+_0x41cb67[_0x68bd('0x33')][_0x68bd('0x4d')]+'%'};return _0x570e65;}})});}_0x5d8517=_[_0x68bd('0x4e')]({},_0x5d8517,_0x41cb67[_0x68bd('0x50')]);var _0x764851={'where':_0x5d8517[_0x68bd('0x4b')]};return db[_0x68bd('0x51')]['count'](_0x764851)[_0x68bd('0x26')](function(_0x539bbe){_0x4d325a[_0x68bd('0x1f')]=_0x539bbe;if(_0x41cb67[_0x68bd('0x33')][_0x68bd('0x52')]){_0x5d8517[_0x68bd('0x53')]=[{'all':!![]}];}return db[_0x68bd('0x51')]['findAll'](_0x5d8517);})['then'](function(_0x81c28f){_0x4d325a[_0x68bd('0x54')]=_0x81c28f;return _0x4d325a;})[_0x68bd('0x26')](respondWithFilteredResult(_0x58391e,_0x5d8517))[_0x68bd('0x55')](handleError(_0x58391e,null));};exports[_0x68bd('0x56')]=function(_0x3687ab,_0x1f481f){var _0x126fe4={'raw':!![],'where':{'id':_0x3687ab[_0x68bd('0x57')]['id']}},_0x31e97c={};_0x31e97c[_0x68bd('0x36')]=_[_0x68bd('0x32')](db['CmHopper']['rawAttributes']);_0x31e97c[_0x68bd('0x33')]=_[_0x68bd('0x32')](_0x3687ab[_0x68bd('0x33')]);_0x31e97c['filters']=_[_0x68bd('0x35')](_0x31e97c[_0x68bd('0x36')],_0x31e97c['query']);_0x126fe4[_0x68bd('0x46')]=_['intersection'](_0x31e97c['model'],qs[_0x68bd('0x47')](_0x3687ab[_0x68bd('0x33')][_0x68bd('0x47')]));_0x126fe4['attributes']=_0x126fe4[_0x68bd('0x46')][_0x68bd('0x48')]?_0x126fe4[_0x68bd('0x46')]:_0x31e97c[_0x68bd('0x36')];if(_0x3687ab[_0x68bd('0x33')][_0x68bd('0x52')]){_0x126fe4[_0x68bd('0x53')]=[{'all':!![]}];}_0x126fe4=_['merge']({},_0x126fe4,_0x3687ab[_0x68bd('0x50')]);return db[_0x68bd('0x51')]['find'](_0x126fe4)[_0x68bd('0x26')](handleEntityNotFound(_0x1f481f,null))[_0x68bd('0x26')](respondWithResult(_0x1f481f,null))[_0x68bd('0x55')](handleError(_0x1f481f,null));};exports[_0x68bd('0x58')]=function(_0x1c2900,_0x3bdfaa){return db[_0x68bd('0x51')][_0x68bd('0x58')](_0x1c2900[_0x68bd('0x59')],{})[_0x68bd('0x26')](respondWithResult(_0x3bdfaa,0xc9))[_0x68bd('0x55')](handleError(_0x3bdfaa,null));};exports[_0x68bd('0x25')]=function(_0x4db9a1,_0xaa7b4e){if(_0x4db9a1[_0x68bd('0x59')]['id']){delete _0x4db9a1[_0x68bd('0x59')]['id'];}return db[_0x68bd('0x51')][_0x68bd('0x5a')]({'where':{'id':_0x4db9a1[_0x68bd('0x57')]['id']}})['then'](handleEntityNotFound(_0xaa7b4e,null))['then'](saveUpdates(_0x4db9a1['body'],null))[_0x68bd('0x26')](respondWithResult(_0xaa7b4e,null))[_0x68bd('0x55')](handleError(_0xaa7b4e,null));};exports['describe']=function(_0x4bade5,_0xeac3da){return db[_0x68bd('0x51')][_0x68bd('0x5b')]()[_0x68bd('0x26')](respondWithResult(_0xeac3da,null))['catch'](handleError(_0xeac3da,null));};exports[_0x68bd('0x27')]=function(_0x1e6f32,_0xc0d1c9){var _0x37c67d;return db['CmHopper'][_0x68bd('0x5a')]({'where':{'id':_0x1e6f32[_0x68bd('0x57')]['id']}})['then'](handleEntityNotFound(_0xc0d1c9,null))['then'](function(_0x2874b5){if(_0x2874b5){return _0x2874b5['destroy']()['then'](function(_0xbe3c99){return _0xbe3c99;});}})[_0x68bd('0x26')](function(_0x36d343){_0x37c67d=_0x36d343;if(_0x36d343){if(_0x36d343[_0x68bd('0x5c')]||_0x36d343[_0x68bd('0x5d')]){return db[_0x36d343[_0x68bd('0x5c')]?'VoiceQueue':_0x68bd('0x5e')]['find']({'where':{'id':_0x36d343[_0x68bd('0x5c')]?_0x36d343['VoiceQueueId']:_0x36d343['CampaignId']},'attributes':['id',_0x68bd('0x2b')],'raw':!![]});}}})[_0x68bd('0x26')](function(_0x4637d2){var _0x483eb5={};if(_0x4637d2){_[_0x68bd('0x4e')](_0x483eb5,_[_0x68bd('0x5f')](_0x37c67d[_0x68bd('0x60')],[_0x68bd('0x61'),_0x68bd('0x62'),'id']));_0x483eb5[_0x68bd('0x63')]=0x15;_0x483eb5['statedesc']=_0x68bd('0x64');_0x483eb5[_0x68bd('0x65')]=_0x4637d2[_0x68bd('0x2b')];_0x483eb5[_0x68bd('0x66')]=_0x1e6f32['user'][_0x68bd('0x2b')];_0x483eb5[_0x68bd('0x67')]=_0x1e6f32[_0x68bd('0x68')]['id'];_0x483eb5[_0x68bd('0x64')]=!![];_0x483eb5[_0x68bd('0x69')]=moment()['format'](_0x68bd('0x6a'));_0x483eb5[_0x68bd('0x6b')]=_0x37c67d[_0x68bd('0x6c')];_0x483eb5[_0x68bd('0x6d')]=_0x37c67d['VoiceQueueId']?_0x68bd('0x6e'):_0x68bd('0x6f');return db['CmContact'][_0x68bd('0x5a')]({'where':{'id':_0x483eb5[_0x68bd('0x70')]},'attributes':[_0x68bd('0x71'),_0x68bd('0x72')]})[_0x68bd('0x26')](function(_0x30d452){if(!_[_0x68bd('0x73')](_0xc0d1c9)&&!_['isNil'](_0x30d452[_0x68bd('0x71')])){_0x483eb5[_0x68bd('0x74')]=_0x30d452[_0x68bd('0x71')];if(!_[_0x68bd('0x73')](_0x30d452[_0x68bd('0x72')])){_0x483eb5['calleridname']+='\x20'+_0x30d452['lastName'];}}})[_0x68bd('0x75')](function(){return db[_0x68bd('0x76')][_0x68bd('0x58')](_0x483eb5);});}})[_0x68bd('0x26')](function(){return _0xc0d1c9[_0x68bd('0x1a')](0xcc)[_0x68bd('0x28')]();})[_0x68bd('0x55')](handleError(_0xc0d1c9,null));};exports[_0x68bd('0x77')]=function(_0x323308,_0x594be6,_0x16dd09){var _0x49c38a=[];return db[_0x68bd('0x78')][_0x68bd('0x5b')]()[_0x68bd('0x26')](function(_0x4f7e00){_0x49c38a=_[_0x68bd('0x32')](_0x4f7e00);return _0x323308[_0x68bd('0x68')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x68bd('0x79')],'raw':!![]});})['then'](function(_0x163719){if(_0x163719&&_0x163719['length']){return db[_0x68bd('0x7a')][_0x68bd('0x7b')](function(_0x300607){var _0x5b81df={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x68bd('0x7c')](_0x68bd('0x6a'))},'VoiceQueueId':{'$in':_[_0x68bd('0x2e')](_0x163719,'id')},'$or':[{'UserId':null},{'UserId':_0x323308[_0x68bd('0x68')]['id']}]};var _0x30df33=[];if(_0x323308[_0x68bd('0x59')]['direction']&&_0x323308[_0x68bd('0x59')][_0x68bd('0x7d')]===_0x68bd('0x7e')){if(!_[_0x68bd('0x7f')](_0x323308[_0x68bd('0x59')]['hopperIds'])){_0x5b81df['id']={'$in':_0x323308[_0x68bd('0x59')][_0x68bd('0x80')]};}_0x30df33=[[_0x68bd('0x81'),_0x68bd('0x82')],[_0x68bd('0x83'),_0x163719[0x0][_0x68bd('0x79')]===_0x68bd('0x82')?'DESC':_0x68bd('0x82')],db['sequelize'][_0x68bd('0x84')](_0x68bd('0x85')),['id',_0x68bd('0x86')]];}else{if(!_[_0x68bd('0x7f')](_0x323308[_0x68bd('0x59')][_0x68bd('0x80')])){_0x5b81df['id']={'$notIn':_0x323308[_0x68bd('0x59')]['hopperIds']};}_0x30df33=[[_0x68bd('0x81'),_0x68bd('0x86')],[_0x68bd('0x83'),_0x163719[0x0]['dialOrderByScheduledAt']],db[_0x68bd('0x7a')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x68bd('0x82')]];}return db[_0x68bd('0x51')][_0x68bd('0x87')]({'attributes':['id',_0x68bd('0x88')],'where':_0x5b81df,'order':_0x30df33,'transaction':_0x300607,'lock':_0x300607[_0x68bd('0x89')]['UPDATE'],'include':[{'model':db[_0x68bd('0x78')],'as':_0x68bd('0x8a'),'attributes':_0x49c38a,'include':[{'model':db[_0x68bd('0x8b')],'as':'Company','attributes':['id','name']}]},{'model':db[_0x68bd('0x8c')],'as':'List','attributes':['id',_0x68bd('0x2b')]},{'model':db[_0x68bd('0x8d')],'as':_0x68bd('0x8e'),'attributes':['id','name',_0x68bd('0x8f')]}]})['then'](function(_0x56a319){if(_0x56a319){return _0x56a319['update']({'UserId':_0x323308['user']['id']},{'transaction':_0x300607});}});});}})[_0x68bd('0x26')](handleEntityNotFound(_0x594be6,null))['then'](respondWithResult(_0x594be6,null))['catch'](handleError(_0x594be6,null));};exports[_0x68bd('0x90')]=function(_0x2d7ff,_0xfbf24d,_0x3f34be){return _0x2d7ff['user'][_0x68bd('0x91')]({'where':{'type':_0x68bd('0x92'),'dialActive':!![],'dialMethod':_0x68bd('0x93')},'attributes':['id'],'raw':!![]})[_0x68bd('0x26')](function(_0x4e9cc1){if(_0x4e9cc1&&_0x4e9cc1[_0x68bd('0x48')]){return db[_0x68bd('0x51')][_0x68bd('0x1f')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x68bd('0x7c')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x68bd('0x2e')](_0x4e9cc1,'id')},'$or':[{'UserId':null},{'UserId':_0x2d7ff[_0x68bd('0x68')]['id']}]}});}return 0x0;})[_0x68bd('0x26')](function(_0x2d37d7){if(!_['isNil'](_0x2d37d7)&&_[_0x68bd('0x94')](_0x2d37d7)){return _0xfbf24d['status'](0xc8)['json']({'contacts':_0x2d37d7});}else{logger[_0x68bd('0x29')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x68bd('0x90'),0x194,'entity\x20not\x20found');_0xfbf24d[_0x68bd('0x19')](0x194);}})[_0x68bd('0x55')](handleError(_0xfbf24d,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index ccb6b32..52ee660 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 _0x33af=['request-promise','path','rimraf','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','util','api','moment','bluebird'];(function(_0x324366,_0x2ec482){var _0x21fae2=function(_0x30162e){while(--_0x30162e){_0x324366['push'](_0x324366['shift']());}};_0x21fae2(++_0x2ec482);}(_0x33af,0xec));var _0xf33a=function(_0xafcf00,_0x4429a3){_0xafcf00=_0xafcf00-0x0;var _0x513af4=_0x33af[_0xafcf00];return _0x513af4;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var logger=require('../../config/logger')(_0xf33a('0x1'));var moment=require(_0xf33a('0x2'));var BPromise=require(_0xf33a('0x3'));var rp=require(_0xf33a('0x4'));var fs=require('fs');var path=require(_0xf33a('0x5'));var rimraf=require(_0xf33a('0x6'));var config=require('../../config/environment');var attributes=require(_0xf33a('0x7'));module[_0xf33a('0x8')]=function(_0x583e54,_0xc0dd13){return _0x583e54[_0xf33a('0x9')](_0xf33a('0xa'),attributes,{'tableName':_0xf33a('0xb'),'paranoid':![],'indexes':[{'name':_0xf33a('0xc'),'fields':[_0xf33a('0xc')]},{'name':'phone','fields':[_0xf33a('0xd')]},{'name':_0xf33a('0xe'),'fields':[_0xf33a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','cm_hopper','scheduledat','phone','priority','lodash'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0xabce,0x103));var _0xeabc=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xabce[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./cmHopper.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('CmHopper',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]},{'name':'phone','fields':[_0xeabc('0xb')]},{'name':_0xeabc('0xc'),'fields':[_0xeabc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 2a2f9c1..d19489c 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 _0x29b3=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetCmHopper','CmHopper','findAll','options','where','attributes','limit','map','include','model','info','catch','ShowCmHopper','find','raw','create','body','debug','CreateCmHopper','update','UpdateCmHopper','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','UPDATE','Contact','User','name','voicePause','length','UserId','includes','push','all','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','LOCK','GetContactRecallMe','keys','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x331352,_0x329457){var _0x448f0a=function(_0x2c7cee){while(--_0x2c7cee){_0x331352['push'](_0x331352['shift']());}};_0x448f0a(++_0x329457);}(_0x29b3,0x11a));var _0x329b=function(_0x31de83,_0xf24103){_0x31de83=_0x31de83-0x0;var _0x4ddcb2=_0x29b3[_0x31de83];return _0x4ddcb2;};'use strict';var _=require(_0x329b('0x0'));var util=require(_0x329b('0x1'));var moment=require(_0x329b('0x2'));var BPromise=require(_0x329b('0x3'));var rs=require(_0x329b('0x4'));var fs=require('fs');var Redis=require(_0x329b('0x5'));var db=require(_0x329b('0x6'))['db'];var utils=require(_0x329b('0x7'));var logger=require(_0x329b('0x8'))(_0x329b('0x9'));var config=require(_0x329b('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x329b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37274e,_0x24c079,_0x2913ba){return new BPromise(function(_0x4b42c6,_0x3d7859){return client[_0x329b('0xc')](_0x37274e,_0x2913ba)[_0x329b('0xd')](function(_0x36dda2){logger['info'](_0x329b('0xe'),_0x24c079,_0x329b('0xf'));logger['debug'](_0x329b('0x10'),_0x24c079,'request\x20sent',JSON[_0x329b('0x11')](_0x36dda2));if(_0x36dda2[_0x329b('0x12')]){if(_0x36dda2[_0x329b('0x12')]['code']===0x1f4){logger[_0x329b('0x12')](_0x329b('0xe'),_0x24c079,_0x36dda2['error'][_0x329b('0x13')]);return _0x3d7859(_0x36dda2[_0x329b('0x12')][_0x329b('0x13')]);}logger[_0x329b('0x12')](_0x329b('0xe'),_0x24c079,_0x36dda2[_0x329b('0x12')][_0x329b('0x13')]);return _0x4b42c6(_0x36dda2['error']['message']);}else{logger['info'](_0x329b('0xe'),_0x24c079,_0x329b('0xf'));_0x4b42c6(_0x36dda2[_0x329b('0x14')][_0x329b('0x13')]);}})['catch'](function(_0x9c70a9){logger[_0x329b('0x12')]('CmHopper,\x20%s,\x20%s',_0x24c079,_0x9c70a9);_0x3d7859(_0x9c70a9);});});}exports[_0x329b('0x15')]=function(_0x413ff2){var _0x2b598d=this;return new Promise(function(_0x3f8ec5,_0x932601){return db[_0x329b('0x16')][_0x329b('0x17')]({'raw':_0x413ff2[_0x329b('0x18')]?_0x413ff2['options']['raw']===undefined?!![]:![]:!![],'where':_0x413ff2['options']?_0x413ff2[_0x329b('0x18')][_0x329b('0x19')]||null:null,'attributes':_0x413ff2[_0x329b('0x18')]?_0x413ff2['options'][_0x329b('0x1a')]||null:null,'limit':_0x413ff2[_0x329b('0x18')]?_0x413ff2[_0x329b('0x18')][_0x329b('0x1b')]||null:null,'include':_0x413ff2[_0x329b('0x18')]?_0x413ff2[_0x329b('0x18')]['include']?_[_0x329b('0x1c')](_0x413ff2[_0x329b('0x18')][_0x329b('0x1d')],function(_0xc36005){return{'model':db[_0xc36005[_0x329b('0x1e')]],'as':_0xc36005['as'],'attributes':_0xc36005['attributes'],'include':_0xc36005['include']?_[_0x329b('0x1c')](_0xc36005[_0x329b('0x1d')],function(_0x5a2535){return{'model':db[_0x5a2535[_0x329b('0x1e')]],'as':_0x5a2535['as'],'attributes':_0x5a2535[_0x329b('0x1a')],'include':_0x5a2535[_0x329b('0x1d')]?_[_0x329b('0x1c')](_0x5a2535[_0x329b('0x1d')],function(_0x4c203c){return{'model':db[_0x4c203c['model']],'as':_0x4c203c['as'],'attributes':_0x4c203c[_0x329b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x329b('0xd')](function(_0x2fcb71){logger[_0x329b('0x1f')](_0x329b('0x15'),_0x413ff2);logger['debug']('GetCmHopper',_0x413ff2,JSON[_0x329b('0x11')](_0x2fcb71));_0x3f8ec5(_0x2fcb71);})[_0x329b('0x20')](function(_0x5d1ef0){logger['error'](_0x329b('0x15'),_0x5d1ef0[_0x329b('0x13')],_0x413ff2);_0x932601(_0x2b598d[_0x329b('0x12')](0x1f4,_0x5d1ef0[_0x329b('0x13')]));});});};exports[_0x329b('0x21')]=function(_0x58685a){var _0x307ce9=this;return new Promise(function(_0x3d7ed5,_0x1ae3e3){return db[_0x329b('0x16')][_0x329b('0x22')]({'raw':_0x58685a[_0x329b('0x18')]?_0x58685a['options'][_0x329b('0x23')]===undefined?!![]:![]:!![],'where':_0x58685a[_0x329b('0x18')]?_0x58685a[_0x329b('0x18')]['where']||null:null,'attributes':_0x58685a[_0x329b('0x18')]?_0x58685a['options'][_0x329b('0x1a')]||null:null,'include':_0x58685a[_0x329b('0x18')]?_0x58685a[_0x329b('0x18')][_0x329b('0x1d')]?_['map'](_0x58685a['options'][_0x329b('0x1d')],function(_0x473a3c){return{'model':db[_0x473a3c['model']],'as':_0x473a3c['as'],'attributes':_0x473a3c[_0x329b('0x1a')],'include':_0x473a3c['include']?_[_0x329b('0x1c')](_0x473a3c[_0x329b('0x1d')],function(_0x15d2da){return{'model':db[_0x15d2da['model']],'as':_0x15d2da['as'],'attributes':_0x15d2da[_0x329b('0x1a')],'include':_0x15d2da[_0x329b('0x1d')]?_[_0x329b('0x1c')](_0x15d2da[_0x329b('0x1d')],function(_0xa7a602){return{'model':db[_0xa7a602[_0x329b('0x1e')]],'as':_0xa7a602['as'],'attributes':_0xa7a602['attributes']};}):[]};}):[]};}):[]:[]})[_0x329b('0xd')](function(_0x3e4dc0){logger[_0x329b('0x1f')]('ShowCmHopper',_0x58685a);logger['debug'](_0x329b('0x21'),_0x58685a,JSON[_0x329b('0x11')](_0x3e4dc0));_0x3d7ed5(_0x3e4dc0);})['catch'](function(_0x95959c){logger[_0x329b('0x12')](_0x329b('0x21'),_0x95959c['message'],_0x58685a);_0x1ae3e3(_0x307ce9[_0x329b('0x12')](0x1f4,_0x95959c[_0x329b('0x13')]));});});};exports['CreateCmHopper']=function(_0x5d824e){var _0x396e9b=this;return new Promise(function(_0x3aef93,_0x1ce580){return db[_0x329b('0x16')][_0x329b('0x24')](_0x5d824e[_0x329b('0x25')],{'raw':_0x5d824e['options']?_0x5d824e[_0x329b('0x18')][_0x329b('0x23')]===undefined?!![]:![]:!![]})['then'](function(_0x14958f){logger[_0x329b('0x1f')]('CreateCmHopper',_0x5d824e);logger[_0x329b('0x26')](_0x329b('0x27'),_0x5d824e,JSON[_0x329b('0x11')](_0x14958f));_0x3aef93(_0x14958f);})['catch'](function(_0x4e4525){logger['error'](_0x329b('0x27'),_0x4e4525[_0x329b('0x13')],_0x5d824e);_0x1ce580(_0x396e9b['error'](0x1f4,_0x4e4525[_0x329b('0x13')]));});});};exports['UpdateCmHopper']=function(_0x43c40a){var _0x39a4f8=this;return new Promise(function(_0x2388aa,_0x55c80e){return db[_0x329b('0x16')][_0x329b('0x28')](_0x43c40a[_0x329b('0x25')],{'raw':_0x43c40a[_0x329b('0x18')]?_0x43c40a[_0x329b('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43c40a[_0x329b('0x18')]?_0x43c40a['options'][_0x329b('0x19')]||null:null,'attributes':_0x43c40a['options']?_0x43c40a['options'][_0x329b('0x1a')]||null:null,'limit':_0x43c40a[_0x329b('0x18')]?_0x43c40a[_0x329b('0x18')]['limit']||null:null})[_0x329b('0xd')](function(_0x1e888f){logger[_0x329b('0x1f')]('UpdateCmHopper',_0x43c40a);logger['debug'](_0x329b('0x29'),_0x43c40a,JSON['stringify'](_0x1e888f));_0x2388aa(_0x1e888f);})[_0x329b('0x20')](function(_0x18e01a){logger[_0x329b('0x12')](_0x329b('0x29'),_0x18e01a[_0x329b('0x13')],_0x43c40a);_0x55c80e(_0x39a4f8[_0x329b('0x12')](0x1f4,_0x18e01a[_0x329b('0x13')]));});});};exports[_0x329b('0x2a')]=function(_0x1d9010){var _0x595875=this;return new Promise(function(_0x1719b2,_0xd503f8){return db[_0x329b('0x16')]['destroy']({'where':_0x1d9010[_0x329b('0x18')]?_0x1d9010[_0x329b('0x18')][_0x329b('0x19')]||null:null})[_0x329b('0xd')](function(_0x916aee){logger[_0x329b('0x1f')](_0x329b('0x2a'),_0x1d9010);logger[_0x329b('0x26')](_0x329b('0x2a'),_0x1d9010,JSON[_0x329b('0x11')](_0x916aee));_0x1719b2(_0x916aee);})[_0x329b('0x20')](function(_0x1789b1){logger[_0x329b('0x12')]('DestroyCmHopper',_0x1789b1[_0x329b('0x13')],_0x1d9010);_0xd503f8(_0x595875[_0x329b('0x12')](0x1f4,_0x1789b1[_0x329b('0x13')]));});});};exports[_0x329b('0x2b')]=function(_0x48c858){var _0xe5663c=this;return new Promise(function(_0x1af12c,_0x2d2c7b){return db[_0x329b('0x2c')][_0x329b('0x2d')]()['then'](function(_0x267d1b){return db[_0x329b('0x2e')][_0x329b('0x2f')](function(_0x5dd18d){return db['CmHopper'][_0x329b('0x17')]({'where':_0x48c858['options']?_0x48c858[_0x329b('0x18')][_0x329b('0x19')]||null:null,'attributes':_0x48c858[_0x329b('0x18')]?_0x48c858[_0x329b('0x18')][_0x329b('0x1a')]||null:null,'limit':_0x48c858[_0x329b('0x18')]?_0x48c858[_0x329b('0x18')][_0x329b('0x1b')]||null:null,'order':_0x48c858[_0x329b('0x18')]?_0x48c858[_0x329b('0x18')][_0x329b('0x30')]||null:null,'transaction':_0x5dd18d,'lock':_0x5dd18d['LOCK'][_0x329b('0x31')],'include':[{'model':db[_0x329b('0x2c')],'as':_0x329b('0x32'),'attributes':_['keys'](_0x267d1b)},{'model':db[_0x329b('0x33')],'as':'Agent','attributes':['id',_0x329b('0x34'),_0x329b('0x35')]}]})[_0x329b('0xd')](function(_0x34707c){var _0x35d1d1=[];var _0x2e9988=[];for(var _0x4f29d2=0x0;_0x4f29d2<_0x34707c[_0x329b('0x36')];_0x4f29d2+=0x1){var _0x47d0ed=_0x34707c[_0x4f29d2][_0x329b('0x37')];if(_0x47d0ed===null){_0x35d1d1['push'](_0x34707c[_0x4f29d2][_0x329b('0x28')](_0x48c858[_0x329b('0x25')],{'transaction':_0x5dd18d}));}else if(!_0x2e9988[_0x329b('0x38')](_0x47d0ed)){_0x2e9988[_0x329b('0x39')](_0x47d0ed);_0x35d1d1[_0x329b('0x39')](_0x34707c[_0x4f29d2][_0x329b('0x28')](_0x48c858[_0x329b('0x25')],{'transaction':_0x5dd18d}));}}return BPromise[_0x329b('0x3a')](_0x35d1d1);});})['then'](function(_0x106d9e){logger[_0x329b('0x1f')](_0x329b('0x2b'),_0x48c858);logger[_0x329b('0x26')](_0x329b('0x2b'),_0x48c858,JSON[_0x329b('0x11')](_0x106d9e));_0x1af12c(_0x106d9e);})[_0x329b('0x20')](function(_0x4c277e){logger[_0x329b('0x12')](_0x329b('0x2b'),_0x4c277e['message'],_0x48c858);_0x2d2c7b(_0xe5663c[_0x329b('0x12')](0x1f4,_0x4c277e[_0x329b('0x13')]));});});});};exports[_0x329b('0x3b')]=function(_0x178116){var _0x4b0e7d=this;return new Promise(function(_0x3e171a,_0x44f417){return db['sequelize'][_0x329b('0x2f')](function(_0x33a09f){return db[_0x329b('0x3c')]['create'](_0x178116['body'],{'raw':_0x178116[_0x329b('0x18')]?_0x178116[_0x329b('0x18')]['raw']===undefined?!![]:![]:!![],'transaction':_0x33a09f})[_0x329b('0xd')](function(){return db[_0x329b('0x16')]['destroy']({'where':_0x178116['options']?_0x178116[_0x329b('0x18')][_0x329b('0x19')]||null:null,'transaction':_0x33a09f});});})[_0x329b('0xd')](function(_0x226bdc){logger[_0x329b('0x1f')](_0x329b('0x3b'),_0x178116);logger[_0x329b('0x26')](_0x329b('0x3b'),_0x178116,JSON[_0x329b('0x11')](_0x226bdc));_0x3e171a(_0x226bdc);})[_0x329b('0x20')](function(_0x4e03c1){logger['error'](_0x329b('0x3b'),_0x4e03c1[_0x329b('0x13')],_0x178116);_0x44f417(_0x4b0e7d[_0x329b('0x12')](0x1f4,_0x4e03c1['message']));});});};exports[_0x329b('0x3d')]=function(_0x51cd13){var _0x331af6=this;return new Promise(function(_0x28a92f,_0x312f8d){return db[_0x329b('0x16')][_0x329b('0x17')]({'raw':_0x51cd13[_0x329b('0x18')]?_0x51cd13[_0x329b('0x18')][_0x329b('0x23')]===undefined?!![]:![]:!![],'where':_0x51cd13[_0x329b('0x18')]?_0x51cd13[_0x329b('0x18')][_0x329b('0x19')]||null:null,'attributes':[[db[_0x329b('0x2e')]['fn'](_0x329b('0x3e'),db['sequelize']['fn']('IF',db['sequelize'][_0x329b('0x3f')](_0x329b('0x40')+util[_0x329b('0x41')](_0x329b('0x42'),moment()[_0x329b('0x41')](_0x329b('0x43')))+_0x329b('0x44')))),'contactsRescheduled']]})[_0x329b('0xd')](function(_0x359367){logger[_0x329b('0x1f')]('CountReScheduled',_0x51cd13);logger[_0x329b('0x26')]('CountReScheduled',_0x51cd13,JSON[_0x329b('0x11')](_0x359367));_0x28a92f(_0x359367);})['catch'](function(_0x353511){logger[_0x329b('0x12')](_0x329b('0x3d'),_0x353511[_0x329b('0x13')],_0x51cd13);_0x312f8d(_0x331af6['error'](0x1f4,_0x353511[_0x329b('0x13')]));});});};exports['GetContactRecallMe']=function(_0x2e7910){var _0x45f8f1=this;return new Promise(function(_0x3440f5,_0x4b9ca8){return db[_0x329b('0x2c')][_0x329b('0x2d')]()[_0x329b('0xd')](function(_0x5cf4e7){return db['sequelize']['transaction'](function(_0x41d3a8){return db[_0x329b('0x16')]['findAll']({'where':_0x2e7910[_0x329b('0x18')]?_0x2e7910['options']['where']||null:null,'attributes':_0x2e7910[_0x329b('0x18')]?_0x2e7910[_0x329b('0x18')][_0x329b('0x1a')]||null:null,'limit':0x1,'order':_0x2e7910[_0x329b('0x18')]?_0x2e7910[_0x329b('0x18')][_0x329b('0x30')]||null:null,'group':db[_0x329b('0x16')][_0x329b('0x37')],'transaction':_0x41d3a8,'lock':_0x41d3a8[_0x329b('0x45')][_0x329b('0x31')],'include':_0x2e7910[_0x329b('0x18')]?_0x2e7910[_0x329b('0x18')]['include']?_[_0x329b('0x1c')](_0x2e7910['options'][_0x329b('0x1d')],function(_0x4eab00){return{'model':db[_0x4eab00[_0x329b('0x1e')]],'as':_0x4eab00['as'],'attributes':_0x4eab00[_0x329b('0x1a')],'include':_0x4eab00['include']?_['map'](_0x4eab00[_0x329b('0x1d')],function(_0x5819e7){return{'model':db[_0x5819e7['model']],'as':_0x5819e7['as'],'attributes':_0x5819e7['attributes'],'include':_0x5819e7[_0x329b('0x1d')]?_[_0x329b('0x1c')](_0x5819e7[_0x329b('0x1d')],function(_0x165567){return{'model':db[_0x165567[_0x329b('0x1e')]],'as':_0x165567['as'],'attributes':_0x165567[_0x329b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x329b('0xd')](function(_0x205377){var _0x586580=[];for(var _0xee3063=0x0;_0xee3063<_0x205377[_0x329b('0x36')];_0xee3063+=0x1){_0x586580[_0x329b('0x39')](_0x205377[_0xee3063]['update'](_0x2e7910[_0x329b('0x25')],{'transaction':_0x41d3a8}));}return BPromise[_0x329b('0x3a')](_0x586580);});})[_0x329b('0xd')](function(_0x423b9){logger['info'](_0x329b('0x46'),_0x2e7910);logger[_0x329b('0x26')](_0x329b('0x46'),_0x2e7910,JSON[_0x329b('0x11')](_0x423b9));_0x3440f5(_0x423b9);})[_0x329b('0x20')](function(_0x23315a){logger[_0x329b('0x12')](_0x329b('0x46'),_0x23315a[_0x329b('0x13')],_0x2e7910);_0x4b9ca8(_0x45f8f1[_0x329b('0x12')](0x1f4,_0x23315a['message']));});});});};exports['GetCmHopperPreview']=function(_0x34dfdd){var _0x4477db=this;return new Promise(function(_0x1ecb2a,_0x116d1d){db['CmContact'][_0x329b('0x2d')]()[_0x329b('0xd')](function(_0x279275){return db[_0x329b('0x16')][_0x329b('0x17')]({'raw':_0x34dfdd['options']?_0x34dfdd[_0x329b('0x18')][_0x329b('0x23')]===undefined?!![]:![]:!![],'where':_0x34dfdd[_0x329b('0x18')]?_0x34dfdd[_0x329b('0x18')]['where']||null:null,'attributes':_0x34dfdd['options']?_0x34dfdd[_0x329b('0x18')]['attributes']||null:null,'limit':_0x34dfdd[_0x329b('0x18')]?_0x34dfdd[_0x329b('0x18')][_0x329b('0x1b')]||null:null,'include':_0x34dfdd['options']?_0x34dfdd[_0x329b('0x18')][_0x329b('0x1d')]?_[_0x329b('0x1c')](_0x34dfdd[_0x329b('0x18')][_0x329b('0x1d')],function(_0x5b917a){return{'model':db[_0x5b917a[_0x329b('0x1e')]],'as':_0x5b917a['as'],'attributes':_0x5b917a['as']===_0x329b('0x32')?_[_0x329b('0x47')](_0x279275):_0x5b917a[_0x329b('0x1a')],'include':_0x5b917a[_0x329b('0x1d')]?_[_0x329b('0x1c')](_0x5b917a[_0x329b('0x1d')],function(_0x413765){return{'model':db[_0x413765[_0x329b('0x1e')]],'as':_0x413765['as'],'attributes':_0x413765[_0x329b('0x1a')],'include':_0x413765['include']?_[_0x329b('0x1c')](_0x413765[_0x329b('0x1d')],function(_0x355b15){return{'model':db[_0x355b15[_0x329b('0x1e')]],'as':_0x355b15['as'],'attributes':_0x355b15[_0x329b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f5493){logger['info']('GetCmHopper',_0x34dfdd);logger['debug'](_0x329b('0x15'),_0x34dfdd,JSON[_0x329b('0x11')](_0x2f5493));_0x1ecb2a(_0x2f5493);})[_0x329b('0x20')](function(_0x594cd7){logger[_0x329b('0x12')](_0x329b('0x15'),_0x594cd7[_0x329b('0x13')],_0x34dfdd);_0x116d1d(_0x4477db['error'](0x1f4,_0x594cd7[_0x329b('0x13')]));});});});}; \ No newline at end of file +var _0xba23=['User','name','voicePause','length','UserId','push','includes','all','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','GetContactRecallMe','GetCmHopperPreview','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CmHopper','findAll','options','raw','where','attributes','include','map','model','then','GetCmHopper','ShowCmHopper','find','CreateCmHopper','create','body','UpdateCmHopper','update','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','limit','order','LOCK','UPDATE','Contact','keys'];(function(_0xe8129c,_0x2fb03c){var _0x709fc5=function(_0xb8e0c6){while(--_0xb8e0c6){_0xe8129c['push'](_0xe8129c['shift']());}};_0x709fc5(++_0x2fb03c);}(_0xba23,0x1bc));var _0x3ba2=function(_0x515dfb,_0x410149){_0x515dfb=_0x515dfb-0x0;var _0x5bdff9=_0xba23[_0x515dfb];return _0x5bdff9;};'use strict';var _=require(_0x3ba2('0x0'));var util=require('util');var moment=require(_0x3ba2('0x1'));var BPromise=require(_0x3ba2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3ba2('0x3'))['db'];var utils=require(_0x3ba2('0x4'));var logger=require(_0x3ba2('0x5'))(_0x3ba2('0x6'));var config=require(_0x3ba2('0x7'));var jayson=require(_0x3ba2('0x8'));var client=jayson[_0x3ba2('0x9')][_0x3ba2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f2ed8,_0x1c12a0,_0x154108){return new BPromise(function(_0x48fd47,_0x14aec6){return client[_0x3ba2('0xb')](_0x3f2ed8,_0x154108)['then'](function(_0x4d23f5){logger['info'](_0x3ba2('0xc'),_0x1c12a0,_0x3ba2('0xd'));logger[_0x3ba2('0xe')](_0x3ba2('0xf'),_0x1c12a0,_0x3ba2('0xd'),JSON[_0x3ba2('0x10')](_0x4d23f5));if(_0x4d23f5[_0x3ba2('0x11')]){if(_0x4d23f5[_0x3ba2('0x11')][_0x3ba2('0x12')]===0x1f4){logger[_0x3ba2('0x11')](_0x3ba2('0xc'),_0x1c12a0,_0x4d23f5[_0x3ba2('0x11')][_0x3ba2('0x13')]);return _0x14aec6(_0x4d23f5[_0x3ba2('0x11')][_0x3ba2('0x13')]);}logger[_0x3ba2('0x11')](_0x3ba2('0xc'),_0x1c12a0,_0x4d23f5[_0x3ba2('0x11')]['message']);return _0x48fd47(_0x4d23f5['error'][_0x3ba2('0x13')]);}else{logger[_0x3ba2('0x14')]('CmHopper,\x20%s,\x20%s',_0x1c12a0,'request\x20sent');_0x48fd47(_0x4d23f5['result'][_0x3ba2('0x13')]);}})[_0x3ba2('0x15')](function(_0x3cd661){logger[_0x3ba2('0x11')](_0x3ba2('0xc'),_0x1c12a0,_0x3cd661);_0x14aec6(_0x3cd661);});});}exports['GetCmHopper']=function(_0x100e7d){var _0x3447eb=this;return new Promise(function(_0x4539ec,_0x1f82a3){return db[_0x3ba2('0x16')][_0x3ba2('0x17')]({'raw':_0x100e7d[_0x3ba2('0x18')]?_0x100e7d[_0x3ba2('0x18')][_0x3ba2('0x19')]===undefined?!![]:![]:!![],'where':_0x100e7d['options']?_0x100e7d[_0x3ba2('0x18')][_0x3ba2('0x1a')]||null:null,'attributes':_0x100e7d[_0x3ba2('0x18')]?_0x100e7d[_0x3ba2('0x18')][_0x3ba2('0x1b')]||null:null,'limit':_0x100e7d[_0x3ba2('0x18')]?_0x100e7d[_0x3ba2('0x18')]['limit']||null:null,'include':_0x100e7d[_0x3ba2('0x18')]?_0x100e7d[_0x3ba2('0x18')]['include']?_['map'](_0x100e7d['options'][_0x3ba2('0x1c')],function(_0x1be151){return{'model':db[_0x1be151['model']],'as':_0x1be151['as'],'attributes':_0x1be151[_0x3ba2('0x1b')],'include':_0x1be151['include']?_['map'](_0x1be151[_0x3ba2('0x1c')],function(_0x275ce2){return{'model':db[_0x275ce2['model']],'as':_0x275ce2['as'],'attributes':_0x275ce2[_0x3ba2('0x1b')],'include':_0x275ce2['include']?_[_0x3ba2('0x1d')](_0x275ce2[_0x3ba2('0x1c')],function(_0x12f5aa){return{'model':db[_0x12f5aa[_0x3ba2('0x1e')]],'as':_0x12f5aa['as'],'attributes':_0x12f5aa[_0x3ba2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3ba2('0x1f')](function(_0x28389d){logger['info'](_0x3ba2('0x20'),_0x100e7d);logger[_0x3ba2('0xe')]('GetCmHopper',_0x100e7d,JSON['stringify'](_0x28389d));_0x4539ec(_0x28389d);})[_0x3ba2('0x15')](function(_0x429202){logger[_0x3ba2('0x11')](_0x3ba2('0x20'),_0x429202['message'],_0x100e7d);_0x1f82a3(_0x3447eb[_0x3ba2('0x11')](0x1f4,_0x429202[_0x3ba2('0x13')]));});});};exports[_0x3ba2('0x21')]=function(_0x3b0ab8){var _0x34c20e=this;return new Promise(function(_0x4ee365,_0x2b2bd0){return db[_0x3ba2('0x16')][_0x3ba2('0x22')]({'raw':_0x3b0ab8[_0x3ba2('0x18')]?_0x3b0ab8[_0x3ba2('0x18')][_0x3ba2('0x19')]===undefined?!![]:![]:!![],'where':_0x3b0ab8[_0x3ba2('0x18')]?_0x3b0ab8[_0x3ba2('0x18')][_0x3ba2('0x1a')]||null:null,'attributes':_0x3b0ab8[_0x3ba2('0x18')]?_0x3b0ab8[_0x3ba2('0x18')][_0x3ba2('0x1b')]||null:null,'include':_0x3b0ab8[_0x3ba2('0x18')]?_0x3b0ab8[_0x3ba2('0x18')]['include']?_[_0x3ba2('0x1d')](_0x3b0ab8[_0x3ba2('0x18')][_0x3ba2('0x1c')],function(_0x3706da){return{'model':db[_0x3706da[_0x3ba2('0x1e')]],'as':_0x3706da['as'],'attributes':_0x3706da[_0x3ba2('0x1b')],'include':_0x3706da[_0x3ba2('0x1c')]?_[_0x3ba2('0x1d')](_0x3706da[_0x3ba2('0x1c')],function(_0x210765){return{'model':db[_0x210765[_0x3ba2('0x1e')]],'as':_0x210765['as'],'attributes':_0x210765[_0x3ba2('0x1b')],'include':_0x210765[_0x3ba2('0x1c')]?_[_0x3ba2('0x1d')](_0x210765['include'],function(_0x4cf630){return{'model':db[_0x4cf630['model']],'as':_0x4cf630['as'],'attributes':_0x4cf630[_0x3ba2('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4963d2){logger[_0x3ba2('0x14')](_0x3ba2('0x21'),_0x3b0ab8);logger['debug']('ShowCmHopper',_0x3b0ab8,JSON[_0x3ba2('0x10')](_0x4963d2));_0x4ee365(_0x4963d2);})[_0x3ba2('0x15')](function(_0x3e5e8f){logger[_0x3ba2('0x11')]('ShowCmHopper',_0x3e5e8f[_0x3ba2('0x13')],_0x3b0ab8);_0x2b2bd0(_0x34c20e[_0x3ba2('0x11')](0x1f4,_0x3e5e8f[_0x3ba2('0x13')]));});});};exports[_0x3ba2('0x23')]=function(_0x363b30){var _0x3488df=this;return new Promise(function(_0x47c08c,_0x2e8daf){return db[_0x3ba2('0x16')][_0x3ba2('0x24')](_0x363b30[_0x3ba2('0x25')],{'raw':_0x363b30[_0x3ba2('0x18')]?_0x363b30[_0x3ba2('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x3ba2('0x1f')](function(_0x21e8fe){logger['info'](_0x3ba2('0x23'),_0x363b30);logger[_0x3ba2('0xe')](_0x3ba2('0x23'),_0x363b30,JSON[_0x3ba2('0x10')](_0x21e8fe));_0x47c08c(_0x21e8fe);})[_0x3ba2('0x15')](function(_0x328ead){logger[_0x3ba2('0x11')](_0x3ba2('0x23'),_0x328ead[_0x3ba2('0x13')],_0x363b30);_0x2e8daf(_0x3488df['error'](0x1f4,_0x328ead[_0x3ba2('0x13')]));});});};exports[_0x3ba2('0x26')]=function(_0x5af952){var _0x48c5d3=this;return new Promise(function(_0x4a2783,_0x2e57d9){return db[_0x3ba2('0x16')][_0x3ba2('0x27')](_0x5af952[_0x3ba2('0x25')],{'raw':_0x5af952['options']?_0x5af952['options'][_0x3ba2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5af952['options']?_0x5af952[_0x3ba2('0x18')][_0x3ba2('0x1a')]||null:null,'attributes':_0x5af952['options']?_0x5af952[_0x3ba2('0x18')][_0x3ba2('0x1b')]||null:null,'limit':_0x5af952[_0x3ba2('0x18')]?_0x5af952['options']['limit']||null:null})['then'](function(_0x4bcfcb){logger[_0x3ba2('0x14')]('UpdateCmHopper',_0x5af952);logger['debug'](_0x3ba2('0x26'),_0x5af952,JSON[_0x3ba2('0x10')](_0x4bcfcb));_0x4a2783(_0x4bcfcb);})[_0x3ba2('0x15')](function(_0x4be3c2){logger[_0x3ba2('0x11')](_0x3ba2('0x26'),_0x4be3c2[_0x3ba2('0x13')],_0x5af952);_0x2e57d9(_0x48c5d3[_0x3ba2('0x11')](0x1f4,_0x4be3c2[_0x3ba2('0x13')]));});});};exports['DestroyCmHopper']=function(_0x42e52f){var _0x338378=this;return new Promise(function(_0x24b99f,_0x394aa7){return db[_0x3ba2('0x16')][_0x3ba2('0x28')]({'where':_0x42e52f[_0x3ba2('0x18')]?_0x42e52f[_0x3ba2('0x18')][_0x3ba2('0x1a')]||null:null})[_0x3ba2('0x1f')](function(_0x4157bc){logger[_0x3ba2('0x14')](_0x3ba2('0x29'),_0x42e52f);logger[_0x3ba2('0xe')](_0x3ba2('0x29'),_0x42e52f,JSON['stringify'](_0x4157bc));_0x24b99f(_0x4157bc);})[_0x3ba2('0x15')](function(_0x4682f6){logger[_0x3ba2('0x11')](_0x3ba2('0x29'),_0x4682f6['message'],_0x42e52f);_0x394aa7(_0x338378['error'](0x1f4,_0x4682f6[_0x3ba2('0x13')]));});});};exports[_0x3ba2('0x2a')]=function(_0x5b93b7){var _0x4b8c36=this;return new Promise(function(_0x1e0c81,_0x336314){return db[_0x3ba2('0x2b')][_0x3ba2('0x2c')]()['then'](function(_0x2b0f8c){return db[_0x3ba2('0x2d')][_0x3ba2('0x2e')](function(_0x52bda4){return db[_0x3ba2('0x16')]['findAll']({'where':_0x5b93b7[_0x3ba2('0x18')]?_0x5b93b7[_0x3ba2('0x18')]['where']||null:null,'attributes':_0x5b93b7[_0x3ba2('0x18')]?_0x5b93b7[_0x3ba2('0x18')][_0x3ba2('0x1b')]||null:null,'limit':_0x5b93b7[_0x3ba2('0x18')]?_0x5b93b7['options'][_0x3ba2('0x2f')]||null:null,'order':_0x5b93b7[_0x3ba2('0x18')]?_0x5b93b7[_0x3ba2('0x18')][_0x3ba2('0x30')]||null:null,'transaction':_0x52bda4,'lock':_0x52bda4[_0x3ba2('0x31')][_0x3ba2('0x32')],'include':[{'model':db[_0x3ba2('0x2b')],'as':_0x3ba2('0x33'),'attributes':_[_0x3ba2('0x34')](_0x2b0f8c)},{'model':db[_0x3ba2('0x35')],'as':'Agent','attributes':['id',_0x3ba2('0x36'),_0x3ba2('0x37')]}]})[_0x3ba2('0x1f')](function(_0x29d3bd){var _0x38980a=[];var _0x4d02bf=[];for(var _0x3a4dc5=0x0;_0x3a4dc5<_0x29d3bd[_0x3ba2('0x38')];_0x3a4dc5+=0x1){var _0x5b80a2=_0x29d3bd[_0x3a4dc5][_0x3ba2('0x39')];if(_0x5b80a2===null){_0x38980a[_0x3ba2('0x3a')](_0x29d3bd[_0x3a4dc5][_0x3ba2('0x27')](_0x5b93b7[_0x3ba2('0x25')],{'transaction':_0x52bda4}));}else if(!_0x4d02bf[_0x3ba2('0x3b')](_0x5b80a2)){_0x4d02bf[_0x3ba2('0x3a')](_0x5b80a2);_0x38980a[_0x3ba2('0x3a')](_0x29d3bd[_0x3a4dc5]['update'](_0x5b93b7[_0x3ba2('0x25')],{'transaction':_0x52bda4}));}}return BPromise[_0x3ba2('0x3c')](_0x38980a);});})[_0x3ba2('0x1f')](function(_0x2256ed){logger[_0x3ba2('0x14')](_0x3ba2('0x2a'),_0x5b93b7);logger[_0x3ba2('0xe')](_0x3ba2('0x2a'),_0x5b93b7,JSON[_0x3ba2('0x10')](_0x2256ed));_0x1e0c81(_0x2256ed);})[_0x3ba2('0x15')](function(_0x129d5c){logger[_0x3ba2('0x11')](_0x3ba2('0x2a'),_0x129d5c['message'],_0x5b93b7);_0x336314(_0x4b8c36[_0x3ba2('0x11')](0x1f4,_0x129d5c[_0x3ba2('0x13')]));});});});};exports[_0x3ba2('0x3d')]=function(_0x59432b){var _0x8401e6=this;return new Promise(function(_0xf8e0f6,_0x978f60){return db[_0x3ba2('0x2d')][_0x3ba2('0x2e')](function(_0x3c7e48){return db['CmHopperFinal'][_0x3ba2('0x24')](_0x59432b['body'],{'raw':_0x59432b[_0x3ba2('0x18')]?_0x59432b[_0x3ba2('0x18')][_0x3ba2('0x19')]===undefined?!![]:![]:!![],'transaction':_0x3c7e48})[_0x3ba2('0x1f')](function(){return db[_0x3ba2('0x16')][_0x3ba2('0x28')]({'where':_0x59432b[_0x3ba2('0x18')]?_0x59432b[_0x3ba2('0x18')][_0x3ba2('0x1a')]||null:null,'transaction':_0x3c7e48});});})[_0x3ba2('0x1f')](function(_0x251906){logger['info'](_0x3ba2('0x3d'),_0x59432b);logger[_0x3ba2('0xe')](_0x3ba2('0x3d'),_0x59432b,JSON[_0x3ba2('0x10')](_0x251906));_0xf8e0f6(_0x251906);})['catch'](function(_0x24eaa2){logger[_0x3ba2('0x11')]('MoveContactManagedDialer',_0x24eaa2['message'],_0x59432b);_0x978f60(_0x8401e6[_0x3ba2('0x11')](0x1f4,_0x24eaa2[_0x3ba2('0x13')]));});});};exports[_0x3ba2('0x3e')]=function(_0x198d60){var _0x59dad7=this;return new Promise(function(_0x5c6904,_0x4a5422){return db[_0x3ba2('0x16')][_0x3ba2('0x17')]({'raw':_0x198d60[_0x3ba2('0x18')]?_0x198d60['options'][_0x3ba2('0x19')]===undefined?!![]:![]:!![],'where':_0x198d60['options']?_0x198d60['options'][_0x3ba2('0x1a')]||null:null,'attributes':[[db[_0x3ba2('0x2d')]['fn'](_0x3ba2('0x3f'),db[_0x3ba2('0x2d')]['fn']('IF',db[_0x3ba2('0x2d')][_0x3ba2('0x40')](_0x3ba2('0x41')+util[_0x3ba2('0x42')](_0x3ba2('0x43'),moment()['format'](_0x3ba2('0x44')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})['then'](function(_0x3450be){logger['info'](_0x3ba2('0x3e'),_0x198d60);logger[_0x3ba2('0xe')](_0x3ba2('0x3e'),_0x198d60,JSON[_0x3ba2('0x10')](_0x3450be));_0x5c6904(_0x3450be);})[_0x3ba2('0x15')](function(_0x51bfc4){logger[_0x3ba2('0x11')](_0x3ba2('0x3e'),_0x51bfc4[_0x3ba2('0x13')],_0x198d60);_0x4a5422(_0x59dad7[_0x3ba2('0x11')](0x1f4,_0x51bfc4[_0x3ba2('0x13')]));});});};exports['GetContactRecallMe']=function(_0x31319e){var _0x23cc37=this;return new Promise(function(_0x4be314,_0x432044){return db[_0x3ba2('0x2b')][_0x3ba2('0x2c')]()[_0x3ba2('0x1f')](function(_0x209239){return db[_0x3ba2('0x2d')][_0x3ba2('0x2e')](function(_0x32ba18){return db['CmHopper'][_0x3ba2('0x17')]({'where':_0x31319e[_0x3ba2('0x18')]?_0x31319e[_0x3ba2('0x18')][_0x3ba2('0x1a')]||null:null,'attributes':_0x31319e[_0x3ba2('0x18')]?_0x31319e[_0x3ba2('0x18')][_0x3ba2('0x1b')]||null:null,'limit':0x1,'order':_0x31319e[_0x3ba2('0x18')]?_0x31319e[_0x3ba2('0x18')][_0x3ba2('0x30')]||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x32ba18,'lock':_0x32ba18[_0x3ba2('0x31')][_0x3ba2('0x32')],'include':_0x31319e[_0x3ba2('0x18')]?_0x31319e['options'][_0x3ba2('0x1c')]?_[_0x3ba2('0x1d')](_0x31319e[_0x3ba2('0x18')][_0x3ba2('0x1c')],function(_0x142900){return{'model':db[_0x142900['model']],'as':_0x142900['as'],'attributes':_0x142900['attributes'],'include':_0x142900[_0x3ba2('0x1c')]?_[_0x3ba2('0x1d')](_0x142900[_0x3ba2('0x1c')],function(_0x48bd45){return{'model':db[_0x48bd45[_0x3ba2('0x1e')]],'as':_0x48bd45['as'],'attributes':_0x48bd45[_0x3ba2('0x1b')],'include':_0x48bd45['include']?_['map'](_0x48bd45[_0x3ba2('0x1c')],function(_0x45361b){return{'model':db[_0x45361b['model']],'as':_0x45361b['as'],'attributes':_0x45361b[_0x3ba2('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3497a4){var _0x14f97d=[];for(var _0x5453b1=0x0;_0x5453b1<_0x3497a4[_0x3ba2('0x38')];_0x5453b1+=0x1){_0x14f97d['push'](_0x3497a4[_0x5453b1][_0x3ba2('0x27')](_0x31319e['body'],{'transaction':_0x32ba18}));}return BPromise[_0x3ba2('0x3c')](_0x14f97d);});})[_0x3ba2('0x1f')](function(_0xf625b1){logger['info'](_0x3ba2('0x45'),_0x31319e);logger[_0x3ba2('0xe')](_0x3ba2('0x45'),_0x31319e,JSON[_0x3ba2('0x10')](_0xf625b1));_0x4be314(_0xf625b1);})[_0x3ba2('0x15')](function(_0x39d55a){logger[_0x3ba2('0x11')]('GetContactRecallMe',_0x39d55a[_0x3ba2('0x13')],_0x31319e);_0x432044(_0x23cc37[_0x3ba2('0x11')](0x1f4,_0x39d55a[_0x3ba2('0x13')]));});});});};exports[_0x3ba2('0x46')]=function(_0x5c473b){var _0x279b5f=this;return new Promise(function(_0x5c5c81,_0x1101c2){db['CmContact'][_0x3ba2('0x2c')]()[_0x3ba2('0x1f')](function(_0x535565){return db['CmHopper']['findAll']({'raw':_0x5c473b['options']?_0x5c473b['options'][_0x3ba2('0x19')]===undefined?!![]:![]:!![],'where':_0x5c473b[_0x3ba2('0x18')]?_0x5c473b[_0x3ba2('0x18')]['where']||null:null,'attributes':_0x5c473b['options']?_0x5c473b[_0x3ba2('0x18')][_0x3ba2('0x1b')]||null:null,'limit':_0x5c473b[_0x3ba2('0x18')]?_0x5c473b['options'][_0x3ba2('0x2f')]||null:null,'include':_0x5c473b[_0x3ba2('0x18')]?_0x5c473b[_0x3ba2('0x18')]['include']?_[_0x3ba2('0x1d')](_0x5c473b['options']['include'],function(_0x18204d){return{'model':db[_0x18204d[_0x3ba2('0x1e')]],'as':_0x18204d['as'],'attributes':_0x18204d['as']==='Contact'?_[_0x3ba2('0x34')](_0x535565):_0x18204d[_0x3ba2('0x1b')],'include':_0x18204d['include']?_[_0x3ba2('0x1d')](_0x18204d['include'],function(_0x15127b){return{'model':db[_0x15127b['model']],'as':_0x15127b['as'],'attributes':_0x15127b[_0x3ba2('0x1b')],'include':_0x15127b[_0x3ba2('0x1c')]?_[_0x3ba2('0x1d')](_0x15127b[_0x3ba2('0x1c')],function(_0x53f9d0){return{'model':db[_0x53f9d0[_0x3ba2('0x1e')]],'as':_0x53f9d0['as'],'attributes':_0x53f9d0['attributes']};}):[]};}):[]};}):[]:[]})[_0x3ba2('0x1f')](function(_0x5c8681){logger[_0x3ba2('0x14')](_0x3ba2('0x20'),_0x5c473b);logger[_0x3ba2('0xe')]('GetCmHopper',_0x5c473b,JSON['stringify'](_0x5c8681));_0x5c5c81(_0x5c8681);})[_0x3ba2('0x15')](function(_0x473abc){logger[_0x3ba2('0x11')]('GetCmHopper',_0x473abc['message'],_0x5c473b);_0x1101c2(_0x279b5f[_0x3ba2('0x11')](0x1f4,_0x473abc['message']));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 0a71724..477f47a 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 _0x29be=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','describe','/opencontacts','getOpenContacts','/:id','show','create','post','/preview','getPreview','put','update','destroy','multer','util','connect-timeout','express'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x29be,0xdd));var _0xe29b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x29be[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xe29b('0x0'));var util=require(_0xe29b('0x1'));var path=require('path');var timeout=require(_0xe29b('0x2'));var express=require(_0xe29b('0x3'));var router=express[_0xe29b('0x4')]();var fs_extra=require(_0xe29b('0x5'));var auth=require(_0xe29b('0x6'));var interaction=require(_0xe29b('0x7'));var config=require(_0xe29b('0x8'));var controller=require(_0xe29b('0x9'));router[_0xe29b('0xa')]('/',auth[_0xe29b('0xb')](),controller[_0xe29b('0xc')]);router['get']('/describe',auth[_0xe29b('0xb')](),controller[_0xe29b('0xd')]);router[_0xe29b('0xa')](_0xe29b('0xe'),auth['isAuthenticated'](),controller[_0xe29b('0xf')]);router[_0xe29b('0xa')](_0xe29b('0x10'),auth[_0xe29b('0xb')](),controller[_0xe29b('0x11')]);router['post']('/',auth[_0xe29b('0xb')](),controller[_0xe29b('0x12')]);router[_0xe29b('0x13')](_0xe29b('0x14'),auth['isAuthenticated'](),controller[_0xe29b('0x15')]);router[_0xe29b('0x16')](_0xe29b('0x10'),auth['isAuthenticated'](),controller[_0xe29b('0x17')]);router['delete']('/:id',auth[_0xe29b('0xb')](),controller[_0xe29b('0x18')]);module['exports']=router; \ No newline at end of file +var _0xb5d8=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','isAuthenticated','/describe','describe','getOpenContacts','/:id','show','post','create','/preview','getPreview','put','update','delete','destroy'];(function(_0x230ba4,_0x14f937){var _0x2d872a=function(_0x44459f){while(--_0x44459f){_0x230ba4['push'](_0x230ba4['shift']());}};_0x2d872a(++_0x14f937);}(_0xb5d8,0xd9));var _0x8b5d=function(_0x51da15,_0x265676){_0x51da15=_0x51da15-0x0;var _0x5629e0=_0xb5d8[_0x51da15];return _0x5629e0;};'use strict';var multer=require(_0x8b5d('0x0'));var util=require(_0x8b5d('0x1'));var path=require('path');var timeout=require(_0x8b5d('0x2'));var express=require(_0x8b5d('0x3'));var router=express[_0x8b5d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8b5d('0x5'));var interaction=require(_0x8b5d('0x6'));var config=require(_0x8b5d('0x7'));var controller=require(_0x8b5d('0x8'));router['get']('/',auth[_0x8b5d('0x9')](),controller['index']);router['get'](_0x8b5d('0xa'),auth['isAuthenticated'](),controller[_0x8b5d('0xb')]);router['get']('/opencontacts',auth['isAuthenticated'](),controller[_0x8b5d('0xc')]);router['get'](_0x8b5d('0xd'),auth['isAuthenticated'](),controller[_0x8b5d('0xe')]);router[_0x8b5d('0xf')]('/',auth[_0x8b5d('0x9')](),controller[_0x8b5d('0x10')]);router[_0x8b5d('0xf')](_0x8b5d('0x11'),auth['isAuthenticated'](),controller[_0x8b5d('0x12')]);router[_0x8b5d('0x13')](_0x8b5d('0xd'),auth[_0x8b5d('0x9')](),controller[_0x8b5d('0x14')]);router[_0x8b5d('0x15')](_0x8b5d('0xd'),auth[_0x8b5d('0x9')](),controller[_0x8b5d('0x16')]);module[_0x8b5d('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index c7ee5de..0f7a5b5 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 _0xb35d=['contactListQueue','moment','sequelize','exports','STRING','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb35d,0x14b));var _0xdb35=function(_0x47794f,_0x12c9b3){_0x47794f=_0x47794f-0x0;var _0x2ca51d=_0xb35d[_0x47794f];return _0x2ca51d;};'use strict';var moment=require(_0xdb35('0x0'));var Sequelize=require(_0xdb35('0x1'));module[_0xdb35('0x2')]={'phone':{'type':Sequelize[_0xdb35('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xdb35('0x4')],'unique':_0xdb35('0x5')},'ListId':{'type':Sequelize[_0xdb35('0x4')],'unique':_0xdb35('0x5')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xdb35('0x5')}}; \ No newline at end of file +var _0x4cff=['moment','sequelize','STRING','contactListQueue','INTEGER'];(function(_0x442020,_0x271171){var _0x3d954f=function(_0x4862c2){while(--_0x4862c2){_0x442020['push'](_0x442020['shift']());}};_0x3d954f(++_0x271171);}(_0x4cff,0x14a));var _0xf4cf=function(_0x24ac0a,_0x137a37){_0x24ac0a=_0x24ac0a-0x0;var _0x495692=_0x4cff[_0x24ac0a];return _0x495692;};'use strict';var moment=require(_0xf4cf('0x0'));var Sequelize=require(_0xf4cf('0x1'));module['exports']={'phone':{'type':Sequelize[_0xf4cf('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xf4cf('0x3')},'ListId':{'type':Sequelize[_0xf4cf('0x4')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0xf4cf('0x4')],'unique':_0xf4cf('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 7ac6065..34758cc 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 _0xc935=['jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','apply','reject','destroy','then','error','stack','name','send','map','CmHopperBlack','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc935,0x10a));var _0x5c93=function(_0x3e9341,_0x34e3dc){_0x3e9341=_0x3e9341-0x0;var _0x23bbdb=_0xc935[_0x3e9341];return _0x23bbdb;};'use strict';var emlformat=require(_0x5c93('0x0'));var rimraf=require(_0x5c93('0x1'));var zipdir=require(_0x5c93('0x2'));var jsonpatch=require(_0x5c93('0x3'));var rp=require(_0x5c93('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5c93('0x5'));var util=require(_0x5c93('0x6'));var path=require('path');var sox=require(_0x5c93('0x7'));var csv=require(_0x5c93('0x8'));var ejs=require(_0x5c93('0x9'));var fs=require('fs');var fs_extra=require(_0x5c93('0xa'));var _=require(_0x5c93('0xb'));var squel=require(_0x5c93('0xc'));var crypto=require(_0x5c93('0xd'));var jsforce=require(_0x5c93('0xe'));var deskjs=require(_0x5c93('0xf'));var toCsv=require(_0x5c93('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5c93('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5c93('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5c93('0x12'))(_0x5c93('0x13'));var utils=require(_0x5c93('0x14'));var config=require(_0x5c93('0x15'));var licenseUtil=require(_0x5c93('0x16'));var db=require(_0x5c93('0x17'))['db'];function respondWithStatusCode(_0x135c9a,_0x461da2){_0x461da2=_0x461da2||0xcc;return function(_0x3eb478){if(_0x3eb478){return _0x135c9a[_0x5c93('0x18')](_0x461da2);}return _0x135c9a['status'](_0x461da2)['end']();};}function respondWithResult(_0x1ff8d2,_0x3028fa){_0x3028fa=_0x3028fa||0xc8;return function(_0x579110){if(_0x579110){return _0x1ff8d2[_0x5c93('0x19')](_0x3028fa)[_0x5c93('0x1a')](_0x579110);}};}function respondWithFilteredResult(_0x5d21c9,_0x14e4d6){return function(_0x3a2a19){if(_0x3a2a19){var _0x1d49f4=typeof _0x14e4d6[_0x5c93('0x1b')]===_0x5c93('0x1c')&&typeof _0x14e4d6['limit']==='undefined';var _0x5508ee=_0x3a2a19[_0x5c93('0x1d')];var _0x3e5117=_0x1d49f4?0x0:_0x14e4d6[_0x5c93('0x1b')];var _0x258ee7=_0x1d49f4?_0x3a2a19['count']:_0x14e4d6['offset']+_0x14e4d6[_0x5c93('0x1e')];var _0x1b7cf8;if(_0x258ee7>=_0x5508ee){_0x258ee7=_0x5508ee;_0x1b7cf8=0xc8;}else{_0x1b7cf8=0xce;}_0x5d21c9[_0x5c93('0x19')](_0x1b7cf8);return _0x5d21c9['set']('Content-Range',_0x3e5117+'-'+_0x258ee7+'/'+_0x5508ee)[_0x5c93('0x1a')](_0x3a2a19);}return null;};}function patchUpdates(_0x3ba2d1){return function(_0x431041){try{jsonpatch[_0x5c93('0x1f')](_0x431041,_0x3ba2d1,!![]);}catch(_0xce1807){return BPromise[_0x5c93('0x20')](_0xce1807);}return _0x431041['save']();};}function saveUpdates(_0x508a2f,_0x399082){return function(_0x52e9e5){if(_0x52e9e5){return _0x52e9e5['update'](_0x508a2f)['then'](function(_0x35200f){return _0x35200f;});}return null;};}function removeEntity(_0x4e69ca,_0x24aac5){return function(_0x209607){if(_0x209607){return _0x209607[_0x5c93('0x21')]()[_0x5c93('0x22')](function(){_0x4e69ca[_0x5c93('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27c80c,_0x5be8e0){return function(_0x43d1f2){if(!_0x43d1f2){_0x27c80c[_0x5c93('0x18')](0x194);}return _0x43d1f2;};}function handleError(_0x37679b,_0x181176){_0x181176=_0x181176||0x1f4;return function(_0x320735){logger[_0x5c93('0x23')](_0x320735[_0x5c93('0x24')]);if(_0x320735['name']){delete _0x320735[_0x5c93('0x25')];}_0x37679b[_0x5c93('0x19')](_0x181176)[_0x5c93('0x26')](_0x320735);};}exports['index']=function(_0x47eb87,_0x38e545){var _0x47ab32={},_0x31d024={},_0x3d0cc8={'count':0x0,'rows':[]};var _0x15034f=_[_0x5c93('0x27')](db[_0x5c93('0x28')][_0x5c93('0x29')],function(_0x195c52){return{'name':_0x195c52['fieldName'],'type':_0x195c52[_0x5c93('0x2a')][_0x5c93('0x2b')]};});_0x31d024['model']=_[_0x5c93('0x27')](_0x15034f,_0x5c93('0x25'));_0x31d024[_0x5c93('0x2c')]=_[_0x5c93('0x2d')](_0x47eb87['query']);_0x31d024[_0x5c93('0x2e')]=_['intersection'](_0x31d024[_0x5c93('0x2f')],_0x31d024[_0x5c93('0x2c')]);_0x47ab32[_0x5c93('0x30')]=_[_0x5c93('0x31')](_0x31d024[_0x5c93('0x2f')],qs[_0x5c93('0x32')](_0x47eb87[_0x5c93('0x2c')][_0x5c93('0x32')]));_0x47ab32['attributes']=_0x47ab32[_0x5c93('0x30')][_0x5c93('0x33')]?_0x47ab32[_0x5c93('0x30')]:_0x31d024[_0x5c93('0x2f')];if(!_0x47eb87[_0x5c93('0x2c')][_0x5c93('0x34')](_0x5c93('0x35'))){_0x47ab32[_0x5c93('0x1e')]=qs[_0x5c93('0x1e')](_0x47eb87[_0x5c93('0x2c')][_0x5c93('0x1e')]);_0x47ab32[_0x5c93('0x1b')]=qs['offset'](_0x47eb87[_0x5c93('0x2c')][_0x5c93('0x1b')]);}_0x47ab32[_0x5c93('0x36')]=qs[_0x5c93('0x37')](_0x47eb87[_0x5c93('0x2c')][_0x5c93('0x37')]);_0x47ab32[_0x5c93('0x38')]=qs['filters'](_['pick'](_0x47eb87['query'],_0x31d024['filters']),_0x15034f);if(_0x47eb87['query'][_0x5c93('0x39')]){_0x47ab32[_0x5c93('0x38')]=_[_0x5c93('0x3a')](_0x47ab32[_0x5c93('0x38')],{'$or':_[_0x5c93('0x27')](_0x15034f,function(_0x320445){if(_0x320445['type']!==_0x5c93('0x3b')){var _0x42d594={};_0x42d594[_0x320445['name']]={'$like':'%'+_0x47eb87['query'][_0x5c93('0x39')]+'%'};return _0x42d594;}})});}_0x47ab32=_[_0x5c93('0x3a')]({},_0x47ab32,_0x47eb87[_0x5c93('0x3c')]);var _0x4f3e88={'where':_0x47ab32[_0x5c93('0x38')]};return db[_0x5c93('0x28')][_0x5c93('0x1d')](_0x4f3e88)[_0x5c93('0x22')](function(_0x217ecf){_0x3d0cc8[_0x5c93('0x1d')]=_0x217ecf;if(_0x47eb87[_0x5c93('0x2c')][_0x5c93('0x3d')]){_0x47ab32[_0x5c93('0x3e')]=[{'all':!![]}];}return db[_0x5c93('0x28')][_0x5c93('0x3f')](_0x47ab32);})[_0x5c93('0x22')](function(_0x40c104){_0x3d0cc8[_0x5c93('0x40')]=_0x40c104;return _0x3d0cc8;})[_0x5c93('0x22')](respondWithFilteredResult(_0x38e545,_0x47ab32))[_0x5c93('0x41')](handleError(_0x38e545,null));};exports['show']=function(_0x4b29bc,_0x3320b9){var _0x3d7a53={'raw':!![],'where':{'id':_0x4b29bc[_0x5c93('0x42')]['id']}},_0x6ea1f8={};_0x6ea1f8[_0x5c93('0x2f')]=_[_0x5c93('0x2d')](db['CmHopperBlack'][_0x5c93('0x29')]);_0x6ea1f8['query']=_[_0x5c93('0x2d')](_0x4b29bc['query']);_0x6ea1f8['filters']=_['intersection'](_0x6ea1f8[_0x5c93('0x2f')],_0x6ea1f8[_0x5c93('0x2c')]);_0x3d7a53[_0x5c93('0x30')]=_['intersection'](_0x6ea1f8[_0x5c93('0x2f')],qs['fields'](_0x4b29bc['query'][_0x5c93('0x32')]));_0x3d7a53[_0x5c93('0x30')]=_0x3d7a53[_0x5c93('0x30')]['length']?_0x3d7a53['attributes']:_0x6ea1f8[_0x5c93('0x2f')];if(_0x4b29bc[_0x5c93('0x2c')][_0x5c93('0x3d')]){_0x3d7a53[_0x5c93('0x3e')]=[{'all':!![]}];}_0x3d7a53=_[_0x5c93('0x3a')]({},_0x3d7a53,_0x4b29bc[_0x5c93('0x3c')]);return db['CmHopperBlack'][_0x5c93('0x43')](_0x3d7a53)['then'](handleEntityNotFound(_0x3320b9,null))['then'](respondWithResult(_0x3320b9,null))[_0x5c93('0x41')](handleError(_0x3320b9,null));};exports['update']=function(_0x4aeec2,_0x5cdda0){if(_0x4aeec2[_0x5c93('0x44')]['id']){delete _0x4aeec2['body']['id'];}return db[_0x5c93('0x28')][_0x5c93('0x43')]({'where':{'id':_0x4aeec2['params']['id']}})[_0x5c93('0x22')](handleEntityNotFound(_0x5cdda0,null))['then'](saveUpdates(_0x4aeec2[_0x5c93('0x44')],null))[_0x5c93('0x22')](respondWithResult(_0x5cdda0,null))[_0x5c93('0x41')](handleError(_0x5cdda0,null));};exports[_0x5c93('0x21')]=function(_0x5a0cd6,_0x45b9ab){return db[_0x5c93('0x28')]['find']({'where':{'id':_0x5a0cd6['params']['id']}})[_0x5c93('0x22')](handleEntityNotFound(_0x45b9ab,null))[_0x5c93('0x22')](removeEntity(_0x45b9ab,null))[_0x5c93('0x41')](handleError(_0x45b9ab,null));};exports[_0x5c93('0x45')]=function(_0x537478,_0x1e71dd){return db[_0x5c93('0x28')][_0x5c93('0x45')]()[_0x5c93('0x22')](respondWithResult(_0x1e71dd,null))[_0x5c93('0x41')](handleError(_0x1e71dd,null));}; \ No newline at end of file +var _0xa5ad=['fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','reject','save','then','destroy','error','name','send','index','CmHopperBlack','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','length','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs'];(function(_0x41cf69,_0x15a021){var _0x2d5890=function(_0xa3f0c0){while(--_0xa3f0c0){_0x41cf69['push'](_0x41cf69['shift']());}};_0x2d5890(++_0x15a021);}(_0xa5ad,0x1ab));var _0xda5a=function(_0x500f5d,_0x5433a3){_0x500f5d=_0x500f5d-0x0;var _0x1f7498=_0xa5ad[_0x500f5d];return _0x1f7498;};'use strict';var emlformat=require(_0xda5a('0x0'));var rimraf=require(_0xda5a('0x1'));var zipdir=require(_0xda5a('0x2'));var jsonpatch=require(_0xda5a('0x3'));var rp=require(_0xda5a('0x4'));var moment=require('moment');var BPromise=require(_0xda5a('0x5'));var Mustache=require('mustache');var util=require(_0xda5a('0x6'));var path=require(_0xda5a('0x7'));var sox=require(_0xda5a('0x8'));var csv=require(_0xda5a('0x9'));var ejs=require(_0xda5a('0xa'));var fs=require('fs');var fs_extra=require(_0xda5a('0xb'));var _=require(_0xda5a('0xc'));var squel=require(_0xda5a('0xd'));var crypto=require(_0xda5a('0xe'));var jsforce=require(_0xda5a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xda5a('0x9'));var querystring=require('querystring');var Papa=require(_0xda5a('0x10'));var Redis=require('ioredis');var authService=require(_0xda5a('0x11'));var qs=require(_0xda5a('0x12'));var as=require(_0xda5a('0x13'));var hardwareService=require(_0xda5a('0x14'));var logger=require(_0xda5a('0x15'))(_0xda5a('0x16'));var utils=require(_0xda5a('0x17'));var config=require(_0xda5a('0x18'));var licenseUtil=require(_0xda5a('0x19'));var db=require(_0xda5a('0x1a'))['db'];function respondWithStatusCode(_0xa12d33,_0x1ee81a){_0x1ee81a=_0x1ee81a||0xcc;return function(_0x519473){if(_0x519473){return _0xa12d33[_0xda5a('0x1b')](_0x1ee81a);}return _0xa12d33[_0xda5a('0x1c')](_0x1ee81a)[_0xda5a('0x1d')]();};}function respondWithResult(_0x50e5c0,_0x12bc13){_0x12bc13=_0x12bc13||0xc8;return function(_0x2fa134){if(_0x2fa134){return _0x50e5c0[_0xda5a('0x1c')](_0x12bc13)[_0xda5a('0x1e')](_0x2fa134);}};}function respondWithFilteredResult(_0x16a252,_0x104f2f){return function(_0x570c3e){if(_0x570c3e){var _0x396afa=typeof _0x104f2f[_0xda5a('0x1f')]===_0xda5a('0x20')&&typeof _0x104f2f['limit']==='undefined';var _0x5c2273=_0x570c3e['count'];var _0x182839=_0x396afa?0x0:_0x104f2f[_0xda5a('0x1f')];var _0x247a6a=_0x396afa?_0x570c3e[_0xda5a('0x21')]:_0x104f2f[_0xda5a('0x1f')]+_0x104f2f[_0xda5a('0x22')];var _0x2bba69;if(_0x247a6a>=_0x5c2273){_0x247a6a=_0x5c2273;_0x2bba69=0xc8;}else{_0x2bba69=0xce;}_0x16a252[_0xda5a('0x1c')](_0x2bba69);return _0x16a252['set']('Content-Range',_0x182839+'-'+_0x247a6a+'/'+_0x5c2273)[_0xda5a('0x1e')](_0x570c3e);}return null;};}function patchUpdates(_0x81800c){return function(_0x134b75){try{jsonpatch['apply'](_0x134b75,_0x81800c,!![]);}catch(_0x54c63d){return BPromise[_0xda5a('0x23')](_0x54c63d);}return _0x134b75[_0xda5a('0x24')]();};}function saveUpdates(_0x576b74,_0x49c895){return function(_0x2337f9){if(_0x2337f9){return _0x2337f9['update'](_0x576b74)[_0xda5a('0x25')](function(_0xf98e8d){return _0xf98e8d;});}return null;};}function removeEntity(_0x54f72e,_0x365b91){return function(_0x291427){if(_0x291427){return _0x291427[_0xda5a('0x26')]()[_0xda5a('0x25')](function(){_0x54f72e[_0xda5a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f5edd,_0x46dbab){return function(_0x381226){if(!_0x381226){_0x3f5edd[_0xda5a('0x1b')](0x194);}return _0x381226;};}function handleError(_0x1722ea,_0x406937){_0x406937=_0x406937||0x1f4;return function(_0x3f0d77){logger[_0xda5a('0x27')](_0x3f0d77['stack']);if(_0x3f0d77[_0xda5a('0x28')]){delete _0x3f0d77[_0xda5a('0x28')];}_0x1722ea[_0xda5a('0x1c')](_0x406937)[_0xda5a('0x29')](_0x3f0d77);};}exports[_0xda5a('0x2a')]=function(_0xbe9e82,_0x245eaf){var _0x3f8dd3={},_0x2fcb03={},_0x3a3c00={'count':0x0,'rows':[]};var _0x397ac0=_['map'](db[_0xda5a('0x2b')]['rawAttributes'],function(_0x457dc1){return{'name':_0x457dc1[_0xda5a('0x2c')],'type':_0x457dc1['type'][_0xda5a('0x2d')]};});_0x2fcb03[_0xda5a('0x2e')]=_[_0xda5a('0x2f')](_0x397ac0,'name');_0x2fcb03[_0xda5a('0x30')]=_[_0xda5a('0x31')](_0xbe9e82[_0xda5a('0x30')]);_0x2fcb03[_0xda5a('0x32')]=_['intersection'](_0x2fcb03[_0xda5a('0x2e')],_0x2fcb03[_0xda5a('0x30')]);_0x3f8dd3[_0xda5a('0x33')]=_[_0xda5a('0x34')](_0x2fcb03[_0xda5a('0x2e')],qs[_0xda5a('0x35')](_0xbe9e82[_0xda5a('0x30')][_0xda5a('0x35')]));_0x3f8dd3[_0xda5a('0x33')]=_0x3f8dd3[_0xda5a('0x33')]['length']?_0x3f8dd3[_0xda5a('0x33')]:_0x2fcb03[_0xda5a('0x2e')];if(!_0xbe9e82[_0xda5a('0x30')][_0xda5a('0x36')]('nolimit')){_0x3f8dd3['limit']=qs[_0xda5a('0x22')](_0xbe9e82[_0xda5a('0x30')][_0xda5a('0x22')]);_0x3f8dd3[_0xda5a('0x1f')]=qs[_0xda5a('0x1f')](_0xbe9e82['query'][_0xda5a('0x1f')]);}_0x3f8dd3['order']=qs['sort'](_0xbe9e82['query'][_0xda5a('0x37')]);_0x3f8dd3[_0xda5a('0x38')]=qs[_0xda5a('0x32')](_[_0xda5a('0x39')](_0xbe9e82[_0xda5a('0x30')],_0x2fcb03[_0xda5a('0x32')]),_0x397ac0);if(_0xbe9e82[_0xda5a('0x30')][_0xda5a('0x3a')]){_0x3f8dd3[_0xda5a('0x38')]=_[_0xda5a('0x3b')](_0x3f8dd3['where'],{'$or':_[_0xda5a('0x2f')](_0x397ac0,function(_0x4a9206){if(_0x4a9206['type']!==_0xda5a('0x3c')){var _0x4b62e8={};_0x4b62e8[_0x4a9206[_0xda5a('0x28')]]={'$like':'%'+_0xbe9e82[_0xda5a('0x30')][_0xda5a('0x3a')]+'%'};return _0x4b62e8;}})});}_0x3f8dd3=_[_0xda5a('0x3b')]({},_0x3f8dd3,_0xbe9e82[_0xda5a('0x3d')]);var _0x5b9813={'where':_0x3f8dd3['where']};return db[_0xda5a('0x2b')][_0xda5a('0x21')](_0x5b9813)[_0xda5a('0x25')](function(_0x41d00f){_0x3a3c00[_0xda5a('0x21')]=_0x41d00f;if(_0xbe9e82[_0xda5a('0x30')][_0xda5a('0x3e')]){_0x3f8dd3[_0xda5a('0x3f')]=[{'all':!![]}];}return db[_0xda5a('0x2b')][_0xda5a('0x40')](_0x3f8dd3);})[_0xda5a('0x25')](function(_0x851b61){_0x3a3c00['rows']=_0x851b61;return _0x3a3c00;})['then'](respondWithFilteredResult(_0x245eaf,_0x3f8dd3))[_0xda5a('0x41')](handleError(_0x245eaf,null));};exports[_0xda5a('0x42')]=function(_0x1ec119,_0x47d36e){var _0x2c0ecc={'raw':!![],'where':{'id':_0x1ec119[_0xda5a('0x43')]['id']}},_0x27669f={};_0x27669f[_0xda5a('0x2e')]=_[_0xda5a('0x31')](db[_0xda5a('0x2b')][_0xda5a('0x44')]);_0x27669f[_0xda5a('0x30')]=_[_0xda5a('0x31')](_0x1ec119['query']);_0x27669f[_0xda5a('0x32')]=_[_0xda5a('0x34')](_0x27669f[_0xda5a('0x2e')],_0x27669f[_0xda5a('0x30')]);_0x2c0ecc[_0xda5a('0x33')]=_[_0xda5a('0x34')](_0x27669f[_0xda5a('0x2e')],qs[_0xda5a('0x35')](_0x1ec119[_0xda5a('0x30')][_0xda5a('0x35')]));_0x2c0ecc['attributes']=_0x2c0ecc[_0xda5a('0x33')][_0xda5a('0x45')]?_0x2c0ecc[_0xda5a('0x33')]:_0x27669f['model'];if(_0x1ec119[_0xda5a('0x30')][_0xda5a('0x3e')]){_0x2c0ecc[_0xda5a('0x3f')]=[{'all':!![]}];}_0x2c0ecc=_[_0xda5a('0x3b')]({},_0x2c0ecc,_0x1ec119['options']);return db['CmHopperBlack'][_0xda5a('0x46')](_0x2c0ecc)[_0xda5a('0x25')](handleEntityNotFound(_0x47d36e,null))[_0xda5a('0x25')](respondWithResult(_0x47d36e,null))['catch'](handleError(_0x47d36e,null));};exports['update']=function(_0x2f61fd,_0x577e33){if(_0x2f61fd[_0xda5a('0x47')]['id']){delete _0x2f61fd['body']['id'];}return db[_0xda5a('0x2b')][_0xda5a('0x46')]({'where':{'id':_0x2f61fd[_0xda5a('0x43')]['id']}})[_0xda5a('0x25')](handleEntityNotFound(_0x577e33,null))[_0xda5a('0x25')](saveUpdates(_0x2f61fd[_0xda5a('0x47')],null))[_0xda5a('0x25')](respondWithResult(_0x577e33,null))[_0xda5a('0x41')](handleError(_0x577e33,null));};exports[_0xda5a('0x26')]=function(_0x1ceba3,_0x166261){return db[_0xda5a('0x2b')][_0xda5a('0x46')]({'where':{'id':_0x1ceba3[_0xda5a('0x43')]['id']}})[_0xda5a('0x25')](handleEntityNotFound(_0x166261,null))['then'](removeEntity(_0x166261,null))[_0xda5a('0x41')](handleError(_0x166261,null));};exports['describe']=function(_0x14bc4a,_0xbdda3b){return db[_0xda5a('0x2b')][_0xda5a('0x48')]()[_0xda5a('0x25')](respondWithResult(_0xbdda3b,null))[_0xda5a('0x41')](handleError(_0xbdda3b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index f86781b..48e19a5 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 _0x7098=['../../config/logger','moment','bluebird','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','CmHopperBlack','cm_hopper_black','lodash'];(function(_0x3ea136,_0x300c41){var _0x49f36d=function(_0x524220){while(--_0x524220){_0x3ea136['push'](_0x3ea136['shift']());}};_0x49f36d(++_0x300c41);}(_0x7098,0x171));var _0x8709=function(_0x30e8f5,_0x1c0007){_0x30e8f5=_0x30e8f5-0x0;var _0x468a11=_0x7098[_0x30e8f5];return _0x468a11;};'use strict';var _=require(_0x8709('0x0'));var util=require('util');var logger=require(_0x8709('0x1'))('api');var moment=require(_0x8709('0x2'));var BPromise=require(_0x8709('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8709('0x4'));var config=require(_0x8709('0x5'));var attributes=require(_0x8709('0x6'));module[_0x8709('0x7')]=function(_0x1eb4db,_0x226094){return _0x1eb4db['define'](_0x8709('0x8'),attributes,{'tableName':_0x8709('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b2e=['exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x9b2e,0x7c));var _0xe9b2=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9b2e[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xe9b2('0x0'));var util=require(_0xe9b2('0x1'));var logger=require(_0xe9b2('0x2'))(_0xe9b2('0x3'));var moment=require(_0xe9b2('0x4'));var BPromise=require(_0xe9b2('0x5'));var rp=require(_0xe9b2('0x6'));var fs=require('fs');var path=require(_0xe9b2('0x7'));var rimraf=require(_0xe9b2('0x8'));var config=require(_0xe9b2('0x9'));var attributes=require(_0xe9b2('0xa'));module[_0xe9b2('0xb')]=function(_0x13c6e1,_0x23f03e){return _0x13c6e1[_0xe9b2('0xc')](_0xe9b2('0xd'),attributes,{'tableName':_0xe9b2('0xe'),'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 636a77f..01b838d 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 _0x2547=['attributes','limit','map','include','model','debug','stringify','UpdateCmHopperBlack','update','body','raw','DestroyCmHopperBlack','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','where'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x2547,0xc5));var _0x7254=function(_0x5a55ba,_0x5cb7e6){_0x5a55ba=_0x5a55ba-0x0;var _0x4c1f2d=_0x2547[_0x5a55ba];return _0x4c1f2d;};'use strict';var _=require(_0x7254('0x0'));var util=require(_0x7254('0x1'));var moment=require('moment');var BPromise=require(_0x7254('0x2'));var rs=require(_0x7254('0x3'));var fs=require('fs');var Redis=require(_0x7254('0x4'));var db=require(_0x7254('0x5'))['db'];var utils=require(_0x7254('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x7254('0x7'));var jayson=require(_0x7254('0x8'));var client=jayson[_0x7254('0x9')][_0x7254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53e159,_0x2ecdbb,_0x3a21ad){return new BPromise(function(_0x12b17d,_0x1b8a4e){return client[_0x7254('0xb')](_0x53e159,_0x3a21ad)[_0x7254('0xc')](function(_0xca1474){logger[_0x7254('0xd')](_0x7254('0xe'),_0x2ecdbb,'request\x20sent');logger['debug'](_0x7254('0xf'),_0x2ecdbb,'request\x20sent',JSON['stringify'](_0xca1474));if(_0xca1474[_0x7254('0x10')]){if(_0xca1474[_0x7254('0x10')]['code']===0x1f4){logger[_0x7254('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x2ecdbb,_0xca1474[_0x7254('0x10')][_0x7254('0x11')]);return _0x1b8a4e(_0xca1474[_0x7254('0x10')][_0x7254('0x11')]);}logger[_0x7254('0x10')](_0x7254('0xe'),_0x2ecdbb,_0xca1474[_0x7254('0x10')][_0x7254('0x11')]);return _0x12b17d(_0xca1474['error'][_0x7254('0x11')]);}else{logger[_0x7254('0xd')](_0x7254('0xe'),_0x2ecdbb,'request\x20sent');_0x12b17d(_0xca1474[_0x7254('0x12')][_0x7254('0x11')]);}})[_0x7254('0x13')](function(_0x1cfc05){logger[_0x7254('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x2ecdbb,_0x1cfc05);_0x1b8a4e(_0x1cfc05);});});}exports[_0x7254('0x14')]=function(_0x311444){var _0x154c9b=this;return new Promise(function(_0x410ce1,_0x575e4){return db[_0x7254('0x15')][_0x7254('0x16')]({'raw':_0x311444[_0x7254('0x17')]?_0x311444[_0x7254('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x311444[_0x7254('0x17')]?_0x311444[_0x7254('0x17')][_0x7254('0x18')]||null:null,'attributes':_0x311444['options']?_0x311444['options'][_0x7254('0x19')]||null:null,'limit':_0x311444[_0x7254('0x17')]?_0x311444[_0x7254('0x17')][_0x7254('0x1a')]||null:null,'include':_0x311444[_0x7254('0x17')]?_0x311444[_0x7254('0x17')]['include']?_[_0x7254('0x1b')](_0x311444['options'][_0x7254('0x1c')],function(_0x1d4f64){return{'model':db[_0x1d4f64[_0x7254('0x1d')]],'as':_0x1d4f64['as'],'attributes':_0x1d4f64[_0x7254('0x19')],'include':_0x1d4f64['include']?_[_0x7254('0x1b')](_0x1d4f64['include'],function(_0x429ff7){return{'model':db[_0x429ff7[_0x7254('0x1d')]],'as':_0x429ff7['as'],'attributes':_0x429ff7[_0x7254('0x19')],'include':_0x429ff7['include']?_[_0x7254('0x1b')](_0x429ff7[_0x7254('0x1c')],function(_0x3fd2ce){return{'model':db[_0x3fd2ce[_0x7254('0x1d')]],'as':_0x3fd2ce['as'],'attributes':_0x3fd2ce[_0x7254('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7254('0xc')](function(_0x1f0be0){logger['info']('GetCmHopperBlack',_0x311444);logger[_0x7254('0x1e')](_0x7254('0x14'),_0x311444,JSON[_0x7254('0x1f')](_0x1f0be0));_0x410ce1(_0x1f0be0);})[_0x7254('0x13')](function(_0xc80b9f){logger['error'](_0x7254('0x14'),_0xc80b9f[_0x7254('0x11')],_0x311444);_0x575e4(_0x154c9b[_0x7254('0x10')](0x1f4,_0xc80b9f[_0x7254('0x11')]));});});};exports[_0x7254('0x20')]=function(_0x87a7fa){var _0x4af5ad=this;return new Promise(function(_0x35bd5e,_0x248226){return db['CmHopperBlack'][_0x7254('0x21')](_0x87a7fa[_0x7254('0x22')],{'raw':_0x87a7fa[_0x7254('0x17')]?_0x87a7fa[_0x7254('0x17')][_0x7254('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x87a7fa['options']?_0x87a7fa[_0x7254('0x17')]['where']||null:null,'attributes':_0x87a7fa[_0x7254('0x17')]?_0x87a7fa[_0x7254('0x17')]['attributes']||null:null,'limit':_0x87a7fa['options']?_0x87a7fa[_0x7254('0x17')][_0x7254('0x1a')]||null:null})['then'](function(_0x2e6da9){logger[_0x7254('0xd')](_0x7254('0x20'),_0x87a7fa);logger[_0x7254('0x1e')](_0x7254('0x20'),_0x87a7fa,JSON[_0x7254('0x1f')](_0x2e6da9));_0x35bd5e(_0x2e6da9);})[_0x7254('0x13')](function(_0x4696ab){logger['error']('UpdateCmHopperBlack',_0x4696ab['message'],_0x87a7fa);_0x248226(_0x4af5ad[_0x7254('0x10')](0x1f4,_0x4696ab['message']));});});};exports[_0x7254('0x24')]=function(_0x2575f0){var _0x14c7ce=this;return new Promise(function(_0x2b6653,_0x1d7b8c){return db[_0x7254('0x15')]['destroy']({'where':_0x2575f0[_0x7254('0x17')]?_0x2575f0[_0x7254('0x17')][_0x7254('0x18')]||null:null})[_0x7254('0xc')](function(_0x227b52){logger[_0x7254('0xd')](_0x7254('0x24'),_0x2575f0);logger[_0x7254('0x1e')](_0x7254('0x24'),_0x2575f0,JSON['stringify'](_0x227b52));_0x2b6653(_0x227b52);})[_0x7254('0x13')](function(_0x15be06){logger[_0x7254('0x10')](_0x7254('0x24'),_0x15be06['message'],_0x2575f0);_0x1d7b8c(_0x14c7ce[_0x7254('0x10')](0x1f4,_0x15be06['message']));});});}; \ No newline at end of file +var _0xfdf1=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','UpdateCmHopperBlack','CmHopperBlack','update','DestroyCmHopperBlack','stringify','lodash','util','moment'];(function(_0x3a376f,_0x4694fb){var _0x2cc9ae=function(_0x3efd74){while(--_0x3efd74){_0x3a376f['push'](_0x3a376f['shift']());}};_0x2cc9ae(++_0x4694fb);}(_0xfdf1,0x16f));var _0x1fdf=function(_0x2ab154,_0x45d19d){_0x2ab154=_0x2ab154-0x0;var _0xe8afe3=_0xfdf1[_0x2ab154];return _0xe8afe3;};'use strict';var _=require(_0x1fdf('0x0'));var util=require(_0x1fdf('0x1'));var moment=require(_0x1fdf('0x2'));var BPromise=require(_0x1fdf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fdf('0x4'));var db=require(_0x1fdf('0x5'))['db'];var utils=require(_0x1fdf('0x6'));var logger=require(_0x1fdf('0x7'))('rpc');var config=require(_0x1fdf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1fdf('0x9')][_0x1fdf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a5b3f,_0x1d60be,_0x259bad){return new BPromise(function(_0x38d6ca,_0x4bed11){return client['request'](_0x5a5b3f,_0x259bad)[_0x1fdf('0xb')](function(_0x379ac7){logger[_0x1fdf('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x1d60be,_0x1fdf('0xd'));logger[_0x1fdf('0xe')](_0x1fdf('0xf'),_0x1d60be,_0x1fdf('0xd'),JSON['stringify'](_0x379ac7));if(_0x379ac7[_0x1fdf('0x10')]){if(_0x379ac7[_0x1fdf('0x10')][_0x1fdf('0x11')]===0x1f4){logger[_0x1fdf('0x10')](_0x1fdf('0x12'),_0x1d60be,_0x379ac7[_0x1fdf('0x10')][_0x1fdf('0x13')]);return _0x4bed11(_0x379ac7['error'][_0x1fdf('0x13')]);}logger[_0x1fdf('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x1d60be,_0x379ac7[_0x1fdf('0x10')][_0x1fdf('0x13')]);return _0x38d6ca(_0x379ac7[_0x1fdf('0x10')][_0x1fdf('0x13')]);}else{logger[_0x1fdf('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x1d60be,_0x1fdf('0xd'));_0x38d6ca(_0x379ac7[_0x1fdf('0x14')][_0x1fdf('0x13')]);}})[_0x1fdf('0x15')](function(_0x30c441){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x1d60be,_0x30c441);_0x4bed11(_0x30c441);});});}exports[_0x1fdf('0x16')]=function(_0xcde756){var _0x5711a6=this;return new Promise(function(_0x3a08d3,_0x219000){return db['CmHopperBlack'][_0x1fdf('0x17')]({'raw':_0xcde756[_0x1fdf('0x18')]?_0xcde756[_0x1fdf('0x18')][_0x1fdf('0x19')]===undefined?!![]:![]:!![],'where':_0xcde756[_0x1fdf('0x18')]?_0xcde756[_0x1fdf('0x18')][_0x1fdf('0x1a')]||null:null,'attributes':_0xcde756['options']?_0xcde756[_0x1fdf('0x18')][_0x1fdf('0x1b')]||null:null,'limit':_0xcde756[_0x1fdf('0x18')]?_0xcde756['options'][_0x1fdf('0x1c')]||null:null,'include':_0xcde756[_0x1fdf('0x18')]?_0xcde756[_0x1fdf('0x18')][_0x1fdf('0x1d')]?_[_0x1fdf('0x1e')](_0xcde756[_0x1fdf('0x18')][_0x1fdf('0x1d')],function(_0x286411){return{'model':db[_0x286411[_0x1fdf('0x1f')]],'as':_0x286411['as'],'attributes':_0x286411[_0x1fdf('0x1b')],'include':_0x286411[_0x1fdf('0x1d')]?_['map'](_0x286411['include'],function(_0x27c060){return{'model':db[_0x27c060[_0x1fdf('0x1f')]],'as':_0x27c060['as'],'attributes':_0x27c060['attributes'],'include':_0x27c060['include']?_[_0x1fdf('0x1e')](_0x27c060[_0x1fdf('0x1d')],function(_0x2c1184){return{'model':db[_0x2c1184[_0x1fdf('0x1f')]],'as':_0x2c1184['as'],'attributes':_0x2c1184[_0x1fdf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1fdf('0xb')](function(_0x362b7e){logger[_0x1fdf('0xc')](_0x1fdf('0x16'),_0xcde756);logger[_0x1fdf('0xe')](_0x1fdf('0x16'),_0xcde756,JSON['stringify'](_0x362b7e));_0x3a08d3(_0x362b7e);})[_0x1fdf('0x15')](function(_0x136142){logger[_0x1fdf('0x10')]('GetCmHopperBlack',_0x136142[_0x1fdf('0x13')],_0xcde756);_0x219000(_0x5711a6[_0x1fdf('0x10')](0x1f4,_0x136142['message']));});});};exports[_0x1fdf('0x20')]=function(_0x1225ca){var _0x44d7c1=this;return new Promise(function(_0x1f5327,_0x5d28d2){return db[_0x1fdf('0x21')][_0x1fdf('0x22')](_0x1225ca['body'],{'raw':_0x1225ca[_0x1fdf('0x18')]?_0x1225ca[_0x1fdf('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1225ca['options']?_0x1225ca[_0x1fdf('0x18')][_0x1fdf('0x1a')]||null:null,'attributes':_0x1225ca[_0x1fdf('0x18')]?_0x1225ca[_0x1fdf('0x18')][_0x1fdf('0x1b')]||null:null,'limit':_0x1225ca[_0x1fdf('0x18')]?_0x1225ca[_0x1fdf('0x18')]['limit']||null:null})[_0x1fdf('0xb')](function(_0x58c36b){logger[_0x1fdf('0xc')](_0x1fdf('0x20'),_0x1225ca);logger[_0x1fdf('0xe')](_0x1fdf('0x20'),_0x1225ca,JSON['stringify'](_0x58c36b));_0x1f5327(_0x58c36b);})['catch'](function(_0x575ffe){logger[_0x1fdf('0x10')]('UpdateCmHopperBlack',_0x575ffe[_0x1fdf('0x13')],_0x1225ca);_0x5d28d2(_0x44d7c1[_0x1fdf('0x10')](0x1f4,_0x575ffe[_0x1fdf('0x13')]));});});};exports[_0x1fdf('0x23')]=function(_0xa89393){var _0x51d845=this;return new Promise(function(_0x2b933b,_0x56b9b9){return db[_0x1fdf('0x21')]['destroy']({'where':_0xa89393[_0x1fdf('0x18')]?_0xa89393[_0x1fdf('0x18')][_0x1fdf('0x1a')]||null:null})['then'](function(_0xdacad3){logger[_0x1fdf('0xc')]('DestroyCmHopperBlack',_0xa89393);logger[_0x1fdf('0xe')](_0x1fdf('0x23'),_0xa89393,JSON[_0x1fdf('0x24')](_0xdacad3));_0x2b933b(_0xdacad3);})[_0x1fdf('0x15')](function(_0x1a7213){logger[_0x1fdf('0x10')](_0x1fdf('0x23'),_0x1a7213['message'],_0xa89393);_0x56b9b9(_0x51d845['error'](0x1f4,_0x1a7213[_0x1fdf('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 3d95033..4a70107 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 _0xeff8=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','describe','/:id','update','exports','multer'];(function(_0x44cf57,_0x13a9e4){var _0x3b9f1d=function(_0x26aa91){while(--_0x26aa91){_0x44cf57['push'](_0x44cf57['shift']());}};_0x3b9f1d(++_0x13a9e4);}(_0xeff8,0x186));var _0x8eff=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0xeff8[_0x1b5aea];return _0x15cfc6;};'use strict';var multer=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var path=require('path');var timeout=require(_0x8eff('0x2'));var express=require(_0x8eff('0x3'));var router=express[_0x8eff('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8eff('0x5'));var interaction=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var controller=require(_0x8eff('0x8'));router['get']('/',auth[_0x8eff('0x9')](),controller[_0x8eff('0xa')]);router[_0x8eff('0xb')](_0x8eff('0xc'),auth['isAuthenticated'](),controller[_0x8eff('0xd')]);router[_0x8eff('0xb')](_0x8eff('0xe'),auth[_0x8eff('0x9')](),controller['show']);router['put'](_0x8eff('0xe'),auth[_0x8eff('0x9')](),controller[_0x8eff('0xf')]);router['delete'](_0x8eff('0xe'),auth[_0x8eff('0x9')](),controller['destroy']);module[_0x8eff('0x10')]=router; \ No newline at end of file +var _0x2a07=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x253358,_0x497f28){var _0x1487bf=function(_0x5a89d3){while(--_0x5a89d3){_0x253358['push'](_0x253358['shift']());}};_0x1487bf(++_0x497f28);}(_0x2a07,0x74));var _0x72a0=function(_0x1a151a,_0x44325f){_0x1a151a=_0x1a151a-0x0;var _0x3ce862=_0x2a07[_0x1a151a];return _0x3ce862;};'use strict';var multer=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var path=require(_0x72a0('0x2'));var timeout=require(_0x72a0('0x3'));var express=require(_0x72a0('0x4'));var router=express['Router']();var fs_extra=require(_0x72a0('0x5'));var auth=require(_0x72a0('0x6'));var interaction=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var controller=require(_0x72a0('0x9'));router[_0x72a0('0xa')]('/',auth[_0x72a0('0xb')](),controller[_0x72a0('0xc')]);router[_0x72a0('0xa')](_0x72a0('0xd'),auth[_0x72a0('0xb')](),controller[_0x72a0('0xe')]);router[_0x72a0('0xa')](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x10')]);router['put'](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller['update']);router[_0x72a0('0x11')](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x12')]);module[_0x72a0('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 286cba3..e205bb5 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 _0x6d05=['setDataValue','followuptime','diff','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime'];(function(_0x3156dc,_0x34bc35){var _0x1acfa3=function(_0x369f3d){while(--_0x369f3d){_0x3156dc['push'](_0x3156dc['shift']());}};_0x1acfa3(++_0x34bc35);}(_0x6d05,0xd5));var _0x56d0=function(_0x75c3a2,_0x4a0b4b){_0x75c3a2=_0x75c3a2-0x0;var _0x278d62=_0x6d05[_0x75c3a2];return _0x278d62;};'use strict';var Sequelize=require(_0x56d0('0x0'));var moment=require(_0x56d0('0x1'));module[_0x56d0('0x2')]={'state':{'type':Sequelize[_0x56d0('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x56d0('0x4')]},'scheduledat':{'type':Sequelize[_0x56d0('0x5')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x56d0('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x56d0('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x56d0('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x56d0('0x4')]},'calleridnum':{'type':Sequelize[_0x56d0('0x4')]},'calleridname':{'type':Sequelize[_0x56d0('0x4')]},'starttime':{'type':Sequelize[_0x56d0('0x5')]},'responsetime':{'type':Sequelize[_0x56d0('0x5')]},'answertime':{'type':Sequelize[_0x56d0('0x5')]},'droptime':{'type':Sequelize[_0x56d0('0x5')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x56d0('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x56d0('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x56d0('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x56d0('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x56d0('0x4')]},'reason':{'type':Sequelize[_0x56d0('0x4')]},'disposition':{'type':Sequelize[_0x56d0('0x4')]},'secondDisposition':{'type':Sequelize[_0x56d0('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x56d0('0x5')],'set':function(_0x3493c9){var _0x47d85a=this[_0x56d0('0x6')](_0x56d0('0x7'));if(_0x47d85a&&_0x3493c9){this[_0x56d0('0x8')](_0x56d0('0x9'),moment(_0x3493c9)[_0x56d0('0xa')](moment(_0x47d85a),'seconds'));}return this['setDataValue'](_0x56d0('0xb'),_0x3493c9);}},'amd':{'type':Sequelize[_0x56d0('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x56d0('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x56d0('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x56d0('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x56d0('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x56d0('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x56d0('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x56d0('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x56d0('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x56d0('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x56d0('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x56d0('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x56d0('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x77ce=['endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','DATE','STRING'];(function(_0x2cb68e,_0x5c05f6){var _0x6ad908=function(_0x170c31){while(--_0x170c31){_0x2cb68e['push'](_0x2cb68e['shift']());}};_0x6ad908(++_0x5c05f6);}(_0x77ce,0x118));var _0xe77c=function(_0x492d04,_0x1d4574){_0x492d04=_0x492d04-0x0;var _0x57d954=_0x77ce[_0x492d04];return _0x57d954;};'use strict';var Sequelize=require(_0xe77c('0x0'));var moment=require(_0xe77c('0x1'));module[_0xe77c('0x2')]={'state':{'type':Sequelize[_0xe77c('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xe77c('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe77c('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe77c('0x5')]},'originatecalleridnum':{'type':Sequelize[_0xe77c('0x5')]},'originatecalleridname':{'type':Sequelize[_0xe77c('0x5')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xe77c('0x4')]},'responsetime':{'type':Sequelize[_0xe77c('0x4')]},'answertime':{'type':Sequelize[_0xe77c('0x4')]},'droptime':{'type':Sequelize[_0xe77c('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xe77c('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe77c('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe77c('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xe77c('0x5')]},'campaigntype':{'type':Sequelize[_0xe77c('0x5')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xe77c('0x5')]},'disposition':{'type':Sequelize[_0xe77c('0x5')]},'secondDisposition':{'type':Sequelize[_0xe77c('0x5')]},'thirdDisposition':{'type':Sequelize[_0xe77c('0x5')]},'dispositionat':{'type':Sequelize[_0xe77c('0x4')],'set':function(_0x9b8a39){var _0x1cdf14=this['getDataValue'](_0xe77c('0x6'));if(_0x1cdf14&&_0x9b8a39){this[_0xe77c('0x7')](_0xe77c('0x8'),moment(_0x9b8a39)[_0xe77c('0x9')](moment(_0x1cdf14),_0xe77c('0xa')));}return this['setDataValue'](_0xe77c('0xb'),_0x9b8a39);}},'amd':{'type':Sequelize[_0xe77c('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe77c('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xe77c('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xe77c('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xe77c('0x4')]},'callback':{'type':Sequelize[_0xe77c('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe77c('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe77c('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xe77c('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xe77c('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe77c('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe77c('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe77c('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index e6ff7a0..f942550 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 _0xd8fb=['updatedAt','select','field','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','NOW()','from','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','toString','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x204','group','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','Content-Range','apply','reject','save','update','then','error','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','keys','include','options','find','describe','body','uniqueid','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','reCallContacts','`state`\x20=\x2019,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt'];(function(_0x89e963,_0x25a348){var _0x556241=function(_0x59a635){while(--_0x59a635){_0x89e963['push'](_0x89e963['shift']());}};_0x556241(++_0x25a348);}(_0xd8fb,0x99));var _0xbd8f=function(_0x110294,_0x57ed3d){_0x110294=_0x110294-0x0;var _0x2e225e=_0xd8fb[_0x110294];return _0x2e225e;};'use strict';var emlformat=require(_0xbd8f('0x0'));var rimraf=require(_0xbd8f('0x1'));var zipdir=require(_0xbd8f('0x2'));var jsonpatch=require(_0xbd8f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbd8f('0x4'));var util=require(_0xbd8f('0x5'));var path=require('path');var sox=require(_0xbd8f('0x6'));var csv=require(_0xbd8f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd8f('0x8'));var _=require('lodash');var squel=require(_0xbd8f('0x9'));var crypto=require('crypto');var jsforce=require(_0xbd8f('0xa'));var deskjs=require(_0xbd8f('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbd8f('0xc'));var Redis=require(_0xbd8f('0xd'));var authService=require(_0xbd8f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbd8f('0xf'));var hardwareService=require(_0xbd8f('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xbd8f('0x11'));var config=require(_0xbd8f('0x12'));var licenseUtil=require(_0xbd8f('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x230988,_0x159f09){_0x159f09=_0x159f09||0xcc;return function(_0x39be16){if(_0x39be16){return _0x230988[_0xbd8f('0x14')](_0x159f09);}return _0x230988[_0xbd8f('0x15')](_0x159f09)[_0xbd8f('0x16')]();};}function respondWithResult(_0x37d4d5,_0x29ffe8){_0x29ffe8=_0x29ffe8||0xc8;return function(_0x14606c){if(_0x14606c){return _0x37d4d5['status'](_0x29ffe8)[_0xbd8f('0x17')](_0x14606c);}};}function respondWithFilteredResult(_0x829fb2,_0xa57e91){return function(_0x10d72e){if(_0x10d72e){var _0x4da96f=typeof _0xa57e91[_0xbd8f('0x18')]===_0xbd8f('0x19')&&typeof _0xa57e91['limit']===_0xbd8f('0x19');var _0xf5e7a=_0x10d72e['count'];var _0x4435b9=_0x4da96f?0x0:_0xa57e91[_0xbd8f('0x18')];var _0x47d317=_0x4da96f?_0x10d72e['count']:_0xa57e91[_0xbd8f('0x18')]+_0xa57e91['limit'];var _0x5705c5;if(_0x47d317>=_0xf5e7a){_0x47d317=_0xf5e7a;_0x5705c5=0xc8;}else{_0x5705c5=0xce;}_0x829fb2[_0xbd8f('0x15')](_0x5705c5);return _0x829fb2['set'](_0xbd8f('0x1a'),_0x4435b9+'-'+_0x47d317+'/'+_0xf5e7a)[_0xbd8f('0x17')](_0x10d72e);}return null;};}function patchUpdates(_0xb47c8e){return function(_0x897f25){try{jsonpatch[_0xbd8f('0x1b')](_0x897f25,_0xb47c8e,!![]);}catch(_0x20cab7){return BPromise[_0xbd8f('0x1c')](_0x20cab7);}return _0x897f25[_0xbd8f('0x1d')]();};}function saveUpdates(_0x2fbe3b,_0x775acc){return function(_0xfe4048){if(_0xfe4048){return _0xfe4048[_0xbd8f('0x1e')](_0x2fbe3b)[_0xbd8f('0x1f')](function(_0x15c4a9){return _0x15c4a9;});}return null;};}function removeEntity(_0x320ede,_0xd11ae){return function(_0x395b1b){if(_0x395b1b){return _0x395b1b['destroy']()[_0xbd8f('0x1f')](function(){_0x320ede[_0xbd8f('0x15')](0xcc)[_0xbd8f('0x16')]();});}};}function handleEntityNotFound(_0x2f3df7,_0xa88414){return function(_0x2257fd){if(!_0x2257fd){_0x2f3df7[_0xbd8f('0x14')](0x194);}return _0x2257fd;};}function handleError(_0x264e62,_0x4ea554){_0x4ea554=_0x4ea554||0x1f4;return function(_0x40cb43){logger[_0xbd8f('0x20')](_0x40cb43['stack']);if(_0x40cb43[_0xbd8f('0x21')]){delete _0x40cb43['name'];}_0x264e62[_0xbd8f('0x15')](_0x4ea554)[_0xbd8f('0x22')](_0x40cb43);};}exports[_0xbd8f('0x23')]=function(_0x202126,_0x2aefa2){var _0x247b07={},_0x4c4431={},_0x166de7={'count':0x0,'rows':[]};var _0x14f3cb=_[_0xbd8f('0x24')](db[_0xbd8f('0x25')][_0xbd8f('0x26')],function(_0x2ac26f){return{'name':_0x2ac26f[_0xbd8f('0x27')],'type':_0x2ac26f['type'][_0xbd8f('0x28')]};});_0x4c4431[_0xbd8f('0x29')]=_[_0xbd8f('0x24')](_0x14f3cb,_0xbd8f('0x21'));_0x4c4431['query']=_['keys'](_0x202126[_0xbd8f('0x2a')]);_0x4c4431[_0xbd8f('0x2b')]=_[_0xbd8f('0x2c')](_0x4c4431[_0xbd8f('0x29')],_0x4c4431['query']);_0x247b07[_0xbd8f('0x2d')]=_[_0xbd8f('0x2c')](_0x4c4431[_0xbd8f('0x29')],qs[_0xbd8f('0x2e')](_0x202126[_0xbd8f('0x2a')]['fields']));_0x247b07[_0xbd8f('0x2d')]=_0x247b07[_0xbd8f('0x2d')][_0xbd8f('0x2f')]?_0x247b07[_0xbd8f('0x2d')]:_0x4c4431[_0xbd8f('0x29')];if(!_0x202126['query'][_0xbd8f('0x30')]('nolimit')){_0x247b07[_0xbd8f('0x31')]=qs[_0xbd8f('0x31')](_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x31')]);_0x247b07[_0xbd8f('0x18')]=qs[_0xbd8f('0x18')](_0x202126['query']['offset']);}_0x247b07['order']=qs[_0xbd8f('0x32')](_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x32')]);_0x247b07[_0xbd8f('0x33')]=qs[_0xbd8f('0x2b')](_[_0xbd8f('0x34')](_0x202126[_0xbd8f('0x2a')],_0x4c4431[_0xbd8f('0x2b')]),_0x14f3cb);if(_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x35')]){_0x247b07[_0xbd8f('0x33')]=_[_0xbd8f('0x36')](_0x247b07[_0xbd8f('0x33')],{'$or':_[_0xbd8f('0x24')](_0x14f3cb,function(_0x391d45){if(_0x391d45['type']!==_0xbd8f('0x37')){var _0x4181e0={};_0x4181e0[_0x391d45['name']]={'$like':'%'+_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x35')]+'%'};return _0x4181e0;}})});}_0x247b07=_[_0xbd8f('0x36')]({},_0x247b07,_0x202126['options']);var _0x21da54={'where':_0x247b07['where']};return db[_0xbd8f('0x25')][_0xbd8f('0x38')](_0x21da54)[_0xbd8f('0x1f')](function(_0x4f2ebc){_0x166de7[_0xbd8f('0x38')]=_0x4f2ebc;if(_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x39')]){_0x247b07['include']=[{'all':!![]}];}return db[_0xbd8f('0x25')][_0xbd8f('0x3a')](_0x247b07);})[_0xbd8f('0x1f')](function(_0x351027){_0x166de7[_0xbd8f('0x3b')]=_0x351027;return _0x166de7;})[_0xbd8f('0x1f')](respondWithFilteredResult(_0x2aefa2,_0x247b07))[_0xbd8f('0x3c')](handleError(_0x2aefa2,null));};exports[_0xbd8f('0x3d')]=function(_0x14b768,_0x5e1e77){var _0x52c62b={'raw':!![],'where':{'id':_0x14b768[_0xbd8f('0x3e')]['id']}},_0x2907a3={};_0x2907a3[_0xbd8f('0x29')]=_[_0xbd8f('0x3f')](db['CmHopperFinal'][_0xbd8f('0x26')]);_0x2907a3[_0xbd8f('0x2a')]=_[_0xbd8f('0x3f')](_0x14b768[_0xbd8f('0x2a')]);_0x2907a3[_0xbd8f('0x2b')]=_['intersection'](_0x2907a3['model'],_0x2907a3[_0xbd8f('0x2a')]);_0x52c62b['attributes']=_[_0xbd8f('0x2c')](_0x2907a3[_0xbd8f('0x29')],qs[_0xbd8f('0x2e')](_0x14b768[_0xbd8f('0x2a')][_0xbd8f('0x2e')]));_0x52c62b[_0xbd8f('0x2d')]=_0x52c62b[_0xbd8f('0x2d')][_0xbd8f('0x2f')]?_0x52c62b['attributes']:_0x2907a3[_0xbd8f('0x29')];if(_0x14b768[_0xbd8f('0x2a')][_0xbd8f('0x39')]){_0x52c62b[_0xbd8f('0x40')]=[{'all':!![]}];}_0x52c62b=_[_0xbd8f('0x36')]({},_0x52c62b,_0x14b768[_0xbd8f('0x41')]);return db[_0xbd8f('0x25')][_0xbd8f('0x42')](_0x52c62b)['then'](handleEntityNotFound(_0x5e1e77,null))[_0xbd8f('0x1f')](respondWithResult(_0x5e1e77,null))[_0xbd8f('0x3c')](handleError(_0x5e1e77,null));};exports[_0xbd8f('0x43')]=function(_0x1f12dd,_0x2fdbd0){return db[_0xbd8f('0x25')][_0xbd8f('0x43')]()[_0xbd8f('0x1f')](respondWithResult(_0x2fdbd0,null))[_0xbd8f('0x3c')](handleError(_0x2fdbd0,null));};exports[_0xbd8f('0x1e')]=function(_0x406741,_0x255c59){if(_0x406741[_0xbd8f('0x44')][_0xbd8f('0x45')]){delete _0x406741[_0xbd8f('0x44')][_0xbd8f('0x45')];}return db[_0xbd8f('0x25')][_0xbd8f('0x42')]({'where':{'uniqueid':_0x406741[_0xbd8f('0x3e')]['id']}})['then'](handleEntityNotFound(_0x255c59,null))[_0xbd8f('0x1f')](saveUpdates(_0x406741[_0xbd8f('0x44')],null))[_0xbd8f('0x1f')](respondWithResult(_0x255c59,null))[_0xbd8f('0x3c')](handleError(_0x255c59,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x1b38ad,_0x5a33c5,_0x9bfe93){return db[_0xbd8f('0x25')][_0xbd8f('0x3a')]({'raw':![],'where':{'VoiceQueueId':_0x1b38ad[_0xbd8f('0x3e')]['id']},'attributes':[[db['sequelize']['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x49')))),_0xbd8f('0x4a')],[db['sequelize']['fn'](_0xbd8f('0x46'),db['sequelize']['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x4b')))),_0xbd8f('0x4c')],[db[_0xbd8f('0x47')]['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')]('`state`\x20=\x205,\x201,\x20null'))),_0xbd8f('0x4d')],[db['sequelize']['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db['sequelize'][_0xbd8f('0x48')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x4e')))),_0xbd8f('0x4f')],[db['sequelize']['fn']('COUNT',db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x50')))),_0xbd8f('0x51')],[db['sequelize']['fn'](_0xbd8f('0x46'),db['sequelize']['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x52')))),'reCallContacts'],[db[_0xbd8f('0x47')]['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0xbd8f('0x53')]]})['then'](handleEntityNotFound(_0x5a33c5,null))[_0xbd8f('0x1f')](respondWithResult(_0x5a33c5,null))[_0xbd8f('0x3c')](handleError(_0x5a33c5,null));};exports[_0xbd8f('0x54')]=function(_0x93452d,_0x4a86a9,_0x5ea275){return db[_0xbd8f('0x25')][_0xbd8f('0x3a')]({'raw':![],'where':{'CampaignId':_0x93452d[_0xbd8f('0x3e')]['id']},'attributes':[[db[_0xbd8f('0x47')]['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x49')))),_0xbd8f('0x4a')],[db[_0xbd8f('0x47')]['fn']('COUNT',db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x4b')))),_0xbd8f('0x4c')],[db[_0xbd8f('0x47')]['fn']('COUNT',db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xbd8f('0x4d')],[db[_0xbd8f('0x47')]['fn'](_0xbd8f('0x46'),db['sequelize']['fn']('IF',db['sequelize'][_0xbd8f('0x48')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xbd8f('0x47')]['literal'](_0xbd8f('0x4e')))),_0xbd8f('0x4f')],[db['sequelize']['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x50')))),'abandonedContacts'],[db['sequelize']['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x52')))),_0xbd8f('0x55')],[db['sequelize']['fn']('COUNT',db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')]['literal'](_0xbd8f('0x56')))),_0xbd8f('0x53')]]})['then'](handleEntityNotFound(_0x4a86a9,null))[_0xbd8f('0x1f')](respondWithResult(_0x4a86a9,null))[_0xbd8f('0x3c')](handleError(_0x4a86a9,null));};exports[_0xbd8f('0x57')]=function(_0x5a8c8f,_0x5c04d9,_0x2407e7){return db[_0xbd8f('0x58')][_0xbd8f('0x42')]({'where':{'id':_0x5a8c8f[_0xbd8f('0x3e')]['id']}})[_0xbd8f('0x1f')](handleEntityNotFound(_0x5c04d9,null))['then'](function(_0x200718){var _0x27ec14;if(_0x200718){_0x27ec14=squel[_0xbd8f('0x59')]()[_0xbd8f('0x5a')](_0xbd8f('0x5b'))[_0xbd8f('0x5c')]([_0xbd8f('0x5d'),_0xbd8f('0x5e'),_0xbd8f('0x5f'),_0xbd8f('0x60'),_0xbd8f('0x61'),_0xbd8f('0x62'),_0xbd8f('0x63')],squel[_0xbd8f('0x64')]()[_0xbd8f('0x65')](_0xbd8f('0x66'),_0xbd8f('0x5d'))[_0xbd8f('0x65')]('NOW()',_0xbd8f('0x5e'))[_0xbd8f('0x65')](_0xbd8f('0x67'),_0xbd8f('0x5f'))[_0xbd8f('0x65')](_0xbd8f('0x68'),'ListId')['field'](_0xbd8f('0x69'),_0xbd8f('0x61'))['field'](_0xbd8f('0x6a'),'createdAt')[_0xbd8f('0x65')](_0xbd8f('0x6a'),_0xbd8f('0x63'))[_0xbd8f('0x6b')]('cm_hopper_final')[_0xbd8f('0x33')](_0xbd8f('0x6c'),_0x5a8c8f[_0xbd8f('0x3e')]['id']['toString']())[_0xbd8f('0x33')](_0xbd8f('0x6d'),_0x5a8c8f[_0xbd8f('0x44')][_0xbd8f('0x6e')]['toString']())[_0xbd8f('0x33')](_0xbd8f('0x6f'))[_0xbd8f('0x33')](_0xbd8f('0x70'),squel[_0xbd8f('0x64')]()[_0xbd8f('0x65')](_0xbd8f('0x5d'))[_0xbd8f('0x6b')]('cm_hopper')[_0xbd8f('0x33')]('VoiceQueueId\x20=\x20?',_0x5a8c8f[_0xbd8f('0x3e')]['id']['toString']()))[_0xbd8f('0x33')](_0xbd8f('0x70'),squel['select']()[_0xbd8f('0x65')](_0xbd8f('0x71'))[_0xbd8f('0x6b')](_0xbd8f('0x72'))['where'](_0xbd8f('0x6c'),_0x5a8c8f[_0xbd8f('0x3e')]['id'][_0xbd8f('0x73')]())[_0xbd8f('0x33')]('state\x20=\x204'))['group'](_0xbd8f('0x5f')))[_0xbd8f('0x73')]();return db[_0xbd8f('0x47')][_0xbd8f('0x2a')](_0x27ec14);}return[];})[_0xbd8f('0x1f')](respondWithResult(_0x5c04d9,null))['catch'](handleError(_0x5c04d9,null));};exports[_0xbd8f('0x74')]=function(_0x13314f,_0x328bd6,_0x11a05a){return db[_0xbd8f('0x75')]['find']({'where':{'id':_0x13314f['params']['id']}})['then'](handleEntityNotFound(_0x328bd6,null))[_0xbd8f('0x1f')](function(_0x5df0e1){var _0x535869;if(_0x5df0e1){_0x535869=squel['insert']()[_0xbd8f('0x5a')](_0xbd8f('0x5b'))[_0xbd8f('0x5c')]([_0xbd8f('0x5d'),_0xbd8f('0x5e'),_0xbd8f('0x5f'),_0xbd8f('0x60'),_0xbd8f('0x76'),'createdAt',_0xbd8f('0x63')],squel[_0xbd8f('0x64')]()[_0xbd8f('0x65')]('ANY_VALUE(calleridnum)',_0xbd8f('0x5d'))[_0xbd8f('0x65')](_0xbd8f('0x6a'),_0xbd8f('0x5e'))[_0xbd8f('0x65')](_0xbd8f('0x67'),_0xbd8f('0x5f'))[_0xbd8f('0x65')](_0xbd8f('0x68'),_0xbd8f('0x60'))['field'](_0xbd8f('0x77'),_0xbd8f('0x76'))[_0xbd8f('0x65')]('NOW()',_0xbd8f('0x62'))['field'](_0xbd8f('0x6a'),_0xbd8f('0x63'))[_0xbd8f('0x6b')](_0xbd8f('0x72'))[_0xbd8f('0x33')]('CampaignId\x20=\x20?',_0x13314f[_0xbd8f('0x3e')]['id'][_0xbd8f('0x73')]())[_0xbd8f('0x33')](_0xbd8f('0x6d'),_0x13314f[_0xbd8f('0x44')][_0xbd8f('0x6e')]['toString']())[_0xbd8f('0x33')](_0xbd8f('0x6f'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xbd8f('0x64')]()['field']('phone')['from'](_0xbd8f('0x5b'))[_0xbd8f('0x33')](_0xbd8f('0x78'),_0x13314f[_0xbd8f('0x3e')]['id']['toString']()))[_0xbd8f('0x33')](_0xbd8f('0x70'),squel['select']()['field'](_0xbd8f('0x71'))['from'](_0xbd8f('0x72'))['where']('CampaignId\x20=\x20?',_0x13314f[_0xbd8f('0x3e')]['id'][_0xbd8f('0x73')]())[_0xbd8f('0x33')](_0xbd8f('0x79')))[_0xbd8f('0x7a')]('ContactId'))[_0xbd8f('0x73')]();return db[_0xbd8f('0x47')][_0xbd8f('0x2a')](_0x535869);}return[];})['then'](respondWithResult(_0x328bd6,null))[_0xbd8f('0x3c')](handleError(_0x328bd6,null));};exports[_0xbd8f('0x7b')]=function(_0x38d1a6,_0x31b92c,_0x11fb11){return db[_0xbd8f('0x7c')][_0xbd8f('0x7d')]({'where':{'VoiceQueueId':_0x38d1a6[_0xbd8f('0x44')][_0xbd8f('0x61')],'CampaignId':_0x38d1a6[_0xbd8f('0x44')]['CampaignId'],'ContactId':_0x38d1a6['body']['ContactId']}})['then'](handleEntityNotFound(_0x31b92c,null))[_0xbd8f('0x1f')](function(_0x3ff503){if(_0x3ff503){return _0x3ff503;}return null;})['then'](respondWithResult(_0x31b92c,null))['catch'](handleError(_0x31b92c,null));}; \ No newline at end of file +var _0x5d17=['ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','state\x20=\x204','moveContactsIvrCampaignHopperFinal','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','group','checkContactHopper','findOne','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','nolimit','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','describe','update','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','congestionContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()'];(function(_0x2265da,_0xfbbd2e){var _0x430c2b=function(_0x20d671){while(--_0x20d671){_0x2265da['push'](_0x2265da['shift']());}};_0x430c2b(++_0xfbbd2e);}(_0x5d17,0x114));var _0x75d1=function(_0x465351,_0x115a2c){_0x465351=_0x465351-0x0;var _0x19f941=_0x5d17[_0x465351];return _0x19f941;};'use strict';var emlformat=require(_0x75d1('0x0'));var rimraf=require(_0x75d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x75d1('0x2'));var moment=require(_0x75d1('0x3'));var BPromise=require(_0x75d1('0x4'));var Mustache=require('mustache');var util=require(_0x75d1('0x5'));var path=require(_0x75d1('0x6'));var sox=require(_0x75d1('0x7'));var csv=require(_0x75d1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75d1('0x9'));var _=require(_0x75d1('0xa'));var squel=require(_0x75d1('0xb'));var crypto=require(_0x75d1('0xc'));var jsforce=require(_0x75d1('0xd'));var deskjs=require(_0x75d1('0xe'));var toCsv=require(_0x75d1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x75d1('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75d1('0x10'));var hardwareService=require(_0x75d1('0x11'));var logger=require('../../config/logger')(_0x75d1('0x12'));var utils=require(_0x75d1('0x13'));var config=require(_0x75d1('0x14'));var licenseUtil=require(_0x75d1('0x15'));var db=require(_0x75d1('0x16'))['db'];function respondWithStatusCode(_0xd089cf,_0x49667a){_0x49667a=_0x49667a||0xcc;return function(_0x19e825){if(_0x19e825){return _0xd089cf[_0x75d1('0x17')](_0x49667a);}return _0xd089cf[_0x75d1('0x18')](_0x49667a)[_0x75d1('0x19')]();};}function respondWithResult(_0x49d723,_0x553697){_0x553697=_0x553697||0xc8;return function(_0x55b8a0){if(_0x55b8a0){return _0x49d723[_0x75d1('0x18')](_0x553697)[_0x75d1('0x1a')](_0x55b8a0);}};}function respondWithFilteredResult(_0x2fd022,_0x52e649){return function(_0x1f9620){if(_0x1f9620){var _0x3fff9b=typeof _0x52e649[_0x75d1('0x1b')]===_0x75d1('0x1c')&&typeof _0x52e649[_0x75d1('0x1d')]===_0x75d1('0x1c');var _0x2845bc=_0x1f9620[_0x75d1('0x1e')];var _0x1bc5de=_0x3fff9b?0x0:_0x52e649[_0x75d1('0x1b')];var _0x2c2a6d=_0x3fff9b?_0x1f9620['count']:_0x52e649['offset']+_0x52e649[_0x75d1('0x1d')];var _0x42b7ac;if(_0x2c2a6d>=_0x2845bc){_0x2c2a6d=_0x2845bc;_0x42b7ac=0xc8;}else{_0x42b7ac=0xce;}_0x2fd022['status'](_0x42b7ac);return _0x2fd022[_0x75d1('0x1f')](_0x75d1('0x20'),_0x1bc5de+'-'+_0x2c2a6d+'/'+_0x2845bc)[_0x75d1('0x1a')](_0x1f9620);}return null;};}function patchUpdates(_0xf6cc70){return function(_0xa42dbe){try{jsonpatch[_0x75d1('0x21')](_0xa42dbe,_0xf6cc70,!![]);}catch(_0x51d3b0){return BPromise[_0x75d1('0x22')](_0x51d3b0);}return _0xa42dbe[_0x75d1('0x23')]();};}function saveUpdates(_0x501cc7,_0x1cb58c){return function(_0x641ea4){if(_0x641ea4){return _0x641ea4['update'](_0x501cc7)[_0x75d1('0x24')](function(_0x5e70ec){return _0x5e70ec;});}return null;};}function removeEntity(_0x3a85c0,_0xc256af){return function(_0x345cf5){if(_0x345cf5){return _0x345cf5['destroy']()['then'](function(){_0x3a85c0[_0x75d1('0x18')](0xcc)[_0x75d1('0x19')]();});}};}function handleEntityNotFound(_0x315ce5,_0x18184b){return function(_0x51d043){if(!_0x51d043){_0x315ce5[_0x75d1('0x17')](0x194);}return _0x51d043;};}function handleError(_0x2b5848,_0x367238){_0x367238=_0x367238||0x1f4;return function(_0x51138e){logger['error'](_0x51138e['stack']);if(_0x51138e[_0x75d1('0x25')]){delete _0x51138e[_0x75d1('0x25')];}_0x2b5848[_0x75d1('0x18')](_0x367238)[_0x75d1('0x26')](_0x51138e);};}exports[_0x75d1('0x27')]=function(_0x519ceb,_0x4d292e){var _0x410e16={},_0x197f52={},_0x4967b5={'count':0x0,'rows':[]};var _0x2408b6=_['map'](db[_0x75d1('0x28')][_0x75d1('0x29')],function(_0x91e7c9){return{'name':_0x91e7c9[_0x75d1('0x2a')],'type':_0x91e7c9[_0x75d1('0x2b')]['key']};});_0x197f52[_0x75d1('0x2c')]=_[_0x75d1('0x2d')](_0x2408b6,_0x75d1('0x25'));_0x197f52[_0x75d1('0x2e')]=_['keys'](_0x519ceb[_0x75d1('0x2e')]);_0x197f52['filters']=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],_0x197f52['query']);_0x410e16[_0x75d1('0x30')]=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x519ceb[_0x75d1('0x2e')]['fields']));_0x410e16[_0x75d1('0x30')]=_0x410e16[_0x75d1('0x30')][_0x75d1('0x32')]?_0x410e16[_0x75d1('0x30')]:_0x197f52['model'];if(!_0x519ceb['query']['hasOwnProperty'](_0x75d1('0x33'))){_0x410e16[_0x75d1('0x1d')]=qs[_0x75d1('0x1d')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1d')]);_0x410e16[_0x75d1('0x1b')]=qs[_0x75d1('0x1b')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1b')]);}_0x410e16['order']=qs[_0x75d1('0x34')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x34')]);_0x410e16[_0x75d1('0x35')]=qs[_0x75d1('0x36')](_['pick'](_0x519ceb['query'],_0x197f52['filters']),_0x2408b6);if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x37')]){_0x410e16[_0x75d1('0x35')]=_[_0x75d1('0x38')](_0x410e16[_0x75d1('0x35')],{'$or':_[_0x75d1('0x2d')](_0x2408b6,function(_0x48f9f3){if(_0x48f9f3['type']!=='VIRTUAL'){var _0x3f2569={};_0x3f2569[_0x48f9f3['name']]={'$like':'%'+_0x519ceb['query'][_0x75d1('0x37')]+'%'};return _0x3f2569;}})});}_0x410e16=_[_0x75d1('0x38')]({},_0x410e16,_0x519ceb[_0x75d1('0x39')]);var _0x46854c={'where':_0x410e16['where']};return db[_0x75d1('0x28')][_0x75d1('0x1e')](_0x46854c)[_0x75d1('0x24')](function(_0x3d4137){_0x4967b5[_0x75d1('0x1e')]=_0x3d4137;if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x410e16[_0x75d1('0x3b')]=[{'all':!![]}];}return db[_0x75d1('0x28')][_0x75d1('0x3c')](_0x410e16);})[_0x75d1('0x24')](function(_0x93922f){_0x4967b5[_0x75d1('0x3d')]=_0x93922f;return _0x4967b5;})[_0x75d1('0x24')](respondWithFilteredResult(_0x4d292e,_0x410e16))[_0x75d1('0x3e')](handleError(_0x4d292e,null));};exports[_0x75d1('0x3f')]=function(_0x25f689,_0x2ad3ef){var _0x42c18c={'raw':!![],'where':{'id':_0x25f689[_0x75d1('0x40')]['id']}},_0x2384aa={};_0x2384aa[_0x75d1('0x2c')]=_['keys'](db['CmHopperFinal'][_0x75d1('0x29')]);_0x2384aa[_0x75d1('0x2e')]=_[_0x75d1('0x41')](_0x25f689[_0x75d1('0x2e')]);_0x2384aa['filters']=_[_0x75d1('0x2f')](_0x2384aa[_0x75d1('0x2c')],_0x2384aa[_0x75d1('0x2e')]);_0x42c18c[_0x75d1('0x30')]=_['intersection'](_0x2384aa[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x25f689[_0x75d1('0x2e')][_0x75d1('0x31')]));_0x42c18c['attributes']=_0x42c18c[_0x75d1('0x30')]['length']?_0x42c18c[_0x75d1('0x30')]:_0x2384aa[_0x75d1('0x2c')];if(_0x25f689[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x42c18c[_0x75d1('0x3b')]=[{'all':!![]}];}_0x42c18c=_[_0x75d1('0x38')]({},_0x42c18c,_0x25f689['options']);return db[_0x75d1('0x28')]['find'](_0x42c18c)['then'](handleEntityNotFound(_0x2ad3ef,null))[_0x75d1('0x24')](respondWithResult(_0x2ad3ef,null))[_0x75d1('0x3e')](handleError(_0x2ad3ef,null));};exports[_0x75d1('0x42')]=function(_0x12bd67,_0x16f744){return db[_0x75d1('0x28')][_0x75d1('0x42')]()['then'](respondWithResult(_0x16f744,null))['catch'](handleError(_0x16f744,null));};exports[_0x75d1('0x43')]=function(_0x8ce3d2,_0x50def3){if(_0x8ce3d2[_0x75d1('0x44')][_0x75d1('0x45')]){delete _0x8ce3d2[_0x75d1('0x44')]['uniqueid'];}return db[_0x75d1('0x28')][_0x75d1('0x46')]({'where':{'uniqueid':_0x8ce3d2[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x50def3,null))[_0x75d1('0x24')](saveUpdates(_0x8ce3d2[_0x75d1('0x44')],null))[_0x75d1('0x24')](respondWithResult(_0x50def3,null))['catch'](handleError(_0x50def3,null));};exports[_0x75d1('0x47')]=function(_0x382195,_0x16b3c0,_0x395e0b){return db[_0x75d1('0x28')][_0x75d1('0x3c')]({'raw':![],'where':{'VoiceQueueId':_0x382195[_0x75d1('0x40')]['id']},'attributes':[[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x51')))),'congestionContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),_0x75d1('0x55')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),_0x75d1('0x57')],[db['sequelize']['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})['then'](handleEntityNotFound(_0x16b3c0,null))[_0x75d1('0x24')](respondWithResult(_0x16b3c0,null))[_0x75d1('0x3e')](handleError(_0x16b3c0,null));};exports[_0x75d1('0x59')]=function(_0x16cc70,_0x5d2219,_0x22ce12){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x16cc70[_0x75d1('0x40')]['id']},'attributes':[[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x51')))),_0x75d1('0x5a')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),'abandonedContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),'reCallContacts'],[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})[_0x75d1('0x24')](handleEntityNotFound(_0x5d2219,null))[_0x75d1('0x24')](respondWithResult(_0x5d2219,null))['catch'](handleError(_0x5d2219,null));};exports[_0x75d1('0x5b')]=function(_0x1f9ac2,_0x290587,_0x1baaca){return db[_0x75d1('0x5c')]['find']({'where':{'id':_0x1f9ac2['params']['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x290587,null))['then'](function(_0x3f15f3){var _0xf29a9f;if(_0x3f15f3){_0xf29a9f=squel[_0x75d1('0x5d')]()['into']('cm_hopper')[_0x75d1('0x5e')](['phone',_0x75d1('0x5f'),_0x75d1('0x60'),_0x75d1('0x61'),'VoiceQueueId',_0x75d1('0x62'),_0x75d1('0x63')],squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x66'),_0x75d1('0x67'))[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')](_0x75d1('0x69'),_0x75d1('0x60'))[_0x75d1('0x65')](_0x75d1('0x6a'),'ListId')['field'](_0x75d1('0x6b'),_0x75d1('0x6c'))['field'](_0x75d1('0x68'),'createdAt')['field']('NOW()',_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2['params']['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x1f9ac2[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()['field']('phone')['from'](_0x75d1('0x74'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2[_0x75d1('0x40')]['id'][_0x75d1('0x70')]()))[_0x75d1('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x75d1('0x64')]()[_0x75d1('0x65')]('calleridnum')[_0x75d1('0x6d')]('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x1f9ac2[_0x75d1('0x40')]['id']['toString']())['where'](_0x75d1('0x75')))['group'](_0x75d1('0x60')))[_0x75d1('0x70')]();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0xf29a9f);}return[];})[_0x75d1('0x24')](respondWithResult(_0x290587,null))[_0x75d1('0x3e')](handleError(_0x290587,null));};exports[_0x75d1('0x76')]=function(_0x217347,_0x51b682,_0x195a0a){return db['Campaign'][_0x75d1('0x46')]({'where':{'id':_0x217347[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x51b682,null))['then'](function(_0x10bc92){var _0x150735;if(_0x10bc92){_0x150735=squel[_0x75d1('0x5d')]()[_0x75d1('0x77')](_0x75d1('0x74'))[_0x75d1('0x5e')]([_0x75d1('0x67'),'scheduledAt',_0x75d1('0x60'),_0x75d1('0x61'),_0x75d1('0x78'),_0x75d1('0x62'),_0x75d1('0x63')],squel['select']()['field'](_0x75d1('0x66'),'phone')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')]('ANY_VALUE(ContactId)','ContactId')[_0x75d1('0x65')](_0x75d1('0x6a'),_0x75d1('0x61'))[_0x75d1('0x65')](_0x75d1('0x79'),'CampaignId')[_0x75d1('0x65')](_0x75d1('0x68'),'createdAt')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')]('CampaignId\x20=\x20?',_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x217347[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x67'))[_0x75d1('0x6d')]('cm_hopper')[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id']['toString']()))[_0x75d1('0x35')](_0x75d1('0x73'),squel['select']()[_0x75d1('0x65')](_0x75d1('0x7b'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')]('state\x20=\x204'))[_0x75d1('0x7c')](_0x75d1('0x60')))['toString']();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0x150735);}return[];})['then'](respondWithResult(_0x51b682,null))['catch'](handleError(_0x51b682,null));};exports[_0x75d1('0x7d')]=function(_0x44a017,_0x4d8e5d,_0x1f3a7e){return db['CmHopper'][_0x75d1('0x7e')]({'where':{'VoiceQueueId':_0x44a017['body'][_0x75d1('0x6c')],'CampaignId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x78')],'ContactId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x60')]}})[_0x75d1('0x24')](handleEntityNotFound(_0x4d8e5d,null))[_0x75d1('0x24')](function(_0x205e82){if(_0x205e82){return _0x205e82;}return null;})[_0x75d1('0x24')](respondWithResult(_0x4d8e5d,null))[_0x75d1('0x3e')](handleError(_0x4d8e5d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 80ad9d2..efe11c6 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 _0x21d8=['bluebird','request-promise','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x34e4a0,_0x1fd446){var _0x3ead3e=function(_0x47adec){while(--_0x47adec){_0x34e4a0['push'](_0x34e4a0['shift']());}};_0x3ead3e(++_0x1fd446);}(_0x21d8,0x91));var _0x821d=function(_0x908de7,_0x21e550){_0x908de7=_0x908de7-0x0;var _0x391718=_0x21d8[_0x908de7];return _0x391718;};'use strict';var _=require(_0x821d('0x0'));var util=require(_0x821d('0x1'));var logger=require(_0x821d('0x2'))(_0x821d('0x3'));var moment=require(_0x821d('0x4'));var BPromise=require(_0x821d('0x5'));var rp=require(_0x821d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x821d('0x7'));var config=require(_0x821d('0x8'));var attributes=require(_0x821d('0x9'));module[_0x821d('0xa')]=function(_0x34c825,_0x3c4689){return _0x34c825[_0x821d('0xb')]('CmHopperFinal',attributes,{'tableName':_0x821d('0xc'),'paranoid':![],'indexes':[{'name':_0x821d('0xd'),'fields':['calleridnum']},{'name':_0x821d('0xe'),'fields':[_0x821d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x91da=['cm_hopper_final','calleridnum','uniqueid','util','../../config/logger','moment','request-promise','rimraf','exports','define'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x91da,0x161));var _0xa91d=function(_0x48e0ff,_0x3a8676){_0x48e0ff=_0x48e0ff-0x0;var _0x322c42=_0x91da[_0x48e0ff];return _0x322c42;};'use strict';var _=require('lodash');var util=require(_0xa91d('0x0'));var logger=require(_0xa91d('0x1'))('api');var moment=require(_0xa91d('0x2'));var BPromise=require('bluebird');var rp=require(_0xa91d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa91d('0x4'));var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module[_0xa91d('0x5')]=function(_0x239637,_0x21db32){return _0x239637[_0xa91d('0x6')]('CmHopperFinal',attributes,{'tableName':_0xa91d('0x7'),'paranoid':![],'indexes':[{'name':_0xa91d('0x8'),'fields':[_0xa91d('0x8')]},{'name':_0xa91d('0x9'),'fields':[_0xa91d('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index a7c3bf1..6a43cdd 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(_0x20244d,_0x143894){var _0x50d712=function(_0x15c451){while(--_0x15c451){_0x20244d['push'](_0x20244d['shift']());}};_0x50d712(++_0x143894);}(_0xb10b,0x12a));var _0xbb10=function(_0x3b8bb3,_0x29136d){_0x3b8bb3=_0x3b8bb3-0x0;var _0x420eb8=_0xb10b[_0x3b8bb3];return _0x420eb8;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x652c98,_0x5d5e1e){var _0x3a2753=function(_0x29c01f){while(--_0x29c01f){_0x652c98['push'](_0x652c98['shift']());}};_0x3a2753(++_0x5d5e1e);}(_0xb10b,0x12a));var _0xbb10=function(_0x1be1f6,_0x5e7089){_0x1be1f6=_0x1be1f6-0x0;var _0x2bd577=_0xb10b[_0x1be1f6];return _0x2bd577;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 1c7cdde..77d9728 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 _0x9500=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','/describe','isAuthenticated','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsIvrCampaignHopperFinal','put','update','exports'];(function(_0x1a2ed1,_0x14112f){var _0x2d6176=function(_0x20901d){while(--_0x20901d){_0x1a2ed1['push'](_0x1a2ed1['shift']());}};_0x2d6176(++_0x14112f);}(_0x9500,0xb6));var _0x0950=function(_0x57c173,_0x2512c3){_0x57c173=_0x57c173-0x0;var _0x1b7077=_0x9500[_0x57c173];return _0x1b7077;};'use strict';var multer=require(_0x0950('0x0'));var util=require(_0x0950('0x1'));var path=require(_0x0950('0x2'));var timeout=require(_0x0950('0x3'));var express=require(_0x0950('0x4'));var router=express[_0x0950('0x5')]();var fs_extra=require(_0x0950('0x6'));var auth=require(_0x0950('0x7'));var interaction=require(_0x0950('0x8'));var config=require(_0x0950('0x9'));var controller=require(_0x0950('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0950('0xb')](_0x0950('0xc'),auth[_0x0950('0xd')](),controller['describe']);router[_0x0950('0xb')](_0x0950('0xe'),auth['isAuthenticated'](),controller[_0x0950('0xf')]);router[_0x0950('0xb')](_0x0950('0x10'),auth[_0x0950('0xd')](),controller[_0x0950('0x11')]);router['get'](_0x0950('0x12'),auth['isAuthenticated'](),controller[_0x0950('0x13')]);router[_0x0950('0x14')](_0x0950('0x15'),auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router['post']('/voice/campaign/moveContacts/:id',auth[_0x0950('0xd')](),controller[_0x0950('0x16')]);router[_0x0950('0x14')]('/checkContactHopper',auth['isAuthenticated'](),controller['checkContactHopper']);router[_0x0950('0x17')](_0x0950('0xe'),auth[_0x0950('0xd')](),controller[_0x0950('0x18')]);module[_0x0950('0x19')]=router; \ No newline at end of file +var _0x9f40=['../../components/interaction/service','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','countContactsQueueCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','post','checkContactHopper','update','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x25523d,_0x14b1a1){var _0x442f91=function(_0x3c1188){while(--_0x3c1188){_0x25523d['push'](_0x25523d['shift']());}};_0x442f91(++_0x14b1a1);}(_0x9f40,0x9b));var _0x09f4=function(_0x35ca57,_0x444f3a){_0x35ca57=_0x35ca57-0x0;var _0x204381=_0x9f40[_0x35ca57];return _0x204381;};'use strict';var multer=require('multer');var util=require(_0x09f4('0x0'));var path=require('path');var timeout=require(_0x09f4('0x1'));var express=require(_0x09f4('0x2'));var router=express[_0x09f4('0x3')]();var fs_extra=require(_0x09f4('0x4'));var auth=require(_0x09f4('0x5'));var interaction=require(_0x09f4('0x6'));var config=require('../../config/environment');var controller=require(_0x09f4('0x7'));router[_0x09f4('0x8')]('/',auth[_0x09f4('0x9')](),controller[_0x09f4('0xa')]);router[_0x09f4('0x8')](_0x09f4('0xb'),auth[_0x09f4('0x9')](),controller[_0x09f4('0xc')]);router[_0x09f4('0x8')](_0x09f4('0xd'),auth[_0x09f4('0x9')](),controller[_0x09f4('0xe')]);router[_0x09f4('0x8')]('/voice/queue/countAttributes/:id',auth[_0x09f4('0x9')](),controller[_0x09f4('0xf')]);router['get']('/campaign/countAttributes/:id',auth[_0x09f4('0x9')](),controller['countContactsIvrCampaignHopperFinal']);router['post'](_0x09f4('0x10'),auth['isAuthenticated'](),controller[_0x09f4('0x11')]);router['post'](_0x09f4('0x12'),auth[_0x09f4('0x9')](),controller[_0x09f4('0x13')]);router[_0x09f4('0x14')]('/checkContactHopper',auth[_0x09f4('0x9')](),controller[_0x09f4('0x15')]);router['put'](_0x09f4('0xd'),auth[_0x09f4('0x9')](),controller[_0x09f4('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index ecdfea7..a386aa3 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 _0xe23a=['INTEGER','BOOLEAN','sequelize','STRING','DATE'];(function(_0x33cad7,_0x492026){var _0x381d4a=function(_0x41bc73){while(--_0x41bc73){_0x33cad7['push'](_0x33cad7['shift']());}};_0x381d4a(++_0x492026);}(_0xe23a,0xde));var _0xae23=function(_0x2e6dee,_0x1a61b0){_0x2e6dee=_0x2e6dee-0x0;var _0x47706=_0xe23a[_0x2e6dee];return _0x47706;};'use strict';var Sequelize=require(_0xae23('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xae23('0x1')]},'scheduledat':{'type':Sequelize[_0xae23('0x2')]},'countbusyretry':{'type':Sequelize[_0xae23('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xae23('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xae23('0x1')]},'originatecalleridnum':{'type':Sequelize[_0xae23('0x1')]},'originatecalleridname':{'type':Sequelize[_0xae23('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xae23('0x2')]},'responsetime':{'type':Sequelize[_0xae23('0x2')]},'answertime':{'type':Sequelize[_0xae23('0x2')]},'droptime':{'type':Sequelize[_0xae23('0x2')]},'endtime':{'type':Sequelize[_0xae23('0x2')]},'ringtime':{'type':Sequelize[_0xae23('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xae23('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xae23('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xae23('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xae23('0x1')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xae23('0x1')]},'reason':{'type':Sequelize[_0xae23('0x1')]},'amd':{'type':Sequelize[_0xae23('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xae23('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xae23('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xae23('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xae23('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xae23('0x2')]},'edited':{'type':Sequelize[_0xae23('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xae23('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xae23('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xae23('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xae23('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1c2f=['INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c2f,0x1f3));var _0xf1c2=function(_0x42a572,_0x580f6c){_0x42a572=_0x42a572-0x0;var _0x3dc541=_0x1c2f[_0x42a572];return _0x3dc541;};'use strict';var Sequelize=require(_0xf1c2('0x0'));module['exports']={'state':{'type':Sequelize[_0xf1c2('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xf1c2('0x2')]},'scheduledat':{'type':Sequelize[_0xf1c2('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf1c2('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf1c2('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xf1c2('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xf1c2('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xf1c2('0x2')]},'originatecalleridname':{'type':Sequelize[_0xf1c2('0x2')]},'calleridnum':{'type':Sequelize[_0xf1c2('0x2')]},'calleridname':{'type':Sequelize[_0xf1c2('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xf1c2('0x3')]},'answertime':{'type':Sequelize[_0xf1c2('0x3')]},'droptime':{'type':Sequelize[_0xf1c2('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xf1c2('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xf1c2('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xf1c2('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xf1c2('0x2')]},'campaign':{'type':Sequelize[_0xf1c2('0x2')]},'campaigntype':{'type':Sequelize[_0xf1c2('0x2')]},'membername':{'type':Sequelize[_0xf1c2('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xf1c2('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xf1c2('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xf1c2('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf1c2('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf1c2('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xf1c2('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf1c2('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf1c2('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf1c2('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf1c2('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index a880270..4093ccc 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 _0xb49c=['model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','describe','uniqueid','eml-format','fast-json-patch','request-promise','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','error','stack','name','index','map','CmHopperHistory','rawAttributes','fieldName','type','key'];(function(_0x1600c7,_0x25caf0){var _0x2fffc9=function(_0x55e01b){while(--_0x55e01b){_0x1600c7['push'](_0x1600c7['shift']());}};_0x2fffc9(++_0x25caf0);}(_0xb49c,0x66));var _0xcb49=function(_0x36c21b,_0x3d305c){_0x36c21b=_0x36c21b-0x0;var _0x101bf1=_0xb49c[_0x36c21b];return _0x101bf1;};'use strict';var emlformat=require(_0xcb49('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcb49('0x1'));var rp=require(_0xcb49('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcb49('0x3'));var util=require('util');var path=require(_0xcb49('0x4'));var sox=require(_0xcb49('0x5'));var csv=require('to-csv');var ejs=require(_0xcb49('0x6'));var fs=require('fs');var fs_extra=require(_0xcb49('0x7'));var _=require(_0xcb49('0x8'));var squel=require(_0xcb49('0x9'));var crypto=require('crypto');var jsforce=require(_0xcb49('0xa'));var deskjs=require(_0xcb49('0xb'));var toCsv=require(_0xcb49('0xc'));var querystring=require(_0xcb49('0xd'));var Papa=require('papaparse');var Redis=require(_0xcb49('0xe'));var authService=require(_0xcb49('0xf'));var qs=require(_0xcb49('0x10'));var as=require(_0xcb49('0x11'));var hardwareService=require(_0xcb49('0x12'));var logger=require(_0xcb49('0x13'))(_0xcb49('0x14'));var utils=require(_0xcb49('0x15'));var config=require(_0xcb49('0x16'));var licenseUtil=require(_0xcb49('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x356060,_0x4fbe02){_0x4fbe02=_0x4fbe02||0xcc;return function(_0x488477){if(_0x488477){return _0x356060[_0xcb49('0x18')](_0x4fbe02);}return _0x356060['status'](_0x4fbe02)[_0xcb49('0x19')]();};}function respondWithResult(_0x2ddcd0,_0x401168){_0x401168=_0x401168||0xc8;return function(_0x4a969e){if(_0x4a969e){return _0x2ddcd0[_0xcb49('0x1a')](_0x401168)[_0xcb49('0x1b')](_0x4a969e);}};}function respondWithFilteredResult(_0x28728f,_0x1c0d15){return function(_0x435424){if(_0x435424){var _0x679979=typeof _0x1c0d15[_0xcb49('0x1c')]===_0xcb49('0x1d')&&typeof _0x1c0d15[_0xcb49('0x1e')]===_0xcb49('0x1d');var _0x2d0455=_0x435424['count'];var _0x35ab31=_0x679979?0x0:_0x1c0d15[_0xcb49('0x1c')];var _0x3dbba4=_0x679979?_0x435424[_0xcb49('0x1f')]:_0x1c0d15[_0xcb49('0x1c')]+_0x1c0d15[_0xcb49('0x1e')];var _0x586d3b;if(_0x3dbba4>=_0x2d0455){_0x3dbba4=_0x2d0455;_0x586d3b=0xc8;}else{_0x586d3b=0xce;}_0x28728f[_0xcb49('0x1a')](_0x586d3b);return _0x28728f['set'](_0xcb49('0x20'),_0x35ab31+'-'+_0x3dbba4+'/'+_0x2d0455)[_0xcb49('0x1b')](_0x435424);}return null;};}function patchUpdates(_0x289e43){return function(_0x14affe){try{jsonpatch[_0xcb49('0x21')](_0x14affe,_0x289e43,!![]);}catch(_0x3b26e8){return BPromise['reject'](_0x3b26e8);}return _0x14affe[_0xcb49('0x22')]();};}function saveUpdates(_0x5e1a6c,_0x1ad59c){return function(_0x3b765b){if(_0x3b765b){return _0x3b765b[_0xcb49('0x23')](_0x5e1a6c)['then'](function(_0x5dcf04){return _0x5dcf04;});}return null;};}function removeEntity(_0x268884,_0xb9e620){return function(_0x42a5eb){if(_0x42a5eb){return _0x42a5eb[_0xcb49('0x24')]()[_0xcb49('0x25')](function(){_0x268884[_0xcb49('0x1a')](0xcc)[_0xcb49('0x19')]();});}};}function handleEntityNotFound(_0x2d5259,_0x39acd3){return function(_0x35db13){if(!_0x35db13){_0x2d5259[_0xcb49('0x18')](0x194);}return _0x35db13;};}function handleError(_0x414d1c,_0x4faad9){_0x4faad9=_0x4faad9||0x1f4;return function(_0x27947a){logger[_0xcb49('0x26')](_0x27947a[_0xcb49('0x27')]);if(_0x27947a[_0xcb49('0x28')]){delete _0x27947a[_0xcb49('0x28')];}_0x414d1c['status'](_0x4faad9)['send'](_0x27947a);};}exports[_0xcb49('0x29')]=function(_0x4d488,_0x1315e4){var _0xe6f538={},_0xc063d9={},_0x547ff0={'count':0x0,'rows':[]};var _0x54e799=_[_0xcb49('0x2a')](db[_0xcb49('0x2b')][_0xcb49('0x2c')],function(_0x127107){return{'name':_0x127107[_0xcb49('0x2d')],'type':_0x127107[_0xcb49('0x2e')][_0xcb49('0x2f')]};});_0xc063d9[_0xcb49('0x30')]=_[_0xcb49('0x2a')](_0x54e799,_0xcb49('0x28'));_0xc063d9['query']=_[_0xcb49('0x31')](_0x4d488[_0xcb49('0x32')]);_0xc063d9['filters']=_[_0xcb49('0x33')](_0xc063d9[_0xcb49('0x30')],_0xc063d9['query']);_0xe6f538[_0xcb49('0x34')]=_[_0xcb49('0x33')](_0xc063d9[_0xcb49('0x30')],qs[_0xcb49('0x35')](_0x4d488['query']['fields']));_0xe6f538[_0xcb49('0x34')]=_0xe6f538[_0xcb49('0x34')][_0xcb49('0x36')]?_0xe6f538[_0xcb49('0x34')]:_0xc063d9['model'];if(!_0x4d488[_0xcb49('0x32')]['hasOwnProperty'](_0xcb49('0x37'))){_0xe6f538[_0xcb49('0x1e')]=qs['limit'](_0x4d488[_0xcb49('0x32')]['limit']);_0xe6f538[_0xcb49('0x1c')]=qs[_0xcb49('0x1c')](_0x4d488[_0xcb49('0x32')]['offset']);}_0xe6f538[_0xcb49('0x38')]=qs[_0xcb49('0x39')](_0x4d488[_0xcb49('0x32')][_0xcb49('0x39')]);_0xe6f538[_0xcb49('0x3a')]=qs[_0xcb49('0x3b')](_[_0xcb49('0x3c')](_0x4d488[_0xcb49('0x32')],_0xc063d9['filters']),_0x54e799);if(_0x4d488['query']['filter']){_0xe6f538['where']=_[_0xcb49('0x3d')](_0xe6f538[_0xcb49('0x3a')],{'$or':_['map'](_0x54e799,function(_0x182ad3){if(_0x182ad3['type']!==_0xcb49('0x3e')){var _0x139745={};_0x139745[_0x182ad3[_0xcb49('0x28')]]={'$like':'%'+_0x4d488[_0xcb49('0x32')]['filter']+'%'};return _0x139745;}})});}_0xe6f538=_[_0xcb49('0x3d')]({},_0xe6f538,_0x4d488[_0xcb49('0x3f')]);var _0x4d281e={'where':_0xe6f538[_0xcb49('0x3a')]};return db[_0xcb49('0x2b')][_0xcb49('0x1f')](_0x4d281e)['then'](function(_0x10a796){_0x547ff0[_0xcb49('0x1f')]=_0x10a796;if(_0x4d488[_0xcb49('0x32')][_0xcb49('0x40')]){_0xe6f538[_0xcb49('0x41')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0xe6f538);})[_0xcb49('0x25')](function(_0x48a856){_0x547ff0[_0xcb49('0x42')]=_0x48a856;return _0x547ff0;})[_0xcb49('0x25')](respondWithFilteredResult(_0x1315e4,_0xe6f538))[_0xcb49('0x43')](handleError(_0x1315e4,null));};exports[_0xcb49('0x44')]=function(_0x2325f5,_0x2846a5){var _0x42225a={'raw':!![],'where':{'id':_0x2325f5[_0xcb49('0x45')]['id']}},_0x56a91d={};_0x56a91d['model']=_[_0xcb49('0x31')](db['CmHopperHistory'][_0xcb49('0x2c')]);_0x56a91d[_0xcb49('0x32')]=_[_0xcb49('0x31')](_0x2325f5[_0xcb49('0x32')]);_0x56a91d['filters']=_[_0xcb49('0x33')](_0x56a91d[_0xcb49('0x30')],_0x56a91d[_0xcb49('0x32')]);_0x42225a[_0xcb49('0x34')]=_['intersection'](_0x56a91d[_0xcb49('0x30')],qs[_0xcb49('0x35')](_0x2325f5[_0xcb49('0x32')]['fields']));_0x42225a[_0xcb49('0x34')]=_0x42225a[_0xcb49('0x34')][_0xcb49('0x36')]?_0x42225a[_0xcb49('0x34')]:_0x56a91d[_0xcb49('0x30')];if(_0x2325f5[_0xcb49('0x32')][_0xcb49('0x40')]){_0x42225a[_0xcb49('0x41')]=[{'all':!![]}];}_0x42225a=_['merge']({},_0x42225a,_0x2325f5[_0xcb49('0x3f')]);return db[_0xcb49('0x2b')][_0xcb49('0x46')](_0x42225a)[_0xcb49('0x25')](handleEntityNotFound(_0x2846a5,null))[_0xcb49('0x25')](respondWithResult(_0x2846a5,null))[_0xcb49('0x43')](handleError(_0x2846a5,null));};exports[_0xcb49('0x47')]=function(_0x3ba2e8,_0x381f8f){return db[_0xcb49('0x2b')][_0xcb49('0x47')](_0x3ba2e8[_0xcb49('0x48')],{})[_0xcb49('0x25')](respondWithResult(_0x381f8f,0xc9))[_0xcb49('0x43')](handleError(_0x381f8f,null));};exports[_0xcb49('0x49')]=function(_0x36c2de,_0x58a48d){return db[_0xcb49('0x2b')]['describe']()['then'](respondWithResult(_0x58a48d,null))['catch'](handleError(_0x58a48d,null));};exports['update']=function(_0x39757b,_0x179946){if(_0x39757b['body'][_0xcb49('0x4a')]){delete _0x39757b['body'][_0xcb49('0x4a')];}return db[_0xcb49('0x2b')][_0xcb49('0x46')]({'where':{'uniqueid':_0x39757b[_0xcb49('0x45')]['id']}})[_0xcb49('0x25')](handleEntityNotFound(_0x179946,null))['then'](saveUpdates(_0x39757b[_0xcb49('0x48')],null))[_0xcb49('0x25')](respondWithResult(_0x179946,null))[_0xcb49('0x43')](handleError(_0x179946,null));}; \ No newline at end of file +var _0xa866=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','end','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','type','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','findAll','rows','show','params','keys','intersection','find','create','body','describe','catch','update','uniqueid','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x1c633e,_0x27493c){var _0x2a3fcf=function(_0x291288){while(--_0x291288){_0x1c633e['push'](_0x1c633e['shift']());}};_0x2a3fcf(++_0x27493c);}(_0xa866,0x8e));var _0x6a86=function(_0x2c7e3f,_0x47ba45){_0x2c7e3f=_0x2c7e3f-0x0;var _0x5d4bbd=_0xa866[_0x2c7e3f];return _0x5d4bbd;};'use strict';var emlformat=require(_0x6a86('0x0'));var rimraf=require(_0x6a86('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6a86('0x2'));var rp=require(_0x6a86('0x3'));var moment=require(_0x6a86('0x4'));var BPromise=require(_0x6a86('0x5'));var Mustache=require(_0x6a86('0x6'));var util=require(_0x6a86('0x7'));var path=require(_0x6a86('0x8'));var sox=require(_0x6a86('0x9'));var csv=require(_0x6a86('0xa'));var ejs=require(_0x6a86('0xb'));var fs=require('fs');var fs_extra=require(_0x6a86('0xc'));var _=require(_0x6a86('0xd'));var squel=require(_0x6a86('0xe'));var crypto=require(_0x6a86('0xf'));var jsforce=require(_0x6a86('0x10'));var deskjs=require(_0x6a86('0x11'));var toCsv=require(_0x6a86('0xa'));var querystring=require(_0x6a86('0x12'));var Papa=require(_0x6a86('0x13'));var Redis=require(_0x6a86('0x14'));var authService=require(_0x6a86('0x15'));var qs=require(_0x6a86('0x16'));var as=require(_0x6a86('0x17'));var hardwareService=require(_0x6a86('0x18'));var logger=require(_0x6a86('0x19'))(_0x6a86('0x1a'));var utils=require('../../config/utils');var config=require(_0x6a86('0x1b'));var licenseUtil=require(_0x6a86('0x1c'));var db=require(_0x6a86('0x1d'))['db'];function respondWithStatusCode(_0xd2d0c5,_0x37e848){_0x37e848=_0x37e848||0xcc;return function(_0x5166d3){if(_0x5166d3){return _0xd2d0c5[_0x6a86('0x1e')](_0x37e848);}return _0xd2d0c5['status'](_0x37e848)['end']();};}function respondWithResult(_0x55e7ac,_0x12178f){_0x12178f=_0x12178f||0xc8;return function(_0x7d9120){if(_0x7d9120){return _0x55e7ac[_0x6a86('0x1f')](_0x12178f)[_0x6a86('0x20')](_0x7d9120);}};}function respondWithFilteredResult(_0x568695,_0x4dfac5){return function(_0x2278ad){if(_0x2278ad){var _0x57ff52=typeof _0x4dfac5[_0x6a86('0x21')]==='undefined'&&typeof _0x4dfac5[_0x6a86('0x22')]===_0x6a86('0x23');var _0x2bba4a=_0x2278ad[_0x6a86('0x24')];var _0x5d74a1=_0x57ff52?0x0:_0x4dfac5[_0x6a86('0x21')];var _0x1ba087=_0x57ff52?_0x2278ad[_0x6a86('0x24')]:_0x4dfac5['offset']+_0x4dfac5['limit'];var _0x1c6e86;if(_0x1ba087>=_0x2bba4a){_0x1ba087=_0x2bba4a;_0x1c6e86=0xc8;}else{_0x1c6e86=0xce;}_0x568695[_0x6a86('0x1f')](_0x1c6e86);return _0x568695[_0x6a86('0x25')](_0x6a86('0x26'),_0x5d74a1+'-'+_0x1ba087+'/'+_0x2bba4a)[_0x6a86('0x20')](_0x2278ad);}return null;};}function patchUpdates(_0x4d5fbb){return function(_0x11e793){try{jsonpatch[_0x6a86('0x27')](_0x11e793,_0x4d5fbb,!![]);}catch(_0x1a41d5){return BPromise[_0x6a86('0x28')](_0x1a41d5);}return _0x11e793['save']();};}function saveUpdates(_0x496483,_0x21b7b8){return function(_0xd89152){if(_0xd89152){return _0xd89152['update'](_0x496483)[_0x6a86('0x29')](function(_0x46b572){return _0x46b572;});}return null;};}function removeEntity(_0x498f30,_0x1980ff){return function(_0x41cba4){if(_0x41cba4){return _0x41cba4[_0x6a86('0x2a')]()[_0x6a86('0x29')](function(){_0x498f30['status'](0xcc)[_0x6a86('0x2b')]();});}};}function handleEntityNotFound(_0x2d2a3b,_0x522e89){return function(_0x449b8b){if(!_0x449b8b){_0x2d2a3b[_0x6a86('0x1e')](0x194);}return _0x449b8b;};}function handleError(_0x2e20e9,_0x3972b4){_0x3972b4=_0x3972b4||0x1f4;return function(_0x50d02d){logger[_0x6a86('0x2c')](_0x50d02d[_0x6a86('0x2d')]);if(_0x50d02d[_0x6a86('0x2e')]){delete _0x50d02d[_0x6a86('0x2e')];}_0x2e20e9[_0x6a86('0x1f')](_0x3972b4)[_0x6a86('0x2f')](_0x50d02d);};}exports[_0x6a86('0x30')]=function(_0x365476,_0x4f9466){var _0x50078e={},_0x25b948={},_0x4b66f4={'count':0x0,'rows':[]};var _0x7de529=_[_0x6a86('0x31')](db[_0x6a86('0x32')][_0x6a86('0x33')],function(_0x47e64e){return{'name':_0x47e64e['fieldName'],'type':_0x47e64e[_0x6a86('0x34')]['key']};});_0x25b948['model']=_[_0x6a86('0x31')](_0x7de529,'name');_0x25b948[_0x6a86('0x35')]=_['keys'](_0x365476[_0x6a86('0x35')]);_0x25b948[_0x6a86('0x36')]=_['intersection'](_0x25b948[_0x6a86('0x37')],_0x25b948[_0x6a86('0x35')]);_0x50078e[_0x6a86('0x38')]=_['intersection'](_0x25b948[_0x6a86('0x37')],qs[_0x6a86('0x39')](_0x365476['query'][_0x6a86('0x39')]));_0x50078e[_0x6a86('0x38')]=_0x50078e['attributes'][_0x6a86('0x3a')]?_0x50078e[_0x6a86('0x38')]:_0x25b948[_0x6a86('0x37')];if(!_0x365476[_0x6a86('0x35')][_0x6a86('0x3b')](_0x6a86('0x3c'))){_0x50078e[_0x6a86('0x22')]=qs[_0x6a86('0x22')](_0x365476[_0x6a86('0x35')][_0x6a86('0x22')]);_0x50078e[_0x6a86('0x21')]=qs[_0x6a86('0x21')](_0x365476['query'][_0x6a86('0x21')]);}_0x50078e[_0x6a86('0x3d')]=qs[_0x6a86('0x3e')](_0x365476[_0x6a86('0x35')]['sort']);_0x50078e[_0x6a86('0x3f')]=qs[_0x6a86('0x36')](_[_0x6a86('0x40')](_0x365476[_0x6a86('0x35')],_0x25b948[_0x6a86('0x36')]),_0x7de529);if(_0x365476[_0x6a86('0x35')]['filter']){_0x50078e['where']=_[_0x6a86('0x41')](_0x50078e['where'],{'$or':_[_0x6a86('0x31')](_0x7de529,function(_0x58cd2b){if(_0x58cd2b[_0x6a86('0x34')]!=='VIRTUAL'){var _0x28b05f={};_0x28b05f[_0x58cd2b[_0x6a86('0x2e')]]={'$like':'%'+_0x365476[_0x6a86('0x35')]['filter']+'%'};return _0x28b05f;}})});}_0x50078e=_[_0x6a86('0x41')]({},_0x50078e,_0x365476[_0x6a86('0x42')]);var _0x548e60={'where':_0x50078e[_0x6a86('0x3f')]};return db[_0x6a86('0x32')][_0x6a86('0x24')](_0x548e60)[_0x6a86('0x29')](function(_0x170847){_0x4b66f4[_0x6a86('0x24')]=_0x170847;if(_0x365476[_0x6a86('0x35')][_0x6a86('0x43')]){_0x50078e['include']=[{'all':!![]}];}return db[_0x6a86('0x32')][_0x6a86('0x44')](_0x50078e);})['then'](function(_0x4fbe21){_0x4b66f4[_0x6a86('0x45')]=_0x4fbe21;return _0x4b66f4;})[_0x6a86('0x29')](respondWithFilteredResult(_0x4f9466,_0x50078e))['catch'](handleError(_0x4f9466,null));};exports[_0x6a86('0x46')]=function(_0x27f511,_0x10edee){var _0x284fa9={'raw':!![],'where':{'id':_0x27f511[_0x6a86('0x47')]['id']}},_0x298696={};_0x298696['model']=_[_0x6a86('0x48')](db[_0x6a86('0x32')][_0x6a86('0x33')]);_0x298696[_0x6a86('0x35')]=_[_0x6a86('0x48')](_0x27f511[_0x6a86('0x35')]);_0x298696[_0x6a86('0x36')]=_[_0x6a86('0x49')](_0x298696[_0x6a86('0x37')],_0x298696[_0x6a86('0x35')]);_0x284fa9[_0x6a86('0x38')]=_[_0x6a86('0x49')](_0x298696[_0x6a86('0x37')],qs[_0x6a86('0x39')](_0x27f511['query'][_0x6a86('0x39')]));_0x284fa9[_0x6a86('0x38')]=_0x284fa9[_0x6a86('0x38')]['length']?_0x284fa9[_0x6a86('0x38')]:_0x298696[_0x6a86('0x37')];if(_0x27f511['query'][_0x6a86('0x43')]){_0x284fa9['include']=[{'all':!![]}];}_0x284fa9=_[_0x6a86('0x41')]({},_0x284fa9,_0x27f511[_0x6a86('0x42')]);return db[_0x6a86('0x32')][_0x6a86('0x4a')](_0x284fa9)['then'](handleEntityNotFound(_0x10edee,null))[_0x6a86('0x29')](respondWithResult(_0x10edee,null))['catch'](handleError(_0x10edee,null));};exports[_0x6a86('0x4b')]=function(_0x4b291a,_0x20917c){return db[_0x6a86('0x32')][_0x6a86('0x4b')](_0x4b291a[_0x6a86('0x4c')],{})[_0x6a86('0x29')](respondWithResult(_0x20917c,0xc9))['catch'](handleError(_0x20917c,null));};exports[_0x6a86('0x4d')]=function(_0x25e718,_0x23ab3d){return db[_0x6a86('0x32')][_0x6a86('0x4d')]()[_0x6a86('0x29')](respondWithResult(_0x23ab3d,null))[_0x6a86('0x4e')](handleError(_0x23ab3d,null));};exports[_0x6a86('0x4f')]=function(_0x54f27f,_0xd8e898){if(_0x54f27f['body'][_0x6a86('0x50')]){delete _0x54f27f[_0x6a86('0x4c')][_0x6a86('0x50')];}return db[_0x6a86('0x32')][_0x6a86('0x4a')]({'where':{'uniqueid':_0x54f27f['params']['id']}})[_0x6a86('0x29')](handleEntityNotFound(_0xd8e898,null))[_0x6a86('0x29')](saveUpdates(_0x54f27f['body'],null))[_0x6a86('0x29')](respondWithResult(_0xd8e898,null))[_0x6a86('0x4e')](handleError(_0xd8e898,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index fbb86b9..946b3ca 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 _0x94e6=['bluebird','request-promise','path','../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory','endtime','lodash','../../config/logger','api','moment'];(function(_0x3617a5,_0x20863a){var _0x5ee893=function(_0x382888){while(--_0x382888){_0x3617a5['push'](_0x3617a5['shift']());}};_0x5ee893(++_0x20863a);}(_0x94e6,0x194));var _0x694e=function(_0x83c61f,_0x584a19){_0x83c61f=_0x83c61f-0x0;var _0x5cf1d2=_0x94e6[_0x83c61f];return _0x5cf1d2;};'use strict';var _=require(_0x694e('0x0'));var util=require('util');var logger=require(_0x694e('0x1'))(_0x694e('0x2'));var moment=require(_0x694e('0x3'));var BPromise=require(_0x694e('0x4'));var rp=require(_0x694e('0x5'));var fs=require('fs');var path=require(_0x694e('0x6'));var rimraf=require('rimraf');var config=require(_0x694e('0x7'));var attributes=require(_0x694e('0x8'));module['exports']=function(_0x59abaf,_0x43238f){return _0x59abaf[_0x694e('0x9')](_0x694e('0xa'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':[_0x694e('0xb')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7382=['CmHopperHistory','endtime','uniqueid','util','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define'];(function(_0x36da68,_0x5622fd){var _0x4eb8ee=function(_0x4cc3b7){while(--_0x4cc3b7){_0x36da68['push'](_0x36da68['shift']());}};_0x4eb8ee(++_0x5622fd);}(_0x7382,0x111));var _0x2738=function(_0x1bacac,_0x39d59d){_0x1bacac=_0x1bacac-0x0;var _0x5793ab=_0x7382[_0x1bacac];return _0x5793ab;};'use strict';var _=require('lodash');var util=require(_0x2738('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2738('0x1'));var rimraf=require(_0x2738('0x2'));var config=require(_0x2738('0x3'));var attributes=require(_0x2738('0x4'));module[_0x2738('0x5')]=function(_0x5bb77c,_0x1958d2){return _0x5bb77c[_0x2738('0x6')](_0x2738('0x7'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x2738('0x8'),'fields':[_0x2738('0x8')]},{'name':_0x2738('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 59e03c0..0972115 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 _0xde71=['outboundReCallsDay','GetCampaignHopperHistory','name','ivrTotalCallsDays','`state`\x20=\x204,\x201,\x20null','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','CmHopperHistory,\x20%s,\x20%s','message','catch','create','options','CreateCmHopperHistory','findAll','raw','where','sequelize','COUNT','col','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','CmHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\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'];(function(_0x48b5a2,_0x5014c7){var _0xc7f542=function(_0xa288f5){while(--_0xa288f5){_0x48b5a2['push'](_0x48b5a2['shift']());}};_0xc7f542(++_0x5014c7);}(_0xde71,0x1c1));var _0x1de7=function(_0x31295c,_0x2f2b82){_0x31295c=_0x31295c-0x0;var _0x2c150e=_0xde71[_0x31295c];return _0x2c150e;};'use strict';var _=require(_0x1de7('0x0'));var util=require(_0x1de7('0x1'));var moment=require(_0x1de7('0x2'));var BPromise=require(_0x1de7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1de7('0x4'));var db=require(_0x1de7('0x5'))['db'];var utils=require(_0x1de7('0x6'));var logger=require(_0x1de7('0x7'))(_0x1de7('0x8'));var config=require(_0x1de7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1de7('0xa')][_0x1de7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8efed1,_0x1c92d9,_0x3a2f08){return new BPromise(function(_0x58a35f,_0x52940d){return client[_0x1de7('0xc')](_0x8efed1,_0x3a2f08)[_0x1de7('0xd')](function(_0x37383f){logger[_0x1de7('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x1c92d9,'request\x20sent');logger[_0x1de7('0xf')](_0x1de7('0x10'),_0x1c92d9,_0x1de7('0x11'),JSON[_0x1de7('0x12')](_0x37383f));if(_0x37383f['error']){if(_0x37383f['error'][_0x1de7('0x13')]===0x1f4){logger[_0x1de7('0x14')](_0x1de7('0x15'),_0x1c92d9,_0x37383f[_0x1de7('0x14')][_0x1de7('0x16')]);return _0x52940d(_0x37383f[_0x1de7('0x14')][_0x1de7('0x16')]);}logger[_0x1de7('0x14')](_0x1de7('0x15'),_0x1c92d9,_0x37383f['error'][_0x1de7('0x16')]);return _0x58a35f(_0x37383f['error']['message']);}else{logger['info'](_0x1de7('0x15'),_0x1c92d9,_0x1de7('0x11'));_0x58a35f(_0x37383f['result']['message']);}})[_0x1de7('0x17')](function(_0x2592c1){logger[_0x1de7('0x14')](_0x1de7('0x15'),_0x1c92d9,_0x2592c1);_0x52940d(_0x2592c1);});});}exports['CreateCmHopperHistory']=function(_0x1630d9){var _0x1bc2f7=this;return new Promise(function(_0x305c3a,_0x3b75d4){return db['CmHopperHistory'][_0x1de7('0x18')](_0x1630d9['body'],{'raw':_0x1630d9[_0x1de7('0x19')]?_0x1630d9[_0x1de7('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x24d123){logger[_0x1de7('0xe')](_0x1de7('0x1a'),_0x1630d9);logger['debug'](_0x1de7('0x1a'),_0x1630d9,JSON[_0x1de7('0x12')](_0x24d123));_0x305c3a(_0x24d123);})['catch'](function(_0xffd5cd){logger[_0x1de7('0x14')](_0x1de7('0x1a'),_0xffd5cd[_0x1de7('0x16')],_0x1630d9);_0x3b75d4(_0x1bc2f7[_0x1de7('0x14')](0x1f4,_0xffd5cd['message']));});});};exports['AvgHandleTime']=function(_0x574a06){var _0x32c80b=this;return new Promise(function(_0x5da0b2,_0x41b3d7){return db['CmHopperHistory'][_0x1de7('0x1b')]({'raw':_0x574a06[_0x1de7('0x19')]?_0x574a06[_0x1de7('0x19')][_0x1de7('0x1c')]===undefined?!![]:![]:!![],'where':_0x574a06[_0x1de7('0x19')]?_0x574a06['options'][_0x1de7('0x1d')]||null:null,'attributes':[[db[_0x1de7('0x1e')]['fn'](_0x1de7('0x1f'),db['sequelize'][_0x1de7('0x20')]('id')),'predictiveIntervalTotalCalls'],[db[_0x1de7('0x1e')]['fn'](_0x1de7('0x1f'),db[_0x1de7('0x1e')]['fn']('IF',db[_0x1de7('0x1e')][_0x1de7('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0x1de7('0x22')],[db[_0x1de7('0x1e')]['fn']('COUNT',db[_0x1de7('0x1e')]['fn']('IF',db['sequelize'][_0x1de7('0x21')](_0x1de7('0x23')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x1de7('0x1e')]['fn']('COUNT',db[_0x1de7('0x1e')]['fn']('IF',db[_0x1de7('0x1e')][_0x1de7('0x21')](_0x1de7('0x24')))),_0x1de7('0x25')],[db['sequelize']['fn'](_0x1de7('0x26'),db['sequelize']['fn']('IF',db[_0x1de7('0x1e')][_0x1de7('0x21')](_0x1de7('0x27')))),_0x1de7('0x28')],[db[_0x1de7('0x1e')]['fn'](_0x1de7('0x26'),db[_0x1de7('0x1e')]['fn']('IF',db[_0x1de7('0x1e')]['literal'](_0x1de7('0x29')))),_0x1de7('0x2a')]]})[_0x1de7('0xd')](function(_0x5eb0f2){logger['info'](_0x1de7('0x2b'),_0x574a06);logger[_0x1de7('0xf')](_0x1de7('0x2b'),_0x574a06,JSON[_0x1de7('0x12')](_0x5eb0f2));_0x5da0b2(_0x5eb0f2);})[_0x1de7('0x17')](function(_0x35d0cf){logger['error']('AvgHandleTime',_0x35d0cf[_0x1de7('0x16')],_0x574a06);_0x41b3d7(_0x32c80b['error'](0x1f4,_0x35d0cf[_0x1de7('0x16')]));});});};exports[_0x1de7('0x2c')]=function(_0x368da5){var _0x2db375=this;return new Promise(function(_0x24c8a9,_0x432ac2){return db[_0x1de7('0x2d')][_0x1de7('0x1b')]({'raw':_0x368da5[_0x1de7('0x19')]?_0x368da5[_0x1de7('0x19')][_0x1de7('0x1c')]===undefined?!![]:![]:!![],'where':_0x368da5[_0x1de7('0x19')]?_0x368da5[_0x1de7('0x19')][_0x1de7('0x1d')]||null:null,'attributes':[[_0x1de7('0x2e'),'name'],[db[_0x1de7('0x1e')]['fn'](_0x1de7('0x1f'),db[_0x1de7('0x1e')]['fn']('IF',db[_0x1de7('0x1e')][_0x1de7('0x21')](_0x1de7('0x2f')))),'outboundNoSuchCallsDay'],[db[_0x1de7('0x1e')]['fn']('COUNT',db[_0x1de7('0x1e')]['fn']('IF',db[_0x1de7('0x1e')][_0x1de7('0x21')](_0x1de7('0x30')))),_0x1de7('0x31')],[db[_0x1de7('0x1e')]['fn'](_0x1de7('0x1f'),db[_0x1de7('0x1e')]['fn']('IF',db[_0x1de7('0x1e')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x1de7('0x32')],[db[_0x1de7('0x1e')]['fn'](_0x1de7('0x1f'),db['sequelize']['fn']('IF',db[_0x1de7('0x1e')][_0x1de7('0x21')](_0x1de7('0x33')))),_0x1de7('0x34')],[db[_0x1de7('0x1e')]['fn'](_0x1de7('0x1f'),db[_0x1de7('0x1e')]['fn']('IF',db[_0x1de7('0x1e')][_0x1de7('0x21')](_0x1de7('0x35')))),_0x1de7('0x36')],[db['sequelize']['fn'](_0x1de7('0x1f'),db[_0x1de7('0x1e')]['fn']('IF',db[_0x1de7('0x1e')]['literal'](_0x1de7('0x37')))),_0x1de7('0x38')],[db[_0x1de7('0x1e')]['fn'](_0x1de7('0x1f'),db['sequelize']['fn']('IF',db[_0x1de7('0x1e')][_0x1de7('0x21')](_0x1de7('0x39')))),_0x1de7('0x3a')],[db['sequelize']['fn'](_0x1de7('0x1f'),db['sequelize']['fn']('IF',db[_0x1de7('0x1e')][_0x1de7('0x21')](_0x1de7('0x3b')))),'outboundUnknownCallsDay'],[db[_0x1de7('0x1e')]['fn'](_0x1de7('0x1f'),db[_0x1de7('0x1e')]['fn']('IF',db[_0x1de7('0x1e')][_0x1de7('0x21')]('`state`\x20=\x2013,\x201,\x20null'))),_0x1de7('0x3c')],[db[_0x1de7('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x1de7('0x1e')]['literal'](_0x1de7('0x3d')))),_0x1de7('0x3e')],[db[_0x1de7('0x1e')]['fn'](_0x1de7('0x1f'),db[_0x1de7('0x1e')]['fn']('IF',db['sequelize'][_0x1de7('0x21')](_0x1de7('0x3f')))),_0x1de7('0x40')],[db[_0x1de7('0x1e')]['fn'](_0x1de7('0x1f'),db[_0x1de7('0x1e')]['fn']('IF',db[_0x1de7('0x1e')][_0x1de7('0x21')](_0x1de7('0x41')))),_0x1de7('0x42')],[db[_0x1de7('0x1e')]['fn']('COUNT',db[_0x1de7('0x1e')]['fn']('IF',db[_0x1de7('0x1e')][_0x1de7('0x21')](_0x1de7('0x43')))),_0x1de7('0x40')],[db[_0x1de7('0x1e')]['fn'](_0x1de7('0x1f'),db[_0x1de7('0x1e')]['fn']('IF',db[_0x1de7('0x1e')]['literal'](_0x1de7('0x44')))),_0x1de7('0x45')]],'group':[_0x1de7('0x2e')]})['then'](function(_0x4a799b){logger[_0x1de7('0xe')](_0x1de7('0x2c'),_0x368da5);logger['debug'](_0x1de7('0x2c'),_0x368da5,JSON['stringify'](_0x4a799b));_0x24c8a9(_0x4a799b);})['catch'](function(_0x41bf29){logger[_0x1de7('0x14')](_0x1de7('0x2c'),_0x41bf29['message'],_0x368da5);_0x432ac2(_0x2db375[_0x1de7('0x14')](0x1f4,_0x41bf29[_0x1de7('0x16')]));});});};exports[_0x1de7('0x46')]=function(_0x3a23b7){var _0x579321=this;return new Promise(function(_0x15b26e,_0x2d140d){return db['CmHopperHistory'][_0x1de7('0x1b')]({'raw':_0x3a23b7[_0x1de7('0x19')]?_0x3a23b7[_0x1de7('0x19')][_0x1de7('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a23b7[_0x1de7('0x19')]?_0x3a23b7[_0x1de7('0x19')][_0x1de7('0x1d')]||null:null,'attributes':[[_0x1de7('0x2e'),_0x1de7('0x47')],[db[_0x1de7('0x1e')]['fn']('COUNT',db[_0x1de7('0x1e')][_0x1de7('0x20')]('id')),_0x1de7('0x48')],[db[_0x1de7('0x1e')]['fn'](_0x1de7('0x1f'),db[_0x1de7('0x1e')]['fn']('IF',db[_0x1de7('0x1e')][_0x1de7('0x21')](_0x1de7('0x49')))),'ivrAnswerCallsDay']],'group':['campaign']})[_0x1de7('0xd')](function(_0x38ac74){logger['info'](_0x1de7('0x46'),_0x3a23b7);logger[_0x1de7('0xf')](_0x1de7('0x46'),_0x3a23b7,JSON['stringify'](_0x38ac74));_0x15b26e(_0x38ac74);})[_0x1de7('0x17')](function(_0x4b2f5a){logger['error'](_0x1de7('0x46'),_0x4b2f5a['message'],_0x3a23b7);_0x2d140d(_0x579321[_0x1de7('0x14')](0x1f4,_0x4b2f5a[_0x1de7('0x16')]));});});}; \ No newline at end of file +var _0x32e3=['body','options','raw','info','catch','AvgHandleTime','findAll','where','COUNT','col','predictiveIntervalTotalCalls','sequelize','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','CmHopperHistory,\x20%s,\x20%s','message','CreateCmHopperHistory','CmHopperHistory','create'];(function(_0x263d7d,_0x4fe765){var _0x510b6d=function(_0x5e2f98){while(--_0x5e2f98){_0x263d7d['push'](_0x263d7d['shift']());}};_0x510b6d(++_0x4fe765);}(_0x32e3,0x104));var _0x332e=function(_0x4cd41d,_0x105b86){_0x4cd41d=_0x4cd41d-0x0;var _0x48e136=_0x32e3[_0x4cd41d];return _0x48e136;};'use strict';var _=require('lodash');var util=require(_0x332e('0x0'));var moment=require(_0x332e('0x1'));var BPromise=require(_0x332e('0x2'));var rs=require(_0x332e('0x3'));var fs=require('fs');var Redis=require(_0x332e('0x4'));var db=require(_0x332e('0x5'))['db'];var utils=require(_0x332e('0x6'));var logger=require('../../config/logger')(_0x332e('0x7'));var config=require(_0x332e('0x8'));var jayson=require(_0x332e('0x9'));var client=jayson[_0x332e('0xa')][_0x332e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c1ee8,_0x2d4489,_0x575f38){return new BPromise(function(_0x25fa7d,_0x4a134a){return client[_0x332e('0xc')](_0x2c1ee8,_0x575f38)[_0x332e('0xd')](function(_0x33f3d9){logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x2d4489,_0x332e('0xe'));logger[_0x332e('0xf')](_0x332e('0x10'),_0x2d4489,_0x332e('0xe'),JSON[_0x332e('0x11')](_0x33f3d9));if(_0x33f3d9[_0x332e('0x12')]){if(_0x33f3d9[_0x332e('0x12')]['code']===0x1f4){logger[_0x332e('0x12')](_0x332e('0x13'),_0x2d4489,_0x33f3d9['error']['message']);return _0x4a134a(_0x33f3d9['error'][_0x332e('0x14')]);}logger[_0x332e('0x12')](_0x332e('0x13'),_0x2d4489,_0x33f3d9[_0x332e('0x12')][_0x332e('0x14')]);return _0x25fa7d(_0x33f3d9[_0x332e('0x12')][_0x332e('0x14')]);}else{logger['info'](_0x332e('0x13'),_0x2d4489,'request\x20sent');_0x25fa7d(_0x33f3d9['result']['message']);}})['catch'](function(_0x6108e7){logger[_0x332e('0x12')](_0x332e('0x13'),_0x2d4489,_0x6108e7);_0x4a134a(_0x6108e7);});});}exports[_0x332e('0x15')]=function(_0x40cba8){var _0x3c8f4c=this;return new Promise(function(_0x1c953a,_0x35b8db){return db[_0x332e('0x16')][_0x332e('0x17')](_0x40cba8[_0x332e('0x18')],{'raw':_0x40cba8[_0x332e('0x19')]?_0x40cba8[_0x332e('0x19')][_0x332e('0x1a')]===undefined?!![]:![]:!![]})[_0x332e('0xd')](function(_0x44471d){logger[_0x332e('0x1b')](_0x332e('0x15'),_0x40cba8);logger['debug'](_0x332e('0x15'),_0x40cba8,JSON['stringify'](_0x44471d));_0x1c953a(_0x44471d);})[_0x332e('0x1c')](function(_0x397674){logger['error'](_0x332e('0x15'),_0x397674[_0x332e('0x14')],_0x40cba8);_0x35b8db(_0x3c8f4c[_0x332e('0x12')](0x1f4,_0x397674[_0x332e('0x14')]));});});};exports[_0x332e('0x1d')]=function(_0x4d6e41){var _0x3e4e2c=this;return new Promise(function(_0x4cd82f,_0x49e7a1){return db[_0x332e('0x16')][_0x332e('0x1e')]({'raw':_0x4d6e41['options']?_0x4d6e41[_0x332e('0x19')][_0x332e('0x1a')]===undefined?!![]:![]:!![],'where':_0x4d6e41[_0x332e('0x19')]?_0x4d6e41[_0x332e('0x19')][_0x332e('0x1f')]||null:null,'attributes':[[db['sequelize']['fn'](_0x332e('0x20'),db['sequelize'][_0x332e('0x21')]('id')),_0x332e('0x22')],[db['sequelize']['fn'](_0x332e('0x20'),db['sequelize']['fn']('IF',db[_0x332e('0x23')][_0x332e('0x24')](_0x332e('0x25')))),_0x332e('0x26')],[db[_0x332e('0x23')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x332e('0x23')]['literal'](_0x332e('0x27')))),_0x332e('0x28')],[db[_0x332e('0x23')]['fn'](_0x332e('0x20'),db[_0x332e('0x23')]['fn']('IF',db[_0x332e('0x23')][_0x332e('0x24')](_0x332e('0x29')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x332e('0x23')]['fn'](_0x332e('0x2a'),db[_0x332e('0x23')]['fn']('IF',db[_0x332e('0x23')][_0x332e('0x24')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x332e('0x2b')],[db[_0x332e('0x23')]['fn'](_0x332e('0x2a'),db[_0x332e('0x23')]['fn']('IF',db[_0x332e('0x23')][_0x332e('0x24')](_0x332e('0x2c')))),_0x332e('0x2d')]]})[_0x332e('0xd')](function(_0x97935e){logger[_0x332e('0x1b')](_0x332e('0x1d'),_0x4d6e41);logger[_0x332e('0xf')](_0x332e('0x1d'),_0x4d6e41,JSON[_0x332e('0x11')](_0x97935e));_0x4cd82f(_0x97935e);})[_0x332e('0x1c')](function(_0x4ae50c){logger['error'](_0x332e('0x1d'),_0x4ae50c['message'],_0x4d6e41);_0x49e7a1(_0x3e4e2c['error'](0x1f4,_0x4ae50c[_0x332e('0x14')]));});});};exports[_0x332e('0x2e')]=function(_0x4287a3){var _0x5d4d10=this;return new Promise(function(_0x2c5ee8,_0x5114e7){return db['CmHopperHistory'][_0x332e('0x1e')]({'raw':_0x4287a3['options']?_0x4287a3[_0x332e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4287a3['options']?_0x4287a3[_0x332e('0x19')][_0x332e('0x1f')]||null:null,'attributes':[[_0x332e('0x2f'),_0x332e('0x30')],[db[_0x332e('0x23')]['fn']('COUNT',db[_0x332e('0x23')]['fn']('IF',db[_0x332e('0x23')][_0x332e('0x24')](_0x332e('0x31')))),'outboundNoSuchCallsDay'],[db[_0x332e('0x23')]['fn'](_0x332e('0x20'),db[_0x332e('0x23')]['fn']('IF',db[_0x332e('0x23')]['literal'](_0x332e('0x32')))),_0x332e('0x33')],[db[_0x332e('0x23')]['fn'](_0x332e('0x20'),db['sequelize']['fn']('IF',db[_0x332e('0x23')][_0x332e('0x24')](_0x332e('0x25')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0x332e('0x20'),db[_0x332e('0x23')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x332e('0x34')],[db[_0x332e('0x23')]['fn'](_0x332e('0x20'),db[_0x332e('0x23')]['fn']('IF',db[_0x332e('0x23')][_0x332e('0x24')](_0x332e('0x35')))),_0x332e('0x36')],[db[_0x332e('0x23')]['fn'](_0x332e('0x20'),db['sequelize']['fn']('IF',db[_0x332e('0x23')][_0x332e('0x24')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x332e('0x37')],[db[_0x332e('0x23')]['fn'](_0x332e('0x20'),db['sequelize']['fn']('IF',db[_0x332e('0x23')][_0x332e('0x24')](_0x332e('0x38')))),_0x332e('0x39')],[db[_0x332e('0x23')]['fn'](_0x332e('0x20'),db[_0x332e('0x23')]['fn']('IF',db['sequelize']['literal'](_0x332e('0x3a')))),_0x332e('0x3b')],[db[_0x332e('0x23')]['fn'](_0x332e('0x20'),db[_0x332e('0x23')]['fn']('IF',db['sequelize'][_0x332e('0x24')](_0x332e('0x3c')))),_0x332e('0x3d')],[db[_0x332e('0x23')]['fn'](_0x332e('0x20'),db[_0x332e('0x23')]['fn']('IF',db['sequelize'][_0x332e('0x24')](_0x332e('0x3e')))),_0x332e('0x3f')],[db['sequelize']['fn'](_0x332e('0x20'),db[_0x332e('0x23')]['fn']('IF',db[_0x332e('0x23')]['literal'](_0x332e('0x40')))),_0x332e('0x41')],[db[_0x332e('0x23')]['fn'](_0x332e('0x20'),db[_0x332e('0x23')]['fn']('IF',db[_0x332e('0x23')][_0x332e('0x24')]('`state`\x20=\x2016,\x201,\x20null'))),_0x332e('0x42')],[db[_0x332e('0x23')]['fn'](_0x332e('0x20'),db[_0x332e('0x23')]['fn']('IF',db['sequelize'][_0x332e('0x24')]('`state`\x20=\x2020,\x201,\x20null'))),_0x332e('0x41')],[db['sequelize']['fn'](_0x332e('0x20'),db[_0x332e('0x23')]['fn']('IF',db[_0x332e('0x23')]['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x332e('0x43')]],'group':[_0x332e('0x2f')]})[_0x332e('0xd')](function(_0x17a2a0){logger[_0x332e('0x1b')](_0x332e('0x2e'),_0x4287a3);logger['debug'](_0x332e('0x2e'),_0x4287a3,JSON[_0x332e('0x11')](_0x17a2a0));_0x2c5ee8(_0x17a2a0);})['catch'](function(_0x4721e6){logger[_0x332e('0x12')](_0x332e('0x2e'),_0x4721e6[_0x332e('0x14')],_0x4287a3);_0x5114e7(_0x5d4d10[_0x332e('0x12')](0x1f4,_0x4721e6[_0x332e('0x14')]));});});};exports[_0x332e('0x44')]=function(_0x51f85c){var _0x33076f=this;return new Promise(function(_0x2d278b,_0x3e3d2d){return db[_0x332e('0x16')]['findAll']({'raw':_0x51f85c[_0x332e('0x19')]?_0x51f85c[_0x332e('0x19')][_0x332e('0x1a')]===undefined?!![]:![]:!![],'where':_0x51f85c[_0x332e('0x19')]?_0x51f85c[_0x332e('0x19')]['where']||null:null,'attributes':[['campaign','name'],[db['sequelize']['fn'](_0x332e('0x20'),db[_0x332e('0x23')][_0x332e('0x21')]('id')),_0x332e('0x45')],[db['sequelize']['fn'](_0x332e('0x20'),db[_0x332e('0x23')]['fn']('IF',db[_0x332e('0x23')][_0x332e('0x24')](_0x332e('0x25')))),_0x332e('0x46')]],'group':[_0x332e('0x2f')]})[_0x332e('0xd')](function(_0x120674){logger['info'](_0x332e('0x44'),_0x51f85c);logger[_0x332e('0xf')]('GetCampaignHopperHistory',_0x51f85c,JSON[_0x332e('0x11')](_0x120674));_0x2d278b(_0x120674);})[_0x332e('0x1c')](function(_0x3da0ea){logger[_0x332e('0x12')](_0x332e('0x44'),_0x3da0ea['message'],_0x51f85c);_0x3e3d2d(_0x33076f['error'](0x1f4,_0x3da0ea[_0x332e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 6bc1c22..d409bbd 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 _0x96d3=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','get','describe','/:id','show','post','create','put','update','exports','util','path','connect-timeout','Router','fs-extra'];(function(_0x58a4ac,_0x43fd42){var _0x545810=function(_0x308e65){while(--_0x308e65){_0x58a4ac['push'](_0x58a4ac['shift']());}};_0x545810(++_0x43fd42);}(_0x96d3,0xcc));var _0x396d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x96d3[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require(_0x396d('0x0'));var path=require(_0x396d('0x1'));var timeout=require(_0x396d('0x2'));var express=require('express');var router=express[_0x396d('0x3')]();var fs_extra=require(_0x396d('0x4'));var auth=require(_0x396d('0x5'));var interaction=require(_0x396d('0x6'));var config=require(_0x396d('0x7'));var controller=require(_0x396d('0x8'));router['get']('/',auth[_0x396d('0x9')](),controller['index']);router[_0x396d('0xa')]('/describe',auth[_0x396d('0x9')](),controller[_0x396d('0xb')]);router[_0x396d('0xa')](_0x396d('0xc'),auth[_0x396d('0x9')](),controller[_0x396d('0xd')]);router[_0x396d('0xe')]('/',auth[_0x396d('0x9')](),controller[_0x396d('0xf')]);router[_0x396d('0x10')]('/:id',auth[_0x396d('0x9')](),controller[_0x396d('0x11')]);module[_0x396d('0x12')]=router; \ No newline at end of file +var _0xa439=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','update','multer','util'];(function(_0x1b8fe6,_0x218bb9){var _0x569bc=function(_0x31a64a){while(--_0x31a64a){_0x1b8fe6['push'](_0x1b8fe6['shift']());}};_0x569bc(++_0x218bb9);}(_0xa439,0xfa));var _0x9a43=function(_0x5f4ed1,_0x4ee239){_0x5f4ed1=_0x5f4ed1-0x0;var _0xb898ca=_0xa439[_0x5f4ed1];return _0xb898ca;};'use strict';var multer=require(_0x9a43('0x0'));var util=require(_0x9a43('0x1'));var path=require(_0x9a43('0x2'));var timeout=require(_0x9a43('0x3'));var express=require(_0x9a43('0x4'));var router=express['Router']();var fs_extra=require(_0x9a43('0x5'));var auth=require(_0x9a43('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9a43('0x7'));var controller=require(_0x9a43('0x8'));router[_0x9a43('0x9')]('/',auth[_0x9a43('0xa')](),controller[_0x9a43('0xb')]);router[_0x9a43('0x9')](_0x9a43('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x9a43('0x9')](_0x9a43('0xd'),auth[_0x9a43('0xa')](),controller[_0x9a43('0xe')]);router['post']('/',auth[_0x9a43('0xa')](),controller[_0x9a43('0xf')]);router[_0x9a43('0x10')](_0x9a43('0xd'),auth[_0x9a43('0xa')](),controller[_0x9a43('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index c11347e..ecbde2a 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 _0xb31a=['sequelize','exports','STRING','name'];(function(_0x28d1c7,_0x20ef51){var _0x584a72=function(_0x4fabed){while(--_0x4fabed){_0x28d1c7['push'](_0x28d1c7['shift']());}};_0x584a72(++_0x20ef51);}(_0xb31a,0xd4));var _0xab31=function(_0x15cfbf,_0x58c837){_0x15cfbf=_0x15cfbf-0x0;var _0x126890=_0xb31a[_0x15cfbf];return _0x126890;};'use strict';var Sequelize=require(_0xab31('0x0'));module[_0xab31('0x1')]={'name':{'type':Sequelize[_0xab31('0x2')],'unique':_0xab31('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xab31('0x2')]},'dialPrefix':{'type':Sequelize[_0xab31('0x2')]}}; \ No newline at end of file +var _0xbc17=['exports','name','STRING','sequelize'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xbc17,0x1ab));var _0x7bc1=function(_0x2c6810,_0x23c079){_0x2c6810=_0x2c6810-0x0;var _0x213881=_0xbc17[_0x2c6810];return _0x213881;};'use strict';var Sequelize=require(_0x7bc1('0x0'));module[_0x7bc1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7bc1('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7bc1('0x3')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 05de9fe..a2efaca 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 _0xa1ef=['raw','getContactsCsv','CmCustomField','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','sequelize','transaction','addCustomFields','Sequelize','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','Lists','UserProfileResource','destroy','end','error','stack','name','index','map','CmList','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','includeAll','catch','show','params','include','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','describe','addDisposition','ListId','Disposition','findOne','rawAttributes','filter','findAll','rows','removeDispositions','addContacts','CmContact','isArray','tags','push','each','ids','success','dataValues','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','cf_%d'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0xa1ef,0xb0));var _0xfa1e=function(_0x105b3a,_0x3f146c){_0x105b3a=_0x105b3a-0x0;var _0x561a8f=_0xa1ef[_0x105b3a];return _0x561a8f;};'use strict';var emlformat=require(_0xfa1e('0x0'));var rimraf=require(_0xfa1e('0x1'));var zipdir=require(_0xfa1e('0x2'));var jsonpatch=require(_0xfa1e('0x3'));var rp=require(_0xfa1e('0x4'));var moment=require(_0xfa1e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfa1e('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xfa1e('0x7'));var ejs=require(_0xfa1e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfa1e('0x9'));var squel=require(_0xfa1e('0xa'));var crypto=require(_0xfa1e('0xb'));var jsforce=require(_0xfa1e('0xc'));var deskjs=require(_0xfa1e('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfa1e('0xe'));var qs=require(_0xfa1e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfa1e('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xfa1e('0x11'));var config=require(_0xfa1e('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xfa1e('0x13'))['db'];config[_0xfa1e('0x14')]=_[_0xfa1e('0x15')](config[_0xfa1e('0x14')],{'host':_0xfa1e('0x16'),'port':0x18eb});var socket=require(_0xfa1e('0x17'))(new Redis(config[_0xfa1e('0x14')]));require(_0xfa1e('0x18'))[_0xfa1e('0x19')](socket);function respondWithStatusCode(_0x1663b8,_0x5b76ea){_0x5b76ea=_0x5b76ea||0xcc;return function(_0x42ccbe){if(_0x42ccbe){return _0x1663b8[_0xfa1e('0x1a')](_0x5b76ea);}return _0x1663b8[_0xfa1e('0x1b')](_0x5b76ea)['end']();};}function respondWithResult(_0x8573bd,_0x11eed5){_0x11eed5=_0x11eed5||0xc8;return function(_0x1b2eda){if(_0x1b2eda){return _0x8573bd[_0xfa1e('0x1b')](_0x11eed5)[_0xfa1e('0x1c')](_0x1b2eda);}};}function respondWithFilteredResult(_0x5addbe,_0x48edc3){return function(_0x4e1af5){if(_0x4e1af5){var _0x4ec8d5=typeof _0x48edc3[_0xfa1e('0x1d')]===_0xfa1e('0x1e')&&typeof _0x48edc3[_0xfa1e('0x1f')]===_0xfa1e('0x1e');var _0xbc6eb4=_0x4e1af5[_0xfa1e('0x20')];var _0x3748fd=_0x4ec8d5?0x0:_0x48edc3[_0xfa1e('0x1d')];var _0x47d51c=_0x4ec8d5?_0x4e1af5['count']:_0x48edc3[_0xfa1e('0x1d')]+_0x48edc3[_0xfa1e('0x1f')];var _0x10730d;if(_0x47d51c>=_0xbc6eb4){_0x47d51c=_0xbc6eb4;_0x10730d=0xc8;}else{_0x10730d=0xce;}_0x5addbe[_0xfa1e('0x1b')](_0x10730d);return _0x5addbe['set'](_0xfa1e('0x21'),_0x3748fd+'-'+_0x47d51c+'/'+_0xbc6eb4)['json'](_0x4e1af5);}return null;};}function patchUpdates(_0x18b09c){return function(_0x52d009){try{jsonpatch[_0xfa1e('0x22')](_0x52d009,_0x18b09c,!![]);}catch(_0x22c7f8){return BPromise['reject'](_0x22c7f8);}return _0x52d009[_0xfa1e('0x23')]();};}function saveUpdates(_0x208f4e,_0x2a08c0){return function(_0x4fe25d){if(_0x4fe25d){return _0x4fe25d[_0xfa1e('0x24')](_0x208f4e)[_0xfa1e('0x25')](function(_0x22eafa){return _0x22eafa;});}return null;};}function removeEntity(_0x5033fa,_0x5e204d){return function(_0x24514f){if(_0x24514f){return _0x24514f['destroy']()[_0xfa1e('0x25')](function(){var _0x59b826=_0x24514f['get']({'plain':!![]});var _0x367ae0=_0xfa1e('0x26');return db[_0xfa1e('0x27')][_0xfa1e('0x28')]({'where':{'type':_0x367ae0,'resourceId':_0x59b826['id']}})[_0xfa1e('0x25')](function(){return _0x24514f;});})[_0xfa1e('0x25')](function(){_0x5033fa[_0xfa1e('0x1b')](0xcc)[_0xfa1e('0x29')]();});}};}function handleEntityNotFound(_0x43c544,_0x26bb6d){return function(_0x5dfee4){if(!_0x5dfee4){_0x43c544['sendStatus'](0x194);}return _0x5dfee4;};}function handleError(_0x4606f4,_0x432a5c){_0x432a5c=_0x432a5c||0x1f4;return function(_0x2134cb){logger[_0xfa1e('0x2a')](_0x2134cb[_0xfa1e('0x2b')]);if(_0x2134cb[_0xfa1e('0x2c')]){delete _0x2134cb['name'];}_0x4606f4[_0xfa1e('0x1b')](_0x432a5c)['send'](_0x2134cb);};}exports[_0xfa1e('0x2d')]=function(_0x1ba3a6,_0x3df56f){var _0x28d70a={},_0xb9efd4={},_0x574ea6={'count':0x0,'rows':[]};var _0x5196e1=_[_0xfa1e('0x2e')](db[_0xfa1e('0x2f')]['rawAttributes'],function(_0x4947fb){return{'name':_0x4947fb['fieldName'],'type':_0x4947fb[_0xfa1e('0x30')][_0xfa1e('0x31')]};});_0xb9efd4[_0xfa1e('0x32')]=_[_0xfa1e('0x2e')](_0x5196e1,'name');_0xb9efd4[_0xfa1e('0x33')]=_[_0xfa1e('0x34')](_0x1ba3a6[_0xfa1e('0x33')]);_0xb9efd4[_0xfa1e('0x35')]=_[_0xfa1e('0x36')](_0xb9efd4[_0xfa1e('0x32')],_0xb9efd4[_0xfa1e('0x33')]);_0x28d70a[_0xfa1e('0x37')]=_[_0xfa1e('0x36')](_0xb9efd4[_0xfa1e('0x32')],qs[_0xfa1e('0x38')](_0x1ba3a6['query']['fields']));_0x28d70a[_0xfa1e('0x37')]=_0x28d70a[_0xfa1e('0x37')][_0xfa1e('0x39')]?_0x28d70a[_0xfa1e('0x37')]:_0xb9efd4['model'];if(!_0x1ba3a6[_0xfa1e('0x33')][_0xfa1e('0x3a')](_0xfa1e('0x3b'))){_0x28d70a['limit']=qs[_0xfa1e('0x1f')](_0x1ba3a6['query']['limit']);_0x28d70a[_0xfa1e('0x1d')]=qs[_0xfa1e('0x1d')](_0x1ba3a6['query'][_0xfa1e('0x1d')]);}_0x28d70a[_0xfa1e('0x3c')]=qs[_0xfa1e('0x3d')](_0x1ba3a6[_0xfa1e('0x33')]['sort']);_0x28d70a[_0xfa1e('0x3e')]=qs[_0xfa1e('0x35')](_[_0xfa1e('0x3f')](_0x1ba3a6['query'],_0xb9efd4['filters']),_0x5196e1);if(_0x1ba3a6['query']['filter']){_0x28d70a[_0xfa1e('0x3e')]=_['merge'](_0x28d70a[_0xfa1e('0x3e')],{'$or':_[_0xfa1e('0x2e')](_0x5196e1,function(_0x37b3b1){if(_0x37b3b1[_0xfa1e('0x30')]!=='VIRTUAL'){var _0x5bbcf0={};_0x5bbcf0[_0x37b3b1[_0xfa1e('0x2c')]]={'$like':'%'+_0x1ba3a6['query']['filter']+'%'};return _0x5bbcf0;}})});}_0x28d70a=_[_0xfa1e('0x40')]({},_0x28d70a,_0x1ba3a6['options']);var _0x715fd2={'where':_0x28d70a[_0xfa1e('0x3e')]};return db[_0xfa1e('0x2f')][_0xfa1e('0x20')](_0x715fd2)[_0xfa1e('0x25')](function(_0x5126ca){_0x574ea6[_0xfa1e('0x20')]=_0x5126ca;if(_0x1ba3a6[_0xfa1e('0x33')][_0xfa1e('0x41')]){_0x28d70a['include']=[{'all':!![]}];}return db[_0xfa1e('0x2f')]['findAll'](_0x28d70a);})[_0xfa1e('0x25')](function(_0x5981a2){_0x574ea6['rows']=_0x5981a2;return _0x574ea6;})[_0xfa1e('0x25')](respondWithFilteredResult(_0x3df56f,_0x28d70a))[_0xfa1e('0x42')](handleError(_0x3df56f,null));};exports[_0xfa1e('0x43')]=function(_0x5d07aa,_0x592b4d){var _0x931f9={'raw':![],'where':{'id':_0x5d07aa[_0xfa1e('0x44')]['id']}},_0xe4f5ad={};_0xe4f5ad[_0xfa1e('0x32')]=_['keys'](db[_0xfa1e('0x2f')]['rawAttributes']);_0xe4f5ad[_0xfa1e('0x33')]=_[_0xfa1e('0x34')](_0x5d07aa[_0xfa1e('0x33')]);_0xe4f5ad[_0xfa1e('0x35')]=_[_0xfa1e('0x36')](_0xe4f5ad[_0xfa1e('0x32')],_0xe4f5ad[_0xfa1e('0x33')]);_0x931f9[_0xfa1e('0x37')]=_[_0xfa1e('0x36')](_0xe4f5ad[_0xfa1e('0x32')],qs['fields'](_0x5d07aa[_0xfa1e('0x33')][_0xfa1e('0x38')]));_0x931f9[_0xfa1e('0x37')]=_0x931f9[_0xfa1e('0x37')]['length']?_0x931f9[_0xfa1e('0x37')]:_0xe4f5ad[_0xfa1e('0x32')];if(_0x5d07aa[_0xfa1e('0x33')]['includeAll']){_0x931f9[_0xfa1e('0x45')]=[{'all':!![]}];}_0x931f9=_[_0xfa1e('0x40')]({},_0x931f9,_0x5d07aa[_0xfa1e('0x46')]);return db['CmList'][_0xfa1e('0x47')](_0x931f9)[_0xfa1e('0x25')](handleEntityNotFound(_0x592b4d,null))['then'](respondWithResult(_0x592b4d,null))[_0xfa1e('0x42')](handleError(_0x592b4d,null));};exports[_0xfa1e('0x48')]=function(_0x46c6f9,_0xa6ec3e){return db['CmList'][_0xfa1e('0x48')](_0x46c6f9[_0xfa1e('0x49')],{})[_0xfa1e('0x25')](function(_0x4b9f28){var _0x420cad=_0x46c6f9[_0xfa1e('0x4a')]['get']({'plain':!![]});if(!_0x420cad)throw new Error(_0xfa1e('0x4b'));if(_0x420cad[_0xfa1e('0x4c')]===_0xfa1e('0x4a')){var _0x53dc20=_0x4b9f28['get']({'plain':!![]});var _0x34b8da=_0xfa1e('0x26');return db[_0xfa1e('0x4d')][_0xfa1e('0x47')]({'where':{'name':_0x34b8da,'userProfileId':_0x420cad[_0xfa1e('0x4e')]},'raw':!![]})[_0xfa1e('0x25')](function(_0x32871b){if(_0x32871b&&_0x32871b[_0xfa1e('0x4f')]===0x0){return db[_0xfa1e('0x27')]['create']({'name':_0x53dc20['name'],'resourceId':_0x53dc20['id'],'type':_0x32871b[_0xfa1e('0x2c')],'sectionId':_0x32871b['id']},{})[_0xfa1e('0x25')](function(){return _0x4b9f28;});}else{return _0x4b9f28;}})[_0xfa1e('0x42')](function(_0x3d7aef){logger['error'](_0xfa1e('0x50'),_0x3d7aef);throw _0x3d7aef;});}return _0x4b9f28;})[_0xfa1e('0x25')](respondWithResult(_0xa6ec3e,0xc9))[_0xfa1e('0x42')](handleError(_0xa6ec3e,null));};exports[_0xfa1e('0x24')]=function(_0x1d942b,_0x40ec8){if(_0x1d942b[_0xfa1e('0x49')]['id']){delete _0x1d942b[_0xfa1e('0x49')]['id'];}return db[_0xfa1e('0x2f')]['find']({'where':{'id':_0x1d942b[_0xfa1e('0x44')]['id']}})[_0xfa1e('0x25')](handleEntityNotFound(_0x40ec8,null))[_0xfa1e('0x25')](saveUpdates(_0x1d942b[_0xfa1e('0x49')],null))[_0xfa1e('0x25')](respondWithResult(_0x40ec8,null))[_0xfa1e('0x42')](handleError(_0x40ec8,null));};exports[_0xfa1e('0x28')]=function(_0xa363ef,_0x4c9a03){return db[_0xfa1e('0x2f')]['find']({'where':{'id':_0xa363ef[_0xfa1e('0x44')]['id']}})[_0xfa1e('0x25')](handleEntityNotFound(_0x4c9a03,null))[_0xfa1e('0x25')](removeEntity(_0x4c9a03,null))[_0xfa1e('0x42')](handleError(_0x4c9a03,null));};exports['describe']=function(_0x1e6601,_0x1cb3f2){return db['CmList'][_0xfa1e('0x51')]()[_0xfa1e('0x25')](respondWithResult(_0x1cb3f2,null))[_0xfa1e('0x42')](handleError(_0x1cb3f2,null));};exports[_0xfa1e('0x52')]=function(_0x45f5ba,_0x16ddb2,_0x2f10b0){if(_0x45f5ba[_0xfa1e('0x49')]['id']){delete _0x45f5ba[_0xfa1e('0x49')]['id'];}return db[_0xfa1e('0x2f')]['find']({'where':{'id':_0x45f5ba[_0xfa1e('0x44')]['id']}})[_0xfa1e('0x25')](handleEntityNotFound(_0x16ddb2,null))[_0xfa1e('0x25')](function(_0x47ac40){if(_0x47ac40){_0x45f5ba[_0xfa1e('0x49')][_0xfa1e('0x53')]=_0x47ac40['id'];return db[_0xfa1e('0x54')][_0xfa1e('0x48')](_0x45f5ba[_0xfa1e('0x49')]);}})[_0xfa1e('0x25')](respondWithResult(_0x16ddb2,null))['catch'](handleError(_0x16ddb2,null));};exports['getDispositions']=function(_0x13702e,_0x2558d9,_0x41c3a4){var _0x1f31fe={'raw':![],'where':{}};var _0x19f371={};var _0x33cf3c={'count':0x0,'rows':[]};return db['CmList'][_0xfa1e('0x55')]({'where':{'id':_0x13702e[_0xfa1e('0x44')]['id']}})[_0xfa1e('0x25')](handleEntityNotFound(_0x2558d9,null))[_0xfa1e('0x25')](function(_0xd6701b){if(_0xd6701b){_0x19f371['model']=_[_0xfa1e('0x34')](db[_0xfa1e('0x54')][_0xfa1e('0x56')]);_0x19f371['query']=_[_0xfa1e('0x34')](_0x13702e[_0xfa1e('0x33')]);_0x19f371[_0xfa1e('0x35')]=_[_0xfa1e('0x36')](_0x19f371['model'],_0x19f371[_0xfa1e('0x33')]);_0x1f31fe[_0xfa1e('0x37')]=_[_0xfa1e('0x36')](_0x19f371[_0xfa1e('0x32')],qs['fields'](_0x13702e[_0xfa1e('0x33')][_0xfa1e('0x38')]));_0x1f31fe[_0xfa1e('0x37')]=_0x1f31fe[_0xfa1e('0x37')][_0xfa1e('0x39')]?_0x1f31fe[_0xfa1e('0x37')]:_0x19f371[_0xfa1e('0x32')];if(!_0x13702e['query'][_0xfa1e('0x3a')]('nolimit')){_0x1f31fe[_0xfa1e('0x1f')]=qs['limit'](_0x13702e['query'][_0xfa1e('0x1f')]);_0x1f31fe[_0xfa1e('0x1d')]=qs['offset'](_0x13702e[_0xfa1e('0x33')][_0xfa1e('0x1d')]);}_0x1f31fe[_0xfa1e('0x3c')]=qs[_0xfa1e('0x3d')](_0x13702e['query'][_0xfa1e('0x3d')]);_0x1f31fe[_0xfa1e('0x3e')]=qs[_0xfa1e('0x35')](_['pick'](_0x13702e[_0xfa1e('0x33')],_0x19f371[_0xfa1e('0x35')]));_0x1f31fe[_0xfa1e('0x3e')][_0xfa1e('0x53')]=_0xd6701b['id'];if(_0x13702e[_0xfa1e('0x33')][_0xfa1e('0x57')]){_0x1f31fe['where']=_[_0xfa1e('0x40')](_0x1f31fe[_0xfa1e('0x3e')],{'$or':_[_0xfa1e('0x2e')](_0x1f31fe[_0xfa1e('0x37')],function(_0x2a1115){var _0x523fa0={};_0x523fa0[_0x2a1115]={'$like':'%'+_0x13702e['query'][_0xfa1e('0x57')]+'%'};return _0x523fa0;})});}_0x1f31fe=_['merge']({},_0x1f31fe,_0x13702e[_0xfa1e('0x46')]);return db['Disposition']['count']({'where':_0x1f31fe[_0xfa1e('0x3e')]})[_0xfa1e('0x25')](function(_0x395a0f){_0x33cf3c[_0xfa1e('0x20')]=_0x395a0f;if(_0x13702e['query'][_0xfa1e('0x41')]){_0x1f31fe[_0xfa1e('0x45')]=[{'all':!![]}];}return db[_0xfa1e('0x54')][_0xfa1e('0x58')](_0x1f31fe);})[_0xfa1e('0x25')](function(_0x18e567){_0x33cf3c[_0xfa1e('0x59')]=_0x18e567;return _0x33cf3c;});}})['then'](respondWithFilteredResult(_0x2558d9,_0x1f31fe))[_0xfa1e('0x42')](handleError(_0x2558d9,null));};exports['removeDispositions']=function(_0x2b7d83,_0x3d4b6c,_0x1a2e3e){return db[_0xfa1e('0x2f')][_0xfa1e('0x47')]({'where':{'id':_0x2b7d83['params']['id']}})['then'](handleEntityNotFound(_0x3d4b6c,null))[_0xfa1e('0x25')](function(_0xe4f54f){if(_0xe4f54f){return _0xe4f54f[_0xfa1e('0x5a')](_0x2b7d83[_0xfa1e('0x33')]['ids']);}})[_0xfa1e('0x25')](respondWithStatusCode(_0x3d4b6c,null))[_0xfa1e('0x42')](handleError(_0x3d4b6c,null));};exports[_0xfa1e('0x5b')]=function(_0x1a1626,_0x286d5a,_0x589163){return db['CmList'][_0xfa1e('0x47')]({'where':{'id':_0x1a1626[_0xfa1e('0x44')]['id']}})[_0xfa1e('0x25')](handleEntityNotFound(_0x286d5a,null))[_0xfa1e('0x25')](function(_0x2441f5){if(_0x2441f5){var _0x56c4e2=[];var _0x8bb69b={'success':[],'errors':[]};return db[_0xfa1e('0x5c')]['describe']()[_0xfa1e('0x25')](function(_0x519b9d){if(_0x1a1626['body']['tags']&&_[_0xfa1e('0x5d')](_0x1a1626[_0xfa1e('0x49')][_0xfa1e('0x5e')])){if(_0x1a1626['body'][_0xfa1e('0x5e')][_0xfa1e('0x39')]){_0x1a1626[_0xfa1e('0x49')]['tags']=_0x1a1626[_0xfa1e('0x49')][_0xfa1e('0x5e')]['join'](';')+';';}else{_0x1a1626[_0xfa1e('0x49')][_0xfa1e('0x5e')]=null;}}else{_0x1a1626[_0xfa1e('0x49')]['tags']=null;}if(_0x1a1626[_0xfa1e('0x49')]&&_[_0xfa1e('0x5d')](_0x1a1626['body'])){for(var _0x45ffbf=0x0;_0x45ffbf<_0x1a1626[_0xfa1e('0x49')]['length'];_0x45ffbf+=0x1){_0x1a1626['body'][_0x45ffbf][_0xfa1e('0x53')]=_0x1a1626[_0xfa1e('0x44')]['id'];_0x56c4e2[_0xfa1e('0x5f')](_0x1a1626[_0xfa1e('0x49')][_0x45ffbf]);}return BPromise[_0xfa1e('0x60')](_0x56c4e2,function(_0x5d1178){return db['CmContact'][_0xfa1e('0x48')](_['omit'](_0x5d1178,[_0xfa1e('0x61'),'id'])||{},{'fields':_['keys'](_0x519b9d),'raw':!![]})['then'](function(_0x390db6){_0x8bb69b[_0xfa1e('0x62')][_0xfa1e('0x5f')](_0x390db6[_0xfa1e('0x63')]);})['catch'](function(_0x486c5b){_0x8bb69b['errors'][_0xfa1e('0x5f')]({'data':_0x5d1178,'error':_0x486c5b['message']});});})[_0xfa1e('0x25')](function(_0x423146){return _0x8bb69b;})[_0xfa1e('0x42')](function(_0x101050){return _0x101050;});}else{_0x286d5a['status'](0x190)[_0xfa1e('0x1c')]({'message':_0xfa1e('0x64')});}});}})['then'](respondWithResult(_0x286d5a,null))[_0xfa1e('0x42')](handleError(_0x286d5a,null));};exports[_0xfa1e('0x65')]=function(_0x5eac5f,_0x425c01,_0xf9deef){var _0x1579b5;return db[_0xfa1e('0x2f')][_0xfa1e('0x47')]({'where':{'id':_0x5eac5f[_0xfa1e('0x44')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xfa1e('0x66')}]})[_0xfa1e('0x25')](handleEntityNotFound(_0x425c01,null))[_0xfa1e('0x25')](function(_0x3867d7){if(_0x3867d7){_0x1579b5=_0x3867d7;return db['CmContact']['rawAttributes'];}})['then'](function(_0xc36875){if(_0xc36875){var _0x2a5a75={};var _0x44bd42={};_0x44bd42['model']=_[_0xfa1e('0x67')](_['keys'](_0xc36875),_[_0xfa1e('0x2e')](_0x1579b5[_0xfa1e('0x66')],function(_0x108fc8){return util[_0xfa1e('0x68')](_0xfa1e('0x69'),_0x108fc8['id']);}));_0x44bd42[_0xfa1e('0x33')]=_['keys'](_0x5eac5f['query']);_0x44bd42[_0xfa1e('0x35')]=_[_0xfa1e('0x36')](_0x44bd42['model'],_0x44bd42[_0xfa1e('0x33')]);_0x2a5a75[_0xfa1e('0x37')]=_[_0xfa1e('0x36')](_0x44bd42['model'],qs[_0xfa1e('0x38')](_0x5eac5f['query'][_0xfa1e('0x38')]));_0x2a5a75[_0xfa1e('0x37')]=_0x2a5a75[_0xfa1e('0x37')][_0xfa1e('0x39')]?_0x2a5a75[_0xfa1e('0x37')]:_0x44bd42[_0xfa1e('0x32')];if(!_0x5eac5f[_0xfa1e('0x33')]['hasOwnProperty'](_0xfa1e('0x3b'))){_0x2a5a75[_0xfa1e('0x1f')]=qs[_0xfa1e('0x1f')](_0x5eac5f[_0xfa1e('0x33')][_0xfa1e('0x1f')]);_0x2a5a75['offset']=qs[_0xfa1e('0x1d')](_0x5eac5f[_0xfa1e('0x33')][_0xfa1e('0x1d')]);}_0x2a5a75[_0xfa1e('0x3c')]=qs['sort'](_0x5eac5f['query'][_0xfa1e('0x3d')]);_0x2a5a75[_0xfa1e('0x3e')]=qs[_0xfa1e('0x35')](_[_0xfa1e('0x3f')](_0x5eac5f[_0xfa1e('0x33')],_0x44bd42[_0xfa1e('0x35')]));_0x2a5a75[_0xfa1e('0x6a')]=!![];if(_0x5eac5f['query'][_0xfa1e('0x57')]){_0x2a5a75[_0xfa1e('0x3e')]=_[_0xfa1e('0x40')](_0x2a5a75['where'],{'$or':_[_0xfa1e('0x2e')](_0x2a5a75[_0xfa1e('0x37')],function(_0x3d5003){var _0x171e46={};_0x171e46[_0x3d5003]={'$like':'%'+_0x5eac5f[_0xfa1e('0x33')][_0xfa1e('0x57')]+'%'};return _0x171e46;})});}_0x2a5a75=_['merge']({},_0x2a5a75,_0x5eac5f[_0xfa1e('0x46')]);return _0x1579b5[_0xfa1e('0x65')](_0x2a5a75);}})[_0xfa1e('0x25')](respondWithResult(_0x425c01,null))[_0xfa1e('0x42')](handleError(_0x425c01,null));};exports[_0xfa1e('0x6b')]=function(_0x501715,_0x40b8f8,_0x4d932d){var _0x174794;return db[_0xfa1e('0x2f')]['find']({'where':{'id':_0x501715[_0xfa1e('0x44')]['id']},'include':[{'model':db[_0xfa1e('0x6c')],'as':'CustomFields'}]})[_0xfa1e('0x25')](handleEntityNotFound(_0x40b8f8,null))[_0xfa1e('0x25')](function(_0x3b26e1){if(_0x3b26e1){_0x174794=_0x3b26e1;return db[_0xfa1e('0x5c')][_0xfa1e('0x56')];}})[_0xfa1e('0x25')](function(_0x6603ce){if(_0x6603ce){var _0x51dc9a={};var _0x12d55c={};_0x12d55c[_0xfa1e('0x32')]=_['concat'](_['keys'](_0x6603ce),_[_0xfa1e('0x2e')](_0x174794[_0xfa1e('0x66')],function(_0xc62497){return util['format'](_0xfa1e('0x69'),_0xc62497['id']);}));_0x12d55c[_0xfa1e('0x33')]=_[_0xfa1e('0x34')](_0x501715['query']);_0x12d55c[_0xfa1e('0x35')]=_[_0xfa1e('0x36')](_0x12d55c[_0xfa1e('0x32')],_0x12d55c[_0xfa1e('0x33')]);_0x51dc9a[_0xfa1e('0x37')]=_[_0xfa1e('0x36')](_0x12d55c[_0xfa1e('0x32')],qs['fields'](_0x501715[_0xfa1e('0x33')][_0xfa1e('0x38')]));_0x51dc9a[_0xfa1e('0x37')]=_0x51dc9a[_0xfa1e('0x37')][_0xfa1e('0x39')]?_0x51dc9a[_0xfa1e('0x37')]:_0x12d55c[_0xfa1e('0x32')];if(!_0x501715[_0xfa1e('0x33')][_0xfa1e('0x3a')](_0xfa1e('0x3b'))){_0x51dc9a[_0xfa1e('0x1f')]=qs[_0xfa1e('0x1f')](_0x501715[_0xfa1e('0x33')][_0xfa1e('0x1f')]);_0x51dc9a[_0xfa1e('0x1d')]=qs['offset'](_0x501715[_0xfa1e('0x33')][_0xfa1e('0x1d')]);}_0x51dc9a['order']=qs[_0xfa1e('0x3d')](_0x501715[_0xfa1e('0x33')]['sort']);_0x51dc9a[_0xfa1e('0x3e')]=qs[_0xfa1e('0x35')](_[_0xfa1e('0x3f')](_0x501715['query'],_0x12d55c[_0xfa1e('0x35')]));_0x51dc9a[_0xfa1e('0x6a')]=!![];if(_0x501715[_0xfa1e('0x33')][_0xfa1e('0x57')]){_0x51dc9a[_0xfa1e('0x3e')]=_[_0xfa1e('0x40')](_0x51dc9a['where'],{'$or':_[_0xfa1e('0x2e')](_0x51dc9a[_0xfa1e('0x37')],function(_0x1f2444){var _0x26059d={};_0x26059d[_0x1f2444]={'$like':'%'+_0x501715[_0xfa1e('0x33')][_0xfa1e('0x57')]+'%'};return _0x26059d;})});}_0x51dc9a=_[_0xfa1e('0x40')]({},_0x51dc9a,_0x501715[_0xfa1e('0x46')]);return _0x174794[_0xfa1e('0x65')](_0x51dc9a);}})[_0xfa1e('0x25')](function(_0x452b55){if(!_['isEmpty'](_0x452b55)){var _0x485ada=toCsv(_0x452b55);var _0xa7a7a9=Date[_0xfa1e('0x6d')]();fs[_0xfa1e('0x6e')](util[_0xfa1e('0x68')](_0xfa1e('0x6f'),_0x174794['id'],_0xa7a7a9),_0x485ada);_0x40b8f8[_0xfa1e('0x70')](_0xfa1e('0x71'),_0xfa1e('0x72')+util[_0xfa1e('0x68')](_0xfa1e('0x73'),_0x174794['id'],_0xa7a7a9));_0x40b8f8[_0xfa1e('0x70')](_0xfa1e('0x74'),_0xfa1e('0x75'));return _0x40b8f8[_0xfa1e('0x76')](util[_0xfa1e('0x68')]('/tmp/list_%d_%s.csv',_0x174794['id'],_0xa7a7a9));}else{return _0x40b8f8['sendStatus'](0xcc);}})[_0xfa1e('0x42')](handleError(_0x40b8f8,null));};exports['addCustomField']=function(_0x14f033,_0x12623e,_0x238f73){var _0x27a992;delete _0x14f033[_0xfa1e('0x49')]['id'];return db[_0xfa1e('0x2f')][_0xfa1e('0x55')]({'where':{'id':_0x14f033['params']['id']}})[_0xfa1e('0x25')](handleEntityNotFound(_0x12623e,null))[_0xfa1e('0x25')](function(_0x4d5cc7){if(_0x4d5cc7){return db[_0xfa1e('0x77')][_0xfa1e('0x78')](function(_0x3ca899){return db['CmCustomField']['create'](_0x14f033[_0xfa1e('0x49')],{'transaction':_0x3ca899})['then'](function(_0x517bd7){_0x27a992=_0x517bd7;return _0x4d5cc7[_0xfa1e('0x79')](_0x517bd7,{'transaction':_0x3ca899});})['then'](function(){var _0x18ff6a={'type':db[_0xfa1e('0x7a')]['TEXT'],'transaction':_0x3ca899};switch(_0x14f033['body'][_0xfa1e('0x30')]){case _0xfa1e('0x7b'):_0x18ff6a[_0xfa1e('0x30')]=db[_0xfa1e('0x7a')]['TEXT'];break;case _0xfa1e('0x7c'):_0x18ff6a[_0xfa1e('0x30')]=db['Sequelize'][_0xfa1e('0x7d')];break;case _0xfa1e('0x7e'):_0x18ff6a[_0xfa1e('0x30')]=db[_0xfa1e('0x7a')][_0xfa1e('0x7f')];_0x18ff6a[_0xfa1e('0x80')]=![];break;default:}return db[_0xfa1e('0x77')][_0xfa1e('0x81')][_0xfa1e('0x82')](_0xfa1e('0x83'),util['format'](_0xfa1e('0x84'),_0x27a992['id']),_0x18ff6a);})['then'](function(){return _0x27a992;});});}})[_0xfa1e('0x25')](respondWithResult(_0x12623e,null))[_0xfa1e('0x42')](handleError(_0x12623e,null));};exports[_0xfa1e('0x85')]=function(_0x108b22,_0x14d226,_0x58b386){var _0x2afe1c={};var _0x14510b={};var _0x2e9795;var _0x39ee56;return db[_0xfa1e('0x2f')][_0xfa1e('0x55')]({'where':{'id':_0x108b22[_0xfa1e('0x44')]['id']}})[_0xfa1e('0x25')](handleEntityNotFound(_0x14d226,null))[_0xfa1e('0x25')](function(_0x1cecd0){if(_0x1cecd0){_0x2e9795=_0x1cecd0;_0x14510b[_0xfa1e('0x32')]=_[_0xfa1e('0x34')](db[_0xfa1e('0x6c')][_0xfa1e('0x56')]);_0x14510b[_0xfa1e('0x33')]=_[_0xfa1e('0x34')](_0x108b22[_0xfa1e('0x33')]);_0x14510b[_0xfa1e('0x35')]=_[_0xfa1e('0x36')](_0x14510b[_0xfa1e('0x32')],_0x14510b[_0xfa1e('0x33')]);_0x2afe1c[_0xfa1e('0x37')]=_[_0xfa1e('0x36')](_0x14510b[_0xfa1e('0x32')],qs[_0xfa1e('0x38')](_0x108b22[_0xfa1e('0x33')][_0xfa1e('0x38')]));_0x2afe1c[_0xfa1e('0x37')]=_0x2afe1c[_0xfa1e('0x37')][_0xfa1e('0x39')]?_0x2afe1c['attributes']:_0x14510b[_0xfa1e('0x32')];_0x2afe1c[_0xfa1e('0x3c')]=qs[_0xfa1e('0x3d')](_0x108b22[_0xfa1e('0x33')][_0xfa1e('0x3d')]);_0x2afe1c[_0xfa1e('0x3e')]=qs[_0xfa1e('0x35')](_[_0xfa1e('0x3f')](_0x108b22[_0xfa1e('0x33')],_0x14510b['filters']));_0x2afe1c[_0xfa1e('0x3e')]=_['merge'](_0x2afe1c[_0xfa1e('0x3e')],{'$or':[{'ListId':_0x1cecd0['id']},{'ListId':null}]});if(_0x108b22[_0xfa1e('0x33')][_0xfa1e('0x57')]){_0x2afe1c[_0xfa1e('0x3e')]=_[_0xfa1e('0x40')](_0x2afe1c[_0xfa1e('0x3e')],{'$or':_[_0xfa1e('0x2e')](_0x2afe1c[_0xfa1e('0x37')],function(_0x96f894){var _0x5026f4={};_0x5026f4[_0x96f894]={'$like':'%'+_0x108b22[_0xfa1e('0x33')][_0xfa1e('0x57')]+'%'};return _0x5026f4;})});}_0x2afe1c=_[_0xfa1e('0x40')]({},_0x2afe1c,_0x108b22['options']);return db['CmCustomField'][_0xfa1e('0x86')](_0x2afe1c);}})['then'](respondWithResult(_0x14d226,null))[_0xfa1e('0x42')](handleError(_0x14d226,null));};exports[_0xfa1e('0x87')]=function(_0x2d1f36,_0x5f3b82,_0x35769f){return db[_0xfa1e('0x2f')][_0xfa1e('0x47')]({'where':{'id':_0x2d1f36[_0xfa1e('0x44')]['id']}})[_0xfa1e('0x25')](handleEntityNotFound(_0x5f3b82,null))[_0xfa1e('0x25')](function(_0x459166){if(_0x459166){return _0x459166[_0xfa1e('0x87')](_0x2d1f36[_0xfa1e('0x49')][_0xfa1e('0x61')],_['omit'](_0x2d1f36[_0xfa1e('0x49')],['ids','id'])||{})[_0xfa1e('0x88')](function(_0x43c874){for(var _0x4011c9=0x0;_0x4011c9<_0x2d1f36[_0xfa1e('0x49')]['ids'][_0xfa1e('0x39')];_0x4011c9+=0x1){socket[_0xfa1e('0x89')]('userCmList:save',{'UserId':Number(_0x2d1f36['body'][_0xfa1e('0x61')][_0x4011c9]),'CmListId':Number(_0x2d1f36[_0xfa1e('0x44')]['id'])});}return _0x43c874;});}})[_0xfa1e('0x25')](respondWithResult(_0x5f3b82,null))['catch'](handleError(_0x5f3b82,null));};exports[_0xfa1e('0x8a')]=function(_0x4aa219,_0x162884,_0x1beb13){return db[_0xfa1e('0x2f')][_0xfa1e('0x47')]({'where':{'id':_0x4aa219[_0xfa1e('0x44')]['id']}})['then'](handleEntityNotFound(_0x162884,null))['then'](function(_0x3309d3){if(_0x3309d3){return _0x3309d3['removeAgents'](_0x4aa219['query'][_0xfa1e('0x61')])[_0xfa1e('0x25')](function(){if(_['isArray'](_0x4aa219[_0xfa1e('0x33')][_0xfa1e('0x61')])){for(var _0x3c7b49=0x0;_0x3c7b49<_0x4aa219[_0xfa1e('0x33')][_0xfa1e('0x61')][_0xfa1e('0x39')];_0x3c7b49+=0x1){socket[_0xfa1e('0x89')](_0xfa1e('0x8b'),{'UserId':Number(_0x4aa219[_0xfa1e('0x33')]['ids'][_0x3c7b49]),'CmListId':Number(_0x4aa219[_0xfa1e('0x44')]['id'])});}}else{socket[_0xfa1e('0x89')](_0xfa1e('0x8b'),{'UserId':Number(_0x4aa219[_0xfa1e('0x33')][_0xfa1e('0x61')]),'CmListId':Number(_0x4aa219['params']['id'])});}});}})[_0xfa1e('0x25')](respondWithStatusCode(_0x162884,null))[_0xfa1e('0x42')](handleError(_0x162884,null));};exports[_0xfa1e('0x8c')]=function(_0x5d8a9e,_0x20d91b,_0x4dba63){var _0x77321e={};var _0x1e3897={};var _0x47e8d2;var _0x5633c5;return db[_0xfa1e('0x2f')][_0xfa1e('0x55')]({'where':{'id':_0x5d8a9e[_0xfa1e('0x44')]['id']}})['then'](handleEntityNotFound(_0x20d91b,null))[_0xfa1e('0x25')](function(_0x35b7a4){if(_0x35b7a4){_0x47e8d2=_0x35b7a4;_0x1e3897[_0xfa1e('0x32')]=_[_0xfa1e('0x34')](db['User']['rawAttributes']);_0x1e3897[_0xfa1e('0x33')]=_[_0xfa1e('0x34')](_0x5d8a9e['query']);_0x1e3897['filters']=_[_0xfa1e('0x36')](_0x1e3897[_0xfa1e('0x32')],_0x1e3897['query']);_0x77321e[_0xfa1e('0x37')]=_[_0xfa1e('0x36')](_0x1e3897[_0xfa1e('0x32')],qs[_0xfa1e('0x38')](_0x5d8a9e['query'][_0xfa1e('0x38')]));_0x77321e['attributes']=_0x77321e[_0xfa1e('0x37')][_0xfa1e('0x39')]?_0x77321e[_0xfa1e('0x37')]:_0x1e3897[_0xfa1e('0x32')];_0x77321e[_0xfa1e('0x3c')]=qs[_0xfa1e('0x3d')](_0x5d8a9e['query'][_0xfa1e('0x3d')]);_0x77321e['where']=qs[_0xfa1e('0x35')](_[_0xfa1e('0x3f')](_0x5d8a9e[_0xfa1e('0x33')],_0x1e3897['filters']));if(_0x5d8a9e[_0xfa1e('0x33')][_0xfa1e('0x57')]){_0x77321e[_0xfa1e('0x3e')]=_[_0xfa1e('0x40')](_0x77321e[_0xfa1e('0x3e')],{'$or':_[_0xfa1e('0x2e')](_0x77321e['attributes'],function(_0x20f9aa){var _0x5eb9ac={};_0x5eb9ac[_0x20f9aa]={'$like':'%'+_0x5d8a9e['query'][_0xfa1e('0x57')]+'%'};return _0x5eb9ac;})});}_0x77321e=_[_0xfa1e('0x40')]({},_0x77321e,_0x5d8a9e[_0xfa1e('0x46')]);return _0x47e8d2[_0xfa1e('0x8c')](_0x77321e);}})[_0xfa1e('0x25')](function(_0x5a2e4f){if(_0x5a2e4f){_0x5633c5=_0x5a2e4f[_0xfa1e('0x39')];if(!_0x5d8a9e['query'][_0xfa1e('0x3a')]('nolimit')){_0x77321e[_0xfa1e('0x1f')]=qs['limit'](_0x5d8a9e[_0xfa1e('0x33')][_0xfa1e('0x1f')]);_0x77321e[_0xfa1e('0x1d')]=qs['offset'](_0x5d8a9e[_0xfa1e('0x33')][_0xfa1e('0x1d')]);}return _0x47e8d2['getAgents'](_0x77321e);}})[_0xfa1e('0x25')](function(_0x51e7ac){if(_0x51e7ac){return _0x51e7ac?{'count':_0x5633c5,'rows':_0x51e7ac}:null;}})['then'](respondWithResult(_0x20d91b,null))[_0xfa1e('0x42')](handleError(_0x20d91b,null));}; \ No newline at end of file +var _0x423d=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','destroy','Lists','UserProfileResource','end','stack','name','send','index','CmList','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','include','findAll','rows','catch','show','params','fields','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','error','body','describe','ListId','Disposition','getDispositions','findOne','hasOwnProperty','filter','includeAll','removeDispositions','addContacts','CmContact','tags','isArray','join','push','ids','success','dataValues','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','isEmpty','now','writeFileSync','setHeader','attachment;\x20filename=','Content-type','text/csv','/tmp/list_%d_%s.csv','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','omit','removeAgents','emit','userCmList:remove','getAgents','User','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring'];(function(_0x48e72b,_0x5514cd){var _0x120ffe=function(_0x50d904){while(--_0x50d904){_0x48e72b['push'](_0x48e72b['shift']());}};_0x120ffe(++_0x5514cd);}(_0x423d,0x10c));var _0xd423=function(_0x40722d,_0x467184){_0x40722d=_0x40722d-0x0;var _0x233c33=_0x423d[_0x40722d];return _0x233c33;};'use strict';var emlformat=require(_0xd423('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd423('0x1'));var jsonpatch=require(_0xd423('0x2'));var rp=require(_0xd423('0x3'));var moment=require(_0xd423('0x4'));var BPromise=require(_0xd423('0x5'));var Mustache=require(_0xd423('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd423('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd423('0x8'));var squel=require(_0xd423('0x9'));var crypto=require('crypto');var jsforce=require(_0xd423('0xa'));var deskjs=require(_0xd423('0xb'));var toCsv=require(_0xd423('0xc'));var querystring=require(_0xd423('0xd'));var Papa=require('papaparse');var Redis=require(_0xd423('0xe'));var authService=require(_0xd423('0xf'));var qs=require(_0xd423('0x10'));var as=require(_0xd423('0x11'));var hardwareService=require(_0xd423('0x12'));var logger=require(_0xd423('0x13'))('api');var utils=require(_0xd423('0x14'));var config=require(_0xd423('0x15'));var licenseUtil=require(_0xd423('0x16'));var db=require(_0xd423('0x17'))['db'];config[_0xd423('0x18')]=_['defaults'](config[_0xd423('0x18')],{'host':_0xd423('0x19'),'port':0x18eb});var socket=require(_0xd423('0x1a'))(new Redis(config[_0xd423('0x18')]));require(_0xd423('0x1b'))[_0xd423('0x1c')](socket);function respondWithStatusCode(_0x5df04d,_0x2e0d9e){_0x2e0d9e=_0x2e0d9e||0xcc;return function(_0x24ffd0){if(_0x24ffd0){return _0x5df04d[_0xd423('0x1d')](_0x2e0d9e);}return _0x5df04d[_0xd423('0x1e')](_0x2e0d9e)['end']();};}function respondWithResult(_0x42d485,_0x3e36a6){_0x3e36a6=_0x3e36a6||0xc8;return function(_0x157791){if(_0x157791){return _0x42d485[_0xd423('0x1e')](_0x3e36a6)['json'](_0x157791);}};}function respondWithFilteredResult(_0xe8f255,_0x57cca7){return function(_0xf0ad46){if(_0xf0ad46){var _0x58327b=typeof _0x57cca7[_0xd423('0x1f')]===_0xd423('0x20')&&typeof _0x57cca7[_0xd423('0x21')]===_0xd423('0x20');var _0x22f69b=_0xf0ad46[_0xd423('0x22')];var _0x440b05=_0x58327b?0x0:_0x57cca7[_0xd423('0x1f')];var _0x42fc86=_0x58327b?_0xf0ad46[_0xd423('0x22')]:_0x57cca7[_0xd423('0x1f')]+_0x57cca7[_0xd423('0x21')];var _0x43efd4;if(_0x42fc86>=_0x22f69b){_0x42fc86=_0x22f69b;_0x43efd4=0xc8;}else{_0x43efd4=0xce;}_0xe8f255[_0xd423('0x1e')](_0x43efd4);return _0xe8f255[_0xd423('0x23')](_0xd423('0x24'),_0x440b05+'-'+_0x42fc86+'/'+_0x22f69b)[_0xd423('0x25')](_0xf0ad46);}return null;};}function patchUpdates(_0x1a6719){return function(_0x4c9a99){try{jsonpatch['apply'](_0x4c9a99,_0x1a6719,!![]);}catch(_0x19e0db){return BPromise[_0xd423('0x26')](_0x19e0db);}return _0x4c9a99['save']();};}function saveUpdates(_0x1dc9e2,_0x25c016){return function(_0x1b90e7){if(_0x1b90e7){return _0x1b90e7[_0xd423('0x27')](_0x1dc9e2)[_0xd423('0x28')](function(_0x265fc7){return _0x265fc7;});}return null;};}function removeEntity(_0x5b1ff4,_0x414dcd){return function(_0x1d962e){if(_0x1d962e){return _0x1d962e[_0xd423('0x29')]()[_0xd423('0x28')](function(){var _0x11a9b8=_0x1d962e['get']({'plain':!![]});var _0x459ed5=_0xd423('0x2a');return db[_0xd423('0x2b')]['destroy']({'where':{'type':_0x459ed5,'resourceId':_0x11a9b8['id']}})['then'](function(){return _0x1d962e;});})[_0xd423('0x28')](function(){_0x5b1ff4[_0xd423('0x1e')](0xcc)[_0xd423('0x2c')]();});}};}function handleEntityNotFound(_0x54298f,_0x1f6703){return function(_0x47c8e1){if(!_0x47c8e1){_0x54298f[_0xd423('0x1d')](0x194);}return _0x47c8e1;};}function handleError(_0x2f6029,_0x382e80){_0x382e80=_0x382e80||0x1f4;return function(_0x1b92f8){logger['error'](_0x1b92f8[_0xd423('0x2d')]);if(_0x1b92f8[_0xd423('0x2e')]){delete _0x1b92f8[_0xd423('0x2e')];}_0x2f6029[_0xd423('0x1e')](_0x382e80)[_0xd423('0x2f')](_0x1b92f8);};}exports[_0xd423('0x30')]=function(_0x3940ef,_0x4a65d2){var _0xc7bb10={},_0x150bf7={},_0x4942c9={'count':0x0,'rows':[]};var _0x5b2976=_['map'](db[_0xd423('0x31')][_0xd423('0x32')],function(_0x33e3ac){return{'name':_0x33e3ac[_0xd423('0x33')],'type':_0x33e3ac[_0xd423('0x34')][_0xd423('0x35')]};});_0x150bf7[_0xd423('0x36')]=_[_0xd423('0x37')](_0x5b2976,_0xd423('0x2e'));_0x150bf7[_0xd423('0x38')]=_[_0xd423('0x39')](_0x3940ef['query']);_0x150bf7[_0xd423('0x3a')]=_[_0xd423('0x3b')](_0x150bf7[_0xd423('0x36')],_0x150bf7[_0xd423('0x38')]);_0xc7bb10[_0xd423('0x3c')]=_[_0xd423('0x3b')](_0x150bf7[_0xd423('0x36')],qs['fields'](_0x3940ef[_0xd423('0x38')]['fields']));_0xc7bb10['attributes']=_0xc7bb10[_0xd423('0x3c')][_0xd423('0x3d')]?_0xc7bb10[_0xd423('0x3c')]:_0x150bf7['model'];if(!_0x3940ef[_0xd423('0x38')]['hasOwnProperty'](_0xd423('0x3e'))){_0xc7bb10[_0xd423('0x21')]=qs['limit'](_0x3940ef[_0xd423('0x38')]['limit']);_0xc7bb10[_0xd423('0x1f')]=qs[_0xd423('0x1f')](_0x3940ef[_0xd423('0x38')][_0xd423('0x1f')]);}_0xc7bb10[_0xd423('0x3f')]=qs[_0xd423('0x40')](_0x3940ef[_0xd423('0x38')]['sort']);_0xc7bb10[_0xd423('0x41')]=qs[_0xd423('0x3a')](_[_0xd423('0x42')](_0x3940ef[_0xd423('0x38')],_0x150bf7[_0xd423('0x3a')]),_0x5b2976);if(_0x3940ef[_0xd423('0x38')]['filter']){_0xc7bb10['where']=_[_0xd423('0x43')](_0xc7bb10[_0xd423('0x41')],{'$or':_['map'](_0x5b2976,function(_0x246e27){if(_0x246e27['type']!==_0xd423('0x44')){var _0x2ed925={};_0x2ed925[_0x246e27[_0xd423('0x2e')]]={'$like':'%'+_0x3940ef[_0xd423('0x38')]['filter']+'%'};return _0x2ed925;}})});}_0xc7bb10=_[_0xd423('0x43')]({},_0xc7bb10,_0x3940ef['options']);var _0x394584={'where':_0xc7bb10[_0xd423('0x41')]};return db[_0xd423('0x31')][_0xd423('0x22')](_0x394584)[_0xd423('0x28')](function(_0x5a25d2){_0x4942c9[_0xd423('0x22')]=_0x5a25d2;if(_0x3940ef['query']['includeAll']){_0xc7bb10[_0xd423('0x45')]=[{'all':!![]}];}return db[_0xd423('0x31')][_0xd423('0x46')](_0xc7bb10);})[_0xd423('0x28')](function(_0x1b5f03){_0x4942c9[_0xd423('0x47')]=_0x1b5f03;return _0x4942c9;})[_0xd423('0x28')](respondWithFilteredResult(_0x4a65d2,_0xc7bb10))[_0xd423('0x48')](handleError(_0x4a65d2,null));};exports[_0xd423('0x49')]=function(_0x55d5f9,_0xce1a54){var _0x43da13={'raw':![],'where':{'id':_0x55d5f9[_0xd423('0x4a')]['id']}},_0xa5beef={};_0xa5beef['model']=_['keys'](db['CmList'][_0xd423('0x32')]);_0xa5beef[_0xd423('0x38')]=_[_0xd423('0x39')](_0x55d5f9['query']);_0xa5beef[_0xd423('0x3a')]=_[_0xd423('0x3b')](_0xa5beef[_0xd423('0x36')],_0xa5beef[_0xd423('0x38')]);_0x43da13[_0xd423('0x3c')]=_['intersection'](_0xa5beef[_0xd423('0x36')],qs[_0xd423('0x4b')](_0x55d5f9[_0xd423('0x38')]['fields']));_0x43da13[_0xd423('0x3c')]=_0x43da13['attributes'][_0xd423('0x3d')]?_0x43da13[_0xd423('0x3c')]:_0xa5beef['model'];if(_0x55d5f9[_0xd423('0x38')]['includeAll']){_0x43da13[_0xd423('0x45')]=[{'all':!![]}];}_0x43da13=_[_0xd423('0x43')]({},_0x43da13,_0x55d5f9[_0xd423('0x4c')]);return db[_0xd423('0x31')][_0xd423('0x4d')](_0x43da13)[_0xd423('0x28')](handleEntityNotFound(_0xce1a54,null))[_0xd423('0x28')](respondWithResult(_0xce1a54,null))[_0xd423('0x48')](handleError(_0xce1a54,null));};exports[_0xd423('0x4e')]=function(_0x2e6ecc,_0x3635b2){return db[_0xd423('0x31')][_0xd423('0x4e')](_0x2e6ecc['body'],{})[_0xd423('0x28')](function(_0x2c575a){var _0x48cd33=_0x2e6ecc['user']['get']({'plain':!![]});if(!_0x48cd33)throw new Error(_0xd423('0x4f'));if(_0x48cd33[_0xd423('0x50')]==='user'){var _0xd3ac0c=_0x2c575a[_0xd423('0x51')]({'plain':!![]});var _0x28cf46=_0xd423('0x2a');return db[_0xd423('0x52')][_0xd423('0x4d')]({'where':{'name':_0x28cf46,'userProfileId':_0x48cd33['userProfileId']},'raw':!![]})[_0xd423('0x28')](function(_0x4616fe){if(_0x4616fe&&_0x4616fe[_0xd423('0x53')]===0x0){return db[_0xd423('0x2b')][_0xd423('0x4e')]({'name':_0xd3ac0c[_0xd423('0x2e')],'resourceId':_0xd3ac0c['id'],'type':_0x4616fe[_0xd423('0x2e')],'sectionId':_0x4616fe['id']},{})[_0xd423('0x28')](function(){return _0x2c575a;});}else{return _0x2c575a;}})[_0xd423('0x48')](function(_0x3713fc){logger[_0xd423('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3713fc);throw _0x3713fc;});}return _0x2c575a;})[_0xd423('0x28')](respondWithResult(_0x3635b2,0xc9))[_0xd423('0x48')](handleError(_0x3635b2,null));};exports[_0xd423('0x27')]=function(_0x9e0098,_0x1019e0){if(_0x9e0098[_0xd423('0x55')]['id']){delete _0x9e0098['body']['id'];}return db['CmList'][_0xd423('0x4d')]({'where':{'id':_0x9e0098[_0xd423('0x4a')]['id']}})[_0xd423('0x28')](handleEntityNotFound(_0x1019e0,null))[_0xd423('0x28')](saveUpdates(_0x9e0098[_0xd423('0x55')],null))['then'](respondWithResult(_0x1019e0,null))['catch'](handleError(_0x1019e0,null));};exports[_0xd423('0x29')]=function(_0x539eab,_0x2753ec){return db[_0xd423('0x31')][_0xd423('0x4d')]({'where':{'id':_0x539eab['params']['id']}})[_0xd423('0x28')](handleEntityNotFound(_0x2753ec,null))[_0xd423('0x28')](removeEntity(_0x2753ec,null))[_0xd423('0x48')](handleError(_0x2753ec,null));};exports['describe']=function(_0x1bf8e7,_0xe2534){return db[_0xd423('0x31')][_0xd423('0x56')]()[_0xd423('0x28')](respondWithResult(_0xe2534,null))[_0xd423('0x48')](handleError(_0xe2534,null));};exports['addDisposition']=function(_0xb6e12a,_0x415333,_0x5474aa){if(_0xb6e12a['body']['id']){delete _0xb6e12a[_0xd423('0x55')]['id'];}return db['CmList']['find']({'where':{'id':_0xb6e12a[_0xd423('0x4a')]['id']}})[_0xd423('0x28')](handleEntityNotFound(_0x415333,null))[_0xd423('0x28')](function(_0x2c03f3){if(_0x2c03f3){_0xb6e12a['body'][_0xd423('0x57')]=_0x2c03f3['id'];return db[_0xd423('0x58')][_0xd423('0x4e')](_0xb6e12a[_0xd423('0x55')]);}})[_0xd423('0x28')](respondWithResult(_0x415333,null))[_0xd423('0x48')](handleError(_0x415333,null));};exports[_0xd423('0x59')]=function(_0x2a639b,_0x56eaf7,_0x25980e){var _0x2b1e1b={'raw':![],'where':{}};var _0x1900c8={};var _0x28d6cb={'count':0x0,'rows':[]};return db['CmList'][_0xd423('0x5a')]({'where':{'id':_0x2a639b[_0xd423('0x4a')]['id']}})[_0xd423('0x28')](handleEntityNotFound(_0x56eaf7,null))['then'](function(_0x23a87a){if(_0x23a87a){_0x1900c8['model']=_[_0xd423('0x39')](db['Disposition'][_0xd423('0x32')]);_0x1900c8['query']=_['keys'](_0x2a639b[_0xd423('0x38')]);_0x1900c8[_0xd423('0x3a')]=_['intersection'](_0x1900c8[_0xd423('0x36')],_0x1900c8[_0xd423('0x38')]);_0x2b1e1b[_0xd423('0x3c')]=_[_0xd423('0x3b')](_0x1900c8[_0xd423('0x36')],qs[_0xd423('0x4b')](_0x2a639b[_0xd423('0x38')][_0xd423('0x4b')]));_0x2b1e1b[_0xd423('0x3c')]=_0x2b1e1b[_0xd423('0x3c')][_0xd423('0x3d')]?_0x2b1e1b[_0xd423('0x3c')]:_0x1900c8[_0xd423('0x36')];if(!_0x2a639b[_0xd423('0x38')][_0xd423('0x5b')]('nolimit')){_0x2b1e1b[_0xd423('0x21')]=qs[_0xd423('0x21')](_0x2a639b[_0xd423('0x38')][_0xd423('0x21')]);_0x2b1e1b[_0xd423('0x1f')]=qs['offset'](_0x2a639b[_0xd423('0x38')][_0xd423('0x1f')]);}_0x2b1e1b[_0xd423('0x3f')]=qs[_0xd423('0x40')](_0x2a639b['query'][_0xd423('0x40')]);_0x2b1e1b[_0xd423('0x41')]=qs[_0xd423('0x3a')](_[_0xd423('0x42')](_0x2a639b[_0xd423('0x38')],_0x1900c8[_0xd423('0x3a')]));_0x2b1e1b[_0xd423('0x41')]['ListId']=_0x23a87a['id'];if(_0x2a639b[_0xd423('0x38')]['filter']){_0x2b1e1b['where']=_['merge'](_0x2b1e1b[_0xd423('0x41')],{'$or':_[_0xd423('0x37')](_0x2b1e1b['attributes'],function(_0x273822){var _0x57f237={};_0x57f237[_0x273822]={'$like':'%'+_0x2a639b['query'][_0xd423('0x5c')]+'%'};return _0x57f237;})});}_0x2b1e1b=_[_0xd423('0x43')]({},_0x2b1e1b,_0x2a639b[_0xd423('0x4c')]);return db[_0xd423('0x58')][_0xd423('0x22')]({'where':_0x2b1e1b[_0xd423('0x41')]})[_0xd423('0x28')](function(_0x533551){_0x28d6cb[_0xd423('0x22')]=_0x533551;if(_0x2a639b[_0xd423('0x38')][_0xd423('0x5d')]){_0x2b1e1b['include']=[{'all':!![]}];}return db['Disposition'][_0xd423('0x46')](_0x2b1e1b);})[_0xd423('0x28')](function(_0x3ab5cc){_0x28d6cb[_0xd423('0x47')]=_0x3ab5cc;return _0x28d6cb;});}})[_0xd423('0x28')](respondWithFilteredResult(_0x56eaf7,_0x2b1e1b))[_0xd423('0x48')](handleError(_0x56eaf7,null));};exports[_0xd423('0x5e')]=function(_0x403e76,_0x332f7b,_0x3f787c){return db[_0xd423('0x31')][_0xd423('0x4d')]({'where':{'id':_0x403e76[_0xd423('0x4a')]['id']}})[_0xd423('0x28')](handleEntityNotFound(_0x332f7b,null))['then'](function(_0xb50c3f){if(_0xb50c3f){return _0xb50c3f[_0xd423('0x5e')](_0x403e76['query']['ids']);}})[_0xd423('0x28')](respondWithStatusCode(_0x332f7b,null))[_0xd423('0x48')](handleError(_0x332f7b,null));};exports[_0xd423('0x5f')]=function(_0x1a40c6,_0x3ab8fa,_0x2e23e3){return db[_0xd423('0x31')][_0xd423('0x4d')]({'where':{'id':_0x1a40c6[_0xd423('0x4a')]['id']}})[_0xd423('0x28')](handleEntityNotFound(_0x3ab8fa,null))[_0xd423('0x28')](function(_0x45b7f5){if(_0x45b7f5){var _0x1d2b75=[];var _0x519cf5={'success':[],'errors':[]};return db[_0xd423('0x60')][_0xd423('0x56')]()['then'](function(_0x12350a){if(_0x1a40c6[_0xd423('0x55')][_0xd423('0x61')]&&_[_0xd423('0x62')](_0x1a40c6[_0xd423('0x55')][_0xd423('0x61')])){if(_0x1a40c6[_0xd423('0x55')][_0xd423('0x61')][_0xd423('0x3d')]){_0x1a40c6[_0xd423('0x55')]['tags']=_0x1a40c6[_0xd423('0x55')]['tags'][_0xd423('0x63')](';')+';';}else{_0x1a40c6[_0xd423('0x55')][_0xd423('0x61')]=null;}}else{_0x1a40c6[_0xd423('0x55')][_0xd423('0x61')]=null;}if(_0x1a40c6[_0xd423('0x55')]&&_['isArray'](_0x1a40c6[_0xd423('0x55')])){for(var _0x32f6f3=0x0;_0x32f6f3<_0x1a40c6[_0xd423('0x55')][_0xd423('0x3d')];_0x32f6f3+=0x1){_0x1a40c6[_0xd423('0x55')][_0x32f6f3]['ListId']=_0x1a40c6[_0xd423('0x4a')]['id'];_0x1d2b75[_0xd423('0x64')](_0x1a40c6['body'][_0x32f6f3]);}return BPromise['each'](_0x1d2b75,function(_0x10f809){return db['CmContact'][_0xd423('0x4e')](_['omit'](_0x10f809,[_0xd423('0x65'),'id'])||{},{'fields':_['keys'](_0x12350a),'raw':!![]})[_0xd423('0x28')](function(_0x1006d9){_0x519cf5[_0xd423('0x66')][_0xd423('0x64')](_0x1006d9[_0xd423('0x67')]);})[_0xd423('0x48')](function(_0x16bdc0){_0x519cf5['errors'][_0xd423('0x64')]({'data':_0x10f809,'error':_0x16bdc0['message']});});})[_0xd423('0x28')](function(_0xf93942){return _0x519cf5;})['catch'](function(_0x1f00eb){return _0x1f00eb;});}else{_0x3ab8fa['status'](0x190)[_0xd423('0x25')]({'message':_0xd423('0x68')});}});}})['then'](respondWithResult(_0x3ab8fa,null))[_0xd423('0x48')](handleError(_0x3ab8fa,null));};exports[_0xd423('0x69')]=function(_0x441f48,_0x3cf3ba,_0xc4d8f2){var _0x9dfad5;return db[_0xd423('0x31')][_0xd423('0x4d')]({'where':{'id':_0x441f48[_0xd423('0x4a')]['id']},'include':[{'model':db[_0xd423('0x6a')],'as':_0xd423('0x6b')}]})[_0xd423('0x28')](handleEntityNotFound(_0x3cf3ba,null))[_0xd423('0x28')](function(_0x5d1c07){if(_0x5d1c07){_0x9dfad5=_0x5d1c07;return db[_0xd423('0x60')][_0xd423('0x32')];}})[_0xd423('0x28')](function(_0x40aed4){if(_0x40aed4){var _0x4e0a16={};var _0x4a5c8c={};_0x4a5c8c['model']=_[_0xd423('0x6c')](_[_0xd423('0x39')](_0x40aed4),_[_0xd423('0x37')](_0x9dfad5['CustomFields'],function(_0x30ae33){return util[_0xd423('0x6d')](_0xd423('0x6e'),_0x30ae33['id']);}));_0x4a5c8c['query']=_['keys'](_0x441f48[_0xd423('0x38')]);_0x4a5c8c[_0xd423('0x3a')]=_[_0xd423('0x3b')](_0x4a5c8c[_0xd423('0x36')],_0x4a5c8c['query']);_0x4e0a16[_0xd423('0x3c')]=_[_0xd423('0x3b')](_0x4a5c8c[_0xd423('0x36')],qs[_0xd423('0x4b')](_0x441f48[_0xd423('0x38')][_0xd423('0x4b')]));_0x4e0a16[_0xd423('0x3c')]=_0x4e0a16[_0xd423('0x3c')][_0xd423('0x3d')]?_0x4e0a16[_0xd423('0x3c')]:_0x4a5c8c['model'];if(!_0x441f48[_0xd423('0x38')]['hasOwnProperty'](_0xd423('0x3e'))){_0x4e0a16[_0xd423('0x21')]=qs[_0xd423('0x21')](_0x441f48['query'][_0xd423('0x21')]);_0x4e0a16[_0xd423('0x1f')]=qs[_0xd423('0x1f')](_0x441f48['query'][_0xd423('0x1f')]);}_0x4e0a16[_0xd423('0x3f')]=qs[_0xd423('0x40')](_0x441f48[_0xd423('0x38')][_0xd423('0x40')]);_0x4e0a16[_0xd423('0x41')]=qs[_0xd423('0x3a')](_['pick'](_0x441f48[_0xd423('0x38')],_0x4a5c8c['filters']));_0x4e0a16['raw']=!![];if(_0x441f48[_0xd423('0x38')][_0xd423('0x5c')]){_0x4e0a16['where']=_[_0xd423('0x43')](_0x4e0a16['where'],{'$or':_[_0xd423('0x37')](_0x4e0a16[_0xd423('0x3c')],function(_0x33aa76){var _0x4a76d7={};_0x4a76d7[_0x33aa76]={'$like':'%'+_0x441f48[_0xd423('0x38')][_0xd423('0x5c')]+'%'};return _0x4a76d7;})});}_0x4e0a16=_['merge']({},_0x4e0a16,_0x441f48[_0xd423('0x4c')]);return _0x9dfad5[_0xd423('0x69')](_0x4e0a16);}})[_0xd423('0x28')](respondWithResult(_0x3cf3ba,null))[_0xd423('0x48')](handleError(_0x3cf3ba,null));};exports['getContactsCsv']=function(_0x2a21da,_0x128978,_0x288be7){var _0x19af1a;return db[_0xd423('0x31')][_0xd423('0x4d')]({'where':{'id':_0x2a21da['params']['id']},'include':[{'model':db[_0xd423('0x6a')],'as':'CustomFields'}]})[_0xd423('0x28')](handleEntityNotFound(_0x128978,null))[_0xd423('0x28')](function(_0x2eeecd){if(_0x2eeecd){_0x19af1a=_0x2eeecd;return db['CmContact'][_0xd423('0x32')];}})[_0xd423('0x28')](function(_0x1f6e0d){if(_0x1f6e0d){var _0x405380={};var _0x2f7b4c={};_0x2f7b4c['model']=_['concat'](_[_0xd423('0x39')](_0x1f6e0d),_[_0xd423('0x37')](_0x19af1a['CustomFields'],function(_0x3b101d){return util[_0xd423('0x6d')](_0xd423('0x6e'),_0x3b101d['id']);}));_0x2f7b4c[_0xd423('0x38')]=_[_0xd423('0x39')](_0x2a21da[_0xd423('0x38')]);_0x2f7b4c[_0xd423('0x3a')]=_[_0xd423('0x3b')](_0x2f7b4c[_0xd423('0x36')],_0x2f7b4c[_0xd423('0x38')]);_0x405380[_0xd423('0x3c')]=_[_0xd423('0x3b')](_0x2f7b4c[_0xd423('0x36')],qs[_0xd423('0x4b')](_0x2a21da[_0xd423('0x38')][_0xd423('0x4b')]));_0x405380[_0xd423('0x3c')]=_0x405380['attributes'][_0xd423('0x3d')]?_0x405380[_0xd423('0x3c')]:_0x2f7b4c[_0xd423('0x36')];if(!_0x2a21da['query']['hasOwnProperty'](_0xd423('0x3e'))){_0x405380[_0xd423('0x21')]=qs[_0xd423('0x21')](_0x2a21da[_0xd423('0x38')][_0xd423('0x21')]);_0x405380[_0xd423('0x1f')]=qs[_0xd423('0x1f')](_0x2a21da['query']['offset']);}_0x405380[_0xd423('0x3f')]=qs[_0xd423('0x40')](_0x2a21da[_0xd423('0x38')][_0xd423('0x40')]);_0x405380[_0xd423('0x41')]=qs[_0xd423('0x3a')](_['pick'](_0x2a21da['query'],_0x2f7b4c[_0xd423('0x3a')]));_0x405380['raw']=!![];if(_0x2a21da['query']['filter']){_0x405380['where']=_[_0xd423('0x43')](_0x405380[_0xd423('0x41')],{'$or':_['map'](_0x405380[_0xd423('0x3c')],function(_0x5f462a){var _0x118ec7={};_0x118ec7[_0x5f462a]={'$like':'%'+_0x2a21da['query'][_0xd423('0x5c')]+'%'};return _0x118ec7;})});}_0x405380=_[_0xd423('0x43')]({},_0x405380,_0x2a21da[_0xd423('0x4c')]);return _0x19af1a[_0xd423('0x69')](_0x405380);}})[_0xd423('0x28')](function(_0x2708c9){if(!_[_0xd423('0x6f')](_0x2708c9)){var _0x306cd4=toCsv(_0x2708c9);var _0x296ba3=Date[_0xd423('0x70')]();fs[_0xd423('0x71')](util[_0xd423('0x6d')]('/tmp/list_%d_%s.csv',_0x19af1a['id'],_0x296ba3),_0x306cd4);_0x128978[_0xd423('0x72')]('Content-disposition',_0xd423('0x73')+util[_0xd423('0x6d')]('list_%d_%s.csv',_0x19af1a['id'],_0x296ba3));_0x128978[_0xd423('0x72')](_0xd423('0x74'),_0xd423('0x75'));return _0x128978['download'](util[_0xd423('0x6d')](_0xd423('0x76'),_0x19af1a['id'],_0x296ba3));}else{return _0x128978[_0xd423('0x1d')](0xcc);}})['catch'](handleError(_0x128978,null));};exports['addCustomField']=function(_0x4a29f3,_0x5ec341,_0x5b2892){var _0x4c5c4b;delete _0x4a29f3[_0xd423('0x55')]['id'];return db[_0xd423('0x31')][_0xd423('0x5a')]({'where':{'id':_0x4a29f3[_0xd423('0x4a')]['id']}})[_0xd423('0x28')](handleEntityNotFound(_0x5ec341,null))[_0xd423('0x28')](function(_0x250d24){if(_0x250d24){return db[_0xd423('0x77')][_0xd423('0x78')](function(_0x3f1fb6){return db[_0xd423('0x6a')][_0xd423('0x4e')](_0x4a29f3[_0xd423('0x55')],{'transaction':_0x3f1fb6})['then'](function(_0x45d615){_0x4c5c4b=_0x45d615;return _0x250d24[_0xd423('0x79')](_0x45d615,{'transaction':_0x3f1fb6});})[_0xd423('0x28')](function(){var _0x40934f={'type':db[_0xd423('0x7a')][_0xd423('0x7b')],'transaction':_0x3f1fb6};switch(_0x4a29f3[_0xd423('0x55')]['type']){case _0xd423('0x7c'):_0x40934f['type']=db[_0xd423('0x7a')]['TEXT'];break;case'number':_0x40934f[_0xd423('0x34')]=db['Sequelize'][_0xd423('0x7d')];break;case _0xd423('0x7e'):_0x40934f['type']=db[_0xd423('0x7a')][_0xd423('0x7f')];_0x40934f['defaultValue']=![];break;default:}return db[_0xd423('0x77')][_0xd423('0x80')][_0xd423('0x81')](_0xd423('0x82'),util[_0xd423('0x6d')](_0xd423('0x83'),_0x4c5c4b['id']),_0x40934f);})[_0xd423('0x28')](function(){return _0x4c5c4b;});});}})[_0xd423('0x28')](respondWithResult(_0x5ec341,null))[_0xd423('0x48')](handleError(_0x5ec341,null));};exports[_0xd423('0x84')]=function(_0x1ede32,_0x7b3021,_0x4cbd85){var _0x5d31de={};var _0x30b13b={};var _0x2926ff;var _0x42574c;return db[_0xd423('0x31')][_0xd423('0x5a')]({'where':{'id':_0x1ede32[_0xd423('0x4a')]['id']}})[_0xd423('0x28')](handleEntityNotFound(_0x7b3021,null))[_0xd423('0x28')](function(_0x423c4b){if(_0x423c4b){_0x2926ff=_0x423c4b;_0x30b13b[_0xd423('0x36')]=_[_0xd423('0x39')](db[_0xd423('0x6a')][_0xd423('0x32')]);_0x30b13b[_0xd423('0x38')]=_['keys'](_0x1ede32['query']);_0x30b13b[_0xd423('0x3a')]=_[_0xd423('0x3b')](_0x30b13b['model'],_0x30b13b[_0xd423('0x38')]);_0x5d31de[_0xd423('0x3c')]=_[_0xd423('0x3b')](_0x30b13b[_0xd423('0x36')],qs[_0xd423('0x4b')](_0x1ede32[_0xd423('0x38')][_0xd423('0x4b')]));_0x5d31de[_0xd423('0x3c')]=_0x5d31de[_0xd423('0x3c')]['length']?_0x5d31de[_0xd423('0x3c')]:_0x30b13b[_0xd423('0x36')];_0x5d31de[_0xd423('0x3f')]=qs['sort'](_0x1ede32[_0xd423('0x38')][_0xd423('0x40')]);_0x5d31de[_0xd423('0x41')]=qs[_0xd423('0x3a')](_['pick'](_0x1ede32[_0xd423('0x38')],_0x30b13b[_0xd423('0x3a')]));_0x5d31de[_0xd423('0x41')]=_[_0xd423('0x43')](_0x5d31de[_0xd423('0x41')],{'$or':[{'ListId':_0x423c4b['id']},{'ListId':null}]});if(_0x1ede32[_0xd423('0x38')][_0xd423('0x5c')]){_0x5d31de['where']=_[_0xd423('0x43')](_0x5d31de['where'],{'$or':_[_0xd423('0x37')](_0x5d31de[_0xd423('0x3c')],function(_0x1ec4e2){var _0x59647a={};_0x59647a[_0x1ec4e2]={'$like':'%'+_0x1ede32[_0xd423('0x38')][_0xd423('0x5c')]+'%'};return _0x59647a;})});}_0x5d31de=_[_0xd423('0x43')]({},_0x5d31de,_0x1ede32['options']);return db[_0xd423('0x6a')][_0xd423('0x85')](_0x5d31de);}})[_0xd423('0x28')](respondWithResult(_0x7b3021,null))[_0xd423('0x48')](handleError(_0x7b3021,null));};exports[_0xd423('0x86')]=function(_0x3164ac,_0x35d901,_0xdd9665){return db[_0xd423('0x31')][_0xd423('0x4d')]({'where':{'id':_0x3164ac[_0xd423('0x4a')]['id']}})[_0xd423('0x28')](handleEntityNotFound(_0x35d901,null))['then'](function(_0x5da10e){if(_0x5da10e){return _0x5da10e['addAgents'](_0x3164ac[_0xd423('0x55')][_0xd423('0x65')],_[_0xd423('0x87')](_0x3164ac[_0xd423('0x55')],[_0xd423('0x65'),'id'])||{})['spread'](function(_0xe27e8b){for(var _0xe3447c=0x0;_0xe3447c<_0x3164ac[_0xd423('0x55')][_0xd423('0x65')][_0xd423('0x3d')];_0xe3447c+=0x1){socket['emit']('userCmList:save',{'UserId':Number(_0x3164ac[_0xd423('0x55')][_0xd423('0x65')][_0xe3447c]),'CmListId':Number(_0x3164ac[_0xd423('0x4a')]['id'])});}return _0xe27e8b;});}})['then'](respondWithResult(_0x35d901,null))[_0xd423('0x48')](handleError(_0x35d901,null));};exports[_0xd423('0x88')]=function(_0x5dcb1b,_0x3ceb5d,_0x51a938){return db[_0xd423('0x31')][_0xd423('0x4d')]({'where':{'id':_0x5dcb1b[_0xd423('0x4a')]['id']}})[_0xd423('0x28')](handleEntityNotFound(_0x3ceb5d,null))[_0xd423('0x28')](function(_0x4d3f8e){if(_0x4d3f8e){return _0x4d3f8e[_0xd423('0x88')](_0x5dcb1b[_0xd423('0x38')][_0xd423('0x65')])[_0xd423('0x28')](function(){if(_['isArray'](_0x5dcb1b[_0xd423('0x38')][_0xd423('0x65')])){for(var _0x3dd8c8=0x0;_0x3dd8c8<_0x5dcb1b['query']['ids'][_0xd423('0x3d')];_0x3dd8c8+=0x1){socket[_0xd423('0x89')](_0xd423('0x8a'),{'UserId':Number(_0x5dcb1b[_0xd423('0x38')][_0xd423('0x65')][_0x3dd8c8]),'CmListId':Number(_0x5dcb1b['params']['id'])});}}else{socket[_0xd423('0x89')](_0xd423('0x8a'),{'UserId':Number(_0x5dcb1b[_0xd423('0x38')][_0xd423('0x65')]),'CmListId':Number(_0x5dcb1b[_0xd423('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x3ceb5d,null))['catch'](handleError(_0x3ceb5d,null));};exports[_0xd423('0x8b')]=function(_0x38c50e,_0x5e4d23,_0xebb077){var _0xdd2291={};var _0x996089={};var _0x20f175;var _0x2b9785;return db['CmList']['findOne']({'where':{'id':_0x38c50e[_0xd423('0x4a')]['id']}})[_0xd423('0x28')](handleEntityNotFound(_0x5e4d23,null))[_0xd423('0x28')](function(_0x2a5274){if(_0x2a5274){_0x20f175=_0x2a5274;_0x996089['model']=_['keys'](db[_0xd423('0x8c')]['rawAttributes']);_0x996089['query']=_[_0xd423('0x39')](_0x38c50e[_0xd423('0x38')]);_0x996089['filters']=_[_0xd423('0x3b')](_0x996089[_0xd423('0x36')],_0x996089[_0xd423('0x38')]);_0xdd2291['attributes']=_[_0xd423('0x3b')](_0x996089[_0xd423('0x36')],qs[_0xd423('0x4b')](_0x38c50e[_0xd423('0x38')][_0xd423('0x4b')]));_0xdd2291['attributes']=_0xdd2291[_0xd423('0x3c')][_0xd423('0x3d')]?_0xdd2291[_0xd423('0x3c')]:_0x996089[_0xd423('0x36')];_0xdd2291['order']=qs[_0xd423('0x40')](_0x38c50e['query'][_0xd423('0x40')]);_0xdd2291[_0xd423('0x41')]=qs['filters'](_[_0xd423('0x42')](_0x38c50e[_0xd423('0x38')],_0x996089['filters']));if(_0x38c50e['query'][_0xd423('0x5c')]){_0xdd2291[_0xd423('0x41')]=_['merge'](_0xdd2291[_0xd423('0x41')],{'$or':_[_0xd423('0x37')](_0xdd2291[_0xd423('0x3c')],function(_0x59a696){var _0x2bec7e={};_0x2bec7e[_0x59a696]={'$like':'%'+_0x38c50e[_0xd423('0x38')]['filter']+'%'};return _0x2bec7e;})});}_0xdd2291=_[_0xd423('0x43')]({},_0xdd2291,_0x38c50e[_0xd423('0x4c')]);return _0x20f175['getAgents'](_0xdd2291);}})[_0xd423('0x28')](function(_0x15459f){if(_0x15459f){_0x2b9785=_0x15459f[_0xd423('0x3d')];if(!_0x38c50e[_0xd423('0x38')][_0xd423('0x5b')](_0xd423('0x3e'))){_0xdd2291['limit']=qs[_0xd423('0x21')](_0x38c50e[_0xd423('0x38')][_0xd423('0x21')]);_0xdd2291[_0xd423('0x1f')]=qs[_0xd423('0x1f')](_0x38c50e['query']['offset']);}return _0x20f175[_0xd423('0x8b')](_0xdd2291);}})['then'](function(_0x2e75b4){if(_0x2e75b4){return _0x2e75b4?{'count':_0x2b9785,'rows':_0x2e75b4}:null;}})[_0xd423('0x28')](respondWithResult(_0x5e4d23,null))[_0xd423('0x48')](handleError(_0x5e4d23,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index c2ebbea..cd8add8 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 _0x326f=['exports','events','setMaxListeners','save','update','remove','emit','hook'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x326f,0xd1));var _0xf326=function(_0x5d2ba1,_0x569801){_0x5d2ba1=_0x5d2ba1-0x0;var _0x23e59c=_0x326f[_0x5d2ba1];return _0x23e59c;};'use strict';var EventEmitter=require(_0xf326('0x0'));var CmList=require('../../mysqldb')['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0xf326('0x1')](0x0);var events={'afterCreate':_0xf326('0x2'),'afterUpdate':_0xf326('0x3'),'afterDestroy':_0xf326('0x4')};function emitEvent(_0x27e8d7){return function(_0x120a26,_0x9445c6,_0xf1c243){CmListEvents[_0xf326('0x5')](_0x27e8d7+':'+_0x120a26['id'],_0x120a26);CmListEvents[_0xf326('0x5')](_0x27e8d7,_0x120a26);_0xf1c243(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xf326('0x6')](e,emitEvent(event));}}module[_0xf326('0x7')]=CmListEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe14b,0x93));var _0xbe14=function(_0x48d5da,_0x2c85e4){_0x48d5da=_0x48d5da-0x0;var _0x5ab43b=_0xe14b[_0x48d5da];return _0x5ab43b;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index f286f74..25f6caf 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 _0xcb91=['rimraf','./cmList.attributes','exports','define','cm_lists','../../config/logger','api','moment','bluebird','path'];(function(_0xecd971,_0x4e183d){var _0x4c97dd=function(_0x3f5b1c){while(--_0x3f5b1c){_0xecd971['push'](_0xecd971['shift']());}};_0x4c97dd(++_0x4e183d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x29e35f,_0x4859ef){_0x29e35f=_0x29e35f-0x0;var _0x266b74=_0xcb91[_0x29e35f];return _0x266b74;};'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')]('CmList',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa75b=['request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','lodash','api','moment','bluebird'];(function(_0x289e64,_0x5adb3c){var _0x30246c=function(_0x1bf7f6){while(--_0x1bf7f6){_0x289e64['push'](_0x289e64['shift']());}};_0x30246c(++_0x5adb3c);}(_0xa75b,0x170));var _0xba75=function(_0x3b458a,_0x560793){_0x3b458a=_0x3b458a-0x0;var _0x318125=_0xa75b[_0x3b458a];return _0x318125;};'use strict';var _=require(_0xba75('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xba75('0x1'));var moment=require(_0xba75('0x2'));var BPromise=require(_0xba75('0x3'));var rp=require(_0xba75('0x4'));var fs=require('fs');var path=require(_0xba75('0x5'));var rimraf=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var attributes=require(_0xba75('0x8'));module[_0xba75('0x9')]=function(_0x41afc9,_0x2baa28){return _0x41afc9[_0xba75('0xa')](_0xba75('0xb'),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 c03d710..5ace9e0 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 _0x489a=['then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./cmList.socket','register','request'];(function(_0x1e235e,_0x994b77){var _0x1e8e94=function(_0x4a9e2c){while(--_0x4a9e2c){_0x1e235e['push'](_0x1e235e['shift']());}};_0x1e8e94(++_0x994b77);}(_0x489a,0xc7));var _0xa489=function(_0x5ebe34,_0x421337){_0x5ebe34=_0x5ebe34-0x0;var _0x36a3ee=_0x489a[_0x5ebe34];return _0x36a3ee;};'use strict';var _=require('lodash');var util=require(_0xa489('0x0'));var moment=require(_0xa489('0x1'));var BPromise=require(_0xa489('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa489('0x3'));var db=require(_0xa489('0x4'))['db'];var utils=require(_0xa489('0x5'));var logger=require(_0xa489('0x6'))(_0xa489('0x7'));var config=require('../../config/environment');var jayson=require(_0xa489('0x8'));var client=jayson[_0xa489('0x9')]['http']({'port':0x232a});config['redis']=_[_0xa489('0xa')](config['redis'],{'host':_0xa489('0xb'),'port':0x18eb});var socket=require(_0xa489('0xc'))(new Redis(config[_0xa489('0xd')]));require(_0xa489('0xe'))[_0xa489('0xf')](socket);function respondWithRpcPromise(_0xf7e351,_0x397b6b,_0x32433d){return new BPromise(function(_0x37854e,_0x5d13c6){return client[_0xa489('0x10')](_0xf7e351,_0x32433d)[_0xa489('0x11')](function(_0x1807cd){logger[_0xa489('0x12')](_0xa489('0x13'),_0x397b6b,_0xa489('0x14'));logger[_0xa489('0x15')](_0xa489('0x16'),_0x397b6b,_0xa489('0x14'),JSON[_0xa489('0x17')](_0x1807cd));if(_0x1807cd[_0xa489('0x18')]){if(_0x1807cd[_0xa489('0x18')][_0xa489('0x19')]===0x1f4){logger[_0xa489('0x18')](_0xa489('0x13'),_0x397b6b,_0x1807cd['error'][_0xa489('0x1a')]);return _0x5d13c6(_0x1807cd[_0xa489('0x18')][_0xa489('0x1a')]);}logger[_0xa489('0x18')](_0xa489('0x13'),_0x397b6b,_0x1807cd[_0xa489('0x18')][_0xa489('0x1a')]);return _0x37854e(_0x1807cd['error']['message']);}else{logger[_0xa489('0x12')](_0xa489('0x13'),_0x397b6b,_0xa489('0x14'));_0x37854e(_0x1807cd['result'][_0xa489('0x1a')]);}})['catch'](function(_0x499f5e){logger[_0xa489('0x18')](_0xa489('0x13'),_0x397b6b,_0x499f5e);_0x5d13c6(_0x499f5e);});});} \ No newline at end of file +var _0x23fd=['client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x3aaf0a,_0x450970){var _0x33e6bc=function(_0x1db54d){while(--_0x1db54d){_0x3aaf0a['push'](_0x3aaf0a['shift']());}};_0x33e6bc(++_0x450970);}(_0x23fd,0x121));var _0xd23f=function(_0x32dfdb,_0x5b9400){_0x32dfdb=_0x32dfdb-0x0;var _0xec9630=_0x23fd[_0x32dfdb];return _0xec9630;};'use strict';var _=require(_0xd23f('0x0'));var util=require(_0xd23f('0x1'));var moment=require(_0xd23f('0x2'));var BPromise=require('bluebird');var rs=require(_0xd23f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd23f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd23f('0x5'))(_0xd23f('0x6'));var config=require('../../config/environment');var jayson=require(_0xd23f('0x7'));var client=jayson[_0xd23f('0x8')][_0xd23f('0x9')]({'port':0x232a});config[_0xd23f('0xa')]=_[_0xd23f('0xb')](config[_0xd23f('0xa')],{'host':_0xd23f('0xc'),'port':0x18eb});var socket=require(_0xd23f('0xd'))(new Redis(config[_0xd23f('0xa')]));require(_0xd23f('0xe'))[_0xd23f('0xf')](socket);function respondWithRpcPromise(_0x17b0f1,_0x587fd9,_0x46efe8){return new BPromise(function(_0x4cad32,_0x9358d7){return client[_0xd23f('0x10')](_0x17b0f1,_0x46efe8)[_0xd23f('0x11')](function(_0x2233eb){logger['info'](_0xd23f('0x12'),_0x587fd9,'request\x20sent');logger[_0xd23f('0x13')](_0xd23f('0x14'),_0x587fd9,_0xd23f('0x15'),JSON[_0xd23f('0x16')](_0x2233eb));if(_0x2233eb['error']){if(_0x2233eb[_0xd23f('0x17')][_0xd23f('0x18')]===0x1f4){logger[_0xd23f('0x17')](_0xd23f('0x12'),_0x587fd9,_0x2233eb[_0xd23f('0x17')][_0xd23f('0x19')]);return _0x9358d7(_0x2233eb[_0xd23f('0x17')][_0xd23f('0x19')]);}logger[_0xd23f('0x17')](_0xd23f('0x12'),_0x587fd9,_0x2233eb[_0xd23f('0x17')][_0xd23f('0x19')]);return _0x4cad32(_0x2233eb[_0xd23f('0x17')][_0xd23f('0x19')]);}else{logger[_0xd23f('0x1a')](_0xd23f('0x12'),_0x587fd9,_0xd23f('0x15'));_0x4cad32(_0x2233eb['result'][_0xd23f('0x19')]);}})['catch'](function(_0x104bdd){logger[_0xd23f('0x17')]('CmList,\x20%s,\x20%s',_0x587fd9,_0x104bdd);_0x9358d7(_0x104bdd);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 66dcbba..06d383c 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 _0x9771=['cmList:','save','remove','update','removeListener','length'];(function(_0xc8a02c,_0x4809d3){var _0x3d89da=function(_0x5903d8){while(--_0x5903d8){_0xc8a02c['push'](_0xc8a02c['shift']());}};_0x3d89da(++_0x4809d3);}(_0x9771,0xc1));var _0x1977=function(_0x58a579,_0x3fb984){_0x58a579=_0x58a579-0x0;var _0x587781=_0x9771[_0x58a579];return _0x587781;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x1977('0x0'),_0x1977('0x1'),_0x1977('0x2')];function createListener(_0x5c7585,_0x368fd9){return function(_0x5d97ef){_0x368fd9['emit'](_0x5c7585,_0x5d97ef);};}function removeListener(_0xa773df,_0x6adc35){return function(){CmListEvents[_0x1977('0x3')](_0xa773df,_0x6adc35);};}exports['register']=function(_0x14fb57){for(var _0x3b1573=0x0,_0x177b01=events[_0x1977('0x4')];_0x3b1573<_0x177b01;_0x3b1573++){var _0x2587bb=events[_0x3b1573];var _0x4248de=createListener(_0x1977('0x5')+_0x2587bb,_0x14fb57);CmListEvents['on'](_0x2587bb,_0x4248de);}}; \ No newline at end of file +var _0x815a=['./cmList.events','save','remove','update','removeListener','register','length','cmList:'];(function(_0x4e2db8,_0x145135){var _0x4231f6=function(_0x4f583c){while(--_0x4f583c){_0x4e2db8['push'](_0x4e2db8['shift']());}};_0x4231f6(++_0x145135);}(_0x815a,0x170));var _0xa815=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x815a[_0x36dfbd];return _0x4ecad9;};'use strict';var CmListEvents=require(_0xa815('0x0'));var events=[_0xa815('0x1'),_0xa815('0x2'),_0xa815('0x3')];function createListener(_0x3af0fa,_0x382281){return function(_0x44dc44){_0x382281['emit'](_0x3af0fa,_0x44dc44);};}function removeListener(_0x2c5c93,_0x2ca4d2){return function(){CmListEvents[_0xa815('0x4')](_0x2c5c93,_0x2ca4d2);};}exports[_0xa815('0x5')]=function(_0x567876){for(var _0x2785b0=0x0,_0x210b21=events[_0xa815('0x6')];_0x2785b0<_0x210b21;_0x2785b0++){var _0x32477c=events[_0x2785b0];var _0x8edc8d=createListener(_0xa815('0x7')+_0x32477c,_0x567876);CmListEvents['on'](_0x32477c,_0x8edc8d);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 55dbf3a..0b9ec5a 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 _0xed70=['/:id/users','getAgents','post','create','addContacts','addCustomField','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAgents','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','isAuthenticated','show','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields'];(function(_0x4ab9a2,_0x1fdbca){var _0x10d7d7=function(_0x21d124){while(--_0x21d124){_0x4ab9a2['push'](_0x4ab9a2['shift']());}};_0x10d7d7(++_0x1fdbca);}(_0xed70,0x75));var _0x0ed7=function(_0x3e3e56,_0x59a258){_0x3e3e56=_0x3e3e56-0x0;var _0x5a935e=_0xed70[_0x3e3e56];return _0x5a935e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0ed7('0x0'));var timeout=require(_0x0ed7('0x1'));var express=require(_0x0ed7('0x2'));var router=express[_0x0ed7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0ed7('0x4'));var interaction=require(_0x0ed7('0x5'));var config=require(_0x0ed7('0x6'));var controller=require(_0x0ed7('0x7'));router[_0x0ed7('0x8')]('/',auth['isAuthenticated'](),controller[_0x0ed7('0x9')]);router[_0x0ed7('0x8')]('/describe',auth[_0x0ed7('0xa')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x0ed7('0xb')]);router['get'](_0x0ed7('0xc'),auth['isAuthenticated'](),controller[_0x0ed7('0xd')]);router['get']('/:id/contacts',auth['isAuthenticated'](),controller[_0x0ed7('0xe')]);router['get'](_0x0ed7('0xf'),auth[_0x0ed7('0xa')](),controller[_0x0ed7('0x10')]);router[_0x0ed7('0x8')](_0x0ed7('0x11'),auth[_0x0ed7('0xa')](),controller[_0x0ed7('0x12')]);router[_0x0ed7('0x8')](_0x0ed7('0x13'),auth['isAuthenticated'](),controller[_0x0ed7('0x14')]);router[_0x0ed7('0x15')]('/',auth[_0x0ed7('0xa')](),controller[_0x0ed7('0x16')]);router['post']('/:id/dispositions',auth[_0x0ed7('0xa')](),controller['addDisposition']);router[_0x0ed7('0x15')]('/:id/contacts',auth[_0x0ed7('0xa')](),controller[_0x0ed7('0x17')]);router[_0x0ed7('0x15')]('/:id/fields',auth[_0x0ed7('0xa')](),controller[_0x0ed7('0x18')]);router[_0x0ed7('0x15')](_0x0ed7('0x13'),auth['isAuthenticated'](),controller[_0x0ed7('0x19')]);router[_0x0ed7('0x1a')](_0x0ed7('0x1b'),auth[_0x0ed7('0xa')](),controller[_0x0ed7('0x1c')]);router[_0x0ed7('0x1d')](_0x0ed7('0x1b'),auth[_0x0ed7('0xa')](),controller[_0x0ed7('0x1e')]);router['delete'](_0x0ed7('0xc'),auth[_0x0ed7('0xa')](),controller[_0x0ed7('0x1f')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x0ed7('0x20')]);module[_0x0ed7('0x21')]=router; \ No newline at end of file +var _0x02fd=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./cmList.controller','get','describe','/:id','isAuthenticated','show','/:id/dispositions','/:id/contacts/csv','getContactsCsv','getCustomFields','getAgents','post','create','addDisposition','/:id/contacts','addContacts','/:id/fields','addAgents','put','update','delete','removeDispositions','/:id/users','removeAgents','exports','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x02fd,0x1b1));var _0xd02f=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x02fd[_0x15c421];return _0x5e5ed5;};'use strict';var multer=require('multer');var util=require(_0xd02f('0x0'));var path=require(_0xd02f('0x1'));var timeout=require(_0xd02f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd02f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xd02f('0x4'));var config=require(_0xd02f('0x5'));var controller=require(_0xd02f('0x6'));router[_0xd02f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd02f('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xd02f('0x8')]);router[_0xd02f('0x7')](_0xd02f('0x9'),auth[_0xd02f('0xa')](),controller[_0xd02f('0xb')]);router[_0xd02f('0x7')](_0xd02f('0xc'),auth[_0xd02f('0xa')](),controller['getDispositions']);router[_0xd02f('0x7')]('/:id/contacts',auth['isAuthenticated'](),controller['getContacts']);router[_0xd02f('0x7')](_0xd02f('0xd'),auth[_0xd02f('0xa')](),controller[_0xd02f('0xe')]);router[_0xd02f('0x7')]('/:id/fields',auth[_0xd02f('0xa')](),controller[_0xd02f('0xf')]);router[_0xd02f('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0xd02f('0x10')]);router[_0xd02f('0x11')]('/',auth['isAuthenticated'](),controller[_0xd02f('0x12')]);router[_0xd02f('0x11')](_0xd02f('0xc'),auth['isAuthenticated'](),controller[_0xd02f('0x13')]);router[_0xd02f('0x11')](_0xd02f('0x14'),auth[_0xd02f('0xa')](),controller[_0xd02f('0x15')]);router[_0xd02f('0x11')](_0xd02f('0x16'),auth['isAuthenticated'](),controller['addCustomField']);router[_0xd02f('0x11')]('/:id/users',auth[_0xd02f('0xa')](),controller[_0xd02f('0x17')]);router[_0xd02f('0x18')](_0xd02f('0x9'),auth[_0xd02f('0xa')](),controller[_0xd02f('0x19')]);router['delete'](_0xd02f('0x9'),auth[_0xd02f('0xa')](),controller['destroy']);router[_0xd02f('0x1a')]('/:id/dispositions',auth[_0xd02f('0xa')](),controller[_0xd02f('0x1b')]);router[_0xd02f('0x1a')](_0xd02f('0x1c'),auth[_0xd02f('0xa')](),controller[_0xd02f('0x1d')]);module[_0xd02f('0x1e')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 6b66e16..75243b7 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 _0xfe81=['STRING','sequelize','exports','VIRTUAL','getDataValue','field'];(function(_0x49e584,_0x2886f8){var _0x58b1be=function(_0x40397c){while(--_0x40397c){_0x49e584['push'](_0x49e584['shift']());}};_0x58b1be(++_0x2886f8);}(_0xfe81,0xa3));var _0x1fe8=function(_0x30a31e,_0x31f766){_0x30a31e=_0x30a31e-0x0;var _0x170879=_0xfe81[_0x30a31e];return _0x170879;};'use strict';var Sequelize=require(_0x1fe8('0x0'));module[_0x1fe8('0x1')]={'name':{'type':Sequelize[_0x1fe8('0x2')],'get':function(_0x417acd){return this[_0x1fe8('0x3')](_0x1fe8('0x4'));}},'field':{'type':Sequelize[_0x1fe8('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x1fe8('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x1fe8('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0xd7eb=['sequelize','exports','VIRTUAL','getDataValue','field','STRING'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xd7eb,0x66));var _0xbd7e=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xd7eb[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0xbd7e('0x0'));module[_0xbd7e('0x1')]={'name':{'type':Sequelize[_0xbd7e('0x2')],'get':function(_0x2ccbc2){return this[_0xbd7e('0x3')](_0xbd7e('0x4'));}},'field':{'type':Sequelize[_0xbd7e('0x5')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 17cea37..4847910 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(_0x328ec5,_0x16df6d){var _0x428e77=function(_0x45bf80){while(--_0x45bf80){_0x328ec5['push'](_0x328ec5['shift']());}};_0x428e77(++_0x16df6d);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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(_0x35555d,_0xe36793){var _0x1a7609=function(_0x599e9a){while(--_0x599e9a){_0x35555d['push'](_0x35555d['shift']());}};_0x1a7609(++_0xe36793);}(_0x7a54,0x106));var _0x47a5=function(_0x2a1965,_0x5b39d3){_0x2a1965=_0x2a1965-0x0;var _0x40b7e6=_0x7a54[_0x2a1965];return _0x40b7e6;};'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 e384245..0edcfaf 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 _0xd45d=['tools_conditions','util','api','moment','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','Condition'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd45d,0xe8));var _0xdd45=function(_0x5b84d1,_0x387330){_0x5b84d1=_0x5b84d1-0x0;var _0x598650=_0xd45d[_0x5b84d1];return _0x598650;};'use strict';var _=require('lodash');var util=require(_0xdd45('0x0'));var logger=require('../../config/logger')(_0xdd45('0x1'));var moment=require(_0xdd45('0x2'));var BPromise=require('bluebird');var rp=require(_0xdd45('0x3'));var fs=require('fs');var path=require(_0xdd45('0x4'));var rimraf=require(_0xdd45('0x5'));var config=require(_0xdd45('0x6'));var attributes=require(_0xdd45('0x7'));module[_0xdd45('0x8')]=function(_0x84edfb,_0x4c6d23){return _0x84edfb['define'](_0xdd45('0x9'),attributes,{'tableName':_0xdd45('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x673d=['../../config/logger','api','bluebird','path','./condition.attributes','exports','Condition','tools_conditions','lodash','util'];(function(_0x3b3cc6,_0x1a6e24){var _0x1161e4=function(_0x19cc52){while(--_0x19cc52){_0x3b3cc6['push'](_0x3b3cc6['shift']());}};_0x1161e4(++_0x1a6e24);}(_0x673d,0xda));var _0xd673=function(_0x43f9fd,_0x3bb23c){_0x43f9fd=_0x43f9fd-0x0;var _0x15360e=_0x673d[_0x43f9fd];return _0x15360e;};'use strict';var _=require(_0xd673('0x0'));var util=require(_0xd673('0x1'));var logger=require(_0xd673('0x2'))(_0xd673('0x3'));var moment=require('moment');var BPromise=require(_0xd673('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd673('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd673('0x6'));module[_0xd673('0x7')]=function(_0x2fb0e8,_0x33392b){return _0x2fb0e8['define'](_0xd673('0x8'),attributes,{'tableName':_0xd673('0x9'),'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 c3e0531..65eac2e 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 _0x1653=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x43e19a,_0x3127f2){var _0x35099e=function(_0x3bbc47){while(--_0x3bbc47){_0x43e19a['push'](_0x43e19a['shift']());}};_0x35099e(++_0x3127f2);}(_0x1653,0x17a));var _0x3165=function(_0x20e5c3,_0x41470c){_0x20e5c3=_0x20e5c3-0x0;var _0x401520=_0x1653[_0x20e5c3];return _0x401520;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3165('0x0'));var BPromise=require('bluebird');var rs=require(_0x3165('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3165('0x2'))['db'];var utils=require(_0x3165('0x3'));var logger=require(_0x3165('0x4'))(_0x3165('0x5'));var config=require(_0x3165('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3165('0x7')][_0x3165('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3da8c0,_0x34f566,_0x48621d){return new BPromise(function(_0x193fb6,_0x250c48){return client[_0x3165('0x9')](_0x3da8c0,_0x48621d)[_0x3165('0xa')](function(_0xbc570b){logger['info'](_0x3165('0xb'),_0x34f566,_0x3165('0xc'));logger['debug'](_0x3165('0xd'),_0x34f566,_0x3165('0xc'),JSON[_0x3165('0xe')](_0xbc570b));if(_0xbc570b['error']){if(_0xbc570b[_0x3165('0xf')][_0x3165('0x10')]===0x1f4){logger[_0x3165('0xf')](_0x3165('0xb'),_0x34f566,_0xbc570b[_0x3165('0xf')]['message']);return _0x250c48(_0xbc570b[_0x3165('0xf')][_0x3165('0x11')]);}logger[_0x3165('0xf')](_0x3165('0xb'),_0x34f566,_0xbc570b['error'][_0x3165('0x11')]);return _0x193fb6(_0xbc570b[_0x3165('0xf')][_0x3165('0x11')]);}else{logger[_0x3165('0x12')](_0x3165('0xb'),_0x34f566,_0x3165('0xc'));_0x193fb6(_0xbc570b[_0x3165('0x13')][_0x3165('0x11')]);}})[_0x3165('0x14')](function(_0x2d7849){logger['error']('Condition,\x20%s,\x20%s',_0x34f566,_0x2d7849);_0x250c48(_0x2d7849);});});} \ No newline at end of file +var _0xcbf8=['error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4628c6,_0x212c5e){var _0x181ddc=function(_0x36280a){while(--_0x36280a){_0x4628c6['push'](_0x4628c6['shift']());}};_0x181ddc(++_0x212c5e);}(_0xcbf8,0x18c));var _0x8cbf=function(_0x4dbc46,_0x576c7c){_0x4dbc46=_0x4dbc46-0x0;var _0x54fa06=_0xcbf8[_0x4dbc46];return _0x54fa06;};'use strict';var _=require(_0x8cbf('0x0'));var util=require(_0x8cbf('0x1'));var moment=require(_0x8cbf('0x2'));var BPromise=require(_0x8cbf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8cbf('0x4'));var db=require(_0x8cbf('0x5'))['db'];var utils=require(_0x8cbf('0x6'));var logger=require(_0x8cbf('0x7'))(_0x8cbf('0x8'));var config=require(_0x8cbf('0x9'));var jayson=require(_0x8cbf('0xa'));var client=jayson[_0x8cbf('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x457c5c,_0xcc63bf,_0x3396f3){return new BPromise(function(_0x50b196,_0x5505f5){return client[_0x8cbf('0xc')](_0x457c5c,_0x3396f3)['then'](function(_0x296a18){logger['info'](_0x8cbf('0xd'),_0xcc63bf,_0x8cbf('0xe'));logger[_0x8cbf('0xf')](_0x8cbf('0x10'),_0xcc63bf,_0x8cbf('0xe'),JSON[_0x8cbf('0x11')](_0x296a18));if(_0x296a18['error']){if(_0x296a18[_0x8cbf('0x12')][_0x8cbf('0x13')]===0x1f4){logger[_0x8cbf('0x12')](_0x8cbf('0xd'),_0xcc63bf,_0x296a18[_0x8cbf('0x12')][_0x8cbf('0x14')]);return _0x5505f5(_0x296a18['error'][_0x8cbf('0x14')]);}logger[_0x8cbf('0x12')](_0x8cbf('0xd'),_0xcc63bf,_0x296a18[_0x8cbf('0x12')][_0x8cbf('0x14')]);return _0x50b196(_0x296a18[_0x8cbf('0x12')][_0x8cbf('0x14')]);}else{logger['info'](_0x8cbf('0xd'),_0xcc63bf,'request\x20sent');_0x50b196(_0x296a18[_0x8cbf('0x15')][_0x8cbf('0x14')]);}})[_0x8cbf('0x16')](function(_0x212222){logger[_0x8cbf('0x12')](_0x8cbf('0xd'),_0xcc63bf,_0x212222);_0x5505f5(_0x212222);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 2797473..739ca98 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 _0xd2e0=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./condition.controller','update','delete','/:id','isAuthenticated','destroy','exports','multer'];(function(_0x1fd450,_0x42cbf6){var _0x4cb0a5=function(_0x1384d4){while(--_0x1384d4){_0x1fd450['push'](_0x1fd450['shift']());}};_0x4cb0a5(++_0x42cbf6);}(_0xd2e0,0xe0));var _0x0d2e=function(_0x3e465b,_0x3ac185){_0x3e465b=_0x3e465b-0x0;var _0x277d88=_0xd2e0[_0x3e465b];return _0x277d88;};'use strict';var multer=require(_0x0d2e('0x0'));var util=require(_0x0d2e('0x1'));var path=require(_0x0d2e('0x2'));var timeout=require(_0x0d2e('0x3'));var express=require(_0x0d2e('0x4'));var router=express[_0x0d2e('0x5')]();var fs_extra=require(_0x0d2e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0d2e('0x7'));var config=require('../../config/environment');var controller=require(_0x0d2e('0x8'));router['put']('/:id',auth['isAuthenticated'](),controller[_0x0d2e('0x9')]);router[_0x0d2e('0xa')](_0x0d2e('0xb'),auth[_0x0d2e('0xc')](),controller[_0x0d2e('0xd')]);module[_0x0d2e('0xe')]=router; \ No newline at end of file +var _0x7a0e=['delete','destroy','util','path','express','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a0e,0x199));var _0xe7a0=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x7a0e[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require('multer');var util=require(_0xe7a0('0x0'));var path=require(_0xe7a0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe7a0('0x2'));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(_0xe7a0('0x3'));var controller=require(_0xe7a0('0x4'));router[_0xe7a0('0x5')](_0xe7a0('0x6'),auth[_0xe7a0('0x7')](),controller[_0xe7a0('0x8')]);router[_0xe7a0('0x9')](_0xe7a0('0x6'),auth[_0xe7a0('0x7')](),controller[_0xe7a0('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 1c39296..3fbba9a 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 _0xb7e7=['STRING','sequelize'];(function(_0x318840,_0x561b1e){var _0x223da4=function(_0x510071){while(--_0x510071){_0x318840['push'](_0x318840['shift']());}};_0x223da4(++_0x561b1e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xb7e7[_0x38ced4];return _0x547c07;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x3fe042,_0x1106f7){var _0x7d4a1f=function(_0x2df987){while(--_0x2df987){_0x3fe042['push'](_0x3fe042['shift']());}};_0x7d4a1f(++_0x1106f7);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'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 36c1a96..0985f74 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 _0x6457=['../../config/license/util','../../mysqldb','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','CustomDashboards','UserProfileResource','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where','pick','merge','VIRTUAL','filter','Dashboard','includeAll','include','rows','show','params','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','clone','omit','createdAt','updatedAt','body','autoAssociation','error','iframe','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','sort','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment'];(function(_0x3b4b20,_0x247cdf){var _0x25bb98=function(_0x1424b1){while(--_0x1424b1){_0x3b4b20['push'](_0x3b4b20['shift']());}};_0x25bb98(++_0x247cdf);}(_0x6457,0x67));var _0x7645=function(_0x5d16cc,_0x5c3690){_0x5d16cc=_0x5d16cc-0x0;var _0x131784=_0x6457[_0x5d16cc];return _0x131784;};'use strict';var emlformat=require(_0x7645('0x0'));var rimraf=require(_0x7645('0x1'));var zipdir=require(_0x7645('0x2'));var jsonpatch=require(_0x7645('0x3'));var rp=require('request-promise');var moment=require(_0x7645('0x4'));var BPromise=require(_0x7645('0x5'));var Mustache=require(_0x7645('0x6'));var util=require(_0x7645('0x7'));var path=require(_0x7645('0x8'));var sox=require(_0x7645('0x9'));var csv=require(_0x7645('0xa'));var ejs=require(_0x7645('0xb'));var fs=require('fs');var fs_extra=require(_0x7645('0xc'));var _=require(_0x7645('0xd'));var squel=require(_0x7645('0xe'));var crypto=require(_0x7645('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7645('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7645('0x11'));var Papa=require(_0x7645('0x12'));var Redis=require('ioredis');var authService=require(_0x7645('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7645('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7645('0x15'));var utils=require('../../config/utils');var config=require(_0x7645('0x16'));var licenseUtil=require(_0x7645('0x17'));var db=require(_0x7645('0x18'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x7645('0x19'),'port':0x18eb});var socket=require(_0x7645('0x1a'))(new Redis(config['redis']));require('./dashboard.socket')[_0x7645('0x1b')](socket);function respondWithStatusCode(_0x578da9,_0x552658){_0x552658=_0x552658||0xcc;return function(_0x25fb68){if(_0x25fb68){return _0x578da9[_0x7645('0x1c')](_0x552658);}return _0x578da9['status'](_0x552658)[_0x7645('0x1d')]();};}function respondWithResult(_0x1bfee8,_0x44b19a){_0x44b19a=_0x44b19a||0xc8;return function(_0x38d9be){if(_0x38d9be){return _0x1bfee8[_0x7645('0x1e')](_0x44b19a)[_0x7645('0x1f')](_0x38d9be);}};}function respondWithFilteredResult(_0x45b478,_0x434c6e){return function(_0x3945b6){if(_0x3945b6){var _0x15733c=typeof _0x434c6e[_0x7645('0x20')]===_0x7645('0x21')&&typeof _0x434c6e[_0x7645('0x22')]===_0x7645('0x21');var _0x5b11a0=_0x3945b6[_0x7645('0x23')];var _0xab8e=_0x15733c?0x0:_0x434c6e[_0x7645('0x20')];var _0x23bbcc=_0x15733c?_0x3945b6[_0x7645('0x23')]:_0x434c6e[_0x7645('0x20')]+_0x434c6e['limit'];var _0x507311;if(_0x23bbcc>=_0x5b11a0){_0x23bbcc=_0x5b11a0;_0x507311=0xc8;}else{_0x507311=0xce;}_0x45b478[_0x7645('0x1e')](_0x507311);return _0x45b478[_0x7645('0x24')](_0x7645('0x25'),_0xab8e+'-'+_0x23bbcc+'/'+_0x5b11a0)[_0x7645('0x1f')](_0x3945b6);}return null;};}function patchUpdates(_0x27464e){return function(_0x45fd35){try{jsonpatch[_0x7645('0x26')](_0x45fd35,_0x27464e,!![]);}catch(_0x3e28d1){return BPromise[_0x7645('0x27')](_0x3e28d1);}return _0x45fd35[_0x7645('0x28')]();};}function saveUpdates(_0x16a101,_0x135d2e){return function(_0x4099da){if(_0x4099da){return _0x4099da[_0x7645('0x29')](_0x16a101)[_0x7645('0x2a')](function(_0x47ed43){return _0x47ed43;});}return null;};}function removeEntity(_0x525da5,_0x208d48){return function(_0x15b07d){if(_0x15b07d){return _0x15b07d['destroy']()['then'](function(){var _0x289377=_0x15b07d[_0x7645('0x2b')]({'plain':!![]});var _0x28d8d2=_0x7645('0x2c');return db[_0x7645('0x2d')][_0x7645('0x2e')]({'where':{'type':_0x28d8d2,'resourceId':_0x289377['id']}})[_0x7645('0x2a')](function(){return _0x15b07d;});})[_0x7645('0x2a')](function(){_0x525da5[_0x7645('0x1e')](0xcc)[_0x7645('0x1d')]();});}};}function handleEntityNotFound(_0x6b0e13,_0x44d604){return function(_0xed9b9e){if(!_0xed9b9e){_0x6b0e13['sendStatus'](0x194);}return _0xed9b9e;};}function handleError(_0x5ca1eb,_0x5c5691){_0x5c5691=_0x5c5691||0x1f4;return function(_0x1f0f17){logger['error'](_0x1f0f17[_0x7645('0x2f')]);if(_0x1f0f17['name']){delete _0x1f0f17[_0x7645('0x30')];}_0x5ca1eb[_0x7645('0x1e')](_0x5c5691)[_0x7645('0x31')](_0x1f0f17);};}exports[_0x7645('0x32')]=function(_0x244fd9,_0x5436dc){var _0x2bc4fd={},_0x1303a3={},_0x5c57f9={'count':0x0,'rows':[]};var _0x255cd4=_[_0x7645('0x33')](db['Dashboard'][_0x7645('0x34')],function(_0x39c6be){return{'name':_0x39c6be[_0x7645('0x35')],'type':_0x39c6be[_0x7645('0x36')][_0x7645('0x37')]};});_0x1303a3[_0x7645('0x38')]=_[_0x7645('0x33')](_0x255cd4,'name');_0x1303a3[_0x7645('0x39')]=_[_0x7645('0x3a')](_0x244fd9[_0x7645('0x39')]);_0x1303a3[_0x7645('0x3b')]=_[_0x7645('0x3c')](_0x1303a3['model'],_0x1303a3[_0x7645('0x39')]);_0x2bc4fd[_0x7645('0x3d')]=_[_0x7645('0x3c')](_0x1303a3['model'],qs[_0x7645('0x3e')](_0x244fd9[_0x7645('0x39')][_0x7645('0x3e')]));_0x2bc4fd[_0x7645('0x3d')]=_0x2bc4fd[_0x7645('0x3d')][_0x7645('0x3f')]?_0x2bc4fd[_0x7645('0x3d')]:_0x1303a3['model'];if(!_0x244fd9[_0x7645('0x39')]['hasOwnProperty'](_0x7645('0x40'))){_0x2bc4fd[_0x7645('0x22')]=qs[_0x7645('0x22')](_0x244fd9['query'][_0x7645('0x22')]);_0x2bc4fd[_0x7645('0x20')]=qs[_0x7645('0x20')](_0x244fd9[_0x7645('0x39')][_0x7645('0x20')]);}_0x2bc4fd[_0x7645('0x41')]=qs['sort'](_0x244fd9[_0x7645('0x39')]['sort']);_0x2bc4fd[_0x7645('0x42')]=qs[_0x7645('0x3b')](_[_0x7645('0x43')](_0x244fd9[_0x7645('0x39')],_0x1303a3[_0x7645('0x3b')]),_0x255cd4);if(_0x244fd9['query']['filter']){_0x2bc4fd[_0x7645('0x42')]=_[_0x7645('0x44')](_0x2bc4fd[_0x7645('0x42')],{'$or':_['map'](_0x255cd4,function(_0xb6615){if(_0xb6615['type']!==_0x7645('0x45')){var _0x56ae03={};_0x56ae03[_0xb6615[_0x7645('0x30')]]={'$like':'%'+_0x244fd9[_0x7645('0x39')][_0x7645('0x46')]+'%'};return _0x56ae03;}})});}_0x2bc4fd=_[_0x7645('0x44')]({},_0x2bc4fd,_0x244fd9['options']);var _0x4c7747={'where':_0x2bc4fd[_0x7645('0x42')]};return db[_0x7645('0x47')][_0x7645('0x23')](_0x4c7747)[_0x7645('0x2a')](function(_0x52c4f5){_0x5c57f9[_0x7645('0x23')]=_0x52c4f5;if(_0x244fd9[_0x7645('0x39')][_0x7645('0x48')]){_0x2bc4fd[_0x7645('0x49')]=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x2bc4fd);})[_0x7645('0x2a')](function(_0xab683){_0x5c57f9[_0x7645('0x4a')]=_0xab683;return _0x5c57f9;})['then'](respondWithFilteredResult(_0x5436dc,_0x2bc4fd))['catch'](handleError(_0x5436dc,null));};exports[_0x7645('0x4b')]=function(_0x4ee828,_0x57bf2c){var _0x91764={'raw':![],'where':{'id':_0x4ee828[_0x7645('0x4c')]['id']}},_0x136ab1={};_0x136ab1['model']=_[_0x7645('0x3a')](db[_0x7645('0x47')][_0x7645('0x34')]);_0x136ab1[_0x7645('0x39')]=_[_0x7645('0x3a')](_0x4ee828[_0x7645('0x39')]);_0x136ab1[_0x7645('0x3b')]=_[_0x7645('0x3c')](_0x136ab1['model'],_0x136ab1[_0x7645('0x39')]);_0x91764[_0x7645('0x3d')]=_[_0x7645('0x3c')](_0x136ab1['model'],qs[_0x7645('0x3e')](_0x4ee828[_0x7645('0x39')][_0x7645('0x3e')]));_0x91764['attributes']=_0x91764[_0x7645('0x3d')]['length']?_0x91764[_0x7645('0x3d')]:_0x136ab1['model'];if(_0x4ee828['query'][_0x7645('0x48')]){_0x91764[_0x7645('0x49')]=[{'all':!![]}];}_0x91764=_[_0x7645('0x44')]({},_0x91764,_0x4ee828[_0x7645('0x4d')]);return db['Dashboard'][_0x7645('0x4e')](_0x91764)['then'](handleEntityNotFound(_0x57bf2c,null))['then'](respondWithResult(_0x57bf2c,null))[_0x7645('0x4f')](handleError(_0x57bf2c,null));};exports[_0x7645('0x50')]=function(_0x575054,_0x5f9810){return db[_0x7645('0x47')]['create'](_0x575054['body'],{})['then'](function(_0x5ece36){var _0xf6b98f=_0x575054[_0x7645('0x51')]['get']({'plain':!![]});if(!_0xf6b98f)throw new Error(_0x7645('0x52'));if(_0xf6b98f[_0x7645('0x53')]===_0x7645('0x51')){var _0x1fec9e=_0x5ece36[_0x7645('0x2b')]({'plain':!![]});var _0x4e0b69=_0x7645('0x2c');return db[_0x7645('0x54')][_0x7645('0x4e')]({'where':{'name':_0x4e0b69,'userProfileId':_0xf6b98f[_0x7645('0x55')]},'raw':!![]})[_0x7645('0x2a')](function(_0x2c0c9a){if(_0x2c0c9a&&_0x2c0c9a['autoAssociation']===0x0){return db[_0x7645('0x2d')][_0x7645('0x50')]({'name':_0x1fec9e[_0x7645('0x30')],'resourceId':_0x1fec9e['id'],'type':_0x2c0c9a[_0x7645('0x30')],'sectionId':_0x2c0c9a['id']},{})[_0x7645('0x2a')](function(){return _0x5ece36;});}else{return _0x5ece36;}})[_0x7645('0x4f')](function(_0x80a9bf){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x80a9bf);throw _0x80a9bf;});}return _0x5ece36;})[_0x7645('0x2a')](respondWithResult(_0x5f9810,0xc9))['catch'](handleError(_0x5f9810,null));};exports[_0x7645('0x56')]=function(_0x460690,_0x167adb){var _0x2a57d4={'where':{'id':_0x460690['params']['id']}},_0x54f89c={};_0x54f89c['model']=_[_0x7645('0x3a')](db[_0x7645('0x47')][_0x7645('0x34')]);_0x2a57d4[_0x7645('0x3d')]=_[_0x7645('0x3c')](_0x54f89c[_0x7645('0x38')],qs['fields'](_0x460690[_0x7645('0x39')][_0x7645('0x3e')]));_0x2a57d4[_0x7645('0x3d')]=_0x2a57d4['attributes']['length']?_0x2a57d4[_0x7645('0x3d')]:_0x54f89c[_0x7645('0x38')];if(_0x460690[_0x7645('0x39')][_0x7645('0x48')]){_0x2a57d4[_0x7645('0x49')]=[{'all':!![]}];}_0x2a57d4=_[_0x7645('0x44')]({},_0x2a57d4,_0x460690[_0x7645('0x4d')]);return db['Dashboard'][_0x7645('0x4e')](_0x2a57d4)['then'](handleEntityNotFound(_0x167adb,null))[_0x7645('0x2a')](function(_0x831503){if(_0x831503){var _0x58c165=_0x831503[_0x7645('0x2b')]({'plain':!![]});_0x58c165=qs[_0x7645('0x57')](_0x58c165,['id',_0x7645('0x58'),_0x7645('0x59')]);_0x460690[_0x7645('0x5a')]=_[_0x7645('0x57')](_0x460690[_0x7645('0x5a')],['id',_0x7645('0x58'),_0x7645('0x59')]);return db[_0x7645('0x47')]['create'](_[_0x7645('0x44')](_0x58c165,_0x460690[_0x7645('0x5a')]),{'include':_0x460690['query'][_0x7645('0x48')]?[{'all':!![]}]:undefined})[_0x7645('0x2a')](function(_0x4a4e70){var _0x16fd06=_0x460690[_0x7645('0x51')][_0x7645('0x2b')]({'plain':!![]});if(!_0x16fd06)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16fd06[_0x7645('0x53')]==='user'){var _0x5935f2=_0x4a4e70[_0x7645('0x2b')]({'plain':!![]});var _0x2c7b71=_0x7645('0x2c');return db[_0x7645('0x54')][_0x7645('0x4e')]({'where':{'name':_0x2c7b71,'userProfileId':_0x16fd06[_0x7645('0x55')]},'raw':!![]})['then'](function(_0x2aa6e0){if(_0x2aa6e0&&_0x2aa6e0[_0x7645('0x5b')]===0x0){return db[_0x7645('0x2d')][_0x7645('0x50')]({'name':_0x5935f2['name'],'resourceId':_0x5935f2['id'],'type':_0x2aa6e0[_0x7645('0x30')],'sectionId':_0x2aa6e0['id']},{})[_0x7645('0x2a')](function(){return _0x4a4e70;});}else{return _0x4a4e70;}})['catch'](function(_0x94f8ff){logger[_0x7645('0x5c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x94f8ff);throw _0x94f8ff;});}return _0x4a4e70;});}})[_0x7645('0x2a')](respondWithResult(_0x167adb,0xc9))[_0x7645('0x4f')](handleError(_0x167adb,null));};exports['update']=function(_0x303103,_0x44bd97){if(_0x303103[_0x7645('0x5a')]['id']){delete _0x303103['body']['id'];}return db[_0x7645('0x47')][_0x7645('0x4e')]({'where':{'id':_0x303103[_0x7645('0x4c')]['id']}})[_0x7645('0x2a')](handleEntityNotFound(_0x44bd97,null))[_0x7645('0x2a')](saveUpdates(_0x303103[_0x7645('0x5a')],null))[_0x7645('0x2a')](respondWithResult(_0x44bd97,null))[_0x7645('0x4f')](handleError(_0x44bd97,null));};exports[_0x7645('0x2e')]=function(_0x3ae3bc,_0x4250ed){return db['Dashboard']['find']({'where':{'id':_0x3ae3bc[_0x7645('0x4c')]['id']}})[_0x7645('0x2a')](handleEntityNotFound(_0x4250ed,null))[_0x7645('0x2a')](removeEntity(_0x4250ed,null))[_0x7645('0x4f')](handleError(_0x4250ed,null));};function widgetAttributes(_0x206301){try{switch(_0x206301['type']){case _0x7645('0x5d'):return[{'name':'attrUrl','value':_0x206301['attrUrl']||(_0x206301['attrs']&&_0x206301[_0x7645('0x5e')][0x0]?_0x206301[_0x7645('0x5e')][0x0]['value']:undefined)||_0x7645('0x5f')}];case _0x7645('0x60'):return[{'name':'attrPath','value':_0x206301[_0x7645('0x61')]||(_0x206301[_0x7645('0x5e')]&&_0x206301['attrs'][0x0]?_0x206301[_0x7645('0x5e')][0x0][_0x7645('0x62')]:undefined)||''}];case _0x7645('0x63'):return[{'name':_0x7645('0x64'),'value':_0x206301[_0x7645('0x64')]||(_0x206301[_0x7645('0x5e')]&&_0x206301['attrs'][0x0]?_0x206301[_0x7645('0x5e')][0x0]['value']:undefined)||_0x7645('0x65')},{'name':_0x7645('0x66'),'value':_0x206301[_0x7645('0x66')]||(_0x206301['attrs']&&_0x206301[_0x7645('0x5e')][0x1]?_0x206301[_0x7645('0x5e')][0x1][_0x7645('0x62')]:undefined)||_0x7645('0x67')},{'name':_0x7645('0x68'),'value':_0x206301[_0x7645('0x68')]||(_0x206301[_0x7645('0x5e')]&&_0x206301[_0x7645('0x5e')][0x2]?_0x206301[_0x7645('0x5e')][0x2][_0x7645('0x62')]:undefined)||0xc}];case _0x7645('0x69'):return[{'name':'attrMetric','value':_0x206301[_0x7645('0x6a')]||(_0x206301[_0x7645('0x5e')]&&_0x206301['attrs'][0x0]?_0x206301[_0x7645('0x5e')][0x0]['value']:undefined)||'total'},{'name':_0x7645('0x6b'),'value':_0x206301['attrVoiceQueues']||(_0x206301['attrs']&&_0x206301[_0x7645('0x5e')][0x1]?_0x206301[_0x7645('0x5e')][0x1][_0x7645('0x62')]:undefined)||[]},{'name':'attrFontSize','value':_0x206301['attrFontSize']||(_0x206301[_0x7645('0x5e')]&&_0x206301[_0x7645('0x5e')][0x2]?_0x206301[_0x7645('0x5e')][0x2]['value']:undefined)||0x14}];case _0x7645('0x6c'):case _0x7645('0x6d'):return[{'name':_0x7645('0x6e'),'value':_0x206301['attrSerie1']||(_0x206301[_0x7645('0x5e')]&&_0x206301[_0x7645('0x5e')][0x0]?_0x206301['attrs'][0x0][_0x7645('0x62')]:undefined)||_0x7645('0x6f')},{'name':'attrSerie2','value':_0x206301[_0x7645('0x70')]||(_0x206301[_0x7645('0x5e')]&&_0x206301['attrs'][0x1]?_0x206301[_0x7645('0x5e')][0x1][_0x7645('0x62')]:undefined)||null},{'name':'attrSerie3','value':_0x206301[_0x7645('0x71')]||(_0x206301[_0x7645('0x5e')]&&_0x206301[_0x7645('0x5e')][0x2]?_0x206301[_0x7645('0x5e')][0x2]['value']:undefined)||null},{'name':_0x7645('0x6b'),'value':_0x206301[_0x7645('0x6b')]||(_0x206301['attrs']&&_0x206301[_0x7645('0x5e')][0x3]?_0x206301['attrs'][0x3][_0x7645('0x62')]:undefined)||[]}];case _0x7645('0x72'):return[{'name':'attrReport','type':_0x206301[_0x7645('0x73')]||(_0x206301['attrs']&&_0x206301['attrs'][0x0]?_0x206301['attrs'][0x0][_0x7645('0x36')]:undefined)||null,'value':_0x206301[_0x7645('0x74')]||(_0x206301['attrs']&&_0x206301[_0x7645('0x5e')][0x0]?_0x206301[_0x7645('0x5e')][0x0][_0x7645('0x62')]:undefined)||null},{'name':_0x7645('0x75'),'value':_0x206301['attrRefresh']||(_0x206301[_0x7645('0x5e')]&&_0x206301[_0x7645('0x5e')][0x1]?_0x206301['attrs'][0x1][_0x7645('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x437e73){logger[_0x7645('0x5c')](_0x7645('0x76'),JSON[_0x7645('0x77')](_0x437e73));return[];}}exports['addItem']=function(_0x1494e8,_0x54bec4,_0x4888ca){if(_0x1494e8[_0x7645('0x5a')]['id']){delete _0x1494e8[_0x7645('0x5a')]['id'];}return db[_0x7645('0x47')][_0x7645('0x4e')]({'where':{'id':_0x1494e8[_0x7645('0x4c')]['id']}})[_0x7645('0x2a')](handleEntityNotFound(_0x54bec4,null))[_0x7645('0x2a')](function(_0x531b3b){if(_0x531b3b){_0x1494e8[_0x7645('0x5a')][_0x7645('0x78')]=_0x531b3b['id'];_0x1494e8[_0x7645('0x5a')][_0x7645('0x5e')]=widgetAttributes(_0x1494e8['body']);return db[_0x7645('0x79')][_0x7645('0x50')](_0x1494e8[_0x7645('0x5a')]);}})[_0x7645('0x2a')](respondWithResult(_0x54bec4,null))[_0x7645('0x4f')](handleError(_0x54bec4,null));};exports[_0x7645('0x7a')]=function(_0x236bf7,_0x4040e8,_0x280382){var _0x170968={};var _0x10e436={};var _0x4efc3e;var _0x5a4f2c;return db[_0x7645('0x47')][_0x7645('0x7b')]({'where':{'id':_0x236bf7[_0x7645('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4040e8,null))[_0x7645('0x2a')](function(_0x15cbe7){if(_0x15cbe7){_0x4efc3e=_0x15cbe7;_0x10e436['model']=_[_0x7645('0x3a')](db['DashboardItem'][_0x7645('0x34')]);_0x10e436['query']=_['keys'](_0x236bf7[_0x7645('0x39')]);_0x10e436[_0x7645('0x3b')]=_[_0x7645('0x3c')](_0x10e436[_0x7645('0x38')],_0x10e436[_0x7645('0x39')]);_0x170968[_0x7645('0x3d')]=_[_0x7645('0x3c')](_0x10e436[_0x7645('0x38')],qs[_0x7645('0x3e')](_0x236bf7[_0x7645('0x39')][_0x7645('0x3e')]));_0x170968[_0x7645('0x3d')]=_0x170968['attributes']['length']?_0x170968[_0x7645('0x3d')]:_0x10e436[_0x7645('0x38')];_0x170968[_0x7645('0x41')]=qs[_0x7645('0x7c')](_0x236bf7[_0x7645('0x39')][_0x7645('0x7c')]);_0x170968[_0x7645('0x42')]=qs[_0x7645('0x3b')](_[_0x7645('0x43')](_0x236bf7[_0x7645('0x39')],_0x10e436[_0x7645('0x3b')]));if(_0x236bf7[_0x7645('0x39')]['filter']){_0x170968['where']=_[_0x7645('0x44')](_0x170968[_0x7645('0x42')],{'$or':_['map'](_0x170968[_0x7645('0x3d')],function(_0x26d689){var _0x14a355={};_0x14a355[_0x26d689]={'$like':'%'+_0x236bf7[_0x7645('0x39')][_0x7645('0x46')]+'%'};return _0x14a355;})});}_0x170968=_['merge']({},_0x170968,_0x236bf7[_0x7645('0x4d')]);return _0x4efc3e[_0x7645('0x7a')](_0x170968);}})[_0x7645('0x2a')](function(_0x1e9867){if(_0x1e9867){_0x5a4f2c=_0x1e9867[_0x7645('0x3f')];if(!_0x236bf7[_0x7645('0x39')][_0x7645('0x7d')]('nolimit')){_0x170968[_0x7645('0x22')]=qs['limit'](_0x236bf7['query'][_0x7645('0x22')]);_0x170968['offset']=qs[_0x7645('0x20')](_0x236bf7['query']['offset']);}return _0x4efc3e[_0x7645('0x7a')](_0x170968);}})[_0x7645('0x2a')](function(_0x55ef3f){if(_0x55ef3f){return _0x55ef3f?{'count':_0x5a4f2c,'rows':_0x55ef3f}:null;}})[_0x7645('0x2a')](respondWithResult(_0x4040e8,null))[_0x7645('0x4f')](handleError(_0x4040e8,null));}; \ No newline at end of file +var _0x6829=['attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','order','eml-format','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','name','send','index','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filters','filter','merge','Dashboard','include','rows','show','params','rawAttributes','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','options','omit','createdAt','updatedAt','attrUrl','attrs','https://','custom','attrPath','value','clock'];(function(_0x59ee9c,_0x43f62d){var _0x44a2a8=function(_0x5b2c33){while(--_0x5b2c33){_0x59ee9c['push'](_0x59ee9c['shift']());}};_0x44a2a8(++_0x43f62d);}(_0x6829,0x178));var _0x9682=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x6829[_0x36eaaa];return _0x461349;};'use strict';var emlformat=require(_0x9682('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9682('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9682('0x2'));var moment=require(_0x9682('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9682('0x4'));var util=require(_0x9682('0x5'));var path=require('path');var sox=require(_0x9682('0x6'));var csv=require(_0x9682('0x7'));var ejs=require(_0x9682('0x8'));var fs=require('fs');var fs_extra=require(_0x9682('0x9'));var _=require('lodash');var squel=require(_0x9682('0xa'));var crypto=require('crypto');var jsforce=require(_0x9682('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9682('0x7'));var querystring=require(_0x9682('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9682('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x9682('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9682('0xf'))(_0x9682('0x10'));var utils=require('../../config/utils');var config=require(_0x9682('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x9682('0x12'))['db'];config[_0x9682('0x13')]=_[_0x9682('0x14')](config[_0x9682('0x13')],{'host':_0x9682('0x15'),'port':0x18eb});var socket=require(_0x9682('0x16'))(new Redis(config['redis']));require(_0x9682('0x17'))['register'](socket);function respondWithStatusCode(_0x6f5fdb,_0x198aae){_0x198aae=_0x198aae||0xcc;return function(_0x2c38c1){if(_0x2c38c1){return _0x6f5fdb[_0x9682('0x18')](_0x198aae);}return _0x6f5fdb[_0x9682('0x19')](_0x198aae)[_0x9682('0x1a')]();};}function respondWithResult(_0x2261d5,_0x3d88d8){_0x3d88d8=_0x3d88d8||0xc8;return function(_0x54186a){if(_0x54186a){return _0x2261d5['status'](_0x3d88d8)[_0x9682('0x1b')](_0x54186a);}};}function respondWithFilteredResult(_0x5509ff,_0x5b6036){return function(_0x1a198f){if(_0x1a198f){var _0x207ca8=typeof _0x5b6036[_0x9682('0x1c')]===_0x9682('0x1d')&&typeof _0x5b6036[_0x9682('0x1e')]===_0x9682('0x1d');var _0x42403d=_0x1a198f[_0x9682('0x1f')];var _0x82de1f=_0x207ca8?0x0:_0x5b6036[_0x9682('0x1c')];var _0x45d73c=_0x207ca8?_0x1a198f[_0x9682('0x1f')]:_0x5b6036['offset']+_0x5b6036[_0x9682('0x1e')];var _0x4edf37;if(_0x45d73c>=_0x42403d){_0x45d73c=_0x42403d;_0x4edf37=0xc8;}else{_0x4edf37=0xce;}_0x5509ff[_0x9682('0x19')](_0x4edf37);return _0x5509ff[_0x9682('0x20')](_0x9682('0x21'),_0x82de1f+'-'+_0x45d73c+'/'+_0x42403d)[_0x9682('0x1b')](_0x1a198f);}return null;};}function patchUpdates(_0x9dc862){return function(_0xcc6536){try{jsonpatch[_0x9682('0x22')](_0xcc6536,_0x9dc862,!![]);}catch(_0x2fe505){return BPromise[_0x9682('0x23')](_0x2fe505);}return _0xcc6536['save']();};}function saveUpdates(_0xd8e610,_0x5bda7a){return function(_0x1ac6d6){if(_0x1ac6d6){return _0x1ac6d6[_0x9682('0x24')](_0xd8e610)[_0x9682('0x25')](function(_0x276e55){return _0x276e55;});}return null;};}function removeEntity(_0xafd451,_0x53ed29){return function(_0x5b7614){if(_0x5b7614){return _0x5b7614[_0x9682('0x26')]()[_0x9682('0x25')](function(){var _0xa3a2e5=_0x5b7614[_0x9682('0x27')]({'plain':!![]});var _0x3db48b='CustomDashboards';return db[_0x9682('0x28')][_0x9682('0x26')]({'where':{'type':_0x3db48b,'resourceId':_0xa3a2e5['id']}})[_0x9682('0x25')](function(){return _0x5b7614;});})['then'](function(){_0xafd451['status'](0xcc)[_0x9682('0x1a')]();});}};}function handleEntityNotFound(_0x54a95d,_0x94e0da){return function(_0x2b93cc){if(!_0x2b93cc){_0x54a95d[_0x9682('0x18')](0x194);}return _0x2b93cc;};}function handleError(_0x5af4a2,_0x18d1b5){_0x18d1b5=_0x18d1b5||0x1f4;return function(_0x33fa4a){logger['error'](_0x33fa4a['stack']);if(_0x33fa4a[_0x9682('0x29')]){delete _0x33fa4a[_0x9682('0x29')];}_0x5af4a2['status'](_0x18d1b5)[_0x9682('0x2a')](_0x33fa4a);};}exports[_0x9682('0x2b')]=function(_0x581e9a,_0x11a162){var _0x29e10a={},_0x5c629a={},_0x335f39={'count':0x0,'rows':[]};var _0x40476a=_['map'](db['Dashboard']['rawAttributes'],function(_0x397d1c){return{'name':_0x397d1c['fieldName'],'type':_0x397d1c[_0x9682('0x2c')][_0x9682('0x2d')]};});_0x5c629a[_0x9682('0x2e')]=_[_0x9682('0x2f')](_0x40476a,_0x9682('0x29'));_0x5c629a[_0x9682('0x30')]=_[_0x9682('0x31')](_0x581e9a['query']);_0x5c629a['filters']=_[_0x9682('0x32')](_0x5c629a[_0x9682('0x2e')],_0x5c629a[_0x9682('0x30')]);_0x29e10a[_0x9682('0x33')]=_['intersection'](_0x5c629a[_0x9682('0x2e')],qs[_0x9682('0x34')](_0x581e9a[_0x9682('0x30')][_0x9682('0x34')]));_0x29e10a[_0x9682('0x33')]=_0x29e10a[_0x9682('0x33')]['length']?_0x29e10a['attributes']:_0x5c629a[_0x9682('0x2e')];if(!_0x581e9a['query'][_0x9682('0x35')]('nolimit')){_0x29e10a[_0x9682('0x1e')]=qs[_0x9682('0x1e')](_0x581e9a['query'][_0x9682('0x1e')]);_0x29e10a['offset']=qs[_0x9682('0x1c')](_0x581e9a[_0x9682('0x30')][_0x9682('0x1c')]);}_0x29e10a['order']=qs[_0x9682('0x36')](_0x581e9a[_0x9682('0x30')][_0x9682('0x36')]);_0x29e10a[_0x9682('0x37')]=qs['filters'](_[_0x9682('0x38')](_0x581e9a[_0x9682('0x30')],_0x5c629a[_0x9682('0x39')]),_0x40476a);if(_0x581e9a[_0x9682('0x30')][_0x9682('0x3a')]){_0x29e10a[_0x9682('0x37')]=_[_0x9682('0x3b')](_0x29e10a[_0x9682('0x37')],{'$or':_[_0x9682('0x2f')](_0x40476a,function(_0x524158){if(_0x524158[_0x9682('0x2c')]!=='VIRTUAL'){var _0x5a2ffc={};_0x5a2ffc[_0x524158[_0x9682('0x29')]]={'$like':'%'+_0x581e9a['query'][_0x9682('0x3a')]+'%'};return _0x5a2ffc;}})});}_0x29e10a=_[_0x9682('0x3b')]({},_0x29e10a,_0x581e9a['options']);var _0x385d7f={'where':_0x29e10a[_0x9682('0x37')]};return db[_0x9682('0x3c')][_0x9682('0x1f')](_0x385d7f)[_0x9682('0x25')](function(_0x2ecd9b){_0x335f39[_0x9682('0x1f')]=_0x2ecd9b;if(_0x581e9a[_0x9682('0x30')]['includeAll']){_0x29e10a[_0x9682('0x3d')]=[{'all':!![]}];}return db[_0x9682('0x3c')]['findAll'](_0x29e10a);})[_0x9682('0x25')](function(_0x93abb0){_0x335f39[_0x9682('0x3e')]=_0x93abb0;return _0x335f39;})[_0x9682('0x25')](respondWithFilteredResult(_0x11a162,_0x29e10a))['catch'](handleError(_0x11a162,null));};exports[_0x9682('0x3f')]=function(_0x236d88,_0x405cc6){var _0x2a7e77={'raw':![],'where':{'id':_0x236d88[_0x9682('0x40')]['id']}},_0x1d2c8e={};_0x1d2c8e[_0x9682('0x2e')]=_[_0x9682('0x31')](db['Dashboard'][_0x9682('0x41')]);_0x1d2c8e[_0x9682('0x30')]=_[_0x9682('0x31')](_0x236d88[_0x9682('0x30')]);_0x1d2c8e['filters']=_[_0x9682('0x32')](_0x1d2c8e['model'],_0x1d2c8e[_0x9682('0x30')]);_0x2a7e77[_0x9682('0x33')]=_[_0x9682('0x32')](_0x1d2c8e['model'],qs[_0x9682('0x34')](_0x236d88[_0x9682('0x30')][_0x9682('0x34')]));_0x2a7e77[_0x9682('0x33')]=_0x2a7e77[_0x9682('0x33')][_0x9682('0x42')]?_0x2a7e77[_0x9682('0x33')]:_0x1d2c8e[_0x9682('0x2e')];if(_0x236d88['query']['includeAll']){_0x2a7e77[_0x9682('0x3d')]=[{'all':!![]}];}_0x2a7e77=_[_0x9682('0x3b')]({},_0x2a7e77,_0x236d88['options']);return db['Dashboard'][_0x9682('0x43')](_0x2a7e77)['then'](handleEntityNotFound(_0x405cc6,null))[_0x9682('0x25')](respondWithResult(_0x405cc6,null))[_0x9682('0x44')](handleError(_0x405cc6,null));};exports['create']=function(_0x1fe0bf,_0x2e5635){return db[_0x9682('0x3c')][_0x9682('0x45')](_0x1fe0bf[_0x9682('0x46')],{})[_0x9682('0x25')](function(_0x4d401e){var _0x42d6a3=_0x1fe0bf[_0x9682('0x47')]['get']({'plain':!![]});if(!_0x42d6a3)throw new Error(_0x9682('0x48'));if(_0x42d6a3['role']===_0x9682('0x47')){var _0x4db1fc=_0x4d401e[_0x9682('0x27')]({'plain':!![]});var _0x270716=_0x9682('0x49');return db[_0x9682('0x4a')][_0x9682('0x43')]({'where':{'name':_0x270716,'userProfileId':_0x42d6a3[_0x9682('0x4b')]},'raw':!![]})[_0x9682('0x25')](function(_0x2426ab){if(_0x2426ab&&_0x2426ab[_0x9682('0x4c')]===0x0){return db[_0x9682('0x28')][_0x9682('0x45')]({'name':_0x4db1fc[_0x9682('0x29')],'resourceId':_0x4db1fc['id'],'type':_0x2426ab[_0x9682('0x29')],'sectionId':_0x2426ab['id']},{})[_0x9682('0x25')](function(){return _0x4d401e;});}else{return _0x4d401e;}})['catch'](function(_0x45d463){logger[_0x9682('0x4d')](_0x9682('0x4e'),_0x45d463);throw _0x45d463;});}return _0x4d401e;})[_0x9682('0x25')](respondWithResult(_0x2e5635,0xc9))[_0x9682('0x44')](handleError(_0x2e5635,null));};exports[_0x9682('0x4f')]=function(_0x3a7ef0,_0xc4c64e){var _0x35cfc7={'where':{'id':_0x3a7ef0[_0x9682('0x40')]['id']}},_0x324929={};_0x324929[_0x9682('0x2e')]=_[_0x9682('0x31')](db[_0x9682('0x3c')][_0x9682('0x41')]);_0x35cfc7['attributes']=_[_0x9682('0x32')](_0x324929[_0x9682('0x2e')],qs['fields'](_0x3a7ef0[_0x9682('0x30')][_0x9682('0x34')]));_0x35cfc7['attributes']=_0x35cfc7['attributes'][_0x9682('0x42')]?_0x35cfc7[_0x9682('0x33')]:_0x324929[_0x9682('0x2e')];if(_0x3a7ef0[_0x9682('0x30')][_0x9682('0x50')]){_0x35cfc7[_0x9682('0x3d')]=[{'all':!![]}];}_0x35cfc7=_[_0x9682('0x3b')]({},_0x35cfc7,_0x3a7ef0[_0x9682('0x51')]);return db[_0x9682('0x3c')][_0x9682('0x43')](_0x35cfc7)[_0x9682('0x25')](handleEntityNotFound(_0xc4c64e,null))[_0x9682('0x25')](function(_0x363c2c){if(_0x363c2c){var _0x4a4f0a=_0x363c2c[_0x9682('0x27')]({'plain':!![]});_0x4a4f0a=qs[_0x9682('0x52')](_0x4a4f0a,['id','createdAt','updatedAt']);_0x3a7ef0[_0x9682('0x46')]=_['omit'](_0x3a7ef0['body'],['id',_0x9682('0x53'),_0x9682('0x54')]);return db['Dashboard'][_0x9682('0x45')](_['merge'](_0x4a4f0a,_0x3a7ef0['body']),{'include':_0x3a7ef0['query'][_0x9682('0x50')]?[{'all':!![]}]:undefined})[_0x9682('0x25')](function(_0x361556){var _0xc047c3=_0x3a7ef0[_0x9682('0x47')][_0x9682('0x27')]({'plain':!![]});if(!_0xc047c3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xc047c3['role']===_0x9682('0x47')){var _0xc182df=_0x361556['get']({'plain':!![]});var _0x3c4c8d='CustomDashboards';return db[_0x9682('0x4a')][_0x9682('0x43')]({'where':{'name':_0x3c4c8d,'userProfileId':_0xc047c3[_0x9682('0x4b')]},'raw':!![]})[_0x9682('0x25')](function(_0x3d45b3){if(_0x3d45b3&&_0x3d45b3[_0x9682('0x4c')]===0x0){return db[_0x9682('0x28')][_0x9682('0x45')]({'name':_0xc182df[_0x9682('0x29')],'resourceId':_0xc182df['id'],'type':_0x3d45b3[_0x9682('0x29')],'sectionId':_0x3d45b3['id']},{})['then'](function(){return _0x361556;});}else{return _0x361556;}})['catch'](function(_0x296730){logger[_0x9682('0x4d')](_0x9682('0x4e'),_0x296730);throw _0x296730;});}return _0x361556;});}})[_0x9682('0x25')](respondWithResult(_0xc4c64e,0xc9))[_0x9682('0x44')](handleError(_0xc4c64e,null));};exports[_0x9682('0x24')]=function(_0x567963,_0x39e4b6){if(_0x567963[_0x9682('0x46')]['id']){delete _0x567963[_0x9682('0x46')]['id'];}return db['Dashboard'][_0x9682('0x43')]({'where':{'id':_0x567963['params']['id']}})[_0x9682('0x25')](handleEntityNotFound(_0x39e4b6,null))[_0x9682('0x25')](saveUpdates(_0x567963[_0x9682('0x46')],null))[_0x9682('0x25')](respondWithResult(_0x39e4b6,null))[_0x9682('0x44')](handleError(_0x39e4b6,null));};exports[_0x9682('0x26')]=function(_0x1409f9,_0x4b5e31){return db[_0x9682('0x3c')][_0x9682('0x43')]({'where':{'id':_0x1409f9[_0x9682('0x40')]['id']}})[_0x9682('0x25')](handleEntityNotFound(_0x4b5e31,null))['then'](removeEntity(_0x4b5e31,null))['catch'](handleError(_0x4b5e31,null));};function widgetAttributes(_0xe0b02c){try{switch(_0xe0b02c['type']){case'iframe':return[{'name':_0x9682('0x55'),'value':_0xe0b02c['attrUrl']||(_0xe0b02c[_0x9682('0x56')]&&_0xe0b02c[_0x9682('0x56')][0x0]?_0xe0b02c[_0x9682('0x56')][0x0]['value']:undefined)||_0x9682('0x57')}];case _0x9682('0x58'):return[{'name':'attrPath','value':_0xe0b02c[_0x9682('0x59')]||(_0xe0b02c['attrs']&&_0xe0b02c[_0x9682('0x56')][0x0]?_0xe0b02c[_0x9682('0x56')][0x0][_0x9682('0x5a')]:undefined)||''}];case _0x9682('0x5b'):return[{'name':_0x9682('0x5c'),'value':_0xe0b02c[_0x9682('0x5c')]||(_0xe0b02c[_0x9682('0x56')]&&_0xe0b02c[_0x9682('0x56')][0x0]?_0xe0b02c[_0x9682('0x56')][0x0]['value']:undefined)||_0x9682('0x5d')},{'name':_0x9682('0x5e'),'value':_0xe0b02c[_0x9682('0x5e')]||(_0xe0b02c[_0x9682('0x56')]&&_0xe0b02c['attrs'][0x1]?_0xe0b02c[_0x9682('0x56')][0x1][_0x9682('0x5a')]:undefined)||_0x9682('0x5f')},{'name':'attrFontSize','value':_0xe0b02c[_0x9682('0x60')]||(_0xe0b02c[_0x9682('0x56')]&&_0xe0b02c[_0x9682('0x56')][0x2]?_0xe0b02c['attrs'][0x2]['value']:undefined)||0xc}];case _0x9682('0x61'):return[{'name':_0x9682('0x62'),'value':_0xe0b02c[_0x9682('0x62')]||(_0xe0b02c[_0x9682('0x56')]&&_0xe0b02c[_0x9682('0x56')][0x0]?_0xe0b02c[_0x9682('0x56')][0x0]['value']:undefined)||_0x9682('0x63')},{'name':_0x9682('0x64'),'value':_0xe0b02c[_0x9682('0x64')]||(_0xe0b02c[_0x9682('0x56')]&&_0xe0b02c[_0x9682('0x56')][0x1]?_0xe0b02c[_0x9682('0x56')][0x1][_0x9682('0x5a')]:undefined)||[]},{'name':_0x9682('0x60'),'value':_0xe0b02c[_0x9682('0x60')]||(_0xe0b02c[_0x9682('0x56')]&&_0xe0b02c['attrs'][0x2]?_0xe0b02c[_0x9682('0x56')][0x2]['value']:undefined)||0x14}];case _0x9682('0x65'):case _0x9682('0x66'):return[{'name':_0x9682('0x67'),'value':_0xe0b02c[_0x9682('0x67')]||(_0xe0b02c[_0x9682('0x56')]&&_0xe0b02c[_0x9682('0x56')][0x0]?_0xe0b02c['attrs'][0x0][_0x9682('0x5a')]:undefined)||_0x9682('0x63')},{'name':'attrSerie2','value':_0xe0b02c[_0x9682('0x68')]||(_0xe0b02c[_0x9682('0x56')]&&_0xe0b02c[_0x9682('0x56')][0x1]?_0xe0b02c[_0x9682('0x56')][0x1][_0x9682('0x5a')]:undefined)||null},{'name':'attrSerie3','value':_0xe0b02c[_0x9682('0x69')]||(_0xe0b02c[_0x9682('0x56')]&&_0xe0b02c[_0x9682('0x56')][0x2]?_0xe0b02c['attrs'][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0xe0b02c[_0x9682('0x64')]||(_0xe0b02c[_0x9682('0x56')]&&_0xe0b02c['attrs'][0x3]?_0xe0b02c[_0x9682('0x56')][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':_0x9682('0x6a'),'type':_0xe0b02c[_0x9682('0x6b')]||(_0xe0b02c[_0x9682('0x56')]&&_0xe0b02c[_0x9682('0x56')][0x0]?_0xe0b02c[_0x9682('0x56')][0x0][_0x9682('0x2c')]:undefined)||null,'value':_0xe0b02c['attrReport']||(_0xe0b02c['attrs']&&_0xe0b02c[_0x9682('0x56')][0x0]?_0xe0b02c[_0x9682('0x56')][0x0][_0x9682('0x5a')]:undefined)||null},{'name':_0x9682('0x6c'),'value':_0xe0b02c['attrRefresh']||(_0xe0b02c[_0x9682('0x56')]&&_0xe0b02c['attrs'][0x1]?_0xe0b02c['attrs'][0x1][_0x9682('0x5a')]:undefined)||0x0}];default:return[];}}catch(_0x2c7b7c){logger['error'](_0x9682('0x6d'),JSON[_0x9682('0x6e')](_0x2c7b7c));return[];}}exports[_0x9682('0x6f')]=function(_0x1caa77,_0x40062e,_0xacfaa0){if(_0x1caa77[_0x9682('0x46')]['id']){delete _0x1caa77['body']['id'];}return db[_0x9682('0x3c')][_0x9682('0x43')]({'where':{'id':_0x1caa77[_0x9682('0x40')]['id']}})[_0x9682('0x25')](handleEntityNotFound(_0x40062e,null))[_0x9682('0x25')](function(_0x505164){if(_0x505164){_0x1caa77[_0x9682('0x46')][_0x9682('0x70')]=_0x505164['id'];_0x1caa77[_0x9682('0x46')][_0x9682('0x56')]=widgetAttributes(_0x1caa77[_0x9682('0x46')]);return db[_0x9682('0x71')][_0x9682('0x45')](_0x1caa77[_0x9682('0x46')]);}})[_0x9682('0x25')](respondWithResult(_0x40062e,null))[_0x9682('0x44')](handleError(_0x40062e,null));};exports[_0x9682('0x72')]=function(_0x562999,_0x18ce9d,_0x37f5f2){var _0x11cef3={};var _0x347319={};var _0x1201e0;var _0x3f1e47;return db[_0x9682('0x3c')][_0x9682('0x73')]({'where':{'id':_0x562999['params']['id']}})[_0x9682('0x25')](handleEntityNotFound(_0x18ce9d,null))[_0x9682('0x25')](function(_0x3b9ee2){if(_0x3b9ee2){_0x1201e0=_0x3b9ee2;_0x347319['model']=_[_0x9682('0x31')](db[_0x9682('0x71')][_0x9682('0x41')]);_0x347319['query']=_[_0x9682('0x31')](_0x562999[_0x9682('0x30')]);_0x347319[_0x9682('0x39')]=_[_0x9682('0x32')](_0x347319[_0x9682('0x2e')],_0x347319['query']);_0x11cef3[_0x9682('0x33')]=_[_0x9682('0x32')](_0x347319[_0x9682('0x2e')],qs[_0x9682('0x34')](_0x562999['query'][_0x9682('0x34')]));_0x11cef3[_0x9682('0x33')]=_0x11cef3['attributes'][_0x9682('0x42')]?_0x11cef3[_0x9682('0x33')]:_0x347319['model'];_0x11cef3[_0x9682('0x74')]=qs[_0x9682('0x36')](_0x562999['query'][_0x9682('0x36')]);_0x11cef3[_0x9682('0x37')]=qs[_0x9682('0x39')](_[_0x9682('0x38')](_0x562999[_0x9682('0x30')],_0x347319[_0x9682('0x39')]));if(_0x562999[_0x9682('0x30')][_0x9682('0x3a')]){_0x11cef3['where']=_[_0x9682('0x3b')](_0x11cef3[_0x9682('0x37')],{'$or':_['map'](_0x11cef3['attributes'],function(_0x225de7){var _0x1b3992={};_0x1b3992[_0x225de7]={'$like':'%'+_0x562999[_0x9682('0x30')][_0x9682('0x3a')]+'%'};return _0x1b3992;})});}_0x11cef3=_[_0x9682('0x3b')]({},_0x11cef3,_0x562999['options']);return _0x1201e0['getItems'](_0x11cef3);}})[_0x9682('0x25')](function(_0x213e10){if(_0x213e10){_0x3f1e47=_0x213e10['length'];if(!_0x562999['query'][_0x9682('0x35')]('nolimit')){_0x11cef3[_0x9682('0x1e')]=qs[_0x9682('0x1e')](_0x562999[_0x9682('0x30')][_0x9682('0x1e')]);_0x11cef3['offset']=qs[_0x9682('0x1c')](_0x562999[_0x9682('0x30')][_0x9682('0x1c')]);}return _0x1201e0[_0x9682('0x72')](_0x11cef3);}})[_0x9682('0x25')](function(_0x3ea493){if(_0x3ea493){return _0x3ea493?{'count':_0x3f1e47,'rows':_0x3ea493}:null;}})[_0x9682('0x25')](respondWithResult(_0x18ce9d,null))['catch'](handleError(_0x18ce9d,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index c80cfcd..1b0a29d 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 _0x9d67=['update','emit','hook','exports','events','../../mysqldb'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x9d67,0xe8));var _0x79d6=function(_0x5e2191,_0x36a2b4){_0x5e2191=_0x5e2191-0x0;var _0x34265a=_0x9d67[_0x5e2191];return _0x34265a;};'use strict';var EventEmitter=require(_0x79d6('0x0'));var Dashboard=require(_0x79d6('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x79d6('0x2'),'afterDestroy':'remove'};function emitEvent(_0x30879a){return function(_0x10aa4b,_0x3aad68,_0x280061){DashboardEvents[_0x79d6('0x3')](_0x30879a+':'+_0x10aa4b['id'],_0x10aa4b);DashboardEvents[_0x79d6('0x3')](_0x30879a,_0x10aa4b);_0x280061(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x79d6('0x4')](e,emitEvent(event));}}module[_0x79d6('0x5')]=DashboardEvents; \ No newline at end of file +var _0xe085=['hasOwnProperty','exports','events','../../mysqldb','Dashboard','setMaxListeners','update','remove','emit'];(function(_0x3ece3d,_0x58b2a6){var _0x54d262=function(_0x3f7313){while(--_0x3f7313){_0x3ece3d['push'](_0x3ece3d['shift']());}};_0x54d262(++_0x58b2a6);}(_0xe085,0x16a));var _0x5e08=function(_0x1febfb,_0x326b20){_0x1febfb=_0x1febfb-0x0;var _0x231a6f=_0xe085[_0x1febfb];return _0x231a6f;};'use strict';var EventEmitter=require(_0x5e08('0x0'));var Dashboard=require(_0x5e08('0x1'))['db'][_0x5e08('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x5e08('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5e08('0x4'),'afterDestroy':_0x5e08('0x5')};function emitEvent(_0x3b8329){return function(_0x65a4f6,_0x5c7c63,_0x31a169){DashboardEvents[_0x5e08('0x6')](_0x3b8329+':'+_0x65a4f6['id'],_0x65a4f6);DashboardEvents['emit'](_0x3b8329,_0x65a4f6);_0x31a169(null);};}for(var e in events){if(events[_0x5e08('0x7')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x5e08('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index b531fb6..1e0da06 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 _0x132f=['moment','bluebird','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','dashboards','lodash','util','../../config/logger','api'];(function(_0x2a5d41,_0x4ef191){var _0x52e99f=function(_0x2b9ab4){while(--_0x2b9ab4){_0x2a5d41['push'](_0x2a5d41['shift']());}};_0x52e99f(++_0x4ef191);}(_0x132f,0x182));var _0xf132=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x132f[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0xf132('0x0'));var util=require(_0xf132('0x1'));var logger=require(_0xf132('0x2'))(_0xf132('0x3'));var moment=require(_0xf132('0x4'));var BPromise=require(_0xf132('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf132('0x6'));var rimraf=require(_0xf132('0x7'));var config=require(_0xf132('0x8'));var attributes=require(_0xf132('0x9'));module[_0xf132('0xa')]=function(_0x5e0f2b,_0x925b1a){return _0x5e0f2b[_0xf132('0xb')]('Dashboard',attributes,{'tableName':_0xf132('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0495=['./dashboard.attributes','exports','define','Dashboard','util','api','moment','bluebird','request-promise','../../config/environment'];(function(_0xabb4d5,_0x107432){var _0x4740e5=function(_0x23a55c){while(--_0x23a55c){_0xabb4d5['push'](_0xabb4d5['shift']());}};_0x4740e5(++_0x107432);}(_0x0495,0x126));var _0x5049=function(_0x2975b8,_0xfd2820){_0x2975b8=_0x2975b8-0x0;var _0x7665d9=_0x0495[_0x2975b8];return _0x7665d9;};'use strict';var _=require('lodash');var util=require(_0x5049('0x0'));var logger=require('../../config/logger')(_0x5049('0x1'));var moment=require(_0x5049('0x2'));var BPromise=require(_0x5049('0x3'));var rp=require(_0x5049('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5049('0x5'));var attributes=require(_0x5049('0x6'));module[_0x5049('0x7')]=function(_0x341649,_0xeb95ea){return _0x341649[_0x5049('0x8')](_0x5049('0x9'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 67fd05a..5548a01 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 _0x01d7=['info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','then'];(function(_0x39a3ac,_0x415c6d){var _0x2bc0cc=function(_0x44c5fa){while(--_0x44c5fa){_0x39a3ac['push'](_0x39a3ac['shift']());}};_0x2bc0cc(++_0x415c6d);}(_0x01d7,0x185));var _0x701d=function(_0x4c528e,_0x2bfd9c){_0x4c528e=_0x4c528e-0x0;var _0x4bca5c=_0x01d7[_0x4c528e];return _0x4bca5c;};'use strict';var _=require(_0x701d('0x0'));var util=require(_0x701d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x701d('0x2'));var fs=require('fs');var Redis=require(_0x701d('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x701d('0x4'))(_0x701d('0x5'));var config=require('../../config/environment');var jayson=require(_0x701d('0x6'));var client=jayson[_0x701d('0x7')][_0x701d('0x8')]({'port':0x232a});config[_0x701d('0x9')]=_['defaults'](config[_0x701d('0x9')],{'host':_0x701d('0xa'),'port':0x18eb});var socket=require(_0x701d('0xb'))(new Redis(config[_0x701d('0x9')]));require(_0x701d('0xc'))[_0x701d('0xd')](socket);function respondWithRpcPromise(_0x2068f9,_0x65bc09,_0x355a19){return new BPromise(function(_0x43491d,_0x573095){return client[_0x701d('0xe')](_0x2068f9,_0x355a19)[_0x701d('0xf')](function(_0x254abf){logger[_0x701d('0x10')](_0x701d('0x11'),_0x65bc09,_0x701d('0x12'));logger[_0x701d('0x13')](_0x701d('0x14'),_0x65bc09,_0x701d('0x12'),JSON[_0x701d('0x15')](_0x254abf));if(_0x254abf[_0x701d('0x16')]){if(_0x254abf[_0x701d('0x16')][_0x701d('0x17')]===0x1f4){logger['error'](_0x701d('0x11'),_0x65bc09,_0x254abf[_0x701d('0x16')][_0x701d('0x18')]);return _0x573095(_0x254abf['error']['message']);}logger[_0x701d('0x16')](_0x701d('0x11'),_0x65bc09,_0x254abf[_0x701d('0x16')][_0x701d('0x18')]);return _0x43491d(_0x254abf[_0x701d('0x16')][_0x701d('0x18')]);}else{logger[_0x701d('0x10')](_0x701d('0x11'),_0x65bc09,'request\x20sent');_0x43491d(_0x254abf[_0x701d('0x19')][_0x701d('0x18')]);}})[_0x701d('0x1a')](function(_0x302436){logger['error'](_0x701d('0x11'),_0x65bc09,_0x302436);_0x573095(_0x302436);});});} \ No newline at end of file +var _0x9b22=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird'];(function(_0xd57744,_0x181401){var _0x3936cb=function(_0x3afb1e){while(--_0x3afb1e){_0xd57744['push'](_0xd57744['shift']());}};_0x3936cb(++_0x181401);}(_0x9b22,0xb3));var _0x29b2=function(_0x5ca660,_0x565deb){_0x5ca660=_0x5ca660-0x0;var _0x234e6c=_0x9b22[_0x5ca660];return _0x234e6c;};'use strict';var _=require(_0x29b2('0x0'));var util=require(_0x29b2('0x1'));var moment=require('moment');var BPromise=require(_0x29b2('0x2'));var rs=require(_0x29b2('0x3'));var fs=require('fs');var Redis=require(_0x29b2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x29b2('0x5'))(_0x29b2('0x6'));var config=require(_0x29b2('0x7'));var jayson=require(_0x29b2('0x8'));var client=jayson[_0x29b2('0x9')]['http']({'port':0x232a});config[_0x29b2('0xa')]=_[_0x29b2('0xb')](config['redis'],{'host':_0x29b2('0xc'),'port':0x18eb});var socket=require(_0x29b2('0xd'))(new Redis(config[_0x29b2('0xa')]));require(_0x29b2('0xe'))[_0x29b2('0xf')](socket);function respondWithRpcPromise(_0x450530,_0x31653e,_0x5cd313){return new BPromise(function(_0x49a5cf,_0x2d396b){return client['request'](_0x450530,_0x5cd313)['then'](function(_0x383e87){logger[_0x29b2('0x10')](_0x29b2('0x11'),_0x31653e,'request\x20sent');logger[_0x29b2('0x12')](_0x29b2('0x13'),_0x31653e,_0x29b2('0x14'),JSON['stringify'](_0x383e87));if(_0x383e87['error']){if(_0x383e87[_0x29b2('0x15')][_0x29b2('0x16')]===0x1f4){logger['error'](_0x29b2('0x11'),_0x31653e,_0x383e87[_0x29b2('0x15')][_0x29b2('0x17')]);return _0x2d396b(_0x383e87[_0x29b2('0x15')]['message']);}logger['error'](_0x29b2('0x11'),_0x31653e,_0x383e87[_0x29b2('0x15')]['message']);return _0x49a5cf(_0x383e87[_0x29b2('0x15')]['message']);}else{logger[_0x29b2('0x10')](_0x29b2('0x11'),_0x31653e,_0x29b2('0x14'));_0x49a5cf(_0x383e87[_0x29b2('0x18')]['message']);}})[_0x29b2('0x19')](function(_0x326576){logger[_0x29b2('0x15')]('Dashboard,\x20%s,\x20%s',_0x31653e,_0x326576);_0x2d396b(_0x326576);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index c4a5c30..2bcd1c3 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 _0x53d2=['update','emit','removeListener','register','length','dashboard:','./dashboard.events','save','remove'];(function(_0x44a22c,_0x586042){var _0x4707dd=function(_0x193e2f){while(--_0x193e2f){_0x44a22c['push'](_0x44a22c['shift']());}};_0x4707dd(++_0x586042);}(_0x53d2,0xba));var _0x253d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53d2[_0x3dd15e];return _0x231fd0;};'use strict';var DashboardEvents=require(_0x253d('0x0'));var events=[_0x253d('0x1'),_0x253d('0x2'),_0x253d('0x3')];function createListener(_0xd3b004,_0x43375c){return function(_0x2c491c){_0x43375c[_0x253d('0x4')](_0xd3b004,_0x2c491c);};}function removeListener(_0xbb00f4,_0x4cc6fc){return function(){DashboardEvents[_0x253d('0x5')](_0xbb00f4,_0x4cc6fc);};}exports[_0x253d('0x6')]=function(_0x3db5a6){for(var _0xef546d=0x0,_0x38a38c=events[_0x253d('0x7')];_0xef546d<_0x38a38c;_0xef546d++){var _0x58751d=events[_0xef546d];var _0x10d0d3=createListener(_0x253d('0x8')+_0x58751d,_0x3db5a6);DashboardEvents['on'](_0x58751d,_0x10d0d3);}}; \ No newline at end of file +var _0x3ab6=['emit','register','length','dashboard:','./dashboard.events','save','remove','update'];(function(_0x5c03cc,_0x2a31b9){var _0x500d3d=function(_0x70a36a){while(--_0x70a36a){_0x5c03cc['push'](_0x5c03cc['shift']());}};_0x500d3d(++_0x2a31b9);}(_0x3ab6,0x184));var _0x63ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ab6[_0x3dd15e];return _0x231fd0;};'use strict';var DashboardEvents=require(_0x63ab('0x0'));var events=[_0x63ab('0x1'),_0x63ab('0x2'),_0x63ab('0x3')];function createListener(_0x12fc7a,_0x3a32c3){return function(_0x57f0d3){_0x3a32c3[_0x63ab('0x4')](_0x12fc7a,_0x57f0d3);};}function removeListener(_0x35fad3,_0x254ea9){return function(){DashboardEvents['removeListener'](_0x35fad3,_0x254ea9);};}exports[_0x63ab('0x5')]=function(_0x24ebb9){for(var _0x445540=0x0,_0x101256=events[_0x63ab('0x6')];_0x445540<_0x101256;_0x445540++){var _0x17003b=events[_0x445540];var _0x2dcff8=createListener(_0x63ab('0x7')+_0x17003b,_0x24ebb9);DashboardEvents['on'](_0x17003b,_0x2dcff8);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index d818c73..dc0e077 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 _0xba75=['destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','/:id/items','getItems','post','create','/:id/clone','clone','put','update','delete'];(function(_0x48cad7,_0x2e578a){var _0x3e75db=function(_0x4177ed){while(--_0x4177ed){_0x48cad7['push'](_0x48cad7['shift']());}};_0x3e75db(++_0x2e578a);}(_0xba75,0x161));var _0x5ba7=function(_0x4bf0bc,_0x2c6490){_0x4bf0bc=_0x4bf0bc-0x0;var _0x223837=_0xba75[_0x4bf0bc];return _0x223837;};'use strict';var multer=require(_0x5ba7('0x0'));var util=require(_0x5ba7('0x1'));var path=require(_0x5ba7('0x2'));var timeout=require(_0x5ba7('0x3'));var express=require(_0x5ba7('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5ba7('0x5'));var config=require(_0x5ba7('0x6'));var controller=require(_0x5ba7('0x7'));router[_0x5ba7('0x8')]('/',auth[_0x5ba7('0x9')](),controller[_0x5ba7('0xa')]);router[_0x5ba7('0x8')](_0x5ba7('0xb'),auth[_0x5ba7('0x9')](),controller['show']);router['get'](_0x5ba7('0xc'),auth[_0x5ba7('0x9')](),controller[_0x5ba7('0xd')]);router[_0x5ba7('0xe')]('/',auth[_0x5ba7('0x9')](),controller[_0x5ba7('0xf')]);router[_0x5ba7('0xe')](_0x5ba7('0x10'),auth[_0x5ba7('0x9')](),controller[_0x5ba7('0x11')]);router['post'](_0x5ba7('0xc'),auth[_0x5ba7('0x9')](),controller['addItem']);router[_0x5ba7('0x12')]('/:id',auth[_0x5ba7('0x9')](),controller[_0x5ba7('0x13')]);router[_0x5ba7('0x14')](_0x5ba7('0xb'),auth[_0x5ba7('0x9')](),controller[_0x5ba7('0x15')]);module['exports']=router; \ No newline at end of file +var _0x7ea3=['../../components/interaction/service','./dashboard.controller','get','isAuthenticated','index','/:id','/:id/items','getItems','post','/:id/clone','clone','addItem','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x84963c,_0x4bc233){var _0x8bd8d1=function(_0x456d03){while(--_0x456d03){_0x84963c['push'](_0x84963c['shift']());}};_0x8bd8d1(++_0x4bc233);}(_0x7ea3,0x10c));var _0x37ea=function(_0x5dbaa7,_0x1f6d4a){_0x5dbaa7=_0x5dbaa7-0x0;var _0x481319=_0x7ea3[_0x5dbaa7];return _0x481319;};'use strict';var multer=require(_0x37ea('0x0'));var util=require(_0x37ea('0x1'));var path=require(_0x37ea('0x2'));var timeout=require('connect-timeout');var express=require(_0x37ea('0x3'));var router=express[_0x37ea('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x37ea('0x5'));var config=require('../../config/environment');var controller=require(_0x37ea('0x6'));router[_0x37ea('0x7')]('/',auth[_0x37ea('0x8')](),controller[_0x37ea('0x9')]);router[_0x37ea('0x7')](_0x37ea('0xa'),auth[_0x37ea('0x8')](),controller['show']);router[_0x37ea('0x7')](_0x37ea('0xb'),auth[_0x37ea('0x8')](),controller[_0x37ea('0xc')]);router[_0x37ea('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x37ea('0xd')](_0x37ea('0xe'),auth[_0x37ea('0x8')](),controller[_0x37ea('0xf')]);router[_0x37ea('0xd')](_0x37ea('0xb'),auth['isAuthenticated'](),controller[_0x37ea('0x10')]);router['put'](_0x37ea('0xa'),auth[_0x37ea('0x8')](),controller[_0x37ea('0x11')]);router[_0x37ea('0x12')](_0x37ea('0xa'),auth['isAuthenticated'](),controller[_0x37ea('0x13')]);module[_0x37ea('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index a0eb816..d125940 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 _0x187d=['stringify','INTEGER','#ffffff','sequelize','lodash','exports','STRING','TEXT','long','getDataValue','attrs','setDataValue'];(function(_0x420a56,_0x45c974){var _0x19dc8d=function(_0x4027a5){while(--_0x4027a5){_0x420a56['push'](_0x420a56['shift']());}};_0x19dc8d(++_0x45c974);}(_0x187d,0x93));var _0xd187=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x187d[_0x4709c0];return _0x13348b;};'use strict';var Sequelize=require(_0xd187('0x0'));var squel=require('squel');var _=require(_0xd187('0x1'));module[_0xd187('0x2')]={'title':{'type':Sequelize[_0xd187('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xd187('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xd187('0x4')](_0xd187('0x5')),'get':function(){try{return JSON['parse'](this[_0xd187('0x6')](_0xd187('0x7')));}catch(_0x4ebc8d){return[];}},'set':function(_0x1d2533){try{this[_0xd187('0x8')](_0xd187('0x7'),JSON[_0xd187('0x9')](_0x1d2533));}catch(_0x28ce2f){this[_0xd187('0x8')](_0xd187('0x7'),JSON[_0xd187('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xd187('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xd187('0xa')]},'col':{'type':Sequelize[_0xd187('0xa')]},'background':{'type':Sequelize[_0xd187('0x3')],'allowNull':![],'defaultValue':_0xd187('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xd187('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xd187('0x3')]},'titleFontSize':{'type':Sequelize[_0xd187('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0x4c60=['attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING'];(function(_0x4852c4,_0x314710){var _0x1458b4=function(_0xbc78dd){while(--_0xbc78dd){_0x4852c4['push'](_0x4852c4['shift']());}};_0x1458b4(++_0x314710);}(_0x4c60,0xc1));var _0x04c6=function(_0xbf4cf7,_0x293f64){_0xbf4cf7=_0xbf4cf7-0x0;var _0x28ec8b=_0x4c60[_0xbf4cf7];return _0x28ec8b;};'use strict';var Sequelize=require(_0x04c6('0x0'));var squel=require(_0x04c6('0x1'));var _=require(_0x04c6('0x2'));module[_0x04c6('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x04c6('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON['parse'](this['getDataValue'](_0x04c6('0x5')));}catch(_0xc6e772){return[];}},'set':function(_0x2054da){try{this[_0x04c6('0x6')](_0x04c6('0x5'),JSON[_0x04c6('0x7')](_0x2054da));}catch(_0x8f9b13){this['setDataValue'](_0x04c6('0x5'),JSON[_0x04c6('0x7')]([]));}}},'sizeX':{'type':Sequelize[_0x04c6('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x04c6('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x04c6('0x9'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x04c6('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x04c6('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 7cdf415..ca089fd 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 _0x485a=['web-report','attrReport','reportType','attrRefresh','error','stringify','create','body','update','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','save','destroy','then','name','send','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','DashboardItem','catch','find','type','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','attrSerie1','total','attrSerie2','attrSerie3'];(function(_0x1a20da,_0x226076){var _0x1c7969=function(_0x247116){while(--_0x247116){_0x1a20da['push'](_0x1a20da['shift']());}};_0x1c7969(++_0x226076);}(_0x485a,0x1d0));var _0xa485=function(_0x2d6d0f,_0x3cf2a5){_0x2d6d0f=_0x2d6d0f-0x0;var _0xd2bee6=_0x485a[_0x2d6d0f];return _0xd2bee6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa485('0x0'));var zipdir=require(_0xa485('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa485('0x2'));var moment=require(_0xa485('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa485('0x4'));var util=require(_0xa485('0x5'));var path=require('path');var sox=require(_0xa485('0x6'));var csv=require(_0xa485('0x7'));var ejs=require(_0xa485('0x8'));var fs=require('fs');var fs_extra=require(_0xa485('0x9'));var _=require(_0xa485('0xa'));var squel=require(_0xa485('0xb'));var crypto=require(_0xa485('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa485('0xd'));var toCsv=require(_0xa485('0x7'));var querystring=require(_0xa485('0xe'));var Papa=require('papaparse');var Redis=require(_0xa485('0xf'));var authService=require(_0xa485('0x10'));var qs=require(_0xa485('0x11'));var as=require(_0xa485('0x12'));var hardwareService=require(_0xa485('0x13'));var logger=require(_0xa485('0x14'))(_0xa485('0x15'));var utils=require(_0xa485('0x16'));var config=require(_0xa485('0x17'));var licenseUtil=require(_0xa485('0x18'));var db=require(_0xa485('0x19'))['db'];config[_0xa485('0x1a')]=_['defaults'](config[_0xa485('0x1a')],{'host':_0xa485('0x1b'),'port':0x18eb});var socket=require(_0xa485('0x1c'))(new Redis(config['redis']));require(_0xa485('0x1d'))[_0xa485('0x1e')](socket);function respondWithStatusCode(_0x1d04b6,_0x18d91b){_0x18d91b=_0x18d91b||0xcc;return function(_0x575f28){if(_0x575f28){return _0x1d04b6[_0xa485('0x1f')](_0x18d91b);}return _0x1d04b6[_0xa485('0x20')](_0x18d91b)[_0xa485('0x21')]();};}function respondWithResult(_0x199bb9,_0x5738ff){_0x5738ff=_0x5738ff||0xc8;return function(_0x3c4c46){if(_0x3c4c46){return _0x199bb9['status'](_0x5738ff)[_0xa485('0x22')](_0x3c4c46);}};}function respondWithFilteredResult(_0x5eca60,_0xd3011a){return function(_0x4f4c8f){if(_0x4f4c8f){var _0x3253ca=typeof _0xd3011a['offset']===_0xa485('0x23')&&typeof _0xd3011a['limit']===_0xa485('0x23');var _0x1dde49=_0x4f4c8f[_0xa485('0x24')];var _0xa609d4=_0x3253ca?0x0:_0xd3011a[_0xa485('0x25')];var _0x564c82=_0x3253ca?_0x4f4c8f[_0xa485('0x24')]:_0xd3011a[_0xa485('0x25')]+_0xd3011a[_0xa485('0x26')];var _0x367037;if(_0x564c82>=_0x1dde49){_0x564c82=_0x1dde49;_0x367037=0xc8;}else{_0x367037=0xce;}_0x5eca60[_0xa485('0x20')](_0x367037);return _0x5eca60[_0xa485('0x27')](_0xa485('0x28'),_0xa609d4+'-'+_0x564c82+'/'+_0x1dde49)[_0xa485('0x22')](_0x4f4c8f);}return null;};}function patchUpdates(_0x1e5b8a){return function(_0xa1fc82){try{jsonpatch['apply'](_0xa1fc82,_0x1e5b8a,!![]);}catch(_0x194a08){return BPromise['reject'](_0x194a08);}return _0xa1fc82[_0xa485('0x29')]();};}function saveUpdates(_0x556400,_0x40e880){return function(_0x490631){if(_0x490631){return _0x490631['update'](_0x556400)['then'](function(_0x38730c){return _0x38730c;});}return null;};}function removeEntity(_0x3d1e08,_0x454bb3){return function(_0x47bb45){if(_0x47bb45){return _0x47bb45[_0xa485('0x2a')]()[_0xa485('0x2b')](function(){_0x3d1e08[_0xa485('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26bb11,_0x550348){return function(_0x4333d1){if(!_0x4333d1){_0x26bb11[_0xa485('0x1f')](0x194);}return _0x4333d1;};}function handleError(_0x326c1c,_0x4c5a82){_0x4c5a82=_0x4c5a82||0x1f4;return function(_0x30ed23){logger['error'](_0x30ed23['stack']);if(_0x30ed23['name']){delete _0x30ed23[_0xa485('0x2c')];}_0x326c1c[_0xa485('0x20')](_0x4c5a82)[_0xa485('0x2d')](_0x30ed23);};}exports[_0xa485('0x2e')]=function(_0x388338,_0x424b6c){var _0x5ae20b={'raw':![],'where':{'id':_0x388338[_0xa485('0x2f')]['id']}},_0x502352={};_0x502352[_0xa485('0x30')]=_[_0xa485('0x31')](db['DashboardItem']['rawAttributes']);_0x502352['query']=_['keys'](_0x388338[_0xa485('0x32')]);_0x502352[_0xa485('0x33')]=_[_0xa485('0x34')](_0x502352['model'],_0x502352['query']);_0x5ae20b[_0xa485('0x35')]=_[_0xa485('0x34')](_0x502352[_0xa485('0x30')],qs[_0xa485('0x36')](_0x388338[_0xa485('0x32')][_0xa485('0x36')]));_0x5ae20b[_0xa485('0x35')]=_0x5ae20b[_0xa485('0x35')][_0xa485('0x37')]?_0x5ae20b[_0xa485('0x35')]:_0x502352['model'];if(_0x388338['query'][_0xa485('0x38')]){_0x5ae20b[_0xa485('0x39')]=[{'all':!![]}];}_0x5ae20b=_[_0xa485('0x3a')]({},_0x5ae20b,_0x388338[_0xa485('0x3b')]);return db[_0xa485('0x3c')]['find'](_0x5ae20b)['then'](handleEntityNotFound(_0x424b6c,null))[_0xa485('0x2b')](respondWithResult(_0x424b6c,null))[_0xa485('0x3d')](handleError(_0x424b6c,null));};exports['destroy']=function(_0x29a472,_0x4819df){return db[_0xa485('0x3c')][_0xa485('0x3e')]({'where':{'id':_0x29a472['params']['id']}})[_0xa485('0x2b')](handleEntityNotFound(_0x4819df,null))['then'](removeEntity(_0x4819df,null))['catch'](handleError(_0x4819df,null));};function widgetAttributes(_0x56a36d){try{switch(_0x56a36d[_0xa485('0x3f')]){case'iframe':return[{'name':_0xa485('0x40'),'value':_0x56a36d[_0xa485('0x40')]||(_0x56a36d[_0xa485('0x41')]&&_0x56a36d[_0xa485('0x41')][0x0]?_0x56a36d['attrs'][0x0][_0xa485('0x42')]:undefined)||'https://'}];case'custom':return[{'name':_0xa485('0x43'),'value':_0x56a36d[_0xa485('0x43')]||(_0x56a36d['attrs']&&_0x56a36d[_0xa485('0x41')][0x0]?_0x56a36d[_0xa485('0x41')][0x0]['value']:undefined)||''}];case _0xa485('0x44'):return[{'name':_0xa485('0x45'),'value':_0x56a36d[_0xa485('0x45')]||(_0x56a36d[_0xa485('0x41')]&&_0x56a36d['attrs'][0x0]?_0x56a36d[_0xa485('0x41')][0x0]['value']:undefined)||_0xa485('0x46')},{'name':_0xa485('0x47'),'value':_0x56a36d[_0xa485('0x47')]||(_0x56a36d['attrs']&&_0x56a36d[_0xa485('0x41')][0x1]?_0x56a36d[_0xa485('0x41')][0x1]['value']:undefined)||_0xa485('0x48')},{'name':_0xa485('0x49'),'value':_0x56a36d[_0xa485('0x49')]||(_0x56a36d['attrs']&&_0x56a36d[_0xa485('0x41')][0x2]?_0x56a36d[_0xa485('0x41')][0x2][_0xa485('0x42')]:undefined)||0xc}];case _0xa485('0x4a'):return[{'name':'attrMetric','value':_0x56a36d[_0xa485('0x4b')]||(_0x56a36d[_0xa485('0x41')]&&_0x56a36d['attrs'][0x0]?_0x56a36d[_0xa485('0x41')][0x0][_0xa485('0x42')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x56a36d[_0xa485('0x4c')]||(_0x56a36d[_0xa485('0x41')]&&_0x56a36d[_0xa485('0x41')][0x1]?_0x56a36d[_0xa485('0x41')][0x1]['value']:undefined)||[]},{'name':_0xa485('0x49'),'value':_0x56a36d[_0xa485('0x49')]||(_0x56a36d[_0xa485('0x41')]&&_0x56a36d[_0xa485('0x41')][0x2]?_0x56a36d[_0xa485('0x41')][0x2][_0xa485('0x42')]:undefined)||0x14}];case _0xa485('0x4d'):case'pie-chart':return[{'name':'attrSerie1','value':_0x56a36d[_0xa485('0x4e')]||(_0x56a36d['attrs']&&_0x56a36d['attrs'][0x0]?_0x56a36d[_0xa485('0x41')][0x0][_0xa485('0x42')]:undefined)||_0xa485('0x4f')},{'name':_0xa485('0x50'),'value':_0x56a36d[_0xa485('0x50')]||(_0x56a36d[_0xa485('0x41')]&&_0x56a36d[_0xa485('0x41')][0x1]?_0x56a36d['attrs'][0x1]['value']:undefined)||null},{'name':_0xa485('0x51'),'value':_0x56a36d[_0xa485('0x51')]||(_0x56a36d[_0xa485('0x41')]&&_0x56a36d['attrs'][0x2]?_0x56a36d[_0xa485('0x41')][0x2][_0xa485('0x42')]:undefined)||null},{'name':_0xa485('0x4c'),'value':_0x56a36d[_0xa485('0x4c')]||(_0x56a36d[_0xa485('0x41')]&&_0x56a36d[_0xa485('0x41')][0x3]?_0x56a36d[_0xa485('0x41')][0x3][_0xa485('0x42')]:undefined)||[]}];case _0xa485('0x52'):return[{'name':_0xa485('0x53'),'type':_0x56a36d[_0xa485('0x54')]||(_0x56a36d[_0xa485('0x41')]&&_0x56a36d[_0xa485('0x41')][0x0]?_0x56a36d[_0xa485('0x41')][0x0]['type']:undefined)||null,'value':_0x56a36d[_0xa485('0x53')]||(_0x56a36d[_0xa485('0x41')]&&_0x56a36d[_0xa485('0x41')][0x0]?_0x56a36d['attrs'][0x0][_0xa485('0x42')]:undefined)||null},{'name':'attrRefresh','value':_0x56a36d[_0xa485('0x55')]||(_0x56a36d[_0xa485('0x41')]&&_0x56a36d[_0xa485('0x41')][0x1]?_0x56a36d[_0xa485('0x41')][0x1][_0xa485('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x3f0a14){logger[_0xa485('0x56')]('widgetAttributes:\x20%s',JSON[_0xa485('0x57')](_0x3f0a14));return[];}}exports[_0xa485('0x58')]=function(_0x212b1e,_0x4ccc45){if(_0x212b1e['body']){_0x212b1e['body']['attrs']=widgetAttributes(_0x212b1e[_0xa485('0x59')]);}return db[_0xa485('0x3c')][_0xa485('0x58')](_0x212b1e[_0xa485('0x59')],{})[_0xa485('0x2b')](respondWithResult(_0x4ccc45,0xc9))[_0xa485('0x3d')](handleError(_0x4ccc45,null));};exports[_0xa485('0x5a')]=function(_0x52b93f,_0x1d2f62){if(_0x52b93f[_0xa485('0x59')]['id']){delete _0x52b93f['body']['id'];}_0x52b93f[_0xa485('0x59')]['attrs']=widgetAttributes(_0x52b93f['body']);return db[_0xa485('0x3c')][_0xa485('0x3e')]({'where':{'id':_0x52b93f['params']['id']}})['then'](handleEntityNotFound(_0x1d2f62,null))[_0xa485('0x2b')](saveUpdates(_0x52b93f[_0xa485('0x59')],null))[_0xa485('0x2b')](respondWithResult(_0x1d2f62,null))['catch'](handleError(_0x1d2f62,null));}; \ No newline at end of file +var _0xde84=['name','send','show','params','model','keys','DashboardItem','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','options','find','catch','attrUrl','value','https://','custom','attrPath','attrs','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','attrSerie1','total','attrSerie2','attrSerie3','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./dashboardItem.socket','register','sendStatus','end','status','json','offset','limit','count','set','apply','reject','save','update','destroy','then','error','stack'];(function(_0x3e65f2,_0x410e3b){var _0x33f71e=function(_0x376569){while(--_0x376569){_0x3e65f2['push'](_0x3e65f2['shift']());}};_0x33f71e(++_0x410e3b);}(_0xde84,0x84));var _0x4de8=function(_0x312372,_0x131d2f){_0x312372=_0x312372-0x0;var _0x5966eb=_0xde84[_0x312372];return _0x5966eb;};'use strict';var emlformat=require(_0x4de8('0x0'));var rimraf=require(_0x4de8('0x1'));var zipdir=require(_0x4de8('0x2'));var jsonpatch=require(_0x4de8('0x3'));var rp=require('request-promise');var moment=require(_0x4de8('0x4'));var BPromise=require(_0x4de8('0x5'));var Mustache=require(_0x4de8('0x6'));var util=require(_0x4de8('0x7'));var path=require(_0x4de8('0x8'));var sox=require(_0x4de8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4de8('0xa'));var _=require(_0x4de8('0xb'));var squel=require(_0x4de8('0xc'));var crypto=require(_0x4de8('0xd'));var jsforce=require(_0x4de8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4de8('0xf'));var querystring=require('querystring');var Papa=require(_0x4de8('0x10'));var Redis=require(_0x4de8('0x11'));var authService=require(_0x4de8('0x12'));var qs=require(_0x4de8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4de8('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4de8('0x15'));var config=require(_0x4de8('0x16'));var licenseUtil=require(_0x4de8('0x17'));var db=require('../../mysqldb')['db'];config[_0x4de8('0x18')]=_['defaults'](config['redis'],{'host':_0x4de8('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4de8('0x18')]));require(_0x4de8('0x1a'))[_0x4de8('0x1b')](socket);function respondWithStatusCode(_0x1e0eed,_0x1bb15f){_0x1bb15f=_0x1bb15f||0xcc;return function(_0x24563c){if(_0x24563c){return _0x1e0eed[_0x4de8('0x1c')](_0x1bb15f);}return _0x1e0eed['status'](_0x1bb15f)[_0x4de8('0x1d')]();};}function respondWithResult(_0x22c68b,_0x566601){_0x566601=_0x566601||0xc8;return function(_0x45a7e9){if(_0x45a7e9){return _0x22c68b[_0x4de8('0x1e')](_0x566601)[_0x4de8('0x1f')](_0x45a7e9);}};}function respondWithFilteredResult(_0x5e5101,_0x35d2a9){return function(_0x4c25af){if(_0x4c25af){var _0x3e1efa=typeof _0x35d2a9[_0x4de8('0x20')]==='undefined'&&typeof _0x35d2a9[_0x4de8('0x21')]==='undefined';var _0x5627e2=_0x4c25af['count'];var _0x4b81a9=_0x3e1efa?0x0:_0x35d2a9['offset'];var _0x3456da=_0x3e1efa?_0x4c25af[_0x4de8('0x22')]:_0x35d2a9['offset']+_0x35d2a9[_0x4de8('0x21')];var _0x570d39;if(_0x3456da>=_0x5627e2){_0x3456da=_0x5627e2;_0x570d39=0xc8;}else{_0x570d39=0xce;}_0x5e5101[_0x4de8('0x1e')](_0x570d39);return _0x5e5101[_0x4de8('0x23')]('Content-Range',_0x4b81a9+'-'+_0x3456da+'/'+_0x5627e2)['json'](_0x4c25af);}return null;};}function patchUpdates(_0x2e09d5){return function(_0x1a1320){try{jsonpatch[_0x4de8('0x24')](_0x1a1320,_0x2e09d5,!![]);}catch(_0x2dc929){return BPromise[_0x4de8('0x25')](_0x2dc929);}return _0x1a1320[_0x4de8('0x26')]();};}function saveUpdates(_0x1972d7,_0x42c93a){return function(_0x13fe7e){if(_0x13fe7e){return _0x13fe7e[_0x4de8('0x27')](_0x1972d7)['then'](function(_0x21fda8){return _0x21fda8;});}return null;};}function removeEntity(_0x498d2c,_0x8fa3d1){return function(_0x781f04){if(_0x781f04){return _0x781f04[_0x4de8('0x28')]()[_0x4de8('0x29')](function(){_0x498d2c['status'](0xcc)[_0x4de8('0x1d')]();});}};}function handleEntityNotFound(_0x406fcd,_0x339fbe){return function(_0x31d343){if(!_0x31d343){_0x406fcd[_0x4de8('0x1c')](0x194);}return _0x31d343;};}function handleError(_0x263dab,_0x180104){_0x180104=_0x180104||0x1f4;return function(_0x24223d){logger[_0x4de8('0x2a')](_0x24223d[_0x4de8('0x2b')]);if(_0x24223d[_0x4de8('0x2c')]){delete _0x24223d['name'];}_0x263dab[_0x4de8('0x1e')](_0x180104)[_0x4de8('0x2d')](_0x24223d);};}exports[_0x4de8('0x2e')]=function(_0x262aef,_0x3352cc){var _0x540d45={'raw':![],'where':{'id':_0x262aef[_0x4de8('0x2f')]['id']}},_0x2c05ae={};_0x2c05ae[_0x4de8('0x30')]=_[_0x4de8('0x31')](db[_0x4de8('0x32')][_0x4de8('0x33')]);_0x2c05ae[_0x4de8('0x34')]=_['keys'](_0x262aef[_0x4de8('0x34')]);_0x2c05ae['filters']=_[_0x4de8('0x35')](_0x2c05ae[_0x4de8('0x30')],_0x2c05ae[_0x4de8('0x34')]);_0x540d45[_0x4de8('0x36')]=_[_0x4de8('0x35')](_0x2c05ae[_0x4de8('0x30')],qs[_0x4de8('0x37')](_0x262aef['query'][_0x4de8('0x37')]));_0x540d45['attributes']=_0x540d45[_0x4de8('0x36')][_0x4de8('0x38')]?_0x540d45[_0x4de8('0x36')]:_0x2c05ae[_0x4de8('0x30')];if(_0x262aef['query'][_0x4de8('0x39')]){_0x540d45[_0x4de8('0x3a')]=[{'all':!![]}];}_0x540d45=_['merge']({},_0x540d45,_0x262aef[_0x4de8('0x3b')]);return db[_0x4de8('0x32')][_0x4de8('0x3c')](_0x540d45)[_0x4de8('0x29')](handleEntityNotFound(_0x3352cc,null))['then'](respondWithResult(_0x3352cc,null))[_0x4de8('0x3d')](handleError(_0x3352cc,null));};exports['destroy']=function(_0x29d042,_0x28df23){return db[_0x4de8('0x32')][_0x4de8('0x3c')]({'where':{'id':_0x29d042[_0x4de8('0x2f')]['id']}})[_0x4de8('0x29')](handleEntityNotFound(_0x28df23,null))[_0x4de8('0x29')](removeEntity(_0x28df23,null))[_0x4de8('0x3d')](handleError(_0x28df23,null));};function widgetAttributes(_0x7bd27a){try{switch(_0x7bd27a['type']){case'iframe':return[{'name':_0x4de8('0x3e'),'value':_0x7bd27a[_0x4de8('0x3e')]||(_0x7bd27a['attrs']&&_0x7bd27a['attrs'][0x0]?_0x7bd27a['attrs'][0x0][_0x4de8('0x3f')]:undefined)||_0x4de8('0x40')}];case _0x4de8('0x41'):return[{'name':_0x4de8('0x42'),'value':_0x7bd27a[_0x4de8('0x42')]||(_0x7bd27a[_0x4de8('0x43')]&&_0x7bd27a[_0x4de8('0x43')][0x0]?_0x7bd27a['attrs'][0x0][_0x4de8('0x3f')]:undefined)||''}];case _0x4de8('0x44'):return[{'name':_0x4de8('0x45'),'value':_0x7bd27a[_0x4de8('0x45')]||(_0x7bd27a['attrs']&&_0x7bd27a[_0x4de8('0x43')][0x0]?_0x7bd27a[_0x4de8('0x43')][0x0][_0x4de8('0x3f')]:undefined)||_0x4de8('0x46')},{'name':'attrTimezone','value':_0x7bd27a[_0x4de8('0x47')]||(_0x7bd27a[_0x4de8('0x43')]&&_0x7bd27a['attrs'][0x1]?_0x7bd27a[_0x4de8('0x43')][0x1][_0x4de8('0x3f')]:undefined)||_0x4de8('0x48')},{'name':_0x4de8('0x49'),'value':_0x7bd27a[_0x4de8('0x49')]||(_0x7bd27a[_0x4de8('0x43')]&&_0x7bd27a[_0x4de8('0x43')][0x2]?_0x7bd27a['attrs'][0x2][_0x4de8('0x3f')]:undefined)||0xc}];case _0x4de8('0x4a'):return[{'name':_0x4de8('0x4b'),'value':_0x7bd27a['attrMetric']||(_0x7bd27a[_0x4de8('0x43')]&&_0x7bd27a[_0x4de8('0x43')][0x0]?_0x7bd27a[_0x4de8('0x43')][0x0][_0x4de8('0x3f')]:undefined)||'total'},{'name':_0x4de8('0x4c'),'value':_0x7bd27a[_0x4de8('0x4c')]||(_0x7bd27a[_0x4de8('0x43')]&&_0x7bd27a['attrs'][0x1]?_0x7bd27a[_0x4de8('0x43')][0x1][_0x4de8('0x3f')]:undefined)||[]},{'name':_0x4de8('0x49'),'value':_0x7bd27a[_0x4de8('0x49')]||(_0x7bd27a[_0x4de8('0x43')]&&_0x7bd27a[_0x4de8('0x43')][0x2]?_0x7bd27a[_0x4de8('0x43')][0x2][_0x4de8('0x3f')]:undefined)||0x14}];case _0x4de8('0x4d'):case'pie-chart':return[{'name':_0x4de8('0x4e'),'value':_0x7bd27a[_0x4de8('0x4e')]||(_0x7bd27a['attrs']&&_0x7bd27a[_0x4de8('0x43')][0x0]?_0x7bd27a[_0x4de8('0x43')][0x0][_0x4de8('0x3f')]:undefined)||_0x4de8('0x4f')},{'name':_0x4de8('0x50'),'value':_0x7bd27a[_0x4de8('0x50')]||(_0x7bd27a[_0x4de8('0x43')]&&_0x7bd27a[_0x4de8('0x43')][0x1]?_0x7bd27a[_0x4de8('0x43')][0x1][_0x4de8('0x3f')]:undefined)||null},{'name':_0x4de8('0x51'),'value':_0x7bd27a[_0x4de8('0x51')]||(_0x7bd27a[_0x4de8('0x43')]&&_0x7bd27a[_0x4de8('0x43')][0x2]?_0x7bd27a['attrs'][0x2][_0x4de8('0x3f')]:undefined)||null},{'name':_0x4de8('0x4c'),'value':_0x7bd27a['attrVoiceQueues']||(_0x7bd27a[_0x4de8('0x43')]&&_0x7bd27a[_0x4de8('0x43')][0x3]?_0x7bd27a[_0x4de8('0x43')][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':'attrReport','type':_0x7bd27a['reportType']||(_0x7bd27a[_0x4de8('0x43')]&&_0x7bd27a[_0x4de8('0x43')][0x0]?_0x7bd27a[_0x4de8('0x43')][0x0]['type']:undefined)||null,'value':_0x7bd27a[_0x4de8('0x52')]||(_0x7bd27a[_0x4de8('0x43')]&&_0x7bd27a[_0x4de8('0x43')][0x0]?_0x7bd27a[_0x4de8('0x43')][0x0][_0x4de8('0x3f')]:undefined)||null},{'name':'attrRefresh','value':_0x7bd27a[_0x4de8('0x53')]||(_0x7bd27a['attrs']&&_0x7bd27a[_0x4de8('0x43')][0x1]?_0x7bd27a[_0x4de8('0x43')][0x1][_0x4de8('0x3f')]:undefined)||0x0}];default:return[];}}catch(_0x3814bc){logger[_0x4de8('0x2a')](_0x4de8('0x54'),JSON[_0x4de8('0x55')](_0x3814bc));return[];}}exports['create']=function(_0xf45094,_0x5633f6){if(_0xf45094[_0x4de8('0x56')]){_0xf45094[_0x4de8('0x56')][_0x4de8('0x43')]=widgetAttributes(_0xf45094[_0x4de8('0x56')]);}return db[_0x4de8('0x32')][_0x4de8('0x57')](_0xf45094[_0x4de8('0x56')],{})['then'](respondWithResult(_0x5633f6,0xc9))[_0x4de8('0x3d')](handleError(_0x5633f6,null));};exports['update']=function(_0x51317b,_0x51646e){if(_0x51317b[_0x4de8('0x56')]['id']){delete _0x51317b['body']['id'];}_0x51317b['body'][_0x4de8('0x43')]=widgetAttributes(_0x51317b['body']);return db[_0x4de8('0x32')][_0x4de8('0x3c')]({'where':{'id':_0x51317b[_0x4de8('0x2f')]['id']}})[_0x4de8('0x29')](handleEntityNotFound(_0x51646e,null))[_0x4de8('0x29')](saveUpdates(_0x51317b[_0x4de8('0x56')],null))['then'](respondWithResult(_0x51646e,null))[_0x4de8('0x3d')](handleError(_0x51646e,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 4a05897..16771a3 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 _0xdedd=['emit','hasOwnProperty','hook','events','../../mysqldb','DashboardItem','setMaxListeners','update','remove'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xdedd,0x1a1));var _0xdded=function(_0x3d3aad,_0x5e595f){_0x3d3aad=_0x3d3aad-0x0;var _0xba87ce=_0xdedd[_0x3d3aad];return _0xba87ce;};'use strict';var EventEmitter=require(_0xdded('0x0'));var DashboardItem=require(_0xdded('0x1'))['db'][_0xdded('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xdded('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdded('0x4'),'afterDestroy':_0xdded('0x5')};function emitEvent(_0x5047f){return function(_0x381a87,_0x5312e4,_0x587db1){DashboardItemEvents[_0xdded('0x6')](_0x5047f+':'+_0x381a87['id'],_0x381a87);DashboardItemEvents[_0xdded('0x6')](_0x5047f,_0x381a87);_0x587db1(null);};}for(var e in events){if(events[_0xdded('0x7')](e)){var event=events[e];DashboardItem[_0xdded('0x8')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0xcc5b=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update','emit'];(function(_0x18e42f,_0x24c3bf){var _0x28e072=function(_0x3062ec){while(--_0x3062ec){_0x18e42f['push'](_0x18e42f['shift']());}};_0x28e072(++_0x24c3bf);}(_0xcc5b,0x1e3));var _0xbcc5=function(_0x2fd925,_0xde1a2a){_0x2fd925=_0x2fd925-0x0;var _0x2f7a4f=_0xcc5b[_0x2fd925];return _0x2f7a4f;};'use strict';var EventEmitter=require(_0xbcc5('0x0'));var DashboardItem=require(_0xbcc5('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xbcc5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbcc5('0x3'),'afterDestroy':'remove'};function emitEvent(_0x566901){return function(_0xb87fa4,_0x5809fd,_0x2b88e2){DashboardItemEvents[_0xbcc5('0x4')](_0x566901+':'+_0xb87fa4['id'],_0xb87fa4);DashboardItemEvents[_0xbcc5('0x4')](_0x566901,_0xb87fa4);_0x2b88e2(null);};}for(var e in events){if(events[_0xbcc5('0x5')](e)){var event=events[e];DashboardItem[_0xbcc5('0x6')](e,emitEvent(event));}}module[_0xbcc5('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 4939ce7..4946af9 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 _0x7762=['rimraf','../../config/environment','exports','DashboardItem','dashboard_items','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x7762,0x17b));var _0x2776=function(_0x140333,_0x3cf55b){_0x140333=_0x140333-0x0;var _0x329cef=_0x7762[_0x140333];return _0x329cef;};'use strict';var _=require(_0x2776('0x0'));var util=require(_0x2776('0x1'));var logger=require(_0x2776('0x2'))('api');var moment=require(_0x2776('0x3'));var BPromise=require(_0x2776('0x4'));var rp=require(_0x2776('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2776('0x6'));var config=require(_0x2776('0x7'));var attributes=require('./dashboardItem.attributes');module[_0x2776('0x8')]=function(_0x489e72,_0x4eefcf){return _0x489e72['define'](_0x2776('0x9'),attributes,{'tableName':_0x2776('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ac8=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash'];(function(_0x3e35b6,_0x3c7e99){var _0x528514=function(_0x430e21){while(--_0x430e21){_0x3e35b6['push'](_0x3e35b6['shift']());}};_0x528514(++_0x3c7e99);}(_0x1ac8,0xed));var _0x81ac=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1ac8[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x81ac('0x0'));var util=require(_0x81ac('0x1'));var logger=require(_0x81ac('0x2'))(_0x81ac('0x3'));var moment=require(_0x81ac('0x4'));var BPromise=require('bluebird');var rp=require(_0x81ac('0x5'));var fs=require('fs');var path=require(_0x81ac('0x6'));var rimraf=require(_0x81ac('0x7'));var config=require(_0x81ac('0x8'));var attributes=require(_0x81ac('0x9'));module[_0x81ac('0xa')]=function(_0x2b7f3d,_0x52ae5b){return _0x2b7f3d[_0x81ac('0xb')](_0x81ac('0xc'),attributes,{'tableName':_0x81ac('0xd'),'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 9e9bc11..6f3b3fc 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 _0x1b49=['moment','randomstring','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x6e1ca,_0x178893){var _0xa06bf3=function(_0x42b656){while(--_0x42b656){_0x6e1ca['push'](_0x6e1ca['shift']());}};_0xa06bf3(++_0x178893);}(_0x1b49,0x144));var _0x91b4=function(_0x5c12ba,_0x229eee){_0x5c12ba=_0x5c12ba-0x0;var _0x4ed0fa=_0x1b49[_0x5c12ba];return _0x4ed0fa;};'use strict';var _=require('lodash');var util=require(_0x91b4('0x0'));var moment=require(_0x91b4('0x1'));var BPromise=require('bluebird');var rs=require(_0x91b4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x91b4('0x3'));var config=require(_0x91b4('0x4'));var jayson=require(_0x91b4('0x5'));var client=jayson[_0x91b4('0x6')]['http']({'port':0x232a});config[_0x91b4('0x7')]=_[_0x91b4('0x8')](config['redis'],{'host':_0x91b4('0x9'),'port':0x18eb});var socket=require(_0x91b4('0xa'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0x91b4('0xb')](socket);function respondWithRpcPromise(_0x3b3708,_0x117e89,_0x4d504c){return new BPromise(function(_0x2c6d14,_0x3eafaf){return client[_0x91b4('0xc')](_0x3b3708,_0x4d504c)[_0x91b4('0xd')](function(_0x460e34){logger[_0x91b4('0xe')](_0x91b4('0xf'),_0x117e89,_0x91b4('0x10'));logger[_0x91b4('0x11')](_0x91b4('0x12'),_0x117e89,_0x91b4('0x10'),JSON[_0x91b4('0x13')](_0x460e34));if(_0x460e34[_0x91b4('0x14')]){if(_0x460e34[_0x91b4('0x14')][_0x91b4('0x15')]===0x1f4){logger[_0x91b4('0x14')](_0x91b4('0xf'),_0x117e89,_0x460e34[_0x91b4('0x14')][_0x91b4('0x16')]);return _0x3eafaf(_0x460e34['error'][_0x91b4('0x16')]);}logger['error'](_0x91b4('0xf'),_0x117e89,_0x460e34[_0x91b4('0x14')]['message']);return _0x2c6d14(_0x460e34[_0x91b4('0x14')][_0x91b4('0x16')]);}else{logger['info'](_0x91b4('0xf'),_0x117e89,_0x91b4('0x10'));_0x2c6d14(_0x460e34[_0x91b4('0x17')][_0x91b4('0x16')]);}})[_0x91b4('0x18')](function(_0x3051c7){logger['error']('DashboardItem,\x20%s,\x20%s',_0x117e89,_0x3051c7);_0x3eafaf(_0x3051c7);});});} \ No newline at end of file +var _0x51bb=['code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','./dashboardItem.socket','register','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3a9bff,_0x5ad570){var _0xcf5198=function(_0xedb908){while(--_0xedb908){_0x3a9bff['push'](_0x3a9bff['shift']());}};_0xcf5198(++_0x5ad570);}(_0x51bb,0x1e0));var _0xb51b=function(_0x4f0a40,_0x283658){_0x4f0a40=_0x4f0a40-0x0;var _0xa65cd3=_0x51bb[_0x4f0a40];return _0xa65cd3;};'use strict';var _=require(_0xb51b('0x0'));var util=require(_0xb51b('0x1'));var moment=require(_0xb51b('0x2'));var BPromise=require(_0xb51b('0x3'));var rs=require(_0xb51b('0x4'));var fs=require('fs');var Redis=require(_0xb51b('0x5'));var db=require(_0xb51b('0x6'))['db'];var utils=require(_0xb51b('0x7'));var logger=require(_0xb51b('0x8'))(_0xb51b('0x9'));var config=require(_0xb51b('0xa'));var jayson=require(_0xb51b('0xb'));var client=jayson['client']['http']({'port':0x232a});config[_0xb51b('0xc')]=_[_0xb51b('0xd')](config[_0xb51b('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb51b('0xc')]));require(_0xb51b('0xe'))[_0xb51b('0xf')](socket);function respondWithRpcPromise(_0xba7c96,_0x21ff8c,_0x192671){return new BPromise(function(_0x2f9313,_0x1363d2){return client[_0xb51b('0x10')](_0xba7c96,_0x192671)[_0xb51b('0x11')](function(_0x4d61e8){logger['info'](_0xb51b('0x12'),_0x21ff8c,_0xb51b('0x13'));logger[_0xb51b('0x14')](_0xb51b('0x15'),_0x21ff8c,_0xb51b('0x13'),JSON[_0xb51b('0x16')](_0x4d61e8));if(_0x4d61e8[_0xb51b('0x17')]){if(_0x4d61e8[_0xb51b('0x17')][_0xb51b('0x18')]===0x1f4){logger[_0xb51b('0x17')](_0xb51b('0x12'),_0x21ff8c,_0x4d61e8[_0xb51b('0x17')][_0xb51b('0x19')]);return _0x1363d2(_0x4d61e8[_0xb51b('0x17')]['message']);}logger[_0xb51b('0x17')]('DashboardItem,\x20%s,\x20%s',_0x21ff8c,_0x4d61e8['error'][_0xb51b('0x19')]);return _0x2f9313(_0x4d61e8[_0xb51b('0x17')]['message']);}else{logger[_0xb51b('0x1a')](_0xb51b('0x12'),_0x21ff8c,'request\x20sent');_0x2f9313(_0x4d61e8['result'][_0xb51b('0x19')]);}})[_0xb51b('0x1b')](function(_0x80e99){logger['error'](_0xb51b('0x12'),_0x21ff8c,_0x80e99);_0x1363d2(_0x80e99);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index d968277..39dd0e3 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 _0x004f=['remove','update','emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','save'];(function(_0x4370c7,_0x5dbfb0){var _0xce78a9=function(_0x157b2c){while(--_0x157b2c){_0x4370c7['push'](_0x4370c7['shift']());}};_0xce78a9(++_0x5dbfb0);}(_0x004f,0x166));var _0xf004=function(_0x1111fb,_0x2d2efb){_0x1111fb=_0x1111fb-0x0;var _0x4087c3=_0x004f[_0x1111fb];return _0x4087c3;};'use strict';var DashboardItemEvents=require(_0xf004('0x0'));var events=[_0xf004('0x1'),_0xf004('0x2'),_0xf004('0x3')];function createListener(_0x27c2e8,_0x4d558e){return function(_0x4b87fa){_0x4d558e[_0xf004('0x4')](_0x27c2e8,_0x4b87fa);};}function removeListener(_0xbf8cbf,_0x36d506){return function(){DashboardItemEvents[_0xf004('0x5')](_0xbf8cbf,_0x36d506);};}exports[_0xf004('0x6')]=function(_0xf3d0a4){for(var _0x491386=0x0,_0x491e19=events[_0xf004('0x7')];_0x491386<_0x491e19;_0x491386++){var _0x568408=events[_0x491386];var _0x50945d=createListener(_0xf004('0x8')+_0x568408,_0xf3d0a4);DashboardItemEvents['on'](_0x568408,_0x50945d);}}; \ No newline at end of file +var _0xf5da=['./dashboardItem.events','remove','update','emit','removeListener','length','dashboardItem:'];(function(_0x1f099b,_0x1c978a){var _0x56c12f=function(_0x571c50){while(--_0x571c50){_0x1f099b['push'](_0x1f099b['shift']());}};_0x56c12f(++_0x1c978a);}(_0xf5da,0x85));var _0xaf5d=function(_0x16fd68,_0x3d394d){_0x16fd68=_0x16fd68-0x0;var _0x12cf8e=_0xf5da[_0x16fd68];return _0x12cf8e;};'use strict';var DashboardItemEvents=require(_0xaf5d('0x0'));var events=['save',_0xaf5d('0x1'),_0xaf5d('0x2')];function createListener(_0x1f50a5,_0x321bdc){return function(_0x11483e){_0x321bdc[_0xaf5d('0x3')](_0x1f50a5,_0x11483e);};}function removeListener(_0x3a3a0e,_0x370ca4){return function(){DashboardItemEvents[_0xaf5d('0x4')](_0x3a3a0e,_0x370ca4);};}exports['register']=function(_0x1eee0c){for(var _0x312c28=0x0,_0x171003=events[_0xaf5d('0x5')];_0x312c28<_0x171003;_0x312c28++){var _0x38f4ff=events[_0x312c28];var _0x47191a=createListener(_0xaf5d('0x6')+_0x38f4ff,_0x1eee0c);DashboardItemEvents['on'](_0x38f4ff,_0x47191a);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 4048ea9..8a6b3f5 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 _0x8259=['destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','show','post','create','put','update','/:id','isAuthenticated'];(function(_0x200a4c,_0x10084a){var _0x9e90ef=function(_0x52678a){while(--_0x52678a){_0x200a4c['push'](_0x200a4c['shift']());}};_0x9e90ef(++_0x10084a);}(_0x8259,0xbd));var _0x9825=function(_0x33e9bf,_0x41823d){_0x33e9bf=_0x33e9bf-0x0;var _0x52ff43=_0x8259[_0x33e9bf];return _0x52ff43;};'use strict';var multer=require('multer');var util=require(_0x9825('0x0'));var path=require(_0x9825('0x1'));var timeout=require(_0x9825('0x2'));var express=require(_0x9825('0x3'));var router=express['Router']();var fs_extra=require(_0x9825('0x4'));var auth=require(_0x9825('0x5'));var interaction=require(_0x9825('0x6'));var config=require('../../config/environment');var controller=require(_0x9825('0x7'));router['get']('/:id',auth['isAuthenticated'](),controller[_0x9825('0x8')]);router[_0x9825('0x9')]('/',auth['isAuthenticated'](),controller[_0x9825('0xa')]);router[_0x9825('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x9825('0xc')]);router['delete'](_0x9825('0xd'),auth[_0x9825('0xe')](),controller[_0x9825('0xf')]);module[_0x9825('0x10')]=router; \ No newline at end of file +var _0x6272=['update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','post','create','put'];(function(_0x288ae8,_0x399244){var _0x6504b9=function(_0xf884e2){while(--_0xf884e2){_0x288ae8['push'](_0x288ae8['shift']());}};_0x6504b9(++_0x399244);}(_0x6272,0x136));var _0x2627=function(_0x1134c5,_0x5c0169){_0x1134c5=_0x1134c5-0x0;var _0x45f19b=_0x6272[_0x1134c5];return _0x45f19b;};'use strict';var multer=require('multer');var util=require(_0x2627('0x0'));var path=require(_0x2627('0x1'));var timeout=require('connect-timeout');var express=require(_0x2627('0x2'));var router=express[_0x2627('0x3')]();var fs_extra=require(_0x2627('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2627('0x5'));var config=require(_0x2627('0x6'));var controller=require('./dashboardItem.controller');router[_0x2627('0x7')](_0x2627('0x8'),auth[_0x2627('0x9')](),controller['show']);router[_0x2627('0xa')]('/',auth[_0x2627('0x9')](),controller[_0x2627('0xb')]);router[_0x2627('0xc')](_0x2627('0x8'),auth[_0x2627('0x9')](),controller[_0x2627('0xd')]);router[_0x2627('0xe')](_0x2627('0x8'),auth[_0x2627('0x9')](),controller[_0x2627('0xf')]);module[_0x2627('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 987e6f0..121b8ce 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 _0x79fc=['second','sequelize','exports','STRING','ENUM','first'];(function(_0x511b76,_0x4727fa){var _0x5424ff=function(_0x24b7c0){while(--_0x24b7c0){_0x511b76['push'](_0x511b76['shift']());}};_0x5424ff(++_0x4727fa);}(_0x79fc,0x9d));var _0xc79f=function(_0x40e0eb,_0x51f9a5){_0x40e0eb=_0x40e0eb-0x0;var _0x3b11ee=_0x79fc[_0x40e0eb];return _0x3b11ee;};'use strict';var Sequelize=require(_0xc79f('0x0'));module[_0xc79f('0x1')]={'name':{'type':Sequelize[_0xc79f('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xc79f('0x3')](_0xc79f('0x4'),_0xc79f('0x5'),'third'),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xc79f('0x2')]}}; \ No newline at end of file +var _0xe010=['second','third','sequelize','exports','STRING','ENUM'];(function(_0x360dfc,_0x23ee2e){var _0x24ad26=function(_0x1764f3){while(--_0x1764f3){_0x360dfc['push'](_0x360dfc['shift']());}};_0x24ad26(++_0x23ee2e);}(_0xe010,0x1e2));var _0x0e01=function(_0x278282,_0x2636d9){_0x278282=_0x278282-0x0;var _0x12f7d2=_0xe010[_0x278282];return _0x12f7d2;};'use strict';var Sequelize=require(_0x0e01('0x0'));module[_0x0e01('0x1')]={'name':{'type':Sequelize[_0x0e01('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x0e01('0x3')]('first',_0x0e01('0x4'),_0x0e01('0x5')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 763d76d..f36b66c 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 _0x3a67=['fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','Disposition','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','index','map','rawAttributes'];(function(_0x53f4e3,_0x62f760){var _0x25c1ef=function(_0x4e4e95){while(--_0x4e4e95){_0x53f4e3['push'](_0x53f4e3['shift']());}};_0x25c1ef(++_0x62f760);}(_0x3a67,0x11c));var _0x73a6=function(_0x4f13f0,_0xd7f5ae){_0x4f13f0=_0x4f13f0-0x0;var _0x2d4805=_0x3a67[_0x4f13f0];return _0x2d4805;};'use strict';var emlformat=require(_0x73a6('0x0'));var rimraf=require(_0x73a6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x73a6('0x2'));var moment=require('moment');var BPromise=require(_0x73a6('0x3'));var Mustache=require('mustache');var util=require(_0x73a6('0x4'));var path=require('path');var sox=require(_0x73a6('0x5'));var csv=require(_0x73a6('0x6'));var ejs=require(_0x73a6('0x7'));var fs=require('fs');var fs_extra=require(_0x73a6('0x8'));var _=require(_0x73a6('0x9'));var squel=require(_0x73a6('0xa'));var crypto=require(_0x73a6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x73a6('0xc'));var toCsv=require(_0x73a6('0x6'));var querystring=require(_0x73a6('0xd'));var Papa=require('papaparse');var Redis=require(_0x73a6('0xe'));var authService=require(_0x73a6('0xf'));var qs=require(_0x73a6('0x10'));var as=require(_0x73a6('0x11'));var hardwareService=require(_0x73a6('0x12'));var logger=require(_0x73a6('0x13'))(_0x73a6('0x14'));var utils=require('../../config/utils');var config=require(_0x73a6('0x15'));var licenseUtil=require(_0x73a6('0x16'));var db=require(_0x73a6('0x17'))['db'];function respondWithStatusCode(_0x737d89,_0x567a44){_0x567a44=_0x567a44||0xcc;return function(_0x59b1bd){if(_0x59b1bd){return _0x737d89[_0x73a6('0x18')](_0x567a44);}return _0x737d89[_0x73a6('0x19')](_0x567a44)[_0x73a6('0x1a')]();};}function respondWithResult(_0x25cba4,_0x362a74){_0x362a74=_0x362a74||0xc8;return function(_0x4a2253){if(_0x4a2253){return _0x25cba4[_0x73a6('0x19')](_0x362a74)[_0x73a6('0x1b')](_0x4a2253);}};}function respondWithFilteredResult(_0x49b47c,_0x52c90d){return function(_0x210cdd){if(_0x210cdd){var _0x428599=typeof _0x52c90d['offset']===_0x73a6('0x1c')&&typeof _0x52c90d[_0x73a6('0x1d')]===_0x73a6('0x1c');var _0x2feba6=_0x210cdd[_0x73a6('0x1e')];var _0x2b1b30=_0x428599?0x0:_0x52c90d['offset'];var _0x2dc73f=_0x428599?_0x210cdd['count']:_0x52c90d[_0x73a6('0x1f')]+_0x52c90d['limit'];var _0x40511e;if(_0x2dc73f>=_0x2feba6){_0x2dc73f=_0x2feba6;_0x40511e=0xc8;}else{_0x40511e=0xce;}_0x49b47c[_0x73a6('0x19')](_0x40511e);return _0x49b47c[_0x73a6('0x20')](_0x73a6('0x21'),_0x2b1b30+'-'+_0x2dc73f+'/'+_0x2feba6)[_0x73a6('0x1b')](_0x210cdd);}return null;};}function patchUpdates(_0x112f01){return function(_0xd4bdc2){try{jsonpatch['apply'](_0xd4bdc2,_0x112f01,!![]);}catch(_0x40b6d0){return BPromise[_0x73a6('0x22')](_0x40b6d0);}return _0xd4bdc2[_0x73a6('0x23')]();};}function saveUpdates(_0x5533b5,_0x5f3993){return function(_0x38b99c){if(_0x38b99c){return _0x38b99c[_0x73a6('0x24')](_0x5533b5)[_0x73a6('0x25')](function(_0x419c6b){return _0x419c6b;});}return null;};}function removeEntity(_0xc2fe45,_0x3e9097){return function(_0x4bfb93){if(_0x4bfb93){return _0x4bfb93[_0x73a6('0x26')]()[_0x73a6('0x25')](function(){var _0x2acdf5=_0x4bfb93[_0x73a6('0x27')]({'plain':!![]});var _0x417437=_0x73a6('0x28');return db[_0x73a6('0x29')]['destroy']({'where':{'type':_0x417437,'resourceId':_0x2acdf5['id']}})[_0x73a6('0x25')](function(){return _0x4bfb93;});})[_0x73a6('0x25')](function(){_0xc2fe45[_0x73a6('0x19')](0xcc)[_0x73a6('0x1a')]();});}};}function handleEntityNotFound(_0x6d1048,_0x3e8561){return function(_0x23f281){if(!_0x23f281){_0x6d1048[_0x73a6('0x18')](0x194);}return _0x23f281;};}function handleError(_0xec16e6,_0x29e8a8){_0x29e8a8=_0x29e8a8||0x1f4;return function(_0x594840){logger[_0x73a6('0x2a')](_0x594840[_0x73a6('0x2b')]);if(_0x594840['name']){delete _0x594840[_0x73a6('0x2c')];}_0xec16e6[_0x73a6('0x19')](_0x29e8a8)['send'](_0x594840);};}exports[_0x73a6('0x2d')]=function(_0x4588c7,_0x1c7c4a){var _0x5396e9={},_0x11c1ae={},_0x355eb6={'count':0x0,'rows':[]};var _0x16a228=_[_0x73a6('0x2e')](db['Disposition'][_0x73a6('0x2f')],function(_0x139252){return{'name':_0x139252[_0x73a6('0x30')],'type':_0x139252[_0x73a6('0x31')][_0x73a6('0x32')]};});_0x11c1ae[_0x73a6('0x33')]=_[_0x73a6('0x2e')](_0x16a228,_0x73a6('0x2c'));_0x11c1ae[_0x73a6('0x34')]=_[_0x73a6('0x35')](_0x4588c7[_0x73a6('0x34')]);_0x11c1ae[_0x73a6('0x36')]=_['intersection'](_0x11c1ae[_0x73a6('0x33')],_0x11c1ae[_0x73a6('0x34')]);_0x5396e9[_0x73a6('0x37')]=_[_0x73a6('0x38')](_0x11c1ae[_0x73a6('0x33')],qs[_0x73a6('0x39')](_0x4588c7[_0x73a6('0x34')]['fields']));_0x5396e9[_0x73a6('0x37')]=_0x5396e9['attributes'][_0x73a6('0x3a')]?_0x5396e9['attributes']:_0x11c1ae[_0x73a6('0x33')];if(!_0x4588c7['query'][_0x73a6('0x3b')](_0x73a6('0x3c'))){_0x5396e9[_0x73a6('0x1d')]=qs[_0x73a6('0x1d')](_0x4588c7['query'][_0x73a6('0x1d')]);_0x5396e9[_0x73a6('0x1f')]=qs['offset'](_0x4588c7[_0x73a6('0x34')]['offset']);}_0x5396e9[_0x73a6('0x3d')]=qs['sort'](_0x4588c7[_0x73a6('0x34')]['sort']);_0x5396e9[_0x73a6('0x3e')]=qs[_0x73a6('0x36')](_[_0x73a6('0x3f')](_0x4588c7[_0x73a6('0x34')],_0x11c1ae[_0x73a6('0x36')]),_0x16a228);if(_0x4588c7[_0x73a6('0x34')][_0x73a6('0x40')]){_0x5396e9['where']=_[_0x73a6('0x41')](_0x5396e9['where'],{'$or':_[_0x73a6('0x2e')](_0x16a228,function(_0x5bb386){if(_0x5bb386[_0x73a6('0x31')]!==_0x73a6('0x42')){var _0xc00a4f={};_0xc00a4f[_0x5bb386[_0x73a6('0x2c')]]={'$like':'%'+_0x4588c7[_0x73a6('0x34')]['filter']+'%'};return _0xc00a4f;}})});}_0x5396e9=_[_0x73a6('0x41')]({},_0x5396e9,_0x4588c7[_0x73a6('0x43')]);var _0xc8ddba={'where':_0x5396e9[_0x73a6('0x3e')]};return db[_0x73a6('0x44')][_0x73a6('0x1e')](_0xc8ddba)[_0x73a6('0x25')](function(_0x31f3ed){_0x355eb6[_0x73a6('0x1e')]=_0x31f3ed;if(_0x4588c7[_0x73a6('0x34')]['includeAll']){_0x5396e9['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x5396e9);})[_0x73a6('0x25')](function(_0x2d0a80){_0x355eb6[_0x73a6('0x45')]=_0x2d0a80;return _0x355eb6;})[_0x73a6('0x25')](respondWithFilteredResult(_0x1c7c4a,_0x5396e9))[_0x73a6('0x46')](handleError(_0x1c7c4a,null));};exports[_0x73a6('0x47')]=function(_0x3e45ff,_0x59a135){var _0x31ddc1={'raw':!![],'where':{'id':_0x3e45ff[_0x73a6('0x48')]['id']}},_0x1a4c00={};_0x1a4c00[_0x73a6('0x33')]=_['keys'](db[_0x73a6('0x44')][_0x73a6('0x2f')]);_0x1a4c00['query']=_[_0x73a6('0x35')](_0x3e45ff[_0x73a6('0x34')]);_0x1a4c00[_0x73a6('0x36')]=_['intersection'](_0x1a4c00['model'],_0x1a4c00[_0x73a6('0x34')]);_0x31ddc1[_0x73a6('0x37')]=_[_0x73a6('0x38')](_0x1a4c00[_0x73a6('0x33')],qs[_0x73a6('0x39')](_0x3e45ff[_0x73a6('0x34')][_0x73a6('0x39')]));_0x31ddc1[_0x73a6('0x37')]=_0x31ddc1['attributes'][_0x73a6('0x3a')]?_0x31ddc1[_0x73a6('0x37')]:_0x1a4c00['model'];if(_0x3e45ff[_0x73a6('0x34')][_0x73a6('0x49')]){_0x31ddc1['include']=[{'all':!![]}];}_0x31ddc1=_['merge']({},_0x31ddc1,_0x3e45ff['options']);return db['Disposition'][_0x73a6('0x4a')](_0x31ddc1)['then'](handleEntityNotFound(_0x59a135,null))[_0x73a6('0x25')](respondWithResult(_0x59a135,null))['catch'](handleError(_0x59a135,null));};exports[_0x73a6('0x4b')]=function(_0x15d8b2,_0x54da12){return db[_0x73a6('0x44')][_0x73a6('0x4b')](_0x15d8b2[_0x73a6('0x4c')],{})['then'](function(_0x3857b5){var _0x1e675e=_0x15d8b2[_0x73a6('0x4d')][_0x73a6('0x27')]({'plain':!![]});if(!_0x1e675e)throw new Error(_0x73a6('0x4e'));if(_0x1e675e[_0x73a6('0x4f')]==='user'){var _0x2e4bc8=_0x3857b5['get']({'plain':!![]});var _0x468f24=_0x73a6('0x28');return db[_0x73a6('0x50')][_0x73a6('0x4a')]({'where':{'name':_0x468f24,'userProfileId':_0x1e675e['userProfileId']},'raw':!![]})[_0x73a6('0x25')](function(_0x19966a){if(_0x19966a&&_0x19966a[_0x73a6('0x51')]===0x0){return db[_0x73a6('0x29')]['create']({'name':_0x2e4bc8['name'],'resourceId':_0x2e4bc8['id'],'type':_0x19966a[_0x73a6('0x2c')],'sectionId':_0x19966a['id']},{})['then'](function(){return _0x3857b5;});}else{return _0x3857b5;}})[_0x73a6('0x46')](function(_0x3c52bf){logger[_0x73a6('0x2a')](_0x73a6('0x52'),_0x3c52bf);throw _0x3c52bf;});}return _0x3857b5;})[_0x73a6('0x25')](respondWithResult(_0x54da12,0xc9))[_0x73a6('0x46')](handleError(_0x54da12,null));};exports[_0x73a6('0x24')]=function(_0x4539d0,_0x2d8b35){if(_0x4539d0[_0x73a6('0x4c')]['id']){delete _0x4539d0[_0x73a6('0x4c')]['id'];}return db['Disposition'][_0x73a6('0x4a')]({'where':{'id':_0x4539d0[_0x73a6('0x48')]['id']}})[_0x73a6('0x25')](handleEntityNotFound(_0x2d8b35,null))['then'](saveUpdates(_0x4539d0[_0x73a6('0x4c')],null))[_0x73a6('0x25')](respondWithResult(_0x2d8b35,null))['catch'](handleError(_0x2d8b35,null));};exports[_0x73a6('0x26')]=function(_0x39c198,_0x4c2de8){return db[_0x73a6('0x44')]['find']({'where':{'id':_0x39c198[_0x73a6('0x48')]['id']}})[_0x73a6('0x25')](handleEntityNotFound(_0x4c2de8,null))['then'](removeEntity(_0x4c2de8,null))['catch'](handleError(_0x4c2de8,null));}; \ No newline at end of file +var _0x895c=['bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','get','Dispositions','error','name','send','index','Disposition','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x1a1e23,_0x3c2f9b){var _0x39d845=function(_0x226db2){while(--_0x226db2){_0x1a1e23['push'](_0x1a1e23['shift']());}};_0x39d845(++_0x3c2f9b);}(_0x895c,0x173));var _0xc895=function(_0x2c74e5,_0x2f9a66){_0x2c74e5=_0x2c74e5-0x0;var _0x3ea53c=_0x895c[_0x2c74e5];return _0x3ea53c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc895('0x0'));var zipdir=require(_0xc895('0x1'));var jsonpatch=require(_0xc895('0x2'));var rp=require(_0xc895('0x3'));var moment=require('moment');var BPromise=require(_0xc895('0x4'));var Mustache=require(_0xc895('0x5'));var util=require('util');var path=require('path');var sox=require(_0xc895('0x6'));var csv=require(_0xc895('0x7'));var ejs=require(_0xc895('0x8'));var fs=require('fs');var fs_extra=require(_0xc895('0x9'));var _=require(_0xc895('0xa'));var squel=require('squel');var crypto=require(_0xc895('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc895('0xc'));var toCsv=require(_0xc895('0x7'));var querystring=require(_0xc895('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc895('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc895('0xf'));var logger=require(_0xc895('0x10'))(_0xc895('0x11'));var utils=require(_0xc895('0x12'));var config=require(_0xc895('0x13'));var licenseUtil=require(_0xc895('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f2797,_0x452e00){_0x452e00=_0x452e00||0xcc;return function(_0x26b9ed){if(_0x26b9ed){return _0x4f2797[_0xc895('0x15')](_0x452e00);}return _0x4f2797[_0xc895('0x16')](_0x452e00)[_0xc895('0x17')]();};}function respondWithResult(_0x4d4fea,_0x4219d5){_0x4219d5=_0x4219d5||0xc8;return function(_0xc626ee){if(_0xc626ee){return _0x4d4fea[_0xc895('0x16')](_0x4219d5)[_0xc895('0x18')](_0xc626ee);}};}function respondWithFilteredResult(_0x4a7ca3,_0x3272c1){return function(_0x34b804){if(_0x34b804){var _0x3933b8=typeof _0x3272c1[_0xc895('0x19')]===_0xc895('0x1a')&&typeof _0x3272c1[_0xc895('0x1b')]===_0xc895('0x1a');var _0x5d77db=_0x34b804[_0xc895('0x1c')];var _0x18a547=_0x3933b8?0x0:_0x3272c1[_0xc895('0x19')];var _0x3234dd=_0x3933b8?_0x34b804[_0xc895('0x1c')]:_0x3272c1[_0xc895('0x19')]+_0x3272c1[_0xc895('0x1b')];var _0x586c6a;if(_0x3234dd>=_0x5d77db){_0x3234dd=_0x5d77db;_0x586c6a=0xc8;}else{_0x586c6a=0xce;}_0x4a7ca3[_0xc895('0x16')](_0x586c6a);return _0x4a7ca3[_0xc895('0x1d')]('Content-Range',_0x18a547+'-'+_0x3234dd+'/'+_0x5d77db)[_0xc895('0x18')](_0x34b804);}return null;};}function patchUpdates(_0x1dba01){return function(_0x159b08){try{jsonpatch[_0xc895('0x1e')](_0x159b08,_0x1dba01,!![]);}catch(_0x5b613b){return BPromise[_0xc895('0x1f')](_0x5b613b);}return _0x159b08['save']();};}function saveUpdates(_0x2e86f8,_0x250533){return function(_0x14cb6d){if(_0x14cb6d){return _0x14cb6d[_0xc895('0x20')](_0x2e86f8)[_0xc895('0x21')](function(_0xec82f0){return _0xec82f0;});}return null;};}function removeEntity(_0x48bd50,_0x4c7a95){return function(_0x56fc97){if(_0x56fc97){return _0x56fc97[_0xc895('0x22')]()[_0xc895('0x21')](function(){var _0x649a85=_0x56fc97[_0xc895('0x23')]({'plain':!![]});var _0x4a05f3=_0xc895('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x4a05f3,'resourceId':_0x649a85['id']}})[_0xc895('0x21')](function(){return _0x56fc97;});})[_0xc895('0x21')](function(){_0x48bd50['status'](0xcc)[_0xc895('0x17')]();});}};}function handleEntityNotFound(_0x3e21e4,_0x55a1da){return function(_0x3b55d0){if(!_0x3b55d0){_0x3e21e4[_0xc895('0x15')](0x194);}return _0x3b55d0;};}function handleError(_0x3ab02f,_0x429355){_0x429355=_0x429355||0x1f4;return function(_0x1554ac){logger[_0xc895('0x25')](_0x1554ac['stack']);if(_0x1554ac['name']){delete _0x1554ac[_0xc895('0x26')];}_0x3ab02f[_0xc895('0x16')](_0x429355)[_0xc895('0x27')](_0x1554ac);};}exports[_0xc895('0x28')]=function(_0xe26752,_0x18ecbc){var _0x2d87e8={},_0x49ad8f={},_0x231cdf={'count':0x0,'rows':[]};var _0x131f8b=_['map'](db[_0xc895('0x29')]['rawAttributes'],function(_0x251132){return{'name':_0x251132[_0xc895('0x2a')],'type':_0x251132[_0xc895('0x2b')][_0xc895('0x2c')]};});_0x49ad8f[_0xc895('0x2d')]=_[_0xc895('0x2e')](_0x131f8b,_0xc895('0x26'));_0x49ad8f[_0xc895('0x2f')]=_['keys'](_0xe26752[_0xc895('0x2f')]);_0x49ad8f[_0xc895('0x30')]=_[_0xc895('0x31')](_0x49ad8f[_0xc895('0x2d')],_0x49ad8f['query']);_0x2d87e8[_0xc895('0x32')]=_['intersection'](_0x49ad8f[_0xc895('0x2d')],qs[_0xc895('0x33')](_0xe26752[_0xc895('0x2f')][_0xc895('0x33')]));_0x2d87e8[_0xc895('0x32')]=_0x2d87e8[_0xc895('0x32')][_0xc895('0x34')]?_0x2d87e8[_0xc895('0x32')]:_0x49ad8f[_0xc895('0x2d')];if(!_0xe26752[_0xc895('0x2f')][_0xc895('0x35')]('nolimit')){_0x2d87e8[_0xc895('0x1b')]=qs['limit'](_0xe26752[_0xc895('0x2f')][_0xc895('0x1b')]);_0x2d87e8[_0xc895('0x19')]=qs[_0xc895('0x19')](_0xe26752['query']['offset']);}_0x2d87e8['order']=qs['sort'](_0xe26752[_0xc895('0x2f')]['sort']);_0x2d87e8[_0xc895('0x36')]=qs[_0xc895('0x30')](_[_0xc895('0x37')](_0xe26752[_0xc895('0x2f')],_0x49ad8f[_0xc895('0x30')]),_0x131f8b);if(_0xe26752['query'][_0xc895('0x38')]){_0x2d87e8[_0xc895('0x36')]=_[_0xc895('0x39')](_0x2d87e8[_0xc895('0x36')],{'$or':_[_0xc895('0x2e')](_0x131f8b,function(_0x2ae452){if(_0x2ae452['type']!==_0xc895('0x3a')){var _0x43d772={};_0x43d772[_0x2ae452[_0xc895('0x26')]]={'$like':'%'+_0xe26752[_0xc895('0x2f')][_0xc895('0x38')]+'%'};return _0x43d772;}})});}_0x2d87e8=_[_0xc895('0x39')]({},_0x2d87e8,_0xe26752[_0xc895('0x3b')]);var _0x213bb2={'where':_0x2d87e8[_0xc895('0x36')]};return db[_0xc895('0x29')][_0xc895('0x1c')](_0x213bb2)[_0xc895('0x21')](function(_0x57124d){_0x231cdf[_0xc895('0x1c')]=_0x57124d;if(_0xe26752[_0xc895('0x2f')][_0xc895('0x3c')]){_0x2d87e8[_0xc895('0x3d')]=[{'all':!![]}];}return db[_0xc895('0x29')]['findAll'](_0x2d87e8);})[_0xc895('0x21')](function(_0x547c0a){_0x231cdf[_0xc895('0x3e')]=_0x547c0a;return _0x231cdf;})[_0xc895('0x21')](respondWithFilteredResult(_0x18ecbc,_0x2d87e8))[_0xc895('0x3f')](handleError(_0x18ecbc,null));};exports[_0xc895('0x40')]=function(_0x63886f,_0x571955){var _0x40e277={'raw':!![],'where':{'id':_0x63886f[_0xc895('0x41')]['id']}},_0x198862={};_0x198862[_0xc895('0x2d')]=_['keys'](db[_0xc895('0x29')]['rawAttributes']);_0x198862[_0xc895('0x2f')]=_[_0xc895('0x42')](_0x63886f[_0xc895('0x2f')]);_0x198862[_0xc895('0x30')]=_['intersection'](_0x198862[_0xc895('0x2d')],_0x198862[_0xc895('0x2f')]);_0x40e277[_0xc895('0x32')]=_[_0xc895('0x31')](_0x198862['model'],qs['fields'](_0x63886f['query']['fields']));_0x40e277['attributes']=_0x40e277[_0xc895('0x32')][_0xc895('0x34')]?_0x40e277[_0xc895('0x32')]:_0x198862['model'];if(_0x63886f[_0xc895('0x2f')][_0xc895('0x3c')]){_0x40e277[_0xc895('0x3d')]=[{'all':!![]}];}_0x40e277=_[_0xc895('0x39')]({},_0x40e277,_0x63886f[_0xc895('0x3b')]);return db[_0xc895('0x29')][_0xc895('0x43')](_0x40e277)['then'](handleEntityNotFound(_0x571955,null))['then'](respondWithResult(_0x571955,null))['catch'](handleError(_0x571955,null));};exports[_0xc895('0x44')]=function(_0x469b83,_0x4f1215){return db[_0xc895('0x29')][_0xc895('0x44')](_0x469b83[_0xc895('0x45')],{})[_0xc895('0x21')](function(_0x52a8fb){var _0x1adf0b=_0x469b83[_0xc895('0x46')]['get']({'plain':!![]});if(!_0x1adf0b)throw new Error(_0xc895('0x47'));if(_0x1adf0b[_0xc895('0x48')]===_0xc895('0x46')){var _0xf0ba33=_0x52a8fb[_0xc895('0x23')]({'plain':!![]});var _0x482918=_0xc895('0x24');return db[_0xc895('0x49')]['find']({'where':{'name':_0x482918,'userProfileId':_0x1adf0b['userProfileId']},'raw':!![]})['then'](function(_0xe2338){if(_0xe2338&&_0xe2338[_0xc895('0x4a')]===0x0){return db['UserProfileResource'][_0xc895('0x44')]({'name':_0xf0ba33['name'],'resourceId':_0xf0ba33['id'],'type':_0xe2338[_0xc895('0x26')],'sectionId':_0xe2338['id']},{})[_0xc895('0x21')](function(){return _0x52a8fb;});}else{return _0x52a8fb;}})['catch'](function(_0x3c99a1){logger[_0xc895('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c99a1);throw _0x3c99a1;});}return _0x52a8fb;})[_0xc895('0x21')](respondWithResult(_0x4f1215,0xc9))[_0xc895('0x3f')](handleError(_0x4f1215,null));};exports[_0xc895('0x20')]=function(_0x357b1b,_0x37b456){if(_0x357b1b[_0xc895('0x45')]['id']){delete _0x357b1b['body']['id'];}return db['Disposition'][_0xc895('0x43')]({'where':{'id':_0x357b1b[_0xc895('0x41')]['id']}})[_0xc895('0x21')](handleEntityNotFound(_0x37b456,null))[_0xc895('0x21')](saveUpdates(_0x357b1b[_0xc895('0x45')],null))[_0xc895('0x21')](respondWithResult(_0x37b456,null))[_0xc895('0x3f')](handleError(_0x37b456,null));};exports[_0xc895('0x22')]=function(_0x23f4de,_0x337f71){return db['Disposition']['find']({'where':{'id':_0x23f4de[_0xc895('0x41')]['id']}})[_0xc895('0x21')](handleEntityNotFound(_0x337f71,null))['then'](removeEntity(_0x337f71,null))[_0xc895('0x3f')](handleError(_0x337f71,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 2c34dd0..fea94dd 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 _0x8556=['rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','MailAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x293a36,_0x214e12){var _0x5efbf3=function(_0x1e981d){while(--_0x1e981d){_0x293a36['push'](_0x293a36['shift']());}};_0x5efbf3(++_0x214e12);}(_0x8556,0x6d));var _0x6855=function(_0x1ff2ec,_0x386e86){_0x1ff2ec=_0x1ff2ec-0x0;var _0x405683=_0x8556[_0x1ff2ec];return _0x405683;};'use strict';var _=require(_0x6855('0x0'));var util=require(_0x6855('0x1'));var logger=require(_0x6855('0x2'))(_0x6855('0x3'));var moment=require(_0x6855('0x4'));var BPromise=require(_0x6855('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6855('0x6'));var config=require(_0x6855('0x7'));var attributes=require(_0x6855('0x8'));module[_0x6855('0x9')]=function(_0x1fb540,_0x26bf26){return _0x1fb540[_0x6855('0xa')](_0x6855('0xb'),attributes,{'tableName':_0x6855('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x6855('0xd'),'fields':[_0x6855('0xe'),_0x6855('0xf')]},{'unique':!![],'name':_0x6855('0x10'),'fields':[_0x6855('0xe'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0x6855('0xe'),_0x6855('0x11')]},{'unique':!![],'name':'name_sms','fields':[_0x6855('0xe'),'SmsAccountId']},{'unique':!![],'name':_0x6855('0x12'),'fields':[_0x6855('0xe'),'FaxAccountId']},{'unique':!![],'name':_0x6855('0x13'),'fields':[_0x6855('0xe'),_0x6855('0x14')]},{'unique':!![],'name':_0x6855('0x15'),'fields':[_0x6855('0xe'),_0x6855('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4a07=['FaxAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','moment','rimraf','../../config/environment','./disposition.attributes','exports','define','name_voice','name','ListId','name_chat','name_mail','MailAccountId','name_sms','SmsAccountId'];(function(_0x3b0323,_0x2aa6bd){var _0x1cc44e=function(_0x2a05d5){while(--_0x2a05d5){_0x3b0323['push'](_0x3b0323['shift']());}};_0x1cc44e(++_0x2aa6bd);}(_0x4a07,0xd4));var _0x74a0=function(_0x21636f,_0x1da759){_0x21636f=_0x21636f-0x0;var _0x3bccda=_0x4a07[_0x21636f];return _0x3bccda;};'use strict';var _=require(_0x74a0('0x0'));var util=require('util');var logger=require(_0x74a0('0x1'))('api');var moment=require(_0x74a0('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x74a0('0x3'));var config=require(_0x74a0('0x4'));var attributes=require(_0x74a0('0x5'));module[_0x74a0('0x6')]=function(_0x280359,_0x11d90e){return _0x280359[_0x74a0('0x7')]('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x74a0('0x8'),'fields':[_0x74a0('0x9'),_0x74a0('0xa')]},{'unique':!![],'name':_0x74a0('0xb'),'fields':['name','ChatWebsiteId']},{'unique':!![],'name':_0x74a0('0xc'),'fields':[_0x74a0('0x9'),_0x74a0('0xd')]},{'unique':!![],'name':_0x74a0('0xe'),'fields':[_0x74a0('0x9'),_0x74a0('0xf')]},{'unique':!![],'name':'name_fax','fields':[_0x74a0('0x9'),_0x74a0('0x10')]},{'unique':!![],'name':'name_openchannel','fields':[_0x74a0('0x9'),'OpenchannelAccountId']},{'unique':!![],'name':_0x74a0('0x11'),'fields':[_0x74a0('0x9'),_0x74a0('0x12')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 4efc02e..53cd9b9 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(_0xb111bf,_0x34d31b){var _0x4504f1=function(_0xc84514){while(--_0xc84514){_0xb111bf['push'](_0xb111bf['shift']());}};_0x4504f1(++_0x34d31b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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(_0x458581,_0x14e465){var _0x2b3f80=function(_0x4219d9){while(--_0x4219d9){_0x458581['push'](_0x458581['shift']());}};_0x2b3f80(++_0x14e465);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 4de4701..06fcbd8 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 _0xf17a=['util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x4d9c0b,_0x17a4b8){var _0x28a8b3=function(_0x1d39bc){while(--_0x1d39bc){_0x4d9c0b['push'](_0x4d9c0b['shift']());}};_0x28a8b3(++_0x17a4b8);}(_0xf17a,0x117));var _0xaf17=function(_0x2668a2,_0x520772){_0x2668a2=_0x2668a2-0x0;var _0x311f2c=_0xf17a[_0x2668a2];return _0x311f2c;};'use strict';var multer=require(_0xaf17('0x0'));var util=require(_0xaf17('0x1'));var path=require('path');var timeout=require(_0xaf17('0x2'));var express=require(_0xaf17('0x3'));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[_0xaf17('0x8')]('/',auth[_0xaf17('0x9')](),controller[_0xaf17('0xa')]);router['get'](_0xaf17('0xb'),auth[_0xaf17('0x9')](),controller[_0xaf17('0xc')]);router[_0xaf17('0xd')]('/',auth[_0xaf17('0x9')](),controller[_0xaf17('0xe')]);router[_0xaf17('0xf')](_0xaf17('0xb'),auth[_0xaf17('0x9')](),controller[_0xaf17('0x10')]);router[_0xaf17('0x11')](_0xaf17('0xb'),auth['isAuthenticated'](),controller[_0xaf17('0x12')]);module[_0xaf17('0x13')]=router; \ No newline at end of file +var _0x6705=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./disposition.controller','get','index','/:id','isAuthenticated','show','post','create','update','destroy','exports','multer'];(function(_0x12eb66,_0x5cd435){var _0x483b0f=function(_0x4a532c){while(--_0x4a532c){_0x12eb66['push'](_0x12eb66['shift']());}};_0x483b0f(++_0x5cd435);}(_0x6705,0xfb));var _0x5670=function(_0x72dd95,_0xddfb44){_0x72dd95=_0x72dd95-0x0;var _0x1188ab=_0x6705[_0x72dd95];return _0x1188ab;};'use strict';var multer=require(_0x5670('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5670('0x1'));var express=require(_0x5670('0x2'));var router=express[_0x5670('0x3')]();var fs_extra=require(_0x5670('0x4'));var auth=require(_0x5670('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5670('0x6'));var controller=require(_0x5670('0x7'));router[_0x5670('0x8')]('/',auth['isAuthenticated'](),controller[_0x5670('0x9')]);router['get'](_0x5670('0xa'),auth[_0x5670('0xb')](),controller[_0x5670('0xc')]);router[_0x5670('0xd')]('/',auth[_0x5670('0xb')](),controller[_0x5670('0xe')]);router['put'](_0x5670('0xa'),auth['isAuthenticated'](),controller[_0x5670('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5670('0x10')]);module[_0x5670('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 23d7346..28eaea3 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 _0x9632=['localstationid','2400','7200','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax'];(function(_0x5c5913,_0x3e1eef){var _0x3e2887=function(_0x4a1a03){while(--_0x4a1a03){_0x5c5913['push'](_0x5c5913['shift']());}};_0x3e2887(++_0x3e1eef);}(_0x9632,0x72));var _0x2963=function(_0x3a31c3,_0x4b2e4d){_0x3a31c3=_0x3a31c3-0x0;var _0x1ec91b=_0x9632[_0x3a31c3];return _0x1ec91b;};'use strict';var Sequelize=require(_0x2963('0x0'));module[_0x2963('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2963('0x2')]},'ecm':{'type':Sequelize[_0x2963('0x3')](_0x2963('0x4'),'no'),'defaultValue':_0x2963('0x4')},'headerinfo':{'type':Sequelize[_0x2963('0x2')],'defaultValue':_0x2963('0x5')},'localstationid':{'type':Sequelize[_0x2963('0x2')],'unique':_0x2963('0x6')},'minrate':{'type':Sequelize[_0x2963('0x3')](_0x2963('0x7'),'4800',_0x2963('0x8'),'9600',_0x2963('0x9'),_0x2963('0xa')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x2963('0x3')](_0x2963('0x7'),'4800','7200','9600',_0x2963('0x9'),_0x2963('0xa')),'defaultValue':_0x2963('0xa')},'modem':{'type':Sequelize[_0x2963('0x2')],'defaultValue':_0x2963('0xb')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x2963('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x2963('0xd'),_0x2963('0xe'),_0x2963('0xf'),_0x2963('0x10')),'defaultValue':_0x2963('0xd')},'key':{'type':Sequelize[_0x2963('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x2963('0x11')],'defaultValue':function(){return _0x2963('0x12');}},'notificationSound':{'type':Sequelize[_0x2963('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2963('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2963('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2963('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2963('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2963('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2963('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2963('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x2963('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x2963('0x13')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x305d96){if(!_0x305d96)this['setDataValue'](_0x2963('0x15'),null);this[_0x2963('0x16')](_0x2963('0x17'),_0x305d96);}}}; \ No newline at end of file +var _0xb1a4=['7200','v17,v27,v29','IAX','DADHI','KHOMP','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','9600','12000','14400'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0xb1a4,0x12e));var _0x4b1a=function(_0x1a565d,_0x4df16b){_0x1a565d=_0x1a565d-0x0;var _0x1148cc=_0xb1a4[_0x1a565d];return _0x1148cc;};'use strict';var Sequelize=require(_0x4b1a('0x0'));module['exports']={'name':{'type':Sequelize[_0x4b1a('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4b1a('0x1')]},'ecm':{'type':Sequelize[_0x4b1a('0x2')](_0x4b1a('0x3'),'no'),'defaultValue':_0x4b1a('0x3')},'headerinfo':{'type':Sequelize[_0x4b1a('0x1')],'defaultValue':_0x4b1a('0x4')},'localstationid':{'type':Sequelize[_0x4b1a('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x4b1a('0x2')](_0x4b1a('0x5'),_0x4b1a('0x6'),'7200',_0x4b1a('0x7'),_0x4b1a('0x8'),_0x4b1a('0x9')),'defaultValue':_0x4b1a('0x6')},'maxrate':{'type':Sequelize[_0x4b1a('0x2')](_0x4b1a('0x5'),_0x4b1a('0x6'),_0x4b1a('0xa'),_0x4b1a('0x7'),_0x4b1a('0x8'),_0x4b1a('0x9')),'defaultValue':_0x4b1a('0x9')},'modem':{'type':Sequelize[_0x4b1a('0x1')],'defaultValue':_0x4b1a('0xb')},'gateway':{'type':Sequelize[_0x4b1a('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM']('SIP',_0x4b1a('0xc'),_0x4b1a('0xd'),_0x4b1a('0xe')),'defaultValue':_0x4b1a('0xf')},'key':{'type':Sequelize[_0x4b1a('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4b1a('0x10')],'defaultValue':function(){return _0x4b1a('0x11');}},'notificationSound':{'type':Sequelize[_0x4b1a('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4b1a('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4b1a('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4b1a('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4b1a('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4b1a('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4b1a('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4b1a('0x13')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x4b1a('0x12')],'defaultValue':![],'comment':_0x4b1a('0x14'),'set':function(_0x471cd9){if(!_0x471cd9)this['setDataValue'](_0x4b1a('0x15'),null);this[_0x4b1a('0x16')](_0x4b1a('0x17'),_0x471cd9);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 5ac5348..00529c7 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 _0x94a6=['Contact\x20not\x20found','spread','filename','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','http','request','then','info','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','end','status','json','offset','undefined','limit','count','set','apply','save','update','destroy','get','FaxAccounts','UserProfileResource','sendStatus','name','send','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','show','params','Pause','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','nolimit','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','tag','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','from-voip-provider','exten','localstationid','system','description','Fax\x20Extension','priority','appdata','push','Answer','CDR(type)=inbound-fax','Set','faxdetect','maxrate','minrate','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','VoiceExtension','tech','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','fax','List','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','FaxInteraction','out'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x94a6,0x191));var _0x694a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94a6[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x694a('0x0'));var rimraf=require(_0x694a('0x1'));var zipdir=require(_0x694a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x694a('0x3'));var moment=require(_0x694a('0x4'));var BPromise=require(_0x694a('0x5'));var Mustache=require(_0x694a('0x6'));var util=require(_0x694a('0x7'));var path=require(_0x694a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x694a('0x9'));var fs=require('fs');var fs_extra=require(_0x694a('0xa'));var _=require(_0x694a('0xb'));var squel=require(_0x694a('0xc'));var crypto=require('crypto');var jsforce=require(_0x694a('0xd'));var deskjs=require(_0x694a('0xe'));var toCsv=require(_0x694a('0xf'));var querystring=require(_0x694a('0x10'));var Papa=require(_0x694a('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x694a('0x12'));var hardwareService=require(_0x694a('0x13'));var logger=require(_0x694a('0x14'))(_0x694a('0x15'));var utils=require(_0x694a('0x16'));var config=require(_0x694a('0x17'));var licenseUtil=require(_0x694a('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x694a('0x19')](config[_0x694a('0x1a')],{'host':_0x694a('0x1b'),'port':0x18eb});var socket=require(_0x694a('0x1c'))(new Redis(config[_0x694a('0x1a')]));require(_0x694a('0x1d'))[_0x694a('0x1e')](socket);var jayson=require(_0x694a('0x1f'));var client=jayson['client'][_0x694a('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x694a('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1bfc53,_0x2b5059,_0x2f295f,_0x136806){return new BPromise(function(_0x40be18,_0x15ebe8){var _0x2ccc1f=_0x136806||client;return _0x2ccc1f[_0x694a('0x21')](_0x1bfc53,_0x2f295f)[_0x694a('0x22')](function(_0x32a958){logger[_0x694a('0x23')]('FaxAccount,\x20%s,\x20%s',_0x2b5059,_0x694a('0x24'));logger['debug'](_0x694a('0x25'),_0x2b5059,_0x694a('0x24'),JSON[_0x694a('0x26')](_0x32a958));if(_0x32a958['error']){if(_0x32a958[_0x694a('0x27')][_0x694a('0x28')]===0x1f4){logger[_0x694a('0x27')](_0x694a('0x29'),_0x2b5059,_0x32a958['error']['message']);return _0x15ebe8(_0x32a958['error'][_0x694a('0x2a')]);}logger['error'](_0x694a('0x29'),_0x2b5059,_0x32a958[_0x694a('0x27')][_0x694a('0x2a')]);return _0x40be18(_0x32a958['error']['message']);}else{logger['info'](_0x694a('0x29'),_0x2b5059,_0x694a('0x24'));_0x40be18(_0x32a958[_0x694a('0x2b')][_0x694a('0x2a')]);}})[_0x694a('0x2c')](function(_0x9258df){logger[_0x694a('0x27')](_0x694a('0x29'),_0x2b5059,_0x9258df);_0x15ebe8(_0x9258df);});});}function respondWithStatusCode(_0xbaec1f,_0x33d7a4){_0x33d7a4=_0x33d7a4||0xcc;return function(_0x3e130a){if(_0x3e130a){return _0xbaec1f['sendStatus'](_0x33d7a4);}return _0xbaec1f['status'](_0x33d7a4)[_0x694a('0x2d')]();};}function respondWithResult(_0x565394,_0x598a1e){_0x598a1e=_0x598a1e||0xc8;return function(_0xecdc1a){if(_0xecdc1a){return _0x565394[_0x694a('0x2e')](_0x598a1e)[_0x694a('0x2f')](_0xecdc1a);}};}function respondWithFilteredResult(_0x21193,_0x5b1ad5){return function(_0x1b20cf){if(_0x1b20cf){var _0x2bdab7=typeof _0x5b1ad5[_0x694a('0x30')]===_0x694a('0x31')&&typeof _0x5b1ad5[_0x694a('0x32')]==='undefined';var _0x472fd8=_0x1b20cf[_0x694a('0x33')];var _0x5f44b9=_0x2bdab7?0x0:_0x5b1ad5[_0x694a('0x30')];var _0x5ccd31=_0x2bdab7?_0x1b20cf[_0x694a('0x33')]:_0x5b1ad5[_0x694a('0x30')]+_0x5b1ad5[_0x694a('0x32')];var _0x2e0e37;if(_0x5ccd31>=_0x472fd8){_0x5ccd31=_0x472fd8;_0x2e0e37=0xc8;}else{_0x2e0e37=0xce;}_0x21193[_0x694a('0x2e')](_0x2e0e37);return _0x21193[_0x694a('0x34')]('Content-Range',_0x5f44b9+'-'+_0x5ccd31+'/'+_0x472fd8)[_0x694a('0x2f')](_0x1b20cf);}return null;};}function patchUpdates(_0xe23daf){return function(_0x159439){try{jsonpatch[_0x694a('0x35')](_0x159439,_0xe23daf,!![]);}catch(_0x29c2be){return BPromise['reject'](_0x29c2be);}return _0x159439[_0x694a('0x36')]();};}function saveUpdates(_0x186872,_0x2e53cd){return function(_0x597892){if(_0x597892){return _0x597892[_0x694a('0x37')](_0x186872)[_0x694a('0x22')](function(_0x1925c6){return _0x1925c6;});}return null;};}function removeEntity(_0x191836,_0x5f56ad){return function(_0x2b0eb5){if(_0x2b0eb5){return _0x2b0eb5[_0x694a('0x38')]()[_0x694a('0x22')](function(){var _0x39316c=_0x2b0eb5[_0x694a('0x39')]({'plain':!![]});var _0x446ffe=_0x694a('0x3a');return db[_0x694a('0x3b')]['destroy']({'where':{'type':_0x446ffe,'resourceId':_0x39316c['id']}})[_0x694a('0x22')](function(){return _0x2b0eb5;});})[_0x694a('0x22')](function(){_0x191836[_0x694a('0x2e')](0xcc)[_0x694a('0x2d')]();});}};}function handleEntityNotFound(_0x5c9a28,_0x5452a0){return function(_0x23721d){if(!_0x23721d){_0x5c9a28[_0x694a('0x3c')](0x194);}return _0x23721d;};}function handleError(_0x42da80,_0x564f6d){_0x564f6d=_0x564f6d||0x1f4;return function(_0x598930){logger[_0x694a('0x27')](_0x598930['stack']);if(_0x598930[_0x694a('0x3d')]){delete _0x598930[_0x694a('0x3d')];}_0x42da80[_0x694a('0x2e')](_0x564f6d)[_0x694a('0x3e')](_0x598930);};}exports[_0x694a('0x3f')]=function(_0x4230ec,_0x4fdca9){var _0x4fc068={'include':[{'model':db['Pause'],'as':_0x694a('0x40')}]},_0x11c210={},_0x3fa6e1={'count':0x0,'rows':[]};var _0x9e3497=_[_0x694a('0x41')](db[_0x694a('0x42')][_0x694a('0x43')],function(_0x415c48){return{'name':_0x415c48['fieldName'],'type':_0x415c48['type'][_0x694a('0x44')]};});_0x11c210[_0x694a('0x45')]=_[_0x694a('0x41')](_0x9e3497,_0x694a('0x3d'));_0x11c210[_0x694a('0x46')]=_[_0x694a('0x47')](_0x4230ec[_0x694a('0x46')]);_0x11c210[_0x694a('0x48')]=_[_0x694a('0x49')](_0x11c210[_0x694a('0x45')],_0x11c210[_0x694a('0x46')]);_0x4fc068[_0x694a('0x4a')]=_[_0x694a('0x49')](_0x11c210[_0x694a('0x45')],qs[_0x694a('0x4b')](_0x4230ec[_0x694a('0x46')][_0x694a('0x4b')]));_0x4fc068['attributes']=_0x4fc068['attributes'][_0x694a('0x4c')]?_0x4fc068[_0x694a('0x4a')]:_0x11c210[_0x694a('0x45')];if(!_0x4230ec[_0x694a('0x46')][_0x694a('0x4d')]('nolimit')){_0x4fc068[_0x694a('0x32')]=qs['limit'](_0x4230ec[_0x694a('0x46')][_0x694a('0x32')]);_0x4fc068[_0x694a('0x30')]=qs['offset'](_0x4230ec[_0x694a('0x46')]['offset']);}_0x4fc068[_0x694a('0x4e')]=qs[_0x694a('0x4f')](_0x4230ec[_0x694a('0x46')][_0x694a('0x4f')]);_0x4fc068['where']=qs[_0x694a('0x48')](_[_0x694a('0x50')](_0x4230ec[_0x694a('0x46')],_0x11c210[_0x694a('0x48')]),_0x9e3497);if(_0x4230ec[_0x694a('0x46')][_0x694a('0x51')]){_0x4fc068[_0x694a('0x52')]=_[_0x694a('0x53')](_0x4fc068['where'],{'$or':_['map'](_0x9e3497,function(_0x591ce8){if(_0x591ce8['type']!=='VIRTUAL'){var _0x4b3dcc={};_0x4b3dcc[_0x591ce8[_0x694a('0x3d')]]={'$like':'%'+_0x4230ec['query'][_0x694a('0x51')]+'%'};return _0x4b3dcc;}})});}_0x4fc068=_[_0x694a('0x53')]({},_0x4fc068,_0x4230ec[_0x694a('0x54')]);var _0xfd4033={'where':_0x4fc068[_0x694a('0x52')]};return db[_0x694a('0x42')]['count'](_0xfd4033)[_0x694a('0x22')](function(_0x5bb38c){_0x3fa6e1['count']=_0x5bb38c;if(_0x4230ec['query'][_0x694a('0x55')]){_0x4fc068['include']=[{'all':!![]}];}return db['FaxAccount'][_0x694a('0x56')](_0x4fc068);})[_0x694a('0x22')](function(_0x162a08){_0x3fa6e1[_0x694a('0x57')]=_0x162a08;return _0x3fa6e1;})[_0x694a('0x22')](respondWithFilteredResult(_0x4fdca9,_0x4fc068))[_0x694a('0x2c')](handleError(_0x4fdca9,null));};exports[_0x694a('0x58')]=function(_0xf722aa,_0x54dc09){var _0x5b0134={'raw':![],'where':{'id':_0xf722aa[_0x694a('0x59')]['id']},'include':[{'model':db[_0x694a('0x5a')],'as':_0x694a('0x40')}]},_0x34c3a5={};_0x34c3a5[_0x694a('0x45')]=_[_0x694a('0x47')](db[_0x694a('0x42')][_0x694a('0x43')]);_0x34c3a5['query']=_['keys'](_0xf722aa[_0x694a('0x46')]);_0x34c3a5[_0x694a('0x48')]=_[_0x694a('0x49')](_0x34c3a5[_0x694a('0x45')],_0x34c3a5[_0x694a('0x46')]);_0x5b0134[_0x694a('0x4a')]=_['intersection'](_0x34c3a5[_0x694a('0x45')],qs['fields'](_0xf722aa[_0x694a('0x46')][_0x694a('0x4b')]));_0x5b0134[_0x694a('0x4a')]=_0x5b0134[_0x694a('0x4a')][_0x694a('0x4c')]?_0x5b0134[_0x694a('0x4a')]:_0x34c3a5['model'];if(_0xf722aa[_0x694a('0x46')][_0x694a('0x55')]){_0x5b0134[_0x694a('0x5b')]=[{'all':!![]}];}_0x5b0134=_['merge']({},_0x5b0134,_0xf722aa[_0x694a('0x54')]);return db[_0x694a('0x42')][_0x694a('0x5c')](_0x5b0134)[_0x694a('0x22')](handleEntityNotFound(_0x54dc09,null))[_0x694a('0x22')](respondWithResult(_0x54dc09,null))[_0x694a('0x2c')](handleError(_0x54dc09,null));};exports[_0x694a('0x5d')]=function(_0x17e625,_0x45ccba){return db['FaxAccount'][_0x694a('0x5d')](_0x17e625[_0x694a('0x5e')],{})[_0x694a('0x22')](function(_0x446dcb){var _0x1b1f4b=_0x17e625[_0x694a('0x5f')]['get']({'plain':!![]});if(!_0x1b1f4b)throw new Error(_0x694a('0x60'));if(_0x1b1f4b[_0x694a('0x61')]===_0x694a('0x5f')){var _0x22d722=_0x446dcb[_0x694a('0x39')]({'plain':!![]});var _0x52e0ca=_0x694a('0x3a');return db[_0x694a('0x62')][_0x694a('0x5c')]({'where':{'name':_0x52e0ca,'userProfileId':_0x1b1f4b[_0x694a('0x63')]},'raw':!![]})[_0x694a('0x22')](function(_0x152818){if(_0x152818&&_0x152818['autoAssociation']===0x0){return db['UserProfileResource'][_0x694a('0x5d')]({'name':_0x22d722['name'],'resourceId':_0x22d722['id'],'type':_0x152818[_0x694a('0x3d')],'sectionId':_0x152818['id']},{})['then'](function(){return _0x446dcb;});}else{return _0x446dcb;}})['catch'](function(_0x453bed){logger[_0x694a('0x27')](_0x694a('0x64'),_0x453bed);throw _0x453bed;});}return _0x446dcb;})[_0x694a('0x22')](respondWithResult(_0x45ccba,0xc9))[_0x694a('0x2c')](handleError(_0x45ccba,null));};exports['update']=function(_0x5d8ee7,_0x435b90){if(_0x5d8ee7[_0x694a('0x5e')]['id']){delete _0x5d8ee7[_0x694a('0x5e')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x5d8ee7[_0x694a('0x59')]['id']},'include':[{'model':db[_0x694a('0x5a')],'as':_0x694a('0x40')}]})['then'](handleEntityNotFound(_0x435b90,null))['then'](saveUpdates(_0x5d8ee7['body'],null))[_0x694a('0x22')](respondWithResult(_0x435b90,null))['catch'](handleError(_0x435b90,null));};exports['destroy']=function(_0x2cb87e,_0x386035){return db['FaxAccount'][_0x694a('0x5c')]({'where':{'id':_0x2cb87e[_0x694a('0x59')]['id']}})['then'](handleEntityNotFound(_0x386035,null))[_0x694a('0x22')](removeEntity(_0x386035,null))[_0x694a('0x2c')](handleError(_0x386035,null));};exports['describe']=function(_0x3a5cc2,_0x4bd4ab){return db[_0x694a('0x42')][_0x694a('0x65')]()['then'](respondWithResult(_0x4bd4ab,null))[_0x694a('0x2c')](handleError(_0x4bd4ab,null));};exports[_0x694a('0x66')]=function(_0x4076e8,_0x288cbb,_0xe4a16f){if(_0x4076e8[_0x694a('0x5e')]['id']){delete _0x4076e8[_0x694a('0x5e')]['id'];}return db[_0x694a('0x42')][_0x694a('0x5c')]({'where':{'id':_0x4076e8[_0x694a('0x59')]['id']}})[_0x694a('0x22')](handleEntityNotFound(_0x288cbb,null))[_0x694a('0x22')](function(_0x3623dc){if(_0x3623dc){_0x4076e8[_0x694a('0x5e')][_0x694a('0x67')]=_0x3623dc['id'];return db['Disposition'][_0x694a('0x5d')](_0x4076e8['body']);}})[_0x694a('0x22')](respondWithResult(_0x288cbb,null))['catch'](handleError(_0x288cbb,null));};exports[_0x694a('0x68')]=function(_0x4dd293,_0x4139ab,_0x4d1e4d){var _0x56bf31={'raw':![],'where':{}};var _0x1e589e={};var _0x28f1dc={'count':0x0,'rows':[]};return db[_0x694a('0x42')][_0x694a('0x69')]({'where':{'id':_0x4dd293[_0x694a('0x59')]['id']}})[_0x694a('0x22')](handleEntityNotFound(_0x4139ab,null))['then'](function(_0x9f6113){if(_0x9f6113){_0x1e589e[_0x694a('0x45')]=_['keys'](db[_0x694a('0x6a')]['rawAttributes']);_0x1e589e[_0x694a('0x46')]=_[_0x694a('0x47')](_0x4dd293[_0x694a('0x46')]);_0x1e589e[_0x694a('0x48')]=_['intersection'](_0x1e589e[_0x694a('0x45')],_0x1e589e[_0x694a('0x46')]);_0x56bf31[_0x694a('0x4a')]=_[_0x694a('0x49')](_0x1e589e['model'],qs[_0x694a('0x4b')](_0x4dd293[_0x694a('0x46')]['fields']));_0x56bf31[_0x694a('0x4a')]=_0x56bf31['attributes'][_0x694a('0x4c')]?_0x56bf31[_0x694a('0x4a')]:_0x1e589e['model'];if(!_0x4dd293[_0x694a('0x46')][_0x694a('0x4d')](_0x694a('0x6b'))){_0x56bf31[_0x694a('0x32')]=qs[_0x694a('0x32')](_0x4dd293[_0x694a('0x46')]['limit']);_0x56bf31['offset']=qs[_0x694a('0x30')](_0x4dd293[_0x694a('0x46')][_0x694a('0x30')]);}_0x56bf31[_0x694a('0x4e')]=qs[_0x694a('0x4f')](_0x4dd293[_0x694a('0x46')]['sort']);_0x56bf31['where']=qs[_0x694a('0x48')](_[_0x694a('0x50')](_0x4dd293[_0x694a('0x46')],_0x1e589e[_0x694a('0x48')]));_0x56bf31[_0x694a('0x52')][_0x694a('0x67')]=_0x9f6113['id'];if(_0x4dd293['query']['filter']){_0x56bf31[_0x694a('0x52')]=_[_0x694a('0x53')](_0x56bf31[_0x694a('0x52')],{'$or':_['map'](_0x56bf31[_0x694a('0x4a')],function(_0x34e0d5){var _0x17d60b={};_0x17d60b[_0x34e0d5]={'$like':'%'+_0x4dd293[_0x694a('0x46')][_0x694a('0x51')]+'%'};return _0x17d60b;})});}_0x56bf31=_[_0x694a('0x53')]({},_0x56bf31,_0x4dd293['options']);return db[_0x694a('0x6a')][_0x694a('0x33')]({'where':_0x56bf31[_0x694a('0x52')]})['then'](function(_0xfcf2e8){_0x28f1dc[_0x694a('0x33')]=_0xfcf2e8;if(_0x4dd293['query']['includeAll']){_0x56bf31[_0x694a('0x5b')]=[{'all':!![]}];}return db[_0x694a('0x6a')]['findAll'](_0x56bf31);})[_0x694a('0x22')](function(_0x20d5fc){_0x28f1dc[_0x694a('0x57')]=_0x20d5fc;return _0x28f1dc;});}})['then'](respondWithFilteredResult(_0x4139ab,_0x56bf31))[_0x694a('0x2c')](handleError(_0x4139ab,null));};exports[_0x694a('0x6c')]=function(_0x2596a2,_0x23ac12,_0x1157c0){return db[_0x694a('0x42')][_0x694a('0x5c')]({'where':{'id':_0x2596a2[_0x694a('0x59')]['id']}})[_0x694a('0x22')](handleEntityNotFound(_0x23ac12,null))['then'](function(_0x9462c1){if(_0x9462c1){return _0x9462c1[_0x694a('0x6c')](_0x2596a2[_0x694a('0x46')][_0x694a('0x6d')]);}})['then'](respondWithStatusCode(_0x23ac12,null))[_0x694a('0x2c')](handleError(_0x23ac12,null));};exports[_0x694a('0x6e')]=function(_0x329f65,_0x237582,_0x21aa95){if(_0x329f65['body']['id']){delete _0x329f65[_0x694a('0x5e')]['id'];}return db[_0x694a('0x42')]['find']({'where':{'id':_0x329f65[_0x694a('0x59')]['id']}})[_0x694a('0x22')](handleEntityNotFound(_0x237582,null))[_0x694a('0x22')](function(_0x4d0b44){if(_0x4d0b44){_0x329f65[_0x694a('0x5e')]['FaxAccountId']=_0x4d0b44['id'];return db['CannedAnswer'][_0x694a('0x5d')](_0x329f65[_0x694a('0x5e')]);}})[_0x694a('0x22')](respondWithResult(_0x237582,null))[_0x694a('0x2c')](handleError(_0x237582,null));};exports[_0x694a('0x6f')]=function(_0x3317ef,_0x1283cf,_0x27515e){var _0x37049b={'raw':![],'where':{}};var _0x95df55={};var _0x19be76={'count':0x0,'rows':[]};return db[_0x694a('0x42')]['findOne']({'where':{'id':_0x3317ef[_0x694a('0x59')]['id']}})[_0x694a('0x22')](handleEntityNotFound(_0x1283cf,null))['then'](function(_0xd5e910){if(_0xd5e910){_0x95df55['model']=_[_0x694a('0x47')](db['CannedAnswer'][_0x694a('0x43')]);_0x95df55[_0x694a('0x46')]=_['keys'](_0x3317ef['query']);_0x95df55[_0x694a('0x48')]=_[_0x694a('0x49')](_0x95df55[_0x694a('0x45')],_0x95df55[_0x694a('0x46')]);_0x37049b[_0x694a('0x4a')]=_[_0x694a('0x49')](_0x95df55[_0x694a('0x45')],qs[_0x694a('0x4b')](_0x3317ef['query'][_0x694a('0x4b')]));_0x37049b['attributes']=_0x37049b['attributes'][_0x694a('0x4c')]?_0x37049b[_0x694a('0x4a')]:_0x95df55['model'];if(!_0x3317ef[_0x694a('0x46')][_0x694a('0x4d')](_0x694a('0x6b'))){_0x37049b[_0x694a('0x32')]=qs['limit'](_0x3317ef[_0x694a('0x46')][_0x694a('0x32')]);_0x37049b[_0x694a('0x30')]=qs[_0x694a('0x30')](_0x3317ef[_0x694a('0x46')][_0x694a('0x30')]);}_0x37049b[_0x694a('0x4e')]=qs[_0x694a('0x4f')](_0x3317ef['query'][_0x694a('0x4f')]);_0x37049b[_0x694a('0x52')]=qs['filters'](_['pick'](_0x3317ef[_0x694a('0x46')],_0x95df55['filters']));_0x37049b[_0x694a('0x52')][_0x694a('0x67')]=_0xd5e910['id'];if(_0x3317ef[_0x694a('0x46')][_0x694a('0x51')]){_0x37049b['where']=_[_0x694a('0x53')](_0x37049b[_0x694a('0x52')],{'$or':_[_0x694a('0x41')](_0x37049b[_0x694a('0x4a')],function(_0x179b1d){var _0x2553d6={};_0x2553d6[_0x179b1d]={'$like':'%'+_0x3317ef[_0x694a('0x46')]['filter']+'%'};return _0x2553d6;})});}_0x37049b=_[_0x694a('0x53')]({},_0x37049b,_0x3317ef[_0x694a('0x54')]);return db[_0x694a('0x70')][_0x694a('0x33')]({'where':_0x37049b[_0x694a('0x52')]})[_0x694a('0x22')](function(_0x1e7513){_0x19be76['count']=_0x1e7513;if(_0x3317ef[_0x694a('0x46')]['includeAll']){_0x37049b[_0x694a('0x5b')]=[{'all':!![]}];}return db[_0x694a('0x70')][_0x694a('0x56')](_0x37049b);})[_0x694a('0x22')](function(_0x11a93d){_0x19be76['rows']=_0x11a93d;return _0x19be76;});}})[_0x694a('0x22')](respondWithFilteredResult(_0x1283cf,_0x37049b))[_0x694a('0x2c')](handleError(_0x1283cf,null));};exports['removeAnswers']=function(_0x4300ae,_0x1e741d,_0x5cf520){return db['FaxAccount'][_0x694a('0x5c')]({'where':{'id':_0x4300ae[_0x694a('0x59')]['id']}})[_0x694a('0x22')](handleEntityNotFound(_0x1e741d,null))['then'](function(_0x155bed){if(_0x155bed){return _0x155bed[_0x694a('0x71')](_0x4300ae[_0x694a('0x46')]['ids']);}})['then'](respondWithStatusCode(_0x1e741d,null))[_0x694a('0x2c')](handleError(_0x1e741d,null));};exports[_0x694a('0x72')]=function(_0x1bd8fe,_0x3b9665,_0x16ca6a){return db['FaxInteraction'][_0x694a('0x5c')]({'where':{'id':_0x1bd8fe[_0x694a('0x59')]['id']}})[_0x694a('0x22')](handleEntityNotFound(_0x3b9665,null))[_0x694a('0x22')](function(_0x34126d){if(_0x34126d){return _0x34126d['addInteraction'](_0x1bd8fe['body']['ids'],_[_0x694a('0x73')](_0x1bd8fe['body'],[_0x694a('0x6d'),'id'])||{});}})['then'](respondWithResult(_0x3b9665,null))['catch'](handleError(_0x3b9665,null));};exports[_0x694a('0x74')]=function(_0x571348,_0x1842fb,_0xd8ee28){var _0x583c95={'raw':![],'where':{}};var _0x283b33={};var _0x13410e={'count':0x0,'rows':[]};return db[_0x694a('0x42')][_0x694a('0x69')]({'where':{'id':_0x571348[_0x694a('0x59')]['id']}})[_0x694a('0x22')](handleEntityNotFound(_0x1842fb,null))[_0x694a('0x22')](function(_0x597d26){if(_0x597d26){_0x283b33['model']=_[_0x694a('0x47')](db['FaxInteraction']['rawAttributes']);_0x283b33[_0x694a('0x46')]=_[_0x694a('0x47')](_0x571348[_0x694a('0x46')]);_0x283b33['filters']=_[_0x694a('0x49')](_0x283b33[_0x694a('0x45')],_0x283b33[_0x694a('0x46')]);_0x583c95[_0x694a('0x4a')]=_[_0x694a('0x49')](_0x283b33['model'],qs[_0x694a('0x4b')](_0x571348[_0x694a('0x46')][_0x694a('0x4b')]));_0x583c95['attributes']=_0x583c95[_0x694a('0x4a')][_0x694a('0x4c')]?_0x583c95[_0x694a('0x4a')]:_0x283b33[_0x694a('0x45')];if(!_0x571348[_0x694a('0x46')]['hasOwnProperty']('nolimit')){_0x583c95[_0x694a('0x32')]=qs['limit'](_0x571348[_0x694a('0x46')]['limit']);_0x583c95[_0x694a('0x30')]=qs[_0x694a('0x30')](_0x571348[_0x694a('0x46')][_0x694a('0x30')]);}_0x583c95[_0x694a('0x4e')]=qs[_0x694a('0x4f')](_0x571348[_0x694a('0x46')][_0x694a('0x4f')]);_0x583c95[_0x694a('0x52')]=qs[_0x694a('0x48')](_[_0x694a('0x50')](_0x571348['query'],_0x283b33[_0x694a('0x48')]));_0x583c95[_0x694a('0x52')]['FaxAccountId']=_0x597d26['id'];if(_0x571348[_0x694a('0x46')][_0x694a('0x51')]){_0x583c95[_0x694a('0x52')]=_[_0x694a('0x53')](_0x583c95['where'],{'$or':_[_0x694a('0x41')](_0x583c95[_0x694a('0x4a')],function(_0x392deb){var _0x261e3f={};_0x261e3f[_0x392deb]={'$like':'%'+_0x571348[_0x694a('0x46')][_0x694a('0x51')]+'%'};return _0x261e3f;})});}_0x583c95=_['merge']({},_0x583c95,_0x571348[_0x694a('0x54')]);return db['FaxInteraction'][_0x694a('0x33')]({'where':_0x583c95[_0x694a('0x52')]})['then'](function(_0x1cafee){_0x13410e['count']=_0x1cafee;if(_0x571348[_0x694a('0x46')]['includeAll']){_0x583c95[_0x694a('0x5b')]=[{'model':db[_0x694a('0x75')],'as':_0x694a('0x76'),'required':![]},{'model':db[_0x694a('0x77')],'as':_0x694a('0x78'),'attributes':['name',_0x694a('0x79'),_0x694a('0x7a')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x694a('0x3d'),'color'],'where':_0x571348[_0x694a('0x46')][_0x694a('0x7b')]?{'id':_0x571348[_0x694a('0x46')][_0x694a('0x7b')]}:undefined,'required':_0x571348['query']['tag']?!![]:![]}];}return db['FaxInteraction'][_0x694a('0x56')](_0x583c95);})[_0x694a('0x22')](function(_0x17251){_0x13410e['rows']=_0x17251;return _0x13410e;});}})[_0x694a('0x22')](respondWithFilteredResult(_0x1842fb,_0x583c95))[_0x694a('0x2c')](handleError(_0x1842fb,null));};exports['addApplications']=function(_0x432d7f,_0x1cc64f,_0xf26ece){return db[_0x694a('0x42')][_0x694a('0x69')]({'where':{'id':_0x432d7f[_0x694a('0x59')]['id']}})[_0x694a('0x22')](handleEntityNotFound(_0x1cc64f,null))[_0x694a('0x22')](function(_0x1be1d7){if(_0x1be1d7){return db[_0x694a('0x7c')][_0x694a('0x7d')](function(_0x5851a0){return db[_0x694a('0x7e')][_0x694a('0x38')]({'where':{'FaxAccountId':_0x432d7f[_0x694a('0x59')]['id']},'transaction':_0x5851a0})[_0x694a('0x22')](function(_0x389e45){var _0x5b17b8=_[_0x694a('0x41')](_0x432d7f[_0x694a('0x5e')],function(_0x268628){_0x268628[_0x694a('0x67')]=_0x432d7f[_0x694a('0x59')]['id'];return _0x268628;});return db[_0x694a('0x7e')][_0x694a('0x7f')](_0x5b17b8,{'transaction':_0x5851a0});});})[_0x694a('0x22')](function(){return db['FaxApplication'][_0x694a('0x80')]({'where':{'FaxAccountId':_0x432d7f['params']['id']},'order':'priority'});});}})[_0x694a('0x22')](respondWithResult(_0x1cc64f,null))[_0x694a('0x2c')](handleError(_0x1cc64f,null));};exports['getApplications']=function(_0x44b469,_0x5e9e1c,_0x2e2e72){var _0x2af295={};var _0x2975fc={};var _0x5bd34d;var _0x25f337;return db[_0x694a('0x42')]['findOne']({'where':{'id':_0x44b469[_0x694a('0x59')]['id']}})[_0x694a('0x22')](handleEntityNotFound(_0x5e9e1c,null))[_0x694a('0x22')](function(_0x1e828e){if(_0x1e828e){_0x5bd34d=_0x1e828e;_0x2975fc['model']=_['keys'](db['FaxApplication'][_0x694a('0x43')]);_0x2975fc[_0x694a('0x46')]=_[_0x694a('0x47')](_0x44b469[_0x694a('0x46')]);_0x2975fc['filters']=_[_0x694a('0x49')](_0x2975fc[_0x694a('0x45')],_0x2975fc[_0x694a('0x46')]);_0x2af295[_0x694a('0x4a')]=_[_0x694a('0x49')](_0x2975fc['model'],qs[_0x694a('0x4b')](_0x44b469[_0x694a('0x46')][_0x694a('0x4b')]));_0x2af295[_0x694a('0x4a')]=_0x2af295[_0x694a('0x4a')]['length']?_0x2af295[_0x694a('0x4a')]:_0x2975fc[_0x694a('0x45')];_0x2af295[_0x694a('0x4e')]=qs[_0x694a('0x4f')](_0x44b469[_0x694a('0x46')][_0x694a('0x4f')]);_0x2af295[_0x694a('0x52')]=qs[_0x694a('0x48')](_[_0x694a('0x50')](_0x44b469[_0x694a('0x46')],_0x2975fc[_0x694a('0x48')]));if(_0x44b469[_0x694a('0x46')][_0x694a('0x51')]){_0x2af295[_0x694a('0x52')]=_[_0x694a('0x53')](_0x2af295[_0x694a('0x52')],{'$or':_[_0x694a('0x41')](_0x2af295[_0x694a('0x4a')],function(_0x54241b){var _0x2f8c64={};_0x2f8c64[_0x54241b]={'$like':'%'+_0x44b469[_0x694a('0x46')][_0x694a('0x51')]+'%'};return _0x2f8c64;})});}_0x2af295=_[_0x694a('0x53')]({},_0x2af295,_0x44b469['options']);return _0x5bd34d['getApplications'](_0x2af295);}})['then'](function(_0x4b3293){if(_0x4b3293){_0x25f337=_0x4b3293['length'];if(!_0x44b469[_0x694a('0x46')][_0x694a('0x4d')](_0x694a('0x6b'))){_0x2af295['limit']=qs[_0x694a('0x32')](_0x44b469[_0x694a('0x46')]['limit']);_0x2af295[_0x694a('0x30')]=qs[_0x694a('0x30')](_0x44b469[_0x694a('0x46')][_0x694a('0x30')]);}return _0x5bd34d[_0x694a('0x81')](_0x2af295);}})[_0x694a('0x22')](function(_0x3f5b6f){if(_0x3f5b6f){return _0x3f5b6f?{'count':_0x25f337,'rows':_0x3f5b6f}:null;}})['then'](respondWithResult(_0x5e9e1c,null))['catch'](handleError(_0x5e9e1c,null));};function Extension(_0x590a77,_0x3b4191,_0x491c60,_0x5eefa9){this[_0x694a('0x82')]=_0x694a('0x83');this[_0x694a('0x84')]=_0x590a77[_0x694a('0x85')];this['app']=_0x5eefa9;this['type']=_0x694a('0x86');this[_0x694a('0x87')]=_0x694a('0x88');this['FaxAccountId']=_0x590a77['id'];this[_0x694a('0x89')]=_0x3b4191;this[_0x694a('0x8a')]=_0x491c60;}function createExtensionsReciveFax(_0x50a5bd){var _0x4e5944=0x1;var _0x1da1c3=[];_0x1da1c3[_0x694a('0x8b')](new Extension(_0x50a5bd,_0x4e5944,'',_0x694a('0x8c')));_0x4e5944+=0x1;_0x1da1c3['push'](new Extension(_0x50a5bd,_0x4e5944,_0x694a('0x8d'),_0x694a('0x8e')));_0x4e5944+=0x1;for(var _0x24f754 in _0x50a5bd){if(_0x50a5bd[_0x694a('0x4d')](_0x24f754)&&(_0x24f754==='ecm'||_0x24f754==='localstationid'||_0x24f754==='gateway'||_0x24f754===_0x694a('0x8f')||_0x24f754==='headerinfo'||_0x24f754===_0x694a('0x90')||_0x24f754===_0x694a('0x91')||_0x24f754==='modem'||_0x24f754===_0x694a('0x92'))){_0x1da1c3[_0x694a('0x8b')](new Extension(_0x50a5bd,_0x4e5944,_0x694a('0x93')+_0x24f754+')='+_0x50a5bd[_0x24f754],_0x694a('0x8e')));_0x4e5944+=0x1;}}_0x1da1c3['push'](new Extension(_0x50a5bd,_0x4e5944,'6',_0x694a('0x94')));_0x4e5944+=0x1;_0x1da1c3['push'](new Extension(_0x50a5bd,_0x4e5944,_0x694a('0x95'),_0x694a('0x96')));_0x4e5944=0x0;return _0x1da1c3;}exports['addAccountApplications']=function(_0x557224,_0xd56059,_0x25f862){var _0xd84be2;return db[_0x694a('0x7c')][_0x694a('0x7d')](function(_0x46d793){return db[_0x694a('0x42')][_0x694a('0x5d')](_0x557224[_0x694a('0x5e')],{'transaction':_0x46d793})[_0x694a('0x22')](function(_0x4c22c3){_0xd84be2=_0x4c22c3[_0x694a('0x39')]({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0xd84be2),{'transaction':_0x46d793});});})[_0x694a('0x22')](function(){return _0xd84be2;})[_0x694a('0x22')](respondWithResult(_0xd56059,null))[_0x694a('0x2c')](handleError(_0xd56059,null));};exports['updateAccountApplications']=function(_0x3d292a,_0x2aef90,_0x3309a7){var _0x86bec2;return db[_0x694a('0x7c')][_0x694a('0x7d')](function(_0x116f66){return db[_0x694a('0x42')][_0x694a('0x37')](_0x3d292a[_0x694a('0x5e')],{'where':{'id':_0x3d292a['body']['id']},'transaction':_0x116f66})[_0x694a('0x22')](function(_0x543bd9){return db[_0x694a('0x97')][_0x694a('0x38')]({'where':{'FaxAccountId':_0x3d292a[_0x694a('0x5e')]['id']},'transaction':_0x116f66})[_0x694a('0x22')](function(_0x37cc4a){return db[_0x694a('0x97')][_0x694a('0x7f')](createExtensionsReciveFax(_['omit'](_0x3d292a['body'],[_0x694a('0x98'),_0x694a('0x44'),'createdAt',_0x694a('0x99'),_0x694a('0x9a'),_0x694a('0x9b')])),{'transaction':_0x116f66});});});})[_0x694a('0x22')](function(){return db[_0x694a('0x42')][_0x694a('0x9c')](_0x3d292a[_0x694a('0x5e')]['id']);})[_0x694a('0x22')](respondWithResult(_0x2aef90,null))[_0x694a('0x2c')](handleError(_0x2aef90,null));};exports[_0x694a('0x9d')]=function(_0x530bb0,_0x54867a,_0x3885b5){var _0x4bf66d={'raw':!![],'where':{}};var _0x5208e7={};var _0x59a6cb={'count':0x0,'rows':[]};return db[_0x694a('0x42')][_0x694a('0x69')]({'where':{'id':_0x530bb0[_0x694a('0x59')]['id']}})['then'](handleEntityNotFound(_0x54867a,null))[_0x694a('0x22')](function(_0xf590f8){if(_0xf590f8){_0x5208e7[_0x694a('0x45')]=_['keys'](db[_0x694a('0x9e')][_0x694a('0x43')]);_0x5208e7[_0x694a('0x46')]=_['keys'](_0x530bb0[_0x694a('0x46')]);_0x5208e7[_0x694a('0x48')]=_[_0x694a('0x49')](_0x5208e7[_0x694a('0x45')],_0x5208e7[_0x694a('0x46')]);_0x4bf66d[_0x694a('0x4a')]=_[_0x694a('0x49')](_0x5208e7[_0x694a('0x45')],qs['fields'](_0x530bb0['query'][_0x694a('0x4b')]));_0x4bf66d[_0x694a('0x4a')]=_0x4bf66d[_0x694a('0x4a')][_0x694a('0x4c')]?_0x4bf66d[_0x694a('0x4a')]:_0x5208e7[_0x694a('0x45')];if(!_0x530bb0[_0x694a('0x46')][_0x694a('0x4d')]('nolimit')){_0x4bf66d[_0x694a('0x32')]=qs[_0x694a('0x32')](_0x530bb0[_0x694a('0x46')][_0x694a('0x32')]);_0x4bf66d[_0x694a('0x30')]=qs[_0x694a('0x30')](_0x530bb0[_0x694a('0x46')][_0x694a('0x30')]);}_0x4bf66d[_0x694a('0x4e')]=qs[_0x694a('0x4f')](_0x530bb0[_0x694a('0x46')][_0x694a('0x4f')]);_0x4bf66d[_0x694a('0x52')]=qs[_0x694a('0x48')](_['pick'](_0x530bb0[_0x694a('0x46')],_0x5208e7[_0x694a('0x48')]));_0x4bf66d[_0x694a('0x52')][_0x694a('0x67')]=_0xf590f8['id'];if(_0x530bb0[_0x694a('0x46')]['filter']){_0x4bf66d[_0x694a('0x52')]=_[_0x694a('0x53')](_0x4bf66d[_0x694a('0x52')],{'$or':_['map'](_0x4bf66d[_0x694a('0x4a')],function(_0x103ae9){var _0x578f14={};_0x578f14[_0x103ae9]={'$like':'%'+_0x530bb0['query']['filter']+'%'};return _0x578f14;})});}if(_0x530bb0[_0x694a('0x46')][_0x694a('0x9f')]){var _0x1072b1=_0x530bb0[_0x694a('0x46')]['$gte'][_0x694a('0xa0')](',');var _0x2531eb={};_0x2531eb[_0x1072b1[0x0]]={'$gte':moment(_0x1072b1[0x1])[_0x694a('0xa1')](_0x694a('0xa2'))};_0x4bf66d[_0x694a('0x52')]=_[_0x694a('0x53')](_0x4bf66d[_0x694a('0x52')],_0x2531eb);}_0x4bf66d=_[_0x694a('0x53')]({},_0x4bf66d,_0x530bb0['options']);return db[_0x694a('0x9e')][_0x694a('0x33')]({'where':_0x4bf66d[_0x694a('0x52')]})[_0x694a('0x22')](function(_0x34cb3e){_0x59a6cb[_0x694a('0x33')]=_0x34cb3e;if(_0x530bb0[_0x694a('0x46')][_0x694a('0x55')]){_0x4bf66d[_0x694a('0x5b')]=[{'all':!![]}];}return db[_0x694a('0x9e')][_0x694a('0x56')](_0x4bf66d);})[_0x694a('0x22')](function(_0x2f462){_0x59a6cb[_0x694a('0x57')]=_0x2f462;return _0x59a6cb;});}})[_0x694a('0x22')](respondWithFilteredResult(_0x54867a,_0x4bf66d))['catch'](handleError(_0x54867a,null));};exports[_0x694a('0x3e')]=function(_0x13d0d4,_0x4d0d10,_0x5a419d){var _0x593ef3,_0x34d01a={},_0x3fe0ef;if(_0x13d0d4[_0x694a('0x5e')]['to']){_0x3fe0ef=_0x13d0d4[_0x694a('0x5e')]['to'][0x0];}return db[_0x694a('0x42')][_0x694a('0x5c')]({'where':{'id':_0x13d0d4[_0x694a('0x59')]['id']},'include':[{'model':db[_0x694a('0xa3')],'as':'List','include':[{'model':db[_0x694a('0x75')],'as':'Contacts','where':{'fax':_0x3fe0ef},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})['then'](handleEntityNotFound(_0x4d0d10,null))[_0x694a('0x22')](function(_0x48ce2d){_0x593ef3=_0x48ce2d;if(_0x13d0d4['body']['attachments']&&_0x13d0d4[_0x694a('0x5e')][_0x694a('0xa4')][_0x694a('0x4c')]){for(var _0x4f9ff1=0x0;_0x4f9ff1<_0x13d0d4[_0x694a('0x5e')][_0x694a('0xa4')][_0x694a('0x4c')];_0x4f9ff1+=0x1){_0x13d0d4[_0x694a('0x5e')][_0x694a('0xa4')][_0x4f9ff1]={'filename':_0x13d0d4['body']['attachments'][_0x4f9ff1][_0x694a('0x3d')],'id':_0x13d0d4[_0x694a('0x5e')][_0x694a('0xa4')][_0x4f9ff1]['id'],'path':path['join'](config[_0x694a('0xa5')],_0x694a('0xa6'),_0x13d0d4['body']['attachments'][_0x4f9ff1][_0x694a('0xa7')])};}}return respondWithRpcPromise('CheckAfterSend',_0x694a('0xa8'),{'FaxAccountId':_['isNil'](_0x13d0d4[_0x694a('0x59')]['id'])?undefined:_0x13d0d4[_0x694a('0x59')]['id'],'path':_[_0x694a('0xa9')](_0x13d0d4[_0x694a('0x5e')]['attachments'][0x0][_0x694a('0x8')])?undefined:_0x13d0d4[_0x694a('0x5e')][_0x694a('0xa4')][0x0][_0x694a('0x8')],'fax':_['isNil'](_0x13d0d4['body']['to'][0x0])?undefined:_0x13d0d4[_0x694a('0x5e')]['to'][0x0]},client9002);})[_0x694a('0x22')](function(){if(_0x593ef3){if(_[_0x694a('0xa9')](_0x13d0d4[_0x694a('0x5e')]['from'])){_0x13d0d4[_0x694a('0x5e')][_0x694a('0xaa')]=util['format']('\x22%s\x22\x20<%s>',_0x593ef3[_0x694a('0x3d')],_0x593ef3[_0x694a('0xab')]);}if(_0x593ef3[_0x694a('0xac')]){if(_0x593ef3[_0x694a('0xac')][_0x694a('0xad')]['length']){return _0x593ef3[_0x694a('0xac')][_0x694a('0xad')][0x0];}else{return db[_0x694a('0x75')][_0x694a('0x5d')](_[_0x694a('0x19')](_0x13d0d4[_0x694a('0x5e')],{'firstName':_0x13d0d4[_0x694a('0x5e')]['to'][0x0],'phone':_0x13d0d4['body']['to'][0x0],'fax':_0x13d0d4[_0x694a('0x5e')]['to'][0x0],'ListId':_0x593ef3['ListId']}));}}else{throw new Error(_0x694a('0xae'));}}else{throw new Error(_0x694a('0xaf'));}})[_0x694a('0x22')](function(_0x1c405e){if(_0x1c405e){return db[_0x694a('0xb0')]['find']({'where':{'ContactId':_0x1c405e['id'],'closed':![],'FaxAccountId':_0x593ef3['id']}})[_0x694a('0x22')](function(_0x585141){if(_0x585141){return[_0x585141,![]];}return db[_0x694a('0xb0')][_0x694a('0x5d')]({'UserId':_0x13d0d4[_0x694a('0x5f')]['id'],'ContactId':_0x1c405e['id'],'FaxAccountId':_0x593ef3['id'],'fax':_0x13d0d4[_0x694a('0x5e')]['to'][0x0],'firstMsgDirection':_0x694a('0xb1'),'Messages':[_['merge'](_0x13d0d4['body'],{'read':![],'body':_0x13d0d4[_0x694a('0x5e')][_0x694a('0xa4')][0x0]['filename'],'FaxAccountId':_0x593ef3['id'],'UserId':_0x13d0d4['user']['id'],'ContactId':_0x1c405e['id'],'AttachmentId':_0x13d0d4[_0x694a('0x5e')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x694a('0x9e')],'as':'Messages'}]})[_0x694a('0x22')](function(_0xa83b06){return[_0xa83b06,!![]];});});}else{throw new Error(_0x694a('0xb2'));}})[_0x694a('0xb3')](function(_0x43a405,_0x2c489a){if(_0x2c489a){return _0x43a405;}return db[_0x694a('0x9e')][_0x694a('0x5d')]({'direction':_0x694a('0xb1'),'read':![],'body':_0x13d0d4['body'][_0x694a('0xa4')][0x0][_0x694a('0xb4')],'FaxAccountId':_0x593ef3['id'],'FaxInteractionId':_0x43a405['id'],'UserId':_0x13d0d4[_0x694a('0x5f')]['id'],'ContactId':_0x43a405[_0x694a('0xb5')],'AttachmentId':_0x13d0d4['body'][_0x694a('0xa4')][0x0]['id']})[_0x694a('0x22')](function(_0x693c36){_0x43a405[_0x694a('0xb6')][_0x694a('0xb7')]=[];_0x43a405[_0x694a('0xb6')][_0x694a('0xb7')][_0x694a('0x8b')](_0x693c36[_0x694a('0xb6')]);return _0x43a405;});})[_0x694a('0x22')](function(_0x5708b9){respondWithRpcPromise(_0x694a('0xb8'),'SendFax',{'FaxAccountId':_['isNil'](_0x13d0d4[_0x694a('0x59')]['id'])?undefined:_0x13d0d4['params']['id'],'path':_[_0x694a('0xa9')](_0x13d0d4[_0x694a('0x5e')][_0x694a('0xa4')][0x0][_0x694a('0x8')])?undefined:_0x13d0d4[_0x694a('0x5e')][_0x694a('0xa4')][0x0][_0x694a('0x8')],'fax':_[_0x694a('0xa9')](_0x13d0d4['body']['to'][0x0])?undefined:_0x13d0d4['body']['to'][0x0],'AttachmentId':_0x13d0d4[_0x694a('0x5e')][_0x694a('0xa4')][0x0]['id']},client9002)['then'](function(_0x5e4460){logger[_0x694a('0x23')](_0x694a('0xb9'),_0x5e4460);})['catch'](function(_0x11d2f7){logger[_0x694a('0x23')](_0x694a('0xb9'),_0x11d2f7);});return _0x5708b9;})[_0x694a('0x22')](respondWithResult(_0x4d0d10,null))[_0x694a('0x2c')](handleError(_0x4d0d10,null));};exports[_0x694a('0xba')]=function(_0x5ea744,_0x3bd2b5,_0x40cb0d){return db[_0x694a('0x42')][_0x694a('0x5c')]({'where':{'id':_0x5ea744[_0x694a('0x59')]['id']}})[_0x694a('0x22')](handleEntityNotFound(_0x3bd2b5,null))['then'](function(_0x5a7ad1){if(_0x5a7ad1){return _0x5a7ad1[_0x694a('0xba')](_0x5ea744[_0x694a('0x5e')]['ids'],_[_0x694a('0x73')](_0x5ea744['body'],[_0x694a('0x6d'),'id'])||{})[_0x694a('0xb3')](function(_0xad37){for(var _0x47ef1e=0x0;_0x47ef1e<_0x5ea744[_0x694a('0x5e')]['ids'][_0x694a('0x4c')];_0x47ef1e+=0x1){socket[_0x694a('0xbb')](_0x694a('0xbc'),{'UserId':Number(_0x5ea744['body'][_0x694a('0x6d')][_0x47ef1e]),'FaxAccountId':Number(_0x5ea744['params']['id'])});}return _0xad37;});}})[_0x694a('0x22')](respondWithResult(_0x3bd2b5,null))[_0x694a('0x2c')](handleError(_0x3bd2b5,null));};exports[_0x694a('0xbd')]=function(_0x55818d,_0x25a0bf,_0x474c2f){return db['FaxAccount']['find']({'where':{'id':_0x55818d[_0x694a('0x59')]['id']}})['then'](handleEntityNotFound(_0x25a0bf,null))[_0x694a('0x22')](function(_0x32a5a7){if(_0x32a5a7){return _0x32a5a7[_0x694a('0xbd')](_0x55818d['query'][_0x694a('0x6d')])[_0x694a('0x22')](function(){if(_[_0x694a('0xbe')](_0x55818d[_0x694a('0x46')]['ids'])){for(var _0x1950c0=0x0;_0x1950c0<_0x55818d[_0x694a('0x46')][_0x694a('0x6d')][_0x694a('0x4c')];_0x1950c0+=0x1){socket['emit'](_0x694a('0xbf'),{'UserId':Number(_0x55818d[_0x694a('0x46')]['ids'][_0x1950c0]),'FaxAccountId':Number(_0x55818d['params']['id'])});}}else{socket['emit'](_0x694a('0xbf'),{'UserId':Number(_0x55818d[_0x694a('0x46')][_0x694a('0x6d')]),'FaxAccountId':Number(_0x55818d[_0x694a('0x59')]['id'])});}});}})[_0x694a('0x22')](respondWithStatusCode(_0x25a0bf,null))[_0x694a('0x2c')](handleError(_0x25a0bf,null));};exports['getAgents']=function(_0x2f8085,_0x1e421d,_0x49e27f){var _0x2e733d={};var _0x44a6d6={};var _0x4ab0b6;var _0x291b07;return db[_0x694a('0x42')]['findOne']({'where':{'id':_0x2f8085[_0x694a('0x59')]['id']}})['then'](handleEntityNotFound(_0x1e421d,null))[_0x694a('0x22')](function(_0x4631db){if(_0x4631db){_0x4ab0b6=_0x4631db;_0x44a6d6[_0x694a('0x45')]=_['keys'](db[_0x694a('0x77')][_0x694a('0x43')]);_0x44a6d6[_0x694a('0x46')]=_[_0x694a('0x47')](_0x2f8085[_0x694a('0x46')]);_0x44a6d6[_0x694a('0x48')]=_[_0x694a('0x49')](_0x44a6d6[_0x694a('0x45')],_0x44a6d6[_0x694a('0x46')]);_0x2e733d['attributes']=_[_0x694a('0x49')](_0x44a6d6[_0x694a('0x45')],qs['fields'](_0x2f8085['query'][_0x694a('0x4b')]));_0x2e733d[_0x694a('0x4a')]=_0x2e733d[_0x694a('0x4a')][_0x694a('0x4c')]?_0x2e733d['attributes']:_0x44a6d6['model'];_0x2e733d[_0x694a('0x4e')]=qs[_0x694a('0x4f')](_0x2f8085[_0x694a('0x46')][_0x694a('0x4f')]);_0x2e733d[_0x694a('0x52')]=qs[_0x694a('0x48')](_[_0x694a('0x50')](_0x2f8085['query'],_0x44a6d6[_0x694a('0x48')]));if(_0x2f8085[_0x694a('0x46')][_0x694a('0x51')]){_0x2e733d[_0x694a('0x52')]=_[_0x694a('0x53')](_0x2e733d[_0x694a('0x52')],{'$or':_[_0x694a('0x41')](_0x2e733d[_0x694a('0x4a')],function(_0x246f47){var _0x19b4bc={};_0x19b4bc[_0x246f47]={'$like':'%'+_0x2f8085[_0x694a('0x46')]['filter']+'%'};return _0x19b4bc;})});}_0x2e733d=_[_0x694a('0x53')]({},_0x2e733d,_0x2f8085[_0x694a('0x54')]);return _0x4ab0b6[_0x694a('0xc0')](_0x2e733d);}})[_0x694a('0x22')](function(_0x5e35c3){if(_0x5e35c3){_0x291b07=_0x5e35c3['length'];if(!_0x2f8085['query'][_0x694a('0x4d')]('nolimit')){_0x2e733d[_0x694a('0x32')]=qs[_0x694a('0x32')](_0x2f8085[_0x694a('0x46')][_0x694a('0x32')]);_0x2e733d[_0x694a('0x30')]=qs[_0x694a('0x30')](_0x2f8085[_0x694a('0x46')][_0x694a('0x30')]);}return _0x4ab0b6[_0x694a('0xc0')](_0x2e733d);}})[_0x694a('0x22')](function(_0x5a424d){if(_0x5a424d){return _0x5a424d?{'count':_0x291b07,'rows':_0x5a424d}:null;}})['then'](respondWithResult(_0x1e421d,null))[_0x694a('0x2c')](handleError(_0x1e421d,null));}; \ No newline at end of file +var _0xd911=['sort','where','pick','merge','VIRTUAL','filter','count','includeAll','include','findAll','rows','show','mandatoryDispositionPause','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','userProfileId','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','length','nolimit','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','omit','FaxInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','findOne','sequelize','transaction','FaxApplication','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','app','system','description','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','faxdetect','headerinfo','modem','t38timeout','FAXOPT(','Wait','ReceiveFax','addAccountApplications','VoiceExtension','bulkCreate','key','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','send','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','fax','filename','Messages','spread','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','register','jayson/promise','client','http','request','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','FaxAccounts','UserProfileResource','destroy','stack','name','index','Pause','FaxAccount','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd911,0x13c));var _0x1d91=function(_0x3071ab,_0x574a59){_0x3071ab=_0x3071ab-0x0;var _0x2f458c=_0xd911[_0x3071ab];return _0x2f458c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1d91('0x0'));var zipdir=require(_0x1d91('0x1'));var jsonpatch=require(_0x1d91('0x2'));var rp=require(_0x1d91('0x3'));var moment=require(_0x1d91('0x4'));var BPromise=require(_0x1d91('0x5'));var Mustache=require(_0x1d91('0x6'));var util=require(_0x1d91('0x7'));var path=require(_0x1d91('0x8'));var sox=require(_0x1d91('0x9'));var csv=require(_0x1d91('0xa'));var ejs=require(_0x1d91('0xb'));var fs=require('fs');var fs_extra=require(_0x1d91('0xc'));var _=require(_0x1d91('0xd'));var squel=require(_0x1d91('0xe'));var crypto=require(_0x1d91('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x1d91('0x10'));var toCsv=require(_0x1d91('0xa'));var querystring=require(_0x1d91('0x11'));var Papa=require(_0x1d91('0x12'));var Redis=require(_0x1d91('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x1d91('0x14'));var as=require(_0x1d91('0x15'));var hardwareService=require(_0x1d91('0x16'));var logger=require(_0x1d91('0x17'))(_0x1d91('0x18'));var utils=require('../../config/utils');var config=require(_0x1d91('0x19'));var licenseUtil=require(_0x1d91('0x1a'));var db=require('../../mysqldb')['db'];config[_0x1d91('0x1b')]=_[_0x1d91('0x1c')](config[_0x1d91('0x1b')],{'host':_0x1d91('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1d91('0x1b')]));require('./faxAccount.socket')[_0x1d91('0x1e')](socket);var jayson=require(_0x1d91('0x1f'));var client=jayson[_0x1d91('0x20')][_0x1d91('0x21')]({'port':0x232c});var client9002=jayson[_0x1d91('0x20')][_0x1d91('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x248fd3,_0x568b28,_0x2f11e8,_0x2d764c){return new BPromise(function(_0xe89739,_0x25ebad){var _0x30f6f2=_0x2d764c||client;return _0x30f6f2[_0x1d91('0x22')](_0x248fd3,_0x2f11e8)['then'](function(_0x5cfa7d){logger[_0x1d91('0x23')]('FaxAccount,\x20%s,\x20%s',_0x568b28,_0x1d91('0x24'));logger[_0x1d91('0x25')](_0x1d91('0x26'),_0x568b28,'request\x20sent',JSON[_0x1d91('0x27')](_0x5cfa7d));if(_0x5cfa7d[_0x1d91('0x28')]){if(_0x5cfa7d[_0x1d91('0x28')][_0x1d91('0x29')]===0x1f4){logger[_0x1d91('0x28')](_0x1d91('0x2a'),_0x568b28,_0x5cfa7d['error']['message']);return _0x25ebad(_0x5cfa7d[_0x1d91('0x28')][_0x1d91('0x2b')]);}logger['error'](_0x1d91('0x2a'),_0x568b28,_0x5cfa7d[_0x1d91('0x28')][_0x1d91('0x2b')]);return _0xe89739(_0x5cfa7d[_0x1d91('0x28')][_0x1d91('0x2b')]);}else{logger[_0x1d91('0x23')](_0x1d91('0x2a'),_0x568b28,_0x1d91('0x24'));_0xe89739(_0x5cfa7d[_0x1d91('0x2c')][_0x1d91('0x2b')]);}})['catch'](function(_0x44ccbf){logger[_0x1d91('0x28')]('FaxAccount,\x20%s,\x20%s',_0x568b28,_0x44ccbf);_0x25ebad(_0x44ccbf);});});}function respondWithStatusCode(_0x2b2d74,_0x41ec3a){_0x41ec3a=_0x41ec3a||0xcc;return function(_0x3590d9){if(_0x3590d9){return _0x2b2d74[_0x1d91('0x2d')](_0x41ec3a);}return _0x2b2d74['status'](_0x41ec3a)['end']();};}function respondWithResult(_0x91c189,_0x1a42f0){_0x1a42f0=_0x1a42f0||0xc8;return function(_0x5d7151){if(_0x5d7151){return _0x91c189[_0x1d91('0x2e')](_0x1a42f0)[_0x1d91('0x2f')](_0x5d7151);}};}function respondWithFilteredResult(_0x2d50ca,_0xf3a0ae){return function(_0x3bf5c6){if(_0x3bf5c6){var _0x5582b7=typeof _0xf3a0ae[_0x1d91('0x30')]===_0x1d91('0x31')&&typeof _0xf3a0ae[_0x1d91('0x32')]===_0x1d91('0x31');var _0x1989ef=_0x3bf5c6['count'];var _0x2cd21f=_0x5582b7?0x0:_0xf3a0ae['offset'];var _0x1bb335=_0x5582b7?_0x3bf5c6['count']:_0xf3a0ae[_0x1d91('0x30')]+_0xf3a0ae[_0x1d91('0x32')];var _0x4bf894;if(_0x1bb335>=_0x1989ef){_0x1bb335=_0x1989ef;_0x4bf894=0xc8;}else{_0x4bf894=0xce;}_0x2d50ca[_0x1d91('0x2e')](_0x4bf894);return _0x2d50ca[_0x1d91('0x33')](_0x1d91('0x34'),_0x2cd21f+'-'+_0x1bb335+'/'+_0x1989ef)['json'](_0x3bf5c6);}return null;};}function patchUpdates(_0x1fc9ac){return function(_0x54db2d){try{jsonpatch[_0x1d91('0x35')](_0x54db2d,_0x1fc9ac,!![]);}catch(_0x487952){return BPromise['reject'](_0x487952);}return _0x54db2d[_0x1d91('0x36')]();};}function saveUpdates(_0x4cb554,_0x4399d6){return function(_0x356402){if(_0x356402){return _0x356402[_0x1d91('0x37')](_0x4cb554)['then'](function(_0x9793e){return _0x9793e;});}return null;};}function removeEntity(_0x2460bd,_0x446e6f){return function(_0x37bfed){if(_0x37bfed){return _0x37bfed['destroy']()[_0x1d91('0x38')](function(){var _0x843880=_0x37bfed['get']({'plain':!![]});var _0x2ce433=_0x1d91('0x39');return db[_0x1d91('0x3a')][_0x1d91('0x3b')]({'where':{'type':_0x2ce433,'resourceId':_0x843880['id']}})[_0x1d91('0x38')](function(){return _0x37bfed;});})[_0x1d91('0x38')](function(){_0x2460bd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x36d276,_0x47c189){return function(_0x1cb4ce){if(!_0x1cb4ce){_0x36d276['sendStatus'](0x194);}return _0x1cb4ce;};}function handleError(_0x3677fe,_0x3a77c6){_0x3a77c6=_0x3a77c6||0x1f4;return function(_0x5dfb88){logger[_0x1d91('0x28')](_0x5dfb88[_0x1d91('0x3c')]);if(_0x5dfb88[_0x1d91('0x3d')]){delete _0x5dfb88[_0x1d91('0x3d')];}_0x3677fe['status'](_0x3a77c6)['send'](_0x5dfb88);};}exports[_0x1d91('0x3e')]=function(_0x320c78,_0x4942a7){var _0x4526b2={'include':[{'model':db[_0x1d91('0x3f')],'as':'mandatoryDispositionPause'}]},_0xc0c035={},_0x54c69e={'count':0x0,'rows':[]};var _0x326b51=_['map'](db[_0x1d91('0x40')][_0x1d91('0x41')],function(_0x97fec9){return{'name':_0x97fec9[_0x1d91('0x42')],'type':_0x97fec9[_0x1d91('0x43')]['key']};});_0xc0c035['model']=_[_0x1d91('0x44')](_0x326b51,_0x1d91('0x3d'));_0xc0c035[_0x1d91('0x45')]=_[_0x1d91('0x46')](_0x320c78[_0x1d91('0x45')]);_0xc0c035[_0x1d91('0x47')]=_[_0x1d91('0x48')](_0xc0c035[_0x1d91('0x49')],_0xc0c035[_0x1d91('0x45')]);_0x4526b2[_0x1d91('0x4a')]=_[_0x1d91('0x48')](_0xc0c035[_0x1d91('0x49')],qs[_0x1d91('0x4b')](_0x320c78[_0x1d91('0x45')][_0x1d91('0x4b')]));_0x4526b2[_0x1d91('0x4a')]=_0x4526b2[_0x1d91('0x4a')]['length']?_0x4526b2[_0x1d91('0x4a')]:_0xc0c035['model'];if(!_0x320c78[_0x1d91('0x45')][_0x1d91('0x4c')]('nolimit')){_0x4526b2[_0x1d91('0x32')]=qs[_0x1d91('0x32')](_0x320c78[_0x1d91('0x45')]['limit']);_0x4526b2['offset']=qs[_0x1d91('0x30')](_0x320c78[_0x1d91('0x45')][_0x1d91('0x30')]);}_0x4526b2[_0x1d91('0x4d')]=qs['sort'](_0x320c78['query'][_0x1d91('0x4e')]);_0x4526b2[_0x1d91('0x4f')]=qs[_0x1d91('0x47')](_[_0x1d91('0x50')](_0x320c78['query'],_0xc0c035[_0x1d91('0x47')]),_0x326b51);if(_0x320c78[_0x1d91('0x45')]['filter']){_0x4526b2[_0x1d91('0x4f')]=_[_0x1d91('0x51')](_0x4526b2[_0x1d91('0x4f')],{'$or':_[_0x1d91('0x44')](_0x326b51,function(_0x50bd14){if(_0x50bd14[_0x1d91('0x43')]!==_0x1d91('0x52')){var _0x5ce1a6={};_0x5ce1a6[_0x50bd14['name']]={'$like':'%'+_0x320c78[_0x1d91('0x45')][_0x1d91('0x53')]+'%'};return _0x5ce1a6;}})});}_0x4526b2=_[_0x1d91('0x51')]({},_0x4526b2,_0x320c78['options']);var _0x3d4d11={'where':_0x4526b2['where']};return db['FaxAccount']['count'](_0x3d4d11)[_0x1d91('0x38')](function(_0x338c8c){_0x54c69e[_0x1d91('0x54')]=_0x338c8c;if(_0x320c78['query'][_0x1d91('0x55')]){_0x4526b2[_0x1d91('0x56')]=[{'all':!![]}];}return db[_0x1d91('0x40')][_0x1d91('0x57')](_0x4526b2);})['then'](function(_0x256f28){_0x54c69e[_0x1d91('0x58')]=_0x256f28;return _0x54c69e;})[_0x1d91('0x38')](respondWithFilteredResult(_0x4942a7,_0x4526b2))['catch'](handleError(_0x4942a7,null));};exports[_0x1d91('0x59')]=function(_0x5ee931,_0xb74e8c){var _0x2222af={'raw':![],'where':{'id':_0x5ee931['params']['id']},'include':[{'model':db[_0x1d91('0x3f')],'as':_0x1d91('0x5a')}]},_0x3f3789={};_0x3f3789['model']=_[_0x1d91('0x46')](db['FaxAccount'][_0x1d91('0x41')]);_0x3f3789[_0x1d91('0x45')]=_[_0x1d91('0x46')](_0x5ee931[_0x1d91('0x45')]);_0x3f3789[_0x1d91('0x47')]=_[_0x1d91('0x48')](_0x3f3789[_0x1d91('0x49')],_0x3f3789[_0x1d91('0x45')]);_0x2222af[_0x1d91('0x4a')]=_[_0x1d91('0x48')](_0x3f3789[_0x1d91('0x49')],qs[_0x1d91('0x4b')](_0x5ee931[_0x1d91('0x45')][_0x1d91('0x4b')]));_0x2222af[_0x1d91('0x4a')]=_0x2222af['attributes']['length']?_0x2222af[_0x1d91('0x4a')]:_0x3f3789[_0x1d91('0x49')];if(_0x5ee931[_0x1d91('0x45')][_0x1d91('0x55')]){_0x2222af[_0x1d91('0x56')]=[{'all':!![]}];}_0x2222af=_[_0x1d91('0x51')]({},_0x2222af,_0x5ee931[_0x1d91('0x5b')]);return db['FaxAccount'][_0x1d91('0x5c')](_0x2222af)[_0x1d91('0x38')](handleEntityNotFound(_0xb74e8c,null))[_0x1d91('0x38')](respondWithResult(_0xb74e8c,null))[_0x1d91('0x5d')](handleError(_0xb74e8c,null));};exports[_0x1d91('0x5e')]=function(_0x4d0391,_0x365947){return db[_0x1d91('0x40')]['create'](_0x4d0391[_0x1d91('0x5f')],{})['then'](function(_0x33f445){var _0x5179ed=_0x4d0391['user']['get']({'plain':!![]});if(!_0x5179ed)throw new Error(_0x1d91('0x60'));if(_0x5179ed[_0x1d91('0x61')]===_0x1d91('0x62')){var _0x484394=_0x33f445[_0x1d91('0x63')]({'plain':!![]});var _0x57c2c6=_0x1d91('0x39');return db['UserProfileSection'][_0x1d91('0x5c')]({'where':{'name':_0x57c2c6,'userProfileId':_0x5179ed[_0x1d91('0x64')]},'raw':!![]})[_0x1d91('0x38')](function(_0x1b3f02){if(_0x1b3f02&&_0x1b3f02['autoAssociation']===0x0){return db[_0x1d91('0x3a')][_0x1d91('0x5e')]({'name':_0x484394[_0x1d91('0x3d')],'resourceId':_0x484394['id'],'type':_0x1b3f02[_0x1d91('0x3d')],'sectionId':_0x1b3f02['id']},{})[_0x1d91('0x38')](function(){return _0x33f445;});}else{return _0x33f445;}})[_0x1d91('0x5d')](function(_0xc54371){logger[_0x1d91('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc54371);throw _0xc54371;});}return _0x33f445;})[_0x1d91('0x38')](respondWithResult(_0x365947,0xc9))['catch'](handleError(_0x365947,null));};exports[_0x1d91('0x37')]=function(_0x338d4f,_0x260416){if(_0x338d4f[_0x1d91('0x5f')]['id']){delete _0x338d4f[_0x1d91('0x5f')]['id'];}return db[_0x1d91('0x40')][_0x1d91('0x5c')]({'where':{'id':_0x338d4f[_0x1d91('0x65')]['id']},'include':[{'model':db[_0x1d91('0x3f')],'as':_0x1d91('0x5a')}]})[_0x1d91('0x38')](handleEntityNotFound(_0x260416,null))[_0x1d91('0x38')](saveUpdates(_0x338d4f[_0x1d91('0x5f')],null))[_0x1d91('0x38')](respondWithResult(_0x260416,null))[_0x1d91('0x5d')](handleError(_0x260416,null));};exports['destroy']=function(_0x456887,_0x1cd972){return db[_0x1d91('0x40')][_0x1d91('0x5c')]({'where':{'id':_0x456887['params']['id']}})[_0x1d91('0x38')](handleEntityNotFound(_0x1cd972,null))[_0x1d91('0x38')](removeEntity(_0x1cd972,null))[_0x1d91('0x5d')](handleError(_0x1cd972,null));};exports[_0x1d91('0x66')]=function(_0x754a7d,_0x5ef34d){return db[_0x1d91('0x40')]['describe']()[_0x1d91('0x38')](respondWithResult(_0x5ef34d,null))[_0x1d91('0x5d')](handleError(_0x5ef34d,null));};exports[_0x1d91('0x67')]=function(_0x3318a1,_0x71ee46,_0x1f5360){if(_0x3318a1[_0x1d91('0x5f')]['id']){delete _0x3318a1['body']['id'];}return db[_0x1d91('0x40')][_0x1d91('0x5c')]({'where':{'id':_0x3318a1['params']['id']}})[_0x1d91('0x38')](handleEntityNotFound(_0x71ee46,null))[_0x1d91('0x38')](function(_0x5b0105){if(_0x5b0105){_0x3318a1[_0x1d91('0x5f')][_0x1d91('0x68')]=_0x5b0105['id'];return db[_0x1d91('0x69')][_0x1d91('0x5e')](_0x3318a1[_0x1d91('0x5f')]);}})[_0x1d91('0x38')](respondWithResult(_0x71ee46,null))['catch'](handleError(_0x71ee46,null));};exports[_0x1d91('0x6a')]=function(_0x1be320,_0x594b3a,_0x27cca9){var _0x5373e0={'raw':![],'where':{}};var _0x5f10f9={};var _0x1d27f1={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x1be320[_0x1d91('0x65')]['id']}})[_0x1d91('0x38')](handleEntityNotFound(_0x594b3a,null))[_0x1d91('0x38')](function(_0x901201){if(_0x901201){_0x5f10f9[_0x1d91('0x49')]=_[_0x1d91('0x46')](db[_0x1d91('0x69')][_0x1d91('0x41')]);_0x5f10f9['query']=_[_0x1d91('0x46')](_0x1be320[_0x1d91('0x45')]);_0x5f10f9['filters']=_['intersection'](_0x5f10f9['model'],_0x5f10f9['query']);_0x5373e0['attributes']=_[_0x1d91('0x48')](_0x5f10f9['model'],qs[_0x1d91('0x4b')](_0x1be320[_0x1d91('0x45')][_0x1d91('0x4b')]));_0x5373e0[_0x1d91('0x4a')]=_0x5373e0[_0x1d91('0x4a')][_0x1d91('0x6b')]?_0x5373e0['attributes']:_0x5f10f9['model'];if(!_0x1be320[_0x1d91('0x45')]['hasOwnProperty'](_0x1d91('0x6c'))){_0x5373e0[_0x1d91('0x32')]=qs[_0x1d91('0x32')](_0x1be320['query'][_0x1d91('0x32')]);_0x5373e0[_0x1d91('0x30')]=qs[_0x1d91('0x30')](_0x1be320[_0x1d91('0x45')][_0x1d91('0x30')]);}_0x5373e0['order']=qs[_0x1d91('0x4e')](_0x1be320['query'][_0x1d91('0x4e')]);_0x5373e0['where']=qs['filters'](_[_0x1d91('0x50')](_0x1be320[_0x1d91('0x45')],_0x5f10f9[_0x1d91('0x47')]));_0x5373e0[_0x1d91('0x4f')][_0x1d91('0x68')]=_0x901201['id'];if(_0x1be320[_0x1d91('0x45')][_0x1d91('0x53')]){_0x5373e0[_0x1d91('0x4f')]=_[_0x1d91('0x51')](_0x5373e0[_0x1d91('0x4f')],{'$or':_[_0x1d91('0x44')](_0x5373e0[_0x1d91('0x4a')],function(_0x2a093d){var _0x400cf5={};_0x400cf5[_0x2a093d]={'$like':'%'+_0x1be320[_0x1d91('0x45')][_0x1d91('0x53')]+'%'};return _0x400cf5;})});}_0x5373e0=_['merge']({},_0x5373e0,_0x1be320['options']);return db[_0x1d91('0x69')][_0x1d91('0x54')]({'where':_0x5373e0['where']})['then'](function(_0xefdb0e){_0x1d27f1[_0x1d91('0x54')]=_0xefdb0e;if(_0x1be320['query'][_0x1d91('0x55')]){_0x5373e0[_0x1d91('0x56')]=[{'all':!![]}];}return db[_0x1d91('0x69')]['findAll'](_0x5373e0);})[_0x1d91('0x38')](function(_0x28cff7){_0x1d27f1['rows']=_0x28cff7;return _0x1d27f1;});}})[_0x1d91('0x38')](respondWithFilteredResult(_0x594b3a,_0x5373e0))['catch'](handleError(_0x594b3a,null));};exports[_0x1d91('0x6d')]=function(_0x50671d,_0x2b7a57,_0x44231d){return db[_0x1d91('0x40')]['find']({'where':{'id':_0x50671d[_0x1d91('0x65')]['id']}})[_0x1d91('0x38')](handleEntityNotFound(_0x2b7a57,null))[_0x1d91('0x38')](function(_0x4a8123){if(_0x4a8123){return _0x4a8123[_0x1d91('0x6d')](_0x50671d[_0x1d91('0x45')][_0x1d91('0x6e')]);}})['then'](respondWithStatusCode(_0x2b7a57,null))[_0x1d91('0x5d')](handleError(_0x2b7a57,null));};exports['addAnswer']=function(_0x177ede,_0x2153e7,_0xdb7f01){if(_0x177ede['body']['id']){delete _0x177ede[_0x1d91('0x5f')]['id'];}return db[_0x1d91('0x40')][_0x1d91('0x5c')]({'where':{'id':_0x177ede['params']['id']}})[_0x1d91('0x38')](handleEntityNotFound(_0x2153e7,null))['then'](function(_0x3137ca){if(_0x3137ca){_0x177ede[_0x1d91('0x5f')][_0x1d91('0x68')]=_0x3137ca['id'];return db['CannedAnswer'][_0x1d91('0x5e')](_0x177ede[_0x1d91('0x5f')]);}})[_0x1d91('0x38')](respondWithResult(_0x2153e7,null))[_0x1d91('0x5d')](handleError(_0x2153e7,null));};exports[_0x1d91('0x6f')]=function(_0x51831b,_0x17bfda,_0x5e967f){var _0x478bdc={'raw':![],'where':{}};var _0x4f9ff3={};var _0x394b6a={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x51831b[_0x1d91('0x65')]['id']}})[_0x1d91('0x38')](handleEntityNotFound(_0x17bfda,null))[_0x1d91('0x38')](function(_0x381393){if(_0x381393){_0x4f9ff3[_0x1d91('0x49')]=_[_0x1d91('0x46')](db['CannedAnswer']['rawAttributes']);_0x4f9ff3[_0x1d91('0x45')]=_['keys'](_0x51831b[_0x1d91('0x45')]);_0x4f9ff3[_0x1d91('0x47')]=_[_0x1d91('0x48')](_0x4f9ff3[_0x1d91('0x49')],_0x4f9ff3['query']);_0x478bdc[_0x1d91('0x4a')]=_[_0x1d91('0x48')](_0x4f9ff3[_0x1d91('0x49')],qs['fields'](_0x51831b[_0x1d91('0x45')]['fields']));_0x478bdc[_0x1d91('0x4a')]=_0x478bdc[_0x1d91('0x4a')]['length']?_0x478bdc[_0x1d91('0x4a')]:_0x4f9ff3[_0x1d91('0x49')];if(!_0x51831b[_0x1d91('0x45')]['hasOwnProperty'](_0x1d91('0x6c'))){_0x478bdc['limit']=qs[_0x1d91('0x32')](_0x51831b['query'][_0x1d91('0x32')]);_0x478bdc['offset']=qs[_0x1d91('0x30')](_0x51831b[_0x1d91('0x45')]['offset']);}_0x478bdc[_0x1d91('0x4d')]=qs[_0x1d91('0x4e')](_0x51831b[_0x1d91('0x45')][_0x1d91('0x4e')]);_0x478bdc[_0x1d91('0x4f')]=qs[_0x1d91('0x47')](_[_0x1d91('0x50')](_0x51831b[_0x1d91('0x45')],_0x4f9ff3[_0x1d91('0x47')]));_0x478bdc[_0x1d91('0x4f')][_0x1d91('0x68')]=_0x381393['id'];if(_0x51831b['query']['filter']){_0x478bdc[_0x1d91('0x4f')]=_[_0x1d91('0x51')](_0x478bdc[_0x1d91('0x4f')],{'$or':_[_0x1d91('0x44')](_0x478bdc[_0x1d91('0x4a')],function(_0x543431){var _0x2ac06c={};_0x2ac06c[_0x543431]={'$like':'%'+_0x51831b['query'][_0x1d91('0x53')]+'%'};return _0x2ac06c;})});}_0x478bdc=_[_0x1d91('0x51')]({},_0x478bdc,_0x51831b[_0x1d91('0x5b')]);return db[_0x1d91('0x70')]['count']({'where':_0x478bdc[_0x1d91('0x4f')]})['then'](function(_0x166c35){_0x394b6a[_0x1d91('0x54')]=_0x166c35;if(_0x51831b[_0x1d91('0x45')]['includeAll']){_0x478bdc[_0x1d91('0x56')]=[{'all':!![]}];}return db[_0x1d91('0x70')][_0x1d91('0x57')](_0x478bdc);})['then'](function(_0x268d91){_0x394b6a[_0x1d91('0x58')]=_0x268d91;return _0x394b6a;});}})['then'](respondWithFilteredResult(_0x17bfda,_0x478bdc))[_0x1d91('0x5d')](handleError(_0x17bfda,null));};exports['removeAnswers']=function(_0x3b3f36,_0x4043fb,_0x4ebb04){return db[_0x1d91('0x40')][_0x1d91('0x5c')]({'where':{'id':_0x3b3f36[_0x1d91('0x65')]['id']}})[_0x1d91('0x38')](handleEntityNotFound(_0x4043fb,null))[_0x1d91('0x38')](function(_0x3289af){if(_0x3289af){return _0x3289af[_0x1d91('0x71')](_0x3b3f36[_0x1d91('0x45')][_0x1d91('0x6e')]);}})[_0x1d91('0x38')](respondWithStatusCode(_0x4043fb,null))[_0x1d91('0x5d')](handleError(_0x4043fb,null));};exports['addInteraction']=function(_0x33319d,_0x381f63,_0x5b37a8){return db['FaxInteraction'][_0x1d91('0x5c')]({'where':{'id':_0x33319d[_0x1d91('0x65')]['id']}})[_0x1d91('0x38')](handleEntityNotFound(_0x381f63,null))['then'](function(_0x437680){if(_0x437680){return _0x437680['addInteraction'](_0x33319d['body'][_0x1d91('0x6e')],_[_0x1d91('0x72')](_0x33319d[_0x1d91('0x5f')],[_0x1d91('0x6e'),'id'])||{});}})[_0x1d91('0x38')](respondWithResult(_0x381f63,null))[_0x1d91('0x5d')](handleError(_0x381f63,null));};exports['getInteractions']=function(_0xecb7c1,_0x206f11,_0x382fcc){var _0x2170b8={'raw':![],'where':{}};var _0x34c83d={};var _0x48189d={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0xecb7c1[_0x1d91('0x65')]['id']}})[_0x1d91('0x38')](handleEntityNotFound(_0x206f11,null))[_0x1d91('0x38')](function(_0x1f1460){if(_0x1f1460){_0x34c83d['model']=_[_0x1d91('0x46')](db['FaxInteraction']['rawAttributes']);_0x34c83d[_0x1d91('0x45')]=_['keys'](_0xecb7c1['query']);_0x34c83d['filters']=_[_0x1d91('0x48')](_0x34c83d[_0x1d91('0x49')],_0x34c83d['query']);_0x2170b8[_0x1d91('0x4a')]=_['intersection'](_0x34c83d['model'],qs[_0x1d91('0x4b')](_0xecb7c1[_0x1d91('0x45')][_0x1d91('0x4b')]));_0x2170b8[_0x1d91('0x4a')]=_0x2170b8['attributes'][_0x1d91('0x6b')]?_0x2170b8[_0x1d91('0x4a')]:_0x34c83d['model'];if(!_0xecb7c1[_0x1d91('0x45')][_0x1d91('0x4c')](_0x1d91('0x6c'))){_0x2170b8['limit']=qs[_0x1d91('0x32')](_0xecb7c1[_0x1d91('0x45')][_0x1d91('0x32')]);_0x2170b8[_0x1d91('0x30')]=qs[_0x1d91('0x30')](_0xecb7c1[_0x1d91('0x45')][_0x1d91('0x30')]);}_0x2170b8[_0x1d91('0x4d')]=qs[_0x1d91('0x4e')](_0xecb7c1[_0x1d91('0x45')]['sort']);_0x2170b8['where']=qs[_0x1d91('0x47')](_[_0x1d91('0x50')](_0xecb7c1[_0x1d91('0x45')],_0x34c83d[_0x1d91('0x47')]));_0x2170b8[_0x1d91('0x4f')][_0x1d91('0x68')]=_0x1f1460['id'];if(_0xecb7c1['query'][_0x1d91('0x53')]){_0x2170b8['where']=_[_0x1d91('0x51')](_0x2170b8[_0x1d91('0x4f')],{'$or':_[_0x1d91('0x44')](_0x2170b8[_0x1d91('0x4a')],function(_0x455cea){var _0x21f5d8={};_0x21f5d8[_0x455cea]={'$like':'%'+_0xecb7c1[_0x1d91('0x45')]['filter']+'%'};return _0x21f5d8;})});}_0x2170b8=_['merge']({},_0x2170b8,_0xecb7c1[_0x1d91('0x5b')]);return db[_0x1d91('0x73')]['count']({'where':_0x2170b8['where']})[_0x1d91('0x38')](function(_0x4d6280){_0x48189d[_0x1d91('0x54')]=_0x4d6280;if(_0xecb7c1[_0x1d91('0x45')][_0x1d91('0x55')]){_0x2170b8[_0x1d91('0x56')]=[{'model':db[_0x1d91('0x74')],'as':_0x1d91('0x75'),'required':![]},{'model':db[_0x1d91('0x76')],'as':_0x1d91('0x77'),'attributes':['name',_0x1d91('0x78'),_0x1d91('0x79')],'required':![]},{'model':db[_0x1d91('0x7a')],'as':_0x1d91('0x7b'),'attributes':['id','name',_0x1d91('0x7c')],'where':_0xecb7c1[_0x1d91('0x45')][_0x1d91('0x7d')]?{'id':_0xecb7c1[_0x1d91('0x45')]['tag']}:undefined,'required':_0xecb7c1['query'][_0x1d91('0x7d')]?!![]:![]}];}return db['FaxInteraction'][_0x1d91('0x57')](_0x2170b8);})[_0x1d91('0x38')](function(_0x1c5a14){_0x48189d[_0x1d91('0x58')]=_0x1c5a14;return _0x48189d;});}})[_0x1d91('0x38')](respondWithFilteredResult(_0x206f11,_0x2170b8))[_0x1d91('0x5d')](handleError(_0x206f11,null));};exports[_0x1d91('0x7e')]=function(_0x519c88,_0x4dfa03,_0x541025){return db[_0x1d91('0x40')][_0x1d91('0x7f')]({'where':{'id':_0x519c88[_0x1d91('0x65')]['id']}})[_0x1d91('0x38')](handleEntityNotFound(_0x4dfa03,null))[_0x1d91('0x38')](function(_0x20b457){if(_0x20b457){return db[_0x1d91('0x80')][_0x1d91('0x81')](function(_0x14064c){return db['FaxApplication'][_0x1d91('0x3b')]({'where':{'FaxAccountId':_0x519c88[_0x1d91('0x65')]['id']},'transaction':_0x14064c})[_0x1d91('0x38')](function(_0x20df70){var _0x37c67c=_['map'](_0x519c88[_0x1d91('0x5f')],function(_0x164c51){_0x164c51[_0x1d91('0x68')]=_0x519c88[_0x1d91('0x65')]['id'];return _0x164c51;});return db['FaxApplication']['bulkCreate'](_0x37c67c,{'transaction':_0x14064c});});})['then'](function(){return db[_0x1d91('0x82')][_0x1d91('0x83')]({'where':{'FaxAccountId':_0x519c88[_0x1d91('0x65')]['id']},'order':_0x1d91('0x84')});});}})['then'](respondWithResult(_0x4dfa03,null))[_0x1d91('0x5d')](handleError(_0x4dfa03,null));};exports[_0x1d91('0x85')]=function(_0x2630b3,_0x4ebde2,_0x3112f4){var _0x353f6d={};var _0x16e3dc={};var _0x475471;var _0x5ebb5b;return db[_0x1d91('0x40')][_0x1d91('0x7f')]({'where':{'id':_0x2630b3['params']['id']}})[_0x1d91('0x38')](handleEntityNotFound(_0x4ebde2,null))[_0x1d91('0x38')](function(_0x16fef2){if(_0x16fef2){_0x475471=_0x16fef2;_0x16e3dc['model']=_[_0x1d91('0x46')](db['FaxApplication'][_0x1d91('0x41')]);_0x16e3dc['query']=_[_0x1d91('0x46')](_0x2630b3[_0x1d91('0x45')]);_0x16e3dc[_0x1d91('0x47')]=_[_0x1d91('0x48')](_0x16e3dc[_0x1d91('0x49')],_0x16e3dc[_0x1d91('0x45')]);_0x353f6d[_0x1d91('0x4a')]=_[_0x1d91('0x48')](_0x16e3dc['model'],qs[_0x1d91('0x4b')](_0x2630b3[_0x1d91('0x45')][_0x1d91('0x4b')]));_0x353f6d[_0x1d91('0x4a')]=_0x353f6d[_0x1d91('0x4a')][_0x1d91('0x6b')]?_0x353f6d[_0x1d91('0x4a')]:_0x16e3dc[_0x1d91('0x49')];_0x353f6d['order']=qs['sort'](_0x2630b3['query'][_0x1d91('0x4e')]);_0x353f6d['where']=qs[_0x1d91('0x47')](_[_0x1d91('0x50')](_0x2630b3[_0x1d91('0x45')],_0x16e3dc[_0x1d91('0x47')]));if(_0x2630b3[_0x1d91('0x45')][_0x1d91('0x53')]){_0x353f6d[_0x1d91('0x4f')]=_[_0x1d91('0x51')](_0x353f6d[_0x1d91('0x4f')],{'$or':_['map'](_0x353f6d[_0x1d91('0x4a')],function(_0x4e6677){var _0x579cd8={};_0x579cd8[_0x4e6677]={'$like':'%'+_0x2630b3['query'][_0x1d91('0x53')]+'%'};return _0x579cd8;})});}_0x353f6d=_['merge']({},_0x353f6d,_0x2630b3[_0x1d91('0x5b')]);return _0x475471[_0x1d91('0x85')](_0x353f6d);}})[_0x1d91('0x38')](function(_0x382a76){if(_0x382a76){_0x5ebb5b=_0x382a76['length'];if(!_0x2630b3['query'][_0x1d91('0x4c')](_0x1d91('0x6c'))){_0x353f6d[_0x1d91('0x32')]=qs[_0x1d91('0x32')](_0x2630b3[_0x1d91('0x45')][_0x1d91('0x32')]);_0x353f6d['offset']=qs['offset'](_0x2630b3['query'][_0x1d91('0x30')]);}return _0x475471['getApplications'](_0x353f6d);}})['then'](function(_0x5bddc4){if(_0x5bddc4){return _0x5bddc4?{'count':_0x5ebb5b,'rows':_0x5bddc4}:null;}})['then'](respondWithResult(_0x4ebde2,null))[_0x1d91('0x5d')](handleError(_0x4ebde2,null));};function Extension(_0x1e93d1,_0x5ecd08,_0x586e31,_0x5e27a0){this[_0x1d91('0x86')]=_0x1d91('0x87');this[_0x1d91('0x88')]=_0x1e93d1['localstationid'];this[_0x1d91('0x89')]=_0x5e27a0;this[_0x1d91('0x43')]=_0x1d91('0x8a');this[_0x1d91('0x8b')]=_0x1d91('0x8c');this[_0x1d91('0x68')]=_0x1e93d1['id'];this[_0x1d91('0x84')]=_0x5ecd08;this[_0x1d91('0x8d')]=_0x586e31;}function createExtensionsReciveFax(_0x45a903){var _0x25e797=0x1;var _0x3e145c=[];_0x3e145c['push'](new Extension(_0x45a903,_0x25e797,'','Answer'));_0x25e797+=0x1;_0x3e145c[_0x1d91('0x8e')](new Extension(_0x45a903,_0x25e797,_0x1d91('0x8f'),_0x1d91('0x90')));_0x25e797+=0x1;for(var _0x104a15 in _0x45a903){if(_0x45a903[_0x1d91('0x4c')](_0x104a15)&&(_0x104a15===_0x1d91('0x91')||_0x104a15===_0x1d91('0x92')||_0x104a15===_0x1d91('0x93')||_0x104a15===_0x1d91('0x94')||_0x104a15===_0x1d91('0x95')||_0x104a15==='maxrate'||_0x104a15==='minrate'||_0x104a15===_0x1d91('0x96')||_0x104a15===_0x1d91('0x97'))){_0x3e145c[_0x1d91('0x8e')](new Extension(_0x45a903,_0x25e797,_0x1d91('0x98')+_0x104a15+')='+_0x45a903[_0x104a15],_0x1d91('0x90')));_0x25e797+=0x1;}}_0x3e145c[_0x1d91('0x8e')](new Extension(_0x45a903,_0x25e797,'6',_0x1d91('0x99')));_0x25e797+=0x1;_0x3e145c[_0x1d91('0x8e')](new Extension(_0x45a903,_0x25e797,'/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',_0x1d91('0x9a')));_0x25e797=0x0;return _0x3e145c;}exports[_0x1d91('0x9b')]=function(_0x464d73,_0x205a90,_0x46aacd){var _0x10f392;return db[_0x1d91('0x80')][_0x1d91('0x81')](function(_0x4cb1d2){return db['FaxAccount'][_0x1d91('0x5e')](_0x464d73[_0x1d91('0x5f')],{'transaction':_0x4cb1d2})[_0x1d91('0x38')](function(_0x1edb50){_0x10f392=_0x1edb50[_0x1d91('0x63')]({'plain':!![]});return db[_0x1d91('0x9c')][_0x1d91('0x9d')](createExtensionsReciveFax(_0x10f392),{'transaction':_0x4cb1d2});});})[_0x1d91('0x38')](function(){return _0x10f392;})['then'](respondWithResult(_0x205a90,null))['catch'](handleError(_0x205a90,null));};exports['updateAccountApplications']=function(_0x108dc5,_0x2e6945,_0x103578){var _0x2a4346;return db[_0x1d91('0x80')][_0x1d91('0x81')](function(_0x4d297d){return db[_0x1d91('0x40')][_0x1d91('0x37')](_0x108dc5[_0x1d91('0x5f')],{'where':{'id':_0x108dc5[_0x1d91('0x5f')]['id']},'transaction':_0x4d297d})[_0x1d91('0x38')](function(_0xd7560b){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x108dc5[_0x1d91('0x5f')]['id']},'transaction':_0x4d297d})[_0x1d91('0x38')](function(_0x4b79c5){return db[_0x1d91('0x9c')][_0x1d91('0x9d')](createExtensionsReciveFax(_[_0x1d91('0x72')](_0x108dc5[_0x1d91('0x5f')],['tech',_0x1d91('0x9e'),_0x1d91('0x9f'),_0x1d91('0xa0'),_0x1d91('0xa1'),_0x1d91('0xa2')])),{'transaction':_0x4d297d});});});})[_0x1d91('0x38')](function(){return db['FaxAccount'][_0x1d91('0xa3')](_0x108dc5['body']['id']);})[_0x1d91('0x38')](respondWithResult(_0x2e6945,null))['catch'](handleError(_0x2e6945,null));};exports[_0x1d91('0xa4')]=function(_0x38d578,_0x47d252,_0x4fd708){var _0x16b453={'raw':!![],'where':{}};var _0x20634c={};var _0x48eb1d={'count':0x0,'rows':[]};return db[_0x1d91('0x40')][_0x1d91('0x7f')]({'where':{'id':_0x38d578['params']['id']}})[_0x1d91('0x38')](handleEntityNotFound(_0x47d252,null))[_0x1d91('0x38')](function(_0xb0c01e){if(_0xb0c01e){_0x20634c[_0x1d91('0x49')]=_[_0x1d91('0x46')](db[_0x1d91('0xa5')][_0x1d91('0x41')]);_0x20634c[_0x1d91('0x45')]=_[_0x1d91('0x46')](_0x38d578[_0x1d91('0x45')]);_0x20634c[_0x1d91('0x47')]=_['intersection'](_0x20634c[_0x1d91('0x49')],_0x20634c[_0x1d91('0x45')]);_0x16b453[_0x1d91('0x4a')]=_[_0x1d91('0x48')](_0x20634c['model'],qs[_0x1d91('0x4b')](_0x38d578['query']['fields']));_0x16b453[_0x1d91('0x4a')]=_0x16b453[_0x1d91('0x4a')][_0x1d91('0x6b')]?_0x16b453['attributes']:_0x20634c[_0x1d91('0x49')];if(!_0x38d578[_0x1d91('0x45')]['hasOwnProperty'](_0x1d91('0x6c'))){_0x16b453[_0x1d91('0x32')]=qs[_0x1d91('0x32')](_0x38d578[_0x1d91('0x45')]['limit']);_0x16b453['offset']=qs[_0x1d91('0x30')](_0x38d578[_0x1d91('0x45')][_0x1d91('0x30')]);}_0x16b453[_0x1d91('0x4d')]=qs[_0x1d91('0x4e')](_0x38d578[_0x1d91('0x45')][_0x1d91('0x4e')]);_0x16b453[_0x1d91('0x4f')]=qs[_0x1d91('0x47')](_[_0x1d91('0x50')](_0x38d578[_0x1d91('0x45')],_0x20634c[_0x1d91('0x47')]));_0x16b453['where'][_0x1d91('0x68')]=_0xb0c01e['id'];if(_0x38d578[_0x1d91('0x45')]['filter']){_0x16b453['where']=_[_0x1d91('0x51')](_0x16b453[_0x1d91('0x4f')],{'$or':_['map'](_0x16b453[_0x1d91('0x4a')],function(_0x3aae5e){var _0x57c8dc={};_0x57c8dc[_0x3aae5e]={'$like':'%'+_0x38d578[_0x1d91('0x45')][_0x1d91('0x53')]+'%'};return _0x57c8dc;})});}if(_0x38d578['query'][_0x1d91('0xa6')]){var _0x44a876=_0x38d578[_0x1d91('0x45')][_0x1d91('0xa6')][_0x1d91('0xa7')](',');var _0x1c6083={};_0x1c6083[_0x44a876[0x0]]={'$gte':moment(_0x44a876[0x1])[_0x1d91('0xa8')](_0x1d91('0xa9'))};_0x16b453[_0x1d91('0x4f')]=_[_0x1d91('0x51')](_0x16b453[_0x1d91('0x4f')],_0x1c6083);}_0x16b453=_[_0x1d91('0x51')]({},_0x16b453,_0x38d578[_0x1d91('0x5b')]);return db[_0x1d91('0xa5')][_0x1d91('0x54')]({'where':_0x16b453[_0x1d91('0x4f')]})[_0x1d91('0x38')](function(_0x46749a){_0x48eb1d['count']=_0x46749a;if(_0x38d578[_0x1d91('0x45')][_0x1d91('0x55')]){_0x16b453[_0x1d91('0x56')]=[{'all':!![]}];}return db[_0x1d91('0xa5')]['findAll'](_0x16b453);})[_0x1d91('0x38')](function(_0x4f642b){_0x48eb1d['rows']=_0x4f642b;return _0x48eb1d;});}})[_0x1d91('0x38')](respondWithFilteredResult(_0x47d252,_0x16b453))[_0x1d91('0x5d')](handleError(_0x47d252,null));};exports[_0x1d91('0xaa')]=function(_0x589130,_0x1804ff,_0x443a5f){var _0x3fcdd7,_0x5868d6={},_0x44594d;if(_0x589130['body']['to']){_0x44594d=_0x589130[_0x1d91('0x5f')]['to'][0x0];}return db[_0x1d91('0x40')]['find']({'where':{'id':_0x589130[_0x1d91('0x65')]['id']},'include':[{'model':db[_0x1d91('0xab')],'as':_0x1d91('0xac'),'include':[{'model':db[_0x1d91('0x74')],'as':_0x1d91('0xad'),'where':{'fax':_0x44594d},'limit':0x1,'order':[[_0x1d91('0xa0'),_0x1d91('0xae')]]}]}]})[_0x1d91('0x38')](handleEntityNotFound(_0x1804ff,null))['then'](function(_0xa6a745){_0x3fcdd7=_0xa6a745;if(_0x589130['body'][_0x1d91('0xaf')]&&_0x589130[_0x1d91('0x5f')][_0x1d91('0xaf')][_0x1d91('0x6b')]){for(var _0x115ad5=0x0;_0x115ad5<_0x589130[_0x1d91('0x5f')]['attachments']['length'];_0x115ad5+=0x1){_0x589130[_0x1d91('0x5f')]['attachments'][_0x115ad5]={'filename':_0x589130[_0x1d91('0x5f')][_0x1d91('0xaf')][_0x115ad5]['name'],'id':_0x589130[_0x1d91('0x5f')][_0x1d91('0xaf')][_0x115ad5]['id'],'path':path[_0x1d91('0xb0')](config[_0x1d91('0xb1')],_0x1d91('0xb2'),_0x589130[_0x1d91('0x5f')][_0x1d91('0xaf')][_0x115ad5]['basename'])};}}return respondWithRpcPromise(_0x1d91('0xb3'),'CheckAfterSend',{'FaxAccountId':_['isNil'](_0x589130['params']['id'])?undefined:_0x589130[_0x1d91('0x65')]['id'],'path':_[_0x1d91('0xb4')](_0x589130[_0x1d91('0x5f')][_0x1d91('0xaf')][0x0][_0x1d91('0x8')])?undefined:_0x589130[_0x1d91('0x5f')][_0x1d91('0xaf')][0x0][_0x1d91('0x8')],'fax':_[_0x1d91('0xb4')](_0x589130[_0x1d91('0x5f')]['to'][0x0])?undefined:_0x589130[_0x1d91('0x5f')]['to'][0x0]},client9002);})[_0x1d91('0x38')](function(){if(_0x3fcdd7){if(_[_0x1d91('0xb4')](_0x589130['body']['from'])){_0x589130[_0x1d91('0x5f')][_0x1d91('0xb5')]=util['format']('\x22%s\x22\x20<%s>',_0x3fcdd7[_0x1d91('0x3d')],_0x3fcdd7[_0x1d91('0xb6')]);}if(_0x3fcdd7['List']){if(_0x3fcdd7[_0x1d91('0xac')][_0x1d91('0xad')][_0x1d91('0x6b')]){return _0x3fcdd7['List']['Contacts'][0x0];}else{return db[_0x1d91('0x74')]['create'](_['defaults'](_0x589130['body'],{'firstName':_0x589130[_0x1d91('0x5f')]['to'][0x0],'phone':_0x589130[_0x1d91('0x5f')]['to'][0x0],'fax':_0x589130['body']['to'][0x0],'ListId':_0x3fcdd7[_0x1d91('0xa2')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x1d91('0x38')](function(_0x51dd06){if(_0x51dd06){return db[_0x1d91('0x73')][_0x1d91('0x5c')]({'where':{'ContactId':_0x51dd06['id'],'closed':![],'FaxAccountId':_0x3fcdd7['id']}})[_0x1d91('0x38')](function(_0x273450){if(_0x273450){return[_0x273450,![]];}return db[_0x1d91('0x73')][_0x1d91('0x5e')]({'UserId':_0x589130[_0x1d91('0x62')]['id'],'ContactId':_0x51dd06['id'],'FaxAccountId':_0x3fcdd7['id'],'fax':_0x589130[_0x1d91('0x5f')]['to'][0x0],'firstMsgDirection':'out','Messages':[_['merge'](_0x589130[_0x1d91('0x5f')],{'read':![],'body':_0x589130[_0x1d91('0x5f')][_0x1d91('0xaf')][0x0][_0x1d91('0xb7')],'FaxAccountId':_0x3fcdd7['id'],'UserId':_0x589130[_0x1d91('0x62')]['id'],'ContactId':_0x51dd06['id'],'AttachmentId':_0x589130[_0x1d91('0x5f')][_0x1d91('0xaf')][0x0]['id']})]},{'include':[{'model':db[_0x1d91('0xa5')],'as':_0x1d91('0xb8')}]})[_0x1d91('0x38')](function(_0x2a7e2f){return[_0x2a7e2f,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x1d91('0xb9')](function(_0x3038fe,_0x210342){if(_0x210342){return _0x3038fe;}return db[_0x1d91('0xa5')][_0x1d91('0x5e')]({'direction':_0x1d91('0xba'),'read':![],'body':_0x589130[_0x1d91('0x5f')][_0x1d91('0xaf')][0x0][_0x1d91('0xb7')],'FaxAccountId':_0x3fcdd7['id'],'FaxInteractionId':_0x3038fe['id'],'UserId':_0x589130[_0x1d91('0x62')]['id'],'ContactId':_0x3038fe[_0x1d91('0xbb')],'AttachmentId':_0x589130[_0x1d91('0x5f')][_0x1d91('0xaf')][0x0]['id']})[_0x1d91('0x38')](function(_0x56c36a){_0x3038fe[_0x1d91('0xbc')][_0x1d91('0xb8')]=[];_0x3038fe[_0x1d91('0xbc')][_0x1d91('0xb8')][_0x1d91('0x8e')](_0x56c36a[_0x1d91('0xbc')]);return _0x3038fe;});})['then'](function(_0x2a576e){respondWithRpcPromise(_0x1d91('0xbd'),_0x1d91('0xbd'),{'FaxAccountId':_['isNil'](_0x589130['params']['id'])?undefined:_0x589130[_0x1d91('0x65')]['id'],'path':_[_0x1d91('0xb4')](_0x589130[_0x1d91('0x5f')]['attachments'][0x0][_0x1d91('0x8')])?undefined:_0x589130[_0x1d91('0x5f')][_0x1d91('0xaf')][0x0][_0x1d91('0x8')],'fax':_[_0x1d91('0xb4')](_0x589130[_0x1d91('0x5f')]['to'][0x0])?undefined:_0x589130[_0x1d91('0x5f')]['to'][0x0],'AttachmentId':_0x589130[_0x1d91('0x5f')][_0x1d91('0xaf')][0x0]['id']},client9002)[_0x1d91('0x38')](function(_0x3c5fbf){logger['info']('SendFaxRpc,\x20%s',_0x3c5fbf);})[_0x1d91('0x5d')](function(_0x3fde24){logger['info'](_0x1d91('0xbe'),_0x3fde24);});return _0x2a576e;})[_0x1d91('0x38')](respondWithResult(_0x1804ff,null))[_0x1d91('0x5d')](handleError(_0x1804ff,null));};exports[_0x1d91('0xbf')]=function(_0x35ba59,_0x5bcf25,_0x281d8c){return db[_0x1d91('0x40')][_0x1d91('0x5c')]({'where':{'id':_0x35ba59[_0x1d91('0x65')]['id']}})[_0x1d91('0x38')](handleEntityNotFound(_0x5bcf25,null))['then'](function(_0x1c9902){if(_0x1c9902){return _0x1c9902[_0x1d91('0xbf')](_0x35ba59[_0x1d91('0x5f')][_0x1d91('0x6e')],_[_0x1d91('0x72')](_0x35ba59['body'],['ids','id'])||{})[_0x1d91('0xb9')](function(_0x29ed1d){for(var _0x22e409=0x0;_0x22e409<_0x35ba59[_0x1d91('0x5f')]['ids'][_0x1d91('0x6b')];_0x22e409+=0x1){socket[_0x1d91('0xc0')](_0x1d91('0xc1'),{'UserId':Number(_0x35ba59['body']['ids'][_0x22e409]),'FaxAccountId':Number(_0x35ba59[_0x1d91('0x65')]['id'])});}return _0x29ed1d;});}})[_0x1d91('0x38')](respondWithResult(_0x5bcf25,null))[_0x1d91('0x5d')](handleError(_0x5bcf25,null));};exports['removeAgents']=function(_0x2db7ba,_0x238a1b,_0x379c67){return db['FaxAccount'][_0x1d91('0x5c')]({'where':{'id':_0x2db7ba['params']['id']}})[_0x1d91('0x38')](handleEntityNotFound(_0x238a1b,null))['then'](function(_0x3e5ea2){if(_0x3e5ea2){return _0x3e5ea2[_0x1d91('0xc2')](_0x2db7ba[_0x1d91('0x45')]['ids'])[_0x1d91('0x38')](function(){if(_['isArray'](_0x2db7ba['query']['ids'])){for(var _0x229c27=0x0;_0x229c27<_0x2db7ba[_0x1d91('0x45')][_0x1d91('0x6e')][_0x1d91('0x6b')];_0x229c27+=0x1){socket[_0x1d91('0xc0')](_0x1d91('0xc3'),{'UserId':Number(_0x2db7ba[_0x1d91('0x45')][_0x1d91('0x6e')][_0x229c27]),'FaxAccountId':Number(_0x2db7ba[_0x1d91('0x65')]['id'])});}}else{socket[_0x1d91('0xc0')](_0x1d91('0xc3'),{'UserId':Number(_0x2db7ba[_0x1d91('0x45')][_0x1d91('0x6e')]),'FaxAccountId':Number(_0x2db7ba[_0x1d91('0x65')]['id'])});}});}})['then'](respondWithStatusCode(_0x238a1b,null))[_0x1d91('0x5d')](handleError(_0x238a1b,null));};exports[_0x1d91('0xc4')]=function(_0x52db29,_0x34f09e,_0x238e1c){var _0x468404={};var _0xd2ed98={};var _0x58f8eb;var _0x3ca7cd;return db['FaxAccount'][_0x1d91('0x7f')]({'where':{'id':_0x52db29[_0x1d91('0x65')]['id']}})['then'](handleEntityNotFound(_0x34f09e,null))['then'](function(_0xb043e9){if(_0xb043e9){_0x58f8eb=_0xb043e9;_0xd2ed98[_0x1d91('0x49')]=_[_0x1d91('0x46')](db[_0x1d91('0x76')]['rawAttributes']);_0xd2ed98[_0x1d91('0x45')]=_[_0x1d91('0x46')](_0x52db29[_0x1d91('0x45')]);_0xd2ed98[_0x1d91('0x47')]=_[_0x1d91('0x48')](_0xd2ed98['model'],_0xd2ed98['query']);_0x468404[_0x1d91('0x4a')]=_[_0x1d91('0x48')](_0xd2ed98[_0x1d91('0x49')],qs[_0x1d91('0x4b')](_0x52db29['query'][_0x1d91('0x4b')]));_0x468404[_0x1d91('0x4a')]=_0x468404['attributes']['length']?_0x468404[_0x1d91('0x4a')]:_0xd2ed98[_0x1d91('0x49')];_0x468404['order']=qs[_0x1d91('0x4e')](_0x52db29[_0x1d91('0x45')][_0x1d91('0x4e')]);_0x468404[_0x1d91('0x4f')]=qs['filters'](_[_0x1d91('0x50')](_0x52db29[_0x1d91('0x45')],_0xd2ed98[_0x1d91('0x47')]));if(_0x52db29[_0x1d91('0x45')][_0x1d91('0x53')]){_0x468404['where']=_[_0x1d91('0x51')](_0x468404[_0x1d91('0x4f')],{'$or':_['map'](_0x468404[_0x1d91('0x4a')],function(_0x458cc2){var _0x4cb2b8={};_0x4cb2b8[_0x458cc2]={'$like':'%'+_0x52db29['query'][_0x1d91('0x53')]+'%'};return _0x4cb2b8;})});}_0x468404=_['merge']({},_0x468404,_0x52db29['options']);return _0x58f8eb['getAgents'](_0x468404);}})[_0x1d91('0x38')](function(_0x480aa4){if(_0x480aa4){_0x3ca7cd=_0x480aa4[_0x1d91('0x6b')];if(!_0x52db29[_0x1d91('0x45')]['hasOwnProperty'](_0x1d91('0x6c'))){_0x468404['limit']=qs[_0x1d91('0x32')](_0x52db29[_0x1d91('0x45')][_0x1d91('0x32')]);_0x468404[_0x1d91('0x30')]=qs[_0x1d91('0x30')](_0x52db29[_0x1d91('0x45')][_0x1d91('0x30')]);}return _0x58f8eb[_0x1d91('0xc4')](_0x468404);}})[_0x1d91('0x38')](function(_0x2b202b){if(_0x2b202b){return _0x2b202b?{'count':_0x3ca7cd,'rows':_0x2b202b}:null;}})['then'](respondWithResult(_0x34f09e,null))[_0x1d91('0x5d')](handleError(_0x34f09e,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index f992494..798482f 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 _0x1a58=['exports','events','FaxAccount','setMaxListeners','save','update','remove','emit','hook'];(function(_0x1f6e83,_0x1b8b02){var _0x58b9d8=function(_0x252e7c){while(--_0x252e7c){_0x1f6e83['push'](_0x1f6e83['shift']());}};_0x58b9d8(++_0x1b8b02);}(_0x1a58,0x17b));var _0x81a5=function(_0x17e9b0,_0x3dc934){_0x17e9b0=_0x17e9b0-0x0;var _0x2bc59f=_0x1a58[_0x17e9b0];return _0x2bc59f;};'use strict';var EventEmitter=require(_0x81a5('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x81a5('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x81a5('0x2')](0x0);var events={'afterCreate':_0x81a5('0x3'),'afterUpdate':_0x81a5('0x4'),'afterDestroy':_0x81a5('0x5')};function emitEvent(_0x5b96eb){return function(_0x57dc14,_0xb12256,_0x25441c){FaxAccountEvents[_0x81a5('0x6')](_0x5b96eb+':'+_0x57dc14['id'],_0x57dc14);FaxAccountEvents['emit'](_0x5b96eb,_0x57dc14);_0x25441c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x81a5('0x7')](e,emitEvent(event));}}module[_0x81a5('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0xc610=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','update','remove','emit'];(function(_0x16bc8d,_0x3d95f1){var _0x34397d=function(_0x3a96d5){while(--_0x3a96d5){_0x16bc8d['push'](_0x16bc8d['shift']());}};_0x34397d(++_0x3d95f1);}(_0xc610,0x1d9));var _0x0c61=function(_0xe3f0b0,_0x43edc9){_0xe3f0b0=_0xe3f0b0-0x0;var _0x3a839e=_0xc610[_0xe3f0b0];return _0x3a839e;};'use strict';var EventEmitter=require(_0x0c61('0x0'));var FaxAccount=require(_0x0c61('0x1'))['db'][_0x0c61('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x0c61('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0c61('0x4'),'afterDestroy':_0x0c61('0x5')};function emitEvent(_0x340ebc){return function(_0x3c48bd,_0x4a13b0,_0x3ae37c){FaxAccountEvents['emit'](_0x340ebc+':'+_0x3c48bd['id'],_0x3c48bd);FaxAccountEvents[_0x0c61('0x6')](_0x340ebc,_0x3c48bd);_0x3ae37c(null);};}for(var e in events){if(events[_0x0c61('0x7')](e)){var event=events[e];FaxAccount[_0x0c61('0x8')](e,emitEvent(event));}}module[_0x0c61('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index d69f897..5890d7a 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 _0xe7ab=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxAccount','fax_accounts','lodash','../../config/logger','api','moment'];(function(_0x402282,_0x615de3){var _0x4f65af=function(_0x4a20f7){while(--_0x4a20f7){_0x402282['push'](_0x402282['shift']());}};_0x4f65af(++_0x615de3);}(_0xe7ab,0x168));var _0xbe7a=function(_0x6a1c13,_0x239142){_0x6a1c13=_0x6a1c13-0x0;var _0x4301a5=_0xe7ab[_0x6a1c13];return _0x4301a5;};'use strict';var _=require(_0xbe7a('0x0'));var util=require('util');var logger=require(_0xbe7a('0x1'))(_0xbe7a('0x2'));var moment=require(_0xbe7a('0x3'));var BPromise=require(_0xbe7a('0x4'));var rp=require(_0xbe7a('0x5'));var fs=require('fs');var path=require(_0xbe7a('0x6'));var rimraf=require(_0xbe7a('0x7'));var config=require(_0xbe7a('0x8'));var attributes=require('./faxAccount.attributes');module[_0xbe7a('0x9')]=function(_0x56d03a,_0x5dee19){return _0x56d03a[_0xbe7a('0xa')](_0xbe7a('0xb'),attributes,{'tableName':_0xbe7a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x011b=['api','moment','bluebird','request-promise','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger'];(function(_0x51b19b,_0x5015d2){var _0x1a3cd6=function(_0x495134){while(--_0x495134){_0x51b19b['push'](_0x51b19b['shift']());}};_0x1a3cd6(++_0x5015d2);}(_0x011b,0xda));var _0xb011=function(_0x4b1604,_0x4f9b75){_0x4b1604=_0x4b1604-0x0;var _0x4e2367=_0x011b[_0x4b1604];return _0x4e2367;};'use strict';var _=require(_0xb011('0x0'));var util=require(_0xb011('0x1'));var logger=require(_0xb011('0x2'))(_0xb011('0x3'));var moment=require(_0xb011('0x4'));var BPromise=require(_0xb011('0x5'));var rp=require(_0xb011('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb011('0x7'));var attributes=require(_0xb011('0x8'));module[_0xb011('0x9')]=function(_0x3d4e43,_0x1f9634){return _0x3d4e43[_0xb011('0xa')](_0xb011('0xb'),attributes,{'tableName':_0xb011('0xc'),'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 54d1706..16f1929 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 _0x4e61=['CmContact','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','from','ValidationError','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','applications','list','priority','create','contact','fax','FaxInteraction','Contact\x20not\x20found','spread','autoclose','length','unmanaged','*,*,*,*','interaction','ContactId','AttachmentId','UserId','User','name','agent','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','./faxAccount.socket','request','then','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','FaxAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','GetFaxAccount','findAll','options','raw','attributes','include','map','model','stringify','NotifyFaxAccount','body'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x4e61,0x1e1));var _0x14e6=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x4e61[_0x2112d4];return _0x434972;};'use strict';var _=require('lodash');var util=require(_0x14e6('0x0'));var moment=require(_0x14e6('0x1'));var BPromise=require(_0x14e6('0x2'));var rs=require(_0x14e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x14e6('0x4'));var logger=require('../../config/logger')(_0x14e6('0x5'));var config=require('../../config/environment');var jayson=require(_0x14e6('0x6'));var client=jayson[_0x14e6('0x7')]['http']({'port':0x232c});config[_0x14e6('0x8')]=_[_0x14e6('0x9')](config[_0x14e6('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x14e6('0xa'))(new Redis(config[_0x14e6('0x8')]));require(_0x14e6('0xb'))['register'](socket);function respondWithRpcPromise(_0x98c1bc,_0x1c5bf2,_0x12318e){return new BPromise(function(_0x346a3e,_0x3b27d4){return client[_0x14e6('0xc')](_0x98c1bc,_0x12318e)[_0x14e6('0xd')](function(_0x277587){logger[_0x14e6('0xe')]('FaxAccount,\x20%s,\x20%s',_0x1c5bf2,'request\x20sent');logger[_0x14e6('0xf')](_0x14e6('0x10'),_0x1c5bf2,'request\x20sent',JSON['stringify'](_0x277587));if(_0x277587[_0x14e6('0x11')]){if(_0x277587['error'][_0x14e6('0x12')]===0x1f4){logger['error'](_0x14e6('0x13'),_0x1c5bf2,_0x277587['error'][_0x14e6('0x14')]);return _0x3b27d4(_0x277587[_0x14e6('0x11')]['message']);}logger[_0x14e6('0x11')](_0x14e6('0x13'),_0x1c5bf2,_0x277587[_0x14e6('0x11')][_0x14e6('0x14')]);return _0x346a3e(_0x277587[_0x14e6('0x11')]['message']);}else{logger[_0x14e6('0xe')](_0x14e6('0x13'),_0x1c5bf2,_0x14e6('0x15'));_0x346a3e(_0x277587[_0x14e6('0x16')][_0x14e6('0x14')]);}})[_0x14e6('0x17')](function(_0x330fe2){logger[_0x14e6('0x11')](_0x14e6('0x13'),_0x1c5bf2,_0x330fe2);_0x3b27d4(_0x330fe2);});});}exports[_0x14e6('0x18')]=function(_0x40ccd4){var _0x254b41=this;return new Promise(function(_0x299b23,_0x442e40){return db['FaxAccount'][_0x14e6('0x19')]({'raw':_0x40ccd4[_0x14e6('0x1a')]?_0x40ccd4['options'][_0x14e6('0x1b')]===undefined?!![]:![]:!![],'where':_0x40ccd4[_0x14e6('0x1a')]?_0x40ccd4[_0x14e6('0x1a')]['where']||null:null,'attributes':_0x40ccd4['options']?_0x40ccd4['options'][_0x14e6('0x1c')]||null:null,'limit':_0x40ccd4[_0x14e6('0x1a')]?_0x40ccd4[_0x14e6('0x1a')]['limit']||null:null,'include':_0x40ccd4[_0x14e6('0x1a')]?_0x40ccd4[_0x14e6('0x1a')][_0x14e6('0x1d')]?_[_0x14e6('0x1e')](_0x40ccd4[_0x14e6('0x1a')][_0x14e6('0x1d')],function(_0x13ade9){return{'model':db[_0x13ade9[_0x14e6('0x1f')]],'as':_0x13ade9['as'],'attributes':_0x13ade9[_0x14e6('0x1c')],'include':_0x13ade9[_0x14e6('0x1d')]?_[_0x14e6('0x1e')](_0x13ade9['include'],function(_0x4aeda8){return{'model':db[_0x4aeda8['model']],'as':_0x4aeda8['as'],'attributes':_0x4aeda8[_0x14e6('0x1c')],'include':_0x4aeda8[_0x14e6('0x1d')]?_[_0x14e6('0x1e')](_0x4aeda8[_0x14e6('0x1d')],function(_0x9ce564){return{'model':db[_0x9ce564['model']],'as':_0x9ce564['as'],'attributes':_0x9ce564[_0x14e6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x14e6('0xd')](function(_0x22a2dc){logger[_0x14e6('0xe')](_0x14e6('0x18'),_0x40ccd4);logger[_0x14e6('0xf')](_0x14e6('0x18'),_0x40ccd4,JSON[_0x14e6('0x20')](_0x22a2dc));_0x299b23(_0x22a2dc);})[_0x14e6('0x17')](function(_0x5b1697){logger[_0x14e6('0x11')]('GetFaxAccount',_0x5b1697[_0x14e6('0x14')],_0x40ccd4);_0x442e40(_0x254b41[_0x14e6('0x11')](0x1f4,_0x5b1697[_0x14e6('0x14')]));});});};exports[_0x14e6('0x21')]=function(_0x3db750,_0xdf9a67,_0xfee684){var _0x18ab81=this;return new Promise(function(_0x1b063a,_0xcd4635){var _0x2fa6ae={'body':_0x3db750[_0x14e6('0x22')],'channel':'fax'};var _0x2a671c=[];var _0xb14f60=[];var _0x5335c8={};return db[_0x14e6('0x23')]['describe']()[_0x14e6('0xd')](function(_0x337981){if(!_0x337981){throw new db[(_0x14e6('0x24'))]['ValidationError'](_0x14e6('0x25'));}_0x2a671c=_[_0x14e6('0x26')](_[_0x14e6('0x27')](_0x337981),[_0x14e6('0x28'),_0x14e6('0x29')]);_0xb14f60=_['difference'](_[_0x14e6('0x27')](_0x337981),[_0x14e6('0x28'),_0x14e6('0x29'),_0x14e6('0x2a'),_0x14e6('0x2b')]);if(_0x3db750[_0x14e6('0x22')]['id']){delete _0x3db750[_0x14e6('0x22')]['id'];}if(_['isNil'](_0x3db750[_0x14e6('0x22')][_0x14e6('0x2c')])){throw new db[(_0x14e6('0x24'))][(_0x14e6('0x2d'))](_0x14e6('0x2e'));}if(_[_0x14e6('0x2f')](_0x3db750[_0x14e6('0x22')][_0x14e6('0x22')])||_0x3db750[_0x14e6('0x22')][_0x14e6('0x22')]===''){throw new db['Sequelize'][(_0x14e6('0x2d'))](_0x14e6('0x30'));}if(_[_0x14e6('0x2f')](_0x3db750['body'][_0x14e6('0x31')])){throw new db[(_0x14e6('0x24'))][(_0x14e6('0x2d'))](_0x14e6('0x32')+_0xb14f60);}if(!_[_0x14e6('0x33')](_0xb14f60,_0x3db750[_0x14e6('0x22')][_0x14e6('0x31')])){throw new db[(_0x14e6('0x24'))]['ValidationError'](_0x14e6('0x34')+_0xb14f60);}_0x5335c8[_0x3db750[_0x14e6('0x22')][_0x14e6('0x31')]]=_0x3db750['body'][_0x14e6('0x2c')];})['then'](function(){return db[_0x14e6('0x35')][_0x14e6('0x36')]({'where':{'id':_0x3db750[_0x14e6('0x37')]['id']},'include':[{'model':db[_0x14e6('0x38')],'as':_0x14e6('0x39'),'include':[{'model':db[_0x14e6('0x23')],'as':_0x14e6('0x3a'),'where':_0x5335c8,'limit':0x1,'order':[[_0x14e6('0x29'),_0x14e6('0x3b')]]}]},{'model':db[_0x14e6('0x3c')],'as':_0x14e6('0x3d')}]});})[_0x14e6('0xd')](function(_0x5b5b0e){if(_0x5b5b0e&&_0x5b5b0e[_0x14e6('0x39')]){var _0x4a5630=_0x5b5b0e[_0x14e6('0x3e')]({'plain':!![]});_0x2fa6ae['account']=_0x4a5630;_0x2fa6ae[_0x14e6('0x3f')]=_0x4a5630['Applications'];_0x2fa6ae[_0x14e6('0x40')]=_0x4a5630['List'];_0x2fa6ae[_0x14e6('0x3f')]=_['orderBy'](_0x2fa6ae['applications'],[_0x14e6('0x41')],['asc']);if(_0x2fa6ae['account'][_0x14e6('0x3d')]){delete _0x2fa6ae['account'][_0x14e6('0x3d')];}if(_0x2fa6ae['account'][_0x14e6('0x39')]&&_0x2fa6ae[_0x14e6('0x37')][_0x14e6('0x39')][_0x14e6('0x3a')]['length']){return _0x2fa6ae['account']['List']['Contacts'][0x0];}var _0x3e1ffc=_[_0x14e6('0x9')](_0x3db750[_0x14e6('0x22')],{'firstName':_0x3db750[_0x14e6('0x22')][_0x14e6('0x2c')],'ListId':_0x4a5630[_0x14e6('0x2b')]});_0x3e1ffc[_0x3db750[_0x14e6('0x22')][_0x14e6('0x31')]]=_0x3db750[_0x14e6('0x22')][_0x14e6('0x2c')];return db[_0x14e6('0x23')][_0x14e6('0x42')](_0x3e1ffc,{'fields':_0x2a671c,'raw':!![]});}})[_0x14e6('0xd')](function(_0x4071f0){_0x2fa6ae[_0x14e6('0x43')]=_0x4071f0;if(_0x4071f0){var _0x5bbaa0={'ContactId':_0x4071f0['id'],'FaxAccountId':_0x3db750['account']['id'],'fax':_0x4071f0[_0x14e6('0x44')]};return db[_0x14e6('0x45')][_0x14e6('0x36')]({'where':{'ContactId':_0x4071f0['id'],'closed':![],'FaxAccountId':_0x3db750[_0x14e6('0x37')]['id']}})[_0x14e6('0xd')](function(_0x136096){if(_0x136096){return[_0x136096,![]];}return db['FaxInteraction'][_0x14e6('0x42')](_0x5bbaa0)[_0x14e6('0xd')](function(_0x1fef23){return[_0x1fef23,!![]];});});}else{throw new Error(_0x14e6('0x46'));}})[_0x14e6('0x47')](function(_0x252f32,_0x383cf3){var _0x506a22=_0x252f32['get']({'plain':!![]});if(_0x383cf3){if(_0x2fa6ae[_0x14e6('0x37')][_0x14e6('0x48')]){_0x2fa6ae['applications']['push']({'id':0x0,'priority':_0x2fa6ae[_0x14e6('0x3f')][_0x14e6('0x49')]+0x1,'app':'close','appdata':_0x14e6('0x4a'),'interval':_0x14e6('0x4b')});}_0x506a22['created']=!![];}else{_0x506a22['created']=![];}_0x2fa6ae[_0x14e6('0x4c')]=_0x506a22;return db['FaxMessage'][_0x14e6('0x42')]({'body':_0x3db750['body']['body'],'FaxAccountId':_0x3db750[_0x14e6('0x37')]['id'],'FaxInteractionId':_0x252f32['id'],'direction':'in','ContactId':_0x252f32[_0x14e6('0x4d')],'AttachmentId':_0x3db750[_0x14e6('0x22')][_0x14e6('0x4e')]});})['then'](function(_0x5c2120){_0x2fa6ae['message']=_0x5c2120;if(_0x2fa6ae[_0x14e6('0x4c')][_0x14e6('0x4f')]){return db[_0x14e6('0x50')][_0x14e6('0x36')]({'attributes':['id',_0x14e6('0x51')],'where':{'id':_0x2fa6ae[_0x14e6('0x4c')][_0x14e6('0x4f')]}})[_0x14e6('0xd')](function(_0x442140){if(_0x442140){_0x2fa6ae[_0x14e6('0x3f')]['unshift']({'id':0x0,'priority':0x0,'app':_0x14e6('0x52'),'appdata':_0x442140[_0x14e6('0x51')]+','+(_0x2fa6ae['account'][_0x14e6('0x53')]||0xa),'interval':_0x14e6('0x4b')});}return respondWithRpcPromise('Start','startRouting',_0x2fa6ae);});}return respondWithRpcPromise(_0x14e6('0x54'),_0x14e6('0x55'),_0x2fa6ae);})['then'](function(_0x532c12){_0x1b063a(_0x532c12);})[_0x14e6('0x17')](function(_0xbccead){_0xcd4635(_0x18ab81[_0x14e6('0x11')](0x1f4,_0xbccead[_0x14e6('0x14')]));});});}; \ No newline at end of file +var _0x76d4=['interaction','FaxMessage','ContactId','UserId','unshift','name','waitForTheAssignedAgent','Start','startRouting','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','request\x20sent','stringify','error','FaxAccount,\x20%s,\x20%s','message','info','result','catch','FaxAccount','options','where','attributes','limit','include','map','model','GetFaxAccount','debug','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','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','find','account','CmList','List','DESC','FaxApplication','Applications','get','list','applications','orderBy','Contacts','length','defaults','create','contact','FaxInteraction','Contact\x20not\x20found','autoclose','push','close','*,*,*,*','created'];(function(_0x10327a,_0x27357c){var _0x5d3c6b=function(_0x22584a){while(--_0x22584a){_0x10327a['push'](_0x10327a['shift']());}};_0x5d3c6b(++_0x27357c);}(_0x76d4,0x15d));var _0x476d=function(_0x21cd1d,_0x3ec220){_0x21cd1d=_0x21cd1d-0x0;var _0x512046=_0x76d4[_0x21cd1d];return _0x512046;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x476d('0x0'));var BPromise=require('bluebird');var rs=require(_0x476d('0x1'));var fs=require('fs');var Redis=require(_0x476d('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x476d('0x3'));var config=require(_0x476d('0x4'));var jayson=require(_0x476d('0x5'));var client=jayson[_0x476d('0x6')][_0x476d('0x7')]({'port':0x232c});config[_0x476d('0x8')]=_['defaults'](config['redis'],{'host':_0x476d('0x9'),'port':0x18eb});var socket=require(_0x476d('0xa'))(new Redis(config['redis']));require(_0x476d('0xb'))[_0x476d('0xc')](socket);function respondWithRpcPromise(_0x424a17,_0x524e79,_0x2c9c74){return new BPromise(function(_0x2b6a83,_0x67d118){return client[_0x476d('0xd')](_0x424a17,_0x2c9c74)[_0x476d('0xe')](function(_0x27f9a4){logger['info']('FaxAccount,\x20%s,\x20%s',_0x524e79,_0x476d('0xf'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x524e79,_0x476d('0xf'),JSON[_0x476d('0x10')](_0x27f9a4));if(_0x27f9a4[_0x476d('0x11')]){if(_0x27f9a4[_0x476d('0x11')]['code']===0x1f4){logger[_0x476d('0x11')](_0x476d('0x12'),_0x524e79,_0x27f9a4[_0x476d('0x11')][_0x476d('0x13')]);return _0x67d118(_0x27f9a4[_0x476d('0x11')][_0x476d('0x13')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x524e79,_0x27f9a4[_0x476d('0x11')]['message']);return _0x2b6a83(_0x27f9a4[_0x476d('0x11')][_0x476d('0x13')]);}else{logger[_0x476d('0x14')](_0x476d('0x12'),_0x524e79,_0x476d('0xf'));_0x2b6a83(_0x27f9a4[_0x476d('0x15')]['message']);}})[_0x476d('0x16')](function(_0xa21767){logger[_0x476d('0x11')](_0x476d('0x12'),_0x524e79,_0xa21767);_0x67d118(_0xa21767);});});}exports['GetFaxAccount']=function(_0xf5bec7){var _0x1fd42f=this;return new Promise(function(_0x234c86,_0x452888){return db[_0x476d('0x17')]['findAll']({'raw':_0xf5bec7[_0x476d('0x18')]?_0xf5bec7[_0x476d('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xf5bec7['options']?_0xf5bec7[_0x476d('0x18')][_0x476d('0x19')]||null:null,'attributes':_0xf5bec7[_0x476d('0x18')]?_0xf5bec7[_0x476d('0x18')][_0x476d('0x1a')]||null:null,'limit':_0xf5bec7['options']?_0xf5bec7[_0x476d('0x18')][_0x476d('0x1b')]||null:null,'include':_0xf5bec7[_0x476d('0x18')]?_0xf5bec7[_0x476d('0x18')][_0x476d('0x1c')]?_[_0x476d('0x1d')](_0xf5bec7[_0x476d('0x18')]['include'],function(_0x5aa9a5){return{'model':db[_0x5aa9a5['model']],'as':_0x5aa9a5['as'],'attributes':_0x5aa9a5['attributes'],'include':_0x5aa9a5[_0x476d('0x1c')]?_[_0x476d('0x1d')](_0x5aa9a5[_0x476d('0x1c')],function(_0x1683d4){return{'model':db[_0x1683d4[_0x476d('0x1e')]],'as':_0x1683d4['as'],'attributes':_0x1683d4[_0x476d('0x1a')],'include':_0x1683d4[_0x476d('0x1c')]?_['map'](_0x1683d4[_0x476d('0x1c')],function(_0x9e9dc8){return{'model':db[_0x9e9dc8['model']],'as':_0x9e9dc8['as'],'attributes':_0x9e9dc8[_0x476d('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29e2bc){logger['info'](_0x476d('0x1f'),_0xf5bec7);logger[_0x476d('0x20')]('GetFaxAccount',_0xf5bec7,JSON['stringify'](_0x29e2bc));_0x234c86(_0x29e2bc);})['catch'](function(_0x296088){logger[_0x476d('0x11')](_0x476d('0x1f'),_0x296088[_0x476d('0x13')],_0xf5bec7);_0x452888(_0x1fd42f[_0x476d('0x11')](0x1f4,_0x296088['message']));});});};exports['NotifyFaxAccount']=function(_0x4596f6,_0x168fa8,_0x3eec7c){var _0x494b4b=this;return new Promise(function(_0x1a28f5,_0x57f0ae){var _0x4e91ad={'body':_0x4596f6[_0x476d('0x21')],'channel':_0x476d('0x22')};var _0x337c06=[];var _0x18fe85=[];var _0xb4ce06={};return db[_0x476d('0x23')][_0x476d('0x24')]()['then'](function(_0x3cd27d){if(!_0x3cd27d){throw new db[(_0x476d('0x25'))][(_0x476d('0x26'))](_0x476d('0x27'));}_0x337c06=_[_0x476d('0x28')](_[_0x476d('0x29')](_0x3cd27d),[_0x476d('0x2a'),_0x476d('0x2b')]);_0x18fe85=_['difference'](_['keys'](_0x3cd27d),[_0x476d('0x2a'),_0x476d('0x2b'),_0x476d('0x2c'),_0x476d('0x2d')]);if(_0x4596f6['body']['id']){delete _0x4596f6['body']['id'];}if(_[_0x476d('0x2e')](_0x4596f6[_0x476d('0x21')][_0x476d('0x2f')])){throw new db[(_0x476d('0x25'))][(_0x476d('0x26'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x4596f6[_0x476d('0x21')][_0x476d('0x21')])||_0x4596f6['body'][_0x476d('0x21')]===''){throw new db[(_0x476d('0x25'))]['ValidationError'](_0x476d('0x30'));}if(_['isNil'](_0x4596f6[_0x476d('0x21')][_0x476d('0x31')])){throw new db['Sequelize'][(_0x476d('0x26'))](_0x476d('0x32')+_0x18fe85);}if(!_[_0x476d('0x33')](_0x18fe85,_0x4596f6[_0x476d('0x21')][_0x476d('0x31')])){throw new db[(_0x476d('0x25'))][(_0x476d('0x26'))](_0x476d('0x34')+_0x18fe85);}_0xb4ce06[_0x4596f6[_0x476d('0x21')][_0x476d('0x31')]]=_0x4596f6[_0x476d('0x21')]['from'];})[_0x476d('0xe')](function(){return db[_0x476d('0x17')][_0x476d('0x35')]({'where':{'id':_0x4596f6[_0x476d('0x36')]['id']},'include':[{'model':db[_0x476d('0x37')],'as':_0x476d('0x38'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0xb4ce06,'limit':0x1,'order':[[_0x476d('0x2b'),_0x476d('0x39')]]}]},{'model':db[_0x476d('0x3a')],'as':_0x476d('0x3b')}]});})['then'](function(_0x5aa2f9){if(_0x5aa2f9&&_0x5aa2f9[_0x476d('0x38')]){var _0x27183d=_0x5aa2f9[_0x476d('0x3c')]({'plain':!![]});_0x4e91ad[_0x476d('0x36')]=_0x27183d;_0x4e91ad['applications']=_0x27183d[_0x476d('0x3b')];_0x4e91ad[_0x476d('0x3d')]=_0x27183d[_0x476d('0x38')];_0x4e91ad[_0x476d('0x3e')]=_[_0x476d('0x3f')](_0x4e91ad[_0x476d('0x3e')],['priority'],['asc']);if(_0x4e91ad['account'][_0x476d('0x3b')]){delete _0x4e91ad[_0x476d('0x36')][_0x476d('0x3b')];}if(_0x4e91ad[_0x476d('0x36')][_0x476d('0x38')]&&_0x4e91ad[_0x476d('0x36')][_0x476d('0x38')][_0x476d('0x40')][_0x476d('0x41')]){return _0x4e91ad['account'][_0x476d('0x38')][_0x476d('0x40')][0x0];}var _0x184ea2=_[_0x476d('0x42')](_0x4596f6[_0x476d('0x21')],{'firstName':_0x4596f6[_0x476d('0x21')][_0x476d('0x2f')],'ListId':_0x27183d[_0x476d('0x2d')]});_0x184ea2[_0x4596f6[_0x476d('0x21')]['mapKey']]=_0x4596f6[_0x476d('0x21')][_0x476d('0x2f')];return db['CmContact'][_0x476d('0x43')](_0x184ea2,{'fields':_0x337c06,'raw':!![]});}})['then'](function(_0x291883){_0x4e91ad[_0x476d('0x44')]=_0x291883;if(_0x291883){var _0x456281={'ContactId':_0x291883['id'],'FaxAccountId':_0x4596f6[_0x476d('0x36')]['id'],'fax':_0x291883[_0x476d('0x22')]};return db[_0x476d('0x45')][_0x476d('0x35')]({'where':{'ContactId':_0x291883['id'],'closed':![],'FaxAccountId':_0x4596f6[_0x476d('0x36')]['id']}})['then'](function(_0x317cd7){if(_0x317cd7){return[_0x317cd7,![]];}return db[_0x476d('0x45')]['create'](_0x456281)[_0x476d('0xe')](function(_0x4f5f5c){return[_0x4f5f5c,!![]];});});}else{throw new Error(_0x476d('0x46'));}})['spread'](function(_0x3f8383,_0x48470d){var _0x175b23=_0x3f8383[_0x476d('0x3c')]({'plain':!![]});if(_0x48470d){if(_0x4e91ad[_0x476d('0x36')][_0x476d('0x47')]){_0x4e91ad[_0x476d('0x3e')][_0x476d('0x48')]({'id':0x0,'priority':_0x4e91ad['applications']['length']+0x1,'app':_0x476d('0x49'),'appdata':'unmanaged','interval':_0x476d('0x4a')});}_0x175b23[_0x476d('0x4b')]=!![];}else{_0x175b23[_0x476d('0x4b')]=![];}_0x4e91ad[_0x476d('0x4c')]=_0x175b23;return db[_0x476d('0x4d')]['create']({'body':_0x4596f6[_0x476d('0x21')]['body'],'FaxAccountId':_0x4596f6[_0x476d('0x36')]['id'],'FaxInteractionId':_0x3f8383['id'],'direction':'in','ContactId':_0x3f8383[_0x476d('0x4e')],'AttachmentId':_0x4596f6[_0x476d('0x21')]['AttachmentId']});})[_0x476d('0xe')](function(_0x2a552a){_0x4e91ad[_0x476d('0x13')]=_0x2a552a;if(_0x4e91ad[_0x476d('0x4c')]['UserId']){return db['User'][_0x476d('0x35')]({'attributes':['id','name'],'where':{'id':_0x4e91ad[_0x476d('0x4c')][_0x476d('0x4f')]}})[_0x476d('0xe')](function(_0x5b3941){if(_0x5b3941){_0x4e91ad[_0x476d('0x3e')][_0x476d('0x50')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5b3941[_0x476d('0x51')]+','+(_0x4e91ad['account'][_0x476d('0x52')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x476d('0x53'),_0x476d('0x54'),_0x4e91ad);});}return respondWithRpcPromise(_0x476d('0x53'),_0x476d('0x54'),_0x4e91ad);})[_0x476d('0xe')](function(_0x5eab0f){_0x1a28f5(_0x5eab0f);})[_0x476d('0x16')](function(_0x556bec){_0x57f0ae(_0x494b4b['error'](0x1f4,_0x556bec['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 0e11091..a82adf9 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 _0xd9b0=['./faxAccount.events','save','remove','update','emit','register','faxAccount:'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd9b0,0x15e));var _0x0d9b=function(_0x4e340d,_0x227f30){_0x4e340d=_0x4e340d-0x0;var _0x322209=_0xd9b0[_0x4e340d];return _0x322209;};'use strict';var FaxAccountEvents=require(_0x0d9b('0x0'));var events=[_0x0d9b('0x1'),_0x0d9b('0x2'),_0x0d9b('0x3')];function createListener(_0x5e84d7,_0x5bb613){return function(_0x328d2c){_0x5bb613[_0x0d9b('0x4')](_0x5e84d7,_0x328d2c);};}function removeListener(_0x59122c,_0x52e0ec){return function(){FaxAccountEvents['removeListener'](_0x59122c,_0x52e0ec);};}exports[_0x0d9b('0x5')]=function(_0x3dba45){for(var _0x35ee80=0x0,_0x54a5e4=events['length'];_0x35ee80<_0x54a5e4;_0x35ee80++){var _0xa36779=events[_0x35ee80];var _0x401aac=createListener(_0x0d9b('0x6')+_0xa36779,_0x3dba45);FaxAccountEvents['on'](_0xa36779,_0x401aac);}}; \ No newline at end of file +var _0x67d3=['save','remove','faxAccount:','./faxAccount.events'];(function(_0x312cbf,_0x2a7414){var _0x12dbb9=function(_0x3f3298){while(--_0x3f3298){_0x312cbf['push'](_0x312cbf['shift']());}};_0x12dbb9(++_0x2a7414);}(_0x67d3,0x1b3));var _0x367d=function(_0x4c7e61,_0x5bdb5c){_0x4c7e61=_0x4c7e61-0x0;var _0x432e54=_0x67d3[_0x4c7e61];return _0x432e54;};'use strict';var FaxAccountEvents=require(_0x367d('0x0'));var events=[_0x367d('0x1'),_0x367d('0x2'),'update'];function createListener(_0x1727a2,_0x48459e){return function(_0x1d8b52){_0x48459e['emit'](_0x1727a2,_0x1d8b52);};}function removeListener(_0x14419f,_0xc3bea2){return function(){FaxAccountEvents['removeListener'](_0x14419f,_0xc3bea2);};}exports['register']=function(_0x5ba28c){for(var _0x3bfa06=0x0,_0x332cec=events['length'];_0x3bfa06<_0x332cec;_0x3bfa06++){var _0x1e244d=events[_0x3bfa06];var _0x59082b=createListener(_0x367d('0x3')+_0x1e244d,_0x5ba28c);FaxAccountEvents['on'](_0x1e244d,_0x59082b);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index f0a569f..2b02077 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(_0x573a47,_0x1e909b){var _0x4b232e=function(_0x198995){while(--_0x198995){_0x573a47['push'](_0x573a47['shift']());}};_0x4b232e(++_0x1e909b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/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(_0x148ad8,_0x1b3a24){var _0x137b12=function(_0x388c0f){while(--_0x388c0f){_0x148ad8['push'](_0x148ad8['shift']());}};_0x137b12(++_0x1b3a24);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),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 0745ade..eb67bf2 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 _0xfdd0=['*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x1839c9,_0x4ec3cc){var _0x1e5e5c=function(_0x25272d){while(--_0x25272d){_0x1839c9['push'](_0x1839c9['shift']());}};_0x1e5e5c(++_0x4ec3cc);}(_0xfdd0,0xd8));var _0x0fdd=function(_0x59566d,_0x3640b7){_0x59566d=_0x59566d-0x0;var _0x139267=_0xfdd0[_0x59566d];return _0x139267;};'use strict';var Sequelize=require(_0x0fdd('0x0'));module[_0x0fdd('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0fdd('0x2')],'allowNull':![],'defaultValue':_0x0fdd('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x0fdd('0x2')]},'interval':{'type':Sequelize[_0x0fdd('0x2')],'defaultValue':_0x0fdd('0x4')}}; \ No newline at end of file +var _0x06e1=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x45f2e1,_0x48b816){var _0x461542=function(_0x3ec96e){while(--_0x3ec96e){_0x45f2e1['push'](_0x45f2e1['shift']());}};_0x461542(++_0x48b816);}(_0x06e1,0x151));var _0x106e=function(_0x4ae76c,_0x334943){_0x4ae76c=_0x4ae76c-0x0;var _0x5ebfea=_0x06e1[_0x4ae76c];return _0x5ebfea;};'use strict';var Sequelize=require(_0x106e('0x0'));module[_0x106e('0x1')]={'priority':{'type':Sequelize[_0x106e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x106e('0x3')],'allowNull':![],'defaultValue':_0x106e('0x4')},'appdata':{'type':Sequelize[_0x106e('0x5')]()},'description':{'type':Sequelize[_0x106e('0x3')]},'interval':{'type':Sequelize[_0x106e('0x3')],'defaultValue':_0x106e('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 16cc3ef..f0c18de 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 _0x56f5=['../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','end','error','name','send','index','map','FaxApplication','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','include','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x39cc4c,_0x184236){var _0x524221=function(_0x3e94c3){while(--_0x3e94c3){_0x39cc4c['push'](_0x39cc4c['shift']());}};_0x524221(++_0x184236);}(_0x56f5,0x105));var _0x556f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x56f5[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x556f('0x0'));var rimraf=require(_0x556f('0x1'));var zipdir=require(_0x556f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x556f('0x3'));var moment=require(_0x556f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x556f('0x5'));var csv=require('to-csv');var ejs=require(_0x556f('0x6'));var fs=require('fs');var fs_extra=require(_0x556f('0x7'));var _=require(_0x556f('0x8'));var squel=require(_0x556f('0x9'));var crypto=require(_0x556f('0xa'));var jsforce=require(_0x556f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x556f('0xc'));var querystring=require(_0x556f('0xd'));var Papa=require(_0x556f('0xe'));var Redis=require(_0x556f('0xf'));var authService=require(_0x556f('0x10'));var qs=require(_0x556f('0x11'));var as=require(_0x556f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x556f('0x13'))('api');var utils=require(_0x556f('0x14'));var config=require(_0x556f('0x15'));var licenseUtil=require(_0x556f('0x16'));var db=require(_0x556f('0x17'))['db'];function respondWithStatusCode(_0x83cc88,_0x55cb31){_0x55cb31=_0x55cb31||0xcc;return function(_0x5b0550){if(_0x5b0550){return _0x83cc88[_0x556f('0x18')](_0x55cb31);}return _0x83cc88[_0x556f('0x19')](_0x55cb31)['end']();};}function respondWithResult(_0x4d8297,_0x3ffcb3){_0x3ffcb3=_0x3ffcb3||0xc8;return function(_0x3a7a4a){if(_0x3a7a4a){return _0x4d8297[_0x556f('0x19')](_0x3ffcb3)['json'](_0x3a7a4a);}};}function respondWithFilteredResult(_0x681a1d,_0x44fc67){return function(_0x8fe6d4){if(_0x8fe6d4){var _0x149acc=typeof _0x44fc67[_0x556f('0x1a')]===_0x556f('0x1b')&&typeof _0x44fc67[_0x556f('0x1c')]===_0x556f('0x1b');var _0x223113=_0x8fe6d4[_0x556f('0x1d')];var _0x50a4ea=_0x149acc?0x0:_0x44fc67[_0x556f('0x1a')];var _0x222652=_0x149acc?_0x8fe6d4['count']:_0x44fc67[_0x556f('0x1a')]+_0x44fc67[_0x556f('0x1c')];var _0x498f96;if(_0x222652>=_0x223113){_0x222652=_0x223113;_0x498f96=0xc8;}else{_0x498f96=0xce;}_0x681a1d[_0x556f('0x19')](_0x498f96);return _0x681a1d[_0x556f('0x1e')](_0x556f('0x1f'),_0x50a4ea+'-'+_0x222652+'/'+_0x223113)[_0x556f('0x20')](_0x8fe6d4);}return null;};}function patchUpdates(_0x461ced){return function(_0x1d84d8){try{jsonpatch[_0x556f('0x21')](_0x1d84d8,_0x461ced,!![]);}catch(_0x159cbc){return BPromise[_0x556f('0x22')](_0x159cbc);}return _0x1d84d8['save']();};}function saveUpdates(_0x59b552,_0xf866b0){return function(_0x1f02ad){if(_0x1f02ad){return _0x1f02ad[_0x556f('0x23')](_0x59b552)[_0x556f('0x24')](function(_0x1a3917){return _0x1a3917;});}return null;};}function removeEntity(_0x8c2d2c,_0x53198d){return function(_0x1e19b9){if(_0x1e19b9){return _0x1e19b9[_0x556f('0x25')]()[_0x556f('0x24')](function(){_0x8c2d2c[_0x556f('0x19')](0xcc)[_0x556f('0x26')]();});}};}function handleEntityNotFound(_0x8b5231,_0x2e38b2){return function(_0x23f11f){if(!_0x23f11f){_0x8b5231[_0x556f('0x18')](0x194);}return _0x23f11f;};}function handleError(_0x1e9987,_0x38cbc9){_0x38cbc9=_0x38cbc9||0x1f4;return function(_0x4f9bcc){logger[_0x556f('0x27')](_0x4f9bcc['stack']);if(_0x4f9bcc[_0x556f('0x28')]){delete _0x4f9bcc[_0x556f('0x28')];}_0x1e9987[_0x556f('0x19')](_0x38cbc9)[_0x556f('0x29')](_0x4f9bcc);};}exports[_0x556f('0x2a')]=function(_0x1d63f0,_0x20ae34){var _0xbdabfd={},_0xb05fe8={},_0x4d2620={'count':0x0,'rows':[]};var _0x10c911=_[_0x556f('0x2b')](db[_0x556f('0x2c')][_0x556f('0x2d')],function(_0x5eb33b){return{'name':_0x5eb33b[_0x556f('0x2e')],'type':_0x5eb33b['type'][_0x556f('0x2f')]};});_0xb05fe8[_0x556f('0x30')]=_[_0x556f('0x2b')](_0x10c911,_0x556f('0x28'));_0xb05fe8[_0x556f('0x31')]=_[_0x556f('0x32')](_0x1d63f0[_0x556f('0x31')]);_0xb05fe8[_0x556f('0x33')]=_[_0x556f('0x34')](_0xb05fe8[_0x556f('0x30')],_0xb05fe8[_0x556f('0x31')]);_0xbdabfd[_0x556f('0x35')]=_[_0x556f('0x34')](_0xb05fe8[_0x556f('0x30')],qs['fields'](_0x1d63f0[_0x556f('0x31')][_0x556f('0x36')]));_0xbdabfd['attributes']=_0xbdabfd[_0x556f('0x35')][_0x556f('0x37')]?_0xbdabfd[_0x556f('0x35')]:_0xb05fe8[_0x556f('0x30')];if(!_0x1d63f0[_0x556f('0x31')][_0x556f('0x38')](_0x556f('0x39'))){_0xbdabfd[_0x556f('0x1c')]=qs['limit'](_0x1d63f0['query'][_0x556f('0x1c')]);_0xbdabfd[_0x556f('0x1a')]=qs['offset'](_0x1d63f0['query'][_0x556f('0x1a')]);}_0xbdabfd['order']=qs[_0x556f('0x3a')](_0x1d63f0['query']['sort']);_0xbdabfd[_0x556f('0x3b')]=qs['filters'](_['pick'](_0x1d63f0[_0x556f('0x31')],_0xb05fe8[_0x556f('0x33')]),_0x10c911);if(_0x1d63f0['query'][_0x556f('0x3c')]){_0xbdabfd['where']=_[_0x556f('0x3d')](_0xbdabfd[_0x556f('0x3b')],{'$or':_[_0x556f('0x2b')](_0x10c911,function(_0xfad923){if(_0xfad923['type']!==_0x556f('0x3e')){var _0x1ded57={};_0x1ded57[_0xfad923[_0x556f('0x28')]]={'$like':'%'+_0x1d63f0['query'][_0x556f('0x3c')]+'%'};return _0x1ded57;}})});}_0xbdabfd=_[_0x556f('0x3d')]({},_0xbdabfd,_0x1d63f0['options']);var _0x4cd9d0={'where':_0xbdabfd[_0x556f('0x3b')]};return db['FaxApplication'][_0x556f('0x1d')](_0x4cd9d0)[_0x556f('0x24')](function(_0x19f23c){_0x4d2620[_0x556f('0x1d')]=_0x19f23c;if(_0x1d63f0['query'][_0x556f('0x3f')]){_0xbdabfd[_0x556f('0x40')]=[{'all':!![]}];}return db[_0x556f('0x2c')]['findAll'](_0xbdabfd);})['then'](function(_0x38f22b){_0x4d2620['rows']=_0x38f22b;return _0x4d2620;})['then'](respondWithFilteredResult(_0x20ae34,_0xbdabfd))[_0x556f('0x41')](handleError(_0x20ae34,null));};exports[_0x556f('0x42')]=function(_0x4feae9,_0x449cfe){var _0xd0a0b={'raw':!![],'where':{'id':_0x4feae9[_0x556f('0x43')]['id']}},_0x5c0d09={};_0x5c0d09[_0x556f('0x30')]=_['keys'](db[_0x556f('0x2c')]['rawAttributes']);_0x5c0d09['query']=_[_0x556f('0x32')](_0x4feae9['query']);_0x5c0d09[_0x556f('0x33')]=_[_0x556f('0x34')](_0x5c0d09['model'],_0x5c0d09[_0x556f('0x31')]);_0xd0a0b[_0x556f('0x35')]=_[_0x556f('0x34')](_0x5c0d09[_0x556f('0x30')],qs['fields'](_0x4feae9[_0x556f('0x31')][_0x556f('0x36')]));_0xd0a0b['attributes']=_0xd0a0b[_0x556f('0x35')][_0x556f('0x37')]?_0xd0a0b[_0x556f('0x35')]:_0x5c0d09[_0x556f('0x30')];if(_0x4feae9['query'][_0x556f('0x3f')]){_0xd0a0b[_0x556f('0x40')]=[{'all':!![]}];}_0xd0a0b=_[_0x556f('0x3d')]({},_0xd0a0b,_0x4feae9['options']);return db[_0x556f('0x2c')][_0x556f('0x44')](_0xd0a0b)[_0x556f('0x24')](handleEntityNotFound(_0x449cfe,null))[_0x556f('0x24')](respondWithResult(_0x449cfe,null))[_0x556f('0x41')](handleError(_0x449cfe,null));};exports[_0x556f('0x45')]=function(_0x559388,_0x5d9b1d){return db[_0x556f('0x2c')][_0x556f('0x45')](_0x559388[_0x556f('0x46')],{})['then'](respondWithResult(_0x5d9b1d,0xc9))[_0x556f('0x41')](handleError(_0x5d9b1d,null));};exports[_0x556f('0x23')]=function(_0x592631,_0x227109){if(_0x592631['body']['id']){delete _0x592631[_0x556f('0x46')]['id'];}return db['FaxApplication']['find']({'where':{'id':_0x592631[_0x556f('0x43')]['id']}})[_0x556f('0x24')](handleEntityNotFound(_0x227109,null))[_0x556f('0x24')](saveUpdates(_0x592631['body'],null))[_0x556f('0x24')](respondWithResult(_0x227109,null))['catch'](handleError(_0x227109,null));};exports[_0x556f('0x25')]=function(_0x5d7b24,_0x5d1bb9){return db[_0x556f('0x2c')][_0x556f('0x44')]({'where':{'id':_0x5d7b24[_0x556f('0x43')]['id']}})[_0x556f('0x24')](handleEntityNotFound(_0x5d1bb9,null))[_0x556f('0x24')](removeEntity(_0x5d1bb9,null))[_0x556f('0x41')](handleError(_0x5d1bb9,null));}; \ No newline at end of file +var _0x0d4d=['json','offset','undefined','limit','count','reject','update','then','destroy','error','stack','name','send','index','map','FaxApplication','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end'];(function(_0x5261b3,_0x2ffbcc){var _0x491a5b=function(_0x3c0b45){while(--_0x3c0b45){_0x5261b3['push'](_0x5261b3['shift']());}};_0x491a5b(++_0x2ffbcc);}(_0x0d4d,0x74));var _0xd0d4=function(_0xff1de9,_0x15171d){_0xff1de9=_0xff1de9-0x0;var _0x25f9dd=_0x0d4d[_0xff1de9];return _0x25f9dd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd0d4('0x0'));var zipdir=require(_0xd0d4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd0d4('0x2'));var moment=require(_0xd0d4('0x3'));var BPromise=require(_0xd0d4('0x4'));var Mustache=require(_0xd0d4('0x5'));var util=require(_0xd0d4('0x6'));var path=require('path');var sox=require(_0xd0d4('0x7'));var csv=require(_0xd0d4('0x8'));var ejs=require(_0xd0d4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd0d4('0xa'));var squel=require(_0xd0d4('0xb'));var crypto=require(_0xd0d4('0xc'));var jsforce=require(_0xd0d4('0xd'));var deskjs=require(_0xd0d4('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd0d4('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd0d4('0x10'));var qs=require(_0xd0d4('0x11'));var as=require(_0xd0d4('0x12'));var hardwareService=require(_0xd0d4('0x13'));var logger=require(_0xd0d4('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xd0d4('0x15'));var licenseUtil=require(_0xd0d4('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8a2273,_0x35654c){_0x35654c=_0x35654c||0xcc;return function(_0x2e5124){if(_0x2e5124){return _0x8a2273[_0xd0d4('0x17')](_0x35654c);}return _0x8a2273[_0xd0d4('0x18')](_0x35654c)[_0xd0d4('0x19')]();};}function respondWithResult(_0x2c9979,_0x1a08ef){_0x1a08ef=_0x1a08ef||0xc8;return function(_0x579c17){if(_0x579c17){return _0x2c9979[_0xd0d4('0x18')](_0x1a08ef)[_0xd0d4('0x1a')](_0x579c17);}};}function respondWithFilteredResult(_0x1cc813,_0x2c8184){return function(_0x139b98){if(_0x139b98){var _0x38e916=typeof _0x2c8184[_0xd0d4('0x1b')]===_0xd0d4('0x1c')&&typeof _0x2c8184[_0xd0d4('0x1d')]===_0xd0d4('0x1c');var _0x567276=_0x139b98[_0xd0d4('0x1e')];var _0x3ed595=_0x38e916?0x0:_0x2c8184[_0xd0d4('0x1b')];var _0x127601=_0x38e916?_0x139b98['count']:_0x2c8184[_0xd0d4('0x1b')]+_0x2c8184[_0xd0d4('0x1d')];var _0x4f52ee;if(_0x127601>=_0x567276){_0x127601=_0x567276;_0x4f52ee=0xc8;}else{_0x4f52ee=0xce;}_0x1cc813[_0xd0d4('0x18')](_0x4f52ee);return _0x1cc813['set']('Content-Range',_0x3ed595+'-'+_0x127601+'/'+_0x567276)[_0xd0d4('0x1a')](_0x139b98);}return null;};}function patchUpdates(_0x1716e0){return function(_0x33fc88){try{jsonpatch['apply'](_0x33fc88,_0x1716e0,!![]);}catch(_0x51544a){return BPromise[_0xd0d4('0x1f')](_0x51544a);}return _0x33fc88['save']();};}function saveUpdates(_0x155d44,_0x15ba60){return function(_0x3fdc8c){if(_0x3fdc8c){return _0x3fdc8c[_0xd0d4('0x20')](_0x155d44)[_0xd0d4('0x21')](function(_0x56fceb){return _0x56fceb;});}return null;};}function removeEntity(_0x604040,_0x4d01f2){return function(_0x2fc01d){if(_0x2fc01d){return _0x2fc01d[_0xd0d4('0x22')]()['then'](function(){_0x604040[_0xd0d4('0x18')](0xcc)[_0xd0d4('0x19')]();});}};}function handleEntityNotFound(_0x3f3abb,_0x16a897){return function(_0xc76b71){if(!_0xc76b71){_0x3f3abb['sendStatus'](0x194);}return _0xc76b71;};}function handleError(_0xe8c18b,_0xb1a1a9){_0xb1a1a9=_0xb1a1a9||0x1f4;return function(_0x539589){logger[_0xd0d4('0x23')](_0x539589[_0xd0d4('0x24')]);if(_0x539589[_0xd0d4('0x25')]){delete _0x539589[_0xd0d4('0x25')];}_0xe8c18b['status'](_0xb1a1a9)[_0xd0d4('0x26')](_0x539589);};}exports[_0xd0d4('0x27')]=function(_0x27103a,_0x57d5ac){var _0x52f70d={},_0x5d3e41={},_0x1cad0f={'count':0x0,'rows':[]};var _0x3afb78=_[_0xd0d4('0x28')](db[_0xd0d4('0x29')]['rawAttributes'],function(_0x4f3fd5){return{'name':_0x4f3fd5[_0xd0d4('0x2a')],'type':_0x4f3fd5[_0xd0d4('0x2b')][_0xd0d4('0x2c')]};});_0x5d3e41[_0xd0d4('0x2d')]=_[_0xd0d4('0x28')](_0x3afb78,'name');_0x5d3e41[_0xd0d4('0x2e')]=_[_0xd0d4('0x2f')](_0x27103a[_0xd0d4('0x2e')]);_0x5d3e41[_0xd0d4('0x30')]=_['intersection'](_0x5d3e41[_0xd0d4('0x2d')],_0x5d3e41[_0xd0d4('0x2e')]);_0x52f70d[_0xd0d4('0x31')]=_[_0xd0d4('0x32')](_0x5d3e41[_0xd0d4('0x2d')],qs[_0xd0d4('0x33')](_0x27103a[_0xd0d4('0x2e')][_0xd0d4('0x33')]));_0x52f70d[_0xd0d4('0x31')]=_0x52f70d['attributes'][_0xd0d4('0x34')]?_0x52f70d[_0xd0d4('0x31')]:_0x5d3e41['model'];if(!_0x27103a[_0xd0d4('0x2e')][_0xd0d4('0x35')](_0xd0d4('0x36'))){_0x52f70d[_0xd0d4('0x1d')]=qs[_0xd0d4('0x1d')](_0x27103a[_0xd0d4('0x2e')][_0xd0d4('0x1d')]);_0x52f70d['offset']=qs['offset'](_0x27103a[_0xd0d4('0x2e')][_0xd0d4('0x1b')]);}_0x52f70d[_0xd0d4('0x37')]=qs[_0xd0d4('0x38')](_0x27103a[_0xd0d4('0x2e')][_0xd0d4('0x38')]);_0x52f70d[_0xd0d4('0x39')]=qs[_0xd0d4('0x30')](_['pick'](_0x27103a['query'],_0x5d3e41[_0xd0d4('0x30')]),_0x3afb78);if(_0x27103a[_0xd0d4('0x2e')][_0xd0d4('0x3a')]){_0x52f70d[_0xd0d4('0x39')]=_[_0xd0d4('0x3b')](_0x52f70d['where'],{'$or':_[_0xd0d4('0x28')](_0x3afb78,function(_0x265ab9){if(_0x265ab9['type']!=='VIRTUAL'){var _0x2fa926={};_0x2fa926[_0x265ab9['name']]={'$like':'%'+_0x27103a[_0xd0d4('0x2e')][_0xd0d4('0x3a')]+'%'};return _0x2fa926;}})});}_0x52f70d=_[_0xd0d4('0x3b')]({},_0x52f70d,_0x27103a[_0xd0d4('0x3c')]);var _0x308093={'where':_0x52f70d['where']};return db['FaxApplication'][_0xd0d4('0x1e')](_0x308093)[_0xd0d4('0x21')](function(_0x35ca67){_0x1cad0f[_0xd0d4('0x1e')]=_0x35ca67;if(_0x27103a[_0xd0d4('0x2e')]['includeAll']){_0x52f70d[_0xd0d4('0x3d')]=[{'all':!![]}];}return db[_0xd0d4('0x29')][_0xd0d4('0x3e')](_0x52f70d);})['then'](function(_0xfca8ac){_0x1cad0f[_0xd0d4('0x3f')]=_0xfca8ac;return _0x1cad0f;})[_0xd0d4('0x21')](respondWithFilteredResult(_0x57d5ac,_0x52f70d))[_0xd0d4('0x40')](handleError(_0x57d5ac,null));};exports['show']=function(_0x48b63d,_0x4169de){var _0x176c67={'raw':!![],'where':{'id':_0x48b63d[_0xd0d4('0x41')]['id']}},_0x3036a3={};_0x3036a3[_0xd0d4('0x2d')]=_['keys'](db[_0xd0d4('0x29')][_0xd0d4('0x42')]);_0x3036a3[_0xd0d4('0x2e')]=_['keys'](_0x48b63d[_0xd0d4('0x2e')]);_0x3036a3[_0xd0d4('0x30')]=_[_0xd0d4('0x32')](_0x3036a3[_0xd0d4('0x2d')],_0x3036a3['query']);_0x176c67['attributes']=_['intersection'](_0x3036a3[_0xd0d4('0x2d')],qs[_0xd0d4('0x33')](_0x48b63d[_0xd0d4('0x2e')][_0xd0d4('0x33')]));_0x176c67[_0xd0d4('0x31')]=_0x176c67['attributes'][_0xd0d4('0x34')]?_0x176c67['attributes']:_0x3036a3[_0xd0d4('0x2d')];if(_0x48b63d[_0xd0d4('0x2e')][_0xd0d4('0x43')]){_0x176c67[_0xd0d4('0x3d')]=[{'all':!![]}];}_0x176c67=_[_0xd0d4('0x3b')]({},_0x176c67,_0x48b63d[_0xd0d4('0x3c')]);return db[_0xd0d4('0x29')][_0xd0d4('0x44')](_0x176c67)['then'](handleEntityNotFound(_0x4169de,null))['then'](respondWithResult(_0x4169de,null))[_0xd0d4('0x40')](handleError(_0x4169de,null));};exports[_0xd0d4('0x45')]=function(_0x57c6e3,_0x55ba63){return db[_0xd0d4('0x29')]['create'](_0x57c6e3[_0xd0d4('0x46')],{})['then'](respondWithResult(_0x55ba63,0xc9))[_0xd0d4('0x40')](handleError(_0x55ba63,null));};exports[_0xd0d4('0x20')]=function(_0x32b10b,_0x434f08){if(_0x32b10b['body']['id']){delete _0x32b10b[_0xd0d4('0x46')]['id'];}return db[_0xd0d4('0x29')][_0xd0d4('0x44')]({'where':{'id':_0x32b10b[_0xd0d4('0x41')]['id']}})[_0xd0d4('0x21')](handleEntityNotFound(_0x434f08,null))[_0xd0d4('0x21')](saveUpdates(_0x32b10b[_0xd0d4('0x46')],null))[_0xd0d4('0x21')](respondWithResult(_0x434f08,null))[_0xd0d4('0x40')](handleError(_0x434f08,null));};exports[_0xd0d4('0x22')]=function(_0x1383b2,_0x25df0a){return db[_0xd0d4('0x29')][_0xd0d4('0x44')]({'where':{'id':_0x1383b2[_0xd0d4('0x41')]['id']}})[_0xd0d4('0x21')](handleEntityNotFound(_0x25df0a,null))[_0xd0d4('0x21')](removeEntity(_0x25df0a,null))[_0xd0d4('0x40')](handleError(_0x25df0a,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 668dbbc..a2b4a52 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 _0x5040=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x629775,_0x125f3b){var _0x1963cc=function(_0x4ae2f2){while(--_0x4ae2f2){_0x629775['push'](_0x629775['shift']());}};_0x1963cc(++_0x125f3b);}(_0x5040,0x14f));var _0x0504=function(_0x2a8759,_0x2118e0){_0x2a8759=_0x2a8759-0x0;var _0x4c96e4=_0x5040[_0x2a8759];return _0x4c96e4;};'use strict';var _=require(_0x0504('0x0'));var util=require('util');var logger=require(_0x0504('0x1'))(_0x0504('0x2'));var moment=require(_0x0504('0x3'));var BPromise=require(_0x0504('0x4'));var rp=require(_0x0504('0x5'));var fs=require('fs');var path=require(_0x0504('0x6'));var rimraf=require(_0x0504('0x7'));var config=require(_0x0504('0x8'));var attributes=require('./faxApplication.attributes');module[_0x0504('0x9')]=function(_0x149771,_0x38455e){return _0x149771[_0x0504('0xa')]('FaxApplication',attributes,{'tableName':_0x0504('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0504('0xc'),'collate':_0x0504('0xd')});}; \ No newline at end of file +var _0x8356=['request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','utf8mb4','util','../../config/logger','api','moment'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x8356,0x8b));var _0x6835=function(_0xc0cbf,_0x22f493){_0xc0cbf=_0xc0cbf-0x0;var _0x24a0ac=_0x8356[_0xc0cbf];return _0x24a0ac;};'use strict';var _=require('lodash');var util=require(_0x6835('0x0'));var logger=require(_0x6835('0x1'))(_0x6835('0x2'));var moment=require(_0x6835('0x3'));var BPromise=require('bluebird');var rp=require(_0x6835('0x4'));var fs=require('fs');var path=require(_0x6835('0x5'));var rimraf=require(_0x6835('0x6'));var config=require(_0x6835('0x7'));var attributes=require(_0x6835('0x8'));module[_0x6835('0x9')]=function(_0x47573e,_0x256315){return _0x47573e[_0x6835('0xa')]('FaxApplication',attributes,{'tableName':_0x6835('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6835('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 267352e..13f7bee 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 _0xfd7b=['request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','FaxApplication','update','options','attributes','info','UpdateFaxApplication','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','FaxApplication,\x20%s,\x20%s'];(function(_0x543242,_0xeac9fd){var _0x4c99b6=function(_0x47d087){while(--_0x47d087){_0x543242['push'](_0x543242['shift']());}};_0x4c99b6(++_0xeac9fd);}(_0xfd7b,0x1b3));var _0xbfd7=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xfd7b[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0xbfd7('0x0'));var moment=require(_0xbfd7('0x1'));var BPromise=require('bluebird');var rs=require(_0xbfd7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbfd7('0x3'))['db'];var utils=require(_0xbfd7('0x4'));var logger=require(_0xbfd7('0x5'))(_0xbfd7('0x6'));var config=require(_0xbfd7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbfd7('0x8')][_0xbfd7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d98e3,_0x2cda4e,_0x30e2d0){return new BPromise(function(_0x2f1d38,_0x3e1ab3){return client[_0xbfd7('0xa')](_0x4d98e3,_0x30e2d0)[_0xbfd7('0xb')](function(_0x185637){logger['info'](_0xbfd7('0xc'),_0x2cda4e,_0xbfd7('0xd'));logger[_0xbfd7('0xe')](_0xbfd7('0xf'),_0x2cda4e,_0xbfd7('0xd'),JSON[_0xbfd7('0x10')](_0x185637));if(_0x185637[_0xbfd7('0x11')]){if(_0x185637[_0xbfd7('0x11')][_0xbfd7('0x12')]===0x1f4){logger[_0xbfd7('0x11')](_0xbfd7('0xc'),_0x2cda4e,_0x185637['error'][_0xbfd7('0x13')]);return _0x3e1ab3(_0x185637[_0xbfd7('0x11')][_0xbfd7('0x13')]);}logger[_0xbfd7('0x11')]('FaxApplication,\x20%s,\x20%s',_0x2cda4e,_0x185637[_0xbfd7('0x11')][_0xbfd7('0x13')]);return _0x2f1d38(_0x185637[_0xbfd7('0x11')][_0xbfd7('0x13')]);}else{logger['info'](_0xbfd7('0xc'),_0x2cda4e,'request\x20sent');_0x2f1d38(_0x185637[_0xbfd7('0x14')]['message']);}})['catch'](function(_0x3a7d33){logger[_0xbfd7('0x11')]('FaxApplication,\x20%s,\x20%s',_0x2cda4e,_0x3a7d33);_0x3e1ab3(_0x3a7d33);});});}exports['UpdateFaxApplication']=function(_0x3646e0){var _0x481d67=this;return new Promise(function(_0x2c78fb,_0x240590){return db[_0xbfd7('0x15')][_0xbfd7('0x16')](_0x3646e0['body'],{'raw':_0x3646e0[_0xbfd7('0x17')]?_0x3646e0[_0xbfd7('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3646e0['options']?_0x3646e0[_0xbfd7('0x17')]['where']||null:null,'attributes':_0x3646e0[_0xbfd7('0x17')]?_0x3646e0[_0xbfd7('0x17')][_0xbfd7('0x18')]||null:null,'limit':_0x3646e0[_0xbfd7('0x17')]?_0x3646e0['options']['limit']||null:null})[_0xbfd7('0xb')](function(_0x71dd88){logger[_0xbfd7('0x19')](_0xbfd7('0x1a'),_0x3646e0);logger[_0xbfd7('0xe')](_0xbfd7('0x1a'),_0x3646e0,JSON[_0xbfd7('0x10')](_0x71dd88));_0x2c78fb(_0x71dd88);})[_0xbfd7('0x1b')](function(_0x389fd8){logger[_0xbfd7('0x11')](_0xbfd7('0x1a'),_0x389fd8['message'],_0x3646e0);_0x240590(_0x481d67['error'](0x1f4,_0x389fd8[_0xbfd7('0x13')]));});});}; \ No newline at end of file +var _0x1737=['FaxApplication','update','options','raw','where','attributes','limit','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','FaxApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','UpdateFaxApplication'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x1737,0x147));var _0x7173=function(_0xeaec2f,_0x3e1f29){_0xeaec2f=_0xeaec2f-0x0;var _0xc69a94=_0x1737[_0xeaec2f];return _0xc69a94;};'use strict';var _=require(_0x7173('0x0'));var util=require(_0x7173('0x1'));var moment=require('moment');var BPromise=require(_0x7173('0x2'));var rs=require(_0x7173('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7173('0x4'))['db'];var utils=require(_0x7173('0x5'));var logger=require('../../config/logger')(_0x7173('0x6'));var config=require('../../config/environment');var jayson=require(_0x7173('0x7'));var client=jayson[_0x7173('0x8')][_0x7173('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3029ee,_0x2e3a78,_0x3e1f34){return new BPromise(function(_0x3c97f9,_0x2e9520){return client['request'](_0x3029ee,_0x3e1f34)[_0x7173('0xa')](function(_0x104bfa){logger[_0x7173('0xb')](_0x7173('0xc'),_0x2e3a78,'request\x20sent');logger[_0x7173('0xd')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x2e3a78,_0x7173('0xe'),JSON[_0x7173('0xf')](_0x104bfa));if(_0x104bfa[_0x7173('0x10')]){if(_0x104bfa['error'][_0x7173('0x11')]===0x1f4){logger[_0x7173('0x10')](_0x7173('0xc'),_0x2e3a78,_0x104bfa['error'][_0x7173('0x12')]);return _0x2e9520(_0x104bfa[_0x7173('0x10')][_0x7173('0x12')]);}logger[_0x7173('0x10')](_0x7173('0xc'),_0x2e3a78,_0x104bfa['error']['message']);return _0x3c97f9(_0x104bfa['error'][_0x7173('0x12')]);}else{logger[_0x7173('0xb')](_0x7173('0xc'),_0x2e3a78,_0x7173('0xe'));_0x3c97f9(_0x104bfa[_0x7173('0x13')][_0x7173('0x12')]);}})['catch'](function(_0x351eb6){logger['error'](_0x7173('0xc'),_0x2e3a78,_0x351eb6);_0x2e9520(_0x351eb6);});});}exports[_0x7173('0x14')]=function(_0x8fbc82){var _0x39a7ae=this;return new Promise(function(_0x460d81,_0x1ea347){return db[_0x7173('0x15')][_0x7173('0x16')](_0x8fbc82['body'],{'raw':_0x8fbc82[_0x7173('0x17')]?_0x8fbc82[_0x7173('0x17')][_0x7173('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8fbc82[_0x7173('0x17')]?_0x8fbc82[_0x7173('0x17')][_0x7173('0x19')]||null:null,'attributes':_0x8fbc82[_0x7173('0x17')]?_0x8fbc82[_0x7173('0x17')][_0x7173('0x1a')]||null:null,'limit':_0x8fbc82[_0x7173('0x17')]?_0x8fbc82[_0x7173('0x17')][_0x7173('0x1b')]||null:null})['then'](function(_0x5e6373){logger['info']('UpdateFaxApplication',_0x8fbc82);logger[_0x7173('0xd')](_0x7173('0x14'),_0x8fbc82,JSON[_0x7173('0xf')](_0x5e6373));_0x460d81(_0x5e6373);})[_0x7173('0x1c')](function(_0x4cd687){logger[_0x7173('0x10')]('UpdateFaxApplication',_0x4cd687[_0x7173('0x12')],_0x8fbc82);_0x1ea347(_0x39a7ae['error'](0x1f4,_0x4cd687['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 54d7cc3..d9422c4 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 _0xb688=['show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','index','/:id','isAuthenticated'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0xb688,0xcf));var _0x8b68=function(_0x223009,_0x14c52f){_0x223009=_0x223009-0x0;var _0x4c1ec9=_0xb688[_0x223009];return _0x4c1ec9;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var fs_extra=require(_0x8b68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var controller=require(_0x8b68('0x8'));router[_0x8b68('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['get'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xd')]);router[_0x8b68('0xe')]('/',auth[_0x8b68('0xc')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x10')](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x12')](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller['destroy']);module[_0x8b68('0x13')]=router; \ No newline at end of file +var _0xd4a2=['../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','connect-timeout','Router'];(function(_0x2b04ad,_0x1eb795){var _0x527e6f=function(_0xd7195f){while(--_0xd7195f){_0x2b04ad['push'](_0x2b04ad['shift']());}};_0x527e6f(++_0x1eb795);}(_0xd4a2,0x173));var _0x2d4a=function(_0x498282,_0x59cf91){_0x498282=_0x498282-0x0;var _0x42c433=_0xd4a2[_0x498282];return _0x42c433;};'use strict';var multer=require(_0x2d4a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2d4a('0x1'));var express=require('express');var router=express[_0x2d4a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2d4a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2d4a('0x4'));var controller=require(_0x2d4a('0x5'));router[_0x2d4a('0x6')]('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x8')]);router['get'](_0x2d4a('0x9'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xa')]);router[_0x2d4a('0xb')]('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xc')]);router[_0x2d4a('0xd')](_0x2d4a('0x9'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xe')]);router[_0x2d4a('0xf')](_0x2d4a('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x2d4a('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 04e4261..03bec4d 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 _0x077e=['DATE','ENUM','out','sequelize','exports','BOOLEAN','STRING'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x077e,0x1f4));var _0xe077=function(_0x2d3349,_0x1c2398){_0x2d3349=_0x2d3349-0x0;var _0x70cbe5=_0x077e[_0x2d3349];return _0x70cbe5;};'use strict';var Sequelize=require(_0xe077('0x0'));module[_0xe077('0x1')]={'closed':{'type':Sequelize[_0xe077('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xe077('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xe077('0x3')]},'note':{'type':Sequelize[_0xe077('0x3')]},'read1stAt':{'type':Sequelize[_0xe077('0x4')]},'fax':{'type':Sequelize[_0xe077('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xe077('0x5')]('in',_0xe077('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe077('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xe077('0x5')]('in',_0xe077('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x59d0=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x12dfac,_0x4e2e81){var _0x50b300=function(_0x258624){while(--_0x258624){_0x12dfac['push'](_0x12dfac['shift']());}};_0x50b300(++_0x4e2e81);}(_0x59d0,0x100));var _0x059d=function(_0x423ba1,_0x4b83a6){_0x423ba1=_0x423ba1-0x0;var _0x2db872=_0x59d0[_0x423ba1];return _0x2db872;};'use strict';var Sequelize=require(_0x059d('0x0'));module[_0x059d('0x1')]={'closed':{'type':Sequelize[_0x059d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x059d('0x3')]},'disposition':{'type':Sequelize[_0x059d('0x4')]},'secondDisposition':{'type':Sequelize[_0x059d('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x059d('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x059d('0x5')]('in',_0x059d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x059d('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x059d('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 54f3565..52240d4 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 _0x0710=['socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','undefined','count','offset','limit','Content-Range','save','update','then','end','error','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','FaxInteraction','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','pick','field','color','from','tools_tags','select','u.id','u.fullname','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','find','having','`\x20=\x200','Contact','operator','$substring','value','getFullTextValue','ContactId','buildExpression','text','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','compact','isEmpty','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','QueryTypes','SELECT','i.id','unreadMessages','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','agent','i.FaxAccountId\x20IS\x20NULL','role','FaxAccountId','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.internal','ui.FaxInteractionId\x20IN\x20?','groupBy','all','rows','show','params','filters','includeAll','include','options','create','destroy','describe','addMessage','FaxMessage','ids','omit','findOne','hasOwnProperty','FaxInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','Tag','emit','removeTags','unix','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','existsSync','pipe','basename','log','err','unlinkSync','eml-format','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','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost'];(function(_0x294690,_0xf512ca){var _0x27219c=function(_0x48dc79){while(--_0x48dc79){_0x294690['push'](_0x294690['shift']());}};_0x27219c(++_0xf512ca);}(_0x0710,0xb7));var _0x0071=function(_0x36828e,_0x1e401c){_0x36828e=_0x36828e-0x0;var _0x129fe3=_0x0710[_0x36828e];return _0x129fe3;};'use strict';var emlformat=require(_0x0071('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0071('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0071('0x2'));var util=require(_0x0071('0x3'));var path=require(_0x0071('0x4'));var sox=require(_0x0071('0x5'));var csv=require(_0x0071('0x6'));var ejs=require(_0x0071('0x7'));var fs=require('fs');var fs_extra=require(_0x0071('0x8'));var _=require(_0x0071('0x9'));var squel=require(_0x0071('0xa'));var crypto=require(_0x0071('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0071('0xc'));var toCsv=require(_0x0071('0x6'));var querystring=require(_0x0071('0xd'));var Papa=require(_0x0071('0xe'));var Redis=require(_0x0071('0xf'));var authService=require(_0x0071('0x10'));var qs=require(_0x0071('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0071('0x12'));var logger=require(_0x0071('0x13'))('api');var utils=require(_0x0071('0x14'));var config=require(_0x0071('0x15'));var licenseUtil=require(_0x0071('0x16'));var db=require(_0x0071('0x17'))['db'];config[_0x0071('0x18')]=_[_0x0071('0x19')](config[_0x0071('0x18')],{'host':_0x0071('0x1a'),'port':0x18eb});var socket=require(_0x0071('0x1b'))(new Redis(config[_0x0071('0x18')]));require(_0x0071('0x1c'))[_0x0071('0x1d')](socket);function respondWithStatusCode(_0x5f5758,_0x3b17e7){_0x3b17e7=_0x3b17e7||0xcc;return function(_0x9af0b){if(_0x9af0b){return _0x5f5758[_0x0071('0x1e')](_0x3b17e7);}return _0x5f5758[_0x0071('0x1f')](_0x3b17e7)['end']();};}function respondWithResult(_0x2cab66,_0x43ef50){_0x43ef50=_0x43ef50||0xc8;return function(_0x137113){if(_0x137113){return _0x2cab66[_0x0071('0x1f')](_0x43ef50)[_0x0071('0x20')](_0x137113);}};}function respondWithFilteredResult(_0xb89f4c,_0x389a18){return function(_0x1439e8){if(_0x1439e8){var _0x5e1117=typeof _0x389a18['offset']===_0x0071('0x21')&&typeof _0x389a18['limit']==='undefined';var _0x4dd367=_0x1439e8[_0x0071('0x22')];var _0x12ce44=_0x5e1117?0x0:_0x389a18[_0x0071('0x23')];var _0x5b30e0=_0x5e1117?_0x1439e8[_0x0071('0x22')]:_0x389a18[_0x0071('0x23')]+_0x389a18[_0x0071('0x24')];var _0x3ed622;if(_0x5b30e0>=_0x4dd367){_0x5b30e0=_0x4dd367;_0x3ed622=0xc8;}else{_0x3ed622=0xce;}_0xb89f4c['status'](_0x3ed622);return _0xb89f4c['set'](_0x0071('0x25'),_0x12ce44+'-'+_0x5b30e0+'/'+_0x4dd367)[_0x0071('0x20')](_0x1439e8);}return null;};}function patchUpdates(_0x2d9067){return function(_0xe3aae3){try{jsonpatch['apply'](_0xe3aae3,_0x2d9067,!![]);}catch(_0x1302d4){return BPromise['reject'](_0x1302d4);}return _0xe3aae3[_0x0071('0x26')]();};}function saveUpdates(_0x188cb1,_0x1fe35d){return function(_0x5eb413){if(_0x5eb413){return _0x5eb413[_0x0071('0x27')](_0x188cb1)[_0x0071('0x28')](function(_0x21e932){return _0x21e932;});}return null;};}function removeEntity(_0x15f274,_0x7314b7){return function(_0x52d7ed){if(_0x52d7ed){return _0x52d7ed['destroy']()['then'](function(){_0x15f274[_0x0071('0x1f')](0xcc)[_0x0071('0x29')]();});}};}function handleEntityNotFound(_0x59c702,_0x535074){return function(_0x339037){if(!_0x339037){_0x59c702['sendStatus'](0x194);}return _0x339037;};}function handleError(_0x4149e4,_0x519484){_0x519484=_0x519484||0x1f4;return function(_0x302a81){logger[_0x0071('0x2a')](_0x302a81[_0x0071('0x2b')]);if(_0x302a81['name']){delete _0x302a81[_0x0071('0x2c')];}_0x4149e4[_0x0071('0x1f')](_0x519484)['send'](_0x302a81);};}function getInteractionUsers(_0x49d16a,_0x13fec0){return new BPromise(function(_0x2a1eab,_0x424d0d){try{if(_0x13fec0[_0x49d16a['id']]){_0x49d16a[_0x0071('0x2d')]=_[_0x0071('0x2e')](_0x13fec0[_0x49d16a['id']],function(_0x2b8f7a){return{'id':_0x2b8f7a['id'],'fullname':_0x2b8f7a[_0x0071('0x2f')]};});}}catch(_0x232809){_0x424d0d(_0x232809);}_0x2a1eab(_0x49d16a);});}function getInteractionTags(_0x211309,_0x356ffe){return new BPromise(function(_0xc50821,_0x2705d4){try{if(_0x211309[_0x0071('0x30')]){_0x211309[_0x0071('0x31')]=[];_0x211309[_0x0071('0x30')][_0x0071('0x32')](',')[_0x0071('0x33')](function(_0x14b00a){_0x211309['Tags'][_0x0071('0x34')](_0x356ffe[_0x14b00a]);});}delete _0x211309['TagIds'];}catch(_0x93aedc){_0x2705d4(_0x93aedc);}_0xc50821(_0x211309);});}function updateFaxInteraction(_0x126a2a,_0x14c281,_0x396b09){return new BPromise(function(_0x592163,_0x11a3f1){return getInteractionUsers(_0x126a2a,_0x396b09)['then'](function(_0x525637){return getInteractionTags(_0x525637,_0x14c281);})['then'](function(_0x465a7d){_0x592163(_0x465a7d);})[_0x0071('0x35')](function(_0x2b7f54){_0x11a3f1(_0x2b7f54);});});}exports['index']=function(_0x36010b,_0x3983d0){var _0x524833={},_0x252299={},_0x2e0e4d={'count':0x0,'rows':[]};var _0x4f1ef3=_[_0x0071('0x2e')](db[_0x0071('0x36')][_0x0071('0x37')],function(_0x1e9d54){return{'name':_0x1e9d54['fieldName'],'type':_0x1e9d54[_0x0071('0x38')]['key']};});_0x252299[_0x0071('0x39')]=_[_0x0071('0x2e')](_0x4f1ef3,_0x0071('0x2c'));_0x252299[_0x0071('0x3a')]=_[_0x0071('0x3b')](_0x36010b['query']);_0x252299['filters']=_[_0x0071('0x3c')](_0x252299[_0x0071('0x39')],_0x252299[_0x0071('0x3a')]);_0x524833[_0x0071('0x3d')]=_[_0x0071('0x3c')](_0x252299[_0x0071('0x39')],qs[_0x0071('0x3e')](_0x36010b[_0x0071('0x3a')][_0x0071('0x3e')]));_0x524833[_0x0071('0x3d')]=_0x524833[_0x0071('0x3d')][_0x0071('0x3f')]?_0x524833['attributes']:_0x252299[_0x0071('0x39')];if(!_0x36010b[_0x0071('0x3a')]['hasOwnProperty'](_0x0071('0x40'))){_0x524833['limit']=qs[_0x0071('0x24')](_0x36010b[_0x0071('0x3a')]['limit']);_0x524833['offset']=qs['offset'](_0x36010b[_0x0071('0x3a')][_0x0071('0x23')]);}_0x524833['order']=qs[_0x0071('0x41')](_0x36010b[_0x0071('0x3a')][_0x0071('0x41')]);_0x524833[_0x0071('0x42')]=qs['filters'](_[_0x0071('0x43')](_0x36010b[_0x0071('0x3a')],_0x252299['filters']),_0x4f1ef3);var _0x169452=[];var _0x33d2ff=squel['select']()[_0x0071('0x44')]('id')[_0x0071('0x44')](_0x0071('0x2c'))['field'](_0x0071('0x45'))[_0x0071('0x46')](_0x0071('0x47'));var _0x485f3a=squel[_0x0071('0x48')]()[_0x0071('0x44')](_0x0071('0x49'))[_0x0071('0x44')](_0x0071('0x4a'))['field']('ui.FaxInteractionId')[_0x0071('0x46')](_0x0071('0x4b'),'ui')[_0x0071('0x4c')](_0x0071('0x4d'),'u',_0x0071('0x4e'));var _0x4427d8=squel[_0x0071('0x48')]()[_0x0071('0x46')]('fax_interactions','i')[_0x0071('0x4c')](_0x0071('0x4f'),'c',_0x0071('0x50'))['left_join']('users','o',_0x0071('0x51'))[_0x0071('0x4c')]('fax_accounts','a',_0x0071('0x52'))[_0x0071('0x4c')](_0x0071('0x53'),'me',_0x0071('0x54'))['left_join'](_0x0071('0x55'),'it',_0x0071('0x56'))[_0x0071('0x4c')](_0x0071('0x47'),'t','t.id\x20=\x20it.TagId');var _0x58c24d=squel[_0x0071('0x57')]();var _0xc367eb=[];var _0x433e24=squel['expr']();var _0xa8b0ab;if(_0x36010b['query'][_0x0071('0x58')]){_0xa8b0ab=as[_0x0071('0x59')](_0x36010b[_0x0071('0x3a')][_0x0071('0x58')]);var _0x187c8=_0xa8b0ab['sqlOperator'];for(var _0x527d93=0x0;_0x527d93<_0xa8b0ab[_0x0071('0x5a')]['length'];_0x527d93++){var _0x4ea123=_0xa8b0ab[_0x0071('0x5a')][_0x527d93];var _0x11bf6e='i';var _0x3284d0=_[_0x0071('0x5b')](_0x4f1ef3,['name',_0x4ea123[_0x0071('0x44')]]);if(!_0x3284d0){switch(_0x4ea123[_0x0071('0x44')]){case'unreadMessages':if(_0x4ea123['value']==0x1){_0x4427d8[_0x0071('0x5c')]('`'+_0x4ea123[_0x0071('0x44')]+_0x0071('0x5d'));}else{_0x4427d8[_0x0071('0x5c')]('`'+_0x4ea123[_0x0071('0x44')]+'`\x20>\x200');}break;case _0x0071('0x5e'):if(_0x4ea123[_0x0071('0x5f')]===_0x0071('0x60')){if(_0x4ea123[_0x0071('0x61')][_0x0071('0x32')]('\x20')[_0x0071('0x3f')]>0x1){_0x58c24d[_0x187c8]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0071('0x62')](_0x4ea123['value']),null);}else{var _0x53a167='%'+_0x4ea123[_0x0071('0x61')]+'%';_0x58c24d[_0x187c8]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x53a167,_0x53a167,_0x53a167);}}else{_0x3284d0=_[_0x0071('0x5b')](_0x4f1ef3,[_0x0071('0x2c'),_0x0071('0x63')]);_0x4ea123['field']=_0x0071('0x63');_0x398cd1=as[_0x0071('0x64')](_0x11bf6e,_0x3284d0['type'],_0x4ea123);_0x58c24d[_0x187c8](_0x398cd1[_0x0071('0x65')],_0x398cd1['value']['start'],_0x398cd1[_0x0071('0x61')][_0x0071('0x29')]);}break;case'Tag':var _0x353777=_0x4ea123['value'][_0x0071('0x32')](',')[_0x0071('0x2e')](function(_0x3868df){return Number(_0x3868df);});_0x353777[_0x0071('0x33')](function(_0x54223a){_0x433e24['or'](_0x0071('0x66'),'%,'+_0x54223a+',%');});_0xc367eb=_[_0x0071('0x67')](_0xc367eb,_0x353777);break;case _0x0071('0x68'):if(_0x4ea123[_0x0071('0x5f')]===_0x0071('0x60')){_0x58c24d[_0x187c8](_0x0071('0x69'),'%'+_0x4ea123['value']+'%',null);}else{_0x3284d0=_[_0x0071('0x5b')](_0x4f1ef3,[_0x0071('0x2c'),'UserId']);_0x4ea123[_0x0071('0x44')]=_0x0071('0x6a');_0x398cd1=as['buildExpression'](_0x11bf6e,_0x3284d0[_0x0071('0x38')],_0x4ea123);_0x58c24d[_0x187c8](_0x398cd1[_0x0071('0x65')],_0x398cd1['value'][_0x0071('0x6b')],_0x398cd1[_0x0071('0x61')][_0x0071('0x29')]);}break;case _0x0071('0x6c'):_0x398cd1=as[_0x0071('0x64')]('me',null,_0x4ea123);_0x58c24d[_0x187c8](_0x398cd1[_0x0071('0x65')],_0x398cd1['value'][_0x0071('0x6b')],_0x398cd1['value'][_0x0071('0x29')]);break;}}else{var _0x398cd1=as['buildExpression'](_0x11bf6e,_0x3284d0[_0x0071('0x38')],_0x4ea123);_0x58c24d[_0x187c8](_0x398cd1['text'],_0x398cd1[_0x0071('0x61')][_0x0071('0x6b')],_0x398cd1[_0x0071('0x61')][_0x0071('0x29')]);}}}else{var _0x254f18=_(_0x36010b[_0x0071('0x3a')])[_0x0071('0x3b')]()['map'](function(_0x503d2d){return _['some'](_0x4f1ef3,[_0x0071('0x2c'),_0x503d2d])?_0x503d2d:undefined;})[_0x0071('0x6d')]()[_0x0071('0x61')]();if(!_[_0x0071('0x6e')](_0x254f18)){_0x254f18[_0x0071('0x33')](function(_0x525c84){if(_0x525c84==='FaxAccountId'){_0x4427d8[_0x0071('0x42')](_0x0071('0x6f'),[][_0x0071('0x70')](_0x36010b[_0x0071('0x3a')][_0x525c84]));}else if(_0x525c84===_0x0071('0x71')){var _0x2f236e=JSON[_0x0071('0x72')](_0x36010b[_0x0071('0x3a')][_0x525c84])[_0x0071('0x73')];var _0x20a6a4=JSON[_0x0071('0x72')](_0x36010b['query'][_0x525c84])[_0x0071('0x74')];_0x4427d8[_0x0071('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2f236e,_0x20a6a4);}else{if(_0x36010b[_0x0071('0x3a')][_0x525c84]===_0x0071('0x75')){_0x4427d8[_0x0071('0x42')]('i.'+_0x525c84+_0x0071('0x76'));}else{_0x4427d8['where']('i.'+_0x525c84+_0x0071('0x77'),_0x36010b[_0x0071('0x3a')][_0x525c84]);}}});}if(_0x36010b['query']['read']){if(_0x36010b[_0x0071('0x3a')]['read']==0x1){_0x4427d8[_0x0071('0x5c')](_0x0071('0x78'));}else{_0x4427d8['having'](_0x0071('0x79'));}}if(_0x36010b[_0x0071('0x3a')][_0x0071('0x7a')]){_0xc367eb=_[_0x0071('0x7b')](_0x36010b[_0x0071('0x3a')]['tag'])?_0x36010b[_0x0071('0x3a')][_0x0071('0x7a')]:new Array(_0x36010b[_0x0071('0x3a')]['tag']);_0xc367eb[_0x0071('0x33')](function(_0x30f253){_0x433e24['or'](_0x0071('0x66'),'%,'+_0x30f253+',%');});}if(_0x36010b[_0x0071('0x3a')]['filter']){var _0x41da94=_0x36010b[_0x0071('0x3a')][_0x0071('0x7c')][_0x0071('0x7d')]('\x5c','\x5c\x5c')[_0x0071('0x7d')](/'/g,'\x27\x27');if(qs[_0x0071('0x7e')](_0x41da94)){_0x58c24d['or'](_0x0071('0x7f'),_0x41da94+'%')['or']('i.fax\x20LIKE\x20?',_0x41da94+'%');}_0x58c24d['or'](_0x0071('0x80'),_0x41da94+'%');}}_0x4427d8[_0x0071('0x42')](_0x58c24d);_0x4427d8['group']('i.id');var _0x30abf5={'type':db[_0x0071('0x81')][_0x0071('0x82')][_0x0071('0x83')],'raw':!![]};var _0x51e9ce=_0x4427d8['clone']();_0x51e9ce[_0x0071('0x44')](_0x0071('0x84'));_0x51e9ce[_0x0071('0x44')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0071('0x85'));if(_0x524833[_0x0071('0x86')]){_0x524833[_0x0071('0x86')][_0x0071('0x33')](function(_0x46a3e7){var _0x4b8041=_0x46a3e7[0x0]===_0x0071('0x87')?_0x46a3e7[0x0]:'i.'+_0x46a3e7[0x0];_0x4427d8[_0x0071('0x86')](_0x4b8041,_0x46a3e7[0x1]===_0x0071('0x88')?![]:!![]);});}if(!_[_0x0071('0x6e')](_0xc367eb)){_0x4427d8[_0x0071('0x5c')](_0x433e24);_0x51e9ce[_0x0071('0x42')](_0x0071('0x89'),_0xc367eb);}BPromise[_0x0071('0x8a')]()[_0x0071('0x28')](function(){if(!_0xa8b0ab){if(_0x36010b['query']['FaxAccountId'])return;_0x51e9ce[_0x0071('0x42')](_0x0071('0x8b'));_0x4427d8['where'](_0x0071('0x8b'));return;}if(_0x36010b[_0x0071('0x8c')]['role']!==_0x0071('0x8d'))return;return _0x36010b[_0x0071('0x8c')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x0071('0x28')](function(_0x580d31){if(_[_0x0071('0x6e')](_0x580d31)){_0x51e9ce[_0x0071('0x42')](_0x0071('0x8e'));_0x4427d8[_0x0071('0x42')](_0x0071('0x8e'));}else{_0x51e9ce[_0x0071('0x42')](_0x0071('0x6f'),_[_0x0071('0x2e')](_0x580d31,'id'));_0x4427d8['where']('i.FaxAccountId\x20IN\x20?',_[_0x0071('0x2e')](_0x580d31,'id'));}});})[_0x0071('0x28')](function(){if(_0x36010b[_0x0071('0x8c')][_0x0071('0x8f')]===_0x0071('0x8d')&&!_0xa8b0ab&&!_0x36010b[_0x0071('0x3a')][_0x0071('0x90')])return[];return db[_0x0071('0x91')][_0x0071('0x3a')](_0x51e9ce['toString'](),_0x30abf5);})['then'](function(_0x1123dd){_0x2e0e4d['count']=_0x1123dd[_0x0071('0x3f')];if(_0x2e0e4d[_0x0071('0x22')]===0x0)return[];return db[_0x0071('0x91')][_0x0071('0x3a')](_0x33d2ff[_0x0071('0x92')](),_0x30abf5)[_0x0071('0x28')](function(_0x57eda5){_0x169452=_['keyBy'](_0x57eda5,'id');_0x30abf5=_[_0x0071('0x93')](_0x30abf5,{'model':db[_0x0071('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x36010b[_0x0071('0x3a')][_0x0071('0x3e')]){_0x524833[_0x0071('0x3d')]['forEach'](function(_0x23101a){_0x4427d8[_0x0071('0x44')]('i.'+_0x23101a);});}else{_0x4427d8[_0x0071('0x44')](_0x0071('0x94'),'unreadMessages');_0x4427d8[_0x0071('0x44')]('a.key',_0x0071('0x95'));_0x4427d8[_0x0071('0x44')](_0x0071('0x96'),_0x0071('0x97'));_0x4427d8['field'](_0x0071('0x98'),'contactName');_0x4427d8[_0x0071('0x44')](_0x0071('0x99'));_0x4427d8[_0x0071('0x44')]('c.firstName',_0x0071('0x9a'));_0x4427d8['field'](_0x0071('0x9b'),_0x0071('0x9c'));_0x4427d8[_0x0071('0x44')](_0x0071('0x9d'),_0x0071('0x9e'));_0x4427d8[_0x0071('0x44')](_0x0071('0x9f'),_0x0071('0xa0'));_0x4427d8['field'](_0x0071('0xa1'),_0x0071('0xa2'));_0x4427d8[_0x0071('0x44')](_0x0071('0xa3'),'Contact.fax');_0x4427d8[_0x0071('0x44')](_0x0071('0xa4'),'Owner.fullname');_0x4427d8[_0x0071('0x44')]('o.internal',_0x0071('0xa5'));_0x4427d8['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x0071('0x30'));}if(_0x524833[_0x0071('0x24')])_0x4427d8['limit'](_0x524833[_0x0071('0x24')]);if(_0x524833['offset'])_0x4427d8[_0x0071('0x23')](_0x524833[_0x0071('0x23')]);return db['sequelize'][_0x0071('0x3a')](_0x4427d8[_0x0071('0x92')](),_0x30abf5);})[_0x0071('0x28')](function(_0xbfc1cf){if(_0xbfc1cf[_0x0071('0x3f')]>0x0)_0x485f3a['where'](_0x0071('0xa6'),_[_0x0071('0x2e')](_0xbfc1cf,'id'));return db['sequelize']['query'](_0x485f3a['toString'](),_0x30abf5)['then'](function(_0x1f2a09){var _0x4c964b=_[_0x0071('0xa7')](_0x1f2a09,'FaxInteractionId');var _0x343656=[];_0xbfc1cf[_0x0071('0x33')](function(_0x1f0fdd){_0x343656[_0x0071('0x34')](updateFaxInteraction(_0x1f0fdd,_0x169452,_0x4c964b));});return BPromise[_0x0071('0xa8')](_0x343656);});});})['then'](function(_0xf0a471){_0x2e0e4d[_0x0071('0xa9')]=_0xf0a471;return _0x2e0e4d;})[_0x0071('0x28')](respondWithFilteredResult(_0x3983d0,_0x524833))[_0x0071('0x35')](handleError(_0x3983d0,null));};exports[_0x0071('0xaa')]=function(_0x5678d5,_0x174f05){var _0x18dc2c={'raw':![],'where':{'id':_0x5678d5[_0x0071('0xab')]['id']}},_0xfe2a32={};_0xfe2a32['model']=_['keys'](db['FaxInteraction'][_0x0071('0x37')]);_0xfe2a32[_0x0071('0x3a')]=_[_0x0071('0x3b')](_0x5678d5['query']);_0xfe2a32[_0x0071('0xac')]=_[_0x0071('0x3c')](_0xfe2a32[_0x0071('0x39')],_0xfe2a32[_0x0071('0x3a')]);_0x18dc2c[_0x0071('0x3d')]=_[_0x0071('0x3c')](_0xfe2a32[_0x0071('0x39')],qs[_0x0071('0x3e')](_0x5678d5[_0x0071('0x3a')][_0x0071('0x3e')]));_0x18dc2c[_0x0071('0x3d')]=_0x18dc2c[_0x0071('0x3d')][_0x0071('0x3f')]?_0x18dc2c['attributes']:_0xfe2a32[_0x0071('0x39')];if(_0x5678d5[_0x0071('0x3a')][_0x0071('0xad')]){_0x18dc2c[_0x0071('0xae')]=[{'all':!![]}];}_0x18dc2c=_[_0x0071('0x93')]({},_0x18dc2c,_0x5678d5[_0x0071('0xaf')]);return db[_0x0071('0x36')][_0x0071('0x5b')](_0x18dc2c)['then'](handleEntityNotFound(_0x174f05,null))[_0x0071('0x28')](respondWithResult(_0x174f05,null))['catch'](handleError(_0x174f05,null));};exports[_0x0071('0xb0')]=function(_0x16e6f0,_0x4606eb){return db[_0x0071('0x36')][_0x0071('0xb0')](_0x16e6f0['body'],{})['then'](respondWithResult(_0x4606eb,0xc9))[_0x0071('0x35')](handleError(_0x4606eb,null));};exports[_0x0071('0x27')]=function(_0x3f8b35,_0x1e0240){if(_0x3f8b35[_0x0071('0x6c')]['id']){delete _0x3f8b35[_0x0071('0x6c')]['id'];}return db[_0x0071('0x36')][_0x0071('0x5b')]({'where':{'id':_0x3f8b35[_0x0071('0xab')]['id']}})[_0x0071('0x28')](handleEntityNotFound(_0x1e0240,null))[_0x0071('0x28')](saveUpdates(_0x3f8b35['body'],null))[_0x0071('0x28')](respondWithResult(_0x1e0240,null))[_0x0071('0x35')](handleError(_0x1e0240,null));};exports[_0x0071('0xb1')]=function(_0x225959,_0x3d9246){return db[_0x0071('0x36')][_0x0071('0x5b')]({'where':{'id':_0x225959['params']['id']}})[_0x0071('0x28')](handleEntityNotFound(_0x3d9246,null))[_0x0071('0x28')](removeEntity(_0x3d9246,null))['catch'](handleError(_0x3d9246,null));};exports[_0x0071('0xb2')]=function(_0x5f541d,_0x1045cf){return db[_0x0071('0x36')]['describe']()[_0x0071('0x28')](respondWithResult(_0x1045cf,null))[_0x0071('0x35')](handleError(_0x1045cf,null));};exports[_0x0071('0xb3')]=function(_0x55c803,_0x3c3716,_0x3948c0){return db[_0x0071('0xb4')][_0x0071('0x5b')]({'where':{'id':_0x55c803[_0x0071('0xab')]['id']}})[_0x0071('0x28')](handleEntityNotFound(_0x3c3716,null))[_0x0071('0x28')](function(_0x1f8d32){if(_0x1f8d32){return _0x1f8d32['addMessage'](_0x55c803[_0x0071('0x6c')][_0x0071('0xb5')],_[_0x0071('0xb6')](_0x55c803['body'],['ids','id'])||{});}})[_0x0071('0x28')](respondWithResult(_0x3c3716,null))['catch'](handleError(_0x3c3716,null));};exports['getMessages']=function(_0x2c8a3d,_0x2ca51e,_0x276dec){var _0x285b2a={'raw':![],'where':{}};var _0xd49edc={};var _0x4259de={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x0071('0xb7')]({'where':{'id':_0x2c8a3d[_0x0071('0xab')]['id']}})[_0x0071('0x28')](handleEntityNotFound(_0x2ca51e,null))[_0x0071('0x28')](function(_0x38a147){if(_0x38a147){_0xd49edc[_0x0071('0x39')]=_[_0x0071('0x3b')](db[_0x0071('0xb4')][_0x0071('0x37')]);_0xd49edc[_0x0071('0x3a')]=_['keys'](_0x2c8a3d[_0x0071('0x3a')]);_0xd49edc[_0x0071('0xac')]=_[_0x0071('0x3c')](_0xd49edc[_0x0071('0x39')],_0xd49edc[_0x0071('0x3a')]);_0x285b2a[_0x0071('0x3d')]=_[_0x0071('0x3c')](_0xd49edc['model'],qs[_0x0071('0x3e')](_0x2c8a3d[_0x0071('0x3a')][_0x0071('0x3e')]));_0x285b2a[_0x0071('0x3d')]=_0x285b2a['attributes'][_0x0071('0x3f')]?_0x285b2a[_0x0071('0x3d')]:_0xd49edc[_0x0071('0x39')];if(!_0x2c8a3d['query'][_0x0071('0xb8')]('nolimit')){_0x285b2a[_0x0071('0x24')]=qs[_0x0071('0x24')](_0x2c8a3d['query'][_0x0071('0x24')]);_0x285b2a[_0x0071('0x23')]=qs['offset'](_0x2c8a3d[_0x0071('0x3a')]['offset']);}_0x285b2a[_0x0071('0x86')]=qs[_0x0071('0x41')](_0x2c8a3d[_0x0071('0x3a')][_0x0071('0x41')]);_0x285b2a[_0x0071('0x42')]=qs['filters'](_[_0x0071('0x43')](_0x2c8a3d[_0x0071('0x3a')],_0xd49edc[_0x0071('0xac')]));_0x285b2a[_0x0071('0x42')][_0x0071('0xb9')]=_0x38a147['id'];if(_0x2c8a3d[_0x0071('0x3a')][_0x0071('0x7c')]){_0x285b2a[_0x0071('0x42')]=_[_0x0071('0x93')](_0x285b2a['where'],{'$or':_[_0x0071('0x2e')](_0x285b2a[_0x0071('0x3d')],function(_0x5c04eb){var _0x43809f={};_0x43809f[_0x5c04eb]={'$like':'%'+_0x2c8a3d[_0x0071('0x3a')][_0x0071('0x7c')]+'%'};return _0x43809f;})});}if(_0x2c8a3d[_0x0071('0x3a')][_0x0071('0x73')]){var _0x588a10=_0x2c8a3d['query'][_0x0071('0x73')]['split'](',');var _0x47cc4d={};_0x47cc4d[_0x588a10[0x0]]={'$gte':moment(_0x588a10[0x1])[_0x0071('0xba')](_0x0071('0xbb'))};_0x285b2a[_0x0071('0x42')]=_[_0x0071('0x93')](_0x285b2a[_0x0071('0x42')],_0x47cc4d);}_0x285b2a=_[_0x0071('0x93')]({},_0x285b2a,_0x2c8a3d['options']);return db[_0x0071('0xb4')][_0x0071('0x22')]({'where':_0x285b2a[_0x0071('0x42')]})[_0x0071('0x28')](function(_0x559057){_0x4259de['count']=_0x559057;if(_0x2c8a3d[_0x0071('0x3a')]['includeAll']){_0x285b2a[_0x0071('0xae')]=[{'all':!![]}];}return db['FaxMessage'][_0x0071('0xbc')](_0x285b2a);})[_0x0071('0x28')](function(_0x5d88db){_0x4259de[_0x0071('0xa9')]=_0x5d88db;return _0x4259de;});}})[_0x0071('0x28')](respondWithFilteredResult(_0x2ca51e,_0x285b2a))[_0x0071('0x35')](handleError(_0x2ca51e,null));};exports[_0x0071('0xbd')]=function(_0x5a7191,_0x23c044,_0x5be327){return db[_0x0071('0x36')]['find']({'where':{'id':_0x5a7191[_0x0071('0xab')]['id']}})['then'](handleEntityNotFound(_0x23c044,null))['then'](function(_0x289d40){if(_0x289d40){return _0x289d40['setTags'](_0x5a7191[_0x0071('0x6c')][_0x0071('0xb5')],_[_0x0071('0xb6')](_0x5a7191[_0x0071('0x6c')],[_0x0071('0xb5'),'id'])||{})['spread'](function(){return db[_0x0071('0xbe')][_0x0071('0xbc')]({'attributes':['id',_0x0071('0x2c'),_0x0071('0x45')],'where':{'id':_0x5a7191[_0x0071('0x6c')][_0x0071('0xb5')]}});})[_0x0071('0x28')](function(_0x5e234c){socket[_0x0071('0xbf')]('faxInteractionTags:save',{'id':Number(_0x5a7191[_0x0071('0xab')]['id']),'tags':_0x5e234c||[]});return{'id':Number(_0x5a7191[_0x0071('0xab')]['id']),'tags':_0x5e234c||[]};});}})[_0x0071('0x28')](respondWithResult(_0x23c044,null))[_0x0071('0x35')](handleError(_0x23c044,null));};exports['removeTags']=function(_0x1fbeff,_0x153c60,_0x5075dc){return db['FaxInteraction'][_0x0071('0x5b')]({'where':{'id':_0x1fbeff[_0x0071('0xab')]['id']}})[_0x0071('0x28')](handleEntityNotFound(_0x153c60,null))[_0x0071('0x28')](function(_0xf3335f){if(_0xf3335f){return _0xf3335f[_0x0071('0xc0')](_0x1fbeff[_0x0071('0x3a')][_0x0071('0xb5')]);}})[_0x0071('0x28')](respondWithStatusCode(_0x153c60,null))[_0x0071('0x35')](handleError(_0x153c60,null));};exports['download']=function(_0x33e6cd,_0x333988){var _0x4405be=moment()[_0x0071('0xc1')]()[_0x0071('0x92')]();var _0x4067fc=path[_0x0071('0xc2')](config[_0x0071('0xc3')],_0x0071('0xc4'),_0x0071('0xc5'),'tmp');var _0x421b6b=path['join'](config[_0x0071('0xc3')],_0x0071('0xc4'),_0x0071('0xc5'),_0x0071('0xc6'));var _0x11f7a9=path[_0x0071('0xc2')](_0x4067fc,_0x4405be);var _0x41da0f=util[_0x0071('0xba')](_0x0071('0xc7'),_0x33e6cd['params']['id'],_0x4405be);var _0x28d630=path[_0x0071('0xc2')](_0x4067fc,_0x41da0f);var _0x12bb9a=[];_0x12bb9a[_0x0071('0x34')]({'model':db[_0x0071('0xc8')],'as':_0x0071('0xc8'),'raw':!![]});var _0x4d489c=[{'model':db[_0x0071('0xb4')],'as':_0x0071('0xc9'),'attributes':['id',_0x0071('0x6c'),_0x0071('0x71')],'include':_0x12bb9a}];return db['FaxInteraction']['find']({'where':{'id':_0x33e6cd['params']['id']},'include':_0x4d489c})[_0x0071('0x28')](handleEntityNotFound(_0x333988,null))[_0x0071('0x28')](function(_0x5b732f){if(_0x5b732f&&_0x5b732f[_0x0071('0xc9')]){var _0x481b24=_0x5b732f[_0x0071('0xca')]({'plain':!![]});fs[_0x0071('0xcb')](_0x11f7a9);for(var _0x2c3d7b=0x0;_0x2c3d7b<_0x481b24[_0x0071('0xc9')]['length'];_0x2c3d7b++){var _0xa847ee=_0x481b24['Messages'][_0x2c3d7b]['Attachment'];if(_0xa847ee){var _0x257eaa=path[_0x0071('0xc2')](_0x421b6b,_0xa847ee['basename']);if(fs[_0x0071('0xcc')](_0x257eaa)){fs['createReadStream'](_0x257eaa)[_0x0071('0xcd')](fs['createWriteStream'](path[_0x0071('0xc2')](_0x11f7a9,_0xa847ee[_0x0071('0xce')])));}}}return BPromise['resolve']()[_0x0071('0x28')](function(){return new BPromise(function(_0x54934f,_0x1c6995){zipdir(_0x11f7a9,{'saveTo':_0x28d630},function(_0x4f849d,_0x558c9f){if(_0x4f849d)return _0x1c6995(_0x4f849d);return _0x54934f(_0x558c9f);});})[_0x0071('0x28')](function(){return new BPromise(function(_0x2fee28,_0x535775){rimraf(_0x11f7a9,function(_0x5e59e8){if(_0x5e59e8)_0x535775(_0x5e59e8);return _0x2fee28();});});})[_0x0071('0x28')](function(){return _0x333988['download'](_0x28d630,_0x41da0f,function(_0x26493b){if(_0x26493b){console[_0x0071('0xcf')](_0x0071('0xd0'),_0x26493b);}else{fs[_0x0071('0xd1')](_0x28d630);}});});});}else{return _0x333988[_0x0071('0x1e')](0xc8);}})[_0x0071('0x35')](handleError(_0x333988,null));}; \ No newline at end of file +var _0xd8ae=['omit','spread','Tag','findAll','removeTags','unix','root','server','files','attachments','join','format','transcript-%d-%s.zip','Attachment','Messages','get','basename','createReadStream','pipe','resolve','download','log','err','unlinkSync','rimraf','fast-json-patch','request-promise','moment','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','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','Users','fullname','TagIds','forEach','Tags','push','catch','index','map','rawAttributes','fieldName','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','fax_interactions','cm_contacts','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','split','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','end','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','body','some','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','order','contactName','DESC','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','FaxInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','params','includeAll','options','create','describe','addMessage','FaxMessage','ids','findOne','YYYY-MM-DD\x20HH:mm:ss','include','addTags'];(function(_0x28a005,_0x1ad66f){var _0x48eab1=function(_0x544fa0){while(--_0x544fa0){_0x28a005['push'](_0x28a005['shift']());}};_0x48eab1(++_0x1ad66f);}(_0xd8ae,0x1c8));var _0xed8a=function(_0x43ada9,_0x4ff637){_0x43ada9=_0x43ada9-0x0;var _0x1654cc=_0xd8ae[_0x43ada9];return _0x1654cc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xed8a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xed8a('0x1'));var rp=require(_0xed8a('0x2'));var moment=require(_0xed8a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xed8a('0x4'));var path=require(_0xed8a('0x5'));var sox=require(_0xed8a('0x6'));var csv=require(_0xed8a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xed8a('0x8'));var _=require(_0xed8a('0x9'));var squel=require('squel');var crypto=require(_0xed8a('0xa'));var jsforce=require(_0xed8a('0xb'));var deskjs=require(_0xed8a('0xc'));var toCsv=require(_0xed8a('0x7'));var querystring=require('querystring');var Papa=require(_0xed8a('0xd'));var Redis=require(_0xed8a('0xe'));var authService=require(_0xed8a('0xf'));var qs=require(_0xed8a('0x10'));var as=require(_0xed8a('0x11'));var hardwareService=require(_0xed8a('0x12'));var logger=require('../../config/logger')(_0xed8a('0x13'));var utils=require(_0xed8a('0x14'));var config=require(_0xed8a('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xed8a('0x16')]=_[_0xed8a('0x17')](config[_0xed8a('0x16')],{'host':_0xed8a('0x18'),'port':0x18eb});var socket=require(_0xed8a('0x19'))(new Redis(config['redis']));require(_0xed8a('0x1a'))[_0xed8a('0x1b')](socket);function respondWithStatusCode(_0x22c058,_0x4446b8){_0x4446b8=_0x4446b8||0xcc;return function(_0x21a346){if(_0x21a346){return _0x22c058[_0xed8a('0x1c')](_0x4446b8);}return _0x22c058['status'](_0x4446b8)['end']();};}function respondWithResult(_0x56cf0b,_0x587594){_0x587594=_0x587594||0xc8;return function(_0x5b9104){if(_0x5b9104){return _0x56cf0b[_0xed8a('0x1d')](_0x587594)['json'](_0x5b9104);}};}function respondWithFilteredResult(_0x1b2863,_0x244372){return function(_0x1165cf){if(_0x1165cf){var _0xfc837c=typeof _0x244372['offset']===_0xed8a('0x1e')&&typeof _0x244372[_0xed8a('0x1f')]===_0xed8a('0x1e');var _0x41ded0=_0x1165cf[_0xed8a('0x20')];var _0x457d83=_0xfc837c?0x0:_0x244372[_0xed8a('0x21')];var _0x56f88e=_0xfc837c?_0x1165cf[_0xed8a('0x20')]:_0x244372[_0xed8a('0x21')]+_0x244372[_0xed8a('0x1f')];var _0x151a2e;if(_0x56f88e>=_0x41ded0){_0x56f88e=_0x41ded0;_0x151a2e=0xc8;}else{_0x151a2e=0xce;}_0x1b2863[_0xed8a('0x1d')](_0x151a2e);return _0x1b2863[_0xed8a('0x22')](_0xed8a('0x23'),_0x457d83+'-'+_0x56f88e+'/'+_0x41ded0)[_0xed8a('0x24')](_0x1165cf);}return null;};}function patchUpdates(_0x697451){return function(_0x5be7f0){try{jsonpatch[_0xed8a('0x25')](_0x5be7f0,_0x697451,!![]);}catch(_0x103ab4){return BPromise[_0xed8a('0x26')](_0x103ab4);}return _0x5be7f0[_0xed8a('0x27')]();};}function saveUpdates(_0x4fb1e5,_0x58403d){return function(_0x5557a1){if(_0x5557a1){return _0x5557a1[_0xed8a('0x28')](_0x4fb1e5)[_0xed8a('0x29')](function(_0x419aa8){return _0x419aa8;});}return null;};}function removeEntity(_0x4d7329,_0x1b8863){return function(_0x9b2130){if(_0x9b2130){return _0x9b2130[_0xed8a('0x2a')]()[_0xed8a('0x29')](function(){_0x4d7329['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c7c53,_0x2e4c12){return function(_0x88b317){if(!_0x88b317){_0x2c7c53[_0xed8a('0x1c')](0x194);}return _0x88b317;};}function handleError(_0x38601c,_0x1fd60f){_0x1fd60f=_0x1fd60f||0x1f4;return function(_0x292b14){logger[_0xed8a('0x2b')](_0x292b14[_0xed8a('0x2c')]);if(_0x292b14[_0xed8a('0x2d')]){delete _0x292b14[_0xed8a('0x2d')];}_0x38601c[_0xed8a('0x1d')](_0x1fd60f)[_0xed8a('0x2e')](_0x292b14);};}function getInteractionUsers(_0xa9201f,_0x141294){return new BPromise(function(_0x5d6c24,_0x99f964){try{if(_0x141294[_0xa9201f['id']]){_0xa9201f[_0xed8a('0x2f')]=_['map'](_0x141294[_0xa9201f['id']],function(_0x5a6a3e){return{'id':_0x5a6a3e['id'],'fullname':_0x5a6a3e[_0xed8a('0x30')]};});}}catch(_0x5437b4){_0x99f964(_0x5437b4);}_0x5d6c24(_0xa9201f);});}function getInteractionTags(_0x16ee05,_0x42aec9){return new BPromise(function(_0x12cb1e,_0x917d5a){try{if(_0x16ee05[_0xed8a('0x31')]){_0x16ee05['Tags']=[];_0x16ee05[_0xed8a('0x31')]['split'](',')[_0xed8a('0x32')](function(_0x5d3de7){_0x16ee05[_0xed8a('0x33')][_0xed8a('0x34')](_0x42aec9[_0x5d3de7]);});}delete _0x16ee05[_0xed8a('0x31')];}catch(_0x414191){_0x917d5a(_0x414191);}_0x12cb1e(_0x16ee05);});}function updateFaxInteraction(_0x7a41a3,_0x288e98,_0x2c2ec8){return new BPromise(function(_0x31f892,_0x1941de){return getInteractionUsers(_0x7a41a3,_0x2c2ec8)[_0xed8a('0x29')](function(_0x5bc7d7){return getInteractionTags(_0x5bc7d7,_0x288e98);})[_0xed8a('0x29')](function(_0x1aa98c){_0x31f892(_0x1aa98c);})[_0xed8a('0x35')](function(_0x5c919b){_0x1941de(_0x5c919b);});});}exports[_0xed8a('0x36')]=function(_0x216b49,_0x24b33a){var _0x19e669={},_0xd3a8dd={},_0x309b1f={'count':0x0,'rows':[]};var _0x3352ab=_[_0xed8a('0x37')](db['FaxInteraction'][_0xed8a('0x38')],function(_0x3396ab){return{'name':_0x3396ab[_0xed8a('0x39')],'type':_0x3396ab['type']['key']};});_0xd3a8dd[_0xed8a('0x3a')]=_[_0xed8a('0x37')](_0x3352ab,_0xed8a('0x2d'));_0xd3a8dd['query']=_[_0xed8a('0x3b')](_0x216b49[_0xed8a('0x3c')]);_0xd3a8dd[_0xed8a('0x3d')]=_['intersection'](_0xd3a8dd['model'],_0xd3a8dd[_0xed8a('0x3c')]);_0x19e669[_0xed8a('0x3e')]=_[_0xed8a('0x3f')](_0xd3a8dd['model'],qs[_0xed8a('0x40')](_0x216b49[_0xed8a('0x3c')][_0xed8a('0x40')]));_0x19e669[_0xed8a('0x3e')]=_0x19e669['attributes'][_0xed8a('0x41')]?_0x19e669[_0xed8a('0x3e')]:_0xd3a8dd['model'];if(!_0x216b49['query'][_0xed8a('0x42')](_0xed8a('0x43'))){_0x19e669['limit']=qs[_0xed8a('0x1f')](_0x216b49[_0xed8a('0x3c')]['limit']);_0x19e669[_0xed8a('0x21')]=qs[_0xed8a('0x21')](_0x216b49['query'][_0xed8a('0x21')]);}_0x19e669['order']=qs[_0xed8a('0x44')](_0x216b49['query'][_0xed8a('0x44')]);_0x19e669[_0xed8a('0x45')]=qs[_0xed8a('0x3d')](_[_0xed8a('0x46')](_0x216b49[_0xed8a('0x3c')],_0xd3a8dd[_0xed8a('0x3d')]),_0x3352ab);var _0x59a35c=[];var _0x562b30=squel[_0xed8a('0x47')]()[_0xed8a('0x48')]('id')[_0xed8a('0x48')]('name')[_0xed8a('0x48')](_0xed8a('0x49'))[_0xed8a('0x4a')](_0xed8a('0x4b'));var _0x52d6db=squel[_0xed8a('0x47')]()[_0xed8a('0x48')](_0xed8a('0x4c'))['field'](_0xed8a('0x4d'))['field'](_0xed8a('0x4e'))[_0xed8a('0x4a')](_0xed8a('0x4f'),'ui')[_0xed8a('0x50')](_0xed8a('0x51'),'u','u.id\x20=\x20ui.UserId');var _0x1592d5=squel['select']()[_0xed8a('0x4a')](_0xed8a('0x52'),'i')[_0xed8a('0x50')](_0xed8a('0x53'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xed8a('0x50')]('users','o',_0xed8a('0x54'))[_0xed8a('0x50')](_0xed8a('0x55'),'a',_0xed8a('0x56'))['left_join'](_0xed8a('0x57'),'me','me.FaxInteractionId\x20=\x20i.id')[_0xed8a('0x50')](_0xed8a('0x58'),'it',_0xed8a('0x59'))['left_join'](_0xed8a('0x4b'),'t',_0xed8a('0x5a'));var _0x47d009=squel[_0xed8a('0x5b')]();var _0x45090f=[];var _0x21f25e=squel['expr']();var _0x69aca5;if(_0x216b49[_0xed8a('0x3c')]['search']){_0x69aca5=as[_0xed8a('0x5c')](_0x216b49[_0xed8a('0x3c')][_0xed8a('0x5d')]);var _0x4b5280=_0x69aca5[_0xed8a('0x5e')];for(var _0x58715d=0x0;_0x58715d<_0x69aca5['conditions'][_0xed8a('0x41')];_0x58715d++){var _0xdc8449=_0x69aca5['conditions'][_0x58715d];var _0x5d9f79='i';var _0x50768b=_[_0xed8a('0x5f')](_0x3352ab,['name',_0xdc8449['field']]);if(!_0x50768b){switch(_0xdc8449[_0xed8a('0x48')]){case _0xed8a('0x60'):if(_0xdc8449[_0xed8a('0x61')]==0x1){_0x1592d5['having']('`'+_0xdc8449['field']+_0xed8a('0x62'));}else{_0x1592d5[_0xed8a('0x63')]('`'+_0xdc8449['field']+_0xed8a('0x64'));}break;case _0xed8a('0x65'):if(_0xdc8449[_0xed8a('0x66')]===_0xed8a('0x67')){if(_0xdc8449['value'][_0xed8a('0x68')]('\x20')[_0xed8a('0x41')]>0x1){_0x47d009[_0x4b5280]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0xdc8449[_0xed8a('0x61')]),null);}else{var _0x2327f2='%'+_0xdc8449[_0xed8a('0x61')]+'%';_0x47d009[_0x4b5280](_0xed8a('0x69'),_0x2327f2,_0x2327f2,_0x2327f2);}}else{_0x50768b=_[_0xed8a('0x5f')](_0x3352ab,[_0xed8a('0x2d'),'ContactId']);_0xdc8449[_0xed8a('0x48')]=_0xed8a('0x6a');_0x2c13d2=as[_0xed8a('0x6b')](_0x5d9f79,_0x50768b[_0xed8a('0x6c')],_0xdc8449);_0x47d009[_0x4b5280](_0x2c13d2[_0xed8a('0x6d')],_0x2c13d2['value'][_0xed8a('0x6e')],_0x2c13d2['value'][_0xed8a('0x6f')]);}break;case'Tag':var _0x23185d=_0xdc8449['value'][_0xed8a('0x68')](',')[_0xed8a('0x37')](function(_0x5725b9){return Number(_0x5725b9);});_0x23185d[_0xed8a('0x32')](function(_0x1773ba){_0x21f25e['or'](_0xed8a('0x70'),'%,'+_0x1773ba+',%');});_0x45090f=_[_0xed8a('0x71')](_0x45090f,_0x23185d);break;case _0xed8a('0x72'):if(_0xdc8449[_0xed8a('0x66')]==='$substring'){_0x47d009[_0x4b5280]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0xdc8449[_0xed8a('0x61')]+'%',null);}else{_0x50768b=_['find'](_0x3352ab,['name',_0xed8a('0x73')]);_0xdc8449[_0xed8a('0x48')]=_0xed8a('0x73');_0x2c13d2=as[_0xed8a('0x6b')](_0x5d9f79,_0x50768b['type'],_0xdc8449);_0x47d009[_0x4b5280](_0x2c13d2[_0xed8a('0x6d')],_0x2c13d2[_0xed8a('0x61')][_0xed8a('0x6e')],_0x2c13d2['value'][_0xed8a('0x6f')]);}break;case _0xed8a('0x74'):_0x2c13d2=as[_0xed8a('0x6b')]('me',null,_0xdc8449);_0x47d009[_0x4b5280](_0x2c13d2[_0xed8a('0x6d')],_0x2c13d2[_0xed8a('0x61')][_0xed8a('0x6e')],_0x2c13d2[_0xed8a('0x61')][_0xed8a('0x6f')]);break;}}else{var _0x2c13d2=as[_0xed8a('0x6b')](_0x5d9f79,_0x50768b[_0xed8a('0x6c')],_0xdc8449);_0x47d009[_0x4b5280](_0x2c13d2[_0xed8a('0x6d')],_0x2c13d2[_0xed8a('0x61')][_0xed8a('0x6e')],_0x2c13d2['value']['end']);}}}else{var _0x4e8629=_(_0x216b49[_0xed8a('0x3c')])[_0xed8a('0x3b')]()[_0xed8a('0x37')](function(_0x267ad5){return _[_0xed8a('0x75')](_0x3352ab,[_0xed8a('0x2d'),_0x267ad5])?_0x267ad5:undefined;})['compact']()[_0xed8a('0x61')]();if(!_[_0xed8a('0x76')](_0x4e8629)){_0x4e8629[_0xed8a('0x32')](function(_0x563d57){if(_0x563d57===_0xed8a('0x77')){_0x1592d5[_0xed8a('0x45')](_0xed8a('0x78'),[]['concat'](_0x216b49['query'][_0x563d57]));}else if(_0x563d57===_0xed8a('0x79')){var _0x2f2349=JSON[_0xed8a('0x7a')](_0x216b49[_0xed8a('0x3c')][_0x563d57])[_0xed8a('0x7b')];var _0x23947c=JSON[_0xed8a('0x7a')](_0x216b49[_0xed8a('0x3c')][_0x563d57])[_0xed8a('0x7c')];_0x1592d5['where'](_0xed8a('0x7d'),_0x2f2349,_0x23947c);}else{if(_0x216b49[_0xed8a('0x3c')][_0x563d57]===_0xed8a('0x7e')){_0x1592d5[_0xed8a('0x45')]('i.'+_0x563d57+_0xed8a('0x7f'));}else{_0x1592d5[_0xed8a('0x45')]('i.'+_0x563d57+'\x20=\x20?',_0x216b49[_0xed8a('0x3c')][_0x563d57]);}}});}if(_0x216b49['query'][_0xed8a('0x80')]){if(_0x216b49['query'][_0xed8a('0x80')]==0x1){_0x1592d5[_0xed8a('0x63')](_0xed8a('0x81'));}else{_0x1592d5['having'](_0xed8a('0x82'));}}if(_0x216b49['query'][_0xed8a('0x83')]){_0x45090f=_[_0xed8a('0x84')](_0x216b49[_0xed8a('0x3c')]['tag'])?_0x216b49['query'][_0xed8a('0x83')]:new Array(_0x216b49[_0xed8a('0x3c')][_0xed8a('0x83')]);_0x45090f[_0xed8a('0x32')](function(_0x380295){_0x21f25e['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x380295+',%');});}if(_0x216b49[_0xed8a('0x3c')][_0xed8a('0x85')]){var _0x7e8d48=_0x216b49[_0xed8a('0x3c')][_0xed8a('0x85')][_0xed8a('0x86')]('\x5c','\x5c\x5c')[_0xed8a('0x86')](/'/g,'\x27\x27');if(qs[_0xed8a('0x87')](_0x7e8d48)){_0x47d009['or'](_0xed8a('0x88'),_0x7e8d48+'%')['or'](_0xed8a('0x89'),_0x7e8d48+'%');}_0x47d009['or'](_0xed8a('0x8a'),_0x7e8d48+'%');}}_0x1592d5[_0xed8a('0x45')](_0x47d009);_0x1592d5[_0xed8a('0x8b')](_0xed8a('0x8c'));var _0x1a3d76={'type':db[_0xed8a('0x8d')][_0xed8a('0x8e')]['SELECT'],'raw':!![]};var _0x43995e=_0x1592d5[_0xed8a('0x8f')]();_0x43995e[_0xed8a('0x48')](_0xed8a('0x8c'));_0x43995e['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x19e669['order']){_0x19e669[_0xed8a('0x90')][_0xed8a('0x32')](function(_0x5f5105){var _0x6307e7=_0x5f5105[0x0]===_0xed8a('0x91')?_0x5f5105[0x0]:'i.'+_0x5f5105[0x0];_0x1592d5['order'](_0x6307e7,_0x5f5105[0x1]===_0xed8a('0x92')?![]:!![]);});}if(!_['isEmpty'](_0x45090f)){_0x1592d5['having'](_0x21f25e);_0x43995e[_0xed8a('0x45')]('t.id\x20IN\x20?',_0x45090f);}BPromise['resolve']()[_0xed8a('0x29')](function(){if(!_0x69aca5){if(_0x216b49[_0xed8a('0x3c')][_0xed8a('0x77')])return;_0x43995e[_0xed8a('0x45')](_0xed8a('0x93'));_0x1592d5[_0xed8a('0x45')](_0xed8a('0x93'));return;}if(_0x216b49[_0xed8a('0x94')][_0xed8a('0x95')]!==_0xed8a('0x96'))return;return _0x216b49[_0xed8a('0x94')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0xed8a('0x29')](function(_0x374316){if(_['isEmpty'](_0x374316)){_0x43995e[_0xed8a('0x45')](_0xed8a('0x97'));_0x1592d5[_0xed8a('0x45')](_0xed8a('0x97'));}else{_0x43995e[_0xed8a('0x45')](_0xed8a('0x78'),_[_0xed8a('0x37')](_0x374316,'id'));_0x1592d5[_0xed8a('0x45')]('i.FaxAccountId\x20IN\x20?',_[_0xed8a('0x37')](_0x374316,'id'));}});})[_0xed8a('0x29')](function(){if(_0x216b49['user']['role']===_0xed8a('0x96')&&!_0x69aca5&&!_0x216b49[_0xed8a('0x3c')]['FaxAccountId'])return[];return db[_0xed8a('0x98')][_0xed8a('0x3c')](_0x43995e[_0xed8a('0x99')](),_0x1a3d76);})['then'](function(_0x30b4e9){_0x309b1f[_0xed8a('0x20')]=_0x30b4e9[_0xed8a('0x41')];if(_0x309b1f[_0xed8a('0x20')]===0x0)return[];return db[_0xed8a('0x98')]['query'](_0x562b30[_0xed8a('0x99')](),_0x1a3d76)[_0xed8a('0x29')](function(_0x4f658e){_0x59a35c=_[_0xed8a('0x9a')](_0x4f658e,'id');_0x1a3d76=_[_0xed8a('0x9b')](_0x1a3d76,{'model':db[_0xed8a('0x9c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x216b49['query'][_0xed8a('0x40')]){_0x19e669[_0xed8a('0x3e')][_0xed8a('0x32')](function(_0x2bcba8){_0x1592d5[_0xed8a('0x48')]('i.'+_0x2bcba8);});}else{_0x1592d5[_0xed8a('0x48')](_0xed8a('0x9d'),_0xed8a('0x60'));_0x1592d5[_0xed8a('0x48')](_0xed8a('0x9e'),'Account.key');_0x1592d5[_0xed8a('0x48')](_0xed8a('0x9f'),_0xed8a('0xa0'));_0x1592d5[_0xed8a('0x48')](_0xed8a('0xa1'),'contactName');_0x1592d5[_0xed8a('0x48')](_0xed8a('0xa2'));_0x1592d5['field'](_0xed8a('0xa3'),_0xed8a('0xa4'));_0x1592d5['field']('c.lastName',_0xed8a('0xa5'));_0x1592d5[_0xed8a('0x48')]('c.email',_0xed8a('0xa6'));_0x1592d5[_0xed8a('0x48')](_0xed8a('0xa7'),'Contact.phone');_0x1592d5['field'](_0xed8a('0xa8'),_0xed8a('0xa9'));_0x1592d5[_0xed8a('0x48')]('c.fax',_0xed8a('0xaa'));_0x1592d5[_0xed8a('0x48')]('o.fullname',_0xed8a('0xab'));_0x1592d5[_0xed8a('0x48')]('o.internal',_0xed8a('0xac'));_0x1592d5['field'](_0xed8a('0xad'),_0xed8a('0x31'));}if(_0x19e669[_0xed8a('0x1f')])_0x1592d5[_0xed8a('0x1f')](_0x19e669[_0xed8a('0x1f')]);if(_0x19e669[_0xed8a('0x21')])_0x1592d5['offset'](_0x19e669[_0xed8a('0x21')]);return db[_0xed8a('0x98')][_0xed8a('0x3c')](_0x1592d5['toString'](),_0x1a3d76);})['then'](function(_0x2751db){if(_0x2751db[_0xed8a('0x41')]>0x0)_0x52d6db['where'](_0xed8a('0xae'),_[_0xed8a('0x37')](_0x2751db,'id'));return db[_0xed8a('0x98')][_0xed8a('0x3c')](_0x52d6db['toString'](),_0x1a3d76)[_0xed8a('0x29')](function(_0x2eda5f){var _0x358276=_[_0xed8a('0xaf')](_0x2eda5f,_0xed8a('0xb0'));var _0x808a0a=[];_0x2751db[_0xed8a('0x32')](function(_0x9cbca9){_0x808a0a[_0xed8a('0x34')](updateFaxInteraction(_0x9cbca9,_0x59a35c,_0x358276));});return BPromise[_0xed8a('0xb1')](_0x808a0a);});});})[_0xed8a('0x29')](function(_0x21be02){_0x309b1f[_0xed8a('0xb2')]=_0x21be02;return _0x309b1f;})[_0xed8a('0x29')](respondWithFilteredResult(_0x24b33a,_0x19e669))[_0xed8a('0x35')](handleError(_0x24b33a,null));};exports[_0xed8a('0xb3')]=function(_0xb2db1c,_0x137c2f){var _0xfa86f7={'raw':![],'where':{'id':_0xb2db1c[_0xed8a('0xb4')]['id']}},_0x15f67f={};_0x15f67f[_0xed8a('0x3a')]=_[_0xed8a('0x3b')](db['FaxInteraction'][_0xed8a('0x38')]);_0x15f67f[_0xed8a('0x3c')]=_[_0xed8a('0x3b')](_0xb2db1c[_0xed8a('0x3c')]);_0x15f67f[_0xed8a('0x3d')]=_[_0xed8a('0x3f')](_0x15f67f[_0xed8a('0x3a')],_0x15f67f[_0xed8a('0x3c')]);_0xfa86f7[_0xed8a('0x3e')]=_[_0xed8a('0x3f')](_0x15f67f['model'],qs[_0xed8a('0x40')](_0xb2db1c['query'][_0xed8a('0x40')]));_0xfa86f7[_0xed8a('0x3e')]=_0xfa86f7['attributes']['length']?_0xfa86f7[_0xed8a('0x3e')]:_0x15f67f[_0xed8a('0x3a')];if(_0xb2db1c[_0xed8a('0x3c')][_0xed8a('0xb5')]){_0xfa86f7['include']=[{'all':!![]}];}_0xfa86f7=_[_0xed8a('0x9b')]({},_0xfa86f7,_0xb2db1c[_0xed8a('0xb6')]);return db[_0xed8a('0x9c')][_0xed8a('0x5f')](_0xfa86f7)[_0xed8a('0x29')](handleEntityNotFound(_0x137c2f,null))['then'](respondWithResult(_0x137c2f,null))[_0xed8a('0x35')](handleError(_0x137c2f,null));};exports[_0xed8a('0xb7')]=function(_0x5a77c1,_0x152e0a){return db[_0xed8a('0x9c')]['create'](_0x5a77c1['body'],{})[_0xed8a('0x29')](respondWithResult(_0x152e0a,0xc9))[_0xed8a('0x35')](handleError(_0x152e0a,null));};exports[_0xed8a('0x28')]=function(_0x34cdf9,_0x3f886a){if(_0x34cdf9[_0xed8a('0x74')]['id']){delete _0x34cdf9['body']['id'];}return db[_0xed8a('0x9c')][_0xed8a('0x5f')]({'where':{'id':_0x34cdf9['params']['id']}})['then'](handleEntityNotFound(_0x3f886a,null))[_0xed8a('0x29')](saveUpdates(_0x34cdf9[_0xed8a('0x74')],null))['then'](respondWithResult(_0x3f886a,null))[_0xed8a('0x35')](handleError(_0x3f886a,null));};exports[_0xed8a('0x2a')]=function(_0x4a4a34,_0x47e48e){return db['FaxInteraction']['find']({'where':{'id':_0x4a4a34['params']['id']}})['then'](handleEntityNotFound(_0x47e48e,null))[_0xed8a('0x29')](removeEntity(_0x47e48e,null))[_0xed8a('0x35')](handleError(_0x47e48e,null));};exports[_0xed8a('0xb8')]=function(_0x9790ee,_0x412a94){return db[_0xed8a('0x9c')]['describe']()['then'](respondWithResult(_0x412a94,null))[_0xed8a('0x35')](handleError(_0x412a94,null));};exports[_0xed8a('0xb9')]=function(_0x5b5108,_0xfeaf17,_0x1ab48a){return db[_0xed8a('0xba')][_0xed8a('0x5f')]({'where':{'id':_0x5b5108['params']['id']}})[_0xed8a('0x29')](handleEntityNotFound(_0xfeaf17,null))[_0xed8a('0x29')](function(_0x4a544b){if(_0x4a544b){return _0x4a544b['addMessage'](_0x5b5108[_0xed8a('0x74')][_0xed8a('0xbb')],_['omit'](_0x5b5108['body'],[_0xed8a('0xbb'),'id'])||{});}})[_0xed8a('0x29')](respondWithResult(_0xfeaf17,null))['catch'](handleError(_0xfeaf17,null));};exports['getMessages']=function(_0xc09c53,_0x4e49f2,_0x58f24c){var _0x428ef5={'raw':![],'where':{}};var _0xbcaa5b={};var _0x407ad9={'count':0x0,'rows':[]};return db[_0xed8a('0x9c')][_0xed8a('0xbc')]({'where':{'id':_0xc09c53[_0xed8a('0xb4')]['id']}})[_0xed8a('0x29')](handleEntityNotFound(_0x4e49f2,null))[_0xed8a('0x29')](function(_0x4da83e){if(_0x4da83e){_0xbcaa5b[_0xed8a('0x3a')]=_[_0xed8a('0x3b')](db[_0xed8a('0xba')][_0xed8a('0x38')]);_0xbcaa5b['query']=_[_0xed8a('0x3b')](_0xc09c53['query']);_0xbcaa5b[_0xed8a('0x3d')]=_[_0xed8a('0x3f')](_0xbcaa5b[_0xed8a('0x3a')],_0xbcaa5b[_0xed8a('0x3c')]);_0x428ef5[_0xed8a('0x3e')]=_[_0xed8a('0x3f')](_0xbcaa5b[_0xed8a('0x3a')],qs['fields'](_0xc09c53['query'][_0xed8a('0x40')]));_0x428ef5[_0xed8a('0x3e')]=_0x428ef5['attributes']['length']?_0x428ef5['attributes']:_0xbcaa5b['model'];if(!_0xc09c53[_0xed8a('0x3c')][_0xed8a('0x42')](_0xed8a('0x43'))){_0x428ef5[_0xed8a('0x1f')]=qs[_0xed8a('0x1f')](_0xc09c53[_0xed8a('0x3c')][_0xed8a('0x1f')]);_0x428ef5['offset']=qs['offset'](_0xc09c53[_0xed8a('0x3c')][_0xed8a('0x21')]);}_0x428ef5[_0xed8a('0x90')]=qs[_0xed8a('0x44')](_0xc09c53[_0xed8a('0x3c')][_0xed8a('0x44')]);_0x428ef5[_0xed8a('0x45')]=qs[_0xed8a('0x3d')](_[_0xed8a('0x46')](_0xc09c53['query'],_0xbcaa5b[_0xed8a('0x3d')]));_0x428ef5[_0xed8a('0x45')][_0xed8a('0xb0')]=_0x4da83e['id'];if(_0xc09c53['query'][_0xed8a('0x85')]){_0x428ef5[_0xed8a('0x45')]=_[_0xed8a('0x9b')](_0x428ef5[_0xed8a('0x45')],{'$or':_[_0xed8a('0x37')](_0x428ef5[_0xed8a('0x3e')],function(_0x1e6155){var _0x33c2d7={};_0x33c2d7[_0x1e6155]={'$like':'%'+_0xc09c53[_0xed8a('0x3c')]['filter']+'%'};return _0x33c2d7;})});}if(_0xc09c53[_0xed8a('0x3c')][_0xed8a('0x7b')]){var _0x2ab4c6=_0xc09c53[_0xed8a('0x3c')][_0xed8a('0x7b')][_0xed8a('0x68')](',');var _0x5758f4={};_0x5758f4[_0x2ab4c6[0x0]]={'$gte':moment(_0x2ab4c6[0x1])['format'](_0xed8a('0xbd'))};_0x428ef5[_0xed8a('0x45')]=_[_0xed8a('0x9b')](_0x428ef5[_0xed8a('0x45')],_0x5758f4);}_0x428ef5=_[_0xed8a('0x9b')]({},_0x428ef5,_0xc09c53[_0xed8a('0xb6')]);return db[_0xed8a('0xba')][_0xed8a('0x20')]({'where':_0x428ef5[_0xed8a('0x45')]})[_0xed8a('0x29')](function(_0x3a9f7c){_0x407ad9[_0xed8a('0x20')]=_0x3a9f7c;if(_0xc09c53[_0xed8a('0x3c')]['includeAll']){_0x428ef5[_0xed8a('0xbe')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x428ef5);})[_0xed8a('0x29')](function(_0x2fe074){_0x407ad9[_0xed8a('0xb2')]=_0x2fe074;return _0x407ad9;});}})[_0xed8a('0x29')](respondWithFilteredResult(_0x4e49f2,_0x428ef5))['catch'](handleError(_0x4e49f2,null));};exports[_0xed8a('0xbf')]=function(_0x1b5303,_0x145172,_0x2160bc){return db['FaxInteraction']['find']({'where':{'id':_0x1b5303[_0xed8a('0xb4')]['id']}})[_0xed8a('0x29')](handleEntityNotFound(_0x145172,null))[_0xed8a('0x29')](function(_0x85dfab){if(_0x85dfab){return _0x85dfab['setTags'](_0x1b5303['body'][_0xed8a('0xbb')],_[_0xed8a('0xc0')](_0x1b5303[_0xed8a('0x74')],[_0xed8a('0xbb'),'id'])||{})[_0xed8a('0xc1')](function(){return db[_0xed8a('0xc2')][_0xed8a('0xc3')]({'attributes':['id',_0xed8a('0x2d'),_0xed8a('0x49')],'where':{'id':_0x1b5303[_0xed8a('0x74')][_0xed8a('0xbb')]}});})[_0xed8a('0x29')](function(_0x42afb7){socket['emit']('faxInteractionTags:save',{'id':Number(_0x1b5303[_0xed8a('0xb4')]['id']),'tags':_0x42afb7||[]});return{'id':Number(_0x1b5303[_0xed8a('0xb4')]['id']),'tags':_0x42afb7||[]};});}})['then'](respondWithResult(_0x145172,null))[_0xed8a('0x35')](handleError(_0x145172,null));};exports[_0xed8a('0xc4')]=function(_0x5434be,_0xddb2ba,_0x2a2117){return db['FaxInteraction'][_0xed8a('0x5f')]({'where':{'id':_0x5434be[_0xed8a('0xb4')]['id']}})[_0xed8a('0x29')](handleEntityNotFound(_0xddb2ba,null))[_0xed8a('0x29')](function(_0x56e40a){if(_0x56e40a){return _0x56e40a[_0xed8a('0xc4')](_0x5434be['query'][_0xed8a('0xbb')]);}})[_0xed8a('0x29')](respondWithStatusCode(_0xddb2ba,null))['catch'](handleError(_0xddb2ba,null));};exports['download']=function(_0x38c8d7,_0x334138){var _0x42a8f8=moment()[_0xed8a('0xc5')]()['toString']();var _0x1ecca2=path['join'](config[_0xed8a('0xc6')],_0xed8a('0xc7'),_0xed8a('0xc8'),'tmp');var _0x5eb0fe=path['join'](config[_0xed8a('0xc6')],_0xed8a('0xc7'),_0xed8a('0xc8'),_0xed8a('0xc9'));var _0x2cf733=path[_0xed8a('0xca')](_0x1ecca2,_0x42a8f8);var _0x46bfa0=util[_0xed8a('0xcb')](_0xed8a('0xcc'),_0x38c8d7[_0xed8a('0xb4')]['id'],_0x42a8f8);var _0x5840e1=path['join'](_0x1ecca2,_0x46bfa0);var _0x2d1d24=[];_0x2d1d24[_0xed8a('0x34')]({'model':db[_0xed8a('0xcd')],'as':_0xed8a('0xcd'),'raw':!![]});var _0x45b161=[{'model':db[_0xed8a('0xba')],'as':_0xed8a('0xce'),'attributes':['id',_0xed8a('0x74'),_0xed8a('0x79')],'include':_0x2d1d24}];return db[_0xed8a('0x9c')][_0xed8a('0x5f')]({'where':{'id':_0x38c8d7[_0xed8a('0xb4')]['id']},'include':_0x45b161})[_0xed8a('0x29')](handleEntityNotFound(_0x334138,null))['then'](function(_0x3dbadf){if(_0x3dbadf&&_0x3dbadf[_0xed8a('0xce')]){var _0x236701=_0x3dbadf[_0xed8a('0xcf')]({'plain':!![]});fs['mkdirSync'](_0x2cf733);for(var _0x3219a2=0x0;_0x3219a2<_0x236701[_0xed8a('0xce')][_0xed8a('0x41')];_0x3219a2++){var _0x39a2c2=_0x236701[_0xed8a('0xce')][_0x3219a2][_0xed8a('0xcd')];if(_0x39a2c2){var _0x35dd38=path['join'](_0x5eb0fe,_0x39a2c2[_0xed8a('0xd0')]);if(fs['existsSync'](_0x35dd38)){fs[_0xed8a('0xd1')](_0x35dd38)[_0xed8a('0xd2')](fs['createWriteStream'](path[_0xed8a('0xca')](_0x2cf733,_0x39a2c2[_0xed8a('0xd0')])));}}}return BPromise[_0xed8a('0xd3')]()['then'](function(){return new BPromise(function(_0x3ec906,_0x209456){zipdir(_0x2cf733,{'saveTo':_0x5840e1},function(_0x5aa041,_0x540ea0){if(_0x5aa041)return _0x209456(_0x5aa041);return _0x3ec906(_0x540ea0);});})['then'](function(){return new BPromise(function(_0x549794,_0x2b5d48){rimraf(_0x2cf733,function(_0x1acc62){if(_0x1acc62)_0x2b5d48(_0x1acc62);return _0x549794();});});})['then'](function(){return _0x334138[_0xed8a('0xd4')](_0x5840e1,_0x46bfa0,function(_0x2d4bcf){if(_0x2d4bcf){console[_0xed8a('0xd5')](_0xed8a('0xd6'),_0x2d4bcf);}else{fs[_0xed8a('0xd7')](_0x5840e1);}});});});}else{return _0x334138[_0xed8a('0x1c')](0xc8);}})[_0xed8a('0x35')](handleError(_0x334138,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 2275a19..089822f 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 _0x20cf=['findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users'];(function(_0x5431ef,_0x41def0){var _0x204901=function(_0x34bf04){while(--_0x34bf04){_0x5431ef['push'](_0x5431ef['shift']());}};_0x204901(++_0x41def0);}(_0x20cf,0x115));var _0xf20c=function(_0x3c7e51,_0x38d61d){_0x3c7e51=_0x3c7e51-0x0;var _0xd681e0=_0x20cf[_0x3c7e51];return _0xd681e0;};'use strict';var EventEmitter=require(_0xf20c('0x0'));var FaxInteraction=require(_0xf20c('0x1'))['db'][_0xf20c('0x2')];var FaxMessage=require(_0xf20c('0x1'))['db'][_0xf20c('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf20c('0x4')](0x0);var events={'afterCreate':_0xf20c('0x5'),'afterUpdate':'update','afterDestroy':_0xf20c('0x6')};function emitEvent(_0x21a952){return function(_0x367568,_0x371ccc,_0x393147){_0x367568[_0xf20c('0x7')]({'attributes':['id'],'raw':!![]})[_0xf20c('0x8')](function(_0xe9a560){_0x367568[_0xf20c('0x9')](_0xf20c('0xa'),_0xe9a560['map'](function(_0x2a5ad4){return{'id':_0x2a5ad4['id']};}));return FaxMessage[_0xf20c('0xb')]({'where':{'FaxInteractionId':_0x367568['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf20c('0x8')](function(_0x1f8f78){_0x367568[_0xf20c('0x9')](_0xf20c('0xc'),_0x1f8f78['length']);FaxInteractionEvents[_0xf20c('0xd')](_0x21a952+':'+_0x367568['id'],_0x367568);FaxInteractionEvents['emit'](_0x21a952,_0x367568);_0x393147(null);})[_0xf20c('0xe')](_0x393147(null));};}for(var e in events){if(events[_0xf20c('0xf')](e)){var event=events[e];FaxInteraction[_0xf20c('0x10')](e,emitEvent(event));}}module[_0xf20c('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0x73f7=['getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','FaxInteraction','setMaxListeners','update','remove'];(function(_0x2b62d2,_0x3fce9b){var _0x22f790=function(_0x359734){while(--_0x359734){_0x2b62d2['push'](_0x2b62d2['shift']());}};_0x22f790(++_0x3fce9b);}(_0x73f7,0x16b));var _0x773f=function(_0x452f0e,_0x2fd0d4){_0x452f0e=_0x452f0e-0x0;var _0x323f96=_0x73f7[_0x452f0e];return _0x323f96;};'use strict';var EventEmitter=require(_0x773f('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0x773f('0x1')];var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x773f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x773f('0x3'),'afterDestroy':_0x773f('0x4')};function emitEvent(_0x5b22fd){return function(_0x3c3c3d,_0xf4e147,_0x4713e7){_0x3c3c3d[_0x773f('0x5')]({'attributes':['id'],'raw':!![]})[_0x773f('0x6')](function(_0x30cdf6){_0x3c3c3d[_0x773f('0x7')]('Users',_0x30cdf6[_0x773f('0x8')](function(_0x4beca0){return{'id':_0x4beca0['id']};}));return FaxMessage[_0x773f('0x9')]({'where':{'FaxInteractionId':_0x3c3c3d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x773f('0x6')](function(_0x4545d2){_0x3c3c3d[_0x773f('0x7')](_0x773f('0xa'),_0x4545d2[_0x773f('0xb')]);FaxInteractionEvents[_0x773f('0xc')](_0x5b22fd+':'+_0x3c3c3d['id'],_0x3c3c3d);FaxInteractionEvents[_0x773f('0xc')](_0x5b22fd,_0x3c3c3d);_0x4713e7(null);})['catch'](_0x4713e7(null));};}for(var e in events){if(events[_0x773f('0xd')](e)){var event=events[e];FaxInteraction[_0x773f('0xe')](e,emitEvent(event));}}module[_0x773f('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index e3bf1de..ca69fbd 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 _0x7b77=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxInteraction.attributes','exports','define','fax_interactions','changed','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x1a6572,_0x4b6b55){var _0x1c33a5=function(_0x9818f5){while(--_0x9818f5){_0x1a6572['push'](_0x1a6572['shift']());}};_0x1c33a5(++_0x4b6b55);}(_0x7b77,0x179));var _0x77b7=function(_0x45d1fd,_0x463212){_0x45d1fd=_0x45d1fd-0x0;var _0xd0e542=_0x7b77[_0x45d1fd];return _0xd0e542;};'use strict';var _=require(_0x77b7('0x0'));var util=require(_0x77b7('0x1'));var logger=require(_0x77b7('0x2'))(_0x77b7('0x3'));var moment=require('moment');var BPromise=require(_0x77b7('0x4'));var rp=require(_0x77b7('0x5'));var fs=require('fs');var path=require(_0x77b7('0x6'));var rimraf=require('rimraf');var config=require(_0x77b7('0x7'));var attributes=require(_0x77b7('0x8'));module[_0x77b7('0x9')]=function(_0x3d97f0,_0x4556c1){return _0x3d97f0[_0x77b7('0xa')]('FaxInteraction',attributes,{'tableName':_0x77b7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x32b8ab,_0x33d439,_0x4abf3a){if(_0x32b8ab[_0x77b7('0xc')]('closed')){_0x32b8ab['closedAt']=moment()['format'](_0x77b7('0xd'));}_0x4abf3a(null,_0x32b8ab);}}});}; \ No newline at end of file +var _0x0b49=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','FaxInteraction','fax_interactions','changed','closed'];(function(_0x2d086e,_0x5516c7){var _0x39bd87=function(_0x4c9997){while(--_0x4c9997){_0x2d086e['push'](_0x2d086e['shift']());}};_0x39bd87(++_0x5516c7);}(_0x0b49,0x69));var _0x90b4=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x0b49[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0x90b4('0x0'));var util=require(_0x90b4('0x1'));var logger=require(_0x90b4('0x2'))('api');var moment=require(_0x90b4('0x3'));var BPromise=require('bluebird');var rp=require(_0x90b4('0x4'));var fs=require('fs');var path=require(_0x90b4('0x5'));var rimraf=require(_0x90b4('0x6'));var config=require(_0x90b4('0x7'));var attributes=require('./faxInteraction.attributes');module[_0x90b4('0x8')]=function(_0x16d921,_0x31a4b7){return _0x16d921[_0x90b4('0x9')](_0x90b4('0xa'),attributes,{'tableName':_0x90b4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1001fa,_0x4a0410,_0x183ab5){if(_0x1001fa[_0x90b4('0xc')](_0x90b4('0xd'))){_0x1001fa[_0x90b4('0xe')]=moment()[_0x90b4('0xf')](_0x90b4('0x10'));}_0x183ab5(null,_0x1001fa);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 032619d..3e3ae0a 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 _0xcf92=['attributes','limit','AddTagsToFaxInteraction','find','where','addTags','ids','omit','body','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','then','info','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','options'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xcf92,0x86));var _0x2cf9=function(_0x185f3f,_0x2923ef){_0x185f3f=_0x185f3f-0x0;var _0x465cf8=_0xcf92[_0x185f3f];return _0x465cf8;};'use strict';var _=require(_0x2cf9('0x0'));var util=require(_0x2cf9('0x1'));var moment=require('moment');var BPromise=require(_0x2cf9('0x2'));var rs=require(_0x2cf9('0x3'));var fs=require('fs');var Redis=require(_0x2cf9('0x4'));var db=require(_0x2cf9('0x5'))['db'];var utils=require(_0x2cf9('0x6'));var logger=require(_0x2cf9('0x7'))(_0x2cf9('0x8'));var config=require(_0x2cf9('0x9'));var jayson=require(_0x2cf9('0xa'));var client=jayson[_0x2cf9('0xb')][_0x2cf9('0xc')]({'port':0x232a});config[_0x2cf9('0xd')]=_[_0x2cf9('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2cf9('0xd')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x437320,_0x5d7201,_0x2bdc3b){return new BPromise(function(_0x37bd14,_0x34d740){return client['request'](_0x437320,_0x2bdc3b)[_0x2cf9('0xf')](function(_0x17f1c4){logger[_0x2cf9('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x5d7201,'request\x20sent');logger[_0x2cf9('0x11')](_0x2cf9('0x12'),_0x5d7201,_0x2cf9('0x13'),JSON[_0x2cf9('0x14')](_0x17f1c4));if(_0x17f1c4[_0x2cf9('0x15')]){if(_0x17f1c4[_0x2cf9('0x15')]['code']===0x1f4){logger[_0x2cf9('0x15')](_0x2cf9('0x16'),_0x5d7201,_0x17f1c4[_0x2cf9('0x15')][_0x2cf9('0x17')]);return _0x34d740(_0x17f1c4[_0x2cf9('0x15')][_0x2cf9('0x17')]);}logger[_0x2cf9('0x15')](_0x2cf9('0x16'),_0x5d7201,_0x17f1c4[_0x2cf9('0x15')][_0x2cf9('0x17')]);return _0x37bd14(_0x17f1c4[_0x2cf9('0x15')][_0x2cf9('0x17')]);}else{logger['info'](_0x2cf9('0x16'),_0x5d7201,_0x2cf9('0x13'));_0x37bd14(_0x17f1c4[_0x2cf9('0x18')]['message']);}})[_0x2cf9('0x19')](function(_0x37ec08){logger[_0x2cf9('0x15')](_0x2cf9('0x16'),_0x5d7201,_0x37ec08);_0x34d740(_0x37ec08);});});}exports[_0x2cf9('0x1a')]=function(_0x20031a){var _0x4ac052=this;return new Promise(function(_0x31e56a,_0x241526){return db[_0x2cf9('0x1b')][_0x2cf9('0x1c')](_0x20031a['body'],{'raw':_0x20031a[_0x2cf9('0x1d')]?_0x20031a[_0x2cf9('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20031a[_0x2cf9('0x1d')]?_0x20031a[_0x2cf9('0x1d')]['where']||null:null,'attributes':_0x20031a['options']?_0x20031a[_0x2cf9('0x1d')][_0x2cf9('0x1e')]||null:null,'limit':_0x20031a['options']?_0x20031a[_0x2cf9('0x1d')][_0x2cf9('0x1f')]||null:null})['then'](function(_0x4ccfd8){logger[_0x2cf9('0x10')](_0x2cf9('0x1a'),_0x20031a);logger[_0x2cf9('0x11')](_0x2cf9('0x1a'),_0x20031a,JSON[_0x2cf9('0x14')](_0x4ccfd8));_0x31e56a(_0x4ccfd8);})['catch'](function(_0x59636e){logger[_0x2cf9('0x15')](_0x2cf9('0x1a'),_0x59636e[_0x2cf9('0x17')],_0x20031a);_0x241526(_0x4ac052['error'](0x1f4,_0x59636e[_0x2cf9('0x17')]));});});};exports[_0x2cf9('0x20')]=function(_0x4cf86d){return new Promise(function(_0x3dc178,_0x355d77){return db['FaxInteraction'][_0x2cf9('0x21')]({'where':_0x4cf86d[_0x2cf9('0x1d')]?_0x4cf86d[_0x2cf9('0x1d')][_0x2cf9('0x22')]||null:null})['then'](function(_0x554853){if(_0x554853){return _0x554853[_0x2cf9('0x23')](_0x4cf86d['body'][_0x2cf9('0x24')],_[_0x2cf9('0x25')](_0x4cf86d[_0x2cf9('0x26')],[_0x2cf9('0x24'),'id'])||{});}})[_0x2cf9('0x27')](function(_0x28e657){logger[_0x2cf9('0x10')](_0x2cf9('0x28'),_0x4cf86d);logger[_0x2cf9('0x11')](_0x2cf9('0x28'),_0x4cf86d,JSON['stringify'](_0x28e657));_0x3dc178(_0x28e657);})[_0x2cf9('0x19')](function(_0x9ef0ad){logger[_0x2cf9('0x15')]('AddTags',_0x9ef0ad['message'],_0x4cf86d);_0x355d77(_this['error'](0x1f4,_0x9ef0ad[_0x2cf9('0x17')]));});});}; \ No newline at end of file +var _0x860e=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','socket.io-emitter','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxInteraction,\x20%s,\x20%s','result','catch','update','body','options','raw','where','attributes','limit','UpdateFaxInteraction','AddTagsToFaxInteraction','addTags','ids','omit','spread','AddTags','lodash','util'];(function(_0x511bc3,_0x4dd5ea){var _0x264a10=function(_0x2e66ae){while(--_0x2e66ae){_0x511bc3['push'](_0x511bc3['shift']());}};_0x264a10(++_0x4dd5ea);}(_0x860e,0x1ab));var _0xe860=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x860e[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xe860('0x0'));var util=require(_0xe860('0x1'));var moment=require(_0xe860('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe860('0x3'));var db=require(_0xe860('0x4'))['db'];var utils=require(_0xe860('0x5'));var logger=require(_0xe860('0x6'))(_0xe860('0x7'));var config=require(_0xe860('0x8'));var jayson=require(_0xe860('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xe860('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe860('0xb'))(new Redis(config[_0xe860('0xa')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x3cd3d4,_0x272428,_0x45d2ea){return new BPromise(function(_0x28c4a1,_0x5385db){return client[_0xe860('0xc')](_0x3cd3d4,_0x45d2ea)[_0xe860('0xd')](function(_0x39c581){logger[_0xe860('0xe')]('FaxInteraction,\x20%s,\x20%s',_0x272428,_0xe860('0xf'));logger[_0xe860('0x10')](_0xe860('0x11'),_0x272428,'request\x20sent',JSON[_0xe860('0x12')](_0x39c581));if(_0x39c581[_0xe860('0x13')]){if(_0x39c581['error'][_0xe860('0x14')]===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x272428,_0x39c581[_0xe860('0x13')][_0xe860('0x15')]);return _0x5385db(_0x39c581[_0xe860('0x13')][_0xe860('0x15')]);}logger[_0xe860('0x13')](_0xe860('0x16'),_0x272428,_0x39c581['error'][_0xe860('0x15')]);return _0x28c4a1(_0x39c581[_0xe860('0x13')][_0xe860('0x15')]);}else{logger[_0xe860('0xe')](_0xe860('0x16'),_0x272428,_0xe860('0xf'));_0x28c4a1(_0x39c581[_0xe860('0x17')][_0xe860('0x15')]);}})[_0xe860('0x18')](function(_0x14e85d){logger[_0xe860('0x13')](_0xe860('0x16'),_0x272428,_0x14e85d);_0x5385db(_0x14e85d);});});}exports['UpdateFaxInteraction']=function(_0x3981f0){var _0x43f32a=this;return new Promise(function(_0x43aa3a,_0x5d7c13){return db['FaxInteraction'][_0xe860('0x19')](_0x3981f0[_0xe860('0x1a')],{'raw':_0x3981f0['options']?_0x3981f0[_0xe860('0x1b')][_0xe860('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3981f0[_0xe860('0x1b')]?_0x3981f0[_0xe860('0x1b')][_0xe860('0x1d')]||null:null,'attributes':_0x3981f0['options']?_0x3981f0[_0xe860('0x1b')][_0xe860('0x1e')]||null:null,'limit':_0x3981f0[_0xe860('0x1b')]?_0x3981f0[_0xe860('0x1b')][_0xe860('0x1f')]||null:null})['then'](function(_0x49dee4){logger[_0xe860('0xe')](_0xe860('0x20'),_0x3981f0);logger[_0xe860('0x10')](_0xe860('0x20'),_0x3981f0,JSON['stringify'](_0x49dee4));_0x43aa3a(_0x49dee4);})[_0xe860('0x18')](function(_0x45b6e3){logger[_0xe860('0x13')](_0xe860('0x20'),_0x45b6e3[_0xe860('0x15')],_0x3981f0);_0x5d7c13(_0x43f32a[_0xe860('0x13')](0x1f4,_0x45b6e3[_0xe860('0x15')]));});});};exports[_0xe860('0x21')]=function(_0x5dcef3){return new Promise(function(_0x568c9f,_0x198d6b){return db['FaxInteraction']['find']({'where':_0x5dcef3[_0xe860('0x1b')]?_0x5dcef3[_0xe860('0x1b')][_0xe860('0x1d')]||null:null})[_0xe860('0xd')](function(_0x59410c){if(_0x59410c){return _0x59410c[_0xe860('0x22')](_0x5dcef3['body'][_0xe860('0x23')],_[_0xe860('0x24')](_0x5dcef3[_0xe860('0x1a')],[_0xe860('0x23'),'id'])||{});}})[_0xe860('0x25')](function(_0x23b6a2){logger['info'](_0xe860('0x26'),_0x5dcef3);logger[_0xe860('0x10')]('AddTags',_0x5dcef3,JSON[_0xe860('0x12')](_0x23b6a2));_0x568c9f(_0x23b6a2);})[_0xe860('0x18')](function(_0x531c04){logger[_0xe860('0x13')](_0xe860('0x26'),_0x531c04[_0xe860('0x15')],_0x5dcef3);_0x198d6b(_this[_0xe860('0x13')](0x1f4,_0x531c04[_0xe860('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 6c30704..d1ed039 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 _0x3777=['remove','update','removeListener','register','./faxInteraction.events','save'];(function(_0x49221b,_0x206f1f){var _0x359429=function(_0x3a8c96){while(--_0x3a8c96){_0x49221b['push'](_0x49221b['shift']());}};_0x359429(++_0x206f1f);}(_0x3777,0x124));var _0x7377=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x3777[_0x173d7e];return _0x2220d6;};'use strict';var FaxInteractionEvents=require(_0x7377('0x0'));var events=[_0x7377('0x1'),_0x7377('0x2'),_0x7377('0x3')];function createListener(_0x41ba50,_0x3a5458){return function(_0x3a5ac5){_0x3a5458['emit'](_0x41ba50,_0x3a5ac5);};}function removeListener(_0x1f125c,_0x4b2a9d){return function(){FaxInteractionEvents[_0x7377('0x4')](_0x1f125c,_0x4b2a9d);};}exports[_0x7377('0x5')]=function(_0x2ce462){for(var _0x5777d6=0x0,_0x23ad84=events['length'];_0x5777d6<_0x23ad84;_0x5777d6++){var _0x2f4448=events[_0x5777d6];var _0x2cf5c1=createListener('faxInteraction:'+_0x2f4448,_0x2ce462);FaxInteractionEvents['on'](_0x2f4448,_0x2cf5c1);}}; \ No newline at end of file +var _0xf64b=['emit','length','faxInteraction:','./faxInteraction.events','remove','update'];(function(_0x128b23,_0x504677){var _0x503678=function(_0x33c608){while(--_0x33c608){_0x128b23['push'](_0x128b23['shift']());}};_0x503678(++_0x504677);}(_0xf64b,0x17d));var _0xbf64=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xf64b[_0x187ee1];return _0x388160;};'use strict';var FaxInteractionEvents=require(_0xbf64('0x0'));var events=['save',_0xbf64('0x1'),_0xbf64('0x2')];function createListener(_0x28c5dd,_0x2b38ce){return function(_0x42cabe){_0x2b38ce[_0xbf64('0x3')](_0x28c5dd,_0x42cabe);};}function removeListener(_0x1e7027,_0x2d3538){return function(){FaxInteractionEvents['removeListener'](_0x1e7027,_0x2d3538);};}exports['register']=function(_0x7895f9){for(var _0x5d1256=0x0,_0x327afb=events[_0xbf64('0x4')];_0x5d1256<_0x327afb;_0x5d1256++){var _0x263ea3=events[_0x5d1256];var _0x111fda=createListener(_0xbf64('0x5')+_0x263ea3,_0x7895f9);FaxInteractionEvents['on'](_0x263ea3,_0x111fda);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 24ce6b9..9e5d849 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 _0x32a6=['/:id/download','download','post','create','tracked','faxinteraction:addtags','addTags','put','fax','faxinteraction:update','faxinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages'];(function(_0x31db51,_0x4557c3){var _0x5233f0=function(_0x36e381){while(--_0x36e381){_0x31db51['push'](_0x31db51['shift']());}};_0x5233f0(++_0x4557c3);}(_0x32a6,0x108));var _0x632a=function(_0x3df519,_0xed17c6){_0x3df519=_0x3df519-0x0;var _0xd01f66=_0x32a6[_0x3df519];return _0xd01f66;};'use strict';var multer=require(_0x632a('0x0'));var util=require('util');var path=require(_0x632a('0x1'));var timeout=require(_0x632a('0x2'));var express=require('express');var router=express[_0x632a('0x3')]();var fs_extra=require(_0x632a('0x4'));var auth=require(_0x632a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x632a('0x6'));var controller=require(_0x632a('0x7'));router[_0x632a('0x8')]('/',auth[_0x632a('0x9')](),controller[_0x632a('0xa')]);router[_0x632a('0x8')](_0x632a('0xb'),auth['isAuthenticated'](),controller[_0x632a('0xc')]);router[_0x632a('0x8')](_0x632a('0xd'),auth[_0x632a('0x9')](),controller['show']);router[_0x632a('0x8')](_0x632a('0xe'),auth[_0x632a('0x9')](),controller['getMessages']);router[_0x632a('0x8')](_0x632a('0xf'),auth[_0x632a('0x9')](),controller[_0x632a('0x10')]);router[_0x632a('0x11')]('/',auth[_0x632a('0x9')](),controller[_0x632a('0x12')]);router['post']('/:id/messages',auth[_0x632a('0x9')](),controller['addMessage']);router[_0x632a('0x11')]('/:id/tags',auth[_0x632a('0x9')](),interaction[_0x632a('0x13')]('fax',_0x632a('0x14')),controller[_0x632a('0x15')]);router[_0x632a('0x16')](_0x632a('0xd'),auth['isAuthenticated'](),interaction['tracked'](_0x632a('0x17'),_0x632a('0x18')),controller['update']);router['delete'](_0x632a('0xd'),auth[_0x632a('0x9')](),interaction[_0x632a('0x13')](_0x632a('0x17'),_0x632a('0x19')),controller[_0x632a('0x1a')]);router[_0x632a('0x1b')](_0x632a('0x1c'),auth['isAuthenticated'](),controller[_0x632a('0x1d')]);module[_0x632a('0x1e')]=router; \ No newline at end of file +var _0x3cfa=['describe','/:id','show','/:id/messages','download','post','/:id/tags','fax','faxinteraction:update','update','delete','faxinteraction:destroy','removeTags','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','index','/describe','isAuthenticated'];(function(_0x53415b,_0x95605){var _0x3cc127=function(_0x29134e){while(--_0x29134e){_0x53415b['push'](_0x53415b['shift']());}};_0x3cc127(++_0x95605);}(_0x3cfa,0x6d));var _0xa3cf=function(_0x5b426f,_0x522174){_0x5b426f=_0x5b426f-0x0;var _0x4376ba=_0x3cfa[_0x5b426f];return _0x4376ba;};'use strict';var multer=require('multer');var util=require(_0xa3cf('0x0'));var path=require('path');var timeout=require(_0xa3cf('0x1'));var express=require(_0xa3cf('0x2'));var router=express['Router']();var fs_extra=require(_0xa3cf('0x3'));var auth=require(_0xa3cf('0x4'));var interaction=require(_0xa3cf('0x5'));var config=require('../../config/environment');var controller=require(_0xa3cf('0x6'));router[_0xa3cf('0x7')]('/',auth['isAuthenticated'](),controller[_0xa3cf('0x8')]);router[_0xa3cf('0x7')](_0xa3cf('0x9'),auth[_0xa3cf('0xa')](),controller[_0xa3cf('0xb')]);router[_0xa3cf('0x7')](_0xa3cf('0xc'),auth[_0xa3cf('0xa')](),controller[_0xa3cf('0xd')]);router[_0xa3cf('0x7')](_0xa3cf('0xe'),auth['isAuthenticated'](),controller['getMessages']);router[_0xa3cf('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0xa3cf('0xf')]);router[_0xa3cf('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa3cf('0x10')](_0xa3cf('0xe'),auth['isAuthenticated'](),controller['addMessage']);router['post'](_0xa3cf('0x11'),auth[_0xa3cf('0xa')](),interaction['tracked'](_0xa3cf('0x12'),'faxinteraction:addtags'),controller['addTags']);router['put'](_0xa3cf('0xc'),auth[_0xa3cf('0xa')](),interaction['tracked'](_0xa3cf('0x12'),_0xa3cf('0x13')),controller[_0xa3cf('0x14')]);router[_0xa3cf('0x15')](_0xa3cf('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0xa3cf('0x12'),_0xa3cf('0x16')),controller['destroy']);router['delete'](_0xa3cf('0x11'),auth[_0xa3cf('0xa')](),controller[_0xa3cf('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 728d076..aa8ec1b 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 _0xb647=['ENUM','out','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x261a1a,_0x269ddd){var _0x3ce41f=function(_0x4eae33){while(--_0x4eae33){_0x261a1a['push'](_0x261a1a['shift']());}};_0x3ce41f(++_0x269ddd);}(_0xb647,0xdb));var _0x7b64=function(_0x4945a0,_0x44ee37){_0x4945a0=_0x4945a0-0x0;var _0xbb98a6=_0xb647[_0x4945a0];return _0xbb98a6;};'use strict';var Sequelize=require(_0x7b64('0x0'));module[_0x7b64('0x1')]={'body':{'type':Sequelize[_0x7b64('0x2')](_0x7b64('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x7b64('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7b64('0x5')]('in',_0x7b64('0x6')),'defaultValue':_0x7b64('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x7b64('0x7')]}}; \ No newline at end of file +var _0xbe31=['medium','BOOLEAN','ENUM','out','DATE','exports','TEXT'];(function(_0x4bbb2a,_0x577dad){var _0x35b2ae=function(_0x17185f){while(--_0x17185f){_0x4bbb2a['push'](_0x4bbb2a['shift']());}};_0x35b2ae(++_0x577dad);}(_0xbe31,0x83));var _0x1be3=function(_0x350258,_0x4e0a50){_0x350258=_0x350258-0x0;var _0x3714b3=_0xbe31[_0x350258];return _0x3714b3;};'use strict';var Sequelize=require('sequelize');module[_0x1be3('0x0')]={'body':{'type':Sequelize[_0x1be3('0x1')](_0x1be3('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x1be3('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1be3('0x4')]('in',_0x1be3('0x5')),'defaultValue':_0x1be3('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x1be3('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x1be3('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 0972482..d5f0ba3 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 _0x9d48=['join','root','server','files','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','info','catch','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','destroy','stack','name','index','map','FaxMessage','rawAttributes','fieldName','type','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','limit','order','sort','where','filter','VIRTUAL','merge','includeAll','rows','params','include','find','body','describe','fax-interactions','accept','fax','read','readAt','UserId','user','agent','get','FaxInteraction','FaxInteractionId','update','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','contact','User','fullname','email','internal','manual','format','SIP/%s','channel','event','EventManager','acceptmessage','RejectMessage','ContactId','SELECT','interface','rejectmessage','create','CmContact','findOne','Attachment','SendFax','FaxAccountId','basename','AttachmentId','download'];(function(_0x29e3b6,_0x40b0b4){var _0x55d4b0=function(_0x55c58e){while(--_0x55c58e){_0x29e3b6['push'](_0x29e3b6['shift']());}};_0x55d4b0(++_0x40b0b4);}(_0x9d48,0x92));var _0x89d4=function(_0x1cfc39,_0x1d3913){_0x1cfc39=_0x1cfc39-0x0;var _0x957a28=_0x9d48[_0x1cfc39];return _0x957a28;};'use strict';var emlformat=require(_0x89d4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x89d4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x89d4('0x2'));var moment=require(_0x89d4('0x3'));var BPromise=require(_0x89d4('0x4'));var Mustache=require(_0x89d4('0x5'));var util=require(_0x89d4('0x6'));var path=require('path');var sox=require(_0x89d4('0x7'));var csv=require(_0x89d4('0x8'));var ejs=require(_0x89d4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x89d4('0xa'));var squel=require(_0x89d4('0xb'));var crypto=require(_0x89d4('0xc'));var jsforce=require(_0x89d4('0xd'));var deskjs=require(_0x89d4('0xe'));var toCsv=require(_0x89d4('0x8'));var querystring=require(_0x89d4('0xf'));var Papa=require(_0x89d4('0x10'));var Redis=require(_0x89d4('0x11'));var authService=require(_0x89d4('0x12'));var qs=require(_0x89d4('0x13'));var as=require(_0x89d4('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x89d4('0x15'))(_0x89d4('0x16'));var utils=require('../../config/utils');var config=require(_0x89d4('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x89d4('0x18'))['db'];config[_0x89d4('0x19')]=_[_0x89d4('0x1a')](config[_0x89d4('0x19')],{'host':_0x89d4('0x1b'),'port':0x18eb});var socket=require(_0x89d4('0x1c'))(new Redis(config[_0x89d4('0x19')]));require('./faxMessage.socket')[_0x89d4('0x1d')](socket);var jayson=require(_0x89d4('0x1e'));var client=jayson[_0x89d4('0x1f')][_0x89d4('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x89d4('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x125fa0,_0x2f0b92,_0x195b5a,_0x1c08fc){return new BPromise(function(_0x3e54fa,_0x219f11){var _0x3c53d0=_0x1c08fc||client;return _0x3c53d0[_0x89d4('0x21')](_0x125fa0,_0x195b5a)[_0x89d4('0x22')](function(_0x41f237){logger['info']('FaxMessage,\x20%s,\x20%s',_0x2f0b92,_0x89d4('0x23'));logger[_0x89d4('0x24')](_0x89d4('0x25'),_0x2f0b92,_0x89d4('0x23'),JSON[_0x89d4('0x26')](_0x41f237));if(_0x41f237['error']){if(_0x41f237[_0x89d4('0x27')][_0x89d4('0x28')]===0x1f4){logger[_0x89d4('0x27')](_0x89d4('0x29'),_0x2f0b92,_0x41f237[_0x89d4('0x27')]['message']);return _0x219f11(_0x41f237[_0x89d4('0x27')]['message']);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x2f0b92,_0x41f237[_0x89d4('0x27')][_0x89d4('0x2a')]);return _0x3e54fa(_0x41f237['error'][_0x89d4('0x2a')]);}else{logger[_0x89d4('0x2b')](_0x89d4('0x29'),_0x2f0b92,_0x89d4('0x23'));_0x3e54fa(_0x41f237['result'][_0x89d4('0x2a')]);}})[_0x89d4('0x2c')](function(_0x5e0817){logger['error']('FaxMessage,\x20%s,\x20%s',_0x2f0b92,_0x5e0817);_0x219f11(_0x5e0817);});});}function respondWithStatusCode(_0x1e264a,_0x4a5ea4){_0x4a5ea4=_0x4a5ea4||0xcc;return function(_0x4970b8){if(_0x4970b8){return _0x1e264a[_0x89d4('0x2d')](_0x4a5ea4);}return _0x1e264a[_0x89d4('0x2e')](_0x4a5ea4)[_0x89d4('0x2f')]();};}function respondWithResult(_0x5c702d,_0x3ac992){_0x3ac992=_0x3ac992||0xc8;return function(_0xbefaa3){if(_0xbefaa3){return _0x5c702d['status'](_0x3ac992)[_0x89d4('0x30')](_0xbefaa3);}};}function respondWithFilteredResult(_0x1cad4a,_0x40be93){return function(_0x242a1c){if(_0x242a1c){var _0x5ba893=typeof _0x40be93[_0x89d4('0x31')]==='undefined'&&typeof _0x40be93['limit']===_0x89d4('0x32');var _0x53b601=_0x242a1c[_0x89d4('0x33')];var _0x88b0d8=_0x5ba893?0x0:_0x40be93['offset'];var _0x4ede79=_0x5ba893?_0x242a1c['count']:_0x40be93[_0x89d4('0x31')]+_0x40be93['limit'];var _0xdfbcf3;if(_0x4ede79>=_0x53b601){_0x4ede79=_0x53b601;_0xdfbcf3=0xc8;}else{_0xdfbcf3=0xce;}_0x1cad4a[_0x89d4('0x2e')](_0xdfbcf3);return _0x1cad4a[_0x89d4('0x34')](_0x89d4('0x35'),_0x88b0d8+'-'+_0x4ede79+'/'+_0x53b601)[_0x89d4('0x30')](_0x242a1c);}return null;};}function patchUpdates(_0x22fc15){return function(_0x29f9fc){try{jsonpatch[_0x89d4('0x36')](_0x29f9fc,_0x22fc15,!![]);}catch(_0x4b7fc6){return BPromise[_0x89d4('0x37')](_0x4b7fc6);}return _0x29f9fc['save']();};}function saveUpdates(_0x32d367,_0x4eb800){return function(_0x4d117c){if(_0x4d117c){return _0x4d117c['update'](_0x32d367)[_0x89d4('0x22')](function(_0x214e53){return _0x214e53;});}return null;};}function removeEntity(_0x327297,_0xa89c6b){return function(_0x9137c0){if(_0x9137c0){return _0x9137c0[_0x89d4('0x38')]()['then'](function(){_0x327297[_0x89d4('0x2e')](0xcc)[_0x89d4('0x2f')]();});}};}function handleEntityNotFound(_0x4645e8,_0x16f8d0){return function(_0x2a2520){if(!_0x2a2520){_0x4645e8[_0x89d4('0x2d')](0x194);}return _0x2a2520;};}function handleError(_0xce4400,_0x215deb){_0x215deb=_0x215deb||0x1f4;return function(_0x49630c){logger['error'](_0x49630c[_0x89d4('0x39')]);if(_0x49630c[_0x89d4('0x3a')]){delete _0x49630c[_0x89d4('0x3a')];}_0xce4400['status'](_0x215deb)['send'](_0x49630c);};}exports[_0x89d4('0x3b')]=function(_0x161615,_0x489153){var _0x390de6={},_0x2f0e76={},_0x503ab7={'count':0x0,'rows':[]};var _0x340c78=_[_0x89d4('0x3c')](db[_0x89d4('0x3d')][_0x89d4('0x3e')],function(_0x4a5fb0){return{'name':_0x4a5fb0[_0x89d4('0x3f')],'type':_0x4a5fb0[_0x89d4('0x40')]['key']};});_0x2f0e76['model']=_[_0x89d4('0x3c')](_0x340c78,_0x89d4('0x3a'));_0x2f0e76[_0x89d4('0x41')]=_[_0x89d4('0x42')](_0x161615[_0x89d4('0x41')]);_0x2f0e76[_0x89d4('0x43')]=_['intersection'](_0x2f0e76['model'],_0x2f0e76[_0x89d4('0x41')]);_0x390de6[_0x89d4('0x44')]=_[_0x89d4('0x45')](_0x2f0e76[_0x89d4('0x46')],qs['fields'](_0x161615[_0x89d4('0x41')][_0x89d4('0x47')]));_0x390de6[_0x89d4('0x44')]=_0x390de6[_0x89d4('0x44')][_0x89d4('0x48')]?_0x390de6[_0x89d4('0x44')]:_0x2f0e76['model'];if(!_0x161615[_0x89d4('0x41')][_0x89d4('0x49')]('nolimit')){_0x390de6[_0x89d4('0x4a')]=qs[_0x89d4('0x4a')](_0x161615[_0x89d4('0x41')][_0x89d4('0x4a')]);_0x390de6[_0x89d4('0x31')]=qs['offset'](_0x161615['query'][_0x89d4('0x31')]);}_0x390de6[_0x89d4('0x4b')]=qs['sort'](_0x161615[_0x89d4('0x41')][_0x89d4('0x4c')]);_0x390de6[_0x89d4('0x4d')]=qs['filters'](_['pick'](_0x161615[_0x89d4('0x41')],_0x2f0e76[_0x89d4('0x43')]),_0x340c78);if(_0x161615[_0x89d4('0x41')][_0x89d4('0x4e')]){_0x390de6[_0x89d4('0x4d')]=_['merge'](_0x390de6['where'],{'$or':_[_0x89d4('0x3c')](_0x340c78,function(_0x4ac33f){if(_0x4ac33f[_0x89d4('0x40')]!==_0x89d4('0x4f')){var _0x14b4ca={};_0x14b4ca[_0x4ac33f[_0x89d4('0x3a')]]={'$like':'%'+_0x161615[_0x89d4('0x41')][_0x89d4('0x4e')]+'%'};return _0x14b4ca;}})});}_0x390de6=_[_0x89d4('0x50')]({},_0x390de6,_0x161615['options']);var _0xeb7c4={'where':_0x390de6[_0x89d4('0x4d')]};return db[_0x89d4('0x3d')][_0x89d4('0x33')](_0xeb7c4)[_0x89d4('0x22')](function(_0x461865){_0x503ab7[_0x89d4('0x33')]=_0x461865;if(_0x161615[_0x89d4('0x41')][_0x89d4('0x51')]){_0x390de6['include']=[{'all':!![]}];}return db[_0x89d4('0x3d')]['findAll'](_0x390de6);})[_0x89d4('0x22')](function(_0x209ceb){_0x503ab7[_0x89d4('0x52')]=_0x209ceb;return _0x503ab7;})[_0x89d4('0x22')](respondWithFilteredResult(_0x489153,_0x390de6))['catch'](handleError(_0x489153,null));};exports['show']=function(_0x3dd365,_0x37f871){var _0x45cf12={'raw':!![],'where':{'id':_0x3dd365[_0x89d4('0x53')]['id']}},_0x3273e1={};_0x3273e1[_0x89d4('0x46')]=_[_0x89d4('0x42')](db['FaxMessage'][_0x89d4('0x3e')]);_0x3273e1[_0x89d4('0x41')]=_['keys'](_0x3dd365['query']);_0x3273e1['filters']=_[_0x89d4('0x45')](_0x3273e1['model'],_0x3273e1['query']);_0x45cf12['attributes']=_[_0x89d4('0x45')](_0x3273e1[_0x89d4('0x46')],qs[_0x89d4('0x47')](_0x3dd365[_0x89d4('0x41')][_0x89d4('0x47')]));_0x45cf12['attributes']=_0x45cf12[_0x89d4('0x44')][_0x89d4('0x48')]?_0x45cf12[_0x89d4('0x44')]:_0x3273e1[_0x89d4('0x46')];if(_0x3dd365[_0x89d4('0x41')]['includeAll']){_0x45cf12[_0x89d4('0x54')]=[{'all':!![]}];}_0x45cf12=_[_0x89d4('0x50')]({},_0x45cf12,_0x3dd365['options']);return db['FaxMessage'][_0x89d4('0x55')](_0x45cf12)['then'](handleEntityNotFound(_0x37f871,null))[_0x89d4('0x22')](respondWithResult(_0x37f871,null))['catch'](handleError(_0x37f871,null));};exports['update']=function(_0x50afdb,_0x2042b7){if(_0x50afdb[_0x89d4('0x56')]['id']){delete _0x50afdb[_0x89d4('0x56')]['id'];}return db['FaxMessage'][_0x89d4('0x55')]({'where':{'id':_0x50afdb['params']['id']}})[_0x89d4('0x22')](handleEntityNotFound(_0x2042b7,null))[_0x89d4('0x22')](saveUpdates(_0x50afdb[_0x89d4('0x56')],null))[_0x89d4('0x22')](respondWithResult(_0x2042b7,null))[_0x89d4('0x2c')](handleError(_0x2042b7,null));};exports['destroy']=function(_0x2cf124,_0x211e46){return db['FaxMessage'][_0x89d4('0x55')]({'where':{'id':_0x2cf124[_0x89d4('0x53')]['id']}})[_0x89d4('0x22')](handleEntityNotFound(_0x211e46,null))[_0x89d4('0x22')](removeEntity(_0x211e46,null))[_0x89d4('0x2c')](handleError(_0x211e46,null));};exports[_0x89d4('0x57')]=function(_0x15b8fe,_0x292f22){return db[_0x89d4('0x3d')][_0x89d4('0x57')]()[_0x89d4('0x22')](respondWithResult(_0x292f22,null))[_0x89d4('0x2c')](handleError(_0x292f22,null));};var interaction_log=require(_0x89d4('0x15'))(_0x89d4('0x58'));exports[_0x89d4('0x59')]=function(_0x2c9a79,_0x473669,_0x486188){var _0x1b00c7={'agent':{},'channel':_0x89d4('0x5a')};if(_0x2c9a79[_0x89d4('0x56')]['id']){delete _0x2c9a79[_0x89d4('0x56')]['id'];}_0x2c9a79[_0x89d4('0x56')][_0x89d4('0x5b')]=!![];_0x2c9a79[_0x89d4('0x56')][_0x89d4('0x5c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2c9a79[_0x89d4('0x56')][_0x89d4('0x5d')]=_0x2c9a79[_0x89d4('0x56')][_0x89d4('0x5d')]||_0x2c9a79[_0x89d4('0x5e')]['id'];_0x1b00c7[_0x89d4('0x5f')]['id']=_0x2c9a79[_0x89d4('0x56')][_0x89d4('0x5d')];return db['FaxMessage'][_0x89d4('0x55')]({'where':{'id':_0x2c9a79[_0x89d4('0x53')]['id'],'UserId':null}})[_0x89d4('0x22')](handleEntityNotFound(_0x473669,null))['then'](saveUpdates(_0x2c9a79[_0x89d4('0x56')],null))[_0x89d4('0x22')](function(_0x2856e7){if(_0x2856e7){_0x1b00c7[_0x89d4('0x2a')]=_0x2856e7[_0x89d4('0x60')]({'plain':!![]});return db[_0x89d4('0x61')][_0x89d4('0x55')]({'where':{'id':_0x2856e7[_0x89d4('0x62')]}});}return null;})[_0x89d4('0x22')](handleEntityNotFound(_0x473669,null))[_0x89d4('0x22')](function(_0x46529b){if(_0x46529b){return _0x46529b[_0x89d4('0x63')]({'UserId':_0x2c9a79['body']['UserId'],'read1stAt':_[_0x89d4('0x64')](_0x46529b[_0x89d4('0x65')])?moment()['format'](_0x89d4('0x66')):undefined});}return null;})[_0x89d4('0x22')](function(_0x2e77ef){if(_0x2e77ef){_0x1b00c7['interaction']=_0x2e77ef['get']({'plain':!![]});interaction_log[_0x89d4('0x2b')](_0x89d4('0x67'),_0x2c9a79[_0x89d4('0x5e')]['id'],_0x2c9a79[_0x89d4('0x5e')]['name'],_0x2c9a79[_0x89d4('0x5e')][_0x89d4('0x68')],_0x1b00c7[_0x89d4('0x69')]['id'],_0x2c9a79[_0x89d4('0x56')]?JSON[_0x89d4('0x26')](_0x2c9a79[_0x89d4('0x56')]):_0x89d4('0x6a'));return respondWithRpcPromise(_0x89d4('0x6b'),_0x89d4('0x6c'),_0x1b00c7);}return null;})[_0x89d4('0x22')](function(_0x54cc49){var _0x1ffcc3=_0x89d4('0x6d')+_0x54cc49[_0x89d4('0x2a')]['ContactId'];return db[_0x89d4('0x6e')][_0x89d4('0x41')](_0x1ffcc3,{'type':db['Sequelize'][_0x89d4('0x6f')]['SELECT'],'raw':!![]})[_0x89d4('0x22')](function(_0x18d2d1){return _0x18d2d1;});})[_0x89d4('0x22')](function(_0xe80a90){if(_0xe80a90){_0x1b00c7[_0x89d4('0x2a')][_0x89d4('0x70')]=_0xe80a90[0x0];if(!_0x2c9a79[_0x89d4('0x56')][_0x89d4('0x5d')])return;return db[_0x89d4('0x71')][_0x89d4('0x55')]({'where':{'id':_0x2c9a79[_0x89d4('0x56')][_0x89d4('0x5d')],'role':_0x89d4('0x5f')},'attributes':['id',_0x89d4('0x3a'),_0x89d4('0x72'),_0x89d4('0x73'),_0x89d4('0x74')],'raw':!![]});}return null;})['then'](function(_0x1ea2ae){if(!_0x1ea2ae)return null;_0x1b00c7['message'][_0x89d4('0x5f')]=_0x1ea2ae;return _0x1b00c7;})['then'](function(_0x40fe46){if(_0x40fe46){if(_0x2c9a79['body'][_0x89d4('0x75')]){_0x1b00c7[_0x89d4('0x2a')]['interface']=util[_0x89d4('0x76')](_0x89d4('0x77'),_0x2c9a79['user'][_0x89d4('0x3a')]);_0x1b00c7[_0x89d4('0x2a')][_0x89d4('0x78')]=_0x1b00c7[_0x89d4('0x78')];_0x1b00c7['message'][_0x89d4('0x79')]='accept';return respondWithRpcPromise(_0x89d4('0x7a'),_0x89d4('0x7a'),{'event':_0x89d4('0x7b'),'message':_0x1b00c7[_0x89d4('0x2a')]},client9002)[_0x89d4('0x22')](function(){return _0x1b00c7;});}return _0x1b00c7;}return null;})[_0x89d4('0x22')](respondWithResult(_0x473669,null))[_0x89d4('0x2c')](handleError(_0x473669,null));};var interaction_log=require('../../config/logger')(_0x89d4('0x58'));exports[_0x89d4('0x37')]=function(_0x555458,_0xf3127e,_0x15a699){var _0x3bc808={'agent':{},'channel':'fax'};if(_0x555458['body']['id']){delete _0x555458[_0x89d4('0x56')]['id'];}_0x555458['body'][_0x89d4('0x5d')]=_0x555458[_0x89d4('0x56')][_0x89d4('0x5d')]||_0x555458['user']['id'];_0x3bc808['agent']['id']=_0x555458[_0x89d4('0x56')]['UserId'];return db['FaxMessage']['find']({'where':{'id':_0x555458[_0x89d4('0x53')]['id'],'UserId':null}})[_0x89d4('0x22')](handleEntityNotFound(_0xf3127e,null))[_0x89d4('0x22')](function(_0x5d41d6){if(_0x5d41d6){_0x3bc808[_0x89d4('0x2a')]=_0x5d41d6[_0x89d4('0x60')]({'plain':!![]});return db[_0x89d4('0x61')]['find']({'where':{'id':_0x5d41d6[_0x89d4('0x62')]}});}return null;})[_0x89d4('0x22')](handleEntityNotFound(_0xf3127e,null))['then'](function(_0x52c0d8){if(_0x52c0d8){_0x3bc808['interaction']=_0x52c0d8[_0x89d4('0x60')]({'plain':!![]});interaction_log[_0x89d4('0x2b')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x555458[_0x89d4('0x5e')]['id'],_0x555458['user']['name'],_0x555458[_0x89d4('0x5e')][_0x89d4('0x68')],_0x3bc808[_0x89d4('0x69')]['id'],_0x555458[_0x89d4('0x56')]?JSON['stringify'](_0x555458[_0x89d4('0x56')]):_0x89d4('0x6a'));return respondWithRpcPromise(_0x89d4('0x7c'),'rejectMessage',_0x3bc808);}return null;})[_0x89d4('0x22')](function(_0x2fba05){var _0x49167e=_0x89d4('0x6d')+_0x2fba05[_0x89d4('0x2a')][_0x89d4('0x7d')];return db[_0x89d4('0x6e')]['query'](_0x49167e,{'type':db['Sequelize'][_0x89d4('0x6f')][_0x89d4('0x7e')],'raw':!![]})[_0x89d4('0x22')](function(_0x285b22){return _0x285b22;});})['then'](function(_0x2131ec){if(_0x2131ec){_0x3bc808[_0x89d4('0x2a')][_0x89d4('0x70')]=_0x2131ec[0x0];if(!_0x555458[_0x89d4('0x56')]['UserId'])return;return db[_0x89d4('0x71')][_0x89d4('0x55')]({'where':{'id':_0x555458[_0x89d4('0x56')]['UserId'],'role':'agent'},'attributes':['id','name',_0x89d4('0x72'),_0x89d4('0x73'),_0x89d4('0x74')],'raw':!![]});}return null;})[_0x89d4('0x22')](function(_0x5117d3){if(!_0x5117d3)return null;_0x3bc808[_0x89d4('0x2a')]['agent']=_0x5117d3;return _0x3bc808;})[_0x89d4('0x22')](function(_0x117955){if(_0x117955){_0x117955['message'][_0x89d4('0x7f')]=util['format']('SIP/%s',_0x555458[_0x89d4('0x5e')][_0x89d4('0x3a')]);_0x117955[_0x89d4('0x2a')][_0x89d4('0x78')]=_0x3bc808[_0x89d4('0x78')];_0x117955['message']['event']=_0x89d4('0x37');respondWithRpcPromise('EventManager',_0x89d4('0x7a'),{'event':_0x89d4('0x80'),'message':_0x117955[_0x89d4('0x2a')]},client9002);return _0x3bc808;}return null;})[_0x89d4('0x22')](respondWithResult(_0xf3127e,null))[_0x89d4('0x2c')](handleError(_0xf3127e,null));};exports[_0x89d4('0x81')]=function(_0x593c19,_0x57cfc4){var _0x4dd032;return db[_0x89d4('0x3d')][_0x89d4('0x81')](_0x593c19['body'],{})[_0x89d4('0x22')](function(_0x5023dd){_0x4dd032=_0x5023dd;return db[_0x89d4('0x82')][_0x89d4('0x83')]({'where':{'id':_0x4dd032[_0x89d4('0x7d')]}});})[_0x89d4('0x22')](function(_0x4e86a3){if(_[_0x89d4('0x64')](_0x4e86a3)){return;}else{_0x4dd032[_0x89d4('0x5a')]=_0x4e86a3[_0x89d4('0x5a')];return db[_0x89d4('0x84')][_0x89d4('0x83')]({'where':{'id':_0x4dd032['AttachmentId']}});}})['then'](function(_0x247c96){return respondWithRpcPromise(_0x89d4('0x85'),_0x89d4('0x85'),{'FaxAccountId':_[_0x89d4('0x64')](_0x593c19[_0x89d4('0x56')])?undefined:_0x593c19[_0x89d4('0x56')][_0x89d4('0x86')],'path':_[_0x89d4('0x64')](_0x247c96)?undefined:util[_0x89d4('0x76')]('/var/opt/motion2/server/files/attachments/%s',_0x247c96[_0x89d4('0x87')]),'fax':_[_0x89d4('0x64')](_0x4dd032[_0x89d4('0x5a')])?undefined:_0x4dd032[_0x89d4('0x5a')],'AttachmentId':_0x4dd032[_0x89d4('0x88')]},client9002);})['then'](respondWithResult(_0x57cfc4,0xc9))[_0x89d4('0x2c')](handleError(_0x57cfc4,null));};exports[_0x89d4('0x89')]=function(_0x383b7f,_0xb6bc63){var _0x34a4f9=path[_0x89d4('0x8a')](config[_0x89d4('0x8b')],_0x89d4('0x8c'),_0x89d4('0x8d'),'attachments');return db[_0x89d4('0x3d')][_0x89d4('0x55')]({'where':{'id':_0x383b7f[_0x89d4('0x53')]['id']},'include':[{'model':db[_0x89d4('0x84')],'as':'Attachment'}]})['then'](handleEntityNotFound(_0xb6bc63,null))[_0x89d4('0x22')](function(_0x5514d0){if(_0x5514d0){return _0xb6bc63[_0x89d4('0x89')](path['join'](_0x34a4f9,_0x5514d0[_0x89d4('0x84')][_0x89d4('0x87')]));}})[_0x89d4('0x2c')](handleError(_0xb6bc63,null));}; \ No newline at end of file +var _0x3480=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','FaxMessage,\x20%s,\x20%s','message','result','catch','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','stack','name','send','index','FaxMessage','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','includeAll','include','show','params','options','update','body','destroy','find','describe','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','FaxInteraction','FaxInteractionId','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','event','EventManager','acceptmessage','fax-interactions','get','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','create','CmContact','findOne','isNil','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','root','server','files','rimraf','zip-dir'];(function(_0x40927b,_0xf9b0a0){var _0x2635e8=function(_0x1f2b8c){while(--_0x1f2b8c){_0x40927b['push'](_0x40927b['shift']());}};_0x2635e8(++_0xf9b0a0);}(_0x3480,0x1bd));var _0x0348=function(_0xe9f2f7,_0x4871ae){_0xe9f2f7=_0xe9f2f7-0x0;var _0x3ecf06=_0x3480[_0xe9f2f7];return _0x3ecf06;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0348('0x0'));var zipdir=require(_0x0348('0x1'));var jsonpatch=require(_0x0348('0x2'));var rp=require(_0x0348('0x3'));var moment=require(_0x0348('0x4'));var BPromise=require(_0x0348('0x5'));var Mustache=require(_0x0348('0x6'));var util=require(_0x0348('0x7'));var path=require(_0x0348('0x8'));var sox=require('sox');var csv=require(_0x0348('0x9'));var ejs=require(_0x0348('0xa'));var fs=require('fs');var fs_extra=require(_0x0348('0xb'));var _=require(_0x0348('0xc'));var squel=require(_0x0348('0xd'));var crypto=require(_0x0348('0xe'));var jsforce=require(_0x0348('0xf'));var deskjs=require(_0x0348('0x10'));var toCsv=require('to-csv');var querystring=require(_0x0348('0x11'));var Papa=require(_0x0348('0x12'));var Redis=require(_0x0348('0x13'));var authService=require(_0x0348('0x14'));var qs=require(_0x0348('0x15'));var as=require(_0x0348('0x16'));var hardwareService=require(_0x0348('0x17'));var logger=require(_0x0348('0x18'))('api');var utils=require(_0x0348('0x19'));var config=require(_0x0348('0x1a'));var licenseUtil=require(_0x0348('0x1b'));var db=require(_0x0348('0x1c'))['db'];config[_0x0348('0x1d')]=_[_0x0348('0x1e')](config['redis'],{'host':_0x0348('0x1f'),'port':0x18eb});var socket=require(_0x0348('0x20'))(new Redis(config[_0x0348('0x1d')]));require(_0x0348('0x21'))[_0x0348('0x22')](socket);var jayson=require(_0x0348('0x23'));var client=jayson[_0x0348('0x24')]['http']({'port':0x232c});var client9002=jayson[_0x0348('0x24')][_0x0348('0x25')]({'port':0x232a});function respondWithRpcPromise(_0x42e29b,_0xc2fcc9,_0x19f5a8,_0x474e18){return new BPromise(function(_0x2c3aaf,_0x4c5aa2){var _0x3a0273=_0x474e18||client;return _0x3a0273[_0x0348('0x26')](_0x42e29b,_0x19f5a8)[_0x0348('0x27')](function(_0x315a3e){logger[_0x0348('0x28')]('FaxMessage,\x20%s,\x20%s',_0xc2fcc9,_0x0348('0x29'));logger[_0x0348('0x2a')](_0x0348('0x2b'),_0xc2fcc9,_0x0348('0x29'),JSON[_0x0348('0x2c')](_0x315a3e));if(_0x315a3e[_0x0348('0x2d')]){if(_0x315a3e[_0x0348('0x2d')]['code']===0x1f4){logger[_0x0348('0x2d')](_0x0348('0x2e'),_0xc2fcc9,_0x315a3e[_0x0348('0x2d')][_0x0348('0x2f')]);return _0x4c5aa2(_0x315a3e[_0x0348('0x2d')][_0x0348('0x2f')]);}logger[_0x0348('0x2d')](_0x0348('0x2e'),_0xc2fcc9,_0x315a3e[_0x0348('0x2d')][_0x0348('0x2f')]);return _0x2c3aaf(_0x315a3e[_0x0348('0x2d')][_0x0348('0x2f')]);}else{logger[_0x0348('0x28')](_0x0348('0x2e'),_0xc2fcc9,_0x0348('0x29'));_0x2c3aaf(_0x315a3e[_0x0348('0x30')]['message']);}})[_0x0348('0x31')](function(_0x5935c8){logger[_0x0348('0x2d')](_0x0348('0x2e'),_0xc2fcc9,_0x5935c8);_0x4c5aa2(_0x5935c8);});});}function respondWithStatusCode(_0x13e094,_0x116caf){_0x116caf=_0x116caf||0xcc;return function(_0x37dc84){if(_0x37dc84){return _0x13e094['sendStatus'](_0x116caf);}return _0x13e094[_0x0348('0x32')](_0x116caf)[_0x0348('0x33')]();};}function respondWithResult(_0x344b6d,_0x39fef0){_0x39fef0=_0x39fef0||0xc8;return function(_0x5db69c){if(_0x5db69c){return _0x344b6d[_0x0348('0x32')](_0x39fef0)[_0x0348('0x34')](_0x5db69c);}};}function respondWithFilteredResult(_0x50b578,_0x53b064){return function(_0x4a3b3a){if(_0x4a3b3a){var _0x35eeee=typeof _0x53b064['offset']==='undefined'&&typeof _0x53b064[_0x0348('0x35')]===_0x0348('0x36');var _0x2d0718=_0x4a3b3a[_0x0348('0x37')];var _0x123fd9=_0x35eeee?0x0:_0x53b064[_0x0348('0x38')];var _0x292efb=_0x35eeee?_0x4a3b3a[_0x0348('0x37')]:_0x53b064[_0x0348('0x38')]+_0x53b064[_0x0348('0x35')];var _0x2a8cef;if(_0x292efb>=_0x2d0718){_0x292efb=_0x2d0718;_0x2a8cef=0xc8;}else{_0x2a8cef=0xce;}_0x50b578['status'](_0x2a8cef);return _0x50b578[_0x0348('0x39')](_0x0348('0x3a'),_0x123fd9+'-'+_0x292efb+'/'+_0x2d0718)['json'](_0x4a3b3a);}return null;};}function patchUpdates(_0x5a7688){return function(_0x26f4b6){try{jsonpatch[_0x0348('0x3b')](_0x26f4b6,_0x5a7688,!![]);}catch(_0x352517){return BPromise[_0x0348('0x3c')](_0x352517);}return _0x26f4b6[_0x0348('0x3d')]();};}function saveUpdates(_0xc3b909,_0xebc550){return function(_0xbc7798){if(_0xbc7798){return _0xbc7798['update'](_0xc3b909)[_0x0348('0x27')](function(_0x29e7f0){return _0x29e7f0;});}return null;};}function removeEntity(_0x56e1c1,_0x2c2e46){return function(_0x1621c7){if(_0x1621c7){return _0x1621c7['destroy']()[_0x0348('0x27')](function(){_0x56e1c1['status'](0xcc)[_0x0348('0x33')]();});}};}function handleEntityNotFound(_0x46d03a,_0x23431b){return function(_0x470d80){if(!_0x470d80){_0x46d03a['sendStatus'](0x194);}return _0x470d80;};}function handleError(_0x161b75,_0x480a20){_0x480a20=_0x480a20||0x1f4;return function(_0x537ecd){logger[_0x0348('0x2d')](_0x537ecd[_0x0348('0x3e')]);if(_0x537ecd[_0x0348('0x3f')]){delete _0x537ecd[_0x0348('0x3f')];}_0x161b75[_0x0348('0x32')](_0x480a20)[_0x0348('0x40')](_0x537ecd);};}exports[_0x0348('0x41')]=function(_0x1a70be,_0x27ca32){var _0x3f4057={},_0x1d2abf={},_0x5634f1={'count':0x0,'rows':[]};var _0x302b88=_['map'](db[_0x0348('0x42')]['rawAttributes'],function(_0xc87f5f){return{'name':_0xc87f5f[_0x0348('0x43')],'type':_0xc87f5f[_0x0348('0x44')][_0x0348('0x45')]};});_0x1d2abf[_0x0348('0x46')]=_[_0x0348('0x47')](_0x302b88,'name');_0x1d2abf[_0x0348('0x48')]=_[_0x0348('0x49')](_0x1a70be['query']);_0x1d2abf[_0x0348('0x4a')]=_[_0x0348('0x4b')](_0x1d2abf[_0x0348('0x46')],_0x1d2abf[_0x0348('0x48')]);_0x3f4057[_0x0348('0x4c')]=_['intersection'](_0x1d2abf[_0x0348('0x46')],qs[_0x0348('0x4d')](_0x1a70be['query'][_0x0348('0x4d')]));_0x3f4057[_0x0348('0x4c')]=_0x3f4057[_0x0348('0x4c')][_0x0348('0x4e')]?_0x3f4057['attributes']:_0x1d2abf['model'];if(!_0x1a70be[_0x0348('0x48')][_0x0348('0x4f')](_0x0348('0x50'))){_0x3f4057[_0x0348('0x35')]=qs[_0x0348('0x35')](_0x1a70be['query'][_0x0348('0x35')]);_0x3f4057[_0x0348('0x38')]=qs[_0x0348('0x38')](_0x1a70be['query'][_0x0348('0x38')]);}_0x3f4057['order']=qs[_0x0348('0x51')](_0x1a70be[_0x0348('0x48')][_0x0348('0x51')]);_0x3f4057[_0x0348('0x52')]=qs[_0x0348('0x4a')](_[_0x0348('0x53')](_0x1a70be[_0x0348('0x48')],_0x1d2abf[_0x0348('0x4a')]),_0x302b88);if(_0x1a70be[_0x0348('0x48')]['filter']){_0x3f4057[_0x0348('0x52')]=_[_0x0348('0x54')](_0x3f4057[_0x0348('0x52')],{'$or':_[_0x0348('0x47')](_0x302b88,function(_0x3437b4){if(_0x3437b4[_0x0348('0x44')]!=='VIRTUAL'){var _0x25deac={};_0x25deac[_0x3437b4['name']]={'$like':'%'+_0x1a70be[_0x0348('0x48')][_0x0348('0x55')]+'%'};return _0x25deac;}})});}_0x3f4057=_[_0x0348('0x54')]({},_0x3f4057,_0x1a70be['options']);var _0x2f92a5={'where':_0x3f4057[_0x0348('0x52')]};return db['FaxMessage'][_0x0348('0x37')](_0x2f92a5)[_0x0348('0x27')](function(_0x213ac5){_0x5634f1['count']=_0x213ac5;if(_0x1a70be[_0x0348('0x48')][_0x0348('0x56')]){_0x3f4057[_0x0348('0x57')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x3f4057);})['then'](function(_0x4e6d81){_0x5634f1['rows']=_0x4e6d81;return _0x5634f1;})[_0x0348('0x27')](respondWithFilteredResult(_0x27ca32,_0x3f4057))['catch'](handleError(_0x27ca32,null));};exports[_0x0348('0x58')]=function(_0x1432ae,_0x1235d8){var _0x526061={'raw':!![],'where':{'id':_0x1432ae[_0x0348('0x59')]['id']}},_0x24118a={};_0x24118a['model']=_[_0x0348('0x49')](db[_0x0348('0x42')]['rawAttributes']);_0x24118a[_0x0348('0x48')]=_[_0x0348('0x49')](_0x1432ae['query']);_0x24118a[_0x0348('0x4a')]=_['intersection'](_0x24118a[_0x0348('0x46')],_0x24118a[_0x0348('0x48')]);_0x526061[_0x0348('0x4c')]=_['intersection'](_0x24118a['model'],qs[_0x0348('0x4d')](_0x1432ae['query']['fields']));_0x526061[_0x0348('0x4c')]=_0x526061[_0x0348('0x4c')][_0x0348('0x4e')]?_0x526061[_0x0348('0x4c')]:_0x24118a['model'];if(_0x1432ae[_0x0348('0x48')]['includeAll']){_0x526061[_0x0348('0x57')]=[{'all':!![]}];}_0x526061=_['merge']({},_0x526061,_0x1432ae[_0x0348('0x5a')]);return db[_0x0348('0x42')]['find'](_0x526061)[_0x0348('0x27')](handleEntityNotFound(_0x1235d8,null))[_0x0348('0x27')](respondWithResult(_0x1235d8,null))[_0x0348('0x31')](handleError(_0x1235d8,null));};exports[_0x0348('0x5b')]=function(_0x4a12a4,_0x2d3bbb){if(_0x4a12a4[_0x0348('0x5c')]['id']){delete _0x4a12a4[_0x0348('0x5c')]['id'];}return db[_0x0348('0x42')]['find']({'where':{'id':_0x4a12a4[_0x0348('0x59')]['id']}})['then'](handleEntityNotFound(_0x2d3bbb,null))['then'](saveUpdates(_0x4a12a4[_0x0348('0x5c')],null))[_0x0348('0x27')](respondWithResult(_0x2d3bbb,null))['catch'](handleError(_0x2d3bbb,null));};exports[_0x0348('0x5d')]=function(_0x2ef113,_0x8f3930){return db[_0x0348('0x42')][_0x0348('0x5e')]({'where':{'id':_0x2ef113[_0x0348('0x59')]['id']}})[_0x0348('0x27')](handleEntityNotFound(_0x8f3930,null))[_0x0348('0x27')](removeEntity(_0x8f3930,null))[_0x0348('0x31')](handleError(_0x8f3930,null));};exports['describe']=function(_0x4c6fd5,_0xbe2ca4){return db[_0x0348('0x42')][_0x0348('0x5f')]()[_0x0348('0x27')](respondWithResult(_0xbe2ca4,null))[_0x0348('0x31')](handleError(_0xbe2ca4,null));};var interaction_log=require(_0x0348('0x18'))('fax-interactions');exports[_0x0348('0x60')]=function(_0x5bdee3,_0x38390a,_0x4f7fc0){var _0x5e5e3b={'agent':{},'channel':_0x0348('0x61')};if(_0x5bdee3[_0x0348('0x5c')]['id']){delete _0x5bdee3[_0x0348('0x5c')]['id'];}_0x5bdee3[_0x0348('0x5c')][_0x0348('0x62')]=!![];_0x5bdee3[_0x0348('0x5c')][_0x0348('0x63')]=moment()[_0x0348('0x64')](_0x0348('0x65'));_0x5bdee3[_0x0348('0x5c')][_0x0348('0x66')]=_0x5bdee3[_0x0348('0x5c')]['UserId']||_0x5bdee3[_0x0348('0x67')]['id'];_0x5e5e3b[_0x0348('0x68')]['id']=_0x5bdee3[_0x0348('0x5c')][_0x0348('0x66')];return db[_0x0348('0x42')][_0x0348('0x5e')]({'where':{'id':_0x5bdee3[_0x0348('0x59')]['id'],'UserId':null}})[_0x0348('0x27')](handleEntityNotFound(_0x38390a,null))[_0x0348('0x27')](saveUpdates(_0x5bdee3[_0x0348('0x5c')],null))[_0x0348('0x27')](function(_0x33e371){if(_0x33e371){_0x5e5e3b[_0x0348('0x2f')]=_0x33e371['get']({'plain':!![]});return db[_0x0348('0x69')][_0x0348('0x5e')]({'where':{'id':_0x33e371[_0x0348('0x6a')]}});}return null;})[_0x0348('0x27')](handleEntityNotFound(_0x38390a,null))[_0x0348('0x27')](function(_0x10b769){if(_0x10b769){return _0x10b769[_0x0348('0x5b')]({'UserId':_0x5bdee3['body'][_0x0348('0x66')],'read1stAt':_['isNil'](_0x10b769[_0x0348('0x6b')])?moment()[_0x0348('0x64')](_0x0348('0x65')):undefined});}return null;})['then'](function(_0x71470e){if(_0x71470e){_0x5e5e3b[_0x0348('0x6c')]=_0x71470e['get']({'plain':!![]});interaction_log[_0x0348('0x28')](_0x0348('0x6d'),_0x5bdee3[_0x0348('0x67')]['id'],_0x5bdee3[_0x0348('0x67')][_0x0348('0x3f')],_0x5bdee3['user'][_0x0348('0x6e')],_0x5e5e3b[_0x0348('0x6c')]['id'],_0x5bdee3['body']?JSON['stringify'](_0x5bdee3['body']):_0x0348('0x6f'));return respondWithRpcPromise(_0x0348('0x70'),_0x0348('0x71'),_0x5e5e3b);}return null;})['then'](function(_0x14c67a){var _0x5a1943='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x14c67a['message'][_0x0348('0x72')];return db[_0x0348('0x73')][_0x0348('0x48')](_0x5a1943,{'type':db[_0x0348('0x74')][_0x0348('0x75')][_0x0348('0x76')],'raw':!![]})[_0x0348('0x27')](function(_0x3aaa7e){return _0x3aaa7e;});})[_0x0348('0x27')](function(_0x166ddb){if(_0x166ddb){_0x5e5e3b[_0x0348('0x2f')][_0x0348('0x77')]=_0x166ddb[0x0];if(!_0x5bdee3[_0x0348('0x5c')][_0x0348('0x66')])return;return db[_0x0348('0x78')]['find']({'where':{'id':_0x5bdee3[_0x0348('0x5c')][_0x0348('0x66')],'role':_0x0348('0x68')},'attributes':['id',_0x0348('0x3f'),_0x0348('0x79'),_0x0348('0x7a'),_0x0348('0x7b')],'raw':!![]});}return null;})[_0x0348('0x27')](function(_0x5ce40a){if(!_0x5ce40a)return null;_0x5e5e3b[_0x0348('0x2f')][_0x0348('0x68')]=_0x5ce40a;return _0x5e5e3b;})[_0x0348('0x27')](function(_0x5b8bf5){if(_0x5b8bf5){if(_0x5bdee3[_0x0348('0x5c')][_0x0348('0x7c')]){_0x5e5e3b[_0x0348('0x2f')]['interface']=util[_0x0348('0x64')](_0x0348('0x7d'),_0x5bdee3['user'][_0x0348('0x3f')]);_0x5e5e3b[_0x0348('0x2f')][_0x0348('0x7e')]=_0x5e5e3b[_0x0348('0x7e')];_0x5e5e3b[_0x0348('0x2f')][_0x0348('0x7f')]=_0x0348('0x60');return respondWithRpcPromise(_0x0348('0x80'),_0x0348('0x80'),{'event':_0x0348('0x81'),'message':_0x5e5e3b[_0x0348('0x2f')]},client9002)[_0x0348('0x27')](function(){return _0x5e5e3b;});}return _0x5e5e3b;}return null;})['then'](respondWithResult(_0x38390a,null))[_0x0348('0x31')](handleError(_0x38390a,null));};var interaction_log=require(_0x0348('0x18'))(_0x0348('0x82'));exports[_0x0348('0x3c')]=function(_0x363115,_0x10f748,_0x4915f3){var _0x15ccf3={'agent':{},'channel':_0x0348('0x61')};if(_0x363115[_0x0348('0x5c')]['id']){delete _0x363115[_0x0348('0x5c')]['id'];}_0x363115['body']['UserId']=_0x363115['body'][_0x0348('0x66')]||_0x363115[_0x0348('0x67')]['id'];_0x15ccf3[_0x0348('0x68')]['id']=_0x363115[_0x0348('0x5c')][_0x0348('0x66')];return db['FaxMessage'][_0x0348('0x5e')]({'where':{'id':_0x363115[_0x0348('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x10f748,null))[_0x0348('0x27')](function(_0xb38ae0){if(_0xb38ae0){_0x15ccf3[_0x0348('0x2f')]=_0xb38ae0[_0x0348('0x83')]({'plain':!![]});return db[_0x0348('0x69')][_0x0348('0x5e')]({'where':{'id':_0xb38ae0[_0x0348('0x6a')]}});}return null;})[_0x0348('0x27')](handleEntityNotFound(_0x10f748,null))[_0x0348('0x27')](function(_0x1f8b4a){if(_0x1f8b4a){_0x15ccf3['interaction']=_0x1f8b4a[_0x0348('0x83')]({'plain':!![]});interaction_log[_0x0348('0x28')](_0x0348('0x84'),_0x363115[_0x0348('0x67')]['id'],_0x363115[_0x0348('0x67')]['name'],_0x363115[_0x0348('0x67')]['role'],_0x15ccf3['interaction']['id'],_0x363115['body']?JSON[_0x0348('0x2c')](_0x363115[_0x0348('0x5c')]):'null');return respondWithRpcPromise(_0x0348('0x85'),'rejectMessage',_0x15ccf3);}return null;})['then'](function(_0x4362dc){var _0x275527=_0x0348('0x86')+_0x4362dc['message'][_0x0348('0x72')];return db[_0x0348('0x73')]['query'](_0x275527,{'type':db[_0x0348('0x74')][_0x0348('0x75')][_0x0348('0x76')],'raw':!![]})[_0x0348('0x27')](function(_0x1d0d86){return _0x1d0d86;});})['then'](function(_0x1a21c5){if(_0x1a21c5){_0x15ccf3[_0x0348('0x2f')][_0x0348('0x77')]=_0x1a21c5[0x0];if(!_0x363115[_0x0348('0x5c')][_0x0348('0x66')])return;return db[_0x0348('0x78')]['find']({'where':{'id':_0x363115[_0x0348('0x5c')][_0x0348('0x66')],'role':_0x0348('0x68')},'attributes':['id','name',_0x0348('0x79'),_0x0348('0x7a'),_0x0348('0x7b')],'raw':!![]});}return null;})['then'](function(_0x5d43db){if(!_0x5d43db)return null;_0x15ccf3[_0x0348('0x2f')]['agent']=_0x5d43db;return _0x15ccf3;})['then'](function(_0x4d6815){if(_0x4d6815){_0x4d6815[_0x0348('0x2f')]['interface']=util[_0x0348('0x64')]('SIP/%s',_0x363115[_0x0348('0x67')]['name']);_0x4d6815[_0x0348('0x2f')][_0x0348('0x7e')]=_0x15ccf3[_0x0348('0x7e')];_0x4d6815[_0x0348('0x2f')]['event']=_0x0348('0x3c');respondWithRpcPromise('EventManager',_0x0348('0x80'),{'event':'rejectmessage','message':_0x4d6815[_0x0348('0x2f')]},client9002);return _0x15ccf3;}return null;})[_0x0348('0x27')](respondWithResult(_0x10f748,null))[_0x0348('0x31')](handleError(_0x10f748,null));};exports['create']=function(_0xe60055,_0x317a43){var _0x5e4e6b;return db[_0x0348('0x42')][_0x0348('0x87')](_0xe60055['body'],{})['then'](function(_0xa0b9fa){_0x5e4e6b=_0xa0b9fa;return db[_0x0348('0x88')][_0x0348('0x89')]({'where':{'id':_0x5e4e6b[_0x0348('0x72')]}});})[_0x0348('0x27')](function(_0x185140){if(_[_0x0348('0x8a')](_0x185140)){return;}else{_0x5e4e6b[_0x0348('0x61')]=_0x185140[_0x0348('0x61')];return db[_0x0348('0x8b')]['findOne']({'where':{'id':_0x5e4e6b[_0x0348('0x8c')]}});}})[_0x0348('0x27')](function(_0x1d8920){return respondWithRpcPromise(_0x0348('0x8d'),_0x0348('0x8d'),{'FaxAccountId':_[_0x0348('0x8a')](_0xe60055[_0x0348('0x5c')])?undefined:_0xe60055[_0x0348('0x5c')][_0x0348('0x8e')],'path':_[_0x0348('0x8a')](_0x1d8920)?undefined:util['format'](_0x0348('0x8f'),_0x1d8920[_0x0348('0x90')]),'fax':_[_0x0348('0x8a')](_0x5e4e6b['fax'])?undefined:_0x5e4e6b[_0x0348('0x61')],'AttachmentId':_0x5e4e6b[_0x0348('0x8c')]},client9002);})['then'](respondWithResult(_0x317a43,0xc9))[_0x0348('0x31')](handleError(_0x317a43,null));};exports[_0x0348('0x91')]=function(_0x4336cd,_0x29c267){var _0x1f26f2=path['join'](config[_0x0348('0x92')],_0x0348('0x93'),_0x0348('0x94'),'attachments');return db[_0x0348('0x42')][_0x0348('0x5e')]({'where':{'id':_0x4336cd[_0x0348('0x59')]['id']},'include':[{'model':db[_0x0348('0x8b')],'as':_0x0348('0x8b')}]})[_0x0348('0x27')](handleEntityNotFound(_0x29c267,null))[_0x0348('0x27')](function(_0x46fd73){if(_0x46fd73){return _0x29c267[_0x0348('0x91')](path['join'](_0x1f26f2,_0x46fd73[_0x0348('0x8b')][_0x0348('0x90')]));}})['catch'](handleError(_0x29c267,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index ada4f3c..6206abc 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 _0xf963=['emit','hook','exports','events','setMaxListeners','save'];(function(_0x51666b,_0x48e537){var _0x1858fa=function(_0x578ff0){while(--_0x578ff0){_0x51666b['push'](_0x51666b['shift']());}};_0x1858fa(++_0x48e537);}(_0xf963,0x11d));var _0x3f96=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xf963[_0x56482c];return _0x5aae7a;};'use strict';var EventEmitter=require(_0x3f96('0x0'));var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x3f96('0x1')](0x0);var events={'afterCreate':_0x3f96('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1f30a1){return function(_0x1e7cb9,_0x3a6815,_0x1a91ab){FaxMessageEvents['emit'](_0x1f30a1+':'+_0x1e7cb9['id'],_0x1e7cb9);FaxMessageEvents[_0x3f96('0x3')](_0x1f30a1,_0x1e7cb9);_0x1a91ab(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x3f96('0x4')](e,emitEvent(event));}}module[_0x3f96('0x5')]=FaxMessageEvents; \ No newline at end of file +var _0xd906=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','FaxMessage'];(function(_0x9366d4,_0x51a60b){var _0x29addd=function(_0x19912b){while(--_0x19912b){_0x9366d4['push'](_0x9366d4['shift']());}};_0x29addd(++_0x51a60b);}(_0xd906,0x6b));var _0x6d90=function(_0x113c43,_0x475fc1){_0x113c43=_0x113c43-0x0;var _0x51fbae=_0xd906[_0x113c43];return _0x51fbae;};'use strict';var EventEmitter=require('events');var FaxMessage=require('../../mysqldb')['db'][_0x6d90('0x0')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x6d90('0x1')](0x0);var events={'afterCreate':_0x6d90('0x2'),'afterUpdate':_0x6d90('0x3'),'afterDestroy':_0x6d90('0x4')};function emitEvent(_0x4d5bbd){return function(_0x2ae140,_0x431c1e,_0x132c67){FaxMessageEvents[_0x6d90('0x5')](_0x4d5bbd+':'+_0x2ae140['id'],_0x2ae140);FaxMessageEvents['emit'](_0x4d5bbd,_0x2ae140);_0x132c67(null);};}for(var e in events){if(events[_0x6d90('0x6')](e)){var event=events[e];FaxMessage[_0x6d90('0x7')](e,emitEvent(event));}}module[_0x6d90('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 2999f8a..4aef597 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 _0x8d3d=['exports','define','fti_fax_messages','body','FULLTEXT','models','direction','toLowerCase','out','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./faxMessage.attributes'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x8d3d,0x116));var _0xd8d3=function(_0x214045,_0x144c95){_0x214045=_0x214045-0x0;var _0x49df3b=_0x8d3d[_0x214045];return _0x49df3b;};'use strict';var _=require(_0xd8d3('0x0'));var util=require(_0xd8d3('0x1'));var logger=require(_0xd8d3('0x2'))('api');var moment=require(_0xd8d3('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd8d3('0x4'));var rimraf=require(_0xd8d3('0x5'));var config=require(_0xd8d3('0x6'));var attributes=require(_0xd8d3('0x7'));module[_0xd8d3('0x8')]=function(_0x1e1c5d,_0x3a3672){return _0x1e1c5d[_0xd8d3('0x9')]('FaxMessage',attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xd8d3('0xa'),'fields':[_0xd8d3('0xb')],'type':_0xd8d3('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x418058,_0x2432c6,_0x505a4b){var _0x3ec61f=_0x1e1c5d[_0xd8d3('0xd')];var _0x22696a=_0x418058['get']({'plain':!![]});if(_0x22696a[_0xd8d3('0xe')][_0xd8d3('0xf')]()==='in'||_0x22696a[_0xd8d3('0xe')][_0xd8d3('0xf')]()===_0xd8d3('0x10')&&!_0x22696a['secret']&&!_['isNil'](_0x22696a['UserId'])){_0x3ec61f[_0xd8d3('0x11')][_0xd8d3('0x12')]({'where':{'id':_0x22696a[_0xd8d3('0x13')]}})[_0xd8d3('0x14')](function(_0x506854){if(_0x506854){_0x506854[_0xd8d3('0x15')]({'lastMsgAt':_0x22696a[_0xd8d3('0x16')],'lastMsgDirection':_0x22696a[_0xd8d3('0xe')][_0xd8d3('0xf')]()});}})[_0xd8d3('0x17')](function(_0x46b709){console[_0xd8d3('0x18')](_0x46b709);});}_0x505a4b();}},'charset':'utf8mb4','collate':_0xd8d3('0x19')});}; \ No newline at end of file +var _0x9d62=['util','api','moment','bluebird','path','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body','models','get','direction','toLowerCase','out','UserId','FaxInteraction','findOne','FaxInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci'];(function(_0x3245e7,_0x452e02){var _0x1a452b=function(_0x586c7b){while(--_0x586c7b){_0x3245e7['push'](_0x3245e7['shift']());}};_0x1a452b(++_0x452e02);}(_0x9d62,0x118));var _0x29d6=function(_0x9fb5f2,_0x4d3901){_0x9fb5f2=_0x9fb5f2-0x0;var _0x540d23=_0x9d62[_0x9fb5f2];return _0x540d23;};'use strict';var _=require('lodash');var util=require(_0x29d6('0x0'));var logger=require('../../config/logger')(_0x29d6('0x1'));var moment=require(_0x29d6('0x2'));var BPromise=require(_0x29d6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x29d6('0x4'));var rimraf=require(_0x29d6('0x5'));var config=require(_0x29d6('0x6'));var attributes=require(_0x29d6('0x7'));module['exports']=function(_0xeaaad5,_0x1fe143){return _0xeaaad5[_0x29d6('0x8')](_0x29d6('0x9'),attributes,{'tableName':_0x29d6('0xa'),'paranoid':![],'indexes':[{'name':_0x29d6('0xb'),'fields':[_0x29d6('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3cce8c,_0x1e4d69,_0x427b03){var _0x5da869=_0xeaaad5[_0x29d6('0xd')];var _0x40b9a0=_0x3cce8c[_0x29d6('0xe')]({'plain':!![]});if(_0x40b9a0[_0x29d6('0xf')][_0x29d6('0x10')]()==='in'||_0x40b9a0[_0x29d6('0xf')][_0x29d6('0x10')]()===_0x29d6('0x11')&&!_0x40b9a0['secret']&&!_['isNil'](_0x40b9a0[_0x29d6('0x12')])){_0x5da869[_0x29d6('0x13')][_0x29d6('0x14')]({'where':{'id':_0x40b9a0[_0x29d6('0x15')]}})[_0x29d6('0x16')](function(_0x2ce0bf){if(_0x2ce0bf){_0x2ce0bf['update']({'lastMsgAt':_0x40b9a0[_0x29d6('0x17')],'lastMsgDirection':_0x40b9a0[_0x29d6('0xf')]['toLowerCase']()});}})[_0x29d6('0x18')](function(_0x45eb84){console[_0x29d6('0x19')](_0x45eb84);});}_0x427b03();}},'charset':_0x29d6('0x1a'),'collate':_0x29d6('0x1b')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index abab339..9b7868a 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 _0x9957=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','body','options','raw','CreateFaxMessage','catch','UpdateFaxMessage','FaxMessage','where','attributes','lodash'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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});config[_0x7995('0xc')]=_[_0x7995('0xd')](config['redis'],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require(_0x7995('0xf'))(new Redis(config['redis']));require(_0x7995('0x10'))[_0x7995('0x11')](socket);function respondWithRpcPromise(_0x18c8a3,_0x35b5fe,_0x3c1d19){return new BPromise(function(_0x1e400a,_0x341672){return client['request'](_0x18c8a3,_0x3c1d19)[_0x7995('0x12')](function(_0x41c652){logger['info'](_0x7995('0x13'),_0x35b5fe,_0x7995('0x14'));logger[_0x7995('0x15')](_0x7995('0x16'),_0x35b5fe,_0x7995('0x14'),JSON[_0x7995('0x17')](_0x41c652));if(_0x41c652[_0x7995('0x18')]){if(_0x41c652['error']['code']===0x1f4){logger[_0x7995('0x18')](_0x7995('0x13'),_0x35b5fe,_0x41c652[_0x7995('0x18')][_0x7995('0x19')]);return _0x341672(_0x41c652[_0x7995('0x18')][_0x7995('0x19')]);}logger[_0x7995('0x18')](_0x7995('0x13'),_0x35b5fe,_0x41c652['error'][_0x7995('0x19')]);return _0x1e400a(_0x41c652['error'][_0x7995('0x19')]);}else{logger[_0x7995('0x1a')](_0x7995('0x13'),_0x35b5fe,_0x7995('0x14'));_0x1e400a(_0x41c652[_0x7995('0x1b')][_0x7995('0x19')]);}})['catch'](function(_0x54c9ae){logger[_0x7995('0x18')]('FaxMessage,\x20%s,\x20%s',_0x35b5fe,_0x54c9ae);_0x341672(_0x54c9ae);});});}exports['CreateFaxMessage']=function(_0x3ec178){var _0x3d463e=this;return new Promise(function(_0x4cbe10,_0x3a9b54){return db['FaxMessage']['create'](_0x3ec178[_0x7995('0x1c')],{'raw':_0x3ec178[_0x7995('0x1d')]?_0x3ec178[_0x7995('0x1d')][_0x7995('0x1e')]===undefined?!![]:![]:!![]})[_0x7995('0x12')](function(_0x1c278a){logger['info'](_0x7995('0x1f'),_0x3ec178);logger[_0x7995('0x15')](_0x7995('0x1f'),_0x3ec178,JSON[_0x7995('0x17')](_0x1c278a));_0x4cbe10(_0x1c278a);})[_0x7995('0x20')](function(_0x13bc35){logger[_0x7995('0x18')](_0x7995('0x1f'),_0x13bc35['message'],_0x3ec178);_0x3a9b54(_0x3d463e[_0x7995('0x18')](0x1f4,_0x13bc35[_0x7995('0x19')]));});});};exports[_0x7995('0x21')]=function(_0x268ce7){var _0x3a3fcf=this;return new Promise(function(_0x2a307e,_0x56691a){return db[_0x7995('0x22')]['update'](_0x268ce7[_0x7995('0x1c')],{'raw':_0x268ce7[_0x7995('0x1d')]?_0x268ce7[_0x7995('0x1d')][_0x7995('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x268ce7[_0x7995('0x1d')]?_0x268ce7['options'][_0x7995('0x23')]||null:null,'attributes':_0x268ce7['options']?_0x268ce7[_0x7995('0x1d')][_0x7995('0x24')]||null:null,'limit':_0x268ce7[_0x7995('0x1d')]?_0x268ce7['options']['limit']||null:null})['then'](function(_0x3573be){logger[_0x7995('0x1a')](_0x7995('0x21'),_0x268ce7);logger[_0x7995('0x15')](_0x7995('0x21'),_0x268ce7,JSON[_0x7995('0x17')](_0x3573be));_0x2a307e(_0x3573be);})['catch'](function(_0x481c74){logger[_0x7995('0x18')]('UpdateFaxMessage',_0x481c74[_0x7995('0x19')],_0x268ce7);_0x56691a(_0x3a3fcf[_0x7995('0x18')](0x1f4,_0x481c74[_0x7995('0x19')]));});});}; \ No newline at end of file +var _0x032e=['FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','UpdateFaxMessage','where','attributes','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info'];(function(_0x141480,_0x26f326){var _0x2c0e5e=function(_0x405b34){while(--_0x405b34){_0x141480['push'](_0x141480['shift']());}};_0x2c0e5e(++_0x26f326);}(_0x032e,0x124));var _0xe032=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x032e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var moment=require(_0xe032('0x1'));var BPromise=require(_0xe032('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe032('0x3'))['db'];var utils=require(_0xe032('0x4'));var logger=require(_0xe032('0x5'))(_0xe032('0x6'));var config=require(_0xe032('0x7'));var jayson=require(_0xe032('0x8'));var client=jayson[_0xe032('0x9')][_0xe032('0xa')]({'port':0x232a});config[_0xe032('0xb')]=_[_0xe032('0xc')](config[_0xe032('0xb')],{'host':_0xe032('0xd'),'port':0x18eb});var socket=require(_0xe032('0xe'))(new Redis(config[_0xe032('0xb')]));require(_0xe032('0xf'))[_0xe032('0x10')](socket);function respondWithRpcPromise(_0x2dc9e5,_0x167bd9,_0x4aec53){return new BPromise(function(_0x1382e1,_0x1ce2ae){return client[_0xe032('0x11')](_0x2dc9e5,_0x4aec53)[_0xe032('0x12')](function(_0x244f93){logger[_0xe032('0x13')](_0xe032('0x14'),_0x167bd9,'request\x20sent');logger[_0xe032('0x15')](_0xe032('0x16'),_0x167bd9,_0xe032('0x17'),JSON[_0xe032('0x18')](_0x244f93));if(_0x244f93['error']){if(_0x244f93[_0xe032('0x19')][_0xe032('0x1a')]===0x1f4){logger[_0xe032('0x19')](_0xe032('0x14'),_0x167bd9,_0x244f93[_0xe032('0x19')][_0xe032('0x1b')]);return _0x1ce2ae(_0x244f93[_0xe032('0x19')]['message']);}logger[_0xe032('0x19')](_0xe032('0x14'),_0x167bd9,_0x244f93[_0xe032('0x19')][_0xe032('0x1b')]);return _0x1382e1(_0x244f93[_0xe032('0x19')][_0xe032('0x1b')]);}else{logger['info'](_0xe032('0x14'),_0x167bd9,_0xe032('0x17'));_0x1382e1(_0x244f93[_0xe032('0x1c')][_0xe032('0x1b')]);}})[_0xe032('0x1d')](function(_0x5721ce){logger['error']('FaxMessage,\x20%s,\x20%s',_0x167bd9,_0x5721ce);_0x1ce2ae(_0x5721ce);});});}exports[_0xe032('0x1e')]=function(_0x505d8c){var _0x46dc27=this;return new Promise(function(_0x4608e4,_0x3f0257){return db[_0xe032('0x1f')][_0xe032('0x20')](_0x505d8c[_0xe032('0x21')],{'raw':_0x505d8c[_0xe032('0x22')]?_0x505d8c['options'][_0xe032('0x23')]===undefined?!![]:![]:!![]})[_0xe032('0x12')](function(_0x232e8f){logger[_0xe032('0x13')](_0xe032('0x1e'),_0x505d8c);logger[_0xe032('0x15')](_0xe032('0x1e'),_0x505d8c,JSON[_0xe032('0x18')](_0x232e8f));_0x4608e4(_0x232e8f);})['catch'](function(_0x4f1aa3){logger['error'](_0xe032('0x1e'),_0x4f1aa3[_0xe032('0x1b')],_0x505d8c);_0x3f0257(_0x46dc27[_0xe032('0x19')](0x1f4,_0x4f1aa3[_0xe032('0x1b')]));});});};exports[_0xe032('0x24')]=function(_0x200671){var _0x36ece7=this;return new Promise(function(_0x2b6ffa,_0x4dcbf1){return db[_0xe032('0x1f')]['update'](_0x200671[_0xe032('0x21')],{'raw':_0x200671[_0xe032('0x22')]?_0x200671[_0xe032('0x22')][_0xe032('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x200671['options']?_0x200671['options'][_0xe032('0x25')]||null:null,'attributes':_0x200671[_0xe032('0x22')]?_0x200671[_0xe032('0x22')][_0xe032('0x26')]||null:null,'limit':_0x200671['options']?_0x200671['options']['limit']||null:null})[_0xe032('0x12')](function(_0x1dd34f){logger[_0xe032('0x13')](_0xe032('0x24'),_0x200671);logger['debug'](_0xe032('0x24'),_0x200671,JSON[_0xe032('0x18')](_0x1dd34f));_0x2b6ffa(_0x1dd34f);})[_0xe032('0x1d')](function(_0x4348f8){logger[_0xe032('0x19')]('UpdateFaxMessage',_0x4348f8[_0xe032('0x1b')],_0x200671);_0x4dcbf1(_0x36ece7[_0xe032('0x19')](0x1f4,_0x4348f8[_0xe032('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 2ac8b42..589e4e2 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 _0xb804=['update','removeListener','register','./faxMessage.events','save','remove'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb804,0x1d7));var _0x4b80=function(_0x5679a4,_0x1f420b){_0x5679a4=_0x5679a4-0x0;var _0x397109=_0xb804[_0x5679a4];return _0x397109;};'use strict';var FaxMessageEvents=require(_0x4b80('0x0'));var events=[_0x4b80('0x1'),_0x4b80('0x2'),_0x4b80('0x3')];function createListener(_0x3e8db3,_0x48ff18){return function(_0x4fa897){_0x48ff18['emit'](_0x3e8db3,_0x4fa897);};}function removeListener(_0x428742,_0x29a3a5){return function(){FaxMessageEvents[_0x4b80('0x4')](_0x428742,_0x29a3a5);};}exports[_0x4b80('0x5')]=function(_0x235131){for(var _0x2d617f=0x0,_0x2d4cfe=events['length'];_0x2d617f<_0x2d4cfe;_0x2d617f++){var _0x11506d=events[_0x2d617f];var _0x4d2fac=createListener('faxMessage:'+_0x11506d,_0x235131);FaxMessageEvents['on'](_0x11506d,_0x4d2fac);}}; \ No newline at end of file +var _0x66be=['emit','removeListener','register','faxMessage:','./faxMessage.events','update'];(function(_0x35f2bb,_0x57cf1b){var _0x68ee51=function(_0x4df34a){while(--_0x4df34a){_0x35f2bb['push'](_0x35f2bb['shift']());}};_0x68ee51(++_0x57cf1b);}(_0x66be,0x1e4));var _0xe66b=function(_0x5818b2,_0x3a60e7){_0x5818b2=_0x5818b2-0x0;var _0x58cd50=_0x66be[_0x5818b2];return _0x58cd50;};'use strict';var FaxMessageEvents=require(_0xe66b('0x0'));var events=['save','remove',_0xe66b('0x1')];function createListener(_0x3dab98,_0x13cd15){return function(_0x2e9981){_0x13cd15[_0xe66b('0x2')](_0x3dab98,_0x2e9981);};}function removeListener(_0x487685,_0x4a4768){return function(){FaxMessageEvents[_0xe66b('0x3')](_0x487685,_0x4a4768);};}exports[_0xe66b('0x4')]=function(_0x223543){for(var _0x29a719=0x0,_0x386695=events['length'];_0x29a719<_0x386695;_0x29a719++){var _0x249588=events[_0x29a719];var _0x1420f7=createListener(_0xe66b('0x5')+_0x249588,_0x223543);FaxMessageEvents['on'](_0x249588,_0x1420f7);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index a9ff183..19c7cf7 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 _0xbee3=['update','/:id/accept','accept','/:id/reject','reject','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/download','download','post','fax','create','put'];(function(_0x99f811,_0x44d59e){var _0x37ba7f=function(_0x3f3961){while(--_0x3f3961){_0x99f811['push'](_0x99f811['shift']());}};_0x37ba7f(++_0x44d59e);}(_0xbee3,0xd5));var _0x3bee=function(_0x5e0c01,_0x5924c7){_0x5e0c01=_0x5e0c01-0x0;var _0x14ff45=_0xbee3[_0x5e0c01];return _0x14ff45;};'use strict';var multer=require('multer');var util=require(_0x3bee('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3bee('0x1'));var router=express[_0x3bee('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x3bee('0x3'));var interaction=require(_0x3bee('0x4'));var config=require(_0x3bee('0x5'));var controller=require('./faxMessage.controller');router[_0x3bee('0x6')]('/',auth[_0x3bee('0x7')](),controller['index']);router[_0x3bee('0x6')](_0x3bee('0x8'),auth[_0x3bee('0x7')](),controller[_0x3bee('0x9')]);router[_0x3bee('0x6')](_0x3bee('0xa'),auth[_0x3bee('0x7')](),controller['show']);router[_0x3bee('0x6')](_0x3bee('0xb'),auth[_0x3bee('0x7')](),controller[_0x3bee('0xc')]);router[_0x3bee('0xd')]('/',auth[_0x3bee('0x7')](),interaction['tracked'](_0x3bee('0xe'),'faxmessage:create'),controller[_0x3bee('0xf')]);router[_0x3bee('0x10')](_0x3bee('0xa'),auth[_0x3bee('0x7')](),controller[_0x3bee('0x11')]);router[_0x3bee('0x10')](_0x3bee('0x12'),auth['isAuthenticated'](),controller[_0x3bee('0x13')]);router[_0x3bee('0x10')](_0x3bee('0x14'),auth[_0x3bee('0x7')](),controller[_0x3bee('0x15')]);router['delete']('/:id',auth[_0x3bee('0x7')](),controller['destroy']);module[_0x3bee('0x16')]=router; \ No newline at end of file +var _0x702d=['get','index','/describe','describe','/:id','isAuthenticated','show','/:id/download','download','post','tracked','create','put','update','/:id/accept','accept','reject','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1703cd,_0x3c8ade){var _0x13ed83=function(_0x222f97){while(--_0x222f97){_0x1703cd['push'](_0x1703cd['shift']());}};_0x13ed83(++_0x3c8ade);}(_0x702d,0x147));var _0xd702=function(_0x17187f,_0xa130bc){_0x17187f=_0x17187f-0x0;var _0x52a06b=_0x702d[_0x17187f];return _0x52a06b;};'use strict';var multer=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var path=require(_0xd702('0x2'));var timeout=require(_0xd702('0x3'));var express=require(_0xd702('0x4'));var router=express['Router']();var fs_extra=require(_0xd702('0x5'));var auth=require(_0xd702('0x6'));var interaction=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var controller=require('./faxMessage.controller');router[_0xd702('0x9')]('/',auth['isAuthenticated'](),controller[_0xd702('0xa')]);router[_0xd702('0x9')](_0xd702('0xb'),auth['isAuthenticated'](),controller[_0xd702('0xc')]);router['get'](_0xd702('0xd'),auth[_0xd702('0xe')](),controller[_0xd702('0xf')]);router[_0xd702('0x9')](_0xd702('0x10'),auth[_0xd702('0xe')](),controller[_0xd702('0x11')]);router[_0xd702('0x12')]('/',auth[_0xd702('0xe')](),interaction[_0xd702('0x13')]('fax','faxmessage:create'),controller[_0xd702('0x14')]);router[_0xd702('0x15')](_0xd702('0xd'),auth['isAuthenticated'](),controller[_0xd702('0x16')]);router[_0xd702('0x15')](_0xd702('0x17'),auth[_0xd702('0xe')](),controller[_0xd702('0x18')]);router[_0xd702('0x15')]('/:id/reject',auth[_0xd702('0xe')](),controller[_0xd702('0x19')]);router['delete'](_0xd702('0xd'),auth['isAuthenticated'](),controller[_0xd702('0x1a')]);module[_0xd702('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index f7e72d1..4605433 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 _0x20e0=['beepall','roundrobin','exports','STRING','INTEGER','ENUM','rrmemory'];(function(_0x354635,_0x1a8e2a){var _0x27e1e2=function(_0x1ebd35){while(--_0x1ebd35){_0x354635['push'](_0x354635['shift']());}};_0x27e1e2(++_0x1a8e2a);}(_0x20e0,0xc6));var _0x020e=function(_0x39424b,_0x9531ca){_0x39424b=_0x39424b-0x0;var _0x545cf0=_0x20e0[_0x39424b];return _0x545cf0;};'use strict';var Sequelize=require('sequelize');module[_0x020e('0x0')]={'name':{'type':Sequelize[_0x020e('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x020e('0x1')]},'timeout':{'type':Sequelize[_0x020e('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x020e('0x3')](_0x020e('0x4'),_0x020e('0x5'),_0x020e('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x020e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfd6e=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','ENUM'];(function(_0x5e302e,_0x317f71){var _0x3822a1=function(_0x148f8f){while(--_0x148f8f){_0x5e302e['push'](_0x5e302e['shift']());}};_0x3822a1(++_0x317f71);}(_0xfd6e,0x183));var _0xefd6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfd6e[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xefd6('0x0'));module[_0xefd6('0x1')]={'name':{'type':Sequelize[_0xefd6('0x2')],'unique':_0xefd6('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xefd6('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xefd6('0x4')](_0xefd6('0x5'),_0xefd6('0x6'),_0xefd6('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 88db796..732a934 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 _0x2a25=['userFaxQueue:save','removeTeams','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','order','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','get','FaxQueues','error','stack','name','send','index','FaxQueue','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','map','VIRTUAL','merge','include','findAll','rows','catch','params','rawAttributes','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','getMembers','findOne','pick','FaxQueueId','User','UserId','agent','createdAt','%s/%s','SIP','updatedAt','Team','getTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','addTeams','each','UserFaxQueue','forEach','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a25,0xa4));var _0x52a2=function(_0xe71be4,_0x2bd1e9){_0xe71be4=_0xe71be4-0x0;var _0xf5aaee=_0x2a25[_0xe71be4];return _0xf5aaee;};'use strict';var emlformat=require(_0x52a2('0x0'));var rimraf=require(_0x52a2('0x1'));var zipdir=require(_0x52a2('0x2'));var jsonpatch=require(_0x52a2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x52a2('0x4'));var Mustache=require('mustache');var util=require(_0x52a2('0x5'));var path=require(_0x52a2('0x6'));var sox=require('sox');var csv=require(_0x52a2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x52a2('0x8'));var _=require(_0x52a2('0x9'));var squel=require(_0x52a2('0xa'));var crypto=require(_0x52a2('0xb'));var jsforce=require(_0x52a2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x52a2('0x7'));var querystring=require('querystring');var Papa=require(_0x52a2('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x52a2('0xe'));var as=require(_0x52a2('0xf'));var hardwareService=require(_0x52a2('0x10'));var logger=require('../../config/logger')(_0x52a2('0x11'));var utils=require('../../config/utils');var config=require(_0x52a2('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x52a2('0x13')](config[_0x52a2('0x14')],{'host':_0x52a2('0x15'),'port':0x18eb});var socket=require(_0x52a2('0x16'))(new Redis(config['redis']));require(_0x52a2('0x17'))[_0x52a2('0x18')](socket);function respondWithStatusCode(_0x6f54d0,_0x1eadbf){_0x1eadbf=_0x1eadbf||0xcc;return function(_0x2ebbac){if(_0x2ebbac){return _0x6f54d0[_0x52a2('0x19')](_0x1eadbf);}return _0x6f54d0['status'](_0x1eadbf)[_0x52a2('0x1a')]();};}function respondWithResult(_0x2b390f,_0x111eb9){_0x111eb9=_0x111eb9||0xc8;return function(_0x2ef556){if(_0x2ef556){return _0x2b390f[_0x52a2('0x1b')](_0x111eb9)[_0x52a2('0x1c')](_0x2ef556);}};}function respondWithFilteredResult(_0x31d7e9,_0x395fdb){return function(_0x522460){if(_0x522460){var _0xafc26e=typeof _0x395fdb[_0x52a2('0x1d')]===_0x52a2('0x1e')&&typeof _0x395fdb[_0x52a2('0x1f')]===_0x52a2('0x1e');var _0x5dc669=_0x522460[_0x52a2('0x20')];var _0x18e086=_0xafc26e?0x0:_0x395fdb[_0x52a2('0x1d')];var _0x3c4a6f=_0xafc26e?_0x522460[_0x52a2('0x20')]:_0x395fdb[_0x52a2('0x1d')]+_0x395fdb[_0x52a2('0x1f')];var _0x4eb2e2;if(_0x3c4a6f>=_0x5dc669){_0x3c4a6f=_0x5dc669;_0x4eb2e2=0xc8;}else{_0x4eb2e2=0xce;}_0x31d7e9[_0x52a2('0x1b')](_0x4eb2e2);return _0x31d7e9['set'](_0x52a2('0x21'),_0x18e086+'-'+_0x3c4a6f+'/'+_0x5dc669)[_0x52a2('0x1c')](_0x522460);}return null;};}function patchUpdates(_0x1855a5){return function(_0x17e00c){try{jsonpatch['apply'](_0x17e00c,_0x1855a5,!![]);}catch(_0x22bef4){return BPromise[_0x52a2('0x22')](_0x22bef4);}return _0x17e00c[_0x52a2('0x23')]();};}function saveUpdates(_0x3537ed,_0x18ae1c){return function(_0x1f987d){if(_0x1f987d){return _0x1f987d[_0x52a2('0x24')](_0x3537ed)[_0x52a2('0x25')](function(_0x4d6931){return _0x4d6931;});}return null;};}function removeEntity(_0xa3e4f0,_0x3d363e){return function(_0x546a4e){if(_0x546a4e){return _0x546a4e['destroy']()[_0x52a2('0x25')](function(){var _0x391a6c=_0x546a4e[_0x52a2('0x26')]({'plain':!![]});var _0x523742=_0x52a2('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x523742,'resourceId':_0x391a6c['id']}})[_0x52a2('0x25')](function(){return _0x546a4e;});})[_0x52a2('0x25')](function(){_0xa3e4f0[_0x52a2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4964b6,_0x4ff61d){return function(_0x5ce42b){if(!_0x5ce42b){_0x4964b6[_0x52a2('0x19')](0x194);}return _0x5ce42b;};}function handleError(_0x72af5b,_0x3a287a){_0x3a287a=_0x3a287a||0x1f4;return function(_0x90b41c){logger[_0x52a2('0x28')](_0x90b41c[_0x52a2('0x29')]);if(_0x90b41c[_0x52a2('0x2a')]){delete _0x90b41c[_0x52a2('0x2a')];}_0x72af5b[_0x52a2('0x1b')](_0x3a287a)[_0x52a2('0x2b')](_0x90b41c);};}exports[_0x52a2('0x2c')]=function(_0x361e32,_0x14f8d9){var _0x40cdb3={},_0x2c2d88={},_0x5634cf={'count':0x0,'rows':[]};var _0x4bdebd=_['map'](db[_0x52a2('0x2d')]['rawAttributes'],function(_0x353dff){return{'name':_0x353dff['fieldName'],'type':_0x353dff[_0x52a2('0x2e')][_0x52a2('0x2f')]};});_0x2c2d88['model']=_['map'](_0x4bdebd,_0x52a2('0x2a'));_0x2c2d88[_0x52a2('0x30')]=_[_0x52a2('0x31')](_0x361e32[_0x52a2('0x30')]);_0x2c2d88[_0x52a2('0x32')]=_[_0x52a2('0x33')](_0x2c2d88[_0x52a2('0x34')],_0x2c2d88[_0x52a2('0x30')]);_0x40cdb3['attributes']=_[_0x52a2('0x33')](_0x2c2d88[_0x52a2('0x34')],qs[_0x52a2('0x35')](_0x361e32[_0x52a2('0x30')][_0x52a2('0x35')]));_0x40cdb3[_0x52a2('0x36')]=_0x40cdb3[_0x52a2('0x36')][_0x52a2('0x37')]?_0x40cdb3['attributes']:_0x2c2d88[_0x52a2('0x34')];if(!_0x361e32['query'][_0x52a2('0x38')](_0x52a2('0x39'))){_0x40cdb3[_0x52a2('0x1f')]=qs[_0x52a2('0x1f')](_0x361e32[_0x52a2('0x30')]['limit']);_0x40cdb3['offset']=qs['offset'](_0x361e32[_0x52a2('0x30')][_0x52a2('0x1d')]);}_0x40cdb3['order']=qs[_0x52a2('0x3a')](_0x361e32[_0x52a2('0x30')][_0x52a2('0x3a')]);_0x40cdb3[_0x52a2('0x3b')]=qs[_0x52a2('0x32')](_['pick'](_0x361e32[_0x52a2('0x30')],_0x2c2d88[_0x52a2('0x32')]),_0x4bdebd);if(_0x361e32[_0x52a2('0x30')][_0x52a2('0x3c')]){_0x40cdb3[_0x52a2('0x3b')]=_['merge'](_0x40cdb3[_0x52a2('0x3b')],{'$or':_[_0x52a2('0x3d')](_0x4bdebd,function(_0x6ed0df){if(_0x6ed0df[_0x52a2('0x2e')]!==_0x52a2('0x3e')){var _0x2cb421={};_0x2cb421[_0x6ed0df[_0x52a2('0x2a')]]={'$like':'%'+_0x361e32[_0x52a2('0x30')][_0x52a2('0x3c')]+'%'};return _0x2cb421;}})});}_0x40cdb3=_[_0x52a2('0x3f')]({},_0x40cdb3,_0x361e32['options']);var _0x320355={'where':_0x40cdb3[_0x52a2('0x3b')]};return db[_0x52a2('0x2d')][_0x52a2('0x20')](_0x320355)[_0x52a2('0x25')](function(_0x2288ec){_0x5634cf['count']=_0x2288ec;if(_0x361e32[_0x52a2('0x30')]['includeAll']){_0x40cdb3[_0x52a2('0x40')]=[{'all':!![]}];}return db[_0x52a2('0x2d')][_0x52a2('0x41')](_0x40cdb3);})[_0x52a2('0x25')](function(_0x3e6ae9){_0x5634cf[_0x52a2('0x42')]=_0x3e6ae9;return _0x5634cf;})['then'](respondWithFilteredResult(_0x14f8d9,_0x40cdb3))[_0x52a2('0x43')](handleError(_0x14f8d9,null));};exports['show']=function(_0x39e397,_0x50c490){var _0x4bfd65={'raw':!![],'where':{'id':_0x39e397[_0x52a2('0x44')]['id']}},_0x20baef={};_0x20baef[_0x52a2('0x34')]=_[_0x52a2('0x31')](db[_0x52a2('0x2d')][_0x52a2('0x45')]);_0x20baef[_0x52a2('0x30')]=_[_0x52a2('0x31')](_0x39e397['query']);_0x20baef[_0x52a2('0x32')]=_[_0x52a2('0x33')](_0x20baef['model'],_0x20baef[_0x52a2('0x30')]);_0x4bfd65['attributes']=_[_0x52a2('0x33')](_0x20baef[_0x52a2('0x34')],qs['fields'](_0x39e397['query'][_0x52a2('0x35')]));_0x4bfd65[_0x52a2('0x36')]=_0x4bfd65[_0x52a2('0x36')][_0x52a2('0x37')]?_0x4bfd65[_0x52a2('0x36')]:_0x20baef[_0x52a2('0x34')];if(_0x39e397[_0x52a2('0x30')]['includeAll']){_0x4bfd65[_0x52a2('0x40')]=[{'all':!![]}];}_0x4bfd65=_[_0x52a2('0x3f')]({},_0x4bfd65,_0x39e397[_0x52a2('0x46')]);return db[_0x52a2('0x2d')][_0x52a2('0x47')](_0x4bfd65)['then'](handleEntityNotFound(_0x50c490,null))[_0x52a2('0x25')](respondWithResult(_0x50c490,null))[_0x52a2('0x43')](handleError(_0x50c490,null));};exports[_0x52a2('0x48')]=function(_0x15ebe1,_0x15ffa8){return db[_0x52a2('0x2d')]['create'](_0x15ebe1['body'],{})[_0x52a2('0x25')](function(_0x525b61){var _0x57c700=_0x15ebe1['user']['get']({'plain':!![]});if(!_0x57c700)throw new Error(_0x52a2('0x49'));if(_0x57c700['role']===_0x52a2('0x4a')){var _0x55e3cd=_0x525b61[_0x52a2('0x26')]({'plain':!![]});var _0x5d83dd=_0x52a2('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x5d83dd,'userProfileId':_0x57c700['userProfileId']},'raw':!![]})[_0x52a2('0x25')](function(_0x2bdd21){if(_0x2bdd21&&_0x2bdd21[_0x52a2('0x4b')]===0x0){return db[_0x52a2('0x4c')][_0x52a2('0x48')]({'name':_0x55e3cd[_0x52a2('0x2a')],'resourceId':_0x55e3cd['id'],'type':_0x2bdd21[_0x52a2('0x2a')],'sectionId':_0x2bdd21['id']},{})[_0x52a2('0x25')](function(){return _0x525b61;});}else{return _0x525b61;}})['catch'](function(_0x3f2bf2){logger[_0x52a2('0x28')](_0x52a2('0x4d'),_0x3f2bf2);throw _0x3f2bf2;});}return _0x525b61;})[_0x52a2('0x25')](respondWithResult(_0x15ffa8,0xc9))['catch'](handleError(_0x15ffa8,null));};exports[_0x52a2('0x24')]=function(_0x3d5ca4,_0x698d95){if(_0x3d5ca4[_0x52a2('0x4e')]['id']){delete _0x3d5ca4[_0x52a2('0x4e')]['id'];}return db[_0x52a2('0x2d')][_0x52a2('0x47')]({'where':{'id':_0x3d5ca4[_0x52a2('0x44')]['id']}})[_0x52a2('0x25')](handleEntityNotFound(_0x698d95,null))[_0x52a2('0x25')](saveUpdates(_0x3d5ca4[_0x52a2('0x4e')],null))[_0x52a2('0x25')](respondWithResult(_0x698d95,null))['catch'](handleError(_0x698d95,null));};exports[_0x52a2('0x4f')]=function(_0x1f8bb4,_0x460fde){return db[_0x52a2('0x2d')][_0x52a2('0x47')]({'where':{'id':_0x1f8bb4[_0x52a2('0x44')]['id']}})['then'](handleEntityNotFound(_0x460fde,null))[_0x52a2('0x25')](removeEntity(_0x460fde,null))['catch'](handleError(_0x460fde,null));};exports[_0x52a2('0x50')]=function(_0x349d45,_0xbea8d9){return db['FaxQueue'][_0x52a2('0x50')]()[_0x52a2('0x25')](respondWithResult(_0xbea8d9,null))[_0x52a2('0x43')](handleError(_0xbea8d9,null));};exports[_0x52a2('0x51')]=function(_0x5671be,_0x5832a7,_0x4f4b1b){var _0x5b776d={'raw':!![],'where':{}},_0x9c6e3c={},_0x517f99;return db[_0x52a2('0x2d')][_0x52a2('0x52')]({'where':{'id':_0x5671be[_0x52a2('0x44')]['id']}})[_0x52a2('0x25')](handleEntityNotFound(_0x5832a7,null))[_0x52a2('0x25')](function(_0x188d6e){if(_0x188d6e){_0x517f99=_0x188d6e['get']({'plain':!![]});_0x9c6e3c[_0x52a2('0x34')]=_[_0x52a2('0x31')](db['UserFaxQueue'][_0x52a2('0x45')]);_0x9c6e3c[_0x52a2('0x30')]=_['keys'](_0x5671be[_0x52a2('0x30')]);_0x9c6e3c[_0x52a2('0x32')]=_[_0x52a2('0x33')](_0x9c6e3c[_0x52a2('0x34')],_0x9c6e3c['query']);_0x5b776d[_0x52a2('0x36')]=_['intersection'](_0x9c6e3c['model'],qs[_0x52a2('0x35')](_0x5671be[_0x52a2('0x30')][_0x52a2('0x35')]));_0x5b776d[_0x52a2('0x36')]=_0x5b776d[_0x52a2('0x36')][_0x52a2('0x37')]?_0x5b776d[_0x52a2('0x36')]:_0x9c6e3c[_0x52a2('0x34')];if(!_0x5671be[_0x52a2('0x30')][_0x52a2('0x38')](_0x52a2('0x39'))){_0x5b776d['limit']=qs[_0x52a2('0x1f')](_0x5671be[_0x52a2('0x30')][_0x52a2('0x1f')]);_0x5b776d[_0x52a2('0x1d')]=qs[_0x52a2('0x1d')](_0x5671be[_0x52a2('0x30')][_0x52a2('0x1d')]);}_0x5b776d['order']=qs[_0x52a2('0x3a')](_0x5671be['query'][_0x52a2('0x3a')]);_0x5b776d[_0x52a2('0x3b')]=qs[_0x52a2('0x32')](_[_0x52a2('0x53')](_0x5671be[_0x52a2('0x30')],_0x9c6e3c['filters']));_0x5b776d[_0x52a2('0x3b')][_0x52a2('0x54')]=_0x188d6e['id'];if(_0x5671be[_0x52a2('0x30')]['filter']){_0x5b776d['where']=_['merge'](_0x5b776d[_0x52a2('0x3b')],{'$or':_['map'](_0x5b776d['attributes'],function(_0x2653b1){var _0x859986={};_0x859986[_0x2653b1]={'$like':'%'+_0x5671be[_0x52a2('0x30')][_0x52a2('0x3c')]+'%'};return _0x859986;})});}_0x5b776d=_[_0x52a2('0x3f')]({},_0x5b776d,_0x5671be[_0x52a2('0x46')]);return db['UserFaxQueue'][_0x52a2('0x41')](_0x5b776d);}})['then'](function(_0x17cd7e){if(_0x17cd7e){return db[_0x52a2('0x55')]['findAndCountAll']({'where':{'id':_['map'](_0x17cd7e,_0x52a2('0x56')),'role':_0x52a2('0x57')},'attributes':['id',_0x52a2('0x2a'),'faxPause','updatedAt',_0x52a2('0x58')]});}})['then'](function(_0x2fcf82){if(_0x2fcf82){return{'count':_0x2fcf82['count'],'rows':_['map'](_0x2fcf82['rows'],function(_0x305e66){return{'membername':_0x305e66['name'],'UserId':_0x305e66['id'],'queue_name':_0x517f99['name'],'FaxQueueId':_0x517f99['id'],'interface':util['format'](_0x52a2('0x59'),_0x52a2('0x5a'),_0x305e66[_0x52a2('0x2a')]),'penalty':0x0,'paused':_0x305e66['faxPause'],'createdAt':_0x305e66[_0x52a2('0x58')],'updatedAt':_0x305e66[_0x52a2('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x52a2('0x25')](respondWithFilteredResult(_0x5832a7,_0x5b776d))[_0x52a2('0x43')](handleError(_0x5832a7,null));};exports['getTeams']=function(_0x1a9ded,_0x35b05e,_0x215bc8){var _0x3fad3f={};var _0x1715ad={};var _0x554d7e;var _0x22d884;return db[_0x52a2('0x2d')][_0x52a2('0x52')]({'where':{'id':_0x1a9ded[_0x52a2('0x44')]['id']}})[_0x52a2('0x25')](handleEntityNotFound(_0x35b05e,null))[_0x52a2('0x25')](function(_0x4ad87e){if(_0x4ad87e){_0x554d7e=_0x4ad87e;_0x1715ad[_0x52a2('0x34')]=_[_0x52a2('0x31')](db[_0x52a2('0x5c')][_0x52a2('0x45')]);_0x1715ad[_0x52a2('0x30')]=_[_0x52a2('0x31')](_0x1a9ded[_0x52a2('0x30')]);_0x1715ad[_0x52a2('0x32')]=_[_0x52a2('0x33')](_0x1715ad[_0x52a2('0x34')],_0x1715ad['query']);_0x3fad3f[_0x52a2('0x36')]=_[_0x52a2('0x33')](_0x1715ad[_0x52a2('0x34')],qs[_0x52a2('0x35')](_0x1a9ded['query'][_0x52a2('0x35')]));_0x3fad3f[_0x52a2('0x36')]=_0x3fad3f[_0x52a2('0x36')][_0x52a2('0x37')]?_0x3fad3f[_0x52a2('0x36')]:_0x1715ad[_0x52a2('0x34')];_0x3fad3f['order']=qs[_0x52a2('0x3a')](_0x1a9ded[_0x52a2('0x30')]['sort']);_0x3fad3f[_0x52a2('0x3b')]=qs['filters'](_[_0x52a2('0x53')](_0x1a9ded[_0x52a2('0x30')],_0x1715ad[_0x52a2('0x32')]));if(_0x1a9ded['query'][_0x52a2('0x3c')]){_0x3fad3f[_0x52a2('0x3b')]=_['merge'](_0x3fad3f['where'],{'$or':_[_0x52a2('0x3d')](_0x3fad3f[_0x52a2('0x36')],function(_0x5c13c5){var _0x44d879={};_0x44d879[_0x5c13c5]={'$like':'%'+_0x1a9ded[_0x52a2('0x30')][_0x52a2('0x3c')]+'%'};return _0x44d879;})});}_0x3fad3f=_[_0x52a2('0x3f')]({},_0x3fad3f,_0x1a9ded[_0x52a2('0x46')]);return _0x554d7e[_0x52a2('0x5d')](_0x3fad3f);}})[_0x52a2('0x25')](function(_0x422f22){if(_0x422f22){_0x22d884=_0x422f22[_0x52a2('0x37')];if(!_0x1a9ded[_0x52a2('0x30')][_0x52a2('0x38')]('nolimit')){_0x3fad3f[_0x52a2('0x1f')]=qs[_0x52a2('0x1f')](_0x1a9ded[_0x52a2('0x30')]['limit']);_0x3fad3f['offset']=qs['offset'](_0x1a9ded['query']['offset']);}return _0x554d7e[_0x52a2('0x5d')](_0x3fad3f);}})['then'](function(_0x157b9f){if(_0x157b9f){return _0x157b9f?{'count':_0x22d884,'rows':_0x157b9f}:null;}})[_0x52a2('0x25')](respondWithResult(_0x35b05e,null))[_0x52a2('0x43')](handleError(_0x35b05e,null));};exports['addTeams']=function(_0x44aedf,_0x3697b5,_0x44b15e){var _0xac603=_0x44aedf['body'][_0x52a2('0x5e')];return db[_0x52a2('0x5c')][_0x52a2('0x41')]({'where':{'id':_0xac603},'attributes':['id'],'include':[{'model':db[_0x52a2('0x55')],'as':_0x52a2('0x5f'),'attributes':['id',_0x52a2('0x2a'),_0x52a2('0x60'),_0x52a2('0x61'),'interface'],'raw':!![]}]})['then'](function(_0x2c1f2f){if(_0x2c1f2f){var _0x1b945b=_[_0x52a2('0x62')](_0x2c1f2f,function(_0x1475d7){var _0x461673=_0x1475d7[_0x52a2('0x26')]({'plain':!![]});return _0x461673[_0x52a2('0x5f')];});return db[_0x52a2('0x2d')][_0x52a2('0x47')]({'where':{'id':_0x44aedf['params']['id']}})['then'](function(_0x3a9429){return db[_0x52a2('0x63')][_0x52a2('0x64')](function(_0x14d471){return _0x3a9429[_0x52a2('0x65')](_0xac603,{'transaction':_0x14d471})[_0x52a2('0x25')](function(){return BPromise[_0x52a2('0x66')](_0x1b945b,function(_0x242783){return db[_0x52a2('0x67')]['findOrCreate']({'where':{'UserId':_0x242783['id'],'FaxQueueId':_0x44aedf[_0x52a2('0x44')]['id']},'transaction':_0x14d471});});})[_0x52a2('0x25')](function(){_0x1b945b[_0x52a2('0x68')](function(_0xfe4944){socket[_0x52a2('0x69')](_0x52a2('0x6a'),{'UserId':_0xfe4944['id'],'FaxQueueId':_0x3a9429['id']});});});});});}})[_0x52a2('0x25')](respondWithStatusCode(_0x3697b5,null))['catch'](handleError(_0x3697b5,null));};exports[_0x52a2('0x6b')]=function(_0x26a78c,_0x277c14,_0x55845e){return db[_0x52a2('0x5c')][_0x52a2('0x41')]({'where':{'id':_0x26a78c[_0x52a2('0x30')][_0x52a2('0x5e')]},'attributes':['id'],'include':[{'model':db[_0x52a2('0x55')],'as':_0x52a2('0x5f'),'attributes':['id'],'raw':!![]}]})[_0x52a2('0x25')](handleEntityNotFound(_0x277c14,null))[_0x52a2('0x25')](function(_0x310fd4){var _0xab0d2=_[_0x52a2('0x3d')](_0x310fd4,'id');var _0x14b2e8=[];var _0x42d706=[];var _0x2e8668=squel['select']();_0x2e8668[_0x52a2('0x6c')](_0x52a2('0x6d'))[_0x52a2('0x6e')](_0x52a2('0x6f'),'tq')[_0x52a2('0x70')](_0x52a2('0x71'),'ut',_0x52a2('0x72'))['where'](_0x52a2('0x73'),_0x26a78c[_0x52a2('0x44')]['id']);for(var _0x540812=0x0;_0x540812<_0x310fd4[_0x52a2('0x37')];_0x540812+=0x1){let _0x289837=_0x310fd4[_0x540812];for(var _0xe5e5b6=0x0;_0xe5e5b6<_0x289837[_0x52a2('0x5f')]['length'];_0xe5e5b6+=0x1){let _0x31bfa9=_0x289837[_0x52a2('0x5f')][_0xe5e5b6];var _0x1f0304=_0x2e8668[_0x52a2('0x74')]();_0x1f0304[_0x52a2('0x3b')](_0x52a2('0x75'),_0x31bfa9['id']);_0x42d706['push'](db[_0x52a2('0x63')]['query'](_0x1f0304[_0x52a2('0x76')](),{'type':db[_0x52a2('0x63')]['QueryTypes'][_0x52a2('0x77')]})['then'](function(_0x5dbee7){if(_0x5dbee7['length']===0x1){return _0x31bfa9['id'];}else{var _0x372a94=_[_0x52a2('0x78')](_['map'](_0x5dbee7,_0x52a2('0x79')),function(_0x512c0b){return _[_0x52a2('0x7a')](_0xab0d2,_0x512c0b);});if(_0x372a94){return _0x31bfa9['id'];}}}));}}return BPromise['all'](_0x42d706)[_0x52a2('0x25')](function(_0x1069b6){_0x14b2e8=_(_0x14b2e8)[_0x52a2('0x7b')](_0x1069b6)[_0x52a2('0x7c')]()[_0x52a2('0x7d')]();return db[_0x52a2('0x2d')][_0x52a2('0x47')]({'where':{'id':_0x26a78c[_0x52a2('0x44')]['id']}})['then'](function(_0x49deac){return db[_0x52a2('0x63')][_0x52a2('0x64')](function(_0x4537d2){return _0x49deac[_0x52a2('0x6b')](_0x26a78c[_0x52a2('0x30')]['ids'],{'transaction':_0x4537d2})[_0x52a2('0x25')](function(){if(!_[_0x52a2('0x7e')](_0x14b2e8)){return _0x49deac[_0x52a2('0x7f')](_0x14b2e8,{'transaction':_0x4537d2});}})[_0x52a2('0x25')](function(){_0x14b2e8['forEach'](function(_0x586425){socket[_0x52a2('0x69')](_0x52a2('0x80'),{'UserId':_0x586425,'FaxQueueId':_0x49deac['id']});});});});});});})[_0x52a2('0x25')](respondWithStatusCode(_0x277c14,null))[_0x52a2('0x43')](handleError(_0x277c14,null));};exports['addAgents']=function(_0x195b74,_0x26632e,_0x263e91){return db['FaxQueue'][_0x52a2('0x47')]({'where':{'id':_0x195b74[_0x52a2('0x44')]['id']}})[_0x52a2('0x25')](handleEntityNotFound(_0x26632e,null))[_0x52a2('0x25')](function(_0x2c69ec){if(_0x2c69ec){return _0x2c69ec[_0x52a2('0x81')](_0x195b74[_0x52a2('0x4e')]['ids'],_[_0x52a2('0x82')](_0x195b74[_0x52a2('0x4e')],[_0x52a2('0x5e'),'id'])||{})[_0x52a2('0x83')](function(_0x5ca2ab){for(var _0x11a108=0x0;_0x11a108<_0x195b74['body']['ids'][_0x52a2('0x37')];_0x11a108+=0x1){socket[_0x52a2('0x69')](_0x52a2('0x6a'),{'UserId':Number(_0x195b74[_0x52a2('0x4e')][_0x52a2('0x5e')][_0x11a108]),'FaxQueueId':Number(_0x195b74[_0x52a2('0x44')]['id'])});}return _0x5ca2ab;});}})['then'](respondWithResult(_0x26632e,null))[_0x52a2('0x43')](handleError(_0x26632e,null));};exports[_0x52a2('0x7f')]=function(_0x6a7232,_0x4dcf66,_0x1a5092){return db['FaxQueue'][_0x52a2('0x47')]({'where':{'id':_0x6a7232[_0x52a2('0x44')]['id']}})['then'](handleEntityNotFound(_0x4dcf66,null))[_0x52a2('0x25')](function(_0x3dda40){if(_0x3dda40){return _0x3dda40[_0x52a2('0x7f')](_0x6a7232[_0x52a2('0x30')][_0x52a2('0x5e')])['then'](function(){if(_[_0x52a2('0x84')](_0x6a7232[_0x52a2('0x30')]['ids'])){for(var _0x4ac3fe=0x0;_0x4ac3fe<_0x6a7232[_0x52a2('0x30')]['ids'][_0x52a2('0x37')];_0x4ac3fe+=0x1){socket[_0x52a2('0x69')](_0x52a2('0x80'),{'UserId':Number(_0x6a7232['query'][_0x52a2('0x5e')][_0x4ac3fe]),'FaxQueueId':Number(_0x6a7232[_0x52a2('0x44')]['id'])});}}else{socket[_0x52a2('0x69')](_0x52a2('0x80'),{'UserId':Number(_0x6a7232[_0x52a2('0x30')][_0x52a2('0x5e')]),'FaxQueueId':Number(_0x6a7232[_0x52a2('0x44')]['id'])});}});}})[_0x52a2('0x25')](respondWithStatusCode(_0x4dcf66,null))[_0x52a2('0x43')](handleError(_0x4dcf66,null));};exports[_0x52a2('0x85')]=function(_0x48cabc,_0x53192b,_0xe71219){var _0x4e8659={};var _0x1d593d={};var _0x4c5132;var _0x1320b6;return db['FaxQueue'][_0x52a2('0x52')]({'where':{'id':_0x48cabc[_0x52a2('0x44')]['id']}})[_0x52a2('0x25')](handleEntityNotFound(_0x53192b,null))[_0x52a2('0x25')](function(_0x2e5b7b){if(_0x2e5b7b){_0x4c5132=_0x2e5b7b;_0x1d593d[_0x52a2('0x34')]=_['keys'](db[_0x52a2('0x55')][_0x52a2('0x45')]);_0x1d593d['query']=_[_0x52a2('0x31')](_0x48cabc[_0x52a2('0x30')]);_0x1d593d[_0x52a2('0x32')]=_[_0x52a2('0x33')](_0x1d593d[_0x52a2('0x34')],_0x1d593d['query']);_0x4e8659[_0x52a2('0x36')]=_['intersection'](_0x1d593d[_0x52a2('0x34')],qs[_0x52a2('0x35')](_0x48cabc[_0x52a2('0x30')]['fields']));_0x4e8659['attributes']=_0x4e8659[_0x52a2('0x36')][_0x52a2('0x37')]?_0x4e8659[_0x52a2('0x36')]:_0x1d593d[_0x52a2('0x34')];_0x4e8659[_0x52a2('0x86')]=qs[_0x52a2('0x3a')](_0x48cabc['query']['sort']);_0x4e8659['where']=qs[_0x52a2('0x32')](_[_0x52a2('0x53')](_0x48cabc[_0x52a2('0x30')],_0x1d593d[_0x52a2('0x32')]));if(_0x48cabc[_0x52a2('0x30')]['filter']){_0x4e8659[_0x52a2('0x3b')]=_[_0x52a2('0x3f')](_0x4e8659[_0x52a2('0x3b')],{'$or':_[_0x52a2('0x3d')](_0x4e8659[_0x52a2('0x36')],function(_0x43f025){var _0x432db3={};_0x432db3[_0x43f025]={'$like':'%'+_0x48cabc[_0x52a2('0x30')][_0x52a2('0x3c')]+'%'};return _0x432db3;})});}_0x4e8659=_[_0x52a2('0x3f')]({},_0x4e8659,_0x48cabc['options']);return _0x4c5132[_0x52a2('0x85')](_0x4e8659);}})['then'](function(_0x5c359c){if(_0x5c359c){_0x1320b6=_0x5c359c[_0x52a2('0x37')];if(!_0x48cabc[_0x52a2('0x30')][_0x52a2('0x38')]('nolimit')){_0x4e8659[_0x52a2('0x1f')]=qs[_0x52a2('0x1f')](_0x48cabc[_0x52a2('0x30')]['limit']);_0x4e8659['offset']=qs[_0x52a2('0x1d')](_0x48cabc[_0x52a2('0x30')][_0x52a2('0x1d')]);}return _0x4c5132[_0x52a2('0x85')](_0x4e8659);}})[_0x52a2('0x25')](function(_0x1ef33b){if(_0x1ef33b){return _0x1ef33b?{'count':_0x1320b6,'rows':_0x1ef33b}:null;}})[_0x52a2('0x25')](respondWithResult(_0x53192b,null))[_0x52a2('0x43')](handleError(_0x53192b,null));}; \ No newline at end of file +var _0x5c17=['online','voicePause','interface','sequelize','each','findOrCreate','emit','userFaxQueue:save','field','from','team_has_fax_queues','join','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','all','union','removeTeams','removeAgents','forEach','userFaxQueue:remove','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','end','json','offset','limit','undefined','count','reject','save','update','destroy','then','get','UserProfileResource','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','FaxQueue','includeAll','include','findAll','catch','attributes','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','FaxQueues','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','User','UserId','faxPause','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents'];(function(_0x5c76f5,_0xf2a68){var _0x548079=function(_0xfd543a){while(--_0xfd543a){_0x5c76f5['push'](_0x5c76f5['shift']());}};_0x548079(++_0xf2a68);}(_0x5c17,0x1b2));var _0x75c1=function(_0x2c0cec,_0x4e3f2a){_0x2c0cec=_0x2c0cec-0x0;var _0x5cfdde=_0x5c17[_0x2c0cec];return _0x5cfdde;};'use strict';var emlformat=require(_0x75c1('0x0'));var rimraf=require(_0x75c1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x75c1('0x2'));var rp=require(_0x75c1('0x3'));var moment=require(_0x75c1('0x4'));var BPromise=require(_0x75c1('0x5'));var Mustache=require(_0x75c1('0x6'));var util=require('util');var path=require(_0x75c1('0x7'));var sox=require(_0x75c1('0x8'));var csv=require(_0x75c1('0x9'));var ejs=require(_0x75c1('0xa'));var fs=require('fs');var fs_extra=require(_0x75c1('0xb'));var _=require(_0x75c1('0xc'));var squel=require(_0x75c1('0xd'));var crypto=require(_0x75c1('0xe'));var jsforce=require(_0x75c1('0xf'));var deskjs=require(_0x75c1('0x10'));var toCsv=require(_0x75c1('0x9'));var querystring=require('querystring');var Papa=require(_0x75c1('0x11'));var Redis=require(_0x75c1('0x12'));var authService=require(_0x75c1('0x13'));var qs=require(_0x75c1('0x14'));var as=require(_0x75c1('0x15'));var hardwareService=require(_0x75c1('0x16'));var logger=require('../../config/logger')(_0x75c1('0x17'));var utils=require(_0x75c1('0x18'));var config=require(_0x75c1('0x19'));var licenseUtil=require(_0x75c1('0x1a'));var db=require(_0x75c1('0x1b'))['db'];config[_0x75c1('0x1c')]=_[_0x75c1('0x1d')](config[_0x75c1('0x1c')],{'host':_0x75c1('0x1e'),'port':0x18eb});var socket=require(_0x75c1('0x1f'))(new Redis(config[_0x75c1('0x1c')]));require(_0x75c1('0x20'))['register'](socket);function respondWithStatusCode(_0x30d9a8,_0x565ba8){_0x565ba8=_0x565ba8||0xcc;return function(_0x1db2c8){if(_0x1db2c8){return _0x30d9a8[_0x75c1('0x21')](_0x565ba8);}return _0x30d9a8[_0x75c1('0x22')](_0x565ba8)[_0x75c1('0x23')]();};}function respondWithResult(_0xf0bd16,_0x475532){_0x475532=_0x475532||0xc8;return function(_0x451115){if(_0x451115){return _0xf0bd16[_0x75c1('0x22')](_0x475532)[_0x75c1('0x24')](_0x451115);}};}function respondWithFilteredResult(_0x5085c4,_0x11b44d){return function(_0x2cde73){if(_0x2cde73){var _0x1d324e=typeof _0x11b44d[_0x75c1('0x25')]==='undefined'&&typeof _0x11b44d[_0x75c1('0x26')]===_0x75c1('0x27');var _0x53eea2=_0x2cde73[_0x75c1('0x28')];var _0x34c100=_0x1d324e?0x0:_0x11b44d[_0x75c1('0x25')];var _0x1ca22c=_0x1d324e?_0x2cde73[_0x75c1('0x28')]:_0x11b44d[_0x75c1('0x25')]+_0x11b44d[_0x75c1('0x26')];var _0x198b3a;if(_0x1ca22c>=_0x53eea2){_0x1ca22c=_0x53eea2;_0x198b3a=0xc8;}else{_0x198b3a=0xce;}_0x5085c4[_0x75c1('0x22')](_0x198b3a);return _0x5085c4['set']('Content-Range',_0x34c100+'-'+_0x1ca22c+'/'+_0x53eea2)['json'](_0x2cde73);}return null;};}function patchUpdates(_0x1d3830){return function(_0x551e91){try{jsonpatch['apply'](_0x551e91,_0x1d3830,!![]);}catch(_0x20da8d){return BPromise[_0x75c1('0x29')](_0x20da8d);}return _0x551e91[_0x75c1('0x2a')]();};}function saveUpdates(_0x31cf8d,_0x28df7e){return function(_0x5a5925){if(_0x5a5925){return _0x5a5925[_0x75c1('0x2b')](_0x31cf8d)['then'](function(_0x390d9e){return _0x390d9e;});}return null;};}function removeEntity(_0x213040,_0x4869e7){return function(_0x303d26){if(_0x303d26){return _0x303d26[_0x75c1('0x2c')]()[_0x75c1('0x2d')](function(){var _0x4f09ef=_0x303d26[_0x75c1('0x2e')]({'plain':!![]});var _0x324df2='FaxQueues';return db[_0x75c1('0x2f')][_0x75c1('0x2c')]({'where':{'type':_0x324df2,'resourceId':_0x4f09ef['id']}})[_0x75c1('0x2d')](function(){return _0x303d26;});})['then'](function(){_0x213040[_0x75c1('0x22')](0xcc)[_0x75c1('0x23')]();});}};}function handleEntityNotFound(_0x2700aa,_0x430a4e){return function(_0xc79e06){if(!_0xc79e06){_0x2700aa['sendStatus'](0x194);}return _0xc79e06;};}function handleError(_0x3260c5,_0x1e9517){_0x1e9517=_0x1e9517||0x1f4;return function(_0x59398b){logger['error'](_0x59398b['stack']);if(_0x59398b[_0x75c1('0x30')]){delete _0x59398b[_0x75c1('0x30')];}_0x3260c5[_0x75c1('0x22')](_0x1e9517)['send'](_0x59398b);};}exports[_0x75c1('0x31')]=function(_0x1ffbd3,_0x4dd243){var _0x3f3ab9={},_0x431835={},_0x2ca283={'count':0x0,'rows':[]};var _0x450437=_[_0x75c1('0x32')](db['FaxQueue'][_0x75c1('0x33')],function(_0x53d43a){return{'name':_0x53d43a[_0x75c1('0x34')],'type':_0x53d43a[_0x75c1('0x35')][_0x75c1('0x36')]};});_0x431835[_0x75c1('0x37')]=_['map'](_0x450437,_0x75c1('0x30'));_0x431835[_0x75c1('0x38')]=_[_0x75c1('0x39')](_0x1ffbd3['query']);_0x431835[_0x75c1('0x3a')]=_[_0x75c1('0x3b')](_0x431835['model'],_0x431835['query']);_0x3f3ab9['attributes']=_[_0x75c1('0x3b')](_0x431835['model'],qs[_0x75c1('0x3c')](_0x1ffbd3[_0x75c1('0x38')][_0x75c1('0x3c')]));_0x3f3ab9['attributes']=_0x3f3ab9['attributes']['length']?_0x3f3ab9['attributes']:_0x431835['model'];if(!_0x1ffbd3[_0x75c1('0x38')][_0x75c1('0x3d')](_0x75c1('0x3e'))){_0x3f3ab9[_0x75c1('0x26')]=qs['limit'](_0x1ffbd3[_0x75c1('0x38')][_0x75c1('0x26')]);_0x3f3ab9['offset']=qs[_0x75c1('0x25')](_0x1ffbd3[_0x75c1('0x38')][_0x75c1('0x25')]);}_0x3f3ab9[_0x75c1('0x3f')]=qs[_0x75c1('0x40')](_0x1ffbd3['query']['sort']);_0x3f3ab9['where']=qs[_0x75c1('0x3a')](_[_0x75c1('0x41')](_0x1ffbd3[_0x75c1('0x38')],_0x431835['filters']),_0x450437);if(_0x1ffbd3['query'][_0x75c1('0x42')]){_0x3f3ab9[_0x75c1('0x43')]=_[_0x75c1('0x44')](_0x3f3ab9[_0x75c1('0x43')],{'$or':_['map'](_0x450437,function(_0x8a2558){if(_0x8a2558[_0x75c1('0x35')]!==_0x75c1('0x45')){var _0x5971e9={};_0x5971e9[_0x8a2558[_0x75c1('0x30')]]={'$like':'%'+_0x1ffbd3['query'][_0x75c1('0x42')]+'%'};return _0x5971e9;}})});}_0x3f3ab9=_['merge']({},_0x3f3ab9,_0x1ffbd3[_0x75c1('0x46')]);var _0x288b5c={'where':_0x3f3ab9[_0x75c1('0x43')]};return db[_0x75c1('0x47')][_0x75c1('0x28')](_0x288b5c)[_0x75c1('0x2d')](function(_0xbe70ad){_0x2ca283[_0x75c1('0x28')]=_0xbe70ad;if(_0x1ffbd3[_0x75c1('0x38')][_0x75c1('0x48')]){_0x3f3ab9[_0x75c1('0x49')]=[{'all':!![]}];}return db['FaxQueue'][_0x75c1('0x4a')](_0x3f3ab9);})[_0x75c1('0x2d')](function(_0xa0fa06){_0x2ca283['rows']=_0xa0fa06;return _0x2ca283;})[_0x75c1('0x2d')](respondWithFilteredResult(_0x4dd243,_0x3f3ab9))[_0x75c1('0x4b')](handleError(_0x4dd243,null));};exports['show']=function(_0x43c688,_0x79d493){var _0x2c1f8f={'raw':!![],'where':{'id':_0x43c688['params']['id']}},_0x12e027={};_0x12e027[_0x75c1('0x37')]=_[_0x75c1('0x39')](db[_0x75c1('0x47')][_0x75c1('0x33')]);_0x12e027['query']=_[_0x75c1('0x39')](_0x43c688[_0x75c1('0x38')]);_0x12e027[_0x75c1('0x3a')]=_[_0x75c1('0x3b')](_0x12e027['model'],_0x12e027['query']);_0x2c1f8f[_0x75c1('0x4c')]=_[_0x75c1('0x3b')](_0x12e027[_0x75c1('0x37')],qs[_0x75c1('0x3c')](_0x43c688['query'][_0x75c1('0x3c')]));_0x2c1f8f[_0x75c1('0x4c')]=_0x2c1f8f['attributes'][_0x75c1('0x4d')]?_0x2c1f8f[_0x75c1('0x4c')]:_0x12e027['model'];if(_0x43c688['query'][_0x75c1('0x48')]){_0x2c1f8f[_0x75c1('0x49')]=[{'all':!![]}];}_0x2c1f8f=_[_0x75c1('0x44')]({},_0x2c1f8f,_0x43c688[_0x75c1('0x46')]);return db['FaxQueue'][_0x75c1('0x4e')](_0x2c1f8f)[_0x75c1('0x2d')](handleEntityNotFound(_0x79d493,null))[_0x75c1('0x2d')](respondWithResult(_0x79d493,null))[_0x75c1('0x4b')](handleError(_0x79d493,null));};exports[_0x75c1('0x4f')]=function(_0x14985d,_0x4de56d){return db[_0x75c1('0x47')]['create'](_0x14985d['body'],{})[_0x75c1('0x2d')](function(_0x377541){var _0x33959d=_0x14985d[_0x75c1('0x50')][_0x75c1('0x2e')]({'plain':!![]});if(!_0x33959d)throw new Error(_0x75c1('0x51'));if(_0x33959d['role']===_0x75c1('0x50')){var _0x2e7d24=_0x377541[_0x75c1('0x2e')]({'plain':!![]});var _0xa2b5fb=_0x75c1('0x52');return db[_0x75c1('0x53')][_0x75c1('0x4e')]({'where':{'name':_0xa2b5fb,'userProfileId':_0x33959d['userProfileId']},'raw':!![]})['then'](function(_0x49e8d5){if(_0x49e8d5&&_0x49e8d5[_0x75c1('0x54')]===0x0){return db[_0x75c1('0x2f')][_0x75c1('0x4f')]({'name':_0x2e7d24[_0x75c1('0x30')],'resourceId':_0x2e7d24['id'],'type':_0x49e8d5[_0x75c1('0x30')],'sectionId':_0x49e8d5['id']},{})['then'](function(){return _0x377541;});}else{return _0x377541;}})[_0x75c1('0x4b')](function(_0x328a7e){logger[_0x75c1('0x55')](_0x75c1('0x56'),_0x328a7e);throw _0x328a7e;});}return _0x377541;})['then'](respondWithResult(_0x4de56d,0xc9))[_0x75c1('0x4b')](handleError(_0x4de56d,null));};exports['update']=function(_0x8b6393,_0xad1e5b){if(_0x8b6393[_0x75c1('0x57')]['id']){delete _0x8b6393[_0x75c1('0x57')]['id'];}return db[_0x75c1('0x47')][_0x75c1('0x4e')]({'where':{'id':_0x8b6393['params']['id']}})[_0x75c1('0x2d')](handleEntityNotFound(_0xad1e5b,null))['then'](saveUpdates(_0x8b6393[_0x75c1('0x57')],null))[_0x75c1('0x2d')](respondWithResult(_0xad1e5b,null))[_0x75c1('0x4b')](handleError(_0xad1e5b,null));};exports[_0x75c1('0x2c')]=function(_0x52915f,_0x51044a){return db['FaxQueue'][_0x75c1('0x4e')]({'where':{'id':_0x52915f[_0x75c1('0x58')]['id']}})[_0x75c1('0x2d')](handleEntityNotFound(_0x51044a,null))['then'](removeEntity(_0x51044a,null))[_0x75c1('0x4b')](handleError(_0x51044a,null));};exports[_0x75c1('0x59')]=function(_0x373263,_0x380c4a){return db['FaxQueue'][_0x75c1('0x59')]()[_0x75c1('0x2d')](respondWithResult(_0x380c4a,null))[_0x75c1('0x4b')](handleError(_0x380c4a,null));};exports[_0x75c1('0x5a')]=function(_0x9e8d90,_0xe3eb2c,_0x2f5681){var _0x4077b8={'raw':!![],'where':{}},_0x4c757d={},_0x559a5e;return db[_0x75c1('0x47')][_0x75c1('0x5b')]({'where':{'id':_0x9e8d90[_0x75c1('0x58')]['id']}})[_0x75c1('0x2d')](handleEntityNotFound(_0xe3eb2c,null))[_0x75c1('0x2d')](function(_0x5c549b){if(_0x5c549b){_0x559a5e=_0x5c549b['get']({'plain':!![]});_0x4c757d[_0x75c1('0x37')]=_[_0x75c1('0x39')](db[_0x75c1('0x5c')]['rawAttributes']);_0x4c757d['query']=_[_0x75c1('0x39')](_0x9e8d90['query']);_0x4c757d[_0x75c1('0x3a')]=_[_0x75c1('0x3b')](_0x4c757d[_0x75c1('0x37')],_0x4c757d[_0x75c1('0x38')]);_0x4077b8[_0x75c1('0x4c')]=_['intersection'](_0x4c757d['model'],qs[_0x75c1('0x3c')](_0x9e8d90[_0x75c1('0x38')]['fields']));_0x4077b8['attributes']=_0x4077b8['attributes'][_0x75c1('0x4d')]?_0x4077b8[_0x75c1('0x4c')]:_0x4c757d[_0x75c1('0x37')];if(!_0x9e8d90[_0x75c1('0x38')][_0x75c1('0x3d')]('nolimit')){_0x4077b8[_0x75c1('0x26')]=qs[_0x75c1('0x26')](_0x9e8d90['query'][_0x75c1('0x26')]);_0x4077b8[_0x75c1('0x25')]=qs[_0x75c1('0x25')](_0x9e8d90[_0x75c1('0x38')][_0x75c1('0x25')]);}_0x4077b8['order']=qs[_0x75c1('0x40')](_0x9e8d90[_0x75c1('0x38')][_0x75c1('0x40')]);_0x4077b8[_0x75c1('0x43')]=qs[_0x75c1('0x3a')](_[_0x75c1('0x41')](_0x9e8d90['query'],_0x4c757d[_0x75c1('0x3a')]));_0x4077b8[_0x75c1('0x43')][_0x75c1('0x5d')]=_0x5c549b['id'];if(_0x9e8d90[_0x75c1('0x38')][_0x75c1('0x42')]){_0x4077b8[_0x75c1('0x43')]=_[_0x75c1('0x44')](_0x4077b8[_0x75c1('0x43')],{'$or':_[_0x75c1('0x32')](_0x4077b8[_0x75c1('0x4c')],function(_0x274e11){var _0xdc2eb3={};_0xdc2eb3[_0x274e11]={'$like':'%'+_0x9e8d90['query']['filter']+'%'};return _0xdc2eb3;})});}_0x4077b8=_[_0x75c1('0x44')]({},_0x4077b8,_0x9e8d90['options']);return db['UserFaxQueue'][_0x75c1('0x4a')](_0x4077b8);}})[_0x75c1('0x2d')](function(_0x301d9f){if(_0x301d9f){return db[_0x75c1('0x5e')]['findAndCountAll']({'where':{'id':_['map'](_0x301d9f,_0x75c1('0x5f')),'role':'agent'},'attributes':['id',_0x75c1('0x30'),_0x75c1('0x60'),'updatedAt',_0x75c1('0x61')]});}})['then'](function(_0xc3e5c6){if(_0xc3e5c6){return{'count':_0xc3e5c6[_0x75c1('0x28')],'rows':_[_0x75c1('0x32')](_0xc3e5c6['rows'],function(_0x388309){return{'membername':_0x388309[_0x75c1('0x30')],'UserId':_0x388309['id'],'queue_name':_0x559a5e['name'],'FaxQueueId':_0x559a5e['id'],'interface':util[_0x75c1('0x62')](_0x75c1('0x63'),_0x75c1('0x64'),_0x388309[_0x75c1('0x30')]),'penalty':0x0,'paused':_0x388309[_0x75c1('0x60')],'createdAt':_0x388309[_0x75c1('0x61')],'updatedAt':_0x388309['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x75c1('0x2d')](respondWithFilteredResult(_0xe3eb2c,_0x4077b8))[_0x75c1('0x4b')](handleError(_0xe3eb2c,null));};exports[_0x75c1('0x65')]=function(_0x155bef,_0x59024e,_0x242e45){var _0x2701ae={};var _0x526180={};var _0x411a25;var _0x28f7d1;return db[_0x75c1('0x47')][_0x75c1('0x5b')]({'where':{'id':_0x155bef[_0x75c1('0x58')]['id']}})[_0x75c1('0x2d')](handleEntityNotFound(_0x59024e,null))[_0x75c1('0x2d')](function(_0xd54808){if(_0xd54808){_0x411a25=_0xd54808;_0x526180['model']=_['keys'](db[_0x75c1('0x66')][_0x75c1('0x33')]);_0x526180['query']=_[_0x75c1('0x39')](_0x155bef[_0x75c1('0x38')]);_0x526180[_0x75c1('0x3a')]=_[_0x75c1('0x3b')](_0x526180[_0x75c1('0x37')],_0x526180[_0x75c1('0x38')]);_0x2701ae[_0x75c1('0x4c')]=_[_0x75c1('0x3b')](_0x526180[_0x75c1('0x37')],qs['fields'](_0x155bef[_0x75c1('0x38')]['fields']));_0x2701ae[_0x75c1('0x4c')]=_0x2701ae[_0x75c1('0x4c')][_0x75c1('0x4d')]?_0x2701ae[_0x75c1('0x4c')]:_0x526180['model'];_0x2701ae[_0x75c1('0x3f')]=qs['sort'](_0x155bef['query'][_0x75c1('0x40')]);_0x2701ae[_0x75c1('0x43')]=qs[_0x75c1('0x3a')](_[_0x75c1('0x41')](_0x155bef[_0x75c1('0x38')],_0x526180[_0x75c1('0x3a')]));if(_0x155bef[_0x75c1('0x38')][_0x75c1('0x42')]){_0x2701ae[_0x75c1('0x43')]=_[_0x75c1('0x44')](_0x2701ae[_0x75c1('0x43')],{'$or':_[_0x75c1('0x32')](_0x2701ae[_0x75c1('0x4c')],function(_0x2c3871){var _0x20f0fd={};_0x20f0fd[_0x2c3871]={'$like':'%'+_0x155bef['query'][_0x75c1('0x42')]+'%'};return _0x20f0fd;})});}_0x2701ae=_[_0x75c1('0x44')]({},_0x2701ae,_0x155bef[_0x75c1('0x46')]);return _0x411a25['getTeams'](_0x2701ae);}})[_0x75c1('0x2d')](function(_0x43e2b7){if(_0x43e2b7){_0x28f7d1=_0x43e2b7[_0x75c1('0x4d')];if(!_0x155bef['query'][_0x75c1('0x3d')](_0x75c1('0x3e'))){_0x2701ae[_0x75c1('0x26')]=qs[_0x75c1('0x26')](_0x155bef[_0x75c1('0x38')][_0x75c1('0x26')]);_0x2701ae['offset']=qs[_0x75c1('0x25')](_0x155bef[_0x75c1('0x38')][_0x75c1('0x25')]);}return _0x411a25[_0x75c1('0x65')](_0x2701ae);}})['then'](function(_0x3d38f3){if(_0x3d38f3){return _0x3d38f3?{'count':_0x28f7d1,'rows':_0x3d38f3}:null;}})[_0x75c1('0x2d')](respondWithResult(_0x59024e,null))[_0x75c1('0x4b')](handleError(_0x59024e,null));};exports[_0x75c1('0x67')]=function(_0x10db73,_0x5a5e54,_0x415fba){var _0x311e2c=_0x10db73[_0x75c1('0x57')][_0x75c1('0x68')];return db['Team'][_0x75c1('0x4a')]({'where':{'id':_0x311e2c},'attributes':['id'],'include':[{'model':db[_0x75c1('0x5e')],'as':_0x75c1('0x69'),'attributes':['id','name',_0x75c1('0x6a'),_0x75c1('0x6b'),_0x75c1('0x6c')],'raw':!![]}]})[_0x75c1('0x2d')](function(_0x16a940){if(_0x16a940){var _0x2b8846=_['flatMap'](_0x16a940,function(_0x4b9092){var _0x7bfe19=_0x4b9092[_0x75c1('0x2e')]({'plain':!![]});return _0x7bfe19['Agents'];});return db['FaxQueue'][_0x75c1('0x4e')]({'where':{'id':_0x10db73[_0x75c1('0x58')]['id']}})['then'](function(_0x5385e3){return db[_0x75c1('0x6d')]['transaction'](function(_0x412b34){return _0x5385e3['addTeams'](_0x311e2c,{'transaction':_0x412b34})['then'](function(){return BPromise[_0x75c1('0x6e')](_0x2b8846,function(_0x1d4f45){return db[_0x75c1('0x5c')][_0x75c1('0x6f')]({'where':{'UserId':_0x1d4f45['id'],'FaxQueueId':_0x10db73[_0x75c1('0x58')]['id']},'transaction':_0x412b34});});})[_0x75c1('0x2d')](function(){_0x2b8846['forEach'](function(_0xb82c89){socket[_0x75c1('0x70')](_0x75c1('0x71'),{'UserId':_0xb82c89['id'],'FaxQueueId':_0x5385e3['id']});});});});});}})[_0x75c1('0x2d')](respondWithStatusCode(_0x5a5e54,null))[_0x75c1('0x4b')](handleError(_0x5a5e54,null));};exports['removeTeams']=function(_0x112f18,_0x4b6ea8,_0x2d36e7){return db[_0x75c1('0x66')][_0x75c1('0x4a')]({'where':{'id':_0x112f18[_0x75c1('0x38')][_0x75c1('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x75c1('0x69'),'attributes':['id'],'raw':!![]}]})[_0x75c1('0x2d')](handleEntityNotFound(_0x4b6ea8,null))[_0x75c1('0x2d')](function(_0x1c422a){var _0x17e4b7=_[_0x75c1('0x32')](_0x1c422a,'id');var _0x5583a5=[];var _0x342e2c=[];var _0xc7fbf2=squel['select']();_0xc7fbf2[_0x75c1('0x72')]('tq.TeamId')[_0x75c1('0x73')](_0x75c1('0x74'),'tq')[_0x75c1('0x75')](_0x75c1('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x75c1('0x43')](_0x75c1('0x77'),_0x112f18['params']['id']);for(var _0x331a0e=0x0;_0x331a0e<_0x1c422a[_0x75c1('0x4d')];_0x331a0e+=0x1){let _0x4ceab3=_0x1c422a[_0x331a0e];for(var _0x2ed46a=0x0;_0x2ed46a<_0x4ceab3['Agents'][_0x75c1('0x4d')];_0x2ed46a+=0x1){let _0x624eed=_0x4ceab3[_0x75c1('0x69')][_0x2ed46a];var _0x3a135d=_0xc7fbf2[_0x75c1('0x78')]();_0x3a135d['where'](_0x75c1('0x79'),_0x624eed['id']);_0x342e2c['push'](db['sequelize'][_0x75c1('0x38')](_0x3a135d['toString'](),{'type':db[_0x75c1('0x6d')][_0x75c1('0x7a')][_0x75c1('0x7b')]})[_0x75c1('0x2d')](function(_0x51049a){if(_0x51049a['length']===0x1){return _0x624eed['id'];}else{var _0x94449b=_[_0x75c1('0x7c')](_[_0x75c1('0x32')](_0x51049a,'TeamId'),function(_0x3d2d57){return _['includes'](_0x17e4b7,_0x3d2d57);});if(_0x94449b){return _0x624eed['id'];}}}));}}return BPromise[_0x75c1('0x7d')](_0x342e2c)[_0x75c1('0x2d')](function(_0x561752){_0x5583a5=_(_0x5583a5)[_0x75c1('0x7e')](_0x561752)['compact']()['value']();return db[_0x75c1('0x47')][_0x75c1('0x4e')]({'where':{'id':_0x112f18[_0x75c1('0x58')]['id']}})[_0x75c1('0x2d')](function(_0x55ba31){return db[_0x75c1('0x6d')]['transaction'](function(_0x1815a0){return _0x55ba31[_0x75c1('0x7f')](_0x112f18[_0x75c1('0x38')][_0x75c1('0x68')],{'transaction':_0x1815a0})[_0x75c1('0x2d')](function(){if(!_['isEmpty'](_0x5583a5)){return _0x55ba31[_0x75c1('0x80')](_0x5583a5,{'transaction':_0x1815a0});}})[_0x75c1('0x2d')](function(){_0x5583a5[_0x75c1('0x81')](function(_0x1bd5de){socket[_0x75c1('0x70')](_0x75c1('0x82'),{'UserId':_0x1bd5de,'FaxQueueId':_0x55ba31['id']});});});});});});})['then'](respondWithStatusCode(_0x4b6ea8,null))['catch'](handleError(_0x4b6ea8,null));};exports['addAgents']=function(_0x45bd19,_0x38b95e,_0x428015){return db['FaxQueue'][_0x75c1('0x4e')]({'where':{'id':_0x45bd19[_0x75c1('0x58')]['id']}})['then'](handleEntityNotFound(_0x38b95e,null))['then'](function(_0xaf5b33){if(_0xaf5b33){return _0xaf5b33['addAgents'](_0x45bd19[_0x75c1('0x57')][_0x75c1('0x68')],_[_0x75c1('0x83')](_0x45bd19[_0x75c1('0x57')],[_0x75c1('0x68'),'id'])||{})[_0x75c1('0x84')](function(_0x860498){for(var _0x17948c=0x0;_0x17948c<_0x45bd19['body'][_0x75c1('0x68')][_0x75c1('0x4d')];_0x17948c+=0x1){socket[_0x75c1('0x70')](_0x75c1('0x71'),{'UserId':Number(_0x45bd19['body']['ids'][_0x17948c]),'FaxQueueId':Number(_0x45bd19[_0x75c1('0x58')]['id'])});}return _0x860498;});}})['then'](respondWithResult(_0x38b95e,null))[_0x75c1('0x4b')](handleError(_0x38b95e,null));};exports[_0x75c1('0x80')]=function(_0x53c70f,_0x39bbd3,_0xead42a){return db[_0x75c1('0x47')][_0x75c1('0x4e')]({'where':{'id':_0x53c70f['params']['id']}})[_0x75c1('0x2d')](handleEntityNotFound(_0x39bbd3,null))['then'](function(_0x4e0fdb){if(_0x4e0fdb){return _0x4e0fdb[_0x75c1('0x80')](_0x53c70f[_0x75c1('0x38')][_0x75c1('0x68')])[_0x75c1('0x2d')](function(){if(_[_0x75c1('0x85')](_0x53c70f[_0x75c1('0x38')][_0x75c1('0x68')])){for(var _0x4ae17b=0x0;_0x4ae17b<_0x53c70f['query'][_0x75c1('0x68')][_0x75c1('0x4d')];_0x4ae17b+=0x1){socket[_0x75c1('0x70')](_0x75c1('0x82'),{'UserId':Number(_0x53c70f[_0x75c1('0x38')]['ids'][_0x4ae17b]),'FaxQueueId':Number(_0x53c70f[_0x75c1('0x58')]['id'])});}}else{socket[_0x75c1('0x70')]('userFaxQueue:remove',{'UserId':Number(_0x53c70f[_0x75c1('0x38')][_0x75c1('0x68')]),'FaxQueueId':Number(_0x53c70f[_0x75c1('0x58')]['id'])});}});}})[_0x75c1('0x2d')](respondWithStatusCode(_0x39bbd3,null))[_0x75c1('0x4b')](handleError(_0x39bbd3,null));};exports[_0x75c1('0x86')]=function(_0x1b5492,_0xccb4b0,_0x2ce61b){var _0x67075c={};var _0x16e4b7={};var _0x29f257;var _0x359cee;return db['FaxQueue']['findOne']({'where':{'id':_0x1b5492[_0x75c1('0x58')]['id']}})['then'](handleEntityNotFound(_0xccb4b0,null))[_0x75c1('0x2d')](function(_0x432c3c){if(_0x432c3c){_0x29f257=_0x432c3c;_0x16e4b7[_0x75c1('0x37')]=_['keys'](db[_0x75c1('0x5e')][_0x75c1('0x33')]);_0x16e4b7[_0x75c1('0x38')]=_[_0x75c1('0x39')](_0x1b5492['query']);_0x16e4b7[_0x75c1('0x3a')]=_[_0x75c1('0x3b')](_0x16e4b7[_0x75c1('0x37')],_0x16e4b7[_0x75c1('0x38')]);_0x67075c[_0x75c1('0x4c')]=_[_0x75c1('0x3b')](_0x16e4b7[_0x75c1('0x37')],qs[_0x75c1('0x3c')](_0x1b5492[_0x75c1('0x38')][_0x75c1('0x3c')]));_0x67075c[_0x75c1('0x4c')]=_0x67075c[_0x75c1('0x4c')][_0x75c1('0x4d')]?_0x67075c[_0x75c1('0x4c')]:_0x16e4b7[_0x75c1('0x37')];_0x67075c[_0x75c1('0x3f')]=qs[_0x75c1('0x40')](_0x1b5492[_0x75c1('0x38')][_0x75c1('0x40')]);_0x67075c[_0x75c1('0x43')]=qs[_0x75c1('0x3a')](_[_0x75c1('0x41')](_0x1b5492[_0x75c1('0x38')],_0x16e4b7[_0x75c1('0x3a')]));if(_0x1b5492[_0x75c1('0x38')][_0x75c1('0x42')]){_0x67075c['where']=_[_0x75c1('0x44')](_0x67075c[_0x75c1('0x43')],{'$or':_[_0x75c1('0x32')](_0x67075c[_0x75c1('0x4c')],function(_0x27038f){var _0x4b4f77={};_0x4b4f77[_0x27038f]={'$like':'%'+_0x1b5492[_0x75c1('0x38')][_0x75c1('0x42')]+'%'};return _0x4b4f77;})});}_0x67075c=_['merge']({},_0x67075c,_0x1b5492[_0x75c1('0x46')]);return _0x29f257['getAgents'](_0x67075c);}})[_0x75c1('0x2d')](function(_0x2f19f8){if(_0x2f19f8){_0x359cee=_0x2f19f8[_0x75c1('0x4d')];if(!_0x1b5492[_0x75c1('0x38')]['hasOwnProperty'](_0x75c1('0x3e'))){_0x67075c[_0x75c1('0x26')]=qs[_0x75c1('0x26')](_0x1b5492[_0x75c1('0x38')][_0x75c1('0x26')]);_0x67075c[_0x75c1('0x25')]=qs[_0x75c1('0x25')](_0x1b5492['query'][_0x75c1('0x25')]);}return _0x29f257['getAgents'](_0x67075c);}})['then'](function(_0x475743){if(_0x475743){return _0x475743?{'count':_0x359cee,'rows':_0x475743}:null;}})[_0x75c1('0x2d')](respondWithResult(_0xccb4b0,null))[_0x75c1('0x4b')](handleError(_0xccb4b0,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index ab1418b..c85eb05 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 _0x68b9=['exports','save','remove','emit','hasOwnProperty'];(function(_0x1b1b68,_0x2e8007){var _0x4dc185=function(_0x3b7587){while(--_0x3b7587){_0x1b1b68['push'](_0x1b1b68['shift']());}};_0x4dc185(++_0x2e8007);}(_0x68b9,0x187));var _0x968b=function(_0x4f3f71,_0x1e35ce){_0x4f3f71=_0x4f3f71-0x0;var _0x559c25=_0x68b9[_0x4f3f71];return _0x559c25;};'use strict';var EventEmitter=require('events');var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x968b('0x0'),'afterUpdate':'update','afterDestroy':_0x968b('0x1')};function emitEvent(_0x5e3bca){return function(_0x5d3548,_0x53ee0e,_0x3fdacb){FaxQueueEvents['emit'](_0x5e3bca+':'+_0x5d3548['id'],_0x5d3548);FaxQueueEvents[_0x968b('0x2')](_0x5e3bca,_0x5d3548);_0x3fdacb(null);};}for(var e in events){if(events[_0x968b('0x3')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x968b('0x4')]=FaxQueueEvents; \ No newline at end of file +var _0x1a69=['hasOwnProperty','hook','exports','../../mysqldb','FaxQueue','setMaxListeners','update','remove','emit'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0x1a69,0xc9));var _0x91a6=function(_0x34ffa3,_0x18d78d){_0x34ffa3=_0x34ffa3-0x0;var _0xafb565=_0x1a69[_0x34ffa3];return _0xafb565;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x91a6('0x0'))['db'][_0x91a6('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x91a6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x91a6('0x3'),'afterDestroy':_0x91a6('0x4')};function emitEvent(_0x4b6e18){return function(_0x190004,_0x24e1ec,_0x3b6ffc){FaxQueueEvents[_0x91a6('0x5')](_0x4b6e18+':'+_0x190004['id'],_0x190004);FaxQueueEvents[_0x91a6('0x5')](_0x4b6e18,_0x190004);_0x3b6ffc(null);};}for(var e in events){if(events[_0x91a6('0x6')](e)){var event=events[e];FaxQueue[_0x91a6('0x7')](e,emitEvent(event));}}module[_0x91a6('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 3d278f9..fb8f216 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 _0xf432=['path','rimraf','../../config/environment','./faxQueue.attributes','define','fax_queues','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3e6906,_0x3979f){var _0x5a5194=function(_0x16baff){while(--_0x16baff){_0x3e6906['push'](_0x3e6906['shift']());}};_0x5a5194(++_0x3979f);}(_0xf432,0x187));var _0x2f43=function(_0x21d0e6,_0x5a7aa6){_0x21d0e6=_0x21d0e6-0x0;var _0x1cc2d1=_0xf432[_0x21d0e6];return _0x1cc2d1;};'use strict';var _=require('lodash');var util=require(_0x2f43('0x0'));var logger=require(_0x2f43('0x1'))('api');var moment=require(_0x2f43('0x2'));var BPromise=require(_0x2f43('0x3'));var rp=require(_0x2f43('0x4'));var fs=require('fs');var path=require(_0x2f43('0x5'));var rimraf=require(_0x2f43('0x6'));var config=require(_0x2f43('0x7'));var attributes=require(_0x2f43('0x8'));module['exports']=function(_0x54ceac,_0x4e343a){return _0x54ceac[_0x2f43('0x9')]('FaxQueue',attributes,{'tableName':_0x2f43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e56=['define','FaxQueue','util','api','moment','request-promise','path','../../config/environment','./faxQueue.attributes','exports'];(function(_0x4b8b80,_0x474380){var _0x7b93f1=function(_0x1292ef){while(--_0x1292ef){_0x4b8b80['push'](_0x4b8b80['shift']());}};_0x7b93f1(++_0x474380);}(_0x4e56,0xa2));var _0x64e5=function(_0x35c86f,_0x399bc4){_0x35c86f=_0x35c86f-0x0;var _0x28c841=_0x4e56[_0x35c86f];return _0x28c841;};'use strict';var _=require('lodash');var util=require(_0x64e5('0x0'));var logger=require('../../config/logger')(_0x64e5('0x1'));var moment=require(_0x64e5('0x2'));var BPromise=require('bluebird');var rp=require(_0x64e5('0x3'));var fs=require('fs');var path=require(_0x64e5('0x4'));var rimraf=require('rimraf');var config=require(_0x64e5('0x5'));var attributes=require(_0x64e5('0x6'));module[_0x64e5('0x7')]=function(_0x5dd7e,_0x5180c1){return _0x5dd7e[_0x64e5('0x8')](_0x64e5('0x9'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 8d5f501..0d133d4 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 _0x4ef4=['http','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','model','map','ShowFaxQueue','find','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x402c8f,_0x30cc1d){var _0x11e809=function(_0x4ccfa3){while(--_0x4ccfa3){_0x402c8f['push'](_0x402c8f['shift']());}};_0x11e809(++_0x30cc1d);}(_0x4ef4,0x1ed));var _0x44ef=function(_0x5e429d,_0x2aad4e){_0x5e429d=_0x5e429d-0x0;var _0x2c962e=_0x4ef4[_0x5e429d];return _0x2c962e;};'use strict';var _=require(_0x44ef('0x0'));var util=require(_0x44ef('0x1'));var moment=require(_0x44ef('0x2'));var BPromise=require(_0x44ef('0x3'));var rs=require(_0x44ef('0x4'));var fs=require('fs');var Redis=require(_0x44ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x44ef('0x6'));var logger=require(_0x44ef('0x7'))('rpc');var config=require(_0x44ef('0x8'));var jayson=require(_0x44ef('0x9'));var client=jayson[_0x44ef('0xa')][_0x44ef('0xb')]({'port':0x232a});config[_0x44ef('0xc')]=_['defaults'](config[_0x44ef('0xc')],{'host':_0x44ef('0xd'),'port':0x18eb});var socket=require(_0x44ef('0xe'))(new Redis(config[_0x44ef('0xc')]));require(_0x44ef('0xf'))[_0x44ef('0x10')](socket);function respondWithRpcPromise(_0x38b7e4,_0x105168,_0x1ab205){return new BPromise(function(_0x392a65,_0x27462d){return client[_0x44ef('0x11')](_0x38b7e4,_0x1ab205)[_0x44ef('0x12')](function(_0x452ca5){logger['info'](_0x44ef('0x13'),_0x105168,'request\x20sent');logger[_0x44ef('0x14')](_0x44ef('0x15'),_0x105168,_0x44ef('0x16'),JSON[_0x44ef('0x17')](_0x452ca5));if(_0x452ca5[_0x44ef('0x18')]){if(_0x452ca5[_0x44ef('0x18')]['code']===0x1f4){logger[_0x44ef('0x18')](_0x44ef('0x13'),_0x105168,_0x452ca5[_0x44ef('0x18')][_0x44ef('0x19')]);return _0x27462d(_0x452ca5['error'][_0x44ef('0x19')]);}logger['error'](_0x44ef('0x13'),_0x105168,_0x452ca5['error'][_0x44ef('0x19')]);return _0x392a65(_0x452ca5[_0x44ef('0x18')][_0x44ef('0x19')]);}else{logger[_0x44ef('0x1a')](_0x44ef('0x13'),_0x105168,_0x44ef('0x16'));_0x392a65(_0x452ca5[_0x44ef('0x1b')][_0x44ef('0x19')]);}})['catch'](function(_0x46249e){logger[_0x44ef('0x18')](_0x44ef('0x13'),_0x105168,_0x46249e);_0x27462d(_0x46249e);});});}exports[_0x44ef('0x1c')]=function(_0x30ad13){var _0x112218=this;return new Promise(function(_0x141ed6,_0x1f5593){return db[_0x44ef('0x1d')][_0x44ef('0x1e')]({'raw':_0x30ad13[_0x44ef('0x1f')]?_0x30ad13['options'][_0x44ef('0x20')]===undefined?!![]:![]:!![],'where':_0x30ad13[_0x44ef('0x1f')]?_0x30ad13[_0x44ef('0x1f')][_0x44ef('0x21')]||null:null,'attributes':_0x30ad13[_0x44ef('0x1f')]?_0x30ad13['options'][_0x44ef('0x22')]||null:null,'limit':_0x30ad13['options']?_0x30ad13[_0x44ef('0x1f')][_0x44ef('0x23')]||null:null,'include':_0x30ad13[_0x44ef('0x1f')]?_0x30ad13['options']['include']?_['map'](_0x30ad13[_0x44ef('0x1f')][_0x44ef('0x24')],function(_0x4a2341){return{'model':db[_0x4a2341[_0x44ef('0x25')]],'as':_0x4a2341['as'],'attributes':_0x4a2341[_0x44ef('0x22')],'include':_0x4a2341[_0x44ef('0x24')]?_['map'](_0x4a2341[_0x44ef('0x24')],function(_0x46e802){return{'model':db[_0x46e802[_0x44ef('0x25')]],'as':_0x46e802['as'],'attributes':_0x46e802[_0x44ef('0x22')],'include':_0x46e802[_0x44ef('0x24')]?_[_0x44ef('0x26')](_0x46e802[_0x44ef('0x24')],function(_0x4da2d4){return{'model':db[_0x4da2d4[_0x44ef('0x25')]],'as':_0x4da2d4['as'],'attributes':_0x4da2d4['attributes']};}):[]};}):[]};}):[]:[]})[_0x44ef('0x12')](function(_0x3862db){logger[_0x44ef('0x1a')]('GetFaxQueue',_0x30ad13);logger[_0x44ef('0x14')](_0x44ef('0x1c'),_0x30ad13,JSON['stringify'](_0x3862db));_0x141ed6(_0x3862db);})['catch'](function(_0x2953e1){logger[_0x44ef('0x18')](_0x44ef('0x1c'),_0x2953e1['message'],_0x30ad13);_0x1f5593(_0x112218[_0x44ef('0x18')](0x1f4,_0x2953e1[_0x44ef('0x19')]));});});};exports[_0x44ef('0x27')]=function(_0x5b5305){var _0x19c31d=this;return new Promise(function(_0x353a54,_0x5af3c7){return db[_0x44ef('0x1d')][_0x44ef('0x28')]({'raw':_0x5b5305[_0x44ef('0x1f')]?_0x5b5305[_0x44ef('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x5b5305[_0x44ef('0x1f')]?_0x5b5305[_0x44ef('0x1f')][_0x44ef('0x21')]||null:null,'attributes':_0x5b5305[_0x44ef('0x1f')]?_0x5b5305['options'][_0x44ef('0x22')]||null:null,'include':_0x5b5305[_0x44ef('0x1f')]?_0x5b5305[_0x44ef('0x1f')][_0x44ef('0x24')]?_[_0x44ef('0x26')](_0x5b5305['options']['include'],function(_0x301b65){return{'model':db[_0x301b65[_0x44ef('0x25')]],'as':_0x301b65['as'],'attributes':_0x301b65[_0x44ef('0x22')],'include':_0x301b65[_0x44ef('0x24')]?_[_0x44ef('0x26')](_0x301b65[_0x44ef('0x24')],function(_0x951af6){return{'model':db[_0x951af6[_0x44ef('0x25')]],'as':_0x951af6['as'],'attributes':_0x951af6[_0x44ef('0x22')],'include':_0x951af6[_0x44ef('0x24')]?_[_0x44ef('0x26')](_0x951af6[_0x44ef('0x24')],function(_0x362e87){return{'model':db[_0x362e87[_0x44ef('0x25')]],'as':_0x362e87['as'],'attributes':_0x362e87[_0x44ef('0x22')]};}):[]};}):[]};}):[]:[]})[_0x44ef('0x12')](function(_0xdb515f){logger[_0x44ef('0x1a')](_0x44ef('0x27'),_0x5b5305);logger['debug'](_0x44ef('0x27'),_0x5b5305,JSON[_0x44ef('0x17')](_0xdb515f));_0x353a54(_0xdb515f);})[_0x44ef('0x29')](function(_0x2082a8){logger[_0x44ef('0x18')](_0x44ef('0x27'),_0x2082a8[_0x44ef('0x19')],_0x5b5305);_0x5af3c7(_0x19c31d[_0x44ef('0x18')](0x1f4,_0x2082a8[_0x44ef('0x19')]));});});}; \ No newline at end of file +var _0x7e5f=['localhost','socket.io-emitter','./faxQueue.socket','register','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','model','map','find','ShowFaxQueue','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis'];(function(_0x48adbc,_0x2fbff8){var _0x60fe7e=function(_0x599ef7){while(--_0x599ef7){_0x48adbc['push'](_0x48adbc['shift']());}};_0x60fe7e(++_0x2fbff8);}(_0x7e5f,0x1d5));var _0xf7e5=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x7e5f[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0xf7e5('0x0'));var util=require('util');var moment=require(_0xf7e5('0x1'));var BPromise=require(_0xf7e5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf7e5('0x3'));var db=require(_0xf7e5('0x4'))['db'];var utils=require(_0xf7e5('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf7e5('0x6'));var jayson=require(_0xf7e5('0x7'));var client=jayson[_0xf7e5('0x8')][_0xf7e5('0x9')]({'port':0x232a});config[_0xf7e5('0xa')]=_['defaults'](config[_0xf7e5('0xa')],{'host':_0xf7e5('0xb'),'port':0x18eb});var socket=require(_0xf7e5('0xc'))(new Redis(config[_0xf7e5('0xa')]));require(_0xf7e5('0xd'))[_0xf7e5('0xe')](socket);function respondWithRpcPromise(_0x355c4a,_0x21c77c,_0x4902bc){return new BPromise(function(_0x4fa06d,_0xf5ee75){return client['request'](_0x355c4a,_0x4902bc)[_0xf7e5('0xf')](function(_0x52b709){logger[_0xf7e5('0x10')]('FaxQueue,\x20%s,\x20%s',_0x21c77c,_0xf7e5('0x11'));logger[_0xf7e5('0x12')](_0xf7e5('0x13'),_0x21c77c,_0xf7e5('0x11'),JSON[_0xf7e5('0x14')](_0x52b709));if(_0x52b709[_0xf7e5('0x15')]){if(_0x52b709[_0xf7e5('0x15')][_0xf7e5('0x16')]===0x1f4){logger['error'](_0xf7e5('0x17'),_0x21c77c,_0x52b709[_0xf7e5('0x15')][_0xf7e5('0x18')]);return _0xf5ee75(_0x52b709[_0xf7e5('0x15')]['message']);}logger['error']('FaxQueue,\x20%s,\x20%s',_0x21c77c,_0x52b709['error']['message']);return _0x4fa06d(_0x52b709[_0xf7e5('0x15')][_0xf7e5('0x18')]);}else{logger[_0xf7e5('0x10')](_0xf7e5('0x17'),_0x21c77c,_0xf7e5('0x11'));_0x4fa06d(_0x52b709[_0xf7e5('0x19')][_0xf7e5('0x18')]);}})[_0xf7e5('0x1a')](function(_0x486bce){logger['error']('FaxQueue,\x20%s,\x20%s',_0x21c77c,_0x486bce);_0xf5ee75(_0x486bce);});});}exports[_0xf7e5('0x1b')]=function(_0x475b10){var _0x52e534=this;return new Promise(function(_0x44538c,_0x5f5104){return db[_0xf7e5('0x1c')][_0xf7e5('0x1d')]({'raw':_0x475b10['options']?_0x475b10[_0xf7e5('0x1e')][_0xf7e5('0x1f')]===undefined?!![]:![]:!![],'where':_0x475b10[_0xf7e5('0x1e')]?_0x475b10['options'][_0xf7e5('0x20')]||null:null,'attributes':_0x475b10['options']?_0x475b10['options'][_0xf7e5('0x21')]||null:null,'limit':_0x475b10[_0xf7e5('0x1e')]?_0x475b10[_0xf7e5('0x1e')][_0xf7e5('0x22')]||null:null,'include':_0x475b10[_0xf7e5('0x1e')]?_0x475b10[_0xf7e5('0x1e')]['include']?_['map'](_0x475b10['options'][_0xf7e5('0x23')],function(_0x6c5e41){return{'model':db[_0x6c5e41[_0xf7e5('0x24')]],'as':_0x6c5e41['as'],'attributes':_0x6c5e41[_0xf7e5('0x21')],'include':_0x6c5e41[_0xf7e5('0x23')]?_[_0xf7e5('0x25')](_0x6c5e41[_0xf7e5('0x23')],function(_0x20f496){return{'model':db[_0x20f496[_0xf7e5('0x24')]],'as':_0x20f496['as'],'attributes':_0x20f496[_0xf7e5('0x21')],'include':_0x20f496[_0xf7e5('0x23')]?_['map'](_0x20f496[_0xf7e5('0x23')],function(_0x241295){return{'model':db[_0x241295['model']],'as':_0x241295['as'],'attributes':_0x241295[_0xf7e5('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf7e5('0xf')](function(_0x17330f){logger[_0xf7e5('0x10')](_0xf7e5('0x1b'),_0x475b10);logger[_0xf7e5('0x12')]('GetFaxQueue',_0x475b10,JSON[_0xf7e5('0x14')](_0x17330f));_0x44538c(_0x17330f);})[_0xf7e5('0x1a')](function(_0x45e72c){logger[_0xf7e5('0x15')](_0xf7e5('0x1b'),_0x45e72c[_0xf7e5('0x18')],_0x475b10);_0x5f5104(_0x52e534[_0xf7e5('0x15')](0x1f4,_0x45e72c[_0xf7e5('0x18')]));});});};exports['ShowFaxQueue']=function(_0x151475){var _0x29f4e2=this;return new Promise(function(_0x8cae28,_0x31c621){return db[_0xf7e5('0x1c')][_0xf7e5('0x26')]({'raw':_0x151475[_0xf7e5('0x1e')]?_0x151475['options'][_0xf7e5('0x1f')]===undefined?!![]:![]:!![],'where':_0x151475['options']?_0x151475[_0xf7e5('0x1e')][_0xf7e5('0x20')]||null:null,'attributes':_0x151475[_0xf7e5('0x1e')]?_0x151475[_0xf7e5('0x1e')]['attributes']||null:null,'include':_0x151475[_0xf7e5('0x1e')]?_0x151475[_0xf7e5('0x1e')][_0xf7e5('0x23')]?_[_0xf7e5('0x25')](_0x151475[_0xf7e5('0x1e')]['include'],function(_0x1be62f){return{'model':db[_0x1be62f['model']],'as':_0x1be62f['as'],'attributes':_0x1be62f['attributes'],'include':_0x1be62f[_0xf7e5('0x23')]?_[_0xf7e5('0x25')](_0x1be62f[_0xf7e5('0x23')],function(_0x37d4c7){return{'model':db[_0x37d4c7[_0xf7e5('0x24')]],'as':_0x37d4c7['as'],'attributes':_0x37d4c7[_0xf7e5('0x21')],'include':_0x37d4c7[_0xf7e5('0x23')]?_[_0xf7e5('0x25')](_0x37d4c7[_0xf7e5('0x23')],function(_0x2fac3b){return{'model':db[_0x2fac3b[_0xf7e5('0x24')]],'as':_0x2fac3b['as'],'attributes':_0x2fac3b[_0xf7e5('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf7e5('0xf')](function(_0x186310){logger[_0xf7e5('0x10')](_0xf7e5('0x27'),_0x151475);logger[_0xf7e5('0x12')]('ShowFaxQueue',_0x151475,JSON[_0xf7e5('0x14')](_0x186310));_0x8cae28(_0x186310);})[_0xf7e5('0x1a')](function(_0x5bcc16){logger[_0xf7e5('0x15')](_0xf7e5('0x27'),_0x5bcc16['message'],_0x151475);_0x31c621(_0x29f4e2[_0xf7e5('0x15')](0x1f4,_0x5bcc16[_0xf7e5('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 667eb2b..507022e 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 _0xb5a3=['./faxQueue.events','remove','update','emit','register','length','faxQueue:'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0xb5a3,0x93));var _0x3b5a=function(_0xe1b5f6,_0x210c09){_0xe1b5f6=_0xe1b5f6-0x0;var _0x44636e=_0xb5a3[_0xe1b5f6];return _0x44636e;};'use strict';var FaxQueueEvents=require(_0x3b5a('0x0'));var events=['save',_0x3b5a('0x1'),_0x3b5a('0x2')];function createListener(_0xd618b1,_0x2d628f){return function(_0xb1ea71){_0x2d628f[_0x3b5a('0x3')](_0xd618b1,_0xb1ea71);};}function removeListener(_0x4c00ef,_0xcbceb1){return function(){FaxQueueEvents['removeListener'](_0x4c00ef,_0xcbceb1);};}exports[_0x3b5a('0x4')]=function(_0x493153){for(var _0x282b0f=0x0,_0xff57a9=events[_0x3b5a('0x5')];_0x282b0f<_0xff57a9;_0x282b0f++){var _0x4ad8a4=events[_0x282b0f];var _0x2d1158=createListener(_0x3b5a('0x6')+_0x4ad8a4,_0x493153);FaxQueueEvents['on'](_0x4ad8a4,_0x2d1158);}}; \ No newline at end of file +var _0x7126=['faxQueue:','./faxQueue.events','save','remove','update','removeListener','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7126,0xb9));var _0x6712=function(_0x58ec58,_0x474a4c){_0x58ec58=_0x58ec58-0x0;var _0xd19910=_0x7126[_0x58ec58];return _0xd19910;};'use strict';var FaxQueueEvents=require(_0x6712('0x0'));var events=[_0x6712('0x1'),_0x6712('0x2'),_0x6712('0x3')];function createListener(_0x255baa,_0x4bb5b0){return function(_0x5f0c1f){_0x4bb5b0['emit'](_0x255baa,_0x5f0c1f);};}function removeListener(_0xfc25b0,_0x576e75){return function(){FaxQueueEvents[_0x6712('0x4')](_0xfc25b0,_0x576e75);};}exports[_0x6712('0x5')]=function(_0x299ec4){for(var _0x1edbda=0x0,_0x411392=events[_0x6712('0x6')];_0x1edbda<_0x411392;_0x1edbda++){var _0x43f9e8=events[_0x1edbda];var _0x1a0cd8=createListener(_0x6712('0x7')+_0x43f9e8,_0x299ec4);FaxQueueEvents['on'](_0x43f9e8,_0x1a0cd8);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index c7a158d..970468d 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 _0x5d58=['put','update','delete','destroy','removeTeams','removeAgents','exports','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams'];(function(_0x310fe7,_0x447a9d){var _0x29db45=function(_0x2d98a8){while(--_0x2d98a8){_0x310fe7['push'](_0x310fe7['shift']());}};_0x29db45(++_0x447a9d);}(_0x5d58,0x187));var _0x85d5=function(_0x543c6e,_0x136002){_0x543c6e=_0x543c6e-0x0;var _0x2a5959=_0x5d58[_0x543c6e];return _0x2a5959;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x85d5('0x0')]();var fs_extra=require(_0x85d5('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x85d5('0x2'));var config=require(_0x85d5('0x3'));var controller=require('./faxQueue.controller');router[_0x85d5('0x4')]('/',auth[_0x85d5('0x5')](),controller[_0x85d5('0x6')]);router[_0x85d5('0x4')]('/describe',auth[_0x85d5('0x5')](),controller[_0x85d5('0x7')]);router['get'](_0x85d5('0x8'),auth['isAuthenticated'](),controller[_0x85d5('0x9')]);router[_0x85d5('0x4')](_0x85d5('0xa'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0x85d5('0xb'),auth[_0x85d5('0x5')](),controller[_0x85d5('0xc')]);router[_0x85d5('0x4')](_0x85d5('0xd'),auth[_0x85d5('0x5')](),controller[_0x85d5('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x85d5('0xf')](_0x85d5('0xb'),auth[_0x85d5('0x5')](),controller[_0x85d5('0x10')]);router[_0x85d5('0xf')](_0x85d5('0xd'),auth[_0x85d5('0x5')](),controller['addAgents']);router[_0x85d5('0x11')](_0x85d5('0x8'),auth[_0x85d5('0x5')](),controller[_0x85d5('0x12')]);router[_0x85d5('0x13')](_0x85d5('0x8'),auth[_0x85d5('0x5')](),controller[_0x85d5('0x14')]);router[_0x85d5('0x13')](_0x85d5('0xb'),auth[_0x85d5('0x5')](),controller[_0x85d5('0x15')]);router[_0x85d5('0x13')](_0x85d5('0xd'),auth[_0x85d5('0x5')](),controller[_0x85d5('0x16')]);module[_0x85d5('0x17')]=router; \ No newline at end of file +var _0xaf1b=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getTeams','/:id/users','getAgents','create','post','/:id/teams','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router'];(function(_0x50fea0,_0x30d45d){var _0x228021=function(_0x3de6fe){while(--_0x3de6fe){_0x50fea0['push'](_0x50fea0['shift']());}};_0x228021(++_0x30d45d);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x80dc0,_0x3df64e){_0x80dc0=_0x80dc0-0x0;var _0x250d29=_0xaf1b[_0x80dc0];return _0x250d29;};'use strict';var multer=require(_0xbaf1('0x0'));var util=require(_0xbaf1('0x1'));var path=require(_0xbaf1('0x2'));var timeout=require(_0xbaf1('0x3'));var express=require(_0xbaf1('0x4'));var router=express[_0xbaf1('0x5')]();var fs_extra=require(_0xbaf1('0x6'));var auth=require(_0xbaf1('0x7'));var interaction=require(_0xbaf1('0x8'));var config=require(_0xbaf1('0x9'));var controller=require(_0xbaf1('0xa'));router[_0xbaf1('0xb')]('/',auth[_0xbaf1('0xc')](),controller[_0xbaf1('0xd')]);router['get'](_0xbaf1('0xe'),auth['isAuthenticated'](),controller[_0xbaf1('0xf')]);router['get'](_0xbaf1('0x10'),auth[_0xbaf1('0xc')](),controller[_0xbaf1('0x11')]);router['get'](_0xbaf1('0x12'),auth[_0xbaf1('0xc')](),controller['getMembers']);router[_0xbaf1('0xb')]('/:id/teams',auth[_0xbaf1('0xc')](),controller[_0xbaf1('0x13')]);router[_0xbaf1('0xb')](_0xbaf1('0x14'),auth[_0xbaf1('0xc')](),controller[_0xbaf1('0x15')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbaf1('0x16')]);router[_0xbaf1('0x17')](_0xbaf1('0x18'),auth[_0xbaf1('0xc')](),controller[_0xbaf1('0x19')]);router[_0xbaf1('0x17')](_0xbaf1('0x14'),auth['isAuthenticated'](),controller[_0xbaf1('0x1a')]);router[_0xbaf1('0x1b')](_0xbaf1('0x10'),auth[_0xbaf1('0xc')](),controller[_0xbaf1('0x1c')]);router[_0xbaf1('0x1d')](_0xbaf1('0x10'),auth[_0xbaf1('0xc')](),controller['destroy']);router[_0xbaf1('0x1d')]('/:id/teams',auth[_0xbaf1('0xc')](),controller[_0xbaf1('0x1e')]);router[_0xbaf1('0x1d')](_0xbaf1('0x14'),auth['isAuthenticated'](),controller[_0xbaf1('0x1f')]);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 da4c2d9..1c66bad 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 _0x7e06=['sequelize','exports','STRING','DATE'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x7e06,0x1b0));var _0x67e0=function(_0x447c76,_0x194561){_0x447c76=_0x447c76-0x0;var _0x42a959=_0x7e06[_0x447c76];return _0x42a959;};'use strict';var moment=require('moment');var Sequelize=require(_0x67e0('0x0'));module[_0x67e0('0x1')]={'uniqueid':{'type':Sequelize[_0x67e0('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x67e0('0x2')]},'joinAt':{'type':Sequelize[_0x67e0('0x3')]},'leaveAt':{'type':Sequelize[_0x67e0('0x3')]},'acceptAt':{'type':Sequelize[_0x67e0('0x3')]},'exitAt':{'type':Sequelize[_0x67e0('0x3')]},'reason':{'type':Sequelize[_0x67e0('0x2')]}}; \ No newline at end of file +var _0x4b2e=['STRING','DATE','exports'];(function(_0x134198,_0x3e8614){var _0x44fd50=function(_0x2683e6){while(--_0x2683e6){_0x134198['push'](_0x134198['shift']());}};_0x44fd50(++_0x3e8614);}(_0x4b2e,0xcb));var _0xe4b2=function(_0xe47c8b,_0x29aef7){_0xe47c8b=_0xe47c8b-0x0;var _0x39876e=_0x4b2e[_0xe47c8b];return _0x39876e;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xe4b2('0x0')]={'uniqueid':{'type':Sequelize[_0xe4b2('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xe4b2('0x1')]},'joinAt':{'type':Sequelize[_0xe4b2('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xe4b2('0x2')]},'exitAt':{'type':Sequelize[_0xe4b2('0x2')]},'reason':{'type':Sequelize[_0xe4b2('0x1')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 6d665ca..e1688d2 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 _0x8482=['count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','FaxQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','filter','merge','options','findAll','rows','show','length','includeAll','include','find','create','body','catch','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','undefined'];(function(_0x205df0,_0x3b8a15){var _0x14fe94=function(_0x4664f7){while(--_0x4664f7){_0x205df0['push'](_0x205df0['shift']());}};_0x14fe94(++_0x3b8a15);}(_0x8482,0x14e));var _0x2848=function(_0x2fede2,_0x24e0eb){_0x2fede2=_0x2fede2-0x0;var _0x59ce33=_0x8482[_0x2fede2];return _0x59ce33;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2848('0x0'));var zipdir=require(_0x2848('0x1'));var jsonpatch=require(_0x2848('0x2'));var rp=require(_0x2848('0x3'));var moment=require(_0x2848('0x4'));var BPromise=require(_0x2848('0x5'));var Mustache=require(_0x2848('0x6'));var util=require(_0x2848('0x7'));var path=require(_0x2848('0x8'));var sox=require(_0x2848('0x9'));var csv=require('to-csv');var ejs=require(_0x2848('0xa'));var fs=require('fs');var fs_extra=require(_0x2848('0xb'));var _=require('lodash');var squel=require(_0x2848('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2848('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2848('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2848('0xf'));var as=require(_0x2848('0x10'));var hardwareService=require(_0x2848('0x11'));var logger=require(_0x2848('0x12'))(_0x2848('0x13'));var utils=require(_0x2848('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2848('0x15'))['db'];function respondWithStatusCode(_0x465380,_0xf0658d){_0xf0658d=_0xf0658d||0xcc;return function(_0x566a0b){if(_0x566a0b){return _0x465380[_0x2848('0x16')](_0xf0658d);}return _0x465380[_0x2848('0x17')](_0xf0658d)[_0x2848('0x18')]();};}function respondWithResult(_0x5e64c7,_0xbddd26){_0xbddd26=_0xbddd26||0xc8;return function(_0x501a0e){if(_0x501a0e){return _0x5e64c7[_0x2848('0x17')](_0xbddd26)['json'](_0x501a0e);}};}function respondWithFilteredResult(_0x1002d2,_0xeba65b){return function(_0x6600c5){if(_0x6600c5){var _0x59f39a=typeof _0xeba65b['offset']==='undefined'&&typeof _0xeba65b['limit']===_0x2848('0x19');var _0x1acd41=_0x6600c5[_0x2848('0x1a')];var _0x46755c=_0x59f39a?0x0:_0xeba65b[_0x2848('0x1b')];var _0x3b4eeb=_0x59f39a?_0x6600c5[_0x2848('0x1a')]:_0xeba65b[_0x2848('0x1b')]+_0xeba65b[_0x2848('0x1c')];var _0x193ffa;if(_0x3b4eeb>=_0x1acd41){_0x3b4eeb=_0x1acd41;_0x193ffa=0xc8;}else{_0x193ffa=0xce;}_0x1002d2[_0x2848('0x17')](_0x193ffa);return _0x1002d2['set'](_0x2848('0x1d'),_0x46755c+'-'+_0x3b4eeb+'/'+_0x1acd41)[_0x2848('0x1e')](_0x6600c5);}return null;};}function patchUpdates(_0x1a1f79){return function(_0x5748ae){try{jsonpatch[_0x2848('0x1f')](_0x5748ae,_0x1a1f79,!![]);}catch(_0x1f67a7){return BPromise[_0x2848('0x20')](_0x1f67a7);}return _0x5748ae[_0x2848('0x21')]();};}function saveUpdates(_0x3b99a2,_0x555279){return function(_0x3dd7db){if(_0x3dd7db){return _0x3dd7db[_0x2848('0x22')](_0x3b99a2)[_0x2848('0x23')](function(_0x436709){return _0x436709;});}return null;};}function removeEntity(_0xea4128,_0x40f510){return function(_0x5f38e2){if(_0x5f38e2){return _0x5f38e2[_0x2848('0x24')]()['then'](function(){_0xea4128[_0x2848('0x17')](0xcc)[_0x2848('0x18')]();});}};}function handleEntityNotFound(_0x2d936a,_0x4517d3){return function(_0x51c924){if(!_0x51c924){_0x2d936a[_0x2848('0x16')](0x194);}return _0x51c924;};}function handleError(_0xecd4f4,_0xdba069){_0xdba069=_0xdba069||0x1f4;return function(_0x2dc32e){logger[_0x2848('0x25')](_0x2dc32e[_0x2848('0x26')]);if(_0x2dc32e[_0x2848('0x27')]){delete _0x2dc32e['name'];}_0xecd4f4['status'](_0xdba069)['send'](_0x2dc32e);};}exports[_0x2848('0x28')]=function(_0x18df37,_0x3b9c0d){var _0x3f915b={},_0x189701={},_0x528825={'count':0x0,'rows':[]};var _0x4c9685=_['map'](db[_0x2848('0x29')][_0x2848('0x2a')],function(_0x1ff601){return{'name':_0x1ff601[_0x2848('0x2b')],'type':_0x1ff601[_0x2848('0x2c')][_0x2848('0x2d')]};});_0x189701[_0x2848('0x2e')]=_[_0x2848('0x2f')](_0x4c9685,_0x2848('0x27'));_0x189701[_0x2848('0x30')]=_[_0x2848('0x31')](_0x18df37['query']);_0x189701[_0x2848('0x32')]=_[_0x2848('0x33')](_0x189701[_0x2848('0x2e')],_0x189701[_0x2848('0x30')]);_0x3f915b['attributes']=_[_0x2848('0x33')](_0x189701[_0x2848('0x2e')],qs[_0x2848('0x34')](_0x18df37[_0x2848('0x30')]['fields']));_0x3f915b['attributes']=_0x3f915b['attributes']['length']?_0x3f915b[_0x2848('0x35')]:_0x189701[_0x2848('0x2e')];if(!_0x18df37['query']['hasOwnProperty'](_0x2848('0x36'))){_0x3f915b[_0x2848('0x1c')]=qs[_0x2848('0x1c')](_0x18df37[_0x2848('0x30')][_0x2848('0x1c')]);_0x3f915b['offset']=qs[_0x2848('0x1b')](_0x18df37[_0x2848('0x30')][_0x2848('0x1b')]);}_0x3f915b['order']=qs[_0x2848('0x37')](_0x18df37[_0x2848('0x30')][_0x2848('0x37')]);_0x3f915b[_0x2848('0x38')]=qs[_0x2848('0x32')](_['pick'](_0x18df37['query'],_0x189701[_0x2848('0x32')]),_0x4c9685);if(_0x18df37[_0x2848('0x30')][_0x2848('0x39')]){_0x3f915b[_0x2848('0x38')]=_[_0x2848('0x3a')](_0x3f915b[_0x2848('0x38')],{'$or':_['map'](_0x4c9685,function(_0x489ed8){if(_0x489ed8['type']!=='VIRTUAL'){var _0x5c3d4e={};_0x5c3d4e[_0x489ed8[_0x2848('0x27')]]={'$like':'%'+_0x18df37['query'][_0x2848('0x39')]+'%'};return _0x5c3d4e;}})});}_0x3f915b=_['merge']({},_0x3f915b,_0x18df37[_0x2848('0x3b')]);var _0x24af01={'where':_0x3f915b[_0x2848('0x38')]};return db['FaxQueueReport'][_0x2848('0x1a')](_0x24af01)[_0x2848('0x23')](function(_0x368ef1){_0x528825[_0x2848('0x1a')]=_0x368ef1;if(_0x18df37[_0x2848('0x30')]['includeAll']){_0x3f915b['include']=[{'all':!![]}];}return db[_0x2848('0x29')][_0x2848('0x3c')](_0x3f915b);})[_0x2848('0x23')](function(_0xfe7e37){_0x528825[_0x2848('0x3d')]=_0xfe7e37;return _0x528825;})[_0x2848('0x23')](respondWithFilteredResult(_0x3b9c0d,_0x3f915b))['catch'](handleError(_0x3b9c0d,null));};exports[_0x2848('0x3e')]=function(_0x5ef41f,_0x3208f2){var _0x56d0fa={'raw':!![],'where':{'id':_0x5ef41f['params']['id']}},_0x32f51a={};_0x32f51a['model']=_['keys'](db['FaxQueueReport'][_0x2848('0x2a')]);_0x32f51a[_0x2848('0x30')]=_[_0x2848('0x31')](_0x5ef41f[_0x2848('0x30')]);_0x32f51a[_0x2848('0x32')]=_[_0x2848('0x33')](_0x32f51a[_0x2848('0x2e')],_0x32f51a[_0x2848('0x30')]);_0x56d0fa[_0x2848('0x35')]=_['intersection'](_0x32f51a[_0x2848('0x2e')],qs[_0x2848('0x34')](_0x5ef41f[_0x2848('0x30')]['fields']));_0x56d0fa[_0x2848('0x35')]=_0x56d0fa[_0x2848('0x35')][_0x2848('0x3f')]?_0x56d0fa[_0x2848('0x35')]:_0x32f51a[_0x2848('0x2e')];if(_0x5ef41f['query'][_0x2848('0x40')]){_0x56d0fa[_0x2848('0x41')]=[{'all':!![]}];}_0x56d0fa=_[_0x2848('0x3a')]({},_0x56d0fa,_0x5ef41f[_0x2848('0x3b')]);return db['FaxQueueReport'][_0x2848('0x42')](_0x56d0fa)[_0x2848('0x23')](handleEntityNotFound(_0x3208f2,null))[_0x2848('0x23')](respondWithResult(_0x3208f2,null))['catch'](handleError(_0x3208f2,null));};exports[_0x2848('0x43')]=function(_0xf6c69,_0x53420b){return db['FaxQueueReport'][_0x2848('0x43')](_0xf6c69[_0x2848('0x44')],{})[_0x2848('0x23')](respondWithResult(_0x53420b,0xc9))[_0x2848('0x45')](handleError(_0x53420b,null));};exports[_0x2848('0x22')]=function(_0x4e4b1e,_0x35ed61){if(_0x4e4b1e[_0x2848('0x44')]['id']){delete _0x4e4b1e[_0x2848('0x44')]['id'];}return db[_0x2848('0x29')][_0x2848('0x42')]({'where':{'id':_0x4e4b1e[_0x2848('0x46')]['id']}})[_0x2848('0x23')](handleEntityNotFound(_0x35ed61,null))[_0x2848('0x23')](saveUpdates(_0x4e4b1e[_0x2848('0x44')],null))[_0x2848('0x23')](respondWithResult(_0x35ed61,null))[_0x2848('0x45')](handleError(_0x35ed61,null));};exports[_0x2848('0x24')]=function(_0xe8e50,_0x1a8946){return db[_0x2848('0x29')][_0x2848('0x42')]({'where':{'id':_0xe8e50[_0x2848('0x46')]['id']}})[_0x2848('0x23')](handleEntityNotFound(_0x1a8946,null))[_0x2848('0x23')](removeEntity(_0x1a8946,null))[_0x2848('0x45')](handleError(_0x1a8946,null));};exports['describe']=function(_0x2814a2,_0x3b996e){return db['FaxQueueReport'][_0x2848('0x47')]()[_0x2848('0x23')](respondWithResult(_0x3b996e,null))['catch'](handleError(_0x3b996e,null));}; \ No newline at end of file +var _0x534d=['error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick','merge','where','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x534d,0x79));var _0xd534=function(_0x38b33c,_0x13bf9a){_0x38b33c=_0x38b33c-0x0;var _0x3e2f77=_0x534d[_0x38b33c];return _0x3e2f77;};'use strict';var emlformat=require(_0xd534('0x0'));var rimraf=require(_0xd534('0x1'));var zipdir=require(_0xd534('0x2'));var jsonpatch=require(_0xd534('0x3'));var rp=require(_0xd534('0x4'));var moment=require(_0xd534('0x5'));var BPromise=require(_0xd534('0x6'));var Mustache=require(_0xd534('0x7'));var util=require(_0xd534('0x8'));var path=require(_0xd534('0x9'));var sox=require(_0xd534('0xa'));var csv=require(_0xd534('0xb'));var ejs=require(_0xd534('0xc'));var fs=require('fs');var fs_extra=require(_0xd534('0xd'));var _=require(_0xd534('0xe'));var squel=require(_0xd534('0xf'));var crypto=require(_0xd534('0x10'));var jsforce=require(_0xd534('0x11'));var deskjs=require(_0xd534('0x12'));var toCsv=require('to-csv');var querystring=require(_0xd534('0x13'));var Papa=require(_0xd534('0x14'));var Redis=require(_0xd534('0x15'));var authService=require(_0xd534('0x16'));var qs=require(_0xd534('0x17'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd534('0x18'));var logger=require(_0xd534('0x19'))(_0xd534('0x1a'));var utils=require(_0xd534('0x1b'));var config=require(_0xd534('0x1c'));var licenseUtil=require(_0xd534('0x1d'));var db=require(_0xd534('0x1e'))['db'];function respondWithStatusCode(_0xc019db,_0x568e0e){_0x568e0e=_0x568e0e||0xcc;return function(_0x518e7d){if(_0x518e7d){return _0xc019db[_0xd534('0x1f')](_0x568e0e);}return _0xc019db[_0xd534('0x20')](_0x568e0e)[_0xd534('0x21')]();};}function respondWithResult(_0x187e0,_0x290b75){_0x290b75=_0x290b75||0xc8;return function(_0x9ecc7d){if(_0x9ecc7d){return _0x187e0[_0xd534('0x20')](_0x290b75)[_0xd534('0x22')](_0x9ecc7d);}};}function respondWithFilteredResult(_0x340dee,_0x1ec85f){return function(_0x502c61){if(_0x502c61){var _0x51e8b2=typeof _0x1ec85f[_0xd534('0x23')]===_0xd534('0x24')&&typeof _0x1ec85f[_0xd534('0x25')]==='undefined';var _0x4f7f45=_0x502c61[_0xd534('0x26')];var _0x477b62=_0x51e8b2?0x0:_0x1ec85f[_0xd534('0x23')];var _0xb097fd=_0x51e8b2?_0x502c61['count']:_0x1ec85f['offset']+_0x1ec85f[_0xd534('0x25')];var _0x65672f;if(_0xb097fd>=_0x4f7f45){_0xb097fd=_0x4f7f45;_0x65672f=0xc8;}else{_0x65672f=0xce;}_0x340dee['status'](_0x65672f);return _0x340dee['set'](_0xd534('0x27'),_0x477b62+'-'+_0xb097fd+'/'+_0x4f7f45)['json'](_0x502c61);}return null;};}function patchUpdates(_0x3c0f39){return function(_0x419e08){try{jsonpatch[_0xd534('0x28')](_0x419e08,_0x3c0f39,!![]);}catch(_0x4464d3){return BPromise[_0xd534('0x29')](_0x4464d3);}return _0x419e08['save']();};}function saveUpdates(_0x59f5d7,_0x25a176){return function(_0x533c13){if(_0x533c13){return _0x533c13[_0xd534('0x2a')](_0x59f5d7)[_0xd534('0x2b')](function(_0x4d139f){return _0x4d139f;});}return null;};}function removeEntity(_0x3138f6,_0x38681b){return function(_0x3c030e){if(_0x3c030e){return _0x3c030e[_0xd534('0x2c')]()['then'](function(){_0x3138f6['status'](0xcc)[_0xd534('0x21')]();});}};}function handleEntityNotFound(_0x269b31,_0x1028b8){return function(_0x4ec7bf){if(!_0x4ec7bf){_0x269b31[_0xd534('0x1f')](0x194);}return _0x4ec7bf;};}function handleError(_0x27d291,_0x46818d){_0x46818d=_0x46818d||0x1f4;return function(_0x4c509d){logger[_0xd534('0x2d')](_0x4c509d[_0xd534('0x2e')]);if(_0x4c509d['name']){delete _0x4c509d[_0xd534('0x2f')];}_0x27d291[_0xd534('0x20')](_0x46818d)[_0xd534('0x30')](_0x4c509d);};}exports[_0xd534('0x31')]=function(_0x2bf346,_0x36ee41){var _0x4d5bbb={},_0xf3da75={},_0x35037c={'count':0x0,'rows':[]};var _0xb08730=_[_0xd534('0x32')](db[_0xd534('0x33')][_0xd534('0x34')],function(_0x2d525e){return{'name':_0x2d525e[_0xd534('0x35')],'type':_0x2d525e[_0xd534('0x36')][_0xd534('0x37')]};});_0xf3da75[_0xd534('0x38')]=_[_0xd534('0x32')](_0xb08730,'name');_0xf3da75[_0xd534('0x39')]=_[_0xd534('0x3a')](_0x2bf346['query']);_0xf3da75[_0xd534('0x3b')]=_[_0xd534('0x3c')](_0xf3da75['model'],_0xf3da75['query']);_0x4d5bbb['attributes']=_[_0xd534('0x3c')](_0xf3da75[_0xd534('0x38')],qs['fields'](_0x2bf346[_0xd534('0x39')][_0xd534('0x3d')]));_0x4d5bbb[_0xd534('0x3e')]=_0x4d5bbb['attributes'][_0xd534('0x3f')]?_0x4d5bbb[_0xd534('0x3e')]:_0xf3da75[_0xd534('0x38')];if(!_0x2bf346['query'][_0xd534('0x40')](_0xd534('0x41'))){_0x4d5bbb[_0xd534('0x25')]=qs['limit'](_0x2bf346[_0xd534('0x39')][_0xd534('0x25')]);_0x4d5bbb['offset']=qs[_0xd534('0x23')](_0x2bf346[_0xd534('0x39')][_0xd534('0x23')]);}_0x4d5bbb[_0xd534('0x42')]=qs['sort'](_0x2bf346[_0xd534('0x39')]['sort']);_0x4d5bbb['where']=qs['filters'](_[_0xd534('0x43')](_0x2bf346[_0xd534('0x39')],_0xf3da75[_0xd534('0x3b')]),_0xb08730);if(_0x2bf346[_0xd534('0x39')]['filter']){_0x4d5bbb['where']=_[_0xd534('0x44')](_0x4d5bbb[_0xd534('0x45')],{'$or':_[_0xd534('0x32')](_0xb08730,function(_0x1f588d){if(_0x1f588d[_0xd534('0x36')]!==_0xd534('0x46')){var _0x4b8d09={};_0x4b8d09[_0x1f588d[_0xd534('0x2f')]]={'$like':'%'+_0x2bf346['query'][_0xd534('0x47')]+'%'};return _0x4b8d09;}})});}_0x4d5bbb=_[_0xd534('0x44')]({},_0x4d5bbb,_0x2bf346[_0xd534('0x48')]);var _0x3bb78f={'where':_0x4d5bbb[_0xd534('0x45')]};return db['FaxQueueReport'][_0xd534('0x26')](_0x3bb78f)['then'](function(_0x351e1b){_0x35037c[_0xd534('0x26')]=_0x351e1b;if(_0x2bf346[_0xd534('0x39')][_0xd534('0x49')]){_0x4d5bbb[_0xd534('0x4a')]=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0x4d5bbb);})[_0xd534('0x2b')](function(_0x2b9de4){_0x35037c[_0xd534('0x4b')]=_0x2b9de4;return _0x35037c;})[_0xd534('0x2b')](respondWithFilteredResult(_0x36ee41,_0x4d5bbb))[_0xd534('0x4c')](handleError(_0x36ee41,null));};exports[_0xd534('0x4d')]=function(_0x1ee0fa,_0xc8b67d){var _0x5b2eb3={'raw':!![],'where':{'id':_0x1ee0fa[_0xd534('0x4e')]['id']}},_0x1e8595={};_0x1e8595[_0xd534('0x38')]=_['keys'](db['FaxQueueReport'][_0xd534('0x34')]);_0x1e8595[_0xd534('0x39')]=_['keys'](_0x1ee0fa[_0xd534('0x39')]);_0x1e8595['filters']=_[_0xd534('0x3c')](_0x1e8595[_0xd534('0x38')],_0x1e8595[_0xd534('0x39')]);_0x5b2eb3['attributes']=_[_0xd534('0x3c')](_0x1e8595[_0xd534('0x38')],qs[_0xd534('0x3d')](_0x1ee0fa[_0xd534('0x39')][_0xd534('0x3d')]));_0x5b2eb3[_0xd534('0x3e')]=_0x5b2eb3[_0xd534('0x3e')][_0xd534('0x3f')]?_0x5b2eb3[_0xd534('0x3e')]:_0x1e8595[_0xd534('0x38')];if(_0x1ee0fa['query']['includeAll']){_0x5b2eb3['include']=[{'all':!![]}];}_0x5b2eb3=_[_0xd534('0x44')]({},_0x5b2eb3,_0x1ee0fa[_0xd534('0x48')]);return db[_0xd534('0x33')][_0xd534('0x4f')](_0x5b2eb3)[_0xd534('0x2b')](handleEntityNotFound(_0xc8b67d,null))[_0xd534('0x2b')](respondWithResult(_0xc8b67d,null))['catch'](handleError(_0xc8b67d,null));};exports[_0xd534('0x50')]=function(_0x4c4560,_0x3eb0d1){return db[_0xd534('0x33')]['create'](_0x4c4560[_0xd534('0x51')],{})[_0xd534('0x2b')](respondWithResult(_0x3eb0d1,0xc9))[_0xd534('0x4c')](handleError(_0x3eb0d1,null));};exports[_0xd534('0x2a')]=function(_0x495f17,_0xb3c1cb){if(_0x495f17[_0xd534('0x51')]['id']){delete _0x495f17[_0xd534('0x51')]['id'];}return db[_0xd534('0x33')][_0xd534('0x4f')]({'where':{'id':_0x495f17[_0xd534('0x4e')]['id']}})[_0xd534('0x2b')](handleEntityNotFound(_0xb3c1cb,null))['then'](saveUpdates(_0x495f17['body'],null))[_0xd534('0x2b')](respondWithResult(_0xb3c1cb,null))[_0xd534('0x4c')](handleError(_0xb3c1cb,null));};exports['destroy']=function(_0x494667,_0x56b2ee){return db[_0xd534('0x33')]['find']({'where':{'id':_0x494667[_0xd534('0x4e')]['id']}})[_0xd534('0x2b')](handleEntityNotFound(_0x56b2ee,null))[_0xd534('0x2b')](removeEntity(_0x56b2ee,null))[_0xd534('0x4c')](handleError(_0x56b2ee,null));};exports['describe']=function(_0x17b1bc,_0x400472){return db[_0xd534('0x33')][_0xd534('0x52')]()[_0xd534('0x2b')](respondWithResult(_0x400472,null))[_0xd534('0x4c')](handleError(_0x400472,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 35d414c..929dff5 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 _0x5fab=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','api'];(function(_0x24bf6f,_0x2214f4){var _0xef9adb=function(_0x54a0fe){while(--_0x54a0fe){_0x24bf6f['push'](_0x24bf6f['shift']());}};_0xef9adb(++_0x2214f4);}(_0x5fab,0x177));var _0xb5fa=function(_0x320e1f,_0x1ada5e){_0x320e1f=_0x320e1f-0x0;var _0x1c7ae2=_0x5fab[_0x320e1f];return _0x1c7ae2;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[{'name':_0xb5fa('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','moment'];(function(_0x3d8207,_0x323d6e){var _0x17bf61=function(_0x536ac8){while(--_0x536ac8){_0x3d8207['push'](_0x3d8207['shift']());}};_0x17bf61(++_0x323d6e);}(_0xe14b,0x93));var _0xbe14=function(_0x502c6f,_0x1a1528){_0x502c6f=_0x502c6f-0x0;var _0x591ec6=_0xe14b[_0x502c6f];return _0x591ec6;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 8eff6e4..84a02e9 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 _0x47dc=['code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','update','where','attributes','limit','util','moment','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1325c2,_0x547793){var _0x174007=function(_0x5df622){while(--_0x5df622){_0x1325c2['push'](_0x1325c2['shift']());}};_0x174007(++_0x547793);}(_0x47dc,0xaf));var _0xc47d=function(_0x5cf873,_0x13c209){_0x5cf873=_0x5cf873-0x0;var _0x39eabc=_0x47dc[_0x5cf873];return _0x39eabc;};'use strict';var _=require('lodash');var util=require(_0xc47d('0x0'));var moment=require(_0xc47d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc47d('0x2'));var db=require(_0xc47d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc47d('0x4'));var jayson=require(_0xc47d('0x5'));var client=jayson[_0xc47d('0x6')][_0xc47d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1e28cd,_0x32f034,_0x37cbb7){return new BPromise(function(_0x5cb653,_0x1ccf8c){return client[_0xc47d('0x8')](_0x1e28cd,_0x37cbb7)[_0xc47d('0x9')](function(_0x50f3ad){logger[_0xc47d('0xa')](_0xc47d('0xb'),_0x32f034,_0xc47d('0xc'));logger[_0xc47d('0xd')](_0xc47d('0xe'),_0x32f034,'request\x20sent',JSON[_0xc47d('0xf')](_0x50f3ad));if(_0x50f3ad[_0xc47d('0x10')]){if(_0x50f3ad[_0xc47d('0x10')][_0xc47d('0x11')]===0x1f4){logger[_0xc47d('0x10')](_0xc47d('0xb'),_0x32f034,_0x50f3ad['error']['message']);return _0x1ccf8c(_0x50f3ad['error'][_0xc47d('0x12')]);}logger[_0xc47d('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x32f034,_0x50f3ad['error'][_0xc47d('0x12')]);return _0x5cb653(_0x50f3ad['error'][_0xc47d('0x12')]);}else{logger['info'](_0xc47d('0xb'),_0x32f034,_0xc47d('0xc'));_0x5cb653(_0x50f3ad[_0xc47d('0x13')]['message']);}})[_0xc47d('0x14')](function(_0x5ba1dd){logger['error'](_0xc47d('0xb'),_0x32f034,_0x5ba1dd);_0x1ccf8c(_0x5ba1dd);});});}exports[_0xc47d('0x15')]=function(_0x20c413){var _0x28e825=this;return new Promise(function(_0x5b4711,_0x65163){return db[_0xc47d('0x16')][_0xc47d('0x17')](_0x20c413[_0xc47d('0x18')],{'raw':_0x20c413['options']?_0x20c413[_0xc47d('0x19')][_0xc47d('0x1a')]===undefined?!![]:![]:!![]})[_0xc47d('0x9')](function(_0x4a55bd){logger[_0xc47d('0xa')](_0xc47d('0x15'),_0x20c413);logger[_0xc47d('0xd')](_0xc47d('0x15'),_0x20c413,JSON['stringify'](_0x4a55bd));_0x5b4711(_0x4a55bd);})[_0xc47d('0x14')](function(_0x627b0a){logger['error']('CreateFaxQueueReport',_0x627b0a[_0xc47d('0x12')],_0x20c413);_0x65163(_0x28e825[_0xc47d('0x10')](0x1f4,_0x627b0a['message']));});});};exports[_0xc47d('0x1b')]=function(_0x40eb6b){var _0x1a2d8b=this;return new Promise(function(_0x102cb6,_0x5a2f30){return db[_0xc47d('0x16')][_0xc47d('0x1c')](_0x40eb6b['body'],{'raw':_0x40eb6b['options']?_0x40eb6b[_0xc47d('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40eb6b[_0xc47d('0x19')]?_0x40eb6b[_0xc47d('0x19')][_0xc47d('0x1d')]||null:null,'attributes':_0x40eb6b['options']?_0x40eb6b[_0xc47d('0x19')][_0xc47d('0x1e')]||null:null,'limit':_0x40eb6b['options']?_0x40eb6b[_0xc47d('0x19')][_0xc47d('0x1f')]||null:null})[_0xc47d('0x9')](function(_0x25afc6){logger[_0xc47d('0xa')]('UpdateFaxQueueReport',_0x40eb6b);logger['debug']('UpdateFaxQueueReport',_0x40eb6b,JSON[_0xc47d('0xf')](_0x25afc6));_0x102cb6(_0x25afc6);})['catch'](function(_0x1bdb12){logger[_0xc47d('0x10')]('UpdateFaxQueueReport',_0x1bdb12[_0xc47d('0x12')],_0x40eb6b);_0x5a2f30(_0x1a2d8b['error'](0x1f4,_0x1bdb12[_0xc47d('0x12')]));});});}; \ No newline at end of file +var _0x761f=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateFaxQueueReport','FaxQueueReport','options','raw','UpdateFaxQueueReport','update','attributes','limit','util','moment','bluebird','randomstring','ioredis'];(function(_0x48b99c,_0x5b2d9d){var _0x5a52de=function(_0x1da2ab){while(--_0x1da2ab){_0x48b99c['push'](_0x48b99c['shift']());}};_0x5a52de(++_0x5b2d9d);}(_0x761f,0xf3));var _0xf761=function(_0x4d7a61,_0x3fb6e6){_0x4d7a61=_0x4d7a61-0x0;var _0x186f73=_0x761f[_0x4d7a61];return _0x186f73;};'use strict';var _=require('lodash');var util=require(_0xf761('0x0'));var moment=require(_0xf761('0x1'));var BPromise=require(_0xf761('0x2'));var rs=require(_0xf761('0x3'));var fs=require('fs');var Redis=require(_0xf761('0x4'));var db=require(_0xf761('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf761('0x6'));var config=require(_0xf761('0x7'));var jayson=require(_0xf761('0x8'));var client=jayson[_0xf761('0x9')][_0xf761('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a2d53,_0x5d1418,_0x373779){return new BPromise(function(_0xea32c7,_0x1286ab){return client[_0xf761('0xb')](_0x3a2d53,_0x373779)[_0xf761('0xc')](function(_0x555185){logger[_0xf761('0xd')](_0xf761('0xe'),_0x5d1418,_0xf761('0xf'));logger[_0xf761('0x10')](_0xf761('0x11'),_0x5d1418,_0xf761('0xf'),JSON[_0xf761('0x12')](_0x555185));if(_0x555185['error']){if(_0x555185['error']['code']===0x1f4){logger[_0xf761('0x13')](_0xf761('0xe'),_0x5d1418,_0x555185[_0xf761('0x13')][_0xf761('0x14')]);return _0x1286ab(_0x555185[_0xf761('0x13')][_0xf761('0x14')]);}logger[_0xf761('0x13')](_0xf761('0xe'),_0x5d1418,_0x555185[_0xf761('0x13')][_0xf761('0x14')]);return _0xea32c7(_0x555185[_0xf761('0x13')][_0xf761('0x14')]);}else{logger[_0xf761('0xd')](_0xf761('0xe'),_0x5d1418,_0xf761('0xf'));_0xea32c7(_0x555185[_0xf761('0x15')][_0xf761('0x14')]);}})[_0xf761('0x16')](function(_0x29487c){logger[_0xf761('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x5d1418,_0x29487c);_0x1286ab(_0x29487c);});});}exports[_0xf761('0x17')]=function(_0x24ad03){var _0x55b188=this;return new Promise(function(_0x2171e6,_0x5c19e1){return db[_0xf761('0x18')]['create'](_0x24ad03['body'],{'raw':_0x24ad03[_0xf761('0x19')]?_0x24ad03[_0xf761('0x19')][_0xf761('0x1a')]===undefined?!![]:![]:!![]})[_0xf761('0xc')](function(_0x4d62ce){logger[_0xf761('0xd')](_0xf761('0x17'),_0x24ad03);logger['debug'](_0xf761('0x17'),_0x24ad03,JSON[_0xf761('0x12')](_0x4d62ce));_0x2171e6(_0x4d62ce);})[_0xf761('0x16')](function(_0x9df7c7){logger[_0xf761('0x13')](_0xf761('0x17'),_0x9df7c7['message'],_0x24ad03);_0x5c19e1(_0x55b188[_0xf761('0x13')](0x1f4,_0x9df7c7[_0xf761('0x14')]));});});};exports[_0xf761('0x1b')]=function(_0x114eff){var _0x26d228=this;return new Promise(function(_0xc471a6,_0x2f5bd7){return db['FaxQueueReport'][_0xf761('0x1c')](_0x114eff['body'],{'raw':_0x114eff[_0xf761('0x19')]?_0x114eff[_0xf761('0x19')][_0xf761('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x114eff[_0xf761('0x19')]?_0x114eff[_0xf761('0x19')]['where']||null:null,'attributes':_0x114eff[_0xf761('0x19')]?_0x114eff[_0xf761('0x19')][_0xf761('0x1d')]||null:null,'limit':_0x114eff[_0xf761('0x19')]?_0x114eff[_0xf761('0x19')][_0xf761('0x1e')]||null:null})[_0xf761('0xc')](function(_0x31d7fb){logger[_0xf761('0xd')](_0xf761('0x1b'),_0x114eff);logger['debug'](_0xf761('0x1b'),_0x114eff,JSON['stringify'](_0x31d7fb));_0xc471a6(_0x31d7fb);})['catch'](function(_0x14e621){logger['error'](_0xf761('0x1b'),_0x14e621['message'],_0x114eff);_0x2f5bd7(_0x26d228[_0xf761('0x13')](0x1f4,_0x14e621[_0xf761('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index bafba4f..4da5cec 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 _0x2ee1=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post','create','update','delete'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x2ee1,0x187));var _0x12ee=function(_0x2305f6,_0xae8fed){_0x2305f6=_0x2305f6-0x0;var _0x553a5c=_0x2ee1[_0x2305f6];return _0x553a5c;};'use strict';var multer=require('multer');var util=require(_0x12ee('0x0'));var path=require('path');var timeout=require(_0x12ee('0x1'));var express=require(_0x12ee('0x2'));var router=express['Router']();var fs_extra=require(_0x12ee('0x3'));var auth=require(_0x12ee('0x4'));var interaction=require(_0x12ee('0x5'));var config=require(_0x12ee('0x6'));var controller=require('./faxQueueReport.controller');router[_0x12ee('0x7')]('/',auth[_0x12ee('0x8')](),controller[_0x12ee('0x9')]);router['get'](_0x12ee('0xa'),auth[_0x12ee('0x8')](),controller['describe']);router[_0x12ee('0x7')](_0x12ee('0xb'),auth[_0x12ee('0x8')](),controller[_0x12ee('0xc')]);router[_0x12ee('0xd')]('/',auth[_0x12ee('0x8')](),controller[_0x12ee('0xe')]);router['put'](_0x12ee('0xb'),auth[_0x12ee('0x8')](),controller[_0x12ee('0xf')]);router[_0x12ee('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe665=['isAuthenticated','/describe','/:id','show','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','./faxQueueReport.controller','get'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xe665,0x117));var _0x5e66=function(_0x12957f,_0x38dfb7){_0x12957f=_0x12957f-0x0;var _0x36b849=_0xe665[_0x12957f];return _0x36b849;};'use strict';var multer=require(_0x5e66('0x0'));var util=require(_0x5e66('0x1'));var path=require(_0x5e66('0x2'));var timeout=require('connect-timeout');var express=require(_0x5e66('0x3'));var router=express[_0x5e66('0x4')]();var fs_extra=require(_0x5e66('0x5'));var auth=require(_0x5e66('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5e66('0x7'));router[_0x5e66('0x8')]('/',auth[_0x5e66('0x9')](),controller['index']);router[_0x5e66('0x8')](_0x5e66('0xa'),auth[_0x5e66('0x9')](),controller['describe']);router[_0x5e66('0x8')](_0x5e66('0xb'),auth[_0x5e66('0x9')](),controller[_0x5e66('0xc')]);router['post']('/',auth[_0x5e66('0x9')](),controller[_0x5e66('0xd')]);router['put'](_0x5e66('0xb'),auth[_0x5e66('0x9')](),controller[_0x5e66('0xe')]);router[_0x5e66('0xf')](_0x5e66('0xb'),auth[_0x5e66('0x9')](),controller[_0x5e66('0x10')]);module[_0x5e66('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 1708cec..5abbefd 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(_0x1c9c24,_0x2a517b){var _0x349c69=function(_0x259ff7){while(--_0x259ff7){_0x1c9c24['push'](_0x1c9c24['shift']());}};_0x349c69(++_0x2a517b);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3211f3,_0x56d39a){_0x3211f3=_0x3211f3-0x0;var _0x101e88=_0xb43b[_0x3211f3];return _0x101e88;};'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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x1d1b1f,_0x338af4){var _0x32ee5c=function(_0x5d7d41){while(--_0x5d7d41){_0x1d1b1f['push'](_0x1d1b1f['shift']());}};_0x32ee5c(++_0x338af4);}(_0xaa88,0x137));var _0x8aa8=function(_0xae01dd,_0xbd8a3c){_0xae01dd=_0xae01dd-0x0;var _0x8c26df=_0xaa88[_0xae01dd];return _0x8c26df;};'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/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index e3c0f2e..eafd6ca 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 _0x6e60=['map','FaxTransferReport','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','count','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','end','error','stack','name','send'];(function(_0x268aa9,_0x4f3582){var _0x5c5bc4=function(_0x59a160){while(--_0x59a160){_0x268aa9['push'](_0x268aa9['shift']());}};_0x5c5bc4(++_0x4f3582);}(_0x6e60,0xc3));var _0x06e6=function(_0x543696,_0x80a066){_0x543696=_0x543696-0x0;var _0x4f25ce=_0x6e60[_0x543696];return _0x4f25ce;};'use strict';var emlformat=require(_0x06e6('0x0'));var rimraf=require(_0x06e6('0x1'));var zipdir=require(_0x06e6('0x2'));var jsonpatch=require(_0x06e6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x06e6('0x4'));var Mustache=require(_0x06e6('0x5'));var util=require(_0x06e6('0x6'));var path=require(_0x06e6('0x7'));var sox=require(_0x06e6('0x8'));var csv=require(_0x06e6('0x9'));var ejs=require(_0x06e6('0xa'));var fs=require('fs');var fs_extra=require(_0x06e6('0xb'));var _=require(_0x06e6('0xc'));var squel=require(_0x06e6('0xd'));var crypto=require(_0x06e6('0xe'));var jsforce=require(_0x06e6('0xf'));var deskjs=require(_0x06e6('0x10'));var toCsv=require(_0x06e6('0x9'));var querystring=require(_0x06e6('0x11'));var Papa=require(_0x06e6('0x12'));var Redis=require('ioredis');var authService=require(_0x06e6('0x13'));var qs=require(_0x06e6('0x14'));var as=require(_0x06e6('0x15'));var hardwareService=require(_0x06e6('0x16'));var logger=require('../../config/logger')(_0x06e6('0x17'));var utils=require(_0x06e6('0x18'));var config=require(_0x06e6('0x19'));var licenseUtil=require(_0x06e6('0x1a'));var db=require(_0x06e6('0x1b'))['db'];function respondWithStatusCode(_0x14a37c,_0x15b1cf){_0x15b1cf=_0x15b1cf||0xcc;return function(_0x48aa44){if(_0x48aa44){return _0x14a37c[_0x06e6('0x1c')](_0x15b1cf);}return _0x14a37c[_0x06e6('0x1d')](_0x15b1cf)['end']();};}function respondWithResult(_0x3f509a,_0x2c8ac4){_0x2c8ac4=_0x2c8ac4||0xc8;return function(_0x16a45c){if(_0x16a45c){return _0x3f509a[_0x06e6('0x1d')](_0x2c8ac4)[_0x06e6('0x1e')](_0x16a45c);}};}function respondWithFilteredResult(_0x51fc38,_0x30730){return function(_0x1becaa){if(_0x1becaa){var _0x5f1327=typeof _0x30730[_0x06e6('0x1f')]===_0x06e6('0x20')&&typeof _0x30730[_0x06e6('0x21')]===_0x06e6('0x20');var _0x1b2d02=_0x1becaa['count'];var _0x371f85=_0x5f1327?0x0:_0x30730['offset'];var _0x27d4cf=_0x5f1327?_0x1becaa['count']:_0x30730[_0x06e6('0x1f')]+_0x30730[_0x06e6('0x21')];var _0x2e8d40;if(_0x27d4cf>=_0x1b2d02){_0x27d4cf=_0x1b2d02;_0x2e8d40=0xc8;}else{_0x2e8d40=0xce;}_0x51fc38[_0x06e6('0x1d')](_0x2e8d40);return _0x51fc38[_0x06e6('0x22')](_0x06e6('0x23'),_0x371f85+'-'+_0x27d4cf+'/'+_0x1b2d02)[_0x06e6('0x1e')](_0x1becaa);}return null;};}function patchUpdates(_0x7f0928){return function(_0x5aed8f){try{jsonpatch['apply'](_0x5aed8f,_0x7f0928,!![]);}catch(_0x42e935){return BPromise[_0x06e6('0x24')](_0x42e935);}return _0x5aed8f[_0x06e6('0x25')]();};}function saveUpdates(_0x426f80,_0x5a0810){return function(_0x4f674f){if(_0x4f674f){return _0x4f674f[_0x06e6('0x26')](_0x426f80)[_0x06e6('0x27')](function(_0x398341){return _0x398341;});}return null;};}function removeEntity(_0x4b22cd,_0x73b389){return function(_0x4a34cc){if(_0x4a34cc){return _0x4a34cc['destroy']()[_0x06e6('0x27')](function(){_0x4b22cd['status'](0xcc)[_0x06e6('0x28')]();});}};}function handleEntityNotFound(_0x46ccce,_0x10513d){return function(_0x41af0c){if(!_0x41af0c){_0x46ccce['sendStatus'](0x194);}return _0x41af0c;};}function handleError(_0x32563f,_0x2bfb30){_0x2bfb30=_0x2bfb30||0x1f4;return function(_0x5bece6){logger[_0x06e6('0x29')](_0x5bece6[_0x06e6('0x2a')]);if(_0x5bece6[_0x06e6('0x2b')]){delete _0x5bece6[_0x06e6('0x2b')];}_0x32563f['status'](_0x2bfb30)[_0x06e6('0x2c')](_0x5bece6);};}exports['index']=function(_0x5b0249,_0x25e12c){var _0x5e347d={},_0x4958bd={},_0x1ea02b={'count':0x0,'rows':[]};var _0x5d36a8=_[_0x06e6('0x2d')](db[_0x06e6('0x2e')]['rawAttributes'],function(_0x2e72e7){return{'name':_0x2e72e7['fieldName'],'type':_0x2e72e7['type'][_0x06e6('0x2f')]};});_0x4958bd[_0x06e6('0x30')]=_[_0x06e6('0x2d')](_0x5d36a8,'name');_0x4958bd[_0x06e6('0x31')]=_[_0x06e6('0x32')](_0x5b0249[_0x06e6('0x31')]);_0x4958bd[_0x06e6('0x33')]=_['intersection'](_0x4958bd['model'],_0x4958bd[_0x06e6('0x31')]);_0x5e347d[_0x06e6('0x34')]=_[_0x06e6('0x35')](_0x4958bd[_0x06e6('0x30')],qs['fields'](_0x5b0249[_0x06e6('0x31')][_0x06e6('0x36')]));_0x5e347d[_0x06e6('0x34')]=_0x5e347d[_0x06e6('0x34')]['length']?_0x5e347d['attributes']:_0x4958bd[_0x06e6('0x30')];if(!_0x5b0249['query'][_0x06e6('0x37')](_0x06e6('0x38'))){_0x5e347d['limit']=qs[_0x06e6('0x21')](_0x5b0249[_0x06e6('0x31')][_0x06e6('0x21')]);_0x5e347d[_0x06e6('0x1f')]=qs['offset'](_0x5b0249[_0x06e6('0x31')][_0x06e6('0x1f')]);}_0x5e347d[_0x06e6('0x39')]=qs[_0x06e6('0x3a')](_0x5b0249[_0x06e6('0x31')][_0x06e6('0x3a')]);_0x5e347d[_0x06e6('0x3b')]=qs[_0x06e6('0x33')](_['pick'](_0x5b0249[_0x06e6('0x31')],_0x4958bd[_0x06e6('0x33')]),_0x5d36a8);if(_0x5b0249[_0x06e6('0x31')][_0x06e6('0x3c')]){_0x5e347d[_0x06e6('0x3b')]=_[_0x06e6('0x3d')](_0x5e347d['where'],{'$or':_[_0x06e6('0x2d')](_0x5d36a8,function(_0x5ce02d){if(_0x5ce02d[_0x06e6('0x3e')]!==_0x06e6('0x3f')){var _0x589e0c={};_0x589e0c[_0x5ce02d[_0x06e6('0x2b')]]={'$like':'%'+_0x5b0249[_0x06e6('0x31')][_0x06e6('0x3c')]+'%'};return _0x589e0c;}})});}_0x5e347d=_['merge']({},_0x5e347d,_0x5b0249['options']);var _0x391f80={'where':_0x5e347d[_0x06e6('0x3b')]};return db[_0x06e6('0x2e')][_0x06e6('0x40')](_0x391f80)[_0x06e6('0x27')](function(_0x11b9b6){_0x1ea02b[_0x06e6('0x40')]=_0x11b9b6;if(_0x5b0249[_0x06e6('0x31')]['includeAll']){_0x5e347d[_0x06e6('0x41')]=[{'all':!![]}];}return db[_0x06e6('0x2e')][_0x06e6('0x42')](_0x5e347d);})[_0x06e6('0x27')](function(_0x422213){_0x1ea02b[_0x06e6('0x43')]=_0x422213;return _0x1ea02b;})[_0x06e6('0x27')](respondWithFilteredResult(_0x25e12c,_0x5e347d))[_0x06e6('0x44')](handleError(_0x25e12c,null));};exports[_0x06e6('0x45')]=function(_0x29d2c8,_0x58e51f){var _0x137224={'raw':!![],'where':{'id':_0x29d2c8[_0x06e6('0x46')]['id']}},_0x2e1daf={};_0x2e1daf['model']=_[_0x06e6('0x32')](db[_0x06e6('0x2e')][_0x06e6('0x47')]);_0x2e1daf[_0x06e6('0x31')]=_['keys'](_0x29d2c8[_0x06e6('0x31')]);_0x2e1daf[_0x06e6('0x33')]=_[_0x06e6('0x35')](_0x2e1daf[_0x06e6('0x30')],_0x2e1daf[_0x06e6('0x31')]);_0x137224[_0x06e6('0x34')]=_[_0x06e6('0x35')](_0x2e1daf['model'],qs[_0x06e6('0x36')](_0x29d2c8[_0x06e6('0x31')][_0x06e6('0x36')]));_0x137224[_0x06e6('0x34')]=_0x137224[_0x06e6('0x34')][_0x06e6('0x48')]?_0x137224['attributes']:_0x2e1daf[_0x06e6('0x30')];if(_0x29d2c8[_0x06e6('0x31')][_0x06e6('0x49')]){_0x137224[_0x06e6('0x41')]=[{'all':!![]}];}_0x137224=_[_0x06e6('0x3d')]({},_0x137224,_0x29d2c8[_0x06e6('0x4a')]);return db[_0x06e6('0x2e')][_0x06e6('0x4b')](_0x137224)[_0x06e6('0x27')](handleEntityNotFound(_0x58e51f,null))['then'](respondWithResult(_0x58e51f,null))[_0x06e6('0x44')](handleError(_0x58e51f,null));};exports[_0x06e6('0x4c')]=function(_0x363834,_0x1aa3dd){return db['FaxTransferReport'][_0x06e6('0x4c')](_0x363834[_0x06e6('0x4d')],{})[_0x06e6('0x27')](respondWithResult(_0x1aa3dd,0xc9))[_0x06e6('0x44')](handleError(_0x1aa3dd,null));};exports['update']=function(_0x50bcd4,_0x2b34ee){if(_0x50bcd4['body']['id']){delete _0x50bcd4['body']['id'];}return db[_0x06e6('0x2e')]['find']({'where':{'id':_0x50bcd4[_0x06e6('0x46')]['id']}})[_0x06e6('0x27')](handleEntityNotFound(_0x2b34ee,null))[_0x06e6('0x27')](saveUpdates(_0x50bcd4[_0x06e6('0x4d')],null))[_0x06e6('0x27')](respondWithResult(_0x2b34ee,null))[_0x06e6('0x44')](handleError(_0x2b34ee,null));};exports[_0x06e6('0x4e')]=function(_0x97110a,_0x44f003){return db[_0x06e6('0x2e')][_0x06e6('0x4b')]({'where':{'id':_0x97110a['params']['id']}})[_0x06e6('0x27')](handleEntityNotFound(_0x44f003,null))[_0x06e6('0x27')](removeEntity(_0x44f003,null))[_0x06e6('0x44')](handleError(_0x44f003,null));};exports[_0x06e6('0x4f')]=function(_0x1aa5ee,_0x1cb0dc){return db['FaxTransferReport'][_0x06e6('0x4f')]()[_0x06e6('0x27')](respondWithResult(_0x1cb0dc,null))[_0x06e6('0x44')](handleError(_0x1cb0dc,null));}; \ No newline at end of file +var _0x3d10=['body','params','describe','eml-format','rimraf','zip-dir','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','FaxTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create'];(function(_0x69394d,_0x24473a){var _0x56e048=function(_0x4031cb){while(--_0x4031cb){_0x69394d['push'](_0x69394d['shift']());}};_0x56e048(++_0x24473a);}(_0x3d10,0x9f));var _0x03d1=function(_0x4afac5,_0x1ab4ed){_0x4afac5=_0x4afac5-0x0;var _0x2404b3=_0x3d10[_0x4afac5];return _0x2404b3;};'use strict';var emlformat=require(_0x03d1('0x0'));var rimraf=require(_0x03d1('0x1'));var zipdir=require(_0x03d1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x03d1('0x3'));var Mustache=require('mustache');var util=require(_0x03d1('0x4'));var path=require(_0x03d1('0x5'));var sox=require('sox');var csv=require(_0x03d1('0x6'));var ejs=require(_0x03d1('0x7'));var fs=require('fs');var fs_extra=require(_0x03d1('0x8'));var _=require(_0x03d1('0x9'));var squel=require(_0x03d1('0xa'));var crypto=require('crypto');var jsforce=require(_0x03d1('0xb'));var deskjs=require(_0x03d1('0xc'));var toCsv=require(_0x03d1('0x6'));var querystring=require(_0x03d1('0xd'));var Papa=require('papaparse');var Redis=require(_0x03d1('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x03d1('0xf'));var as=require(_0x03d1('0x10'));var hardwareService=require(_0x03d1('0x11'));var logger=require(_0x03d1('0x12'))(_0x03d1('0x13'));var utils=require(_0x03d1('0x14'));var config=require(_0x03d1('0x15'));var licenseUtil=require(_0x03d1('0x16'));var db=require(_0x03d1('0x17'))['db'];function respondWithStatusCode(_0x2858e6,_0xae38d9){_0xae38d9=_0xae38d9||0xcc;return function(_0x40075c){if(_0x40075c){return _0x2858e6[_0x03d1('0x18')](_0xae38d9);}return _0x2858e6['status'](_0xae38d9)[_0x03d1('0x19')]();};}function respondWithResult(_0x2f51c3,_0x3b5102){_0x3b5102=_0x3b5102||0xc8;return function(_0x2c7f2e){if(_0x2c7f2e){return _0x2f51c3[_0x03d1('0x1a')](_0x3b5102)[_0x03d1('0x1b')](_0x2c7f2e);}};}function respondWithFilteredResult(_0x19ff7a,_0x2fefb1){return function(_0x264080){if(_0x264080){var _0x3e9670=typeof _0x2fefb1[_0x03d1('0x1c')]===_0x03d1('0x1d')&&typeof _0x2fefb1['limit']==='undefined';var _0x573764=_0x264080[_0x03d1('0x1e')];var _0x3b78bf=_0x3e9670?0x0:_0x2fefb1[_0x03d1('0x1c')];var _0x2a47d0=_0x3e9670?_0x264080[_0x03d1('0x1e')]:_0x2fefb1['offset']+_0x2fefb1[_0x03d1('0x1f')];var _0x24a4b3;if(_0x2a47d0>=_0x573764){_0x2a47d0=_0x573764;_0x24a4b3=0xc8;}else{_0x24a4b3=0xce;}_0x19ff7a[_0x03d1('0x1a')](_0x24a4b3);return _0x19ff7a[_0x03d1('0x20')](_0x03d1('0x21'),_0x3b78bf+'-'+_0x2a47d0+'/'+_0x573764)[_0x03d1('0x1b')](_0x264080);}return null;};}function patchUpdates(_0x2deb7d){return function(_0x2c1814){try{jsonpatch[_0x03d1('0x22')](_0x2c1814,_0x2deb7d,!![]);}catch(_0x2b18c8){return BPromise[_0x03d1('0x23')](_0x2b18c8);}return _0x2c1814[_0x03d1('0x24')]();};}function saveUpdates(_0x34a0f0,_0x203580){return function(_0x212f34){if(_0x212f34){return _0x212f34[_0x03d1('0x25')](_0x34a0f0)[_0x03d1('0x26')](function(_0x1fceb2){return _0x1fceb2;});}return null;};}function removeEntity(_0x292628,_0x169893){return function(_0x59d5ed){if(_0x59d5ed){return _0x59d5ed[_0x03d1('0x27')]()[_0x03d1('0x26')](function(){_0x292628[_0x03d1('0x1a')](0xcc)[_0x03d1('0x19')]();});}};}function handleEntityNotFound(_0x3145e8,_0x334dba){return function(_0x1ef861){if(!_0x1ef861){_0x3145e8[_0x03d1('0x18')](0x194);}return _0x1ef861;};}function handleError(_0x2fa90d,_0x59a7ea){_0x59a7ea=_0x59a7ea||0x1f4;return function(_0x36356f){logger[_0x03d1('0x28')](_0x36356f[_0x03d1('0x29')]);if(_0x36356f[_0x03d1('0x2a')]){delete _0x36356f['name'];}_0x2fa90d[_0x03d1('0x1a')](_0x59a7ea)['send'](_0x36356f);};}exports[_0x03d1('0x2b')]=function(_0xafb976,_0x2e6e4d){var _0x51f713={},_0xe99619={},_0x212394={'count':0x0,'rows':[]};var _0x2a0b0e=_[_0x03d1('0x2c')](db[_0x03d1('0x2d')][_0x03d1('0x2e')],function(_0x4a7789){return{'name':_0x4a7789[_0x03d1('0x2f')],'type':_0x4a7789[_0x03d1('0x30')]['key']};});_0xe99619[_0x03d1('0x31')]=_[_0x03d1('0x2c')](_0x2a0b0e,'name');_0xe99619[_0x03d1('0x32')]=_[_0x03d1('0x33')](_0xafb976['query']);_0xe99619[_0x03d1('0x34')]=_['intersection'](_0xe99619[_0x03d1('0x31')],_0xe99619['query']);_0x51f713['attributes']=_[_0x03d1('0x35')](_0xe99619[_0x03d1('0x31')],qs[_0x03d1('0x36')](_0xafb976[_0x03d1('0x32')][_0x03d1('0x36')]));_0x51f713[_0x03d1('0x37')]=_0x51f713[_0x03d1('0x37')][_0x03d1('0x38')]?_0x51f713['attributes']:_0xe99619[_0x03d1('0x31')];if(!_0xafb976[_0x03d1('0x32')][_0x03d1('0x39')](_0x03d1('0x3a'))){_0x51f713[_0x03d1('0x1f')]=qs[_0x03d1('0x1f')](_0xafb976['query']['limit']);_0x51f713[_0x03d1('0x1c')]=qs[_0x03d1('0x1c')](_0xafb976[_0x03d1('0x32')]['offset']);}_0x51f713[_0x03d1('0x3b')]=qs['sort'](_0xafb976[_0x03d1('0x32')][_0x03d1('0x3c')]);_0x51f713['where']=qs['filters'](_[_0x03d1('0x3d')](_0xafb976[_0x03d1('0x32')],_0xe99619[_0x03d1('0x34')]),_0x2a0b0e);if(_0xafb976[_0x03d1('0x32')][_0x03d1('0x3e')]){_0x51f713[_0x03d1('0x3f')]=_['merge'](_0x51f713['where'],{'$or':_['map'](_0x2a0b0e,function(_0x3ed16a){if(_0x3ed16a[_0x03d1('0x30')]!==_0x03d1('0x40')){var _0x55822a={};_0x55822a[_0x3ed16a[_0x03d1('0x2a')]]={'$like':'%'+_0xafb976[_0x03d1('0x32')][_0x03d1('0x3e')]+'%'};return _0x55822a;}})});}_0x51f713=_[_0x03d1('0x41')]({},_0x51f713,_0xafb976[_0x03d1('0x42')]);var _0x124bca={'where':_0x51f713[_0x03d1('0x3f')]};return db[_0x03d1('0x2d')][_0x03d1('0x1e')](_0x124bca)[_0x03d1('0x26')](function(_0x4a8748){_0x212394[_0x03d1('0x1e')]=_0x4a8748;if(_0xafb976[_0x03d1('0x32')][_0x03d1('0x43')]){_0x51f713[_0x03d1('0x44')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x03d1('0x45')](_0x51f713);})[_0x03d1('0x26')](function(_0xd6fe9){_0x212394[_0x03d1('0x46')]=_0xd6fe9;return _0x212394;})['then'](respondWithFilteredResult(_0x2e6e4d,_0x51f713))[_0x03d1('0x47')](handleError(_0x2e6e4d,null));};exports[_0x03d1('0x48')]=function(_0x24b442,_0x4697d0){var _0x5c98c8={'raw':!![],'where':{'id':_0x24b442['params']['id']}},_0x58fdd7={};_0x58fdd7[_0x03d1('0x31')]=_[_0x03d1('0x33')](db[_0x03d1('0x2d')]['rawAttributes']);_0x58fdd7['query']=_['keys'](_0x24b442['query']);_0x58fdd7['filters']=_[_0x03d1('0x35')](_0x58fdd7['model'],_0x58fdd7[_0x03d1('0x32')]);_0x5c98c8[_0x03d1('0x37')]=_['intersection'](_0x58fdd7['model'],qs[_0x03d1('0x36')](_0x24b442[_0x03d1('0x32')][_0x03d1('0x36')]));_0x5c98c8[_0x03d1('0x37')]=_0x5c98c8[_0x03d1('0x37')][_0x03d1('0x38')]?_0x5c98c8['attributes']:_0x58fdd7['model'];if(_0x24b442[_0x03d1('0x32')]['includeAll']){_0x5c98c8[_0x03d1('0x44')]=[{'all':!![]}];}_0x5c98c8=_[_0x03d1('0x41')]({},_0x5c98c8,_0x24b442[_0x03d1('0x42')]);return db[_0x03d1('0x2d')][_0x03d1('0x49')](_0x5c98c8)['then'](handleEntityNotFound(_0x4697d0,null))[_0x03d1('0x26')](respondWithResult(_0x4697d0,null))['catch'](handleError(_0x4697d0,null));};exports['create']=function(_0x1ac57e,_0x3660cd){return db['FaxTransferReport'][_0x03d1('0x4a')](_0x1ac57e[_0x03d1('0x4b')],{})[_0x03d1('0x26')](respondWithResult(_0x3660cd,0xc9))[_0x03d1('0x47')](handleError(_0x3660cd,null));};exports[_0x03d1('0x25')]=function(_0x3c7455,_0x110884){if(_0x3c7455[_0x03d1('0x4b')]['id']){delete _0x3c7455[_0x03d1('0x4b')]['id'];}return db[_0x03d1('0x2d')][_0x03d1('0x49')]({'where':{'id':_0x3c7455['params']['id']}})[_0x03d1('0x26')](handleEntityNotFound(_0x110884,null))[_0x03d1('0x26')](saveUpdates(_0x3c7455[_0x03d1('0x4b')],null))['then'](respondWithResult(_0x110884,null))[_0x03d1('0x47')](handleError(_0x110884,null));};exports[_0x03d1('0x27')]=function(_0xaee95,_0x48299a){return db[_0x03d1('0x2d')][_0x03d1('0x49')]({'where':{'id':_0xaee95[_0x03d1('0x4c')]['id']}})[_0x03d1('0x26')](handleEntityNotFound(_0x48299a,null))[_0x03d1('0x26')](removeEntity(_0x48299a,null))[_0x03d1('0x47')](handleError(_0x48299a,null));};exports['describe']=function(_0x4c6cd8,_0x57c19b){return db[_0x03d1('0x2d')][_0x03d1('0x4d')]()['then'](respondWithResult(_0x57c19b,null))['catch'](handleError(_0x57c19b,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 6d94c00..af40685 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 _0x142c=['exports','define','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x42a6cd,_0x5cc6a4){var _0x3854c4=function(_0xe4a6ed){while(--_0xe4a6ed){_0x42a6cd['push'](_0x42a6cd['shift']());}};_0x3854c4(++_0x5cc6a4);}(_0x142c,0x163));var _0xc142=function(_0x5baee9,_0x416e7c){_0x5baee9=_0x5baee9-0x0;var _0x419234=_0x142c[_0x5baee9];return _0x419234;};'use strict';var _=require(_0xc142('0x0'));var util=require(_0xc142('0x1'));var logger=require(_0xc142('0x2'))(_0xc142('0x3'));var moment=require(_0xc142('0x4'));var BPromise=require(_0xc142('0x5'));var rp=require(_0xc142('0x6'));var fs=require('fs');var path=require(_0xc142('0x7'));var rimraf=require(_0xc142('0x8'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module[_0xc142('0x9')]=function(_0x583735,_0x531f02){return _0x583735[_0xc142('0xa')]('FaxTransferReport',attributes,{'tableName':_0xc142('0xb'),'paranoid':![],'indexes':[{'name':_0xc142('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb2ed=['FaxTransferReport','uniqueid','util','api','moment','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define'];(function(_0x25ba47,_0x51e785){var _0x1aafb8=function(_0x336fe8){while(--_0x336fe8){_0x25ba47['push'](_0x25ba47['shift']());}};_0x1aafb8(++_0x51e785);}(_0xb2ed,0x120));var _0xdb2e=function(_0x1d3577,_0x17a32e){_0x1d3577=_0x1d3577-0x0;var _0x277d9a=_0xb2ed[_0x1d3577];return _0x277d9a;};'use strict';var _=require('lodash');var util=require(_0xdb2e('0x0'));var logger=require('../../config/logger')(_0xdb2e('0x1'));var moment=require(_0xdb2e('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdb2e('0x3'));var rimraf=require(_0xdb2e('0x4'));var config=require(_0xdb2e('0x5'));var attributes=require(_0xdb2e('0x6'));module[_0xdb2e('0x7')]=function(_0xb4834c,_0x256bfc){return _0xb4834c[_0xdb2e('0x8')](_0xdb2e('0x9'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xdb2e('0xa'),'fields':[_0xdb2e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 15d3e25..b122ea0 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 _0x314c=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x2e6141,_0x3a472e){var _0x132d19=function(_0x4ab5fc){while(--_0x4ab5fc){_0x2e6141['push'](_0x2e6141['shift']());}};_0x132d19(++_0x3a472e);}(_0x314c,0x17a));var _0xc314=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x314c[_0x273c39];return _0x46d6b5;};'use strict';var _=require(_0xc314('0x0'));var util=require(_0xc314('0x1'));var moment=require(_0xc314('0x2'));var BPromise=require('bluebird');var rs=require(_0xc314('0x3'));var fs=require('fs');var Redis=require(_0xc314('0x4'));var db=require(_0xc314('0x5'))['db'];var utils=require(_0xc314('0x6'));var logger=require(_0xc314('0x7'))('rpc');var config=require(_0xc314('0x8'));var jayson=require(_0xc314('0x9'));var client=jayson[_0xc314('0xa')][_0xc314('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x165f59,_0x50ca52,_0x7eae71){return new BPromise(function(_0x5a37ec,_0xdd6673){return client['request'](_0x165f59,_0x7eae71)['then'](function(_0x34f644){logger[_0xc314('0xc')](_0xc314('0xd'),_0x50ca52,_0xc314('0xe'));logger[_0xc314('0xf')](_0xc314('0x10'),_0x50ca52,_0xc314('0xe'),JSON['stringify'](_0x34f644));if(_0x34f644[_0xc314('0x11')]){if(_0x34f644[_0xc314('0x11')][_0xc314('0x12')]===0x1f4){logger['error'](_0xc314('0xd'),_0x50ca52,_0x34f644[_0xc314('0x11')][_0xc314('0x13')]);return _0xdd6673(_0x34f644[_0xc314('0x11')][_0xc314('0x13')]);}logger[_0xc314('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x50ca52,_0x34f644[_0xc314('0x11')][_0xc314('0x13')]);return _0x5a37ec(_0x34f644['error']['message']);}else{logger[_0xc314('0xc')](_0xc314('0xd'),_0x50ca52,_0xc314('0xe'));_0x5a37ec(_0x34f644['result']['message']);}})[_0xc314('0x14')](function(_0xf522cc){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x50ca52,_0xf522cc);_0xdd6673(_0xf522cc);});});} \ No newline at end of file +var _0xfb83=['FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x5dedf5,_0x20c96e){var _0x4a30f0=function(_0x4ec00b){while(--_0x4ec00b){_0x5dedf5['push'](_0x5dedf5['shift']());}};_0x4a30f0(++_0x20c96e);}(_0xfb83,0x191));var _0x3fb8=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xfb83[_0xa148b7];return _0x51efd3;};'use strict';var _=require('lodash');var util=require(_0x3fb8('0x0'));var moment=require(_0x3fb8('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3fb8('0x2'));var db=require(_0x3fb8('0x3'))['db'];var utils=require(_0x3fb8('0x4'));var logger=require(_0x3fb8('0x5'))(_0x3fb8('0x6'));var config=require(_0x3fb8('0x7'));var jayson=require(_0x3fb8('0x8'));var client=jayson[_0x3fb8('0x9')][_0x3fb8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40f80c,_0x307858,_0x9986f5){return new BPromise(function(_0xf3eaab,_0x2369e3){return client[_0x3fb8('0xb')](_0x40f80c,_0x9986f5)[_0x3fb8('0xc')](function(_0x5cf329){logger['info'](_0x3fb8('0xd'),_0x307858,'request\x20sent');logger[_0x3fb8('0xe')](_0x3fb8('0xf'),_0x307858,_0x3fb8('0x10'),JSON['stringify'](_0x5cf329));if(_0x5cf329[_0x3fb8('0x11')]){if(_0x5cf329[_0x3fb8('0x11')][_0x3fb8('0x12')]===0x1f4){logger[_0x3fb8('0x11')](_0x3fb8('0xd'),_0x307858,_0x5cf329['error'][_0x3fb8('0x13')]);return _0x2369e3(_0x5cf329['error'][_0x3fb8('0x13')]);}logger[_0x3fb8('0x11')](_0x3fb8('0xd'),_0x307858,_0x5cf329[_0x3fb8('0x11')][_0x3fb8('0x13')]);return _0xf3eaab(_0x5cf329[_0x3fb8('0x11')][_0x3fb8('0x13')]);}else{logger[_0x3fb8('0x14')](_0x3fb8('0xd'),_0x307858,_0x3fb8('0x10'));_0xf3eaab(_0x5cf329[_0x3fb8('0x15')][_0x3fb8('0x13')]);}})[_0x3fb8('0x16')](function(_0x5bdcde){logger['error'](_0x3fb8('0xd'),_0x307858,_0x5bdcde);_0x2369e3(_0x5bdcde);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 4e65181..ea4ca36 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 _0x21cb=['./faxTransferReport.controller','get','isAuthenticated','index','describe','post','create','put','/:id','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2f6acc,_0x4c35ab){var _0xc775bc=function(_0x173504){while(--_0x173504){_0x2f6acc['push'](_0x2f6acc['shift']());}};_0xc775bc(++_0x4c35ab);}(_0x21cb,0x1cd));var _0xb21c=function(_0x2aa5d3,_0x320c98){_0x2aa5d3=_0x2aa5d3-0x0;var _0x597975=_0x21cb[_0x2aa5d3];return _0x597975;};'use strict';var multer=require(_0xb21c('0x0'));var util=require('util');var path=require(_0xb21c('0x1'));var timeout=require(_0xb21c('0x2'));var express=require(_0xb21c('0x3'));var router=express[_0xb21c('0x4')]();var fs_extra=require(_0xb21c('0x5'));var auth=require(_0xb21c('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb21c('0x7'));router[_0xb21c('0x8')]('/',auth[_0xb21c('0x9')](),controller[_0xb21c('0xa')]);router[_0xb21c('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xb21c('0xb')]);router[_0xb21c('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xb21c('0xc')]('/',auth[_0xb21c('0x9')](),controller[_0xb21c('0xd')]);router[_0xb21c('0xe')](_0xb21c('0xf'),auth[_0xb21c('0x9')](),controller[_0xb21c('0x10')]);router['delete'](_0xb21c('0xf'),auth[_0xb21c('0x9')](),controller[_0xb21c('0x11')]);module['exports']=router; \ No newline at end of file +var _0x7b52=['update','delete','/:id','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','describe','post','create'];(function(_0x52e161,_0x99a43d){var _0x4a990f=function(_0x5f2678){while(--_0x5f2678){_0x52e161['push'](_0x52e161['shift']());}};_0x4a990f(++_0x99a43d);}(_0x7b52,0x1f2));var _0x27b5=function(_0xd4d4aa,_0x5db1f0){_0xd4d4aa=_0xd4d4aa-0x0;var _0x3f2237=_0x7b52[_0xd4d4aa];return _0x3f2237;};'use strict';var multer=require('multer');var util=require(_0x27b5('0x0'));var path=require(_0x27b5('0x1'));var timeout=require(_0x27b5('0x2'));var express=require(_0x27b5('0x3'));var router=express[_0x27b5('0x4')]();var fs_extra=require(_0x27b5('0x5'));var auth=require(_0x27b5('0x6'));var interaction=require(_0x27b5('0x7'));var config=require(_0x27b5('0x8'));var controller=require(_0x27b5('0x9'));router[_0x27b5('0xa')]('/',auth[_0x27b5('0xb')](),controller['index']);router[_0x27b5('0xa')]('/describe',auth[_0x27b5('0xb')](),controller[_0x27b5('0xc')]);router['get']('/:id',auth[_0x27b5('0xb')](),controller['show']);router[_0x27b5('0xd')]('/',auth[_0x27b5('0xb')](),controller[_0x27b5('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x27b5('0xf')]);router[_0x27b5('0x10')](_0x27b5('0x11'),auth[_0x27b5('0xb')](),controller[_0x27b5('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index c33eb10..6fd4105 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 _0x8ebc=['/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ebc,0x70));var _0xc8eb=function(_0x5d3898,_0x489f5d){_0x5d3898=_0x5d3898-0x0;var _0x233dc9=_0x8ebc[_0x5d3898];return _0x233dc9;};'use strict';var multer=require(_0xc8eb('0x0'));var util=require(_0xc8eb('0x1'));var path=require(_0xc8eb('0x2'));var timeout=require(_0xc8eb('0x3'));var express=require(_0xc8eb('0x4'));var router=express['Router']();var fs_extra=require(_0xc8eb('0x5'));var auth=require(_0xc8eb('0x6'));var interaction=require(_0xc8eb('0x7'));var config=require(_0xc8eb('0x8'));var controller=require(_0xc8eb('0x9'));router[_0xc8eb('0xa')]('/',auth[_0xc8eb('0xb')](),controller[_0xc8eb('0xc')]);router[_0xc8eb('0xa')](_0xc8eb('0xd'),auth[_0xc8eb('0xb')](),controller['show']);router[_0xc8eb('0xa')](_0xc8eb('0xe'),auth['isAuthenticated'](),controller[_0xc8eb('0xf')]);router[_0xc8eb('0xa')](_0xc8eb('0x10'),auth[_0xc8eb('0xb')](),controller[_0xc8eb('0x11')]);router[_0xc8eb('0x12')]('/',auth[_0xc8eb('0xb')](),controller[_0xc8eb('0x13')]);router[_0xc8eb('0x12')]('/:id/configurations',auth[_0xc8eb('0xb')](),controller[_0xc8eb('0x14')]);router[_0xc8eb('0x15')](_0xc8eb('0xd'),auth[_0xc8eb('0xb')](),controller[_0xc8eb('0x16')]);router[_0xc8eb('0x17')]('/:id',auth[_0xc8eb('0xb')](),controller[_0xc8eb('0x18')]);module['exports']=router; \ No newline at end of file +var _0x971b=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer'];(function(_0x157571,_0x388342){var _0x1ce04c=function(_0x38b8b1){while(--_0x38b8b1){_0x157571['push'](_0x157571['shift']());}};_0x1ce04c(++_0x388342);}(_0x971b,0x81));var _0xb971=function(_0x38080e,_0x95512d){_0x38080e=_0x38080e-0x0;var _0x4e4c87=_0x971b[_0x38080e];return _0x4e4c87;};'use strict';var multer=require(_0xb971('0x0'));var util=require(_0xb971('0x1'));var path=require(_0xb971('0x2'));var timeout=require('connect-timeout');var express=require(_0xb971('0x3'));var router=express[_0xb971('0x4')]();var fs_extra=require(_0xb971('0x5'));var auth=require(_0xb971('0x6'));var interaction=require(_0xb971('0x7'));var config=require(_0xb971('0x8'));var controller=require(_0xb971('0x9'));router['get']('/',auth[_0xb971('0xa')](),controller[_0xb971('0xb')]);router[_0xb971('0xc')]('/:id',auth[_0xb971('0xa')](),controller[_0xb971('0xd')]);router['get'](_0xb971('0xe'),auth[_0xb971('0xa')](),controller[_0xb971('0xf')]);router[_0xb971('0xc')]('/:id/fields',auth[_0xb971('0xa')](),controller[_0xb971('0x10')]);router[_0xb971('0x11')]('/',auth['isAuthenticated'](),controller[_0xb971('0x12')]);router[_0xb971('0x11')]('/:id/configurations',auth[_0xb971('0xa')](),controller[_0xb971('0x13')]);router[_0xb971('0x14')](_0xb971('0x15'),auth['isAuthenticated'](),controller[_0xb971('0x16')]);router[_0xb971('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xb971('0x18')]);module[_0xb971('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 7c34697..fe549b4 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 _0x7ea9=['integrationTab','newTab','exports','STRING','basic'];(function(_0x3da2ad,_0x88e4b6){var _0x2f665d=function(_0x4d0fa1){while(--_0x4d0fa1){_0x3da2ad['push'](_0x3da2ad['shift']());}};_0x2f665d(++_0x88e4b6);}(_0x7ea9,0x110));var _0x97ea=function(_0x1cd597,_0x860c7e){_0x1cd597=_0x1cd597-0x0;var _0xce52f3=_0x7ea9[_0x1cd597];return _0xce52f3;};'use strict';var Sequelize=require('sequelize');module[_0x97ea('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x97ea('0x1')]},'username':{'type':Sequelize[_0x97ea('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0x97ea('0x2')),'defaultValue':_0x97ea('0x2')},'password':{'type':Sequelize[_0x97ea('0x1')]},'consumerKey':{'type':Sequelize[_0x97ea('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x97ea('0x1')]},'tokenSecret':{'type':Sequelize[_0x97ea('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x97ea('0x3'),_0x97ea('0x4')),'defaultValue':_0x97ea('0x3')}}; \ No newline at end of file +var _0xfc10=['integrationTab','newTab','sequelize','exports','STRING','ENUM'];(function(_0x461886,_0x4fc171){var _0x295e0a=function(_0x451524){while(--_0x451524){_0x461886['push'](_0x461886['shift']());}};_0x295e0a(++_0x4fc171);}(_0xfc10,0x158));var _0x0fc1=function(_0x4fb290,_0x2908ff){_0x4fb290=_0x4fb290-0x0;var _0x214675=_0xfc10[_0x4fb290];return _0x214675;};'use strict';var Sequelize=require(_0x0fc1('0x0'));module[_0x0fc1('0x1')]={'name':{'type':Sequelize[_0x0fc1('0x2')]},'description':{'type':Sequelize[_0x0fc1('0x2')]},'username':{'type':Sequelize[_0x0fc1('0x2')]},'remoteUri':{'type':Sequelize[_0x0fc1('0x2')]},'authType':{'type':Sequelize[_0x0fc1('0x3')]('basic'),'defaultValue':'basic'},'password':{'type':Sequelize[_0x0fc1('0x2')]},'consumerKey':{'type':Sequelize[_0x0fc1('0x2')]},'consumerSecret':{'type':Sequelize[_0x0fc1('0x2')]},'token':{'type':Sequelize[_0x0fc1('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x0fc1('0x3')](_0x0fc1('0x4'),_0x0fc1('0x5')),'defaultValue':_0x0fc1('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index c150191..d114008 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 _0x2942=['find','body','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','create','DeskField','Descriptions','getFields','priority','remoteUri','authType','username','password','consumerKey','slice','substring','lastIndexOf','GET','format','application/json','basic','Basic\x20%s','%s:%s','toString','concat','map','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','name','send','index','DeskAccount','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params'];(function(_0x48771b,_0x46a461){var _0x3996c6=function(_0x1bf0c0){while(--_0x1bf0c0){_0x48771b['push'](_0x48771b['shift']());}};_0x3996c6(++_0x46a461);}(_0x2942,0x9b));var _0x2294=function(_0x3271f5,_0x510ea1){_0x3271f5=_0x3271f5-0x0;var _0x18ac61=_0x2942[_0x3271f5];return _0x18ac61;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2294('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2294('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2294('0x2'));var Mustache=require(_0x2294('0x3'));var util=require(_0x2294('0x4'));var path=require(_0x2294('0x5'));var sox=require('sox');var csv=require(_0x2294('0x6'));var ejs=require(_0x2294('0x7'));var fs=require('fs');var fs_extra=require(_0x2294('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2294('0x9'));var jsforce=require(_0x2294('0xa'));var deskjs=require(_0x2294('0xb'));var toCsv=require(_0x2294('0x6'));var querystring=require(_0x2294('0xc'));var Papa=require(_0x2294('0xd'));var Redis=require(_0x2294('0xe'));var authService=require(_0x2294('0xf'));var qs=require(_0x2294('0x10'));var as=require(_0x2294('0x11'));var hardwareService=require(_0x2294('0x12'));var logger=require(_0x2294('0x13'))(_0x2294('0x14'));var utils=require('../../config/utils');var config=require(_0x2294('0x15'));var licenseUtil=require(_0x2294('0x16'));var db=require(_0x2294('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1577cc,_0x2a5a1f){_0x2a5a1f=_0x2a5a1f||0xcc;return function(_0xea6bb6){if(_0xea6bb6){return _0x1577cc[_0x2294('0x18')](_0x2a5a1f);}return _0x1577cc['status'](_0x2a5a1f)[_0x2294('0x19')]();};}function respondWithResult(_0x30bc53,_0x337b41){_0x337b41=_0x337b41||0xc8;return function(_0x4dab89){if(_0x4dab89){return _0x30bc53[_0x2294('0x1a')](_0x337b41)['json'](_0x4dab89);}};}function respondWithFilteredResult(_0x4111bd,_0x2db769){return function(_0x567443){if(_0x567443){var _0x345aaf=typeof _0x2db769[_0x2294('0x1b')]===_0x2294('0x1c')&&typeof _0x2db769[_0x2294('0x1d')]===_0x2294('0x1c');var _0x33882c=_0x567443['count'];var _0xdf834d=_0x345aaf?0x0:_0x2db769[_0x2294('0x1b')];var _0x54a38e=_0x345aaf?_0x567443['count']:_0x2db769[_0x2294('0x1b')]+_0x2db769[_0x2294('0x1d')];var _0x5edc65;if(_0x54a38e>=_0x33882c){_0x54a38e=_0x33882c;_0x5edc65=0xc8;}else{_0x5edc65=0xce;}_0x4111bd['status'](_0x5edc65);return _0x4111bd[_0x2294('0x1e')](_0x2294('0x1f'),_0xdf834d+'-'+_0x54a38e+'/'+_0x33882c)[_0x2294('0x20')](_0x567443);}return null;};}function patchUpdates(_0x25e261){return function(_0x3d3a16){try{jsonpatch[_0x2294('0x21')](_0x3d3a16,_0x25e261,!![]);}catch(_0x5eb3d8){return BPromise[_0x2294('0x22')](_0x5eb3d8);}return _0x3d3a16['save']();};}function saveUpdates(_0x2818af,_0x54fa8e){return function(_0x172229){if(_0x172229){return _0x172229[_0x2294('0x23')](_0x2818af)[_0x2294('0x24')](function(_0xaaecc9){return _0xaaecc9;});}return null;};}function removeEntity(_0x2eb249,_0x2bb08c){return function(_0x197f8b){if(_0x197f8b){return _0x197f8b[_0x2294('0x25')]()[_0x2294('0x24')](function(){_0x2eb249[_0x2294('0x1a')](0xcc)[_0x2294('0x19')]();});}};}function handleEntityNotFound(_0x25fb98,_0x1ec770){return function(_0x48e7ae){if(!_0x48e7ae){_0x25fb98[_0x2294('0x18')](0x194);}return _0x48e7ae;};}function handleError(_0xab161,_0x3091f4){_0x3091f4=_0x3091f4||0x1f4;return function(_0x3b51fd){logger[_0x2294('0x26')](_0x3b51fd['stack']);if(_0x3b51fd[_0x2294('0x27')]){delete _0x3b51fd[_0x2294('0x27')];}_0xab161[_0x2294('0x1a')](_0x3091f4)[_0x2294('0x28')](_0x3b51fd);};}exports[_0x2294('0x29')]=function(_0x1c8861,_0x126c43){var _0x56d5b3={},_0x4f0b9f={},_0x399c1a={'count':0x0,'rows':[]};var _0x131e63=_['map'](db[_0x2294('0x2a')][_0x2294('0x2b')],function(_0x566c31){return{'name':_0x566c31[_0x2294('0x2c')],'type':_0x566c31[_0x2294('0x2d')][_0x2294('0x2e')]};});_0x4f0b9f[_0x2294('0x2f')]=_['map'](_0x131e63,'name');_0x4f0b9f['query']=_[_0x2294('0x30')](_0x1c8861[_0x2294('0x31')]);_0x4f0b9f['filters']=_[_0x2294('0x32')](_0x4f0b9f[_0x2294('0x2f')],_0x4f0b9f[_0x2294('0x31')]);_0x56d5b3['attributes']=_[_0x2294('0x32')](_0x4f0b9f['model'],qs[_0x2294('0x33')](_0x1c8861['query'][_0x2294('0x33')]));_0x56d5b3[_0x2294('0x34')]=_0x56d5b3[_0x2294('0x34')][_0x2294('0x35')]?_0x56d5b3[_0x2294('0x34')]:_0x4f0b9f['model'];if(!_0x1c8861[_0x2294('0x31')][_0x2294('0x36')](_0x2294('0x37'))){_0x56d5b3[_0x2294('0x1d')]=qs[_0x2294('0x1d')](_0x1c8861[_0x2294('0x31')]['limit']);_0x56d5b3[_0x2294('0x1b')]=qs[_0x2294('0x1b')](_0x1c8861[_0x2294('0x31')]['offset']);}_0x56d5b3[_0x2294('0x38')]=qs['sort'](_0x1c8861['query'][_0x2294('0x39')]);_0x56d5b3[_0x2294('0x3a')]=qs[_0x2294('0x3b')](_[_0x2294('0x3c')](_0x1c8861[_0x2294('0x31')],_0x4f0b9f[_0x2294('0x3b')]),_0x131e63);if(_0x1c8861[_0x2294('0x31')][_0x2294('0x3d')]){_0x56d5b3['where']=_[_0x2294('0x3e')](_0x56d5b3[_0x2294('0x3a')],{'$or':_['map'](_0x131e63,function(_0x4032fe){if(_0x4032fe['type']!==_0x2294('0x3f')){var _0x3f812f={};_0x3f812f[_0x4032fe['name']]={'$like':'%'+_0x1c8861[_0x2294('0x31')]['filter']+'%'};return _0x3f812f;}})});}_0x56d5b3=_['merge']({},_0x56d5b3,_0x1c8861[_0x2294('0x40')]);var _0x4c9a71={'where':_0x56d5b3['where']};return db[_0x2294('0x2a')]['count'](_0x4c9a71)[_0x2294('0x24')](function(_0x1574ac){_0x399c1a[_0x2294('0x41')]=_0x1574ac;if(_0x1c8861[_0x2294('0x31')][_0x2294('0x42')]){_0x56d5b3[_0x2294('0x43')]=[{'all':!![]}];}return db[_0x2294('0x2a')][_0x2294('0x44')](_0x56d5b3);})[_0x2294('0x24')](function(_0x3da2cd){_0x399c1a[_0x2294('0x45')]=_0x3da2cd;return _0x399c1a;})[_0x2294('0x24')](respondWithFilteredResult(_0x126c43,_0x56d5b3))[_0x2294('0x46')](handleError(_0x126c43,null));};exports[_0x2294('0x47')]=function(_0x2031cd,_0x4fee01){var _0x231d6b={'raw':![],'where':{'id':_0x2031cd[_0x2294('0x48')]['id']}},_0x196dab={};_0x196dab[_0x2294('0x2f')]=_[_0x2294('0x30')](db[_0x2294('0x2a')][_0x2294('0x2b')]);_0x196dab[_0x2294('0x31')]=_['keys'](_0x2031cd[_0x2294('0x31')]);_0x196dab['filters']=_[_0x2294('0x32')](_0x196dab['model'],_0x196dab[_0x2294('0x31')]);_0x231d6b[_0x2294('0x34')]=_[_0x2294('0x32')](_0x196dab[_0x2294('0x2f')],qs[_0x2294('0x33')](_0x2031cd[_0x2294('0x31')][_0x2294('0x33')]));_0x231d6b['attributes']=_0x231d6b[_0x2294('0x34')]['length']?_0x231d6b[_0x2294('0x34')]:_0x196dab['model'];if(_0x2031cd[_0x2294('0x31')][_0x2294('0x42')]){_0x231d6b[_0x2294('0x43')]=[{'all':!![]}];}_0x231d6b=_[_0x2294('0x3e')]({},_0x231d6b,_0x2031cd[_0x2294('0x40')]);return db['DeskAccount'][_0x2294('0x49')](_0x231d6b)[_0x2294('0x24')](handleEntityNotFound(_0x4fee01,null))[_0x2294('0x24')](respondWithResult(_0x4fee01,null))[_0x2294('0x46')](handleError(_0x4fee01,null));};exports['create']=function(_0x20304b,_0x33d84e){return db[_0x2294('0x2a')]['create'](_0x20304b[_0x2294('0x4a')],{})[_0x2294('0x24')](respondWithResult(_0x33d84e,0xc9))[_0x2294('0x46')](handleError(_0x33d84e,null));};exports[_0x2294('0x23')]=function(_0x1db3e8,_0x290f56){if(_0x1db3e8[_0x2294('0x4a')]['id']){delete _0x1db3e8[_0x2294('0x4a')]['id'];}return db['DeskAccount'][_0x2294('0x49')]({'where':{'id':_0x1db3e8[_0x2294('0x48')]['id']}})[_0x2294('0x24')](handleEntityNotFound(_0x290f56,null))[_0x2294('0x24')](saveUpdates(_0x1db3e8['body'],null))[_0x2294('0x24')](respondWithResult(_0x290f56,null))['catch'](handleError(_0x290f56,null));};exports[_0x2294('0x25')]=function(_0x2b2974,_0x2e4900){return db[_0x2294('0x2a')][_0x2294('0x49')]({'where':{'id':_0x2b2974[_0x2294('0x48')]['id']}})[_0x2294('0x24')](handleEntityNotFound(_0x2e4900,null))[_0x2294('0x24')](removeEntity(_0x2e4900,null))[_0x2294('0x46')](handleError(_0x2e4900,null));};exports[_0x2294('0x4b')]=function(_0x5ecac2,_0x818c6a,_0x4379c3){var _0x29723d={};var _0x4f31d4={};var _0x25d742;var _0x2f5439;return db[_0x2294('0x2a')][_0x2294('0x4c')]({'where':{'id':_0x5ecac2[_0x2294('0x48')]['id']}})[_0x2294('0x24')](handleEntityNotFound(_0x818c6a,null))[_0x2294('0x24')](function(_0x89c068){if(_0x89c068){_0x25d742=_0x89c068;_0x4f31d4['model']=_[_0x2294('0x30')](db[_0x2294('0x4d')][_0x2294('0x2b')]);_0x4f31d4[_0x2294('0x31')]=_[_0x2294('0x30')](_0x5ecac2['query']);_0x4f31d4[_0x2294('0x3b')]=_[_0x2294('0x32')](_0x4f31d4[_0x2294('0x2f')],_0x4f31d4[_0x2294('0x31')]);_0x29723d['attributes']=_[_0x2294('0x32')](_0x4f31d4[_0x2294('0x2f')],qs[_0x2294('0x33')](_0x5ecac2[_0x2294('0x31')][_0x2294('0x33')]));_0x29723d[_0x2294('0x34')]=_0x29723d[_0x2294('0x34')]['length']?_0x29723d[_0x2294('0x34')]:_0x4f31d4['model'];_0x29723d[_0x2294('0x38')]=qs[_0x2294('0x39')](_0x5ecac2[_0x2294('0x31')][_0x2294('0x39')]);_0x29723d[_0x2294('0x3a')]=qs[_0x2294('0x3b')](_[_0x2294('0x3c')](_0x5ecac2[_0x2294('0x31')],_0x4f31d4[_0x2294('0x3b')]));if(_0x5ecac2[_0x2294('0x31')][_0x2294('0x3d')]){_0x29723d[_0x2294('0x3a')]=_['merge'](_0x29723d[_0x2294('0x3a')],{'$or':_['map'](_0x29723d[_0x2294('0x34')],function(_0x1accd7){var _0x5038f7={};_0x5038f7[_0x1accd7]={'$like':'%'+_0x5ecac2[_0x2294('0x31')][_0x2294('0x3d')]+'%'};return _0x5038f7;})});}_0x29723d=_['merge']({},_0x29723d,_0x5ecac2[_0x2294('0x40')]);return _0x25d742['getConfigurations'](_0x29723d);}})[_0x2294('0x24')](function(_0xc4ab68){if(_0xc4ab68){_0x2f5439=_0xc4ab68[_0x2294('0x35')];if(!_0x5ecac2[_0x2294('0x31')][_0x2294('0x36')](_0x2294('0x37'))){_0x29723d['limit']=qs[_0x2294('0x1d')](_0x5ecac2[_0x2294('0x31')]['limit']);_0x29723d[_0x2294('0x1b')]=qs[_0x2294('0x1b')](_0x5ecac2[_0x2294('0x31')][_0x2294('0x1b')]);}return _0x25d742[_0x2294('0x4b')](_0x29723d);}})[_0x2294('0x24')](function(_0x58245c){if(_0x58245c){return _0x58245c?{'count':_0x2f5439,'rows':_0x58245c}:null;}})['then'](respondWithResult(_0x818c6a,null))[_0x2294('0x46')](handleError(_0x818c6a,null));};exports[_0x2294('0x4e')]=function(_0x3bd06b,_0x1dde73,_0x4395b4){if(_0x3bd06b['body']['id']){delete _0x3bd06b[_0x2294('0x4a')]['id'];}return db[_0x2294('0x2a')][_0x2294('0x4c')]({'where':{'id':_0x3bd06b[_0x2294('0x48')]['id']}})[_0x2294('0x24')](handleEntityNotFound(_0x1dde73,null))[_0x2294('0x24')](function(_0x51f752){if(_0x51f752){_0x3bd06b['body'][_0x2294('0x4f')]=_0x51f752['id'];_0x3bd06b['body'][_0x2294('0x50')]=integrations[_0x2294('0x51')](_0x3bd06b[_0x2294('0x4a')][_0x2294('0x52')],_0x3bd06b[_0x2294('0x4a')][_0x2294('0x2d')]);_0x3bd06b['body']['Descriptions']=integrations[_0x2294('0x53')](_0x3bd06b[_0x2294('0x4a')][_0x2294('0x52')],_0x3bd06b[_0x2294('0x4a')][_0x2294('0x2d')]);return db[_0x2294('0x4d')][_0x2294('0x54')](_0x3bd06b[_0x2294('0x4a')],{'include':[{'model':db[_0x2294('0x55')],'as':_0x2294('0x50')},{'model':db[_0x2294('0x55')],'as':_0x2294('0x56')}]});}return null;})['then'](respondWithResult(_0x1dde73,null))[_0x2294('0x46')](handleError(_0x1dde73,null));};exports[_0x2294('0x57')]=function(_0x20f69b,_0x514857,_0x38b7e9){var _0x67e34a=[{'name':'priority','label':_0x2294('0x58'),'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 _0x389e3f='';return db[_0x2294('0x2a')][_0x2294('0x4c')]({'where':{'id':_0x20f69b[_0x2294('0x48')]['id']},'attributes':['id',_0x2294('0x59'),_0x2294('0x5a'),_0x2294('0x5b'),_0x2294('0x5c'),_0x2294('0x5d'),'consumerSecret','token','tokenSecret']})[_0x2294('0x24')](handleEntityNotFound(_0x514857,null))[_0x2294('0x24')](function(_0x2d044c){if(_0x2d044c){_0x389e3f=_0x2d044c['remoteUri'];var _0x4305f3=_0x389e3f[_0x2294('0x5e')](-0x1);if(_0x4305f3==='/'){_0x389e3f=_0x389e3f[_0x2294('0x5f')](0x0,_0x389e3f[_0x2294('0x60')](_0x4305f3));}var _0x1ffeb9={'method':_0x2294('0x61'),'uri':util[_0x2294('0x62')]('%s/custom_fields',_0x389e3f),'headers':{'Content-Type':_0x2294('0x63'),'Accept':_0x2294('0x63')},'json':!![]};if(_0x2d044c[_0x2294('0x5a')]===_0x2294('0x64')){_0x1ffeb9['headers']['Authorization']=util[_0x2294('0x62')](_0x2294('0x65'),new Buffer(util[_0x2294('0x62')](_0x2294('0x66'),_0x2d044c[_0x2294('0x5b')],_0x2d044c['password']))[_0x2294('0x67')]('base64'));}return rp(_0x1ffeb9)['then'](function(_0x331a66){return _0x67e34a[_0x2294('0x68')](_[_0x2294('0x69')](_0x331a66['_embedded'][_0x2294('0x6a')],function(_0x10adb5){return{'id':_0x10adb5[_0x2294('0x27')],'name':_0x10adb5[_0x2294('0x27')],'type':_0x10adb5['type'],'active':_0x10adb5[_0x2294('0x6b')],'label':_0x10adb5[_0x2294('0x6c')],'custom':!![]};}));});}})[_0x2294('0x24')](function(_0x2964c0){return{'count':_0x2964c0[_0x2294('0x35')],'rows':_0x2964c0};})[_0x2294('0x24')](respondWithResult(_0x514857,null))[_0x2294('0x46')](function(_0x9ba293){var _0x52b580=_0x20f69b[_0x2294('0x31')]['test']?0x1f4:_0x9ba293[_0x2294('0x6d')]||0x1f4;logger[_0x2294('0x26')](_0x2294('0x6e'),_0x2294('0x57'),_0x52b580,JSON[_0x2294('0x6f')](_0x9ba293));delete _0x9ba293[_0x2294('0x27')];if(_0x52b580===0x191){_0x52b580=0x190;}_0x514857['status'](_0x52b580)[_0x2294('0x28')](_0x20f69b[_0x2294('0x31')][_0x2294('0x70')]?{'message':_0x2294('0x71'),'statusCode':_0x9ba293[_0x2294('0x6d')]}:_0x9ba293);});}; \ No newline at end of file +var _0xe499=['crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','status','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','show','params','find','create','body','getConfigurations','findOne','DeskConfiguration','length','order','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','consumerKey','consumerSecret','token','tokenSecret','substring','lastIndexOf','format','application/json','headers','Authorization','Basic\x20%s','%s:%s','password','toString','concat','_embedded','entries','active','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xe499,0x1b0));var _0x9e49=function(_0xce8183,_0x567545){_0xce8183=_0xce8183-0x0;var _0x27c555=_0xe499[_0xce8183];return _0x27c555;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9e49('0x0'));var zipdir=require(_0x9e49('0x1'));var jsonpatch=require(_0x9e49('0x2'));var rp=require(_0x9e49('0x3'));var moment=require(_0x9e49('0x4'));var BPromise=require(_0x9e49('0x5'));var Mustache=require('mustache');var util=require(_0x9e49('0x6'));var path=require(_0x9e49('0x7'));var sox=require('sox');var csv=require(_0x9e49('0x8'));var ejs=require(_0x9e49('0x9'));var fs=require('fs');var fs_extra=require(_0x9e49('0xa'));var _=require('lodash');var squel=require(_0x9e49('0xb'));var crypto=require(_0x9e49('0xc'));var jsforce=require(_0x9e49('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9e49('0x8'));var querystring=require('querystring');var Papa=require(_0x9e49('0xe'));var Redis=require(_0x9e49('0xf'));var authService=require(_0x9e49('0x10'));var qs=require(_0x9e49('0x11'));var as=require(_0x9e49('0x12'));var hardwareService=require(_0x9e49('0x13'));var logger=require(_0x9e49('0x14'))('api');var utils=require(_0x9e49('0x15'));var config=require(_0x9e49('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9e49('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5727bd,_0x3a0e17){_0x3a0e17=_0x3a0e17||0xcc;return function(_0x2433f6){if(_0x2433f6){return _0x5727bd[_0x9e49('0x18')](_0x3a0e17);}return _0x5727bd['status'](_0x3a0e17)[_0x9e49('0x19')]();};}function respondWithResult(_0x3f9403,_0x3a4178){_0x3a4178=_0x3a4178||0xc8;return function(_0x39de94){if(_0x39de94){return _0x3f9403['status'](_0x3a4178)[_0x9e49('0x1a')](_0x39de94);}};}function respondWithFilteredResult(_0x5304ee,_0xd2a46f){return function(_0x93845d){if(_0x93845d){var _0x159f44=typeof _0xd2a46f[_0x9e49('0x1b')]===_0x9e49('0x1c')&&typeof _0xd2a46f['limit']===_0x9e49('0x1c');var _0x4888f4=_0x93845d[_0x9e49('0x1d')];var _0x2e8540=_0x159f44?0x0:_0xd2a46f['offset'];var _0x54ce54=_0x159f44?_0x93845d[_0x9e49('0x1d')]:_0xd2a46f['offset']+_0xd2a46f[_0x9e49('0x1e')];var _0x155e2b;if(_0x54ce54>=_0x4888f4){_0x54ce54=_0x4888f4;_0x155e2b=0xc8;}else{_0x155e2b=0xce;}_0x5304ee['status'](_0x155e2b);return _0x5304ee[_0x9e49('0x1f')](_0x9e49('0x20'),_0x2e8540+'-'+_0x54ce54+'/'+_0x4888f4)[_0x9e49('0x1a')](_0x93845d);}return null;};}function patchUpdates(_0x35373e){return function(_0x5845d3){try{jsonpatch[_0x9e49('0x21')](_0x5845d3,_0x35373e,!![]);}catch(_0x3cf9b3){return BPromise['reject'](_0x3cf9b3);}return _0x5845d3['save']();};}function saveUpdates(_0x3b2dd5,_0x4fc8fe){return function(_0x470c24){if(_0x470c24){return _0x470c24[_0x9e49('0x22')](_0x3b2dd5)[_0x9e49('0x23')](function(_0x5df2c3){return _0x5df2c3;});}return null;};}function removeEntity(_0x33b598,_0x3d2904){return function(_0x38db24){if(_0x38db24){return _0x38db24[_0x9e49('0x24')]()[_0x9e49('0x23')](function(){_0x33b598[_0x9e49('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x217f90,_0x3e9253){return function(_0x1e476b){if(!_0x1e476b){_0x217f90[_0x9e49('0x18')](0x194);}return _0x1e476b;};}function handleError(_0x336ce8,_0x495e35){_0x495e35=_0x495e35||0x1f4;return function(_0x3808d1){logger['error'](_0x3808d1[_0x9e49('0x26')]);if(_0x3808d1[_0x9e49('0x27')]){delete _0x3808d1[_0x9e49('0x27')];}_0x336ce8['status'](_0x495e35)[_0x9e49('0x28')](_0x3808d1);};}exports[_0x9e49('0x29')]=function(_0x5b87bb,_0x31077a){var _0x3be6ba={},_0x44417e={},_0x50ad16={'count':0x0,'rows':[]};var _0x25229a=_[_0x9e49('0x2a')](db[_0x9e49('0x2b')][_0x9e49('0x2c')],function(_0x1e3d36){return{'name':_0x1e3d36[_0x9e49('0x2d')],'type':_0x1e3d36[_0x9e49('0x2e')][_0x9e49('0x2f')]};});_0x44417e[_0x9e49('0x30')]=_[_0x9e49('0x2a')](_0x25229a,'name');_0x44417e['query']=_[_0x9e49('0x31')](_0x5b87bb[_0x9e49('0x32')]);_0x44417e[_0x9e49('0x33')]=_['intersection'](_0x44417e[_0x9e49('0x30')],_0x44417e[_0x9e49('0x32')]);_0x3be6ba[_0x9e49('0x34')]=_[_0x9e49('0x35')](_0x44417e[_0x9e49('0x30')],qs['fields'](_0x5b87bb[_0x9e49('0x32')][_0x9e49('0x36')]));_0x3be6ba[_0x9e49('0x34')]=_0x3be6ba[_0x9e49('0x34')]['length']?_0x3be6ba['attributes']:_0x44417e[_0x9e49('0x30')];if(!_0x5b87bb[_0x9e49('0x32')][_0x9e49('0x37')](_0x9e49('0x38'))){_0x3be6ba[_0x9e49('0x1e')]=qs[_0x9e49('0x1e')](_0x5b87bb[_0x9e49('0x32')][_0x9e49('0x1e')]);_0x3be6ba['offset']=qs[_0x9e49('0x1b')](_0x5b87bb[_0x9e49('0x32')]['offset']);}_0x3be6ba['order']=qs[_0x9e49('0x39')](_0x5b87bb['query'][_0x9e49('0x39')]);_0x3be6ba['where']=qs[_0x9e49('0x33')](_[_0x9e49('0x3a')](_0x5b87bb[_0x9e49('0x32')],_0x44417e['filters']),_0x25229a);if(_0x5b87bb[_0x9e49('0x32')][_0x9e49('0x3b')]){_0x3be6ba['where']=_['merge'](_0x3be6ba[_0x9e49('0x3c')],{'$or':_[_0x9e49('0x2a')](_0x25229a,function(_0x51fccf){if(_0x51fccf[_0x9e49('0x2e')]!=='VIRTUAL'){var _0x407361={};_0x407361[_0x51fccf['name']]={'$like':'%'+_0x5b87bb[_0x9e49('0x32')][_0x9e49('0x3b')]+'%'};return _0x407361;}})});}_0x3be6ba=_[_0x9e49('0x3d')]({},_0x3be6ba,_0x5b87bb[_0x9e49('0x3e')]);var _0x1d104e={'where':_0x3be6ba[_0x9e49('0x3c')]};return db['DeskAccount']['count'](_0x1d104e)[_0x9e49('0x23')](function(_0x1e0d5d){_0x50ad16['count']=_0x1e0d5d;if(_0x5b87bb[_0x9e49('0x32')][_0x9e49('0x3f')]){_0x3be6ba[_0x9e49('0x40')]=[{'all':!![]}];}return db[_0x9e49('0x2b')]['findAll'](_0x3be6ba);})[_0x9e49('0x23')](function(_0x60d452){_0x50ad16[_0x9e49('0x41')]=_0x60d452;return _0x50ad16;})[_0x9e49('0x23')](respondWithFilteredResult(_0x31077a,_0x3be6ba))[_0x9e49('0x42')](handleError(_0x31077a,null));};exports[_0x9e49('0x43')]=function(_0xdc1301,_0xa19381){var _0xdeb399={'raw':![],'where':{'id':_0xdc1301[_0x9e49('0x44')]['id']}},_0x246818={};_0x246818[_0x9e49('0x30')]=_[_0x9e49('0x31')](db[_0x9e49('0x2b')][_0x9e49('0x2c')]);_0x246818[_0x9e49('0x32')]=_[_0x9e49('0x31')](_0xdc1301[_0x9e49('0x32')]);_0x246818['filters']=_[_0x9e49('0x35')](_0x246818[_0x9e49('0x30')],_0x246818[_0x9e49('0x32')]);_0xdeb399[_0x9e49('0x34')]=_[_0x9e49('0x35')](_0x246818[_0x9e49('0x30')],qs[_0x9e49('0x36')](_0xdc1301[_0x9e49('0x32')][_0x9e49('0x36')]));_0xdeb399[_0x9e49('0x34')]=_0xdeb399[_0x9e49('0x34')]['length']?_0xdeb399[_0x9e49('0x34')]:_0x246818['model'];if(_0xdc1301['query'][_0x9e49('0x3f')]){_0xdeb399[_0x9e49('0x40')]=[{'all':!![]}];}_0xdeb399=_['merge']({},_0xdeb399,_0xdc1301[_0x9e49('0x3e')]);return db[_0x9e49('0x2b')][_0x9e49('0x45')](_0xdeb399)[_0x9e49('0x23')](handleEntityNotFound(_0xa19381,null))[_0x9e49('0x23')](respondWithResult(_0xa19381,null))[_0x9e49('0x42')](handleError(_0xa19381,null));};exports[_0x9e49('0x46')]=function(_0x471f56,_0x3fe439){return db[_0x9e49('0x2b')][_0x9e49('0x46')](_0x471f56['body'],{})[_0x9e49('0x23')](respondWithResult(_0x3fe439,0xc9))[_0x9e49('0x42')](handleError(_0x3fe439,null));};exports[_0x9e49('0x22')]=function(_0x5c29cc,_0xc11123){if(_0x5c29cc[_0x9e49('0x47')]['id']){delete _0x5c29cc['body']['id'];}return db[_0x9e49('0x2b')][_0x9e49('0x45')]({'where':{'id':_0x5c29cc[_0x9e49('0x44')]['id']}})[_0x9e49('0x23')](handleEntityNotFound(_0xc11123,null))[_0x9e49('0x23')](saveUpdates(_0x5c29cc[_0x9e49('0x47')],null))[_0x9e49('0x23')](respondWithResult(_0xc11123,null))[_0x9e49('0x42')](handleError(_0xc11123,null));};exports[_0x9e49('0x24')]=function(_0x3767e5,_0x4b6491){return db[_0x9e49('0x2b')]['find']({'where':{'id':_0x3767e5[_0x9e49('0x44')]['id']}})[_0x9e49('0x23')](handleEntityNotFound(_0x4b6491,null))[_0x9e49('0x23')](removeEntity(_0x4b6491,null))['catch'](handleError(_0x4b6491,null));};exports[_0x9e49('0x48')]=function(_0x6f520c,_0x98370f,_0x5d61da){var _0x22a239={};var _0x3978bb={};var _0x1ac765;var _0x41bb6c;return db['DeskAccount'][_0x9e49('0x49')]({'where':{'id':_0x6f520c[_0x9e49('0x44')]['id']}})['then'](handleEntityNotFound(_0x98370f,null))[_0x9e49('0x23')](function(_0xeaa6ac){if(_0xeaa6ac){_0x1ac765=_0xeaa6ac;_0x3978bb[_0x9e49('0x30')]=_[_0x9e49('0x31')](db[_0x9e49('0x4a')][_0x9e49('0x2c')]);_0x3978bb[_0x9e49('0x32')]=_[_0x9e49('0x31')](_0x6f520c[_0x9e49('0x32')]);_0x3978bb['filters']=_['intersection'](_0x3978bb[_0x9e49('0x30')],_0x3978bb['query']);_0x22a239[_0x9e49('0x34')]=_['intersection'](_0x3978bb['model'],qs['fields'](_0x6f520c[_0x9e49('0x32')][_0x9e49('0x36')]));_0x22a239[_0x9e49('0x34')]=_0x22a239[_0x9e49('0x34')][_0x9e49('0x4b')]?_0x22a239[_0x9e49('0x34')]:_0x3978bb[_0x9e49('0x30')];_0x22a239[_0x9e49('0x4c')]=qs['sort'](_0x6f520c[_0x9e49('0x32')][_0x9e49('0x39')]);_0x22a239[_0x9e49('0x3c')]=qs[_0x9e49('0x33')](_[_0x9e49('0x3a')](_0x6f520c[_0x9e49('0x32')],_0x3978bb[_0x9e49('0x33')]));if(_0x6f520c[_0x9e49('0x32')]['filter']){_0x22a239[_0x9e49('0x3c')]=_[_0x9e49('0x3d')](_0x22a239['where'],{'$or':_[_0x9e49('0x2a')](_0x22a239[_0x9e49('0x34')],function(_0x4509e6){var _0x41db69={};_0x41db69[_0x4509e6]={'$like':'%'+_0x6f520c[_0x9e49('0x32')][_0x9e49('0x3b')]+'%'};return _0x41db69;})});}_0x22a239=_[_0x9e49('0x3d')]({},_0x22a239,_0x6f520c['options']);return _0x1ac765[_0x9e49('0x48')](_0x22a239);}})[_0x9e49('0x23')](function(_0x32571d){if(_0x32571d){_0x41bb6c=_0x32571d[_0x9e49('0x4b')];if(!_0x6f520c[_0x9e49('0x32')]['hasOwnProperty']('nolimit')){_0x22a239[_0x9e49('0x1e')]=qs[_0x9e49('0x1e')](_0x6f520c['query'][_0x9e49('0x1e')]);_0x22a239[_0x9e49('0x1b')]=qs[_0x9e49('0x1b')](_0x6f520c['query']['offset']);}return _0x1ac765[_0x9e49('0x48')](_0x22a239);}})['then'](function(_0x130421){if(_0x130421){return _0x130421?{'count':_0x41bb6c,'rows':_0x130421}:null;}})[_0x9e49('0x23')](respondWithResult(_0x98370f,null))[_0x9e49('0x42')](handleError(_0x98370f,null));};exports[_0x9e49('0x4d')]=function(_0x530f7b,_0x47aefd,_0x5566ea){if(_0x530f7b[_0x9e49('0x47')]['id']){delete _0x530f7b[_0x9e49('0x47')]['id'];}return db[_0x9e49('0x2b')]['findOne']({'where':{'id':_0x530f7b['params']['id']}})[_0x9e49('0x23')](handleEntityNotFound(_0x47aefd,null))[_0x9e49('0x23')](function(_0x4e05df){if(_0x4e05df){_0x530f7b[_0x9e49('0x47')]['AccountId']=_0x4e05df['id'];_0x530f7b[_0x9e49('0x47')][_0x9e49('0x4e')]=integrations[_0x9e49('0x4f')](_0x530f7b[_0x9e49('0x47')][_0x9e49('0x50')],_0x530f7b[_0x9e49('0x47')][_0x9e49('0x2e')]);_0x530f7b[_0x9e49('0x47')][_0x9e49('0x51')]=integrations[_0x9e49('0x52')](_0x530f7b['body'][_0x9e49('0x50')],_0x530f7b[_0x9e49('0x47')][_0x9e49('0x2e')]);return db['DeskConfiguration'][_0x9e49('0x46')](_0x530f7b[_0x9e49('0x47')],{'include':[{'model':db['DeskField'],'as':_0x9e49('0x4e')},{'model':db[_0x9e49('0x53')],'as':_0x9e49('0x51')}]});}return null;})[_0x9e49('0x23')](respondWithResult(_0x47aefd,null))[_0x9e49('0x42')](handleError(_0x47aefd,null));};exports[_0x9e49('0x54')]=function(_0x49537d,_0x1976ca,_0x2b6e88){var _0x4c8882=[{'name':_0x9e49('0x55'),'label':_0x9e49('0x55'),'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 _0x51686b='';return db[_0x9e49('0x2b')]['findOne']({'where':{'id':_0x49537d[_0x9e49('0x44')]['id']},'attributes':['id',_0x9e49('0x56'),_0x9e49('0x57'),_0x9e49('0x58'),'password',_0x9e49('0x59'),_0x9e49('0x5a'),_0x9e49('0x5b'),_0x9e49('0x5c')]})[_0x9e49('0x23')](handleEntityNotFound(_0x1976ca,null))['then'](function(_0x5af380){if(_0x5af380){_0x51686b=_0x5af380['remoteUri'];var _0x3c7cd9=_0x51686b['slice'](-0x1);if(_0x3c7cd9==='/'){_0x51686b=_0x51686b[_0x9e49('0x5d')](0x0,_0x51686b[_0x9e49('0x5e')](_0x3c7cd9));}var _0x2b7430={'method':'GET','uri':util[_0x9e49('0x5f')]('%s/custom_fields',_0x51686b),'headers':{'Content-Type':_0x9e49('0x60'),'Accept':_0x9e49('0x60')},'json':!![]};if(_0x5af380[_0x9e49('0x57')]==='basic'){_0x2b7430[_0x9e49('0x61')][_0x9e49('0x62')]=util[_0x9e49('0x5f')](_0x9e49('0x63'),new Buffer(util[_0x9e49('0x5f')](_0x9e49('0x64'),_0x5af380[_0x9e49('0x58')],_0x5af380[_0x9e49('0x65')]))[_0x9e49('0x66')]('base64'));}return rp(_0x2b7430)[_0x9e49('0x23')](function(_0x271886){return _0x4c8882[_0x9e49('0x67')](_['map'](_0x271886[_0x9e49('0x68')][_0x9e49('0x69')],function(_0x1628e2){return{'id':_0x1628e2[_0x9e49('0x27')],'name':_0x1628e2['name'],'type':_0x1628e2['type'],'active':_0x1628e2[_0x9e49('0x6a')],'label':_0x1628e2['label'],'custom':!![]};}));});}})[_0x9e49('0x23')](function(_0x7106d3){return{'count':_0x7106d3[_0x9e49('0x4b')],'rows':_0x7106d3};})[_0x9e49('0x23')](respondWithResult(_0x1976ca,null))[_0x9e49('0x42')](function(_0x3df480){var _0x35f05f=_0x49537d[_0x9e49('0x32')][_0x9e49('0x6b')]?0x1f4:_0x3df480[_0x9e49('0x6c')]||0x1f4;logger[_0x9e49('0x6d')](_0x9e49('0x6e'),_0x9e49('0x54'),_0x35f05f,JSON['stringify'](_0x3df480));delete _0x3df480[_0x9e49('0x27')];if(_0x35f05f===0x191){_0x35f05f=0x190;}_0x1976ca[_0x9e49('0x25')](_0x35f05f)[_0x9e49('0x28')](_0x49537d[_0x9e49('0x32')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x3df480[_0x9e49('0x6c')]}:_0x3df480);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 2da88c5..2360a1f 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 _0xa035=['../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','int_desk_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xa035,0x179));var _0x5a03=function(_0x4be9bf,_0xeeade9){_0x4be9bf=_0x4be9bf-0x0;var _0x2388b6=_0xa035[_0x4be9bf];return _0x2388b6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5a03('0x0'))(_0x5a03('0x1'));var moment=require(_0x5a03('0x2'));var BPromise=require(_0x5a03('0x3'));var rp=require(_0x5a03('0x4'));var fs=require('fs');var path=require(_0x5a03('0x5'));var rimraf=require(_0x5a03('0x6'));var config=require(_0x5a03('0x7'));var attributes=require(_0x5a03('0x8'));var integrations=require(_0x5a03('0x9'));module['exports']=function(_0x4e5c19,_0x5146b7){return _0x4e5c19[_0x5a03('0xa')]('DeskAccount',attributes,{'tableName':_0x5a03('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84d9=['int_desk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount'];(function(_0x34e148,_0x3b91c1){var _0x15ed0c=function(_0x289596){while(--_0x289596){_0x34e148['push'](_0x34e148['shift']());}};_0x15ed0c(++_0x3b91c1);}(_0x84d9,0x12d));var _0x984d=function(_0x20366e,_0x4e9109){_0x20366e=_0x20366e-0x0;var _0x582c3a=_0x84d9[_0x20366e];return _0x582c3a;};'use strict';var _=require(_0x984d('0x0'));var util=require(_0x984d('0x1'));var logger=require(_0x984d('0x2'))(_0x984d('0x3'));var moment=require(_0x984d('0x4'));var BPromise=require(_0x984d('0x5'));var rp=require(_0x984d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x984d('0x7'));var config=require(_0x984d('0x8'));var attributes=require(_0x984d('0x9'));var integrations=require(_0x984d('0xa'));module[_0x984d('0xb')]=function(_0x46e1f8,_0xbf41cc){return _0x46e1f8[_0x984d('0xc')](_0x984d('0xd'),attributes,{'tableName':_0x984d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 9aa9238..2bcfd72 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 _0x47b0=['model','ShowDeskAccount','find','raw','debug','util','moment','randomstring','rpc','../../config/environment','jayson/promise','client','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','where','attributes','limit','include','map'];(function(_0x3f4f05,_0x55b135){var _0x3ad4d2=function(_0x207e5b){while(--_0x207e5b){_0x3f4f05['push'](_0x3f4f05['shift']());}};_0x3ad4d2(++_0x55b135);}(_0x47b0,0x1f4));var _0x047b=function(_0x3246a6,_0x2a685a){_0x3246a6=_0x3246a6-0x0;var _0x1df64d=_0x47b0[_0x3246a6];return _0x1df64d;};'use strict';var _=require('lodash');var util=require(_0x047b('0x0'));var moment=require(_0x047b('0x1'));var BPromise=require('bluebird');var rs=require(_0x047b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x047b('0x3'));var config=require(_0x047b('0x4'));var jayson=require(_0x047b('0x5'));var client=jayson[_0x047b('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43e19f,_0x2332ba,_0x2cb988){return new BPromise(function(_0x3b5c8a,_0x28a043){return client[_0x047b('0x7')](_0x43e19f,_0x2cb988)[_0x047b('0x8')](function(_0x36b1df){logger[_0x047b('0x9')](_0x047b('0xa'),_0x2332ba,_0x047b('0xb'));logger['debug'](_0x047b('0xc'),_0x2332ba,'request\x20sent',JSON[_0x047b('0xd')](_0x36b1df));if(_0x36b1df[_0x047b('0xe')]){if(_0x36b1df['error'][_0x047b('0xf')]===0x1f4){logger['error'](_0x047b('0xa'),_0x2332ba,_0x36b1df[_0x047b('0xe')][_0x047b('0x10')]);return _0x28a043(_0x36b1df[_0x047b('0xe')][_0x047b('0x10')]);}logger[_0x047b('0xe')](_0x047b('0xa'),_0x2332ba,_0x36b1df[_0x047b('0xe')]['message']);return _0x3b5c8a(_0x36b1df['error'][_0x047b('0x10')]);}else{logger[_0x047b('0x9')](_0x047b('0xa'),_0x2332ba,_0x047b('0xb'));_0x3b5c8a(_0x36b1df[_0x047b('0x11')][_0x047b('0x10')]);}})[_0x047b('0x12')](function(_0x286e9f){logger[_0x047b('0xe')](_0x047b('0xa'),_0x2332ba,_0x286e9f);_0x28a043(_0x286e9f);});});}exports[_0x047b('0x13')]=function(_0x164c78){var _0x773318=this;return new Promise(function(_0x4938e6,_0x2d25d9){return db[_0x047b('0x14')][_0x047b('0x15')]({'raw':_0x164c78['options']?_0x164c78[_0x047b('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x164c78[_0x047b('0x16')]?_0x164c78[_0x047b('0x16')][_0x047b('0x17')]||null:null,'attributes':_0x164c78[_0x047b('0x16')]?_0x164c78['options'][_0x047b('0x18')]||null:null,'limit':_0x164c78['options']?_0x164c78[_0x047b('0x16')][_0x047b('0x19')]||null:null,'include':_0x164c78[_0x047b('0x16')]?_0x164c78[_0x047b('0x16')][_0x047b('0x1a')]?_[_0x047b('0x1b')](_0x164c78['options'][_0x047b('0x1a')],function(_0x29274f){return{'model':db[_0x29274f[_0x047b('0x1c')]],'as':_0x29274f['as'],'attributes':_0x29274f['attributes'],'include':_0x29274f[_0x047b('0x1a')]?_['map'](_0x29274f[_0x047b('0x1a')],function(_0x11b7ec){return{'model':db[_0x11b7ec[_0x047b('0x1c')]],'as':_0x11b7ec['as'],'attributes':_0x11b7ec[_0x047b('0x18')],'include':_0x11b7ec[_0x047b('0x1a')]?_[_0x047b('0x1b')](_0x11b7ec[_0x047b('0x1a')],function(_0x58cec5){return{'model':db[_0x58cec5[_0x047b('0x1c')]],'as':_0x58cec5['as'],'attributes':_0x58cec5[_0x047b('0x18')]};}):[]};}):[]};}):[]:[]})[_0x047b('0x8')](function(_0x29809d){logger['info'](_0x047b('0x13'),_0x164c78);logger['debug']('GetDeskAccount',_0x164c78,JSON[_0x047b('0xd')](_0x29809d));_0x4938e6(_0x29809d);})[_0x047b('0x12')](function(_0x588b74){logger[_0x047b('0xe')](_0x047b('0x13'),_0x588b74['message'],_0x164c78);_0x2d25d9(_0x773318[_0x047b('0xe')](0x1f4,_0x588b74[_0x047b('0x10')]));});});};exports[_0x047b('0x1d')]=function(_0x424b82){var _0x326eb3=this;return new Promise(function(_0x3fc52f,_0x1e1672){return db['DeskAccount'][_0x047b('0x1e')]({'raw':_0x424b82[_0x047b('0x16')]?_0x424b82[_0x047b('0x16')][_0x047b('0x1f')]===undefined?!![]:![]:!![],'where':_0x424b82['options']?_0x424b82[_0x047b('0x16')]['where']||null:null,'attributes':_0x424b82[_0x047b('0x16')]?_0x424b82[_0x047b('0x16')][_0x047b('0x18')]||null:null,'include':_0x424b82[_0x047b('0x16')]?_0x424b82[_0x047b('0x16')]['include']?_[_0x047b('0x1b')](_0x424b82['options'][_0x047b('0x1a')],function(_0x412534){return{'model':db[_0x412534[_0x047b('0x1c')]],'as':_0x412534['as'],'attributes':_0x412534[_0x047b('0x18')],'include':_0x412534[_0x047b('0x1a')]?_[_0x047b('0x1b')](_0x412534[_0x047b('0x1a')],function(_0x5a80dc){return{'model':db[_0x5a80dc[_0x047b('0x1c')]],'as':_0x5a80dc['as'],'attributes':_0x5a80dc[_0x047b('0x18')],'include':_0x5a80dc[_0x047b('0x1a')]?_[_0x047b('0x1b')](_0x5a80dc[_0x047b('0x1a')],function(_0x339a48){return{'model':db[_0x339a48[_0x047b('0x1c')]],'as':_0x339a48['as'],'attributes':_0x339a48[_0x047b('0x18')]};}):[]};}):[]};}):[]:[]})[_0x047b('0x8')](function(_0xdf00b3){logger[_0x047b('0x9')](_0x047b('0x1d'),_0x424b82);logger[_0x047b('0x20')](_0x047b('0x1d'),_0x424b82,JSON[_0x047b('0xd')](_0xdf00b3));_0x3fc52f(_0xdf00b3);})[_0x047b('0x12')](function(_0x2f4c9b){logger[_0x047b('0xe')](_0x047b('0x1d'),_0x2f4c9b[_0x047b('0x10')],_0x424b82);_0x1e1672(_0x326eb3[_0x047b('0xe')](0x1f4,_0x2f4c9b['message']));});});}; \ No newline at end of file +var _0x735d=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetDeskAccount','ShowDeskAccount','find','stringify'];(function(_0x2d9043,_0x4d3914){var _0x30dbbe=function(_0x5433b6){while(--_0x5433b6){_0x2d9043['push'](_0x2d9043['shift']());}};_0x30dbbe(++_0x4d3914);}(_0x735d,0x15e));var _0xd735=function(_0x15876a,_0x15383d){_0x15876a=_0x15876a-0x0;var _0xbd900f=_0x735d[_0x15876a];return _0xbd900f;};'use strict';var _=require(_0xd735('0x0'));var util=require(_0xd735('0x1'));var moment=require(_0xd735('0x2'));var BPromise=require('bluebird');var rs=require(_0xd735('0x3'));var fs=require('fs');var Redis=require(_0xd735('0x4'));var db=require(_0xd735('0x5'))['db'];var utils=require(_0xd735('0x6'));var logger=require(_0xd735('0x7'))(_0xd735('0x8'));var config=require(_0xd735('0x9'));var jayson=require(_0xd735('0xa'));var client=jayson[_0xd735('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x353d7f,_0x251420,_0x8e964b){return new BPromise(function(_0x5e250c,_0x232d07){return client['request'](_0x353d7f,_0x8e964b)[_0xd735('0xc')](function(_0x56fa88){logger['info'](_0xd735('0xd'),_0x251420,_0xd735('0xe'));logger[_0xd735('0xf')](_0xd735('0x10'),_0x251420,'request\x20sent',JSON['stringify'](_0x56fa88));if(_0x56fa88[_0xd735('0x11')]){if(_0x56fa88[_0xd735('0x11')][_0xd735('0x12')]===0x1f4){logger[_0xd735('0x11')]('DeskAccount,\x20%s,\x20%s',_0x251420,_0x56fa88['error'][_0xd735('0x13')]);return _0x232d07(_0x56fa88[_0xd735('0x11')][_0xd735('0x13')]);}logger[_0xd735('0x11')](_0xd735('0xd'),_0x251420,_0x56fa88[_0xd735('0x11')][_0xd735('0x13')]);return _0x5e250c(_0x56fa88['error'][_0xd735('0x13')]);}else{logger[_0xd735('0x14')]('DeskAccount,\x20%s,\x20%s',_0x251420,_0xd735('0xe'));_0x5e250c(_0x56fa88['result'][_0xd735('0x13')]);}})[_0xd735('0x15')](function(_0x1c816c){logger[_0xd735('0x11')]('DeskAccount,\x20%s,\x20%s',_0x251420,_0x1c816c);_0x232d07(_0x1c816c);});});}exports['GetDeskAccount']=function(_0x63424f){var _0x2dcd9c=this;return new Promise(function(_0x3effef,_0x13a46d){return db['DeskAccount'][_0xd735('0x16')]({'raw':_0x63424f[_0xd735('0x17')]?_0x63424f[_0xd735('0x17')][_0xd735('0x18')]===undefined?!![]:![]:!![],'where':_0x63424f[_0xd735('0x17')]?_0x63424f['options'][_0xd735('0x19')]||null:null,'attributes':_0x63424f[_0xd735('0x17')]?_0x63424f[_0xd735('0x17')][_0xd735('0x1a')]||null:null,'limit':_0x63424f[_0xd735('0x17')]?_0x63424f[_0xd735('0x17')][_0xd735('0x1b')]||null:null,'include':_0x63424f[_0xd735('0x17')]?_0x63424f[_0xd735('0x17')][_0xd735('0x1c')]?_[_0xd735('0x1d')](_0x63424f[_0xd735('0x17')][_0xd735('0x1c')],function(_0x2a005d){return{'model':db[_0x2a005d['model']],'as':_0x2a005d['as'],'attributes':_0x2a005d[_0xd735('0x1a')],'include':_0x2a005d['include']?_[_0xd735('0x1d')](_0x2a005d[_0xd735('0x1c')],function(_0x2e01d4){return{'model':db[_0x2e01d4[_0xd735('0x1e')]],'as':_0x2e01d4['as'],'attributes':_0x2e01d4[_0xd735('0x1a')],'include':_0x2e01d4[_0xd735('0x1c')]?_[_0xd735('0x1d')](_0x2e01d4[_0xd735('0x1c')],function(_0x13b9de){return{'model':db[_0x13b9de['model']],'as':_0x13b9de['as'],'attributes':_0x13b9de[_0xd735('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd735('0xc')](function(_0x4f748a){logger[_0xd735('0x14')]('GetDeskAccount',_0x63424f);logger[_0xd735('0xf')](_0xd735('0x1f'),_0x63424f,JSON['stringify'](_0x4f748a));_0x3effef(_0x4f748a);})[_0xd735('0x15')](function(_0x2a4c1d){logger[_0xd735('0x11')](_0xd735('0x1f'),_0x2a4c1d[_0xd735('0x13')],_0x63424f);_0x13a46d(_0x2dcd9c['error'](0x1f4,_0x2a4c1d[_0xd735('0x13')]));});});};exports[_0xd735('0x20')]=function(_0x3d9dc3){var _0x2dadeb=this;return new Promise(function(_0x32a206,_0x57cd98){return db['DeskAccount'][_0xd735('0x21')]({'raw':_0x3d9dc3['options']?_0x3d9dc3[_0xd735('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3d9dc3[_0xd735('0x17')]?_0x3d9dc3[_0xd735('0x17')][_0xd735('0x19')]||null:null,'attributes':_0x3d9dc3[_0xd735('0x17')]?_0x3d9dc3[_0xd735('0x17')]['attributes']||null:null,'include':_0x3d9dc3['options']?_0x3d9dc3[_0xd735('0x17')]['include']?_[_0xd735('0x1d')](_0x3d9dc3[_0xd735('0x17')][_0xd735('0x1c')],function(_0x20ed3b){return{'model':db[_0x20ed3b[_0xd735('0x1e')]],'as':_0x20ed3b['as'],'attributes':_0x20ed3b[_0xd735('0x1a')],'include':_0x20ed3b[_0xd735('0x1c')]?_[_0xd735('0x1d')](_0x20ed3b[_0xd735('0x1c')],function(_0xbf581b){return{'model':db[_0xbf581b['model']],'as':_0xbf581b['as'],'attributes':_0xbf581b[_0xd735('0x1a')],'include':_0xbf581b[_0xd735('0x1c')]?_[_0xd735('0x1d')](_0xbf581b[_0xd735('0x1c')],function(_0x1030b1){return{'model':db[_0x1030b1['model']],'as':_0x1030b1['as'],'attributes':_0x1030b1[_0xd735('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e1762){logger[_0xd735('0x14')](_0xd735('0x20'),_0x3d9dc3);logger[_0xd735('0xf')](_0xd735('0x20'),_0x3d9dc3,JSON[_0xd735('0x22')](_0x2e1762));_0x32a206(_0x2e1762);})[_0xd735('0x15')](function(_0x3f7cac){logger[_0xd735('0x11')]('ShowDeskAccount',_0x3f7cac[_0xd735('0x13')],_0x3d9dc3);_0x57cd98(_0x2dadeb['error'](0x1f4,_0x3f7cac[_0xd735('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 55eb5b4..67b867f 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x339fa7,_0x2f7bb8){var _0x274de6=function(_0xac0839){while(--_0xac0839){_0x339fa7['push'](_0x339fa7['shift']());}};_0x274de6(++_0x2f7bb8);}(_0xedd9,0xfc));var _0x9edd=function(_0x3a15ce,_0x5f0345){_0x3a15ce=_0x3a15ce-0x0;var _0x57cd6b=_0xedd9[_0x3a15ce];return _0x57cd6b;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file +var _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x31953c,_0x3a8ab2){var _0x1b5b88=function(_0x517771){while(--_0x517771){_0x31953c['push'](_0x31953c['shift']());}};_0x1b5b88(++_0x3a8ab2);}(_0xedd9,0xfc));var _0x9edd=function(_0x372059,_0x2715e1){_0x372059=_0x372059-0x0;var _0x4a0a9d=_0xedd9[_0x372059];return _0x4a0a9d;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index c2e2791..8f9b4b7 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 _0xb280=['STRING','sequelize'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0xb280,0x73));var _0x0b28=function(_0x59d4ab,_0x8ac099){_0x59d4ab=_0x59d4ab-0x0;var _0x5d5bc4=_0xb280[_0x59d4ab];return _0x5d5bc4;};'use strict';var Sequelize=require(_0x0b28('0x0'));module['exports']={'name':{'type':Sequelize[_0x0b28('0x1')]},'description':{'type':Sequelize[_0x0b28('0x1')]}}; \ No newline at end of file +var _0xf2b1=['STRING','exports'];(function(_0x58ce3c,_0x247cfb){var _0x5e9cb2=function(_0x5a2341){while(--_0x5a2341){_0x58ce3c['push'](_0x58ce3c['shift']());}};_0x5e9cb2(++_0x247cfb);}(_0xf2b1,0x1d3));var _0x1f2b=function(_0x197065,_0x2e79d0){_0x197065=_0x197065-0x0;var _0x3d9404=_0xf2b1[_0x197065];return _0x3d9404;};'use strict';var Sequelize=require('sequelize');module[_0x1f2b('0x0')]={'name':{'type':Sequelize[_0x1f2b('0x1')]},'description':{'type':Sequelize[_0x1f2b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 604c494..f882fb6 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 _0x105c=['merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','getFields','findOne','pick','getSubjects','getDescriptions','DeskField','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','type','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter'];(function(_0x15462b,_0x4fcf41){var _0x2295fe=function(_0x981be0){while(--_0x981be0){_0x15462b['push'](_0x15462b['shift']());}};_0x2295fe(++_0x4fcf41);}(_0x105c,0x1ca));var _0xc105=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0x105c[_0x1fafa5];return _0xcf08c9;};'use strict';var emlformat=require(_0xc105('0x0'));var rimraf=require(_0xc105('0x1'));var zipdir=require(_0xc105('0x2'));var jsonpatch=require(_0xc105('0x3'));var rp=require(_0xc105('0x4'));var moment=require(_0xc105('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc105('0x6'));var util=require(_0xc105('0x7'));var path=require(_0xc105('0x8'));var sox=require(_0xc105('0x9'));var csv=require(_0xc105('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc105('0xb'));var _=require(_0xc105('0xc'));var squel=require(_0xc105('0xd'));var crypto=require(_0xc105('0xe'));var jsforce=require(_0xc105('0xf'));var deskjs=require(_0xc105('0x10'));var toCsv=require(_0xc105('0xa'));var querystring=require(_0xc105('0x11'));var Papa=require('papaparse');var Redis=require(_0xc105('0x12'));var authService=require(_0xc105('0x13'));var qs=require(_0xc105('0x14'));var as=require(_0xc105('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc105('0x16'))('api');var utils=require(_0xc105('0x17'));var config=require(_0xc105('0x18'));var licenseUtil=require(_0xc105('0x19'));var db=require(_0xc105('0x1a'))['db'];function respondWithStatusCode(_0x3acd7d,_0x3dfea0){_0x3dfea0=_0x3dfea0||0xcc;return function(_0x21a9fb){if(_0x21a9fb){return _0x3acd7d['sendStatus'](_0x3dfea0);}return _0x3acd7d[_0xc105('0x1b')](_0x3dfea0)['end']();};}function respondWithResult(_0x5cf019,_0x3ab842){_0x3ab842=_0x3ab842||0xc8;return function(_0x32572c){if(_0x32572c){return _0x5cf019[_0xc105('0x1b')](_0x3ab842)[_0xc105('0x1c')](_0x32572c);}};}function respondWithFilteredResult(_0xe37fe4,_0x2204bf){return function(_0x2ea8f7){if(_0x2ea8f7){var _0x4fd8c7=typeof _0x2204bf[_0xc105('0x1d')]==='undefined'&&typeof _0x2204bf[_0xc105('0x1e')]===_0xc105('0x1f');var _0x46e99f=_0x2ea8f7[_0xc105('0x20')];var _0x2314b7=_0x4fd8c7?0x0:_0x2204bf[_0xc105('0x1d')];var _0x37a190=_0x4fd8c7?_0x2ea8f7['count']:_0x2204bf['offset']+_0x2204bf[_0xc105('0x1e')];var _0x5e6575;if(_0x37a190>=_0x46e99f){_0x37a190=_0x46e99f;_0x5e6575=0xc8;}else{_0x5e6575=0xce;}_0xe37fe4[_0xc105('0x1b')](_0x5e6575);return _0xe37fe4[_0xc105('0x21')](_0xc105('0x22'),_0x2314b7+'-'+_0x37a190+'/'+_0x46e99f)[_0xc105('0x1c')](_0x2ea8f7);}return null;};}function patchUpdates(_0x3c84c4){return function(_0x425441){try{jsonpatch[_0xc105('0x23')](_0x425441,_0x3c84c4,!![]);}catch(_0x14e819){return BPromise['reject'](_0x14e819);}return _0x425441[_0xc105('0x24')]();};}function saveUpdates(_0x3144e3,_0x5ac4ef){return function(_0xb17bdb){if(_0xb17bdb){return _0xb17bdb[_0xc105('0x25')](_0x3144e3)['then'](function(_0x16b5ab){return _0x16b5ab;});}return null;};}function removeEntity(_0x5bd606,_0x223e02){return function(_0xd316b){if(_0xd316b){return _0xd316b[_0xc105('0x26')]()[_0xc105('0x27')](function(){_0x5bd606[_0xc105('0x1b')](0xcc)[_0xc105('0x28')]();});}};}function handleEntityNotFound(_0x500540,_0x164bb8){return function(_0x248289){if(!_0x248289){_0x500540[_0xc105('0x29')](0x194);}return _0x248289;};}function handleError(_0x22632d,_0x126694){_0x126694=_0x126694||0x1f4;return function(_0x23a05d){logger[_0xc105('0x2a')](_0x23a05d[_0xc105('0x2b')]);if(_0x23a05d[_0xc105('0x2c')]){delete _0x23a05d['name'];}_0x22632d[_0xc105('0x1b')](_0x126694)[_0xc105('0x2d')](_0x23a05d);};}exports[_0xc105('0x2e')]=function(_0x56c8e6,_0x203059){var _0x3d45ed={},_0x49cfba={},_0x46bb7c={'count':0x0,'rows':[]};var _0x5828fb=_[_0xc105('0x2f')](db[_0xc105('0x30')][_0xc105('0x31')],function(_0x2bce0a){return{'name':_0x2bce0a['fieldName'],'type':_0x2bce0a[_0xc105('0x32')]['key']};});_0x49cfba[_0xc105('0x33')]=_[_0xc105('0x2f')](_0x5828fb,_0xc105('0x2c'));_0x49cfba[_0xc105('0x34')]=_['keys'](_0x56c8e6[_0xc105('0x34')]);_0x49cfba['filters']=_['intersection'](_0x49cfba['model'],_0x49cfba[_0xc105('0x34')]);_0x3d45ed[_0xc105('0x35')]=_[_0xc105('0x36')](_0x49cfba['model'],qs[_0xc105('0x37')](_0x56c8e6[_0xc105('0x34')][_0xc105('0x37')]));_0x3d45ed[_0xc105('0x35')]=_0x3d45ed[_0xc105('0x35')][_0xc105('0x38')]?_0x3d45ed[_0xc105('0x35')]:_0x49cfba['model'];if(!_0x56c8e6[_0xc105('0x34')][_0xc105('0x39')](_0xc105('0x3a'))){_0x3d45ed[_0xc105('0x1e')]=qs[_0xc105('0x1e')](_0x56c8e6[_0xc105('0x34')]['limit']);_0x3d45ed['offset']=qs[_0xc105('0x1d')](_0x56c8e6['query'][_0xc105('0x1d')]);}_0x3d45ed[_0xc105('0x3b')]=qs[_0xc105('0x3c')](_0x56c8e6[_0xc105('0x34')][_0xc105('0x3c')]);_0x3d45ed[_0xc105('0x3d')]=qs[_0xc105('0x3e')](_['pick'](_0x56c8e6[_0xc105('0x34')],_0x49cfba[_0xc105('0x3e')]),_0x5828fb);if(_0x56c8e6[_0xc105('0x34')][_0xc105('0x3f')]){_0x3d45ed[_0xc105('0x3d')]=_[_0xc105('0x40')](_0x3d45ed['where'],{'$or':_['map'](_0x5828fb,function(_0x5afeac){if(_0x5afeac[_0xc105('0x32')]!==_0xc105('0x41')){var _0x3d0d19={};_0x3d0d19[_0x5afeac[_0xc105('0x2c')]]={'$like':'%'+_0x56c8e6[_0xc105('0x34')][_0xc105('0x3f')]+'%'};return _0x3d0d19;}})});}_0x3d45ed=_[_0xc105('0x40')]({},_0x3d45ed,_0x56c8e6[_0xc105('0x42')]);var _0x264de4={'where':_0x3d45ed[_0xc105('0x3d')]};return db[_0xc105('0x30')][_0xc105('0x20')](_0x264de4)[_0xc105('0x27')](function(_0x32b43c){_0x46bb7c[_0xc105('0x20')]=_0x32b43c;if(_0x56c8e6[_0xc105('0x34')][_0xc105('0x43')]){_0x3d45ed[_0xc105('0x44')]=[{'all':!![]}];}return db[_0xc105('0x30')][_0xc105('0x45')](_0x3d45ed);})[_0xc105('0x27')](function(_0x3e0e65){_0x46bb7c[_0xc105('0x46')]=_0x3e0e65;return _0x46bb7c;})['then'](respondWithFilteredResult(_0x203059,_0x3d45ed))['catch'](handleError(_0x203059,null));};exports[_0xc105('0x47')]=function(_0x4cb53d,_0x19eb09){var _0x2358f4={'raw':![],'where':{'id':_0x4cb53d[_0xc105('0x48')]['id']}},_0x2ff416={};_0x2ff416[_0xc105('0x33')]=_[_0xc105('0x49')](db[_0xc105('0x30')][_0xc105('0x31')]);_0x2ff416['query']=_[_0xc105('0x49')](_0x4cb53d[_0xc105('0x34')]);_0x2ff416[_0xc105('0x3e')]=_[_0xc105('0x36')](_0x2ff416[_0xc105('0x33')],_0x2ff416[_0xc105('0x34')]);_0x2358f4[_0xc105('0x35')]=_[_0xc105('0x36')](_0x2ff416[_0xc105('0x33')],qs['fields'](_0x4cb53d['query'][_0xc105('0x37')]));_0x2358f4[_0xc105('0x35')]=_0x2358f4['attributes'][_0xc105('0x38')]?_0x2358f4[_0xc105('0x35')]:_0x2ff416[_0xc105('0x33')];if(_0x4cb53d[_0xc105('0x34')][_0xc105('0x43')]){_0x2358f4[_0xc105('0x44')]=[{'all':!![]}];}_0x2358f4=_[_0xc105('0x40')]({},_0x2358f4,_0x4cb53d[_0xc105('0x42')]);return db[_0xc105('0x30')][_0xc105('0x4a')](_0x2358f4)[_0xc105('0x27')](handleEntityNotFound(_0x19eb09,null))[_0xc105('0x27')](respondWithResult(_0x19eb09,null))[_0xc105('0x4b')](handleError(_0x19eb09,null));};exports['create']=function(_0x310785,_0x3a9e73){return db['DeskConfiguration'][_0xc105('0x4c')](_0x310785['body'],{})[_0xc105('0x27')](respondWithResult(_0x3a9e73,0xc9))[_0xc105('0x4b')](handleError(_0x3a9e73,null));};exports[_0xc105('0x25')]=function(_0x5ca541,_0x4181f7){if(_0x5ca541[_0xc105('0x4d')]['id']){delete _0x5ca541[_0xc105('0x4d')]['id'];}return db[_0xc105('0x30')]['find']({'where':{'id':_0x5ca541[_0xc105('0x48')]['id']}})['then'](handleEntityNotFound(_0x4181f7,null))['then'](saveUpdates(_0x5ca541[_0xc105('0x4d')],null))[_0xc105('0x27')](respondWithResult(_0x4181f7,null))[_0xc105('0x4b')](handleError(_0x4181f7,null));};exports[_0xc105('0x26')]=function(_0x5ae5d1,_0x812c60){return db['DeskConfiguration'][_0xc105('0x4a')]({'where':{'id':_0x5ae5d1['params']['id']}})[_0xc105('0x27')](handleEntityNotFound(_0x812c60,null))[_0xc105('0x27')](removeEntity(_0x812c60,null))[_0xc105('0x4b')](handleError(_0x812c60,null));};exports[_0xc105('0x4e')]=function(_0x2f7f0c,_0xd48132,_0x4c078d){var _0x577b84={};var _0x22c87b={};var _0x13a3f0;var _0x33543f;return db[_0xc105('0x30')][_0xc105('0x4f')]({'where':{'id':_0x2f7f0c[_0xc105('0x48')]['id']}})[_0xc105('0x27')](handleEntityNotFound(_0xd48132,null))[_0xc105('0x27')](function(_0x4bfac7){if(_0x4bfac7){_0x13a3f0=_0x4bfac7;_0x22c87b['model']=_[_0xc105('0x49')](db['DeskField']['rawAttributes']);_0x22c87b[_0xc105('0x34')]=_[_0xc105('0x49')](_0x2f7f0c[_0xc105('0x34')]);_0x22c87b['filters']=_[_0xc105('0x36')](_0x22c87b['model'],_0x22c87b[_0xc105('0x34')]);_0x577b84['attributes']=_['intersection'](_0x22c87b[_0xc105('0x33')],qs[_0xc105('0x37')](_0x2f7f0c[_0xc105('0x34')][_0xc105('0x37')]));_0x577b84['attributes']=_0x577b84[_0xc105('0x35')][_0xc105('0x38')]?_0x577b84[_0xc105('0x35')]:_0x22c87b[_0xc105('0x33')];_0x577b84[_0xc105('0x3b')]=qs[_0xc105('0x3c')](_0x2f7f0c[_0xc105('0x34')][_0xc105('0x3c')]);_0x577b84[_0xc105('0x3d')]=qs[_0xc105('0x3e')](_[_0xc105('0x50')](_0x2f7f0c[_0xc105('0x34')],_0x22c87b[_0xc105('0x3e')]));if(_0x2f7f0c[_0xc105('0x34')]['filter']){_0x577b84['where']=_['merge'](_0x577b84[_0xc105('0x3d')],{'$or':_[_0xc105('0x2f')](_0x577b84[_0xc105('0x35')],function(_0x8512af){var _0x265889={};_0x265889[_0x8512af]={'$like':'%'+_0x2f7f0c[_0xc105('0x34')][_0xc105('0x3f')]+'%'};return _0x265889;})});}_0x577b84=_['merge']({},_0x577b84,_0x2f7f0c['options']);return _0x13a3f0[_0xc105('0x4e')](_0x577b84);}})[_0xc105('0x27')](function(_0x3504dc){if(_0x3504dc){_0x33543f=_0x3504dc[_0xc105('0x38')];if(!_0x2f7f0c[_0xc105('0x34')][_0xc105('0x39')]('nolimit')){_0x577b84[_0xc105('0x1e')]=qs[_0xc105('0x1e')](_0x2f7f0c[_0xc105('0x34')][_0xc105('0x1e')]);_0x577b84['offset']=qs[_0xc105('0x1d')](_0x2f7f0c[_0xc105('0x34')][_0xc105('0x1d')]);}return _0x13a3f0['getFields'](_0x577b84);}})[_0xc105('0x27')](function(_0x33e52c){if(_0x33e52c){return _0x33e52c?{'count':_0x33543f,'rows':_0x33e52c}:null;}})[_0xc105('0x27')](respondWithResult(_0xd48132,null))['catch'](handleError(_0xd48132,null));};exports[_0xc105('0x51')]=function(_0x57f7db,_0x197799,_0xa287d7){var _0x3244da={};var _0x1e3cfd={};var _0xdd4e7e;var _0x20af48;return db['DeskConfiguration'][_0xc105('0x4f')]({'where':{'id':_0x57f7db[_0xc105('0x48')]['id']}})[_0xc105('0x27')](handleEntityNotFound(_0x197799,null))['then'](function(_0x1ee77c){if(_0x1ee77c){_0xdd4e7e=_0x1ee77c;_0x1e3cfd[_0xc105('0x33')]=_[_0xc105('0x49')](db['DeskField']['rawAttributes']);_0x1e3cfd[_0xc105('0x34')]=_[_0xc105('0x49')](_0x57f7db[_0xc105('0x34')]);_0x1e3cfd['filters']=_[_0xc105('0x36')](_0x1e3cfd[_0xc105('0x33')],_0x1e3cfd['query']);_0x3244da[_0xc105('0x35')]=_['intersection'](_0x1e3cfd['model'],qs[_0xc105('0x37')](_0x57f7db['query'][_0xc105('0x37')]));_0x3244da[_0xc105('0x35')]=_0x3244da[_0xc105('0x35')][_0xc105('0x38')]?_0x3244da['attributes']:_0x1e3cfd['model'];_0x3244da[_0xc105('0x3b')]=qs[_0xc105('0x3c')](_0x57f7db[_0xc105('0x34')][_0xc105('0x3c')]);_0x3244da[_0xc105('0x3d')]=qs['filters'](_[_0xc105('0x50')](_0x57f7db['query'],_0x1e3cfd['filters']));if(_0x57f7db[_0xc105('0x34')][_0xc105('0x3f')]){_0x3244da['where']=_[_0xc105('0x40')](_0x3244da[_0xc105('0x3d')],{'$or':_['map'](_0x3244da[_0xc105('0x35')],function(_0x4ad5a8){var _0xb412f6={};_0xb412f6[_0x4ad5a8]={'$like':'%'+_0x57f7db[_0xc105('0x34')]['filter']+'%'};return _0xb412f6;})});}_0x3244da=_[_0xc105('0x40')]({},_0x3244da,_0x57f7db[_0xc105('0x42')]);return _0xdd4e7e['getSubjects'](_0x3244da);}})[_0xc105('0x27')](function(_0x5a1b8f){if(_0x5a1b8f){_0x20af48=_0x5a1b8f[_0xc105('0x38')];if(!_0x57f7db['query'][_0xc105('0x39')](_0xc105('0x3a'))){_0x3244da[_0xc105('0x1e')]=qs[_0xc105('0x1e')](_0x57f7db['query'][_0xc105('0x1e')]);_0x3244da[_0xc105('0x1d')]=qs['offset'](_0x57f7db[_0xc105('0x34')][_0xc105('0x1d')]);}return _0xdd4e7e['getSubjects'](_0x3244da);}})[_0xc105('0x27')](function(_0x47b10a){if(_0x47b10a){return _0x47b10a?{'count':_0x20af48,'rows':_0x47b10a}:null;}})[_0xc105('0x27')](respondWithResult(_0x197799,null))[_0xc105('0x4b')](handleError(_0x197799,null));};exports[_0xc105('0x52')]=function(_0x44b1c4,_0xf10b6c,_0x1f743e){var _0x581261={};var _0x1a65f1={};var _0x34dfa6;var _0x44d8ce;return db[_0xc105('0x30')]['findOne']({'where':{'id':_0x44b1c4['params']['id']}})[_0xc105('0x27')](handleEntityNotFound(_0xf10b6c,null))[_0xc105('0x27')](function(_0x143738){if(_0x143738){_0x34dfa6=_0x143738;_0x1a65f1[_0xc105('0x33')]=_[_0xc105('0x49')](db[_0xc105('0x53')][_0xc105('0x31')]);_0x1a65f1['query']=_[_0xc105('0x49')](_0x44b1c4[_0xc105('0x34')]);_0x1a65f1[_0xc105('0x3e')]=_[_0xc105('0x36')](_0x1a65f1[_0xc105('0x33')],_0x1a65f1[_0xc105('0x34')]);_0x581261[_0xc105('0x35')]=_['intersection'](_0x1a65f1['model'],qs[_0xc105('0x37')](_0x44b1c4[_0xc105('0x34')][_0xc105('0x37')]));_0x581261[_0xc105('0x35')]=_0x581261[_0xc105('0x35')][_0xc105('0x38')]?_0x581261[_0xc105('0x35')]:_0x1a65f1[_0xc105('0x33')];_0x581261[_0xc105('0x3b')]=qs[_0xc105('0x3c')](_0x44b1c4[_0xc105('0x34')]['sort']);_0x581261[_0xc105('0x3d')]=qs[_0xc105('0x3e')](_[_0xc105('0x50')](_0x44b1c4[_0xc105('0x34')],_0x1a65f1[_0xc105('0x3e')]));if(_0x44b1c4[_0xc105('0x34')][_0xc105('0x3f')]){_0x581261[_0xc105('0x3d')]=_[_0xc105('0x40')](_0x581261[_0xc105('0x3d')],{'$or':_[_0xc105('0x2f')](_0x581261[_0xc105('0x35')],function(_0x480e16){var _0x39ef27={};_0x39ef27[_0x480e16]={'$like':'%'+_0x44b1c4[_0xc105('0x34')][_0xc105('0x3f')]+'%'};return _0x39ef27;})});}_0x581261=_[_0xc105('0x40')]({},_0x581261,_0x44b1c4[_0xc105('0x42')]);return _0x34dfa6['getDescriptions'](_0x581261);}})[_0xc105('0x27')](function(_0x37def1){if(_0x37def1){_0x44d8ce=_0x37def1[_0xc105('0x38')];if(!_0x44b1c4['query']['hasOwnProperty'](_0xc105('0x3a'))){_0x581261[_0xc105('0x1e')]=qs[_0xc105('0x1e')](_0x44b1c4[_0xc105('0x34')][_0xc105('0x1e')]);_0x581261[_0xc105('0x1d')]=qs[_0xc105('0x1d')](_0x44b1c4[_0xc105('0x34')][_0xc105('0x1d')]);}return _0x34dfa6[_0xc105('0x52')](_0x581261);}})[_0xc105('0x27')](function(_0x471065){if(_0x471065){return _0x471065?{'count':_0x44d8ce,'rows':_0x471065}:null;}})[_0xc105('0x27')](respondWithResult(_0xf10b6c,null))[_0xc105('0x4b')](handleError(_0xf10b6c,null));};exports[_0xc105('0x54')]=function(_0x20ee68,_0x29a131,_0xef05ef){var _0x1184fe={};var _0x5336be={};var _0x5862bf;var _0x58edb2;return db[_0xc105('0x30')][_0xc105('0x4f')]({'where':{'id':_0x20ee68[_0xc105('0x48')]['id']}})['then'](handleEntityNotFound(_0x29a131,null))['then'](function(_0x53b328){if(_0x53b328){_0x5862bf=_0x53b328;_0x5336be[_0xc105('0x33')]=_[_0xc105('0x49')](db[_0xc105('0x55')][_0xc105('0x31')]);_0x5336be[_0xc105('0x34')]=_['keys'](_0x20ee68['query']);_0x5336be[_0xc105('0x3e')]=_[_0xc105('0x36')](_0x5336be[_0xc105('0x33')],_0x5336be['query']);_0x1184fe['attributes']=_[_0xc105('0x36')](_0x5336be[_0xc105('0x33')],qs['fields'](_0x20ee68[_0xc105('0x34')][_0xc105('0x37')]));_0x1184fe[_0xc105('0x35')]=_0x1184fe[_0xc105('0x35')]['length']?_0x1184fe['attributes']:_0x5336be['model'];_0x1184fe['order']=qs[_0xc105('0x3c')](_0x20ee68[_0xc105('0x34')][_0xc105('0x3c')]);_0x1184fe['where']=qs[_0xc105('0x3e')](_[_0xc105('0x50')](_0x20ee68[_0xc105('0x34')],_0x5336be[_0xc105('0x3e')]));if(_0x20ee68[_0xc105('0x34')][_0xc105('0x3f')]){_0x1184fe[_0xc105('0x3d')]=_['merge'](_0x1184fe[_0xc105('0x3d')],{'$or':_[_0xc105('0x2f')](_0x1184fe['attributes'],function(_0x17e549){var _0x10790d={};_0x10790d[_0x17e549]={'$like':'%'+_0x20ee68[_0xc105('0x34')][_0xc105('0x3f')]+'%'};return _0x10790d;})});}_0x1184fe=_['merge']({},_0x1184fe,_0x20ee68[_0xc105('0x42')]);return _0x5862bf[_0xc105('0x54')](_0x1184fe);}})[_0xc105('0x27')](function(_0x1aeb6d){if(_0x1aeb6d){_0x58edb2=_0x1aeb6d['length'];if(!_0x20ee68[_0xc105('0x34')][_0xc105('0x39')](_0xc105('0x3a'))){_0x1184fe[_0xc105('0x1e')]=qs[_0xc105('0x1e')](_0x20ee68['query']['limit']);_0x1184fe['offset']=qs[_0xc105('0x1d')](_0x20ee68[_0xc105('0x34')][_0xc105('0x1d')]);}return _0x5862bf[_0xc105('0x54')](_0x1184fe);}})[_0xc105('0x27')](function(_0x534728){if(_0x534728){return _0x534728?{'count':_0x58edb2,'rows':_0x534728}:null;}})[_0xc105('0x27')](respondWithResult(_0x29a131,null))[_0xc105('0x4b')](handleError(_0x29a131,null));};exports[_0xc105('0x56')]=function(_0x186e8b,_0x29ffdc,_0x45d96f){if(_0x186e8b[_0xc105('0x4d')]['id']){delete _0x186e8b[_0xc105('0x4d')]['id'];}return db['DeskConfiguration']['findOne']({'where':{'id':_0x186e8b[_0xc105('0x48')]['id']}})[_0xc105('0x27')](handleEntityNotFound(_0x29ffdc,null))[_0xc105('0x27')](function(_0x4a9e37){if(_0x4a9e37){return _0x4a9e37[_0xc105('0x56')](_0x186e8b[_0xc105('0x4d')]['ids']||[]);}return null;})['then'](respondWithResult(_0x29ffdc,null))[_0xc105('0x4b')](handleError(_0x29ffdc,null));}; \ No newline at end of file +var _0x18ba=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','nolimit','limit','sort','filter','where','merge','options','DeskConfiguration','includeAll','include','findAll','catch','show','params','keys','find','create','body','getFields','findOne','DeskField','order','hasOwnProperty','getSubjects','pick','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','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'];(function(_0x362960,_0x18f6ed){var _0x1cbb9a=function(_0x18233f){while(--_0x18233f){_0x362960['push'](_0x362960['shift']());}};_0x1cbb9a(++_0x18f6ed);}(_0x18ba,0x91));var _0xa18b=function(_0x49d662,_0x4a6c27){_0x49d662=_0x49d662-0x0;var _0xca9472=_0x18ba[_0x49d662];return _0xca9472;};'use strict';var emlformat=require(_0xa18b('0x0'));var rimraf=require(_0xa18b('0x1'));var zipdir=require(_0xa18b('0x2'));var jsonpatch=require(_0xa18b('0x3'));var rp=require(_0xa18b('0x4'));var moment=require('moment');var BPromise=require(_0xa18b('0x5'));var Mustache=require(_0xa18b('0x6'));var util=require(_0xa18b('0x7'));var path=require(_0xa18b('0x8'));var sox=require(_0xa18b('0x9'));var csv=require('to-csv');var ejs=require(_0xa18b('0xa'));var fs=require('fs');var fs_extra=require(_0xa18b('0xb'));var _=require(_0xa18b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa18b('0xd'));var deskjs=require(_0xa18b('0xe'));var toCsv=require(_0xa18b('0xf'));var querystring=require(_0xa18b('0x10'));var Papa=require(_0xa18b('0x11'));var Redis=require(_0xa18b('0x12'));var authService=require(_0xa18b('0x13'));var qs=require(_0xa18b('0x14'));var as=require(_0xa18b('0x15'));var hardwareService=require(_0xa18b('0x16'));var logger=require(_0xa18b('0x17'))(_0xa18b('0x18'));var utils=require(_0xa18b('0x19'));var config=require(_0xa18b('0x1a'));var licenseUtil=require(_0xa18b('0x1b'));var db=require(_0xa18b('0x1c'))['db'];function respondWithStatusCode(_0x4b98d2,_0x23a23e){_0x23a23e=_0x23a23e||0xcc;return function(_0x2368f6){if(_0x2368f6){return _0x4b98d2[_0xa18b('0x1d')](_0x23a23e);}return _0x4b98d2[_0xa18b('0x1e')](_0x23a23e)[_0xa18b('0x1f')]();};}function respondWithResult(_0x29abe9,_0x30bc7f){_0x30bc7f=_0x30bc7f||0xc8;return function(_0x2c4153){if(_0x2c4153){return _0x29abe9[_0xa18b('0x1e')](_0x30bc7f)[_0xa18b('0x20')](_0x2c4153);}};}function respondWithFilteredResult(_0x179e1d,_0x562286){return function(_0x2a672d){if(_0x2a672d){var _0x20b7e6=typeof _0x562286['offset']==='undefined'&&typeof _0x562286['limit']===_0xa18b('0x21');var _0x43e2d4=_0x2a672d[_0xa18b('0x22')];var _0x443f58=_0x20b7e6?0x0:_0x562286[_0xa18b('0x23')];var _0x1e5f97=_0x20b7e6?_0x2a672d[_0xa18b('0x22')]:_0x562286[_0xa18b('0x23')]+_0x562286['limit'];var _0x272248;if(_0x1e5f97>=_0x43e2d4){_0x1e5f97=_0x43e2d4;_0x272248=0xc8;}else{_0x272248=0xce;}_0x179e1d[_0xa18b('0x1e')](_0x272248);return _0x179e1d[_0xa18b('0x24')](_0xa18b('0x25'),_0x443f58+'-'+_0x1e5f97+'/'+_0x43e2d4)[_0xa18b('0x20')](_0x2a672d);}return null;};}function patchUpdates(_0x5ab306){return function(_0x38b061){try{jsonpatch[_0xa18b('0x26')](_0x38b061,_0x5ab306,!![]);}catch(_0x2a25ee){return BPromise['reject'](_0x2a25ee);}return _0x38b061[_0xa18b('0x27')]();};}function saveUpdates(_0x49c38b,_0x32826b){return function(_0x269090){if(_0x269090){return _0x269090[_0xa18b('0x28')](_0x49c38b)[_0xa18b('0x29')](function(_0x3644d6){return _0x3644d6;});}return null;};}function removeEntity(_0x56a381,_0x24c48a){return function(_0x214a87){if(_0x214a87){return _0x214a87[_0xa18b('0x2a')]()['then'](function(){_0x56a381['status'](0xcc)[_0xa18b('0x1f')]();});}};}function handleEntityNotFound(_0x26e88d,_0x5d8945){return function(_0x5b6095){if(!_0x5b6095){_0x26e88d[_0xa18b('0x1d')](0x194);}return _0x5b6095;};}function handleError(_0x59a531,_0xad2e7){_0xad2e7=_0xad2e7||0x1f4;return function(_0x24dfe1){logger[_0xa18b('0x2b')](_0x24dfe1[_0xa18b('0x2c')]);if(_0x24dfe1[_0xa18b('0x2d')]){delete _0x24dfe1[_0xa18b('0x2d')];}_0x59a531[_0xa18b('0x1e')](_0xad2e7)[_0xa18b('0x2e')](_0x24dfe1);};}exports['index']=function(_0x5b1668,_0x60e880){var _0x5b8950={},_0x318782={},_0xc96892={'count':0x0,'rows':[]};var _0x104f7b=_[_0xa18b('0x2f')](db['DeskConfiguration'][_0xa18b('0x30')],function(_0xd75a07){return{'name':_0xd75a07[_0xa18b('0x31')],'type':_0xd75a07['type']['key']};});_0x318782[_0xa18b('0x32')]=_[_0xa18b('0x2f')](_0x104f7b,'name');_0x318782[_0xa18b('0x33')]=_['keys'](_0x5b1668[_0xa18b('0x33')]);_0x318782[_0xa18b('0x34')]=_['intersection'](_0x318782[_0xa18b('0x32')],_0x318782[_0xa18b('0x33')]);_0x5b8950['attributes']=_[_0xa18b('0x35')](_0x318782[_0xa18b('0x32')],qs[_0xa18b('0x36')](_0x5b1668[_0xa18b('0x33')][_0xa18b('0x36')]));_0x5b8950[_0xa18b('0x37')]=_0x5b8950[_0xa18b('0x37')][_0xa18b('0x38')]?_0x5b8950[_0xa18b('0x37')]:_0x318782[_0xa18b('0x32')];if(!_0x5b1668[_0xa18b('0x33')]['hasOwnProperty'](_0xa18b('0x39'))){_0x5b8950['limit']=qs['limit'](_0x5b1668['query'][_0xa18b('0x3a')]);_0x5b8950[_0xa18b('0x23')]=qs['offset'](_0x5b1668[_0xa18b('0x33')][_0xa18b('0x23')]);}_0x5b8950['order']=qs[_0xa18b('0x3b')](_0x5b1668[_0xa18b('0x33')][_0xa18b('0x3b')]);_0x5b8950['where']=qs['filters'](_['pick'](_0x5b1668['query'],_0x318782['filters']),_0x104f7b);if(_0x5b1668[_0xa18b('0x33')][_0xa18b('0x3c')]){_0x5b8950[_0xa18b('0x3d')]=_[_0xa18b('0x3e')](_0x5b8950[_0xa18b('0x3d')],{'$or':_[_0xa18b('0x2f')](_0x104f7b,function(_0x45db63){if(_0x45db63['type']!=='VIRTUAL'){var _0x3e7476={};_0x3e7476[_0x45db63[_0xa18b('0x2d')]]={'$like':'%'+_0x5b1668['query'][_0xa18b('0x3c')]+'%'};return _0x3e7476;}})});}_0x5b8950=_[_0xa18b('0x3e')]({},_0x5b8950,_0x5b1668[_0xa18b('0x3f')]);var _0x59fbbb={'where':_0x5b8950[_0xa18b('0x3d')]};return db[_0xa18b('0x40')][_0xa18b('0x22')](_0x59fbbb)[_0xa18b('0x29')](function(_0xf47fbb){_0xc96892[_0xa18b('0x22')]=_0xf47fbb;if(_0x5b1668[_0xa18b('0x33')][_0xa18b('0x41')]){_0x5b8950[_0xa18b('0x42')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xa18b('0x43')](_0x5b8950);})['then'](function(_0x1f0ca3){_0xc96892['rows']=_0x1f0ca3;return _0xc96892;})[_0xa18b('0x29')](respondWithFilteredResult(_0x60e880,_0x5b8950))[_0xa18b('0x44')](handleError(_0x60e880,null));};exports[_0xa18b('0x45')]=function(_0x2685e7,_0x44461a){var _0x166c76={'raw':![],'where':{'id':_0x2685e7[_0xa18b('0x46')]['id']}},_0x5bc30d={};_0x5bc30d[_0xa18b('0x32')]=_[_0xa18b('0x47')](db[_0xa18b('0x40')]['rawAttributes']);_0x5bc30d[_0xa18b('0x33')]=_['keys'](_0x2685e7[_0xa18b('0x33')]);_0x5bc30d[_0xa18b('0x34')]=_[_0xa18b('0x35')](_0x5bc30d[_0xa18b('0x32')],_0x5bc30d[_0xa18b('0x33')]);_0x166c76[_0xa18b('0x37')]=_[_0xa18b('0x35')](_0x5bc30d['model'],qs['fields'](_0x2685e7[_0xa18b('0x33')][_0xa18b('0x36')]));_0x166c76[_0xa18b('0x37')]=_0x166c76[_0xa18b('0x37')][_0xa18b('0x38')]?_0x166c76[_0xa18b('0x37')]:_0x5bc30d[_0xa18b('0x32')];if(_0x2685e7[_0xa18b('0x33')][_0xa18b('0x41')]){_0x166c76[_0xa18b('0x42')]=[{'all':!![]}];}_0x166c76=_[_0xa18b('0x3e')]({},_0x166c76,_0x2685e7[_0xa18b('0x3f')]);return db['DeskConfiguration'][_0xa18b('0x48')](_0x166c76)[_0xa18b('0x29')](handleEntityNotFound(_0x44461a,null))[_0xa18b('0x29')](respondWithResult(_0x44461a,null))[_0xa18b('0x44')](handleError(_0x44461a,null));};exports['create']=function(_0x411739,_0xb9b5d){return db[_0xa18b('0x40')][_0xa18b('0x49')](_0x411739['body'],{})[_0xa18b('0x29')](respondWithResult(_0xb9b5d,0xc9))[_0xa18b('0x44')](handleError(_0xb9b5d,null));};exports[_0xa18b('0x28')]=function(_0x32b20d,_0x577f47){if(_0x32b20d[_0xa18b('0x4a')]['id']){delete _0x32b20d['body']['id'];}return db[_0xa18b('0x40')][_0xa18b('0x48')]({'where':{'id':_0x32b20d['params']['id']}})[_0xa18b('0x29')](handleEntityNotFound(_0x577f47,null))[_0xa18b('0x29')](saveUpdates(_0x32b20d[_0xa18b('0x4a')],null))[_0xa18b('0x29')](respondWithResult(_0x577f47,null))['catch'](handleError(_0x577f47,null));};exports[_0xa18b('0x2a')]=function(_0xb2a8ce,_0x453044){return db[_0xa18b('0x40')]['find']({'where':{'id':_0xb2a8ce['params']['id']}})[_0xa18b('0x29')](handleEntityNotFound(_0x453044,null))['then'](removeEntity(_0x453044,null))['catch'](handleError(_0x453044,null));};exports[_0xa18b('0x4b')]=function(_0x2a55da,_0x20bdcb,_0x41add9){var _0x44037d={};var _0xc8fa20={};var _0x54282b;var _0x9a7ccf;return db[_0xa18b('0x40')][_0xa18b('0x4c')]({'where':{'id':_0x2a55da['params']['id']}})[_0xa18b('0x29')](handleEntityNotFound(_0x20bdcb,null))['then'](function(_0x56f729){if(_0x56f729){_0x54282b=_0x56f729;_0xc8fa20['model']=_['keys'](db[_0xa18b('0x4d')][_0xa18b('0x30')]);_0xc8fa20[_0xa18b('0x33')]=_[_0xa18b('0x47')](_0x2a55da[_0xa18b('0x33')]);_0xc8fa20['filters']=_[_0xa18b('0x35')](_0xc8fa20[_0xa18b('0x32')],_0xc8fa20['query']);_0x44037d[_0xa18b('0x37')]=_[_0xa18b('0x35')](_0xc8fa20[_0xa18b('0x32')],qs[_0xa18b('0x36')](_0x2a55da['query'][_0xa18b('0x36')]));_0x44037d[_0xa18b('0x37')]=_0x44037d[_0xa18b('0x37')][_0xa18b('0x38')]?_0x44037d[_0xa18b('0x37')]:_0xc8fa20[_0xa18b('0x32')];_0x44037d[_0xa18b('0x4e')]=qs['sort'](_0x2a55da['query'][_0xa18b('0x3b')]);_0x44037d['where']=qs[_0xa18b('0x34')](_['pick'](_0x2a55da['query'],_0xc8fa20['filters']));if(_0x2a55da[_0xa18b('0x33')][_0xa18b('0x3c')]){_0x44037d[_0xa18b('0x3d')]=_['merge'](_0x44037d['where'],{'$or':_['map'](_0x44037d[_0xa18b('0x37')],function(_0x498315){var _0x329d3a={};_0x329d3a[_0x498315]={'$like':'%'+_0x2a55da['query'][_0xa18b('0x3c')]+'%'};return _0x329d3a;})});}_0x44037d=_['merge']({},_0x44037d,_0x2a55da[_0xa18b('0x3f')]);return _0x54282b[_0xa18b('0x4b')](_0x44037d);}})[_0xa18b('0x29')](function(_0x7a7c1e){if(_0x7a7c1e){_0x9a7ccf=_0x7a7c1e[_0xa18b('0x38')];if(!_0x2a55da[_0xa18b('0x33')][_0xa18b('0x4f')](_0xa18b('0x39'))){_0x44037d[_0xa18b('0x3a')]=qs['limit'](_0x2a55da[_0xa18b('0x33')][_0xa18b('0x3a')]);_0x44037d[_0xa18b('0x23')]=qs[_0xa18b('0x23')](_0x2a55da['query'][_0xa18b('0x23')]);}return _0x54282b[_0xa18b('0x4b')](_0x44037d);}})[_0xa18b('0x29')](function(_0x5c51fc){if(_0x5c51fc){return _0x5c51fc?{'count':_0x9a7ccf,'rows':_0x5c51fc}:null;}})['then'](respondWithResult(_0x20bdcb,null))[_0xa18b('0x44')](handleError(_0x20bdcb,null));};exports[_0xa18b('0x50')]=function(_0x513d88,_0x39ed19,_0x265879){var _0x5893aa={};var _0x2cb1fc={};var _0x108bd4;var _0xde8c3f;return db[_0xa18b('0x40')][_0xa18b('0x4c')]({'where':{'id':_0x513d88[_0xa18b('0x46')]['id']}})[_0xa18b('0x29')](handleEntityNotFound(_0x39ed19,null))[_0xa18b('0x29')](function(_0xa9a49e){if(_0xa9a49e){_0x108bd4=_0xa9a49e;_0x2cb1fc[_0xa18b('0x32')]=_[_0xa18b('0x47')](db[_0xa18b('0x4d')]['rawAttributes']);_0x2cb1fc[_0xa18b('0x33')]=_[_0xa18b('0x47')](_0x513d88[_0xa18b('0x33')]);_0x2cb1fc[_0xa18b('0x34')]=_['intersection'](_0x2cb1fc[_0xa18b('0x32')],_0x2cb1fc[_0xa18b('0x33')]);_0x5893aa[_0xa18b('0x37')]=_[_0xa18b('0x35')](_0x2cb1fc[_0xa18b('0x32')],qs[_0xa18b('0x36')](_0x513d88[_0xa18b('0x33')]['fields']));_0x5893aa[_0xa18b('0x37')]=_0x5893aa['attributes'][_0xa18b('0x38')]?_0x5893aa[_0xa18b('0x37')]:_0x2cb1fc[_0xa18b('0x32')];_0x5893aa[_0xa18b('0x4e')]=qs[_0xa18b('0x3b')](_0x513d88['query'][_0xa18b('0x3b')]);_0x5893aa['where']=qs['filters'](_[_0xa18b('0x51')](_0x513d88[_0xa18b('0x33')],_0x2cb1fc[_0xa18b('0x34')]));if(_0x513d88['query'][_0xa18b('0x3c')]){_0x5893aa[_0xa18b('0x3d')]=_[_0xa18b('0x3e')](_0x5893aa['where'],{'$or':_['map'](_0x5893aa[_0xa18b('0x37')],function(_0x1ce66a){var _0x9bed99={};_0x9bed99[_0x1ce66a]={'$like':'%'+_0x513d88[_0xa18b('0x33')][_0xa18b('0x3c')]+'%'};return _0x9bed99;})});}_0x5893aa=_[_0xa18b('0x3e')]({},_0x5893aa,_0x513d88[_0xa18b('0x3f')]);return _0x108bd4[_0xa18b('0x50')](_0x5893aa);}})['then'](function(_0x5cdd55){if(_0x5cdd55){_0xde8c3f=_0x5cdd55['length'];if(!_0x513d88[_0xa18b('0x33')][_0xa18b('0x4f')](_0xa18b('0x39'))){_0x5893aa[_0xa18b('0x3a')]=qs[_0xa18b('0x3a')](_0x513d88[_0xa18b('0x33')][_0xa18b('0x3a')]);_0x5893aa[_0xa18b('0x23')]=qs[_0xa18b('0x23')](_0x513d88[_0xa18b('0x33')][_0xa18b('0x23')]);}return _0x108bd4['getSubjects'](_0x5893aa);}})['then'](function(_0x50309a){if(_0x50309a){return _0x50309a?{'count':_0xde8c3f,'rows':_0x50309a}:null;}})[_0xa18b('0x29')](respondWithResult(_0x39ed19,null))['catch'](handleError(_0x39ed19,null));};exports[_0xa18b('0x52')]=function(_0x4b44ec,_0x56a7a0,_0x17b667){var _0x431387={};var _0x192641={};var _0x43b8a3;var _0x2d90bf;return db[_0xa18b('0x40')][_0xa18b('0x4c')]({'where':{'id':_0x4b44ec[_0xa18b('0x46')]['id']}})[_0xa18b('0x29')](handleEntityNotFound(_0x56a7a0,null))['then'](function(_0x3245ee){if(_0x3245ee){_0x43b8a3=_0x3245ee;_0x192641[_0xa18b('0x32')]=_[_0xa18b('0x47')](db['DeskField'][_0xa18b('0x30')]);_0x192641[_0xa18b('0x33')]=_[_0xa18b('0x47')](_0x4b44ec[_0xa18b('0x33')]);_0x192641[_0xa18b('0x34')]=_[_0xa18b('0x35')](_0x192641[_0xa18b('0x32')],_0x192641[_0xa18b('0x33')]);_0x431387['attributes']=_['intersection'](_0x192641[_0xa18b('0x32')],qs[_0xa18b('0x36')](_0x4b44ec[_0xa18b('0x33')]['fields']));_0x431387[_0xa18b('0x37')]=_0x431387['attributes'][_0xa18b('0x38')]?_0x431387['attributes']:_0x192641['model'];_0x431387[_0xa18b('0x4e')]=qs[_0xa18b('0x3b')](_0x4b44ec['query'][_0xa18b('0x3b')]);_0x431387[_0xa18b('0x3d')]=qs['filters'](_['pick'](_0x4b44ec['query'],_0x192641['filters']));if(_0x4b44ec['query'][_0xa18b('0x3c')]){_0x431387[_0xa18b('0x3d')]=_[_0xa18b('0x3e')](_0x431387['where'],{'$or':_[_0xa18b('0x2f')](_0x431387[_0xa18b('0x37')],function(_0x3468ac){var _0x5d73b8={};_0x5d73b8[_0x3468ac]={'$like':'%'+_0x4b44ec[_0xa18b('0x33')][_0xa18b('0x3c')]+'%'};return _0x5d73b8;})});}_0x431387=_[_0xa18b('0x3e')]({},_0x431387,_0x4b44ec[_0xa18b('0x3f')]);return _0x43b8a3['getDescriptions'](_0x431387);}})['then'](function(_0x524aec){if(_0x524aec){_0x2d90bf=_0x524aec[_0xa18b('0x38')];if(!_0x4b44ec['query']['hasOwnProperty'](_0xa18b('0x39'))){_0x431387[_0xa18b('0x3a')]=qs[_0xa18b('0x3a')](_0x4b44ec[_0xa18b('0x33')]['limit']);_0x431387[_0xa18b('0x23')]=qs['offset'](_0x4b44ec[_0xa18b('0x33')][_0xa18b('0x23')]);}return _0x43b8a3[_0xa18b('0x52')](_0x431387);}})[_0xa18b('0x29')](function(_0x4b4e9c){if(_0x4b4e9c){return _0x4b4e9c?{'count':_0x2d90bf,'rows':_0x4b4e9c}:null;}})[_0xa18b('0x29')](respondWithResult(_0x56a7a0,null))['catch'](handleError(_0x56a7a0,null));};exports[_0xa18b('0x53')]=function(_0x4d09ef,_0x20d319,_0x1ed717){var _0x488e53={};var _0xa5bc21={};var _0x504487;var _0x1b4976;return db[_0xa18b('0x40')][_0xa18b('0x4c')]({'where':{'id':_0x4d09ef[_0xa18b('0x46')]['id']}})['then'](handleEntityNotFound(_0x20d319,null))[_0xa18b('0x29')](function(_0x18b22d){if(_0x18b22d){_0x504487=_0x18b22d;_0xa5bc21[_0xa18b('0x32')]=_[_0xa18b('0x47')](db['Tag'][_0xa18b('0x30')]);_0xa5bc21[_0xa18b('0x33')]=_[_0xa18b('0x47')](_0x4d09ef[_0xa18b('0x33')]);_0xa5bc21[_0xa18b('0x34')]=_['intersection'](_0xa5bc21[_0xa18b('0x32')],_0xa5bc21[_0xa18b('0x33')]);_0x488e53['attributes']=_[_0xa18b('0x35')](_0xa5bc21[_0xa18b('0x32')],qs['fields'](_0x4d09ef['query'][_0xa18b('0x36')]));_0x488e53['attributes']=_0x488e53['attributes'][_0xa18b('0x38')]?_0x488e53[_0xa18b('0x37')]:_0xa5bc21[_0xa18b('0x32')];_0x488e53[_0xa18b('0x4e')]=qs[_0xa18b('0x3b')](_0x4d09ef[_0xa18b('0x33')][_0xa18b('0x3b')]);_0x488e53['where']=qs[_0xa18b('0x34')](_[_0xa18b('0x51')](_0x4d09ef['query'],_0xa5bc21[_0xa18b('0x34')]));if(_0x4d09ef[_0xa18b('0x33')][_0xa18b('0x3c')]){_0x488e53['where']=_[_0xa18b('0x3e')](_0x488e53[_0xa18b('0x3d')],{'$or':_['map'](_0x488e53['attributes'],function(_0x27286d){var _0x3c65c8={};_0x3c65c8[_0x27286d]={'$like':'%'+_0x4d09ef[_0xa18b('0x33')][_0xa18b('0x3c')]+'%'};return _0x3c65c8;})});}_0x488e53=_['merge']({},_0x488e53,_0x4d09ef[_0xa18b('0x3f')]);return _0x504487[_0xa18b('0x53')](_0x488e53);}})[_0xa18b('0x29')](function(_0x1cba91){if(_0x1cba91){_0x1b4976=_0x1cba91[_0xa18b('0x38')];if(!_0x4d09ef[_0xa18b('0x33')]['hasOwnProperty'](_0xa18b('0x39'))){_0x488e53['limit']=qs[_0xa18b('0x3a')](_0x4d09ef[_0xa18b('0x33')][_0xa18b('0x3a')]);_0x488e53['offset']=qs[_0xa18b('0x23')](_0x4d09ef[_0xa18b('0x33')]['offset']);}return _0x504487['getTags'](_0x488e53);}})[_0xa18b('0x29')](function(_0x2117f8){if(_0x2117f8){return _0x2117f8?{'count':_0x1b4976,'rows':_0x2117f8}:null;}})['then'](respondWithResult(_0x20d319,null))[_0xa18b('0x44')](handleError(_0x20d319,null));};exports[_0xa18b('0x54')]=function(_0x5841af,_0x23214c,_0x2ccd90){if(_0x5841af[_0xa18b('0x4a')]['id']){delete _0x5841af['body']['id'];}return db[_0xa18b('0x40')]['findOne']({'where':{'id':_0x5841af[_0xa18b('0x46')]['id']}})[_0xa18b('0x29')](handleEntityNotFound(_0x23214c,null))[_0xa18b('0x29')](function(_0x2c02d6){if(_0x2c02d6){return _0x2c02d6[_0xa18b('0x54')](_0x5841af[_0xa18b('0x4a')][_0xa18b('0x55')]||[]);}return null;})[_0xa18b('0x29')](respondWithResult(_0x23214c,null))[_0xa18b('0x44')](handleError(_0x23214c,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 71af053..1790b44 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 _0x613f=['int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','./intDeskConfiguration.attributes','exports','define','DeskConfiguration'];(function(_0xf8429f,_0x2cc589){var _0x2b4b97=function(_0x257397){while(--_0x257397){_0xf8429f['push'](_0xf8429f['shift']());}};_0x2b4b97(++_0x2cc589);}(_0x613f,0x6d));var _0xf613=function(_0x286888,_0x2236c5){_0x286888=_0x286888-0x0;var _0x5f24d3=_0x613f[_0x286888];return _0x5f24d3;};'use strict';var _=require(_0xf613('0x0'));var util=require(_0xf613('0x1'));var logger=require(_0xf613('0x2'))(_0xf613('0x3'));var moment=require(_0xf613('0x4'));var BPromise=require(_0xf613('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf613('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf613('0x7'));module[_0xf613('0x8')]=function(_0x42f40d,_0x28a9a4){return _0x42f40d[_0xf613('0x9')](_0xf613('0xa'),attributes,{'tableName':_0xf613('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3cef=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','int_desk_configurations','util','../../config/logger'];(function(_0x18f005,_0x475e37){var _0x3276be=function(_0x3a95e6){while(--_0x3a95e6){_0x18f005['push'](_0x18f005['shift']());}};_0x3276be(++_0x475e37);}(_0x3cef,0xe2));var _0xf3ce=function(_0x29fc1b,_0x4f1346){_0x29fc1b=_0x29fc1b-0x0;var _0x4f5015=_0x3cef[_0x29fc1b];return _0x4f5015;};'use strict';var _=require('lodash');var util=require(_0xf3ce('0x0'));var logger=require(_0xf3ce('0x1'))('api');var moment=require(_0xf3ce('0x2'));var BPromise=require(_0xf3ce('0x3'));var rp=require(_0xf3ce('0x4'));var fs=require('fs');var path=require(_0xf3ce('0x5'));var rimraf=require(_0xf3ce('0x6'));var config=require(_0xf3ce('0x7'));var attributes=require(_0xf3ce('0x8'));module[_0xf3ce('0x9')]=function(_0x52aa27,_0x1da434){return _0x52aa27[_0xf3ce('0xa')]('DeskConfiguration',attributes,{'tableName':_0xf3ce('0xb'),'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 a574e42..5adfbad 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 _0x0268=['message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error'];(function(_0x590218,_0x5bd329){var _0x2c0a0f=function(_0x2a57dd){while(--_0x2a57dd){_0x590218['push'](_0x590218['shift']());}};_0x2c0a0f(++_0x5bd329);}(_0x0268,0x17e));var _0x8026=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x0268[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x8026('0x0'));var util=require('util');var moment=require(_0x8026('0x1'));var BPromise=require(_0x8026('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8026('0x3'));var db=require(_0x8026('0x4'))['db'];var utils=require(_0x8026('0x5'));var logger=require(_0x8026('0x6'))(_0x8026('0x7'));var config=require('../../config/environment');var jayson=require(_0x8026('0x8'));var client=jayson[_0x8026('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2573a8,_0x2881ea,_0x38e49e){return new BPromise(function(_0xaf6f84,_0x1119f0){return client[_0x8026('0xa')](_0x2573a8,_0x38e49e)[_0x8026('0xb')](function(_0x1d5d8f){logger[_0x8026('0xc')](_0x8026('0xd'),_0x2881ea,_0x8026('0xe'));logger[_0x8026('0xf')](_0x8026('0x10'),_0x2881ea,'request\x20sent',JSON['stringify'](_0x1d5d8f));if(_0x1d5d8f['error']){if(_0x1d5d8f[_0x8026('0x11')]['code']===0x1f4){logger[_0x8026('0x11')](_0x8026('0xd'),_0x2881ea,_0x1d5d8f[_0x8026('0x11')][_0x8026('0x12')]);return _0x1119f0(_0x1d5d8f[_0x8026('0x11')][_0x8026('0x12')]);}logger[_0x8026('0x11')](_0x8026('0xd'),_0x2881ea,_0x1d5d8f[_0x8026('0x11')][_0x8026('0x12')]);return _0xaf6f84(_0x1d5d8f[_0x8026('0x11')][_0x8026('0x12')]);}else{logger[_0x8026('0xc')](_0x8026('0xd'),_0x2881ea,_0x8026('0xe'));_0xaf6f84(_0x1d5d8f[_0x8026('0x13')][_0x8026('0x12')]);}})['catch'](function(_0x5df96d){logger[_0x8026('0x11')](_0x8026('0xd'),_0x2881ea,_0x5df96d);_0x1119f0(_0x5df96d);});});} \ No newline at end of file +var _0x0257=['rpc','jayson/promise','client','http','request','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x156b75,_0x2778d7){var _0x472179=function(_0x4fddb7){while(--_0x4fddb7){_0x156b75['push'](_0x156b75['shift']());}};_0x472179(++_0x2778d7);}(_0x0257,0x1db));var _0x7025=function(_0x4df667,_0x2d80ea){_0x4df667=_0x4df667-0x0;var _0x24ff9d=_0x0257[_0x4df667];return _0x24ff9d;};'use strict';var _=require('lodash');var util=require(_0x7025('0x0'));var moment=require(_0x7025('0x1'));var BPromise=require(_0x7025('0x2'));var rs=require(_0x7025('0x3'));var fs=require('fs');var Redis=require(_0x7025('0x4'));var db=require(_0x7025('0x5'))['db'];var utils=require(_0x7025('0x6'));var logger=require(_0x7025('0x7'))(_0x7025('0x8'));var config=require('../../config/environment');var jayson=require(_0x7025('0x9'));var client=jayson[_0x7025('0xa')][_0x7025('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44dc85,_0x33251b,_0xd2a516){return new BPromise(function(_0x494e48,_0xa74928){return client[_0x7025('0xc')](_0x44dc85,_0xd2a516)[_0x7025('0xd')](function(_0x5dbd09){logger['info'](_0x7025('0xe'),_0x33251b,_0x7025('0xf'));logger[_0x7025('0x10')](_0x7025('0x11'),_0x33251b,_0x7025('0xf'),JSON['stringify'](_0x5dbd09));if(_0x5dbd09[_0x7025('0x12')]){if(_0x5dbd09[_0x7025('0x12')][_0x7025('0x13')]===0x1f4){logger[_0x7025('0x12')](_0x7025('0xe'),_0x33251b,_0x5dbd09[_0x7025('0x12')][_0x7025('0x14')]);return _0xa74928(_0x5dbd09[_0x7025('0x12')][_0x7025('0x14')]);}logger[_0x7025('0x12')](_0x7025('0xe'),_0x33251b,_0x5dbd09[_0x7025('0x12')][_0x7025('0x14')]);return _0x494e48(_0x5dbd09['error'][_0x7025('0x14')]);}else{logger['info'](_0x7025('0xe'),_0x33251b,_0x7025('0xf'));_0x494e48(_0x5dbd09[_0x7025('0x15')]['message']);}})[_0x7025('0x16')](function(_0x4aca38){logger[_0x7025('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x33251b,_0x4aca38);_0xa74928(_0x4aca38);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index f702359..4986e3e 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 _0xfc6d=['multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','exports'];(function(_0xe55053,_0x149b3d){var _0x5bc0b8=function(_0x3bf14f){while(--_0x3bf14f){_0xe55053['push'](_0xe55053['shift']());}};_0x5bc0b8(++_0x149b3d);}(_0xfc6d,0x1e6));var _0xdfc6=function(_0x5f4a39,_0x4831bd){_0x5f4a39=_0x5f4a39-0x0;var _0x31f117=_0xfc6d[_0x5f4a39];return _0x31f117;};'use strict';var multer=require(_0xdfc6('0x0'));var util=require(_0xdfc6('0x1'));var path=require(_0xdfc6('0x2'));var timeout=require(_0xdfc6('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdfc6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdfc6('0x5'));var config=require(_0xdfc6('0x6'));var controller=require('./intDeskField.controller');router[_0xdfc6('0x7')]('/',auth['isAuthenticated'](),controller[_0xdfc6('0x8')]);router[_0xdfc6('0x7')](_0xdfc6('0x9'),auth[_0xdfc6('0xa')](),controller[_0xdfc6('0xb')]);router[_0xdfc6('0xc')]('/',auth[_0xdfc6('0xa')](),controller[_0xdfc6('0xd')]);router[_0xdfc6('0xe')](_0xdfc6('0x9'),auth[_0xdfc6('0xa')](),controller[_0xdfc6('0xf')]);router[_0xdfc6('0x10')](_0xdfc6('0x9'),auth[_0xdfc6('0xa')](),controller['destroy']);module[_0xdfc6('0x11')]=router; \ No newline at end of file +var _0x7792=['destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','/:id','isAuthenticated','show','create','put','update'];(function(_0xefb553,_0x93f724){var _0x2e5e72=function(_0x105161){while(--_0x105161){_0xefb553['push'](_0xefb553['shift']());}};_0x2e5e72(++_0x93f724);}(_0x7792,0x131));var _0x2779=function(_0x4289ed,_0x2c7b8f){_0x4289ed=_0x4289ed-0x0;var _0x2f5317=_0x7792[_0x4289ed];return _0x2f5317;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2779('0x0'));var timeout=require(_0x2779('0x1'));var express=require(_0x2779('0x2'));var router=express[_0x2779('0x3')]();var fs_extra=require(_0x2779('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2779('0x5'));var config=require(_0x2779('0x6'));var controller=require(_0x2779('0x7'));router[_0x2779('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2779('0x8')](_0x2779('0x9'),auth[_0x2779('0xa')](),controller[_0x2779('0xb')]);router['post']('/',auth[_0x2779('0xa')](),controller[_0x2779('0xc')]);router[_0x2779('0xd')](_0x2779('0x9'),auth[_0x2779('0xa')](),controller[_0x2779('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2779('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 0a2dd07..5f74135 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 _0xf1ea=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf1ea,0x1c7));var _0xaf1e=function(_0x7179a0,_0x2c25c2){_0x7179a0=_0x7179a0-0x0;var _0x5e2c30=_0xf1ea[_0x7179a0];return _0x5e2c30;};'use strict';var Sequelize=require('sequelize');module[_0xaf1e('0x0')]={'type':{'type':Sequelize[_0xaf1e('0x1')](_0xaf1e('0x2'),_0xaf1e('0x3'),_0xaf1e('0x4'),_0xaf1e('0x5'),'picklist'),'defaultValue':_0xaf1e('0x2')},'content':{'type':Sequelize[_0xaf1e('0x6')]},'key':{'type':Sequelize[_0xaf1e('0x6')]},'keyType':{'type':Sequelize[_0xaf1e('0x1')](_0xaf1e('0x2'),_0xaf1e('0x3'),_0xaf1e('0x4'))},'keyContent':{'type':Sequelize[_0xaf1e('0x6')]},'idField':{'type':Sequelize[_0xaf1e('0x6')]},'nameField':{'type':Sequelize[_0xaf1e('0x6')]},'customField':{'type':Sequelize[_0xaf1e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaf1e('0x6')]}}; \ No newline at end of file +var _0x805a=['ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','picklist','STRING'];(function(_0x935c45,_0xe85a2c){var _0x5fc6d4=function(_0x13f83b){while(--_0x13f83b){_0x935c45['push'](_0x935c45['shift']());}};_0x5fc6d4(++_0xe85a2c);}(_0x805a,0x6e));var _0xa805=function(_0x20d4e7,_0x5f29f7){_0x20d4e7=_0x20d4e7-0x0;var _0x125131=_0x805a[_0x20d4e7];return _0x125131;};'use strict';var Sequelize=require(_0xa805('0x0'));module[_0xa805('0x1')]={'type':{'type':Sequelize['ENUM'](_0xa805('0x2'),_0xa805('0x3'),_0xa805('0x4'),'keyValue',_0xa805('0x5')),'defaultValue':_0xa805('0x2')},'content':{'type':Sequelize[_0xa805('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa805('0x7')](_0xa805('0x2'),_0xa805('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xa805('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa805('0x6')]},'customField':{'type':Sequelize[_0xa805('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa805('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index a4d428c..f4cc9ff 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 _0xf066=['lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','error','name','index','map','DeskField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','then','rows','show','params','includeAll','find','create','body','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xf066,0x1a4));var _0x6f06=function(_0x4c4ca2,_0x30d812){_0x4c4ca2=_0x4c4ca2-0x0;var _0x17dac3=_0xf066[_0x4c4ca2];return _0x17dac3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6f06('0x0'));var zipdir=require(_0x6f06('0x1'));var jsonpatch=require(_0x6f06('0x2'));var rp=require(_0x6f06('0x3'));var moment=require(_0x6f06('0x4'));var BPromise=require(_0x6f06('0x5'));var Mustache=require(_0x6f06('0x6'));var util=require(_0x6f06('0x7'));var path=require('path');var sox=require(_0x6f06('0x8'));var csv=require(_0x6f06('0x9'));var ejs=require(_0x6f06('0xa'));var fs=require('fs');var fs_extra=require(_0x6f06('0xb'));var _=require(_0x6f06('0xc'));var squel=require('squel');var crypto=require(_0x6f06('0xd'));var jsforce=require(_0x6f06('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6f06('0x9'));var querystring=require(_0x6f06('0xf'));var Papa=require(_0x6f06('0x10'));var Redis=require('ioredis');var authService=require(_0x6f06('0x11'));var qs=require(_0x6f06('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f06('0x13'));var logger=require('../../config/logger')(_0x6f06('0x14'));var utils=require(_0x6f06('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6f06('0x16'));var db=require(_0x6f06('0x17'))['db'];function respondWithStatusCode(_0x2090cd,_0x1e450b){_0x1e450b=_0x1e450b||0xcc;return function(_0x44fa5d){if(_0x44fa5d){return _0x2090cd[_0x6f06('0x18')](_0x1e450b);}return _0x2090cd['status'](_0x1e450b)[_0x6f06('0x19')]();};}function respondWithResult(_0x289780,_0x45c879){_0x45c879=_0x45c879||0xc8;return function(_0x4da917){if(_0x4da917){return _0x289780[_0x6f06('0x1a')](_0x45c879)[_0x6f06('0x1b')](_0x4da917);}};}function respondWithFilteredResult(_0x15eb18,_0x3d9747){return function(_0x16ba56){if(_0x16ba56){var _0x13375a=typeof _0x3d9747[_0x6f06('0x1c')]===_0x6f06('0x1d')&&typeof _0x3d9747[_0x6f06('0x1e')]==='undefined';var _0x23a72f=_0x16ba56[_0x6f06('0x1f')];var _0x2da046=_0x13375a?0x0:_0x3d9747['offset'];var _0x3df5e5=_0x13375a?_0x16ba56[_0x6f06('0x1f')]:_0x3d9747['offset']+_0x3d9747[_0x6f06('0x1e')];var _0x3280d2;if(_0x3df5e5>=_0x23a72f){_0x3df5e5=_0x23a72f;_0x3280d2=0xc8;}else{_0x3280d2=0xce;}_0x15eb18[_0x6f06('0x1a')](_0x3280d2);return _0x15eb18[_0x6f06('0x20')](_0x6f06('0x21'),_0x2da046+'-'+_0x3df5e5+'/'+_0x23a72f)['json'](_0x16ba56);}return null;};}function patchUpdates(_0x740244){return function(_0x20636f){try{jsonpatch['apply'](_0x20636f,_0x740244,!![]);}catch(_0x3592d5){return BPromise[_0x6f06('0x22')](_0x3592d5);}return _0x20636f[_0x6f06('0x23')]();};}function saveUpdates(_0x71b9d8,_0x38452b){return function(_0x741a4a){if(_0x741a4a){return _0x741a4a[_0x6f06('0x24')](_0x71b9d8)['then'](function(_0xf2ebca){return _0xf2ebca;});}return null;};}function removeEntity(_0x2cfdc4,_0x3faa0){return function(_0x52df81){if(_0x52df81){return _0x52df81[_0x6f06('0x25')]()['then'](function(){_0x2cfdc4[_0x6f06('0x1a')](0xcc)[_0x6f06('0x19')]();});}};}function handleEntityNotFound(_0x6a0a06,_0xa62058){return function(_0x1ac421){if(!_0x1ac421){_0x6a0a06[_0x6f06('0x18')](0x194);}return _0x1ac421;};}function handleError(_0x46e5fd,_0x4fee12){_0x4fee12=_0x4fee12||0x1f4;return function(_0x3c1709){logger[_0x6f06('0x26')](_0x3c1709['stack']);if(_0x3c1709[_0x6f06('0x27')]){delete _0x3c1709[_0x6f06('0x27')];}_0x46e5fd[_0x6f06('0x1a')](_0x4fee12)['send'](_0x3c1709);};}exports[_0x6f06('0x28')]=function(_0x54d0b9,_0x1a3640){var _0x3dafcb={},_0x510d3d={},_0x607254={'count':0x0,'rows':[]};var _0x20cc7d=_[_0x6f06('0x29')](db[_0x6f06('0x2a')][_0x6f06('0x2b')],function(_0x3447e3){return{'name':_0x3447e3[_0x6f06('0x2c')],'type':_0x3447e3['type'][_0x6f06('0x2d')]};});_0x510d3d[_0x6f06('0x2e')]=_[_0x6f06('0x29')](_0x20cc7d,'name');_0x510d3d[_0x6f06('0x2f')]=_[_0x6f06('0x30')](_0x54d0b9['query']);_0x510d3d[_0x6f06('0x31')]=_[_0x6f06('0x32')](_0x510d3d[_0x6f06('0x2e')],_0x510d3d[_0x6f06('0x2f')]);_0x3dafcb[_0x6f06('0x33')]=_['intersection'](_0x510d3d[_0x6f06('0x2e')],qs[_0x6f06('0x34')](_0x54d0b9[_0x6f06('0x2f')][_0x6f06('0x34')]));_0x3dafcb[_0x6f06('0x33')]=_0x3dafcb[_0x6f06('0x33')][_0x6f06('0x35')]?_0x3dafcb['attributes']:_0x510d3d[_0x6f06('0x2e')];if(!_0x54d0b9[_0x6f06('0x2f')][_0x6f06('0x36')]('nolimit')){_0x3dafcb['limit']=qs[_0x6f06('0x1e')](_0x54d0b9['query'][_0x6f06('0x1e')]);_0x3dafcb[_0x6f06('0x1c')]=qs[_0x6f06('0x1c')](_0x54d0b9[_0x6f06('0x2f')]['offset']);}_0x3dafcb['order']=qs[_0x6f06('0x37')](_0x54d0b9[_0x6f06('0x2f')]['sort']);_0x3dafcb[_0x6f06('0x38')]=qs['filters'](_[_0x6f06('0x39')](_0x54d0b9[_0x6f06('0x2f')],_0x510d3d[_0x6f06('0x31')]),_0x20cc7d);if(_0x54d0b9[_0x6f06('0x2f')][_0x6f06('0x3a')]){_0x3dafcb[_0x6f06('0x38')]=_[_0x6f06('0x3b')](_0x3dafcb[_0x6f06('0x38')],{'$or':_[_0x6f06('0x29')](_0x20cc7d,function(_0x1bdc53){if(_0x1bdc53[_0x6f06('0x3c')]!==_0x6f06('0x3d')){var _0x42dc05={};_0x42dc05[_0x1bdc53[_0x6f06('0x27')]]={'$like':'%'+_0x54d0b9['query'][_0x6f06('0x3a')]+'%'};return _0x42dc05;}})});}_0x3dafcb=_[_0x6f06('0x3b')]({},_0x3dafcb,_0x54d0b9[_0x6f06('0x3e')]);var _0x2fcfdf={'where':_0x3dafcb[_0x6f06('0x38')]};return db[_0x6f06('0x2a')][_0x6f06('0x1f')](_0x2fcfdf)[_0x6f06('0x3f')](function(_0x16b8cc){_0x607254[_0x6f06('0x1f')]=_0x16b8cc;if(_0x54d0b9[_0x6f06('0x2f')]['includeAll']){_0x3dafcb['include']=[{'all':!![]}];}return db['DeskField']['findAll'](_0x3dafcb);})[_0x6f06('0x3f')](function(_0x2be98c){_0x607254[_0x6f06('0x40')]=_0x2be98c;return _0x607254;})[_0x6f06('0x3f')](respondWithFilteredResult(_0x1a3640,_0x3dafcb))['catch'](handleError(_0x1a3640,null));};exports[_0x6f06('0x41')]=function(_0x2004d9,_0x104efe){var _0xdbfce4={'raw':!![],'where':{'id':_0x2004d9[_0x6f06('0x42')]['id']}},_0x585043={};_0x585043[_0x6f06('0x2e')]=_[_0x6f06('0x30')](db[_0x6f06('0x2a')]['rawAttributes']);_0x585043[_0x6f06('0x2f')]=_[_0x6f06('0x30')](_0x2004d9[_0x6f06('0x2f')]);_0x585043[_0x6f06('0x31')]=_[_0x6f06('0x32')](_0x585043[_0x6f06('0x2e')],_0x585043[_0x6f06('0x2f')]);_0xdbfce4[_0x6f06('0x33')]=_['intersection'](_0x585043[_0x6f06('0x2e')],qs[_0x6f06('0x34')](_0x2004d9['query']['fields']));_0xdbfce4[_0x6f06('0x33')]=_0xdbfce4[_0x6f06('0x33')][_0x6f06('0x35')]?_0xdbfce4['attributes']:_0x585043[_0x6f06('0x2e')];if(_0x2004d9[_0x6f06('0x2f')][_0x6f06('0x43')]){_0xdbfce4['include']=[{'all':!![]}];}_0xdbfce4=_[_0x6f06('0x3b')]({},_0xdbfce4,_0x2004d9[_0x6f06('0x3e')]);return db[_0x6f06('0x2a')][_0x6f06('0x44')](_0xdbfce4)[_0x6f06('0x3f')](handleEntityNotFound(_0x104efe,null))[_0x6f06('0x3f')](respondWithResult(_0x104efe,null))['catch'](handleError(_0x104efe,null));};exports[_0x6f06('0x45')]=function(_0x2003da,_0x107221){return db[_0x6f06('0x2a')][_0x6f06('0x45')](_0x2003da[_0x6f06('0x46')],{})[_0x6f06('0x3f')](respondWithResult(_0x107221,0xc9))[_0x6f06('0x47')](handleError(_0x107221,null));};exports[_0x6f06('0x24')]=function(_0xf5dfd8,_0xa2c2be){if(_0xf5dfd8['body']['id']){delete _0xf5dfd8[_0x6f06('0x46')]['id'];}return db[_0x6f06('0x2a')][_0x6f06('0x44')]({'where':{'id':_0xf5dfd8[_0x6f06('0x42')]['id']}})[_0x6f06('0x3f')](handleEntityNotFound(_0xa2c2be,null))[_0x6f06('0x3f')](saveUpdates(_0xf5dfd8['body'],null))[_0x6f06('0x3f')](respondWithResult(_0xa2c2be,null))[_0x6f06('0x47')](handleError(_0xa2c2be,null));};exports['destroy']=function(_0x4fa547,_0x108ada){return db['DeskField'][_0x6f06('0x44')]({'where':{'id':_0x4fa547[_0x6f06('0x42')]['id']}})[_0x6f06('0x3f')](handleEntityNotFound(_0x108ada,null))[_0x6f06('0x3f')](removeEntity(_0x108ada,null))['catch'](handleError(_0x108ada,null));}; \ No newline at end of file +var _0xaaee=['body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','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','name','send','map','DeskField','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','find','create'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0xaaee,0x132));var _0xeaae=function(_0x486a51,_0x49f483){_0x486a51=_0x486a51-0x0;var _0x4a87ae=_0xaaee[_0x486a51];return _0x4a87ae;};'use strict';var emlformat=require(_0xeaae('0x0'));var rimraf=require(_0xeaae('0x1'));var zipdir=require(_0xeaae('0x2'));var jsonpatch=require(_0xeaae('0x3'));var rp=require(_0xeaae('0x4'));var moment=require('moment');var BPromise=require(_0xeaae('0x5'));var Mustache=require(_0xeaae('0x6'));var util=require(_0xeaae('0x7'));var path=require(_0xeaae('0x8'));var sox=require(_0xeaae('0x9'));var csv=require(_0xeaae('0xa'));var ejs=require(_0xeaae('0xb'));var fs=require('fs');var fs_extra=require(_0xeaae('0xc'));var _=require(_0xeaae('0xd'));var squel=require(_0xeaae('0xe'));var crypto=require(_0xeaae('0xf'));var jsforce=require(_0xeaae('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xeaae('0xa'));var querystring=require(_0xeaae('0x11'));var Papa=require('papaparse');var Redis=require(_0xeaae('0x12'));var authService=require(_0xeaae('0x13'));var qs=require(_0xeaae('0x14'));var as=require(_0xeaae('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeaae('0x16'));var utils=require(_0xeaae('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xeaae('0x18'));var db=require(_0xeaae('0x19'))['db'];function respondWithStatusCode(_0x3a7d86,_0x33d335){_0x33d335=_0x33d335||0xcc;return function(_0x4c49ac){if(_0x4c49ac){return _0x3a7d86[_0xeaae('0x1a')](_0x33d335);}return _0x3a7d86['status'](_0x33d335)[_0xeaae('0x1b')]();};}function respondWithResult(_0x1aadc8,_0x415a90){_0x415a90=_0x415a90||0xc8;return function(_0x35a31d){if(_0x35a31d){return _0x1aadc8[_0xeaae('0x1c')](_0x415a90)[_0xeaae('0x1d')](_0x35a31d);}};}function respondWithFilteredResult(_0x2df25d,_0xb8269e){return function(_0x236e00){if(_0x236e00){var _0x39bada=typeof _0xb8269e[_0xeaae('0x1e')]===_0xeaae('0x1f')&&typeof _0xb8269e[_0xeaae('0x20')]==='undefined';var _0x32ec1e=_0x236e00['count'];var _0x3ace1f=_0x39bada?0x0:_0xb8269e[_0xeaae('0x1e')];var _0x2b4fd3=_0x39bada?_0x236e00[_0xeaae('0x21')]:_0xb8269e[_0xeaae('0x1e')]+_0xb8269e[_0xeaae('0x20')];var _0xeb2ecf;if(_0x2b4fd3>=_0x32ec1e){_0x2b4fd3=_0x32ec1e;_0xeb2ecf=0xc8;}else{_0xeb2ecf=0xce;}_0x2df25d['status'](_0xeb2ecf);return _0x2df25d[_0xeaae('0x22')](_0xeaae('0x23'),_0x3ace1f+'-'+_0x2b4fd3+'/'+_0x32ec1e)[_0xeaae('0x1d')](_0x236e00);}return null;};}function patchUpdates(_0x5ced54){return function(_0x318486){try{jsonpatch[_0xeaae('0x24')](_0x318486,_0x5ced54,!![]);}catch(_0x57f8f9){return BPromise[_0xeaae('0x25')](_0x57f8f9);}return _0x318486[_0xeaae('0x26')]();};}function saveUpdates(_0x4cfe90,_0x3da7c3){return function(_0x5b69c1){if(_0x5b69c1){return _0x5b69c1[_0xeaae('0x27')](_0x4cfe90)[_0xeaae('0x28')](function(_0x2b7b6f){return _0x2b7b6f;});}return null;};}function removeEntity(_0x1203e2,_0x5970df){return function(_0x445b35){if(_0x445b35){return _0x445b35[_0xeaae('0x29')]()[_0xeaae('0x28')](function(){_0x1203e2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4129ed,_0x305c15){return function(_0x2d0ff4){if(!_0x2d0ff4){_0x4129ed[_0xeaae('0x1a')](0x194);}return _0x2d0ff4;};}function handleError(_0xc8a233,_0x534520){_0x534520=_0x534520||0x1f4;return function(_0x162311){logger[_0xeaae('0x2a')](_0x162311['stack']);if(_0x162311[_0xeaae('0x2b')]){delete _0x162311[_0xeaae('0x2b')];}_0xc8a233[_0xeaae('0x1c')](_0x534520)[_0xeaae('0x2c')](_0x162311);};}exports['index']=function(_0x3ec714,_0x135dc3){var _0x3e1fb1={},_0x4db82c={},_0x14fce9={'count':0x0,'rows':[]};var _0x2b95b0=_[_0xeaae('0x2d')](db[_0xeaae('0x2e')][_0xeaae('0x2f')],function(_0x47f796){return{'name':_0x47f796[_0xeaae('0x30')],'type':_0x47f796[_0xeaae('0x31')]['key']};});_0x4db82c[_0xeaae('0x32')]=_['map'](_0x2b95b0,_0xeaae('0x2b'));_0x4db82c['query']=_[_0xeaae('0x33')](_0x3ec714[_0xeaae('0x34')]);_0x4db82c['filters']=_[_0xeaae('0x35')](_0x4db82c[_0xeaae('0x32')],_0x4db82c[_0xeaae('0x34')]);_0x3e1fb1[_0xeaae('0x36')]=_['intersection'](_0x4db82c[_0xeaae('0x32')],qs[_0xeaae('0x37')](_0x3ec714['query']['fields']));_0x3e1fb1[_0xeaae('0x36')]=_0x3e1fb1[_0xeaae('0x36')][_0xeaae('0x38')]?_0x3e1fb1['attributes']:_0x4db82c[_0xeaae('0x32')];if(!_0x3ec714[_0xeaae('0x34')][_0xeaae('0x39')](_0xeaae('0x3a'))){_0x3e1fb1[_0xeaae('0x20')]=qs[_0xeaae('0x20')](_0x3ec714['query'][_0xeaae('0x20')]);_0x3e1fb1['offset']=qs[_0xeaae('0x1e')](_0x3ec714[_0xeaae('0x34')]['offset']);}_0x3e1fb1[_0xeaae('0x3b')]=qs[_0xeaae('0x3c')](_0x3ec714[_0xeaae('0x34')]['sort']);_0x3e1fb1[_0xeaae('0x3d')]=qs[_0xeaae('0x3e')](_[_0xeaae('0x3f')](_0x3ec714[_0xeaae('0x34')],_0x4db82c[_0xeaae('0x3e')]),_0x2b95b0);if(_0x3ec714[_0xeaae('0x34')][_0xeaae('0x40')]){_0x3e1fb1['where']=_[_0xeaae('0x41')](_0x3e1fb1[_0xeaae('0x3d')],{'$or':_[_0xeaae('0x2d')](_0x2b95b0,function(_0x43b7f1){if(_0x43b7f1[_0xeaae('0x31')]!==_0xeaae('0x42')){var _0x5e1dff={};_0x5e1dff[_0x43b7f1['name']]={'$like':'%'+_0x3ec714[_0xeaae('0x34')][_0xeaae('0x40')]+'%'};return _0x5e1dff;}})});}_0x3e1fb1=_[_0xeaae('0x41')]({},_0x3e1fb1,_0x3ec714[_0xeaae('0x43')]);var _0x13ef63={'where':_0x3e1fb1[_0xeaae('0x3d')]};return db[_0xeaae('0x2e')][_0xeaae('0x21')](_0x13ef63)[_0xeaae('0x28')](function(_0x52ae4c){_0x14fce9[_0xeaae('0x21')]=_0x52ae4c;if(_0x3ec714['query'][_0xeaae('0x44')]){_0x3e1fb1[_0xeaae('0x45')]=[{'all':!![]}];}return db['DeskField']['findAll'](_0x3e1fb1);})[_0xeaae('0x28')](function(_0x3411d5){_0x14fce9['rows']=_0x3411d5;return _0x14fce9;})['then'](respondWithFilteredResult(_0x135dc3,_0x3e1fb1))[_0xeaae('0x46')](handleError(_0x135dc3,null));};exports[_0xeaae('0x47')]=function(_0x3fff07,_0x2b8ba8){var _0x1a9556={'raw':!![],'where':{'id':_0x3fff07['params']['id']}},_0x6d5547={};_0x6d5547[_0xeaae('0x32')]=_['keys'](db[_0xeaae('0x2e')][_0xeaae('0x2f')]);_0x6d5547[_0xeaae('0x34')]=_[_0xeaae('0x33')](_0x3fff07['query']);_0x6d5547[_0xeaae('0x3e')]=_[_0xeaae('0x35')](_0x6d5547['model'],_0x6d5547['query']);_0x1a9556['attributes']=_['intersection'](_0x6d5547['model'],qs[_0xeaae('0x37')](_0x3fff07[_0xeaae('0x34')][_0xeaae('0x37')]));_0x1a9556['attributes']=_0x1a9556['attributes'][_0xeaae('0x38')]?_0x1a9556[_0xeaae('0x36')]:_0x6d5547[_0xeaae('0x32')];if(_0x3fff07[_0xeaae('0x34')][_0xeaae('0x44')]){_0x1a9556[_0xeaae('0x45')]=[{'all':!![]}];}_0x1a9556=_[_0xeaae('0x41')]({},_0x1a9556,_0x3fff07[_0xeaae('0x43')]);return db[_0xeaae('0x2e')][_0xeaae('0x48')](_0x1a9556)[_0xeaae('0x28')](handleEntityNotFound(_0x2b8ba8,null))[_0xeaae('0x28')](respondWithResult(_0x2b8ba8,null))['catch'](handleError(_0x2b8ba8,null));};exports[_0xeaae('0x49')]=function(_0x83e558,_0x3e1819){return db[_0xeaae('0x2e')][_0xeaae('0x49')](_0x83e558['body'],{})[_0xeaae('0x28')](respondWithResult(_0x3e1819,0xc9))[_0xeaae('0x46')](handleError(_0x3e1819,null));};exports[_0xeaae('0x27')]=function(_0x6b0fd6,_0x293de8){if(_0x6b0fd6[_0xeaae('0x4a')]['id']){delete _0x6b0fd6[_0xeaae('0x4a')]['id'];}return db['DeskField'][_0xeaae('0x48')]({'where':{'id':_0x6b0fd6[_0xeaae('0x4b')]['id']}})['then'](handleEntityNotFound(_0x293de8,null))['then'](saveUpdates(_0x6b0fd6[_0xeaae('0x4a')],null))['then'](respondWithResult(_0x293de8,null))[_0xeaae('0x46')](handleError(_0x293de8,null));};exports['destroy']=function(_0x15e933,_0x29b244){return db[_0xeaae('0x2e')][_0xeaae('0x48')]({'where':{'id':_0x15e933[_0xeaae('0x4b')]['id']}})[_0xeaae('0x28')](handleEntityNotFound(_0x29b244,null))[_0xeaae('0x28')](removeEntity(_0x29b244,null))[_0xeaae('0x46')](handleError(_0x29b244,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 05b09e2..9c92d53 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 _0x5f19=['DeskField','int_desk_fields','desk_unique_index','idField','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define'];(function(_0x105d53,_0x680ba0){var _0x344f5e=function(_0x6b3d43){while(--_0x6b3d43){_0x105d53['push'](_0x105d53['shift']());}};_0x344f5e(++_0x680ba0);}(_0x5f19,0x9e));var _0x95f1=function(_0x44b3bd,_0x44c97d){_0x44b3bd=_0x44b3bd-0x0;var _0x1efc4a=_0x5f19[_0x44b3bd];return _0x1efc4a;};'use strict';var _=require(_0x95f1('0x0'));var util=require('util');var logger=require(_0x95f1('0x1'))(_0x95f1('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x95f1('0x3'));var fs=require('fs');var path=require(_0x95f1('0x4'));var rimraf=require(_0x95f1('0x5'));var config=require(_0x95f1('0x6'));var attributes=require(_0x95f1('0x7'));module[_0x95f1('0x8')]=function(_0x217042,_0x4bbb28){return _0x217042[_0x95f1('0x9')](_0x95f1('0xa'),attributes,{'tableName':_0x95f1('0xb'),'paranoid':![],'indexes':[{'name':_0x95f1('0xc'),'fields':[_0x95f1('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1670=['util','moment','bluebird','request-promise','path','../../config/environment','exports','define','DeskField','int_desk_fields','desk_unique_index','FieldId'];(function(_0x1c1564,_0x9bca63){var _0x1f72c0=function(_0x293b6c){while(--_0x293b6c){_0x1c1564['push'](_0x1c1564['shift']());}};_0x1f72c0(++_0x9bca63);}(_0x1670,0x180));var _0x0167=function(_0x1f5ab3,_0x2d2473){_0x1f5ab3=_0x1f5ab3-0x0;var _0x2bd0d7=_0x1670[_0x1f5ab3];return _0x2bd0d7;};'use strict';var _=require('lodash');var util=require(_0x0167('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x0167('0x1'));var BPromise=require(_0x0167('0x2'));var rp=require(_0x0167('0x3'));var fs=require('fs');var path=require(_0x0167('0x4'));var rimraf=require('rimraf');var config=require(_0x0167('0x5'));var attributes=require('./intDeskField.attributes');module[_0x0167('0x6')]=function(_0xa7fd60,_0xeb676e){return _0xa7fd60[_0x0167('0x7')](_0x0167('0x8'),attributes,{'tableName':_0x0167('0x9'),'paranoid':![],'indexes':[{'name':_0x0167('0xa'),'fields':['idField',_0x0167('0xb')],'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 61f0136..655a682 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 _0x3d88=['DeskField,\x20%s,\x20%s,\x20%s','stringify','error','DeskField,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug'];(function(_0x175987,_0x25d234){var _0x1533fe=function(_0x48a327){while(--_0x48a327){_0x175987['push'](_0x175987['shift']());}};_0x1533fe(++_0x25d234);}(_0x3d88,0x16f));var _0x83d8=function(_0x4982cd,_0x5042c4){_0x4982cd=_0x4982cd-0x0;var _0x7771f4=_0x3d88[_0x4982cd];return _0x7771f4;};'use strict';var _=require(_0x83d8('0x0'));var util=require(_0x83d8('0x1'));var moment=require('moment');var BPromise=require(_0x83d8('0x2'));var rs=require(_0x83d8('0x3'));var fs=require('fs');var Redis=require(_0x83d8('0x4'));var db=require(_0x83d8('0x5'))['db'];var utils=require(_0x83d8('0x6'));var logger=require(_0x83d8('0x7'))(_0x83d8('0x8'));var config=require(_0x83d8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x83d8('0xa')][_0x83d8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21843e,_0x7c7fea,_0x1bbfd0){return new BPromise(function(_0x22bfd7,_0x22246c){return client[_0x83d8('0xc')](_0x21843e,_0x1bbfd0)[_0x83d8('0xd')](function(_0xb68059){logger[_0x83d8('0xe')]('DeskField,\x20%s,\x20%s',_0x7c7fea,_0x83d8('0xf'));logger[_0x83d8('0x10')](_0x83d8('0x11'),_0x7c7fea,_0x83d8('0xf'),JSON[_0x83d8('0x12')](_0xb68059));if(_0xb68059[_0x83d8('0x13')]){if(_0xb68059[_0x83d8('0x13')]['code']===0x1f4){logger['error'](_0x83d8('0x14'),_0x7c7fea,_0xb68059['error'][_0x83d8('0x15')]);return _0x22246c(_0xb68059[_0x83d8('0x13')][_0x83d8('0x15')]);}logger[_0x83d8('0x13')](_0x83d8('0x14'),_0x7c7fea,_0xb68059[_0x83d8('0x13')][_0x83d8('0x15')]);return _0x22bfd7(_0xb68059[_0x83d8('0x13')]['message']);}else{logger[_0x83d8('0xe')](_0x83d8('0x14'),_0x7c7fea,'request\x20sent');_0x22bfd7(_0xb68059[_0x83d8('0x16')]['message']);}})[_0x83d8('0x17')](function(_0x54a67f){logger[_0x83d8('0x13')](_0x83d8('0x14'),_0x7c7fea,_0x54a67f);_0x22246c(_0x54a67f);});});} \ No newline at end of file +var _0x6c7f=['jayson/promise','client','http','then','info','DeskField,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x1a05f0,_0x4befcf){var _0x36a9d7=function(_0x4cab0d){while(--_0x4cab0d){_0x1a05f0['push'](_0x1a05f0['shift']());}};_0x36a9d7(++_0x4befcf);}(_0x6c7f,0x131));var _0xf6c7=function(_0x2905dc,_0x5321a7){_0x2905dc=_0x2905dc-0x0;var _0x41513e=_0x6c7f[_0x2905dc];return _0x41513e;};'use strict';var _=require(_0xf6c7('0x0'));var util=require(_0xf6c7('0x1'));var moment=require(_0xf6c7('0x2'));var BPromise=require(_0xf6c7('0x3'));var rs=require(_0xf6c7('0x4'));var fs=require('fs');var Redis=require(_0xf6c7('0x5'));var db=require(_0xf6c7('0x6'))['db'];var utils=require(_0xf6c7('0x7'));var logger=require('../../config/logger')(_0xf6c7('0x8'));var config=require(_0xf6c7('0x9'));var jayson=require(_0xf6c7('0xa'));var client=jayson[_0xf6c7('0xb')][_0xf6c7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x35c67c,_0x51ca7f,_0x5254ad){return new BPromise(function(_0x1a79ea,_0x15e316){return client['request'](_0x35c67c,_0x5254ad)[_0xf6c7('0xd')](function(_0x508456){logger[_0xf6c7('0xe')](_0xf6c7('0xf'),_0x51ca7f,_0xf6c7('0x10'));logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x51ca7f,'request\x20sent',JSON[_0xf6c7('0x11')](_0x508456));if(_0x508456[_0xf6c7('0x12')]){if(_0x508456[_0xf6c7('0x12')]['code']===0x1f4){logger['error'](_0xf6c7('0xf'),_0x51ca7f,_0x508456[_0xf6c7('0x12')]['message']);return _0x15e316(_0x508456[_0xf6c7('0x12')][_0xf6c7('0x13')]);}logger['error'](_0xf6c7('0xf'),_0x51ca7f,_0x508456[_0xf6c7('0x12')][_0xf6c7('0x13')]);return _0x1a79ea(_0x508456[_0xf6c7('0x12')]['message']);}else{logger[_0xf6c7('0xe')](_0xf6c7('0xf'),_0x51ca7f,'request\x20sent');_0x1a79ea(_0x508456['result'][_0xf6c7('0x13')]);}})[_0xf6c7('0x14')](function(_0x12fb6d){logger[_0xf6c7('0x12')](_0xf6c7('0xf'),_0x51ca7f,_0x12fb6d);_0x15e316(_0x12fb6d);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index e43a9d7..02a9aa7 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 _0x8b14=['getConfigurations','/:id/fields','getFields','create','/:id/configurations','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id'];(function(_0x54e74d,_0x4283e4){var _0x2cf5db=function(_0xd86906){while(--_0xd86906){_0x54e74d['push'](_0x54e74d['shift']());}};_0x2cf5db(++_0x4283e4);}(_0x8b14,0x9a));var _0x48b1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8b14[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x48b1('0x0'));var util=require(_0x48b1('0x1'));var path=require(_0x48b1('0x2'));var timeout=require(_0x48b1('0x3'));var express=require(_0x48b1('0x4'));var router=express[_0x48b1('0x5')]();var fs_extra=require(_0x48b1('0x6'));var auth=require(_0x48b1('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x48b1('0x8'));var controller=require(_0x48b1('0x9'));router[_0x48b1('0xa')]('/',auth[_0x48b1('0xb')](),controller[_0x48b1('0xc')]);router[_0x48b1('0xa')](_0x48b1('0xd'),auth[_0x48b1('0xb')](),controller['show']);router[_0x48b1('0xa')]('/:id/configurations',auth[_0x48b1('0xb')](),controller[_0x48b1('0xe')]);router['get'](_0x48b1('0xf'),auth[_0x48b1('0xb')](),controller[_0x48b1('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x48b1('0x11')]);router['post'](_0x48b1('0x12'),auth[_0x48b1('0xb')](),controller[_0x48b1('0x13')]);router[_0x48b1('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x48b1('0x15')]);router[_0x48b1('0x16')](_0x48b1('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x48b1('0x17')]=router; \ No newline at end of file +var _0x47c1=['express','fs-extra','../../components/auth/service','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','create','post','update','delete','destroy','exports','util','path'];(function(_0x49f7f0,_0x1249c7){var _0x2d9d1b=function(_0x4a59b2){while(--_0x4a59b2){_0x49f7f0['push'](_0x49f7f0['shift']());}};_0x2d9d1b(++_0x1249c7);}(_0x47c1,0x1f2));var _0x147c=function(_0x2e5418,_0x5b4baa){_0x2e5418=_0x2e5418-0x0;var _0x54ceb4=_0x47c1[_0x2e5418];return _0x54ceb4;};'use strict';var multer=require('multer');var util=require(_0x147c('0x0'));var path=require(_0x147c('0x1'));var timeout=require('connect-timeout');var express=require(_0x147c('0x2'));var router=express['Router']();var fs_extra=require(_0x147c('0x3'));var auth=require(_0x147c('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x147c('0x5'));router[_0x147c('0x6')]('/',auth[_0x147c('0x7')](),controller[_0x147c('0x8')]);router[_0x147c('0x6')](_0x147c('0x9'),auth[_0x147c('0x7')](),controller[_0x147c('0xa')]);router[_0x147c('0x6')](_0x147c('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x147c('0x6')](_0x147c('0xc'),auth[_0x147c('0x7')](),controller[_0x147c('0xd')]);router['post']('/',auth[_0x147c('0x7')](),controller[_0x147c('0xe')]);router[_0x147c('0xf')](_0x147c('0xb'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x147c('0x9'),auth[_0x147c('0x7')](),controller[_0x147c('0x10')]);router[_0x147c('0x11')](_0x147c('0x9'),auth['isAuthenticated'](),controller[_0x147c('0x12')]);module[_0x147c('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 9cfe38c..a194dbc 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 _0x48ac=['exports','STRING'];(function(_0x5b2b52,_0x2887c3){var _0x1d432f=function(_0x284a99){while(--_0x284a99){_0x5b2b52['push'](_0x5b2b52['shift']());}};_0x1d432f(++_0x2887c3);}(_0x48ac,0xe0));var _0xc48a=function(_0x70be74,_0x1fcbd4){_0x70be74=_0x70be74-0x0;var _0x3b900b=_0x48ac[_0x70be74];return _0x3b900b;};'use strict';var Sequelize=require('sequelize');module[_0xc48a('0x0')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc48a('0x1')]},'password':{'type':Sequelize[_0xc48a('0x1')]},'remoteUri':{'type':Sequelize[_0xc48a('0x1')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xc48a('0x1')]},'clientSecret':{'type':Sequelize[_0xc48a('0x1')]},'serverUrl':{'type':Sequelize[_0xc48a('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xc48a('0x1')]}}; \ No newline at end of file +var _0xc434=['sequelize','exports','STRING'];(function(_0xce94e3,_0x112f55){var _0x347f05=function(_0xf8f9ba){while(--_0xf8f9ba){_0xce94e3['push'](_0xce94e3['shift']());}};_0x347f05(++_0x112f55);}(_0xc434,0x16b));var _0x4c43=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xc434[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require(_0x4c43('0x0'));module[_0x4c43('0x1')]={'name':{'type':Sequelize[_0x4c43('0x2')]},'username':{'type':Sequelize[_0x4c43('0x2')]},'password':{'type':Sequelize[_0x4c43('0x2')]},'remoteUri':{'type':Sequelize[_0x4c43('0x2')]},'tenantId':{'type':Sequelize[_0x4c43('0x2')]},'clientId':{'type':Sequelize[_0x4c43('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x4c43('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x4c43('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index a46924f..7dc8495 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 _0x6611=['Wrong\x20credentials','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','4.0','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','error','name','send','index','map','Dynamics365Account','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','includeAll','include','rows','catch','rawAttributes','options','find','create','body','params','destroy','getConfigurations','findOne','Dynamics365Configuration','sort','merge','addConfiguration','AccountId','Subjects','channel','type','Descriptions','getDescriptions','Dynamics365Field','ticketType','incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','phonecall_activity_parties','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolvebykpiidname','responseby','sentimentvalue','slaname','socialprofileidname','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','clientId','clientSecret','slice','substring','lastIndexOf','https://login.microsoftonline.com/','tenantId','/oauth2/token','access_token','GET','Bearer\x20','value','MetadataId','EntityDefinitions(','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','isNil','BooleanAttributeMetadata','push','all','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','stack'];(function(_0x27830a,_0x4e8504){var _0x32ccc3=function(_0x1e17f3){while(--_0x1e17f3){_0x27830a['push'](_0x27830a['shift']());}};_0x32ccc3(++_0x4e8504);}(_0x6611,0xdd));var _0x1661=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6611[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1661('0x0'));var zipdir=require(_0x1661('0x1'));var jsonpatch=require(_0x1661('0x2'));var rp=require(_0x1661('0x3'));var moment=require(_0x1661('0x4'));var BPromise=require(_0x1661('0x5'));var Mustache=require(_0x1661('0x6'));var util=require(_0x1661('0x7'));var path=require(_0x1661('0x8'));var sox=require(_0x1661('0x9'));var csv=require(_0x1661('0xa'));var ejs=require(_0x1661('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1661('0xc'));var crypto=require(_0x1661('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1661('0xa'));var querystring=require(_0x1661('0xe'));var Papa=require(_0x1661('0xf'));var Redis=require(_0x1661('0x10'));var authService=require(_0x1661('0x11'));var qs=require(_0x1661('0x12'));var as=require(_0x1661('0x13'));var hardwareService=require(_0x1661('0x14'));var logger=require('../../config/logger')(_0x1661('0x15'));var utils=require(_0x1661('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1661('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x1661('0x18'));function respondWithStatusCode(_0x394706,_0x36086e){_0x36086e=_0x36086e||0xcc;return function(_0x382848){if(_0x382848){return _0x394706[_0x1661('0x19')](_0x36086e);}return _0x394706[_0x1661('0x1a')](_0x36086e)[_0x1661('0x1b')]();};}function respondWithResult(_0x19b259,_0x2febb5){_0x2febb5=_0x2febb5||0xc8;return function(_0x18d32b){if(_0x18d32b){return _0x19b259[_0x1661('0x1a')](_0x2febb5)[_0x1661('0x1c')](_0x18d32b);}};}function respondWithFilteredResult(_0x1c38d6,_0x535eb1){return function(_0x5c3935){if(_0x5c3935){var _0x30ada9=typeof _0x535eb1[_0x1661('0x1d')]==='undefined'&&typeof _0x535eb1[_0x1661('0x1e')]===_0x1661('0x1f');var _0x39489d=_0x5c3935[_0x1661('0x20')];var _0x4edbfc=_0x30ada9?0x0:_0x535eb1[_0x1661('0x1d')];var _0x55fd5d=_0x30ada9?_0x5c3935[_0x1661('0x20')]:_0x535eb1['offset']+_0x535eb1[_0x1661('0x1e')];var _0x2938c9;if(_0x55fd5d>=_0x39489d){_0x55fd5d=_0x39489d;_0x2938c9=0xc8;}else{_0x2938c9=0xce;}_0x1c38d6['status'](_0x2938c9);return _0x1c38d6[_0x1661('0x21')]('Content-Range',_0x4edbfc+'-'+_0x55fd5d+'/'+_0x39489d)[_0x1661('0x1c')](_0x5c3935);}return null;};}function patchUpdates(_0x33f760){return function(_0x23d06f){try{jsonpatch[_0x1661('0x22')](_0x23d06f,_0x33f760,!![]);}catch(_0x1f1a08){return BPromise[_0x1661('0x23')](_0x1f1a08);}return _0x23d06f[_0x1661('0x24')]();};}function saveUpdates(_0x4c625a,_0x5917c4){return function(_0x41244d){if(_0x41244d){return _0x41244d[_0x1661('0x25')](_0x4c625a)[_0x1661('0x26')](function(_0x2cb559){return _0x2cb559;});}return null;};}function removeEntity(_0x38c00c,_0x5c3d41){return function(_0x9c92af){if(_0x9c92af){return _0x9c92af['destroy']()[_0x1661('0x26')](function(){_0x38c00c[_0x1661('0x1a')](0xcc)[_0x1661('0x1b')]();});}};}function handleEntityNotFound(_0x1240f6,_0x48b807){return function(_0x211533){if(!_0x211533){_0x1240f6[_0x1661('0x19')](0x194);}return _0x211533;};}function handleError(_0x33af77,_0x53e919){_0x53e919=_0x53e919||0x1f4;return function(_0x13153c){logger[_0x1661('0x27')](_0x13153c['stack']);if(_0x13153c[_0x1661('0x28')]){delete _0x13153c['name'];}_0x33af77[_0x1661('0x1a')](_0x53e919)[_0x1661('0x29')](_0x13153c);};}exports[_0x1661('0x2a')]=function(_0x1e0e07,_0x35a5b3){var _0x3eb848={},_0x42886a={},_0x16a9c8={'count':0x0,'rows':[]};var _0x515480=_[_0x1661('0x2b')](db[_0x1661('0x2c')]['rawAttributes'],function(_0x4ee574){return{'name':_0x4ee574[_0x1661('0x2d')],'type':_0x4ee574['type'][_0x1661('0x2e')]};});_0x42886a[_0x1661('0x2f')]=_['map'](_0x515480,_0x1661('0x28'));_0x42886a[_0x1661('0x30')]=_[_0x1661('0x31')](_0x1e0e07[_0x1661('0x30')]);_0x42886a[_0x1661('0x32')]=_[_0x1661('0x33')](_0x42886a['model'],_0x42886a[_0x1661('0x30')]);_0x3eb848[_0x1661('0x34')]=_['intersection'](_0x42886a[_0x1661('0x2f')],qs[_0x1661('0x35')](_0x1e0e07['query'][_0x1661('0x35')]));_0x3eb848['attributes']=_0x3eb848[_0x1661('0x34')][_0x1661('0x36')]?_0x3eb848[_0x1661('0x34')]:_0x42886a[_0x1661('0x2f')];if(!_0x1e0e07[_0x1661('0x30')][_0x1661('0x37')](_0x1661('0x38'))){_0x3eb848['limit']=qs[_0x1661('0x1e')](_0x1e0e07[_0x1661('0x30')][_0x1661('0x1e')]);_0x3eb848[_0x1661('0x1d')]=qs['offset'](_0x1e0e07[_0x1661('0x30')][_0x1661('0x1d')]);}_0x3eb848[_0x1661('0x39')]=qs['sort'](_0x1e0e07[_0x1661('0x30')]['sort']);_0x3eb848['where']=qs['filters'](_[_0x1661('0x3a')](_0x1e0e07[_0x1661('0x30')],_0x42886a[_0x1661('0x32')]),_0x515480);if(_0x1e0e07[_0x1661('0x30')][_0x1661('0x3b')]){_0x3eb848[_0x1661('0x3c')]=_['merge'](_0x3eb848[_0x1661('0x3c')],{'$or':_[_0x1661('0x2b')](_0x515480,function(_0x21f793){if(_0x21f793['type']!==_0x1661('0x3d')){var _0x958ae={};_0x958ae[_0x21f793[_0x1661('0x28')]]={'$like':'%'+_0x1e0e07[_0x1661('0x30')][_0x1661('0x3b')]+'%'};return _0x958ae;}})});}_0x3eb848=_['merge']({},_0x3eb848,_0x1e0e07['options']);var _0x58025d={'where':_0x3eb848[_0x1661('0x3c')]};return db[_0x1661('0x2c')][_0x1661('0x20')](_0x58025d)[_0x1661('0x26')](function(_0x3f15a5){_0x16a9c8[_0x1661('0x20')]=_0x3f15a5;if(_0x1e0e07[_0x1661('0x30')][_0x1661('0x3e')]){_0x3eb848[_0x1661('0x3f')]=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x3eb848);})[_0x1661('0x26')](function(_0x48694b){_0x16a9c8[_0x1661('0x40')]=_0x48694b;return _0x16a9c8;})[_0x1661('0x26')](respondWithFilteredResult(_0x35a5b3,_0x3eb848))[_0x1661('0x41')](handleError(_0x35a5b3,null));};exports['show']=function(_0x1bf869,_0x1b085c){var _0x3703dd={'raw':![],'where':{'id':_0x1bf869['params']['id']}},_0x8b7f45={};_0x8b7f45['model']=_[_0x1661('0x31')](db[_0x1661('0x2c')][_0x1661('0x42')]);_0x8b7f45['query']=_[_0x1661('0x31')](_0x1bf869[_0x1661('0x30')]);_0x8b7f45[_0x1661('0x32')]=_[_0x1661('0x33')](_0x8b7f45[_0x1661('0x2f')],_0x8b7f45[_0x1661('0x30')]);_0x3703dd['attributes']=_[_0x1661('0x33')](_0x8b7f45[_0x1661('0x2f')],qs[_0x1661('0x35')](_0x1bf869[_0x1661('0x30')][_0x1661('0x35')]));_0x3703dd[_0x1661('0x34')]=_0x3703dd[_0x1661('0x34')][_0x1661('0x36')]?_0x3703dd['attributes']:_0x8b7f45[_0x1661('0x2f')];if(_0x1bf869[_0x1661('0x30')][_0x1661('0x3e')]){_0x3703dd[_0x1661('0x3f')]=[{'all':!![]}];}_0x3703dd=_['merge']({},_0x3703dd,_0x1bf869[_0x1661('0x43')]);return db[_0x1661('0x2c')][_0x1661('0x44')](_0x3703dd)[_0x1661('0x26')](handleEntityNotFound(_0x1b085c,null))[_0x1661('0x26')](respondWithResult(_0x1b085c,null))[_0x1661('0x41')](handleError(_0x1b085c,null));};exports[_0x1661('0x45')]=function(_0x5d5456,_0x33c237){return db['Dynamics365Account']['create'](_0x5d5456['body'],{})[_0x1661('0x26')](respondWithResult(_0x33c237,0xc9))[_0x1661('0x41')](handleError(_0x33c237,null));};exports[_0x1661('0x25')]=function(_0x22f25d,_0x4b0f41){if(_0x22f25d[_0x1661('0x46')]['id']){delete _0x22f25d[_0x1661('0x46')]['id'];}return db[_0x1661('0x2c')][_0x1661('0x44')]({'where':{'id':_0x22f25d[_0x1661('0x47')]['id']}})['then'](handleEntityNotFound(_0x4b0f41,null))[_0x1661('0x26')](saveUpdates(_0x22f25d[_0x1661('0x46')],null))[_0x1661('0x26')](respondWithResult(_0x4b0f41,null))[_0x1661('0x41')](handleError(_0x4b0f41,null));};exports[_0x1661('0x48')]=function(_0x5f11b1,_0x4bb128){return db[_0x1661('0x2c')][_0x1661('0x44')]({'where':{'id':_0x5f11b1[_0x1661('0x47')]['id']}})[_0x1661('0x26')](handleEntityNotFound(_0x4bb128,null))[_0x1661('0x26')](removeEntity(_0x4bb128,null))[_0x1661('0x41')](handleError(_0x4bb128,null));};exports[_0x1661('0x49')]=function(_0x2fc545,_0x571f34,_0x3bc03c){var _0x4ce4da={};var _0x374f05={};var _0x2e0dc6;var _0xf08345;return db[_0x1661('0x2c')][_0x1661('0x4a')]({'where':{'id':_0x2fc545[_0x1661('0x47')]['id']}})[_0x1661('0x26')](handleEntityNotFound(_0x571f34,null))[_0x1661('0x26')](function(_0x176021){if(_0x176021){_0x2e0dc6=_0x176021;_0x374f05[_0x1661('0x2f')]=_[_0x1661('0x31')](db[_0x1661('0x4b')][_0x1661('0x42')]);_0x374f05[_0x1661('0x30')]=_[_0x1661('0x31')](_0x2fc545['query']);_0x374f05['filters']=_[_0x1661('0x33')](_0x374f05[_0x1661('0x2f')],_0x374f05[_0x1661('0x30')]);_0x4ce4da[_0x1661('0x34')]=_['intersection'](_0x374f05['model'],qs[_0x1661('0x35')](_0x2fc545[_0x1661('0x30')][_0x1661('0x35')]));_0x4ce4da[_0x1661('0x34')]=_0x4ce4da[_0x1661('0x34')][_0x1661('0x36')]?_0x4ce4da[_0x1661('0x34')]:_0x374f05[_0x1661('0x2f')];_0x4ce4da[_0x1661('0x39')]=qs[_0x1661('0x4c')](_0x2fc545[_0x1661('0x30')]['sort']);_0x4ce4da[_0x1661('0x3c')]=qs[_0x1661('0x32')](_[_0x1661('0x3a')](_0x2fc545[_0x1661('0x30')],_0x374f05[_0x1661('0x32')]));if(_0x2fc545[_0x1661('0x30')][_0x1661('0x3b')]){_0x4ce4da[_0x1661('0x3c')]=_[_0x1661('0x4d')](_0x4ce4da[_0x1661('0x3c')],{'$or':_[_0x1661('0x2b')](_0x4ce4da[_0x1661('0x34')],function(_0x42e268){var _0x1ee71d={};_0x1ee71d[_0x42e268]={'$like':'%'+_0x2fc545[_0x1661('0x30')][_0x1661('0x3b')]+'%'};return _0x1ee71d;})});}_0x4ce4da=_[_0x1661('0x4d')]({},_0x4ce4da,_0x2fc545[_0x1661('0x43')]);return _0x2e0dc6['getConfigurations'](_0x4ce4da);}})[_0x1661('0x26')](function(_0x586739){if(_0x586739){_0xf08345=_0x586739[_0x1661('0x36')];if(!_0x2fc545[_0x1661('0x30')]['hasOwnProperty']('nolimit')){_0x4ce4da['limit']=qs['limit'](_0x2fc545[_0x1661('0x30')][_0x1661('0x1e')]);_0x4ce4da[_0x1661('0x1d')]=qs['offset'](_0x2fc545[_0x1661('0x30')][_0x1661('0x1d')]);}return _0x2e0dc6[_0x1661('0x49')](_0x4ce4da);}})['then'](function(_0x532278){if(_0x532278){return _0x532278?{'count':_0xf08345,'rows':_0x532278}:null;}})[_0x1661('0x26')](respondWithResult(_0x571f34,null))[_0x1661('0x41')](handleError(_0x571f34,null));};exports[_0x1661('0x4e')]=function(_0x451ac9,_0x44326f,_0x2f67e3){if(_0x451ac9[_0x1661('0x46')]['id']){delete _0x451ac9[_0x1661('0x46')]['id'];}return db[_0x1661('0x2c')]['findOne']({'where':{'id':_0x451ac9[_0x1661('0x47')]['id']}})['then'](handleEntityNotFound(_0x44326f,null))[_0x1661('0x26')](function(_0x2455b3){if(_0x2455b3){_0x451ac9['body'][_0x1661('0x4f')]=_0x2455b3['id'];_0x451ac9[_0x1661('0x46')][_0x1661('0x50')]=integrations['getSubjects'](_0x451ac9[_0x1661('0x46')][_0x1661('0x51')],_0x451ac9[_0x1661('0x46')][_0x1661('0x52')]);_0x451ac9[_0x1661('0x46')][_0x1661('0x53')]=integrations[_0x1661('0x54')](_0x451ac9[_0x1661('0x46')][_0x1661('0x51')],_0x451ac9[_0x1661('0x46')][_0x1661('0x52')]);return db[_0x1661('0x4b')][_0x1661('0x45')](_0x451ac9[_0x1661('0x46')],{'include':[{'model':db[_0x1661('0x55')],'as':_0x1661('0x50')},{'model':db[_0x1661('0x55')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x44326f,null))[_0x1661('0x41')](handleError(_0x44326f,null));};exports['getFields']=function(_0x487991,_0x823c21,_0x5c545e){var _0x4067f9=_0x487991['query'][_0x1661('0x56')];var _0x26ab73=_0x4067f9===_0x1661('0x57')?'Incident':_0x1661('0x58');var _0x133ade='';var _0x47c7bb='';var _0x23bd22='';var _0x534c5b='';var _0x3462a5='';var _0x393bcf='';var _0x6ac0eb='';var _0x2f3bfa='';var _0x49ff1=[_0x1661('0x59'),_0x1661('0x5a'),_0x1661('0x5b'),_0x1661('0x5c'),_0x1661('0x5d'),'subject',_0x1661('0x5e'),_0x1661('0x5f'),'directioncode',_0x1661('0x60')];var _0x5b9b41=['accountidname','accountidyominame',_0x1661('0x61'),_0x1661('0x62'),_0x1661('0x63'),_0x1661('0x64'),_0x1661('0x65'),_0x1661('0x66'),_0x1661('0x67'),'createdbyexternalpartyyominame',_0x1661('0x68'),_0x1661('0x69'),_0x1661('0x6a'),_0x1661('0x6b'),_0x1661('0x6c'),_0x1661('0x6d'),_0x1661('0x6e'),'customeridyominame',_0x1661('0x6f'),'entitlementidname',_0x1661('0x70'),'entityimage_url',_0x1661('0x71'),_0x1661('0x72'),_0x1661('0x73'),_0x1661('0x74'),_0x1661('0x75'),_0x1661('0x76'),_0x1661('0x77'),'lastonholdtime',_0x1661('0x78'),'modifiedbyexternalpartyname',_0x1661('0x79'),_0x1661('0x7a'),_0x1661('0x7b'),_0x1661('0x7c'),'modifiedonbehalfbyname',_0x1661('0x7d'),_0x1661('0x7e'),'msdyn_iotalertname',_0x1661('0x7f'),_0x1661('0x80'),_0x1661('0x81'),_0x1661('0x82'),'owneridtype',_0x1661('0x83'),_0x1661('0x84'),_0x1661('0x85'),_0x1661('0x86'),'prioritycodename',_0x1661('0x87'),_0x1661('0x88'),'resolveby',_0x1661('0x89'),_0x1661('0x8a'),'responsiblecontactidname','responsiblecontactidyominame',_0x1661('0x8b'),'slainvokedidname',_0x1661('0x8c'),_0x1661('0x8d'),'statecode','statuscode',_0x1661('0x8e'),_0x1661('0x8f'),_0x1661('0x90'),_0x1661('0x91'),_0x1661('0x92'),_0x1661('0x93'),_0x1661('0x94')];var _0x1df90e=_0x49ff1[_0x1661('0x95')](_0x5b9b41);return db['Dynamics365Account'][_0x1661('0x4a')]({'where':{'id':_0x487991[_0x1661('0x47')]['id']},'attributes':['id',_0x1661('0x96'),_0x1661('0x97'),_0x1661('0x98'),'tenantId',_0x1661('0x99'),_0x1661('0x9a')]})[_0x1661('0x26')](handleEntityNotFound(_0x823c21,null))[_0x1661('0x26')](function(_0x212d98){if(_0x212d98){_0x2f3bfa=_0x212d98[_0x1661('0x98')];var _0x521075=_0x2f3bfa[_0x1661('0x9b')](-0x1);if(_0x521075==='/'){_0x2f3bfa=_0x2f3bfa[_0x1661('0x9c')](0x0,_0x2f3bfa[_0x1661('0x9d')](_0x521075));}_0x6ac0eb=util['format']('%s/api/data/v9.0/',_0x2f3bfa);var _0x257b94={'method':'POST','uri':_0x1661('0x9e')+_0x212d98[_0x1661('0x9f')]+_0x1661('0xa0'),'form':{'client_id':_0x212d98[_0x1661('0x99')],'resource':_0x2f3bfa,'username':_0x212d98[_0x1661('0x96')],'password':_0x212d98[_0x1661('0x97')],'grant_type':_0x1661('0x97'),'client_secret':_0x212d98[_0x1661('0x9a')]},'json':!![]};return rp(_0x257b94);}})[_0x1661('0x26')](function(_0x368264){_0x393bcf=_0x368264[_0x1661('0xa1')];var _0x436403={'method':_0x1661('0xa2'),'uri':encodeURI(_0x6ac0eb+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x26ab73+'\x27'),'headers':{'Authorization':_0x1661('0xa3')+_0x393bcf,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x436403);})[_0x1661('0x26')](function(_0x20c216){var _0x29a97c=_0x20c216[_0x1661('0xa4')][0x0];var _0x5e7592=_0x29a97c[_0x1661('0xa5')];var _0x3a5157={'method':_0x1661('0xa2'),'uri':_0x6ac0eb+_0x1661('0xa6')+_0x5e7592+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x1661('0xa3')+_0x393bcf,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3a5157);})['then'](function(_0x10542c){_0x133ade=_0x10542c;_0x47c7bb=_0x133ade['Attributes'];_0x47c7bb=_[_0x1661('0xa7')](_0x47c7bb,function(_0x1c6ff1){return!_0x1df90e[_0x1661('0xa8')](_0x1c6ff1[_0x1661('0xa9')]);});var _0x31c370=[];var _0x13b33b=[];_0x47c7bb[_0x1661('0xaa')](function(_0x1cdce3){if(_0x1cdce3[_0x1661('0xab')]){var _0x27b8a7=_0x1cdce3['@odata.type']['substring'](_0x1cdce3[_0x1661('0xab')][_0x1661('0x9d')]('.')+0x1);if(_0x27b8a7===_0x1661('0xac')){_0x31c370['push'](getSelectList(_0x6ac0eb,_0x4067f9,_0x13b33b,_0x133ade['MetadataId'],_0x1cdce3['MetadataId'],_0x393bcf));}}});return Promise['all'](_0x31c370);})['then'](function(_0x198111){_0x23bd22=_0x198111[0x0];var _0x23e798=[];var _0x2919db=[];_0x47c7bb[_0x1661('0xaa')](function(_0x2659b4){if(!_[_0x1661('0xad')](_0x2659b4['@odata.type'])){var _0x3eab78=_0x2659b4[_0x1661('0xab')][_0x1661('0x9c')](_0x2659b4[_0x1661('0xab')][_0x1661('0x9d')]('.')+0x1);if(_0x3eab78===_0x1661('0xae')){_0x23e798[_0x1661('0xaf')](getBooleanList(_0x6ac0eb,_0x4067f9,_0x2919db,_0x133ade[_0x1661('0xa5')],_0x2659b4[_0x1661('0xa5')],_0x393bcf));}}});return Promise[_0x1661('0xb0')](_0x23e798);})['then'](function(_0x379479){_0x534c5b=_0x379479[0x0];var _0x473186=[];var _0x56570d=[];_0x47c7bb[_0x1661('0xaa')](function(_0x1e9fcc){if(_0x1e9fcc['@odata.type']){var _0x193457=_0x1e9fcc[_0x1661('0xab')][_0x1661('0x9c')](_0x1e9fcc['@odata.type']['lastIndexOf']('.')+0x1);if(_0x193457===_0x1661('0xb1')||_0x193457===_0x1661('0xb2')||_0x193457==='BigIntAttributeMetadata'||_0x193457===_0x1661('0xb3')||_0x193457===_0x1661('0xb4')||_0x193457===_0x1661('0xb5')||_0x193457===_0x1661('0xb6')||_0x193457===_0x1661('0xb7')||_0x193457===_0x1661('0xb8')||_0x193457===_0x1661('0xb9')){_0x473186['push'](getInputList(_0x6ac0eb,_0x4067f9,_0x193457,_0x56570d,_0x133ade[_0x1661('0xa5')],_0x1e9fcc[_0x1661('0xa5')],_0x393bcf));}}});return Promise[_0x1661('0xb0')](_0x473186);})[_0x1661('0x26')](function(_0x1d0751){_0x3462a5=_0x1d0751[0x0];var _0x1dc941=_0x23bd22[_0x1661('0x95')](_0x534c5b)[_0x1661('0x95')](_0x3462a5);var _0x3caf63={'count':_0x1dc941[_0x1661('0x36')],'rows':_0x1dc941};return _0x3caf63;})[_0x1661('0x26')](respondWithResult(_0x823c21,null))[_0x1661('0x41')](function(_0xb78b0c){var _0x43048a=_0x487991['query'][_0x1661('0xba')]?0x1f4:_0xb78b0c[_0x1661('0xbb')]||0x1f4;logger['error'](_0xb78b0c[_0x1661('0xbc')]);delete _0xb78b0c[_0x1661('0x28')];if(_0x43048a===0x191){_0x43048a=0x190;}_0x823c21[_0x1661('0x1a')](_0x43048a)['send'](_0x487991['query'][_0x1661('0xba')]?{'message':_0x1661('0xbd'),'statusCode':_0xb78b0c['statusCode']}:_0xb78b0c);});};function getSelectList(_0x4f5016,_0x25a742,_0x335d24,_0x255d4f,_0x26044e,_0x2703b3){var _0x1e3736={'method':_0x1661('0xa2'),'uri':_0x4f5016+_0x1661('0xa6')+_0x255d4f+')/Attributes('+_0x26044e+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x1661('0xbe'),'headers':{'Authorization':_0x1661('0xa3')+_0x2703b3,'If-None-Match':null,'OData-Version':_0x1661('0xbf')},'json':!![]};return rp(_0x1e3736)['then'](function(_0x3fb076){var _0x3c8ab2=[];var _0x39b0cf=_0x3fb076[_0x1661('0xc0')][_0x1661('0xc1')];_0x39b0cf['forEach'](function(_0xba6ce3){_0x3c8ab2[_0x1661('0xaf')]({'name':_0xba6ce3[_0x1661('0xc2')][_0x1661('0xc3')][_0x1661('0xc2')],'value':String(_0xba6ce3[_0x1661('0xc4')])});});var _0x427b6f={'id':_0x25a742+'_'+_0x3fb076[_0x1661('0xa9')],'name':_0x3fb076[_0x1661('0xc5')]['UserLocalizedLabel'][_0x1661('0xc2')],'custom':![],'options':_0x3c8ab2};_0x335d24[_0x1661('0xaf')](_0x427b6f);return _0x335d24;});}function getBooleanList(_0x24f2c4,_0x14d8ba,_0x3a59c0,_0x56818d,_0x2b0573,_0x3ba121){var _0x583014={'method':'GET','uri':_0x24f2c4+'EntityDefinitions('+_0x56818d+_0x1661('0xc6')+_0x2b0573+_0x1661('0xc7'),'headers':{'Authorization':_0x1661('0xa3')+_0x3ba121,'If-None-Match':null,'OData-Version':_0x1661('0xbf')},'json':!![]};return rp(_0x583014)[_0x1661('0x26')](function(_0x257872){var _0x2c0451=[];_0x2c0451[_0x1661('0xaf')]({'name':_0x257872[_0x1661('0xc0')][_0x1661('0xc8')]['Label'][_0x1661('0xc3')][_0x1661('0xc2')],'value':'true'},{'name':_0x257872['OptionSet'][_0x1661('0xc9')]['Label'][_0x1661('0xc3')]['Label'],'value':_0x1661('0xca')});var _0x118871={'id':_0x14d8ba+'_'+_0x257872[_0x1661('0xa9')],'name':_0x257872[_0x1661('0xc5')][_0x1661('0xc3')]['Label'],'custom':![],'options':_0x2c0451};_0x3a59c0[_0x1661('0xaf')](_0x118871);return _0x3a59c0;});}function getInputList(_0x382c02,_0x5888a5,_0xf16e5b,_0x5c998c,_0x3b44d8,_0x1dbb45,_0x4372f6){var _0x313afe={'method':'GET','uri':_0x382c02+_0x1661('0xa6')+_0x3b44d8+_0x1661('0xc6')+_0x1dbb45+_0x1661('0xcb')+_0xf16e5b+_0x1661('0xcc'),'headers':{'Authorization':_0x1661('0xa3')+_0x4372f6,'If-None-Match':null,'OData-Version':_0x1661('0xbf')},'json':!![]};return rp(_0x313afe)['then'](function(_0x41a8c9){var _0x244345={'id':_0x5888a5+'_'+_0x41a8c9[_0x1661('0xa9')],'name':_0x41a8c9[_0x1661('0xc5')][_0x1661('0xc3')]?_0x41a8c9[_0x1661('0xc5')][_0x1661('0xc3')]['Label']:_0x41a8c9['LogicalName'],'custom':![],'options':[]};_0x5c998c['push'](_0x244345);return _0x5c998c;});} \ No newline at end of file +var _0xa3e6=['moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','fieldName','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','type','Dynamics365Account','includeAll','include','findAll','rows','show','params','keys','rawAttributes','fields','options','find','catch','create','body','getConfigurations','findOne','Dynamics365Configuration','pick','filter','addConfiguration','getSubjects','Descriptions','getDescriptions','channel','Subjects','Dynamics365Field','ticketType','incident','title','description','customerid','ownerid','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridyominame','emailaddress','entitlementidname','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridtype','owneridyominame','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','username','tenantId','clientId','clientSecret','slice','substring','lastIndexOf','/oauth2/token','password','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','remove','includes','forEach','@odata.type','push','isNil','all','StringAttributeMetadata','BigIntAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','Options','UserLocalizedLabel','Label','Value','LogicalName','DisplayName','OptionSet','TrueOption','true','FalseOption','false',')/Attributes(',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','zip-dir','request-promise'];(function(_0x54cfcf,_0x3ecf5b){var _0x1c2060=function(_0x484a41){while(--_0x484a41){_0x54cfcf['push'](_0x54cfcf['shift']());}};_0x1c2060(++_0x3ecf5b);}(_0xa3e6,0xbe));var _0x6a3e=function(_0x3d9564,_0x1463d6){_0x3d9564=_0x3d9564-0x0;var _0xc1202e=_0xa3e6[_0x3d9564];return _0xc1202e;};'use strict';var emlformat=require(_0x6a3e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6a3e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a3e('0x2'));var moment=require(_0x6a3e('0x3'));var BPromise=require(_0x6a3e('0x4'));var Mustache=require('mustache');var util=require(_0x6a3e('0x5'));var path=require('path');var sox=require(_0x6a3e('0x6'));var csv=require(_0x6a3e('0x7'));var ejs=require(_0x6a3e('0x8'));var fs=require('fs');var fs_extra=require(_0x6a3e('0x9'));var _=require(_0x6a3e('0xa'));var squel=require('squel');var crypto=require(_0x6a3e('0xb'));var jsforce=require(_0x6a3e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6a3e('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6a3e('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6a3e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6a3e('0x10'))(_0x6a3e('0x11'));var utils=require(_0x6a3e('0x12'));var config=require(_0x6a3e('0x13'));var licenseUtil=require(_0x6a3e('0x14'));var db=require(_0x6a3e('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x27e169,_0x385c29){_0x385c29=_0x385c29||0xcc;return function(_0x1a1893){if(_0x1a1893){return _0x27e169[_0x6a3e('0x16')](_0x385c29);}return _0x27e169[_0x6a3e('0x17')](_0x385c29)[_0x6a3e('0x18')]();};}function respondWithResult(_0x222f7c,_0x4bd05f){_0x4bd05f=_0x4bd05f||0xc8;return function(_0x2e911b){if(_0x2e911b){return _0x222f7c[_0x6a3e('0x17')](_0x4bd05f)[_0x6a3e('0x19')](_0x2e911b);}};}function respondWithFilteredResult(_0x2a62a8,_0x500ccd){return function(_0x462b8d){if(_0x462b8d){var _0x24666d=typeof _0x500ccd['offset']==='undefined'&&typeof _0x500ccd['limit']==='undefined';var _0x48adf6=_0x462b8d[_0x6a3e('0x1a')];var _0x467e2c=_0x24666d?0x0:_0x500ccd[_0x6a3e('0x1b')];var _0x701d04=_0x24666d?_0x462b8d[_0x6a3e('0x1a')]:_0x500ccd[_0x6a3e('0x1b')]+_0x500ccd[_0x6a3e('0x1c')];var _0x2f2150;if(_0x701d04>=_0x48adf6){_0x701d04=_0x48adf6;_0x2f2150=0xc8;}else{_0x2f2150=0xce;}_0x2a62a8['status'](_0x2f2150);return _0x2a62a8[_0x6a3e('0x1d')]('Content-Range',_0x467e2c+'-'+_0x701d04+'/'+_0x48adf6)[_0x6a3e('0x19')](_0x462b8d);}return null;};}function patchUpdates(_0x5ae73b){return function(_0x16c5e4){try{jsonpatch[_0x6a3e('0x1e')](_0x16c5e4,_0x5ae73b,!![]);}catch(_0x6fd39a){return BPromise[_0x6a3e('0x1f')](_0x6fd39a);}return _0x16c5e4['save']();};}function saveUpdates(_0x4f7507,_0x215ac1){return function(_0x2d811f){if(_0x2d811f){return _0x2d811f[_0x6a3e('0x20')](_0x4f7507)[_0x6a3e('0x21')](function(_0x4e5a25){return _0x4e5a25;});}return null;};}function removeEntity(_0x1ae966,_0x21b5aa){return function(_0x4436ac){if(_0x4436ac){return _0x4436ac[_0x6a3e('0x22')]()[_0x6a3e('0x21')](function(){_0x1ae966[_0x6a3e('0x17')](0xcc)[_0x6a3e('0x18')]();});}};}function handleEntityNotFound(_0x83e681,_0x25fc14){return function(_0x18de92){if(!_0x18de92){_0x83e681['sendStatus'](0x194);}return _0x18de92;};}function handleError(_0x4ec834,_0x150992){_0x150992=_0x150992||0x1f4;return function(_0x6cc7c4){logger[_0x6a3e('0x23')](_0x6cc7c4[_0x6a3e('0x24')]);if(_0x6cc7c4[_0x6a3e('0x25')]){delete _0x6cc7c4[_0x6a3e('0x25')];}_0x4ec834[_0x6a3e('0x17')](_0x150992)[_0x6a3e('0x26')](_0x6cc7c4);};}exports[_0x6a3e('0x27')]=function(_0x436169,_0x3a831b){var _0x508a55={},_0x4eec67={},_0x2a2b2a={'count':0x0,'rows':[]};var _0x4cda7d=_[_0x6a3e('0x28')](db['Dynamics365Account']['rawAttributes'],function(_0x1c0f4b){return{'name':_0x1c0f4b[_0x6a3e('0x29')],'type':_0x1c0f4b['type']['key']};});_0x4eec67[_0x6a3e('0x2a')]=_[_0x6a3e('0x28')](_0x4cda7d,_0x6a3e('0x25'));_0x4eec67[_0x6a3e('0x2b')]=_['keys'](_0x436169['query']);_0x4eec67[_0x6a3e('0x2c')]=_[_0x6a3e('0x2d')](_0x4eec67[_0x6a3e('0x2a')],_0x4eec67[_0x6a3e('0x2b')]);_0x508a55['attributes']=_[_0x6a3e('0x2d')](_0x4eec67[_0x6a3e('0x2a')],qs['fields'](_0x436169['query']['fields']));_0x508a55[_0x6a3e('0x2e')]=_0x508a55[_0x6a3e('0x2e')][_0x6a3e('0x2f')]?_0x508a55[_0x6a3e('0x2e')]:_0x4eec67[_0x6a3e('0x2a')];if(!_0x436169[_0x6a3e('0x2b')][_0x6a3e('0x30')](_0x6a3e('0x31'))){_0x508a55[_0x6a3e('0x1c')]=qs[_0x6a3e('0x1c')](_0x436169[_0x6a3e('0x2b')][_0x6a3e('0x1c')]);_0x508a55[_0x6a3e('0x1b')]=qs[_0x6a3e('0x1b')](_0x436169[_0x6a3e('0x2b')]['offset']);}_0x508a55[_0x6a3e('0x32')]=qs[_0x6a3e('0x33')](_0x436169[_0x6a3e('0x2b')]['sort']);_0x508a55[_0x6a3e('0x34')]=qs[_0x6a3e('0x2c')](_['pick'](_0x436169[_0x6a3e('0x2b')],_0x4eec67[_0x6a3e('0x2c')]),_0x4cda7d);if(_0x436169[_0x6a3e('0x2b')]['filter']){_0x508a55[_0x6a3e('0x34')]=_[_0x6a3e('0x35')](_0x508a55[_0x6a3e('0x34')],{'$or':_[_0x6a3e('0x28')](_0x4cda7d,function(_0x18a50f){if(_0x18a50f[_0x6a3e('0x36')]!=='VIRTUAL'){var _0x3931c3={};_0x3931c3[_0x18a50f['name']]={'$like':'%'+_0x436169['query']['filter']+'%'};return _0x3931c3;}})});}_0x508a55=_[_0x6a3e('0x35')]({},_0x508a55,_0x436169['options']);var _0x1a6b68={'where':_0x508a55[_0x6a3e('0x34')]};return db[_0x6a3e('0x37')][_0x6a3e('0x1a')](_0x1a6b68)[_0x6a3e('0x21')](function(_0x36944d){_0x2a2b2a['count']=_0x36944d;if(_0x436169['query'][_0x6a3e('0x38')]){_0x508a55[_0x6a3e('0x39')]=[{'all':!![]}];}return db[_0x6a3e('0x37')][_0x6a3e('0x3a')](_0x508a55);})[_0x6a3e('0x21')](function(_0x57f40b){_0x2a2b2a[_0x6a3e('0x3b')]=_0x57f40b;return _0x2a2b2a;})[_0x6a3e('0x21')](respondWithFilteredResult(_0x3a831b,_0x508a55))['catch'](handleError(_0x3a831b,null));};exports[_0x6a3e('0x3c')]=function(_0x417f8a,_0x35c836){var _0x53ad48={'raw':![],'where':{'id':_0x417f8a[_0x6a3e('0x3d')]['id']}},_0xda81a4={};_0xda81a4[_0x6a3e('0x2a')]=_[_0x6a3e('0x3e')](db[_0x6a3e('0x37')][_0x6a3e('0x3f')]);_0xda81a4['query']=_[_0x6a3e('0x3e')](_0x417f8a[_0x6a3e('0x2b')]);_0xda81a4[_0x6a3e('0x2c')]=_['intersection'](_0xda81a4[_0x6a3e('0x2a')],_0xda81a4['query']);_0x53ad48['attributes']=_[_0x6a3e('0x2d')](_0xda81a4[_0x6a3e('0x2a')],qs[_0x6a3e('0x40')](_0x417f8a['query']['fields']));_0x53ad48[_0x6a3e('0x2e')]=_0x53ad48[_0x6a3e('0x2e')][_0x6a3e('0x2f')]?_0x53ad48[_0x6a3e('0x2e')]:_0xda81a4[_0x6a3e('0x2a')];if(_0x417f8a[_0x6a3e('0x2b')]['includeAll']){_0x53ad48[_0x6a3e('0x39')]=[{'all':!![]}];}_0x53ad48=_[_0x6a3e('0x35')]({},_0x53ad48,_0x417f8a[_0x6a3e('0x41')]);return db[_0x6a3e('0x37')][_0x6a3e('0x42')](_0x53ad48)[_0x6a3e('0x21')](handleEntityNotFound(_0x35c836,null))[_0x6a3e('0x21')](respondWithResult(_0x35c836,null))[_0x6a3e('0x43')](handleError(_0x35c836,null));};exports[_0x6a3e('0x44')]=function(_0x4d36e2,_0x40a09d){return db[_0x6a3e('0x37')]['create'](_0x4d36e2[_0x6a3e('0x45')],{})['then'](respondWithResult(_0x40a09d,0xc9))[_0x6a3e('0x43')](handleError(_0x40a09d,null));};exports[_0x6a3e('0x20')]=function(_0x28a3e9,_0x4f288d){if(_0x28a3e9[_0x6a3e('0x45')]['id']){delete _0x28a3e9[_0x6a3e('0x45')]['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x28a3e9['params']['id']}})[_0x6a3e('0x21')](handleEntityNotFound(_0x4f288d,null))[_0x6a3e('0x21')](saveUpdates(_0x28a3e9[_0x6a3e('0x45')],null))[_0x6a3e('0x21')](respondWithResult(_0x4f288d,null))[_0x6a3e('0x43')](handleError(_0x4f288d,null));};exports[_0x6a3e('0x22')]=function(_0x404473,_0x1ce964){return db[_0x6a3e('0x37')][_0x6a3e('0x42')]({'where':{'id':_0x404473[_0x6a3e('0x3d')]['id']}})['then'](handleEntityNotFound(_0x1ce964,null))[_0x6a3e('0x21')](removeEntity(_0x1ce964,null))[_0x6a3e('0x43')](handleError(_0x1ce964,null));};exports[_0x6a3e('0x46')]=function(_0x21ba7b,_0x23ea98,_0x4e7879){var _0x8e463={};var _0x4d1882={};var _0x1afa0a;var _0x37b0c8;return db[_0x6a3e('0x37')][_0x6a3e('0x47')]({'where':{'id':_0x21ba7b[_0x6a3e('0x3d')]['id']}})['then'](handleEntityNotFound(_0x23ea98,null))['then'](function(_0x562bf9){if(_0x562bf9){_0x1afa0a=_0x562bf9;_0x4d1882[_0x6a3e('0x2a')]=_[_0x6a3e('0x3e')](db[_0x6a3e('0x48')][_0x6a3e('0x3f')]);_0x4d1882[_0x6a3e('0x2b')]=_[_0x6a3e('0x3e')](_0x21ba7b['query']);_0x4d1882[_0x6a3e('0x2c')]=_['intersection'](_0x4d1882['model'],_0x4d1882['query']);_0x8e463[_0x6a3e('0x2e')]=_[_0x6a3e('0x2d')](_0x4d1882['model'],qs[_0x6a3e('0x40')](_0x21ba7b[_0x6a3e('0x2b')]['fields']));_0x8e463[_0x6a3e('0x2e')]=_0x8e463[_0x6a3e('0x2e')][_0x6a3e('0x2f')]?_0x8e463[_0x6a3e('0x2e')]:_0x4d1882[_0x6a3e('0x2a')];_0x8e463['order']=qs[_0x6a3e('0x33')](_0x21ba7b[_0x6a3e('0x2b')]['sort']);_0x8e463[_0x6a3e('0x34')]=qs[_0x6a3e('0x2c')](_[_0x6a3e('0x49')](_0x21ba7b[_0x6a3e('0x2b')],_0x4d1882[_0x6a3e('0x2c')]));if(_0x21ba7b[_0x6a3e('0x2b')][_0x6a3e('0x4a')]){_0x8e463[_0x6a3e('0x34')]=_[_0x6a3e('0x35')](_0x8e463[_0x6a3e('0x34')],{'$or':_[_0x6a3e('0x28')](_0x8e463['attributes'],function(_0x2870be){var _0x2dcb70={};_0x2dcb70[_0x2870be]={'$like':'%'+_0x21ba7b[_0x6a3e('0x2b')]['filter']+'%'};return _0x2dcb70;})});}_0x8e463=_[_0x6a3e('0x35')]({},_0x8e463,_0x21ba7b[_0x6a3e('0x41')]);return _0x1afa0a[_0x6a3e('0x46')](_0x8e463);}})[_0x6a3e('0x21')](function(_0x582ad9){if(_0x582ad9){_0x37b0c8=_0x582ad9[_0x6a3e('0x2f')];if(!_0x21ba7b['query'][_0x6a3e('0x30')]('nolimit')){_0x8e463[_0x6a3e('0x1c')]=qs[_0x6a3e('0x1c')](_0x21ba7b[_0x6a3e('0x2b')][_0x6a3e('0x1c')]);_0x8e463[_0x6a3e('0x1b')]=qs[_0x6a3e('0x1b')](_0x21ba7b[_0x6a3e('0x2b')][_0x6a3e('0x1b')]);}return _0x1afa0a[_0x6a3e('0x46')](_0x8e463);}})['then'](function(_0x3a5f9d){if(_0x3a5f9d){return _0x3a5f9d?{'count':_0x37b0c8,'rows':_0x3a5f9d}:null;}})[_0x6a3e('0x21')](respondWithResult(_0x23ea98,null))[_0x6a3e('0x43')](handleError(_0x23ea98,null));};exports[_0x6a3e('0x4b')]=function(_0x145655,_0x3a4a29,_0x1da682){if(_0x145655[_0x6a3e('0x45')]['id']){delete _0x145655[_0x6a3e('0x45')]['id'];}return db[_0x6a3e('0x37')][_0x6a3e('0x47')]({'where':{'id':_0x145655[_0x6a3e('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3a4a29,null))[_0x6a3e('0x21')](function(_0x40213e){if(_0x40213e){_0x145655[_0x6a3e('0x45')]['AccountId']=_0x40213e['id'];_0x145655[_0x6a3e('0x45')]['Subjects']=integrations[_0x6a3e('0x4c')](_0x145655[_0x6a3e('0x45')]['channel'],_0x145655[_0x6a3e('0x45')][_0x6a3e('0x36')]);_0x145655['body'][_0x6a3e('0x4d')]=integrations[_0x6a3e('0x4e')](_0x145655[_0x6a3e('0x45')][_0x6a3e('0x4f')],_0x145655[_0x6a3e('0x45')]['type']);return db[_0x6a3e('0x48')]['create'](_0x145655[_0x6a3e('0x45')],{'include':[{'model':db['Dynamics365Field'],'as':_0x6a3e('0x50')},{'model':db[_0x6a3e('0x51')],'as':_0x6a3e('0x4d')}]});}return null;})[_0x6a3e('0x21')](respondWithResult(_0x3a4a29,null))['catch'](handleError(_0x3a4a29,null));};exports['getFields']=function(_0x18718f,_0x309e1c,_0x48edbf){var _0x2704f0=_0x18718f[_0x6a3e('0x2b')][_0x6a3e('0x52')];var _0x7b8d96=_0x2704f0===_0x6a3e('0x53')?'Incident':'PhoneCall';var _0x4429f1='';var _0x385ef1='';var _0x1ba563='';var _0x924f01='';var _0x1c8923='';var _0xb5afbb='';var _0x5511be='';var _0x22883c='';var _0x3457fd=[_0x6a3e('0x54'),_0x6a3e('0x55'),_0x6a3e('0x56'),_0x6a3e('0x57'),'caseorigincode','subject',_0x6a3e('0x58'),_0x6a3e('0x59'),_0x6a3e('0x5a'),_0x6a3e('0x5b')];var _0x28af16=[_0x6a3e('0x5c'),_0x6a3e('0x5d'),_0x6a3e('0x5e'),_0x6a3e('0x5f'),'contactidname',_0x6a3e('0x60'),_0x6a3e('0x61'),_0x6a3e('0x62'),_0x6a3e('0x63'),_0x6a3e('0x64'),_0x6a3e('0x65'),_0x6a3e('0x66'),_0x6a3e('0x67'),'createdonbehalfbyname',_0x6a3e('0x68'),'customeridname','customeridtype',_0x6a3e('0x69'),_0x6a3e('0x6a'),_0x6a3e('0x6b'),'entityimage_timestamp',_0x6a3e('0x6c'),_0x6a3e('0x6d'),_0x6a3e('0x6e'),_0x6a3e('0x6f'),_0x6a3e('0x70'),_0x6a3e('0x71'),_0x6a3e('0x72'),_0x6a3e('0x73'),_0x6a3e('0x74'),'masteridname',_0x6a3e('0x75'),_0x6a3e('0x76'),_0x6a3e('0x77'),_0x6a3e('0x78'),_0x6a3e('0x79'),_0x6a3e('0x7a'),_0x6a3e('0x7b'),_0x6a3e('0x7c'),_0x6a3e('0x7d'),_0x6a3e('0x7e'),_0x6a3e('0x7f'),'overriddencreatedon','owneridname',_0x6a3e('0x80'),_0x6a3e('0x81'),'parentcaseidname','primarycontactidname',_0x6a3e('0x82'),'prioritycodename',_0x6a3e('0x83'),_0x6a3e('0x84'),_0x6a3e('0x85'),_0x6a3e('0x86'),_0x6a3e('0x87'),'responsiblecontactidname',_0x6a3e('0x88'),'sentimentvalue',_0x6a3e('0x89'),_0x6a3e('0x8a'),_0x6a3e('0x8b'),_0x6a3e('0x8c'),'statuscode','subjectidname',_0x6a3e('0x8d'),_0x6a3e('0x8e'),_0x6a3e('0x8f'),_0x6a3e('0x90'),'utcconversiontimezonecode',_0x6a3e('0x91')];var _0x3554be=_0x3457fd[_0x6a3e('0x92')](_0x28af16);return db['Dynamics365Account'][_0x6a3e('0x47')]({'where':{'id':_0x18718f[_0x6a3e('0x3d')]['id']},'attributes':['id',_0x6a3e('0x93'),'password','remoteUri',_0x6a3e('0x94'),_0x6a3e('0x95'),_0x6a3e('0x96')]})['then'](handleEntityNotFound(_0x309e1c,null))[_0x6a3e('0x21')](function(_0x15441e){if(_0x15441e){_0x22883c=_0x15441e['remoteUri'];var _0x3f86e9=_0x22883c[_0x6a3e('0x97')](-0x1);if(_0x3f86e9==='/'){_0x22883c=_0x22883c[_0x6a3e('0x98')](0x0,_0x22883c[_0x6a3e('0x99')](_0x3f86e9));}_0x5511be=util['format']('%s/api/data/v9.0/',_0x22883c);var _0x4ef96a={'method':'POST','uri':'https://login.microsoftonline.com/'+_0x15441e[_0x6a3e('0x94')]+_0x6a3e('0x9a'),'form':{'client_id':_0x15441e[_0x6a3e('0x95')],'resource':_0x22883c,'username':_0x15441e[_0x6a3e('0x93')],'password':_0x15441e[_0x6a3e('0x9b')],'grant_type':'password','client_secret':_0x15441e[_0x6a3e('0x96')]},'json':!![]};return rp(_0x4ef96a);}})[_0x6a3e('0x21')](function(_0x54e6f7){_0xb5afbb=_0x54e6f7['access_token'];var _0x48b49a={'method':'GET','uri':encodeURI(_0x5511be+_0x6a3e('0x9c')+_0x7b8d96+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0xb5afbb,'If-None-Match':null,'OData-Version':_0x6a3e('0x9d')},'json':!![]};return rp(_0x48b49a);})[_0x6a3e('0x21')](function(_0x1e4b20){var _0x546de8=_0x1e4b20[_0x6a3e('0x9e')][0x0];var _0x29a546=_0x546de8[_0x6a3e('0x9f')];var _0x2e8dfd={'method':_0x6a3e('0xa0'),'uri':_0x5511be+_0x6a3e('0xa1')+_0x29a546+_0x6a3e('0xa2'),'headers':{'Authorization':_0x6a3e('0xa3')+_0xb5afbb,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2e8dfd);})[_0x6a3e('0x21')](function(_0x9a6302){_0x4429f1=_0x9a6302;_0x385ef1=_0x4429f1['Attributes'];_0x385ef1=_[_0x6a3e('0xa4')](_0x385ef1,function(_0x3a59be){return!_0x3554be[_0x6a3e('0xa5')](_0x3a59be['LogicalName']);});var _0x20e765=[];var _0x3ce92a=[];_0x385ef1[_0x6a3e('0xa6')](function(_0xb6760f){if(_0xb6760f[_0x6a3e('0xa7')]){var _0xb8f9bc=_0xb6760f[_0x6a3e('0xa7')][_0x6a3e('0x98')](_0xb6760f[_0x6a3e('0xa7')]['lastIndexOf']('.')+0x1);if(_0xb8f9bc==='PicklistAttributeMetadata'){_0x20e765[_0x6a3e('0xa8')](getSelectList(_0x5511be,_0x2704f0,_0x3ce92a,_0x4429f1[_0x6a3e('0x9f')],_0xb6760f[_0x6a3e('0x9f')],_0xb5afbb));}}});return Promise['all'](_0x20e765);})[_0x6a3e('0x21')](function(_0x4cef57){_0x1ba563=_0x4cef57[0x0];var _0xe105c5=[];var _0x51ded2=[];_0x385ef1[_0x6a3e('0xa6')](function(_0x4ae71b){if(!_[_0x6a3e('0xa9')](_0x4ae71b[_0x6a3e('0xa7')])){var _0x3177e4=_0x4ae71b['@odata.type'][_0x6a3e('0x98')](_0x4ae71b['@odata.type'][_0x6a3e('0x99')]('.')+0x1);if(_0x3177e4==='BooleanAttributeMetadata'){_0xe105c5[_0x6a3e('0xa8')](getBooleanList(_0x5511be,_0x2704f0,_0x51ded2,_0x4429f1[_0x6a3e('0x9f')],_0x4ae71b[_0x6a3e('0x9f')],_0xb5afbb));}}});return Promise[_0x6a3e('0xaa')](_0xe105c5);})[_0x6a3e('0x21')](function(_0x1c391c){_0x924f01=_0x1c391c[0x0];var _0x12aee6=[];var _0x49f701=[];_0x385ef1[_0x6a3e('0xa6')](function(_0xb4cb8c){if(_0xb4cb8c['@odata.type']){var _0x14cced=_0xb4cb8c[_0x6a3e('0xa7')][_0x6a3e('0x98')](_0xb4cb8c[_0x6a3e('0xa7')][_0x6a3e('0x99')]('.')+0x1);if(_0x14cced===_0x6a3e('0xab')||_0x14cced==='DoubleAttributeMetadata'||_0x14cced===_0x6a3e('0xac')||_0x14cced==='IntegerAttributeMetadata'||_0x14cced==='MemoAttributeMetadata'||_0x14cced===_0x6a3e('0xad')||_0x14cced===_0x6a3e('0xae')||_0x14cced===_0x6a3e('0xaf')||_0x14cced==='StateAttributeMetadata'||_0x14cced==='DecimalAttributeMetadata'){_0x12aee6[_0x6a3e('0xa8')](getInputList(_0x5511be,_0x2704f0,_0x14cced,_0x49f701,_0x4429f1['MetadataId'],_0xb4cb8c['MetadataId'],_0xb5afbb));}}});return Promise['all'](_0x12aee6);})[_0x6a3e('0x21')](function(_0x229cfd){_0x1c8923=_0x229cfd[0x0];var _0x2f85c1=_0x1ba563[_0x6a3e('0x92')](_0x924f01)['concat'](_0x1c8923);var _0x266f3d={'count':_0x2f85c1[_0x6a3e('0x2f')],'rows':_0x2f85c1};return _0x266f3d;})[_0x6a3e('0x21')](respondWithResult(_0x309e1c,null))['catch'](function(_0x3faf57){var _0x4f27f3=_0x18718f[_0x6a3e('0x2b')]['test']?0x1f4:_0x3faf57[_0x6a3e('0xb0')]||0x1f4;logger['error'](_0x3faf57[_0x6a3e('0x24')]);delete _0x3faf57[_0x6a3e('0x25')];if(_0x4f27f3===0x191){_0x4f27f3=0x190;}_0x309e1c[_0x6a3e('0x17')](_0x4f27f3)[_0x6a3e('0x26')](_0x18718f[_0x6a3e('0x2b')]['test']?{'message':_0x6a3e('0xb1'),'statusCode':_0x3faf57[_0x6a3e('0xb0')]}:_0x3faf57);});};function getSelectList(_0x3c4195,_0x143c5b,_0x2419cd,_0x2ae05e,_0x36b49b,_0x433225){var _0xdc1471={'method':_0x6a3e('0xa0'),'uri':_0x3c4195+_0x6a3e('0xa1')+_0x2ae05e+')/Attributes('+_0x36b49b+_0x6a3e('0xb2')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x433225,'If-None-Match':null,'OData-Version':_0x6a3e('0x9d')},'json':!![]};return rp(_0xdc1471)['then'](function(_0x5d71ce){var _0x4cc04b=[];var _0x38519a=_0x5d71ce['OptionSet'][_0x6a3e('0xb3')];_0x38519a[_0x6a3e('0xa6')](function(_0x23562d){_0x4cc04b[_0x6a3e('0xa8')]({'name':_0x23562d['Label'][_0x6a3e('0xb4')][_0x6a3e('0xb5')],'value':String(_0x23562d[_0x6a3e('0xb6')])});});var _0x2cd621={'id':_0x143c5b+'_'+_0x5d71ce[_0x6a3e('0xb7')],'name':_0x5d71ce[_0x6a3e('0xb8')]['UserLocalizedLabel'][_0x6a3e('0xb5')],'custom':![],'options':_0x4cc04b};_0x2419cd[_0x6a3e('0xa8')](_0x2cd621);return _0x2419cd;});}function getBooleanList(_0x577697,_0x5220fc,_0x45eb22,_0x298378,_0x38f50f,_0x16c61c){var _0x2c9027={'method':_0x6a3e('0xa0'),'uri':_0x577697+_0x6a3e('0xa1')+_0x298378+')/Attributes('+_0x38f50f+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x6a3e('0xa3')+_0x16c61c,'If-None-Match':null,'OData-Version':_0x6a3e('0x9d')},'json':!![]};return rp(_0x2c9027)['then'](function(_0x7a96c){var _0x14c887=[];_0x14c887['push']({'name':_0x7a96c[_0x6a3e('0xb9')][_0x6a3e('0xba')][_0x6a3e('0xb5')]['UserLocalizedLabel'][_0x6a3e('0xb5')],'value':_0x6a3e('0xbb')},{'name':_0x7a96c[_0x6a3e('0xb9')][_0x6a3e('0xbc')][_0x6a3e('0xb5')][_0x6a3e('0xb4')][_0x6a3e('0xb5')],'value':_0x6a3e('0xbd')});var _0x53aba2={'id':_0x5220fc+'_'+_0x7a96c['LogicalName'],'name':_0x7a96c[_0x6a3e('0xb8')][_0x6a3e('0xb4')]['Label'],'custom':![],'options':_0x14c887};_0x45eb22[_0x6a3e('0xa8')](_0x53aba2);return _0x45eb22;});}function getInputList(_0xb23f44,_0x334d28,_0x47b34c,_0x4088db,_0x512871,_0x579e32,_0x3ef55e){var _0x26e835={'method':_0x6a3e('0xa0'),'uri':_0xb23f44+'EntityDefinitions('+_0x512871+_0x6a3e('0xbe')+_0x579e32+_0x6a3e('0xbf')+_0x47b34c+_0x6a3e('0xc0'),'headers':{'Authorization':'Bearer\x20'+_0x3ef55e,'If-None-Match':null,'OData-Version':_0x6a3e('0x9d')},'json':!![]};return rp(_0x26e835)['then'](function(_0x998658){var _0x1bfc90={'id':_0x334d28+'_'+_0x998658[_0x6a3e('0xb7')],'name':_0x998658[_0x6a3e('0xb8')][_0x6a3e('0xb4')]?_0x998658[_0x6a3e('0xb8')][_0x6a3e('0xb4')]['Label']:_0x998658[_0x6a3e('0xb7')],'custom':![],'options':[]};_0x4088db[_0x6a3e('0xa8')](_0x1bfc90);return _0x4088db;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index cdbcd59..172e5ea 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 _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x2551e9,_0x9018bc){var _0x386bab=function(_0x190ceb){while(--_0x190ceb){_0x2551e9['push'](_0x2551e9['shift']());}};_0x386bab(++_0x9018bc);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x33155c,_0x3fdde1){var _0x5becf7=function(_0x2f7a2f){while(--_0x2f7a2f){_0x33155c['push'](_0x33155c['shift']());}};_0x5becf7(++_0x3fdde1);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index c50c390..025748c 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 _0x31a2=['request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','include','map','model','then','debug','ShowDynamics365Account','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x31a2,0x10d));var _0x231a=function(_0x270eca,_0x4c6cff){_0x270eca=_0x270eca-0x0;var _0x6d4e66=_0x31a2[_0x270eca];return _0x6d4e66;};'use strict';var _=require(_0x231a('0x0'));var util=require('util');var moment=require(_0x231a('0x1'));var BPromise=require(_0x231a('0x2'));var rs=require(_0x231a('0x3'));var fs=require('fs');var Redis=require(_0x231a('0x4'));var db=require(_0x231a('0x5'))['db'];var utils=require(_0x231a('0x6'));var logger=require(_0x231a('0x7'))('rpc');var config=require(_0x231a('0x8'));var jayson=require(_0x231a('0x9'));var client=jayson['client'][_0x231a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x460795,_0x1bf5e2,_0x19a61d){return new BPromise(function(_0x5c3032,_0x54704f){return client[_0x231a('0xb')](_0x460795,_0x19a61d)['then'](function(_0x112ccf){logger[_0x231a('0xc')](_0x231a('0xd'),_0x1bf5e2,_0x231a('0xe'));logger['debug'](_0x231a('0xf'),_0x1bf5e2,_0x231a('0xe'),JSON[_0x231a('0x10')](_0x112ccf));if(_0x112ccf['error']){if(_0x112ccf[_0x231a('0x11')][_0x231a('0x12')]===0x1f4){logger[_0x231a('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x1bf5e2,_0x112ccf[_0x231a('0x11')][_0x231a('0x13')]);return _0x54704f(_0x112ccf[_0x231a('0x11')][_0x231a('0x13')]);}logger[_0x231a('0x11')](_0x231a('0xd'),_0x1bf5e2,_0x112ccf['error'][_0x231a('0x13')]);return _0x5c3032(_0x112ccf[_0x231a('0x11')][_0x231a('0x13')]);}else{logger[_0x231a('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x1bf5e2,_0x231a('0xe'));_0x5c3032(_0x112ccf[_0x231a('0x14')][_0x231a('0x13')]);}})[_0x231a('0x15')](function(_0x4c5d45){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x1bf5e2,_0x4c5d45);_0x54704f(_0x4c5d45);});});}exports[_0x231a('0x16')]=function(_0x434a10){var _0x457668=this;return new Promise(function(_0x4a7c2e,_0xf0e892){return db[_0x231a('0x17')][_0x231a('0x18')]({'raw':_0x434a10[_0x231a('0x19')]?_0x434a10[_0x231a('0x19')][_0x231a('0x1a')]===undefined?!![]:![]:!![],'where':_0x434a10['options']?_0x434a10['options'][_0x231a('0x1b')]||null:null,'attributes':_0x434a10[_0x231a('0x19')]?_0x434a10[_0x231a('0x19')][_0x231a('0x1c')]||null:null,'limit':_0x434a10[_0x231a('0x19')]?_0x434a10['options']['limit']||null:null,'include':_0x434a10[_0x231a('0x19')]?_0x434a10['options'][_0x231a('0x1d')]?_[_0x231a('0x1e')](_0x434a10[_0x231a('0x19')][_0x231a('0x1d')],function(_0x103d0a){return{'model':db[_0x103d0a[_0x231a('0x1f')]],'as':_0x103d0a['as'],'attributes':_0x103d0a[_0x231a('0x1c')],'include':_0x103d0a['include']?_[_0x231a('0x1e')](_0x103d0a[_0x231a('0x1d')],function(_0x20d687){return{'model':db[_0x20d687[_0x231a('0x1f')]],'as':_0x20d687['as'],'attributes':_0x20d687['attributes'],'include':_0x20d687['include']?_['map'](_0x20d687[_0x231a('0x1d')],function(_0x3f464d){return{'model':db[_0x3f464d[_0x231a('0x1f')]],'as':_0x3f464d['as'],'attributes':_0x3f464d[_0x231a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x231a('0x20')](function(_0x3092be){logger[_0x231a('0xc')]('GetDynamics365Account',_0x434a10);logger[_0x231a('0x21')](_0x231a('0x16'),_0x434a10,JSON['stringify'](_0x3092be));_0x4a7c2e(_0x3092be);})['catch'](function(_0x236f36){logger['error'](_0x231a('0x16'),_0x236f36[_0x231a('0x13')],_0x434a10);_0xf0e892(_0x457668[_0x231a('0x11')](0x1f4,_0x236f36[_0x231a('0x13')]));});});};exports[_0x231a('0x22')]=function(_0x17ed54){var _0x1ea4c5=this;return new Promise(function(_0x542e9f,_0xfcd8f3){return db[_0x231a('0x17')]['find']({'raw':_0x17ed54['options']?_0x17ed54['options'][_0x231a('0x1a')]===undefined?!![]:![]:!![],'where':_0x17ed54[_0x231a('0x19')]?_0x17ed54['options']['where']||null:null,'attributes':_0x17ed54[_0x231a('0x19')]?_0x17ed54[_0x231a('0x19')]['attributes']||null:null,'include':_0x17ed54[_0x231a('0x19')]?_0x17ed54[_0x231a('0x19')][_0x231a('0x1d')]?_[_0x231a('0x1e')](_0x17ed54[_0x231a('0x19')][_0x231a('0x1d')],function(_0x415bbb){return{'model':db[_0x415bbb[_0x231a('0x1f')]],'as':_0x415bbb['as'],'attributes':_0x415bbb[_0x231a('0x1c')],'include':_0x415bbb[_0x231a('0x1d')]?_[_0x231a('0x1e')](_0x415bbb[_0x231a('0x1d')],function(_0x459479){return{'model':db[_0x459479[_0x231a('0x1f')]],'as':_0x459479['as'],'attributes':_0x459479[_0x231a('0x1c')],'include':_0x459479['include']?_['map'](_0x459479[_0x231a('0x1d')],function(_0x36d0b0){return{'model':db[_0x36d0b0['model']],'as':_0x36d0b0['as'],'attributes':_0x36d0b0[_0x231a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x231a('0x20')](function(_0x29ae4e){logger[_0x231a('0xc')](_0x231a('0x22'),_0x17ed54);logger[_0x231a('0x21')]('ShowDynamics365Account',_0x17ed54,JSON[_0x231a('0x10')](_0x29ae4e));_0x542e9f(_0x29ae4e);})[_0x231a('0x15')](function(_0x140ef1){logger[_0x231a('0x11')](_0x231a('0x22'),_0x140ef1[_0x231a('0x13')],_0x17ed54);_0xfcd8f3(_0x1ea4c5[_0x231a('0x11')](0x1f4,_0x140ef1['message']));});});}; \ No newline at end of file +var _0x5d46=['rpc','../../config/environment','jayson/promise','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetDynamics365Account','Dynamics365Account','findAll','raw','options','attributes','include','map','debug','ShowDynamics365Account','find','where','model','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x1ad926,_0x3e1fed){var _0x1b81dc=function(_0x506f83){while(--_0x506f83){_0x1ad926['push'](_0x1ad926['shift']());}};_0x1b81dc(++_0x3e1fed);}(_0x5d46,0x1e9));var _0x65d4=function(_0x5b015,_0x341440){_0x5b015=_0x5b015-0x0;var _0x561eb4=_0x5d46[_0x5b015];return _0x561eb4;};'use strict';var _=require(_0x65d4('0x0'));var util=require('util');var moment=require(_0x65d4('0x1'));var BPromise=require('bluebird');var rs=require(_0x65d4('0x2'));var fs=require('fs');var Redis=require(_0x65d4('0x3'));var db=require(_0x65d4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x65d4('0x5'))(_0x65d4('0x6'));var config=require(_0x65d4('0x7'));var jayson=require(_0x65d4('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3da59,_0x5e5f17,_0x77ebea){return new BPromise(function(_0x401b41,_0x11fa34){return client[_0x65d4('0x9')](_0x3da59,_0x77ebea)[_0x65d4('0xa')](function(_0x1590b8){logger[_0x65d4('0xb')](_0x65d4('0xc'),_0x5e5f17,_0x65d4('0xd'));logger['debug'](_0x65d4('0xe'),_0x5e5f17,_0x65d4('0xd'),JSON[_0x65d4('0xf')](_0x1590b8));if(_0x1590b8[_0x65d4('0x10')]){if(_0x1590b8['error'][_0x65d4('0x11')]===0x1f4){logger['error'](_0x65d4('0xc'),_0x5e5f17,_0x1590b8['error'][_0x65d4('0x12')]);return _0x11fa34(_0x1590b8[_0x65d4('0x10')][_0x65d4('0x12')]);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x5e5f17,_0x1590b8[_0x65d4('0x10')][_0x65d4('0x12')]);return _0x401b41(_0x1590b8[_0x65d4('0x10')][_0x65d4('0x12')]);}else{logger[_0x65d4('0xb')](_0x65d4('0xc'),_0x5e5f17,_0x65d4('0xd'));_0x401b41(_0x1590b8['result']['message']);}})[_0x65d4('0x13')](function(_0x23eb1b){logger[_0x65d4('0x10')](_0x65d4('0xc'),_0x5e5f17,_0x23eb1b);_0x11fa34(_0x23eb1b);});});}exports[_0x65d4('0x14')]=function(_0x17845a){var _0x138aad=this;return new Promise(function(_0x57b9f9,_0x429f96){return db[_0x65d4('0x15')][_0x65d4('0x16')]({'raw':_0x17845a['options']?_0x17845a['options'][_0x65d4('0x17')]===undefined?!![]:![]:!![],'where':_0x17845a['options']?_0x17845a[_0x65d4('0x18')]['where']||null:null,'attributes':_0x17845a['options']?_0x17845a[_0x65d4('0x18')][_0x65d4('0x19')]||null:null,'limit':_0x17845a[_0x65d4('0x18')]?_0x17845a[_0x65d4('0x18')]['limit']||null:null,'include':_0x17845a[_0x65d4('0x18')]?_0x17845a[_0x65d4('0x18')][_0x65d4('0x1a')]?_[_0x65d4('0x1b')](_0x17845a[_0x65d4('0x18')][_0x65d4('0x1a')],function(_0x4a9585){return{'model':db[_0x4a9585['model']],'as':_0x4a9585['as'],'attributes':_0x4a9585['attributes'],'include':_0x4a9585['include']?_[_0x65d4('0x1b')](_0x4a9585[_0x65d4('0x1a')],function(_0x46d0a5){return{'model':db[_0x46d0a5['model']],'as':_0x46d0a5['as'],'attributes':_0x46d0a5[_0x65d4('0x19')],'include':_0x46d0a5[_0x65d4('0x1a')]?_[_0x65d4('0x1b')](_0x46d0a5['include'],function(_0x3570a3){return{'model':db[_0x3570a3['model']],'as':_0x3570a3['as'],'attributes':_0x3570a3[_0x65d4('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34885f){logger[_0x65d4('0xb')](_0x65d4('0x14'),_0x17845a);logger[_0x65d4('0x1c')](_0x65d4('0x14'),_0x17845a,JSON[_0x65d4('0xf')](_0x34885f));_0x57b9f9(_0x34885f);})[_0x65d4('0x13')](function(_0x467a8f){logger[_0x65d4('0x10')](_0x65d4('0x14'),_0x467a8f['message'],_0x17845a);_0x429f96(_0x138aad[_0x65d4('0x10')](0x1f4,_0x467a8f[_0x65d4('0x12')]));});});};exports[_0x65d4('0x1d')]=function(_0x48c72a){var _0x559ea9=this;return new Promise(function(_0x402a21,_0x3131a3){return db['Dynamics365Account'][_0x65d4('0x1e')]({'raw':_0x48c72a['options']?_0x48c72a[_0x65d4('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x48c72a[_0x65d4('0x18')]?_0x48c72a[_0x65d4('0x18')][_0x65d4('0x1f')]||null:null,'attributes':_0x48c72a['options']?_0x48c72a['options'][_0x65d4('0x19')]||null:null,'include':_0x48c72a[_0x65d4('0x18')]?_0x48c72a['options']['include']?_[_0x65d4('0x1b')](_0x48c72a[_0x65d4('0x18')][_0x65d4('0x1a')],function(_0x1d35d4){return{'model':db[_0x1d35d4[_0x65d4('0x20')]],'as':_0x1d35d4['as'],'attributes':_0x1d35d4['attributes'],'include':_0x1d35d4[_0x65d4('0x1a')]?_[_0x65d4('0x1b')](_0x1d35d4[_0x65d4('0x1a')],function(_0x22efc2){return{'model':db[_0x22efc2[_0x65d4('0x20')]],'as':_0x22efc2['as'],'attributes':_0x22efc2[_0x65d4('0x19')],'include':_0x22efc2[_0x65d4('0x1a')]?_[_0x65d4('0x1b')](_0x22efc2[_0x65d4('0x1a')],function(_0x215070){return{'model':db[_0x215070[_0x65d4('0x20')]],'as':_0x215070['as'],'attributes':_0x215070[_0x65d4('0x19')]};}):[]};}):[]};}):[]:[]})[_0x65d4('0xa')](function(_0x1eaa6){logger[_0x65d4('0xb')](_0x65d4('0x1d'),_0x48c72a);logger['debug'](_0x65d4('0x1d'),_0x48c72a,JSON[_0x65d4('0xf')](_0x1eaa6));_0x402a21(_0x1eaa6);})[_0x65d4('0x13')](function(_0xcd6708){logger[_0x65d4('0x10')]('ShowDynamics365Account',_0xcd6708[_0x65d4('0x12')],_0x48c72a);_0x3131a3(_0x559ea9['error'](0x1f4,_0xcd6708[_0x65d4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index b203101..2164fbf 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 _0x9f12=['destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete'];(function(_0x10f254,_0xcbab0){var _0x178547=function(_0x4148ba){while(--_0x4148ba){_0x10f254['push'](_0x10f254['shift']());}};_0x178547(++_0xcbab0);}(_0x9f12,0xe8));var _0x29f1=function(_0x11a05f,_0x38a6af){_0x11a05f=_0x11a05f-0x0;var _0xdfea63=_0x9f12[_0x11a05f];return _0xdfea63;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x29f1('0x0'));var timeout=require(_0x29f1('0x1'));var express=require(_0x29f1('0x2'));var router=express[_0x29f1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x29f1('0x4'));var interaction=require(_0x29f1('0x5'));var config=require(_0x29f1('0x6'));var controller=require(_0x29f1('0x7'));router[_0x29f1('0x8')]('/',auth[_0x29f1('0x9')](),controller['index']);router[_0x29f1('0x8')](_0x29f1('0xa'),auth[_0x29f1('0x9')](),controller[_0x29f1('0xb')]);router['get']('/:id/fields',auth[_0x29f1('0x9')](),controller[_0x29f1('0xc')]);router[_0x29f1('0x8')](_0x29f1('0xd'),auth[_0x29f1('0x9')](),controller[_0x29f1('0xe')]);router[_0x29f1('0x8')](_0x29f1('0xf'),auth['isAuthenticated'](),controller[_0x29f1('0x10')]);router[_0x29f1('0x11')]('/',auth[_0x29f1('0x9')](),controller['create']);router[_0x29f1('0x12')](_0x29f1('0xa'),auth[_0x29f1('0x9')](),controller[_0x29f1('0x13')]);router[_0x29f1('0x14')](_0x29f1('0xa'),auth[_0x29f1('0x9')](),controller[_0x29f1('0x15')]);module[_0x29f1('0x16')]=router; \ No newline at end of file +var _0x31df=['create','put','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x73eea3,_0x4f2f07){var _0x429c65=function(_0x524361){while(--_0x524361){_0x73eea3['push'](_0x73eea3['shift']());}};_0x429c65(++_0x4f2f07);}(_0x31df,0x13d));var _0xf31d=function(_0x374aeb,_0x3eef46){_0x374aeb=_0x374aeb-0x0;var _0x1eaa7e=_0x31df[_0x374aeb];return _0x1eaa7e;};'use strict';var multer=require(_0xf31d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf31d('0x1'));var express=require(_0xf31d('0x2'));var router=express[_0xf31d('0x3')]();var fs_extra=require(_0xf31d('0x4'));var auth=require(_0xf31d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf31d('0x6'));var controller=require(_0xf31d('0x7'));router[_0xf31d('0x8')]('/',auth[_0xf31d('0x9')](),controller[_0xf31d('0xa')]);router[_0xf31d('0x8')](_0xf31d('0xb'),auth[_0xf31d('0x9')](),controller[_0xf31d('0xc')]);router[_0xf31d('0x8')]('/:id/fields',auth[_0xf31d('0x9')](),controller[_0xf31d('0xd')]);router[_0xf31d('0x8')](_0xf31d('0xe'),auth[_0xf31d('0x9')](),controller[_0xf31d('0xf')]);router[_0xf31d('0x8')](_0xf31d('0x10'),auth[_0xf31d('0x9')](),controller[_0xf31d('0x11')]);router[_0xf31d('0x12')]('/',auth[_0xf31d('0x9')](),controller[_0xf31d('0x13')]);router[_0xf31d('0x14')](_0xf31d('0xb'),auth[_0xf31d('0x9')](),controller[_0xf31d('0x15')]);router[_0xf31d('0x16')](_0xf31d('0xb'),auth[_0xf31d('0x9')](),controller['destroy']);module[_0xf31d('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index cb7127f..c73f73d 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 _0x0835=['STRING','ENUM','incident','exports'];(function(_0x523e09,_0xb598ae){var _0x1c6782=function(_0x2d8977){while(--_0x2d8977){_0x523e09['push'](_0x523e09['shift']());}};_0x1c6782(++_0xb598ae);}(_0x0835,0x17b));var _0x5083=function(_0xd5b9d0,_0x2e7764){_0xd5b9d0=_0xd5b9d0-0x0;var _0x1d1d1f=_0x0835[_0xd5b9d0];return _0x1d1d1f;};'use strict';var Sequelize=require('sequelize');module[_0x5083('0x0')]={'name':{'type':Sequelize[_0x5083('0x1')]},'description':{'type':Sequelize[_0x5083('0x1')]},'ticketType':{'type':Sequelize[_0x5083('0x2')](_0x5083('0x3'),'phonecall'),'defaultValue':_0x5083('0x3')}}; \ No newline at end of file +var _0x78ea=['sequelize','STRING','incident','phonecall'];(function(_0x5ac84c,_0x287781){var _0x3c53d2=function(_0x40cde0){while(--_0x40cde0){_0x5ac84c['push'](_0x5ac84c['shift']());}};_0x3c53d2(++_0x287781);}(_0x78ea,0x6c));var _0xa78e=function(_0x20b1f9,_0x1abe8a){_0x20b1f9=_0x20b1f9-0x0;var _0x578891=_0x78ea[_0x20b1f9];return _0x578891;};'use strict';var Sequelize=require(_0xa78e('0x0'));module['exports']={'name':{'type':Sequelize[_0xa78e('0x1')]},'description':{'type':Sequelize[_0xa78e('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0xa78e('0x2'),_0xa78e('0x3')),'defaultValue':_0xa78e('0x2')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 032dfc9..da2c67c 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 _0x2eac=['rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','error','stack','name','send','index','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','catch','create','update','find','body','getFields','findOne','Dynamics365Field','pick','getSubjects','getDescriptions','options','nolimit','eml-format'];(function(_0x93ed4,_0x7f163e){var _0x2612f1=function(_0x205290){while(--_0x205290){_0x93ed4['push'](_0x93ed4['shift']());}};_0x2612f1(++_0x7f163e);}(_0x2eac,0x19e));var _0xc2ea=function(_0x22e723,_0x4370ee){_0x22e723=_0x22e723-0x0;var _0x52fde1=_0x2eac[_0x22e723];return _0x52fde1;};'use strict';var emlformat=require(_0xc2ea('0x0'));var rimraf=require(_0xc2ea('0x1'));var zipdir=require(_0xc2ea('0x2'));var jsonpatch=require(_0xc2ea('0x3'));var rp=require(_0xc2ea('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc2ea('0x5'));var util=require(_0xc2ea('0x6'));var path=require(_0xc2ea('0x7'));var sox=require('sox');var csv=require(_0xc2ea('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc2ea('0x9'));var _=require(_0xc2ea('0xa'));var squel=require('squel');var crypto=require(_0xc2ea('0xb'));var jsforce=require(_0xc2ea('0xc'));var deskjs=require(_0xc2ea('0xd'));var toCsv=require(_0xc2ea('0x8'));var querystring=require(_0xc2ea('0xe'));var Papa=require(_0xc2ea('0xf'));var Redis=require(_0xc2ea('0x10'));var authService=require(_0xc2ea('0x11'));var qs=require(_0xc2ea('0x12'));var as=require(_0xc2ea('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc2ea('0x14'))(_0xc2ea('0x15'));var utils=require('../../config/utils');var config=require(_0xc2ea('0x16'));var licenseUtil=require(_0xc2ea('0x17'));var db=require(_0xc2ea('0x18'))['db'];function respondWithStatusCode(_0x3b16e6,_0x5741a0){_0x5741a0=_0x5741a0||0xcc;return function(_0x355114){if(_0x355114){return _0x3b16e6[_0xc2ea('0x19')](_0x5741a0);}return _0x3b16e6[_0xc2ea('0x1a')](_0x5741a0)[_0xc2ea('0x1b')]();};}function respondWithResult(_0x3c36b7,_0x59b657){_0x59b657=_0x59b657||0xc8;return function(_0x134b09){if(_0x134b09){return _0x3c36b7['status'](_0x59b657)[_0xc2ea('0x1c')](_0x134b09);}};}function respondWithFilteredResult(_0x585efd,_0x2b48d4){return function(_0x154ba2){if(_0x154ba2){var _0x3922df=typeof _0x2b48d4[_0xc2ea('0x1d')]===_0xc2ea('0x1e')&&typeof _0x2b48d4[_0xc2ea('0x1f')]===_0xc2ea('0x1e');var _0x2324c6=_0x154ba2['count'];var _0x1d435c=_0x3922df?0x0:_0x2b48d4[_0xc2ea('0x1d')];var _0x22ba2c=_0x3922df?_0x154ba2[_0xc2ea('0x20')]:_0x2b48d4['offset']+_0x2b48d4['limit'];var _0x4a3141;if(_0x22ba2c>=_0x2324c6){_0x22ba2c=_0x2324c6;_0x4a3141=0xc8;}else{_0x4a3141=0xce;}_0x585efd[_0xc2ea('0x1a')](_0x4a3141);return _0x585efd[_0xc2ea('0x21')](_0xc2ea('0x22'),_0x1d435c+'-'+_0x22ba2c+'/'+_0x2324c6)[_0xc2ea('0x1c')](_0x154ba2);}return null;};}function patchUpdates(_0x40508b){return function(_0x18f857){try{jsonpatch['apply'](_0x18f857,_0x40508b,!![]);}catch(_0x8f008e){return BPromise[_0xc2ea('0x23')](_0x8f008e);}return _0x18f857['save']();};}function saveUpdates(_0x3378fa,_0x42de02){return function(_0x2521f2){if(_0x2521f2){return _0x2521f2['update'](_0x3378fa)[_0xc2ea('0x24')](function(_0x33e8d6){return _0x33e8d6;});}return null;};}function removeEntity(_0x57b2ee,_0x4a8bf7){return function(_0x5006d3){if(_0x5006d3){return _0x5006d3[_0xc2ea('0x25')]()['then'](function(){_0x57b2ee['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x580d0c,_0x447f8f){return function(_0x22d899){if(!_0x22d899){_0x580d0c[_0xc2ea('0x19')](0x194);}return _0x22d899;};}function handleError(_0x35eee1,_0x11b7f5){_0x11b7f5=_0x11b7f5||0x1f4;return function(_0x5a30e7){logger[_0xc2ea('0x26')](_0x5a30e7[_0xc2ea('0x27')]);if(_0x5a30e7[_0xc2ea('0x28')]){delete _0x5a30e7['name'];}_0x35eee1[_0xc2ea('0x1a')](_0x11b7f5)[_0xc2ea('0x29')](_0x5a30e7);};}exports[_0xc2ea('0x2a')]=function(_0xa69c2a,_0x4a01d3){var _0x4fc823={},_0x22e451={},_0x33d9df={'count':0x0,'rows':[]};var _0x17e5a6=_['map'](db[_0xc2ea('0x2b')][_0xc2ea('0x2c')],function(_0x4a5e69){return{'name':_0x4a5e69[_0xc2ea('0x2d')],'type':_0x4a5e69[_0xc2ea('0x2e')][_0xc2ea('0x2f')]};});_0x22e451[_0xc2ea('0x30')]=_[_0xc2ea('0x31')](_0x17e5a6,_0xc2ea('0x28'));_0x22e451[_0xc2ea('0x32')]=_['keys'](_0xa69c2a[_0xc2ea('0x32')]);_0x22e451[_0xc2ea('0x33')]=_[_0xc2ea('0x34')](_0x22e451[_0xc2ea('0x30')],_0x22e451[_0xc2ea('0x32')]);_0x4fc823['attributes']=_[_0xc2ea('0x34')](_0x22e451[_0xc2ea('0x30')],qs[_0xc2ea('0x35')](_0xa69c2a[_0xc2ea('0x32')]['fields']));_0x4fc823[_0xc2ea('0x36')]=_0x4fc823['attributes'][_0xc2ea('0x37')]?_0x4fc823[_0xc2ea('0x36')]:_0x22e451['model'];if(!_0xa69c2a[_0xc2ea('0x32')][_0xc2ea('0x38')]('nolimit')){_0x4fc823[_0xc2ea('0x1f')]=qs[_0xc2ea('0x1f')](_0xa69c2a[_0xc2ea('0x32')][_0xc2ea('0x1f')]);_0x4fc823[_0xc2ea('0x1d')]=qs['offset'](_0xa69c2a[_0xc2ea('0x32')]['offset']);}_0x4fc823[_0xc2ea('0x39')]=qs[_0xc2ea('0x3a')](_0xa69c2a[_0xc2ea('0x32')][_0xc2ea('0x3a')]);_0x4fc823[_0xc2ea('0x3b')]=qs[_0xc2ea('0x33')](_['pick'](_0xa69c2a[_0xc2ea('0x32')],_0x22e451['filters']),_0x17e5a6);if(_0xa69c2a[_0xc2ea('0x32')][_0xc2ea('0x3c')]){_0x4fc823['where']=_[_0xc2ea('0x3d')](_0x4fc823[_0xc2ea('0x3b')],{'$or':_['map'](_0x17e5a6,function(_0x630ce){if(_0x630ce['type']!==_0xc2ea('0x3e')){var _0x1bd652={};_0x1bd652[_0x630ce[_0xc2ea('0x28')]]={'$like':'%'+_0xa69c2a[_0xc2ea('0x32')][_0xc2ea('0x3c')]+'%'};return _0x1bd652;}})});}_0x4fc823=_[_0xc2ea('0x3d')]({},_0x4fc823,_0xa69c2a['options']);var _0x536085={'where':_0x4fc823[_0xc2ea('0x3b')]};return db[_0xc2ea('0x2b')]['count'](_0x536085)['then'](function(_0x17e72a){_0x33d9df['count']=_0x17e72a;if(_0xa69c2a[_0xc2ea('0x32')][_0xc2ea('0x3f')]){_0x4fc823[_0xc2ea('0x40')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0xc2ea('0x41')](_0x4fc823);})[_0xc2ea('0x24')](function(_0x28160f){_0x33d9df[_0xc2ea('0x42')]=_0x28160f;return _0x33d9df;})[_0xc2ea('0x24')](respondWithFilteredResult(_0x4a01d3,_0x4fc823))['catch'](handleError(_0x4a01d3,null));};exports[_0xc2ea('0x43')]=function(_0x4872cf,_0x127c75){var _0x42db22={'raw':![],'where':{'id':_0x4872cf[_0xc2ea('0x44')]['id']}},_0x4a3497={};_0x4a3497[_0xc2ea('0x30')]=_[_0xc2ea('0x45')](db['Dynamics365Configuration'][_0xc2ea('0x2c')]);_0x4a3497[_0xc2ea('0x32')]=_['keys'](_0x4872cf['query']);_0x4a3497[_0xc2ea('0x33')]=_[_0xc2ea('0x34')](_0x4a3497[_0xc2ea('0x30')],_0x4a3497[_0xc2ea('0x32')]);_0x42db22[_0xc2ea('0x36')]=_['intersection'](_0x4a3497[_0xc2ea('0x30')],qs[_0xc2ea('0x35')](_0x4872cf[_0xc2ea('0x32')]['fields']));_0x42db22[_0xc2ea('0x36')]=_0x42db22[_0xc2ea('0x36')][_0xc2ea('0x37')]?_0x42db22[_0xc2ea('0x36')]:_0x4a3497[_0xc2ea('0x30')];if(_0x4872cf[_0xc2ea('0x32')]['includeAll']){_0x42db22[_0xc2ea('0x40')]=[{'all':!![]}];}_0x42db22=_[_0xc2ea('0x3d')]({},_0x42db22,_0x4872cf['options']);return db['Dynamics365Configuration']['find'](_0x42db22)[_0xc2ea('0x24')](handleEntityNotFound(_0x127c75,null))['then'](respondWithResult(_0x127c75,null))[_0xc2ea('0x46')](handleError(_0x127c75,null));};exports[_0xc2ea('0x47')]=function(_0x4cab3a,_0x1a2e9f){return db['Dynamics365Configuration'][_0xc2ea('0x47')](_0x4cab3a['body'],{})['then'](respondWithResult(_0x1a2e9f,0xc9))['catch'](handleError(_0x1a2e9f,null));};exports[_0xc2ea('0x48')]=function(_0x1903f6,_0x3880f9){if(_0x1903f6['body']['id']){delete _0x1903f6['body']['id'];}return db[_0xc2ea('0x2b')][_0xc2ea('0x49')]({'where':{'id':_0x1903f6[_0xc2ea('0x44')]['id']}})['then'](handleEntityNotFound(_0x3880f9,null))[_0xc2ea('0x24')](saveUpdates(_0x1903f6[_0xc2ea('0x4a')],null))[_0xc2ea('0x24')](respondWithResult(_0x3880f9,null))[_0xc2ea('0x46')](handleError(_0x3880f9,null));};exports[_0xc2ea('0x25')]=function(_0x57115b,_0x3279d3){return db[_0xc2ea('0x2b')]['find']({'where':{'id':_0x57115b[_0xc2ea('0x44')]['id']}})[_0xc2ea('0x24')](handleEntityNotFound(_0x3279d3,null))['then'](removeEntity(_0x3279d3,null))['catch'](handleError(_0x3279d3,null));};exports[_0xc2ea('0x4b')]=function(_0x5dac69,_0x3eb1ec,_0x40ec9c){var _0x5a5e41={};var _0x543f9b={};var _0x573e68;var _0x47e222;return db[_0xc2ea('0x2b')][_0xc2ea('0x4c')]({'where':{'id':_0x5dac69[_0xc2ea('0x44')]['id']}})[_0xc2ea('0x24')](handleEntityNotFound(_0x3eb1ec,null))['then'](function(_0x1020b5){if(_0x1020b5){_0x573e68=_0x1020b5;_0x543f9b['model']=_[_0xc2ea('0x45')](db[_0xc2ea('0x4d')][_0xc2ea('0x2c')]);_0x543f9b['query']=_[_0xc2ea('0x45')](_0x5dac69[_0xc2ea('0x32')]);_0x543f9b[_0xc2ea('0x33')]=_[_0xc2ea('0x34')](_0x543f9b['model'],_0x543f9b['query']);_0x5a5e41['attributes']=_['intersection'](_0x543f9b['model'],qs[_0xc2ea('0x35')](_0x5dac69['query'][_0xc2ea('0x35')]));_0x5a5e41['attributes']=_0x5a5e41[_0xc2ea('0x36')]['length']?_0x5a5e41[_0xc2ea('0x36')]:_0x543f9b[_0xc2ea('0x30')];_0x5a5e41['order']=qs['sort'](_0x5dac69[_0xc2ea('0x32')][_0xc2ea('0x3a')]);_0x5a5e41['where']=qs[_0xc2ea('0x33')](_[_0xc2ea('0x4e')](_0x5dac69['query'],_0x543f9b[_0xc2ea('0x33')]));if(_0x5dac69[_0xc2ea('0x32')]['filter']){_0x5a5e41['where']=_[_0xc2ea('0x3d')](_0x5a5e41[_0xc2ea('0x3b')],{'$or':_[_0xc2ea('0x31')](_0x5a5e41[_0xc2ea('0x36')],function(_0x361d54){var _0x1fd89c={};_0x1fd89c[_0x361d54]={'$like':'%'+_0x5dac69['query'][_0xc2ea('0x3c')]+'%'};return _0x1fd89c;})});}_0x5a5e41=_['merge']({},_0x5a5e41,_0x5dac69['options']);return _0x573e68[_0xc2ea('0x4b')](_0x5a5e41);}})[_0xc2ea('0x24')](function(_0x10597a){if(_0x10597a){_0x47e222=_0x10597a['length'];if(!_0x5dac69[_0xc2ea('0x32')][_0xc2ea('0x38')]('nolimit')){_0x5a5e41['limit']=qs[_0xc2ea('0x1f')](_0x5dac69['query'][_0xc2ea('0x1f')]);_0x5a5e41[_0xc2ea('0x1d')]=qs[_0xc2ea('0x1d')](_0x5dac69[_0xc2ea('0x32')][_0xc2ea('0x1d')]);}return _0x573e68['getFields'](_0x5a5e41);}})[_0xc2ea('0x24')](function(_0x457d72){if(_0x457d72){return _0x457d72?{'count':_0x47e222,'rows':_0x457d72}:null;}})['then'](respondWithResult(_0x3eb1ec,null))[_0xc2ea('0x46')](handleError(_0x3eb1ec,null));};exports[_0xc2ea('0x4f')]=function(_0x296b8e,_0x8bca8d,_0x1e83e6){var _0x38ae22={};var _0x413f63={};var _0x3740bb;var _0x380acd;return db[_0xc2ea('0x2b')][_0xc2ea('0x4c')]({'where':{'id':_0x296b8e[_0xc2ea('0x44')]['id']}})[_0xc2ea('0x24')](handleEntityNotFound(_0x8bca8d,null))[_0xc2ea('0x24')](function(_0x47e669){if(_0x47e669){_0x3740bb=_0x47e669;_0x413f63[_0xc2ea('0x30')]=_[_0xc2ea('0x45')](db[_0xc2ea('0x4d')][_0xc2ea('0x2c')]);_0x413f63[_0xc2ea('0x32')]=_[_0xc2ea('0x45')](_0x296b8e[_0xc2ea('0x32')]);_0x413f63['filters']=_[_0xc2ea('0x34')](_0x413f63[_0xc2ea('0x30')],_0x413f63['query']);_0x38ae22['attributes']=_[_0xc2ea('0x34')](_0x413f63[_0xc2ea('0x30')],qs['fields'](_0x296b8e[_0xc2ea('0x32')][_0xc2ea('0x35')]));_0x38ae22[_0xc2ea('0x36')]=_0x38ae22[_0xc2ea('0x36')][_0xc2ea('0x37')]?_0x38ae22[_0xc2ea('0x36')]:_0x413f63['model'];_0x38ae22['order']=qs[_0xc2ea('0x3a')](_0x296b8e[_0xc2ea('0x32')][_0xc2ea('0x3a')]);_0x38ae22[_0xc2ea('0x3b')]=qs[_0xc2ea('0x33')](_['pick'](_0x296b8e[_0xc2ea('0x32')],_0x413f63[_0xc2ea('0x33')]));if(_0x296b8e[_0xc2ea('0x32')]['filter']){_0x38ae22[_0xc2ea('0x3b')]=_[_0xc2ea('0x3d')](_0x38ae22['where'],{'$or':_[_0xc2ea('0x31')](_0x38ae22[_0xc2ea('0x36')],function(_0x28d961){var _0x4b5e7a={};_0x4b5e7a[_0x28d961]={'$like':'%'+_0x296b8e[_0xc2ea('0x32')]['filter']+'%'};return _0x4b5e7a;})});}_0x38ae22=_[_0xc2ea('0x3d')]({},_0x38ae22,_0x296b8e['options']);return _0x3740bb[_0xc2ea('0x4f')](_0x38ae22);}})['then'](function(_0x4f940d){if(_0x4f940d){_0x380acd=_0x4f940d['length'];if(!_0x296b8e['query'][_0xc2ea('0x38')]('nolimit')){_0x38ae22[_0xc2ea('0x1f')]=qs[_0xc2ea('0x1f')](_0x296b8e['query'][_0xc2ea('0x1f')]);_0x38ae22['offset']=qs['offset'](_0x296b8e[_0xc2ea('0x32')][_0xc2ea('0x1d')]);}return _0x3740bb[_0xc2ea('0x4f')](_0x38ae22);}})[_0xc2ea('0x24')](function(_0x36f92e){if(_0x36f92e){return _0x36f92e?{'count':_0x380acd,'rows':_0x36f92e}:null;}})[_0xc2ea('0x24')](respondWithResult(_0x8bca8d,null))[_0xc2ea('0x46')](handleError(_0x8bca8d,null));};exports[_0xc2ea('0x50')]=function(_0x12cc3f,_0x39547b,_0x262178){var _0x3e77c4={};var _0x47204c={};var _0x2e56b4;var _0x864af;return db[_0xc2ea('0x2b')][_0xc2ea('0x4c')]({'where':{'id':_0x12cc3f[_0xc2ea('0x44')]['id']}})[_0xc2ea('0x24')](handleEntityNotFound(_0x39547b,null))[_0xc2ea('0x24')](function(_0x3f41ef){if(_0x3f41ef){_0x2e56b4=_0x3f41ef;_0x47204c[_0xc2ea('0x30')]=_[_0xc2ea('0x45')](db[_0xc2ea('0x4d')][_0xc2ea('0x2c')]);_0x47204c[_0xc2ea('0x32')]=_[_0xc2ea('0x45')](_0x12cc3f[_0xc2ea('0x32')]);_0x47204c[_0xc2ea('0x33')]=_[_0xc2ea('0x34')](_0x47204c[_0xc2ea('0x30')],_0x47204c[_0xc2ea('0x32')]);_0x3e77c4[_0xc2ea('0x36')]=_[_0xc2ea('0x34')](_0x47204c[_0xc2ea('0x30')],qs[_0xc2ea('0x35')](_0x12cc3f[_0xc2ea('0x32')][_0xc2ea('0x35')]));_0x3e77c4['attributes']=_0x3e77c4[_0xc2ea('0x36')][_0xc2ea('0x37')]?_0x3e77c4[_0xc2ea('0x36')]:_0x47204c[_0xc2ea('0x30')];_0x3e77c4[_0xc2ea('0x39')]=qs[_0xc2ea('0x3a')](_0x12cc3f[_0xc2ea('0x32')][_0xc2ea('0x3a')]);_0x3e77c4[_0xc2ea('0x3b')]=qs['filters'](_[_0xc2ea('0x4e')](_0x12cc3f[_0xc2ea('0x32')],_0x47204c[_0xc2ea('0x33')]));if(_0x12cc3f[_0xc2ea('0x32')][_0xc2ea('0x3c')]){_0x3e77c4[_0xc2ea('0x3b')]=_['merge'](_0x3e77c4[_0xc2ea('0x3b')],{'$or':_[_0xc2ea('0x31')](_0x3e77c4['attributes'],function(_0x3f7ef2){var _0x539ce3={};_0x539ce3[_0x3f7ef2]={'$like':'%'+_0x12cc3f[_0xc2ea('0x32')][_0xc2ea('0x3c')]+'%'};return _0x539ce3;})});}_0x3e77c4=_[_0xc2ea('0x3d')]({},_0x3e77c4,_0x12cc3f[_0xc2ea('0x51')]);return _0x2e56b4['getDescriptions'](_0x3e77c4);}})[_0xc2ea('0x24')](function(_0x1fd982){if(_0x1fd982){_0x864af=_0x1fd982['length'];if(!_0x12cc3f['query'][_0xc2ea('0x38')](_0xc2ea('0x52'))){_0x3e77c4['limit']=qs[_0xc2ea('0x1f')](_0x12cc3f['query'][_0xc2ea('0x1f')]);_0x3e77c4[_0xc2ea('0x1d')]=qs[_0xc2ea('0x1d')](_0x12cc3f[_0xc2ea('0x32')][_0xc2ea('0x1d')]);}return _0x2e56b4[_0xc2ea('0x50')](_0x3e77c4);}})[_0xc2ea('0x24')](function(_0x137f2d){if(_0x137f2d){return _0x137f2d?{'count':_0x864af,'rows':_0x137f2d}:null;}})[_0xc2ea('0x24')](respondWithResult(_0x39547b,null))[_0xc2ea('0x46')](handleError(_0x39547b,null));}; \ No newline at end of file +var _0x4040=['length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','find','create','body','getFields','findOne','Dynamics365Field','hasOwnProperty','getSubjects','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes'];(function(_0x5a07d4,_0x501d6c){var _0xacb3e3=function(_0x104c4e){while(--_0x104c4e){_0x5a07d4['push'](_0x5a07d4['shift']());}};_0xacb3e3(++_0x501d6c);}(_0x4040,0x10e));var _0x0404=function(_0x507d23,_0x1190c6){_0x507d23=_0x507d23-0x0;var _0x5eef1c=_0x4040[_0x507d23];return _0x5eef1c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0404('0x0'));var jsonpatch=require(_0x0404('0x1'));var rp=require(_0x0404('0x2'));var moment=require(_0x0404('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0404('0x4'));var util=require(_0x0404('0x5'));var path=require('path');var sox=require(_0x0404('0x6'));var csv=require(_0x0404('0x7'));var ejs=require(_0x0404('0x8'));var fs=require('fs');var fs_extra=require(_0x0404('0x9'));var _=require(_0x0404('0xa'));var squel=require(_0x0404('0xb'));var crypto=require(_0x0404('0xc'));var jsforce=require(_0x0404('0xd'));var deskjs=require(_0x0404('0xe'));var toCsv=require(_0x0404('0x7'));var querystring=require('querystring');var Papa=require(_0x0404('0xf'));var Redis=require(_0x0404('0x10'));var authService=require(_0x0404('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0404('0x12'));var hardwareService=require(_0x0404('0x13'));var logger=require('../../config/logger')(_0x0404('0x14'));var utils=require('../../config/utils');var config=require(_0x0404('0x15'));var licenseUtil=require(_0x0404('0x16'));var db=require(_0x0404('0x17'))['db'];function respondWithStatusCode(_0x5c1522,_0x540bca){_0x540bca=_0x540bca||0xcc;return function(_0x3399d4){if(_0x3399d4){return _0x5c1522[_0x0404('0x18')](_0x540bca);}return _0x5c1522[_0x0404('0x19')](_0x540bca)[_0x0404('0x1a')]();};}function respondWithResult(_0xaa9881,_0x4bb24a){_0x4bb24a=_0x4bb24a||0xc8;return function(_0x4110a9){if(_0x4110a9){return _0xaa9881['status'](_0x4bb24a)['json'](_0x4110a9);}};}function respondWithFilteredResult(_0x5d594d,_0x3fd6dc){return function(_0x51d7cb){if(_0x51d7cb){var _0x1e0d16=typeof _0x3fd6dc[_0x0404('0x1b')]===_0x0404('0x1c')&&typeof _0x3fd6dc['limit']===_0x0404('0x1c');var _0x1451e6=_0x51d7cb[_0x0404('0x1d')];var _0x496db9=_0x1e0d16?0x0:_0x3fd6dc[_0x0404('0x1b')];var _0x21562a=_0x1e0d16?_0x51d7cb[_0x0404('0x1d')]:_0x3fd6dc[_0x0404('0x1b')]+_0x3fd6dc[_0x0404('0x1e')];var _0x675079;if(_0x21562a>=_0x1451e6){_0x21562a=_0x1451e6;_0x675079=0xc8;}else{_0x675079=0xce;}_0x5d594d[_0x0404('0x19')](_0x675079);return _0x5d594d[_0x0404('0x1f')](_0x0404('0x20'),_0x496db9+'-'+_0x21562a+'/'+_0x1451e6)[_0x0404('0x21')](_0x51d7cb);}return null;};}function patchUpdates(_0x269933){return function(_0x109638){try{jsonpatch[_0x0404('0x22')](_0x109638,_0x269933,!![]);}catch(_0x43adb4){return BPromise[_0x0404('0x23')](_0x43adb4);}return _0x109638[_0x0404('0x24')]();};}function saveUpdates(_0x4ed9c0,_0x5d1bad){return function(_0xa7e313){if(_0xa7e313){return _0xa7e313[_0x0404('0x25')](_0x4ed9c0)[_0x0404('0x26')](function(_0x4cbff1){return _0x4cbff1;});}return null;};}function removeEntity(_0x1e6072,_0x63d0c5){return function(_0x180d88){if(_0x180d88){return _0x180d88[_0x0404('0x27')]()[_0x0404('0x26')](function(){_0x1e6072[_0x0404('0x19')](0xcc)[_0x0404('0x1a')]();});}};}function handleEntityNotFound(_0x36344a,_0x5bfcba){return function(_0x31b7c9){if(!_0x31b7c9){_0x36344a['sendStatus'](0x194);}return _0x31b7c9;};}function handleError(_0x23e27f,_0x2469e2){_0x2469e2=_0x2469e2||0x1f4;return function(_0x3f1d2d){logger[_0x0404('0x28')](_0x3f1d2d[_0x0404('0x29')]);if(_0x3f1d2d[_0x0404('0x2a')]){delete _0x3f1d2d['name'];}_0x23e27f['status'](_0x2469e2)[_0x0404('0x2b')](_0x3f1d2d);};}exports[_0x0404('0x2c')]=function(_0x1e6f59,_0x2b183b){var _0x243282={},_0x58e0ed={},_0x23a291={'count':0x0,'rows':[]};var _0x20dbe9=_[_0x0404('0x2d')](db[_0x0404('0x2e')][_0x0404('0x2f')],function(_0x4c9709){return{'name':_0x4c9709[_0x0404('0x30')],'type':_0x4c9709[_0x0404('0x31')][_0x0404('0x32')]};});_0x58e0ed[_0x0404('0x33')]=_[_0x0404('0x2d')](_0x20dbe9,_0x0404('0x2a'));_0x58e0ed[_0x0404('0x34')]=_[_0x0404('0x35')](_0x1e6f59['query']);_0x58e0ed[_0x0404('0x36')]=_[_0x0404('0x37')](_0x58e0ed['model'],_0x58e0ed[_0x0404('0x34')]);_0x243282['attributes']=_[_0x0404('0x37')](_0x58e0ed['model'],qs[_0x0404('0x38')](_0x1e6f59[_0x0404('0x34')][_0x0404('0x38')]));_0x243282[_0x0404('0x39')]=_0x243282[_0x0404('0x39')][_0x0404('0x3a')]?_0x243282[_0x0404('0x39')]:_0x58e0ed[_0x0404('0x33')];if(!_0x1e6f59['query']['hasOwnProperty'](_0x0404('0x3b'))){_0x243282[_0x0404('0x1e')]=qs[_0x0404('0x1e')](_0x1e6f59['query']['limit']);_0x243282[_0x0404('0x1b')]=qs[_0x0404('0x1b')](_0x1e6f59[_0x0404('0x34')][_0x0404('0x1b')]);}_0x243282[_0x0404('0x3c')]=qs[_0x0404('0x3d')](_0x1e6f59[_0x0404('0x34')][_0x0404('0x3d')]);_0x243282['where']=qs[_0x0404('0x36')](_[_0x0404('0x3e')](_0x1e6f59[_0x0404('0x34')],_0x58e0ed[_0x0404('0x36')]),_0x20dbe9);if(_0x1e6f59[_0x0404('0x34')]['filter']){_0x243282[_0x0404('0x3f')]=_[_0x0404('0x40')](_0x243282[_0x0404('0x3f')],{'$or':_['map'](_0x20dbe9,function(_0x4cad10){if(_0x4cad10[_0x0404('0x31')]!==_0x0404('0x41')){var _0x5c3e1d={};_0x5c3e1d[_0x4cad10['name']]={'$like':'%'+_0x1e6f59[_0x0404('0x34')][_0x0404('0x42')]+'%'};return _0x5c3e1d;}})});}_0x243282=_['merge']({},_0x243282,_0x1e6f59[_0x0404('0x43')]);var _0x3eaddd={'where':_0x243282[_0x0404('0x3f')]};return db[_0x0404('0x2e')][_0x0404('0x1d')](_0x3eaddd)[_0x0404('0x26')](function(_0x205cd7){_0x23a291[_0x0404('0x1d')]=_0x205cd7;if(_0x1e6f59[_0x0404('0x34')][_0x0404('0x44')]){_0x243282['include']=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x0404('0x45')](_0x243282);})['then'](function(_0x3c47cd){_0x23a291[_0x0404('0x46')]=_0x3c47cd;return _0x23a291;})[_0x0404('0x26')](respondWithFilteredResult(_0x2b183b,_0x243282))[_0x0404('0x47')](handleError(_0x2b183b,null));};exports['show']=function(_0x23ebc7,_0x1d59ba){var _0x2ac53b={'raw':![],'where':{'id':_0x23ebc7[_0x0404('0x48')]['id']}},_0x5b2c05={};_0x5b2c05['model']=_[_0x0404('0x35')](db[_0x0404('0x2e')]['rawAttributes']);_0x5b2c05[_0x0404('0x34')]=_[_0x0404('0x35')](_0x23ebc7['query']);_0x5b2c05[_0x0404('0x36')]=_['intersection'](_0x5b2c05['model'],_0x5b2c05[_0x0404('0x34')]);_0x2ac53b[_0x0404('0x39')]=_[_0x0404('0x37')](_0x5b2c05[_0x0404('0x33')],qs[_0x0404('0x38')](_0x23ebc7[_0x0404('0x34')]['fields']));_0x2ac53b[_0x0404('0x39')]=_0x2ac53b[_0x0404('0x39')][_0x0404('0x3a')]?_0x2ac53b['attributes']:_0x5b2c05[_0x0404('0x33')];if(_0x23ebc7[_0x0404('0x34')]['includeAll']){_0x2ac53b['include']=[{'all':!![]}];}_0x2ac53b=_[_0x0404('0x40')]({},_0x2ac53b,_0x23ebc7[_0x0404('0x43')]);return db[_0x0404('0x2e')][_0x0404('0x49')](_0x2ac53b)['then'](handleEntityNotFound(_0x1d59ba,null))['then'](respondWithResult(_0x1d59ba,null))[_0x0404('0x47')](handleError(_0x1d59ba,null));};exports[_0x0404('0x4a')]=function(_0x3d710e,_0x247cc0){return db[_0x0404('0x2e')]['create'](_0x3d710e[_0x0404('0x4b')],{})[_0x0404('0x26')](respondWithResult(_0x247cc0,0xc9))[_0x0404('0x47')](handleError(_0x247cc0,null));};exports['update']=function(_0x449302,_0x502da1){if(_0x449302[_0x0404('0x4b')]['id']){delete _0x449302['body']['id'];}return db[_0x0404('0x2e')][_0x0404('0x49')]({'where':{'id':_0x449302[_0x0404('0x48')]['id']}})[_0x0404('0x26')](handleEntityNotFound(_0x502da1,null))['then'](saveUpdates(_0x449302[_0x0404('0x4b')],null))[_0x0404('0x26')](respondWithResult(_0x502da1,null))[_0x0404('0x47')](handleError(_0x502da1,null));};exports[_0x0404('0x27')]=function(_0x436337,_0x1b0f3f){return db[_0x0404('0x2e')][_0x0404('0x49')]({'where':{'id':_0x436337['params']['id']}})['then'](handleEntityNotFound(_0x1b0f3f,null))[_0x0404('0x26')](removeEntity(_0x1b0f3f,null))[_0x0404('0x47')](handleError(_0x1b0f3f,null));};exports[_0x0404('0x4c')]=function(_0xa51d0,_0x131219,_0x57edd0){var _0x48c9c4={};var _0x42fe84={};var _0x137673;var _0x1eab71;return db['Dynamics365Configuration'][_0x0404('0x4d')]({'where':{'id':_0xa51d0[_0x0404('0x48')]['id']}})[_0x0404('0x26')](handleEntityNotFound(_0x131219,null))[_0x0404('0x26')](function(_0x336f95){if(_0x336f95){_0x137673=_0x336f95;_0x42fe84['model']=_[_0x0404('0x35')](db[_0x0404('0x4e')][_0x0404('0x2f')]);_0x42fe84[_0x0404('0x34')]=_[_0x0404('0x35')](_0xa51d0[_0x0404('0x34')]);_0x42fe84[_0x0404('0x36')]=_[_0x0404('0x37')](_0x42fe84['model'],_0x42fe84[_0x0404('0x34')]);_0x48c9c4['attributes']=_[_0x0404('0x37')](_0x42fe84[_0x0404('0x33')],qs[_0x0404('0x38')](_0xa51d0[_0x0404('0x34')][_0x0404('0x38')]));_0x48c9c4[_0x0404('0x39')]=_0x48c9c4[_0x0404('0x39')]['length']?_0x48c9c4[_0x0404('0x39')]:_0x42fe84['model'];_0x48c9c4[_0x0404('0x3c')]=qs[_0x0404('0x3d')](_0xa51d0[_0x0404('0x34')]['sort']);_0x48c9c4[_0x0404('0x3f')]=qs[_0x0404('0x36')](_[_0x0404('0x3e')](_0xa51d0[_0x0404('0x34')],_0x42fe84[_0x0404('0x36')]));if(_0xa51d0['query'][_0x0404('0x42')]){_0x48c9c4['where']=_[_0x0404('0x40')](_0x48c9c4[_0x0404('0x3f')],{'$or':_[_0x0404('0x2d')](_0x48c9c4[_0x0404('0x39')],function(_0x5b6409){var _0x58a748={};_0x58a748[_0x5b6409]={'$like':'%'+_0xa51d0[_0x0404('0x34')]['filter']+'%'};return _0x58a748;})});}_0x48c9c4=_[_0x0404('0x40')]({},_0x48c9c4,_0xa51d0[_0x0404('0x43')]);return _0x137673[_0x0404('0x4c')](_0x48c9c4);}})[_0x0404('0x26')](function(_0x320cc8){if(_0x320cc8){_0x1eab71=_0x320cc8[_0x0404('0x3a')];if(!_0xa51d0[_0x0404('0x34')][_0x0404('0x4f')]('nolimit')){_0x48c9c4[_0x0404('0x1e')]=qs['limit'](_0xa51d0[_0x0404('0x34')][_0x0404('0x1e')]);_0x48c9c4[_0x0404('0x1b')]=qs['offset'](_0xa51d0[_0x0404('0x34')]['offset']);}return _0x137673[_0x0404('0x4c')](_0x48c9c4);}})['then'](function(_0x3786ab){if(_0x3786ab){return _0x3786ab?{'count':_0x1eab71,'rows':_0x3786ab}:null;}})[_0x0404('0x26')](respondWithResult(_0x131219,null))[_0x0404('0x47')](handleError(_0x131219,null));};exports[_0x0404('0x50')]=function(_0x3a737e,_0x566397,_0xb9e0cd){var _0x13f1b2={};var _0x2a7ba8={};var _0x384470;var _0x255e04;return db[_0x0404('0x2e')]['findOne']({'where':{'id':_0x3a737e['params']['id']}})[_0x0404('0x26')](handleEntityNotFound(_0x566397,null))['then'](function(_0xbf32ac){if(_0xbf32ac){_0x384470=_0xbf32ac;_0x2a7ba8[_0x0404('0x33')]=_[_0x0404('0x35')](db[_0x0404('0x4e')]['rawAttributes']);_0x2a7ba8['query']=_[_0x0404('0x35')](_0x3a737e[_0x0404('0x34')]);_0x2a7ba8[_0x0404('0x36')]=_[_0x0404('0x37')](_0x2a7ba8['model'],_0x2a7ba8[_0x0404('0x34')]);_0x13f1b2[_0x0404('0x39')]=_[_0x0404('0x37')](_0x2a7ba8['model'],qs[_0x0404('0x38')](_0x3a737e['query']['fields']));_0x13f1b2[_0x0404('0x39')]=_0x13f1b2[_0x0404('0x39')]['length']?_0x13f1b2[_0x0404('0x39')]:_0x2a7ba8[_0x0404('0x33')];_0x13f1b2[_0x0404('0x3c')]=qs[_0x0404('0x3d')](_0x3a737e[_0x0404('0x34')][_0x0404('0x3d')]);_0x13f1b2['where']=qs[_0x0404('0x36')](_['pick'](_0x3a737e[_0x0404('0x34')],_0x2a7ba8[_0x0404('0x36')]));if(_0x3a737e[_0x0404('0x34')][_0x0404('0x42')]){_0x13f1b2[_0x0404('0x3f')]=_[_0x0404('0x40')](_0x13f1b2[_0x0404('0x3f')],{'$or':_[_0x0404('0x2d')](_0x13f1b2['attributes'],function(_0x12c37b){var _0x6af865={};_0x6af865[_0x12c37b]={'$like':'%'+_0x3a737e[_0x0404('0x34')][_0x0404('0x42')]+'%'};return _0x6af865;})});}_0x13f1b2=_[_0x0404('0x40')]({},_0x13f1b2,_0x3a737e[_0x0404('0x43')]);return _0x384470[_0x0404('0x50')](_0x13f1b2);}})[_0x0404('0x26')](function(_0x501de0){if(_0x501de0){_0x255e04=_0x501de0['length'];if(!_0x3a737e[_0x0404('0x34')]['hasOwnProperty'](_0x0404('0x3b'))){_0x13f1b2[_0x0404('0x1e')]=qs[_0x0404('0x1e')](_0x3a737e[_0x0404('0x34')][_0x0404('0x1e')]);_0x13f1b2[_0x0404('0x1b')]=qs[_0x0404('0x1b')](_0x3a737e[_0x0404('0x34')][_0x0404('0x1b')]);}return _0x384470[_0x0404('0x50')](_0x13f1b2);}})[_0x0404('0x26')](function(_0x1b3929){if(_0x1b3929){return _0x1b3929?{'count':_0x255e04,'rows':_0x1b3929}:null;}})[_0x0404('0x26')](respondWithResult(_0x566397,null))[_0x0404('0x47')](handleError(_0x566397,null));};exports[_0x0404('0x51')]=function(_0x39e1fa,_0x466f90,_0x3d91ec){var _0x233b20={};var _0x37adb3={};var _0x35af53;var _0xb16dc7;return db[_0x0404('0x2e')][_0x0404('0x4d')]({'where':{'id':_0x39e1fa['params']['id']}})[_0x0404('0x26')](handleEntityNotFound(_0x466f90,null))[_0x0404('0x26')](function(_0x2b8a69){if(_0x2b8a69){_0x35af53=_0x2b8a69;_0x37adb3[_0x0404('0x33')]=_[_0x0404('0x35')](db[_0x0404('0x4e')]['rawAttributes']);_0x37adb3[_0x0404('0x34')]=_[_0x0404('0x35')](_0x39e1fa[_0x0404('0x34')]);_0x37adb3[_0x0404('0x36')]=_[_0x0404('0x37')](_0x37adb3[_0x0404('0x33')],_0x37adb3['query']);_0x233b20[_0x0404('0x39')]=_[_0x0404('0x37')](_0x37adb3['model'],qs[_0x0404('0x38')](_0x39e1fa[_0x0404('0x34')]['fields']));_0x233b20[_0x0404('0x39')]=_0x233b20[_0x0404('0x39')][_0x0404('0x3a')]?_0x233b20[_0x0404('0x39')]:_0x37adb3['model'];_0x233b20[_0x0404('0x3c')]=qs[_0x0404('0x3d')](_0x39e1fa[_0x0404('0x34')][_0x0404('0x3d')]);_0x233b20[_0x0404('0x3f')]=qs[_0x0404('0x36')](_[_0x0404('0x3e')](_0x39e1fa[_0x0404('0x34')],_0x37adb3['filters']));if(_0x39e1fa[_0x0404('0x34')][_0x0404('0x42')]){_0x233b20[_0x0404('0x3f')]=_[_0x0404('0x40')](_0x233b20[_0x0404('0x3f')],{'$or':_['map'](_0x233b20[_0x0404('0x39')],function(_0x486342){var _0x533234={};_0x533234[_0x486342]={'$like':'%'+_0x39e1fa['query'][_0x0404('0x42')]+'%'};return _0x533234;})});}_0x233b20=_['merge']({},_0x233b20,_0x39e1fa[_0x0404('0x43')]);return _0x35af53[_0x0404('0x51')](_0x233b20);}})[_0x0404('0x26')](function(_0x126ceb){if(_0x126ceb){_0xb16dc7=_0x126ceb[_0x0404('0x3a')];if(!_0x39e1fa[_0x0404('0x34')][_0x0404('0x4f')]('nolimit')){_0x233b20[_0x0404('0x1e')]=qs['limit'](_0x39e1fa[_0x0404('0x34')][_0x0404('0x1e')]);_0x233b20['offset']=qs[_0x0404('0x1b')](_0x39e1fa['query'][_0x0404('0x1b')]);}return _0x35af53[_0x0404('0x51')](_0x233b20);}})[_0x0404('0x26')](function(_0x1cc4d8){if(_0x1cc4d8){return _0x1cc4d8?{'count':_0xb16dc7,'rows':_0x1cc4d8}:null;}})[_0x0404('0x26')](respondWithResult(_0x466f90,null))[_0x0404('0x47')](handleError(_0x466f90,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 6298707..62abd18 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 _0xa9e0=['../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x59dc9e,_0x10cf0e){var _0x543383=function(_0x58d74d){while(--_0x58d74d){_0x59dc9e['push'](_0x59dc9e['shift']());}};_0x543383(++_0x10cf0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['request-promise','path','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','../../config/logger','api','moment','bluebird'];(function(_0x870bbb,_0x150783){var _0x286d46=function(_0x33b524){while(--_0x33b524){_0x870bbb['push'](_0x870bbb['shift']());}};_0x286d46(++_0x150783);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 62a8b9c..4300ce0 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 _0x4bf8=['http','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','code','Dynamics365Configuration,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x205fa0,_0xb2bca8){var _0x3b9b23=function(_0x5629bb){while(--_0x5629bb){_0x205fa0['push'](_0x205fa0['shift']());}};_0x3b9b23(++_0xb2bca8);}(_0x4bf8,0x1ef));var _0x84bf=function(_0x4a57d5,_0x5e7093){_0x4a57d5=_0x4a57d5-0x0;var _0x2e210a=_0x4bf8[_0x4a57d5];return _0x2e210a;};'use strict';var _=require(_0x84bf('0x0'));var util=require('util');var moment=require(_0x84bf('0x1'));var BPromise=require(_0x84bf('0x2'));var rs=require(_0x84bf('0x3'));var fs=require('fs');var Redis=require(_0x84bf('0x4'));var db=require(_0x84bf('0x5'))['db'];var utils=require(_0x84bf('0x6'));var logger=require(_0x84bf('0x7'))(_0x84bf('0x8'));var config=require(_0x84bf('0x9'));var jayson=require(_0x84bf('0xa'));var client=jayson['client'][_0x84bf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x403412,_0x57149f,_0x2ef1d8){return new BPromise(function(_0x240335,_0x402594){return client['request'](_0x403412,_0x2ef1d8)['then'](function(_0x452ce1){logger[_0x84bf('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x57149f,_0x84bf('0xd'));logger[_0x84bf('0xe')](_0x84bf('0xf'),_0x57149f,'request\x20sent',JSON['stringify'](_0x452ce1));if(_0x452ce1['error']){if(_0x452ce1['error'][_0x84bf('0x10')]===0x1f4){logger['error'](_0x84bf('0x11'),_0x57149f,_0x452ce1[_0x84bf('0x12')][_0x84bf('0x13')]);return _0x402594(_0x452ce1[_0x84bf('0x12')][_0x84bf('0x13')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x57149f,_0x452ce1['error'][_0x84bf('0x13')]);return _0x240335(_0x452ce1[_0x84bf('0x12')][_0x84bf('0x13')]);}else{logger[_0x84bf('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x57149f,_0x84bf('0xd'));_0x240335(_0x452ce1[_0x84bf('0x14')][_0x84bf('0x13')]);}})[_0x84bf('0x15')](function(_0x30a157){logger[_0x84bf('0x12')](_0x84bf('0x11'),_0x57149f,_0x30a157);_0x402594(_0x30a157);});});} \ No newline at end of file +var _0xd4ef=['request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x332f0c,_0x5a2094){var _0x358da8=function(_0x42bf8e){while(--_0x42bf8e){_0x332f0c['push'](_0x332f0c['shift']());}};_0x358da8(++_0x5a2094);}(_0xd4ef,0x1ef));var _0xfd4e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4ef[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfd4e('0x0'));var util=require(_0xfd4e('0x1'));var moment=require(_0xfd4e('0x2'));var BPromise=require(_0xfd4e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfd4e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd4e('0x5'));var logger=require(_0xfd4e('0x6'))(_0xfd4e('0x7'));var config=require(_0xfd4e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfd4e('0x9')][_0xfd4e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34185e,_0x4a10a6,_0x29ad59){return new BPromise(function(_0x4f1615,_0x170b99){return client[_0xfd4e('0xb')](_0x34185e,_0x29ad59)['then'](function(_0x4147a7){logger[_0xfd4e('0xc')](_0xfd4e('0xd'),_0x4a10a6,_0xfd4e('0xe'));logger['debug'](_0xfd4e('0xf'),_0x4a10a6,'request\x20sent',JSON[_0xfd4e('0x10')](_0x4147a7));if(_0x4147a7[_0xfd4e('0x11')]){if(_0x4147a7['error'][_0xfd4e('0x12')]===0x1f4){logger['error'](_0xfd4e('0xd'),_0x4a10a6,_0x4147a7[_0xfd4e('0x11')][_0xfd4e('0x13')]);return _0x170b99(_0x4147a7[_0xfd4e('0x11')][_0xfd4e('0x13')]);}logger[_0xfd4e('0x11')](_0xfd4e('0xd'),_0x4a10a6,_0x4147a7[_0xfd4e('0x11')][_0xfd4e('0x13')]);return _0x4f1615(_0x4147a7[_0xfd4e('0x11')][_0xfd4e('0x13')]);}else{logger[_0xfd4e('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4a10a6,_0xfd4e('0xe'));_0x4f1615(_0x4147a7[_0xfd4e('0x14')]['message']);}})[_0xfd4e('0x15')](function(_0x5ddfb0){logger['error'](_0xfd4e('0xd'),_0x4a10a6,_0x5ddfb0);_0x170b99(_0x5ddfb0);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 52ffbe6..8599b37 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 _0xb288=['fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','index','/:id','isAuthenticated','show','post','create','delete','destroy','util','path','connect-timeout','express','Router'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb288,0x1f3));var _0x8b28=function(_0x440a3d,_0x2ae549){_0x440a3d=_0x440a3d-0x0;var _0x4d56c6=_0xb288[_0x440a3d];return _0x4d56c6;};'use strict';var multer=require('multer');var util=require(_0x8b28('0x0'));var path=require(_0x8b28('0x1'));var timeout=require(_0x8b28('0x2'));var express=require(_0x8b28('0x3'));var router=express[_0x8b28('0x4')]();var fs_extra=require(_0x8b28('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b28('0x6'));var config=require(_0x8b28('0x7'));var controller=require(_0x8b28('0x8'));router[_0x8b28('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b28('0xa')]);router['get'](_0x8b28('0xb'),auth[_0x8b28('0xc')](),controller[_0x8b28('0xd')]);router[_0x8b28('0xe')]('/',auth[_0x8b28('0xc')](),controller[_0x8b28('0xf')]);router['put']('/:id',auth[_0x8b28('0xc')](),controller['update']);router[_0x8b28('0x10')](_0x8b28('0xb'),auth[_0x8b28('0xc')](),controller[_0x8b28('0x11')]);module['exports']=router; \ No newline at end of file +var _0xb6b1=['/:id','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x417774,_0x1b95e6){var _0x10015d=function(_0x2526b3){while(--_0x2526b3){_0x417774['push'](_0x417774['shift']());}};_0x10015d(++_0x1b95e6);}(_0xb6b1,0x15c));var _0x1b6b=function(_0x478c8a,_0x9afc92){_0x478c8a=_0x478c8a-0x0;var _0x3b6b3e=_0xb6b1[_0x478c8a];return _0x3b6b3e;};'use strict';var multer=require(_0x1b6b('0x0'));var util=require(_0x1b6b('0x1'));var path=require(_0x1b6b('0x2'));var timeout=require(_0x1b6b('0x3'));var express=require(_0x1b6b('0x4'));var router=express[_0x1b6b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1b6b('0x6'));var interaction=require(_0x1b6b('0x7'));var config=require(_0x1b6b('0x8'));var controller=require('./intDynamics365Field.controller');router[_0x1b6b('0x9')]('/',auth[_0x1b6b('0xa')](),controller[_0x1b6b('0xb')]);router[_0x1b6b('0x9')](_0x1b6b('0xc'),auth[_0x1b6b('0xa')](),controller['show']);router[_0x1b6b('0xd')]('/',auth['isAuthenticated'](),controller[_0x1b6b('0xe')]);router[_0x1b6b('0xf')](_0x1b6b('0xc'),auth[_0x1b6b('0xa')](),controller['update']);router[_0x1b6b('0x10')](_0x1b6b('0xc'),auth[_0x1b6b('0xa')](),controller['destroy']);module[_0x1b6b('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 199ec14..caafcb4 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 _0x0aef=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x163ba5,_0x17d024){var _0x14ee35=function(_0x591859){while(--_0x591859){_0x163ba5['push'](_0x163ba5['shift']());}};_0x14ee35(++_0x17d024);}(_0x0aef,0x1c8));var _0xf0ae=function(_0x43149d,_0x1a717e){_0x43149d=_0x43149d-0x0;var _0x4d4203=_0x0aef[_0x43149d];return _0x4d4203;};'use strict';var Sequelize=require(_0xf0ae('0x0'));module[_0xf0ae('0x1')]={'type':{'type':Sequelize[_0xf0ae('0x2')](_0xf0ae('0x3'),_0xf0ae('0x4'),_0xf0ae('0x5'),_0xf0ae('0x6'),_0xf0ae('0x7')),'defaultValue':_0xf0ae('0x3')},'content':{'type':Sequelize[_0xf0ae('0x8')]},'key':{'type':Sequelize[_0xf0ae('0x8')]},'keyType':{'type':Sequelize[_0xf0ae('0x2')](_0xf0ae('0x3'),_0xf0ae('0x4'),_0xf0ae('0x5'))},'keyContent':{'type':Sequelize[_0xf0ae('0x8')]},'idField':{'type':Sequelize[_0xf0ae('0x8')]},'nameField':{'type':Sequelize[_0xf0ae('0x8')]},'customField':{'type':Sequelize[_0xf0ae('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf0ae('0x8')]}}; \ No newline at end of file +var _0x43b1=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x43b1,0x195));var _0x143b=function(_0x42b025,_0x45a093){_0x42b025=_0x42b025-0x0;var _0x57d38e=_0x43b1[_0x42b025];return _0x57d38e;};'use strict';var Sequelize=require(_0x143b('0x0'));module[_0x143b('0x1')]={'type':{'type':Sequelize[_0x143b('0x2')](_0x143b('0x3'),_0x143b('0x4'),_0x143b('0x5'),_0x143b('0x6'),'picklist'),'defaultValue':_0x143b('0x3')},'content':{'type':Sequelize[_0x143b('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x143b('0x2')](_0x143b('0x3'),_0x143b('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x143b('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x143b('0x7')]},'customField':{'type':Sequelize[_0x143b('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 caaeb02..4e5fd86 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 _0x6786=['bluebird','util','sox','to-csv','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/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','reject','save','update','then','error','stack','name','send','index','map','Dynamics365Field','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','catch','options','find','create','body','destroy','params','rimraf','zip-dir','request-promise','moment'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x6786,0x114));var _0x6678=function(_0x4e0359,_0x205155){_0x4e0359=_0x4e0359-0x0;var _0x450f0a=_0x6786[_0x4e0359];return _0x450f0a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6678('0x0'));var zipdir=require(_0x6678('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6678('0x2'));var moment=require(_0x6678('0x3'));var BPromise=require(_0x6678('0x4'));var Mustache=require('mustache');var util=require(_0x6678('0x5'));var path=require('path');var sox=require(_0x6678('0x6'));var csv=require(_0x6678('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6678('0x8'));var squel=require('squel');var crypto=require(_0x6678('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x6678('0xa'));var toCsv=require(_0x6678('0x7'));var querystring=require(_0x6678('0xb'));var Papa=require(_0x6678('0xc'));var Redis=require(_0x6678('0xd'));var authService=require(_0x6678('0xe'));var qs=require(_0x6678('0xf'));var as=require(_0x6678('0x10'));var hardwareService=require(_0x6678('0x11'));var logger=require(_0x6678('0x12'))(_0x6678('0x13'));var utils=require(_0x6678('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6678('0x15'));var db=require(_0x6678('0x16'))['db'];function respondWithStatusCode(_0x2d71c4,_0xf99f9c){_0xf99f9c=_0xf99f9c||0xcc;return function(_0x4a505d){if(_0x4a505d){return _0x2d71c4[_0x6678('0x17')](_0xf99f9c);}return _0x2d71c4[_0x6678('0x18')](_0xf99f9c)[_0x6678('0x19')]();};}function respondWithResult(_0x585d90,_0x4b45bf){_0x4b45bf=_0x4b45bf||0xc8;return function(_0x4c0a7f){if(_0x4c0a7f){return _0x585d90[_0x6678('0x18')](_0x4b45bf)[_0x6678('0x1a')](_0x4c0a7f);}};}function respondWithFilteredResult(_0x1fd1f6,_0x376e0b){return function(_0x5d7e9f){if(_0x5d7e9f){var _0x1ff7be=typeof _0x376e0b['offset']===_0x6678('0x1b')&&typeof _0x376e0b[_0x6678('0x1c')]===_0x6678('0x1b');var _0x46ae15=_0x5d7e9f['count'];var _0x401623=_0x1ff7be?0x0:_0x376e0b['offset'];var _0x361668=_0x1ff7be?_0x5d7e9f[_0x6678('0x1d')]:_0x376e0b['offset']+_0x376e0b[_0x6678('0x1c')];var _0x29344f;if(_0x361668>=_0x46ae15){_0x361668=_0x46ae15;_0x29344f=0xc8;}else{_0x29344f=0xce;}_0x1fd1f6[_0x6678('0x18')](_0x29344f);return _0x1fd1f6[_0x6678('0x1e')]('Content-Range',_0x401623+'-'+_0x361668+'/'+_0x46ae15)[_0x6678('0x1a')](_0x5d7e9f);}return null;};}function patchUpdates(_0x3a3e10){return function(_0x166d5f){try{jsonpatch['apply'](_0x166d5f,_0x3a3e10,!![]);}catch(_0x120641){return BPromise[_0x6678('0x1f')](_0x120641);}return _0x166d5f[_0x6678('0x20')]();};}function saveUpdates(_0x39a5fa,_0x4dad60){return function(_0x2ec066){if(_0x2ec066){return _0x2ec066[_0x6678('0x21')](_0x39a5fa)[_0x6678('0x22')](function(_0x1abbab){return _0x1abbab;});}return null;};}function removeEntity(_0x330c6b,_0x18ae13){return function(_0x5d6994){if(_0x5d6994){return _0x5d6994['destroy']()['then'](function(){_0x330c6b[_0x6678('0x18')](0xcc)[_0x6678('0x19')]();});}};}function handleEntityNotFound(_0x188f21,_0x57849a){return function(_0x5ef5aa){if(!_0x5ef5aa){_0x188f21[_0x6678('0x17')](0x194);}return _0x5ef5aa;};}function handleError(_0x282493,_0x551f68){_0x551f68=_0x551f68||0x1f4;return function(_0x2dd8b8){logger[_0x6678('0x23')](_0x2dd8b8[_0x6678('0x24')]);if(_0x2dd8b8['name']){delete _0x2dd8b8[_0x6678('0x25')];}_0x282493[_0x6678('0x18')](_0x551f68)[_0x6678('0x26')](_0x2dd8b8);};}exports[_0x6678('0x27')]=function(_0x1e224f,_0x383437){var _0x3ca4e4={},_0x116ba2={},_0xdca249={'count':0x0,'rows':[]};var _0x3680a6=_[_0x6678('0x28')](db[_0x6678('0x29')]['rawAttributes'],function(_0x5c4f05){return{'name':_0x5c4f05['fieldName'],'type':_0x5c4f05[_0x6678('0x2a')][_0x6678('0x2b')]};});_0x116ba2[_0x6678('0x2c')]=_['map'](_0x3680a6,'name');_0x116ba2['query']=_['keys'](_0x1e224f[_0x6678('0x2d')]);_0x116ba2[_0x6678('0x2e')]=_[_0x6678('0x2f')](_0x116ba2[_0x6678('0x2c')],_0x116ba2['query']);_0x3ca4e4[_0x6678('0x30')]=_['intersection'](_0x116ba2[_0x6678('0x2c')],qs[_0x6678('0x31')](_0x1e224f[_0x6678('0x2d')][_0x6678('0x31')]));_0x3ca4e4[_0x6678('0x30')]=_0x3ca4e4['attributes'][_0x6678('0x32')]?_0x3ca4e4[_0x6678('0x30')]:_0x116ba2[_0x6678('0x2c')];if(!_0x1e224f[_0x6678('0x2d')][_0x6678('0x33')](_0x6678('0x34'))){_0x3ca4e4['limit']=qs['limit'](_0x1e224f['query']['limit']);_0x3ca4e4['offset']=qs[_0x6678('0x35')](_0x1e224f[_0x6678('0x2d')][_0x6678('0x35')]);}_0x3ca4e4[_0x6678('0x36')]=qs[_0x6678('0x37')](_0x1e224f[_0x6678('0x2d')][_0x6678('0x37')]);_0x3ca4e4[_0x6678('0x38')]=qs[_0x6678('0x2e')](_['pick'](_0x1e224f[_0x6678('0x2d')],_0x116ba2[_0x6678('0x2e')]),_0x3680a6);if(_0x1e224f[_0x6678('0x2d')][_0x6678('0x39')]){_0x3ca4e4[_0x6678('0x38')]=_['merge'](_0x3ca4e4['where'],{'$or':_[_0x6678('0x28')](_0x3680a6,function(_0x4eccef){if(_0x4eccef[_0x6678('0x2a')]!==_0x6678('0x3a')){var _0xdb508={};_0xdb508[_0x4eccef[_0x6678('0x25')]]={'$like':'%'+_0x1e224f['query'][_0x6678('0x39')]+'%'};return _0xdb508;}})});}_0x3ca4e4=_[_0x6678('0x3b')]({},_0x3ca4e4,_0x1e224f['options']);var _0x625118={'where':_0x3ca4e4['where']};return db['Dynamics365Field'][_0x6678('0x1d')](_0x625118)['then'](function(_0x2e9b59){_0xdca249[_0x6678('0x1d')]=_0x2e9b59;if(_0x1e224f[_0x6678('0x2d')][_0x6678('0x3c')]){_0x3ca4e4[_0x6678('0x3d')]=[{'all':!![]}];}return db[_0x6678('0x29')][_0x6678('0x3e')](_0x3ca4e4);})[_0x6678('0x22')](function(_0x43c0d0){_0xdca249['rows']=_0x43c0d0;return _0xdca249;})['then'](respondWithFilteredResult(_0x383437,_0x3ca4e4))[_0x6678('0x3f')](handleError(_0x383437,null));};exports['show']=function(_0x4effab,_0x40984a){var _0x2d7f8f={'raw':!![],'where':{'id':_0x4effab['params']['id']}},_0x455fa5={};_0x455fa5['model']=_['keys'](db[_0x6678('0x29')]['rawAttributes']);_0x455fa5['query']=_['keys'](_0x4effab['query']);_0x455fa5['filters']=_[_0x6678('0x2f')](_0x455fa5[_0x6678('0x2c')],_0x455fa5[_0x6678('0x2d')]);_0x2d7f8f[_0x6678('0x30')]=_[_0x6678('0x2f')](_0x455fa5['model'],qs[_0x6678('0x31')](_0x4effab[_0x6678('0x2d')][_0x6678('0x31')]));_0x2d7f8f[_0x6678('0x30')]=_0x2d7f8f['attributes'][_0x6678('0x32')]?_0x2d7f8f['attributes']:_0x455fa5['model'];if(_0x4effab[_0x6678('0x2d')][_0x6678('0x3c')]){_0x2d7f8f[_0x6678('0x3d')]=[{'all':!![]}];}_0x2d7f8f=_['merge']({},_0x2d7f8f,_0x4effab[_0x6678('0x40')]);return db[_0x6678('0x29')][_0x6678('0x41')](_0x2d7f8f)['then'](handleEntityNotFound(_0x40984a,null))[_0x6678('0x22')](respondWithResult(_0x40984a,null))['catch'](handleError(_0x40984a,null));};exports[_0x6678('0x42')]=function(_0x214ca6,_0x587db2){return db[_0x6678('0x29')][_0x6678('0x42')](_0x214ca6[_0x6678('0x43')],{})['then'](respondWithResult(_0x587db2,0xc9))['catch'](handleError(_0x587db2,null));};exports[_0x6678('0x21')]=function(_0x53f983,_0x9a2b22){if(_0x53f983[_0x6678('0x43')]['id']){delete _0x53f983[_0x6678('0x43')]['id'];}return db[_0x6678('0x29')]['find']({'where':{'id':_0x53f983['params']['id']}})['then'](handleEntityNotFound(_0x9a2b22,null))['then'](saveUpdates(_0x53f983[_0x6678('0x43')],null))[_0x6678('0x22')](respondWithResult(_0x9a2b22,null))[_0x6678('0x3f')](handleError(_0x9a2b22,null));};exports[_0x6678('0x44')]=function(_0x3003e2,_0x156fbe){return db[_0x6678('0x29')][_0x6678('0x41')]({'where':{'id':_0x3003e2[_0x6678('0x45')]['id']}})['then'](handleEntityNotFound(_0x156fbe,null))[_0x6678('0x22')](removeEntity(_0x156fbe,null))[_0x6678('0x3f')](handleError(_0x156fbe,null));}; \ No newline at end of file +var _0xc49b=['rows','catch','show','params','keys','create','update','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include'];(function(_0xf9286a,_0x495e5b){var _0x1de149=function(_0x338c92){while(--_0x338c92){_0xf9286a['push'](_0xf9286a['shift']());}};_0x1de149(++_0x495e5b);}(_0xc49b,0xea));var _0xbc49=function(_0x1bfc87,_0x3ce263){_0x1bfc87=_0x1bfc87-0x0;var _0x55e028=_0xc49b[_0x1bfc87];return _0x55e028;};'use strict';var emlformat=require(_0xbc49('0x0'));var rimraf=require(_0xbc49('0x1'));var zipdir=require(_0xbc49('0x2'));var jsonpatch=require(_0xbc49('0x3'));var rp=require(_0xbc49('0x4'));var moment=require('moment');var BPromise=require(_0xbc49('0x5'));var Mustache=require('mustache');var util=require(_0xbc49('0x6'));var path=require(_0xbc49('0x7'));var sox=require(_0xbc49('0x8'));var csv=require(_0xbc49('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbc49('0xa'));var squel=require(_0xbc49('0xb'));var crypto=require(_0xbc49('0xc'));var jsforce=require(_0xbc49('0xd'));var deskjs=require(_0xbc49('0xe'));var toCsv=require(_0xbc49('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbc49('0xf'));var authService=require(_0xbc49('0x10'));var qs=require(_0xbc49('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbc49('0x12'));var logger=require('../../config/logger')(_0xbc49('0x13'));var utils=require(_0xbc49('0x14'));var config=require(_0xbc49('0x15'));var licenseUtil=require(_0xbc49('0x16'));var db=require(_0xbc49('0x17'))['db'];function respondWithStatusCode(_0x2f9162,_0x2cd552){_0x2cd552=_0x2cd552||0xcc;return function(_0x2cb75c){if(_0x2cb75c){return _0x2f9162[_0xbc49('0x18')](_0x2cd552);}return _0x2f9162[_0xbc49('0x19')](_0x2cd552)[_0xbc49('0x1a')]();};}function respondWithResult(_0x5815a3,_0x5107dc){_0x5107dc=_0x5107dc||0xc8;return function(_0xebeaed){if(_0xebeaed){return _0x5815a3[_0xbc49('0x19')](_0x5107dc)[_0xbc49('0x1b')](_0xebeaed);}};}function respondWithFilteredResult(_0x2c8d44,_0x388af7){return function(_0x4be08d){if(_0x4be08d){var _0x381c1f=typeof _0x388af7[_0xbc49('0x1c')]===_0xbc49('0x1d')&&typeof _0x388af7[_0xbc49('0x1e')]===_0xbc49('0x1d');var _0x5ca108=_0x4be08d[_0xbc49('0x1f')];var _0x1e57af=_0x381c1f?0x0:_0x388af7[_0xbc49('0x1c')];var _0x26be37=_0x381c1f?_0x4be08d[_0xbc49('0x1f')]:_0x388af7[_0xbc49('0x1c')]+_0x388af7[_0xbc49('0x1e')];var _0x1e2f26;if(_0x26be37>=_0x5ca108){_0x26be37=_0x5ca108;_0x1e2f26=0xc8;}else{_0x1e2f26=0xce;}_0x2c8d44['status'](_0x1e2f26);return _0x2c8d44[_0xbc49('0x20')](_0xbc49('0x21'),_0x1e57af+'-'+_0x26be37+'/'+_0x5ca108)[_0xbc49('0x1b')](_0x4be08d);}return null;};}function patchUpdates(_0xc5723e){return function(_0x54531a){try{jsonpatch['apply'](_0x54531a,_0xc5723e,!![]);}catch(_0x2eadc4){return BPromise[_0xbc49('0x22')](_0x2eadc4);}return _0x54531a['save']();};}function saveUpdates(_0x2a7a19,_0x578cf2){return function(_0x1dc481){if(_0x1dc481){return _0x1dc481['update'](_0x2a7a19)[_0xbc49('0x23')](function(_0x536a80){return _0x536a80;});}return null;};}function removeEntity(_0x384db2,_0x2985fa){return function(_0x2a7859){if(_0x2a7859){return _0x2a7859[_0xbc49('0x24')]()[_0xbc49('0x23')](function(){_0x384db2[_0xbc49('0x19')](0xcc)[_0xbc49('0x1a')]();});}};}function handleEntityNotFound(_0x35c1e3,_0x210a4a){return function(_0x2cf12f){if(!_0x2cf12f){_0x35c1e3[_0xbc49('0x18')](0x194);}return _0x2cf12f;};}function handleError(_0x3b4440,_0x554fe1){_0x554fe1=_0x554fe1||0x1f4;return function(_0x210785){logger[_0xbc49('0x25')](_0x210785[_0xbc49('0x26')]);if(_0x210785[_0xbc49('0x27')]){delete _0x210785[_0xbc49('0x27')];}_0x3b4440[_0xbc49('0x19')](_0x554fe1)[_0xbc49('0x28')](_0x210785);};}exports[_0xbc49('0x29')]=function(_0x8ec7da,_0x1926e0){var _0x33ba96={},_0x3f8e50={},_0x5ba4db={'count':0x0,'rows':[]};var _0x5426dd=_[_0xbc49('0x2a')](db[_0xbc49('0x2b')][_0xbc49('0x2c')],function(_0x19ae09){return{'name':_0x19ae09[_0xbc49('0x2d')],'type':_0x19ae09[_0xbc49('0x2e')][_0xbc49('0x2f')]};});_0x3f8e50[_0xbc49('0x30')]=_[_0xbc49('0x2a')](_0x5426dd,_0xbc49('0x27'));_0x3f8e50[_0xbc49('0x31')]=_['keys'](_0x8ec7da[_0xbc49('0x31')]);_0x3f8e50[_0xbc49('0x32')]=_[_0xbc49('0x33')](_0x3f8e50[_0xbc49('0x30')],_0x3f8e50[_0xbc49('0x31')]);_0x33ba96[_0xbc49('0x34')]=_[_0xbc49('0x33')](_0x3f8e50['model'],qs[_0xbc49('0x35')](_0x8ec7da[_0xbc49('0x31')][_0xbc49('0x35')]));_0x33ba96[_0xbc49('0x34')]=_0x33ba96[_0xbc49('0x34')][_0xbc49('0x36')]?_0x33ba96[_0xbc49('0x34')]:_0x3f8e50[_0xbc49('0x30')];if(!_0x8ec7da[_0xbc49('0x31')][_0xbc49('0x37')](_0xbc49('0x38'))){_0x33ba96['limit']=qs[_0xbc49('0x1e')](_0x8ec7da[_0xbc49('0x31')][_0xbc49('0x1e')]);_0x33ba96['offset']=qs[_0xbc49('0x1c')](_0x8ec7da['query'][_0xbc49('0x1c')]);}_0x33ba96[_0xbc49('0x39')]=qs[_0xbc49('0x3a')](_0x8ec7da[_0xbc49('0x31')][_0xbc49('0x3a')]);_0x33ba96[_0xbc49('0x3b')]=qs[_0xbc49('0x32')](_[_0xbc49('0x3c')](_0x8ec7da[_0xbc49('0x31')],_0x3f8e50[_0xbc49('0x32')]),_0x5426dd);if(_0x8ec7da[_0xbc49('0x31')][_0xbc49('0x3d')]){_0x33ba96[_0xbc49('0x3b')]=_[_0xbc49('0x3e')](_0x33ba96['where'],{'$or':_[_0xbc49('0x2a')](_0x5426dd,function(_0x4f7697){if(_0x4f7697[_0xbc49('0x2e')]!==_0xbc49('0x3f')){var _0x1f579f={};_0x1f579f[_0x4f7697['name']]={'$like':'%'+_0x8ec7da[_0xbc49('0x31')][_0xbc49('0x3d')]+'%'};return _0x1f579f;}})});}_0x33ba96=_[_0xbc49('0x3e')]({},_0x33ba96,_0x8ec7da[_0xbc49('0x40')]);var _0x37c4f4={'where':_0x33ba96[_0xbc49('0x3b')]};return db[_0xbc49('0x2b')][_0xbc49('0x1f')](_0x37c4f4)[_0xbc49('0x23')](function(_0x45d2f1){_0x5ba4db[_0xbc49('0x1f')]=_0x45d2f1;if(_0x8ec7da['query']['includeAll']){_0x33ba96[_0xbc49('0x41')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x33ba96);})[_0xbc49('0x23')](function(_0x19d641){_0x5ba4db[_0xbc49('0x42')]=_0x19d641;return _0x5ba4db;})[_0xbc49('0x23')](respondWithFilteredResult(_0x1926e0,_0x33ba96))[_0xbc49('0x43')](handleError(_0x1926e0,null));};exports[_0xbc49('0x44')]=function(_0x1224aa,_0x4e765b){var _0x4b0164={'raw':!![],'where':{'id':_0x1224aa[_0xbc49('0x45')]['id']}},_0x2bebb8={};_0x2bebb8[_0xbc49('0x30')]=_[_0xbc49('0x46')](db[_0xbc49('0x2b')][_0xbc49('0x2c')]);_0x2bebb8[_0xbc49('0x31')]=_[_0xbc49('0x46')](_0x1224aa[_0xbc49('0x31')]);_0x2bebb8[_0xbc49('0x32')]=_[_0xbc49('0x33')](_0x2bebb8[_0xbc49('0x30')],_0x2bebb8['query']);_0x4b0164['attributes']=_[_0xbc49('0x33')](_0x2bebb8[_0xbc49('0x30')],qs[_0xbc49('0x35')](_0x1224aa[_0xbc49('0x31')][_0xbc49('0x35')]));_0x4b0164[_0xbc49('0x34')]=_0x4b0164[_0xbc49('0x34')][_0xbc49('0x36')]?_0x4b0164[_0xbc49('0x34')]:_0x2bebb8[_0xbc49('0x30')];if(_0x1224aa[_0xbc49('0x31')]['includeAll']){_0x4b0164[_0xbc49('0x41')]=[{'all':!![]}];}_0x4b0164=_[_0xbc49('0x3e')]({},_0x4b0164,_0x1224aa['options']);return db[_0xbc49('0x2b')]['find'](_0x4b0164)['then'](handleEntityNotFound(_0x4e765b,null))[_0xbc49('0x23')](respondWithResult(_0x4e765b,null))[_0xbc49('0x43')](handleError(_0x4e765b,null));};exports[_0xbc49('0x47')]=function(_0x2536b0,_0x1e95fe){return db['Dynamics365Field'][_0xbc49('0x47')](_0x2536b0['body'],{})[_0xbc49('0x23')](respondWithResult(_0x1e95fe,0xc9))[_0xbc49('0x43')](handleError(_0x1e95fe,null));};exports[_0xbc49('0x48')]=function(_0xe0f0fd,_0x244a30){if(_0xe0f0fd[_0xbc49('0x49')]['id']){delete _0xe0f0fd['body']['id'];}return db[_0xbc49('0x2b')]['find']({'where':{'id':_0xe0f0fd[_0xbc49('0x45')]['id']}})[_0xbc49('0x23')](handleEntityNotFound(_0x244a30,null))[_0xbc49('0x23')](saveUpdates(_0xe0f0fd[_0xbc49('0x49')],null))[_0xbc49('0x23')](respondWithResult(_0x244a30,null))[_0xbc49('0x43')](handleError(_0x244a30,null));};exports[_0xbc49('0x24')]=function(_0x3d3fbf,_0x380b11){return db[_0xbc49('0x2b')][_0xbc49('0x4a')]({'where':{'id':_0x3d3fbf[_0xbc49('0x45')]['id']}})[_0xbc49('0x23')](handleEntityNotFound(_0x380b11,null))[_0xbc49('0x23')](removeEntity(_0x380b11,null))[_0xbc49('0x43')](handleError(_0x380b11,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index ef2707b..d73f779 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 _0x302a=['exports','define','Dynamics365Field','int_dynamics365_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x302a,0x1e6));var _0xa302=function(_0x15899b,_0x1c888a){_0x15899b=_0x15899b-0x0;var _0x2383b9=_0x302a[_0x15899b];return _0x2383b9;};'use strict';var _=require(_0xa302('0x0'));var util=require(_0xa302('0x1'));var logger=require(_0xa302('0x2'))(_0xa302('0x3'));var moment=require(_0xa302('0x4'));var BPromise=require('bluebird');var rp=require(_0xa302('0x5'));var fs=require('fs');var path=require(_0xa302('0x6'));var rimraf=require(_0xa302('0x7'));var config=require(_0xa302('0x8'));var attributes=require(_0xa302('0x9'));module[_0xa302('0xa')]=function(_0x2e7699,_0x166c2a){return _0x2e7699[_0xa302('0xb')](_0xa302('0xc'),attributes,{'tableName':_0xa302('0xd'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0xa302('0xe'),_0xa302('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe58d=['FieldId','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','dynamics365_unique_index','idField'];(function(_0x32adea,_0x2d2af2){var _0x14078c=function(_0x109cc1){while(--_0x109cc1){_0x32adea['push'](_0x32adea['shift']());}};_0x14078c(++_0x2d2af2);}(_0xe58d,0xdd));var _0xde58=function(_0x34ab14,_0x228d49){_0x34ab14=_0x34ab14-0x0;var _0x52c36b=_0xe58d[_0x34ab14];return _0x52c36b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xde58('0x0'))('api');var moment=require(_0xde58('0x1'));var BPromise=require(_0xde58('0x2'));var rp=require(_0xde58('0x3'));var fs=require('fs');var path=require(_0xde58('0x4'));var rimraf=require(_0xde58('0x5'));var config=require(_0xde58('0x6'));var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x20f394,_0x48aab5){return _0x20f394[_0xde58('0x7')]('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xde58('0x8'),'fields':[_0xde58('0x9'),_0xde58('0xa')],'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 cabd6a1..2059508 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 _0x58a3=['client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise'];(function(_0x35e3d1,_0x584659){var _0x4943a6=function(_0x33d078){while(--_0x33d078){_0x35e3d1['push'](_0x35e3d1['shift']());}};_0x4943a6(++_0x584659);}(_0x58a3,0x73));var _0x358a=function(_0x39e164,_0x2cb93b){_0x39e164=_0x39e164-0x0;var _0x13fa6b=_0x58a3[_0x39e164];return _0x13fa6b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x358a('0x0'));var rs=require(_0x358a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x358a('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x358a('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x358a('0x4'));var client=jayson[_0x358a('0x5')][_0x358a('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x26612c,_0x44cc3f,_0x64626f){return new BPromise(function(_0x35838e,_0x2508b5){return client[_0x358a('0x7')](_0x26612c,_0x64626f)[_0x358a('0x8')](function(_0x275f7a){logger[_0x358a('0x9')](_0x358a('0xa'),_0x44cc3f,_0x358a('0xb'));logger[_0x358a('0xc')](_0x358a('0xd'),_0x44cc3f,_0x358a('0xb'),JSON[_0x358a('0xe')](_0x275f7a));if(_0x275f7a['error']){if(_0x275f7a['error'][_0x358a('0xf')]===0x1f4){logger[_0x358a('0x10')](_0x358a('0xa'),_0x44cc3f,_0x275f7a[_0x358a('0x10')]['message']);return _0x2508b5(_0x275f7a[_0x358a('0x10')][_0x358a('0x11')]);}logger[_0x358a('0x10')](_0x358a('0xa'),_0x44cc3f,_0x275f7a[_0x358a('0x10')][_0x358a('0x11')]);return _0x35838e(_0x275f7a[_0x358a('0x10')][_0x358a('0x11')]);}else{logger['info'](_0x358a('0xa'),_0x44cc3f,_0x358a('0xb'));_0x35838e(_0x275f7a[_0x358a('0x12')][_0x358a('0x11')]);}})[_0x358a('0x13')](function(_0x595d11){logger[_0x358a('0x10')](_0x358a('0xa'),_0x44cc3f,_0x595d11);_0x2508b5(_0x595d11);});});} \ No newline at end of file +var _0x907d=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x57b913,_0x48b176){var _0x466aaa=function(_0x4df7aa){while(--_0x4df7aa){_0x57b913['push'](_0x57b913['shift']());}};_0x466aaa(++_0x48b176);}(_0x907d,0x182));var _0xd907=function(_0x264d4d,_0x118fb5){_0x264d4d=_0x264d4d-0x0;var _0xc917e2=_0x907d[_0x264d4d];return _0xc917e2;};'use strict';var _=require(_0xd907('0x0'));var util=require(_0xd907('0x1'));var moment=require(_0xd907('0x2'));var BPromise=require(_0xd907('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd907('0x4'));var db=require(_0xd907('0x5'))['db'];var utils=require(_0xd907('0x6'));var logger=require(_0xd907('0x7'))(_0xd907('0x8'));var config=require(_0xd907('0x9'));var jayson=require(_0xd907('0xa'));var client=jayson[_0xd907('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40db4a,_0x1af6b1,_0x269099){return new BPromise(function(_0x262d7f,_0x1c2ebd){return client[_0xd907('0xc')](_0x40db4a,_0x269099)[_0xd907('0xd')](function(_0x51e78b){logger[_0xd907('0xe')](_0xd907('0xf'),_0x1af6b1,_0xd907('0x10'));logger[_0xd907('0x11')](_0xd907('0x12'),_0x1af6b1,_0xd907('0x10'),JSON['stringify'](_0x51e78b));if(_0x51e78b[_0xd907('0x13')]){if(_0x51e78b[_0xd907('0x13')][_0xd907('0x14')]===0x1f4){logger[_0xd907('0x13')](_0xd907('0xf'),_0x1af6b1,_0x51e78b[_0xd907('0x13')][_0xd907('0x15')]);return _0x1c2ebd(_0x51e78b[_0xd907('0x13')][_0xd907('0x15')]);}logger[_0xd907('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x1af6b1,_0x51e78b['error'][_0xd907('0x15')]);return _0x262d7f(_0x51e78b[_0xd907('0x13')][_0xd907('0x15')]);}else{logger[_0xd907('0xe')](_0xd907('0xf'),_0x1af6b1,_0xd907('0x10'));_0x262d7f(_0x51e78b[_0xd907('0x16')][_0xd907('0x15')]);}})[_0xd907('0x17')](function(_0x19271d){logger[_0xd907('0x13')](_0xd907('0xf'),_0x1af6b1,_0x19271d);_0x1c2ebd(_0x19271d);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index ac8e9d2..983160f 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 _0x3c82=['path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util'];(function(_0x4599b6,_0x40c254){var _0x2e014c=function(_0x3c4d90){while(--_0x3c4d90){_0x4599b6['push'](_0x4599b6['shift']());}};_0x2e014c(++_0x40c254);}(_0x3c82,0x157));var _0x23c8=function(_0x28ea86,_0x15dee1){_0x28ea86=_0x28ea86-0x0;var _0x45bf56=_0x3c82[_0x28ea86];return _0x45bf56;};'use strict';var multer=require(_0x23c8('0x0'));var util=require(_0x23c8('0x1'));var path=require(_0x23c8('0x2'));var timeout=require(_0x23c8('0x3'));var express=require(_0x23c8('0x4'));var router=express['Router']();var fs_extra=require(_0x23c8('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x23c8('0x6'));var controller=require('./intFreshdeskAccount.controller');router[_0x23c8('0x7')]('/',auth[_0x23c8('0x8')](),controller[_0x23c8('0x9')]);router[_0x23c8('0x7')](_0x23c8('0xa'),auth[_0x23c8('0x8')](),controller[_0x23c8('0xb')]);router[_0x23c8('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x23c8('0xc')]);router['get'](_0x23c8('0xd'),auth[_0x23c8('0x8')](),controller[_0x23c8('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x23c8('0xf')]);router['post'](_0x23c8('0x10'),auth['isAuthenticated'](),controller[_0x23c8('0x11')]);router[_0x23c8('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x23c8('0x13')]);router[_0x23c8('0x14')]('/:id',auth[_0x23c8('0x8')](),controller[_0x23c8('0x15')]);module[_0x23c8('0x16')]=router; \ No newline at end of file +var _0x28e0=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','update','delete','exports','path','connect-timeout'];(function(_0x38d394,_0xe577e3){var _0x1a5437=function(_0x4753ec){while(--_0x4753ec){_0x38d394['push'](_0x38d394['shift']());}};_0x1a5437(++_0xe577e3);}(_0x28e0,0xae));var _0x028e=function(_0x15e30c,_0x581414){_0x15e30c=_0x15e30c-0x0;var _0x117a37=_0x28e0[_0x15e30c];return _0x117a37;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x028e('0x0'));var timeout=require(_0x028e('0x1'));var express=require(_0x028e('0x2'));var router=express[_0x028e('0x3')]();var fs_extra=require(_0x028e('0x4'));var auth=require(_0x028e('0x5'));var interaction=require(_0x028e('0x6'));var config=require(_0x028e('0x7'));var controller=require(_0x028e('0x8'));router[_0x028e('0x9')]('/',auth[_0x028e('0xa')](),controller['index']);router[_0x028e('0x9')](_0x028e('0xb'),auth[_0x028e('0xa')](),controller[_0x028e('0xc')]);router[_0x028e('0x9')](_0x028e('0xd'),auth[_0x028e('0xa')](),controller[_0x028e('0xe')]);router[_0x028e('0x9')](_0x028e('0xf'),auth[_0x028e('0xa')](),controller['getFields']);router[_0x028e('0x10')]('/',auth[_0x028e('0xa')](),controller[_0x028e('0x11')]);router[_0x028e('0x10')](_0x028e('0xd'),auth[_0x028e('0xa')](),controller['addConfiguration']);router[_0x028e('0x12')](_0x028e('0xb'),auth[_0x028e('0xa')](),controller[_0x028e('0x13')]);router[_0x028e('0x14')](_0x028e('0xb'),auth[_0x028e('0xa')](),controller['destroy']);module[_0x028e('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index b42dc94..f57e473 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 _0xa456=['STRING','username','sequelize','exports'];(function(_0x1b0a9f,_0x49e369){var _0x1c6650=function(_0x2d7335){while(--_0x2d7335){_0x1b0a9f['push'](_0x1b0a9f['shift']());}};_0x1c6650(++_0x49e369);}(_0xa456,0x142));var _0x6a45=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0xa456[_0x476bf4];return _0x788ffe;};'use strict';var Sequelize=require(_0x6a45('0x0'));module[_0x6a45('0x1')]={'name':{'type':Sequelize[_0x6a45('0x2')]},'description':{'type':Sequelize[_0x6a45('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x6a45('0x3')},'apiKey':{'type':Sequelize[_0x6a45('0x2')]},'remoteUri':{'type':Sequelize[_0x6a45('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x6a45('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xd7d1=['sequelize','exports','STRING','username','remoteUri'];(function(_0x7b575e,_0x12dc3e){var _0x5a03e3=function(_0x5e25ff){while(--_0x5e25ff){_0x7b575e['push'](_0x7b575e['shift']());}};_0x5a03e3(++_0x12dc3e);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x197570,_0x5632eb){_0x197570=_0x197570-0x0;var _0x169a97=_0xd7d1[_0x197570];return _0x169a97;};'use strict';var Sequelize=require(_0x1d7d('0x0'));module[_0x1d7d('0x1')]={'name':{'type':Sequelize[_0x1d7d('0x2')]},'description':{'type':Sequelize[_0x1d7d('0x2')]},'username':{'type':Sequelize[_0x1d7d('0x2')],'unique':_0x1d7d('0x3')},'apiKey':{'type':Sequelize[_0x1d7d('0x2')]},'remoteUri':{'type':Sequelize[_0x1d7d('0x2')],'unique':_0x1d7d('0x4')},'serverUrl':{'type':Sequelize[_0x1d7d('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 35a5b7c..5761291 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 _0xb299=['attributes','model','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','catch','show','params','keys','create','find','getConfigurations','findOne','FreshdeskConfiguration','nolimit','addConfiguration','body','Subjects','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','remoteUri','apiKey','slice','substring','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','agent','group','source','ticket_type','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../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','reject','save','update','then','error','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','intersection','query'];(function(_0x35ea6b,_0x191de4){var _0x1fae2a=function(_0x4b8432){while(--_0x4b8432){_0x35ea6b['push'](_0x35ea6b['shift']());}};_0x1fae2a(++_0x191de4);}(_0xb299,0x19b));var _0x9b29=function(_0x17c6b3,_0x2e2f27){_0x17c6b3=_0x17c6b3-0x0;var _0x26d493=_0xb299[_0x17c6b3];return _0x26d493;};'use strict';var emlformat=require(_0x9b29('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9b29('0x1'));var jsonpatch=require(_0x9b29('0x2'));var rp=require(_0x9b29('0x3'));var moment=require(_0x9b29('0x4'));var BPromise=require(_0x9b29('0x5'));var Mustache=require(_0x9b29('0x6'));var util=require(_0x9b29('0x7'));var path=require('path');var sox=require(_0x9b29('0x8'));var csv=require(_0x9b29('0x9'));var ejs=require(_0x9b29('0xa'));var fs=require('fs');var fs_extra=require(_0x9b29('0xb'));var _=require(_0x9b29('0xc'));var squel=require(_0x9b29('0xd'));var crypto=require(_0x9b29('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9b29('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9b29('0x10'));var Redis=require(_0x9b29('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9b29('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9b29('0x13'));var logger=require(_0x9b29('0x14'))(_0x9b29('0x15'));var utils=require('../../config/utils');var config=require(_0x9b29('0x16'));var licenseUtil=require(_0x9b29('0x17'));var db=require(_0x9b29('0x18'))['db'];var integrations=require(_0x9b29('0x19'));function respondWithStatusCode(_0x35da05,_0x353308){_0x353308=_0x353308||0xcc;return function(_0x2479a2){if(_0x2479a2){return _0x35da05[_0x9b29('0x1a')](_0x353308);}return _0x35da05[_0x9b29('0x1b')](_0x353308)[_0x9b29('0x1c')]();};}function respondWithResult(_0x370f86,_0x292a5f){_0x292a5f=_0x292a5f||0xc8;return function(_0x355806){if(_0x355806){return _0x370f86[_0x9b29('0x1b')](_0x292a5f)[_0x9b29('0x1d')](_0x355806);}};}function respondWithFilteredResult(_0x2e5976,_0x4773c3){return function(_0x45b857){if(_0x45b857){var _0x31d9a1=typeof _0x4773c3[_0x9b29('0x1e')]===_0x9b29('0x1f')&&typeof _0x4773c3[_0x9b29('0x20')]==='undefined';var _0x48d3b4=_0x45b857['count'];var _0xf8967d=_0x31d9a1?0x0:_0x4773c3[_0x9b29('0x1e')];var _0x24d45d=_0x31d9a1?_0x45b857[_0x9b29('0x21')]:_0x4773c3[_0x9b29('0x1e')]+_0x4773c3[_0x9b29('0x20')];var _0x12c2e4;if(_0x24d45d>=_0x48d3b4){_0x24d45d=_0x48d3b4;_0x12c2e4=0xc8;}else{_0x12c2e4=0xce;}_0x2e5976[_0x9b29('0x1b')](_0x12c2e4);return _0x2e5976[_0x9b29('0x22')](_0x9b29('0x23'),_0xf8967d+'-'+_0x24d45d+'/'+_0x48d3b4)['json'](_0x45b857);}return null;};}function patchUpdates(_0x598d3f){return function(_0xdebf3e){try{jsonpatch[_0x9b29('0x24')](_0xdebf3e,_0x598d3f,!![]);}catch(_0x7b8615){return BPromise[_0x9b29('0x25')](_0x7b8615);}return _0xdebf3e[_0x9b29('0x26')]();};}function saveUpdates(_0x389f27,_0x90a182){return function(_0x3ab389){if(_0x3ab389){return _0x3ab389[_0x9b29('0x27')](_0x389f27)[_0x9b29('0x28')](function(_0x4802f7){return _0x4802f7;});}return null;};}function removeEntity(_0x1d6743,_0x1861a4){return function(_0xeebf6c){if(_0xeebf6c){return _0xeebf6c['destroy']()[_0x9b29('0x28')](function(){_0x1d6743['status'](0xcc)[_0x9b29('0x1c')]();});}};}function handleEntityNotFound(_0x3d05fc,_0x48b85d){return function(_0x4ef61f){if(!_0x4ef61f){_0x3d05fc[_0x9b29('0x1a')](0x194);}return _0x4ef61f;};}function handleError(_0x405f2d,_0x50ea3d){_0x50ea3d=_0x50ea3d||0x1f4;return function(_0x3fa7b6){logger[_0x9b29('0x29')](_0x3fa7b6['stack']);if(_0x3fa7b6[_0x9b29('0x2a')]){delete _0x3fa7b6[_0x9b29('0x2a')];}_0x405f2d[_0x9b29('0x1b')](_0x50ea3d)[_0x9b29('0x2b')](_0x3fa7b6);};}exports[_0x9b29('0x2c')]=function(_0x49025f,_0x25a000){var _0x3cee24={},_0x36fb08={},_0x386c65={'count':0x0,'rows':[]};var _0x512e71=_[_0x9b29('0x2d')](db[_0x9b29('0x2e')][_0x9b29('0x2f')],function(_0x2fe6a5){return{'name':_0x2fe6a5[_0x9b29('0x30')],'type':_0x2fe6a5[_0x9b29('0x31')][_0x9b29('0x32')]};});_0x36fb08['model']=_[_0x9b29('0x2d')](_0x512e71,_0x9b29('0x2a'));_0x36fb08['query']=_['keys'](_0x49025f['query']);_0x36fb08['filters']=_[_0x9b29('0x33')](_0x36fb08['model'],_0x36fb08[_0x9b29('0x34')]);_0x3cee24[_0x9b29('0x35')]=_[_0x9b29('0x33')](_0x36fb08[_0x9b29('0x36')],qs[_0x9b29('0x37')](_0x49025f[_0x9b29('0x34')][_0x9b29('0x37')]));_0x3cee24['attributes']=_0x3cee24['attributes'][_0x9b29('0x38')]?_0x3cee24[_0x9b29('0x35')]:_0x36fb08[_0x9b29('0x36')];if(!_0x49025f[_0x9b29('0x34')][_0x9b29('0x39')]('nolimit')){_0x3cee24[_0x9b29('0x20')]=qs['limit'](_0x49025f['query'][_0x9b29('0x20')]);_0x3cee24[_0x9b29('0x1e')]=qs[_0x9b29('0x1e')](_0x49025f[_0x9b29('0x34')][_0x9b29('0x1e')]);}_0x3cee24[_0x9b29('0x3a')]=qs[_0x9b29('0x3b')](_0x49025f[_0x9b29('0x34')]['sort']);_0x3cee24[_0x9b29('0x3c')]=qs[_0x9b29('0x3d')](_[_0x9b29('0x3e')](_0x49025f[_0x9b29('0x34')],_0x36fb08[_0x9b29('0x3d')]),_0x512e71);if(_0x49025f[_0x9b29('0x34')][_0x9b29('0x3f')]){_0x3cee24[_0x9b29('0x3c')]=_[_0x9b29('0x40')](_0x3cee24[_0x9b29('0x3c')],{'$or':_[_0x9b29('0x2d')](_0x512e71,function(_0x1b7250){if(_0x1b7250[_0x9b29('0x31')]!=='VIRTUAL'){var _0x3a4699={};_0x3a4699[_0x1b7250[_0x9b29('0x2a')]]={'$like':'%'+_0x49025f[_0x9b29('0x34')]['filter']+'%'};return _0x3a4699;}})});}_0x3cee24=_[_0x9b29('0x40')]({},_0x3cee24,_0x49025f[_0x9b29('0x41')]);var _0x3620d9={'where':_0x3cee24['where']};return db[_0x9b29('0x2e')]['count'](_0x3620d9)[_0x9b29('0x28')](function(_0x8e91ed){_0x386c65['count']=_0x8e91ed;if(_0x49025f['query'][_0x9b29('0x42')]){_0x3cee24[_0x9b29('0x43')]=[{'all':!![]}];}return db[_0x9b29('0x2e')]['findAll'](_0x3cee24);})[_0x9b29('0x28')](function(_0x5a79fa){_0x386c65['rows']=_0x5a79fa;return _0x386c65;})[_0x9b29('0x28')](respondWithFilteredResult(_0x25a000,_0x3cee24))[_0x9b29('0x44')](handleError(_0x25a000,null));};exports[_0x9b29('0x45')]=function(_0x2d6be6,_0x59c3b0){var _0x6e0a00={'raw':![],'where':{'id':_0x2d6be6[_0x9b29('0x46')]['id']}},_0x116cb0={};_0x116cb0[_0x9b29('0x36')]=_['keys'](db['FreshdeskAccount'][_0x9b29('0x2f')]);_0x116cb0[_0x9b29('0x34')]=_[_0x9b29('0x47')](_0x2d6be6['query']);_0x116cb0[_0x9b29('0x3d')]=_[_0x9b29('0x33')](_0x116cb0[_0x9b29('0x36')],_0x116cb0['query']);_0x6e0a00[_0x9b29('0x35')]=_[_0x9b29('0x33')](_0x116cb0[_0x9b29('0x36')],qs[_0x9b29('0x37')](_0x2d6be6[_0x9b29('0x34')]['fields']));_0x6e0a00[_0x9b29('0x35')]=_0x6e0a00[_0x9b29('0x35')][_0x9b29('0x38')]?_0x6e0a00['attributes']:_0x116cb0[_0x9b29('0x36')];if(_0x2d6be6[_0x9b29('0x34')][_0x9b29('0x42')]){_0x6e0a00['include']=[{'all':!![]}];}_0x6e0a00=_[_0x9b29('0x40')]({},_0x6e0a00,_0x2d6be6[_0x9b29('0x41')]);return db[_0x9b29('0x2e')]['find'](_0x6e0a00)['then'](handleEntityNotFound(_0x59c3b0,null))['then'](respondWithResult(_0x59c3b0,null))[_0x9b29('0x44')](handleError(_0x59c3b0,null));};exports[_0x9b29('0x48')]=function(_0x31fcf9,_0x13d87d){return db[_0x9b29('0x2e')]['create'](_0x31fcf9['body'],{})[_0x9b29('0x28')](respondWithResult(_0x13d87d,0xc9))[_0x9b29('0x44')](handleError(_0x13d87d,null));};exports[_0x9b29('0x27')]=function(_0x50500e,_0x43508a){if(_0x50500e['body']['id']){delete _0x50500e['body']['id'];}return db[_0x9b29('0x2e')][_0x9b29('0x49')]({'where':{'id':_0x50500e[_0x9b29('0x46')]['id']}})[_0x9b29('0x28')](handleEntityNotFound(_0x43508a,null))[_0x9b29('0x28')](saveUpdates(_0x50500e['body'],null))['then'](respondWithResult(_0x43508a,null))['catch'](handleError(_0x43508a,null));};exports['destroy']=function(_0x2eb99c,_0x225c55){return db[_0x9b29('0x2e')][_0x9b29('0x49')]({'where':{'id':_0x2eb99c[_0x9b29('0x46')]['id']}})[_0x9b29('0x28')](handleEntityNotFound(_0x225c55,null))['then'](removeEntity(_0x225c55,null))[_0x9b29('0x44')](handleError(_0x225c55,null));};exports[_0x9b29('0x4a')]=function(_0x1fd72a,_0x4b53b2,_0x2088b9){var _0x193287={};var _0xab0b76={};var _0x16206c;var _0x3ac328;return db[_0x9b29('0x2e')][_0x9b29('0x4b')]({'where':{'id':_0x1fd72a[_0x9b29('0x46')]['id']}})[_0x9b29('0x28')](handleEntityNotFound(_0x4b53b2,null))['then'](function(_0x46484c){if(_0x46484c){_0x16206c=_0x46484c;_0xab0b76[_0x9b29('0x36')]=_[_0x9b29('0x47')](db[_0x9b29('0x4c')][_0x9b29('0x2f')]);_0xab0b76[_0x9b29('0x34')]=_[_0x9b29('0x47')](_0x1fd72a[_0x9b29('0x34')]);_0xab0b76[_0x9b29('0x3d')]=_[_0x9b29('0x33')](_0xab0b76[_0x9b29('0x36')],_0xab0b76[_0x9b29('0x34')]);_0x193287[_0x9b29('0x35')]=_['intersection'](_0xab0b76['model'],qs[_0x9b29('0x37')](_0x1fd72a[_0x9b29('0x34')]['fields']));_0x193287[_0x9b29('0x35')]=_0x193287[_0x9b29('0x35')][_0x9b29('0x38')]?_0x193287[_0x9b29('0x35')]:_0xab0b76[_0x9b29('0x36')];_0x193287[_0x9b29('0x3a')]=qs[_0x9b29('0x3b')](_0x1fd72a[_0x9b29('0x34')]['sort']);_0x193287['where']=qs[_0x9b29('0x3d')](_[_0x9b29('0x3e')](_0x1fd72a[_0x9b29('0x34')],_0xab0b76[_0x9b29('0x3d')]));if(_0x1fd72a['query'][_0x9b29('0x3f')]){_0x193287[_0x9b29('0x3c')]=_[_0x9b29('0x40')](_0x193287[_0x9b29('0x3c')],{'$or':_[_0x9b29('0x2d')](_0x193287[_0x9b29('0x35')],function(_0x82e152){var _0x297b75={};_0x297b75[_0x82e152]={'$like':'%'+_0x1fd72a[_0x9b29('0x34')][_0x9b29('0x3f')]+'%'};return _0x297b75;})});}_0x193287=_[_0x9b29('0x40')]({},_0x193287,_0x1fd72a['options']);return _0x16206c[_0x9b29('0x4a')](_0x193287);}})['then'](function(_0x28c5e9){if(_0x28c5e9){_0x3ac328=_0x28c5e9['length'];if(!_0x1fd72a[_0x9b29('0x34')][_0x9b29('0x39')](_0x9b29('0x4d'))){_0x193287[_0x9b29('0x20')]=qs[_0x9b29('0x20')](_0x1fd72a[_0x9b29('0x34')][_0x9b29('0x20')]);_0x193287[_0x9b29('0x1e')]=qs['offset'](_0x1fd72a[_0x9b29('0x34')][_0x9b29('0x1e')]);}return _0x16206c[_0x9b29('0x4a')](_0x193287);}})[_0x9b29('0x28')](function(_0x5a68b5){if(_0x5a68b5){return _0x5a68b5?{'count':_0x3ac328,'rows':_0x5a68b5}:null;}})[_0x9b29('0x28')](respondWithResult(_0x4b53b2,null))[_0x9b29('0x44')](handleError(_0x4b53b2,null));};exports[_0x9b29('0x4e')]=function(_0x3e9ff8,_0x1c37ad,_0x11036f){if(_0x3e9ff8[_0x9b29('0x4f')]['id']){delete _0x3e9ff8[_0x9b29('0x4f')]['id'];}return db[_0x9b29('0x2e')][_0x9b29('0x4b')]({'where':{'id':_0x3e9ff8['params']['id']}})[_0x9b29('0x28')](handleEntityNotFound(_0x1c37ad,null))[_0x9b29('0x28')](function(_0x478838){if(_0x478838){_0x3e9ff8[_0x9b29('0x4f')]['AccountId']=_0x478838['id'];_0x3e9ff8[_0x9b29('0x4f')][_0x9b29('0x50')]=integrations[_0x9b29('0x51')](_0x3e9ff8[_0x9b29('0x4f')][_0x9b29('0x52')],_0x3e9ff8[_0x9b29('0x4f')][_0x9b29('0x31')]);_0x3e9ff8[_0x9b29('0x4f')]['Descriptions']=integrations[_0x9b29('0x53')](_0x3e9ff8[_0x9b29('0x4f')]['channel'],_0x3e9ff8['body'][_0x9b29('0x31')]);return db[_0x9b29('0x4c')][_0x9b29('0x48')](_0x3e9ff8['body'],{'include':[{'model':db['FreshdeskField'],'as':_0x9b29('0x50')},{'model':db[_0x9b29('0x54')],'as':_0x9b29('0x55')}]});}return null;})[_0x9b29('0x28')](respondWithResult(_0x1c37ad,null))[_0x9b29('0x44')](handleError(_0x1c37ad,null));};exports['getFields']=function(_0x4248af,_0x4cd0bb,_0x48aa19){var _0x18eb00='';return db['FreshdeskAccount'][_0x9b29('0x4b')]({'where':{'id':_0x4248af[_0x9b29('0x46')]['id']},'attributes':['id',_0x9b29('0x56'),_0x9b29('0x57')]})[_0x9b29('0x28')](handleEntityNotFound(_0x4cd0bb,null))[_0x9b29('0x28')](function(_0x196bb1){if(_0x196bb1){_0x18eb00=_0x196bb1[_0x9b29('0x56')];var _0x5563f7=_0x18eb00[_0x9b29('0x58')](-0x1);if(_0x5563f7==='/'){_0x18eb00=_0x18eb00[_0x9b29('0x59')](0x0,_0x18eb00['lastIndexOf'](_0x5563f7));}return rp({'method':_0x9b29('0x5a'),'uri':util[_0x9b29('0x5b')](_0x9b29('0x5c'),_0x18eb00,_0x9b29('0x5d')),'headers':{'Authorization':util[_0x9b29('0x5b')](_0x9b29('0x5e'),new Buffer(util[_0x9b29('0x5b')](_0x9b29('0x5f'),_0x196bb1[_0x9b29('0x57')]))[_0x9b29('0x60')](_0x9b29('0x61')))},'json':!![]});}})[_0x9b29('0x28')](function(_0x514921){if(_0x514921){var _0x5d931b=[_0x9b29('0x62'),'subject',_0x9b29('0x63'),'description',_0x9b29('0x1b'),'priority',_0x9b29('0x64'),_0x9b29('0x65'),_0x9b29('0x66'),_0x9b29('0x64'),'company'];_[_0x9b29('0x67')](_0x514921,function(_0x2332e7){return _0x5d931b[_0x9b29('0x68')](_0x2332e7[_0x9b29('0x2a')])||!_0x2332e7[_0x9b29('0x69')]&&_0x2332e7[_0x9b29('0x31')]!==_0x9b29('0x6a')&&_0x2332e7[_0x9b29('0x31')]!==_0x9b29('0x6b');});return{'count':_0x514921[_0x9b29('0x38')],'rows':_['map'](_0x514921,function(_0x37e6f0){return{'id':_0x37e6f0['name'],'name':_0x37e6f0[_0x9b29('0x6c')],'custom':!_0x37e6f0['default'],'options':_0x37e6f0['choices']?_[_0x9b29('0x2d')](_0x37e6f0[_0x9b29('0x6d')],function(_0x10c151){return{'name':_[_0x9b29('0x6e')](_0x10c151),'value':_0x10c151};}):[]};})};}})['then'](respondWithResult(_0x4cd0bb,null))[_0x9b29('0x44')](function(_0x43cdf2){var _0x3a00fc=_0x4248af[_0x9b29('0x34')][_0x9b29('0x6f')]?0x1f4:_0x43cdf2[_0x9b29('0x70')]||0x1f4;logger['error'](_0x9b29('0x71'),_0x9b29('0x72'),_0x3a00fc,JSON[_0x9b29('0x73')](_0x43cdf2));delete _0x43cdf2[_0x9b29('0x2a')];if(_0x3a00fc===0x191){_0x3a00fc=0x190;}_0x4cd0bb['status'](_0x3a00fc)[_0x9b29('0x2b')](_0x4248af[_0x9b29('0x34')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x43cdf2[_0x9b29('0x70')]}:_0x43cdf2);});}; \ No newline at end of file +var _0x8721=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','name','index','FreshdeskAccount','rawAttributes','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','include','create','body','find','getConfigurations','findOne','FreshdeskConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','remoteUri','apiKey','slice','substring','lastIndexOf','%s/%s','api/v2/ticket_fields','format','toString','subject','agent','description','priority','group','source','ticket_type','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x35035e,_0x26bc1d){var _0x3a042f=function(_0x38d4e3){while(--_0x38d4e3){_0x35035e['push'](_0x35035e['shift']());}};_0x3a042f(++_0x26bc1d);}(_0x8721,0xd9));var _0x1872=function(_0x235482,_0x14b833){_0x235482=_0x235482-0x0;var _0x5f5bea=_0x8721[_0x235482];return _0x5f5bea;};'use strict';var emlformat=require(_0x1872('0x0'));var rimraf=require(_0x1872('0x1'));var zipdir=require(_0x1872('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1872('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x1872('0x4'));var sox=require(_0x1872('0x5'));var csv=require(_0x1872('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1872('0x7'));var squel=require(_0x1872('0x8'));var crypto=require(_0x1872('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x1872('0xa'));var toCsv=require(_0x1872('0x6'));var querystring=require(_0x1872('0xb'));var Papa=require(_0x1872('0xc'));var Redis=require(_0x1872('0xd'));var authService=require(_0x1872('0xe'));var qs=require(_0x1872('0xf'));var as=require(_0x1872('0x10'));var hardwareService=require(_0x1872('0x11'));var logger=require(_0x1872('0x12'))(_0x1872('0x13'));var utils=require('../../config/utils');var config=require(_0x1872('0x14'));var licenseUtil=require(_0x1872('0x15'));var db=require(_0x1872('0x16'))['db'];var integrations=require(_0x1872('0x17'));function respondWithStatusCode(_0x5122df,_0x412663){_0x412663=_0x412663||0xcc;return function(_0x1a8e90){if(_0x1a8e90){return _0x5122df[_0x1872('0x18')](_0x412663);}return _0x5122df[_0x1872('0x19')](_0x412663)['end']();};}function respondWithResult(_0x4df475,_0xe47f69){_0xe47f69=_0xe47f69||0xc8;return function(_0x9e92ef){if(_0x9e92ef){return _0x4df475[_0x1872('0x19')](_0xe47f69)[_0x1872('0x1a')](_0x9e92ef);}};}function respondWithFilteredResult(_0x1ffc89,_0x5662e6){return function(_0x4be58a){if(_0x4be58a){var _0x4d5d5d=typeof _0x5662e6[_0x1872('0x1b')]===_0x1872('0x1c')&&typeof _0x5662e6[_0x1872('0x1d')]==='undefined';var _0xd4204d=_0x4be58a['count'];var _0x444306=_0x4d5d5d?0x0:_0x5662e6[_0x1872('0x1b')];var _0x32147c=_0x4d5d5d?_0x4be58a['count']:_0x5662e6[_0x1872('0x1b')]+_0x5662e6['limit'];var _0x82b55e;if(_0x32147c>=_0xd4204d){_0x32147c=_0xd4204d;_0x82b55e=0xc8;}else{_0x82b55e=0xce;}_0x1ffc89[_0x1872('0x19')](_0x82b55e);return _0x1ffc89[_0x1872('0x1e')](_0x1872('0x1f'),_0x444306+'-'+_0x32147c+'/'+_0xd4204d)[_0x1872('0x1a')](_0x4be58a);}return null;};}function patchUpdates(_0x506a44){return function(_0x3e4ee7){try{jsonpatch[_0x1872('0x20')](_0x3e4ee7,_0x506a44,!![]);}catch(_0x1d0e89){return BPromise[_0x1872('0x21')](_0x1d0e89);}return _0x3e4ee7[_0x1872('0x22')]();};}function saveUpdates(_0x3142f8,_0x1fc33f){return function(_0x1acbc2){if(_0x1acbc2){return _0x1acbc2[_0x1872('0x23')](_0x3142f8)['then'](function(_0x54e059){return _0x54e059;});}return null;};}function removeEntity(_0x5f29f5,_0x42e0e4){return function(_0x3a9ca2){if(_0x3a9ca2){return _0x3a9ca2[_0x1872('0x24')]()[_0x1872('0x25')](function(){_0x5f29f5['status'](0xcc)[_0x1872('0x26')]();});}};}function handleEntityNotFound(_0x2ac6b8,_0x126ab4){return function(_0x588fc1){if(!_0x588fc1){_0x2ac6b8[_0x1872('0x18')](0x194);}return _0x588fc1;};}function handleError(_0x576efa,_0x43e178){_0x43e178=_0x43e178||0x1f4;return function(_0x8d964a){logger[_0x1872('0x27')](_0x8d964a['stack']);if(_0x8d964a[_0x1872('0x28')]){delete _0x8d964a[_0x1872('0x28')];}_0x576efa['status'](_0x43e178)['send'](_0x8d964a);};}exports[_0x1872('0x29')]=function(_0x5bab21,_0x5469e7){var _0x333961={},_0x5b1ef0={},_0x3f2779={'count':0x0,'rows':[]};var _0x7c1b35=_['map'](db[_0x1872('0x2a')][_0x1872('0x2b')],function(_0x30ad4f){return{'name':_0x30ad4f['fieldName'],'type':_0x30ad4f[_0x1872('0x2c')][_0x1872('0x2d')]};});_0x5b1ef0[_0x1872('0x2e')]=_[_0x1872('0x2f')](_0x7c1b35,_0x1872('0x28'));_0x5b1ef0['query']=_[_0x1872('0x30')](_0x5bab21[_0x1872('0x31')]);_0x5b1ef0[_0x1872('0x32')]=_[_0x1872('0x33')](_0x5b1ef0[_0x1872('0x2e')],_0x5b1ef0[_0x1872('0x31')]);_0x333961['attributes']=_[_0x1872('0x33')](_0x5b1ef0[_0x1872('0x2e')],qs[_0x1872('0x34')](_0x5bab21[_0x1872('0x31')][_0x1872('0x34')]));_0x333961[_0x1872('0x35')]=_0x333961[_0x1872('0x35')][_0x1872('0x36')]?_0x333961['attributes']:_0x5b1ef0['model'];if(!_0x5bab21[_0x1872('0x31')][_0x1872('0x37')](_0x1872('0x38'))){_0x333961[_0x1872('0x1d')]=qs[_0x1872('0x1d')](_0x5bab21[_0x1872('0x31')]['limit']);_0x333961[_0x1872('0x1b')]=qs[_0x1872('0x1b')](_0x5bab21['query']['offset']);}_0x333961['order']=qs[_0x1872('0x39')](_0x5bab21[_0x1872('0x31')][_0x1872('0x39')]);_0x333961['where']=qs[_0x1872('0x32')](_[_0x1872('0x3a')](_0x5bab21[_0x1872('0x31')],_0x5b1ef0[_0x1872('0x32')]),_0x7c1b35);if(_0x5bab21[_0x1872('0x31')][_0x1872('0x3b')]){_0x333961['where']=_[_0x1872('0x3c')](_0x333961[_0x1872('0x3d')],{'$or':_[_0x1872('0x2f')](_0x7c1b35,function(_0x3bd1da){if(_0x3bd1da[_0x1872('0x2c')]!==_0x1872('0x3e')){var _0x224d46={};_0x224d46[_0x3bd1da[_0x1872('0x28')]]={'$like':'%'+_0x5bab21['query'][_0x1872('0x3b')]+'%'};return _0x224d46;}})});}_0x333961=_[_0x1872('0x3c')]({},_0x333961,_0x5bab21[_0x1872('0x3f')]);var _0x4c3e9e={'where':_0x333961[_0x1872('0x3d')]};return db[_0x1872('0x2a')]['count'](_0x4c3e9e)[_0x1872('0x25')](function(_0x18a711){_0x3f2779[_0x1872('0x40')]=_0x18a711;if(_0x5bab21[_0x1872('0x31')][_0x1872('0x41')]){_0x333961['include']=[{'all':!![]}];}return db[_0x1872('0x2a')][_0x1872('0x42')](_0x333961);})[_0x1872('0x25')](function(_0x4b2dae){_0x3f2779[_0x1872('0x43')]=_0x4b2dae;return _0x3f2779;})[_0x1872('0x25')](respondWithFilteredResult(_0x5469e7,_0x333961))[_0x1872('0x44')](handleError(_0x5469e7,null));};exports[_0x1872('0x45')]=function(_0x38b60e,_0xbd6e46){var _0x857b68={'raw':![],'where':{'id':_0x38b60e[_0x1872('0x46')]['id']}},_0x300806={};_0x300806['model']=_[_0x1872('0x30')](db[_0x1872('0x2a')][_0x1872('0x2b')]);_0x300806[_0x1872('0x31')]=_[_0x1872('0x30')](_0x38b60e[_0x1872('0x31')]);_0x300806[_0x1872('0x32')]=_['intersection'](_0x300806['model'],_0x300806[_0x1872('0x31')]);_0x857b68[_0x1872('0x35')]=_[_0x1872('0x33')](_0x300806[_0x1872('0x2e')],qs['fields'](_0x38b60e['query']['fields']));_0x857b68['attributes']=_0x857b68[_0x1872('0x35')]['length']?_0x857b68[_0x1872('0x35')]:_0x300806[_0x1872('0x2e')];if(_0x38b60e['query'][_0x1872('0x41')]){_0x857b68[_0x1872('0x47')]=[{'all':!![]}];}_0x857b68=_['merge']({},_0x857b68,_0x38b60e[_0x1872('0x3f')]);return db[_0x1872('0x2a')]['find'](_0x857b68)[_0x1872('0x25')](handleEntityNotFound(_0xbd6e46,null))[_0x1872('0x25')](respondWithResult(_0xbd6e46,null))[_0x1872('0x44')](handleError(_0xbd6e46,null));};exports[_0x1872('0x48')]=function(_0x392f26,_0x2a6341){return db[_0x1872('0x2a')][_0x1872('0x48')](_0x392f26['body'],{})['then'](respondWithResult(_0x2a6341,0xc9))[_0x1872('0x44')](handleError(_0x2a6341,null));};exports[_0x1872('0x23')]=function(_0x3e985e,_0x5e70a6){if(_0x3e985e[_0x1872('0x49')]['id']){delete _0x3e985e[_0x1872('0x49')]['id'];}return db[_0x1872('0x2a')][_0x1872('0x4a')]({'where':{'id':_0x3e985e[_0x1872('0x46')]['id']}})['then'](handleEntityNotFound(_0x5e70a6,null))[_0x1872('0x25')](saveUpdates(_0x3e985e[_0x1872('0x49')],null))[_0x1872('0x25')](respondWithResult(_0x5e70a6,null))[_0x1872('0x44')](handleError(_0x5e70a6,null));};exports[_0x1872('0x24')]=function(_0x5b6c04,_0x3a6edb){return db[_0x1872('0x2a')][_0x1872('0x4a')]({'where':{'id':_0x5b6c04[_0x1872('0x46')]['id']}})[_0x1872('0x25')](handleEntityNotFound(_0x3a6edb,null))[_0x1872('0x25')](removeEntity(_0x3a6edb,null))[_0x1872('0x44')](handleError(_0x3a6edb,null));};exports[_0x1872('0x4b')]=function(_0x3528b6,_0x5f4ae9,_0xbdf0c6){var _0x183f7b={};var _0x3d4143={};var _0x17a80b;var _0x340570;return db[_0x1872('0x2a')][_0x1872('0x4c')]({'where':{'id':_0x3528b6['params']['id']}})['then'](handleEntityNotFound(_0x5f4ae9,null))[_0x1872('0x25')](function(_0x3145b1){if(_0x3145b1){_0x17a80b=_0x3145b1;_0x3d4143[_0x1872('0x2e')]=_['keys'](db[_0x1872('0x4d')][_0x1872('0x2b')]);_0x3d4143[_0x1872('0x31')]=_[_0x1872('0x30')](_0x3528b6[_0x1872('0x31')]);_0x3d4143[_0x1872('0x32')]=_[_0x1872('0x33')](_0x3d4143[_0x1872('0x2e')],_0x3d4143['query']);_0x183f7b[_0x1872('0x35')]=_['intersection'](_0x3d4143[_0x1872('0x2e')],qs[_0x1872('0x34')](_0x3528b6[_0x1872('0x31')]['fields']));_0x183f7b[_0x1872('0x35')]=_0x183f7b['attributes'][_0x1872('0x36')]?_0x183f7b['attributes']:_0x3d4143['model'];_0x183f7b[_0x1872('0x4e')]=qs[_0x1872('0x39')](_0x3528b6[_0x1872('0x31')][_0x1872('0x39')]);_0x183f7b['where']=qs[_0x1872('0x32')](_[_0x1872('0x3a')](_0x3528b6[_0x1872('0x31')],_0x3d4143[_0x1872('0x32')]));if(_0x3528b6[_0x1872('0x31')][_0x1872('0x3b')]){_0x183f7b[_0x1872('0x3d')]=_[_0x1872('0x3c')](_0x183f7b[_0x1872('0x3d')],{'$or':_[_0x1872('0x2f')](_0x183f7b[_0x1872('0x35')],function(_0x101ada){var _0x7d4201={};_0x7d4201[_0x101ada]={'$like':'%'+_0x3528b6[_0x1872('0x31')][_0x1872('0x3b')]+'%'};return _0x7d4201;})});}_0x183f7b=_[_0x1872('0x3c')]({},_0x183f7b,_0x3528b6[_0x1872('0x3f')]);return _0x17a80b[_0x1872('0x4b')](_0x183f7b);}})[_0x1872('0x25')](function(_0x1c3a86){if(_0x1c3a86){_0x340570=_0x1c3a86[_0x1872('0x36')];if(!_0x3528b6[_0x1872('0x31')][_0x1872('0x37')]('nolimit')){_0x183f7b[_0x1872('0x1d')]=qs['limit'](_0x3528b6[_0x1872('0x31')]['limit']);_0x183f7b['offset']=qs[_0x1872('0x1b')](_0x3528b6[_0x1872('0x31')][_0x1872('0x1b')]);}return _0x17a80b[_0x1872('0x4b')](_0x183f7b);}})[_0x1872('0x25')](function(_0x51c0d9){if(_0x51c0d9){return _0x51c0d9?{'count':_0x340570,'rows':_0x51c0d9}:null;}})[_0x1872('0x25')](respondWithResult(_0x5f4ae9,null))[_0x1872('0x44')](handleError(_0x5f4ae9,null));};exports[_0x1872('0x4f')]=function(_0x2cc5fd,_0x30596c,_0x59bd34){if(_0x2cc5fd[_0x1872('0x49')]['id']){delete _0x2cc5fd['body']['id'];}return db[_0x1872('0x2a')][_0x1872('0x4c')]({'where':{'id':_0x2cc5fd[_0x1872('0x46')]['id']}})[_0x1872('0x25')](handleEntityNotFound(_0x30596c,null))[_0x1872('0x25')](function(_0x36d3ee){if(_0x36d3ee){_0x2cc5fd[_0x1872('0x49')][_0x1872('0x50')]=_0x36d3ee['id'];_0x2cc5fd['body'][_0x1872('0x51')]=integrations[_0x1872('0x52')](_0x2cc5fd['body'][_0x1872('0x53')],_0x2cc5fd['body'][_0x1872('0x2c')]);_0x2cc5fd['body'][_0x1872('0x54')]=integrations[_0x1872('0x55')](_0x2cc5fd[_0x1872('0x49')]['channel'],_0x2cc5fd['body']['type']);return db[_0x1872('0x4d')][_0x1872('0x48')](_0x2cc5fd['body'],{'include':[{'model':db[_0x1872('0x56')],'as':_0x1872('0x51')},{'model':db[_0x1872('0x56')],'as':_0x1872('0x54')}]});}return null;})[_0x1872('0x25')](respondWithResult(_0x30596c,null))[_0x1872('0x44')](handleError(_0x30596c,null));};exports['getFields']=function(_0x1897fe,_0x2af635,_0x454a2f){var _0x2742b9='';return db[_0x1872('0x2a')][_0x1872('0x4c')]({'where':{'id':_0x1897fe[_0x1872('0x46')]['id']},'attributes':['id',_0x1872('0x57'),_0x1872('0x58')]})[_0x1872('0x25')](handleEntityNotFound(_0x2af635,null))[_0x1872('0x25')](function(_0x311fbc){if(_0x311fbc){_0x2742b9=_0x311fbc[_0x1872('0x57')];var _0xc8c0d3=_0x2742b9[_0x1872('0x59')](-0x1);if(_0xc8c0d3==='/'){_0x2742b9=_0x2742b9[_0x1872('0x5a')](0x0,_0x2742b9[_0x1872('0x5b')](_0xc8c0d3));}return rp({'method':'GET','uri':util['format'](_0x1872('0x5c'),_0x2742b9,_0x1872('0x5d')),'headers':{'Authorization':util[_0x1872('0x5e')]('Basic\x20%s',new Buffer(util[_0x1872('0x5e')]('%s:X',_0x311fbc['apiKey']))[_0x1872('0x5f')]('base64'))},'json':!![]});}})[_0x1872('0x25')](function(_0x5c057e){if(_0x5c057e){var _0x236b66=['requester',_0x1872('0x60'),_0x1872('0x61'),_0x1872('0x62'),_0x1872('0x19'),_0x1872('0x63'),_0x1872('0x64'),_0x1872('0x65'),_0x1872('0x66'),_0x1872('0x64'),'company'];_[_0x1872('0x67')](_0x5c057e,function(_0x9f53bc){return _0x236b66[_0x1872('0x68')](_0x9f53bc[_0x1872('0x28')])||!_0x9f53bc[_0x1872('0x69')]&&_0x9f53bc[_0x1872('0x2c')]!==_0x1872('0x6a')&&_0x9f53bc[_0x1872('0x2c')]!==_0x1872('0x6b');});return{'count':_0x5c057e[_0x1872('0x36')],'rows':_[_0x1872('0x2f')](_0x5c057e,function(_0xa39f0b){return{'id':_0xa39f0b[_0x1872('0x28')],'name':_0xa39f0b[_0x1872('0x6c')],'custom':!_0xa39f0b['default'],'options':_0xa39f0b['choices']?_['map'](_0xa39f0b[_0x1872('0x6d')],function(_0x5d5a72){return{'name':_[_0x1872('0x6e')](_0x5d5a72),'value':_0x5d5a72};}):[]};})};}})[_0x1872('0x25')](respondWithResult(_0x2af635,null))[_0x1872('0x44')](function(_0x57df91){var _0x5f5cae=_0x1897fe[_0x1872('0x31')][_0x1872('0x6f')]?0x1f4:_0x57df91[_0x1872('0x70')]||0x1f4;logger['error'](_0x1872('0x71'),'getFields',_0x5f5cae,JSON[_0x1872('0x72')](_0x57df91));delete _0x57df91[_0x1872('0x28')];if(_0x5f5cae===0x191){_0x5f5cae=0x190;}_0x2af635[_0x1872('0x19')](_0x5f5cae)[_0x1872('0x73')](_0x1897fe['query']['test']?{'message':_0x1872('0x74'),'statusCode':_0x57df91[_0x1872('0x70')]}:_0x57df91);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index ff75fb4..c3ea1f0 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 _0x5437=['int_freshdesk_accounts','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','FreshdeskAccount'];(function(_0x2a2228,_0x66b18f){var _0x13c647=function(_0x4d30d2){while(--_0x4d30d2){_0x2a2228['push'](_0x2a2228['shift']());}};_0x13c647(++_0x66b18f);}(_0x5437,0xaa));var _0x7543=function(_0x525af9,_0x4edd23){_0x525af9=_0x525af9-0x0;var _0x129fbf=_0x5437[_0x525af9];return _0x129fbf;};'use strict';var _=require('lodash');var util=require(_0x7543('0x0'));var logger=require(_0x7543('0x1'))(_0x7543('0x2'));var moment=require(_0x7543('0x3'));var BPromise=require(_0x7543('0x4'));var rp=require(_0x7543('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7543('0x6'));var config=require(_0x7543('0x7'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x7543('0x8'));module[_0x7543('0x9')]=function(_0x1a3f35,_0x10e4de){return _0x1a3f35[_0x7543('0xa')](_0x7543('0xb'),attributes,{'tableName':_0x7543('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa91f=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api'];(function(_0x52ad0e,_0x134b99){var _0x3ee4fa=function(_0x407fc3){while(--_0x407fc3){_0x52ad0e['push'](_0x52ad0e['shift']());}};_0x3ee4fa(++_0x134b99);}(_0xa91f,0x1bc));var _0xfa91=function(_0x25dd4a,_0x255598){_0x25dd4a=_0x25dd4a-0x0;var _0x11837c=_0xa91f[_0x25dd4a];return _0x11837c;};'use strict';var _=require(_0xfa91('0x0'));var util=require(_0xfa91('0x1'));var logger=require(_0xfa91('0x2'))(_0xfa91('0x3'));var moment=require('moment');var BPromise=require(_0xfa91('0x4'));var rp=require(_0xfa91('0x5'));var fs=require('fs');var path=require(_0xfa91('0x6'));var rimraf=require(_0xfa91('0x7'));var config=require(_0xfa91('0x8'));var attributes=require(_0xfa91('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xfa91('0xa')]=function(_0x218588,_0x215035){return _0x218588[_0xfa91('0xb')](_0xfa91('0xc'),attributes,{'tableName':_0xfa91('0xd'),'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 5325a87..4705cc9 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 _0xd218=['where','attributes','limit','include','map','model','ShowFreshdeskAccount','lodash','moment','randomstring','ioredis','../../config/logger','../../config/environment','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw'];(function(_0x118da9,_0x21a9f8){var _0x31d18c=function(_0x4ca6ef){while(--_0x4ca6ef){_0x118da9['push'](_0x118da9['shift']());}};_0x31d18c(++_0x21a9f8);}(_0xd218,0x64));var _0x8d21=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xd218[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0x8d21('0x0'));var util=require('util');var moment=require(_0x8d21('0x1'));var BPromise=require('bluebird');var rs=require(_0x8d21('0x2'));var fs=require('fs');var Redis=require(_0x8d21('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8d21('0x4'))('rpc');var config=require(_0x8d21('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x8d21('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f85d5,_0x129e73,_0x1fc103){return new BPromise(function(_0x5a3b59,_0x5851c5){return client[_0x8d21('0x7')](_0x4f85d5,_0x1fc103)[_0x8d21('0x8')](function(_0x3433e2){logger[_0x8d21('0x9')](_0x8d21('0xa'),_0x129e73,_0x8d21('0xb'));logger[_0x8d21('0xc')](_0x8d21('0xd'),_0x129e73,_0x8d21('0xb'),JSON['stringify'](_0x3433e2));if(_0x3433e2[_0x8d21('0xe')]){if(_0x3433e2[_0x8d21('0xe')][_0x8d21('0xf')]===0x1f4){logger[_0x8d21('0xe')](_0x8d21('0xa'),_0x129e73,_0x3433e2[_0x8d21('0xe')][_0x8d21('0x10')]);return _0x5851c5(_0x3433e2[_0x8d21('0xe')][_0x8d21('0x10')]);}logger[_0x8d21('0xe')](_0x8d21('0xa'),_0x129e73,_0x3433e2[_0x8d21('0xe')][_0x8d21('0x10')]);return _0x5a3b59(_0x3433e2[_0x8d21('0xe')][_0x8d21('0x10')]);}else{logger[_0x8d21('0x9')](_0x8d21('0xa'),_0x129e73,_0x8d21('0xb'));_0x5a3b59(_0x3433e2[_0x8d21('0x11')]['message']);}})[_0x8d21('0x12')](function(_0x583fc1){logger['error'](_0x8d21('0xa'),_0x129e73,_0x583fc1);_0x5851c5(_0x583fc1);});});}exports[_0x8d21('0x13')]=function(_0x5cc710){var _0x2a374c=this;return new Promise(function(_0x357a96,_0xb09867){return db[_0x8d21('0x14')][_0x8d21('0x15')]({'raw':_0x5cc710[_0x8d21('0x16')]?_0x5cc710[_0x8d21('0x16')][_0x8d21('0x17')]===undefined?!![]:![]:!![],'where':_0x5cc710[_0x8d21('0x16')]?_0x5cc710[_0x8d21('0x16')][_0x8d21('0x18')]||null:null,'attributes':_0x5cc710['options']?_0x5cc710['options'][_0x8d21('0x19')]||null:null,'limit':_0x5cc710[_0x8d21('0x16')]?_0x5cc710['options'][_0x8d21('0x1a')]||null:null,'include':_0x5cc710[_0x8d21('0x16')]?_0x5cc710['options'][_0x8d21('0x1b')]?_[_0x8d21('0x1c')](_0x5cc710['options'][_0x8d21('0x1b')],function(_0x203402){return{'model':db[_0x203402[_0x8d21('0x1d')]],'as':_0x203402['as'],'attributes':_0x203402[_0x8d21('0x19')],'include':_0x203402['include']?_[_0x8d21('0x1c')](_0x203402['include'],function(_0x38ae45){return{'model':db[_0x38ae45[_0x8d21('0x1d')]],'as':_0x38ae45['as'],'attributes':_0x38ae45['attributes'],'include':_0x38ae45[_0x8d21('0x1b')]?_[_0x8d21('0x1c')](_0x38ae45[_0x8d21('0x1b')],function(_0xa4cc1d){return{'model':db[_0xa4cc1d[_0x8d21('0x1d')]],'as':_0xa4cc1d['as'],'attributes':_0xa4cc1d[_0x8d21('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8d21('0x8')](function(_0x201458){logger['info'](_0x8d21('0x13'),_0x5cc710);logger['debug']('GetFreshdeskAccount',_0x5cc710,JSON['stringify'](_0x201458));_0x357a96(_0x201458);})[_0x8d21('0x12')](function(_0x382d0d){logger['error'](_0x8d21('0x13'),_0x382d0d[_0x8d21('0x10')],_0x5cc710);_0xb09867(_0x2a374c['error'](0x1f4,_0x382d0d['message']));});});};exports['ShowFreshdeskAccount']=function(_0x1f8694){var _0x3a3644=this;return new Promise(function(_0x5f4c32,_0x5c6574){return db[_0x8d21('0x14')]['find']({'raw':_0x1f8694[_0x8d21('0x16')]?_0x1f8694[_0x8d21('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1f8694[_0x8d21('0x16')]?_0x1f8694[_0x8d21('0x16')]['where']||null:null,'attributes':_0x1f8694[_0x8d21('0x16')]?_0x1f8694[_0x8d21('0x16')][_0x8d21('0x19')]||null:null,'include':_0x1f8694[_0x8d21('0x16')]?_0x1f8694[_0x8d21('0x16')][_0x8d21('0x1b')]?_[_0x8d21('0x1c')](_0x1f8694[_0x8d21('0x16')][_0x8d21('0x1b')],function(_0x24348a){return{'model':db[_0x24348a[_0x8d21('0x1d')]],'as':_0x24348a['as'],'attributes':_0x24348a[_0x8d21('0x19')],'include':_0x24348a['include']?_[_0x8d21('0x1c')](_0x24348a['include'],function(_0x20fd9a){return{'model':db[_0x20fd9a[_0x8d21('0x1d')]],'as':_0x20fd9a['as'],'attributes':_0x20fd9a[_0x8d21('0x19')],'include':_0x20fd9a[_0x8d21('0x1b')]?_[_0x8d21('0x1c')](_0x20fd9a['include'],function(_0x2ae30e){return{'model':db[_0x2ae30e[_0x8d21('0x1d')]],'as':_0x2ae30e['as'],'attributes':_0x2ae30e[_0x8d21('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8d21('0x8')](function(_0x44a51b){logger['info'](_0x8d21('0x1e'),_0x1f8694);logger['debug'](_0x8d21('0x1e'),_0x1f8694,JSON['stringify'](_0x44a51b));_0x5f4c32(_0x44a51b);})[_0x8d21('0x12')](function(_0x3de1d9){logger['error'](_0x8d21('0x1e'),_0x3de1d9[_0x8d21('0x10')],_0x1f8694);_0x5c6574(_0x3a3644[_0x8d21('0xe')](0x1f4,_0x3de1d9[_0x8d21('0x10')]));});});}; \ No newline at end of file +var _0xc452=['http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshdeskAccount','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x4a0fca,_0x3157bf){var _0x38385e=function(_0xc8c025){while(--_0xc8c025){_0x4a0fca['push'](_0x4a0fca['shift']());}};_0x38385e(++_0x3157bf);}(_0xc452,0x154));var _0x2c45=function(_0x1e2643,_0x82c64b){_0x1e2643=_0x1e2643-0x0;var _0x1dde54=_0xc452[_0x1e2643];return _0x1dde54;};'use strict';var _=require('lodash');var util=require(_0x2c45('0x0'));var moment=require('moment');var BPromise=require(_0x2c45('0x1'));var rs=require(_0x2c45('0x2'));var fs=require('fs');var Redis=require(_0x2c45('0x3'));var db=require(_0x2c45('0x4'))['db'];var utils=require(_0x2c45('0x5'));var logger=require(_0x2c45('0x6'))(_0x2c45('0x7'));var config=require('../../config/environment');var jayson=require(_0x2c45('0x8'));var client=jayson[_0x2c45('0x9')][_0x2c45('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x573bfe,_0xe9867e,_0x2b6bd4){return new BPromise(function(_0x3d7630,_0x1cc451){return client[_0x2c45('0xb')](_0x573bfe,_0x2b6bd4)[_0x2c45('0xc')](function(_0x477ca8){logger[_0x2c45('0xd')](_0x2c45('0xe'),_0xe9867e,_0x2c45('0xf'));logger[_0x2c45('0x10')](_0x2c45('0x11'),_0xe9867e,_0x2c45('0xf'),JSON[_0x2c45('0x12')](_0x477ca8));if(_0x477ca8[_0x2c45('0x13')]){if(_0x477ca8[_0x2c45('0x13')]['code']===0x1f4){logger['error'](_0x2c45('0xe'),_0xe9867e,_0x477ca8['error'][_0x2c45('0x14')]);return _0x1cc451(_0x477ca8[_0x2c45('0x13')][_0x2c45('0x14')]);}logger[_0x2c45('0x13')](_0x2c45('0xe'),_0xe9867e,_0x477ca8[_0x2c45('0x13')][_0x2c45('0x14')]);return _0x3d7630(_0x477ca8[_0x2c45('0x13')][_0x2c45('0x14')]);}else{logger['info'](_0x2c45('0xe'),_0xe9867e,'request\x20sent');_0x3d7630(_0x477ca8['result'][_0x2c45('0x14')]);}})[_0x2c45('0x15')](function(_0x21b5fc){logger[_0x2c45('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0xe9867e,_0x21b5fc);_0x1cc451(_0x21b5fc);});});}exports[_0x2c45('0x16')]=function(_0x20d8e2){var _0x13983b=this;return new Promise(function(_0x2b7880,_0x1a8a33){return db[_0x2c45('0x17')][_0x2c45('0x18')]({'raw':_0x20d8e2[_0x2c45('0x19')]?_0x20d8e2[_0x2c45('0x19')][_0x2c45('0x1a')]===undefined?!![]:![]:!![],'where':_0x20d8e2[_0x2c45('0x19')]?_0x20d8e2[_0x2c45('0x19')][_0x2c45('0x1b')]||null:null,'attributes':_0x20d8e2[_0x2c45('0x19')]?_0x20d8e2[_0x2c45('0x19')][_0x2c45('0x1c')]||null:null,'limit':_0x20d8e2[_0x2c45('0x19')]?_0x20d8e2[_0x2c45('0x19')][_0x2c45('0x1d')]||null:null,'include':_0x20d8e2[_0x2c45('0x19')]?_0x20d8e2['options'][_0x2c45('0x1e')]?_[_0x2c45('0x1f')](_0x20d8e2[_0x2c45('0x19')][_0x2c45('0x1e')],function(_0x1d2f2b){return{'model':db[_0x1d2f2b[_0x2c45('0x20')]],'as':_0x1d2f2b['as'],'attributes':_0x1d2f2b[_0x2c45('0x1c')],'include':_0x1d2f2b['include']?_['map'](_0x1d2f2b['include'],function(_0x4b7be0){return{'model':db[_0x4b7be0[_0x2c45('0x20')]],'as':_0x4b7be0['as'],'attributes':_0x4b7be0[_0x2c45('0x1c')],'include':_0x4b7be0['include']?_['map'](_0x4b7be0[_0x2c45('0x1e')],function(_0x235b87){return{'model':db[_0x235b87[_0x2c45('0x20')]],'as':_0x235b87['as'],'attributes':_0x235b87[_0x2c45('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2c45('0xc')](function(_0xbd0bce){logger[_0x2c45('0xd')](_0x2c45('0x16'),_0x20d8e2);logger[_0x2c45('0x10')](_0x2c45('0x16'),_0x20d8e2,JSON['stringify'](_0xbd0bce));_0x2b7880(_0xbd0bce);})[_0x2c45('0x15')](function(_0x3ace6a){logger[_0x2c45('0x13')](_0x2c45('0x16'),_0x3ace6a[_0x2c45('0x14')],_0x20d8e2);_0x1a8a33(_0x13983b[_0x2c45('0x13')](0x1f4,_0x3ace6a[_0x2c45('0x14')]));});});};exports[_0x2c45('0x21')]=function(_0x50214a){var _0x4e561c=this;return new Promise(function(_0x3c1175,_0x1e3ea4){return db[_0x2c45('0x17')][_0x2c45('0x22')]({'raw':_0x50214a['options']?_0x50214a[_0x2c45('0x19')][_0x2c45('0x1a')]===undefined?!![]:![]:!![],'where':_0x50214a['options']?_0x50214a[_0x2c45('0x19')]['where']||null:null,'attributes':_0x50214a[_0x2c45('0x19')]?_0x50214a['options'][_0x2c45('0x1c')]||null:null,'include':_0x50214a[_0x2c45('0x19')]?_0x50214a[_0x2c45('0x19')][_0x2c45('0x1e')]?_[_0x2c45('0x1f')](_0x50214a[_0x2c45('0x19')][_0x2c45('0x1e')],function(_0x32bb2f){return{'model':db[_0x32bb2f[_0x2c45('0x20')]],'as':_0x32bb2f['as'],'attributes':_0x32bb2f['attributes'],'include':_0x32bb2f[_0x2c45('0x1e')]?_[_0x2c45('0x1f')](_0x32bb2f[_0x2c45('0x1e')],function(_0x1549e4){return{'model':db[_0x1549e4[_0x2c45('0x20')]],'as':_0x1549e4['as'],'attributes':_0x1549e4['attributes'],'include':_0x1549e4[_0x2c45('0x1e')]?_['map'](_0x1549e4[_0x2c45('0x1e')],function(_0x3a6211){return{'model':db[_0x3a6211[_0x2c45('0x20')]],'as':_0x3a6211['as'],'attributes':_0x3a6211[_0x2c45('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dee8d){logger[_0x2c45('0xd')](_0x2c45('0x21'),_0x50214a);logger[_0x2c45('0x10')](_0x2c45('0x21'),_0x50214a,JSON[_0x2c45('0x12')](_0x3dee8d));_0x3c1175(_0x3dee8d);})[_0x2c45('0x15')](function(_0x46eb41){logger['error']('ShowFreshdeskAccount',_0x46eb41['message'],_0x50214a);_0x1e3ea4(_0x4e561c['error'](0x1f4,_0x46eb41['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 5341ff3..51a50b8 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 _0xf972=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','put','update','delete','destroy','exports','multer','util','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf972,0xd5));var _0x2f97=function(_0x436d54,_0x4caf80){_0x436d54=_0x436d54-0x0;var _0x40dba1=_0xf972[_0x436d54];return _0x40dba1;};'use strict';var multer=require(_0x2f97('0x0'));var util=require(_0x2f97('0x1'));var path=require(_0x2f97('0x2'));var timeout=require(_0x2f97('0x3'));var express=require('express');var router=express[_0x2f97('0x4')]();var fs_extra=require(_0x2f97('0x5'));var auth=require(_0x2f97('0x6'));var interaction=require(_0x2f97('0x7'));var config=require(_0x2f97('0x8'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x2f97('0x9')]('/',auth[_0x2f97('0xa')](),controller[_0x2f97('0xb')]);router[_0x2f97('0x9')](_0x2f97('0xc'),auth[_0x2f97('0xa')](),controller[_0x2f97('0xd')]);router[_0x2f97('0x9')]('/:id/fields',auth[_0x2f97('0xa')](),controller[_0x2f97('0xe')]);router[_0x2f97('0x9')](_0x2f97('0xf'),auth[_0x2f97('0xa')](),controller['getSubjects']);router[_0x2f97('0x9')](_0x2f97('0x10'),auth[_0x2f97('0xa')](),controller[_0x2f97('0x11')]);router['get'](_0x2f97('0x12'),auth[_0x2f97('0xa')](),controller['getTags']);router[_0x2f97('0x13')]('/',auth['isAuthenticated'](),controller[_0x2f97('0x14')]);router[_0x2f97('0x13')]('/:id/tags',auth[_0x2f97('0xa')](),controller[_0x2f97('0x15')]);router[_0x2f97('0x16')](_0x2f97('0xc'),auth[_0x2f97('0xa')](),controller[_0x2f97('0x17')]);router[_0x2f97('0x18')]('/:id',auth[_0x2f97('0xa')](),controller[_0x2f97('0x19')]);module[_0x2f97('0x1a')]=router; \ No newline at end of file +var _0xe8fd=['../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','/:id/tags','getTags','post','setTags','put','update','destroy','exports','multer','util','express','Router','fs-extra'];(function(_0x35e8ea,_0x307b2a){var _0x5b3e3a=function(_0x3f0f69){while(--_0x3f0f69){_0x35e8ea['push'](_0x35e8ea['shift']());}};_0x5b3e3a(++_0x307b2a);}(_0xe8fd,0x73));var _0xde8f=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xe8fd[_0x1deb03];return _0x189fe7;};'use strict';var multer=require(_0xde8f('0x0'));var util=require(_0xde8f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xde8f('0x2'));var router=express[_0xde8f('0x3')]();var fs_extra=require(_0xde8f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xde8f('0x5'));var config=require(_0xde8f('0x6'));var controller=require(_0xde8f('0x7'));router[_0xde8f('0x8')]('/',auth[_0xde8f('0x9')](),controller['index']);router[_0xde8f('0x8')](_0xde8f('0xa'),auth['isAuthenticated'](),controller[_0xde8f('0xb')]);router['get'](_0xde8f('0xc'),auth['isAuthenticated'](),controller[_0xde8f('0xd')]);router[_0xde8f('0x8')](_0xde8f('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xde8f('0x8')](_0xde8f('0xf'),auth[_0xde8f('0x9')](),controller['getDescriptions']);router['get'](_0xde8f('0x10'),auth[_0xde8f('0x9')](),controller[_0xde8f('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xde8f('0x12')]('/:id/tags',auth['isAuthenticated'](),controller[_0xde8f('0x13')]);router[_0xde8f('0x14')](_0xde8f('0xa'),auth[_0xde8f('0x9')](),controller[_0xde8f('0x15')]);router['delete'](_0xde8f('0xa'),auth[_0xde8f('0x9')](),controller[_0xde8f('0x16')]);module[_0xde8f('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 86ed42b..0501084 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 _0xb890=['STRING','sequelize','exports'];(function(_0x3bcbac,_0x19199d){var _0x5bafb8=function(_0x39751d){while(--_0x39751d){_0x3bcbac['push'](_0x3bcbac['shift']());}};_0x5bafb8(++_0x19199d);}(_0xb890,0xc7));var _0x0b89=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb890[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0b89('0x0'));module[_0x0b89('0x1')]={'name':{'type':Sequelize[_0x0b89('0x2')]},'description':{'type':Sequelize[_0x0b89('0x2')]}}; \ No newline at end of file +var _0x0ce8=['sequelize','STRING'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x0ce8,0x1b2));var _0x80ce=function(_0x9d9e77,_0x65b01){_0x9d9e77=_0x9d9e77-0x0;var _0x2b312e=_0x0ce8[_0x9d9e77];return _0x2b312e;};'use strict';var Sequelize=require(_0x80ce('0x0'));module['exports']={'name':{'type':Sequelize[_0x80ce('0x1')]},'description':{'type':Sequelize[_0x80ce('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 426f2e9..90a9e3f 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 _0x07f9=['destroy','end','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','find','create','body','params','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','fast-json-patch','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','offset','undefined','limit','count','status','set','Content-Range','json','save','update','then'];(function(_0x45ba6a,_0xa4862a){var _0x1dbbea=function(_0x5b1483){while(--_0x5b1483){_0x45ba6a['push'](_0x45ba6a['shift']());}};_0x1dbbea(++_0xa4862a);}(_0x07f9,0x11e));var _0x907f=function(_0x1d7c1e,_0x515252){_0x1d7c1e=_0x1d7c1e-0x0;var _0x2d1742=_0x07f9[_0x1d7c1e];return _0x2d1742;};'use strict';var emlformat=require(_0x907f('0x0'));var rimraf=require(_0x907f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x907f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x907f('0x3'));var Mustache=require('mustache');var util=require(_0x907f('0x4'));var path=require(_0x907f('0x5'));var sox=require('sox');var csv=require(_0x907f('0x6'));var ejs=require(_0x907f('0x7'));var fs=require('fs');var fs_extra=require(_0x907f('0x8'));var _=require(_0x907f('0x9'));var squel=require(_0x907f('0xa'));var crypto=require(_0x907f('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x907f('0x6'));var querystring=require(_0x907f('0xc'));var Papa=require(_0x907f('0xd'));var Redis=require(_0x907f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x907f('0xf'));var as=require(_0x907f('0x10'));var hardwareService=require(_0x907f('0x11'));var logger=require('../../config/logger')(_0x907f('0x12'));var utils=require(_0x907f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x907f('0x14'));var db=require(_0x907f('0x15'))['db'];function respondWithStatusCode(_0x466469,_0x152459){_0x152459=_0x152459||0xcc;return function(_0x32b7de){if(_0x32b7de){return _0x466469[_0x907f('0x16')](_0x152459);}return _0x466469['status'](_0x152459)['end']();};}function respondWithResult(_0xf480f7,_0x441e71){_0x441e71=_0x441e71||0xc8;return function(_0x5cbeb7){if(_0x5cbeb7){return _0xf480f7['status'](_0x441e71)['json'](_0x5cbeb7);}};}function respondWithFilteredResult(_0x12bebd,_0x4fb9d2){return function(_0x1bab7f){if(_0x1bab7f){var _0x5456fb=typeof _0x4fb9d2[_0x907f('0x17')]===_0x907f('0x18')&&typeof _0x4fb9d2[_0x907f('0x19')]==='undefined';var _0x1c0637=_0x1bab7f[_0x907f('0x1a')];var _0x1b710c=_0x5456fb?0x0:_0x4fb9d2[_0x907f('0x17')];var _0x231e82=_0x5456fb?_0x1bab7f[_0x907f('0x1a')]:_0x4fb9d2['offset']+_0x4fb9d2['limit'];var _0x4f52bf;if(_0x231e82>=_0x1c0637){_0x231e82=_0x1c0637;_0x4f52bf=0xc8;}else{_0x4f52bf=0xce;}_0x12bebd[_0x907f('0x1b')](_0x4f52bf);return _0x12bebd[_0x907f('0x1c')](_0x907f('0x1d'),_0x1b710c+'-'+_0x231e82+'/'+_0x1c0637)[_0x907f('0x1e')](_0x1bab7f);}return null;};}function patchUpdates(_0x16065f){return function(_0xbd8119){try{jsonpatch['apply'](_0xbd8119,_0x16065f,!![]);}catch(_0x4655ad){return BPromise['reject'](_0x4655ad);}return _0xbd8119[_0x907f('0x1f')]();};}function saveUpdates(_0x5ae0db,_0x1d71a0){return function(_0x52c126){if(_0x52c126){return _0x52c126[_0x907f('0x20')](_0x5ae0db)[_0x907f('0x21')](function(_0x365984){return _0x365984;});}return null;};}function removeEntity(_0x364dd9,_0x524b90){return function(_0xba2ef){if(_0xba2ef){return _0xba2ef[_0x907f('0x22')]()[_0x907f('0x21')](function(){_0x364dd9[_0x907f('0x1b')](0xcc)[_0x907f('0x23')]();});}};}function handleEntityNotFound(_0x36e5b4,_0x244671){return function(_0x2508e5){if(!_0x2508e5){_0x36e5b4['sendStatus'](0x194);}return _0x2508e5;};}function handleError(_0x42f391,_0x1ba9d3){_0x1ba9d3=_0x1ba9d3||0x1f4;return function(_0x337fa5){logger['error'](_0x337fa5['stack']);if(_0x337fa5[_0x907f('0x24')]){delete _0x337fa5[_0x907f('0x24')];}_0x42f391[_0x907f('0x1b')](_0x1ba9d3)[_0x907f('0x25')](_0x337fa5);};}exports[_0x907f('0x26')]=function(_0x355d1c,_0xbf373f){var _0x4f8754={},_0x2791bb={},_0x21003c={'count':0x0,'rows':[]};var _0x2b8628=_[_0x907f('0x27')](db[_0x907f('0x28')][_0x907f('0x29')],function(_0x42b12d){return{'name':_0x42b12d[_0x907f('0x2a')],'type':_0x42b12d['type'][_0x907f('0x2b')]};});_0x2791bb[_0x907f('0x2c')]=_[_0x907f('0x27')](_0x2b8628,_0x907f('0x24'));_0x2791bb[_0x907f('0x2d')]=_[_0x907f('0x2e')](_0x355d1c['query']);_0x2791bb[_0x907f('0x2f')]=_[_0x907f('0x30')](_0x2791bb[_0x907f('0x2c')],_0x2791bb[_0x907f('0x2d')]);_0x4f8754['attributes']=_[_0x907f('0x30')](_0x2791bb[_0x907f('0x2c')],qs['fields'](_0x355d1c[_0x907f('0x2d')][_0x907f('0x31')]));_0x4f8754[_0x907f('0x32')]=_0x4f8754[_0x907f('0x32')][_0x907f('0x33')]?_0x4f8754[_0x907f('0x32')]:_0x2791bb[_0x907f('0x2c')];if(!_0x355d1c[_0x907f('0x2d')][_0x907f('0x34')](_0x907f('0x35'))){_0x4f8754['limit']=qs[_0x907f('0x19')](_0x355d1c[_0x907f('0x2d')][_0x907f('0x19')]);_0x4f8754[_0x907f('0x17')]=qs[_0x907f('0x17')](_0x355d1c[_0x907f('0x2d')][_0x907f('0x17')]);}_0x4f8754[_0x907f('0x36')]=qs['sort'](_0x355d1c[_0x907f('0x2d')][_0x907f('0x37')]);_0x4f8754[_0x907f('0x38')]=qs[_0x907f('0x2f')](_[_0x907f('0x39')](_0x355d1c[_0x907f('0x2d')],_0x2791bb[_0x907f('0x2f')]),_0x2b8628);if(_0x355d1c[_0x907f('0x2d')]['filter']){_0x4f8754[_0x907f('0x38')]=_[_0x907f('0x3a')](_0x4f8754['where'],{'$or':_[_0x907f('0x27')](_0x2b8628,function(_0x30db19){if(_0x30db19[_0x907f('0x3b')]!==_0x907f('0x3c')){var _0xf98c4b={};_0xf98c4b[_0x30db19[_0x907f('0x24')]]={'$like':'%'+_0x355d1c['query'][_0x907f('0x3d')]+'%'};return _0xf98c4b;}})});}_0x4f8754=_[_0x907f('0x3a')]({},_0x4f8754,_0x355d1c[_0x907f('0x3e')]);var _0x252a70={'where':_0x4f8754[_0x907f('0x38')]};return db[_0x907f('0x28')][_0x907f('0x1a')](_0x252a70)[_0x907f('0x21')](function(_0x49890d){_0x21003c[_0x907f('0x1a')]=_0x49890d;if(_0x355d1c[_0x907f('0x2d')][_0x907f('0x3f')]){_0x4f8754[_0x907f('0x40')]=[{'all':!![]}];}return db[_0x907f('0x28')][_0x907f('0x41')](_0x4f8754);})['then'](function(_0x46662f){_0x21003c['rows']=_0x46662f;return _0x21003c;})[_0x907f('0x21')](respondWithFilteredResult(_0xbf373f,_0x4f8754))[_0x907f('0x42')](handleError(_0xbf373f,null));};exports[_0x907f('0x43')]=function(_0xa7d26c,_0x3b6434){var _0x5452a1={'raw':![],'where':{'id':_0xa7d26c['params']['id']}},_0x3cdcba={};_0x3cdcba[_0x907f('0x2c')]=_['keys'](db[_0x907f('0x28')][_0x907f('0x29')]);_0x3cdcba[_0x907f('0x2d')]=_[_0x907f('0x2e')](_0xa7d26c['query']);_0x3cdcba['filters']=_['intersection'](_0x3cdcba[_0x907f('0x2c')],_0x3cdcba[_0x907f('0x2d')]);_0x5452a1[_0x907f('0x32')]=_['intersection'](_0x3cdcba[_0x907f('0x2c')],qs[_0x907f('0x31')](_0xa7d26c[_0x907f('0x2d')][_0x907f('0x31')]));_0x5452a1[_0x907f('0x32')]=_0x5452a1[_0x907f('0x32')][_0x907f('0x33')]?_0x5452a1[_0x907f('0x32')]:_0x3cdcba[_0x907f('0x2c')];if(_0xa7d26c['query']['includeAll']){_0x5452a1[_0x907f('0x40')]=[{'all':!![]}];}_0x5452a1=_[_0x907f('0x3a')]({},_0x5452a1,_0xa7d26c[_0x907f('0x3e')]);return db[_0x907f('0x28')][_0x907f('0x44')](_0x5452a1)[_0x907f('0x21')](handleEntityNotFound(_0x3b6434,null))['then'](respondWithResult(_0x3b6434,null))['catch'](handleError(_0x3b6434,null));};exports[_0x907f('0x45')]=function(_0x5ebb38,_0x22d58d){return db[_0x907f('0x28')][_0x907f('0x45')](_0x5ebb38[_0x907f('0x46')],{})[_0x907f('0x21')](respondWithResult(_0x22d58d,0xc9))['catch'](handleError(_0x22d58d,null));};exports[_0x907f('0x20')]=function(_0x4297c9,_0x16ffb7){if(_0x4297c9[_0x907f('0x46')]['id']){delete _0x4297c9[_0x907f('0x46')]['id'];}return db[_0x907f('0x28')][_0x907f('0x44')]({'where':{'id':_0x4297c9[_0x907f('0x47')]['id']}})['then'](handleEntityNotFound(_0x16ffb7,null))[_0x907f('0x21')](saveUpdates(_0x4297c9[_0x907f('0x46')],null))[_0x907f('0x21')](respondWithResult(_0x16ffb7,null))[_0x907f('0x42')](handleError(_0x16ffb7,null));};exports['destroy']=function(_0x30d8e0,_0x5cdc6a){return db[_0x907f('0x28')][_0x907f('0x44')]({'where':{'id':_0x30d8e0['params']['id']}})[_0x907f('0x21')](handleEntityNotFound(_0x5cdc6a,null))[_0x907f('0x21')](removeEntity(_0x5cdc6a,null))[_0x907f('0x42')](handleError(_0x5cdc6a,null));};exports[_0x907f('0x48')]=function(_0x3ba0,_0x35e9c8,_0x2db5f0){var _0x3df5c7={};var _0x109176={};var _0xa4c877;var _0x1f7352;return db[_0x907f('0x28')][_0x907f('0x49')]({'where':{'id':_0x3ba0['params']['id']}})['then'](handleEntityNotFound(_0x35e9c8,null))['then'](function(_0x911488){if(_0x911488){_0xa4c877=_0x911488;_0x109176['model']=_['keys'](db[_0x907f('0x4a')][_0x907f('0x29')]);_0x109176[_0x907f('0x2d')]=_['keys'](_0x3ba0['query']);_0x109176[_0x907f('0x2f')]=_[_0x907f('0x30')](_0x109176[_0x907f('0x2c')],_0x109176[_0x907f('0x2d')]);_0x3df5c7[_0x907f('0x32')]=_[_0x907f('0x30')](_0x109176['model'],qs['fields'](_0x3ba0['query'][_0x907f('0x31')]));_0x3df5c7[_0x907f('0x32')]=_0x3df5c7['attributes'][_0x907f('0x33')]?_0x3df5c7[_0x907f('0x32')]:_0x109176[_0x907f('0x2c')];_0x3df5c7[_0x907f('0x36')]=qs['sort'](_0x3ba0['query'][_0x907f('0x37')]);_0x3df5c7[_0x907f('0x38')]=qs[_0x907f('0x2f')](_[_0x907f('0x39')](_0x3ba0[_0x907f('0x2d')],_0x109176[_0x907f('0x2f')]));if(_0x3ba0['query'][_0x907f('0x3d')]){_0x3df5c7[_0x907f('0x38')]=_['merge'](_0x3df5c7[_0x907f('0x38')],{'$or':_[_0x907f('0x27')](_0x3df5c7[_0x907f('0x32')],function(_0x4f5b22){var _0x5783ee={};_0x5783ee[_0x4f5b22]={'$like':'%'+_0x3ba0[_0x907f('0x2d')]['filter']+'%'};return _0x5783ee;})});}_0x3df5c7=_['merge']({},_0x3df5c7,_0x3ba0[_0x907f('0x3e')]);return _0xa4c877[_0x907f('0x48')](_0x3df5c7);}})[_0x907f('0x21')](function(_0x48f0b8){if(_0x48f0b8){_0x1f7352=_0x48f0b8[_0x907f('0x33')];if(!_0x3ba0[_0x907f('0x2d')]['hasOwnProperty'](_0x907f('0x35'))){_0x3df5c7[_0x907f('0x19')]=qs[_0x907f('0x19')](_0x3ba0[_0x907f('0x2d')][_0x907f('0x19')]);_0x3df5c7['offset']=qs['offset'](_0x3ba0[_0x907f('0x2d')][_0x907f('0x17')]);}return _0xa4c877['getFields'](_0x3df5c7);}})[_0x907f('0x21')](function(_0x24f156){if(_0x24f156){return _0x24f156?{'count':_0x1f7352,'rows':_0x24f156}:null;}})[_0x907f('0x21')](respondWithResult(_0x35e9c8,null))[_0x907f('0x42')](handleError(_0x35e9c8,null));};exports[_0x907f('0x4b')]=function(_0x2daff6,_0x4305e1,_0x1530d5){var _0x5393b3={};var _0x2fe6f2={};var _0x2cf0c4;var _0x5d1d97;return db[_0x907f('0x28')][_0x907f('0x49')]({'where':{'id':_0x2daff6[_0x907f('0x47')]['id']}})[_0x907f('0x21')](handleEntityNotFound(_0x4305e1,null))[_0x907f('0x21')](function(_0x58a9be){if(_0x58a9be){_0x2cf0c4=_0x58a9be;_0x2fe6f2[_0x907f('0x2c')]=_[_0x907f('0x2e')](db[_0x907f('0x4a')][_0x907f('0x29')]);_0x2fe6f2[_0x907f('0x2d')]=_[_0x907f('0x2e')](_0x2daff6[_0x907f('0x2d')]);_0x2fe6f2[_0x907f('0x2f')]=_[_0x907f('0x30')](_0x2fe6f2[_0x907f('0x2c')],_0x2fe6f2[_0x907f('0x2d')]);_0x5393b3[_0x907f('0x32')]=_[_0x907f('0x30')](_0x2fe6f2[_0x907f('0x2c')],qs['fields'](_0x2daff6[_0x907f('0x2d')][_0x907f('0x31')]));_0x5393b3['attributes']=_0x5393b3['attributes']['length']?_0x5393b3['attributes']:_0x2fe6f2[_0x907f('0x2c')];_0x5393b3[_0x907f('0x36')]=qs[_0x907f('0x37')](_0x2daff6[_0x907f('0x2d')]['sort']);_0x5393b3['where']=qs[_0x907f('0x2f')](_[_0x907f('0x39')](_0x2daff6[_0x907f('0x2d')],_0x2fe6f2['filters']));if(_0x2daff6['query'][_0x907f('0x3d')]){_0x5393b3[_0x907f('0x38')]=_[_0x907f('0x3a')](_0x5393b3['where'],{'$or':_[_0x907f('0x27')](_0x5393b3[_0x907f('0x32')],function(_0x4df386){var _0x103eb2={};_0x103eb2[_0x4df386]={'$like':'%'+_0x2daff6[_0x907f('0x2d')][_0x907f('0x3d')]+'%'};return _0x103eb2;})});}_0x5393b3=_[_0x907f('0x3a')]({},_0x5393b3,_0x2daff6[_0x907f('0x3e')]);return _0x2cf0c4[_0x907f('0x4b')](_0x5393b3);}})[_0x907f('0x21')](function(_0x5cad20){if(_0x5cad20){_0x5d1d97=_0x5cad20[_0x907f('0x33')];if(!_0x2daff6[_0x907f('0x2d')][_0x907f('0x34')](_0x907f('0x35'))){_0x5393b3[_0x907f('0x19')]=qs[_0x907f('0x19')](_0x2daff6[_0x907f('0x2d')][_0x907f('0x19')]);_0x5393b3['offset']=qs['offset'](_0x2daff6['query'][_0x907f('0x17')]);}return _0x2cf0c4[_0x907f('0x4b')](_0x5393b3);}})[_0x907f('0x21')](function(_0x252657){if(_0x252657){return _0x252657?{'count':_0x5d1d97,'rows':_0x252657}:null;}})['then'](respondWithResult(_0x4305e1,null))[_0x907f('0x42')](handleError(_0x4305e1,null));};exports[_0x907f('0x4c')]=function(_0x399c4f,_0x34b5cb,_0x768f41){var _0x14a9e9={};var _0x3ae702={};var _0x475229;var _0x1fc490;return db[_0x907f('0x28')][_0x907f('0x49')]({'where':{'id':_0x399c4f[_0x907f('0x47')]['id']}})[_0x907f('0x21')](handleEntityNotFound(_0x34b5cb,null))[_0x907f('0x21')](function(_0x244a0c){if(_0x244a0c){_0x475229=_0x244a0c;_0x3ae702[_0x907f('0x2c')]=_[_0x907f('0x2e')](db[_0x907f('0x4a')][_0x907f('0x29')]);_0x3ae702[_0x907f('0x2d')]=_[_0x907f('0x2e')](_0x399c4f[_0x907f('0x2d')]);_0x3ae702[_0x907f('0x2f')]=_[_0x907f('0x30')](_0x3ae702[_0x907f('0x2c')],_0x3ae702['query']);_0x14a9e9['attributes']=_[_0x907f('0x30')](_0x3ae702[_0x907f('0x2c')],qs[_0x907f('0x31')](_0x399c4f[_0x907f('0x2d')][_0x907f('0x31')]));_0x14a9e9[_0x907f('0x32')]=_0x14a9e9[_0x907f('0x32')][_0x907f('0x33')]?_0x14a9e9['attributes']:_0x3ae702[_0x907f('0x2c')];_0x14a9e9[_0x907f('0x36')]=qs['sort'](_0x399c4f[_0x907f('0x2d')][_0x907f('0x37')]);_0x14a9e9[_0x907f('0x38')]=qs[_0x907f('0x2f')](_[_0x907f('0x39')](_0x399c4f[_0x907f('0x2d')],_0x3ae702[_0x907f('0x2f')]));if(_0x399c4f[_0x907f('0x2d')]['filter']){_0x14a9e9[_0x907f('0x38')]=_[_0x907f('0x3a')](_0x14a9e9[_0x907f('0x38')],{'$or':_[_0x907f('0x27')](_0x14a9e9[_0x907f('0x32')],function(_0x694103){var _0x1a0841={};_0x1a0841[_0x694103]={'$like':'%'+_0x399c4f['query']['filter']+'%'};return _0x1a0841;})});}_0x14a9e9=_['merge']({},_0x14a9e9,_0x399c4f[_0x907f('0x3e')]);return _0x475229[_0x907f('0x4c')](_0x14a9e9);}})['then'](function(_0x392062){if(_0x392062){_0x1fc490=_0x392062[_0x907f('0x33')];if(!_0x399c4f[_0x907f('0x2d')][_0x907f('0x34')](_0x907f('0x35'))){_0x14a9e9[_0x907f('0x19')]=qs[_0x907f('0x19')](_0x399c4f['query']['limit']);_0x14a9e9[_0x907f('0x17')]=qs[_0x907f('0x17')](_0x399c4f['query'][_0x907f('0x17')]);}return _0x475229[_0x907f('0x4c')](_0x14a9e9);}})[_0x907f('0x21')](function(_0x51d8a2){if(_0x51d8a2){return _0x51d8a2?{'count':_0x1fc490,'rows':_0x51d8a2}:null;}})[_0x907f('0x21')](respondWithResult(_0x34b5cb,null))['catch'](handleError(_0x34b5cb,null));};exports[_0x907f('0x4d')]=function(_0x5da128,_0x4a38ab,_0x3043a7){var _0x18d9e3={};var _0x5636f8={};var _0xc592;var _0x39f331;return db[_0x907f('0x28')][_0x907f('0x49')]({'where':{'id':_0x5da128[_0x907f('0x47')]['id']}})[_0x907f('0x21')](handleEntityNotFound(_0x4a38ab,null))[_0x907f('0x21')](function(_0x48c8b8){if(_0x48c8b8){_0xc592=_0x48c8b8;_0x5636f8[_0x907f('0x2c')]=_[_0x907f('0x2e')](db[_0x907f('0x4e')][_0x907f('0x29')]);_0x5636f8[_0x907f('0x2d')]=_[_0x907f('0x2e')](_0x5da128[_0x907f('0x2d')]);_0x5636f8[_0x907f('0x2f')]=_[_0x907f('0x30')](_0x5636f8['model'],_0x5636f8['query']);_0x18d9e3[_0x907f('0x32')]=_[_0x907f('0x30')](_0x5636f8['model'],qs['fields'](_0x5da128[_0x907f('0x2d')][_0x907f('0x31')]));_0x18d9e3['attributes']=_0x18d9e3[_0x907f('0x32')][_0x907f('0x33')]?_0x18d9e3[_0x907f('0x32')]:_0x5636f8[_0x907f('0x2c')];_0x18d9e3[_0x907f('0x36')]=qs[_0x907f('0x37')](_0x5da128['query']['sort']);_0x18d9e3[_0x907f('0x38')]=qs[_0x907f('0x2f')](_['pick'](_0x5da128[_0x907f('0x2d')],_0x5636f8[_0x907f('0x2f')]));if(_0x5da128[_0x907f('0x2d')]['filter']){_0x18d9e3[_0x907f('0x38')]=_[_0x907f('0x3a')](_0x18d9e3['where'],{'$or':_['map'](_0x18d9e3[_0x907f('0x32')],function(_0x30c388){var _0xd61d66={};_0xd61d66[_0x30c388]={'$like':'%'+_0x5da128['query'][_0x907f('0x3d')]+'%'};return _0xd61d66;})});}_0x18d9e3=_[_0x907f('0x3a')]({},_0x18d9e3,_0x5da128['options']);return _0xc592['getTags'](_0x18d9e3);}})['then'](function(_0x104849){if(_0x104849){_0x39f331=_0x104849[_0x907f('0x33')];if(!_0x5da128[_0x907f('0x2d')][_0x907f('0x34')](_0x907f('0x35'))){_0x18d9e3['limit']=qs['limit'](_0x5da128['query'][_0x907f('0x19')]);_0x18d9e3['offset']=qs['offset'](_0x5da128['query'][_0x907f('0x17')]);}return _0xc592[_0x907f('0x4d')](_0x18d9e3);}})['then'](function(_0x2f53c0){if(_0x2f53c0){return _0x2f53c0?{'count':_0x39f331,'rows':_0x2f53c0}:null;}})['then'](respondWithResult(_0x4a38ab,null))[_0x907f('0x42')](handleError(_0x4a38ab,null));};exports[_0x907f('0x4f')]=function(_0x226ed1,_0x4da063,_0x2e1c2c){if(_0x226ed1['body']['id']){delete _0x226ed1[_0x907f('0x46')]['id'];}return db[_0x907f('0x28')][_0x907f('0x49')]({'where':{'id':_0x226ed1[_0x907f('0x47')]['id']}})[_0x907f('0x21')](handleEntityNotFound(_0x4da063,null))[_0x907f('0x21')](function(_0x3fcc18){if(_0x3fcc18){return _0x3fcc18[_0x907f('0x4f')](_0x226ed1[_0x907f('0x46')]['ids']||[]);}return null;})[_0x907f('0x21')](respondWithResult(_0x4da063,null))[_0x907f('0x42')](handleError(_0x4da063,null));}; \ No newline at end of file +var _0x3d47=['query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','type','filter','options','includeAll','include','FreshdeskConfiguration','findAll','rows','show','params','find','catch','create','body','findOne','order','getFields','getSubjects','FreshdeskField','hasOwnProperty','getDescriptions','getTags','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','rawAttributes','key','model','map'];(function(_0x8ae4,_0x4eaf07){var _0x5529c2=function(_0xe79fe9){while(--_0xe79fe9){_0x8ae4['push'](_0x8ae4['shift']());}};_0x5529c2(++_0x4eaf07);}(_0x3d47,0x1bd));var _0x73d4=function(_0x1e6423,_0xabb0a7){_0x1e6423=_0x1e6423-0x0;var _0x5942c4=_0x3d47[_0x1e6423];return _0x5942c4;};'use strict';var emlformat=require(_0x73d4('0x0'));var rimraf=require(_0x73d4('0x1'));var zipdir=require(_0x73d4('0x2'));var jsonpatch=require(_0x73d4('0x3'));var rp=require(_0x73d4('0x4'));var moment=require(_0x73d4('0x5'));var BPromise=require(_0x73d4('0x6'));var Mustache=require(_0x73d4('0x7'));var util=require(_0x73d4('0x8'));var path=require('path');var sox=require(_0x73d4('0x9'));var csv=require(_0x73d4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x73d4('0xb'));var _=require('lodash');var squel=require(_0x73d4('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x73d4('0xd'));var toCsv=require(_0x73d4('0xa'));var querystring=require(_0x73d4('0xe'));var Papa=require(_0x73d4('0xf'));var Redis=require('ioredis');var authService=require(_0x73d4('0x10'));var qs=require(_0x73d4('0x11'));var as=require(_0x73d4('0x12'));var hardwareService=require(_0x73d4('0x13'));var logger=require(_0x73d4('0x14'))(_0x73d4('0x15'));var utils=require(_0x73d4('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x73d4('0x17'));var db=require(_0x73d4('0x18'))['db'];function respondWithStatusCode(_0x28b953,_0x20893c){_0x20893c=_0x20893c||0xcc;return function(_0x30750b){if(_0x30750b){return _0x28b953[_0x73d4('0x19')](_0x20893c);}return _0x28b953[_0x73d4('0x1a')](_0x20893c)[_0x73d4('0x1b')]();};}function respondWithResult(_0x5c1bef,_0xdded7b){_0xdded7b=_0xdded7b||0xc8;return function(_0x263e5c){if(_0x263e5c){return _0x5c1bef[_0x73d4('0x1a')](_0xdded7b)[_0x73d4('0x1c')](_0x263e5c);}};}function respondWithFilteredResult(_0x58760a,_0x554e4d){return function(_0x16c937){if(_0x16c937){var _0x5e6233=typeof _0x554e4d[_0x73d4('0x1d')]===_0x73d4('0x1e')&&typeof _0x554e4d[_0x73d4('0x1f')]===_0x73d4('0x1e');var _0x367753=_0x16c937[_0x73d4('0x20')];var _0x39ed94=_0x5e6233?0x0:_0x554e4d['offset'];var _0x3dd571=_0x5e6233?_0x16c937[_0x73d4('0x20')]:_0x554e4d[_0x73d4('0x1d')]+_0x554e4d[_0x73d4('0x1f')];var _0x32cef0;if(_0x3dd571>=_0x367753){_0x3dd571=_0x367753;_0x32cef0=0xc8;}else{_0x32cef0=0xce;}_0x58760a[_0x73d4('0x1a')](_0x32cef0);return _0x58760a[_0x73d4('0x21')](_0x73d4('0x22'),_0x39ed94+'-'+_0x3dd571+'/'+_0x367753)[_0x73d4('0x1c')](_0x16c937);}return null;};}function patchUpdates(_0x17937d){return function(_0x30f019){try{jsonpatch[_0x73d4('0x23')](_0x30f019,_0x17937d,!![]);}catch(_0x4ad838){return BPromise['reject'](_0x4ad838);}return _0x30f019['save']();};}function saveUpdates(_0x3a36d7,_0x57d1d0){return function(_0x57097f){if(_0x57097f){return _0x57097f[_0x73d4('0x24')](_0x3a36d7)[_0x73d4('0x25')](function(_0x18b3e6){return _0x18b3e6;});}return null;};}function removeEntity(_0x4709b9,_0x9f0432){return function(_0x518c93){if(_0x518c93){return _0x518c93[_0x73d4('0x26')]()[_0x73d4('0x25')](function(){_0x4709b9[_0x73d4('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf97a27,_0x3a49fb){return function(_0x4453a7){if(!_0x4453a7){_0xf97a27[_0x73d4('0x19')](0x194);}return _0x4453a7;};}function handleError(_0x176bfd,_0x521490){_0x521490=_0x521490||0x1f4;return function(_0x49e955){logger[_0x73d4('0x27')](_0x49e955[_0x73d4('0x28')]);if(_0x49e955[_0x73d4('0x29')]){delete _0x49e955[_0x73d4('0x29')];}_0x176bfd[_0x73d4('0x1a')](_0x521490)[_0x73d4('0x2a')](_0x49e955);};}exports['index']=function(_0x4cdb15,_0x2271ef){var _0x426b33={},_0x1e5bd4={},_0x1cc85a={'count':0x0,'rows':[]};var _0x4cdc57=_['map'](db['FreshdeskConfiguration'][_0x73d4('0x2b')],function(_0x2489f5){return{'name':_0x2489f5['fieldName'],'type':_0x2489f5['type'][_0x73d4('0x2c')]};});_0x1e5bd4[_0x73d4('0x2d')]=_[_0x73d4('0x2e')](_0x4cdc57,_0x73d4('0x29'));_0x1e5bd4[_0x73d4('0x2f')]=_[_0x73d4('0x30')](_0x4cdb15['query']);_0x1e5bd4[_0x73d4('0x31')]=_[_0x73d4('0x32')](_0x1e5bd4[_0x73d4('0x2d')],_0x1e5bd4[_0x73d4('0x2f')]);_0x426b33[_0x73d4('0x33')]=_[_0x73d4('0x32')](_0x1e5bd4[_0x73d4('0x2d')],qs[_0x73d4('0x34')](_0x4cdb15[_0x73d4('0x2f')][_0x73d4('0x34')]));_0x426b33[_0x73d4('0x33')]=_0x426b33['attributes'][_0x73d4('0x35')]?_0x426b33[_0x73d4('0x33')]:_0x1e5bd4[_0x73d4('0x2d')];if(!_0x4cdb15[_0x73d4('0x2f')]['hasOwnProperty'](_0x73d4('0x36'))){_0x426b33[_0x73d4('0x1f')]=qs[_0x73d4('0x1f')](_0x4cdb15[_0x73d4('0x2f')]['limit']);_0x426b33[_0x73d4('0x1d')]=qs[_0x73d4('0x1d')](_0x4cdb15['query'][_0x73d4('0x1d')]);}_0x426b33['order']=qs['sort'](_0x4cdb15[_0x73d4('0x2f')][_0x73d4('0x37')]);_0x426b33[_0x73d4('0x38')]=qs['filters'](_[_0x73d4('0x39')](_0x4cdb15[_0x73d4('0x2f')],_0x1e5bd4['filters']),_0x4cdc57);if(_0x4cdb15['query']['filter']){_0x426b33[_0x73d4('0x38')]=_[_0x73d4('0x3a')](_0x426b33[_0x73d4('0x38')],{'$or':_[_0x73d4('0x2e')](_0x4cdc57,function(_0x5e5425){if(_0x5e5425[_0x73d4('0x3b')]!=='VIRTUAL'){var _0x233e26={};_0x233e26[_0x5e5425[_0x73d4('0x29')]]={'$like':'%'+_0x4cdb15['query'][_0x73d4('0x3c')]+'%'};return _0x233e26;}})});}_0x426b33=_[_0x73d4('0x3a')]({},_0x426b33,_0x4cdb15[_0x73d4('0x3d')]);var _0x142b06={'where':_0x426b33[_0x73d4('0x38')]};return db['FreshdeskConfiguration'][_0x73d4('0x20')](_0x142b06)[_0x73d4('0x25')](function(_0x5f1ed6){_0x1cc85a[_0x73d4('0x20')]=_0x5f1ed6;if(_0x4cdb15[_0x73d4('0x2f')][_0x73d4('0x3e')]){_0x426b33[_0x73d4('0x3f')]=[{'all':!![]}];}return db[_0x73d4('0x40')][_0x73d4('0x41')](_0x426b33);})[_0x73d4('0x25')](function(_0x4e747a){_0x1cc85a[_0x73d4('0x42')]=_0x4e747a;return _0x1cc85a;})[_0x73d4('0x25')](respondWithFilteredResult(_0x2271ef,_0x426b33))['catch'](handleError(_0x2271ef,null));};exports[_0x73d4('0x43')]=function(_0x59c9d9,_0x460c78){var _0x77d8e5={'raw':![],'where':{'id':_0x59c9d9[_0x73d4('0x44')]['id']}},_0x1966dd={};_0x1966dd['model']=_[_0x73d4('0x30')](db[_0x73d4('0x40')]['rawAttributes']);_0x1966dd[_0x73d4('0x2f')]=_[_0x73d4('0x30')](_0x59c9d9['query']);_0x1966dd['filters']=_[_0x73d4('0x32')](_0x1966dd[_0x73d4('0x2d')],_0x1966dd[_0x73d4('0x2f')]);_0x77d8e5[_0x73d4('0x33')]=_[_0x73d4('0x32')](_0x1966dd[_0x73d4('0x2d')],qs['fields'](_0x59c9d9[_0x73d4('0x2f')][_0x73d4('0x34')]));_0x77d8e5[_0x73d4('0x33')]=_0x77d8e5[_0x73d4('0x33')][_0x73d4('0x35')]?_0x77d8e5[_0x73d4('0x33')]:_0x1966dd[_0x73d4('0x2d')];if(_0x59c9d9[_0x73d4('0x2f')][_0x73d4('0x3e')]){_0x77d8e5[_0x73d4('0x3f')]=[{'all':!![]}];}_0x77d8e5=_['merge']({},_0x77d8e5,_0x59c9d9[_0x73d4('0x3d')]);return db[_0x73d4('0x40')][_0x73d4('0x45')](_0x77d8e5)[_0x73d4('0x25')](handleEntityNotFound(_0x460c78,null))[_0x73d4('0x25')](respondWithResult(_0x460c78,null))[_0x73d4('0x46')](handleError(_0x460c78,null));};exports[_0x73d4('0x47')]=function(_0x575bab,_0x256582){return db[_0x73d4('0x40')][_0x73d4('0x47')](_0x575bab['body'],{})['then'](respondWithResult(_0x256582,0xc9))[_0x73d4('0x46')](handleError(_0x256582,null));};exports[_0x73d4('0x24')]=function(_0x5513b0,_0x7b66d8){if(_0x5513b0[_0x73d4('0x48')]['id']){delete _0x5513b0[_0x73d4('0x48')]['id'];}return db[_0x73d4('0x40')][_0x73d4('0x45')]({'where':{'id':_0x5513b0[_0x73d4('0x44')]['id']}})[_0x73d4('0x25')](handleEntityNotFound(_0x7b66d8,null))[_0x73d4('0x25')](saveUpdates(_0x5513b0[_0x73d4('0x48')],null))[_0x73d4('0x25')](respondWithResult(_0x7b66d8,null))[_0x73d4('0x46')](handleError(_0x7b66d8,null));};exports['destroy']=function(_0x4527d0,_0x595ddc){return db[_0x73d4('0x40')]['find']({'where':{'id':_0x4527d0[_0x73d4('0x44')]['id']}})[_0x73d4('0x25')](handleEntityNotFound(_0x595ddc,null))[_0x73d4('0x25')](removeEntity(_0x595ddc,null))[_0x73d4('0x46')](handleError(_0x595ddc,null));};exports['getFields']=function(_0x531450,_0x32aef3,_0x3c47da){var _0x339fc9={};var _0x3da2e3={};var _0x13b833;var _0x2bd980;return db[_0x73d4('0x40')][_0x73d4('0x49')]({'where':{'id':_0x531450[_0x73d4('0x44')]['id']}})[_0x73d4('0x25')](handleEntityNotFound(_0x32aef3,null))[_0x73d4('0x25')](function(_0x46b69d){if(_0x46b69d){_0x13b833=_0x46b69d;_0x3da2e3[_0x73d4('0x2d')]=_['keys'](db['FreshdeskField'][_0x73d4('0x2b')]);_0x3da2e3[_0x73d4('0x2f')]=_[_0x73d4('0x30')](_0x531450[_0x73d4('0x2f')]);_0x3da2e3[_0x73d4('0x31')]=_[_0x73d4('0x32')](_0x3da2e3[_0x73d4('0x2d')],_0x3da2e3[_0x73d4('0x2f')]);_0x339fc9[_0x73d4('0x33')]=_[_0x73d4('0x32')](_0x3da2e3[_0x73d4('0x2d')],qs[_0x73d4('0x34')](_0x531450['query'][_0x73d4('0x34')]));_0x339fc9[_0x73d4('0x33')]=_0x339fc9[_0x73d4('0x33')][_0x73d4('0x35')]?_0x339fc9[_0x73d4('0x33')]:_0x3da2e3[_0x73d4('0x2d')];_0x339fc9[_0x73d4('0x4a')]=qs[_0x73d4('0x37')](_0x531450['query'][_0x73d4('0x37')]);_0x339fc9['where']=qs[_0x73d4('0x31')](_[_0x73d4('0x39')](_0x531450[_0x73d4('0x2f')],_0x3da2e3[_0x73d4('0x31')]));if(_0x531450[_0x73d4('0x2f')]['filter']){_0x339fc9['where']=_[_0x73d4('0x3a')](_0x339fc9[_0x73d4('0x38')],{'$or':_[_0x73d4('0x2e')](_0x339fc9[_0x73d4('0x33')],function(_0x44d8ad){var _0xa13796={};_0xa13796[_0x44d8ad]={'$like':'%'+_0x531450['query'][_0x73d4('0x3c')]+'%'};return _0xa13796;})});}_0x339fc9=_[_0x73d4('0x3a')]({},_0x339fc9,_0x531450[_0x73d4('0x3d')]);return _0x13b833[_0x73d4('0x4b')](_0x339fc9);}})[_0x73d4('0x25')](function(_0x43cf7e){if(_0x43cf7e){_0x2bd980=_0x43cf7e['length'];if(!_0x531450[_0x73d4('0x2f')]['hasOwnProperty'](_0x73d4('0x36'))){_0x339fc9[_0x73d4('0x1f')]=qs[_0x73d4('0x1f')](_0x531450['query'][_0x73d4('0x1f')]);_0x339fc9['offset']=qs[_0x73d4('0x1d')](_0x531450['query']['offset']);}return _0x13b833['getFields'](_0x339fc9);}})[_0x73d4('0x25')](function(_0x112b20){if(_0x112b20){return _0x112b20?{'count':_0x2bd980,'rows':_0x112b20}:null;}})['then'](respondWithResult(_0x32aef3,null))[_0x73d4('0x46')](handleError(_0x32aef3,null));};exports[_0x73d4('0x4c')]=function(_0x7be5f9,_0x4a1f41,_0x2a33a2){var _0x47c238={};var _0x32a635={};var _0x4084bc;var _0x50994e;return db[_0x73d4('0x40')][_0x73d4('0x49')]({'where':{'id':_0x7be5f9[_0x73d4('0x44')]['id']}})['then'](handleEntityNotFound(_0x4a1f41,null))['then'](function(_0x1646d5){if(_0x1646d5){_0x4084bc=_0x1646d5;_0x32a635[_0x73d4('0x2d')]=_[_0x73d4('0x30')](db[_0x73d4('0x4d')][_0x73d4('0x2b')]);_0x32a635[_0x73d4('0x2f')]=_['keys'](_0x7be5f9[_0x73d4('0x2f')]);_0x32a635[_0x73d4('0x31')]=_[_0x73d4('0x32')](_0x32a635[_0x73d4('0x2d')],_0x32a635['query']);_0x47c238[_0x73d4('0x33')]=_[_0x73d4('0x32')](_0x32a635[_0x73d4('0x2d')],qs['fields'](_0x7be5f9[_0x73d4('0x2f')][_0x73d4('0x34')]));_0x47c238[_0x73d4('0x33')]=_0x47c238[_0x73d4('0x33')][_0x73d4('0x35')]?_0x47c238[_0x73d4('0x33')]:_0x32a635[_0x73d4('0x2d')];_0x47c238[_0x73d4('0x4a')]=qs[_0x73d4('0x37')](_0x7be5f9[_0x73d4('0x2f')][_0x73d4('0x37')]);_0x47c238['where']=qs[_0x73d4('0x31')](_['pick'](_0x7be5f9[_0x73d4('0x2f')],_0x32a635[_0x73d4('0x31')]));if(_0x7be5f9['query'][_0x73d4('0x3c')]){_0x47c238['where']=_[_0x73d4('0x3a')](_0x47c238['where'],{'$or':_[_0x73d4('0x2e')](_0x47c238[_0x73d4('0x33')],function(_0xb08623){var _0x511b56={};_0x511b56[_0xb08623]={'$like':'%'+_0x7be5f9['query'][_0x73d4('0x3c')]+'%'};return _0x511b56;})});}_0x47c238=_[_0x73d4('0x3a')]({},_0x47c238,_0x7be5f9[_0x73d4('0x3d')]);return _0x4084bc['getSubjects'](_0x47c238);}})[_0x73d4('0x25')](function(_0x5cf5eb){if(_0x5cf5eb){_0x50994e=_0x5cf5eb[_0x73d4('0x35')];if(!_0x7be5f9[_0x73d4('0x2f')][_0x73d4('0x4e')]('nolimit')){_0x47c238[_0x73d4('0x1f')]=qs[_0x73d4('0x1f')](_0x7be5f9[_0x73d4('0x2f')][_0x73d4('0x1f')]);_0x47c238[_0x73d4('0x1d')]=qs[_0x73d4('0x1d')](_0x7be5f9['query'][_0x73d4('0x1d')]);}return _0x4084bc[_0x73d4('0x4c')](_0x47c238);}})[_0x73d4('0x25')](function(_0x196d90){if(_0x196d90){return _0x196d90?{'count':_0x50994e,'rows':_0x196d90}:null;}})[_0x73d4('0x25')](respondWithResult(_0x4a1f41,null))['catch'](handleError(_0x4a1f41,null));};exports['getDescriptions']=function(_0x3baa7e,_0x1578de,_0xe6db08){var _0x21e78a={};var _0x266afb={};var _0x18f631;var _0x4393d4;return db[_0x73d4('0x40')]['findOne']({'where':{'id':_0x3baa7e[_0x73d4('0x44')]['id']}})[_0x73d4('0x25')](handleEntityNotFound(_0x1578de,null))[_0x73d4('0x25')](function(_0x4208db){if(_0x4208db){_0x18f631=_0x4208db;_0x266afb['model']=_[_0x73d4('0x30')](db[_0x73d4('0x4d')][_0x73d4('0x2b')]);_0x266afb[_0x73d4('0x2f')]=_['keys'](_0x3baa7e[_0x73d4('0x2f')]);_0x266afb[_0x73d4('0x31')]=_[_0x73d4('0x32')](_0x266afb[_0x73d4('0x2d')],_0x266afb['query']);_0x21e78a[_0x73d4('0x33')]=_[_0x73d4('0x32')](_0x266afb['model'],qs[_0x73d4('0x34')](_0x3baa7e[_0x73d4('0x2f')]['fields']));_0x21e78a[_0x73d4('0x33')]=_0x21e78a[_0x73d4('0x33')]['length']?_0x21e78a['attributes']:_0x266afb[_0x73d4('0x2d')];_0x21e78a[_0x73d4('0x4a')]=qs[_0x73d4('0x37')](_0x3baa7e[_0x73d4('0x2f')][_0x73d4('0x37')]);_0x21e78a['where']=qs[_0x73d4('0x31')](_[_0x73d4('0x39')](_0x3baa7e[_0x73d4('0x2f')],_0x266afb['filters']));if(_0x3baa7e[_0x73d4('0x2f')]['filter']){_0x21e78a[_0x73d4('0x38')]=_['merge'](_0x21e78a[_0x73d4('0x38')],{'$or':_[_0x73d4('0x2e')](_0x21e78a[_0x73d4('0x33')],function(_0x558a57){var _0xb2815b={};_0xb2815b[_0x558a57]={'$like':'%'+_0x3baa7e['query']['filter']+'%'};return _0xb2815b;})});}_0x21e78a=_[_0x73d4('0x3a')]({},_0x21e78a,_0x3baa7e[_0x73d4('0x3d')]);return _0x18f631['getDescriptions'](_0x21e78a);}})['then'](function(_0x3bf92f){if(_0x3bf92f){_0x4393d4=_0x3bf92f['length'];if(!_0x3baa7e[_0x73d4('0x2f')][_0x73d4('0x4e')](_0x73d4('0x36'))){_0x21e78a[_0x73d4('0x1f')]=qs['limit'](_0x3baa7e[_0x73d4('0x2f')][_0x73d4('0x1f')]);_0x21e78a[_0x73d4('0x1d')]=qs[_0x73d4('0x1d')](_0x3baa7e[_0x73d4('0x2f')]['offset']);}return _0x18f631[_0x73d4('0x4f')](_0x21e78a);}})[_0x73d4('0x25')](function(_0x37e910){if(_0x37e910){return _0x37e910?{'count':_0x4393d4,'rows':_0x37e910}:null;}})[_0x73d4('0x25')](respondWithResult(_0x1578de,null))[_0x73d4('0x46')](handleError(_0x1578de,null));};exports[_0x73d4('0x50')]=function(_0xd4ccec,_0x150590,_0x317947){var _0x3ace9e={};var _0x4c25fc={};var _0x3e40c7;var _0x1e007e;return db[_0x73d4('0x40')][_0x73d4('0x49')]({'where':{'id':_0xd4ccec[_0x73d4('0x44')]['id']}})[_0x73d4('0x25')](handleEntityNotFound(_0x150590,null))[_0x73d4('0x25')](function(_0x18ab3b){if(_0x18ab3b){_0x3e40c7=_0x18ab3b;_0x4c25fc[_0x73d4('0x2d')]=_[_0x73d4('0x30')](db['Tag'][_0x73d4('0x2b')]);_0x4c25fc[_0x73d4('0x2f')]=_['keys'](_0xd4ccec[_0x73d4('0x2f')]);_0x4c25fc[_0x73d4('0x31')]=_[_0x73d4('0x32')](_0x4c25fc[_0x73d4('0x2d')],_0x4c25fc['query']);_0x3ace9e[_0x73d4('0x33')]=_['intersection'](_0x4c25fc[_0x73d4('0x2d')],qs[_0x73d4('0x34')](_0xd4ccec[_0x73d4('0x2f')][_0x73d4('0x34')]));_0x3ace9e['attributes']=_0x3ace9e['attributes'][_0x73d4('0x35')]?_0x3ace9e['attributes']:_0x4c25fc[_0x73d4('0x2d')];_0x3ace9e[_0x73d4('0x4a')]=qs[_0x73d4('0x37')](_0xd4ccec[_0x73d4('0x2f')][_0x73d4('0x37')]);_0x3ace9e[_0x73d4('0x38')]=qs[_0x73d4('0x31')](_[_0x73d4('0x39')](_0xd4ccec[_0x73d4('0x2f')],_0x4c25fc['filters']));if(_0xd4ccec[_0x73d4('0x2f')][_0x73d4('0x3c')]){_0x3ace9e['where']=_['merge'](_0x3ace9e[_0x73d4('0x38')],{'$or':_[_0x73d4('0x2e')](_0x3ace9e[_0x73d4('0x33')],function(_0x42b0d2){var _0x5bc1fd={};_0x5bc1fd[_0x42b0d2]={'$like':'%'+_0xd4ccec['query'][_0x73d4('0x3c')]+'%'};return _0x5bc1fd;})});}_0x3ace9e=_[_0x73d4('0x3a')]({},_0x3ace9e,_0xd4ccec['options']);return _0x3e40c7['getTags'](_0x3ace9e);}})[_0x73d4('0x25')](function(_0x4d7506){if(_0x4d7506){_0x1e007e=_0x4d7506[_0x73d4('0x35')];if(!_0xd4ccec[_0x73d4('0x2f')][_0x73d4('0x4e')](_0x73d4('0x36'))){_0x3ace9e[_0x73d4('0x1f')]=qs[_0x73d4('0x1f')](_0xd4ccec[_0x73d4('0x2f')][_0x73d4('0x1f')]);_0x3ace9e[_0x73d4('0x1d')]=qs[_0x73d4('0x1d')](_0xd4ccec['query'][_0x73d4('0x1d')]);}return _0x3e40c7['getTags'](_0x3ace9e);}})[_0x73d4('0x25')](function(_0xfcf500){if(_0xfcf500){return _0xfcf500?{'count':_0x1e007e,'rows':_0xfcf500}:null;}})[_0x73d4('0x25')](respondWithResult(_0x150590,null))[_0x73d4('0x46')](handleError(_0x150590,null));};exports[_0x73d4('0x51')]=function(_0x5b284d,_0x4564fa,_0x1a5ccb){if(_0x5b284d['body']['id']){delete _0x5b284d['body']['id'];}return db[_0x73d4('0x40')][_0x73d4('0x49')]({'where':{'id':_0x5b284d['params']['id']}})[_0x73d4('0x25')](handleEntityNotFound(_0x4564fa,null))[_0x73d4('0x25')](function(_0x3a1eba){if(_0x3a1eba){return _0x3a1eba[_0x73d4('0x51')](_0x5b284d[_0x73d4('0x48')]['ids']||[]);}return null;})['then'](respondWithResult(_0x4564fa,null))[_0x73d4('0x46')](handleError(_0x4564fa,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index bed668e..6d77485 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 _0x717a=['../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','util','bluebird','request-promise','rimraf'];(function(_0x1f7392,_0x19c591){var _0x3e28d9=function(_0x446901){while(--_0x446901){_0x1f7392['push'](_0x1f7392['shift']());}};_0x3e28d9(++_0x19c591);}(_0x717a,0x1c7));var _0xa717=function(_0x5a6961,_0xd41ca6){_0x5a6961=_0x5a6961-0x0;var _0x4af0a6=_0x717a[_0x5a6961];return _0x4af0a6;};'use strict';var _=require('lodash');var util=require(_0xa717('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa717('0x1'));var rp=require(_0xa717('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa717('0x3'));var config=require(_0xa717('0x4'));var attributes=require(_0xa717('0x5'));module[_0xa717('0x6')]=function(_0x1b6a5b,_0x7ecea){return _0x1b6a5b[_0xa717('0x7')](_0xa717('0x8'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ff4=['rimraf','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x299100,_0x36369d){var _0x2b9c4f=function(_0x80e717){while(--_0x80e717){_0x299100['push'](_0x299100['shift']());}};_0x2b9c4f(++_0x36369d);}(_0x8ff4,0x1bc));var _0x48ff=function(_0xd06a8b,_0x3ce43e){_0xd06a8b=_0xd06a8b-0x0;var _0xe9b203=_0x8ff4[_0xd06a8b];return _0xe9b203;};'use strict';var _=require(_0x48ff('0x0'));var util=require(_0x48ff('0x1'));var logger=require(_0x48ff('0x2'))(_0x48ff('0x3'));var moment=require(_0x48ff('0x4'));var BPromise=require('bluebird');var rp=require(_0x48ff('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x48ff('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0x120cf8,_0xe69c20){return _0x120cf8[_0x48ff('0x7')](_0x48ff('0x8'),attributes,{'tableName':_0x48ff('0x9'),'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 ee9b30e..cce0347 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 _0x24cf=['util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash'];(function(_0x39b39a,_0x4e84b3){var _0x3e54af=function(_0x171514){while(--_0x171514){_0x39b39a['push'](_0x39b39a['shift']());}};_0x3e54af(++_0x4e84b3);}(_0x24cf,0xe6));var _0xf24c=function(_0x479d81,_0x11e0ff){_0x479d81=_0x479d81-0x0;var _0x37e937=_0x24cf[_0x479d81];return _0x37e937;};'use strict';var _=require(_0xf24c('0x0'));var util=require(_0xf24c('0x1'));var moment=require(_0xf24c('0x2'));var BPromise=require(_0xf24c('0x3'));var rs=require(_0xf24c('0x4'));var fs=require('fs');var Redis=require(_0xf24c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf24c('0x6'));var logger=require('../../config/logger')(_0xf24c('0x7'));var config=require(_0xf24c('0x8'));var jayson=require(_0xf24c('0x9'));var client=jayson['client'][_0xf24c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8ca79a,_0x365105,_0x3eb33c){return new BPromise(function(_0x4948c1,_0xebe15d){return client[_0xf24c('0xb')](_0x8ca79a,_0x3eb33c)[_0xf24c('0xc')](function(_0x1d8722){logger[_0xf24c('0xd')](_0xf24c('0xe'),_0x365105,_0xf24c('0xf'));logger['debug'](_0xf24c('0x10'),_0x365105,_0xf24c('0xf'),JSON['stringify'](_0x1d8722));if(_0x1d8722[_0xf24c('0x11')]){if(_0x1d8722['error'][_0xf24c('0x12')]===0x1f4){logger[_0xf24c('0x11')](_0xf24c('0xe'),_0x365105,_0x1d8722[_0xf24c('0x11')][_0xf24c('0x13')]);return _0xebe15d(_0x1d8722[_0xf24c('0x11')][_0xf24c('0x13')]);}logger[_0xf24c('0x11')](_0xf24c('0xe'),_0x365105,_0x1d8722['error'][_0xf24c('0x13')]);return _0x4948c1(_0x1d8722[_0xf24c('0x11')][_0xf24c('0x13')]);}else{logger[_0xf24c('0xd')](_0xf24c('0xe'),_0x365105,_0xf24c('0xf'));_0x4948c1(_0x1d8722[_0xf24c('0x14')]['message']);}})['catch'](function(_0x52d5c9){logger[_0xf24c('0x11')](_0xf24c('0xe'),_0x365105,_0x52d5c9);_0xebe15d(_0x52d5c9);});});} \ No newline at end of file +var _0xbacf=['jayson/promise','client','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x2c3201,_0x1f76ff){var _0x564fc4=function(_0x424493){while(--_0x424493){_0x2c3201['push'](_0x2c3201['shift']());}};_0x564fc4(++_0x1f76ff);}(_0xbacf,0xe7));var _0xfbac=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xbacf[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0xfbac('0x0'));var util=require(_0xfbac('0x1'));var moment=require(_0xfbac('0x2'));var BPromise=require(_0xfbac('0x3'));var rs=require(_0xfbac('0x4'));var fs=require('fs');var Redis=require(_0xfbac('0x5'));var db=require(_0xfbac('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfbac('0x7'))(_0xfbac('0x8'));var config=require('../../config/environment');var jayson=require(_0xfbac('0x9'));var client=jayson[_0xfbac('0xa')][_0xfbac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x480484,_0x2151ea,_0x59bfab){return new BPromise(function(_0x1d1590,_0x46a148){return client['request'](_0x480484,_0x59bfab)[_0xfbac('0xc')](function(_0x168e62){logger[_0xfbac('0xd')](_0xfbac('0xe'),_0x2151ea,'request\x20sent');logger[_0xfbac('0xf')](_0xfbac('0x10'),_0x2151ea,_0xfbac('0x11'),JSON[_0xfbac('0x12')](_0x168e62));if(_0x168e62[_0xfbac('0x13')]){if(_0x168e62[_0xfbac('0x13')][_0xfbac('0x14')]===0x1f4){logger[_0xfbac('0x13')](_0xfbac('0xe'),_0x2151ea,_0x168e62[_0xfbac('0x13')][_0xfbac('0x15')]);return _0x46a148(_0x168e62[_0xfbac('0x13')][_0xfbac('0x15')]);}logger[_0xfbac('0x13')](_0xfbac('0xe'),_0x2151ea,_0x168e62[_0xfbac('0x13')][_0xfbac('0x15')]);return _0x1d1590(_0x168e62[_0xfbac('0x13')][_0xfbac('0x15')]);}else{logger['info'](_0xfbac('0xe'),_0x2151ea,'request\x20sent');_0x1d1590(_0x168e62[_0xfbac('0x16')][_0xfbac('0x15')]);}})[_0xfbac('0x17')](function(_0x92f633){logger['error'](_0xfbac('0xe'),_0x2151ea,_0x92f633);_0x46a148(_0x92f633);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 02163f8..87ac1fa 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 _0xc5ce=['create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','post'];(function(_0x593dc5,_0x44b1ee){var _0x2977cd=function(_0x178a2d){while(--_0x178a2d){_0x593dc5['push'](_0x593dc5['shift']());}};_0x2977cd(++_0x44b1ee);}(_0xc5ce,0x15a));var _0xec5c=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xc5ce[_0x1969a7];return _0x3d665f;};'use strict';var multer=require(_0xec5c('0x0'));var util=require(_0xec5c('0x1'));var path=require(_0xec5c('0x2'));var timeout=require(_0xec5c('0x3'));var express=require(_0xec5c('0x4'));var router=express[_0xec5c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xec5c('0x6'));var interaction=require(_0xec5c('0x7'));var config=require(_0xec5c('0x8'));var controller=require(_0xec5c('0x9'));router[_0xec5c('0xa')]('/',auth[_0xec5c('0xb')](),controller[_0xec5c('0xc')]);router[_0xec5c('0xa')]('/:id',auth[_0xec5c('0xb')](),controller['show']);router[_0xec5c('0xd')]('/',auth['isAuthenticated'](),controller[_0xec5c('0xe')]);router[_0xec5c('0xf')](_0xec5c('0x10'),auth[_0xec5c('0xb')](),controller[_0xec5c('0x11')]);router['delete'](_0xec5c('0x10'),auth['isAuthenticated'](),controller[_0xec5c('0x12')]);module[_0xec5c('0x13')]=router; \ No newline at end of file +var _0x3139=['./intFreshdeskField.controller','get','isAuthenticated','show','create','put','/:id','update','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x33c693,_0x5cbd81){var _0x474b1a=function(_0x1ffed2){while(--_0x1ffed2){_0x33c693['push'](_0x33c693['shift']());}};_0x474b1a(++_0x5cbd81);}(_0x3139,0x108));var _0x9313=function(_0x4e60fc,_0xd7bcb3){_0x4e60fc=_0x4e60fc-0x0;var _0x466b3b=_0x3139[_0x4e60fc];return _0x466b3b;};'use strict';var multer=require(_0x9313('0x0'));var util=require(_0x9313('0x1'));var path=require(_0x9313('0x2'));var timeout=require(_0x9313('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9313('0x4'));var auth=require(_0x9313('0x5'));var interaction=require(_0x9313('0x6'));var config=require(_0x9313('0x7'));var controller=require(_0x9313('0x8'));router[_0x9313('0x9')]('/',auth[_0x9313('0xa')](),controller['index']);router[_0x9313('0x9')]('/:id',auth[_0x9313('0xa')](),controller[_0x9313('0xb')]);router['post']('/',auth[_0x9313('0xa')](),controller[_0x9313('0xc')]);router[_0x9313('0xd')](_0x9313('0xe'),auth[_0x9313('0xa')](),controller[_0x9313('0xf')]);router['delete'](_0x9313('0xe'),auth[_0x9313('0xa')](),controller[_0x9313('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 4dffb50..e79baef 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 _0x272d=['BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x5ce948,_0x5946f2){var _0x348c4b=function(_0x4ad9ec){while(--_0x4ad9ec){_0x5ce948['push'](_0x5ce948['shift']());}};_0x348c4b(++_0x5946f2);}(_0x272d,0x91));var _0xd272=function(_0x3fd32f,_0x588235){_0x3fd32f=_0x3fd32f-0x0;var _0xa55282=_0x272d[_0x3fd32f];return _0xa55282;};'use strict';var Sequelize=require('sequelize');module[_0xd272('0x0')]={'type':{'type':Sequelize[_0xd272('0x1')](_0xd272('0x2'),_0xd272('0x3'),_0xd272('0x4'),_0xd272('0x5'),_0xd272('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xd272('0x7')]},'key':{'type':Sequelize[_0xd272('0x7')]},'keyType':{'type':Sequelize[_0xd272('0x1')](_0xd272('0x2'),_0xd272('0x3'),_0xd272('0x4'))},'keyContent':{'type':Sequelize[_0xd272('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd272('0x7')]},'customField':{'type':Sequelize[_0xd272('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd272('0x7')]}}; \ No newline at end of file +var _0x721a=['sequelize','exports','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x721a,0x117));var _0xa721=function(_0x1f8d0f,_0x3ca300){_0x1f8d0f=_0x1f8d0f-0x0;var _0xfe40a6=_0x721a[_0x1f8d0f];return _0xfe40a6;};'use strict';var Sequelize=require(_0xa721('0x0'));module[_0xa721('0x1')]={'type':{'type':Sequelize[_0xa721('0x2')](_0xa721('0x3'),_0xa721('0x4'),_0xa721('0x5'),'keyValue',_0xa721('0x6')),'defaultValue':_0xa721('0x3')},'content':{'type':Sequelize[_0xa721('0x7')]},'key':{'type':Sequelize[_0xa721('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xa721('0x3'),_0xa721('0x4'),_0xa721('0x5'))},'keyContent':{'type':Sequelize[_0xa721('0x7')]},'idField':{'type':Sequelize[_0xa721('0x7')]},'nameField':{'type':Sequelize[_0xa721('0x7')]},'customField':{'type':Sequelize[_0xa721('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa721('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 8fe7a95..93b9034 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 _0x2e54=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','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','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','error','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where'];(function(_0x4207f4,_0x1f778b){var _0x29a621=function(_0xa6f5b7){while(--_0xa6f5b7){_0x4207f4['push'](_0x4207f4['shift']());}};_0x29a621(++_0x1f778b);}(_0x2e54,0x1dd));var _0x42e5=function(_0x282455,_0x4f5e3d){_0x282455=_0x282455-0x0;var _0x14e262=_0x2e54[_0x282455];return _0x14e262;};'use strict';var emlformat=require(_0x42e5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x42e5('0x1'));var rp=require(_0x42e5('0x2'));var moment=require(_0x42e5('0x3'));var BPromise=require(_0x42e5('0x4'));var Mustache=require(_0x42e5('0x5'));var util=require(_0x42e5('0x6'));var path=require(_0x42e5('0x7'));var sox=require('sox');var csv=require(_0x42e5('0x8'));var ejs=require(_0x42e5('0x9'));var fs=require('fs');var fs_extra=require(_0x42e5('0xa'));var _=require('lodash');var squel=require(_0x42e5('0xb'));var crypto=require('crypto');var jsforce=require(_0x42e5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x42e5('0x8'));var querystring=require(_0x42e5('0xd'));var Papa=require(_0x42e5('0xe'));var Redis=require(_0x42e5('0xf'));var authService=require(_0x42e5('0x10'));var qs=require(_0x42e5('0x11'));var as=require(_0x42e5('0x12'));var hardwareService=require(_0x42e5('0x13'));var logger=require(_0x42e5('0x14'))('api');var utils=require(_0x42e5('0x15'));var config=require(_0x42e5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x42e5('0x17'))['db'];function respondWithStatusCode(_0x12385d,_0x4530ba){_0x4530ba=_0x4530ba||0xcc;return function(_0x41598d){if(_0x41598d){return _0x12385d[_0x42e5('0x18')](_0x4530ba);}return _0x12385d[_0x42e5('0x19')](_0x4530ba)[_0x42e5('0x1a')]();};}function respondWithResult(_0x96fae2,_0x447648){_0x447648=_0x447648||0xc8;return function(_0x23957f){if(_0x23957f){return _0x96fae2['status'](_0x447648)[_0x42e5('0x1b')](_0x23957f);}};}function respondWithFilteredResult(_0x1d8e52,_0x4034bd){return function(_0x388300){if(_0x388300){var _0x2f4999=typeof _0x4034bd[_0x42e5('0x1c')]===_0x42e5('0x1d')&&typeof _0x4034bd[_0x42e5('0x1e')]===_0x42e5('0x1d');var _0x3c7b79=_0x388300[_0x42e5('0x1f')];var _0x38282d=_0x2f4999?0x0:_0x4034bd[_0x42e5('0x1c')];var _0x23fe09=_0x2f4999?_0x388300['count']:_0x4034bd[_0x42e5('0x1c')]+_0x4034bd['limit'];var _0x5f4428;if(_0x23fe09>=_0x3c7b79){_0x23fe09=_0x3c7b79;_0x5f4428=0xc8;}else{_0x5f4428=0xce;}_0x1d8e52[_0x42e5('0x19')](_0x5f4428);return _0x1d8e52[_0x42e5('0x20')]('Content-Range',_0x38282d+'-'+_0x23fe09+'/'+_0x3c7b79)[_0x42e5('0x1b')](_0x388300);}return null;};}function patchUpdates(_0x39a3e2){return function(_0x1c2169){try{jsonpatch[_0x42e5('0x21')](_0x1c2169,_0x39a3e2,!![]);}catch(_0x1150f4){return BPromise[_0x42e5('0x22')](_0x1150f4);}return _0x1c2169[_0x42e5('0x23')]();};}function saveUpdates(_0x58eee5,_0x4da508){return function(_0x283d44){if(_0x283d44){return _0x283d44['update'](_0x58eee5)[_0x42e5('0x24')](function(_0x2e9574){return _0x2e9574;});}return null;};}function removeEntity(_0x37d10e,_0x49490f){return function(_0x32380f){if(_0x32380f){return _0x32380f['destroy']()[_0x42e5('0x24')](function(){_0x37d10e[_0x42e5('0x19')](0xcc)[_0x42e5('0x1a')]();});}};}function handleEntityNotFound(_0x275c80,_0x4638bc){return function(_0x4f52b2){if(!_0x4f52b2){_0x275c80['sendStatus'](0x194);}return _0x4f52b2;};}function handleError(_0x3115e4,_0x534a26){_0x534a26=_0x534a26||0x1f4;return function(_0x56f812){logger[_0x42e5('0x25')](_0x56f812['stack']);if(_0x56f812[_0x42e5('0x26')]){delete _0x56f812[_0x42e5('0x26')];}_0x3115e4[_0x42e5('0x19')](_0x534a26)[_0x42e5('0x27')](_0x56f812);};}exports[_0x42e5('0x28')]=function(_0x2f1edc,_0x59a46b){var _0x3e2ea5={},_0x201d9e={},_0x39f763={'count':0x0,'rows':[]};var _0x2c53d4=_[_0x42e5('0x29')](db[_0x42e5('0x2a')][_0x42e5('0x2b')],function(_0x282cbf){return{'name':_0x282cbf[_0x42e5('0x2c')],'type':_0x282cbf[_0x42e5('0x2d')][_0x42e5('0x2e')]};});_0x201d9e[_0x42e5('0x2f')]=_[_0x42e5('0x29')](_0x2c53d4,'name');_0x201d9e[_0x42e5('0x30')]=_[_0x42e5('0x31')](_0x2f1edc[_0x42e5('0x30')]);_0x201d9e[_0x42e5('0x32')]=_['intersection'](_0x201d9e['model'],_0x201d9e[_0x42e5('0x30')]);_0x3e2ea5['attributes']=_[_0x42e5('0x33')](_0x201d9e['model'],qs[_0x42e5('0x34')](_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x34')]));_0x3e2ea5['attributes']=_0x3e2ea5[_0x42e5('0x35')][_0x42e5('0x36')]?_0x3e2ea5['attributes']:_0x201d9e[_0x42e5('0x2f')];if(!_0x2f1edc['query'][_0x42e5('0x37')](_0x42e5('0x38'))){_0x3e2ea5[_0x42e5('0x1e')]=qs[_0x42e5('0x1e')](_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x1e')]);_0x3e2ea5[_0x42e5('0x1c')]=qs['offset'](_0x2f1edc['query'][_0x42e5('0x1c')]);}_0x3e2ea5[_0x42e5('0x39')]=qs[_0x42e5('0x3a')](_0x2f1edc['query']['sort']);_0x3e2ea5['where']=qs['filters'](_[_0x42e5('0x3b')](_0x2f1edc[_0x42e5('0x30')],_0x201d9e[_0x42e5('0x32')]),_0x2c53d4);if(_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x3c')]){_0x3e2ea5[_0x42e5('0x3d')]=_[_0x42e5('0x3e')](_0x3e2ea5[_0x42e5('0x3d')],{'$or':_['map'](_0x2c53d4,function(_0x260413){if(_0x260413['type']!==_0x42e5('0x3f')){var _0x343363={};_0x343363[_0x260413[_0x42e5('0x26')]]={'$like':'%'+_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x3c')]+'%'};return _0x343363;}})});}_0x3e2ea5=_[_0x42e5('0x3e')]({},_0x3e2ea5,_0x2f1edc[_0x42e5('0x40')]);var _0x5ab9b8={'where':_0x3e2ea5[_0x42e5('0x3d')]};return db[_0x42e5('0x2a')]['count'](_0x5ab9b8)[_0x42e5('0x24')](function(_0x5e8f96){_0x39f763['count']=_0x5e8f96;if(_0x2f1edc['query'][_0x42e5('0x41')]){_0x3e2ea5[_0x42e5('0x42')]=[{'all':!![]}];}return db[_0x42e5('0x2a')][_0x42e5('0x43')](_0x3e2ea5);})[_0x42e5('0x24')](function(_0x77aa22){_0x39f763[_0x42e5('0x44')]=_0x77aa22;return _0x39f763;})['then'](respondWithFilteredResult(_0x59a46b,_0x3e2ea5))[_0x42e5('0x45')](handleError(_0x59a46b,null));};exports[_0x42e5('0x46')]=function(_0x5bec97,_0x398b73){var _0x1c697a={'raw':!![],'where':{'id':_0x5bec97[_0x42e5('0x47')]['id']}},_0x5db771={};_0x5db771[_0x42e5('0x2f')]=_[_0x42e5('0x31')](db[_0x42e5('0x2a')][_0x42e5('0x2b')]);_0x5db771['query']=_[_0x42e5('0x31')](_0x5bec97[_0x42e5('0x30')]);_0x5db771[_0x42e5('0x32')]=_[_0x42e5('0x33')](_0x5db771['model'],_0x5db771[_0x42e5('0x30')]);_0x1c697a[_0x42e5('0x35')]=_[_0x42e5('0x33')](_0x5db771[_0x42e5('0x2f')],qs[_0x42e5('0x34')](_0x5bec97[_0x42e5('0x30')][_0x42e5('0x34')]));_0x1c697a[_0x42e5('0x35')]=_0x1c697a['attributes'][_0x42e5('0x36')]?_0x1c697a['attributes']:_0x5db771['model'];if(_0x5bec97[_0x42e5('0x30')][_0x42e5('0x41')]){_0x1c697a[_0x42e5('0x42')]=[{'all':!![]}];}_0x1c697a=_[_0x42e5('0x3e')]({},_0x1c697a,_0x5bec97[_0x42e5('0x40')]);return db[_0x42e5('0x2a')][_0x42e5('0x48')](_0x1c697a)['then'](handleEntityNotFound(_0x398b73,null))[_0x42e5('0x24')](respondWithResult(_0x398b73,null))[_0x42e5('0x45')](handleError(_0x398b73,null));};exports[_0x42e5('0x49')]=function(_0x21a047,_0x1086b2){return db[_0x42e5('0x2a')][_0x42e5('0x49')](_0x21a047[_0x42e5('0x4a')],{})['then'](respondWithResult(_0x1086b2,0xc9))[_0x42e5('0x45')](handleError(_0x1086b2,null));};exports[_0x42e5('0x4b')]=function(_0x3616f4,_0x48757e){if(_0x3616f4[_0x42e5('0x4a')]['id']){delete _0x3616f4[_0x42e5('0x4a')]['id'];}return db[_0x42e5('0x2a')][_0x42e5('0x48')]({'where':{'id':_0x3616f4[_0x42e5('0x47')]['id']}})['then'](handleEntityNotFound(_0x48757e,null))[_0x42e5('0x24')](saveUpdates(_0x3616f4['body'],null))[_0x42e5('0x24')](respondWithResult(_0x48757e,null))[_0x42e5('0x45')](handleError(_0x48757e,null));};exports[_0x42e5('0x4c')]=function(_0x48b63b,_0x50f59c){return db['FreshdeskField'][_0x42e5('0x48')]({'where':{'id':_0x48b63b[_0x42e5('0x47')]['id']}})[_0x42e5('0x24')](handleEntityNotFound(_0x50f59c,null))[_0x42e5('0x24')](removeEntity(_0x50f59c,null))['catch'](handleError(_0x50f59c,null));}; \ No newline at end of file +var _0xb43b=['create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','sendStatus','name','status','send','index','map','FreshdeskField','rawAttributes','type','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','then','catch','params','find'];(function(_0x428ec7,_0x552c32){var _0x9ffea7=function(_0x4ce1ad){while(--_0x4ce1ad){_0x428ec7['push'](_0x428ec7['shift']());}};_0x9ffea7(++_0x552c32);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1721a3,_0x4e3d37){_0x1721a3=_0x1721a3-0x0;var _0x115967=_0xb43b[_0x1721a3];return _0x115967;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require(_0xbb43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb43('0x5'));var util=require(_0xbb43('0x6'));var path=require(_0xbb43('0x7'));var sox=require(_0xbb43('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb43('0x9'));var _=require('lodash');var squel=require(_0xbb43('0xa'));var crypto=require(_0xbb43('0xb'));var jsforce=require(_0xbb43('0xc'));var deskjs=require(_0xbb43('0xd'));var toCsv=require(_0xbb43('0xe'));var querystring=require('querystring');var Papa=require(_0xbb43('0xf'));var Redis=require(_0xbb43('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb43('0x11'));var as=require(_0xbb43('0x12'));var hardwareService=require(_0xbb43('0x13'));var logger=require(_0xbb43('0x14'))(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb43('0x17'));var db=require(_0xbb43('0x18'))['db'];function respondWithStatusCode(_0x50e2c0,_0x578392){_0x578392=_0x578392||0xcc;return function(_0x41e7e5){if(_0x41e7e5){return _0x50e2c0['sendStatus'](_0x578392);}return _0x50e2c0['status'](_0x578392)[_0xbb43('0x19')]();};}function respondWithResult(_0x5a509f,_0x68d45d){_0x68d45d=_0x68d45d||0xc8;return function(_0x43021d){if(_0x43021d){return _0x5a509f['status'](_0x68d45d)['json'](_0x43021d);}};}function respondWithFilteredResult(_0x4d5bcf,_0x338120){return function(_0x2abce0){if(_0x2abce0){var _0x57bd1d=typeof _0x338120['offset']===_0xbb43('0x1a')&&typeof _0x338120['limit']==='undefined';var _0x2b0797=_0x2abce0[_0xbb43('0x1b')];var _0x2e3b43=_0x57bd1d?0x0:_0x338120['offset'];var _0x1c16d7=_0x57bd1d?_0x2abce0['count']:_0x338120[_0xbb43('0x1c')]+_0x338120[_0xbb43('0x1d')];var _0x4dfc54;if(_0x1c16d7>=_0x2b0797){_0x1c16d7=_0x2b0797;_0x4dfc54=0xc8;}else{_0x4dfc54=0xce;}_0x4d5bcf['status'](_0x4dfc54);return _0x4d5bcf[_0xbb43('0x1e')](_0xbb43('0x1f'),_0x2e3b43+'-'+_0x1c16d7+'/'+_0x2b0797)[_0xbb43('0x20')](_0x2abce0);}return null;};}function patchUpdates(_0x2bf2d4){return function(_0x5bcce7){try{jsonpatch[_0xbb43('0x21')](_0x5bcce7,_0x2bf2d4,!![]);}catch(_0x5f4416){return BPromise[_0xbb43('0x22')](_0x5f4416);}return _0x5bcce7['save']();};}function saveUpdates(_0x2f5e31,_0x565256){return function(_0x3f323e){if(_0x3f323e){return _0x3f323e[_0xbb43('0x23')](_0x2f5e31)['then'](function(_0x1d0768){return _0x1d0768;});}return null;};}function removeEntity(_0x4dfb7f,_0xf24e60){return function(_0x298ce2){if(_0x298ce2){return _0x298ce2[_0xbb43('0x24')]()['then'](function(){_0x4dfb7f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x269ca5,_0x32d7f0){return function(_0x5d8310){if(!_0x5d8310){_0x269ca5[_0xbb43('0x25')](0x194);}return _0x5d8310;};}function handleError(_0x2da653,_0x226827){_0x226827=_0x226827||0x1f4;return function(_0x3874fb){logger['error'](_0x3874fb['stack']);if(_0x3874fb[_0xbb43('0x26')]){delete _0x3874fb[_0xbb43('0x26')];}_0x2da653[_0xbb43('0x27')](_0x226827)[_0xbb43('0x28')](_0x3874fb);};}exports[_0xbb43('0x29')]=function(_0x40b04b,_0x21d386){var _0x473828={},_0x539730={},_0x2ad6da={'count':0x0,'rows':[]};var _0x56fe33=_[_0xbb43('0x2a')](db[_0xbb43('0x2b')][_0xbb43('0x2c')],function(_0x1880cd){return{'name':_0x1880cd['fieldName'],'type':_0x1880cd[_0xbb43('0x2d')]['key']};});_0x539730['model']=_['map'](_0x56fe33,_0xbb43('0x26'));_0x539730['query']=_[_0xbb43('0x2e')](_0x40b04b[_0xbb43('0x2f')]);_0x539730[_0xbb43('0x30')]=_['intersection'](_0x539730[_0xbb43('0x31')],_0x539730[_0xbb43('0x2f')]);_0x473828[_0xbb43('0x32')]=_[_0xbb43('0x33')](_0x539730[_0xbb43('0x31')],qs[_0xbb43('0x34')](_0x40b04b[_0xbb43('0x2f')][_0xbb43('0x34')]));_0x473828['attributes']=_0x473828[_0xbb43('0x32')][_0xbb43('0x35')]?_0x473828[_0xbb43('0x32')]:_0x539730[_0xbb43('0x31')];if(!_0x40b04b[_0xbb43('0x2f')][_0xbb43('0x36')](_0xbb43('0x37'))){_0x473828[_0xbb43('0x1d')]=qs[_0xbb43('0x1d')](_0x40b04b[_0xbb43('0x2f')][_0xbb43('0x1d')]);_0x473828[_0xbb43('0x1c')]=qs[_0xbb43('0x1c')](_0x40b04b[_0xbb43('0x2f')][_0xbb43('0x1c')]);}_0x473828[_0xbb43('0x38')]=qs['sort'](_0x40b04b[_0xbb43('0x2f')][_0xbb43('0x39')]);_0x473828['where']=qs[_0xbb43('0x30')](_[_0xbb43('0x3a')](_0x40b04b[_0xbb43('0x2f')],_0x539730['filters']),_0x56fe33);if(_0x40b04b['query']['filter']){_0x473828[_0xbb43('0x3b')]=_[_0xbb43('0x3c')](_0x473828['where'],{'$or':_['map'](_0x56fe33,function(_0x2aa381){if(_0x2aa381[_0xbb43('0x2d')]!==_0xbb43('0x3d')){var _0x37afbb={};_0x37afbb[_0x2aa381[_0xbb43('0x26')]]={'$like':'%'+_0x40b04b['query'][_0xbb43('0x3e')]+'%'};return _0x37afbb;}})});}_0x473828=_[_0xbb43('0x3c')]({},_0x473828,_0x40b04b[_0xbb43('0x3f')]);var _0x3340aa={'where':_0x473828[_0xbb43('0x3b')]};return db['FreshdeskField'][_0xbb43('0x1b')](_0x3340aa)['then'](function(_0x1c076f){_0x2ad6da[_0xbb43('0x1b')]=_0x1c076f;if(_0x40b04b['query'][_0xbb43('0x40')]){_0x473828['include']=[{'all':!![]}];}return db[_0xbb43('0x2b')][_0xbb43('0x41')](_0x473828);})[_0xbb43('0x42')](function(_0xb84ece){_0x2ad6da['rows']=_0xb84ece;return _0x2ad6da;})[_0xbb43('0x42')](respondWithFilteredResult(_0x21d386,_0x473828))[_0xbb43('0x43')](handleError(_0x21d386,null));};exports['show']=function(_0x3443f8,_0x5198a2){var _0x42b965={'raw':!![],'where':{'id':_0x3443f8[_0xbb43('0x44')]['id']}},_0x14285d={};_0x14285d[_0xbb43('0x31')]=_[_0xbb43('0x2e')](db[_0xbb43('0x2b')]['rawAttributes']);_0x14285d[_0xbb43('0x2f')]=_['keys'](_0x3443f8[_0xbb43('0x2f')]);_0x14285d[_0xbb43('0x30')]=_[_0xbb43('0x33')](_0x14285d[_0xbb43('0x31')],_0x14285d['query']);_0x42b965[_0xbb43('0x32')]=_[_0xbb43('0x33')](_0x14285d[_0xbb43('0x31')],qs[_0xbb43('0x34')](_0x3443f8[_0xbb43('0x2f')][_0xbb43('0x34')]));_0x42b965[_0xbb43('0x32')]=_0x42b965[_0xbb43('0x32')]['length']?_0x42b965[_0xbb43('0x32')]:_0x14285d[_0xbb43('0x31')];if(_0x3443f8['query'][_0xbb43('0x40')]){_0x42b965['include']=[{'all':!![]}];}_0x42b965=_['merge']({},_0x42b965,_0x3443f8['options']);return db['FreshdeskField'][_0xbb43('0x45')](_0x42b965)['then'](handleEntityNotFound(_0x5198a2,null))[_0xbb43('0x42')](respondWithResult(_0x5198a2,null))['catch'](handleError(_0x5198a2,null));};exports[_0xbb43('0x46')]=function(_0x39b6ae,_0x1f3fb4){return db['FreshdeskField'][_0xbb43('0x46')](_0x39b6ae['body'],{})[_0xbb43('0x42')](respondWithResult(_0x1f3fb4,0xc9))[_0xbb43('0x43')](handleError(_0x1f3fb4,null));};exports[_0xbb43('0x23')]=function(_0x29840e,_0x417ad9){if(_0x29840e[_0xbb43('0x47')]['id']){delete _0x29840e[_0xbb43('0x47')]['id'];}return db['FreshdeskField'][_0xbb43('0x45')]({'where':{'id':_0x29840e[_0xbb43('0x44')]['id']}})[_0xbb43('0x42')](handleEntityNotFound(_0x417ad9,null))[_0xbb43('0x42')](saveUpdates(_0x29840e['body'],null))[_0xbb43('0x42')](respondWithResult(_0x417ad9,null))[_0xbb43('0x43')](handleError(_0x417ad9,null));};exports[_0xbb43('0x24')]=function(_0xb1883e,_0x4b7712){return db[_0xbb43('0x2b')][_0xbb43('0x45')]({'where':{'id':_0xb1883e[_0xbb43('0x44')]['id']}})['then'](handleEntityNotFound(_0x4b7712,null))[_0xbb43('0x42')](removeEntity(_0x4b7712,null))[_0xbb43('0x43')](handleError(_0x4b7712,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 6557aa1..9e311d3 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 _0xdff5=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId'];(function(_0x288aac,_0x4e35d5){var _0x277495=function(_0x108d89){while(--_0x108d89){_0x288aac['push'](_0x288aac['shift']());}};_0x277495(++_0x4e35d5);}(_0xdff5,0x100));var _0x5dff=function(_0xce58e0,_0x2a85da){_0xce58e0=_0xce58e0-0x0;var _0x17f4b5=_0xdff5[_0xce58e0];return _0x17f4b5;};'use strict';var _=require('lodash');var util=require(_0x5dff('0x0'));var logger=require(_0x5dff('0x1'))(_0x5dff('0x2'));var moment=require(_0x5dff('0x3'));var BPromise=require(_0x5dff('0x4'));var rp=require(_0x5dff('0x5'));var fs=require('fs');var path=require(_0x5dff('0x6'));var rimraf=require(_0x5dff('0x7'));var config=require(_0x5dff('0x8'));var attributes=require(_0x5dff('0x9'));module[_0x5dff('0xa')]=function(_0x490fdd,_0x5999bc){return _0x490fdd[_0x5dff('0xb')]('FreshdeskField',attributes,{'tableName':_0x5dff('0xc'),'paranoid':![],'indexes':[{'name':_0x5dff('0xd'),'fields':[_0x5dff('0xe'),_0x5dff('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc800=['idField','FieldId','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskField.attributes','define','FreshdeskField','freshdesk_unique_index'];(function(_0x4ccd42,_0x581b7f){var _0x37df3a=function(_0x38158a){while(--_0x38158a){_0x4ccd42['push'](_0x4ccd42['shift']());}};_0x37df3a(++_0x581b7f);}(_0xc800,0x1b4));var _0x0c80=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0xc800[_0x166742];return _0xb7814a;};'use strict';var _=require(_0x0c80('0x0'));var util=require(_0x0c80('0x1'));var logger=require('../../config/logger')(_0x0c80('0x2'));var moment=require(_0x0c80('0x3'));var BPromise=require(_0x0c80('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c80('0x5'));var rimraf=require(_0x0c80('0x6'));var config=require(_0x0c80('0x7'));var attributes=require(_0x0c80('0x8'));module['exports']=function(_0x299f3b,_0x55ba02){return _0x299f3b[_0x0c80('0x9')](_0x0c80('0xa'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x0c80('0xb'),'fields':[_0x0c80('0xc'),_0x0c80('0xd')],'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 20a1f47..52f371a 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 _0x2472=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util'];(function(_0x226391,_0x58d432){var _0x58f2b6=function(_0x51e1d0){while(--_0x51e1d0){_0x226391['push'](_0x226391['shift']());}};_0x58f2b6(++_0x58d432);}(_0x2472,0x8a));var _0x2247=function(_0x58e6ab,_0xd89ded){_0x58e6ab=_0x58e6ab-0x0;var _0x56f318=_0x2472[_0x58e6ab];return _0x56f318;};'use strict';var _=require(_0x2247('0x0'));var util=require(_0x2247('0x1'));var moment=require('moment');var BPromise=require(_0x2247('0x2'));var rs=require(_0x2247('0x3'));var fs=require('fs');var Redis=require(_0x2247('0x4'));var db=require(_0x2247('0x5'))['db'];var utils=require(_0x2247('0x6'));var logger=require('../../config/logger')(_0x2247('0x7'));var config=require('../../config/environment');var jayson=require(_0x2247('0x8'));var client=jayson[_0x2247('0x9')][_0x2247('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x122963,_0x186995,_0x56fe21){return new BPromise(function(_0x237045,_0x5ad98a){return client[_0x2247('0xb')](_0x122963,_0x56fe21)['then'](function(_0x4d88b6){logger[_0x2247('0xc')](_0x2247('0xd'),_0x186995,'request\x20sent');logger['debug']('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x186995,_0x2247('0xe'),JSON['stringify'](_0x4d88b6));if(_0x4d88b6[_0x2247('0xf')]){if(_0x4d88b6[_0x2247('0xf')][_0x2247('0x10')]===0x1f4){logger['error'](_0x2247('0xd'),_0x186995,_0x4d88b6[_0x2247('0xf')][_0x2247('0x11')]);return _0x5ad98a(_0x4d88b6[_0x2247('0xf')][_0x2247('0x11')]);}logger[_0x2247('0xf')](_0x2247('0xd'),_0x186995,_0x4d88b6[_0x2247('0xf')]['message']);return _0x237045(_0x4d88b6['error'][_0x2247('0x11')]);}else{logger[_0x2247('0xc')](_0x2247('0xd'),_0x186995,_0x2247('0xe'));_0x237045(_0x4d88b6[_0x2247('0x12')][_0x2247('0x11')]);}})[_0x2247('0x13')](function(_0x1f38c4){logger[_0x2247('0xf')](_0x2247('0xd'),_0x186995,_0x1f38c4);_0x5ad98a(_0x1f38c4);});});} \ No newline at end of file +var _0xd062=['then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x271537,_0x8b7b3b){var _0x19dc22=function(_0x459bbf){while(--_0x459bbf){_0x271537['push'](_0x271537['shift']());}};_0x19dc22(++_0x8b7b3b);}(_0xd062,0x1ed));var _0x2d06=function(_0x4a5e78,_0x27f592){_0x4a5e78=_0x4a5e78-0x0;var _0x2a6fb8=_0xd062[_0x4a5e78];return _0x2a6fb8;};'use strict';var _=require(_0x2d06('0x0'));var util=require('util');var moment=require(_0x2d06('0x1'));var BPromise=require(_0x2d06('0x2'));var rs=require(_0x2d06('0x3'));var fs=require('fs');var Redis=require(_0x2d06('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2d06('0x5'))(_0x2d06('0x6'));var config=require('../../config/environment');var jayson=require(_0x2d06('0x7'));var client=jayson[_0x2d06('0x8')][_0x2d06('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4953de,_0x18fc05,_0x2ab7c9){return new BPromise(function(_0x4462bc,_0x52c8b2){return client[_0x2d06('0xa')](_0x4953de,_0x2ab7c9)[_0x2d06('0xb')](function(_0x5ce23f){logger[_0x2d06('0xc')](_0x2d06('0xd'),_0x18fc05,_0x2d06('0xe'));logger[_0x2d06('0xf')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x18fc05,_0x2d06('0xe'),JSON[_0x2d06('0x10')](_0x5ce23f));if(_0x5ce23f['error']){if(_0x5ce23f[_0x2d06('0x11')][_0x2d06('0x12')]===0x1f4){logger[_0x2d06('0x11')](_0x2d06('0xd'),_0x18fc05,_0x5ce23f[_0x2d06('0x11')][_0x2d06('0x13')]);return _0x52c8b2(_0x5ce23f[_0x2d06('0x11')][_0x2d06('0x13')]);}logger[_0x2d06('0x11')](_0x2d06('0xd'),_0x18fc05,_0x5ce23f[_0x2d06('0x11')][_0x2d06('0x13')]);return _0x4462bc(_0x5ce23f[_0x2d06('0x11')]['message']);}else{logger[_0x2d06('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x18fc05,_0x2d06('0xe'));_0x4462bc(_0x5ce23f[_0x2d06('0x14')]['message']);}})['catch'](function(_0x51450b){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x18fc05,_0x51450b);_0x52c8b2(_0x51450b);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index cee92d0..ca71971 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 _0xefda=['update','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','index','/:id','isAuthenticated','/:id/configurations','getFields','post','create','addConfiguration','put'];(function(_0xe7ee5f,_0x239c63){var _0x459e06=function(_0x5ac7a1){while(--_0x5ac7a1){_0xe7ee5f['push'](_0xe7ee5f['shift']());}};_0x459e06(++_0x239c63);}(_0xefda,0x96));var _0xaefd=function(_0x5ba9de,_0x4a867e){_0x5ba9de=_0x5ba9de-0x0;var _0x46b1d2=_0xefda[_0x5ba9de];return _0x46b1d2;};'use strict';var multer=require(_0xaefd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaefd('0x1'));var express=require(_0xaefd('0x2'));var router=express['Router']();var fs_extra=require(_0xaefd('0x3'));var auth=require(_0xaefd('0x4'));var interaction=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var controller=require(_0xaefd('0x7'));router[_0xaefd('0x8')]('/',auth['isAuthenticated'](),controller[_0xaefd('0x9')]);router[_0xaefd('0x8')](_0xaefd('0xa'),auth[_0xaefd('0xb')](),controller['show']);router[_0xaefd('0x8')](_0xaefd('0xc'),auth[_0xaefd('0xb')](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0xaefd('0xb')](),controller[_0xaefd('0xd')]);router[_0xaefd('0xe')]('/',auth[_0xaefd('0xb')](),controller[_0xaefd('0xf')]);router[_0xaefd('0xe')](_0xaefd('0xc'),auth[_0xaefd('0xb')](),controller[_0xaefd('0x10')]);router[_0xaefd('0x11')](_0xaefd('0xa'),auth['isAuthenticated'](),controller[_0xaefd('0x12')]);router['delete'](_0xaefd('0xa'),auth[_0xaefd('0xb')](),controller[_0xaefd('0x13')]);module[_0xaefd('0x14')]=router; \ No newline at end of file +var _0xeffd=['/:id','show','getConfigurations','getFields','post','create','/:id/configurations','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0xeffd,0x6b));var _0xdeff=function(_0x4b935b,_0x5b9f05){_0x4b935b=_0x4b935b-0x0;var _0x265040=_0xeffd[_0x4b935b];return _0x265040;};'use strict';var multer=require(_0xdeff('0x0'));var util=require('util');var path=require(_0xdeff('0x1'));var timeout=require(_0xdeff('0x2'));var express=require(_0xdeff('0x3'));var router=express[_0xdeff('0x4')]();var fs_extra=require(_0xdeff('0x5'));var auth=require(_0xdeff('0x6'));var interaction=require(_0xdeff('0x7'));var config=require(_0xdeff('0x8'));var controller=require(_0xdeff('0x9'));router[_0xdeff('0xa')]('/',auth[_0xdeff('0xb')](),controller[_0xdeff('0xc')]);router[_0xdeff('0xa')](_0xdeff('0xd'),auth[_0xdeff('0xb')](),controller[_0xdeff('0xe')]);router[_0xdeff('0xa')]('/:id/configurations',auth[_0xdeff('0xb')](),controller[_0xdeff('0xf')]);router[_0xdeff('0xa')]('/:id/fields',auth[_0xdeff('0xb')](),controller[_0xdeff('0x10')]);router[_0xdeff('0x11')]('/',auth[_0xdeff('0xb')](),controller[_0xdeff('0x12')]);router[_0xdeff('0x11')](_0xdeff('0x13'),auth[_0xdeff('0xb')](),controller['addConfiguration']);router[_0xdeff('0x14')](_0xdeff('0xd'),auth['isAuthenticated'](),controller[_0xdeff('0x15')]);router['delete']('/:id',auth[_0xdeff('0xb')](),controller[_0xdeff('0x16')]);module[_0xdeff('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 1a82c28..a611fdd 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 _0xe820=['sequelize','STRING','username'];(function(_0x4b3be8,_0x13acd6){var _0xc9d66=function(_0x3b147f){while(--_0x3b147f){_0x4b3be8['push'](_0x4b3be8['shift']());}};_0xc9d66(++_0x13acd6);}(_0xe820,0xd2));var _0x0e82=function(_0xe70803,_0x4139a0){_0xe70803=_0xe70803-0x0;var _0x3a3178=_0xe820[_0xe70803];return _0x3a3178;};'use strict';var Sequelize=require(_0x0e82('0x0'));module['exports']={'name':{'type':Sequelize[_0x0e82('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0e82('0x2')},'apiKey':{'type':Sequelize[_0x0e82('0x1')]},'remoteUri':{'type':Sequelize[_0x0e82('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x0e82('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x0adf=['remoteUri','sequelize','exports','STRING','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x4f0c02,_0x26a90f){_0x4f0c02=_0x4f0c02-0x0;var _0x55cbea=_0x0adf[_0x4f0c02];return _0x55cbea;};'use strict';var Sequelize=require(_0xf0ad('0x0'));module[_0xf0ad('0x1')]={'name':{'type':Sequelize[_0xf0ad('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf0ad('0x2')],'unique':_0xf0ad('0x3')},'apiKey':{'type':Sequelize[_0xf0ad('0x2')]},'remoteUri':{'type':Sequelize[_0xf0ad('0x2')],'unique':_0xf0ad('0x4')},'serverUrl':{'type':Sequelize[_0xf0ad('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 74fb24d..d5d7005 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 _0x90ec=['Content-Range','apply','save','update','then','destroy','error','stack','name','map','FreshsalesAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','create','body','find','getConfigurations','findOne','FreshsalesConfiguration','nolimit','addConfiguration','AccountId','channel','Descriptions','getDescriptions','FreshsalesField','Subjects','getFields','apiKey','username','remoteUri','slice','substring','GET','format','Token\x20token=','users','email','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../components/integrations/configuration','sendStatus','end','status','json','offset','limit','undefined','count','set'];(function(_0x4b74e3,_0x4b2ce5){var _0x285b1e=function(_0x3ac6c3){while(--_0x3ac6c3){_0x4b74e3['push'](_0x4b74e3['shift']());}};_0x285b1e(++_0x4b2ce5);}(_0x90ec,0x1d4));var _0xc90e=function(_0x91d2a0,_0x14c5b6){_0x91d2a0=_0x91d2a0-0x0;var _0x55acd0=_0x90ec[_0x91d2a0];return _0x55acd0;};'use strict';var emlformat=require(_0xc90e('0x0'));var rimraf=require(_0xc90e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc90e('0x2'));var rp=require(_0xc90e('0x3'));var moment=require(_0xc90e('0x4'));var BPromise=require(_0xc90e('0x5'));var Mustache=require(_0xc90e('0x6'));var util=require('util');var path=require(_0xc90e('0x7'));var sox=require(_0xc90e('0x8'));var csv=require(_0xc90e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc90e('0xa'));var _=require('lodash');var squel=require(_0xc90e('0xb'));var crypto=require(_0xc90e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc90e('0xd'));var toCsv=require(_0xc90e('0x9'));var querystring=require(_0xc90e('0xe'));var Papa=require(_0xc90e('0xf'));var Redis=require(_0xc90e('0x10'));var authService=require(_0xc90e('0x11'));var qs=require(_0xc90e('0x12'));var as=require(_0xc90e('0x13'));var hardwareService=require(_0xc90e('0x14'));var logger=require('../../config/logger')(_0xc90e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xc90e('0x16'));function respondWithStatusCode(_0x41d560,_0x5cef50){_0x5cef50=_0x5cef50||0xcc;return function(_0x37321a){if(_0x37321a){return _0x41d560[_0xc90e('0x17')](_0x5cef50);}return _0x41d560['status'](_0x5cef50)[_0xc90e('0x18')]();};}function respondWithResult(_0x40e989,_0x274876){_0x274876=_0x274876||0xc8;return function(_0x2758bb){if(_0x2758bb){return _0x40e989[_0xc90e('0x19')](_0x274876)[_0xc90e('0x1a')](_0x2758bb);}};}function respondWithFilteredResult(_0x53e2e1,_0x16050f){return function(_0x2ada5a){if(_0x2ada5a){var _0x4ff295=typeof _0x16050f[_0xc90e('0x1b')]==='undefined'&&typeof _0x16050f[_0xc90e('0x1c')]===_0xc90e('0x1d');var _0x558b22=_0x2ada5a[_0xc90e('0x1e')];var _0xe0e0bc=_0x4ff295?0x0:_0x16050f[_0xc90e('0x1b')];var _0x54e957=_0x4ff295?_0x2ada5a['count']:_0x16050f['offset']+_0x16050f[_0xc90e('0x1c')];var _0x147120;if(_0x54e957>=_0x558b22){_0x54e957=_0x558b22;_0x147120=0xc8;}else{_0x147120=0xce;}_0x53e2e1[_0xc90e('0x19')](_0x147120);return _0x53e2e1[_0xc90e('0x1f')](_0xc90e('0x20'),_0xe0e0bc+'-'+_0x54e957+'/'+_0x558b22)['json'](_0x2ada5a);}return null;};}function patchUpdates(_0x469f0d){return function(_0x556954){try{jsonpatch[_0xc90e('0x21')](_0x556954,_0x469f0d,!![]);}catch(_0x3cf47c){return BPromise['reject'](_0x3cf47c);}return _0x556954[_0xc90e('0x22')]();};}function saveUpdates(_0x134760,_0x957d1e){return function(_0x114042){if(_0x114042){return _0x114042[_0xc90e('0x23')](_0x134760)[_0xc90e('0x24')](function(_0x1a25bc){return _0x1a25bc;});}return null;};}function removeEntity(_0x136187,_0x1cff73){return function(_0x52aa00){if(_0x52aa00){return _0x52aa00[_0xc90e('0x25')]()[_0xc90e('0x24')](function(){_0x136187[_0xc90e('0x19')](0xcc)[_0xc90e('0x18')]();});}};}function handleEntityNotFound(_0x3371aa,_0x59d731){return function(_0x2e4d0c){if(!_0x2e4d0c){_0x3371aa[_0xc90e('0x17')](0x194);}return _0x2e4d0c;};}function handleError(_0x2ba549,_0x4fde04){_0x4fde04=_0x4fde04||0x1f4;return function(_0x3a30c7){logger[_0xc90e('0x26')](_0x3a30c7[_0xc90e('0x27')]);if(_0x3a30c7[_0xc90e('0x28')]){delete _0x3a30c7[_0xc90e('0x28')];}_0x2ba549[_0xc90e('0x19')](_0x4fde04)['send'](_0x3a30c7);};}exports['index']=function(_0x31e405,_0x550e8f){var _0xe8bae9={},_0xae20be={},_0x1baedc={'count':0x0,'rows':[]};var _0x404eef=_[_0xc90e('0x29')](db[_0xc90e('0x2a')][_0xc90e('0x2b')],function(_0x50e0d7){return{'name':_0x50e0d7[_0xc90e('0x2c')],'type':_0x50e0d7[_0xc90e('0x2d')]['key']};});_0xae20be[_0xc90e('0x2e')]=_['map'](_0x404eef,_0xc90e('0x28'));_0xae20be[_0xc90e('0x2f')]=_[_0xc90e('0x30')](_0x31e405[_0xc90e('0x2f')]);_0xae20be[_0xc90e('0x31')]=_[_0xc90e('0x32')](_0xae20be[_0xc90e('0x2e')],_0xae20be[_0xc90e('0x2f')]);_0xe8bae9[_0xc90e('0x33')]=_['intersection'](_0xae20be['model'],qs[_0xc90e('0x34')](_0x31e405[_0xc90e('0x2f')][_0xc90e('0x34')]));_0xe8bae9[_0xc90e('0x33')]=_0xe8bae9[_0xc90e('0x33')][_0xc90e('0x35')]?_0xe8bae9[_0xc90e('0x33')]:_0xae20be[_0xc90e('0x2e')];if(!_0x31e405[_0xc90e('0x2f')][_0xc90e('0x36')]('nolimit')){_0xe8bae9[_0xc90e('0x1c')]=qs[_0xc90e('0x1c')](_0x31e405[_0xc90e('0x2f')][_0xc90e('0x1c')]);_0xe8bae9['offset']=qs['offset'](_0x31e405['query'][_0xc90e('0x1b')]);}_0xe8bae9[_0xc90e('0x37')]=qs[_0xc90e('0x38')](_0x31e405[_0xc90e('0x2f')][_0xc90e('0x38')]);_0xe8bae9['where']=qs[_0xc90e('0x31')](_[_0xc90e('0x39')](_0x31e405[_0xc90e('0x2f')],_0xae20be[_0xc90e('0x31')]),_0x404eef);if(_0x31e405[_0xc90e('0x2f')][_0xc90e('0x3a')]){_0xe8bae9[_0xc90e('0x3b')]=_[_0xc90e('0x3c')](_0xe8bae9[_0xc90e('0x3b')],{'$or':_[_0xc90e('0x29')](_0x404eef,function(_0x39f241){if(_0x39f241[_0xc90e('0x2d')]!==_0xc90e('0x3d')){var _0x5421b6={};_0x5421b6[_0x39f241[_0xc90e('0x28')]]={'$like':'%'+_0x31e405[_0xc90e('0x2f')]['filter']+'%'};return _0x5421b6;}})});}_0xe8bae9=_['merge']({},_0xe8bae9,_0x31e405[_0xc90e('0x3e')]);var _0x53e484={'where':_0xe8bae9[_0xc90e('0x3b')]};return db[_0xc90e('0x2a')]['count'](_0x53e484)[_0xc90e('0x24')](function(_0x4d7911){_0x1baedc['count']=_0x4d7911;if(_0x31e405[_0xc90e('0x2f')]['includeAll']){_0xe8bae9['include']=[{'all':!![]}];}return db[_0xc90e('0x2a')][_0xc90e('0x3f')](_0xe8bae9);})['then'](function(_0x3f1de7){_0x1baedc[_0xc90e('0x40')]=_0x3f1de7;return _0x1baedc;})[_0xc90e('0x24')](respondWithFilteredResult(_0x550e8f,_0xe8bae9))[_0xc90e('0x41')](handleError(_0x550e8f,null));};exports[_0xc90e('0x42')]=function(_0x25b5da,_0x3f194a){var _0x25a7d6={'raw':![],'where':{'id':_0x25b5da[_0xc90e('0x43')]['id']}},_0x486bc7={};_0x486bc7['model']=_['keys'](db[_0xc90e('0x2a')]['rawAttributes']);_0x486bc7[_0xc90e('0x2f')]=_['keys'](_0x25b5da[_0xc90e('0x2f')]);_0x486bc7[_0xc90e('0x31')]=_[_0xc90e('0x32')](_0x486bc7[_0xc90e('0x2e')],_0x486bc7[_0xc90e('0x2f')]);_0x25a7d6[_0xc90e('0x33')]=_[_0xc90e('0x32')](_0x486bc7[_0xc90e('0x2e')],qs[_0xc90e('0x34')](_0x25b5da['query'][_0xc90e('0x34')]));_0x25a7d6[_0xc90e('0x33')]=_0x25a7d6[_0xc90e('0x33')][_0xc90e('0x35')]?_0x25a7d6['attributes']:_0x486bc7[_0xc90e('0x2e')];if(_0x25b5da[_0xc90e('0x2f')][_0xc90e('0x44')]){_0x25a7d6['include']=[{'all':!![]}];}_0x25a7d6=_[_0xc90e('0x3c')]({},_0x25a7d6,_0x25b5da['options']);return db[_0xc90e('0x2a')]['find'](_0x25a7d6)[_0xc90e('0x24')](handleEntityNotFound(_0x3f194a,null))['then'](respondWithResult(_0x3f194a,null))[_0xc90e('0x41')](handleError(_0x3f194a,null));};exports[_0xc90e('0x45')]=function(_0x3812ed,_0x324a04){return db[_0xc90e('0x2a')][_0xc90e('0x45')](_0x3812ed[_0xc90e('0x46')],{})[_0xc90e('0x24')](respondWithResult(_0x324a04,0xc9))['catch'](handleError(_0x324a04,null));};exports[_0xc90e('0x23')]=function(_0x3de64f,_0x58eed6){if(_0x3de64f['body']['id']){delete _0x3de64f[_0xc90e('0x46')]['id'];}return db['FreshsalesAccount'][_0xc90e('0x47')]({'where':{'id':_0x3de64f[_0xc90e('0x43')]['id']}})[_0xc90e('0x24')](handleEntityNotFound(_0x58eed6,null))[_0xc90e('0x24')](saveUpdates(_0x3de64f[_0xc90e('0x46')],null))['then'](respondWithResult(_0x58eed6,null))[_0xc90e('0x41')](handleError(_0x58eed6,null));};exports[_0xc90e('0x25')]=function(_0x496b00,_0x2f6d54){return db['FreshsalesAccount'][_0xc90e('0x47')]({'where':{'id':_0x496b00['params']['id']}})[_0xc90e('0x24')](handleEntityNotFound(_0x2f6d54,null))[_0xc90e('0x24')](removeEntity(_0x2f6d54,null))[_0xc90e('0x41')](handleError(_0x2f6d54,null));};exports[_0xc90e('0x48')]=function(_0xc7d60f,_0x3b8ec8,_0xa8b8b6){var _0x25b48f={};var _0x2697a1={};var _0x1cca00;var _0x10b7e8;return db[_0xc90e('0x2a')][_0xc90e('0x49')]({'where':{'id':_0xc7d60f[_0xc90e('0x43')]['id']}})[_0xc90e('0x24')](handleEntityNotFound(_0x3b8ec8,null))[_0xc90e('0x24')](function(_0x49467d){if(_0x49467d){_0x1cca00=_0x49467d;_0x2697a1[_0xc90e('0x2e')]=_[_0xc90e('0x30')](db[_0xc90e('0x4a')][_0xc90e('0x2b')]);_0x2697a1[_0xc90e('0x2f')]=_[_0xc90e('0x30')](_0xc7d60f[_0xc90e('0x2f')]);_0x2697a1['filters']=_[_0xc90e('0x32')](_0x2697a1['model'],_0x2697a1[_0xc90e('0x2f')]);_0x25b48f[_0xc90e('0x33')]=_[_0xc90e('0x32')](_0x2697a1[_0xc90e('0x2e')],qs[_0xc90e('0x34')](_0xc7d60f['query'][_0xc90e('0x34')]));_0x25b48f[_0xc90e('0x33')]=_0x25b48f['attributes'][_0xc90e('0x35')]?_0x25b48f[_0xc90e('0x33')]:_0x2697a1[_0xc90e('0x2e')];_0x25b48f[_0xc90e('0x37')]=qs['sort'](_0xc7d60f['query'][_0xc90e('0x38')]);_0x25b48f[_0xc90e('0x3b')]=qs[_0xc90e('0x31')](_[_0xc90e('0x39')](_0xc7d60f[_0xc90e('0x2f')],_0x2697a1['filters']));if(_0xc7d60f[_0xc90e('0x2f')][_0xc90e('0x3a')]){_0x25b48f['where']=_['merge'](_0x25b48f[_0xc90e('0x3b')],{'$or':_[_0xc90e('0x29')](_0x25b48f[_0xc90e('0x33')],function(_0x36512b){var _0x5a3274={};_0x5a3274[_0x36512b]={'$like':'%'+_0xc7d60f[_0xc90e('0x2f')][_0xc90e('0x3a')]+'%'};return _0x5a3274;})});}_0x25b48f=_[_0xc90e('0x3c')]({},_0x25b48f,_0xc7d60f[_0xc90e('0x3e')]);return _0x1cca00[_0xc90e('0x48')](_0x25b48f);}})[_0xc90e('0x24')](function(_0x171938){if(_0x171938){_0x10b7e8=_0x171938[_0xc90e('0x35')];if(!_0xc7d60f['query'][_0xc90e('0x36')](_0xc90e('0x4b'))){_0x25b48f[_0xc90e('0x1c')]=qs[_0xc90e('0x1c')](_0xc7d60f[_0xc90e('0x2f')]['limit']);_0x25b48f[_0xc90e('0x1b')]=qs[_0xc90e('0x1b')](_0xc7d60f[_0xc90e('0x2f')]['offset']);}return _0x1cca00['getConfigurations'](_0x25b48f);}})[_0xc90e('0x24')](function(_0x52691a){if(_0x52691a){return _0x52691a?{'count':_0x10b7e8,'rows':_0x52691a}:null;}})[_0xc90e('0x24')](respondWithResult(_0x3b8ec8,null))['catch'](handleError(_0x3b8ec8,null));};exports[_0xc90e('0x4c')]=function(_0x323e47,_0x26b89b,_0x36946f){if(_0x323e47[_0xc90e('0x46')]['id']){delete _0x323e47[_0xc90e('0x46')]['id'];}return db[_0xc90e('0x2a')][_0xc90e('0x49')]({'where':{'id':_0x323e47[_0xc90e('0x43')]['id']}})[_0xc90e('0x24')](handleEntityNotFound(_0x26b89b,null))[_0xc90e('0x24')](function(_0x22ee16){if(_0x22ee16){_0x323e47['body'][_0xc90e('0x4d')]=_0x22ee16['id'];_0x323e47['body']['Subjects']=integrations['getSubjects'](_0x323e47['body'][_0xc90e('0x4e')],_0x323e47[_0xc90e('0x46')]['type']);_0x323e47[_0xc90e('0x46')][_0xc90e('0x4f')]=integrations[_0xc90e('0x50')](_0x323e47[_0xc90e('0x46')][_0xc90e('0x4e')],_0x323e47[_0xc90e('0x46')]['type']);return db[_0xc90e('0x4a')][_0xc90e('0x45')](_0x323e47[_0xc90e('0x46')],{'include':[{'model':db[_0xc90e('0x51')],'as':_0xc90e('0x52')},{'model':db[_0xc90e('0x51')],'as':'Descriptions'}]});}return null;})[_0xc90e('0x24')](respondWithResult(_0x26b89b,null))['catch'](handleError(_0x26b89b,null));};exports[_0xc90e('0x53')]=function(_0x592924,_0x5c96c9,_0x247f6a){var _0x2b02f1='';var _0x51f714='';return db[_0xc90e('0x2a')]['findOne']({'where':{'id':_0x592924['params']['id']},'attributes':['id','username','remoteUri',_0xc90e('0x54')]})[_0xc90e('0x24')](handleEntityNotFound(_0x5c96c9,null))['then'](function(_0x104288){if(_0x104288){_0x51f714=_0x104288[_0xc90e('0x55')];_0x2b02f1=_0x104288[_0xc90e('0x56')];var _0xb4bb6a=_0x104288[_0xc90e('0x56')][_0xc90e('0x57')](-0x1);if(_0xb4bb6a==='/'){_0x2b02f1=_0x2b02f1[_0xc90e('0x58')](0x0,_0x2b02f1['lastIndexOf'](_0xb4bb6a));}return rp({'method':_0xc90e('0x59'),'uri':util[_0xc90e('0x5a')]('%s%s',_0x2b02f1,'/api/selector/owners'),'headers':{'Authorization':_0xc90e('0x5b')+_0x104288['apiKey']},'json':!![]});}})['then'](function(_0x1df4de){if(_0x1df4de){var _0x3f44f0=_0x1df4de[_0xc90e('0x5c')];var _0x16a95f=![];var _0x1fb4c5=null;for(_0x1fb4c5=0x0;_0x1fb4c5<_0x3f44f0[_0xc90e('0x35')];_0x1fb4c5++){if(_0x3f44f0[_0x1fb4c5][_0xc90e('0x5d')]===_0x51f714){_0x16a95f=!![];}}if(_0x16a95f){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xc90e('0x24')](respondWithResult(_0x5c96c9,null))[_0xc90e('0x41')](function(_0x56f2be){var _0x29619f=_0x592924[_0xc90e('0x2f')][_0xc90e('0x5e')]?0x1f4:_0x56f2be['statusCode']||0x1f4;logger['error'](_0xc90e('0x5f'),'getFields',_0x29619f,JSON[_0xc90e('0x60')](_0x56f2be));delete _0x56f2be[_0xc90e('0x28')];if(_0x29619f===0x191){_0x29619f=0x190;}_0x5c96c9[_0xc90e('0x19')](_0x29619f)[_0xc90e('0x61')](_0x592924['query'][_0xc90e('0x5e')]?{'message':_0xc90e('0x62'),'statusCode':_0x56f2be[_0xc90e('0x63')]}:_0x56f2be);});}; \ No newline at end of file +var _0x54b2=['key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','FreshsalesAccount','findAll','rows','catch','show','params','keys','create','body','find','destroy','FreshsalesConfiguration','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','findOne','remoteUri','apiKey','username','slice','lastIndexOf','GET','%s%s','/api/selector/owners','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type'];(function(_0x3db4d4,_0x5bae35){var _0x25dbf0=function(_0x15099d){while(--_0x15099d){_0x3db4d4['push'](_0x3db4d4['shift']());}};_0x25dbf0(++_0x5bae35);}(_0x54b2,0x113));var _0x254b=function(_0x4a7dea,_0x1c8cbc){_0x4a7dea=_0x4a7dea-0x0;var _0x58f094=_0x54b2[_0x4a7dea];return _0x58f094;};'use strict';var emlformat=require(_0x254b('0x0'));var rimraf=require(_0x254b('0x1'));var zipdir=require(_0x254b('0x2'));var jsonpatch=require(_0x254b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x254b('0x4'));var Mustache=require(_0x254b('0x5'));var util=require(_0x254b('0x6'));var path=require('path');var sox=require(_0x254b('0x7'));var csv=require(_0x254b('0x8'));var ejs=require(_0x254b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x254b('0xa'));var squel=require(_0x254b('0xb'));var crypto=require('crypto');var jsforce=require(_0x254b('0xc'));var deskjs=require(_0x254b('0xd'));var toCsv=require(_0x254b('0x8'));var querystring=require(_0x254b('0xe'));var Papa=require(_0x254b('0xf'));var Redis=require(_0x254b('0x10'));var authService=require(_0x254b('0x11'));var qs=require(_0x254b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x254b('0x13'));var logger=require(_0x254b('0x14'))(_0x254b('0x15'));var utils=require(_0x254b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x254b('0x17'));var db=require(_0x254b('0x18'))['db'];var integrations=require(_0x254b('0x19'));function respondWithStatusCode(_0x4a1cbe,_0x2e153d){_0x2e153d=_0x2e153d||0xcc;return function(_0x23f133){if(_0x23f133){return _0x4a1cbe[_0x254b('0x1a')](_0x2e153d);}return _0x4a1cbe[_0x254b('0x1b')](_0x2e153d)['end']();};}function respondWithResult(_0x173ba1,_0x8b383a){_0x8b383a=_0x8b383a||0xc8;return function(_0x264752){if(_0x264752){return _0x173ba1[_0x254b('0x1b')](_0x8b383a)[_0x254b('0x1c')](_0x264752);}};}function respondWithFilteredResult(_0x34284b,_0x491c2e){return function(_0x4dc500){if(_0x4dc500){var _0x44efb0=typeof _0x491c2e[_0x254b('0x1d')]===_0x254b('0x1e')&&typeof _0x491c2e[_0x254b('0x1f')]===_0x254b('0x1e');var _0x1c24fe=_0x4dc500['count'];var _0x88cea8=_0x44efb0?0x0:_0x491c2e[_0x254b('0x1d')];var _0x24c047=_0x44efb0?_0x4dc500[_0x254b('0x20')]:_0x491c2e[_0x254b('0x1d')]+_0x491c2e[_0x254b('0x1f')];var _0x34283f;if(_0x24c047>=_0x1c24fe){_0x24c047=_0x1c24fe;_0x34283f=0xc8;}else{_0x34283f=0xce;}_0x34284b[_0x254b('0x1b')](_0x34283f);return _0x34284b[_0x254b('0x21')](_0x254b('0x22'),_0x88cea8+'-'+_0x24c047+'/'+_0x1c24fe)[_0x254b('0x1c')](_0x4dc500);}return null;};}function patchUpdates(_0x3d9fe4){return function(_0x2b304b){try{jsonpatch[_0x254b('0x23')](_0x2b304b,_0x3d9fe4,!![]);}catch(_0x3888a3){return BPromise['reject'](_0x3888a3);}return _0x2b304b[_0x254b('0x24')]();};}function saveUpdates(_0x35eb11,_0x456644){return function(_0x5e850a){if(_0x5e850a){return _0x5e850a[_0x254b('0x25')](_0x35eb11)[_0x254b('0x26')](function(_0xd0bdd5){return _0xd0bdd5;});}return null;};}function removeEntity(_0x1be691,_0x3ec8d1){return function(_0x1b8fbd){if(_0x1b8fbd){return _0x1b8fbd['destroy']()[_0x254b('0x26')](function(){_0x1be691['status'](0xcc)[_0x254b('0x27')]();});}};}function handleEntityNotFound(_0x3e948e,_0x4f5122){return function(_0x33e818){if(!_0x33e818){_0x3e948e[_0x254b('0x1a')](0x194);}return _0x33e818;};}function handleError(_0x198f71,_0x9600c3){_0x9600c3=_0x9600c3||0x1f4;return function(_0x20470b){logger[_0x254b('0x28')](_0x20470b[_0x254b('0x29')]);if(_0x20470b['name']){delete _0x20470b[_0x254b('0x2a')];}_0x198f71[_0x254b('0x1b')](_0x9600c3)[_0x254b('0x2b')](_0x20470b);};}exports[_0x254b('0x2c')]=function(_0x2cdb14,_0xfebf1f){var _0x3bfbf1={},_0x55d1e4={},_0x460807={'count':0x0,'rows':[]};var _0x1e59b8=_[_0x254b('0x2d')](db['FreshsalesAccount'][_0x254b('0x2e')],function(_0x55ac17){return{'name':_0x55ac17[_0x254b('0x2f')],'type':_0x55ac17[_0x254b('0x30')][_0x254b('0x31')]};});_0x55d1e4[_0x254b('0x32')]=_['map'](_0x1e59b8,'name');_0x55d1e4[_0x254b('0x33')]=_['keys'](_0x2cdb14[_0x254b('0x33')]);_0x55d1e4[_0x254b('0x34')]=_[_0x254b('0x35')](_0x55d1e4[_0x254b('0x32')],_0x55d1e4[_0x254b('0x33')]);_0x3bfbf1[_0x254b('0x36')]=_[_0x254b('0x35')](_0x55d1e4[_0x254b('0x32')],qs[_0x254b('0x37')](_0x2cdb14['query'][_0x254b('0x37')]));_0x3bfbf1[_0x254b('0x36')]=_0x3bfbf1[_0x254b('0x36')][_0x254b('0x38')]?_0x3bfbf1[_0x254b('0x36')]:_0x55d1e4[_0x254b('0x32')];if(!_0x2cdb14[_0x254b('0x33')]['hasOwnProperty'](_0x254b('0x39'))){_0x3bfbf1[_0x254b('0x1f')]=qs[_0x254b('0x1f')](_0x2cdb14[_0x254b('0x33')]['limit']);_0x3bfbf1[_0x254b('0x1d')]=qs['offset'](_0x2cdb14[_0x254b('0x33')][_0x254b('0x1d')]);}_0x3bfbf1[_0x254b('0x3a')]=qs[_0x254b('0x3b')](_0x2cdb14['query']['sort']);_0x3bfbf1['where']=qs['filters'](_[_0x254b('0x3c')](_0x2cdb14[_0x254b('0x33')],_0x55d1e4[_0x254b('0x34')]),_0x1e59b8);if(_0x2cdb14[_0x254b('0x33')][_0x254b('0x3d')]){_0x3bfbf1[_0x254b('0x3e')]=_[_0x254b('0x3f')](_0x3bfbf1[_0x254b('0x3e')],{'$or':_[_0x254b('0x2d')](_0x1e59b8,function(_0x2adfc6){if(_0x2adfc6['type']!==_0x254b('0x40')){var _0x3dd45f={};_0x3dd45f[_0x2adfc6[_0x254b('0x2a')]]={'$like':'%'+_0x2cdb14['query'][_0x254b('0x3d')]+'%'};return _0x3dd45f;}})});}_0x3bfbf1=_[_0x254b('0x3f')]({},_0x3bfbf1,_0x2cdb14[_0x254b('0x41')]);var _0x597fed={'where':_0x3bfbf1[_0x254b('0x3e')]};return db['FreshsalesAccount'][_0x254b('0x20')](_0x597fed)[_0x254b('0x26')](function(_0xdbb572){_0x460807[_0x254b('0x20')]=_0xdbb572;if(_0x2cdb14[_0x254b('0x33')][_0x254b('0x42')]){_0x3bfbf1[_0x254b('0x43')]=[{'all':!![]}];}return db[_0x254b('0x44')][_0x254b('0x45')](_0x3bfbf1);})['then'](function(_0x2cb984){_0x460807[_0x254b('0x46')]=_0x2cb984;return _0x460807;})['then'](respondWithFilteredResult(_0xfebf1f,_0x3bfbf1))[_0x254b('0x47')](handleError(_0xfebf1f,null));};exports[_0x254b('0x48')]=function(_0xaab18e,_0x5d2ded){var _0x52a291={'raw':![],'where':{'id':_0xaab18e[_0x254b('0x49')]['id']}},_0x27a440={};_0x27a440[_0x254b('0x32')]=_['keys'](db['FreshsalesAccount']['rawAttributes']);_0x27a440[_0x254b('0x33')]=_[_0x254b('0x4a')](_0xaab18e[_0x254b('0x33')]);_0x27a440['filters']=_['intersection'](_0x27a440[_0x254b('0x32')],_0x27a440['query']);_0x52a291['attributes']=_[_0x254b('0x35')](_0x27a440[_0x254b('0x32')],qs[_0x254b('0x37')](_0xaab18e[_0x254b('0x33')][_0x254b('0x37')]));_0x52a291[_0x254b('0x36')]=_0x52a291[_0x254b('0x36')][_0x254b('0x38')]?_0x52a291[_0x254b('0x36')]:_0x27a440[_0x254b('0x32')];if(_0xaab18e[_0x254b('0x33')][_0x254b('0x42')]){_0x52a291['include']=[{'all':!![]}];}_0x52a291=_[_0x254b('0x3f')]({},_0x52a291,_0xaab18e[_0x254b('0x41')]);return db[_0x254b('0x44')]['find'](_0x52a291)['then'](handleEntityNotFound(_0x5d2ded,null))[_0x254b('0x26')](respondWithResult(_0x5d2ded,null))['catch'](handleError(_0x5d2ded,null));};exports[_0x254b('0x4b')]=function(_0x40aaf4,_0x501407){return db['FreshsalesAccount'][_0x254b('0x4b')](_0x40aaf4['body'],{})[_0x254b('0x26')](respondWithResult(_0x501407,0xc9))[_0x254b('0x47')](handleError(_0x501407,null));};exports[_0x254b('0x25')]=function(_0x219cb8,_0xf5bb82){if(_0x219cb8[_0x254b('0x4c')]['id']){delete _0x219cb8[_0x254b('0x4c')]['id'];}return db[_0x254b('0x44')][_0x254b('0x4d')]({'where':{'id':_0x219cb8[_0x254b('0x49')]['id']}})[_0x254b('0x26')](handleEntityNotFound(_0xf5bb82,null))[_0x254b('0x26')](saveUpdates(_0x219cb8[_0x254b('0x4c')],null))[_0x254b('0x26')](respondWithResult(_0xf5bb82,null))[_0x254b('0x47')](handleError(_0xf5bb82,null));};exports[_0x254b('0x4e')]=function(_0xda10ef,_0x7e54dd){return db[_0x254b('0x44')]['find']({'where':{'id':_0xda10ef[_0x254b('0x49')]['id']}})[_0x254b('0x26')](handleEntityNotFound(_0x7e54dd,null))[_0x254b('0x26')](removeEntity(_0x7e54dd,null))[_0x254b('0x47')](handleError(_0x7e54dd,null));};exports['getConfigurations']=function(_0x21f338,_0x27321c,_0x1a571e){var _0x2ae84b={};var _0x3c488e={};var _0x306331;var _0x33a857;return db[_0x254b('0x44')]['findOne']({'where':{'id':_0x21f338[_0x254b('0x49')]['id']}})[_0x254b('0x26')](handleEntityNotFound(_0x27321c,null))[_0x254b('0x26')](function(_0x4358b2){if(_0x4358b2){_0x306331=_0x4358b2;_0x3c488e[_0x254b('0x32')]=_[_0x254b('0x4a')](db[_0x254b('0x4f')][_0x254b('0x2e')]);_0x3c488e[_0x254b('0x33')]=_[_0x254b('0x4a')](_0x21f338[_0x254b('0x33')]);_0x3c488e['filters']=_[_0x254b('0x35')](_0x3c488e['model'],_0x3c488e[_0x254b('0x33')]);_0x2ae84b[_0x254b('0x36')]=_[_0x254b('0x35')](_0x3c488e[_0x254b('0x32')],qs[_0x254b('0x37')](_0x21f338['query'][_0x254b('0x37')]));_0x2ae84b['attributes']=_0x2ae84b[_0x254b('0x36')][_0x254b('0x38')]?_0x2ae84b[_0x254b('0x36')]:_0x3c488e[_0x254b('0x32')];_0x2ae84b[_0x254b('0x3a')]=qs[_0x254b('0x3b')](_0x21f338[_0x254b('0x33')][_0x254b('0x3b')]);_0x2ae84b[_0x254b('0x3e')]=qs[_0x254b('0x34')](_[_0x254b('0x3c')](_0x21f338[_0x254b('0x33')],_0x3c488e[_0x254b('0x34')]));if(_0x21f338[_0x254b('0x33')][_0x254b('0x3d')]){_0x2ae84b['where']=_[_0x254b('0x3f')](_0x2ae84b[_0x254b('0x3e')],{'$or':_[_0x254b('0x2d')](_0x2ae84b[_0x254b('0x36')],function(_0x36aad7){var _0x4c863a={};_0x4c863a[_0x36aad7]={'$like':'%'+_0x21f338[_0x254b('0x33')][_0x254b('0x3d')]+'%'};return _0x4c863a;})});}_0x2ae84b=_[_0x254b('0x3f')]({},_0x2ae84b,_0x21f338[_0x254b('0x41')]);return _0x306331[_0x254b('0x50')](_0x2ae84b);}})['then'](function(_0x2f263e){if(_0x2f263e){_0x33a857=_0x2f263e[_0x254b('0x38')];if(!_0x21f338[_0x254b('0x33')][_0x254b('0x51')]('nolimit')){_0x2ae84b['limit']=qs[_0x254b('0x1f')](_0x21f338[_0x254b('0x33')][_0x254b('0x1f')]);_0x2ae84b[_0x254b('0x1d')]=qs[_0x254b('0x1d')](_0x21f338['query']['offset']);}return _0x306331[_0x254b('0x50')](_0x2ae84b);}})[_0x254b('0x26')](function(_0x24ace5){if(_0x24ace5){return _0x24ace5?{'count':_0x33a857,'rows':_0x24ace5}:null;}})['then'](respondWithResult(_0x27321c,null))[_0x254b('0x47')](handleError(_0x27321c,null));};exports[_0x254b('0x52')]=function(_0x4e98af,_0x48c642,_0xd04c40){if(_0x4e98af['body']['id']){delete _0x4e98af[_0x254b('0x4c')]['id'];}return db[_0x254b('0x44')]['findOne']({'where':{'id':_0x4e98af[_0x254b('0x49')]['id']}})[_0x254b('0x26')](handleEntityNotFound(_0x48c642,null))[_0x254b('0x26')](function(_0x18406){if(_0x18406){_0x4e98af[_0x254b('0x4c')][_0x254b('0x53')]=_0x18406['id'];_0x4e98af[_0x254b('0x4c')][_0x254b('0x54')]=integrations[_0x254b('0x55')](_0x4e98af[_0x254b('0x4c')][_0x254b('0x56')],_0x4e98af['body']['type']);_0x4e98af['body'][_0x254b('0x57')]=integrations[_0x254b('0x58')](_0x4e98af[_0x254b('0x4c')]['channel'],_0x4e98af[_0x254b('0x4c')][_0x254b('0x30')]);return db['FreshsalesConfiguration']['create'](_0x4e98af[_0x254b('0x4c')],{'include':[{'model':db[_0x254b('0x59')],'as':'Subjects'},{'model':db[_0x254b('0x59')],'as':_0x254b('0x57')}]});}return null;})[_0x254b('0x26')](respondWithResult(_0x48c642,null))[_0x254b('0x47')](handleError(_0x48c642,null));};exports['getFields']=function(_0xd81ba1,_0x30ffd2,_0x93a343){var _0x8bd813='';var _0x207071='';return db['FreshsalesAccount'][_0x254b('0x5a')]({'where':{'id':_0xd81ba1[_0x254b('0x49')]['id']},'attributes':['id','username',_0x254b('0x5b'),_0x254b('0x5c')]})[_0x254b('0x26')](handleEntityNotFound(_0x30ffd2,null))[_0x254b('0x26')](function(_0x3ddbdb){if(_0x3ddbdb){_0x207071=_0x3ddbdb[_0x254b('0x5d')];_0x8bd813=_0x3ddbdb[_0x254b('0x5b')];var _0x422861=_0x3ddbdb['remoteUri'][_0x254b('0x5e')](-0x1);if(_0x422861==='/'){_0x8bd813=_0x8bd813['substring'](0x0,_0x8bd813[_0x254b('0x5f')](_0x422861));}return rp({'method':_0x254b('0x60'),'uri':util['format'](_0x254b('0x61'),_0x8bd813,_0x254b('0x62')),'headers':{'Authorization':'Token\x20token='+_0x3ddbdb[_0x254b('0x5c')]},'json':!![]});}})['then'](function(_0x473005){if(_0x473005){var _0x1dcbf7=_0x473005[_0x254b('0x63')];var _0x46cc8c=![];var _0xfa7906=null;for(_0xfa7906=0x0;_0xfa7906<_0x1dcbf7[_0x254b('0x38')];_0xfa7906++){if(_0x1dcbf7[_0xfa7906][_0x254b('0x64')]===_0x207071){_0x46cc8c=!![];}}if(_0x46cc8c){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x254b('0x65')});}}})[_0x254b('0x26')](respondWithResult(_0x30ffd2,null))[_0x254b('0x47')](function(_0xa8667){var _0x367c17=_0xd81ba1['query'][_0x254b('0x66')]?0x1f4:_0xa8667[_0x254b('0x67')]||0x1f4;logger[_0x254b('0x28')](_0x254b('0x68'),_0x254b('0x69'),_0x367c17,JSON[_0x254b('0x6a')](_0xa8667));delete _0xa8667[_0x254b('0x2a')];if(_0x367c17===0x191){_0x367c17=0x190;}_0x30ffd2[_0x254b('0x1b')](_0x367c17)[_0x254b('0x2b')](_0xd81ba1['query']['test']?{'message':_0x254b('0x6b'),'statusCode':_0xa8667[_0x254b('0x67')]}:_0xa8667);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index ae5a4a0..a86a90c 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 _0x4975=['path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2196f5,_0x46c5b1){var _0x58eed9=function(_0x34ea74){while(--_0x34ea74){_0x2196f5['push'](_0x2196f5['shift']());}};_0x58eed9(++_0x46c5b1);}(_0x4975,0x86));var _0x5497=function(_0x5b0bda,_0xdce4d7){_0x5b0bda=_0x5b0bda-0x0;var _0x4720e6=_0x4975[_0x5b0bda];return _0x4720e6;};'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'));var integrations=require(_0x5497('0xa'));module['exports']=function(_0x37e48d,_0x4f563d){return _0x37e48d[_0x5497('0xb')](_0x5497('0xc'),attributes,{'tableName':_0x5497('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bd3=['define','int_freshsales_accounts','lodash','../../config/logger','api','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x4bd3,0x174));var _0x34bd=function(_0x2e7ac8,_0x4dc660){_0x2e7ac8=_0x2e7ac8-0x0;var _0x79aa51=_0x4bd3[_0x2e7ac8];return _0x79aa51;};'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('./intFreshsalesAccount.attributes');var integrations=require(_0x34bd('0x6'));module[_0x34bd('0x7')]=function(_0x5c2a7a,_0x3e8744){return _0x5c2a7a[_0x34bd('0x8')]('FreshsalesAccount',attributes,{'tableName':_0x34bd('0x9'),'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 6f3854f..050cb15 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 _0x781d=['model','map','GetFreshsalesAccount','find','ShowFreshsalesAccount','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','FreshsalesAccount','findAll','options','where','attributes','limit','include'];(function(_0x1895b7,_0x21fbc7){var _0x1aecdc=function(_0x44682a){while(--_0x44682a){_0x1895b7['push'](_0x1895b7['shift']());}};_0x1aecdc(++_0x21fbc7);}(_0x781d,0x14a));var _0xd781=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x781d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd781('0x2'));var fs=require('fs');var Redis=require(_0xd781('0x3'));var db=require(_0xd781('0x4'))['db'];var utils=require(_0xd781('0x5'));var logger=require(_0xd781('0x6'))(_0xd781('0x7'));var config=require(_0xd781('0x8'));var jayson=require(_0xd781('0x9'));var client=jayson[_0xd781('0xa')][_0xd781('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a07f0,_0x133509,_0x1a242d){return new BPromise(function(_0x50610d,_0x248172){return client['request'](_0x5a07f0,_0x1a242d)[_0xd781('0xc')](function(_0x5c18c8){logger[_0xd781('0xd')](_0xd781('0xe'),_0x133509,'request\x20sent');logger[_0xd781('0xf')](_0xd781('0x10'),_0x133509,'request\x20sent',JSON['stringify'](_0x5c18c8));if(_0x5c18c8[_0xd781('0x11')]){if(_0x5c18c8[_0xd781('0x11')][_0xd781('0x12')]===0x1f4){logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x5c18c8[_0xd781('0x11')][_0xd781('0x13')]);return _0x248172(_0x5c18c8[_0xd781('0x11')][_0xd781('0x13')]);}logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x5c18c8['error'][_0xd781('0x13')]);return _0x50610d(_0x5c18c8[_0xd781('0x11')]['message']);}else{logger[_0xd781('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x133509,_0xd781('0x14'));_0x50610d(_0x5c18c8[_0xd781('0x15')][_0xd781('0x13')]);}})[_0xd781('0x16')](function(_0x42a9c1){logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x42a9c1);_0x248172(_0x42a9c1);});});}exports['GetFreshsalesAccount']=function(_0x1407fc){var _0x3f2922=this;return new Promise(function(_0x395d9c,_0x2f1273){return db[_0xd781('0x17')][_0xd781('0x18')]({'raw':_0x1407fc[_0xd781('0x19')]?_0x1407fc[_0xd781('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1407fc[_0xd781('0x19')]?_0x1407fc[_0xd781('0x19')][_0xd781('0x1a')]||null:null,'attributes':_0x1407fc[_0xd781('0x19')]?_0x1407fc[_0xd781('0x19')][_0xd781('0x1b')]||null:null,'limit':_0x1407fc[_0xd781('0x19')]?_0x1407fc['options'][_0xd781('0x1c')]||null:null,'include':_0x1407fc['options']?_0x1407fc['options'][_0xd781('0x1d')]?_['map'](_0x1407fc[_0xd781('0x19')][_0xd781('0x1d')],function(_0x395087){return{'model':db[_0x395087[_0xd781('0x1e')]],'as':_0x395087['as'],'attributes':_0x395087[_0xd781('0x1b')],'include':_0x395087[_0xd781('0x1d')]?_[_0xd781('0x1f')](_0x395087[_0xd781('0x1d')],function(_0x10940b){return{'model':db[_0x10940b['model']],'as':_0x10940b['as'],'attributes':_0x10940b['attributes'],'include':_0x10940b[_0xd781('0x1d')]?_[_0xd781('0x1f')](_0x10940b[_0xd781('0x1d')],function(_0x57b41e){return{'model':db[_0x57b41e[_0xd781('0x1e')]],'as':_0x57b41e['as'],'attributes':_0x57b41e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e29c8){logger['info'](_0xd781('0x20'),_0x1407fc);logger[_0xd781('0xf')]('GetFreshsalesAccount',_0x1407fc,JSON['stringify'](_0x1e29c8));_0x395d9c(_0x1e29c8);})[_0xd781('0x16')](function(_0x5b0464){logger[_0xd781('0x11')]('GetFreshsalesAccount',_0x5b0464[_0xd781('0x13')],_0x1407fc);_0x2f1273(_0x3f2922[_0xd781('0x11')](0x1f4,_0x5b0464['message']));});});};exports['ShowFreshsalesAccount']=function(_0x432d14){var _0x29e81a=this;return new Promise(function(_0x1c7d83,_0x5a389c){return db['FreshsalesAccount'][_0xd781('0x21')]({'raw':_0x432d14[_0xd781('0x19')]?_0x432d14[_0xd781('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x432d14['options']?_0x432d14[_0xd781('0x19')][_0xd781('0x1a')]||null:null,'attributes':_0x432d14['options']?_0x432d14[_0xd781('0x19')][_0xd781('0x1b')]||null:null,'include':_0x432d14['options']?_0x432d14[_0xd781('0x19')][_0xd781('0x1d')]?_[_0xd781('0x1f')](_0x432d14[_0xd781('0x19')]['include'],function(_0x23dffb){return{'model':db[_0x23dffb[_0xd781('0x1e')]],'as':_0x23dffb['as'],'attributes':_0x23dffb[_0xd781('0x1b')],'include':_0x23dffb[_0xd781('0x1d')]?_['map'](_0x23dffb[_0xd781('0x1d')],function(_0x3f20e2){return{'model':db[_0x3f20e2['model']],'as':_0x3f20e2['as'],'attributes':_0x3f20e2[_0xd781('0x1b')],'include':_0x3f20e2['include']?_[_0xd781('0x1f')](_0x3f20e2[_0xd781('0x1d')],function(_0x57fdb6){return{'model':db[_0x57fdb6[_0xd781('0x1e')]],'as':_0x57fdb6['as'],'attributes':_0x57fdb6[_0xd781('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a29b7){logger['info'](_0xd781('0x22'),_0x432d14);logger[_0xd781('0xf')]('ShowFreshsalesAccount',_0x432d14,JSON[_0xd781('0x23')](_0x2a29b7));_0x1c7d83(_0x2a29b7);})[_0xd781('0x16')](function(_0x5651de){logger[_0xd781('0x11')](_0xd781('0x22'),_0x5651de[_0xd781('0x13')],_0x432d14);_0x5a389c(_0x29e81a['error'](0x1f4,_0x5651de[_0xd781('0x13')]));});});}; \ No newline at end of file +var _0x781d=['model','map','GetFreshsalesAccount','find','ShowFreshsalesAccount','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','FreshsalesAccount','findAll','options','where','attributes','limit','include'];(function(_0x4c9380,_0x2fefc0){var _0x49a523=function(_0x165e85){while(--_0x165e85){_0x4c9380['push'](_0x4c9380['shift']());}};_0x49a523(++_0x2fefc0);}(_0x781d,0x14a));var _0xd781=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x781d[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd781('0x2'));var fs=require('fs');var Redis=require(_0xd781('0x3'));var db=require(_0xd781('0x4'))['db'];var utils=require(_0xd781('0x5'));var logger=require(_0xd781('0x6'))(_0xd781('0x7'));var config=require(_0xd781('0x8'));var jayson=require(_0xd781('0x9'));var client=jayson[_0xd781('0xa')][_0xd781('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a07f0,_0x133509,_0x1a242d){return new BPromise(function(_0x50610d,_0x248172){return client['request'](_0x5a07f0,_0x1a242d)[_0xd781('0xc')](function(_0x5c18c8){logger[_0xd781('0xd')](_0xd781('0xe'),_0x133509,'request\x20sent');logger[_0xd781('0xf')](_0xd781('0x10'),_0x133509,'request\x20sent',JSON['stringify'](_0x5c18c8));if(_0x5c18c8[_0xd781('0x11')]){if(_0x5c18c8[_0xd781('0x11')][_0xd781('0x12')]===0x1f4){logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x5c18c8[_0xd781('0x11')][_0xd781('0x13')]);return _0x248172(_0x5c18c8[_0xd781('0x11')][_0xd781('0x13')]);}logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x5c18c8['error'][_0xd781('0x13')]);return _0x50610d(_0x5c18c8[_0xd781('0x11')]['message']);}else{logger[_0xd781('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x133509,_0xd781('0x14'));_0x50610d(_0x5c18c8[_0xd781('0x15')][_0xd781('0x13')]);}})[_0xd781('0x16')](function(_0x42a9c1){logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x42a9c1);_0x248172(_0x42a9c1);});});}exports['GetFreshsalesAccount']=function(_0x1407fc){var _0x3f2922=this;return new Promise(function(_0x395d9c,_0x2f1273){return db[_0xd781('0x17')][_0xd781('0x18')]({'raw':_0x1407fc[_0xd781('0x19')]?_0x1407fc[_0xd781('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1407fc[_0xd781('0x19')]?_0x1407fc[_0xd781('0x19')][_0xd781('0x1a')]||null:null,'attributes':_0x1407fc[_0xd781('0x19')]?_0x1407fc[_0xd781('0x19')][_0xd781('0x1b')]||null:null,'limit':_0x1407fc[_0xd781('0x19')]?_0x1407fc['options'][_0xd781('0x1c')]||null:null,'include':_0x1407fc['options']?_0x1407fc['options'][_0xd781('0x1d')]?_['map'](_0x1407fc[_0xd781('0x19')][_0xd781('0x1d')],function(_0x395087){return{'model':db[_0x395087[_0xd781('0x1e')]],'as':_0x395087['as'],'attributes':_0x395087[_0xd781('0x1b')],'include':_0x395087[_0xd781('0x1d')]?_[_0xd781('0x1f')](_0x395087[_0xd781('0x1d')],function(_0x10940b){return{'model':db[_0x10940b['model']],'as':_0x10940b['as'],'attributes':_0x10940b['attributes'],'include':_0x10940b[_0xd781('0x1d')]?_[_0xd781('0x1f')](_0x10940b[_0xd781('0x1d')],function(_0x57b41e){return{'model':db[_0x57b41e[_0xd781('0x1e')]],'as':_0x57b41e['as'],'attributes':_0x57b41e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e29c8){logger['info'](_0xd781('0x20'),_0x1407fc);logger[_0xd781('0xf')]('GetFreshsalesAccount',_0x1407fc,JSON['stringify'](_0x1e29c8));_0x395d9c(_0x1e29c8);})[_0xd781('0x16')](function(_0x5b0464){logger[_0xd781('0x11')]('GetFreshsalesAccount',_0x5b0464[_0xd781('0x13')],_0x1407fc);_0x2f1273(_0x3f2922[_0xd781('0x11')](0x1f4,_0x5b0464['message']));});});};exports['ShowFreshsalesAccount']=function(_0x432d14){var _0x29e81a=this;return new Promise(function(_0x1c7d83,_0x5a389c){return db['FreshsalesAccount'][_0xd781('0x21')]({'raw':_0x432d14[_0xd781('0x19')]?_0x432d14[_0xd781('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x432d14['options']?_0x432d14[_0xd781('0x19')][_0xd781('0x1a')]||null:null,'attributes':_0x432d14['options']?_0x432d14[_0xd781('0x19')][_0xd781('0x1b')]||null:null,'include':_0x432d14['options']?_0x432d14[_0xd781('0x19')][_0xd781('0x1d')]?_[_0xd781('0x1f')](_0x432d14[_0xd781('0x19')]['include'],function(_0x23dffb){return{'model':db[_0x23dffb[_0xd781('0x1e')]],'as':_0x23dffb['as'],'attributes':_0x23dffb[_0xd781('0x1b')],'include':_0x23dffb[_0xd781('0x1d')]?_['map'](_0x23dffb[_0xd781('0x1d')],function(_0x3f20e2){return{'model':db[_0x3f20e2['model']],'as':_0x3f20e2['as'],'attributes':_0x3f20e2[_0xd781('0x1b')],'include':_0x3f20e2['include']?_[_0xd781('0x1f')](_0x3f20e2[_0xd781('0x1d')],function(_0x57fdb6){return{'model':db[_0x57fdb6[_0xd781('0x1e')]],'as':_0x57fdb6['as'],'attributes':_0x57fdb6[_0xd781('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a29b7){logger['info'](_0xd781('0x22'),_0x432d14);logger[_0xd781('0xf')]('ShowFreshsalesAccount',_0x432d14,JSON[_0xd781('0x23')](_0x2a29b7));_0x1c7d83(_0x2a29b7);})[_0xd781('0x16')](function(_0x5651de){logger[_0xd781('0x11')](_0xd781('0x22'),_0x5651de[_0xd781('0x13')],_0x432d14);_0x5a389c(_0x29e81a['error'](0x1f4,_0x5651de[_0xd781('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 8f63b72..b423b56 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 _0x8f9a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','post','put','update','delete','destroy','exports','multer','util'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x8f9a,0x1d9));var _0xa8f9=function(_0x12f451,_0x3b618f){_0x12f451=_0x12f451-0x0;var _0x5e9589=_0x8f9a[_0x12f451];return _0x5e9589;};'use strict';var multer=require(_0xa8f9('0x0'));var util=require(_0xa8f9('0x1'));var path=require('path');var timeout=require(_0xa8f9('0x2'));var express=require(_0xa8f9('0x3'));var router=express[_0xa8f9('0x4')]();var fs_extra=require(_0xa8f9('0x5'));var auth=require(_0xa8f9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa8f9('0x7'));var controller=require(_0xa8f9('0x8'));router[_0xa8f9('0x9')]('/',auth[_0xa8f9('0xa')](),controller[_0xa8f9('0xb')]);router[_0xa8f9('0x9')](_0xa8f9('0xc'),auth['isAuthenticated'](),controller[_0xa8f9('0xd')]);router[_0xa8f9('0x9')](_0xa8f9('0xe'),auth[_0xa8f9('0xa')](),controller[_0xa8f9('0xf')]);router[_0xa8f9('0x9')](_0xa8f9('0x10'),auth[_0xa8f9('0xa')](),controller[_0xa8f9('0x11')]);router[_0xa8f9('0x9')](_0xa8f9('0x12'),auth['isAuthenticated'](),controller['getFields']);router[_0xa8f9('0x13')]('/',auth[_0xa8f9('0xa')](),controller['create']);router[_0xa8f9('0x14')](_0xa8f9('0xc'),auth[_0xa8f9('0xa')](),controller[_0xa8f9('0x15')]);router[_0xa8f9('0x16')](_0xa8f9('0xc'),auth[_0xa8f9('0xa')](),controller[_0xa8f9('0x17')]);module[_0xa8f9('0x18')]=router; \ No newline at end of file +var _0x8119=['/:id/subjects','/:id/descriptions','getDescriptions','getFields','post','create','put','update','delete','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','get','isAuthenticated','/:id'];(function(_0x25fef3,_0x2238b0){var _0x5d9ea1=function(_0x1b469e){while(--_0x1b469e){_0x25fef3['push'](_0x25fef3['shift']());}};_0x5d9ea1(++_0x2238b0);}(_0x8119,0xe2));var _0x9811=function(_0x46a8c7,_0x59f5b0){_0x46a8c7=_0x46a8c7-0x0;var _0x3cf81d=_0x8119[_0x46a8c7];return _0x3cf81d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9811('0x0'));var timeout=require(_0x9811('0x1'));var express=require(_0x9811('0x2'));var router=express['Router']();var fs_extra=require(_0x9811('0x3'));var auth=require(_0x9811('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshsalesConfiguration.controller');router[_0x9811('0x5')]('/',auth[_0x9811('0x6')](),controller['index']);router[_0x9811('0x5')](_0x9811('0x7'),auth['isAuthenticated'](),controller['show']);router[_0x9811('0x5')](_0x9811('0x8'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0x9811('0x9'),auth[_0x9811('0x6')](),controller[_0x9811('0xa')]);router[_0x9811('0x5')]('/:id/fields',auth[_0x9811('0x6')](),controller[_0x9811('0xb')]);router[_0x9811('0xc')]('/',auth[_0x9811('0x6')](),controller[_0x9811('0xd')]);router[_0x9811('0xe')]('/:id',auth[_0x9811('0x6')](),controller[_0x9811('0xf')]);router[_0x9811('0x10')](_0x9811('0x7'),auth[_0x9811('0x6')](),controller['destroy']);module[_0x9811('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 67ba2b1..4661cea 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 _0x22d0=['sequelize','exports','STRING'];(function(_0xf0a9d0,_0x5719b3){var _0x52a56d=function(_0x45e682){while(--_0x45e682){_0xf0a9d0['push'](_0xf0a9d0['shift']());}};_0x52a56d(++_0x5719b3);}(_0x22d0,0x1d1));var _0x022d=function(_0x384231,_0x50be41){_0x384231=_0x384231-0x0;var _0x2480bf=_0x22d0[_0x384231];return _0x2480bf;};'use strict';var Sequelize=require(_0x022d('0x0'));module[_0x022d('0x1')]={'name':{'type':Sequelize[_0x022d('0x2')]},'description':{'type':Sequelize[_0x022d('0x2')]}}; \ No newline at end of file +var _0x70f9=['STRING','sequelize','exports'];(function(_0x417671,_0x85ccdd){var _0x11f9e6=function(_0x180b15){while(--_0x180b15){_0x417671['push'](_0x417671['shift']());}};_0x11f9e6(++_0x85ccdd);}(_0x70f9,0x163));var _0x970f=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0x70f9[_0x386c3e];return _0x4b8e13;};'use strict';var Sequelize=require(_0x970f('0x0'));module[_0x970f('0x1')]={'name':{'type':Sequelize[_0x970f('0x2')]},'description':{'type':Sequelize[_0x970f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 5198057..4b75034 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 _0x4b84=['mustache','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','FreshsalesConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','include','findAll','rows','catch','show','params','merge','find','body','getSubjects','findOne','FreshsalesField','hasOwnProperty','getDescriptions','getFields','eml-format','zip-dir','request-promise','moment'];(function(_0xe57c3e,_0xfd381f){var _0x3b22b5=function(_0x1955d0){while(--_0x1955d0){_0xe57c3e['push'](_0xe57c3e['shift']());}};_0x3b22b5(++_0xfd381f);}(_0x4b84,0x96));var _0x44b8=function(_0x4e5552,_0x19ec4e){_0x4e5552=_0x4e5552-0x0;var _0x60a338=_0x4b84[_0x4e5552];return _0x60a338;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x44b8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require(_0x44b8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x44b8('0x5'));var ejs=require(_0x44b8('0x6'));var fs=require('fs');var fs_extra=require(_0x44b8('0x7'));var _=require('lodash');var squel=require(_0x44b8('0x8'));var crypto=require(_0x44b8('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x44b8('0x5'));var querystring=require(_0x44b8('0xa'));var Papa=require(_0x44b8('0xb'));var Redis=require('ioredis');var authService=require(_0x44b8('0xc'));var qs=require(_0x44b8('0xd'));var as=require(_0x44b8('0xe'));var hardwareService=require(_0x44b8('0xf'));var logger=require(_0x44b8('0x10'))(_0x44b8('0x11'));var utils=require(_0x44b8('0x12'));var config=require(_0x44b8('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x14'))['db'];function respondWithStatusCode(_0x4e1400,_0x201f4b){_0x201f4b=_0x201f4b||0xcc;return function(_0x353307){if(_0x353307){return _0x4e1400[_0x44b8('0x15')](_0x201f4b);}return _0x4e1400[_0x44b8('0x16')](_0x201f4b)[_0x44b8('0x17')]();};}function respondWithResult(_0x404601,_0x3e5f1f){_0x3e5f1f=_0x3e5f1f||0xc8;return function(_0x5a18db){if(_0x5a18db){return _0x404601[_0x44b8('0x16')](_0x3e5f1f)[_0x44b8('0x18')](_0x5a18db);}};}function respondWithFilteredResult(_0x16ecb5,_0x2fbb57){return function(_0x4065de){if(_0x4065de){var _0xce865d=typeof _0x2fbb57[_0x44b8('0x19')]===_0x44b8('0x1a')&&typeof _0x2fbb57[_0x44b8('0x1b')]===_0x44b8('0x1a');var _0x50a13c=_0x4065de[_0x44b8('0x1c')];var _0x361d7d=_0xce865d?0x0:_0x2fbb57[_0x44b8('0x19')];var _0x397a72=_0xce865d?_0x4065de[_0x44b8('0x1c')]:_0x2fbb57[_0x44b8('0x19')]+_0x2fbb57[_0x44b8('0x1b')];var _0xc44831;if(_0x397a72>=_0x50a13c){_0x397a72=_0x50a13c;_0xc44831=0xc8;}else{_0xc44831=0xce;}_0x16ecb5[_0x44b8('0x16')](_0xc44831);return _0x16ecb5['set'](_0x44b8('0x1d'),_0x361d7d+'-'+_0x397a72+'/'+_0x50a13c)[_0x44b8('0x18')](_0x4065de);}return null;};}function patchUpdates(_0x1f81ba){return function(_0x5ede34){try{jsonpatch[_0x44b8('0x1e')](_0x5ede34,_0x1f81ba,!![]);}catch(_0x126327){return BPromise[_0x44b8('0x1f')](_0x126327);}return _0x5ede34[_0x44b8('0x20')]();};}function saveUpdates(_0x36bf42,_0x5ea388){return function(_0xe6c7cf){if(_0xe6c7cf){return _0xe6c7cf[_0x44b8('0x21')](_0x36bf42)['then'](function(_0x17e371){return _0x17e371;});}return null;};}function removeEntity(_0x214cd2,_0x4127fb){return function(_0x304dbb){if(_0x304dbb){return _0x304dbb[_0x44b8('0x22')]()[_0x44b8('0x23')](function(){_0x214cd2[_0x44b8('0x16')](0xcc)[_0x44b8('0x17')]();});}};}function handleEntityNotFound(_0x6713ee,_0x3956f6){return function(_0x281d4f){if(!_0x281d4f){_0x6713ee['sendStatus'](0x194);}return _0x281d4f;};}function handleError(_0xf918b4,_0x652bcc){_0x652bcc=_0x652bcc||0x1f4;return function(_0x4ed7d3){logger[_0x44b8('0x24')](_0x4ed7d3[_0x44b8('0x25')]);if(_0x4ed7d3[_0x44b8('0x26')]){delete _0x4ed7d3[_0x44b8('0x26')];}_0xf918b4[_0x44b8('0x16')](_0x652bcc)['send'](_0x4ed7d3);};}exports[_0x44b8('0x27')]=function(_0x119eff,_0x26f22e){var _0x425de9={},_0x22753b={},_0x8c7fdc={'count':0x0,'rows':[]};var _0x17d854=_[_0x44b8('0x28')](db[_0x44b8('0x29')][_0x44b8('0x2a')],function(_0x565843){return{'name':_0x565843[_0x44b8('0x2b')],'type':_0x565843['type'][_0x44b8('0x2c')]};});_0x22753b[_0x44b8('0x2d')]=_[_0x44b8('0x28')](_0x17d854,_0x44b8('0x26'));_0x22753b[_0x44b8('0x2e')]=_[_0x44b8('0x2f')](_0x119eff['query']);_0x22753b[_0x44b8('0x30')]=_['intersection'](_0x22753b['model'],_0x22753b[_0x44b8('0x2e')]);_0x425de9[_0x44b8('0x31')]=_[_0x44b8('0x32')](_0x22753b[_0x44b8('0x2d')],qs[_0x44b8('0x33')](_0x119eff[_0x44b8('0x2e')]['fields']));_0x425de9['attributes']=_0x425de9[_0x44b8('0x31')][_0x44b8('0x34')]?_0x425de9['attributes']:_0x22753b[_0x44b8('0x2d')];if(!_0x119eff['query']['hasOwnProperty'](_0x44b8('0x35'))){_0x425de9[_0x44b8('0x1b')]=qs[_0x44b8('0x1b')](_0x119eff[_0x44b8('0x2e')][_0x44b8('0x1b')]);_0x425de9[_0x44b8('0x19')]=qs[_0x44b8('0x19')](_0x119eff[_0x44b8('0x2e')][_0x44b8('0x19')]);}_0x425de9[_0x44b8('0x36')]=qs[_0x44b8('0x37')](_0x119eff[_0x44b8('0x2e')][_0x44b8('0x37')]);_0x425de9[_0x44b8('0x38')]=qs['filters'](_[_0x44b8('0x39')](_0x119eff[_0x44b8('0x2e')],_0x22753b[_0x44b8('0x30')]),_0x17d854);if(_0x119eff[_0x44b8('0x2e')][_0x44b8('0x3a')]){_0x425de9[_0x44b8('0x38')]=_['merge'](_0x425de9[_0x44b8('0x38')],{'$or':_[_0x44b8('0x28')](_0x17d854,function(_0x1cc8bc){if(_0x1cc8bc[_0x44b8('0x3b')]!==_0x44b8('0x3c')){var _0x2995a2={};_0x2995a2[_0x1cc8bc[_0x44b8('0x26')]]={'$like':'%'+_0x119eff[_0x44b8('0x2e')]['filter']+'%'};return _0x2995a2;}})});}_0x425de9=_['merge']({},_0x425de9,_0x119eff[_0x44b8('0x3d')]);var _0x4d1a68={'where':_0x425de9['where']};return db[_0x44b8('0x29')][_0x44b8('0x1c')](_0x4d1a68)[_0x44b8('0x23')](function(_0x50beee){_0x8c7fdc['count']=_0x50beee;if(_0x119eff[_0x44b8('0x2e')]['includeAll']){_0x425de9[_0x44b8('0x3e')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x44b8('0x3f')](_0x425de9);})[_0x44b8('0x23')](function(_0x4e90cb){_0x8c7fdc[_0x44b8('0x40')]=_0x4e90cb;return _0x8c7fdc;})['then'](respondWithFilteredResult(_0x26f22e,_0x425de9))[_0x44b8('0x41')](handleError(_0x26f22e,null));};exports[_0x44b8('0x42')]=function(_0x496951,_0xf1b652){var _0x36a318={'raw':![],'where':{'id':_0x496951[_0x44b8('0x43')]['id']}},_0xd360df={};_0xd360df['model']=_[_0x44b8('0x2f')](db[_0x44b8('0x29')]['rawAttributes']);_0xd360df['query']=_['keys'](_0x496951[_0x44b8('0x2e')]);_0xd360df['filters']=_[_0x44b8('0x32')](_0xd360df['model'],_0xd360df[_0x44b8('0x2e')]);_0x36a318[_0x44b8('0x31')]=_[_0x44b8('0x32')](_0xd360df[_0x44b8('0x2d')],qs[_0x44b8('0x33')](_0x496951[_0x44b8('0x2e')][_0x44b8('0x33')]));_0x36a318[_0x44b8('0x31')]=_0x36a318['attributes'][_0x44b8('0x34')]?_0x36a318[_0x44b8('0x31')]:_0xd360df[_0x44b8('0x2d')];if(_0x496951[_0x44b8('0x2e')]['includeAll']){_0x36a318[_0x44b8('0x3e')]=[{'all':!![]}];}_0x36a318=_[_0x44b8('0x44')]({},_0x36a318,_0x496951['options']);return db[_0x44b8('0x29')][_0x44b8('0x45')](_0x36a318)['then'](handleEntityNotFound(_0xf1b652,null))[_0x44b8('0x23')](respondWithResult(_0xf1b652,null))[_0x44b8('0x41')](handleError(_0xf1b652,null));};exports['create']=function(_0x143dfa,_0x445172){return db[_0x44b8('0x29')]['create'](_0x143dfa[_0x44b8('0x46')],{})[_0x44b8('0x23')](respondWithResult(_0x445172,0xc9))[_0x44b8('0x41')](handleError(_0x445172,null));};exports[_0x44b8('0x21')]=function(_0x1836ca,_0x49890b){if(_0x1836ca['body']['id']){delete _0x1836ca[_0x44b8('0x46')]['id'];}return db[_0x44b8('0x29')][_0x44b8('0x45')]({'where':{'id':_0x1836ca[_0x44b8('0x43')]['id']}})[_0x44b8('0x23')](handleEntityNotFound(_0x49890b,null))[_0x44b8('0x23')](saveUpdates(_0x1836ca[_0x44b8('0x46')],null))[_0x44b8('0x23')](respondWithResult(_0x49890b,null))[_0x44b8('0x41')](handleError(_0x49890b,null));};exports['destroy']=function(_0x568dbe,_0x4a1a69){return db[_0x44b8('0x29')][_0x44b8('0x45')]({'where':{'id':_0x568dbe[_0x44b8('0x43')]['id']}})['then'](handleEntityNotFound(_0x4a1a69,null))[_0x44b8('0x23')](removeEntity(_0x4a1a69,null))[_0x44b8('0x41')](handleError(_0x4a1a69,null));};exports[_0x44b8('0x47')]=function(_0x425c4a,_0xa4d963,_0x17f76d){var _0x28e943={};var _0x275698={};var _0x18ff69;var _0x359cf9;return db[_0x44b8('0x29')][_0x44b8('0x48')]({'where':{'id':_0x425c4a[_0x44b8('0x43')]['id']}})['then'](handleEntityNotFound(_0xa4d963,null))[_0x44b8('0x23')](function(_0x33dbae){if(_0x33dbae){_0x18ff69=_0x33dbae;_0x275698['model']=_[_0x44b8('0x2f')](db[_0x44b8('0x49')][_0x44b8('0x2a')]);_0x275698[_0x44b8('0x2e')]=_[_0x44b8('0x2f')](_0x425c4a[_0x44b8('0x2e')]);_0x275698[_0x44b8('0x30')]=_[_0x44b8('0x32')](_0x275698[_0x44b8('0x2d')],_0x275698[_0x44b8('0x2e')]);_0x28e943[_0x44b8('0x31')]=_[_0x44b8('0x32')](_0x275698[_0x44b8('0x2d')],qs[_0x44b8('0x33')](_0x425c4a[_0x44b8('0x2e')][_0x44b8('0x33')]));_0x28e943[_0x44b8('0x31')]=_0x28e943[_0x44b8('0x31')][_0x44b8('0x34')]?_0x28e943['attributes']:_0x275698['model'];_0x28e943['order']=qs[_0x44b8('0x37')](_0x425c4a[_0x44b8('0x2e')][_0x44b8('0x37')]);_0x28e943[_0x44b8('0x38')]=qs['filters'](_[_0x44b8('0x39')](_0x425c4a[_0x44b8('0x2e')],_0x275698[_0x44b8('0x30')]));if(_0x425c4a[_0x44b8('0x2e')]['filter']){_0x28e943[_0x44b8('0x38')]=_[_0x44b8('0x44')](_0x28e943['where'],{'$or':_[_0x44b8('0x28')](_0x28e943[_0x44b8('0x31')],function(_0x398a89){var _0x4bc94f={};_0x4bc94f[_0x398a89]={'$like':'%'+_0x425c4a[_0x44b8('0x2e')]['filter']+'%'};return _0x4bc94f;})});}_0x28e943=_['merge']({},_0x28e943,_0x425c4a['options']);return _0x18ff69[_0x44b8('0x47')](_0x28e943);}})[_0x44b8('0x23')](function(_0x3451b5){if(_0x3451b5){_0x359cf9=_0x3451b5['length'];if(!_0x425c4a['query'][_0x44b8('0x4a')](_0x44b8('0x35'))){_0x28e943['limit']=qs[_0x44b8('0x1b')](_0x425c4a[_0x44b8('0x2e')][_0x44b8('0x1b')]);_0x28e943['offset']=qs[_0x44b8('0x19')](_0x425c4a['query'][_0x44b8('0x19')]);}return _0x18ff69[_0x44b8('0x47')](_0x28e943);}})[_0x44b8('0x23')](function(_0x2ef761){if(_0x2ef761){return _0x2ef761?{'count':_0x359cf9,'rows':_0x2ef761}:null;}})[_0x44b8('0x23')](respondWithResult(_0xa4d963,null))[_0x44b8('0x41')](handleError(_0xa4d963,null));};exports['getDescriptions']=function(_0x3149b2,_0x16abe9,_0x202562){var _0x438f3b={};var _0x39f999={};var _0x126699;var _0x18ec40;return db[_0x44b8('0x29')][_0x44b8('0x48')]({'where':{'id':_0x3149b2[_0x44b8('0x43')]['id']}})['then'](handleEntityNotFound(_0x16abe9,null))[_0x44b8('0x23')](function(_0x1e818d){if(_0x1e818d){_0x126699=_0x1e818d;_0x39f999['model']=_[_0x44b8('0x2f')](db[_0x44b8('0x49')][_0x44b8('0x2a')]);_0x39f999[_0x44b8('0x2e')]=_[_0x44b8('0x2f')](_0x3149b2[_0x44b8('0x2e')]);_0x39f999[_0x44b8('0x30')]=_['intersection'](_0x39f999['model'],_0x39f999[_0x44b8('0x2e')]);_0x438f3b[_0x44b8('0x31')]=_[_0x44b8('0x32')](_0x39f999[_0x44b8('0x2d')],qs['fields'](_0x3149b2['query']['fields']));_0x438f3b[_0x44b8('0x31')]=_0x438f3b[_0x44b8('0x31')]['length']?_0x438f3b[_0x44b8('0x31')]:_0x39f999[_0x44b8('0x2d')];_0x438f3b[_0x44b8('0x36')]=qs[_0x44b8('0x37')](_0x3149b2[_0x44b8('0x2e')]['sort']);_0x438f3b['where']=qs[_0x44b8('0x30')](_[_0x44b8('0x39')](_0x3149b2['query'],_0x39f999['filters']));if(_0x3149b2['query']['filter']){_0x438f3b[_0x44b8('0x38')]=_[_0x44b8('0x44')](_0x438f3b[_0x44b8('0x38')],{'$or':_[_0x44b8('0x28')](_0x438f3b['attributes'],function(_0x5542b7){var _0x4af1e3={};_0x4af1e3[_0x5542b7]={'$like':'%'+_0x3149b2[_0x44b8('0x2e')]['filter']+'%'};return _0x4af1e3;})});}_0x438f3b=_[_0x44b8('0x44')]({},_0x438f3b,_0x3149b2[_0x44b8('0x3d')]);return _0x126699[_0x44b8('0x4b')](_0x438f3b);}})[_0x44b8('0x23')](function(_0x419cf6){if(_0x419cf6){_0x18ec40=_0x419cf6[_0x44b8('0x34')];if(!_0x3149b2[_0x44b8('0x2e')][_0x44b8('0x4a')](_0x44b8('0x35'))){_0x438f3b[_0x44b8('0x1b')]=qs[_0x44b8('0x1b')](_0x3149b2[_0x44b8('0x2e')]['limit']);_0x438f3b[_0x44b8('0x19')]=qs[_0x44b8('0x19')](_0x3149b2[_0x44b8('0x2e')][_0x44b8('0x19')]);}return _0x126699[_0x44b8('0x4b')](_0x438f3b);}})[_0x44b8('0x23')](function(_0xd7af84){if(_0xd7af84){return _0xd7af84?{'count':_0x18ec40,'rows':_0xd7af84}:null;}})[_0x44b8('0x23')](respondWithResult(_0x16abe9,null))[_0x44b8('0x41')](handleError(_0x16abe9,null));};exports['getFields']=function(_0x273991,_0x12b1d4,_0x3b1218){var _0x7b306b={};var _0x1196f8={};var _0x515395;var _0x16775d;return db[_0x44b8('0x29')]['findOne']({'where':{'id':_0x273991[_0x44b8('0x43')]['id']}})[_0x44b8('0x23')](handleEntityNotFound(_0x12b1d4,null))[_0x44b8('0x23')](function(_0x4e9188){if(_0x4e9188){_0x515395=_0x4e9188;_0x1196f8[_0x44b8('0x2d')]=_[_0x44b8('0x2f')](db[_0x44b8('0x49')][_0x44b8('0x2a')]);_0x1196f8['query']=_[_0x44b8('0x2f')](_0x273991[_0x44b8('0x2e')]);_0x1196f8[_0x44b8('0x30')]=_[_0x44b8('0x32')](_0x1196f8[_0x44b8('0x2d')],_0x1196f8['query']);_0x7b306b[_0x44b8('0x31')]=_[_0x44b8('0x32')](_0x1196f8[_0x44b8('0x2d')],qs[_0x44b8('0x33')](_0x273991[_0x44b8('0x2e')][_0x44b8('0x33')]));_0x7b306b['attributes']=_0x7b306b[_0x44b8('0x31')][_0x44b8('0x34')]?_0x7b306b[_0x44b8('0x31')]:_0x1196f8[_0x44b8('0x2d')];_0x7b306b[_0x44b8('0x36')]=qs[_0x44b8('0x37')](_0x273991[_0x44b8('0x2e')][_0x44b8('0x37')]);_0x7b306b['where']=qs[_0x44b8('0x30')](_[_0x44b8('0x39')](_0x273991[_0x44b8('0x2e')],_0x1196f8[_0x44b8('0x30')]));if(_0x273991[_0x44b8('0x2e')][_0x44b8('0x3a')]){_0x7b306b['where']=_[_0x44b8('0x44')](_0x7b306b[_0x44b8('0x38')],{'$or':_['map'](_0x7b306b[_0x44b8('0x31')],function(_0x1686ac){var _0x4e21f8={};_0x4e21f8[_0x1686ac]={'$like':'%'+_0x273991['query'][_0x44b8('0x3a')]+'%'};return _0x4e21f8;})});}_0x7b306b=_['merge']({},_0x7b306b,_0x273991[_0x44b8('0x3d')]);return _0x515395[_0x44b8('0x4c')](_0x7b306b);}})[_0x44b8('0x23')](function(_0x9c3f7f){if(_0x9c3f7f){_0x16775d=_0x9c3f7f['length'];if(!_0x273991[_0x44b8('0x2e')][_0x44b8('0x4a')](_0x44b8('0x35'))){_0x7b306b[_0x44b8('0x1b')]=qs[_0x44b8('0x1b')](_0x273991[_0x44b8('0x2e')]['limit']);_0x7b306b['offset']=qs['offset'](_0x273991[_0x44b8('0x2e')][_0x44b8('0x19')]);}return _0x515395['getFields'](_0x7b306b);}})[_0x44b8('0x23')](function(_0xde88b2){if(_0xde88b2){return _0xde88b2?{'count':_0x16775d,'rows':_0xde88b2}:null;}})[_0x44b8('0x23')](respondWithResult(_0x12b1d4,null))['catch'](handleError(_0x12b1d4,null));}; \ No newline at end of file +var _0x5aa9=['undefined','limit','count','set','Content-Range','save','update','then','destroy','error','stack','name','send','FreshsalesConfiguration','rawAttributes','fieldName','key','map','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','include','findAll','rows','catch','keys','options','find','create','body','params','getSubjects','FreshsalesField','getDescriptions','findOne','getFields','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset'];(function(_0x2fc0ef,_0x2b4bda){var _0x3fd3c3=function(_0x7dd9da){while(--_0x7dd9da){_0x2fc0ef['push'](_0x2fc0ef['shift']());}};_0x3fd3c3(++_0x2b4bda);}(_0x5aa9,0x1c2));var _0x95aa=function(_0x5141a2,_0x3d81e5){_0x5141a2=_0x5141a2-0x0;var _0x9d6b28=_0x5aa9[_0x5141a2];return _0x9d6b28;};'use strict';var emlformat=require(_0x95aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x95aa('0x1'));var jsonpatch=require(_0x95aa('0x2'));var rp=require('request-promise');var moment=require(_0x95aa('0x3'));var BPromise=require(_0x95aa('0x4'));var Mustache=require(_0x95aa('0x5'));var util=require(_0x95aa('0x6'));var path=require(_0x95aa('0x7'));var sox=require('sox');var csv=require(_0x95aa('0x8'));var ejs=require(_0x95aa('0x9'));var fs=require('fs');var fs_extra=require(_0x95aa('0xa'));var _=require(_0x95aa('0xb'));var squel=require(_0x95aa('0xc'));var crypto=require(_0x95aa('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x95aa('0xe'));var toCsv=require('to-csv');var querystring=require(_0x95aa('0xf'));var Papa=require(_0x95aa('0x10'));var Redis=require(_0x95aa('0x11'));var authService=require(_0x95aa('0x12'));var qs=require(_0x95aa('0x13'));var as=require(_0x95aa('0x14'));var hardwareService=require(_0x95aa('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x95aa('0x16'));var config=require(_0x95aa('0x17'));var licenseUtil=require(_0x95aa('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43419f,_0x38fec5){_0x38fec5=_0x38fec5||0xcc;return function(_0x2aad74){if(_0x2aad74){return _0x43419f[_0x95aa('0x19')](_0x38fec5);}return _0x43419f[_0x95aa('0x1a')](_0x38fec5)[_0x95aa('0x1b')]();};}function respondWithResult(_0xf13ae4,_0x118e33){_0x118e33=_0x118e33||0xc8;return function(_0x1474fe){if(_0x1474fe){return _0xf13ae4[_0x95aa('0x1a')](_0x118e33)[_0x95aa('0x1c')](_0x1474fe);}};}function respondWithFilteredResult(_0x3ded18,_0x360185){return function(_0x4b1034){if(_0x4b1034){var _0x3a6a42=typeof _0x360185[_0x95aa('0x1d')]===_0x95aa('0x1e')&&typeof _0x360185[_0x95aa('0x1f')]===_0x95aa('0x1e');var _0x171f1e=_0x4b1034['count'];var _0x4f71ff=_0x3a6a42?0x0:_0x360185[_0x95aa('0x1d')];var _0x220386=_0x3a6a42?_0x4b1034[_0x95aa('0x20')]:_0x360185['offset']+_0x360185[_0x95aa('0x1f')];var _0x16c923;if(_0x220386>=_0x171f1e){_0x220386=_0x171f1e;_0x16c923=0xc8;}else{_0x16c923=0xce;}_0x3ded18['status'](_0x16c923);return _0x3ded18[_0x95aa('0x21')](_0x95aa('0x22'),_0x4f71ff+'-'+_0x220386+'/'+_0x171f1e)[_0x95aa('0x1c')](_0x4b1034);}return null;};}function patchUpdates(_0x2b2118){return function(_0x2619ad){try{jsonpatch['apply'](_0x2619ad,_0x2b2118,!![]);}catch(_0x16803f){return BPromise['reject'](_0x16803f);}return _0x2619ad[_0x95aa('0x23')]();};}function saveUpdates(_0xdb823c,_0x2d963c){return function(_0x43f0c7){if(_0x43f0c7){return _0x43f0c7[_0x95aa('0x24')](_0xdb823c)[_0x95aa('0x25')](function(_0x3bde4d){return _0x3bde4d;});}return null;};}function removeEntity(_0x8b7e2c,_0x1553e0){return function(_0xb57563){if(_0xb57563){return _0xb57563[_0x95aa('0x26')]()[_0x95aa('0x25')](function(){_0x8b7e2c[_0x95aa('0x1a')](0xcc)[_0x95aa('0x1b')]();});}};}function handleEntityNotFound(_0x39e0a3,_0x1baec2){return function(_0x4ebc70){if(!_0x4ebc70){_0x39e0a3[_0x95aa('0x19')](0x194);}return _0x4ebc70;};}function handleError(_0x157b04,_0x26ef76){_0x26ef76=_0x26ef76||0x1f4;return function(_0x3b8f34){logger[_0x95aa('0x27')](_0x3b8f34[_0x95aa('0x28')]);if(_0x3b8f34[_0x95aa('0x29')]){delete _0x3b8f34['name'];}_0x157b04[_0x95aa('0x1a')](_0x26ef76)[_0x95aa('0x2a')](_0x3b8f34);};}exports['index']=function(_0x3ebf98,_0x205136){var _0x3f4d78={},_0x430297={},_0x25ecdf={'count':0x0,'rows':[]};var _0x5668d0=_['map'](db[_0x95aa('0x2b')][_0x95aa('0x2c')],function(_0xb3e04c){return{'name':_0xb3e04c[_0x95aa('0x2d')],'type':_0xb3e04c['type'][_0x95aa('0x2e')]};});_0x430297['model']=_[_0x95aa('0x2f')](_0x5668d0,'name');_0x430297[_0x95aa('0x30')]=_['keys'](_0x3ebf98[_0x95aa('0x30')]);_0x430297['filters']=_[_0x95aa('0x31')](_0x430297[_0x95aa('0x32')],_0x430297[_0x95aa('0x30')]);_0x3f4d78[_0x95aa('0x33')]=_[_0x95aa('0x31')](_0x430297['model'],qs[_0x95aa('0x34')](_0x3ebf98['query'][_0x95aa('0x34')]));_0x3f4d78['attributes']=_0x3f4d78['attributes'][_0x95aa('0x35')]?_0x3f4d78[_0x95aa('0x33')]:_0x430297[_0x95aa('0x32')];if(!_0x3ebf98[_0x95aa('0x30')][_0x95aa('0x36')](_0x95aa('0x37'))){_0x3f4d78[_0x95aa('0x1f')]=qs[_0x95aa('0x1f')](_0x3ebf98[_0x95aa('0x30')][_0x95aa('0x1f')]);_0x3f4d78[_0x95aa('0x1d')]=qs[_0x95aa('0x1d')](_0x3ebf98['query'][_0x95aa('0x1d')]);}_0x3f4d78[_0x95aa('0x38')]=qs[_0x95aa('0x39')](_0x3ebf98['query'][_0x95aa('0x39')]);_0x3f4d78[_0x95aa('0x3a')]=qs[_0x95aa('0x3b')](_[_0x95aa('0x3c')](_0x3ebf98['query'],_0x430297[_0x95aa('0x3b')]),_0x5668d0);if(_0x3ebf98[_0x95aa('0x30')][_0x95aa('0x3d')]){_0x3f4d78[_0x95aa('0x3a')]=_[_0x95aa('0x3e')](_0x3f4d78['where'],{'$or':_[_0x95aa('0x2f')](_0x5668d0,function(_0x51fd75){if(_0x51fd75[_0x95aa('0x3f')]!==_0x95aa('0x40')){var _0x456483={};_0x456483[_0x51fd75['name']]={'$like':'%'+_0x3ebf98[_0x95aa('0x30')][_0x95aa('0x3d')]+'%'};return _0x456483;}})});}_0x3f4d78=_[_0x95aa('0x3e')]({},_0x3f4d78,_0x3ebf98['options']);var _0xc0eb44={'where':_0x3f4d78[_0x95aa('0x3a')]};return db['FreshsalesConfiguration'][_0x95aa('0x20')](_0xc0eb44)[_0x95aa('0x25')](function(_0x22fd3d){_0x25ecdf['count']=_0x22fd3d;if(_0x3ebf98[_0x95aa('0x30')]['includeAll']){_0x3f4d78[_0x95aa('0x41')]=[{'all':!![]}];}return db[_0x95aa('0x2b')][_0x95aa('0x42')](_0x3f4d78);})[_0x95aa('0x25')](function(_0x1482e8){_0x25ecdf[_0x95aa('0x43')]=_0x1482e8;return _0x25ecdf;})[_0x95aa('0x25')](respondWithFilteredResult(_0x205136,_0x3f4d78))[_0x95aa('0x44')](handleError(_0x205136,null));};exports['show']=function(_0xc77ffd,_0x5f239b){var _0x31777a={'raw':![],'where':{'id':_0xc77ffd['params']['id']}},_0x2c11bc={};_0x2c11bc[_0x95aa('0x32')]=_[_0x95aa('0x45')](db[_0x95aa('0x2b')]['rawAttributes']);_0x2c11bc[_0x95aa('0x30')]=_[_0x95aa('0x45')](_0xc77ffd['query']);_0x2c11bc[_0x95aa('0x3b')]=_[_0x95aa('0x31')](_0x2c11bc[_0x95aa('0x32')],_0x2c11bc[_0x95aa('0x30')]);_0x31777a[_0x95aa('0x33')]=_[_0x95aa('0x31')](_0x2c11bc[_0x95aa('0x32')],qs[_0x95aa('0x34')](_0xc77ffd[_0x95aa('0x30')]['fields']));_0x31777a[_0x95aa('0x33')]=_0x31777a[_0x95aa('0x33')]['length']?_0x31777a[_0x95aa('0x33')]:_0x2c11bc['model'];if(_0xc77ffd[_0x95aa('0x30')]['includeAll']){_0x31777a[_0x95aa('0x41')]=[{'all':!![]}];}_0x31777a=_[_0x95aa('0x3e')]({},_0x31777a,_0xc77ffd[_0x95aa('0x46')]);return db[_0x95aa('0x2b')][_0x95aa('0x47')](_0x31777a)['then'](handleEntityNotFound(_0x5f239b,null))[_0x95aa('0x25')](respondWithResult(_0x5f239b,null))[_0x95aa('0x44')](handleError(_0x5f239b,null));};exports[_0x95aa('0x48')]=function(_0x1d6afe,_0x56de0b){return db[_0x95aa('0x2b')][_0x95aa('0x48')](_0x1d6afe[_0x95aa('0x49')],{})[_0x95aa('0x25')](respondWithResult(_0x56de0b,0xc9))[_0x95aa('0x44')](handleError(_0x56de0b,null));};exports[_0x95aa('0x24')]=function(_0x522f9e,_0x4ccd7b){if(_0x522f9e[_0x95aa('0x49')]['id']){delete _0x522f9e['body']['id'];}return db[_0x95aa('0x2b')]['find']({'where':{'id':_0x522f9e[_0x95aa('0x4a')]['id']}})[_0x95aa('0x25')](handleEntityNotFound(_0x4ccd7b,null))[_0x95aa('0x25')](saveUpdates(_0x522f9e[_0x95aa('0x49')],null))['then'](respondWithResult(_0x4ccd7b,null))[_0x95aa('0x44')](handleError(_0x4ccd7b,null));};exports[_0x95aa('0x26')]=function(_0x3a2d6c,_0xae6e10){return db[_0x95aa('0x2b')]['find']({'where':{'id':_0x3a2d6c[_0x95aa('0x4a')]['id']}})[_0x95aa('0x25')](handleEntityNotFound(_0xae6e10,null))[_0x95aa('0x25')](removeEntity(_0xae6e10,null))['catch'](handleError(_0xae6e10,null));};exports[_0x95aa('0x4b')]=function(_0x1d81c2,_0x7c718f,_0x38659b){var _0x17f356={};var _0x45683a={};var _0x4f19ca;var _0x197678;return db[_0x95aa('0x2b')]['findOne']({'where':{'id':_0x1d81c2[_0x95aa('0x4a')]['id']}})[_0x95aa('0x25')](handleEntityNotFound(_0x7c718f,null))[_0x95aa('0x25')](function(_0x353976){if(_0x353976){_0x4f19ca=_0x353976;_0x45683a[_0x95aa('0x32')]=_['keys'](db[_0x95aa('0x4c')][_0x95aa('0x2c')]);_0x45683a[_0x95aa('0x30')]=_[_0x95aa('0x45')](_0x1d81c2[_0x95aa('0x30')]);_0x45683a[_0x95aa('0x3b')]=_['intersection'](_0x45683a[_0x95aa('0x32')],_0x45683a['query']);_0x17f356['attributes']=_[_0x95aa('0x31')](_0x45683a[_0x95aa('0x32')],qs['fields'](_0x1d81c2[_0x95aa('0x30')][_0x95aa('0x34')]));_0x17f356[_0x95aa('0x33')]=_0x17f356[_0x95aa('0x33')][_0x95aa('0x35')]?_0x17f356[_0x95aa('0x33')]:_0x45683a['model'];_0x17f356[_0x95aa('0x38')]=qs[_0x95aa('0x39')](_0x1d81c2[_0x95aa('0x30')][_0x95aa('0x39')]);_0x17f356[_0x95aa('0x3a')]=qs['filters'](_['pick'](_0x1d81c2[_0x95aa('0x30')],_0x45683a[_0x95aa('0x3b')]));if(_0x1d81c2['query'][_0x95aa('0x3d')]){_0x17f356[_0x95aa('0x3a')]=_[_0x95aa('0x3e')](_0x17f356[_0x95aa('0x3a')],{'$or':_[_0x95aa('0x2f')](_0x17f356['attributes'],function(_0x1ce200){var _0x20e9d4={};_0x20e9d4[_0x1ce200]={'$like':'%'+_0x1d81c2[_0x95aa('0x30')][_0x95aa('0x3d')]+'%'};return _0x20e9d4;})});}_0x17f356=_['merge']({},_0x17f356,_0x1d81c2[_0x95aa('0x46')]);return _0x4f19ca[_0x95aa('0x4b')](_0x17f356);}})['then'](function(_0x588f63){if(_0x588f63){_0x197678=_0x588f63[_0x95aa('0x35')];if(!_0x1d81c2[_0x95aa('0x30')][_0x95aa('0x36')]('nolimit')){_0x17f356[_0x95aa('0x1f')]=qs['limit'](_0x1d81c2[_0x95aa('0x30')][_0x95aa('0x1f')]);_0x17f356['offset']=qs['offset'](_0x1d81c2[_0x95aa('0x30')][_0x95aa('0x1d')]);}return _0x4f19ca[_0x95aa('0x4b')](_0x17f356);}})[_0x95aa('0x25')](function(_0xe1e316){if(_0xe1e316){return _0xe1e316?{'count':_0x197678,'rows':_0xe1e316}:null;}})[_0x95aa('0x25')](respondWithResult(_0x7c718f,null))[_0x95aa('0x44')](handleError(_0x7c718f,null));};exports[_0x95aa('0x4d')]=function(_0x3a4b5c,_0x5dfc6b,_0x4e6886){var _0x481213={};var _0x24540c={};var _0x5cf83d;var _0x4e4686;return db[_0x95aa('0x2b')][_0x95aa('0x4e')]({'where':{'id':_0x3a4b5c['params']['id']}})['then'](handleEntityNotFound(_0x5dfc6b,null))[_0x95aa('0x25')](function(_0x201b48){if(_0x201b48){_0x5cf83d=_0x201b48;_0x24540c['model']=_[_0x95aa('0x45')](db[_0x95aa('0x4c')]['rawAttributes']);_0x24540c[_0x95aa('0x30')]=_[_0x95aa('0x45')](_0x3a4b5c[_0x95aa('0x30')]);_0x24540c[_0x95aa('0x3b')]=_['intersection'](_0x24540c[_0x95aa('0x32')],_0x24540c[_0x95aa('0x30')]);_0x481213[_0x95aa('0x33')]=_[_0x95aa('0x31')](_0x24540c['model'],qs[_0x95aa('0x34')](_0x3a4b5c[_0x95aa('0x30')][_0x95aa('0x34')]));_0x481213[_0x95aa('0x33')]=_0x481213['attributes'][_0x95aa('0x35')]?_0x481213[_0x95aa('0x33')]:_0x24540c[_0x95aa('0x32')];_0x481213[_0x95aa('0x38')]=qs[_0x95aa('0x39')](_0x3a4b5c['query']['sort']);_0x481213[_0x95aa('0x3a')]=qs[_0x95aa('0x3b')](_[_0x95aa('0x3c')](_0x3a4b5c[_0x95aa('0x30')],_0x24540c[_0x95aa('0x3b')]));if(_0x3a4b5c[_0x95aa('0x30')]['filter']){_0x481213[_0x95aa('0x3a')]=_[_0x95aa('0x3e')](_0x481213[_0x95aa('0x3a')],{'$or':_[_0x95aa('0x2f')](_0x481213[_0x95aa('0x33')],function(_0x2c43a5){var _0x1f4f2d={};_0x1f4f2d[_0x2c43a5]={'$like':'%'+_0x3a4b5c['query'][_0x95aa('0x3d')]+'%'};return _0x1f4f2d;})});}_0x481213=_[_0x95aa('0x3e')]({},_0x481213,_0x3a4b5c[_0x95aa('0x46')]);return _0x5cf83d[_0x95aa('0x4d')](_0x481213);}})[_0x95aa('0x25')](function(_0x25ddcb){if(_0x25ddcb){_0x4e4686=_0x25ddcb[_0x95aa('0x35')];if(!_0x3a4b5c[_0x95aa('0x30')][_0x95aa('0x36')](_0x95aa('0x37'))){_0x481213[_0x95aa('0x1f')]=qs[_0x95aa('0x1f')](_0x3a4b5c[_0x95aa('0x30')]['limit']);_0x481213[_0x95aa('0x1d')]=qs[_0x95aa('0x1d')](_0x3a4b5c[_0x95aa('0x30')]['offset']);}return _0x5cf83d[_0x95aa('0x4d')](_0x481213);}})[_0x95aa('0x25')](function(_0x47cb31){if(_0x47cb31){return _0x47cb31?{'count':_0x4e4686,'rows':_0x47cb31}:null;}})[_0x95aa('0x25')](respondWithResult(_0x5dfc6b,null))[_0x95aa('0x44')](handleError(_0x5dfc6b,null));};exports[_0x95aa('0x4f')]=function(_0x2b04fd,_0x4fc8f1,_0x560291){var _0x41af55={};var _0x5285d8={};var _0x2e5d1d;var _0x49d6fd;return db[_0x95aa('0x2b')][_0x95aa('0x4e')]({'where':{'id':_0x2b04fd[_0x95aa('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4fc8f1,null))[_0x95aa('0x25')](function(_0x5609ba){if(_0x5609ba){_0x2e5d1d=_0x5609ba;_0x5285d8[_0x95aa('0x32')]=_[_0x95aa('0x45')](db['FreshsalesField'][_0x95aa('0x2c')]);_0x5285d8[_0x95aa('0x30')]=_[_0x95aa('0x45')](_0x2b04fd[_0x95aa('0x30')]);_0x5285d8[_0x95aa('0x3b')]=_['intersection'](_0x5285d8[_0x95aa('0x32')],_0x5285d8['query']);_0x41af55[_0x95aa('0x33')]=_[_0x95aa('0x31')](_0x5285d8[_0x95aa('0x32')],qs[_0x95aa('0x34')](_0x2b04fd[_0x95aa('0x30')][_0x95aa('0x34')]));_0x41af55['attributes']=_0x41af55[_0x95aa('0x33')]['length']?_0x41af55[_0x95aa('0x33')]:_0x5285d8[_0x95aa('0x32')];_0x41af55[_0x95aa('0x38')]=qs[_0x95aa('0x39')](_0x2b04fd['query'][_0x95aa('0x39')]);_0x41af55[_0x95aa('0x3a')]=qs[_0x95aa('0x3b')](_[_0x95aa('0x3c')](_0x2b04fd[_0x95aa('0x30')],_0x5285d8[_0x95aa('0x3b')]));if(_0x2b04fd[_0x95aa('0x30')][_0x95aa('0x3d')]){_0x41af55['where']=_[_0x95aa('0x3e')](_0x41af55[_0x95aa('0x3a')],{'$or':_[_0x95aa('0x2f')](_0x41af55['attributes'],function(_0x836f38){var _0xbc0683={};_0xbc0683[_0x836f38]={'$like':'%'+_0x2b04fd[_0x95aa('0x30')][_0x95aa('0x3d')]+'%'};return _0xbc0683;})});}_0x41af55=_[_0x95aa('0x3e')]({},_0x41af55,_0x2b04fd['options']);return _0x2e5d1d[_0x95aa('0x4f')](_0x41af55);}})['then'](function(_0x577056){if(_0x577056){_0x49d6fd=_0x577056['length'];if(!_0x2b04fd['query'][_0x95aa('0x36')](_0x95aa('0x37'))){_0x41af55[_0x95aa('0x1f')]=qs[_0x95aa('0x1f')](_0x2b04fd[_0x95aa('0x30')]['limit']);_0x41af55[_0x95aa('0x1d')]=qs[_0x95aa('0x1d')](_0x2b04fd[_0x95aa('0x30')][_0x95aa('0x1d')]);}return _0x2e5d1d['getFields'](_0x41af55);}})['then'](function(_0x39ab21){if(_0x39ab21){return _0x39ab21?{'count':_0x49d6fd,'rows':_0x39ab21}:null;}})[_0x95aa('0x25')](respondWithResult(_0x4fc8f1,null))[_0x95aa('0x44')](handleError(_0x4fc8f1,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index b2d5d3a..8b160a6 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 _0xec8b=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intFreshsalesConfiguration.attributes','exports','int_freshsales_configurations','lodash','util'];(function(_0x580a59,_0x21266c){var _0x19da51=function(_0x772ac8){while(--_0x772ac8){_0x580a59['push'](_0x580a59['shift']());}};_0x19da51(++_0x21266c);}(_0xec8b,0x169));var _0xbec8=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xec8b[_0x5608a3];return _0x1ed50a;};'use strict';var _=require(_0xbec8('0x0'));var util=require(_0xbec8('0x1'));var logger=require(_0xbec8('0x2'))(_0xbec8('0x3'));var moment=require(_0xbec8('0x4'));var BPromise=require(_0xbec8('0x5'));var rp=require(_0xbec8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbec8('0x7'));var attributes=require(_0xbec8('0x8'));module[_0xbec8('0x9')]=function(_0x1bf65c,_0x20e9ce){return _0x1bf65c['define']('FreshsalesConfiguration',attributes,{'tableName':_0xbec8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0833=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','int_freshsales_configurations','lodash'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x0833,0x113));var _0x3083=function(_0x405787,_0xdf605c){_0x405787=_0x405787-0x0;var _0x3aa71f=_0x0833[_0x405787];return _0x3aa71f;};'use strict';var _=require(_0x3083('0x0'));var util=require(_0x3083('0x1'));var logger=require(_0x3083('0x2'))(_0x3083('0x3'));var moment=require('moment');var BPromise=require(_0x3083('0x4'));var rp=require(_0x3083('0x5'));var fs=require('fs');var path=require(_0x3083('0x6'));var rimraf=require(_0x3083('0x7'));var config=require(_0x3083('0x8'));var attributes=require(_0x3083('0x9'));module[_0x3083('0xa')]=function(_0x20ccd1,_0x2de1f0){return _0x20ccd1['define']('FreshsalesConfiguration',attributes,{'tableName':_0x3083('0xb'),'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 255d968..761628d 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 _0xf194=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch'];(function(_0x3107e7,_0x259bc1){var _0x1f97bc=function(_0x495e40){while(--_0x495e40){_0x3107e7['push'](_0x3107e7['shift']());}};_0x1f97bc(++_0x259bc1);}(_0xf194,0xd8));var _0x4f19=function(_0x118302,_0x25be4){_0x118302=_0x118302-0x0;var _0x574e61=_0xf194[_0x118302];return _0x574e61;};'use strict';var _=require(_0x4f19('0x0'));var util=require(_0x4f19('0x1'));var moment=require(_0x4f19('0x2'));var BPromise=require(_0x4f19('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f19('0x4'));var db=require(_0x4f19('0x5'))['db'];var utils=require(_0x4f19('0x6'));var logger=require(_0x4f19('0x7'))(_0x4f19('0x8'));var config=require(_0x4f19('0x9'));var jayson=require(_0x4f19('0xa'));var client=jayson[_0x4f19('0xb')][_0x4f19('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c8b4a,_0x5a94c3,_0x19bdda){return new BPromise(function(_0x2b5cdf,_0x1583d4){return client[_0x4f19('0xd')](_0x3c8b4a,_0x19bdda)[_0x4f19('0xe')](function(_0xfecb43){logger[_0x4f19('0xf')](_0x4f19('0x10'),_0x5a94c3,_0x4f19('0x11'));logger[_0x4f19('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x5a94c3,'request\x20sent',JSON[_0x4f19('0x13')](_0xfecb43));if(_0xfecb43[_0x4f19('0x14')]){if(_0xfecb43[_0x4f19('0x14')][_0x4f19('0x15')]===0x1f4){logger[_0x4f19('0x14')](_0x4f19('0x10'),_0x5a94c3,_0xfecb43[_0x4f19('0x14')][_0x4f19('0x16')]);return _0x1583d4(_0xfecb43[_0x4f19('0x14')]['message']);}logger[_0x4f19('0x14')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5a94c3,_0xfecb43[_0x4f19('0x14')][_0x4f19('0x16')]);return _0x2b5cdf(_0xfecb43[_0x4f19('0x14')][_0x4f19('0x16')]);}else{logger[_0x4f19('0xf')](_0x4f19('0x10'),_0x5a94c3,'request\x20sent');_0x2b5cdf(_0xfecb43['result']['message']);}})[_0x4f19('0x17')](function(_0x2f43b0){logger[_0x4f19('0x14')](_0x4f19('0x10'),_0x5a94c3,_0x2f43b0);_0x1583d4(_0x2f43b0);});});} \ No newline at end of file +var _0x6095=['result','catch','lodash','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent'];(function(_0x1eb1b2,_0x26b6b7){var _0x2f520a=function(_0x493622){while(--_0x493622){_0x1eb1b2['push'](_0x1eb1b2['shift']());}};_0x2f520a(++_0x26b6b7);}(_0x6095,0xde));var _0x5609=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0x6095[_0x4c440b];return _0x2d48cf;};'use strict';var _=require(_0x5609('0x0'));var util=require('util');var moment=require(_0x5609('0x1'));var BPromise=require('bluebird');var rs=require(_0x5609('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5609('0x3'));var logger=require('../../config/logger')(_0x5609('0x4'));var config=require(_0x5609('0x5'));var jayson=require(_0x5609('0x6'));var client=jayson[_0x5609('0x7')][_0x5609('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x48b3a6,_0x4d884e,_0x1f5aad){return new BPromise(function(_0x187cb4,_0xe5922e){return client[_0x5609('0x9')](_0x48b3a6,_0x1f5aad)['then'](function(_0x37ecc9){logger[_0x5609('0xa')](_0x5609('0xb'),_0x4d884e,'request\x20sent');logger[_0x5609('0xc')](_0x5609('0xd'),_0x4d884e,'request\x20sent',JSON['stringify'](_0x37ecc9));if(_0x37ecc9[_0x5609('0xe')]){if(_0x37ecc9[_0x5609('0xe')][_0x5609('0xf')]===0x1f4){logger[_0x5609('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4d884e,_0x37ecc9['error'][_0x5609('0x10')]);return _0xe5922e(_0x37ecc9['error'][_0x5609('0x10')]);}logger[_0x5609('0xe')](_0x5609('0xb'),_0x4d884e,_0x37ecc9[_0x5609('0xe')][_0x5609('0x10')]);return _0x187cb4(_0x37ecc9['error'][_0x5609('0x10')]);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x4d884e,_0x5609('0x11'));_0x187cb4(_0x37ecc9[_0x5609('0x12')][_0x5609('0x10')]);}})[_0x5609('0x13')](function(_0x39d9bb){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x4d884e,_0x39d9bb);_0xe5922e(_0x39d9bb);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index a740fff..130144e 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 _0x4a81=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get'];(function(_0x3d3734,_0x11b20e){var _0x214b3a=function(_0x5b658e){while(--_0x5b658e){_0x3d3734['push'](_0x3d3734['shift']());}};_0x214b3a(++_0x11b20e);}(_0x4a81,0x1b7));var _0x14a8=function(_0x48312a,_0x41cc3e){_0x48312a=_0x48312a-0x0;var _0x1d1ff0=_0x4a81[_0x48312a];return _0x1d1ff0;};'use strict';var multer=require(_0x14a8('0x0'));var util=require(_0x14a8('0x1'));var path=require(_0x14a8('0x2'));var timeout=require(_0x14a8('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x14a8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x14a8('0x5'));var config=require(_0x14a8('0x6'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0x14a8('0x7')](),controller['index']);router[_0x14a8('0x8')]('/:id',auth[_0x14a8('0x7')](),controller[_0x14a8('0x9')]);router[_0x14a8('0xa')]('/',auth[_0x14a8('0x7')](),controller[_0x14a8('0xb')]);router['put']('/:id',auth[_0x14a8('0x7')](),controller[_0x14a8('0xc')]);router[_0x14a8('0xd')]('/:id',auth[_0x14a8('0x7')](),controller[_0x14a8('0xe')]);module[_0x14a8('0xf')]=router; \ No newline at end of file +var _0x63eb=['./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x63eb,0x90));var _0xb63e=function(_0x294f4d,_0x374007){_0x294f4d=_0x294f4d-0x0;var _0x21f1be=_0x63eb[_0x294f4d];return _0x21f1be;};'use strict';var multer=require(_0xb63e('0x0'));var util=require(_0xb63e('0x1'));var path=require(_0xb63e('0x2'));var timeout=require(_0xb63e('0x3'));var express=require(_0xb63e('0x4'));var router=express[_0xb63e('0x5')]();var fs_extra=require(_0xb63e('0x6'));var auth=require(_0xb63e('0x7'));var interaction=require(_0xb63e('0x8'));var config=require(_0xb63e('0x9'));var controller=require(_0xb63e('0xa'));router[_0xb63e('0xb')]('/',auth[_0xb63e('0xc')](),controller[_0xb63e('0xd')]);router[_0xb63e('0xb')](_0xb63e('0xe'),auth[_0xb63e('0xc')](),controller[_0xb63e('0xf')]);router[_0xb63e('0x10')]('/',auth[_0xb63e('0xc')](),controller[_0xb63e('0x11')]);router['put'](_0xb63e('0xe'),auth['isAuthenticated'](),controller[_0xb63e('0x12')]);router[_0xb63e('0x13')](_0xb63e('0xe'),auth['isAuthenticated'](),controller[_0xb63e('0x14')]);module[_0xb63e('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index ad3287e..1a39b1d 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 _0xdf25=['STRING','ENUM','string','variable','customVariable','picklist'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xdf25,0x1c3));var _0x5df2=function(_0x47eaff,_0x502553){_0x47eaff=_0x47eaff-0x0;var _0x53103e=_0xdf25[_0x47eaff];return _0x53103e;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x5df2('0x0')](_0x5df2('0x1'),_0x5df2('0x2'),_0x5df2('0x3'),'keyValue',_0x5df2('0x4')),'defaultValue':_0x5df2('0x1')},'content':{'type':Sequelize[_0x5df2('0x5')]},'key':{'type':Sequelize[_0x5df2('0x5')]},'keyType':{'type':Sequelize[_0x5df2('0x0')]('string',_0x5df2('0x2'),_0x5df2('0x3'))},'keyContent':{'type':Sequelize[_0x5df2('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5df2('0x5')]}}; \ No newline at end of file +var _0xfc9d=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x39bc03,_0x29f7c2){var _0x2f22f7=function(_0x4bd0e9){while(--_0x4bd0e9){_0x39bc03['push'](_0x39bc03['shift']());}};_0x2f22f7(++_0x29f7c2);}(_0xfc9d,0x1de));var _0xdfc9=function(_0x461f4c,_0x4c293d){_0x461f4c=_0x461f4c-0x0;var _0x299260=_0xfc9d[_0x461f4c];return _0x299260;};'use strict';var Sequelize=require(_0xdfc9('0x0'));module[_0xdfc9('0x1')]={'type':{'type':Sequelize[_0xdfc9('0x2')](_0xdfc9('0x3'),_0xdfc9('0x4'),_0xdfc9('0x5'),'keyValue',_0xdfc9('0x6')),'defaultValue':_0xdfc9('0x3')},'content':{'type':Sequelize[_0xdfc9('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xdfc9('0x2')]('string',_0xdfc9('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xdfc9('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xdfc9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdfc9('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 8840487..182c100 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 _0x24d6=['sendStatus','name','send','index','map','FreshsalesField','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','type','merge','findAll','rows','catch','show','include','options','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','end','json','offset','undefined','count','status','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x13bc50,_0x4c9aeb){var _0x44ccbb=function(_0x1de143){while(--_0x1de143){_0x13bc50['push'](_0x13bc50['shift']());}};_0x44ccbb(++_0x4c9aeb);}(_0x24d6,0x1ab));var _0x624d=function(_0x4702ee,_0xaf6a45){_0x4702ee=_0x4702ee-0x0;var _0x62ca7d=_0x24d6[_0x4702ee];return _0x62ca7d;};'use strict';var emlformat=require(_0x624d('0x0'));var rimraf=require(_0x624d('0x1'));var zipdir=require(_0x624d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x624d('0x3'));var moment=require(_0x624d('0x4'));var BPromise=require(_0x624d('0x5'));var Mustache=require(_0x624d('0x6'));var util=require('util');var path=require(_0x624d('0x7'));var sox=require(_0x624d('0x8'));var csv=require(_0x624d('0x9'));var ejs=require(_0x624d('0xa'));var fs=require('fs');var fs_extra=require(_0x624d('0xb'));var _=require(_0x624d('0xc'));var squel=require('squel');var crypto=require(_0x624d('0xd'));var jsforce=require(_0x624d('0xe'));var deskjs=require(_0x624d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x624d('0x10'));var Papa=require(_0x624d('0x11'));var Redis=require(_0x624d('0x12'));var authService=require(_0x624d('0x13'));var qs=require(_0x624d('0x14'));var as=require(_0x624d('0x15'));var hardwareService=require(_0x624d('0x16'));var logger=require('../../config/logger')(_0x624d('0x17'));var utils=require(_0x624d('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x624d('0x19'));var db=require(_0x624d('0x1a'))['db'];function respondWithStatusCode(_0x10cdaa,_0xc49a28){_0xc49a28=_0xc49a28||0xcc;return function(_0x1826fa){if(_0x1826fa){return _0x10cdaa['sendStatus'](_0xc49a28);}return _0x10cdaa['status'](_0xc49a28)[_0x624d('0x1b')]();};}function respondWithResult(_0x1a4333,_0x4ca4a3){_0x4ca4a3=_0x4ca4a3||0xc8;return function(_0x3828da){if(_0x3828da){return _0x1a4333['status'](_0x4ca4a3)[_0x624d('0x1c')](_0x3828da);}};}function respondWithFilteredResult(_0x3ecf2c,_0x1d4098){return function(_0x3ce189){if(_0x3ce189){var _0x25e16c=typeof _0x1d4098[_0x624d('0x1d')]===_0x624d('0x1e')&&typeof _0x1d4098['limit']===_0x624d('0x1e');var _0x139a0b=_0x3ce189['count'];var _0x20232e=_0x25e16c?0x0:_0x1d4098['offset'];var _0x158821=_0x25e16c?_0x3ce189[_0x624d('0x1f')]:_0x1d4098[_0x624d('0x1d')]+_0x1d4098['limit'];var _0x8e2d42;if(_0x158821>=_0x139a0b){_0x158821=_0x139a0b;_0x8e2d42=0xc8;}else{_0x8e2d42=0xce;}_0x3ecf2c[_0x624d('0x20')](_0x8e2d42);return _0x3ecf2c[_0x624d('0x21')](_0x624d('0x22'),_0x20232e+'-'+_0x158821+'/'+_0x139a0b)[_0x624d('0x1c')](_0x3ce189);}return null;};}function patchUpdates(_0xd8cb52){return function(_0x508dc6){try{jsonpatch[_0x624d('0x23')](_0x508dc6,_0xd8cb52,!![]);}catch(_0x42a1ab){return BPromise[_0x624d('0x24')](_0x42a1ab);}return _0x508dc6[_0x624d('0x25')]();};}function saveUpdates(_0x36b449,_0x4dc884){return function(_0x15462c){if(_0x15462c){return _0x15462c[_0x624d('0x26')](_0x36b449)[_0x624d('0x27')](function(_0x30b823){return _0x30b823;});}return null;};}function removeEntity(_0x5e06db,_0x456a71){return function(_0x308765){if(_0x308765){return _0x308765[_0x624d('0x28')]()[_0x624d('0x27')](function(){_0x5e06db[_0x624d('0x20')](0xcc)[_0x624d('0x1b')]();});}};}function handleEntityNotFound(_0x434e8e,_0x32ab20){return function(_0x4d3cfa){if(!_0x4d3cfa){_0x434e8e[_0x624d('0x29')](0x194);}return _0x4d3cfa;};}function handleError(_0x2931f0,_0x3a62b0){_0x3a62b0=_0x3a62b0||0x1f4;return function(_0x40bdcc){logger['error'](_0x40bdcc['stack']);if(_0x40bdcc[_0x624d('0x2a')]){delete _0x40bdcc[_0x624d('0x2a')];}_0x2931f0[_0x624d('0x20')](_0x3a62b0)[_0x624d('0x2b')](_0x40bdcc);};}exports[_0x624d('0x2c')]=function(_0x5e545d,_0x2bea8f){var _0x65b0bc={},_0x83826a={},_0xb3a138={'count':0x0,'rows':[]};var _0x225a57=_[_0x624d('0x2d')](db[_0x624d('0x2e')][_0x624d('0x2f')],function(_0x23e615){return{'name':_0x23e615[_0x624d('0x30')],'type':_0x23e615['type'][_0x624d('0x31')]};});_0x83826a[_0x624d('0x32')]=_[_0x624d('0x2d')](_0x225a57,_0x624d('0x2a'));_0x83826a[_0x624d('0x33')]=_[_0x624d('0x34')](_0x5e545d[_0x624d('0x33')]);_0x83826a['filters']=_[_0x624d('0x35')](_0x83826a['model'],_0x83826a[_0x624d('0x33')]);_0x65b0bc['attributes']=_[_0x624d('0x35')](_0x83826a[_0x624d('0x32')],qs[_0x624d('0x36')](_0x5e545d['query'][_0x624d('0x36')]));_0x65b0bc[_0x624d('0x37')]=_0x65b0bc[_0x624d('0x37')][_0x624d('0x38')]?_0x65b0bc[_0x624d('0x37')]:_0x83826a[_0x624d('0x32')];if(!_0x5e545d['query'][_0x624d('0x39')](_0x624d('0x3a'))){_0x65b0bc[_0x624d('0x3b')]=qs['limit'](_0x5e545d[_0x624d('0x33')][_0x624d('0x3b')]);_0x65b0bc[_0x624d('0x1d')]=qs[_0x624d('0x1d')](_0x5e545d['query'][_0x624d('0x1d')]);}_0x65b0bc[_0x624d('0x3c')]=qs['sort'](_0x5e545d['query'][_0x624d('0x3d')]);_0x65b0bc['where']=qs[_0x624d('0x3e')](_[_0x624d('0x3f')](_0x5e545d[_0x624d('0x33')],_0x83826a[_0x624d('0x3e')]),_0x225a57);if(_0x5e545d[_0x624d('0x33')][_0x624d('0x40')]){_0x65b0bc[_0x624d('0x41')]=_['merge'](_0x65b0bc[_0x624d('0x41')],{'$or':_['map'](_0x225a57,function(_0x1560a4){if(_0x1560a4[_0x624d('0x42')]!=='VIRTUAL'){var _0xa9b114={};_0xa9b114[_0x1560a4['name']]={'$like':'%'+_0x5e545d['query'][_0x624d('0x40')]+'%'};return _0xa9b114;}})});}_0x65b0bc=_[_0x624d('0x43')]({},_0x65b0bc,_0x5e545d['options']);var _0x5d91d8={'where':_0x65b0bc['where']};return db[_0x624d('0x2e')][_0x624d('0x1f')](_0x5d91d8)[_0x624d('0x27')](function(_0x5ba3ea){_0xb3a138[_0x624d('0x1f')]=_0x5ba3ea;if(_0x5e545d[_0x624d('0x33')]['includeAll']){_0x65b0bc['include']=[{'all':!![]}];}return db['FreshsalesField'][_0x624d('0x44')](_0x65b0bc);})[_0x624d('0x27')](function(_0x1affea){_0xb3a138[_0x624d('0x45')]=_0x1affea;return _0xb3a138;})[_0x624d('0x27')](respondWithFilteredResult(_0x2bea8f,_0x65b0bc))[_0x624d('0x46')](handleError(_0x2bea8f,null));};exports[_0x624d('0x47')]=function(_0x435ede,_0x45b247){var _0x534a20={'raw':!![],'where':{'id':_0x435ede['params']['id']}},_0x46421f={};_0x46421f[_0x624d('0x32')]=_['keys'](db['FreshsalesField']['rawAttributes']);_0x46421f[_0x624d('0x33')]=_[_0x624d('0x34')](_0x435ede[_0x624d('0x33')]);_0x46421f[_0x624d('0x3e')]=_[_0x624d('0x35')](_0x46421f[_0x624d('0x32')],_0x46421f[_0x624d('0x33')]);_0x534a20['attributes']=_[_0x624d('0x35')](_0x46421f[_0x624d('0x32')],qs[_0x624d('0x36')](_0x435ede[_0x624d('0x33')][_0x624d('0x36')]));_0x534a20[_0x624d('0x37')]=_0x534a20[_0x624d('0x37')][_0x624d('0x38')]?_0x534a20['attributes']:_0x46421f[_0x624d('0x32')];if(_0x435ede[_0x624d('0x33')]['includeAll']){_0x534a20[_0x624d('0x48')]=[{'all':!![]}];}_0x534a20=_['merge']({},_0x534a20,_0x435ede[_0x624d('0x49')]);return db[_0x624d('0x2e')][_0x624d('0x4a')](_0x534a20)[_0x624d('0x27')](handleEntityNotFound(_0x45b247,null))[_0x624d('0x27')](respondWithResult(_0x45b247,null))[_0x624d('0x46')](handleError(_0x45b247,null));};exports['create']=function(_0x4745f0,_0x5d2a80){return db[_0x624d('0x2e')][_0x624d('0x4b')](_0x4745f0['body'],{})[_0x624d('0x27')](respondWithResult(_0x5d2a80,0xc9))['catch'](handleError(_0x5d2a80,null));};exports['update']=function(_0x384901,_0x394448){if(_0x384901['body']['id']){delete _0x384901[_0x624d('0x4c')]['id'];}return db[_0x624d('0x2e')][_0x624d('0x4a')]({'where':{'id':_0x384901[_0x624d('0x4d')]['id']}})[_0x624d('0x27')](handleEntityNotFound(_0x394448,null))[_0x624d('0x27')](saveUpdates(_0x384901[_0x624d('0x4c')],null))[_0x624d('0x27')](respondWithResult(_0x394448,null))['catch'](handleError(_0x394448,null));};exports[_0x624d('0x28')]=function(_0x3c09e,_0x18ef7c){return db[_0x624d('0x2e')]['find']({'where':{'id':_0x3c09e[_0x624d('0x4d')]['id']}})[_0x624d('0x27')](handleEntityNotFound(_0x18ef7c,null))['then'](removeEntity(_0x18ef7c,null))[_0x624d('0x46')](handleError(_0x18ef7c,null));}; \ No newline at end of file +var _0xf16d=['include','findAll','show','params','includeAll','options','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','Content-Range','reject','then','destroy','sendStatus','error','send','index','FreshsalesField','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','map','type','VIRTUAL'];(function(_0x3042c5,_0x36cb88){var _0x7cd140=function(_0x4cdcd8){while(--_0x4cdcd8){_0x3042c5['push'](_0x3042c5['shift']());}};_0x7cd140(++_0x36cb88);}(_0xf16d,0x169));var _0xdf16=function(_0xfe977e,_0x3cb4bd){_0xfe977e=_0xfe977e-0x0;var _0x1b1e1e=_0xf16d[_0xfe977e];return _0x1b1e1e;};'use strict';var emlformat=require(_0xdf16('0x0'));var rimraf=require(_0xdf16('0x1'));var zipdir=require(_0xdf16('0x2'));var jsonpatch=require(_0xdf16('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdf16('0x4'));var util=require(_0xdf16('0x5'));var path=require('path');var sox=require(_0xdf16('0x6'));var csv=require('to-csv');var ejs=require(_0xdf16('0x7'));var fs=require('fs');var fs_extra=require(_0xdf16('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdf16('0x9'));var deskjs=require(_0xdf16('0xa'));var toCsv=require(_0xdf16('0xb'));var querystring=require(_0xdf16('0xc'));var Papa=require(_0xdf16('0xd'));var Redis=require('ioredis');var authService=require(_0xdf16('0xe'));var qs=require(_0xdf16('0xf'));var as=require(_0xdf16('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdf16('0x11'))(_0xdf16('0x12'));var utils=require(_0xdf16('0x13'));var config=require(_0xdf16('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xdf16('0x15'))['db'];function respondWithStatusCode(_0x3f4135,_0x58b06f){_0x58b06f=_0x58b06f||0xcc;return function(_0x4f8e5e){if(_0x4f8e5e){return _0x3f4135['sendStatus'](_0x58b06f);}return _0x3f4135[_0xdf16('0x16')](_0x58b06f)[_0xdf16('0x17')]();};}function respondWithResult(_0x59cd65,_0x12b5ce){_0x12b5ce=_0x12b5ce||0xc8;return function(_0x2c5cd0){if(_0x2c5cd0){return _0x59cd65[_0xdf16('0x16')](_0x12b5ce)[_0xdf16('0x18')](_0x2c5cd0);}};}function respondWithFilteredResult(_0x407c7b,_0x1f83ab){return function(_0x491f5f){if(_0x491f5f){var _0x3eabcc=typeof _0x1f83ab[_0xdf16('0x19')]===_0xdf16('0x1a')&&typeof _0x1f83ab['limit']===_0xdf16('0x1a');var _0x3a96df=_0x491f5f[_0xdf16('0x1b')];var _0x1bd5df=_0x3eabcc?0x0:_0x1f83ab['offset'];var _0x5716f9=_0x3eabcc?_0x491f5f['count']:_0x1f83ab[_0xdf16('0x19')]+_0x1f83ab['limit'];var _0x5f023f;if(_0x5716f9>=_0x3a96df){_0x5716f9=_0x3a96df;_0x5f023f=0xc8;}else{_0x5f023f=0xce;}_0x407c7b[_0xdf16('0x16')](_0x5f023f);return _0x407c7b['set'](_0xdf16('0x1c'),_0x1bd5df+'-'+_0x5716f9+'/'+_0x3a96df)['json'](_0x491f5f);}return null;};}function patchUpdates(_0x1dddb9){return function(_0x250984){try{jsonpatch['apply'](_0x250984,_0x1dddb9,!![]);}catch(_0x36c8c0){return BPromise[_0xdf16('0x1d')](_0x36c8c0);}return _0x250984['save']();};}function saveUpdates(_0x5b77a7,_0x3aa28f){return function(_0x13780f){if(_0x13780f){return _0x13780f['update'](_0x5b77a7)[_0xdf16('0x1e')](function(_0x26ca2f){return _0x26ca2f;});}return null;};}function removeEntity(_0x22d1d9,_0x2d06f7){return function(_0x4873cf){if(_0x4873cf){return _0x4873cf[_0xdf16('0x1f')]()[_0xdf16('0x1e')](function(){_0x22d1d9['status'](0xcc)[_0xdf16('0x17')]();});}};}function handleEntityNotFound(_0x15621c,_0x56f3f7){return function(_0x512413){if(!_0x512413){_0x15621c[_0xdf16('0x20')](0x194);}return _0x512413;};}function handleError(_0x14b61d,_0x234159){_0x234159=_0x234159||0x1f4;return function(_0x41932b){logger[_0xdf16('0x21')](_0x41932b['stack']);if(_0x41932b['name']){delete _0x41932b['name'];}_0x14b61d['status'](_0x234159)[_0xdf16('0x22')](_0x41932b);};}exports[_0xdf16('0x23')]=function(_0x1da4d6,_0x33bf5a){var _0x89151c={},_0x41f024={},_0x299faa={'count':0x0,'rows':[]};var _0x164c1a=_['map'](db[_0xdf16('0x24')][_0xdf16('0x25')],function(_0x501aa5){return{'name':_0x501aa5[_0xdf16('0x26')],'type':_0x501aa5['type'][_0xdf16('0x27')]};});_0x41f024[_0xdf16('0x28')]=_['map'](_0x164c1a,_0xdf16('0x29'));_0x41f024[_0xdf16('0x2a')]=_[_0xdf16('0x2b')](_0x1da4d6[_0xdf16('0x2a')]);_0x41f024[_0xdf16('0x2c')]=_[_0xdf16('0x2d')](_0x41f024[_0xdf16('0x28')],_0x41f024[_0xdf16('0x2a')]);_0x89151c[_0xdf16('0x2e')]=_[_0xdf16('0x2d')](_0x41f024['model'],qs['fields'](_0x1da4d6['query'][_0xdf16('0x2f')]));_0x89151c['attributes']=_0x89151c[_0xdf16('0x2e')][_0xdf16('0x30')]?_0x89151c[_0xdf16('0x2e')]:_0x41f024[_0xdf16('0x28')];if(!_0x1da4d6['query'][_0xdf16('0x31')]('nolimit')){_0x89151c['limit']=qs[_0xdf16('0x32')](_0x1da4d6['query'][_0xdf16('0x32')]);_0x89151c['offset']=qs[_0xdf16('0x19')](_0x1da4d6['query'][_0xdf16('0x19')]);}_0x89151c[_0xdf16('0x33')]=qs[_0xdf16('0x34')](_0x1da4d6[_0xdf16('0x2a')][_0xdf16('0x34')]);_0x89151c[_0xdf16('0x35')]=qs[_0xdf16('0x2c')](_['pick'](_0x1da4d6[_0xdf16('0x2a')],_0x41f024[_0xdf16('0x2c')]),_0x164c1a);if(_0x1da4d6['query'][_0xdf16('0x36')]){_0x89151c[_0xdf16('0x35')]=_[_0xdf16('0x37')](_0x89151c[_0xdf16('0x35')],{'$or':_[_0xdf16('0x38')](_0x164c1a,function(_0x36ed02){if(_0x36ed02[_0xdf16('0x39')]!==_0xdf16('0x3a')){var _0x36559b={};_0x36559b[_0x36ed02['name']]={'$like':'%'+_0x1da4d6[_0xdf16('0x2a')][_0xdf16('0x36')]+'%'};return _0x36559b;}})});}_0x89151c=_['merge']({},_0x89151c,_0x1da4d6['options']);var _0x2fcc71={'where':_0x89151c[_0xdf16('0x35')]};return db[_0xdf16('0x24')][_0xdf16('0x1b')](_0x2fcc71)[_0xdf16('0x1e')](function(_0x1c5ad2){_0x299faa['count']=_0x1c5ad2;if(_0x1da4d6[_0xdf16('0x2a')]['includeAll']){_0x89151c[_0xdf16('0x3b')]=[{'all':!![]}];}return db[_0xdf16('0x24')][_0xdf16('0x3c')](_0x89151c);})[_0xdf16('0x1e')](function(_0x89f6b8){_0x299faa['rows']=_0x89f6b8;return _0x299faa;})['then'](respondWithFilteredResult(_0x33bf5a,_0x89151c))['catch'](handleError(_0x33bf5a,null));};exports[_0xdf16('0x3d')]=function(_0x48a70a,_0x439048){var _0x4d3c40={'raw':!![],'where':{'id':_0x48a70a[_0xdf16('0x3e')]['id']}},_0x454b29={};_0x454b29[_0xdf16('0x28')]=_[_0xdf16('0x2b')](db[_0xdf16('0x24')][_0xdf16('0x25')]);_0x454b29[_0xdf16('0x2a')]=_[_0xdf16('0x2b')](_0x48a70a['query']);_0x454b29[_0xdf16('0x2c')]=_['intersection'](_0x454b29[_0xdf16('0x28')],_0x454b29[_0xdf16('0x2a')]);_0x4d3c40['attributes']=_['intersection'](_0x454b29['model'],qs['fields'](_0x48a70a['query'][_0xdf16('0x2f')]));_0x4d3c40[_0xdf16('0x2e')]=_0x4d3c40[_0xdf16('0x2e')][_0xdf16('0x30')]?_0x4d3c40['attributes']:_0x454b29[_0xdf16('0x28')];if(_0x48a70a[_0xdf16('0x2a')][_0xdf16('0x3f')]){_0x4d3c40[_0xdf16('0x3b')]=[{'all':!![]}];}_0x4d3c40=_[_0xdf16('0x37')]({},_0x4d3c40,_0x48a70a[_0xdf16('0x40')]);return db[_0xdf16('0x24')][_0xdf16('0x41')](_0x4d3c40)[_0xdf16('0x1e')](handleEntityNotFound(_0x439048,null))[_0xdf16('0x1e')](respondWithResult(_0x439048,null))[_0xdf16('0x42')](handleError(_0x439048,null));};exports[_0xdf16('0x43')]=function(_0x2b6db9,_0x5bd512){return db[_0xdf16('0x24')][_0xdf16('0x43')](_0x2b6db9[_0xdf16('0x44')],{})[_0xdf16('0x1e')](respondWithResult(_0x5bd512,0xc9))[_0xdf16('0x42')](handleError(_0x5bd512,null));};exports[_0xdf16('0x45')]=function(_0x4597ec,_0x3453fc){if(_0x4597ec['body']['id']){delete _0x4597ec['body']['id'];}return db[_0xdf16('0x24')][_0xdf16('0x41')]({'where':{'id':_0x4597ec[_0xdf16('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3453fc,null))['then'](saveUpdates(_0x4597ec['body'],null))[_0xdf16('0x1e')](respondWithResult(_0x3453fc,null))['catch'](handleError(_0x3453fc,null));};exports[_0xdf16('0x1f')]=function(_0x80a54e,_0x1aa822){return db[_0xdf16('0x24')][_0xdf16('0x41')]({'where':{'id':_0x80a54e[_0xdf16('0x3e')]['id']}})[_0xdf16('0x1e')](handleEntityNotFound(_0x1aa822,null))[_0xdf16('0x1e')](removeEntity(_0x1aa822,null))['catch'](handleError(_0x1aa822,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 7e82c48..ce78f7e 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 _0xa880=['./intFreshsalesField.attributes','define','FreshsalesField','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa880,0x106));var _0x0a88=function(_0x181fba,_0x3e23f4){_0x181fba=_0x181fba-0x0;var _0x509d8d=_0xa880[_0x181fba];return _0x509d8d;};'use strict';var _=require(_0x0a88('0x0'));var util=require(_0x0a88('0x1'));var logger=require(_0x0a88('0x2'))(_0x0a88('0x3'));var moment=require(_0x0a88('0x4'));var BPromise=require(_0x0a88('0x5'));var rp=require(_0x0a88('0x6'));var fs=require('fs');var path=require(_0x0a88('0x7'));var rimraf=require(_0x0a88('0x8'));var config=require(_0x0a88('0x9'));var attributes=require(_0x0a88('0xa'));module['exports']=function(_0x35c530,_0x2aac39){return _0x35c530[_0x0a88('0xb')](_0x0a88('0xc'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x0a88('0xd'),'fields':[_0x0a88('0xe'),_0x0a88('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd301=['int_freshsales_fields','idField','FieldId','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd301,0x145));var _0x1d30=function(_0x324496,_0x3a4cdd){_0x324496=_0x324496-0x0;var _0x899545=_0xd301[_0x324496];return _0x899545;};'use strict';var _=require(_0x1d30('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x1d30('0x1'));var BPromise=require(_0x1d30('0x2'));var rp=require(_0x1d30('0x3'));var fs=require('fs');var path=require(_0x1d30('0x4'));var rimraf=require(_0x1d30('0x5'));var config=require(_0x1d30('0x6'));var attributes=require(_0x1d30('0x7'));module[_0x1d30('0x8')]=function(_0x19f202,_0x4ad474){return _0x19f202[_0x1d30('0x9')](_0x1d30('0xa'),attributes,{'tableName':_0x1d30('0xb'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x1d30('0xc'),_0x1d30('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 30b4f70..495aea1 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 _0x7c09=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','then','info','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment'];(function(_0x4bdb2e,_0x53ae98){var _0x372646=function(_0x23b355){while(--_0x23b355){_0x4bdb2e['push'](_0x4bdb2e['shift']());}};_0x372646(++_0x53ae98);}(_0x7c09,0x102));var _0x97c0=function(_0xfd6e34,_0x3029ce){_0xfd6e34=_0xfd6e34-0x0;var _0x5a4dbb=_0x7c09[_0xfd6e34];return _0x5a4dbb;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var moment=require(_0x97c0('0x1'));var BPromise=require('bluebird');var rs=require(_0x97c0('0x2'));var fs=require('fs');var Redis=require(_0x97c0('0x3'));var db=require(_0x97c0('0x4'))['db'];var utils=require(_0x97c0('0x5'));var logger=require(_0x97c0('0x6'))(_0x97c0('0x7'));var config=require(_0x97c0('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46fdd9,_0x42c6c7,_0x2c19fa){return new BPromise(function(_0x109bc8,_0x293785){return client['request'](_0x46fdd9,_0x2c19fa)[_0x97c0('0x9')](function(_0x4ac5f1){logger[_0x97c0('0xa')](_0x97c0('0xb'),_0x42c6c7,'request\x20sent');logger['debug'](_0x97c0('0xc'),_0x42c6c7,_0x97c0('0xd'),JSON[_0x97c0('0xe')](_0x4ac5f1));if(_0x4ac5f1[_0x97c0('0xf')]){if(_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x10')]===0x1f4){logger[_0x97c0('0xf')](_0x97c0('0xb'),_0x42c6c7,_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x11')]);return _0x293785(_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x11')]);}logger[_0x97c0('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x42c6c7,_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x11')]);return _0x109bc8(_0x4ac5f1[_0x97c0('0xf')]['message']);}else{logger[_0x97c0('0xa')](_0x97c0('0xb'),_0x42c6c7,_0x97c0('0xd'));_0x109bc8(_0x4ac5f1[_0x97c0('0x12')][_0x97c0('0x11')]);}})[_0x97c0('0x13')](function(_0x49c0d9){logger[_0x97c0('0xf')](_0x97c0('0xb'),_0x42c6c7,_0x49c0d9);_0x293785(_0x49c0d9);});});} \ No newline at end of file +var _0x2675=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis'];(function(_0x5d86fa,_0x20203f){var _0x473702=function(_0x202ad1){while(--_0x202ad1){_0x5d86fa['push'](_0x5d86fa['shift']());}};_0x473702(++_0x20203f);}(_0x2675,0x75));var _0x5267=function(_0x4aaed9,_0x34382f){_0x4aaed9=_0x4aaed9-0x0;var _0x8bf05c=_0x2675[_0x4aaed9];return _0x8bf05c;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5267('0x1'));var fs=require('fs');var Redis=require(_0x5267('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5267('0x3'));var logger=require(_0x5267('0x4'))('rpc');var config=require(_0x5267('0x5'));var jayson=require(_0x5267('0x6'));var client=jayson[_0x5267('0x7')][_0x5267('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20f065,_0xc56cd5,_0x527c16){return new BPromise(function(_0x9e0a27,_0x46bfdf){return client['request'](_0x20f065,_0x527c16)[_0x5267('0x9')](function(_0x5d6645){logger[_0x5267('0xa')](_0x5267('0xb'),_0xc56cd5,_0x5267('0xc'));logger['debug'](_0x5267('0xd'),_0xc56cd5,'request\x20sent',JSON[_0x5267('0xe')](_0x5d6645));if(_0x5d6645['error']){if(_0x5d6645[_0x5267('0xf')][_0x5267('0x10')]===0x1f4){logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);return _0x46bfdf(_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);}logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);return _0x9e0a27(_0x5d6645[_0x5267('0xf')]['message']);}else{logger['info'](_0x5267('0xb'),_0xc56cd5,_0x5267('0xc'));_0x9e0a27(_0x5d6645[_0x5267('0x12')][_0x5267('0x11')]);}})[_0x5267('0x13')](function(_0x27e5c6){logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x27e5c6);_0x46bfdf(_0x27e5c6);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index a4fa217..79f9138 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(_0x3ac20e,_0x531e90){var _0x2a748c=function(_0xbcd504){while(--_0xbcd504){_0x3ac20e['push'](_0x3ac20e['shift']());}};_0x2a748c(++_0x531e90);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _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(_0x5a3ab6,_0x1e2825){var _0x274bb6=function(_0x1de5ce){while(--_0x1de5ce){_0x5a3ab6['push'](_0x5a3ab6['shift']());}};_0x274bb6(++_0x1e2825);}(_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 diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index bebcf7a..a3d316f 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 _0x3d3d=['integrationTab','exports','STRING','username','ENUM'];(function(_0x3c91e7,_0x17fea6){var _0x381e47=function(_0x225026){while(--_0x225026){_0x3c91e7['push'](_0x3c91e7['shift']());}};_0x381e47(++_0x17fea6);}(_0x3d3d,0xab));var _0xd3d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d3d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xd3d3('0x0')]={'name':{'type':Sequelize[_0xd3d3('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd3d3('0x1')],'unique':_0xd3d3('0x2')},'remoteUri':{'type':Sequelize[_0xd3d3('0x1')]},'password':{'type':Sequelize[_0xd3d3('0x1')]},'clientId':{'type':Sequelize[_0xd3d3('0x1')]},'clientSecret':{'type':Sequelize[_0xd3d3('0x1')]},'securityToken':{'type':Sequelize[_0xd3d3('0x1')]},'serverUrl':{'type':Sequelize[_0xd3d3('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xd3d3('0x3')](_0xd3d3('0x4'),'newTab'),'defaultValue':_0xd3d3('0x4')}}; \ No newline at end of file +var _0x6bab=['exports','STRING','username','integrationTab','newTab','sequelize'];(function(_0x1964b4,_0x5796f4){var _0x509a77=function(_0x247257){while(--_0x247257){_0x1964b4['push'](_0x1964b4['shift']());}};_0x509a77(++_0x5796f4);}(_0x6bab,0x1c7));var _0xb6ba=function(_0x3430aa,_0x57cd92){_0x3430aa=_0x3430aa-0x0;var _0x2ac5c=_0x6bab[_0x3430aa];return _0x2ac5c;};'use strict';var Sequelize=require(_0xb6ba('0x0'));module[_0xb6ba('0x1')]={'name':{'type':Sequelize[_0xb6ba('0x2')]},'description':{'type':Sequelize[_0xb6ba('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xb6ba('0x3')},'remoteUri':{'type':Sequelize[_0xb6ba('0x2')]},'password':{'type':Sequelize[_0xb6ba('0x2')]},'clientId':{'type':Sequelize[_0xb6ba('0x2')]},'clientSecret':{'type':Sequelize[_0xb6ba('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xb6ba('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xb6ba('0x4'),_0xb6ba('0x5')),'defaultValue':_0xb6ba('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 790350a..a6cf1e5 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 _0x1414=['statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','undefined','count','set','Content-Range','json','reject','save','then','end','error','stack','name','send','index','map','SalesforceAccount','fieldName','type','key','model','keys','query','intersection','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','params','rawAttributes','fields','length','includeAll','find','create','body','update','destroy','SalesforceConfiguration','order','getConfigurations','findOne','Subjects','getSubjects','Descriptions','getDescriptions','SalesforceField','remoteUri','clientId','clientSecret','username','password','securityToken','substring','lastIndexOf','Connection','login','concat','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','picklist','boolean','textarea','phone','remove','label','picklistValues','value','True','true','False','false','test'];(function(_0x1d0c1a,_0x3209d2){var _0x4bee7b=function(_0x14910b){while(--_0x14910b){_0x1d0c1a['push'](_0x1d0c1a['shift']());}};_0x4bee7b(++_0x3209d2);}(_0x1414,0xf4));var _0x4141=function(_0x225b82,_0x2442a7){_0x225b82=_0x225b82-0x0;var _0x5e2def=_0x1414[_0x225b82];return _0x5e2def;};'use strict';var emlformat=require(_0x4141('0x0'));var rimraf=require(_0x4141('0x1'));var zipdir=require(_0x4141('0x2'));var jsonpatch=require(_0x4141('0x3'));var rp=require('request-promise');var moment=require(_0x4141('0x4'));var BPromise=require(_0x4141('0x5'));var Mustache=require('mustache');var util=require(_0x4141('0x6'));var path=require(_0x4141('0x7'));var sox=require('sox');var csv=require(_0x4141('0x8'));var ejs=require(_0x4141('0x9'));var fs=require('fs');var fs_extra=require(_0x4141('0xa'));var _=require(_0x4141('0xb'));var squel=require(_0x4141('0xc'));var crypto=require(_0x4141('0xd'));var jsforce=require(_0x4141('0xe'));var deskjs=require(_0x4141('0xf'));var toCsv=require(_0x4141('0x8'));var querystring=require('querystring');var Papa=require(_0x4141('0x10'));var Redis=require(_0x4141('0x11'));var authService=require(_0x4141('0x12'));var qs=require(_0x4141('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4141('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x4141('0x15'));var licenseUtil=require(_0x4141('0x16'));var db=require(_0x4141('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xc9c1b4,_0x2c66d6){_0x2c66d6=_0x2c66d6||0xcc;return function(_0x50824b){if(_0x50824b){return _0xc9c1b4['sendStatus'](_0x2c66d6);}return _0xc9c1b4['status'](_0x2c66d6)['end']();};}function respondWithResult(_0x592aa8,_0x224ce2){_0x224ce2=_0x224ce2||0xc8;return function(_0x2b6e9e){if(_0x2b6e9e){return _0x592aa8[_0x4141('0x18')](_0x224ce2)['json'](_0x2b6e9e);}};}function respondWithFilteredResult(_0x45aa25,_0x22ee46){return function(_0x3e2a69){if(_0x3e2a69){var _0x27985e=typeof _0x22ee46[_0x4141('0x19')]==='undefined'&&typeof _0x22ee46[_0x4141('0x1a')]===_0x4141('0x1b');var _0x12f1c6=_0x3e2a69[_0x4141('0x1c')];var _0x5f7868=_0x27985e?0x0:_0x22ee46[_0x4141('0x19')];var _0x7ded42=_0x27985e?_0x3e2a69[_0x4141('0x1c')]:_0x22ee46[_0x4141('0x19')]+_0x22ee46[_0x4141('0x1a')];var _0x21cf74;if(_0x7ded42>=_0x12f1c6){_0x7ded42=_0x12f1c6;_0x21cf74=0xc8;}else{_0x21cf74=0xce;}_0x45aa25[_0x4141('0x18')](_0x21cf74);return _0x45aa25[_0x4141('0x1d')](_0x4141('0x1e'),_0x5f7868+'-'+_0x7ded42+'/'+_0x12f1c6)[_0x4141('0x1f')](_0x3e2a69);}return null;};}function patchUpdates(_0x1a9c65){return function(_0x21b0f9){try{jsonpatch['apply'](_0x21b0f9,_0x1a9c65,!![]);}catch(_0x508f52){return BPromise[_0x4141('0x20')](_0x508f52);}return _0x21b0f9[_0x4141('0x21')]();};}function saveUpdates(_0x4c741b,_0xe7ac52){return function(_0x27394a){if(_0x27394a){return _0x27394a['update'](_0x4c741b)[_0x4141('0x22')](function(_0xb6842d){return _0xb6842d;});}return null;};}function removeEntity(_0x1b8a21,_0x4865d0){return function(_0x4ba4b4){if(_0x4ba4b4){return _0x4ba4b4['destroy']()[_0x4141('0x22')](function(){_0x1b8a21[_0x4141('0x18')](0xcc)[_0x4141('0x23')]();});}};}function handleEntityNotFound(_0x289d91,_0xd650d6){return function(_0x37f66a){if(!_0x37f66a){_0x289d91['sendStatus'](0x194);}return _0x37f66a;};}function handleError(_0x121612,_0x47cd23){_0x47cd23=_0x47cd23||0x1f4;return function(_0x131fac){logger[_0x4141('0x24')](_0x131fac[_0x4141('0x25')]);if(_0x131fac[_0x4141('0x26')]){delete _0x131fac['name'];}_0x121612[_0x4141('0x18')](_0x47cd23)[_0x4141('0x27')](_0x131fac);};}exports[_0x4141('0x28')]=function(_0x1925cc,_0x5a00fb){var _0x5a0f52={},_0x19b4b5={},_0x2751b4={'count':0x0,'rows':[]};var _0x4f21ce=_[_0x4141('0x29')](db[_0x4141('0x2a')]['rawAttributes'],function(_0x4734eb){return{'name':_0x4734eb[_0x4141('0x2b')],'type':_0x4734eb[_0x4141('0x2c')][_0x4141('0x2d')]};});_0x19b4b5[_0x4141('0x2e')]=_['map'](_0x4f21ce,_0x4141('0x26'));_0x19b4b5['query']=_[_0x4141('0x2f')](_0x1925cc[_0x4141('0x30')]);_0x19b4b5['filters']=_[_0x4141('0x31')](_0x19b4b5[_0x4141('0x2e')],_0x19b4b5[_0x4141('0x30')]);_0x5a0f52['attributes']=_[_0x4141('0x31')](_0x19b4b5[_0x4141('0x2e')],qs['fields'](_0x1925cc[_0x4141('0x30')]['fields']));_0x5a0f52[_0x4141('0x32')]=_0x5a0f52['attributes']['length']?_0x5a0f52[_0x4141('0x32')]:_0x19b4b5[_0x4141('0x2e')];if(!_0x1925cc[_0x4141('0x30')][_0x4141('0x33')](_0x4141('0x34'))){_0x5a0f52['limit']=qs['limit'](_0x1925cc[_0x4141('0x30')][_0x4141('0x1a')]);_0x5a0f52[_0x4141('0x19')]=qs[_0x4141('0x19')](_0x1925cc[_0x4141('0x30')][_0x4141('0x19')]);}_0x5a0f52['order']=qs[_0x4141('0x35')](_0x1925cc[_0x4141('0x30')]['sort']);_0x5a0f52[_0x4141('0x36')]=qs[_0x4141('0x37')](_[_0x4141('0x38')](_0x1925cc[_0x4141('0x30')],_0x19b4b5[_0x4141('0x37')]),_0x4f21ce);if(_0x1925cc[_0x4141('0x30')][_0x4141('0x39')]){_0x5a0f52['where']=_[_0x4141('0x3a')](_0x5a0f52[_0x4141('0x36')],{'$or':_[_0x4141('0x29')](_0x4f21ce,function(_0x483ceb){if(_0x483ceb['type']!=='VIRTUAL'){var _0x3a17b9={};_0x3a17b9[_0x483ceb[_0x4141('0x26')]]={'$like':'%'+_0x1925cc['query'][_0x4141('0x39')]+'%'};return _0x3a17b9;}})});}_0x5a0f52=_[_0x4141('0x3a')]({},_0x5a0f52,_0x1925cc[_0x4141('0x3b')]);var _0x2b8569={'where':_0x5a0f52[_0x4141('0x36')]};return db[_0x4141('0x2a')][_0x4141('0x1c')](_0x2b8569)['then'](function(_0x317bf8){_0x2751b4[_0x4141('0x1c')]=_0x317bf8;if(_0x1925cc[_0x4141('0x30')]['includeAll']){_0x5a0f52[_0x4141('0x3c')]=[{'all':!![]}];}return db[_0x4141('0x2a')][_0x4141('0x3d')](_0x5a0f52);})[_0x4141('0x22')](function(_0x7ad42a){_0x2751b4[_0x4141('0x3e')]=_0x7ad42a;return _0x2751b4;})[_0x4141('0x22')](respondWithFilteredResult(_0x5a00fb,_0x5a0f52))[_0x4141('0x3f')](handleError(_0x5a00fb,null));};exports['show']=function(_0xb3cff8,_0x15afa7){var _0x47cd4d={'raw':![],'where':{'id':_0xb3cff8[_0x4141('0x40')]['id']}},_0x2fb5c8={};_0x2fb5c8['model']=_['keys'](db[_0x4141('0x2a')][_0x4141('0x41')]);_0x2fb5c8[_0x4141('0x30')]=_[_0x4141('0x2f')](_0xb3cff8[_0x4141('0x30')]);_0x2fb5c8[_0x4141('0x37')]=_[_0x4141('0x31')](_0x2fb5c8['model'],_0x2fb5c8['query']);_0x47cd4d[_0x4141('0x32')]=_[_0x4141('0x31')](_0x2fb5c8[_0x4141('0x2e')],qs[_0x4141('0x42')](_0xb3cff8['query'][_0x4141('0x42')]));_0x47cd4d[_0x4141('0x32')]=_0x47cd4d['attributes'][_0x4141('0x43')]?_0x47cd4d[_0x4141('0x32')]:_0x2fb5c8[_0x4141('0x2e')];if(_0xb3cff8[_0x4141('0x30')][_0x4141('0x44')]){_0x47cd4d['include']=[{'all':!![]}];}_0x47cd4d=_['merge']({},_0x47cd4d,_0xb3cff8[_0x4141('0x3b')]);return db[_0x4141('0x2a')][_0x4141('0x45')](_0x47cd4d)[_0x4141('0x22')](handleEntityNotFound(_0x15afa7,null))[_0x4141('0x22')](respondWithResult(_0x15afa7,null))[_0x4141('0x3f')](handleError(_0x15afa7,null));};exports[_0x4141('0x46')]=function(_0x1febe6,_0x48376b){return db[_0x4141('0x2a')][_0x4141('0x46')](_0x1febe6[_0x4141('0x47')],{})[_0x4141('0x22')](respondWithResult(_0x48376b,0xc9))[_0x4141('0x3f')](handleError(_0x48376b,null));};exports[_0x4141('0x48')]=function(_0x194db9,_0x27c03d){if(_0x194db9['body']['id']){delete _0x194db9[_0x4141('0x47')]['id'];}return db[_0x4141('0x2a')][_0x4141('0x45')]({'where':{'id':_0x194db9[_0x4141('0x40')]['id']}})['then'](handleEntityNotFound(_0x27c03d,null))[_0x4141('0x22')](saveUpdates(_0x194db9[_0x4141('0x47')],null))[_0x4141('0x22')](respondWithResult(_0x27c03d,null))[_0x4141('0x3f')](handleError(_0x27c03d,null));};exports[_0x4141('0x49')]=function(_0x204b2c,_0x34f361){return db[_0x4141('0x2a')][_0x4141('0x45')]({'where':{'id':_0x204b2c['params']['id']}})['then'](handleEntityNotFound(_0x34f361,null))['then'](removeEntity(_0x34f361,null))[_0x4141('0x3f')](handleError(_0x34f361,null));};exports['getConfigurations']=function(_0x4ce93d,_0x363e14,_0x360c85){var _0x4834e7={};var _0x47fcbc={};var _0x1da366;var _0x4a7936;return db[_0x4141('0x2a')]['findOne']({'where':{'id':_0x4ce93d[_0x4141('0x40')]['id']}})[_0x4141('0x22')](handleEntityNotFound(_0x363e14,null))[_0x4141('0x22')](function(_0x10b72e){if(_0x10b72e){_0x1da366=_0x10b72e;_0x47fcbc['model']=_[_0x4141('0x2f')](db[_0x4141('0x4a')][_0x4141('0x41')]);_0x47fcbc[_0x4141('0x30')]=_[_0x4141('0x2f')](_0x4ce93d[_0x4141('0x30')]);_0x47fcbc[_0x4141('0x37')]=_[_0x4141('0x31')](_0x47fcbc[_0x4141('0x2e')],_0x47fcbc['query']);_0x4834e7[_0x4141('0x32')]=_[_0x4141('0x31')](_0x47fcbc[_0x4141('0x2e')],qs[_0x4141('0x42')](_0x4ce93d[_0x4141('0x30')][_0x4141('0x42')]));_0x4834e7['attributes']=_0x4834e7['attributes'][_0x4141('0x43')]?_0x4834e7[_0x4141('0x32')]:_0x47fcbc[_0x4141('0x2e')];_0x4834e7[_0x4141('0x4b')]=qs[_0x4141('0x35')](_0x4ce93d[_0x4141('0x30')]['sort']);_0x4834e7[_0x4141('0x36')]=qs['filters'](_[_0x4141('0x38')](_0x4ce93d[_0x4141('0x30')],_0x47fcbc[_0x4141('0x37')]));if(_0x4ce93d[_0x4141('0x30')][_0x4141('0x39')]){_0x4834e7[_0x4141('0x36')]=_[_0x4141('0x3a')](_0x4834e7[_0x4141('0x36')],{'$or':_[_0x4141('0x29')](_0x4834e7[_0x4141('0x32')],function(_0x14cb3c){var _0x4b0b9b={};_0x4b0b9b[_0x14cb3c]={'$like':'%'+_0x4ce93d[_0x4141('0x30')][_0x4141('0x39')]+'%'};return _0x4b0b9b;})});}_0x4834e7=_[_0x4141('0x3a')]({},_0x4834e7,_0x4ce93d[_0x4141('0x3b')]);return _0x1da366[_0x4141('0x4c')](_0x4834e7);}})['then'](function(_0x5eccc8){if(_0x5eccc8){_0x4a7936=_0x5eccc8[_0x4141('0x43')];if(!_0x4ce93d[_0x4141('0x30')][_0x4141('0x33')](_0x4141('0x34'))){_0x4834e7['limit']=qs[_0x4141('0x1a')](_0x4ce93d['query'][_0x4141('0x1a')]);_0x4834e7[_0x4141('0x19')]=qs[_0x4141('0x19')](_0x4ce93d[_0x4141('0x30')][_0x4141('0x19')]);}return _0x1da366[_0x4141('0x4c')](_0x4834e7);}})[_0x4141('0x22')](function(_0x362d4e){if(_0x362d4e){return _0x362d4e?{'count':_0x4a7936,'rows':_0x362d4e}:null;}})[_0x4141('0x22')](respondWithResult(_0x363e14,null))[_0x4141('0x3f')](handleError(_0x363e14,null));};exports['addConfiguration']=function(_0x10055c,_0x85d624,_0x4ee543){if(_0x10055c[_0x4141('0x47')]['id']){delete _0x10055c['body']['id'];}return db[_0x4141('0x2a')][_0x4141('0x4d')]({'where':{'id':_0x10055c['params']['id']}})[_0x4141('0x22')](handleEntityNotFound(_0x85d624,null))[_0x4141('0x22')](function(_0x2c3351){if(_0x2c3351){_0x10055c[_0x4141('0x47')]['AccountId']=_0x2c3351['id'];_0x10055c[_0x4141('0x47')][_0x4141('0x4e')]=integrations[_0x4141('0x4f')](_0x10055c[_0x4141('0x47')]['channel'],_0x10055c[_0x4141('0x47')]['type']);_0x10055c[_0x4141('0x47')][_0x4141('0x50')]=integrations[_0x4141('0x51')](_0x10055c['body']['channel'],_0x10055c[_0x4141('0x47')][_0x4141('0x2c')]);return db['SalesforceConfiguration'][_0x4141('0x46')](_0x10055c['body'],{'include':[{'model':db[_0x4141('0x52')],'as':_0x4141('0x4e')},{'model':db[_0x4141('0x52')],'as':_0x4141('0x50')}]});}return null;})['then'](respondWithResult(_0x85d624,null))[_0x4141('0x3f')](handleError(_0x85d624,null));};exports['getFields']=function(_0x44dd04,_0x43bb76,_0x3cc7bd){var _0x3ccf2d;var _0x2e15bf='';var _0x124d93='Task';return db[_0x4141('0x2a')]['findOne']({'where':{'id':_0x44dd04['params']['id']},'attributes':['id',_0x4141('0x53'),_0x4141('0x54'),_0x4141('0x55'),_0x4141('0x56'),_0x4141('0x57'),_0x4141('0x58')]})[_0x4141('0x22')](handleEntityNotFound(_0x43bb76,null))[_0x4141('0x22')](function(_0x59ec54){if(_0x59ec54){_0x2e15bf=_0x59ec54[_0x4141('0x53')];var _0x3ad53d=_0x2e15bf['slice'](-0x1);if(_0x3ad53d==='/'){_0x2e15bf=_0x2e15bf[_0x4141('0x59')](0x0,_0x2e15bf[_0x4141('0x5a')](_0x3ad53d));}_0x3ccf2d=new jsforce[(_0x4141('0x5b'))]({'oauth2':{'loginUrl':_0x2e15bf,'clientId':_0x59ec54[_0x4141('0x54')],'clientSecret':_0x59ec54[_0x4141('0x55')]}});return _0x3ccf2d[_0x4141('0x5c')](_0x59ec54[_0x4141('0x56')],_0x59ec54[_0x4141('0x57')][_0x4141('0x5d')](_0x59ec54[_0x4141('0x58')]));}})[_0x4141('0x22')](function(_0x2224f8){if(_0x2224f8){if(!_['isNil'](_0x44dd04[_0x4141('0x30')]['ticketType'])){_0x124d93=_0x44dd04[_0x4141('0x30')][_0x4141('0x5e')];}return _0x3ccf2d[_0x4141('0x5f')](_0x124d93)[_0x4141('0x60')]();}})[_0x4141('0x22')](function(_0x314dda){var _0x341923=[_0x4141('0x61'),_0x4141('0x62'),_0x4141('0x63'),_0x4141('0x64'),_0x4141('0x65'),_0x4141('0x66')];var _0x58eda7=['string','int',_0x4141('0x67'),_0x4141('0x68'),'email',_0x4141('0x69'),_0x4141('0x6a')];if(_0x314dda){_[_0x4141('0x6b')](_0x314dda[_0x4141('0x42')],function(_0x65a7c2){return _0x341923['includes'](_0x65a7c2['name'])||!_0x58eda7['includes'](_0x65a7c2['type']);});return{'count':_0x314dda[_0x4141('0x42')][_0x4141('0x43')],'rows':_[_0x4141('0x29')](_0x314dda[_0x4141('0x42')],function(_0x23f28d){return{'id':_0x23f28d[_0x4141('0x26')],'name':_0x23f28d[_0x4141('0x6c')],'custom':_0x23f28d['custom'],'options':_0x23f28d[_0x4141('0x6d')]['length']>0x0?_[_0x4141('0x29')](_0x23f28d[_0x4141('0x6d')],function(_0x4b5dc1){return{'name':_0x4b5dc1[_0x4141('0x6c')],'value':_0x4b5dc1[_0x4141('0x6e')]};}):_0x23f28d[_0x4141('0x2c')]=='boolean'?[{'name':_0x4141('0x6f'),'value':_0x4141('0x70')},{'name':_0x4141('0x71'),'value':_0x4141('0x72')}]:[]};})};}})[_0x4141('0x22')](respondWithResult(_0x43bb76,null))[_0x4141('0x3f')](function(_0x10983e){var _0x42f857=_0x44dd04[_0x4141('0x30')][_0x4141('0x73')]?0x1f4:_0x10983e[_0x4141('0x74')]||0x1f4;logger['error'](_0x4141('0x75'),_0x4141('0x76'),_0x42f857,JSON['stringify'](_0x10983e));delete _0x10983e[_0x4141('0x26')];if(_0x42f857===0x191){_0x42f857=0x190;}_0x43bb76[_0x4141('0x18')](_0x42f857)[_0x4141('0x27')](_0x44dd04[_0x4141('0x30')][_0x4141('0x73')]?{'message':_0x4141('0x77'),'statusCode':_0x10983e[_0x4141('0x74')]}:_0x10983e);});}; \ No newline at end of file +var _0x3af4=['../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','name','index','map','SalesforceAccount','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','getConfigurations','findOne','SalesforceConfiguration','order','sort','Subjects','getSubjects','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','login','concat','isNil','ticketType','sobject','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','int','picklist','boolean','email','textarea','includes','label','picklistValues','True','true','False','false','test','statusCode','error','stringify','send','rimraf','zip-dir','request-promise','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb'];(function(_0x4e2e40,_0xe0400e){var _0x2acea7=function(_0x555eff){while(--_0x555eff){_0x4e2e40['push'](_0x4e2e40['shift']());}};_0x2acea7(++_0xe0400e);}(_0x3af4,0xd2));var _0x43af=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0x3af4[_0x23b655];return _0x364b32;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x43af('0x0'));var zipdir=require(_0x43af('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x43af('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x43af('0x3'));var path=require(_0x43af('0x4'));var sox=require(_0x43af('0x5'));var csv=require(_0x43af('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x43af('0x7'));var _=require('lodash');var squel=require(_0x43af('0x8'));var crypto=require(_0x43af('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x43af('0xa'));var toCsv=require(_0x43af('0x6'));var querystring=require(_0x43af('0xb'));var Papa=require(_0x43af('0xc'));var Redis=require(_0x43af('0xd'));var authService=require(_0x43af('0xe'));var qs=require(_0x43af('0xf'));var as=require(_0x43af('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x43af('0x11'));var utils=require(_0x43af('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x43af('0x13'))['db'];var integrations=require(_0x43af('0x14'));function respondWithStatusCode(_0x8a8c2e,_0x49384b){_0x49384b=_0x49384b||0xcc;return function(_0x1757e5){if(_0x1757e5){return _0x8a8c2e[_0x43af('0x15')](_0x49384b);}return _0x8a8c2e[_0x43af('0x16')](_0x49384b)[_0x43af('0x17')]();};}function respondWithResult(_0x274953,_0x1e19a4){_0x1e19a4=_0x1e19a4||0xc8;return function(_0x1e262b){if(_0x1e262b){return _0x274953['status'](_0x1e19a4)[_0x43af('0x18')](_0x1e262b);}};}function respondWithFilteredResult(_0x595d49,_0x3a1d3d){return function(_0x5007b2){if(_0x5007b2){var _0x1a924b=typeof _0x3a1d3d[_0x43af('0x19')]===_0x43af('0x1a')&&typeof _0x3a1d3d[_0x43af('0x1b')]===_0x43af('0x1a');var _0x2dc1c5=_0x5007b2[_0x43af('0x1c')];var _0x15973a=_0x1a924b?0x0:_0x3a1d3d[_0x43af('0x19')];var _0x4fa75a=_0x1a924b?_0x5007b2[_0x43af('0x1c')]:_0x3a1d3d['offset']+_0x3a1d3d[_0x43af('0x1b')];var _0x4e4cd5;if(_0x4fa75a>=_0x2dc1c5){_0x4fa75a=_0x2dc1c5;_0x4e4cd5=0xc8;}else{_0x4e4cd5=0xce;}_0x595d49['status'](_0x4e4cd5);return _0x595d49[_0x43af('0x1d')](_0x43af('0x1e'),_0x15973a+'-'+_0x4fa75a+'/'+_0x2dc1c5)[_0x43af('0x18')](_0x5007b2);}return null;};}function patchUpdates(_0x209885){return function(_0x231883){try{jsonpatch[_0x43af('0x1f')](_0x231883,_0x209885,!![]);}catch(_0xe88667){return BPromise['reject'](_0xe88667);}return _0x231883['save']();};}function saveUpdates(_0x56671b,_0x3258b7){return function(_0x5b4752){if(_0x5b4752){return _0x5b4752[_0x43af('0x20')](_0x56671b)[_0x43af('0x21')](function(_0x5ee2dc){return _0x5ee2dc;});}return null;};}function removeEntity(_0x3f45b8,_0x1a9154){return function(_0x2bd458){if(_0x2bd458){return _0x2bd458[_0x43af('0x22')]()[_0x43af('0x21')](function(){_0x3f45b8[_0x43af('0x16')](0xcc)[_0x43af('0x17')]();});}};}function handleEntityNotFound(_0x101748,_0xf0ff92){return function(_0xba4871){if(!_0xba4871){_0x101748[_0x43af('0x15')](0x194);}return _0xba4871;};}function handleError(_0x5ddd68,_0xe3bd18){_0xe3bd18=_0xe3bd18||0x1f4;return function(_0x1cacfd){logger['error'](_0x1cacfd['stack']);if(_0x1cacfd[_0x43af('0x23')]){delete _0x1cacfd[_0x43af('0x23')];}_0x5ddd68[_0x43af('0x16')](_0xe3bd18)['send'](_0x1cacfd);};}exports[_0x43af('0x24')]=function(_0x133ef7,_0x2978b8){var _0x44efec={},_0x4c91e4={},_0x36a78d={'count':0x0,'rows':[]};var _0x122c5b=_[_0x43af('0x25')](db[_0x43af('0x26')][_0x43af('0x27')],function(_0x504afe){return{'name':_0x504afe[_0x43af('0x28')],'type':_0x504afe['type']['key']};});_0x4c91e4[_0x43af('0x29')]=_[_0x43af('0x25')](_0x122c5b,_0x43af('0x23'));_0x4c91e4['query']=_[_0x43af('0x2a')](_0x133ef7[_0x43af('0x2b')]);_0x4c91e4[_0x43af('0x2c')]=_[_0x43af('0x2d')](_0x4c91e4['model'],_0x4c91e4[_0x43af('0x2b')]);_0x44efec[_0x43af('0x2e')]=_['intersection'](_0x4c91e4[_0x43af('0x29')],qs[_0x43af('0x2f')](_0x133ef7['query'][_0x43af('0x2f')]));_0x44efec[_0x43af('0x2e')]=_0x44efec[_0x43af('0x2e')]['length']?_0x44efec['attributes']:_0x4c91e4[_0x43af('0x29')];if(!_0x133ef7[_0x43af('0x2b')][_0x43af('0x30')](_0x43af('0x31'))){_0x44efec[_0x43af('0x1b')]=qs[_0x43af('0x1b')](_0x133ef7[_0x43af('0x2b')][_0x43af('0x1b')]);_0x44efec[_0x43af('0x19')]=qs[_0x43af('0x19')](_0x133ef7[_0x43af('0x2b')][_0x43af('0x19')]);}_0x44efec['order']=qs['sort'](_0x133ef7[_0x43af('0x2b')]['sort']);_0x44efec[_0x43af('0x32')]=qs[_0x43af('0x2c')](_[_0x43af('0x33')](_0x133ef7[_0x43af('0x2b')],_0x4c91e4[_0x43af('0x2c')]),_0x122c5b);if(_0x133ef7[_0x43af('0x2b')][_0x43af('0x34')]){_0x44efec['where']=_[_0x43af('0x35')](_0x44efec['where'],{'$or':_['map'](_0x122c5b,function(_0x5d66d1){if(_0x5d66d1[_0x43af('0x36')]!==_0x43af('0x37')){var _0x2fd032={};_0x2fd032[_0x5d66d1[_0x43af('0x23')]]={'$like':'%'+_0x133ef7[_0x43af('0x2b')]['filter']+'%'};return _0x2fd032;}})});}_0x44efec=_['merge']({},_0x44efec,_0x133ef7[_0x43af('0x38')]);var _0x5b179e={'where':_0x44efec['where']};return db[_0x43af('0x26')][_0x43af('0x1c')](_0x5b179e)[_0x43af('0x21')](function(_0x299f15){_0x36a78d['count']=_0x299f15;if(_0x133ef7['query'][_0x43af('0x39')]){_0x44efec[_0x43af('0x3a')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x43af('0x3b')](_0x44efec);})[_0x43af('0x21')](function(_0x2ca510){_0x36a78d[_0x43af('0x3c')]=_0x2ca510;return _0x36a78d;})[_0x43af('0x21')](respondWithFilteredResult(_0x2978b8,_0x44efec))['catch'](handleError(_0x2978b8,null));};exports[_0x43af('0x3d')]=function(_0x59840c,_0x407e91){var _0x36039d={'raw':![],'where':{'id':_0x59840c[_0x43af('0x3e')]['id']}},_0x489e3f={};_0x489e3f[_0x43af('0x29')]=_[_0x43af('0x2a')](db[_0x43af('0x26')][_0x43af('0x27')]);_0x489e3f[_0x43af('0x2b')]=_[_0x43af('0x2a')](_0x59840c['query']);_0x489e3f[_0x43af('0x2c')]=_[_0x43af('0x2d')](_0x489e3f[_0x43af('0x29')],_0x489e3f[_0x43af('0x2b')]);_0x36039d[_0x43af('0x2e')]=_['intersection'](_0x489e3f[_0x43af('0x29')],qs['fields'](_0x59840c[_0x43af('0x2b')]['fields']));_0x36039d[_0x43af('0x2e')]=_0x36039d['attributes'][_0x43af('0x3f')]?_0x36039d[_0x43af('0x2e')]:_0x489e3f['model'];if(_0x59840c[_0x43af('0x2b')][_0x43af('0x39')]){_0x36039d[_0x43af('0x3a')]=[{'all':!![]}];}_0x36039d=_[_0x43af('0x35')]({},_0x36039d,_0x59840c['options']);return db[_0x43af('0x26')][_0x43af('0x40')](_0x36039d)[_0x43af('0x21')](handleEntityNotFound(_0x407e91,null))[_0x43af('0x21')](respondWithResult(_0x407e91,null))[_0x43af('0x41')](handleError(_0x407e91,null));};exports[_0x43af('0x42')]=function(_0x55f922,_0x3a3f15){return db[_0x43af('0x26')][_0x43af('0x42')](_0x55f922['body'],{})['then'](respondWithResult(_0x3a3f15,0xc9))['catch'](handleError(_0x3a3f15,null));};exports[_0x43af('0x20')]=function(_0x3dd11e,_0x101fe1){if(_0x3dd11e[_0x43af('0x43')]['id']){delete _0x3dd11e['body']['id'];}return db[_0x43af('0x26')][_0x43af('0x40')]({'where':{'id':_0x3dd11e[_0x43af('0x3e')]['id']}})[_0x43af('0x21')](handleEntityNotFound(_0x101fe1,null))['then'](saveUpdates(_0x3dd11e[_0x43af('0x43')],null))[_0x43af('0x21')](respondWithResult(_0x101fe1,null))['catch'](handleError(_0x101fe1,null));};exports[_0x43af('0x22')]=function(_0xd273f1,_0x1f8d72){return db[_0x43af('0x26')][_0x43af('0x40')]({'where':{'id':_0xd273f1[_0x43af('0x3e')]['id']}})[_0x43af('0x21')](handleEntityNotFound(_0x1f8d72,null))[_0x43af('0x21')](removeEntity(_0x1f8d72,null))[_0x43af('0x41')](handleError(_0x1f8d72,null));};exports[_0x43af('0x44')]=function(_0x4e579d,_0x2511da,_0x1bc3a0){var _0x3c68d3={};var _0x322994={};var _0x23e6e5;var _0xc6e822;return db['SalesforceAccount'][_0x43af('0x45')]({'where':{'id':_0x4e579d[_0x43af('0x3e')]['id']}})[_0x43af('0x21')](handleEntityNotFound(_0x2511da,null))['then'](function(_0x44ec6d){if(_0x44ec6d){_0x23e6e5=_0x44ec6d;_0x322994['model']=_[_0x43af('0x2a')](db[_0x43af('0x46')]['rawAttributes']);_0x322994[_0x43af('0x2b')]=_[_0x43af('0x2a')](_0x4e579d['query']);_0x322994[_0x43af('0x2c')]=_[_0x43af('0x2d')](_0x322994[_0x43af('0x29')],_0x322994['query']);_0x3c68d3[_0x43af('0x2e')]=_[_0x43af('0x2d')](_0x322994[_0x43af('0x29')],qs['fields'](_0x4e579d[_0x43af('0x2b')][_0x43af('0x2f')]));_0x3c68d3['attributes']=_0x3c68d3[_0x43af('0x2e')][_0x43af('0x3f')]?_0x3c68d3[_0x43af('0x2e')]:_0x322994[_0x43af('0x29')];_0x3c68d3[_0x43af('0x47')]=qs[_0x43af('0x48')](_0x4e579d[_0x43af('0x2b')]['sort']);_0x3c68d3[_0x43af('0x32')]=qs[_0x43af('0x2c')](_['pick'](_0x4e579d[_0x43af('0x2b')],_0x322994[_0x43af('0x2c')]));if(_0x4e579d[_0x43af('0x2b')][_0x43af('0x34')]){_0x3c68d3['where']=_[_0x43af('0x35')](_0x3c68d3[_0x43af('0x32')],{'$or':_[_0x43af('0x25')](_0x3c68d3[_0x43af('0x2e')],function(_0xf4b8c5){var _0x4bc44c={};_0x4bc44c[_0xf4b8c5]={'$like':'%'+_0x4e579d[_0x43af('0x2b')][_0x43af('0x34')]+'%'};return _0x4bc44c;})});}_0x3c68d3=_[_0x43af('0x35')]({},_0x3c68d3,_0x4e579d[_0x43af('0x38')]);return _0x23e6e5[_0x43af('0x44')](_0x3c68d3);}})[_0x43af('0x21')](function(_0x3fab5d){if(_0x3fab5d){_0xc6e822=_0x3fab5d[_0x43af('0x3f')];if(!_0x4e579d[_0x43af('0x2b')][_0x43af('0x30')](_0x43af('0x31'))){_0x3c68d3[_0x43af('0x1b')]=qs[_0x43af('0x1b')](_0x4e579d[_0x43af('0x2b')][_0x43af('0x1b')]);_0x3c68d3[_0x43af('0x19')]=qs[_0x43af('0x19')](_0x4e579d['query'][_0x43af('0x19')]);}return _0x23e6e5[_0x43af('0x44')](_0x3c68d3);}})['then'](function(_0x52bb59){if(_0x52bb59){return _0x52bb59?{'count':_0xc6e822,'rows':_0x52bb59}:null;}})['then'](respondWithResult(_0x2511da,null))['catch'](handleError(_0x2511da,null));};exports['addConfiguration']=function(_0x1a3d7b,_0x3ebe23,_0x421ad2){if(_0x1a3d7b[_0x43af('0x43')]['id']){delete _0x1a3d7b[_0x43af('0x43')]['id'];}return db[_0x43af('0x26')][_0x43af('0x45')]({'where':{'id':_0x1a3d7b[_0x43af('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3ebe23,null))[_0x43af('0x21')](function(_0x53e0c4){if(_0x53e0c4){_0x1a3d7b['body']['AccountId']=_0x53e0c4['id'];_0x1a3d7b[_0x43af('0x43')][_0x43af('0x49')]=integrations[_0x43af('0x4a')](_0x1a3d7b[_0x43af('0x43')]['channel'],_0x1a3d7b[_0x43af('0x43')][_0x43af('0x36')]);_0x1a3d7b[_0x43af('0x43')][_0x43af('0x4b')]=integrations[_0x43af('0x4c')](_0x1a3d7b['body']['channel'],_0x1a3d7b[_0x43af('0x43')]['type']);return db['SalesforceConfiguration'][_0x43af('0x42')](_0x1a3d7b[_0x43af('0x43')],{'include':[{'model':db[_0x43af('0x4d')],'as':_0x43af('0x49')},{'model':db['SalesforceField'],'as':_0x43af('0x4b')}]});}return null;})[_0x43af('0x21')](respondWithResult(_0x3ebe23,null))[_0x43af('0x41')](handleError(_0x3ebe23,null));};exports[_0x43af('0x4e')]=function(_0x3fdc7e,_0x248ba6,_0x32c8c5){var _0x2911cd;var _0x42b494='';var _0x2118ff=_0x43af('0x4f');return db[_0x43af('0x26')][_0x43af('0x45')]({'where':{'id':_0x3fdc7e[_0x43af('0x3e')]['id']},'attributes':['id',_0x43af('0x50'),_0x43af('0x51'),_0x43af('0x52'),_0x43af('0x53'),_0x43af('0x54'),_0x43af('0x55')]})[_0x43af('0x21')](handleEntityNotFound(_0x248ba6,null))['then'](function(_0x2d4624){if(_0x2d4624){_0x42b494=_0x2d4624[_0x43af('0x50')];var _0xade8a6=_0x42b494[_0x43af('0x56')](-0x1);if(_0xade8a6==='/'){_0x42b494=_0x42b494[_0x43af('0x57')](0x0,_0x42b494['lastIndexOf'](_0xade8a6));}_0x2911cd=new jsforce['Connection']({'oauth2':{'loginUrl':_0x42b494,'clientId':_0x2d4624[_0x43af('0x51')],'clientSecret':_0x2d4624['clientSecret']}});return _0x2911cd[_0x43af('0x58')](_0x2d4624[_0x43af('0x53')],_0x2d4624[_0x43af('0x54')][_0x43af('0x59')](_0x2d4624[_0x43af('0x55')]));}})[_0x43af('0x21')](function(_0x1b8b22){if(_0x1b8b22){if(!_[_0x43af('0x5a')](_0x3fdc7e[_0x43af('0x2b')]['ticketType'])){_0x2118ff=_0x3fdc7e[_0x43af('0x2b')][_0x43af('0x5b')];}return _0x2911cd[_0x43af('0x5c')](_0x2118ff)['describe']();}})[_0x43af('0x21')](function(_0x1f51f7){var _0x248362=['OwnerId',_0x43af('0x5d'),_0x43af('0x5e'),_0x43af('0x5f'),_0x43af('0x60'),_0x43af('0x61')];var _0x5924dd=['string',_0x43af('0x62'),_0x43af('0x63'),_0x43af('0x64'),_0x43af('0x65'),_0x43af('0x66'),'phone'];if(_0x1f51f7){_['remove'](_0x1f51f7['fields'],function(_0xb80854){return _0x248362[_0x43af('0x67')](_0xb80854['name'])||!_0x5924dd[_0x43af('0x67')](_0xb80854[_0x43af('0x36')]);});return{'count':_0x1f51f7['fields'][_0x43af('0x3f')],'rows':_[_0x43af('0x25')](_0x1f51f7[_0x43af('0x2f')],function(_0x2a5987){return{'id':_0x2a5987[_0x43af('0x23')],'name':_0x2a5987[_0x43af('0x68')],'custom':_0x2a5987['custom'],'options':_0x2a5987[_0x43af('0x69')][_0x43af('0x3f')]>0x0?_['map'](_0x2a5987[_0x43af('0x69')],function(_0x3eb425){return{'name':_0x3eb425[_0x43af('0x68')],'value':_0x3eb425['value']};}):_0x2a5987[_0x43af('0x36')]==_0x43af('0x64')?[{'name':_0x43af('0x6a'),'value':_0x43af('0x6b')},{'name':_0x43af('0x6c'),'value':_0x43af('0x6d')}]:[]};})};}})['then'](respondWithResult(_0x248ba6,null))[_0x43af('0x41')](function(_0x5222cf){var _0x36e13f=_0x3fdc7e[_0x43af('0x2b')][_0x43af('0x6e')]?0x1f4:_0x5222cf[_0x43af('0x6f')]||0x1f4;logger[_0x43af('0x70')]('getFields,\x20%s,\x20%s,\x20%s',_0x43af('0x4e'),_0x36e13f,JSON[_0x43af('0x71')](_0x5222cf));delete _0x5222cf['name'];if(_0x36e13f===0x191){_0x36e13f=0x190;}_0x248ba6[_0x43af('0x16')](_0x36e13f)[_0x43af('0x72')](_0x3fdc7e[_0x43af('0x2b')][_0x43af('0x6e')]?{'message':'Wrong\x20credentials','statusCode':_0x5222cf[_0x43af('0x6f')]}:_0x5222cf);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index b87ec42..3e6c8f7 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 _0xa74e=['moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','int_salesforce_accounts','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa74e,0x8d));var _0xea74=function(_0x4eec9d,_0xb53313){_0x4eec9d=_0x4eec9d-0x0;var _0x2c261b=_0xa74e[_0x4eec9d];return _0x2c261b;};'use strict';var _=require(_0xea74('0x0'));var util=require(_0xea74('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xea74('0x2'));var BPromise=require(_0xea74('0x3'));var rp=require(_0xea74('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea74('0x5'));var config=require(_0xea74('0x6'));var attributes=require(_0xea74('0x7'));var integrations=require(_0xea74('0x8'));module['exports']=function(_0x405221,_0x2295a7){return _0x405221[_0xea74('0x9')]('SalesforceAccount',attributes,{'tableName':_0xea74('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x091c=['SalesforceAccount','int_salesforce_accounts','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','exports'];(function(_0x223f00,_0x2cc572){var _0x42cec7=function(_0x51128d){while(--_0x51128d){_0x223f00['push'](_0x223f00['shift']());}};_0x42cec7(++_0x2cc572);}(_0x091c,0x1af));var _0xc091=function(_0x2ca515,_0x2f0654){_0x2ca515=_0x2ca515-0x0;var _0x2f7701=_0x091c[_0x2ca515];return _0x2f7701;};'use strict';var _=require('lodash');var util=require(_0xc091('0x0'));var logger=require(_0xc091('0x1'))('api');var moment=require(_0xc091('0x2'));var BPromise=require(_0xc091('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc091('0x4'));var rimraf=require(_0xc091('0x5'));var config=require(_0xc091('0x6'));var attributes=require(_0xc091('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xc091('0x8')]=function(_0x112283,_0x124358){return _0x112283['define'](_0xc091('0x9'),attributes,{'tableName':_0xc091('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index a4f3183..310771b 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 _0xa473=['debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','limit','include','map','model','attributes','then','info','ShowSalesforceAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','SalesforceAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa473,0x89));var _0x3a47=function(_0x60f45e,_0x22b50b){_0x60f45e=_0x60f45e-0x0;var _0x1e5209=_0xa473[_0x60f45e];return _0x1e5209;};'use strict';var _=require(_0x3a47('0x0'));var util=require(_0x3a47('0x1'));var moment=require(_0x3a47('0x2'));var BPromise=require(_0x3a47('0x3'));var rs=require(_0x3a47('0x4'));var fs=require('fs');var Redis=require(_0x3a47('0x5'));var db=require(_0x3a47('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3a47('0x7'))(_0x3a47('0x8'));var config=require(_0x3a47('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3a47('0xa')][_0x3a47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57deeb,_0x4a3300,_0x4e8a87){return new BPromise(function(_0x5b698c,_0x50a4d3){return client[_0x3a47('0xc')](_0x57deeb,_0x4e8a87)['then'](function(_0x514578){logger['info'](_0x3a47('0xd'),_0x4a3300,_0x3a47('0xe'));logger[_0x3a47('0xf')](_0x3a47('0x10'),_0x4a3300,'request\x20sent',JSON[_0x3a47('0x11')](_0x514578));if(_0x514578['error']){if(_0x514578['error'][_0x3a47('0x12')]===0x1f4){logger['error'](_0x3a47('0xd'),_0x4a3300,_0x514578[_0x3a47('0x13')][_0x3a47('0x14')]);return _0x50a4d3(_0x514578[_0x3a47('0x13')][_0x3a47('0x14')]);}logger[_0x3a47('0x13')](_0x3a47('0xd'),_0x4a3300,_0x514578[_0x3a47('0x13')][_0x3a47('0x14')]);return _0x5b698c(_0x514578[_0x3a47('0x13')][_0x3a47('0x14')]);}else{logger['info'](_0x3a47('0xd'),_0x4a3300,_0x3a47('0xe'));_0x5b698c(_0x514578[_0x3a47('0x15')][_0x3a47('0x14')]);}})[_0x3a47('0x16')](function(_0x104374){logger[_0x3a47('0x13')](_0x3a47('0xd'),_0x4a3300,_0x104374);_0x50a4d3(_0x104374);});});}exports[_0x3a47('0x17')]=function(_0x44ec4d){var _0x397474=this;return new Promise(function(_0x2a4158,_0x1f6688){return db[_0x3a47('0x18')][_0x3a47('0x19')]({'raw':_0x44ec4d[_0x3a47('0x1a')]?_0x44ec4d[_0x3a47('0x1a')][_0x3a47('0x1b')]===undefined?!![]:![]:!![],'where':_0x44ec4d[_0x3a47('0x1a')]?_0x44ec4d[_0x3a47('0x1a')][_0x3a47('0x1c')]||null:null,'attributes':_0x44ec4d[_0x3a47('0x1a')]?_0x44ec4d['options']['attributes']||null:null,'limit':_0x44ec4d[_0x3a47('0x1a')]?_0x44ec4d['options'][_0x3a47('0x1d')]||null:null,'include':_0x44ec4d[_0x3a47('0x1a')]?_0x44ec4d[_0x3a47('0x1a')][_0x3a47('0x1e')]?_[_0x3a47('0x1f')](_0x44ec4d[_0x3a47('0x1a')][_0x3a47('0x1e')],function(_0x92e98a){return{'model':db[_0x92e98a[_0x3a47('0x20')]],'as':_0x92e98a['as'],'attributes':_0x92e98a[_0x3a47('0x21')],'include':_0x92e98a[_0x3a47('0x1e')]?_['map'](_0x92e98a['include'],function(_0x524d19){return{'model':db[_0x524d19[_0x3a47('0x20')]],'as':_0x524d19['as'],'attributes':_0x524d19['attributes'],'include':_0x524d19[_0x3a47('0x1e')]?_[_0x3a47('0x1f')](_0x524d19[_0x3a47('0x1e')],function(_0x370ce2){return{'model':db[_0x370ce2[_0x3a47('0x20')]],'as':_0x370ce2['as'],'attributes':_0x370ce2[_0x3a47('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3a47('0x22')](function(_0x58f514){logger[_0x3a47('0x23')]('GetSalesforceAccount',_0x44ec4d);logger[_0x3a47('0xf')](_0x3a47('0x17'),_0x44ec4d,JSON[_0x3a47('0x11')](_0x58f514));_0x2a4158(_0x58f514);})['catch'](function(_0x123a04){logger[_0x3a47('0x13')](_0x3a47('0x17'),_0x123a04[_0x3a47('0x14')],_0x44ec4d);_0x1f6688(_0x397474[_0x3a47('0x13')](0x1f4,_0x123a04[_0x3a47('0x14')]));});});};exports[_0x3a47('0x24')]=function(_0x29d12d){var _0x169e45=this;return new Promise(function(_0x28f5e0,_0x45313d){return db[_0x3a47('0x18')][_0x3a47('0x25')]({'raw':_0x29d12d['options']?_0x29d12d[_0x3a47('0x1a')][_0x3a47('0x1b')]===undefined?!![]:![]:!![],'where':_0x29d12d[_0x3a47('0x1a')]?_0x29d12d['options']['where']||null:null,'attributes':_0x29d12d[_0x3a47('0x1a')]?_0x29d12d[_0x3a47('0x1a')][_0x3a47('0x21')]||null:null,'include':_0x29d12d[_0x3a47('0x1a')]?_0x29d12d['options'][_0x3a47('0x1e')]?_[_0x3a47('0x1f')](_0x29d12d['options'][_0x3a47('0x1e')],function(_0x2e9d63){return{'model':db[_0x2e9d63[_0x3a47('0x20')]],'as':_0x2e9d63['as'],'attributes':_0x2e9d63['attributes'],'include':_0x2e9d63[_0x3a47('0x1e')]?_[_0x3a47('0x1f')](_0x2e9d63[_0x3a47('0x1e')],function(_0x47232f){return{'model':db[_0x47232f[_0x3a47('0x20')]],'as':_0x47232f['as'],'attributes':_0x47232f[_0x3a47('0x21')],'include':_0x47232f[_0x3a47('0x1e')]?_[_0x3a47('0x1f')](_0x47232f[_0x3a47('0x1e')],function(_0x8da0f3){return{'model':db[_0x8da0f3[_0x3a47('0x20')]],'as':_0x8da0f3['as'],'attributes':_0x8da0f3[_0x3a47('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xcc8f16){logger['info'](_0x3a47('0x24'),_0x29d12d);logger['debug']('ShowSalesforceAccount',_0x29d12d,JSON[_0x3a47('0x11')](_0xcc8f16));_0x28f5e0(_0xcc8f16);})[_0x3a47('0x16')](function(_0x576d6d){logger[_0x3a47('0x13')](_0x3a47('0x24'),_0x576d6d[_0x3a47('0x14')],_0x29d12d);_0x45313d(_0x169e45[_0x3a47('0x13')](0x1f4,_0x576d6d[_0x3a47('0x14')]));});});}; \ No newline at end of file +var _0xbaab=['request\x20sent','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount','findAll','options','raw','where','attributes','limit','include','model','map','debug','stringify','SalesforceAccount','find','ShowSalesforceAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x32cc4d,_0x3c5d5f){var _0x42e52d=function(_0x4c2383){while(--_0x4c2383){_0x32cc4d['push'](_0x32cc4d['shift']());}};_0x42e52d(++_0x3c5d5f);}(_0xbaab,0x1b8));var _0xbbaa=function(_0x1fca34,_0x1555ea){_0x1fca34=_0x1fca34-0x0;var _0x51f99f=_0xbaab[_0x1fca34];return _0x51f99f;};'use strict';var _=require(_0xbbaa('0x0'));var util=require(_0xbbaa('0x1'));var moment=require(_0xbbaa('0x2'));var BPromise=require(_0xbbaa('0x3'));var rs=require(_0xbbaa('0x4'));var fs=require('fs');var Redis=require(_0xbbaa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbbaa('0x6'));var logger=require(_0xbbaa('0x7'))(_0xbbaa('0x8'));var config=require(_0xbbaa('0x9'));var jayson=require(_0xbbaa('0xa'));var client=jayson[_0xbbaa('0xb')][_0xbbaa('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x315038,_0x3c6e50,_0x4bb1b5){return new BPromise(function(_0x522c6a,_0x4d0015){return client[_0xbbaa('0xd')](_0x315038,_0x4bb1b5)[_0xbbaa('0xe')](function(_0xa03820){logger[_0xbbaa('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x3c6e50,'request\x20sent');logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x3c6e50,_0xbbaa('0x10'),JSON['stringify'](_0xa03820));if(_0xa03820[_0xbbaa('0x11')]){if(_0xa03820[_0xbbaa('0x11')][_0xbbaa('0x12')]===0x1f4){logger[_0xbbaa('0x11')](_0xbbaa('0x13'),_0x3c6e50,_0xa03820[_0xbbaa('0x11')][_0xbbaa('0x14')]);return _0x4d0015(_0xa03820[_0xbbaa('0x11')]['message']);}logger['error'](_0xbbaa('0x13'),_0x3c6e50,_0xa03820[_0xbbaa('0x11')][_0xbbaa('0x14')]);return _0x522c6a(_0xa03820[_0xbbaa('0x11')][_0xbbaa('0x14')]);}else{logger[_0xbbaa('0xf')](_0xbbaa('0x13'),_0x3c6e50,_0xbbaa('0x10'));_0x522c6a(_0xa03820[_0xbbaa('0x15')]['message']);}})[_0xbbaa('0x16')](function(_0x321ef1){logger[_0xbbaa('0x11')](_0xbbaa('0x13'),_0x3c6e50,_0x321ef1);_0x4d0015(_0x321ef1);});});}exports[_0xbbaa('0x17')]=function(_0x3abe72){var _0xc69ade=this;return new Promise(function(_0x4f9928,_0x22d284){return db['SalesforceAccount'][_0xbbaa('0x18')]({'raw':_0x3abe72[_0xbbaa('0x19')]?_0x3abe72[_0xbbaa('0x19')][_0xbbaa('0x1a')]===undefined?!![]:![]:!![],'where':_0x3abe72[_0xbbaa('0x19')]?_0x3abe72[_0xbbaa('0x19')][_0xbbaa('0x1b')]||null:null,'attributes':_0x3abe72[_0xbbaa('0x19')]?_0x3abe72[_0xbbaa('0x19')][_0xbbaa('0x1c')]||null:null,'limit':_0x3abe72[_0xbbaa('0x19')]?_0x3abe72['options'][_0xbbaa('0x1d')]||null:null,'include':_0x3abe72[_0xbbaa('0x19')]?_0x3abe72[_0xbbaa('0x19')][_0xbbaa('0x1e')]?_['map'](_0x3abe72[_0xbbaa('0x19')]['include'],function(_0x320539){return{'model':db[_0x320539[_0xbbaa('0x1f')]],'as':_0x320539['as'],'attributes':_0x320539['attributes'],'include':_0x320539[_0xbbaa('0x1e')]?_['map'](_0x320539[_0xbbaa('0x1e')],function(_0x18b21a){return{'model':db[_0x18b21a[_0xbbaa('0x1f')]],'as':_0x18b21a['as'],'attributes':_0x18b21a[_0xbbaa('0x1c')],'include':_0x18b21a[_0xbbaa('0x1e')]?_[_0xbbaa('0x20')](_0x18b21a[_0xbbaa('0x1e')],function(_0x45a1fd){return{'model':db[_0x45a1fd['model']],'as':_0x45a1fd['as'],'attributes':_0x45a1fd['attributes']};}):[]};}):[]};}):[]:[]})[_0xbbaa('0xe')](function(_0x42ed18){logger[_0xbbaa('0xf')](_0xbbaa('0x17'),_0x3abe72);logger[_0xbbaa('0x21')](_0xbbaa('0x17'),_0x3abe72,JSON[_0xbbaa('0x22')](_0x42ed18));_0x4f9928(_0x42ed18);})[_0xbbaa('0x16')](function(_0x243c98){logger[_0xbbaa('0x11')](_0xbbaa('0x17'),_0x243c98[_0xbbaa('0x14')],_0x3abe72);_0x22d284(_0xc69ade[_0xbbaa('0x11')](0x1f4,_0x243c98[_0xbbaa('0x14')]));});});};exports['ShowSalesforceAccount']=function(_0x5e9aaf){var _0x5b59ad=this;return new Promise(function(_0x5d6726,_0x2fc971){return db[_0xbbaa('0x23')][_0xbbaa('0x24')]({'raw':_0x5e9aaf[_0xbbaa('0x19')]?_0x5e9aaf[_0xbbaa('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5e9aaf['options']?_0x5e9aaf[_0xbbaa('0x19')][_0xbbaa('0x1b')]||null:null,'attributes':_0x5e9aaf['options']?_0x5e9aaf['options'][_0xbbaa('0x1c')]||null:null,'include':_0x5e9aaf['options']?_0x5e9aaf['options'][_0xbbaa('0x1e')]?_[_0xbbaa('0x20')](_0x5e9aaf['options'][_0xbbaa('0x1e')],function(_0x1273bc){return{'model':db[_0x1273bc[_0xbbaa('0x1f')]],'as':_0x1273bc['as'],'attributes':_0x1273bc['attributes'],'include':_0x1273bc[_0xbbaa('0x1e')]?_[_0xbbaa('0x20')](_0x1273bc[_0xbbaa('0x1e')],function(_0x3d968b){return{'model':db[_0x3d968b[_0xbbaa('0x1f')]],'as':_0x3d968b['as'],'attributes':_0x3d968b[_0xbbaa('0x1c')],'include':_0x3d968b['include']?_['map'](_0x3d968b['include'],function(_0x169090){return{'model':db[_0x169090['model']],'as':_0x169090['as'],'attributes':_0x169090[_0xbbaa('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbbaa('0xe')](function(_0x20717c){logger['info'](_0xbbaa('0x25'),_0x5e9aaf);logger[_0xbbaa('0x21')](_0xbbaa('0x25'),_0x5e9aaf,JSON[_0xbbaa('0x22')](_0x20717c));_0x5d6726(_0x20717c);})[_0xbbaa('0x16')](function(_0x557dee){logger[_0xbbaa('0x11')](_0xbbaa('0x25'),_0x557dee[_0xbbaa('0x14')],_0x5e9aaf);_0x2fc971(_0x5b59ad['error'](0x1f4,_0x557dee[_0xbbaa('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 02f82d9..5030a29 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 _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x561996,_0x23faaa){var _0x74926c=function(_0x296894){while(--_0x296894){_0x561996['push'](_0x561996['shift']());}};_0x74926c(++_0x23faaa);}(_0x7a54,0x106));var _0x47a5=function(_0x411ae8,_0x42738f){_0x411ae8=_0x411ae8-0x0;var _0x42ec8b=_0x7a54[_0x411ae8];return _0x42ec8b;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file +var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x14a0a0,_0x45d0cf){var _0x56b651=function(_0x1fae09){while(--_0x1fae09){_0x14a0a0['push'](_0x14a0a0['shift']());}};_0x56b651(++_0x45d0cf);}(_0x0b0e,0x187));var _0xe0b0=function(_0xc55d64,_0x133f2d){_0xc55d64=_0xc55d64-0x0;var _0x4194f6=_0x0b0e[_0xc55d64];return _0x4194f6;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index c8fe76c..e5863dd 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 _0x8754=['Case','contact_lead','contact','account_contact_lead','account','nothing','lead','sequelize','exports','STRING','ENUM','Task'];(function(_0x3b27a2,_0x26be85){var _0x4d0878=function(_0x39925b){while(--_0x39925b){_0x3b27a2['push'](_0x3b27a2['shift']());}};_0x4d0878(++_0x26be85);}(_0x8754,0xf7));var _0x4875=function(_0x5ec4be,_0x590f56){_0x5ec4be=_0x5ec4be-0x0;var _0x445547=_0x8754[_0x5ec4be];return _0x445547;};'use strict';var Sequelize=require(_0x4875('0x0'));module[_0x4875('0x1')]={'name':{'type':Sequelize[_0x4875('0x2')]},'description':{'type':Sequelize[_0x4875('0x2')]},'ticketType':{'type':Sequelize[_0x4875('0x3')](_0x4875('0x4'),_0x4875('0x5')),'defaultValue':_0x4875('0x4')},'moduleSearch':{'type':Sequelize[_0x4875('0x3')](_0x4875('0x6'),_0x4875('0x7'),'lead',_0x4875('0x8'),_0x4875('0x9')),'defaultValue':_0x4875('0x6')},'moduleCreate':{'type':Sequelize['ENUM'](_0x4875('0xa'),_0x4875('0x7'),_0x4875('0xb'),_0x4875('0x9')),'defaultValue':_0x4875('0xb')},'leadId':{'type':Sequelize[_0x4875('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x4875('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x4875('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x4875('0x2')]}}; \ No newline at end of file +var _0x3f43=['Task','contact_lead','lead','account','nothing','contact','sequelize','exports','STRING','ENUM'];(function(_0x1b6bd0,_0xdd57c3){var _0x34950c=function(_0x49bcb3){while(--_0x49bcb3){_0x1b6bd0['push'](_0x1b6bd0['shift']());}};_0x34950c(++_0xdd57c3);}(_0x3f43,0x1e6));var _0x33f4=function(_0x539093,_0x58d2f8){_0x539093=_0x539093-0x0;var _0x2b5e49=_0x3f43[_0x539093];return _0x2b5e49;};'use strict';var Sequelize=require(_0x33f4('0x0'));module[_0x33f4('0x1')]={'name':{'type':Sequelize[_0x33f4('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x33f4('0x3')](_0x33f4('0x4'),'Case'),'defaultValue':_0x33f4('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x33f4('0x5'),'contact',_0x33f4('0x6'),'account_contact_lead',_0x33f4('0x7')),'defaultValue':_0x33f4('0x5')},'moduleCreate':{'type':Sequelize['ENUM'](_0x33f4('0x8'),_0x33f4('0x9'),_0x33f4('0x6'),_0x33f4('0x7')),'defaultValue':_0x33f4('0x6')},'leadId':{'type':Sequelize[_0x33f4('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x33f4('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x33f4('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x33f4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 14ed2a4..9977e4a 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 _0xa24e=['querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','then','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','include','SalesforceConfiguration','findAll','rows','catch','show','params','includeAll','find','create','body','update','destroy','getFields','findOne','SalesforceField','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa24e,0x137));var _0xea24=function(_0xfba42,_0x2df074){_0xfba42=_0xfba42-0x0;var _0x245842=_0xa24e[_0xfba42];return _0x245842;};'use strict';var emlformat=require(_0xea24('0x0'));var rimraf=require(_0xea24('0x1'));var zipdir=require(_0xea24('0x2'));var jsonpatch=require(_0xea24('0x3'));var rp=require(_0xea24('0x4'));var moment=require(_0xea24('0x5'));var BPromise=require(_0xea24('0x6'));var Mustache=require(_0xea24('0x7'));var util=require(_0xea24('0x8'));var path=require('path');var sox=require(_0xea24('0x9'));var csv=require(_0xea24('0xa'));var ejs=require(_0xea24('0xb'));var fs=require('fs');var fs_extra=require(_0xea24('0xc'));var _=require(_0xea24('0xd'));var squel=require('squel');var crypto=require(_0xea24('0xe'));var jsforce=require(_0xea24('0xf'));var deskjs=require(_0xea24('0x10'));var toCsv=require(_0xea24('0xa'));var querystring=require(_0xea24('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xea24('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xea24('0x13'));var hardwareService=require(_0xea24('0x14'));var logger=require(_0xea24('0x15'))(_0xea24('0x16'));var utils=require('../../config/utils');var config=require(_0xea24('0x17'));var licenseUtil=require(_0xea24('0x18'));var db=require(_0xea24('0x19'))['db'];function respondWithStatusCode(_0x49af95,_0x2e7fc5){_0x2e7fc5=_0x2e7fc5||0xcc;return function(_0x1691a0){if(_0x1691a0){return _0x49af95[_0xea24('0x1a')](_0x2e7fc5);}return _0x49af95['status'](_0x2e7fc5)[_0xea24('0x1b')]();};}function respondWithResult(_0x51081a,_0x10b0f4){_0x10b0f4=_0x10b0f4||0xc8;return function(_0x40c878){if(_0x40c878){return _0x51081a['status'](_0x10b0f4)['json'](_0x40c878);}};}function respondWithFilteredResult(_0x31f775,_0x5baa30){return function(_0x31d222){if(_0x31d222){var _0x641291=typeof _0x5baa30[_0xea24('0x1c')]===_0xea24('0x1d')&&typeof _0x5baa30[_0xea24('0x1e')]===_0xea24('0x1d');var _0x58fd4f=_0x31d222[_0xea24('0x1f')];var _0x1eed0c=_0x641291?0x0:_0x5baa30[_0xea24('0x1c')];var _0x50dbcf=_0x641291?_0x31d222['count']:_0x5baa30[_0xea24('0x1c')]+_0x5baa30['limit'];var _0x5be60c;if(_0x50dbcf>=_0x58fd4f){_0x50dbcf=_0x58fd4f;_0x5be60c=0xc8;}else{_0x5be60c=0xce;}_0x31f775[_0xea24('0x20')](_0x5be60c);return _0x31f775[_0xea24('0x21')](_0xea24('0x22'),_0x1eed0c+'-'+_0x50dbcf+'/'+_0x58fd4f)['json'](_0x31d222);}return null;};}function patchUpdates(_0x4f7896){return function(_0x53ef15){try{jsonpatch[_0xea24('0x23')](_0x53ef15,_0x4f7896,!![]);}catch(_0x5c59d0){return BPromise[_0xea24('0x24')](_0x5c59d0);}return _0x53ef15[_0xea24('0x25')]();};}function saveUpdates(_0x3ec628,_0x11fa74){return function(_0x568b3d){if(_0x568b3d){return _0x568b3d['update'](_0x3ec628)[_0xea24('0x26')](function(_0x447e0e){return _0x447e0e;});}return null;};}function removeEntity(_0x1476f6,_0x51e361){return function(_0x24bc50){if(_0x24bc50){return _0x24bc50['destroy']()[_0xea24('0x26')](function(){_0x1476f6[_0xea24('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4617cf,_0x137385){return function(_0x35309c){if(!_0x35309c){_0x4617cf[_0xea24('0x1a')](0x194);}return _0x35309c;};}function handleError(_0x180b53,_0x5650fc){_0x5650fc=_0x5650fc||0x1f4;return function(_0x3ba1cb){logger[_0xea24('0x27')](_0x3ba1cb[_0xea24('0x28')]);if(_0x3ba1cb[_0xea24('0x29')]){delete _0x3ba1cb[_0xea24('0x29')];}_0x180b53['status'](_0x5650fc)['send'](_0x3ba1cb);};}exports['index']=function(_0x14f5fd,_0x162688){var _0x29d60b={},_0x2e8552={},_0x182fae={'count':0x0,'rows':[]};var _0x54a3f3=_[_0xea24('0x2a')](db['SalesforceConfiguration'][_0xea24('0x2b')],function(_0x1e8803){return{'name':_0x1e8803[_0xea24('0x2c')],'type':_0x1e8803[_0xea24('0x2d')][_0xea24('0x2e')]};});_0x2e8552[_0xea24('0x2f')]=_[_0xea24('0x2a')](_0x54a3f3,_0xea24('0x29'));_0x2e8552[_0xea24('0x30')]=_[_0xea24('0x31')](_0x14f5fd[_0xea24('0x30')]);_0x2e8552['filters']=_[_0xea24('0x32')](_0x2e8552['model'],_0x2e8552[_0xea24('0x30')]);_0x29d60b['attributes']=_[_0xea24('0x32')](_0x2e8552[_0xea24('0x2f')],qs[_0xea24('0x33')](_0x14f5fd[_0xea24('0x30')]['fields']));_0x29d60b[_0xea24('0x34')]=_0x29d60b[_0xea24('0x34')][_0xea24('0x35')]?_0x29d60b[_0xea24('0x34')]:_0x2e8552[_0xea24('0x2f')];if(!_0x14f5fd[_0xea24('0x30')][_0xea24('0x36')]('nolimit')){_0x29d60b[_0xea24('0x1e')]=qs['limit'](_0x14f5fd[_0xea24('0x30')][_0xea24('0x1e')]);_0x29d60b['offset']=qs[_0xea24('0x1c')](_0x14f5fd[_0xea24('0x30')][_0xea24('0x1c')]);}_0x29d60b[_0xea24('0x37')]=qs['sort'](_0x14f5fd[_0xea24('0x30')][_0xea24('0x38')]);_0x29d60b[_0xea24('0x39')]=qs[_0xea24('0x3a')](_[_0xea24('0x3b')](_0x14f5fd[_0xea24('0x30')],_0x2e8552[_0xea24('0x3a')]),_0x54a3f3);if(_0x14f5fd[_0xea24('0x30')][_0xea24('0x3c')]){_0x29d60b[_0xea24('0x39')]=_[_0xea24('0x3d')](_0x29d60b[_0xea24('0x39')],{'$or':_[_0xea24('0x2a')](_0x54a3f3,function(_0x34560a){if(_0x34560a[_0xea24('0x2d')]!=='VIRTUAL'){var _0x478e4c={};_0x478e4c[_0x34560a[_0xea24('0x29')]]={'$like':'%'+_0x14f5fd[_0xea24('0x30')][_0xea24('0x3c')]+'%'};return _0x478e4c;}})});}_0x29d60b=_['merge']({},_0x29d60b,_0x14f5fd[_0xea24('0x3e')]);var _0xdecd6e={'where':_0x29d60b['where']};return db['SalesforceConfiguration']['count'](_0xdecd6e)[_0xea24('0x26')](function(_0xbc47a1){_0x182fae['count']=_0xbc47a1;if(_0x14f5fd[_0xea24('0x30')]['includeAll']){_0x29d60b[_0xea24('0x3f')]=[{'all':!![]}];}return db[_0xea24('0x40')][_0xea24('0x41')](_0x29d60b);})[_0xea24('0x26')](function(_0x6eb18b){_0x182fae[_0xea24('0x42')]=_0x6eb18b;return _0x182fae;})['then'](respondWithFilteredResult(_0x162688,_0x29d60b))[_0xea24('0x43')](handleError(_0x162688,null));};exports[_0xea24('0x44')]=function(_0x314531,_0x6add52){var _0x3ace02={'raw':![],'where':{'id':_0x314531[_0xea24('0x45')]['id']}},_0x8bf93d={};_0x8bf93d[_0xea24('0x2f')]=_[_0xea24('0x31')](db[_0xea24('0x40')][_0xea24('0x2b')]);_0x8bf93d[_0xea24('0x30')]=_[_0xea24('0x31')](_0x314531[_0xea24('0x30')]);_0x8bf93d[_0xea24('0x3a')]=_[_0xea24('0x32')](_0x8bf93d[_0xea24('0x2f')],_0x8bf93d[_0xea24('0x30')]);_0x3ace02['attributes']=_[_0xea24('0x32')](_0x8bf93d[_0xea24('0x2f')],qs['fields'](_0x314531[_0xea24('0x30')][_0xea24('0x33')]));_0x3ace02['attributes']=_0x3ace02[_0xea24('0x34')][_0xea24('0x35')]?_0x3ace02[_0xea24('0x34')]:_0x8bf93d[_0xea24('0x2f')];if(_0x314531[_0xea24('0x30')][_0xea24('0x46')]){_0x3ace02[_0xea24('0x3f')]=[{'all':!![]}];}_0x3ace02=_[_0xea24('0x3d')]({},_0x3ace02,_0x314531['options']);return db[_0xea24('0x40')][_0xea24('0x47')](_0x3ace02)[_0xea24('0x26')](handleEntityNotFound(_0x6add52,null))['then'](respondWithResult(_0x6add52,null))[_0xea24('0x43')](handleError(_0x6add52,null));};exports['create']=function(_0x2e1141,_0x281465){return db[_0xea24('0x40')][_0xea24('0x48')](_0x2e1141[_0xea24('0x49')],{})[_0xea24('0x26')](respondWithResult(_0x281465,0xc9))['catch'](handleError(_0x281465,null));};exports[_0xea24('0x4a')]=function(_0x4f756b,_0x10c6fa){if(_0x4f756b[_0xea24('0x49')]['id']){delete _0x4f756b[_0xea24('0x49')]['id'];}return db['SalesforceConfiguration'][_0xea24('0x47')]({'where':{'id':_0x4f756b[_0xea24('0x45')]['id']}})[_0xea24('0x26')](handleEntityNotFound(_0x10c6fa,null))['then'](saveUpdates(_0x4f756b[_0xea24('0x49')],null))[_0xea24('0x26')](respondWithResult(_0x10c6fa,null))[_0xea24('0x43')](handleError(_0x10c6fa,null));};exports[_0xea24('0x4b')]=function(_0xab4a44,_0x1925fc){return db[_0xea24('0x40')][_0xea24('0x47')]({'where':{'id':_0xab4a44[_0xea24('0x45')]['id']}})[_0xea24('0x26')](handleEntityNotFound(_0x1925fc,null))[_0xea24('0x26')](removeEntity(_0x1925fc,null))['catch'](handleError(_0x1925fc,null));};exports[_0xea24('0x4c')]=function(_0x498e88,_0xc37720,_0x147919){var _0x3b1f56={};var _0x401a9d={};var _0x1fe63b;var _0x3c2eca;return db['SalesforceConfiguration'][_0xea24('0x4d')]({'where':{'id':_0x498e88['params']['id']}})[_0xea24('0x26')](handleEntityNotFound(_0xc37720,null))[_0xea24('0x26')](function(_0x268575){if(_0x268575){_0x1fe63b=_0x268575;_0x401a9d[_0xea24('0x2f')]=_[_0xea24('0x31')](db[_0xea24('0x4e')][_0xea24('0x2b')]);_0x401a9d['query']=_[_0xea24('0x31')](_0x498e88['query']);_0x401a9d[_0xea24('0x3a')]=_[_0xea24('0x32')](_0x401a9d[_0xea24('0x2f')],_0x401a9d[_0xea24('0x30')]);_0x3b1f56[_0xea24('0x34')]=_['intersection'](_0x401a9d['model'],qs['fields'](_0x498e88['query'][_0xea24('0x33')]));_0x3b1f56['attributes']=_0x3b1f56[_0xea24('0x34')]['length']?_0x3b1f56[_0xea24('0x34')]:_0x401a9d[_0xea24('0x2f')];_0x3b1f56[_0xea24('0x37')]=qs['sort'](_0x498e88[_0xea24('0x30')][_0xea24('0x38')]);_0x3b1f56[_0xea24('0x39')]=qs[_0xea24('0x3a')](_[_0xea24('0x3b')](_0x498e88[_0xea24('0x30')],_0x401a9d[_0xea24('0x3a')]));if(_0x498e88[_0xea24('0x30')][_0xea24('0x3c')]){_0x3b1f56[_0xea24('0x39')]=_[_0xea24('0x3d')](_0x3b1f56[_0xea24('0x39')],{'$or':_['map'](_0x3b1f56[_0xea24('0x34')],function(_0x2028be){var _0x276adb={};_0x276adb[_0x2028be]={'$like':'%'+_0x498e88[_0xea24('0x30')][_0xea24('0x3c')]+'%'};return _0x276adb;})});}_0x3b1f56=_[_0xea24('0x3d')]({},_0x3b1f56,_0x498e88['options']);return _0x1fe63b[_0xea24('0x4c')](_0x3b1f56);}})[_0xea24('0x26')](function(_0x45045f){if(_0x45045f){_0x3c2eca=_0x45045f[_0xea24('0x35')];if(!_0x498e88[_0xea24('0x30')][_0xea24('0x36')](_0xea24('0x4f'))){_0x3b1f56[_0xea24('0x1e')]=qs[_0xea24('0x1e')](_0x498e88['query']['limit']);_0x3b1f56['offset']=qs['offset'](_0x498e88[_0xea24('0x30')][_0xea24('0x1c')]);}return _0x1fe63b[_0xea24('0x4c')](_0x3b1f56);}})[_0xea24('0x26')](function(_0x3c0666){if(_0x3c0666){return _0x3c0666?{'count':_0x3c2eca,'rows':_0x3c0666}:null;}})[_0xea24('0x26')](respondWithResult(_0xc37720,null))[_0xea24('0x43')](handleError(_0xc37720,null));};exports[_0xea24('0x50')]=function(_0x138ebf,_0x45cf3a,_0x6bc6ef){var _0xc91ed7={};var _0x32e279={};var _0x506cde;var _0xb1aa1;return db[_0xea24('0x40')][_0xea24('0x4d')]({'where':{'id':_0x138ebf[_0xea24('0x45')]['id']}})[_0xea24('0x26')](handleEntityNotFound(_0x45cf3a,null))[_0xea24('0x26')](function(_0x173ec7){if(_0x173ec7){_0x506cde=_0x173ec7;_0x32e279[_0xea24('0x2f')]=_[_0xea24('0x31')](db[_0xea24('0x4e')]['rawAttributes']);_0x32e279[_0xea24('0x30')]=_[_0xea24('0x31')](_0x138ebf[_0xea24('0x30')]);_0x32e279['filters']=_['intersection'](_0x32e279['model'],_0x32e279[_0xea24('0x30')]);_0xc91ed7[_0xea24('0x34')]=_['intersection'](_0x32e279[_0xea24('0x2f')],qs[_0xea24('0x33')](_0x138ebf[_0xea24('0x30')][_0xea24('0x33')]));_0xc91ed7[_0xea24('0x34')]=_0xc91ed7[_0xea24('0x34')]['length']?_0xc91ed7[_0xea24('0x34')]:_0x32e279[_0xea24('0x2f')];_0xc91ed7[_0xea24('0x37')]=qs[_0xea24('0x38')](_0x138ebf['query'][_0xea24('0x38')]);_0xc91ed7[_0xea24('0x39')]=qs[_0xea24('0x3a')](_[_0xea24('0x3b')](_0x138ebf[_0xea24('0x30')],_0x32e279[_0xea24('0x3a')]));if(_0x138ebf[_0xea24('0x30')][_0xea24('0x3c')]){_0xc91ed7[_0xea24('0x39')]=_['merge'](_0xc91ed7[_0xea24('0x39')],{'$or':_['map'](_0xc91ed7[_0xea24('0x34')],function(_0x1d838e){var _0x391e13={};_0x391e13[_0x1d838e]={'$like':'%'+_0x138ebf[_0xea24('0x30')][_0xea24('0x3c')]+'%'};return _0x391e13;})});}_0xc91ed7=_[_0xea24('0x3d')]({},_0xc91ed7,_0x138ebf[_0xea24('0x3e')]);return _0x506cde['getSubjects'](_0xc91ed7);}})[_0xea24('0x26')](function(_0x86d118){if(_0x86d118){_0xb1aa1=_0x86d118[_0xea24('0x35')];if(!_0x138ebf[_0xea24('0x30')][_0xea24('0x36')](_0xea24('0x4f'))){_0xc91ed7[_0xea24('0x1e')]=qs['limit'](_0x138ebf[_0xea24('0x30')][_0xea24('0x1e')]);_0xc91ed7[_0xea24('0x1c')]=qs['offset'](_0x138ebf[_0xea24('0x30')][_0xea24('0x1c')]);}return _0x506cde[_0xea24('0x50')](_0xc91ed7);}})[_0xea24('0x26')](function(_0x271464){if(_0x271464){return _0x271464?{'count':_0xb1aa1,'rows':_0x271464}:null;}})[_0xea24('0x26')](respondWithResult(_0x45cf3a,null))[_0xea24('0x43')](handleError(_0x45cf3a,null));};exports[_0xea24('0x51')]=function(_0x46c5e2,_0x17f9e0,_0x32178b){var _0x281b41={};var _0x3b06ea={};var _0x20827b;var _0xbadd64;return db[_0xea24('0x40')][_0xea24('0x4d')]({'where':{'id':_0x46c5e2[_0xea24('0x45')]['id']}})[_0xea24('0x26')](handleEntityNotFound(_0x17f9e0,null))['then'](function(_0x3a08ce){if(_0x3a08ce){_0x20827b=_0x3a08ce;_0x3b06ea[_0xea24('0x2f')]=_['keys'](db[_0xea24('0x4e')][_0xea24('0x2b')]);_0x3b06ea[_0xea24('0x30')]=_[_0xea24('0x31')](_0x46c5e2['query']);_0x3b06ea[_0xea24('0x3a')]=_[_0xea24('0x32')](_0x3b06ea[_0xea24('0x2f')],_0x3b06ea[_0xea24('0x30')]);_0x281b41['attributes']=_['intersection'](_0x3b06ea['model'],qs['fields'](_0x46c5e2[_0xea24('0x30')][_0xea24('0x33')]));_0x281b41[_0xea24('0x34')]=_0x281b41[_0xea24('0x34')][_0xea24('0x35')]?_0x281b41[_0xea24('0x34')]:_0x3b06ea[_0xea24('0x2f')];_0x281b41[_0xea24('0x37')]=qs[_0xea24('0x38')](_0x46c5e2[_0xea24('0x30')][_0xea24('0x38')]);_0x281b41['where']=qs['filters'](_[_0xea24('0x3b')](_0x46c5e2[_0xea24('0x30')],_0x3b06ea[_0xea24('0x3a')]));if(_0x46c5e2[_0xea24('0x30')][_0xea24('0x3c')]){_0x281b41[_0xea24('0x39')]=_[_0xea24('0x3d')](_0x281b41[_0xea24('0x39')],{'$or':_[_0xea24('0x2a')](_0x281b41['attributes'],function(_0x2c8c3f){var _0x41196d={};_0x41196d[_0x2c8c3f]={'$like':'%'+_0x46c5e2[_0xea24('0x30')][_0xea24('0x3c')]+'%'};return _0x41196d;})});}_0x281b41=_[_0xea24('0x3d')]({},_0x281b41,_0x46c5e2[_0xea24('0x3e')]);return _0x20827b['getDescriptions'](_0x281b41);}})[_0xea24('0x26')](function(_0x2a2685){if(_0x2a2685){_0xbadd64=_0x2a2685[_0xea24('0x35')];if(!_0x46c5e2['query']['hasOwnProperty'](_0xea24('0x4f'))){_0x281b41[_0xea24('0x1e')]=qs[_0xea24('0x1e')](_0x46c5e2[_0xea24('0x30')]['limit']);_0x281b41[_0xea24('0x1c')]=qs[_0xea24('0x1c')](_0x46c5e2[_0xea24('0x30')][_0xea24('0x1c')]);}return _0x20827b[_0xea24('0x51')](_0x281b41);}})[_0xea24('0x26')](function(_0x3a6d27){if(_0x3a6d27){return _0x3a6d27?{'count':_0xbadd64,'rows':_0x3a6d27}:null;}})['then'](respondWithResult(_0x17f9e0,null))[_0xea24('0x43')](handleError(_0x17f9e0,null));}; \ No newline at end of file +var _0x5f2b=['reject','save','update','destroy','then','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','keys','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','findAll','rows','catch','params','intersection','includeAll','include','options','find','body','getFields','findOne','getSubjects','SalesforceField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply'];(function(_0x2e488e,_0x50b586){var _0x2b0900=function(_0x2b7990){while(--_0x2b7990){_0x2e488e['push'](_0x2e488e['shift']());}};_0x2b0900(++_0x50b586);}(_0x5f2b,0x17a));var _0xb5f2=function(_0x5b0a7d,_0x4ef6cf){_0x5b0a7d=_0x5b0a7d-0x0;var _0x11b32f=_0x5f2b[_0x5b0a7d];return _0x11b32f;};'use strict';var emlformat=require(_0xb5f2('0x0'));var rimraf=require(_0xb5f2('0x1'));var zipdir=require(_0xb5f2('0x2'));var jsonpatch=require(_0xb5f2('0x3'));var rp=require(_0xb5f2('0x4'));var moment=require('moment');var BPromise=require(_0xb5f2('0x5'));var Mustache=require(_0xb5f2('0x6'));var util=require(_0xb5f2('0x7'));var path=require(_0xb5f2('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb5f2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb5f2('0xa'));var squel=require(_0xb5f2('0xb'));var crypto=require(_0xb5f2('0xc'));var jsforce=require(_0xb5f2('0xd'));var deskjs=require(_0xb5f2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb5f2('0xf'));var Papa=require(_0xb5f2('0x10'));var Redis=require(_0xb5f2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb5f2('0x12'));var as=require(_0xb5f2('0x13'));var hardwareService=require(_0xb5f2('0x14'));var logger=require(_0xb5f2('0x15'))(_0xb5f2('0x16'));var utils=require(_0xb5f2('0x17'));var config=require(_0xb5f2('0x18'));var licenseUtil=require(_0xb5f2('0x19'));var db=require(_0xb5f2('0x1a'))['db'];function respondWithStatusCode(_0x21671c,_0x5434f8){_0x5434f8=_0x5434f8||0xcc;return function(_0x27d624){if(_0x27d624){return _0x21671c[_0xb5f2('0x1b')](_0x5434f8);}return _0x21671c[_0xb5f2('0x1c')](_0x5434f8)[_0xb5f2('0x1d')]();};}function respondWithResult(_0x2027c1,_0x45b1cd){_0x45b1cd=_0x45b1cd||0xc8;return function(_0x3cd462){if(_0x3cd462){return _0x2027c1[_0xb5f2('0x1c')](_0x45b1cd)[_0xb5f2('0x1e')](_0x3cd462);}};}function respondWithFilteredResult(_0x2b24f0,_0x25a86c){return function(_0x2dc28d){if(_0x2dc28d){var _0x4512d4=typeof _0x25a86c[_0xb5f2('0x1f')]===_0xb5f2('0x20')&&typeof _0x25a86c[_0xb5f2('0x21')]===_0xb5f2('0x20');var _0x2614c8=_0x2dc28d[_0xb5f2('0x22')];var _0x214a43=_0x4512d4?0x0:_0x25a86c[_0xb5f2('0x1f')];var _0x22cf47=_0x4512d4?_0x2dc28d['count']:_0x25a86c[_0xb5f2('0x1f')]+_0x25a86c['limit'];var _0x330f08;if(_0x22cf47>=_0x2614c8){_0x22cf47=_0x2614c8;_0x330f08=0xc8;}else{_0x330f08=0xce;}_0x2b24f0[_0xb5f2('0x1c')](_0x330f08);return _0x2b24f0['set'](_0xb5f2('0x23'),_0x214a43+'-'+_0x22cf47+'/'+_0x2614c8)['json'](_0x2dc28d);}return null;};}function patchUpdates(_0x33b501){return function(_0x502837){try{jsonpatch[_0xb5f2('0x24')](_0x502837,_0x33b501,!![]);}catch(_0x56857e){return BPromise[_0xb5f2('0x25')](_0x56857e);}return _0x502837[_0xb5f2('0x26')]();};}function saveUpdates(_0x3d915c,_0x1f03f0){return function(_0x49e300){if(_0x49e300){return _0x49e300[_0xb5f2('0x27')](_0x3d915c)['then'](function(_0x27c374){return _0x27c374;});}return null;};}function removeEntity(_0x276672,_0x96cddd){return function(_0x15dc58){if(_0x15dc58){return _0x15dc58[_0xb5f2('0x28')]()[_0xb5f2('0x29')](function(){_0x276672[_0xb5f2('0x1c')](0xcc)[_0xb5f2('0x1d')]();});}};}function handleEntityNotFound(_0x3dcb22,_0x40e77a){return function(_0x61a533){if(!_0x61a533){_0x3dcb22[_0xb5f2('0x1b')](0x194);}return _0x61a533;};}function handleError(_0x239d17,_0x10e0bb){_0x10e0bb=_0x10e0bb||0x1f4;return function(_0x590863){logger[_0xb5f2('0x2a')](_0x590863[_0xb5f2('0x2b')]);if(_0x590863[_0xb5f2('0x2c')]){delete _0x590863[_0xb5f2('0x2c')];}_0x239d17[_0xb5f2('0x1c')](_0x10e0bb)[_0xb5f2('0x2d')](_0x590863);};}exports[_0xb5f2('0x2e')]=function(_0x242c76,_0x3dd8a6){var _0x58bf1d={},_0x399eef={},_0x437627={'count':0x0,'rows':[]};var _0x17c95c=_[_0xb5f2('0x2f')](db[_0xb5f2('0x30')][_0xb5f2('0x31')],function(_0x351be0){return{'name':_0x351be0[_0xb5f2('0x32')],'type':_0x351be0[_0xb5f2('0x33')][_0xb5f2('0x34')]};});_0x399eef[_0xb5f2('0x35')]=_[_0xb5f2('0x2f')](_0x17c95c,_0xb5f2('0x2c'));_0x399eef['query']=_[_0xb5f2('0x36')](_0x242c76['query']);_0x399eef['filters']=_['intersection'](_0x399eef[_0xb5f2('0x35')],_0x399eef[_0xb5f2('0x37')]);_0x58bf1d['attributes']=_['intersection'](_0x399eef[_0xb5f2('0x35')],qs['fields'](_0x242c76[_0xb5f2('0x37')][_0xb5f2('0x38')]));_0x58bf1d[_0xb5f2('0x39')]=_0x58bf1d['attributes'][_0xb5f2('0x3a')]?_0x58bf1d[_0xb5f2('0x39')]:_0x399eef[_0xb5f2('0x35')];if(!_0x242c76[_0xb5f2('0x37')][_0xb5f2('0x3b')](_0xb5f2('0x3c'))){_0x58bf1d[_0xb5f2('0x21')]=qs['limit'](_0x242c76[_0xb5f2('0x37')][_0xb5f2('0x21')]);_0x58bf1d[_0xb5f2('0x1f')]=qs[_0xb5f2('0x1f')](_0x242c76[_0xb5f2('0x37')][_0xb5f2('0x1f')]);}_0x58bf1d[_0xb5f2('0x3d')]=qs[_0xb5f2('0x3e')](_0x242c76['query'][_0xb5f2('0x3e')]);_0x58bf1d[_0xb5f2('0x3f')]=qs['filters'](_[_0xb5f2('0x40')](_0x242c76[_0xb5f2('0x37')],_0x399eef[_0xb5f2('0x41')]),_0x17c95c);if(_0x242c76[_0xb5f2('0x37')][_0xb5f2('0x42')]){_0x58bf1d['where']=_[_0xb5f2('0x43')](_0x58bf1d[_0xb5f2('0x3f')],{'$or':_['map'](_0x17c95c,function(_0x9196f0){if(_0x9196f0[_0xb5f2('0x33')]!=='VIRTUAL'){var _0x39155e={};_0x39155e[_0x9196f0[_0xb5f2('0x2c')]]={'$like':'%'+_0x242c76[_0xb5f2('0x37')]['filter']+'%'};return _0x39155e;}})});}_0x58bf1d=_['merge']({},_0x58bf1d,_0x242c76['options']);var _0x5171f1={'where':_0x58bf1d['where']};return db[_0xb5f2('0x30')][_0xb5f2('0x22')](_0x5171f1)[_0xb5f2('0x29')](function(_0x401848){_0x437627['count']=_0x401848;if(_0x242c76[_0xb5f2('0x37')]['includeAll']){_0x58bf1d['include']=[{'all':!![]}];}return db[_0xb5f2('0x30')][_0xb5f2('0x44')](_0x58bf1d);})[_0xb5f2('0x29')](function(_0x3bfa88){_0x437627[_0xb5f2('0x45')]=_0x3bfa88;return _0x437627;})['then'](respondWithFilteredResult(_0x3dd8a6,_0x58bf1d))[_0xb5f2('0x46')](handleError(_0x3dd8a6,null));};exports['show']=function(_0x4c3203,_0x298bf5){var _0x51f8f8={'raw':![],'where':{'id':_0x4c3203[_0xb5f2('0x47')]['id']}},_0x2acc6e={};_0x2acc6e[_0xb5f2('0x35')]=_[_0xb5f2('0x36')](db[_0xb5f2('0x30')][_0xb5f2('0x31')]);_0x2acc6e[_0xb5f2('0x37')]=_[_0xb5f2('0x36')](_0x4c3203[_0xb5f2('0x37')]);_0x2acc6e[_0xb5f2('0x41')]=_[_0xb5f2('0x48')](_0x2acc6e[_0xb5f2('0x35')],_0x2acc6e[_0xb5f2('0x37')]);_0x51f8f8['attributes']=_['intersection'](_0x2acc6e['model'],qs[_0xb5f2('0x38')](_0x4c3203['query']['fields']));_0x51f8f8[_0xb5f2('0x39')]=_0x51f8f8['attributes'][_0xb5f2('0x3a')]?_0x51f8f8[_0xb5f2('0x39')]:_0x2acc6e[_0xb5f2('0x35')];if(_0x4c3203[_0xb5f2('0x37')][_0xb5f2('0x49')]){_0x51f8f8[_0xb5f2('0x4a')]=[{'all':!![]}];}_0x51f8f8=_[_0xb5f2('0x43')]({},_0x51f8f8,_0x4c3203[_0xb5f2('0x4b')]);return db[_0xb5f2('0x30')][_0xb5f2('0x4c')](_0x51f8f8)[_0xb5f2('0x29')](handleEntityNotFound(_0x298bf5,null))[_0xb5f2('0x29')](respondWithResult(_0x298bf5,null))[_0xb5f2('0x46')](handleError(_0x298bf5,null));};exports['create']=function(_0x4e3dab,_0x2a5dee){return db['SalesforceConfiguration']['create'](_0x4e3dab[_0xb5f2('0x4d')],{})[_0xb5f2('0x29')](respondWithResult(_0x2a5dee,0xc9))['catch'](handleError(_0x2a5dee,null));};exports[_0xb5f2('0x27')]=function(_0x4046c8,_0x288297){if(_0x4046c8['body']['id']){delete _0x4046c8[_0xb5f2('0x4d')]['id'];}return db[_0xb5f2('0x30')][_0xb5f2('0x4c')]({'where':{'id':_0x4046c8[_0xb5f2('0x47')]['id']}})['then'](handleEntityNotFound(_0x288297,null))[_0xb5f2('0x29')](saveUpdates(_0x4046c8[_0xb5f2('0x4d')],null))['then'](respondWithResult(_0x288297,null))[_0xb5f2('0x46')](handleError(_0x288297,null));};exports[_0xb5f2('0x28')]=function(_0xe7169b,_0x6235ee){return db[_0xb5f2('0x30')][_0xb5f2('0x4c')]({'where':{'id':_0xe7169b[_0xb5f2('0x47')]['id']}})[_0xb5f2('0x29')](handleEntityNotFound(_0x6235ee,null))[_0xb5f2('0x29')](removeEntity(_0x6235ee,null))[_0xb5f2('0x46')](handleError(_0x6235ee,null));};exports[_0xb5f2('0x4e')]=function(_0x50def0,_0x1eac29,_0x1747d5){var _0x408a45={};var _0xe4c1a3={};var _0x8baf74;var _0x3b9caf;return db[_0xb5f2('0x30')][_0xb5f2('0x4f')]({'where':{'id':_0x50def0[_0xb5f2('0x47')]['id']}})[_0xb5f2('0x29')](handleEntityNotFound(_0x1eac29,null))[_0xb5f2('0x29')](function(_0x3c79e4){if(_0x3c79e4){_0x8baf74=_0x3c79e4;_0xe4c1a3[_0xb5f2('0x35')]=_['keys'](db['SalesforceField'][_0xb5f2('0x31')]);_0xe4c1a3['query']=_[_0xb5f2('0x36')](_0x50def0[_0xb5f2('0x37')]);_0xe4c1a3[_0xb5f2('0x41')]=_[_0xb5f2('0x48')](_0xe4c1a3[_0xb5f2('0x35')],_0xe4c1a3['query']);_0x408a45[_0xb5f2('0x39')]=_[_0xb5f2('0x48')](_0xe4c1a3[_0xb5f2('0x35')],qs[_0xb5f2('0x38')](_0x50def0[_0xb5f2('0x37')][_0xb5f2('0x38')]));_0x408a45['attributes']=_0x408a45['attributes'][_0xb5f2('0x3a')]?_0x408a45['attributes']:_0xe4c1a3[_0xb5f2('0x35')];_0x408a45[_0xb5f2('0x3d')]=qs['sort'](_0x50def0[_0xb5f2('0x37')][_0xb5f2('0x3e')]);_0x408a45[_0xb5f2('0x3f')]=qs[_0xb5f2('0x41')](_[_0xb5f2('0x40')](_0x50def0[_0xb5f2('0x37')],_0xe4c1a3['filters']));if(_0x50def0['query'][_0xb5f2('0x42')]){_0x408a45[_0xb5f2('0x3f')]=_['merge'](_0x408a45[_0xb5f2('0x3f')],{'$or':_[_0xb5f2('0x2f')](_0x408a45[_0xb5f2('0x39')],function(_0x1995e2){var _0xcb005e={};_0xcb005e[_0x1995e2]={'$like':'%'+_0x50def0[_0xb5f2('0x37')][_0xb5f2('0x42')]+'%'};return _0xcb005e;})});}_0x408a45=_[_0xb5f2('0x43')]({},_0x408a45,_0x50def0[_0xb5f2('0x4b')]);return _0x8baf74[_0xb5f2('0x4e')](_0x408a45);}})['then'](function(_0x147df4){if(_0x147df4){_0x3b9caf=_0x147df4[_0xb5f2('0x3a')];if(!_0x50def0[_0xb5f2('0x37')][_0xb5f2('0x3b')](_0xb5f2('0x3c'))){_0x408a45['limit']=qs['limit'](_0x50def0[_0xb5f2('0x37')]['limit']);_0x408a45['offset']=qs[_0xb5f2('0x1f')](_0x50def0['query'][_0xb5f2('0x1f')]);}return _0x8baf74[_0xb5f2('0x4e')](_0x408a45);}})[_0xb5f2('0x29')](function(_0x26bf2d){if(_0x26bf2d){return _0x26bf2d?{'count':_0x3b9caf,'rows':_0x26bf2d}:null;}})['then'](respondWithResult(_0x1eac29,null))['catch'](handleError(_0x1eac29,null));};exports[_0xb5f2('0x50')]=function(_0x5d6520,_0x41b96f,_0x54dc54){var _0x299c7c={};var _0x30eb22={};var _0x14613f;var _0x28f6f1;return db[_0xb5f2('0x30')]['findOne']({'where':{'id':_0x5d6520['params']['id']}})[_0xb5f2('0x29')](handleEntityNotFound(_0x41b96f,null))[_0xb5f2('0x29')](function(_0x3a6763){if(_0x3a6763){_0x14613f=_0x3a6763;_0x30eb22[_0xb5f2('0x35')]=_['keys'](db[_0xb5f2('0x51')][_0xb5f2('0x31')]);_0x30eb22['query']=_['keys'](_0x5d6520[_0xb5f2('0x37')]);_0x30eb22['filters']=_[_0xb5f2('0x48')](_0x30eb22[_0xb5f2('0x35')],_0x30eb22[_0xb5f2('0x37')]);_0x299c7c[_0xb5f2('0x39')]=_[_0xb5f2('0x48')](_0x30eb22[_0xb5f2('0x35')],qs[_0xb5f2('0x38')](_0x5d6520[_0xb5f2('0x37')]['fields']));_0x299c7c[_0xb5f2('0x39')]=_0x299c7c[_0xb5f2('0x39')][_0xb5f2('0x3a')]?_0x299c7c[_0xb5f2('0x39')]:_0x30eb22[_0xb5f2('0x35')];_0x299c7c[_0xb5f2('0x3d')]=qs['sort'](_0x5d6520['query'][_0xb5f2('0x3e')]);_0x299c7c[_0xb5f2('0x3f')]=qs['filters'](_[_0xb5f2('0x40')](_0x5d6520['query'],_0x30eb22[_0xb5f2('0x41')]));if(_0x5d6520['query'][_0xb5f2('0x42')]){_0x299c7c[_0xb5f2('0x3f')]=_[_0xb5f2('0x43')](_0x299c7c[_0xb5f2('0x3f')],{'$or':_[_0xb5f2('0x2f')](_0x299c7c[_0xb5f2('0x39')],function(_0x4174d3){var _0xe9811f={};_0xe9811f[_0x4174d3]={'$like':'%'+_0x5d6520[_0xb5f2('0x37')]['filter']+'%'};return _0xe9811f;})});}_0x299c7c=_[_0xb5f2('0x43')]({},_0x299c7c,_0x5d6520[_0xb5f2('0x4b')]);return _0x14613f[_0xb5f2('0x50')](_0x299c7c);}})[_0xb5f2('0x29')](function(_0x35322f){if(_0x35322f){_0x28f6f1=_0x35322f[_0xb5f2('0x3a')];if(!_0x5d6520[_0xb5f2('0x37')][_0xb5f2('0x3b')](_0xb5f2('0x3c'))){_0x299c7c[_0xb5f2('0x21')]=qs[_0xb5f2('0x21')](_0x5d6520[_0xb5f2('0x37')][_0xb5f2('0x21')]);_0x299c7c[_0xb5f2('0x1f')]=qs['offset'](_0x5d6520['query'][_0xb5f2('0x1f')]);}return _0x14613f[_0xb5f2('0x50')](_0x299c7c);}})[_0xb5f2('0x29')](function(_0x388369){if(_0x388369){return _0x388369?{'count':_0x28f6f1,'rows':_0x388369}:null;}})[_0xb5f2('0x29')](respondWithResult(_0x41b96f,null))[_0xb5f2('0x46')](handleError(_0x41b96f,null));};exports[_0xb5f2('0x52')]=function(_0x3a422b,_0x3343a6,_0x4f5053){var _0x5c5209={};var _0x5a7394={};var _0x178b37;var _0x438190;return db[_0xb5f2('0x30')]['findOne']({'where':{'id':_0x3a422b['params']['id']}})[_0xb5f2('0x29')](handleEntityNotFound(_0x3343a6,null))[_0xb5f2('0x29')](function(_0x2c6d99){if(_0x2c6d99){_0x178b37=_0x2c6d99;_0x5a7394[_0xb5f2('0x35')]=_['keys'](db[_0xb5f2('0x51')][_0xb5f2('0x31')]);_0x5a7394[_0xb5f2('0x37')]=_['keys'](_0x3a422b[_0xb5f2('0x37')]);_0x5a7394[_0xb5f2('0x41')]=_[_0xb5f2('0x48')](_0x5a7394['model'],_0x5a7394['query']);_0x5c5209['attributes']=_[_0xb5f2('0x48')](_0x5a7394[_0xb5f2('0x35')],qs['fields'](_0x3a422b[_0xb5f2('0x37')][_0xb5f2('0x38')]));_0x5c5209['attributes']=_0x5c5209[_0xb5f2('0x39')][_0xb5f2('0x3a')]?_0x5c5209[_0xb5f2('0x39')]:_0x5a7394[_0xb5f2('0x35')];_0x5c5209[_0xb5f2('0x3d')]=qs[_0xb5f2('0x3e')](_0x3a422b[_0xb5f2('0x37')][_0xb5f2('0x3e')]);_0x5c5209['where']=qs[_0xb5f2('0x41')](_[_0xb5f2('0x40')](_0x3a422b[_0xb5f2('0x37')],_0x5a7394['filters']));if(_0x3a422b[_0xb5f2('0x37')][_0xb5f2('0x42')]){_0x5c5209[_0xb5f2('0x3f')]=_[_0xb5f2('0x43')](_0x5c5209['where'],{'$or':_[_0xb5f2('0x2f')](_0x5c5209[_0xb5f2('0x39')],function(_0x4fed63){var _0x2dfdbb={};_0x2dfdbb[_0x4fed63]={'$like':'%'+_0x3a422b[_0xb5f2('0x37')][_0xb5f2('0x42')]+'%'};return _0x2dfdbb;})});}_0x5c5209=_[_0xb5f2('0x43')]({},_0x5c5209,_0x3a422b[_0xb5f2('0x4b')]);return _0x178b37[_0xb5f2('0x52')](_0x5c5209);}})['then'](function(_0x1dde8f){if(_0x1dde8f){_0x438190=_0x1dde8f[_0xb5f2('0x3a')];if(!_0x3a422b[_0xb5f2('0x37')][_0xb5f2('0x3b')](_0xb5f2('0x3c'))){_0x5c5209[_0xb5f2('0x21')]=qs[_0xb5f2('0x21')](_0x3a422b[_0xb5f2('0x37')]['limit']);_0x5c5209['offset']=qs[_0xb5f2('0x1f')](_0x3a422b[_0xb5f2('0x37')]['offset']);}return _0x178b37[_0xb5f2('0x52')](_0x5c5209);}})[_0xb5f2('0x29')](function(_0x5b0aef){if(_0x5b0aef){return _0x5b0aef?{'count':_0x438190,'rows':_0x5b0aef}:null;}})[_0xb5f2('0x29')](respondWithResult(_0x3343a6,null))[_0xb5f2('0x46')](handleError(_0x3343a6,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 2cd9847..3f71987 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 _0x9aa0=['path','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3213f6,_0x21d9ec){var _0x483b74=function(_0x245156){while(--_0x245156){_0x3213f6['push'](_0x3213f6['shift']());}};_0x483b74(++_0x21d9ec);}(_0x9aa0,0xa1));var _0x09aa=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9aa0[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x09aa('0x0'));var util=require(_0x09aa('0x1'));var logger=require(_0x09aa('0x2'))(_0x09aa('0x3'));var moment=require(_0x09aa('0x4'));var BPromise=require(_0x09aa('0x5'));var rp=require(_0x09aa('0x6'));var fs=require('fs');var path=require(_0x09aa('0x7'));var rimraf=require(_0x09aa('0x8'));var config=require(_0x09aa('0x9'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x09aa('0xa')]=function(_0x59a9dc,_0x556d15){return _0x59a9dc[_0x09aa('0xb')]('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55eb=['request-promise','path','rimraf','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','util','../../config/logger','api','moment','bluebird'];(function(_0x1cf1c6,_0x5e8bf5){var _0x4f1d6f=function(_0x51ca5e){while(--_0x51ca5e){_0x1cf1c6['push'](_0x1cf1c6['shift']());}};_0x4f1d6f(++_0x5e8bf5);}(_0x55eb,0x163));var _0xb55e=function(_0x414149,_0xc3b0e5){_0x414149=_0x414149-0x0;var _0x3eb2c3=_0x55eb[_0x414149];return _0x3eb2c3;};'use strict';var _=require('lodash');var util=require(_0xb55e('0x0'));var logger=require(_0xb55e('0x1'))(_0xb55e('0x2'));var moment=require(_0xb55e('0x3'));var BPromise=require(_0xb55e('0x4'));var rp=require(_0xb55e('0x5'));var fs=require('fs');var path=require(_0xb55e('0x6'));var rimraf=require(_0xb55e('0x7'));var config=require('../../config/environment');var attributes=require(_0xb55e('0x8'));module[_0xb55e('0x9')]=function(_0x5b4ee6,_0x273d69){return _0x5b4ee6[_0xb55e('0xa')](_0xb55e('0xb'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 897ea06..5a57401 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 _0xe9b5=['request\x20sent','error','code','message','SalesforceConfiguration,\x20%s,\x20%s','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','SalesforceConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0xe9b5,0x16e));var _0x5e9b=function(_0x30d4c5,_0x20d44a){_0x30d4c5=_0x30d4c5-0x0;var _0x5ddbc2=_0xe9b5[_0x30d4c5];return _0x5ddbc2;};'use strict';var _=require('lodash');var util=require(_0x5e9b('0x0'));var moment=require(_0x5e9b('0x1'));var BPromise=require(_0x5e9b('0x2'));var rs=require(_0x5e9b('0x3'));var fs=require('fs');var Redis=require(_0x5e9b('0x4'));var db=require(_0x5e9b('0x5'))['db'];var utils=require(_0x5e9b('0x6'));var logger=require(_0x5e9b('0x7'))(_0x5e9b('0x8'));var config=require('../../config/environment');var jayson=require(_0x5e9b('0x9'));var client=jayson['client'][_0x5e9b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfaf841,_0x7f4f72,_0x319f91){return new BPromise(function(_0x3783c6,_0x88084a){return client[_0x5e9b('0xb')](_0xfaf841,_0x319f91)['then'](function(_0xec2179){logger[_0x5e9b('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x7f4f72,'request\x20sent');logger['debug'](_0x5e9b('0xd'),_0x7f4f72,_0x5e9b('0xe'),JSON['stringify'](_0xec2179));if(_0xec2179[_0x5e9b('0xf')]){if(_0xec2179[_0x5e9b('0xf')][_0x5e9b('0x10')]===0x1f4){logger[_0x5e9b('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x7f4f72,_0xec2179['error']['message']);return _0x88084a(_0xec2179['error'][_0x5e9b('0x11')]);}logger[_0x5e9b('0xf')](_0x5e9b('0x12'),_0x7f4f72,_0xec2179[_0x5e9b('0xf')]['message']);return _0x3783c6(_0xec2179[_0x5e9b('0xf')][_0x5e9b('0x11')]);}else{logger[_0x5e9b('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x7f4f72,_0x5e9b('0xe'));_0x3783c6(_0xec2179[_0x5e9b('0x13')]['message']);}})['catch'](function(_0x49a0bd){logger[_0x5e9b('0xf')](_0x5e9b('0x12'),_0x7f4f72,_0x49a0bd);_0x88084a(_0x49a0bd);});});} \ No newline at end of file +var _0xd49c=['rpc','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','lodash','util','randomstring','../../mysqldb','../../config/logger'];(function(_0x44d797,_0x276017){var _0x4005c2=function(_0x3d3b5b){while(--_0x3d3b5b){_0x44d797['push'](_0x44d797['shift']());}};_0x4005c2(++_0x276017);}(_0xd49c,0x1c3));var _0xcd49=function(_0x48e03a,_0x2f2757){_0x48e03a=_0x48e03a-0x0;var _0x53bdce=_0xd49c[_0x48e03a];return _0x53bdce;};'use strict';var _=require(_0xcd49('0x0'));var util=require(_0xcd49('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcd49('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd49('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd49('0x4'))(_0xcd49('0x5'));var config=require('../../config/environment');var jayson=require(_0xcd49('0x6'));var client=jayson[_0xcd49('0x7')][_0xcd49('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53abae,_0x2fb48e,_0xc173cd){return new BPromise(function(_0x24e60f,_0xefcea9){return client[_0xcd49('0x9')](_0x53abae,_0xc173cd)[_0xcd49('0xa')](function(_0x315e14){logger[_0xcd49('0xb')](_0xcd49('0xc'),_0x2fb48e,'request\x20sent');logger[_0xcd49('0xd')](_0xcd49('0xe'),_0x2fb48e,'request\x20sent',JSON[_0xcd49('0xf')](_0x315e14));if(_0x315e14[_0xcd49('0x10')]){if(_0x315e14[_0xcd49('0x10')]['code']===0x1f4){logger[_0xcd49('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2fb48e,_0x315e14[_0xcd49('0x10')][_0xcd49('0x11')]);return _0xefcea9(_0x315e14[_0xcd49('0x10')]['message']);}logger[_0xcd49('0x10')](_0xcd49('0xc'),_0x2fb48e,_0x315e14['error'][_0xcd49('0x11')]);return _0x24e60f(_0x315e14[_0xcd49('0x10')]['message']);}else{logger['info'](_0xcd49('0xc'),_0x2fb48e,_0xcd49('0x12'));_0x24e60f(_0x315e14['result'][_0xcd49('0x11')]);}})['catch'](function(_0x340b47){logger['error'](_0xcd49('0xc'),_0x2fb48e,_0x340b47);_0xefcea9(_0x340b47);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index dbeafaa..fba79bc 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 _0x0814=['create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x0814,0x145));var _0x4081=function(_0x3f9a56,_0x140559){_0x3f9a56=_0x3f9a56-0x0;var _0x4dd5fd=_0x0814[_0x3f9a56];return _0x4dd5fd;};'use strict';var multer=require(_0x4081('0x0'));var util=require(_0x4081('0x1'));var path=require(_0x4081('0x2'));var timeout=require(_0x4081('0x3'));var express=require(_0x4081('0x4'));var router=express['Router']();var fs_extra=require(_0x4081('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4081('0x6'));var config=require(_0x4081('0x7'));var controller=require(_0x4081('0x8'));router[_0x4081('0x9')]('/',auth[_0x4081('0xa')](),controller[_0x4081('0xb')]);router[_0x4081('0x9')](_0x4081('0xc'),auth['isAuthenticated'](),controller[_0x4081('0xd')]);router[_0x4081('0xe')]('/',auth[_0x4081('0xa')](),controller[_0x4081('0xf')]);router[_0x4081('0x10')](_0x4081('0xc'),auth[_0x4081('0xa')](),controller['update']);router[_0x4081('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x4081('0x12')]);module[_0x4081('0x13')]=router; \ No newline at end of file +var _0x45c8=['show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./intSalesforceField.controller','isAuthenticated','index','get','/:id'];(function(_0xf9a860,_0x19eb67){var _0x26de69=function(_0x51a2b8){while(--_0x51a2b8){_0xf9a860['push'](_0xf9a860['shift']());}};_0x26de69(++_0x19eb67);}(_0x45c8,0x1d0));var _0x845c=function(_0x26d3a6,_0x61d8c1){_0x26d3a6=_0x26d3a6-0x0;var _0x3a4c2a=_0x45c8[_0x26d3a6];return _0x3a4c2a;};'use strict';var multer=require(_0x845c('0x0'));var util=require('util');var path=require(_0x845c('0x1'));var timeout=require(_0x845c('0x2'));var express=require(_0x845c('0x3'));var router=express[_0x845c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x845c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x845c('0x6'));router['get']('/',auth[_0x845c('0x7')](),controller[_0x845c('0x8')]);router[_0x845c('0x9')](_0x845c('0xa'),auth[_0x845c('0x7')](),controller[_0x845c('0xb')]);router[_0x845c('0xc')]('/',auth[_0x845c('0x7')](),controller[_0x845c('0xd')]);router[_0x845c('0xe')](_0x845c('0xa'),auth[_0x845c('0x7')](),controller[_0x845c('0xf')]);router[_0x845c('0x10')](_0x845c('0xa'),auth[_0x845c('0x7')](),controller[_0x845c('0x11')]);module[_0x845c('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index ed03c76..9768408 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 _0x1474=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x5d1629,_0x253b93){var _0x5f219d=function(_0x286eb4){while(--_0x286eb4){_0x5d1629['push'](_0x5d1629['shift']());}};_0x5f219d(++_0x253b93);}(_0x1474,0x17a));var _0x4147=function(_0x466a1a,_0x37933b){_0x466a1a=_0x466a1a-0x0;var _0x577165=_0x1474[_0x466a1a];return _0x577165;};'use strict';var Sequelize=require(_0x4147('0x0'));module[_0x4147('0x1')]={'type':{'type':Sequelize[_0x4147('0x2')](_0x4147('0x3'),_0x4147('0x4'),_0x4147('0x5'),_0x4147('0x6'),_0x4147('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4147('0x8')]},'key':{'type':Sequelize[_0x4147('0x8')]},'keyType':{'type':Sequelize[_0x4147('0x2')](_0x4147('0x3'),_0x4147('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4147('0x8')]},'variableName':{'type':Sequelize[_0x4147('0x8')]}}; \ No newline at end of file +var _0x138a=['STRING','sequelize','exports','ENUM','string','variable','customVariable','picklist'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x138a,0x1f1));var _0xa138=function(_0x1216bf,_0x2b0866){_0x1216bf=_0x1216bf-0x0;var _0x9ddc50=_0x138a[_0x1216bf];return _0x9ddc50;};'use strict';var Sequelize=require(_0xa138('0x0'));module[_0xa138('0x1')]={'type':{'type':Sequelize[_0xa138('0x2')](_0xa138('0x3'),_0xa138('0x4'),_0xa138('0x5'),'keyValue',_0xa138('0x6')),'defaultValue':_0xa138('0x3')},'content':{'type':Sequelize[_0xa138('0x7')]},'key':{'type':Sequelize[_0xa138('0x7')]},'keyType':{'type':Sequelize[_0xa138('0x2')](_0xa138('0x3'),_0xa138('0x4'),_0xa138('0x5'))},'keyContent':{'type':Sequelize[_0xa138('0x7')]},'idField':{'type':Sequelize[_0xa138('0x7')]},'variableName':{'type':Sequelize[_0xa138('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 887ec38..4d29f1e 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 _0x6a75=['pick','filters','filter','merge','VIRTUAL','includeAll','rows','catch','show','keys','include','options','create','body','find','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','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','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','error','stack','name','send','index','SalesforceField','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','nolimit','order','sort','where'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6a75,0x18c));var _0x56a7=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x6a75[_0xfa634c];return _0x73e478;};'use strict';var emlformat=require(_0x56a7('0x0'));var rimraf=require(_0x56a7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x56a7('0x2'));var rp=require(_0x56a7('0x3'));var moment=require(_0x56a7('0x4'));var BPromise=require(_0x56a7('0x5'));var Mustache=require('mustache');var util=require(_0x56a7('0x6'));var path=require(_0x56a7('0x7'));var sox=require('sox');var csv=require(_0x56a7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x56a7('0x9'));var _=require(_0x56a7('0xa'));var squel=require(_0x56a7('0xb'));var crypto=require(_0x56a7('0xc'));var jsforce=require(_0x56a7('0xd'));var deskjs=require(_0x56a7('0xe'));var toCsv=require(_0x56a7('0x8'));var querystring=require(_0x56a7('0xf'));var Papa=require('papaparse');var Redis=require(_0x56a7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x56a7('0x11'));var as=require(_0x56a7('0x12'));var hardwareService=require(_0x56a7('0x13'));var logger=require(_0x56a7('0x14'))(_0x56a7('0x15'));var utils=require(_0x56a7('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x56a7('0x17'));var db=require(_0x56a7('0x18'))['db'];function respondWithStatusCode(_0x4c882b,_0x533e91){_0x533e91=_0x533e91||0xcc;return function(_0xd88ea8){if(_0xd88ea8){return _0x4c882b[_0x56a7('0x19')](_0x533e91);}return _0x4c882b[_0x56a7('0x1a')](_0x533e91)[_0x56a7('0x1b')]();};}function respondWithResult(_0x252dee,_0x1f1a74){_0x1f1a74=_0x1f1a74||0xc8;return function(_0x3595a9){if(_0x3595a9){return _0x252dee[_0x56a7('0x1a')](_0x1f1a74)[_0x56a7('0x1c')](_0x3595a9);}};}function respondWithFilteredResult(_0xf10721,_0x2dea9e){return function(_0x4dceba){if(_0x4dceba){var _0x536330=typeof _0x2dea9e['offset']===_0x56a7('0x1d')&&typeof _0x2dea9e[_0x56a7('0x1e')]==='undefined';var _0x40f118=_0x4dceba[_0x56a7('0x1f')];var _0x3e0f69=_0x536330?0x0:_0x2dea9e[_0x56a7('0x20')];var _0x596f60=_0x536330?_0x4dceba['count']:_0x2dea9e[_0x56a7('0x20')]+_0x2dea9e['limit'];var _0x857497;if(_0x596f60>=_0x40f118){_0x596f60=_0x40f118;_0x857497=0xc8;}else{_0x857497=0xce;}_0xf10721[_0x56a7('0x1a')](_0x857497);return _0xf10721[_0x56a7('0x21')]('Content-Range',_0x3e0f69+'-'+_0x596f60+'/'+_0x40f118)['json'](_0x4dceba);}return null;};}function patchUpdates(_0x3bec75){return function(_0x433459){try{jsonpatch[_0x56a7('0x22')](_0x433459,_0x3bec75,!![]);}catch(_0x78f931){return BPromise['reject'](_0x78f931);}return _0x433459[_0x56a7('0x23')]();};}function saveUpdates(_0x336216,_0x22658c){return function(_0x26da79){if(_0x26da79){return _0x26da79[_0x56a7('0x24')](_0x336216)[_0x56a7('0x25')](function(_0x2347e0){return _0x2347e0;});}return null;};}function removeEntity(_0x1fe9f2,_0x2b3451){return function(_0x40b63b){if(_0x40b63b){return _0x40b63b[_0x56a7('0x26')]()[_0x56a7('0x25')](function(){_0x1fe9f2['status'](0xcc)[_0x56a7('0x1b')]();});}};}function handleEntityNotFound(_0x6d50c2,_0x1d0e57){return function(_0x4e3cd0){if(!_0x4e3cd0){_0x6d50c2[_0x56a7('0x19')](0x194);}return _0x4e3cd0;};}function handleError(_0x4cb07e,_0x40a06b){_0x40a06b=_0x40a06b||0x1f4;return function(_0x156700){logger[_0x56a7('0x27')](_0x156700[_0x56a7('0x28')]);if(_0x156700[_0x56a7('0x29')]){delete _0x156700[_0x56a7('0x29')];}_0x4cb07e[_0x56a7('0x1a')](_0x40a06b)[_0x56a7('0x2a')](_0x156700);};}exports[_0x56a7('0x2b')]=function(_0x36c932,_0x42f778){var _0x48821c={},_0x52a4e0={},_0x2ef07f={'count':0x0,'rows':[]};var _0x933585=_['map'](db[_0x56a7('0x2c')][_0x56a7('0x2d')],function(_0x334289){return{'name':_0x334289[_0x56a7('0x2e')],'type':_0x334289[_0x56a7('0x2f')][_0x56a7('0x30')]};});_0x52a4e0[_0x56a7('0x31')]=_[_0x56a7('0x32')](_0x933585,'name');_0x52a4e0[_0x56a7('0x33')]=_['keys'](_0x36c932[_0x56a7('0x33')]);_0x52a4e0['filters']=_[_0x56a7('0x34')](_0x52a4e0['model'],_0x52a4e0[_0x56a7('0x33')]);_0x48821c[_0x56a7('0x35')]=_[_0x56a7('0x34')](_0x52a4e0[_0x56a7('0x31')],qs[_0x56a7('0x36')](_0x36c932[_0x56a7('0x33')][_0x56a7('0x36')]));_0x48821c[_0x56a7('0x35')]=_0x48821c[_0x56a7('0x35')][_0x56a7('0x37')]?_0x48821c[_0x56a7('0x35')]:_0x52a4e0['model'];if(!_0x36c932[_0x56a7('0x33')]['hasOwnProperty'](_0x56a7('0x38'))){_0x48821c['limit']=qs[_0x56a7('0x1e')](_0x36c932['query'][_0x56a7('0x1e')]);_0x48821c[_0x56a7('0x20')]=qs[_0x56a7('0x20')](_0x36c932[_0x56a7('0x33')][_0x56a7('0x20')]);}_0x48821c[_0x56a7('0x39')]=qs[_0x56a7('0x3a')](_0x36c932['query'][_0x56a7('0x3a')]);_0x48821c[_0x56a7('0x3b')]=qs['filters'](_[_0x56a7('0x3c')](_0x36c932[_0x56a7('0x33')],_0x52a4e0[_0x56a7('0x3d')]),_0x933585);if(_0x36c932[_0x56a7('0x33')][_0x56a7('0x3e')]){_0x48821c[_0x56a7('0x3b')]=_[_0x56a7('0x3f')](_0x48821c[_0x56a7('0x3b')],{'$or':_['map'](_0x933585,function(_0x54982a){if(_0x54982a[_0x56a7('0x2f')]!==_0x56a7('0x40')){var _0x45d377={};_0x45d377[_0x54982a[_0x56a7('0x29')]]={'$like':'%'+_0x36c932[_0x56a7('0x33')][_0x56a7('0x3e')]+'%'};return _0x45d377;}})});}_0x48821c=_[_0x56a7('0x3f')]({},_0x48821c,_0x36c932['options']);var _0x4aa2c7={'where':_0x48821c[_0x56a7('0x3b')]};return db[_0x56a7('0x2c')][_0x56a7('0x1f')](_0x4aa2c7)[_0x56a7('0x25')](function(_0x547416){_0x2ef07f[_0x56a7('0x1f')]=_0x547416;if(_0x36c932[_0x56a7('0x33')][_0x56a7('0x41')]){_0x48821c['include']=[{'all':!![]}];}return db['SalesforceField']['findAll'](_0x48821c);})[_0x56a7('0x25')](function(_0x379842){_0x2ef07f[_0x56a7('0x42')]=_0x379842;return _0x2ef07f;})[_0x56a7('0x25')](respondWithFilteredResult(_0x42f778,_0x48821c))[_0x56a7('0x43')](handleError(_0x42f778,null));};exports[_0x56a7('0x44')]=function(_0x26c210,_0x25f98f){var _0x16c9e7={'raw':!![],'where':{'id':_0x26c210['params']['id']}},_0x29b1ec={};_0x29b1ec[_0x56a7('0x31')]=_['keys'](db[_0x56a7('0x2c')][_0x56a7('0x2d')]);_0x29b1ec[_0x56a7('0x33')]=_[_0x56a7('0x45')](_0x26c210[_0x56a7('0x33')]);_0x29b1ec[_0x56a7('0x3d')]=_[_0x56a7('0x34')](_0x29b1ec[_0x56a7('0x31')],_0x29b1ec['query']);_0x16c9e7[_0x56a7('0x35')]=_[_0x56a7('0x34')](_0x29b1ec[_0x56a7('0x31')],qs[_0x56a7('0x36')](_0x26c210[_0x56a7('0x33')]['fields']));_0x16c9e7[_0x56a7('0x35')]=_0x16c9e7[_0x56a7('0x35')][_0x56a7('0x37')]?_0x16c9e7[_0x56a7('0x35')]:_0x29b1ec[_0x56a7('0x31')];if(_0x26c210[_0x56a7('0x33')][_0x56a7('0x41')]){_0x16c9e7[_0x56a7('0x46')]=[{'all':!![]}];}_0x16c9e7=_['merge']({},_0x16c9e7,_0x26c210[_0x56a7('0x47')]);return db[_0x56a7('0x2c')]['find'](_0x16c9e7)[_0x56a7('0x25')](handleEntityNotFound(_0x25f98f,null))['then'](respondWithResult(_0x25f98f,null))[_0x56a7('0x43')](handleError(_0x25f98f,null));};exports['create']=function(_0x33f656,_0x2c9b21){return db['SalesforceField'][_0x56a7('0x48')](_0x33f656[_0x56a7('0x49')],{})['then'](respondWithResult(_0x2c9b21,0xc9))[_0x56a7('0x43')](handleError(_0x2c9b21,null));};exports['update']=function(_0x198ab8,_0x4cd564){if(_0x198ab8[_0x56a7('0x49')]['id']){delete _0x198ab8[_0x56a7('0x49')]['id'];}return db[_0x56a7('0x2c')][_0x56a7('0x4a')]({'where':{'id':_0x198ab8[_0x56a7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4cd564,null))[_0x56a7('0x25')](saveUpdates(_0x198ab8[_0x56a7('0x49')],null))[_0x56a7('0x25')](respondWithResult(_0x4cd564,null))[_0x56a7('0x43')](handleError(_0x4cd564,null));};exports[_0x56a7('0x26')]=function(_0x4b6478,_0x1b6beb){return db[_0x56a7('0x2c')][_0x56a7('0x4a')]({'where':{'id':_0x4b6478[_0x56a7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1b6beb,null))[_0x56a7('0x25')](removeEntity(_0x1b6beb,null))[_0x56a7('0x43')](handleError(_0x1b6beb,null));}; \ No newline at end of file +var _0xa02f=['squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','SalesforceField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','fields','find','create','body','eml-format','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','lodash'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xa02f,0xcf));var _0xfa02=function(_0x442174,_0x2e591f){_0x442174=_0x442174-0x0;var _0x225768=_0xa02f[_0x442174];return _0x225768;};'use strict';var emlformat=require(_0xfa02('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfa02('0x1'));var rp=require(_0xfa02('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfa02('0x3'));var util=require(_0xfa02('0x4'));var path=require(_0xfa02('0x5'));var sox=require(_0xfa02('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa02('0x7'));var _=require(_0xfa02('0x8'));var squel=require(_0xfa02('0x9'));var crypto=require(_0xfa02('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfa02('0xb'));var toCsv=require(_0xfa02('0xc'));var querystring=require(_0xfa02('0xd'));var Papa=require(_0xfa02('0xe'));var Redis=require(_0xfa02('0xf'));var authService=require(_0xfa02('0x10'));var qs=require(_0xfa02('0x11'));var as=require(_0xfa02('0x12'));var hardwareService=require(_0xfa02('0x13'));var logger=require('../../config/logger')(_0xfa02('0x14'));var utils=require('../../config/utils');var config=require(_0xfa02('0x15'));var licenseUtil=require(_0xfa02('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1023c7,_0x311e1f){_0x311e1f=_0x311e1f||0xcc;return function(_0x423231){if(_0x423231){return _0x1023c7['sendStatus'](_0x311e1f);}return _0x1023c7[_0xfa02('0x17')](_0x311e1f)[_0xfa02('0x18')]();};}function respondWithResult(_0x5b853e,_0x3a54ec){_0x3a54ec=_0x3a54ec||0xc8;return function(_0x251cd4){if(_0x251cd4){return _0x5b853e[_0xfa02('0x17')](_0x3a54ec)[_0xfa02('0x19')](_0x251cd4);}};}function respondWithFilteredResult(_0x36b86c,_0x828fc8){return function(_0x430647){if(_0x430647){var _0x34490e=typeof _0x828fc8[_0xfa02('0x1a')]===_0xfa02('0x1b')&&typeof _0x828fc8[_0xfa02('0x1c')]===_0xfa02('0x1b');var _0x1c9373=_0x430647[_0xfa02('0x1d')];var _0x536b8f=_0x34490e?0x0:_0x828fc8[_0xfa02('0x1a')];var _0x5a836c=_0x34490e?_0x430647[_0xfa02('0x1d')]:_0x828fc8[_0xfa02('0x1a')]+_0x828fc8[_0xfa02('0x1c')];var _0x365c4f;if(_0x5a836c>=_0x1c9373){_0x5a836c=_0x1c9373;_0x365c4f=0xc8;}else{_0x365c4f=0xce;}_0x36b86c[_0xfa02('0x17')](_0x365c4f);return _0x36b86c[_0xfa02('0x1e')](_0xfa02('0x1f'),_0x536b8f+'-'+_0x5a836c+'/'+_0x1c9373)[_0xfa02('0x19')](_0x430647);}return null;};}function patchUpdates(_0xb45a6){return function(_0xd7fda1){try{jsonpatch['apply'](_0xd7fda1,_0xb45a6,!![]);}catch(_0x19ad3e){return BPromise[_0xfa02('0x20')](_0x19ad3e);}return _0xd7fda1[_0xfa02('0x21')]();};}function saveUpdates(_0x8f2d8c,_0x4b14c5){return function(_0x55d186){if(_0x55d186){return _0x55d186[_0xfa02('0x22')](_0x8f2d8c)[_0xfa02('0x23')](function(_0x5ca8d6){return _0x5ca8d6;});}return null;};}function removeEntity(_0x2a0ea2,_0xfe785){return function(_0x365210){if(_0x365210){return _0x365210[_0xfa02('0x24')]()[_0xfa02('0x23')](function(){_0x2a0ea2['status'](0xcc)[_0xfa02('0x18')]();});}};}function handleEntityNotFound(_0x33a7ee,_0x4ae07a){return function(_0x37d627){if(!_0x37d627){_0x33a7ee[_0xfa02('0x25')](0x194);}return _0x37d627;};}function handleError(_0x478a05,_0x2406eb){_0x2406eb=_0x2406eb||0x1f4;return function(_0xee82ed){logger[_0xfa02('0x26')](_0xee82ed[_0xfa02('0x27')]);if(_0xee82ed[_0xfa02('0x28')]){delete _0xee82ed[_0xfa02('0x28')];}_0x478a05[_0xfa02('0x17')](_0x2406eb)['send'](_0xee82ed);};}exports[_0xfa02('0x29')]=function(_0x41e368,_0x27b174){var _0x406ad2={},_0x2c4f30={},_0x48e88b={'count':0x0,'rows':[]};var _0x3ace50=_[_0xfa02('0x2a')](db[_0xfa02('0x2b')][_0xfa02('0x2c')],function(_0x75d6fc){return{'name':_0x75d6fc[_0xfa02('0x2d')],'type':_0x75d6fc[_0xfa02('0x2e')]['key']};});_0x2c4f30[_0xfa02('0x2f')]=_[_0xfa02('0x2a')](_0x3ace50,_0xfa02('0x28'));_0x2c4f30[_0xfa02('0x30')]=_[_0xfa02('0x31')](_0x41e368[_0xfa02('0x30')]);_0x2c4f30[_0xfa02('0x32')]=_[_0xfa02('0x33')](_0x2c4f30[_0xfa02('0x2f')],_0x2c4f30[_0xfa02('0x30')]);_0x406ad2[_0xfa02('0x34')]=_[_0xfa02('0x33')](_0x2c4f30[_0xfa02('0x2f')],qs['fields'](_0x41e368[_0xfa02('0x30')]['fields']));_0x406ad2[_0xfa02('0x34')]=_0x406ad2[_0xfa02('0x34')]['length']?_0x406ad2[_0xfa02('0x34')]:_0x2c4f30[_0xfa02('0x2f')];if(!_0x41e368[_0xfa02('0x30')][_0xfa02('0x35')](_0xfa02('0x36'))){_0x406ad2[_0xfa02('0x1c')]=qs['limit'](_0x41e368[_0xfa02('0x30')]['limit']);_0x406ad2[_0xfa02('0x1a')]=qs['offset'](_0x41e368['query'][_0xfa02('0x1a')]);}_0x406ad2['order']=qs[_0xfa02('0x37')](_0x41e368[_0xfa02('0x30')]['sort']);_0x406ad2[_0xfa02('0x38')]=qs[_0xfa02('0x32')](_[_0xfa02('0x39')](_0x41e368[_0xfa02('0x30')],_0x2c4f30[_0xfa02('0x32')]),_0x3ace50);if(_0x41e368[_0xfa02('0x30')][_0xfa02('0x3a')]){_0x406ad2['where']=_[_0xfa02('0x3b')](_0x406ad2['where'],{'$or':_[_0xfa02('0x2a')](_0x3ace50,function(_0x28b463){if(_0x28b463[_0xfa02('0x2e')]!==_0xfa02('0x3c')){var _0x176115={};_0x176115[_0x28b463[_0xfa02('0x28')]]={'$like':'%'+_0x41e368[_0xfa02('0x30')][_0xfa02('0x3a')]+'%'};return _0x176115;}})});}_0x406ad2=_[_0xfa02('0x3b')]({},_0x406ad2,_0x41e368[_0xfa02('0x3d')]);var _0x3d7464={'where':_0x406ad2[_0xfa02('0x38')]};return db[_0xfa02('0x2b')][_0xfa02('0x1d')](_0x3d7464)[_0xfa02('0x23')](function(_0x3064d7){_0x48e88b[_0xfa02('0x1d')]=_0x3064d7;if(_0x41e368['query'][_0xfa02('0x3e')]){_0x406ad2[_0xfa02('0x3f')]=[{'all':!![]}];}return db[_0xfa02('0x2b')][_0xfa02('0x40')](_0x406ad2);})[_0xfa02('0x23')](function(_0x19c49e){_0x48e88b[_0xfa02('0x41')]=_0x19c49e;return _0x48e88b;})[_0xfa02('0x23')](respondWithFilteredResult(_0x27b174,_0x406ad2))[_0xfa02('0x42')](handleError(_0x27b174,null));};exports['show']=function(_0x3e7169,_0x167003){var _0x26ca58={'raw':!![],'where':{'id':_0x3e7169[_0xfa02('0x43')]['id']}},_0x48a3ec={};_0x48a3ec[_0xfa02('0x2f')]=_[_0xfa02('0x31')](db['SalesforceField']['rawAttributes']);_0x48a3ec[_0xfa02('0x30')]=_['keys'](_0x3e7169[_0xfa02('0x30')]);_0x48a3ec[_0xfa02('0x32')]=_[_0xfa02('0x33')](_0x48a3ec['model'],_0x48a3ec['query']);_0x26ca58[_0xfa02('0x34')]=_['intersection'](_0x48a3ec[_0xfa02('0x2f')],qs[_0xfa02('0x44')](_0x3e7169[_0xfa02('0x30')][_0xfa02('0x44')]));_0x26ca58['attributes']=_0x26ca58[_0xfa02('0x34')]['length']?_0x26ca58['attributes']:_0x48a3ec[_0xfa02('0x2f')];if(_0x3e7169[_0xfa02('0x30')][_0xfa02('0x3e')]){_0x26ca58[_0xfa02('0x3f')]=[{'all':!![]}];}_0x26ca58=_[_0xfa02('0x3b')]({},_0x26ca58,_0x3e7169['options']);return db['SalesforceField'][_0xfa02('0x45')](_0x26ca58)[_0xfa02('0x23')](handleEntityNotFound(_0x167003,null))['then'](respondWithResult(_0x167003,null))[_0xfa02('0x42')](handleError(_0x167003,null));};exports[_0xfa02('0x46')]=function(_0xdad6ec,_0x4431bd){return db['SalesforceField']['create'](_0xdad6ec[_0xfa02('0x47')],{})['then'](respondWithResult(_0x4431bd,0xc9))[_0xfa02('0x42')](handleError(_0x4431bd,null));};exports[_0xfa02('0x22')]=function(_0x5bc2eb,_0x9f5cc9){if(_0x5bc2eb[_0xfa02('0x47')]['id']){delete _0x5bc2eb[_0xfa02('0x47')]['id'];}return db[_0xfa02('0x2b')][_0xfa02('0x45')]({'where':{'id':_0x5bc2eb[_0xfa02('0x43')]['id']}})[_0xfa02('0x23')](handleEntityNotFound(_0x9f5cc9,null))[_0xfa02('0x23')](saveUpdates(_0x5bc2eb[_0xfa02('0x47')],null))['then'](respondWithResult(_0x9f5cc9,null))[_0xfa02('0x42')](handleError(_0x9f5cc9,null));};exports['destroy']=function(_0x5661c5,_0x1918d6){return db[_0xfa02('0x2b')][_0xfa02('0x45')]({'where':{'id':_0x5661c5['params']['id']}})[_0xfa02('0x23')](handleEntityNotFound(_0x1918d6,null))[_0xfa02('0x23')](removeEntity(_0x1918d6,null))[_0xfa02('0x42')](handleError(_0x1918d6,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 1406101..b7c2a28 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 _0x9f8f=['SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define'];(function(_0x29caec,_0x16b241){var _0x1b9aea=function(_0x1c4bb5){while(--_0x1c4bb5){_0x29caec['push'](_0x29caec['shift']());}};_0x1b9aea(++_0x16b241);}(_0x9f8f,0x18c));var _0xf9f8=function(_0xef1a8f,_0xa5b7ee){_0xef1a8f=_0xef1a8f-0x0;var _0xcfc9d5=_0x9f8f[_0xef1a8f];return _0xcfc9d5;};'use strict';var _=require(_0xf9f8('0x0'));var util=require(_0xf9f8('0x1'));var logger=require(_0xf9f8('0x2'))('api');var moment=require(_0xf9f8('0x3'));var BPromise=require(_0xf9f8('0x4'));var rp=require(_0xf9f8('0x5'));var fs=require('fs');var path=require(_0xf9f8('0x6'));var rimraf=require(_0xf9f8('0x7'));var config=require(_0xf9f8('0x8'));var attributes=require(_0xf9f8('0x9'));module[_0xf9f8('0xa')]=function(_0xe00fc3,_0x2c70af){return _0xe00fc3[_0xf9f8('0xb')](_0xf9f8('0xc'),attributes,{'tableName':_0xf9f8('0xd'),'paranoid':![],'indexes':[{'name':_0xf9f8('0xe'),'fields':[_0xf9f8('0xf'),_0xf9f8('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5906=['salesforce_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceField.attributes','exports','SalesforceField','int_salesforce_fields'];(function(_0x462fe4,_0x394d3e){var _0x82b23a=function(_0x2c071f){while(--_0x2c071f){_0x462fe4['push'](_0x462fe4['shift']());}};_0x82b23a(++_0x394d3e);}(_0x5906,0xd5));var _0x6590=function(_0x161165,_0x40e238){_0x161165=_0x161165-0x0;var _0x245aed=_0x5906[_0x161165];return _0x245aed;};'use strict';var _=require(_0x6590('0x0'));var util=require('util');var logger=require(_0x6590('0x1'))(_0x6590('0x2'));var moment=require(_0x6590('0x3'));var BPromise=require(_0x6590('0x4'));var rp=require(_0x6590('0x5'));var fs=require('fs');var path=require(_0x6590('0x6'));var rimraf=require('rimraf');var config=require(_0x6590('0x7'));var attributes=require(_0x6590('0x8'));module[_0x6590('0x9')]=function(_0x5083fe,_0x1e0d80){return _0x5083fe['define'](_0x6590('0xa'),attributes,{'tableName':_0x6590('0xb'),'paranoid':![],'indexes':[{'name':_0x6590('0xc'),'fields':[_0x6590('0xd'),_0x6590('0xe')],'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 a8fc1a8..394fa9b 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 _0x8207=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x8207,0x83));var _0x7820=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8207[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x7820('0x0'));var moment=require(_0x7820('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7820('0x2'));var db=require(_0x7820('0x3'))['db'];var utils=require(_0x7820('0x4'));var logger=require(_0x7820('0x5'))(_0x7820('0x6'));var config=require('../../config/environment');var jayson=require(_0x7820('0x7'));var client=jayson['client'][_0x7820('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44428d,_0x263b46,_0x1916f4){return new BPromise(function(_0x214070,_0x4e2586){return client[_0x7820('0x9')](_0x44428d,_0x1916f4)[_0x7820('0xa')](function(_0x1fb562){logger['info'](_0x7820('0xb'),_0x263b46,'request\x20sent');logger[_0x7820('0xc')](_0x7820('0xd'),_0x263b46,_0x7820('0xe'),JSON[_0x7820('0xf')](_0x1fb562));if(_0x1fb562['error']){if(_0x1fb562[_0x7820('0x10')][_0x7820('0x11')]===0x1f4){logger[_0x7820('0x10')](_0x7820('0xb'),_0x263b46,_0x1fb562[_0x7820('0x10')][_0x7820('0x12')]);return _0x4e2586(_0x1fb562[_0x7820('0x10')]['message']);}logger[_0x7820('0x10')](_0x7820('0xb'),_0x263b46,_0x1fb562[_0x7820('0x10')][_0x7820('0x12')]);return _0x214070(_0x1fb562[_0x7820('0x10')][_0x7820('0x12')]);}else{logger[_0x7820('0x13')](_0x7820('0xb'),_0x263b46,'request\x20sent');_0x214070(_0x1fb562[_0x7820('0x14')][_0x7820('0x12')]);}})[_0x7820('0x15')](function(_0x49c62f){logger[_0x7820('0x10')]('SalesforceField,\x20%s,\x20%s',_0x263b46,_0x49c62f);_0x4e2586(_0x49c62f);});});} \ No newline at end of file +var _0x3c55=['SalesforceField,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error'];(function(_0x18c22e,_0x443a33){var _0x49e9dd=function(_0xa87cc6){while(--_0xa87cc6){_0x18c22e['push'](_0x18c22e['shift']());}};_0x49e9dd(++_0x443a33);}(_0x3c55,0xdf));var _0x53c5=function(_0x23374b,_0x1249e6){_0x23374b=_0x23374b-0x0;var _0x3b9262=_0x3c55[_0x23374b];return _0x3b9262;};'use strict';var _=require('lodash');var util=require(_0x53c5('0x0'));var moment=require(_0x53c5('0x1'));var BPromise=require(_0x53c5('0x2'));var rs=require(_0x53c5('0x3'));var fs=require('fs');var Redis=require(_0x53c5('0x4'));var db=require(_0x53c5('0x5'))['db'];var utils=require(_0x53c5('0x6'));var logger=require(_0x53c5('0x7'))('rpc');var config=require(_0x53c5('0x8'));var jayson=require(_0x53c5('0x9'));var client=jayson[_0x53c5('0xa')][_0x53c5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43f464,_0x3e7525,_0x366d0e){return new BPromise(function(_0x46b7cd,_0x34b06a){return client[_0x53c5('0xc')](_0x43f464,_0x366d0e)[_0x53c5('0xd')](function(_0x1eafca){logger[_0x53c5('0xe')]('SalesforceField,\x20%s,\x20%s',_0x3e7525,_0x53c5('0xf'));logger[_0x53c5('0x10')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x3e7525,_0x53c5('0xf'),JSON[_0x53c5('0x11')](_0x1eafca));if(_0x1eafca[_0x53c5('0x12')]){if(_0x1eafca[_0x53c5('0x12')]['code']===0x1f4){logger[_0x53c5('0x12')](_0x53c5('0x13'),_0x3e7525,_0x1eafca['error']['message']);return _0x34b06a(_0x1eafca[_0x53c5('0x12')][_0x53c5('0x14')]);}logger['error'](_0x53c5('0x13'),_0x3e7525,_0x1eafca['error']['message']);return _0x46b7cd(_0x1eafca[_0x53c5('0x12')][_0x53c5('0x14')]);}else{logger[_0x53c5('0xe')](_0x53c5('0x13'),_0x3e7525,_0x53c5('0xf'));_0x46b7cd(_0x1eafca['result'][_0x53c5('0x14')]);}})[_0x53c5('0x15')](function(_0x29b7f7){logger[_0x53c5('0x12')](_0x53c5('0x13'),_0x3e7525,_0x29b7f7);_0x34b06a(_0x29b7f7);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 3749488..80b5575 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 _0x8e0d=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','put','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x253b37,_0x34107b){var _0x523716=function(_0x1b5fa6){while(--_0x1b5fa6){_0x253b37['push'](_0x253b37['shift']());}};_0x523716(++_0x34107b);}(_0x8e0d,0x82));var _0xd8e0=function(_0x3a1ea5,_0x349f01){_0x3a1ea5=_0x3a1ea5-0x0;var _0xfac9b2=_0x8e0d[_0x3a1ea5];return _0xfac9b2;};'use strict';var multer=require(_0xd8e0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd8e0('0x1'));var express=require(_0xd8e0('0x2'));var router=express['Router']();var fs_extra=require(_0xd8e0('0x3'));var auth=require(_0xd8e0('0x4'));var interaction=require(_0xd8e0('0x5'));var config=require(_0xd8e0('0x6'));var controller=require('./intServicenowAccount.controller');router['get']('/',auth[_0xd8e0('0x7')](),controller[_0xd8e0('0x8')]);router[_0xd8e0('0x9')](_0xd8e0('0xa'),auth['isAuthenticated'](),controller[_0xd8e0('0xb')]);router[_0xd8e0('0x9')](_0xd8e0('0xc'),auth[_0xd8e0('0x7')](),controller[_0xd8e0('0xd')]);router['get'](_0xd8e0('0xe'),auth['isAuthenticated'](),controller[_0xd8e0('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd8e0('0x10')]);router[_0xd8e0('0x11')](_0xd8e0('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xd8e0('0x12')]('/:id',auth[_0xd8e0('0x7')](),controller['update']);router['delete']('/:id',auth[_0xd8e0('0x7')](),controller['destroy']);module[_0xd8e0('0x13')]=router; \ No newline at end of file +var _0xc831=['getConfigurations','getFields','post','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','index','/:id','isAuthenticated','show','get','/:id/configurations'];(function(_0x49bb63,_0x48e41f){var _0x43cf32=function(_0x37e2a0){while(--_0x37e2a0){_0x49bb63['push'](_0x49bb63['shift']());}};_0x43cf32(++_0x48e41f);}(_0xc831,0x103));var _0x1c83=function(_0x5aeed6,_0x143430){_0x5aeed6=_0x5aeed6-0x0;var _0x2c1fb3=_0xc831[_0x5aeed6];return _0x2c1fb3;};'use strict';var multer=require('multer');var util=require(_0x1c83('0x0'));var path=require(_0x1c83('0x1'));var timeout=require(_0x1c83('0x2'));var express=require(_0x1c83('0x3'));var router=express[_0x1c83('0x4')]();var fs_extra=require(_0x1c83('0x5'));var auth=require(_0x1c83('0x6'));var interaction=require(_0x1c83('0x7'));var config=require(_0x1c83('0x8'));var controller=require(_0x1c83('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1c83('0xa')]);router['get'](_0x1c83('0xb'),auth[_0x1c83('0xc')](),controller[_0x1c83('0xd')]);router[_0x1c83('0xe')](_0x1c83('0xf'),auth['isAuthenticated'](),controller[_0x1c83('0x10')]);router[_0x1c83('0xe')]('/:id/fields',auth['isAuthenticated'](),controller[_0x1c83('0x11')]);router[_0x1c83('0x12')]('/',auth[_0x1c83('0xc')](),controller['create']);router[_0x1c83('0x12')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x1c83('0x13')]);router[_0x1c83('0x14')](_0x1c83('0xb'),auth[_0x1c83('0xc')](),controller[_0x1c83('0x15')]);router[_0x1c83('0x16')](_0x1c83('0xb'),auth['isAuthenticated'](),controller[_0x1c83('0x17')]);module[_0x1c83('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 89ea8fa..aa0e966 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 _0x7856=['sequelize','STRING','username','remoteUri'];(function(_0x910161,_0x4c6908){var _0x2d68d1=function(_0x2584bf){while(--_0x2584bf){_0x910161['push'](_0x910161['shift']());}};_0x2d68d1(++_0x4c6908);}(_0x7856,0x178));var _0x6785=function(_0x48965f,_0x5e02cf){_0x48965f=_0x48965f-0x0;var _0xad42e9=_0x7856[_0x48965f];return _0xad42e9;};'use strict';var Sequelize=require(_0x6785('0x0'));module['exports']={'name':{'type':Sequelize[_0x6785('0x1')]},'description':{'type':Sequelize[_0x6785('0x1')]},'username':{'type':Sequelize[_0x6785('0x1')],'unique':_0x6785('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x6785('0x1')]},'remoteUri':{'type':Sequelize[_0x6785('0x1')],'unique':_0x6785('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xb908=['STRING','username','sequelize','exports'];(function(_0x4d5d28,_0x26bd9b){var _0x2026b1=function(_0x1fe42c){while(--_0x1fe42c){_0x4d5d28['push'](_0x4d5d28['shift']());}};_0x2026b1(++_0x26bd9b);}(_0xb908,0x8a));var _0x8b90=function(_0x4327fe,_0x4f8040){_0x4327fe=_0x4327fe-0x0;var _0x138651=_0xb908[_0x4327fe];return _0x138651;};'use strict';var Sequelize=require(_0x8b90('0x0'));module[_0x8b90('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x8b90('0x2')],'unique':_0x8b90('0x3')},'password':{'type':Sequelize[_0x8b90('0x2')]},'email':{'type':Sequelize[_0x8b90('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 29b055c..43d9c8e 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 _0x4b77=['result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','boolean','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','ServicenowAccount','includeAll','include','findAll','catch','fields','find','create','body','params','ServicenowConfiguration','order','getConfigurations','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','Descriptions','getFields','hold_reason','knowledge','subcategory','notify','incident_state','category','parent','made_sla','caused_by','watch_list','sys_updated_on','child_incidents','number','resolved_by','sys_updated_by','user_input','sys_created_on','state','calendar_stc','closed_at','cmdb_ci','impact','work_notes_list','business_service','sys_domain_path','rfc','time_worked','expected_start','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','short_description','close_code','correlation_display','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','parent_incident','sys_id','contact_type','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','severity','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','sys_tags','escalation','upon_approval','correlation_id','email','serverUrl','remoteUri','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all'];(function(_0x5e42a7,_0x3eba35){var _0x36d21b=function(_0x567f0a){while(--_0x567f0a){_0x5e42a7['push'](_0x5e42a7['shift']());}};_0x36d21b(++_0x3eba35);}(_0x4b77,0xcd));var _0x74b7=function(_0x171474,_0xf87039){_0x171474=_0x171474-0x0;var _0x3969b0=_0x4b77[_0x171474];return _0x3969b0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x74b7('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x74b7('0x1'));var moment=require(_0x74b7('0x2'));var BPromise=require(_0x74b7('0x3'));var Mustache=require('mustache');var util=require(_0x74b7('0x4'));var path=require(_0x74b7('0x5'));var sox=require(_0x74b7('0x6'));var csv=require(_0x74b7('0x7'));var ejs=require(_0x74b7('0x8'));var fs=require('fs');var fs_extra=require(_0x74b7('0x9'));var _=require(_0x74b7('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x74b7('0xb'));var deskjs=require(_0x74b7('0xc'));var toCsv=require(_0x74b7('0x7'));var querystring=require(_0x74b7('0xd'));var Papa=require(_0x74b7('0xe'));var Redis=require(_0x74b7('0xf'));var authService=require(_0x74b7('0x10'));var qs=require(_0x74b7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x74b7('0x12'))(_0x74b7('0x13'));var utils=require(_0x74b7('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x74b7('0x15'))['db'];var integrations=require(_0x74b7('0x16'));function respondWithStatusCode(_0x12728a,_0x44c5b9){_0x44c5b9=_0x44c5b9||0xcc;return function(_0x1b0358){if(_0x1b0358){return _0x12728a['sendStatus'](_0x44c5b9);}return _0x12728a[_0x74b7('0x17')](_0x44c5b9)[_0x74b7('0x18')]();};}function respondWithResult(_0x4ab2e0,_0x38010d){_0x38010d=_0x38010d||0xc8;return function(_0x19b599){if(_0x19b599){return _0x4ab2e0[_0x74b7('0x17')](_0x38010d)[_0x74b7('0x19')](_0x19b599);}};}function respondWithFilteredResult(_0x3a2a40,_0x353c58){return function(_0x514417){if(_0x514417){var _0x52bcbc=typeof _0x353c58[_0x74b7('0x1a')]===_0x74b7('0x1b')&&typeof _0x353c58[_0x74b7('0x1c')]===_0x74b7('0x1b');var _0x44d2c5=_0x514417[_0x74b7('0x1d')];var _0x26cff8=_0x52bcbc?0x0:_0x353c58[_0x74b7('0x1a')];var _0x229d29=_0x52bcbc?_0x514417['count']:_0x353c58[_0x74b7('0x1a')]+_0x353c58['limit'];var _0x308be7;if(_0x229d29>=_0x44d2c5){_0x229d29=_0x44d2c5;_0x308be7=0xc8;}else{_0x308be7=0xce;}_0x3a2a40['status'](_0x308be7);return _0x3a2a40['set'](_0x74b7('0x1e'),_0x26cff8+'-'+_0x229d29+'/'+_0x44d2c5)[_0x74b7('0x19')](_0x514417);}return null;};}function patchUpdates(_0x2a5dea){return function(_0x7ec4cd){try{jsonpatch[_0x74b7('0x1f')](_0x7ec4cd,_0x2a5dea,!![]);}catch(_0x532323){return BPromise[_0x74b7('0x20')](_0x532323);}return _0x7ec4cd[_0x74b7('0x21')]();};}function saveUpdates(_0x96f0ae,_0x26964b){return function(_0x4859e3){if(_0x4859e3){return _0x4859e3[_0x74b7('0x22')](_0x96f0ae)[_0x74b7('0x23')](function(_0x506897){return _0x506897;});}return null;};}function removeEntity(_0x299ecf,_0x5acd38){return function(_0x4390d0){if(_0x4390d0){return _0x4390d0[_0x74b7('0x24')]()['then'](function(){_0x299ecf['status'](0xcc)[_0x74b7('0x18')]();});}};}function handleEntityNotFound(_0xda9b03,_0x39d041){return function(_0xfb3e2a){if(!_0xfb3e2a){_0xda9b03[_0x74b7('0x25')](0x194);}return _0xfb3e2a;};}function handleError(_0x199486,_0x403c3b){_0x403c3b=_0x403c3b||0x1f4;return function(_0x25666f){logger[_0x74b7('0x26')](_0x25666f[_0x74b7('0x27')]);if(_0x25666f[_0x74b7('0x28')]){delete _0x25666f[_0x74b7('0x28')];}_0x199486[_0x74b7('0x17')](_0x403c3b)[_0x74b7('0x29')](_0x25666f);};}exports[_0x74b7('0x2a')]=function(_0x3dd3d0,_0xca0e80){var _0x1bad54={},_0x42fba8={},_0x48623a={'count':0x0,'rows':[]};var _0x370ce2=_[_0x74b7('0x2b')](db['ServicenowAccount'][_0x74b7('0x2c')],function(_0x26bcbe){return{'name':_0x26bcbe[_0x74b7('0x2d')],'type':_0x26bcbe[_0x74b7('0x2e')]['key']};});_0x42fba8['model']=_['map'](_0x370ce2,_0x74b7('0x28'));_0x42fba8[_0x74b7('0x2f')]=_[_0x74b7('0x30')](_0x3dd3d0['query']);_0x42fba8[_0x74b7('0x31')]=_['intersection'](_0x42fba8[_0x74b7('0x32')],_0x42fba8['query']);_0x1bad54[_0x74b7('0x33')]=_[_0x74b7('0x34')](_0x42fba8['model'],qs['fields'](_0x3dd3d0[_0x74b7('0x2f')]['fields']));_0x1bad54[_0x74b7('0x33')]=_0x1bad54['attributes'][_0x74b7('0x35')]?_0x1bad54[_0x74b7('0x33')]:_0x42fba8[_0x74b7('0x32')];if(!_0x3dd3d0[_0x74b7('0x2f')][_0x74b7('0x36')](_0x74b7('0x37'))){_0x1bad54[_0x74b7('0x1c')]=qs[_0x74b7('0x1c')](_0x3dd3d0[_0x74b7('0x2f')][_0x74b7('0x1c')]);_0x1bad54['offset']=qs[_0x74b7('0x1a')](_0x3dd3d0[_0x74b7('0x2f')][_0x74b7('0x1a')]);}_0x1bad54['order']=qs[_0x74b7('0x38')](_0x3dd3d0['query'][_0x74b7('0x38')]);_0x1bad54[_0x74b7('0x39')]=qs[_0x74b7('0x31')](_[_0x74b7('0x3a')](_0x3dd3d0['query'],_0x42fba8[_0x74b7('0x31')]),_0x370ce2);if(_0x3dd3d0[_0x74b7('0x2f')][_0x74b7('0x3b')]){_0x1bad54[_0x74b7('0x39')]=_[_0x74b7('0x3c')](_0x1bad54[_0x74b7('0x39')],{'$or':_[_0x74b7('0x2b')](_0x370ce2,function(_0x35ebac){if(_0x35ebac[_0x74b7('0x2e')]!==_0x74b7('0x3d')){var _0x51dbe6={};_0x51dbe6[_0x35ebac['name']]={'$like':'%'+_0x3dd3d0['query'][_0x74b7('0x3b')]+'%'};return _0x51dbe6;}})});}_0x1bad54=_[_0x74b7('0x3c')]({},_0x1bad54,_0x3dd3d0[_0x74b7('0x3e')]);var _0xaaf989={'where':_0x1bad54[_0x74b7('0x39')]};return db[_0x74b7('0x3f')]['count'](_0xaaf989)[_0x74b7('0x23')](function(_0x30ecad){_0x48623a['count']=_0x30ecad;if(_0x3dd3d0[_0x74b7('0x2f')][_0x74b7('0x40')]){_0x1bad54[_0x74b7('0x41')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x74b7('0x42')](_0x1bad54);})[_0x74b7('0x23')](function(_0xb9e214){_0x48623a['rows']=_0xb9e214;return _0x48623a;})[_0x74b7('0x23')](respondWithFilteredResult(_0xca0e80,_0x1bad54))[_0x74b7('0x43')](handleError(_0xca0e80,null));};exports['show']=function(_0x8ea185,_0xd3a1fa){var _0x277e25={'raw':![],'where':{'id':_0x8ea185['params']['id']}},_0x1ad4f0={};_0x1ad4f0['model']=_[_0x74b7('0x30')](db[_0x74b7('0x3f')]['rawAttributes']);_0x1ad4f0['query']=_[_0x74b7('0x30')](_0x8ea185[_0x74b7('0x2f')]);_0x1ad4f0['filters']=_[_0x74b7('0x34')](_0x1ad4f0[_0x74b7('0x32')],_0x1ad4f0['query']);_0x277e25[_0x74b7('0x33')]=_[_0x74b7('0x34')](_0x1ad4f0[_0x74b7('0x32')],qs['fields'](_0x8ea185[_0x74b7('0x2f')][_0x74b7('0x44')]));_0x277e25[_0x74b7('0x33')]=_0x277e25['attributes']['length']?_0x277e25[_0x74b7('0x33')]:_0x1ad4f0[_0x74b7('0x32')];if(_0x8ea185[_0x74b7('0x2f')]['includeAll']){_0x277e25['include']=[{'all':!![]}];}_0x277e25=_[_0x74b7('0x3c')]({},_0x277e25,_0x8ea185['options']);return db['ServicenowAccount'][_0x74b7('0x45')](_0x277e25)[_0x74b7('0x23')](handleEntityNotFound(_0xd3a1fa,null))[_0x74b7('0x23')](respondWithResult(_0xd3a1fa,null))['catch'](handleError(_0xd3a1fa,null));};exports[_0x74b7('0x46')]=function(_0x554c2d,_0x174196){return db['ServicenowAccount']['create'](_0x554c2d[_0x74b7('0x47')],{})[_0x74b7('0x23')](respondWithResult(_0x174196,0xc9))[_0x74b7('0x43')](handleError(_0x174196,null));};exports[_0x74b7('0x22')]=function(_0x3e6d64,_0x204ccd){if(_0x3e6d64[_0x74b7('0x47')]['id']){delete _0x3e6d64[_0x74b7('0x47')]['id'];}return db[_0x74b7('0x3f')][_0x74b7('0x45')]({'where':{'id':_0x3e6d64['params']['id']}})[_0x74b7('0x23')](handleEntityNotFound(_0x204ccd,null))[_0x74b7('0x23')](saveUpdates(_0x3e6d64[_0x74b7('0x47')],null))['then'](respondWithResult(_0x204ccd,null))[_0x74b7('0x43')](handleError(_0x204ccd,null));};exports[_0x74b7('0x24')]=function(_0x14a78f,_0x5171a2){return db[_0x74b7('0x3f')][_0x74b7('0x45')]({'where':{'id':_0x14a78f['params']['id']}})[_0x74b7('0x23')](handleEntityNotFound(_0x5171a2,null))['then'](removeEntity(_0x5171a2,null))['catch'](handleError(_0x5171a2,null));};exports['getConfigurations']=function(_0x2a0962,_0x4afbbe,_0x3e0c83){var _0x1fa6f2={};var _0x17b9c4={};var _0x39f342;var _0x42740a;return db[_0x74b7('0x3f')]['findOne']({'where':{'id':_0x2a0962[_0x74b7('0x48')]['id']}})[_0x74b7('0x23')](handleEntityNotFound(_0x4afbbe,null))['then'](function(_0x25ad7b){if(_0x25ad7b){_0x39f342=_0x25ad7b;_0x17b9c4[_0x74b7('0x32')]=_[_0x74b7('0x30')](db[_0x74b7('0x49')][_0x74b7('0x2c')]);_0x17b9c4['query']=_['keys'](_0x2a0962[_0x74b7('0x2f')]);_0x17b9c4[_0x74b7('0x31')]=_[_0x74b7('0x34')](_0x17b9c4[_0x74b7('0x32')],_0x17b9c4[_0x74b7('0x2f')]);_0x1fa6f2[_0x74b7('0x33')]=_[_0x74b7('0x34')](_0x17b9c4['model'],qs['fields'](_0x2a0962[_0x74b7('0x2f')][_0x74b7('0x44')]));_0x1fa6f2[_0x74b7('0x33')]=_0x1fa6f2[_0x74b7('0x33')][_0x74b7('0x35')]?_0x1fa6f2['attributes']:_0x17b9c4[_0x74b7('0x32')];_0x1fa6f2[_0x74b7('0x4a')]=qs[_0x74b7('0x38')](_0x2a0962[_0x74b7('0x2f')][_0x74b7('0x38')]);_0x1fa6f2[_0x74b7('0x39')]=qs['filters'](_[_0x74b7('0x3a')](_0x2a0962['query'],_0x17b9c4[_0x74b7('0x31')]));if(_0x2a0962[_0x74b7('0x2f')][_0x74b7('0x3b')]){_0x1fa6f2[_0x74b7('0x39')]=_[_0x74b7('0x3c')](_0x1fa6f2[_0x74b7('0x39')],{'$or':_[_0x74b7('0x2b')](_0x1fa6f2[_0x74b7('0x33')],function(_0x449b81){var _0x4035c8={};_0x4035c8[_0x449b81]={'$like':'%'+_0x2a0962['query'][_0x74b7('0x3b')]+'%'};return _0x4035c8;})});}_0x1fa6f2=_[_0x74b7('0x3c')]({},_0x1fa6f2,_0x2a0962[_0x74b7('0x3e')]);return _0x39f342[_0x74b7('0x4b')](_0x1fa6f2);}})['then'](function(_0x212b96){if(_0x212b96){_0x42740a=_0x212b96['length'];if(!_0x2a0962[_0x74b7('0x2f')]['hasOwnProperty'](_0x74b7('0x37'))){_0x1fa6f2[_0x74b7('0x1c')]=qs[_0x74b7('0x1c')](_0x2a0962[_0x74b7('0x2f')][_0x74b7('0x1c')]);_0x1fa6f2[_0x74b7('0x1a')]=qs['offset'](_0x2a0962[_0x74b7('0x2f')]['offset']);}return _0x39f342[_0x74b7('0x4b')](_0x1fa6f2);}})[_0x74b7('0x23')](function(_0x4ba93e){if(_0x4ba93e){return _0x4ba93e?{'count':_0x42740a,'rows':_0x4ba93e}:null;}})[_0x74b7('0x23')](respondWithResult(_0x4afbbe,null))[_0x74b7('0x43')](handleError(_0x4afbbe,null));};exports['addConfiguration']=function(_0x597ec3,_0x3bdc81,_0x1ee1a8){if(_0x597ec3[_0x74b7('0x47')]['id']){delete _0x597ec3[_0x74b7('0x47')]['id'];}return db[_0x74b7('0x3f')][_0x74b7('0x4c')]({'where':{'id':_0x597ec3[_0x74b7('0x48')]['id']}})[_0x74b7('0x23')](handleEntityNotFound(_0x3bdc81,null))['then'](function(_0x1f9149){if(_0x1f9149){_0x597ec3[_0x74b7('0x47')][_0x74b7('0x4d')]=_0x1f9149['id'];_0x597ec3[_0x74b7('0x47')][_0x74b7('0x4e')]=integrations[_0x74b7('0x4f')](_0x597ec3[_0x74b7('0x47')][_0x74b7('0x50')],_0x597ec3[_0x74b7('0x47')][_0x74b7('0x2e')]);_0x597ec3[_0x74b7('0x47')]['Descriptions']=integrations[_0x74b7('0x51')](_0x597ec3[_0x74b7('0x47')][_0x74b7('0x50')],_0x597ec3[_0x74b7('0x47')][_0x74b7('0x2e')]);return db['ServicenowConfiguration']['create'](_0x597ec3[_0x74b7('0x47')],{'include':[{'model':db['ServicenowField'],'as':_0x74b7('0x4e')},{'model':db['ServicenowField'],'as':_0x74b7('0x52')}]});}return null;})[_0x74b7('0x23')](respondWithResult(_0x3bdc81,null))['catch'](handleError(_0x3bdc81,null));};exports[_0x74b7('0x53')]=function(_0x4045c4,_0x515fe6,_0x111a78){var _0x3a1d32=['made_sla',_0x74b7('0x54'),_0x74b7('0x55'),_0x74b7('0x56'),'close_code',_0x74b7('0x57'),_0x74b7('0x58'),'severity',_0x74b7('0x59')];var _0x164b9f=[_0x74b7('0x5a'),_0x74b7('0x5b'),_0x74b7('0x5c'),_0x74b7('0x5d'),'upon_reject',_0x74b7('0x5e'),_0x74b7('0x5f'),_0x74b7('0x54'),'approval_history',_0x74b7('0x60'),_0x74b7('0x61'),_0x74b7('0x62'),'opened_by',_0x74b7('0x63'),_0x74b7('0x64'),'sys_domain',_0x74b7('0x65'),'sys_created_by','knowledge',_0x74b7('0x4a'),_0x74b7('0x66'),_0x74b7('0x67'),_0x74b7('0x68'),'delivery_plan',_0x74b7('0x69'),'active',_0x74b7('0x6a'),_0x74b7('0x6b'),'priority',_0x74b7('0x6c'),_0x74b7('0x6d'),_0x74b7('0x6e'),_0x74b7('0x6f'),'opened_at',_0x74b7('0x70'),_0x74b7('0x71'),_0x74b7('0x72'),_0x74b7('0x73'),_0x74b7('0x74'),_0x74b7('0x75'),_0x74b7('0x76'),_0x74b7('0x56'),'work_notes',_0x74b7('0x77'),_0x74b7('0x78'),_0x74b7('0x79'),'delivery_task','work_start',_0x74b7('0x7a'),_0x74b7('0x7b'),_0x74b7('0x7c'),_0x74b7('0x7d'),_0x74b7('0x7e'),_0x74b7('0x57'),_0x74b7('0x7f'),_0x74b7('0x80'),'closed_by','follow_up',_0x74b7('0x81'),_0x74b7('0x82'),_0x74b7('0x83'),'reopened_by',_0x74b7('0x58'),_0x74b7('0x84'),_0x74b7('0x85'),_0x74b7('0x86'),_0x74b7('0x87'),_0x74b7('0x88'),_0x74b7('0x89'),_0x74b7('0x8a'),'comments',_0x74b7('0x8b'),_0x74b7('0x8c'),_0x74b7('0x8d'),_0x74b7('0x8e'),_0x74b7('0x8f'),'reopen_count',_0x74b7('0x90'),_0x74b7('0x91'),_0x74b7('0x92'),_0x74b7('0x93'),'location',_0x74b7('0x59')];var _0x2a8ee2='';var _0x3b9984='';var _0x293670=[];var _0x143b2d='';var _0x1202cd='';var _0x2af7a2=[];var _0x209a6b='';var _0x4199dc='';var _0x12c330={};var _0x485a43='';return db[_0x74b7('0x3f')][_0x74b7('0x4c')]({'where':{'id':_0x4045c4['params']['id']},'attributes':['id','username','password',_0x74b7('0x94'),'remoteUri',_0x74b7('0x95')]})['then'](handleEntityNotFound(_0x515fe6,null))[_0x74b7('0x23')](function(_0x570037){if(_0x570037){_0x485a43=_0x570037[_0x74b7('0x96')];var _0x437606=_0x485a43['slice'](-0x1);if(_0x437606==='/'){_0x485a43=_0x485a43[_0x74b7('0x97')](0x0,_0x485a43[_0x74b7('0x98')](_0x437606));}_0x4199dc=util[_0x74b7('0x99')](_0x74b7('0x9a'),_0x485a43);_0x209a6b=util['format']('%s/api/now/table/',_0x485a43);_0x12c330={'user':_0x570037['username'],'pass':_0x570037['password']};var _0x1a8ae7={'method':_0x74b7('0x9b'),'uri':_0x4199dc+_0x74b7('0x9c'),'auth':_0x12c330,'json':!![]};return rp(_0x1a8ae7);}})[_0x74b7('0x23')](function(_0x4575a1){if(_0x4575a1['result']['length']>0x0){_0x2a8ee2=_0x4575a1[_0x74b7('0x9d')];}console[_0x74b7('0x9e')](_0x74b7('0x9f'),_0x2a8ee2);_0x2af7a2=[];_0x3b9984=Object[_0x74b7('0xa0')]([],_0x2a8ee2);_[_0x74b7('0xa1')](_0x3b9984,function(_0x3f3d55){return!_0x3a1d32[_0x74b7('0xa2')](_0x3f3d55[_0x74b7('0x28')]);});_0x3b9984[_0x74b7('0xa3')](function(_0x4865fe){var _0x45e500=createFieldObject(_0x209a6b,_0x12c330,_0x4865fe[_0x74b7('0xa4')],_0x4865fe[_0x74b7('0x28')],_0x4865fe[_0x74b7('0xa5')],![]);_0x2af7a2[_0x74b7('0xa6')](_0x45e500);});return Promise[_0x74b7('0xa7')](_0x2af7a2);})[_0x74b7('0x23')](function(_0x5e85){_0x293670=_0x5e85;_0x143b2d=Object[_0x74b7('0xa0')]([],_0x2a8ee2);console['log'](_0x74b7('0xa8'),_0x2a8ee2);_[_0x74b7('0xa1')](_0x143b2d,function(_0x5513b2){return _0x164b9f[_0x74b7('0xa2')](_0x5513b2[_0x74b7('0x28')]);});console[_0x74b7('0x9e')](_0x74b7('0xa9'),_0x143b2d);_0x2af7a2=[];_0x143b2d[_0x74b7('0xa3')](function(_0x404b54){var _0x3bf86d=createFieldObject(_0x209a6b,_0x12c330,_0x404b54[_0x74b7('0xa4')],_0x404b54['name'],_0x404b54[_0x74b7('0xa5')],!![]);_0x2af7a2[_0x74b7('0xa6')](_0x3bf86d);});return Promise[_0x74b7('0xa7')](_0x2af7a2);})[_0x74b7('0x23')](function(_0x377c65){_0x1202cd=_0x377c65;var _0x9850bf=_0x293670[_0x74b7('0xaa')](_0x1202cd);return{'count':_0x9850bf[_0x74b7('0x35')],'rows':_0x9850bf};})[_0x74b7('0x23')](respondWithResult(_0x515fe6,null))[_0x74b7('0x43')](function(_0x20f270){console[_0x74b7('0x9e')](_0x74b7('0xab')+_0x20f270);var _0x27a0fc=_0x4045c4['query'][_0x74b7('0xac')]?0x1f4:_0x20f270['statusCode']||0x1f4;logger[_0x74b7('0x26')](_0x20f270['stack']);delete _0x20f270[_0x74b7('0x28')];if(_0x27a0fc===0x191){_0x27a0fc=0x190;}_0x515fe6[_0x74b7('0x17')](_0x27a0fc)[_0x74b7('0x29')](_0x4045c4[_0x74b7('0x2f')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x20f270[_0x74b7('0xad')]}:_0x20f270);});};function createFieldObject(_0x22e4ef,_0x2a2f60,_0x2ee290,_0x3865b6,_0x227131,_0x4ad935){return new Promise(function(_0x14b71a,_0x1f1df1){var _0x214e2f={'id':_0x3865b6,'name':_0x227131,'custom':_0x4ad935};if(_0x2ee290===_0x74b7('0xae')){_0x214e2f[_0x74b7('0x3e')]=[{'name':'True','value':_0x74b7('0xaf')},{'name':_0x74b7('0xb0'),'value':_0x74b7('0xb1')}];_0x14b71a(_0x214e2f);}else{var _0x172727={'method':_0x74b7('0x9b'),'uri':_0x22e4ef+_0x74b7('0xb2')+_0x3865b6,'auth':_0x2a2f60,'json':!![]};return rp(_0x172727)[_0x74b7('0x23')](function(_0x23a7db){var _0x198351=[];if(_0x23a7db[_0x74b7('0x9d')][_0x74b7('0x35')]>0x0){_0x23a7db[_0x74b7('0x9d')]['forEach'](function(_0x2af764){if(_0x2af764[_0x74b7('0xb3')]===_0x74b7('0xb1')){var _0x4ddaec={'name':_0x2af764[_0x74b7('0xa5')],'value':_0x2af764[_0x74b7('0xb4')]};_0x198351[_0x74b7('0xa6')](_0x4ddaec);}});}_0x214e2f['options']=_0x198351;if(_0x214e2f['options']['length']>0x0){_0x14b71a(_0x214e2f);}else{if(_0x4ad935==![]){_0x14b71a();}else{_0x14b71a(_0x214e2f);}}});}});} \ No newline at end of file +var _0x4a36=['approval_set','work_notes','short_description','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','calendar_duration','close_notes','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','category','username','password','remoteUri','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','assign','remove','internalType','label','push','all','includes','concat','test','stack','send','Wrong\x20credentials','statusCode','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','value','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','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','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','name','index','ServicenowAccount','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','length','include','find','create','body','params','findOne','rawAttributes','pick','getConfigurations','AccountId','Subjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','getFields','hold_reason','knowledge','close_code','notify','incident_state','severity','parent','caused_by','upon_reject','sys_updated_on','child_incidents','approval_history','number','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','active','business_service','priority','time_worked','expected_start','opened_at','business_duration','work_end','reopened_time','resolved_at','caller_id'];(function(_0x478fa5,_0x554af8){var _0x461735=function(_0x92fb17){while(--_0x92fb17){_0x478fa5['push'](_0x478fa5['shift']());}};_0x461735(++_0x554af8);}(_0x4a36,0x1a9));var _0x64a3=function(_0x4614f0,_0x19808f){_0x4614f0=_0x4614f0-0x0;var _0x421c7e=_0x4a36[_0x4614f0];return _0x421c7e;};'use strict';var emlformat=require(_0x64a3('0x0'));var rimraf=require(_0x64a3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x64a3('0x2'));var rp=require(_0x64a3('0x3'));var moment=require(_0x64a3('0x4'));var BPromise=require(_0x64a3('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x64a3('0x6'));var sox=require(_0x64a3('0x7'));var csv=require('to-csv');var ejs=require(_0x64a3('0x8'));var fs=require('fs');var fs_extra=require(_0x64a3('0x9'));var _=require('lodash');var squel=require(_0x64a3('0xa'));var crypto=require(_0x64a3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x64a3('0xc'));var toCsv=require(_0x64a3('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x64a3('0xe'));var authService=require(_0x64a3('0xf'));var qs=require(_0x64a3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x64a3('0x11'));var logger=require(_0x64a3('0x12'))(_0x64a3('0x13'));var utils=require(_0x64a3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x64a3('0x15'));var db=require(_0x64a3('0x16'))['db'];var integrations=require(_0x64a3('0x17'));function respondWithStatusCode(_0x4e0948,_0x2cc1d9){_0x2cc1d9=_0x2cc1d9||0xcc;return function(_0x9d9eff){if(_0x9d9eff){return _0x4e0948[_0x64a3('0x18')](_0x2cc1d9);}return _0x4e0948[_0x64a3('0x19')](_0x2cc1d9)[_0x64a3('0x1a')]();};}function respondWithResult(_0x414453,_0x69cbc5){_0x69cbc5=_0x69cbc5||0xc8;return function(_0x29edbd){if(_0x29edbd){return _0x414453[_0x64a3('0x19')](_0x69cbc5)[_0x64a3('0x1b')](_0x29edbd);}};}function respondWithFilteredResult(_0x51ba51,_0x468099){return function(_0x54823c){if(_0x54823c){var _0x19e357=typeof _0x468099[_0x64a3('0x1c')]==='undefined'&&typeof _0x468099[_0x64a3('0x1d')]===_0x64a3('0x1e');var _0x2bcd4c=_0x54823c[_0x64a3('0x1f')];var _0x510075=_0x19e357?0x0:_0x468099['offset'];var _0x406c7c=_0x19e357?_0x54823c[_0x64a3('0x1f')]:_0x468099['offset']+_0x468099[_0x64a3('0x1d')];var _0x112131;if(_0x406c7c>=_0x2bcd4c){_0x406c7c=_0x2bcd4c;_0x112131=0xc8;}else{_0x112131=0xce;}_0x51ba51[_0x64a3('0x19')](_0x112131);return _0x51ba51[_0x64a3('0x20')](_0x64a3('0x21'),_0x510075+'-'+_0x406c7c+'/'+_0x2bcd4c)[_0x64a3('0x1b')](_0x54823c);}return null;};}function patchUpdates(_0x322834){return function(_0x16c5b0){try{jsonpatch[_0x64a3('0x22')](_0x16c5b0,_0x322834,!![]);}catch(_0x19f95){return BPromise[_0x64a3('0x23')](_0x19f95);}return _0x16c5b0['save']();};}function saveUpdates(_0x2f923c,_0x1ee55f){return function(_0x4eb28d){if(_0x4eb28d){return _0x4eb28d[_0x64a3('0x24')](_0x2f923c)[_0x64a3('0x25')](function(_0x49c2db){return _0x49c2db;});}return null;};}function removeEntity(_0x57120d,_0x2f9148){return function(_0x3f84c1){if(_0x3f84c1){return _0x3f84c1[_0x64a3('0x26')]()[_0x64a3('0x25')](function(){_0x57120d[_0x64a3('0x19')](0xcc)[_0x64a3('0x1a')]();});}};}function handleEntityNotFound(_0x56f5d5,_0x96dc76){return function(_0x5379bb){if(!_0x5379bb){_0x56f5d5[_0x64a3('0x18')](0x194);}return _0x5379bb;};}function handleError(_0x5d46d5,_0x890339){_0x890339=_0x890339||0x1f4;return function(_0x14418c){logger[_0x64a3('0x27')](_0x14418c['stack']);if(_0x14418c[_0x64a3('0x28')]){delete _0x14418c[_0x64a3('0x28')];}_0x5d46d5[_0x64a3('0x19')](_0x890339)['send'](_0x14418c);};}exports[_0x64a3('0x29')]=function(_0x3af49e,_0x408dad){var _0x5ca123={},_0x34e91c={},_0x51715c={'count':0x0,'rows':[]};var _0x48a658=_['map'](db[_0x64a3('0x2a')]['rawAttributes'],function(_0x13cffb){return{'name':_0x13cffb['fieldName'],'type':_0x13cffb[_0x64a3('0x2b')]['key']};});_0x34e91c[_0x64a3('0x2c')]=_[_0x64a3('0x2d')](_0x48a658,_0x64a3('0x28'));_0x34e91c[_0x64a3('0x2e')]=_[_0x64a3('0x2f')](_0x3af49e[_0x64a3('0x2e')]);_0x34e91c[_0x64a3('0x30')]=_[_0x64a3('0x31')](_0x34e91c[_0x64a3('0x2c')],_0x34e91c[_0x64a3('0x2e')]);_0x5ca123[_0x64a3('0x32')]=_['intersection'](_0x34e91c['model'],qs[_0x64a3('0x33')](_0x3af49e[_0x64a3('0x2e')][_0x64a3('0x33')]));_0x5ca123['attributes']=_0x5ca123[_0x64a3('0x32')]['length']?_0x5ca123[_0x64a3('0x32')]:_0x34e91c[_0x64a3('0x2c')];if(!_0x3af49e[_0x64a3('0x2e')][_0x64a3('0x34')](_0x64a3('0x35'))){_0x5ca123['limit']=qs['limit'](_0x3af49e[_0x64a3('0x2e')][_0x64a3('0x1d')]);_0x5ca123['offset']=qs[_0x64a3('0x1c')](_0x3af49e[_0x64a3('0x2e')][_0x64a3('0x1c')]);}_0x5ca123[_0x64a3('0x36')]=qs[_0x64a3('0x37')](_0x3af49e[_0x64a3('0x2e')][_0x64a3('0x37')]);_0x5ca123[_0x64a3('0x38')]=qs[_0x64a3('0x30')](_['pick'](_0x3af49e[_0x64a3('0x2e')],_0x34e91c[_0x64a3('0x30')]),_0x48a658);if(_0x3af49e[_0x64a3('0x2e')][_0x64a3('0x39')]){_0x5ca123[_0x64a3('0x38')]=_['merge'](_0x5ca123['where'],{'$or':_[_0x64a3('0x2d')](_0x48a658,function(_0x1810fc){if(_0x1810fc['type']!==_0x64a3('0x3a')){var _0x426fed={};_0x426fed[_0x1810fc[_0x64a3('0x28')]]={'$like':'%'+_0x3af49e['query'][_0x64a3('0x39')]+'%'};return _0x426fed;}})});}_0x5ca123=_[_0x64a3('0x3b')]({},_0x5ca123,_0x3af49e[_0x64a3('0x3c')]);var _0x37c8b3={'where':_0x5ca123['where']};return db[_0x64a3('0x2a')][_0x64a3('0x1f')](_0x37c8b3)[_0x64a3('0x25')](function(_0x2f43c3){_0x51715c[_0x64a3('0x1f')]=_0x2f43c3;if(_0x3af49e[_0x64a3('0x2e')][_0x64a3('0x3d')]){_0x5ca123['include']=[{'all':!![]}];}return db[_0x64a3('0x2a')][_0x64a3('0x3e')](_0x5ca123);})['then'](function(_0x2554d2){_0x51715c[_0x64a3('0x3f')]=_0x2554d2;return _0x51715c;})[_0x64a3('0x25')](respondWithFilteredResult(_0x408dad,_0x5ca123))[_0x64a3('0x40')](handleError(_0x408dad,null));};exports[_0x64a3('0x41')]=function(_0x2da601,_0x235d36){var _0x1b0c0a={'raw':![],'where':{'id':_0x2da601['params']['id']}},_0x2d1115={};_0x2d1115[_0x64a3('0x2c')]=_[_0x64a3('0x2f')](db[_0x64a3('0x2a')]['rawAttributes']);_0x2d1115['query']=_[_0x64a3('0x2f')](_0x2da601[_0x64a3('0x2e')]);_0x2d1115[_0x64a3('0x30')]=_[_0x64a3('0x31')](_0x2d1115[_0x64a3('0x2c')],_0x2d1115[_0x64a3('0x2e')]);_0x1b0c0a['attributes']=_[_0x64a3('0x31')](_0x2d1115['model'],qs['fields'](_0x2da601[_0x64a3('0x2e')][_0x64a3('0x33')]));_0x1b0c0a['attributes']=_0x1b0c0a['attributes'][_0x64a3('0x42')]?_0x1b0c0a[_0x64a3('0x32')]:_0x2d1115[_0x64a3('0x2c')];if(_0x2da601['query'][_0x64a3('0x3d')]){_0x1b0c0a[_0x64a3('0x43')]=[{'all':!![]}];}_0x1b0c0a=_['merge']({},_0x1b0c0a,_0x2da601[_0x64a3('0x3c')]);return db[_0x64a3('0x2a')][_0x64a3('0x44')](_0x1b0c0a)['then'](handleEntityNotFound(_0x235d36,null))[_0x64a3('0x25')](respondWithResult(_0x235d36,null))[_0x64a3('0x40')](handleError(_0x235d36,null));};exports[_0x64a3('0x45')]=function(_0x2dd47b,_0x13d2f6){return db[_0x64a3('0x2a')][_0x64a3('0x45')](_0x2dd47b[_0x64a3('0x46')],{})['then'](respondWithResult(_0x13d2f6,0xc9))['catch'](handleError(_0x13d2f6,null));};exports[_0x64a3('0x24')]=function(_0x222a06,_0x12a49d){if(_0x222a06[_0x64a3('0x46')]['id']){delete _0x222a06[_0x64a3('0x46')]['id'];}return db[_0x64a3('0x2a')]['find']({'where':{'id':_0x222a06[_0x64a3('0x47')]['id']}})['then'](handleEntityNotFound(_0x12a49d,null))[_0x64a3('0x25')](saveUpdates(_0x222a06[_0x64a3('0x46')],null))[_0x64a3('0x25')](respondWithResult(_0x12a49d,null))[_0x64a3('0x40')](handleError(_0x12a49d,null));};exports[_0x64a3('0x26')]=function(_0x544de4,_0x15aada){return db[_0x64a3('0x2a')]['find']({'where':{'id':_0x544de4[_0x64a3('0x47')]['id']}})[_0x64a3('0x25')](handleEntityNotFound(_0x15aada,null))[_0x64a3('0x25')](removeEntity(_0x15aada,null))['catch'](handleError(_0x15aada,null));};exports['getConfigurations']=function(_0x40f266,_0x2b7c6c,_0x4ae51b){var _0x139642={};var _0x29cede={};var _0x369da4;var _0x30de68;return db[_0x64a3('0x2a')][_0x64a3('0x48')]({'where':{'id':_0x40f266[_0x64a3('0x47')]['id']}})['then'](handleEntityNotFound(_0x2b7c6c,null))[_0x64a3('0x25')](function(_0x27d7f2){if(_0x27d7f2){_0x369da4=_0x27d7f2;_0x29cede[_0x64a3('0x2c')]=_[_0x64a3('0x2f')](db['ServicenowConfiguration'][_0x64a3('0x49')]);_0x29cede[_0x64a3('0x2e')]=_[_0x64a3('0x2f')](_0x40f266['query']);_0x29cede['filters']=_[_0x64a3('0x31')](_0x29cede['model'],_0x29cede[_0x64a3('0x2e')]);_0x139642[_0x64a3('0x32')]=_[_0x64a3('0x31')](_0x29cede[_0x64a3('0x2c')],qs[_0x64a3('0x33')](_0x40f266['query'][_0x64a3('0x33')]));_0x139642[_0x64a3('0x32')]=_0x139642[_0x64a3('0x32')]['length']?_0x139642[_0x64a3('0x32')]:_0x29cede['model'];_0x139642['order']=qs[_0x64a3('0x37')](_0x40f266['query'][_0x64a3('0x37')]);_0x139642[_0x64a3('0x38')]=qs[_0x64a3('0x30')](_[_0x64a3('0x4a')](_0x40f266[_0x64a3('0x2e')],_0x29cede[_0x64a3('0x30')]));if(_0x40f266[_0x64a3('0x2e')][_0x64a3('0x39')]){_0x139642[_0x64a3('0x38')]=_[_0x64a3('0x3b')](_0x139642[_0x64a3('0x38')],{'$or':_[_0x64a3('0x2d')](_0x139642[_0x64a3('0x32')],function(_0xf2cc9a){var _0x32c03c={};_0x32c03c[_0xf2cc9a]={'$like':'%'+_0x40f266[_0x64a3('0x2e')][_0x64a3('0x39')]+'%'};return _0x32c03c;})});}_0x139642=_['merge']({},_0x139642,_0x40f266['options']);return _0x369da4[_0x64a3('0x4b')](_0x139642);}})['then'](function(_0x456321){if(_0x456321){_0x30de68=_0x456321[_0x64a3('0x42')];if(!_0x40f266['query'][_0x64a3('0x34')]('nolimit')){_0x139642[_0x64a3('0x1d')]=qs['limit'](_0x40f266['query'][_0x64a3('0x1d')]);_0x139642['offset']=qs['offset'](_0x40f266[_0x64a3('0x2e')]['offset']);}return _0x369da4[_0x64a3('0x4b')](_0x139642);}})['then'](function(_0x235666){if(_0x235666){return _0x235666?{'count':_0x30de68,'rows':_0x235666}:null;}})[_0x64a3('0x25')](respondWithResult(_0x2b7c6c,null))[_0x64a3('0x40')](handleError(_0x2b7c6c,null));};exports['addConfiguration']=function(_0x15691e,_0x163c1f,_0x10be8a){if(_0x15691e[_0x64a3('0x46')]['id']){delete _0x15691e[_0x64a3('0x46')]['id'];}return db['ServicenowAccount'][_0x64a3('0x48')]({'where':{'id':_0x15691e[_0x64a3('0x47')]['id']}})['then'](handleEntityNotFound(_0x163c1f,null))[_0x64a3('0x25')](function(_0x1432f2){if(_0x1432f2){_0x15691e['body'][_0x64a3('0x4c')]=_0x1432f2['id'];_0x15691e[_0x64a3('0x46')][_0x64a3('0x4d')]=integrations['getSubjects'](_0x15691e[_0x64a3('0x46')][_0x64a3('0x4e')],_0x15691e[_0x64a3('0x46')]['type']);_0x15691e[_0x64a3('0x46')][_0x64a3('0x4f')]=integrations[_0x64a3('0x50')](_0x15691e[_0x64a3('0x46')][_0x64a3('0x4e')],_0x15691e[_0x64a3('0x46')][_0x64a3('0x2b')]);return db[_0x64a3('0x51')]['create'](_0x15691e[_0x64a3('0x46')],{'include':[{'model':db[_0x64a3('0x52')],'as':_0x64a3('0x4d')},{'model':db[_0x64a3('0x52')],'as':_0x64a3('0x4f')}]});}return null;})[_0x64a3('0x25')](respondWithResult(_0x163c1f,null))[_0x64a3('0x40')](handleError(_0x163c1f,null));};exports[_0x64a3('0x53')]=function(_0x28269c,_0x1bb625,_0x286041){var _0x224f1f=['made_sla',_0x64a3('0x54'),_0x64a3('0x55'),'subcategory',_0x64a3('0x56'),_0x64a3('0x57'),_0x64a3('0x58'),_0x64a3('0x59'),'category'];var _0x40422c=[_0x64a3('0x5a'),'made_sla',_0x64a3('0x5b'),'watch_list',_0x64a3('0x5c'),_0x64a3('0x5d'),_0x64a3('0x5e'),_0x64a3('0x54'),_0x64a3('0x5f'),_0x64a3('0x60'),'resolved_by',_0x64a3('0x61'),_0x64a3('0x62'),_0x64a3('0x63'),_0x64a3('0x64'),_0x64a3('0x65'),_0x64a3('0x66'),_0x64a3('0x67'),_0x64a3('0x55'),_0x64a3('0x36'),'calendar_stc',_0x64a3('0x68'),_0x64a3('0x69'),_0x64a3('0x6a'),'impact',_0x64a3('0x6b'),'work_notes_list',_0x64a3('0x6c'),_0x64a3('0x6d'),'sys_domain_path','rfc',_0x64a3('0x6e'),_0x64a3('0x6f'),_0x64a3('0x70'),_0x64a3('0x71'),'group_list',_0x64a3('0x72'),_0x64a3('0x73'),_0x64a3('0x74'),_0x64a3('0x75'),_0x64a3('0x76'),'subcategory',_0x64a3('0x77'),_0x64a3('0x78'),_0x64a3('0x56'),'correlation_display',_0x64a3('0x79'),_0x64a3('0x7a'),_0x64a3('0x7b'),_0x64a3('0x7c'),_0x64a3('0x7d'),'description',_0x64a3('0x7e'),_0x64a3('0x57'),'sys_class_name',_0x64a3('0x7f'),'closed_by',_0x64a3('0x80'),_0x64a3('0x81'),_0x64a3('0x82'),_0x64a3('0x83'),_0x64a3('0x84'),'incident_state',_0x64a3('0x85'),_0x64a3('0x86'),_0x64a3('0x87'),_0x64a3('0x88'),_0x64a3('0x89'),_0x64a3('0x8a'),_0x64a3('0x59'),_0x64a3('0x8b'),'sla_due','approval',_0x64a3('0x8c'),_0x64a3('0x8d'),_0x64a3('0x8e'),_0x64a3('0x8f'),'sys_tags',_0x64a3('0x90'),_0x64a3('0x91'),'correlation_id','location',_0x64a3('0x92')];var _0x1ae93d='';var _0xd4c8a6='';var _0x2d27ff=[];var _0x1156aa='';var _0x2b2a0a='';var _0x348f58=[];var _0x5d2a21='';var _0x133da2='';var _0x54aa00={};var _0x1b0569='';return db[_0x64a3('0x2a')][_0x64a3('0x48')]({'where':{'id':_0x28269c[_0x64a3('0x47')]['id']},'attributes':['id',_0x64a3('0x93'),_0x64a3('0x94'),'email',_0x64a3('0x95'),_0x64a3('0x96')]})[_0x64a3('0x25')](handleEntityNotFound(_0x1bb625,null))[_0x64a3('0x25')](function(_0x4e5dbd){if(_0x4e5dbd){_0x1b0569=_0x4e5dbd[_0x64a3('0x95')];var _0x4fb19a=_0x1b0569[_0x64a3('0x97')](-0x1);if(_0x4fb19a==='/'){_0x1b0569=_0x1b0569[_0x64a3('0x98')](0x0,_0x1b0569[_0x64a3('0x99')](_0x4fb19a));}_0x133da2=util['format'](_0x64a3('0x9a'),_0x1b0569);_0x5d2a21=util[_0x64a3('0x9b')](_0x64a3('0x9c'),_0x1b0569);_0x54aa00={'user':_0x4e5dbd[_0x64a3('0x93')],'pass':_0x4e5dbd[_0x64a3('0x94')]};var _0x14ef5f={'method':_0x64a3('0x9d'),'uri':_0x133da2+_0x64a3('0x9e'),'auth':_0x54aa00,'json':!![]};return rp(_0x14ef5f);}})['then'](function(_0x5841ea){if(_0x5841ea[_0x64a3('0x9f')]['length']>0x0){_0x1ae93d=_0x5841ea[_0x64a3('0x9f')];}console[_0x64a3('0xa0')]('incident\x20table\x20objects',_0x1ae93d);_0x348f58=[];_0xd4c8a6=Object[_0x64a3('0xa1')]([],_0x1ae93d);_[_0x64a3('0xa2')](_0xd4c8a6,function(_0x452f1e){return!_0x224f1f['includes'](_0x452f1e[_0x64a3('0x28')]);});_0xd4c8a6['forEach'](function(_0x4ba6b3){var _0x30d41b=createFieldObject(_0x5d2a21,_0x54aa00,_0x4ba6b3[_0x64a3('0xa3')],_0x4ba6b3[_0x64a3('0x28')],_0x4ba6b3[_0x64a3('0xa4')],![]);_0x348f58[_0x64a3('0xa5')](_0x30d41b);});return Promise[_0x64a3('0xa6')](_0x348f58);})['then'](function(_0x2830b8){_0x2d27ff=_0x2830b8;_0x1156aa=Object['assign']([],_0x1ae93d);console['log']('TCL:\x20_object',_0x1ae93d);_[_0x64a3('0xa2')](_0x1156aa,function(_0x3db5e5){return _0x40422c[_0x64a3('0xa7')](_0x3db5e5['name']);});console[_0x64a3('0xa0')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x1156aa);_0x348f58=[];_0x1156aa['forEach'](function(_0x5a32c3){var _0x1dbd40=createFieldObject(_0x5d2a21,_0x54aa00,_0x5a32c3[_0x64a3('0xa3')],_0x5a32c3[_0x64a3('0x28')],_0x5a32c3[_0x64a3('0xa4')],!![]);_0x348f58[_0x64a3('0xa5')](_0x1dbd40);});return Promise[_0x64a3('0xa6')](_0x348f58);})[_0x64a3('0x25')](function(_0x14f0f9){_0x2b2a0a=_0x14f0f9;var _0x39ec10=_0x2d27ff[_0x64a3('0xa8')](_0x2b2a0a);return{'count':_0x39ec10[_0x64a3('0x42')],'rows':_0x39ec10};})[_0x64a3('0x25')](respondWithResult(_0x1bb625,null))[_0x64a3('0x40')](function(_0x25bc9b){console['log']('ServiceNow\x20error:\x20'+_0x25bc9b);var _0xa1a251=_0x28269c[_0x64a3('0x2e')][_0x64a3('0xa9')]?0x1f4:_0x25bc9b['statusCode']||0x1f4;logger[_0x64a3('0x27')](_0x25bc9b[_0x64a3('0xaa')]);delete _0x25bc9b[_0x64a3('0x28')];if(_0xa1a251===0x191){_0xa1a251=0x190;}_0x1bb625[_0x64a3('0x19')](_0xa1a251)[_0x64a3('0xab')](_0x28269c[_0x64a3('0x2e')]['test']?{'message':_0x64a3('0xac'),'statusCode':_0x25bc9b[_0x64a3('0xad')]}:_0x25bc9b);});};function createFieldObject(_0x232544,_0x3602ce,_0x9bbf14,_0x8d8b15,_0x3e9558,_0x34c7ba){return new Promise(function(_0x1c60bd,_0x344862){var _0x1c2025={'id':_0x8d8b15,'name':_0x3e9558,'custom':_0x34c7ba};if(_0x9bbf14===_0x64a3('0xae')){_0x1c2025[_0x64a3('0x3c')]=[{'name':_0x64a3('0xaf'),'value':_0x64a3('0xb0')},{'name':_0x64a3('0xb1'),'value':_0x64a3('0xb2')}];_0x1c60bd(_0x1c2025);}else{var _0x232daa={'method':_0x64a3('0x9d'),'uri':_0x232544+_0x64a3('0xb3')+_0x8d8b15,'auth':_0x3602ce,'json':!![]};return rp(_0x232daa)[_0x64a3('0x25')](function(_0x52920a){var _0x54b1db=[];if(_0x52920a[_0x64a3('0x9f')][_0x64a3('0x42')]>0x0){_0x52920a[_0x64a3('0x9f')]['forEach'](function(_0x2ea09c){if(_0x2ea09c['inactive']===_0x64a3('0xb2')){var _0x4534c6={'name':_0x2ea09c[_0x64a3('0xa4')],'value':_0x2ea09c[_0x64a3('0xb4')]};_0x54b1db[_0x64a3('0xa5')](_0x4534c6);}});}_0x1c2025[_0x64a3('0x3c')]=_0x54b1db;if(_0x1c2025[_0x64a3('0x3c')][_0x64a3('0x42')]>0x0){_0x1c60bd(_0x1c2025);}else{if(_0x34c7ba==![]){_0x1c60bd();}else{_0x1c60bd(_0x1c2025);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index e759cb4..9586ae6 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 _0x6f47=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','define','int_servicenow_accounts','util'];(function(_0x216f98,_0x470c7f){var _0xea6b36=function(_0x38f18c){while(--_0x38f18c){_0x216f98['push'](_0x216f98['shift']());}};_0xea6b36(++_0x470c7f);}(_0x6f47,0xc7));var _0x76f4=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x6f47[_0x75f869];return _0x10af8b;};'use strict';var _=require('lodash');var util=require(_0x76f4('0x0'));var logger=require(_0x76f4('0x1'))('api');var moment=require(_0x76f4('0x2'));var BPromise=require('bluebird');var rp=require(_0x76f4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x76f4('0x4'));var config=require(_0x76f4('0x5'));var attributes=require(_0x76f4('0x6'));var integrations=require(_0x76f4('0x7'));module['exports']=function(_0x35602f,_0xfc2405){return _0x35602f[_0x76f4('0x8')]('ServicenowAccount',attributes,{'tableName':_0x76f4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fab=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts'];(function(_0x4e46fd,_0x5993bb){var _0x4dc5cf=function(_0xb9c857){while(--_0xb9c857){_0x4e46fd['push'](_0x4e46fd['shift']());}};_0x4dc5cf(++_0x5993bb);}(_0x5fab,0x177));var _0xb5fa=function(_0x20ebb9,_0x3535bb){_0x20ebb9=_0x20ebb9-0x0;var _0x1ec31d=_0x5fab[_0x20ebb9];return _0x1ec31d;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));var integrations=require(_0xb5fa('0xa'));module[_0xb5fa('0xb')]=function(_0x4a0249,_0x5d70f6){return _0x4a0249[_0xb5fa('0xc')](_0xb5fa('0xd'),attributes,{'tableName':_0xb5fa('0xe'),'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 e32d4bb..fac9d08 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 _0x1c3b=['then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','attributes','limit','include','map','model','debug','ShowServicenowAccount','where','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x1c3b,0xd1));var _0xb1c3=function(_0x588172,_0x293724){_0x588172=_0x588172-0x0;var _0x12ef02=_0x1c3b[_0x588172];return _0x12ef02;};'use strict';var _=require('lodash');var util=require(_0xb1c3('0x0'));var moment=require('moment');var BPromise=require(_0xb1c3('0x1'));var rs=require(_0xb1c3('0x2'));var fs=require('fs');var Redis=require(_0xb1c3('0x3'));var db=require(_0xb1c3('0x4'))['db'];var utils=require(_0xb1c3('0x5'));var logger=require(_0xb1c3('0x6'))(_0xb1c3('0x7'));var config=require(_0xb1c3('0x8'));var jayson=require(_0xb1c3('0x9'));var client=jayson[_0xb1c3('0xa')][_0xb1c3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2814fe,_0x2b92da,_0x3bfce4){return new BPromise(function(_0x5d683b,_0x448128){return client[_0xb1c3('0xc')](_0x2814fe,_0x3bfce4)[_0xb1c3('0xd')](function(_0x76b21f){logger[_0xb1c3('0xe')](_0xb1c3('0xf'),_0x2b92da,_0xb1c3('0x10'));logger['debug'](_0xb1c3('0x11'),_0x2b92da,_0xb1c3('0x10'),JSON[_0xb1c3('0x12')](_0x76b21f));if(_0x76b21f['error']){if(_0x76b21f['error'][_0xb1c3('0x13')]===0x1f4){logger[_0xb1c3('0x14')]('ServicenowAccount,\x20%s,\x20%s',_0x2b92da,_0x76b21f[_0xb1c3('0x14')][_0xb1c3('0x15')]);return _0x448128(_0x76b21f[_0xb1c3('0x14')]['message']);}logger['error'](_0xb1c3('0xf'),_0x2b92da,_0x76b21f[_0xb1c3('0x14')]['message']);return _0x5d683b(_0x76b21f[_0xb1c3('0x14')]['message']);}else{logger['info'](_0xb1c3('0xf'),_0x2b92da,'request\x20sent');_0x5d683b(_0x76b21f[_0xb1c3('0x16')]['message']);}})[_0xb1c3('0x17')](function(_0x439954){logger[_0xb1c3('0x14')](_0xb1c3('0xf'),_0x2b92da,_0x439954);_0x448128(_0x439954);});});}exports[_0xb1c3('0x18')]=function(_0x3aa891){var _0x1a2f59=this;return new Promise(function(_0x180886,_0x58ea8f){return db[_0xb1c3('0x19')][_0xb1c3('0x1a')]({'raw':_0x3aa891[_0xb1c3('0x1b')]?_0x3aa891[_0xb1c3('0x1b')][_0xb1c3('0x1c')]===undefined?!![]:![]:!![],'where':_0x3aa891[_0xb1c3('0x1b')]?_0x3aa891[_0xb1c3('0x1b')]['where']||null:null,'attributes':_0x3aa891[_0xb1c3('0x1b')]?_0x3aa891[_0xb1c3('0x1b')][_0xb1c3('0x1d')]||null:null,'limit':_0x3aa891[_0xb1c3('0x1b')]?_0x3aa891[_0xb1c3('0x1b')][_0xb1c3('0x1e')]||null:null,'include':_0x3aa891['options']?_0x3aa891['options'][_0xb1c3('0x1f')]?_[_0xb1c3('0x20')](_0x3aa891[_0xb1c3('0x1b')]['include'],function(_0x4bf386){return{'model':db[_0x4bf386[_0xb1c3('0x21')]],'as':_0x4bf386['as'],'attributes':_0x4bf386[_0xb1c3('0x1d')],'include':_0x4bf386[_0xb1c3('0x1f')]?_['map'](_0x4bf386[_0xb1c3('0x1f')],function(_0x42e5b5){return{'model':db[_0x42e5b5[_0xb1c3('0x21')]],'as':_0x42e5b5['as'],'attributes':_0x42e5b5[_0xb1c3('0x1d')],'include':_0x42e5b5[_0xb1c3('0x1f')]?_[_0xb1c3('0x20')](_0x42e5b5['include'],function(_0x1f2d55){return{'model':db[_0x1f2d55['model']],'as':_0x1f2d55['as'],'attributes':_0x1f2d55[_0xb1c3('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb1c3('0xd')](function(_0x3009d9){logger[_0xb1c3('0xe')](_0xb1c3('0x18'),_0x3aa891);logger[_0xb1c3('0x22')]('GetServicenowAccount',_0x3aa891,JSON['stringify'](_0x3009d9));_0x180886(_0x3009d9);})[_0xb1c3('0x17')](function(_0x3cd00a){logger['error']('GetServicenowAccount',_0x3cd00a[_0xb1c3('0x15')],_0x3aa891);_0x58ea8f(_0x1a2f59['error'](0x1f4,_0x3cd00a[_0xb1c3('0x15')]));});});};exports[_0xb1c3('0x23')]=function(_0x96128d){var _0x1bda02=this;return new Promise(function(_0x59b8ce,_0x2bc01b){return db[_0xb1c3('0x19')]['find']({'raw':_0x96128d[_0xb1c3('0x1b')]?_0x96128d['options']['raw']===undefined?!![]:![]:!![],'where':_0x96128d[_0xb1c3('0x1b')]?_0x96128d['options'][_0xb1c3('0x24')]||null:null,'attributes':_0x96128d[_0xb1c3('0x1b')]?_0x96128d[_0xb1c3('0x1b')]['attributes']||null:null,'include':_0x96128d[_0xb1c3('0x1b')]?_0x96128d[_0xb1c3('0x1b')][_0xb1c3('0x1f')]?_[_0xb1c3('0x20')](_0x96128d[_0xb1c3('0x1b')]['include'],function(_0x54659f){return{'model':db[_0x54659f['model']],'as':_0x54659f['as'],'attributes':_0x54659f[_0xb1c3('0x1d')],'include':_0x54659f['include']?_[_0xb1c3('0x20')](_0x54659f[_0xb1c3('0x1f')],function(_0x5155a2){return{'model':db[_0x5155a2['model']],'as':_0x5155a2['as'],'attributes':_0x5155a2[_0xb1c3('0x1d')],'include':_0x5155a2[_0xb1c3('0x1f')]?_[_0xb1c3('0x20')](_0x5155a2[_0xb1c3('0x1f')],function(_0x43af64){return{'model':db[_0x43af64[_0xb1c3('0x21')]],'as':_0x43af64['as'],'attributes':_0x43af64[_0xb1c3('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x19ac4f){logger[_0xb1c3('0xe')](_0xb1c3('0x23'),_0x96128d);logger[_0xb1c3('0x22')](_0xb1c3('0x23'),_0x96128d,JSON[_0xb1c3('0x12')](_0x19ac4f));_0x59b8ce(_0x19ac4f);})[_0xb1c3('0x17')](function(_0x4c8e5e){logger[_0xb1c3('0x14')](_0xb1c3('0x23'),_0x4c8e5e[_0xb1c3('0x15')],_0x96128d);_0x2bc01b(_0x1bda02[_0xb1c3('0x14')](0x1f4,_0x4c8e5e['message']));});});}; \ No newline at end of file +var _0xb69d=['message','GetServicenowAccount','options','raw','where','attributes','include','model','map','catch','ShowServicenowAccount','ServicenowAccount','stringify','util','moment','randomstring','ioredis','../../mysqldb','http','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','ServicenowAccount,\x20%s,\x20%s'];(function(_0x544490,_0x31c10d){var _0x126307=function(_0x18e068){while(--_0x18e068){_0x544490['push'](_0x544490['shift']());}};_0x126307(++_0x31c10d);}(_0xb69d,0x15f));var _0xdb69=function(_0x28cdfd,_0x2c81fe){_0x28cdfd=_0x28cdfd-0x0;var _0x143f2f=_0xb69d[_0x28cdfd];return _0x143f2f;};'use strict';var _=require('lodash');var util=require(_0xdb69('0x0'));var moment=require(_0xdb69('0x1'));var BPromise=require('bluebird');var rs=require(_0xdb69('0x2'));var fs=require('fs');var Redis=require(_0xdb69('0x3'));var db=require(_0xdb69('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['client'][_0xdb69('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x2d0ce2,_0x29d0a2,_0x32020f){return new BPromise(function(_0x12af13,_0x2fef48){return client['request'](_0x2d0ce2,_0x32020f)[_0xdb69('0x6')](function(_0x5426f7){logger[_0xdb69('0x7')]('ServicenowAccount,\x20%s,\x20%s',_0x29d0a2,_0xdb69('0x8'));logger[_0xdb69('0x9')](_0xdb69('0xa'),_0x29d0a2,_0xdb69('0x8'),JSON['stringify'](_0x5426f7));if(_0x5426f7['error']){if(_0x5426f7['error']['code']===0x1f4){logger[_0xdb69('0xb')](_0xdb69('0xc'),_0x29d0a2,_0x5426f7[_0xdb69('0xb')]['message']);return _0x2fef48(_0x5426f7[_0xdb69('0xb')][_0xdb69('0xd')]);}logger[_0xdb69('0xb')](_0xdb69('0xc'),_0x29d0a2,_0x5426f7[_0xdb69('0xb')]['message']);return _0x12af13(_0x5426f7['error'][_0xdb69('0xd')]);}else{logger[_0xdb69('0x7')](_0xdb69('0xc'),_0x29d0a2,_0xdb69('0x8'));_0x12af13(_0x5426f7['result']['message']);}})['catch'](function(_0x1d7613){logger[_0xdb69('0xb')](_0xdb69('0xc'),_0x29d0a2,_0x1d7613);_0x2fef48(_0x1d7613);});});}exports[_0xdb69('0xe')]=function(_0x11b79b){var _0x3eef18=this;return new Promise(function(_0x2a2675,_0x1ab78a){return db['ServicenowAccount']['findAll']({'raw':_0x11b79b['options']?_0x11b79b[_0xdb69('0xf')][_0xdb69('0x10')]===undefined?!![]:![]:!![],'where':_0x11b79b['options']?_0x11b79b[_0xdb69('0xf')][_0xdb69('0x11')]||null:null,'attributes':_0x11b79b[_0xdb69('0xf')]?_0x11b79b[_0xdb69('0xf')][_0xdb69('0x12')]||null:null,'limit':_0x11b79b['options']?_0x11b79b[_0xdb69('0xf')]['limit']||null:null,'include':_0x11b79b['options']?_0x11b79b['options'][_0xdb69('0x13')]?_['map'](_0x11b79b[_0xdb69('0xf')][_0xdb69('0x13')],function(_0x2bdacd){return{'model':db[_0x2bdacd[_0xdb69('0x14')]],'as':_0x2bdacd['as'],'attributes':_0x2bdacd['attributes'],'include':_0x2bdacd[_0xdb69('0x13')]?_['map'](_0x2bdacd[_0xdb69('0x13')],function(_0x4e5846){return{'model':db[_0x4e5846[_0xdb69('0x14')]],'as':_0x4e5846['as'],'attributes':_0x4e5846[_0xdb69('0x12')],'include':_0x4e5846['include']?_[_0xdb69('0x15')](_0x4e5846['include'],function(_0x233c22){return{'model':db[_0x233c22[_0xdb69('0x14')]],'as':_0x233c22['as'],'attributes':_0x233c22[_0xdb69('0x12')]};}):[]};}):[]};}):[]:[]})[_0xdb69('0x6')](function(_0x11007d){logger[_0xdb69('0x7')](_0xdb69('0xe'),_0x11b79b);logger[_0xdb69('0x9')](_0xdb69('0xe'),_0x11b79b,JSON['stringify'](_0x11007d));_0x2a2675(_0x11007d);})[_0xdb69('0x16')](function(_0x12efa9){logger['error']('GetServicenowAccount',_0x12efa9[_0xdb69('0xd')],_0x11b79b);_0x1ab78a(_0x3eef18['error'](0x1f4,_0x12efa9['message']));});});};exports[_0xdb69('0x17')]=function(_0x35fd32){var _0x370816=this;return new Promise(function(_0x19657d,_0x350b7b){return db[_0xdb69('0x18')]['find']({'raw':_0x35fd32['options']?_0x35fd32[_0xdb69('0xf')][_0xdb69('0x10')]===undefined?!![]:![]:!![],'where':_0x35fd32['options']?_0x35fd32[_0xdb69('0xf')][_0xdb69('0x11')]||null:null,'attributes':_0x35fd32['options']?_0x35fd32[_0xdb69('0xf')][_0xdb69('0x12')]||null:null,'include':_0x35fd32['options']?_0x35fd32[_0xdb69('0xf')][_0xdb69('0x13')]?_['map'](_0x35fd32[_0xdb69('0xf')][_0xdb69('0x13')],function(_0x3ff174){return{'model':db[_0x3ff174[_0xdb69('0x14')]],'as':_0x3ff174['as'],'attributes':_0x3ff174[_0xdb69('0x12')],'include':_0x3ff174[_0xdb69('0x13')]?_[_0xdb69('0x15')](_0x3ff174['include'],function(_0x18fc85){return{'model':db[_0x18fc85['model']],'as':_0x18fc85['as'],'attributes':_0x18fc85['attributes'],'include':_0x18fc85['include']?_[_0xdb69('0x15')](_0x18fc85[_0xdb69('0x13')],function(_0x1e71c8){return{'model':db[_0x1e71c8[_0xdb69('0x14')]],'as':_0x1e71c8['as'],'attributes':_0x1e71c8[_0xdb69('0x12')]};}):[]};}):[]};}):[]:[]})[_0xdb69('0x6')](function(_0x155db6){logger['info'](_0xdb69('0x17'),_0x35fd32);logger[_0xdb69('0x9')](_0xdb69('0x17'),_0x35fd32,JSON[_0xdb69('0x19')](_0x155db6));_0x19657d(_0x155db6);})[_0xdb69('0x16')](function(_0x3e893d){logger[_0xdb69('0xb')]('ShowServicenowAccount',_0x3e893d[_0xdb69('0xd')],_0x35fd32);_0x350b7b(_0x370816[_0xdb69('0xb')](0x1f4,_0x3e893d[_0xdb69('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index cfa2150..c39a962 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 _0xa3b9=['index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa3b9,0x6d));var _0x9a3b=function(_0x36e5f8,_0x3dca06){_0x36e5f8=_0x36e5f8-0x0;var _0x92254a=_0xa3b9[_0x36e5f8];return _0x92254a;};'use strict';var multer=require(_0x9a3b('0x0'));var util=require(_0x9a3b('0x1'));var path=require(_0x9a3b('0x2'));var timeout=require(_0x9a3b('0x3'));var express=require('express');var router=express[_0x9a3b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9a3b('0x5'));var interaction=require(_0x9a3b('0x6'));var config=require(_0x9a3b('0x7'));var controller=require(_0x9a3b('0x8'));router[_0x9a3b('0x9')]('/',auth[_0x9a3b('0xa')](),controller[_0x9a3b('0xb')]);router[_0x9a3b('0x9')](_0x9a3b('0xc'),auth['isAuthenticated'](),controller[_0x9a3b('0xd')]);router[_0x9a3b('0x9')](_0x9a3b('0xe'),auth[_0x9a3b('0xa')](),controller[_0x9a3b('0xf')]);router[_0x9a3b('0x9')](_0x9a3b('0x10'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0x9a3b('0x11'),auth[_0x9a3b('0xa')](),controller[_0x9a3b('0x12')]);router[_0x9a3b('0x13')]('/',auth['isAuthenticated'](),controller[_0x9a3b('0x14')]);router[_0x9a3b('0x15')](_0x9a3b('0xc'),auth[_0x9a3b('0xa')](),controller['update']);router[_0x9a3b('0x16')](_0x9a3b('0xc'),auth['isAuthenticated'](),controller[_0x9a3b('0x17')]);module['exports']=router; \ No newline at end of file +var _0x14aa=['/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','/:id/descriptions','create','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x14aa,0x74));var _0xa14a=function(_0x5630d8,_0x5e6a72){_0x5630d8=_0x5630d8-0x0;var _0x208aec=_0x14aa[_0x5630d8];return _0x208aec;};'use strict';var multer=require('multer');var util=require(_0xa14a('0x0'));var path=require(_0xa14a('0x1'));var timeout=require(_0xa14a('0x2'));var express=require('express');var router=express[_0xa14a('0x3')]();var fs_extra=require(_0xa14a('0x4'));var auth=require(_0xa14a('0x5'));var interaction=require(_0xa14a('0x6'));var config=require(_0xa14a('0x7'));var controller=require('./intServicenowConfiguration.controller');router[_0xa14a('0x8')]('/',auth['isAuthenticated'](),controller[_0xa14a('0x9')]);router[_0xa14a('0x8')](_0xa14a('0xa'),auth[_0xa14a('0xb')](),controller['show']);router[_0xa14a('0x8')](_0xa14a('0xc'),auth[_0xa14a('0xb')](),controller[_0xa14a('0xd')]);router[_0xa14a('0x8')](_0xa14a('0xe'),auth[_0xa14a('0xb')](),controller['getSubjects']);router['get'](_0xa14a('0xf'),auth[_0xa14a('0xb')](),controller['getDescriptions']);router['post']('/',auth[_0xa14a('0xb')](),controller[_0xa14a('0x10')]);router['put'](_0xa14a('0xa'),auth[_0xa14a('0xb')](),controller['update']);router['delete'](_0xa14a('0xa'),auth[_0xa14a('0xb')](),controller['destroy']);module[_0xa14a('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index c86c862..2ac51f6 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 _0x91f8=['STRING','sequelize','exports'];(function(_0x3749d8,_0x106971){var _0x19d29c=function(_0x5cc0b8){while(--_0x5cc0b8){_0x3749d8['push'](_0x3749d8['shift']());}};_0x19d29c(++_0x106971);}(_0x91f8,0x124));var _0x891f=function(_0x50d471,_0x2d9086){_0x50d471=_0x50d471-0x0;var _0x214900=_0x91f8[_0x50d471];return _0x214900;};'use strict';var Sequelize=require(_0x891f('0x0'));module[_0x891f('0x1')]={'name':{'type':Sequelize[_0x891f('0x2')]},'description':{'type':Sequelize[_0x891f('0x2')]}}; \ No newline at end of file +var _0x4162=['exports','STRING','sequelize'];(function(_0x3448f6,_0x2b21e5){var _0x562390=function(_0x36a55c){while(--_0x36a55c){_0x3448f6['push'](_0x3448f6['shift']());}};_0x562390(++_0x2b21e5);}(_0x4162,0x95));var _0x2416=function(_0x4a6b57,_0x261d94){_0x4a6b57=_0x4a6b57-0x0;var _0x3a98da=_0x4162[_0x4a6b57];return _0x3a98da;};'use strict';var Sequelize=require(_0x2416('0x0'));module[_0x2416('0x1')]={'name':{'type':Sequelize[_0x2416('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index e1154f7..4e2ac57 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 _0xa964=['VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','getFields','ServicenowField','order','findOne','getSubjects','getDescriptions','eml-format','zip-dir','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','type'];(function(_0xe012e0,_0x5319a0){var _0x5e2d40=function(_0xf97b4c){while(--_0xf97b4c){_0xe012e0['push'](_0xe012e0['shift']());}};_0x5e2d40(++_0x5319a0);}(_0xa964,0xb6));var _0x4a96=function(_0x119280,_0x439c3e){_0x119280=_0x119280-0x0;var _0x481797=_0xa964[_0x119280];return _0x481797;};'use strict';var emlformat=require(_0x4a96('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4a96('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4a96('0x2'));var Mustache=require('mustache');var util=require(_0x4a96('0x3'));var path=require('path');var sox=require(_0x4a96('0x4'));var csv=require('to-csv');var ejs=require(_0x4a96('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4a96('0x6'));var squel=require(_0x4a96('0x7'));var crypto=require(_0x4a96('0x8'));var jsforce=require(_0x4a96('0x9'));var deskjs=require(_0x4a96('0xa'));var toCsv=require(_0x4a96('0xb'));var querystring=require(_0x4a96('0xc'));var Papa=require(_0x4a96('0xd'));var Redis=require(_0x4a96('0xe'));var authService=require(_0x4a96('0xf'));var qs=require(_0x4a96('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4a96('0x11'))('api');var utils=require(_0x4a96('0x12'));var config=require(_0x4a96('0x13'));var licenseUtil=require(_0x4a96('0x14'));var db=require(_0x4a96('0x15'))['db'];function respondWithStatusCode(_0x11e321,_0xd09cd7){_0xd09cd7=_0xd09cd7||0xcc;return function(_0x561dc5){if(_0x561dc5){return _0x11e321['sendStatus'](_0xd09cd7);}return _0x11e321['status'](_0xd09cd7)[_0x4a96('0x16')]();};}function respondWithResult(_0x24e488,_0x19848c){_0x19848c=_0x19848c||0xc8;return function(_0x11ec48){if(_0x11ec48){return _0x24e488['status'](_0x19848c)[_0x4a96('0x17')](_0x11ec48);}};}function respondWithFilteredResult(_0x3cd36d,_0x22eec6){return function(_0x415ae0){if(_0x415ae0){var _0x126bb6=typeof _0x22eec6[_0x4a96('0x18')]===_0x4a96('0x19')&&typeof _0x22eec6[_0x4a96('0x1a')]===_0x4a96('0x19');var _0x7d7ccf=_0x415ae0[_0x4a96('0x1b')];var _0x559c71=_0x126bb6?0x0:_0x22eec6[_0x4a96('0x18')];var _0xceeea8=_0x126bb6?_0x415ae0[_0x4a96('0x1b')]:_0x22eec6[_0x4a96('0x18')]+_0x22eec6['limit'];var _0x5a9107;if(_0xceeea8>=_0x7d7ccf){_0xceeea8=_0x7d7ccf;_0x5a9107=0xc8;}else{_0x5a9107=0xce;}_0x3cd36d[_0x4a96('0x1c')](_0x5a9107);return _0x3cd36d[_0x4a96('0x1d')](_0x4a96('0x1e'),_0x559c71+'-'+_0xceeea8+'/'+_0x7d7ccf)[_0x4a96('0x17')](_0x415ae0);}return null;};}function patchUpdates(_0xb9f64e){return function(_0x1164b1){try{jsonpatch[_0x4a96('0x1f')](_0x1164b1,_0xb9f64e,!![]);}catch(_0x3b200f){return BPromise[_0x4a96('0x20')](_0x3b200f);}return _0x1164b1[_0x4a96('0x21')]();};}function saveUpdates(_0x27bdcc,_0x21edd1){return function(_0x1da58e){if(_0x1da58e){return _0x1da58e[_0x4a96('0x22')](_0x27bdcc)[_0x4a96('0x23')](function(_0xc9394e){return _0xc9394e;});}return null;};}function removeEntity(_0x3bbcb7,_0xbdb718){return function(_0x42f593){if(_0x42f593){return _0x42f593[_0x4a96('0x24')]()[_0x4a96('0x23')](function(){_0x3bbcb7[_0x4a96('0x1c')](0xcc)[_0x4a96('0x16')]();});}};}function handleEntityNotFound(_0x268cb4,_0x1e94d2){return function(_0xf9449){if(!_0xf9449){_0x268cb4[_0x4a96('0x25')](0x194);}return _0xf9449;};}function handleError(_0x3e6010,_0xe150c6){_0xe150c6=_0xe150c6||0x1f4;return function(_0xafe7de){logger[_0x4a96('0x26')](_0xafe7de['stack']);if(_0xafe7de[_0x4a96('0x27')]){delete _0xafe7de['name'];}_0x3e6010[_0x4a96('0x1c')](_0xe150c6)[_0x4a96('0x28')](_0xafe7de);};}exports[_0x4a96('0x29')]=function(_0x53d57a,_0x1f6daf){var _0x160227={},_0x4c1fba={},_0x9ba5c5={'count':0x0,'rows':[]};var _0x238c3b=_[_0x4a96('0x2a')](db[_0x4a96('0x2b')][_0x4a96('0x2c')],function(_0x17c21b){return{'name':_0x17c21b[_0x4a96('0x2d')],'type':_0x17c21b['type'][_0x4a96('0x2e')]};});_0x4c1fba[_0x4a96('0x2f')]=_[_0x4a96('0x2a')](_0x238c3b,_0x4a96('0x27'));_0x4c1fba[_0x4a96('0x30')]=_[_0x4a96('0x31')](_0x53d57a[_0x4a96('0x30')]);_0x4c1fba[_0x4a96('0x32')]=_[_0x4a96('0x33')](_0x4c1fba[_0x4a96('0x2f')],_0x4c1fba[_0x4a96('0x30')]);_0x160227[_0x4a96('0x34')]=_[_0x4a96('0x33')](_0x4c1fba[_0x4a96('0x2f')],qs['fields'](_0x53d57a[_0x4a96('0x30')][_0x4a96('0x35')]));_0x160227[_0x4a96('0x34')]=_0x160227[_0x4a96('0x34')]['length']?_0x160227[_0x4a96('0x34')]:_0x4c1fba['model'];if(!_0x53d57a['query'][_0x4a96('0x36')](_0x4a96('0x37'))){_0x160227[_0x4a96('0x1a')]=qs[_0x4a96('0x1a')](_0x53d57a[_0x4a96('0x30')][_0x4a96('0x1a')]);_0x160227[_0x4a96('0x18')]=qs['offset'](_0x53d57a[_0x4a96('0x30')][_0x4a96('0x18')]);}_0x160227['order']=qs[_0x4a96('0x38')](_0x53d57a[_0x4a96('0x30')][_0x4a96('0x38')]);_0x160227['where']=qs['filters'](_[_0x4a96('0x39')](_0x53d57a[_0x4a96('0x30')],_0x4c1fba[_0x4a96('0x32')]),_0x238c3b);if(_0x53d57a[_0x4a96('0x30')][_0x4a96('0x3a')]){_0x160227[_0x4a96('0x3b')]=_['merge'](_0x160227['where'],{'$or':_['map'](_0x238c3b,function(_0x3a46d7){if(_0x3a46d7[_0x4a96('0x3c')]!==_0x4a96('0x3d')){var _0x376e03={};_0x376e03[_0x3a46d7[_0x4a96('0x27')]]={'$like':'%'+_0x53d57a[_0x4a96('0x30')][_0x4a96('0x3a')]+'%'};return _0x376e03;}})});}_0x160227=_[_0x4a96('0x3e')]({},_0x160227,_0x53d57a[_0x4a96('0x3f')]);var _0x378692={'where':_0x160227[_0x4a96('0x3b')]};return db[_0x4a96('0x2b')][_0x4a96('0x1b')](_0x378692)[_0x4a96('0x23')](function(_0x4bc080){_0x9ba5c5['count']=_0x4bc080;if(_0x53d57a['query'][_0x4a96('0x40')]){_0x160227[_0x4a96('0x41')]=[{'all':!![]}];}return db[_0x4a96('0x2b')][_0x4a96('0x42')](_0x160227);})['then'](function(_0x9190fb){_0x9ba5c5[_0x4a96('0x43')]=_0x9190fb;return _0x9ba5c5;})['then'](respondWithFilteredResult(_0x1f6daf,_0x160227))[_0x4a96('0x44')](handleError(_0x1f6daf,null));};exports[_0x4a96('0x45')]=function(_0x17a727,_0x4e1c94){var _0x5915ec={'raw':![],'where':{'id':_0x17a727['params']['id']}},_0x12f7ff={};_0x12f7ff[_0x4a96('0x2f')]=_[_0x4a96('0x31')](db[_0x4a96('0x2b')]['rawAttributes']);_0x12f7ff[_0x4a96('0x30')]=_['keys'](_0x17a727[_0x4a96('0x30')]);_0x12f7ff[_0x4a96('0x32')]=_[_0x4a96('0x33')](_0x12f7ff['model'],_0x12f7ff[_0x4a96('0x30')]);_0x5915ec[_0x4a96('0x34')]=_[_0x4a96('0x33')](_0x12f7ff[_0x4a96('0x2f')],qs['fields'](_0x17a727[_0x4a96('0x30')]['fields']));_0x5915ec[_0x4a96('0x34')]=_0x5915ec[_0x4a96('0x34')][_0x4a96('0x46')]?_0x5915ec[_0x4a96('0x34')]:_0x12f7ff[_0x4a96('0x2f')];if(_0x17a727['query'][_0x4a96('0x40')]){_0x5915ec[_0x4a96('0x41')]=[{'all':!![]}];}_0x5915ec=_['merge']({},_0x5915ec,_0x17a727[_0x4a96('0x3f')]);return db['ServicenowConfiguration'][_0x4a96('0x47')](_0x5915ec)['then'](handleEntityNotFound(_0x4e1c94,null))['then'](respondWithResult(_0x4e1c94,null))[_0x4a96('0x44')](handleError(_0x4e1c94,null));};exports[_0x4a96('0x48')]=function(_0x241b95,_0x531753){return db[_0x4a96('0x2b')][_0x4a96('0x48')](_0x241b95[_0x4a96('0x49')],{})['then'](respondWithResult(_0x531753,0xc9))[_0x4a96('0x44')](handleError(_0x531753,null));};exports[_0x4a96('0x22')]=function(_0x3a139d,_0x12933e){if(_0x3a139d[_0x4a96('0x49')]['id']){delete _0x3a139d[_0x4a96('0x49')]['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x3a139d[_0x4a96('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12933e,null))[_0x4a96('0x23')](saveUpdates(_0x3a139d[_0x4a96('0x49')],null))['then'](respondWithResult(_0x12933e,null))[_0x4a96('0x44')](handleError(_0x12933e,null));};exports[_0x4a96('0x24')]=function(_0x5b7b45,_0x75c4d5){return db[_0x4a96('0x2b')][_0x4a96('0x47')]({'where':{'id':_0x5b7b45[_0x4a96('0x4a')]['id']}})['then'](handleEntityNotFound(_0x75c4d5,null))['then'](removeEntity(_0x75c4d5,null))[_0x4a96('0x44')](handleError(_0x75c4d5,null));};exports[_0x4a96('0x4b')]=function(_0x1039d7,_0x5b8ebf,_0x24c18d){var _0xbc6ede={};var _0x23babf={};var _0x22bc3f;var _0x9a6104;return db[_0x4a96('0x2b')]['findOne']({'where':{'id':_0x1039d7[_0x4a96('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5b8ebf,null))['then'](function(_0x720308){if(_0x720308){_0x22bc3f=_0x720308;_0x23babf[_0x4a96('0x2f')]=_[_0x4a96('0x31')](db[_0x4a96('0x4c')][_0x4a96('0x2c')]);_0x23babf['query']=_['keys'](_0x1039d7[_0x4a96('0x30')]);_0x23babf['filters']=_[_0x4a96('0x33')](_0x23babf['model'],_0x23babf[_0x4a96('0x30')]);_0xbc6ede['attributes']=_[_0x4a96('0x33')](_0x23babf[_0x4a96('0x2f')],qs[_0x4a96('0x35')](_0x1039d7['query'][_0x4a96('0x35')]));_0xbc6ede['attributes']=_0xbc6ede[_0x4a96('0x34')]['length']?_0xbc6ede[_0x4a96('0x34')]:_0x23babf[_0x4a96('0x2f')];_0xbc6ede[_0x4a96('0x4d')]=qs[_0x4a96('0x38')](_0x1039d7['query'][_0x4a96('0x38')]);_0xbc6ede[_0x4a96('0x3b')]=qs['filters'](_[_0x4a96('0x39')](_0x1039d7[_0x4a96('0x30')],_0x23babf[_0x4a96('0x32')]));if(_0x1039d7['query'][_0x4a96('0x3a')]){_0xbc6ede[_0x4a96('0x3b')]=_[_0x4a96('0x3e')](_0xbc6ede[_0x4a96('0x3b')],{'$or':_['map'](_0xbc6ede[_0x4a96('0x34')],function(_0x3f8965){var _0x3656ef={};_0x3656ef[_0x3f8965]={'$like':'%'+_0x1039d7[_0x4a96('0x30')]['filter']+'%'};return _0x3656ef;})});}_0xbc6ede=_[_0x4a96('0x3e')]({},_0xbc6ede,_0x1039d7[_0x4a96('0x3f')]);return _0x22bc3f[_0x4a96('0x4b')](_0xbc6ede);}})[_0x4a96('0x23')](function(_0x3709e3){if(_0x3709e3){_0x9a6104=_0x3709e3[_0x4a96('0x46')];if(!_0x1039d7[_0x4a96('0x30')][_0x4a96('0x36')](_0x4a96('0x37'))){_0xbc6ede[_0x4a96('0x1a')]=qs[_0x4a96('0x1a')](_0x1039d7[_0x4a96('0x30')][_0x4a96('0x1a')]);_0xbc6ede['offset']=qs[_0x4a96('0x18')](_0x1039d7[_0x4a96('0x30')][_0x4a96('0x18')]);}return _0x22bc3f['getFields'](_0xbc6ede);}})[_0x4a96('0x23')](function(_0x52890f){if(_0x52890f){return _0x52890f?{'count':_0x9a6104,'rows':_0x52890f}:null;}})[_0x4a96('0x23')](respondWithResult(_0x5b8ebf,null))[_0x4a96('0x44')](handleError(_0x5b8ebf,null));};exports['getSubjects']=function(_0xb2a23a,_0x2afb9e,_0x240b61){var _0x3c0071={};var _0x6db224={};var _0x4a6dc9;var _0x3fecf4;return db[_0x4a96('0x2b')][_0x4a96('0x4e')]({'where':{'id':_0xb2a23a[_0x4a96('0x4a')]['id']}})[_0x4a96('0x23')](handleEntityNotFound(_0x2afb9e,null))[_0x4a96('0x23')](function(_0x3a8426){if(_0x3a8426){_0x4a6dc9=_0x3a8426;_0x6db224[_0x4a96('0x2f')]=_['keys'](db['ServicenowField'][_0x4a96('0x2c')]);_0x6db224[_0x4a96('0x30')]=_[_0x4a96('0x31')](_0xb2a23a[_0x4a96('0x30')]);_0x6db224[_0x4a96('0x32')]=_[_0x4a96('0x33')](_0x6db224[_0x4a96('0x2f')],_0x6db224[_0x4a96('0x30')]);_0x3c0071[_0x4a96('0x34')]=_[_0x4a96('0x33')](_0x6db224[_0x4a96('0x2f')],qs['fields'](_0xb2a23a['query'][_0x4a96('0x35')]));_0x3c0071[_0x4a96('0x34')]=_0x3c0071[_0x4a96('0x34')]['length']?_0x3c0071[_0x4a96('0x34')]:_0x6db224[_0x4a96('0x2f')];_0x3c0071[_0x4a96('0x4d')]=qs['sort'](_0xb2a23a['query'][_0x4a96('0x38')]);_0x3c0071[_0x4a96('0x3b')]=qs[_0x4a96('0x32')](_['pick'](_0xb2a23a[_0x4a96('0x30')],_0x6db224[_0x4a96('0x32')]));if(_0xb2a23a[_0x4a96('0x30')][_0x4a96('0x3a')]){_0x3c0071[_0x4a96('0x3b')]=_[_0x4a96('0x3e')](_0x3c0071[_0x4a96('0x3b')],{'$or':_['map'](_0x3c0071[_0x4a96('0x34')],function(_0x410697){var _0x372f0b={};_0x372f0b[_0x410697]={'$like':'%'+_0xb2a23a['query'][_0x4a96('0x3a')]+'%'};return _0x372f0b;})});}_0x3c0071=_[_0x4a96('0x3e')]({},_0x3c0071,_0xb2a23a[_0x4a96('0x3f')]);return _0x4a6dc9[_0x4a96('0x4f')](_0x3c0071);}})[_0x4a96('0x23')](function(_0x417be0){if(_0x417be0){_0x3fecf4=_0x417be0[_0x4a96('0x46')];if(!_0xb2a23a[_0x4a96('0x30')]['hasOwnProperty'](_0x4a96('0x37'))){_0x3c0071[_0x4a96('0x1a')]=qs['limit'](_0xb2a23a[_0x4a96('0x30')]['limit']);_0x3c0071[_0x4a96('0x18')]=qs[_0x4a96('0x18')](_0xb2a23a[_0x4a96('0x30')]['offset']);}return _0x4a6dc9[_0x4a96('0x4f')](_0x3c0071);}})[_0x4a96('0x23')](function(_0x331e9d){if(_0x331e9d){return _0x331e9d?{'count':_0x3fecf4,'rows':_0x331e9d}:null;}})[_0x4a96('0x23')](respondWithResult(_0x2afb9e,null))['catch'](handleError(_0x2afb9e,null));};exports[_0x4a96('0x50')]=function(_0x143534,_0x3d3f39,_0x5e038d){var _0x2480db={};var _0x38ed69={};var _0x35066a;var _0x509aa6;return db[_0x4a96('0x2b')][_0x4a96('0x4e')]({'where':{'id':_0x143534[_0x4a96('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3d3f39,null))['then'](function(_0x2db67a){if(_0x2db67a){_0x35066a=_0x2db67a;_0x38ed69[_0x4a96('0x2f')]=_[_0x4a96('0x31')](db[_0x4a96('0x4c')][_0x4a96('0x2c')]);_0x38ed69[_0x4a96('0x30')]=_[_0x4a96('0x31')](_0x143534['query']);_0x38ed69['filters']=_['intersection'](_0x38ed69[_0x4a96('0x2f')],_0x38ed69[_0x4a96('0x30')]);_0x2480db[_0x4a96('0x34')]=_[_0x4a96('0x33')](_0x38ed69[_0x4a96('0x2f')],qs[_0x4a96('0x35')](_0x143534[_0x4a96('0x30')]['fields']));_0x2480db[_0x4a96('0x34')]=_0x2480db['attributes'][_0x4a96('0x46')]?_0x2480db[_0x4a96('0x34')]:_0x38ed69[_0x4a96('0x2f')];_0x2480db['order']=qs['sort'](_0x143534[_0x4a96('0x30')][_0x4a96('0x38')]);_0x2480db[_0x4a96('0x3b')]=qs['filters'](_[_0x4a96('0x39')](_0x143534[_0x4a96('0x30')],_0x38ed69[_0x4a96('0x32')]));if(_0x143534[_0x4a96('0x30')][_0x4a96('0x3a')]){_0x2480db[_0x4a96('0x3b')]=_[_0x4a96('0x3e')](_0x2480db[_0x4a96('0x3b')],{'$or':_[_0x4a96('0x2a')](_0x2480db[_0x4a96('0x34')],function(_0x312ac2){var _0x10bd9e={};_0x10bd9e[_0x312ac2]={'$like':'%'+_0x143534[_0x4a96('0x30')][_0x4a96('0x3a')]+'%'};return _0x10bd9e;})});}_0x2480db=_['merge']({},_0x2480db,_0x143534[_0x4a96('0x3f')]);return _0x35066a[_0x4a96('0x50')](_0x2480db);}})['then'](function(_0x3cac11){if(_0x3cac11){_0x509aa6=_0x3cac11[_0x4a96('0x46')];if(!_0x143534['query'][_0x4a96('0x36')](_0x4a96('0x37'))){_0x2480db['limit']=qs[_0x4a96('0x1a')](_0x143534[_0x4a96('0x30')][_0x4a96('0x1a')]);_0x2480db[_0x4a96('0x18')]=qs[_0x4a96('0x18')](_0x143534[_0x4a96('0x30')][_0x4a96('0x18')]);}return _0x35066a['getDescriptions'](_0x2480db);}})[_0x4a96('0x23')](function(_0x1f3844){if(_0x1f3844){return _0x1f3844?{'count':_0x509aa6,'rows':_0x1f3844}:null;}})[_0x4a96('0x23')](respondWithResult(_0x3d3f39,null))['catch'](handleError(_0x3d3f39,null));}; \ No newline at end of file +var _0xbafb=['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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','then','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','include','merge','find','catch','create','body','destroy','getFields','findOne','ServicenowField','getSubjects','nolimit','getDescriptions','eml-format','rimraf','zip-dir'];(function(_0x4a266c,_0x1e7b29){var _0x430feb=function(_0x4042ac){while(--_0x4042ac){_0x4a266c['push'](_0x4a266c['shift']());}};_0x430feb(++_0x1e7b29);}(_0xbafb,0x1ab));var _0xbbaf=function(_0x2e8166,_0x35f0b8){_0x2e8166=_0x2e8166-0x0;var _0x4cb1c2=_0xbafb[_0x2e8166];return _0x4cb1c2;};'use strict';var emlformat=require(_0xbbaf('0x0'));var rimraf=require(_0xbbaf('0x1'));var zipdir=require(_0xbbaf('0x2'));var jsonpatch=require(_0xbbaf('0x3'));var rp=require(_0xbbaf('0x4'));var moment=require(_0xbbaf('0x5'));var BPromise=require(_0xbbaf('0x6'));var Mustache=require(_0xbbaf('0x7'));var util=require(_0xbbaf('0x8'));var path=require(_0xbbaf('0x9'));var sox=require(_0xbbaf('0xa'));var csv=require(_0xbbaf('0xb'));var ejs=require(_0xbbaf('0xc'));var fs=require('fs');var fs_extra=require(_0xbbaf('0xd'));var _=require(_0xbbaf('0xe'));var squel=require(_0xbbaf('0xf'));var crypto=require(_0xbbaf('0x10'));var jsforce=require(_0xbbaf('0x11'));var deskjs=require(_0xbbaf('0x12'));var toCsv=require(_0xbbaf('0xb'));var querystring=require(_0xbbaf('0x13'));var Papa=require(_0xbbaf('0x14'));var Redis=require(_0xbbaf('0x15'));var authService=require('../../components/auth/service');var qs=require(_0xbbaf('0x16'));var as=require(_0xbbaf('0x17'));var hardwareService=require(_0xbbaf('0x18'));var logger=require(_0xbbaf('0x19'))(_0xbbaf('0x1a'));var utils=require(_0xbbaf('0x1b'));var config=require(_0xbbaf('0x1c'));var licenseUtil=require(_0xbbaf('0x1d'));var db=require(_0xbbaf('0x1e'))['db'];function respondWithStatusCode(_0x134bbb,_0x2f80cc){_0x2f80cc=_0x2f80cc||0xcc;return function(_0x22e1d7){if(_0x22e1d7){return _0x134bbb[_0xbbaf('0x1f')](_0x2f80cc);}return _0x134bbb[_0xbbaf('0x20')](_0x2f80cc)[_0xbbaf('0x21')]();};}function respondWithResult(_0x2202af,_0x1011c4){_0x1011c4=_0x1011c4||0xc8;return function(_0xc20a98){if(_0xc20a98){return _0x2202af[_0xbbaf('0x20')](_0x1011c4)[_0xbbaf('0x22')](_0xc20a98);}};}function respondWithFilteredResult(_0x5c93ed,_0x9bb38d){return function(_0x100d01){if(_0x100d01){var _0x5d07cd=typeof _0x9bb38d[_0xbbaf('0x23')]===_0xbbaf('0x24')&&typeof _0x9bb38d[_0xbbaf('0x25')]===_0xbbaf('0x24');var _0x1f6a0e=_0x100d01[_0xbbaf('0x26')];var _0x584d1f=_0x5d07cd?0x0:_0x9bb38d['offset'];var _0x301d84=_0x5d07cd?_0x100d01['count']:_0x9bb38d[_0xbbaf('0x23')]+_0x9bb38d[_0xbbaf('0x25')];var _0x9e21a3;if(_0x301d84>=_0x1f6a0e){_0x301d84=_0x1f6a0e;_0x9e21a3=0xc8;}else{_0x9e21a3=0xce;}_0x5c93ed['status'](_0x9e21a3);return _0x5c93ed['set'](_0xbbaf('0x27'),_0x584d1f+'-'+_0x301d84+'/'+_0x1f6a0e)['json'](_0x100d01);}return null;};}function patchUpdates(_0x3a65a9){return function(_0x51346e){try{jsonpatch[_0xbbaf('0x28')](_0x51346e,_0x3a65a9,!![]);}catch(_0x3beb5f){return BPromise['reject'](_0x3beb5f);}return _0x51346e[_0xbbaf('0x29')]();};}function saveUpdates(_0x5079ef,_0x21463d){return function(_0x5efe1c){if(_0x5efe1c){return _0x5efe1c['update'](_0x5079ef)['then'](function(_0x259753){return _0x259753;});}return null;};}function removeEntity(_0x59542a,_0x30d8d9){return function(_0x2d65ae){if(_0x2d65ae){return _0x2d65ae['destroy']()[_0xbbaf('0x2a')](function(){_0x59542a[_0xbbaf('0x20')](0xcc)[_0xbbaf('0x21')]();});}};}function handleEntityNotFound(_0x1249ea,_0x3c707d){return function(_0x3e70c9){if(!_0x3e70c9){_0x1249ea[_0xbbaf('0x1f')](0x194);}return _0x3e70c9;};}function handleError(_0x20efd6,_0x11e9ff){_0x11e9ff=_0x11e9ff||0x1f4;return function(_0x265d3f){logger['error'](_0x265d3f[_0xbbaf('0x2b')]);if(_0x265d3f[_0xbbaf('0x2c')]){delete _0x265d3f[_0xbbaf('0x2c')];}_0x20efd6[_0xbbaf('0x20')](_0x11e9ff)[_0xbbaf('0x2d')](_0x265d3f);};}exports[_0xbbaf('0x2e')]=function(_0x4f2217,_0x448016){var _0x19b8be={},_0x21a8af={},_0x253d41={'count':0x0,'rows':[]};var _0x31fb5d=_[_0xbbaf('0x2f')](db[_0xbbaf('0x30')][_0xbbaf('0x31')],function(_0x27ef85){return{'name':_0x27ef85['fieldName'],'type':_0x27ef85[_0xbbaf('0x32')][_0xbbaf('0x33')]};});_0x21a8af[_0xbbaf('0x34')]=_[_0xbbaf('0x2f')](_0x31fb5d,_0xbbaf('0x2c'));_0x21a8af[_0xbbaf('0x35')]=_['keys'](_0x4f2217[_0xbbaf('0x35')]);_0x21a8af[_0xbbaf('0x36')]=_[_0xbbaf('0x37')](_0x21a8af[_0xbbaf('0x34')],_0x21a8af[_0xbbaf('0x35')]);_0x19b8be[_0xbbaf('0x38')]=_['intersection'](_0x21a8af[_0xbbaf('0x34')],qs[_0xbbaf('0x39')](_0x4f2217['query'][_0xbbaf('0x39')]));_0x19b8be[_0xbbaf('0x38')]=_0x19b8be[_0xbbaf('0x38')][_0xbbaf('0x3a')]?_0x19b8be[_0xbbaf('0x38')]:_0x21a8af[_0xbbaf('0x34')];if(!_0x4f2217[_0xbbaf('0x35')][_0xbbaf('0x3b')]('nolimit')){_0x19b8be[_0xbbaf('0x25')]=qs[_0xbbaf('0x25')](_0x4f2217[_0xbbaf('0x35')][_0xbbaf('0x25')]);_0x19b8be[_0xbbaf('0x23')]=qs[_0xbbaf('0x23')](_0x4f2217[_0xbbaf('0x35')]['offset']);}_0x19b8be[_0xbbaf('0x3c')]=qs[_0xbbaf('0x3d')](_0x4f2217[_0xbbaf('0x35')][_0xbbaf('0x3d')]);_0x19b8be['where']=qs[_0xbbaf('0x36')](_[_0xbbaf('0x3e')](_0x4f2217[_0xbbaf('0x35')],_0x21a8af[_0xbbaf('0x36')]),_0x31fb5d);if(_0x4f2217[_0xbbaf('0x35')][_0xbbaf('0x3f')]){_0x19b8be['where']=_['merge'](_0x19b8be[_0xbbaf('0x40')],{'$or':_[_0xbbaf('0x2f')](_0x31fb5d,function(_0x2b9a5d){if(_0x2b9a5d[_0xbbaf('0x32')]!==_0xbbaf('0x41')){var _0x56c99b={};_0x56c99b[_0x2b9a5d['name']]={'$like':'%'+_0x4f2217[_0xbbaf('0x35')][_0xbbaf('0x3f')]+'%'};return _0x56c99b;}})});}_0x19b8be=_['merge']({},_0x19b8be,_0x4f2217[_0xbbaf('0x42')]);var _0x397793={'where':_0x19b8be[_0xbbaf('0x40')]};return db['ServicenowConfiguration']['count'](_0x397793)[_0xbbaf('0x2a')](function(_0x5cd2fb){_0x253d41[_0xbbaf('0x26')]=_0x5cd2fb;if(_0x4f2217[_0xbbaf('0x35')][_0xbbaf('0x43')]){_0x19b8be['include']=[{'all':!![]}];}return db[_0xbbaf('0x30')][_0xbbaf('0x44')](_0x19b8be);})['then'](function(_0x17857c){_0x253d41[_0xbbaf('0x45')]=_0x17857c;return _0x253d41;})[_0xbbaf('0x2a')](respondWithFilteredResult(_0x448016,_0x19b8be))['catch'](handleError(_0x448016,null));};exports[_0xbbaf('0x46')]=function(_0x1709be,_0x4b490f){var _0x3569c9={'raw':![],'where':{'id':_0x1709be[_0xbbaf('0x47')]['id']}},_0x58a7d5={};_0x58a7d5[_0xbbaf('0x34')]=_[_0xbbaf('0x48')](db['ServicenowConfiguration'][_0xbbaf('0x31')]);_0x58a7d5[_0xbbaf('0x35')]=_[_0xbbaf('0x48')](_0x1709be['query']);_0x58a7d5[_0xbbaf('0x36')]=_[_0xbbaf('0x37')](_0x58a7d5[_0xbbaf('0x34')],_0x58a7d5[_0xbbaf('0x35')]);_0x3569c9['attributes']=_[_0xbbaf('0x37')](_0x58a7d5[_0xbbaf('0x34')],qs[_0xbbaf('0x39')](_0x1709be[_0xbbaf('0x35')][_0xbbaf('0x39')]));_0x3569c9['attributes']=_0x3569c9[_0xbbaf('0x38')]['length']?_0x3569c9['attributes']:_0x58a7d5[_0xbbaf('0x34')];if(_0x1709be['query']['includeAll']){_0x3569c9[_0xbbaf('0x49')]=[{'all':!![]}];}_0x3569c9=_[_0xbbaf('0x4a')]({},_0x3569c9,_0x1709be[_0xbbaf('0x42')]);return db[_0xbbaf('0x30')][_0xbbaf('0x4b')](_0x3569c9)[_0xbbaf('0x2a')](handleEntityNotFound(_0x4b490f,null))[_0xbbaf('0x2a')](respondWithResult(_0x4b490f,null))[_0xbbaf('0x4c')](handleError(_0x4b490f,null));};exports[_0xbbaf('0x4d')]=function(_0x3424df,_0x508b1f){return db[_0xbbaf('0x30')][_0xbbaf('0x4d')](_0x3424df[_0xbbaf('0x4e')],{})[_0xbbaf('0x2a')](respondWithResult(_0x508b1f,0xc9))['catch'](handleError(_0x508b1f,null));};exports['update']=function(_0xed736a,_0x4de496){if(_0xed736a[_0xbbaf('0x4e')]['id']){delete _0xed736a[_0xbbaf('0x4e')]['id'];}return db[_0xbbaf('0x30')]['find']({'where':{'id':_0xed736a['params']['id']}})[_0xbbaf('0x2a')](handleEntityNotFound(_0x4de496,null))['then'](saveUpdates(_0xed736a[_0xbbaf('0x4e')],null))['then'](respondWithResult(_0x4de496,null))['catch'](handleError(_0x4de496,null));};exports[_0xbbaf('0x4f')]=function(_0x3a20d6,_0x3ec1c9){return db[_0xbbaf('0x30')][_0xbbaf('0x4b')]({'where':{'id':_0x3a20d6[_0xbbaf('0x47')]['id']}})[_0xbbaf('0x2a')](handleEntityNotFound(_0x3ec1c9,null))['then'](removeEntity(_0x3ec1c9,null))[_0xbbaf('0x4c')](handleError(_0x3ec1c9,null));};exports[_0xbbaf('0x50')]=function(_0x25eac7,_0x43d687,_0x5d713f){var _0x449526={};var _0x2aa2ee={};var _0x4d3e53;var _0x53fe5f;return db['ServicenowConfiguration'][_0xbbaf('0x51')]({'where':{'id':_0x25eac7[_0xbbaf('0x47')]['id']}})[_0xbbaf('0x2a')](handleEntityNotFound(_0x43d687,null))[_0xbbaf('0x2a')](function(_0x7aa059){if(_0x7aa059){_0x4d3e53=_0x7aa059;_0x2aa2ee[_0xbbaf('0x34')]=_[_0xbbaf('0x48')](db[_0xbbaf('0x52')][_0xbbaf('0x31')]);_0x2aa2ee[_0xbbaf('0x35')]=_[_0xbbaf('0x48')](_0x25eac7[_0xbbaf('0x35')]);_0x2aa2ee[_0xbbaf('0x36')]=_[_0xbbaf('0x37')](_0x2aa2ee[_0xbbaf('0x34')],_0x2aa2ee[_0xbbaf('0x35')]);_0x449526[_0xbbaf('0x38')]=_[_0xbbaf('0x37')](_0x2aa2ee[_0xbbaf('0x34')],qs['fields'](_0x25eac7[_0xbbaf('0x35')][_0xbbaf('0x39')]));_0x449526[_0xbbaf('0x38')]=_0x449526[_0xbbaf('0x38')][_0xbbaf('0x3a')]?_0x449526[_0xbbaf('0x38')]:_0x2aa2ee[_0xbbaf('0x34')];_0x449526['order']=qs['sort'](_0x25eac7[_0xbbaf('0x35')][_0xbbaf('0x3d')]);_0x449526[_0xbbaf('0x40')]=qs[_0xbbaf('0x36')](_[_0xbbaf('0x3e')](_0x25eac7[_0xbbaf('0x35')],_0x2aa2ee['filters']));if(_0x25eac7[_0xbbaf('0x35')][_0xbbaf('0x3f')]){_0x449526[_0xbbaf('0x40')]=_[_0xbbaf('0x4a')](_0x449526[_0xbbaf('0x40')],{'$or':_[_0xbbaf('0x2f')](_0x449526['attributes'],function(_0x370f48){var _0x256bf3={};_0x256bf3[_0x370f48]={'$like':'%'+_0x25eac7[_0xbbaf('0x35')]['filter']+'%'};return _0x256bf3;})});}_0x449526=_['merge']({},_0x449526,_0x25eac7['options']);return _0x4d3e53[_0xbbaf('0x50')](_0x449526);}})[_0xbbaf('0x2a')](function(_0x5be407){if(_0x5be407){_0x53fe5f=_0x5be407[_0xbbaf('0x3a')];if(!_0x25eac7[_0xbbaf('0x35')][_0xbbaf('0x3b')]('nolimit')){_0x449526['limit']=qs[_0xbbaf('0x25')](_0x25eac7[_0xbbaf('0x35')]['limit']);_0x449526['offset']=qs[_0xbbaf('0x23')](_0x25eac7['query']['offset']);}return _0x4d3e53[_0xbbaf('0x50')](_0x449526);}})[_0xbbaf('0x2a')](function(_0x37b3c3){if(_0x37b3c3){return _0x37b3c3?{'count':_0x53fe5f,'rows':_0x37b3c3}:null;}})[_0xbbaf('0x2a')](respondWithResult(_0x43d687,null))[_0xbbaf('0x4c')](handleError(_0x43d687,null));};exports[_0xbbaf('0x53')]=function(_0x33a8cf,_0x5421b7,_0x18c7bc){var _0x4ba723={};var _0x2a78ca={};var _0x1271a6;var _0x43e660;return db[_0xbbaf('0x30')][_0xbbaf('0x51')]({'where':{'id':_0x33a8cf[_0xbbaf('0x47')]['id']}})[_0xbbaf('0x2a')](handleEntityNotFound(_0x5421b7,null))[_0xbbaf('0x2a')](function(_0x26d81d){if(_0x26d81d){_0x1271a6=_0x26d81d;_0x2a78ca['model']=_[_0xbbaf('0x48')](db[_0xbbaf('0x52')][_0xbbaf('0x31')]);_0x2a78ca['query']=_[_0xbbaf('0x48')](_0x33a8cf[_0xbbaf('0x35')]);_0x2a78ca[_0xbbaf('0x36')]=_[_0xbbaf('0x37')](_0x2a78ca['model'],_0x2a78ca[_0xbbaf('0x35')]);_0x4ba723[_0xbbaf('0x38')]=_[_0xbbaf('0x37')](_0x2a78ca['model'],qs[_0xbbaf('0x39')](_0x33a8cf[_0xbbaf('0x35')]['fields']));_0x4ba723['attributes']=_0x4ba723['attributes']['length']?_0x4ba723['attributes']:_0x2a78ca['model'];_0x4ba723[_0xbbaf('0x3c')]=qs[_0xbbaf('0x3d')](_0x33a8cf[_0xbbaf('0x35')][_0xbbaf('0x3d')]);_0x4ba723['where']=qs[_0xbbaf('0x36')](_[_0xbbaf('0x3e')](_0x33a8cf[_0xbbaf('0x35')],_0x2a78ca[_0xbbaf('0x36')]));if(_0x33a8cf[_0xbbaf('0x35')][_0xbbaf('0x3f')]){_0x4ba723[_0xbbaf('0x40')]=_['merge'](_0x4ba723[_0xbbaf('0x40')],{'$or':_[_0xbbaf('0x2f')](_0x4ba723[_0xbbaf('0x38')],function(_0x2f5b76){var _0xc39ce3={};_0xc39ce3[_0x2f5b76]={'$like':'%'+_0x33a8cf[_0xbbaf('0x35')][_0xbbaf('0x3f')]+'%'};return _0xc39ce3;})});}_0x4ba723=_[_0xbbaf('0x4a')]({},_0x4ba723,_0x33a8cf[_0xbbaf('0x42')]);return _0x1271a6[_0xbbaf('0x53')](_0x4ba723);}})[_0xbbaf('0x2a')](function(_0x1a26f6){if(_0x1a26f6){_0x43e660=_0x1a26f6[_0xbbaf('0x3a')];if(!_0x33a8cf[_0xbbaf('0x35')][_0xbbaf('0x3b')](_0xbbaf('0x54'))){_0x4ba723['limit']=qs[_0xbbaf('0x25')](_0x33a8cf['query'][_0xbbaf('0x25')]);_0x4ba723[_0xbbaf('0x23')]=qs[_0xbbaf('0x23')](_0x33a8cf[_0xbbaf('0x35')][_0xbbaf('0x23')]);}return _0x1271a6[_0xbbaf('0x53')](_0x4ba723);}})[_0xbbaf('0x2a')](function(_0x298ea7){if(_0x298ea7){return _0x298ea7?{'count':_0x43e660,'rows':_0x298ea7}:null;}})[_0xbbaf('0x2a')](respondWithResult(_0x5421b7,null))[_0xbbaf('0x4c')](handleError(_0x5421b7,null));};exports[_0xbbaf('0x55')]=function(_0x5ad519,_0x5f0db8,_0x2a42ff){var _0x33868f={};var _0x2f8d49={};var _0x573944;var _0x24480f;return db[_0xbbaf('0x30')][_0xbbaf('0x51')]({'where':{'id':_0x5ad519[_0xbbaf('0x47')]['id']}})[_0xbbaf('0x2a')](handleEntityNotFound(_0x5f0db8,null))[_0xbbaf('0x2a')](function(_0x23e7f5){if(_0x23e7f5){_0x573944=_0x23e7f5;_0x2f8d49[_0xbbaf('0x34')]=_[_0xbbaf('0x48')](db[_0xbbaf('0x52')][_0xbbaf('0x31')]);_0x2f8d49[_0xbbaf('0x35')]=_[_0xbbaf('0x48')](_0x5ad519[_0xbbaf('0x35')]);_0x2f8d49[_0xbbaf('0x36')]=_[_0xbbaf('0x37')](_0x2f8d49[_0xbbaf('0x34')],_0x2f8d49[_0xbbaf('0x35')]);_0x33868f[_0xbbaf('0x38')]=_[_0xbbaf('0x37')](_0x2f8d49[_0xbbaf('0x34')],qs[_0xbbaf('0x39')](_0x5ad519['query'][_0xbbaf('0x39')]));_0x33868f[_0xbbaf('0x38')]=_0x33868f[_0xbbaf('0x38')][_0xbbaf('0x3a')]?_0x33868f[_0xbbaf('0x38')]:_0x2f8d49[_0xbbaf('0x34')];_0x33868f[_0xbbaf('0x3c')]=qs[_0xbbaf('0x3d')](_0x5ad519[_0xbbaf('0x35')][_0xbbaf('0x3d')]);_0x33868f[_0xbbaf('0x40')]=qs[_0xbbaf('0x36')](_['pick'](_0x5ad519[_0xbbaf('0x35')],_0x2f8d49[_0xbbaf('0x36')]));if(_0x5ad519[_0xbbaf('0x35')][_0xbbaf('0x3f')]){_0x33868f[_0xbbaf('0x40')]=_['merge'](_0x33868f[_0xbbaf('0x40')],{'$or':_[_0xbbaf('0x2f')](_0x33868f[_0xbbaf('0x38')],function(_0x574d55){var _0x34ec42={};_0x34ec42[_0x574d55]={'$like':'%'+_0x5ad519[_0xbbaf('0x35')][_0xbbaf('0x3f')]+'%'};return _0x34ec42;})});}_0x33868f=_[_0xbbaf('0x4a')]({},_0x33868f,_0x5ad519[_0xbbaf('0x42')]);return _0x573944[_0xbbaf('0x55')](_0x33868f);}})[_0xbbaf('0x2a')](function(_0x562080){if(_0x562080){_0x24480f=_0x562080[_0xbbaf('0x3a')];if(!_0x5ad519[_0xbbaf('0x35')][_0xbbaf('0x3b')](_0xbbaf('0x54'))){_0x33868f[_0xbbaf('0x25')]=qs[_0xbbaf('0x25')](_0x5ad519[_0xbbaf('0x35')]['limit']);_0x33868f[_0xbbaf('0x23')]=qs['offset'](_0x5ad519[_0xbbaf('0x35')]['offset']);}return _0x573944['getDescriptions'](_0x33868f);}})[_0xbbaf('0x2a')](function(_0x5a55fb){if(_0x5a55fb){return _0x5a55fb?{'count':_0x24480f,'rows':_0x5a55fb}:null;}})[_0xbbaf('0x2a')](respondWithResult(_0x5f0db8,null))[_0xbbaf('0x4c')](handleError(_0x5f0db8,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 9da2c7d..fb4dc19 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 _0x5523=['./intServicenowConfiguration.attributes','exports','int_servicenow_configurations','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5523,0x137));var _0x3552=function(_0x395021,_0x2a27ab){_0x395021=_0x395021-0x0;var _0x46b1c5=_0x5523[_0x395021];return _0x46b1c5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3552('0x0'))(_0x3552('0x1'));var moment=require(_0x3552('0x2'));var BPromise=require(_0x3552('0x3'));var rp=require(_0x3552('0x4'));var fs=require('fs');var path=require(_0x3552('0x5'));var rimraf=require(_0x3552('0x6'));var config=require(_0x3552('0x7'));var attributes=require(_0x3552('0x8'));module[_0x3552('0x9')]=function(_0x3225aa,_0x58385b){return _0x3225aa['define']('ServicenowConfiguration',attributes,{'tableName':_0x3552('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x723c=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration'];(function(_0x900a62,_0x52889d){var _0x1f537a=function(_0x26b331){while(--_0x26b331){_0x900a62['push'](_0x900a62['shift']());}};_0x1f537a(++_0x52889d);}(_0x723c,0x1ad));var _0xc723=function(_0x50fab1,_0x2e83e8){_0x50fab1=_0x50fab1-0x0;var _0xf6da0d=_0x723c[_0x50fab1];return _0xf6da0d;};'use strict';var _=require('lodash');var util=require(_0xc723('0x0'));var logger=require(_0xc723('0x1'))('api');var moment=require(_0xc723('0x2'));var BPromise=require('bluebird');var rp=require(_0xc723('0x3'));var fs=require('fs');var path=require(_0xc723('0x4'));var rimraf=require(_0xc723('0x5'));var config=require(_0xc723('0x6'));var attributes=require(_0xc723('0x7'));module[_0xc723('0x8')]=function(_0xa08b3,_0x4eb5ff){return _0xa08b3[_0xc723('0x9')](_0xc723('0xa'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 5f70883..c86bb0d 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 _0x66da=['ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','code','message','error','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x430aa7,_0x22c420){var _0x2bb332=function(_0x99e139){while(--_0x99e139){_0x430aa7['push'](_0x430aa7['shift']());}};_0x2bb332(++_0x22c420);}(_0x66da,0x16f));var _0xa66d=function(_0x155c64,_0x26ff95){_0x155c64=_0x155c64-0x0;var _0x1f154a=_0x66da[_0x155c64];return _0x1f154a;};'use strict';var _=require(_0xa66d('0x0'));var util=require(_0xa66d('0x1'));var moment=require(_0xa66d('0x2'));var BPromise=require(_0xa66d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa66d('0x4'));var logger=require(_0xa66d('0x5'))(_0xa66d('0x6'));var config=require(_0xa66d('0x7'));var jayson=require(_0xa66d('0x8'));var client=jayson['client'][_0xa66d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1643d9,_0x109fc6,_0xa2baf9){return new BPromise(function(_0x2c0d83,_0x28f57f){return client[_0xa66d('0xa')](_0x1643d9,_0xa2baf9)[_0xa66d('0xb')](function(_0x7ee9c){logger[_0xa66d('0xc')](_0xa66d('0xd'),_0x109fc6,_0xa66d('0xe'));logger['debug'](_0xa66d('0xf'),_0x109fc6,_0xa66d('0xe'),JSON['stringify'](_0x7ee9c));if(_0x7ee9c['error']){if(_0x7ee9c['error'][_0xa66d('0x10')]===0x1f4){logger['error'](_0xa66d('0xd'),_0x109fc6,_0x7ee9c['error'][_0xa66d('0x11')]);return _0x28f57f(_0x7ee9c[_0xa66d('0x12')]['message']);}logger[_0xa66d('0x12')](_0xa66d('0xd'),_0x109fc6,_0x7ee9c['error'][_0xa66d('0x11')]);return _0x2c0d83(_0x7ee9c['error'][_0xa66d('0x11')]);}else{logger['info'](_0xa66d('0xd'),_0x109fc6,_0xa66d('0xe'));_0x2c0d83(_0x7ee9c['result'][_0xa66d('0x11')]);}})[_0xa66d('0x13')](function(_0x15191c){logger[_0xa66d('0x12')](_0xa66d('0xd'),_0x109fc6,_0x15191c);_0x28f57f(_0x15191c);});});} \ No newline at end of file +var _0xa105=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','bluebird','randomstring'];(function(_0x10c2d3,_0x2f5914){var _0x5a0b13=function(_0x412864){while(--_0x412864){_0x10c2d3['push'](_0x10c2d3['shift']());}};_0x5a0b13(++_0x2f5914);}(_0xa105,0xd8));var _0x5a10=function(_0x36c347,_0x175bd5){_0x36c347=_0x36c347-0x0;var _0x5d1286=_0xa105[_0x36c347];return _0x5d1286;};'use strict';var _=require(_0x5a10('0x0'));var util=require('util');var moment=require(_0x5a10('0x1'));var BPromise=require(_0x5a10('0x2'));var rs=require(_0x5a10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a10('0x4'))['db'];var utils=require(_0x5a10('0x5'));var logger=require(_0x5a10('0x6'))(_0x5a10('0x7'));var config=require('../../config/environment');var jayson=require(_0x5a10('0x8'));var client=jayson[_0x5a10('0x9')][_0x5a10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x70d28,_0x3c19f0,_0x34f4b2){return new BPromise(function(_0x15e9ab,_0x31c58f){return client[_0x5a10('0xb')](_0x70d28,_0x34f4b2)[_0x5a10('0xc')](function(_0x1eb5c1){logger[_0x5a10('0xd')](_0x5a10('0xe'),_0x3c19f0,_0x5a10('0xf'));logger[_0x5a10('0x10')](_0x5a10('0x11'),_0x3c19f0,_0x5a10('0xf'),JSON['stringify'](_0x1eb5c1));if(_0x1eb5c1[_0x5a10('0x12')]){if(_0x1eb5c1[_0x5a10('0x12')][_0x5a10('0x13')]===0x1f4){logger[_0x5a10('0x12')](_0x5a10('0xe'),_0x3c19f0,_0x1eb5c1[_0x5a10('0x12')][_0x5a10('0x14')]);return _0x31c58f(_0x1eb5c1[_0x5a10('0x12')][_0x5a10('0x14')]);}logger[_0x5a10('0x12')](_0x5a10('0xe'),_0x3c19f0,_0x1eb5c1[_0x5a10('0x12')][_0x5a10('0x14')]);return _0x15e9ab(_0x1eb5c1[_0x5a10('0x12')]['message']);}else{logger[_0x5a10('0xd')](_0x5a10('0xe'),_0x3c19f0,_0x5a10('0xf'));_0x15e9ab(_0x1eb5c1['result']['message']);}})[_0x5a10('0x15')](function(_0x27f5f2){logger[_0x5a10('0x12')](_0x5a10('0xe'),_0x3c19f0,_0x27f5f2);_0x31c58f(_0x27f5f2);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 3e92aa3..9567bd9 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 _0x16a2=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller'];(function(_0x4a9771,_0x52429b){var _0x52e0ed=function(_0x5485c0){while(--_0x5485c0){_0x4a9771['push'](_0x4a9771['shift']());}};_0x52e0ed(++_0x52429b);}(_0x16a2,0x89));var _0x216a=function(_0x51b1a5,_0x285a4f){_0x51b1a5=_0x51b1a5-0x0;var _0x15c738=_0x16a2[_0x51b1a5];return _0x15c738;};'use strict';var multer=require('multer');var util=require(_0x216a('0x0'));var path=require(_0x216a('0x1'));var timeout=require(_0x216a('0x2'));var express=require(_0x216a('0x3'));var router=express[_0x216a('0x4')]();var fs_extra=require(_0x216a('0x5'));var auth=require(_0x216a('0x6'));var interaction=require(_0x216a('0x7'));var config=require(_0x216a('0x8'));var controller=require(_0x216a('0x9'));router[_0x216a('0xa')]('/',auth[_0x216a('0xb')](),controller[_0x216a('0xc')]);router[_0x216a('0xa')](_0x216a('0xd'),auth[_0x216a('0xb')](),controller[_0x216a('0xe')]);router[_0x216a('0xf')]('/',auth[_0x216a('0xb')](),controller[_0x216a('0x10')]);router[_0x216a('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x216a('0x12')]);router[_0x216a('0x13')]('/:id',auth[_0x216a('0xb')](),controller['destroy']);module[_0x216a('0x14')]=router; \ No newline at end of file +var _0x1805=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','/:id','put','delete'];(function(_0x332998,_0x2d99c7){var _0x460be7=function(_0x1a4d24){while(--_0x1a4d24){_0x332998['push'](_0x332998['shift']());}};_0x460be7(++_0x2d99c7);}(_0x1805,0xf0));var _0x5180=function(_0x15b249,_0x54ae07){_0x15b249=_0x15b249-0x0;var _0x2184aa=_0x1805[_0x15b249];return _0x2184aa;};'use strict';var multer=require(_0x5180('0x0'));var util=require(_0x5180('0x1'));var path=require(_0x5180('0x2'));var timeout=require('connect-timeout');var express=require(_0x5180('0x3'));var router=express[_0x5180('0x4')]();var fs_extra=require(_0x5180('0x5'));var auth=require(_0x5180('0x6'));var interaction=require(_0x5180('0x7'));var config=require(_0x5180('0x8'));var controller=require(_0x5180('0x9'));router[_0x5180('0xa')]('/',auth[_0x5180('0xb')](),controller['index']);router[_0x5180('0xa')](_0x5180('0xc'),auth[_0x5180('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5180('0xd')](_0x5180('0xc'),auth[_0x5180('0xb')](),controller['update']);router[_0x5180('0xe')]('/:id',auth[_0x5180('0xb')](),controller[_0x5180('0xf')]);module[_0x5180('0x10')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index ce50162..413f477 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 _0x93b1=['STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','picklist'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x93b1,0x1ce));var _0x193b=function(_0x146ca7,_0x2b5fae){_0x146ca7=_0x146ca7-0x0;var _0x1af811=_0x93b1[_0x146ca7];return _0x1af811;};'use strict';var Sequelize=require(_0x193b('0x0'));module[_0x193b('0x1')]={'type':{'type':Sequelize[_0x193b('0x2')](_0x193b('0x3'),_0x193b('0x4'),'customVariable','keyValue',_0x193b('0x5')),'defaultValue':_0x193b('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x193b('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x193b('0x3'),_0x193b('0x4'),_0x193b('0x7'))},'keyContent':{'type':Sequelize[_0x193b('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x193b('0x6')]},'customField':{'type':Sequelize[_0x193b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x193b('0x6')]}}; \ No newline at end of file +var _0x6f11=['string','customVariable','picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x3aa88e,_0x4f2dc8){var _0x3bbdee=function(_0x459c2d){while(--_0x459c2d){_0x3aa88e['push'](_0x3aa88e['shift']());}};_0x3bbdee(++_0x4f2dc8);}(_0x6f11,0x9f));var _0x16f1=function(_0x830c49,_0x4bb035){_0x830c49=_0x830c49-0x0;var _0x56b989=_0x6f11[_0x830c49];return _0x56b989;};'use strict';var Sequelize=require(_0x16f1('0x0'));module[_0x16f1('0x1')]={'type':{'type':Sequelize[_0x16f1('0x2')](_0x16f1('0x3'),'variable',_0x16f1('0x4'),'keyValue',_0x16f1('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x16f1('0x6')]},'key':{'type':Sequelize[_0x16f1('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x16f1('0x7'),_0x16f1('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x16f1('0x6')]},'nameField':{'type':Sequelize[_0x16f1('0x6')]},'customField':{'type':Sequelize[_0x16f1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x16f1('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index bd9247b..3a4cc76 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 _0x00aa=['fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','catch','show','params','keys','find','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','filters','intersection','model'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x00aa,0xe6));var _0xa00a=function(_0x1064bc,_0x206f12){_0x1064bc=_0x1064bc-0x0;var _0x5edc45=_0x00aa[_0x1064bc];return _0x5edc45;};'use strict';var emlformat=require(_0xa00a('0x0'));var rimraf=require(_0xa00a('0x1'));var zipdir=require(_0xa00a('0x2'));var jsonpatch=require(_0xa00a('0x3'));var rp=require(_0xa00a('0x4'));var moment=require(_0xa00a('0x5'));var BPromise=require(_0xa00a('0x6'));var Mustache=require('mustache');var util=require(_0xa00a('0x7'));var path=require(_0xa00a('0x8'));var sox=require(_0xa00a('0x9'));var csv=require(_0xa00a('0xa'));var ejs=require(_0xa00a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa00a('0xc'));var squel=require('squel');var crypto=require(_0xa00a('0xd'));var jsforce=require(_0xa00a('0xe'));var deskjs=require(_0xa00a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa00a('0x10'));var Papa=require('papaparse');var Redis=require(_0xa00a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa00a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa00a('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa00a('0x14'));var licenseUtil=require(_0xa00a('0x15'));var db=require(_0xa00a('0x16'))['db'];function respondWithStatusCode(_0x10e89c,_0x5d809b){_0x5d809b=_0x5d809b||0xcc;return function(_0x155ef1){if(_0x155ef1){return _0x10e89c[_0xa00a('0x17')](_0x5d809b);}return _0x10e89c['status'](_0x5d809b)[_0xa00a('0x18')]();};}function respondWithResult(_0x450639,_0x3e0705){_0x3e0705=_0x3e0705||0xc8;return function(_0x363ed3){if(_0x363ed3){return _0x450639[_0xa00a('0x19')](_0x3e0705)[_0xa00a('0x1a')](_0x363ed3);}};}function respondWithFilteredResult(_0x56c5b7,_0x35329f){return function(_0x85153e){if(_0x85153e){var _0x5051f4=typeof _0x35329f[_0xa00a('0x1b')]===_0xa00a('0x1c')&&typeof _0x35329f[_0xa00a('0x1d')]===_0xa00a('0x1c');var _0x4f8461=_0x85153e[_0xa00a('0x1e')];var _0xaa9373=_0x5051f4?0x0:_0x35329f[_0xa00a('0x1b')];var _0x18ddd9=_0x5051f4?_0x85153e[_0xa00a('0x1e')]:_0x35329f[_0xa00a('0x1b')]+_0x35329f['limit'];var _0x153143;if(_0x18ddd9>=_0x4f8461){_0x18ddd9=_0x4f8461;_0x153143=0xc8;}else{_0x153143=0xce;}_0x56c5b7[_0xa00a('0x19')](_0x153143);return _0x56c5b7[_0xa00a('0x1f')]('Content-Range',_0xaa9373+'-'+_0x18ddd9+'/'+_0x4f8461)[_0xa00a('0x1a')](_0x85153e);}return null;};}function patchUpdates(_0x2bf02d){return function(_0x5be593){try{jsonpatch[_0xa00a('0x20')](_0x5be593,_0x2bf02d,!![]);}catch(_0x22c828){return BPromise['reject'](_0x22c828);}return _0x5be593[_0xa00a('0x21')]();};}function saveUpdates(_0x13e987,_0x256e7e){return function(_0x14f708){if(_0x14f708){return _0x14f708[_0xa00a('0x22')](_0x13e987)[_0xa00a('0x23')](function(_0x3fef3e){return _0x3fef3e;});}return null;};}function removeEntity(_0x14d27a,_0x543010){return function(_0x32d650){if(_0x32d650){return _0x32d650[_0xa00a('0x24')]()[_0xa00a('0x23')](function(){_0x14d27a[_0xa00a('0x19')](0xcc)[_0xa00a('0x18')]();});}};}function handleEntityNotFound(_0x516112,_0xc14f2b){return function(_0x536d82){if(!_0x536d82){_0x516112[_0xa00a('0x17')](0x194);}return _0x536d82;};}function handleError(_0x205f69,_0x447f8f){_0x447f8f=_0x447f8f||0x1f4;return function(_0x517453){logger['error'](_0x517453['stack']);if(_0x517453[_0xa00a('0x25')]){delete _0x517453[_0xa00a('0x25')];}_0x205f69[_0xa00a('0x19')](_0x447f8f)[_0xa00a('0x26')](_0x517453);};}exports[_0xa00a('0x27')]=function(_0x303fd6,_0x37b3db){var _0x486e18={},_0x8c8bad={},_0x56e78f={'count':0x0,'rows':[]};var _0x1333d4=_[_0xa00a('0x28')](db[_0xa00a('0x29')][_0xa00a('0x2a')],function(_0x1134b3){return{'name':_0x1134b3[_0xa00a('0x2b')],'type':_0x1134b3[_0xa00a('0x2c')][_0xa00a('0x2d')]};});_0x8c8bad['model']=_['map'](_0x1333d4,_0xa00a('0x25'));_0x8c8bad[_0xa00a('0x2e')]=_['keys'](_0x303fd6[_0xa00a('0x2e')]);_0x8c8bad[_0xa00a('0x2f')]=_[_0xa00a('0x30')](_0x8c8bad['model'],_0x8c8bad['query']);_0x486e18['attributes']=_[_0xa00a('0x30')](_0x8c8bad[_0xa00a('0x31')],qs[_0xa00a('0x32')](_0x303fd6['query'][_0xa00a('0x32')]));_0x486e18[_0xa00a('0x33')]=_0x486e18[_0xa00a('0x33')][_0xa00a('0x34')]?_0x486e18[_0xa00a('0x33')]:_0x8c8bad['model'];if(!_0x303fd6[_0xa00a('0x2e')][_0xa00a('0x35')]('nolimit')){_0x486e18['limit']=qs[_0xa00a('0x1d')](_0x303fd6['query'][_0xa00a('0x1d')]);_0x486e18[_0xa00a('0x1b')]=qs[_0xa00a('0x1b')](_0x303fd6['query']['offset']);}_0x486e18[_0xa00a('0x36')]=qs[_0xa00a('0x37')](_0x303fd6[_0xa00a('0x2e')][_0xa00a('0x37')]);_0x486e18[_0xa00a('0x38')]=qs[_0xa00a('0x2f')](_[_0xa00a('0x39')](_0x303fd6[_0xa00a('0x2e')],_0x8c8bad[_0xa00a('0x2f')]),_0x1333d4);if(_0x303fd6[_0xa00a('0x2e')]['filter']){_0x486e18[_0xa00a('0x38')]=_[_0xa00a('0x3a')](_0x486e18['where'],{'$or':_['map'](_0x1333d4,function(_0x4d4510){if(_0x4d4510[_0xa00a('0x2c')]!==_0xa00a('0x3b')){var _0x24de66={};_0x24de66[_0x4d4510['name']]={'$like':'%'+_0x303fd6['query'][_0xa00a('0x3c')]+'%'};return _0x24de66;}})});}_0x486e18=_[_0xa00a('0x3a')]({},_0x486e18,_0x303fd6[_0xa00a('0x3d')]);var _0x374c8b={'where':_0x486e18[_0xa00a('0x38')]};return db[_0xa00a('0x29')][_0xa00a('0x1e')](_0x374c8b)[_0xa00a('0x23')](function(_0x3fc85a){_0x56e78f['count']=_0x3fc85a;if(_0x303fd6['query'][_0xa00a('0x3e')]){_0x486e18[_0xa00a('0x3f')]=[{'all':!![]}];}return db[_0xa00a('0x29')]['findAll'](_0x486e18);})[_0xa00a('0x23')](function(_0x9f463a){_0x56e78f['rows']=_0x9f463a;return _0x56e78f;})[_0xa00a('0x23')](respondWithFilteredResult(_0x37b3db,_0x486e18))[_0xa00a('0x40')](handleError(_0x37b3db,null));};exports[_0xa00a('0x41')]=function(_0x176e54,_0x3e154a){var _0x2010a4={'raw':!![],'where':{'id':_0x176e54[_0xa00a('0x42')]['id']}},_0x420ad0={};_0x420ad0['model']=_['keys'](db[_0xa00a('0x29')][_0xa00a('0x2a')]);_0x420ad0[_0xa00a('0x2e')]=_[_0xa00a('0x43')](_0x176e54['query']);_0x420ad0[_0xa00a('0x2f')]=_[_0xa00a('0x30')](_0x420ad0[_0xa00a('0x31')],_0x420ad0[_0xa00a('0x2e')]);_0x2010a4[_0xa00a('0x33')]=_[_0xa00a('0x30')](_0x420ad0[_0xa00a('0x31')],qs[_0xa00a('0x32')](_0x176e54[_0xa00a('0x2e')][_0xa00a('0x32')]));_0x2010a4['attributes']=_0x2010a4[_0xa00a('0x33')]['length']?_0x2010a4['attributes']:_0x420ad0[_0xa00a('0x31')];if(_0x176e54[_0xa00a('0x2e')][_0xa00a('0x3e')]){_0x2010a4['include']=[{'all':!![]}];}_0x2010a4=_['merge']({},_0x2010a4,_0x176e54['options']);return db[_0xa00a('0x29')][_0xa00a('0x44')](_0x2010a4)[_0xa00a('0x23')](handleEntityNotFound(_0x3e154a,null))[_0xa00a('0x23')](respondWithResult(_0x3e154a,null))[_0xa00a('0x40')](handleError(_0x3e154a,null));};exports['create']=function(_0x55c87c,_0x160b84){return db['ServicenowField']['create'](_0x55c87c['body'],{})[_0xa00a('0x23')](respondWithResult(_0x160b84,0xc9))['catch'](handleError(_0x160b84,null));};exports['update']=function(_0x4828e3,_0x465873){if(_0x4828e3['body']['id']){delete _0x4828e3[_0xa00a('0x45')]['id'];}return db[_0xa00a('0x29')][_0xa00a('0x44')]({'where':{'id':_0x4828e3[_0xa00a('0x42')]['id']}})[_0xa00a('0x23')](handleEntityNotFound(_0x465873,null))[_0xa00a('0x23')](saveUpdates(_0x4828e3['body'],null))[_0xa00a('0x23')](respondWithResult(_0x465873,null))['catch'](handleError(_0x465873,null));};exports['destroy']=function(_0x5efd07,_0x16dc60){return db[_0xa00a('0x29')][_0xa00a('0x44')]({'where':{'id':_0x5efd07[_0xa00a('0x42')]['id']}})[_0xa00a('0x23')](handleEntityNotFound(_0x16dc60,null))[_0xa00a('0x23')](removeEntity(_0x16dc60,null))[_0xa00a('0x40')](handleError(_0x16dc60,null));}; \ No newline at end of file +var _0x4fd0=['length','hasOwnProperty','nolimit','order','sort','where','filters','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','end','error','name','send','index','map','ServicenowField','rawAttributes','type','key','model','query','intersection','fields','attributes'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x4fd0,0xa7));var _0x04fd=function(_0xac8055,_0x5ababb){_0xac8055=_0xac8055-0x0;var _0x2d5608=_0x4fd0[_0xac8055];return _0x2d5608;};'use strict';var emlformat=require(_0x04fd('0x0'));var rimraf=require(_0x04fd('0x1'));var zipdir=require(_0x04fd('0x2'));var jsonpatch=require(_0x04fd('0x3'));var rp=require(_0x04fd('0x4'));var moment=require('moment');var BPromise=require(_0x04fd('0x5'));var Mustache=require(_0x04fd('0x6'));var util=require(_0x04fd('0x7'));var path=require(_0x04fd('0x8'));var sox=require(_0x04fd('0x9'));var csv=require(_0x04fd('0xa'));var ejs=require(_0x04fd('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x04fd('0xc'));var crypto=require(_0x04fd('0xd'));var jsforce=require(_0x04fd('0xe'));var deskjs=require(_0x04fd('0xf'));var toCsv=require(_0x04fd('0xa'));var querystring=require(_0x04fd('0x10'));var Papa=require(_0x04fd('0x11'));var Redis=require('ioredis');var authService=require(_0x04fd('0x12'));var qs=require(_0x04fd('0x13'));var as=require(_0x04fd('0x14'));var hardwareService=require(_0x04fd('0x15'));var logger=require(_0x04fd('0x16'))(_0x04fd('0x17'));var utils=require('../../config/utils');var config=require(_0x04fd('0x18'));var licenseUtil=require(_0x04fd('0x19'));var db=require(_0x04fd('0x1a'))['db'];function respondWithStatusCode(_0x2e7c79,_0xa7b83a){_0xa7b83a=_0xa7b83a||0xcc;return function(_0x25e9ae){if(_0x25e9ae){return _0x2e7c79[_0x04fd('0x1b')](_0xa7b83a);}return _0x2e7c79[_0x04fd('0x1c')](_0xa7b83a)['end']();};}function respondWithResult(_0x5a811c,_0x140bd3){_0x140bd3=_0x140bd3||0xc8;return function(_0x33a507){if(_0x33a507){return _0x5a811c['status'](_0x140bd3)[_0x04fd('0x1d')](_0x33a507);}};}function respondWithFilteredResult(_0xb1b75,_0xcc6432){return function(_0x567d6e){if(_0x567d6e){var _0x150308=typeof _0xcc6432['offset']===_0x04fd('0x1e')&&typeof _0xcc6432[_0x04fd('0x1f')]==='undefined';var _0x36be7c=_0x567d6e[_0x04fd('0x20')];var _0x3c67c1=_0x150308?0x0:_0xcc6432['offset'];var _0x556a36=_0x150308?_0x567d6e['count']:_0xcc6432[_0x04fd('0x21')]+_0xcc6432['limit'];var _0x229729;if(_0x556a36>=_0x36be7c){_0x556a36=_0x36be7c;_0x229729=0xc8;}else{_0x229729=0xce;}_0xb1b75[_0x04fd('0x1c')](_0x229729);return _0xb1b75[_0x04fd('0x22')](_0x04fd('0x23'),_0x3c67c1+'-'+_0x556a36+'/'+_0x36be7c)[_0x04fd('0x1d')](_0x567d6e);}return null;};}function patchUpdates(_0x1214e9){return function(_0x1f7193){try{jsonpatch[_0x04fd('0x24')](_0x1f7193,_0x1214e9,!![]);}catch(_0x38767f){return BPromise['reject'](_0x38767f);}return _0x1f7193['save']();};}function saveUpdates(_0x37d3b2,_0x31ff5e){return function(_0x3c0430){if(_0x3c0430){return _0x3c0430[_0x04fd('0x25')](_0x37d3b2)[_0x04fd('0x26')](function(_0x4aaf4b){return _0x4aaf4b;});}return null;};}function removeEntity(_0xcfed02,_0x5a5ed4){return function(_0x349092){if(_0x349092){return _0x349092[_0x04fd('0x27')]()[_0x04fd('0x26')](function(){_0xcfed02[_0x04fd('0x1c')](0xcc)[_0x04fd('0x28')]();});}};}function handleEntityNotFound(_0x2b39f7,_0x11ea6a){return function(_0x1bc879){if(!_0x1bc879){_0x2b39f7['sendStatus'](0x194);}return _0x1bc879;};}function handleError(_0x508d33,_0x24653e){_0x24653e=_0x24653e||0x1f4;return function(_0x3608c8){logger[_0x04fd('0x29')](_0x3608c8['stack']);if(_0x3608c8[_0x04fd('0x2a')]){delete _0x3608c8[_0x04fd('0x2a')];}_0x508d33[_0x04fd('0x1c')](_0x24653e)[_0x04fd('0x2b')](_0x3608c8);};}exports[_0x04fd('0x2c')]=function(_0x3187d0,_0x351770){var _0x3e1de9={},_0x2022cd={},_0x477a33={'count':0x0,'rows':[]};var _0x44bbcf=_[_0x04fd('0x2d')](db[_0x04fd('0x2e')][_0x04fd('0x2f')],function(_0x530b19){return{'name':_0x530b19['fieldName'],'type':_0x530b19[_0x04fd('0x30')][_0x04fd('0x31')]};});_0x2022cd[_0x04fd('0x32')]=_[_0x04fd('0x2d')](_0x44bbcf,_0x04fd('0x2a'));_0x2022cd[_0x04fd('0x33')]=_['keys'](_0x3187d0['query']);_0x2022cd['filters']=_[_0x04fd('0x34')](_0x2022cd[_0x04fd('0x32')],_0x2022cd['query']);_0x3e1de9['attributes']=_[_0x04fd('0x34')](_0x2022cd[_0x04fd('0x32')],qs[_0x04fd('0x35')](_0x3187d0['query'][_0x04fd('0x35')]));_0x3e1de9[_0x04fd('0x36')]=_0x3e1de9[_0x04fd('0x36')][_0x04fd('0x37')]?_0x3e1de9['attributes']:_0x2022cd['model'];if(!_0x3187d0['query'][_0x04fd('0x38')](_0x04fd('0x39'))){_0x3e1de9['limit']=qs[_0x04fd('0x1f')](_0x3187d0['query'][_0x04fd('0x1f')]);_0x3e1de9[_0x04fd('0x21')]=qs[_0x04fd('0x21')](_0x3187d0[_0x04fd('0x33')][_0x04fd('0x21')]);}_0x3e1de9[_0x04fd('0x3a')]=qs['sort'](_0x3187d0[_0x04fd('0x33')][_0x04fd('0x3b')]);_0x3e1de9[_0x04fd('0x3c')]=qs[_0x04fd('0x3d')](_['pick'](_0x3187d0['query'],_0x2022cd[_0x04fd('0x3d')]),_0x44bbcf);if(_0x3187d0[_0x04fd('0x33')]['filter']){_0x3e1de9[_0x04fd('0x3c')]=_['merge'](_0x3e1de9['where'],{'$or':_[_0x04fd('0x2d')](_0x44bbcf,function(_0x18ad5b){if(_0x18ad5b[_0x04fd('0x30')]!==_0x04fd('0x3e')){var _0x3a1ad9={};_0x3a1ad9[_0x18ad5b['name']]={'$like':'%'+_0x3187d0['query']['filter']+'%'};return _0x3a1ad9;}})});}_0x3e1de9=_[_0x04fd('0x3f')]({},_0x3e1de9,_0x3187d0[_0x04fd('0x40')]);var _0x7b421b={'where':_0x3e1de9[_0x04fd('0x3c')]};return db[_0x04fd('0x2e')][_0x04fd('0x20')](_0x7b421b)[_0x04fd('0x26')](function(_0x31b76b){_0x477a33[_0x04fd('0x20')]=_0x31b76b;if(_0x3187d0[_0x04fd('0x33')][_0x04fd('0x41')]){_0x3e1de9[_0x04fd('0x42')]=[{'all':!![]}];}return db['ServicenowField'][_0x04fd('0x43')](_0x3e1de9);})[_0x04fd('0x26')](function(_0xa326fe){_0x477a33[_0x04fd('0x44')]=_0xa326fe;return _0x477a33;})[_0x04fd('0x26')](respondWithFilteredResult(_0x351770,_0x3e1de9))[_0x04fd('0x45')](handleError(_0x351770,null));};exports['show']=function(_0x3e0fb9,_0x124936){var _0x756a14={'raw':!![],'where':{'id':_0x3e0fb9[_0x04fd('0x46')]['id']}},_0x5e5484={};_0x5e5484[_0x04fd('0x32')]=_[_0x04fd('0x47')](db[_0x04fd('0x2e')][_0x04fd('0x2f')]);_0x5e5484[_0x04fd('0x33')]=_[_0x04fd('0x47')](_0x3e0fb9['query']);_0x5e5484[_0x04fd('0x3d')]=_[_0x04fd('0x34')](_0x5e5484[_0x04fd('0x32')],_0x5e5484['query']);_0x756a14[_0x04fd('0x36')]=_[_0x04fd('0x34')](_0x5e5484['model'],qs[_0x04fd('0x35')](_0x3e0fb9['query']['fields']));_0x756a14[_0x04fd('0x36')]=_0x756a14[_0x04fd('0x36')][_0x04fd('0x37')]?_0x756a14[_0x04fd('0x36')]:_0x5e5484[_0x04fd('0x32')];if(_0x3e0fb9['query'][_0x04fd('0x41')]){_0x756a14[_0x04fd('0x42')]=[{'all':!![]}];}_0x756a14=_[_0x04fd('0x3f')]({},_0x756a14,_0x3e0fb9[_0x04fd('0x40')]);return db['ServicenowField'][_0x04fd('0x48')](_0x756a14)[_0x04fd('0x26')](handleEntityNotFound(_0x124936,null))[_0x04fd('0x26')](respondWithResult(_0x124936,null))[_0x04fd('0x45')](handleError(_0x124936,null));};exports['create']=function(_0x93f6b6,_0x42e2a3){return db['ServicenowField']['create'](_0x93f6b6[_0x04fd('0x49')],{})[_0x04fd('0x26')](respondWithResult(_0x42e2a3,0xc9))[_0x04fd('0x45')](handleError(_0x42e2a3,null));};exports['update']=function(_0x35c44c,_0x22072f){if(_0x35c44c['body']['id']){delete _0x35c44c[_0x04fd('0x49')]['id'];}return db[_0x04fd('0x2e')][_0x04fd('0x48')]({'where':{'id':_0x35c44c[_0x04fd('0x46')]['id']}})[_0x04fd('0x26')](handleEntityNotFound(_0x22072f,null))[_0x04fd('0x26')](saveUpdates(_0x35c44c[_0x04fd('0x49')],null))['then'](respondWithResult(_0x22072f,null))[_0x04fd('0x45')](handleError(_0x22072f,null));};exports[_0x04fd('0x27')]=function(_0x1b53bb,_0x2b05cd){return db[_0x04fd('0x2e')][_0x04fd('0x48')]({'where':{'id':_0x1b53bb[_0x04fd('0x46')]['id']}})[_0x04fd('0x26')](handleEntityNotFound(_0x2b05cd,null))[_0x04fd('0x26')](removeEntity(_0x2b05cd,null))[_0x04fd('0x45')](handleError(_0x2b05cd,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 2711a4c..be42877 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 _0x0bed=['int_servicenow_fields','servicenow_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','ServicenowField'];(function(_0x3018eb,_0x570c63){var _0x23131f=function(_0x33656f){while(--_0x33656f){_0x3018eb['push'](_0x3018eb['shift']());}};_0x23131f(++_0x570c63);}(_0x0bed,0x66));var _0xd0be=function(_0x3dd8f5,_0x236549){_0x3dd8f5=_0x3dd8f5-0x0;var _0x18bfd8=_0x0bed[_0x3dd8f5];return _0x18bfd8;};'use strict';var _=require('lodash');var util=require(_0xd0be('0x0'));var logger=require(_0xd0be('0x1'))(_0xd0be('0x2'));var moment=require(_0xd0be('0x3'));var BPromise=require(_0xd0be('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd0be('0x5'));var rimraf=require('rimraf');var config=require(_0xd0be('0x6'));var attributes=require('./intServicenowField.attributes');module[_0xd0be('0x7')]=function(_0x512f38,_0x472f60){return _0x512f38[_0xd0be('0x8')](_0xd0be('0x9'),attributes,{'tableName':_0xd0be('0xa'),'paranoid':![],'indexes':[{'name':_0xd0be('0xb'),'fields':[_0xd0be('0xc'),_0xd0be('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1dd4=['idField','FieldId','lodash','api','bluebird','path','rimraf','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index'];(function(_0x521862,_0x45930d){var _0x401508=function(_0x465762){while(--_0x465762){_0x521862['push'](_0x521862['shift']());}};_0x401508(++_0x45930d);}(_0x1dd4,0x1e3));var _0x41dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dd4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x41dd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x41dd('0x1'));var moment=require('moment');var BPromise=require(_0x41dd('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x41dd('0x3'));var rimraf=require(_0x41dd('0x4'));var config=require('../../config/environment');var attributes=require(_0x41dd('0x5'));module[_0x41dd('0x6')]=function(_0x7ad602,_0x353b66){return _0x7ad602[_0x41dd('0x7')](_0x41dd('0x8'),attributes,{'tableName':_0x41dd('0x9'),'paranoid':![],'indexes':[{'name':_0x41dd('0xa'),'fields':[_0x41dd('0xb'),_0x41dd('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 22c5805..b3a339e 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(_0xd25b59,_0x217f8a){var _0x4cab47=function(_0x26362d){while(--_0x26362d){_0xd25b59['push'](_0xd25b59['shift']());}};_0x4cab47(++_0x217f8a);}(_0xaa88,0x137));var _0x8aa8=function(_0x2d9535,_0x4bc592){_0x2d9535=_0x2d9535-0x0;var _0xb4e710=_0xaa88[_0x2d9535];return _0xb4e710;};'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 _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x125df5,_0x406825){var _0x2d1258=function(_0x29b583){while(--_0x29b583){_0x125df5['push'](_0x125df5['shift']());}};_0x2d1258(++_0x406825);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2c7995,_0x527e77){_0x2c7995=_0x2c7995-0x0;var _0x4e0134=_0xb43b[_0x2c7995];return _0x4e0134;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 8146260..385e40d 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(_0x4e16b8,_0xd0d913){var _0x5b73d6=function(_0x226d78){while(--_0x226d78){_0x4e16b8['push'](_0x4e16b8['shift']());}};_0x5b73d6(++_0xd0d913);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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(_0xc97e1,_0x14726c){var _0x33869b=function(_0x3cef48){while(--_0x3cef48){_0xc97e1['push'](_0xc97e1['shift']());}};_0x33869b(++_0x14726c);}(_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('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 ebfdc0e..955d4e6 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(_0x28fb8d,_0x1bf1c0){var _0x4897ad=function(_0x4be75e){while(--_0x4be75e){_0x28fb8d['push'](_0x28fb8d['shift']());}};_0x4897ad(++_0x1bf1c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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(_0x6a288a,_0x4e0832){var _0x4fe73f=function(_0x226369){while(--_0x226369){_0x6a288a['push'](_0x6a288a['shift']());}};_0x4fe73f(++_0x4e0832);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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 12bfce3..ab89434 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 _0xca88=['params','getConfigurations','findOne','SugarcrmConfiguration','hasOwnProperty','nolimit','AccountId','getSubjects','channel','Descriptions','SugarcrmField','Subjects','getFields','created_by','description','duration_hours','parent_id','parent_type','parent_name','direction','password','remoteUri','slice','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','username','PLAIN','Invalid\x20Login','Password\x20Expired','POST','get_module_fields','Calls','remove','includes','endsWith','values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body'];(function(_0x285fc1,_0x36f7b1){var _0x58bf57=function(_0x2acaec){while(--_0x2acaec){_0x285fc1['push'](_0x285fc1['shift']());}};_0x58bf57(++_0x36f7b1);}(_0xca88,0xab));var _0x8ca8=function(_0x51cb02,_0x491c6d){_0x51cb02=_0x51cb02-0x0;var _0x2e6ecc=_0xca88[_0x51cb02];return _0x2e6ecc;};'use strict';var emlformat=require(_0x8ca8('0x0'));var rimraf=require(_0x8ca8('0x1'));var zipdir=require(_0x8ca8('0x2'));var jsonpatch=require(_0x8ca8('0x3'));var rp=require(_0x8ca8('0x4'));var moment=require(_0x8ca8('0x5'));var BPromise=require(_0x8ca8('0x6'));var Mustache=require('mustache');var util=require(_0x8ca8('0x7'));var path=require(_0x8ca8('0x8'));var sox=require(_0x8ca8('0x9'));var csv=require(_0x8ca8('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ca8('0xb'));var _=require(_0x8ca8('0xc'));var squel=require(_0x8ca8('0xd'));var crypto=require(_0x8ca8('0xe'));var jsforce=require(_0x8ca8('0xf'));var deskjs=require(_0x8ca8('0x10'));var toCsv=require(_0x8ca8('0xa'));var querystring=require(_0x8ca8('0x11'));var Papa=require(_0x8ca8('0x12'));var Redis=require('ioredis');var authService=require(_0x8ca8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8ca8('0x14'));var hardwareService=require(_0x8ca8('0x15'));var logger=require('../../config/logger')(_0x8ca8('0x16'));var utils=require(_0x8ca8('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8ca8('0x18'))['db'];var integrations=require(_0x8ca8('0x19'));function respondWithStatusCode(_0xce41ca,_0x39df55){_0x39df55=_0x39df55||0xcc;return function(_0x35e57d){if(_0x35e57d){return _0xce41ca[_0x8ca8('0x1a')](_0x39df55);}return _0xce41ca[_0x8ca8('0x1b')](_0x39df55)[_0x8ca8('0x1c')]();};}function respondWithResult(_0x45a7be,_0x36fa47){_0x36fa47=_0x36fa47||0xc8;return function(_0x5eb87a){if(_0x5eb87a){return _0x45a7be[_0x8ca8('0x1b')](_0x36fa47)[_0x8ca8('0x1d')](_0x5eb87a);}};}function respondWithFilteredResult(_0x19e67c,_0x147929){return function(_0x20ca09){if(_0x20ca09){var _0x3cddc8=typeof _0x147929[_0x8ca8('0x1e')]===_0x8ca8('0x1f')&&typeof _0x147929[_0x8ca8('0x20')]==='undefined';var _0x5eda6b=_0x20ca09[_0x8ca8('0x21')];var _0x16f60a=_0x3cddc8?0x0:_0x147929['offset'];var _0x5e3e77=_0x3cddc8?_0x20ca09[_0x8ca8('0x21')]:_0x147929[_0x8ca8('0x1e')]+_0x147929[_0x8ca8('0x20')];var _0x58238a;if(_0x5e3e77>=_0x5eda6b){_0x5e3e77=_0x5eda6b;_0x58238a=0xc8;}else{_0x58238a=0xce;}_0x19e67c[_0x8ca8('0x1b')](_0x58238a);return _0x19e67c[_0x8ca8('0x22')](_0x8ca8('0x23'),_0x16f60a+'-'+_0x5e3e77+'/'+_0x5eda6b)[_0x8ca8('0x1d')](_0x20ca09);}return null;};}function patchUpdates(_0x15b249){return function(_0x3da610){try{jsonpatch[_0x8ca8('0x24')](_0x3da610,_0x15b249,!![]);}catch(_0x3dc11e){return BPromise[_0x8ca8('0x25')](_0x3dc11e);}return _0x3da610[_0x8ca8('0x26')]();};}function saveUpdates(_0x976d19,_0x398920){return function(_0xc14200){if(_0xc14200){return _0xc14200[_0x8ca8('0x27')](_0x976d19)[_0x8ca8('0x28')](function(_0xe50a26){return _0xe50a26;});}return null;};}function removeEntity(_0x128c7b,_0x52af95){return function(_0x396a80){if(_0x396a80){return _0x396a80[_0x8ca8('0x29')]()[_0x8ca8('0x28')](function(){_0x128c7b[_0x8ca8('0x1b')](0xcc)[_0x8ca8('0x1c')]();});}};}function handleEntityNotFound(_0x2918c0,_0x3892b4){return function(_0x43997c){if(!_0x43997c){_0x2918c0['sendStatus'](0x194);}return _0x43997c;};}function handleError(_0x472bf1,_0x5f3938){_0x5f3938=_0x5f3938||0x1f4;return function(_0x4a3756){logger[_0x8ca8('0x2a')](_0x4a3756[_0x8ca8('0x2b')]);if(_0x4a3756[_0x8ca8('0x2c')]){delete _0x4a3756[_0x8ca8('0x2c')];}_0x472bf1[_0x8ca8('0x1b')](_0x5f3938)['send'](_0x4a3756);};}exports[_0x8ca8('0x2d')]=function(_0x49afd5,_0x4cd590){var _0x51d142={},_0x51afee={},_0x4f4f19={'count':0x0,'rows':[]};var _0x1ba20f=_[_0x8ca8('0x2e')](db[_0x8ca8('0x2f')][_0x8ca8('0x30')],function(_0x32de95){return{'name':_0x32de95[_0x8ca8('0x31')],'type':_0x32de95[_0x8ca8('0x32')][_0x8ca8('0x33')]};});_0x51afee[_0x8ca8('0x34')]=_[_0x8ca8('0x2e')](_0x1ba20f,_0x8ca8('0x2c'));_0x51afee['query']=_[_0x8ca8('0x35')](_0x49afd5[_0x8ca8('0x36')]);_0x51afee[_0x8ca8('0x37')]=_[_0x8ca8('0x38')](_0x51afee[_0x8ca8('0x34')],_0x51afee['query']);_0x51d142[_0x8ca8('0x39')]=_[_0x8ca8('0x38')](_0x51afee[_0x8ca8('0x34')],qs[_0x8ca8('0x3a')](_0x49afd5[_0x8ca8('0x36')][_0x8ca8('0x3a')]));_0x51d142[_0x8ca8('0x39')]=_0x51d142[_0x8ca8('0x39')][_0x8ca8('0x3b')]?_0x51d142[_0x8ca8('0x39')]:_0x51afee[_0x8ca8('0x34')];if(!_0x49afd5['query']['hasOwnProperty']('nolimit')){_0x51d142['limit']=qs[_0x8ca8('0x20')](_0x49afd5[_0x8ca8('0x36')]['limit']);_0x51d142[_0x8ca8('0x1e')]=qs['offset'](_0x49afd5[_0x8ca8('0x36')][_0x8ca8('0x1e')]);}_0x51d142[_0x8ca8('0x3c')]=qs[_0x8ca8('0x3d')](_0x49afd5['query']['sort']);_0x51d142[_0x8ca8('0x3e')]=qs[_0x8ca8('0x37')](_[_0x8ca8('0x3f')](_0x49afd5[_0x8ca8('0x36')],_0x51afee['filters']),_0x1ba20f);if(_0x49afd5[_0x8ca8('0x36')][_0x8ca8('0x40')]){_0x51d142[_0x8ca8('0x3e')]=_[_0x8ca8('0x41')](_0x51d142[_0x8ca8('0x3e')],{'$or':_['map'](_0x1ba20f,function(_0x25c71f){if(_0x25c71f[_0x8ca8('0x32')]!==_0x8ca8('0x42')){var _0x4a030f={};_0x4a030f[_0x25c71f[_0x8ca8('0x2c')]]={'$like':'%'+_0x49afd5[_0x8ca8('0x36')][_0x8ca8('0x40')]+'%'};return _0x4a030f;}})});}_0x51d142=_['merge']({},_0x51d142,_0x49afd5[_0x8ca8('0x43')]);var _0x37c0a0={'where':_0x51d142['where']};return db[_0x8ca8('0x2f')]['count'](_0x37c0a0)[_0x8ca8('0x28')](function(_0x460558){_0x4f4f19[_0x8ca8('0x21')]=_0x460558;if(_0x49afd5[_0x8ca8('0x36')][_0x8ca8('0x44')]){_0x51d142[_0x8ca8('0x45')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x8ca8('0x46')](_0x51d142);})[_0x8ca8('0x28')](function(_0xd42bcb){_0x4f4f19[_0x8ca8('0x47')]=_0xd42bcb;return _0x4f4f19;})[_0x8ca8('0x28')](respondWithFilteredResult(_0x4cd590,_0x51d142))[_0x8ca8('0x48')](handleError(_0x4cd590,null));};exports[_0x8ca8('0x49')]=function(_0x5d4e5b,_0x3f5a53){var _0x36907e={'raw':![],'where':{'id':_0x5d4e5b['params']['id']}},_0x5721d3={};_0x5721d3[_0x8ca8('0x34')]=_[_0x8ca8('0x35')](db[_0x8ca8('0x2f')][_0x8ca8('0x30')]);_0x5721d3['query']=_[_0x8ca8('0x35')](_0x5d4e5b[_0x8ca8('0x36')]);_0x5721d3['filters']=_['intersection'](_0x5721d3[_0x8ca8('0x34')],_0x5721d3[_0x8ca8('0x36')]);_0x36907e['attributes']=_[_0x8ca8('0x38')](_0x5721d3[_0x8ca8('0x34')],qs['fields'](_0x5d4e5b[_0x8ca8('0x36')][_0x8ca8('0x3a')]));_0x36907e[_0x8ca8('0x39')]=_0x36907e[_0x8ca8('0x39')][_0x8ca8('0x3b')]?_0x36907e['attributes']:_0x5721d3['model'];if(_0x5d4e5b[_0x8ca8('0x36')]['includeAll']){_0x36907e['include']=[{'all':!![]}];}_0x36907e=_['merge']({},_0x36907e,_0x5d4e5b['options']);return db[_0x8ca8('0x2f')][_0x8ca8('0x4a')](_0x36907e)[_0x8ca8('0x28')](handleEntityNotFound(_0x3f5a53,null))[_0x8ca8('0x28')](respondWithResult(_0x3f5a53,null))[_0x8ca8('0x48')](handleError(_0x3f5a53,null));};exports[_0x8ca8('0x4b')]=function(_0x55f761,_0x5eda27){return db[_0x8ca8('0x2f')][_0x8ca8('0x4b')](_0x55f761[_0x8ca8('0x4c')],{})['then'](respondWithResult(_0x5eda27,0xc9))[_0x8ca8('0x48')](handleError(_0x5eda27,null));};exports[_0x8ca8('0x27')]=function(_0xcd534f,_0x42f7f7){if(_0xcd534f[_0x8ca8('0x4c')]['id']){delete _0xcd534f['body']['id'];}return db[_0x8ca8('0x2f')][_0x8ca8('0x4a')]({'where':{'id':_0xcd534f[_0x8ca8('0x4d')]['id']}})[_0x8ca8('0x28')](handleEntityNotFound(_0x42f7f7,null))['then'](saveUpdates(_0xcd534f[_0x8ca8('0x4c')],null))[_0x8ca8('0x28')](respondWithResult(_0x42f7f7,null))['catch'](handleError(_0x42f7f7,null));};exports[_0x8ca8('0x29')]=function(_0x29bd1e,_0x23a8f4){return db[_0x8ca8('0x2f')][_0x8ca8('0x4a')]({'where':{'id':_0x29bd1e[_0x8ca8('0x4d')]['id']}})[_0x8ca8('0x28')](handleEntityNotFound(_0x23a8f4,null))[_0x8ca8('0x28')](removeEntity(_0x23a8f4,null))[_0x8ca8('0x48')](handleError(_0x23a8f4,null));};exports[_0x8ca8('0x4e')]=function(_0x22e600,_0x193bf3,_0x2bdd19){var _0x3264a5={};var _0x47af88={};var _0x3aa8e8;var _0x1a8dde;return db[_0x8ca8('0x2f')][_0x8ca8('0x4f')]({'where':{'id':_0x22e600['params']['id']}})[_0x8ca8('0x28')](handleEntityNotFound(_0x193bf3,null))[_0x8ca8('0x28')](function(_0x2771a0){if(_0x2771a0){_0x3aa8e8=_0x2771a0;_0x47af88[_0x8ca8('0x34')]=_[_0x8ca8('0x35')](db[_0x8ca8('0x50')][_0x8ca8('0x30')]);_0x47af88[_0x8ca8('0x36')]=_[_0x8ca8('0x35')](_0x22e600[_0x8ca8('0x36')]);_0x47af88['filters']=_['intersection'](_0x47af88[_0x8ca8('0x34')],_0x47af88['query']);_0x3264a5[_0x8ca8('0x39')]=_[_0x8ca8('0x38')](_0x47af88[_0x8ca8('0x34')],qs['fields'](_0x22e600['query'][_0x8ca8('0x3a')]));_0x3264a5['attributes']=_0x3264a5[_0x8ca8('0x39')]['length']?_0x3264a5[_0x8ca8('0x39')]:_0x47af88[_0x8ca8('0x34')];_0x3264a5['order']=qs[_0x8ca8('0x3d')](_0x22e600[_0x8ca8('0x36')]['sort']);_0x3264a5[_0x8ca8('0x3e')]=qs['filters'](_[_0x8ca8('0x3f')](_0x22e600['query'],_0x47af88['filters']));if(_0x22e600[_0x8ca8('0x36')][_0x8ca8('0x40')]){_0x3264a5[_0x8ca8('0x3e')]=_['merge'](_0x3264a5[_0x8ca8('0x3e')],{'$or':_[_0x8ca8('0x2e')](_0x3264a5[_0x8ca8('0x39')],function(_0x3d5ec6){var _0x3a00a7={};_0x3a00a7[_0x3d5ec6]={'$like':'%'+_0x22e600['query'][_0x8ca8('0x40')]+'%'};return _0x3a00a7;})});}_0x3264a5=_[_0x8ca8('0x41')]({},_0x3264a5,_0x22e600['options']);return _0x3aa8e8['getConfigurations'](_0x3264a5);}})[_0x8ca8('0x28')](function(_0x5d79a5){if(_0x5d79a5){_0x1a8dde=_0x5d79a5[_0x8ca8('0x3b')];if(!_0x22e600[_0x8ca8('0x36')][_0x8ca8('0x51')](_0x8ca8('0x52'))){_0x3264a5[_0x8ca8('0x20')]=qs[_0x8ca8('0x20')](_0x22e600[_0x8ca8('0x36')]['limit']);_0x3264a5[_0x8ca8('0x1e')]=qs[_0x8ca8('0x1e')](_0x22e600[_0x8ca8('0x36')]['offset']);}return _0x3aa8e8[_0x8ca8('0x4e')](_0x3264a5);}})[_0x8ca8('0x28')](function(_0x4cdbc9){if(_0x4cdbc9){return _0x4cdbc9?{'count':_0x1a8dde,'rows':_0x4cdbc9}:null;}})[_0x8ca8('0x28')](respondWithResult(_0x193bf3,null))[_0x8ca8('0x48')](handleError(_0x193bf3,null));};exports['addConfiguration']=function(_0x3aea19,_0x55aa92,_0x411f3f){if(_0x3aea19['body']['id']){delete _0x3aea19['body']['id'];}return db[_0x8ca8('0x2f')][_0x8ca8('0x4f')]({'where':{'id':_0x3aea19['params']['id']}})[_0x8ca8('0x28')](handleEntityNotFound(_0x55aa92,null))[_0x8ca8('0x28')](function(_0x4f2718){if(_0x4f2718){_0x3aea19['body'][_0x8ca8('0x53')]=_0x4f2718['id'];_0x3aea19[_0x8ca8('0x4c')]['Subjects']=integrations[_0x8ca8('0x54')](_0x3aea19[_0x8ca8('0x4c')][_0x8ca8('0x55')],_0x3aea19[_0x8ca8('0x4c')][_0x8ca8('0x32')]);_0x3aea19[_0x8ca8('0x4c')][_0x8ca8('0x56')]=integrations['getDescriptions'](_0x3aea19[_0x8ca8('0x4c')][_0x8ca8('0x55')],_0x3aea19[_0x8ca8('0x4c')][_0x8ca8('0x32')]);return db[_0x8ca8('0x50')][_0x8ca8('0x4b')](_0x3aea19[_0x8ca8('0x4c')],{'include':[{'model':db[_0x8ca8('0x57')],'as':_0x8ca8('0x58')},{'model':db['SugarcrmField'],'as':_0x8ca8('0x56')}]});}return null;})['then'](respondWithResult(_0x55aa92,null))['catch'](handleError(_0x55aa92,null));};exports[_0x8ca8('0x59')]=function(_0x49976e,_0x103290,_0xe9bffd){var _0x3b2c5e='';var _0x294ee0=['id',_0x8ca8('0x2c'),'assigned_user_id',_0x8ca8('0x5a'),_0x8ca8('0x5b'),'date_start',_0x8ca8('0x5c'),'duration_minutes',_0x8ca8('0x5d'),_0x8ca8('0x5e'),_0x8ca8('0x5f'),_0x8ca8('0x60')];return db['SugarcrmAccount'][_0x8ca8('0x4f')]({'where':{'id':_0x49976e[_0x8ca8('0x4d')]['id']},'attributes':['id','username',_0x8ca8('0x61'),'remoteUri']})[_0x8ca8('0x28')](handleEntityNotFound(_0x103290,null))[_0x8ca8('0x28')](function(_0x4c5672){if(_0x4c5672){_0x3b2c5e=_0x4c5672[_0x8ca8('0x62')];var _0x591771=_0x3b2c5e[_0x8ca8('0x63')](-0x1);if(_0x591771==='/'){_0x3b2c5e=_0x3b2c5e[_0x8ca8('0x64')](0x0,_0x3b2c5e[_0x8ca8('0x65')](_0x591771));}return rp({'method':'POST','uri':util[_0x8ca8('0x66')](_0x8ca8('0x67'),_0x3b2c5e,_0x8ca8('0x68')),'json':!![],'form':{'method':_0x8ca8('0x69'),'input_type':_0x8ca8('0x6a'),'response_type':'JSON','rest_data':JSON[_0x8ca8('0x6b')]({'user_auth':{'user_name':_0x4c5672[_0x8ca8('0x6c')],'password':_0x4c5672['password'],'encryption':_0x8ca8('0x6d')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x8ca8('0x28')](function(_0x15a253){if(_0x15a253&&_0x15a253[_0x8ca8('0x2c')]!==_0x8ca8('0x6e')&&_0x15a253[_0x8ca8('0x2c')]!==_0x8ca8('0x6f')){return rp({'method':_0x8ca8('0x70'),'uri':util[_0x8ca8('0x66')]('%s%s',_0x3b2c5e,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x8ca8('0x71'),'input_type':_0x8ca8('0x6a'),'response_type':_0x8ca8('0x6a'),'rest_data':JSON[_0x8ca8('0x6b')]({'session':_0x15a253['id'],'module_name':_0x8ca8('0x72')})}})[_0x8ca8('0x28')](function(_0x770d9c){if(_0x770d9c){var _0x1d5729=_['values'](_0x770d9c['module_fields']);_[_0x8ca8('0x73')](_0x1d5729,function(_0x3b9594){return _0x294ee0[_0x8ca8('0x74')](_0x3b9594[_0x8ca8('0x2c')]);});return{'count':_0x1d5729[_0x8ca8('0x3b')],'rows':_[_0x8ca8('0x2e')](_0x1d5729,function(_0x343614){return{'id':_0x343614[_0x8ca8('0x2c')],'name':_0x343614['label'],'custom':_[_0x8ca8('0x75')](_0x343614[_0x8ca8('0x2c')],'_c')?!![]:![],'options':_0x343614[_0x8ca8('0x43')]?_['map'](_[_0x8ca8('0x76')](_0x343614['options']),function(_0x1f9e48){return{'name':_0x1f9e48['value'],'value':_0x1f9e48[_0x8ca8('0x2c')]};}):[]};})};}})[_0x8ca8('0x28')](respondWithResult(_0x103290,null))[_0x8ca8('0x48')](function(_0x28abf6){var _0x7b775f=_0x49976e[_0x8ca8('0x36')][_0x8ca8('0x77')]?0x1f4:_0x28abf6[_0x8ca8('0x78')]||0x1f4;logger['error'](_0x8ca8('0x79'),_0x8ca8('0x59'),_0x7b775f,JSON[_0x8ca8('0x6b')](_0x28abf6));delete _0x28abf6[_0x8ca8('0x2c')];if(_0x7b775f===0x191){_0x7b775f=0x190;}_0x103290[_0x8ca8('0x1b')](_0x7b775f)['send'](_0x49976e[_0x8ca8('0x36')][_0x8ca8('0x77')]?{'message':'Wrong\x20credentials','statusCode':_0x28abf6[_0x8ca8('0x78')]}:_0x28abf6);});}else{var _0x410de5=0x1f4;_0x103290['status'](_0x410de5)[_0x8ca8('0x7a')]({'message':_0x8ca8('0x7b'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xba63=['Wrong\x20credentials','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','end','offset','undefined','count','limit','status','set','Content-Range','json','apply','reject','save','update','then','stack','name','send','index','SugarcrmAccount','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','destroy','getConfigurations','findOne','SugarcrmConfiguration','pick','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_id','direction','username','password','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','JSON','PLAIN','Invalid\x20Login','Password\x20Expired','format','stringify','module_fields','remove','includes','label','endsWith','values','value','test','statusCode','error'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0xba63,0xed));var _0x3ba6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xba63[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3ba6('0x0'));var zipdir=require(_0x3ba6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3ba6('0x2'));var BPromise=require(_0x3ba6('0x3'));var Mustache=require(_0x3ba6('0x4'));var util=require(_0x3ba6('0x5'));var path=require(_0x3ba6('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3ba6('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3ba6('0x8'));var squel=require(_0x3ba6('0x9'));var crypto=require(_0x3ba6('0xa'));var jsforce=require(_0x3ba6('0xb'));var deskjs=require(_0x3ba6('0xc'));var toCsv=require(_0x3ba6('0xd'));var querystring=require(_0x3ba6('0xe'));var Papa=require('papaparse');var Redis=require(_0x3ba6('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3ba6('0x10'));var hardwareService=require(_0x3ba6('0x11'));var logger=require(_0x3ba6('0x12'))(_0x3ba6('0x13'));var utils=require(_0x3ba6('0x14'));var config=require(_0x3ba6('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x3ba6('0x16'));function respondWithStatusCode(_0x235538,_0x1b229f){_0x1b229f=_0x1b229f||0xcc;return function(_0x580d55){if(_0x580d55){return _0x235538[_0x3ba6('0x17')](_0x1b229f);}return _0x235538['status'](_0x1b229f)[_0x3ba6('0x18')]();};}function respondWithResult(_0x5e53c3,_0x491f88){_0x491f88=_0x491f88||0xc8;return function(_0x5965b4){if(_0x5965b4){return _0x5e53c3['status'](_0x491f88)['json'](_0x5965b4);}};}function respondWithFilteredResult(_0x3da03e,_0x1d81dd){return function(_0x80cff1){if(_0x80cff1){var _0x5ac79f=typeof _0x1d81dd[_0x3ba6('0x19')]==='undefined'&&typeof _0x1d81dd['limit']===_0x3ba6('0x1a');var _0x1b71b3=_0x80cff1[_0x3ba6('0x1b')];var _0x320dee=_0x5ac79f?0x0:_0x1d81dd[_0x3ba6('0x19')];var _0x10247b=_0x5ac79f?_0x80cff1[_0x3ba6('0x1b')]:_0x1d81dd[_0x3ba6('0x19')]+_0x1d81dd[_0x3ba6('0x1c')];var _0x40b9f1;if(_0x10247b>=_0x1b71b3){_0x10247b=_0x1b71b3;_0x40b9f1=0xc8;}else{_0x40b9f1=0xce;}_0x3da03e[_0x3ba6('0x1d')](_0x40b9f1);return _0x3da03e[_0x3ba6('0x1e')](_0x3ba6('0x1f'),_0x320dee+'-'+_0x10247b+'/'+_0x1b71b3)[_0x3ba6('0x20')](_0x80cff1);}return null;};}function patchUpdates(_0x426afc){return function(_0x10ba61){try{jsonpatch[_0x3ba6('0x21')](_0x10ba61,_0x426afc,!![]);}catch(_0x2f77c6){return BPromise[_0x3ba6('0x22')](_0x2f77c6);}return _0x10ba61[_0x3ba6('0x23')]();};}function saveUpdates(_0x1b4be3,_0x485410){return function(_0x5a7540){if(_0x5a7540){return _0x5a7540[_0x3ba6('0x24')](_0x1b4be3)['then'](function(_0x2db99c){return _0x2db99c;});}return null;};}function removeEntity(_0x4945bc,_0x139e9e){return function(_0x47a5f1){if(_0x47a5f1){return _0x47a5f1['destroy']()[_0x3ba6('0x25')](function(){_0x4945bc['status'](0xcc)[_0x3ba6('0x18')]();});}};}function handleEntityNotFound(_0x3e7388,_0x5b50ee){return function(_0x3a9eb1){if(!_0x3a9eb1){_0x3e7388[_0x3ba6('0x17')](0x194);}return _0x3a9eb1;};}function handleError(_0x42be30,_0x33f4bf){_0x33f4bf=_0x33f4bf||0x1f4;return function(_0x2e6a99){logger['error'](_0x2e6a99[_0x3ba6('0x26')]);if(_0x2e6a99['name']){delete _0x2e6a99[_0x3ba6('0x27')];}_0x42be30['status'](_0x33f4bf)[_0x3ba6('0x28')](_0x2e6a99);};}exports[_0x3ba6('0x29')]=function(_0x3c0a8d,_0x2e11f1){var _0x575ab1={},_0x487cf5={},_0x54442d={'count':0x0,'rows':[]};var _0x513c48=_['map'](db[_0x3ba6('0x2a')][_0x3ba6('0x2b')],function(_0xf7cbce){return{'name':_0xf7cbce[_0x3ba6('0x2c')],'type':_0xf7cbce['type'][_0x3ba6('0x2d')]};});_0x487cf5[_0x3ba6('0x2e')]=_[_0x3ba6('0x2f')](_0x513c48,'name');_0x487cf5[_0x3ba6('0x30')]=_['keys'](_0x3c0a8d[_0x3ba6('0x30')]);_0x487cf5[_0x3ba6('0x31')]=_[_0x3ba6('0x32')](_0x487cf5[_0x3ba6('0x2e')],_0x487cf5[_0x3ba6('0x30')]);_0x575ab1[_0x3ba6('0x33')]=_[_0x3ba6('0x32')](_0x487cf5[_0x3ba6('0x2e')],qs['fields'](_0x3c0a8d[_0x3ba6('0x30')][_0x3ba6('0x34')]));_0x575ab1[_0x3ba6('0x33')]=_0x575ab1[_0x3ba6('0x33')][_0x3ba6('0x35')]?_0x575ab1['attributes']:_0x487cf5[_0x3ba6('0x2e')];if(!_0x3c0a8d[_0x3ba6('0x30')]['hasOwnProperty'](_0x3ba6('0x36'))){_0x575ab1[_0x3ba6('0x1c')]=qs[_0x3ba6('0x1c')](_0x3c0a8d[_0x3ba6('0x30')]['limit']);_0x575ab1['offset']=qs[_0x3ba6('0x19')](_0x3c0a8d[_0x3ba6('0x30')][_0x3ba6('0x19')]);}_0x575ab1[_0x3ba6('0x37')]=qs[_0x3ba6('0x38')](_0x3c0a8d['query'][_0x3ba6('0x38')]);_0x575ab1[_0x3ba6('0x39')]=qs[_0x3ba6('0x31')](_['pick'](_0x3c0a8d[_0x3ba6('0x30')],_0x487cf5[_0x3ba6('0x31')]),_0x513c48);if(_0x3c0a8d[_0x3ba6('0x30')][_0x3ba6('0x3a')]){_0x575ab1[_0x3ba6('0x39')]=_[_0x3ba6('0x3b')](_0x575ab1['where'],{'$or':_[_0x3ba6('0x2f')](_0x513c48,function(_0x3cb2e6){if(_0x3cb2e6[_0x3ba6('0x3c')]!==_0x3ba6('0x3d')){var _0x5b6b18={};_0x5b6b18[_0x3cb2e6[_0x3ba6('0x27')]]={'$like':'%'+_0x3c0a8d['query'][_0x3ba6('0x3a')]+'%'};return _0x5b6b18;}})});}_0x575ab1=_[_0x3ba6('0x3b')]({},_0x575ab1,_0x3c0a8d[_0x3ba6('0x3e')]);var _0x35efb9={'where':_0x575ab1[_0x3ba6('0x39')]};return db['SugarcrmAccount']['count'](_0x35efb9)[_0x3ba6('0x25')](function(_0x2bd8f3){_0x54442d[_0x3ba6('0x1b')]=_0x2bd8f3;if(_0x3c0a8d[_0x3ba6('0x30')][_0x3ba6('0x3f')]){_0x575ab1[_0x3ba6('0x40')]=[{'all':!![]}];}return db[_0x3ba6('0x2a')][_0x3ba6('0x41')](_0x575ab1);})[_0x3ba6('0x25')](function(_0x5516d8){_0x54442d['rows']=_0x5516d8;return _0x54442d;})[_0x3ba6('0x25')](respondWithFilteredResult(_0x2e11f1,_0x575ab1))[_0x3ba6('0x42')](handleError(_0x2e11f1,null));};exports[_0x3ba6('0x43')]=function(_0x54d9d2,_0x434232){var _0x525a2f={'raw':![],'where':{'id':_0x54d9d2[_0x3ba6('0x44')]['id']}},_0x1aad68={};_0x1aad68['model']=_[_0x3ba6('0x45')](db['SugarcrmAccount'][_0x3ba6('0x2b')]);_0x1aad68[_0x3ba6('0x30')]=_['keys'](_0x54d9d2['query']);_0x1aad68[_0x3ba6('0x31')]=_[_0x3ba6('0x32')](_0x1aad68['model'],_0x1aad68[_0x3ba6('0x30')]);_0x525a2f[_0x3ba6('0x33')]=_[_0x3ba6('0x32')](_0x1aad68[_0x3ba6('0x2e')],qs[_0x3ba6('0x34')](_0x54d9d2[_0x3ba6('0x30')][_0x3ba6('0x34')]));_0x525a2f[_0x3ba6('0x33')]=_0x525a2f[_0x3ba6('0x33')][_0x3ba6('0x35')]?_0x525a2f[_0x3ba6('0x33')]:_0x1aad68[_0x3ba6('0x2e')];if(_0x54d9d2[_0x3ba6('0x30')]['includeAll']){_0x525a2f[_0x3ba6('0x40')]=[{'all':!![]}];}_0x525a2f=_[_0x3ba6('0x3b')]({},_0x525a2f,_0x54d9d2['options']);return db['SugarcrmAccount'][_0x3ba6('0x46')](_0x525a2f)[_0x3ba6('0x25')](handleEntityNotFound(_0x434232,null))[_0x3ba6('0x25')](respondWithResult(_0x434232,null))[_0x3ba6('0x42')](handleError(_0x434232,null));};exports[_0x3ba6('0x47')]=function(_0x596e4e,_0xdc1f96){return db[_0x3ba6('0x2a')]['create'](_0x596e4e['body'],{})[_0x3ba6('0x25')](respondWithResult(_0xdc1f96,0xc9))['catch'](handleError(_0xdc1f96,null));};exports[_0x3ba6('0x24')]=function(_0x1b6c76,_0x1251c9){if(_0x1b6c76['body']['id']){delete _0x1b6c76[_0x3ba6('0x48')]['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x1b6c76[_0x3ba6('0x44')]['id']}})['then'](handleEntityNotFound(_0x1251c9,null))[_0x3ba6('0x25')](saveUpdates(_0x1b6c76[_0x3ba6('0x48')],null))['then'](respondWithResult(_0x1251c9,null))['catch'](handleError(_0x1251c9,null));};exports[_0x3ba6('0x49')]=function(_0x1e57f2,_0x14c03e){return db[_0x3ba6('0x2a')][_0x3ba6('0x46')]({'where':{'id':_0x1e57f2[_0x3ba6('0x44')]['id']}})[_0x3ba6('0x25')](handleEntityNotFound(_0x14c03e,null))[_0x3ba6('0x25')](removeEntity(_0x14c03e,null))['catch'](handleError(_0x14c03e,null));};exports[_0x3ba6('0x4a')]=function(_0x3839d8,_0x22bb11,_0x5521ad){var _0x2769ce={};var _0x527363={};var _0x1528cc;var _0x3b38a8;return db[_0x3ba6('0x2a')][_0x3ba6('0x4b')]({'where':{'id':_0x3839d8[_0x3ba6('0x44')]['id']}})[_0x3ba6('0x25')](handleEntityNotFound(_0x22bb11,null))[_0x3ba6('0x25')](function(_0x24fe47){if(_0x24fe47){_0x1528cc=_0x24fe47;_0x527363[_0x3ba6('0x2e')]=_[_0x3ba6('0x45')](db[_0x3ba6('0x4c')]['rawAttributes']);_0x527363[_0x3ba6('0x30')]=_[_0x3ba6('0x45')](_0x3839d8[_0x3ba6('0x30')]);_0x527363['filters']=_[_0x3ba6('0x32')](_0x527363[_0x3ba6('0x2e')],_0x527363['query']);_0x2769ce[_0x3ba6('0x33')]=_[_0x3ba6('0x32')](_0x527363['model'],qs[_0x3ba6('0x34')](_0x3839d8[_0x3ba6('0x30')][_0x3ba6('0x34')]));_0x2769ce['attributes']=_0x2769ce['attributes'][_0x3ba6('0x35')]?_0x2769ce[_0x3ba6('0x33')]:_0x527363[_0x3ba6('0x2e')];_0x2769ce[_0x3ba6('0x37')]=qs[_0x3ba6('0x38')](_0x3839d8[_0x3ba6('0x30')]['sort']);_0x2769ce[_0x3ba6('0x39')]=qs[_0x3ba6('0x31')](_[_0x3ba6('0x4d')](_0x3839d8['query'],_0x527363[_0x3ba6('0x31')]));if(_0x3839d8[_0x3ba6('0x30')][_0x3ba6('0x3a')]){_0x2769ce['where']=_[_0x3ba6('0x3b')](_0x2769ce[_0x3ba6('0x39')],{'$or':_['map'](_0x2769ce[_0x3ba6('0x33')],function(_0x39008e){var _0x5cace8={};_0x5cace8[_0x39008e]={'$like':'%'+_0x3839d8[_0x3ba6('0x30')][_0x3ba6('0x3a')]+'%'};return _0x5cace8;})});}_0x2769ce=_[_0x3ba6('0x3b')]({},_0x2769ce,_0x3839d8[_0x3ba6('0x3e')]);return _0x1528cc[_0x3ba6('0x4a')](_0x2769ce);}})['then'](function(_0x2fff59){if(_0x2fff59){_0x3b38a8=_0x2fff59[_0x3ba6('0x35')];if(!_0x3839d8[_0x3ba6('0x30')][_0x3ba6('0x4e')](_0x3ba6('0x36'))){_0x2769ce['limit']=qs['limit'](_0x3839d8['query'][_0x3ba6('0x1c')]);_0x2769ce[_0x3ba6('0x19')]=qs[_0x3ba6('0x19')](_0x3839d8[_0x3ba6('0x30')]['offset']);}return _0x1528cc['getConfigurations'](_0x2769ce);}})[_0x3ba6('0x25')](function(_0x4ccffd){if(_0x4ccffd){return _0x4ccffd?{'count':_0x3b38a8,'rows':_0x4ccffd}:null;}})[_0x3ba6('0x25')](respondWithResult(_0x22bb11,null))[_0x3ba6('0x42')](handleError(_0x22bb11,null));};exports['addConfiguration']=function(_0x83e5be,_0x45b937,_0x223d3c){if(_0x83e5be['body']['id']){delete _0x83e5be[_0x3ba6('0x48')]['id'];}return db['SugarcrmAccount'][_0x3ba6('0x4b')]({'where':{'id':_0x83e5be['params']['id']}})[_0x3ba6('0x25')](handleEntityNotFound(_0x45b937,null))['then'](function(_0x2d9832){if(_0x2d9832){_0x83e5be[_0x3ba6('0x48')][_0x3ba6('0x4f')]=_0x2d9832['id'];_0x83e5be[_0x3ba6('0x48')][_0x3ba6('0x50')]=integrations[_0x3ba6('0x51')](_0x83e5be[_0x3ba6('0x48')][_0x3ba6('0x52')],_0x83e5be['body']['type']);_0x83e5be[_0x3ba6('0x48')][_0x3ba6('0x53')]=integrations[_0x3ba6('0x54')](_0x83e5be['body'][_0x3ba6('0x52')],_0x83e5be[_0x3ba6('0x48')]['type']);return db[_0x3ba6('0x4c')][_0x3ba6('0x47')](_0x83e5be[_0x3ba6('0x48')],{'include':[{'model':db[_0x3ba6('0x55')],'as':'Subjects'},{'model':db[_0x3ba6('0x55')],'as':_0x3ba6('0x53')}]});}return null;})[_0x3ba6('0x25')](respondWithResult(_0x45b937,null))[_0x3ba6('0x42')](handleError(_0x45b937,null));};exports[_0x3ba6('0x56')]=function(_0x2bede9,_0x728cc5,_0x4ef78e){var _0x2d9f54='';var _0x394182=['id',_0x3ba6('0x27'),_0x3ba6('0x57'),_0x3ba6('0x58'),'description',_0x3ba6('0x59'),_0x3ba6('0x5a'),_0x3ba6('0x5b'),_0x3ba6('0x5c'),'parent_type','parent_name',_0x3ba6('0x5d')];return db[_0x3ba6('0x2a')]['findOne']({'where':{'id':_0x2bede9['params']['id']},'attributes':['id',_0x3ba6('0x5e'),_0x3ba6('0x5f'),'remoteUri']})['then'](handleEntityNotFound(_0x728cc5,null))['then'](function(_0x22725b){if(_0x22725b){_0x2d9f54=_0x22725b['remoteUri'];var _0x1da4ac=_0x2d9f54['slice'](-0x1);if(_0x1da4ac==='/'){_0x2d9f54=_0x2d9f54[_0x3ba6('0x60')](0x0,_0x2d9f54[_0x3ba6('0x61')](_0x1da4ac));}return rp({'method':_0x3ba6('0x62'),'uri':util['format'](_0x3ba6('0x63'),_0x2d9f54,_0x3ba6('0x64')),'json':!![],'form':{'method':'login','input_type':_0x3ba6('0x65'),'response_type':_0x3ba6('0x65'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x22725b[_0x3ba6('0x5e')],'password':_0x22725b[_0x3ba6('0x5f')],'encryption':_0x3ba6('0x66')},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0x2d1014){if(_0x2d1014&&_0x2d1014[_0x3ba6('0x27')]!==_0x3ba6('0x67')&&_0x2d1014['name']!==_0x3ba6('0x68')){return rp({'method':_0x3ba6('0x62'),'uri':util[_0x3ba6('0x69')]('%s%s',_0x2d9f54,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':_0x3ba6('0x65'),'response_type':_0x3ba6('0x65'),'rest_data':JSON[_0x3ba6('0x6a')]({'session':_0x2d1014['id'],'module_name':'Calls'})}})[_0x3ba6('0x25')](function(_0x162438){if(_0x162438){var _0x1f2aea=_['values'](_0x162438[_0x3ba6('0x6b')]);_[_0x3ba6('0x6c')](_0x1f2aea,function(_0xc46e8b){return _0x394182[_0x3ba6('0x6d')](_0xc46e8b[_0x3ba6('0x27')]);});return{'count':_0x1f2aea[_0x3ba6('0x35')],'rows':_[_0x3ba6('0x2f')](_0x1f2aea,function(_0x1c9b54){return{'id':_0x1c9b54[_0x3ba6('0x27')],'name':_0x1c9b54[_0x3ba6('0x6e')],'custom':_[_0x3ba6('0x6f')](_0x1c9b54[_0x3ba6('0x27')],'_c')?!![]:![],'options':_0x1c9b54[_0x3ba6('0x3e')]?_[_0x3ba6('0x2f')](_[_0x3ba6('0x70')](_0x1c9b54[_0x3ba6('0x3e')]),function(_0x363f69){return{'name':_0x363f69[_0x3ba6('0x71')],'value':_0x363f69[_0x3ba6('0x27')]};}):[]};})};}})[_0x3ba6('0x25')](respondWithResult(_0x728cc5,null))[_0x3ba6('0x42')](function(_0x464cc0){var _0x45952b=_0x2bede9[_0x3ba6('0x30')][_0x3ba6('0x72')]?0x1f4:_0x464cc0[_0x3ba6('0x73')]||0x1f4;logger[_0x3ba6('0x74')]('getFields,\x20%s,\x20%s,\x20%s',_0x3ba6('0x56'),_0x45952b,JSON['stringify'](_0x464cc0));delete _0x464cc0[_0x3ba6('0x27')];if(_0x45952b===0x191){_0x45952b=0x190;}_0x728cc5[_0x3ba6('0x1d')](_0x45952b)[_0x3ba6('0x28')](_0x2bede9[_0x3ba6('0x30')][_0x3ba6('0x72')]?{'message':_0x3ba6('0x75'),'statusCode':_0x464cc0['statusCode']}:_0x464cc0);});}else{var _0x4daf0b=0x1f4;_0x728cc5[_0x3ba6('0x1d')](_0x4daf0b)[_0x3ba6('0x28')]({'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 50e8fc6..81b0824 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 _0xee3a=['rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x55d6a1,_0x4a3b75){var _0x5ef900=function(_0x2995bc){while(--_0x2995bc){_0x55d6a1['push'](_0x55d6a1['shift']());}};_0x5ef900(++_0x4a3b75);}(_0xee3a,0x13f));var _0xaee3=function(_0x1a7470,_0x513bb0){_0x1a7470=_0x1a7470-0x0;var _0x2973e2=_0xee3a[_0x1a7470];return _0x2973e2;};'use strict';var _=require(_0xaee3('0x0'));var util=require(_0xaee3('0x1'));var logger=require(_0xaee3('0x2'))('api');var moment=require(_0xaee3('0x3'));var BPromise=require(_0xaee3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaee3('0x5'));var rimraf=require(_0xaee3('0x6'));var config=require(_0xaee3('0x7'));var attributes=require(_0xaee3('0x8'));var integrations=require(_0xaee3('0x9'));module[_0xaee3('0xa')]=function(_0x1b15ed,_0x50c037){return _0x1b15ed[_0xaee3('0xb')](_0xaee3('0xc'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7757=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts'];(function(_0x499aab,_0x79ef10){var _0x1174b1=function(_0x2625eb){while(--_0x2625eb){_0x499aab['push'](_0x499aab['shift']());}};_0x1174b1(++_0x79ef10);}(_0x7757,0x12b));var _0x7775=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x7757[_0x2763f2];return _0x3ef471;};'use strict';var _=require('lodash');var util=require(_0x7775('0x0'));var logger=require(_0x7775('0x1'))(_0x7775('0x2'));var moment=require(_0x7775('0x3'));var BPromise=require(_0x7775('0x4'));var rp=require(_0x7775('0x5'));var fs=require('fs');var path=require(_0x7775('0x6'));var rimraf=require(_0x7775('0x7'));var config=require('../../config/environment');var attributes=require(_0x7775('0x8'));var integrations=require(_0x7775('0x9'));module['exports']=function(_0x433ca8,_0xee7bdf){return _0x433ca8[_0x7775('0xa')](_0x7775('0xb'),attributes,{'tableName':_0x7775('0xc'),'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 c138211..a19de95 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 _0x660a=['error','code','message','result','findAll','options','raw','where','limit','include','map','model','attributes','debug','stringify','catch','GetSugarcrmAccount','ShowSugarcrmAccount','SugarcrmAccount','find','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s'];(function(_0x3f29bc,_0x102fa1){var _0x253de9=function(_0x3ee168){while(--_0x3ee168){_0x3f29bc['push'](_0x3f29bc['shift']());}};_0x253de9(++_0x102fa1);}(_0x660a,0xa4));var _0xa660=function(_0x21b87c,_0x1fcc0c){_0x21b87c=_0x21b87c-0x0;var _0x54cfec=_0x660a[_0x21b87c];return _0x54cfec;};'use strict';var _=require('lodash');var util=require(_0xa660('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa660('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa660('0x2'))['db'];var utils=require(_0xa660('0x3'));var logger=require(_0xa660('0x4'))(_0xa660('0x5'));var config=require(_0xa660('0x6'));var jayson=require(_0xa660('0x7'));var client=jayson[_0xa660('0x8')][_0xa660('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x306d15,_0x3f9445,_0x23d43f){return new BPromise(function(_0x8f8c49,_0x222202){return client[_0xa660('0xa')](_0x306d15,_0x23d43f)[_0xa660('0xb')](function(_0x1afd6d){logger[_0xa660('0xc')](_0xa660('0xd'),_0x3f9445,_0xa660('0xe'));logger['debug'](_0xa660('0xf'),_0x3f9445,_0xa660('0xe'),JSON['stringify'](_0x1afd6d));if(_0x1afd6d['error']){if(_0x1afd6d[_0xa660('0x10')][_0xa660('0x11')]===0x1f4){logger[_0xa660('0x10')](_0xa660('0xd'),_0x3f9445,_0x1afd6d[_0xa660('0x10')][_0xa660('0x12')]);return _0x222202(_0x1afd6d[_0xa660('0x10')][_0xa660('0x12')]);}logger[_0xa660('0x10')](_0xa660('0xd'),_0x3f9445,_0x1afd6d[_0xa660('0x10')][_0xa660('0x12')]);return _0x8f8c49(_0x1afd6d['error'][_0xa660('0x12')]);}else{logger[_0xa660('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x3f9445,'request\x20sent');_0x8f8c49(_0x1afd6d[_0xa660('0x13')][_0xa660('0x12')]);}})['catch'](function(_0x5d6831){logger[_0xa660('0x10')](_0xa660('0xd'),_0x3f9445,_0x5d6831);_0x222202(_0x5d6831);});});}exports['GetSugarcrmAccount']=function(_0xfdd97){var _0x42eae4=this;return new Promise(function(_0x516347,_0x549fc8){return db['SugarcrmAccount'][_0xa660('0x14')]({'raw':_0xfdd97[_0xa660('0x15')]?_0xfdd97['options'][_0xa660('0x16')]===undefined?!![]:![]:!![],'where':_0xfdd97['options']?_0xfdd97[_0xa660('0x15')][_0xa660('0x17')]||null:null,'attributes':_0xfdd97[_0xa660('0x15')]?_0xfdd97['options']['attributes']||null:null,'limit':_0xfdd97['options']?_0xfdd97['options'][_0xa660('0x18')]||null:null,'include':_0xfdd97[_0xa660('0x15')]?_0xfdd97[_0xa660('0x15')][_0xa660('0x19')]?_[_0xa660('0x1a')](_0xfdd97[_0xa660('0x15')]['include'],function(_0x2e4f97){return{'model':db[_0x2e4f97[_0xa660('0x1b')]],'as':_0x2e4f97['as'],'attributes':_0x2e4f97[_0xa660('0x1c')],'include':_0x2e4f97['include']?_[_0xa660('0x1a')](_0x2e4f97['include'],function(_0x2f07e4){return{'model':db[_0x2f07e4[_0xa660('0x1b')]],'as':_0x2f07e4['as'],'attributes':_0x2f07e4[_0xa660('0x1c')],'include':_0x2f07e4['include']?_[_0xa660('0x1a')](_0x2f07e4[_0xa660('0x19')],function(_0x3c5ebe){return{'model':db[_0x3c5ebe[_0xa660('0x1b')]],'as':_0x3c5ebe['as'],'attributes':_0x3c5ebe[_0xa660('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa660('0xb')](function(_0x347849){logger[_0xa660('0xc')]('GetSugarcrmAccount',_0xfdd97);logger[_0xa660('0x1d')]('GetSugarcrmAccount',_0xfdd97,JSON[_0xa660('0x1e')](_0x347849));_0x516347(_0x347849);})[_0xa660('0x1f')](function(_0x38eba4){logger['error'](_0xa660('0x20'),_0x38eba4[_0xa660('0x12')],_0xfdd97);_0x549fc8(_0x42eae4[_0xa660('0x10')](0x1f4,_0x38eba4[_0xa660('0x12')]));});});};exports[_0xa660('0x21')]=function(_0x3f88de){var _0x499b1b=this;return new Promise(function(_0x4abd6b,_0x1aed7f){return db[_0xa660('0x22')][_0xa660('0x23')]({'raw':_0x3f88de[_0xa660('0x15')]?_0x3f88de['options'][_0xa660('0x16')]===undefined?!![]:![]:!![],'where':_0x3f88de[_0xa660('0x15')]?_0x3f88de[_0xa660('0x15')][_0xa660('0x17')]||null:null,'attributes':_0x3f88de[_0xa660('0x15')]?_0x3f88de[_0xa660('0x15')]['attributes']||null:null,'include':_0x3f88de[_0xa660('0x15')]?_0x3f88de[_0xa660('0x15')][_0xa660('0x19')]?_[_0xa660('0x1a')](_0x3f88de[_0xa660('0x15')]['include'],function(_0x30762f){return{'model':db[_0x30762f[_0xa660('0x1b')]],'as':_0x30762f['as'],'attributes':_0x30762f[_0xa660('0x1c')],'include':_0x30762f[_0xa660('0x19')]?_[_0xa660('0x1a')](_0x30762f[_0xa660('0x19')],function(_0xda717c){return{'model':db[_0xda717c['model']],'as':_0xda717c['as'],'attributes':_0xda717c[_0xa660('0x1c')],'include':_0xda717c[_0xa660('0x19')]?_[_0xa660('0x1a')](_0xda717c[_0xa660('0x19')],function(_0x1b019f){return{'model':db[_0x1b019f['model']],'as':_0x1b019f['as'],'attributes':_0x1b019f['attributes']};}):[]};}):[]};}):[]:[]})[_0xa660('0xb')](function(_0x34f90a){logger['info'](_0xa660('0x21'),_0x3f88de);logger['debug'](_0xa660('0x21'),_0x3f88de,JSON[_0xa660('0x1e')](_0x34f90a));_0x4abd6b(_0x34f90a);})[_0xa660('0x1f')](function(_0x327390){logger[_0xa660('0x10')](_0xa660('0x21'),_0x327390[_0xa660('0x12')],_0x3f88de);_0x1aed7f(_0x499b1b[_0xa660('0x10')](0x1f4,_0x327390[_0xa660('0x12')]));});});}; \ No newline at end of file +var _0xc1e6=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetSugarcrmAccount','options','raw','attributes','limit','include','map','model','info','stringify','SugarcrmAccount','find','ShowSugarcrmAccount','util','moment'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xc1e6,0x1ed));var _0x6c1e=function(_0x2b9e7b,_0x2bc62b){_0x2b9e7b=_0x2b9e7b-0x0;var _0x371601=_0xc1e6[_0x2b9e7b];return _0x371601;};'use strict';var _=require('lodash');var util=require(_0x6c1e('0x0'));var moment=require(_0x6c1e('0x1'));var BPromise=require(_0x6c1e('0x2'));var rs=require(_0x6c1e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c1e('0x4'))['db'];var utils=require(_0x6c1e('0x5'));var logger=require(_0x6c1e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6c1e('0x7'));var client=jayson[_0x6c1e('0x8')][_0x6c1e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b5e31,_0x495d0b,_0x15e161){return new BPromise(function(_0x147ccb,_0x1661c2){return client[_0x6c1e('0xa')](_0x5b5e31,_0x15e161)[_0x6c1e('0xb')](function(_0x669bde){logger['info'](_0x6c1e('0xc'),_0x495d0b,_0x6c1e('0xd'));logger[_0x6c1e('0xe')](_0x6c1e('0xf'),_0x495d0b,_0x6c1e('0xd'),JSON['stringify'](_0x669bde));if(_0x669bde[_0x6c1e('0x10')]){if(_0x669bde[_0x6c1e('0x10')][_0x6c1e('0x11')]===0x1f4){logger[_0x6c1e('0x10')](_0x6c1e('0xc'),_0x495d0b,_0x669bde[_0x6c1e('0x10')]['message']);return _0x1661c2(_0x669bde[_0x6c1e('0x10')][_0x6c1e('0x12')]);}logger[_0x6c1e('0x10')](_0x6c1e('0xc'),_0x495d0b,_0x669bde[_0x6c1e('0x10')][_0x6c1e('0x12')]);return _0x147ccb(_0x669bde[_0x6c1e('0x10')]['message']);}else{logger['info'](_0x6c1e('0xc'),_0x495d0b,'request\x20sent');_0x147ccb(_0x669bde['result'][_0x6c1e('0x12')]);}})[_0x6c1e('0x13')](function(_0x34bc94){logger[_0x6c1e('0x10')](_0x6c1e('0xc'),_0x495d0b,_0x34bc94);_0x1661c2(_0x34bc94);});});}exports[_0x6c1e('0x14')]=function(_0x449319){var _0x37fa36=this;return new Promise(function(_0x26ff3f,_0x39e140){return db['SugarcrmAccount']['findAll']({'raw':_0x449319[_0x6c1e('0x15')]?_0x449319[_0x6c1e('0x15')][_0x6c1e('0x16')]===undefined?!![]:![]:!![],'where':_0x449319['options']?_0x449319[_0x6c1e('0x15')]['where']||null:null,'attributes':_0x449319['options']?_0x449319['options'][_0x6c1e('0x17')]||null:null,'limit':_0x449319[_0x6c1e('0x15')]?_0x449319[_0x6c1e('0x15')][_0x6c1e('0x18')]||null:null,'include':_0x449319[_0x6c1e('0x15')]?_0x449319[_0x6c1e('0x15')][_0x6c1e('0x19')]?_[_0x6c1e('0x1a')](_0x449319['options'][_0x6c1e('0x19')],function(_0xca4ed0){return{'model':db[_0xca4ed0['model']],'as':_0xca4ed0['as'],'attributes':_0xca4ed0[_0x6c1e('0x17')],'include':_0xca4ed0[_0x6c1e('0x19')]?_['map'](_0xca4ed0[_0x6c1e('0x19')],function(_0x1a9f86){return{'model':db[_0x1a9f86[_0x6c1e('0x1b')]],'as':_0x1a9f86['as'],'attributes':_0x1a9f86['attributes'],'include':_0x1a9f86[_0x6c1e('0x19')]?_[_0x6c1e('0x1a')](_0x1a9f86[_0x6c1e('0x19')],function(_0x179db7){return{'model':db[_0x179db7[_0x6c1e('0x1b')]],'as':_0x179db7['as'],'attributes':_0x179db7[_0x6c1e('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x304609){logger[_0x6c1e('0x1c')](_0x6c1e('0x14'),_0x449319);logger[_0x6c1e('0xe')](_0x6c1e('0x14'),_0x449319,JSON[_0x6c1e('0x1d')](_0x304609));_0x26ff3f(_0x304609);})['catch'](function(_0x256a1c){logger[_0x6c1e('0x10')](_0x6c1e('0x14'),_0x256a1c[_0x6c1e('0x12')],_0x449319);_0x39e140(_0x37fa36[_0x6c1e('0x10')](0x1f4,_0x256a1c[_0x6c1e('0x12')]));});});};exports['ShowSugarcrmAccount']=function(_0x2f2772){var _0xae258a=this;return new Promise(function(_0x2102db,_0xac4ab4){return db[_0x6c1e('0x1e')][_0x6c1e('0x1f')]({'raw':_0x2f2772[_0x6c1e('0x15')]?_0x2f2772[_0x6c1e('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x2f2772[_0x6c1e('0x15')]?_0x2f2772[_0x6c1e('0x15')]['where']||null:null,'attributes':_0x2f2772[_0x6c1e('0x15')]?_0x2f2772[_0x6c1e('0x15')][_0x6c1e('0x17')]||null:null,'include':_0x2f2772[_0x6c1e('0x15')]?_0x2f2772[_0x6c1e('0x15')][_0x6c1e('0x19')]?_[_0x6c1e('0x1a')](_0x2f2772['options'][_0x6c1e('0x19')],function(_0x181b9c){return{'model':db[_0x181b9c['model']],'as':_0x181b9c['as'],'attributes':_0x181b9c[_0x6c1e('0x17')],'include':_0x181b9c[_0x6c1e('0x19')]?_[_0x6c1e('0x1a')](_0x181b9c[_0x6c1e('0x19')],function(_0x1cb2d9){return{'model':db[_0x1cb2d9[_0x6c1e('0x1b')]],'as':_0x1cb2d9['as'],'attributes':_0x1cb2d9['attributes'],'include':_0x1cb2d9[_0x6c1e('0x19')]?_[_0x6c1e('0x1a')](_0x1cb2d9[_0x6c1e('0x19')],function(_0x4d9f8f){return{'model':db[_0x4d9f8f[_0x6c1e('0x1b')]],'as':_0x4d9f8f['as'],'attributes':_0x4d9f8f[_0x6c1e('0x17')]};}):[]};}):[]};}):[]:[]})[_0x6c1e('0xb')](function(_0x597691){logger[_0x6c1e('0x1c')]('ShowSugarcrmAccount',_0x2f2772);logger[_0x6c1e('0xe')](_0x6c1e('0x20'),_0x2f2772,JSON[_0x6c1e('0x1d')](_0x597691));_0x2102db(_0x597691);})['catch'](function(_0x3eb41b){logger['error'](_0x6c1e('0x20'),_0x3eb41b[_0x6c1e('0x12')],_0x2f2772);_0xac4ab4(_0xae258a['error'](0x1f4,_0x3eb41b[_0x6c1e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index eeaa327..d104a28 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 _0x4c9a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','delete','destroy','exports','multer','util','path'];(function(_0x3efe53,_0x2b28f2){var _0x37e031=function(_0x5976b4){while(--_0x5976b4){_0x3efe53['push'](_0x3efe53['shift']());}};_0x37e031(++_0x2b28f2);}(_0x4c9a,0x110));var _0xa4c9=function(_0x5081e7,_0x1f8fca){_0x5081e7=_0x5081e7-0x0;var _0x25a674=_0x4c9a[_0x5081e7];return _0x25a674;};'use strict';var multer=require(_0xa4c9('0x0'));var util=require(_0xa4c9('0x1'));var path=require(_0xa4c9('0x2'));var timeout=require(_0xa4c9('0x3'));var express=require(_0xa4c9('0x4'));var router=express[_0xa4c9('0x5')]();var fs_extra=require(_0xa4c9('0x6'));var auth=require(_0xa4c9('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa4c9('0x8'));router[_0xa4c9('0x9')]('/',auth[_0xa4c9('0xa')](),controller[_0xa4c9('0xb')]);router[_0xa4c9('0x9')](_0xa4c9('0xc'),auth[_0xa4c9('0xa')](),controller[_0xa4c9('0xd')]);router['get'](_0xa4c9('0xe'),auth['isAuthenticated'](),controller[_0xa4c9('0xf')]);router[_0xa4c9('0x9')](_0xa4c9('0x10'),auth[_0xa4c9('0xa')](),controller[_0xa4c9('0x11')]);router[_0xa4c9('0x9')](_0xa4c9('0x12'),auth[_0xa4c9('0xa')](),controller[_0xa4c9('0x13')]);router[_0xa4c9('0x14')]('/',auth[_0xa4c9('0xa')](),controller[_0xa4c9('0x15')]);router['put'](_0xa4c9('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xa4c9('0x16')]('/:id',auth[_0xa4c9('0xa')](),controller[_0xa4c9('0x17')]);module[_0xa4c9('0x18')]=router; \ No newline at end of file +var _0xbd19=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','util','path'];(function(_0x53c918,_0x543915){var _0x302843=function(_0x410487){while(--_0x410487){_0x53c918['push'](_0x53c918['shift']());}};_0x302843(++_0x543915);}(_0xbd19,0xcd));var _0x9bd1=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0xbd19[_0x616290];return _0x453879;};'use strict';var multer=require('multer');var util=require(_0x9bd1('0x0'));var path=require(_0x9bd1('0x1'));var timeout=require(_0x9bd1('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9bd1('0x3'));var auth=require(_0x9bd1('0x4'));var interaction=require(_0x9bd1('0x5'));var config=require(_0x9bd1('0x6'));var controller=require(_0x9bd1('0x7'));router[_0x9bd1('0x8')]('/',auth[_0x9bd1('0x9')](),controller[_0x9bd1('0xa')]);router[_0x9bd1('0x8')](_0x9bd1('0xb'),auth[_0x9bd1('0x9')](),controller['show']);router[_0x9bd1('0x8')](_0x9bd1('0xc'),auth['isAuthenticated'](),controller[_0x9bd1('0xd')]);router['get'](_0x9bd1('0xe'),auth[_0x9bd1('0x9')](),controller['getSubjects']);router['get'](_0x9bd1('0xf'),auth[_0x9bd1('0x9')](),controller[_0x9bd1('0x10')]);router['post']('/',auth[_0x9bd1('0x9')](),controller[_0x9bd1('0x11')]);router[_0x9bd1('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x9bd1('0x13')]);router[_0x9bd1('0x14')](_0x9bd1('0xb'),auth[_0x9bd1('0x9')](),controller[_0x9bd1('0x15')]);module[_0x9bd1('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 77ed0b4..0caa91f 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 _0xc084=['sequelize','STRING'];(function(_0x49c0b1,_0x9921c6){var _0x17dfbe=function(_0x12d4e0){while(--_0x12d4e0){_0x49c0b1['push'](_0x49c0b1['shift']());}};_0x17dfbe(++_0x9921c6);}(_0xc084,0x18a));var _0x4c08=function(_0x5a699b,_0x1b1491){_0x5a699b=_0x5a699b-0x0;var _0x49351f=_0xc084[_0x5a699b];return _0x49351f;};'use strict';var Sequelize=require(_0x4c08('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4c08('0x1')]}}; \ No newline at end of file +var _0x248f=['STRING','sequelize','exports'];(function(_0x429c0c,_0x560f5b){var _0x45c8a5=function(_0xf23261){while(--_0xf23261){_0x429c0c['push'](_0x429c0c['shift']());}};_0x45c8a5(++_0x560f5b);}(_0x248f,0x10f));var _0xf248=function(_0x1dbbe4,_0x38f65c){_0x1dbbe4=_0x1dbbe4-0x0;var _0x148de1=_0x248f[_0x1dbbe4];return _0x148de1;};'use strict';var Sequelize=require(_0xf248('0x0'));module[_0xf248('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf248('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 98f09ab..18b2a33 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 _0x0c50=['show','params','rawAttributes','length','create','body','find','findOne','SugarcrmField','hasOwnProperty','getFields','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','SugarcrmConfiguration','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch'];(function(_0x1486e5,_0x39684f){var _0x29d89b=function(_0x4a0a80){while(--_0x4a0a80){_0x1486e5['push'](_0x1486e5['shift']());}};_0x29d89b(++_0x39684f);}(_0x0c50,0x1a7));var _0x00c5=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x0c50[_0x30ae5e];return _0x1f2e93;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x00c5('0x0'));var zipdir=require(_0x00c5('0x1'));var jsonpatch=require(_0x00c5('0x2'));var rp=require(_0x00c5('0x3'));var moment=require(_0x00c5('0x4'));var BPromise=require(_0x00c5('0x5'));var Mustache=require(_0x00c5('0x6'));var util=require('util');var path=require(_0x00c5('0x7'));var sox=require('sox');var csv=require(_0x00c5('0x8'));var ejs=require(_0x00c5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x00c5('0xa'));var squel=require(_0x00c5('0xb'));var crypto=require(_0x00c5('0xc'));var jsforce=require(_0x00c5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x00c5('0x8'));var querystring=require('querystring');var Papa=require(_0x00c5('0xe'));var Redis=require(_0x00c5('0xf'));var authService=require(_0x00c5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x00c5('0x11'));var hardwareService=require(_0x00c5('0x12'));var logger=require(_0x00c5('0x13'))('api');var utils=require(_0x00c5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x00c5('0x15'));var db=require(_0x00c5('0x16'))['db'];function respondWithStatusCode(_0x285c15,_0x1f320f){_0x1f320f=_0x1f320f||0xcc;return function(_0xcb9eec){if(_0xcb9eec){return _0x285c15[_0x00c5('0x17')](_0x1f320f);}return _0x285c15[_0x00c5('0x18')](_0x1f320f)[_0x00c5('0x19')]();};}function respondWithResult(_0x1a013b,_0x12f67d){_0x12f67d=_0x12f67d||0xc8;return function(_0x5ecd1d){if(_0x5ecd1d){return _0x1a013b[_0x00c5('0x18')](_0x12f67d)[_0x00c5('0x1a')](_0x5ecd1d);}};}function respondWithFilteredResult(_0x2b58b9,_0x4d1681){return function(_0xd79dc3){if(_0xd79dc3){var _0x28812d=typeof _0x4d1681[_0x00c5('0x1b')]===_0x00c5('0x1c')&&typeof _0x4d1681[_0x00c5('0x1d')]===_0x00c5('0x1c');var _0x2aa0e3=_0xd79dc3['count'];var _0xb46842=_0x28812d?0x0:_0x4d1681[_0x00c5('0x1b')];var _0x2a9180=_0x28812d?_0xd79dc3['count']:_0x4d1681[_0x00c5('0x1b')]+_0x4d1681[_0x00c5('0x1d')];var _0xb7018b;if(_0x2a9180>=_0x2aa0e3){_0x2a9180=_0x2aa0e3;_0xb7018b=0xc8;}else{_0xb7018b=0xce;}_0x2b58b9[_0x00c5('0x18')](_0xb7018b);return _0x2b58b9[_0x00c5('0x1e')](_0x00c5('0x1f'),_0xb46842+'-'+_0x2a9180+'/'+_0x2aa0e3)[_0x00c5('0x1a')](_0xd79dc3);}return null;};}function patchUpdates(_0x926990){return function(_0x53d437){try{jsonpatch[_0x00c5('0x20')](_0x53d437,_0x926990,!![]);}catch(_0x44e7b3){return BPromise[_0x00c5('0x21')](_0x44e7b3);}return _0x53d437[_0x00c5('0x22')]();};}function saveUpdates(_0x20d118,_0x144ebe){return function(_0x5ed659){if(_0x5ed659){return _0x5ed659[_0x00c5('0x23')](_0x20d118)[_0x00c5('0x24')](function(_0x3492be){return _0x3492be;});}return null;};}function removeEntity(_0x54ce5f,_0x2a0264){return function(_0xf97123){if(_0xf97123){return _0xf97123[_0x00c5('0x25')]()['then'](function(){_0x54ce5f['status'](0xcc)[_0x00c5('0x19')]();});}};}function handleEntityNotFound(_0x3c8586,_0x571fae){return function(_0x393794){if(!_0x393794){_0x3c8586[_0x00c5('0x17')](0x194);}return _0x393794;};}function handleError(_0xd5f805,_0x39467f){_0x39467f=_0x39467f||0x1f4;return function(_0x40c82d){logger[_0x00c5('0x26')](_0x40c82d['stack']);if(_0x40c82d[_0x00c5('0x27')]){delete _0x40c82d[_0x00c5('0x27')];}_0xd5f805['status'](_0x39467f)[_0x00c5('0x28')](_0x40c82d);};}exports[_0x00c5('0x29')]=function(_0x4ff486,_0x2cc0a1){var _0x436f76={},_0x5d252b={},_0x4a0c27={'count':0x0,'rows':[]};var _0x18fc3d=_[_0x00c5('0x2a')](db[_0x00c5('0x2b')]['rawAttributes'],function(_0x4a2668){return{'name':_0x4a2668[_0x00c5('0x2c')],'type':_0x4a2668['type'][_0x00c5('0x2d')]};});_0x5d252b[_0x00c5('0x2e')]=_[_0x00c5('0x2a')](_0x18fc3d,_0x00c5('0x27'));_0x5d252b[_0x00c5('0x2f')]=_[_0x00c5('0x30')](_0x4ff486[_0x00c5('0x2f')]);_0x5d252b[_0x00c5('0x31')]=_[_0x00c5('0x32')](_0x5d252b['model'],_0x5d252b[_0x00c5('0x2f')]);_0x436f76[_0x00c5('0x33')]=_['intersection'](_0x5d252b[_0x00c5('0x2e')],qs[_0x00c5('0x34')](_0x4ff486[_0x00c5('0x2f')][_0x00c5('0x34')]));_0x436f76[_0x00c5('0x33')]=_0x436f76['attributes']['length']?_0x436f76[_0x00c5('0x33')]:_0x5d252b[_0x00c5('0x2e')];if(!_0x4ff486[_0x00c5('0x2f')]['hasOwnProperty'](_0x00c5('0x35'))){_0x436f76[_0x00c5('0x1d')]=qs[_0x00c5('0x1d')](_0x4ff486[_0x00c5('0x2f')][_0x00c5('0x1d')]);_0x436f76['offset']=qs['offset'](_0x4ff486[_0x00c5('0x2f')]['offset']);}_0x436f76[_0x00c5('0x36')]=qs[_0x00c5('0x37')](_0x4ff486[_0x00c5('0x2f')][_0x00c5('0x37')]);_0x436f76[_0x00c5('0x38')]=qs[_0x00c5('0x31')](_[_0x00c5('0x39')](_0x4ff486[_0x00c5('0x2f')],_0x5d252b[_0x00c5('0x31')]),_0x18fc3d);if(_0x4ff486[_0x00c5('0x2f')][_0x00c5('0x3a')]){_0x436f76[_0x00c5('0x38')]=_[_0x00c5('0x3b')](_0x436f76[_0x00c5('0x38')],{'$or':_[_0x00c5('0x2a')](_0x18fc3d,function(_0x212454){if(_0x212454[_0x00c5('0x3c')]!==_0x00c5('0x3d')){var _0x3937b2={};_0x3937b2[_0x212454[_0x00c5('0x27')]]={'$like':'%'+_0x4ff486[_0x00c5('0x2f')][_0x00c5('0x3a')]+'%'};return _0x3937b2;}})});}_0x436f76=_[_0x00c5('0x3b')]({},_0x436f76,_0x4ff486[_0x00c5('0x3e')]);var _0x1f95a0={'where':_0x436f76[_0x00c5('0x38')]};return db[_0x00c5('0x2b')][_0x00c5('0x3f')](_0x1f95a0)[_0x00c5('0x24')](function(_0x2fc91e){_0x4a0c27['count']=_0x2fc91e;if(_0x4ff486[_0x00c5('0x2f')][_0x00c5('0x40')]){_0x436f76[_0x00c5('0x41')]=[{'all':!![]}];}return db[_0x00c5('0x2b')][_0x00c5('0x42')](_0x436f76);})[_0x00c5('0x24')](function(_0x3b6023){_0x4a0c27[_0x00c5('0x43')]=_0x3b6023;return _0x4a0c27;})[_0x00c5('0x24')](respondWithFilteredResult(_0x2cc0a1,_0x436f76))[_0x00c5('0x44')](handleError(_0x2cc0a1,null));};exports[_0x00c5('0x45')]=function(_0x15864c,_0x1bece8){var _0x57670d={'raw':![],'where':{'id':_0x15864c[_0x00c5('0x46')]['id']}},_0x5f0e9a={};_0x5f0e9a[_0x00c5('0x2e')]=_[_0x00c5('0x30')](db[_0x00c5('0x2b')][_0x00c5('0x47')]);_0x5f0e9a[_0x00c5('0x2f')]=_['keys'](_0x15864c['query']);_0x5f0e9a[_0x00c5('0x31')]=_[_0x00c5('0x32')](_0x5f0e9a[_0x00c5('0x2e')],_0x5f0e9a[_0x00c5('0x2f')]);_0x57670d[_0x00c5('0x33')]=_[_0x00c5('0x32')](_0x5f0e9a[_0x00c5('0x2e')],qs[_0x00c5('0x34')](_0x15864c[_0x00c5('0x2f')]['fields']));_0x57670d[_0x00c5('0x33')]=_0x57670d[_0x00c5('0x33')][_0x00c5('0x48')]?_0x57670d['attributes']:_0x5f0e9a['model'];if(_0x15864c[_0x00c5('0x2f')]['includeAll']){_0x57670d['include']=[{'all':!![]}];}_0x57670d=_['merge']({},_0x57670d,_0x15864c['options']);return db['SugarcrmConfiguration']['find'](_0x57670d)[_0x00c5('0x24')](handleEntityNotFound(_0x1bece8,null))[_0x00c5('0x24')](respondWithResult(_0x1bece8,null))[_0x00c5('0x44')](handleError(_0x1bece8,null));};exports['create']=function(_0x484919,_0x123b12){return db['SugarcrmConfiguration'][_0x00c5('0x49')](_0x484919['body'],{})[_0x00c5('0x24')](respondWithResult(_0x123b12,0xc9))[_0x00c5('0x44')](handleError(_0x123b12,null));};exports[_0x00c5('0x23')]=function(_0x2259d6,_0x3064eb){if(_0x2259d6[_0x00c5('0x4a')]['id']){delete _0x2259d6[_0x00c5('0x4a')]['id'];}return db[_0x00c5('0x2b')][_0x00c5('0x4b')]({'where':{'id':_0x2259d6[_0x00c5('0x46')]['id']}})[_0x00c5('0x24')](handleEntityNotFound(_0x3064eb,null))[_0x00c5('0x24')](saveUpdates(_0x2259d6[_0x00c5('0x4a')],null))['then'](respondWithResult(_0x3064eb,null))[_0x00c5('0x44')](handleError(_0x3064eb,null));};exports['destroy']=function(_0x507f62,_0x181fec){return db['SugarcrmConfiguration']['find']({'where':{'id':_0x507f62[_0x00c5('0x46')]['id']}})[_0x00c5('0x24')](handleEntityNotFound(_0x181fec,null))[_0x00c5('0x24')](removeEntity(_0x181fec,null))[_0x00c5('0x44')](handleError(_0x181fec,null));};exports['getFields']=function(_0x3bda21,_0x1bf880,_0x3fc510){var _0x71227={};var _0x2f9bca={};var _0x2086c2;var _0x2d9409;return db[_0x00c5('0x2b')][_0x00c5('0x4c')]({'where':{'id':_0x3bda21['params']['id']}})[_0x00c5('0x24')](handleEntityNotFound(_0x1bf880,null))[_0x00c5('0x24')](function(_0x4fca9e){if(_0x4fca9e){_0x2086c2=_0x4fca9e;_0x2f9bca[_0x00c5('0x2e')]=_[_0x00c5('0x30')](db[_0x00c5('0x4d')][_0x00c5('0x47')]);_0x2f9bca['query']=_[_0x00c5('0x30')](_0x3bda21[_0x00c5('0x2f')]);_0x2f9bca[_0x00c5('0x31')]=_[_0x00c5('0x32')](_0x2f9bca['model'],_0x2f9bca[_0x00c5('0x2f')]);_0x71227[_0x00c5('0x33')]=_[_0x00c5('0x32')](_0x2f9bca[_0x00c5('0x2e')],qs['fields'](_0x3bda21[_0x00c5('0x2f')]['fields']));_0x71227[_0x00c5('0x33')]=_0x71227[_0x00c5('0x33')][_0x00c5('0x48')]?_0x71227[_0x00c5('0x33')]:_0x2f9bca[_0x00c5('0x2e')];_0x71227[_0x00c5('0x36')]=qs[_0x00c5('0x37')](_0x3bda21[_0x00c5('0x2f')][_0x00c5('0x37')]);_0x71227[_0x00c5('0x38')]=qs['filters'](_[_0x00c5('0x39')](_0x3bda21[_0x00c5('0x2f')],_0x2f9bca['filters']));if(_0x3bda21['query'][_0x00c5('0x3a')]){_0x71227[_0x00c5('0x38')]=_['merge'](_0x71227[_0x00c5('0x38')],{'$or':_['map'](_0x71227['attributes'],function(_0x5b0d29){var _0xe3c368={};_0xe3c368[_0x5b0d29]={'$like':'%'+_0x3bda21['query'][_0x00c5('0x3a')]+'%'};return _0xe3c368;})});}_0x71227=_[_0x00c5('0x3b')]({},_0x71227,_0x3bda21[_0x00c5('0x3e')]);return _0x2086c2['getFields'](_0x71227);}})[_0x00c5('0x24')](function(_0x2ed1df){if(_0x2ed1df){_0x2d9409=_0x2ed1df['length'];if(!_0x3bda21[_0x00c5('0x2f')][_0x00c5('0x4e')](_0x00c5('0x35'))){_0x71227[_0x00c5('0x1d')]=qs[_0x00c5('0x1d')](_0x3bda21[_0x00c5('0x2f')][_0x00c5('0x1d')]);_0x71227['offset']=qs[_0x00c5('0x1b')](_0x3bda21[_0x00c5('0x2f')][_0x00c5('0x1b')]);}return _0x2086c2[_0x00c5('0x4f')](_0x71227);}})[_0x00c5('0x24')](function(_0x2fc893){if(_0x2fc893){return _0x2fc893?{'count':_0x2d9409,'rows':_0x2fc893}:null;}})['then'](respondWithResult(_0x1bf880,null))[_0x00c5('0x44')](handleError(_0x1bf880,null));};exports['getSubjects']=function(_0x362ea2,_0x2b9fce,_0x411b0b){var _0x5349bb={};var _0x5e574a={};var _0x46a614;var _0x17a7f3;return db[_0x00c5('0x2b')]['findOne']({'where':{'id':_0x362ea2[_0x00c5('0x46')]['id']}})[_0x00c5('0x24')](handleEntityNotFound(_0x2b9fce,null))[_0x00c5('0x24')](function(_0x156302){if(_0x156302){_0x46a614=_0x156302;_0x5e574a[_0x00c5('0x2e')]=_[_0x00c5('0x30')](db[_0x00c5('0x4d')][_0x00c5('0x47')]);_0x5e574a[_0x00c5('0x2f')]=_[_0x00c5('0x30')](_0x362ea2[_0x00c5('0x2f')]);_0x5e574a[_0x00c5('0x31')]=_[_0x00c5('0x32')](_0x5e574a['model'],_0x5e574a[_0x00c5('0x2f')]);_0x5349bb['attributes']=_[_0x00c5('0x32')](_0x5e574a[_0x00c5('0x2e')],qs[_0x00c5('0x34')](_0x362ea2['query']['fields']));_0x5349bb[_0x00c5('0x33')]=_0x5349bb[_0x00c5('0x33')][_0x00c5('0x48')]?_0x5349bb['attributes']:_0x5e574a[_0x00c5('0x2e')];_0x5349bb['order']=qs[_0x00c5('0x37')](_0x362ea2[_0x00c5('0x2f')]['sort']);_0x5349bb[_0x00c5('0x38')]=qs[_0x00c5('0x31')](_['pick'](_0x362ea2[_0x00c5('0x2f')],_0x5e574a[_0x00c5('0x31')]));if(_0x362ea2[_0x00c5('0x2f')][_0x00c5('0x3a')]){_0x5349bb['where']=_[_0x00c5('0x3b')](_0x5349bb[_0x00c5('0x38')],{'$or':_[_0x00c5('0x2a')](_0x5349bb[_0x00c5('0x33')],function(_0x3f4c9e){var _0x3bb6ce={};_0x3bb6ce[_0x3f4c9e]={'$like':'%'+_0x362ea2[_0x00c5('0x2f')]['filter']+'%'};return _0x3bb6ce;})});}_0x5349bb=_[_0x00c5('0x3b')]({},_0x5349bb,_0x362ea2['options']);return _0x46a614[_0x00c5('0x50')](_0x5349bb);}})[_0x00c5('0x24')](function(_0x4180f3){if(_0x4180f3){_0x17a7f3=_0x4180f3[_0x00c5('0x48')];if(!_0x362ea2['query'][_0x00c5('0x4e')](_0x00c5('0x35'))){_0x5349bb[_0x00c5('0x1d')]=qs[_0x00c5('0x1d')](_0x362ea2[_0x00c5('0x2f')][_0x00c5('0x1d')]);_0x5349bb[_0x00c5('0x1b')]=qs['offset'](_0x362ea2['query']['offset']);}return _0x46a614[_0x00c5('0x50')](_0x5349bb);}})[_0x00c5('0x24')](function(_0x38b044){if(_0x38b044){return _0x38b044?{'count':_0x17a7f3,'rows':_0x38b044}:null;}})[_0x00c5('0x24')](respondWithResult(_0x2b9fce,null))['catch'](handleError(_0x2b9fce,null));};exports['getDescriptions']=function(_0x45a26c,_0x4cc528,_0x316cd3){var _0x2a727b={};var _0xb735ff={};var _0x123147;var _0x191e8e;return db['SugarcrmConfiguration'][_0x00c5('0x4c')]({'where':{'id':_0x45a26c[_0x00c5('0x46')]['id']}})[_0x00c5('0x24')](handleEntityNotFound(_0x4cc528,null))[_0x00c5('0x24')](function(_0x30aa14){if(_0x30aa14){_0x123147=_0x30aa14;_0xb735ff[_0x00c5('0x2e')]=_[_0x00c5('0x30')](db[_0x00c5('0x4d')][_0x00c5('0x47')]);_0xb735ff[_0x00c5('0x2f')]=_['keys'](_0x45a26c[_0x00c5('0x2f')]);_0xb735ff[_0x00c5('0x31')]=_[_0x00c5('0x32')](_0xb735ff[_0x00c5('0x2e')],_0xb735ff['query']);_0x2a727b[_0x00c5('0x33')]=_[_0x00c5('0x32')](_0xb735ff[_0x00c5('0x2e')],qs['fields'](_0x45a26c[_0x00c5('0x2f')][_0x00c5('0x34')]));_0x2a727b[_0x00c5('0x33')]=_0x2a727b[_0x00c5('0x33')][_0x00c5('0x48')]?_0x2a727b[_0x00c5('0x33')]:_0xb735ff[_0x00c5('0x2e')];_0x2a727b[_0x00c5('0x36')]=qs[_0x00c5('0x37')](_0x45a26c['query'][_0x00c5('0x37')]);_0x2a727b[_0x00c5('0x38')]=qs[_0x00c5('0x31')](_[_0x00c5('0x39')](_0x45a26c[_0x00c5('0x2f')],_0xb735ff[_0x00c5('0x31')]));if(_0x45a26c['query']['filter']){_0x2a727b[_0x00c5('0x38')]=_['merge'](_0x2a727b[_0x00c5('0x38')],{'$or':_[_0x00c5('0x2a')](_0x2a727b[_0x00c5('0x33')],function(_0x336e0a){var _0x4b00dd={};_0x4b00dd[_0x336e0a]={'$like':'%'+_0x45a26c[_0x00c5('0x2f')]['filter']+'%'};return _0x4b00dd;})});}_0x2a727b=_['merge']({},_0x2a727b,_0x45a26c[_0x00c5('0x3e')]);return _0x123147[_0x00c5('0x51')](_0x2a727b);}})[_0x00c5('0x24')](function(_0x4c048c){if(_0x4c048c){_0x191e8e=_0x4c048c[_0x00c5('0x48')];if(!_0x45a26c[_0x00c5('0x2f')][_0x00c5('0x4e')]('nolimit')){_0x2a727b['limit']=qs[_0x00c5('0x1d')](_0x45a26c[_0x00c5('0x2f')]['limit']);_0x2a727b[_0x00c5('0x1b')]=qs[_0x00c5('0x1b')](_0x45a26c[_0x00c5('0x2f')][_0x00c5('0x1b')]);}return _0x123147[_0x00c5('0x51')](_0x2a727b);}})[_0x00c5('0x24')](function(_0x974b76){if(_0x974b76){return _0x974b76?{'count':_0x191e8e,'rows':_0x974b76}:null;}})['then'](respondWithResult(_0x4cc528,null))[_0x00c5('0x44')](handleError(_0x4cc528,null));}; \ No newline at end of file +var _0x9999=['eml-format','rimraf','fast-json-patch','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','update','then','error','stack','name','send','map','SugarcrmConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','order','sort','pick','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','length','create','body','destroy','SugarcrmField','filter','getFields','hasOwnProperty','nolimit','getSubjects','findOne','getDescriptions'];(function(_0x23be51,_0xc02a1b){var _0x47a26d=function(_0xa92395){while(--_0xa92395){_0x23be51['push'](_0x23be51['shift']());}};_0x47a26d(++_0xc02a1b);}(_0x9999,0xe7));var _0x9999=function(_0x558e03,_0x477deb){_0x558e03=_0x558e03-0x0;var _0x431bdb=_0x9999[_0x558e03];return _0x431bdb;};'use strict';var emlformat=require(_0x9999('0x0'));var rimraf=require(_0x9999('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9999('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9999('0x3'));var util=require(_0x9999('0x4'));var path=require('path');var sox=require(_0x9999('0x5'));var csv=require(_0x9999('0x6'));var ejs=require(_0x9999('0x7'));var fs=require('fs');var fs_extra=require(_0x9999('0x8'));var _=require(_0x9999('0x9'));var squel=require(_0x9999('0xa'));var crypto=require(_0x9999('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9999('0xc'));var toCsv=require(_0x9999('0x6'));var querystring=require(_0x9999('0xd'));var Papa=require(_0x9999('0xe'));var Redis=require(_0x9999('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9999('0x10'));var hardwareService=require(_0x9999('0x11'));var logger=require(_0x9999('0x12'))(_0x9999('0x13'));var utils=require(_0x9999('0x14'));var config=require(_0x9999('0x15'));var licenseUtil=require(_0x9999('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58ec09,_0x465219){_0x465219=_0x465219||0xcc;return function(_0x4e3d94){if(_0x4e3d94){return _0x58ec09[_0x9999('0x17')](_0x465219);}return _0x58ec09[_0x9999('0x18')](_0x465219)[_0x9999('0x19')]();};}function respondWithResult(_0x4b49f6,_0x317f68){_0x317f68=_0x317f68||0xc8;return function(_0x2f6339){if(_0x2f6339){return _0x4b49f6[_0x9999('0x18')](_0x317f68)[_0x9999('0x1a')](_0x2f6339);}};}function respondWithFilteredResult(_0x310cbf,_0x254abc){return function(_0x25b157){if(_0x25b157){var _0x29a14f=typeof _0x254abc[_0x9999('0x1b')]==='undefined'&&typeof _0x254abc[_0x9999('0x1c')]==='undefined';var _0x29033e=_0x25b157[_0x9999('0x1d')];var _0x311d30=_0x29a14f?0x0:_0x254abc['offset'];var _0x439e16=_0x29a14f?_0x25b157[_0x9999('0x1d')]:_0x254abc[_0x9999('0x1b')]+_0x254abc[_0x9999('0x1c')];var _0x54d64;if(_0x439e16>=_0x29033e){_0x439e16=_0x29033e;_0x54d64=0xc8;}else{_0x54d64=0xce;}_0x310cbf['status'](_0x54d64);return _0x310cbf['set'](_0x9999('0x1e'),_0x311d30+'-'+_0x439e16+'/'+_0x29033e)[_0x9999('0x1a')](_0x25b157);}return null;};}function patchUpdates(_0x2a96d8){return function(_0x412c63){try{jsonpatch[_0x9999('0x1f')](_0x412c63,_0x2a96d8,!![]);}catch(_0x1b658b){return BPromise[_0x9999('0x20')](_0x1b658b);}return _0x412c63['save']();};}function saveUpdates(_0x43fc36,_0x54de54){return function(_0x1ecb44){if(_0x1ecb44){return _0x1ecb44[_0x9999('0x21')](_0x43fc36)[_0x9999('0x22')](function(_0x4d5365){return _0x4d5365;});}return null;};}function removeEntity(_0x5bcde0,_0x1c7c8c){return function(_0x2a92b){if(_0x2a92b){return _0x2a92b['destroy']()[_0x9999('0x22')](function(){_0x5bcde0[_0x9999('0x18')](0xcc)[_0x9999('0x19')]();});}};}function handleEntityNotFound(_0x169408,_0x147dde){return function(_0x47f8f6){if(!_0x47f8f6){_0x169408['sendStatus'](0x194);}return _0x47f8f6;};}function handleError(_0x3ac8ea,_0x19bfe4){_0x19bfe4=_0x19bfe4||0x1f4;return function(_0x1cad5c){logger[_0x9999('0x23')](_0x1cad5c[_0x9999('0x24')]);if(_0x1cad5c[_0x9999('0x25')]){delete _0x1cad5c[_0x9999('0x25')];}_0x3ac8ea['status'](_0x19bfe4)[_0x9999('0x26')](_0x1cad5c);};}exports['index']=function(_0x496859,_0x5aa22d){var _0x1d54a2={},_0x4e7f41={},_0x2090ba={'count':0x0,'rows':[]};var _0x243a9b=_[_0x9999('0x27')](db[_0x9999('0x28')][_0x9999('0x29')],function(_0x1eaaad){return{'name':_0x1eaaad[_0x9999('0x2a')],'type':_0x1eaaad['type'][_0x9999('0x2b')]};});_0x4e7f41[_0x9999('0x2c')]=_[_0x9999('0x27')](_0x243a9b,'name');_0x4e7f41[_0x9999('0x2d')]=_[_0x9999('0x2e')](_0x496859[_0x9999('0x2d')]);_0x4e7f41[_0x9999('0x2f')]=_['intersection'](_0x4e7f41['model'],_0x4e7f41[_0x9999('0x2d')]);_0x1d54a2[_0x9999('0x30')]=_[_0x9999('0x31')](_0x4e7f41[_0x9999('0x2c')],qs[_0x9999('0x32')](_0x496859['query']['fields']));_0x1d54a2[_0x9999('0x30')]=_0x1d54a2[_0x9999('0x30')]['length']?_0x1d54a2[_0x9999('0x30')]:_0x4e7f41[_0x9999('0x2c')];if(!_0x496859['query']['hasOwnProperty']('nolimit')){_0x1d54a2[_0x9999('0x1c')]=qs['limit'](_0x496859[_0x9999('0x2d')]['limit']);_0x1d54a2[_0x9999('0x1b')]=qs['offset'](_0x496859[_0x9999('0x2d')][_0x9999('0x1b')]);}_0x1d54a2[_0x9999('0x33')]=qs['sort'](_0x496859[_0x9999('0x2d')][_0x9999('0x34')]);_0x1d54a2['where']=qs[_0x9999('0x2f')](_[_0x9999('0x35')](_0x496859['query'],_0x4e7f41[_0x9999('0x2f')]),_0x243a9b);if(_0x496859[_0x9999('0x2d')]['filter']){_0x1d54a2[_0x9999('0x36')]=_['merge'](_0x1d54a2['where'],{'$or':_[_0x9999('0x27')](_0x243a9b,function(_0x4ab89b){if(_0x4ab89b[_0x9999('0x37')]!==_0x9999('0x38')){var _0x4485a6={};_0x4485a6[_0x4ab89b[_0x9999('0x25')]]={'$like':'%'+_0x496859[_0x9999('0x2d')]['filter']+'%'};return _0x4485a6;}})});}_0x1d54a2=_[_0x9999('0x39')]({},_0x1d54a2,_0x496859[_0x9999('0x3a')]);var _0x4e504d={'where':_0x1d54a2[_0x9999('0x36')]};return db[_0x9999('0x28')]['count'](_0x4e504d)['then'](function(_0x5d7de7){_0x2090ba['count']=_0x5d7de7;if(_0x496859['query'][_0x9999('0x3b')]){_0x1d54a2[_0x9999('0x3c')]=[{'all':!![]}];}return db[_0x9999('0x28')][_0x9999('0x3d')](_0x1d54a2);})[_0x9999('0x22')](function(_0x12ac7c){_0x2090ba[_0x9999('0x3e')]=_0x12ac7c;return _0x2090ba;})[_0x9999('0x22')](respondWithFilteredResult(_0x5aa22d,_0x1d54a2))[_0x9999('0x3f')](handleError(_0x5aa22d,null));};exports['show']=function(_0x603c84,_0x4cfd17){var _0x4db274={'raw':![],'where':{'id':_0x603c84[_0x9999('0x40')]['id']}},_0x23c6fe={};_0x23c6fe[_0x9999('0x2c')]=_[_0x9999('0x2e')](db[_0x9999('0x28')]['rawAttributes']);_0x23c6fe[_0x9999('0x2d')]=_[_0x9999('0x2e')](_0x603c84[_0x9999('0x2d')]);_0x23c6fe[_0x9999('0x2f')]=_['intersection'](_0x23c6fe[_0x9999('0x2c')],_0x23c6fe[_0x9999('0x2d')]);_0x4db274[_0x9999('0x30')]=_['intersection'](_0x23c6fe[_0x9999('0x2c')],qs[_0x9999('0x32')](_0x603c84[_0x9999('0x2d')][_0x9999('0x32')]));_0x4db274['attributes']=_0x4db274[_0x9999('0x30')][_0x9999('0x41')]?_0x4db274[_0x9999('0x30')]:_0x23c6fe[_0x9999('0x2c')];if(_0x603c84['query'][_0x9999('0x3b')]){_0x4db274['include']=[{'all':!![]}];}_0x4db274=_['merge']({},_0x4db274,_0x603c84[_0x9999('0x3a')]);return db[_0x9999('0x28')]['find'](_0x4db274)[_0x9999('0x22')](handleEntityNotFound(_0x4cfd17,null))[_0x9999('0x22')](respondWithResult(_0x4cfd17,null))['catch'](handleError(_0x4cfd17,null));};exports['create']=function(_0x438b31,_0x20ea2d){return db[_0x9999('0x28')][_0x9999('0x42')](_0x438b31[_0x9999('0x43')],{})[_0x9999('0x22')](respondWithResult(_0x20ea2d,0xc9))[_0x9999('0x3f')](handleError(_0x20ea2d,null));};exports['update']=function(_0x283bc8,_0x145f6f){if(_0x283bc8['body']['id']){delete _0x283bc8['body']['id'];}return db[_0x9999('0x28')]['find']({'where':{'id':_0x283bc8[_0x9999('0x40')]['id']}})[_0x9999('0x22')](handleEntityNotFound(_0x145f6f,null))[_0x9999('0x22')](saveUpdates(_0x283bc8[_0x9999('0x43')],null))[_0x9999('0x22')](respondWithResult(_0x145f6f,null))['catch'](handleError(_0x145f6f,null));};exports[_0x9999('0x44')]=function(_0x17ad9b,_0x11221b){return db[_0x9999('0x28')]['find']({'where':{'id':_0x17ad9b['params']['id']}})[_0x9999('0x22')](handleEntityNotFound(_0x11221b,null))[_0x9999('0x22')](removeEntity(_0x11221b,null))[_0x9999('0x3f')](handleError(_0x11221b,null));};exports['getFields']=function(_0x29ccd7,_0x2ad951,_0x47ede6){var _0x29ca26={};var _0x1790b9={};var _0x4540cb;var _0x6e3dde;return db[_0x9999('0x28')]['findOne']({'where':{'id':_0x29ccd7[_0x9999('0x40')]['id']}})[_0x9999('0x22')](handleEntityNotFound(_0x2ad951,null))[_0x9999('0x22')](function(_0x520e18){if(_0x520e18){_0x4540cb=_0x520e18;_0x1790b9[_0x9999('0x2c')]=_[_0x9999('0x2e')](db[_0x9999('0x45')][_0x9999('0x29')]);_0x1790b9[_0x9999('0x2d')]=_[_0x9999('0x2e')](_0x29ccd7[_0x9999('0x2d')]);_0x1790b9['filters']=_[_0x9999('0x31')](_0x1790b9[_0x9999('0x2c')],_0x1790b9[_0x9999('0x2d')]);_0x29ca26[_0x9999('0x30')]=_[_0x9999('0x31')](_0x1790b9[_0x9999('0x2c')],qs[_0x9999('0x32')](_0x29ccd7[_0x9999('0x2d')][_0x9999('0x32')]));_0x29ca26['attributes']=_0x29ca26['attributes'][_0x9999('0x41')]?_0x29ca26[_0x9999('0x30')]:_0x1790b9[_0x9999('0x2c')];_0x29ca26[_0x9999('0x33')]=qs['sort'](_0x29ccd7['query']['sort']);_0x29ca26[_0x9999('0x36')]=qs['filters'](_[_0x9999('0x35')](_0x29ccd7[_0x9999('0x2d')],_0x1790b9['filters']));if(_0x29ccd7[_0x9999('0x2d')][_0x9999('0x46')]){_0x29ca26[_0x9999('0x36')]=_[_0x9999('0x39')](_0x29ca26[_0x9999('0x36')],{'$or':_[_0x9999('0x27')](_0x29ca26['attributes'],function(_0x235dee){var _0x503493={};_0x503493[_0x235dee]={'$like':'%'+_0x29ccd7[_0x9999('0x2d')][_0x9999('0x46')]+'%'};return _0x503493;})});}_0x29ca26=_[_0x9999('0x39')]({},_0x29ca26,_0x29ccd7['options']);return _0x4540cb[_0x9999('0x47')](_0x29ca26);}})['then'](function(_0x5b034a){if(_0x5b034a){_0x6e3dde=_0x5b034a[_0x9999('0x41')];if(!_0x29ccd7['query'][_0x9999('0x48')](_0x9999('0x49'))){_0x29ca26[_0x9999('0x1c')]=qs[_0x9999('0x1c')](_0x29ccd7['query'][_0x9999('0x1c')]);_0x29ca26['offset']=qs[_0x9999('0x1b')](_0x29ccd7['query'][_0x9999('0x1b')]);}return _0x4540cb[_0x9999('0x47')](_0x29ca26);}})[_0x9999('0x22')](function(_0x30ead3){if(_0x30ead3){return _0x30ead3?{'count':_0x6e3dde,'rows':_0x30ead3}:null;}})[_0x9999('0x22')](respondWithResult(_0x2ad951,null))[_0x9999('0x3f')](handleError(_0x2ad951,null));};exports[_0x9999('0x4a')]=function(_0xded7f1,_0x11b271,_0x3ea49a){var _0x404283={};var _0x11ff2a={};var _0xaac9fd;var _0x29af5e;return db['SugarcrmConfiguration'][_0x9999('0x4b')]({'where':{'id':_0xded7f1[_0x9999('0x40')]['id']}})['then'](handleEntityNotFound(_0x11b271,null))[_0x9999('0x22')](function(_0x302300){if(_0x302300){_0xaac9fd=_0x302300;_0x11ff2a[_0x9999('0x2c')]=_[_0x9999('0x2e')](db['SugarcrmField']['rawAttributes']);_0x11ff2a['query']=_['keys'](_0xded7f1[_0x9999('0x2d')]);_0x11ff2a[_0x9999('0x2f')]=_[_0x9999('0x31')](_0x11ff2a[_0x9999('0x2c')],_0x11ff2a[_0x9999('0x2d')]);_0x404283[_0x9999('0x30')]=_[_0x9999('0x31')](_0x11ff2a['model'],qs[_0x9999('0x32')](_0xded7f1[_0x9999('0x2d')][_0x9999('0x32')]));_0x404283[_0x9999('0x30')]=_0x404283['attributes']['length']?_0x404283[_0x9999('0x30')]:_0x11ff2a[_0x9999('0x2c')];_0x404283[_0x9999('0x33')]=qs[_0x9999('0x34')](_0xded7f1[_0x9999('0x2d')]['sort']);_0x404283[_0x9999('0x36')]=qs[_0x9999('0x2f')](_['pick'](_0xded7f1[_0x9999('0x2d')],_0x11ff2a['filters']));if(_0xded7f1[_0x9999('0x2d')][_0x9999('0x46')]){_0x404283['where']=_[_0x9999('0x39')](_0x404283[_0x9999('0x36')],{'$or':_[_0x9999('0x27')](_0x404283['attributes'],function(_0xb6d4f8){var _0x5e1736={};_0x5e1736[_0xb6d4f8]={'$like':'%'+_0xded7f1[_0x9999('0x2d')][_0x9999('0x46')]+'%'};return _0x5e1736;})});}_0x404283=_[_0x9999('0x39')]({},_0x404283,_0xded7f1[_0x9999('0x3a')]);return _0xaac9fd[_0x9999('0x4a')](_0x404283);}})[_0x9999('0x22')](function(_0x2913eb){if(_0x2913eb){_0x29af5e=_0x2913eb[_0x9999('0x41')];if(!_0xded7f1['query']['hasOwnProperty']('nolimit')){_0x404283[_0x9999('0x1c')]=qs[_0x9999('0x1c')](_0xded7f1['query'][_0x9999('0x1c')]);_0x404283[_0x9999('0x1b')]=qs[_0x9999('0x1b')](_0xded7f1['query'][_0x9999('0x1b')]);}return _0xaac9fd[_0x9999('0x4a')](_0x404283);}})[_0x9999('0x22')](function(_0x1f61b9){if(_0x1f61b9){return _0x1f61b9?{'count':_0x29af5e,'rows':_0x1f61b9}:null;}})[_0x9999('0x22')](respondWithResult(_0x11b271,null))[_0x9999('0x3f')](handleError(_0x11b271,null));};exports[_0x9999('0x4c')]=function(_0x5c1ac7,_0x1fdcc4,_0x2aea47){var _0x565706={};var _0x1e5e44={};var _0x456b9b;var _0x150ce1;return db[_0x9999('0x28')][_0x9999('0x4b')]({'where':{'id':_0x5c1ac7[_0x9999('0x40')]['id']}})['then'](handleEntityNotFound(_0x1fdcc4,null))[_0x9999('0x22')](function(_0x133318){if(_0x133318){_0x456b9b=_0x133318;_0x1e5e44['model']=_[_0x9999('0x2e')](db[_0x9999('0x45')]['rawAttributes']);_0x1e5e44[_0x9999('0x2d')]=_[_0x9999('0x2e')](_0x5c1ac7[_0x9999('0x2d')]);_0x1e5e44['filters']=_[_0x9999('0x31')](_0x1e5e44[_0x9999('0x2c')],_0x1e5e44[_0x9999('0x2d')]);_0x565706[_0x9999('0x30')]=_[_0x9999('0x31')](_0x1e5e44[_0x9999('0x2c')],qs[_0x9999('0x32')](_0x5c1ac7[_0x9999('0x2d')]['fields']));_0x565706[_0x9999('0x30')]=_0x565706[_0x9999('0x30')][_0x9999('0x41')]?_0x565706['attributes']:_0x1e5e44[_0x9999('0x2c')];_0x565706[_0x9999('0x33')]=qs[_0x9999('0x34')](_0x5c1ac7['query'][_0x9999('0x34')]);_0x565706['where']=qs[_0x9999('0x2f')](_[_0x9999('0x35')](_0x5c1ac7[_0x9999('0x2d')],_0x1e5e44['filters']));if(_0x5c1ac7[_0x9999('0x2d')][_0x9999('0x46')]){_0x565706[_0x9999('0x36')]=_[_0x9999('0x39')](_0x565706[_0x9999('0x36')],{'$or':_[_0x9999('0x27')](_0x565706['attributes'],function(_0x34eff6){var _0x359cad={};_0x359cad[_0x34eff6]={'$like':'%'+_0x5c1ac7[_0x9999('0x2d')][_0x9999('0x46')]+'%'};return _0x359cad;})});}_0x565706=_['merge']({},_0x565706,_0x5c1ac7[_0x9999('0x3a')]);return _0x456b9b[_0x9999('0x4c')](_0x565706);}})[_0x9999('0x22')](function(_0x2df22d){if(_0x2df22d){_0x150ce1=_0x2df22d[_0x9999('0x41')];if(!_0x5c1ac7['query'][_0x9999('0x48')](_0x9999('0x49'))){_0x565706[_0x9999('0x1c')]=qs[_0x9999('0x1c')](_0x5c1ac7[_0x9999('0x2d')][_0x9999('0x1c')]);_0x565706[_0x9999('0x1b')]=qs['offset'](_0x5c1ac7[_0x9999('0x2d')][_0x9999('0x1b')]);}return _0x456b9b[_0x9999('0x4c')](_0x565706);}})[_0x9999('0x22')](function(_0x3a0560){if(_0x3a0560){return _0x3a0560?{'count':_0x150ce1,'rows':_0x3a0560}:null;}})[_0x9999('0x22')](respondWithResult(_0x1fdcc4,null))[_0x9999('0x3f')](handleError(_0x1fdcc4,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index dd2849a..19245e5 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 _0xa37a=['lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations'];(function(_0x160cd7,_0x315362){var _0x4c34f2=function(_0x55c3c6){while(--_0x55c3c6){_0x160cd7['push'](_0x160cd7['shift']());}};_0x4c34f2(++_0x315362);}(_0xa37a,0x108));var _0xaa37=function(_0x380144,_0x19e06d){_0x380144=_0x380144-0x0;var _0x18e207=_0xa37a[_0x380144];return _0x18e207;};'use strict';var _=require(_0xaa37('0x0'));var util=require('util');var logger=require(_0xaa37('0x1'))('api');var moment=require(_0xaa37('0x2'));var BPromise=require(_0xaa37('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaa37('0x4'));var rimraf=require(_0xaa37('0x5'));var config=require(_0xaa37('0x6'));var attributes=require(_0xaa37('0x7'));module[_0xaa37('0x8')]=function(_0x20b5d1,_0x246766){return _0x20b5d1[_0xaa37('0x9')](_0xaa37('0xa'),attributes,{'tableName':_0xaa37('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a09=['./intSugarcrmConfiguration.attributes','exports','define','int_sugarcrm_configurations','lodash','util','../../config/logger','api','bluebird','path','../../config/environment'];(function(_0x561b25,_0x312a13){var _0x5c66fb=function(_0x23a0c0){while(--_0x23a0c0){_0x561b25['push'](_0x561b25['shift']());}};_0x5c66fb(++_0x312a13);}(_0x1a09,0x1d2));var _0x91a0=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x1a09[_0x54d4a8];return _0x3b321b;};'use strict';var _=require(_0x91a0('0x0'));var util=require(_0x91a0('0x1'));var logger=require(_0x91a0('0x2'))(_0x91a0('0x3'));var moment=require('moment');var BPromise=require(_0x91a0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91a0('0x5'));var rimraf=require('rimraf');var config=require(_0x91a0('0x6'));var attributes=require(_0x91a0('0x7'));module[_0x91a0('0x8')]=function(_0x21f08f,_0x17c762){return _0x21f08f[_0x91a0('0x9')]('SugarcrmConfiguration',attributes,{'tableName':_0x91a0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 217dab8..d8d4fea 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 _0x35c6=['info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','../../config/utils','jayson/promise','client','http','request','then'];(function(_0x4c1338,_0x1f2b01){var _0x16c5db=function(_0x19dab6){while(--_0x19dab6){_0x4c1338['push'](_0x4c1338['shift']());}};_0x16c5db(++_0x1f2b01);}(_0x35c6,0xda));var _0x635c=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x35c6[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x635c('0x0'));var util=require(_0x635c('0x1'));var moment=require(_0x635c('0x2'));var BPromise=require(_0x635c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x635c('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x635c('0x5'));var client=jayson[_0x635c('0x6')][_0x635c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5e2775,_0xb70b01,_0x1dd87c){return new BPromise(function(_0x4a4e7f,_0x2aaf3c){return client[_0x635c('0x8')](_0x5e2775,_0x1dd87c)[_0x635c('0x9')](function(_0xf62f03){logger[_0x635c('0xa')](_0x635c('0xb'),_0xb70b01,_0x635c('0xc'));logger[_0x635c('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0xb70b01,_0x635c('0xc'),JSON[_0x635c('0xe')](_0xf62f03));if(_0xf62f03[_0x635c('0xf')]){if(_0xf62f03['error'][_0x635c('0x10')]===0x1f4){logger[_0x635c('0xf')](_0x635c('0xb'),_0xb70b01,_0xf62f03[_0x635c('0xf')]['message']);return _0x2aaf3c(_0xf62f03[_0x635c('0xf')]['message']);}logger[_0x635c('0xf')](_0x635c('0xb'),_0xb70b01,_0xf62f03[_0x635c('0xf')]['message']);return _0x4a4e7f(_0xf62f03[_0x635c('0xf')][_0x635c('0x11')]);}else{logger[_0x635c('0xa')](_0x635c('0xb'),_0xb70b01,'request\x20sent');_0x4a4e7f(_0xf62f03[_0x635c('0x12')][_0x635c('0x11')]);}})['catch'](function(_0x9e2562){logger[_0x635c('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xb70b01,_0x9e2562);_0x2aaf3c(_0x9e2562);});});} \ No newline at end of file +var _0x43a0=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x43a0,0x1e4));var _0x043a=function(_0x20317d,_0x156ede){_0x20317d=_0x20317d-0x0;var _0x316d8f=_0x43a0[_0x20317d];return _0x316d8f;};'use strict';var _=require(_0x043a('0x0'));var util=require(_0x043a('0x1'));var moment=require(_0x043a('0x2'));var BPromise=require('bluebird');var rs=require(_0x043a('0x3'));var fs=require('fs');var Redis=require(_0x043a('0x4'));var db=require(_0x043a('0x5'))['db'];var utils=require(_0x043a('0x6'));var logger=require(_0x043a('0x7'))(_0x043a('0x8'));var config=require(_0x043a('0x9'));var jayson=require(_0x043a('0xa'));var client=jayson['client'][_0x043a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e5369,_0x17b5d9,_0x48eeaf){return new BPromise(function(_0x5ed05d,_0x45c5c5){return client[_0x043a('0xc')](_0x2e5369,_0x48eeaf)[_0x043a('0xd')](function(_0x3dae9b){logger['info'](_0x043a('0xe'),_0x17b5d9,'request\x20sent');logger[_0x043a('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x17b5d9,_0x043a('0x10'),JSON[_0x043a('0x11')](_0x3dae9b));if(_0x3dae9b['error']){if(_0x3dae9b[_0x043a('0x12')][_0x043a('0x13')]===0x1f4){logger['error'](_0x043a('0xe'),_0x17b5d9,_0x3dae9b['error'][_0x043a('0x14')]);return _0x45c5c5(_0x3dae9b[_0x043a('0x12')]['message']);}logger[_0x043a('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x17b5d9,_0x3dae9b[_0x043a('0x12')][_0x043a('0x14')]);return _0x5ed05d(_0x3dae9b[_0x043a('0x12')][_0x043a('0x14')]);}else{logger['info'](_0x043a('0xe'),_0x17b5d9,'request\x20sent');_0x5ed05d(_0x3dae9b[_0x043a('0x15')][_0x043a('0x14')]);}})[_0x043a('0x16')](function(_0x31e7f7){logger[_0x043a('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x17b5d9,_0x31e7f7);_0x45c5c5(_0x31e7f7);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 18266d0..c23b9b0 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 _0x67e6=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','index','get','/:id','show','post','create','put'];(function(_0x1cc961,_0x2c42ee){var _0x471d86=function(_0x44e422){while(--_0x44e422){_0x1cc961['push'](_0x1cc961['shift']());}};_0x471d86(++_0x2c42ee);}(_0x67e6,0xab));var _0x667e=function(_0x102d2b,_0x1d61d6){_0x102d2b=_0x102d2b-0x0;var _0x2bc573=_0x67e6[_0x102d2b];return _0x2bc573;};'use strict';var multer=require(_0x667e('0x0'));var util=require(_0x667e('0x1'));var path=require(_0x667e('0x2'));var timeout=require(_0x667e('0x3'));var express=require(_0x667e('0x4'));var router=express[_0x667e('0x5')]();var fs_extra=require(_0x667e('0x6'));var auth=require(_0x667e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x667e('0x8'));var controller=require(_0x667e('0x9'));router['get']('/',auth[_0x667e('0xa')](),controller[_0x667e('0xb')]);router[_0x667e('0xc')](_0x667e('0xd'),auth[_0x667e('0xa')](),controller[_0x667e('0xe')]);router[_0x667e('0xf')]('/',auth['isAuthenticated'](),controller[_0x667e('0x10')]);router[_0x667e('0x11')](_0x667e('0xd'),auth[_0x667e('0xa')](),controller['update']);router[_0x667e('0x12')](_0x667e('0xd'),auth[_0x667e('0xa')](),controller[_0x667e('0x13')]);module[_0x667e('0x14')]=router; \ No newline at end of file +var _0xd328=['index','/:id','show','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0xd328,0x67));var _0x8d32=function(_0xfa214e,_0x63a4a6){_0xfa214e=_0xfa214e-0x0;var _0x1cd6c3=_0xd328[_0xfa214e];return _0x1cd6c3;};'use strict';var multer=require(_0x8d32('0x0'));var util=require(_0x8d32('0x1'));var path=require('path');var timeout=require(_0x8d32('0x2'));var express=require(_0x8d32('0x3'));var router=express[_0x8d32('0x4')]();var fs_extra=require(_0x8d32('0x5'));var auth=require(_0x8d32('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8d32('0x7'));var controller=require(_0x8d32('0x8'));router[_0x8d32('0x9')]('/',auth[_0x8d32('0xa')](),controller[_0x8d32('0xb')]);router[_0x8d32('0x9')](_0x8d32('0xc'),auth[_0x8d32('0xa')](),controller[_0x8d32('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8d32('0xe')]);router[_0x8d32('0xf')](_0x8d32('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x8d32('0x10')](_0x8d32('0xc'),auth[_0x8d32('0xa')](),controller[_0x8d32('0x11')]);module[_0x8d32('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 1c22c3e..623af5b 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 _0x47b5=['ENUM','picklist','string','STRING','variable','customVariable','BOOLEAN','sequelize'];(function(_0x13ba2b,_0x5702b6){var _0x33a36d=function(_0xe1f5bc){while(--_0xe1f5bc){_0x13ba2b['push'](_0x13ba2b['shift']());}};_0x33a36d(++_0x5702b6);}(_0x47b5,0x13f));var _0x547b=function(_0x3c1730,_0x430d55){_0x3c1730=_0x3c1730-0x0;var _0xa81530=_0x47b5[_0x3c1730];return _0xa81530;};'use strict';var Sequelize=require(_0x547b('0x0'));module['exports']={'type':{'type':Sequelize[_0x547b('0x1')]('string','variable','customVariable','keyValue',_0x547b('0x2')),'defaultValue':_0x547b('0x3')},'content':{'type':Sequelize[_0x547b('0x4')]},'key':{'type':Sequelize[_0x547b('0x4')]},'keyType':{'type':Sequelize[_0x547b('0x1')]('string',_0x547b('0x5'),_0x547b('0x6'))},'keyContent':{'type':Sequelize[_0x547b('0x4')]},'idField':{'type':Sequelize[_0x547b('0x4')]},'nameField':{'type':Sequelize[_0x547b('0x4')]},'customField':{'type':Sequelize[_0x547b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x547b('0x4')]}}; \ No newline at end of file +var _0x1d47=['variable','picklist','STRING','customVariable','sequelize','exports','ENUM','string'];(function(_0x505707,_0x539e74){var _0x3253b1=function(_0x2dfa5a){while(--_0x2dfa5a){_0x505707['push'](_0x505707['shift']());}};_0x3253b1(++_0x539e74);}(_0x1d47,0xb4));var _0x71d4=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x1d47[_0x49ca18];return _0x145d54;};'use strict';var Sequelize=require(_0x71d4('0x0'));module[_0x71d4('0x1')]={'type':{'type':Sequelize[_0x71d4('0x2')](_0x71d4('0x3'),_0x71d4('0x4'),'customVariable','keyValue',_0x71d4('0x5')),'defaultValue':_0x71d4('0x3')},'content':{'type':Sequelize[_0x71d4('0x6')]},'key':{'type':Sequelize[_0x71d4('0x6')]},'keyType':{'type':Sequelize[_0x71d4('0x2')]('string',_0x71d4('0x4'),_0x71d4('0x7'))},'keyContent':{'type':Sequelize[_0x71d4('0x6')]},'idField':{'type':Sequelize[_0x71d4('0x6')]},'nameField':{'type':Sequelize[_0x71d4('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x71d4('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index eb9cb33..7cc5c18 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 _0x082a=['save','update','then','destroy','stack','name','map','SugarcrmField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','length','options','catch','create','body','params','find','eml-format','rimraf','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','reject'];(function(_0x38fb0d,_0x52b5db){var _0x30a5d6=function(_0x31eba6){while(--_0x31eba6){_0x38fb0d['push'](_0x38fb0d['shift']());}};_0x30a5d6(++_0x52b5db);}(_0x082a,0x65));var _0xa082=function(_0x457b1c,_0x587a7a){_0x457b1c=_0x457b1c-0x0;var _0xebd2cd=_0x082a[_0x457b1c];return _0xebd2cd;};'use strict';var emlformat=require(_0xa082('0x0'));var rimraf=require(_0xa082('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa082('0x2'));var moment=require('moment');var BPromise=require(_0xa082('0x3'));var Mustache=require(_0xa082('0x4'));var util=require('util');var path=require(_0xa082('0x5'));var sox=require(_0xa082('0x6'));var csv=require(_0xa082('0x7'));var ejs=require(_0xa082('0x8'));var fs=require('fs');var fs_extra=require(_0xa082('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa082('0xa'));var jsforce=require(_0xa082('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa082('0x7'));var querystring=require(_0xa082('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa082('0xd'));var as=require(_0xa082('0xe'));var hardwareService=require(_0xa082('0xf'));var logger=require('../../config/logger')(_0xa082('0x10'));var utils=require('../../config/utils');var config=require(_0xa082('0x11'));var licenseUtil=require(_0xa082('0x12'));var db=require(_0xa082('0x13'))['db'];function respondWithStatusCode(_0x489f50,_0x28752b){_0x28752b=_0x28752b||0xcc;return function(_0x36160b){if(_0x36160b){return _0x489f50[_0xa082('0x14')](_0x28752b);}return _0x489f50[_0xa082('0x15')](_0x28752b)['end']();};}function respondWithResult(_0xf62cd7,_0x55149c){_0x55149c=_0x55149c||0xc8;return function(_0x1032ec){if(_0x1032ec){return _0xf62cd7[_0xa082('0x15')](_0x55149c)[_0xa082('0x16')](_0x1032ec);}};}function respondWithFilteredResult(_0x5a5703,_0x5b7d0e){return function(_0x429753){if(_0x429753){var _0x1bf219=typeof _0x5b7d0e[_0xa082('0x17')]==='undefined'&&typeof _0x5b7d0e[_0xa082('0x18')]==='undefined';var _0x11b57f=_0x429753['count'];var _0x149f97=_0x1bf219?0x0:_0x5b7d0e[_0xa082('0x17')];var _0x10966a=_0x1bf219?_0x429753[_0xa082('0x19')]:_0x5b7d0e['offset']+_0x5b7d0e[_0xa082('0x18')];var _0x25cd2c;if(_0x10966a>=_0x11b57f){_0x10966a=_0x11b57f;_0x25cd2c=0xc8;}else{_0x25cd2c=0xce;}_0x5a5703[_0xa082('0x15')](_0x25cd2c);return _0x5a5703[_0xa082('0x1a')](_0xa082('0x1b'),_0x149f97+'-'+_0x10966a+'/'+_0x11b57f)[_0xa082('0x16')](_0x429753);}return null;};}function patchUpdates(_0x2fd330){return function(_0xdbbc2b){try{jsonpatch['apply'](_0xdbbc2b,_0x2fd330,!![]);}catch(_0x4b7ead){return BPromise[_0xa082('0x1c')](_0x4b7ead);}return _0xdbbc2b[_0xa082('0x1d')]();};}function saveUpdates(_0x5b651b,_0x102587){return function(_0x5bb266){if(_0x5bb266){return _0x5bb266[_0xa082('0x1e')](_0x5b651b)[_0xa082('0x1f')](function(_0x5e9b10){return _0x5e9b10;});}return null;};}function removeEntity(_0x5d897e,_0x503482){return function(_0x533ee0){if(_0x533ee0){return _0x533ee0[_0xa082('0x20')]()[_0xa082('0x1f')](function(){_0x5d897e[_0xa082('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5830e4,_0x59ee47){return function(_0x68fbe){if(!_0x68fbe){_0x5830e4['sendStatus'](0x194);}return _0x68fbe;};}function handleError(_0x489b83,_0xd6c47b){_0xd6c47b=_0xd6c47b||0x1f4;return function(_0x20eac6){logger['error'](_0x20eac6[_0xa082('0x21')]);if(_0x20eac6[_0xa082('0x22')]){delete _0x20eac6[_0xa082('0x22')];}_0x489b83[_0xa082('0x15')](_0xd6c47b)['send'](_0x20eac6);};}exports['index']=function(_0xb235fa,_0x50b02b){var _0x3da8bf={},_0x5d6b32={},_0x37fdc4={'count':0x0,'rows':[]};var _0x1f4b25=_[_0xa082('0x23')](db[_0xa082('0x24')][_0xa082('0x25')],function(_0x55855d){return{'name':_0x55855d[_0xa082('0x26')],'type':_0x55855d[_0xa082('0x27')][_0xa082('0x28')]};});_0x5d6b32[_0xa082('0x29')]=_[_0xa082('0x23')](_0x1f4b25,_0xa082('0x22'));_0x5d6b32['query']=_[_0xa082('0x2a')](_0xb235fa[_0xa082('0x2b')]);_0x5d6b32[_0xa082('0x2c')]=_[_0xa082('0x2d')](_0x5d6b32[_0xa082('0x29')],_0x5d6b32[_0xa082('0x2b')]);_0x3da8bf['attributes']=_[_0xa082('0x2d')](_0x5d6b32['model'],qs[_0xa082('0x2e')](_0xb235fa[_0xa082('0x2b')]['fields']));_0x3da8bf['attributes']=_0x3da8bf[_0xa082('0x2f')]['length']?_0x3da8bf['attributes']:_0x5d6b32[_0xa082('0x29')];if(!_0xb235fa[_0xa082('0x2b')][_0xa082('0x30')]('nolimit')){_0x3da8bf[_0xa082('0x18')]=qs[_0xa082('0x18')](_0xb235fa[_0xa082('0x2b')][_0xa082('0x18')]);_0x3da8bf[_0xa082('0x17')]=qs['offset'](_0xb235fa['query'][_0xa082('0x17')]);}_0x3da8bf['order']=qs[_0xa082('0x31')](_0xb235fa[_0xa082('0x2b')]['sort']);_0x3da8bf[_0xa082('0x32')]=qs[_0xa082('0x2c')](_[_0xa082('0x33')](_0xb235fa[_0xa082('0x2b')],_0x5d6b32['filters']),_0x1f4b25);if(_0xb235fa[_0xa082('0x2b')][_0xa082('0x34')]){_0x3da8bf[_0xa082('0x32')]=_[_0xa082('0x35')](_0x3da8bf[_0xa082('0x32')],{'$or':_['map'](_0x1f4b25,function(_0x2a695e){if(_0x2a695e['type']!==_0xa082('0x36')){var _0x3bf751={};_0x3bf751[_0x2a695e[_0xa082('0x22')]]={'$like':'%'+_0xb235fa['query'][_0xa082('0x34')]+'%'};return _0x3bf751;}})});}_0x3da8bf=_[_0xa082('0x35')]({},_0x3da8bf,_0xb235fa['options']);var _0x5df14e={'where':_0x3da8bf[_0xa082('0x32')]};return db[_0xa082('0x24')][_0xa082('0x19')](_0x5df14e)['then'](function(_0x39febf){_0x37fdc4[_0xa082('0x19')]=_0x39febf;if(_0xb235fa[_0xa082('0x2b')][_0xa082('0x37')]){_0x3da8bf[_0xa082('0x38')]=[{'all':!![]}];}return db[_0xa082('0x24')]['findAll'](_0x3da8bf);})['then'](function(_0x2b72d5){_0x37fdc4[_0xa082('0x39')]=_0x2b72d5;return _0x37fdc4;})[_0xa082('0x1f')](respondWithFilteredResult(_0x50b02b,_0x3da8bf))['catch'](handleError(_0x50b02b,null));};exports['show']=function(_0x1e850c,_0x182755){var _0x101265={'raw':!![],'where':{'id':_0x1e850c['params']['id']}},_0x55e0c5={};_0x55e0c5[_0xa082('0x29')]=_[_0xa082('0x2a')](db['SugarcrmField'][_0xa082('0x25')]);_0x55e0c5[_0xa082('0x2b')]=_[_0xa082('0x2a')](_0x1e850c[_0xa082('0x2b')]);_0x55e0c5[_0xa082('0x2c')]=_[_0xa082('0x2d')](_0x55e0c5[_0xa082('0x29')],_0x55e0c5[_0xa082('0x2b')]);_0x101265[_0xa082('0x2f')]=_['intersection'](_0x55e0c5[_0xa082('0x29')],qs[_0xa082('0x2e')](_0x1e850c[_0xa082('0x2b')]['fields']));_0x101265['attributes']=_0x101265[_0xa082('0x2f')][_0xa082('0x3a')]?_0x101265[_0xa082('0x2f')]:_0x55e0c5['model'];if(_0x1e850c[_0xa082('0x2b')][_0xa082('0x37')]){_0x101265[_0xa082('0x38')]=[{'all':!![]}];}_0x101265=_[_0xa082('0x35')]({},_0x101265,_0x1e850c[_0xa082('0x3b')]);return db[_0xa082('0x24')]['find'](_0x101265)['then'](handleEntityNotFound(_0x182755,null))['then'](respondWithResult(_0x182755,null))[_0xa082('0x3c')](handleError(_0x182755,null));};exports[_0xa082('0x3d')]=function(_0x2ca76b,_0x4346e4){return db['SugarcrmField'][_0xa082('0x3d')](_0x2ca76b[_0xa082('0x3e')],{})[_0xa082('0x1f')](respondWithResult(_0x4346e4,0xc9))['catch'](handleError(_0x4346e4,null));};exports[_0xa082('0x1e')]=function(_0x4b3657,_0x24df78){if(_0x4b3657[_0xa082('0x3e')]['id']){delete _0x4b3657[_0xa082('0x3e')]['id'];}return db[_0xa082('0x24')]['find']({'where':{'id':_0x4b3657[_0xa082('0x3f')]['id']}})[_0xa082('0x1f')](handleEntityNotFound(_0x24df78,null))[_0xa082('0x1f')](saveUpdates(_0x4b3657[_0xa082('0x3e')],null))['then'](respondWithResult(_0x24df78,null))[_0xa082('0x3c')](handleError(_0x24df78,null));};exports[_0xa082('0x20')]=function(_0x4b50ab,_0x4f20a9){return db[_0xa082('0x24')][_0xa082('0x40')]({'where':{'id':_0x4b50ab['params']['id']}})['then'](handleEntityNotFound(_0x4f20a9,null))[_0xa082('0x1f')](removeEntity(_0x4f20a9,null))[_0xa082('0x3c')](handleError(_0x4f20a9,null));}; \ No newline at end of file +var _0x1859=['stack','name','send','map','SugarcrmField','rawAttributes','fieldName','type','key','model','filters','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','intersection','merge','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','then','destroy','error'];(function(_0x39e9b9,_0x1490f9){var _0x23dd9a=function(_0x138d07){while(--_0x138d07){_0x39e9b9['push'](_0x39e9b9['shift']());}};_0x23dd9a(++_0x1490f9);}(_0x1859,0x1f2));var _0x9185=function(_0x5fb3cb,_0xe4f69d){_0x5fb3cb=_0x5fb3cb-0x0;var _0x42e125=_0x1859[_0x5fb3cb];return _0x42e125;};'use strict';var emlformat=require(_0x9185('0x0'));var rimraf=require(_0x9185('0x1'));var zipdir=require(_0x9185('0x2'));var jsonpatch=require(_0x9185('0x3'));var rp=require(_0x9185('0x4'));var moment=require('moment');var BPromise=require(_0x9185('0x5'));var Mustache=require(_0x9185('0x6'));var util=require(_0x9185('0x7'));var path=require(_0x9185('0x8'));var sox=require(_0x9185('0x9'));var csv=require(_0x9185('0xa'));var ejs=require(_0x9185('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9185('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9185('0xd'));var deskjs=require(_0x9185('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9185('0xf'));var Papa=require(_0x9185('0x10'));var Redis=require(_0x9185('0x11'));var authService=require(_0x9185('0x12'));var qs=require(_0x9185('0x13'));var as=require(_0x9185('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9185('0x15'))(_0x9185('0x16'));var utils=require(_0x9185('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9185('0x18'));var db=require(_0x9185('0x19'))['db'];function respondWithStatusCode(_0x3ae782,_0x39855b){_0x39855b=_0x39855b||0xcc;return function(_0xadb7b1){if(_0xadb7b1){return _0x3ae782[_0x9185('0x1a')](_0x39855b);}return _0x3ae782[_0x9185('0x1b')](_0x39855b)[_0x9185('0x1c')]();};}function respondWithResult(_0x1abf4b,_0x3dc4d5){_0x3dc4d5=_0x3dc4d5||0xc8;return function(_0x2ff91b){if(_0x2ff91b){return _0x1abf4b['status'](_0x3dc4d5)['json'](_0x2ff91b);}};}function respondWithFilteredResult(_0x4159bf,_0x24322b){return function(_0x2e6415){if(_0x2e6415){var _0xa3cdb2=typeof _0x24322b[_0x9185('0x1d')]===_0x9185('0x1e')&&typeof _0x24322b[_0x9185('0x1f')]===_0x9185('0x1e');var _0x4a5fa3=_0x2e6415[_0x9185('0x20')];var _0x32a515=_0xa3cdb2?0x0:_0x24322b['offset'];var _0x39f521=_0xa3cdb2?_0x2e6415[_0x9185('0x20')]:_0x24322b[_0x9185('0x1d')]+_0x24322b[_0x9185('0x1f')];var _0x4078b9;if(_0x39f521>=_0x4a5fa3){_0x39f521=_0x4a5fa3;_0x4078b9=0xc8;}else{_0x4078b9=0xce;}_0x4159bf[_0x9185('0x1b')](_0x4078b9);return _0x4159bf[_0x9185('0x21')]('Content-Range',_0x32a515+'-'+_0x39f521+'/'+_0x4a5fa3)[_0x9185('0x22')](_0x2e6415);}return null;};}function patchUpdates(_0x469869){return function(_0x205178){try{jsonpatch[_0x9185('0x23')](_0x205178,_0x469869,!![]);}catch(_0x416b79){return BPromise[_0x9185('0x24')](_0x416b79);}return _0x205178[_0x9185('0x25')]();};}function saveUpdates(_0x20d06b,_0x235e53){return function(_0x911c5a){if(_0x911c5a){return _0x911c5a['update'](_0x20d06b)[_0x9185('0x26')](function(_0x186523){return _0x186523;});}return null;};}function removeEntity(_0x185ee9,_0x5951c0){return function(_0x503876){if(_0x503876){return _0x503876[_0x9185('0x27')]()['then'](function(){_0x185ee9[_0x9185('0x1b')](0xcc)[_0x9185('0x1c')]();});}};}function handleEntityNotFound(_0xdea2d2,_0x4d6625){return function(_0x24745){if(!_0x24745){_0xdea2d2[_0x9185('0x1a')](0x194);}return _0x24745;};}function handleError(_0x5d1151,_0x226672){_0x226672=_0x226672||0x1f4;return function(_0x5a7d15){logger[_0x9185('0x28')](_0x5a7d15[_0x9185('0x29')]);if(_0x5a7d15[_0x9185('0x2a')]){delete _0x5a7d15[_0x9185('0x2a')];}_0x5d1151['status'](_0x226672)[_0x9185('0x2b')](_0x5a7d15);};}exports['index']=function(_0xe18d0b,_0x549209){var _0x3da3a7={},_0x4a6da8={},_0x39a2f0={'count':0x0,'rows':[]};var _0x54f62e=_[_0x9185('0x2c')](db[_0x9185('0x2d')][_0x9185('0x2e')],function(_0x57ee0f){return{'name':_0x57ee0f[_0x9185('0x2f')],'type':_0x57ee0f[_0x9185('0x30')][_0x9185('0x31')]};});_0x4a6da8[_0x9185('0x32')]=_[_0x9185('0x2c')](_0x54f62e,_0x9185('0x2a'));_0x4a6da8['query']=_['keys'](_0xe18d0b['query']);_0x4a6da8[_0x9185('0x33')]=_['intersection'](_0x4a6da8[_0x9185('0x32')],_0x4a6da8[_0x9185('0x34')]);_0x3da3a7[_0x9185('0x35')]=_['intersection'](_0x4a6da8[_0x9185('0x32')],qs[_0x9185('0x36')](_0xe18d0b[_0x9185('0x34')][_0x9185('0x36')]));_0x3da3a7[_0x9185('0x35')]=_0x3da3a7[_0x9185('0x35')][_0x9185('0x37')]?_0x3da3a7[_0x9185('0x35')]:_0x4a6da8[_0x9185('0x32')];if(!_0xe18d0b[_0x9185('0x34')][_0x9185('0x38')](_0x9185('0x39'))){_0x3da3a7['limit']=qs['limit'](_0xe18d0b[_0x9185('0x34')]['limit']);_0x3da3a7[_0x9185('0x1d')]=qs['offset'](_0xe18d0b['query'][_0x9185('0x1d')]);}_0x3da3a7[_0x9185('0x3a')]=qs[_0x9185('0x3b')](_0xe18d0b[_0x9185('0x34')][_0x9185('0x3b')]);_0x3da3a7[_0x9185('0x3c')]=qs[_0x9185('0x33')](_['pick'](_0xe18d0b['query'],_0x4a6da8[_0x9185('0x33')]),_0x54f62e);if(_0xe18d0b[_0x9185('0x34')][_0x9185('0x3d')]){_0x3da3a7[_0x9185('0x3c')]=_['merge'](_0x3da3a7['where'],{'$or':_[_0x9185('0x2c')](_0x54f62e,function(_0x477847){if(_0x477847['type']!==_0x9185('0x3e')){var _0x4b88f9={};_0x4b88f9[_0x477847[_0x9185('0x2a')]]={'$like':'%'+_0xe18d0b[_0x9185('0x34')]['filter']+'%'};return _0x4b88f9;}})});}_0x3da3a7=_['merge']({},_0x3da3a7,_0xe18d0b[_0x9185('0x3f')]);var _0x53b677={'where':_0x3da3a7[_0x9185('0x3c')]};return db[_0x9185('0x2d')][_0x9185('0x20')](_0x53b677)['then'](function(_0x9a3d24){_0x39a2f0[_0x9185('0x20')]=_0x9a3d24;if(_0xe18d0b[_0x9185('0x34')][_0x9185('0x40')]){_0x3da3a7[_0x9185('0x41')]=[{'all':!![]}];}return db['SugarcrmField'][_0x9185('0x42')](_0x3da3a7);})[_0x9185('0x26')](function(_0x3e0057){_0x39a2f0[_0x9185('0x43')]=_0x3e0057;return _0x39a2f0;})[_0x9185('0x26')](respondWithFilteredResult(_0x549209,_0x3da3a7))['catch'](handleError(_0x549209,null));};exports[_0x9185('0x44')]=function(_0x2adffc,_0x4f5d63){var _0xb96a98={'raw':!![],'where':{'id':_0x2adffc[_0x9185('0x45')]['id']}},_0x19466d={};_0x19466d['model']=_[_0x9185('0x46')](db['SugarcrmField']['rawAttributes']);_0x19466d[_0x9185('0x34')]=_[_0x9185('0x46')](_0x2adffc['query']);_0x19466d[_0x9185('0x33')]=_[_0x9185('0x47')](_0x19466d[_0x9185('0x32')],_0x19466d['query']);_0xb96a98[_0x9185('0x35')]=_[_0x9185('0x47')](_0x19466d[_0x9185('0x32')],qs[_0x9185('0x36')](_0x2adffc[_0x9185('0x34')]['fields']));_0xb96a98[_0x9185('0x35')]=_0xb96a98['attributes']['length']?_0xb96a98[_0x9185('0x35')]:_0x19466d['model'];if(_0x2adffc['query'][_0x9185('0x40')]){_0xb96a98[_0x9185('0x41')]=[{'all':!![]}];}_0xb96a98=_[_0x9185('0x48')]({},_0xb96a98,_0x2adffc[_0x9185('0x3f')]);return db[_0x9185('0x2d')][_0x9185('0x49')](_0xb96a98)['then'](handleEntityNotFound(_0x4f5d63,null))[_0x9185('0x26')](respondWithResult(_0x4f5d63,null))['catch'](handleError(_0x4f5d63,null));};exports[_0x9185('0x4a')]=function(_0x44b4bc,_0x4e14bf){return db['SugarcrmField']['create'](_0x44b4bc[_0x9185('0x4b')],{})['then'](respondWithResult(_0x4e14bf,0xc9))['catch'](handleError(_0x4e14bf,null));};exports['update']=function(_0x2d776d,_0x46d942){if(_0x2d776d[_0x9185('0x4b')]['id']){delete _0x2d776d['body']['id'];}return db[_0x9185('0x2d')][_0x9185('0x49')]({'where':{'id':_0x2d776d[_0x9185('0x45')]['id']}})[_0x9185('0x26')](handleEntityNotFound(_0x46d942,null))[_0x9185('0x26')](saveUpdates(_0x2d776d[_0x9185('0x4b')],null))['then'](respondWithResult(_0x46d942,null))[_0x9185('0x4c')](handleError(_0x46d942,null));};exports[_0x9185('0x27')]=function(_0x28706e,_0x1899cc){return db[_0x9185('0x2d')]['find']({'where':{'id':_0x28706e[_0x9185('0x45')]['id']}})[_0x9185('0x26')](handleEntityNotFound(_0x1899cc,null))['then'](removeEntity(_0x1899cc,null))['catch'](handleError(_0x1899cc,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index e63563d..ca3bf41 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 _0xb103=['./intSugarcrmField.attributes','define','SugarcrmField','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x6c0123,_0x4c8d3b){var _0x5a87d2=function(_0x1ff614){while(--_0x1ff614){_0x6c0123['push'](_0x6c0123['shift']());}};_0x5a87d2(++_0x4c8d3b);}(_0xb103,0x94));var _0x3b10=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0xb103[_0x11ce46];return _0x368a1e;};'use strict';var _=require(_0x3b10('0x0'));var util=require(_0x3b10('0x1'));var logger=require(_0x3b10('0x2'))('api');var moment=require(_0x3b10('0x3'));var BPromise=require(_0x3b10('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3b10('0x5'));var rimraf=require(_0x3b10('0x6'));var config=require(_0x3b10('0x7'));var attributes=require(_0x3b10('0x8'));module['exports']=function(_0x2ad008,_0x8e44b6){return _0x2ad008[_0x3b10('0x9')](_0x3b10('0xa'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x3b10('0xb'),_0x3b10('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa3e0=['./intSugarcrmField.attributes','exports','define','idField','lodash','../../config/logger','api','moment','bluebird'];(function(_0x10e660,_0x311794){var _0x1ff2a2=function(_0x2dd65a){while(--_0x2dd65a){_0x10e660['push'](_0x10e660['shift']());}};_0x1ff2a2(++_0x311794);}(_0xa3e0,0x79));var _0x0a3e=function(_0x4e93ad,_0x47cc05){_0x4e93ad=_0x4e93ad-0x0;var _0x21ca84=_0xa3e0[_0x4e93ad];return _0x21ca84;};'use strict';var _=require(_0x0a3e('0x0'));var util=require('util');var logger=require(_0x0a3e('0x1'))(_0x0a3e('0x2'));var moment=require(_0x0a3e('0x3'));var BPromise=require(_0x0a3e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0a3e('0x5'));module[_0x0a3e('0x6')]=function(_0xf4f595,_0x7bbac9){return _0xf4f595[_0x0a3e('0x7')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x0a3e('0x8'),'FieldId'],'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 023e072..f056a94 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 _0x4d71=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','moment'];(function(_0x5ac056,_0xf16f9c){var _0x211960=function(_0x1bee87){while(--_0x1bee87){_0x5ac056['push'](_0x5ac056['shift']());}};_0x211960(++_0xf16f9c);}(_0x4d71,0x67));var _0x14d7=function(_0x1f0bcf,_0x2898b3){_0x1f0bcf=_0x1f0bcf-0x0;var _0x1fc8c9=_0x4d71[_0x1f0bcf];return _0x1fc8c9;};'use strict';var _=require('lodash');var util=require(_0x14d7('0x0'));var moment=require(_0x14d7('0x1'));var BPromise=require(_0x14d7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x14d7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x14d7('0x4'));var logger=require(_0x14d7('0x5'))(_0x14d7('0x6'));var config=require(_0x14d7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x14d7('0x8')][_0x14d7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x223e37,_0x16e393,_0x52945c){return new BPromise(function(_0x4a3405,_0x595a1b){return client[_0x14d7('0xa')](_0x223e37,_0x52945c)[_0x14d7('0xb')](function(_0x351719){logger['info'](_0x14d7('0xc'),_0x16e393,_0x14d7('0xd'));logger['debug'](_0x14d7('0xe'),_0x16e393,_0x14d7('0xd'),JSON[_0x14d7('0xf')](_0x351719));if(_0x351719[_0x14d7('0x10')]){if(_0x351719[_0x14d7('0x10')]['code']===0x1f4){logger[_0x14d7('0x10')](_0x14d7('0xc'),_0x16e393,_0x351719[_0x14d7('0x10')]['message']);return _0x595a1b(_0x351719['error'][_0x14d7('0x11')]);}logger[_0x14d7('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x16e393,_0x351719[_0x14d7('0x10')][_0x14d7('0x11')]);return _0x4a3405(_0x351719[_0x14d7('0x10')]['message']);}else{logger[_0x14d7('0x12')](_0x14d7('0xc'),_0x16e393,_0x14d7('0xd'));_0x4a3405(_0x351719[_0x14d7('0x13')][_0x14d7('0x11')]);}})[_0x14d7('0x14')](function(_0xd3cfc4){logger['error'](_0x14d7('0xc'),_0x16e393,_0xd3cfc4);_0x595a1b(_0xd3cfc4);});});} \ No newline at end of file +var _0x1030=['../../mysqldb','rpc','jayson/promise','client','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x7978a5,_0x5a4e10){var _0x5a7ad3=function(_0x45b8f2){while(--_0x45b8f2){_0x7978a5['push'](_0x7978a5['shift']());}};_0x5a7ad3(++_0x5a4e10);}(_0x1030,0x69));var _0x0103=function(_0x48fa63,_0x64aa0e){_0x48fa63=_0x48fa63-0x0;var _0x4ff127=_0x1030[_0x48fa63];return _0x4ff127;};'use strict';var _=require(_0x0103('0x0'));var util=require(_0x0103('0x1'));var moment=require('moment');var BPromise=require(_0x0103('0x2'));var rs=require(_0x0103('0x3'));var fs=require('fs');var Redis=require(_0x0103('0x4'));var db=require(_0x0103('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0103('0x6'));var config=require('../../config/environment');var jayson=require(_0x0103('0x7'));var client=jayson[_0x0103('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d3602,_0x449393,_0x4c7a38){return new BPromise(function(_0x1a2ec6,_0x40cb1b){return client[_0x0103('0x9')](_0x5d3602,_0x4c7a38)[_0x0103('0xa')](function(_0x5dfbb9){logger[_0x0103('0xb')](_0x0103('0xc'),_0x449393,_0x0103('0xd'));logger[_0x0103('0xe')](_0x0103('0xf'),_0x449393,'request\x20sent',JSON[_0x0103('0x10')](_0x5dfbb9));if(_0x5dfbb9[_0x0103('0x11')]){if(_0x5dfbb9[_0x0103('0x11')][_0x0103('0x12')]===0x1f4){logger['error'](_0x0103('0xc'),_0x449393,_0x5dfbb9[_0x0103('0x11')][_0x0103('0x13')]);return _0x40cb1b(_0x5dfbb9[_0x0103('0x11')][_0x0103('0x13')]);}logger[_0x0103('0x11')](_0x0103('0xc'),_0x449393,_0x5dfbb9['error'][_0x0103('0x13')]);return _0x1a2ec6(_0x5dfbb9[_0x0103('0x11')][_0x0103('0x13')]);}else{logger[_0x0103('0xb')](_0x0103('0xc'),_0x449393,_0x0103('0xd'));_0x1a2ec6(_0x5dfbb9[_0x0103('0x14')][_0x0103('0x13')]);}})[_0x0103('0x15')](function(_0x1ab6b1){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x449393,_0x1ab6b1);_0x40cb1b(_0x1ab6b1);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 831ff44..ad0a82b 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 _0x30ff=['/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations'];(function(_0x2b7675,_0x5969c9){var _0x4c4f97=function(_0x233188){while(--_0x233188){_0x2b7675['push'](_0x2b7675['shift']());}};_0x4c4f97(++_0x5969c9);}(_0x30ff,0x6a));var _0xf30f=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x30ff[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0xf30f('0x0'));var path=require(_0xf30f('0x1'));var timeout=require(_0xf30f('0x2'));var express=require(_0xf30f('0x3'));var router=express[_0xf30f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf30f('0x5'));var interaction=require(_0xf30f('0x6'));var config=require('../../config/environment');var controller=require(_0xf30f('0x7'));router[_0xf30f('0x8')]('/',auth[_0xf30f('0x9')](),controller['index']);router[_0xf30f('0x8')](_0xf30f('0xa'),auth[_0xf30f('0x9')](),controller[_0xf30f('0xb')]);router['get'](_0xf30f('0xc'),auth[_0xf30f('0x9')](),controller[_0xf30f('0xd')]);router[_0xf30f('0x8')](_0xf30f('0xe'),auth[_0xf30f('0x9')](),controller[_0xf30f('0xf')]);router[_0xf30f('0x10')]('/',auth[_0xf30f('0x9')](),controller[_0xf30f('0x11')]);router[_0xf30f('0x10')](_0xf30f('0xc'),auth['isAuthenticated'](),controller[_0xf30f('0x12')]);router[_0xf30f('0x13')](_0xf30f('0xa'),auth['isAuthenticated'](),controller[_0xf30f('0x14')]);router[_0xf30f('0x15')](_0xf30f('0xa'),auth['isAuthenticated'](),controller[_0xf30f('0x16')]);module[_0xf30f('0x17')]=router; \ No newline at end of file +var _0xbed7=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0xe23713,_0x419a1b){var _0x1ac7ce=function(_0x2f51c2){while(--_0x2f51c2){_0xe23713['push'](_0xe23713['shift']());}};_0x1ac7ce(++_0x419a1b);}(_0xbed7,0x14b));var _0x7bed=function(_0x48d269,_0x426d6f){_0x48d269=_0x48d269-0x0;var _0x360598=_0xbed7[_0x48d269];return _0x360598;};'use strict';var multer=require(_0x7bed('0x0'));var util=require(_0x7bed('0x1'));var path=require(_0x7bed('0x2'));var timeout=require(_0x7bed('0x3'));var express=require(_0x7bed('0x4'));var router=express['Router']();var fs_extra=require(_0x7bed('0x5'));var auth=require(_0x7bed('0x6'));var interaction=require(_0x7bed('0x7'));var config=require(_0x7bed('0x8'));var controller=require(_0x7bed('0x9'));router[_0x7bed('0xa')]('/',auth[_0x7bed('0xb')](),controller[_0x7bed('0xc')]);router[_0x7bed('0xa')]('/:id',auth[_0x7bed('0xb')](),controller[_0x7bed('0xd')]);router['get'](_0x7bed('0xe'),auth[_0x7bed('0xb')](),controller['getConfigurations']);router[_0x7bed('0xa')](_0x7bed('0xf'),auth['isAuthenticated'](),controller[_0x7bed('0x10')]);router[_0x7bed('0x11')]('/',auth[_0x7bed('0xb')](),controller[_0x7bed('0x12')]);router['post'](_0x7bed('0xe'),auth[_0x7bed('0xb')](),controller[_0x7bed('0x13')]);router[_0x7bed('0x14')](_0x7bed('0x15'),auth[_0x7bed('0xb')](),controller['update']);router[_0x7bed('0x16')](_0x7bed('0x15'),auth[_0x7bed('0xb')](),controller[_0x7bed('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 0f8a645..29301bd 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 _0xe453=['HelpDesk','STRING'];(function(_0x301536,_0x1249d8){var _0x182bb0=function(_0x2cdd67){while(--_0x2cdd67){_0x301536['push'](_0x301536['shift']());}};_0x182bb0(++_0x1249d8);}(_0xe453,0x157));var _0x3e45=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xe453[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3e45('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x3e45('0x0')]},'username':{'type':Sequelize[_0x3e45('0x0')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x3e45('0x0')],'allowNull':![],'defaultValue':_0x3e45('0x1')},'remoteUri':{'type':Sequelize[_0x3e45('0x0')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x3e45('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0xc50f=['exports','STRING','HelpDesk'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc50f,0x66));var _0xfc50=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xc50f[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require('sequelize');module[_0xfc50('0x0')]={'name':{'type':Sequelize[_0xfc50('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xfc50('0x1')]},'username':{'type':Sequelize[_0xfc50('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xfc50('0x1')],'allowNull':![],'defaultValue':_0xfc50('0x2')},'remoteUri':{'type':Sequelize[_0xfc50('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 2635e60..57eee23 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 _0x089f=['picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','then','destroy','error','stack','name','send','index','VtigerAccount','fieldName','key','model','map','query','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','catch','show','params','keys','rawAttributes','filters','find','create','update','body','getConfigurations','findOne','VtigerConfiguration','order','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','getFields','username','remoteUri','accessKey','moduleName','slice','format','%s/webservice.php','getchallenge','success','POST','result','token','sessionName','autogenerated','includes','editable','false','label','startsWith'];(function(_0x1a0ef3,_0x535bbf){var _0x2b86da=function(_0x5d30f9){while(--_0x5d30f9){_0x1a0ef3['push'](_0x1a0ef3['shift']());}};_0x2b86da(++_0x535bbf);}(_0x089f,0x7a));var _0xf089=function(_0x8fc20f,_0x299ee6){_0x8fc20f=_0x8fc20f-0x0;var _0x3edc46=_0x089f[_0x8fc20f];return _0x3edc46;};'use strict';var emlformat=require(_0xf089('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf089('0x1'));var jsonpatch=require(_0xf089('0x2'));var rp=require(_0xf089('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf089('0x4'));var util=require(_0xf089('0x5'));var path=require(_0xf089('0x6'));var sox=require(_0xf089('0x7'));var csv=require(_0xf089('0x8'));var ejs=require(_0xf089('0x9'));var fs=require('fs');var fs_extra=require(_0xf089('0xa'));var _=require('lodash');var squel=require(_0xf089('0xb'));var crypto=require(_0xf089('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf089('0xd'));var toCsv=require(_0xf089('0x8'));var querystring=require(_0xf089('0xe'));var Papa=require(_0xf089('0xf'));var Redis=require(_0xf089('0x10'));var authService=require(_0xf089('0x11'));var qs=require(_0xf089('0x12'));var as=require(_0xf089('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf089('0x14'));var config=require(_0xf089('0x15'));var licenseUtil=require(_0xf089('0x16'));var db=require(_0xf089('0x17'))['db'];var integrations=require(_0xf089('0x18'));function respondWithStatusCode(_0x3743a9,_0x37b276){_0x37b276=_0x37b276||0xcc;return function(_0x43fab9){if(_0x43fab9){return _0x3743a9[_0xf089('0x19')](_0x37b276);}return _0x3743a9['status'](_0x37b276)[_0xf089('0x1a')]();};}function respondWithResult(_0x2ecbd3,_0x8dfee4){_0x8dfee4=_0x8dfee4||0xc8;return function(_0x4a63f6){if(_0x4a63f6){return _0x2ecbd3[_0xf089('0x1b')](_0x8dfee4)[_0xf089('0x1c')](_0x4a63f6);}};}function respondWithFilteredResult(_0x4866ad,_0x33a53a){return function(_0x194445){if(_0x194445){var _0x4084cf=typeof _0x33a53a['offset']===_0xf089('0x1d')&&typeof _0x33a53a[_0xf089('0x1e')]===_0xf089('0x1d');var _0x1aa048=_0x194445[_0xf089('0x1f')];var _0x2d49d0=_0x4084cf?0x0:_0x33a53a[_0xf089('0x20')];var _0x204073=_0x4084cf?_0x194445['count']:_0x33a53a[_0xf089('0x20')]+_0x33a53a[_0xf089('0x1e')];var _0x516e5c;if(_0x204073>=_0x1aa048){_0x204073=_0x1aa048;_0x516e5c=0xc8;}else{_0x516e5c=0xce;}_0x4866ad['status'](_0x516e5c);return _0x4866ad[_0xf089('0x21')](_0xf089('0x22'),_0x2d49d0+'-'+_0x204073+'/'+_0x1aa048)[_0xf089('0x1c')](_0x194445);}return null;};}function patchUpdates(_0xaec940){return function(_0x480c66){try{jsonpatch[_0xf089('0x23')](_0x480c66,_0xaec940,!![]);}catch(_0x1ce3ac){return BPromise['reject'](_0x1ce3ac);}return _0x480c66['save']();};}function saveUpdates(_0x5a9574,_0x135c23){return function(_0x4fef1d){if(_0x4fef1d){return _0x4fef1d['update'](_0x5a9574)[_0xf089('0x24')](function(_0x529145){return _0x529145;});}return null;};}function removeEntity(_0x51c39c,_0x3ab482){return function(_0x3f97b9){if(_0x3f97b9){return _0x3f97b9[_0xf089('0x25')]()[_0xf089('0x24')](function(){_0x51c39c[_0xf089('0x1b')](0xcc)[_0xf089('0x1a')]();});}};}function handleEntityNotFound(_0x5b4582,_0x1f9a06){return function(_0x5cb3b9){if(!_0x5cb3b9){_0x5b4582[_0xf089('0x19')](0x194);}return _0x5cb3b9;};}function handleError(_0x2d7639,_0x33e7f4){_0x33e7f4=_0x33e7f4||0x1f4;return function(_0x3f76ef){logger[_0xf089('0x26')](_0x3f76ef[_0xf089('0x27')]);if(_0x3f76ef[_0xf089('0x28')]){delete _0x3f76ef[_0xf089('0x28')];}_0x2d7639['status'](_0x33e7f4)[_0xf089('0x29')](_0x3f76ef);};}exports[_0xf089('0x2a')]=function(_0x22d96d,_0x162852){var _0x2ab9f5={},_0x3f0af3={},_0x5e6114={'count':0x0,'rows':[]};var _0x1cf7f8=_['map'](db[_0xf089('0x2b')]['rawAttributes'],function(_0x2fa8d8){return{'name':_0x2fa8d8[_0xf089('0x2c')],'type':_0x2fa8d8['type'][_0xf089('0x2d')]};});_0x3f0af3[_0xf089('0x2e')]=_[_0xf089('0x2f')](_0x1cf7f8,_0xf089('0x28'));_0x3f0af3[_0xf089('0x30')]=_['keys'](_0x22d96d['query']);_0x3f0af3['filters']=_[_0xf089('0x31')](_0x3f0af3['model'],_0x3f0af3[_0xf089('0x30')]);_0x2ab9f5[_0xf089('0x32')]=_[_0xf089('0x31')](_0x3f0af3[_0xf089('0x2e')],qs[_0xf089('0x33')](_0x22d96d[_0xf089('0x30')][_0xf089('0x33')]));_0x2ab9f5[_0xf089('0x32')]=_0x2ab9f5['attributes'][_0xf089('0x34')]?_0x2ab9f5[_0xf089('0x32')]:_0x3f0af3[_0xf089('0x2e')];if(!_0x22d96d[_0xf089('0x30')]['hasOwnProperty'](_0xf089('0x35'))){_0x2ab9f5[_0xf089('0x1e')]=qs[_0xf089('0x1e')](_0x22d96d['query'][_0xf089('0x1e')]);_0x2ab9f5[_0xf089('0x20')]=qs[_0xf089('0x20')](_0x22d96d[_0xf089('0x30')][_0xf089('0x20')]);}_0x2ab9f5['order']=qs[_0xf089('0x36')](_0x22d96d[_0xf089('0x30')]['sort']);_0x2ab9f5[_0xf089('0x37')]=qs['filters'](_[_0xf089('0x38')](_0x22d96d['query'],_0x3f0af3['filters']),_0x1cf7f8);if(_0x22d96d['query'][_0xf089('0x39')]){_0x2ab9f5[_0xf089('0x37')]=_[_0xf089('0x3a')](_0x2ab9f5['where'],{'$or':_[_0xf089('0x2f')](_0x1cf7f8,function(_0x219f8c){if(_0x219f8c[_0xf089('0x3b')]!==_0xf089('0x3c')){var _0x574e93={};_0x574e93[_0x219f8c[_0xf089('0x28')]]={'$like':'%'+_0x22d96d[_0xf089('0x30')][_0xf089('0x39')]+'%'};return _0x574e93;}})});}_0x2ab9f5=_[_0xf089('0x3a')]({},_0x2ab9f5,_0x22d96d[_0xf089('0x3d')]);var _0x2385cc={'where':_0x2ab9f5['where']};return db[_0xf089('0x2b')][_0xf089('0x1f')](_0x2385cc)['then'](function(_0x1112bc){_0x5e6114['count']=_0x1112bc;if(_0x22d96d['query']['includeAll']){_0x2ab9f5['include']=[{'all':!![]}];}return db[_0xf089('0x2b')]['findAll'](_0x2ab9f5);})[_0xf089('0x24')](function(_0x5233d5){_0x5e6114['rows']=_0x5233d5;return _0x5e6114;})[_0xf089('0x24')](respondWithFilteredResult(_0x162852,_0x2ab9f5))[_0xf089('0x3e')](handleError(_0x162852,null));};exports[_0xf089('0x3f')]=function(_0x51bad4,_0x11b550){var _0x5a41c8={'raw':![],'where':{'id':_0x51bad4[_0xf089('0x40')]['id']}},_0x493eb6={};_0x493eb6[_0xf089('0x2e')]=_[_0xf089('0x41')](db[_0xf089('0x2b')][_0xf089('0x42')]);_0x493eb6[_0xf089('0x30')]=_[_0xf089('0x41')](_0x51bad4[_0xf089('0x30')]);_0x493eb6[_0xf089('0x43')]=_[_0xf089('0x31')](_0x493eb6[_0xf089('0x2e')],_0x493eb6['query']);_0x5a41c8[_0xf089('0x32')]=_['intersection'](_0x493eb6[_0xf089('0x2e')],qs['fields'](_0x51bad4[_0xf089('0x30')][_0xf089('0x33')]));_0x5a41c8[_0xf089('0x32')]=_0x5a41c8['attributes'][_0xf089('0x34')]?_0x5a41c8[_0xf089('0x32')]:_0x493eb6[_0xf089('0x2e')];if(_0x51bad4[_0xf089('0x30')]['includeAll']){_0x5a41c8['include']=[{'all':!![]}];}_0x5a41c8=_[_0xf089('0x3a')]({},_0x5a41c8,_0x51bad4[_0xf089('0x3d')]);return db[_0xf089('0x2b')][_0xf089('0x44')](_0x5a41c8)[_0xf089('0x24')](handleEntityNotFound(_0x11b550,null))[_0xf089('0x24')](respondWithResult(_0x11b550,null))[_0xf089('0x3e')](handleError(_0x11b550,null));};exports[_0xf089('0x45')]=function(_0x64f8bf,_0x9f8110){return db[_0xf089('0x2b')][_0xf089('0x45')](_0x64f8bf['body'],{})['then'](respondWithResult(_0x9f8110,0xc9))['catch'](handleError(_0x9f8110,null));};exports[_0xf089('0x46')]=function(_0x422029,_0x5203e3){if(_0x422029['body']['id']){delete _0x422029[_0xf089('0x47')]['id'];}return db[_0xf089('0x2b')]['find']({'where':{'id':_0x422029[_0xf089('0x40')]['id']}})[_0xf089('0x24')](handleEntityNotFound(_0x5203e3,null))['then'](saveUpdates(_0x422029['body'],null))[_0xf089('0x24')](respondWithResult(_0x5203e3,null))[_0xf089('0x3e')](handleError(_0x5203e3,null));};exports[_0xf089('0x25')]=function(_0xaec603,_0x308de2){return db['VtigerAccount'][_0xf089('0x44')]({'where':{'id':_0xaec603['params']['id']}})[_0xf089('0x24')](handleEntityNotFound(_0x308de2,null))[_0xf089('0x24')](removeEntity(_0x308de2,null))[_0xf089('0x3e')](handleError(_0x308de2,null));};exports[_0xf089('0x48')]=function(_0x6861aa,_0xa5a769,_0x21e903){var _0x5e7864={};var _0x3fa169={};var _0x42f197;var _0x5448d8;return db[_0xf089('0x2b')][_0xf089('0x49')]({'where':{'id':_0x6861aa[_0xf089('0x40')]['id']}})[_0xf089('0x24')](handleEntityNotFound(_0xa5a769,null))[_0xf089('0x24')](function(_0x270bbe){if(_0x270bbe){_0x42f197=_0x270bbe;_0x3fa169['model']=_[_0xf089('0x41')](db[_0xf089('0x4a')][_0xf089('0x42')]);_0x3fa169['query']=_[_0xf089('0x41')](_0x6861aa[_0xf089('0x30')]);_0x3fa169[_0xf089('0x43')]=_[_0xf089('0x31')](_0x3fa169[_0xf089('0x2e')],_0x3fa169['query']);_0x5e7864['attributes']=_['intersection'](_0x3fa169[_0xf089('0x2e')],qs[_0xf089('0x33')](_0x6861aa[_0xf089('0x30')][_0xf089('0x33')]));_0x5e7864['attributes']=_0x5e7864[_0xf089('0x32')][_0xf089('0x34')]?_0x5e7864[_0xf089('0x32')]:_0x3fa169[_0xf089('0x2e')];_0x5e7864[_0xf089('0x4b')]=qs['sort'](_0x6861aa[_0xf089('0x30')][_0xf089('0x36')]);_0x5e7864[_0xf089('0x37')]=qs[_0xf089('0x43')](_[_0xf089('0x38')](_0x6861aa[_0xf089('0x30')],_0x3fa169[_0xf089('0x43')]));if(_0x6861aa[_0xf089('0x30')]['filter']){_0x5e7864[_0xf089('0x37')]=_[_0xf089('0x3a')](_0x5e7864['where'],{'$or':_[_0xf089('0x2f')](_0x5e7864[_0xf089('0x32')],function(_0x1f6f08){var _0x33aa1c={};_0x33aa1c[_0x1f6f08]={'$like':'%'+_0x6861aa['query'][_0xf089('0x39')]+'%'};return _0x33aa1c;})});}_0x5e7864=_[_0xf089('0x3a')]({},_0x5e7864,_0x6861aa[_0xf089('0x3d')]);return _0x42f197['getConfigurations'](_0x5e7864);}})[_0xf089('0x24')](function(_0x4feff7){if(_0x4feff7){_0x5448d8=_0x4feff7[_0xf089('0x34')];if(!_0x6861aa[_0xf089('0x30')][_0xf089('0x4c')](_0xf089('0x35'))){_0x5e7864[_0xf089('0x1e')]=qs[_0xf089('0x1e')](_0x6861aa['query'][_0xf089('0x1e')]);_0x5e7864[_0xf089('0x20')]=qs['offset'](_0x6861aa[_0xf089('0x30')][_0xf089('0x20')]);}return _0x42f197[_0xf089('0x48')](_0x5e7864);}})['then'](function(_0x275303){if(_0x275303){return _0x275303?{'count':_0x5448d8,'rows':_0x275303}:null;}})[_0xf089('0x24')](respondWithResult(_0xa5a769,null))['catch'](handleError(_0xa5a769,null));};exports['addConfiguration']=function(_0x22269f,_0x306e43,_0x244456){if(_0x22269f['body']['id']){delete _0x22269f[_0xf089('0x47')]['id'];}return db['VtigerAccount'][_0xf089('0x49')]({'where':{'id':_0x22269f[_0xf089('0x40')]['id']}})[_0xf089('0x24')](handleEntityNotFound(_0x306e43,null))[_0xf089('0x24')](function(_0x1796cb){if(_0x1796cb){_0x22269f[_0xf089('0x47')][_0xf089('0x4d')]=_0x1796cb['id'];_0x22269f[_0xf089('0x47')][_0xf089('0x4e')]=integrations[_0xf089('0x4f')](_0x22269f[_0xf089('0x47')][_0xf089('0x50')],_0x22269f[_0xf089('0x47')][_0xf089('0x3b')]);_0x22269f[_0xf089('0x47')][_0xf089('0x51')]=integrations[_0xf089('0x52')](_0x22269f['body'][_0xf089('0x50')],_0x22269f[_0xf089('0x47')][_0xf089('0x3b')]);return db[_0xf089('0x4a')][_0xf089('0x45')](_0x22269f['body'],{'include':[{'model':db[_0xf089('0x53')],'as':'Subjects'},{'model':db[_0xf089('0x53')],'as':_0xf089('0x51')}]});}return null;})[_0xf089('0x24')](respondWithResult(_0x306e43,null))[_0xf089('0x3e')](handleError(_0x306e43,null));};var md5=require('md5');exports[_0xf089('0x54')]=function(_0x32afa2,_0x1f06bb,_0x35c8ec){var _0x4bc3fc=null;var _0x1af2ec=null;var _0x2f5c0=null;var _0x4249ac=null;var _0x2d3589='';return db['VtigerAccount']['findOne']({'where':{'id':_0x32afa2[_0xf089('0x40')]['id']},'attributes':['id',_0xf089('0x28'),_0xf089('0x55'),'description','moduleName',_0xf089('0x56'),'serverUrl',_0xf089('0x57')]})[_0xf089('0x24')](handleEntityNotFound(_0x1f06bb,null))[_0xf089('0x24')](function(_0x2a8f06){if(_0x2a8f06){_0x4bc3fc=_0x2a8f06[_0xf089('0x55')];_0x1af2ec=_0x2a8f06[_0xf089('0x57')];_0x2f5c0=_0x2a8f06[_0xf089('0x58')];_0x2d3589=_0x2a8f06[_0xf089('0x56')];var _0x295719=_0x2d3589[_0xf089('0x59')](-0x1);if(_0x295719==='/'){_0x2d3589=_0x2d3589['substring'](0x0,_0x2d3589['lastIndexOf'](_0x295719));}_0x4249ac=util[_0xf089('0x5a')](_0xf089('0x5b'),_0x2d3589);var _0x2983c6={'method':'GET','uri':_0x4249ac,'qs':{'operation':_0xf089('0x5c'),'username':_0x2a8f06[_0xf089('0x55')]},'json':!![]};return rp(_0x2983c6);}})[_0xf089('0x24')](function(_0x51dc6c){if(_0x51dc6c[_0xf089('0x5d')]){var _0x136086={'method':_0xf089('0x5e'),'uri':_0x4249ac,'form':{'operation':'login','username':_0x4bc3fc,'accessKey':md5(_0x51dc6c[_0xf089('0x5f')][_0xf089('0x60')]+_0x1af2ec)},'json':!![]};return rp(_0x136086);}})[_0xf089('0x24')](function(_0x315ea5){if(_0x315ea5[_0xf089('0x5d')]){var _0x142e24={'method':'GET','uri':_0x4249ac,'qs':{'operation':'describe','username':_0x4bc3fc,'sessionName':_0x315ea5['result'][_0xf089('0x61')],'elementType':_0x2f5c0},'json':!![]};return rp(_0x142e24);}})['then'](function(_0x59b3f8){if(_0x59b3f8[_0xf089('0x5d')]){var _0x4e5f4a=[_0xf089('0x62'),'reference','owner'];_['remove'](_0x59b3f8[_0xf089('0x5f')]['fields'],function(_0x2087ba){return _0x4e5f4a[_0xf089('0x63')](_0x2087ba[_0xf089('0x3b')][_0xf089('0x28')]);});_['remove'](_0x59b3f8[_0xf089('0x5f')][_0xf089('0x33')],function(_0x833022){return _0x833022[_0xf089('0x64')]===_0xf089('0x65');});return{'count':_0x59b3f8[_0xf089('0x5f')]['fields'][_0xf089('0x34')],'rows':_[_0xf089('0x2f')](_0x59b3f8[_0xf089('0x5f')][_0xf089('0x33')],function(_0x1833b8){return{'id':_0x1833b8[_0xf089('0x28')],'name':_0x1833b8[_0xf089('0x66')],'custom':_[_0xf089('0x67')](_0x1833b8['name'],'cf_')?!![]:![],'options':_0x1833b8['type'][_0xf089('0x28')]===_0xf089('0x68')&&_0x1833b8['type'][_0xf089('0x69')][_0xf089('0x34')]>0x0?_['map'](_0x1833b8[_0xf089('0x3b')][_0xf089('0x69')],function(_0xfefb60){return{'name':_0xfefb60['label'],'value':_0xfefb60[_0xf089('0x6a')]};}):[]};})};}})[_0xf089('0x24')](respondWithResult(_0x1f06bb,null))[_0xf089('0x3e')](function(_0x3ce7c0){console[_0xf089('0x6b')](_0xf089('0x6c')+_0x3ce7c0);var _0x2bb97d=_0x32afa2[_0xf089('0x30')][_0xf089('0x6d')]?0x1f4:_0x3ce7c0[_0xf089('0x6e')]||0x1f4;logger[_0xf089('0x26')](_0xf089('0x6f'),_0xf089('0x54'),_0x2bb97d,JSON['stringify'](_0x3ce7c0));delete _0x3ce7c0[_0xf089('0x28')];if(_0x2bb97d===0x191){_0x2bb97d=0x190;}_0x1f06bb[_0xf089('0x1b')](_0x2bb97d)[_0xf089('0x29')](_0x32afa2[_0xf089('0x30')][_0xf089('0x6d')]?{'message':_0xf089('0x70'),'statusCode':_0x3ce7c0[_0xf089('0x6e')]}:_0x3ce7c0);});}; \ No newline at end of file +var _0x0435=['remoteUri','serverUrl','username','accessKey','slice','substring','lastIndexOf','%s/webservice.php','getchallenge','success','POST','login','result','GET','describe','sessionName','autogenerated','owner','remove','editable','false','startsWith','cf_','label','log','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','zip-dir','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','name','index','VtigerAccount','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','keys','length','create','body','find','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','description','moduleName'];(function(_0x310043,_0x435e95){var _0x43283d=function(_0x247ab8){while(--_0x247ab8){_0x310043['push'](_0x310043['shift']());}};_0x43283d(++_0x435e95);}(_0x0435,0x17c));var _0x5043=function(_0x1e6e4e,_0x2b1b09){_0x1e6e4e=_0x1e6e4e-0x0;var _0x3d746b=_0x0435[_0x1e6e4e];return _0x3d746b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5043('0x0'));var jsonpatch=require(_0x5043('0x1'));var rp=require(_0x5043('0x2'));var moment=require(_0x5043('0x3'));var BPromise=require(_0x5043('0x4'));var Mustache=require(_0x5043('0x5'));var util=require(_0x5043('0x6'));var path=require('path');var sox=require(_0x5043('0x7'));var csv=require(_0x5043('0x8'));var ejs=require(_0x5043('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5043('0xa'));var crypto=require(_0x5043('0xb'));var jsforce=require(_0x5043('0xc'));var deskjs=require(_0x5043('0xd'));var toCsv=require(_0x5043('0x8'));var querystring=require(_0x5043('0xe'));var Papa=require(_0x5043('0xf'));var Redis=require(_0x5043('0x10'));var authService=require(_0x5043('0x11'));var qs=require(_0x5043('0x12'));var as=require(_0x5043('0x13'));var hardwareService=require(_0x5043('0x14'));var logger=require(_0x5043('0x15'))(_0x5043('0x16'));var utils=require(_0x5043('0x17'));var config=require(_0x5043('0x18'));var licenseUtil=require(_0x5043('0x19'));var db=require(_0x5043('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x46f530,_0xd223c8){_0xd223c8=_0xd223c8||0xcc;return function(_0x2a4991){if(_0x2a4991){return _0x46f530[_0x5043('0x1b')](_0xd223c8);}return _0x46f530[_0x5043('0x1c')](_0xd223c8)['end']();};}function respondWithResult(_0x17ed58,_0x402d47){_0x402d47=_0x402d47||0xc8;return function(_0x113b56){if(_0x113b56){return _0x17ed58[_0x5043('0x1c')](_0x402d47)['json'](_0x113b56);}};}function respondWithFilteredResult(_0x3632b2,_0xda4381){return function(_0x16f648){if(_0x16f648){var _0x534d39=typeof _0xda4381[_0x5043('0x1d')]==='undefined'&&typeof _0xda4381[_0x5043('0x1e')]===_0x5043('0x1f');var _0x97f863=_0x16f648[_0x5043('0x20')];var _0x499481=_0x534d39?0x0:_0xda4381['offset'];var _0x26c942=_0x534d39?_0x16f648[_0x5043('0x20')]:_0xda4381[_0x5043('0x1d')]+_0xda4381[_0x5043('0x1e')];var _0xd5812;if(_0x26c942>=_0x97f863){_0x26c942=_0x97f863;_0xd5812=0xc8;}else{_0xd5812=0xce;}_0x3632b2[_0x5043('0x1c')](_0xd5812);return _0x3632b2[_0x5043('0x21')](_0x5043('0x22'),_0x499481+'-'+_0x26c942+'/'+_0x97f863)['json'](_0x16f648);}return null;};}function patchUpdates(_0x4fd39f){return function(_0x4d8fe1){try{jsonpatch[_0x5043('0x23')](_0x4d8fe1,_0x4fd39f,!![]);}catch(_0x1af94f){return BPromise[_0x5043('0x24')](_0x1af94f);}return _0x4d8fe1['save']();};}function saveUpdates(_0x420c4b,_0x10dbd8){return function(_0x2019ef){if(_0x2019ef){return _0x2019ef[_0x5043('0x25')](_0x420c4b)[_0x5043('0x26')](function(_0x5ae8d2){return _0x5ae8d2;});}return null;};}function removeEntity(_0x535582,_0x249f04){return function(_0x561dbc){if(_0x561dbc){return _0x561dbc[_0x5043('0x27')]()[_0x5043('0x26')](function(){_0x535582[_0x5043('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a31f4,_0x53e749){return function(_0x226903){if(!_0x226903){_0x3a31f4[_0x5043('0x1b')](0x194);}return _0x226903;};}function handleError(_0x27a50f,_0x1e4672){_0x1e4672=_0x1e4672||0x1f4;return function(_0x5565d4){logger[_0x5043('0x28')](_0x5565d4['stack']);if(_0x5565d4[_0x5043('0x29')]){delete _0x5565d4['name'];}_0x27a50f['status'](_0x1e4672)['send'](_0x5565d4);};}exports[_0x5043('0x2a')]=function(_0x1d9305,_0x37c3f8){var _0x44eec3={},_0x21388f={},_0x300019={'count':0x0,'rows':[]};var _0x38af90=_['map'](db[_0x5043('0x2b')][_0x5043('0x2c')],function(_0x1e4aa7){return{'name':_0x1e4aa7['fieldName'],'type':_0x1e4aa7[_0x5043('0x2d')][_0x5043('0x2e')]};});_0x21388f['model']=_['map'](_0x38af90,'name');_0x21388f[_0x5043('0x2f')]=_['keys'](_0x1d9305[_0x5043('0x2f')]);_0x21388f[_0x5043('0x30')]=_[_0x5043('0x31')](_0x21388f[_0x5043('0x32')],_0x21388f[_0x5043('0x2f')]);_0x44eec3[_0x5043('0x33')]=_[_0x5043('0x31')](_0x21388f['model'],qs[_0x5043('0x34')](_0x1d9305[_0x5043('0x2f')][_0x5043('0x34')]));_0x44eec3['attributes']=_0x44eec3['attributes']['length']?_0x44eec3['attributes']:_0x21388f['model'];if(!_0x1d9305[_0x5043('0x2f')][_0x5043('0x35')](_0x5043('0x36'))){_0x44eec3[_0x5043('0x1e')]=qs[_0x5043('0x1e')](_0x1d9305[_0x5043('0x2f')][_0x5043('0x1e')]);_0x44eec3[_0x5043('0x1d')]=qs[_0x5043('0x1d')](_0x1d9305[_0x5043('0x2f')][_0x5043('0x1d')]);}_0x44eec3[_0x5043('0x37')]=qs[_0x5043('0x38')](_0x1d9305[_0x5043('0x2f')][_0x5043('0x38')]);_0x44eec3[_0x5043('0x39')]=qs[_0x5043('0x30')](_['pick'](_0x1d9305[_0x5043('0x2f')],_0x21388f[_0x5043('0x30')]),_0x38af90);if(_0x1d9305['query'][_0x5043('0x3a')]){_0x44eec3[_0x5043('0x39')]=_['merge'](_0x44eec3[_0x5043('0x39')],{'$or':_[_0x5043('0x3b')](_0x38af90,function(_0x289570){if(_0x289570[_0x5043('0x2d')]!==_0x5043('0x3c')){var _0x411c95={};_0x411c95[_0x289570[_0x5043('0x29')]]={'$like':'%'+_0x1d9305['query'][_0x5043('0x3a')]+'%'};return _0x411c95;}})});}_0x44eec3=_[_0x5043('0x3d')]({},_0x44eec3,_0x1d9305[_0x5043('0x3e')]);var _0x45f6de={'where':_0x44eec3[_0x5043('0x39')]};return db['VtigerAccount']['count'](_0x45f6de)[_0x5043('0x26')](function(_0x39cc3){_0x300019[_0x5043('0x20')]=_0x39cc3;if(_0x1d9305[_0x5043('0x2f')][_0x5043('0x3f')]){_0x44eec3[_0x5043('0x40')]=[{'all':!![]}];}return db[_0x5043('0x2b')][_0x5043('0x41')](_0x44eec3);})[_0x5043('0x26')](function(_0x1a9843){_0x300019['rows']=_0x1a9843;return _0x300019;})['then'](respondWithFilteredResult(_0x37c3f8,_0x44eec3))[_0x5043('0x42')](handleError(_0x37c3f8,null));};exports['show']=function(_0xc8ab07,_0x4f1708){var _0x2bb9ec={'raw':![],'where':{'id':_0xc8ab07[_0x5043('0x43')]['id']}},_0x36b773={};_0x36b773[_0x5043('0x32')]=_[_0x5043('0x44')](db[_0x5043('0x2b')]['rawAttributes']);_0x36b773['query']=_[_0x5043('0x44')](_0xc8ab07['query']);_0x36b773['filters']=_[_0x5043('0x31')](_0x36b773[_0x5043('0x32')],_0x36b773[_0x5043('0x2f')]);_0x2bb9ec[_0x5043('0x33')]=_['intersection'](_0x36b773['model'],qs[_0x5043('0x34')](_0xc8ab07[_0x5043('0x2f')][_0x5043('0x34')]));_0x2bb9ec['attributes']=_0x2bb9ec['attributes'][_0x5043('0x45')]?_0x2bb9ec[_0x5043('0x33')]:_0x36b773[_0x5043('0x32')];if(_0xc8ab07['query'][_0x5043('0x3f')]){_0x2bb9ec[_0x5043('0x40')]=[{'all':!![]}];}_0x2bb9ec=_[_0x5043('0x3d')]({},_0x2bb9ec,_0xc8ab07['options']);return db[_0x5043('0x2b')]['find'](_0x2bb9ec)[_0x5043('0x26')](handleEntityNotFound(_0x4f1708,null))[_0x5043('0x26')](respondWithResult(_0x4f1708,null))[_0x5043('0x42')](handleError(_0x4f1708,null));};exports[_0x5043('0x46')]=function(_0x4df89d,_0x538136){return db[_0x5043('0x2b')][_0x5043('0x46')](_0x4df89d['body'],{})[_0x5043('0x26')](respondWithResult(_0x538136,0xc9))['catch'](handleError(_0x538136,null));};exports[_0x5043('0x25')]=function(_0x19ff26,_0x109861){if(_0x19ff26[_0x5043('0x47')]['id']){delete _0x19ff26[_0x5043('0x47')]['id'];}return db[_0x5043('0x2b')][_0x5043('0x48')]({'where':{'id':_0x19ff26[_0x5043('0x43')]['id']}})[_0x5043('0x26')](handleEntityNotFound(_0x109861,null))['then'](saveUpdates(_0x19ff26['body'],null))['then'](respondWithResult(_0x109861,null))['catch'](handleError(_0x109861,null));};exports[_0x5043('0x27')]=function(_0x433a6a,_0x54827d){return db[_0x5043('0x2b')]['find']({'where':{'id':_0x433a6a['params']['id']}})[_0x5043('0x26')](handleEntityNotFound(_0x54827d,null))[_0x5043('0x26')](removeEntity(_0x54827d,null))[_0x5043('0x42')](handleError(_0x54827d,null));};exports[_0x5043('0x49')]=function(_0x129b0e,_0x2d0e29,_0x45d971){var _0x58a5c6={};var _0x5bbcde={};var _0x25e35b;var _0x3c48b4;return db['VtigerAccount'][_0x5043('0x4a')]({'where':{'id':_0x129b0e['params']['id']}})[_0x5043('0x26')](handleEntityNotFound(_0x2d0e29,null))['then'](function(_0x3b9bc8){if(_0x3b9bc8){_0x25e35b=_0x3b9bc8;_0x5bbcde[_0x5043('0x32')]=_[_0x5043('0x44')](db[_0x5043('0x4b')][_0x5043('0x2c')]);_0x5bbcde[_0x5043('0x2f')]=_[_0x5043('0x44')](_0x129b0e[_0x5043('0x2f')]);_0x5bbcde[_0x5043('0x30')]=_['intersection'](_0x5bbcde['model'],_0x5bbcde['query']);_0x58a5c6[_0x5043('0x33')]=_[_0x5043('0x31')](_0x5bbcde[_0x5043('0x32')],qs[_0x5043('0x34')](_0x129b0e[_0x5043('0x2f')]['fields']));_0x58a5c6[_0x5043('0x33')]=_0x58a5c6[_0x5043('0x33')]['length']?_0x58a5c6[_0x5043('0x33')]:_0x5bbcde[_0x5043('0x32')];_0x58a5c6[_0x5043('0x37')]=qs[_0x5043('0x38')](_0x129b0e[_0x5043('0x2f')][_0x5043('0x38')]);_0x58a5c6['where']=qs[_0x5043('0x30')](_['pick'](_0x129b0e[_0x5043('0x2f')],_0x5bbcde[_0x5043('0x30')]));if(_0x129b0e['query'][_0x5043('0x3a')]){_0x58a5c6[_0x5043('0x39')]=_[_0x5043('0x3d')](_0x58a5c6[_0x5043('0x39')],{'$or':_['map'](_0x58a5c6['attributes'],function(_0x320d92){var _0xf5a26c={};_0xf5a26c[_0x320d92]={'$like':'%'+_0x129b0e[_0x5043('0x2f')]['filter']+'%'};return _0xf5a26c;})});}_0x58a5c6=_['merge']({},_0x58a5c6,_0x129b0e[_0x5043('0x3e')]);return _0x25e35b[_0x5043('0x49')](_0x58a5c6);}})[_0x5043('0x26')](function(_0x56de2b){if(_0x56de2b){_0x3c48b4=_0x56de2b[_0x5043('0x45')];if(!_0x129b0e[_0x5043('0x2f')][_0x5043('0x35')](_0x5043('0x36'))){_0x58a5c6[_0x5043('0x1e')]=qs[_0x5043('0x1e')](_0x129b0e[_0x5043('0x2f')][_0x5043('0x1e')]);_0x58a5c6[_0x5043('0x1d')]=qs[_0x5043('0x1d')](_0x129b0e[_0x5043('0x2f')][_0x5043('0x1d')]);}return _0x25e35b['getConfigurations'](_0x58a5c6);}})[_0x5043('0x26')](function(_0x5e2893){if(_0x5e2893){return _0x5e2893?{'count':_0x3c48b4,'rows':_0x5e2893}:null;}})['then'](respondWithResult(_0x2d0e29,null))[_0x5043('0x42')](handleError(_0x2d0e29,null));};exports[_0x5043('0x4c')]=function(_0x35e46b,_0x31f8f6,_0x3402e1){if(_0x35e46b['body']['id']){delete _0x35e46b[_0x5043('0x47')]['id'];}return db['VtigerAccount'][_0x5043('0x4a')]({'where':{'id':_0x35e46b[_0x5043('0x43')]['id']}})['then'](handleEntityNotFound(_0x31f8f6,null))['then'](function(_0x3301d8){if(_0x3301d8){_0x35e46b[_0x5043('0x47')][_0x5043('0x4d')]=_0x3301d8['id'];_0x35e46b[_0x5043('0x47')][_0x5043('0x4e')]=integrations[_0x5043('0x4f')](_0x35e46b[_0x5043('0x47')][_0x5043('0x50')],_0x35e46b[_0x5043('0x47')][_0x5043('0x2d')]);_0x35e46b[_0x5043('0x47')][_0x5043('0x51')]=integrations[_0x5043('0x52')](_0x35e46b[_0x5043('0x47')][_0x5043('0x50')],_0x35e46b[_0x5043('0x47')][_0x5043('0x2d')]);return db[_0x5043('0x4b')][_0x5043('0x46')](_0x35e46b['body'],{'include':[{'model':db[_0x5043('0x53')],'as':_0x5043('0x4e')},{'model':db[_0x5043('0x53')],'as':_0x5043('0x51')}]});}return null;})[_0x5043('0x26')](respondWithResult(_0x31f8f6,null))[_0x5043('0x42')](handleError(_0x31f8f6,null));};var md5=require(_0x5043('0x54'));exports[_0x5043('0x55')]=function(_0x516fa3,_0xaf7d9f,_0x5ec66a){var _0x32428d=null;var _0x58d167=null;var _0x4571cf=null;var _0x4d2291=null;var _0x15fd32='';return db[_0x5043('0x2b')][_0x5043('0x4a')]({'where':{'id':_0x516fa3[_0x5043('0x43')]['id']},'attributes':['id','name','username',_0x5043('0x56'),_0x5043('0x57'),_0x5043('0x58'),_0x5043('0x59'),'accessKey']})['then'](handleEntityNotFound(_0xaf7d9f,null))[_0x5043('0x26')](function(_0x2c64a5){if(_0x2c64a5){_0x32428d=_0x2c64a5[_0x5043('0x5a')];_0x58d167=_0x2c64a5[_0x5043('0x5b')];_0x4571cf=_0x2c64a5[_0x5043('0x57')];_0x15fd32=_0x2c64a5['remoteUri'];var _0x4a23b9=_0x15fd32[_0x5043('0x5c')](-0x1);if(_0x4a23b9==='/'){_0x15fd32=_0x15fd32[_0x5043('0x5d')](0x0,_0x15fd32[_0x5043('0x5e')](_0x4a23b9));}_0x4d2291=util['format'](_0x5043('0x5f'),_0x15fd32);var _0x47f6e8={'method':'GET','uri':_0x4d2291,'qs':{'operation':_0x5043('0x60'),'username':_0x2c64a5[_0x5043('0x5a')]},'json':!![]};return rp(_0x47f6e8);}})['then'](function(_0x1319ae){if(_0x1319ae[_0x5043('0x61')]){var _0x4e7889={'method':_0x5043('0x62'),'uri':_0x4d2291,'form':{'operation':_0x5043('0x63'),'username':_0x32428d,'accessKey':md5(_0x1319ae[_0x5043('0x64')]['token']+_0x58d167)},'json':!![]};return rp(_0x4e7889);}})[_0x5043('0x26')](function(_0x3027c5){if(_0x3027c5[_0x5043('0x61')]){var _0x147318={'method':_0x5043('0x65'),'uri':_0x4d2291,'qs':{'operation':_0x5043('0x66'),'username':_0x32428d,'sessionName':_0x3027c5[_0x5043('0x64')][_0x5043('0x67')],'elementType':_0x4571cf},'json':!![]};return rp(_0x147318);}})[_0x5043('0x26')](function(_0x443a1f){if(_0x443a1f[_0x5043('0x61')]){var _0xa2e5f4=[_0x5043('0x68'),'reference',_0x5043('0x69')];_[_0x5043('0x6a')](_0x443a1f[_0x5043('0x64')][_0x5043('0x34')],function(_0x1f7005){return _0xa2e5f4['includes'](_0x1f7005[_0x5043('0x2d')]['name']);});_[_0x5043('0x6a')](_0x443a1f['result'][_0x5043('0x34')],function(_0x2eb20f){return _0x2eb20f[_0x5043('0x6b')]===_0x5043('0x6c');});return{'count':_0x443a1f[_0x5043('0x64')]['fields'][_0x5043('0x45')],'rows':_[_0x5043('0x3b')](_0x443a1f[_0x5043('0x64')][_0x5043('0x34')],function(_0x43ceeb){return{'id':_0x43ceeb[_0x5043('0x29')],'name':_0x43ceeb['label'],'custom':_[_0x5043('0x6d')](_0x43ceeb[_0x5043('0x29')],_0x5043('0x6e'))?!![]:![],'options':_0x43ceeb['type'][_0x5043('0x29')]==='picklist'&&_0x43ceeb[_0x5043('0x2d')]['picklistValues']['length']>0x0?_[_0x5043('0x3b')](_0x43ceeb['type']['picklistValues'],function(_0x4bae77){return{'name':_0x4bae77[_0x5043('0x6f')],'value':_0x4bae77['value']};}):[]};})};}})['then'](respondWithResult(_0xaf7d9f,null))[_0x5043('0x42')](function(_0x11a041){console[_0x5043('0x70')]('vTiger\x20error:\x20'+_0x11a041);var _0x39d74c=_0x516fa3['query'][_0x5043('0x71')]?0x1f4:_0x11a041[_0x5043('0x72')]||0x1f4;logger[_0x5043('0x28')](_0x5043('0x73'),_0x5043('0x55'),_0x39d74c,JSON[_0x5043('0x74')](_0x11a041));delete _0x11a041[_0x5043('0x29')];if(_0x39d74c===0x191){_0x39d74c=0x190;}_0xaf7d9f[_0x5043('0x1c')](_0x39d74c)['send'](_0x516fa3[_0x5043('0x2f')][_0x5043('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x11a041[_0x5043('0x72')]}:_0x11a041);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index eda293a..8a930fd 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 _0x6453=['moment','bluebird','request-promise','path','rimraf','./intVtigerAccount.attributes','exports','define','VtigerAccount','util','../../config/logger'];(function(_0x25bca6,_0xe415ea){var _0x3f8d02=function(_0x3e581b){while(--_0x3e581b){_0x25bca6['push'](_0x25bca6['shift']());}};_0x3f8d02(++_0xe415ea);}(_0x6453,0x148));var _0x3645=function(_0x1b92a6,_0x14444b){_0x1b92a6=_0x1b92a6-0x0;var _0x24be5b=_0x6453[_0x1b92a6];return _0x24be5b;};'use strict';var _=require('lodash');var util=require(_0x3645('0x0'));var logger=require(_0x3645('0x1'))('api');var moment=require(_0x3645('0x2'));var BPromise=require(_0x3645('0x3'));var rp=require(_0x3645('0x4'));var fs=require('fs');var path=require(_0x3645('0x5'));var rimraf=require(_0x3645('0x6'));var config=require('../../config/environment');var attributes=require(_0x3645('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x3645('0x8')]=function(_0x3d3552,_0x23f94d){return _0x3d3552[_0x3645('0x9')](_0x3645('0xa'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda24=['rimraf','../../config/environment','./intVtigerAccount.attributes','define','int_vtiger_accounts','lodash','moment','request-promise','path'];(function(_0x49e3a4,_0x263356){var _0x1e36a5=function(_0x5d427a){while(--_0x5d427a){_0x49e3a4['push'](_0x49e3a4['shift']());}};_0x1e36a5(++_0x263356);}(_0xda24,0x1f4));var _0x4da2=function(_0x585b83,_0x25d403){_0x585b83=_0x585b83-0x0;var _0x2faa24=_0xda24[_0x585b83];return _0x2faa24;};'use strict';var _=require(_0x4da2('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4da2('0x1'));var BPromise=require('bluebird');var rp=require(_0x4da2('0x2'));var fs=require('fs');var path=require(_0x4da2('0x3'));var rimraf=require(_0x4da2('0x4'));var config=require(_0x4da2('0x5'));var attributes=require(_0x4da2('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x554055,_0x489ae2){return _0x554055[_0x4da2('0x7')]('VtigerAccount',attributes,{'tableName':_0x4da2('0x8'),'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 c3ebaf4..fb2679f 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 _0xcb91=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','attributes','include','map','model','then','ShowVtigerAccount','find','where','moment','bluebird','randomstring','ioredis'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x384231,_0x50be41){_0x384231=_0x384231-0x0;var _0x2480bf=_0xcb91[_0x384231];return _0x2480bf;};'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')]('VtigerAccount,\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);});});}exports[_0x1cb9('0x14')]=function(_0x23d3a9){var _0x4e1340=this;return new Promise(function(_0x479d43,_0x1b2fa6){return db[_0x1cb9('0x15')][_0x1cb9('0x16')]({'raw':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x18')]===undefined?!![]:![]:!![],'where':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['where']||null:null,'attributes':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options'][_0x1cb9('0x19')]||null:null,'limit':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['limit']||null:null,'include':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x59ebea){return{'model':db[_0x59ebea['model']],'as':_0x59ebea['as'],'attributes':_0x59ebea[_0x1cb9('0x19')],'include':_0x59ebea['include']?_[_0x1cb9('0x1b')](_0x59ebea[_0x1cb9('0x1a')],function(_0x69b4c8){return{'model':db[_0x69b4c8[_0x1cb9('0x1c')]],'as':_0x69b4c8['as'],'attributes':_0x69b4c8[_0x1cb9('0x19')],'include':_0x69b4c8['include']?_[_0x1cb9('0x1b')](_0x69b4c8[_0x1cb9('0x1a')],function(_0x4c8d76){return{'model':db[_0x4c8d76[_0x1cb9('0x1c')]],'as':_0x4c8d76['as'],'attributes':_0x4c8d76[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x1804fd){logger[_0x1cb9('0xa')](_0x1cb9('0x14'),_0x23d3a9);logger[_0x1cb9('0xd')](_0x1cb9('0x14'),_0x23d3a9,JSON[_0x1cb9('0xf')](_0x1804fd));_0x479d43(_0x1804fd);})[_0x1cb9('0x13')](function(_0x48888d){logger[_0x1cb9('0x10')]('GetVtigerAccount',_0x48888d[_0x1cb9('0x12')],_0x23d3a9);_0x1b2fa6(_0x4e1340['error'](0x1f4,_0x48888d[_0x1cb9('0x12')]));});});};exports[_0x1cb9('0x1e')]=function(_0x3cd7f5){var _0x2038aa=this;return new Promise(function(_0x561d89,_0x1c701f){return db['VtigerAccount'][_0x1cb9('0x1f')]({'raw':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5['options'][_0x1cb9('0x20')]||null:null,'attributes':_0x3cd7f5['options']?_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x19')]||null:null,'include':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['include']?_[_0x1cb9('0x1b')](_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x91a1db){return{'model':db[_0x91a1db[_0x1cb9('0x1c')]],'as':_0x91a1db['as'],'attributes':_0x91a1db[_0x1cb9('0x19')],'include':_0x91a1db[_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x91a1db[_0x1cb9('0x1a')],function(_0x1de287){return{'model':db[_0x1de287[_0x1cb9('0x1c')]],'as':_0x1de287['as'],'attributes':_0x1de287[_0x1cb9('0x19')],'include':_0x1de287[_0x1cb9('0x1a')]?_['map'](_0x1de287['include'],function(_0x299ff8){return{'model':db[_0x299ff8[_0x1cb9('0x1c')]],'as':_0x299ff8['as'],'attributes':_0x299ff8[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x385daa){logger[_0x1cb9('0xa')](_0x1cb9('0x1e'),_0x3cd7f5);logger[_0x1cb9('0xd')]('ShowVtigerAccount',_0x3cd7f5,JSON[_0x1cb9('0xf')](_0x385daa));_0x561d89(_0x385daa);})[_0x1cb9('0x13')](function(_0xefe136){logger['error'](_0x1cb9('0x1e'),_0xefe136['message'],_0x3cd7f5);_0x1c701f(_0x2038aa[_0x1cb9('0x10')](0x1f4,_0xefe136['message']));});});}; \ No newline at end of file +var _0x351d=['findAll','options','attributes','include','map','model','then','catch','ShowVtigerAccount','find','raw','where','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','GetVtigerAccount','VtigerAccount'];(function(_0x57fcf5,_0x471abc){var _0x83a451=function(_0x57ed9e){while(--_0x57ed9e){_0x57fcf5['push'](_0x57fcf5['shift']());}};_0x83a451(++_0x471abc);}(_0x351d,0x90));var _0xd351=function(_0x36db25,_0x260ca3){_0x36db25=_0x36db25-0x0;var _0xfdc90c=_0x351d[_0x36db25];return _0xfdc90c;};'use strict';var _=require(_0xd351('0x0'));var util=require('util');var moment=require(_0xd351('0x1'));var BPromise=require(_0xd351('0x2'));var rs=require(_0xd351('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd351('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd351('0x5'))(_0xd351('0x6'));var config=require('../../config/environment');var jayson=require(_0xd351('0x7'));var client=jayson[_0xd351('0x8')][_0xd351('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5318b2,_0x16b3f7,_0x235aa0){return new BPromise(function(_0x4e1b06,_0x2e9a2a){return client[_0xd351('0xa')](_0x5318b2,_0x235aa0)['then'](function(_0x586c60){logger[_0xd351('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x16b3f7,_0xd351('0xc'));logger[_0xd351('0xd')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x16b3f7,_0xd351('0xc'),JSON[_0xd351('0xe')](_0x586c60));if(_0x586c60['error']){if(_0x586c60[_0xd351('0xf')]['code']===0x1f4){logger['error'](_0xd351('0x10'),_0x16b3f7,_0x586c60[_0xd351('0xf')][_0xd351('0x11')]);return _0x2e9a2a(_0x586c60[_0xd351('0xf')]['message']);}logger[_0xd351('0xf')](_0xd351('0x10'),_0x16b3f7,_0x586c60['error'][_0xd351('0x11')]);return _0x4e1b06(_0x586c60[_0xd351('0xf')][_0xd351('0x11')]);}else{logger[_0xd351('0xb')](_0xd351('0x10'),_0x16b3f7,'request\x20sent');_0x4e1b06(_0x586c60[_0xd351('0x12')]['message']);}})['catch'](function(_0x2c6708){logger['error'](_0xd351('0x10'),_0x16b3f7,_0x2c6708);_0x2e9a2a(_0x2c6708);});});}exports[_0xd351('0x13')]=function(_0x4e0164){var _0x4c6693=this;return new Promise(function(_0x1e1a3c,_0x2bfc53){return db[_0xd351('0x14')][_0xd351('0x15')]({'raw':_0x4e0164['options']?_0x4e0164[_0xd351('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4e0164['options']?_0x4e0164[_0xd351('0x16')]['where']||null:null,'attributes':_0x4e0164[_0xd351('0x16')]?_0x4e0164[_0xd351('0x16')][_0xd351('0x17')]||null:null,'limit':_0x4e0164[_0xd351('0x16')]?_0x4e0164[_0xd351('0x16')]['limit']||null:null,'include':_0x4e0164[_0xd351('0x16')]?_0x4e0164[_0xd351('0x16')][_0xd351('0x18')]?_['map'](_0x4e0164[_0xd351('0x16')][_0xd351('0x18')],function(_0x365bbc){return{'model':db[_0x365bbc['model']],'as':_0x365bbc['as'],'attributes':_0x365bbc[_0xd351('0x17')],'include':_0x365bbc[_0xd351('0x18')]?_[_0xd351('0x19')](_0x365bbc[_0xd351('0x18')],function(_0x489c9a){return{'model':db[_0x489c9a[_0xd351('0x1a')]],'as':_0x489c9a['as'],'attributes':_0x489c9a['attributes'],'include':_0x489c9a[_0xd351('0x18')]?_[_0xd351('0x19')](_0x489c9a['include'],function(_0x2648d0){return{'model':db[_0x2648d0['model']],'as':_0x2648d0['as'],'attributes':_0x2648d0['attributes']};}):[]};}):[]};}):[]:[]})[_0xd351('0x1b')](function(_0x560be9){logger['info'](_0xd351('0x13'),_0x4e0164);logger['debug'](_0xd351('0x13'),_0x4e0164,JSON[_0xd351('0xe')](_0x560be9));_0x1e1a3c(_0x560be9);})[_0xd351('0x1c')](function(_0x4d3f48){logger[_0xd351('0xf')]('GetVtigerAccount',_0x4d3f48[_0xd351('0x11')],_0x4e0164);_0x2bfc53(_0x4c6693['error'](0x1f4,_0x4d3f48['message']));});});};exports[_0xd351('0x1d')]=function(_0x38c82f){var _0x3f9ef3=this;return new Promise(function(_0x33b43d,_0x48aa96){return db[_0xd351('0x14')][_0xd351('0x1e')]({'raw':_0x38c82f[_0xd351('0x16')]?_0x38c82f[_0xd351('0x16')][_0xd351('0x1f')]===undefined?!![]:![]:!![],'where':_0x38c82f[_0xd351('0x16')]?_0x38c82f[_0xd351('0x16')][_0xd351('0x20')]||null:null,'attributes':_0x38c82f[_0xd351('0x16')]?_0x38c82f['options'][_0xd351('0x17')]||null:null,'include':_0x38c82f[_0xd351('0x16')]?_0x38c82f[_0xd351('0x16')][_0xd351('0x18')]?_['map'](_0x38c82f[_0xd351('0x16')][_0xd351('0x18')],function(_0x3d5b7f){return{'model':db[_0x3d5b7f[_0xd351('0x1a')]],'as':_0x3d5b7f['as'],'attributes':_0x3d5b7f[_0xd351('0x17')],'include':_0x3d5b7f[_0xd351('0x18')]?_[_0xd351('0x19')](_0x3d5b7f[_0xd351('0x18')],function(_0x238663){return{'model':db[_0x238663['model']],'as':_0x238663['as'],'attributes':_0x238663['attributes'],'include':_0x238663[_0xd351('0x18')]?_[_0xd351('0x19')](_0x238663[_0xd351('0x18')],function(_0x2907b7){return{'model':db[_0x2907b7[_0xd351('0x1a')]],'as':_0x2907b7['as'],'attributes':_0x2907b7[_0xd351('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47e2fa){logger[_0xd351('0xb')]('ShowVtigerAccount',_0x38c82f);logger[_0xd351('0xd')](_0xd351('0x1d'),_0x38c82f,JSON[_0xd351('0xe')](_0x47e2fa));_0x33b43d(_0x47e2fa);})[_0xd351('0x1c')](function(_0x33307){logger[_0xd351('0xf')](_0xd351('0x1d'),_0x33307[_0xd351('0x11')],_0x38c82f);_0x48aa96(_0x3f9ef3[_0xd351('0xf')](0x1f4,_0x33307[_0xd351('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 5472eae..d54e354 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 _0x40c3=['/:id/descriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','getSubjects'];(function(_0x182216,_0x3a50a0){var _0x48e881=function(_0x86e798){while(--_0x86e798){_0x182216['push'](_0x182216['shift']());}};_0x48e881(++_0x3a50a0);}(_0x40c3,0x71));var _0x340c=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x40c3[_0x1d24eb];return _0x1dc576;};'use strict';var multer=require(_0x340c('0x0'));var util=require(_0x340c('0x1'));var path=require(_0x340c('0x2'));var timeout=require(_0x340c('0x3'));var express=require(_0x340c('0x4'));var router=express[_0x340c('0x5')]();var fs_extra=require(_0x340c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x340c('0x7'));var config=require(_0x340c('0x8'));var controller=require('./intVtigerConfiguration.controller');router[_0x340c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x340c('0x9')](_0x340c('0xa'),auth[_0x340c('0xb')](),controller['show']);router[_0x340c('0x9')]('/:id/fields',auth[_0x340c('0xb')](),controller['getFields']);router[_0x340c('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x340c('0xc')]);router[_0x340c('0x9')](_0x340c('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x340c('0xe')]('/',auth['isAuthenticated'](),controller[_0x340c('0xf')]);router[_0x340c('0x10')]('/:id',auth[_0x340c('0xb')](),controller[_0x340c('0x11')]);router[_0x340c('0x12')](_0x340c('0xa'),auth['isAuthenticated'](),controller[_0x340c('0x13')]);module[_0x340c('0x14')]=router; \ No newline at end of file +var _0xdea5=['../../config/environment','get','isAuthenticated','show','/:id/fields','getFields','getSubjects','getDescriptions','post','create','put','/:id','update','exports','multer','util','path','express','Router','../../components/interaction/service'];(function(_0x42f50b,_0x3d5fa7){var _0x454ece=function(_0x34e2a6){while(--_0x34e2a6){_0x42f50b['push'](_0x42f50b['shift']());}};_0x454ece(++_0x3d5fa7);}(_0xdea5,0xae));var _0x5dea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdea5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5dea('0x0'));var util=require(_0x5dea('0x1'));var path=require(_0x5dea('0x2'));var timeout=require('connect-timeout');var express=require(_0x5dea('0x3'));var router=express[_0x5dea('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5dea('0x5'));var config=require(_0x5dea('0x6'));var controller=require('./intVtigerConfiguration.controller');router[_0x5dea('0x7')]('/',auth[_0x5dea('0x8')](),controller['index']);router['get']('/:id',auth[_0x5dea('0x8')](),controller[_0x5dea('0x9')]);router[_0x5dea('0x7')](_0x5dea('0xa'),auth[_0x5dea('0x8')](),controller[_0x5dea('0xb')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x5dea('0xc')]);router[_0x5dea('0x7')]('/:id/descriptions',auth[_0x5dea('0x8')](),controller[_0x5dea('0xd')]);router[_0x5dea('0xe')]('/',auth[_0x5dea('0x8')](),controller[_0x5dea('0xf')]);router[_0x5dea('0x10')](_0x5dea('0x11'),auth[_0x5dea('0x8')](),controller[_0x5dea('0x12')]);router['delete']('/:id',auth[_0x5dea('0x8')](),controller['destroy']);module[_0x5dea('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index d62b059..c0b1f52 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 _0x1ffb=['sequelize','STRING'];(function(_0x35e117,_0x360a13){var _0x288bda=function(_0x57b8de){while(--_0x57b8de){_0x35e117['push'](_0x35e117['shift']());}};_0x288bda(++_0x360a13);}(_0x1ffb,0x1e2));var _0xb1ff=function(_0x471ceb,_0x5dc4d6){_0x471ceb=_0x471ceb-0x0;var _0x49a18d=_0x1ffb[_0x471ceb];return _0x49a18d;};'use strict';var Sequelize=require(_0xb1ff('0x0'));module['exports']={'name':{'type':Sequelize[_0xb1ff('0x1')]},'description':{'type':Sequelize[_0xb1ff('0x1')]}}; \ No newline at end of file +var _0x305b=['exports','STRING'];(function(_0x280820,_0xce9bc7){var _0x474787=function(_0x3d224e){while(--_0x3d224e){_0x280820['push'](_0x280820['shift']());}};_0x474787(++_0xce9bc7);}(_0x305b,0xfe));var _0xb305=function(_0x4b2cc6,_0x29ef43){_0x4b2cc6=_0x4b2cc6-0x0;var _0x3e0b08=_0x305b[_0x4b2cc6];return _0x3e0b08;};'use strict';var Sequelize=require('sequelize');module[_0xb305('0x0')]={'name':{'type':Sequelize[_0xb305('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 0eb990f..7b4a68f 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 _0x7cda=['options','count','then','includeAll','include','findAll','rows','rawAttributes','length','catch','create','body','find','getFields','findOne','params','VtigerField','pick','getSubjects','getDescriptions','hasOwnProperty','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','save','destroy','error','name','send','map','VtigerConfiguration','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7cda,0xf6));var _0xa7cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7cda[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa7cd('0x0'));var zipdir=require(_0xa7cd('0x1'));var jsonpatch=require(_0xa7cd('0x2'));var rp=require('request-promise');var moment=require(_0xa7cd('0x3'));var BPromise=require(_0xa7cd('0x4'));var Mustache=require('mustache');var util=require(_0xa7cd('0x5'));var path=require(_0xa7cd('0x6'));var sox=require(_0xa7cd('0x7'));var csv=require(_0xa7cd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa7cd('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa7cd('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa7cd('0xb'));var toCsv=require(_0xa7cd('0x8'));var querystring=require(_0xa7cd('0xc'));var Papa=require(_0xa7cd('0xd'));var Redis=require(_0xa7cd('0xe'));var authService=require(_0xa7cd('0xf'));var qs=require(_0xa7cd('0x10'));var as=require(_0xa7cd('0x11'));var hardwareService=require(_0xa7cd('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xa7cd('0x13'));var config=require(_0xa7cd('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xa7cd('0x15'))['db'];function respondWithStatusCode(_0x4056ee,_0x57fb93){_0x57fb93=_0x57fb93||0xcc;return function(_0x3bbf3b){if(_0x3bbf3b){return _0x4056ee[_0xa7cd('0x16')](_0x57fb93);}return _0x4056ee[_0xa7cd('0x17')](_0x57fb93)['end']();};}function respondWithResult(_0x20c9ef,_0xff7938){_0xff7938=_0xff7938||0xc8;return function(_0x43abdf){if(_0x43abdf){return _0x20c9ef[_0xa7cd('0x17')](_0xff7938)[_0xa7cd('0x18')](_0x43abdf);}};}function respondWithFilteredResult(_0x2f53cd,_0x4e8710){return function(_0x5b2c7f){if(_0x5b2c7f){var _0x44d991=typeof _0x4e8710[_0xa7cd('0x19')]===_0xa7cd('0x1a')&&typeof _0x4e8710['limit']===_0xa7cd('0x1a');var _0x323e4b=_0x5b2c7f['count'];var _0x54b13f=_0x44d991?0x0:_0x4e8710[_0xa7cd('0x19')];var _0x2e1d4d=_0x44d991?_0x5b2c7f['count']:_0x4e8710[_0xa7cd('0x19')]+_0x4e8710[_0xa7cd('0x1b')];var _0x5b0e92;if(_0x2e1d4d>=_0x323e4b){_0x2e1d4d=_0x323e4b;_0x5b0e92=0xc8;}else{_0x5b0e92=0xce;}_0x2f53cd[_0xa7cd('0x17')](_0x5b0e92);return _0x2f53cd[_0xa7cd('0x1c')](_0xa7cd('0x1d'),_0x54b13f+'-'+_0x2e1d4d+'/'+_0x323e4b)['json'](_0x5b2c7f);}return null;};}function patchUpdates(_0x4c601c){return function(_0x57f8b4){try{jsonpatch[_0xa7cd('0x1e')](_0x57f8b4,_0x4c601c,!![]);}catch(_0x5dcd3b){return BPromise['reject'](_0x5dcd3b);}return _0x57f8b4[_0xa7cd('0x1f')]();};}function saveUpdates(_0x4dc29b,_0x2f20df){return function(_0x134612){if(_0x134612){return _0x134612['update'](_0x4dc29b)['then'](function(_0x49bd91){return _0x49bd91;});}return null;};}function removeEntity(_0x18f13a,_0x5c9891){return function(_0x242eab){if(_0x242eab){return _0x242eab[_0xa7cd('0x20')]()['then'](function(){_0x18f13a[_0xa7cd('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x313e79,_0x4469eb){return function(_0x59d362){if(!_0x59d362){_0x313e79[_0xa7cd('0x16')](0x194);}return _0x59d362;};}function handleError(_0x4362a4,_0x53d3b7){_0x53d3b7=_0x53d3b7||0x1f4;return function(_0x5ba778){logger[_0xa7cd('0x21')](_0x5ba778['stack']);if(_0x5ba778[_0xa7cd('0x22')]){delete _0x5ba778['name'];}_0x4362a4[_0xa7cd('0x17')](_0x53d3b7)[_0xa7cd('0x23')](_0x5ba778);};}exports['index']=function(_0x484fdc,_0x5e384d){var _0x282f77={},_0x50b898={},_0x33fa77={'count':0x0,'rows':[]};var _0x27d159=_[_0xa7cd('0x24')](db[_0xa7cd('0x25')]['rawAttributes'],function(_0x11b7d7){return{'name':_0x11b7d7['fieldName'],'type':_0x11b7d7[_0xa7cd('0x26')][_0xa7cd('0x27')]};});_0x50b898['model']=_[_0xa7cd('0x24')](_0x27d159,_0xa7cd('0x22'));_0x50b898[_0xa7cd('0x28')]=_[_0xa7cd('0x29')](_0x484fdc[_0xa7cd('0x28')]);_0x50b898[_0xa7cd('0x2a')]=_[_0xa7cd('0x2b')](_0x50b898[_0xa7cd('0x2c')],_0x50b898[_0xa7cd('0x28')]);_0x282f77[_0xa7cd('0x2d')]=_['intersection'](_0x50b898[_0xa7cd('0x2c')],qs[_0xa7cd('0x2e')](_0x484fdc['query']['fields']));_0x282f77[_0xa7cd('0x2d')]=_0x282f77[_0xa7cd('0x2d')]['length']?_0x282f77[_0xa7cd('0x2d')]:_0x50b898[_0xa7cd('0x2c')];if(!_0x484fdc[_0xa7cd('0x28')]['hasOwnProperty'](_0xa7cd('0x2f'))){_0x282f77['limit']=qs[_0xa7cd('0x1b')](_0x484fdc[_0xa7cd('0x28')][_0xa7cd('0x1b')]);_0x282f77[_0xa7cd('0x19')]=qs['offset'](_0x484fdc['query'][_0xa7cd('0x19')]);}_0x282f77[_0xa7cd('0x30')]=qs[_0xa7cd('0x31')](_0x484fdc[_0xa7cd('0x28')][_0xa7cd('0x31')]);_0x282f77[_0xa7cd('0x32')]=qs[_0xa7cd('0x2a')](_['pick'](_0x484fdc[_0xa7cd('0x28')],_0x50b898[_0xa7cd('0x2a')]),_0x27d159);if(_0x484fdc[_0xa7cd('0x28')][_0xa7cd('0x33')]){_0x282f77[_0xa7cd('0x32')]=_[_0xa7cd('0x34')](_0x282f77[_0xa7cd('0x32')],{'$or':_[_0xa7cd('0x24')](_0x27d159,function(_0x490562){if(_0x490562[_0xa7cd('0x26')]!==_0xa7cd('0x35')){var _0x375088={};_0x375088[_0x490562[_0xa7cd('0x22')]]={'$like':'%'+_0x484fdc[_0xa7cd('0x28')][_0xa7cd('0x33')]+'%'};return _0x375088;}})});}_0x282f77=_[_0xa7cd('0x34')]({},_0x282f77,_0x484fdc[_0xa7cd('0x36')]);var _0x59aac5={'where':_0x282f77['where']};return db[_0xa7cd('0x25')][_0xa7cd('0x37')](_0x59aac5)[_0xa7cd('0x38')](function(_0x496cfb){_0x33fa77[_0xa7cd('0x37')]=_0x496cfb;if(_0x484fdc[_0xa7cd('0x28')][_0xa7cd('0x39')]){_0x282f77[_0xa7cd('0x3a')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0xa7cd('0x3b')](_0x282f77);})[_0xa7cd('0x38')](function(_0x1c8958){_0x33fa77[_0xa7cd('0x3c')]=_0x1c8958;return _0x33fa77;})['then'](respondWithFilteredResult(_0x5e384d,_0x282f77))['catch'](handleError(_0x5e384d,null));};exports['show']=function(_0x3acc76,_0x42d77d){var _0x11faca={'raw':![],'where':{'id':_0x3acc76['params']['id']}},_0x54802d={};_0x54802d[_0xa7cd('0x2c')]=_[_0xa7cd('0x29')](db[_0xa7cd('0x25')][_0xa7cd('0x3d')]);_0x54802d[_0xa7cd('0x28')]=_[_0xa7cd('0x29')](_0x3acc76[_0xa7cd('0x28')]);_0x54802d[_0xa7cd('0x2a')]=_[_0xa7cd('0x2b')](_0x54802d[_0xa7cd('0x2c')],_0x54802d[_0xa7cd('0x28')]);_0x11faca[_0xa7cd('0x2d')]=_[_0xa7cd('0x2b')](_0x54802d[_0xa7cd('0x2c')],qs[_0xa7cd('0x2e')](_0x3acc76[_0xa7cd('0x28')]['fields']));_0x11faca[_0xa7cd('0x2d')]=_0x11faca[_0xa7cd('0x2d')][_0xa7cd('0x3e')]?_0x11faca[_0xa7cd('0x2d')]:_0x54802d[_0xa7cd('0x2c')];if(_0x3acc76[_0xa7cd('0x28')][_0xa7cd('0x39')]){_0x11faca['include']=[{'all':!![]}];}_0x11faca=_[_0xa7cd('0x34')]({},_0x11faca,_0x3acc76[_0xa7cd('0x36')]);return db[_0xa7cd('0x25')]['find'](_0x11faca)[_0xa7cd('0x38')](handleEntityNotFound(_0x42d77d,null))[_0xa7cd('0x38')](respondWithResult(_0x42d77d,null))[_0xa7cd('0x3f')](handleError(_0x42d77d,null));};exports[_0xa7cd('0x40')]=function(_0x119c99,_0x2a48d3){return db[_0xa7cd('0x25')][_0xa7cd('0x40')](_0x119c99[_0xa7cd('0x41')],{})['then'](respondWithResult(_0x2a48d3,0xc9))['catch'](handleError(_0x2a48d3,null));};exports['update']=function(_0x35e023,_0xf668be){if(_0x35e023[_0xa7cd('0x41')]['id']){delete _0x35e023['body']['id'];}return db[_0xa7cd('0x25')][_0xa7cd('0x42')]({'where':{'id':_0x35e023['params']['id']}})['then'](handleEntityNotFound(_0xf668be,null))['then'](saveUpdates(_0x35e023['body'],null))[_0xa7cd('0x38')](respondWithResult(_0xf668be,null))[_0xa7cd('0x3f')](handleError(_0xf668be,null));};exports[_0xa7cd('0x20')]=function(_0x11f0d0,_0xb98e4d){return db[_0xa7cd('0x25')][_0xa7cd('0x42')]({'where':{'id':_0x11f0d0['params']['id']}})[_0xa7cd('0x38')](handleEntityNotFound(_0xb98e4d,null))['then'](removeEntity(_0xb98e4d,null))[_0xa7cd('0x3f')](handleError(_0xb98e4d,null));};exports[_0xa7cd('0x43')]=function(_0x1a0e24,_0x1c8648,_0x447f99){var _0x351c94={};var _0x1490bd={};var _0x4c5a03;var _0x1c3bf0;return db[_0xa7cd('0x25')][_0xa7cd('0x44')]({'where':{'id':_0x1a0e24[_0xa7cd('0x45')]['id']}})[_0xa7cd('0x38')](handleEntityNotFound(_0x1c8648,null))[_0xa7cd('0x38')](function(_0x140ef6){if(_0x140ef6){_0x4c5a03=_0x140ef6;_0x1490bd['model']=_['keys'](db[_0xa7cd('0x46')][_0xa7cd('0x3d')]);_0x1490bd[_0xa7cd('0x28')]=_[_0xa7cd('0x29')](_0x1a0e24['query']);_0x1490bd[_0xa7cd('0x2a')]=_[_0xa7cd('0x2b')](_0x1490bd[_0xa7cd('0x2c')],_0x1490bd[_0xa7cd('0x28')]);_0x351c94['attributes']=_['intersection'](_0x1490bd['model'],qs[_0xa7cd('0x2e')](_0x1a0e24[_0xa7cd('0x28')][_0xa7cd('0x2e')]));_0x351c94[_0xa7cd('0x2d')]=_0x351c94['attributes'][_0xa7cd('0x3e')]?_0x351c94[_0xa7cd('0x2d')]:_0x1490bd[_0xa7cd('0x2c')];_0x351c94[_0xa7cd('0x30')]=qs['sort'](_0x1a0e24[_0xa7cd('0x28')][_0xa7cd('0x31')]);_0x351c94['where']=qs['filters'](_[_0xa7cd('0x47')](_0x1a0e24['query'],_0x1490bd[_0xa7cd('0x2a')]));if(_0x1a0e24[_0xa7cd('0x28')]['filter']){_0x351c94[_0xa7cd('0x32')]=_['merge'](_0x351c94['where'],{'$or':_[_0xa7cd('0x24')](_0x351c94[_0xa7cd('0x2d')],function(_0x56027d){var _0x17dbbc={};_0x17dbbc[_0x56027d]={'$like':'%'+_0x1a0e24[_0xa7cd('0x28')][_0xa7cd('0x33')]+'%'};return _0x17dbbc;})});}_0x351c94=_[_0xa7cd('0x34')]({},_0x351c94,_0x1a0e24['options']);return _0x4c5a03[_0xa7cd('0x43')](_0x351c94);}})[_0xa7cd('0x38')](function(_0x196209){if(_0x196209){_0x1c3bf0=_0x196209[_0xa7cd('0x3e')];if(!_0x1a0e24[_0xa7cd('0x28')]['hasOwnProperty'](_0xa7cd('0x2f'))){_0x351c94[_0xa7cd('0x1b')]=qs['limit'](_0x1a0e24['query']['limit']);_0x351c94[_0xa7cd('0x19')]=qs[_0xa7cd('0x19')](_0x1a0e24[_0xa7cd('0x28')]['offset']);}return _0x4c5a03[_0xa7cd('0x43')](_0x351c94);}})[_0xa7cd('0x38')](function(_0x3f55a2){if(_0x3f55a2){return _0x3f55a2?{'count':_0x1c3bf0,'rows':_0x3f55a2}:null;}})[_0xa7cd('0x38')](respondWithResult(_0x1c8648,null))['catch'](handleError(_0x1c8648,null));};exports['getSubjects']=function(_0xa12060,_0x1f40c3,_0x24f38a){var _0x43ec91={};var _0x231edd={};var _0x298fe9;var _0x265e47;return db[_0xa7cd('0x25')][_0xa7cd('0x44')]({'where':{'id':_0xa12060[_0xa7cd('0x45')]['id']}})[_0xa7cd('0x38')](handleEntityNotFound(_0x1f40c3,null))['then'](function(_0x5114af){if(_0x5114af){_0x298fe9=_0x5114af;_0x231edd['model']=_['keys'](db[_0xa7cd('0x46')][_0xa7cd('0x3d')]);_0x231edd['query']=_[_0xa7cd('0x29')](_0xa12060['query']);_0x231edd['filters']=_[_0xa7cd('0x2b')](_0x231edd[_0xa7cd('0x2c')],_0x231edd['query']);_0x43ec91[_0xa7cd('0x2d')]=_['intersection'](_0x231edd[_0xa7cd('0x2c')],qs[_0xa7cd('0x2e')](_0xa12060['query'][_0xa7cd('0x2e')]));_0x43ec91[_0xa7cd('0x2d')]=_0x43ec91[_0xa7cd('0x2d')][_0xa7cd('0x3e')]?_0x43ec91[_0xa7cd('0x2d')]:_0x231edd[_0xa7cd('0x2c')];_0x43ec91[_0xa7cd('0x30')]=qs[_0xa7cd('0x31')](_0xa12060['query']['sort']);_0x43ec91['where']=qs[_0xa7cd('0x2a')](_[_0xa7cd('0x47')](_0xa12060[_0xa7cd('0x28')],_0x231edd[_0xa7cd('0x2a')]));if(_0xa12060[_0xa7cd('0x28')][_0xa7cd('0x33')]){_0x43ec91[_0xa7cd('0x32')]=_[_0xa7cd('0x34')](_0x43ec91['where'],{'$or':_[_0xa7cd('0x24')](_0x43ec91[_0xa7cd('0x2d')],function(_0x1e0a5d){var _0x5c29fd={};_0x5c29fd[_0x1e0a5d]={'$like':'%'+_0xa12060[_0xa7cd('0x28')][_0xa7cd('0x33')]+'%'};return _0x5c29fd;})});}_0x43ec91=_[_0xa7cd('0x34')]({},_0x43ec91,_0xa12060[_0xa7cd('0x36')]);return _0x298fe9[_0xa7cd('0x48')](_0x43ec91);}})[_0xa7cd('0x38')](function(_0x115cd4){if(_0x115cd4){_0x265e47=_0x115cd4[_0xa7cd('0x3e')];if(!_0xa12060[_0xa7cd('0x28')]['hasOwnProperty']('nolimit')){_0x43ec91[_0xa7cd('0x1b')]=qs[_0xa7cd('0x1b')](_0xa12060[_0xa7cd('0x28')][_0xa7cd('0x1b')]);_0x43ec91[_0xa7cd('0x19')]=qs[_0xa7cd('0x19')](_0xa12060['query'][_0xa7cd('0x19')]);}return _0x298fe9[_0xa7cd('0x48')](_0x43ec91);}})[_0xa7cd('0x38')](function(_0x4f918e){if(_0x4f918e){return _0x4f918e?{'count':_0x265e47,'rows':_0x4f918e}:null;}})[_0xa7cd('0x38')](respondWithResult(_0x1f40c3,null))[_0xa7cd('0x3f')](handleError(_0x1f40c3,null));};exports[_0xa7cd('0x49')]=function(_0x2c92ca,_0x1ca4a2,_0x231ccb){var _0x338c7d={};var _0x2c6d55={};var _0x2f528c;var _0x35e153;return db[_0xa7cd('0x25')]['findOne']({'where':{'id':_0x2c92ca['params']['id']}})[_0xa7cd('0x38')](handleEntityNotFound(_0x1ca4a2,null))['then'](function(_0x4f9dae){if(_0x4f9dae){_0x2f528c=_0x4f9dae;_0x2c6d55[_0xa7cd('0x2c')]=_[_0xa7cd('0x29')](db[_0xa7cd('0x46')][_0xa7cd('0x3d')]);_0x2c6d55['query']=_['keys'](_0x2c92ca[_0xa7cd('0x28')]);_0x2c6d55[_0xa7cd('0x2a')]=_[_0xa7cd('0x2b')](_0x2c6d55[_0xa7cd('0x2c')],_0x2c6d55['query']);_0x338c7d[_0xa7cd('0x2d')]=_[_0xa7cd('0x2b')](_0x2c6d55[_0xa7cd('0x2c')],qs['fields'](_0x2c92ca[_0xa7cd('0x28')][_0xa7cd('0x2e')]));_0x338c7d[_0xa7cd('0x2d')]=_0x338c7d[_0xa7cd('0x2d')][_0xa7cd('0x3e')]?_0x338c7d['attributes']:_0x2c6d55[_0xa7cd('0x2c')];_0x338c7d[_0xa7cd('0x30')]=qs[_0xa7cd('0x31')](_0x2c92ca[_0xa7cd('0x28')][_0xa7cd('0x31')]);_0x338c7d['where']=qs[_0xa7cd('0x2a')](_['pick'](_0x2c92ca[_0xa7cd('0x28')],_0x2c6d55[_0xa7cd('0x2a')]));if(_0x2c92ca['query'][_0xa7cd('0x33')]){_0x338c7d[_0xa7cd('0x32')]=_['merge'](_0x338c7d[_0xa7cd('0x32')],{'$or':_[_0xa7cd('0x24')](_0x338c7d[_0xa7cd('0x2d')],function(_0x2f76b1){var _0xcf8d87={};_0xcf8d87[_0x2f76b1]={'$like':'%'+_0x2c92ca['query'][_0xa7cd('0x33')]+'%'};return _0xcf8d87;})});}_0x338c7d=_['merge']({},_0x338c7d,_0x2c92ca['options']);return _0x2f528c[_0xa7cd('0x49')](_0x338c7d);}})[_0xa7cd('0x38')](function(_0x3af7ae){if(_0x3af7ae){_0x35e153=_0x3af7ae[_0xa7cd('0x3e')];if(!_0x2c92ca[_0xa7cd('0x28')][_0xa7cd('0x4a')](_0xa7cd('0x2f'))){_0x338c7d[_0xa7cd('0x1b')]=qs['limit'](_0x2c92ca[_0xa7cd('0x28')][_0xa7cd('0x1b')]);_0x338c7d[_0xa7cd('0x19')]=qs['offset'](_0x2c92ca[_0xa7cd('0x28')][_0xa7cd('0x19')]);}return _0x2f528c[_0xa7cd('0x49')](_0x338c7d);}})[_0xa7cd('0x38')](function(_0x561f7e){if(_0x561f7e){return _0x561f7e?{'count':_0x35e153,'rows':_0x561f7e}:null;}})['then'](respondWithResult(_0x1ca4a2,null))[_0xa7cd('0x3f')](handleError(_0x1ca4a2,null));}; \ No newline at end of file +var _0x64e6=['update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','VtigerConfiguration','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','hasOwnProperty','getSubjects','VtigerField','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save'];(function(_0x4be338,_0x390655){var _0x568f6a=function(_0x128636){while(--_0x128636){_0x4be338['push'](_0x4be338['shift']());}};_0x568f6a(++_0x390655);}(_0x64e6,0xcd));var _0x664e=function(_0x2b7f56,_0x41bc7d){_0x2b7f56=_0x2b7f56-0x0;var _0x36896d=_0x64e6[_0x2b7f56];return _0x36896d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x664e('0x0'));var zipdir=require(_0x664e('0x1'));var jsonpatch=require(_0x664e('0x2'));var rp=require(_0x664e('0x3'));var moment=require('moment');var BPromise=require(_0x664e('0x4'));var Mustache=require(_0x664e('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x664e('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x664e('0x7'));var _=require(_0x664e('0x8'));var squel=require('squel');var crypto=require(_0x664e('0x9'));var jsforce=require(_0x664e('0xa'));var deskjs=require(_0x664e('0xb'));var toCsv=require(_0x664e('0x6'));var querystring=require(_0x664e('0xc'));var Papa=require(_0x664e('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x664e('0xe'));var as=require(_0x664e('0xf'));var hardwareService=require(_0x664e('0x10'));var logger=require(_0x664e('0x11'))(_0x664e('0x12'));var utils=require(_0x664e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x664e('0x14'));var db=require(_0x664e('0x15'))['db'];function respondWithStatusCode(_0x5650b5,_0x11002b){_0x11002b=_0x11002b||0xcc;return function(_0x599cec){if(_0x599cec){return _0x5650b5[_0x664e('0x16')](_0x11002b);}return _0x5650b5[_0x664e('0x17')](_0x11002b)[_0x664e('0x18')]();};}function respondWithResult(_0x55d989,_0x243848){_0x243848=_0x243848||0xc8;return function(_0x4837bd){if(_0x4837bd){return _0x55d989[_0x664e('0x17')](_0x243848)[_0x664e('0x19')](_0x4837bd);}};}function respondWithFilteredResult(_0x6f8b76,_0x103dfc){return function(_0x3f5b28){if(_0x3f5b28){var _0x2fc3f5=typeof _0x103dfc[_0x664e('0x1a')]===_0x664e('0x1b')&&typeof _0x103dfc['limit']===_0x664e('0x1b');var _0x3c0009=_0x3f5b28['count'];var _0x3e55cc=_0x2fc3f5?0x0:_0x103dfc['offset'];var _0x2766f0=_0x2fc3f5?_0x3f5b28[_0x664e('0x1c')]:_0x103dfc[_0x664e('0x1a')]+_0x103dfc[_0x664e('0x1d')];var _0x13af09;if(_0x2766f0>=_0x3c0009){_0x2766f0=_0x3c0009;_0x13af09=0xc8;}else{_0x13af09=0xce;}_0x6f8b76['status'](_0x13af09);return _0x6f8b76[_0x664e('0x1e')](_0x664e('0x1f'),_0x3e55cc+'-'+_0x2766f0+'/'+_0x3c0009)['json'](_0x3f5b28);}return null;};}function patchUpdates(_0x1a6a64){return function(_0x5975ce){try{jsonpatch[_0x664e('0x20')](_0x5975ce,_0x1a6a64,!![]);}catch(_0x398f7d){return BPromise[_0x664e('0x21')](_0x398f7d);}return _0x5975ce[_0x664e('0x22')]();};}function saveUpdates(_0x5596de,_0x6ce3d8){return function(_0x356de4){if(_0x356de4){return _0x356de4[_0x664e('0x23')](_0x5596de)[_0x664e('0x24')](function(_0x2be563){return _0x2be563;});}return null;};}function removeEntity(_0x5cecb8,_0x411ed8){return function(_0x41d0c5){if(_0x41d0c5){return _0x41d0c5[_0x664e('0x25')]()[_0x664e('0x24')](function(){_0x5cecb8[_0x664e('0x17')](0xcc)[_0x664e('0x18')]();});}};}function handleEntityNotFound(_0x540a60,_0x62a545){return function(_0x2aa309){if(!_0x2aa309){_0x540a60[_0x664e('0x16')](0x194);}return _0x2aa309;};}function handleError(_0x1ac58e,_0x3b0713){_0x3b0713=_0x3b0713||0x1f4;return function(_0x58c1b1){logger[_0x664e('0x26')](_0x58c1b1[_0x664e('0x27')]);if(_0x58c1b1['name']){delete _0x58c1b1[_0x664e('0x28')];}_0x1ac58e['status'](_0x3b0713)['send'](_0x58c1b1);};}exports[_0x664e('0x29')]=function(_0x311c49,_0x154d48){var _0x52c830={},_0xa86fd0={},_0x16112a={'count':0x0,'rows':[]};var _0x59d8ed=_[_0x664e('0x2a')](db['VtigerConfiguration'][_0x664e('0x2b')],function(_0x1fc1fa){return{'name':_0x1fc1fa[_0x664e('0x2c')],'type':_0x1fc1fa[_0x664e('0x2d')][_0x664e('0x2e')]};});_0xa86fd0['model']=_['map'](_0x59d8ed,'name');_0xa86fd0[_0x664e('0x2f')]=_[_0x664e('0x30')](_0x311c49[_0x664e('0x2f')]);_0xa86fd0[_0x664e('0x31')]=_['intersection'](_0xa86fd0[_0x664e('0x32')],_0xa86fd0['query']);_0x52c830[_0x664e('0x33')]=_[_0x664e('0x34')](_0xa86fd0[_0x664e('0x32')],qs[_0x664e('0x35')](_0x311c49['query'][_0x664e('0x35')]));_0x52c830[_0x664e('0x33')]=_0x52c830['attributes'][_0x664e('0x36')]?_0x52c830[_0x664e('0x33')]:_0xa86fd0[_0x664e('0x32')];if(!_0x311c49['query']['hasOwnProperty']('nolimit')){_0x52c830[_0x664e('0x1d')]=qs['limit'](_0x311c49['query'][_0x664e('0x1d')]);_0x52c830[_0x664e('0x1a')]=qs[_0x664e('0x1a')](_0x311c49[_0x664e('0x2f')][_0x664e('0x1a')]);}_0x52c830[_0x664e('0x37')]=qs[_0x664e('0x38')](_0x311c49[_0x664e('0x2f')]['sort']);_0x52c830[_0x664e('0x39')]=qs[_0x664e('0x31')](_[_0x664e('0x3a')](_0x311c49[_0x664e('0x2f')],_0xa86fd0['filters']),_0x59d8ed);if(_0x311c49[_0x664e('0x2f')][_0x664e('0x3b')]){_0x52c830[_0x664e('0x39')]=_[_0x664e('0x3c')](_0x52c830[_0x664e('0x39')],{'$or':_[_0x664e('0x2a')](_0x59d8ed,function(_0x4ba05a){if(_0x4ba05a['type']!==_0x664e('0x3d')){var _0x3935cb={};_0x3935cb[_0x4ba05a[_0x664e('0x28')]]={'$like':'%'+_0x311c49['query'][_0x664e('0x3b')]+'%'};return _0x3935cb;}})});}_0x52c830=_[_0x664e('0x3c')]({},_0x52c830,_0x311c49[_0x664e('0x3e')]);var _0x277bd7={'where':_0x52c830['where']};return db[_0x664e('0x3f')][_0x664e('0x1c')](_0x277bd7)[_0x664e('0x24')](function(_0x1fc130){_0x16112a[_0x664e('0x1c')]=_0x1fc130;if(_0x311c49[_0x664e('0x2f')][_0x664e('0x40')]){_0x52c830[_0x664e('0x41')]=[{'all':!![]}];}return db[_0x664e('0x3f')][_0x664e('0x42')](_0x52c830);})[_0x664e('0x24')](function(_0x2bcffa){_0x16112a[_0x664e('0x43')]=_0x2bcffa;return _0x16112a;})['then'](respondWithFilteredResult(_0x154d48,_0x52c830))[_0x664e('0x44')](handleError(_0x154d48,null));};exports[_0x664e('0x45')]=function(_0x55b4de,_0x3979e6){var _0x198704={'raw':![],'where':{'id':_0x55b4de[_0x664e('0x46')]['id']}},_0x2c75e9={};_0x2c75e9[_0x664e('0x32')]=_[_0x664e('0x30')](db[_0x664e('0x3f')][_0x664e('0x2b')]);_0x2c75e9[_0x664e('0x2f')]=_['keys'](_0x55b4de[_0x664e('0x2f')]);_0x2c75e9['filters']=_[_0x664e('0x34')](_0x2c75e9[_0x664e('0x32')],_0x2c75e9['query']);_0x198704[_0x664e('0x33')]=_[_0x664e('0x34')](_0x2c75e9[_0x664e('0x32')],qs[_0x664e('0x35')](_0x55b4de[_0x664e('0x2f')]['fields']));_0x198704[_0x664e('0x33')]=_0x198704['attributes'][_0x664e('0x36')]?_0x198704[_0x664e('0x33')]:_0x2c75e9[_0x664e('0x32')];if(_0x55b4de[_0x664e('0x2f')][_0x664e('0x40')]){_0x198704[_0x664e('0x41')]=[{'all':!![]}];}_0x198704=_[_0x664e('0x3c')]({},_0x198704,_0x55b4de[_0x664e('0x3e')]);return db[_0x664e('0x3f')][_0x664e('0x47')](_0x198704)[_0x664e('0x24')](handleEntityNotFound(_0x3979e6,null))[_0x664e('0x24')](respondWithResult(_0x3979e6,null))[_0x664e('0x44')](handleError(_0x3979e6,null));};exports[_0x664e('0x48')]=function(_0x5ab54f,_0x148a2e){return db['VtigerConfiguration'][_0x664e('0x48')](_0x5ab54f[_0x664e('0x49')],{})['then'](respondWithResult(_0x148a2e,0xc9))['catch'](handleError(_0x148a2e,null));};exports['update']=function(_0x2131ab,_0x15fd98){if(_0x2131ab[_0x664e('0x49')]['id']){delete _0x2131ab[_0x664e('0x49')]['id'];}return db[_0x664e('0x3f')][_0x664e('0x47')]({'where':{'id':_0x2131ab[_0x664e('0x46')]['id']}})['then'](handleEntityNotFound(_0x15fd98,null))['then'](saveUpdates(_0x2131ab[_0x664e('0x49')],null))['then'](respondWithResult(_0x15fd98,null))[_0x664e('0x44')](handleError(_0x15fd98,null));};exports[_0x664e('0x25')]=function(_0x42a862,_0x14a72b){return db['VtigerConfiguration']['find']({'where':{'id':_0x42a862[_0x664e('0x46')]['id']}})[_0x664e('0x24')](handleEntityNotFound(_0x14a72b,null))[_0x664e('0x24')](removeEntity(_0x14a72b,null))[_0x664e('0x44')](handleError(_0x14a72b,null));};exports[_0x664e('0x4a')]=function(_0x3875d4,_0x47b499,_0x39c386){var _0x1a05c2={};var _0x21081c={};var _0x3d4ee3;var _0x1e3ca4;return db[_0x664e('0x3f')][_0x664e('0x4b')]({'where':{'id':_0x3875d4[_0x664e('0x46')]['id']}})['then'](handleEntityNotFound(_0x47b499,null))[_0x664e('0x24')](function(_0xf81749){if(_0xf81749){_0x3d4ee3=_0xf81749;_0x21081c['model']=_[_0x664e('0x30')](db['VtigerField'][_0x664e('0x2b')]);_0x21081c[_0x664e('0x2f')]=_[_0x664e('0x30')](_0x3875d4[_0x664e('0x2f')]);_0x21081c[_0x664e('0x31')]=_[_0x664e('0x34')](_0x21081c[_0x664e('0x32')],_0x21081c['query']);_0x1a05c2[_0x664e('0x33')]=_[_0x664e('0x34')](_0x21081c['model'],qs['fields'](_0x3875d4['query'][_0x664e('0x35')]));_0x1a05c2['attributes']=_0x1a05c2[_0x664e('0x33')]['length']?_0x1a05c2[_0x664e('0x33')]:_0x21081c[_0x664e('0x32')];_0x1a05c2[_0x664e('0x37')]=qs[_0x664e('0x38')](_0x3875d4[_0x664e('0x2f')][_0x664e('0x38')]);_0x1a05c2['where']=qs[_0x664e('0x31')](_[_0x664e('0x3a')](_0x3875d4[_0x664e('0x2f')],_0x21081c[_0x664e('0x31')]));if(_0x3875d4[_0x664e('0x2f')][_0x664e('0x3b')]){_0x1a05c2[_0x664e('0x39')]=_[_0x664e('0x3c')](_0x1a05c2['where'],{'$or':_[_0x664e('0x2a')](_0x1a05c2[_0x664e('0x33')],function(_0x23070c){var _0x25a103={};_0x25a103[_0x23070c]={'$like':'%'+_0x3875d4[_0x664e('0x2f')][_0x664e('0x3b')]+'%'};return _0x25a103;})});}_0x1a05c2=_[_0x664e('0x3c')]({},_0x1a05c2,_0x3875d4[_0x664e('0x3e')]);return _0x3d4ee3[_0x664e('0x4a')](_0x1a05c2);}})['then'](function(_0x27127b){if(_0x27127b){_0x1e3ca4=_0x27127b[_0x664e('0x36')];if(!_0x3875d4[_0x664e('0x2f')][_0x664e('0x4c')]('nolimit')){_0x1a05c2[_0x664e('0x1d')]=qs[_0x664e('0x1d')](_0x3875d4[_0x664e('0x2f')][_0x664e('0x1d')]);_0x1a05c2[_0x664e('0x1a')]=qs[_0x664e('0x1a')](_0x3875d4[_0x664e('0x2f')]['offset']);}return _0x3d4ee3[_0x664e('0x4a')](_0x1a05c2);}})[_0x664e('0x24')](function(_0x387503){if(_0x387503){return _0x387503?{'count':_0x1e3ca4,'rows':_0x387503}:null;}})[_0x664e('0x24')](respondWithResult(_0x47b499,null))[_0x664e('0x44')](handleError(_0x47b499,null));};exports[_0x664e('0x4d')]=function(_0x2f03c1,_0x2ccd02,_0xadea2a){var _0x3e55fd={};var _0x35c9fc={};var _0x4a7bf0;var _0x43825a;return db[_0x664e('0x3f')][_0x664e('0x4b')]({'where':{'id':_0x2f03c1[_0x664e('0x46')]['id']}})['then'](handleEntityNotFound(_0x2ccd02,null))['then'](function(_0x1930f9){if(_0x1930f9){_0x4a7bf0=_0x1930f9;_0x35c9fc[_0x664e('0x32')]=_[_0x664e('0x30')](db[_0x664e('0x4e')][_0x664e('0x2b')]);_0x35c9fc[_0x664e('0x2f')]=_['keys'](_0x2f03c1[_0x664e('0x2f')]);_0x35c9fc[_0x664e('0x31')]=_[_0x664e('0x34')](_0x35c9fc['model'],_0x35c9fc[_0x664e('0x2f')]);_0x3e55fd[_0x664e('0x33')]=_[_0x664e('0x34')](_0x35c9fc[_0x664e('0x32')],qs['fields'](_0x2f03c1['query'][_0x664e('0x35')]));_0x3e55fd[_0x664e('0x33')]=_0x3e55fd[_0x664e('0x33')][_0x664e('0x36')]?_0x3e55fd['attributes']:_0x35c9fc['model'];_0x3e55fd[_0x664e('0x37')]=qs[_0x664e('0x38')](_0x2f03c1[_0x664e('0x2f')][_0x664e('0x38')]);_0x3e55fd[_0x664e('0x39')]=qs[_0x664e('0x31')](_['pick'](_0x2f03c1[_0x664e('0x2f')],_0x35c9fc['filters']));if(_0x2f03c1['query'][_0x664e('0x3b')]){_0x3e55fd['where']=_[_0x664e('0x3c')](_0x3e55fd[_0x664e('0x39')],{'$or':_['map'](_0x3e55fd['attributes'],function(_0x3e7515){var _0x2364b6={};_0x2364b6[_0x3e7515]={'$like':'%'+_0x2f03c1[_0x664e('0x2f')]['filter']+'%'};return _0x2364b6;})});}_0x3e55fd=_['merge']({},_0x3e55fd,_0x2f03c1[_0x664e('0x3e')]);return _0x4a7bf0['getSubjects'](_0x3e55fd);}})[_0x664e('0x24')](function(_0x221f8c){if(_0x221f8c){_0x43825a=_0x221f8c[_0x664e('0x36')];if(!_0x2f03c1['query'][_0x664e('0x4c')]('nolimit')){_0x3e55fd[_0x664e('0x1d')]=qs[_0x664e('0x1d')](_0x2f03c1['query'][_0x664e('0x1d')]);_0x3e55fd[_0x664e('0x1a')]=qs['offset'](_0x2f03c1['query'][_0x664e('0x1a')]);}return _0x4a7bf0[_0x664e('0x4d')](_0x3e55fd);}})[_0x664e('0x24')](function(_0x11c7be){if(_0x11c7be){return _0x11c7be?{'count':_0x43825a,'rows':_0x11c7be}:null;}})[_0x664e('0x24')](respondWithResult(_0x2ccd02,null))[_0x664e('0x44')](handleError(_0x2ccd02,null));};exports[_0x664e('0x4f')]=function(_0x573ce3,_0x1a658c,_0x2b1e25){var _0x130109={};var _0x680a75={};var _0x563231;var _0x329f84;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x573ce3['params']['id']}})[_0x664e('0x24')](handleEntityNotFound(_0x1a658c,null))[_0x664e('0x24')](function(_0x26be27){if(_0x26be27){_0x563231=_0x26be27;_0x680a75['model']=_['keys'](db['VtigerField'][_0x664e('0x2b')]);_0x680a75[_0x664e('0x2f')]=_['keys'](_0x573ce3[_0x664e('0x2f')]);_0x680a75[_0x664e('0x31')]=_[_0x664e('0x34')](_0x680a75[_0x664e('0x32')],_0x680a75[_0x664e('0x2f')]);_0x130109['attributes']=_['intersection'](_0x680a75['model'],qs['fields'](_0x573ce3[_0x664e('0x2f')]['fields']));_0x130109[_0x664e('0x33')]=_0x130109['attributes']['length']?_0x130109[_0x664e('0x33')]:_0x680a75[_0x664e('0x32')];_0x130109[_0x664e('0x37')]=qs['sort'](_0x573ce3['query'][_0x664e('0x38')]);_0x130109[_0x664e('0x39')]=qs[_0x664e('0x31')](_[_0x664e('0x3a')](_0x573ce3[_0x664e('0x2f')],_0x680a75[_0x664e('0x31')]));if(_0x573ce3[_0x664e('0x2f')][_0x664e('0x3b')]){_0x130109['where']=_[_0x664e('0x3c')](_0x130109[_0x664e('0x39')],{'$or':_['map'](_0x130109['attributes'],function(_0x2b1f2c){var _0x3a5297={};_0x3a5297[_0x2b1f2c]={'$like':'%'+_0x573ce3[_0x664e('0x2f')]['filter']+'%'};return _0x3a5297;})});}_0x130109=_[_0x664e('0x3c')]({},_0x130109,_0x573ce3[_0x664e('0x3e')]);return _0x563231[_0x664e('0x4f')](_0x130109);}})[_0x664e('0x24')](function(_0xc02448){if(_0xc02448){_0x329f84=_0xc02448[_0x664e('0x36')];if(!_0x573ce3[_0x664e('0x2f')]['hasOwnProperty']('nolimit')){_0x130109['limit']=qs['limit'](_0x573ce3[_0x664e('0x2f')][_0x664e('0x1d')]);_0x130109[_0x664e('0x1a')]=qs[_0x664e('0x1a')](_0x573ce3[_0x664e('0x2f')][_0x664e('0x1a')]);}return _0x563231[_0x664e('0x4f')](_0x130109);}})['then'](function(_0x1dd2b3){if(_0x1dd2b3){return _0x1dd2b3?{'count':_0x329f84,'rows':_0x1dd2b3}:null;}})['then'](respondWithResult(_0x1a658c,null))['catch'](handleError(_0x1a658c,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 4161832..65e8897 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 _0xa75f=['../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x42e283,_0x40dfc7){var _0x2e36d6=function(_0x2a30e6){while(--_0x2a30e6){_0x42e283['push'](_0x42e283['shift']());}};_0x2e36d6(++_0x40dfc7);}(_0xa75f,0x172));var _0xfa75=function(_0x14a8d2,_0x3b47a5){_0x14a8d2=_0x14a8d2-0x0;var _0x166333=_0xa75f[_0x14a8d2];return _0x166333;};'use strict';var _=require(_0xfa75('0x0'));var util=require(_0xfa75('0x1'));var logger=require(_0xfa75('0x2'))(_0xfa75('0x3'));var moment=require(_0xfa75('0x4'));var BPromise=require('bluebird');var rp=require(_0xfa75('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfa75('0x6'));var config=require(_0xfa75('0x7'));var attributes=require(_0xfa75('0x8'));module[_0xfa75('0x9')]=function(_0xb26f4b,_0x1a5b5d){return _0xb26f4b[_0xfa75('0xa')](_0xfa75('0xb'),attributes,{'tableName':_0xfa75('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ce0=['VtigerConfiguration','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define'];(function(_0x142c9e,_0x141cd7){var _0x6d03b6=function(_0x588b23){while(--_0x588b23){_0x142c9e['push'](_0x142c9e['shift']());}};_0x6d03b6(++_0x141cd7);}(_0x5ce0,0x155));var _0x05ce=function(_0x7dbd65,_0x18da49){_0x7dbd65=_0x7dbd65-0x0;var _0x33d551=_0x5ce0[_0x7dbd65];return _0x33d551;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x05ce('0x0'))('api');var moment=require(_0x05ce('0x1'));var BPromise=require('bluebird');var rp=require(_0x05ce('0x2'));var fs=require('fs');var path=require(_0x05ce('0x3'));var rimraf=require(_0x05ce('0x4'));var config=require(_0x05ce('0x5'));var attributes=require(_0x05ce('0x6'));module[_0x05ce('0x7')]=function(_0x21e279,_0x4572fb){return _0x21e279[_0x05ce('0x8')](_0x05ce('0x9'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 6338020..8d020cc 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 _0xfebc=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','lodash'];(function(_0x2bf5bd,_0x120787){var _0xc810c0=function(_0xba9dd3){while(--_0xba9dd3){_0x2bf5bd['push'](_0x2bf5bd['shift']());}};_0xc810c0(++_0x120787);}(_0xfebc,0xfc));var _0xcfeb=function(_0x3d3fa2,_0x104433){_0x3d3fa2=_0x3d3fa2-0x0;var _0x556091=_0xfebc[_0x3d3fa2];return _0x556091;};'use strict';var _=require(_0xcfeb('0x0'));var util=require(_0xcfeb('0x1'));var moment=require('moment');var BPromise=require(_0xcfeb('0x2'));var rs=require(_0xcfeb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcfeb('0x4'))['db'];var utils=require(_0xcfeb('0x5'));var logger=require(_0xcfeb('0x6'))(_0xcfeb('0x7'));var config=require('../../config/environment');var jayson=require(_0xcfeb('0x8'));var client=jayson[_0xcfeb('0x9')][_0xcfeb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8bcc0d,_0x4f5e85,_0x2d3914){return new BPromise(function(_0x251f95,_0x436290){return client[_0xcfeb('0xb')](_0x8bcc0d,_0x2d3914)[_0xcfeb('0xc')](function(_0x5cd965){logger[_0xcfeb('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x4f5e85,_0xcfeb('0xe'));logger[_0xcfeb('0xf')](_0xcfeb('0x10'),_0x4f5e85,_0xcfeb('0xe'),JSON[_0xcfeb('0x11')](_0x5cd965));if(_0x5cd965['error']){if(_0x5cd965[_0xcfeb('0x12')][_0xcfeb('0x13')]===0x1f4){logger['error'](_0xcfeb('0x14'),_0x4f5e85,_0x5cd965[_0xcfeb('0x12')][_0xcfeb('0x15')]);return _0x436290(_0x5cd965[_0xcfeb('0x12')][_0xcfeb('0x15')]);}logger['error'](_0xcfeb('0x14'),_0x4f5e85,_0x5cd965[_0xcfeb('0x12')][_0xcfeb('0x15')]);return _0x251f95(_0x5cd965[_0xcfeb('0x12')]['message']);}else{logger[_0xcfeb('0xd')](_0xcfeb('0x14'),_0x4f5e85,_0xcfeb('0xe'));_0x251f95(_0x5cd965[_0xcfeb('0x16')][_0xcfeb('0x15')]);}})['catch'](function(_0x2e4648){logger[_0xcfeb('0x12')](_0xcfeb('0x14'),_0x4f5e85,_0x2e4648);_0x436290(_0x2e4648);});});} \ No newline at end of file +var _0x9f1c=['catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent'];(function(_0x2c8f98,_0x2a8009){var _0x5e1a16=function(_0x171cd3){while(--_0x171cd3){_0x2c8f98['push'](_0x2c8f98['shift']());}};_0x5e1a16(++_0x2a8009);}(_0x9f1c,0x17d));var _0xc9f1=function(_0x52106f,_0x202244){_0x52106f=_0x52106f-0x0;var _0x430652=_0x9f1c[_0x52106f];return _0x430652;};'use strict';var _=require(_0xc9f1('0x0'));var util=require('util');var moment=require(_0xc9f1('0x1'));var BPromise=require('bluebird');var rs=require(_0xc9f1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc9f1('0x3'))['db'];var utils=require(_0xc9f1('0x4'));var logger=require(_0xc9f1('0x5'))(_0xc9f1('0x6'));var config=require(_0xc9f1('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc9f1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c3b53,_0x1b11c0,_0x3f5000){return new BPromise(function(_0x214d46,_0x36451a){return client[_0xc9f1('0x9')](_0x5c3b53,_0x3f5000)[_0xc9f1('0xa')](function(_0x578209){logger[_0xc9f1('0xb')](_0xc9f1('0xc'),_0x1b11c0,'request\x20sent');logger[_0xc9f1('0xd')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x1b11c0,'request\x20sent',JSON[_0xc9f1('0xe')](_0x578209));if(_0x578209[_0xc9f1('0xf')]){if(_0x578209[_0xc9f1('0xf')][_0xc9f1('0x10')]===0x1f4){logger[_0xc9f1('0xf')](_0xc9f1('0xc'),_0x1b11c0,_0x578209['error'][_0xc9f1('0x11')]);return _0x36451a(_0x578209[_0xc9f1('0xf')][_0xc9f1('0x11')]);}logger[_0xc9f1('0xf')](_0xc9f1('0xc'),_0x1b11c0,_0x578209[_0xc9f1('0xf')]['message']);return _0x214d46(_0x578209['error']['message']);}else{logger[_0xc9f1('0xb')](_0xc9f1('0xc'),_0x1b11c0,_0xc9f1('0x12'));_0x214d46(_0x578209['result']['message']);}})[_0xc9f1('0x13')](function(_0x381498){logger[_0xc9f1('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x1b11c0,_0x381498);_0x36451a(_0x381498);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 4154442..3113fd6 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 _0x2ec7=['../../config/environment','./intVtigerField.controller','index','get','/:id','isAuthenticated','post','create','put','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x185ba5,_0x23ea0b){var _0x1811d2=function(_0x42ff66){while(--_0x42ff66){_0x185ba5['push'](_0x185ba5['shift']());}};_0x1811d2(++_0x23ea0b);}(_0x2ec7,0x14e));var _0x72ec=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x2ec7[_0x199572];return _0x13cfa3;};'use strict';var multer=require(_0x72ec('0x0'));var util=require('util');var path=require(_0x72ec('0x1'));var timeout=require(_0x72ec('0x2'));var express=require(_0x72ec('0x3'));var router=express[_0x72ec('0x4')]();var fs_extra=require(_0x72ec('0x5'));var auth=require(_0x72ec('0x6'));var interaction=require(_0x72ec('0x7'));var config=require(_0x72ec('0x8'));var controller=require(_0x72ec('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x72ec('0xa')]);router[_0x72ec('0xb')](_0x72ec('0xc'),auth[_0x72ec('0xd')](),controller['show']);router[_0x72ec('0xe')]('/',auth[_0x72ec('0xd')](),controller[_0x72ec('0xf')]);router[_0x72ec('0x10')](_0x72ec('0xc'),auth[_0x72ec('0xd')](),controller['update']);router['delete'](_0x72ec('0xc'),auth[_0x72ec('0xd')](),controller[_0x72ec('0x11')]);module['exports']=router; \ No newline at end of file +var _0x7bec=['util','express','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerField.controller','index','get','/:id','isAuthenticated','show','post','create','update','delete','exports','multer'];(function(_0x1ee2a1,_0x465e4e){var _0x390f66=function(_0x1e328e){while(--_0x1e328e){_0x1ee2a1['push'](_0x1ee2a1['shift']());}};_0x390f66(++_0x465e4e);}(_0x7bec,0xa9));var _0xc7be=function(_0x428941,_0x30eea5){_0x428941=_0x428941-0x0;var _0x6c25f=_0x7bec[_0x428941];return _0x6c25f;};'use strict';var multer=require(_0xc7be('0x0'));var util=require(_0xc7be('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc7be('0x2'));var router=express['Router']();var fs_extra=require(_0xc7be('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xc7be('0x4'));var config=require(_0xc7be('0x5'));var controller=require(_0xc7be('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xc7be('0x7')]);router[_0xc7be('0x8')](_0xc7be('0x9'),auth[_0xc7be('0xa')](),controller[_0xc7be('0xb')]);router[_0xc7be('0xc')]('/',auth[_0xc7be('0xa')](),controller[_0xc7be('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc7be('0xe')]);router[_0xc7be('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc7be('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 932febf..83232f8 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 _0xdc96=['exports','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x40fd6d,_0x3d49f3){var _0x278fcf=function(_0x4e3346){while(--_0x4e3346){_0x40fd6d['push'](_0x40fd6d['shift']());}};_0x278fcf(++_0x3d49f3);}(_0xdc96,0xaf));var _0x6dc9=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xdc96[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require('sequelize');module[_0x6dc9('0x0')]={'type':{'type':Sequelize[_0x6dc9('0x1')](_0x6dc9('0x2'),_0x6dc9('0x3'),_0x6dc9('0x4'),'keyValue',_0x6dc9('0x5')),'defaultValue':_0x6dc9('0x2')},'content':{'type':Sequelize[_0x6dc9('0x6')]},'key':{'type':Sequelize[_0x6dc9('0x6')]},'keyType':{'type':Sequelize[_0x6dc9('0x1')](_0x6dc9('0x2'),_0x6dc9('0x3'),_0x6dc9('0x4'))},'keyContent':{'type':Sequelize[_0x6dc9('0x6')]},'idField':{'type':Sequelize[_0x6dc9('0x6')]},'nameField':{'type':Sequelize[_0x6dc9('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0032=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x250e29,_0x5f2ecc){var _0x5a36af=function(_0x185acf){while(--_0x185acf){_0x250e29['push'](_0x250e29['shift']());}};_0x5a36af(++_0x5f2ecc);}(_0x0032,0xbb));var _0x2003=function(_0x183f92,_0x13326f){_0x183f92=_0x183f92-0x0;var _0x2be6f2=_0x0032[_0x183f92];return _0x2be6f2;};'use strict';var Sequelize=require(_0x2003('0x0'));module[_0x2003('0x1')]={'type':{'type':Sequelize[_0x2003('0x2')](_0x2003('0x3'),_0x2003('0x4'),_0x2003('0x5'),_0x2003('0x6'),_0x2003('0x7')),'defaultValue':_0x2003('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2003('0x8')]},'keyType':{'type':Sequelize[_0x2003('0x2')](_0x2003('0x3'),'variable',_0x2003('0x5'))},'keyContent':{'type':Sequelize[_0x2003('0x8')]},'idField':{'type':Sequelize[_0x2003('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2003('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2003('0x8')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 0599c7d..5f93849 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 _0xf3d5=['update','then','destroy','name','index','map','VtigerField','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','include','findAll','rows','catch','show','params','includeAll','find','create','body','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xf3d5,0x135));var _0x5f3d=function(_0x27f4ac,_0x1a0088){_0x27f4ac=_0x27f4ac-0x0;var _0x2c860a=_0xf3d5[_0x27f4ac];return _0x2c860a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5f3d('0x0'));var zipdir=require(_0x5f3d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5f3d('0x2'));var moment=require(_0x5f3d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5f3d('0x4'));var util=require(_0x5f3d('0x5'));var path=require('path');var sox=require(_0x5f3d('0x6'));var csv=require(_0x5f3d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5f3d('0x8'));var jsforce=require(_0x5f3d('0x9'));var deskjs=require(_0x5f3d('0xa'));var toCsv=require('to-csv');var querystring=require(_0x5f3d('0xb'));var Papa=require(_0x5f3d('0xc'));var Redis=require('ioredis');var authService=require(_0x5f3d('0xd'));var qs=require(_0x5f3d('0xe'));var as=require(_0x5f3d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5f3d('0x10'));var utils=require(_0x5f3d('0x11'));var config=require(_0x5f3d('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x5f3d('0x13'))['db'];function respondWithStatusCode(_0x4404d7,_0xc562f8){_0xc562f8=_0xc562f8||0xcc;return function(_0xa3eea1){if(_0xa3eea1){return _0x4404d7[_0x5f3d('0x14')](_0xc562f8);}return _0x4404d7[_0x5f3d('0x15')](_0xc562f8)[_0x5f3d('0x16')]();};}function respondWithResult(_0x20e845,_0x1181f5){_0x1181f5=_0x1181f5||0xc8;return function(_0x2f06df){if(_0x2f06df){return _0x20e845[_0x5f3d('0x15')](_0x1181f5)[_0x5f3d('0x17')](_0x2f06df);}};}function respondWithFilteredResult(_0x2eef1d,_0x1c3281){return function(_0x52a2f7){if(_0x52a2f7){var _0x5c6a93=typeof _0x1c3281[_0x5f3d('0x18')]==='undefined'&&typeof _0x1c3281[_0x5f3d('0x19')]==='undefined';var _0xeea13c=_0x52a2f7['count'];var _0x261d8a=_0x5c6a93?0x0:_0x1c3281['offset'];var _0x41da17=_0x5c6a93?_0x52a2f7['count']:_0x1c3281['offset']+_0x1c3281[_0x5f3d('0x19')];var _0x25ac97;if(_0x41da17>=_0xeea13c){_0x41da17=_0xeea13c;_0x25ac97=0xc8;}else{_0x25ac97=0xce;}_0x2eef1d[_0x5f3d('0x15')](_0x25ac97);return _0x2eef1d[_0x5f3d('0x1a')](_0x5f3d('0x1b'),_0x261d8a+'-'+_0x41da17+'/'+_0xeea13c)[_0x5f3d('0x17')](_0x52a2f7);}return null;};}function patchUpdates(_0x211977){return function(_0xe3eccf){try{jsonpatch[_0x5f3d('0x1c')](_0xe3eccf,_0x211977,!![]);}catch(_0xd54e6b){return BPromise[_0x5f3d('0x1d')](_0xd54e6b);}return _0xe3eccf[_0x5f3d('0x1e')]();};}function saveUpdates(_0x13322a,_0x27229a){return function(_0x4d781f){if(_0x4d781f){return _0x4d781f[_0x5f3d('0x1f')](_0x13322a)[_0x5f3d('0x20')](function(_0x54ae30){return _0x54ae30;});}return null;};}function removeEntity(_0x333332,_0x1957e1){return function(_0x357832){if(_0x357832){return _0x357832[_0x5f3d('0x21')]()['then'](function(){_0x333332[_0x5f3d('0x15')](0xcc)[_0x5f3d('0x16')]();});}};}function handleEntityNotFound(_0x3cbe05,_0x15a275){return function(_0x34a397){if(!_0x34a397){_0x3cbe05['sendStatus'](0x194);}return _0x34a397;};}function handleError(_0x280092,_0x13cf88){_0x13cf88=_0x13cf88||0x1f4;return function(_0x2d9a52){logger['error'](_0x2d9a52['stack']);if(_0x2d9a52[_0x5f3d('0x22')]){delete _0x2d9a52['name'];}_0x280092[_0x5f3d('0x15')](_0x13cf88)['send'](_0x2d9a52);};}exports[_0x5f3d('0x23')]=function(_0x2f0050,_0x343af4){var _0x483bf0={},_0x23840e={},_0x2c8d9f={'count':0x0,'rows':[]};var _0x81dcd7=_[_0x5f3d('0x24')](db[_0x5f3d('0x25')][_0x5f3d('0x26')],function(_0x2c4cd1){return{'name':_0x2c4cd1['fieldName'],'type':_0x2c4cd1['type']['key']};});_0x23840e['model']=_[_0x5f3d('0x24')](_0x81dcd7,_0x5f3d('0x22'));_0x23840e[_0x5f3d('0x27')]=_[_0x5f3d('0x28')](_0x2f0050[_0x5f3d('0x27')]);_0x23840e[_0x5f3d('0x29')]=_[_0x5f3d('0x2a')](_0x23840e[_0x5f3d('0x2b')],_0x23840e[_0x5f3d('0x27')]);_0x483bf0['attributes']=_['intersection'](_0x23840e[_0x5f3d('0x2b')],qs[_0x5f3d('0x2c')](_0x2f0050['query'][_0x5f3d('0x2c')]));_0x483bf0[_0x5f3d('0x2d')]=_0x483bf0['attributes'][_0x5f3d('0x2e')]?_0x483bf0[_0x5f3d('0x2d')]:_0x23840e[_0x5f3d('0x2b')];if(!_0x2f0050[_0x5f3d('0x27')][_0x5f3d('0x2f')](_0x5f3d('0x30'))){_0x483bf0[_0x5f3d('0x19')]=qs['limit'](_0x2f0050['query']['limit']);_0x483bf0[_0x5f3d('0x18')]=qs['offset'](_0x2f0050[_0x5f3d('0x27')][_0x5f3d('0x18')]);}_0x483bf0[_0x5f3d('0x31')]=qs[_0x5f3d('0x32')](_0x2f0050[_0x5f3d('0x27')][_0x5f3d('0x32')]);_0x483bf0[_0x5f3d('0x33')]=qs[_0x5f3d('0x29')](_[_0x5f3d('0x34')](_0x2f0050['query'],_0x23840e['filters']),_0x81dcd7);if(_0x2f0050[_0x5f3d('0x27')][_0x5f3d('0x35')]){_0x483bf0[_0x5f3d('0x33')]=_['merge'](_0x483bf0[_0x5f3d('0x33')],{'$or':_[_0x5f3d('0x24')](_0x81dcd7,function(_0x18afda){if(_0x18afda['type']!==_0x5f3d('0x36')){var _0x5213f6={};_0x5213f6[_0x18afda[_0x5f3d('0x22')]]={'$like':'%'+_0x2f0050[_0x5f3d('0x27')][_0x5f3d('0x35')]+'%'};return _0x5213f6;}})});}_0x483bf0=_[_0x5f3d('0x37')]({},_0x483bf0,_0x2f0050[_0x5f3d('0x38')]);var _0x29ab72={'where':_0x483bf0[_0x5f3d('0x33')]};return db[_0x5f3d('0x25')][_0x5f3d('0x39')](_0x29ab72)[_0x5f3d('0x20')](function(_0x21f053){_0x2c8d9f[_0x5f3d('0x39')]=_0x21f053;if(_0x2f0050[_0x5f3d('0x27')]['includeAll']){_0x483bf0[_0x5f3d('0x3a')]=[{'all':!![]}];}return db[_0x5f3d('0x25')][_0x5f3d('0x3b')](_0x483bf0);})[_0x5f3d('0x20')](function(_0x11b0a4){_0x2c8d9f[_0x5f3d('0x3c')]=_0x11b0a4;return _0x2c8d9f;})[_0x5f3d('0x20')](respondWithFilteredResult(_0x343af4,_0x483bf0))[_0x5f3d('0x3d')](handleError(_0x343af4,null));};exports[_0x5f3d('0x3e')]=function(_0x3c4108,_0x1bf8f5){var _0x332a32={'raw':!![],'where':{'id':_0x3c4108[_0x5f3d('0x3f')]['id']}},_0x1473bb={};_0x1473bb[_0x5f3d('0x2b')]=_[_0x5f3d('0x28')](db[_0x5f3d('0x25')][_0x5f3d('0x26')]);_0x1473bb[_0x5f3d('0x27')]=_[_0x5f3d('0x28')](_0x3c4108[_0x5f3d('0x27')]);_0x1473bb[_0x5f3d('0x29')]=_[_0x5f3d('0x2a')](_0x1473bb[_0x5f3d('0x2b')],_0x1473bb['query']);_0x332a32['attributes']=_[_0x5f3d('0x2a')](_0x1473bb[_0x5f3d('0x2b')],qs[_0x5f3d('0x2c')](_0x3c4108[_0x5f3d('0x27')][_0x5f3d('0x2c')]));_0x332a32['attributes']=_0x332a32[_0x5f3d('0x2d')]['length']?_0x332a32['attributes']:_0x1473bb[_0x5f3d('0x2b')];if(_0x3c4108['query'][_0x5f3d('0x40')]){_0x332a32[_0x5f3d('0x3a')]=[{'all':!![]}];}_0x332a32=_['merge']({},_0x332a32,_0x3c4108[_0x5f3d('0x38')]);return db[_0x5f3d('0x25')][_0x5f3d('0x41')](_0x332a32)[_0x5f3d('0x20')](handleEntityNotFound(_0x1bf8f5,null))[_0x5f3d('0x20')](respondWithResult(_0x1bf8f5,null))[_0x5f3d('0x3d')](handleError(_0x1bf8f5,null));};exports[_0x5f3d('0x42')]=function(_0x172f1b,_0x74e4bd){return db['VtigerField'][_0x5f3d('0x42')](_0x172f1b[_0x5f3d('0x43')],{})[_0x5f3d('0x20')](respondWithResult(_0x74e4bd,0xc9))[_0x5f3d('0x3d')](handleError(_0x74e4bd,null));};exports[_0x5f3d('0x1f')]=function(_0x424a6b,_0x2596f7){if(_0x424a6b[_0x5f3d('0x43')]['id']){delete _0x424a6b[_0x5f3d('0x43')]['id'];}return db[_0x5f3d('0x25')][_0x5f3d('0x41')]({'where':{'id':_0x424a6b[_0x5f3d('0x3f')]['id']}})[_0x5f3d('0x20')](handleEntityNotFound(_0x2596f7,null))['then'](saveUpdates(_0x424a6b['body'],null))[_0x5f3d('0x20')](respondWithResult(_0x2596f7,null))['catch'](handleError(_0x2596f7,null));};exports[_0x5f3d('0x21')]=function(_0x2ec765,_0x3c2e6a){return db['VtigerField'][_0x5f3d('0x41')]({'where':{'id':_0x2ec765[_0x5f3d('0x3f')]['id']}})[_0x5f3d('0x20')](handleEntityNotFound(_0x3c2e6a,null))[_0x5f3d('0x20')](removeEntity(_0x3c2e6a,null))[_0x5f3d('0x3d')](handleError(_0x3c2e6a,null));}; \ No newline at end of file +var _0xcf7d=['VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','json','apply','reject','save','update','destroy','then','error','name','send','map','VtigerField','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge'];(function(_0x1f99a0,_0x50b73d){var _0x1e0849=function(_0x41e764){while(--_0x41e764){_0x1f99a0['push'](_0x1f99a0['shift']());}};_0x1e0849(++_0x50b73d);}(_0xcf7d,0x130));var _0xdcf7=function(_0xba87cb,_0x1de0b4){_0xba87cb=_0xba87cb-0x0;var _0x4dffef=_0xcf7d[_0xba87cb];return _0x4dffef;};'use strict';var emlformat=require(_0xdcf7('0x0'));var rimraf=require(_0xdcf7('0x1'));var zipdir=require(_0xdcf7('0x2'));var jsonpatch=require(_0xdcf7('0x3'));var rp=require('request-promise');var moment=require(_0xdcf7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdcf7('0x5'));var util=require(_0xdcf7('0x6'));var path=require('path');var sox=require(_0xdcf7('0x7'));var csv=require(_0xdcf7('0x8'));var ejs=require(_0xdcf7('0x9'));var fs=require('fs');var fs_extra=require(_0xdcf7('0xa'));var _=require(_0xdcf7('0xb'));var squel=require(_0xdcf7('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdcf7('0xd'));var toCsv=require(_0xdcf7('0x8'));var querystring=require(_0xdcf7('0xe'));var Papa=require('papaparse');var Redis=require(_0xdcf7('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdcf7('0x10'));var hardwareService=require(_0xdcf7('0x11'));var logger=require('../../config/logger')(_0xdcf7('0x12'));var utils=require(_0xdcf7('0x13'));var config=require(_0xdcf7('0x14'));var licenseUtil=require(_0xdcf7('0x15'));var db=require(_0xdcf7('0x16'))['db'];function respondWithStatusCode(_0x5e8104,_0x3ff2d2){_0x3ff2d2=_0x3ff2d2||0xcc;return function(_0x2ef107){if(_0x2ef107){return _0x5e8104[_0xdcf7('0x17')](_0x3ff2d2);}return _0x5e8104[_0xdcf7('0x18')](_0x3ff2d2)[_0xdcf7('0x19')]();};}function respondWithResult(_0x44e425,_0x12f103){_0x12f103=_0x12f103||0xc8;return function(_0x387f65){if(_0x387f65){return _0x44e425[_0xdcf7('0x18')](_0x12f103)['json'](_0x387f65);}};}function respondWithFilteredResult(_0x571647,_0x4a7cfd){return function(_0x18e1e9){if(_0x18e1e9){var _0x4ebcaf=typeof _0x4a7cfd[_0xdcf7('0x1a')]===_0xdcf7('0x1b')&&typeof _0x4a7cfd['limit']===_0xdcf7('0x1b');var _0xb4590e=_0x18e1e9[_0xdcf7('0x1c')];var _0x1f9940=_0x4ebcaf?0x0:_0x4a7cfd[_0xdcf7('0x1a')];var _0x167174=_0x4ebcaf?_0x18e1e9['count']:_0x4a7cfd['offset']+_0x4a7cfd[_0xdcf7('0x1d')];var _0x49be8d;if(_0x167174>=_0xb4590e){_0x167174=_0xb4590e;_0x49be8d=0xc8;}else{_0x49be8d=0xce;}_0x571647[_0xdcf7('0x18')](_0x49be8d);return _0x571647['set']('Content-Range',_0x1f9940+'-'+_0x167174+'/'+_0xb4590e)[_0xdcf7('0x1e')](_0x18e1e9);}return null;};}function patchUpdates(_0x369283){return function(_0x23b73c){try{jsonpatch[_0xdcf7('0x1f')](_0x23b73c,_0x369283,!![]);}catch(_0x28aaca){return BPromise[_0xdcf7('0x20')](_0x28aaca);}return _0x23b73c[_0xdcf7('0x21')]();};}function saveUpdates(_0x235f8d,_0x206a43){return function(_0x2b544e){if(_0x2b544e){return _0x2b544e[_0xdcf7('0x22')](_0x235f8d)['then'](function(_0x4d817b){return _0x4d817b;});}return null;};}function removeEntity(_0x130f71,_0x24353e){return function(_0x29b63f){if(_0x29b63f){return _0x29b63f[_0xdcf7('0x23')]()[_0xdcf7('0x24')](function(){_0x130f71[_0xdcf7('0x18')](0xcc)[_0xdcf7('0x19')]();});}};}function handleEntityNotFound(_0x4deef0,_0x2a1480){return function(_0x4aa609){if(!_0x4aa609){_0x4deef0[_0xdcf7('0x17')](0x194);}return _0x4aa609;};}function handleError(_0x5b5ad7,_0x1880ff){_0x1880ff=_0x1880ff||0x1f4;return function(_0x21ae87){logger[_0xdcf7('0x25')](_0x21ae87['stack']);if(_0x21ae87[_0xdcf7('0x26')]){delete _0x21ae87[_0xdcf7('0x26')];}_0x5b5ad7[_0xdcf7('0x18')](_0x1880ff)[_0xdcf7('0x27')](_0x21ae87);};}exports['index']=function(_0x15bf2a,_0x4d53e7){var _0x11d850={},_0x192f22={},_0x22d9a3={'count':0x0,'rows':[]};var _0x172590=_[_0xdcf7('0x28')](db[_0xdcf7('0x29')][_0xdcf7('0x2a')],function(_0x42c6bb){return{'name':_0x42c6bb[_0xdcf7('0x2b')],'type':_0x42c6bb[_0xdcf7('0x2c')][_0xdcf7('0x2d')]};});_0x192f22[_0xdcf7('0x2e')]=_[_0xdcf7('0x28')](_0x172590,_0xdcf7('0x26'));_0x192f22[_0xdcf7('0x2f')]=_[_0xdcf7('0x30')](_0x15bf2a[_0xdcf7('0x2f')]);_0x192f22['filters']=_['intersection'](_0x192f22[_0xdcf7('0x2e')],_0x192f22['query']);_0x11d850['attributes']=_[_0xdcf7('0x31')](_0x192f22[_0xdcf7('0x2e')],qs['fields'](_0x15bf2a['query'][_0xdcf7('0x32')]));_0x11d850[_0xdcf7('0x33')]=_0x11d850[_0xdcf7('0x33')]['length']?_0x11d850[_0xdcf7('0x33')]:_0x192f22['model'];if(!_0x15bf2a[_0xdcf7('0x2f')][_0xdcf7('0x34')](_0xdcf7('0x35'))){_0x11d850[_0xdcf7('0x1d')]=qs[_0xdcf7('0x1d')](_0x15bf2a[_0xdcf7('0x2f')][_0xdcf7('0x1d')]);_0x11d850[_0xdcf7('0x1a')]=qs[_0xdcf7('0x1a')](_0x15bf2a[_0xdcf7('0x2f')]['offset']);}_0x11d850[_0xdcf7('0x36')]=qs[_0xdcf7('0x37')](_0x15bf2a[_0xdcf7('0x2f')][_0xdcf7('0x37')]);_0x11d850[_0xdcf7('0x38')]=qs[_0xdcf7('0x39')](_[_0xdcf7('0x3a')](_0x15bf2a[_0xdcf7('0x2f')],_0x192f22['filters']),_0x172590);if(_0x15bf2a[_0xdcf7('0x2f')][_0xdcf7('0x3b')]){_0x11d850[_0xdcf7('0x38')]=_[_0xdcf7('0x3c')](_0x11d850[_0xdcf7('0x38')],{'$or':_['map'](_0x172590,function(_0x51a315){if(_0x51a315['type']!==_0xdcf7('0x3d')){var _0x16c9f9={};_0x16c9f9[_0x51a315['name']]={'$like':'%'+_0x15bf2a[_0xdcf7('0x2f')][_0xdcf7('0x3b')]+'%'};return _0x16c9f9;}})});}_0x11d850=_['merge']({},_0x11d850,_0x15bf2a[_0xdcf7('0x3e')]);var _0x1f1e43={'where':_0x11d850['where']};return db[_0xdcf7('0x29')][_0xdcf7('0x1c')](_0x1f1e43)[_0xdcf7('0x24')](function(_0x2a2f1a){_0x22d9a3[_0xdcf7('0x1c')]=_0x2a2f1a;if(_0x15bf2a[_0xdcf7('0x2f')][_0xdcf7('0x3f')]){_0x11d850[_0xdcf7('0x40')]=[{'all':!![]}];}return db[_0xdcf7('0x29')][_0xdcf7('0x41')](_0x11d850);})['then'](function(_0x16427f){_0x22d9a3[_0xdcf7('0x42')]=_0x16427f;return _0x22d9a3;})[_0xdcf7('0x24')](respondWithFilteredResult(_0x4d53e7,_0x11d850))[_0xdcf7('0x43')](handleError(_0x4d53e7,null));};exports['show']=function(_0x4c90c7,_0x507aae){var _0x4809c6={'raw':!![],'where':{'id':_0x4c90c7[_0xdcf7('0x44')]['id']}},_0x1155df={};_0x1155df[_0xdcf7('0x2e')]=_[_0xdcf7('0x30')](db['VtigerField'][_0xdcf7('0x2a')]);_0x1155df[_0xdcf7('0x2f')]=_['keys'](_0x4c90c7[_0xdcf7('0x2f')]);_0x1155df[_0xdcf7('0x39')]=_[_0xdcf7('0x31')](_0x1155df[_0xdcf7('0x2e')],_0x1155df[_0xdcf7('0x2f')]);_0x4809c6[_0xdcf7('0x33')]=_['intersection'](_0x1155df['model'],qs['fields'](_0x4c90c7[_0xdcf7('0x2f')][_0xdcf7('0x32')]));_0x4809c6[_0xdcf7('0x33')]=_0x4809c6[_0xdcf7('0x33')][_0xdcf7('0x45')]?_0x4809c6[_0xdcf7('0x33')]:_0x1155df[_0xdcf7('0x2e')];if(_0x4c90c7['query'][_0xdcf7('0x3f')]){_0x4809c6[_0xdcf7('0x40')]=[{'all':!![]}];}_0x4809c6=_[_0xdcf7('0x3c')]({},_0x4809c6,_0x4c90c7[_0xdcf7('0x3e')]);return db[_0xdcf7('0x29')][_0xdcf7('0x46')](_0x4809c6)[_0xdcf7('0x24')](handleEntityNotFound(_0x507aae,null))['then'](respondWithResult(_0x507aae,null))[_0xdcf7('0x43')](handleError(_0x507aae,null));};exports[_0xdcf7('0x47')]=function(_0x5a075c,_0x108097){return db[_0xdcf7('0x29')]['create'](_0x5a075c[_0xdcf7('0x48')],{})[_0xdcf7('0x24')](respondWithResult(_0x108097,0xc9))[_0xdcf7('0x43')](handleError(_0x108097,null));};exports[_0xdcf7('0x22')]=function(_0x40d3f8,_0xa4ed8){if(_0x40d3f8['body']['id']){delete _0x40d3f8[_0xdcf7('0x48')]['id'];}return db[_0xdcf7('0x29')]['find']({'where':{'id':_0x40d3f8['params']['id']}})[_0xdcf7('0x24')](handleEntityNotFound(_0xa4ed8,null))[_0xdcf7('0x24')](saveUpdates(_0x40d3f8[_0xdcf7('0x48')],null))[_0xdcf7('0x24')](respondWithResult(_0xa4ed8,null))[_0xdcf7('0x43')](handleError(_0xa4ed8,null));};exports[_0xdcf7('0x23')]=function(_0x5c45f2,_0x22ca00){return db[_0xdcf7('0x29')][_0xdcf7('0x46')]({'where':{'id':_0x5c45f2[_0xdcf7('0x44')]['id']}})[_0xdcf7('0x24')](handleEntityNotFound(_0x22ca00,null))[_0xdcf7('0x24')](removeEntity(_0x22ca00,null))[_0xdcf7('0x43')](handleError(_0x22ca00,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 6598af5..0b77bac 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 _0xe309=['bluebird','request-promise','path','../../config/environment','exports','int_vtiger_fields','vtiger_unique_index','idField','FieldId','../../config/logger','api','moment'];(function(_0x1f1402,_0x36059f){var _0x11426b=function(_0x4b27a8){while(--_0x4b27a8){_0x1f1402['push'](_0x1f1402['shift']());}};_0x11426b(++_0x36059f);}(_0xe309,0x11d));var _0x9e30=function(_0x2fc97c,_0x142a8b){_0x2fc97c=_0x2fc97c-0x0;var _0x3f17c1=_0xe309[_0x2fc97c];return _0x3f17c1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9e30('0x0'))(_0x9e30('0x1'));var moment=require(_0x9e30('0x2'));var BPromise=require(_0x9e30('0x3'));var rp=require(_0x9e30('0x4'));var fs=require('fs');var path=require(_0x9e30('0x5'));var rimraf=require('rimraf');var config=require(_0x9e30('0x6'));var attributes=require('./intVtigerField.attributes');module[_0x9e30('0x7')]=function(_0x8e41b7,_0x5761e0){return _0x8e41b7['define']('VtigerField',attributes,{'tableName':_0x9e30('0x8'),'paranoid':![],'indexes':[{'name':_0x9e30('0x9'),'fields':[_0x9e30('0xa'),_0x9e30('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd5c2=['vtiger_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define'];(function(_0x48d9c4,_0x26c211){var _0x3f2080=function(_0x479bc9){while(--_0x479bc9){_0x48d9c4['push'](_0x48d9c4['shift']());}};_0x3f2080(++_0x26c211);}(_0xd5c2,0xa7));var _0x2d5c=function(_0x33a8e3,_0x2fbd69){_0x33a8e3=_0x33a8e3-0x0;var _0x255050=_0xd5c2[_0x33a8e3];return _0x255050;};'use strict';var _=require(_0x2d5c('0x0'));var util=require(_0x2d5c('0x1'));var logger=require(_0x2d5c('0x2'))(_0x2d5c('0x3'));var moment=require(_0x2d5c('0x4'));var BPromise=require(_0x2d5c('0x5'));var rp=require(_0x2d5c('0x6'));var fs=require('fs');var path=require(_0x2d5c('0x7'));var rimraf=require(_0x2d5c('0x8'));var config=require(_0x2d5c('0x9'));var attributes=require(_0x2d5c('0xa'));module[_0x2d5c('0xb')]=function(_0x572930,_0xfed415){return _0x572930[_0x2d5c('0xc')]('VtigerField',attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x2d5c('0xd'),'fields':['idField',_0x2d5c('0xe')],'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 cba43dd..a8a5642 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 _0x1fa8=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','message','error','result','catch'];(function(_0x115186,_0x1baa42){var _0x38349f=function(_0x390c0a){while(--_0x390c0a){_0x115186['push'](_0x115186['shift']());}};_0x38349f(++_0x1baa42);}(_0x1fa8,0x1cc));var _0x81fa=function(_0x3d95e9,_0x45bb17){_0x3d95e9=_0x3d95e9-0x0;var _0x472c9a=_0x1fa8[_0x3d95e9];return _0x472c9a;};'use strict';var _=require(_0x81fa('0x0'));var util=require(_0x81fa('0x1'));var moment=require(_0x81fa('0x2'));var BPromise=require('bluebird');var rs=require(_0x81fa('0x3'));var fs=require('fs');var Redis=require(_0x81fa('0x4'));var db=require(_0x81fa('0x5'))['db'];var utils=require(_0x81fa('0x6'));var logger=require(_0x81fa('0x7'))(_0x81fa('0x8'));var config=require(_0x81fa('0x9'));var jayson=require(_0x81fa('0xa'));var client=jayson[_0x81fa('0xb')][_0x81fa('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x234566,_0x62b634,_0x2c115b){return new BPromise(function(_0x5e36d9,_0x36362f){return client[_0x81fa('0xd')](_0x234566,_0x2c115b)[_0x81fa('0xe')](function(_0x44157c){logger[_0x81fa('0xf')](_0x81fa('0x10'),_0x62b634,_0x81fa('0x11'));logger[_0x81fa('0x12')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x62b634,_0x81fa('0x11'),JSON['stringify'](_0x44157c));if(_0x44157c['error']){if(_0x44157c['error']['code']===0x1f4){logger['error'](_0x81fa('0x10'),_0x62b634,_0x44157c['error'][_0x81fa('0x13')]);return _0x36362f(_0x44157c['error']['message']);}logger[_0x81fa('0x14')]('VtigerField,\x20%s,\x20%s',_0x62b634,_0x44157c[_0x81fa('0x14')][_0x81fa('0x13')]);return _0x5e36d9(_0x44157c[_0x81fa('0x14')][_0x81fa('0x13')]);}else{logger[_0x81fa('0xf')](_0x81fa('0x10'),_0x62b634,'request\x20sent');_0x5e36d9(_0x44157c[_0x81fa('0x15')][_0x81fa('0x13')]);}})[_0x81fa('0x16')](function(_0x134f3c){logger[_0x81fa('0x14')](_0x81fa('0x10'),_0x62b634,_0x134f3c);_0x36362f(_0x134f3c);});});} \ No newline at end of file +var _0x6060=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0xaa44a2,_0x18110a){var _0x5bc606=function(_0x4e34d5){while(--_0x4e34d5){_0xaa44a2['push'](_0xaa44a2['shift']());}};_0x5bc606(++_0x18110a);}(_0x6060,0xd0));var _0x0606=function(_0xa6b085,_0x7728a0){_0xa6b085=_0xa6b085-0x0;var _0x1a1e4c=_0x6060[_0xa6b085];return _0x1a1e4c;};'use strict';var _=require(_0x0606('0x0'));var util=require(_0x0606('0x1'));var moment=require(_0x0606('0x2'));var BPromise=require(_0x0606('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0606('0x4'))['db'];var utils=require(_0x0606('0x5'));var logger=require(_0x0606('0x6'))(_0x0606('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x204aac,_0x2889a4,_0x59bdeb){return new BPromise(function(_0x3c338b,_0x1b95d0){return client[_0x0606('0x8')](_0x204aac,_0x59bdeb)[_0x0606('0x9')](function(_0x530922){logger['info'](_0x0606('0xa'),_0x2889a4,_0x0606('0xb'));logger[_0x0606('0xc')](_0x0606('0xd'),_0x2889a4,_0x0606('0xb'),JSON[_0x0606('0xe')](_0x530922));if(_0x530922['error']){if(_0x530922[_0x0606('0xf')][_0x0606('0x10')]===0x1f4){logger[_0x0606('0xf')](_0x0606('0xa'),_0x2889a4,_0x530922[_0x0606('0xf')][_0x0606('0x11')]);return _0x1b95d0(_0x530922[_0x0606('0xf')][_0x0606('0x11')]);}logger[_0x0606('0xf')]('VtigerField,\x20%s,\x20%s',_0x2889a4,_0x530922[_0x0606('0xf')][_0x0606('0x11')]);return _0x3c338b(_0x530922[_0x0606('0xf')][_0x0606('0x11')]);}else{logger[_0x0606('0x12')](_0x0606('0xa'),_0x2889a4,_0x0606('0xb'));_0x3c338b(_0x530922[_0x0606('0x13')][_0x0606('0x11')]);}})[_0x0606('0x14')](function(_0x1190b1){logger[_0x0606('0xf')](_0x0606('0xa'),_0x2889a4,_0x1190b1);_0x1b95d0(_0x1190b1);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 5529d36..5d6e2ce 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 _0x9bdb=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','show','getConfigurations','/:id/fields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x30a067,_0x48dbc6){var _0x1cdaec=function(_0xd5de5){while(--_0xd5de5){_0x30a067['push'](_0x30a067['shift']());}};_0x1cdaec(++_0x48dbc6);}(_0x9bdb,0x13c));var _0xb9bd=function(_0xdc1284,_0xe13c86){_0xdc1284=_0xdc1284-0x0;var _0x1def81=_0x9bdb[_0xdc1284];return _0x1def81;};'use strict';var multer=require(_0xb9bd('0x0'));var util=require(_0xb9bd('0x1'));var path=require(_0xb9bd('0x2'));var timeout=require(_0xb9bd('0x3'));var express=require('express');var router=express[_0xb9bd('0x4')]();var fs_extra=require(_0xb9bd('0x5'));var auth=require(_0xb9bd('0x6'));var interaction=require(_0xb9bd('0x7'));var config=require(_0xb9bd('0x8'));var controller=require(_0xb9bd('0x9'));router[_0xb9bd('0xa')]('/',auth[_0xb9bd('0xb')](),controller['index']);router[_0xb9bd('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xb9bd('0xc')]);router[_0xb9bd('0xa')]('/:id/configurations',auth[_0xb9bd('0xb')](),controller[_0xb9bd('0xd')]);router[_0xb9bd('0xa')](_0xb9bd('0xe'),auth[_0xb9bd('0xb')](),controller['getFields']);router['post']('/',auth[_0xb9bd('0xb')](),controller[_0xb9bd('0xf')]);router[_0xb9bd('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xb9bd('0x11')]);router[_0xb9bd('0x12')]('/:id',auth[_0xb9bd('0xb')](),controller[_0xb9bd('0x13')]);router[_0xb9bd('0x14')]('/:id',auth[_0xb9bd('0xb')](),controller[_0xb9bd('0x15')]);module[_0xb9bd('0x16')]=router; \ No newline at end of file +var _0xacff=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get'];(function(_0x52bc0a,_0x5220df){var _0x4bb809=function(_0x59eae5){while(--_0x59eae5){_0x52bc0a['push'](_0x52bc0a['shift']());}};_0x4bb809(++_0x5220df);}(_0xacff,0x116));var _0xfacf=function(_0x12c2d1,_0x2d5304){_0x12c2d1=_0x12c2d1-0x0;var _0x5e808c=_0xacff[_0x12c2d1];return _0x5e808c;};'use strict';var multer=require('multer');var util=require(_0xfacf('0x0'));var path=require(_0xfacf('0x1'));var timeout=require(_0xfacf('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xfacf('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xfacf('0x4'));var config=require(_0xfacf('0x5'));var controller=require(_0xfacf('0x6'));router[_0xfacf('0x7')]('/',auth[_0xfacf('0x8')](),controller[_0xfacf('0x9')]);router['get'](_0xfacf('0xa'),auth['isAuthenticated'](),controller[_0xfacf('0xb')]);router['get'](_0xfacf('0xc'),auth[_0xfacf('0x8')](),controller[_0xfacf('0xd')]);router[_0xfacf('0x7')](_0xfacf('0xe'),auth[_0xfacf('0x8')](),controller[_0xfacf('0xf')]);router[_0xfacf('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xfacf('0xc'),auth[_0xfacf('0x8')](),controller[_0xfacf('0x11')]);router[_0xfacf('0x12')]('/:id',auth[_0xfacf('0x8')](),controller[_0xfacf('0x13')]);router[_0xfacf('0x14')](_0xfacf('0xa'),auth[_0xfacf('0x8')](),controller[_0xfacf('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index a15d042..d27b0e3 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 _0x4888=['password','token','exports','STRING','username','remoteUri','ENUM'];(function(_0x350300,_0x92a6aa){var _0xdcf806=function(_0x4b26be){while(--_0x4b26be){_0x350300['push'](_0x350300['shift']());}};_0xdcf806(++_0x92a6aa);}(_0x4888,0x198));var _0x8488=function(_0x25c5a4,_0x1922b9){_0x25c5a4=_0x25c5a4-0x0;var _0x3f191b=_0x4888[_0x25c5a4];return _0x3f191b;};'use strict';var Sequelize=require('sequelize');module[_0x8488('0x0')]={'name':{'type':Sequelize[_0x8488('0x1')]},'description':{'type':Sequelize[_0x8488('0x1')]},'username':{'type':Sequelize[_0x8488('0x1')],'unique':_0x8488('0x2')},'password':{'type':Sequelize[_0x8488('0x1')]},'token':{'type':Sequelize[_0x8488('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x8488('0x3')},'authType':{'type':Sequelize[_0x8488('0x4')](_0x8488('0x5'),_0x8488('0x6')),'defaultValue':_0x8488('0x5')},'serverUrl':{'type':Sequelize[_0x8488('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab','newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x5b6e=['exports','STRING','username','ENUM','password','token','integrationTab','newTab','sequelize'];(function(_0x5da0d9,_0x49ee54){var _0x4b6d2f=function(_0x9832cf){while(--_0x9832cf){_0x5da0d9['push'](_0x5da0d9['shift']());}};_0x4b6d2f(++_0x49ee54);}(_0x5b6e,0x14c));var _0xe5b6=function(_0x1fc3f8,_0x484a7a){_0x1fc3f8=_0x1fc3f8-0x0;var _0x56dae3=_0x5b6e[_0x1fc3f8];return _0x56dae3;};'use strict';var Sequelize=require(_0xe5b6('0x0'));module[_0xe5b6('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe5b6('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xe5b6('0x3')},'password':{'type':Sequelize[_0xe5b6('0x2')]},'token':{'type':Sequelize[_0xe5b6('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xe5b6('0x4')](_0xe5b6('0x5'),_0xe5b6('0x6')),'defaultValue':_0xe5b6('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xe5b6('0x4')](_0xe5b6('0x7'),_0xe5b6('0x8')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index f03a66e..ef033e9 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 _0xc900=['query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','rawAttributes','intersection','includeAll','find','create','body','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','password','token','authType','remoteUri','substring','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','username','toString','base64','ValidationError','Unknown\x20authentication\x20type','subject','group','remove','includes','title','position','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','ZendeskAccount','fieldName','type','model'];(function(_0x42085e,_0x43630e){var _0x574013=function(_0x9eb445){while(--_0x9eb445){_0x42085e['push'](_0x42085e['shift']());}};_0x574013(++_0x43630e);}(_0xc900,0xb3));var _0x0c90=function(_0x39ef3f,_0x145753){_0x39ef3f=_0x39ef3f-0x0;var _0x15c904=_0xc900[_0x39ef3f];return _0x15c904;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0c90('0x0'));var jsonpatch=require(_0x0c90('0x1'));var rp=require(_0x0c90('0x2'));var moment=require('moment');var BPromise=require(_0x0c90('0x3'));var Mustache=require(_0x0c90('0x4'));var util=require('util');var path=require(_0x0c90('0x5'));var sox=require(_0x0c90('0x6'));var csv=require(_0x0c90('0x7'));var ejs=require(_0x0c90('0x8'));var fs=require('fs');var fs_extra=require(_0x0c90('0x9'));var _=require(_0x0c90('0xa'));var squel=require('squel');var crypto=require(_0x0c90('0xb'));var jsforce=require(_0x0c90('0xc'));var deskjs=require(_0x0c90('0xd'));var toCsv=require(_0x0c90('0x7'));var querystring=require(_0x0c90('0xe'));var Papa=require(_0x0c90('0xf'));var Redis=require(_0x0c90('0x10'));var authService=require(_0x0c90('0x11'));var qs=require(_0x0c90('0x12'));var as=require(_0x0c90('0x13'));var hardwareService=require(_0x0c90('0x14'));var logger=require(_0x0c90('0x15'))(_0x0c90('0x16'));var utils=require('../../config/utils');var config=require(_0x0c90('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c90('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x459cdb,_0x26fc46){_0x26fc46=_0x26fc46||0xcc;return function(_0x4535a2){if(_0x4535a2){return _0x459cdb[_0x0c90('0x19')](_0x26fc46);}return _0x459cdb[_0x0c90('0x1a')](_0x26fc46)['end']();};}function respondWithResult(_0x467b32,_0x4451e0){_0x4451e0=_0x4451e0||0xc8;return function(_0x4f35f4){if(_0x4f35f4){return _0x467b32[_0x0c90('0x1a')](_0x4451e0)[_0x0c90('0x1b')](_0x4f35f4);}};}function respondWithFilteredResult(_0x3bd5e8,_0x5bef7d){return function(_0x5daeb7){if(_0x5daeb7){var _0x412635=typeof _0x5bef7d[_0x0c90('0x1c')]===_0x0c90('0x1d')&&typeof _0x5bef7d[_0x0c90('0x1e')]===_0x0c90('0x1d');var _0x2cab22=_0x5daeb7[_0x0c90('0x1f')];var _0x57b9a6=_0x412635?0x0:_0x5bef7d[_0x0c90('0x1c')];var _0x38becc=_0x412635?_0x5daeb7[_0x0c90('0x1f')]:_0x5bef7d[_0x0c90('0x1c')]+_0x5bef7d['limit'];var _0x10a775;if(_0x38becc>=_0x2cab22){_0x38becc=_0x2cab22;_0x10a775=0xc8;}else{_0x10a775=0xce;}_0x3bd5e8[_0x0c90('0x1a')](_0x10a775);return _0x3bd5e8[_0x0c90('0x20')](_0x0c90('0x21'),_0x57b9a6+'-'+_0x38becc+'/'+_0x2cab22)[_0x0c90('0x1b')](_0x5daeb7);}return null;};}function patchUpdates(_0xc08f54){return function(_0x4cc940){try{jsonpatch[_0x0c90('0x22')](_0x4cc940,_0xc08f54,!![]);}catch(_0x4d629f){return BPromise[_0x0c90('0x23')](_0x4d629f);}return _0x4cc940[_0x0c90('0x24')]();};}function saveUpdates(_0x47b13c,_0x2a053a){return function(_0x43ddc3){if(_0x43ddc3){return _0x43ddc3[_0x0c90('0x25')](_0x47b13c)[_0x0c90('0x26')](function(_0x212164){return _0x212164;});}return null;};}function removeEntity(_0x3b287c,_0x4dfbc3){return function(_0x26f0a3){if(_0x26f0a3){return _0x26f0a3[_0x0c90('0x27')]()['then'](function(){_0x3b287c['status'](0xcc)[_0x0c90('0x28')]();});}};}function handleEntityNotFound(_0x3ea861,_0x35c243){return function(_0x109a5f){if(!_0x109a5f){_0x3ea861['sendStatus'](0x194);}return _0x109a5f;};}function handleError(_0x2dfa14,_0x438652){_0x438652=_0x438652||0x1f4;return function(_0xeb7f58){logger[_0x0c90('0x29')](_0xeb7f58[_0x0c90('0x2a')]);if(_0xeb7f58[_0x0c90('0x2b')]){delete _0xeb7f58['name'];}_0x2dfa14[_0x0c90('0x1a')](_0x438652)[_0x0c90('0x2c')](_0xeb7f58);};}exports[_0x0c90('0x2d')]=function(_0x13b377,_0x52d28d){var _0x4c8603={},_0x1f27f1={},_0x25da6e={'count':0x0,'rows':[]};var _0x3bff04=_[_0x0c90('0x2e')](db[_0x0c90('0x2f')]['rawAttributes'],function(_0x120136){return{'name':_0x120136[_0x0c90('0x30')],'type':_0x120136[_0x0c90('0x31')]['key']};});_0x1f27f1[_0x0c90('0x32')]=_['map'](_0x3bff04,'name');_0x1f27f1[_0x0c90('0x33')]=_[_0x0c90('0x34')](_0x13b377[_0x0c90('0x33')]);_0x1f27f1[_0x0c90('0x35')]=_['intersection'](_0x1f27f1[_0x0c90('0x32')],_0x1f27f1['query']);_0x4c8603[_0x0c90('0x36')]=_['intersection'](_0x1f27f1[_0x0c90('0x32')],qs[_0x0c90('0x37')](_0x13b377['query'][_0x0c90('0x37')]));_0x4c8603[_0x0c90('0x36')]=_0x4c8603[_0x0c90('0x36')][_0x0c90('0x38')]?_0x4c8603[_0x0c90('0x36')]:_0x1f27f1[_0x0c90('0x32')];if(!_0x13b377[_0x0c90('0x33')][_0x0c90('0x39')]('nolimit')){_0x4c8603[_0x0c90('0x1e')]=qs[_0x0c90('0x1e')](_0x13b377[_0x0c90('0x33')][_0x0c90('0x1e')]);_0x4c8603['offset']=qs[_0x0c90('0x1c')](_0x13b377[_0x0c90('0x33')][_0x0c90('0x1c')]);}_0x4c8603[_0x0c90('0x3a')]=qs[_0x0c90('0x3b')](_0x13b377[_0x0c90('0x33')][_0x0c90('0x3b')]);_0x4c8603[_0x0c90('0x3c')]=qs['filters'](_[_0x0c90('0x3d')](_0x13b377[_0x0c90('0x33')],_0x1f27f1['filters']),_0x3bff04);if(_0x13b377[_0x0c90('0x33')][_0x0c90('0x3e')]){_0x4c8603[_0x0c90('0x3c')]=_[_0x0c90('0x3f')](_0x4c8603[_0x0c90('0x3c')],{'$or':_['map'](_0x3bff04,function(_0x2f1d95){if(_0x2f1d95[_0x0c90('0x31')]!==_0x0c90('0x40')){var _0x2bca69={};_0x2bca69[_0x2f1d95[_0x0c90('0x2b')]]={'$like':'%'+_0x13b377[_0x0c90('0x33')][_0x0c90('0x3e')]+'%'};return _0x2bca69;}})});}_0x4c8603=_[_0x0c90('0x3f')]({},_0x4c8603,_0x13b377[_0x0c90('0x41')]);var _0x4f0227={'where':_0x4c8603[_0x0c90('0x3c')]};return db['ZendeskAccount'][_0x0c90('0x1f')](_0x4f0227)['then'](function(_0xb126ef){_0x25da6e[_0x0c90('0x1f')]=_0xb126ef;if(_0x13b377['query']['includeAll']){_0x4c8603[_0x0c90('0x42')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x0c90('0x43')](_0x4c8603);})[_0x0c90('0x26')](function(_0x373f9f){_0x25da6e['rows']=_0x373f9f;return _0x25da6e;})[_0x0c90('0x26')](respondWithFilteredResult(_0x52d28d,_0x4c8603))[_0x0c90('0x44')](handleError(_0x52d28d,null));};exports[_0x0c90('0x45')]=function(_0x3e5137,_0x2139c3){var _0x1184c4={'raw':![],'where':{'id':_0x3e5137[_0x0c90('0x46')]['id']}},_0x565b10={};_0x565b10[_0x0c90('0x32')]=_[_0x0c90('0x34')](db[_0x0c90('0x2f')][_0x0c90('0x47')]);_0x565b10[_0x0c90('0x33')]=_[_0x0c90('0x34')](_0x3e5137['query']);_0x565b10[_0x0c90('0x35')]=_['intersection'](_0x565b10[_0x0c90('0x32')],_0x565b10[_0x0c90('0x33')]);_0x1184c4[_0x0c90('0x36')]=_[_0x0c90('0x48')](_0x565b10[_0x0c90('0x32')],qs[_0x0c90('0x37')](_0x3e5137[_0x0c90('0x33')][_0x0c90('0x37')]));_0x1184c4[_0x0c90('0x36')]=_0x1184c4[_0x0c90('0x36')][_0x0c90('0x38')]?_0x1184c4[_0x0c90('0x36')]:_0x565b10[_0x0c90('0x32')];if(_0x3e5137[_0x0c90('0x33')][_0x0c90('0x49')]){_0x1184c4['include']=[{'all':!![]}];}_0x1184c4=_[_0x0c90('0x3f')]({},_0x1184c4,_0x3e5137[_0x0c90('0x41')]);return db[_0x0c90('0x2f')][_0x0c90('0x4a')](_0x1184c4)[_0x0c90('0x26')](handleEntityNotFound(_0x2139c3,null))[_0x0c90('0x26')](respondWithResult(_0x2139c3,null))[_0x0c90('0x44')](handleError(_0x2139c3,null));};exports[_0x0c90('0x4b')]=function(_0x3bb138,_0x3af64f){return db[_0x0c90('0x2f')][_0x0c90('0x4b')](_0x3bb138[_0x0c90('0x4c')],{})[_0x0c90('0x26')](respondWithResult(_0x3af64f,0xc9))['catch'](handleError(_0x3af64f,null));};exports[_0x0c90('0x25')]=function(_0x38f492,_0x553fea){if(_0x38f492['body']['id']){delete _0x38f492['body']['id'];}return db[_0x0c90('0x2f')][_0x0c90('0x4a')]({'where':{'id':_0x38f492[_0x0c90('0x46')]['id']}})[_0x0c90('0x26')](handleEntityNotFound(_0x553fea,null))[_0x0c90('0x26')](saveUpdates(_0x38f492['body'],null))[_0x0c90('0x26')](respondWithResult(_0x553fea,null))[_0x0c90('0x44')](handleError(_0x553fea,null));};exports[_0x0c90('0x27')]=function(_0x549c78,_0x119776){return db[_0x0c90('0x2f')][_0x0c90('0x4a')]({'where':{'id':_0x549c78[_0x0c90('0x46')]['id']}})[_0x0c90('0x26')](handleEntityNotFound(_0x119776,null))[_0x0c90('0x26')](removeEntity(_0x119776,null))[_0x0c90('0x44')](handleError(_0x119776,null));};exports[_0x0c90('0x4d')]=function(_0x1daeed,_0xeeee3b,_0x5e288e){var _0xac80b2={};var _0x4ba9e7={};var _0xda4331;var _0x67539d;return db[_0x0c90('0x2f')][_0x0c90('0x4e')]({'where':{'id':_0x1daeed[_0x0c90('0x46')]['id']}})[_0x0c90('0x26')](handleEntityNotFound(_0xeeee3b,null))['then'](function(_0x4930fc){if(_0x4930fc){_0xda4331=_0x4930fc;_0x4ba9e7['model']=_['keys'](db[_0x0c90('0x4f')][_0x0c90('0x47')]);_0x4ba9e7[_0x0c90('0x33')]=_['keys'](_0x1daeed[_0x0c90('0x33')]);_0x4ba9e7[_0x0c90('0x35')]=_['intersection'](_0x4ba9e7[_0x0c90('0x32')],_0x4ba9e7['query']);_0xac80b2[_0x0c90('0x36')]=_[_0x0c90('0x48')](_0x4ba9e7[_0x0c90('0x32')],qs[_0x0c90('0x37')](_0x1daeed['query'][_0x0c90('0x37')]));_0xac80b2['attributes']=_0xac80b2[_0x0c90('0x36')][_0x0c90('0x38')]?_0xac80b2['attributes']:_0x4ba9e7['model'];_0xac80b2['order']=qs[_0x0c90('0x3b')](_0x1daeed[_0x0c90('0x33')][_0x0c90('0x3b')]);_0xac80b2[_0x0c90('0x3c')]=qs[_0x0c90('0x35')](_['pick'](_0x1daeed[_0x0c90('0x33')],_0x4ba9e7[_0x0c90('0x35')]));if(_0x1daeed['query'][_0x0c90('0x3e')]){_0xac80b2['where']=_[_0x0c90('0x3f')](_0xac80b2[_0x0c90('0x3c')],{'$or':_['map'](_0xac80b2[_0x0c90('0x36')],function(_0x5baf85){var _0x4de11a={};_0x4de11a[_0x5baf85]={'$like':'%'+_0x1daeed['query'][_0x0c90('0x3e')]+'%'};return _0x4de11a;})});}_0xac80b2=_[_0x0c90('0x3f')]({},_0xac80b2,_0x1daeed[_0x0c90('0x41')]);return _0xda4331[_0x0c90('0x4d')](_0xac80b2);}})['then'](function(_0x5b385b){if(_0x5b385b){_0x67539d=_0x5b385b[_0x0c90('0x38')];if(!_0x1daeed[_0x0c90('0x33')][_0x0c90('0x39')]('nolimit')){_0xac80b2[_0x0c90('0x1e')]=qs[_0x0c90('0x1e')](_0x1daeed[_0x0c90('0x33')]['limit']);_0xac80b2[_0x0c90('0x1c')]=qs[_0x0c90('0x1c')](_0x1daeed[_0x0c90('0x33')]['offset']);}return _0xda4331[_0x0c90('0x4d')](_0xac80b2);}})[_0x0c90('0x26')](function(_0x1a198b){if(_0x1a198b){return _0x1a198b?{'count':_0x67539d,'rows':_0x1a198b}:null;}})[_0x0c90('0x26')](respondWithResult(_0xeeee3b,null))[_0x0c90('0x44')](handleError(_0xeeee3b,null));};exports[_0x0c90('0x50')]=function(_0x19f4ac,_0x143e0d,_0x181fe3){if(_0x19f4ac['body']['id']){delete _0x19f4ac['body']['id'];}return db[_0x0c90('0x2f')][_0x0c90('0x4e')]({'where':{'id':_0x19f4ac[_0x0c90('0x46')]['id']}})[_0x0c90('0x26')](handleEntityNotFound(_0x143e0d,null))[_0x0c90('0x26')](function(_0x2dad30){if(_0x2dad30){_0x19f4ac[_0x0c90('0x4c')][_0x0c90('0x51')]=_0x2dad30['id'];_0x19f4ac[_0x0c90('0x4c')][_0x0c90('0x52')]=integrations[_0x0c90('0x53')](_0x19f4ac[_0x0c90('0x4c')][_0x0c90('0x54')],_0x19f4ac[_0x0c90('0x4c')][_0x0c90('0x31')]);_0x19f4ac['body'][_0x0c90('0x55')]=integrations[_0x0c90('0x56')](_0x19f4ac[_0x0c90('0x4c')]['channel'],_0x19f4ac['body'][_0x0c90('0x31')]);return db['ZendeskConfiguration'][_0x0c90('0x4b')](_0x19f4ac[_0x0c90('0x4c')],{'include':[{'model':db['ZendeskField'],'as':_0x0c90('0x52')},{'model':db[_0x0c90('0x57')],'as':_0x0c90('0x55')}]});}return null;})[_0x0c90('0x26')](respondWithResult(_0x143e0d,null))['catch'](handleError(_0x143e0d,null));};exports['getFields']=function(_0x5f32d6,_0x16b38a,_0x2d3287){var _0x3bc90d='';return db[_0x0c90('0x2f')]['findOne']({'where':{'id':_0x5f32d6[_0x0c90('0x46')]['id']},'attributes':['id','username',_0x0c90('0x58'),_0x0c90('0x59'),_0x0c90('0x5a'),'remoteUri']})[_0x0c90('0x26')](handleEntityNotFound(_0x16b38a,null))[_0x0c90('0x26')](function(_0x2da9f9){if(_0x2da9f9){_0x3bc90d=_0x2da9f9[_0x0c90('0x5b')];var _0x57c3b3=_0x3bc90d['slice'](-0x1);if(_0x57c3b3==='/'){_0x3bc90d=_0x3bc90d[_0x0c90('0x5c')](0x0,_0x3bc90d['lastIndexOf'](_0x57c3b3));}var _0x3254c0={'method':_0x0c90('0x5d'),'uri':util[_0x0c90('0x5e')](_0x0c90('0x5f'),_0x3bc90d,_0x0c90('0x60')),'json':!![]};switch(_0x2da9f9[_0x0c90('0x5a')]){case _0x0c90('0x58'):_0x3254c0[_0x0c90('0x61')]={'Authorization':util[_0x0c90('0x5e')](_0x0c90('0x62'),new Buffer(util['format'](_0x0c90('0x63'),_0x2da9f9[_0x0c90('0x64')],_0x2da9f9[_0x0c90('0x58')]))[_0x0c90('0x65')](_0x0c90('0x66')))};break;case _0x0c90('0x59'):_0x3254c0[_0x0c90('0x61')]={'Authorization':util[_0x0c90('0x5e')](_0x0c90('0x62'),new Buffer(util[_0x0c90('0x5e')]('%s/token:%s',_0x2da9f9[_0x0c90('0x64')],_0x2da9f9[_0x0c90('0x59')]))[_0x0c90('0x65')](_0x0c90('0x66')))};break;default:throw new db['Sequelize'][(_0x0c90('0x67'))](_0x0c90('0x68'));}return rp(_0x3254c0);}})[_0x0c90('0x26')](function(_0x48a32f){if(_0x48a32f){var _0x40866c=[_0x0c90('0x69'),'description',_0x0c90('0x6a'),'assignee'];_[_0x0c90('0x6b')](_0x48a32f['ticket_fields'],function(_0x5633a4){return _0x40866c[_0x0c90('0x6c')](_0x5633a4[_0x0c90('0x31')]);});return{'count':_0x48a32f['ticket_fields']['length'],'rows':_[_0x0c90('0x2e')](_0x48a32f[_0x0c90('0x60')],function(_0x5d80b9){return{'id':_0x5d80b9['id'],'name':_0x5d80b9['position']>0x7?_0x5d80b9[_0x0c90('0x6d')]:_0x5d80b9['type'],'custom':_0x5d80b9[_0x0c90('0x6e')]>0x7?!![]:![],'options':_0x5d80b9[_0x0c90('0x6f')]?_0x5d80b9[_0x0c90('0x6f')]:_0x5d80b9[_0x0c90('0x70')]?_0x5d80b9[_0x0c90('0x70')]:[]};})};}})['then'](respondWithResult(_0x16b38a,null))[_0x0c90('0x44')](function(_0x142268){var _0x3aed3c=_0x5f32d6['query']['test']?0x1f4:_0x142268[_0x0c90('0x71')]||0x1f4;logger[_0x0c90('0x29')](_0x0c90('0x72'),'getFields',_0x3aed3c,JSON['stringify'](_0x142268));delete _0x142268['name'];if(_0x3aed3c===0x191){_0x3aed3c=0x190;}_0x16b38a[_0x0c90('0x1a')](_0x3aed3c)['send'](_0x5f32d6['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x142268[_0x0c90('0x71')]}:_0x142268);});}; \ No newline at end of file +var _0x44a3=['save','update','then','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','getConfigurations','ZendeskConfiguration','addConfiguration','Subjects','getSubjects','Descriptions','ZendeskField','getFields','username','password','token','remoteUri','slice','substring','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','Sequelize','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','title','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x44a3,0x1a9));var _0x344a=function(_0x3e2f39,_0x52276d){_0x3e2f39=_0x3e2f39-0x0;var _0x1f915c=_0x44a3[_0x3e2f39];return _0x1f915c;};'use strict';var emlformat=require(_0x344a('0x0'));var rimraf=require(_0x344a('0x1'));var zipdir=require(_0x344a('0x2'));var jsonpatch=require(_0x344a('0x3'));var rp=require(_0x344a('0x4'));var moment=require(_0x344a('0x5'));var BPromise=require(_0x344a('0x6'));var Mustache=require(_0x344a('0x7'));var util=require('util');var path=require(_0x344a('0x8'));var sox=require(_0x344a('0x9'));var csv=require(_0x344a('0xa'));var ejs=require(_0x344a('0xb'));var fs=require('fs');var fs_extra=require(_0x344a('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x344a('0xd'));var toCsv=require(_0x344a('0xa'));var querystring=require(_0x344a('0xe'));var Papa=require(_0x344a('0xf'));var Redis=require(_0x344a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x344a('0x11'));var as=require(_0x344a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x344a('0x13'))('api');var utils=require(_0x344a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x344a('0x15'));var db=require(_0x344a('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4a69ea,_0x304b70){_0x304b70=_0x304b70||0xcc;return function(_0x2ad7eb){if(_0x2ad7eb){return _0x4a69ea[_0x344a('0x17')](_0x304b70);}return _0x4a69ea[_0x344a('0x18')](_0x304b70)[_0x344a('0x19')]();};}function respondWithResult(_0x133ad4,_0x4ee562){_0x4ee562=_0x4ee562||0xc8;return function(_0x4032d7){if(_0x4032d7){return _0x133ad4[_0x344a('0x18')](_0x4ee562)[_0x344a('0x1a')](_0x4032d7);}};}function respondWithFilteredResult(_0x6e1639,_0x58c8cd){return function(_0x54a643){if(_0x54a643){var _0x3609ce=typeof _0x58c8cd[_0x344a('0x1b')]===_0x344a('0x1c')&&typeof _0x58c8cd[_0x344a('0x1d')]==='undefined';var _0x397de6=_0x54a643[_0x344a('0x1e')];var _0x49b55f=_0x3609ce?0x0:_0x58c8cd[_0x344a('0x1b')];var _0x274016=_0x3609ce?_0x54a643[_0x344a('0x1e')]:_0x58c8cd[_0x344a('0x1b')]+_0x58c8cd[_0x344a('0x1d')];var _0x43fa0f;if(_0x274016>=_0x397de6){_0x274016=_0x397de6;_0x43fa0f=0xc8;}else{_0x43fa0f=0xce;}_0x6e1639[_0x344a('0x18')](_0x43fa0f);return _0x6e1639[_0x344a('0x1f')](_0x344a('0x20'),_0x49b55f+'-'+_0x274016+'/'+_0x397de6)[_0x344a('0x1a')](_0x54a643);}return null;};}function patchUpdates(_0x4b3552){return function(_0x16c0fe){try{jsonpatch[_0x344a('0x21')](_0x16c0fe,_0x4b3552,!![]);}catch(_0xe0bdd4){return BPromise[_0x344a('0x22')](_0xe0bdd4);}return _0x16c0fe[_0x344a('0x23')]();};}function saveUpdates(_0x80ae12,_0x185303){return function(_0x976bcf){if(_0x976bcf){return _0x976bcf[_0x344a('0x24')](_0x80ae12)[_0x344a('0x25')](function(_0x90070c){return _0x90070c;});}return null;};}function removeEntity(_0x3b2ab9,_0x5ce9da){return function(_0x266fce){if(_0x266fce){return _0x266fce['destroy']()[_0x344a('0x25')](function(){_0x3b2ab9['status'](0xcc)[_0x344a('0x19')]();});}};}function handleEntityNotFound(_0x484f97,_0x36c920){return function(_0x8bf0b0){if(!_0x8bf0b0){_0x484f97[_0x344a('0x17')](0x194);}return _0x8bf0b0;};}function handleError(_0x16d404,_0x26f059){_0x26f059=_0x26f059||0x1f4;return function(_0x28749b){logger[_0x344a('0x26')](_0x28749b[_0x344a('0x27')]);if(_0x28749b['name']){delete _0x28749b[_0x344a('0x28')];}_0x16d404[_0x344a('0x18')](_0x26f059)[_0x344a('0x29')](_0x28749b);};}exports[_0x344a('0x2a')]=function(_0x14bd54,_0x2d72c9){var _0x5b877d={},_0x3d25fe={},_0x49bbf8={'count':0x0,'rows':[]};var _0x593cf6=_[_0x344a('0x2b')](db[_0x344a('0x2c')][_0x344a('0x2d')],function(_0x4803db){return{'name':_0x4803db['fieldName'],'type':_0x4803db['type'][_0x344a('0x2e')]};});_0x3d25fe[_0x344a('0x2f')]=_[_0x344a('0x2b')](_0x593cf6,'name');_0x3d25fe[_0x344a('0x30')]=_[_0x344a('0x31')](_0x14bd54[_0x344a('0x30')]);_0x3d25fe[_0x344a('0x32')]=_[_0x344a('0x33')](_0x3d25fe[_0x344a('0x2f')],_0x3d25fe[_0x344a('0x30')]);_0x5b877d['attributes']=_[_0x344a('0x33')](_0x3d25fe['model'],qs['fields'](_0x14bd54['query'][_0x344a('0x34')]));_0x5b877d[_0x344a('0x35')]=_0x5b877d[_0x344a('0x35')][_0x344a('0x36')]?_0x5b877d[_0x344a('0x35')]:_0x3d25fe[_0x344a('0x2f')];if(!_0x14bd54['query'][_0x344a('0x37')](_0x344a('0x38'))){_0x5b877d[_0x344a('0x1d')]=qs['limit'](_0x14bd54[_0x344a('0x30')][_0x344a('0x1d')]);_0x5b877d[_0x344a('0x1b')]=qs[_0x344a('0x1b')](_0x14bd54[_0x344a('0x30')]['offset']);}_0x5b877d[_0x344a('0x39')]=qs[_0x344a('0x3a')](_0x14bd54[_0x344a('0x30')][_0x344a('0x3a')]);_0x5b877d[_0x344a('0x3b')]=qs['filters'](_[_0x344a('0x3c')](_0x14bd54[_0x344a('0x30')],_0x3d25fe[_0x344a('0x32')]),_0x593cf6);if(_0x14bd54[_0x344a('0x30')][_0x344a('0x3d')]){_0x5b877d['where']=_[_0x344a('0x3e')](_0x5b877d[_0x344a('0x3b')],{'$or':_[_0x344a('0x2b')](_0x593cf6,function(_0x3356fb){if(_0x3356fb[_0x344a('0x3f')]!==_0x344a('0x40')){var _0x335a0a={};_0x335a0a[_0x3356fb[_0x344a('0x28')]]={'$like':'%'+_0x14bd54['query'][_0x344a('0x3d')]+'%'};return _0x335a0a;}})});}_0x5b877d=_[_0x344a('0x3e')]({},_0x5b877d,_0x14bd54[_0x344a('0x41')]);var _0x28bad9={'where':_0x5b877d[_0x344a('0x3b')]};return db['ZendeskAccount'][_0x344a('0x1e')](_0x28bad9)[_0x344a('0x25')](function(_0x7a33d7){_0x49bbf8[_0x344a('0x1e')]=_0x7a33d7;if(_0x14bd54[_0x344a('0x30')][_0x344a('0x42')]){_0x5b877d[_0x344a('0x43')]=[{'all':!![]}];}return db[_0x344a('0x2c')][_0x344a('0x44')](_0x5b877d);})['then'](function(_0x115a9c){_0x49bbf8[_0x344a('0x45')]=_0x115a9c;return _0x49bbf8;})[_0x344a('0x25')](respondWithFilteredResult(_0x2d72c9,_0x5b877d))[_0x344a('0x46')](handleError(_0x2d72c9,null));};exports['show']=function(_0x32bfa6,_0x3069ca){var _0x2b0ee9={'raw':![],'where':{'id':_0x32bfa6[_0x344a('0x47')]['id']}},_0x41f25b={};_0x41f25b[_0x344a('0x2f')]=_[_0x344a('0x31')](db[_0x344a('0x2c')][_0x344a('0x2d')]);_0x41f25b[_0x344a('0x30')]=_[_0x344a('0x31')](_0x32bfa6['query']);_0x41f25b[_0x344a('0x32')]=_[_0x344a('0x33')](_0x41f25b['model'],_0x41f25b[_0x344a('0x30')]);_0x2b0ee9[_0x344a('0x35')]=_['intersection'](_0x41f25b[_0x344a('0x2f')],qs[_0x344a('0x34')](_0x32bfa6['query'][_0x344a('0x34')]));_0x2b0ee9[_0x344a('0x35')]=_0x2b0ee9[_0x344a('0x35')]['length']?_0x2b0ee9[_0x344a('0x35')]:_0x41f25b['model'];if(_0x32bfa6[_0x344a('0x30')][_0x344a('0x42')]){_0x2b0ee9[_0x344a('0x43')]=[{'all':!![]}];}_0x2b0ee9=_[_0x344a('0x3e')]({},_0x2b0ee9,_0x32bfa6['options']);return db['ZendeskAccount'][_0x344a('0x48')](_0x2b0ee9)[_0x344a('0x25')](handleEntityNotFound(_0x3069ca,null))[_0x344a('0x25')](respondWithResult(_0x3069ca,null))[_0x344a('0x46')](handleError(_0x3069ca,null));};exports[_0x344a('0x49')]=function(_0xa3c8f0,_0x44962b){return db[_0x344a('0x2c')][_0x344a('0x49')](_0xa3c8f0[_0x344a('0x4a')],{})['then'](respondWithResult(_0x44962b,0xc9))[_0x344a('0x46')](handleError(_0x44962b,null));};exports[_0x344a('0x24')]=function(_0x6fad37,_0xbad7ca){if(_0x6fad37['body']['id']){delete _0x6fad37[_0x344a('0x4a')]['id'];}return db['ZendeskAccount']['find']({'where':{'id':_0x6fad37[_0x344a('0x47')]['id']}})[_0x344a('0x25')](handleEntityNotFound(_0xbad7ca,null))['then'](saveUpdates(_0x6fad37[_0x344a('0x4a')],null))[_0x344a('0x25')](respondWithResult(_0xbad7ca,null))[_0x344a('0x46')](handleError(_0xbad7ca,null));};exports[_0x344a('0x4b')]=function(_0x51e411,_0x225fce){return db[_0x344a('0x2c')][_0x344a('0x48')]({'where':{'id':_0x51e411[_0x344a('0x47')]['id']}})[_0x344a('0x25')](handleEntityNotFound(_0x225fce,null))[_0x344a('0x25')](removeEntity(_0x225fce,null))[_0x344a('0x46')](handleError(_0x225fce,null));};exports[_0x344a('0x4c')]=function(_0x292357,_0x1911d0,_0x5e0885){var _0x15928a={};var _0x47ce9c={};var _0x1b7f6c;var _0xb744c6;return db[_0x344a('0x2c')]['findOne']({'where':{'id':_0x292357[_0x344a('0x47')]['id']}})[_0x344a('0x25')](handleEntityNotFound(_0x1911d0,null))[_0x344a('0x25')](function(_0x14921e){if(_0x14921e){_0x1b7f6c=_0x14921e;_0x47ce9c[_0x344a('0x2f')]=_[_0x344a('0x31')](db[_0x344a('0x4d')][_0x344a('0x2d')]);_0x47ce9c[_0x344a('0x30')]=_['keys'](_0x292357[_0x344a('0x30')]);_0x47ce9c[_0x344a('0x32')]=_[_0x344a('0x33')](_0x47ce9c[_0x344a('0x2f')],_0x47ce9c[_0x344a('0x30')]);_0x15928a['attributes']=_[_0x344a('0x33')](_0x47ce9c[_0x344a('0x2f')],qs[_0x344a('0x34')](_0x292357[_0x344a('0x30')]['fields']));_0x15928a[_0x344a('0x35')]=_0x15928a[_0x344a('0x35')]['length']?_0x15928a[_0x344a('0x35')]:_0x47ce9c[_0x344a('0x2f')];_0x15928a[_0x344a('0x39')]=qs[_0x344a('0x3a')](_0x292357[_0x344a('0x30')][_0x344a('0x3a')]);_0x15928a[_0x344a('0x3b')]=qs['filters'](_['pick'](_0x292357['query'],_0x47ce9c[_0x344a('0x32')]));if(_0x292357[_0x344a('0x30')][_0x344a('0x3d')]){_0x15928a[_0x344a('0x3b')]=_['merge'](_0x15928a[_0x344a('0x3b')],{'$or':_['map'](_0x15928a['attributes'],function(_0x57241e){var _0x56b562={};_0x56b562[_0x57241e]={'$like':'%'+_0x292357[_0x344a('0x30')][_0x344a('0x3d')]+'%'};return _0x56b562;})});}_0x15928a=_[_0x344a('0x3e')]({},_0x15928a,_0x292357[_0x344a('0x41')]);return _0x1b7f6c['getConfigurations'](_0x15928a);}})['then'](function(_0x56e76e){if(_0x56e76e){_0xb744c6=_0x56e76e[_0x344a('0x36')];if(!_0x292357[_0x344a('0x30')][_0x344a('0x37')](_0x344a('0x38'))){_0x15928a[_0x344a('0x1d')]=qs['limit'](_0x292357[_0x344a('0x30')][_0x344a('0x1d')]);_0x15928a[_0x344a('0x1b')]=qs['offset'](_0x292357[_0x344a('0x30')]['offset']);}return _0x1b7f6c['getConfigurations'](_0x15928a);}})[_0x344a('0x25')](function(_0x532bcf){if(_0x532bcf){return _0x532bcf?{'count':_0xb744c6,'rows':_0x532bcf}:null;}})['then'](respondWithResult(_0x1911d0,null))[_0x344a('0x46')](handleError(_0x1911d0,null));};exports[_0x344a('0x4e')]=function(_0x4f2e35,_0x1bf894,_0x5808f2){if(_0x4f2e35[_0x344a('0x4a')]['id']){delete _0x4f2e35[_0x344a('0x4a')]['id'];}return db[_0x344a('0x2c')]['findOne']({'where':{'id':_0x4f2e35['params']['id']}})[_0x344a('0x25')](handleEntityNotFound(_0x1bf894,null))[_0x344a('0x25')](function(_0xb4ddd7){if(_0xb4ddd7){_0x4f2e35[_0x344a('0x4a')]['AccountId']=_0xb4ddd7['id'];_0x4f2e35['body'][_0x344a('0x4f')]=integrations[_0x344a('0x50')](_0x4f2e35[_0x344a('0x4a')]['channel'],_0x4f2e35[_0x344a('0x4a')][_0x344a('0x3f')]);_0x4f2e35['body'][_0x344a('0x51')]=integrations['getDescriptions'](_0x4f2e35[_0x344a('0x4a')]['channel'],_0x4f2e35['body']['type']);return db[_0x344a('0x4d')][_0x344a('0x49')](_0x4f2e35[_0x344a('0x4a')],{'include':[{'model':db[_0x344a('0x52')],'as':_0x344a('0x4f')},{'model':db[_0x344a('0x52')],'as':'Descriptions'}]});}return null;})[_0x344a('0x25')](respondWithResult(_0x1bf894,null))[_0x344a('0x46')](handleError(_0x1bf894,null));};exports[_0x344a('0x53')]=function(_0x1c4284,_0x26688e,_0x523774){var _0x23a761='';return db[_0x344a('0x2c')]['findOne']({'where':{'id':_0x1c4284[_0x344a('0x47')]['id']},'attributes':['id',_0x344a('0x54'),_0x344a('0x55'),_0x344a('0x56'),'authType',_0x344a('0x57')]})[_0x344a('0x25')](handleEntityNotFound(_0x26688e,null))[_0x344a('0x25')](function(_0x42e1c0){if(_0x42e1c0){_0x23a761=_0x42e1c0[_0x344a('0x57')];var _0x421a09=_0x23a761[_0x344a('0x58')](-0x1);if(_0x421a09==='/'){_0x23a761=_0x23a761[_0x344a('0x59')](0x0,_0x23a761['lastIndexOf'](_0x421a09));}var _0x33113e={'method':_0x344a('0x5a'),'uri':util[_0x344a('0x5b')](_0x344a('0x5c'),_0x23a761,_0x344a('0x5d')),'json':!![]};switch(_0x42e1c0[_0x344a('0x5e')]){case _0x344a('0x55'):_0x33113e[_0x344a('0x5f')]={'Authorization':util['format'](_0x344a('0x60'),new Buffer(util[_0x344a('0x5b')](_0x344a('0x61'),_0x42e1c0[_0x344a('0x54')],_0x42e1c0['password']))[_0x344a('0x62')](_0x344a('0x63')))};break;case _0x344a('0x56'):_0x33113e[_0x344a('0x5f')]={'Authorization':util[_0x344a('0x5b')](_0x344a('0x60'),new Buffer(util[_0x344a('0x5b')](_0x344a('0x64'),_0x42e1c0['username'],_0x42e1c0[_0x344a('0x56')]))[_0x344a('0x62')](_0x344a('0x63')))};break;default:throw new db[(_0x344a('0x65'))]['ValidationError'](_0x344a('0x66'));}return rp(_0x33113e);}})[_0x344a('0x25')](function(_0x1d0025){if(_0x1d0025){var _0x2ff11d=[_0x344a('0x67'),_0x344a('0x68'),'group',_0x344a('0x69')];_[_0x344a('0x6a')](_0x1d0025[_0x344a('0x5d')],function(_0x5584d5){return _0x2ff11d[_0x344a('0x6b')](_0x5584d5[_0x344a('0x3f')]);});return{'count':_0x1d0025[_0x344a('0x5d')][_0x344a('0x36')],'rows':_[_0x344a('0x2b')](_0x1d0025['ticket_fields'],function(_0x15aadb){return{'id':_0x15aadb['id'],'name':_0x15aadb[_0x344a('0x6c')]>0x7?_0x15aadb[_0x344a('0x6d')]:_0x15aadb['type'],'custom':_0x15aadb[_0x344a('0x6c')]>0x7?!![]:![],'options':_0x15aadb['system_field_options']?_0x15aadb['system_field_options']:_0x15aadb[_0x344a('0x6e')]?_0x15aadb[_0x344a('0x6e')]:[]};})};}})[_0x344a('0x25')](respondWithResult(_0x26688e,null))[_0x344a('0x46')](function(_0x375c34){var _0x5e8df4=_0x1c4284[_0x344a('0x30')][_0x344a('0x6f')]?0x1f4:_0x375c34['statusCode']||0x1f4;logger[_0x344a('0x26')](_0x344a('0x70'),'getFields',_0x5e8df4,JSON['stringify'](_0x375c34));delete _0x375c34[_0x344a('0x28')];if(_0x5e8df4===0x191){_0x5e8df4=0x190;}_0x26688e[_0x344a('0x18')](_0x5e8df4)[_0x344a('0x29')](_0x1c4284[_0x344a('0x30')]['test']?{'message':_0x344a('0x71'),'statusCode':_0x375c34[_0x344a('0x72')]}:_0x375c34);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index a700a78..d444ac1 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 _0x2c53=['./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x2c53,0x18b));var _0x32c5=function(_0x4dbdda,_0x11f07c){_0x4dbdda=_0x4dbdda-0x0;var _0x1acbf1=_0x2c53[_0x4dbdda];return _0x1acbf1;};'use strict';var _=require(_0x32c5('0x0'));var util=require(_0x32c5('0x1'));var logger=require(_0x32c5('0x2'))('api');var moment=require(_0x32c5('0x3'));var BPromise=require(_0x32c5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32c5('0x5'));var rimraf=require(_0x32c5('0x6'));var config=require(_0x32c5('0x7'));var attributes=require(_0x32c5('0x8'));var integrations=require(_0x32c5('0x9'));module[_0x32c5('0xa')]=function(_0x1b1a1e,_0x4d0b65){return _0x1b1a1e[_0x32c5('0xb')](_0x32c5('0xc'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17a8=['lodash','api','moment','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts'];(function(_0x38ef1f,_0x405cf6){var _0x14f963=function(_0x5b7be6){while(--_0x5b7be6){_0x38ef1f['push'](_0x38ef1f['shift']());}};_0x14f963(++_0x405cf6);}(_0x17a8,0x1ee));var _0x817a=function(_0x33f1e2,_0x2111bb){_0x33f1e2=_0x33f1e2-0x0;var _0x581421=_0x17a8[_0x33f1e2];return _0x581421;};'use strict';var _=require(_0x817a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x817a('0x1'));var moment=require(_0x817a('0x2'));var BPromise=require('bluebird');var rp=require(_0x817a('0x3'));var fs=require('fs');var path=require(_0x817a('0x4'));var rimraf=require(_0x817a('0x5'));var config=require(_0x817a('0x6'));var attributes=require(_0x817a('0x7'));var integrations=require(_0x817a('0x8'));module[_0x817a('0x9')]=function(_0x4f9cce,_0x4d2b48){return _0x4f9cce[_0x817a('0xa')](_0x817a('0xb'),attributes,{'tableName':_0x817a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 069965d..6e451a9 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 _0xbb9d=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','GetZendeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','info','stringify','catch','ZendeskAccount','find','ShowZendeskAccount','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0xbb9d,0x113));var _0xdbb9=function(_0x4d9ccb,_0x279565){_0x4d9ccb=_0x4d9ccb-0x0;var _0x1d8c94=_0xbb9d[_0x4d9ccb];return _0x1d8c94;};'use strict';var _=require(_0xdbb9('0x0'));var util=require(_0xdbb9('0x1'));var moment=require('moment');var BPromise=require(_0xdbb9('0x2'));var rs=require(_0xdbb9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdbb9('0x4'))['db'];var utils=require(_0xdbb9('0x5'));var logger=require(_0xdbb9('0x6'))('rpc');var config=require(_0xdbb9('0x7'));var jayson=require(_0xdbb9('0x8'));var client=jayson['client'][_0xdbb9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4faecd,_0x244f43,_0x24f667){return new BPromise(function(_0x27e7bd,_0x14683d){return client[_0xdbb9('0xa')](_0x4faecd,_0x24f667)[_0xdbb9('0xb')](function(_0x12c2e4){logger['info'](_0xdbb9('0xc'),_0x244f43,_0xdbb9('0xd'));logger[_0xdbb9('0xe')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x244f43,'request\x20sent',JSON['stringify'](_0x12c2e4));if(_0x12c2e4['error']){if(_0x12c2e4['error'][_0xdbb9('0xf')]===0x1f4){logger['error'](_0xdbb9('0xc'),_0x244f43,_0x12c2e4[_0xdbb9('0x10')]['message']);return _0x14683d(_0x12c2e4[_0xdbb9('0x10')][_0xdbb9('0x11')]);}logger['error'](_0xdbb9('0xc'),_0x244f43,_0x12c2e4[_0xdbb9('0x10')]['message']);return _0x27e7bd(_0x12c2e4[_0xdbb9('0x10')][_0xdbb9('0x11')]);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x244f43,'request\x20sent');_0x27e7bd(_0x12c2e4[_0xdbb9('0x12')]['message']);}})['catch'](function(_0x4db9fd){logger[_0xdbb9('0x10')](_0xdbb9('0xc'),_0x244f43,_0x4db9fd);_0x14683d(_0x4db9fd);});});}exports[_0xdbb9('0x13')]=function(_0xedd55b){var _0x35402b=this;return new Promise(function(_0x20ba2a,_0x5a4d11){return db['ZendeskAccount'][_0xdbb9('0x14')]({'raw':_0xedd55b[_0xdbb9('0x15')]?_0xedd55b[_0xdbb9('0x15')][_0xdbb9('0x16')]===undefined?!![]:![]:!![],'where':_0xedd55b['options']?_0xedd55b[_0xdbb9('0x15')][_0xdbb9('0x17')]||null:null,'attributes':_0xedd55b[_0xdbb9('0x15')]?_0xedd55b[_0xdbb9('0x15')]['attributes']||null:null,'limit':_0xedd55b[_0xdbb9('0x15')]?_0xedd55b[_0xdbb9('0x15')][_0xdbb9('0x18')]||null:null,'include':_0xedd55b['options']?_0xedd55b[_0xdbb9('0x15')][_0xdbb9('0x19')]?_[_0xdbb9('0x1a')](_0xedd55b[_0xdbb9('0x15')][_0xdbb9('0x19')],function(_0x30bf38){return{'model':db[_0x30bf38[_0xdbb9('0x1b')]],'as':_0x30bf38['as'],'attributes':_0x30bf38[_0xdbb9('0x1c')],'include':_0x30bf38[_0xdbb9('0x19')]?_['map'](_0x30bf38[_0xdbb9('0x19')],function(_0x45c6c5){return{'model':db[_0x45c6c5[_0xdbb9('0x1b')]],'as':_0x45c6c5['as'],'attributes':_0x45c6c5[_0xdbb9('0x1c')],'include':_0x45c6c5['include']?_[_0xdbb9('0x1a')](_0x45c6c5['include'],function(_0x1f0e99){return{'model':db[_0x1f0e99[_0xdbb9('0x1b')]],'as':_0x1f0e99['as'],'attributes':_0x1f0e99['attributes']};}):[]};}):[]};}):[]:[]})[_0xdbb9('0xb')](function(_0x5cf095){logger[_0xdbb9('0x1d')](_0xdbb9('0x13'),_0xedd55b);logger['debug'](_0xdbb9('0x13'),_0xedd55b,JSON[_0xdbb9('0x1e')](_0x5cf095));_0x20ba2a(_0x5cf095);})[_0xdbb9('0x1f')](function(_0x25ad5f){logger[_0xdbb9('0x10')](_0xdbb9('0x13'),_0x25ad5f[_0xdbb9('0x11')],_0xedd55b);_0x5a4d11(_0x35402b[_0xdbb9('0x10')](0x1f4,_0x25ad5f[_0xdbb9('0x11')]));});});};exports['ShowZendeskAccount']=function(_0x55b952){var _0x2cc933=this;return new Promise(function(_0x186fc0,_0xbdcb0a){return db[_0xdbb9('0x20')][_0xdbb9('0x21')]({'raw':_0x55b952[_0xdbb9('0x15')]?_0x55b952['options']['raw']===undefined?!![]:![]:!![],'where':_0x55b952[_0xdbb9('0x15')]?_0x55b952[_0xdbb9('0x15')][_0xdbb9('0x17')]||null:null,'attributes':_0x55b952[_0xdbb9('0x15')]?_0x55b952[_0xdbb9('0x15')]['attributes']||null:null,'include':_0x55b952[_0xdbb9('0x15')]?_0x55b952['options'][_0xdbb9('0x19')]?_[_0xdbb9('0x1a')](_0x55b952[_0xdbb9('0x15')][_0xdbb9('0x19')],function(_0x5d3f69){return{'model':db[_0x5d3f69[_0xdbb9('0x1b')]],'as':_0x5d3f69['as'],'attributes':_0x5d3f69[_0xdbb9('0x1c')],'include':_0x5d3f69['include']?_[_0xdbb9('0x1a')](_0x5d3f69[_0xdbb9('0x19')],function(_0x9ff462){return{'model':db[_0x9ff462['model']],'as':_0x9ff462['as'],'attributes':_0x9ff462[_0xdbb9('0x1c')],'include':_0x9ff462['include']?_[_0xdbb9('0x1a')](_0x9ff462[_0xdbb9('0x19')],function(_0x258421){return{'model':db[_0x258421[_0xdbb9('0x1b')]],'as':_0x258421['as'],'attributes':_0x258421['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1cfaa8){logger[_0xdbb9('0x1d')]('ShowZendeskAccount',_0x55b952);logger[_0xdbb9('0xe')](_0xdbb9('0x22'),_0x55b952,JSON['stringify'](_0x1cfaa8));_0x186fc0(_0x1cfaa8);})['catch'](function(_0x26c1c9){logger[_0xdbb9('0x10')]('ShowZendeskAccount',_0x26c1c9[_0xdbb9('0x11')],_0x55b952);_0xbdcb0a(_0x2cc933[_0xdbb9('0x10')](0x1f4,_0x26c1c9['message']));});});}; \ No newline at end of file +var _0x61de=['ZendeskAccount','options','raw','where','attributes','limit','include','map','model','ShowZendeskAccount','find','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZendeskAccount,\x20%s,\x20%s','catch','GetZendeskAccount'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0x61de,0x18c));var _0xe61d=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x61de[_0x2555d0];return _0x3bb486;};'use strict';var _=require(_0xe61d('0x0'));var util=require(_0xe61d('0x1'));var moment=require(_0xe61d('0x2'));var BPromise=require(_0xe61d('0x3'));var rs=require(_0xe61d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe61d('0x5'));var logger=require(_0xe61d('0x6'))(_0xe61d('0x7'));var config=require(_0xe61d('0x8'));var jayson=require(_0xe61d('0x9'));var client=jayson[_0xe61d('0xa')][_0xe61d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x388d3d,_0x2e5708,_0x15315c){return new BPromise(function(_0x293a84,_0x4da4ac){return client['request'](_0x388d3d,_0x15315c)[_0xe61d('0xc')](function(_0x439f6c){logger[_0xe61d('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0x2e5708,_0xe61d('0xe'));logger[_0xe61d('0xf')](_0xe61d('0x10'),_0x2e5708,_0xe61d('0xe'),JSON[_0xe61d('0x11')](_0x439f6c));if(_0x439f6c['error']){if(_0x439f6c[_0xe61d('0x12')][_0xe61d('0x13')]===0x1f4){logger[_0xe61d('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x2e5708,_0x439f6c[_0xe61d('0x12')][_0xe61d('0x14')]);return _0x4da4ac(_0x439f6c[_0xe61d('0x12')][_0xe61d('0x14')]);}logger['error'](_0xe61d('0x15'),_0x2e5708,_0x439f6c[_0xe61d('0x12')][_0xe61d('0x14')]);return _0x293a84(_0x439f6c[_0xe61d('0x12')][_0xe61d('0x14')]);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x2e5708,_0xe61d('0xe'));_0x293a84(_0x439f6c['result']['message']);}})[_0xe61d('0x16')](function(_0x288d20){logger[_0xe61d('0x12')](_0xe61d('0x15'),_0x2e5708,_0x288d20);_0x4da4ac(_0x288d20);});});}exports[_0xe61d('0x17')]=function(_0x842b93){var _0x9323df=this;return new Promise(function(_0x3cf7ea,_0x5467ad){return db[_0xe61d('0x18')]['findAll']({'raw':_0x842b93[_0xe61d('0x19')]?_0x842b93['options'][_0xe61d('0x1a')]===undefined?!![]:![]:!![],'where':_0x842b93[_0xe61d('0x19')]?_0x842b93[_0xe61d('0x19')][_0xe61d('0x1b')]||null:null,'attributes':_0x842b93[_0xe61d('0x19')]?_0x842b93[_0xe61d('0x19')][_0xe61d('0x1c')]||null:null,'limit':_0x842b93[_0xe61d('0x19')]?_0x842b93['options'][_0xe61d('0x1d')]||null:null,'include':_0x842b93[_0xe61d('0x19')]?_0x842b93[_0xe61d('0x19')][_0xe61d('0x1e')]?_[_0xe61d('0x1f')](_0x842b93['options'][_0xe61d('0x1e')],function(_0x4226b5){return{'model':db[_0x4226b5[_0xe61d('0x20')]],'as':_0x4226b5['as'],'attributes':_0x4226b5[_0xe61d('0x1c')],'include':_0x4226b5[_0xe61d('0x1e')]?_[_0xe61d('0x1f')](_0x4226b5['include'],function(_0x2a83f6){return{'model':db[_0x2a83f6[_0xe61d('0x20')]],'as':_0x2a83f6['as'],'attributes':_0x2a83f6['attributes'],'include':_0x2a83f6[_0xe61d('0x1e')]?_[_0xe61d('0x1f')](_0x2a83f6[_0xe61d('0x1e')],function(_0x2a196a){return{'model':db[_0x2a196a[_0xe61d('0x20')]],'as':_0x2a196a['as'],'attributes':_0x2a196a['attributes']};}):[]};}):[]};}):[]:[]})[_0xe61d('0xc')](function(_0x33c8fc){logger['info'](_0xe61d('0x17'),_0x842b93);logger[_0xe61d('0xf')](_0xe61d('0x17'),_0x842b93,JSON[_0xe61d('0x11')](_0x33c8fc));_0x3cf7ea(_0x33c8fc);})[_0xe61d('0x16')](function(_0x112de5){logger[_0xe61d('0x12')]('GetZendeskAccount',_0x112de5[_0xe61d('0x14')],_0x842b93);_0x5467ad(_0x9323df['error'](0x1f4,_0x112de5['message']));});});};exports[_0xe61d('0x21')]=function(_0x3a049c){var _0x5c1ed3=this;return new Promise(function(_0x4ff252,_0x22e2d3){return db[_0xe61d('0x18')][_0xe61d('0x22')]({'raw':_0x3a049c[_0xe61d('0x19')]?_0x3a049c['options'][_0xe61d('0x1a')]===undefined?!![]:![]:!![],'where':_0x3a049c[_0xe61d('0x19')]?_0x3a049c['options'][_0xe61d('0x1b')]||null:null,'attributes':_0x3a049c[_0xe61d('0x19')]?_0x3a049c[_0xe61d('0x19')]['attributes']||null:null,'include':_0x3a049c['options']?_0x3a049c[_0xe61d('0x19')][_0xe61d('0x1e')]?_['map'](_0x3a049c[_0xe61d('0x19')][_0xe61d('0x1e')],function(_0x21655c){return{'model':db[_0x21655c[_0xe61d('0x20')]],'as':_0x21655c['as'],'attributes':_0x21655c[_0xe61d('0x1c')],'include':_0x21655c['include']?_['map'](_0x21655c[_0xe61d('0x1e')],function(_0x2ce541){return{'model':db[_0x2ce541[_0xe61d('0x20')]],'as':_0x2ce541['as'],'attributes':_0x2ce541[_0xe61d('0x1c')],'include':_0x2ce541[_0xe61d('0x1e')]?_[_0xe61d('0x1f')](_0x2ce541['include'],function(_0xe903c2){return{'model':db[_0xe903c2[_0xe61d('0x20')]],'as':_0xe903c2['as'],'attributes':_0xe903c2[_0xe61d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe61d('0xc')](function(_0x379591){logger[_0xe61d('0xd')]('ShowZendeskAccount',_0x3a049c);logger[_0xe61d('0xf')](_0xe61d('0x21'),_0x3a049c,JSON[_0xe61d('0x11')](_0x379591));_0x4ff252(_0x379591);})[_0xe61d('0x16')](function(_0x2da706){logger[_0xe61d('0x12')](_0xe61d('0x21'),_0x2da706[_0xe61d('0x14')],_0x3a049c);_0x22e2d3(_0x5c1ed3[_0xe61d('0x12')](0x1f4,_0x2da706[_0xe61d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index a8cbc2b..6a87b69 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 _0xb688=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','update','exports','util'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xb688,0xcf));var _0x8b68=function(_0x3d144b,_0x5ac8cd){_0x3d144b=_0x3d144b-0x0;var _0x5b76d4=_0xb688[_0x3d144b];return _0x5b76d4;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var fs_extra=require(_0x8b68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var controller=require(_0x8b68('0x8'));router[_0x8b68('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['get'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xd')]);router[_0x8b68('0x9')](_0x8b68('0xe'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x9')](_0x8b68('0x10'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x9')](_0x8b68('0x12'),auth['isAuthenticated'](),controller[_0x8b68('0x13')]);router[_0x8b68('0x9')](_0x8b68('0x14'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x15')]);router[_0x8b68('0x16')]('/',auth[_0x8b68('0xc')](),controller[_0x8b68('0x17')]);router[_0x8b68('0x16')]('/:id/tags',auth[_0x8b68('0xc')](),controller['setTags']);router['put'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x18')]);router['delete']('/:id',auth[_0x8b68('0xc')](),controller['destroy']);module[_0x8b68('0x19')]=router; \ No newline at end of file +var _0xe5b5=['../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x32b30e,_0x44385e){var _0xff0d9a=function(_0x421558){while(--_0x421558){_0x32b30e['push'](_0x32b30e['shift']());}};_0xff0d9a(++_0x44385e);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x1098db,_0x39ba6b){_0x1098db=_0x1098db-0x0;var _0x14f090=_0xe5b5[_0x1098db];return _0x14f090;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var fs_extra=require(_0x5e5b('0x6'));var auth=require(_0x5e5b('0x7'));var interaction=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var controller=require(_0x5e5b('0xa'));router[_0x5e5b('0xb')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xd')]);router[_0x5e5b('0xb')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xf')]);router[_0x5e5b('0xb')](_0x5e5b('0x10'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0xb')]('/:id/subjects',auth[_0x5e5b('0xc')](),controller['getSubjects']);router[_0x5e5b('0xb')](_0x5e5b('0x12'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x13')]);router['get']('/:id/tags',auth['isAuthenticated'](),controller[_0x5e5b('0x14')]);router[_0x5e5b('0x15')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x16')]);router[_0x5e5b('0x15')](_0x5e5b('0x17'),auth[_0x5e5b('0xc')](),controller['setTags']);router[_0x5e5b('0x18')](_0x5e5b('0xe'),auth['isAuthenticated'](),controller[_0x5e5b('0x19')]);router['delete']('/:id',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x1a')]);module[_0x5e5b('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index eec23d8..2ae5dcf 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 _0x86fb=['sequelize','exports','STRING'];(function(_0x232e0a,_0x2fd08f){var _0x4f0fec=function(_0x54801f){while(--_0x54801f){_0x232e0a['push'](_0x232e0a['shift']());}};_0x4f0fec(++_0x2fd08f);}(_0x86fb,0x108));var _0xb86f=function(_0x8ed793,_0x27ad80){_0x8ed793=_0x8ed793-0x0;var _0x3bfbbf=_0x86fb[_0x8ed793];return _0x3bfbbf;};'use strict';var Sequelize=require(_0xb86f('0x0'));module[_0xb86f('0x1')]={'name':{'type':Sequelize[_0xb86f('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1eef=['STRING','sequelize','exports'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x1eef,0x10c));var _0xf1ee=function(_0x3cba93,_0x5c2fd8){_0x3cba93=_0x3cba93-0x0;var _0x4a2991=_0x1eef[_0x3cba93];return _0x4a2991;};'use strict';var Sequelize=require(_0xf1ee('0x0'));module[_0xf1ee('0x1')]={'name':{'type':Sequelize[_0xf1ee('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index d569be2..cc90337 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 _0xb17e=['keys','model','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','ZendeskConfiguration','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','update','findOne','ZendeskField','getFields','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','query'];(function(_0x2a79e3,_0x4080d1){var _0x548965=function(_0x256f07){while(--_0x256f07){_0x2a79e3['push'](_0x2a79e3['shift']());}};_0x548965(++_0x4080d1);}(_0xb17e,0x1c8));var _0xeb17=function(_0x96c9a5,_0x229e01){_0x96c9a5=_0x96c9a5-0x0;var _0x1aaa9a=_0xb17e[_0x96c9a5];return _0x1aaa9a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb17('0x0'));var zipdir=require(_0xeb17('0x1'));var jsonpatch=require(_0xeb17('0x2'));var rp=require(_0xeb17('0x3'));var moment=require('moment');var BPromise=require(_0xeb17('0x4'));var Mustache=require(_0xeb17('0x5'));var util=require('util');var path=require('path');var sox=require(_0xeb17('0x6'));var csv=require(_0xeb17('0x7'));var ejs=require(_0xeb17('0x8'));var fs=require('fs');var fs_extra=require(_0xeb17('0x9'));var _=require(_0xeb17('0xa'));var squel=require('squel');var crypto=require(_0xeb17('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xeb17('0xc'));var toCsv=require(_0xeb17('0x7'));var querystring=require(_0xeb17('0xd'));var Papa=require(_0xeb17('0xe'));var Redis=require('ioredis');var authService=require(_0xeb17('0xf'));var qs=require(_0xeb17('0x10'));var as=require(_0xeb17('0x11'));var hardwareService=require(_0xeb17('0x12'));var logger=require(_0xeb17('0x13'))(_0xeb17('0x14'));var utils=require(_0xeb17('0x15'));var config=require(_0xeb17('0x16'));var licenseUtil=require(_0xeb17('0x17'));var db=require(_0xeb17('0x18'))['db'];function respondWithStatusCode(_0x1f2e4a,_0x158176){_0x158176=_0x158176||0xcc;return function(_0x254dbe){if(_0x254dbe){return _0x1f2e4a[_0xeb17('0x19')](_0x158176);}return _0x1f2e4a['status'](_0x158176)[_0xeb17('0x1a')]();};}function respondWithResult(_0x58d24d,_0x42189c){_0x42189c=_0x42189c||0xc8;return function(_0x30f7fd){if(_0x30f7fd){return _0x58d24d['status'](_0x42189c)[_0xeb17('0x1b')](_0x30f7fd);}};}function respondWithFilteredResult(_0xbd06f7,_0x32bf3c){return function(_0x8e6336){if(_0x8e6336){var _0xfa5fef=typeof _0x32bf3c[_0xeb17('0x1c')]===_0xeb17('0x1d')&&typeof _0x32bf3c[_0xeb17('0x1e')]===_0xeb17('0x1d');var _0x5db6a8=_0x8e6336['count'];var _0x556106=_0xfa5fef?0x0:_0x32bf3c['offset'];var _0x58d01d=_0xfa5fef?_0x8e6336[_0xeb17('0x1f')]:_0x32bf3c['offset']+_0x32bf3c[_0xeb17('0x1e')];var _0x4f45eb;if(_0x58d01d>=_0x5db6a8){_0x58d01d=_0x5db6a8;_0x4f45eb=0xc8;}else{_0x4f45eb=0xce;}_0xbd06f7[_0xeb17('0x20')](_0x4f45eb);return _0xbd06f7[_0xeb17('0x21')](_0xeb17('0x22'),_0x556106+'-'+_0x58d01d+'/'+_0x5db6a8)[_0xeb17('0x1b')](_0x8e6336);}return null;};}function patchUpdates(_0x852f2b){return function(_0x401608){try{jsonpatch[_0xeb17('0x23')](_0x401608,_0x852f2b,!![]);}catch(_0x3c6f49){return BPromise['reject'](_0x3c6f49);}return _0x401608['save']();};}function saveUpdates(_0x4f8922,_0x11dd2d){return function(_0x19d028){if(_0x19d028){return _0x19d028['update'](_0x4f8922)['then'](function(_0x2718e4){return _0x2718e4;});}return null;};}function removeEntity(_0x486400,_0x1a2628){return function(_0x5227a1){if(_0x5227a1){return _0x5227a1[_0xeb17('0x24')]()[_0xeb17('0x25')](function(){_0x486400[_0xeb17('0x20')](0xcc)[_0xeb17('0x1a')]();});}};}function handleEntityNotFound(_0x1e4ce6,_0x2653b5){return function(_0x19ce07){if(!_0x19ce07){_0x1e4ce6[_0xeb17('0x19')](0x194);}return _0x19ce07;};}function handleError(_0x405a46,_0x32eafd){_0x32eafd=_0x32eafd||0x1f4;return function(_0x5de04a){logger['error'](_0x5de04a[_0xeb17('0x26')]);if(_0x5de04a[_0xeb17('0x27')]){delete _0x5de04a['name'];}_0x405a46[_0xeb17('0x20')](_0x32eafd)[_0xeb17('0x28')](_0x5de04a);};}exports[_0xeb17('0x29')]=function(_0x4b246f,_0x227bc7){var _0x1d45d5={},_0x5eaeea={},_0x151121={'count':0x0,'rows':[]};var _0x56c31c=_[_0xeb17('0x2a')](db['ZendeskConfiguration'][_0xeb17('0x2b')],function(_0x14b13a){return{'name':_0x14b13a[_0xeb17('0x2c')],'type':_0x14b13a[_0xeb17('0x2d')][_0xeb17('0x2e')]};});_0x5eaeea['model']=_[_0xeb17('0x2a')](_0x56c31c,_0xeb17('0x27'));_0x5eaeea[_0xeb17('0x2f')]=_[_0xeb17('0x30')](_0x4b246f[_0xeb17('0x2f')]);_0x5eaeea['filters']=_['intersection'](_0x5eaeea[_0xeb17('0x31')],_0x5eaeea[_0xeb17('0x2f')]);_0x1d45d5[_0xeb17('0x32')]=_[_0xeb17('0x33')](_0x5eaeea[_0xeb17('0x31')],qs[_0xeb17('0x34')](_0x4b246f[_0xeb17('0x2f')][_0xeb17('0x34')]));_0x1d45d5[_0xeb17('0x32')]=_0x1d45d5[_0xeb17('0x32')][_0xeb17('0x35')]?_0x1d45d5['attributes']:_0x5eaeea[_0xeb17('0x31')];if(!_0x4b246f[_0xeb17('0x2f')]['hasOwnProperty'](_0xeb17('0x36'))){_0x1d45d5[_0xeb17('0x1e')]=qs[_0xeb17('0x1e')](_0x4b246f[_0xeb17('0x2f')][_0xeb17('0x1e')]);_0x1d45d5['offset']=qs[_0xeb17('0x1c')](_0x4b246f[_0xeb17('0x2f')]['offset']);}_0x1d45d5[_0xeb17('0x37')]=qs[_0xeb17('0x38')](_0x4b246f['query'][_0xeb17('0x38')]);_0x1d45d5[_0xeb17('0x39')]=qs[_0xeb17('0x3a')](_[_0xeb17('0x3b')](_0x4b246f[_0xeb17('0x2f')],_0x5eaeea[_0xeb17('0x3a')]),_0x56c31c);if(_0x4b246f[_0xeb17('0x2f')][_0xeb17('0x3c')]){_0x1d45d5['where']=_[_0xeb17('0x3d')](_0x1d45d5[_0xeb17('0x39')],{'$or':_[_0xeb17('0x2a')](_0x56c31c,function(_0x293519){if(_0x293519[_0xeb17('0x2d')]!=='VIRTUAL'){var _0x59cbe9={};_0x59cbe9[_0x293519[_0xeb17('0x27')]]={'$like':'%'+_0x4b246f[_0xeb17('0x2f')][_0xeb17('0x3c')]+'%'};return _0x59cbe9;}})});}_0x1d45d5=_[_0xeb17('0x3d')]({},_0x1d45d5,_0x4b246f['options']);var _0x1f2764={'where':_0x1d45d5[_0xeb17('0x39')]};return db[_0xeb17('0x3e')]['count'](_0x1f2764)[_0xeb17('0x25')](function(_0x550e58){_0x151121[_0xeb17('0x1f')]=_0x550e58;if(_0x4b246f[_0xeb17('0x2f')][_0xeb17('0x3f')]){_0x1d45d5[_0xeb17('0x40')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xeb17('0x41')](_0x1d45d5);})[_0xeb17('0x25')](function(_0x36dafd){_0x151121[_0xeb17('0x42')]=_0x36dafd;return _0x151121;})['then'](respondWithFilteredResult(_0x227bc7,_0x1d45d5))['catch'](handleError(_0x227bc7,null));};exports[_0xeb17('0x43')]=function(_0x469a5d,_0x41f689){var _0x5424ea={'raw':![],'where':{'id':_0x469a5d[_0xeb17('0x44')]['id']}},_0x139abd={};_0x139abd['model']=_[_0xeb17('0x30')](db[_0xeb17('0x3e')]['rawAttributes']);_0x139abd[_0xeb17('0x2f')]=_[_0xeb17('0x30')](_0x469a5d[_0xeb17('0x2f')]);_0x139abd['filters']=_[_0xeb17('0x33')](_0x139abd[_0xeb17('0x31')],_0x139abd[_0xeb17('0x2f')]);_0x5424ea['attributes']=_[_0xeb17('0x33')](_0x139abd['model'],qs[_0xeb17('0x34')](_0x469a5d['query']['fields']));_0x5424ea[_0xeb17('0x32')]=_0x5424ea[_0xeb17('0x32')]['length']?_0x5424ea[_0xeb17('0x32')]:_0x139abd[_0xeb17('0x31')];if(_0x469a5d['query'][_0xeb17('0x3f')]){_0x5424ea[_0xeb17('0x40')]=[{'all':!![]}];}_0x5424ea=_[_0xeb17('0x3d')]({},_0x5424ea,_0x469a5d[_0xeb17('0x45')]);return db['ZendeskConfiguration'][_0xeb17('0x46')](_0x5424ea)['then'](handleEntityNotFound(_0x41f689,null))[_0xeb17('0x25')](respondWithResult(_0x41f689,null))[_0xeb17('0x47')](handleError(_0x41f689,null));};exports[_0xeb17('0x48')]=function(_0xf98ca5,_0x763fec){return db[_0xeb17('0x3e')][_0xeb17('0x48')](_0xf98ca5[_0xeb17('0x49')],{})[_0xeb17('0x25')](respondWithResult(_0x763fec,0xc9))['catch'](handleError(_0x763fec,null));};exports[_0xeb17('0x4a')]=function(_0x3bcf29,_0xf13fe5){if(_0x3bcf29['body']['id']){delete _0x3bcf29[_0xeb17('0x49')]['id'];}return db[_0xeb17('0x3e')][_0xeb17('0x46')]({'where':{'id':_0x3bcf29[_0xeb17('0x44')]['id']}})[_0xeb17('0x25')](handleEntityNotFound(_0xf13fe5,null))[_0xeb17('0x25')](saveUpdates(_0x3bcf29['body'],null))[_0xeb17('0x25')](respondWithResult(_0xf13fe5,null))[_0xeb17('0x47')](handleError(_0xf13fe5,null));};exports[_0xeb17('0x24')]=function(_0x1b1599,_0x42926e){return db[_0xeb17('0x3e')][_0xeb17('0x46')]({'where':{'id':_0x1b1599[_0xeb17('0x44')]['id']}})[_0xeb17('0x25')](handleEntityNotFound(_0x42926e,null))[_0xeb17('0x25')](removeEntity(_0x42926e,null))[_0xeb17('0x47')](handleError(_0x42926e,null));};exports['getFields']=function(_0x47ece0,_0x3d2396,_0x443211){var _0x42adcd={};var _0x1ba83f={};var _0x20629f;var _0x2444bc;return db[_0xeb17('0x3e')][_0xeb17('0x4b')]({'where':{'id':_0x47ece0[_0xeb17('0x44')]['id']}})[_0xeb17('0x25')](handleEntityNotFound(_0x3d2396,null))[_0xeb17('0x25')](function(_0x348fbe){if(_0x348fbe){_0x20629f=_0x348fbe;_0x1ba83f[_0xeb17('0x31')]=_[_0xeb17('0x30')](db[_0xeb17('0x4c')]['rawAttributes']);_0x1ba83f[_0xeb17('0x2f')]=_[_0xeb17('0x30')](_0x47ece0[_0xeb17('0x2f')]);_0x1ba83f[_0xeb17('0x3a')]=_['intersection'](_0x1ba83f[_0xeb17('0x31')],_0x1ba83f[_0xeb17('0x2f')]);_0x42adcd['attributes']=_[_0xeb17('0x33')](_0x1ba83f['model'],qs[_0xeb17('0x34')](_0x47ece0['query'][_0xeb17('0x34')]));_0x42adcd[_0xeb17('0x32')]=_0x42adcd['attributes'][_0xeb17('0x35')]?_0x42adcd[_0xeb17('0x32')]:_0x1ba83f[_0xeb17('0x31')];_0x42adcd[_0xeb17('0x37')]=qs['sort'](_0x47ece0[_0xeb17('0x2f')][_0xeb17('0x38')]);_0x42adcd[_0xeb17('0x39')]=qs[_0xeb17('0x3a')](_[_0xeb17('0x3b')](_0x47ece0['query'],_0x1ba83f['filters']));if(_0x47ece0[_0xeb17('0x2f')][_0xeb17('0x3c')]){_0x42adcd[_0xeb17('0x39')]=_[_0xeb17('0x3d')](_0x42adcd['where'],{'$or':_[_0xeb17('0x2a')](_0x42adcd[_0xeb17('0x32')],function(_0x261a1d){var _0x50c77e={};_0x50c77e[_0x261a1d]={'$like':'%'+_0x47ece0[_0xeb17('0x2f')]['filter']+'%'};return _0x50c77e;})});}_0x42adcd=_[_0xeb17('0x3d')]({},_0x42adcd,_0x47ece0[_0xeb17('0x45')]);return _0x20629f['getFields'](_0x42adcd);}})['then'](function(_0x473a03){if(_0x473a03){_0x2444bc=_0x473a03['length'];if(!_0x47ece0[_0xeb17('0x2f')]['hasOwnProperty']('nolimit')){_0x42adcd[_0xeb17('0x1e')]=qs[_0xeb17('0x1e')](_0x47ece0['query'][_0xeb17('0x1e')]);_0x42adcd[_0xeb17('0x1c')]=qs['offset'](_0x47ece0[_0xeb17('0x2f')][_0xeb17('0x1c')]);}return _0x20629f[_0xeb17('0x4d')](_0x42adcd);}})[_0xeb17('0x25')](function(_0x2fa880){if(_0x2fa880){return _0x2fa880?{'count':_0x2444bc,'rows':_0x2fa880}:null;}})[_0xeb17('0x25')](respondWithResult(_0x3d2396,null))['catch'](handleError(_0x3d2396,null));};exports['getSubjects']=function(_0x1e65d7,_0x156a6d,_0x2f97a0){var _0x55d96a={};var _0x3df001={};var _0x32e2dd;var _0x6f27e5;return db[_0xeb17('0x3e')][_0xeb17('0x4b')]({'where':{'id':_0x1e65d7[_0xeb17('0x44')]['id']}})[_0xeb17('0x25')](handleEntityNotFound(_0x156a6d,null))[_0xeb17('0x25')](function(_0x1c1674){if(_0x1c1674){_0x32e2dd=_0x1c1674;_0x3df001[_0xeb17('0x31')]=_['keys'](db[_0xeb17('0x4c')][_0xeb17('0x2b')]);_0x3df001['query']=_['keys'](_0x1e65d7[_0xeb17('0x2f')]);_0x3df001[_0xeb17('0x3a')]=_['intersection'](_0x3df001[_0xeb17('0x31')],_0x3df001[_0xeb17('0x2f')]);_0x55d96a[_0xeb17('0x32')]=_[_0xeb17('0x33')](_0x3df001[_0xeb17('0x31')],qs[_0xeb17('0x34')](_0x1e65d7[_0xeb17('0x2f')][_0xeb17('0x34')]));_0x55d96a[_0xeb17('0x32')]=_0x55d96a[_0xeb17('0x32')][_0xeb17('0x35')]?_0x55d96a['attributes']:_0x3df001[_0xeb17('0x31')];_0x55d96a['order']=qs['sort'](_0x1e65d7[_0xeb17('0x2f')][_0xeb17('0x38')]);_0x55d96a['where']=qs[_0xeb17('0x3a')](_[_0xeb17('0x3b')](_0x1e65d7['query'],_0x3df001[_0xeb17('0x3a')]));if(_0x1e65d7['query'][_0xeb17('0x3c')]){_0x55d96a[_0xeb17('0x39')]=_[_0xeb17('0x3d')](_0x55d96a[_0xeb17('0x39')],{'$or':_[_0xeb17('0x2a')](_0x55d96a[_0xeb17('0x32')],function(_0x4041c5){var _0x252676={};_0x252676[_0x4041c5]={'$like':'%'+_0x1e65d7[_0xeb17('0x2f')][_0xeb17('0x3c')]+'%'};return _0x252676;})});}_0x55d96a=_['merge']({},_0x55d96a,_0x1e65d7[_0xeb17('0x45')]);return _0x32e2dd['getSubjects'](_0x55d96a);}})[_0xeb17('0x25')](function(_0x1dbddf){if(_0x1dbddf){_0x6f27e5=_0x1dbddf[_0xeb17('0x35')];if(!_0x1e65d7['query'][_0xeb17('0x4e')](_0xeb17('0x36'))){_0x55d96a['limit']=qs[_0xeb17('0x1e')](_0x1e65d7[_0xeb17('0x2f')][_0xeb17('0x1e')]);_0x55d96a[_0xeb17('0x1c')]=qs[_0xeb17('0x1c')](_0x1e65d7[_0xeb17('0x2f')]['offset']);}return _0x32e2dd[_0xeb17('0x4f')](_0x55d96a);}})[_0xeb17('0x25')](function(_0x5ec645){if(_0x5ec645){return _0x5ec645?{'count':_0x6f27e5,'rows':_0x5ec645}:null;}})[_0xeb17('0x25')](respondWithResult(_0x156a6d,null))[_0xeb17('0x47')](handleError(_0x156a6d,null));};exports[_0xeb17('0x50')]=function(_0x239952,_0x7b507b,_0x546307){var _0x4bd441={};var _0x248dcf={};var _0x282583;var _0x767531;return db['ZendeskConfiguration'][_0xeb17('0x4b')]({'where':{'id':_0x239952[_0xeb17('0x44')]['id']}})['then'](handleEntityNotFound(_0x7b507b,null))[_0xeb17('0x25')](function(_0x135bb2){if(_0x135bb2){_0x282583=_0x135bb2;_0x248dcf[_0xeb17('0x31')]=_[_0xeb17('0x30')](db[_0xeb17('0x4c')][_0xeb17('0x2b')]);_0x248dcf[_0xeb17('0x2f')]=_[_0xeb17('0x30')](_0x239952['query']);_0x248dcf[_0xeb17('0x3a')]=_[_0xeb17('0x33')](_0x248dcf[_0xeb17('0x31')],_0x248dcf[_0xeb17('0x2f')]);_0x4bd441[_0xeb17('0x32')]=_[_0xeb17('0x33')](_0x248dcf['model'],qs['fields'](_0x239952[_0xeb17('0x2f')][_0xeb17('0x34')]));_0x4bd441[_0xeb17('0x32')]=_0x4bd441['attributes']['length']?_0x4bd441[_0xeb17('0x32')]:_0x248dcf[_0xeb17('0x31')];_0x4bd441[_0xeb17('0x37')]=qs[_0xeb17('0x38')](_0x239952[_0xeb17('0x2f')][_0xeb17('0x38')]);_0x4bd441[_0xeb17('0x39')]=qs[_0xeb17('0x3a')](_['pick'](_0x239952['query'],_0x248dcf[_0xeb17('0x3a')]));if(_0x239952[_0xeb17('0x2f')]['filter']){_0x4bd441[_0xeb17('0x39')]=_[_0xeb17('0x3d')](_0x4bd441[_0xeb17('0x39')],{'$or':_[_0xeb17('0x2a')](_0x4bd441[_0xeb17('0x32')],function(_0xb77592){var _0x1a42ac={};_0x1a42ac[_0xb77592]={'$like':'%'+_0x239952[_0xeb17('0x2f')][_0xeb17('0x3c')]+'%'};return _0x1a42ac;})});}_0x4bd441=_['merge']({},_0x4bd441,_0x239952['options']);return _0x282583[_0xeb17('0x50')](_0x4bd441);}})['then'](function(_0x2047b6){if(_0x2047b6){_0x767531=_0x2047b6[_0xeb17('0x35')];if(!_0x239952[_0xeb17('0x2f')][_0xeb17('0x4e')](_0xeb17('0x36'))){_0x4bd441[_0xeb17('0x1e')]=qs[_0xeb17('0x1e')](_0x239952[_0xeb17('0x2f')][_0xeb17('0x1e')]);_0x4bd441[_0xeb17('0x1c')]=qs[_0xeb17('0x1c')](_0x239952['query']['offset']);}return _0x282583[_0xeb17('0x50')](_0x4bd441);}})[_0xeb17('0x25')](function(_0x44d918){if(_0x44d918){return _0x44d918?{'count':_0x767531,'rows':_0x44d918}:null;}})[_0xeb17('0x25')](respondWithResult(_0x7b507b,null))['catch'](handleError(_0x7b507b,null));};exports[_0xeb17('0x51')]=function(_0x51b0e8,_0x20e567,_0x414c6f){var _0x12cf17={};var _0x27ac95={};var _0x5d9dc0;var _0x47d73b;return db[_0xeb17('0x3e')][_0xeb17('0x4b')]({'where':{'id':_0x51b0e8[_0xeb17('0x44')]['id']}})['then'](handleEntityNotFound(_0x20e567,null))[_0xeb17('0x25')](function(_0x31deba){if(_0x31deba){_0x5d9dc0=_0x31deba;_0x27ac95[_0xeb17('0x31')]=_[_0xeb17('0x30')](db[_0xeb17('0x52')]['rawAttributes']);_0x27ac95['query']=_[_0xeb17('0x30')](_0x51b0e8[_0xeb17('0x2f')]);_0x27ac95['filters']=_[_0xeb17('0x33')](_0x27ac95[_0xeb17('0x31')],_0x27ac95['query']);_0x12cf17[_0xeb17('0x32')]=_[_0xeb17('0x33')](_0x27ac95[_0xeb17('0x31')],qs[_0xeb17('0x34')](_0x51b0e8[_0xeb17('0x2f')]['fields']));_0x12cf17[_0xeb17('0x32')]=_0x12cf17[_0xeb17('0x32')][_0xeb17('0x35')]?_0x12cf17[_0xeb17('0x32')]:_0x27ac95[_0xeb17('0x31')];_0x12cf17[_0xeb17('0x37')]=qs[_0xeb17('0x38')](_0x51b0e8[_0xeb17('0x2f')][_0xeb17('0x38')]);_0x12cf17[_0xeb17('0x39')]=qs[_0xeb17('0x3a')](_[_0xeb17('0x3b')](_0x51b0e8[_0xeb17('0x2f')],_0x27ac95[_0xeb17('0x3a')]));if(_0x51b0e8[_0xeb17('0x2f')]['filter']){_0x12cf17[_0xeb17('0x39')]=_[_0xeb17('0x3d')](_0x12cf17[_0xeb17('0x39')],{'$or':_[_0xeb17('0x2a')](_0x12cf17[_0xeb17('0x32')],function(_0x1762f8){var _0x247463={};_0x247463[_0x1762f8]={'$like':'%'+_0x51b0e8[_0xeb17('0x2f')][_0xeb17('0x3c')]+'%'};return _0x247463;})});}_0x12cf17=_[_0xeb17('0x3d')]({},_0x12cf17,_0x51b0e8[_0xeb17('0x45')]);return _0x5d9dc0['getTags'](_0x12cf17);}})[_0xeb17('0x25')](function(_0x153e0f){if(_0x153e0f){_0x47d73b=_0x153e0f['length'];if(!_0x51b0e8[_0xeb17('0x2f')][_0xeb17('0x4e')](_0xeb17('0x36'))){_0x12cf17[_0xeb17('0x1e')]=qs[_0xeb17('0x1e')](_0x51b0e8['query']['limit']);_0x12cf17[_0xeb17('0x1c')]=qs['offset'](_0x51b0e8['query'][_0xeb17('0x1c')]);}return _0x5d9dc0['getTags'](_0x12cf17);}})['then'](function(_0x3bfba8){if(_0x3bfba8){return _0x3bfba8?{'count':_0x47d73b,'rows':_0x3bfba8}:null;}})[_0xeb17('0x25')](respondWithResult(_0x20e567,null))[_0xeb17('0x47')](handleError(_0x20e567,null));};exports[_0xeb17('0x53')]=function(_0x11d55d,_0x4cfd89,_0x5b1464){if(_0x11d55d['body']['id']){delete _0x11d55d['body']['id'];}return db[_0xeb17('0x3e')][_0xeb17('0x4b')]({'where':{'id':_0x11d55d[_0xeb17('0x44')]['id']}})[_0xeb17('0x25')](handleEntityNotFound(_0x4cfd89,null))['then'](function(_0x41c8d5){if(_0x41c8d5){return _0x41c8d5[_0xeb17('0x53')](_0x11d55d[_0xeb17('0x49')]['ids']||[]);}return null;})[_0xeb17('0x25')](respondWithResult(_0x4cfd89,null))['catch'](handleError(_0x4cfd89,null));}; \ No newline at end of file +var _0x9dbf=['getSubjects','getDescriptions','Tag','getTags','setTags','ids','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','then','destroy','error','send','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','intersection','options','find','catch','create','update','body','findOne','ZendeskField','getFields'];(function(_0x5c9be6,_0x5a9ecc){var _0xf6afb8=function(_0x405880){while(--_0x405880){_0x5c9be6['push'](_0x5c9be6['shift']());}};_0xf6afb8(++_0x5a9ecc);}(_0x9dbf,0x1f2));var _0xf9db=function(_0x1dfb11,_0x2f701f){_0x1dfb11=_0x1dfb11-0x0;var _0x239903=_0x9dbf[_0x1dfb11];return _0x239903;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf9db('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf9db('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf9db('0x2'));var Mustache=require(_0xf9db('0x3'));var util=require('util');var path=require(_0xf9db('0x4'));var sox=require(_0xf9db('0x5'));var csv=require(_0xf9db('0x6'));var ejs=require(_0xf9db('0x7'));var fs=require('fs');var fs_extra=require(_0xf9db('0x8'));var _=require(_0xf9db('0x9'));var squel=require(_0xf9db('0xa'));var crypto=require(_0xf9db('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf9db('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf9db('0xd'));var Papa=require(_0xf9db('0xe'));var Redis=require(_0xf9db('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf9db('0x10'));var hardwareService=require(_0xf9db('0x11'));var logger=require(_0xf9db('0x12'))(_0xf9db('0x13'));var utils=require(_0xf9db('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf9db('0x15'));var db=require(_0xf9db('0x16'))['db'];function respondWithStatusCode(_0xb922dc,_0x56b4cf){_0x56b4cf=_0x56b4cf||0xcc;return function(_0x4022f0){if(_0x4022f0){return _0xb922dc[_0xf9db('0x17')](_0x56b4cf);}return _0xb922dc[_0xf9db('0x18')](_0x56b4cf)[_0xf9db('0x19')]();};}function respondWithResult(_0x3eb835,_0x259996){_0x259996=_0x259996||0xc8;return function(_0x3858b3){if(_0x3858b3){return _0x3eb835[_0xf9db('0x18')](_0x259996)[_0xf9db('0x1a')](_0x3858b3);}};}function respondWithFilteredResult(_0x1b4ace,_0x515bd8){return function(_0x3c6df5){if(_0x3c6df5){var _0x306f66=typeof _0x515bd8[_0xf9db('0x1b')]==='undefined'&&typeof _0x515bd8[_0xf9db('0x1c')]==='undefined';var _0x29aede=_0x3c6df5[_0xf9db('0x1d')];var _0x35aaeb=_0x306f66?0x0:_0x515bd8[_0xf9db('0x1b')];var _0x333a6d=_0x306f66?_0x3c6df5[_0xf9db('0x1d')]:_0x515bd8[_0xf9db('0x1b')]+_0x515bd8[_0xf9db('0x1c')];var _0x2485a7;if(_0x333a6d>=_0x29aede){_0x333a6d=_0x29aede;_0x2485a7=0xc8;}else{_0x2485a7=0xce;}_0x1b4ace[_0xf9db('0x18')](_0x2485a7);return _0x1b4ace[_0xf9db('0x1e')](_0xf9db('0x1f'),_0x35aaeb+'-'+_0x333a6d+'/'+_0x29aede)['json'](_0x3c6df5);}return null;};}function patchUpdates(_0x3c11c0){return function(_0x50413d){try{jsonpatch['apply'](_0x50413d,_0x3c11c0,!![]);}catch(_0x1d62d2){return BPromise[_0xf9db('0x20')](_0x1d62d2);}return _0x50413d['save']();};}function saveUpdates(_0x33f454,_0x2e010b){return function(_0x5e445c){if(_0x5e445c){return _0x5e445c['update'](_0x33f454)[_0xf9db('0x21')](function(_0x3214c8){return _0x3214c8;});}return null;};}function removeEntity(_0x27f404,_0x4ed2e7){return function(_0x211806){if(_0x211806){return _0x211806[_0xf9db('0x22')]()[_0xf9db('0x21')](function(){_0x27f404[_0xf9db('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x483352,_0x3b9d8f){return function(_0x1e758f){if(!_0x1e758f){_0x483352['sendStatus'](0x194);}return _0x1e758f;};}function handleError(_0x4d5403,_0xfff709){_0xfff709=_0xfff709||0x1f4;return function(_0x418b75){logger[_0xf9db('0x23')](_0x418b75['stack']);if(_0x418b75['name']){delete _0x418b75['name'];}_0x4d5403[_0xf9db('0x18')](_0xfff709)[_0xf9db('0x24')](_0x418b75);};}exports['index']=function(_0x1b6493,_0x389fd3){var _0x46e898={},_0x5674e3={},_0x52dd23={'count':0x0,'rows':[]};var _0x1bb9da=_[_0xf9db('0x25')](db[_0xf9db('0x26')][_0xf9db('0x27')],function(_0x1ae49c){return{'name':_0x1ae49c[_0xf9db('0x28')],'type':_0x1ae49c[_0xf9db('0x29')][_0xf9db('0x2a')]};});_0x5674e3[_0xf9db('0x2b')]=_[_0xf9db('0x25')](_0x1bb9da,_0xf9db('0x2c'));_0x5674e3[_0xf9db('0x2d')]=_[_0xf9db('0x2e')](_0x1b6493['query']);_0x5674e3[_0xf9db('0x2f')]=_['intersection'](_0x5674e3['model'],_0x5674e3['query']);_0x46e898[_0xf9db('0x30')]=_['intersection'](_0x5674e3[_0xf9db('0x2b')],qs[_0xf9db('0x31')](_0x1b6493[_0xf9db('0x2d')][_0xf9db('0x31')]));_0x46e898[_0xf9db('0x30')]=_0x46e898[_0xf9db('0x30')][_0xf9db('0x32')]?_0x46e898[_0xf9db('0x30')]:_0x5674e3['model'];if(!_0x1b6493[_0xf9db('0x2d')][_0xf9db('0x33')](_0xf9db('0x34'))){_0x46e898[_0xf9db('0x1c')]=qs['limit'](_0x1b6493[_0xf9db('0x2d')]['limit']);_0x46e898['offset']=qs[_0xf9db('0x1b')](_0x1b6493[_0xf9db('0x2d')][_0xf9db('0x1b')]);}_0x46e898[_0xf9db('0x35')]=qs['sort'](_0x1b6493[_0xf9db('0x2d')][_0xf9db('0x36')]);_0x46e898[_0xf9db('0x37')]=qs[_0xf9db('0x2f')](_[_0xf9db('0x38')](_0x1b6493[_0xf9db('0x2d')],_0x5674e3['filters']),_0x1bb9da);if(_0x1b6493[_0xf9db('0x2d')]['filter']){_0x46e898['where']=_[_0xf9db('0x39')](_0x46e898['where'],{'$or':_['map'](_0x1bb9da,function(_0x53e5a3){if(_0x53e5a3[_0xf9db('0x29')]!==_0xf9db('0x3a')){var _0x5bc315={};_0x5bc315[_0x53e5a3[_0xf9db('0x2c')]]={'$like':'%'+_0x1b6493[_0xf9db('0x2d')][_0xf9db('0x3b')]+'%'};return _0x5bc315;}})});}_0x46e898=_['merge']({},_0x46e898,_0x1b6493['options']);var _0xbae336={'where':_0x46e898[_0xf9db('0x37')]};return db['ZendeskConfiguration'][_0xf9db('0x1d')](_0xbae336)['then'](function(_0x5244fe){_0x52dd23[_0xf9db('0x1d')]=_0x5244fe;if(_0x1b6493['query'][_0xf9db('0x3c')]){_0x46e898[_0xf9db('0x3d')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xf9db('0x3e')](_0x46e898);})['then'](function(_0x205d29){_0x52dd23[_0xf9db('0x3f')]=_0x205d29;return _0x52dd23;})['then'](respondWithFilteredResult(_0x389fd3,_0x46e898))['catch'](handleError(_0x389fd3,null));};exports[_0xf9db('0x40')]=function(_0x48eaa9,_0x3554dd){var _0x9d3c74={'raw':![],'where':{'id':_0x48eaa9[_0xf9db('0x41')]['id']}},_0x54b755={};_0x54b755[_0xf9db('0x2b')]=_[_0xf9db('0x2e')](db['ZendeskConfiguration']['rawAttributes']);_0x54b755[_0xf9db('0x2d')]=_['keys'](_0x48eaa9[_0xf9db('0x2d')]);_0x54b755[_0xf9db('0x2f')]=_['intersection'](_0x54b755[_0xf9db('0x2b')],_0x54b755[_0xf9db('0x2d')]);_0x9d3c74[_0xf9db('0x30')]=_[_0xf9db('0x42')](_0x54b755[_0xf9db('0x2b')],qs[_0xf9db('0x31')](_0x48eaa9['query'][_0xf9db('0x31')]));_0x9d3c74[_0xf9db('0x30')]=_0x9d3c74[_0xf9db('0x30')]['length']?_0x9d3c74[_0xf9db('0x30')]:_0x54b755[_0xf9db('0x2b')];if(_0x48eaa9[_0xf9db('0x2d')][_0xf9db('0x3c')]){_0x9d3c74[_0xf9db('0x3d')]=[{'all':!![]}];}_0x9d3c74=_[_0xf9db('0x39')]({},_0x9d3c74,_0x48eaa9[_0xf9db('0x43')]);return db[_0xf9db('0x26')][_0xf9db('0x44')](_0x9d3c74)[_0xf9db('0x21')](handleEntityNotFound(_0x3554dd,null))[_0xf9db('0x21')](respondWithResult(_0x3554dd,null))[_0xf9db('0x45')](handleError(_0x3554dd,null));};exports[_0xf9db('0x46')]=function(_0x38f1fd,_0x27ada0){return db[_0xf9db('0x26')][_0xf9db('0x46')](_0x38f1fd['body'],{})[_0xf9db('0x21')](respondWithResult(_0x27ada0,0xc9))[_0xf9db('0x45')](handleError(_0x27ada0,null));};exports[_0xf9db('0x47')]=function(_0x24ab3f,_0x4afb24){if(_0x24ab3f[_0xf9db('0x48')]['id']){delete _0x24ab3f[_0xf9db('0x48')]['id'];}return db[_0xf9db('0x26')][_0xf9db('0x44')]({'where':{'id':_0x24ab3f[_0xf9db('0x41')]['id']}})[_0xf9db('0x21')](handleEntityNotFound(_0x4afb24,null))[_0xf9db('0x21')](saveUpdates(_0x24ab3f[_0xf9db('0x48')],null))['then'](respondWithResult(_0x4afb24,null))[_0xf9db('0x45')](handleError(_0x4afb24,null));};exports[_0xf9db('0x22')]=function(_0x46cc3d,_0x2cc452){return db[_0xf9db('0x26')][_0xf9db('0x44')]({'where':{'id':_0x46cc3d[_0xf9db('0x41')]['id']}})[_0xf9db('0x21')](handleEntityNotFound(_0x2cc452,null))[_0xf9db('0x21')](removeEntity(_0x2cc452,null))[_0xf9db('0x45')](handleError(_0x2cc452,null));};exports['getFields']=function(_0x4264d6,_0xc8167d,_0x400589){var _0x337d18={};var _0x4301c6={};var _0x564f75;var _0x2e2aab;return db[_0xf9db('0x26')][_0xf9db('0x49')]({'where':{'id':_0x4264d6[_0xf9db('0x41')]['id']}})[_0xf9db('0x21')](handleEntityNotFound(_0xc8167d,null))[_0xf9db('0x21')](function(_0x30894e){if(_0x30894e){_0x564f75=_0x30894e;_0x4301c6[_0xf9db('0x2b')]=_[_0xf9db('0x2e')](db[_0xf9db('0x4a')][_0xf9db('0x27')]);_0x4301c6['query']=_[_0xf9db('0x2e')](_0x4264d6[_0xf9db('0x2d')]);_0x4301c6['filters']=_[_0xf9db('0x42')](_0x4301c6[_0xf9db('0x2b')],_0x4301c6[_0xf9db('0x2d')]);_0x337d18['attributes']=_['intersection'](_0x4301c6[_0xf9db('0x2b')],qs['fields'](_0x4264d6[_0xf9db('0x2d')][_0xf9db('0x31')]));_0x337d18[_0xf9db('0x30')]=_0x337d18[_0xf9db('0x30')][_0xf9db('0x32')]?_0x337d18[_0xf9db('0x30')]:_0x4301c6[_0xf9db('0x2b')];_0x337d18[_0xf9db('0x35')]=qs[_0xf9db('0x36')](_0x4264d6['query'][_0xf9db('0x36')]);_0x337d18['where']=qs['filters'](_[_0xf9db('0x38')](_0x4264d6[_0xf9db('0x2d')],_0x4301c6['filters']));if(_0x4264d6[_0xf9db('0x2d')][_0xf9db('0x3b')]){_0x337d18[_0xf9db('0x37')]=_[_0xf9db('0x39')](_0x337d18['where'],{'$or':_[_0xf9db('0x25')](_0x337d18['attributes'],function(_0x2b8c71){var _0x21cca2={};_0x21cca2[_0x2b8c71]={'$like':'%'+_0x4264d6[_0xf9db('0x2d')]['filter']+'%'};return _0x21cca2;})});}_0x337d18=_[_0xf9db('0x39')]({},_0x337d18,_0x4264d6[_0xf9db('0x43')]);return _0x564f75[_0xf9db('0x4b')](_0x337d18);}})['then'](function(_0x108b4e){if(_0x108b4e){_0x2e2aab=_0x108b4e[_0xf9db('0x32')];if(!_0x4264d6[_0xf9db('0x2d')][_0xf9db('0x33')]('nolimit')){_0x337d18[_0xf9db('0x1c')]=qs[_0xf9db('0x1c')](_0x4264d6[_0xf9db('0x2d')][_0xf9db('0x1c')]);_0x337d18[_0xf9db('0x1b')]=qs[_0xf9db('0x1b')](_0x4264d6[_0xf9db('0x2d')][_0xf9db('0x1b')]);}return _0x564f75[_0xf9db('0x4b')](_0x337d18);}})[_0xf9db('0x21')](function(_0x15c790){if(_0x15c790){return _0x15c790?{'count':_0x2e2aab,'rows':_0x15c790}:null;}})['then'](respondWithResult(_0xc8167d,null))['catch'](handleError(_0xc8167d,null));};exports[_0xf9db('0x4c')]=function(_0x236181,_0xbc0554,_0x5108a7){var _0x4571ba={};var _0x3cdb67={};var _0xa2456a;var _0x23a2aa;return db[_0xf9db('0x26')][_0xf9db('0x49')]({'where':{'id':_0x236181[_0xf9db('0x41')]['id']}})[_0xf9db('0x21')](handleEntityNotFound(_0xbc0554,null))['then'](function(_0x45fba6){if(_0x45fba6){_0xa2456a=_0x45fba6;_0x3cdb67[_0xf9db('0x2b')]=_[_0xf9db('0x2e')](db['ZendeskField'][_0xf9db('0x27')]);_0x3cdb67['query']=_[_0xf9db('0x2e')](_0x236181[_0xf9db('0x2d')]);_0x3cdb67['filters']=_['intersection'](_0x3cdb67[_0xf9db('0x2b')],_0x3cdb67['query']);_0x4571ba[_0xf9db('0x30')]=_['intersection'](_0x3cdb67['model'],qs[_0xf9db('0x31')](_0x236181['query'][_0xf9db('0x31')]));_0x4571ba[_0xf9db('0x30')]=_0x4571ba[_0xf9db('0x30')][_0xf9db('0x32')]?_0x4571ba[_0xf9db('0x30')]:_0x3cdb67[_0xf9db('0x2b')];_0x4571ba[_0xf9db('0x35')]=qs['sort'](_0x236181[_0xf9db('0x2d')][_0xf9db('0x36')]);_0x4571ba[_0xf9db('0x37')]=qs[_0xf9db('0x2f')](_[_0xf9db('0x38')](_0x236181[_0xf9db('0x2d')],_0x3cdb67['filters']));if(_0x236181[_0xf9db('0x2d')][_0xf9db('0x3b')]){_0x4571ba[_0xf9db('0x37')]=_['merge'](_0x4571ba[_0xf9db('0x37')],{'$or':_[_0xf9db('0x25')](_0x4571ba['attributes'],function(_0x48b40e){var _0x2e227d={};_0x2e227d[_0x48b40e]={'$like':'%'+_0x236181[_0xf9db('0x2d')]['filter']+'%'};return _0x2e227d;})});}_0x4571ba=_[_0xf9db('0x39')]({},_0x4571ba,_0x236181[_0xf9db('0x43')]);return _0xa2456a[_0xf9db('0x4c')](_0x4571ba);}})[_0xf9db('0x21')](function(_0x5ba776){if(_0x5ba776){_0x23a2aa=_0x5ba776[_0xf9db('0x32')];if(!_0x236181['query'][_0xf9db('0x33')](_0xf9db('0x34'))){_0x4571ba[_0xf9db('0x1c')]=qs[_0xf9db('0x1c')](_0x236181['query'][_0xf9db('0x1c')]);_0x4571ba[_0xf9db('0x1b')]=qs[_0xf9db('0x1b')](_0x236181[_0xf9db('0x2d')][_0xf9db('0x1b')]);}return _0xa2456a[_0xf9db('0x4c')](_0x4571ba);}})[_0xf9db('0x21')](function(_0x4f6e8a){if(_0x4f6e8a){return _0x4f6e8a?{'count':_0x23a2aa,'rows':_0x4f6e8a}:null;}})[_0xf9db('0x21')](respondWithResult(_0xbc0554,null))[_0xf9db('0x45')](handleError(_0xbc0554,null));};exports[_0xf9db('0x4d')]=function(_0x147dbc,_0x1acb87,_0x32644d){var _0x583200={};var _0x5cc212={};var _0x377fa0;var _0x80f1db;return db[_0xf9db('0x26')][_0xf9db('0x49')]({'where':{'id':_0x147dbc[_0xf9db('0x41')]['id']}})[_0xf9db('0x21')](handleEntityNotFound(_0x1acb87,null))[_0xf9db('0x21')](function(_0x28c50b){if(_0x28c50b){_0x377fa0=_0x28c50b;_0x5cc212[_0xf9db('0x2b')]=_[_0xf9db('0x2e')](db[_0xf9db('0x4a')][_0xf9db('0x27')]);_0x5cc212[_0xf9db('0x2d')]=_['keys'](_0x147dbc[_0xf9db('0x2d')]);_0x5cc212['filters']=_[_0xf9db('0x42')](_0x5cc212[_0xf9db('0x2b')],_0x5cc212[_0xf9db('0x2d')]);_0x583200[_0xf9db('0x30')]=_[_0xf9db('0x42')](_0x5cc212['model'],qs['fields'](_0x147dbc[_0xf9db('0x2d')][_0xf9db('0x31')]));_0x583200[_0xf9db('0x30')]=_0x583200[_0xf9db('0x30')][_0xf9db('0x32')]?_0x583200[_0xf9db('0x30')]:_0x5cc212['model'];_0x583200[_0xf9db('0x35')]=qs[_0xf9db('0x36')](_0x147dbc['query'][_0xf9db('0x36')]);_0x583200[_0xf9db('0x37')]=qs['filters'](_[_0xf9db('0x38')](_0x147dbc['query'],_0x5cc212[_0xf9db('0x2f')]));if(_0x147dbc['query'][_0xf9db('0x3b')]){_0x583200[_0xf9db('0x37')]=_[_0xf9db('0x39')](_0x583200[_0xf9db('0x37')],{'$or':_[_0xf9db('0x25')](_0x583200['attributes'],function(_0x48a56e){var _0x4ed115={};_0x4ed115[_0x48a56e]={'$like':'%'+_0x147dbc['query'][_0xf9db('0x3b')]+'%'};return _0x4ed115;})});}_0x583200=_[_0xf9db('0x39')]({},_0x583200,_0x147dbc[_0xf9db('0x43')]);return _0x377fa0['getDescriptions'](_0x583200);}})[_0xf9db('0x21')](function(_0x34d631){if(_0x34d631){_0x80f1db=_0x34d631[_0xf9db('0x32')];if(!_0x147dbc['query'][_0xf9db('0x33')]('nolimit')){_0x583200[_0xf9db('0x1c')]=qs['limit'](_0x147dbc[_0xf9db('0x2d')]['limit']);_0x583200[_0xf9db('0x1b')]=qs[_0xf9db('0x1b')](_0x147dbc[_0xf9db('0x2d')][_0xf9db('0x1b')]);}return _0x377fa0[_0xf9db('0x4d')](_0x583200);}})[_0xf9db('0x21')](function(_0x1b7ad7){if(_0x1b7ad7){return _0x1b7ad7?{'count':_0x80f1db,'rows':_0x1b7ad7}:null;}})[_0xf9db('0x21')](respondWithResult(_0x1acb87,null))[_0xf9db('0x45')](handleError(_0x1acb87,null));};exports['getTags']=function(_0x4d21a3,_0x1f49c1,_0x1bedb5){var _0x16e5af={};var _0x366bf3={};var _0x84cdec;var _0xb70484;return db[_0xf9db('0x26')][_0xf9db('0x49')]({'where':{'id':_0x4d21a3[_0xf9db('0x41')]['id']}})['then'](handleEntityNotFound(_0x1f49c1,null))['then'](function(_0x3b8523){if(_0x3b8523){_0x84cdec=_0x3b8523;_0x366bf3['model']=_[_0xf9db('0x2e')](db[_0xf9db('0x4e')][_0xf9db('0x27')]);_0x366bf3['query']=_[_0xf9db('0x2e')](_0x4d21a3[_0xf9db('0x2d')]);_0x366bf3[_0xf9db('0x2f')]=_[_0xf9db('0x42')](_0x366bf3[_0xf9db('0x2b')],_0x366bf3[_0xf9db('0x2d')]);_0x16e5af[_0xf9db('0x30')]=_[_0xf9db('0x42')](_0x366bf3[_0xf9db('0x2b')],qs[_0xf9db('0x31')](_0x4d21a3[_0xf9db('0x2d')][_0xf9db('0x31')]));_0x16e5af[_0xf9db('0x30')]=_0x16e5af[_0xf9db('0x30')]['length']?_0x16e5af[_0xf9db('0x30')]:_0x366bf3[_0xf9db('0x2b')];_0x16e5af[_0xf9db('0x35')]=qs[_0xf9db('0x36')](_0x4d21a3['query']['sort']);_0x16e5af[_0xf9db('0x37')]=qs[_0xf9db('0x2f')](_[_0xf9db('0x38')](_0x4d21a3[_0xf9db('0x2d')],_0x366bf3[_0xf9db('0x2f')]));if(_0x4d21a3[_0xf9db('0x2d')]['filter']){_0x16e5af[_0xf9db('0x37')]=_['merge'](_0x16e5af[_0xf9db('0x37')],{'$or':_[_0xf9db('0x25')](_0x16e5af[_0xf9db('0x30')],function(_0x553441){var _0x50ffcc={};_0x50ffcc[_0x553441]={'$like':'%'+_0x4d21a3[_0xf9db('0x2d')][_0xf9db('0x3b')]+'%'};return _0x50ffcc;})});}_0x16e5af=_[_0xf9db('0x39')]({},_0x16e5af,_0x4d21a3[_0xf9db('0x43')]);return _0x84cdec['getTags'](_0x16e5af);}})[_0xf9db('0x21')](function(_0x4c804c){if(_0x4c804c){_0xb70484=_0x4c804c[_0xf9db('0x32')];if(!_0x4d21a3[_0xf9db('0x2d')][_0xf9db('0x33')]('nolimit')){_0x16e5af['limit']=qs[_0xf9db('0x1c')](_0x4d21a3[_0xf9db('0x2d')][_0xf9db('0x1c')]);_0x16e5af[_0xf9db('0x1b')]=qs[_0xf9db('0x1b')](_0x4d21a3['query'][_0xf9db('0x1b')]);}return _0x84cdec[_0xf9db('0x4f')](_0x16e5af);}})['then'](function(_0x566cff){if(_0x566cff){return _0x566cff?{'count':_0xb70484,'rows':_0x566cff}:null;}})[_0xf9db('0x21')](respondWithResult(_0x1f49c1,null))[_0xf9db('0x45')](handleError(_0x1f49c1,null));};exports[_0xf9db('0x50')]=function(_0x2c057d,_0x5e0574,_0x372bd9){if(_0x2c057d[_0xf9db('0x48')]['id']){delete _0x2c057d[_0xf9db('0x48')]['id'];}return db[_0xf9db('0x26')][_0xf9db('0x49')]({'where':{'id':_0x2c057d[_0xf9db('0x41')]['id']}})[_0xf9db('0x21')](handleEntityNotFound(_0x5e0574,null))['then'](function(_0x541d7a){if(_0x541d7a){return _0x541d7a[_0xf9db('0x50')](_0x2c057d[_0xf9db('0x48')][_0xf9db('0x51')]||[]);}return null;})[_0xf9db('0x21')](respondWithResult(_0x5e0574,null))['catch'](handleError(_0x5e0574,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index dbbe7a2..eaec94b 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 _0x7d25=['api','moment','bluebird','request-promise','path','define','ZendeskConfiguration','int_zendesk_configurations','util','../../config/logger'];(function(_0x2ae5ce,_0x481760){var _0x3ccd3c=function(_0x3b870c){while(--_0x3b870c){_0x2ae5ce['push'](_0x2ae5ce['shift']());}};_0x3ccd3c(++_0x481760);}(_0x7d25,0x8a));var _0x57d2=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x7d25[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var logger=require(_0x57d2('0x1'))(_0x57d2('0x2'));var moment=require(_0x57d2('0x3'));var BPromise=require(_0x57d2('0x4'));var rp=require(_0x57d2('0x5'));var fs=require('fs');var path=require(_0x57d2('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZendeskConfiguration.attributes');module['exports']=function(_0x3c5511,_0x49cc5f){return _0x3c5511[_0x57d2('0x7')](_0x57d2('0x8'),attributes,{'tableName':_0x57d2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34b7=['request-promise','path','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','../../config/logger','api','moment','bluebird'];(function(_0x2ccd5e,_0x3deb44){var _0x1a758e=function(_0x535991){while(--_0x535991){_0x2ccd5e['push'](_0x2ccd5e['shift']());}};_0x1a758e(++_0x3deb44);}(_0x34b7,0x196));var _0x734b=function(_0x784d87,_0x4f0284){_0x784d87=_0x784d87-0x0;var _0x22e453=_0x34b7[_0x784d87];return _0x22e453;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x734b('0x0'))(_0x734b('0x1'));var moment=require(_0x734b('0x2'));var BPromise=require(_0x734b('0x3'));var rp=require(_0x734b('0x4'));var fs=require('fs');var path=require(_0x734b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x734b('0x6'));module[_0x734b('0x7')]=function(_0x2f3128,_0x34fd70){return _0x2f3128[_0x734b('0x8')](_0x734b('0x9'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index cbfb2c9..6234715 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 _0xcfc0=['../../config/environment','jayson/promise','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x32c2be,_0x30f256){var _0x1541d3=function(_0x36af99){while(--_0x36af99){_0x32c2be['push'](_0x32c2be['shift']());}};_0x1541d3(++_0x30f256);}(_0xcfc0,0x167));var _0x0cfc=function(_0x2c4c5d,_0xd4c210){_0x2c4c5d=_0x2c4c5d-0x0;var _0x3d4e6f=_0xcfc0[_0x2c4c5d];return _0x3d4e6f;};'use strict';var _=require(_0x0cfc('0x0'));var util=require(_0x0cfc('0x1'));var moment=require(_0x0cfc('0x2'));var BPromise=require(_0x0cfc('0x3'));var rs=require(_0x0cfc('0x4'));var fs=require('fs');var Redis=require(_0x0cfc('0x5'));var db=require(_0x0cfc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0cfc('0x7'))(_0x0cfc('0x8'));var config=require(_0x0cfc('0x9'));var jayson=require(_0x0cfc('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x45d832,_0x1e9c0c,_0x553cd4){return new BPromise(function(_0x162a31,_0x2554bb){return client[_0x0cfc('0xb')](_0x45d832,_0x553cd4)[_0x0cfc('0xc')](function(_0x36ea27){logger['info'](_0x0cfc('0xd'),_0x1e9c0c,_0x0cfc('0xe'));logger[_0x0cfc('0xf')](_0x0cfc('0x10'),_0x1e9c0c,_0x0cfc('0xe'),JSON[_0x0cfc('0x11')](_0x36ea27));if(_0x36ea27[_0x0cfc('0x12')]){if(_0x36ea27[_0x0cfc('0x12')][_0x0cfc('0x13')]===0x1f4){logger[_0x0cfc('0x12')](_0x0cfc('0xd'),_0x1e9c0c,_0x36ea27['error'][_0x0cfc('0x14')]);return _0x2554bb(_0x36ea27[_0x0cfc('0x12')][_0x0cfc('0x14')]);}logger[_0x0cfc('0x12')](_0x0cfc('0xd'),_0x1e9c0c,_0x36ea27['error'][_0x0cfc('0x14')]);return _0x162a31(_0x36ea27[_0x0cfc('0x12')]['message']);}else{logger[_0x0cfc('0x15')](_0x0cfc('0xd'),_0x1e9c0c,'request\x20sent');_0x162a31(_0x36ea27['result'][_0x0cfc('0x14')]);}})[_0x0cfc('0x16')](function(_0xde6364){logger[_0x0cfc('0x12')](_0x0cfc('0xd'),_0x1e9c0c,_0xde6364);_0x2554bb(_0xde6364);});});} \ No newline at end of file +var _0xaf0a=['ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1cc0f8,_0x431296){var _0x1f9be1=function(_0x4d7ff4){while(--_0x4d7ff4){_0x1cc0f8['push'](_0x1cc0f8['shift']());}};_0x1f9be1(++_0x431296);}(_0xaf0a,0x128));var _0xaaf0=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xaf0a[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0xaaf0('0x0'));var util=require('util');var moment=require(_0xaaf0('0x1'));var BPromise=require(_0xaaf0('0x2'));var rs=require(_0xaaf0('0x3'));var fs=require('fs');var Redis=require(_0xaaf0('0x4'));var db=require(_0xaaf0('0x5'))['db'];var utils=require(_0xaaf0('0x6'));var logger=require(_0xaaf0('0x7'))(_0xaaf0('0x8'));var config=require(_0xaaf0('0x9'));var jayson=require(_0xaaf0('0xa'));var client=jayson[_0xaaf0('0xb')][_0xaaf0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2a0fc7,_0x2254f1,_0x58055c){return new BPromise(function(_0x14928d,_0x4aa455){return client[_0xaaf0('0xd')](_0x2a0fc7,_0x58055c)[_0xaaf0('0xe')](function(_0x540ba2){logger[_0xaaf0('0xf')](_0xaaf0('0x10'),_0x2254f1,_0xaaf0('0x11'));logger['debug'](_0xaaf0('0x12'),_0x2254f1,_0xaaf0('0x11'),JSON[_0xaaf0('0x13')](_0x540ba2));if(_0x540ba2[_0xaaf0('0x14')]){if(_0x540ba2[_0xaaf0('0x14')][_0xaaf0('0x15')]===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x2254f1,_0x540ba2[_0xaaf0('0x14')]['message']);return _0x4aa455(_0x540ba2['error']['message']);}logger[_0xaaf0('0x14')](_0xaaf0('0x10'),_0x2254f1,_0x540ba2[_0xaaf0('0x14')][_0xaaf0('0x16')]);return _0x14928d(_0x540ba2['error'][_0xaaf0('0x16')]);}else{logger['info'](_0xaaf0('0x10'),_0x2254f1,'request\x20sent');_0x14928d(_0x540ba2['result'][_0xaaf0('0x16')]);}})[_0xaaf0('0x17')](function(_0x30bdbe){logger[_0xaaf0('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2254f1,_0x30bdbe);_0x4aa455(_0x30bdbe);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index c63aeec..063409d 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 _0x658f=['/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','get'];(function(_0x14d996,_0x403389){var _0x577f12=function(_0x201992){while(--_0x201992){_0x14d996['push'](_0x14d996['shift']());}};_0x577f12(++_0x403389);}(_0x658f,0xbc));var _0xf658=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x658f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf658('0x0'));var util=require(_0xf658('0x1'));var path=require(_0xf658('0x2'));var timeout=require('connect-timeout');var express=require(_0xf658('0x3'));var router=express[_0xf658('0x4')]();var fs_extra=require(_0xf658('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf658('0x6'));var config=require(_0xf658('0x7'));var controller=require(_0xf658('0x8'));router['get']('/',auth[_0xf658('0x9')](),controller[_0xf658('0xa')]);router[_0xf658('0xb')](_0xf658('0xc'),auth['isAuthenticated'](),controller[_0xf658('0xd')]);router[_0xf658('0xe')]('/',auth['isAuthenticated'](),controller[_0xf658('0xf')]);router['put'](_0xf658('0xc'),auth[_0xf658('0x9')](),controller[_0xf658('0x10')]);router[_0xf658('0x11')](_0xf658('0xc'),auth[_0xf658('0x9')](),controller[_0xf658('0x12')]);module[_0xf658('0x13')]=router; \ No newline at end of file +var _0xbd80=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra'];(function(_0x308ff9,_0x3148cb){var _0x148225=function(_0x1c006b){while(--_0x1c006b){_0x308ff9['push'](_0x308ff9['shift']());}};_0x148225(++_0x3148cb);}(_0xbd80,0x13b));var _0x0bd8=function(_0x22cb0c,_0x80e6af){_0x22cb0c=_0x22cb0c-0x0;var _0x203ce2=_0xbd80[_0x22cb0c];return _0x203ce2;};'use strict';var multer=require(_0x0bd8('0x0'));var util=require('util');var path=require(_0x0bd8('0x1'));var timeout=require(_0x0bd8('0x2'));var express=require(_0x0bd8('0x3'));var router=express['Router']();var fs_extra=require(_0x0bd8('0x4'));var auth=require(_0x0bd8('0x5'));var interaction=require(_0x0bd8('0x6'));var config=require(_0x0bd8('0x7'));var controller=require(_0x0bd8('0x8'));router[_0x0bd8('0x9')]('/',auth[_0x0bd8('0xa')](),controller[_0x0bd8('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x0bd8('0xc')]);router[_0x0bd8('0xd')]('/',auth[_0x0bd8('0xa')](),controller[_0x0bd8('0xe')]);router[_0x0bd8('0xf')](_0x0bd8('0x10'),auth[_0x0bd8('0xa')](),controller['update']);router[_0x0bd8('0x11')](_0x0bd8('0x10'),auth[_0x0bd8('0xa')](),controller[_0x0bd8('0x12')]);module[_0x0bd8('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 92f0af5..5341e91 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 _0xcfb0=['string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','picklist'];(function(_0x489420,_0x3af830){var _0x2104d8=function(_0x48a621){while(--_0x48a621){_0x489420['push'](_0x489420['shift']());}};_0x2104d8(++_0x3af830);}(_0xcfb0,0xd2));var _0x0cfb=function(_0x28347d,_0x2494c4){_0x28347d=_0x28347d-0x0;var _0x1c8324=_0xcfb0[_0x28347d];return _0x1c8324;};'use strict';var Sequelize=require(_0x0cfb('0x0'));module[_0x0cfb('0x1')]={'type':{'type':Sequelize[_0x0cfb('0x2')]('string',_0x0cfb('0x3'),_0x0cfb('0x4'),'keyValue',_0x0cfb('0x5')),'defaultValue':_0x0cfb('0x6')},'content':{'type':Sequelize[_0x0cfb('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x0cfb('0x6'),_0x0cfb('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x0cfb('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0cfb('0x7')]},'customField':{'type':Sequelize[_0x0cfb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0cfb('0x7')]}}; \ No newline at end of file +var _0xd256=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','picklist'];(function(_0x5a5681,_0x5427ac){var _0x4a563b=function(_0x2edda1){while(--_0x2edda1){_0x5a5681['push'](_0x5a5681['shift']());}};_0x4a563b(++_0x5427ac);}(_0xd256,0x134));var _0x6d25=function(_0x34c5a3,_0x5e5b13){_0x34c5a3=_0x34c5a3-0x0;var _0x1a3adf=_0xd256[_0x34c5a3];return _0x1a3adf;};'use strict';var Sequelize=require(_0x6d25('0x0'));module[_0x6d25('0x1')]={'type':{'type':Sequelize[_0x6d25('0x2')](_0x6d25('0x3'),_0x6d25('0x4'),_0x6d25('0x5'),'keyValue',_0x6d25('0x6')),'defaultValue':_0x6d25('0x3')},'content':{'type':Sequelize[_0x6d25('0x7')]},'key':{'type':Sequelize[_0x6d25('0x7')]},'keyType':{'type':Sequelize['ENUM']('string',_0x6d25('0x4'),_0x6d25('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6d25('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6d25('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6d25('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 5c90b2e..c092e75 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 _0x71c8=['query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','name','send','index','map','ZendeskField','fieldName','model'];(function(_0x54ddd7,_0x223146){var _0x24513c=function(_0x2deba1){while(--_0x2deba1){_0x54ddd7['push'](_0x54ddd7['shift']());}};_0x24513c(++_0x223146);}(_0x71c8,0x149));var _0x871c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x71c8[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x871c('0x0'));var rimraf=require(_0x871c('0x1'));var zipdir=require(_0x871c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x871c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x871c('0x4'));var util=require('util');var path=require(_0x871c('0x5'));var sox=require(_0x871c('0x6'));var csv=require(_0x871c('0x7'));var ejs=require(_0x871c('0x8'));var fs=require('fs');var fs_extra=require(_0x871c('0x9'));var _=require('lodash');var squel=require(_0x871c('0xa'));var crypto=require('crypto');var jsforce=require(_0x871c('0xb'));var deskjs=require(_0x871c('0xc'));var toCsv=require(_0x871c('0x7'));var querystring=require(_0x871c('0xd'));var Papa=require(_0x871c('0xe'));var Redis=require(_0x871c('0xf'));var authService=require(_0x871c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x871c('0x11'));var hardwareService=require(_0x871c('0x12'));var logger=require(_0x871c('0x13'))(_0x871c('0x14'));var utils=require(_0x871c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x871c('0x16'));var db=require(_0x871c('0x17'))['db'];function respondWithStatusCode(_0x2af14b,_0x469d87){_0x469d87=_0x469d87||0xcc;return function(_0x521db7){if(_0x521db7){return _0x2af14b[_0x871c('0x18')](_0x469d87);}return _0x2af14b['status'](_0x469d87)[_0x871c('0x19')]();};}function respondWithResult(_0x1dd476,_0x42eafc){_0x42eafc=_0x42eafc||0xc8;return function(_0x46a9b0){if(_0x46a9b0){return _0x1dd476[_0x871c('0x1a')](_0x42eafc)['json'](_0x46a9b0);}};}function respondWithFilteredResult(_0x35d49e,_0xa02784){return function(_0x32354a){if(_0x32354a){var _0xacf7c9=typeof _0xa02784[_0x871c('0x1b')]===_0x871c('0x1c')&&typeof _0xa02784[_0x871c('0x1d')]===_0x871c('0x1c');var _0x33b538=_0x32354a[_0x871c('0x1e')];var _0x47c43e=_0xacf7c9?0x0:_0xa02784[_0x871c('0x1b')];var _0xce43e2=_0xacf7c9?_0x32354a[_0x871c('0x1e')]:_0xa02784[_0x871c('0x1b')]+_0xa02784[_0x871c('0x1d')];var _0x268fec;if(_0xce43e2>=_0x33b538){_0xce43e2=_0x33b538;_0x268fec=0xc8;}else{_0x268fec=0xce;}_0x35d49e['status'](_0x268fec);return _0x35d49e[_0x871c('0x1f')](_0x871c('0x20'),_0x47c43e+'-'+_0xce43e2+'/'+_0x33b538)['json'](_0x32354a);}return null;};}function patchUpdates(_0x320f7f){return function(_0x1bb7f0){try{jsonpatch[_0x871c('0x21')](_0x1bb7f0,_0x320f7f,!![]);}catch(_0x520e22){return BPromise['reject'](_0x520e22);}return _0x1bb7f0[_0x871c('0x22')]();};}function saveUpdates(_0x2d8fe0,_0x79d971){return function(_0x58fbde){if(_0x58fbde){return _0x58fbde[_0x871c('0x23')](_0x2d8fe0)['then'](function(_0x55d771){return _0x55d771;});}return null;};}function removeEntity(_0x8de45a,_0x86ffb5){return function(_0x2cc6c0){if(_0x2cc6c0){return _0x2cc6c0[_0x871c('0x24')]()[_0x871c('0x25')](function(){_0x8de45a[_0x871c('0x1a')](0xcc)[_0x871c('0x19')]();});}};}function handleEntityNotFound(_0x572655,_0x5734a4){return function(_0x459e03){if(!_0x459e03){_0x572655[_0x871c('0x18')](0x194);}return _0x459e03;};}function handleError(_0x105e2f,_0x55c132){_0x55c132=_0x55c132||0x1f4;return function(_0x52b636){logger[_0x871c('0x26')](_0x52b636['stack']);if(_0x52b636[_0x871c('0x27')]){delete _0x52b636[_0x871c('0x27')];}_0x105e2f[_0x871c('0x1a')](_0x55c132)[_0x871c('0x28')](_0x52b636);};}exports[_0x871c('0x29')]=function(_0x588126,_0x37b66e){var _0x235563={},_0x22b055={},_0x2bd5fa={'count':0x0,'rows':[]};var _0x472ac2=_[_0x871c('0x2a')](db[_0x871c('0x2b')]['rawAttributes'],function(_0x360897){return{'name':_0x360897[_0x871c('0x2c')],'type':_0x360897['type']['key']};});_0x22b055[_0x871c('0x2d')]=_[_0x871c('0x2a')](_0x472ac2,_0x871c('0x27'));_0x22b055[_0x871c('0x2e')]=_[_0x871c('0x2f')](_0x588126[_0x871c('0x2e')]);_0x22b055[_0x871c('0x30')]=_['intersection'](_0x22b055['model'],_0x22b055['query']);_0x235563[_0x871c('0x31')]=_[_0x871c('0x32')](_0x22b055[_0x871c('0x2d')],qs['fields'](_0x588126[_0x871c('0x2e')][_0x871c('0x33')]));_0x235563['attributes']=_0x235563[_0x871c('0x31')][_0x871c('0x34')]?_0x235563[_0x871c('0x31')]:_0x22b055[_0x871c('0x2d')];if(!_0x588126['query'][_0x871c('0x35')](_0x871c('0x36'))){_0x235563[_0x871c('0x1d')]=qs['limit'](_0x588126[_0x871c('0x2e')][_0x871c('0x1d')]);_0x235563[_0x871c('0x1b')]=qs['offset'](_0x588126['query'][_0x871c('0x1b')]);}_0x235563[_0x871c('0x37')]=qs[_0x871c('0x38')](_0x588126['query'][_0x871c('0x38')]);_0x235563[_0x871c('0x39')]=qs[_0x871c('0x30')](_[_0x871c('0x3a')](_0x588126[_0x871c('0x2e')],_0x22b055[_0x871c('0x30')]),_0x472ac2);if(_0x588126[_0x871c('0x2e')][_0x871c('0x3b')]){_0x235563[_0x871c('0x39')]=_[_0x871c('0x3c')](_0x235563[_0x871c('0x39')],{'$or':_['map'](_0x472ac2,function(_0x41c964){if(_0x41c964[_0x871c('0x3d')]!==_0x871c('0x3e')){var _0x118af2={};_0x118af2[_0x41c964[_0x871c('0x27')]]={'$like':'%'+_0x588126[_0x871c('0x2e')][_0x871c('0x3b')]+'%'};return _0x118af2;}})});}_0x235563=_['merge']({},_0x235563,_0x588126[_0x871c('0x3f')]);var _0x1fd3c5={'where':_0x235563[_0x871c('0x39')]};return db[_0x871c('0x2b')][_0x871c('0x1e')](_0x1fd3c5)['then'](function(_0xfdfffd){_0x2bd5fa[_0x871c('0x1e')]=_0xfdfffd;if(_0x588126[_0x871c('0x2e')][_0x871c('0x40')]){_0x235563[_0x871c('0x41')]=[{'all':!![]}];}return db[_0x871c('0x2b')][_0x871c('0x42')](_0x235563);})[_0x871c('0x25')](function(_0x13a9fe){_0x2bd5fa[_0x871c('0x43')]=_0x13a9fe;return _0x2bd5fa;})[_0x871c('0x25')](respondWithFilteredResult(_0x37b66e,_0x235563))[_0x871c('0x44')](handleError(_0x37b66e,null));};exports[_0x871c('0x45')]=function(_0x229ad9,_0x5ab6e1){var _0x2c490c={'raw':!![],'where':{'id':_0x229ad9[_0x871c('0x46')]['id']}},_0x2d7454={};_0x2d7454[_0x871c('0x2d')]=_[_0x871c('0x2f')](db[_0x871c('0x2b')][_0x871c('0x47')]);_0x2d7454[_0x871c('0x2e')]=_[_0x871c('0x2f')](_0x229ad9[_0x871c('0x2e')]);_0x2d7454[_0x871c('0x30')]=_[_0x871c('0x32')](_0x2d7454['model'],_0x2d7454['query']);_0x2c490c[_0x871c('0x31')]=_[_0x871c('0x32')](_0x2d7454[_0x871c('0x2d')],qs['fields'](_0x229ad9[_0x871c('0x2e')][_0x871c('0x33')]));_0x2c490c[_0x871c('0x31')]=_0x2c490c[_0x871c('0x31')]['length']?_0x2c490c['attributes']:_0x2d7454[_0x871c('0x2d')];if(_0x229ad9[_0x871c('0x2e')][_0x871c('0x40')]){_0x2c490c[_0x871c('0x41')]=[{'all':!![]}];}_0x2c490c=_['merge']({},_0x2c490c,_0x229ad9[_0x871c('0x3f')]);return db[_0x871c('0x2b')][_0x871c('0x48')](_0x2c490c)[_0x871c('0x25')](handleEntityNotFound(_0x5ab6e1,null))[_0x871c('0x25')](respondWithResult(_0x5ab6e1,null))['catch'](handleError(_0x5ab6e1,null));};exports['create']=function(_0x195f11,_0x37d0f1){return db[_0x871c('0x2b')][_0x871c('0x49')](_0x195f11[_0x871c('0x4a')],{})['then'](respondWithResult(_0x37d0f1,0xc9))[_0x871c('0x44')](handleError(_0x37d0f1,null));};exports[_0x871c('0x23')]=function(_0x3c951c,_0x2ba734){if(_0x3c951c[_0x871c('0x4a')]['id']){delete _0x3c951c[_0x871c('0x4a')]['id'];}return db[_0x871c('0x2b')][_0x871c('0x48')]({'where':{'id':_0x3c951c['params']['id']}})[_0x871c('0x25')](handleEntityNotFound(_0x2ba734,null))[_0x871c('0x25')](saveUpdates(_0x3c951c['body'],null))['then'](respondWithResult(_0x2ba734,null))[_0x871c('0x44')](handleError(_0x2ba734,null));};exports[_0x871c('0x24')]=function(_0x4bf515,_0x5ada2e){return db[_0x871c('0x2b')]['find']({'where':{'id':_0x4bf515[_0x871c('0x46')]['id']}})['then'](handleEntityNotFound(_0x5ada2e,null))['then'](removeEntity(_0x5ada2e,null))[_0x871c('0x44')](handleError(_0x5ada2e,null));}; \ No newline at end of file +var _0x2504=['attributes','fields','length','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','ZendeskField','includeAll','findAll','rows','include','find','catch','create','body','params','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','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','type','key','keys','query','intersection','model'];(function(_0x309ffc,_0x276601){var _0x189b16=function(_0x237722){while(--_0x237722){_0x309ffc['push'](_0x309ffc['shift']());}};_0x189b16(++_0x276601);}(_0x2504,0xee));var _0x4250=function(_0x27f780,_0x3fffb3){_0x27f780=_0x27f780-0x0;var _0x110b67=_0x2504[_0x27f780];return _0x110b67;};'use strict';var emlformat=require(_0x4250('0x0'));var rimraf=require(_0x4250('0x1'));var zipdir=require(_0x4250('0x2'));var jsonpatch=require(_0x4250('0x3'));var rp=require(_0x4250('0x4'));var moment=require(_0x4250('0x5'));var BPromise=require(_0x4250('0x6'));var Mustache=require(_0x4250('0x7'));var util=require(_0x4250('0x8'));var path=require(_0x4250('0x9'));var sox=require(_0x4250('0xa'));var csv=require(_0x4250('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4250('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4250('0xd'));var jsforce=require(_0x4250('0xe'));var deskjs=require(_0x4250('0xf'));var toCsv=require(_0x4250('0xb'));var querystring=require(_0x4250('0x10'));var Papa=require('papaparse');var Redis=require(_0x4250('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4250('0x12'));var as=require(_0x4250('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4250('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x4250('0x15'));var licenseUtil=require(_0x4250('0x16'));var db=require(_0x4250('0x17'))['db'];function respondWithStatusCode(_0x3c1e7e,_0x2a496b){_0x2a496b=_0x2a496b||0xcc;return function(_0x5d62a0){if(_0x5d62a0){return _0x3c1e7e[_0x4250('0x18')](_0x2a496b);}return _0x3c1e7e[_0x4250('0x19')](_0x2a496b)[_0x4250('0x1a')]();};}function respondWithResult(_0x2c8a75,_0xfa4d8a){_0xfa4d8a=_0xfa4d8a||0xc8;return function(_0x33f317){if(_0x33f317){return _0x2c8a75['status'](_0xfa4d8a)[_0x4250('0x1b')](_0x33f317);}};}function respondWithFilteredResult(_0x46ba15,_0x1b0c66){return function(_0x3cff02){if(_0x3cff02){var _0x2979cd=typeof _0x1b0c66[_0x4250('0x1c')]===_0x4250('0x1d')&&typeof _0x1b0c66['limit']===_0x4250('0x1d');var _0x35d232=_0x3cff02[_0x4250('0x1e')];var _0x17a8a9=_0x2979cd?0x0:_0x1b0c66[_0x4250('0x1c')];var _0x30e48c=_0x2979cd?_0x3cff02[_0x4250('0x1e')]:_0x1b0c66['offset']+_0x1b0c66[_0x4250('0x1f')];var _0x4f0154;if(_0x30e48c>=_0x35d232){_0x30e48c=_0x35d232;_0x4f0154=0xc8;}else{_0x4f0154=0xce;}_0x46ba15['status'](_0x4f0154);return _0x46ba15[_0x4250('0x20')](_0x4250('0x21'),_0x17a8a9+'-'+_0x30e48c+'/'+_0x35d232)[_0x4250('0x1b')](_0x3cff02);}return null;};}function patchUpdates(_0x42c331){return function(_0x242cf1){try{jsonpatch[_0x4250('0x22')](_0x242cf1,_0x42c331,!![]);}catch(_0x1ba772){return BPromise[_0x4250('0x23')](_0x1ba772);}return _0x242cf1[_0x4250('0x24')]();};}function saveUpdates(_0x3818c0,_0x728862){return function(_0x30e2ae){if(_0x30e2ae){return _0x30e2ae['update'](_0x3818c0)[_0x4250('0x25')](function(_0x171df4){return _0x171df4;});}return null;};}function removeEntity(_0x1feb98,_0x523053){return function(_0x5d1a74){if(_0x5d1a74){return _0x5d1a74[_0x4250('0x26')]()[_0x4250('0x25')](function(){_0x1feb98[_0x4250('0x19')](0xcc)[_0x4250('0x1a')]();});}};}function handleEntityNotFound(_0x328ffb,_0x5cb4fe){return function(_0x431d01){if(!_0x431d01){_0x328ffb[_0x4250('0x18')](0x194);}return _0x431d01;};}function handleError(_0x3f40dd,_0x559d06){_0x559d06=_0x559d06||0x1f4;return function(_0x5b155e){logger[_0x4250('0x27')](_0x5b155e['stack']);if(_0x5b155e[_0x4250('0x28')]){delete _0x5b155e[_0x4250('0x28')];}_0x3f40dd[_0x4250('0x19')](_0x559d06)[_0x4250('0x29')](_0x5b155e);};}exports[_0x4250('0x2a')]=function(_0x501c5f,_0x395926){var _0x11ca22={},_0x48252b={},_0x2e1c91={'count':0x0,'rows':[]};var _0x5654f5=_[_0x4250('0x2b')](db['ZendeskField']['rawAttributes'],function(_0xea7ccc){return{'name':_0xea7ccc['fieldName'],'type':_0xea7ccc[_0x4250('0x2c')][_0x4250('0x2d')]};});_0x48252b['model']=_[_0x4250('0x2b')](_0x5654f5,_0x4250('0x28'));_0x48252b['query']=_[_0x4250('0x2e')](_0x501c5f[_0x4250('0x2f')]);_0x48252b['filters']=_[_0x4250('0x30')](_0x48252b[_0x4250('0x31')],_0x48252b[_0x4250('0x2f')]);_0x11ca22[_0x4250('0x32')]=_[_0x4250('0x30')](_0x48252b[_0x4250('0x31')],qs[_0x4250('0x33')](_0x501c5f[_0x4250('0x2f')][_0x4250('0x33')]));_0x11ca22[_0x4250('0x32')]=_0x11ca22[_0x4250('0x32')][_0x4250('0x34')]?_0x11ca22[_0x4250('0x32')]:_0x48252b['model'];if(!_0x501c5f[_0x4250('0x2f')]['hasOwnProperty'](_0x4250('0x35'))){_0x11ca22[_0x4250('0x1f')]=qs['limit'](_0x501c5f[_0x4250('0x2f')][_0x4250('0x1f')]);_0x11ca22[_0x4250('0x1c')]=qs[_0x4250('0x1c')](_0x501c5f['query']['offset']);}_0x11ca22['order']=qs[_0x4250('0x36')](_0x501c5f[_0x4250('0x2f')]['sort']);_0x11ca22[_0x4250('0x37')]=qs[_0x4250('0x38')](_[_0x4250('0x39')](_0x501c5f[_0x4250('0x2f')],_0x48252b[_0x4250('0x38')]),_0x5654f5);if(_0x501c5f['query'][_0x4250('0x3a')]){_0x11ca22['where']=_['merge'](_0x11ca22[_0x4250('0x37')],{'$or':_['map'](_0x5654f5,function(_0xfddc4c){if(_0xfddc4c[_0x4250('0x2c')]!==_0x4250('0x3b')){var _0x571ca7={};_0x571ca7[_0xfddc4c[_0x4250('0x28')]]={'$like':'%'+_0x501c5f[_0x4250('0x2f')][_0x4250('0x3a')]+'%'};return _0x571ca7;}})});}_0x11ca22=_[_0x4250('0x3c')]({},_0x11ca22,_0x501c5f[_0x4250('0x3d')]);var _0x4c98f0={'where':_0x11ca22[_0x4250('0x37')]};return db[_0x4250('0x3e')][_0x4250('0x1e')](_0x4c98f0)[_0x4250('0x25')](function(_0x37df2a){_0x2e1c91[_0x4250('0x1e')]=_0x37df2a;if(_0x501c5f['query'][_0x4250('0x3f')]){_0x11ca22['include']=[{'all':!![]}];}return db[_0x4250('0x3e')][_0x4250('0x40')](_0x11ca22);})[_0x4250('0x25')](function(_0x2a10b9){_0x2e1c91[_0x4250('0x41')]=_0x2a10b9;return _0x2e1c91;})[_0x4250('0x25')](respondWithFilteredResult(_0x395926,_0x11ca22))['catch'](handleError(_0x395926,null));};exports['show']=function(_0x491849,_0x440f8c){var _0x2549c1={'raw':!![],'where':{'id':_0x491849['params']['id']}},_0x2e4a22={};_0x2e4a22[_0x4250('0x31')]=_[_0x4250('0x2e')](db[_0x4250('0x3e')]['rawAttributes']);_0x2e4a22[_0x4250('0x2f')]=_[_0x4250('0x2e')](_0x491849[_0x4250('0x2f')]);_0x2e4a22[_0x4250('0x38')]=_['intersection'](_0x2e4a22['model'],_0x2e4a22[_0x4250('0x2f')]);_0x2549c1[_0x4250('0x32')]=_[_0x4250('0x30')](_0x2e4a22[_0x4250('0x31')],qs[_0x4250('0x33')](_0x491849['query'][_0x4250('0x33')]));_0x2549c1['attributes']=_0x2549c1[_0x4250('0x32')][_0x4250('0x34')]?_0x2549c1[_0x4250('0x32')]:_0x2e4a22['model'];if(_0x491849[_0x4250('0x2f')][_0x4250('0x3f')]){_0x2549c1[_0x4250('0x42')]=[{'all':!![]}];}_0x2549c1=_['merge']({},_0x2549c1,_0x491849['options']);return db['ZendeskField'][_0x4250('0x43')](_0x2549c1)[_0x4250('0x25')](handleEntityNotFound(_0x440f8c,null))[_0x4250('0x25')](respondWithResult(_0x440f8c,null))[_0x4250('0x44')](handleError(_0x440f8c,null));};exports[_0x4250('0x45')]=function(_0x20e45c,_0x47b5aa){return db[_0x4250('0x3e')][_0x4250('0x45')](_0x20e45c[_0x4250('0x46')],{})['then'](respondWithResult(_0x47b5aa,0xc9))[_0x4250('0x44')](handleError(_0x47b5aa,null));};exports['update']=function(_0x5895ea,_0x2e0d9d){if(_0x5895ea[_0x4250('0x46')]['id']){delete _0x5895ea[_0x4250('0x46')]['id'];}return db[_0x4250('0x3e')][_0x4250('0x43')]({'where':{'id':_0x5895ea[_0x4250('0x47')]['id']}})['then'](handleEntityNotFound(_0x2e0d9d,null))[_0x4250('0x25')](saveUpdates(_0x5895ea['body'],null))[_0x4250('0x25')](respondWithResult(_0x2e0d9d,null))[_0x4250('0x44')](handleError(_0x2e0d9d,null));};exports[_0x4250('0x26')]=function(_0x544048,_0x3bc2b0){return db[_0x4250('0x3e')]['find']({'where':{'id':_0x544048['params']['id']}})['then'](handleEntityNotFound(_0x3bc2b0,null))[_0x4250('0x25')](removeEntity(_0x3bc2b0,null))['catch'](handleError(_0x3bc2b0,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index f4440b3..86ef183 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 _0x5e0c=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','ZendeskField','idField','util'];(function(_0x4f6e29,_0x54104f){var _0x4efbee=function(_0x32c2a5){while(--_0x32c2a5){_0x4f6e29['push'](_0x4f6e29['shift']());}};_0x4efbee(++_0x54104f);}(_0x5e0c,0xb3));var _0xc5e0=function(_0x3e54d5,_0x179556){_0x3e54d5=_0x3e54d5-0x0;var _0x35ad39=_0x5e0c[_0x3e54d5];return _0x35ad39;};'use strict';var _=require('lodash');var util=require(_0xc5e0('0x0'));var logger=require(_0xc5e0('0x1'))(_0xc5e0('0x2'));var moment=require(_0xc5e0('0x3'));var BPromise=require(_0xc5e0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc5e0('0x5'));var rimraf=require(_0xc5e0('0x6'));var config=require(_0xc5e0('0x7'));var attributes=require('./intZendeskField.attributes');module[_0xc5e0('0x8')]=function(_0xb941ff,_0x50100f){return _0xb941ff[_0xc5e0('0x9')](_0xc5e0('0xa'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xc5e0('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5152=['api','bluebird','request-promise','path','rimraf','./intZendeskField.attributes','define','ZendeskField','zendesk_unique_index','FieldId','lodash','util','../../config/logger'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x5152,0x19d));var _0x2515=function(_0xb24fad,_0xd58756){_0xb24fad=_0xb24fad-0x0;var _0x173226=_0x5152[_0xb24fad];return _0x173226;};'use strict';var _=require(_0x2515('0x0'));var util=require(_0x2515('0x1'));var logger=require(_0x2515('0x2'))(_0x2515('0x3'));var moment=require('moment');var BPromise=require(_0x2515('0x4'));var rp=require(_0x2515('0x5'));var fs=require('fs');var path=require(_0x2515('0x6'));var rimraf=require(_0x2515('0x7'));var config=require('../../config/environment');var attributes=require(_0x2515('0x8'));module['exports']=function(_0xfe8df3,_0x171467){return _0xfe8df3[_0x2515('0x9')](_0x2515('0xa'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x2515('0xb'),'fields':['idField',_0x2515('0xc')],'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 372b747..e071ed2 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 _0x283f=['rpc','../../config/environment','jayson/promise','client','http','request','info','debug','request\x20sent','error','code','message','ZendeskField,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1c6ef2,_0x8d926a){var _0x404b8c=function(_0x4fdf1e){while(--_0x4fdf1e){_0x1c6ef2['push'](_0x1c6ef2['shift']());}};_0x404b8c(++_0x8d926a);}(_0x283f,0x116));var _0xf283=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x283f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf283('0x0'));var util=require(_0xf283('0x1'));var moment=require(_0xf283('0x2'));var BPromise=require(_0xf283('0x3'));var rs=require(_0xf283('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf283('0x5'))['db'];var utils=require(_0xf283('0x6'));var logger=require(_0xf283('0x7'))(_0xf283('0x8'));var config=require(_0xf283('0x9'));var jayson=require(_0xf283('0xa'));var client=jayson[_0xf283('0xb')][_0xf283('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x340b35,_0xdd3679,_0x326c40){return new BPromise(function(_0x38faee,_0x9c5bd9){return client[_0xf283('0xd')](_0x340b35,_0x326c40)['then'](function(_0x5789b7){logger[_0xf283('0xe')]('ZendeskField,\x20%s,\x20%s',_0xdd3679,'request\x20sent');logger[_0xf283('0xf')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0xdd3679,_0xf283('0x10'),JSON['stringify'](_0x5789b7));if(_0x5789b7[_0xf283('0x11')]){if(_0x5789b7[_0xf283('0x11')][_0xf283('0x12')]===0x1f4){logger[_0xf283('0x11')]('ZendeskField,\x20%s,\x20%s',_0xdd3679,_0x5789b7['error'][_0xf283('0x13')]);return _0x9c5bd9(_0x5789b7[_0xf283('0x11')][_0xf283('0x13')]);}logger['error'](_0xf283('0x14'),_0xdd3679,_0x5789b7[_0xf283('0x11')][_0xf283('0x13')]);return _0x38faee(_0x5789b7[_0xf283('0x11')]['message']);}else{logger[_0xf283('0xe')](_0xf283('0x14'),_0xdd3679,_0xf283('0x10'));_0x38faee(_0x5789b7['result'][_0xf283('0x13')]);}})[_0xf283('0x15')](function(_0x38d40b){logger[_0xf283('0x11')](_0xf283('0x14'),_0xdd3679,_0x38d40b);_0x9c5bd9(_0x38d40b);});});} \ No newline at end of file +var _0x47f9=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','ZendeskField,\x20%s,\x20%s','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','moment','bluebird','randomstring'];(function(_0x169996,_0x4b59b5){var _0x28d7e6=function(_0x5e3acd){while(--_0x5e3acd){_0x169996['push'](_0x169996['shift']());}};_0x28d7e6(++_0x4b59b5);}(_0x47f9,0xa4));var _0x947f=function(_0x3aac12,_0x5ce4a3){_0x3aac12=_0x3aac12-0x0;var _0x283857=_0x47f9[_0x3aac12];return _0x283857;};'use strict';var _=require(_0x947f('0x0'));var util=require('util');var moment=require(_0x947f('0x1'));var BPromise=require(_0x947f('0x2'));var rs=require(_0x947f('0x3'));var fs=require('fs');var Redis=require(_0x947f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x947f('0x5'));var logger=require(_0x947f('0x6'))(_0x947f('0x7'));var config=require(_0x947f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x947f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34065b,_0x4db3b3,_0x4499ff){return new BPromise(function(_0x26d708,_0x5566b8){return client[_0x947f('0xa')](_0x34065b,_0x4499ff)[_0x947f('0xb')](function(_0x5ac6a7){logger[_0x947f('0xc')](_0x947f('0xd'),_0x4db3b3,'request\x20sent');logger['debug'](_0x947f('0xe'),_0x4db3b3,'request\x20sent',JSON[_0x947f('0xf')](_0x5ac6a7));if(_0x5ac6a7['error']){if(_0x5ac6a7[_0x947f('0x10')][_0x947f('0x11')]===0x1f4){logger['error'](_0x947f('0xd'),_0x4db3b3,_0x5ac6a7[_0x947f('0x10')][_0x947f('0x12')]);return _0x5566b8(_0x5ac6a7[_0x947f('0x10')]['message']);}logger[_0x947f('0x10')](_0x947f('0xd'),_0x4db3b3,_0x5ac6a7[_0x947f('0x10')]['message']);return _0x26d708(_0x5ac6a7['error'][_0x947f('0x12')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x4db3b3,_0x947f('0x13'));_0x26d708(_0x5ac6a7['result'][_0x947f('0x12')]);}})[_0x947f('0x14')](function(_0x5330d1){logger[_0x947f('0x10')](_0x947f('0xd'),_0x4db3b3,_0x5330d1);_0x5566b8(_0x5330d1);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index a2a540e..af398ca 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 _0x83cc=['../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','update','delete','exports','multer','util','express','Router','fs-extra'];(function(_0x7ad8b0,_0x1ae2a5){var _0x3311d8=function(_0x172b12){while(--_0x172b12){_0x7ad8b0['push'](_0x7ad8b0['shift']());}};_0x3311d8(++_0x1ae2a5);}(_0x83cc,0x14b));var _0xc83c=function(_0x1e6e99,_0xd3bb5f){_0x1e6e99=_0x1e6e99-0x0;var _0x6b6ca8=_0x83cc[_0x1e6e99];return _0x6b6ca8;};'use strict';var multer=require(_0xc83c('0x0'));var util=require(_0xc83c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc83c('0x2'));var router=express[_0xc83c('0x3')]();var fs_extra=require(_0xc83c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc83c('0x5'));var config=require('../../config/environment');var controller=require(_0xc83c('0x6'));router[_0xc83c('0x7')]('/',auth[_0xc83c('0x8')](),controller['index']);router['get'](_0xc83c('0x9'),auth['isAuthenticated'](),controller[_0xc83c('0xa')]);router[_0xc83c('0x7')]('/:id/configurations',auth[_0xc83c('0x8')](),controller[_0xc83c('0xb')]);router['get'](_0xc83c('0xc'),auth['isAuthenticated'](),controller[_0xc83c('0xd')]);router[_0xc83c('0xe')]('/',auth['isAuthenticated'](),controller[_0xc83c('0xf')]);router[_0xc83c('0xe')](_0xc83c('0x10'),auth[_0xc83c('0x8')](),controller[_0xc83c('0x11')]);router['put'](_0xc83c('0x9'),auth[_0xc83c('0x8')](),controller[_0xc83c('0x12')]);router[_0xc83c('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc83c('0x14')]=router; \ No newline at end of file +var _0xcfbf=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','index','get','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','util','path','connect-timeout'];(function(_0x557453,_0x5d573a){var _0x2036dd=function(_0x3e28a0){while(--_0x3e28a0){_0x557453['push'](_0x557453['shift']());}};_0x2036dd(++_0x5d573a);}(_0xcfbf,0x1f1));var _0xfcfb=function(_0x4525e2,_0x474884){_0x4525e2=_0x4525e2-0x0;var _0x566cbb=_0xcfbf[_0x4525e2];return _0x566cbb;};'use strict';var multer=require('multer');var util=require(_0xfcfb('0x0'));var path=require(_0xfcfb('0x1'));var timeout=require(_0xfcfb('0x2'));var express=require(_0xfcfb('0x3'));var router=express[_0xfcfb('0x4')]();var fs_extra=require(_0xfcfb('0x5'));var auth=require(_0xfcfb('0x6'));var interaction=require(_0xfcfb('0x7'));var config=require('../../config/environment');var controller=require(_0xfcfb('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xfcfb('0x9')]);router[_0xfcfb('0xa')](_0xfcfb('0xb'),auth['isAuthenticated'](),controller[_0xfcfb('0xc')]);router[_0xfcfb('0xa')](_0xfcfb('0xd'),auth[_0xfcfb('0xe')](),controller[_0xfcfb('0xf')]);router[_0xfcfb('0xa')](_0xfcfb('0x10'),auth[_0xfcfb('0xe')](),controller[_0xfcfb('0x11')]);router[_0xfcfb('0x12')]('/',auth[_0xfcfb('0xe')](),controller[_0xfcfb('0x13')]);router[_0xfcfb('0x12')](_0xfcfb('0xd'),auth[_0xfcfb('0xe')](),controller[_0xfcfb('0x14')]);router[_0xfcfb('0x15')](_0xfcfb('0xb'),auth['isAuthenticated'](),controller[_0xfcfb('0x16')]);router['delete'](_0xfcfb('0xb'),auth[_0xfcfb('0xe')](),controller[_0xfcfb('0x17')]);module[_0xfcfb('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index e81a69a..4e730e0 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 _0xe5b3=['STRING','exports'];(function(_0x3fbedf,_0x131ae0){var _0x4c914c=function(_0x1a6c25){while(--_0x1a6c25){_0x3fbedf['push'](_0x3fbedf['shift']());}};_0x4c914c(++_0x131ae0);}(_0xe5b3,0x133));var _0x3e5b=function(_0x5d3394,_0x5e5dce){_0x5d3394=_0x5d3394-0x0;var _0x102ca5=_0xe5b3[_0x5d3394];return _0x102ca5;};'use strict';var Sequelize=require('sequelize');module[_0x3e5b('0x0')]={'name':{'type':Sequelize[_0x3e5b('0x1')]},'description':{'type':Sequelize[_0x3e5b('0x1')]},'host':{'type':Sequelize[_0x3e5b('0x1')]},'zone':{'type':Sequelize[_0x3e5b('0x1')]},'clientId':{'type':Sequelize[_0x3e5b('0x1')]},'clientSecret':{'type':Sequelize[_0x3e5b('0x1')]},'serverUrl':{'type':Sequelize[_0x3e5b('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x3e5b('0x1')]},'refreshToken':{'type':Sequelize[_0x3e5b('0x1')]}}; \ No newline at end of file +var _0x6f0d=['exports','STRING'];(function(_0xf97093,_0x29d347){var _0xa300d2=function(_0x320509){while(--_0x320509){_0xf97093['push'](_0xf97093['shift']());}};_0xa300d2(++_0x29d347);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x2b63dd,_0x516e33){_0x2b63dd=_0x2b63dd-0x0;var _0x3c2f97=_0x6f0d[_0x2b63dd];return _0x3c2f97;};'use strict';var Sequelize=require('sequelize');module[_0xd6f0('0x0')]={'name':{'type':Sequelize[_0xd6f0('0x1')]},'description':{'type':Sequelize[_0xd6f0('0x1')]},'host':{'type':Sequelize[_0xd6f0('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xd6f0('0x1')]},'clientSecret':{'type':Sequelize[_0xd6f0('0x1')]},'serverUrl':{'type':Sequelize[_0xd6f0('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xd6f0('0x1')]},'refreshToken':{'type':Sequelize[_0xd6f0('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index c0f22b6..edd7f8e 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 _0xaa0d=['name','send','index','ZohoAccount','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','show','params','length','catch','create','body','find','destroy','getConfigurations','ZohoConfiguration','addConfiguration','AccountId','Subjects','channel','getDescriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zone','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','message','Subject','Description','WhoId','Call_Duration','Call_Type','remove','includes','api_name','push','display_label','custom_field','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','zip-dir','fast-json-patch','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','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','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','end','error','stack'];(function(_0x5af17c,_0x6e2f5f){var _0x326a72=function(_0x5377b5){while(--_0x5377b5){_0x5af17c['push'](_0x5af17c['shift']());}};_0x326a72(++_0x6e2f5f);}(_0xaa0d,0xdd));var _0xdaa0=function(_0x19bf0e,_0x39db02){_0x19bf0e=_0x19bf0e-0x0;var _0x19225c=_0xaa0d[_0x19bf0e];return _0x19225c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdaa0('0x0'));var jsonpatch=require(_0xdaa0('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdaa0('0x2'));var Mustache=require('mustache');var util=require(_0xdaa0('0x3'));var path=require(_0xdaa0('0x4'));var sox=require(_0xdaa0('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdaa0('0x6'));var _=require(_0xdaa0('0x7'));var squel=require(_0xdaa0('0x8'));var crypto=require(_0xdaa0('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xdaa0('0xa'));var toCsv=require(_0xdaa0('0xb'));var querystring=require(_0xdaa0('0xc'));var Papa=require(_0xdaa0('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdaa0('0xe'));var as=require(_0xdaa0('0xf'));var hardwareService=require(_0xdaa0('0x10'));var logger=require(_0xdaa0('0x11'))('api');var utils=require(_0xdaa0('0x12'));var config=require(_0xdaa0('0x13'));var licenseUtil=require(_0xdaa0('0x14'));var db=require(_0xdaa0('0x15'))['db'];var integrations=require(_0xdaa0('0x16'));function respondWithStatusCode(_0x46e1aa,_0x3d5424){_0x3d5424=_0x3d5424||0xcc;return function(_0x563096){if(_0x563096){return _0x46e1aa[_0xdaa0('0x17')](_0x3d5424);}return _0x46e1aa[_0xdaa0('0x18')](_0x3d5424)['end']();};}function respondWithResult(_0x1931de,_0x346859){_0x346859=_0x346859||0xc8;return function(_0x361300){if(_0x361300){return _0x1931de[_0xdaa0('0x18')](_0x346859)[_0xdaa0('0x19')](_0x361300);}};}function respondWithFilteredResult(_0x201418,_0x1af7ed){return function(_0x3ac5d3){if(_0x3ac5d3){var _0x1a9414=typeof _0x1af7ed[_0xdaa0('0x1a')]===_0xdaa0('0x1b')&&typeof _0x1af7ed[_0xdaa0('0x1c')]==='undefined';var _0x32541a=_0x3ac5d3[_0xdaa0('0x1d')];var _0x1860db=_0x1a9414?0x0:_0x1af7ed['offset'];var _0x178286=_0x1a9414?_0x3ac5d3['count']:_0x1af7ed[_0xdaa0('0x1a')]+_0x1af7ed['limit'];var _0x248649;if(_0x178286>=_0x32541a){_0x178286=_0x32541a;_0x248649=0xc8;}else{_0x248649=0xce;}_0x201418['status'](_0x248649);return _0x201418[_0xdaa0('0x1e')]('Content-Range',_0x1860db+'-'+_0x178286+'/'+_0x32541a)['json'](_0x3ac5d3);}return null;};}function patchUpdates(_0x5de0be){return function(_0x3a848b){try{jsonpatch[_0xdaa0('0x1f')](_0x3a848b,_0x5de0be,!![]);}catch(_0x478d16){return BPromise[_0xdaa0('0x20')](_0x478d16);}return _0x3a848b[_0xdaa0('0x21')]();};}function saveUpdates(_0x288307,_0x5753f9){return function(_0x4d5ccc){if(_0x4d5ccc){return _0x4d5ccc[_0xdaa0('0x22')](_0x288307)[_0xdaa0('0x23')](function(_0x2eef98){return _0x2eef98;});}return null;};}function removeEntity(_0x218c36,_0x31141b){return function(_0x2b4680){if(_0x2b4680){return _0x2b4680['destroy']()['then'](function(){_0x218c36['status'](0xcc)[_0xdaa0('0x24')]();});}};}function handleEntityNotFound(_0x73eacd,_0x155c0e){return function(_0x45adc9){if(!_0x45adc9){_0x73eacd[_0xdaa0('0x17')](0x194);}return _0x45adc9;};}function handleError(_0x272416,_0xcdcfb){_0xcdcfb=_0xcdcfb||0x1f4;return function(_0x19c550){logger[_0xdaa0('0x25')](_0x19c550[_0xdaa0('0x26')]);if(_0x19c550[_0xdaa0('0x27')]){delete _0x19c550[_0xdaa0('0x27')];}_0x272416[_0xdaa0('0x18')](_0xcdcfb)[_0xdaa0('0x28')](_0x19c550);};}exports[_0xdaa0('0x29')]=function(_0x4647b4,_0x217299){var _0x5e5846={},_0x426b40={},_0xb65e68={'count':0x0,'rows':[]};var _0x133adc=_['map'](db[_0xdaa0('0x2a')][_0xdaa0('0x2b')],function(_0x16e679){return{'name':_0x16e679[_0xdaa0('0x2c')],'type':_0x16e679[_0xdaa0('0x2d')][_0xdaa0('0x2e')]};});_0x426b40[_0xdaa0('0x2f')]=_[_0xdaa0('0x30')](_0x133adc,_0xdaa0('0x27'));_0x426b40[_0xdaa0('0x31')]=_[_0xdaa0('0x32')](_0x4647b4[_0xdaa0('0x31')]);_0x426b40['filters']=_[_0xdaa0('0x33')](_0x426b40[_0xdaa0('0x2f')],_0x426b40[_0xdaa0('0x31')]);_0x5e5846['attributes']=_[_0xdaa0('0x33')](_0x426b40[_0xdaa0('0x2f')],qs[_0xdaa0('0x34')](_0x4647b4[_0xdaa0('0x31')][_0xdaa0('0x34')]));_0x5e5846['attributes']=_0x5e5846['attributes']['length']?_0x5e5846[_0xdaa0('0x35')]:_0x426b40[_0xdaa0('0x2f')];if(!_0x4647b4[_0xdaa0('0x31')][_0xdaa0('0x36')](_0xdaa0('0x37'))){_0x5e5846['limit']=qs[_0xdaa0('0x1c')](_0x4647b4[_0xdaa0('0x31')][_0xdaa0('0x1c')]);_0x5e5846['offset']=qs[_0xdaa0('0x1a')](_0x4647b4[_0xdaa0('0x31')]['offset']);}_0x5e5846[_0xdaa0('0x38')]=qs[_0xdaa0('0x39')](_0x4647b4['query'][_0xdaa0('0x39')]);_0x5e5846['where']=qs[_0xdaa0('0x3a')](_[_0xdaa0('0x3b')](_0x4647b4['query'],_0x426b40[_0xdaa0('0x3a')]),_0x133adc);if(_0x4647b4[_0xdaa0('0x31')][_0xdaa0('0x3c')]){_0x5e5846['where']=_['merge'](_0x5e5846[_0xdaa0('0x3d')],{'$or':_['map'](_0x133adc,function(_0x204b64){if(_0x204b64[_0xdaa0('0x2d')]!==_0xdaa0('0x3e')){var _0x573935={};_0x573935[_0x204b64['name']]={'$like':'%'+_0x4647b4[_0xdaa0('0x31')]['filter']+'%'};return _0x573935;}})});}_0x5e5846=_[_0xdaa0('0x3f')]({},_0x5e5846,_0x4647b4[_0xdaa0('0x40')]);var _0x40c9dd={'where':_0x5e5846[_0xdaa0('0x3d')]};return db['ZohoAccount'][_0xdaa0('0x1d')](_0x40c9dd)['then'](function(_0x8aebab){_0xb65e68['count']=_0x8aebab;if(_0x4647b4['query'][_0xdaa0('0x41')]){_0x5e5846['include']=[{'all':!![]}];}return db[_0xdaa0('0x2a')][_0xdaa0('0x42')](_0x5e5846);})[_0xdaa0('0x23')](function(_0x136c7f){_0xb65e68['rows']=_0x136c7f;return _0xb65e68;})[_0xdaa0('0x23')](respondWithFilteredResult(_0x217299,_0x5e5846))['catch'](handleError(_0x217299,null));};exports[_0xdaa0('0x43')]=function(_0x2b35a3,_0x32a44d){var _0x55a462={'raw':![],'where':{'id':_0x2b35a3[_0xdaa0('0x44')]['id']}},_0x2c3b21={};_0x2c3b21[_0xdaa0('0x2f')]=_[_0xdaa0('0x32')](db[_0xdaa0('0x2a')][_0xdaa0('0x2b')]);_0x2c3b21[_0xdaa0('0x31')]=_[_0xdaa0('0x32')](_0x2b35a3[_0xdaa0('0x31')]);_0x2c3b21[_0xdaa0('0x3a')]=_['intersection'](_0x2c3b21[_0xdaa0('0x2f')],_0x2c3b21[_0xdaa0('0x31')]);_0x55a462[_0xdaa0('0x35')]=_[_0xdaa0('0x33')](_0x2c3b21[_0xdaa0('0x2f')],qs[_0xdaa0('0x34')](_0x2b35a3[_0xdaa0('0x31')][_0xdaa0('0x34')]));_0x55a462[_0xdaa0('0x35')]=_0x55a462[_0xdaa0('0x35')][_0xdaa0('0x45')]?_0x55a462[_0xdaa0('0x35')]:_0x2c3b21[_0xdaa0('0x2f')];if(_0x2b35a3[_0xdaa0('0x31')]['includeAll']){_0x55a462['include']=[{'all':!![]}];}_0x55a462=_[_0xdaa0('0x3f')]({},_0x55a462,_0x2b35a3['options']);return db[_0xdaa0('0x2a')]['find'](_0x55a462)[_0xdaa0('0x23')](handleEntityNotFound(_0x32a44d,null))[_0xdaa0('0x23')](respondWithResult(_0x32a44d,null))[_0xdaa0('0x46')](handleError(_0x32a44d,null));};exports[_0xdaa0('0x47')]=function(_0x3c4286,_0xdb931){return db[_0xdaa0('0x2a')]['create'](_0x3c4286[_0xdaa0('0x48')],{})[_0xdaa0('0x23')](respondWithResult(_0xdb931,0xc9))[_0xdaa0('0x46')](handleError(_0xdb931,null));};exports['update']=function(_0x4f31e8,_0x49cd58){if(_0x4f31e8[_0xdaa0('0x48')]['id']){delete _0x4f31e8[_0xdaa0('0x48')]['id'];}return db[_0xdaa0('0x2a')][_0xdaa0('0x49')]({'where':{'id':_0x4f31e8[_0xdaa0('0x44')]['id']}})[_0xdaa0('0x23')](handleEntityNotFound(_0x49cd58,null))[_0xdaa0('0x23')](saveUpdates(_0x4f31e8[_0xdaa0('0x48')],null))[_0xdaa0('0x23')](respondWithResult(_0x49cd58,null))[_0xdaa0('0x46')](handleError(_0x49cd58,null));};exports[_0xdaa0('0x4a')]=function(_0x2cd49e,_0x5baba0){return db[_0xdaa0('0x2a')][_0xdaa0('0x49')]({'where':{'id':_0x2cd49e[_0xdaa0('0x44')]['id']}})['then'](handleEntityNotFound(_0x5baba0,null))[_0xdaa0('0x23')](removeEntity(_0x5baba0,null))[_0xdaa0('0x46')](handleError(_0x5baba0,null));};exports[_0xdaa0('0x4b')]=function(_0x252fd2,_0x3077c8,_0x4490df){var _0x40a9b7={};var _0x3f8f86={};var _0x39463b;var _0x2c5bb5;return db['ZohoAccount']['findOne']({'where':{'id':_0x252fd2[_0xdaa0('0x44')]['id']}})[_0xdaa0('0x23')](handleEntityNotFound(_0x3077c8,null))[_0xdaa0('0x23')](function(_0x32440a){if(_0x32440a){_0x39463b=_0x32440a;_0x3f8f86[_0xdaa0('0x2f')]=_['keys'](db[_0xdaa0('0x4c')][_0xdaa0('0x2b')]);_0x3f8f86[_0xdaa0('0x31')]=_[_0xdaa0('0x32')](_0x252fd2[_0xdaa0('0x31')]);_0x3f8f86[_0xdaa0('0x3a')]=_[_0xdaa0('0x33')](_0x3f8f86['model'],_0x3f8f86[_0xdaa0('0x31')]);_0x40a9b7[_0xdaa0('0x35')]=_['intersection'](_0x3f8f86[_0xdaa0('0x2f')],qs['fields'](_0x252fd2[_0xdaa0('0x31')][_0xdaa0('0x34')]));_0x40a9b7[_0xdaa0('0x35')]=_0x40a9b7['attributes'][_0xdaa0('0x45')]?_0x40a9b7[_0xdaa0('0x35')]:_0x3f8f86[_0xdaa0('0x2f')];_0x40a9b7[_0xdaa0('0x38')]=qs[_0xdaa0('0x39')](_0x252fd2[_0xdaa0('0x31')][_0xdaa0('0x39')]);_0x40a9b7[_0xdaa0('0x3d')]=qs[_0xdaa0('0x3a')](_[_0xdaa0('0x3b')](_0x252fd2[_0xdaa0('0x31')],_0x3f8f86[_0xdaa0('0x3a')]));if(_0x252fd2['query'][_0xdaa0('0x3c')]){_0x40a9b7['where']=_[_0xdaa0('0x3f')](_0x40a9b7[_0xdaa0('0x3d')],{'$or':_[_0xdaa0('0x30')](_0x40a9b7[_0xdaa0('0x35')],function(_0x1bc30d){var _0x437ad2={};_0x437ad2[_0x1bc30d]={'$like':'%'+_0x252fd2[_0xdaa0('0x31')]['filter']+'%'};return _0x437ad2;})});}_0x40a9b7=_[_0xdaa0('0x3f')]({},_0x40a9b7,_0x252fd2[_0xdaa0('0x40')]);return _0x39463b[_0xdaa0('0x4b')](_0x40a9b7);}})[_0xdaa0('0x23')](function(_0x3c372d){if(_0x3c372d){_0x2c5bb5=_0x3c372d[_0xdaa0('0x45')];if(!_0x252fd2[_0xdaa0('0x31')]['hasOwnProperty'](_0xdaa0('0x37'))){_0x40a9b7[_0xdaa0('0x1c')]=qs[_0xdaa0('0x1c')](_0x252fd2[_0xdaa0('0x31')][_0xdaa0('0x1c')]);_0x40a9b7['offset']=qs[_0xdaa0('0x1a')](_0x252fd2['query']['offset']);}return _0x39463b['getConfigurations'](_0x40a9b7);}})[_0xdaa0('0x23')](function(_0x5cab44){if(_0x5cab44){return _0x5cab44?{'count':_0x2c5bb5,'rows':_0x5cab44}:null;}})[_0xdaa0('0x23')](respondWithResult(_0x3077c8,null))['catch'](handleError(_0x3077c8,null));};exports[_0xdaa0('0x4d')]=function(_0x3c9036,_0x5b4b7d,_0x3dd4e8){if(_0x3c9036[_0xdaa0('0x48')]['id']){delete _0x3c9036[_0xdaa0('0x48')]['id'];}return db[_0xdaa0('0x2a')]['findOne']({'where':{'id':_0x3c9036[_0xdaa0('0x44')]['id']}})['then'](handleEntityNotFound(_0x5b4b7d,null))[_0xdaa0('0x23')](function(_0x37f42c){if(_0x37f42c){_0x3c9036[_0xdaa0('0x48')][_0xdaa0('0x4e')]=_0x37f42c['id'];_0x3c9036['body'][_0xdaa0('0x4f')]=integrations['getSubjects'](_0x3c9036['body'][_0xdaa0('0x50')],_0x3c9036[_0xdaa0('0x48')][_0xdaa0('0x2d')]);_0x3c9036[_0xdaa0('0x48')]['Descriptions']=integrations[_0xdaa0('0x51')](_0x3c9036[_0xdaa0('0x48')][_0xdaa0('0x50')],_0x3c9036['body'][_0xdaa0('0x2d')]);return db[_0xdaa0('0x4c')][_0xdaa0('0x47')](_0x3c9036['body'],{'include':[{'model':db['ZohoField'],'as':_0xdaa0('0x4f')},{'model':db[_0xdaa0('0x52')],'as':'Descriptions'}]});}return null;})[_0xdaa0('0x23')](respondWithResult(_0x5b4b7d,null))[_0xdaa0('0x46')](handleError(_0x5b4b7d,null));};function getAccessToken(_0x5648f4){return new Promise(function(_0x22d2ee,_0x38630a){var _0x105aa5;switch(_0x5648f4['zone']){case'US':_0x105aa5=_0xdaa0('0x53');break;case'AU':_0x105aa5=_0xdaa0('0x54');break;case'EU':_0x105aa5='https://accounts.zoho.eu';break;case'IN':_0x105aa5=_0xdaa0('0x55');break;case'CN':_0x105aa5=_0xdaa0('0x56');break;default:_0x105aa5=_0xdaa0('0x57');break;}var _0x3cda53={'method':_0xdaa0('0x58'),'uri':_0x105aa5+_0xdaa0('0x59'),'qs':{'refresh_token':_0x5648f4[_0xdaa0('0x5a')],'client_id':_0x5648f4[_0xdaa0('0x5b')],'client_secret':_0x5648f4[_0xdaa0('0x5c')],'grant_type':_0xdaa0('0x5d')},'json':!![]};return rp(_0x3cda53)[_0xdaa0('0x23')](function(_0x41bac5){if(_0x41bac5[_0xdaa0('0x5e')]){_0x22d2ee(_0x41bac5[_0xdaa0('0x5e')]);}else{_0x38630a(_0xdaa0('0x5f'));}})[_0xdaa0('0x46')](function(_0x44446e){_0x38630a(_0x44446e);});});}exports[_0xdaa0('0x60')]=function(_0x540a69,_0x38f647,_0x57ae72){var _0x9c3a08,_0x28e384,_0x587e5e,_0x476d6,_0x5e6353;return db['ZohoAccount']['findOne']({'where':{'id':_0x540a69[_0xdaa0('0x44')]['id']},'attributes':['id',_0xdaa0('0x61'),_0xdaa0('0x62'),_0xdaa0('0x5b'),_0xdaa0('0x5c'),_0xdaa0('0x63'),_0xdaa0('0x64'),'refreshToken']})[_0xdaa0('0x23')](handleEntityNotFound(_0x38f647,null))[_0xdaa0('0x23')](function(_0x1bdb2c){_0x5e6353=_0x1bdb2c;_0x9c3a08=_0x5e6353[_0xdaa0('0x61')];_0x28e384=_0x9c3a08===_0xdaa0('0x65')?'eu':_0xdaa0('0x66');_0x587e5e=_0x5e6353['serverUrl'];var _0x594719=_0x587e5e[_0xdaa0('0x67')](-0x1);if(_0x594719==='/'||_0x594719==='\x5c'||_0x594719===':'){_0x587e5e=_0x587e5e[_0xdaa0('0x68')](0x0,_0x587e5e[_0xdaa0('0x69')](_0x594719));}if(!_0x5e6353[_0xdaa0('0x5a')]){throw new Error(_0xdaa0('0x6a'));}return getAccessToken(_0x5e6353);})['then'](function(_0x14be8b){if(_0x14be8b){return rp({'method':_0xdaa0('0x6b'),'uri':util[_0xdaa0('0x6c')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x28e384),'qs':{'module':_0xdaa0('0x6d')},'headers':{'Authorization':_0xdaa0('0x6e')+_0x14be8b},'json':!![]});}})['then'](function(_0x389faa){if(_0x389faa){if(_0x389faa[_0xdaa0('0x6f')]&&_0x389faa[_0xdaa0('0x6f')][_0xdaa0('0x25')]){throw new Error(_0x389faa[_0xdaa0('0x6f')][_0xdaa0('0x25')][_0xdaa0('0x70')]);}var _0x575df4=[];var _0x1783b9=[];var _0x3890d6=['Owner',_0xdaa0('0x71'),_0xdaa0('0x72'),_0xdaa0('0x73'),_0xdaa0('0x74'),'Call_Result','Call_Start_Time',_0xdaa0('0x75')];_0x1783b9=_[_0xdaa0('0x76')](_0x389faa[_0xdaa0('0x34')],function(_0x985362){return _0x3890d6[_0xdaa0('0x77')](_0x985362[_0xdaa0('0x78')]);});for(var _0x2698b0=0x0;_0x2698b0<_0x1783b9[_0xdaa0('0x45')];_0x2698b0++){if(_0x1783b9[_0x2698b0]['system_mandatory']===![]){_0x575df4[_0xdaa0('0x79')]({'id':_0x1783b9[_0x2698b0]['id'],'name':_0x1783b9[_0x2698b0][_0xdaa0('0x7a')],'custom':_0x1783b9[_0x2698b0][_0xdaa0('0x7b')],'options':_0x1783b9[_0x2698b0]['data_type']===_0xdaa0('0x7c')&&_0x1783b9[_0x2698b0][_0xdaa0('0x7d')][_0xdaa0('0x45')]>-0x1?_[_0xdaa0('0x30')](_0x1783b9[_0x2698b0][_0xdaa0('0x7d')],function(_0x2437d4){return{'name':_0x2437d4,'value':_0x2437d4};}):[]});}}return{'count':_0x575df4[_0xdaa0('0x45')],'rows':_0x575df4};}else{return{'count':0x0,'rows':[]};}})[_0xdaa0('0x23')](respondWithResult(_0x38f647,null))[_0xdaa0('0x46')](function(_0x4cb4d4){var _0xff1509=_0x540a69[_0xdaa0('0x31')][_0xdaa0('0x7e')]?0x1f4:_0x4cb4d4[_0xdaa0('0x7f')]||0x1f4;logger[_0xdaa0('0x25')](_0xdaa0('0x80'),_0xdaa0('0x60'),_0xff1509,JSON['stringify'](_0x4cb4d4));delete _0x4cb4d4[_0xdaa0('0x27')];if(_0xff1509===0x191){_0xff1509=0x190;}_0x38f647['status'](_0xff1509)[_0xdaa0('0x28')](_0x540a69[_0xdaa0('0x31')][_0xdaa0('0x7e')]?{'message':_0xdaa0('0x81'),'statusCode':_0x4cb4d4[_0xdaa0('0x7f')]}:_0x4cb4d4);});}; \ No newline at end of file +var _0x8ff9=['AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','serverUrl','host','slice','substring','lastIndexOf','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','message','Owner','Description','WhoId','Call_Duration','remove','system_mandatory','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','util','path','sox','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','sendStatus','stack','name','map','ZohoAccount','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','type','VIRTUAL','includeAll','include','findAll','rows','params','rawAttributes','options','find','catch','create','body','getConfigurations','findOne','ZohoConfiguration','filter','nolimit'];(function(_0x44443d,_0x28c941){var _0x5000d0=function(_0x3531a7){while(--_0x3531a7){_0x44443d['push'](_0x44443d['shift']());}};_0x5000d0(++_0x28c941);}(_0x8ff9,0xa8));var _0x98ff=function(_0x47e0d8,_0x4227d0){_0x47e0d8=_0x47e0d8-0x0;var _0x101799=_0x8ff9[_0x47e0d8];return _0x101799;};'use strict';var emlformat=require(_0x98ff('0x0'));var rimraf=require(_0x98ff('0x1'));var zipdir=require(_0x98ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x98ff('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x98ff('0x4'));var path=require(_0x98ff('0x5'));var sox=require(_0x98ff('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x98ff('0x7'));var _=require(_0x98ff('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x98ff('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x98ff('0xa'));var querystring=require(_0x98ff('0xb'));var Papa=require(_0x98ff('0xc'));var Redis=require(_0x98ff('0xd'));var authService=require(_0x98ff('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x98ff('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x98ff('0x10'));var licenseUtil=require(_0x98ff('0x11'));var db=require(_0x98ff('0x12'))['db'];var integrations=require(_0x98ff('0x13'));function respondWithStatusCode(_0xecab99,_0x4fcdc0){_0x4fcdc0=_0x4fcdc0||0xcc;return function(_0x271c2e){if(_0x271c2e){return _0xecab99['sendStatus'](_0x4fcdc0);}return _0xecab99[_0x98ff('0x14')](_0x4fcdc0)[_0x98ff('0x15')]();};}function respondWithResult(_0x111050,_0x32635a){_0x32635a=_0x32635a||0xc8;return function(_0x27762e){if(_0x27762e){return _0x111050[_0x98ff('0x14')](_0x32635a)[_0x98ff('0x16')](_0x27762e);}};}function respondWithFilteredResult(_0x5679a1,_0x4dccaa){return function(_0xcc28dd){if(_0xcc28dd){var _0x46a438=typeof _0x4dccaa[_0x98ff('0x17')]===_0x98ff('0x18')&&typeof _0x4dccaa[_0x98ff('0x19')]===_0x98ff('0x18');var _0x4443b4=_0xcc28dd[_0x98ff('0x1a')];var _0x579c1d=_0x46a438?0x0:_0x4dccaa[_0x98ff('0x17')];var _0xcd4922=_0x46a438?_0xcc28dd[_0x98ff('0x1a')]:_0x4dccaa[_0x98ff('0x17')]+_0x4dccaa[_0x98ff('0x19')];var _0x36e9fe;if(_0xcd4922>=_0x4443b4){_0xcd4922=_0x4443b4;_0x36e9fe=0xc8;}else{_0x36e9fe=0xce;}_0x5679a1['status'](_0x36e9fe);return _0x5679a1['set'](_0x98ff('0x1b'),_0x579c1d+'-'+_0xcd4922+'/'+_0x4443b4)['json'](_0xcc28dd);}return null;};}function patchUpdates(_0x5bce3e){return function(_0x1b1bc8){try{jsonpatch['apply'](_0x1b1bc8,_0x5bce3e,!![]);}catch(_0x280091){return BPromise['reject'](_0x280091);}return _0x1b1bc8[_0x98ff('0x1c')]();};}function saveUpdates(_0x51c760,_0x71b2a5){return function(_0x4160a1){if(_0x4160a1){return _0x4160a1[_0x98ff('0x1d')](_0x51c760)[_0x98ff('0x1e')](function(_0x55dce6){return _0x55dce6;});}return null;};}function removeEntity(_0x20280c,_0x35d72f){return function(_0x4a7e04){if(_0x4a7e04){return _0x4a7e04[_0x98ff('0x1f')]()[_0x98ff('0x1e')](function(){_0x20280c[_0x98ff('0x14')](0xcc)[_0x98ff('0x15')]();});}};}function handleEntityNotFound(_0x548a04,_0xfb8f6a){return function(_0x1e20c9){if(!_0x1e20c9){_0x548a04[_0x98ff('0x20')](0x194);}return _0x1e20c9;};}function handleError(_0xc8e8a0,_0x37f3a8){_0x37f3a8=_0x37f3a8||0x1f4;return function(_0x55bec3){logger['error'](_0x55bec3[_0x98ff('0x21')]);if(_0x55bec3[_0x98ff('0x22')]){delete _0x55bec3[_0x98ff('0x22')];}_0xc8e8a0[_0x98ff('0x14')](_0x37f3a8)['send'](_0x55bec3);};}exports['index']=function(_0x33dcb5,_0x2e8946){var _0x382027={},_0x2b2bf9={},_0x1be396={'count':0x0,'rows':[]};var _0x478ae0=_[_0x98ff('0x23')](db[_0x98ff('0x24')]['rawAttributes'],function(_0x592ef9){return{'name':_0x592ef9['fieldName'],'type':_0x592ef9['type'][_0x98ff('0x25')]};});_0x2b2bf9[_0x98ff('0x26')]=_['map'](_0x478ae0,_0x98ff('0x22'));_0x2b2bf9[_0x98ff('0x27')]=_[_0x98ff('0x28')](_0x33dcb5[_0x98ff('0x27')]);_0x2b2bf9['filters']=_[_0x98ff('0x29')](_0x2b2bf9[_0x98ff('0x26')],_0x2b2bf9[_0x98ff('0x27')]);_0x382027[_0x98ff('0x2a')]=_[_0x98ff('0x29')](_0x2b2bf9[_0x98ff('0x26')],qs[_0x98ff('0x2b')](_0x33dcb5[_0x98ff('0x27')][_0x98ff('0x2b')]));_0x382027[_0x98ff('0x2a')]=_0x382027['attributes'][_0x98ff('0x2c')]?_0x382027[_0x98ff('0x2a')]:_0x2b2bf9[_0x98ff('0x26')];if(!_0x33dcb5['query'][_0x98ff('0x2d')]('nolimit')){_0x382027['limit']=qs[_0x98ff('0x19')](_0x33dcb5[_0x98ff('0x27')]['limit']);_0x382027[_0x98ff('0x17')]=qs[_0x98ff('0x17')](_0x33dcb5['query']['offset']);}_0x382027[_0x98ff('0x2e')]=qs[_0x98ff('0x2f')](_0x33dcb5[_0x98ff('0x27')][_0x98ff('0x2f')]);_0x382027[_0x98ff('0x30')]=qs[_0x98ff('0x31')](_[_0x98ff('0x32')](_0x33dcb5['query'],_0x2b2bf9[_0x98ff('0x31')]),_0x478ae0);if(_0x33dcb5['query']['filter']){_0x382027[_0x98ff('0x30')]=_[_0x98ff('0x33')](_0x382027[_0x98ff('0x30')],{'$or':_[_0x98ff('0x23')](_0x478ae0,function(_0x31c1c2){if(_0x31c1c2[_0x98ff('0x34')]!==_0x98ff('0x35')){var _0x2b2b85={};_0x2b2b85[_0x31c1c2['name']]={'$like':'%'+_0x33dcb5[_0x98ff('0x27')]['filter']+'%'};return _0x2b2b85;}})});}_0x382027=_[_0x98ff('0x33')]({},_0x382027,_0x33dcb5['options']);var _0x12220c={'where':_0x382027[_0x98ff('0x30')]};return db['ZohoAccount'][_0x98ff('0x1a')](_0x12220c)[_0x98ff('0x1e')](function(_0x152cb9){_0x1be396['count']=_0x152cb9;if(_0x33dcb5[_0x98ff('0x27')][_0x98ff('0x36')]){_0x382027[_0x98ff('0x37')]=[{'all':!![]}];}return db[_0x98ff('0x24')][_0x98ff('0x38')](_0x382027);})[_0x98ff('0x1e')](function(_0x4bcf76){_0x1be396[_0x98ff('0x39')]=_0x4bcf76;return _0x1be396;})[_0x98ff('0x1e')](respondWithFilteredResult(_0x2e8946,_0x382027))['catch'](handleError(_0x2e8946,null));};exports['show']=function(_0x32b012,_0x2c092b){var _0x3ca139={'raw':![],'where':{'id':_0x32b012[_0x98ff('0x3a')]['id']}},_0x560137={};_0x560137[_0x98ff('0x26')]=_['keys'](db[_0x98ff('0x24')][_0x98ff('0x3b')]);_0x560137['query']=_[_0x98ff('0x28')](_0x32b012[_0x98ff('0x27')]);_0x560137[_0x98ff('0x31')]=_[_0x98ff('0x29')](_0x560137[_0x98ff('0x26')],_0x560137[_0x98ff('0x27')]);_0x3ca139['attributes']=_[_0x98ff('0x29')](_0x560137[_0x98ff('0x26')],qs['fields'](_0x32b012[_0x98ff('0x27')][_0x98ff('0x2b')]));_0x3ca139[_0x98ff('0x2a')]=_0x3ca139['attributes'][_0x98ff('0x2c')]?_0x3ca139[_0x98ff('0x2a')]:_0x560137[_0x98ff('0x26')];if(_0x32b012[_0x98ff('0x27')][_0x98ff('0x36')]){_0x3ca139['include']=[{'all':!![]}];}_0x3ca139=_[_0x98ff('0x33')]({},_0x3ca139,_0x32b012[_0x98ff('0x3c')]);return db[_0x98ff('0x24')][_0x98ff('0x3d')](_0x3ca139)[_0x98ff('0x1e')](handleEntityNotFound(_0x2c092b,null))['then'](respondWithResult(_0x2c092b,null))[_0x98ff('0x3e')](handleError(_0x2c092b,null));};exports[_0x98ff('0x3f')]=function(_0x3d6f71,_0x4ca47a){return db[_0x98ff('0x24')][_0x98ff('0x3f')](_0x3d6f71['body'],{})[_0x98ff('0x1e')](respondWithResult(_0x4ca47a,0xc9))[_0x98ff('0x3e')](handleError(_0x4ca47a,null));};exports[_0x98ff('0x1d')]=function(_0x58a508,_0x3e73bb){if(_0x58a508[_0x98ff('0x40')]['id']){delete _0x58a508[_0x98ff('0x40')]['id'];}return db[_0x98ff('0x24')][_0x98ff('0x3d')]({'where':{'id':_0x58a508[_0x98ff('0x3a')]['id']}})[_0x98ff('0x1e')](handleEntityNotFound(_0x3e73bb,null))['then'](saveUpdates(_0x58a508[_0x98ff('0x40')],null))[_0x98ff('0x1e')](respondWithResult(_0x3e73bb,null))['catch'](handleError(_0x3e73bb,null));};exports[_0x98ff('0x1f')]=function(_0x19859a,_0x58dddb){return db[_0x98ff('0x24')][_0x98ff('0x3d')]({'where':{'id':_0x19859a['params']['id']}})['then'](handleEntityNotFound(_0x58dddb,null))['then'](removeEntity(_0x58dddb,null))['catch'](handleError(_0x58dddb,null));};exports[_0x98ff('0x41')]=function(_0x1a8db2,_0x53d616,_0x383473){var _0x1c6ce6={};var _0x4ea7ed={};var _0x1bef1c;var _0x1923b3;return db[_0x98ff('0x24')][_0x98ff('0x42')]({'where':{'id':_0x1a8db2[_0x98ff('0x3a')]['id']}})[_0x98ff('0x1e')](handleEntityNotFound(_0x53d616,null))[_0x98ff('0x1e')](function(_0x39e783){if(_0x39e783){_0x1bef1c=_0x39e783;_0x4ea7ed[_0x98ff('0x26')]=_[_0x98ff('0x28')](db[_0x98ff('0x43')]['rawAttributes']);_0x4ea7ed[_0x98ff('0x27')]=_['keys'](_0x1a8db2['query']);_0x4ea7ed[_0x98ff('0x31')]=_[_0x98ff('0x29')](_0x4ea7ed[_0x98ff('0x26')],_0x4ea7ed[_0x98ff('0x27')]);_0x1c6ce6[_0x98ff('0x2a')]=_['intersection'](_0x4ea7ed[_0x98ff('0x26')],qs[_0x98ff('0x2b')](_0x1a8db2[_0x98ff('0x27')][_0x98ff('0x2b')]));_0x1c6ce6[_0x98ff('0x2a')]=_0x1c6ce6['attributes'][_0x98ff('0x2c')]?_0x1c6ce6[_0x98ff('0x2a')]:_0x4ea7ed[_0x98ff('0x26')];_0x1c6ce6[_0x98ff('0x2e')]=qs[_0x98ff('0x2f')](_0x1a8db2[_0x98ff('0x27')][_0x98ff('0x2f')]);_0x1c6ce6[_0x98ff('0x30')]=qs[_0x98ff('0x31')](_['pick'](_0x1a8db2[_0x98ff('0x27')],_0x4ea7ed[_0x98ff('0x31')]));if(_0x1a8db2[_0x98ff('0x27')]['filter']){_0x1c6ce6[_0x98ff('0x30')]=_['merge'](_0x1c6ce6['where'],{'$or':_['map'](_0x1c6ce6['attributes'],function(_0x47a0fc){var _0x3be223={};_0x3be223[_0x47a0fc]={'$like':'%'+_0x1a8db2[_0x98ff('0x27')][_0x98ff('0x44')]+'%'};return _0x3be223;})});}_0x1c6ce6=_[_0x98ff('0x33')]({},_0x1c6ce6,_0x1a8db2['options']);return _0x1bef1c['getConfigurations'](_0x1c6ce6);}})[_0x98ff('0x1e')](function(_0x331ca5){if(_0x331ca5){_0x1923b3=_0x331ca5[_0x98ff('0x2c')];if(!_0x1a8db2[_0x98ff('0x27')][_0x98ff('0x2d')](_0x98ff('0x45'))){_0x1c6ce6['limit']=qs[_0x98ff('0x19')](_0x1a8db2[_0x98ff('0x27')]['limit']);_0x1c6ce6[_0x98ff('0x17')]=qs[_0x98ff('0x17')](_0x1a8db2[_0x98ff('0x27')]['offset']);}return _0x1bef1c[_0x98ff('0x41')](_0x1c6ce6);}})[_0x98ff('0x1e')](function(_0x395a63){if(_0x395a63){return _0x395a63?{'count':_0x1923b3,'rows':_0x395a63}:null;}})[_0x98ff('0x1e')](respondWithResult(_0x53d616,null))[_0x98ff('0x3e')](handleError(_0x53d616,null));};exports['addConfiguration']=function(_0x24e6d0,_0x1a5c52,_0x11c5c7){if(_0x24e6d0['body']['id']){delete _0x24e6d0[_0x98ff('0x40')]['id'];}return db[_0x98ff('0x24')]['findOne']({'where':{'id':_0x24e6d0[_0x98ff('0x3a')]['id']}})['then'](handleEntityNotFound(_0x1a5c52,null))[_0x98ff('0x1e')](function(_0x2d808d){if(_0x2d808d){_0x24e6d0[_0x98ff('0x40')][_0x98ff('0x46')]=_0x2d808d['id'];_0x24e6d0['body'][_0x98ff('0x47')]=integrations[_0x98ff('0x48')](_0x24e6d0['body'][_0x98ff('0x49')],_0x24e6d0[_0x98ff('0x40')][_0x98ff('0x34')]);_0x24e6d0[_0x98ff('0x40')][_0x98ff('0x4a')]=integrations[_0x98ff('0x4b')](_0x24e6d0['body'][_0x98ff('0x49')],_0x24e6d0['body'][_0x98ff('0x34')]);return db['ZohoConfiguration'][_0x98ff('0x3f')](_0x24e6d0['body'],{'include':[{'model':db[_0x98ff('0x4c')],'as':_0x98ff('0x47')},{'model':db[_0x98ff('0x4c')],'as':'Descriptions'}]});}return null;})[_0x98ff('0x1e')](respondWithResult(_0x1a5c52,null))[_0x98ff('0x3e')](handleError(_0x1a5c52,null));};function getAccessToken(_0x1bc3a9){return new Promise(function(_0x4fe796,_0x3d2777){var _0x257247;switch(_0x1bc3a9[_0x98ff('0x4d')]){case'US':_0x257247=_0x98ff('0x4e');break;case'AU':_0x257247=_0x98ff('0x4f');break;case'EU':_0x257247=_0x98ff('0x50');break;case'IN':_0x257247=_0x98ff('0x51');break;case'CN':_0x257247=_0x98ff('0x52');break;default:_0x257247='https://accounts.zoho.eu';break;}var _0x48116e={'method':'POST','uri':_0x257247+_0x98ff('0x53'),'qs':{'refresh_token':_0x1bc3a9[_0x98ff('0x54')],'client_id':_0x1bc3a9[_0x98ff('0x55')],'client_secret':_0x1bc3a9[_0x98ff('0x56')],'grant_type':_0x98ff('0x57')},'json':!![]};return rp(_0x48116e)[_0x98ff('0x1e')](function(_0x400c28){if(_0x400c28[_0x98ff('0x58')]){_0x4fe796(_0x400c28[_0x98ff('0x58')]);}else{_0x3d2777(_0x98ff('0x59'));}})[_0x98ff('0x3e')](function(_0x3fe6ab){_0x3d2777(_0x3fe6ab);});});}exports['getFields']=function(_0xe5e41c,_0x25febb,_0x37a05d){var _0x5af1bc,_0x346091,_0x4aa28c,_0x4389b5,_0x2ebb96;return db['ZohoAccount'][_0x98ff('0x42')]({'where':{'id':_0xe5e41c[_0x98ff('0x3a')]['id']},'attributes':['id','host','zone','clientId',_0x98ff('0x56'),_0x98ff('0x5a'),'code',_0x98ff('0x54')]})[_0x98ff('0x1e')](handleEntityNotFound(_0x25febb,null))[_0x98ff('0x1e')](function(_0x2f1eb0){_0x2ebb96=_0x2f1eb0;_0x5af1bc=_0x2ebb96[_0x98ff('0x5b')];_0x346091=_0x5af1bc==='zoho.eu'?'eu':'com';_0x4aa28c=_0x2ebb96[_0x98ff('0x5a')];var _0x3b95d3=_0x4aa28c[_0x98ff('0x5c')](-0x1);if(_0x3b95d3==='/'||_0x3b95d3==='\x5c'||_0x3b95d3===':'){_0x4aa28c=_0x4aa28c[_0x98ff('0x5d')](0x0,_0x4aa28c[_0x98ff('0x5e')](_0x3b95d3));}if(!_0x2ebb96[_0x98ff('0x54')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x2ebb96);})[_0x98ff('0x1e')](function(_0x7b75a0){if(_0x7b75a0){return rp({'method':_0x98ff('0x5f'),'uri':util['format'](_0x98ff('0x60'),_0x346091),'qs':{'module':_0x98ff('0x61')},'headers':{'Authorization':_0x98ff('0x62')+_0x7b75a0},'json':!![]});}})[_0x98ff('0x1e')](function(_0x2ea555){if(_0x2ea555){if(_0x2ea555[_0x98ff('0x63')]&&_0x2ea555['response'][_0x98ff('0x64')]){throw new Error(_0x2ea555[_0x98ff('0x63')][_0x98ff('0x64')][_0x98ff('0x65')]);}var _0x2d90fd=[];var _0x2545d2=[];var _0x541b47=[_0x98ff('0x66'),'Subject',_0x98ff('0x67'),_0x98ff('0x68'),_0x98ff('0x69'),'Call_Result','Call_Start_Time','Call_Type'];_0x2545d2=_[_0x98ff('0x6a')](_0x2ea555['fields'],function(_0x590a83){return _0x541b47['includes'](_0x590a83['api_name']);});for(var _0x103420=0x0;_0x103420<_0x2545d2[_0x98ff('0x2c')];_0x103420++){if(_0x2545d2[_0x103420][_0x98ff('0x6b')]===![]){_0x2d90fd['push']({'id':_0x2545d2[_0x103420]['id'],'name':_0x2545d2[_0x103420]['display_label'],'custom':_0x2545d2[_0x103420][_0x98ff('0x6c')],'options':_0x2545d2[_0x103420][_0x98ff('0x6d')]===_0x98ff('0x6e')&&_0x2545d2[_0x103420][_0x98ff('0x6f')]['length']>-0x1?_[_0x98ff('0x23')](_0x2545d2[_0x103420][_0x98ff('0x6f')],function(_0x4065d4){return{'name':_0x4065d4,'value':_0x4065d4};}):[]});}}return{'count':_0x2d90fd[_0x98ff('0x2c')],'rows':_0x2d90fd};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x25febb,null))[_0x98ff('0x3e')](function(_0x518701){var _0x5be330=_0xe5e41c['query'][_0x98ff('0x70')]?0x1f4:_0x518701[_0x98ff('0x71')]||0x1f4;logger[_0x98ff('0x64')](_0x98ff('0x72'),_0x98ff('0x73'),_0x5be330,JSON[_0x98ff('0x74')](_0x518701));delete _0x518701['name'];if(_0x5be330===0x191){_0x5be330=0x190;}_0x25febb['status'](_0x5be330)[_0x98ff('0x75')](_0xe5e41c[_0x98ff('0x27')]['test']?{'message':_0x98ff('0x76'),'statusCode':_0x518701[_0x98ff('0x71')]}:_0x518701);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 53c81fe..e172c23 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 _0x00d9=['clientSecret','host','serverUrl','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refreshToken','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','code','https://accounts.zoho.in','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','clientId'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x00d9,0xf2));var _0x900d=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x00d9[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x900d('0x0'));var util=require(_0x900d('0x1'));var logger=require(_0x900d('0x2'))('api');var moment=require('moment');var BPromise=require(_0x900d('0x3'));var rp=require(_0x900d('0x4'));var fs=require('fs');var path=require(_0x900d('0x5'));var rimraf=require(_0x900d('0x6'));var config=require(_0x900d('0x7'));var attributes=require(_0x900d('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x900d('0x9')]=function(_0x238fd2,_0x56427c){return _0x238fd2[_0x900d('0xa')](_0x900d('0xb'),attributes,{'tableName':_0x900d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x928450,_0xdeb03e,_0x5c6c57){if(_0x928450[_0x900d('0xd')](_0x900d('0xe'))||_0x928450[_0x900d('0xd')]('serverUrl')||_0x928450[_0x900d('0xd')](_0x900d('0xf'))||_0x928450[_0x900d('0xd')](_0x900d('0x10'))||_0x928450[_0x900d('0xd')]('code')||_0x928450[_0x900d('0xd')](_0x900d('0x11'))){var _0x803458,_0x1efa93;_0x803458=_0x928450[_0x900d('0x12')];var _0x5b0b29=_0x803458[_0x900d('0x13')](-0x1);if(_0x5b0b29==='/'||_0x5b0b29==='\x5c'||_0x5b0b29===':'){_0x803458=_0x803458[_0x900d('0x14')](0x0,_0x803458[_0x900d('0x15')](_0x5b0b29));}switch(_0x928450[_0x900d('0xe')]){case'US':_0x1efa93=_0x900d('0x16');break;case'AU':_0x1efa93=_0x900d('0x17');break;case'IN':_0x1efa93='https://accounts.zoho.in';break;case'CN':_0x1efa93=_0x900d('0x18');break;default:_0x1efa93='https://accounts.zoho.eu';break;}var _0x3b5533={'method':_0x900d('0x19'),'uri':_0x1efa93+_0x900d('0x1a'),'form':{'grant_type':_0x900d('0x1b'),'client_id':_0x928450[_0x900d('0xf')],'client_secret':_0x928450[_0x900d('0x10')],'redirect_uri':_0x928450[_0x900d('0x12')],'code':_0x928450['code']},'headers':{'Content-Type':_0x900d('0x1c')}};return rp(_0x3b5533)[_0x900d('0x1d')](function(_0xf221f7){var _0x465c33=JSON[_0x900d('0x1e')](_0xf221f7);if(_0x465c33['refresh_token']){_0x928450[_0x900d('0x1f')]=_0x465c33[_0x900d('0x20')];logger[_0x900d('0x21')](util[_0x900d('0x22')](_0x900d('0x23'),_0x928450[_0x900d('0x24')],_0x928450['id']));}else{logger[_0x900d('0x25')](util['format'](_0x900d('0x26'),_0x928450['name'],_0x928450['id']),util[_0x900d('0x27')](_0x465c33,{'showHidden':![],'depth':null}));}return _0x5c6c57(null,_0xdeb03e);})[_0x900d('0x28')](function(_0x4aa0b6){logger[_0x900d('0x25')](util[_0x900d('0x22')](_0x900d('0x26'),_0x928450[_0x900d('0x24')],_0x928450['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x5c6c57(_0x4aa0b6);});}else{return _0x5c6c57(null,_0xdeb03e);}},'beforeUpdate':function(_0x3b3580,_0x58b404,_0x38639b){if(_0x3b3580[_0x900d('0xd')](_0x900d('0xe'))||_0x3b3580[_0x900d('0xd')](_0x900d('0x12'))||_0x3b3580[_0x900d('0xd')]('clientId')||_0x3b3580['changed']('clientSecret')||_0x3b3580[_0x900d('0xd')](_0x900d('0x29'))||_0x3b3580[_0x900d('0xd')]('host')){var _0x19baa0,_0x24fe03;_0x19baa0=_0x3b3580['serverUrl'];var _0x555668=_0x19baa0[_0x900d('0x13')](-0x1);if(_0x555668==='/'||_0x555668==='\x5c'||_0x555668===':'){_0x19baa0=_0x19baa0['substring'](0x0,_0x19baa0[_0x900d('0x15')](_0x555668));}switch(_0x3b3580[_0x900d('0xe')]){case'US':_0x24fe03=_0x900d('0x16');break;case'AU':_0x24fe03=_0x900d('0x17');break;case'IN':_0x24fe03=_0x900d('0x2a');break;case'CN':_0x24fe03=_0x900d('0x18');break;default:_0x24fe03='https://accounts.zoho.eu';break;}var _0x481544={'method':_0x900d('0x19'),'uri':_0x24fe03+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x3b3580['clientId'],'client_secret':_0x3b3580[_0x900d('0x10')],'redirect_uri':_0x3b3580['serverUrl'],'code':_0x3b3580[_0x900d('0x29')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x481544)['then'](function(_0x5cec49){var _0x36b1af=JSON[_0x900d('0x1e')](_0x5cec49);if(_0x36b1af[_0x900d('0x20')]){_0x3b3580['refreshToken']=_0x36b1af[_0x900d('0x20')];logger[_0x900d('0x21')](util[_0x900d('0x22')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3b3580['name'],_0x3b3580['id']));}else{logger[_0x900d('0x25')](util['format'](_0x900d('0x26'),_0x3b3580[_0x900d('0x24')],_0x3b3580['id']),util['inspect'](_0x36b1af,{'showHidden':![],'depth':null}));}return _0x38639b(null,_0x58b404);})[_0x900d('0x28')](function(_0x5dd305){logger['error'](util[_0x900d('0x22')](_0x900d('0x26'),_0x3b3580['name'],_0x3b3580['id']),util[_0x900d('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x38639b(_0x5dd305);});}else{return _0x38639b(null,_0x58b404);}}}});}; \ No newline at end of file +var _0xc137=['name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','error','format','slice','lastIndexOf','POST','catch','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','changed','zone','serverUrl','clientId','clientSecret','code','host','substring','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','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d'];(function(_0x323195,_0x23f5ef){var _0x3ab5f2=function(_0x773cdc){while(--_0x773cdc){_0x323195['push'](_0x323195['shift']());}};_0x3ab5f2(++_0x23f5ef);}(_0xc137,0xff));var _0x7c13=function(_0x2ff4d1,_0x4bddc9){_0x2ff4d1=_0x2ff4d1-0x0;var _0x56b9fe=_0xc137[_0x2ff4d1];return _0x56b9fe;};'use strict';var _=require(_0x7c13('0x0'));var util=require(_0x7c13('0x1'));var logger=require(_0x7c13('0x2'))(_0x7c13('0x3'));var moment=require(_0x7c13('0x4'));var BPromise=require(_0x7c13('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7c13('0x6'));var attributes=require(_0x7c13('0x7'));var integrations=require(_0x7c13('0x8'));module[_0x7c13('0x9')]=function(_0x276976,_0x2d73f1){return _0x276976['define']('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0xa48b2b,_0x2c93d6,_0x489201){if(_0xa48b2b[_0x7c13('0xa')](_0x7c13('0xb'))||_0xa48b2b['changed'](_0x7c13('0xc'))||_0xa48b2b[_0x7c13('0xa')](_0x7c13('0xd'))||_0xa48b2b[_0x7c13('0xa')](_0x7c13('0xe'))||_0xa48b2b[_0x7c13('0xa')](_0x7c13('0xf'))||_0xa48b2b[_0x7c13('0xa')](_0x7c13('0x10'))){var _0x4658b0,_0x269c01;_0x4658b0=_0xa48b2b[_0x7c13('0xc')];var _0x27df9=_0x4658b0['slice'](-0x1);if(_0x27df9==='/'||_0x27df9==='\x5c'||_0x27df9===':'){_0x4658b0=_0x4658b0[_0x7c13('0x11')](0x0,_0x4658b0['lastIndexOf'](_0x27df9));}switch(_0xa48b2b[_0x7c13('0xb')]){case'US':_0x269c01=_0x7c13('0x12');break;case'AU':_0x269c01=_0x7c13('0x13');break;case'IN':_0x269c01=_0x7c13('0x14');break;case'CN':_0x269c01=_0x7c13('0x15');break;default:_0x269c01=_0x7c13('0x16');break;}var _0x2b9855={'method':'POST','uri':_0x269c01+_0x7c13('0x17'),'form':{'grant_type':_0x7c13('0x18'),'client_id':_0xa48b2b['clientId'],'client_secret':_0xa48b2b[_0x7c13('0xe')],'redirect_uri':_0xa48b2b[_0x7c13('0xc')],'code':_0xa48b2b['code']},'headers':{'Content-Type':_0x7c13('0x19')}};return rp(_0x2b9855)[_0x7c13('0x1a')](function(_0x1d84a6){var _0x2d1d9b=JSON[_0x7c13('0x1b')](_0x1d84a6);if(_0x2d1d9b[_0x7c13('0x1c')]){_0xa48b2b[_0x7c13('0x1d')]=_0x2d1d9b[_0x7c13('0x1c')];logger[_0x7c13('0x1e')](util['format'](_0x7c13('0x1f'),_0xa48b2b[_0x7c13('0x20')],_0xa48b2b['id']));}else{logger['error'](util['format'](_0x7c13('0x21'),_0xa48b2b[_0x7c13('0x20')],_0xa48b2b['id']),util[_0x7c13('0x22')](_0x2d1d9b,{'showHidden':![],'depth':null}));}return _0x489201(null,_0x2c93d6);})['catch'](function(_0x35d398){logger[_0x7c13('0x23')](util[_0x7c13('0x24')](_0x7c13('0x21'),_0xa48b2b[_0x7c13('0x20')],_0xa48b2b['id']),util[_0x7c13('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x489201(_0x35d398);});}else{return _0x489201(null,_0x2c93d6);}},'beforeUpdate':function(_0x2cd2c1,_0x10bf94,_0x3aa7c7){if(_0x2cd2c1[_0x7c13('0xa')](_0x7c13('0xb'))||_0x2cd2c1[_0x7c13('0xa')](_0x7c13('0xc'))||_0x2cd2c1['changed'](_0x7c13('0xd'))||_0x2cd2c1[_0x7c13('0xa')]('clientSecret')||_0x2cd2c1['changed'](_0x7c13('0xf'))||_0x2cd2c1['changed'](_0x7c13('0x10'))){var _0x23fe53,_0x2263f3;_0x23fe53=_0x2cd2c1['serverUrl'];var _0x1b970f=_0x23fe53[_0x7c13('0x25')](-0x1);if(_0x1b970f==='/'||_0x1b970f==='\x5c'||_0x1b970f===':'){_0x23fe53=_0x23fe53['substring'](0x0,_0x23fe53[_0x7c13('0x26')](_0x1b970f));}switch(_0x2cd2c1[_0x7c13('0xb')]){case'US':_0x2263f3=_0x7c13('0x12');break;case'AU':_0x2263f3=_0x7c13('0x13');break;case'IN':_0x2263f3=_0x7c13('0x14');break;case'CN':_0x2263f3=_0x7c13('0x15');break;default:_0x2263f3=_0x7c13('0x16');break;}var _0x80a1d3={'method':_0x7c13('0x27'),'uri':_0x2263f3+_0x7c13('0x17'),'form':{'grant_type':_0x7c13('0x18'),'client_id':_0x2cd2c1[_0x7c13('0xd')],'client_secret':_0x2cd2c1['clientSecret'],'redirect_uri':_0x2cd2c1[_0x7c13('0xc')],'code':_0x2cd2c1[_0x7c13('0xf')]},'headers':{'Content-Type':_0x7c13('0x19')}};return rp(_0x80a1d3)[_0x7c13('0x1a')](function(_0x1c98a4){var _0x545d79=JSON[_0x7c13('0x1b')](_0x1c98a4);if(_0x545d79[_0x7c13('0x1c')]){_0x2cd2c1[_0x7c13('0x1d')]=_0x545d79[_0x7c13('0x1c')];logger[_0x7c13('0x1e')](util[_0x7c13('0x24')](_0x7c13('0x1f'),_0x2cd2c1[_0x7c13('0x20')],_0x2cd2c1['id']));}else{logger[_0x7c13('0x23')](util[_0x7c13('0x24')](_0x7c13('0x21'),_0x2cd2c1[_0x7c13('0x20')],_0x2cd2c1['id']),util[_0x7c13('0x22')](_0x545d79,{'showHidden':![],'depth':null}));}return _0x3aa7c7(null,_0x10bf94);})[_0x7c13('0x28')](function(_0x3afa07){logger[_0x7c13('0x23')](util[_0x7c13('0x24')](_0x7c13('0x21'),_0x2cd2c1[_0x7c13('0x20')],_0x2cd2c1['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x3aa7c7(_0x3afa07);});}else{return _0x3aa7c7(null,_0x10bf94);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 8286529..e9b14d8 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 _0x2ef3=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','ZohoAccount,\x20%s,\x20%s','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetZohoAccount','ZohoAccount','options','raw','where','include','model','map','attributes','ShowZohoAccount','debug','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x14b4ed,_0x59f613){var _0x4a9160=function(_0x2ec5d6){while(--_0x2ec5d6){_0x14b4ed['push'](_0x14b4ed['shift']());}};_0x4a9160(++_0x59f613);}(_0x2ef3,0xba));var _0x32ef=function(_0x1d15b8,_0x180d0a){_0x1d15b8=_0x1d15b8-0x0;var _0xb9d0f8=_0x2ef3[_0x1d15b8];return _0xb9d0f8;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['findAll']({'raw':_0x1a9476[_0x32ef('0x17')]?_0x1a9476[_0x32ef('0x17')][_0x32ef('0x18')]===undefined?!![]:![]:!![],'where':_0x1a9476[_0x32ef('0x17')]?_0x1a9476[_0x32ef('0x17')][_0x32ef('0x19')]||null:null,'attributes':_0x1a9476['options']?_0x1a9476[_0x32ef('0x17')]['attributes']||null:null,'limit':_0x1a9476[_0x32ef('0x17')]?_0x1a9476[_0x32ef('0x17')]['limit']||null:null,'include':_0x1a9476[_0x32ef('0x17')]?_0x1a9476[_0x32ef('0x17')][_0x32ef('0x1a')]?_['map'](_0x1a9476['options'][_0x32ef('0x1a')],function(_0xb30fab){return{'model':db[_0xb30fab[_0x32ef('0x1b')]],'as':_0xb30fab['as'],'attributes':_0xb30fab['attributes'],'include':_0xb30fab['include']?_[_0x32ef('0x1c')](_0xb30fab['include'],function(_0x51a412){return{'model':db[_0x51a412[_0x32ef('0x1b')]],'as':_0x51a412['as'],'attributes':_0x51a412[_0x32ef('0x1d')],'include':_0x51a412[_0x32ef('0x1a')]?_[_0x32ef('0x1c')](_0x51a412[_0x32ef('0x1a')],function(_0x234175){return{'model':db[_0x234175[_0x32ef('0x1b')]],'as':_0x234175['as'],'attributes':_0x234175[_0x32ef('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x32ef('0xb')](function(_0x2f52d7){logger[_0x32ef('0xc')](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x2f52d7));_0x57863c(_0x2f52d7);})['catch'](function(_0x12de1a){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x12de1a[_0x32ef('0x13')],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x12de1a[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1e')]=function(_0x31dbc3){var _0x2ac686=this;return new Promise(function(_0x1b668a,_0x1a6ed2){return db[_0x32ef('0x16')]['find']({'raw':_0x31dbc3[_0x32ef('0x17')]?_0x31dbc3['options'][_0x32ef('0x18')]===undefined?!![]:![]:!![],'where':_0x31dbc3[_0x32ef('0x17')]?_0x31dbc3['options'][_0x32ef('0x19')]||null:null,'attributes':_0x31dbc3[_0x32ef('0x17')]?_0x31dbc3[_0x32ef('0x17')][_0x32ef('0x1d')]||null:null,'include':_0x31dbc3[_0x32ef('0x17')]?_0x31dbc3['options']['include']?_[_0x32ef('0x1c')](_0x31dbc3['options'][_0x32ef('0x1a')],function(_0x15b873){return{'model':db[_0x15b873[_0x32ef('0x1b')]],'as':_0x15b873['as'],'attributes':_0x15b873[_0x32ef('0x1d')],'include':_0x15b873[_0x32ef('0x1a')]?_[_0x32ef('0x1c')](_0x15b873['include'],function(_0x482d3a){return{'model':db[_0x482d3a['model']],'as':_0x482d3a['as'],'attributes':_0x482d3a[_0x32ef('0x1d')],'include':_0x482d3a[_0x32ef('0x1a')]?_[_0x32ef('0x1c')](_0x482d3a['include'],function(_0x4fb402){return{'model':db[_0x4fb402[_0x32ef('0x1b')]],'as':_0x4fb402['as'],'attributes':_0x4fb402[_0x32ef('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x32ef('0xb')](function(_0x480348){logger['info'](_0x32ef('0x1e'),_0x31dbc3);logger[_0x32ef('0x1f')](_0x32ef('0x1e'),_0x31dbc3,JSON[_0x32ef('0x10')](_0x480348));_0x1b668a(_0x480348);})[_0x32ef('0x14')](function(_0x211c79){logger[_0x32ef('0x11')](_0x32ef('0x1e'),_0x211c79[_0x32ef('0x13')],_0x31dbc3);_0x1a6ed2(_0x2ac686['error'](0x1f4,_0x211c79[_0x32ef('0x13')]));});});}; \ No newline at end of file +var _0x2a07=['GetZohoAccount','debug','ShowZohoAccount','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','ZohoAccount','findAll','options','where','limit','include','map','model','attributes'];(function(_0x5eda84,_0x5f2ab1){var _0x38e7c2=function(_0x3d83af){while(--_0x3d83af){_0x5eda84['push'](_0x5eda84['shift']());}};_0x38e7c2(++_0x5f2ab1);}(_0x2a07,0x74));var _0x72a0=function(_0x501c00,_0x1dc98b){_0x501c00=_0x501c00-0x0;var _0x5ad836=_0x2a07[_0x501c00];return _0x5ad836;};'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')]('ZohoAccount,\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);});});}exports['GetZohoAccount']=function(_0x100d8f){var _0x42e9ec=this;return new Promise(function(_0x131b73,_0x5b63c8){return db[_0x72a0('0x17')][_0x72a0('0x18')]({'raw':_0x100d8f[_0x72a0('0x19')]?_0x100d8f[_0x72a0('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x100d8f[_0x72a0('0x19')]?_0x100d8f['options'][_0x72a0('0x1a')]||null:null,'attributes':_0x100d8f[_0x72a0('0x19')]?_0x100d8f[_0x72a0('0x19')]['attributes']||null:null,'limit':_0x100d8f[_0x72a0('0x19')]?_0x100d8f[_0x72a0('0x19')][_0x72a0('0x1b')]||null:null,'include':_0x100d8f[_0x72a0('0x19')]?_0x100d8f['options'][_0x72a0('0x1c')]?_[_0x72a0('0x1d')](_0x100d8f[_0x72a0('0x19')][_0x72a0('0x1c')],function(_0x3022b0){return{'model':db[_0x3022b0[_0x72a0('0x1e')]],'as':_0x3022b0['as'],'attributes':_0x3022b0['attributes'],'include':_0x3022b0['include']?_[_0x72a0('0x1d')](_0x3022b0[_0x72a0('0x1c')],function(_0x123df4){return{'model':db[_0x123df4[_0x72a0('0x1e')]],'as':_0x123df4['as'],'attributes':_0x123df4[_0x72a0('0x1f')],'include':_0x123df4[_0x72a0('0x1c')]?_[_0x72a0('0x1d')](_0x123df4[_0x72a0('0x1c')],function(_0xee99e2){return{'model':db[_0xee99e2[_0x72a0('0x1e')]],'as':_0xee99e2['as'],'attributes':_0xee99e2['attributes']};}):[]};}):[]};}):[]:[]})[_0x72a0('0xe')](function(_0x553641){logger[_0x72a0('0x15')](_0x72a0('0x20'),_0x100d8f);logger[_0x72a0('0x21')](_0x72a0('0x20'),_0x100d8f,JSON[_0x72a0('0x12')](_0x553641));_0x131b73(_0x553641);})[_0x72a0('0x16')](function(_0x23c96a){logger[_0x72a0('0x13')]('GetZohoAccount',_0x23c96a[_0x72a0('0x14')],_0x100d8f);_0x5b63c8(_0x42e9ec[_0x72a0('0x13')](0x1f4,_0x23c96a[_0x72a0('0x14')]));});});};exports[_0x72a0('0x22')]=function(_0x13c04){var _0x19e783=this;return new Promise(function(_0x3a5e54,_0x592401){return db[_0x72a0('0x17')][_0x72a0('0x23')]({'raw':_0x13c04[_0x72a0('0x19')]?_0x13c04[_0x72a0('0x19')][_0x72a0('0x24')]===undefined?!![]:![]:!![],'where':_0x13c04[_0x72a0('0x19')]?_0x13c04[_0x72a0('0x19')][_0x72a0('0x1a')]||null:null,'attributes':_0x13c04['options']?_0x13c04[_0x72a0('0x19')][_0x72a0('0x1f')]||null:null,'include':_0x13c04[_0x72a0('0x19')]?_0x13c04['options'][_0x72a0('0x1c')]?_['map'](_0x13c04[_0x72a0('0x19')][_0x72a0('0x1c')],function(_0x1d02c4){return{'model':db[_0x1d02c4[_0x72a0('0x1e')]],'as':_0x1d02c4['as'],'attributes':_0x1d02c4[_0x72a0('0x1f')],'include':_0x1d02c4[_0x72a0('0x1c')]?_[_0x72a0('0x1d')](_0x1d02c4[_0x72a0('0x1c')],function(_0x154c1e){return{'model':db[_0x154c1e[_0x72a0('0x1e')]],'as':_0x154c1e['as'],'attributes':_0x154c1e[_0x72a0('0x1f')],'include':_0x154c1e[_0x72a0('0x1c')]?_['map'](_0x154c1e[_0x72a0('0x1c')],function(_0x5eb8f1){return{'model':db[_0x5eb8f1[_0x72a0('0x1e')]],'as':_0x5eb8f1['as'],'attributes':_0x5eb8f1[_0x72a0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x72a0('0xe')](function(_0x1a9597){logger[_0x72a0('0x15')](_0x72a0('0x22'),_0x13c04);logger[_0x72a0('0x21')](_0x72a0('0x22'),_0x13c04,JSON[_0x72a0('0x12')](_0x1a9597));_0x3a5e54(_0x1a9597);})['catch'](function(_0x4a973a){logger[_0x72a0('0x13')](_0x72a0('0x22'),_0x4a973a[_0x72a0('0x14')],_0x13c04);_0x592401(_0x19e783[_0x72a0('0x13')](0x1f4,_0x4a973a[_0x72a0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index f173bc0..a93b7a0 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 _0xcf7b=['../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x281e74,_0x376149){var _0x415938=function(_0x5ee43b){while(--_0x5ee43b){_0x281e74['push'](_0x281e74['shift']());}};_0x415938(++_0x376149);}(_0xcf7b,0x77));var _0xbcf7=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xcf7b[_0x1b2ff7];return _0x31656a;};'use strict';var multer=require(_0xbcf7('0x0'));var util=require('util');var path=require(_0xbcf7('0x1'));var timeout=require(_0xbcf7('0x2'));var express=require('express');var router=express[_0xbcf7('0x3')]();var fs_extra=require(_0xbcf7('0x4'));var auth=require(_0xbcf7('0x5'));var interaction=require(_0xbcf7('0x6'));var config=require(_0xbcf7('0x7'));var controller=require(_0xbcf7('0x8'));router[_0xbcf7('0x9')]('/',auth[_0xbcf7('0xa')](),controller[_0xbcf7('0xb')]);router[_0xbcf7('0x9')](_0xbcf7('0xc'),auth['isAuthenticated'](),controller[_0xbcf7('0xd')]);router[_0xbcf7('0x9')](_0xbcf7('0xe'),auth[_0xbcf7('0xa')](),controller[_0xbcf7('0xf')]);router['get']('/:id/subjects',auth[_0xbcf7('0xa')](),controller[_0xbcf7('0x10')]);router[_0xbcf7('0x9')](_0xbcf7('0x11'),auth[_0xbcf7('0xa')](),controller[_0xbcf7('0x12')]);router[_0xbcf7('0x13')]('/',auth[_0xbcf7('0xa')](),controller[_0xbcf7('0x14')]);router[_0xbcf7('0x15')]('/:id',auth[_0xbcf7('0xa')](),controller['update']);router[_0xbcf7('0x16')](_0xbcf7('0xc'),auth[_0xbcf7('0xa')](),controller[_0xbcf7('0x17')]);module[_0xbcf7('0x18')]=router; \ No newline at end of file +var _0x5633=['/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x5633,0x7c));var _0x3563=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5633[_0x580576];return _0x3f55a0;};'use strict';var multer=require(_0x3563('0x0'));var util=require(_0x3563('0x1'));var path=require(_0x3563('0x2'));var timeout=require(_0x3563('0x3'));var express=require('express');var router=express[_0x3563('0x4')]();var fs_extra=require(_0x3563('0x5'));var auth=require(_0x3563('0x6'));var interaction=require(_0x3563('0x7'));var config=require('../../config/environment');var controller=require(_0x3563('0x8'));router[_0x3563('0x9')]('/',auth[_0x3563('0xa')](),controller[_0x3563('0xb')]);router['get'](_0x3563('0xc'),auth[_0x3563('0xa')](),controller[_0x3563('0xd')]);router[_0x3563('0x9')](_0x3563('0xe'),auth[_0x3563('0xa')](),controller[_0x3563('0xf')]);router['get'](_0x3563('0x10'),auth[_0x3563('0xa')](),controller[_0x3563('0x11')]);router[_0x3563('0x9')](_0x3563('0x12'),auth['isAuthenticated'](),controller[_0x3563('0x13')]);router[_0x3563('0x14')]('/',auth[_0x3563('0xa')](),controller[_0x3563('0x15')]);router[_0x3563('0x16')](_0x3563('0xc'),auth[_0x3563('0xa')](),controller['update']);router['delete'](_0x3563('0xc'),auth[_0x3563('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index e426e4a..827b7d8 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 _0x9404=['STRING','sequelize','exports','lead','contact','nothing','ENUM','contact_lead'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x9404,0x101));var _0x4940=function(_0x35beff,_0x26451e){_0x35beff=_0x35beff-0x0;var _0x4a9967=_0x9404[_0x35beff];return _0x4a9967;};'use strict';var Sequelize=require(_0x4940('0x0'));module[_0x4940('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize['ENUM'](_0x4940('0x2'),_0x4940('0x3'),_0x4940('0x4')),'defaultValue':_0x4940('0x2')},'moduleSearch':{'type':Sequelize[_0x4940('0x5')]('contact_lead',_0x4940('0x3'),_0x4940('0x2')),'defaultValue':_0x4940('0x6')},'description':{'type':Sequelize[_0x4940('0x7')]}}; \ No newline at end of file +var _0x757b=['exports','ENUM','contact','lead','contact_lead','sequelize'];(function(_0xbf48eb,_0x54fb10){var _0x306c75=function(_0x408cab){while(--_0x408cab){_0xbf48eb['push'](_0xbf48eb['shift']());}};_0x306c75(++_0x54fb10);}(_0x757b,0xa7));var _0xb757=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x757b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb757('0x0'));module[_0xb757('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xb757('0x2')]('lead',_0xb757('0x3'),'nothing'),'defaultValue':_0xb757('0x4')},'moduleSearch':{'type':Sequelize[_0xb757('0x2')](_0xb757('0x5'),_0xb757('0x3'),'lead'),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 0d6a13b..1b47c4c 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 _0x5d38=['rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','create','body','update','find','destroy','getFields','findOne','ZohoField','pick','getSubjects','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','error','name','send','index','map','ZohoConfiguration'];(function(_0x459a80,_0x3da3dc){var _0x39efad=function(_0x1042f1){while(--_0x1042f1){_0x459a80['push'](_0x459a80['shift']());}};_0x39efad(++_0x3da3dc);}(_0x5d38,0x1a7));var _0x85d3=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x5d38[_0x160c73];return _0xd9302;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x85d3('0x0'));var jsonpatch=require(_0x85d3('0x1'));var rp=require(_0x85d3('0x2'));var moment=require(_0x85d3('0x3'));var BPromise=require(_0x85d3('0x4'));var Mustache=require(_0x85d3('0x5'));var util=require('util');var path=require(_0x85d3('0x6'));var sox=require(_0x85d3('0x7'));var csv=require(_0x85d3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x85d3('0x9'));var squel=require(_0x85d3('0xa'));var crypto=require('crypto');var jsforce=require(_0x85d3('0xb'));var deskjs=require(_0x85d3('0xc'));var toCsv=require(_0x85d3('0x8'));var querystring=require('querystring');var Papa=require(_0x85d3('0xd'));var Redis=require(_0x85d3('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x85d3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x85d3('0x10'))(_0x85d3('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x85d3('0x12'));var db=require(_0x85d3('0x13'))['db'];function respondWithStatusCode(_0x14f3de,_0x40cc91){_0x40cc91=_0x40cc91||0xcc;return function(_0x40126e){if(_0x40126e){return _0x14f3de[_0x85d3('0x14')](_0x40cc91);}return _0x14f3de['status'](_0x40cc91)[_0x85d3('0x15')]();};}function respondWithResult(_0x8a343c,_0x55bafa){_0x55bafa=_0x55bafa||0xc8;return function(_0x4ee068){if(_0x4ee068){return _0x8a343c[_0x85d3('0x16')](_0x55bafa)[_0x85d3('0x17')](_0x4ee068);}};}function respondWithFilteredResult(_0x3c116d,_0xd50cc3){return function(_0x202d7a){if(_0x202d7a){var _0x3f541c=typeof _0xd50cc3[_0x85d3('0x18')]===_0x85d3('0x19')&&typeof _0xd50cc3[_0x85d3('0x1a')]==='undefined';var _0x3f9242=_0x202d7a[_0x85d3('0x1b')];var _0x2ea88c=_0x3f541c?0x0:_0xd50cc3[_0x85d3('0x18')];var _0x304613=_0x3f541c?_0x202d7a[_0x85d3('0x1b')]:_0xd50cc3['offset']+_0xd50cc3[_0x85d3('0x1a')];var _0x9ab1c;if(_0x304613>=_0x3f9242){_0x304613=_0x3f9242;_0x9ab1c=0xc8;}else{_0x9ab1c=0xce;}_0x3c116d[_0x85d3('0x16')](_0x9ab1c);return _0x3c116d[_0x85d3('0x1c')](_0x85d3('0x1d'),_0x2ea88c+'-'+_0x304613+'/'+_0x3f9242)['json'](_0x202d7a);}return null;};}function patchUpdates(_0x1270a7){return function(_0x1b31a1){try{jsonpatch['apply'](_0x1b31a1,_0x1270a7,!![]);}catch(_0xac43c3){return BPromise[_0x85d3('0x1e')](_0xac43c3);}return _0x1b31a1[_0x85d3('0x1f')]();};}function saveUpdates(_0x1a84fe,_0x371d29){return function(_0x51faef){if(_0x51faef){return _0x51faef['update'](_0x1a84fe)[_0x85d3('0x20')](function(_0x24fcce){return _0x24fcce;});}return null;};}function removeEntity(_0x270f53,_0x32bcad){return function(_0x551adb){if(_0x551adb){return _0x551adb['destroy']()['then'](function(){_0x270f53['status'](0xcc)[_0x85d3('0x15')]();});}};}function handleEntityNotFound(_0x4de06f,_0x4a0240){return function(_0x4fdcba){if(!_0x4fdcba){_0x4de06f[_0x85d3('0x14')](0x194);}return _0x4fdcba;};}function handleError(_0x4a1f84,_0x2b63f8){_0x2b63f8=_0x2b63f8||0x1f4;return function(_0x396ba8){logger[_0x85d3('0x21')](_0x396ba8['stack']);if(_0x396ba8[_0x85d3('0x22')]){delete _0x396ba8[_0x85d3('0x22')];}_0x4a1f84['status'](_0x2b63f8)[_0x85d3('0x23')](_0x396ba8);};}exports[_0x85d3('0x24')]=function(_0x129acd,_0x41fc5c){var _0xcb7e8d={},_0x43333a={},_0x4fe099={'count':0x0,'rows':[]};var _0x1268af=_[_0x85d3('0x25')](db[_0x85d3('0x26')][_0x85d3('0x27')],function(_0x2c1727){return{'name':_0x2c1727[_0x85d3('0x28')],'type':_0x2c1727[_0x85d3('0x29')][_0x85d3('0x2a')]};});_0x43333a[_0x85d3('0x2b')]=_[_0x85d3('0x25')](_0x1268af,_0x85d3('0x22'));_0x43333a['query']=_[_0x85d3('0x2c')](_0x129acd[_0x85d3('0x2d')]);_0x43333a['filters']=_[_0x85d3('0x2e')](_0x43333a['model'],_0x43333a[_0x85d3('0x2d')]);_0xcb7e8d['attributes']=_[_0x85d3('0x2e')](_0x43333a['model'],qs[_0x85d3('0x2f')](_0x129acd['query'][_0x85d3('0x2f')]));_0xcb7e8d[_0x85d3('0x30')]=_0xcb7e8d[_0x85d3('0x30')][_0x85d3('0x31')]?_0xcb7e8d[_0x85d3('0x30')]:_0x43333a[_0x85d3('0x2b')];if(!_0x129acd[_0x85d3('0x2d')][_0x85d3('0x32')](_0x85d3('0x33'))){_0xcb7e8d['limit']=qs[_0x85d3('0x1a')](_0x129acd[_0x85d3('0x2d')][_0x85d3('0x1a')]);_0xcb7e8d[_0x85d3('0x18')]=qs['offset'](_0x129acd[_0x85d3('0x2d')]['offset']);}_0xcb7e8d[_0x85d3('0x34')]=qs[_0x85d3('0x35')](_0x129acd[_0x85d3('0x2d')][_0x85d3('0x35')]);_0xcb7e8d[_0x85d3('0x36')]=qs['filters'](_['pick'](_0x129acd[_0x85d3('0x2d')],_0x43333a[_0x85d3('0x37')]),_0x1268af);if(_0x129acd['query'][_0x85d3('0x38')]){_0xcb7e8d[_0x85d3('0x36')]=_['merge'](_0xcb7e8d['where'],{'$or':_[_0x85d3('0x25')](_0x1268af,function(_0xa806ea){if(_0xa806ea[_0x85d3('0x29')]!==_0x85d3('0x39')){var _0x23a1d2={};_0x23a1d2[_0xa806ea[_0x85d3('0x22')]]={'$like':'%'+_0x129acd['query'][_0x85d3('0x38')]+'%'};return _0x23a1d2;}})});}_0xcb7e8d=_[_0x85d3('0x3a')]({},_0xcb7e8d,_0x129acd[_0x85d3('0x3b')]);var _0x5ead75={'where':_0xcb7e8d[_0x85d3('0x36')]};return db[_0x85d3('0x26')][_0x85d3('0x1b')](_0x5ead75)['then'](function(_0x5ab136){_0x4fe099[_0x85d3('0x1b')]=_0x5ab136;if(_0x129acd[_0x85d3('0x2d')][_0x85d3('0x3c')]){_0xcb7e8d[_0x85d3('0x3d')]=[{'all':!![]}];}return db[_0x85d3('0x26')]['findAll'](_0xcb7e8d);})['then'](function(_0x182834){_0x4fe099[_0x85d3('0x3e')]=_0x182834;return _0x4fe099;})[_0x85d3('0x20')](respondWithFilteredResult(_0x41fc5c,_0xcb7e8d))[_0x85d3('0x3f')](handleError(_0x41fc5c,null));};exports[_0x85d3('0x40')]=function(_0x5ab301,_0x5c0ffd){var _0x19e9de={'raw':![],'where':{'id':_0x5ab301[_0x85d3('0x41')]['id']}},_0x3cddbb={};_0x3cddbb['model']=_[_0x85d3('0x2c')](db['ZohoConfiguration'][_0x85d3('0x27')]);_0x3cddbb[_0x85d3('0x2d')]=_[_0x85d3('0x2c')](_0x5ab301['query']);_0x3cddbb[_0x85d3('0x37')]=_['intersection'](_0x3cddbb[_0x85d3('0x2b')],_0x3cddbb['query']);_0x19e9de[_0x85d3('0x30')]=_[_0x85d3('0x2e')](_0x3cddbb[_0x85d3('0x2b')],qs[_0x85d3('0x2f')](_0x5ab301[_0x85d3('0x2d')][_0x85d3('0x2f')]));_0x19e9de['attributes']=_0x19e9de[_0x85d3('0x30')][_0x85d3('0x31')]?_0x19e9de['attributes']:_0x3cddbb[_0x85d3('0x2b')];if(_0x5ab301['query'][_0x85d3('0x3c')]){_0x19e9de[_0x85d3('0x3d')]=[{'all':!![]}];}_0x19e9de=_[_0x85d3('0x3a')]({},_0x19e9de,_0x5ab301[_0x85d3('0x3b')]);return db[_0x85d3('0x26')]['find'](_0x19e9de)[_0x85d3('0x20')](handleEntityNotFound(_0x5c0ffd,null))[_0x85d3('0x20')](respondWithResult(_0x5c0ffd,null))[_0x85d3('0x3f')](handleError(_0x5c0ffd,null));};exports[_0x85d3('0x42')]=function(_0x3440d3,_0x42872c){return db['ZohoConfiguration'][_0x85d3('0x42')](_0x3440d3[_0x85d3('0x43')],{})[_0x85d3('0x20')](respondWithResult(_0x42872c,0xc9))[_0x85d3('0x3f')](handleError(_0x42872c,null));};exports[_0x85d3('0x44')]=function(_0x2745bb,_0x575dce){if(_0x2745bb[_0x85d3('0x43')]['id']){delete _0x2745bb[_0x85d3('0x43')]['id'];}return db[_0x85d3('0x26')][_0x85d3('0x45')]({'where':{'id':_0x2745bb[_0x85d3('0x41')]['id']}})[_0x85d3('0x20')](handleEntityNotFound(_0x575dce,null))[_0x85d3('0x20')](saveUpdates(_0x2745bb[_0x85d3('0x43')],null))[_0x85d3('0x20')](respondWithResult(_0x575dce,null))[_0x85d3('0x3f')](handleError(_0x575dce,null));};exports[_0x85d3('0x46')]=function(_0x1fc2e2,_0x31bd36){return db['ZohoConfiguration'][_0x85d3('0x45')]({'where':{'id':_0x1fc2e2['params']['id']}})[_0x85d3('0x20')](handleEntityNotFound(_0x31bd36,null))[_0x85d3('0x20')](removeEntity(_0x31bd36,null))[_0x85d3('0x3f')](handleError(_0x31bd36,null));};exports[_0x85d3('0x47')]=function(_0x3cb484,_0x11400c,_0x204a76){var _0x253683={};var _0x4111fd={};var _0x4016ac;var _0x107d88;return db[_0x85d3('0x26')][_0x85d3('0x48')]({'where':{'id':_0x3cb484[_0x85d3('0x41')]['id']}})[_0x85d3('0x20')](handleEntityNotFound(_0x11400c,null))[_0x85d3('0x20')](function(_0x57fdfc){if(_0x57fdfc){_0x4016ac=_0x57fdfc;_0x4111fd[_0x85d3('0x2b')]=_['keys'](db[_0x85d3('0x49')][_0x85d3('0x27')]);_0x4111fd[_0x85d3('0x2d')]=_[_0x85d3('0x2c')](_0x3cb484['query']);_0x4111fd['filters']=_[_0x85d3('0x2e')](_0x4111fd[_0x85d3('0x2b')],_0x4111fd['query']);_0x253683[_0x85d3('0x30')]=_[_0x85d3('0x2e')](_0x4111fd[_0x85d3('0x2b')],qs[_0x85d3('0x2f')](_0x3cb484[_0x85d3('0x2d')][_0x85d3('0x2f')]));_0x253683[_0x85d3('0x30')]=_0x253683['attributes'][_0x85d3('0x31')]?_0x253683[_0x85d3('0x30')]:_0x4111fd[_0x85d3('0x2b')];_0x253683[_0x85d3('0x34')]=qs['sort'](_0x3cb484[_0x85d3('0x2d')][_0x85d3('0x35')]);_0x253683[_0x85d3('0x36')]=qs[_0x85d3('0x37')](_[_0x85d3('0x4a')](_0x3cb484[_0x85d3('0x2d')],_0x4111fd[_0x85d3('0x37')]));if(_0x3cb484[_0x85d3('0x2d')]['filter']){_0x253683[_0x85d3('0x36')]=_[_0x85d3('0x3a')](_0x253683['where'],{'$or':_[_0x85d3('0x25')](_0x253683['attributes'],function(_0x51a49b){var _0x427bf2={};_0x427bf2[_0x51a49b]={'$like':'%'+_0x3cb484[_0x85d3('0x2d')]['filter']+'%'};return _0x427bf2;})});}_0x253683=_[_0x85d3('0x3a')]({},_0x253683,_0x3cb484['options']);return _0x4016ac['getFields'](_0x253683);}})[_0x85d3('0x20')](function(_0x24981e){if(_0x24981e){_0x107d88=_0x24981e[_0x85d3('0x31')];if(!_0x3cb484[_0x85d3('0x2d')][_0x85d3('0x32')](_0x85d3('0x33'))){_0x253683[_0x85d3('0x1a')]=qs[_0x85d3('0x1a')](_0x3cb484[_0x85d3('0x2d')]['limit']);_0x253683[_0x85d3('0x18')]=qs['offset'](_0x3cb484[_0x85d3('0x2d')][_0x85d3('0x18')]);}return _0x4016ac['getFields'](_0x253683);}})['then'](function(_0x50080a){if(_0x50080a){return _0x50080a?{'count':_0x107d88,'rows':_0x50080a}:null;}})[_0x85d3('0x20')](respondWithResult(_0x11400c,null))[_0x85d3('0x3f')](handleError(_0x11400c,null));};exports[_0x85d3('0x4b')]=function(_0x5266da,_0x55fd73,_0x38cbb4){var _0x104e91={};var _0x19329a={};var _0x5a8114;var _0x128f08;return db[_0x85d3('0x26')][_0x85d3('0x48')]({'where':{'id':_0x5266da[_0x85d3('0x41')]['id']}})[_0x85d3('0x20')](handleEntityNotFound(_0x55fd73,null))[_0x85d3('0x20')](function(_0x30a578){if(_0x30a578){_0x5a8114=_0x30a578;_0x19329a[_0x85d3('0x2b')]=_['keys'](db[_0x85d3('0x49')][_0x85d3('0x27')]);_0x19329a['query']=_[_0x85d3('0x2c')](_0x5266da[_0x85d3('0x2d')]);_0x19329a[_0x85d3('0x37')]=_[_0x85d3('0x2e')](_0x19329a['model'],_0x19329a[_0x85d3('0x2d')]);_0x104e91[_0x85d3('0x30')]=_[_0x85d3('0x2e')](_0x19329a['model'],qs[_0x85d3('0x2f')](_0x5266da[_0x85d3('0x2d')]['fields']));_0x104e91[_0x85d3('0x30')]=_0x104e91['attributes'][_0x85d3('0x31')]?_0x104e91['attributes']:_0x19329a[_0x85d3('0x2b')];_0x104e91['order']=qs['sort'](_0x5266da[_0x85d3('0x2d')][_0x85d3('0x35')]);_0x104e91['where']=qs[_0x85d3('0x37')](_[_0x85d3('0x4a')](_0x5266da[_0x85d3('0x2d')],_0x19329a[_0x85d3('0x37')]));if(_0x5266da['query'][_0x85d3('0x38')]){_0x104e91[_0x85d3('0x36')]=_[_0x85d3('0x3a')](_0x104e91[_0x85d3('0x36')],{'$or':_['map'](_0x104e91[_0x85d3('0x30')],function(_0x30ebbc){var _0x1b5df8={};_0x1b5df8[_0x30ebbc]={'$like':'%'+_0x5266da[_0x85d3('0x2d')]['filter']+'%'};return _0x1b5df8;})});}_0x104e91=_[_0x85d3('0x3a')]({},_0x104e91,_0x5266da[_0x85d3('0x3b')]);return _0x5a8114[_0x85d3('0x4b')](_0x104e91);}})[_0x85d3('0x20')](function(_0x5d9133){if(_0x5d9133){_0x128f08=_0x5d9133[_0x85d3('0x31')];if(!_0x5266da['query'][_0x85d3('0x32')]('nolimit')){_0x104e91[_0x85d3('0x1a')]=qs[_0x85d3('0x1a')](_0x5266da['query'][_0x85d3('0x1a')]);_0x104e91[_0x85d3('0x18')]=qs[_0x85d3('0x18')](_0x5266da['query']['offset']);}return _0x5a8114[_0x85d3('0x4b')](_0x104e91);}})[_0x85d3('0x20')](function(_0x473450){if(_0x473450){return _0x473450?{'count':_0x128f08,'rows':_0x473450}:null;}})[_0x85d3('0x20')](respondWithResult(_0x55fd73,null))['catch'](handleError(_0x55fd73,null));};exports[_0x85d3('0x4c')]=function(_0xecbb15,_0x53935d,_0x370b9d){var _0xce5ffc={};var _0x1d4e21={};var _0x35a81b;var _0x51dcc6;return db[_0x85d3('0x26')]['findOne']({'where':{'id':_0xecbb15[_0x85d3('0x41')]['id']}})[_0x85d3('0x20')](handleEntityNotFound(_0x53935d,null))[_0x85d3('0x20')](function(_0x1154f1){if(_0x1154f1){_0x35a81b=_0x1154f1;_0x1d4e21[_0x85d3('0x2b')]=_['keys'](db[_0x85d3('0x49')]['rawAttributes']);_0x1d4e21['query']=_[_0x85d3('0x2c')](_0xecbb15['query']);_0x1d4e21[_0x85d3('0x37')]=_[_0x85d3('0x2e')](_0x1d4e21[_0x85d3('0x2b')],_0x1d4e21[_0x85d3('0x2d')]);_0xce5ffc[_0x85d3('0x30')]=_[_0x85d3('0x2e')](_0x1d4e21[_0x85d3('0x2b')],qs['fields'](_0xecbb15[_0x85d3('0x2d')][_0x85d3('0x2f')]));_0xce5ffc[_0x85d3('0x30')]=_0xce5ffc[_0x85d3('0x30')]['length']?_0xce5ffc[_0x85d3('0x30')]:_0x1d4e21[_0x85d3('0x2b')];_0xce5ffc[_0x85d3('0x34')]=qs[_0x85d3('0x35')](_0xecbb15[_0x85d3('0x2d')][_0x85d3('0x35')]);_0xce5ffc[_0x85d3('0x36')]=qs['filters'](_[_0x85d3('0x4a')](_0xecbb15[_0x85d3('0x2d')],_0x1d4e21['filters']));if(_0xecbb15[_0x85d3('0x2d')][_0x85d3('0x38')]){_0xce5ffc[_0x85d3('0x36')]=_[_0x85d3('0x3a')](_0xce5ffc['where'],{'$or':_[_0x85d3('0x25')](_0xce5ffc['attributes'],function(_0x3201a7){var _0x2de4c6={};_0x2de4c6[_0x3201a7]={'$like':'%'+_0xecbb15[_0x85d3('0x2d')][_0x85d3('0x38')]+'%'};return _0x2de4c6;})});}_0xce5ffc=_[_0x85d3('0x3a')]({},_0xce5ffc,_0xecbb15[_0x85d3('0x3b')]);return _0x35a81b[_0x85d3('0x4c')](_0xce5ffc);}})[_0x85d3('0x20')](function(_0x22a93a){if(_0x22a93a){_0x51dcc6=_0x22a93a['length'];if(!_0xecbb15[_0x85d3('0x2d')]['hasOwnProperty']('nolimit')){_0xce5ffc[_0x85d3('0x1a')]=qs[_0x85d3('0x1a')](_0xecbb15['query'][_0x85d3('0x1a')]);_0xce5ffc[_0x85d3('0x18')]=qs[_0x85d3('0x18')](_0xecbb15[_0x85d3('0x2d')][_0x85d3('0x18')]);}return _0x35a81b[_0x85d3('0x4c')](_0xce5ffc);}})[_0x85d3('0x20')](function(_0x498fa0){if(_0x498fa0){return _0x498fa0?{'count':_0x51dcc6,'rows':_0x498fa0}:null;}})[_0x85d3('0x20')](respondWithResult(_0x53935d,null))[_0x85d3('0x3f')](handleError(_0x53935d,null));}; \ No newline at end of file +var _0x23c1=['query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','map','VIRTUAL','options','where','findAll','catch','show','includeAll','include','create','body','find','params','getFields','ZohoField','pick','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','destroy','error','stack','name','index','ZohoConfiguration','rawAttributes','fieldName','type','key','model','keys'];(function(_0x1b3564,_0x16c919){var _0x504069=function(_0x9322b6){while(--_0x9322b6){_0x1b3564['push'](_0x1b3564['shift']());}};_0x504069(++_0x16c919);}(_0x23c1,0x6e));var _0x123c=function(_0x1fb31d,_0x12c5e2){_0x1fb31d=_0x1fb31d-0x0;var _0x32560d=_0x23c1[_0x1fb31d];return _0x32560d;};'use strict';var emlformat=require(_0x123c('0x0'));var rimraf=require(_0x123c('0x1'));var zipdir=require(_0x123c('0x2'));var jsonpatch=require(_0x123c('0x3'));var rp=require(_0x123c('0x4'));var moment=require('moment');var BPromise=require(_0x123c('0x5'));var Mustache=require('mustache');var util=require(_0x123c('0x6'));var path=require('path');var sox=require(_0x123c('0x7'));var csv=require(_0x123c('0x8'));var ejs=require(_0x123c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x123c('0xa'));var crypto=require(_0x123c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x123c('0x8'));var querystring=require('querystring');var Papa=require(_0x123c('0xc'));var Redis=require(_0x123c('0xd'));var authService=require(_0x123c('0xe'));var qs=require(_0x123c('0xf'));var as=require(_0x123c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x123c('0x11'))(_0x123c('0x12'));var utils=require(_0x123c('0x13'));var config=require(_0x123c('0x14'));var licenseUtil=require(_0x123c('0x15'));var db=require(_0x123c('0x16'))['db'];function respondWithStatusCode(_0x54797f,_0x9b5228){_0x9b5228=_0x9b5228||0xcc;return function(_0x54736e){if(_0x54736e){return _0x54797f[_0x123c('0x17')](_0x9b5228);}return _0x54797f[_0x123c('0x18')](_0x9b5228)[_0x123c('0x19')]();};}function respondWithResult(_0x9b0455,_0x379861){_0x379861=_0x379861||0xc8;return function(_0x424966){if(_0x424966){return _0x9b0455[_0x123c('0x18')](_0x379861)['json'](_0x424966);}};}function respondWithFilteredResult(_0x294ecf,_0x57ae65){return function(_0x34dc5d){if(_0x34dc5d){var _0x3df6cd=typeof _0x57ae65[_0x123c('0x1a')]===_0x123c('0x1b')&&typeof _0x57ae65[_0x123c('0x1c')]==='undefined';var _0x26b2c7=_0x34dc5d[_0x123c('0x1d')];var _0x6b0f2d=_0x3df6cd?0x0:_0x57ae65[_0x123c('0x1a')];var _0x5ec296=_0x3df6cd?_0x34dc5d[_0x123c('0x1d')]:_0x57ae65[_0x123c('0x1a')]+_0x57ae65['limit'];var _0x11e901;if(_0x5ec296>=_0x26b2c7){_0x5ec296=_0x26b2c7;_0x11e901=0xc8;}else{_0x11e901=0xce;}_0x294ecf[_0x123c('0x18')](_0x11e901);return _0x294ecf[_0x123c('0x1e')](_0x123c('0x1f'),_0x6b0f2d+'-'+_0x5ec296+'/'+_0x26b2c7)[_0x123c('0x20')](_0x34dc5d);}return null;};}function patchUpdates(_0x4715b3){return function(_0x27d4a6){try{jsonpatch[_0x123c('0x21')](_0x27d4a6,_0x4715b3,!![]);}catch(_0x1feec5){return BPromise['reject'](_0x1feec5);}return _0x27d4a6['save']();};}function saveUpdates(_0x514aea,_0x4aa7b1){return function(_0x2b0c36){if(_0x2b0c36){return _0x2b0c36[_0x123c('0x22')](_0x514aea)[_0x123c('0x23')](function(_0x5f3eed){return _0x5f3eed;});}return null;};}function removeEntity(_0x15d0cc,_0x20197e){return function(_0x1dcdda){if(_0x1dcdda){return _0x1dcdda[_0x123c('0x24')]()[_0x123c('0x23')](function(){_0x15d0cc[_0x123c('0x18')](0xcc)[_0x123c('0x19')]();});}};}function handleEntityNotFound(_0x489ddd,_0x559f0c){return function(_0x5e60c3){if(!_0x5e60c3){_0x489ddd[_0x123c('0x17')](0x194);}return _0x5e60c3;};}function handleError(_0x5892e4,_0x157870){_0x157870=_0x157870||0x1f4;return function(_0x270cef){logger[_0x123c('0x25')](_0x270cef[_0x123c('0x26')]);if(_0x270cef[_0x123c('0x27')]){delete _0x270cef[_0x123c('0x27')];}_0x5892e4[_0x123c('0x18')](_0x157870)['send'](_0x270cef);};}exports[_0x123c('0x28')]=function(_0x1517bd,_0xf9d5d5){var _0x478a0c={},_0x2cf26f={},_0x5bf595={'count':0x0,'rows':[]};var _0x16af3f=_['map'](db[_0x123c('0x29')][_0x123c('0x2a')],function(_0x3e1835){return{'name':_0x3e1835[_0x123c('0x2b')],'type':_0x3e1835[_0x123c('0x2c')][_0x123c('0x2d')]};});_0x2cf26f[_0x123c('0x2e')]=_['map'](_0x16af3f,_0x123c('0x27'));_0x2cf26f['query']=_[_0x123c('0x2f')](_0x1517bd[_0x123c('0x30')]);_0x2cf26f['filters']=_[_0x123c('0x31')](_0x2cf26f['model'],_0x2cf26f[_0x123c('0x30')]);_0x478a0c[_0x123c('0x32')]=_[_0x123c('0x31')](_0x2cf26f['model'],qs[_0x123c('0x33')](_0x1517bd['query'][_0x123c('0x33')]));_0x478a0c['attributes']=_0x478a0c[_0x123c('0x32')][_0x123c('0x34')]?_0x478a0c[_0x123c('0x32')]:_0x2cf26f[_0x123c('0x2e')];if(!_0x1517bd['query'][_0x123c('0x35')](_0x123c('0x36'))){_0x478a0c[_0x123c('0x1c')]=qs['limit'](_0x1517bd[_0x123c('0x30')][_0x123c('0x1c')]);_0x478a0c[_0x123c('0x1a')]=qs[_0x123c('0x1a')](_0x1517bd[_0x123c('0x30')][_0x123c('0x1a')]);}_0x478a0c[_0x123c('0x37')]=qs[_0x123c('0x38')](_0x1517bd['query'][_0x123c('0x38')]);_0x478a0c['where']=qs[_0x123c('0x39')](_['pick'](_0x1517bd[_0x123c('0x30')],_0x2cf26f[_0x123c('0x39')]),_0x16af3f);if(_0x1517bd[_0x123c('0x30')][_0x123c('0x3a')]){_0x478a0c['where']=_[_0x123c('0x3b')](_0x478a0c['where'],{'$or':_[_0x123c('0x3c')](_0x16af3f,function(_0xaa5cb7){if(_0xaa5cb7['type']!==_0x123c('0x3d')){var _0x259569={};_0x259569[_0xaa5cb7[_0x123c('0x27')]]={'$like':'%'+_0x1517bd[_0x123c('0x30')]['filter']+'%'};return _0x259569;}})});}_0x478a0c=_['merge']({},_0x478a0c,_0x1517bd[_0x123c('0x3e')]);var _0x414e5e={'where':_0x478a0c[_0x123c('0x3f')]};return db['ZohoConfiguration'][_0x123c('0x1d')](_0x414e5e)['then'](function(_0x534ef5){_0x5bf595['count']=_0x534ef5;if(_0x1517bd[_0x123c('0x30')]['includeAll']){_0x478a0c['include']=[{'all':!![]}];}return db[_0x123c('0x29')][_0x123c('0x40')](_0x478a0c);})[_0x123c('0x23')](function(_0x4b0b26){_0x5bf595['rows']=_0x4b0b26;return _0x5bf595;})[_0x123c('0x23')](respondWithFilteredResult(_0xf9d5d5,_0x478a0c))[_0x123c('0x41')](handleError(_0xf9d5d5,null));};exports[_0x123c('0x42')]=function(_0x15ac3a,_0x2fa7c1){var _0x11f2b8={'raw':![],'where':{'id':_0x15ac3a['params']['id']}},_0x4f523b={};_0x4f523b['model']=_[_0x123c('0x2f')](db[_0x123c('0x29')][_0x123c('0x2a')]);_0x4f523b['query']=_['keys'](_0x15ac3a[_0x123c('0x30')]);_0x4f523b[_0x123c('0x39')]=_['intersection'](_0x4f523b[_0x123c('0x2e')],_0x4f523b[_0x123c('0x30')]);_0x11f2b8['attributes']=_['intersection'](_0x4f523b[_0x123c('0x2e')],qs[_0x123c('0x33')](_0x15ac3a[_0x123c('0x30')]['fields']));_0x11f2b8[_0x123c('0x32')]=_0x11f2b8[_0x123c('0x32')]['length']?_0x11f2b8['attributes']:_0x4f523b[_0x123c('0x2e')];if(_0x15ac3a[_0x123c('0x30')][_0x123c('0x43')]){_0x11f2b8[_0x123c('0x44')]=[{'all':!![]}];}_0x11f2b8=_[_0x123c('0x3b')]({},_0x11f2b8,_0x15ac3a[_0x123c('0x3e')]);return db['ZohoConfiguration']['find'](_0x11f2b8)[_0x123c('0x23')](handleEntityNotFound(_0x2fa7c1,null))[_0x123c('0x23')](respondWithResult(_0x2fa7c1,null))[_0x123c('0x41')](handleError(_0x2fa7c1,null));};exports[_0x123c('0x45')]=function(_0x3cb51c,_0x5dbc2d){return db['ZohoConfiguration'][_0x123c('0x45')](_0x3cb51c[_0x123c('0x46')],{})[_0x123c('0x23')](respondWithResult(_0x5dbc2d,0xc9))[_0x123c('0x41')](handleError(_0x5dbc2d,null));};exports['update']=function(_0x18a3b5,_0x45ea1b){if(_0x18a3b5[_0x123c('0x46')]['id']){delete _0x18a3b5[_0x123c('0x46')]['id'];}return db[_0x123c('0x29')][_0x123c('0x47')]({'where':{'id':_0x18a3b5[_0x123c('0x48')]['id']}})['then'](handleEntityNotFound(_0x45ea1b,null))['then'](saveUpdates(_0x18a3b5[_0x123c('0x46')],null))[_0x123c('0x23')](respondWithResult(_0x45ea1b,null))[_0x123c('0x41')](handleError(_0x45ea1b,null));};exports[_0x123c('0x24')]=function(_0x307cf2,_0x41efd9){return db['ZohoConfiguration'][_0x123c('0x47')]({'where':{'id':_0x307cf2['params']['id']}})[_0x123c('0x23')](handleEntityNotFound(_0x41efd9,null))[_0x123c('0x23')](removeEntity(_0x41efd9,null))[_0x123c('0x41')](handleError(_0x41efd9,null));};exports[_0x123c('0x49')]=function(_0x368729,_0x48371e,_0x340a58){var _0x22ffa3={};var _0x1fcf67={};var _0x2c3057;var _0xea586d;return db[_0x123c('0x29')]['findOne']({'where':{'id':_0x368729[_0x123c('0x48')]['id']}})['then'](handleEntityNotFound(_0x48371e,null))[_0x123c('0x23')](function(_0xb5747a){if(_0xb5747a){_0x2c3057=_0xb5747a;_0x1fcf67[_0x123c('0x2e')]=_[_0x123c('0x2f')](db[_0x123c('0x4a')][_0x123c('0x2a')]);_0x1fcf67[_0x123c('0x30')]=_[_0x123c('0x2f')](_0x368729[_0x123c('0x30')]);_0x1fcf67[_0x123c('0x39')]=_[_0x123c('0x31')](_0x1fcf67[_0x123c('0x2e')],_0x1fcf67['query']);_0x22ffa3[_0x123c('0x32')]=_[_0x123c('0x31')](_0x1fcf67['model'],qs[_0x123c('0x33')](_0x368729[_0x123c('0x30')]['fields']));_0x22ffa3[_0x123c('0x32')]=_0x22ffa3[_0x123c('0x32')][_0x123c('0x34')]?_0x22ffa3['attributes']:_0x1fcf67[_0x123c('0x2e')];_0x22ffa3[_0x123c('0x37')]=qs[_0x123c('0x38')](_0x368729['query'][_0x123c('0x38')]);_0x22ffa3[_0x123c('0x3f')]=qs['filters'](_[_0x123c('0x4b')](_0x368729[_0x123c('0x30')],_0x1fcf67[_0x123c('0x39')]));if(_0x368729[_0x123c('0x30')][_0x123c('0x3a')]){_0x22ffa3['where']=_[_0x123c('0x3b')](_0x22ffa3['where'],{'$or':_[_0x123c('0x3c')](_0x22ffa3[_0x123c('0x32')],function(_0x29ba13){var _0x5d5a74={};_0x5d5a74[_0x29ba13]={'$like':'%'+_0x368729['query'][_0x123c('0x3a')]+'%'};return _0x5d5a74;})});}_0x22ffa3=_['merge']({},_0x22ffa3,_0x368729[_0x123c('0x3e')]);return _0x2c3057[_0x123c('0x49')](_0x22ffa3);}})['then'](function(_0x3093b0){if(_0x3093b0){_0xea586d=_0x3093b0['length'];if(!_0x368729[_0x123c('0x30')][_0x123c('0x35')](_0x123c('0x36'))){_0x22ffa3[_0x123c('0x1c')]=qs['limit'](_0x368729[_0x123c('0x30')][_0x123c('0x1c')]);_0x22ffa3[_0x123c('0x1a')]=qs[_0x123c('0x1a')](_0x368729[_0x123c('0x30')]['offset']);}return _0x2c3057[_0x123c('0x49')](_0x22ffa3);}})[_0x123c('0x23')](function(_0x2b1785){if(_0x2b1785){return _0x2b1785?{'count':_0xea586d,'rows':_0x2b1785}:null;}})[_0x123c('0x23')](respondWithResult(_0x48371e,null))[_0x123c('0x41')](handleError(_0x48371e,null));};exports[_0x123c('0x4c')]=function(_0x316510,_0x32e157,_0x7f98dc){var _0x28f3d2={};var _0xfdd28d={};var _0xf63c21;var _0x597ef9;return db['ZohoConfiguration'][_0x123c('0x4d')]({'where':{'id':_0x316510[_0x123c('0x48')]['id']}})[_0x123c('0x23')](handleEntityNotFound(_0x32e157,null))[_0x123c('0x23')](function(_0x2e7dcc){if(_0x2e7dcc){_0xf63c21=_0x2e7dcc;_0xfdd28d[_0x123c('0x2e')]=_['keys'](db['ZohoField']['rawAttributes']);_0xfdd28d[_0x123c('0x30')]=_['keys'](_0x316510[_0x123c('0x30')]);_0xfdd28d[_0x123c('0x39')]=_[_0x123c('0x31')](_0xfdd28d[_0x123c('0x2e')],_0xfdd28d[_0x123c('0x30')]);_0x28f3d2[_0x123c('0x32')]=_[_0x123c('0x31')](_0xfdd28d['model'],qs[_0x123c('0x33')](_0x316510['query'][_0x123c('0x33')]));_0x28f3d2[_0x123c('0x32')]=_0x28f3d2[_0x123c('0x32')][_0x123c('0x34')]?_0x28f3d2[_0x123c('0x32')]:_0xfdd28d[_0x123c('0x2e')];_0x28f3d2[_0x123c('0x37')]=qs['sort'](_0x316510[_0x123c('0x30')][_0x123c('0x38')]);_0x28f3d2[_0x123c('0x3f')]=qs['filters'](_['pick'](_0x316510[_0x123c('0x30')],_0xfdd28d[_0x123c('0x39')]));if(_0x316510[_0x123c('0x30')][_0x123c('0x3a')]){_0x28f3d2[_0x123c('0x3f')]=_[_0x123c('0x3b')](_0x28f3d2['where'],{'$or':_['map'](_0x28f3d2[_0x123c('0x32')],function(_0x571b7b){var _0x4084c2={};_0x4084c2[_0x571b7b]={'$like':'%'+_0x316510[_0x123c('0x30')][_0x123c('0x3a')]+'%'};return _0x4084c2;})});}_0x28f3d2=_[_0x123c('0x3b')]({},_0x28f3d2,_0x316510[_0x123c('0x3e')]);return _0xf63c21[_0x123c('0x4c')](_0x28f3d2);}})['then'](function(_0x3d940d){if(_0x3d940d){_0x597ef9=_0x3d940d['length'];if(!_0x316510['query']['hasOwnProperty'](_0x123c('0x36'))){_0x28f3d2[_0x123c('0x1c')]=qs['limit'](_0x316510[_0x123c('0x30')][_0x123c('0x1c')]);_0x28f3d2[_0x123c('0x1a')]=qs[_0x123c('0x1a')](_0x316510[_0x123c('0x30')][_0x123c('0x1a')]);}return _0xf63c21['getSubjects'](_0x28f3d2);}})[_0x123c('0x23')](function(_0x480fa0){if(_0x480fa0){return _0x480fa0?{'count':_0x597ef9,'rows':_0x480fa0}:null;}})[_0x123c('0x23')](respondWithResult(_0x32e157,null))[_0x123c('0x41')](handleError(_0x32e157,null));};exports['getDescriptions']=function(_0x597611,_0xdf9c59,_0x2eda8d){var _0x10e43e={};var _0x35b682={};var _0x9e868;var _0xaacbbe;return db[_0x123c('0x29')][_0x123c('0x4d')]({'where':{'id':_0x597611[_0x123c('0x48')]['id']}})[_0x123c('0x23')](handleEntityNotFound(_0xdf9c59,null))[_0x123c('0x23')](function(_0x5bc1b6){if(_0x5bc1b6){_0x9e868=_0x5bc1b6;_0x35b682['model']=_[_0x123c('0x2f')](db['ZohoField'][_0x123c('0x2a')]);_0x35b682['query']=_[_0x123c('0x2f')](_0x597611[_0x123c('0x30')]);_0x35b682[_0x123c('0x39')]=_[_0x123c('0x31')](_0x35b682[_0x123c('0x2e')],_0x35b682[_0x123c('0x30')]);_0x10e43e['attributes']=_['intersection'](_0x35b682['model'],qs[_0x123c('0x33')](_0x597611[_0x123c('0x30')]['fields']));_0x10e43e[_0x123c('0x32')]=_0x10e43e[_0x123c('0x32')][_0x123c('0x34')]?_0x10e43e[_0x123c('0x32')]:_0x35b682[_0x123c('0x2e')];_0x10e43e[_0x123c('0x37')]=qs['sort'](_0x597611[_0x123c('0x30')][_0x123c('0x38')]);_0x10e43e[_0x123c('0x3f')]=qs['filters'](_[_0x123c('0x4b')](_0x597611['query'],_0x35b682[_0x123c('0x39')]));if(_0x597611[_0x123c('0x30')][_0x123c('0x3a')]){_0x10e43e[_0x123c('0x3f')]=_[_0x123c('0x3b')](_0x10e43e[_0x123c('0x3f')],{'$or':_[_0x123c('0x3c')](_0x10e43e[_0x123c('0x32')],function(_0x2c3017){var _0x23aec0={};_0x23aec0[_0x2c3017]={'$like':'%'+_0x597611[_0x123c('0x30')]['filter']+'%'};return _0x23aec0;})});}_0x10e43e=_['merge']({},_0x10e43e,_0x597611[_0x123c('0x3e')]);return _0x9e868[_0x123c('0x4e')](_0x10e43e);}})['then'](function(_0x590107){if(_0x590107){_0xaacbbe=_0x590107['length'];if(!_0x597611['query'][_0x123c('0x35')](_0x123c('0x36'))){_0x10e43e['limit']=qs[_0x123c('0x1c')](_0x597611[_0x123c('0x30')][_0x123c('0x1c')]);_0x10e43e[_0x123c('0x1a')]=qs[_0x123c('0x1a')](_0x597611[_0x123c('0x30')][_0x123c('0x1a')]);}return _0x9e868['getDescriptions'](_0x10e43e);}})['then'](function(_0x1316f5){if(_0x1316f5){return _0x1316f5?{'count':_0xaacbbe,'rows':_0x1316f5}:null;}})[_0x123c('0x23')](respondWithResult(_0xdf9c59,null))['catch'](handleError(_0xdf9c59,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index b92d90e..a121199 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 _0x749a=['request-promise','../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration','int_zoho_configurations','lodash','api','bluebird'];(function(_0x4f1b4a,_0x5a2de1){var _0x25f268=function(_0x7a9cd5){while(--_0x7a9cd5){_0x4f1b4a['push'](_0x4f1b4a['shift']());}};_0x25f268(++_0x5a2de1);}(_0x749a,0x153));var _0xa749=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x749a[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xa749('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa749('0x1'));var moment=require('moment');var BPromise=require(_0xa749('0x2'));var rp=require(_0xa749('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa749('0x4'));var attributes=require(_0xa749('0x5'));module['exports']=function(_0x5b7473,_0x3a1cad){return _0x5b7473[_0xa749('0x6')](_0xa749('0x7'),attributes,{'tableName':_0xa749('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc17=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','lodash'];(function(_0x48c9f9,_0x11f9e2){var _0x573d80=function(_0x18b4ef){while(--_0x18b4ef){_0x48c9f9['push'](_0x48c9f9['shift']());}};_0x573d80(++_0x11f9e2);}(_0xcc17,0xc3));var _0x7cc1=function(_0x51a6d6,_0x3c9c49){_0x51a6d6=_0x51a6d6-0x0;var _0x5ef1a8=_0xcc17[_0x51a6d6];return _0x5ef1a8;};'use strict';var _=require(_0x7cc1('0x0'));var util=require(_0x7cc1('0x1'));var logger=require(_0x7cc1('0x2'))(_0x7cc1('0x3'));var moment=require(_0x7cc1('0x4'));var BPromise=require(_0x7cc1('0x5'));var rp=require(_0x7cc1('0x6'));var fs=require('fs');var path=require(_0x7cc1('0x7'));var rimraf=require(_0x7cc1('0x8'));var config=require(_0x7cc1('0x9'));var attributes=require(_0x7cc1('0xa'));module[_0x7cc1('0xb')]=function(_0x35548d,_0x5696ca){return _0x35548d[_0x7cc1('0xc')](_0x7cc1('0xd'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index c90c16d..5c684db 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 _0xe2eb=['error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe2eb,0x101));var _0xbe2e=function(_0x481924,_0x3bc2c8){_0x481924=_0x481924-0x0;var _0x88aba7=_0xe2eb[_0x481924];return _0x88aba7;};'use strict';var _=require('lodash');var util=require(_0xbe2e('0x0'));var moment=require(_0xbe2e('0x1'));var BPromise=require(_0xbe2e('0x2'));var rs=require(_0xbe2e('0x3'));var fs=require('fs');var Redis=require(_0xbe2e('0x4'));var db=require(_0xbe2e('0x5'))['db'];var utils=require(_0xbe2e('0x6'));var logger=require(_0xbe2e('0x7'))(_0xbe2e('0x8'));var config=require(_0xbe2e('0x9'));var jayson=require(_0xbe2e('0xa'));var client=jayson[_0xbe2e('0xb')][_0xbe2e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1eee4e,_0x4d885d,_0x384389){return new BPromise(function(_0x5990df,_0x36943b){return client['request'](_0x1eee4e,_0x384389)[_0xbe2e('0xd')](function(_0x285f41){logger[_0xbe2e('0xe')](_0xbe2e('0xf'),_0x4d885d,_0xbe2e('0x10'));logger[_0xbe2e('0x11')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x4d885d,_0xbe2e('0x10'),JSON[_0xbe2e('0x12')](_0x285f41));if(_0x285f41['error']){if(_0x285f41['error']['code']===0x1f4){logger[_0xbe2e('0x13')](_0xbe2e('0xf'),_0x4d885d,_0x285f41[_0xbe2e('0x13')]['message']);return _0x36943b(_0x285f41[_0xbe2e('0x13')]['message']);}logger[_0xbe2e('0x13')]('ZohoConfiguration,\x20%s,\x20%s',_0x4d885d,_0x285f41[_0xbe2e('0x13')][_0xbe2e('0x14')]);return _0x5990df(_0x285f41[_0xbe2e('0x13')][_0xbe2e('0x14')]);}else{logger[_0xbe2e('0xe')](_0xbe2e('0xf'),_0x4d885d,_0xbe2e('0x10'));_0x5990df(_0x285f41[_0xbe2e('0x15')][_0xbe2e('0x14')]);}})[_0xbe2e('0x16')](function(_0x34b251){logger[_0xbe2e('0x13')](_0xbe2e('0xf'),_0x4d885d,_0x34b251);_0x36943b(_0x34b251);});});} \ No newline at end of file +var _0x7aee=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis'];(function(_0x40bc01,_0x22a9a9){var _0x42365b=function(_0x2d3d88){while(--_0x2d3d88){_0x40bc01['push'](_0x40bc01['shift']());}};_0x42365b(++_0x22a9a9);}(_0x7aee,0x155));var _0xe7ae=function(_0xcec9c8,_0x5683b4){_0xcec9c8=_0xcec9c8-0x0;var _0xac19f=_0x7aee[_0xcec9c8];return _0xac19f;};'use strict';var _=require('lodash');var util=require(_0xe7ae('0x0'));var moment=require(_0xe7ae('0x1'));var BPromise=require(_0xe7ae('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7ae('0x3'));var db=require(_0xe7ae('0x4'))['db'];var utils=require(_0xe7ae('0x5'));var logger=require(_0xe7ae('0x6'))(_0xe7ae('0x7'));var config=require('../../config/environment');var jayson=require(_0xe7ae('0x8'));var client=jayson[_0xe7ae('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17db22,_0x1e0da2,_0x742949){return new BPromise(function(_0xf6a596,_0x459f59){return client[_0xe7ae('0xa')](_0x17db22,_0x742949)[_0xe7ae('0xb')](function(_0x4cfbe9){logger[_0xe7ae('0xc')](_0xe7ae('0xd'),_0x1e0da2,_0xe7ae('0xe'));logger[_0xe7ae('0xf')](_0xe7ae('0x10'),_0x1e0da2,_0xe7ae('0xe'),JSON[_0xe7ae('0x11')](_0x4cfbe9));if(_0x4cfbe9[_0xe7ae('0x12')]){if(_0x4cfbe9[_0xe7ae('0x12')][_0xe7ae('0x13')]===0x1f4){logger[_0xe7ae('0x12')](_0xe7ae('0xd'),_0x1e0da2,_0x4cfbe9[_0xe7ae('0x12')][_0xe7ae('0x14')]);return _0x459f59(_0x4cfbe9[_0xe7ae('0x12')][_0xe7ae('0x14')]);}logger[_0xe7ae('0x12')](_0xe7ae('0xd'),_0x1e0da2,_0x4cfbe9['error']['message']);return _0xf6a596(_0x4cfbe9[_0xe7ae('0x12')]['message']);}else{logger[_0xe7ae('0xc')](_0xe7ae('0xd'),_0x1e0da2,_0xe7ae('0xe'));_0xf6a596(_0x4cfbe9[_0xe7ae('0x15')][_0xe7ae('0x14')]);}})[_0xe7ae('0x16')](function(_0x58a7cd){logger[_0xe7ae('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x1e0da2,_0x58a7cd);_0x459f59(_0x58a7cd);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 7cb5b91..1934fcf 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 _0x11fc=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports'];(function(_0x456bd2,_0x156c79){var _0x2218c1=function(_0x44f2d4){while(--_0x44f2d4){_0x456bd2['push'](_0x456bd2['shift']());}};_0x2218c1(++_0x156c79);}(_0x11fc,0x1db));var _0xc11f=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x11fc[_0x1035c1];return _0x308d67;};'use strict';var multer=require('multer');var util=require(_0xc11f('0x0'));var path=require(_0xc11f('0x1'));var timeout=require(_0xc11f('0x2'));var express=require(_0xc11f('0x3'));var router=express['Router']();var fs_extra=require(_0xc11f('0x4'));var auth=require(_0xc11f('0x5'));var interaction=require(_0xc11f('0x6'));var config=require(_0xc11f('0x7'));var controller=require(_0xc11f('0x8'));router[_0xc11f('0x9')]('/',auth[_0xc11f('0xa')](),controller[_0xc11f('0xb')]);router[_0xc11f('0x9')](_0xc11f('0xc'),auth[_0xc11f('0xa')](),controller[_0xc11f('0xd')]);router[_0xc11f('0xe')]('/',auth[_0xc11f('0xa')](),controller['create']);router['put'](_0xc11f('0xc'),auth[_0xc11f('0xa')](),controller[_0xc11f('0xf')]);router[_0xc11f('0x10')](_0xc11f('0xc'),auth[_0xc11f('0xa')](),controller[_0xc11f('0x11')]);module[_0xc11f('0x12')]=router; \ No newline at end of file +var _0x4986=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','/:id','show','create','put','update','delete','destroy'];(function(_0x3adb2c,_0x5734f3){var _0x3e5ae4=function(_0x1fabec){while(--_0x1fabec){_0x3adb2c['push'](_0x3adb2c['shift']());}};_0x3e5ae4(++_0x5734f3);}(_0x4986,0xa2));var _0x6498=function(_0x14ef86,_0x8b76b2){_0x14ef86=_0x14ef86-0x0;var _0x4b3bb0=_0x4986[_0x14ef86];return _0x4b3bb0;};'use strict';var multer=require('multer');var util=require(_0x6498('0x0'));var path=require(_0x6498('0x1'));var timeout=require(_0x6498('0x2'));var express=require(_0x6498('0x3'));var router=express[_0x6498('0x4')]();var fs_extra=require(_0x6498('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6498('0x6'));var config=require(_0x6498('0x7'));var controller=require(_0x6498('0x8'));router[_0x6498('0x9')]('/',auth[_0x6498('0xa')](),controller['index']);router[_0x6498('0x9')](_0x6498('0xb'),auth[_0x6498('0xa')](),controller[_0x6498('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6498('0xd')]);router[_0x6498('0xe')]('/:id',auth[_0x6498('0xa')](),controller[_0x6498('0xf')]);router[_0x6498('0x10')](_0x6498('0xb'),auth['isAuthenticated'](),controller[_0x6498('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 91e44bc..19c0a8c 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 _0x7c0d=['string','STRING','variable','customVariable','BOOLEAN','exports','ENUM','keyValue','picklist'];(function(_0x27a0d9,_0x60da97){var _0x540904=function(_0x39a11f){while(--_0x39a11f){_0x27a0d9['push'](_0x27a0d9['shift']());}};_0x540904(++_0x60da97);}(_0x7c0d,0x9e));var _0xd7c0=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x7c0d[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require('sequelize');module[_0xd7c0('0x0')]={'type':{'type':Sequelize[_0xd7c0('0x1')]('string','variable','customVariable',_0xd7c0('0x2'),_0xd7c0('0x3')),'defaultValue':_0xd7c0('0x4')},'content':{'type':Sequelize[_0xd7c0('0x5')]},'key':{'type':Sequelize[_0xd7c0('0x5')]},'keyType':{'type':Sequelize[_0xd7c0('0x1')](_0xd7c0('0x4'),_0xd7c0('0x6'),_0xd7c0('0x7'))},'keyContent':{'type':Sequelize[_0xd7c0('0x5')]},'idField':{'type':Sequelize[_0xd7c0('0x5')]},'nameField':{'type':Sequelize[_0xd7c0('0x5')]},'customField':{'type':Sequelize[_0xd7c0('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd7c0('0x5')]}}; \ No newline at end of file +var _0xd9da=['BOOLEAN','exports','ENUM','variable','keyValue','STRING','string','customVariable'];(function(_0x2456af,_0x571456){var _0x263b42=function(_0x39b701){while(--_0x39b701){_0x2456af['push'](_0x2456af['shift']());}};_0x263b42(++_0x571456);}(_0xd9da,0x81));var _0xad9d=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xd9da[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require('sequelize');module[_0xad9d('0x0')]={'type':{'type':Sequelize[_0xad9d('0x1')]('string',_0xad9d('0x2'),'customVariable',_0xad9d('0x3'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xad9d('0x4')]},'key':{'type':Sequelize[_0xad9d('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0xad9d('0x5'),_0xad9d('0x2'),_0xad9d('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xad9d('0x4')]},'nameField':{'type':Sequelize[_0xad9d('0x4')]},'customField':{'type':Sequelize[_0xad9d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xad9d('0x4')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 64ba64f..81601f0 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 _0x7ae7=['index','map','ZohoField','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','keys','includeAll','find','catch','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send'];(function(_0x127ad3,_0x500b22){var _0x31a776=function(_0x171d69){while(--_0x171d69){_0x127ad3['push'](_0x127ad3['shift']());}};_0x31a776(++_0x500b22);}(_0x7ae7,0x109));var _0x77ae=function(_0x38b6ed,_0x355bb8){_0x38b6ed=_0x38b6ed-0x0;var _0x489fe0=_0x7ae7[_0x38b6ed];return _0x489fe0;};'use strict';var emlformat=require(_0x77ae('0x0'));var rimraf=require(_0x77ae('0x1'));var zipdir=require(_0x77ae('0x2'));var jsonpatch=require(_0x77ae('0x3'));var rp=require(_0x77ae('0x4'));var moment=require(_0x77ae('0x5'));var BPromise=require(_0x77ae('0x6'));var Mustache=require('mustache');var util=require(_0x77ae('0x7'));var path=require(_0x77ae('0x8'));var sox=require(_0x77ae('0x9'));var csv=require('to-csv');var ejs=require(_0x77ae('0xa'));var fs=require('fs');var fs_extra=require(_0x77ae('0xb'));var _=require(_0x77ae('0xc'));var squel=require(_0x77ae('0xd'));var crypto=require(_0x77ae('0xe'));var jsforce=require(_0x77ae('0xf'));var deskjs=require(_0x77ae('0x10'));var toCsv=require(_0x77ae('0x11'));var querystring=require(_0x77ae('0x12'));var Papa=require(_0x77ae('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77ae('0x14'));var logger=require(_0x77ae('0x15'))(_0x77ae('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x77ae('0x17'));var db=require(_0x77ae('0x18'))['db'];function respondWithStatusCode(_0x12df1d,_0x101ff3){_0x101ff3=_0x101ff3||0xcc;return function(_0x36b844){if(_0x36b844){return _0x12df1d[_0x77ae('0x19')](_0x101ff3);}return _0x12df1d[_0x77ae('0x1a')](_0x101ff3)[_0x77ae('0x1b')]();};}function respondWithResult(_0x2b6110,_0x3960ed){_0x3960ed=_0x3960ed||0xc8;return function(_0x494bd9){if(_0x494bd9){return _0x2b6110[_0x77ae('0x1a')](_0x3960ed)[_0x77ae('0x1c')](_0x494bd9);}};}function respondWithFilteredResult(_0x3ef691,_0x9b0db2){return function(_0x508bdd){if(_0x508bdd){var _0x16c1c6=typeof _0x9b0db2[_0x77ae('0x1d')]===_0x77ae('0x1e')&&typeof _0x9b0db2[_0x77ae('0x1f')]==='undefined';var _0x22409e=_0x508bdd[_0x77ae('0x20')];var _0x55add8=_0x16c1c6?0x0:_0x9b0db2[_0x77ae('0x1d')];var _0x33b10c=_0x16c1c6?_0x508bdd['count']:_0x9b0db2[_0x77ae('0x1d')]+_0x9b0db2[_0x77ae('0x1f')];var _0x39cd66;if(_0x33b10c>=_0x22409e){_0x33b10c=_0x22409e;_0x39cd66=0xc8;}else{_0x39cd66=0xce;}_0x3ef691[_0x77ae('0x1a')](_0x39cd66);return _0x3ef691[_0x77ae('0x21')](_0x77ae('0x22'),_0x55add8+'-'+_0x33b10c+'/'+_0x22409e)[_0x77ae('0x1c')](_0x508bdd);}return null;};}function patchUpdates(_0x352ba0){return function(_0x16695d){try{jsonpatch[_0x77ae('0x23')](_0x16695d,_0x352ba0,!![]);}catch(_0x55268a){return BPromise[_0x77ae('0x24')](_0x55268a);}return _0x16695d[_0x77ae('0x25')]();};}function saveUpdates(_0x5c07a8,_0x1e2fb3){return function(_0x288fd5){if(_0x288fd5){return _0x288fd5[_0x77ae('0x26')](_0x5c07a8)['then'](function(_0x7e6c6f){return _0x7e6c6f;});}return null;};}function removeEntity(_0x4df9fb,_0x124f57){return function(_0x1e7b36){if(_0x1e7b36){return _0x1e7b36['destroy']()[_0x77ae('0x27')](function(){_0x4df9fb['status'](0xcc)[_0x77ae('0x1b')]();});}};}function handleEntityNotFound(_0x4f7441,_0x5920aa){return function(_0x22afce){if(!_0x22afce){_0x4f7441['sendStatus'](0x194);}return _0x22afce;};}function handleError(_0x4c6aa2,_0x5c1af2){_0x5c1af2=_0x5c1af2||0x1f4;return function(_0x1562ee){logger['error'](_0x1562ee[_0x77ae('0x28')]);if(_0x1562ee[_0x77ae('0x29')]){delete _0x1562ee[_0x77ae('0x29')];}_0x4c6aa2[_0x77ae('0x1a')](_0x5c1af2)[_0x77ae('0x2a')](_0x1562ee);};}exports[_0x77ae('0x2b')]=function(_0x150a46,_0x43b58e){var _0x2317bb={},_0x186bb2={},_0x2c22ce={'count':0x0,'rows':[]};var _0x11d53b=_[_0x77ae('0x2c')](db[_0x77ae('0x2d')][_0x77ae('0x2e')],function(_0x1487f1){return{'name':_0x1487f1[_0x77ae('0x2f')],'type':_0x1487f1[_0x77ae('0x30')]['key']};});_0x186bb2[_0x77ae('0x31')]=_[_0x77ae('0x2c')](_0x11d53b,_0x77ae('0x29'));_0x186bb2[_0x77ae('0x32')]=_['keys'](_0x150a46[_0x77ae('0x32')]);_0x186bb2[_0x77ae('0x33')]=_[_0x77ae('0x34')](_0x186bb2['model'],_0x186bb2['query']);_0x2317bb['attributes']=_[_0x77ae('0x34')](_0x186bb2[_0x77ae('0x31')],qs[_0x77ae('0x35')](_0x150a46[_0x77ae('0x32')][_0x77ae('0x35')]));_0x2317bb[_0x77ae('0x36')]=_0x2317bb[_0x77ae('0x36')][_0x77ae('0x37')]?_0x2317bb[_0x77ae('0x36')]:_0x186bb2[_0x77ae('0x31')];if(!_0x150a46[_0x77ae('0x32')]['hasOwnProperty'](_0x77ae('0x38'))){_0x2317bb[_0x77ae('0x1f')]=qs[_0x77ae('0x1f')](_0x150a46[_0x77ae('0x32')][_0x77ae('0x1f')]);_0x2317bb[_0x77ae('0x1d')]=qs[_0x77ae('0x1d')](_0x150a46[_0x77ae('0x32')][_0x77ae('0x1d')]);}_0x2317bb[_0x77ae('0x39')]=qs[_0x77ae('0x3a')](_0x150a46[_0x77ae('0x32')][_0x77ae('0x3a')]);_0x2317bb[_0x77ae('0x3b')]=qs[_0x77ae('0x33')](_[_0x77ae('0x3c')](_0x150a46['query'],_0x186bb2['filters']),_0x11d53b);if(_0x150a46['query'][_0x77ae('0x3d')]){_0x2317bb[_0x77ae('0x3b')]=_[_0x77ae('0x3e')](_0x2317bb['where'],{'$or':_[_0x77ae('0x2c')](_0x11d53b,function(_0x1b7a15){if(_0x1b7a15[_0x77ae('0x30')]!==_0x77ae('0x3f')){var _0x891600={};_0x891600[_0x1b7a15['name']]={'$like':'%'+_0x150a46[_0x77ae('0x32')][_0x77ae('0x3d')]+'%'};return _0x891600;}})});}_0x2317bb=_[_0x77ae('0x3e')]({},_0x2317bb,_0x150a46[_0x77ae('0x40')]);var _0x1ec08f={'where':_0x2317bb[_0x77ae('0x3b')]};return db['ZohoField'][_0x77ae('0x20')](_0x1ec08f)[_0x77ae('0x27')](function(_0x3a9ef1){_0x2c22ce[_0x77ae('0x20')]=_0x3a9ef1;if(_0x150a46[_0x77ae('0x32')]['includeAll']){_0x2317bb[_0x77ae('0x41')]=[{'all':!![]}];}return db['ZohoField'][_0x77ae('0x42')](_0x2317bb);})[_0x77ae('0x27')](function(_0x5290e8){_0x2c22ce[_0x77ae('0x43')]=_0x5290e8;return _0x2c22ce;})[_0x77ae('0x27')](respondWithFilteredResult(_0x43b58e,_0x2317bb))['catch'](handleError(_0x43b58e,null));};exports[_0x77ae('0x44')]=function(_0x363ac5,_0x31e34f){var _0x70e9fe={'raw':!![],'where':{'id':_0x363ac5['params']['id']}},_0x29fd27={};_0x29fd27[_0x77ae('0x31')]=_[_0x77ae('0x45')](db['ZohoField']['rawAttributes']);_0x29fd27['query']=_[_0x77ae('0x45')](_0x363ac5[_0x77ae('0x32')]);_0x29fd27[_0x77ae('0x33')]=_[_0x77ae('0x34')](_0x29fd27[_0x77ae('0x31')],_0x29fd27[_0x77ae('0x32')]);_0x70e9fe[_0x77ae('0x36')]=_[_0x77ae('0x34')](_0x29fd27[_0x77ae('0x31')],qs[_0x77ae('0x35')](_0x363ac5[_0x77ae('0x32')]['fields']));_0x70e9fe[_0x77ae('0x36')]=_0x70e9fe[_0x77ae('0x36')]['length']?_0x70e9fe[_0x77ae('0x36')]:_0x29fd27[_0x77ae('0x31')];if(_0x363ac5[_0x77ae('0x32')][_0x77ae('0x46')]){_0x70e9fe[_0x77ae('0x41')]=[{'all':!![]}];}_0x70e9fe=_[_0x77ae('0x3e')]({},_0x70e9fe,_0x363ac5[_0x77ae('0x40')]);return db[_0x77ae('0x2d')][_0x77ae('0x47')](_0x70e9fe)[_0x77ae('0x27')](handleEntityNotFound(_0x31e34f,null))[_0x77ae('0x27')](respondWithResult(_0x31e34f,null))[_0x77ae('0x48')](handleError(_0x31e34f,null));};exports['create']=function(_0x4af00f,_0x1353a7){return db[_0x77ae('0x2d')][_0x77ae('0x49')](_0x4af00f[_0x77ae('0x4a')],{})[_0x77ae('0x27')](respondWithResult(_0x1353a7,0xc9))[_0x77ae('0x48')](handleError(_0x1353a7,null));};exports[_0x77ae('0x26')]=function(_0x37cd6d,_0x3ea683){if(_0x37cd6d['body']['id']){delete _0x37cd6d[_0x77ae('0x4a')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x37cd6d[_0x77ae('0x4b')]['id']}})[_0x77ae('0x27')](handleEntityNotFound(_0x3ea683,null))[_0x77ae('0x27')](saveUpdates(_0x37cd6d['body'],null))[_0x77ae('0x27')](respondWithResult(_0x3ea683,null))[_0x77ae('0x48')](handleError(_0x3ea683,null));};exports[_0x77ae('0x4c')]=function(_0x5c51ce,_0x28c8b1){return db['ZohoField'][_0x77ae('0x47')]({'where':{'id':_0x5c51ce[_0x77ae('0x4b')]['id']}})[_0x77ae('0x27')](handleEntityNotFound(_0x28c8b1,null))[_0x77ae('0x27')](removeEntity(_0x28c8b1,null))[_0x77ae('0x48')](handleError(_0x28c8b1,null));}; \ No newline at end of file +var _0x7eee=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','end','error','stack','name','map','ZohoField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','keys','length','create','body','find','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7eee,0x14c));var _0xe7ee=function(_0x47be9b,_0x2e25a8){_0x47be9b=_0x47be9b-0x0;var _0x1f21ed=_0x7eee[_0x47be9b];return _0x1f21ed;};'use strict';var emlformat=require(_0xe7ee('0x0'));var rimraf=require(_0xe7ee('0x1'));var zipdir=require(_0xe7ee('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe7ee('0x3'));var moment=require(_0xe7ee('0x4'));var BPromise=require(_0xe7ee('0x5'));var Mustache=require(_0xe7ee('0x6'));var util=require(_0xe7ee('0x7'));var path=require('path');var sox=require(_0xe7ee('0x8'));var csv=require(_0xe7ee('0x9'));var ejs=require(_0xe7ee('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe7ee('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe7ee('0xc'));var deskjs=require(_0xe7ee('0xd'));var toCsv=require(_0xe7ee('0x9'));var querystring=require('querystring');var Papa=require(_0xe7ee('0xe'));var Redis=require(_0xe7ee('0xf'));var authService=require(_0xe7ee('0x10'));var qs=require(_0xe7ee('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe7ee('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xe7ee('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5699ab,_0x7820ef){_0x7820ef=_0x7820ef||0xcc;return function(_0x1e8786){if(_0x1e8786){return _0x5699ab[_0xe7ee('0x14')](_0x7820ef);}return _0x5699ab[_0xe7ee('0x15')](_0x7820ef)['end']();};}function respondWithResult(_0x35d606,_0x450808){_0x450808=_0x450808||0xc8;return function(_0x144335){if(_0x144335){return _0x35d606['status'](_0x450808)[_0xe7ee('0x16')](_0x144335);}};}function respondWithFilteredResult(_0x53cdfb,_0x2e7999){return function(_0xb0638){if(_0xb0638){var _0x3615f5=typeof _0x2e7999[_0xe7ee('0x17')]===_0xe7ee('0x18')&&typeof _0x2e7999[_0xe7ee('0x19')]===_0xe7ee('0x18');var _0x5e4638=_0xb0638['count'];var _0x2d3198=_0x3615f5?0x0:_0x2e7999[_0xe7ee('0x17')];var _0x38b598=_0x3615f5?_0xb0638[_0xe7ee('0x1a')]:_0x2e7999[_0xe7ee('0x17')]+_0x2e7999['limit'];var _0x1a090e;if(_0x38b598>=_0x5e4638){_0x38b598=_0x5e4638;_0x1a090e=0xc8;}else{_0x1a090e=0xce;}_0x53cdfb[_0xe7ee('0x15')](_0x1a090e);return _0x53cdfb['set'](_0xe7ee('0x1b'),_0x2d3198+'-'+_0x38b598+'/'+_0x5e4638)['json'](_0xb0638);}return null;};}function patchUpdates(_0x14a514){return function(_0x3c11bf){try{jsonpatch[_0xe7ee('0x1c')](_0x3c11bf,_0x14a514,!![]);}catch(_0x5ed89d){return BPromise[_0xe7ee('0x1d')](_0x5ed89d);}return _0x3c11bf[_0xe7ee('0x1e')]();};}function saveUpdates(_0x11ae63,_0x22401b){return function(_0x3811dc){if(_0x3811dc){return _0x3811dc[_0xe7ee('0x1f')](_0x11ae63)['then'](function(_0x3095d3){return _0x3095d3;});}return null;};}function removeEntity(_0x530b3c,_0x2b0888){return function(_0xce11c8){if(_0xce11c8){return _0xce11c8['destroy']()['then'](function(){_0x530b3c[_0xe7ee('0x15')](0xcc)[_0xe7ee('0x20')]();});}};}function handleEntityNotFound(_0x5885d2,_0x2505b7){return function(_0x3f9af2){if(!_0x3f9af2){_0x5885d2[_0xe7ee('0x14')](0x194);}return _0x3f9af2;};}function handleError(_0x2a562e,_0x4c847a){_0x4c847a=_0x4c847a||0x1f4;return function(_0x3a7c5c){logger[_0xe7ee('0x21')](_0x3a7c5c[_0xe7ee('0x22')]);if(_0x3a7c5c[_0xe7ee('0x23')]){delete _0x3a7c5c[_0xe7ee('0x23')];}_0x2a562e['status'](_0x4c847a)['send'](_0x3a7c5c);};}exports['index']=function(_0x20cb05,_0x25ce52){var _0x1cc914={},_0x3a165c={},_0x3f20c8={'count':0x0,'rows':[]};var _0x38ca6d=_[_0xe7ee('0x24')](db[_0xe7ee('0x25')][_0xe7ee('0x26')],function(_0x736e4c){return{'name':_0x736e4c[_0xe7ee('0x27')],'type':_0x736e4c[_0xe7ee('0x28')][_0xe7ee('0x29')]};});_0x3a165c[_0xe7ee('0x2a')]=_[_0xe7ee('0x24')](_0x38ca6d,_0xe7ee('0x23'));_0x3a165c[_0xe7ee('0x2b')]=_['keys'](_0x20cb05['query']);_0x3a165c[_0xe7ee('0x2c')]=_[_0xe7ee('0x2d')](_0x3a165c['model'],_0x3a165c['query']);_0x1cc914[_0xe7ee('0x2e')]=_['intersection'](_0x3a165c['model'],qs[_0xe7ee('0x2f')](_0x20cb05[_0xe7ee('0x2b')][_0xe7ee('0x2f')]));_0x1cc914[_0xe7ee('0x2e')]=_0x1cc914[_0xe7ee('0x2e')]['length']?_0x1cc914['attributes']:_0x3a165c[_0xe7ee('0x2a')];if(!_0x20cb05[_0xe7ee('0x2b')][_0xe7ee('0x30')]('nolimit')){_0x1cc914[_0xe7ee('0x19')]=qs[_0xe7ee('0x19')](_0x20cb05[_0xe7ee('0x2b')]['limit']);_0x1cc914[_0xe7ee('0x17')]=qs[_0xe7ee('0x17')](_0x20cb05['query'][_0xe7ee('0x17')]);}_0x1cc914[_0xe7ee('0x31')]=qs[_0xe7ee('0x32')](_0x20cb05[_0xe7ee('0x2b')]['sort']);_0x1cc914[_0xe7ee('0x33')]=qs[_0xe7ee('0x2c')](_[_0xe7ee('0x34')](_0x20cb05['query'],_0x3a165c['filters']),_0x38ca6d);if(_0x20cb05[_0xe7ee('0x2b')][_0xe7ee('0x35')]){_0x1cc914[_0xe7ee('0x33')]=_[_0xe7ee('0x36')](_0x1cc914['where'],{'$or':_[_0xe7ee('0x24')](_0x38ca6d,function(_0x268ade){if(_0x268ade[_0xe7ee('0x28')]!==_0xe7ee('0x37')){var _0x3d6882={};_0x3d6882[_0x268ade[_0xe7ee('0x23')]]={'$like':'%'+_0x20cb05['query'][_0xe7ee('0x35')]+'%'};return _0x3d6882;}})});}_0x1cc914=_[_0xe7ee('0x36')]({},_0x1cc914,_0x20cb05[_0xe7ee('0x38')]);var _0x4c1844={'where':_0x1cc914[_0xe7ee('0x33')]};return db[_0xe7ee('0x25')][_0xe7ee('0x1a')](_0x4c1844)[_0xe7ee('0x39')](function(_0x67b047){_0x3f20c8[_0xe7ee('0x1a')]=_0x67b047;if(_0x20cb05[_0xe7ee('0x2b')][_0xe7ee('0x3a')]){_0x1cc914[_0xe7ee('0x3b')]=[{'all':!![]}];}return db[_0xe7ee('0x25')][_0xe7ee('0x3c')](_0x1cc914);})[_0xe7ee('0x39')](function(_0x53ebc7){_0x3f20c8[_0xe7ee('0x3d')]=_0x53ebc7;return _0x3f20c8;})[_0xe7ee('0x39')](respondWithFilteredResult(_0x25ce52,_0x1cc914))[_0xe7ee('0x3e')](handleError(_0x25ce52,null));};exports['show']=function(_0x275640,_0x4342fd){var _0x2b821c={'raw':!![],'where':{'id':_0x275640['params']['id']}},_0x4afe03={};_0x4afe03[_0xe7ee('0x2a')]=_[_0xe7ee('0x3f')](db[_0xe7ee('0x25')]['rawAttributes']);_0x4afe03['query']=_['keys'](_0x275640['query']);_0x4afe03[_0xe7ee('0x2c')]=_[_0xe7ee('0x2d')](_0x4afe03[_0xe7ee('0x2a')],_0x4afe03[_0xe7ee('0x2b')]);_0x2b821c[_0xe7ee('0x2e')]=_[_0xe7ee('0x2d')](_0x4afe03[_0xe7ee('0x2a')],qs[_0xe7ee('0x2f')](_0x275640[_0xe7ee('0x2b')][_0xe7ee('0x2f')]));_0x2b821c[_0xe7ee('0x2e')]=_0x2b821c[_0xe7ee('0x2e')][_0xe7ee('0x40')]?_0x2b821c['attributes']:_0x4afe03[_0xe7ee('0x2a')];if(_0x275640[_0xe7ee('0x2b')][_0xe7ee('0x3a')]){_0x2b821c[_0xe7ee('0x3b')]=[{'all':!![]}];}_0x2b821c=_['merge']({},_0x2b821c,_0x275640[_0xe7ee('0x38')]);return db[_0xe7ee('0x25')]['find'](_0x2b821c)['then'](handleEntityNotFound(_0x4342fd,null))[_0xe7ee('0x39')](respondWithResult(_0x4342fd,null))[_0xe7ee('0x3e')](handleError(_0x4342fd,null));};exports[_0xe7ee('0x41')]=function(_0x5d8f18,_0x497343){return db[_0xe7ee('0x25')]['create'](_0x5d8f18[_0xe7ee('0x42')],{})[_0xe7ee('0x39')](respondWithResult(_0x497343,0xc9))[_0xe7ee('0x3e')](handleError(_0x497343,null));};exports['update']=function(_0x4cadaa,_0x4452a6){if(_0x4cadaa[_0xe7ee('0x42')]['id']){delete _0x4cadaa['body']['id'];}return db[_0xe7ee('0x25')][_0xe7ee('0x43')]({'where':{'id':_0x4cadaa[_0xe7ee('0x44')]['id']}})[_0xe7ee('0x39')](handleEntityNotFound(_0x4452a6,null))[_0xe7ee('0x39')](saveUpdates(_0x4cadaa[_0xe7ee('0x42')],null))['then'](respondWithResult(_0x4452a6,null))[_0xe7ee('0x3e')](handleError(_0x4452a6,null));};exports['destroy']=function(_0x26e57b,_0x5a63c1){return db[_0xe7ee('0x25')]['find']({'where':{'id':_0x26e57b[_0xe7ee('0x44')]['id']}})[_0xe7ee('0x39')](handleEntityNotFound(_0x5a63c1,null))[_0xe7ee('0x39')](removeEntity(_0x5a63c1,null))['catch'](handleError(_0x5a63c1,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index cfe6a01..7d4f237 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 _0x896e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','lodash','util','../../config/logger','api'];(function(_0x30b94a,_0xfb8634){var _0x291adc=function(_0x47d0c3){while(--_0x47d0c3){_0x30b94a['push'](_0x30b94a['shift']());}};_0x291adc(++_0xfb8634);}(_0x896e,0x1e9));var _0xe896=function(_0x48d39c,_0x1c31dd){_0x48d39c=_0x48d39c-0x0;var _0x5de2f4=_0x896e[_0x48d39c];return _0x5de2f4;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var logger=require(_0xe896('0x2'))(_0xe896('0x3'));var moment=require(_0xe896('0x4'));var BPromise=require(_0xe896('0x5'));var rp=require(_0xe896('0x6'));var fs=require('fs');var path=require(_0xe896('0x7'));var rimraf=require(_0xe896('0x8'));var config=require(_0xe896('0x9'));var attributes=require(_0xe896('0xa'));module[_0xe896('0xb')]=function(_0x52ac80,_0x24c430){return _0x52ac80[_0xe896('0xc')](_0xe896('0xd'),attributes,{'tableName':_0xe896('0xe'),'paranoid':![],'indexes':[{'name':_0xe896('0xf'),'fields':['idField',_0xe896('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x32b6=['int_zoho_fields','idField','FieldId','lodash','util','api','moment','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField'];(function(_0x3eb713,_0x437874){var _0x1d7128=function(_0x2b9cea){while(--_0x2b9cea){_0x3eb713['push'](_0x3eb713['shift']());}};_0x1d7128(++_0x437874);}(_0x32b6,0x1d1));var _0x632b=function(_0x507436,_0x47d57d){_0x507436=_0x507436-0x0;var _0x383d9d=_0x32b6[_0x507436];return _0x383d9d;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var logger=require('../../config/logger')(_0x632b('0x2'));var moment=require(_0x632b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x632b('0x4'));var rimraf=require(_0x632b('0x5'));var config=require(_0x632b('0x6'));var attributes=require(_0x632b('0x7'));module[_0x632b('0x8')]=function(_0x122768,_0x24ceab){return _0x122768[_0x632b('0x9')](_0x632b('0xa'),attributes,{'tableName':_0x632b('0xb'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x632b('0xc'),_0x632b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index c773622..092a283 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 _0x557d=['client','http','request','then','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x557d,0x99));var _0xd557=function(_0x56fcee,_0x4100d7){_0x56fcee=_0x56fcee-0x0;var _0x2dc509=_0x557d[_0x56fcee];return _0x2dc509;};'use strict';var _=require(_0xd557('0x0'));var util=require(_0xd557('0x1'));var moment=require('moment');var BPromise=require(_0xd557('0x2'));var rs=require(_0xd557('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd557('0x4'))['db'];var utils=require(_0xd557('0x5'));var logger=require('../../config/logger')(_0xd557('0x6'));var config=require(_0xd557('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd557('0x8')][_0xd557('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xaec957,_0xbd7786,_0x414c75){return new BPromise(function(_0x1987fb,_0x2af390){return client[_0xd557('0xa')](_0xaec957,_0x414c75)[_0xd557('0xb')](function(_0x3ea561){logger['info'](_0xd557('0xc'),_0xbd7786,_0xd557('0xd'));logger[_0xd557('0xe')](_0xd557('0xf'),_0xbd7786,_0xd557('0xd'),JSON[_0xd557('0x10')](_0x3ea561));if(_0x3ea561[_0xd557('0x11')]){if(_0x3ea561[_0xd557('0x11')][_0xd557('0x12')]===0x1f4){logger[_0xd557('0x11')]('ZohoField,\x20%s,\x20%s',_0xbd7786,_0x3ea561[_0xd557('0x11')][_0xd557('0x13')]);return _0x2af390(_0x3ea561[_0xd557('0x11')][_0xd557('0x13')]);}logger[_0xd557('0x11')](_0xd557('0xc'),_0xbd7786,_0x3ea561[_0xd557('0x11')][_0xd557('0x13')]);return _0x1987fb(_0x3ea561[_0xd557('0x11')][_0xd557('0x13')]);}else{logger[_0xd557('0x14')]('ZohoField,\x20%s,\x20%s',_0xbd7786,_0xd557('0xd'));_0x1987fb(_0x3ea561[_0xd557('0x15')]['message']);}})[_0xd557('0x16')](function(_0x4522fb){logger[_0xd557('0x11')]('ZohoField,\x20%s,\x20%s',_0xbd7786,_0x4522fb);_0x2af390(_0x4522fb);});});} \ No newline at end of file +var _0xed3f=['message','request\x20sent','result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ZohoField,\x20%s,\x20%s','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1717b0,_0xa93934){var _0x405899=function(_0x449e64){while(--_0x449e64){_0x1717b0['push'](_0x1717b0['shift']());}};_0x405899(++_0xa93934);}(_0xed3f,0x7c));var _0xfed3=function(_0x22e133,_0x527287){_0x22e133=_0x22e133-0x0;var _0x3455ca=_0xed3f[_0x22e133];return _0x3455ca;};'use strict';var _=require('lodash');var util=require(_0xfed3('0x0'));var moment=require(_0xfed3('0x1'));var BPromise=require('bluebird');var rs=require(_0xfed3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfed3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xfed3('0x4'))(_0xfed3('0x5'));var config=require(_0xfed3('0x6'));var jayson=require(_0xfed3('0x7'));var client=jayson[_0xfed3('0x8')][_0xfed3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16ee94,_0x3c5867,_0xdef1da){return new BPromise(function(_0x468b40,_0x11438f){return client['request'](_0x16ee94,_0xdef1da)['then'](function(_0x2bbe7f){logger[_0xfed3('0xa')](_0xfed3('0xb'),_0x3c5867,'request\x20sent');logger['debug'](_0xfed3('0xc'),_0x3c5867,'request\x20sent',JSON[_0xfed3('0xd')](_0x2bbe7f));if(_0x2bbe7f[_0xfed3('0xe')]){if(_0x2bbe7f[_0xfed3('0xe')][_0xfed3('0xf')]===0x1f4){logger[_0xfed3('0xe')](_0xfed3('0xb'),_0x3c5867,_0x2bbe7f[_0xfed3('0xe')][_0xfed3('0x10')]);return _0x11438f(_0x2bbe7f[_0xfed3('0xe')][_0xfed3('0x10')]);}logger[_0xfed3('0xe')](_0xfed3('0xb'),_0x3c5867,_0x2bbe7f[_0xfed3('0xe')]['message']);return _0x468b40(_0x2bbe7f[_0xfed3('0xe')]['message']);}else{logger[_0xfed3('0xa')](_0xfed3('0xb'),_0x3c5867,_0xfed3('0x11'));_0x468b40(_0x2bbe7f[_0xfed3('0x12')][_0xfed3('0x10')]);}})[_0xfed3('0x13')](function(_0x2bc2ff){logger[_0xfed3('0xe')](_0xfed3('0xb'),_0x3c5867,_0x2bc2ff);_0x11438f(_0x2bc2ff);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index a9f23da..2bb8917 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 _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(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3510c2,_0x396bf6){var _0x191fb0=function(_0x1e3f44){while(--_0x1e3f44){_0x3510c2['push'](_0x3510c2['shift']());}};_0x191fb0(++_0x396bf6);}(_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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index eb8a14d..5f35eaf 100644 --- a/server/api/integration/integration.attributes.js +++ b/server/api/integration/integration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8985=['sequelize','exports','STRING','app.js','BOOLEAN','state'];(function(_0x42047e,_0x15ff54){var _0x52aa5b=function(_0x5ce3a0){while(--_0x5ce3a0){_0x42047e['push'](_0x42047e['shift']());}};_0x52aa5b(++_0x15ff54);}(_0x8985,0x198));var _0x5898=function(_0x525511,_0x3b9d9b){_0x525511=_0x525511-0x0;var _0x1ab032=_0x8985[_0x525511];return _0x1ab032;};'use strict';var Sequelize=require(_0x5898('0x0'));module[_0x5898('0x1')]={'name':{'type':Sequelize[_0x5898('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x5898('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':_0x5898('0x3')},'filename':{'type':Sequelize[_0x5898('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x5898('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x5898('0x2')]},'logo':{'type':Sequelize[_0x5898('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0x5898('0x5')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x5898('0x2')]},'remoteUri':{'type':Sequelize[_0x5898('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x4be5=['state','sequelize','exports','unique_name_and_version','STRING','app.js'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x4be5,0xc1));var _0x54be=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x4be5[_0x5c351c];return _0x26f3b3;};'use strict';var Sequelize=require(_0x54be('0x0'));module[_0x54be('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x54be('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x54be('0x2')},'main':{'type':Sequelize[_0x54be('0x3')],'defaultValue':_0x54be('0x4')},'filename':{'type':Sequelize[_0x54be('0x3')]},'path':{'type':Sequelize[_0x54be('0x3')]},'type':{'type':Sequelize[_0x54be('0x3')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x54be('0x3')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x54be('0x3')],'unique':_0x54be('0x5')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x54be('0x3')]},'remoteUri':{'type':Sequelize[_0x54be('0x3')]},'link':{'type':Sequelize[_0x54be('0x3')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index b0523bd..b0fc6fd 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 _0x1883=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Integration','includeAll','include','findAll','params','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x3ee76c,_0x58354e){var _0x14bfa8=function(_0xef7be8){while(--_0xef7be8){_0x3ee76c['push'](_0x3ee76c['shift']());}};_0x14bfa8(++_0x58354e);}(_0x1883,0xab));var _0x3188=function(_0x3cfaea,_0x59581c){_0x3cfaea=_0x3cfaea-0x0;var _0x5131f6=_0x1883[_0x3cfaea];return _0x5131f6;};'use strict';var emlformat=require(_0x3188('0x0'));var rimraf=require(_0x3188('0x1'));var zipdir=require(_0x3188('0x2'));var jsonpatch=require(_0x3188('0x3'));var rp=require(_0x3188('0x4'));var moment=require(_0x3188('0x5'));var BPromise=require(_0x3188('0x6'));var Mustache=require(_0x3188('0x7'));var util=require(_0x3188('0x8'));var path=require(_0x3188('0x9'));var sox=require(_0x3188('0xa'));var csv=require(_0x3188('0xb'));var ejs=require(_0x3188('0xc'));var fs=require('fs');var fs_extra=require(_0x3188('0xd'));var _=require(_0x3188('0xe'));var squel=require(_0x3188('0xf'));var crypto=require(_0x3188('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x3188('0x11'));var toCsv=require(_0x3188('0xb'));var querystring=require('querystring');var Papa=require(_0x3188('0x12'));var Redis=require('ioredis');var authService=require(_0x3188('0x13'));var qs=require(_0x3188('0x14'));var as=require(_0x3188('0x15'));var hardwareService=require(_0x3188('0x16'));var logger=require('../../config/logger')(_0x3188('0x17'));var utils=require(_0x3188('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3188('0x19'))['db'];function respondWithStatusCode(_0x45e94e,_0x20fef6){_0x20fef6=_0x20fef6||0xcc;return function(_0x3ae228){if(_0x3ae228){return _0x45e94e[_0x3188('0x1a')](_0x20fef6);}return _0x45e94e[_0x3188('0x1b')](_0x20fef6)['end']();};}function respondWithResult(_0x276d69,_0x5e0044){_0x5e0044=_0x5e0044||0xc8;return function(_0x4a2f36){if(_0x4a2f36){return _0x276d69[_0x3188('0x1b')](_0x5e0044)['json'](_0x4a2f36);}};}function respondWithFilteredResult(_0x54a87f,_0x32c239){return function(_0x1beead){if(_0x1beead){var _0xa2269=typeof _0x32c239[_0x3188('0x1c')]===_0x3188('0x1d')&&typeof _0x32c239[_0x3188('0x1e')]==='undefined';var _0x19cc72=_0x1beead[_0x3188('0x1f')];var _0x3f5b35=_0xa2269?0x0:_0x32c239[_0x3188('0x1c')];var _0x18a71a=_0xa2269?_0x1beead[_0x3188('0x1f')]:_0x32c239[_0x3188('0x1c')]+_0x32c239[_0x3188('0x1e')];var _0x5bcbba;if(_0x18a71a>=_0x19cc72){_0x18a71a=_0x19cc72;_0x5bcbba=0xc8;}else{_0x5bcbba=0xce;}_0x54a87f[_0x3188('0x1b')](_0x5bcbba);return _0x54a87f[_0x3188('0x20')]('Content-Range',_0x3f5b35+'-'+_0x18a71a+'/'+_0x19cc72)['json'](_0x1beead);}return null;};}function patchUpdates(_0x5d8d62){return function(_0x46a318){try{jsonpatch[_0x3188('0x21')](_0x46a318,_0x5d8d62,!![]);}catch(_0xd292b5){return BPromise['reject'](_0xd292b5);}return _0x46a318['save']();};}function saveUpdates(_0x266260,_0x461286){return function(_0x375077){if(_0x375077){return _0x375077[_0x3188('0x22')](_0x266260)[_0x3188('0x23')](function(_0x4bd5ee){return _0x4bd5ee;});}return null;};}function removeEntity(_0x30cf2c,_0x33f882){return function(_0x5a2e67){if(_0x5a2e67){return _0x5a2e67[_0x3188('0x24')]()['then'](function(){_0x30cf2c['status'](0xcc)[_0x3188('0x25')]();});}};}function handleEntityNotFound(_0x129bd7,_0x87d5a3){return function(_0x1aeaba){if(!_0x1aeaba){_0x129bd7[_0x3188('0x1a')](0x194);}return _0x1aeaba;};}function handleError(_0x2cd060,_0xe57f73){_0xe57f73=_0xe57f73||0x1f4;return function(_0x11021c){logger['error'](_0x11021c[_0x3188('0x26')]);if(_0x11021c[_0x3188('0x27')]){delete _0x11021c['name'];}_0x2cd060[_0x3188('0x1b')](_0xe57f73)[_0x3188('0x28')](_0x11021c);};}exports[_0x3188('0x29')]=function(_0x44db9a,_0x20e6aa){var _0x1f1c6f={},_0x8f810f={},_0x472926={'count':0x0,'rows':[]};var _0x57c21c=_[_0x3188('0x2a')](db['Integration'][_0x3188('0x2b')],function(_0x5623f1){return{'name':_0x5623f1[_0x3188('0x2c')],'type':_0x5623f1[_0x3188('0x2d')][_0x3188('0x2e')]};});_0x8f810f[_0x3188('0x2f')]=_[_0x3188('0x2a')](_0x57c21c,_0x3188('0x27'));_0x8f810f[_0x3188('0x30')]=_[_0x3188('0x31')](_0x44db9a[_0x3188('0x30')]);_0x8f810f[_0x3188('0x32')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],_0x8f810f[_0x3188('0x30')]);_0x1f1c6f[_0x3188('0x34')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],qs[_0x3188('0x35')](_0x44db9a[_0x3188('0x30')]['fields']));_0x1f1c6f[_0x3188('0x34')]=_0x1f1c6f['attributes'][_0x3188('0x36')]?_0x1f1c6f[_0x3188('0x34')]:_0x8f810f['model'];if(!_0x44db9a[_0x3188('0x30')][_0x3188('0x37')](_0x3188('0x38'))){_0x1f1c6f[_0x3188('0x1e')]=qs[_0x3188('0x1e')](_0x44db9a[_0x3188('0x30')][_0x3188('0x1e')]);_0x1f1c6f['offset']=qs['offset'](_0x44db9a[_0x3188('0x30')][_0x3188('0x1c')]);}_0x1f1c6f[_0x3188('0x39')]=qs[_0x3188('0x3a')](_0x44db9a['query'][_0x3188('0x3a')]);_0x1f1c6f[_0x3188('0x3b')]=qs[_0x3188('0x32')](_[_0x3188('0x3c')](_0x44db9a['query'],_0x8f810f[_0x3188('0x32')]),_0x57c21c);if(_0x44db9a['query'][_0x3188('0x3d')]){_0x1f1c6f['where']=_[_0x3188('0x3e')](_0x1f1c6f[_0x3188('0x3b')],{'$or':_[_0x3188('0x2a')](_0x57c21c,function(_0x2990c4){if(_0x2990c4[_0x3188('0x2d')]!==_0x3188('0x3f')){var _0x4666b2={};_0x4666b2[_0x2990c4[_0x3188('0x27')]]={'$like':'%'+_0x44db9a[_0x3188('0x30')][_0x3188('0x3d')]+'%'};return _0x4666b2;}})});}_0x1f1c6f=_['merge']({},_0x1f1c6f,_0x44db9a[_0x3188('0x40')]);var _0x2bad0f={'where':_0x1f1c6f[_0x3188('0x3b')]};return db[_0x3188('0x41')][_0x3188('0x1f')](_0x2bad0f)[_0x3188('0x23')](function(_0x5a815d){_0x472926[_0x3188('0x1f')]=_0x5a815d;if(_0x44db9a['query'][_0x3188('0x42')]){_0x1f1c6f[_0x3188('0x43')]=[{'all':!![]}];}return db[_0x3188('0x41')][_0x3188('0x44')](_0x1f1c6f);})[_0x3188('0x23')](function(_0x549ab2){_0x472926['rows']=_0x549ab2;return _0x472926;})['then'](respondWithFilteredResult(_0x20e6aa,_0x1f1c6f))['catch'](handleError(_0x20e6aa,null));};exports['show']=function(_0x763943,_0x28c224){var _0x3e5f90={'raw':![],'where':{'id':_0x763943[_0x3188('0x45')]['id']}},_0x1b40b1={};_0x1b40b1['model']=_[_0x3188('0x31')](db['Integration'][_0x3188('0x2b')]);_0x1b40b1[_0x3188('0x30')]=_[_0x3188('0x31')](_0x763943[_0x3188('0x30')]);_0x1b40b1['filters']=_[_0x3188('0x33')](_0x1b40b1[_0x3188('0x2f')],_0x1b40b1[_0x3188('0x30')]);_0x3e5f90[_0x3188('0x34')]=_[_0x3188('0x33')](_0x1b40b1['model'],qs['fields'](_0x763943[_0x3188('0x30')][_0x3188('0x35')]));_0x3e5f90['attributes']=_0x3e5f90[_0x3188('0x34')][_0x3188('0x36')]?_0x3e5f90['attributes']:_0x1b40b1[_0x3188('0x2f')];if(_0x763943[_0x3188('0x30')][_0x3188('0x42')]){_0x3e5f90[_0x3188('0x43')]=[{'all':!![]}];}_0x3e5f90=_[_0x3188('0x3e')]({},_0x3e5f90,_0x763943['options']);return db[_0x3188('0x41')]['find'](_0x3e5f90)[_0x3188('0x23')](handleEntityNotFound(_0x28c224,null))[_0x3188('0x23')](respondWithResult(_0x28c224,null))[_0x3188('0x46')](handleError(_0x28c224,null));};exports[_0x3188('0x47')]=function(_0xe4cbb0,_0x315524){return db[_0x3188('0x41')][_0x3188('0x47')](_0xe4cbb0[_0x3188('0x48')],{})[_0x3188('0x23')](respondWithResult(_0x315524,0xc9))[_0x3188('0x46')](handleError(_0x315524,null));};exports['update']=function(_0x50fd56,_0x1b012d){if(_0x50fd56['body']['id']){delete _0x50fd56[_0x3188('0x48')]['id'];}return db[_0x3188('0x41')]['find']({'where':{'id':_0x50fd56[_0x3188('0x45')]['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x1b012d,null))[_0x3188('0x23')](saveUpdates(_0x50fd56[_0x3188('0x48')],null))[_0x3188('0x23')](respondWithResult(_0x1b012d,null))[_0x3188('0x46')](handleError(_0x1b012d,null));};exports[_0x3188('0x24')]=function(_0x1e3592,_0x59a177){return db[_0x3188('0x41')][_0x3188('0x49')]({'where':{'id':_0x1e3592['params']['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x59a177,null))['then'](removeEntity(_0x59a177,null))[_0x3188('0x46')](handleError(_0x59a177,null));}; \ No newline at end of file +var _0x4819=['bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','map','Integration','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','include','catch','show','keys','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4819,0xcd));var _0x9481=function(_0x4276aa,_0xbdba9b){_0x4276aa=_0x4276aa-0x0;var _0x2c49f8=_0x4819[_0x4276aa];return _0x2c49f8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9481('0x0'));var zipdir=require(_0x9481('0x1'));var jsonpatch=require(_0x9481('0x2'));var rp=require(_0x9481('0x3'));var moment=require(_0x9481('0x4'));var BPromise=require(_0x9481('0x5'));var Mustache=require(_0x9481('0x6'));var util=require(_0x9481('0x7'));var path=require(_0x9481('0x8'));var sox=require(_0x9481('0x9'));var csv=require('to-csv');var ejs=require(_0x9481('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9481('0xb'));var crypto=require(_0x9481('0xc'));var jsforce=require(_0x9481('0xd'));var deskjs=require(_0x9481('0xe'));var toCsv=require(_0x9481('0xf'));var querystring=require('querystring');var Papa=require(_0x9481('0x10'));var Redis=require('ioredis');var authService=require(_0x9481('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9481('0x12'));var hardwareService=require(_0x9481('0x13'));var logger=require(_0x9481('0x14'))(_0x9481('0x15'));var utils=require(_0x9481('0x16'));var config=require(_0x9481('0x17'));var licenseUtil=require(_0x9481('0x18'));var db=require(_0x9481('0x19'))['db'];function respondWithStatusCode(_0xed8e9,_0x499b87){_0x499b87=_0x499b87||0xcc;return function(_0x5aac02){if(_0x5aac02){return _0xed8e9[_0x9481('0x1a')](_0x499b87);}return _0xed8e9[_0x9481('0x1b')](_0x499b87)[_0x9481('0x1c')]();};}function respondWithResult(_0x28fcb6,_0x3d23c2){_0x3d23c2=_0x3d23c2||0xc8;return function(_0xc7a0b5){if(_0xc7a0b5){return _0x28fcb6[_0x9481('0x1b')](_0x3d23c2)['json'](_0xc7a0b5);}};}function respondWithFilteredResult(_0x4220f1,_0x7a7ee){return function(_0x5b1fe6){if(_0x5b1fe6){var _0x2266d5=typeof _0x7a7ee['offset']===_0x9481('0x1d')&&typeof _0x7a7ee[_0x9481('0x1e')]===_0x9481('0x1d');var _0x2bb2a4=_0x5b1fe6['count'];var _0x5eda66=_0x2266d5?0x0:_0x7a7ee[_0x9481('0x1f')];var _0x50a559=_0x2266d5?_0x5b1fe6['count']:_0x7a7ee[_0x9481('0x1f')]+_0x7a7ee[_0x9481('0x1e')];var _0x18c6f5;if(_0x50a559>=_0x2bb2a4){_0x50a559=_0x2bb2a4;_0x18c6f5=0xc8;}else{_0x18c6f5=0xce;}_0x4220f1[_0x9481('0x1b')](_0x18c6f5);return _0x4220f1[_0x9481('0x20')](_0x9481('0x21'),_0x5eda66+'-'+_0x50a559+'/'+_0x2bb2a4)['json'](_0x5b1fe6);}return null;};}function patchUpdates(_0x2cf1aa){return function(_0x272a84){try{jsonpatch[_0x9481('0x22')](_0x272a84,_0x2cf1aa,!![]);}catch(_0x615e02){return BPromise[_0x9481('0x23')](_0x615e02);}return _0x272a84['save']();};}function saveUpdates(_0x215dd7,_0x294908){return function(_0x572599){if(_0x572599){return _0x572599[_0x9481('0x24')](_0x215dd7)[_0x9481('0x25')](function(_0x352b3a){return _0x352b3a;});}return null;};}function removeEntity(_0x1809d2,_0x2dc02e){return function(_0x49ecfa){if(_0x49ecfa){return _0x49ecfa[_0x9481('0x26')]()[_0x9481('0x25')](function(){_0x1809d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12b0c3,_0x299e28){return function(_0x550fce){if(!_0x550fce){_0x12b0c3[_0x9481('0x1a')](0x194);}return _0x550fce;};}function handleError(_0x20ff9a,_0xeff0a5){_0xeff0a5=_0xeff0a5||0x1f4;return function(_0x28ae1b){logger['error'](_0x28ae1b[_0x9481('0x27')]);if(_0x28ae1b[_0x9481('0x28')]){delete _0x28ae1b[_0x9481('0x28')];}_0x20ff9a['status'](_0xeff0a5)[_0x9481('0x29')](_0x28ae1b);};}exports['index']=function(_0x2e1eff,_0xe153ab){var _0x22ab26={},_0x13ef93={},_0x2e5e63={'count':0x0,'rows':[]};var _0x53560d=_[_0x9481('0x2a')](db[_0x9481('0x2b')][_0x9481('0x2c')],function(_0x4895a0){return{'name':_0x4895a0['fieldName'],'type':_0x4895a0[_0x9481('0x2d')][_0x9481('0x2e')]};});_0x13ef93[_0x9481('0x2f')]=_[_0x9481('0x2a')](_0x53560d,'name');_0x13ef93['query']=_['keys'](_0x2e1eff[_0x9481('0x30')]);_0x13ef93['filters']=_[_0x9481('0x31')](_0x13ef93['model'],_0x13ef93[_0x9481('0x30')]);_0x22ab26[_0x9481('0x32')]=_[_0x9481('0x31')](_0x13ef93[_0x9481('0x2f')],qs[_0x9481('0x33')](_0x2e1eff['query'][_0x9481('0x33')]));_0x22ab26[_0x9481('0x32')]=_0x22ab26[_0x9481('0x32')]['length']?_0x22ab26[_0x9481('0x32')]:_0x13ef93[_0x9481('0x2f')];if(!_0x2e1eff[_0x9481('0x30')][_0x9481('0x34')](_0x9481('0x35'))){_0x22ab26[_0x9481('0x1e')]=qs['limit'](_0x2e1eff[_0x9481('0x30')]['limit']);_0x22ab26[_0x9481('0x1f')]=qs[_0x9481('0x1f')](_0x2e1eff[_0x9481('0x30')][_0x9481('0x1f')]);}_0x22ab26[_0x9481('0x36')]=qs[_0x9481('0x37')](_0x2e1eff['query'][_0x9481('0x37')]);_0x22ab26[_0x9481('0x38')]=qs['filters'](_['pick'](_0x2e1eff[_0x9481('0x30')],_0x13ef93['filters']),_0x53560d);if(_0x2e1eff[_0x9481('0x30')][_0x9481('0x39')]){_0x22ab26[_0x9481('0x38')]=_[_0x9481('0x3a')](_0x22ab26['where'],{'$or':_[_0x9481('0x2a')](_0x53560d,function(_0x590d50){if(_0x590d50[_0x9481('0x2d')]!=='VIRTUAL'){var _0x2ce972={};_0x2ce972[_0x590d50['name']]={'$like':'%'+_0x2e1eff[_0x9481('0x30')][_0x9481('0x39')]+'%'};return _0x2ce972;}})});}_0x22ab26=_[_0x9481('0x3a')]({},_0x22ab26,_0x2e1eff[_0x9481('0x3b')]);var _0x97dc3e={'where':_0x22ab26[_0x9481('0x38')]};return db[_0x9481('0x2b')]['count'](_0x97dc3e)[_0x9481('0x25')](function(_0x3857e8){_0x2e5e63[_0x9481('0x3c')]=_0x3857e8;if(_0x2e1eff[_0x9481('0x30')][_0x9481('0x3d')]){_0x22ab26[_0x9481('0x3e')]=[{'all':!![]}];}return db[_0x9481('0x2b')]['findAll'](_0x22ab26);})[_0x9481('0x25')](function(_0x1872ff){_0x2e5e63['rows']=_0x1872ff;return _0x2e5e63;})[_0x9481('0x25')](respondWithFilteredResult(_0xe153ab,_0x22ab26))[_0x9481('0x3f')](handleError(_0xe153ab,null));};exports[_0x9481('0x40')]=function(_0x3eb9ee,_0x29a8e9){var _0x5a8ffd={'raw':![],'where':{'id':_0x3eb9ee['params']['id']}},_0x304791={};_0x304791[_0x9481('0x2f')]=_[_0x9481('0x41')](db['Integration']['rawAttributes']);_0x304791[_0x9481('0x30')]=_[_0x9481('0x41')](_0x3eb9ee[_0x9481('0x30')]);_0x304791['filters']=_[_0x9481('0x31')](_0x304791[_0x9481('0x2f')],_0x304791['query']);_0x5a8ffd['attributes']=_[_0x9481('0x31')](_0x304791['model'],qs[_0x9481('0x33')](_0x3eb9ee[_0x9481('0x30')][_0x9481('0x33')]));_0x5a8ffd[_0x9481('0x32')]=_0x5a8ffd[_0x9481('0x32')]['length']?_0x5a8ffd[_0x9481('0x32')]:_0x304791[_0x9481('0x2f')];if(_0x3eb9ee['query'][_0x9481('0x3d')]){_0x5a8ffd[_0x9481('0x3e')]=[{'all':!![]}];}_0x5a8ffd=_[_0x9481('0x3a')]({},_0x5a8ffd,_0x3eb9ee[_0x9481('0x3b')]);return db[_0x9481('0x2b')][_0x9481('0x42')](_0x5a8ffd)[_0x9481('0x25')](handleEntityNotFound(_0x29a8e9,null))[_0x9481('0x25')](respondWithResult(_0x29a8e9,null))[_0x9481('0x3f')](handleError(_0x29a8e9,null));};exports['create']=function(_0xd36133,_0x5d3a06){return db['Integration'][_0x9481('0x43')](_0xd36133['body'],{})[_0x9481('0x25')](respondWithResult(_0x5d3a06,0xc9))[_0x9481('0x3f')](handleError(_0x5d3a06,null));};exports['update']=function(_0x277e2a,_0x1044a2){if(_0x277e2a[_0x9481('0x44')]['id']){delete _0x277e2a[_0x9481('0x44')]['id'];}return db[_0x9481('0x2b')][_0x9481('0x42')]({'where':{'id':_0x277e2a['params']['id']}})['then'](handleEntityNotFound(_0x1044a2,null))[_0x9481('0x25')](saveUpdates(_0x277e2a[_0x9481('0x44')],null))[_0x9481('0x25')](respondWithResult(_0x1044a2,null))[_0x9481('0x3f')](handleError(_0x1044a2,null));};exports[_0x9481('0x26')]=function(_0x353aab,_0x1c070c){return db[_0x9481('0x2b')]['find']({'where':{'id':_0x353aab[_0x9481('0x45')]['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x1c070c,null))[_0x9481('0x25')](removeEntity(_0x1c070c,null))[_0x9481('0x3f')](handleError(_0x1c070c,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 158e7f5..b91c2f8 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 _0x6cd1=['bluebird','request-promise','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','util','../../config/logger','api','moment'];(function(_0x14a0a0,_0x45d0cf){var _0x56b651=function(_0x1fae09){while(--_0x1fae09){_0x14a0a0['push'](_0x14a0a0['shift']());}};_0x56b651(++_0x45d0cf);}(_0x6cd1,0x1e8));var _0x16cd=function(_0x32cd29,_0x29f6bb){_0x32cd29=_0x32cd29-0x0;var _0x2f7e6e=_0x6cd1[_0x32cd29];return _0x2f7e6e;};'use strict';var _=require('lodash');var util=require(_0x16cd('0x0'));var logger=require(_0x16cd('0x1'))(_0x16cd('0x2'));var moment=require(_0x16cd('0x3'));var BPromise=require(_0x16cd('0x4'));var rp=require(_0x16cd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x16cd('0x6'));var config=require(_0x16cd('0x7'));var attributes=require(_0x16cd('0x8'));module[_0x16cd('0x9')]=function(_0x5a3bb0,_0xb4c63a){return _0x5a3bb0[_0x16cd('0xa')](_0x16cd('0xb'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x217b=['integrations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration'];(function(_0x95bf5d,_0x43839b){var _0x29a35f=function(_0x2e94d5){while(--_0x2e94d5){_0x95bf5d['push'](_0x95bf5d['shift']());}};_0x29a35f(++_0x43839b);}(_0x217b,0xc5));var _0xb217=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x217b[_0x31ced5];return _0x10d9e5;};'use strict';var _=require(_0xb217('0x0'));var util=require(_0xb217('0x1'));var logger=require(_0xb217('0x2'))(_0xb217('0x3'));var moment=require(_0xb217('0x4'));var BPromise=require(_0xb217('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb217('0x6'));var rimraf=require(_0xb217('0x7'));var config=require(_0xb217('0x8'));var attributes=require(_0xb217('0x9'));module[_0xb217('0xa')]=function(_0x3ba991,_0x3be347){return _0x3ba991[_0xb217('0xb')](_0xb217('0xc'),attributes,{'tableName':_0xb217('0xd'),'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 40658d6..be9ea8f 100644 --- a/server/api/integration/integration.rpc.js +++ b/server/api/integration/integration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x4ac424,_0x554b5d){var _0xe1b890=function(_0x5e85c4){while(--_0x5e85c4){_0x4ac424['push'](_0x4ac424['shift']());}};_0xe1b890(++_0x554b5d);}(_0x524e,0x15e));var _0xe524=function(_0x570a14,_0x509ac9){_0x570a14=_0x570a14-0x0;var _0x3cfaea=_0x524e[_0x570a14];return _0x3cfaea;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('Integration,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('Integration,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('Integration,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file +var _0x0295=['client','http','then','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','Integration,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2d7859,_0x22d119){var _0x492f31=function(_0x32e2fc){while(--_0x32e2fc){_0x2d7859['push'](_0x2d7859['shift']());}};_0x492f31(++_0x22d119);}(_0x0295,0x1f0));var _0x5029=function(_0x25ada9,_0x5f0e07){_0x25ada9=_0x25ada9-0x0;var _0x59e1ab=_0x0295[_0x25ada9];return _0x59e1ab;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('Integration,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 4cda098..7939fcd 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 _0x66fa=['index','get','/describe','post','/:id','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x9fc5a2,_0x46c38f){var _0x10a4a8=function(_0x2aeef2){while(--_0x2aeef2){_0x9fc5a2['push'](_0x9fc5a2['shift']());}};_0x10a4a8(++_0x46c38f);}(_0x66fa,0x117));var _0xa66f=function(_0x1c9f37,_0x21f275){_0x1c9f37=_0x1c9f37-0x0;var _0x4899f8=_0x66fa[_0x1c9f37];return _0x4899f8;};'use strict';var multer=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var path=require('path');var timeout=require(_0xa66f('0x2'));var express=require(_0xa66f('0x3'));var router=express[_0xa66f('0x4')]();var fs_extra=require(_0xa66f('0x5'));var auth=require(_0xa66f('0x6'));var interaction=require(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var controller=require('./integrationReport.controller');router['get']('/',auth[_0xa66f('0x9')](),controller[_0xa66f('0xa')]);router[_0xa66f('0xb')](_0xa66f('0xc'),auth[_0xa66f('0x9')](),controller['describe']);router[_0xa66f('0xb')]('/:id',auth[_0xa66f('0x9')](),controller['show']);router[_0xa66f('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa66f('0xe'),auth[_0xa66f('0x9')](),controller['update']);router[_0xa66f('0xf')]('/:id',auth[_0xa66f('0x9')](),controller['destroy']);module[_0xa66f('0x10')]=router; \ No newline at end of file +var _0x0295=['isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x0295,0x1f0));var _0x5029=function(_0x35d06e,_0x2e3503){_0x35d06e=_0x35d06e-0x0;var _0x9e9053=_0x0295[_0x35d06e];return _0x9e9053;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5029('0x2'));var auth=require(_0x5029('0x3'));var interaction=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var controller=require(_0x5029('0x6'));router[_0x5029('0x7')]('/',auth[_0x5029('0x8')](),controller[_0x5029('0x9')]);router[_0x5029('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x5029('0x7')]('/:id',auth[_0x5029('0x8')](),controller['show']);router[_0x5029('0xa')]('/',auth['isAuthenticated'](),controller[_0x5029('0xb')]);router[_0x5029('0xc')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0xe')]);router[_0x5029('0xf')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0x10')]);module[_0x5029('0x11')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index e63e7bf..a1a5119 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 _0xd777=['RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING'];(function(_0x4ccad8,_0x1b2209){var _0x553f9f=function(_0x1f4ed4){while(--_0x1f4ed4){_0x4ccad8['push'](_0x4ccad8['shift']());}};_0x553f9f(++_0x1b2209);}(_0xd777,0x86));var _0x7d77=function(_0x497880,_0x430dbc){_0x497880=_0x497880-0x0;var _0x1a3d4b=_0xd777[_0x497880];return _0x1a3d4b;};'use strict';var Sequelize=require(_0x7d77('0x0'));module[_0x7d77('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x7d77('0x2')]},'ticketId':{'type':Sequelize[_0x7d77('0x2')]},'integrationId':{'type':Sequelize[_0x7d77('0x3')]},'contacts':{'type':Sequelize[_0x7d77('0x2')]},'uniqueid':{'type':Sequelize[_0x7d77('0x2')]},'calleridnum':{'type':Sequelize[_0x7d77('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7d77('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x7d77('0x4')]},'agentconnectAt':{'type':Sequelize[_0x7d77('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x7d77('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x7d77('0x4')]},'talktime':{'type':Sequelize[_0x7d77('0x3')]},'agentacw':{'type':Sequelize[_0x7d77('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7d77('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x7d77('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x7d77('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x7d77('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7d77('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x7d77('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7d77('0x2')]},'connectedlinename':{'type':Sequelize[_0x7d77('0x2')]},'language':{'type':Sequelize[_0x7d77('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x7d77('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x7d77('0x2')]},'destchannelstate':{'type':Sequelize[_0x7d77('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x7d77('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x7d77('0x2')]},'destlanguage':{'type':Sequelize[_0x7d77('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x7d77('0x2')]},'destpriority':{'type':Sequelize[_0x7d77('0x2')]},'destuniqueid':{'type':Sequelize[_0x7d77('0x2')]},'messageId':{'type':Sequelize[_0x7d77('0x2')]},'inReplyTo':{'type':Sequelize[_0x7d77('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x7d77('0x6')]},'text':{'type':Sequelize[_0x7d77('0x6')]},'status':{'type':Sequelize[_0x7d77('0x7')](_0x7d77('0x8'),_0x7d77('0x9'),_0x7d77('0xa'),_0x7d77('0xb'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x7d77('0x2')]},'appdata':{'type':Sequelize[_0x7d77('0x2')]},'projectId':{'type':Sequelize[_0x7d77('0x3')]}}; \ No newline at end of file +var _0x8557=['INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','FAILED','sequelize','exports','STRING'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x8557,0x129));var _0x7855=function(_0x147c96,_0x309657){_0x147c96=_0x147c96-0x0;var _0x4ec711=_0x8557[_0x147c96];return _0x4ec711;};'use strict';var Sequelize=require(_0x7855('0x0'));module[_0x7855('0x1')]={'integration':{'type':Sequelize[_0x7855('0x2')]},'eventChannel':{'type':Sequelize[_0x7855('0x2')]},'exitStatus':{'type':Sequelize[_0x7855('0x2')]},'ticketId':{'type':Sequelize[_0x7855('0x2')]},'integrationId':{'type':Sequelize[_0x7855('0x3')]},'contacts':{'type':Sequelize[_0x7855('0x2')]},'uniqueid':{'type':Sequelize[_0x7855('0x2')]},'calleridnum':{'type':Sequelize[_0x7855('0x2')]},'calleridname':{'type':Sequelize[_0x7855('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x7855('0x2')]},'membername':{'type':Sequelize[_0x7855('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x7855('0x4')]},'holdtime':{'type':Sequelize[_0x7855('0x3')]},'agentcomplete':{'type':Sequelize[_0x7855('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x7855('0x4')]},'talktime':{'type':Sequelize[_0x7855('0x3')]},'agentacw':{'type':Sequelize[_0x7855('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7855('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x7855('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x7855('0x4')]},'lastevent':{'type':Sequelize[_0x7855('0x2')]},'channel':{'type':Sequelize[_0x7855('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x7855('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7855('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7855('0x2')]},'accountcode':{'type':Sequelize[_0x7855('0x2')]},'context':{'type':Sequelize[_0x7855('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x7855('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x7855('0x2')]},'destcalleridnum':{'type':Sequelize[_0x7855('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x7855('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7855('0x2')]},'destlanguage':{'type':Sequelize[_0x7855('0x2')]},'destaccountcode':{'type':Sequelize[_0x7855('0x2')]},'destcontext':{'type':Sequelize[_0x7855('0x2')]},'destexten':{'type':Sequelize[_0x7855('0x2')]},'destpriority':{'type':Sequelize[_0x7855('0x2')]},'destuniqueid':{'type':Sequelize[_0x7855('0x2')]},'messageId':{'type':Sequelize[_0x7855('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x7855('0x2')]},'to':{'type':Sequelize[_0x7855('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x7855('0x6')]},'html':{'type':Sequelize[_0x7855('0x6')]},'text':{'type':Sequelize[_0x7855('0x6')]},'status':{'type':Sequelize[_0x7855('0x7')](_0x7855('0x8'),'SENDING','RECEIVED',_0x7855('0x9'))},'url':{'type':Sequelize[_0x7855('0x2')]},'app':{'type':Sequelize[_0x7855('0x2')]},'appdata':{'type':Sequelize[_0x7855('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 8fc9785..2debdc9 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 _0x4a7a=['rawAttributes','type','key','model','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','crypto','papaparse','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','IntegrationReport'];(function(_0x36f5e3,_0x1e755a){var _0x2d7aa9=function(_0x139b57){while(--_0x139b57){_0x36f5e3['push'](_0x36f5e3['shift']());}};_0x2d7aa9(++_0x1e755a);}(_0x4a7a,0x163));var _0xa4a7=function(_0x4f38a4,_0x3ed3a1){_0x4f38a4=_0x4f38a4-0x0;var _0x49e13d=_0x4a7a[_0x4f38a4];return _0x49e13d;};'use strict';var emlformat=require(_0xa4a7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa4a7('0x1'));var jsonpatch=require(_0xa4a7('0x2'));var rp=require(_0xa4a7('0x3'));var moment=require(_0xa4a7('0x4'));var BPromise=require(_0xa4a7('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa4a7('0x6'));var csv=require(_0xa4a7('0x7'));var ejs=require(_0xa4a7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa4a7('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa4a7('0xa'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa4a7('0xb'));var logger=require('../../config/logger')(_0xa4a7('0xc'));var utils=require(_0xa4a7('0xd'));var config=require(_0xa4a7('0xe'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54e4c7,_0x4ca7d2){_0x4ca7d2=_0x4ca7d2||0xcc;return function(_0x280582){if(_0x280582){return _0x54e4c7[_0xa4a7('0xf')](_0x4ca7d2);}return _0x54e4c7['status'](_0x4ca7d2)['end']();};}function respondWithResult(_0x41d619,_0x2e8933){_0x2e8933=_0x2e8933||0xc8;return function(_0x2da695){if(_0x2da695){return _0x41d619[_0xa4a7('0x10')](_0x2e8933)[_0xa4a7('0x11')](_0x2da695);}};}function respondWithFilteredResult(_0x58c0f1,_0x3892fc){return function(_0x27faeb){if(_0x27faeb){var _0x5d68d2=typeof _0x3892fc[_0xa4a7('0x12')]==='undefined'&&typeof _0x3892fc['limit']===_0xa4a7('0x13');var _0x4c8e4b=_0x27faeb['count'];var _0xbaa994=_0x5d68d2?0x0:_0x3892fc['offset'];var _0x38edd4=_0x5d68d2?_0x27faeb[_0xa4a7('0x14')]:_0x3892fc[_0xa4a7('0x12')]+_0x3892fc[_0xa4a7('0x15')];var _0x141bfd;if(_0x38edd4>=_0x4c8e4b){_0x38edd4=_0x4c8e4b;_0x141bfd=0xc8;}else{_0x141bfd=0xce;}_0x58c0f1[_0xa4a7('0x10')](_0x141bfd);return _0x58c0f1[_0xa4a7('0x16')](_0xa4a7('0x17'),_0xbaa994+'-'+_0x38edd4+'/'+_0x4c8e4b)[_0xa4a7('0x11')](_0x27faeb);}return null;};}function patchUpdates(_0x4419e1){return function(_0x2a021e){try{jsonpatch[_0xa4a7('0x18')](_0x2a021e,_0x4419e1,!![]);}catch(_0x19ab3a){return BPromise[_0xa4a7('0x19')](_0x19ab3a);}return _0x2a021e[_0xa4a7('0x1a')]();};}function saveUpdates(_0x1be19b,_0x1465cc){return function(_0x282b71){if(_0x282b71){return _0x282b71['update'](_0x1be19b)[_0xa4a7('0x1b')](function(_0x1a1e07){return _0x1a1e07;});}return null;};}function removeEntity(_0x16f3a4,_0x164d48){return function(_0x4e4ad9){if(_0x4e4ad9){return _0x4e4ad9[_0xa4a7('0x1c')]()[_0xa4a7('0x1b')](function(){_0x16f3a4[_0xa4a7('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x444771,_0x3fe8eb){return function(_0xc9bbf8){if(!_0xc9bbf8){_0x444771[_0xa4a7('0xf')](0x194);}return _0xc9bbf8;};}function handleError(_0x84dd71,_0x3f88c1){_0x3f88c1=_0x3f88c1||0x1f4;return function(_0x538d24){logger[_0xa4a7('0x1d')](_0x538d24[_0xa4a7('0x1e')]);if(_0x538d24[_0xa4a7('0x1f')]){delete _0x538d24['name'];}_0x84dd71[_0xa4a7('0x10')](_0x3f88c1)['send'](_0x538d24);};}exports[_0xa4a7('0x20')]=function(_0x56f7f8,_0x2867c8){var _0x51fc8a={},_0x3b29ea={},_0x10ae3d={'count':0x0,'rows':[]};var _0xc2e8cb=_[_0xa4a7('0x21')](db[_0xa4a7('0x22')][_0xa4a7('0x23')],function(_0x590831){return{'name':_0x590831['fieldName'],'type':_0x590831[_0xa4a7('0x24')][_0xa4a7('0x25')]};});_0x3b29ea[_0xa4a7('0x26')]=_[_0xa4a7('0x21')](_0xc2e8cb,'name');_0x3b29ea['query']=_[_0xa4a7('0x27')](_0x56f7f8[_0xa4a7('0x28')]);_0x3b29ea['filters']=_[_0xa4a7('0x29')](_0x3b29ea[_0xa4a7('0x26')],_0x3b29ea[_0xa4a7('0x28')]);_0x51fc8a['attributes']=_[_0xa4a7('0x29')](_0x3b29ea[_0xa4a7('0x26')],qs['fields'](_0x56f7f8['query']['fields']));_0x51fc8a[_0xa4a7('0x2a')]=_0x51fc8a[_0xa4a7('0x2a')][_0xa4a7('0x2b')]?_0x51fc8a[_0xa4a7('0x2a')]:_0x3b29ea[_0xa4a7('0x26')];if(!_0x56f7f8[_0xa4a7('0x28')][_0xa4a7('0x2c')](_0xa4a7('0x2d'))){_0x51fc8a['limit']=qs[_0xa4a7('0x15')](_0x56f7f8[_0xa4a7('0x28')][_0xa4a7('0x15')]);_0x51fc8a[_0xa4a7('0x12')]=qs[_0xa4a7('0x12')](_0x56f7f8['query'][_0xa4a7('0x12')]);}_0x51fc8a[_0xa4a7('0x2e')]=qs[_0xa4a7('0x2f')](_0x56f7f8[_0xa4a7('0x28')][_0xa4a7('0x2f')]);_0x51fc8a[_0xa4a7('0x30')]=qs[_0xa4a7('0x31')](_['pick'](_0x56f7f8[_0xa4a7('0x28')],_0x3b29ea['filters']),_0xc2e8cb);if(_0x56f7f8[_0xa4a7('0x28')][_0xa4a7('0x32')]){_0x51fc8a[_0xa4a7('0x30')]=_[_0xa4a7('0x33')](_0x51fc8a[_0xa4a7('0x30')],{'$or':_[_0xa4a7('0x21')](_0xc2e8cb,function(_0x583173){if(_0x583173['type']!==_0xa4a7('0x34')){var _0x4233dd={};_0x4233dd[_0x583173[_0xa4a7('0x1f')]]={'$like':'%'+_0x56f7f8['query']['filter']+'%'};return _0x4233dd;}})});}_0x51fc8a=_[_0xa4a7('0x33')]({},_0x51fc8a,_0x56f7f8[_0xa4a7('0x35')]);var _0x5ea742={'where':_0x51fc8a[_0xa4a7('0x30')]};return db[_0xa4a7('0x22')]['count'](_0x5ea742)[_0xa4a7('0x1b')](function(_0x5a13aa){_0x10ae3d[_0xa4a7('0x14')]=_0x5a13aa;if(_0x56f7f8['query'][_0xa4a7('0x36')]){_0x51fc8a['include']=[{'all':!![]}];}return db['IntegrationReport'][_0xa4a7('0x37')](_0x51fc8a);})[_0xa4a7('0x1b')](function(_0x2fa338){_0x10ae3d[_0xa4a7('0x38')]=_0x2fa338;return _0x10ae3d;})[_0xa4a7('0x1b')](respondWithFilteredResult(_0x2867c8,_0x51fc8a))[_0xa4a7('0x39')](handleError(_0x2867c8,null));};exports[_0xa4a7('0x3a')]=function(_0xfce3eb,_0x4a88a0){var _0x3d067c={'raw':![],'where':{'id':_0xfce3eb[_0xa4a7('0x3b')]['id']}},_0x2d8b96={};_0x2d8b96[_0xa4a7('0x26')]=_[_0xa4a7('0x27')](db[_0xa4a7('0x22')]['rawAttributes']);_0x2d8b96[_0xa4a7('0x28')]=_[_0xa4a7('0x27')](_0xfce3eb[_0xa4a7('0x28')]);_0x2d8b96[_0xa4a7('0x31')]=_[_0xa4a7('0x29')](_0x2d8b96[_0xa4a7('0x26')],_0x2d8b96['query']);_0x3d067c[_0xa4a7('0x2a')]=_['intersection'](_0x2d8b96[_0xa4a7('0x26')],qs['fields'](_0xfce3eb['query']['fields']));_0x3d067c[_0xa4a7('0x2a')]=_0x3d067c[_0xa4a7('0x2a')][_0xa4a7('0x2b')]?_0x3d067c[_0xa4a7('0x2a')]:_0x2d8b96[_0xa4a7('0x26')];if(_0xfce3eb['query']['includeAll']){_0x3d067c['include']=[{'all':!![]}];}_0x3d067c=_[_0xa4a7('0x33')]({},_0x3d067c,_0xfce3eb[_0xa4a7('0x35')]);return db[_0xa4a7('0x22')][_0xa4a7('0x3c')](_0x3d067c)[_0xa4a7('0x1b')](handleEntityNotFound(_0x4a88a0,null))[_0xa4a7('0x1b')](respondWithResult(_0x4a88a0,null))['catch'](handleError(_0x4a88a0,null));};exports[_0xa4a7('0x3d')]=function(_0x53d488,_0x49fb0b){return db[_0xa4a7('0x22')][_0xa4a7('0x3d')](_0x53d488[_0xa4a7('0x3e')],{})[_0xa4a7('0x1b')](respondWithResult(_0x49fb0b,0xc9))[_0xa4a7('0x39')](handleError(_0x49fb0b,null));};exports[_0xa4a7('0x3f')]=function(_0x4916,_0x1a3f6d){if(_0x4916[_0xa4a7('0x3e')]['id']){delete _0x4916[_0xa4a7('0x3e')]['id'];}return db[_0xa4a7('0x22')][_0xa4a7('0x3c')]({'where':{'id':_0x4916[_0xa4a7('0x3b')]['id']}})[_0xa4a7('0x1b')](handleEntityNotFound(_0x1a3f6d,null))[_0xa4a7('0x1b')](saveUpdates(_0x4916[_0xa4a7('0x3e')],null))['then'](respondWithResult(_0x1a3f6d,null))[_0xa4a7('0x39')](handleError(_0x1a3f6d,null));};exports[_0xa4a7('0x1c')]=function(_0x230d20,_0x837728){return db[_0xa4a7('0x22')][_0xa4a7('0x3c')]({'where':{'id':_0x230d20['params']['id']}})[_0xa4a7('0x1b')](handleEntityNotFound(_0x837728,null))[_0xa4a7('0x1b')](removeEntity(_0x837728,null))[_0xa4a7('0x39')](handleError(_0x837728,null));};exports[_0xa4a7('0x40')]=function(_0x2307cf,_0x310eb2){return db[_0xa4a7('0x22')][_0xa4a7('0x40')]()[_0xa4a7('0x1b')](respondWithResult(_0x310eb2,null))[_0xa4a7('0x39')](handleError(_0x310eb2,null));}; \ No newline at end of file +var _0x1093=['pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','intersection','include','find','create','body','params','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','end','json','offset','limit','undefined','count','status','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','IntegrationReport','rawAttributes','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','order','sort','where'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x1093,0xa4));var _0x3109=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x1093[_0x55abd9];return _0x3e5669;};'use strict';var emlformat=require(_0x3109('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3109('0x1'));var rp=require(_0x3109('0x2'));var moment=require(_0x3109('0x3'));var BPromise=require(_0x3109('0x4'));var Mustache=require(_0x3109('0x5'));var util=require(_0x3109('0x6'));var path=require(_0x3109('0x7'));var sox=require(_0x3109('0x8'));var csv=require(_0x3109('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3109('0xa'));var _=require(_0x3109('0xb'));var squel=require('squel');var crypto=require(_0x3109('0xc'));var jsforce=require(_0x3109('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3109('0x9'));var querystring=require(_0x3109('0xe'));var Papa=require(_0x3109('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3109('0x10'));var as=require(_0x3109('0x11'));var hardwareService=require(_0x3109('0x12'));var logger=require(_0x3109('0x13'))(_0x3109('0x14'));var utils=require(_0x3109('0x15'));var config=require(_0x3109('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13f785,_0x380e79){_0x380e79=_0x380e79||0xcc;return function(_0x38ca7f){if(_0x38ca7f){return _0x13f785['sendStatus'](_0x380e79);}return _0x13f785['status'](_0x380e79)[_0x3109('0x17')]();};}function respondWithResult(_0x490f57,_0x5e5348){_0x5e5348=_0x5e5348||0xc8;return function(_0x188b73){if(_0x188b73){return _0x490f57['status'](_0x5e5348)[_0x3109('0x18')](_0x188b73);}};}function respondWithFilteredResult(_0x113acf,_0x42d229){return function(_0x294bab){if(_0x294bab){var _0xd13c19=typeof _0x42d229[_0x3109('0x19')]==='undefined'&&typeof _0x42d229[_0x3109('0x1a')]===_0x3109('0x1b');var _0x37caf0=_0x294bab[_0x3109('0x1c')];var _0xf9acef=_0xd13c19?0x0:_0x42d229[_0x3109('0x19')];var _0x3c4fbd=_0xd13c19?_0x294bab['count']:_0x42d229[_0x3109('0x19')]+_0x42d229['limit'];var _0x2f6da8;if(_0x3c4fbd>=_0x37caf0){_0x3c4fbd=_0x37caf0;_0x2f6da8=0xc8;}else{_0x2f6da8=0xce;}_0x113acf[_0x3109('0x1d')](_0x2f6da8);return _0x113acf['set'](_0x3109('0x1e'),_0xf9acef+'-'+_0x3c4fbd+'/'+_0x37caf0)['json'](_0x294bab);}return null;};}function patchUpdates(_0x5c587c){return function(_0x4ec0e5){try{jsonpatch[_0x3109('0x1f')](_0x4ec0e5,_0x5c587c,!![]);}catch(_0x4f4648){return BPromise[_0x3109('0x20')](_0x4f4648);}return _0x4ec0e5[_0x3109('0x21')]();};}function saveUpdates(_0x277a95,_0x3d2c1d){return function(_0x473373){if(_0x473373){return _0x473373[_0x3109('0x22')](_0x277a95)[_0x3109('0x23')](function(_0x1e898a){return _0x1e898a;});}return null;};}function removeEntity(_0x1bb134,_0x53d6e8){return function(_0x19528b){if(_0x19528b){return _0x19528b[_0x3109('0x24')]()[_0x3109('0x23')](function(){_0x1bb134['status'](0xcc)[_0x3109('0x17')]();});}};}function handleEntityNotFound(_0x3611ef,_0x47b4ff){return function(_0x2ae201){if(!_0x2ae201){_0x3611ef[_0x3109('0x25')](0x194);}return _0x2ae201;};}function handleError(_0xd1c7be,_0x3f8b1a){_0x3f8b1a=_0x3f8b1a||0x1f4;return function(_0x2ec2b2){logger[_0x3109('0x26')](_0x2ec2b2['stack']);if(_0x2ec2b2[_0x3109('0x27')]){delete _0x2ec2b2[_0x3109('0x27')];}_0xd1c7be[_0x3109('0x1d')](_0x3f8b1a)[_0x3109('0x28')](_0x2ec2b2);};}exports[_0x3109('0x29')]=function(_0x2e93c2,_0x4c0324){var _0x5ea6ae={},_0x347688={},_0x40e042={'count':0x0,'rows':[]};var _0x59ae3b=_[_0x3109('0x2a')](db[_0x3109('0x2b')][_0x3109('0x2c')],function(_0x541238){return{'name':_0x541238['fieldName'],'type':_0x541238[_0x3109('0x2d')][_0x3109('0x2e')]};});_0x347688[_0x3109('0x2f')]=_[_0x3109('0x2a')](_0x59ae3b,_0x3109('0x27'));_0x347688[_0x3109('0x30')]=_[_0x3109('0x31')](_0x2e93c2[_0x3109('0x30')]);_0x347688[_0x3109('0x32')]=_['intersection'](_0x347688[_0x3109('0x2f')],_0x347688[_0x3109('0x30')]);_0x5ea6ae['attributes']=_['intersection'](_0x347688['model'],qs[_0x3109('0x33')](_0x2e93c2[_0x3109('0x30')]['fields']));_0x5ea6ae[_0x3109('0x34')]=_0x5ea6ae[_0x3109('0x34')][_0x3109('0x35')]?_0x5ea6ae[_0x3109('0x34')]:_0x347688['model'];if(!_0x2e93c2[_0x3109('0x30')][_0x3109('0x36')]('nolimit')){_0x5ea6ae[_0x3109('0x1a')]=qs[_0x3109('0x1a')](_0x2e93c2[_0x3109('0x30')][_0x3109('0x1a')]);_0x5ea6ae['offset']=qs[_0x3109('0x19')](_0x2e93c2['query'][_0x3109('0x19')]);}_0x5ea6ae[_0x3109('0x37')]=qs[_0x3109('0x38')](_0x2e93c2[_0x3109('0x30')][_0x3109('0x38')]);_0x5ea6ae[_0x3109('0x39')]=qs['filters'](_[_0x3109('0x3a')](_0x2e93c2[_0x3109('0x30')],_0x347688[_0x3109('0x32')]),_0x59ae3b);if(_0x2e93c2['query'][_0x3109('0x3b')]){_0x5ea6ae[_0x3109('0x39')]=_[_0x3109('0x3c')](_0x5ea6ae[_0x3109('0x39')],{'$or':_[_0x3109('0x2a')](_0x59ae3b,function(_0x202a9c){if(_0x202a9c[_0x3109('0x2d')]!==_0x3109('0x3d')){var _0x59a829={};_0x59a829[_0x202a9c[_0x3109('0x27')]]={'$like':'%'+_0x2e93c2[_0x3109('0x30')][_0x3109('0x3b')]+'%'};return _0x59a829;}})});}_0x5ea6ae=_[_0x3109('0x3c')]({},_0x5ea6ae,_0x2e93c2[_0x3109('0x3e')]);var _0x4953d5={'where':_0x5ea6ae[_0x3109('0x39')]};return db['IntegrationReport'][_0x3109('0x1c')](_0x4953d5)[_0x3109('0x23')](function(_0x1b34ea){_0x40e042[_0x3109('0x1c')]=_0x1b34ea;if(_0x2e93c2[_0x3109('0x30')][_0x3109('0x3f')]){_0x5ea6ae['include']=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x5ea6ae);})['then'](function(_0x42d925){_0x40e042[_0x3109('0x40')]=_0x42d925;return _0x40e042;})[_0x3109('0x23')](respondWithFilteredResult(_0x4c0324,_0x5ea6ae))[_0x3109('0x41')](handleError(_0x4c0324,null));};exports[_0x3109('0x42')]=function(_0x4723c8,_0x376c60){var _0x1200f4={'raw':![],'where':{'id':_0x4723c8['params']['id']}},_0x179a2d={};_0x179a2d[_0x3109('0x2f')]=_[_0x3109('0x31')](db[_0x3109('0x2b')][_0x3109('0x2c')]);_0x179a2d['query']=_[_0x3109('0x31')](_0x4723c8[_0x3109('0x30')]);_0x179a2d['filters']=_[_0x3109('0x43')](_0x179a2d['model'],_0x179a2d[_0x3109('0x30')]);_0x1200f4[_0x3109('0x34')]=_['intersection'](_0x179a2d['model'],qs['fields'](_0x4723c8['query'][_0x3109('0x33')]));_0x1200f4[_0x3109('0x34')]=_0x1200f4['attributes'][_0x3109('0x35')]?_0x1200f4['attributes']:_0x179a2d[_0x3109('0x2f')];if(_0x4723c8[_0x3109('0x30')][_0x3109('0x3f')]){_0x1200f4[_0x3109('0x44')]=[{'all':!![]}];}_0x1200f4=_[_0x3109('0x3c')]({},_0x1200f4,_0x4723c8['options']);return db[_0x3109('0x2b')][_0x3109('0x45')](_0x1200f4)[_0x3109('0x23')](handleEntityNotFound(_0x376c60,null))[_0x3109('0x23')](respondWithResult(_0x376c60,null))[_0x3109('0x41')](handleError(_0x376c60,null));};exports[_0x3109('0x46')]=function(_0x45af0f,_0x2964d7){return db[_0x3109('0x2b')]['create'](_0x45af0f[_0x3109('0x47')],{})[_0x3109('0x23')](respondWithResult(_0x2964d7,0xc9))['catch'](handleError(_0x2964d7,null));};exports['update']=function(_0x145bc7,_0x22775d){if(_0x145bc7[_0x3109('0x47')]['id']){delete _0x145bc7['body']['id'];}return db['IntegrationReport'][_0x3109('0x45')]({'where':{'id':_0x145bc7[_0x3109('0x48')]['id']}})['then'](handleEntityNotFound(_0x22775d,null))[_0x3109('0x23')](saveUpdates(_0x145bc7[_0x3109('0x47')],null))['then'](respondWithResult(_0x22775d,null))[_0x3109('0x41')](handleError(_0x22775d,null));};exports[_0x3109('0x24')]=function(_0x117bc9,_0x31fba7){return db['IntegrationReport'][_0x3109('0x45')]({'where':{'id':_0x117bc9[_0x3109('0x48')]['id']}})[_0x3109('0x23')](handleEntityNotFound(_0x31fba7,null))['then'](removeEntity(_0x31fba7,null))[_0x3109('0x41')](handleError(_0x31fba7,null));};exports[_0x3109('0x49')]=function(_0x429c87,_0x4984bf){return db['IntegrationReport'][_0x3109('0x49')]()[_0x3109('0x23')](respondWithResult(_0x4984bf,null))[_0x3109('0x41')](handleError(_0x4984bf,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 59c43aa..629c791 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 _0x72a5=['moment','bluebird','path','define','IntegrationReport','report_integration','util','../../config/logger','api'];(function(_0x2aba5f,_0x5704a4){var _0x132437=function(_0x288416){while(--_0x288416){_0x2aba5f['push'](_0x2aba5f['shift']());}};_0x132437(++_0x5704a4);}(_0x72a5,0x192));var _0x572a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x72a5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x572a('0x0'));var logger=require(_0x572a('0x1'))(_0x572a('0x2'));var moment=require(_0x572a('0x3'));var BPromise=require(_0x572a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x572a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module['exports']=function(_0xe4931e,_0x3d008a){return _0xe4931e[_0x572a('0x6')](_0x572a('0x7'),attributes,{'tableName':_0x572a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80f1=['report_integration','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','IntegrationReport'];(function(_0x47ff05,_0x2d59c1){var _0x3983e1=function(_0xa0bce8){while(--_0xa0bce8){_0x47ff05['push'](_0x47ff05['shift']());}};_0x3983e1(++_0x2d59c1);}(_0x80f1,0x12c));var _0x180f=function(_0xcb798d,_0x30aaf4){_0xcb798d=_0xcb798d-0x0;var _0x31b355=_0x80f1[_0xcb798d];return _0x31b355;};'use strict';var _=require(_0x180f('0x0'));var util=require(_0x180f('0x1'));var logger=require(_0x180f('0x2'))(_0x180f('0x3'));var moment=require('moment');var BPromise=require(_0x180f('0x4'));var rp=require(_0x180f('0x5'));var fs=require('fs');var path=require(_0x180f('0x6'));var rimraf=require(_0x180f('0x7'));var config=require(_0x180f('0x8'));var attributes=require('./integrationReport.attributes');module[_0x180f('0x9')]=function(_0x219891,_0x20e6fb){return _0x219891[_0x180f('0xa')](_0x180f('0xb'),attributes,{'tableName':_0x180f('0xc'),'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 38971d3..df5106e 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 _0x31f0=['../../config/environment','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x5c9b55,_0x5befc4){var _0x113969=function(_0x5a404d){while(--_0x5a404d){_0x5c9b55['push'](_0x5c9b55['shift']());}};_0x113969(++_0x5befc4);}(_0x31f0,0xb7));var _0x031f=function(_0x54c077,_0xea1a88){_0x54c077=_0x54c077-0x0;var _0x3c869d=_0x31f0[_0x54c077];return _0x3c869d;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var moment=require(_0x031f('0x1'));var BPromise=require('bluebird');var rs=require(_0x031f('0x2'));var fs=require('fs');var Redis=require(_0x031f('0x3'));var db=require(_0x031f('0x4'))['db'];var utils=require(_0x031f('0x5'));var logger=require('../../config/logger')(_0x031f('0x6'));var config=require(_0x031f('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dc98e,_0x487e65,_0x365f59){return new BPromise(function(_0x4300b4,_0x2569b6){return client[_0x031f('0x8')](_0x3dc98e,_0x365f59)['then'](function(_0x2e5624){logger[_0x031f('0x9')](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));logger[_0x031f('0xc')](_0x031f('0xd'),_0x487e65,_0x031f('0xb'),JSON[_0x031f('0xe')](_0x2e5624));if(_0x2e5624['error']){if(_0x2e5624[_0x031f('0xf')][_0x031f('0x10')]===0x1f4){logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x2569b6(_0x2e5624[_0x031f('0xf')]['message']);}logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x4300b4(_0x2e5624[_0x031f('0xf')]['message']);}else{logger['info'](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));_0x4300b4(_0x2e5624[_0x031f('0x12')][_0x031f('0x11')]);}})['catch'](function(_0x1dc4a7){logger[_0x031f('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x487e65,_0x1dc4a7);_0x2569b6(_0x1dc4a7);});});} \ No newline at end of file +var _0xc2c7=['../../config/logger','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xc2c7,0x134));var _0x7c2c=function(_0x57541c,_0x193094){_0x57541c=_0x57541c-0x0;var _0x3c0794=_0xc2c7[_0x57541c];return _0x3c0794;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 2c206ae..34d5590 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 _0x05f1=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','index','get','isAuthenticated','show','post','create','/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','/:id','delete','exports','multer','util','path'];(function(_0x1dd122,_0x4dcca5){var _0x4e3713=function(_0x46577a){while(--_0x46577a){_0x1dd122['push'](_0x1dd122['shift']());}};_0x4e3713(++_0x4dcca5);}(_0x05f1,0xfa));var _0x105f=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x05f1[_0x122096];return _0x3d1966;};'use strict';var multer=require(_0x105f('0x0'));var util=require(_0x105f('0x1'));var path=require(_0x105f('0x2'));var timeout=require(_0x105f('0x3'));var express=require(_0x105f('0x4'));var router=express[_0x105f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x105f('0x6'));var interaction=require(_0x105f('0x7'));var config=require(_0x105f('0x8'));var controller=require(_0x105f('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x105f('0xa')]);router[_0x105f('0xb')]('/:id',auth[_0x105f('0xc')](),controller[_0x105f('0xd')]);router[_0x105f('0xb')]('/:id/sub_intervals',auth[_0x105f('0xc')](),controller['getIntervals']);router[_0x105f('0xe')]('/',auth[_0x105f('0xc')](),controller[_0x105f('0xf')]);router[_0x105f('0xe')](_0x105f('0x10'),auth[_0x105f('0xc')](),controller[_0x105f('0x11')]);router[_0x105f('0xe')](_0x105f('0x12'),auth[_0x105f('0xc')](),controller[_0x105f('0x13')]);router['put'](_0x105f('0x14'),auth[_0x105f('0xc')](),controller['update']);router[_0x105f('0x15')](_0x105f('0x14'),auth['isAuthenticated'](),controller['destroy']);module[_0x105f('0x16')]=router; \ No newline at end of file +var _0xe958=['addIntervals','put','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many'];(function(_0xe31fd,_0x4b6399){var _0x5715d0=function(_0x41bf1b){while(--_0x41bf1b){_0xe31fd['push'](_0xe31fd['shift']());}};_0x5715d0(++_0x4b6399);}(_0xe958,0x191));var _0x8e95=function(_0x45e681,_0x4a2b8d){_0x45e681=_0x45e681-0x0;var _0x1a4430=_0xe958[_0x45e681];return _0x1a4430;};'use strict';var multer=require('multer');var util=require(_0x8e95('0x0'));var path=require(_0x8e95('0x1'));var timeout=require(_0x8e95('0x2'));var express=require(_0x8e95('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8e95('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8e95('0x5'));var controller=require(_0x8e95('0x6'));router[_0x8e95('0x7')]('/',auth[_0x8e95('0x8')](),controller[_0x8e95('0x9')]);router[_0x8e95('0x7')](_0x8e95('0xa'),auth[_0x8e95('0x8')](),controller['show']);router[_0x8e95('0x7')](_0x8e95('0xb'),auth[_0x8e95('0x8')](),controller[_0x8e95('0xc')]);router[_0x8e95('0xd')]('/',auth[_0x8e95('0x8')](),controller[_0x8e95('0xe')]);router[_0x8e95('0xd')]('/:id/sub_intervals',auth[_0x8e95('0x8')](),controller[_0x8e95('0xf')]);router[_0x8e95('0xd')](_0x8e95('0x10'),auth[_0x8e95('0x8')](),controller[_0x8e95('0x11')]);router[_0x8e95('0x12')](_0x8e95('0xa'),auth[_0x8e95('0x8')](),controller['update']);router[_0x8e95('0x13')](_0x8e95('0xa'),auth[_0x8e95('0x8')](),controller[_0x8e95('0x14')]);module[_0x8e95('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 7527f74..968262a 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 _0xdde5=['STRING','exports'];(function(_0x898654,_0x2e7d5d){var _0x6e2377=function(_0x2b8831){while(--_0x2b8831){_0x898654['push'](_0x898654['shift']());}};_0x6e2377(++_0x2e7d5d);}(_0xdde5,0x67));var _0x5dde=function(_0x4c3904,_0x56db61){_0x4c3904=_0x4c3904-0x0;var _0x44fd48=_0xdde5[_0x4c3904];return _0x44fd48;};'use strict';var Sequelize=require('sequelize');module[_0x5dde('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5dde('0x1')]},'interval':{'type':Sequelize[_0x5dde('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x346c=['STRING','sequelize','exports'];(function(_0x2629c0,_0x2289fa){var _0x476b1b=function(_0x3eed69){while(--_0x3eed69){_0x2629c0['push'](_0x2629c0['shift']());}};_0x476b1b(++_0x2289fa);}(_0x346c,0xbe));var _0xc346=function(_0xb00e3e,_0x476d2b){_0xb00e3e=_0xb00e3e-0x0;var _0x51922a=_0x346c[_0xb00e3e];return _0x51922a;};'use strict';var Sequelize=require(_0xc346('0x0'));module[_0xc346('0x1')]={'name':{'type':Sequelize[_0xc346('0x2')]},'description':{'type':Sequelize[_0xc346('0x2')]},'interval':{'type':Sequelize[_0xc346('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 532310f..c93ab53 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 _0xe6fe=['Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','IntervalId','findOne','sort','getIntervals','addIntervals','sequelize','transaction','bulkCreate','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','end','json','offset','undefined','count','Content-Range','apply','reject','update','then','destroy','UserProfileResource','sendStatus','error','send','index','map','Interval','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','pick','filter','merge','VIRTUAL','options','where','include','findAll','rows','catch','show','includeAll','find','create','body','user'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xe6fe,0x6c));var _0xee6f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe6fe[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xee6f('0x0'));var jsonpatch=require(_0xee6f('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xee6f('0x2'));var Mustache=require(_0xee6f('0x3'));var util=require(_0xee6f('0x4'));var path=require(_0xee6f('0x5'));var sox=require(_0xee6f('0x6'));var csv=require(_0xee6f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee6f('0x8'));var squel=require(_0xee6f('0x9'));var crypto=require(_0xee6f('0xa'));var jsforce=require(_0xee6f('0xb'));var deskjs=require(_0xee6f('0xc'));var toCsv=require(_0xee6f('0x7'));var querystring=require(_0xee6f('0xd'));var Papa=require('papaparse');var Redis=require(_0xee6f('0xe'));var authService=require(_0xee6f('0xf'));var qs=require(_0xee6f('0x10'));var as=require(_0xee6f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee6f('0x12'))('api');var utils=require(_0xee6f('0x13'));var config=require(_0xee6f('0x14'));var licenseUtil=require(_0xee6f('0x15'));var db=require(_0xee6f('0x16'))['db'];var extensions=require(_0xee6f('0x17'));function respondWithStatusCode(_0x2f53ea,_0x5b3354){_0x5b3354=_0x5b3354||0xcc;return function(_0x3094a9){if(_0x3094a9){return _0x2f53ea['sendStatus'](_0x5b3354);}return _0x2f53ea[_0xee6f('0x18')](_0x5b3354)[_0xee6f('0x19')]();};}function respondWithResult(_0x33896a,_0x15904c){_0x15904c=_0x15904c||0xc8;return function(_0x18cb9a){if(_0x18cb9a){return _0x33896a[_0xee6f('0x18')](_0x15904c)[_0xee6f('0x1a')](_0x18cb9a);}};}function respondWithFilteredResult(_0x1e0221,_0x31ed19){return function(_0xc513b){if(_0xc513b){var _0x3a0793=typeof _0x31ed19[_0xee6f('0x1b')]===_0xee6f('0x1c')&&typeof _0x31ed19['limit']==='undefined';var _0x20ec40=_0xc513b[_0xee6f('0x1d')];var _0x1c0da0=_0x3a0793?0x0:_0x31ed19[_0xee6f('0x1b')];var _0x46fd12=_0x3a0793?_0xc513b[_0xee6f('0x1d')]:_0x31ed19[_0xee6f('0x1b')]+_0x31ed19['limit'];var _0x585a5d;if(_0x46fd12>=_0x20ec40){_0x46fd12=_0x20ec40;_0x585a5d=0xc8;}else{_0x585a5d=0xce;}_0x1e0221[_0xee6f('0x18')](_0x585a5d);return _0x1e0221['set'](_0xee6f('0x1e'),_0x1c0da0+'-'+_0x46fd12+'/'+_0x20ec40)[_0xee6f('0x1a')](_0xc513b);}return null;};}function patchUpdates(_0x4a653c){return function(_0x388fe5){try{jsonpatch[_0xee6f('0x1f')](_0x388fe5,_0x4a653c,!![]);}catch(_0x79daa7){return BPromise[_0xee6f('0x20')](_0x79daa7);}return _0x388fe5['save']();};}function saveUpdates(_0x46e4a6,_0x3fd138){return function(_0xbe1ac2){if(_0xbe1ac2){return _0xbe1ac2[_0xee6f('0x21')](_0x46e4a6)[_0xee6f('0x22')](function(_0x44f9fe){return _0x44f9fe;});}return null;};}function removeEntity(_0x246f88,_0x5920ed){return function(_0x38f55d){if(_0x38f55d){return _0x38f55d[_0xee6f('0x23')]()[_0xee6f('0x22')](function(){var _0x2a8510=_0x38f55d['get']({'plain':!![]});var _0x2f9375='Intervals';return db[_0xee6f('0x24')]['destroy']({'where':{'type':_0x2f9375,'resourceId':_0x2a8510['id']}})[_0xee6f('0x22')](function(){return _0x38f55d;});})[_0xee6f('0x22')](function(){_0x246f88['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x40e8df,_0x47bab9){return function(_0x106c83){if(!_0x106c83){_0x40e8df[_0xee6f('0x25')](0x194);}return _0x106c83;};}function handleError(_0x4147e4,_0x14a714){_0x14a714=_0x14a714||0x1f4;return function(_0x4f961d){logger[_0xee6f('0x26')](_0x4f961d['stack']);if(_0x4f961d['name']){delete _0x4f961d['name'];}_0x4147e4[_0xee6f('0x18')](_0x14a714)[_0xee6f('0x27')](_0x4f961d);};}exports[_0xee6f('0x28')]=function(_0x5271d2,_0x1903d5){var _0x37502d={},_0x21bcae={},_0xf6584f={'count':0x0,'rows':[]};var _0x5994d5=_[_0xee6f('0x29')](db[_0xee6f('0x2a')][_0xee6f('0x2b')],function(_0x595ae1){return{'name':_0x595ae1[_0xee6f('0x2c')],'type':_0x595ae1[_0xee6f('0x2d')]['key']};});_0x21bcae['model']=_['map'](_0x5994d5,'name');_0x21bcae['query']=_[_0xee6f('0x2e')](_0x5271d2[_0xee6f('0x2f')]);_0x21bcae[_0xee6f('0x30')]=_[_0xee6f('0x31')](_0x21bcae[_0xee6f('0x32')],_0x21bcae[_0xee6f('0x2f')]);_0x37502d[_0xee6f('0x33')]=_[_0xee6f('0x31')](_0x21bcae[_0xee6f('0x32')],qs['fields'](_0x5271d2[_0xee6f('0x2f')][_0xee6f('0x34')]));_0x37502d[_0xee6f('0x33')]=_0x37502d['attributes'][_0xee6f('0x35')]?_0x37502d[_0xee6f('0x33')]:_0x21bcae[_0xee6f('0x32')];if(!_0x5271d2['query'][_0xee6f('0x36')](_0xee6f('0x37'))){_0x37502d[_0xee6f('0x38')]=qs[_0xee6f('0x38')](_0x5271d2['query'][_0xee6f('0x38')]);_0x37502d[_0xee6f('0x1b')]=qs[_0xee6f('0x1b')](_0x5271d2['query']['offset']);}_0x37502d[_0xee6f('0x39')]=qs['sort'](_0x5271d2[_0xee6f('0x2f')]['sort']);_0x37502d['where']=qs[_0xee6f('0x30')](_[_0xee6f('0x3a')](_0x5271d2[_0xee6f('0x2f')],_0x21bcae[_0xee6f('0x30')]),_0x5994d5);if(_0x5271d2[_0xee6f('0x2f')][_0xee6f('0x3b')]){_0x37502d['where']=_[_0xee6f('0x3c')](_0x37502d['where'],{'$or':_[_0xee6f('0x29')](_0x5994d5,function(_0xf5eec8){if(_0xf5eec8[_0xee6f('0x2d')]!==_0xee6f('0x3d')){var _0x6a2050={};_0x6a2050[_0xf5eec8['name']]={'$like':'%'+_0x5271d2[_0xee6f('0x2f')]['filter']+'%'};return _0x6a2050;}})});}_0x37502d=_['merge']({},_0x37502d,_0x5271d2[_0xee6f('0x3e')]);var _0x17e4b5={'where':_0x37502d[_0xee6f('0x3f')]};return db[_0xee6f('0x2a')][_0xee6f('0x1d')](_0x17e4b5)['then'](function(_0x35586f){_0xf6584f[_0xee6f('0x1d')]=_0x35586f;if(_0x5271d2[_0xee6f('0x2f')]['includeAll']){_0x37502d[_0xee6f('0x40')]=[{'all':!![]}];}return db[_0xee6f('0x2a')][_0xee6f('0x41')](_0x37502d);})['then'](function(_0x1ab0e2){_0xf6584f[_0xee6f('0x42')]=_0x1ab0e2;return _0xf6584f;})['then'](respondWithFilteredResult(_0x1903d5,_0x37502d))[_0xee6f('0x43')](handleError(_0x1903d5,null));};exports[_0xee6f('0x44')]=function(_0x33dfc6,_0x490fe0){var _0x4a1317={'raw':!![],'where':{'id':_0x33dfc6['params']['id']}},_0x1ce158={};_0x1ce158[_0xee6f('0x32')]=_[_0xee6f('0x2e')](db['Interval'][_0xee6f('0x2b')]);_0x1ce158[_0xee6f('0x2f')]=_[_0xee6f('0x2e')](_0x33dfc6['query']);_0x1ce158['filters']=_['intersection'](_0x1ce158[_0xee6f('0x32')],_0x1ce158['query']);_0x4a1317[_0xee6f('0x33')]=_['intersection'](_0x1ce158[_0xee6f('0x32')],qs['fields'](_0x33dfc6[_0xee6f('0x2f')][_0xee6f('0x34')]));_0x4a1317[_0xee6f('0x33')]=_0x4a1317['attributes'][_0xee6f('0x35')]?_0x4a1317[_0xee6f('0x33')]:_0x1ce158[_0xee6f('0x32')];if(_0x33dfc6['query'][_0xee6f('0x45')]){_0x4a1317[_0xee6f('0x40')]=[{'all':!![]}];}_0x4a1317=_['merge']({},_0x4a1317,_0x33dfc6[_0xee6f('0x3e')]);return db[_0xee6f('0x2a')][_0xee6f('0x46')](_0x4a1317)['then'](handleEntityNotFound(_0x490fe0,null))[_0xee6f('0x22')](respondWithResult(_0x490fe0,null))[_0xee6f('0x43')](handleError(_0x490fe0,null));};exports[_0xee6f('0x47')]=function(_0x556f7c,_0x13d410){return db[_0xee6f('0x2a')]['create'](_0x556f7c[_0xee6f('0x48')],{})[_0xee6f('0x22')](function(_0x34f209){var _0x413943=_0x556f7c[_0xee6f('0x49')]['get']({'plain':!![]});if(!_0x413943)throw new Error(_0xee6f('0x4a'));if(_0x413943['role']==='user'){var _0xa7bc59=_0x34f209[_0xee6f('0x4b')]({'plain':!![]});var _0x7a0ce='Intervals';return db[_0xee6f('0x4c')][_0xee6f('0x46')]({'where':{'name':_0x7a0ce,'userProfileId':_0x413943[_0xee6f('0x4d')]},'raw':!![]})[_0xee6f('0x22')](function(_0x30be53){if(_0x30be53&&_0x30be53[_0xee6f('0x4e')]===0x0){return db[_0xee6f('0x24')][_0xee6f('0x47')]({'name':_0xa7bc59[_0xee6f('0x4f')],'resourceId':_0xa7bc59['id'],'type':_0x30be53['name'],'sectionId':_0x30be53['id']},{})['then'](function(){return _0x34f209;});}else{return _0x34f209;}})[_0xee6f('0x43')](function(_0x217907){logger[_0xee6f('0x26')](_0xee6f('0x50'),_0x217907);throw _0x217907;});}return _0x34f209;})[_0xee6f('0x22')](respondWithResult(_0x13d410,0xc9))['catch'](handleError(_0x13d410,null));};exports['update']=function(_0x1bdd7c,_0x5c6478){if(_0x1bdd7c['body']['id']){delete _0x1bdd7c[_0xee6f('0x48')]['id'];}return db[_0xee6f('0x2a')][_0xee6f('0x46')]({'where':{'id':_0x1bdd7c['params']['id']}})[_0xee6f('0x22')](handleEntityNotFound(_0x5c6478,null))[_0xee6f('0x22')](saveUpdates(_0x1bdd7c[_0xee6f('0x48')],null))[_0xee6f('0x22')](respondWithResult(_0x5c6478,null))[_0xee6f('0x43')](handleError(_0x5c6478,null));};exports['destroy']=function(_0x596b88,_0x3aeecf){return db[_0xee6f('0x2a')][_0xee6f('0x46')]({'where':{'id':_0x596b88[_0xee6f('0x51')]['id']}})[_0xee6f('0x22')](handleEntityNotFound(_0x3aeecf,null))[_0xee6f('0x22')](removeEntity(_0x3aeecf,null))['catch'](handleError(_0x3aeecf,null));};exports[_0xee6f('0x52')]=function(_0x5a073e,_0x1fa837,_0x210e0e){if(_0x5a073e[_0xee6f('0x48')]['id']){delete _0x5a073e[_0xee6f('0x48')]['id'];}return db['Interval'][_0xee6f('0x46')]({'where':{'id':_0x5a073e[_0xee6f('0x51')]['id']}})[_0xee6f('0x22')](handleEntityNotFound(_0x1fa837,null))['then'](function(_0x8c1f58){if(_0x8c1f58){_0x5a073e[_0xee6f('0x48')][_0xee6f('0x53')]=_0x8c1f58['id'];return db['Interval'][_0xee6f('0x47')](_0x5a073e[_0xee6f('0x48')]);}})['then'](respondWithResult(_0x1fa837,null))[_0xee6f('0x43')](handleError(_0x1fa837,null));};exports['getIntervals']=function(_0x33025f,_0x47b656,_0x10d816){var _0x2e8103={};var _0xf37dc3={};var _0x109457;var _0x3b225f;return db[_0xee6f('0x2a')][_0xee6f('0x54')]({'where':{'id':_0x33025f[_0xee6f('0x51')]['id']}})['then'](handleEntityNotFound(_0x47b656,null))['then'](function(_0x459e97){if(_0x459e97){_0x109457=_0x459e97;_0xf37dc3[_0xee6f('0x32')]=_[_0xee6f('0x2e')](db[_0xee6f('0x2a')][_0xee6f('0x2b')]);_0xf37dc3['query']=_[_0xee6f('0x2e')](_0x33025f[_0xee6f('0x2f')]);_0xf37dc3[_0xee6f('0x30')]=_[_0xee6f('0x31')](_0xf37dc3['model'],_0xf37dc3[_0xee6f('0x2f')]);_0x2e8103[_0xee6f('0x33')]=_[_0xee6f('0x31')](_0xf37dc3[_0xee6f('0x32')],qs[_0xee6f('0x34')](_0x33025f['query'][_0xee6f('0x34')]));_0x2e8103[_0xee6f('0x33')]=_0x2e8103[_0xee6f('0x33')][_0xee6f('0x35')]?_0x2e8103[_0xee6f('0x33')]:_0xf37dc3['model'];_0x2e8103[_0xee6f('0x39')]=qs[_0xee6f('0x55')](_0x33025f[_0xee6f('0x2f')][_0xee6f('0x55')]);_0x2e8103['where']=qs[_0xee6f('0x30')](_[_0xee6f('0x3a')](_0x33025f[_0xee6f('0x2f')],_0xf37dc3[_0xee6f('0x30')]));if(_0x33025f[_0xee6f('0x2f')][_0xee6f('0x3b')]){_0x2e8103[_0xee6f('0x3f')]=_[_0xee6f('0x3c')](_0x2e8103[_0xee6f('0x3f')],{'$or':_[_0xee6f('0x29')](_0x2e8103[_0xee6f('0x33')],function(_0x770c39){var _0x3ae6bb={};_0x3ae6bb[_0x770c39]={'$like':'%'+_0x33025f['query'][_0xee6f('0x3b')]+'%'};return _0x3ae6bb;})});}_0x2e8103=_[_0xee6f('0x3c')]({},_0x2e8103,_0x33025f[_0xee6f('0x3e')]);return _0x109457['getIntervals'](_0x2e8103);}})[_0xee6f('0x22')](function(_0x470cae){if(_0x470cae){_0x3b225f=_0x470cae[_0xee6f('0x35')];if(!_0x33025f[_0xee6f('0x2f')][_0xee6f('0x36')](_0xee6f('0x37'))){_0x2e8103['limit']=qs[_0xee6f('0x38')](_0x33025f[_0xee6f('0x2f')]['limit']);_0x2e8103[_0xee6f('0x1b')]=qs[_0xee6f('0x1b')](_0x33025f['query']['offset']);}return _0x109457[_0xee6f('0x56')](_0x2e8103);}})[_0xee6f('0x22')](function(_0x2cda8d){if(_0x2cda8d){return _0x2cda8d?{'count':_0x3b225f,'rows':_0x2cda8d}:null;}})[_0xee6f('0x22')](respondWithResult(_0x47b656,null))[_0xee6f('0x43')](handleError(_0x47b656,null));};exports[_0xee6f('0x57')]=function(_0x562729,_0x4dfa1f,_0x4ff79a){return db[_0xee6f('0x2a')]['findOne']({'where':{'id':_0x562729[_0xee6f('0x51')]['id']}})[_0xee6f('0x22')](handleEntityNotFound(_0x4dfa1f,null))['then'](function(_0x3c784f){if(_0x3c784f){return db[_0xee6f('0x58')][_0xee6f('0x59')](function(_0x143c5b){return db['Interval'][_0xee6f('0x23')]({'where':{'IntervalId':_0x562729[_0xee6f('0x51')]['id']},'transaction':_0x143c5b})[_0xee6f('0x22')](function(_0x53d504){var _0x5ee135=_[_0xee6f('0x29')](_0x562729[_0xee6f('0x48')],function(_0x1882ca){delete _0x1882ca['id'];_0x1882ca['IntervalId']=_0x562729[_0xee6f('0x51')]['id'];return _0x1882ca;});return db[_0xee6f('0x2a')][_0xee6f('0x5a')](_0x5ee135,{'transaction':_0x143c5b});});})[_0xee6f('0x22')](function(){return db[_0xee6f('0x2a')][_0xee6f('0x41')]({'where':{'IntervalId':_0x562729['params']['id']}});});}})[_0xee6f('0x22')](respondWithResult(_0x4dfa1f,null))[_0xee6f('0x43')](handleError(_0x4dfa1f,null));}; \ No newline at end of file +var _0xc396=['keys','filters','intersection','attributes','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','rows','catch','show','params','fields','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','getIntervals','findOne','hasOwnProperty','addIntervals','sequelize','transaction','IntervalId','findAll','eml-format','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','get','Intervals','error','name','send','index','Interval','rawAttributes','fieldName','type','key','model','map','query'];(function(_0x54a3eb,_0xa80aeb){var _0x5df3ae=function(_0xd49950){while(--_0xd49950){_0x54a3eb['push'](_0x54a3eb['shift']());}};_0x5df3ae(++_0xa80aeb);}(_0xc396,0x81));var _0x6c39=function(_0x3c6c25,_0x485676){_0x3c6c25=_0x3c6c25-0x0;var _0x1f9c31=_0xc396[_0x3c6c25];return _0x1f9c31;};'use strict';var emlformat=require(_0x6c39('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6c39('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6c39('0x2'));var BPromise=require(_0x6c39('0x3'));var Mustache=require(_0x6c39('0x4'));var util=require(_0x6c39('0x5'));var path=require('path');var sox=require(_0x6c39('0x6'));var csv=require(_0x6c39('0x7'));var ejs=require(_0x6c39('0x8'));var fs=require('fs');var fs_extra=require(_0x6c39('0x9'));var _=require(_0x6c39('0xa'));var squel=require(_0x6c39('0xb'));var crypto=require(_0x6c39('0xc'));var jsforce=require(_0x6c39('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6c39('0x7'));var querystring=require(_0x6c39('0xe'));var Papa=require(_0x6c39('0xf'));var Redis=require(_0x6c39('0x10'));var authService=require(_0x6c39('0x11'));var qs=require(_0x6c39('0x12'));var as=require(_0x6c39('0x13'));var hardwareService=require(_0x6c39('0x14'));var logger=require(_0x6c39('0x15'))(_0x6c39('0x16'));var utils=require(_0x6c39('0x17'));var config=require(_0x6c39('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c39('0x19'))['db'];var extensions=require(_0x6c39('0x1a'));function respondWithStatusCode(_0x14ee66,_0x3eb292){_0x3eb292=_0x3eb292||0xcc;return function(_0x14bda2){if(_0x14bda2){return _0x14ee66[_0x6c39('0x1b')](_0x3eb292);}return _0x14ee66[_0x6c39('0x1c')](_0x3eb292)[_0x6c39('0x1d')]();};}function respondWithResult(_0x490166,_0x5e07ae){_0x5e07ae=_0x5e07ae||0xc8;return function(_0x5ed4be){if(_0x5ed4be){return _0x490166[_0x6c39('0x1c')](_0x5e07ae)[_0x6c39('0x1e')](_0x5ed4be);}};}function respondWithFilteredResult(_0xcd6774,_0xb05409){return function(_0x2b0096){if(_0x2b0096){var _0xc9f52=typeof _0xb05409[_0x6c39('0x1f')]===_0x6c39('0x20')&&typeof _0xb05409[_0x6c39('0x21')]==='undefined';var _0x5acbb0=_0x2b0096[_0x6c39('0x22')];var _0x2f338f=_0xc9f52?0x0:_0xb05409[_0x6c39('0x1f')];var _0x160df4=_0xc9f52?_0x2b0096[_0x6c39('0x22')]:_0xb05409[_0x6c39('0x1f')]+_0xb05409['limit'];var _0x48d212;if(_0x160df4>=_0x5acbb0){_0x160df4=_0x5acbb0;_0x48d212=0xc8;}else{_0x48d212=0xce;}_0xcd6774[_0x6c39('0x1c')](_0x48d212);return _0xcd6774['set'](_0x6c39('0x23'),_0x2f338f+'-'+_0x160df4+'/'+_0x5acbb0)['json'](_0x2b0096);}return null;};}function patchUpdates(_0x273f24){return function(_0x3c0bfa){try{jsonpatch['apply'](_0x3c0bfa,_0x273f24,!![]);}catch(_0x4a9619){return BPromise[_0x6c39('0x24')](_0x4a9619);}return _0x3c0bfa[_0x6c39('0x25')]();};}function saveUpdates(_0x7999aa,_0x29244b){return function(_0x57f97b){if(_0x57f97b){return _0x57f97b[_0x6c39('0x26')](_0x7999aa)[_0x6c39('0x27')](function(_0x5d5902){return _0x5d5902;});}return null;};}function removeEntity(_0x104e75,_0x4cd5e3){return function(_0x5bed53){if(_0x5bed53){return _0x5bed53[_0x6c39('0x28')]()[_0x6c39('0x27')](function(){var _0x1d3369=_0x5bed53[_0x6c39('0x29')]({'plain':!![]});var _0x1a05e3=_0x6c39('0x2a');return db['UserProfileResource'][_0x6c39('0x28')]({'where':{'type':_0x1a05e3,'resourceId':_0x1d3369['id']}})[_0x6c39('0x27')](function(){return _0x5bed53;});})[_0x6c39('0x27')](function(){_0x104e75[_0x6c39('0x1c')](0xcc)[_0x6c39('0x1d')]();});}};}function handleEntityNotFound(_0x31fa15,_0x1db0d0){return function(_0x22bbeb){if(!_0x22bbeb){_0x31fa15[_0x6c39('0x1b')](0x194);}return _0x22bbeb;};}function handleError(_0x683c8b,_0x2356aa){_0x2356aa=_0x2356aa||0x1f4;return function(_0x1f39ee){logger[_0x6c39('0x2b')](_0x1f39ee['stack']);if(_0x1f39ee[_0x6c39('0x2c')]){delete _0x1f39ee[_0x6c39('0x2c')];}_0x683c8b[_0x6c39('0x1c')](_0x2356aa)[_0x6c39('0x2d')](_0x1f39ee);};}exports[_0x6c39('0x2e')]=function(_0x3e160d,_0x1577c4){var _0x24e407={},_0x114889={},_0x175f81={'count':0x0,'rows':[]};var _0x53e0c0=_['map'](db[_0x6c39('0x2f')][_0x6c39('0x30')],function(_0x4b9786){return{'name':_0x4b9786[_0x6c39('0x31')],'type':_0x4b9786[_0x6c39('0x32')][_0x6c39('0x33')]};});_0x114889[_0x6c39('0x34')]=_[_0x6c39('0x35')](_0x53e0c0,'name');_0x114889[_0x6c39('0x36')]=_[_0x6c39('0x37')](_0x3e160d['query']);_0x114889[_0x6c39('0x38')]=_[_0x6c39('0x39')](_0x114889[_0x6c39('0x34')],_0x114889[_0x6c39('0x36')]);_0x24e407[_0x6c39('0x3a')]=_[_0x6c39('0x39')](_0x114889[_0x6c39('0x34')],qs['fields'](_0x3e160d[_0x6c39('0x36')]['fields']));_0x24e407['attributes']=_0x24e407[_0x6c39('0x3a')][_0x6c39('0x3b')]?_0x24e407[_0x6c39('0x3a')]:_0x114889[_0x6c39('0x34')];if(!_0x3e160d['query']['hasOwnProperty'](_0x6c39('0x3c'))){_0x24e407[_0x6c39('0x21')]=qs[_0x6c39('0x21')](_0x3e160d[_0x6c39('0x36')][_0x6c39('0x21')]);_0x24e407[_0x6c39('0x1f')]=qs[_0x6c39('0x1f')](_0x3e160d['query']['offset']);}_0x24e407[_0x6c39('0x3d')]=qs[_0x6c39('0x3e')](_0x3e160d[_0x6c39('0x36')]['sort']);_0x24e407['where']=qs[_0x6c39('0x38')](_[_0x6c39('0x3f')](_0x3e160d[_0x6c39('0x36')],_0x114889[_0x6c39('0x38')]),_0x53e0c0);if(_0x3e160d[_0x6c39('0x36')][_0x6c39('0x40')]){_0x24e407[_0x6c39('0x41')]=_['merge'](_0x24e407[_0x6c39('0x41')],{'$or':_[_0x6c39('0x35')](_0x53e0c0,function(_0x2a8dcd){if(_0x2a8dcd['type']!==_0x6c39('0x42')){var _0x287aef={};_0x287aef[_0x2a8dcd['name']]={'$like':'%'+_0x3e160d['query'][_0x6c39('0x40')]+'%'};return _0x287aef;}})});}_0x24e407=_[_0x6c39('0x43')]({},_0x24e407,_0x3e160d[_0x6c39('0x44')]);var _0x20a650={'where':_0x24e407[_0x6c39('0x41')]};return db[_0x6c39('0x2f')][_0x6c39('0x22')](_0x20a650)[_0x6c39('0x27')](function(_0x416f3c){_0x175f81['count']=_0x416f3c;if(_0x3e160d['query']['includeAll']){_0x24e407[_0x6c39('0x45')]=[{'all':!![]}];}return db['Interval']['findAll'](_0x24e407);})['then'](function(_0x36afe5){_0x175f81[_0x6c39('0x46')]=_0x36afe5;return _0x175f81;})[_0x6c39('0x27')](respondWithFilteredResult(_0x1577c4,_0x24e407))[_0x6c39('0x47')](handleError(_0x1577c4,null));};exports[_0x6c39('0x48')]=function(_0x3df670,_0x16e732){var _0x423a08={'raw':!![],'where':{'id':_0x3df670[_0x6c39('0x49')]['id']}},_0x4da258={};_0x4da258[_0x6c39('0x34')]=_[_0x6c39('0x37')](db[_0x6c39('0x2f')][_0x6c39('0x30')]);_0x4da258[_0x6c39('0x36')]=_[_0x6c39('0x37')](_0x3df670['query']);_0x4da258[_0x6c39('0x38')]=_[_0x6c39('0x39')](_0x4da258[_0x6c39('0x34')],_0x4da258[_0x6c39('0x36')]);_0x423a08[_0x6c39('0x3a')]=_[_0x6c39('0x39')](_0x4da258[_0x6c39('0x34')],qs[_0x6c39('0x4a')](_0x3df670['query'][_0x6c39('0x4a')]));_0x423a08[_0x6c39('0x3a')]=_0x423a08[_0x6c39('0x3a')][_0x6c39('0x3b')]?_0x423a08[_0x6c39('0x3a')]:_0x4da258[_0x6c39('0x34')];if(_0x3df670[_0x6c39('0x36')][_0x6c39('0x4b')]){_0x423a08[_0x6c39('0x45')]=[{'all':!![]}];}_0x423a08=_[_0x6c39('0x43')]({},_0x423a08,_0x3df670[_0x6c39('0x44')]);return db[_0x6c39('0x2f')][_0x6c39('0x4c')](_0x423a08)['then'](handleEntityNotFound(_0x16e732,null))[_0x6c39('0x27')](respondWithResult(_0x16e732,null))[_0x6c39('0x47')](handleError(_0x16e732,null));};exports['create']=function(_0x3f5f01,_0x30aa5f){return db[_0x6c39('0x2f')][_0x6c39('0x4d')](_0x3f5f01[_0x6c39('0x4e')],{})['then'](function(_0x2693fc){var _0x5dc26b=_0x3f5f01[_0x6c39('0x4f')]['get']({'plain':!![]});if(!_0x5dc26b)throw new Error(_0x6c39('0x50'));if(_0x5dc26b['role']===_0x6c39('0x4f')){var _0x5af4c5=_0x2693fc[_0x6c39('0x29')]({'plain':!![]});var _0x87c317='Intervals';return db['UserProfileSection'][_0x6c39('0x4c')]({'where':{'name':_0x87c317,'userProfileId':_0x5dc26b['userProfileId']},'raw':!![]})[_0x6c39('0x27')](function(_0x142d9d){if(_0x142d9d&&_0x142d9d[_0x6c39('0x51')]===0x0){return db['UserProfileResource'][_0x6c39('0x4d')]({'name':_0x5af4c5[_0x6c39('0x2c')],'resourceId':_0x5af4c5['id'],'type':_0x142d9d[_0x6c39('0x2c')],'sectionId':_0x142d9d['id']},{})[_0x6c39('0x27')](function(){return _0x2693fc;});}else{return _0x2693fc;}})[_0x6c39('0x47')](function(_0x335106){logger[_0x6c39('0x2b')](_0x6c39('0x52'),_0x335106);throw _0x335106;});}return _0x2693fc;})[_0x6c39('0x27')](respondWithResult(_0x30aa5f,0xc9))['catch'](handleError(_0x30aa5f,null));};exports[_0x6c39('0x26')]=function(_0xe0aa5,_0x60ec7f){if(_0xe0aa5[_0x6c39('0x4e')]['id']){delete _0xe0aa5['body']['id'];}return db[_0x6c39('0x2f')]['find']({'where':{'id':_0xe0aa5[_0x6c39('0x49')]['id']}})[_0x6c39('0x27')](handleEntityNotFound(_0x60ec7f,null))[_0x6c39('0x27')](saveUpdates(_0xe0aa5[_0x6c39('0x4e')],null))[_0x6c39('0x27')](respondWithResult(_0x60ec7f,null))['catch'](handleError(_0x60ec7f,null));};exports[_0x6c39('0x28')]=function(_0x3964d5,_0x5ca3d3){return db[_0x6c39('0x2f')]['find']({'where':{'id':_0x3964d5[_0x6c39('0x49')]['id']}})[_0x6c39('0x27')](handleEntityNotFound(_0x5ca3d3,null))[_0x6c39('0x27')](removeEntity(_0x5ca3d3,null))[_0x6c39('0x47')](handleError(_0x5ca3d3,null));};exports[_0x6c39('0x53')]=function(_0x31711b,_0x573d63,_0x491eb7){if(_0x31711b[_0x6c39('0x4e')]['id']){delete _0x31711b[_0x6c39('0x4e')]['id'];}return db[_0x6c39('0x2f')][_0x6c39('0x4c')]({'where':{'id':_0x31711b['params']['id']}})[_0x6c39('0x27')](handleEntityNotFound(_0x573d63,null))[_0x6c39('0x27')](function(_0x2d00bb){if(_0x2d00bb){_0x31711b[_0x6c39('0x4e')]['IntervalId']=_0x2d00bb['id'];return db['Interval'][_0x6c39('0x4d')](_0x31711b[_0x6c39('0x4e')]);}})[_0x6c39('0x27')](respondWithResult(_0x573d63,null))[_0x6c39('0x47')](handleError(_0x573d63,null));};exports[_0x6c39('0x54')]=function(_0x1ec825,_0x542c9b,_0x5e1ecc){var _0x3b86da={};var _0x562e7b={};var _0x207fe0;var _0x1f42f6;return db[_0x6c39('0x2f')][_0x6c39('0x55')]({'where':{'id':_0x1ec825[_0x6c39('0x49')]['id']}})[_0x6c39('0x27')](handleEntityNotFound(_0x542c9b,null))['then'](function(_0x38403f){if(_0x38403f){_0x207fe0=_0x38403f;_0x562e7b[_0x6c39('0x34')]=_[_0x6c39('0x37')](db['Interval'][_0x6c39('0x30')]);_0x562e7b[_0x6c39('0x36')]=_[_0x6c39('0x37')](_0x1ec825[_0x6c39('0x36')]);_0x562e7b[_0x6c39('0x38')]=_[_0x6c39('0x39')](_0x562e7b[_0x6c39('0x34')],_0x562e7b[_0x6c39('0x36')]);_0x3b86da[_0x6c39('0x3a')]=_['intersection'](_0x562e7b[_0x6c39('0x34')],qs[_0x6c39('0x4a')](_0x1ec825[_0x6c39('0x36')]['fields']));_0x3b86da[_0x6c39('0x3a')]=_0x3b86da[_0x6c39('0x3a')]['length']?_0x3b86da[_0x6c39('0x3a')]:_0x562e7b[_0x6c39('0x34')];_0x3b86da[_0x6c39('0x3d')]=qs['sort'](_0x1ec825['query'][_0x6c39('0x3e')]);_0x3b86da[_0x6c39('0x41')]=qs[_0x6c39('0x38')](_[_0x6c39('0x3f')](_0x1ec825[_0x6c39('0x36')],_0x562e7b[_0x6c39('0x38')]));if(_0x1ec825[_0x6c39('0x36')][_0x6c39('0x40')]){_0x3b86da[_0x6c39('0x41')]=_[_0x6c39('0x43')](_0x3b86da[_0x6c39('0x41')],{'$or':_[_0x6c39('0x35')](_0x3b86da['attributes'],function(_0x354e25){var _0x5bf92c={};_0x5bf92c[_0x354e25]={'$like':'%'+_0x1ec825['query']['filter']+'%'};return _0x5bf92c;})});}_0x3b86da=_[_0x6c39('0x43')]({},_0x3b86da,_0x1ec825[_0x6c39('0x44')]);return _0x207fe0[_0x6c39('0x54')](_0x3b86da);}})['then'](function(_0x245e79){if(_0x245e79){_0x1f42f6=_0x245e79[_0x6c39('0x3b')];if(!_0x1ec825[_0x6c39('0x36')][_0x6c39('0x56')](_0x6c39('0x3c'))){_0x3b86da[_0x6c39('0x21')]=qs[_0x6c39('0x21')](_0x1ec825[_0x6c39('0x36')][_0x6c39('0x21')]);_0x3b86da['offset']=qs[_0x6c39('0x1f')](_0x1ec825['query'][_0x6c39('0x1f')]);}return _0x207fe0[_0x6c39('0x54')](_0x3b86da);}})[_0x6c39('0x27')](function(_0x52fabf){if(_0x52fabf){return _0x52fabf?{'count':_0x1f42f6,'rows':_0x52fabf}:null;}})[_0x6c39('0x27')](respondWithResult(_0x542c9b,null))[_0x6c39('0x47')](handleError(_0x542c9b,null));};exports[_0x6c39('0x57')]=function(_0x1a5610,_0x1c6a51,_0x41b782){return db[_0x6c39('0x2f')]['findOne']({'where':{'id':_0x1a5610[_0x6c39('0x49')]['id']}})[_0x6c39('0x27')](handleEntityNotFound(_0x1c6a51,null))[_0x6c39('0x27')](function(_0x161d6f){if(_0x161d6f){return db[_0x6c39('0x58')][_0x6c39('0x59')](function(_0x10cc08){return db['Interval'][_0x6c39('0x28')]({'where':{'IntervalId':_0x1a5610[_0x6c39('0x49')]['id']},'transaction':_0x10cc08})[_0x6c39('0x27')](function(_0xd99a0){var _0x15eb65=_[_0x6c39('0x35')](_0x1a5610[_0x6c39('0x4e')],function(_0x37a6ea){delete _0x37a6ea['id'];_0x37a6ea[_0x6c39('0x5a')]=_0x1a5610['params']['id'];return _0x37a6ea;});return db['Interval']['bulkCreate'](_0x15eb65,{'transaction':_0x10cc08});});})[_0x6c39('0x27')](function(){return db['Interval'][_0x6c39('0x5b')]({'where':{'IntervalId':_0x1a5610[_0x6c39('0x49')]['id']}});});}})[_0x6c39('0x27')](respondWithResult(_0x1c6a51,null))['catch'](handleError(_0x1c6a51,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 1a34f65..f0baacd 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 _0xe430=['path','rimraf','../../config/environment','define','tools_intervals','rewrite','lodash','util','../../config/logger','api','request-promise'];(function(_0x3c487b,_0x44c5e2){var _0x1d65f6=function(_0x135e6d){while(--_0x135e6d){_0x3c487b['push'](_0x3c487b['shift']());}};_0x1d65f6(++_0x44c5e2);}(_0xe430,0x171));var _0x0e43=function(_0x482c63,_0x289846){_0x482c63=_0x482c63-0x0;var _0x13cdb6=_0xe430[_0x482c63];return _0x13cdb6;};'use strict';var _=require(_0x0e43('0x0'));var util=require(_0x0e43('0x1'));var logger=require(_0x0e43('0x2'))(_0x0e43('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0e43('0x4'));var fs=require('fs');var path=require(_0x0e43('0x5'));var rimraf=require(_0x0e43('0x6'));var config=require(_0x0e43('0x7'));var attributes=require('./interval.attributes');var extensions=require('../../components/extensions/rewrite');module['exports']=function(_0x5ab651,_0x5bc5ac){return _0x5ab651[_0x0e43('0x8')]('Interval',attributes,{'tableName':_0x0e43('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x361f8b,_0x77fb11){extensions[_0x0e43('0xa')](_0x5ab651,_0x361f8b);},'afterBulkCreate':function(_0xbdcc1,_0x32ca28,_0x2afebc){_0x2afebc();extensions[_0x0e43('0xa')](_0x5ab651,_0xbdcc1[0x0]);},'afterUpdate':function(_0x258e56,_0x18818c){extensions[_0x0e43('0xa')](_0x5ab651,_0x258e56);},'afterDestroy':function(_0x49a91a,_0x5186a2){extensions['rewrite'](_0x5ab651,_0x49a91a);}}});}; \ No newline at end of file +var _0xb13e=['bluebird','path','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment'];(function(_0x2fd428,_0x90bafc){var _0x5e48e1=function(_0x29bcd8){while(--_0x29bcd8){_0x2fd428['push'](_0x2fd428['shift']());}};_0x5e48e1(++_0x90bafc);}(_0xb13e,0xa3));var _0xeb13=function(_0x1e6765,_0x39c381){_0x1e6765=_0x1e6765-0x0;var _0x23e45d=_0xb13e[_0x1e6765];return _0x23e45d;};'use strict';var _=require(_0xeb13('0x0'));var util=require(_0xeb13('0x1'));var logger=require(_0xeb13('0x2'))(_0xeb13('0x3'));var moment=require(_0xeb13('0x4'));var BPromise=require(_0xeb13('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb13('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xeb13('0x7'));var extensions=require(_0xeb13('0x8'));module[_0xeb13('0x9')]=function(_0x3c6c6b,_0x171b81){return _0x3c6c6b[_0xeb13('0xa')](_0xeb13('0xb'),attributes,{'tableName':_0xeb13('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4ca715,_0x32e719){extensions['rewrite'](_0x3c6c6b,_0x4ca715);},'afterBulkCreate':function(_0x38a3d9,_0x4aa539,_0x20c031){_0x20c031();extensions[_0xeb13('0xd')](_0x3c6c6b,_0x38a3d9[0x0]);},'afterUpdate':function(_0x1bad8d,_0x2f4798){extensions[_0xeb13('0xd')](_0x3c6c6b,_0x1bad8d);},'afterDestroy':function(_0x305321,_0x2099f2){extensions['rewrite'](_0x3c6c6b,_0x305321);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 2a2e3e4..471731f 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(_0x72a33d,_0x5691da){var _0x2621d5=function(_0x95b7c6){while(--_0x95b7c6){_0x72a33d['push'](_0x72a33d['shift']());}};_0x2621d5(++_0x5691da);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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(_0xf2f332,_0x299fbf){var _0x56cce3=function(_0x5f37e0){while(--_0x5f37e0){_0xf2f332['push'](_0xf2f332['shift']());}};_0x56cce3(++_0x299fbf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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 04665d1..2a87447 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 _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x216c08,_0x4bea18){var _0x4731dd=function(_0x427360){while(--_0x427360){_0x216c08['push'](_0x216c08['shift']());}};_0x4731dd(++_0x4bea18);}(_0xdb28,0x106));var _0x8db2=function(_0x335edf,_0x3a2d73){_0x335edf=_0x335edf-0x0;var _0x9733e5=_0xdb28[_0x335edf];return _0x9733e5;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file +var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0xf5232,_0x36ad9d){var _0x298303=function(_0x15a7a2){while(--_0x15a7a2){_0xf5232['push'](_0xf5232['shift']());}};_0x298303(++_0x36ad9d);}(_0x2ef3,0xba));var _0x32ef=function(_0x52b1d3,_0x594831){_0x52b1d3=_0x52b1d3-0x0;var _0x13cad6=_0x2ef3[_0x52b1d3];return _0x13cad6;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 81af71d..f982928 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 _0xaef3=['connection','socket','body','bluebird','https','../../config/logger','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','customfield_11500','email','fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11504','customfield_10102','/rest/api/2/issue','POST','Basic\x20','toString','base64','setEncoding','data','end','status','statusCode','json','parse','error','api.jira','openIssue','send','headers','x-forwarded-for','remoteAddress'];(function(_0x2daddd,_0x1f6d29){var _0x5ed9bd=function(_0x38510b){while(--_0x38510b){_0x2daddd['push'](_0x2daddd['shift']());}};_0x5ed9bd(++_0x1f6d29);}(_0xaef3,0xdf));var _0x3aef=function(_0x4a209a,_0x575ff9){_0x4a209a=_0x4a209a-0x0;var _0x4b3c20=_0xaef3[_0x4a209a];return _0x4b3c20;};'use strict';var BPromise=require(_0x3aef('0x0'));var https=require(_0x3aef('0x1'));var logger=require(_0x3aef('0x2'))('api');var USERNAME='support';var PASSWORD=_0x3aef('0x3');function openIssue(_0x529fe6,_0x13cd51){var _0x449c9b={'fields':{'project':{'key':_0x529fe6[_0x3aef('0x4')]||_0x3aef('0x5')},'summary':(_0x529fe6[_0x3aef('0x6')]||_0x3aef('0x7'))+_0x3aef('0x8')+_0x529fe6['ip'],'description':_0x529fe6[_0x3aef('0x9')]||JSON[_0x3aef('0xa')](_0x529fe6),'issuetype':{'name':_0x529fe6[_0x3aef('0xb')]||_0x3aef('0xc')}}};_0x449c9b['fields'][_0x3aef('0xd')]=_0x529fe6[_0x3aef('0xe')];_0x449c9b[_0x3aef('0xf')][_0x3aef('0x10')]=_0x529fe6[_0x3aef('0x11')];_0x449c9b[_0x3aef('0xf')][_0x3aef('0x12')]=_0x529fe6[_0x3aef('0x13')];_0x449c9b[_0x3aef('0xf')]['customfield_11503']=_0x529fe6['name'];_0x449c9b['fields'][_0x3aef('0x14')]=_0x529fe6['reason'];_0x449c9b['fields'][_0x3aef('0x15')]=_0x529fe6['ip'];var _0x30787c={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x3aef('0x16'),'method':_0x3aef('0x17'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x3aef('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x3aef('0x19')](_0x3aef('0x1a'))}};var _0x2a0aab=JSON['stringify'](_0x449c9b);var _0x3ead7=https['request'](_0x30787c,function(_0x5c07cf){_0x5c07cf[_0x3aef('0x1b')]('utf8');var _0x55d70='';_0x5c07cf['on'](_0x3aef('0x1c'),function(_0x17ae6f){_0x55d70+=_0x17ae6f;});_0x5c07cf['on'](_0x3aef('0x1d'),function(){if(_0x13cd51){return _0x13cd51[_0x3aef('0x1e')](_0x5c07cf[_0x3aef('0x1f')])[_0x3aef('0x20')](JSON[_0x3aef('0x21')](_0x55d70));}});});_0x3ead7['on'](_0x3aef('0x22'),function(_0x1fca0c){if(_0x13cd51){return _0x13cd51[_0x3aef('0x1e')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x3aef('0x23')}]});}});_0x3ead7['write'](_0x2a0aab);_0x3ead7[_0x3aef('0x1d')]();}exports[_0x3aef('0x24')]=openIssue;exports[_0x3aef('0x25')]=function(_0x3c307f,_0xf18273){_0x3c307f['body']['ip']=_0x3c307f[_0x3aef('0x26')][_0x3aef('0x27')]||_0x3c307f['connection'][_0x3aef('0x28')]||_0x3c307f['socket'][_0x3aef('0x28')]||_0x3c307f[_0x3aef('0x29')][_0x3aef('0x2a')][_0x3aef('0x28')];return openIssue(_0x3c307f[_0x3aef('0x2b')],_0xf18273);}; \ No newline at end of file +var _0x3a07=['\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','base64','setEncoding','utf8','data','end','status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','openIssue','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','Report'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x3a07,0x140));var _0x73a0=function(_0x3fa42d,_0x326449){_0x3fa42d=_0x3fa42d-0x0;var _0x1bef7d=_0x3a07[_0x3fa42d];return _0x1bef7d;};'use strict';var BPromise=require(_0x73a0('0x0'));var https=require(_0x73a0('0x1'));var logger=require(_0x73a0('0x2'))(_0x73a0('0x3'));var USERNAME=_0x73a0('0x4');var PASSWORD=_0x73a0('0x5');function openIssue(_0x5274d9,_0x400295){var _0x514c4f={'fields':{'project':{'key':_0x5274d9[_0x73a0('0x6')]||_0x73a0('0x7')},'summary':(_0x5274d9['summary']||_0x73a0('0x8'))+_0x73a0('0x9')+_0x5274d9['ip'],'description':_0x5274d9[_0x73a0('0xa')]||JSON[_0x73a0('0xb')](_0x5274d9),'issuetype':{'name':_0x5274d9[_0x73a0('0xc')]||_0x73a0('0xd')}}};_0x514c4f[_0x73a0('0xe')][_0x73a0('0xf')]=_0x5274d9[_0x73a0('0x10')];_0x514c4f[_0x73a0('0xe')][_0x73a0('0x11')]=_0x5274d9['oldToken'];_0x514c4f[_0x73a0('0xe')][_0x73a0('0x12')]=_0x5274d9[_0x73a0('0x13')];_0x514c4f[_0x73a0('0xe')][_0x73a0('0x14')]=_0x5274d9[_0x73a0('0x15')];_0x514c4f['fields'][_0x73a0('0x16')]=_0x5274d9[_0x73a0('0x17')];_0x514c4f[_0x73a0('0xe')][_0x73a0('0x18')]=_0x5274d9['ip'];var _0x445b9b={'host':_0x73a0('0x19'),'port':0x1bb,'path':_0x73a0('0x1a'),'method':_0x73a0('0x1b'),'timeout':0x4e20,'headers':{'Content-Type':_0x73a0('0x1c'),'Authorization':_0x73a0('0x1d')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x73a0('0x1e'))}};var _0x3b6931=JSON['stringify'](_0x514c4f);var _0xd18c93=https['request'](_0x445b9b,function(_0x56d28f){_0x56d28f[_0x73a0('0x1f')](_0x73a0('0x20'));var _0x4c840c='';_0x56d28f['on'](_0x73a0('0x21'),function(_0x40736a){_0x4c840c+=_0x40736a;});_0x56d28f['on'](_0x73a0('0x22'),function(){if(_0x400295){return _0x400295[_0x73a0('0x23')](_0x56d28f[_0x73a0('0x24')])[_0x73a0('0x25')](JSON['parse'](_0x4c840c));}});});_0xd18c93['on'](_0x73a0('0x26'),function(_0x5cc78f){if(_0x400295){return _0x400295[_0x73a0('0x23')](0x1f4)['json']({'errors':[{'message':_0x73a0('0x27'),'type':'api.jira'}]});}});_0xd18c93['write'](_0x3b6931);_0xd18c93[_0x73a0('0x22')]();}exports[_0x73a0('0x28')]=openIssue;exports['send']=function(_0x307c06,_0x3bed2e){_0x307c06[_0x73a0('0x29')]['ip']=_0x307c06[_0x73a0('0x2a')][_0x73a0('0x2b')]||_0x307c06[_0x73a0('0x2c')][_0x73a0('0x2d')]||_0x307c06[_0x73a0('0x2e')][_0x73a0('0x2d')]||_0x307c06['connection']['socket'][_0x73a0('0x2d')];return openIssue(_0x307c06[_0x73a0('0x29')],_0x3bed2e);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index d195771..d15e063 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 _0x6324=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','show','create','put','/:id','update','delete','exports','multer','util'];(function(_0x3b8831,_0x2a73d2){var _0x3d059a=function(_0x18af50){while(--_0x18af50){_0x3b8831['push'](_0x3b8831['shift']());}};_0x3d059a(++_0x2a73d2);}(_0x6324,0x142));var _0x4632=function(_0x29b564,_0x2d95bd){_0x29b564=_0x29b564-0x0;var _0xae0676=_0x6324[_0x29b564];return _0xae0676;};'use strict';var multer=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var path=require(_0x4632('0x2'));var timeout=require(_0x4632('0x3'));var express=require('express');var router=express[_0x4632('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4632('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4632('0x6'));var controller=require('./jscriptyAnswerReport.controller');router[_0x4632('0x7')]('/',auth[_0x4632('0x8')](),controller[_0x4632('0x9')]);router[_0x4632('0x7')]('/describe',auth[_0x4632('0x8')](),controller[_0x4632('0xa')]);router[_0x4632('0x7')]('/:id',auth[_0x4632('0x8')](),controller[_0x4632('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4632('0xc')]);router[_0x4632('0xd')](_0x4632('0xe'),auth[_0x4632('0x8')](),controller[_0x4632('0xf')]);router[_0x4632('0x10')](_0x4632('0xe'),auth[_0x4632('0x8')](),controller['destroy']);module[_0x4632('0x11')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','show','post'];(function(_0x1064bc,_0x206f12){var _0x5edc45=function(_0x5087bd){while(--_0x5087bd){_0x1064bc['push'](_0x1064bc['shift']());}};_0x5edc45(++_0x206f12);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 6f01e80..0388fdd 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(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x7a54,0x106));var _0x47a5=function(_0x3d8d54,_0x24b536){_0x3d8d54=_0x3d8d54-0x0;var _0x31c3d0=_0x7a54[_0x3d8d54];return _0x31c3d0;};'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(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x7a54,0x106));var _0x47a5=function(_0x2b2250,_0x15c79a){_0x2b2250=_0x2b2250-0x0;var _0x5488c3=_0x7a54[_0x2b2250];return _0x5488c3;};'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 92e9981..88e94b9 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 _0xc838=['count','limit','set','Content-Range','save','update','then','error','send','JscriptyAnswerReport','rawAttributes','fieldName','type','key','map','name','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','includeAll','rows','catch','show','options','create','body','find','destroy','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc838,0xbd));var _0x8c83=function(_0x5668ec,_0x13ce45){_0x5668ec=_0x5668ec-0x0;var _0x512285=_0xc838[_0x5668ec];return _0x512285;};'use strict';var emlformat=require(_0x8c83('0x0'));var rimraf=require(_0x8c83('0x1'));var zipdir=require(_0x8c83('0x2'));var jsonpatch=require(_0x8c83('0x3'));var rp=require(_0x8c83('0x4'));var moment=require(_0x8c83('0x5'));var BPromise=require(_0x8c83('0x6'));var Mustache=require(_0x8c83('0x7'));var util=require(_0x8c83('0x8'));var path=require(_0x8c83('0x9'));var sox=require(_0x8c83('0xa'));var csv=require(_0x8c83('0xb'));var ejs=require(_0x8c83('0xc'));var fs=require('fs');var fs_extra=require(_0x8c83('0xd'));var _=require(_0x8c83('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8c83('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8c83('0xb'));var querystring=require(_0x8c83('0x10'));var Papa=require(_0x8c83('0x11'));var Redis=require(_0x8c83('0x12'));var authService=require(_0x8c83('0x13'));var qs=require(_0x8c83('0x14'));var as=require(_0x8c83('0x15'));var hardwareService=require(_0x8c83('0x16'));var logger=require(_0x8c83('0x17'))(_0x8c83('0x18'));var utils=require(_0x8c83('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x8c83('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51d568,_0x4a2fc7){_0x4a2fc7=_0x4a2fc7||0xcc;return function(_0x57a0b5){if(_0x57a0b5){return _0x51d568[_0x8c83('0x1b')](_0x4a2fc7);}return _0x51d568[_0x8c83('0x1c')](_0x4a2fc7)[_0x8c83('0x1d')]();};}function respondWithResult(_0x45d86c,_0x401fc5){_0x401fc5=_0x401fc5||0xc8;return function(_0x1aaac5){if(_0x1aaac5){return _0x45d86c[_0x8c83('0x1c')](_0x401fc5)[_0x8c83('0x1e')](_0x1aaac5);}};}function respondWithFilteredResult(_0x1ac932,_0xf2dee0){return function(_0x573b7d){if(_0x573b7d){var _0x2b4027=typeof _0xf2dee0[_0x8c83('0x1f')]==='undefined'&&typeof _0xf2dee0['limit']===_0x8c83('0x20');var _0x4e3da8=_0x573b7d[_0x8c83('0x21')];var _0x535962=_0x2b4027?0x0:_0xf2dee0['offset'];var _0x3f4b38=_0x2b4027?_0x573b7d['count']:_0xf2dee0[_0x8c83('0x1f')]+_0xf2dee0[_0x8c83('0x22')];var _0x505c0c;if(_0x3f4b38>=_0x4e3da8){_0x3f4b38=_0x4e3da8;_0x505c0c=0xc8;}else{_0x505c0c=0xce;}_0x1ac932['status'](_0x505c0c);return _0x1ac932[_0x8c83('0x23')](_0x8c83('0x24'),_0x535962+'-'+_0x3f4b38+'/'+_0x4e3da8)['json'](_0x573b7d);}return null;};}function patchUpdates(_0x41e629){return function(_0x18f718){try{jsonpatch['apply'](_0x18f718,_0x41e629,!![]);}catch(_0x34825d){return BPromise['reject'](_0x34825d);}return _0x18f718[_0x8c83('0x25')]();};}function saveUpdates(_0x39b02f,_0x17937e){return function(_0xf7b089){if(_0xf7b089){return _0xf7b089[_0x8c83('0x26')](_0x39b02f)['then'](function(_0x4faecd){return _0x4faecd;});}return null;};}function removeEntity(_0x29fced,_0x3a21e9){return function(_0x59e6f9){if(_0x59e6f9){return _0x59e6f9['destroy']()[_0x8c83('0x27')](function(){_0x29fced[_0x8c83('0x1c')](0xcc)[_0x8c83('0x1d')]();});}};}function handleEntityNotFound(_0x5034e1,_0x1bd922){return function(_0x4f7088){if(!_0x4f7088){_0x5034e1[_0x8c83('0x1b')](0x194);}return _0x4f7088;};}function handleError(_0xc5d97d,_0x29b5d8){_0x29b5d8=_0x29b5d8||0x1f4;return function(_0x1180e1){logger[_0x8c83('0x28')](_0x1180e1['stack']);if(_0x1180e1['name']){delete _0x1180e1['name'];}_0xc5d97d[_0x8c83('0x1c')](_0x29b5d8)[_0x8c83('0x29')](_0x1180e1);};}exports['index']=function(_0x106f71,_0x12419a){var _0x142201={},_0x596ff0={},_0x48a74b={'count':0x0,'rows':[]};var _0x1b054a=_['map'](db[_0x8c83('0x2a')][_0x8c83('0x2b')],function(_0x290af8){return{'name':_0x290af8[_0x8c83('0x2c')],'type':_0x290af8[_0x8c83('0x2d')][_0x8c83('0x2e')]};});_0x596ff0['model']=_[_0x8c83('0x2f')](_0x1b054a,_0x8c83('0x30'));_0x596ff0[_0x8c83('0x31')]=_[_0x8c83('0x32')](_0x106f71[_0x8c83('0x31')]);_0x596ff0[_0x8c83('0x33')]=_[_0x8c83('0x34')](_0x596ff0[_0x8c83('0x35')],_0x596ff0[_0x8c83('0x31')]);_0x142201[_0x8c83('0x36')]=_['intersection'](_0x596ff0[_0x8c83('0x35')],qs[_0x8c83('0x37')](_0x106f71[_0x8c83('0x31')]['fields']));_0x142201[_0x8c83('0x36')]=_0x142201[_0x8c83('0x36')]['length']?_0x142201[_0x8c83('0x36')]:_0x596ff0[_0x8c83('0x35')];if(!_0x106f71[_0x8c83('0x31')][_0x8c83('0x38')](_0x8c83('0x39'))){_0x142201[_0x8c83('0x22')]=qs[_0x8c83('0x22')](_0x106f71[_0x8c83('0x31')][_0x8c83('0x22')]);_0x142201[_0x8c83('0x1f')]=qs[_0x8c83('0x1f')](_0x106f71[_0x8c83('0x31')]['offset']);}_0x142201['order']=qs[_0x8c83('0x3a')](_0x106f71[_0x8c83('0x31')][_0x8c83('0x3a')]);_0x142201[_0x8c83('0x3b')]=qs[_0x8c83('0x33')](_['pick'](_0x106f71['query'],_0x596ff0[_0x8c83('0x33')]),_0x1b054a);if(_0x106f71[_0x8c83('0x31')][_0x8c83('0x3c')]){_0x142201['where']=_['merge'](_0x142201['where'],{'$or':_['map'](_0x1b054a,function(_0x259bca){if(_0x259bca[_0x8c83('0x2d')]!==_0x8c83('0x3d')){var _0xbc83f8={};_0xbc83f8[_0x259bca[_0x8c83('0x30')]]={'$like':'%'+_0x106f71[_0x8c83('0x31')][_0x8c83('0x3c')]+'%'};return _0xbc83f8;}})});}_0x142201=_[_0x8c83('0x3e')]({},_0x142201,_0x106f71['options']);var _0x5bfea5={'where':_0x142201[_0x8c83('0x3b')]};return db[_0x8c83('0x2a')][_0x8c83('0x21')](_0x5bfea5)['then'](function(_0x2bab6d){_0x48a74b['count']=_0x2bab6d;if(_0x106f71[_0x8c83('0x31')][_0x8c83('0x3f')]){_0x142201['include']=[{'all':!![]}];}return db[_0x8c83('0x2a')]['findAll'](_0x142201);})['then'](function(_0x5dfc16){_0x48a74b[_0x8c83('0x40')]=_0x5dfc16;return _0x48a74b;})[_0x8c83('0x27')](respondWithFilteredResult(_0x12419a,_0x142201))[_0x8c83('0x41')](handleError(_0x12419a,null));};exports[_0x8c83('0x42')]=function(_0x3e4eb9,_0x3883de){var _0x3a6c98={'raw':!![],'where':{'id':_0x3e4eb9['params']['id']}},_0x4b540d={};_0x4b540d[_0x8c83('0x35')]=_[_0x8c83('0x32')](db[_0x8c83('0x2a')][_0x8c83('0x2b')]);_0x4b540d[_0x8c83('0x31')]=_[_0x8c83('0x32')](_0x3e4eb9[_0x8c83('0x31')]);_0x4b540d['filters']=_['intersection'](_0x4b540d[_0x8c83('0x35')],_0x4b540d[_0x8c83('0x31')]);_0x3a6c98[_0x8c83('0x36')]=_[_0x8c83('0x34')](_0x4b540d[_0x8c83('0x35')],qs[_0x8c83('0x37')](_0x3e4eb9[_0x8c83('0x31')][_0x8c83('0x37')]));_0x3a6c98[_0x8c83('0x36')]=_0x3a6c98[_0x8c83('0x36')]['length']?_0x3a6c98['attributes']:_0x4b540d[_0x8c83('0x35')];if(_0x3e4eb9[_0x8c83('0x31')][_0x8c83('0x3f')]){_0x3a6c98['include']=[{'all':!![]}];}_0x3a6c98=_[_0x8c83('0x3e')]({},_0x3a6c98,_0x3e4eb9[_0x8c83('0x43')]);return db[_0x8c83('0x2a')]['find'](_0x3a6c98)['then'](handleEntityNotFound(_0x3883de,null))['then'](respondWithResult(_0x3883de,null))[_0x8c83('0x41')](handleError(_0x3883de,null));};exports['create']=function(_0x5d3734,_0x35ee54){return db['JscriptyAnswerReport'][_0x8c83('0x44')](_0x5d3734[_0x8c83('0x45')],{})[_0x8c83('0x27')](respondWithResult(_0x35ee54,0xc9))[_0x8c83('0x41')](handleError(_0x35ee54,null));};exports['update']=function(_0x5d8f9f,_0x2c8853){if(_0x5d8f9f[_0x8c83('0x45')]['id']){delete _0x5d8f9f[_0x8c83('0x45')]['id'];}return db['JscriptyAnswerReport'][_0x8c83('0x46')]({'where':{'id':_0x5d8f9f['params']['id']}})[_0x8c83('0x27')](handleEntityNotFound(_0x2c8853,null))[_0x8c83('0x27')](saveUpdates(_0x5d8f9f[_0x8c83('0x45')],null))[_0x8c83('0x27')](respondWithResult(_0x2c8853,null))['catch'](handleError(_0x2c8853,null));};exports[_0x8c83('0x47')]=function(_0x5830b5,_0x595397){return db[_0x8c83('0x2a')][_0x8c83('0x46')]({'where':{'id':_0x5830b5[_0x8c83('0x48')]['id']}})[_0x8c83('0x27')](handleEntityNotFound(_0x595397,null))['then'](removeEntity(_0x595397,null))[_0x8c83('0x41')](handleError(_0x595397,null));};exports[_0x8c83('0x49')]=function(_0x2c1039,_0xd4badb){return db[_0x8c83('0x2a')][_0x8c83('0x49')]()[_0x8c83('0x27')](respondWithResult(_0xd4badb,null))[_0x8c83('0x41')](handleError(_0xd4badb,null));}; \ No newline at end of file +var _0x7118=['stack','name','send','index','map','JscriptyAnswerReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error'];(function(_0x235f01,_0x7c2ed0){var _0x6e3680=function(_0x42bdfa){while(--_0x42bdfa){_0x235f01['push'](_0x235f01['shift']());}};_0x6e3680(++_0x7c2ed0);}(_0x7118,0x159));var _0x8711=function(_0x237b4f,_0x38fc03){_0x237b4f=_0x237b4f-0x0;var _0x3b9c08=_0x7118[_0x237b4f];return _0x3b9c08;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8711('0x0'));var jsonpatch=require(_0x8711('0x1'));var rp=require('request-promise');var moment=require(_0x8711('0x2'));var BPromise=require(_0x8711('0x3'));var Mustache=require(_0x8711('0x4'));var util=require(_0x8711('0x5'));var path=require(_0x8711('0x6'));var sox=require(_0x8711('0x7'));var csv=require(_0x8711('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8711('0x9'));var _=require(_0x8711('0xa'));var squel=require(_0x8711('0xb'));var crypto=require(_0x8711('0xc'));var jsforce=require(_0x8711('0xd'));var deskjs=require(_0x8711('0xe'));var toCsv=require(_0x8711('0x8'));var querystring=require(_0x8711('0xf'));var Papa=require(_0x8711('0x10'));var Redis=require(_0x8711('0x11'));var authService=require(_0x8711('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8711('0x13'));var logger=require(_0x8711('0x14'))(_0x8711('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8711('0x16'));var db=require(_0x8711('0x17'))['db'];function respondWithStatusCode(_0x5d2c38,_0x49b241){_0x49b241=_0x49b241||0xcc;return function(_0x11adb0){if(_0x11adb0){return _0x5d2c38[_0x8711('0x18')](_0x49b241);}return _0x5d2c38[_0x8711('0x19')](_0x49b241)[_0x8711('0x1a')]();};}function respondWithResult(_0xc0a891,_0x22f434){_0x22f434=_0x22f434||0xc8;return function(_0x16b742){if(_0x16b742){return _0xc0a891['status'](_0x22f434)[_0x8711('0x1b')](_0x16b742);}};}function respondWithFilteredResult(_0x363bcd,_0x13f394){return function(_0x2e12ec){if(_0x2e12ec){var _0x3ab905=typeof _0x13f394[_0x8711('0x1c')]==='undefined'&&typeof _0x13f394[_0x8711('0x1d')]===_0x8711('0x1e');var _0x1c2cb5=_0x2e12ec[_0x8711('0x1f')];var _0x19a157=_0x3ab905?0x0:_0x13f394['offset'];var _0x5b2bf8=_0x3ab905?_0x2e12ec['count']:_0x13f394[_0x8711('0x1c')]+_0x13f394[_0x8711('0x1d')];var _0x2f6134;if(_0x5b2bf8>=_0x1c2cb5){_0x5b2bf8=_0x1c2cb5;_0x2f6134=0xc8;}else{_0x2f6134=0xce;}_0x363bcd['status'](_0x2f6134);return _0x363bcd['set'](_0x8711('0x20'),_0x19a157+'-'+_0x5b2bf8+'/'+_0x1c2cb5)[_0x8711('0x1b')](_0x2e12ec);}return null;};}function patchUpdates(_0x1209e0){return function(_0x44b948){try{jsonpatch[_0x8711('0x21')](_0x44b948,_0x1209e0,!![]);}catch(_0x270081){return BPromise[_0x8711('0x22')](_0x270081);}return _0x44b948[_0x8711('0x23')]();};}function saveUpdates(_0xace829,_0x41369d){return function(_0x4a35f5){if(_0x4a35f5){return _0x4a35f5[_0x8711('0x24')](_0xace829)[_0x8711('0x25')](function(_0x3302b9){return _0x3302b9;});}return null;};}function removeEntity(_0x939ef3,_0x4cf830){return function(_0x27cafd){if(_0x27cafd){return _0x27cafd[_0x8711('0x26')]()[_0x8711('0x25')](function(){_0x939ef3['status'](0xcc)[_0x8711('0x1a')]();});}};}function handleEntityNotFound(_0x17bf7f,_0x3e8281){return function(_0x217197){if(!_0x217197){_0x17bf7f[_0x8711('0x18')](0x194);}return _0x217197;};}function handleError(_0x514956,_0x494683){_0x494683=_0x494683||0x1f4;return function(_0x515a74){logger[_0x8711('0x27')](_0x515a74[_0x8711('0x28')]);if(_0x515a74[_0x8711('0x29')]){delete _0x515a74[_0x8711('0x29')];}_0x514956[_0x8711('0x19')](_0x494683)[_0x8711('0x2a')](_0x515a74);};}exports[_0x8711('0x2b')]=function(_0x3ca2b5,_0x398097){var _0x47e7b7={},_0x27db5d={},_0x591380={'count':0x0,'rows':[]};var _0x28c2d5=_[_0x8711('0x2c')](db[_0x8711('0x2d')]['rawAttributes'],function(_0x440bc8){return{'name':_0x440bc8['fieldName'],'type':_0x440bc8[_0x8711('0x2e')][_0x8711('0x2f')]};});_0x27db5d[_0x8711('0x30')]=_['map'](_0x28c2d5,'name');_0x27db5d[_0x8711('0x31')]=_[_0x8711('0x32')](_0x3ca2b5[_0x8711('0x31')]);_0x27db5d[_0x8711('0x33')]=_[_0x8711('0x34')](_0x27db5d[_0x8711('0x30')],_0x27db5d[_0x8711('0x31')]);_0x47e7b7[_0x8711('0x35')]=_[_0x8711('0x34')](_0x27db5d[_0x8711('0x30')],qs['fields'](_0x3ca2b5[_0x8711('0x31')][_0x8711('0x36')]));_0x47e7b7[_0x8711('0x35')]=_0x47e7b7[_0x8711('0x35')][_0x8711('0x37')]?_0x47e7b7[_0x8711('0x35')]:_0x27db5d[_0x8711('0x30')];if(!_0x3ca2b5[_0x8711('0x31')][_0x8711('0x38')](_0x8711('0x39'))){_0x47e7b7['limit']=qs[_0x8711('0x1d')](_0x3ca2b5[_0x8711('0x31')][_0x8711('0x1d')]);_0x47e7b7[_0x8711('0x1c')]=qs[_0x8711('0x1c')](_0x3ca2b5['query'][_0x8711('0x1c')]);}_0x47e7b7[_0x8711('0x3a')]=qs[_0x8711('0x3b')](_0x3ca2b5['query'][_0x8711('0x3b')]);_0x47e7b7[_0x8711('0x3c')]=qs[_0x8711('0x33')](_[_0x8711('0x3d')](_0x3ca2b5[_0x8711('0x31')],_0x27db5d[_0x8711('0x33')]),_0x28c2d5);if(_0x3ca2b5[_0x8711('0x31')]['filter']){_0x47e7b7[_0x8711('0x3c')]=_[_0x8711('0x3e')](_0x47e7b7[_0x8711('0x3c')],{'$or':_[_0x8711('0x2c')](_0x28c2d5,function(_0x5a7e83){if(_0x5a7e83['type']!==_0x8711('0x3f')){var _0x18b82a={};_0x18b82a[_0x5a7e83[_0x8711('0x29')]]={'$like':'%'+_0x3ca2b5[_0x8711('0x31')][_0x8711('0x40')]+'%'};return _0x18b82a;}})});}_0x47e7b7=_[_0x8711('0x3e')]({},_0x47e7b7,_0x3ca2b5[_0x8711('0x41')]);var _0x2db474={'where':_0x47e7b7[_0x8711('0x3c')]};return db[_0x8711('0x2d')][_0x8711('0x1f')](_0x2db474)[_0x8711('0x25')](function(_0x1efd42){_0x591380[_0x8711('0x1f')]=_0x1efd42;if(_0x3ca2b5[_0x8711('0x31')][_0x8711('0x42')]){_0x47e7b7[_0x8711('0x43')]=[{'all':!![]}];}return db[_0x8711('0x2d')][_0x8711('0x44')](_0x47e7b7);})[_0x8711('0x25')](function(_0x2fb5e8){_0x591380['rows']=_0x2fb5e8;return _0x591380;})[_0x8711('0x25')](respondWithFilteredResult(_0x398097,_0x47e7b7))['catch'](handleError(_0x398097,null));};exports[_0x8711('0x45')]=function(_0x3d9562,_0x121971){var _0x38c0c4={'raw':!![],'where':{'id':_0x3d9562[_0x8711('0x46')]['id']}},_0x5f2c0c={};_0x5f2c0c[_0x8711('0x30')]=_[_0x8711('0x32')](db[_0x8711('0x2d')][_0x8711('0x47')]);_0x5f2c0c[_0x8711('0x31')]=_['keys'](_0x3d9562[_0x8711('0x31')]);_0x5f2c0c[_0x8711('0x33')]=_[_0x8711('0x34')](_0x5f2c0c[_0x8711('0x30')],_0x5f2c0c['query']);_0x38c0c4[_0x8711('0x35')]=_[_0x8711('0x34')](_0x5f2c0c[_0x8711('0x30')],qs[_0x8711('0x36')](_0x3d9562[_0x8711('0x31')]['fields']));_0x38c0c4['attributes']=_0x38c0c4[_0x8711('0x35')][_0x8711('0x37')]?_0x38c0c4['attributes']:_0x5f2c0c[_0x8711('0x30')];if(_0x3d9562[_0x8711('0x31')][_0x8711('0x42')]){_0x38c0c4[_0x8711('0x43')]=[{'all':!![]}];}_0x38c0c4=_['merge']({},_0x38c0c4,_0x3d9562[_0x8711('0x41')]);return db[_0x8711('0x2d')][_0x8711('0x48')](_0x38c0c4)['then'](handleEntityNotFound(_0x121971,null))[_0x8711('0x25')](respondWithResult(_0x121971,null))[_0x8711('0x49')](handleError(_0x121971,null));};exports['create']=function(_0x3e9ab1,_0x14a815){return db['JscriptyAnswerReport'][_0x8711('0x4a')](_0x3e9ab1[_0x8711('0x4b')],{})['then'](respondWithResult(_0x14a815,0xc9))[_0x8711('0x49')](handleError(_0x14a815,null));};exports[_0x8711('0x24')]=function(_0x1c55d8,_0x17a3f5){if(_0x1c55d8['body']['id']){delete _0x1c55d8[_0x8711('0x4b')]['id'];}return db[_0x8711('0x2d')]['find']({'where':{'id':_0x1c55d8[_0x8711('0x46')]['id']}})[_0x8711('0x25')](handleEntityNotFound(_0x17a3f5,null))['then'](saveUpdates(_0x1c55d8['body'],null))['then'](respondWithResult(_0x17a3f5,null))['catch'](handleError(_0x17a3f5,null));};exports[_0x8711('0x26')]=function(_0x2efca0,_0x1c83f7){return db[_0x8711('0x2d')][_0x8711('0x48')]({'where':{'id':_0x2efca0[_0x8711('0x46')]['id']}})[_0x8711('0x25')](handleEntityNotFound(_0x1c83f7,null))['then'](removeEntity(_0x1c83f7,null))['catch'](handleError(_0x1c83f7,null));};exports['describe']=function(_0x3b9e2b,_0x867599){return db[_0x8711('0x2d')][_0x8711('0x4c')]()[_0x8711('0x25')](respondWithResult(_0x867599,null))[_0x8711('0x49')](handleError(_0x867599,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 6006c7f..4b6ea0d 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 _0x1736=['lodash','util','../../config/logger','api','path','rimraf','./jscriptyAnswerReport.attributes','exports','define','report_jscripty_answers'];(function(_0x51a327,_0x3669f0){var _0x22af21=function(_0x43a6cf){while(--_0x43a6cf){_0x51a327['push'](_0x51a327['shift']());}};_0x22af21(++_0x3669f0);}(_0x1736,0x19a));var _0x6173=function(_0x598cc5,_0x2cc52){_0x598cc5=_0x598cc5-0x0;var _0xd27750=_0x1736[_0x598cc5];return _0xd27750;};'use strict';var _=require(_0x6173('0x0'));var util=require(_0x6173('0x1'));var logger=require(_0x6173('0x2'))(_0x6173('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6173('0x4'));var rimraf=require(_0x6173('0x5'));var config=require('../../config/environment');var attributes=require(_0x6173('0x6'));module[_0x6173('0x7')]=function(_0x203df4,_0x40aec9){return _0x203df4[_0x6173('0x8')]('JscriptyAnswerReport',attributes,{'tableName':_0x6173('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2dae=['request-promise','../../config/environment','./jscriptyAnswerReport.attributes','define','JscriptyAnswerReport','lodash','util','../../config/logger','api','moment'];(function(_0x3c5f8d,_0x39891f){var _0x3b7beb=function(_0x44d6c9){while(--_0x44d6c9){_0x3c5f8d['push'](_0x3c5f8d['shift']());}};_0x3b7beb(++_0x39891f);}(_0x2dae,0xd7));var _0xe2da=function(_0x16aaef,_0x410651){_0x16aaef=_0x16aaef-0x0;var _0x1c82ef=_0x2dae[_0x16aaef];return _0x1c82ef;};'use strict';var _=require(_0xe2da('0x0'));var util=require(_0xe2da('0x1'));var logger=require(_0xe2da('0x2'))(_0xe2da('0x3'));var moment=require(_0xe2da('0x4'));var BPromise=require('bluebird');var rp=require(_0xe2da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe2da('0x6'));var attributes=require(_0xe2da('0x7'));module['exports']=function(_0x1a18ef,_0x360674){return _0x1a18ef[_0xe2da('0x8')](_0xe2da('0x9'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index b122d6e..d80f77e 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 _0x32d6=['../../config/environment','jayson/promise','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5d640e,_0x149b36){var _0x58d5dc=function(_0x3cc928){while(--_0x3cc928){_0x5d640e['push'](_0x5d640e['shift']());}};_0x58d5dc(++_0x149b36);}(_0x32d6,0xf5));var _0x632d=function(_0x2fd941,_0x273179){_0x2fd941=_0x2fd941-0x0;var _0x2ee734=_0x32d6[_0x2fd941];return _0x2ee734;};'use strict';var _=require(_0x632d('0x0'));var util=require('util');var moment=require(_0x632d('0x1'));var BPromise=require(_0x632d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x632d('0x3'));var db=require(_0x632d('0x4'))['db'];var utils=require(_0x632d('0x5'));var logger=require(_0x632d('0x6'))(_0x632d('0x7'));var config=require(_0x632d('0x8'));var jayson=require(_0x632d('0x9'));var client=jayson['client'][_0x632d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x208a40,_0x24d5c5,_0x221865){return new BPromise(function(_0xa22851,_0x58ac82){return client[_0x632d('0xb')](_0x208a40,_0x221865)[_0x632d('0xc')](function(_0x4d8bdf){logger[_0x632d('0xd')](_0x632d('0xe'),_0x24d5c5,'request\x20sent');logger['debug'](_0x632d('0xf'),_0x24d5c5,_0x632d('0x10'),JSON[_0x632d('0x11')](_0x4d8bdf));if(_0x4d8bdf[_0x632d('0x12')]){if(_0x4d8bdf['error'][_0x632d('0x13')]===0x1f4){logger[_0x632d('0x12')](_0x632d('0xe'),_0x24d5c5,_0x4d8bdf['error'][_0x632d('0x14')]);return _0x58ac82(_0x4d8bdf[_0x632d('0x12')][_0x632d('0x14')]);}logger[_0x632d('0x12')](_0x632d('0xe'),_0x24d5c5,_0x4d8bdf[_0x632d('0x12')][_0x632d('0x14')]);return _0xa22851(_0x4d8bdf['error'][_0x632d('0x14')]);}else{logger[_0x632d('0xd')](_0x632d('0xe'),_0x24d5c5,_0x632d('0x10'));_0xa22851(_0x4d8bdf[_0x632d('0x15')][_0x632d('0x14')]);}})[_0x632d('0x16')](function(_0x4ac470){logger[_0x632d('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x24d5c5,_0x4ac470);_0x58ac82(_0x4ac470);});});} \ No newline at end of file +var _0x9d31=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird'];(function(_0x471dd0,_0x2989d3){var _0x18887c=function(_0x48ae6e){while(--_0x48ae6e){_0x471dd0['push'](_0x471dd0['shift']());}};_0x18887c(++_0x2989d3);}(_0x9d31,0x14d));var _0x19d3=function(_0x5e9691,_0x251156){_0x5e9691=_0x5e9691-0x0;var _0x6348f9=_0x9d31[_0x5e9691];return _0x6348f9;};'use strict';var _=require(_0x19d3('0x0'));var util=require(_0x19d3('0x1'));var moment=require('moment');var BPromise=require(_0x19d3('0x2'));var rs=require(_0x19d3('0x3'));var fs=require('fs');var Redis=require(_0x19d3('0x4'));var db=require(_0x19d3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x19d3('0x6'))(_0x19d3('0x7'));var config=require(_0x19d3('0x8'));var jayson=require(_0x19d3('0x9'));var client=jayson[_0x19d3('0xa')][_0x19d3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1327ab,_0x382073,_0x4cf26c){return new BPromise(function(_0x50c036,_0x3574fe){return client['request'](_0x1327ab,_0x4cf26c)['then'](function(_0x3fe36f){logger[_0x19d3('0xc')](_0x19d3('0xd'),_0x382073,_0x19d3('0xe'));logger[_0x19d3('0xf')](_0x19d3('0x10'),_0x382073,_0x19d3('0xe'),JSON[_0x19d3('0x11')](_0x3fe36f));if(_0x3fe36f[_0x19d3('0x12')]){if(_0x3fe36f[_0x19d3('0x12')]['code']===0x1f4){logger[_0x19d3('0x12')](_0x19d3('0xd'),_0x382073,_0x3fe36f[_0x19d3('0x12')][_0x19d3('0x13')]);return _0x3574fe(_0x3fe36f['error']['message']);}logger[_0x19d3('0x12')](_0x19d3('0xd'),_0x382073,_0x3fe36f['error']['message']);return _0x50c036(_0x3fe36f['error'][_0x19d3('0x13')]);}else{logger[_0x19d3('0xc')](_0x19d3('0xd'),_0x382073,'request\x20sent');_0x50c036(_0x3fe36f[_0x19d3('0x14')]['message']);}})['catch'](function(_0x101370){logger[_0x19d3('0x12')](_0x19d3('0xd'),_0x382073,_0x101370);_0x3574fe(_0x101370);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index efda70c..a60c0cb 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 _0x2cc1=['post','create','/:id/clone','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary'];(function(_0x3c8235,_0x42667b){var _0x404b81=function(_0x3e87d9){while(--_0x3e87d9){_0x3c8235['push'](_0x3c8235['shift']());}};_0x404b81(++_0x42667b);}(_0x2cc1,0x157));var _0x12cc=function(_0x463f44,_0xc071ff){_0x463f44=_0x463f44-0x0;var _0x304163=_0x2cc1[_0x463f44];return _0x304163;};'use strict';var multer=require(_0x12cc('0x0'));var util=require(_0x12cc('0x1'));var path=require(_0x12cc('0x2'));var timeout=require(_0x12cc('0x3'));var express=require(_0x12cc('0x4'));var router=express[_0x12cc('0x5')]();var fs_extra=require(_0x12cc('0x6'));var auth=require(_0x12cc('0x7'));var interaction=require(_0x12cc('0x8'));var config=require(_0x12cc('0x9'));var controller=require('./jscriptyProject.controller');router[_0x12cc('0xa')]('/',auth[_0x12cc('0xb')](),controller[_0x12cc('0xc')]);router[_0x12cc('0xa')](_0x12cc('0xd'),auth[_0x12cc('0xb')](),controller[_0x12cc('0xe')]);router[_0x12cc('0xa')](_0x12cc('0xf'),auth[_0x12cc('0xb')](),controller['getSessions']);router[_0x12cc('0xa')](_0x12cc('0x10'),auth[_0x12cc('0xb')](),controller[_0x12cc('0x11')]);router['get'](_0x12cc('0x12'),auth['isAuthenticated'](),timeout(_0x12cc('0x13')),controller[_0x12cc('0x14')]);router[_0x12cc('0x15')]('/',auth[_0x12cc('0xb')](),controller[_0x12cc('0x16')]);router[_0x12cc('0x15')](_0x12cc('0x17'),auth[_0x12cc('0xb')](),controller['clone']);router[_0x12cc('0x18')](_0x12cc('0xd'),auth['isAuthenticated'](),controller[_0x12cc('0x19')]);router['delete'](_0x12cc('0xd'),auth[_0x12cc('0xb')](),controller[_0x12cc('0x1a')]);module[_0x12cc('0x1b')]=router; \ No newline at end of file +var _0x64bd=['getSessions','getAnswers','30s','getSummary','post','/:id/clone','clone','put','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','/:id','isAuthenticated','show','/:id/sessions'];(function(_0x485f53,_0x104081){var _0x480f1e=function(_0x2d61d2){while(--_0x2d61d2){_0x485f53['push'](_0x485f53['shift']());}};_0x480f1e(++_0x104081);}(_0x64bd,0x15a));var _0xd64b=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x64bd[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd64b('0x0'));var timeout=require(_0xd64b('0x1'));var express=require(_0xd64b('0x2'));var router=express[_0xd64b('0x3')]();var fs_extra=require(_0xd64b('0x4'));var auth=require(_0xd64b('0x5'));var interaction=require(_0xd64b('0x6'));var config=require(_0xd64b('0x7'));var controller=require(_0xd64b('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd64b('0x9')](_0xd64b('0xa'),auth[_0xd64b('0xb')](),controller[_0xd64b('0xc')]);router['get'](_0xd64b('0xd'),auth[_0xd64b('0xb')](),controller[_0xd64b('0xe')]);router[_0xd64b('0x9')]('/:id/answers',auth[_0xd64b('0xb')](),controller[_0xd64b('0xf')]);router[_0xd64b('0x9')]('/:id/summary',auth[_0xd64b('0xb')](),timeout(_0xd64b('0x10')),controller[_0xd64b('0x11')]);router[_0xd64b('0x12')]('/',auth[_0xd64b('0xb')](),controller['create']);router[_0xd64b('0x12')](_0xd64b('0x13'),auth[_0xd64b('0xb')](),controller[_0xd64b('0x14')]);router[_0xd64b('0x15')](_0xd64b('0xa'),auth[_0xd64b('0xb')](),controller['update']);router[_0xd64b('0x16')](_0xd64b('0xa'),auth[_0xd64b('0xb')](),controller[_0xd64b('0x17')]);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 44f62d8..e4092a0 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 _0x03a5=['setDataValue','getDataValue','description','BOOLEAN','sequelize','lodash','util','STRING','name','TEXT','isObjectLike','formData','stringify','isString'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x03a5,0x162));var _0x503a=function(_0x420f45,_0x82ba43){_0x420f45=_0x420f45-0x0;var _0x115f02=_0x03a5[_0x420f45];return _0x115f02;};'use strict';var Sequelize=require(_0x503a('0x0'));var _=require(_0x503a('0x1'));var util=require(_0x503a('0x2'));module['exports']={'name':{'type':Sequelize[_0x503a('0x3')],'unique':_0x503a('0x4')},'description':{'type':Sequelize[_0x503a('0x3')]},'formData':{'type':Sequelize[_0x503a('0x5')]('long'),'set':function(_0xcffc77){if(_[_0x503a('0x6')](_0xcffc77)){this['setDataValue'](_0x503a('0x7'),JSON[_0x503a('0x8')](_0xcffc77));}else if(_[_0x503a('0x9')](_0xcffc77)){this[_0x503a('0xa')](_0x503a('0x7'),_0xcffc77);}else{this[_0x503a('0xa')]('formData',util['format']('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x503a('0xb')](_0x503a('0x4'))||'',this[_0x503a('0xb')](_0x503a('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x503a('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x503a('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x9298=['STRING','TEXT','isObjectLike','setDataValue','stringify','isString','formData','format','getDataValue','description','BOOLEAN','sequelize','util','exports','name'];(function(_0x342548,_0x31c72e){var _0x107140=function(_0x32c2ab){while(--_0x32c2ab){_0x342548['push'](_0x342548['shift']());}};_0x107140(++_0x31c72e);}(_0x9298,0x10a));var _0x8929=function(_0x1c56e0,_0x12d3f8){_0x1c56e0=_0x1c56e0-0x0;var _0x4322bd=_0x9298[_0x1c56e0];return _0x4322bd;};'use strict';var Sequelize=require(_0x8929('0x0'));var _=require('lodash');var util=require(_0x8929('0x1'));module[_0x8929('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x8929('0x3')},'description':{'type':Sequelize[_0x8929('0x4')]},'formData':{'type':Sequelize[_0x8929('0x5')]('long'),'set':function(_0x3ff6b5){if(_[_0x8929('0x6')](_0x3ff6b5)){this[_0x8929('0x7')]('formData',JSON[_0x8929('0x8')](_0x3ff6b5));}else if(_[_0x8929('0x9')](_0x3ff6b5)){this['setDataValue'](_0x8929('0xa'),_0x3ff6b5);}else{this[_0x8929('0x7')](_0x8929('0xa'),util[_0x8929('0xb')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x8929('0xc')]('name')||'',this[_0x8929('0xc')](_0x8929('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x8929('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x8929('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index afae699..287f054 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 _0x6e6c=['fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','length','find','create','user','UserProfileSection','autoAssociation','UserProfileResource','clone','params','createdAt','omit','body','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','getSessions','JscriptySessionReport','nolimit','getAnswers','findOne','JscriptyAnswerReport','ProjectId','number','fromCharCode','indexOf','toString','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Projects','end','error','stack','name','send','index','map','JscriptyProject','rawAttributes'];(function(_0x4e46aa,_0x4413e3){var _0x1ff81d=function(_0x497b09){while(--_0x497b09){_0x4e46aa['push'](_0x4e46aa['shift']());}};_0x1ff81d(++_0x4413e3);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e6c[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xc6e6('0x0'));var rimraf=require(_0xc6e6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc6e6('0x2'));var rp=require(_0xc6e6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc6e6('0x4'));var util=require('util');var path=require(_0xc6e6('0x5'));var sox=require('sox');var csv=require(_0xc6e6('0x6'));var ejs=require(_0xc6e6('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc6e6('0x8'));var squel=require(_0xc6e6('0x9'));var crypto=require('crypto');var jsforce=require(_0xc6e6('0xa'));var deskjs=require(_0xc6e6('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc6e6('0xc'));var Papa=require('papaparse');var Redis=require(_0xc6e6('0xd'));var authService=require(_0xc6e6('0xe'));var qs=require(_0xc6e6('0xf'));var as=require(_0xc6e6('0x10'));var hardwareService=require(_0xc6e6('0x11'));var logger=require(_0xc6e6('0x12'))(_0xc6e6('0x13'));var utils=require(_0xc6e6('0x14'));var config=require(_0xc6e6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc6e6('0x16'))['db'];function respondWithStatusCode(_0x525d60,_0x3a30ce){_0x3a30ce=_0x3a30ce||0xcc;return function(_0x314d0f){if(_0x314d0f){return _0x525d60[_0xc6e6('0x17')](_0x3a30ce);}return _0x525d60[_0xc6e6('0x18')](_0x3a30ce)['end']();};}function respondWithResult(_0x149ac6,_0x2bfe7d){_0x2bfe7d=_0x2bfe7d||0xc8;return function(_0x13be73){if(_0x13be73){return _0x149ac6[_0xc6e6('0x18')](_0x2bfe7d)[_0xc6e6('0x19')](_0x13be73);}};}function respondWithFilteredResult(_0x4cdf15,_0x413cf8){return function(_0x178b34){if(_0x178b34){var _0x569474=typeof _0x413cf8[_0xc6e6('0x1a')]===_0xc6e6('0x1b')&&typeof _0x413cf8[_0xc6e6('0x1c')]==='undefined';var _0x51fd7c=_0x178b34['count'];var _0x3a1ccc=_0x569474?0x0:_0x413cf8['offset'];var _0x46e58f=_0x569474?_0x178b34[_0xc6e6('0x1d')]:_0x413cf8[_0xc6e6('0x1a')]+_0x413cf8[_0xc6e6('0x1c')];var _0x19e1e4;if(_0x46e58f>=_0x51fd7c){_0x46e58f=_0x51fd7c;_0x19e1e4=0xc8;}else{_0x19e1e4=0xce;}_0x4cdf15[_0xc6e6('0x18')](_0x19e1e4);return _0x4cdf15[_0xc6e6('0x1e')](_0xc6e6('0x1f'),_0x3a1ccc+'-'+_0x46e58f+'/'+_0x51fd7c)[_0xc6e6('0x19')](_0x178b34);}return null;};}function patchUpdates(_0x3d734d){return function(_0x4a36b6){try{jsonpatch[_0xc6e6('0x20')](_0x4a36b6,_0x3d734d,!![]);}catch(_0x4ad70e){return BPromise[_0xc6e6('0x21')](_0x4ad70e);}return _0x4a36b6[_0xc6e6('0x22')]();};}function saveUpdates(_0x2be6fc,_0x2f69f1){return function(_0x4f1d68){if(_0x4f1d68){return _0x4f1d68[_0xc6e6('0x23')](_0x2be6fc)[_0xc6e6('0x24')](function(_0x3a96df){return _0x3a96df;});}return null;};}function removeEntity(_0x36ebfa,_0x107561){return function(_0x4c35ae){if(_0x4c35ae){return _0x4c35ae[_0xc6e6('0x25')]()['then'](function(){var _0x266786=_0x4c35ae[_0xc6e6('0x26')]({'plain':!![]});var _0x2e5e0e=_0xc6e6('0x27');return db['UserProfileResource'][_0xc6e6('0x25')]({'where':{'type':_0x2e5e0e,'resourceId':_0x266786['id']}})['then'](function(){return _0x4c35ae;});})[_0xc6e6('0x24')](function(){_0x36ebfa['status'](0xcc)[_0xc6e6('0x28')]();});}};}function handleEntityNotFound(_0x16dcd9,_0x348888){return function(_0x41e7c2){if(!_0x41e7c2){_0x16dcd9[_0xc6e6('0x17')](0x194);}return _0x41e7c2;};}function handleError(_0x5e34f6,_0x346480){_0x346480=_0x346480||0x1f4;return function(_0x1501bd){logger[_0xc6e6('0x29')](_0x1501bd[_0xc6e6('0x2a')]);if(_0x1501bd['name']){delete _0x1501bd[_0xc6e6('0x2b')];}_0x5e34f6['status'](_0x346480)[_0xc6e6('0x2c')](_0x1501bd);};}exports[_0xc6e6('0x2d')]=function(_0x12c616,_0xc578b3){var _0xd3b63={},_0x402598={},_0x43ff9c={'count':0x0,'rows':[]};var _0x337442=_[_0xc6e6('0x2e')](db[_0xc6e6('0x2f')][_0xc6e6('0x30')],function(_0x214d6a){return{'name':_0x214d6a[_0xc6e6('0x31')],'type':_0x214d6a[_0xc6e6('0x32')][_0xc6e6('0x33')]};});_0x402598[_0xc6e6('0x34')]=_[_0xc6e6('0x2e')](_0x337442,'name');_0x402598[_0xc6e6('0x35')]=_[_0xc6e6('0x36')](_0x12c616['query']);_0x402598['filters']=_[_0xc6e6('0x37')](_0x402598[_0xc6e6('0x34')],_0x402598[_0xc6e6('0x35')]);_0xd3b63[_0xc6e6('0x38')]=_[_0xc6e6('0x37')](_0x402598[_0xc6e6('0x34')],qs['fields'](_0x12c616[_0xc6e6('0x35')][_0xc6e6('0x39')]));_0xd3b63[_0xc6e6('0x38')]=_0xd3b63['attributes']['length']?_0xd3b63[_0xc6e6('0x38')]:_0x402598[_0xc6e6('0x34')];if(!_0x12c616[_0xc6e6('0x35')][_0xc6e6('0x3a')]('nolimit')){_0xd3b63['limit']=qs[_0xc6e6('0x1c')](_0x12c616['query'][_0xc6e6('0x1c')]);_0xd3b63['offset']=qs[_0xc6e6('0x1a')](_0x12c616[_0xc6e6('0x35')][_0xc6e6('0x1a')]);}_0xd3b63[_0xc6e6('0x3b')]=qs['sort'](_0x12c616['query'][_0xc6e6('0x3c')]);_0xd3b63[_0xc6e6('0x3d')]=qs[_0xc6e6('0x3e')](_[_0xc6e6('0x3f')](_0x12c616['query'],_0x402598['filters']),_0x337442);if(_0x12c616[_0xc6e6('0x35')][_0xc6e6('0x40')]){_0xd3b63[_0xc6e6('0x3d')]=_[_0xc6e6('0x41')](_0xd3b63['where'],{'$or':_[_0xc6e6('0x2e')](_0x337442,function(_0x46c3ef){if(_0x46c3ef['type']!=='VIRTUAL'){var _0x2b01fd={};_0x2b01fd[_0x46c3ef['name']]={'$like':'%'+_0x12c616[_0xc6e6('0x35')][_0xc6e6('0x40')]+'%'};return _0x2b01fd;}})});}_0xd3b63=_['merge']({},_0xd3b63,_0x12c616[_0xc6e6('0x42')]);var _0x50c96d={'where':_0xd3b63[_0xc6e6('0x3d')]};return db['JscriptyProject'][_0xc6e6('0x1d')](_0x50c96d)[_0xc6e6('0x24')](function(_0x247076){_0x43ff9c[_0xc6e6('0x1d')]=_0x247076;if(_0x12c616[_0xc6e6('0x35')][_0xc6e6('0x43')]){_0xd3b63[_0xc6e6('0x44')]=[{'all':!![]}];}return db[_0xc6e6('0x2f')][_0xc6e6('0x45')](_0xd3b63);})['then'](function(_0x3e3da6){_0x43ff9c[_0xc6e6('0x46')]=_0x3e3da6;return _0x43ff9c;})[_0xc6e6('0x24')](respondWithFilteredResult(_0xc578b3,_0xd3b63))[_0xc6e6('0x47')](handleError(_0xc578b3,null));};exports['show']=function(_0xc5f4fb,_0x825640){var _0x3a46ee={'raw':![],'where':{'id':_0xc5f4fb['params']['id']}},_0x2fa3c5={};_0x2fa3c5[_0xc6e6('0x34')]=_[_0xc6e6('0x36')](db[_0xc6e6('0x2f')][_0xc6e6('0x30')]);_0x2fa3c5[_0xc6e6('0x35')]=_['keys'](_0xc5f4fb[_0xc6e6('0x35')]);_0x2fa3c5['filters']=_[_0xc6e6('0x37')](_0x2fa3c5['model'],_0x2fa3c5[_0xc6e6('0x35')]);_0x3a46ee[_0xc6e6('0x38')]=_[_0xc6e6('0x37')](_0x2fa3c5[_0xc6e6('0x34')],qs[_0xc6e6('0x39')](_0xc5f4fb[_0xc6e6('0x35')][_0xc6e6('0x39')]));_0x3a46ee[_0xc6e6('0x38')]=_0x3a46ee['attributes'][_0xc6e6('0x48')]?_0x3a46ee[_0xc6e6('0x38')]:_0x2fa3c5[_0xc6e6('0x34')];if(_0xc5f4fb['query'][_0xc6e6('0x43')]){_0x3a46ee[_0xc6e6('0x44')]=[{'all':!![]}];}_0x3a46ee=_[_0xc6e6('0x41')]({},_0x3a46ee,_0xc5f4fb[_0xc6e6('0x42')]);return db[_0xc6e6('0x2f')][_0xc6e6('0x49')](_0x3a46ee)[_0xc6e6('0x24')](handleEntityNotFound(_0x825640,null))[_0xc6e6('0x24')](respondWithResult(_0x825640,null))[_0xc6e6('0x47')](handleError(_0x825640,null));};exports[_0xc6e6('0x4a')]=function(_0x3bfe85,_0x470167){return db[_0xc6e6('0x2f')][_0xc6e6('0x4a')](_0x3bfe85['body'],{})[_0xc6e6('0x24')](function(_0x5566df){var _0x2c48e7=_0x3bfe85[_0xc6e6('0x4b')]['get']({'plain':!![]});if(!_0x2c48e7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c48e7['role']==='user'){var _0x531dca=_0x5566df[_0xc6e6('0x26')]({'plain':!![]});var _0x40bbe9=_0xc6e6('0x27');return db[_0xc6e6('0x4c')][_0xc6e6('0x49')]({'where':{'name':_0x40bbe9,'userProfileId':_0x2c48e7['userProfileId']},'raw':!![]})['then'](function(_0x335229){if(_0x335229&&_0x335229[_0xc6e6('0x4d')]===0x0){return db[_0xc6e6('0x4e')][_0xc6e6('0x4a')]({'name':_0x531dca['name'],'resourceId':_0x531dca['id'],'type':_0x335229[_0xc6e6('0x2b')],'sectionId':_0x335229['id']},{})[_0xc6e6('0x24')](function(){return _0x5566df;});}else{return _0x5566df;}})[_0xc6e6('0x47')](function(_0x286dcf){logger[_0xc6e6('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x286dcf);throw _0x286dcf;});}return _0x5566df;})[_0xc6e6('0x24')](respondWithResult(_0x470167,0xc9))[_0xc6e6('0x47')](handleError(_0x470167,null));};exports[_0xc6e6('0x4f')]=function(_0x5113e3,_0x3df0db){var _0x2c2ece={'where':{'id':_0x5113e3[_0xc6e6('0x50')]['id']}},_0xa0032b={};_0xa0032b[_0xc6e6('0x34')]=_['keys'](db[_0xc6e6('0x2f')][_0xc6e6('0x30')]);_0x2c2ece[_0xc6e6('0x38')]=_[_0xc6e6('0x37')](_0xa0032b[_0xc6e6('0x34')],qs['fields'](_0x5113e3['query']['fields']));_0x2c2ece[_0xc6e6('0x38')]=_0x2c2ece[_0xc6e6('0x38')][_0xc6e6('0x48')]?_0x2c2ece[_0xc6e6('0x38')]:_0xa0032b[_0xc6e6('0x34')];if(_0x5113e3[_0xc6e6('0x35')]['includeAll']){_0x2c2ece[_0xc6e6('0x44')]=[{'all':!![]}];}_0x2c2ece=_['merge']({},_0x2c2ece,_0x5113e3[_0xc6e6('0x42')]);return db[_0xc6e6('0x2f')][_0xc6e6('0x49')](_0x2c2ece)['then'](handleEntityNotFound(_0x3df0db,null))[_0xc6e6('0x24')](function(_0x5c89ed){if(_0x5c89ed){var _0x3b6822=_0x5c89ed['get']({'plain':!![]});_0x3b6822=qs['omit'](_0x3b6822,['id',_0xc6e6('0x51'),'updatedAt']);_0x5113e3['body']=_[_0xc6e6('0x52')](_0x5113e3[_0xc6e6('0x53')],['id',_0xc6e6('0x51'),_0xc6e6('0x54')]);return db[_0xc6e6('0x2f')][_0xc6e6('0x4a')](_[_0xc6e6('0x41')](_0x3b6822,_0x5113e3[_0xc6e6('0x53')]),{'include':_0x5113e3['query'][_0xc6e6('0x43')]?[{'all':!![]}]:undefined})[_0xc6e6('0x24')](function(_0x35b43f){var _0x345bc3=_0x5113e3['user'][_0xc6e6('0x26')]({'plain':!![]});if(!_0x345bc3)throw new Error(_0xc6e6('0x55'));if(_0x345bc3[_0xc6e6('0x56')]==='user'){var _0x5c007d=_0x35b43f[_0xc6e6('0x26')]({'plain':!![]});var _0x5ddc81='Projects';return db[_0xc6e6('0x4c')][_0xc6e6('0x49')]({'where':{'name':_0x5ddc81,'userProfileId':_0x345bc3[_0xc6e6('0x57')]},'raw':!![]})[_0xc6e6('0x24')](function(_0x269f63){if(_0x269f63&&_0x269f63[_0xc6e6('0x4d')]===0x0){return db[_0xc6e6('0x4e')][_0xc6e6('0x4a')]({'name':_0x5c007d[_0xc6e6('0x2b')],'resourceId':_0x5c007d['id'],'type':_0x269f63[_0xc6e6('0x2b')],'sectionId':_0x269f63['id']},{})[_0xc6e6('0x24')](function(){return _0x35b43f;});}else{return _0x35b43f;}})['catch'](function(_0x552b4f){logger[_0xc6e6('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x552b4f);throw _0x552b4f;});}return _0x35b43f;});}})['then'](respondWithResult(_0x3df0db,0xc9))[_0xc6e6('0x47')](handleError(_0x3df0db,null));};exports[_0xc6e6('0x23')]=function(_0x27c5f0,_0x4f0543){if(_0x27c5f0[_0xc6e6('0x53')]['id']){delete _0x27c5f0[_0xc6e6('0x53')]['id'];}return db['JscriptyProject']['find']({'where':{'id':_0x27c5f0[_0xc6e6('0x50')]['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x4f0543,null))[_0xc6e6('0x24')](saveUpdates(_0x27c5f0[_0xc6e6('0x53')],null))[_0xc6e6('0x24')](respondWithResult(_0x4f0543,null))[_0xc6e6('0x47')](handleError(_0x4f0543,null));};exports['destroy']=function(_0x21f52a,_0x12d300){return db[_0xc6e6('0x2f')][_0xc6e6('0x49')]({'where':{'id':_0x21f52a[_0xc6e6('0x50')]['id']}})['then'](handleEntityNotFound(_0x12d300,null))[_0xc6e6('0x24')](removeEntity(_0x12d300,null))[_0xc6e6('0x47')](handleError(_0x12d300,null));};exports[_0xc6e6('0x58')]=function(_0x36abee,_0x1f3e86,_0x26dac8){var _0x540b22={'raw':!![],'where':{}};var _0x27e74b={};var _0x4c4985={'count':0x0,'rows':[]};return db[_0xc6e6('0x2f')]['findOne']({'where':{'id':_0x36abee['params']['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x1f3e86,null))['then'](function(_0x31cca2){if(_0x31cca2){_0x27e74b[_0xc6e6('0x34')]=_[_0xc6e6('0x36')](db[_0xc6e6('0x59')][_0xc6e6('0x30')]);_0x27e74b['query']=_[_0xc6e6('0x36')](_0x36abee['query']);_0x27e74b['filters']=_[_0xc6e6('0x37')](_0x27e74b[_0xc6e6('0x34')],_0x27e74b[_0xc6e6('0x35')]);_0x540b22['attributes']=_[_0xc6e6('0x37')](_0x27e74b['model'],qs['fields'](_0x36abee[_0xc6e6('0x35')]['fields']));_0x540b22[_0xc6e6('0x38')]=_0x540b22[_0xc6e6('0x38')][_0xc6e6('0x48')]?_0x540b22[_0xc6e6('0x38')]:_0x27e74b['model'];if(!_0x36abee[_0xc6e6('0x35')][_0xc6e6('0x3a')](_0xc6e6('0x5a'))){_0x540b22[_0xc6e6('0x1c')]=qs[_0xc6e6('0x1c')](_0x36abee['query'][_0xc6e6('0x1c')]);_0x540b22[_0xc6e6('0x1a')]=qs[_0xc6e6('0x1a')](_0x36abee[_0xc6e6('0x35')]['offset']);}_0x540b22['order']=qs[_0xc6e6('0x3c')](_0x36abee[_0xc6e6('0x35')][_0xc6e6('0x3c')]);_0x540b22[_0xc6e6('0x3d')]=qs[_0xc6e6('0x3e')](_[_0xc6e6('0x3f')](_0x36abee[_0xc6e6('0x35')],_0x27e74b[_0xc6e6('0x3e')]));_0x540b22[_0xc6e6('0x3d')]['ProjectId']=_0x31cca2['id'];if(_0x36abee['query'][_0xc6e6('0x40')]){_0x540b22['where']=_[_0xc6e6('0x41')](_0x540b22[_0xc6e6('0x3d')],{'$or':_[_0xc6e6('0x2e')](_0x540b22['attributes'],function(_0x5b0c3b){var _0x38b1ed={};_0x38b1ed[_0x5b0c3b]={'$like':'%'+_0x36abee['query'][_0xc6e6('0x40')]+'%'};return _0x38b1ed;})});}_0x540b22=_['merge']({},_0x540b22,_0x36abee[_0xc6e6('0x42')]);return db[_0xc6e6('0x59')]['count']({'where':_0x540b22[_0xc6e6('0x3d')]})[_0xc6e6('0x24')](function(_0x5a1997){_0x4c4985['count']=_0x5a1997;if(_0x36abee[_0xc6e6('0x35')][_0xc6e6('0x43')]){_0x540b22[_0xc6e6('0x44')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xc6e6('0x45')](_0x540b22);})[_0xc6e6('0x24')](function(_0x4e7b05){_0x4c4985['rows']=_0x4e7b05;return _0x4c4985;});}})['then'](respondWithFilteredResult(_0x1f3e86,_0x540b22))[_0xc6e6('0x47')](handleError(_0x1f3e86,null));};exports[_0xc6e6('0x5b')]=function(_0xfcefd8,_0x202331,_0x30ab02){var _0xcde47f={'raw':!![],'where':{}};var _0x58aef4={};var _0x21b965={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xc6e6('0x5c')]({'where':{'id':_0xfcefd8[_0xc6e6('0x50')]['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x202331,null))['then'](function(_0x503cdb){if(_0x503cdb){_0x58aef4[_0xc6e6('0x34')]=_[_0xc6e6('0x36')](db[_0xc6e6('0x5d')][_0xc6e6('0x30')]);_0x58aef4[_0xc6e6('0x35')]=_[_0xc6e6('0x36')](_0xfcefd8[_0xc6e6('0x35')]);_0x58aef4[_0xc6e6('0x3e')]=_['intersection'](_0x58aef4['model'],_0x58aef4[_0xc6e6('0x35')]);_0xcde47f[_0xc6e6('0x38')]=_[_0xc6e6('0x37')](_0x58aef4[_0xc6e6('0x34')],qs[_0xc6e6('0x39')](_0xfcefd8['query']['fields']));_0xcde47f[_0xc6e6('0x38')]=_0xcde47f[_0xc6e6('0x38')]['length']?_0xcde47f['attributes']:_0x58aef4[_0xc6e6('0x34')];if(!_0xfcefd8[_0xc6e6('0x35')][_0xc6e6('0x3a')](_0xc6e6('0x5a'))){_0xcde47f['limit']=qs[_0xc6e6('0x1c')](_0xfcefd8[_0xc6e6('0x35')][_0xc6e6('0x1c')]);_0xcde47f['offset']=qs['offset'](_0xfcefd8[_0xc6e6('0x35')][_0xc6e6('0x1a')]);}_0xcde47f['order']=qs['sort'](_0xfcefd8[_0xc6e6('0x35')][_0xc6e6('0x3c')]);_0xcde47f[_0xc6e6('0x3d')]=qs['filters'](_[_0xc6e6('0x3f')](_0xfcefd8[_0xc6e6('0x35')],_0x58aef4[_0xc6e6('0x3e')]));_0xcde47f[_0xc6e6('0x3d')][_0xc6e6('0x5e')]=_0x503cdb['id'];if(_0xfcefd8[_0xc6e6('0x35')]['filter']){_0xcde47f[_0xc6e6('0x3d')]=_[_0xc6e6('0x41')](_0xcde47f[_0xc6e6('0x3d')],{'$or':_[_0xc6e6('0x2e')](_0xcde47f['attributes'],function(_0x1742bd){var _0x408b41={};_0x408b41[_0x1742bd]={'$like':'%'+_0xfcefd8[_0xc6e6('0x35')]['filter']+'%'};return _0x408b41;})});}_0xcde47f=_[_0xc6e6('0x41')]({},_0xcde47f,_0xfcefd8[_0xc6e6('0x42')]);return db[_0xc6e6('0x5d')][_0xc6e6('0x1d')]({'where':_0xcde47f[_0xc6e6('0x3d')]})['then'](function(_0x3f5d70){_0x21b965[_0xc6e6('0x1d')]=_0x3f5d70;if(_0xfcefd8[_0xc6e6('0x35')][_0xc6e6('0x43')]){_0xcde47f[_0xc6e6('0x44')]=[{'all':!![]}];}return db[_0xc6e6('0x5d')]['findAll'](_0xcde47f);})[_0xc6e6('0x24')](function(_0x4cd2af){_0x21b965[_0xc6e6('0x46')]=_0x4cd2af;return _0x21b965;});}})[_0xc6e6('0x24')](respondWithFilteredResult(_0x202331,_0xcde47f))[_0xc6e6('0x47')](handleError(_0x202331,null));};function char(_0x410cfd){return _0xc6e6('0x5f')===typeof _0x410cfd?String[_0xc6e6('0x60')][_0xc6e6('0x20')](null,arguments):_0x410cfd;}function needsEncapsulation(_0x3df453){return!!_0x3df453&&(_0x3df453['toString']()[_0xc6e6('0x61')](char(0xd))>=0x0||_0x3df453[_0xc6e6('0x62')]()[_0xc6e6('0x61')](char(0xa))>=0x0||_0x3df453[_0xc6e6('0x62')]()[_0xc6e6('0x61')](char(0x2c))>=0x0||_0x3df453[_0xc6e6('0x62')]()[_0xc6e6('0x61')](char(0x22))>=0x0);}function encapsulate(_0x5091c2){var _0x4b97ac=char(0x22),_0x2df111='\x5c'+char(0x22),_0x19bb49=_0x5091c2['toString']()[_0xc6e6('0x63')](new RegExp(_0x4b97ac,'g'),_0x2df111);return _0x4b97ac+_0x19bb49+_0x4b97ac;}exports[_0xc6e6('0x64')]=function(_0x50af47,_0x48a326,_0xe15a78){var _0x79d341,_0x55cfce;var _0x4db332={'where':{'ProjectId':_0x50af47[_0xc6e6('0x50')]['id']}};if(_0x50af47[_0xc6e6('0x35')][_0xc6e6('0x65')]){_0x4db332['where'][_0xc6e6('0x66')]=JSON[_0xc6e6('0x67')](_0x50af47[_0xc6e6('0x35')][_0xc6e6('0x65')]);}return db[_0xc6e6('0x59')][_0xc6e6('0x45')](_0x4db332)['then'](handleEntityNotFound(_0x48a326,null))['then'](function(_0x2eb18c){if(_0x2eb18c){_0x79d341=_0x2eb18c;return db[_0xc6e6('0x68')][_0xc6e6('0x45')]({'where':{'SessionId':{'$in':_['map'](_0x79d341,'id')},'ProjectId':_0x50af47['params']['id']},'order':_0xc6e6('0x69')});}})[_0xc6e6('0x24')](handleEntityNotFound(_0x48a326,null))[_0xc6e6('0x24')](function(_0x2d9ae3){if(_0x2d9ae3){_0x55cfce=_0x2d9ae3;var _0x178d20={};for(var _0x353615=0x0,_0x24af66=_0x55cfce[_0xc6e6('0x48')];_0x353615<_0x24af66;_0x353615++){if(!_0x178d20[_0xc6e6('0x3a')](_0x55cfce[_0x353615][_0xc6e6('0x6a')])){_0x178d20[_0x55cfce[_0x353615][_0xc6e6('0x6a')]]=needsEncapsulation(_0x55cfce[_0x353615]['question'])?encapsulate(_0x55cfce[_0x353615]['question']):_0x55cfce[_0x353615]['question'];}}var _0x2dfaa8=[],_0x55a993={};for(var _0x49b030=0x0,_0x12c95c=_0x79d341[_0xc6e6('0x48')];_0x49b030<_0x12c95c;_0x49b030++){_0x55a993={'ProjectId':_0x50af47['params']['id'],'SessionId':_0x79d341[_0x49b030]['id'],'StartTime':moment(_0x79d341[_0x49b030]['starttime'])[_0xc6e6('0x6b')](_0xc6e6('0x6c'))};for(var _0x1d32b4=0x0,_0x5f1f6f=_0x55cfce[_0xc6e6('0x48')];_0x1d32b4<_0x5f1f6f;_0x1d32b4++){if(_0x55cfce[_0x1d32b4][_0xc6e6('0x6d')]==_0x79d341[_0x49b030]['id']&&_0x178d20['hasOwnProperty'](_0x55cfce[_0x1d32b4]['questionId'])){_0x55a993[_0x178d20[_0x55cfce[_0x1d32b4][_0xc6e6('0x6a')]]]=_0x55cfce[_0x1d32b4][_0xc6e6('0x6e')];}}for(var _0x2a1266 in _0x178d20){if(!_0x55a993[_0xc6e6('0x3a')](_0x178d20[_0x2a1266])){_0x55a993[_0x178d20[_0x2a1266]]=null;}}_0x2dfaa8[_0xc6e6('0x6f')](_0x55a993);}return _0x2dfaa8;}})['then'](function(_0x4c8ec3){if(!_[_0xc6e6('0x70')](_0x4c8ec3)){var _0x162b33=toCsv(_0x4c8ec3);var _0x5c82da=Date['now']();fs[_0xc6e6('0x71')](util['format'](_0xc6e6('0x72'),_0x50af47[_0xc6e6('0x50')]['id'],_0x5c82da),_0x162b33);_0x48a326[_0xc6e6('0x73')](_0xc6e6('0x74'),_0xc6e6('0x75')+util['format'](_0xc6e6('0x76'),_0x50af47['params']['id'],_0x5c82da));_0x48a326[_0xc6e6('0x73')](_0xc6e6('0x77'),_0xc6e6('0x78'));return _0x48a326[_0xc6e6('0x79')](util[_0xc6e6('0x6b')](_0xc6e6('0x72'),_0x50af47[_0xc6e6('0x50')]['id'],_0x5c82da));}else{return _0x48a326[_0xc6e6('0x17')](0xcc);}})[_0xc6e6('0x47')](handleError(_0x48a326,null));}; \ No newline at end of file +var _0x7dab=['squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','end','stack','name','map','JscriptyProject','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','model','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','UserProfileSection','userProfileId','error','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','hasOwnProperty','pick','ProjectId','getAnswers','JscriptyAnswerReport','fromCharCode','toString','indexOf','replace','getSummary','startTime','parse','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x3a6b64,_0x230b66){var _0x236354=function(_0x5492d4){while(--_0x5492d4){_0x3a6b64['push'](_0x3a6b64['shift']());}};_0x236354(++_0x230b66);}(_0x7dab,0xe5));var _0xb7da=function(_0x2088cd,_0x1d0d7c){_0x2088cd=_0x2088cd-0x0;var _0x3af5ad=_0x7dab[_0x2088cd];return _0x3af5ad;};'use strict';var emlformat=require(_0xb7da('0x0'));var rimraf=require(_0xb7da('0x1'));var zipdir=require(_0xb7da('0x2'));var jsonpatch=require(_0xb7da('0x3'));var rp=require(_0xb7da('0x4'));var moment=require('moment');var BPromise=require(_0xb7da('0x5'));var Mustache=require(_0xb7da('0x6'));var util=require(_0xb7da('0x7'));var path=require(_0xb7da('0x8'));var sox=require(_0xb7da('0x9'));var csv=require(_0xb7da('0xa'));var ejs=require(_0xb7da('0xb'));var fs=require('fs');var fs_extra=require(_0xb7da('0xc'));var _=require('lodash');var squel=require(_0xb7da('0xd'));var crypto=require(_0xb7da('0xe'));var jsforce=require(_0xb7da('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb7da('0x10'));var Papa=require(_0xb7da('0x11'));var Redis=require(_0xb7da('0x12'));var authService=require(_0xb7da('0x13'));var qs=require(_0xb7da('0x14'));var as=require(_0xb7da('0x15'));var hardwareService=require(_0xb7da('0x16'));var logger=require(_0xb7da('0x17'))('api');var utils=require(_0xb7da('0x18'));var config=require(_0xb7da('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xb7da('0x1a'))['db'];function respondWithStatusCode(_0x5c76bb,_0x97f4d8){_0x97f4d8=_0x97f4d8||0xcc;return function(_0x3a1df3){if(_0x3a1df3){return _0x5c76bb[_0xb7da('0x1b')](_0x97f4d8);}return _0x5c76bb[_0xb7da('0x1c')](_0x97f4d8)['end']();};}function respondWithResult(_0x5ae9bb,_0xe4cb50){_0xe4cb50=_0xe4cb50||0xc8;return function(_0x3b6f32){if(_0x3b6f32){return _0x5ae9bb[_0xb7da('0x1c')](_0xe4cb50)['json'](_0x3b6f32);}};}function respondWithFilteredResult(_0x3ac23e,_0x1b2682){return function(_0x2b2bf7){if(_0x2b2bf7){var _0xab868c=typeof _0x1b2682['offset']===_0xb7da('0x1d')&&typeof _0x1b2682[_0xb7da('0x1e')]===_0xb7da('0x1d');var _0x4c5bd9=_0x2b2bf7[_0xb7da('0x1f')];var _0x3128b2=_0xab868c?0x0:_0x1b2682[_0xb7da('0x20')];var _0x55ffe4=_0xab868c?_0x2b2bf7[_0xb7da('0x1f')]:_0x1b2682['offset']+_0x1b2682[_0xb7da('0x1e')];var _0xac04f6;if(_0x55ffe4>=_0x4c5bd9){_0x55ffe4=_0x4c5bd9;_0xac04f6=0xc8;}else{_0xac04f6=0xce;}_0x3ac23e[_0xb7da('0x1c')](_0xac04f6);return _0x3ac23e[_0xb7da('0x21')](_0xb7da('0x22'),_0x3128b2+'-'+_0x55ffe4+'/'+_0x4c5bd9)[_0xb7da('0x23')](_0x2b2bf7);}return null;};}function patchUpdates(_0x292923){return function(_0x20b250){try{jsonpatch[_0xb7da('0x24')](_0x20b250,_0x292923,!![]);}catch(_0x805e91){return BPromise[_0xb7da('0x25')](_0x805e91);}return _0x20b250[_0xb7da('0x26')]();};}function saveUpdates(_0x9c5040,_0xbe21ed){return function(_0x20750c){if(_0x20750c){return _0x20750c[_0xb7da('0x27')](_0x9c5040)[_0xb7da('0x28')](function(_0x44eb3a){return _0x44eb3a;});}return null;};}function removeEntity(_0x2d6a9e,_0x5d0fe8){return function(_0x5a6472){if(_0x5a6472){return _0x5a6472[_0xb7da('0x29')]()[_0xb7da('0x28')](function(){var _0x50e668=_0x5a6472[_0xb7da('0x2a')]({'plain':!![]});var _0x5839d4=_0xb7da('0x2b');return db[_0xb7da('0x2c')][_0xb7da('0x29')]({'where':{'type':_0x5839d4,'resourceId':_0x50e668['id']}})[_0xb7da('0x28')](function(){return _0x5a6472;});})[_0xb7da('0x28')](function(){_0x2d6a9e['status'](0xcc)[_0xb7da('0x2d')]();});}};}function handleEntityNotFound(_0x1e564d,_0x412e08){return function(_0x1726f4){if(!_0x1726f4){_0x1e564d['sendStatus'](0x194);}return _0x1726f4;};}function handleError(_0xfb9c2b,_0xbcab52){_0xbcab52=_0xbcab52||0x1f4;return function(_0x1829dc){logger['error'](_0x1829dc[_0xb7da('0x2e')]);if(_0x1829dc['name']){delete _0x1829dc[_0xb7da('0x2f')];}_0xfb9c2b[_0xb7da('0x1c')](_0xbcab52)['send'](_0x1829dc);};}exports['index']=function(_0x2fe29a,_0x2cef86){var _0x3e8ba6={},_0x37634f={},_0x21b7f1={'count':0x0,'rows':[]};var _0x1a394b=_[_0xb7da('0x30')](db[_0xb7da('0x31')][_0xb7da('0x32')],function(_0x45e250){return{'name':_0x45e250[_0xb7da('0x33')],'type':_0x45e250[_0xb7da('0x34')][_0xb7da('0x35')]};});_0x37634f['model']=_[_0xb7da('0x30')](_0x1a394b,_0xb7da('0x2f'));_0x37634f[_0xb7da('0x36')]=_[_0xb7da('0x37')](_0x2fe29a[_0xb7da('0x36')]);_0x37634f[_0xb7da('0x38')]=_[_0xb7da('0x39')](_0x37634f['model'],_0x37634f['query']);_0x3e8ba6[_0xb7da('0x3a')]=_[_0xb7da('0x39')](_0x37634f['model'],qs[_0xb7da('0x3b')](_0x2fe29a[_0xb7da('0x36')][_0xb7da('0x3b')]));_0x3e8ba6['attributes']=_0x3e8ba6[_0xb7da('0x3a')][_0xb7da('0x3c')]?_0x3e8ba6[_0xb7da('0x3a')]:_0x37634f[_0xb7da('0x3d')];if(!_0x2fe29a[_0xb7da('0x36')]['hasOwnProperty'](_0xb7da('0x3e'))){_0x3e8ba6[_0xb7da('0x1e')]=qs['limit'](_0x2fe29a[_0xb7da('0x36')][_0xb7da('0x1e')]);_0x3e8ba6['offset']=qs['offset'](_0x2fe29a['query'][_0xb7da('0x20')]);}_0x3e8ba6[_0xb7da('0x3f')]=qs[_0xb7da('0x40')](_0x2fe29a[_0xb7da('0x36')][_0xb7da('0x40')]);_0x3e8ba6[_0xb7da('0x41')]=qs[_0xb7da('0x38')](_['pick'](_0x2fe29a['query'],_0x37634f[_0xb7da('0x38')]),_0x1a394b);if(_0x2fe29a['query'][_0xb7da('0x42')]){_0x3e8ba6['where']=_[_0xb7da('0x43')](_0x3e8ba6[_0xb7da('0x41')],{'$or':_[_0xb7da('0x30')](_0x1a394b,function(_0x13a1d9){if(_0x13a1d9[_0xb7da('0x34')]!=='VIRTUAL'){var _0x9a3ee2={};_0x9a3ee2[_0x13a1d9[_0xb7da('0x2f')]]={'$like':'%'+_0x2fe29a[_0xb7da('0x36')]['filter']+'%'};return _0x9a3ee2;}})});}_0x3e8ba6=_['merge']({},_0x3e8ba6,_0x2fe29a[_0xb7da('0x44')]);var _0x235fe7={'where':_0x3e8ba6[_0xb7da('0x41')]};return db[_0xb7da('0x31')]['count'](_0x235fe7)[_0xb7da('0x28')](function(_0x422cc2){_0x21b7f1[_0xb7da('0x1f')]=_0x422cc2;if(_0x2fe29a['query']['includeAll']){_0x3e8ba6[_0xb7da('0x45')]=[{'all':!![]}];}return db[_0xb7da('0x31')][_0xb7da('0x46')](_0x3e8ba6);})[_0xb7da('0x28')](function(_0x2b683c){_0x21b7f1[_0xb7da('0x47')]=_0x2b683c;return _0x21b7f1;})[_0xb7da('0x28')](respondWithFilteredResult(_0x2cef86,_0x3e8ba6))[_0xb7da('0x48')](handleError(_0x2cef86,null));};exports[_0xb7da('0x49')]=function(_0x5364b3,_0x49d06f){var _0x50eb7c={'raw':![],'where':{'id':_0x5364b3[_0xb7da('0x4a')]['id']}},_0x249d7c={};_0x249d7c[_0xb7da('0x3d')]=_[_0xb7da('0x37')](db[_0xb7da('0x31')][_0xb7da('0x32')]);_0x249d7c[_0xb7da('0x36')]=_[_0xb7da('0x37')](_0x5364b3['query']);_0x249d7c[_0xb7da('0x38')]=_[_0xb7da('0x39')](_0x249d7c['model'],_0x249d7c['query']);_0x50eb7c[_0xb7da('0x3a')]=_[_0xb7da('0x39')](_0x249d7c[_0xb7da('0x3d')],qs[_0xb7da('0x3b')](_0x5364b3[_0xb7da('0x36')][_0xb7da('0x3b')]));_0x50eb7c[_0xb7da('0x3a')]=_0x50eb7c['attributes']['length']?_0x50eb7c[_0xb7da('0x3a')]:_0x249d7c[_0xb7da('0x3d')];if(_0x5364b3[_0xb7da('0x36')][_0xb7da('0x4b')]){_0x50eb7c[_0xb7da('0x45')]=[{'all':!![]}];}_0x50eb7c=_['merge']({},_0x50eb7c,_0x5364b3[_0xb7da('0x44')]);return db['JscriptyProject'][_0xb7da('0x4c')](_0x50eb7c)[_0xb7da('0x28')](handleEntityNotFound(_0x49d06f,null))[_0xb7da('0x28')](respondWithResult(_0x49d06f,null))[_0xb7da('0x48')](handleError(_0x49d06f,null));};exports[_0xb7da('0x4d')]=function(_0xfc10cc,_0x5f30c2){return db['JscriptyProject'][_0xb7da('0x4d')](_0xfc10cc[_0xb7da('0x4e')],{})[_0xb7da('0x28')](function(_0x1a587){var _0xbbd0fd=_0xfc10cc['user']['get']({'plain':!![]});if(!_0xbbd0fd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xbbd0fd['role']===_0xb7da('0x4f')){var _0x58bcd2=_0x1a587[_0xb7da('0x2a')]({'plain':!![]});var _0x53ff78=_0xb7da('0x2b');return db[_0xb7da('0x50')]['find']({'where':{'name':_0x53ff78,'userProfileId':_0xbbd0fd[_0xb7da('0x51')]},'raw':!![]})[_0xb7da('0x28')](function(_0x2ba8da){if(_0x2ba8da&&_0x2ba8da['autoAssociation']===0x0){return db[_0xb7da('0x2c')][_0xb7da('0x4d')]({'name':_0x58bcd2[_0xb7da('0x2f')],'resourceId':_0x58bcd2['id'],'type':_0x2ba8da[_0xb7da('0x2f')],'sectionId':_0x2ba8da['id']},{})[_0xb7da('0x28')](function(){return _0x1a587;});}else{return _0x1a587;}})[_0xb7da('0x48')](function(_0x1330e5){logger[_0xb7da('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1330e5);throw _0x1330e5;});}return _0x1a587;})[_0xb7da('0x28')](respondWithResult(_0x5f30c2,0xc9))['catch'](handleError(_0x5f30c2,null));};exports[_0xb7da('0x53')]=function(_0x382d19,_0x2fac0e){var _0x5f78a2={'where':{'id':_0x382d19[_0xb7da('0x4a')]['id']}},_0x4d3e42={};_0x4d3e42[_0xb7da('0x3d')]=_[_0xb7da('0x37')](db['JscriptyProject'][_0xb7da('0x32')]);_0x5f78a2[_0xb7da('0x3a')]=_['intersection'](_0x4d3e42[_0xb7da('0x3d')],qs['fields'](_0x382d19[_0xb7da('0x36')][_0xb7da('0x3b')]));_0x5f78a2['attributes']=_0x5f78a2['attributes'][_0xb7da('0x3c')]?_0x5f78a2[_0xb7da('0x3a')]:_0x4d3e42[_0xb7da('0x3d')];if(_0x382d19[_0xb7da('0x36')]['includeAll']){_0x5f78a2[_0xb7da('0x45')]=[{'all':!![]}];}_0x5f78a2=_[_0xb7da('0x43')]({},_0x5f78a2,_0x382d19['options']);return db[_0xb7da('0x31')]['find'](_0x5f78a2)[_0xb7da('0x28')](handleEntityNotFound(_0x2fac0e,null))[_0xb7da('0x28')](function(_0x2976af){if(_0x2976af){var _0x1f1951=_0x2976af['get']({'plain':!![]});_0x1f1951=qs[_0xb7da('0x54')](_0x1f1951,['id',_0xb7da('0x55'),_0xb7da('0x56')]);_0x382d19[_0xb7da('0x4e')]=_[_0xb7da('0x54')](_0x382d19[_0xb7da('0x4e')],['id',_0xb7da('0x55'),_0xb7da('0x56')]);return db[_0xb7da('0x31')][_0xb7da('0x4d')](_[_0xb7da('0x43')](_0x1f1951,_0x382d19[_0xb7da('0x4e')]),{'include':_0x382d19[_0xb7da('0x36')][_0xb7da('0x4b')]?[{'all':!![]}]:undefined})[_0xb7da('0x28')](function(_0x135ac1){var _0x4bc847=_0x382d19['user'][_0xb7da('0x2a')]({'plain':!![]});if(!_0x4bc847)throw new Error(_0xb7da('0x57'));if(_0x4bc847['role']===_0xb7da('0x4f')){var _0x472069=_0x135ac1[_0xb7da('0x2a')]({'plain':!![]});var _0x1489e8=_0xb7da('0x2b');return db[_0xb7da('0x50')]['find']({'where':{'name':_0x1489e8,'userProfileId':_0x4bc847[_0xb7da('0x51')]},'raw':!![]})[_0xb7da('0x28')](function(_0x52132d){if(_0x52132d&&_0x52132d[_0xb7da('0x58')]===0x0){return db[_0xb7da('0x2c')][_0xb7da('0x4d')]({'name':_0x472069[_0xb7da('0x2f')],'resourceId':_0x472069['id'],'type':_0x52132d[_0xb7da('0x2f')],'sectionId':_0x52132d['id']},{})[_0xb7da('0x28')](function(){return _0x135ac1;});}else{return _0x135ac1;}})[_0xb7da('0x48')](function(_0x357691){logger[_0xb7da('0x52')](_0xb7da('0x59'),_0x357691);throw _0x357691;});}return _0x135ac1;});}})[_0xb7da('0x28')](respondWithResult(_0x2fac0e,0xc9))['catch'](handleError(_0x2fac0e,null));};exports[_0xb7da('0x27')]=function(_0xe4edc,_0x4b7ddd){if(_0xe4edc[_0xb7da('0x4e')]['id']){delete _0xe4edc['body']['id'];}return db[_0xb7da('0x31')][_0xb7da('0x4c')]({'where':{'id':_0xe4edc['params']['id']}})[_0xb7da('0x28')](handleEntityNotFound(_0x4b7ddd,null))[_0xb7da('0x28')](saveUpdates(_0xe4edc[_0xb7da('0x4e')],null))['then'](respondWithResult(_0x4b7ddd,null))[_0xb7da('0x48')](handleError(_0x4b7ddd,null));};exports['destroy']=function(_0x4fc7c9,_0x510294){return db[_0xb7da('0x31')][_0xb7da('0x4c')]({'where':{'id':_0x4fc7c9[_0xb7da('0x4a')]['id']}})[_0xb7da('0x28')](handleEntityNotFound(_0x510294,null))[_0xb7da('0x28')](removeEntity(_0x510294,null))[_0xb7da('0x48')](handleError(_0x510294,null));};exports[_0xb7da('0x5a')]=function(_0x53c5a2,_0x1a2bad,_0x554a57){var _0x56b1f6={'raw':!![],'where':{}};var _0x314de9={};var _0x489284={'count':0x0,'rows':[]};return db[_0xb7da('0x31')][_0xb7da('0x5b')]({'where':{'id':_0x53c5a2[_0xb7da('0x4a')]['id']}})[_0xb7da('0x28')](handleEntityNotFound(_0x1a2bad,null))[_0xb7da('0x28')](function(_0x19e488){if(_0x19e488){_0x314de9[_0xb7da('0x3d')]=_[_0xb7da('0x37')](db[_0xb7da('0x5c')][_0xb7da('0x32')]);_0x314de9[_0xb7da('0x36')]=_['keys'](_0x53c5a2['query']);_0x314de9['filters']=_['intersection'](_0x314de9['model'],_0x314de9['query']);_0x56b1f6[_0xb7da('0x3a')]=_[_0xb7da('0x39')](_0x314de9[_0xb7da('0x3d')],qs[_0xb7da('0x3b')](_0x53c5a2[_0xb7da('0x36')][_0xb7da('0x3b')]));_0x56b1f6[_0xb7da('0x3a')]=_0x56b1f6[_0xb7da('0x3a')][_0xb7da('0x3c')]?_0x56b1f6[_0xb7da('0x3a')]:_0x314de9[_0xb7da('0x3d')];if(!_0x53c5a2[_0xb7da('0x36')][_0xb7da('0x5d')](_0xb7da('0x3e'))){_0x56b1f6['limit']=qs[_0xb7da('0x1e')](_0x53c5a2[_0xb7da('0x36')][_0xb7da('0x1e')]);_0x56b1f6[_0xb7da('0x20')]=qs[_0xb7da('0x20')](_0x53c5a2[_0xb7da('0x36')][_0xb7da('0x20')]);}_0x56b1f6[_0xb7da('0x3f')]=qs[_0xb7da('0x40')](_0x53c5a2[_0xb7da('0x36')][_0xb7da('0x40')]);_0x56b1f6[_0xb7da('0x41')]=qs[_0xb7da('0x38')](_[_0xb7da('0x5e')](_0x53c5a2['query'],_0x314de9[_0xb7da('0x38')]));_0x56b1f6['where'][_0xb7da('0x5f')]=_0x19e488['id'];if(_0x53c5a2[_0xb7da('0x36')][_0xb7da('0x42')]){_0x56b1f6[_0xb7da('0x41')]=_['merge'](_0x56b1f6[_0xb7da('0x41')],{'$or':_[_0xb7da('0x30')](_0x56b1f6['attributes'],function(_0x1d8246){var _0x34317b={};_0x34317b[_0x1d8246]={'$like':'%'+_0x53c5a2[_0xb7da('0x36')][_0xb7da('0x42')]+'%'};return _0x34317b;})});}_0x56b1f6=_[_0xb7da('0x43')]({},_0x56b1f6,_0x53c5a2['options']);return db[_0xb7da('0x5c')][_0xb7da('0x1f')]({'where':_0x56b1f6[_0xb7da('0x41')]})[_0xb7da('0x28')](function(_0x42ffa7){_0x489284['count']=_0x42ffa7;if(_0x53c5a2['query'][_0xb7da('0x4b')]){_0x56b1f6[_0xb7da('0x45')]=[{'all':!![]}];}return db[_0xb7da('0x5c')][_0xb7da('0x46')](_0x56b1f6);})['then'](function(_0x1d9f7a){_0x489284[_0xb7da('0x47')]=_0x1d9f7a;return _0x489284;});}})[_0xb7da('0x28')](respondWithFilteredResult(_0x1a2bad,_0x56b1f6))['catch'](handleError(_0x1a2bad,null));};exports[_0xb7da('0x60')]=function(_0x5db16e,_0x2fc504,_0x4e6c41){var _0x7aae7c={'raw':!![],'where':{}};var _0x4ce942={};var _0x74a1f8={'count':0x0,'rows':[]};return db[_0xb7da('0x31')][_0xb7da('0x5b')]({'where':{'id':_0x5db16e[_0xb7da('0x4a')]['id']}})[_0xb7da('0x28')](handleEntityNotFound(_0x2fc504,null))[_0xb7da('0x28')](function(_0x55f750){if(_0x55f750){_0x4ce942[_0xb7da('0x3d')]=_[_0xb7da('0x37')](db[_0xb7da('0x61')][_0xb7da('0x32')]);_0x4ce942[_0xb7da('0x36')]=_[_0xb7da('0x37')](_0x5db16e[_0xb7da('0x36')]);_0x4ce942['filters']=_[_0xb7da('0x39')](_0x4ce942[_0xb7da('0x3d')],_0x4ce942['query']);_0x7aae7c[_0xb7da('0x3a')]=_[_0xb7da('0x39')](_0x4ce942[_0xb7da('0x3d')],qs[_0xb7da('0x3b')](_0x5db16e[_0xb7da('0x36')][_0xb7da('0x3b')]));_0x7aae7c[_0xb7da('0x3a')]=_0x7aae7c[_0xb7da('0x3a')][_0xb7da('0x3c')]?_0x7aae7c['attributes']:_0x4ce942[_0xb7da('0x3d')];if(!_0x5db16e[_0xb7da('0x36')][_0xb7da('0x5d')](_0xb7da('0x3e'))){_0x7aae7c[_0xb7da('0x1e')]=qs[_0xb7da('0x1e')](_0x5db16e[_0xb7da('0x36')][_0xb7da('0x1e')]);_0x7aae7c[_0xb7da('0x20')]=qs['offset'](_0x5db16e[_0xb7da('0x36')][_0xb7da('0x20')]);}_0x7aae7c[_0xb7da('0x3f')]=qs[_0xb7da('0x40')](_0x5db16e[_0xb7da('0x36')][_0xb7da('0x40')]);_0x7aae7c[_0xb7da('0x41')]=qs[_0xb7da('0x38')](_[_0xb7da('0x5e')](_0x5db16e[_0xb7da('0x36')],_0x4ce942[_0xb7da('0x38')]));_0x7aae7c[_0xb7da('0x41')][_0xb7da('0x5f')]=_0x55f750['id'];if(_0x5db16e[_0xb7da('0x36')]['filter']){_0x7aae7c[_0xb7da('0x41')]=_[_0xb7da('0x43')](_0x7aae7c[_0xb7da('0x41')],{'$or':_[_0xb7da('0x30')](_0x7aae7c[_0xb7da('0x3a')],function(_0x1f954c){var _0x3d9998={};_0x3d9998[_0x1f954c]={'$like':'%'+_0x5db16e[_0xb7da('0x36')][_0xb7da('0x42')]+'%'};return _0x3d9998;})});}_0x7aae7c=_[_0xb7da('0x43')]({},_0x7aae7c,_0x5db16e[_0xb7da('0x44')]);return db[_0xb7da('0x61')][_0xb7da('0x1f')]({'where':_0x7aae7c['where']})[_0xb7da('0x28')](function(_0x4dbed6){_0x74a1f8[_0xb7da('0x1f')]=_0x4dbed6;if(_0x5db16e[_0xb7da('0x36')][_0xb7da('0x4b')]){_0x7aae7c[_0xb7da('0x45')]=[{'all':!![]}];}return db[_0xb7da('0x61')][_0xb7da('0x46')](_0x7aae7c);})[_0xb7da('0x28')](function(_0x16940c){_0x74a1f8[_0xb7da('0x47')]=_0x16940c;return _0x74a1f8;});}})['then'](respondWithFilteredResult(_0x2fc504,_0x7aae7c))[_0xb7da('0x48')](handleError(_0x2fc504,null));};function char(_0x3b9b9c){return'number'===typeof _0x3b9b9c?String[_0xb7da('0x62')][_0xb7da('0x24')](null,arguments):_0x3b9b9c;}function needsEncapsulation(_0x28fd61){return!!_0x28fd61&&(_0x28fd61[_0xb7da('0x63')]()[_0xb7da('0x64')](char(0xd))>=0x0||_0x28fd61['toString']()[_0xb7da('0x64')](char(0xa))>=0x0||_0x28fd61['toString']()[_0xb7da('0x64')](char(0x2c))>=0x0||_0x28fd61[_0xb7da('0x63')]()[_0xb7da('0x64')](char(0x22))>=0x0);}function encapsulate(_0x4b0d77){var _0x97806f=char(0x22),_0x504953='\x5c'+char(0x22),_0x4b97d1=_0x4b0d77[_0xb7da('0x63')]()[_0xb7da('0x65')](new RegExp(_0x97806f,'g'),_0x504953);return _0x97806f+_0x4b97d1+_0x97806f;}exports[_0xb7da('0x66')]=function(_0x3cdda9,_0x4a3f81,_0x5c7488){var _0x437a62,_0x30888b;var _0x44355a={'where':{'ProjectId':_0x3cdda9['params']['id']}};if(_0x3cdda9[_0xb7da('0x36')][_0xb7da('0x67')]){_0x44355a[_0xb7da('0x41')]['starttime']=JSON[_0xb7da('0x68')](_0x3cdda9['query'][_0xb7da('0x67')]);}return db[_0xb7da('0x5c')][_0xb7da('0x46')](_0x44355a)[_0xb7da('0x28')](handleEntityNotFound(_0x4a3f81,null))[_0xb7da('0x28')](function(_0x10dc22){if(_0x10dc22){_0x437a62=_0x10dc22;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0xb7da('0x30')](_0x437a62,'id')},'ProjectId':_0x3cdda9[_0xb7da('0x4a')]['id']},'order':_0xb7da('0x69')});}})[_0xb7da('0x28')](handleEntityNotFound(_0x4a3f81,null))[_0xb7da('0x28')](function(_0x339de7){if(_0x339de7){_0x30888b=_0x339de7;var _0x587dfd={};for(var _0x17f94a=0x0,_0x45e8dd=_0x30888b['length'];_0x17f94a<_0x45e8dd;_0x17f94a++){if(!_0x587dfd[_0xb7da('0x5d')](_0x30888b[_0x17f94a][_0xb7da('0x6a')])){_0x587dfd[_0x30888b[_0x17f94a]['questionId']]=needsEncapsulation(_0x30888b[_0x17f94a][_0xb7da('0x6b')])?encapsulate(_0x30888b[_0x17f94a][_0xb7da('0x6b')]):_0x30888b[_0x17f94a]['question'];}}var _0x1f825a=[],_0x19a686={};for(var _0x2a0cd5=0x0,_0x511026=_0x437a62[_0xb7da('0x3c')];_0x2a0cd5<_0x511026;_0x2a0cd5++){_0x19a686={'ProjectId':_0x3cdda9[_0xb7da('0x4a')]['id'],'SessionId':_0x437a62[_0x2a0cd5]['id'],'StartTime':moment(_0x437a62[_0x2a0cd5]['starttime'])[_0xb7da('0x6c')](_0xb7da('0x6d'))};for(var _0x13589d=0x0,_0x1a7fc1=_0x30888b[_0xb7da('0x3c')];_0x13589d<_0x1a7fc1;_0x13589d++){if(_0x30888b[_0x13589d]['SessionId']==_0x437a62[_0x2a0cd5]['id']&&_0x587dfd['hasOwnProperty'](_0x30888b[_0x13589d][_0xb7da('0x6a')])){_0x19a686[_0x587dfd[_0x30888b[_0x13589d][_0xb7da('0x6a')]]]=_0x30888b[_0x13589d][_0xb7da('0x6e')];}}for(var _0x2cd8a0 in _0x587dfd){if(!_0x19a686[_0xb7da('0x5d')](_0x587dfd[_0x2cd8a0])){_0x19a686[_0x587dfd[_0x2cd8a0]]=null;}}_0x1f825a[_0xb7da('0x6f')](_0x19a686);}return _0x1f825a;}})['then'](function(_0x5abe60){if(!_[_0xb7da('0x70')](_0x5abe60)){var _0x368eee=toCsv(_0x5abe60);var _0x14b687=Date[_0xb7da('0x71')]();fs[_0xb7da('0x72')](util[_0xb7da('0x6c')](_0xb7da('0x73'),_0x3cdda9[_0xb7da('0x4a')]['id'],_0x14b687),_0x368eee);_0x4a3f81['setHeader'](_0xb7da('0x74'),'attachment;\x20filename='+util[_0xb7da('0x6c')](_0xb7da('0x75'),_0x3cdda9['params']['id'],_0x14b687));_0x4a3f81['setHeader'](_0xb7da('0x76'),_0xb7da('0x77'));return _0x4a3f81[_0xb7da('0x78')](util[_0xb7da('0x6c')](_0xb7da('0x73'),_0x3cdda9[_0xb7da('0x4a')]['id'],_0x14b687));}else{return _0x4a3f81[_0xb7da('0x1b')](0xcc);}})[_0xb7da('0x48')](handleError(_0x4a3f81,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index e35323c..7145a28 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 _0x6fb8=['rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','../../config/logger','api','bluebird'];(function(_0x1658e6,_0x43b52e){var _0xc54a9e=function(_0x2a9e46){while(--_0x2a9e46){_0x1658e6['push'](_0x1658e6['shift']());}};_0xc54a9e(++_0x43b52e);}(_0x6fb8,0x104));var _0x86fb=function(_0x2d3ab3,_0x47d90b){_0x2d3ab3=_0x2d3ab3-0x0;var _0x321f9e=_0x6fb8[_0x2d3ab3];return _0x321f9e;};'use strict';var _=require(_0x86fb('0x0'));var util=require('util');var logger=require(_0x86fb('0x1'))(_0x86fb('0x2'));var moment=require('moment');var BPromise=require(_0x86fb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x86fb('0x4'));var config=require(_0x86fb('0x5'));var attributes=require(_0x86fb('0x6'));module[_0x86fb('0x7')]=function(_0x1aa956,_0x7ba395){return _0x1aa956[_0x86fb('0x8')](_0x86fb('0x9'),attributes,{'tableName':_0x86fb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4abf=['rimraf','exports','define','jscripty_projects','lodash','util','api','path'];(function(_0x2a9f85,_0xc18726){var _0x259639=function(_0x2ea115){while(--_0x2ea115){_0x2a9f85['push'](_0x2a9f85['shift']());}};_0x259639(++_0xc18726);}(_0x4abf,0xac));var _0xf4ab=function(_0x64b6e,_0x391478){_0x64b6e=_0x64b6e-0x0;var _0x5d4448=_0x4abf[_0x64b6e];return _0x5d4448;};'use strict';var _=require(_0xf4ab('0x0'));var util=require(_0xf4ab('0x1'));var logger=require('../../config/logger')(_0xf4ab('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf4ab('0x3'));var rimraf=require(_0xf4ab('0x4'));var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0xf4ab('0x5')]=function(_0x4160fb,_0x2e6efe){return _0x4160fb[_0xf4ab('0x6')]('JscriptyProject',attributes,{'tableName':_0xf4ab('0x7'),'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 08540d1..ea23288 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0x46da41,_0x3ae289){var _0x121015=function(_0x3dee74){while(--_0x3dee74){_0x46da41['push'](_0x46da41['shift']());}};_0x121015(++_0x3ae289);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0xcb91[_0x20a558];return _0x53d3f7;};'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')]('JscriptyProject,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xbdb7=['request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','JscriptyProject,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x49f19e,_0x1c3aa3){_0x49f19e=_0x49f19e-0x0;var _0x280b5a=_0xbdb7[_0x49f19e];return _0x280b5a;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 1433b28..2d23028 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 _0x2e0b=['create','put','delete','multer','util','path','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x2e0b,0x120));var _0xb2e0=function(_0x149bc3,_0x4b09d8){_0x149bc3=_0x149bc3-0x0;var _0x5d33eb=_0x2e0b[_0x149bc3];return _0x5d33eb;};'use strict';var multer=require(_0xb2e0('0x0'));var util=require(_0xb2e0('0x1'));var path=require(_0xb2e0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb2e0('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xb2e0('0x4'));var controller=require('./jscriptyQuestionReport.controller');router[_0xb2e0('0x5')]('/',auth[_0xb2e0('0x6')](),controller[_0xb2e0('0x7')]);router[_0xb2e0('0x5')](_0xb2e0('0x8'),auth[_0xb2e0('0x6')](),controller[_0xb2e0('0x9')]);router[_0xb2e0('0x5')](_0xb2e0('0xa'),auth['isAuthenticated'](),controller[_0xb2e0('0xb')]);router['post']('/',auth[_0xb2e0('0x6')](),controller[_0xb2e0('0xc')]);router[_0xb2e0('0xd')](_0xb2e0('0xa'),auth[_0xb2e0('0x6')](),controller['update']);router[_0xb2e0('0xe')]('/:id',auth[_0xb2e0('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xda50=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xda50,0xdf));var _0x0da5=function(_0x4b5640,_0x30980b){_0x4b5640=_0x4b5640-0x0;var _0x4afbaf=_0xda50[_0x4b5640];return _0x4afbaf;};'use strict';var multer=require('multer');var util=require(_0x0da5('0x0'));var path=require(_0x0da5('0x1'));var timeout=require(_0x0da5('0x2'));var express=require(_0x0da5('0x3'));var router=express[_0x0da5('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0da5('0x5'));var config=require(_0x0da5('0x6'));var controller=require('./jscriptyQuestionReport.controller');router[_0x0da5('0x7')]('/',auth[_0x0da5('0x8')](),controller[_0x0da5('0x9')]);router['get']('/describe',auth[_0x0da5('0x8')](),controller[_0x0da5('0xa')]);router[_0x0da5('0x7')](_0x0da5('0xb'),auth[_0x0da5('0x8')](),controller[_0x0da5('0xc')]);router[_0x0da5('0xd')]('/',auth[_0x0da5('0x8')](),controller[_0x0da5('0xe')]);router[_0x0da5('0xf')](_0x0da5('0xb'),auth[_0x0da5('0x8')](),controller[_0x0da5('0x10')]);router[_0x0da5('0x11')](_0x0da5('0xb'),auth['isAuthenticated'](),controller[_0x0da5('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 964baf7..aaca9d5 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7a54,0x106));var _0x47a5=function(_0x2827ed,_0x8b7012){_0x2827ed=_0x2827ed-0x0;var _0x191ad2=_0x7a54[_0x2827ed];return _0x191ad2;};'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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7a54,0x106));var _0x47a5=function(_0x1e395a,_0x4f5de5){_0x1e395a=_0x1e395a-0x0;var _0x40b3c0=_0x7a54[_0x1e395a];return _0x40b3c0;};'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 09cd437..6c21b83 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 _0xb43c=['offset','set','Content-Range','apply','reject','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','options','JscriptyQuestionReport','includeAll','findAll','catch','params','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xb43c,0x191));var _0xcb43=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb43c[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xcb43('0x0'));var rimraf=require(_0xcb43('0x1'));var zipdir=require(_0xcb43('0x2'));var jsonpatch=require(_0xcb43('0x3'));var rp=require(_0xcb43('0x4'));var moment=require(_0xcb43('0x5'));var BPromise=require(_0xcb43('0x6'));var Mustache=require('mustache');var util=require(_0xcb43('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcb43('0x8'));var _=require(_0xcb43('0x9'));var squel=require(_0xcb43('0xa'));var crypto=require(_0xcb43('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcb43('0xc'));var querystring=require(_0xcb43('0xd'));var Papa=require(_0xcb43('0xe'));var Redis=require(_0xcb43('0xf'));var authService=require(_0xcb43('0x10'));var qs=require(_0xcb43('0x11'));var as=require(_0xcb43('0x12'));var hardwareService=require(_0xcb43('0x13'));var logger=require(_0xcb43('0x14'))('api');var utils=require(_0xcb43('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xcb43('0x16'));var db=require(_0xcb43('0x17'))['db'];function respondWithStatusCode(_0x24d3c2,_0x5ea419){_0x5ea419=_0x5ea419||0xcc;return function(_0x5eb783){if(_0x5eb783){return _0x24d3c2[_0xcb43('0x18')](_0x5ea419);}return _0x24d3c2[_0xcb43('0x19')](_0x5ea419)[_0xcb43('0x1a')]();};}function respondWithResult(_0x1933c8,_0xf007bc){_0xf007bc=_0xf007bc||0xc8;return function(_0x4320e3){if(_0x4320e3){return _0x1933c8['status'](_0xf007bc)[_0xcb43('0x1b')](_0x4320e3);}};}function respondWithFilteredResult(_0xcf676b,_0x14c1f6){return function(_0x5d291d){if(_0x5d291d){var _0x147478=typeof _0x14c1f6['offset']==='undefined'&&typeof _0x14c1f6[_0xcb43('0x1c')]===_0xcb43('0x1d');var _0xb5c1fc=_0x5d291d[_0xcb43('0x1e')];var _0x4be812=_0x147478?0x0:_0x14c1f6[_0xcb43('0x1f')];var _0x214c9e=_0x147478?_0x5d291d[_0xcb43('0x1e')]:_0x14c1f6[_0xcb43('0x1f')]+_0x14c1f6['limit'];var _0x226e27;if(_0x214c9e>=_0xb5c1fc){_0x214c9e=_0xb5c1fc;_0x226e27=0xc8;}else{_0x226e27=0xce;}_0xcf676b[_0xcb43('0x19')](_0x226e27);return _0xcf676b[_0xcb43('0x20')](_0xcb43('0x21'),_0x4be812+'-'+_0x214c9e+'/'+_0xb5c1fc)[_0xcb43('0x1b')](_0x5d291d);}return null;};}function patchUpdates(_0x33a501){return function(_0x4e46b9){try{jsonpatch[_0xcb43('0x22')](_0x4e46b9,_0x33a501,!![]);}catch(_0x55a763){return BPromise[_0xcb43('0x23')](_0x55a763);}return _0x4e46b9['save']();};}function saveUpdates(_0x473a05,_0x169db0){return function(_0x31971a){if(_0x31971a){return _0x31971a[_0xcb43('0x24')](_0x473a05)[_0xcb43('0x25')](function(_0x3662b8){return _0x3662b8;});}return null;};}function removeEntity(_0x5b289d,_0x54ed25){return function(_0x243a75){if(_0x243a75){return _0x243a75['destroy']()[_0xcb43('0x25')](function(){_0x5b289d['status'](0xcc)[_0xcb43('0x1a')]();});}};}function handleEntityNotFound(_0x17cbfb,_0x427c04){return function(_0x3b1118){if(!_0x3b1118){_0x17cbfb[_0xcb43('0x18')](0x194);}return _0x3b1118;};}function handleError(_0x44ee9a,_0x5e985a){_0x5e985a=_0x5e985a||0x1f4;return function(_0x366a2f){logger['error'](_0x366a2f[_0xcb43('0x26')]);if(_0x366a2f[_0xcb43('0x27')]){delete _0x366a2f[_0xcb43('0x27')];}_0x44ee9a['status'](_0x5e985a)[_0xcb43('0x28')](_0x366a2f);};}exports[_0xcb43('0x29')]=function(_0x19b808,_0x14abe0){var _0x479e09={},_0x16cb5e={},_0x324b4c={'count':0x0,'rows':[]};var _0x2711e1=_[_0xcb43('0x2a')](db['JscriptyQuestionReport'][_0xcb43('0x2b')],function(_0x20d72c){return{'name':_0x20d72c[_0xcb43('0x2c')],'type':_0x20d72c[_0xcb43('0x2d')][_0xcb43('0x2e')]};});_0x16cb5e[_0xcb43('0x2f')]=_[_0xcb43('0x2a')](_0x2711e1,_0xcb43('0x27'));_0x16cb5e['query']=_[_0xcb43('0x30')](_0x19b808[_0xcb43('0x31')]);_0x16cb5e[_0xcb43('0x32')]=_[_0xcb43('0x33')](_0x16cb5e[_0xcb43('0x2f')],_0x16cb5e[_0xcb43('0x31')]);_0x479e09[_0xcb43('0x34')]=_[_0xcb43('0x33')](_0x16cb5e[_0xcb43('0x2f')],qs[_0xcb43('0x35')](_0x19b808[_0xcb43('0x31')]['fields']));_0x479e09[_0xcb43('0x34')]=_0x479e09['attributes'][_0xcb43('0x36')]?_0x479e09[_0xcb43('0x34')]:_0x16cb5e[_0xcb43('0x2f')];if(!_0x19b808['query']['hasOwnProperty'](_0xcb43('0x37'))){_0x479e09[_0xcb43('0x1c')]=qs[_0xcb43('0x1c')](_0x19b808[_0xcb43('0x31')][_0xcb43('0x1c')]);_0x479e09[_0xcb43('0x1f')]=qs[_0xcb43('0x1f')](_0x19b808['query'][_0xcb43('0x1f')]);}_0x479e09[_0xcb43('0x38')]=qs['sort'](_0x19b808['query'][_0xcb43('0x39')]);_0x479e09['where']=qs[_0xcb43('0x32')](_['pick'](_0x19b808[_0xcb43('0x31')],_0x16cb5e[_0xcb43('0x32')]),_0x2711e1);if(_0x19b808[_0xcb43('0x31')]['filter']){_0x479e09[_0xcb43('0x3a')]=_[_0xcb43('0x3b')](_0x479e09[_0xcb43('0x3a')],{'$or':_[_0xcb43('0x2a')](_0x2711e1,function(_0x13188b){if(_0x13188b[_0xcb43('0x2d')]!=='VIRTUAL'){var _0x165ec9={};_0x165ec9[_0x13188b[_0xcb43('0x27')]]={'$like':'%'+_0x19b808[_0xcb43('0x31')]['filter']+'%'};return _0x165ec9;}})});}_0x479e09=_[_0xcb43('0x3b')]({},_0x479e09,_0x19b808[_0xcb43('0x3c')]);var _0x11df8f={'where':_0x479e09[_0xcb43('0x3a')]};return db[_0xcb43('0x3d')][_0xcb43('0x1e')](_0x11df8f)['then'](function(_0x2a7538){_0x324b4c[_0xcb43('0x1e')]=_0x2a7538;if(_0x19b808[_0xcb43('0x31')][_0xcb43('0x3e')]){_0x479e09['include']=[{'all':!![]}];}return db[_0xcb43('0x3d')][_0xcb43('0x3f')](_0x479e09);})[_0xcb43('0x25')](function(_0x28ff64){_0x324b4c['rows']=_0x28ff64;return _0x324b4c;})[_0xcb43('0x25')](respondWithFilteredResult(_0x14abe0,_0x479e09))[_0xcb43('0x40')](handleError(_0x14abe0,null));};exports['show']=function(_0x4605d0,_0x519a74){var _0x330ed7={'raw':!![],'where':{'id':_0x4605d0[_0xcb43('0x41')]['id']}},_0x50c964={};_0x50c964['model']=_[_0xcb43('0x30')](db['JscriptyQuestionReport'][_0xcb43('0x2b')]);_0x50c964[_0xcb43('0x31')]=_[_0xcb43('0x30')](_0x4605d0[_0xcb43('0x31')]);_0x50c964[_0xcb43('0x32')]=_[_0xcb43('0x33')](_0x50c964[_0xcb43('0x2f')],_0x50c964['query']);_0x330ed7['attributes']=_['intersection'](_0x50c964[_0xcb43('0x2f')],qs['fields'](_0x4605d0['query']['fields']));_0x330ed7['attributes']=_0x330ed7[_0xcb43('0x34')]['length']?_0x330ed7[_0xcb43('0x34')]:_0x50c964[_0xcb43('0x2f')];if(_0x4605d0[_0xcb43('0x31')]['includeAll']){_0x330ed7[_0xcb43('0x42')]=[{'all':!![]}];}_0x330ed7=_[_0xcb43('0x3b')]({},_0x330ed7,_0x4605d0[_0xcb43('0x3c')]);return db[_0xcb43('0x3d')][_0xcb43('0x43')](_0x330ed7)['then'](handleEntityNotFound(_0x519a74,null))['then'](respondWithResult(_0x519a74,null))['catch'](handleError(_0x519a74,null));};exports['create']=function(_0x5bdf40,_0x43eb2c){return db[_0xcb43('0x3d')][_0xcb43('0x44')](_0x5bdf40[_0xcb43('0x45')],{})['then'](respondWithResult(_0x43eb2c,0xc9))[_0xcb43('0x40')](handleError(_0x43eb2c,null));};exports[_0xcb43('0x24')]=function(_0xc3c821,_0x1c459f){if(_0xc3c821[_0xcb43('0x45')]['id']){delete _0xc3c821[_0xcb43('0x45')]['id'];}return db[_0xcb43('0x3d')]['find']({'where':{'id':_0xc3c821[_0xcb43('0x41')]['id']}})[_0xcb43('0x25')](handleEntityNotFound(_0x1c459f,null))[_0xcb43('0x25')](saveUpdates(_0xc3c821['body'],null))['then'](respondWithResult(_0x1c459f,null))[_0xcb43('0x40')](handleError(_0x1c459f,null));};exports[_0xcb43('0x46')]=function(_0x436dcd,_0x283691){return db['JscriptyQuestionReport'][_0xcb43('0x43')]({'where':{'id':_0x436dcd[_0xcb43('0x41')]['id']}})[_0xcb43('0x25')](handleEntityNotFound(_0x283691,null))[_0xcb43('0x25')](removeEntity(_0x283691,null))[_0xcb43('0x40')](handleError(_0x283691,null));};exports[_0xcb43('0x47')]=function(_0x4b2080,_0x24692c){return db[_0xcb43('0x3d')]['describe']()[_0xcb43('0x25')](respondWithResult(_0x24692c,null))[_0xcb43('0x40')](handleError(_0x24692c,null));}; \ No newline at end of file +var _0x645b=['stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','zip-dir','request-promise','bluebird','mustache','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/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error'];(function(_0x38d672,_0xc41411){var _0x33b0ca=function(_0x1022ee){while(--_0x1022ee){_0x38d672['push'](_0x38d672['shift']());}};_0x33b0ca(++_0xc41411);}(_0x645b,0x1af));var _0xb645=function(_0x1ccb3b,_0x55d520){_0x1ccb3b=_0x1ccb3b-0x0;var _0x557296=_0x645b[_0x1ccb3b];return _0x557296;};'use strict';var emlformat=require(_0xb645('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb645('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb645('0x2'));var moment=require('moment');var BPromise=require(_0xb645('0x3'));var Mustache=require(_0xb645('0x4'));var util=require(_0xb645('0x5'));var path=require(_0xb645('0x6'));var sox=require(_0xb645('0x7'));var csv=require(_0xb645('0x8'));var ejs=require(_0xb645('0x9'));var fs=require('fs');var fs_extra=require(_0xb645('0xa'));var _=require(_0xb645('0xb'));var squel=require(_0xb645('0xc'));var crypto=require(_0xb645('0xd'));var jsforce=require(_0xb645('0xe'));var deskjs=require(_0xb645('0xf'));var toCsv=require(_0xb645('0x8'));var querystring=require('querystring');var Papa=require(_0xb645('0x10'));var Redis=require(_0xb645('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb645('0x12'));var as=require(_0xb645('0x13'));var hardwareService=require(_0xb645('0x14'));var logger=require(_0xb645('0x15'))(_0xb645('0x16'));var utils=require(_0xb645('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb645('0x18'));var db=require(_0xb645('0x19'))['db'];function respondWithStatusCode(_0x1c93ea,_0x3d0326){_0x3d0326=_0x3d0326||0xcc;return function(_0x32d8cf){if(_0x32d8cf){return _0x1c93ea[_0xb645('0x1a')](_0x3d0326);}return _0x1c93ea['status'](_0x3d0326)[_0xb645('0x1b')]();};}function respondWithResult(_0x596f04,_0x26dd33){_0x26dd33=_0x26dd33||0xc8;return function(_0x2d5c78){if(_0x2d5c78){return _0x596f04[_0xb645('0x1c')](_0x26dd33)[_0xb645('0x1d')](_0x2d5c78);}};}function respondWithFilteredResult(_0x534f5e,_0x558bf9){return function(_0xd7b26f){if(_0xd7b26f){var _0x5e9782=typeof _0x558bf9[_0xb645('0x1e')]===_0xb645('0x1f')&&typeof _0x558bf9[_0xb645('0x20')]===_0xb645('0x1f');var _0x10964a=_0xd7b26f[_0xb645('0x21')];var _0x65b45c=_0x5e9782?0x0:_0x558bf9[_0xb645('0x1e')];var _0x12f320=_0x5e9782?_0xd7b26f[_0xb645('0x21')]:_0x558bf9['offset']+_0x558bf9[_0xb645('0x20')];var _0x36ec79;if(_0x12f320>=_0x10964a){_0x12f320=_0x10964a;_0x36ec79=0xc8;}else{_0x36ec79=0xce;}_0x534f5e[_0xb645('0x1c')](_0x36ec79);return _0x534f5e[_0xb645('0x22')](_0xb645('0x23'),_0x65b45c+'-'+_0x12f320+'/'+_0x10964a)[_0xb645('0x1d')](_0xd7b26f);}return null;};}function patchUpdates(_0x4dda45){return function(_0x2ada2a){try{jsonpatch[_0xb645('0x24')](_0x2ada2a,_0x4dda45,!![]);}catch(_0x2157ff){return BPromise[_0xb645('0x25')](_0x2157ff);}return _0x2ada2a[_0xb645('0x26')]();};}function saveUpdates(_0x5014cc,_0x170e9e){return function(_0x531265){if(_0x531265){return _0x531265[_0xb645('0x27')](_0x5014cc)[_0xb645('0x28')](function(_0x42dcf3){return _0x42dcf3;});}return null;};}function removeEntity(_0xd3d8ce,_0x4be968){return function(_0x4ef0e4){if(_0x4ef0e4){return _0x4ef0e4[_0xb645('0x29')]()[_0xb645('0x28')](function(){_0xd3d8ce[_0xb645('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31f640,_0x4fa5c2){return function(_0x4bd48c){if(!_0x4bd48c){_0x31f640[_0xb645('0x1a')](0x194);}return _0x4bd48c;};}function handleError(_0x20c33d,_0x363e7f){_0x363e7f=_0x363e7f||0x1f4;return function(_0x2190cb){logger[_0xb645('0x2a')](_0x2190cb[_0xb645('0x2b')]);if(_0x2190cb[_0xb645('0x2c')]){delete _0x2190cb[_0xb645('0x2c')];}_0x20c33d['status'](_0x363e7f)[_0xb645('0x2d')](_0x2190cb);};}exports[_0xb645('0x2e')]=function(_0x534f91,_0x479b8b){var _0x4af0d6={},_0x39bcfd={},_0x2ed292={'count':0x0,'rows':[]};var _0x5b9da9=_[_0xb645('0x2f')](db[_0xb645('0x30')][_0xb645('0x31')],function(_0x37dec0){return{'name':_0x37dec0[_0xb645('0x32')],'type':_0x37dec0[_0xb645('0x33')]['key']};});_0x39bcfd[_0xb645('0x34')]=_['map'](_0x5b9da9,_0xb645('0x2c'));_0x39bcfd[_0xb645('0x35')]=_[_0xb645('0x36')](_0x534f91[_0xb645('0x35')]);_0x39bcfd[_0xb645('0x37')]=_[_0xb645('0x38')](_0x39bcfd[_0xb645('0x34')],_0x39bcfd[_0xb645('0x35')]);_0x4af0d6[_0xb645('0x39')]=_[_0xb645('0x38')](_0x39bcfd[_0xb645('0x34')],qs[_0xb645('0x3a')](_0x534f91[_0xb645('0x35')][_0xb645('0x3a')]));_0x4af0d6['attributes']=_0x4af0d6[_0xb645('0x39')][_0xb645('0x3b')]?_0x4af0d6[_0xb645('0x39')]:_0x39bcfd[_0xb645('0x34')];if(!_0x534f91[_0xb645('0x35')][_0xb645('0x3c')]('nolimit')){_0x4af0d6[_0xb645('0x20')]=qs[_0xb645('0x20')](_0x534f91[_0xb645('0x35')][_0xb645('0x20')]);_0x4af0d6[_0xb645('0x1e')]=qs[_0xb645('0x1e')](_0x534f91[_0xb645('0x35')][_0xb645('0x1e')]);}_0x4af0d6[_0xb645('0x3d')]=qs[_0xb645('0x3e')](_0x534f91[_0xb645('0x35')][_0xb645('0x3e')]);_0x4af0d6[_0xb645('0x3f')]=qs['filters'](_[_0xb645('0x40')](_0x534f91['query'],_0x39bcfd[_0xb645('0x37')]),_0x5b9da9);if(_0x534f91['query'][_0xb645('0x41')]){_0x4af0d6[_0xb645('0x3f')]=_[_0xb645('0x42')](_0x4af0d6[_0xb645('0x3f')],{'$or':_['map'](_0x5b9da9,function(_0x32d60c){if(_0x32d60c[_0xb645('0x33')]!=='VIRTUAL'){var _0xb39803={};_0xb39803[_0x32d60c['name']]={'$like':'%'+_0x534f91[_0xb645('0x35')]['filter']+'%'};return _0xb39803;}})});}_0x4af0d6=_[_0xb645('0x42')]({},_0x4af0d6,_0x534f91[_0xb645('0x43')]);var _0x353ab0={'where':_0x4af0d6[_0xb645('0x3f')]};return db['JscriptyQuestionReport'][_0xb645('0x21')](_0x353ab0)[_0xb645('0x28')](function(_0x1ffdb8){_0x2ed292[_0xb645('0x21')]=_0x1ffdb8;if(_0x534f91[_0xb645('0x35')][_0xb645('0x44')]){_0x4af0d6[_0xb645('0x45')]=[{'all':!![]}];}return db[_0xb645('0x30')][_0xb645('0x46')](_0x4af0d6);})[_0xb645('0x28')](function(_0x760f65){_0x2ed292[_0xb645('0x47')]=_0x760f65;return _0x2ed292;})[_0xb645('0x28')](respondWithFilteredResult(_0x479b8b,_0x4af0d6))[_0xb645('0x48')](handleError(_0x479b8b,null));};exports[_0xb645('0x49')]=function(_0x59b1ef,_0x211dc6){var _0x52049f={'raw':!![],'where':{'id':_0x59b1ef[_0xb645('0x4a')]['id']}},_0x1d63cf={};_0x1d63cf[_0xb645('0x34')]=_['keys'](db[_0xb645('0x30')]['rawAttributes']);_0x1d63cf[_0xb645('0x35')]=_['keys'](_0x59b1ef['query']);_0x1d63cf[_0xb645('0x37')]=_['intersection'](_0x1d63cf[_0xb645('0x34')],_0x1d63cf['query']);_0x52049f[_0xb645('0x39')]=_[_0xb645('0x38')](_0x1d63cf[_0xb645('0x34')],qs[_0xb645('0x3a')](_0x59b1ef[_0xb645('0x35')]['fields']));_0x52049f[_0xb645('0x39')]=_0x52049f[_0xb645('0x39')][_0xb645('0x3b')]?_0x52049f[_0xb645('0x39')]:_0x1d63cf['model'];if(_0x59b1ef[_0xb645('0x35')]['includeAll']){_0x52049f['include']=[{'all':!![]}];}_0x52049f=_[_0xb645('0x42')]({},_0x52049f,_0x59b1ef[_0xb645('0x43')]);return db['JscriptyQuestionReport'][_0xb645('0x4b')](_0x52049f)[_0xb645('0x28')](handleEntityNotFound(_0x211dc6,null))[_0xb645('0x28')](respondWithResult(_0x211dc6,null))[_0xb645('0x48')](handleError(_0x211dc6,null));};exports['create']=function(_0x4b6f73,_0x135681){return db[_0xb645('0x30')][_0xb645('0x4c')](_0x4b6f73[_0xb645('0x4d')],{})[_0xb645('0x28')](respondWithResult(_0x135681,0xc9))[_0xb645('0x48')](handleError(_0x135681,null));};exports[_0xb645('0x27')]=function(_0x5a2d63,_0x55e752){if(_0x5a2d63[_0xb645('0x4d')]['id']){delete _0x5a2d63[_0xb645('0x4d')]['id'];}return db[_0xb645('0x30')][_0xb645('0x4b')]({'where':{'id':_0x5a2d63['params']['id']}})[_0xb645('0x28')](handleEntityNotFound(_0x55e752,null))[_0xb645('0x28')](saveUpdates(_0x5a2d63[_0xb645('0x4d')],null))[_0xb645('0x28')](respondWithResult(_0x55e752,null))[_0xb645('0x48')](handleError(_0x55e752,null));};exports[_0xb645('0x29')]=function(_0x48b10d,_0x537727){return db[_0xb645('0x30')][_0xb645('0x4b')]({'where':{'id':_0x48b10d['params']['id']}})[_0xb645('0x28')](handleEntityNotFound(_0x537727,null))['then'](removeEntity(_0x537727,null))[_0xb645('0x48')](handleError(_0x537727,null));};exports[_0xb645('0x4e')]=function(_0x57e7b8,_0x31a883){return db[_0xb645('0x30')][_0xb645('0x4e')]()[_0xb645('0x28')](respondWithResult(_0x31a883,null))[_0xb645('0x48')](handleError(_0x31a883,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 13e2992..328a319 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 _0xc84e=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions'];(function(_0x1f9730,_0x39814e){var _0x5866aa=function(_0x7fbd56){while(--_0x7fbd56){_0x1f9730['push'](_0x1f9730['shift']());}};_0x5866aa(++_0x39814e);}(_0xc84e,0x1a4));var _0xec84=function(_0x5b105b,_0x6c7812){_0x5b105b=_0x5b105b-0x0;var _0x3b3f61=_0xc84e[_0x5b105b];return _0x3b3f61;};'use strict';var _=require(_0xec84('0x0'));var util=require(_0xec84('0x1'));var logger=require(_0xec84('0x2'))(_0xec84('0x3'));var moment=require(_0xec84('0x4'));var BPromise=require(_0xec84('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec84('0x6'));var rimraf=require(_0xec84('0x7'));var config=require(_0xec84('0x8'));var attributes=require(_0xec84('0x9'));module[_0xec84('0xa')]=function(_0x2f587d,_0x437cd3){return _0x2f587d[_0xec84('0xb')](_0xec84('0xc'),attributes,{'tableName':_0xec84('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1895=['path','./jscriptyQuestionReport.attributes','define','report_jscripty_questions','lodash','api','bluebird','request-promise'];(function(_0x15cfd3,_0xca8998){var _0x486df1=function(_0x596ef4){while(--_0x596ef4){_0x15cfd3['push'](_0x15cfd3['shift']());}};_0x486df1(++_0xca8998);}(_0x1895,0x1bc));var _0x5189=function(_0x5a7efc,_0x36d657){_0x5a7efc=_0x5a7efc-0x0;var _0x1e6341=_0x1895[_0x5a7efc];return _0x1e6341;};'use strict';var _=require(_0x5189('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5189('0x1'));var moment=require('moment');var BPromise=require(_0x5189('0x2'));var rp=require(_0x5189('0x3'));var fs=require('fs');var path=require(_0x5189('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5189('0x5'));module['exports']=function(_0x15aa72,_0x4b3bf9){return _0x15aa72[_0x5189('0x6')]('JscriptyQuestionReport',attributes,{'tableName':_0x5189('0x7'),'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 95c315c..f20b476 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 _0x1d37=['JscriptyQuestionReport,\x20%s,\x20%s','result','catch','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x3d56fb,_0x5a4b6c){var _0xee69d1=function(_0x8192f){while(--_0x8192f){_0x3d56fb['push'](_0x3d56fb['shift']());}};_0xee69d1(++_0x5a4b6c);}(_0x1d37,0xdf));var _0x71d3=function(_0x2dbb49,_0x4955d6){_0x2dbb49=_0x2dbb49-0x0;var _0x59083b=_0x1d37[_0x2dbb49];return _0x59083b;};'use strict';var _=require(_0x71d3('0x0'));var util=require('util');var moment=require(_0x71d3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x71d3('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x71d3('0x3'));var logger=require(_0x71d3('0x4'))(_0x71d3('0x5'));var config=require(_0x71d3('0x6'));var jayson=require(_0x71d3('0x7'));var client=jayson[_0x71d3('0x8')][_0x71d3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3bf027,_0x30141f,_0x325a80){return new BPromise(function(_0xe6977a,_0x134eec){return client['request'](_0x3bf027,_0x325a80)[_0x71d3('0xa')](function(_0x35e15c){logger[_0x71d3('0xb')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x30141f,_0x71d3('0xc'));logger[_0x71d3('0xd')](_0x71d3('0xe'),_0x30141f,_0x71d3('0xc'),JSON['stringify'](_0x35e15c));if(_0x35e15c['error']){if(_0x35e15c[_0x71d3('0xf')]['code']===0x1f4){logger[_0x71d3('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x30141f,_0x35e15c[_0x71d3('0xf')]['message']);return _0x134eec(_0x35e15c[_0x71d3('0xf')][_0x71d3('0x10')]);}logger[_0x71d3('0xf')](_0x71d3('0x11'),_0x30141f,_0x35e15c[_0x71d3('0xf')][_0x71d3('0x10')]);return _0xe6977a(_0x35e15c['error'][_0x71d3('0x10')]);}else{logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x30141f,_0x71d3('0xc'));_0xe6977a(_0x35e15c[_0x71d3('0x12')]['message']);}})[_0x71d3('0x13')](function(_0x64b6fa){logger[_0x71d3('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x30141f,_0x64b6fa);_0x134eec(_0x64b6fa);});});} \ No newline at end of file +var _0xcc10=['http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x25b90a,_0x5891fa){var _0x36c4ae=function(_0x2de29c){while(--_0x2de29c){_0x25b90a['push'](_0x25b90a['shift']());}};_0x36c4ae(++_0x5891fa);}(_0xcc10,0xd1));var _0x0cc1=function(_0x1f2fc1,_0x59c73a){_0x1f2fc1=_0x1f2fc1-0x0;var _0x2ba697=_0xcc10[_0x1f2fc1];return _0x2ba697;};'use strict';var _=require(_0x0cc1('0x0'));var util=require(_0x0cc1('0x1'));var moment=require(_0x0cc1('0x2'));var BPromise=require(_0x0cc1('0x3'));var rs=require(_0x0cc1('0x4'));var fs=require('fs');var Redis=require(_0x0cc1('0x5'));var db=require(_0x0cc1('0x6'))['db'];var utils=require(_0x0cc1('0x7'));var logger=require('../../config/logger')(_0x0cc1('0x8'));var config=require(_0x0cc1('0x9'));var jayson=require(_0x0cc1('0xa'));var client=jayson['client'][_0x0cc1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23c659,_0x387d56,_0x282c8b){return new BPromise(function(_0x581905,_0x10d65b){return client[_0x0cc1('0xc')](_0x23c659,_0x282c8b)[_0x0cc1('0xd')](function(_0xf0a402){logger[_0x0cc1('0xe')](_0x0cc1('0xf'),_0x387d56,_0x0cc1('0x10'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x387d56,'request\x20sent',JSON['stringify'](_0xf0a402));if(_0xf0a402[_0x0cc1('0x11')]){if(_0xf0a402[_0x0cc1('0x11')][_0x0cc1('0x12')]===0x1f4){logger[_0x0cc1('0x11')](_0x0cc1('0xf'),_0x387d56,_0xf0a402[_0x0cc1('0x11')][_0x0cc1('0x13')]);return _0x10d65b(_0xf0a402[_0x0cc1('0x11')][_0x0cc1('0x13')]);}logger[_0x0cc1('0x11')](_0x0cc1('0xf'),_0x387d56,_0xf0a402['error'][_0x0cc1('0x13')]);return _0x581905(_0xf0a402[_0x0cc1('0x11')][_0x0cc1('0x13')]);}else{logger[_0x0cc1('0xe')](_0x0cc1('0xf'),_0x387d56,_0x0cc1('0x10'));_0x581905(_0xf0a402[_0x0cc1('0x14')][_0x0cc1('0x13')]);}})[_0x0cc1('0x15')](function(_0x598cf6){logger[_0x0cc1('0x11')](_0x0cc1('0xf'),_0x387d56,_0x598cf6);_0x10d65b(_0x598cf6);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 9bf8896..27ef094 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 _0x56e7=['get','isAuthenticated','/describe','describe','show','post','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x2f597d,_0x32addb){var _0x28615a=function(_0xa06d14){while(--_0xa06d14){_0x2f597d['push'](_0x2f597d['shift']());}};_0x28615a(++_0x32addb);}(_0x56e7,0x14e));var _0x756e=function(_0x13e2b0,_0x3deffe){_0x13e2b0=_0x13e2b0-0x0;var _0x2a558b=_0x56e7[_0x13e2b0];return _0x2a558b;};'use strict';var multer=require(_0x756e('0x0'));var util=require(_0x756e('0x1'));var path=require(_0x756e('0x2'));var timeout=require(_0x756e('0x3'));var express=require(_0x756e('0x4'));var router=express[_0x756e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x756e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x756e('0x7'));var controller=require('./jscriptySessionReport.controller');router[_0x756e('0x8')]('/',auth[_0x756e('0x9')](),controller['index']);router[_0x756e('0x8')](_0x756e('0xa'),auth[_0x756e('0x9')](),controller[_0x756e('0xb')]);router[_0x756e('0x8')]('/:id',auth[_0x756e('0x9')](),controller[_0x756e('0xc')]);router[_0x756e('0x8')]('/:id/questions',auth[_0x756e('0x9')](),controller['getQuestions']);router[_0x756e('0xd')]('/',auth[_0x756e('0x9')](),controller['create']);router[_0x756e('0xe')]('/:id',auth[_0x756e('0x9')](),controller[_0x756e('0xf')]);router[_0x756e('0x10')](_0x756e('0x11'),auth[_0x756e('0x9')](),controller['destroy']);module[_0x756e('0x12')]=router; \ No newline at end of file +var _0x6bf9=['isAuthenticated','index','/describe','/:id','show','/:id/questions','create','put','update','delete','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get'];(function(_0x4e6b5e,_0x17b2f1){var _0x4c9460=function(_0x3cf400){while(--_0x3cf400){_0x4e6b5e['push'](_0x4e6b5e['shift']());}};_0x4c9460(++_0x17b2f1);}(_0x6bf9,0x8f));var _0x96bf=function(_0x5eaa0b,_0x433b2f){_0x5eaa0b=_0x5eaa0b-0x0;var _0x28b295=_0x6bf9[_0x5eaa0b];return _0x28b295;};'use strict';var multer=require(_0x96bf('0x0'));var util=require(_0x96bf('0x1'));var path=require(_0x96bf('0x2'));var timeout=require(_0x96bf('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x96bf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x96bf('0x5'));var config=require(_0x96bf('0x6'));var controller=require(_0x96bf('0x7'));router[_0x96bf('0x8')]('/',auth[_0x96bf('0x9')](),controller[_0x96bf('0xa')]);router['get'](_0x96bf('0xb'),auth[_0x96bf('0x9')](),controller['describe']);router['get'](_0x96bf('0xc'),auth[_0x96bf('0x9')](),controller[_0x96bf('0xd')]);router[_0x96bf('0x8')](_0x96bf('0xe'),auth[_0x96bf('0x9')](),controller['getQuestions']);router['post']('/',auth[_0x96bf('0x9')](),controller[_0x96bf('0xf')]);router[_0x96bf('0x10')](_0x96bf('0xc'),auth[_0x96bf('0x9')](),controller[_0x96bf('0x11')]);router[_0x96bf('0x12')](_0x96bf('0xc'),auth[_0x96bf('0x9')](),controller['destroy']);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 28711fd..abab06c 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 _0x4ec4=['DATE','STRING','BOOLEAN','moment','sequelize','exports','setDataValue','starttime','endtime','format'];(function(_0x4c4293,_0x2ad119){var _0x4e2402=function(_0x12db1e){while(--_0x12db1e){_0x4c4293['push'](_0x4c4293['shift']());}};_0x4e2402(++_0x2ad119);}(_0x4ec4,0x125));var _0x44ec=function(_0x1256c0,_0x21192c){_0x1256c0=_0x1256c0-0x0;var _0x246678=_0x4ec4[_0x1256c0];return _0x246678;};'use strict';var moment=require(_0x44ec('0x0'));var Sequelize=require(_0x44ec('0x1'));module[_0x44ec('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x16b598){this[_0x44ec('0x3')](_0x44ec('0x4'),_0x16b598);this[_0x44ec('0x3')](_0x44ec('0x5'),moment()[_0x44ec('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x44ec('0x7')]},'membername':{'type':Sequelize[_0x44ec('0x8')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x44ec('0x8')]},'uniqueid':{'type':Sequelize[_0x44ec('0x8')]},'calleridname':{'type':Sequelize[_0x44ec('0x8')]},'calleridnum':{'type':Sequelize[_0x44ec('0x8')]},'completed':{'type':Sequelize[_0x44ec('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x85de=['BOOLEAN','moment','sequelize','exports','DATE','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING'];(function(_0x49bf83,_0x3a54dc){var _0x339b39=function(_0x4ed39e){while(--_0x4ed39e){_0x49bf83['push'](_0x49bf83['shift']());}};_0x339b39(++_0x3a54dc);}(_0x85de,0x65));var _0xe85d=function(_0x2dcfae,_0x5bb50d){_0x2dcfae=_0x2dcfae-0x0;var _0x213a88=_0x85de[_0x2dcfae];return _0x213a88;};'use strict';var moment=require(_0xe85d('0x0'));var Sequelize=require(_0xe85d('0x1'));module[_0xe85d('0x2')]={'starttime':{'type':Sequelize[_0xe85d('0x3')],'set':function(_0xdb8f9e){this[_0xe85d('0x4')]('starttime',_0xdb8f9e);this[_0xe85d('0x4')](_0xe85d('0x5'),moment()[_0xe85d('0x6')](_0xe85d('0x7')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xe85d('0x8')]},'queue':{'type':Sequelize[_0xe85d('0x8')]},'uniqueid':{'type':Sequelize[_0xe85d('0x8')]},'calleridname':{'type':Sequelize[_0xe85d('0x8')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xe85d('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index ff51327..8bc74e4 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 _0x6b0e=['fieldName','type','key','model','keys','query','intersection','attributes','fields','nolimit','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','update','body','describe','getQuestions','hasOwnProperty','order','SessionId','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','apply','reject','save','then','destroy','error','stack','name','map','JscriptySessionReport'];(function(_0x4d1cc6,_0x26bebe){var _0x1a6fee=function(_0x374f30){while(--_0x374f30){_0x4d1cc6['push'](_0x4d1cc6['shift']());}};_0x1a6fee(++_0x26bebe);}(_0x6b0e,0x149));var _0xe6b0=function(_0x251f9f,_0x1099d1){_0x251f9f=_0x251f9f-0x0;var _0x3da5b3=_0x6b0e[_0x251f9f];return _0x3da5b3;};'use strict';var emlformat=require(_0xe6b0('0x0'));var rimraf=require(_0xe6b0('0x1'));var zipdir=require(_0xe6b0('0x2'));var jsonpatch=require(_0xe6b0('0x3'));var rp=require('request-promise');var moment=require(_0xe6b0('0x4'));var BPromise=require(_0xe6b0('0x5'));var Mustache=require('mustache');var util=require(_0xe6b0('0x6'));var path=require(_0xe6b0('0x7'));var sox=require('sox');var csv=require(_0xe6b0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe6b0('0x9'));var _=require(_0xe6b0('0xa'));var squel=require('squel');var crypto=require(_0xe6b0('0xb'));var jsforce=require(_0xe6b0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe6b0('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe6b0('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe6b0('0xe'));var logger=require(_0xe6b0('0xf'))(_0xe6b0('0x10'));var utils=require('../../config/utils');var config=require(_0xe6b0('0x11'));var licenseUtil=require(_0xe6b0('0x12'));var db=require(_0xe6b0('0x13'))['db'];function respondWithStatusCode(_0x79d2c7,_0x38a75c){_0x38a75c=_0x38a75c||0xcc;return function(_0x1fe6e7){if(_0x1fe6e7){return _0x79d2c7['sendStatus'](_0x38a75c);}return _0x79d2c7[_0xe6b0('0x14')](_0x38a75c)[_0xe6b0('0x15')]();};}function respondWithResult(_0x4bf625,_0x586c3b){_0x586c3b=_0x586c3b||0xc8;return function(_0x2abd53){if(_0x2abd53){return _0x4bf625['status'](_0x586c3b)['json'](_0x2abd53);}};}function respondWithFilteredResult(_0x138dfe,_0x5a5ddf){return function(_0x4be193){if(_0x4be193){var _0x19497c=typeof _0x5a5ddf[_0xe6b0('0x16')]==='undefined'&&typeof _0x5a5ddf[_0xe6b0('0x17')]===_0xe6b0('0x18');var _0x5c5b0b=_0x4be193[_0xe6b0('0x19')];var _0x1f8da5=_0x19497c?0x0:_0x5a5ddf[_0xe6b0('0x16')];var _0x59fef1=_0x19497c?_0x4be193[_0xe6b0('0x19')]:_0x5a5ddf[_0xe6b0('0x16')]+_0x5a5ddf['limit'];var _0x1a3226;if(_0x59fef1>=_0x5c5b0b){_0x59fef1=_0x5c5b0b;_0x1a3226=0xc8;}else{_0x1a3226=0xce;}_0x138dfe['status'](_0x1a3226);return _0x138dfe['set']('Content-Range',_0x1f8da5+'-'+_0x59fef1+'/'+_0x5c5b0b)['json'](_0x4be193);}return null;};}function patchUpdates(_0x1b2d14){return function(_0x193da1){try{jsonpatch[_0xe6b0('0x1a')](_0x193da1,_0x1b2d14,!![]);}catch(_0x15d800){return BPromise[_0xe6b0('0x1b')](_0x15d800);}return _0x193da1[_0xe6b0('0x1c')]();};}function saveUpdates(_0x32312c,_0x306d0f){return function(_0x100359){if(_0x100359){return _0x100359['update'](_0x32312c)[_0xe6b0('0x1d')](function(_0x426f33){return _0x426f33;});}return null;};}function removeEntity(_0xf57efd,_0x207efd){return function(_0x285ab5){if(_0x285ab5){return _0x285ab5[_0xe6b0('0x1e')]()['then'](function(){_0xf57efd[_0xe6b0('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28e2c1,_0x173728){return function(_0x32ba43){if(!_0x32ba43){_0x28e2c1['sendStatus'](0x194);}return _0x32ba43;};}function handleError(_0x4fb8af,_0x269ac3){_0x269ac3=_0x269ac3||0x1f4;return function(_0x1a31f7){logger[_0xe6b0('0x1f')](_0x1a31f7[_0xe6b0('0x20')]);if(_0x1a31f7[_0xe6b0('0x21')]){delete _0x1a31f7[_0xe6b0('0x21')];}_0x4fb8af[_0xe6b0('0x14')](_0x269ac3)['send'](_0x1a31f7);};}exports['index']=function(_0x11821a,_0x481e25){var _0x22d408={},_0x387a16={},_0x241d36={'count':0x0,'rows':[]};var _0x1ed5a7=_[_0xe6b0('0x22')](db[_0xe6b0('0x23')]['rawAttributes'],function(_0x2ac525){return{'name':_0x2ac525[_0xe6b0('0x24')],'type':_0x2ac525[_0xe6b0('0x25')][_0xe6b0('0x26')]};});_0x387a16[_0xe6b0('0x27')]=_['map'](_0x1ed5a7,_0xe6b0('0x21'));_0x387a16['query']=_[_0xe6b0('0x28')](_0x11821a[_0xe6b0('0x29')]);_0x387a16['filters']=_[_0xe6b0('0x2a')](_0x387a16[_0xe6b0('0x27')],_0x387a16['query']);_0x22d408[_0xe6b0('0x2b')]=_[_0xe6b0('0x2a')](_0x387a16[_0xe6b0('0x27')],qs[_0xe6b0('0x2c')](_0x11821a[_0xe6b0('0x29')]['fields']));_0x22d408[_0xe6b0('0x2b')]=_0x22d408[_0xe6b0('0x2b')]['length']?_0x22d408[_0xe6b0('0x2b')]:_0x387a16[_0xe6b0('0x27')];if(!_0x11821a[_0xe6b0('0x29')]['hasOwnProperty'](_0xe6b0('0x2d'))){_0x22d408[_0xe6b0('0x17')]=qs['limit'](_0x11821a[_0xe6b0('0x29')][_0xe6b0('0x17')]);_0x22d408['offset']=qs[_0xe6b0('0x16')](_0x11821a[_0xe6b0('0x29')][_0xe6b0('0x16')]);}_0x22d408['order']=qs[_0xe6b0('0x2e')](_0x11821a[_0xe6b0('0x29')][_0xe6b0('0x2e')]);_0x22d408['where']=qs[_0xe6b0('0x2f')](_[_0xe6b0('0x30')](_0x11821a['query'],_0x387a16[_0xe6b0('0x2f')]),_0x1ed5a7);if(_0x11821a[_0xe6b0('0x29')][_0xe6b0('0x31')]){_0x22d408['where']=_['merge'](_0x22d408[_0xe6b0('0x32')],{'$or':_[_0xe6b0('0x22')](_0x1ed5a7,function(_0x162032){if(_0x162032[_0xe6b0('0x25')]!==_0xe6b0('0x33')){var _0x3df6e8={};_0x3df6e8[_0x162032[_0xe6b0('0x21')]]={'$like':'%'+_0x11821a[_0xe6b0('0x29')][_0xe6b0('0x31')]+'%'};return _0x3df6e8;}})});}_0x22d408=_[_0xe6b0('0x34')]({},_0x22d408,_0x11821a[_0xe6b0('0x35')]);var _0x52dbf1={'where':_0x22d408[_0xe6b0('0x32')]};return db[_0xe6b0('0x23')][_0xe6b0('0x19')](_0x52dbf1)[_0xe6b0('0x1d')](function(_0x345d2f){_0x241d36['count']=_0x345d2f;if(_0x11821a[_0xe6b0('0x29')][_0xe6b0('0x36')]){_0x22d408[_0xe6b0('0x37')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xe6b0('0x38')](_0x22d408);})[_0xe6b0('0x1d')](function(_0x135be9){_0x241d36[_0xe6b0('0x39')]=_0x135be9;return _0x241d36;})[_0xe6b0('0x1d')](respondWithFilteredResult(_0x481e25,_0x22d408))[_0xe6b0('0x3a')](handleError(_0x481e25,null));};exports[_0xe6b0('0x3b')]=function(_0x4c0a56,_0x49a5b9){var _0x291921={'raw':!![],'where':{'id':_0x4c0a56[_0xe6b0('0x3c')]['id']}},_0x32d07f={};_0x32d07f[_0xe6b0('0x27')]=_['keys'](db[_0xe6b0('0x23')][_0xe6b0('0x3d')]);_0x32d07f[_0xe6b0('0x29')]=_['keys'](_0x4c0a56[_0xe6b0('0x29')]);_0x32d07f[_0xe6b0('0x2f')]=_[_0xe6b0('0x2a')](_0x32d07f[_0xe6b0('0x27')],_0x32d07f[_0xe6b0('0x29')]);_0x291921[_0xe6b0('0x2b')]=_['intersection'](_0x32d07f['model'],qs[_0xe6b0('0x2c')](_0x4c0a56['query']['fields']));_0x291921[_0xe6b0('0x2b')]=_0x291921[_0xe6b0('0x2b')][_0xe6b0('0x3e')]?_0x291921[_0xe6b0('0x2b')]:_0x32d07f[_0xe6b0('0x27')];if(_0x4c0a56[_0xe6b0('0x29')][_0xe6b0('0x36')]){_0x291921['include']=[{'all':!![]}];}_0x291921=_[_0xe6b0('0x34')]({},_0x291921,_0x4c0a56[_0xe6b0('0x35')]);return db['JscriptySessionReport'][_0xe6b0('0x3f')](_0x291921)[_0xe6b0('0x1d')](handleEntityNotFound(_0x49a5b9,null))['then'](respondWithResult(_0x49a5b9,null))[_0xe6b0('0x3a')](handleError(_0x49a5b9,null));};exports[_0xe6b0('0x40')]=function(_0x412a53,_0x370adb){return db['JscriptySessionReport'][_0xe6b0('0x40')](_0x412a53['body'],{})['then'](respondWithResult(_0x370adb,0xc9))['catch'](handleError(_0x370adb,null));};exports[_0xe6b0('0x41')]=function(_0x1cc34a,_0x1a77ee){if(_0x1cc34a[_0xe6b0('0x42')]['id']){delete _0x1cc34a['body']['id'];}return db[_0xe6b0('0x23')][_0xe6b0('0x3f')]({'where':{'id':_0x1cc34a['params']['id']}})[_0xe6b0('0x1d')](handleEntityNotFound(_0x1a77ee,null))[_0xe6b0('0x1d')](saveUpdates(_0x1cc34a[_0xe6b0('0x42')],null))['then'](respondWithResult(_0x1a77ee,null))[_0xe6b0('0x3a')](handleError(_0x1a77ee,null));};exports[_0xe6b0('0x1e')]=function(_0x26da2a,_0x4716e9){return db[_0xe6b0('0x23')][_0xe6b0('0x3f')]({'where':{'id':_0x26da2a[_0xe6b0('0x3c')]['id']}})['then'](handleEntityNotFound(_0x4716e9,null))['then'](removeEntity(_0x4716e9,null))[_0xe6b0('0x3a')](handleError(_0x4716e9,null));};exports[_0xe6b0('0x43')]=function(_0x2cdb64,_0x5c6ce0){return db[_0xe6b0('0x23')][_0xe6b0('0x43')]()[_0xe6b0('0x1d')](respondWithResult(_0x5c6ce0,null))['catch'](handleError(_0x5c6ce0,null));};exports[_0xe6b0('0x44')]=function(_0x1d1bfc,_0x3b471d,_0x1b56da){var _0x13a400={'raw':!![],'where':{}};var _0x1d6256={};var _0x197d39={'count':0x0,'rows':[]};return db[_0xe6b0('0x23')]['findOne']({'where':{'id':_0x1d1bfc['params']['id']}})[_0xe6b0('0x1d')](handleEntityNotFound(_0x3b471d,null))[_0xe6b0('0x1d')](function(_0x37fc0c){if(_0x37fc0c){_0x1d6256[_0xe6b0('0x27')]=_['keys'](db['JscriptyQuestionReport']['rawAttributes']);_0x1d6256[_0xe6b0('0x29')]=_[_0xe6b0('0x28')](_0x1d1bfc[_0xe6b0('0x29')]);_0x1d6256[_0xe6b0('0x2f')]=_['intersection'](_0x1d6256[_0xe6b0('0x27')],_0x1d6256['query']);_0x13a400[_0xe6b0('0x2b')]=_[_0xe6b0('0x2a')](_0x1d6256['model'],qs[_0xe6b0('0x2c')](_0x1d1bfc['query'][_0xe6b0('0x2c')]));_0x13a400[_0xe6b0('0x2b')]=_0x13a400['attributes']['length']?_0x13a400['attributes']:_0x1d6256['model'];if(!_0x1d1bfc[_0xe6b0('0x29')][_0xe6b0('0x45')](_0xe6b0('0x2d'))){_0x13a400['limit']=qs[_0xe6b0('0x17')](_0x1d1bfc[_0xe6b0('0x29')][_0xe6b0('0x17')]);_0x13a400['offset']=qs[_0xe6b0('0x16')](_0x1d1bfc[_0xe6b0('0x29')][_0xe6b0('0x16')]);}_0x13a400[_0xe6b0('0x46')]=qs['sort'](_0x1d1bfc[_0xe6b0('0x29')][_0xe6b0('0x2e')]);_0x13a400[_0xe6b0('0x32')]=qs[_0xe6b0('0x2f')](_[_0xe6b0('0x30')](_0x1d1bfc['query'],_0x1d6256[_0xe6b0('0x2f')]));_0x13a400['where'][_0xe6b0('0x47')]=_0x37fc0c['id'];if(_0x1d1bfc[_0xe6b0('0x29')][_0xe6b0('0x31')]){_0x13a400[_0xe6b0('0x32')]=_[_0xe6b0('0x34')](_0x13a400[_0xe6b0('0x32')],{'$or':_[_0xe6b0('0x22')](_0x13a400[_0xe6b0('0x2b')],function(_0xe1269c){var _0x225bc2={};_0x225bc2[_0xe1269c]={'$like':'%'+_0x1d1bfc['query'][_0xe6b0('0x31')]+'%'};return _0x225bc2;})});}_0x13a400=_[_0xe6b0('0x34')]({},_0x13a400,_0x1d1bfc[_0xe6b0('0x35')]);return db[_0xe6b0('0x48')]['count']({'where':_0x13a400[_0xe6b0('0x32')]})[_0xe6b0('0x1d')](function(_0x1c9fa6){_0x197d39[_0xe6b0('0x19')]=_0x1c9fa6;if(_0x1d1bfc['query'][_0xe6b0('0x36')]){_0x13a400[_0xe6b0('0x37')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xe6b0('0x38')](_0x13a400);})[_0xe6b0('0x1d')](function(_0x3ba2c3){_0x197d39[_0xe6b0('0x39')]=_0x3ba2c3;return _0x197d39;});}})[_0xe6b0('0x1d')](respondWithFilteredResult(_0x3b471d,_0x13a400))['catch'](handleError(_0x3b471d,null));}; \ No newline at end of file +var _0x8044=['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','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','getQuestions','findOne','length','nolimit','pick','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel'];(function(_0x1d5401,_0x2f95da){var _0x5021c0=function(_0x37205d){while(--_0x37205d){_0x1d5401['push'](_0x1d5401['shift']());}};_0x5021c0(++_0x2f95da);}(_0x8044,0xee));var _0x4804=function(_0x1c06f4,_0x2feba6){_0x1c06f4=_0x1c06f4-0x0;var _0x1a727e=_0x8044[_0x1c06f4];return _0x1a727e;};'use strict';var emlformat=require(_0x4804('0x0'));var rimraf=require(_0x4804('0x1'));var zipdir=require(_0x4804('0x2'));var jsonpatch=require(_0x4804('0x3'));var rp=require(_0x4804('0x4'));var moment=require(_0x4804('0x5'));var BPromise=require(_0x4804('0x6'));var Mustache=require(_0x4804('0x7'));var util=require(_0x4804('0x8'));var path=require('path');var sox=require(_0x4804('0x9'));var csv=require('to-csv');var ejs=require(_0x4804('0xa'));var fs=require('fs');var fs_extra=require(_0x4804('0xb'));var _=require(_0x4804('0xc'));var squel=require(_0x4804('0xd'));var crypto=require(_0x4804('0xe'));var jsforce=require(_0x4804('0xf'));var deskjs=require(_0x4804('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4804('0x11'));var Papa=require('papaparse');var Redis=require(_0x4804('0x12'));var authService=require(_0x4804('0x13'));var qs=require(_0x4804('0x14'));var as=require(_0x4804('0x15'));var hardwareService=require(_0x4804('0x16'));var logger=require(_0x4804('0x17'))(_0x4804('0x18'));var utils=require(_0x4804('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x4804('0x1a'));var db=require(_0x4804('0x1b'))['db'];function respondWithStatusCode(_0x1dc811,_0x9c3461){_0x9c3461=_0x9c3461||0xcc;return function(_0x21d1c6){if(_0x21d1c6){return _0x1dc811[_0x4804('0x1c')](_0x9c3461);}return _0x1dc811[_0x4804('0x1d')](_0x9c3461)[_0x4804('0x1e')]();};}function respondWithResult(_0x11bd75,_0x32bf7d){_0x32bf7d=_0x32bf7d||0xc8;return function(_0x49989f){if(_0x49989f){return _0x11bd75[_0x4804('0x1d')](_0x32bf7d)[_0x4804('0x1f')](_0x49989f);}};}function respondWithFilteredResult(_0x59ecac,_0x537229){return function(_0x46ffa7){if(_0x46ffa7){var _0x49249d=typeof _0x537229[_0x4804('0x20')]===_0x4804('0x21')&&typeof _0x537229['limit']===_0x4804('0x21');var _0x3cb74c=_0x46ffa7['count'];var _0x3b2ea8=_0x49249d?0x0:_0x537229['offset'];var _0xfbab2d=_0x49249d?_0x46ffa7[_0x4804('0x22')]:_0x537229[_0x4804('0x20')]+_0x537229[_0x4804('0x23')];var _0x9ac872;if(_0xfbab2d>=_0x3cb74c){_0xfbab2d=_0x3cb74c;_0x9ac872=0xc8;}else{_0x9ac872=0xce;}_0x59ecac[_0x4804('0x1d')](_0x9ac872);return _0x59ecac[_0x4804('0x24')](_0x4804('0x25'),_0x3b2ea8+'-'+_0xfbab2d+'/'+_0x3cb74c)[_0x4804('0x1f')](_0x46ffa7);}return null;};}function patchUpdates(_0x115971){return function(_0x3b0953){try{jsonpatch[_0x4804('0x26')](_0x3b0953,_0x115971,!![]);}catch(_0xb255ac){return BPromise[_0x4804('0x27')](_0xb255ac);}return _0x3b0953['save']();};}function saveUpdates(_0xf125e1,_0x8f76b6){return function(_0x1189a2){if(_0x1189a2){return _0x1189a2[_0x4804('0x28')](_0xf125e1)[_0x4804('0x29')](function(_0x4237bd){return _0x4237bd;});}return null;};}function removeEntity(_0x4fde64,_0x5750e0){return function(_0x10db60){if(_0x10db60){return _0x10db60[_0x4804('0x2a')]()[_0x4804('0x29')](function(){_0x4fde64[_0x4804('0x1d')](0xcc)[_0x4804('0x1e')]();});}};}function handleEntityNotFound(_0xbc61e0,_0x3ebffa){return function(_0x47e544){if(!_0x47e544){_0xbc61e0[_0x4804('0x1c')](0x194);}return _0x47e544;};}function handleError(_0x28ec47,_0x5c292e){_0x5c292e=_0x5c292e||0x1f4;return function(_0x3c9616){logger[_0x4804('0x2b')](_0x3c9616['stack']);if(_0x3c9616[_0x4804('0x2c')]){delete _0x3c9616[_0x4804('0x2c')];}_0x28ec47[_0x4804('0x1d')](_0x5c292e)[_0x4804('0x2d')](_0x3c9616);};}exports[_0x4804('0x2e')]=function(_0x431e59,_0x375adf){var _0x5c8478={},_0xc6187c={},_0x28d2bc={'count':0x0,'rows':[]};var _0x48c57f=_[_0x4804('0x2f')](db[_0x4804('0x30')][_0x4804('0x31')],function(_0x525e61){return{'name':_0x525e61[_0x4804('0x32')],'type':_0x525e61['type']['key']};});_0xc6187c['model']=_[_0x4804('0x2f')](_0x48c57f,_0x4804('0x2c'));_0xc6187c[_0x4804('0x33')]=_[_0x4804('0x34')](_0x431e59[_0x4804('0x33')]);_0xc6187c[_0x4804('0x35')]=_[_0x4804('0x36')](_0xc6187c[_0x4804('0x37')],_0xc6187c[_0x4804('0x33')]);_0x5c8478[_0x4804('0x38')]=_[_0x4804('0x36')](_0xc6187c[_0x4804('0x37')],qs[_0x4804('0x39')](_0x431e59[_0x4804('0x33')]['fields']));_0x5c8478['attributes']=_0x5c8478[_0x4804('0x38')]['length']?_0x5c8478[_0x4804('0x38')]:_0xc6187c[_0x4804('0x37')];if(!_0x431e59['query'][_0x4804('0x3a')]('nolimit')){_0x5c8478[_0x4804('0x23')]=qs[_0x4804('0x23')](_0x431e59[_0x4804('0x33')]['limit']);_0x5c8478[_0x4804('0x20')]=qs[_0x4804('0x20')](_0x431e59[_0x4804('0x33')][_0x4804('0x20')]);}_0x5c8478[_0x4804('0x3b')]=qs[_0x4804('0x3c')](_0x431e59[_0x4804('0x33')][_0x4804('0x3c')]);_0x5c8478[_0x4804('0x3d')]=qs[_0x4804('0x35')](_['pick'](_0x431e59[_0x4804('0x33')],_0xc6187c[_0x4804('0x35')]),_0x48c57f);if(_0x431e59[_0x4804('0x33')]['filter']){_0x5c8478['where']=_['merge'](_0x5c8478['where'],{'$or':_['map'](_0x48c57f,function(_0x345c65){if(_0x345c65[_0x4804('0x3e')]!==_0x4804('0x3f')){var _0x265ebf={};_0x265ebf[_0x345c65[_0x4804('0x2c')]]={'$like':'%'+_0x431e59[_0x4804('0x33')][_0x4804('0x40')]+'%'};return _0x265ebf;}})});}_0x5c8478=_[_0x4804('0x41')]({},_0x5c8478,_0x431e59[_0x4804('0x42')]);var _0x138fc1={'where':_0x5c8478['where']};return db[_0x4804('0x30')][_0x4804('0x22')](_0x138fc1)[_0x4804('0x29')](function(_0x27c080){_0x28d2bc[_0x4804('0x22')]=_0x27c080;if(_0x431e59[_0x4804('0x33')][_0x4804('0x43')]){_0x5c8478[_0x4804('0x44')]=[{'all':!![]}];}return db[_0x4804('0x30')][_0x4804('0x45')](_0x5c8478);})[_0x4804('0x29')](function(_0x1e1b04){_0x28d2bc[_0x4804('0x46')]=_0x1e1b04;return _0x28d2bc;})[_0x4804('0x29')](respondWithFilteredResult(_0x375adf,_0x5c8478))[_0x4804('0x47')](handleError(_0x375adf,null));};exports[_0x4804('0x48')]=function(_0x3f7308,_0x14d703){var _0x249b9d={'raw':!![],'where':{'id':_0x3f7308[_0x4804('0x49')]['id']}},_0x3e1dbe={};_0x3e1dbe[_0x4804('0x37')]=_[_0x4804('0x34')](db['JscriptySessionReport']['rawAttributes']);_0x3e1dbe['query']=_[_0x4804('0x34')](_0x3f7308[_0x4804('0x33')]);_0x3e1dbe[_0x4804('0x35')]=_[_0x4804('0x36')](_0x3e1dbe['model'],_0x3e1dbe[_0x4804('0x33')]);_0x249b9d[_0x4804('0x38')]=_['intersection'](_0x3e1dbe[_0x4804('0x37')],qs['fields'](_0x3f7308['query'][_0x4804('0x39')]));_0x249b9d[_0x4804('0x38')]=_0x249b9d[_0x4804('0x38')]['length']?_0x249b9d[_0x4804('0x38')]:_0x3e1dbe[_0x4804('0x37')];if(_0x3f7308[_0x4804('0x33')]['includeAll']){_0x249b9d[_0x4804('0x44')]=[{'all':!![]}];}_0x249b9d=_[_0x4804('0x41')]({},_0x249b9d,_0x3f7308[_0x4804('0x42')]);return db[_0x4804('0x30')][_0x4804('0x4a')](_0x249b9d)[_0x4804('0x29')](handleEntityNotFound(_0x14d703,null))[_0x4804('0x29')](respondWithResult(_0x14d703,null))[_0x4804('0x47')](handleError(_0x14d703,null));};exports[_0x4804('0x4b')]=function(_0x544280,_0x33b73c){return db['JscriptySessionReport'][_0x4804('0x4b')](_0x544280['body'],{})[_0x4804('0x29')](respondWithResult(_0x33b73c,0xc9))[_0x4804('0x47')](handleError(_0x33b73c,null));};exports[_0x4804('0x28')]=function(_0x435a2b,_0x85a44f){if(_0x435a2b['body']['id']){delete _0x435a2b[_0x4804('0x4c')]['id'];}return db['JscriptySessionReport']['find']({'where':{'id':_0x435a2b['params']['id']}})[_0x4804('0x29')](handleEntityNotFound(_0x85a44f,null))['then'](saveUpdates(_0x435a2b[_0x4804('0x4c')],null))['then'](respondWithResult(_0x85a44f,null))['catch'](handleError(_0x85a44f,null));};exports[_0x4804('0x2a')]=function(_0x2e835d,_0x1316ca){return db[_0x4804('0x30')][_0x4804('0x4a')]({'where':{'id':_0x2e835d[_0x4804('0x49')]['id']}})['then'](handleEntityNotFound(_0x1316ca,null))[_0x4804('0x29')](removeEntity(_0x1316ca,null))[_0x4804('0x47')](handleError(_0x1316ca,null));};exports['describe']=function(_0x44c08a,_0x218c1e){return db[_0x4804('0x30')][_0x4804('0x4d')]()[_0x4804('0x29')](respondWithResult(_0x218c1e,null))[_0x4804('0x47')](handleError(_0x218c1e,null));};exports[_0x4804('0x4e')]=function(_0x487208,_0x3da115,_0x43c894){var _0x476a62={'raw':!![],'where':{}};var _0x257432={};var _0x425a5f={'count':0x0,'rows':[]};return db[_0x4804('0x30')][_0x4804('0x4f')]({'where':{'id':_0x487208['params']['id']}})[_0x4804('0x29')](handleEntityNotFound(_0x3da115,null))[_0x4804('0x29')](function(_0x50ae2f){if(_0x50ae2f){_0x257432[_0x4804('0x37')]=_[_0x4804('0x34')](db['JscriptyQuestionReport']['rawAttributes']);_0x257432[_0x4804('0x33')]=_[_0x4804('0x34')](_0x487208[_0x4804('0x33')]);_0x257432['filters']=_[_0x4804('0x36')](_0x257432[_0x4804('0x37')],_0x257432[_0x4804('0x33')]);_0x476a62[_0x4804('0x38')]=_['intersection'](_0x257432[_0x4804('0x37')],qs[_0x4804('0x39')](_0x487208[_0x4804('0x33')]['fields']));_0x476a62[_0x4804('0x38')]=_0x476a62[_0x4804('0x38')][_0x4804('0x50')]?_0x476a62['attributes']:_0x257432[_0x4804('0x37')];if(!_0x487208[_0x4804('0x33')][_0x4804('0x3a')](_0x4804('0x51'))){_0x476a62[_0x4804('0x23')]=qs[_0x4804('0x23')](_0x487208['query']['limit']);_0x476a62[_0x4804('0x20')]=qs['offset'](_0x487208[_0x4804('0x33')][_0x4804('0x20')]);}_0x476a62['order']=qs[_0x4804('0x3c')](_0x487208['query'][_0x4804('0x3c')]);_0x476a62[_0x4804('0x3d')]=qs['filters'](_[_0x4804('0x52')](_0x487208[_0x4804('0x33')],_0x257432[_0x4804('0x35')]));_0x476a62[_0x4804('0x3d')]['SessionId']=_0x50ae2f['id'];if(_0x487208[_0x4804('0x33')][_0x4804('0x40')]){_0x476a62[_0x4804('0x3d')]=_['merge'](_0x476a62[_0x4804('0x3d')],{'$or':_['map'](_0x476a62[_0x4804('0x38')],function(_0x46f821){var _0x56cd71={};_0x56cd71[_0x46f821]={'$like':'%'+_0x487208['query'][_0x4804('0x40')]+'%'};return _0x56cd71;})});}_0x476a62=_[_0x4804('0x41')]({},_0x476a62,_0x487208[_0x4804('0x42')]);return db[_0x4804('0x53')]['count']({'where':_0x476a62['where']})['then'](function(_0x3c14e1){_0x425a5f[_0x4804('0x22')]=_0x3c14e1;if(_0x487208[_0x4804('0x33')][_0x4804('0x43')]){_0x476a62[_0x4804('0x44')]=[{'all':!![]}];}return db[_0x4804('0x53')][_0x4804('0x45')](_0x476a62);})[_0x4804('0x29')](function(_0x3934b7){_0x425a5f['rows']=_0x3934b7;return _0x425a5f;});}})[_0x4804('0x29')](respondWithFilteredResult(_0x3da115,_0x476a62))['catch'](handleError(_0x3da115,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index c7947d1..368168c 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 _0xe2fe=['../../config/environment','exports','define','JscriptySessionReport','lodash','api','bluebird','request-promise','path','rimraf'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var 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('./jscriptySessionReport.attributes');module[_0xee2f('0x7')]=function(_0x2b7e7c,_0x49926b){return _0x2b7e7c[_0xee2f('0x8')](_0xee2f('0x9'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7da7=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','define','report_jscripty_sessions','lodash'];(function(_0x4a5e0f,_0x24fcf6){var _0x347895=function(_0x1f5e35){while(--_0x1f5e35){_0x4a5e0f['push'](_0x4a5e0f['shift']());}};_0x347895(++_0x24fcf6);}(_0x7da7,0x10d));var _0x77da=function(_0xcfe8cc,_0xb83aeb){_0xcfe8cc=_0xcfe8cc-0x0;var _0x55ac53=_0x7da7[_0xcfe8cc];return _0x55ac53;};'use strict';var _=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var logger=require(_0x77da('0x2'))('api');var moment=require('moment');var BPromise=require(_0x77da('0x3'));var rp=require(_0x77da('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x77da('0x5'));var config=require(_0x77da('0x6'));var attributes=require('./jscriptySessionReport.attributes');module[_0x77da('0x7')]=function(_0xc54a12,_0x47da81){return _0xc54a12[_0x77da('0x8')]('JscriptySessionReport',attributes,{'tableName':_0x77da('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index ecc4e5f..c43c185 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 _0x5c3c=['JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent'];(function(_0x43938b,_0x128db6){var _0x15b82a=function(_0xf38284){while(--_0xf38284){_0x43938b['push'](_0x43938b['shift']());}};_0x15b82a(++_0x128db6);}(_0x5c3c,0x132));var _0xc5c3=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x5c3c[_0xf50820];return _0x2a9b10;};'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);});});} \ No newline at end of file +var _0x627e=['request','info','JscriptySessionReport,\x20%s,\x20%s','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x293ecd,_0x1325a0){var _0x1d03eb=function(_0x134fbf){while(--_0x134fbf){_0x293ecd['push'](_0x293ecd['shift']());}};_0x1d03eb(++_0x1325a0);}(_0x627e,0x14a));var _0xe627=function(_0x931119,_0xd716ee){_0x931119=_0x931119-0x0;var _0x2fba62=_0x627e[_0x931119];return _0x2fba62;};'use strict';var _=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var moment=require(_0xe627('0x2'));var BPromise=require(_0xe627('0x3'));var rs=require(_0xe627('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe627('0x5'))['db'];var utils=require(_0xe627('0x6'));var logger=require(_0xe627('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe627('0x8')][_0xe627('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45e49a,_0x2d4f63,_0xd5016e){return new BPromise(function(_0xe065b,_0x4bae52){return client[_0xe627('0xa')](_0x45e49a,_0xd5016e)['then'](function(_0x56549e){logger[_0xe627('0xb')](_0xe627('0xc'),_0x2d4f63,'request\x20sent');logger['debug'](_0xe627('0xd'),_0x2d4f63,_0xe627('0xe'),JSON[_0xe627('0xf')](_0x56549e));if(_0x56549e[_0xe627('0x10')]){if(_0x56549e[_0xe627('0x10')][_0xe627('0x11')]===0x1f4){logger[_0xe627('0x10')](_0xe627('0xc'),_0x2d4f63,_0x56549e[_0xe627('0x10')]['message']);return _0x4bae52(_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);}logger[_0xe627('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x2d4f63,_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);return _0xe065b(_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);}else{logger[_0xe627('0xb')](_0xe627('0xc'),_0x2d4f63,_0xe627('0xe'));_0xe065b(_0x56549e['result'][_0xe627('0x12')]);}})[_0xe627('0x13')](function(_0x16c2d7){logger[_0xe627('0x10')](_0xe627('0xc'),_0x2d4f63,_0x16c2d7);_0x4bae52(_0x16c2d7);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index ad30b17..bc46bb2 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 _0x0b36=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','/:id','isAuthenticated','util','path'];(function(_0x177505,_0x47a47a){var _0xb3dbfd=function(_0x46d26a){while(--_0x46d26a){_0x177505['push'](_0x177505['shift']());}};_0xb3dbfd(++_0x47a47a);}(_0x0b36,0x80));var _0x60b3=function(_0x49f368,_0xf070e2){_0x49f368=_0x49f368-0x0;var _0x3923f3=_0x0b36[_0x49f368];return _0x3923f3;};'use strict';var multer=require('multer');var util=require(_0x60b3('0x0'));var path=require(_0x60b3('0x1'));var timeout=require('connect-timeout');var express=require(_0x60b3('0x2'));var router=express[_0x60b3('0x3')]();var fs_extra=require(_0x60b3('0x4'));var auth=require(_0x60b3('0x5'));var interaction=require(_0x60b3('0x6'));var config=require(_0x60b3('0x7'));var controller=require(_0x60b3('0x8'));router[_0x60b3('0x9')]('/',controller[_0x60b3('0xa')]);router['put'](_0x60b3('0xb'),auth[_0x60b3('0xc')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0xe5b3=['../../config/environment','./license.controller','get','put','/:id','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x148879,_0x5b4c11){var _0x4f7027=function(_0xad056b){while(--_0xad056b){_0x148879['push'](_0x148879['shift']());}};_0x4f7027(++_0x5b4c11);}(_0xe5b3,0x133));var _0x3e5b=function(_0x2a8bbd,_0x2d998b){_0x2a8bbd=_0x2a8bbd-0x0;var _0x276e9c=_0xe5b3[_0x2a8bbd];return _0x276e9c;};'use strict';var multer=require('multer');var util=require(_0x3e5b('0x0'));var path=require(_0x3e5b('0x1'));var timeout=require(_0x3e5b('0x2'));var express=require(_0x3e5b('0x3'));var router=express[_0x3e5b('0x4')]();var fs_extra=require(_0x3e5b('0x5'));var auth=require(_0x3e5b('0x6'));var interaction=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var controller=require(_0x3e5b('0x9'));router[_0x3e5b('0xa')]('/',controller['index']);router[_0x3e5b('0xb')](_0x3e5b('0xc'),auth['isAuthenticated'](),controller[_0x3e5b('0xd')]);module[_0x3e5b('0xe')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 50fa757..10c9f72 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 _0x9d6a=['STRING','sequelize','exports','TEXT'];(function(_0x50700a,_0x3cfa24){var _0x93612c=function(_0x3bd5c0){while(--_0x3bd5c0){_0x50700a['push'](_0x50700a['shift']());}};_0x93612c(++_0x3cfa24);}(_0x9d6a,0x1b5));var _0xa9d6=function(_0x1d1a27,_0xad4ccb){_0x1d1a27=_0x1d1a27-0x0;var _0x29a011=_0x9d6a[_0x1d1a27];return _0x29a011;};'use strict';var Sequelize=require(_0xa9d6('0x0'));module[_0xa9d6('0x1')]={'license':{'type':Sequelize[_0xa9d6('0x2')]},'data1':{'type':Sequelize[_0xa9d6('0x3')]},'data2':{'type':Sequelize[_0xa9d6('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x2ee3=['STRING','INTEGER','exports','TEXT'];(function(_0x3b87ef,_0x3d0761){var _0x5d9cd9=function(_0x28c539){while(--_0x28c539){_0x3b87ef['push'](_0x3b87ef['shift']());}};_0x5d9cd9(++_0x3d0761);}(_0x2ee3,0x14a));var _0x32ee=function(_0x338581,_0x85c756){_0x338581=_0x338581-0x0;var _0x306123=_0x2ee3[_0x338581];return _0x306123;};'use strict';var Sequelize=require('sequelize');module[_0x32ee('0x0')]={'license':{'type':Sequelize[_0x32ee('0x1')]},'data1':{'type':Sequelize[_0x32ee('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x32ee('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 0dd75c9..05dab07 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 _0x814b=['json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','model','keys','rawAttributes','intersection','query','attributes','fields','length','merge','options','getLicense','catch','body','License','params','get','key','demo','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x2b9f98,_0x287922){var _0x29fc1b=function(_0xc72094){while(--_0xc72094){_0x2b9f98['push'](_0x2b9f98['shift']());}};_0x29fc1b(++_0x287922);}(_0x814b,0x1a2));var _0xb814=function(_0x1ad901,_0x852d9e){_0x1ad901=_0x1ad901-0x0;var _0x3c0249=_0x814b[_0x1ad901];return _0x3c0249;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=typeof _0x303aca[_0xb814('0x1f')]===_0xb814('0x20')&&typeof _0x303aca[_0xb814('0x21')]===_0xb814('0x20');var _0x48c9df=_0x3a71d6[_0xb814('0x22')];var _0x55ba16=_0x45e0d0?0x0:_0x303aca[_0xb814('0x1f')];var _0xfac75b=_0x45e0d0?_0x3a71d6['count']:_0x303aca['offset']+_0x303aca['limit'];var _0x399b43;if(_0xfac75b>=_0x48c9df){_0xfac75b=_0x48c9df;_0x399b43=0xc8;}else{_0x399b43=0xce;}_0x39bfcf['status'](_0x399b43);return _0x39bfcf['set'](_0xb814('0x23'),_0x55ba16+'-'+_0xfac75b+'/'+_0x48c9df)[_0xb814('0x1e')](_0x3a71d6);}return null;};}function patchUpdates(_0x25b6b6){return function(_0x4e139e){try{jsonpatch[_0xb814('0x24')](_0x4e139e,_0x25b6b6,!![]);}catch(_0x531032){return BPromise[_0xb814('0x25')](_0x531032);}return _0x4e139e[_0xb814('0x26')]();};}function saveUpdates(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x27')](_0x3b267e)[_0xb814('0x28')](function(_0x594470){return _0x594470;});}return null;};}function removeEntity(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(_0x3f81d0){return _0x3f81d0[_0xb814('0x29')]()[_0xb814('0x28')](function(){_0x2ead86[_0xb814('0x1c')](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0xb9e57d,_0x3d836c){return function(_0x5755ea){if(!_0x5755ea){_0xb9e57d[_0xb814('0x1b')](0x194);}return _0x5755ea;};}function handleError(_0xc0ef66,_0x1c2625){_0x1c2625=_0x1c2625||0x1f4;return function(_0x349394){logger[_0xb814('0x2a')](_0x349394[_0xb814('0x2b')]);if(_0x349394[_0xb814('0x2c')]){delete _0x349394[_0xb814('0x2c')];}_0xc0ef66['status'](_0x1c2625)[_0xb814('0x2d')](_0x349394);};}var utilLicense=require(_0xb814('0x19'));exports['index']=function(_0x9008b2,_0x37d24d){var _0x530744={'raw':!![],'where':{'id':0x1}},_0x499f22={};_0x499f22[_0xb814('0x2e')]=_[_0xb814('0x2f')](db['License'][_0xb814('0x30')]);_0x499f22['query']=_[_0xb814('0x2f')](_0x9008b2['query']);_0x499f22['filters']=_[_0xb814('0x31')](_0x499f22['model'],_0x499f22[_0xb814('0x32')]);_0x530744[_0xb814('0x33')]=_[_0xb814('0x31')](_0x499f22['model'],qs['fields'](_0x9008b2[_0xb814('0x32')][_0xb814('0x34')]));_0x530744['attributes']=_0x530744[_0xb814('0x33')][_0xb814('0x35')]?_0x530744[_0xb814('0x33')]:_0x499f22[_0xb814('0x2e')];_0x530744=_[_0xb814('0x36')]({},_0x530744,_0x9008b2[_0xb814('0x37')]);return utilLicense[_0xb814('0x38')](_0x530744)['then'](respondWithResult(_0x37d24d,null))[_0xb814('0x39')](handleError(_0x37d24d,null));};exports[_0xb814('0x27')]=function(_0x30de5a,_0x424e2b){if(_0x30de5a[_0xb814('0x3a')]['id']){delete _0x30de5a['body']['id'];}return db[_0xb814('0x3b')]['find']({'where':{'id':_0x30de5a[_0xb814('0x3c')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x424e2b,null))[_0xb814('0x28')](function(_0x492d5e){var _0x40b885=_0x492d5e[_0xb814('0x3d')]({'plain':!![]});return utilLicense['checkLicense'](_0x40b885,_0x30de5a[_0xb814('0x3a')][_0xb814('0x3e')]);})[_0xb814('0x28')](function(_0x1f7cd8){if(!_0x1f7cd8[_0xb814('0x3f')]){return saveUpdates(_0x30de5a[_0xb814('0x3a')],null);}return _0x1f7cd8;})['then'](respondWithResult(_0x424e2b,null))[_0xb814('0x39')](handleError(_0x424e2b,null));}; \ No newline at end of file +var _0x326f=['sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','stack','name','send','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','options','getLicense','catch','body','License','find','checkLicense','key','demo','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x326f,0xd1));var _0xf326=function(_0x59f39f,_0xbc7b05){_0x59f39f=_0x59f39f-0x0;var _0x184c4a=_0x326f[_0x59f39f];return _0x184c4a;};'use strict';var emlformat=require(_0xf326('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf326('0x1'));var rp=require(_0xf326('0x2'));var moment=require(_0xf326('0x3'));var BPromise=require(_0xf326('0x4'));var Mustache=require(_0xf326('0x5'));var util=require(_0xf326('0x6'));var path=require(_0xf326('0x7'));var sox=require(_0xf326('0x8'));var csv=require(_0xf326('0x9'));var ejs=require(_0xf326('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf326('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3162f9,_0x9ed463){_0x9ed463=_0x9ed463||0xcc;return function(_0x4b3966){if(_0x4b3966){return _0x3162f9[_0xf326('0x17')](_0x9ed463);}return _0x3162f9[_0xf326('0x18')](_0x9ed463)[_0xf326('0x19')]();};}function respondWithResult(_0x17a098,_0x5c8483){_0x5c8483=_0x5c8483||0xc8;return function(_0x45c1b6){if(_0x45c1b6){return _0x17a098['status'](_0x5c8483)['json'](_0x45c1b6);}};}function respondWithFilteredResult(_0xdf21d9,_0x11f6d2){return function(_0x1f2e5a){if(_0x1f2e5a){var _0xa63d1a=typeof _0x11f6d2[_0xf326('0x1a')]===_0xf326('0x1b')&&typeof _0x11f6d2[_0xf326('0x1c')]===_0xf326('0x1b');var _0x5a682a=_0x1f2e5a[_0xf326('0x1d')];var _0x453100=_0xa63d1a?0x0:_0x11f6d2[_0xf326('0x1a')];var _0x31ffb9=_0xa63d1a?_0x1f2e5a[_0xf326('0x1d')]:_0x11f6d2[_0xf326('0x1a')]+_0x11f6d2['limit'];var _0x4a5b6c;if(_0x31ffb9>=_0x5a682a){_0x31ffb9=_0x5a682a;_0x4a5b6c=0xc8;}else{_0x4a5b6c=0xce;}_0xdf21d9['status'](_0x4a5b6c);return _0xdf21d9[_0xf326('0x1e')](_0xf326('0x1f'),_0x453100+'-'+_0x31ffb9+'/'+_0x5a682a)['json'](_0x1f2e5a);}return null;};}function patchUpdates(_0x4cabce){return function(_0x128c68){try{jsonpatch['apply'](_0x128c68,_0x4cabce,!![]);}catch(_0x5b6d3c){return BPromise[_0xf326('0x20')](_0x5b6d3c);}return _0x128c68[_0xf326('0x21')]();};}function saveUpdates(_0x549b46,_0x5aa184){return function(_0x19b8ba){if(_0x19b8ba){return _0x19b8ba[_0xf326('0x22')](_0x549b46)['then'](function(_0x337ed5){return _0x337ed5;});}return null;};}function removeEntity(_0x1b9039,_0x43c53e){return function(_0x295752){if(_0x295752){return _0x295752[_0xf326('0x23')]()[_0xf326('0x24')](function(){_0x1b9039['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f31f6,_0x520d85){return function(_0x1a2c4e){if(!_0x1a2c4e){_0x4f31f6[_0xf326('0x17')](0x194);}return _0x1a2c4e;};}function handleError(_0x1ff2b5,_0x148953){_0x148953=_0x148953||0x1f4;return function(_0x410237){logger['error'](_0x410237[_0xf326('0x25')]);if(_0x410237[_0xf326('0x26')]){delete _0x410237[_0xf326('0x26')];}_0x1ff2b5['status'](_0x148953)[_0xf326('0x27')](_0x410237);};}var utilLicense=require('../../config/license/util');exports['index']=function(_0x6a8e89,_0x1ae23a){var _0x2fa28e={'raw':!![],'where':{'id':0x1}},_0x5dbe63={};_0x5dbe63[_0xf326('0x28')]=_[_0xf326('0x29')](db['License'][_0xf326('0x2a')]);_0x5dbe63[_0xf326('0x2b')]=_[_0xf326('0x29')](_0x6a8e89[_0xf326('0x2b')]);_0x5dbe63[_0xf326('0x2c')]=_[_0xf326('0x2d')](_0x5dbe63[_0xf326('0x28')],_0x5dbe63[_0xf326('0x2b')]);_0x2fa28e[_0xf326('0x2e')]=_[_0xf326('0x2d')](_0x5dbe63['model'],qs[_0xf326('0x2f')](_0x6a8e89[_0xf326('0x2b')][_0xf326('0x2f')]));_0x2fa28e['attributes']=_0x2fa28e[_0xf326('0x2e')][_0xf326('0x30')]?_0x2fa28e[_0xf326('0x2e')]:_0x5dbe63['model'];_0x2fa28e=_['merge']({},_0x2fa28e,_0x6a8e89[_0xf326('0x31')]);return utilLicense[_0xf326('0x32')](_0x2fa28e)[_0xf326('0x24')](respondWithResult(_0x1ae23a,null))[_0xf326('0x33')](handleError(_0x1ae23a,null));};exports[_0xf326('0x22')]=function(_0x2e8a64,_0x62585a){if(_0x2e8a64[_0xf326('0x34')]['id']){delete _0x2e8a64['body']['id'];}return db[_0xf326('0x35')][_0xf326('0x36')]({'where':{'id':_0x2e8a64['params']['id']}})[_0xf326('0x24')](handleEntityNotFound(_0x62585a,null))['then'](function(_0xce1cbb){var _0x481b64=_0xce1cbb['get']({'plain':!![]});return utilLicense[_0xf326('0x37')](_0x481b64,_0x2e8a64['body'][_0xf326('0x38')]);})['then'](function(_0x310dbb){if(!_0x310dbb[_0xf326('0x39')]){return saveUpdates(_0x2e8a64[_0xf326('0x34')],null);}return _0x310dbb;})['then'](respondWithResult(_0x62585a,null))[_0xf326('0x33')](handleError(_0x62585a,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 58595db..403e212 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 _0xfeea=['license','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./license.attributes','exports','define','License'];(function(_0x40ddc0,_0x41c082){var _0x1aebf1=function(_0x3ba1f6){while(--_0x3ba1f6){_0x40ddc0['push'](_0x40ddc0['shift']());}};_0x1aebf1(++_0x41c082);}(_0xfeea,0x105));var _0xafee=function(_0x237c45,_0x55cf99){_0x237c45=_0x237c45-0x0;var _0x2942f6=_0xfeea[_0x237c45];return _0x2942f6;};'use strict';var _=require(_0xafee('0x0'));var util=require(_0xafee('0x1'));var logger=require(_0xafee('0x2'))(_0xafee('0x3'));var moment=require('moment');var BPromise=require(_0xafee('0x4'));var rp=require(_0xafee('0x5'));var fs=require('fs');var path=require(_0xafee('0x6'));var rimraf=require('rimraf');var config=require(_0xafee('0x7'));var attributes=require(_0xafee('0x8'));module[_0xafee('0x9')]=function(_0x4f4bb4,_0x5c107e){return _0x4f4bb4[_0xafee('0xa')](_0xafee('0xb'),attributes,{'tableName':_0xafee('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f92=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes','license','lodash'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3f92,0x173));var _0x23f9=function(_0x47a63a,_0x52275a){_0x47a63a=_0x47a63a-0x0;var _0x98d27d=_0x3f92[_0x47a63a];return _0x98d27d;};'use strict';var _=require(_0x23f9('0x0'));var util=require(_0x23f9('0x1'));var logger=require(_0x23f9('0x2'))(_0x23f9('0x3'));var moment=require(_0x23f9('0x4'));var BPromise=require(_0x23f9('0x5'));var rp=require(_0x23f9('0x6'));var fs=require('fs');var path=require(_0x23f9('0x7'));var rimraf=require(_0x23f9('0x8'));var config=require(_0x23f9('0x9'));var attributes=require(_0x23f9('0xa'));module['exports']=function(_0x3b808a,_0xf7e69){return _0x3b808a['define']('License',attributes,{'tableName':_0x23f9('0xb'),'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 4c0c560..b0d4f5b 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 _0x9af0=['randomstring','../../config/logger','../../config/environment','jayson/promise','client','then','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','code','error','message','lodash','util','moment','bluebird'];(function(_0x22d3f6,_0x31834c){var _0x4b6f1e=function(_0x5e0e73){while(--_0x5e0e73){_0x22d3f6['push'](_0x22d3f6['shift']());}};_0x4b6f1e(++_0x31834c);}(_0x9af0,0xf8));var _0x09af=function(_0x311007,_0x499b48){_0x311007=_0x311007-0x0;var _0x1fbe59=_0x9af0[_0x311007];return _0x1fbe59;};'use strict';var _=require(_0x09af('0x0'));var util=require(_0x09af('0x1'));var moment=require(_0x09af('0x2'));var BPromise=require(_0x09af('0x3'));var rs=require(_0x09af('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x09af('0x5'))('rpc');var config=require(_0x09af('0x6'));var jayson=require(_0x09af('0x7'));var client=jayson[_0x09af('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35bf62,_0x4170b5,_0xb35502){return new BPromise(function(_0x47eacc,_0x3fa0b0){return client['request'](_0x35bf62,_0xb35502)[_0x09af('0x9')](function(_0x3e8069){logger[_0x09af('0xa')](_0x09af('0xb'),_0x4170b5,_0x09af('0xc'));logger['debug'](_0x09af('0xd'),_0x4170b5,_0x09af('0xc'),JSON[_0x09af('0xe')](_0x3e8069));if(_0x3e8069['error']){if(_0x3e8069['error'][_0x09af('0xf')]===0x1f4){logger[_0x09af('0x10')](_0x09af('0xb'),_0x4170b5,_0x3e8069[_0x09af('0x10')][_0x09af('0x11')]);return _0x3fa0b0(_0x3e8069['error']['message']);}logger[_0x09af('0x10')](_0x09af('0xb'),_0x4170b5,_0x3e8069[_0x09af('0x10')][_0x09af('0x11')]);return _0x47eacc(_0x3e8069[_0x09af('0x10')][_0x09af('0x11')]);}else{logger[_0x09af('0xa')](_0x09af('0xb'),_0x4170b5,_0x09af('0xc'));_0x47eacc(_0x3e8069['result']['message']);}})['catch'](function(_0x5a6db7){logger['error'](_0x09af('0xb'),_0x4170b5,_0x5a6db7);_0x3fa0b0(_0x5a6db7);});});} \ No newline at end of file +var _0x2193=['stringify','error','code','message','result','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','License,\x20%s,\x20%s','License,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1d7163,_0x53556e){var _0x4eb40a=function(_0x184081){while(--_0x184081){_0x1d7163['push'](_0x1d7163['shift']());}};_0x4eb40a(++_0x53556e);}(_0x2193,0x77));var _0x3219=function(_0x1d0076,_0x3048a4){_0x1d0076=_0x1d0076-0x0;var _0x2fd766=_0x2193[_0x1d0076];return _0x2fd766;};'use strict';var _=require('lodash');var util=require(_0x3219('0x0'));var moment=require(_0x3219('0x1'));var BPromise=require(_0x3219('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3219('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3219('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x3219('0x5'));var jayson=require(_0x3219('0x6'));var client=jayson[_0x3219('0x7')][_0x3219('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f6c3a,_0x350a51,_0x5d0874){return new BPromise(function(_0x5a3115,_0x167d94){return client[_0x3219('0x9')](_0x1f6c3a,_0x5d0874)['then'](function(_0x59ac5b){logger[_0x3219('0xa')](_0x3219('0xb'),_0x350a51,'request\x20sent');logger['debug'](_0x3219('0xc'),_0x350a51,_0x3219('0xd'),JSON[_0x3219('0xe')](_0x59ac5b));if(_0x59ac5b[_0x3219('0xf')]){if(_0x59ac5b[_0x3219('0xf')][_0x3219('0x10')]===0x1f4){logger[_0x3219('0xf')](_0x3219('0xb'),_0x350a51,_0x59ac5b['error'][_0x3219('0x11')]);return _0x167d94(_0x59ac5b[_0x3219('0xf')]['message']);}logger[_0x3219('0xf')](_0x3219('0xb'),_0x350a51,_0x59ac5b[_0x3219('0xf')][_0x3219('0x11')]);return _0x5a3115(_0x59ac5b[_0x3219('0xf')][_0x3219('0x11')]);}else{logger[_0x3219('0xa')](_0x3219('0xb'),_0x350a51,'request\x20sent');_0x5a3115(_0x59ac5b[_0x3219('0x12')][_0x3219('0x11')]);}})['catch'](function(_0x5e340f){logger[_0x3219('0xf')](_0x3219('0xb'),_0x350a51,_0x5e340f);_0x167d94(_0x5e340f);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index ae885a5..508e8c8 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 _0x44b4=['addInteraction','/:id/applications','addApplications','send','addAgents','put','delete','removeImap','destroy','removeAgents','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','create','addSmtp'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x44b4,0x13f));var _0x444b=function(_0x5a01d7,_0x1715f3){_0x5a01d7=_0x5a01d7-0x0;var _0x1ab6ad=_0x44b4[_0x5a01d7];return _0x1ab6ad;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x444b('0x0'));var timeout=require(_0x444b('0x1'));var express=require(_0x444b('0x2'));var router=express[_0x444b('0x3')]();var fs_extra=require(_0x444b('0x4'));var auth=require(_0x444b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x444b('0x6'));var controller=require('./mailAccount.controller');router[_0x444b('0x7')]('/',auth[_0x444b('0x8')](),controller[_0x444b('0x9')]);router[_0x444b('0x7')](_0x444b('0xa'),auth['isAuthenticated'](),controller[_0x444b('0xb')]);router['get'](_0x444b('0xc'),auth[_0x444b('0x8')](),controller['show']);router['get'](_0x444b('0xd'),auth[_0x444b('0x8')](),controller[_0x444b('0xe')]);router[_0x444b('0x7')](_0x444b('0xf'),auth[_0x444b('0x8')](),controller[_0x444b('0x10')]);router[_0x444b('0x7')](_0x444b('0x11'),auth[_0x444b('0x8')](),controller[_0x444b('0x12')]);router[_0x444b('0x7')](_0x444b('0x13'),auth[_0x444b('0x8')](),controller[_0x444b('0x14')]);router[_0x444b('0x7')](_0x444b('0x15'),auth['isAuthenticated'](),controller[_0x444b('0x16')]);router[_0x444b('0x7')]('/:id/applications',auth[_0x444b('0x8')](),controller[_0x444b('0x17')]);router[_0x444b('0x7')](_0x444b('0x18'),auth['isAuthenticated'](),controller[_0x444b('0x19')]);router['get'](_0x444b('0x1a'),auth['isAuthenticated'](),controller[_0x444b('0x1b')]);router[_0x444b('0x7')](_0x444b('0x1c'),auth[_0x444b('0x8')](),controller[_0x444b('0x1d')]);router[_0x444b('0x1e')](_0x444b('0xd'),auth[_0x444b('0x8')](),controller['addDisposition']);router[_0x444b('0x1e')](_0x444b('0xf'),auth[_0x444b('0x8')](),controller['addAnswer']);router[_0x444b('0x1e')]('/',auth['isAuthenticated'](),controller[_0x444b('0x1f')]);router[_0x444b('0x1e')](_0x444b('0x11'),auth[_0x444b('0x8')](),controller['addImap']);router['post'](_0x444b('0x13'),auth[_0x444b('0x8')](),controller[_0x444b('0x20')]);router[_0x444b('0x1e')](_0x444b('0x15'),auth[_0x444b('0x8')](),controller[_0x444b('0x21')]);router[_0x444b('0x1e')](_0x444b('0x22'),auth['isAuthenticated'](),controller[_0x444b('0x23')]);router[_0x444b('0x1e')]('/:id/send',auth[_0x444b('0x8')](),controller[_0x444b('0x24')]);router[_0x444b('0x1e')](_0x444b('0x1c'),auth[_0x444b('0x8')](),controller[_0x444b('0x25')]);router[_0x444b('0x26')](_0x444b('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x444b('0xd'),auth[_0x444b('0x8')](),controller['removeDispositions']);router[_0x444b('0x27')]('/:id/canned_answers',auth[_0x444b('0x8')](),controller['removeAnswers']);router['delete'](_0x444b('0x11'),auth[_0x444b('0x8')](),controller[_0x444b('0x28')]);router['delete'](_0x444b('0x13'),auth[_0x444b('0x8')](),controller['removeSmtp']);router[_0x444b('0x27')](_0x444b('0xc'),auth[_0x444b('0x8')](),controller[_0x444b('0x29')]);router[_0x444b('0x27')]('/:id/users',auth['isAuthenticated'](),controller[_0x444b('0x2a')]);module[_0x444b('0x2b')]=router; \ No newline at end of file +var _0xd902=['get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','/:id/verify','verifySmtp','post','addAnswer','create','addImap','addSmtp','addApplications','/:id/send','send','/:id/users','addAgents','update','removeDispositions','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x293a10,_0x3e8970){var _0x4cda0f=function(_0x1cfbba){while(--_0x1cfbba){_0x293a10['push'](_0x293a10['shift']());}};_0x4cda0f(++_0x3e8970);}(_0xd902,0xe6));var _0x2d90=function(_0x4c9393,_0x20e6de){_0x4c9393=_0x4c9393-0x0;var _0x580eda=_0xd902[_0x4c9393];return _0x580eda;};'use strict';var multer=require(_0x2d90('0x0'));var util=require(_0x2d90('0x1'));var path=require(_0x2d90('0x2'));var timeout=require(_0x2d90('0x3'));var express=require(_0x2d90('0x4'));var router=express[_0x2d90('0x5')]();var fs_extra=require(_0x2d90('0x6'));var auth=require(_0x2d90('0x7'));var interaction=require(_0x2d90('0x8'));var config=require(_0x2d90('0x9'));var controller=require('./mailAccount.controller');router[_0x2d90('0xa')]('/',auth[_0x2d90('0xb')](),controller['index']);router[_0x2d90('0xa')](_0x2d90('0xc'),auth[_0x2d90('0xb')](),controller[_0x2d90('0xd')]);router[_0x2d90('0xa')](_0x2d90('0xe'),auth[_0x2d90('0xb')](),controller[_0x2d90('0xf')]);router[_0x2d90('0xa')](_0x2d90('0x10'),auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0x2d90('0x11'),auth['isAuthenticated'](),controller[_0x2d90('0x12')]);router[_0x2d90('0xa')](_0x2d90('0x13'),auth[_0x2d90('0xb')](),controller[_0x2d90('0x14')]);router[_0x2d90('0xa')](_0x2d90('0x15'),auth[_0x2d90('0xb')](),controller[_0x2d90('0x16')]);router[_0x2d90('0xa')](_0x2d90('0x17'),auth[_0x2d90('0xb')](),controller[_0x2d90('0x18')]);router['get'](_0x2d90('0x19'),auth[_0x2d90('0xb')](),controller['getApplications']);router[_0x2d90('0xa')](_0x2d90('0x1a'),auth['isAuthenticated'](),controller['getMessages']);router[_0x2d90('0xa')](_0x2d90('0x1b'),auth[_0x2d90('0xb')](),controller[_0x2d90('0x1c')]);router[_0x2d90('0xa')]('/:id/users',auth[_0x2d90('0xb')](),controller['getAgents']);router['post'](_0x2d90('0x10'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x2d90('0x1d')](_0x2d90('0x11'),auth['isAuthenticated'](),controller[_0x2d90('0x1e')]);router['post']('/',auth[_0x2d90('0xb')](),controller[_0x2d90('0x1f')]);router[_0x2d90('0x1d')](_0x2d90('0x13'),auth['isAuthenticated'](),controller[_0x2d90('0x20')]);router[_0x2d90('0x1d')]('/:id/out_servers',auth[_0x2d90('0xb')](),controller[_0x2d90('0x21')]);router['post'](_0x2d90('0x17'),auth[_0x2d90('0xb')](),controller['addInteraction']);router[_0x2d90('0x1d')](_0x2d90('0x19'),auth[_0x2d90('0xb')](),controller[_0x2d90('0x22')]);router[_0x2d90('0x1d')](_0x2d90('0x23'),auth[_0x2d90('0xb')](),controller[_0x2d90('0x24')]);router['post'](_0x2d90('0x25'),auth['isAuthenticated'](),controller[_0x2d90('0x26')]);router['put']('/:id',auth[_0x2d90('0xb')](),controller[_0x2d90('0x27')]);router['delete'](_0x2d90('0x10'),auth[_0x2d90('0xb')](),controller[_0x2d90('0x28')]);router[_0x2d90('0x29')](_0x2d90('0x11'),auth[_0x2d90('0xb')](),controller[_0x2d90('0x2a')]);router['delete'](_0x2d90('0x13'),auth[_0x2d90('0xb')](),controller[_0x2d90('0x2b')]);router['delete'](_0x2d90('0x15'),auth[_0x2d90('0xb')](),controller[_0x2d90('0x2c')]);router[_0x2d90('0x29')](_0x2d90('0xe'),auth[_0x2d90('0xb')](),controller[_0x2d90('0x2d')]);router[_0x2d90('0x29')](_0x2d90('0x25'),auth[_0x2d90('0xb')](),controller[_0x2d90('0x2e')]);module[_0x2d90('0x2f')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index a5f4a8a..934bc98 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 _0xb205=['STRING','BOOLEAN','INTEGER','UNSIGNED','TEXT','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports'];(function(_0x284c46,_0x49ac7e){var _0x290328=function(_0x370655){while(--_0x370655){_0x284c46['push'](_0x284c46['shift']());}};_0x290328(++_0x49ac7e);}(_0xb205,0xf0));var _0x5b20=function(_0x5b13f1,_0x8eaf5f){_0x5b13f1=_0x5b13f1-0x0;var _0x10b6bd=_0xb205[_0x5b13f1];return _0x10b6bd;};'use strict';var Sequelize=require(_0x5b20('0x0'));module[_0x5b20('0x1')]={'description':{'type':Sequelize[_0x5b20('0x2')]},'name':{'type':Sequelize[_0x5b20('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x5b20('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x5b20('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x5b20('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x5b20('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x5b20('0x4')](0x2)[_0x5b20('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x5b20('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x5b20('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5b20('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5b20('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5b20('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5b20('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5b20('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0x5b20('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x5b20('0x3')],'defaultValue':![],'comment':_0x5b20('0x8'),'set':function(_0x5ebb0d){if(!_0x5ebb0d)this[_0x5b20('0x9')](_0x5b20('0xa'),null);this[_0x5b20('0x9')]('mandatoryDisposition',_0x5ebb0d);}}}; \ No newline at end of file +var _0xee14=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','STRING','BOOLEAN','TEXT','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee14,0x13a));var _0x4ee1=function(_0x44ccfc,_0xbee275){_0x44ccfc=_0x44ccfc-0x0;var _0x47ff21=_0xee14[_0x44ccfc];return _0x47ff21;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x4ee1('0x0')]},'name':{'type':Sequelize[_0x4ee1('0x0')],'allowNull':![]},'service':{'type':Sequelize[_0x4ee1('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0x4ee1('0x0')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x4ee1('0x1')],'defaultValue':!![]},'key':{'type':Sequelize[_0x4ee1('0x0')],'allowNull':![]},'template':{'type':Sequelize[_0x4ee1('0x2')]},'markAsUnread':{'type':Sequelize[_0x4ee1('0x1')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x4ee1('0x0')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x4ee1('0x3')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x4ee1('0x2')],'defaultValue':function(){return _0x4ee1('0x4');}},'notificationSound':{'type':Sequelize[_0x4ee1('0x1')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4ee1('0x1')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4ee1('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4ee1('0x1')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4ee1('0x1')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4ee1('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x4ee1('0x5')},'mandatoryDisposition':{'type':Sequelize[_0x4ee1('0x1')],'defaultValue':![],'comment':_0x4ee1('0x6'),'set':function(_0x191da7){if(!_0x191da7)this['setDataValue'](_0x4ee1('0x7'),null);this[_0x4ee1('0x8')](_0x4ee1('0x9'),_0x191da7);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index e1ebe5d..941f444 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 _0x1bfa=['client','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','undefined','count','offset','set','Content-Range','apply','save','then','get','MailAccounts','destroy','send','index','MailServerIn','Imap','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','type','key','model','name','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','where','filter','merge','options','includeAll','include','rows','params','MailServerOut','keys','rawAttributes','find','update','body','describe','addDisposition','MailAccountId','getDispositions','Disposition','findAll','removeDispositions','ids','addAnswer','CannedAnswer','create','findOne','removeAnswers','email','isNil','active','description','cservice','user','cuser','password','cpassword','authentication','host','port','service','UserProfileSection','autoAssociation','UserProfileResource','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','Owner','internal','Tags','tag','sequelize','transaction','bulkCreate','MailApplication','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','true','CmList','List','updatedAt','DESC','from','attachments','join','root','server/files/attachments','pass','secure','auth','SendMail','Contacts','ListId','messageId','subject','attach','Interaction','Messages','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','eml-format','request-promise','moment','mustache','util','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','juice','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x34be3e,_0x3263cb){var _0x1b8c56=function(_0x307e1f){while(--_0x307e1f){_0x34be3e['push'](_0x34be3e['shift']());}};_0x1b8c56(++_0x3263cb);}(_0x1bfa,0x9f));var _0xa1bf=function(_0x4099ee,_0x38495a){_0x4099ee=_0x4099ee-0x0;var _0x1b7bfc=_0x1bfa[_0x4099ee];return _0x1b7bfc;};'use strict';var emlformat=require(_0xa1bf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa1bf('0x1'));var moment=require(_0xa1bf('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xa1bf('0x3'));var util=require(_0xa1bf('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xa1bf('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa1bf('0x6'));var _=require(_0xa1bf('0x7'));var squel=require(_0xa1bf('0x8'));var crypto=require('crypto');var jsforce=require(_0xa1bf('0x9'));var deskjs=require(_0xa1bf('0xa'));var toCsv=require(_0xa1bf('0x5'));var querystring=require(_0xa1bf('0xb'));var Papa=require(_0xa1bf('0xc'));var htmlToText=require('html-to-text');var juice=require(_0xa1bf('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa1bf('0xe'));var as=require(_0xa1bf('0xf'));var hardwareService=require(_0xa1bf('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xa1bf('0x11'));var config=require(_0xa1bf('0x12'));var licenseUtil=require(_0xa1bf('0x13'));var db=require(_0xa1bf('0x14'))['db'];config[_0xa1bf('0x15')]=_[_0xa1bf('0x16')](config[_0xa1bf('0x15')],{'host':_0xa1bf('0x17'),'port':0x18eb});var socket=require(_0xa1bf('0x18'))(new Redis(config[_0xa1bf('0x15')]));require('./mailAccount.socket')[_0xa1bf('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa1bf('0x1a')]['http']({'port':0x232b});function respondWithRpcPromise(_0x5d0d17,_0x8ed9e6,_0x2a6a7e,_0x776bfe){return new BPromise(function(_0x46f7ed,_0x3cdef3){var _0x3e9963=_0x776bfe||client;return _0x3e9963[_0xa1bf('0x1b')](_0x5d0d17,_0x2a6a7e)['then'](function(_0x125bcd){logger[_0xa1bf('0x1c')](_0xa1bf('0x1d'),_0x8ed9e6,_0xa1bf('0x1e'));logger[_0xa1bf('0x1f')](_0xa1bf('0x20'),_0x8ed9e6,_0xa1bf('0x1e'),JSON[_0xa1bf('0x21')](_0x125bcd));if(_0x125bcd['error']){if(_0x125bcd[_0xa1bf('0x22')][_0xa1bf('0x23')]===0x1f4){logger[_0xa1bf('0x22')](_0xa1bf('0x1d'),_0x8ed9e6,_0x125bcd[_0xa1bf('0x22')][_0xa1bf('0x24')]);return _0x3cdef3(_0x125bcd[_0xa1bf('0x22')][_0xa1bf('0x24')]);}logger[_0xa1bf('0x22')](_0xa1bf('0x1d'),_0x8ed9e6,_0x125bcd[_0xa1bf('0x22')][_0xa1bf('0x24')]);return _0x46f7ed(_0x125bcd['error'][_0xa1bf('0x24')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x8ed9e6,_0xa1bf('0x1e'));_0x46f7ed(_0x125bcd[_0xa1bf('0x25')][_0xa1bf('0x24')]);}})[_0xa1bf('0x26')](function(_0x3e5926){logger[_0xa1bf('0x22')](_0xa1bf('0x1d'),_0x8ed9e6,_0x3e5926);_0x3cdef3(_0x3e5926);});});}function respondWithStatusCode(_0x1ef775,_0x2f612a){_0x2f612a=_0x2f612a||0xcc;return function(_0x504e6e){if(_0x504e6e){return _0x1ef775['sendStatus'](_0x2f612a);}return _0x1ef775['status'](_0x2f612a)[_0xa1bf('0x27')]();};}function respondWithResult(_0x5bd770,_0x817512){_0x817512=_0x817512||0xc8;return function(_0x2b4111){if(_0x2b4111){return _0x5bd770[_0xa1bf('0x28')](_0x817512)[_0xa1bf('0x29')](_0x2b4111);}};}function respondWithFilteredResult(_0x206aa0,_0x9dcbdb){return function(_0x672fb3){if(_0x672fb3){var _0x5f33a4=typeof _0x9dcbdb['offset']===_0xa1bf('0x2a')&&typeof _0x9dcbdb['limit']===_0xa1bf('0x2a');var _0x32c8d4=_0x672fb3[_0xa1bf('0x2b')];var _0x6363bb=_0x5f33a4?0x0:_0x9dcbdb[_0xa1bf('0x2c')];var _0x1764da=_0x5f33a4?_0x672fb3[_0xa1bf('0x2b')]:_0x9dcbdb[_0xa1bf('0x2c')]+_0x9dcbdb['limit'];var _0x2cae6f;if(_0x1764da>=_0x32c8d4){_0x1764da=_0x32c8d4;_0x2cae6f=0xc8;}else{_0x2cae6f=0xce;}_0x206aa0[_0xa1bf('0x28')](_0x2cae6f);return _0x206aa0[_0xa1bf('0x2d')](_0xa1bf('0x2e'),_0x6363bb+'-'+_0x1764da+'/'+_0x32c8d4)[_0xa1bf('0x29')](_0x672fb3);}return null;};}function patchUpdates(_0x469d83){return function(_0x1189ed){try{jsonpatch[_0xa1bf('0x2f')](_0x1189ed,_0x469d83,!![]);}catch(_0x38b193){return BPromise['reject'](_0x38b193);}return _0x1189ed[_0xa1bf('0x30')]();};}function saveUpdates(_0x3eaa74,_0x2a6883){return function(_0x446d89){if(_0x446d89){return _0x446d89['update'](_0x3eaa74)['then'](function(_0x3a6adf){return _0x3a6adf;});}return null;};}function removeEntity(_0x510f33,_0x39fa0a){return function(_0x43ae1c){if(_0x43ae1c){return _0x43ae1c['destroy']()[_0xa1bf('0x31')](function(){var _0x5cfd0e=_0x43ae1c[_0xa1bf('0x32')]({'plain':!![]});var _0x12e3c7=_0xa1bf('0x33');return db['UserProfileResource'][_0xa1bf('0x34')]({'where':{'type':_0x12e3c7,'resourceId':_0x5cfd0e['id']}})['then'](function(){return _0x43ae1c;});})[_0xa1bf('0x31')](function(){_0x510f33[_0xa1bf('0x28')](0xcc)[_0xa1bf('0x27')]();});}};}function handleEntityNotFound(_0x32938d,_0x26026b){return function(_0x296ac7){if(!_0x296ac7){_0x32938d['sendStatus'](0x194);}return _0x296ac7;};}function handleError(_0x3df0dc,_0x54adaf){_0x54adaf=_0x54adaf||0x1f4;return function(_0x160297){logger[_0xa1bf('0x22')](_0x160297['stack']);if(_0x160297['name']){delete _0x160297['name'];}_0x3df0dc[_0xa1bf('0x28')](_0x54adaf)[_0xa1bf('0x35')](_0x160297);};}exports[_0xa1bf('0x36')]=function(_0x1fa60f,_0x45af6f){var _0x4d6b77={'include':[{'model':db[_0xa1bf('0x37')],'as':_0xa1bf('0x38')},{'model':db['MailServerOut'],'as':_0xa1bf('0x39')},{'model':db[_0xa1bf('0x3a')],'as':_0xa1bf('0x3b')}]},_0x2b6136={},_0x36e2d5={'count':0x0,'rows':[]};var _0x2f80a6=_[_0xa1bf('0x3c')](db[_0xa1bf('0x3d')]['rawAttributes'],function(_0x8b0016){return{'name':_0x8b0016[_0xa1bf('0x3e')],'type':_0x8b0016[_0xa1bf('0x3f')][_0xa1bf('0x40')]};});_0x2b6136[_0xa1bf('0x41')]=_[_0xa1bf('0x3c')](_0x2f80a6,_0xa1bf('0x42'));_0x2b6136[_0xa1bf('0x43')]=_['keys'](_0x1fa60f[_0xa1bf('0x43')]);_0x2b6136['filters']=_[_0xa1bf('0x44')](_0x2b6136[_0xa1bf('0x41')],_0x2b6136[_0xa1bf('0x43')]);_0x4d6b77['attributes']=_['intersection'](_0x2b6136[_0xa1bf('0x41')],qs[_0xa1bf('0x45')](_0x1fa60f[_0xa1bf('0x43')]['fields']));_0x4d6b77['attributes']=_0x4d6b77[_0xa1bf('0x46')][_0xa1bf('0x47')]?_0x4d6b77[_0xa1bf('0x46')]:_0x2b6136[_0xa1bf('0x41')];if(!_0x1fa60f[_0xa1bf('0x43')][_0xa1bf('0x48')](_0xa1bf('0x49'))){_0x4d6b77['limit']=qs[_0xa1bf('0x4a')](_0x1fa60f[_0xa1bf('0x43')][_0xa1bf('0x4a')]);_0x4d6b77['offset']=qs[_0xa1bf('0x2c')](_0x1fa60f[_0xa1bf('0x43')]['offset']);}_0x4d6b77[_0xa1bf('0x4b')]=qs[_0xa1bf('0x4c')](_0x1fa60f[_0xa1bf('0x43')][_0xa1bf('0x4c')]);_0x4d6b77['where']=qs[_0xa1bf('0x4d')](_[_0xa1bf('0x4e')](_0x1fa60f[_0xa1bf('0x43')],_0x2b6136[_0xa1bf('0x4d')]),_0x2f80a6);if(_0x1fa60f['query']['filter']){_0x4d6b77[_0xa1bf('0x4f')]=_['merge'](_0x4d6b77[_0xa1bf('0x4f')],{'$or':_[_0xa1bf('0x3c')](_0x2f80a6,function(_0x14ad64){if(_0x14ad64[_0xa1bf('0x3f')]!=='VIRTUAL'){var _0x28471d={};_0x28471d[_0x14ad64[_0xa1bf('0x42')]]={'$like':'%'+_0x1fa60f[_0xa1bf('0x43')][_0xa1bf('0x50')]+'%'};return _0x28471d;}})});}_0x4d6b77=_[_0xa1bf('0x51')]({},_0x4d6b77,_0x1fa60f[_0xa1bf('0x52')]);var _0x459246={'where':_0x4d6b77[_0xa1bf('0x4f')]};return db['MailAccount']['count'](_0x459246)[_0xa1bf('0x31')](function(_0x474fae){_0x36e2d5[_0xa1bf('0x2b')]=_0x474fae;if(_0x1fa60f[_0xa1bf('0x43')][_0xa1bf('0x53')]){_0x4d6b77[_0xa1bf('0x54')]=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x4d6b77);})[_0xa1bf('0x31')](function(_0x4973b1){_0x36e2d5[_0xa1bf('0x55')]=_0x4973b1;return _0x36e2d5;})['then'](respondWithFilteredResult(_0x45af6f,_0x4d6b77))[_0xa1bf('0x26')](handleError(_0x45af6f,null));};exports['show']=function(_0x5be69d,_0xa17cd2){var _0x1c5537={'raw':![],'where':{'id':_0x5be69d[_0xa1bf('0x56')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xa1bf('0x38')},{'model':db[_0xa1bf('0x57')],'as':_0xa1bf('0x39')},{'model':db[_0xa1bf('0x3a')],'as':_0xa1bf('0x3b')}]},_0x5462b2={};_0x5462b2[_0xa1bf('0x41')]=_[_0xa1bf('0x58')](db[_0xa1bf('0x3d')][_0xa1bf('0x59')]);_0x5462b2[_0xa1bf('0x43')]=_[_0xa1bf('0x58')](_0x5be69d[_0xa1bf('0x43')]);_0x5462b2[_0xa1bf('0x4d')]=_[_0xa1bf('0x44')](_0x5462b2['model'],_0x5462b2[_0xa1bf('0x43')]);_0x1c5537[_0xa1bf('0x46')]=_[_0xa1bf('0x44')](_0x5462b2[_0xa1bf('0x41')],qs[_0xa1bf('0x45')](_0x5be69d['query'][_0xa1bf('0x45')]));_0x1c5537['attributes']=_0x1c5537[_0xa1bf('0x46')][_0xa1bf('0x47')]?_0x1c5537['attributes']:_0x5462b2[_0xa1bf('0x41')];if(_0x5be69d[_0xa1bf('0x43')]['includeAll']){_0x1c5537[_0xa1bf('0x54')]=[{'all':!![]}];}_0x1c5537=_[_0xa1bf('0x51')]({},_0x1c5537,_0x5be69d[_0xa1bf('0x52')]);return db[_0xa1bf('0x3d')][_0xa1bf('0x5a')](_0x1c5537)[_0xa1bf('0x31')](handleEntityNotFound(_0xa17cd2,null))['then'](respondWithResult(_0xa17cd2,null))[_0xa1bf('0x26')](handleError(_0xa17cd2,null));};exports[_0xa1bf('0x5b')]=function(_0x55dc2f,_0x386f9b){if(_0x55dc2f[_0xa1bf('0x5c')]['id']){delete _0x55dc2f['body']['id'];}return db[_0xa1bf('0x3d')][_0xa1bf('0x5a')]({'where':{'id':_0x55dc2f['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0xa1bf('0x38')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db['Pause'],'as':_0xa1bf('0x3b')}]})[_0xa1bf('0x31')](handleEntityNotFound(_0x386f9b,null))['then'](saveUpdates(_0x55dc2f[_0xa1bf('0x5c')],null))[_0xa1bf('0x31')](function(_0x3ac045){if(_0x3ac045&&_0x55dc2f[_0xa1bf('0x5c')][_0xa1bf('0x38')]){return db[_0xa1bf('0x37')][_0xa1bf('0x5b')](_0x55dc2f['body'][_0xa1bf('0x38')],{'where':{'MailAccountId':_0x3ac045['id']}})[_0xa1bf('0x31')](function(){return _0x3ac045;});}return _0x3ac045;})['then'](function(_0x229a88){if(_0x229a88&&_0x55dc2f[_0xa1bf('0x5c')][_0xa1bf('0x39')]){return db[_0xa1bf('0x57')][_0xa1bf('0x5b')](_0x55dc2f[_0xa1bf('0x5c')][_0xa1bf('0x39')],{'where':{'MailAccountId':_0x229a88['id']}})[_0xa1bf('0x31')](function(){return _0x229a88;});}return _0x229a88;})[_0xa1bf('0x31')](respondWithResult(_0x386f9b,null))[_0xa1bf('0x26')](handleError(_0x386f9b,null));};exports['describe']=function(_0x3b5fa9,_0x1b07d0){return db[_0xa1bf('0x3d')][_0xa1bf('0x5d')]()['then'](respondWithResult(_0x1b07d0,null))[_0xa1bf('0x26')](handleError(_0x1b07d0,null));};exports[_0xa1bf('0x5e')]=function(_0x469289,_0x83877e,_0x3ae66c){if(_0x469289[_0xa1bf('0x5c')]['id']){delete _0x469289[_0xa1bf('0x5c')]['id'];}return db[_0xa1bf('0x3d')]['find']({'where':{'id':_0x469289['params']['id']}})['then'](handleEntityNotFound(_0x83877e,null))[_0xa1bf('0x31')](function(_0x440647){if(_0x440647){_0x469289[_0xa1bf('0x5c')][_0xa1bf('0x5f')]=_0x440647['id'];return db['Disposition']['create'](_0x469289[_0xa1bf('0x5c')]);}})[_0xa1bf('0x31')](respondWithResult(_0x83877e,null))[_0xa1bf('0x26')](handleError(_0x83877e,null));};exports[_0xa1bf('0x60')]=function(_0x26589b,_0x304697,_0x4e751a){var _0x4c186f={'raw':![],'where':{}};var _0x3e504a={};var _0x39c632={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x26589b[_0xa1bf('0x56')]['id']}})[_0xa1bf('0x31')](handleEntityNotFound(_0x304697,null))[_0xa1bf('0x31')](function(_0x26a222){if(_0x26a222){_0x3e504a[_0xa1bf('0x41')]=_[_0xa1bf('0x58')](db[_0xa1bf('0x61')][_0xa1bf('0x59')]);_0x3e504a[_0xa1bf('0x43')]=_[_0xa1bf('0x58')](_0x26589b[_0xa1bf('0x43')]);_0x3e504a[_0xa1bf('0x4d')]=_[_0xa1bf('0x44')](_0x3e504a[_0xa1bf('0x41')],_0x3e504a[_0xa1bf('0x43')]);_0x4c186f[_0xa1bf('0x46')]=_[_0xa1bf('0x44')](_0x3e504a[_0xa1bf('0x41')],qs[_0xa1bf('0x45')](_0x26589b['query'][_0xa1bf('0x45')]));_0x4c186f[_0xa1bf('0x46')]=_0x4c186f[_0xa1bf('0x46')][_0xa1bf('0x47')]?_0x4c186f['attributes']:_0x3e504a['model'];if(!_0x26589b[_0xa1bf('0x43')]['hasOwnProperty']('nolimit')){_0x4c186f[_0xa1bf('0x4a')]=qs[_0xa1bf('0x4a')](_0x26589b[_0xa1bf('0x43')][_0xa1bf('0x4a')]);_0x4c186f[_0xa1bf('0x2c')]=qs[_0xa1bf('0x2c')](_0x26589b[_0xa1bf('0x43')][_0xa1bf('0x2c')]);}_0x4c186f[_0xa1bf('0x4b')]=qs[_0xa1bf('0x4c')](_0x26589b[_0xa1bf('0x43')][_0xa1bf('0x4c')]);_0x4c186f['where']=qs['filters'](_[_0xa1bf('0x4e')](_0x26589b[_0xa1bf('0x43')],_0x3e504a['filters']));_0x4c186f[_0xa1bf('0x4f')]['MailAccountId']=_0x26a222['id'];if(_0x26589b[_0xa1bf('0x43')][_0xa1bf('0x50')]){_0x4c186f['where']=_['merge'](_0x4c186f[_0xa1bf('0x4f')],{'$or':_['map'](_0x4c186f[_0xa1bf('0x46')],function(_0x2a452c){var _0x4b2b0b={};_0x4b2b0b[_0x2a452c]={'$like':'%'+_0x26589b['query'][_0xa1bf('0x50')]+'%'};return _0x4b2b0b;})});}_0x4c186f=_[_0xa1bf('0x51')]({},_0x4c186f,_0x26589b['options']);return db[_0xa1bf('0x61')][_0xa1bf('0x2b')]({'where':_0x4c186f[_0xa1bf('0x4f')]})[_0xa1bf('0x31')](function(_0x58bff4){_0x39c632[_0xa1bf('0x2b')]=_0x58bff4;if(_0x26589b[_0xa1bf('0x43')][_0xa1bf('0x53')]){_0x4c186f[_0xa1bf('0x54')]=[{'all':!![]}];}return db[_0xa1bf('0x61')][_0xa1bf('0x62')](_0x4c186f);})[_0xa1bf('0x31')](function(_0x56c0ad){_0x39c632[_0xa1bf('0x55')]=_0x56c0ad;return _0x39c632;});}})[_0xa1bf('0x31')](respondWithFilteredResult(_0x304697,_0x4c186f))['catch'](handleError(_0x304697,null));};exports[_0xa1bf('0x63')]=function(_0x46a956,_0x23f235,_0x2712d6){return db[_0xa1bf('0x3d')][_0xa1bf('0x5a')]({'where':{'id':_0x46a956[_0xa1bf('0x56')]['id']}})[_0xa1bf('0x31')](handleEntityNotFound(_0x23f235,null))[_0xa1bf('0x31')](function(_0x256c72){if(_0x256c72){return _0x256c72[_0xa1bf('0x63')](_0x46a956[_0xa1bf('0x43')][_0xa1bf('0x64')]);}})[_0xa1bf('0x31')](respondWithStatusCode(_0x23f235,null))[_0xa1bf('0x26')](handleError(_0x23f235,null));};exports[_0xa1bf('0x65')]=function(_0x555021,_0x4cd32d,_0xdafa7b){if(_0x555021[_0xa1bf('0x5c')]['id']){delete _0x555021[_0xa1bf('0x5c')]['id'];}return db['MailAccount'][_0xa1bf('0x5a')]({'where':{'id':_0x555021[_0xa1bf('0x56')]['id']}})[_0xa1bf('0x31')](handleEntityNotFound(_0x4cd32d,null))[_0xa1bf('0x31')](function(_0x59daa0){if(_0x59daa0){_0x555021[_0xa1bf('0x5c')][_0xa1bf('0x5f')]=_0x59daa0['id'];return db[_0xa1bf('0x66')][_0xa1bf('0x67')](_0x555021[_0xa1bf('0x5c')]);}})['then'](respondWithResult(_0x4cd32d,null))['catch'](handleError(_0x4cd32d,null));};exports['getAnswers']=function(_0x4c2daf,_0x2e9975,_0x2918d7){var _0x5916ab={'raw':![],'where':{}};var _0x25880a={};var _0xbfe0f0={'count':0x0,'rows':[]};return db[_0xa1bf('0x3d')][_0xa1bf('0x68')]({'where':{'id':_0x4c2daf[_0xa1bf('0x56')]['id']}})[_0xa1bf('0x31')](handleEntityNotFound(_0x2e9975,null))[_0xa1bf('0x31')](function(_0xbfbff1){if(_0xbfbff1){_0x25880a['model']=_['keys'](db['CannedAnswer'][_0xa1bf('0x59')]);_0x25880a[_0xa1bf('0x43')]=_[_0xa1bf('0x58')](_0x4c2daf['query']);_0x25880a[_0xa1bf('0x4d')]=_[_0xa1bf('0x44')](_0x25880a[_0xa1bf('0x41')],_0x25880a[_0xa1bf('0x43')]);_0x5916ab[_0xa1bf('0x46')]=_[_0xa1bf('0x44')](_0x25880a[_0xa1bf('0x41')],qs[_0xa1bf('0x45')](_0x4c2daf[_0xa1bf('0x43')][_0xa1bf('0x45')]));_0x5916ab[_0xa1bf('0x46')]=_0x5916ab[_0xa1bf('0x46')][_0xa1bf('0x47')]?_0x5916ab[_0xa1bf('0x46')]:_0x25880a['model'];if(!_0x4c2daf[_0xa1bf('0x43')][_0xa1bf('0x48')]('nolimit')){_0x5916ab['limit']=qs['limit'](_0x4c2daf[_0xa1bf('0x43')]['limit']);_0x5916ab[_0xa1bf('0x2c')]=qs['offset'](_0x4c2daf[_0xa1bf('0x43')]['offset']);}_0x5916ab['order']=qs['sort'](_0x4c2daf[_0xa1bf('0x43')][_0xa1bf('0x4c')]);_0x5916ab[_0xa1bf('0x4f')]=qs[_0xa1bf('0x4d')](_[_0xa1bf('0x4e')](_0x4c2daf[_0xa1bf('0x43')],_0x25880a[_0xa1bf('0x4d')]));_0x5916ab[_0xa1bf('0x4f')][_0xa1bf('0x5f')]=_0xbfbff1['id'];if(_0x4c2daf['query'][_0xa1bf('0x50')]){_0x5916ab[_0xa1bf('0x4f')]=_['merge'](_0x5916ab[_0xa1bf('0x4f')],{'$or':_[_0xa1bf('0x3c')](_0x5916ab['attributes'],function(_0x1bcb25){var _0x286052={};_0x286052[_0x1bcb25]={'$like':'%'+_0x4c2daf['query']['filter']+'%'};return _0x286052;})});}_0x5916ab=_['merge']({},_0x5916ab,_0x4c2daf[_0xa1bf('0x52')]);return db[_0xa1bf('0x66')]['count']({'where':_0x5916ab['where']})[_0xa1bf('0x31')](function(_0x22f1f2){_0xbfe0f0[_0xa1bf('0x2b')]=_0x22f1f2;if(_0x4c2daf[_0xa1bf('0x43')]['includeAll']){_0x5916ab[_0xa1bf('0x54')]=[{'all':!![]}];}return db[_0xa1bf('0x66')][_0xa1bf('0x62')](_0x5916ab);})[_0xa1bf('0x31')](function(_0x3467d0){_0xbfe0f0[_0xa1bf('0x55')]=_0x3467d0;return _0xbfe0f0;});}})[_0xa1bf('0x31')](respondWithFilteredResult(_0x2e9975,_0x5916ab))['catch'](handleError(_0x2e9975,null));};exports[_0xa1bf('0x69')]=function(_0x6036bd,_0x2c18a3,_0x4a29f2){return db[_0xa1bf('0x3d')][_0xa1bf('0x5a')]({'where':{'id':_0x6036bd[_0xa1bf('0x56')]['id']}})['then'](handleEntityNotFound(_0x2c18a3,null))['then'](function(_0x16ba50){if(_0x16ba50){return _0x16ba50[_0xa1bf('0x69')](_0x6036bd['query'][_0xa1bf('0x64')]);}})[_0xa1bf('0x31')](respondWithStatusCode(_0x2c18a3,null))[_0xa1bf('0x26')](handleError(_0x2c18a3,null));};exports['create']=function(_0x520c6c,_0x688358){var _0x47054a={'name':_0x520c6c[_0xa1bf('0x5c')][_0xa1bf('0x42')],'key':_0x520c6c['body'][_0xa1bf('0x40')],'email':_0x520c6c[_0xa1bf('0x5c')][_0xa1bf('0x6a')],'ListId':_0x520c6c[_0xa1bf('0x5c')]['ListId'],'active':!_[_0xa1bf('0x6b')](_0x520c6c['body'][_0xa1bf('0x6c')])?_0x520c6c[_0xa1bf('0x5c')][_0xa1bf('0x6c')]:!![],'description':_0x520c6c['body'][_0xa1bf('0x6d')]||null,'Imap':{},'Smtp':{}};if(_[_0xa1bf('0x6b')](_0x520c6c[_0xa1bf('0x5c')][_0xa1bf('0x6e')])){if(_0x520c6c['body']['cauthentication']){_0x47054a[_0xa1bf('0x38')][_0xa1bf('0x6f')]=_0x47054a['Smtp'][_0xa1bf('0x6f')]=_0x520c6c[_0xa1bf('0x5c')][_0xa1bf('0x70')];_0x47054a['Imap'][_0xa1bf('0x71')]=_0x47054a['Smtp']['pass']=_0x520c6c['body'][_0xa1bf('0x72')];}else{_0x47054a[_0xa1bf('0x38')][_0xa1bf('0x73')]=_0x47054a[_0xa1bf('0x39')][_0xa1bf('0x73')]=![];}_0x47054a[_0xa1bf('0x38')]['host']=_0x520c6c[_0xa1bf('0x5c')][_0xa1bf('0x38')][_0xa1bf('0x74')];_0x47054a[_0xa1bf('0x38')]['port']=_0x520c6c[_0xa1bf('0x5c')][_0xa1bf('0x38')]['port'];_0x47054a[_0xa1bf('0x39')][_0xa1bf('0x74')]=_0x520c6c[_0xa1bf('0x5c')][_0xa1bf('0x39')][_0xa1bf('0x74')];_0x47054a['Smtp']['port']=_0x520c6c[_0xa1bf('0x5c')][_0xa1bf('0x39')][_0xa1bf('0x75')];}else{_0x47054a[_0xa1bf('0x38')]['service']=_0x47054a[_0xa1bf('0x39')][_0xa1bf('0x76')]=_0x520c6c[_0xa1bf('0x5c')]['cservice'];_0x47054a[_0xa1bf('0x38')]['user']=_0x47054a[_0xa1bf('0x39')]['user']=_0x520c6c[_0xa1bf('0x5c')][_0xa1bf('0x70')];_0x47054a[_0xa1bf('0x38')][_0xa1bf('0x71')]=_0x47054a[_0xa1bf('0x39')]['pass']=_0x520c6c[_0xa1bf('0x5c')]['cpassword'];}return db[_0xa1bf('0x3d')]['create'](_0x47054a,{'include':[{'model':db[_0xa1bf('0x57')],'as':'Smtp'},{'model':db[_0xa1bf('0x37')],'as':_0xa1bf('0x38')}]})[_0xa1bf('0x31')](function(_0x377c22){var _0x1ea755=_0x520c6c[_0xa1bf('0x6f')][_0xa1bf('0x32')]({'plain':!![]});if(!_0x1ea755)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ea755['role']===_0xa1bf('0x6f')){var _0x57a117=_0x377c22['get']({'plain':!![]});return db[_0xa1bf('0x77')][_0xa1bf('0x5a')]({'where':{'name':_0xa1bf('0x33'),'userProfileId':_0x1ea755['userProfileId']},'raw':!![]})['then'](function(_0x1f6b8f){if(_0x1f6b8f&&_0x1f6b8f[_0xa1bf('0x78')]===0x0){return db[_0xa1bf('0x79')][_0xa1bf('0x67')]({'name':_0x57a117['name'],'resourceId':_0x57a117['id'],'type':_0x1f6b8f[_0xa1bf('0x42')],'sectionId':_0x1f6b8f['id']},{})['then'](function(){return _0x377c22;});}else{return _0x377c22;}})[_0xa1bf('0x26')](function(_0x46f3c4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x46f3c4);throw _0x46f3c4;});}return _0x377c22;})[_0xa1bf('0x31')](respondWithResult(_0x688358,0xc9))[_0xa1bf('0x26')](handleError(_0x688358,null));};exports[_0xa1bf('0x7a')]=function(_0x2135bc,_0x464dc6,_0x135195){return db[_0xa1bf('0x3d')]['findOne']({'where':{'id':_0x2135bc['params']['id']}})[_0xa1bf('0x31')](handleEntityNotFound(_0x464dc6,null))[_0xa1bf('0x31')](function(_0x409013){if(_0x409013){return _0x409013[_0xa1bf('0x7a')]();}return null;})[_0xa1bf('0x31')](respondWithResult(_0x464dc6,null))['catch'](handleError(_0x464dc6,null));};exports[_0xa1bf('0x7b')]=function(_0x39dc38,_0x19cc4c,_0x2834a){if(_0x39dc38[_0xa1bf('0x5c')]['id']){delete _0x39dc38[_0xa1bf('0x5c')]['id'];}return db[_0xa1bf('0x3d')]['find']({'where':{'id':_0x39dc38[_0xa1bf('0x56')]['id']}})['then'](handleEntityNotFound(_0x19cc4c,null))[_0xa1bf('0x31')](function(_0x34f733){if(_0x34f733){_0x39dc38[_0xa1bf('0x5c')]['MailAccountId']=_0x34f733['id'];return db['MailServerIn']['create'](_0x39dc38['body']);}})['then'](respondWithResult(_0x19cc4c,null))[_0xa1bf('0x26')](handleError(_0x19cc4c,null));};exports[_0xa1bf('0x7c')]=function(_0x157af9,_0x1f553d,_0xbd15c0){return db['MailAccount'][_0xa1bf('0x68')]({'where':{'id':_0x157af9[_0xa1bf('0x56')]['id']}})[_0xa1bf('0x31')](handleEntityNotFound(_0x1f553d,null))['then'](function(_0x4773de){if(_0x4773de){return _0x4773de[_0xa1bf('0x7d')](null);}return null;})['then'](respondWithStatusCode(_0x1f553d,null))['catch'](handleError(_0x1f553d,null));};exports[_0xa1bf('0x7e')]=function(_0x31a09e,_0x2bc58f,_0x1e0c05){return db['MailAccount']['findOne']({'where':{'id':_0x31a09e[_0xa1bf('0x56')]['id']}})[_0xa1bf('0x31')](handleEntityNotFound(_0x2bc58f,null))['then'](function(_0x2813cb){if(_0x2813cb){return _0x2813cb[_0xa1bf('0x7e')]();}return null;})[_0xa1bf('0x31')](respondWithResult(_0x2bc58f,null))['catch'](handleError(_0x2bc58f,null));};exports[_0xa1bf('0x7f')]=function(_0x164c12,_0x328f0e,_0x301b4f){if(_0x164c12['body']['id']){delete _0x164c12[_0xa1bf('0x5c')]['id'];}return db[_0xa1bf('0x3d')][_0xa1bf('0x5a')]({'where':{'id':_0x164c12[_0xa1bf('0x56')]['id']}})['then'](handleEntityNotFound(_0x328f0e,null))['then'](function(_0x5094d8){if(_0x5094d8){_0x164c12[_0xa1bf('0x5c')][_0xa1bf('0x5f')]=_0x5094d8['id'];return db['MailServerOut'][_0xa1bf('0x67')](_0x164c12[_0xa1bf('0x5c')]);}})[_0xa1bf('0x31')](respondWithResult(_0x328f0e,null))[_0xa1bf('0x26')](handleError(_0x328f0e,null));};exports[_0xa1bf('0x80')]=function(_0x41604c,_0x434546,_0x3137e1){return db[_0xa1bf('0x3d')]['findOne']({'where':{'id':_0x41604c[_0xa1bf('0x56')]['id']}})[_0xa1bf('0x31')](handleEntityNotFound(_0x434546,null))[_0xa1bf('0x31')](function(_0x2c6231){if(_0x2c6231){return _0x2c6231[_0xa1bf('0x81')](null);}return null;})[_0xa1bf('0x31')](respondWithStatusCode(_0x434546,null))['catch'](handleError(_0x434546,null));};exports[_0xa1bf('0x82')]=function(_0x2cb352,_0x13e990,_0x17335b){return db[_0xa1bf('0x83')][_0xa1bf('0x5a')]({'where':{'id':_0x2cb352[_0xa1bf('0x56')]['id']}})[_0xa1bf('0x31')](handleEntityNotFound(_0x13e990,null))['then'](function(_0x1fa5df){if(_0x1fa5df){return _0x1fa5df[_0xa1bf('0x82')](_0x2cb352[_0xa1bf('0x5c')][_0xa1bf('0x64')],_[_0xa1bf('0x84')](_0x2cb352['body'],[_0xa1bf('0x64'),'id'])||{});}})[_0xa1bf('0x31')](respondWithResult(_0x13e990,null))[_0xa1bf('0x26')](handleError(_0x13e990,null));};exports[_0xa1bf('0x85')]=function(_0x4999ce,_0x1b8752,_0x4132de){var _0x441e9e={'raw':![],'where':{}};var _0x3965ae={};var _0x168119={'count':0x0,'rows':[]};return db[_0xa1bf('0x3d')][_0xa1bf('0x68')]({'where':{'id':_0x4999ce[_0xa1bf('0x56')]['id']}})['then'](handleEntityNotFound(_0x1b8752,null))['then'](function(_0x2ad8d1){if(_0x2ad8d1){_0x3965ae['model']=_['keys'](db[_0xa1bf('0x83')][_0xa1bf('0x59')]);_0x3965ae[_0xa1bf('0x43')]=_['keys'](_0x4999ce[_0xa1bf('0x43')]);_0x3965ae[_0xa1bf('0x4d')]=_[_0xa1bf('0x44')](_0x3965ae[_0xa1bf('0x41')],_0x3965ae[_0xa1bf('0x43')]);_0x441e9e[_0xa1bf('0x46')]=_[_0xa1bf('0x44')](_0x3965ae[_0xa1bf('0x41')],qs[_0xa1bf('0x45')](_0x4999ce[_0xa1bf('0x43')][_0xa1bf('0x45')]));_0x441e9e[_0xa1bf('0x46')]=_0x441e9e[_0xa1bf('0x46')][_0xa1bf('0x47')]?_0x441e9e['attributes']:_0x3965ae['model'];if(!_0x4999ce[_0xa1bf('0x43')][_0xa1bf('0x48')](_0xa1bf('0x49'))){_0x441e9e[_0xa1bf('0x4a')]=qs[_0xa1bf('0x4a')](_0x4999ce['query'][_0xa1bf('0x4a')]);_0x441e9e[_0xa1bf('0x2c')]=qs[_0xa1bf('0x2c')](_0x4999ce[_0xa1bf('0x43')][_0xa1bf('0x2c')]);}_0x441e9e[_0xa1bf('0x4b')]=qs[_0xa1bf('0x4c')](_0x4999ce['query']['sort']);_0x441e9e[_0xa1bf('0x4f')]=qs['filters'](_[_0xa1bf('0x4e')](_0x4999ce[_0xa1bf('0x43')],_0x3965ae[_0xa1bf('0x4d')]));_0x441e9e[_0xa1bf('0x4f')][_0xa1bf('0x5f')]=_0x2ad8d1['id'];if(_0x4999ce[_0xa1bf('0x43')][_0xa1bf('0x50')]){_0x441e9e[_0xa1bf('0x4f')]=_[_0xa1bf('0x51')](_0x441e9e[_0xa1bf('0x4f')],{'$or':_[_0xa1bf('0x3c')](_0x441e9e[_0xa1bf('0x46')],function(_0x393b56){var _0xc8c4f8={};_0xc8c4f8[_0x393b56]={'$like':'%'+_0x4999ce[_0xa1bf('0x43')][_0xa1bf('0x50')]+'%'};return _0xc8c4f8;})});}_0x441e9e=_['merge']({},_0x441e9e,_0x4999ce[_0xa1bf('0x52')]);return db[_0xa1bf('0x83')][_0xa1bf('0x2b')]({'where':_0x441e9e[_0xa1bf('0x4f')]})['then'](function(_0x71f643){_0x168119[_0xa1bf('0x2b')]=_0x71f643;if(_0x4999ce[_0xa1bf('0x43')]['includeAll']){_0x441e9e[_0xa1bf('0x54')]=[{'model':db[_0xa1bf('0x86')],'as':_0xa1bf('0x87'),'required':![]},{'model':db['User'],'as':_0xa1bf('0x88'),'attributes':[_0xa1bf('0x42'),'fullname',_0xa1bf('0x89')],'required':![]},{'model':db['Tag'],'as':_0xa1bf('0x8a'),'attributes':['id',_0xa1bf('0x42'),'color'],'where':_0x4999ce['query']['tag']?{'id':_0x4999ce['query'][_0xa1bf('0x8b')]}:undefined,'required':_0x4999ce[_0xa1bf('0x43')]['tag']?!![]:![]}];}return db[_0xa1bf('0x83')]['findAll'](_0x441e9e);})[_0xa1bf('0x31')](function(_0x2a815b){_0x168119[_0xa1bf('0x55')]=_0x2a815b;return _0x168119;});}})[_0xa1bf('0x31')](respondWithFilteredResult(_0x1b8752,_0x441e9e))[_0xa1bf('0x26')](handleError(_0x1b8752,null));};exports['addApplications']=function(_0x1c89c8,_0x27275d,_0x5396bd){return db[_0xa1bf('0x3d')][_0xa1bf('0x68')]({'where':{'id':_0x1c89c8[_0xa1bf('0x56')]['id']}})[_0xa1bf('0x31')](handleEntityNotFound(_0x27275d,null))['then'](function(_0x2e2dea){if(_0x2e2dea){return db[_0xa1bf('0x8c')][_0xa1bf('0x8d')](function(_0x3533b8){return db['MailApplication']['destroy']({'where':{'MailAccountId':_0x1c89c8[_0xa1bf('0x56')]['id']},'transaction':_0x3533b8})[_0xa1bf('0x31')](function(_0x1fc6a1){var _0x716df4=_['map'](_0x1c89c8[_0xa1bf('0x5c')],function(_0x5718db){_0x5718db[_0xa1bf('0x5f')]=_0x1c89c8[_0xa1bf('0x56')]['id'];return _0x5718db;});return db['MailApplication'][_0xa1bf('0x8e')](_0x716df4,{'transaction':_0x3533b8});});})[_0xa1bf('0x31')](function(){return db[_0xa1bf('0x8f')][_0xa1bf('0x90')]({'where':{'MailAccountId':_0x1c89c8[_0xa1bf('0x56')]['id']},'order':_0xa1bf('0x91')});});}})[_0xa1bf('0x31')](respondWithResult(_0x27275d,null))[_0xa1bf('0x26')](handleError(_0x27275d,null));};exports['getApplications']=function(_0x401f92,_0x77a4b3,_0x345bd1){var _0x1c836b={};var _0x1759a5={};var _0x2372ef;var _0x285655;return db[_0xa1bf('0x3d')]['findOne']({'where':{'id':_0x401f92[_0xa1bf('0x56')]['id']}})[_0xa1bf('0x31')](handleEntityNotFound(_0x77a4b3,null))['then'](function(_0x1212e2){if(_0x1212e2){_0x2372ef=_0x1212e2;_0x1759a5[_0xa1bf('0x41')]=_[_0xa1bf('0x58')](db['MailApplication'][_0xa1bf('0x59')]);_0x1759a5['query']=_[_0xa1bf('0x58')](_0x401f92[_0xa1bf('0x43')]);_0x1759a5[_0xa1bf('0x4d')]=_['intersection'](_0x1759a5[_0xa1bf('0x41')],_0x1759a5[_0xa1bf('0x43')]);_0x1c836b[_0xa1bf('0x46')]=_[_0xa1bf('0x44')](_0x1759a5[_0xa1bf('0x41')],qs[_0xa1bf('0x45')](_0x401f92[_0xa1bf('0x43')][_0xa1bf('0x45')]));_0x1c836b[_0xa1bf('0x46')]=_0x1c836b[_0xa1bf('0x46')][_0xa1bf('0x47')]?_0x1c836b[_0xa1bf('0x46')]:_0x1759a5['model'];_0x1c836b['order']=qs[_0xa1bf('0x4c')](_0x401f92['query'][_0xa1bf('0x4c')]);_0x1c836b[_0xa1bf('0x4f')]=qs[_0xa1bf('0x4d')](_[_0xa1bf('0x4e')](_0x401f92[_0xa1bf('0x43')],_0x1759a5['filters']));if(_0x401f92[_0xa1bf('0x43')]['filter']){_0x1c836b[_0xa1bf('0x4f')]=_[_0xa1bf('0x51')](_0x1c836b['where'],{'$or':_[_0xa1bf('0x3c')](_0x1c836b[_0xa1bf('0x46')],function(_0x2ba96c){var _0x2c412b={};_0x2c412b[_0x2ba96c]={'$like':'%'+_0x401f92[_0xa1bf('0x43')][_0xa1bf('0x50')]+'%'};return _0x2c412b;})});}_0x1c836b=_['merge']({},_0x1c836b,_0x401f92[_0xa1bf('0x52')]);return _0x2372ef[_0xa1bf('0x92')](_0x1c836b);}})[_0xa1bf('0x31')](function(_0x3f9cb9){if(_0x3f9cb9){_0x285655=_0x3f9cb9[_0xa1bf('0x47')];if(!_0x401f92[_0xa1bf('0x43')][_0xa1bf('0x48')]('nolimit')){_0x1c836b[_0xa1bf('0x4a')]=qs[_0xa1bf('0x4a')](_0x401f92[_0xa1bf('0x43')][_0xa1bf('0x4a')]);_0x1c836b[_0xa1bf('0x2c')]=qs['offset'](_0x401f92[_0xa1bf('0x43')][_0xa1bf('0x2c')]);}return _0x2372ef[_0xa1bf('0x92')](_0x1c836b);}})[_0xa1bf('0x31')](function(_0x2ed38c){if(_0x2ed38c){return _0x2ed38c?{'count':_0x285655,'rows':_0x2ed38c}:null;}})[_0xa1bf('0x31')](respondWithResult(_0x77a4b3,null))[_0xa1bf('0x26')](handleError(_0x77a4b3,null));};exports[_0xa1bf('0x93')]=function(_0x46182c,_0x746740,_0x3fe9f2){var _0x400376={'raw':!![],'where':{}};var _0x409693={};var _0x298b3d={'count':0x0,'rows':[]};return db[_0xa1bf('0x3d')][_0xa1bf('0x68')]({'where':{'id':_0x46182c[_0xa1bf('0x56')]['id']}})[_0xa1bf('0x31')](handleEntityNotFound(_0x746740,null))['then'](function(_0xa0be02){if(_0xa0be02){_0x409693[_0xa1bf('0x41')]=_[_0xa1bf('0x58')](db[_0xa1bf('0x94')][_0xa1bf('0x59')]);_0x409693['query']=_[_0xa1bf('0x58')](_0x46182c[_0xa1bf('0x43')]);_0x409693[_0xa1bf('0x4d')]=_['intersection'](_0x409693['model'],_0x409693[_0xa1bf('0x43')]);_0x400376['attributes']=_[_0xa1bf('0x44')](_0x409693[_0xa1bf('0x41')],qs[_0xa1bf('0x45')](_0x46182c[_0xa1bf('0x43')][_0xa1bf('0x45')]));_0x400376[_0xa1bf('0x46')]=_0x400376['attributes'][_0xa1bf('0x47')]?_0x400376[_0xa1bf('0x46')]:_0x409693[_0xa1bf('0x41')];if(!_0x46182c[_0xa1bf('0x43')][_0xa1bf('0x48')](_0xa1bf('0x49'))){_0x400376[_0xa1bf('0x4a')]=qs[_0xa1bf('0x4a')](_0x46182c[_0xa1bf('0x43')]['limit']);_0x400376[_0xa1bf('0x2c')]=qs['offset'](_0x46182c[_0xa1bf('0x43')]['offset']);}_0x400376[_0xa1bf('0x4b')]=qs[_0xa1bf('0x4c')](_0x46182c['query'][_0xa1bf('0x4c')]);_0x400376['where']=qs[_0xa1bf('0x4d')](_[_0xa1bf('0x4e')](_0x46182c[_0xa1bf('0x43')],_0x409693[_0xa1bf('0x4d')]));_0x400376[_0xa1bf('0x4f')][_0xa1bf('0x5f')]=_0xa0be02['id'];if(_0x46182c[_0xa1bf('0x43')][_0xa1bf('0x50')]){_0x400376['where']=_[_0xa1bf('0x51')](_0x400376[_0xa1bf('0x4f')],{'$or':_[_0xa1bf('0x3c')](_0x400376[_0xa1bf('0x46')],function(_0x347f9d){var _0x42b51c={};_0x42b51c[_0x347f9d]={'$like':'%'+_0x46182c[_0xa1bf('0x43')]['filter']+'%'};return _0x42b51c;})});}if(_0x46182c[_0xa1bf('0x43')][_0xa1bf('0x95')]){var _0x22dc81=_0x46182c[_0xa1bf('0x43')][_0xa1bf('0x95')][_0xa1bf('0x96')](',');var _0x4373ad={};_0x4373ad[_0x22dc81[0x0]]={'$gte':moment(_0x22dc81[0x1])[_0xa1bf('0x97')](_0xa1bf('0x98'))};_0x400376[_0xa1bf('0x4f')]=_['merge'](_0x400376[_0xa1bf('0x4f')],_0x4373ad);}_0x400376=_['merge']({},_0x400376,_0x46182c[_0xa1bf('0x52')]);return db[_0xa1bf('0x94')]['count']({'where':_0x400376['where']})[_0xa1bf('0x31')](function(_0x6f64f1){_0x298b3d[_0xa1bf('0x2b')]=_0x6f64f1;if(_0x46182c['query']['includeAll']){_0x400376[_0xa1bf('0x54')]=[{'all':!![]}];}return db[_0xa1bf('0x94')]['findAll'](_0x400376);})['then'](function(_0x5451cb){if(_0x46182c['query']['inlineCss']===_0xa1bf('0x99')){for(var _0x480708=0x0;_0x480708<_0x5451cb['length'];_0x480708++){_0x5451cb[_0x480708]['body']=juice(_0x5451cb[_0x480708][_0xa1bf('0x5c')]);}}_0x298b3d[_0xa1bf('0x55')]=_0x5451cb;return _0x298b3d;});}})[_0xa1bf('0x31')](respondWithFilteredResult(_0x746740,_0x400376))[_0xa1bf('0x26')](handleError(_0x746740,null));};exports[_0xa1bf('0x35')]=function(_0x307495,_0x4428a1,_0x58d4ea){var _0x559f44,_0xe3dbd={},_0x5ca985;if(_0x307495['body']['to']){_0x5ca985=_0x307495[_0xa1bf('0x5c')]['to'][_0xa1bf('0x96')](',')[0x0];}return db[_0xa1bf('0x3d')][_0xa1bf('0x5a')]({'where':{'id':_0x307495[_0xa1bf('0x56')]['id']},'include':[{'model':db[_0xa1bf('0x9a')],'as':_0xa1bf('0x9b'),'include':[{'model':db[_0xa1bf('0x86')],'as':'Contacts','where':{'email':_0x5ca985},'limit':0x1,'order':[[_0xa1bf('0x9c'),_0xa1bf('0x9d')]]}]},{'model':db[_0xa1bf('0x57')],'as':_0xa1bf('0x39'),'raw':!![]}]})['then'](handleEntityNotFound(_0x4428a1,null))['then'](function(_0x233735){if(_0x233735){_0x559f44=_0x233735;if(_0x233735[_0xa1bf('0x39')]){if(_[_0xa1bf('0x6b')](_0x307495[_0xa1bf('0x5c')]['from'])){_0x307495[_0xa1bf('0x5c')][_0xa1bf('0x9e')]=util[_0xa1bf('0x97')]('%s\x20<%s>',_0x233735[_0xa1bf('0x42')],_0x233735['email']||_0x233735[_0xa1bf('0x39')]['user']);}if(_0x307495[_0xa1bf('0x5c')][_0xa1bf('0x9f')]&&_0x307495['body']['attachments'][_0xa1bf('0x47')]){for(var _0x234203=0x0;_0x234203<_0x307495[_0xa1bf('0x5c')][_0xa1bf('0x9f')][_0xa1bf('0x47')];_0x234203+=0x1){_0x307495[_0xa1bf('0x5c')]['attachments'][_0x234203]={'filename':_0x307495[_0xa1bf('0x5c')]['attachments'][_0x234203][_0xa1bf('0x42')],'path':path[_0xa1bf('0xa0')](config[_0xa1bf('0xa1')],_0xa1bf('0xa2'),_0x307495['body'][_0xa1bf('0x9f')][_0x234203]['basename'])};}}var _0x2ec6b1={'tls':{'rejectUnauthorized':![]}};if(_[_0xa1bf('0x6b')](_0x233735[_0xa1bf('0x39')][_0xa1bf('0x76')])){if(_0x233735['Smtp'][_0xa1bf('0x73')]){_0x2ec6b1['auth']={'user':_0x233735[_0xa1bf('0x39')][_0xa1bf('0x6f')],'pass':_0x233735[_0xa1bf('0x39')][_0xa1bf('0xa3')]};}_0x2ec6b1[_0xa1bf('0x74')]=_0x233735[_0xa1bf('0x39')][_0xa1bf('0x74')];_0x2ec6b1[_0xa1bf('0x75')]=_0x233735[_0xa1bf('0x39')]['port'];_0x2ec6b1[_0xa1bf('0xa4')]=_0x233735[_0xa1bf('0x39')]['secure'];}else{_0x2ec6b1[_0xa1bf('0x76')]=_0x233735[_0xa1bf('0x39')]['service'];_0x2ec6b1[_0xa1bf('0xa5')]={'user':_0x233735[_0xa1bf('0x39')][_0xa1bf('0x6f')],'pass':_0x233735[_0xa1bf('0x39')][_0xa1bf('0xa3')]};}return respondWithRpcPromise(_0xa1bf('0xa6'),'sendMail',{'account':_0x2ec6b1,'message':_0x307495[_0xa1bf('0x5c')]});}else{throw new Error('List\x20not\x20found');}}})[_0xa1bf('0x31')](function(_0x2e0742){if(_0x2e0742){_0xe3dbd=_0x2e0742;if(_0x559f44[_0xa1bf('0x9b')]){if(_0x559f44['List']['Contacts'][_0xa1bf('0x47')]){return _0x559f44[_0xa1bf('0x9b')][_0xa1bf('0xa7')][0x0];}else{return db['CmContact']['create'](_['defaults'](_0x307495[_0xa1bf('0x5c')],{'firstName':_0x307495[_0xa1bf('0x5c')]['to'],'email':_0x307495[_0xa1bf('0x5c')]['to'],'phone':_0x307495[_0xa1bf('0x5c')]['to'],'ListId':_0x559f44[_0xa1bf('0xa8')]}));}}else{throw new Error('List\x20not\x20found');}}})['then'](function(_0x56077f){if(_0x56077f){var _0x47ab15={'UserId':_0x307495[_0xa1bf('0x6f')]['id'],'ContactId':_0x56077f['id'],'MailAccountId':_0x559f44['id'],'inReplyTo':_0xe3dbd[_0xa1bf('0xa9')],'to':_0x307495[_0xa1bf('0x5c')]['from'],'cc':_0x307495['body']['cc'],'subject':_0x307495[_0xa1bf('0x5c')][_0xa1bf('0xaa')],'attach':_0x307495['body'][_0xa1bf('0xab')],'firstMsgDirection':'out','lastMsgAt':moment()['format'](_0xa1bf('0x98')),'lastMsgDirection':'out','Messages':[_['merge'](_0x307495[_0xa1bf('0x5c')],{'messageId':_0xe3dbd[_0xa1bf('0xa9')],'sentAt':moment()[_0xa1bf('0x97')](_0xa1bf('0x98')),'read':!![],'MailAccountId':_0x559f44['id'],'UserId':_0x307495[_0xa1bf('0x6f')]['id'],'ContactId':_0x56077f['id']})]};if(_0x307495[_0xa1bf('0x5c')][_0xa1bf('0xac')]){_0x47ab15=_[_0xa1bf('0x51')](_0x47ab15,_0x307495['body'][_0xa1bf('0xac')]);}return db[_0xa1bf('0x83')][_0xa1bf('0x67')](_0x47ab15,{'include':[{'model':db[_0xa1bf('0x94')],'as':_0xa1bf('0xad')}]});}})['then'](respondWithResult(_0x4428a1,null))[_0xa1bf('0x26')](handleError(_0x4428a1,null));};exports['verifySmtp']=function(_0x4d93c6,_0x373718,_0x532f0e){return db[_0xa1bf('0x3d')][_0xa1bf('0x5a')]({'where':{'id':_0x4d93c6[_0xa1bf('0x56')]['id']},'include':[{'model':db[_0xa1bf('0x57')],'as':_0xa1bf('0x39'),'raw':!![]}]})['then'](handleEntityNotFound(_0x373718,null))[_0xa1bf('0x31')](function(_0xeea452){if(_0xeea452&&_0xeea452[_0xa1bf('0x39')]){var _0x43d231={'id':_0xeea452['id'],'tls':{'rejectUnauthorized':![]}};if(_0xeea452[_0xa1bf('0x39')]['service']){_0x43d231[_0xa1bf('0x76')]=_0xeea452[_0xa1bf('0x39')][_0xa1bf('0x76')];}else{_0x43d231['host']=_0xeea452[_0xa1bf('0x39')][_0xa1bf('0x74')];_0x43d231[_0xa1bf('0x75')]=_0xeea452[_0xa1bf('0x39')][_0xa1bf('0x75')];_0x43d231[_0xa1bf('0xa4')]=_0xeea452[_0xa1bf('0x39')][_0xa1bf('0xa4')];}if(_0xeea452[_0xa1bf('0x39')][_0xa1bf('0x73')]){_0x43d231[_0xa1bf('0xa5')]={'user':_0xeea452[_0xa1bf('0x39')][_0xa1bf('0x6f')],'pass':_0xeea452[_0xa1bf('0x39')][_0xa1bf('0xa3')]};}return respondWithRpcPromise('VerifySmtp',_0xa1bf('0xae'),{'account':_0x43d231});}})[_0xa1bf('0x31')](respondWithResult(_0x373718,null))['catch'](handleError(_0x373718,null));};exports['destroy']=function(_0x46ff41,_0x22d21f){return db[_0xa1bf('0x3d')][_0xa1bf('0x5a')]({'where':{'id':_0x46ff41[_0xa1bf('0x56')]['id']}})['then'](handleEntityNotFound(_0x22d21f,null))['then'](function(_0x5e78e0){if(_0x5e78e0&&_0x5e78e0[_0xa1bf('0x76')]){throw new db[(_0xa1bf('0xaf'))][(_0xa1bf('0xb0'))](_0xa1bf('0xb1'));}return _0x5e78e0;})[_0xa1bf('0x31')](removeEntity(_0x22d21f,null))[_0xa1bf('0x26')](handleError(_0x22d21f,null));};exports[_0xa1bf('0xb2')]=function(_0x57a9d1,_0x41670c,_0x5a0fd1){return db[_0xa1bf('0x3d')][_0xa1bf('0x5a')]({'where':{'id':_0x57a9d1[_0xa1bf('0x56')]['id']}})['then'](handleEntityNotFound(_0x41670c,null))[_0xa1bf('0x31')](function(_0x465252){if(_0x465252){return _0x465252[_0xa1bf('0xb2')](_0x57a9d1[_0xa1bf('0x5c')][_0xa1bf('0x64')],_[_0xa1bf('0x84')](_0x57a9d1[_0xa1bf('0x5c')],[_0xa1bf('0x64'),'id'])||{})[_0xa1bf('0xb3')](function(_0x1cc9a7){for(var _0x584df8=0x0;_0x584df8<_0x57a9d1['body'][_0xa1bf('0x64')][_0xa1bf('0x47')];_0x584df8+=0x1){socket[_0xa1bf('0xb4')](_0xa1bf('0xb5'),{'UserId':Number(_0x57a9d1['body']['ids'][_0x584df8]),'MailAccountId':Number(_0x57a9d1[_0xa1bf('0x56')]['id'])});}return _0x1cc9a7;});}})[_0xa1bf('0x31')](respondWithResult(_0x41670c,null))['catch'](handleError(_0x41670c,null));};exports[_0xa1bf('0xb6')]=function(_0x61b71,_0xe13482,_0x503c91){return db[_0xa1bf('0x3d')]['find']({'where':{'id':_0x61b71[_0xa1bf('0x56')]['id']}})[_0xa1bf('0x31')](handleEntityNotFound(_0xe13482,null))[_0xa1bf('0x31')](function(_0x3e02d8){if(_0x3e02d8){return _0x3e02d8[_0xa1bf('0xb6')](_0x61b71[_0xa1bf('0x43')][_0xa1bf('0x64')])[_0xa1bf('0x31')](function(){if(_['isArray'](_0x61b71[_0xa1bf('0x43')][_0xa1bf('0x64')])){for(var _0x4183d3=0x0;_0x4183d3<_0x61b71['query']['ids'][_0xa1bf('0x47')];_0x4183d3+=0x1){socket[_0xa1bf('0xb4')](_0xa1bf('0xb7'),{'UserId':Number(_0x61b71[_0xa1bf('0x43')][_0xa1bf('0x64')][_0x4183d3]),'MailAccountId':Number(_0x61b71[_0xa1bf('0x56')]['id'])});}}else{socket[_0xa1bf('0xb4')](_0xa1bf('0xb7'),{'UserId':Number(_0x61b71[_0xa1bf('0x43')][_0xa1bf('0x64')]),'MailAccountId':Number(_0x61b71[_0xa1bf('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0xe13482,null))[_0xa1bf('0x26')](handleError(_0xe13482,null));};exports['getAgents']=function(_0x1c40c0,_0x49c1cc,_0x2cac3b){var _0x36b725={};var _0x23f0fb={};var _0x4becc6;var _0x16630c;return db['MailAccount'][_0xa1bf('0x68')]({'where':{'id':_0x1c40c0['params']['id']}})[_0xa1bf('0x31')](handleEntityNotFound(_0x49c1cc,null))[_0xa1bf('0x31')](function(_0x5f0905){if(_0x5f0905){_0x4becc6=_0x5f0905;_0x23f0fb[_0xa1bf('0x41')]=_[_0xa1bf('0x58')](db['User'][_0xa1bf('0x59')]);_0x23f0fb['query']=_[_0xa1bf('0x58')](_0x1c40c0[_0xa1bf('0x43')]);_0x23f0fb[_0xa1bf('0x4d')]=_[_0xa1bf('0x44')](_0x23f0fb['model'],_0x23f0fb['query']);_0x36b725[_0xa1bf('0x46')]=_[_0xa1bf('0x44')](_0x23f0fb['model'],qs['fields'](_0x1c40c0[_0xa1bf('0x43')]['fields']));_0x36b725[_0xa1bf('0x46')]=_0x36b725[_0xa1bf('0x46')]['length']?_0x36b725[_0xa1bf('0x46')]:_0x23f0fb[_0xa1bf('0x41')];_0x36b725[_0xa1bf('0x4b')]=qs[_0xa1bf('0x4c')](_0x1c40c0['query'][_0xa1bf('0x4c')]);_0x36b725[_0xa1bf('0x4f')]=qs[_0xa1bf('0x4d')](_[_0xa1bf('0x4e')](_0x1c40c0['query'],_0x23f0fb['filters']));if(_0x1c40c0[_0xa1bf('0x43')]['filter']){_0x36b725['where']=_[_0xa1bf('0x51')](_0x36b725[_0xa1bf('0x4f')],{'$or':_[_0xa1bf('0x3c')](_0x36b725[_0xa1bf('0x46')],function(_0x11b0d9){var _0x1abe25={};_0x1abe25[_0x11b0d9]={'$like':'%'+_0x1c40c0[_0xa1bf('0x43')][_0xa1bf('0x50')]+'%'};return _0x1abe25;})});}_0x36b725=_[_0xa1bf('0x51')]({},_0x36b725,_0x1c40c0[_0xa1bf('0x52')]);return _0x4becc6[_0xa1bf('0xb8')](_0x36b725);}})['then'](function(_0x16c812){if(_0x16c812){_0x16630c=_0x16c812[_0xa1bf('0x47')];if(!_0x1c40c0['query'][_0xa1bf('0x48')](_0xa1bf('0x49'))){_0x36b725[_0xa1bf('0x4a')]=qs[_0xa1bf('0x4a')](_0x1c40c0[_0xa1bf('0x43')][_0xa1bf('0x4a')]);_0x36b725['offset']=qs[_0xa1bf('0x2c')](_0x1c40c0['query'][_0xa1bf('0x2c')]);}return _0x4becc6[_0xa1bf('0xb8')](_0x36b725);}})['then'](function(_0x45d9f4){if(_0x45d9f4){return _0x45d9f4?{'count':_0x16630c,'rows':_0x45d9f4}:null;}})[_0xa1bf('0x31')](respondWithResult(_0x49c1cc,null))[_0xa1bf('0x26')](handleError(_0x49c1cc,null));}; \ No newline at end of file +var _0x33ab=['getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./mailAccount.socket','register','jayson/promise','request','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','end','status','offset','undefined','limit','count','Content-Range','json','save','update','then','destroy','get','MailAccounts','UserProfileResource','sendStatus','send','index','MailServerIn','Imap','MailServerOut','Pause','MailAccount','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','Smtp','rawAttributes','find','body','mandatoryDispositionPause','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','CannedAnswer','create','ListId','isNil','active','description','cservice','cauthentication','user','cuser','cpassword','authentication','host','port','service','password','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','pick','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','CmList','List','CmContact','Contacts','updatedAt','DESC','from','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','auth','pass','secure','sendMail','List\x20not\x20found','messageId','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove'];(function(_0x39ded1,_0xaee436){var _0x2e248e=function(_0x193df3){while(--_0x193df3){_0x39ded1['push'](_0x39ded1['shift']());}};_0x2e248e(++_0xaee436);}(_0x33ab,0x18b));var _0xb33a=function(_0x489df9,_0x5d63b8){_0x489df9=_0x489df9-0x0;var _0x1f2679=_0x33ab[_0x489df9];return _0x1f2679;};'use strict';var emlformat=require(_0xb33a('0x0'));var rimraf=require(_0xb33a('0x1'));var zipdir=require(_0xb33a('0x2'));var jsonpatch=require(_0xb33a('0x3'));var rp=require(_0xb33a('0x4'));var moment=require(_0xb33a('0x5'));var BPromise=require(_0xb33a('0x6'));var Mustache=require('mustache');var util=require(_0xb33a('0x7'));var path=require('path');var sox=require(_0xb33a('0x8'));var csv=require(_0xb33a('0x9'));var ejs=require(_0xb33a('0xa'));var fs=require('fs');var fs_extra=require(_0xb33a('0xb'));var _=require(_0xb33a('0xc'));var squel=require(_0xb33a('0xd'));var crypto=require(_0xb33a('0xe'));var jsforce=require(_0xb33a('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb33a('0x10'));var Papa=require(_0xb33a('0x11'));var htmlToText=require('html-to-text');var juice=require(_0xb33a('0x12'));var Redis=require(_0xb33a('0x13'));var authService=require(_0xb33a('0x14'));var qs=require(_0xb33a('0x15'));var as=require(_0xb33a('0x16'));var hardwareService=require(_0xb33a('0x17'));var logger=require(_0xb33a('0x18'))(_0xb33a('0x19'));var utils=require(_0xb33a('0x1a'));var config=require(_0xb33a('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xb33a('0x1c'))['db'];config[_0xb33a('0x1d')]=_[_0xb33a('0x1e')](config[_0xb33a('0x1d')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb33a('0x1f'))[_0xb33a('0x20')](socket);var jayson=require(_0xb33a('0x21'));var client=jayson['client']['http']({'port':0x232b});function respondWithRpcPromise(_0x294739,_0x12bfa0,_0x45559e,_0x4ab70d){return new BPromise(function(_0x5cadcf,_0x378f8f){var _0x142742=_0x4ab70d||client;return _0x142742[_0xb33a('0x22')](_0x294739,_0x45559e)['then'](function(_0x26e265){logger[_0xb33a('0x23')](_0xb33a('0x24'),_0x12bfa0,'request\x20sent');logger[_0xb33a('0x25')](_0xb33a('0x26'),_0x12bfa0,_0xb33a('0x27'),JSON[_0xb33a('0x28')](_0x26e265));if(_0x26e265[_0xb33a('0x29')]){if(_0x26e265[_0xb33a('0x29')]['code']===0x1f4){logger['error'](_0xb33a('0x24'),_0x12bfa0,_0x26e265[_0xb33a('0x29')]['message']);return _0x378f8f(_0x26e265[_0xb33a('0x29')][_0xb33a('0x2a')]);}logger[_0xb33a('0x29')](_0xb33a('0x24'),_0x12bfa0,_0x26e265[_0xb33a('0x29')][_0xb33a('0x2a')]);return _0x5cadcf(_0x26e265[_0xb33a('0x29')][_0xb33a('0x2a')]);}else{logger['info'](_0xb33a('0x24'),_0x12bfa0,_0xb33a('0x27'));_0x5cadcf(_0x26e265[_0xb33a('0x2b')][_0xb33a('0x2a')]);}})[_0xb33a('0x2c')](function(_0x251e1d){logger['error'](_0xb33a('0x24'),_0x12bfa0,_0x251e1d);_0x378f8f(_0x251e1d);});});}function respondWithStatusCode(_0x1f4c79,_0x54b6af){_0x54b6af=_0x54b6af||0xcc;return function(_0x446199){if(_0x446199){return _0x1f4c79['sendStatus'](_0x54b6af);}return _0x1f4c79['status'](_0x54b6af)[_0xb33a('0x2d')]();};}function respondWithResult(_0x227a44,_0x446b12){_0x446b12=_0x446b12||0xc8;return function(_0x1c1417){if(_0x1c1417){return _0x227a44[_0xb33a('0x2e')](_0x446b12)['json'](_0x1c1417);}};}function respondWithFilteredResult(_0x183741,_0x18bdd8){return function(_0x494d53){if(_0x494d53){var _0x3913ca=typeof _0x18bdd8[_0xb33a('0x2f')]===_0xb33a('0x30')&&typeof _0x18bdd8[_0xb33a('0x31')]==='undefined';var _0x45c5c5=_0x494d53[_0xb33a('0x32')];var _0x43d122=_0x3913ca?0x0:_0x18bdd8[_0xb33a('0x2f')];var _0x5e3b6d=_0x3913ca?_0x494d53[_0xb33a('0x32')]:_0x18bdd8[_0xb33a('0x2f')]+_0x18bdd8[_0xb33a('0x31')];var _0x50e7a5;if(_0x5e3b6d>=_0x45c5c5){_0x5e3b6d=_0x45c5c5;_0x50e7a5=0xc8;}else{_0x50e7a5=0xce;}_0x183741['status'](_0x50e7a5);return _0x183741['set'](_0xb33a('0x33'),_0x43d122+'-'+_0x5e3b6d+'/'+_0x45c5c5)[_0xb33a('0x34')](_0x494d53);}return null;};}function patchUpdates(_0x4b0116){return function(_0x590cf5){try{jsonpatch['apply'](_0x590cf5,_0x4b0116,!![]);}catch(_0x4a6de2){return BPromise['reject'](_0x4a6de2);}return _0x590cf5[_0xb33a('0x35')]();};}function saveUpdates(_0x1f3fe7,_0x4767a6){return function(_0x5d86b4){if(_0x5d86b4){return _0x5d86b4[_0xb33a('0x36')](_0x1f3fe7)[_0xb33a('0x37')](function(_0x22871d){return _0x22871d;});}return null;};}function removeEntity(_0x281468,_0x95fb46){return function(_0x3c4570){if(_0x3c4570){return _0x3c4570[_0xb33a('0x38')]()[_0xb33a('0x37')](function(){var _0x21ee02=_0x3c4570[_0xb33a('0x39')]({'plain':!![]});var _0x2d7ae3=_0xb33a('0x3a');return db[_0xb33a('0x3b')]['destroy']({'where':{'type':_0x2d7ae3,'resourceId':_0x21ee02['id']}})[_0xb33a('0x37')](function(){return _0x3c4570;});})[_0xb33a('0x37')](function(){_0x281468[_0xb33a('0x2e')](0xcc)[_0xb33a('0x2d')]();});}};}function handleEntityNotFound(_0x23cfa5,_0x448f1a){return function(_0x25b627){if(!_0x25b627){_0x23cfa5[_0xb33a('0x3c')](0x194);}return _0x25b627;};}function handleError(_0x3d17fb,_0x570bb1){_0x570bb1=_0x570bb1||0x1f4;return function(_0x4ad2d1){logger[_0xb33a('0x29')](_0x4ad2d1['stack']);if(_0x4ad2d1['name']){delete _0x4ad2d1['name'];}_0x3d17fb['status'](_0x570bb1)[_0xb33a('0x3d')](_0x4ad2d1);};}exports[_0xb33a('0x3e')]=function(_0x2193ed,_0x55ceb1){var _0x21190d={'include':[{'model':db[_0xb33a('0x3f')],'as':_0xb33a('0x40')},{'model':db[_0xb33a('0x41')],'as':'Smtp'},{'model':db[_0xb33a('0x42')],'as':'mandatoryDispositionPause'}]},_0x53a6d0={},_0x3b7836={'count':0x0,'rows':[]};var _0x54f1b7=_['map'](db[_0xb33a('0x43')]['rawAttributes'],function(_0x1a281b){return{'name':_0x1a281b['fieldName'],'type':_0x1a281b[_0xb33a('0x44')][_0xb33a('0x45')]};});_0x53a6d0[_0xb33a('0x46')]=_[_0xb33a('0x47')](_0x54f1b7,_0xb33a('0x48'));_0x53a6d0[_0xb33a('0x49')]=_[_0xb33a('0x4a')](_0x2193ed[_0xb33a('0x49')]);_0x53a6d0[_0xb33a('0x4b')]=_[_0xb33a('0x4c')](_0x53a6d0['model'],_0x53a6d0[_0xb33a('0x49')]);_0x21190d[_0xb33a('0x4d')]=_[_0xb33a('0x4c')](_0x53a6d0[_0xb33a('0x46')],qs[_0xb33a('0x4e')](_0x2193ed['query'][_0xb33a('0x4e')]));_0x21190d['attributes']=_0x21190d[_0xb33a('0x4d')][_0xb33a('0x4f')]?_0x21190d[_0xb33a('0x4d')]:_0x53a6d0[_0xb33a('0x46')];if(!_0x2193ed['query'][_0xb33a('0x50')](_0xb33a('0x51'))){_0x21190d['limit']=qs[_0xb33a('0x31')](_0x2193ed[_0xb33a('0x49')]['limit']);_0x21190d[_0xb33a('0x2f')]=qs[_0xb33a('0x2f')](_0x2193ed[_0xb33a('0x49')][_0xb33a('0x2f')]);}_0x21190d[_0xb33a('0x52')]=qs[_0xb33a('0x53')](_0x2193ed[_0xb33a('0x49')][_0xb33a('0x53')]);_0x21190d[_0xb33a('0x54')]=qs[_0xb33a('0x4b')](_['pick'](_0x2193ed['query'],_0x53a6d0['filters']),_0x54f1b7);if(_0x2193ed['query'][_0xb33a('0x55')]){_0x21190d['where']=_[_0xb33a('0x56')](_0x21190d[_0xb33a('0x54')],{'$or':_[_0xb33a('0x47')](_0x54f1b7,function(_0x5ae75a){if(_0x5ae75a[_0xb33a('0x44')]!=='VIRTUAL'){var _0x3f69df={};_0x3f69df[_0x5ae75a['name']]={'$like':'%'+_0x2193ed[_0xb33a('0x49')][_0xb33a('0x55')]+'%'};return _0x3f69df;}})});}_0x21190d=_[_0xb33a('0x56')]({},_0x21190d,_0x2193ed[_0xb33a('0x57')]);var _0x1f81e7={'where':_0x21190d['where']};return db[_0xb33a('0x43')][_0xb33a('0x32')](_0x1f81e7)[_0xb33a('0x37')](function(_0x88fc6a){_0x3b7836[_0xb33a('0x32')]=_0x88fc6a;if(_0x2193ed['query'][_0xb33a('0x58')]){_0x21190d[_0xb33a('0x59')]=[{'all':!![]}];}return db[_0xb33a('0x43')][_0xb33a('0x5a')](_0x21190d);})[_0xb33a('0x37')](function(_0x27bb97){_0x3b7836[_0xb33a('0x5b')]=_0x27bb97;return _0x3b7836;})[_0xb33a('0x37')](respondWithFilteredResult(_0x55ceb1,_0x21190d))['catch'](handleError(_0x55ceb1,null));};exports[_0xb33a('0x5c')]=function(_0x2d551d,_0x937a85){var _0x156e75={'raw':![],'where':{'id':_0x2d551d[_0xb33a('0x5d')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xb33a('0x40')},{'model':db[_0xb33a('0x41')],'as':_0xb33a('0x5e')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4ba989={};_0x4ba989['model']=_[_0xb33a('0x4a')](db[_0xb33a('0x43')][_0xb33a('0x5f')]);_0x4ba989[_0xb33a('0x49')]=_[_0xb33a('0x4a')](_0x2d551d[_0xb33a('0x49')]);_0x4ba989[_0xb33a('0x4b')]=_[_0xb33a('0x4c')](_0x4ba989[_0xb33a('0x46')],_0x4ba989[_0xb33a('0x49')]);_0x156e75[_0xb33a('0x4d')]=_[_0xb33a('0x4c')](_0x4ba989['model'],qs[_0xb33a('0x4e')](_0x2d551d[_0xb33a('0x49')]['fields']));_0x156e75[_0xb33a('0x4d')]=_0x156e75[_0xb33a('0x4d')][_0xb33a('0x4f')]?_0x156e75['attributes']:_0x4ba989[_0xb33a('0x46')];if(_0x2d551d[_0xb33a('0x49')][_0xb33a('0x58')]){_0x156e75[_0xb33a('0x59')]=[{'all':!![]}];}_0x156e75=_[_0xb33a('0x56')]({},_0x156e75,_0x2d551d[_0xb33a('0x57')]);return db[_0xb33a('0x43')][_0xb33a('0x60')](_0x156e75)['then'](handleEntityNotFound(_0x937a85,null))['then'](respondWithResult(_0x937a85,null))[_0xb33a('0x2c')](handleError(_0x937a85,null));};exports[_0xb33a('0x36')]=function(_0x5caa9f,_0x1e3f06){if(_0x5caa9f[_0xb33a('0x61')]['id']){delete _0x5caa9f[_0xb33a('0x61')]['id'];}return db[_0xb33a('0x43')]['find']({'where':{'id':_0x5caa9f[_0xb33a('0x5d')]['id']},'include':[{'model':db[_0xb33a('0x3f')],'as':_0xb33a('0x40')},{'model':db[_0xb33a('0x41')],'as':'Smtp'},{'model':db['Pause'],'as':_0xb33a('0x62')}]})[_0xb33a('0x37')](handleEntityNotFound(_0x1e3f06,null))[_0xb33a('0x37')](saveUpdates(_0x5caa9f['body'],null))[_0xb33a('0x37')](function(_0x577090){if(_0x577090&&_0x5caa9f['body'][_0xb33a('0x40')]){return db[_0xb33a('0x3f')][_0xb33a('0x36')](_0x5caa9f[_0xb33a('0x61')][_0xb33a('0x40')],{'where':{'MailAccountId':_0x577090['id']}})[_0xb33a('0x37')](function(){return _0x577090;});}return _0x577090;})[_0xb33a('0x37')](function(_0xfd6e11){if(_0xfd6e11&&_0x5caa9f[_0xb33a('0x61')][_0xb33a('0x5e')]){return db[_0xb33a('0x41')][_0xb33a('0x36')](_0x5caa9f[_0xb33a('0x61')]['Smtp'],{'where':{'MailAccountId':_0xfd6e11['id']}})['then'](function(){return _0xfd6e11;});}return _0xfd6e11;})[_0xb33a('0x37')](respondWithResult(_0x1e3f06,null))['catch'](handleError(_0x1e3f06,null));};exports[_0xb33a('0x63')]=function(_0x232e57,_0x24b062){return db[_0xb33a('0x43')][_0xb33a('0x63')]()[_0xb33a('0x37')](respondWithResult(_0x24b062,null))['catch'](handleError(_0x24b062,null));};exports[_0xb33a('0x64')]=function(_0x3e2316,_0x57e8ae,_0x245cd4){if(_0x3e2316[_0xb33a('0x61')]['id']){delete _0x3e2316[_0xb33a('0x61')]['id'];}return db['MailAccount'][_0xb33a('0x60')]({'where':{'id':_0x3e2316[_0xb33a('0x5d')]['id']}})['then'](handleEntityNotFound(_0x57e8ae,null))[_0xb33a('0x37')](function(_0x14dd62){if(_0x14dd62){_0x3e2316[_0xb33a('0x61')][_0xb33a('0x65')]=_0x14dd62['id'];return db[_0xb33a('0x66')]['create'](_0x3e2316['body']);}})[_0xb33a('0x37')](respondWithResult(_0x57e8ae,null))[_0xb33a('0x2c')](handleError(_0x57e8ae,null));};exports[_0xb33a('0x67')]=function(_0x4c1c2d,_0x4a480c,_0x519ed7){var _0x5a4b67={'raw':![],'where':{}};var _0x9903a1={};var _0x5e5f6f={'count':0x0,'rows':[]};return db[_0xb33a('0x43')][_0xb33a('0x68')]({'where':{'id':_0x4c1c2d[_0xb33a('0x5d')]['id']}})[_0xb33a('0x37')](handleEntityNotFound(_0x4a480c,null))[_0xb33a('0x37')](function(_0x5b020d){if(_0x5b020d){_0x9903a1[_0xb33a('0x46')]=_[_0xb33a('0x4a')](db[_0xb33a('0x66')][_0xb33a('0x5f')]);_0x9903a1[_0xb33a('0x49')]=_['keys'](_0x4c1c2d[_0xb33a('0x49')]);_0x9903a1[_0xb33a('0x4b')]=_['intersection'](_0x9903a1[_0xb33a('0x46')],_0x9903a1[_0xb33a('0x49')]);_0x5a4b67['attributes']=_[_0xb33a('0x4c')](_0x9903a1[_0xb33a('0x46')],qs[_0xb33a('0x4e')](_0x4c1c2d[_0xb33a('0x49')][_0xb33a('0x4e')]));_0x5a4b67[_0xb33a('0x4d')]=_0x5a4b67[_0xb33a('0x4d')][_0xb33a('0x4f')]?_0x5a4b67[_0xb33a('0x4d')]:_0x9903a1[_0xb33a('0x46')];if(!_0x4c1c2d[_0xb33a('0x49')][_0xb33a('0x50')]('nolimit')){_0x5a4b67[_0xb33a('0x31')]=qs['limit'](_0x4c1c2d[_0xb33a('0x49')][_0xb33a('0x31')]);_0x5a4b67[_0xb33a('0x2f')]=qs[_0xb33a('0x2f')](_0x4c1c2d['query']['offset']);}_0x5a4b67[_0xb33a('0x52')]=qs[_0xb33a('0x53')](_0x4c1c2d[_0xb33a('0x49')]['sort']);_0x5a4b67[_0xb33a('0x54')]=qs['filters'](_['pick'](_0x4c1c2d['query'],_0x9903a1[_0xb33a('0x4b')]));_0x5a4b67['where'][_0xb33a('0x65')]=_0x5b020d['id'];if(_0x4c1c2d[_0xb33a('0x49')][_0xb33a('0x55')]){_0x5a4b67['where']=_[_0xb33a('0x56')](_0x5a4b67['where'],{'$or':_[_0xb33a('0x47')](_0x5a4b67[_0xb33a('0x4d')],function(_0x3afbdd){var _0x1f8170={};_0x1f8170[_0x3afbdd]={'$like':'%'+_0x4c1c2d[_0xb33a('0x49')][_0xb33a('0x55')]+'%'};return _0x1f8170;})});}_0x5a4b67=_['merge']({},_0x5a4b67,_0x4c1c2d[_0xb33a('0x57')]);return db[_0xb33a('0x66')]['count']({'where':_0x5a4b67[_0xb33a('0x54')]})[_0xb33a('0x37')](function(_0xace269){_0x5e5f6f[_0xb33a('0x32')]=_0xace269;if(_0x4c1c2d['query']['includeAll']){_0x5a4b67[_0xb33a('0x59')]=[{'all':!![]}];}return db[_0xb33a('0x66')][_0xb33a('0x5a')](_0x5a4b67);})[_0xb33a('0x37')](function(_0x98b99c){_0x5e5f6f['rows']=_0x98b99c;return _0x5e5f6f;});}})[_0xb33a('0x37')](respondWithFilteredResult(_0x4a480c,_0x5a4b67))[_0xb33a('0x2c')](handleError(_0x4a480c,null));};exports['removeDispositions']=function(_0x3aa19c,_0x1820e5,_0x2e3aa4){return db['MailAccount'][_0xb33a('0x60')]({'where':{'id':_0x3aa19c[_0xb33a('0x5d')]['id']}})[_0xb33a('0x37')](handleEntityNotFound(_0x1820e5,null))[_0xb33a('0x37')](function(_0x53332c){if(_0x53332c){return _0x53332c[_0xb33a('0x69')](_0x3aa19c['query'][_0xb33a('0x6a')]);}})[_0xb33a('0x37')](respondWithStatusCode(_0x1820e5,null))[_0xb33a('0x2c')](handleError(_0x1820e5,null));};exports['addAnswer']=function(_0x1b328d,_0x3f1128,_0x94f44d){if(_0x1b328d['body']['id']){delete _0x1b328d[_0xb33a('0x61')]['id'];}return db[_0xb33a('0x43')][_0xb33a('0x60')]({'where':{'id':_0x1b328d[_0xb33a('0x5d')]['id']}})[_0xb33a('0x37')](handleEntityNotFound(_0x3f1128,null))[_0xb33a('0x37')](function(_0x1cf82a){if(_0x1cf82a){_0x1b328d[_0xb33a('0x61')]['MailAccountId']=_0x1cf82a['id'];return db[_0xb33a('0x6b')]['create'](_0x1b328d[_0xb33a('0x61')]);}})['then'](respondWithResult(_0x3f1128,null))[_0xb33a('0x2c')](handleError(_0x3f1128,null));};exports['getAnswers']=function(_0x51c2c6,_0x39ea52,_0x1201c9){var _0x38f380={'raw':![],'where':{}};var _0x2457c8={};var _0x34217d={'count':0x0,'rows':[]};return db[_0xb33a('0x43')]['findOne']({'where':{'id':_0x51c2c6[_0xb33a('0x5d')]['id']}})[_0xb33a('0x37')](handleEntityNotFound(_0x39ea52,null))[_0xb33a('0x37')](function(_0xc3778c){if(_0xc3778c){_0x2457c8[_0xb33a('0x46')]=_[_0xb33a('0x4a')](db[_0xb33a('0x6b')]['rawAttributes']);_0x2457c8[_0xb33a('0x49')]=_['keys'](_0x51c2c6[_0xb33a('0x49')]);_0x2457c8[_0xb33a('0x4b')]=_['intersection'](_0x2457c8[_0xb33a('0x46')],_0x2457c8[_0xb33a('0x49')]);_0x38f380[_0xb33a('0x4d')]=_[_0xb33a('0x4c')](_0x2457c8['model'],qs[_0xb33a('0x4e')](_0x51c2c6[_0xb33a('0x49')][_0xb33a('0x4e')]));_0x38f380['attributes']=_0x38f380[_0xb33a('0x4d')]['length']?_0x38f380['attributes']:_0x2457c8['model'];if(!_0x51c2c6['query'][_0xb33a('0x50')](_0xb33a('0x51'))){_0x38f380['limit']=qs[_0xb33a('0x31')](_0x51c2c6['query'][_0xb33a('0x31')]);_0x38f380[_0xb33a('0x2f')]=qs[_0xb33a('0x2f')](_0x51c2c6['query'][_0xb33a('0x2f')]);}_0x38f380['order']=qs[_0xb33a('0x53')](_0x51c2c6[_0xb33a('0x49')][_0xb33a('0x53')]);_0x38f380['where']=qs[_0xb33a('0x4b')](_['pick'](_0x51c2c6[_0xb33a('0x49')],_0x2457c8['filters']));_0x38f380[_0xb33a('0x54')][_0xb33a('0x65')]=_0xc3778c['id'];if(_0x51c2c6[_0xb33a('0x49')][_0xb33a('0x55')]){_0x38f380[_0xb33a('0x54')]=_[_0xb33a('0x56')](_0x38f380[_0xb33a('0x54')],{'$or':_[_0xb33a('0x47')](_0x38f380[_0xb33a('0x4d')],function(_0x1629f7){var _0x399c22={};_0x399c22[_0x1629f7]={'$like':'%'+_0x51c2c6[_0xb33a('0x49')]['filter']+'%'};return _0x399c22;})});}_0x38f380=_[_0xb33a('0x56')]({},_0x38f380,_0x51c2c6['options']);return db[_0xb33a('0x6b')][_0xb33a('0x32')]({'where':_0x38f380[_0xb33a('0x54')]})['then'](function(_0x4043b1){_0x34217d['count']=_0x4043b1;if(_0x51c2c6['query'][_0xb33a('0x58')]){_0x38f380['include']=[{'all':!![]}];}return db[_0xb33a('0x6b')][_0xb33a('0x5a')](_0x38f380);})[_0xb33a('0x37')](function(_0x5707ef){_0x34217d[_0xb33a('0x5b')]=_0x5707ef;return _0x34217d;});}})['then'](respondWithFilteredResult(_0x39ea52,_0x38f380))[_0xb33a('0x2c')](handleError(_0x39ea52,null));};exports['removeAnswers']=function(_0xf9cc04,_0x428005,_0x26f370){return db['MailAccount'][_0xb33a('0x60')]({'where':{'id':_0xf9cc04[_0xb33a('0x5d')]['id']}})['then'](handleEntityNotFound(_0x428005,null))[_0xb33a('0x37')](function(_0x25c355){if(_0x25c355){return _0x25c355['removeAnswers'](_0xf9cc04['query']['ids']);}})['then'](respondWithStatusCode(_0x428005,null))[_0xb33a('0x2c')](handleError(_0x428005,null));};exports[_0xb33a('0x6c')]=function(_0x34bf14,_0x2966f4){var _0x440266={'name':_0x34bf14[_0xb33a('0x61')]['name'],'key':_0x34bf14[_0xb33a('0x61')][_0xb33a('0x45')],'email':_0x34bf14[_0xb33a('0x61')]['email'],'ListId':_0x34bf14['body'][_0xb33a('0x6d')],'active':!_[_0xb33a('0x6e')](_0x34bf14[_0xb33a('0x61')][_0xb33a('0x6f')])?_0x34bf14[_0xb33a('0x61')][_0xb33a('0x6f')]:!![],'description':_0x34bf14[_0xb33a('0x61')][_0xb33a('0x70')]||null,'Imap':{},'Smtp':{}};if(_[_0xb33a('0x6e')](_0x34bf14[_0xb33a('0x61')][_0xb33a('0x71')])){if(_0x34bf14[_0xb33a('0x61')][_0xb33a('0x72')]){_0x440266['Imap'][_0xb33a('0x73')]=_0x440266[_0xb33a('0x5e')][_0xb33a('0x73')]=_0x34bf14['body'][_0xb33a('0x74')];_0x440266[_0xb33a('0x40')]['password']=_0x440266['Smtp']['pass']=_0x34bf14[_0xb33a('0x61')][_0xb33a('0x75')];}else{_0x440266['Imap'][_0xb33a('0x76')]=_0x440266[_0xb33a('0x5e')][_0xb33a('0x76')]=![];}_0x440266[_0xb33a('0x40')]['host']=_0x34bf14['body'][_0xb33a('0x40')][_0xb33a('0x77')];_0x440266['Imap'][_0xb33a('0x78')]=_0x34bf14[_0xb33a('0x61')][_0xb33a('0x40')][_0xb33a('0x78')];_0x440266[_0xb33a('0x5e')][_0xb33a('0x77')]=_0x34bf14[_0xb33a('0x61')][_0xb33a('0x5e')][_0xb33a('0x77')];_0x440266[_0xb33a('0x5e')][_0xb33a('0x78')]=_0x34bf14[_0xb33a('0x61')][_0xb33a('0x5e')][_0xb33a('0x78')];}else{_0x440266[_0xb33a('0x40')][_0xb33a('0x79')]=_0x440266[_0xb33a('0x5e')][_0xb33a('0x79')]=_0x34bf14[_0xb33a('0x61')][_0xb33a('0x71')];_0x440266[_0xb33a('0x40')]['user']=_0x440266['Smtp']['user']=_0x34bf14[_0xb33a('0x61')][_0xb33a('0x74')];_0x440266[_0xb33a('0x40')][_0xb33a('0x7a')]=_0x440266['Smtp']['pass']=_0x34bf14[_0xb33a('0x61')]['cpassword'];}return db[_0xb33a('0x43')][_0xb33a('0x6c')](_0x440266,{'include':[{'model':db[_0xb33a('0x41')],'as':_0xb33a('0x5e')},{'model':db['MailServerIn'],'as':_0xb33a('0x40')}]})[_0xb33a('0x37')](function(_0x81c458){var _0x1715aa=_0x34bf14[_0xb33a('0x73')]['get']({'plain':!![]});if(!_0x1715aa)throw new Error(_0xb33a('0x7b'));if(_0x1715aa[_0xb33a('0x7c')]===_0xb33a('0x73')){var _0x3ac462=_0x81c458[_0xb33a('0x39')]({'plain':!![]});return db['UserProfileSection'][_0xb33a('0x60')]({'where':{'name':_0xb33a('0x3a'),'userProfileId':_0x1715aa[_0xb33a('0x7d')]},'raw':!![]})[_0xb33a('0x37')](function(_0x1464b3){if(_0x1464b3&&_0x1464b3[_0xb33a('0x7e')]===0x0){return db[_0xb33a('0x3b')]['create']({'name':_0x3ac462[_0xb33a('0x48')],'resourceId':_0x3ac462['id'],'type':_0x1464b3[_0xb33a('0x48')],'sectionId':_0x1464b3['id']},{})[_0xb33a('0x37')](function(){return _0x81c458;});}else{return _0x81c458;}})[_0xb33a('0x2c')](function(_0x4901ad){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4901ad);throw _0x4901ad;});}return _0x81c458;})[_0xb33a('0x37')](respondWithResult(_0x2966f4,0xc9))[_0xb33a('0x2c')](handleError(_0x2966f4,null));};exports[_0xb33a('0x7f')]=function(_0x4f9bd1,_0x596945,_0x3d5341){return db[_0xb33a('0x43')]['findOne']({'where':{'id':_0x4f9bd1[_0xb33a('0x5d')]['id']}})[_0xb33a('0x37')](handleEntityNotFound(_0x596945,null))[_0xb33a('0x37')](function(_0x559967){if(_0x559967){return _0x559967[_0xb33a('0x7f')]();}return null;})['then'](respondWithResult(_0x596945,null))[_0xb33a('0x2c')](handleError(_0x596945,null));};exports['addImap']=function(_0x48c5c2,_0x42f61c,_0x3250f5){if(_0x48c5c2[_0xb33a('0x61')]['id']){delete _0x48c5c2[_0xb33a('0x61')]['id'];}return db['MailAccount'][_0xb33a('0x60')]({'where':{'id':_0x48c5c2['params']['id']}})['then'](handleEntityNotFound(_0x42f61c,null))[_0xb33a('0x37')](function(_0x23a763){if(_0x23a763){_0x48c5c2[_0xb33a('0x61')][_0xb33a('0x65')]=_0x23a763['id'];return db[_0xb33a('0x3f')][_0xb33a('0x6c')](_0x48c5c2[_0xb33a('0x61')]);}})['then'](respondWithResult(_0x42f61c,null))['catch'](handleError(_0x42f61c,null));};exports[_0xb33a('0x80')]=function(_0x1bb605,_0x34fb71,_0x2f0a09){return db[_0xb33a('0x43')][_0xb33a('0x68')]({'where':{'id':_0x1bb605[_0xb33a('0x5d')]['id']}})[_0xb33a('0x37')](handleEntityNotFound(_0x34fb71,null))['then'](function(_0x5f4b19){if(_0x5f4b19){return _0x5f4b19[_0xb33a('0x81')](null);}return null;})[_0xb33a('0x37')](respondWithStatusCode(_0x34fb71,null))[_0xb33a('0x2c')](handleError(_0x34fb71,null));};exports[_0xb33a('0x82')]=function(_0x2bc0b9,_0x54f027,_0x1ce4e9){return db[_0xb33a('0x43')][_0xb33a('0x68')]({'where':{'id':_0x2bc0b9[_0xb33a('0x5d')]['id']}})[_0xb33a('0x37')](handleEntityNotFound(_0x54f027,null))[_0xb33a('0x37')](function(_0x8ef0f5){if(_0x8ef0f5){return _0x8ef0f5['getSmtp']();}return null;})[_0xb33a('0x37')](respondWithResult(_0x54f027,null))[_0xb33a('0x2c')](handleError(_0x54f027,null));};exports[_0xb33a('0x83')]=function(_0x4d6179,_0x3ab735,_0x1b4a5d){if(_0x4d6179[_0xb33a('0x61')]['id']){delete _0x4d6179[_0xb33a('0x61')]['id'];}return db[_0xb33a('0x43')][_0xb33a('0x60')]({'where':{'id':_0x4d6179[_0xb33a('0x5d')]['id']}})[_0xb33a('0x37')](handleEntityNotFound(_0x3ab735,null))['then'](function(_0x16e407){if(_0x16e407){_0x4d6179[_0xb33a('0x61')]['MailAccountId']=_0x16e407['id'];return db['MailServerOut'][_0xb33a('0x6c')](_0x4d6179[_0xb33a('0x61')]);}})[_0xb33a('0x37')](respondWithResult(_0x3ab735,null))[_0xb33a('0x2c')](handleError(_0x3ab735,null));};exports[_0xb33a('0x84')]=function(_0x531b6b,_0x53393a,_0x296ed2){return db[_0xb33a('0x43')][_0xb33a('0x68')]({'where':{'id':_0x531b6b['params']['id']}})[_0xb33a('0x37')](handleEntityNotFound(_0x53393a,null))[_0xb33a('0x37')](function(_0x1bfc38){if(_0x1bfc38){return _0x1bfc38[_0xb33a('0x85')](null);}return null;})['then'](respondWithStatusCode(_0x53393a,null))[_0xb33a('0x2c')](handleError(_0x53393a,null));};exports[_0xb33a('0x86')]=function(_0x234a63,_0x857635,_0x4be24f){return db['MailInteraction']['find']({'where':{'id':_0x234a63[_0xb33a('0x5d')]['id']}})[_0xb33a('0x37')](handleEntityNotFound(_0x857635,null))[_0xb33a('0x37')](function(_0x10a699){if(_0x10a699){return _0x10a699['addInteraction'](_0x234a63[_0xb33a('0x61')][_0xb33a('0x6a')],_['omit'](_0x234a63['body'],[_0xb33a('0x6a'),'id'])||{});}})['then'](respondWithResult(_0x857635,null))[_0xb33a('0x2c')](handleError(_0x857635,null));};exports['getInteractions']=function(_0xb886d1,_0x59a2ad,_0x42dd33){var _0x4c12c2={'raw':![],'where':{}};var _0x5a655c={};var _0x50319c={'count':0x0,'rows':[]};return db[_0xb33a('0x43')][_0xb33a('0x68')]({'where':{'id':_0xb886d1['params']['id']}})[_0xb33a('0x37')](handleEntityNotFound(_0x59a2ad,null))['then'](function(_0x2f2255){if(_0x2f2255){_0x5a655c[_0xb33a('0x46')]=_['keys'](db[_0xb33a('0x87')][_0xb33a('0x5f')]);_0x5a655c[_0xb33a('0x49')]=_['keys'](_0xb886d1[_0xb33a('0x49')]);_0x5a655c[_0xb33a('0x4b')]=_[_0xb33a('0x4c')](_0x5a655c[_0xb33a('0x46')],_0x5a655c[_0xb33a('0x49')]);_0x4c12c2[_0xb33a('0x4d')]=_['intersection'](_0x5a655c[_0xb33a('0x46')],qs[_0xb33a('0x4e')](_0xb886d1[_0xb33a('0x49')][_0xb33a('0x4e')]));_0x4c12c2[_0xb33a('0x4d')]=_0x4c12c2[_0xb33a('0x4d')][_0xb33a('0x4f')]?_0x4c12c2['attributes']:_0x5a655c['model'];if(!_0xb886d1['query']['hasOwnProperty'](_0xb33a('0x51'))){_0x4c12c2[_0xb33a('0x31')]=qs[_0xb33a('0x31')](_0xb886d1['query']['limit']);_0x4c12c2[_0xb33a('0x2f')]=qs[_0xb33a('0x2f')](_0xb886d1[_0xb33a('0x49')][_0xb33a('0x2f')]);}_0x4c12c2['order']=qs['sort'](_0xb886d1[_0xb33a('0x49')][_0xb33a('0x53')]);_0x4c12c2['where']=qs[_0xb33a('0x4b')](_[_0xb33a('0x88')](_0xb886d1[_0xb33a('0x49')],_0x5a655c['filters']));_0x4c12c2['where'][_0xb33a('0x65')]=_0x2f2255['id'];if(_0xb886d1[_0xb33a('0x49')]['filter']){_0x4c12c2[_0xb33a('0x54')]=_[_0xb33a('0x56')](_0x4c12c2[_0xb33a('0x54')],{'$or':_[_0xb33a('0x47')](_0x4c12c2['attributes'],function(_0x59be7c){var _0x41364c={};_0x41364c[_0x59be7c]={'$like':'%'+_0xb886d1[_0xb33a('0x49')][_0xb33a('0x55')]+'%'};return _0x41364c;})});}_0x4c12c2=_['merge']({},_0x4c12c2,_0xb886d1[_0xb33a('0x57')]);return db[_0xb33a('0x87')][_0xb33a('0x32')]({'where':_0x4c12c2[_0xb33a('0x54')]})['then'](function(_0x5dda94){_0x50319c[_0xb33a('0x32')]=_0x5dda94;if(_0xb886d1[_0xb33a('0x49')][_0xb33a('0x58')]){_0x4c12c2[_0xb33a('0x59')]=[{'model':db['CmContact'],'as':_0xb33a('0x89'),'required':![]},{'model':db['User'],'as':_0xb33a('0x8a'),'attributes':[_0xb33a('0x48'),_0xb33a('0x8b'),_0xb33a('0x8c')],'required':![]},{'model':db[_0xb33a('0x8d')],'as':_0xb33a('0x8e'),'attributes':['id',_0xb33a('0x48'),_0xb33a('0x8f')],'where':_0xb886d1[_0xb33a('0x49')][_0xb33a('0x90')]?{'id':_0xb886d1[_0xb33a('0x49')][_0xb33a('0x90')]}:undefined,'required':_0xb886d1[_0xb33a('0x49')][_0xb33a('0x90')]?!![]:![]}];}return db[_0xb33a('0x87')][_0xb33a('0x5a')](_0x4c12c2);})[_0xb33a('0x37')](function(_0x5b7327){_0x50319c[_0xb33a('0x5b')]=_0x5b7327;return _0x50319c;});}})[_0xb33a('0x37')](respondWithFilteredResult(_0x59a2ad,_0x4c12c2))[_0xb33a('0x2c')](handleError(_0x59a2ad,null));};exports[_0xb33a('0x91')]=function(_0x50cfc8,_0x24a630,_0x3565c1){return db[_0xb33a('0x43')]['findOne']({'where':{'id':_0x50cfc8[_0xb33a('0x5d')]['id']}})['then'](handleEntityNotFound(_0x24a630,null))['then'](function(_0x4a37bb){if(_0x4a37bb){return db[_0xb33a('0x92')][_0xb33a('0x93')](function(_0x5682ef){return db[_0xb33a('0x94')][_0xb33a('0x38')]({'where':{'MailAccountId':_0x50cfc8[_0xb33a('0x5d')]['id']},'transaction':_0x5682ef})[_0xb33a('0x37')](function(_0x55c951){var _0x2e8732=_[_0xb33a('0x47')](_0x50cfc8['body'],function(_0x1c94d2){_0x1c94d2[_0xb33a('0x65')]=_0x50cfc8[_0xb33a('0x5d')]['id'];return _0x1c94d2;});return db[_0xb33a('0x94')][_0xb33a('0x95')](_0x2e8732,{'transaction':_0x5682ef});});})['then'](function(){return db[_0xb33a('0x94')][_0xb33a('0x96')]({'where':{'MailAccountId':_0x50cfc8['params']['id']},'order':'priority'});});}})[_0xb33a('0x37')](respondWithResult(_0x24a630,null))[_0xb33a('0x2c')](handleError(_0x24a630,null));};exports[_0xb33a('0x97')]=function(_0x2cb83a,_0x13d356,_0x2e6208){var _0x1b9d65={};var _0x68a7c2={};var _0x1fd12f;var _0x10e6ec;return db[_0xb33a('0x43')][_0xb33a('0x68')]({'where':{'id':_0x2cb83a['params']['id']}})[_0xb33a('0x37')](handleEntityNotFound(_0x13d356,null))['then'](function(_0x5eb2ac){if(_0x5eb2ac){_0x1fd12f=_0x5eb2ac;_0x68a7c2['model']=_[_0xb33a('0x4a')](db[_0xb33a('0x94')][_0xb33a('0x5f')]);_0x68a7c2[_0xb33a('0x49')]=_[_0xb33a('0x4a')](_0x2cb83a['query']);_0x68a7c2[_0xb33a('0x4b')]=_[_0xb33a('0x4c')](_0x68a7c2[_0xb33a('0x46')],_0x68a7c2[_0xb33a('0x49')]);_0x1b9d65[_0xb33a('0x4d')]=_[_0xb33a('0x4c')](_0x68a7c2[_0xb33a('0x46')],qs[_0xb33a('0x4e')](_0x2cb83a[_0xb33a('0x49')][_0xb33a('0x4e')]));_0x1b9d65[_0xb33a('0x4d')]=_0x1b9d65[_0xb33a('0x4d')][_0xb33a('0x4f')]?_0x1b9d65['attributes']:_0x68a7c2[_0xb33a('0x46')];_0x1b9d65[_0xb33a('0x52')]=qs['sort'](_0x2cb83a[_0xb33a('0x49')][_0xb33a('0x53')]);_0x1b9d65[_0xb33a('0x54')]=qs[_0xb33a('0x4b')](_[_0xb33a('0x88')](_0x2cb83a[_0xb33a('0x49')],_0x68a7c2['filters']));if(_0x2cb83a['query'][_0xb33a('0x55')]){_0x1b9d65['where']=_[_0xb33a('0x56')](_0x1b9d65[_0xb33a('0x54')],{'$or':_[_0xb33a('0x47')](_0x1b9d65[_0xb33a('0x4d')],function(_0x33d6f4){var _0x2f24bf={};_0x2f24bf[_0x33d6f4]={'$like':'%'+_0x2cb83a[_0xb33a('0x49')]['filter']+'%'};return _0x2f24bf;})});}_0x1b9d65=_[_0xb33a('0x56')]({},_0x1b9d65,_0x2cb83a[_0xb33a('0x57')]);return _0x1fd12f[_0xb33a('0x97')](_0x1b9d65);}})['then'](function(_0x2c609c){if(_0x2c609c){_0x10e6ec=_0x2c609c[_0xb33a('0x4f')];if(!_0x2cb83a[_0xb33a('0x49')][_0xb33a('0x50')](_0xb33a('0x51'))){_0x1b9d65[_0xb33a('0x31')]=qs[_0xb33a('0x31')](_0x2cb83a['query'][_0xb33a('0x31')]);_0x1b9d65[_0xb33a('0x2f')]=qs[_0xb33a('0x2f')](_0x2cb83a[_0xb33a('0x49')][_0xb33a('0x2f')]);}return _0x1fd12f[_0xb33a('0x97')](_0x1b9d65);}})[_0xb33a('0x37')](function(_0x4f37b3){if(_0x4f37b3){return _0x4f37b3?{'count':_0x10e6ec,'rows':_0x4f37b3}:null;}})[_0xb33a('0x37')](respondWithResult(_0x13d356,null))[_0xb33a('0x2c')](handleError(_0x13d356,null));};exports[_0xb33a('0x98')]=function(_0x3c4e17,_0x5a0998,_0x5c4998){var _0x2b1c3d={'raw':!![],'where':{}};var _0x523f55={};var _0x2ff7f4={'count':0x0,'rows':[]};return db[_0xb33a('0x43')][_0xb33a('0x68')]({'where':{'id':_0x3c4e17[_0xb33a('0x5d')]['id']}})[_0xb33a('0x37')](handleEntityNotFound(_0x5a0998,null))[_0xb33a('0x37')](function(_0x2f9400){if(_0x2f9400){_0x523f55[_0xb33a('0x46')]=_[_0xb33a('0x4a')](db['MailMessage']['rawAttributes']);_0x523f55[_0xb33a('0x49')]=_[_0xb33a('0x4a')](_0x3c4e17['query']);_0x523f55['filters']=_[_0xb33a('0x4c')](_0x523f55[_0xb33a('0x46')],_0x523f55[_0xb33a('0x49')]);_0x2b1c3d['attributes']=_[_0xb33a('0x4c')](_0x523f55[_0xb33a('0x46')],qs[_0xb33a('0x4e')](_0x3c4e17[_0xb33a('0x49')][_0xb33a('0x4e')]));_0x2b1c3d[_0xb33a('0x4d')]=_0x2b1c3d[_0xb33a('0x4d')]['length']?_0x2b1c3d[_0xb33a('0x4d')]:_0x523f55['model'];if(!_0x3c4e17['query'][_0xb33a('0x50')](_0xb33a('0x51'))){_0x2b1c3d[_0xb33a('0x31')]=qs['limit'](_0x3c4e17[_0xb33a('0x49')]['limit']);_0x2b1c3d[_0xb33a('0x2f')]=qs[_0xb33a('0x2f')](_0x3c4e17[_0xb33a('0x49')]['offset']);}_0x2b1c3d['order']=qs[_0xb33a('0x53')](_0x3c4e17[_0xb33a('0x49')][_0xb33a('0x53')]);_0x2b1c3d[_0xb33a('0x54')]=qs[_0xb33a('0x4b')](_[_0xb33a('0x88')](_0x3c4e17['query'],_0x523f55['filters']));_0x2b1c3d[_0xb33a('0x54')]['MailAccountId']=_0x2f9400['id'];if(_0x3c4e17[_0xb33a('0x49')][_0xb33a('0x55')]){_0x2b1c3d[_0xb33a('0x54')]=_[_0xb33a('0x56')](_0x2b1c3d['where'],{'$or':_[_0xb33a('0x47')](_0x2b1c3d['attributes'],function(_0x82667a){var _0x2b84fb={};_0x2b84fb[_0x82667a]={'$like':'%'+_0x3c4e17[_0xb33a('0x49')]['filter']+'%'};return _0x2b84fb;})});}if(_0x3c4e17['query'][_0xb33a('0x99')]){var _0x510edb=_0x3c4e17[_0xb33a('0x49')]['$gte'][_0xb33a('0x9a')](',');var _0x2cc4cb={};_0x2cc4cb[_0x510edb[0x0]]={'$gte':moment(_0x510edb[0x1])[_0xb33a('0x9b')](_0xb33a('0x9c'))};_0x2b1c3d['where']=_['merge'](_0x2b1c3d[_0xb33a('0x54')],_0x2cc4cb);}_0x2b1c3d=_[_0xb33a('0x56')]({},_0x2b1c3d,_0x3c4e17['options']);return db[_0xb33a('0x9d')][_0xb33a('0x32')]({'where':_0x2b1c3d[_0xb33a('0x54')]})[_0xb33a('0x37')](function(_0x15ba5e){_0x2ff7f4[_0xb33a('0x32')]=_0x15ba5e;if(_0x3c4e17[_0xb33a('0x49')]['includeAll']){_0x2b1c3d[_0xb33a('0x59')]=[{'all':!![]}];}return db[_0xb33a('0x9d')]['findAll'](_0x2b1c3d);})[_0xb33a('0x37')](function(_0x1ebb04){if(_0x3c4e17[_0xb33a('0x49')][_0xb33a('0x9e')]==='true'){for(var _0x41bfba=0x0;_0x41bfba<_0x1ebb04[_0xb33a('0x4f')];_0x41bfba++){_0x1ebb04[_0x41bfba][_0xb33a('0x61')]=juice(_0x1ebb04[_0x41bfba]['body']);}}_0x2ff7f4['rows']=_0x1ebb04;return _0x2ff7f4;});}})[_0xb33a('0x37')](respondWithFilteredResult(_0x5a0998,_0x2b1c3d))['catch'](handleError(_0x5a0998,null));};exports[_0xb33a('0x3d')]=function(_0x44618f,_0x29d46f,_0x360836){var _0x5e4947,_0x44664a={},_0x196e07;if(_0x44618f[_0xb33a('0x61')]['to']){_0x196e07=_0x44618f[_0xb33a('0x61')]['to'][_0xb33a('0x9a')](',')[0x0];}return db[_0xb33a('0x43')][_0xb33a('0x60')]({'where':{'id':_0x44618f['params']['id']},'include':[{'model':db[_0xb33a('0x9f')],'as':_0xb33a('0xa0'),'include':[{'model':db[_0xb33a('0xa1')],'as':_0xb33a('0xa2'),'where':{'email':_0x196e07},'limit':0x1,'order':[[_0xb33a('0xa3'),_0xb33a('0xa4')]]}]},{'model':db[_0xb33a('0x41')],'as':'Smtp','raw':!![]}]})['then'](handleEntityNotFound(_0x29d46f,null))[_0xb33a('0x37')](function(_0xfb84e4){if(_0xfb84e4){_0x5e4947=_0xfb84e4;if(_0xfb84e4[_0xb33a('0x5e')]){if(_[_0xb33a('0x6e')](_0x44618f[_0xb33a('0x61')][_0xb33a('0xa5')])){_0x44618f[_0xb33a('0x61')]['from']=util[_0xb33a('0x9b')](_0xb33a('0xa6'),_0xfb84e4[_0xb33a('0x48')],_0xfb84e4[_0xb33a('0xa7')]||_0xfb84e4[_0xb33a('0x5e')]['user']);}if(_0x44618f['body'][_0xb33a('0xa8')]&&_0x44618f[_0xb33a('0x61')][_0xb33a('0xa8')][_0xb33a('0x4f')]){for(var _0x187f6d=0x0;_0x187f6d<_0x44618f[_0xb33a('0x61')]['attachments'][_0xb33a('0x4f')];_0x187f6d+=0x1){_0x44618f['body'][_0xb33a('0xa8')][_0x187f6d]={'filename':_0x44618f[_0xb33a('0x61')][_0xb33a('0xa8')][_0x187f6d][_0xb33a('0x48')],'path':path[_0xb33a('0xa9')](config[_0xb33a('0xaa')],_0xb33a('0xab'),_0x44618f[_0xb33a('0x61')][_0xb33a('0xa8')][_0x187f6d][_0xb33a('0xac')])};}}var _0x921231={'tls':{'rejectUnauthorized':![]}};if(_[_0xb33a('0x6e')](_0xfb84e4[_0xb33a('0x5e')][_0xb33a('0x79')])){if(_0xfb84e4[_0xb33a('0x5e')][_0xb33a('0x76')]){_0x921231[_0xb33a('0xad')]={'user':_0xfb84e4['Smtp'][_0xb33a('0x73')],'pass':_0xfb84e4[_0xb33a('0x5e')][_0xb33a('0xae')]};}_0x921231[_0xb33a('0x77')]=_0xfb84e4[_0xb33a('0x5e')][_0xb33a('0x77')];_0x921231[_0xb33a('0x78')]=_0xfb84e4[_0xb33a('0x5e')]['port'];_0x921231['secure']=_0xfb84e4[_0xb33a('0x5e')][_0xb33a('0xaf')];}else{_0x921231[_0xb33a('0x79')]=_0xfb84e4['Smtp']['service'];_0x921231[_0xb33a('0xad')]={'user':_0xfb84e4[_0xb33a('0x5e')]['user'],'pass':_0xfb84e4[_0xb33a('0x5e')][_0xb33a('0xae')]};}return respondWithRpcPromise('SendMail',_0xb33a('0xb0'),{'account':_0x921231,'message':_0x44618f[_0xb33a('0x61')]});}else{throw new Error('List\x20not\x20found');}}})[_0xb33a('0x37')](function(_0x5893e6){if(_0x5893e6){_0x44664a=_0x5893e6;if(_0x5e4947[_0xb33a('0xa0')]){if(_0x5e4947['List'][_0xb33a('0xa2')][_0xb33a('0x4f')]){return _0x5e4947[_0xb33a('0xa0')]['Contacts'][0x0];}else{return db[_0xb33a('0xa1')][_0xb33a('0x6c')](_[_0xb33a('0x1e')](_0x44618f[_0xb33a('0x61')],{'firstName':_0x44618f[_0xb33a('0x61')]['to'],'email':_0x44618f['body']['to'],'phone':_0x44618f['body']['to'],'ListId':_0x5e4947['ListId']}));}}else{throw new Error(_0xb33a('0xb1'));}}})['then'](function(_0x253818){if(_0x253818){var _0x42e2ed={'UserId':_0x44618f[_0xb33a('0x73')]['id'],'ContactId':_0x253818['id'],'MailAccountId':_0x5e4947['id'],'inReplyTo':_0x44664a[_0xb33a('0xb2')],'to':_0x44618f['body'][_0xb33a('0xa5')],'cc':_0x44618f['body']['cc'],'subject':_0x44618f['body']['subject'],'attach':_0x44618f[_0xb33a('0x61')][_0xb33a('0xb3')],'firstMsgDirection':_0xb33a('0xb4'),'lastMsgAt':moment()[_0xb33a('0x9b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xb33a('0xb4'),'Messages':[_[_0xb33a('0x56')](_0x44618f[_0xb33a('0x61')],{'messageId':_0x44664a[_0xb33a('0xb2')],'sentAt':moment()[_0xb33a('0x9b')](_0xb33a('0x9c')),'read':!![],'MailAccountId':_0x5e4947['id'],'UserId':_0x44618f['user']['id'],'ContactId':_0x253818['id']})]};if(_0x44618f[_0xb33a('0x61')][_0xb33a('0xb5')]){_0x42e2ed=_[_0xb33a('0x56')](_0x42e2ed,_0x44618f[_0xb33a('0x61')]['Interaction']);}return db['MailInteraction'][_0xb33a('0x6c')](_0x42e2ed,{'include':[{'model':db[_0xb33a('0x9d')],'as':_0xb33a('0xb6')}]});}})[_0xb33a('0x37')](respondWithResult(_0x29d46f,null))['catch'](handleError(_0x29d46f,null));};exports[_0xb33a('0xb7')]=function(_0xb58ef7,_0x2e9fae,_0x3daae1){return db[_0xb33a('0x43')][_0xb33a('0x60')]({'where':{'id':_0xb58ef7[_0xb33a('0x5d')]['id']},'include':[{'model':db[_0xb33a('0x41')],'as':_0xb33a('0x5e'),'raw':!![]}]})[_0xb33a('0x37')](handleEntityNotFound(_0x2e9fae,null))[_0xb33a('0x37')](function(_0x3c1255){if(_0x3c1255&&_0x3c1255[_0xb33a('0x5e')]){var _0x30cb6b={'id':_0x3c1255['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3c1255[_0xb33a('0x5e')][_0xb33a('0x79')]){_0x30cb6b[_0xb33a('0x79')]=_0x3c1255[_0xb33a('0x5e')]['service'];}else{_0x30cb6b[_0xb33a('0x77')]=_0x3c1255[_0xb33a('0x5e')][_0xb33a('0x77')];_0x30cb6b[_0xb33a('0x78')]=_0x3c1255[_0xb33a('0x5e')][_0xb33a('0x78')];_0x30cb6b['secure']=_0x3c1255[_0xb33a('0x5e')][_0xb33a('0xaf')];}if(_0x3c1255[_0xb33a('0x5e')][_0xb33a('0x76')]){_0x30cb6b[_0xb33a('0xad')]={'user':_0x3c1255['Smtp'][_0xb33a('0x73')],'pass':_0x3c1255[_0xb33a('0x5e')][_0xb33a('0xae')]};}return respondWithRpcPromise(_0xb33a('0xb8'),_0xb33a('0xb7'),{'account':_0x30cb6b});}})['then'](respondWithResult(_0x2e9fae,null))[_0xb33a('0x2c')](handleError(_0x2e9fae,null));};exports[_0xb33a('0x38')]=function(_0x49c0df,_0x19fcd9){return db[_0xb33a('0x43')][_0xb33a('0x60')]({'where':{'id':_0x49c0df['params']['id']}})['then'](handleEntityNotFound(_0x19fcd9,null))[_0xb33a('0x37')](function(_0x10bf77){if(_0x10bf77&&_0x10bf77[_0xb33a('0x79')]){throw new db[(_0xb33a('0xb9'))][(_0xb33a('0xba'))](_0xb33a('0xbb'));}return _0x10bf77;})[_0xb33a('0x37')](removeEntity(_0x19fcd9,null))[_0xb33a('0x2c')](handleError(_0x19fcd9,null));};exports['addAgents']=function(_0x3ac310,_0x399895,_0x52e087){return db[_0xb33a('0x43')][_0xb33a('0x60')]({'where':{'id':_0x3ac310[_0xb33a('0x5d')]['id']}})[_0xb33a('0x37')](handleEntityNotFound(_0x399895,null))['then'](function(_0x4902c4){if(_0x4902c4){return _0x4902c4[_0xb33a('0xbc')](_0x3ac310[_0xb33a('0x61')][_0xb33a('0x6a')],_[_0xb33a('0xbd')](_0x3ac310[_0xb33a('0x61')],[_0xb33a('0x6a'),'id'])||{})[_0xb33a('0xbe')](function(_0x4e04a9){for(var _0x95a6e7=0x0;_0x95a6e7<_0x3ac310[_0xb33a('0x61')]['ids']['length'];_0x95a6e7+=0x1){socket[_0xb33a('0xbf')](_0xb33a('0xc0'),{'UserId':Number(_0x3ac310[_0xb33a('0x61')]['ids'][_0x95a6e7]),'MailAccountId':Number(_0x3ac310[_0xb33a('0x5d')]['id'])});}return _0x4e04a9;});}})[_0xb33a('0x37')](respondWithResult(_0x399895,null))[_0xb33a('0x2c')](handleError(_0x399895,null));};exports['removeAgents']=function(_0x3dd82e,_0x76b878,_0x4d4c6c){return db['MailAccount'][_0xb33a('0x60')]({'where':{'id':_0x3dd82e[_0xb33a('0x5d')]['id']}})['then'](handleEntityNotFound(_0x76b878,null))['then'](function(_0x190f45){if(_0x190f45){return _0x190f45[_0xb33a('0xc1')](_0x3dd82e[_0xb33a('0x49')][_0xb33a('0x6a')])[_0xb33a('0x37')](function(){if(_[_0xb33a('0xc2')](_0x3dd82e[_0xb33a('0x49')][_0xb33a('0x6a')])){for(var _0x2c47d6=0x0;_0x2c47d6<_0x3dd82e['query'][_0xb33a('0x6a')][_0xb33a('0x4f')];_0x2c47d6+=0x1){socket['emit'](_0xb33a('0xc3'),{'UserId':Number(_0x3dd82e[_0xb33a('0x49')][_0xb33a('0x6a')][_0x2c47d6]),'MailAccountId':Number(_0x3dd82e['params']['id'])});}}else{socket[_0xb33a('0xbf')]('userMailAccount:remove',{'UserId':Number(_0x3dd82e[_0xb33a('0x49')][_0xb33a('0x6a')]),'MailAccountId':Number(_0x3dd82e[_0xb33a('0x5d')]['id'])});}});}})[_0xb33a('0x37')](respondWithStatusCode(_0x76b878,null))[_0xb33a('0x2c')](handleError(_0x76b878,null));};exports[_0xb33a('0xc4')]=function(_0x585fe8,_0x38ab4d,_0x18aa3c){var _0x3ec26a={};var _0x1446bd={};var _0xafc218;var _0x70a81c;return db[_0xb33a('0x43')][_0xb33a('0x68')]({'where':{'id':_0x585fe8['params']['id']}})[_0xb33a('0x37')](handleEntityNotFound(_0x38ab4d,null))['then'](function(_0x1981e8){if(_0x1981e8){_0xafc218=_0x1981e8;_0x1446bd[_0xb33a('0x46')]=_[_0xb33a('0x4a')](db['User'][_0xb33a('0x5f')]);_0x1446bd['query']=_[_0xb33a('0x4a')](_0x585fe8[_0xb33a('0x49')]);_0x1446bd[_0xb33a('0x4b')]=_['intersection'](_0x1446bd[_0xb33a('0x46')],_0x1446bd[_0xb33a('0x49')]);_0x3ec26a['attributes']=_[_0xb33a('0x4c')](_0x1446bd[_0xb33a('0x46')],qs[_0xb33a('0x4e')](_0x585fe8['query'][_0xb33a('0x4e')]));_0x3ec26a[_0xb33a('0x4d')]=_0x3ec26a[_0xb33a('0x4d')][_0xb33a('0x4f')]?_0x3ec26a[_0xb33a('0x4d')]:_0x1446bd[_0xb33a('0x46')];_0x3ec26a[_0xb33a('0x52')]=qs['sort'](_0x585fe8[_0xb33a('0x49')][_0xb33a('0x53')]);_0x3ec26a[_0xb33a('0x54')]=qs[_0xb33a('0x4b')](_[_0xb33a('0x88')](_0x585fe8[_0xb33a('0x49')],_0x1446bd['filters']));if(_0x585fe8[_0xb33a('0x49')][_0xb33a('0x55')]){_0x3ec26a[_0xb33a('0x54')]=_[_0xb33a('0x56')](_0x3ec26a[_0xb33a('0x54')],{'$or':_['map'](_0x3ec26a[_0xb33a('0x4d')],function(_0x57e365){var _0x363882={};_0x363882[_0x57e365]={'$like':'%'+_0x585fe8[_0xb33a('0x49')]['filter']+'%'};return _0x363882;})});}_0x3ec26a=_['merge']({},_0x3ec26a,_0x585fe8[_0xb33a('0x57')]);return _0xafc218[_0xb33a('0xc4')](_0x3ec26a);}})['then'](function(_0x35bd9d){if(_0x35bd9d){_0x70a81c=_0x35bd9d[_0xb33a('0x4f')];if(!_0x585fe8[_0xb33a('0x49')]['hasOwnProperty'](_0xb33a('0x51'))){_0x3ec26a[_0xb33a('0x31')]=qs[_0xb33a('0x31')](_0x585fe8['query'][_0xb33a('0x31')]);_0x3ec26a[_0xb33a('0x2f')]=qs[_0xb33a('0x2f')](_0x585fe8[_0xb33a('0x49')][_0xb33a('0x2f')]);}return _0xafc218[_0xb33a('0xc4')](_0x3ec26a);}})[_0xb33a('0x37')](function(_0x23535d){if(_0x23535d){return _0x23535d?{'count':_0x70a81c,'rows':_0x23535d}:null;}})[_0xb33a('0x37')](respondWithResult(_0x38ab4d,null))['catch'](handleError(_0x38ab4d,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 24f68ac..2592e2b 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 _0xbcba=['events','../../mysqldb','MailAccount','update','emit','exports'];(function(_0x4e84d3,_0x1add05){var _0x1a0df6=function(_0x7c5212){while(--_0x7c5212){_0x4e84d3['push'](_0x4e84d3['shift']());}};_0x1a0df6(++_0x1add05);}(_0xbcba,0x198));var _0xabcb=function(_0x67ee2,_0x46cae5){_0x67ee2=_0x67ee2-0x0;var _0x1dc091=_0xbcba[_0x67ee2];return _0x1dc091;};'use strict';var EventEmitter=require(_0xabcb('0x0'));var MailAccount=require(_0xabcb('0x1'))['db'][_0xabcb('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xabcb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4025be){return function(_0x473eb8,_0x481ed8,_0x1e0568){MailAccountEvents[_0xabcb('0x4')](_0x4025be+':'+_0x473eb8['id'],_0x473eb8);MailAccountEvents[_0xabcb('0x4')](_0x4025be,_0x473eb8);_0x1e0568(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xabcb('0x5')]=MailAccountEvents; \ No newline at end of file +var _0x6209=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save','update','remove'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x6209,0x1e8));var _0x9620=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x6209[_0xbca1b1];return _0x4e1686;};'use strict';var EventEmitter=require(_0x9620('0x0'));var MailAccount=require(_0x9620('0x1'))['db'][_0x9620('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x9620('0x3')](0x0);var events={'afterCreate':_0x9620('0x4'),'afterUpdate':_0x9620('0x5'),'afterDestroy':_0x9620('0x6')};function emitEvent(_0x5deb40){return function(_0x2869e2,_0x17dc92,_0x2fa00b){MailAccountEvents['emit'](_0x5deb40+':'+_0x2869e2['id'],_0x2869e2);MailAccountEvents[_0x9620('0x7')](_0x5deb40,_0x2869e2);_0x2fa00b(null);};}for(var e in events){if(events[_0x9620('0x8')](e)){var event=events[e];MailAccount[_0x9620('0x9')](e,emitEvent(event));}}module[_0x9620('0xa')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 2866b53..c761388 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 _0x7dc5=['mail_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailAccount.attributes','exports','define'];(function(_0x1bc2d6,_0x1257d3){var _0x559744=function(_0x537bad){while(--_0x537bad){_0x1bc2d6['push'](_0x1bc2d6['shift']());}};_0x559744(++_0x1257d3);}(_0x7dc5,0xfd));var _0x57dc=function(_0x2991ea,_0x4a0231){_0x2991ea=_0x2991ea-0x0;var _0x4e1c51=_0x7dc5[_0x2991ea];return _0x4e1c51;};'use strict';var _=require(_0x57dc('0x0'));var util=require('util');var logger=require(_0x57dc('0x1'))(_0x57dc('0x2'));var moment=require(_0x57dc('0x3'));var BPromise=require(_0x57dc('0x4'));var rp=require(_0x57dc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x57dc('0x6'));var config=require(_0x57dc('0x7'));var attributes=require(_0x57dc('0x8'));module[_0x57dc('0x9')]=function(_0x5b5305,_0x433422){return _0x5b5305[_0x57dc('0xa')]('MailAccount',attributes,{'tableName':_0x57dc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9524=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailAccount.attributes','define','MailAccount','mail_accounts'];(function(_0x597560,_0x19c4db){var _0x35c31f=function(_0x300bd2){while(--_0x300bd2){_0x597560['push'](_0x597560['shift']());}};_0x35c31f(++_0x19c4db);}(_0x9524,0x138));var _0x4952=function(_0x54a679,_0x2a1df6){_0x54a679=_0x54a679-0x0;var _0x4b2c03=_0x9524[_0x54a679];return _0x4b2c03;};'use strict';var _=require(_0x4952('0x0'));var util=require(_0x4952('0x1'));var logger=require(_0x4952('0x2'))(_0x4952('0x3'));var moment=require(_0x4952('0x4'));var BPromise=require(_0x4952('0x5'));var rp=require(_0x4952('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4952('0x7'));var config=require(_0x4952('0x8'));var attributes=require(_0x4952('0x9'));module['exports']=function(_0x2e566d,_0x50036d){return _0x2e566d[_0x4952('0xa')](_0x4952('0xb'),attributes,{'tableName':_0x4952('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 186ed4b..8f7db77 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 _0x08d9=['orderBy','priority','asc','autoclose','*,*,*,*','Contacts','length','create','List\x20not\x20found','contact','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inReplyTo','MailInteraction','spread','attach','interaction','created','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','User','UserId','unshift','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','MailAccount','findAll','options','raw','where','attributes','limit','map','include','model','debug','GetMailAccount','ShowMailAccount','find','NotifyMailAccount','body','mail','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','CmList','List','CmContact','MailApplication','Applications','MailServerOut','get','omit','list','applications'];(function(_0x2980de,_0x1426a4){var _0x81a4ca=function(_0x19040e){while(--_0x19040e){_0x2980de['push'](_0x2980de['shift']());}};_0x81a4ca(++_0x1426a4);}(_0x08d9,0x163));var _0x908d=function(_0x19c75b,_0x1c5a1d){_0x19c75b=_0x19c75b-0x0;var _0x4ad109=_0x08d9[_0x19c75b];return _0x4ad109;};'use strict';var _=require(_0x908d('0x0'));var util=require(_0x908d('0x1'));var moment=require(_0x908d('0x2'));var BPromise=require(_0x908d('0x3'));var rs=require(_0x908d('0x4'));var fs=require('fs');var Redis=require(_0x908d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x908d('0x6'));var logger=require(_0x908d('0x7'))(_0x908d('0x8'));var config=require(_0x908d('0x9'));var jayson=require(_0x908d('0xa'));var client=jayson[_0x908d('0xb')][_0x908d('0xc')]({'port':0x232c});config[_0x908d('0xd')]=_[_0x908d('0xe')](config[_0x908d('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x908d('0xf'))(new Redis(config[_0x908d('0xd')]));require(_0x908d('0x10'))[_0x908d('0x11')](socket);function respondWithRpcPromise(_0x5abb6c,_0x50d707,_0x592da1){return new BPromise(function(_0xd6dc4f,_0x2f91b2){return client[_0x908d('0x12')](_0x5abb6c,_0x592da1)[_0x908d('0x13')](function(_0xec11c5){logger[_0x908d('0x14')](_0x908d('0x15'),_0x50d707,_0x908d('0x16'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x50d707,_0x908d('0x16'),JSON[_0x908d('0x17')](_0xec11c5));if(_0xec11c5[_0x908d('0x18')]){if(_0xec11c5[_0x908d('0x18')]['code']===0x1f4){logger[_0x908d('0x18')](_0x908d('0x15'),_0x50d707,_0xec11c5['error'][_0x908d('0x19')]);return _0x2f91b2(_0xec11c5['error'][_0x908d('0x19')]);}logger[_0x908d('0x18')](_0x908d('0x15'),_0x50d707,_0xec11c5[_0x908d('0x18')][_0x908d('0x19')]);return _0xd6dc4f(_0xec11c5[_0x908d('0x18')][_0x908d('0x19')]);}else{logger[_0x908d('0x14')]('MailAccount,\x20%s,\x20%s',_0x50d707,_0x908d('0x16'));_0xd6dc4f(_0xec11c5[_0x908d('0x1a')][_0x908d('0x19')]);}})[_0x908d('0x1b')](function(_0x32446f){logger[_0x908d('0x18')](_0x908d('0x15'),_0x50d707,_0x32446f);_0x2f91b2(_0x32446f);});});}exports['GetMailAccount']=function(_0x221fc9){var _0x3929be=this;return new Promise(function(_0x6aeb38,_0x2b6b87){return db[_0x908d('0x1c')][_0x908d('0x1d')]({'raw':_0x221fc9[_0x908d('0x1e')]?_0x221fc9[_0x908d('0x1e')][_0x908d('0x1f')]===undefined?!![]:![]:!![],'where':_0x221fc9[_0x908d('0x1e')]?_0x221fc9[_0x908d('0x1e')][_0x908d('0x20')]||null:null,'attributes':_0x221fc9[_0x908d('0x1e')]?_0x221fc9[_0x908d('0x1e')][_0x908d('0x21')]||null:null,'limit':_0x221fc9['options']?_0x221fc9[_0x908d('0x1e')][_0x908d('0x22')]||null:null,'include':_0x221fc9[_0x908d('0x1e')]?_0x221fc9[_0x908d('0x1e')]['include']?_[_0x908d('0x23')](_0x221fc9[_0x908d('0x1e')][_0x908d('0x24')],function(_0xbdf9eb){return{'model':db[_0xbdf9eb['model']],'as':_0xbdf9eb['as'],'attributes':_0xbdf9eb[_0x908d('0x21')],'include':_0xbdf9eb['include']?_[_0x908d('0x23')](_0xbdf9eb[_0x908d('0x24')],function(_0xeacaf6){return{'model':db[_0xeacaf6[_0x908d('0x25')]],'as':_0xeacaf6['as'],'attributes':_0xeacaf6[_0x908d('0x21')],'include':_0xeacaf6[_0x908d('0x24')]?_[_0x908d('0x23')](_0xeacaf6['include'],function(_0x467d6c){return{'model':db[_0x467d6c['model']],'as':_0x467d6c['as'],'attributes':_0x467d6c[_0x908d('0x21')]};}):[]};}):[]};}):[]:[]})[_0x908d('0x13')](function(_0x4cfc2){logger['info']('GetMailAccount',_0x221fc9);logger[_0x908d('0x26')](_0x908d('0x27'),_0x221fc9,JSON['stringify'](_0x4cfc2));_0x6aeb38(_0x4cfc2);})[_0x908d('0x1b')](function(_0x40109b){logger['error']('GetMailAccount',_0x40109b[_0x908d('0x19')],_0x221fc9);_0x2b6b87(_0x3929be['error'](0x1f4,_0x40109b[_0x908d('0x19')]));});});};exports[_0x908d('0x28')]=function(_0x249ae0){var _0x4771a4=this;return new Promise(function(_0x59ae95,_0x5a651b){return db[_0x908d('0x1c')][_0x908d('0x29')]({'raw':_0x249ae0[_0x908d('0x1e')]?_0x249ae0['options'][_0x908d('0x1f')]===undefined?!![]:![]:!![],'where':_0x249ae0[_0x908d('0x1e')]?_0x249ae0[_0x908d('0x1e')][_0x908d('0x20')]||null:null,'attributes':_0x249ae0[_0x908d('0x1e')]?_0x249ae0[_0x908d('0x1e')][_0x908d('0x21')]||null:null,'include':_0x249ae0[_0x908d('0x1e')]?_0x249ae0['options']['include']?_[_0x908d('0x23')](_0x249ae0[_0x908d('0x1e')][_0x908d('0x24')],function(_0x3d3f9f){return{'model':db[_0x3d3f9f['model']],'as':_0x3d3f9f['as'],'attributes':_0x3d3f9f[_0x908d('0x21')],'include':_0x3d3f9f['include']?_[_0x908d('0x23')](_0x3d3f9f['include'],function(_0x20751a){return{'model':db[_0x20751a[_0x908d('0x25')]],'as':_0x20751a['as'],'attributes':_0x20751a[_0x908d('0x21')],'include':_0x20751a[_0x908d('0x24')]?_[_0x908d('0x23')](_0x20751a[_0x908d('0x24')],function(_0x3c1008){return{'model':db[_0x3c1008[_0x908d('0x25')]],'as':_0x3c1008['as'],'attributes':_0x3c1008[_0x908d('0x21')]};}):[]};}):[]};}):[]:[]})[_0x908d('0x13')](function(_0x47964a){logger[_0x908d('0x14')](_0x908d('0x28'),_0x249ae0);logger[_0x908d('0x26')]('ShowMailAccount',_0x249ae0,JSON[_0x908d('0x17')](_0x47964a));_0x59ae95(_0x47964a);})[_0x908d('0x1b')](function(_0x4c4049){logger[_0x908d('0x18')](_0x908d('0x28'),_0x4c4049[_0x908d('0x19')],_0x249ae0);_0x5a651b(_0x4771a4[_0x908d('0x18')](0x1f4,_0x4c4049[_0x908d('0x19')]));});});};exports[_0x908d('0x2a')]=function(_0x340a12){var _0xed879f=this;return new Promise(function(_0x74870b,_0x21be2d){var _0xa17e5e={'body':_0x340a12[_0x908d('0x2b')],'channel':_0x908d('0x2c')};var _0x26f8a0=_[_0x908d('0x2d')](_[_0x908d('0x2e')](db['CmContact'][_0x908d('0x2f')]),[_0x908d('0x30'),_0x908d('0x31'),_0x908d('0x32'),_0x908d('0x33')]);var _0x551d42=![];if(_0x340a12[_0x908d('0x2b')]['id']){delete _0x340a12['body']['id'];}if(_['isNil'](_0x340a12['body']['from'])){return _0x21be2d(_0xed879f[_0x908d('0x18')](0x1f4,'from\x20is\x20mandatory'));}if(_['isNil'](_0x340a12[_0x908d('0x2b')][_0x908d('0x2b')])||_0x340a12['body'][_0x908d('0x2b')]===''){return _0x21be2d(_0xed879f['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x908d('0x34')](_0x340a12[_0x908d('0x2b')][_0x908d('0x35')])){return _0x21be2d(_0xed879f[_0x908d('0x18')](0x1f4,_0x908d('0x36')+_0x26f8a0));}if(!_[_0x908d('0x37')](_0x26f8a0,_0x340a12[_0x908d('0x2b')][_0x908d('0x35')])){return _0x21be2d(_0xed879f[_0x908d('0x18')](0x1f4,_0x908d('0x38')+_0x26f8a0));}var _0x55cee8={};_0x55cee8[_0x340a12['body'][_0x908d('0x35')]]=_0x340a12['body'][_0x908d('0x39')];return db[_0x908d('0x1c')][_0x908d('0x29')]({'where':{'id':_0x340a12[_0x908d('0x3a')]['id']},'include':[{'model':db[_0x908d('0x3b')],'as':_0x908d('0x3c'),'include':[{'model':db[_0x908d('0x3d')],'as':'Contacts','where':_0x55cee8,'limit':0x1,'order':[[_0x908d('0x31'),'DESC']]}]},{'model':db[_0x908d('0x3e')],'as':_0x908d('0x3f')},{'model':db[_0x908d('0x40')],'as':'Smtp'}]})[_0x908d('0x13')](function(_0x2ea6bb){if(_0x2ea6bb&&_0x2ea6bb[_0x908d('0x3c')]){var _0x359c7c=_0x2ea6bb[_0x908d('0x41')]({'plain':!![]});_0xa17e5e['account']=_[_0x908d('0x42')](_0x359c7c,['Applications',_0x908d('0x3c')]);_0xa17e5e['applications']=_0x359c7c['Applications'];_0xa17e5e[_0x908d('0x43')]=_0x359c7c[_0x908d('0x3c')];_0xa17e5e[_0x908d('0x44')]=_[_0x908d('0x45')](_0xa17e5e[_0x908d('0x44')],[_0x908d('0x46')],[_0x908d('0x47')]);if(_0xa17e5e[_0x908d('0x3a')]&&_0xa17e5e[_0x908d('0x3a')][_0x908d('0x48')]){_0xa17e5e[_0x908d('0x44')]['push']({'id':0x0,'priority':_0xa17e5e['applications']['length']+0x1,'app':'close','appdata':'autoclose','interval':_0x908d('0x49')});}if(_0xa17e5e[_0x908d('0x3a')]['Applications']){delete _0xa17e5e[_0x908d('0x3a')][_0x908d('0x3f')];}if(_0xa17e5e[_0x908d('0x3a')]['List']){delete _0xa17e5e['account'][_0x908d('0x3c')];}if(_0x359c7c['List'][_0x908d('0x4a')][_0x908d('0x4b')]){return _0x359c7c[_0x908d('0x3c')][_0x908d('0x4a')][0x0];}var _0x33071b=_[_0x908d('0xe')](_0x340a12[_0x908d('0x2b')],{'firstName':_0x340a12[_0x908d('0x2b')][_0x908d('0x39')],'ListId':_0x359c7c[_0x908d('0x33')]});_0x33071b[_0x340a12['body'][_0x908d('0x35')]]=_0x340a12[_0x908d('0x2b')][_0x908d('0x39')];return db['CmContact'][_0x908d('0x4c')](_0x33071b);}else{throw new Error(_0x908d('0x4d'));}})[_0x908d('0x13')](function(_0x35fbf1){_0xa17e5e[_0x908d('0x4e')]=_0x35fbf1;if(_0x35fbf1){if(!_0x340a12[_0x908d('0x2b')][_0x908d('0x19')]['messageId']){_0x340a12['body']['message'][_0x908d('0x4f')]=rs[_0x908d('0x50')]()+'\x20'+_0x340a12[_0x908d('0x2b')][_0x908d('0x19')][_0x908d('0x39')];}var _0x50f82d={'ContactId':_0x35fbf1['id'],'MailAccountId':_0x340a12[_0x908d('0x3a')]['id'],'inReplyTo':_0x340a12[_0x908d('0x2b')][_0x908d('0x19')][_0x908d('0x4f')],'to':_0x340a12[_0x908d('0x2b')]['message'][_0x908d('0x39')],'cc':_0x340a12['body'][_0x908d('0x19')]['cc'],'subject':_0x340a12[_0x908d('0x2b')]['message'][_0x908d('0x51')],'attach':_0x340a12[_0x908d('0x2b')][_0x908d('0x19')]['attach'],'lastMsgAt':moment()[_0x908d('0x52')](_0x908d('0x53')),'lastMsgDirection':'in'};return db['MailInteraction'][_0x908d('0x29')]({'where':{'closed':![],'MailAccountId':_0x340a12[_0x908d('0x3a')]['id']},'include':[{'model':db[_0x908d('0x54')],'as':'Messages','attributes':[_0x908d('0x4f')],'where':{'messageId':_0x340a12[_0x908d('0x2b')][_0x908d('0x19')][_0x908d('0x55')]}}]})['then'](function(_0x1e7a37){if(_0x1e7a37){return[_0x1e7a37,![]];}return db[_0x908d('0x56')]['create'](_0x50f82d)[_0x908d('0x13')](function(_0x3ef5de){return[_0x3ef5de,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x908d('0x57')](function(_0x21c090,_0x5c8d00){if(_0x21c090){_0x551d42=_0x5c8d00;if(!_0x5c8d00){return _0x21c090['update']({'inReplyTo':_0x340a12[_0x908d('0x2b')][_0x908d('0x19')][_0x908d('0x4f')],'to':_0x340a12[_0x908d('0x2b')]['message']['from'],'cc':_0x340a12[_0x908d('0x2b')][_0x908d('0x19')]['cc'],'subject':_0x340a12['body'][_0x908d('0x19')][_0x908d('0x51')],'attach':_0x21c090[_0x908d('0x58')]?_0x21c090['attach']:_0x340a12[_0x908d('0x2b')]['message'][_0x908d('0x58')],'substatus':null,'substatusAt':moment()[_0x908d('0x52')](_0x908d('0x53')),'lastMsgAt':moment()['format'](_0x908d('0x53')),'lastMsgDirection':'in'});}else{return _0x21c090;}}})[_0x908d('0x13')](function(_0x5057a9){_0xa17e5e[_0x908d('0x59')]=_0x5057a9[_0x908d('0x41')]({'plain':!![]});_0xa17e5e['interaction'][_0x908d('0x5a')]=_0x551d42;return db['MailMessage'][_0x908d('0x4c')]({'body':_0x340a12[_0x908d('0x2b')][_0x908d('0x2b')],'MailAccountId':_0x340a12[_0x908d('0x3a')]['id'],'MailInteractionId':_0x5057a9['id'],'direction':'in','ContactId':_0xa17e5e[_0x908d('0x4e')]['id'],'messageId':_0x340a12['body']['message']['messageId'],'from':_0x340a12[_0x908d('0x2b')][_0x908d('0x19')][_0x908d('0x39')],'to':_0x340a12[_0x908d('0x2b')]['message']['to'],'cc':_0x340a12['body'][_0x908d('0x19')]['cc'],'subject':_0x340a12['body'][_0x908d('0x19')]['subject'],'attach':_0x340a12[_0x908d('0x2b')][_0x908d('0x19')][_0x908d('0x58')],'Attachments':_0x340a12[_0x908d('0x2b')]['message'][_0x908d('0x5b')],'originTo':_0x340a12[_0x908d('0x2b')][_0x908d('0x19')][_0x908d('0x5c')],'originCc':_0x340a12[_0x908d('0x2b')][_0x908d('0x19')][_0x908d('0x5d')],'bcc':_0x340a12['body'][_0x908d('0x19')][_0x908d('0x5e')],'ChatWebsiteId':_0x340a12['body'][_0x908d('0x19')][_0x908d('0x5f')]||null,'originChannel':_0x340a12[_0x908d('0x2b')][_0x908d('0x19')][_0x908d('0x60')]||_0x908d('0x61'),'ChatOfflineMessageId':_0x340a12[_0x908d('0x2b')][_0x908d('0x19')][_0x908d('0x62')]||null},{'include':[{'model':db['Attachment'],'as':'Attachments'}]});})['then'](function(_0x228d46){_0xa17e5e[_0x908d('0x19')]=_0x228d46;if(_0xa17e5e[_0x908d('0x59')]['UserId']){return db[_0x908d('0x63')][_0x908d('0x29')]({'attributes':['id','name'],'where':{'id':_0xa17e5e[_0x908d('0x59')][_0x908d('0x64')]}})[_0x908d('0x13')](function(_0x3fc490){if(_0x3fc490){_0xa17e5e[_0x908d('0x44')][_0x908d('0x65')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3fc490[_0x908d('0x66')]+','+(_0xa17e5e['account'][_0x908d('0x67')]||0xa),'interval':_0x908d('0x49')});}return respondWithRpcPromise(_0x908d('0x68'),'startRouting',_0xa17e5e);});}return respondWithRpcPromise(_0x908d('0x68'),_0x908d('0x69'),_0xa17e5e);})[_0x908d('0x13')](function(_0x50a5fa){_0x74870b(_0x50a5fa);})[_0x908d('0x1b')](function(_0x4db5d5){_0x21be2d(_0xed879f['error'](0x1f4,_0x4db5d5[_0x908d('0x19')]));});});}; \ No newline at end of file +var _0xdfe2=['result','GetMailAccount','MailAccount','findAll','options','where','attributes','limit','map','include','model','catch','ShowMailAccount','raw','NotifyMailAccount','body','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','DESC','Applications','Smtp','get','omit','applications','list','orderBy','priority','asc','autoclose','push','length','*,*,*,*','defaults','create','List\x20not\x20found','contact','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','interaction','attachments','originTo','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachments','User','name','UserId','unshift','agent','Start','startRouting','lodash','util','moment','bluebird','../../config/utils','../../config/logger','jayson/promise','http','redis','localhost','socket.io-emitter','request','then','MailAccount,\x20%s,\x20%s','debug','stringify','error','code','message','info'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xdfe2,0x188));var _0x2dfe=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xdfe2[_0x44bcb0];return _0xfaf881;};'use strict';var _=require(_0x2dfe('0x0'));var util=require(_0x2dfe('0x1'));var moment=require(_0x2dfe('0x2'));var BPromise=require(_0x2dfe('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2dfe('0x4'));var logger=require(_0x2dfe('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2dfe('0x6'));var client=jayson['client'][_0x2dfe('0x7')]({'port':0x232c});config[_0x2dfe('0x8')]=_['defaults'](config['redis'],{'host':_0x2dfe('0x9'),'port':0x18eb});var socket=require(_0x2dfe('0xa'))(new Redis(config[_0x2dfe('0x8')]));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0x1c292d,_0x39e569,_0x2b5e78){return new BPromise(function(_0x3c4964,_0x633dbd){return client[_0x2dfe('0xb')](_0x1c292d,_0x2b5e78)[_0x2dfe('0xc')](function(_0x22a376){logger['info'](_0x2dfe('0xd'),_0x39e569,'request\x20sent');logger[_0x2dfe('0xe')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x39e569,'request\x20sent',JSON[_0x2dfe('0xf')](_0x22a376));if(_0x22a376[_0x2dfe('0x10')]){if(_0x22a376[_0x2dfe('0x10')][_0x2dfe('0x11')]===0x1f4){logger[_0x2dfe('0x10')](_0x2dfe('0xd'),_0x39e569,_0x22a376[_0x2dfe('0x10')][_0x2dfe('0x12')]);return _0x633dbd(_0x22a376[_0x2dfe('0x10')][_0x2dfe('0x12')]);}logger['error'](_0x2dfe('0xd'),_0x39e569,_0x22a376[_0x2dfe('0x10')][_0x2dfe('0x12')]);return _0x3c4964(_0x22a376[_0x2dfe('0x10')]['message']);}else{logger[_0x2dfe('0x13')]('MailAccount,\x20%s,\x20%s',_0x39e569,'request\x20sent');_0x3c4964(_0x22a376[_0x2dfe('0x14')][_0x2dfe('0x12')]);}})['catch'](function(_0x375f56){logger['error']('MailAccount,\x20%s,\x20%s',_0x39e569,_0x375f56);_0x633dbd(_0x375f56);});});}exports[_0x2dfe('0x15')]=function(_0x59d456){var _0x1f628b=this;return new Promise(function(_0x2b5b2e,_0x5456c3){return db[_0x2dfe('0x16')][_0x2dfe('0x17')]({'raw':_0x59d456['options']?_0x59d456[_0x2dfe('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x59d456[_0x2dfe('0x18')]?_0x59d456['options'][_0x2dfe('0x19')]||null:null,'attributes':_0x59d456[_0x2dfe('0x18')]?_0x59d456[_0x2dfe('0x18')][_0x2dfe('0x1a')]||null:null,'limit':_0x59d456['options']?_0x59d456[_0x2dfe('0x18')][_0x2dfe('0x1b')]||null:null,'include':_0x59d456['options']?_0x59d456[_0x2dfe('0x18')]['include']?_[_0x2dfe('0x1c')](_0x59d456['options'][_0x2dfe('0x1d')],function(_0x52c405){return{'model':db[_0x52c405[_0x2dfe('0x1e')]],'as':_0x52c405['as'],'attributes':_0x52c405[_0x2dfe('0x1a')],'include':_0x52c405[_0x2dfe('0x1d')]?_[_0x2dfe('0x1c')](_0x52c405[_0x2dfe('0x1d')],function(_0x475098){return{'model':db[_0x475098['model']],'as':_0x475098['as'],'attributes':_0x475098[_0x2dfe('0x1a')],'include':_0x475098['include']?_['map'](_0x475098[_0x2dfe('0x1d')],function(_0x185e1e){return{'model':db[_0x185e1e[_0x2dfe('0x1e')]],'as':_0x185e1e['as'],'attributes':_0x185e1e[_0x2dfe('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2dfe('0xc')](function(_0x530b09){logger[_0x2dfe('0x13')]('GetMailAccount',_0x59d456);logger[_0x2dfe('0xe')](_0x2dfe('0x15'),_0x59d456,JSON['stringify'](_0x530b09));_0x2b5b2e(_0x530b09);})[_0x2dfe('0x1f')](function(_0x393ae7){logger[_0x2dfe('0x10')](_0x2dfe('0x15'),_0x393ae7[_0x2dfe('0x12')],_0x59d456);_0x5456c3(_0x1f628b[_0x2dfe('0x10')](0x1f4,_0x393ae7[_0x2dfe('0x12')]));});});};exports[_0x2dfe('0x20')]=function(_0x22885c){var _0xaf5eca=this;return new Promise(function(_0xd32323,_0x1fbbbd){return db[_0x2dfe('0x16')]['find']({'raw':_0x22885c['options']?_0x22885c['options'][_0x2dfe('0x21')]===undefined?!![]:![]:!![],'where':_0x22885c['options']?_0x22885c[_0x2dfe('0x18')]['where']||null:null,'attributes':_0x22885c[_0x2dfe('0x18')]?_0x22885c['options']['attributes']||null:null,'include':_0x22885c[_0x2dfe('0x18')]?_0x22885c['options'][_0x2dfe('0x1d')]?_[_0x2dfe('0x1c')](_0x22885c[_0x2dfe('0x18')][_0x2dfe('0x1d')],function(_0x10f9d5){return{'model':db[_0x10f9d5[_0x2dfe('0x1e')]],'as':_0x10f9d5['as'],'attributes':_0x10f9d5['attributes'],'include':_0x10f9d5[_0x2dfe('0x1d')]?_[_0x2dfe('0x1c')](_0x10f9d5[_0x2dfe('0x1d')],function(_0x27d4dc){return{'model':db[_0x27d4dc['model']],'as':_0x27d4dc['as'],'attributes':_0x27d4dc['attributes'],'include':_0x27d4dc['include']?_[_0x2dfe('0x1c')](_0x27d4dc['include'],function(_0x2182d8){return{'model':db[_0x2182d8['model']],'as':_0x2182d8['as'],'attributes':_0x2182d8['attributes']};}):[]};}):[]};}):[]:[]})[_0x2dfe('0xc')](function(_0x9f62a6){logger[_0x2dfe('0x13')](_0x2dfe('0x20'),_0x22885c);logger[_0x2dfe('0xe')](_0x2dfe('0x20'),_0x22885c,JSON['stringify'](_0x9f62a6));_0xd32323(_0x9f62a6);})['catch'](function(_0x7b786b){logger[_0x2dfe('0x10')](_0x2dfe('0x20'),_0x7b786b[_0x2dfe('0x12')],_0x22885c);_0x1fbbbd(_0xaf5eca['error'](0x1f4,_0x7b786b[_0x2dfe('0x12')]));});});};exports[_0x2dfe('0x22')]=function(_0x354e0a){var _0x3d43de=this;return new Promise(function(_0x56f672,_0x5bcc9a){var _0x5e2070={'body':_0x354e0a[_0x2dfe('0x23')],'channel':'mail'};var _0x8c456e=_[_0x2dfe('0x24')](_[_0x2dfe('0x25')](db[_0x2dfe('0x26')][_0x2dfe('0x27')]),[_0x2dfe('0x28'),_0x2dfe('0x29'),_0x2dfe('0x2a'),_0x2dfe('0x2b')]);var _0x3c5e62=![];if(_0x354e0a[_0x2dfe('0x23')]['id']){delete _0x354e0a[_0x2dfe('0x23')]['id'];}if(_[_0x2dfe('0x2c')](_0x354e0a['body'][_0x2dfe('0x2d')])){return _0x5bcc9a(_0x3d43de[_0x2dfe('0x10')](0x1f4,_0x2dfe('0x2e')));}if(_['isNil'](_0x354e0a['body']['body'])||_0x354e0a['body'][_0x2dfe('0x23')]===''){return _0x5bcc9a(_0x3d43de['error'](0x1f4,_0x2dfe('0x2f')));}if(_['isNil'](_0x354e0a[_0x2dfe('0x23')][_0x2dfe('0x30')])){return _0x5bcc9a(_0x3d43de[_0x2dfe('0x10')](0x1f4,_0x2dfe('0x31')+_0x8c456e));}if(!_[_0x2dfe('0x32')](_0x8c456e,_0x354e0a[_0x2dfe('0x23')][_0x2dfe('0x30')])){return _0x5bcc9a(_0x3d43de[_0x2dfe('0x10')](0x1f4,_0x2dfe('0x33')+_0x8c456e));}var _0x1f548b={};_0x1f548b[_0x354e0a[_0x2dfe('0x23')]['mapKey']]=_0x354e0a[_0x2dfe('0x23')][_0x2dfe('0x2d')];return db[_0x2dfe('0x16')][_0x2dfe('0x34')]({'where':{'id':_0x354e0a[_0x2dfe('0x35')]['id']},'include':[{'model':db[_0x2dfe('0x36')],'as':_0x2dfe('0x37'),'include':[{'model':db[_0x2dfe('0x26')],'as':_0x2dfe('0x38'),'where':_0x1f548b,'limit':0x1,'order':[[_0x2dfe('0x29'),_0x2dfe('0x39')]]}]},{'model':db['MailApplication'],'as':_0x2dfe('0x3a')},{'model':db['MailServerOut'],'as':_0x2dfe('0x3b')}]})['then'](function(_0x5d41f4){if(_0x5d41f4&&_0x5d41f4['List']){var _0x1cddb2=_0x5d41f4[_0x2dfe('0x3c')]({'plain':!![]});_0x5e2070[_0x2dfe('0x35')]=_[_0x2dfe('0x3d')](_0x1cddb2,['Applications','List']);_0x5e2070[_0x2dfe('0x3e')]=_0x1cddb2[_0x2dfe('0x3a')];_0x5e2070[_0x2dfe('0x3f')]=_0x1cddb2['List'];_0x5e2070[_0x2dfe('0x3e')]=_[_0x2dfe('0x40')](_0x5e2070[_0x2dfe('0x3e')],[_0x2dfe('0x41')],[_0x2dfe('0x42')]);if(_0x5e2070[_0x2dfe('0x35')]&&_0x5e2070[_0x2dfe('0x35')][_0x2dfe('0x43')]){_0x5e2070[_0x2dfe('0x3e')][_0x2dfe('0x44')]({'id':0x0,'priority':_0x5e2070[_0x2dfe('0x3e')][_0x2dfe('0x45')]+0x1,'app':'close','appdata':'autoclose','interval':_0x2dfe('0x46')});}if(_0x5e2070[_0x2dfe('0x35')]['Applications']){delete _0x5e2070['account'][_0x2dfe('0x3a')];}if(_0x5e2070[_0x2dfe('0x35')][_0x2dfe('0x37')]){delete _0x5e2070[_0x2dfe('0x35')][_0x2dfe('0x37')];}if(_0x1cddb2[_0x2dfe('0x37')]['Contacts'][_0x2dfe('0x45')]){return _0x1cddb2['List']['Contacts'][0x0];}var _0x19a1b5=_[_0x2dfe('0x47')](_0x354e0a[_0x2dfe('0x23')],{'firstName':_0x354e0a[_0x2dfe('0x23')][_0x2dfe('0x2d')],'ListId':_0x1cddb2['ListId']});_0x19a1b5[_0x354e0a[_0x2dfe('0x23')]['mapKey']]=_0x354e0a[_0x2dfe('0x23')][_0x2dfe('0x2d')];return db['CmContact'][_0x2dfe('0x48')](_0x19a1b5);}else{throw new Error(_0x2dfe('0x49'));}})[_0x2dfe('0xc')](function(_0x95edcb){_0x5e2070[_0x2dfe('0x4a')]=_0x95edcb;if(_0x95edcb){if(!_0x354e0a[_0x2dfe('0x23')][_0x2dfe('0x12')]['messageId']){_0x354e0a[_0x2dfe('0x23')][_0x2dfe('0x12')][_0x2dfe('0x4b')]=rs['generate']()+'\x20'+_0x354e0a[_0x2dfe('0x23')][_0x2dfe('0x12')][_0x2dfe('0x2d')];}var _0x53676a={'ContactId':_0x95edcb['id'],'MailAccountId':_0x354e0a['account']['id'],'inReplyTo':_0x354e0a[_0x2dfe('0x23')]['message'][_0x2dfe('0x4b')],'to':_0x354e0a[_0x2dfe('0x23')]['message'][_0x2dfe('0x2d')],'cc':_0x354e0a['body'][_0x2dfe('0x12')]['cc'],'subject':_0x354e0a[_0x2dfe('0x23')][_0x2dfe('0x12')][_0x2dfe('0x4c')],'attach':_0x354e0a['body']['message'][_0x2dfe('0x4d')],'lastMsgAt':moment()[_0x2dfe('0x4e')](_0x2dfe('0x4f')),'lastMsgDirection':'in'};return db[_0x2dfe('0x50')][_0x2dfe('0x34')]({'where':{'closed':![],'MailAccountId':_0x354e0a['account']['id']},'include':[{'model':db[_0x2dfe('0x51')],'as':_0x2dfe('0x52'),'attributes':[_0x2dfe('0x4b')],'where':{'messageId':_0x354e0a[_0x2dfe('0x23')]['message'][_0x2dfe('0x53')]}}]})[_0x2dfe('0xc')](function(_0x2e4bd5){if(_0x2e4bd5){return[_0x2e4bd5,![]];}return db[_0x2dfe('0x50')][_0x2dfe('0x48')](_0x53676a)[_0x2dfe('0xc')](function(_0x43c736){return[_0x43c736,!![]];});});}else{throw new Error(_0x2dfe('0x54'));}})[_0x2dfe('0x55')](function(_0x5272cd,_0x54aa0e){if(_0x5272cd){_0x3c5e62=_0x54aa0e;if(!_0x54aa0e){return _0x5272cd[_0x2dfe('0x56')]({'inReplyTo':_0x354e0a['body'][_0x2dfe('0x12')][_0x2dfe('0x4b')],'to':_0x354e0a[_0x2dfe('0x23')][_0x2dfe('0x12')]['from'],'cc':_0x354e0a[_0x2dfe('0x23')]['message']['cc'],'subject':_0x354e0a['body'][_0x2dfe('0x12')][_0x2dfe('0x4c')],'attach':_0x5272cd[_0x2dfe('0x4d')]?_0x5272cd[_0x2dfe('0x4d')]:_0x354e0a[_0x2dfe('0x23')]['message'][_0x2dfe('0x4d')],'substatus':null,'substatusAt':moment()[_0x2dfe('0x4e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x2dfe('0x4e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x5272cd;}}})['then'](function(_0x239fa0){_0x5e2070['interaction']=_0x239fa0[_0x2dfe('0x3c')]({'plain':!![]});_0x5e2070[_0x2dfe('0x57')]['created']=_0x3c5e62;return db['MailMessage'][_0x2dfe('0x48')]({'body':_0x354e0a[_0x2dfe('0x23')][_0x2dfe('0x23')],'MailAccountId':_0x354e0a[_0x2dfe('0x35')]['id'],'MailInteractionId':_0x239fa0['id'],'direction':'in','ContactId':_0x5e2070[_0x2dfe('0x4a')]['id'],'messageId':_0x354e0a['body'][_0x2dfe('0x12')]['messageId'],'from':_0x354e0a['body'][_0x2dfe('0x12')][_0x2dfe('0x2d')],'to':_0x354e0a[_0x2dfe('0x23')]['message']['to'],'cc':_0x354e0a[_0x2dfe('0x23')][_0x2dfe('0x12')]['cc'],'subject':_0x354e0a[_0x2dfe('0x23')][_0x2dfe('0x12')]['subject'],'attach':_0x354e0a['body'][_0x2dfe('0x12')][_0x2dfe('0x4d')],'Attachments':_0x354e0a[_0x2dfe('0x23')][_0x2dfe('0x12')][_0x2dfe('0x58')],'originTo':_0x354e0a['body']['message'][_0x2dfe('0x59')],'originCc':_0x354e0a['body'][_0x2dfe('0x12')][_0x2dfe('0x5a')],'bcc':_0x354e0a[_0x2dfe('0x23')][_0x2dfe('0x12')]['bcc'],'ChatWebsiteId':_0x354e0a[_0x2dfe('0x23')]['message'][_0x2dfe('0x5b')]||null,'originChannel':_0x354e0a[_0x2dfe('0x23')][_0x2dfe('0x12')][_0x2dfe('0x5c')]||_0x2dfe('0x5d'),'ChatOfflineMessageId':_0x354e0a[_0x2dfe('0x23')][_0x2dfe('0x12')][_0x2dfe('0x5e')]||null},{'include':[{'model':db['Attachment'],'as':_0x2dfe('0x5f')}]});})[_0x2dfe('0xc')](function(_0x3740ea){_0x5e2070[_0x2dfe('0x12')]=_0x3740ea;if(_0x5e2070[_0x2dfe('0x57')]['UserId']){return db[_0x2dfe('0x60')][_0x2dfe('0x34')]({'attributes':['id',_0x2dfe('0x61')],'where':{'id':_0x5e2070[_0x2dfe('0x57')][_0x2dfe('0x62')]}})[_0x2dfe('0xc')](function(_0x4697a6){if(_0x4697a6){_0x5e2070[_0x2dfe('0x3e')][_0x2dfe('0x63')]({'id':0x0,'priority':0x0,'app':_0x2dfe('0x64'),'appdata':_0x4697a6[_0x2dfe('0x61')]+','+(_0x5e2070[_0x2dfe('0x35')]['waitForTheAssignedAgent']||0xa),'interval':_0x2dfe('0x46')});}return respondWithRpcPromise(_0x2dfe('0x65'),_0x2dfe('0x66'),_0x5e2070);});}return respondWithRpcPromise('Start',_0x2dfe('0x66'),_0x5e2070);})[_0x2dfe('0xc')](function(_0x37752e){_0x56f672(_0x37752e);})[_0x2dfe('0x1f')](function(_0x5ddd67){_0x5bcc9a(_0x3d43de[_0x2dfe('0x10')](0x1f4,_0x5ddd67['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index a6d73b7..406aa37 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 _0x7618=['mailAccount:','update','emit','register','length'];(function(_0x1c802a,_0x2bcf1b){var _0x221f59=function(_0xa56ad7){while(--_0xa56ad7){_0x1c802a['push'](_0x1c802a['shift']());}};_0x221f59(++_0x2bcf1b);}(_0x7618,0x119));var _0x8761=function(_0x5ea23a,_0x2503a8){_0x5ea23a=_0x5ea23a-0x0;var _0x517037=_0x7618[_0x5ea23a];return _0x517037;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=['save','remove',_0x8761('0x0')];function createListener(_0xe2e1cd,_0x358a77){return function(_0x59bcd5){_0x358a77[_0x8761('0x1')](_0xe2e1cd,_0x59bcd5);};}function removeListener(_0x4e2425,_0xe96ded){return function(){MailAccountEvents['removeListener'](_0x4e2425,_0xe96ded);};}exports[_0x8761('0x2')]=function(_0x4824b6){for(var _0x22eea5=0x0,_0x1a293c=events[_0x8761('0x3')];_0x22eea5<_0x1a293c;_0x22eea5++){var _0xc5fc17=events[_0x22eea5];var _0x34b055=createListener(_0x8761('0x4')+_0xc5fc17,_0x4824b6);MailAccountEvents['on'](_0xc5fc17,_0x34b055);}}; \ No newline at end of file +var _0x3f2b=['./mailAccount.events','remove','update','emit','mailAccount:'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x3f2b,0x1f4));var _0xb3f2=function(_0x506ac2,_0x2aaffc){_0x506ac2=_0x506ac2-0x0;var _0x369cca=_0x3f2b[_0x506ac2];return _0x369cca;};'use strict';var MailAccountEvents=require(_0xb3f2('0x0'));var events=['save',_0xb3f2('0x1'),_0xb3f2('0x2')];function createListener(_0x17fbeb,_0x591f4a){return function(_0x95c4cf){_0x591f4a[_0xb3f2('0x3')](_0x17fbeb,_0x95c4cf);};}function removeListener(_0x256707,_0x32ca97){return function(){MailAccountEvents['removeListener'](_0x256707,_0x32ca97);};}exports['register']=function(_0x4e3265){for(var _0x1be817=0x0,_0x341b53=events['length'];_0x1be817<_0x341b53;_0x1be817++){var _0x2bbf7f=events[_0x1be817];var _0x35e243=createListener(_0xb3f2('0x4')+_0x2bbf7f,_0x4e3265);MailAccountEvents['on'](_0x2bbf7f,_0x35e243);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 16cf81d..42955ac 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 _0x7945=['isAuthenticated','update','delete','exports','multer','util','path','Router','fs-extra','../../config/environment','./mailApplication.controller','/:id'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x7945,0xa0));var _0x5794=function(_0x4ebd42,_0x1e36a0){_0x4ebd42=_0x4ebd42-0x0;var _0x3ef98d=_0x7945[_0x4ebd42];return _0x3ef98d;};'use strict';var multer=require(_0x5794('0x0'));var util=require(_0x5794('0x1'));var path=require(_0x5794('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5794('0x3')]();var fs_extra=require(_0x5794('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5794('0x5'));var controller=require(_0x5794('0x6'));router['get'](_0x5794('0x7'),auth[_0x5794('0x8')](),controller['show']);router['put'](_0x5794('0x7'),auth[_0x5794('0x8')](),controller[_0x5794('0x9')]);router[_0x5794('0xa')](_0x5794('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0x5794('0xb')]=router; \ No newline at end of file +var _0xa47d=['show','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x54ef39,_0x348cb1){var _0x4f0958=function(_0x52c3d4){while(--_0x52c3d4){_0x54ef39['push'](_0x54ef39['shift']());}};_0x4f0958(++_0x348cb1);}(_0xa47d,0x1d5));var _0xda47=function(_0x263391,_0x365cba){_0x263391=_0x263391-0x0;var _0x326791=_0xa47d[_0x263391];return _0x326791;};'use strict';var multer=require('multer');var util=require(_0xda47('0x0'));var path=require(_0xda47('0x1'));var timeout=require(_0xda47('0x2'));var express=require(_0xda47('0x3'));var router=express[_0xda47('0x4')]();var fs_extra=require(_0xda47('0x5'));var auth=require(_0xda47('0x6'));var interaction=require(_0xda47('0x7'));var config=require(_0xda47('0x8'));var controller=require('./mailApplication.controller');router[_0xda47('0x9')]('/:id',auth[_0xda47('0xa')](),controller[_0xda47('0xb')]);router['put'](_0xda47('0xc'),auth[_0xda47('0xa')](),controller[_0xda47('0xd')]);router[_0xda47('0xe')](_0xda47('0xc'),auth[_0xda47('0xa')](),controller[_0xda47('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 307fe8d..497a386 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 _0x38e8=['sequelize','INTEGER','STRING','noop','*,*,*,*'];(function(_0x368587,_0x1b6554){var _0x42d33c=function(_0xfdccf){while(--_0xfdccf){_0x368587['push'](_0x368587['shift']());}};_0x42d33c(++_0x1b6554);}(_0x38e8,0x9b));var _0x838e=function(_0x4822be,_0x5f5a8d){_0x4822be=_0x4822be-0x0;var _0x13c474=_0x38e8[_0x4822be];return _0x13c474;};'use strict';var Sequelize=require(_0x838e('0x0'));module['exports']={'priority':{'type':Sequelize[_0x838e('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x838e('0x2')],'allowNull':![],'defaultValue':_0x838e('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x838e('0x2')]},'interval':{'type':Sequelize[_0x838e('0x2')],'defaultValue':_0x838e('0x4')}}; \ No newline at end of file +var _0x1467=['STRING','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x5e71b4,_0xe270b5){var _0x18f5d1=function(_0x40f9e6){while(--_0x40f9e6){_0x5e71b4['push'](_0x5e71b4['shift']());}};_0x18f5d1(++_0xe270b5);}(_0x1467,0xc3));var _0x7146=function(_0x38987f,_0xc79720){_0x38987f=_0x38987f-0x0;var _0x4cb697=_0x1467[_0x38987f];return _0x4cb697;};'use strict';var Sequelize=require(_0x7146('0x0'));module[_0x7146('0x1')]={'priority':{'type':Sequelize[_0x7146('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7146('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7146('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x7146('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 7e1ee1a..0553bbd 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 _0xedd9=['query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','show','params','keys','MailApplication','rawAttributes'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0xedd9,0xfc));var _0x9edd=function(_0x29ee75,_0x1b8e35){_0x29ee75=_0x29ee75-0x0;var _0x729d3d=_0xedd9[_0x29ee75];return _0x729d3d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={'raw':!![],'where':{'id':_0x52746a[_0x9edd('0x27')]['id']}},_0x2ae8dd={};_0x2ae8dd['model']=_[_0x9edd('0x28')](db[_0x9edd('0x29')][_0x9edd('0x2a')]);_0x2ae8dd[_0x9edd('0x2b')]=_[_0x9edd('0x28')](_0x52746a[_0x9edd('0x2b')]);_0x2ae8dd[_0x9edd('0x2c')]=_[_0x9edd('0x2d')](_0x2ae8dd[_0x9edd('0x2e')],_0x2ae8dd[_0x9edd('0x2b')]);_0x28cfae[_0x9edd('0x2f')]=_[_0x9edd('0x2d')](_0x2ae8dd[_0x9edd('0x2e')],qs[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2b')]['fields']));_0x28cfae[_0x9edd('0x2f')]=_0x28cfae[_0x9edd('0x2f')][_0x9edd('0x31')]?_0x28cfae['attributes']:_0x2ae8dd[_0x9edd('0x2e')];if(_0x52746a[_0x9edd('0x2b')][_0x9edd('0x32')]){_0x28cfae[_0x9edd('0x33')]=[{'all':!![]}];}_0x28cfae=_[_0x9edd('0x34')]({},_0x28cfae,_0x52746a[_0x9edd('0x35')]);return db[_0x9edd('0x29')][_0x9edd('0x36')](_0x28cfae)[_0x9edd('0x21')](handleEntityNotFound(_0x238b22,null))[_0x9edd('0x21')](respondWithResult(_0x238b22,null))[_0x9edd('0x37')](handleError(_0x238b22,null));};exports[_0x9edd('0x38')]=function(_0x27eb7e,_0x14f780){if(_0x27eb7e['body']['id']){delete _0x27eb7e[_0x9edd('0x39')]['id'];}return db['MailApplication'][_0x9edd('0x36')]({'where':{'id':_0x27eb7e[_0x9edd('0x27')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x14f780,null))[_0x9edd('0x21')](saveUpdates(_0x27eb7e[_0x9edd('0x39')],null))['then'](respondWithResult(_0x14f780,null))[_0x9edd('0x37')](handleError(_0x14f780,null));};exports[_0x9edd('0x3a')]=function(_0x2b3469,_0x38e9be){return db[_0x9edd('0x29')][_0x9edd('0x36')]({'where':{'id':_0x2b3469[_0x9edd('0x27')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x38e9be,null))[_0x9edd('0x21')](removeEntity(_0x38e9be,null))[_0x9edd('0x37')](handleError(_0x38e9be,null));}; \ No newline at end of file +var _0xd8b0=['attributes','length','include','merge','find','catch','body','params','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','show','model','MailApplication','query','keys','intersection','fields'];(function(_0x286c17,_0x51742e){var _0x52f89c=function(_0xff55ba){while(--_0xff55ba){_0x286c17['push'](_0x286c17['shift']());}};_0x52f89c(++_0x51742e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x19')](_0x35a07b)[_0x0d8b('0x1a')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x19')](_0x5ad086)[_0x0d8b('0x1b')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=typeof _0x23eb7b[_0x0d8b('0x1c')]===_0x0d8b('0x1d')&&typeof _0x23eb7b['limit']===_0x0d8b('0x1d');var _0x4586c2=_0xa86349[_0x0d8b('0x1e')];var _0x5fecbd=_0x17f7df?0x0:_0x23eb7b[_0x0d8b('0x1c')];var _0x18dd2d=_0x17f7df?_0xa86349[_0x0d8b('0x1e')]:_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b['limit'];var _0x27512e;if(_0x18dd2d>=_0x4586c2){_0x18dd2d=_0x4586c2;_0x27512e=0xc8;}else{_0x27512e=0xce;}_0x4f6f21[_0x0d8b('0x19')](_0x27512e);return _0x4f6f21[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x5fecbd+'-'+_0x18dd2d+'/'+_0x4586c2)[_0x0d8b('0x1b')](_0xa86349);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x21')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x22')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')](_0x54a9a7)[_0x0d8b('0x24')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x25')]()[_0x0d8b('0x24')](function(){_0x38efc8[_0x0d8b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8bbee,_0x4463ee){return function(_0x5363e3){if(!_0x5363e3){_0xe8bbee[_0x0d8b('0x18')](0x194);}return _0x5363e3;};}function handleError(_0x4a0ae4,_0x3dd149){_0x3dd149=_0x3dd149||0x1f4;return function(_0x234bdd){logger[_0x0d8b('0x26')](_0x234bdd['stack']);if(_0x234bdd['name']){delete _0x234bdd[_0x0d8b('0x27')];}_0x4a0ae4[_0x0d8b('0x19')](_0x3dd149)['send'](_0x234bdd);};}exports[_0x0d8b('0x28')]=function(_0x59aa83,_0x1b2b59){var _0x4b59e5={'raw':!![],'where':{'id':_0x59aa83['params']['id']}},_0x97050a={};_0x97050a[_0x0d8b('0x29')]=_['keys'](db[_0x0d8b('0x2a')]['rawAttributes']);_0x97050a[_0x0d8b('0x2b')]=_[_0x0d8b('0x2c')](_0x59aa83[_0x0d8b('0x2b')]);_0x97050a['filters']=_['intersection'](_0x97050a['model'],_0x97050a[_0x0d8b('0x2b')]);_0x4b59e5['attributes']=_[_0x0d8b('0x2d')](_0x97050a['model'],qs['fields'](_0x59aa83[_0x0d8b('0x2b')][_0x0d8b('0x2e')]));_0x4b59e5[_0x0d8b('0x2f')]=_0x4b59e5[_0x0d8b('0x2f')][_0x0d8b('0x30')]?_0x4b59e5[_0x0d8b('0x2f')]:_0x97050a[_0x0d8b('0x29')];if(_0x59aa83[_0x0d8b('0x2b')]['includeAll']){_0x4b59e5[_0x0d8b('0x31')]=[{'all':!![]}];}_0x4b59e5=_[_0x0d8b('0x32')]({},_0x4b59e5,_0x59aa83['options']);return db[_0x0d8b('0x2a')][_0x0d8b('0x33')](_0x4b59e5)[_0x0d8b('0x24')](handleEntityNotFound(_0x1b2b59,null))['then'](respondWithResult(_0x1b2b59,null))[_0x0d8b('0x34')](handleError(_0x1b2b59,null));};exports[_0x0d8b('0x23')]=function(_0x206157,_0x31ceba){if(_0x206157[_0x0d8b('0x35')]['id']){delete _0x206157['body']['id'];}return db[_0x0d8b('0x2a')][_0x0d8b('0x33')]({'where':{'id':_0x206157['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x31ceba,null))[_0x0d8b('0x24')](saveUpdates(_0x206157[_0x0d8b('0x35')],null))[_0x0d8b('0x24')](respondWithResult(_0x31ceba,null))[_0x0d8b('0x34')](handleError(_0x31ceba,null));};exports['destroy']=function(_0x497a71,_0x41b4f9){return db['MailApplication']['find']({'where':{'id':_0x497a71[_0x0d8b('0x36')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x41b4f9,null))[_0x0d8b('0x24')](removeEntity(_0x41b4f9,null))[_0x0d8b('0x34')](handleError(_0x41b4f9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 8f91abd..2a455f1 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 _0x1479=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','MailApplication','mail_applications'];(function(_0x38469b,_0x405546){var _0x5285a3=function(_0x5ccb15){while(--_0x5ccb15){_0x38469b['push'](_0x38469b['shift']());}};_0x5285a3(++_0x405546);}(_0x1479,0x1af));var _0x9147=function(_0x481432,_0x307bbd){_0x481432=_0x481432-0x0;var _0x33094f=_0x1479[_0x481432];return _0x33094f;};'use strict';var _=require(_0x9147('0x0'));var util=require(_0x9147('0x1'));var logger=require('../../config/logger')(_0x9147('0x2'));var moment=require(_0x9147('0x3'));var BPromise=require(_0x9147('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9147('0x5'));var rimraf=require(_0x9147('0x6'));var config=require(_0x9147('0x7'));var attributes=require('./mailApplication.attributes');module[_0x9147('0x8')]=function(_0x124aa0,_0x2899f9){return _0x124aa0['define'](_0x9147('0x9'),attributes,{'tableName':_0x9147('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9147('0xb'),'collate':_0x9147('0xc')});}; \ No newline at end of file +var _0x9b7a=['utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','request-promise','path','./mailApplication.attributes','exports','MailApplication','mail_applications'];(function(_0x3816c2,_0xb221e1){var _0x144669=function(_0x149c29){while(--_0x149c29){_0x3816c2['push'](_0x3816c2['shift']());}};_0x144669(++_0xb221e1);}(_0x9b7a,0xde));var _0xa9b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9b7a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xa9b7('0x0'));var logger=require('../../config/logger')(_0xa9b7('0x1'));var moment=require('moment');var BPromise=require(_0xa9b7('0x2'));var rp=require(_0xa9b7('0x3'));var fs=require('fs');var path=require(_0xa9b7('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa9b7('0x5'));module[_0xa9b7('0x6')]=function(_0x320018,_0x22fa36){return _0x320018['define'](_0xa9b7('0x7'),attributes,{'tableName':_0xa9b7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa9b7('0x9'),'collate':_0xa9b7('0xa')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 9745ca8..f1f5252 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 _0x54b0=['../../config/utils','rpc','client','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','options','raw','where','attributes','limit','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x34c1c6,_0x597c2d){var _0x3e2e6c=function(_0xac8600){while(--_0xac8600){_0x34c1c6['push'](_0x34c1c6['shift']());}};_0x3e2e6c(++_0x597c2d);}(_0x54b0,0xbf));var _0x054b=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0x54b0[_0x3207aa];return _0x51758f;};'use strict';var _=require('lodash');var util=require(_0x054b('0x0'));var moment=require(_0x054b('0x1'));var BPromise=require(_0x054b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x054b('0x3'));var db=require(_0x054b('0x4'))['db'];var utils=require(_0x054b('0x5'));var logger=require('../../config/logger')(_0x054b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x054b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8cb1b9,_0x350321,_0xe34f85){return new BPromise(function(_0x8a6bb4,_0x1a7110){return client[_0x054b('0x8')](_0x8cb1b9,_0xe34f85)[_0x054b('0x9')](function(_0x4264da){logger[_0x054b('0xa')](_0x054b('0xb'),_0x350321,_0x054b('0xc'));logger[_0x054b('0xd')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x350321,_0x054b('0xc'),JSON[_0x054b('0xe')](_0x4264da));if(_0x4264da['error']){if(_0x4264da[_0x054b('0xf')][_0x054b('0x10')]===0x1f4){logger[_0x054b('0xf')](_0x054b('0xb'),_0x350321,_0x4264da[_0x054b('0xf')]['message']);return _0x1a7110(_0x4264da['error'][_0x054b('0x11')]);}logger[_0x054b('0xf')](_0x054b('0xb'),_0x350321,_0x4264da[_0x054b('0xf')][_0x054b('0x11')]);return _0x8a6bb4(_0x4264da[_0x054b('0xf')][_0x054b('0x11')]);}else{logger[_0x054b('0xa')](_0x054b('0xb'),_0x350321,_0x054b('0xc'));_0x8a6bb4(_0x4264da[_0x054b('0x12')][_0x054b('0x11')]);}})[_0x054b('0x13')](function(_0x27499a){logger[_0x054b('0xf')](_0x054b('0xb'),_0x350321,_0x27499a);_0x1a7110(_0x27499a);});});}exports[_0x054b('0x14')]=function(_0x2e00c8){var _0x143a41=this;return new Promise(function(_0x240f36,_0x41316b){return db[_0x054b('0x15')][_0x054b('0x16')](_0x2e00c8['body'],{'raw':_0x2e00c8[_0x054b('0x17')]?_0x2e00c8[_0x054b('0x17')][_0x054b('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e00c8[_0x054b('0x17')]?_0x2e00c8['options'][_0x054b('0x19')]||null:null,'attributes':_0x2e00c8['options']?_0x2e00c8[_0x054b('0x17')][_0x054b('0x1a')]||null:null,'limit':_0x2e00c8['options']?_0x2e00c8[_0x054b('0x17')][_0x054b('0x1b')]||null:null})[_0x054b('0x9')](function(_0xc1e939){logger[_0x054b('0xa')](_0x054b('0x14'),_0x2e00c8);logger[_0x054b('0xd')](_0x054b('0x14'),_0x2e00c8,JSON[_0x054b('0xe')](_0xc1e939));_0x240f36(_0xc1e939);})[_0x054b('0x13')](function(_0x5dead1){logger['error'](_0x054b('0x14'),_0x5dead1['message'],_0x2e00c8);_0x41316b(_0x143a41[_0x054b('0xf')](0x1f4,_0x5dead1[_0x054b('0x11')]));});});}; \ No newline at end of file +var _0x8357=['request','then','info','request\x20sent','debug','stringify','error','code','message','MailApplication,\x20%s,\x20%s','result','catch','UpdateMailApplication','MailApplication','body','options','raw','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x2b2896,_0x155504){var _0xcd6ebf=function(_0x560414){while(--_0x560414){_0x2b2896['push'](_0x2b2896['shift']());}};_0xcd6ebf(++_0x155504);}(_0x8357,0x140));var _0x7835=function(_0xd75b98,_0x15ad99){_0xd75b98=_0xd75b98-0x0;var _0xdd720e=_0x8357[_0xd75b98];return _0xdd720e;};'use strict';var _=require(_0x7835('0x0'));var util=require(_0x7835('0x1'));var moment=require('moment');var BPromise=require(_0x7835('0x2'));var rs=require(_0x7835('0x3'));var fs=require('fs');var Redis=require(_0x7835('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7835('0x5'));var logger=require(_0x7835('0x6'))('rpc');var config=require(_0x7835('0x7'));var jayson=require(_0x7835('0x8'));var client=jayson[_0x7835('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d3ad1,_0x27b4d7,_0x27001b){return new BPromise(function(_0x2b10d7,_0x59581e){return client[_0x7835('0xa')](_0x1d3ad1,_0x27001b)[_0x7835('0xb')](function(_0x2e1dfb){logger[_0x7835('0xc')]('MailApplication,\x20%s,\x20%s',_0x27b4d7,_0x7835('0xd'));logger[_0x7835('0xe')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x27b4d7,_0x7835('0xd'),JSON[_0x7835('0xf')](_0x2e1dfb));if(_0x2e1dfb[_0x7835('0x10')]){if(_0x2e1dfb[_0x7835('0x10')][_0x7835('0x11')]===0x1f4){logger[_0x7835('0x10')]('MailApplication,\x20%s,\x20%s',_0x27b4d7,_0x2e1dfb[_0x7835('0x10')][_0x7835('0x12')]);return _0x59581e(_0x2e1dfb[_0x7835('0x10')][_0x7835('0x12')]);}logger[_0x7835('0x10')](_0x7835('0x13'),_0x27b4d7,_0x2e1dfb[_0x7835('0x10')][_0x7835('0x12')]);return _0x2b10d7(_0x2e1dfb[_0x7835('0x10')][_0x7835('0x12')]);}else{logger[_0x7835('0xc')](_0x7835('0x13'),_0x27b4d7,_0x7835('0xd'));_0x2b10d7(_0x2e1dfb[_0x7835('0x14')][_0x7835('0x12')]);}})[_0x7835('0x15')](function(_0xc70bf){logger[_0x7835('0x10')](_0x7835('0x13'),_0x27b4d7,_0xc70bf);_0x59581e(_0xc70bf);});});}exports[_0x7835('0x16')]=function(_0x432de0){var _0x22ca2b=this;return new Promise(function(_0x4534e0,_0x375658){return db[_0x7835('0x17')]['update'](_0x432de0[_0x7835('0x18')],{'raw':_0x432de0[_0x7835('0x19')]?_0x432de0['options'][_0x7835('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x432de0['options']?_0x432de0['options'][_0x7835('0x1b')]||null:null,'attributes':_0x432de0[_0x7835('0x19')]?_0x432de0[_0x7835('0x19')][_0x7835('0x1c')]||null:null,'limit':_0x432de0[_0x7835('0x19')]?_0x432de0['options'][_0x7835('0x1d')]||null:null})[_0x7835('0xb')](function(_0x2f8cea){logger[_0x7835('0xc')](_0x7835('0x16'),_0x432de0);logger[_0x7835('0xe')](_0x7835('0x16'),_0x432de0,JSON['stringify'](_0x2f8cea));_0x4534e0(_0x2f8cea);})[_0x7835('0x15')](function(_0x3ef99d){logger[_0x7835('0x10')](_0x7835('0x16'),_0x3ef99d[_0x7835('0x12')],_0x432de0);_0x375658(_0x22ca2b[_0x7835('0x10')](0x1f4,_0x3ef99d[_0x7835('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index b2e1d51..49a83a1 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 _0xe3f3=['/:id/download','download','post','create','/:id/tags','tracked','mail','mailinteraction:update','update','delete','destroy','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/messages','getMessages'];(function(_0x54b8fa,_0x5d1397){var _0x55b736=function(_0x44078c){while(--_0x44078c){_0x54b8fa['push'](_0x54b8fa['shift']());}};_0x55b736(++_0x5d1397);}(_0xe3f3,0xed));var _0x3e3f=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xe3f3[_0xa148b7];return _0x51efd3;};'use strict';var express=require(_0x3e3f('0x0'));var router=express[_0x3e3f('0x1')]();var auth=require(_0x3e3f('0x2'));var interaction=require(_0x3e3f('0x3'));var controller=require(_0x3e3f('0x4'));router['get']('/',auth[_0x3e3f('0x5')](),controller[_0x3e3f('0x6')]);router[_0x3e3f('0x7')](_0x3e3f('0x8'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x3e3f('0x9'),auth['isAuthenticated'](),controller[_0x3e3f('0xa')]);router[_0x3e3f('0x7')](_0x3e3f('0xb'),auth[_0x3e3f('0x5')](),controller[_0x3e3f('0xc')]);router['get'](_0x3e3f('0xd'),auth[_0x3e3f('0x5')](),controller[_0x3e3f('0xe')]);router[_0x3e3f('0xf')]('/',auth[_0x3e3f('0x5')](),controller[_0x3e3f('0x10')]);router['post'](_0x3e3f('0xb'),auth[_0x3e3f('0x5')](),controller['addMessage']);router['post'](_0x3e3f('0x11'),auth[_0x3e3f('0x5')](),interaction[_0x3e3f('0x12')](_0x3e3f('0x13'),'mailinteraction:addtags'),controller['addTags']);router['put'](_0x3e3f('0x9'),auth[_0x3e3f('0x5')](),interaction[_0x3e3f('0x12')](_0x3e3f('0x13'),_0x3e3f('0x14')),controller[_0x3e3f('0x15')]);router[_0x3e3f('0x16')](_0x3e3f('0x9'),auth[_0x3e3f('0x5')](),interaction[_0x3e3f('0x12')](_0x3e3f('0x13'),'mailinteraction:destroy'),controller[_0x3e3f('0x17')]);router[_0x3e3f('0x16')]('/:id/tags',auth[_0x3e3f('0x5')](),controller['removeTags']);module[_0x3e3f('0x18')]=router; \ No newline at end of file +var _0x289b=['post','create','/:id/messages','addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','tracked','mailinteraction:destroy','destroy','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','getMessages','/:id/download','download'];(function(_0xb746a4,_0x355bdc){var _0x4b6a58=function(_0x3ebf70){while(--_0x3ebf70){_0xb746a4['push'](_0xb746a4['shift']());}};_0x4b6a58(++_0x355bdc);}(_0x289b,0x6d));var _0xb289=function(_0x1ff527,_0x54b6d2){_0x1ff527=_0x1ff527-0x0;var _0x51cc75=_0x289b[_0x1ff527];return _0x51cc75;};'use strict';var express=require(_0xb289('0x0'));var router=express[_0xb289('0x1')]();var auth=require(_0xb289('0x2'));var interaction=require(_0xb289('0x3'));var controller=require(_0xb289('0x4'));router['get']('/',auth[_0xb289('0x5')](),controller[_0xb289('0x6')]);router[_0xb289('0x7')](_0xb289('0x8'),auth[_0xb289('0x5')](),controller[_0xb289('0x9')]);router[_0xb289('0x7')](_0xb289('0xa'),auth[_0xb289('0x5')](),controller[_0xb289('0xb')]);router[_0xb289('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0xb289('0xc')]);router[_0xb289('0x7')](_0xb289('0xd'),auth[_0xb289('0x5')](),controller[_0xb289('0xe')]);router[_0xb289('0xf')]('/',auth['isAuthenticated'](),controller[_0xb289('0x10')]);router['post'](_0xb289('0x11'),auth['isAuthenticated'](),controller[_0xb289('0x12')]);router[_0xb289('0xf')](_0xb289('0x13'),auth['isAuthenticated'](),interaction['tracked'](_0xb289('0x14'),_0xb289('0x15')),controller[_0xb289('0x16')]);router[_0xb289('0x17')](_0xb289('0xa'),auth[_0xb289('0x5')](),interaction['tracked'](_0xb289('0x14'),_0xb289('0x18')),controller[_0xb289('0x19')]);router[_0xb289('0x1a')](_0xb289('0xa'),auth[_0xb289('0x5')](),interaction[_0xb289('0x1b')](_0xb289('0x14'),_0xb289('0x1c')),controller[_0xb289('0x1d')]);router['delete']('/:id/tags',auth[_0xb289('0x5')](),controller['removeTags']);module[_0xb289('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 279cd76..1f8c780 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 _0x221b=['BOOLEAN','DATE','STRING','TEXT','long','out','ENUM','sequelize'];(function(_0xe15270,_0x227d06){var _0x1e813b=function(_0x1d590d){while(--_0x1d590d){_0xe15270['push'](_0xe15270['shift']());}};_0x1e813b(++_0x227d06);}(_0x221b,0xbf));var _0xb221=function(_0x22d076,_0x1bb313){_0x22d076=_0x22d076-0x0;var _0x119e6d=_0x221b[_0x22d076];return _0x119e6d;};'use strict';var Sequelize=require(_0xb221('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0xb221('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb221('0x2')]},'disposition':{'type':Sequelize[_0xb221('0x3')]},'secondDisposition':{'type':Sequelize[_0xb221('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xb221('0x3')]},'inReplyTo':{'type':Sequelize[_0xb221('0x3')](0x1fe)},'to':{'type':Sequelize[_0xb221('0x3')]},'cc':{'type':Sequelize[_0xb221('0x4')](_0xb221('0x5'))},'subject':{'type':Sequelize[_0xb221('0x4')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xb221('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xb221('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xb221('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xb221('0x7')]('in',_0xb221('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb221('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xf583=['DATE','ENUM','out','sequelize','iconv','BOOLEAN','STRING','TEXT','long'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf583,0x111));var _0x3f58=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0xf583[_0x381589];return _0x2a075d;};'use strict';var Sequelize=require(_0x3f58('0x0'));var iconv=require(_0x3f58('0x1'));module['exports']={'closed':{'type':Sequelize[_0x3f58('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x3f58('0x3')]},'thirdDisposition':{'type':Sequelize[_0x3f58('0x3')]},'note':{'type':Sequelize[_0x3f58('0x3')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x3f58('0x3')]},'cc':{'type':Sequelize[_0x3f58('0x4')](_0x3f58('0x5'))},'subject':{'type':Sequelize[_0x3f58('0x4')]()},'attach':{'type':Sequelize[_0x3f58('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x3f58('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x3f58('0x6')]},'firstMsgDirection':{'type':Sequelize[_0x3f58('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3f58('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x3f58('0x7')]('in',_0x3f58('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x3f58('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index c5a41f2..557e0fd 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 _0xa9e0=['o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','Setting','enableEmailPreview','all','rows','show','params','includeAll','include','options','create','body','addMessage','ids','omit','getMessages','nolimit','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','Tag','mailInteractionTags:save','download','join','root','server','tmp','attachments','Attachment','Attachments','subject','Messages','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','util','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','socket.io-emitter','redis','./mailInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','Users','fullname','Tags','split','forEach','push','TagIds','MailMessage','findOne','out','-id','plainBody','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','keys','some','compact','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','QueryTypes','SELECT','clone','i.id','order','contactName','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname'];(function(_0x1d0d2b,_0x41539b){var _0x32f442=function(_0x5484e6){while(--_0x5484e6){_0x1d0d2b['push'](_0x1d0d2b['shift']());}};_0x32f442(++_0x41539b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x0a9e('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x0a9e('0x4'));var squel=require(_0x0a9e('0x5'));var juice=require(_0x0a9e('0x6'));var Redis=require(_0x0a9e('0x7'));var qs=require(_0x0a9e('0x8'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0x0a9e('0x9'))(_0x0a9e('0xa'));var config=require(_0x0a9e('0xb'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0a9e('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xd'))(new Redis(config[_0x0a9e('0xe')]));require(_0x0a9e('0xf'))[_0x0a9e('0x10')](socket);function respondWithStatusCode(_0xfeb75b,_0xbd1168){_0xbd1168=_0xbd1168||0xcc;return function(_0x4a4c56){if(_0x4a4c56){return _0xfeb75b['sendStatus'](_0xbd1168);}return _0xfeb75b['status'](_0xbd1168)['end']();};}function respondWithResult(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xc8;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x11')](_0x36471c)[_0x0a9e('0x12')](_0xd5b662);}};}function respondWithFilteredResult(_0x69aeb7,_0x5db4b0){return function(_0x4283ce){if(_0x4283ce){var _0x239b12=typeof _0x5db4b0[_0x0a9e('0x13')]===_0x0a9e('0x14')&&typeof _0x5db4b0[_0x0a9e('0x15')]===_0x0a9e('0x14');var _0x52a03d=_0x4283ce[_0x0a9e('0x16')];var _0x5d0880=_0x239b12?0x0:_0x5db4b0[_0x0a9e('0x13')];var _0x519dfd=_0x239b12?_0x4283ce[_0x0a9e('0x16')]:_0x5db4b0[_0x0a9e('0x13')]+_0x5db4b0['limit'];var _0x225616;if(_0x519dfd>=_0x52a03d){_0x519dfd=_0x52a03d;_0x225616=0xc8;}else{_0x225616=0xce;}_0x69aeb7['status'](_0x225616);return _0x69aeb7[_0x0a9e('0x17')](_0x0a9e('0x18'),_0x5d0880+'-'+_0x519dfd+'/'+_0x52a03d)[_0x0a9e('0x12')](_0x4283ce);}return null;};}function saveUpdates(_0x205fd6){return function(_0x31b1ca){if(_0x31b1ca){return _0x31b1ca[_0x0a9e('0x19')](_0x205fd6)[_0x0a9e('0x1a')](function(_0x20559e){return _0x20559e;});}return null;};}function removeEntity(_0x1314ae){return function(_0x112016){if(_0x112016){return _0x112016[_0x0a9e('0x1b')]()[_0x0a9e('0x1a')](function(){_0x1314ae['status'](0xcc)[_0x0a9e('0x1c')]();});}};}function handleEntityNotFound(_0x155cce){return function(_0x53682f){if(!_0x53682f){_0x155cce[_0x0a9e('0x1d')](0x194);}return _0x53682f;};}function handleError(_0x5a09ef,_0x588269){_0x588269=_0x588269||0x1f4;return function(_0x3a02e1){logger[_0x0a9e('0x1e')](_0x3a02e1[_0x0a9e('0x1f')]);if(_0x3a02e1[_0x0a9e('0x20')]){delete _0x3a02e1['name'];}_0x5a09ef[_0x0a9e('0x11')](_0x588269)[_0x0a9e('0x21')](_0x3a02e1);};}function getInteractionUsers(_0x3b45bc,_0x4d00e6){return new BPromise(function(_0x370d86,_0x42ac8f){try{if(_0x4d00e6[_0x3b45bc['id']]){_0x3b45bc[_0x0a9e('0x22')]=_['map'](_0x4d00e6[_0x3b45bc['id']],function(_0x59181e){return{'id':_0x59181e['id'],'fullname':_0x59181e[_0x0a9e('0x23')]};});}}catch(_0x3a8e58){_0x42ac8f(_0x3a8e58);}_0x370d86(_0x3b45bc);});}function getInteractionTags(_0x40c424,_0x33161b){return new BPromise(function(_0x526cf3,_0x384319){try{if(_0x40c424['TagIds']){_0x40c424[_0x0a9e('0x24')]=[];_0x40c424['TagIds'][_0x0a9e('0x25')](',')[_0x0a9e('0x26')](function(_0x25fba9){_0x40c424[_0x0a9e('0x24')][_0x0a9e('0x27')](_0x33161b[_0x25fba9]);});}delete _0x40c424[_0x0a9e('0x28')];}catch(_0x11c3b6){_0x384319(_0x11c3b6);}_0x526cf3(_0x40c424);});}function getLastMessageText(_0x14de77){return new BPromise(function(_0x5a101a,_0x3652a7){return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]({'where':{'$and':[{'MailInteractionId':_0x14de77['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0a9e('0x2b')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x0a9e('0x2c'),'raw':!![]})[_0x0a9e('0x1a')](function(_0x1843b2){if(_0x1843b2&&_0x1843b2[_0x0a9e('0x2d')]){_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1843b2[_0x0a9e('0x2d')]);}_0x5a101a(_0x14de77);})[_0x0a9e('0x30')](function(_0x1dbde2){_0x3652a7(_0x1dbde2);});});}function updateMailInteraction(_0x540530,_0x426950,_0x5d1e0e,_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return getInteractionUsers(_0x540530,_0x5d1e0e)[_0x0a9e('0x1a')](function(_0x25ce3a){return getInteractionTags(_0x25ce3a,_0x426950);})['then'](function(_0x66c1d2){if(_0x2407f9){_0x3ae878(getLastMessageText(_0x66c1d2));}else{_0x3ae878(_0x66c1d2);}})[_0x0a9e('0x30')](function(_0x40cb85){_0x1122db(_0x40cb85);});});}exports[_0x0a9e('0x31')]=function(_0x2b45ea,_0x409319){var _0x332d35={},_0x39e565={},_0x5583a4={'count':0x0,'rows':[]};var _0x44295a=_['map'](db[_0x0a9e('0x32')][_0x0a9e('0x33')],function(_0x2b7e7f){return{'name':_0x2b7e7f[_0x0a9e('0x34')],'type':_0x2b7e7f['type'][_0x0a9e('0x35')]};});_0x39e565[_0x0a9e('0x36')]=_[_0x0a9e('0x37')](_0x44295a,_0x0a9e('0x20'));_0x39e565['query']=_['keys'](_0x2b45ea[_0x0a9e('0x38')]);_0x39e565['filters']=_[_0x0a9e('0x39')](_0x39e565[_0x0a9e('0x36')],_0x39e565[_0x0a9e('0x38')]);_0x332d35[_0x0a9e('0x3a')]=_['intersection'](_0x39e565[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x2b45ea[_0x0a9e('0x38')]['fields']));_0x332d35[_0x0a9e('0x3a')]=_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x3c')]?_0x332d35['attributes']:_0x39e565['model'];if(!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3d')]('nolimit')){_0x332d35[_0x0a9e('0x15')]=qs[_0x0a9e('0x15')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x15')]);_0x332d35['offset']=qs['offset'](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x13')]);}_0x332d35['order']=qs[_0x0a9e('0x3e')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x332d35['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x2b45ea[_0x0a9e('0x38')],_0x39e565[_0x0a9e('0x3f')]),_0x44295a);var _0x13cb1f=[];var _0xeaa5e5=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x20'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')](_0x0a9e('0x45'));var _0x37f6cc=squel['select']()['field'](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x42')](_0x0a9e('0x48'))[_0x0a9e('0x44')](_0x0a9e('0x49'),'ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x2c2cb0=squel[_0x0a9e('0x41')]()['from'](_0x0a9e('0x4d'),'i')[_0x0a9e('0x4a')](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')]('mail_accounts','a',_0x0a9e('0x51'))['left_join'](_0x0a9e('0x52'),'me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it',_0x0a9e('0x54'))[_0x0a9e('0x4a')](_0x0a9e('0x45'),'t',_0x0a9e('0x55'));var _0x45c845=squel[_0x0a9e('0x56')]();var _0x45bf7f=[];var _0x5bbcde=squel[_0x0a9e('0x56')]();var _0x1bde3c;if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]){_0x1bde3c=as[_0x0a9e('0x58')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]);var _0x19383e=_0x1bde3c[_0x0a9e('0x59')];for(var _0x58a5c2=0x0;_0x58a5c2<_0x1bde3c[_0x0a9e('0x5a')][_0x0a9e('0x3c')];_0x58a5c2++){var _0x4f7240=_0x1bde3c['conditions'][_0x58a5c2];var _0x5ddf84='i';var _0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,[_0x0a9e('0x20'),_0x4f7240[_0x0a9e('0x42')]]);if(!_0x1adfee){switch(_0x4f7240[_0x0a9e('0x42')]){case _0x0a9e('0x5c'):if(_0x4f7240[_0x0a9e('0x5d')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')]('`'+_0x4f7240['field']+'`\x20=\x200');}else{_0x2c2cb0['having']('`'+_0x4f7240[_0x0a9e('0x42')]+_0x0a9e('0x5f'));}break;case _0x0a9e('0x60'):if(_0x4f7240['operator']===_0x0a9e('0x61')){if(_0x4f7240[_0x0a9e('0x5d')]['split']('\x20')['length']>0x1){_0x45c845[_0x19383e](_0x0a9e('0x62'),qs['getFullTextValue'](_0x4f7240[_0x0a9e('0x5d')]),null);}else{var _0x4c3845='%'+_0x4f7240[_0x0a9e('0x5d')]+'%';_0x45c845[_0x19383e](_0x0a9e('0x63'),_0x4c3845,_0x4c3845,_0x4c3845);}}else{_0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,['name',_0x0a9e('0x64')]);_0x4f7240[_0x0a9e('0x42')]='ContactId';_0x2244d6=as['buildExpression'](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6['value'][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'Tag':var _0xe22ccc=_0x4f7240['value']['split'](',')['map'](function(_0x2da03c){return Number(_0x2da03c);});_0xe22ccc['forEach'](function(_0x2f7092){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x2f7092+',%');});_0x45bf7f=_[_0x0a9e('0x69')](_0x45bf7f,_0xe22ccc);break;case _0x0a9e('0x6a'):if(_0x4f7240[_0x0a9e('0x6b')]===_0x0a9e('0x61')){_0x45c845[_0x19383e](_0x0a9e('0x6c'),'%'+_0x4f7240[_0x0a9e('0x5d')]+'%',null);}else{_0x1adfee=_['find'](_0x44295a,[_0x0a9e('0x20'),_0x0a9e('0x6d')]);_0x4f7240[_0x0a9e('0x42')]=_0x0a9e('0x6d');_0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'plainBody':_0x2244d6=as[_0x0a9e('0x6e')]('me',null,_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6['value']['start'],_0x2244d6[_0x0a9e('0x5d')]['end']);break;}}else{var _0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}}}else{var _0x5854cc=_(_0x2b45ea[_0x0a9e('0x38')])[_0x0a9e('0x6f')]()[_0x0a9e('0x37')](function(_0x5adf8f){return _[_0x0a9e('0x70')](_0x44295a,[_0x0a9e('0x20'),_0x5adf8f])?_0x5adf8f:undefined;})[_0x0a9e('0x71')]()[_0x0a9e('0x5d')]();if(!_['isEmpty'](_0x5854cc)){_0x5854cc[_0x0a9e('0x26')](function(_0xe05a5a){if(_0xe05a5a==='MailAccountId'){_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x73'),[][_0x0a9e('0x74')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]));}else if(_0xe05a5a===_0x0a9e('0x75')){var _0x4d4a35=JSON[_0x0a9e('0x76')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a])[_0x0a9e('0x77')];var _0x47bb43=JSON[_0x0a9e('0x76')](_0x2b45ea['query'][_0xe05a5a])['$lte'];_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x78'),_0x4d4a35,_0x47bb43);}else{if(_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]===_0x0a9e('0x79')){_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7a'));}else{_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7b'),_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]);}}});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7d'));}else{_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7e'));}}if(_0x2b45ea[_0x0a9e('0x38')]['tag']){_0x45bf7f=_[_0x0a9e('0x7f')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x80')])?_0x2b45ea['query'][_0x0a9e('0x80')]:new Array(_0x2b45ea[_0x0a9e('0x38')]['tag']);_0x45bf7f[_0x0a9e('0x26')](function(_0x56e31e){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x56e31e+',%');});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x81')]){var _0x4a43a8=_0x2b45ea['query']['filter'][_0x0a9e('0x82')]('\x5c','\x5c\x5c')[_0x0a9e('0x82')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x83')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x84'),_0x4a43a8+'%');}else if(qs[_0x0a9e('0x85')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x86'),_0x4a43a8+'%');}else{_0x45c845['or'](_0x0a9e('0x87'),qs[_0x0a9e('0x88')](_0x4a43a8))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a9e('0x88')](_0x4a43a8));}}}_0x2c2cb0[_0x0a9e('0x72')](_0x45c845);_0x2c2cb0[_0x0a9e('0x89')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x8a')][_0x0a9e('0x8b')],'raw':!![]};var _0x4c46c1=_0x2c2cb0[_0x0a9e('0x8c')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5c'));if(_0x332d35[_0x0a9e('0x8e')]){_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x26')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x8f')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x2c2cb0[_0x0a9e('0x8e')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x45bf7f)){_0x2c2cb0[_0x0a9e('0x5e')](_0x5bbcde);_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x91'),_0x45bf7f);}BPromise[_0x0a9e('0x92')]()[_0x0a9e('0x1a')](function(){if(!_0x1bde3c){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return;_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x94'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x94'));return;}if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]!==_0x0a9e('0x97'))return;return _0x2b45ea['user'][_0x0a9e('0x98')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x1a')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x99'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x99'));}else{_0x4c46c1['where']('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));_0x2c2cb0[_0x0a9e('0x72')]('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));}});})['then'](function(){if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]==='agent'&&!_0x1bde3c&&!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0x4c46c1[_0x0a9e('0x9b')](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x444f1f){_0x5583a4['count']=_0x444f1f[_0x0a9e('0x3c')];if(_0x5583a4[_0x0a9e('0x16')]===0x0)return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0xeaa5e5['toString'](),_0x2bdc44)[_0x0a9e('0x1a')](function(_0xf0db1){_0x13cb1f=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x9c')](_0x2bdc44,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3b')]){_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x26')](function(_0x5af453){_0x2c2cb0['field']('i.'+_0x5af453);});}else{_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x9d'),_0x0a9e('0x5c'));_0x2c2cb0['field'](_0x0a9e('0x9e'),_0x0a9e('0x9f'));_0x2c2cb0['field']('a.mandatoryDisposition',_0x0a9e('0xa0'));_0x2c2cb0['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa1'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa2'));_0x2c2cb0['field'](_0x0a9e('0xa3'));_0x2c2cb0['field'](_0x0a9e('0xa4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa5'));_0x2c2cb0[_0x0a9e('0x42')]('i.lastMsgAt');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa6'));_0x2c2cb0[_0x0a9e('0x42')]('i.subject');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa7'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa9'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xaa'));_0x2c2cb0['field'](_0x0a9e('0xab'));_0x2c2cb0[_0x0a9e('0x42')]('i.ContactId');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xac'));_0x2c2cb0[_0x0a9e('0x42')]('i.UserId');_0x2c2cb0[_0x0a9e('0x42')]('c.firstName',_0x0a9e('0xad'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb0'),_0x0a9e('0xb1'));_0x2c2cb0[_0x0a9e('0x42')]('c.phone',_0x0a9e('0xb2'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb3'),_0x0a9e('0xb4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb5'),_0x0a9e('0xb6'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb7'),_0x0a9e('0xb8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb9'),_0x0a9e('0xba'));_0x2c2cb0['field'](_0x0a9e('0xbb'),_0x0a9e('0x28'));}if(_0x332d35[_0x0a9e('0x15')])_0x2c2cb0[_0x0a9e('0x15')](_0x332d35[_0x0a9e('0x15')]);if(_0x332d35['offset'])_0x2c2cb0[_0x0a9e('0x13')](_0x332d35[_0x0a9e('0x13')]);return db['sequelize'][_0x0a9e('0x38')](_0x2c2cb0['toString'](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x27041d){if(_0x27041d[_0x0a9e('0x3c')]>0x0)_0x37f6cc[_0x0a9e('0x72')]('ui.MailInteractionId\x20IN\x20?',_[_0x0a9e('0x37')](_0x27041d,'id'));return db['sequelize'][_0x0a9e('0x38')](_0x37f6cc[_0x0a9e('0x9b')](),_0x2bdc44)['then'](function(_0x231c6a){var _0x63c9f7=_[_0x0a9e('0xbc')](_0x231c6a,'MailInteractionId');var _0x4c788f=[];return db[_0x0a9e('0xbd')][_0x0a9e('0x2a')]({'attributes':[_0x0a9e('0xbe')],'raw':!![]})[_0x0a9e('0x1a')](function(_0x3f2f40){var _0x2450a8=_0x3f2f40[_0x0a9e('0xbe')];_0x27041d[_0x0a9e('0x26')](function(_0x3f8124){_0x4c788f['push'](updateMailInteraction(_0x3f8124,_0x13cb1f,_0x63c9f7,_0x2450a8));});return BPromise[_0x0a9e('0xbf')](_0x4c788f);});});});})['then'](function(_0x287324){_0x5583a4[_0x0a9e('0xc0')]=_0x287324;return _0x5583a4;})[_0x0a9e('0x1a')](respondWithFilteredResult(_0x409319,_0x332d35))[_0x0a9e('0x30')](handleError(_0x409319,null));};exports[_0x0a9e('0xc1')]=function(_0x4e7273,_0x436313){var _0x4667bf={'raw':![],'where':{'id':_0x4e7273[_0x0a9e('0xc2')]['id']}},_0x2791c5={};_0x2791c5[_0x0a9e('0x36')]=_['keys'](db['MailInteraction'][_0x0a9e('0x33')]);_0x2791c5['query']=_[_0x0a9e('0x6f')](_0x4e7273[_0x0a9e('0x38')]);_0x2791c5[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x2791c5[_0x0a9e('0x36')],_0x2791c5[_0x0a9e('0x38')]);_0x4667bf['attributes']=_['intersection'](_0x2791c5[_0x0a9e('0x36')],qs['fields'](_0x4e7273[_0x0a9e('0x38')]['fields']));_0x4667bf[_0x0a9e('0x3a')]=_0x4667bf['attributes']['length']?_0x4667bf[_0x0a9e('0x3a')]:_0x2791c5[_0x0a9e('0x36')];if(_0x4e7273['query'][_0x0a9e('0xc3')]){_0x4667bf[_0x0a9e('0xc4')]=[{'all':!![]}];}_0x4667bf=_[_0x0a9e('0x9c')]({},_0x4667bf,_0x4e7273[_0x0a9e('0xc5')]);return db[_0x0a9e('0x32')]['find'](_0x4667bf)['then'](handleEntityNotFound(_0x436313,null))[_0x0a9e('0x1a')](respondWithResult(_0x436313,null))[_0x0a9e('0x30')](handleError(_0x436313,null));};exports[_0x0a9e('0xc6')]=function(_0x24beb6,_0x59303b){return db['MailInteraction'][_0x0a9e('0xc6')](_0x24beb6[_0x0a9e('0xc7')],{})['then'](respondWithResult(_0x59303b,0xc9))[_0x0a9e('0x30')](handleError(_0x59303b,null));};exports[_0x0a9e('0x19')]=function(_0xcacabb,_0x2427d5){if(_0xcacabb[_0x0a9e('0xc7')]['id']){delete _0xcacabb[_0x0a9e('0xc7')]['id'];}return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0xcacabb[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x2427d5,null))['then'](saveUpdates(_0xcacabb[_0x0a9e('0xc7')],null))[_0x0a9e('0x1a')](respondWithResult(_0x2427d5,null))[_0x0a9e('0x30')](handleError(_0x2427d5,null));};exports[_0x0a9e('0x1b')]=function(_0x1d0b02,_0x547e37){return db['MailInteraction'][_0x0a9e('0x5b')]({'where':{'id':_0x1d0b02[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x547e37,null))[_0x0a9e('0x1a')](removeEntity(_0x547e37,null))[_0x0a9e('0x30')](handleError(_0x547e37,null));};exports['describe']=function(_0x1339d0,_0x3c775a){return db[_0x0a9e('0x32')]['describe']()[_0x0a9e('0x1a')](respondWithResult(_0x3c775a,null))['catch'](handleError(_0x3c775a,null));};exports[_0x0a9e('0xc8')]=function(_0x4799d4,_0x25b745){return db[_0x0a9e('0x29')][_0x0a9e('0x5b')]({'where':{'id':_0x4799d4['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x25b745,null))['then'](function(_0x4383da){if(_0x4383da){return _0x4383da[_0x0a9e('0xc8')](_0x4799d4[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x4799d4[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{});}})[_0x0a9e('0x1a')](respondWithResult(_0x25b745,null))[_0x0a9e('0x30')](handleError(_0x25b745,null));};exports[_0x0a9e('0xcb')]=function(_0x4262d0,_0xc876d4){var _0x2415fe={'raw':![],'where':{}};var _0x399def={};var _0x98c62c={'count':0x0,'rows':[]};return db[_0x0a9e('0x32')]['findOne']({'where':{'id':_0x4262d0['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0xc876d4,null))['then'](function(_0x1d999b){if(_0x1d999b){_0x399def[_0x0a9e('0x36')]=_['keys'](db[_0x0a9e('0x29')][_0x0a9e('0x33')]);_0x399def[_0x0a9e('0x38')]=_[_0x0a9e('0x6f')](_0x4262d0['query']);_0x399def[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],_0x399def[_0x0a9e('0x38')]);_0x2415fe['attributes']=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x4262d0['query'][_0x0a9e('0x3b')]));_0x2415fe[_0x0a9e('0x3a')]=_0x2415fe[_0x0a9e('0x3a')]['length']?_0x2415fe[_0x0a9e('0x3a')]:_0x399def[_0x0a9e('0x36')];if(!_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3d')](_0x0a9e('0xcc'))){_0x2415fe['limit']=qs[_0x0a9e('0x15')](_0x4262d0[_0x0a9e('0x38')]['limit']);_0x2415fe[_0x0a9e('0x13')]=qs[_0x0a9e('0x13')](_0x4262d0[_0x0a9e('0x38')]['offset']);}_0x2415fe['order']=qs['sort'](_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x2415fe['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x4262d0[_0x0a9e('0x38')],_0x399def['filters']));_0x2415fe[_0x0a9e('0x72')][_0x0a9e('0xcd')]=_0x1d999b['id'];if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x81')]){_0x2415fe[_0x0a9e('0x72')]=_[_0x0a9e('0x9c')](_0x2415fe[_0x0a9e('0x72')],{'$or':_[_0x0a9e('0x37')](_0x2415fe[_0x0a9e('0x3a')],function(_0x5a1848){var _0x43c397={};_0x43c397[_0x5a1848]={'$like':'%'+_0x4262d0['query'][_0x0a9e('0x81')]+'%'};return _0x43c397;})});}if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]){var _0x3cf222=_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]['split'](',');var _0x1a0314={};_0x1a0314[_0x3cf222[0x0]]={'$gte':moment(_0x3cf222[0x1])[_0x0a9e('0xce')](_0x0a9e('0xcf'))};_0x2415fe[_0x0a9e('0x72')]=_['merge'](_0x2415fe[_0x0a9e('0x72')],_0x1a0314);}_0x2415fe=_[_0x0a9e('0x9c')]({},_0x2415fe,_0x4262d0[_0x0a9e('0xc5')]);return db[_0x0a9e('0x29')][_0x0a9e('0x16')]({'where':_0x2415fe[_0x0a9e('0x72')]})[_0x0a9e('0x1a')](function(_0x25931e){_0x98c62c[_0x0a9e('0x16')]=_0x25931e;if(_0x4262d0[_0x0a9e('0x38')]['includeAll']){_0x2415fe[_0x0a9e('0xc4')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0xd0')](_0x2415fe);})[_0x0a9e('0x1a')](function(_0xea8bd1){if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0xd1')]===_0x0a9e('0xd2')){for(var _0x566b90=0x0;_0x566b90<_0xea8bd1[_0x0a9e('0x3c')];_0x566b90++){_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]=juice(_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]);}}_0x98c62c['rows']=_0xea8bd1;return _0x98c62c;});}})[_0x0a9e('0x1a')](respondWithFilteredResult(_0xc876d4,_0x2415fe))[_0x0a9e('0x30')](handleError(_0xc876d4,null));};exports[_0x0a9e('0xd3')]=function(_0x97d5b5,_0x370b5e){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x97d5b5[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x370b5e,null))[_0x0a9e('0x1a')](function(_0x5a7dad){if(_0x5a7dad){return _0x5a7dad[_0x0a9e('0xd4')](_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x97d5b5[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{})['spread'](function(){return db[_0x0a9e('0xd5')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')]}});})[_0x0a9e('0x1a')](function(_0x2a07d0){socket['emit'](_0x0a9e('0xd6'),{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]});return{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]};});}})[_0x0a9e('0x1a')](respondWithResult(_0x370b5e,null))[_0x0a9e('0x30')](handleError(_0x370b5e,null));};exports['removeTags']=function(_0x57b1b1,_0x9484c8){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x57b1b1['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x9484c8,null))[_0x0a9e('0x1a')](function(_0x422f0a){if(_0x422f0a){return _0x422f0a['removeTags'](_0x57b1b1[_0x0a9e('0x38')][_0x0a9e('0xc9')]);}})[_0x0a9e('0x1a')](respondWithStatusCode(_0x9484c8,null))['catch'](handleError(_0x9484c8,null));};exports[_0x0a9e('0xd7')]=function(_0x336b30,_0x3b7213){var _0x549e03=moment()['unix']()['toString']();var _0x3b04fd=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdb'));var _0x532424=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdc'));var _0x33a26c=path[_0x0a9e('0xd8')](_0x3b04fd,_0x549e03);var _0x580dd6=util[_0x0a9e('0xce')]('transcript-%d-%s.zip',_0x336b30[_0x0a9e('0xc2')]['id'],_0x549e03);var _0x5c57e1=path[_0x0a9e('0xd8')](_0x3b04fd,_0x580dd6);var _0x57b7d4=[];if(_0x336b30[_0x0a9e('0x38')][_0x0a9e('0xdc')]){_0x57b7d4[_0x0a9e('0x27')]({'model':db[_0x0a9e('0xdd')],'as':_0x0a9e('0xde'),'raw':!![]});}var _0x251dd9=[{'model':db[_0x0a9e('0x29')],'as':'Messages','attributes':['id',_0x0a9e('0xc7'),_0x0a9e('0x44'),'to','cc','bcc',_0x0a9e('0xdf'),_0x0a9e('0x75')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x57b7d4}];return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x336b30[_0x0a9e('0xc2')]['id']},'include':_0x251dd9})['then'](handleEntityNotFound(_0x3b7213,null))[_0x0a9e('0x1a')](function(_0xf49ed4){if(_0xf49ed4&&_0xf49ed4[_0x0a9e('0xe0')]){var _0x3f0d64=_0xf49ed4[_0x0a9e('0xe1')]({'plain':!![]});fs[_0x0a9e('0xe2')](_0x33a26c);return BPromise[_0x0a9e('0xe3')](_0x3f0d64[_0x0a9e('0xe0')],function(_0x22767f,_0x426c3c){var _0x56e148={'from':_0x22767f[_0x0a9e('0x44')],'to':_0x22767f['to'],'subject':_0x22767f['subject'],'html':_0x22767f[_0x0a9e('0xc7')],'headers':{'Date':moment(_0x22767f[_0x0a9e('0x75')])[_0x0a9e('0xce')](_0x0a9e('0xe4'))},'attachments':[]};if(_0x22767f['cc']){_0x56e148[_0x0a9e('0xe5')]['Cc']=_0x22767f['cc'];}if(_0x22767f[_0x0a9e('0xe6')]){_0x56e148['headers'][_0x0a9e('0xe7')]=_0x22767f[_0x0a9e('0xe6')];}return new BPromise(function(_0x2977a7,_0x55a599){if(_0x22767f[_0x0a9e('0xde')]){for(var _0x402544=0x0;_0x402544<_0x22767f[_0x0a9e('0xde')][_0x0a9e('0x3c')];_0x402544++){var _0x31e1e0=_0x22767f[_0x0a9e('0xde')][_0x402544];var _0x1e93f5=path['join'](_0x532424,_0x31e1e0[_0x0a9e('0xe8')]);if(fs[_0x0a9e('0xe9')](_0x1e93f5)){_0x56e148[_0x0a9e('0xdc')][_0x0a9e('0x27')]({'name':_0x31e1e0[_0x0a9e('0x20')],'contentType':_0x31e1e0[_0x0a9e('0x65')],'data':fs[_0x0a9e('0xea')](_0x1e93f5)});}}}emlformat['build'](_0x56e148,function(_0x5c8720,_0x10aa22){if(_0x5c8720)return _0x55a599(_0x5c8720);fs[_0x0a9e('0xeb')](path[_0x0a9e('0xd8')](_0x33a26c,util[_0x0a9e('0xce')](_0x0a9e('0xec'),_0x426c3c)),_0x10aa22);return _0x2977a7(_0x10aa22);});});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x609711,_0x584854){zipdir(_0x33a26c,{'saveTo':_0x5c57e1},function(_0x39ea62,_0x1d7fc4){if(_0x39ea62)return _0x584854(_0x39ea62);return _0x609711(_0x1d7fc4);});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x2675a5,_0x1b1757){rimraf(_0x33a26c,function(_0x3c6082){if(_0x3c6082)_0x1b1757(_0x3c6082);return _0x2675a5();});});})[_0x0a9e('0x1a')](function(){return _0x3b7213['download'](_0x5c57e1,_0x580dd6,function(_0x311288){if(!_0x311288)fs[_0x0a9e('0xed')](_0x5c57e1);});});});}else{return _0x3b7213[_0x0a9e('0x1d')](0xc8);}})['catch'](handleError(_0x3b7213,null));}; \ No newline at end of file +var _0xb10b=['Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','findOne','enableEmailPreview','show','params','rawAttributes','includeAll','include','merge','options','create','body','describe','addMessage','ids','omit','getMessages','nolimit','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','rows','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','server','tmp','root','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','subject','get','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','build','message%d.eml','unlinkSync','eml-format','zip-dir','moment','bluebird','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','error','stack','name','send','fullname','TagIds','Tags','split','forEach','push','MailMessage','out','-id','trimStart','plainBody','catch','index','map','MailInteraction','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','field','color','tools_tags','u.id','ui.MailInteractionId','from','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','mail_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','length','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','compact','isEmpty','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','isEmail','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','agent','toString','sequelize','keyBy','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.ContactId','i.MailAccountId','Contact.firstName','c.email'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xb10b,0x12a));var _0xbb10=function(_0x15d21f,_0x10997d){_0x15d21f=_0x15d21f-0x0;var _0x50b48d=_0xb10b[_0x15d21f];return _0x50b48d;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var BPromise=require(_0xbb10('0x3'));var util=require('util');var path=require(_0xbb10('0x4'));var fs=require('fs');var _=require(_0xbb10('0x5'));var squel=require(_0xbb10('0x6'));var juice=require(_0xbb10('0x7'));var Redis=require(_0xbb10('0x8'));var qs=require(_0xbb10('0x9'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0xbb10('0xa'))(_0xbb10('0xb'));var config=require('../../config/environment');var db=require(_0xbb10('0xc'))['db'];config[_0xbb10('0xd')]=_[_0xbb10('0xe')](config[_0xbb10('0xd')],{'host':_0xbb10('0xf'),'port':0x18eb});var socket=require(_0xbb10('0x10'))(new Redis(config[_0xbb10('0xd')]));require(_0xbb10('0x11'))['register'](socket);function respondWithStatusCode(_0x4e47f8,_0x20bd61){_0x20bd61=_0x20bd61||0xcc;return function(_0x118a74){if(_0x118a74){return _0x4e47f8[_0xbb10('0x12')](_0x20bd61);}return _0x4e47f8['status'](_0x20bd61)[_0xbb10('0x13')]();};}function respondWithResult(_0x5be7e0,_0x44fb19){_0x44fb19=_0x44fb19||0xc8;return function(_0x916a32){if(_0x916a32){return _0x5be7e0[_0xbb10('0x14')](_0x44fb19)[_0xbb10('0x15')](_0x916a32);}};}function respondWithFilteredResult(_0x442548,_0x147230){return function(_0x58a612){if(_0x58a612){var _0x26e021=typeof _0x147230[_0xbb10('0x16')]===_0xbb10('0x17')&&typeof _0x147230[_0xbb10('0x18')]===_0xbb10('0x17');var _0x2f2ebf=_0x58a612[_0xbb10('0x19')];var _0x36b5e8=_0x26e021?0x0:_0x147230[_0xbb10('0x16')];var _0x2b184e=_0x26e021?_0x58a612['count']:_0x147230[_0xbb10('0x16')]+_0x147230[_0xbb10('0x18')];var _0x133ac2;if(_0x2b184e>=_0x2f2ebf){_0x2b184e=_0x2f2ebf;_0x133ac2=0xc8;}else{_0x133ac2=0xce;}_0x442548[_0xbb10('0x14')](_0x133ac2);return _0x442548[_0xbb10('0x1a')](_0xbb10('0x1b'),_0x36b5e8+'-'+_0x2b184e+'/'+_0x2f2ebf)[_0xbb10('0x15')](_0x58a612);}return null;};}function saveUpdates(_0x30efc6){return function(_0xbf2906){if(_0xbf2906){return _0xbf2906[_0xbb10('0x1c')](_0x30efc6)['then'](function(_0x5ff0cf){return _0x5ff0cf;});}return null;};}function removeEntity(_0x19f48d){return function(_0x388fab){if(_0x388fab){return _0x388fab[_0xbb10('0x1d')]()[_0xbb10('0x1e')](function(){_0x19f48d[_0xbb10('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12f888){return function(_0x12ef77){if(!_0x12ef77){_0x12f888['sendStatus'](0x194);}return _0x12ef77;};}function handleError(_0x4c4b0d,_0x8e2b97){_0x8e2b97=_0x8e2b97||0x1f4;return function(_0x311abe){logger[_0xbb10('0x1f')](_0x311abe[_0xbb10('0x20')]);if(_0x311abe[_0xbb10('0x21')]){delete _0x311abe[_0xbb10('0x21')];}_0x4c4b0d[_0xbb10('0x14')](_0x8e2b97)[_0xbb10('0x22')](_0x311abe);};}function getInteractionUsers(_0x7f2377,_0x395404){return new BPromise(function(_0x3ba6cd,_0x26ad93){try{if(_0x395404[_0x7f2377['id']]){_0x7f2377['Users']=_['map'](_0x395404[_0x7f2377['id']],function(_0x4fb5e0){return{'id':_0x4fb5e0['id'],'fullname':_0x4fb5e0[_0xbb10('0x23')]};});}}catch(_0x3c5ae7){_0x26ad93(_0x3c5ae7);}_0x3ba6cd(_0x7f2377);});}function getInteractionTags(_0x2c89b9,_0x4e25ff){return new BPromise(function(_0x2fdde9,_0x24d586){try{if(_0x2c89b9[_0xbb10('0x24')]){_0x2c89b9[_0xbb10('0x25')]=[];_0x2c89b9[_0xbb10('0x24')][_0xbb10('0x26')](',')[_0xbb10('0x27')](function(_0x4aabb9){_0x2c89b9[_0xbb10('0x25')][_0xbb10('0x28')](_0x4e25ff[_0x4aabb9]);});}delete _0x2c89b9[_0xbb10('0x24')];}catch(_0x2e0249){_0x24d586(_0x2e0249);}_0x2fdde9(_0x2c89b9);});}function getLastMessageText(_0x1d30aa){return new BPromise(function(_0x2ff4c1,_0x5d5c80){return db[_0xbb10('0x29')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x1d30aa['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xbb10('0x2a')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xbb10('0x2b'),'raw':!![]})[_0xbb10('0x1e')](function(_0x1b59f9){if(_0x1b59f9&&_0x1b59f9['plainBody']){_0x1d30aa['lastMsgText']=_[_0xbb10('0x2c')](_0x1b59f9[_0xbb10('0x2d')]);}_0x2ff4c1(_0x1d30aa);})['catch'](function(_0x359ad4){_0x5d5c80(_0x359ad4);});});}function updateMailInteraction(_0x37dde7,_0x2f653f,_0x1c0b57,_0x37a83f){return new BPromise(function(_0x138bc6,_0xf85197){return getInteractionUsers(_0x37dde7,_0x1c0b57)['then'](function(_0x25acb3){return getInteractionTags(_0x25acb3,_0x2f653f);})[_0xbb10('0x1e')](function(_0x441d15){if(_0x37a83f){_0x138bc6(getLastMessageText(_0x441d15));}else{_0x138bc6(_0x441d15);}})[_0xbb10('0x2e')](function(_0xfb2c5e){_0xf85197(_0xfb2c5e);});});}exports[_0xbb10('0x2f')]=function(_0x188cbd,_0x10202c){var _0x3c8d7d={},_0x56943c={},_0x2b5352={'count':0x0,'rows':[]};var _0x150107=_[_0xbb10('0x30')](db[_0xbb10('0x31')]['rawAttributes'],function(_0x111762){return{'name':_0x111762['fieldName'],'type':_0x111762['type'][_0xbb10('0x32')]};});_0x56943c[_0xbb10('0x33')]=_[_0xbb10('0x30')](_0x150107,_0xbb10('0x21'));_0x56943c[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x188cbd['query']);_0x56943c[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x56943c['model'],_0x56943c['query']);_0x3c8d7d['attributes']=_[_0xbb10('0x37')](_0x56943c[_0xbb10('0x33')],qs[_0xbb10('0x38')](_0x188cbd['query'][_0xbb10('0x38')]));_0x3c8d7d[_0xbb10('0x39')]=_0x3c8d7d[_0xbb10('0x39')]['length']?_0x3c8d7d[_0xbb10('0x39')]:_0x56943c[_0xbb10('0x33')];if(!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3a')]('nolimit')){_0x3c8d7d[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0x188cbd['query'][_0xbb10('0x18')]);_0x3c8d7d[_0xbb10('0x16')]=qs[_0xbb10('0x16')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x16')]);}_0x3c8d7d[_0xbb10('0x3b')]=qs['sort'](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x3c8d7d[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_['pick'](_0x188cbd[_0xbb10('0x34')],_0x56943c[_0xbb10('0x36')]),_0x150107);var _0x23dc18=[];var _0x403beb=squel['select']()[_0xbb10('0x3e')]('id')[_0xbb10('0x3e')]('name')['field'](_0xbb10('0x3f'))['from'](_0xbb10('0x40'));var _0x180933=squel['select']()[_0xbb10('0x3e')](_0xbb10('0x41'))[_0xbb10('0x3e')]('u.fullname')[_0xbb10('0x3e')](_0xbb10('0x42'))[_0xbb10('0x43')](_0xbb10('0x44'),'ui')[_0xbb10('0x45')](_0xbb10('0x46'),'u',_0xbb10('0x47'));var _0x3efa96=squel[_0xbb10('0x48')]()[_0xbb10('0x43')](_0xbb10('0x49'),'i')[_0xbb10('0x45')]('cm_contacts','c',_0xbb10('0x4a'))[_0xbb10('0x45')]('users','o',_0xbb10('0x4b'))[_0xbb10('0x45')](_0xbb10('0x4c'),'a',_0xbb10('0x4d'))[_0xbb10('0x45')](_0xbb10('0x4e'),'me',_0xbb10('0x4f'))['left_join']('mail_interaction_has_tags','it',_0xbb10('0x50'))[_0xbb10('0x45')](_0xbb10('0x40'),'t','t.id\x20=\x20it.TagId');var _0x5f0c12=squel[_0xbb10('0x51')]();var _0x34cf4e=[];var _0x1bd054=squel[_0xbb10('0x51')]();var _0x10159b;if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]){_0x10159b=as[_0xbb10('0x53')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]);var _0x550111=_0x10159b['sqlOperator'];for(var _0x412e13=0x0;_0x412e13<_0x10159b[_0xbb10('0x54')][_0xbb10('0x55')];_0x412e13++){var _0xb014b0=_0x10159b[_0xbb10('0x54')][_0x412e13];var _0x440f9e='i';var _0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),_0xb014b0[_0xbb10('0x3e')]]);if(!_0x358e7e){switch(_0xb014b0[_0xbb10('0x3e')]){case _0xbb10('0x57'):if(_0xb014b0[_0xbb10('0x58')]==0x1){_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0[_0xbb10('0x3e')]+'`\x20=\x200');}else{_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0['field']+_0xbb10('0x5a'));}break;case _0xbb10('0x5b'):if(_0xb014b0[_0xbb10('0x5c')]===_0xbb10('0x5d')){if(_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')]('\x20')[_0xbb10('0x55')]>0x1){_0x5f0c12[_0x550111](_0xbb10('0x5e'),qs[_0xbb10('0x5f')](_0xb014b0[_0xbb10('0x58')]),null);}else{var _0x44a056='%'+_0xb014b0[_0xbb10('0x58')]+'%';_0x5f0c12[_0x550111](_0xbb10('0x60'),_0x44a056,_0x44a056,_0x44a056);}}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'ContactId']);_0xb014b0[_0xbb10('0x3e')]=_0xbb10('0x61');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')]['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);}break;case _0xbb10('0x65'):var _0x14fed3=_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')](',')[_0xbb10('0x30')](function(_0x12ec18){return Number(_0x12ec18);});_0x14fed3[_0xbb10('0x27')](function(_0x40c4fb){_0x1bd054['or'](_0xbb10('0x66'),'%,'+_0x40c4fb+',%');});_0x34cf4e=_[_0xbb10('0x67')](_0x34cf4e,_0x14fed3);break;case _0xbb10('0x68'):if(_0xb014b0['operator']==='$substring'){_0x5f0c12[_0x550111](_0xbb10('0x69'),'%'+_0xb014b0[_0xbb10('0x58')]+'%',null);}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'UserId']);_0xb014b0['field']=_0xbb10('0x6a');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}break;case _0xbb10('0x2d'):_0x155dc5=as[_0xbb10('0x62')]('me',null,_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5['value']['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);break;}}else{var _0x155dc5=as['buildExpression'](_0x440f9e,_0x358e7e['type'],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}}}else{var _0xa1bbd9=_(_0x188cbd[_0xbb10('0x34')])['keys']()['map'](function(_0x27d7b9){return _[_0xbb10('0x6c')](_0x150107,[_0xbb10('0x21'),_0x27d7b9])?_0x27d7b9:undefined;})[_0xbb10('0x6d')]()['value']();if(!_[_0xbb10('0x6e')](_0xa1bbd9)){_0xa1bbd9[_0xbb10('0x27')](function(_0xa7179d){if(_0xa7179d==='MailAccountId'){_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),[][_0xbb10('0x70')](_0x188cbd['query'][_0xa7179d]));}else if(_0xa7179d===_0xbb10('0x71')){var _0x31e85e=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])['$gte'];var _0x251417=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])[_0xbb10('0x73')];_0x3efa96['where'](_0xbb10('0x74'),_0x31e85e,_0x251417);}else{if(_0x188cbd[_0xbb10('0x34')][_0xa7179d]===_0xbb10('0x75')){_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x76'));}else{_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x77'),_0x188cbd['query'][_0xa7179d]);}}});}if(_0x188cbd['query']['read']){if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x78')]==0x1){_0x3efa96[_0xbb10('0x59')]('`unreadMessages`\x20=\x200');}else{_0x3efa96['having'](_0xbb10('0x79'));}}if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]){_0x34cf4e=_[_0xbb10('0x7b')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')])?_0x188cbd['query'][_0xbb10('0x7a')]:new Array(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]);_0x34cf4e[_0xbb10('0x27')](function(_0x2aaaa6){_0x1bd054['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2aaaa6+',%');});}if(_0x188cbd['query']['filter']){var _0x329da7=_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7c')][_0xbb10('0x7d')]('\x5c','\x5c\x5c')[_0xbb10('0x7d')](/'/g,'\x27\x27');if(qs[_0xbb10('0x7e')](_0x329da7)){_0x5f0c12['or']('i.id\x20LIKE\x20?',_0x329da7+'%');}else if(qs[_0xbb10('0x7f')](_0x329da7)){_0x5f0c12['or']('c.email\x20LIKE\x20?',_0x329da7+'%');}else{_0x5f0c12['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x329da7))['or'](_0xbb10('0x80'),qs[_0xbb10('0x5f')](_0x329da7));}}}_0x3efa96[_0xbb10('0x3d')](_0x5f0c12);_0x3efa96[_0xbb10('0x81')]('i.id');var _0x122d38={'type':db['Sequelize']['QueryTypes'][_0xbb10('0x82')],'raw':!![]};var _0xfe3db0=_0x3efa96[_0xbb10('0x83')]();_0xfe3db0[_0xbb10('0x3e')](_0xbb10('0x84'));_0xfe3db0['field'](_0xbb10('0x85'),_0xbb10('0x57'));if(_0x3c8d7d[_0xbb10('0x3b')]){_0x3c8d7d[_0xbb10('0x3b')][_0xbb10('0x27')](function(_0x27f42f){var _0x174395=_0x27f42f[0x0]==='contactName'?_0x27f42f[0x0]:'i.'+_0x27f42f[0x0];_0x3efa96[_0xbb10('0x3b')](_0x174395,_0x27f42f[0x1]===_0xbb10('0x86')?![]:!![]);});}if(!_[_0xbb10('0x6e')](_0x34cf4e)){_0x3efa96[_0xbb10('0x59')](_0x1bd054);_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x87'),_0x34cf4e);}BPromise[_0xbb10('0x88')]()[_0xbb10('0x1e')](function(){if(!_0x10159b){if(_0x188cbd['query'][_0xbb10('0x89')])return;_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8a'));_0x3efa96['where']('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x188cbd['user'][_0xbb10('0x8b')]!=='agent')return;return _0x188cbd['user'][_0xbb10('0x8c')]({'attributes':['id'],'raw':!![]})[_0xbb10('0x1e')](function(_0x33ff06){if(_[_0xbb10('0x6e')](_0x33ff06)){_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8d'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x8d'));}else{_0xfe3db0[_0xbb10('0x3d')]('i.MailAccountId\x20IN\x20?',_[_0xbb10('0x30')](_0x33ff06,'id'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),_[_0xbb10('0x30')](_0x33ff06,'id'));}});})['then'](function(){if(_0x188cbd['user'][_0xbb10('0x8b')]===_0xbb10('0x8e')&&!_0x10159b&&!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x89')])return[];return db['sequelize'][_0xbb10('0x34')](_0xfe3db0[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0xf7b3e1){_0x2b5352[_0xbb10('0x19')]=_0xf7b3e1['length'];if(_0x2b5352['count']===0x0)return[];return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x403beb[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x256b35){_0x23dc18=_[_0xbb10('0x91')](_0x256b35,'id');_0x122d38=_['merge'](_0x122d38,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x38')]){_0x3c8d7d[_0xbb10('0x39')]['forEach'](function(_0x32d5a5){_0x3efa96[_0xbb10('0x3e')]('i.'+_0x32d5a5);});}else{_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x85'),_0xbb10('0x57'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x92'),_0xbb10('0x93'));_0x3efa96[_0xbb10('0x3e')]('a.mandatoryDisposition',_0xbb10('0x94'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x95'),_0xbb10('0x96'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x84'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x97'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x98'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x99'));_0x3efa96['field']('i.closedAt');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9a'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9b'));_0x3efa96[_0xbb10('0x3e')]('i.lastMsgDirection');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9c'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9d'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9e'));_0x3efa96['field'](_0xbb10('0x9f'));_0x3efa96[_0xbb10('0x3e')]('i.substatus');_0x3efa96[_0xbb10('0x3e')]('i.to');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa0'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa1'));_0x3efa96[_0xbb10('0x3e')]('i.UserId');_0x3efa96[_0xbb10('0x3e')]('c.firstName',_0xbb10('0xa2'));_0x3efa96[_0xbb10('0x3e')]('c.lastName','Contact.lastName');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa3'),_0xbb10('0xa4'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa5'),_0xbb10('0xa6'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa7'),_0xbb10('0xa8'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa9'),'Contact.fax');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xaa'),_0xbb10('0xab'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xac'),_0xbb10('0xad'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xae'),_0xbb10('0x24'));}if(_0x3c8d7d[_0xbb10('0x18')])_0x3efa96[_0xbb10('0x18')](_0x3c8d7d[_0xbb10('0x18')]);if(_0x3c8d7d['offset'])_0x3efa96[_0xbb10('0x16')](_0x3c8d7d['offset']);return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x3efa96[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0x38d369){if(_0x38d369['length']>0x0)_0x180933[_0xbb10('0x3d')](_0xbb10('0xaf'),_[_0xbb10('0x30')](_0x38d369,'id'));return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x180933[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x4bd470){var _0x5cc9d7=_[_0xbb10('0xb0')](_0x4bd470,_0xbb10('0xb1'));var _0x57d5a1=[];return db[_0xbb10('0xb2')][_0xbb10('0xb3')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0xbb10('0x1e')](function(_0xaede56){var _0x5642c3=_0xaede56[_0xbb10('0xb4')];_0x38d369['forEach'](function(_0x34cec7){_0x57d5a1[_0xbb10('0x28')](updateMailInteraction(_0x34cec7,_0x23dc18,_0x5cc9d7,_0x5642c3));});return BPromise['all'](_0x57d5a1);});});});})[_0xbb10('0x1e')](function(_0x28cc74){_0x2b5352['rows']=_0x28cc74;return _0x2b5352;})['then'](respondWithFilteredResult(_0x10202c,_0x3c8d7d))[_0xbb10('0x2e')](handleError(_0x10202c,null));};exports[_0xbb10('0xb5')]=function(_0x3e0e34,_0x3299bc){var _0x3ceb77={'raw':![],'where':{'id':_0x3e0e34[_0xbb10('0xb6')]['id']}},_0x4c3bdc={};_0x4c3bdc[_0xbb10('0x33')]=_[_0xbb10('0x35')](db['MailInteraction'][_0xbb10('0xb7')]);_0x4c3bdc[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x3e0e34[_0xbb10('0x34')]);_0x4c3bdc[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x4c3bdc[_0xbb10('0x33')],_0x4c3bdc[_0xbb10('0x34')]);_0x3ceb77[_0xbb10('0x39')]=_['intersection'](_0x4c3bdc['model'],qs[_0xbb10('0x38')](_0x3e0e34[_0xbb10('0x34')][_0xbb10('0x38')]));_0x3ceb77[_0xbb10('0x39')]=_0x3ceb77[_0xbb10('0x39')][_0xbb10('0x55')]?_0x3ceb77[_0xbb10('0x39')]:_0x4c3bdc[_0xbb10('0x33')];if(_0x3e0e34[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x3ceb77[_0xbb10('0xb9')]=[{'all':!![]}];}_0x3ceb77=_[_0xbb10('0xba')]({},_0x3ceb77,_0x3e0e34[_0xbb10('0xbb')]);return db['MailInteraction'][_0xbb10('0x56')](_0x3ceb77)[_0xbb10('0x1e')](handleEntityNotFound(_0x3299bc,null))[_0xbb10('0x1e')](respondWithResult(_0x3299bc,null))[_0xbb10('0x2e')](handleError(_0x3299bc,null));};exports[_0xbb10('0xbc')]=function(_0xd9284e,_0x4258fc){return db[_0xbb10('0x31')][_0xbb10('0xbc')](_0xd9284e[_0xbb10('0xbd')],{})[_0xbb10('0x1e')](respondWithResult(_0x4258fc,0xc9))['catch'](handleError(_0x4258fc,null));};exports[_0xbb10('0x1c')]=function(_0x5e1ac5,_0x3faaca){if(_0x5e1ac5[_0xbb10('0xbd')]['id']){delete _0x5e1ac5[_0xbb10('0xbd')]['id'];}return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x5e1ac5[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x3faaca,null))[_0xbb10('0x1e')](saveUpdates(_0x5e1ac5['body'],null))[_0xbb10('0x1e')](respondWithResult(_0x3faaca,null))[_0xbb10('0x2e')](handleError(_0x3faaca,null));};exports[_0xbb10('0x1d')]=function(_0x576bb6,_0x2b652c){return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x576bb6[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x2b652c,null))[_0xbb10('0x1e')](removeEntity(_0x2b652c,null))[_0xbb10('0x2e')](handleError(_0x2b652c,null));};exports[_0xbb10('0xbe')]=function(_0x589565,_0x3696b3){return db['MailInteraction'][_0xbb10('0xbe')]()[_0xbb10('0x1e')](respondWithResult(_0x3696b3,null))[_0xbb10('0x2e')](handleError(_0x3696b3,null));};exports[_0xbb10('0xbf')]=function(_0x44c229,_0x40271f){return db[_0xbb10('0x29')]['find']({'where':{'id':_0x44c229[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x40271f,null))['then'](function(_0x1513e0){if(_0x1513e0){return _0x1513e0[_0xbb10('0xbf')](_0x44c229[_0xbb10('0xbd')][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x44c229[_0xbb10('0xbd')],['ids','id'])||{});}})[_0xbb10('0x1e')](respondWithResult(_0x40271f,null))[_0xbb10('0x2e')](handleError(_0x40271f,null));};exports[_0xbb10('0xc2')]=function(_0xb1b7c8,_0x136520){var _0x28127c={'raw':![],'where':{}};var _0x528aff={};var _0xdfdc42={'count':0x0,'rows':[]};return db[_0xbb10('0x31')][_0xbb10('0xb3')]({'where':{'id':_0xb1b7c8[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x136520,null))[_0xbb10('0x1e')](function(_0x2764e1){if(_0x2764e1){_0x528aff['model']=_[_0xbb10('0x35')](db['MailMessage'][_0xbb10('0xb7')]);_0x528aff['query']=_['keys'](_0xb1b7c8[_0xbb10('0x34')]);_0x528aff[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x528aff[_0xbb10('0x33')],_0x528aff[_0xbb10('0x34')]);_0x28127c['attributes']=_[_0xbb10('0x37')](_0x528aff['model'],qs['fields'](_0xb1b7c8['query'][_0xbb10('0x38')]));_0x28127c[_0xbb10('0x39')]=_0x28127c[_0xbb10('0x39')][_0xbb10('0x55')]?_0x28127c[_0xbb10('0x39')]:_0x528aff['model'];if(!_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3a')](_0xbb10('0xc3'))){_0x28127c[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x18')]);_0x28127c['offset']=qs['offset'](_0xb1b7c8['query'][_0xbb10('0x16')]);}_0x28127c[_0xbb10('0x3b')]=qs[_0xbb10('0x3c')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x28127c[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_[_0xbb10('0xc4')](_0xb1b7c8[_0xbb10('0x34')],_0x528aff[_0xbb10('0x36')]));_0x28127c['where']['MailInteractionId']=_0x2764e1['id'];if(_0xb1b7c8['query'][_0xbb10('0x7c')]){_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c['where'],{'$or':_[_0xbb10('0x30')](_0x28127c[_0xbb10('0x39')],function(_0x2c638d){var _0x290280={};_0x290280[_0x2c638d]={'$like':'%'+_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x7c')]+'%'};return _0x290280;})});}if(_0xb1b7c8['query']['$gte']){var _0x356660=_0xb1b7c8['query'][_0xbb10('0xc5')][_0xbb10('0x26')](',');var _0x152ca9={};_0x152ca9[_0x356660[0x0]]={'$gte':moment(_0x356660[0x1])[_0xbb10('0xc6')](_0xbb10('0xc7'))};_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c[_0xbb10('0x3d')],_0x152ca9);}_0x28127c=_[_0xbb10('0xba')]({},_0x28127c,_0xb1b7c8[_0xbb10('0xbb')]);return db['MailMessage'][_0xbb10('0x19')]({'where':_0x28127c['where']})[_0xbb10('0x1e')](function(_0x5547fa){_0xdfdc42[_0xbb10('0x19')]=_0x5547fa;if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x28127c[_0xbb10('0xb9')]=[{'all':!![]}];}return db['MailMessage'][_0xbb10('0xc8')](_0x28127c);})['then'](function(_0xfe1154){if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xc9')]==='true'){for(var _0x298167=0x0;_0x298167<_0xfe1154[_0xbb10('0x55')];_0x298167++){_0xfe1154[_0x298167][_0xbb10('0xbd')]=juice(_0xfe1154[_0x298167][_0xbb10('0xbd')]);}}_0xdfdc42[_0xbb10('0xca')]=_0xfe1154;return _0xdfdc42;});}})[_0xbb10('0x1e')](respondWithFilteredResult(_0x136520,_0x28127c))['catch'](handleError(_0x136520,null));};exports['addTags']=function(_0x522a88,_0x26a752){return db['MailInteraction'][_0xbb10('0x56')]({'where':{'id':_0x522a88['params']['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x26a752,null))[_0xbb10('0x1e')](function(_0x385ad3){if(_0x385ad3){return _0x385ad3['setTags'](_0x522a88['body'][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x522a88[_0xbb10('0xbd')],['ids','id'])||{})[_0xbb10('0xcb')](function(){return db[_0xbb10('0x65')][_0xbb10('0xc8')]({'attributes':['id','name','color'],'where':{'id':_0x522a88['body'][_0xbb10('0xc0')]}});})['then'](function(_0x3dfbcd){socket[_0xbb10('0xcc')](_0xbb10('0xcd'),{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]});return{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]};});}})[_0xbb10('0x1e')](respondWithResult(_0x26a752,null))[_0xbb10('0x2e')](handleError(_0x26a752,null));};exports[_0xbb10('0xce')]=function(_0x2746eb,_0x431792){return db[_0xbb10('0x31')]['find']({'where':{'id':_0x2746eb[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x431792,null))['then'](function(_0x14ef50){if(_0x14ef50){return _0x14ef50['removeTags'](_0x2746eb['query'][_0xbb10('0xc0')]);}})[_0xbb10('0x1e')](respondWithStatusCode(_0x431792,null))[_0xbb10('0x2e')](handleError(_0x431792,null));};exports[_0xbb10('0xcf')]=function(_0x99c4,_0x4ca4ce){var _0x161171=moment()[_0xbb10('0xd0')]()['toString']();var _0xa45726=path[_0xbb10('0xd1')](config['root'],_0xbb10('0xd2'),'files',_0xbb10('0xd3'));var _0x8e8049=path[_0xbb10('0xd1')](config[_0xbb10('0xd4')],_0xbb10('0xd2'),_0xbb10('0xd5'),_0xbb10('0xd6'));var _0x56f902=path[_0xbb10('0xd1')](_0xa45726,_0x161171);var _0x4720a1=util[_0xbb10('0xc6')](_0xbb10('0xd7'),_0x99c4[_0xbb10('0xb6')]['id'],_0x161171);var _0x1301e3=path['join'](_0xa45726,_0x4720a1);var _0x550301=[];if(_0x99c4['query'][_0xbb10('0xd6')]){_0x550301[_0xbb10('0x28')]({'model':db[_0xbb10('0xd8')],'as':_0xbb10('0xd9'),'raw':!![]});}var _0x57700b=[{'model':db[_0xbb10('0x29')],'as':_0xbb10('0xda'),'attributes':['id',_0xbb10('0xbd'),'from','to','cc','bcc',_0xbb10('0xdb'),'createdAt'],'where':{'secret':![]},'order':qs[_0xbb10('0x3c')]('id'),'include':_0x550301}];return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x99c4[_0xbb10('0xb6')]['id']},'include':_0x57700b})[_0xbb10('0x1e')](handleEntityNotFound(_0x4ca4ce,null))[_0xbb10('0x1e')](function(_0x1fe250){if(_0x1fe250&&_0x1fe250['Messages']){var _0x424371=_0x1fe250[_0xbb10('0xdc')]({'plain':!![]});fs['mkdirSync'](_0x56f902);return BPromise[_0xbb10('0xdd')](_0x424371[_0xbb10('0xda')],function(_0x32f261,_0x5b11a2){var _0x4b490a={'from':_0x32f261['from'],'to':_0x32f261['to'],'subject':_0x32f261[_0xbb10('0xdb')],'html':_0x32f261[_0xbb10('0xbd')],'headers':{'Date':moment(_0x32f261['createdAt'])[_0xbb10('0xc6')](_0xbb10('0xde'))},'attachments':[]};if(_0x32f261['cc']){_0x4b490a[_0xbb10('0xdf')]['Cc']=_0x32f261['cc'];}if(_0x32f261[_0xbb10('0xe0')]){_0x4b490a[_0xbb10('0xdf')][_0xbb10('0xe1')]=_0x32f261[_0xbb10('0xe0')];}return new BPromise(function(_0x48f0eb,_0x304603){if(_0x32f261['Attachments']){for(var _0x5a7c4e=0x0;_0x5a7c4e<_0x32f261['Attachments'][_0xbb10('0x55')];_0x5a7c4e++){var _0x572d73=_0x32f261['Attachments'][_0x5a7c4e];var _0x1f09f1=path['join'](_0x8e8049,_0x572d73[_0xbb10('0xe2')]);if(fs[_0xbb10('0xe3')](_0x1f09f1)){_0x4b490a[_0xbb10('0xd6')]['push']({'name':_0x572d73['name'],'contentType':_0x572d73[_0xbb10('0x63')],'data':fs['readFileSync'](_0x1f09f1)});}}}emlformat[_0xbb10('0xe4')](_0x4b490a,function(_0x211172,_0x589ecb){if(_0x211172)return _0x304603(_0x211172);fs['writeFileSync'](path[_0xbb10('0xd1')](_0x56f902,util[_0xbb10('0xc6')](_0xbb10('0xe5'),_0x5b11a2)),_0x589ecb);return _0x48f0eb(_0x589ecb);});});})['then'](function(){return new BPromise(function(_0x4f4aa8,_0x426a4f){zipdir(_0x56f902,{'saveTo':_0x1301e3},function(_0x22f153,_0x4d47cc){if(_0x22f153)return _0x426a4f(_0x22f153);return _0x4f4aa8(_0x4d47cc);});})[_0xbb10('0x1e')](function(){return new BPromise(function(_0x203e5a,_0xe88e90){rimraf(_0x56f902,function(_0x4845b5){if(_0x4845b5)_0xe88e90(_0x4845b5);return _0x203e5a();});});})[_0xbb10('0x1e')](function(){return _0x4ca4ce[_0xbb10('0xcf')](_0x1301e3,_0x4720a1,function(_0x166f4f){if(!_0x166f4f)fs[_0xbb10('0xe6')](_0x1301e3);});});});}else{return _0x4ca4ce[_0xbb10('0x12')](0xc8);}})[_0xbb10('0x2e')](handleError(_0x4ca4ce,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 9c480db..453e06b 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 _0x33c6=['Users','findAll','setDataValue','unreadMessages','length','emit','catch','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','update','remove','getUsers','then'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x33c6,0x15c));var _0x633c=function(_0x155812,_0x44d864){_0x155812=_0x155812-0x0;var _0x2dbbc7=_0x33c6[_0x155812];return _0x2dbbc7;};'use strict';var EventEmitter=require(_0x633c('0x0'));var MailInteraction=require(_0x633c('0x1'))['db'][_0x633c('0x2')];var MailMessage=require(_0x633c('0x1'))['db'][_0x633c('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x633c('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x633c('0x5'),'afterDestroy':_0x633c('0x6')};function emitEvent(_0xbed90b){return function(_0x594794,_0x2c8f6c,_0x273daa){_0x594794[_0x633c('0x7')]({'attributes':['id'],'raw':!![]})[_0x633c('0x8')](function(_0x24a55e){_0x594794['setDataValue'](_0x633c('0x9'),_0x24a55e['map'](function(_0x1876b8){return{'id':_0x1876b8['id']};}));return MailMessage[_0x633c('0xa')]({'where':{'MailInteractionId':_0x594794['id'],'direction':'in','read':![]},'raw':!![]});})[_0x633c('0x8')](function(_0x2944a1){_0x594794[_0x633c('0xb')](_0x633c('0xc'),_0x2944a1[_0x633c('0xd')]);MailInteractionEvents['emit'](_0xbed90b+':'+_0x594794['id'],_0x594794);MailInteractionEvents[_0x633c('0xe')](_0xbed90b,_0x594794);_0x273daa(null);})[_0x633c('0xf')](_0x273daa(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x633c('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0xb082=['events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','then','Users','map','findAll','setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb082,0x1b5));var _0x2b08=function(_0x2e90ec,_0x34c770){_0x2e90ec=_0x2e90ec-0x0;var _0x15fb83=_0xb082[_0x2e90ec];return _0x15fb83;};'use strict';var EventEmitter=require(_0x2b08('0x0'));var MailInteraction=require(_0x2b08('0x1'))['db'][_0x2b08('0x2')];var MailMessage=require(_0x2b08('0x1'))['db'][_0x2b08('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x2b08('0x4')](0x0);var events={'afterCreate':_0x2b08('0x5'),'afterUpdate':_0x2b08('0x6'),'afterDestroy':_0x2b08('0x7')};function emitEvent(_0x10fe73){return function(_0x3621a2,_0x2e31d1,_0x34864e){_0x3621a2['getUsers']({'attributes':['id'],'raw':!![]})[_0x2b08('0x8')](function(_0xcfbc96){_0x3621a2['setDataValue'](_0x2b08('0x9'),_0xcfbc96[_0x2b08('0xa')](function(_0x39676a){return{'id':_0x39676a['id']};}));return MailMessage[_0x2b08('0xb')]({'where':{'MailInteractionId':_0x3621a2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2b08('0x8')](function(_0x37353e){_0x3621a2[_0x2b08('0xc')](_0x2b08('0xd'),_0x37353e['length']);MailInteractionEvents['emit'](_0x10fe73+':'+_0x3621a2['id'],_0x3621a2);MailInteractionEvents[_0x2b08('0xe')](_0x10fe73,_0x3621a2);_0x34864e(null);})[_0x2b08('0xf')](_0x34864e(null));};}for(var e in events){if(events[_0x2b08('0x10')](e)){var event=events[e];MailInteraction[_0x2b08('0x11')](e,emitEvent(event));}}module[_0x2b08('0x12')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index cd1938f..687470a 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 _0x9e25=['define','MailInteraction','mail_interactions','subject','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','catch','utf8mb4_unicode_ci','lodash','moment','request-promise','rimraf','../../config/environment','exports'];(function(_0x5e3203,_0x4bf3f9){var _0x3f85bd=function(_0x39e07){while(--_0x39e07){_0x5e3203['push'](_0x5e3203['shift']());}};_0x3f85bd(++_0x4bf3f9);}(_0x9e25,0xc9));var _0x59e2=function(_0x2489d1,_0x4c9d45){_0x2489d1=_0x2489d1-0x0;var _0x2ac3b6=_0x9e25[_0x2489d1];return _0x2ac3b6;};'use strict';var _=require(_0x59e2('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x59e2('0x1'));var BPromise=require('bluebird');var rp=require(_0x59e2('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x59e2('0x3'));var config=require(_0x59e2('0x4'));var attributes=require('./mailInteraction.attributes');module[_0x59e2('0x5')]=function(_0x4a70ea,_0x42fbb7){return _0x4a70ea[_0x59e2('0x6')](_0x59e2('0x7'),attributes,{'tableName':_0x59e2('0x8'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x59e2('0x9'),'to'],'type':_0x59e2('0xa')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5d9396,_0x57fa23,_0x4cb8cd){if(_0x5d9396[_0x59e2('0xb')]){_0x5d9396['substatusAt']=moment()[_0x59e2('0xc')](_0x59e2('0xd'));}if(_0x5d9396[_0x59e2('0xe')]){_0x5d9396[_0x59e2('0xf')]=moment()['format'](_0x59e2('0xd'));}_0x4cb8cd(null,_0x57fa23);},'beforeUpdate':function(_0x516400,_0x67e177,_0x17ba8d){if(_0x516400[_0x59e2('0x10')](_0x59e2('0xb'))){_0x516400['substatusAt']=_0x516400['substatus']?moment()['format'](_0x59e2('0xd')):null;}if(_0x516400[_0x59e2('0x10')]('closed')){_0x516400['closedAt']=moment()[_0x59e2('0xc')](_0x59e2('0xd'));_0x516400[_0x59e2('0xb')]=null;_0x516400['substatusAt']=null;}_0x17ba8d(null,_0x516400);},'afterUpdate':function(_0x171e79,_0x36d977,_0x15ce1a){var _0x4a329a=_0x4a70ea[_0x59e2('0x11')];var _0x969591=_0x171e79[_0x59e2('0x12')]({'plain':!![]});if(_0x969591[_0x59e2('0xe')]){return _0x4a329a[_0x59e2('0x13')][_0x59e2('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x969591['id']}})['then'](function(){_0x15ce1a();})[_0x59e2('0x15')](function(_0x4a743f){_0x15ce1a(_0x4a743f);});}else{_0x15ce1a();}}},'charset':'utf8mb4','collate':_0x59e2('0x16')});}; \ No newline at end of file +var _0x387a=['../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatus','models','get','MailMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x558e29,_0x15e088){var _0x2e2f58=function(_0x36cada){while(--_0x36cada){_0x558e29['push'](_0x558e29['shift']());}};_0x2e2f58(++_0x15e088);}(_0x387a,0x1e5));var _0xa387=function(_0x1ac2b2,_0x3bbe8c){_0x1ac2b2=_0x1ac2b2-0x0;var _0x3f633c=_0x387a[_0x1ac2b2];return _0x3f633c;};'use strict';var _=require(_0xa387('0x0'));var util=require(_0xa387('0x1'));var logger=require(_0xa387('0x2'))('api');var moment=require(_0xa387('0x3'));var BPromise=require(_0xa387('0x4'));var rp=require(_0xa387('0x5'));var fs=require('fs');var path=require(_0xa387('0x6'));var rimraf=require(_0xa387('0x7'));var config=require(_0xa387('0x8'));var attributes=require(_0xa387('0x9'));module[_0xa387('0xa')]=function(_0x2d729f,_0xa156c5){return _0x2d729f[_0xa387('0xb')](_0xa387('0xc'),attributes,{'tableName':_0xa387('0xd'),'paranoid':![],'indexes':[{'name':_0xa387('0xe'),'fields':[_0xa387('0xf'),'to'],'type':_0xa387('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1f3203,_0x2326c6,_0x4ab338){if(_0x1f3203['substatus']){_0x1f3203[_0xa387('0x11')]=moment()[_0xa387('0x12')](_0xa387('0x13'));}if(_0x1f3203[_0xa387('0x14')]){_0x1f3203[_0xa387('0x15')]=moment()[_0xa387('0x12')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4ab338(null,_0x2326c6);},'beforeUpdate':function(_0x1cc72b,_0xfe9b45,_0x6b62f){if(_0x1cc72b[_0xa387('0x16')](_0xa387('0x17'))){_0x1cc72b[_0xa387('0x11')]=_0x1cc72b[_0xa387('0x17')]?moment()[_0xa387('0x12')](_0xa387('0x13')):null;}if(_0x1cc72b[_0xa387('0x16')](_0xa387('0x14'))){_0x1cc72b[_0xa387('0x15')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1cc72b['substatus']=null;_0x1cc72b['substatusAt']=null;}_0x6b62f(null,_0x1cc72b);},'afterUpdate':function(_0xc697bb,_0xf06bdf,_0x17a84a){var _0x455d8a=_0x2d729f[_0xa387('0x18')];var _0x57c699=_0xc697bb[_0xa387('0x19')]({'plain':!![]});if(_0x57c699['closed']){return _0x455d8a[_0xa387('0x1a')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x57c699['id']}})['then'](function(){_0x17a84a();})['catch'](function(_0x3be4d5){_0x17a84a(_0x3be4d5);});}else{_0x17a84a();}}},'charset':_0xa387('0x1b'),'collate':_0xa387('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 7776698..ec5603b 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 _0x1939=['debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','then','info','MailInteraction,\x20%s,\x20%s'];(function(_0xe29fae,_0x43d3f5){var _0xc1c438=function(_0x452237){while(--_0x452237){_0xe29fae['push'](_0xe29fae['shift']());}};_0xc1c438(++_0x43d3f5);}(_0x1939,0x1d1));var _0x9193=function(_0x587783,_0x6296e6){_0x587783=_0x587783-0x0;var _0x1cca44=_0x1939[_0x587783];return _0x1cca44;};'use strict';var _=require(_0x9193('0x0'));var util=require('util');var moment=require(_0x9193('0x1'));var BPromise=require(_0x9193('0x2'));var rs=require(_0x9193('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9193('0x4'))['db'];var utils=require(_0x9193('0x5'));var logger=require(_0x9193('0x6'))(_0x9193('0x7'));var config=require('../../config/environment');var jayson=require(_0x9193('0x8'));var client=jayson[_0x9193('0x9')]['http']({'port':0x232a});config[_0x9193('0xa')]=_[_0x9193('0xb')](config[_0x9193('0xa')],{'host':_0x9193('0xc'),'port':0x18eb});var socket=require(_0x9193('0xd'))(new Redis(config['redis']));require(_0x9193('0xe'))[_0x9193('0xf')](socket);function respondWithRpcPromise(_0x185b7a,_0xe6593e,_0x44d9f7){return new BPromise(function(_0x533e5f,_0x5934d9){return client['request'](_0x185b7a,_0x44d9f7)[_0x9193('0x10')](function(_0x4aa6c7){logger[_0x9193('0x11')](_0x9193('0x12'),_0xe6593e,'request\x20sent');logger[_0x9193('0x13')](_0x9193('0x14'),_0xe6593e,_0x9193('0x15'),JSON[_0x9193('0x16')](_0x4aa6c7));if(_0x4aa6c7[_0x9193('0x17')]){if(_0x4aa6c7[_0x9193('0x17')][_0x9193('0x18')]===0x1f4){logger[_0x9193('0x17')](_0x9193('0x12'),_0xe6593e,_0x4aa6c7['error'][_0x9193('0x19')]);return _0x5934d9(_0x4aa6c7[_0x9193('0x17')][_0x9193('0x19')]);}logger[_0x9193('0x17')](_0x9193('0x12'),_0xe6593e,_0x4aa6c7['error'][_0x9193('0x19')]);return _0x533e5f(_0x4aa6c7[_0x9193('0x17')][_0x9193('0x19')]);}else{logger[_0x9193('0x11')](_0x9193('0x12'),_0xe6593e,_0x9193('0x15'));_0x533e5f(_0x4aa6c7[_0x9193('0x1a')]['message']);}})[_0x9193('0x1b')](function(_0x430c6c){logger[_0x9193('0x17')]('MailInteraction,\x20%s,\x20%s',_0xe6593e,_0x430c6c);_0x5934d9(_0x430c6c);});});}exports[_0x9193('0x1c')]=function(_0x22a444){var _0x3216c9=this;return new Promise(function(_0x490b30,_0x465cd2){return db[_0x9193('0x1d')][_0x9193('0x1e')](_0x22a444[_0x9193('0x1f')],{'raw':_0x22a444[_0x9193('0x20')]?_0x22a444['options'][_0x9193('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22a444[_0x9193('0x20')]?_0x22a444[_0x9193('0x20')][_0x9193('0x22')]||null:null,'attributes':_0x22a444[_0x9193('0x20')]?_0x22a444['options'][_0x9193('0x23')]||null:null,'limit':_0x22a444[_0x9193('0x20')]?_0x22a444[_0x9193('0x20')][_0x9193('0x24')]||null:null})[_0x9193('0x10')](function(_0x4c1406){logger[_0x9193('0x11')](_0x9193('0x1c'),_0x22a444);logger[_0x9193('0x13')](_0x9193('0x1c'),_0x22a444,JSON['stringify'](_0x4c1406));_0x490b30(_0x4c1406);})['catch'](function(_0x1d9dfc){logger[_0x9193('0x17')](_0x9193('0x1c'),_0x1d9dfc[_0x9193('0x19')],_0x22a444);_0x465cd2(_0x3216c9[_0x9193('0x17')](0x1f4,_0x1d9dfc['message']));});});};exports[_0x9193('0x25')]=function(_0x368951){return new Promise(function(_0x404e9c,_0x51de3e){return db[_0x9193('0x1d')][_0x9193('0x26')]({'where':_0x368951[_0x9193('0x20')]?_0x368951[_0x9193('0x20')][_0x9193('0x22')]||null:null})['then'](function(_0x16dde0){if(_0x16dde0){return _0x16dde0[_0x9193('0x27')](_0x368951['body'][_0x9193('0x28')],_[_0x9193('0x29')](_0x368951[_0x9193('0x1f')],[_0x9193('0x28'),'id'])||{});}})[_0x9193('0x2a')](function(_0x2edf15){logger['info'](_0x9193('0x2b'),_0x368951);logger[_0x9193('0x13')](_0x9193('0x2b'),_0x368951,JSON[_0x9193('0x16')](_0x2edf15));_0x404e9c(_0x2edf15);})[_0x9193('0x1b')](function(_0x246d81){logger['error'](_0x9193('0x2b'),_0x246d81[_0x9193('0x19')],_0x368951);_0x51de3e(_this[_0x9193('0x17')](0x1f4,_0x246d81['message']));});});}; \ No newline at end of file +var _0x0984=['ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','AddTagsToMailInteraction','find','addTags'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x0984,0xff));var _0x4098=function(_0x14d1d5,_0x1a2445){_0x14d1d5=_0x14d1d5-0x0;var _0x1a7717=_0x0984[_0x14d1d5];return _0x1a7717;};'use strict';var _=require(_0x4098('0x0'));var util=require(_0x4098('0x1'));var moment=require(_0x4098('0x2'));var BPromise=require('bluebird');var rs=require(_0x4098('0x3'));var fs=require('fs');var Redis=require(_0x4098('0x4'));var db=require(_0x4098('0x5'))['db'];var utils=require(_0x4098('0x6'));var logger=require('../../config/logger')(_0x4098('0x7'));var config=require(_0x4098('0x8'));var jayson=require(_0x4098('0x9'));var client=jayson[_0x4098('0xa')]['http']({'port':0x232a});config[_0x4098('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4098('0xc'))(new Redis(config[_0x4098('0xb')]));require(_0x4098('0xd'))['register'](socket);function respondWithRpcPromise(_0x4ea6e4,_0x5ca76c,_0x253572){return new BPromise(function(_0x25a9e6,_0x518f39){return client[_0x4098('0xe')](_0x4ea6e4,_0x253572)[_0x4098('0xf')](function(_0xbc6a7f){logger[_0x4098('0x10')](_0x4098('0x11'),_0x5ca76c,_0x4098('0x12'));logger[_0x4098('0x13')](_0x4098('0x14'),_0x5ca76c,_0x4098('0x12'),JSON[_0x4098('0x15')](_0xbc6a7f));if(_0xbc6a7f[_0x4098('0x16')]){if(_0xbc6a7f[_0x4098('0x16')][_0x4098('0x17')]===0x1f4){logger[_0x4098('0x16')](_0x4098('0x11'),_0x5ca76c,_0xbc6a7f[_0x4098('0x16')]['message']);return _0x518f39(_0xbc6a7f[_0x4098('0x16')][_0x4098('0x18')]);}logger[_0x4098('0x16')](_0x4098('0x11'),_0x5ca76c,_0xbc6a7f[_0x4098('0x16')]['message']);return _0x25a9e6(_0xbc6a7f[_0x4098('0x16')]['message']);}else{logger['info'](_0x4098('0x11'),_0x5ca76c,_0x4098('0x12'));_0x25a9e6(_0xbc6a7f[_0x4098('0x19')]['message']);}})[_0x4098('0x1a')](function(_0x24cd44){logger[_0x4098('0x16')]('MailInteraction,\x20%s,\x20%s',_0x5ca76c,_0x24cd44);_0x518f39(_0x24cd44);});});}exports[_0x4098('0x1b')]=function(_0x58b45c){var _0x29eecc=this;return new Promise(function(_0xc6466d,_0x5b936d){return db[_0x4098('0x1c')][_0x4098('0x1d')](_0x58b45c[_0x4098('0x1e')],{'raw':_0x58b45c[_0x4098('0x1f')]?_0x58b45c[_0x4098('0x1f')][_0x4098('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58b45c[_0x4098('0x1f')]?_0x58b45c[_0x4098('0x1f')][_0x4098('0x21')]||null:null,'attributes':_0x58b45c[_0x4098('0x1f')]?_0x58b45c['options'][_0x4098('0x22')]||null:null,'limit':_0x58b45c['options']?_0x58b45c['options'][_0x4098('0x23')]||null:null})[_0x4098('0xf')](function(_0x5d5bd2){logger[_0x4098('0x10')](_0x4098('0x1b'),_0x58b45c);logger['debug'](_0x4098('0x1b'),_0x58b45c,JSON[_0x4098('0x15')](_0x5d5bd2));_0xc6466d(_0x5d5bd2);})[_0x4098('0x1a')](function(_0x5e14f3){logger[_0x4098('0x16')](_0x4098('0x1b'),_0x5e14f3['message'],_0x58b45c);_0x5b936d(_0x29eecc[_0x4098('0x16')](0x1f4,_0x5e14f3[_0x4098('0x18')]));});});};exports[_0x4098('0x24')]=function(_0x32d469){return new Promise(function(_0x56074c,_0x1ec1d7){return db[_0x4098('0x1c')][_0x4098('0x25')]({'where':_0x32d469[_0x4098('0x1f')]?_0x32d469[_0x4098('0x1f')][_0x4098('0x21')]||null:null})[_0x4098('0xf')](function(_0x3cb846){if(_0x3cb846){return _0x3cb846[_0x4098('0x26')](_0x32d469[_0x4098('0x1e')][_0x4098('0x27')],_['omit'](_0x32d469['body'],[_0x4098('0x27'),'id'])||{});}})[_0x4098('0x28')](function(_0xc42ccd){logger[_0x4098('0x10')](_0x4098('0x29'),_0x32d469);logger[_0x4098('0x13')]('AddTags',_0x32d469,JSON[_0x4098('0x15')](_0xc42ccd));_0x56074c(_0xc42ccd);})[_0x4098('0x1a')](function(_0x347733){logger[_0x4098('0x16')](_0x4098('0x29'),_0x347733[_0x4098('0x18')],_0x32d469);_0x1ec1d7(_this[_0x4098('0x16')](0x1f4,_0x347733['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index c5daf9f..da974a7 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 _0x47f0=['./mailInteraction.events','save','remove','update','removeListener','register','length','mailInteraction:'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x47f0,0x78));var _0x047f=function(_0x2a8b3b,_0x5efd92){_0x2a8b3b=_0x2a8b3b-0x0;var _0x546b6c=_0x47f0[_0x2a8b3b];return _0x546b6c;};'use strict';var MailInteractionEvents=require(_0x047f('0x0'));var events=[_0x047f('0x1'),_0x047f('0x2'),_0x047f('0x3')];function createListener(_0xaff140,_0x50c8b8){return function(_0x1eac2e){_0x50c8b8['emit'](_0xaff140,_0x1eac2e);};}function removeListener(_0x2de3d3,_0x1eb67c){return function(){MailInteractionEvents[_0x047f('0x4')](_0x2de3d3,_0x1eb67c);};}exports[_0x047f('0x5')]=function(_0x17d1b5){for(var _0x52cf63=0x0,_0x11025d=events[_0x047f('0x6')];_0x52cf63<_0x11025d;_0x52cf63++){var _0x1f6d9a=events[_0x52cf63];var _0x2f636a=createListener(_0x047f('0x7')+_0x1f6d9a,_0x17d1b5);MailInteractionEvents['on'](_0x1f6d9a,_0x2f636a);}}; \ No newline at end of file +var _0x4e7b=['mailInteraction:','./mailInteraction.events','save','update','register'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x4e7b,0xa1));var _0xb4e7=function(_0x7db4c4,_0x1a6c7f){_0x7db4c4=_0x7db4c4-0x0;var _0x79c64=_0x4e7b[_0x7db4c4];return _0x79c64;};'use strict';var MailInteractionEvents=require(_0xb4e7('0x0'));var events=[_0xb4e7('0x1'),'remove',_0xb4e7('0x2')];function createListener(_0x3b89f9,_0x1283cb){return function(_0x4a4abc){_0x1283cb['emit'](_0x3b89f9,_0x4a4abc);};}function removeListener(_0x2011a1,_0xa3808c){return function(){MailInteractionEvents['removeListener'](_0x2011a1,_0xa3808c);};}exports[_0xb4e7('0x3')]=function(_0x4c3cc1){for(var _0x373c96=0x0,_0x227351=events['length'];_0x373c96<_0x227351;_0x373c96++){var _0x5e7c4b=events[_0x373c96];var _0x4745f8=createListener(_0xb4e7('0x4')+_0x5e7c4b,_0x4c3cc1);MailInteractionEvents['on'](_0x5e7c4b,_0x4745f8);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 960e615..126a2f8 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 _0x4d4b=['delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','download','post','mail','mailmessage:create','create','update','put','/:id/reject','reject'];(function(_0x4d3e1f,_0x5e5823){var _0xed198a=function(_0xdc4d6d){while(--_0xdc4d6d){_0x4d3e1f['push'](_0x4d3e1f['shift']());}};_0xed198a(++_0x5e5823);}(_0x4d4b,0xf5));var _0xb4d4=function(_0x13bc89,_0x12f103){_0x13bc89=_0x13bc89-0x0;var _0x587243=_0x4d4b[_0x13bc89];return _0x587243;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb4d4('0x0'));var timeout=require(_0xb4d4('0x1'));var express=require(_0xb4d4('0x2'));var router=express[_0xb4d4('0x3')]();var fs_extra=require(_0xb4d4('0x4'));var auth=require(_0xb4d4('0x5'));var interaction=require(_0xb4d4('0x6'));var config=require(_0xb4d4('0x7'));var controller=require(_0xb4d4('0x8'));router[_0xb4d4('0x9')]('/',auth[_0xb4d4('0xa')](),controller[_0xb4d4('0xb')]);router[_0xb4d4('0x9')](_0xb4d4('0xc'),auth[_0xb4d4('0xa')](),controller[_0xb4d4('0xd')]);router['get'](_0xb4d4('0xe'),auth[_0xb4d4('0xa')](),controller[_0xb4d4('0xf')]);router['get']('/:id/download',auth[_0xb4d4('0xa')](),controller[_0xb4d4('0x10')]);router[_0xb4d4('0x11')]('/',auth[_0xb4d4('0xa')](),interaction['tracked'](_0xb4d4('0x12'),_0xb4d4('0x13')),controller[_0xb4d4('0x14')]);router['put'](_0xb4d4('0xe'),auth[_0xb4d4('0xa')](),controller[_0xb4d4('0x15')]);router['put']('/:id/accept',auth[_0xb4d4('0xa')](),controller['accept']);router[_0xb4d4('0x16')](_0xb4d4('0x17'),auth[_0xb4d4('0xa')](),controller[_0xb4d4('0x18')]);router[_0xb4d4('0x19')](_0xb4d4('0xe'),auth[_0xb4d4('0xa')](),controller[_0xb4d4('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x2d4d=['./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2b1a3c,_0x6aa9b3){var _0x32f9fc=function(_0x4ab620){while(--_0x4ab620){_0x2b1a3c['push'](_0x2b1a3c['shift']());}};_0x32f9fc(++_0x6aa9b3);}(_0x2d4d,0x94));var _0xd2d4=function(_0x5a6380,_0x338657){_0x5a6380=_0x5a6380-0x0;var _0x1f1d9c=_0x2d4d[_0x5a6380];return _0x1f1d9c;};'use strict';var multer=require(_0xd2d4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd2d4('0x1'));var router=express[_0xd2d4('0x2')]();var fs_extra=require(_0xd2d4('0x3'));var auth=require(_0xd2d4('0x4'));var interaction=require(_0xd2d4('0x5'));var config=require(_0xd2d4('0x6'));var controller=require(_0xd2d4('0x7'));router[_0xd2d4('0x8')]('/',auth[_0xd2d4('0x9')](),controller[_0xd2d4('0xa')]);router['get'](_0xd2d4('0xb'),auth['isAuthenticated'](),controller[_0xd2d4('0xc')]);router[_0xd2d4('0x8')](_0xd2d4('0xd'),auth[_0xd2d4('0x9')](),controller[_0xd2d4('0xe')]);router[_0xd2d4('0x8')](_0xd2d4('0xf'),auth[_0xd2d4('0x9')](),controller[_0xd2d4('0x10')]);router[_0xd2d4('0x11')]('/',auth[_0xd2d4('0x9')](),interaction[_0xd2d4('0x12')](_0xd2d4('0x13'),_0xd2d4('0x14')),controller[_0xd2d4('0x15')]);router[_0xd2d4('0x16')](_0xd2d4('0xd'),auth[_0xd2d4('0x9')](),controller[_0xd2d4('0x17')]);router[_0xd2d4('0x16')](_0xd2d4('0x18'),auth[_0xd2d4('0x9')](),controller[_0xd2d4('0x19')]);router[_0xd2d4('0x16')](_0xd2d4('0x1a'),auth[_0xd2d4('0x9')](),controller[_0xd2d4('0x1b')]);router[_0xd2d4('0x1c')](_0xd2d4('0xd'),auth['isAuthenticated'](),controller[_0xd2d4('0x1d')]);module[_0xd2d4('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 1c780b9..12e16b6 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 _0x1842=['exports','TEXT','long','BOOLEAN','out','STRING','INTEGER','DATE','ENUM','Email','Chat','sequelize','lodash'];(function(_0x35e31e,_0x2a70a7){var _0x281b37=function(_0x194b8f){while(--_0x194b8f){_0x35e31e['push'](_0x35e31e['shift']());}};_0x281b37(++_0x2a70a7);}(_0x1842,0x80));var _0x2184=function(_0x5bd667,_0x1aa1c8){_0x5bd667=_0x5bd667-0x0;var _0x47ba52=_0x1842[_0x5bd667];return _0x47ba52;};'use strict';var Sequelize=require(_0x2184('0x0'));var _=require(_0x2184('0x1'));module[_0x2184('0x2')]={'body':{'type':Sequelize[_0x2184('0x3')](_0x2184('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x2184('0x3')]('medium')},'read':{'type':Sequelize[_0x2184('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x2184('0x6')),'defaultValue':_0x2184('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x2184('0x7')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x2184('0x3')](_0x2184('0x4'))},'cc':{'type':Sequelize['TEXT'](_0x2184('0x4'))},'bcc':{'type':Sequelize['TEXT'](_0x2184('0x4'))},'subject':{'type':Sequelize[_0x2184('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x2184('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x2184('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x2184('0x9')]},'originTo':{'type':Sequelize['TEXT'](_0x2184('0x4'))},'originCc':{'type':Sequelize[_0x2184('0x3')](_0x2184('0x4'))},'originChannel':{'type':Sequelize[_0x2184('0xa')](_0x2184('0xb'),_0x2184('0xc')),'defaultValue':_0x2184('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x1fda=['BOOLEAN','out','STRING','TEXT','ENUM','Email','sequelize','lodash','long','medium'];(function(_0x50c58d,_0x540470){var _0x9e6486=function(_0x4ea996){while(--_0x4ea996){_0x50c58d['push'](_0x50c58d['shift']());}};_0x9e6486(++_0x540470);}(_0x1fda,0x74));var _0xa1fd=function(_0x49c93b,_0x1a56b5){_0x49c93b=_0x49c93b-0x0;var _0x1cc6f0=_0x1fda[_0x49c93b];return _0x1cc6f0;};'use strict';var Sequelize=require(_0xa1fd('0x0'));var _=require(_0xa1fd('0x1'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xa1fd('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xa1fd('0x3'))},'read':{'type':Sequelize[_0xa1fd('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa1fd('0x5')),'defaultValue':_0xa1fd('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa1fd('0x6')](0x1fe)},'from':{'type':Sequelize[_0xa1fd('0x6')]},'to':{'type':Sequelize['TEXT'](_0xa1fd('0x2'))},'cc':{'type':Sequelize['TEXT'](_0xa1fd('0x2'))},'bcc':{'type':Sequelize[_0xa1fd('0x7')](_0xa1fd('0x2'))},'subject':{'type':Sequelize[_0xa1fd('0x7')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xa1fd('0x7')](_0xa1fd('0x2'))},'originCc':{'type':Sequelize['TEXT'](_0xa1fd('0x2'))},'originChannel':{'type':Sequelize[_0xa1fd('0x8')](_0xa1fd('0x9'),'Chat'),'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 dac6334..235b37f 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 _0x67a7=['[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','contact','rejectmessage','unix','toString','files','tmp','root','server','message-%s.eml','from','bcc','Attachments','decode','createdAt','Bcc','existsSync','push','build','writeFileSync','unlinkSync','util','path','lodash','ioredis','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','localhost','html-entities','./mailMessage.socket','client','http','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','MailMessage','includeAll','include','findAll','catch','show','params','find','body','describe','create','direction','out','secret','MailAccount','findOne','MailAccountId','CmList','List','CmContact','DESC','MailServerOut','Smtp','service','host','port','secure','authentication','pass','auth','user','attachments','length','join','server/files/attachments','basename','Contacts','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','read','readAt','UserId','get','isNil','read1stAt','interaction','[MAILMESSAGE: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','SELECT','User','agent','email','internal','manual','interface','SIP/%s','channel','event','fromString','EventManager','acceptmessage','reject','mail','MailInteraction','MailInteractionId'];(function(_0x4374af,_0x491c9e){var _0x27ae4e=function(_0x4b695e){while(--_0x4b695e){_0x4374af['push'](_0x4374af['shift']());}};_0x27ae4e(++_0x491c9e);}(_0x67a7,0x159));var _0x767a=function(_0x40faf2,_0x5881c9){_0x40faf2=_0x40faf2-0x0;var _0xb3c793=_0x67a7[_0x40faf2];return _0xb3c793;};'use strict';var emlformat=require('eml-format');var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x767a('0x0'));var path=require(_0x767a('0x1'));var fs=require('fs');var _=require(_0x767a('0x2'));var Redis=require(_0x767a('0x3'));var htmlToText=require('html-to-text');var qs=require('../../components/parsers/qs');var logger=require(_0x767a('0x4'))(_0x767a('0x5'));var interaction_log=require('../../config/logger')(_0x767a('0x6'));var config=require(_0x767a('0x7'));var db=require(_0x767a('0x8'))['db'];config[_0x767a('0x9')]=_['defaults'](config[_0x767a('0x9')],{'host':_0x767a('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x767a('0x9')]));var htmlEntities=require(_0x767a('0xb'));require(_0x767a('0xc'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9003=jayson[_0x767a('0xd')][_0x767a('0xe')]({'port':0x232b});var client9002=jayson['client'][_0x767a('0xe')]({'port':0x232a});function respondWithRpcPromise(_0x19aefc,_0x298637,_0x17a775,_0x10a0fd){return new BPromise(function(_0x34270f,_0x12bcbb){var _0x435444=_0x10a0fd||client;return _0x435444['request'](_0x19aefc,_0x17a775)[_0x767a('0xf')](function(_0x532dbc){logger['info'](_0x767a('0x10'),_0x298637,_0x767a('0x11'));logger[_0x767a('0x12')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x298637,_0x767a('0x11'),JSON['stringify'](_0x532dbc));if(_0x532dbc['error']){if(_0x532dbc[_0x767a('0x13')]['code']===0x1f4){logger[_0x767a('0x13')]('MailMessage,\x20%s,\x20%s',_0x298637,_0x532dbc[_0x767a('0x13')][_0x767a('0x14')]);return _0x12bcbb(_0x532dbc[_0x767a('0x13')][_0x767a('0x14')]);}logger[_0x767a('0x13')](_0x767a('0x10'),_0x298637,_0x532dbc[_0x767a('0x13')][_0x767a('0x14')]);return _0x34270f(_0x532dbc[_0x767a('0x13')][_0x767a('0x14')]);}else{logger[_0x767a('0x15')]('MailMessage,\x20%s,\x20%s',_0x298637,_0x767a('0x11'));_0x34270f(_0x532dbc[_0x767a('0x16')][_0x767a('0x14')]);}})['catch'](function(_0x191828){logger[_0x767a('0x13')]('MailMessage,\x20%s,\x20%s',_0x298637,_0x191828);_0x12bcbb(_0x191828);});});}function respondWithResult(_0x1c4df6,_0x8063d6){_0x8063d6=_0x8063d6||0xc8;return function(_0x2793e3){if(_0x2793e3){return _0x1c4df6[_0x767a('0x17')](_0x8063d6)[_0x767a('0x18')](_0x2793e3);}};}function respondWithFilteredResult(_0x12c9eb,_0x3a3ed7){return function(_0x307a8){if(_0x307a8){var _0x3f109a=typeof _0x3a3ed7[_0x767a('0x19')]==='undefined'&&typeof _0x3a3ed7[_0x767a('0x1a')]===_0x767a('0x1b');var _0x2dac32=_0x307a8[_0x767a('0x1c')];var _0x209e44=_0x3f109a?0x0:_0x3a3ed7[_0x767a('0x19')];var _0x3c6979=_0x3f109a?_0x307a8[_0x767a('0x1c')]:_0x3a3ed7[_0x767a('0x19')]+_0x3a3ed7['limit'];var _0x43dba2;if(_0x3c6979>=_0x2dac32){_0x3c6979=_0x2dac32;_0x43dba2=0xc8;}else{_0x43dba2=0xce;}_0x12c9eb['status'](_0x43dba2);return _0x12c9eb[_0x767a('0x1d')](_0x767a('0x1e'),_0x209e44+'-'+_0x3c6979+'/'+_0x2dac32)[_0x767a('0x18')](_0x307a8);}return null;};}function saveUpdates(_0x59a2c2){return function(_0x59a86d){if(_0x59a86d){return _0x59a86d[_0x767a('0x1f')](_0x59a2c2)[_0x767a('0xf')](function(_0x1a3bf9){return _0x1a3bf9;});}return null;};}function removeEntity(_0x438f12){return function(_0x344fef){if(_0x344fef){return _0x344fef[_0x767a('0x20')]()[_0x767a('0xf')](function(){_0x438f12[_0x767a('0x17')](0xcc)[_0x767a('0x21')]();});}};}function handleEntityNotFound(_0x5a268d){return function(_0x3f0865){if(!_0x3f0865){_0x5a268d[_0x767a('0x22')](0x194);}return _0x3f0865;};}function handleError(_0x4dcd12,_0x517590){_0x517590=_0x517590||0x1f4;return function(_0x2db40b){logger[_0x767a('0x13')](_0x2db40b[_0x767a('0x23')]);if(_0x2db40b['name']){delete _0x2db40b[_0x767a('0x24')];}_0x4dcd12[_0x767a('0x17')](_0x517590)[_0x767a('0x25')](_0x2db40b);};}exports[_0x767a('0x26')]=function(_0x725100,_0x4312d9){var _0x1bab0b={},_0x4939fc={},_0x223ebf={'count':0x0,'rows':[]};var _0x2a02e0=_['map'](db['MailMessage'][_0x767a('0x27')],function(_0x6f5a66){return{'name':_0x6f5a66[_0x767a('0x28')],'type':_0x6f5a66[_0x767a('0x29')][_0x767a('0x2a')]};});_0x4939fc[_0x767a('0x2b')]=_[_0x767a('0x2c')](_0x2a02e0,'name');_0x4939fc[_0x767a('0x2d')]=_[_0x767a('0x2e')](_0x725100[_0x767a('0x2d')]);_0x4939fc[_0x767a('0x2f')]=_[_0x767a('0x30')](_0x4939fc[_0x767a('0x2b')],_0x4939fc[_0x767a('0x2d')]);_0x1bab0b[_0x767a('0x31')]=_[_0x767a('0x30')](_0x4939fc[_0x767a('0x2b')],qs[_0x767a('0x32')](_0x725100[_0x767a('0x2d')]['fields']));_0x1bab0b['attributes']=_0x1bab0b['attributes']['length']?_0x1bab0b[_0x767a('0x31')]:_0x4939fc[_0x767a('0x2b')];if(!_0x725100[_0x767a('0x2d')]['hasOwnProperty'](_0x767a('0x33'))){_0x1bab0b[_0x767a('0x1a')]=qs[_0x767a('0x1a')](_0x725100['query'][_0x767a('0x1a')]);_0x1bab0b['offset']=qs[_0x767a('0x19')](_0x725100['query'][_0x767a('0x19')]);}_0x1bab0b[_0x767a('0x34')]=qs['sort'](_0x725100['query'][_0x767a('0x35')]);_0x1bab0b['where']=qs[_0x767a('0x2f')](_[_0x767a('0x36')](_0x725100[_0x767a('0x2d')],_0x4939fc[_0x767a('0x2f')]),_0x2a02e0);if(_0x725100[_0x767a('0x2d')]['filter']){_0x1bab0b['where']=_[_0x767a('0x37')](_0x1bab0b[_0x767a('0x38')],{'$or':_['map'](_0x2a02e0,function(_0x3a0cee){if(_0x3a0cee[_0x767a('0x29')]!==_0x767a('0x39')){var _0xa94464={};_0xa94464[_0x3a0cee[_0x767a('0x24')]]={'$like':'%'+_0x725100['query'][_0x767a('0x3a')]+'%'};return _0xa94464;}})});}_0x1bab0b=_['merge']({},_0x1bab0b,_0x725100[_0x767a('0x3b')]);var _0x455679={'where':_0x1bab0b[_0x767a('0x38')]};return db[_0x767a('0x3c')]['count'](_0x455679)[_0x767a('0xf')](function(_0xa60a0e){_0x223ebf[_0x767a('0x1c')]=_0xa60a0e;if(_0x725100[_0x767a('0x2d')][_0x767a('0x3d')]){_0x1bab0b[_0x767a('0x3e')]=[{'all':!![]}];}return db[_0x767a('0x3c')][_0x767a('0x3f')](_0x1bab0b);})['then'](function(_0x5bc61a){_0x223ebf['rows']=_0x5bc61a;return _0x223ebf;})['then'](respondWithFilteredResult(_0x4312d9,_0x1bab0b))[_0x767a('0x40')](handleError(_0x4312d9,null));};exports[_0x767a('0x41')]=function(_0x245fd0,_0x3c5d14){var _0x42516f={'raw':!![],'where':{'id':_0x245fd0[_0x767a('0x42')]['id']}},_0x53a2e4={};_0x53a2e4[_0x767a('0x2b')]=_[_0x767a('0x2e')](db[_0x767a('0x3c')][_0x767a('0x27')]);_0x53a2e4[_0x767a('0x2d')]=_['keys'](_0x245fd0[_0x767a('0x2d')]);_0x53a2e4[_0x767a('0x2f')]=_['intersection'](_0x53a2e4[_0x767a('0x2b')],_0x53a2e4[_0x767a('0x2d')]);_0x42516f[_0x767a('0x31')]=_[_0x767a('0x30')](_0x53a2e4[_0x767a('0x2b')],qs[_0x767a('0x32')](_0x245fd0[_0x767a('0x2d')][_0x767a('0x32')]));_0x42516f['attributes']=_0x42516f[_0x767a('0x31')]['length']?_0x42516f['attributes']:_0x53a2e4[_0x767a('0x2b')];if(_0x245fd0[_0x767a('0x2d')][_0x767a('0x3d')]){_0x42516f['include']=[{'all':!![]}];}_0x42516f=_['merge']({},_0x42516f,_0x245fd0[_0x767a('0x3b')]);return db[_0x767a('0x3c')][_0x767a('0x43')](_0x42516f)[_0x767a('0xf')](handleEntityNotFound(_0x3c5d14,null))['then'](respondWithResult(_0x3c5d14,null))[_0x767a('0x40')](handleError(_0x3c5d14,null));};exports['update']=function(_0xcfd2ac,_0x88dc04){if(_0xcfd2ac['body']['id']){delete _0xcfd2ac[_0x767a('0x44')]['id'];}return db[_0x767a('0x3c')][_0x767a('0x43')]({'where':{'id':_0xcfd2ac[_0x767a('0x42')]['id']}})[_0x767a('0xf')](handleEntityNotFound(_0x88dc04,null))['then'](saveUpdates(_0xcfd2ac[_0x767a('0x44')],null))[_0x767a('0xf')](respondWithResult(_0x88dc04,null))[_0x767a('0x40')](handleError(_0x88dc04,null));};exports[_0x767a('0x20')]=function(_0x928fc7,_0x210796){return db['MailMessage'][_0x767a('0x43')]({'where':{'id':_0x928fc7[_0x767a('0x42')]['id']}})['then'](handleEntityNotFound(_0x210796,null))[_0x767a('0xf')](removeEntity(_0x210796,null))[_0x767a('0x40')](handleError(_0x210796,null));};exports['describe']=function(_0x37e61e,_0x31c304){return db[_0x767a('0x3c')][_0x767a('0x45')]()[_0x767a('0xf')](respondWithResult(_0x31c304,null))[_0x767a('0x40')](handleError(_0x31c304,null));};exports[_0x767a('0x46')]=function(_0xc28f6a,_0x2eadec){return db[_0x767a('0x3c')][_0x767a('0x46')](_0xc28f6a[_0x767a('0x44')])[_0x767a('0xf')](function(_0x3e23e1){if(_0x3e23e1){if(_0x3e23e1[_0x767a('0x47')]===_0x767a('0x48')&&!_0x3e23e1[_0x767a('0x49')]){var _0x22bdba,_0x8ed5c,_0x2665a3;if(_0xc28f6a['body']['to']){_0x8ed5c=_0xc28f6a[_0x767a('0x44')]['to']['split'](',')[0x0];}return db[_0x767a('0x4a')][_0x767a('0x4b')]({'where':{'id':_0x3e23e1[_0x767a('0x4c')]},'include':[{'model':db[_0x767a('0x4d')],'as':_0x767a('0x4e'),'include':[{'model':db[_0x767a('0x4f')],'as':'Contacts','where':{'email':_0x8ed5c},'limit':0x1,'order':[['updatedAt',_0x767a('0x50')]]}]},{'model':db[_0x767a('0x51')],'as':'Smtp','raw':!![]}]})[_0x767a('0xf')](function(_0x4cca51){_0x22bdba=_0x4cca51;if(_0x22bdba&&_0x22bdba[_0x767a('0x52')]){var _0x22481b={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x22bdba[_0x767a('0x52')][_0x767a('0x53')])){_0x22481b[_0x767a('0x54')]=_0x22bdba[_0x767a('0x52')]['host'];_0x22481b['port']=_0x22bdba[_0x767a('0x52')][_0x767a('0x55')];_0x22481b[_0x767a('0x56')]=_0x22bdba['Smtp'][_0x767a('0x56')];if(_0x22bdba['Smtp'][_0x767a('0x57')]){_0x22481b['auth']={'user':_0x22bdba[_0x767a('0x52')]['user'],'pass':_0x22bdba[_0x767a('0x52')][_0x767a('0x58')]};}}else{_0x22481b[_0x767a('0x53')]=_0x22bdba[_0x767a('0x52')]['service'];_0x22481b[_0x767a('0x59')]={'user':_0x22bdba[_0x767a('0x52')][_0x767a('0x5a')],'pass':_0x22bdba['Smtp'][_0x767a('0x58')]};_0x22481b['secure']=_0x22bdba['Smtp'][_0x767a('0x56')];}if(_0xc28f6a[_0x767a('0x44')][_0x767a('0x5b')]&&_0xc28f6a[_0x767a('0x44')]['attachments'][_0x767a('0x5c')]){for(var _0x118c8c=0x0;_0x118c8c<_0xc28f6a['body'][_0x767a('0x5b')][_0x767a('0x5c')];_0x118c8c+=0x1){_0xc28f6a[_0x767a('0x44')][_0x767a('0x5b')][_0x118c8c]={'filename':_0xc28f6a[_0x767a('0x44')][_0x767a('0x5b')][_0x118c8c][_0x767a('0x24')],'path':path[_0x767a('0x5d')](config['root'],_0x767a('0x5e'),_0xc28f6a[_0x767a('0x44')][_0x767a('0x5b')][_0x118c8c][_0x767a('0x5f')])};}}_0x2665a3={'account':_0x22481b,'message':_0xc28f6a[_0x767a('0x44')]};return;}})[_0x767a('0xf')](function(){if(_0x22bdba['List']){if(_0x22bdba[_0x767a('0x4e')]['Contacts']['length']){return _0x22bdba['List'][_0x767a('0x60')][0x0];}else{return db[_0x767a('0x4f')]['create'](_['defaults'](_0xc28f6a[_0x767a('0x44')],{'firstName':_0xc28f6a['body']['to'],'email':_0xc28f6a[_0x767a('0x44')]['to'],'phone':_0xc28f6a[_0x767a('0x44')]['to'],'ListId':_0x22bdba[_0x767a('0x61')]}));}}else{throw new Error(_0x767a('0x62'));}})['then'](function(){if(_0x2665a3){return respondWithRpcPromise(_0x767a('0x63'),_0x767a('0x64'),_0x2665a3,client9003)[_0x767a('0xf')](function(_0x3e6974){return _0x3e23e1[_0x767a('0x1f')]({'read':!![],'messageId':_0x3e6974[_0x767a('0x65')],'sentAt':moment()[_0x767a('0x66')](_0x767a('0x67'))});})['catch'](function(_0x115463){logger[_0x767a('0x13')]('%s',JSON[_0x767a('0x68')](_0x115463));return _0x3e23e1;});}return _0x3e23e1;});}return _0x3e23e1;}})[_0x767a('0xf')](respondWithResult(_0x2eadec,0xc9))[_0x767a('0x40')](handleError(_0x2eadec,null));};exports['accept']=function(_0x378ffb,_0x1ab194){var _0xf98cc8={'agent':{},'channel':'mail'};if(_0x378ffb[_0x767a('0x44')]['id']){delete _0x378ffb[_0x767a('0x44')]['id'];}_0x378ffb[_0x767a('0x44')][_0x767a('0x69')]=!![];_0x378ffb['body'][_0x767a('0x6a')]=moment()[_0x767a('0x66')]('YYYY-MM-DD\x20HH:mm:ss');_0x378ffb[_0x767a('0x44')]['UserId']=_0x378ffb['body'][_0x767a('0x6b')]||_0x378ffb[_0x767a('0x5a')]['id'];_0xf98cc8['agent']['id']=_0x378ffb['body']['UserId'];return db['MailMessage'][_0x767a('0x43')]({'where':{'id':_0x378ffb[_0x767a('0x42')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1ab194,null))[_0x767a('0xf')](saveUpdates(_0x378ffb[_0x767a('0x44')],null))[_0x767a('0xf')](function(_0x1ef18e){if(_0x1ef18e){_0xf98cc8[_0x767a('0x14')]=_0x1ef18e[_0x767a('0x6c')]({'plain':!![]});return db['MailInteraction'][_0x767a('0x43')]({'where':{'id':_0x1ef18e['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x1ab194,null))[_0x767a('0xf')](function(_0x48b320){if(_0x48b320){return _0x48b320['update']({'UserId':_0x378ffb[_0x767a('0x44')][_0x767a('0x6b')],'read1stAt':_[_0x767a('0x6d')](_0x48b320[_0x767a('0x6e')])?moment()[_0x767a('0x66')](_0x767a('0x67')):undefined});}return null;})[_0x767a('0xf')](function(_0x1c6999){if(_0x1c6999){_0xf98cc8[_0x767a('0x6f')]=_0x1c6999[_0x767a('0x6c')]({'plain':!![]});interaction_log['info'](_0x767a('0x70'),_0x378ffb[_0x767a('0x5a')]['id'],_0x378ffb['user'][_0x767a('0x24')],_0x378ffb[_0x767a('0x5a')][_0x767a('0x71')],_0xf98cc8[_0x767a('0x6f')]['id'],_0x378ffb[_0x767a('0x44')]?JSON[_0x767a('0x68')](_0x378ffb[_0x767a('0x44')]):'null');return respondWithRpcPromise(_0x767a('0x72'),_0x767a('0x73'),_0xf98cc8);}return null;})[_0x767a('0xf')](function(_0x2f4986){var _0x1f6d7e=_0x767a('0x74')+_0x2f4986['message'][_0x767a('0x75')];return db[_0x767a('0x76')][_0x767a('0x2d')](_0x1f6d7e,{'type':db[_0x767a('0x77')][_0x767a('0x78')][_0x767a('0x79')],'raw':!![]})[_0x767a('0xf')](function(_0x539c27){return _0x539c27;});})['then'](function(_0x5949ca){if(_0x5949ca){_0xf98cc8[_0x767a('0x14')]['contact']=_0x5949ca[0x0];if(!_0x378ffb['body'][_0x767a('0x6b')])return;return db[_0x767a('0x7a')][_0x767a('0x43')]({'where':{'id':_0x378ffb[_0x767a('0x44')][_0x767a('0x6b')],'role':_0x767a('0x7b')},'attributes':['id',_0x767a('0x24'),'fullname',_0x767a('0x7c'),_0x767a('0x7d')],'raw':!![]});}return null;})[_0x767a('0xf')](function(_0x37c7f8){if(!_0x37c7f8)return null;_0xf98cc8[_0x767a('0x14')][_0x767a('0x7b')]=_0x37c7f8;return _0xf98cc8;})[_0x767a('0xf')](function(_0x44875a){if(_0x44875a){if(_0x378ffb['body'][_0x767a('0x7e')]){_0xf98cc8[_0x767a('0x14')][_0x767a('0x7f')]=util[_0x767a('0x66')](_0x767a('0x80'),_0x378ffb[_0x767a('0x5a')][_0x767a('0x24')]);_0xf98cc8['message'][_0x767a('0x81')]=_0xf98cc8['channel'];_0xf98cc8['message'][_0x767a('0x82')]='accept';_0xf98cc8[_0x767a('0x14')]['body']=htmlToText[_0x767a('0x83')](_0xf98cc8['message'][_0x767a('0x44')]);return respondWithRpcPromise('EventManager',_0x767a('0x84'),{'event':_0x767a('0x85'),'message':_0xf98cc8['message']},client9002)[_0x767a('0xf')](function(){return _0xf98cc8;});}return _0xf98cc8;}return null;})['then'](respondWithResult(_0x1ab194,null))['catch'](handleError(_0x1ab194,null));};exports[_0x767a('0x86')]=function(_0x331cb1,_0x103709){var _0x17592c={'agent':{},'channel':_0x767a('0x87')};if(_0x331cb1['body']['id']){delete _0x331cb1[_0x767a('0x44')]['id'];}_0x331cb1[_0x767a('0x44')][_0x767a('0x6b')]=_0x331cb1[_0x767a('0x44')][_0x767a('0x6b')]||_0x331cb1[_0x767a('0x5a')]['id'];_0x17592c[_0x767a('0x7b')]['id']=_0x331cb1[_0x767a('0x44')][_0x767a('0x6b')];return db[_0x767a('0x3c')]['find']({'where':{'id':_0x331cb1[_0x767a('0x42')]['id'],'UserId':null}})[_0x767a('0xf')](handleEntityNotFound(_0x103709,null))[_0x767a('0xf')](function(_0x383155){if(_0x383155){_0x17592c[_0x767a('0x14')]=_0x383155['get']({'plain':!![]});return db[_0x767a('0x88')][_0x767a('0x43')]({'where':{'id':_0x383155[_0x767a('0x89')]}});}return null;})['then'](handleEntityNotFound(_0x103709,null))[_0x767a('0xf')](function(_0x48c57c){if(_0x48c57c){_0x17592c['interaction']=_0x48c57c[_0x767a('0x6c')]({'plain':!![]});interaction_log['info'](_0x767a('0x8a'),_0x331cb1[_0x767a('0x5a')]['id'],_0x331cb1[_0x767a('0x5a')][_0x767a('0x24')],_0x331cb1[_0x767a('0x5a')]['role'],_0x17592c[_0x767a('0x6f')]['id'],_0x331cb1[_0x767a('0x44')]?JSON[_0x767a('0x68')](_0x331cb1[_0x767a('0x44')]):_0x767a('0x8b'));return respondWithRpcPromise('RejectMessage',_0x767a('0x8c'),_0x17592c);}return null;})[_0x767a('0xf')](function(_0x26531e){var _0xacfd3d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x26531e['message'][_0x767a('0x75')];return db[_0x767a('0x76')][_0x767a('0x2d')](_0xacfd3d,{'type':db[_0x767a('0x77')][_0x767a('0x78')][_0x767a('0x79')],'raw':!![]})[_0x767a('0xf')](function(_0x3af45e){return _0x3af45e;});})[_0x767a('0xf')](function(_0x11b84c){if(_0x11b84c){_0x17592c[_0x767a('0x14')][_0x767a('0x8d')]=_0x11b84c[0x0];if(!_0x331cb1[_0x767a('0x44')][_0x767a('0x6b')])return;return db[_0x767a('0x7a')]['find']({'where':{'id':_0x331cb1[_0x767a('0x44')][_0x767a('0x6b')],'role':_0x767a('0x7b')},'attributes':['id',_0x767a('0x24'),'fullname',_0x767a('0x7c'),'internal'],'raw':!![]});}return null;})['then'](function(_0x13462c){if(!_0x13462c)return null;_0x17592c[_0x767a('0x14')][_0x767a('0x7b')]=_0x13462c;return _0x17592c;})[_0x767a('0xf')](function(_0x2876a9){if(_0x2876a9){_0x2876a9[_0x767a('0x14')][_0x767a('0x7f')]=util[_0x767a('0x66')](_0x767a('0x80'),_0x331cb1[_0x767a('0x5a')][_0x767a('0x24')]);_0x2876a9['message']['channel']=_0x17592c[_0x767a('0x81')];_0x2876a9[_0x767a('0x14')]['event']='reject';_0x2876a9[_0x767a('0x14')]['body']=htmlToText[_0x767a('0x83')](_0x17592c[_0x767a('0x14')][_0x767a('0x44')]);respondWithRpcPromise(_0x767a('0x84'),_0x767a('0x84'),{'event':_0x767a('0x8e'),'message':_0x2876a9[_0x767a('0x14')]},client9002);return _0x17592c;}return null;})[_0x767a('0xf')](respondWithResult(_0x103709,null))[_0x767a('0x40')](handleError(_0x103709,null));};exports['download']=function(_0x40043c,_0x2265e0){var _0x52e3f2=moment()[_0x767a('0x8f')]()[_0x767a('0x90')]();var _0x4ff236=path['join'](config['root'],'server',_0x767a('0x91'),_0x767a('0x92'));var _0x127b0b=path[_0x767a('0x5d')](config[_0x767a('0x93')],_0x767a('0x94'),_0x767a('0x91'),'attachments');var _0x253fd9=util['format'](_0x767a('0x95'),_0x52e3f2);return db[_0x767a('0x3c')][_0x767a('0x43')]({'where':{'id':_0x40043c['params']['id']},'attributes':['id',_0x767a('0x44'),_0x767a('0x96'),'to','cc',_0x767a('0x97'),'subject','createdAt'],'include':_0x40043c[_0x767a('0x2d')][_0x767a('0x5b')]?[{'model':db['Attachment'],'as':_0x767a('0x98')}]:undefined})[_0x767a('0xf')](handleEntityNotFound(_0x2265e0,null))['then'](function(_0x190fff){if(_0x190fff){var _0x271270=_0x190fff;var _0xf36da1={'from':_0x271270['from'],'to':_0x271270['to'],'subject':_0x271270['subject'],'html':htmlEntities[_0x767a('0x99')](_0x271270[_0x767a('0x44')]),'headers':{'Date':moment(_0x271270[_0x767a('0x9a')])[_0x767a('0x66')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x190fff['cc']){_0xf36da1['headers']['Cc']=_0x190fff['cc'];}if(_0x190fff[_0x767a('0x97')]){_0xf36da1['headers'][_0x767a('0x9b')]=_0x190fff[_0x767a('0x97')];}return new BPromise(function(_0x518dc1,_0x109a16){if(_0x190fff[_0x767a('0x98')]){for(var _0x4147b1=0x0;_0x4147b1<_0x190fff[_0x767a('0x98')][_0x767a('0x5c')];_0x4147b1++){var _0x47fefa=_0x190fff[_0x767a('0x98')][_0x4147b1];var _0x4725de=path[_0x767a('0x5d')](_0x127b0b,_0x47fefa[_0x767a('0x5f')]);if(fs[_0x767a('0x9c')](_0x4725de)){_0xf36da1[_0x767a('0x5b')][_0x767a('0x9d')]({'name':_0x47fefa[_0x767a('0x24')],'contentType':_0x47fefa[_0x767a('0x29')],'data':fs['readFileSync'](_0x4725de)});}}}emlformat[_0x767a('0x9e')](_0xf36da1,function(_0xde8832,_0x2adb9a){if(_0xde8832)return _0x109a16(_0xde8832);fs[_0x767a('0x9f')](path['join'](_0x4ff236,_0x253fd9),_0x2adb9a);return _0x518dc1(_0x2adb9a);});});}})[_0x767a('0xf')](function(_0x57ebf8){if(_0x57ebf8){return _0x2265e0['download'](path['join'](_0x4ff236,_0x253fd9),_0x253fd9,function(_0x5c97be){if(!_0x5c97be)fs[_0x767a('0xa0')](path[_0x767a('0x5d')](_0x4ff236,_0x253fd9));});}})[_0x767a('0x40')](handleError(_0x2265e0,null));}; \ No newline at end of file +var _0xc8d0=['findOne','MailAccountId','CmList','List','CmContact','updatedAt','DESC','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','attachments','join','root','server/files/attachments','Contacts','List\x20not\x20found','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','read','format','UserId','agent','get','MailInteractionId','isNil','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','User','email','internal','interface','SIP/%s','channel','event','fromString','EventManager','reject','mail','interaction','role','RejectMessage','QueryTypes','contact','fullname','rejectmessage','download','unix','toString','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','unlinkSync','eml-format','bluebird','path','lodash','ioredis','html-to-text','../../components/parsers/qs','api','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','then','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailMessage,\x20%s,\x20%s','message','info','catch','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','MailMessage','includeAll','include','findAll','rows','params','keys','find','body','create','direction','out','secret','split','MailAccount'];(function(_0x500812,_0x296a3c){var _0x4add02=function(_0x33c252){while(--_0x33c252){_0x500812['push'](_0x500812['shift']());}};_0x4add02(++_0x296a3c);}(_0xc8d0,0xf6));var _0x0c8d=function(_0x4fc421,_0x94e88){_0x4fc421=_0x4fc421-0x0;var _0x8c6d63=_0xc8d0[_0x4fc421];return _0x8c6d63;};'use strict';var emlformat=require(_0x0c8d('0x0'));var moment=require('moment');var BPromise=require(_0x0c8d('0x1'));var util=require('util');var path=require(_0x0c8d('0x2'));var fs=require('fs');var _=require(_0x0c8d('0x3'));var Redis=require(_0x0c8d('0x4'));var htmlToText=require(_0x0c8d('0x5'));var qs=require(_0x0c8d('0x6'));var logger=require('../../config/logger')(_0x0c8d('0x7'));var interaction_log=require(_0x0c8d('0x8'))(_0x0c8d('0x9'));var config=require(_0x0c8d('0xa'));var db=require(_0x0c8d('0xb'))['db'];config[_0x0c8d('0xc')]=_[_0x0c8d('0xd')](config[_0x0c8d('0xc')],{'host':_0x0c8d('0xe'),'port':0x18eb});var socket=require(_0x0c8d('0xf'))(new Redis(config[_0x0c8d('0xc')]));var htmlEntities=require(_0x0c8d('0x10'));require(_0x0c8d('0x11'))[_0x0c8d('0x12')](socket);var jayson=require(_0x0c8d('0x13'));var client=jayson[_0x0c8d('0x14')][_0x0c8d('0x15')]({'port':0x232c});var client9003=jayson[_0x0c8d('0x14')][_0x0c8d('0x15')]({'port':0x232b});var client9002=jayson['client'][_0x0c8d('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x542ad5,_0x52a440,_0x133ec5,_0x3a92e9){return new BPromise(function(_0x1231ef,_0x284660){var _0x14f598=_0x3a92e9||client;return _0x14f598['request'](_0x542ad5,_0x133ec5)[_0x0c8d('0x16')](function(_0x50bb20){logger['info']('MailMessage,\x20%s,\x20%s',_0x52a440,'request\x20sent');logger['debug'](_0x0c8d('0x17'),_0x52a440,_0x0c8d('0x18'),JSON[_0x0c8d('0x19')](_0x50bb20));if(_0x50bb20['error']){if(_0x50bb20[_0x0c8d('0x1a')]['code']===0x1f4){logger[_0x0c8d('0x1a')](_0x0c8d('0x1b'),_0x52a440,_0x50bb20[_0x0c8d('0x1a')][_0x0c8d('0x1c')]);return _0x284660(_0x50bb20['error'][_0x0c8d('0x1c')]);}logger[_0x0c8d('0x1a')](_0x0c8d('0x1b'),_0x52a440,_0x50bb20[_0x0c8d('0x1a')]['message']);return _0x1231ef(_0x50bb20[_0x0c8d('0x1a')][_0x0c8d('0x1c')]);}else{logger[_0x0c8d('0x1d')]('MailMessage,\x20%s,\x20%s',_0x52a440,_0x0c8d('0x18'));_0x1231ef(_0x50bb20['result'][_0x0c8d('0x1c')]);}})[_0x0c8d('0x1e')](function(_0x6ec134){logger[_0x0c8d('0x1a')](_0x0c8d('0x1b'),_0x52a440,_0x6ec134);_0x284660(_0x6ec134);});});}function respondWithResult(_0x467cee,_0x387677){_0x387677=_0x387677||0xc8;return function(_0x2377a5){if(_0x2377a5){return _0x467cee[_0x0c8d('0x1f')](_0x387677)[_0x0c8d('0x20')](_0x2377a5);}};}function respondWithFilteredResult(_0x107950,_0x31b71e){return function(_0x587578){if(_0x587578){var _0x22b8ba=typeof _0x31b71e[_0x0c8d('0x21')]==='undefined'&&typeof _0x31b71e[_0x0c8d('0x22')]===_0x0c8d('0x23');var _0x537a40=_0x587578[_0x0c8d('0x24')];var _0x528a9d=_0x22b8ba?0x0:_0x31b71e[_0x0c8d('0x21')];var _0x118db5=_0x22b8ba?_0x587578[_0x0c8d('0x24')]:_0x31b71e[_0x0c8d('0x21')]+_0x31b71e[_0x0c8d('0x22')];var _0x1c107d;if(_0x118db5>=_0x537a40){_0x118db5=_0x537a40;_0x1c107d=0xc8;}else{_0x1c107d=0xce;}_0x107950[_0x0c8d('0x1f')](_0x1c107d);return _0x107950[_0x0c8d('0x25')](_0x0c8d('0x26'),_0x528a9d+'-'+_0x118db5+'/'+_0x537a40)['json'](_0x587578);}return null;};}function saveUpdates(_0x4a91ce){return function(_0x3d0d21){if(_0x3d0d21){return _0x3d0d21[_0x0c8d('0x27')](_0x4a91ce)[_0x0c8d('0x16')](function(_0x5268ec){return _0x5268ec;});}return null;};}function removeEntity(_0x2b237e){return function(_0x461aff){if(_0x461aff){return _0x461aff[_0x0c8d('0x28')]()['then'](function(){_0x2b237e[_0x0c8d('0x1f')](0xcc)[_0x0c8d('0x29')]();});}};}function handleEntityNotFound(_0x27aba2){return function(_0x2a69c5){if(!_0x2a69c5){_0x27aba2['sendStatus'](0x194);}return _0x2a69c5;};}function handleError(_0x5b637c,_0x2bb32c){_0x2bb32c=_0x2bb32c||0x1f4;return function(_0x1563ca){logger['error'](_0x1563ca[_0x0c8d('0x2a')]);if(_0x1563ca[_0x0c8d('0x2b')]){delete _0x1563ca[_0x0c8d('0x2b')];}_0x5b637c[_0x0c8d('0x1f')](_0x2bb32c)[_0x0c8d('0x2c')](_0x1563ca);};}exports[_0x0c8d('0x2d')]=function(_0x94bff8,_0x5724bf){var _0x3a42e1={},_0x35c470={},_0x46f01d={'count':0x0,'rows':[]};var _0x39ff1d=_[_0x0c8d('0x2e')](db['MailMessage'][_0x0c8d('0x2f')],function(_0x52730c){return{'name':_0x52730c[_0x0c8d('0x30')],'type':_0x52730c['type'][_0x0c8d('0x31')]};});_0x35c470[_0x0c8d('0x32')]=_[_0x0c8d('0x2e')](_0x39ff1d,'name');_0x35c470[_0x0c8d('0x33')]=_['keys'](_0x94bff8[_0x0c8d('0x33')]);_0x35c470['filters']=_[_0x0c8d('0x34')](_0x35c470[_0x0c8d('0x32')],_0x35c470[_0x0c8d('0x33')]);_0x3a42e1[_0x0c8d('0x35')]=_['intersection'](_0x35c470['model'],qs['fields'](_0x94bff8['query'][_0x0c8d('0x36')]));_0x3a42e1[_0x0c8d('0x35')]=_0x3a42e1['attributes'][_0x0c8d('0x37')]?_0x3a42e1[_0x0c8d('0x35')]:_0x35c470[_0x0c8d('0x32')];if(!_0x94bff8[_0x0c8d('0x33')][_0x0c8d('0x38')](_0x0c8d('0x39'))){_0x3a42e1[_0x0c8d('0x22')]=qs[_0x0c8d('0x22')](_0x94bff8[_0x0c8d('0x33')][_0x0c8d('0x22')]);_0x3a42e1[_0x0c8d('0x21')]=qs[_0x0c8d('0x21')](_0x94bff8[_0x0c8d('0x33')][_0x0c8d('0x21')]);}_0x3a42e1[_0x0c8d('0x3a')]=qs[_0x0c8d('0x3b')](_0x94bff8[_0x0c8d('0x33')][_0x0c8d('0x3b')]);_0x3a42e1[_0x0c8d('0x3c')]=qs[_0x0c8d('0x3d')](_[_0x0c8d('0x3e')](_0x94bff8['query'],_0x35c470[_0x0c8d('0x3d')]),_0x39ff1d);if(_0x94bff8[_0x0c8d('0x33')][_0x0c8d('0x3f')]){_0x3a42e1[_0x0c8d('0x3c')]=_[_0x0c8d('0x40')](_0x3a42e1[_0x0c8d('0x3c')],{'$or':_[_0x0c8d('0x2e')](_0x39ff1d,function(_0x3c0cf1){if(_0x3c0cf1[_0x0c8d('0x41')]!==_0x0c8d('0x42')){var _0x2caa10={};_0x2caa10[_0x3c0cf1[_0x0c8d('0x2b')]]={'$like':'%'+_0x94bff8['query']['filter']+'%'};return _0x2caa10;}})});}_0x3a42e1=_[_0x0c8d('0x40')]({},_0x3a42e1,_0x94bff8['options']);var _0x590cb3={'where':_0x3a42e1['where']};return db[_0x0c8d('0x43')]['count'](_0x590cb3)[_0x0c8d('0x16')](function(_0x1d6243){_0x46f01d['count']=_0x1d6243;if(_0x94bff8[_0x0c8d('0x33')][_0x0c8d('0x44')]){_0x3a42e1[_0x0c8d('0x45')]=[{'all':!![]}];}return db[_0x0c8d('0x43')][_0x0c8d('0x46')](_0x3a42e1);})[_0x0c8d('0x16')](function(_0x8ab813){_0x46f01d[_0x0c8d('0x47')]=_0x8ab813;return _0x46f01d;})[_0x0c8d('0x16')](respondWithFilteredResult(_0x5724bf,_0x3a42e1))[_0x0c8d('0x1e')](handleError(_0x5724bf,null));};exports['show']=function(_0x55ce4c,_0x2ddc16){var _0x198067={'raw':!![],'where':{'id':_0x55ce4c[_0x0c8d('0x48')]['id']}},_0x2eebe7={};_0x2eebe7[_0x0c8d('0x32')]=_[_0x0c8d('0x49')](db[_0x0c8d('0x43')]['rawAttributes']);_0x2eebe7[_0x0c8d('0x33')]=_[_0x0c8d('0x49')](_0x55ce4c[_0x0c8d('0x33')]);_0x2eebe7[_0x0c8d('0x3d')]=_[_0x0c8d('0x34')](_0x2eebe7[_0x0c8d('0x32')],_0x2eebe7[_0x0c8d('0x33')]);_0x198067[_0x0c8d('0x35')]=_[_0x0c8d('0x34')](_0x2eebe7[_0x0c8d('0x32')],qs[_0x0c8d('0x36')](_0x55ce4c[_0x0c8d('0x33')][_0x0c8d('0x36')]));_0x198067[_0x0c8d('0x35')]=_0x198067[_0x0c8d('0x35')][_0x0c8d('0x37')]?_0x198067[_0x0c8d('0x35')]:_0x2eebe7[_0x0c8d('0x32')];if(_0x55ce4c['query'][_0x0c8d('0x44')]){_0x198067[_0x0c8d('0x45')]=[{'all':!![]}];}_0x198067=_[_0x0c8d('0x40')]({},_0x198067,_0x55ce4c['options']);return db[_0x0c8d('0x43')][_0x0c8d('0x4a')](_0x198067)[_0x0c8d('0x16')](handleEntityNotFound(_0x2ddc16,null))[_0x0c8d('0x16')](respondWithResult(_0x2ddc16,null))['catch'](handleError(_0x2ddc16,null));};exports[_0x0c8d('0x27')]=function(_0xedab0a,_0x462bb7){if(_0xedab0a[_0x0c8d('0x4b')]['id']){delete _0xedab0a[_0x0c8d('0x4b')]['id'];}return db[_0x0c8d('0x43')]['find']({'where':{'id':_0xedab0a['params']['id']}})['then'](handleEntityNotFound(_0x462bb7,null))[_0x0c8d('0x16')](saveUpdates(_0xedab0a['body'],null))[_0x0c8d('0x16')](respondWithResult(_0x462bb7,null))[_0x0c8d('0x1e')](handleError(_0x462bb7,null));};exports[_0x0c8d('0x28')]=function(_0x32c8a0,_0x46a476){return db['MailMessage']['find']({'where':{'id':_0x32c8a0[_0x0c8d('0x48')]['id']}})[_0x0c8d('0x16')](handleEntityNotFound(_0x46a476,null))[_0x0c8d('0x16')](removeEntity(_0x46a476,null))[_0x0c8d('0x1e')](handleError(_0x46a476,null));};exports['describe']=function(_0x3dac1e,_0x572a00){return db[_0x0c8d('0x43')]['describe']()[_0x0c8d('0x16')](respondWithResult(_0x572a00,null))[_0x0c8d('0x1e')](handleError(_0x572a00,null));};exports[_0x0c8d('0x4c')]=function(_0x2f499e,_0x2f76f5){return db[_0x0c8d('0x43')]['create'](_0x2f499e[_0x0c8d('0x4b')])[_0x0c8d('0x16')](function(_0x322f83){if(_0x322f83){if(_0x322f83[_0x0c8d('0x4d')]===_0x0c8d('0x4e')&&!_0x322f83[_0x0c8d('0x4f')]){var _0x2aa3ff,_0x49ceed,_0x37245e;if(_0x2f499e[_0x0c8d('0x4b')]['to']){_0x49ceed=_0x2f499e[_0x0c8d('0x4b')]['to'][_0x0c8d('0x50')](',')[0x0];}return db[_0x0c8d('0x51')][_0x0c8d('0x52')]({'where':{'id':_0x322f83[_0x0c8d('0x53')]},'include':[{'model':db[_0x0c8d('0x54')],'as':_0x0c8d('0x55'),'include':[{'model':db[_0x0c8d('0x56')],'as':'Contacts','where':{'email':_0x49ceed},'limit':0x1,'order':[[_0x0c8d('0x57'),_0x0c8d('0x58')]]}]},{'model':db[_0x0c8d('0x59')],'as':_0x0c8d('0x5a'),'raw':!![]}]})[_0x0c8d('0x16')](function(_0x95cb29){_0x2aa3ff=_0x95cb29;if(_0x2aa3ff&&_0x2aa3ff[_0x0c8d('0x5a')]){var _0x2da4df={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x2aa3ff[_0x0c8d('0x5a')][_0x0c8d('0x5b')])){_0x2da4df[_0x0c8d('0x5c')]=_0x2aa3ff[_0x0c8d('0x5a')][_0x0c8d('0x5c')];_0x2da4df['port']=_0x2aa3ff[_0x0c8d('0x5a')][_0x0c8d('0x5d')];_0x2da4df[_0x0c8d('0x5e')]=_0x2aa3ff['Smtp'][_0x0c8d('0x5e')];if(_0x2aa3ff[_0x0c8d('0x5a')][_0x0c8d('0x5f')]){_0x2da4df[_0x0c8d('0x60')]={'user':_0x2aa3ff[_0x0c8d('0x5a')]['user'],'pass':_0x2aa3ff[_0x0c8d('0x5a')]['pass']};}}else{_0x2da4df[_0x0c8d('0x5b')]=_0x2aa3ff[_0x0c8d('0x5a')][_0x0c8d('0x5b')];_0x2da4df['auth']={'user':_0x2aa3ff['Smtp']['user'],'pass':_0x2aa3ff[_0x0c8d('0x5a')][_0x0c8d('0x61')]};_0x2da4df['secure']=_0x2aa3ff['Smtp'][_0x0c8d('0x5e')];}if(_0x2f499e[_0x0c8d('0x4b')][_0x0c8d('0x62')]&&_0x2f499e[_0x0c8d('0x4b')][_0x0c8d('0x62')]['length']){for(var _0x5caf57=0x0;_0x5caf57<_0x2f499e[_0x0c8d('0x4b')]['attachments'][_0x0c8d('0x37')];_0x5caf57+=0x1){_0x2f499e['body'][_0x0c8d('0x62')][_0x5caf57]={'filename':_0x2f499e[_0x0c8d('0x4b')][_0x0c8d('0x62')][_0x5caf57][_0x0c8d('0x2b')],'path':path[_0x0c8d('0x63')](config[_0x0c8d('0x64')],_0x0c8d('0x65'),_0x2f499e['body']['attachments'][_0x5caf57]['basename'])};}}_0x37245e={'account':_0x2da4df,'message':_0x2f499e[_0x0c8d('0x4b')]};return;}})[_0x0c8d('0x16')](function(){if(_0x2aa3ff[_0x0c8d('0x55')]){if(_0x2aa3ff[_0x0c8d('0x55')][_0x0c8d('0x66')][_0x0c8d('0x37')]){return _0x2aa3ff['List']['Contacts'][0x0];}else{return db[_0x0c8d('0x56')]['create'](_[_0x0c8d('0xd')](_0x2f499e[_0x0c8d('0x4b')],{'firstName':_0x2f499e[_0x0c8d('0x4b')]['to'],'email':_0x2f499e[_0x0c8d('0x4b')]['to'],'phone':_0x2f499e['body']['to'],'ListId':_0x2aa3ff['ListId']}));}}else{throw new Error(_0x0c8d('0x67'));}})[_0x0c8d('0x16')](function(){if(_0x37245e){return respondWithRpcPromise(_0x0c8d('0x68'),_0x0c8d('0x69'),_0x37245e,client9003)[_0x0c8d('0x16')](function(_0x2be84f){return _0x322f83['update']({'read':!![],'messageId':_0x2be84f[_0x0c8d('0x6a')],'sentAt':moment()['format'](_0x0c8d('0x6b'))});})[_0x0c8d('0x1e')](function(_0x5f5998){logger[_0x0c8d('0x1a')]('%s',JSON[_0x0c8d('0x19')](_0x5f5998));return _0x322f83;});}return _0x322f83;});}return _0x322f83;}})[_0x0c8d('0x16')](respondWithResult(_0x2f76f5,0xc9))[_0x0c8d('0x1e')](handleError(_0x2f76f5,null));};exports[_0x0c8d('0x6c')]=function(_0x31eb43,_0x31d2bc){var _0x38bf7f={'agent':{},'channel':'mail'};if(_0x31eb43[_0x0c8d('0x4b')]['id']){delete _0x31eb43['body']['id'];}_0x31eb43[_0x0c8d('0x4b')][_0x0c8d('0x6d')]=!![];_0x31eb43[_0x0c8d('0x4b')]['readAt']=moment()[_0x0c8d('0x6e')](_0x0c8d('0x6b'));_0x31eb43[_0x0c8d('0x4b')][_0x0c8d('0x6f')]=_0x31eb43['body']['UserId']||_0x31eb43['user']['id'];_0x38bf7f[_0x0c8d('0x70')]['id']=_0x31eb43[_0x0c8d('0x4b')][_0x0c8d('0x6f')];return db[_0x0c8d('0x43')][_0x0c8d('0x4a')]({'where':{'id':_0x31eb43[_0x0c8d('0x48')]['id'],'UserId':null}})[_0x0c8d('0x16')](handleEntityNotFound(_0x31d2bc,null))[_0x0c8d('0x16')](saveUpdates(_0x31eb43[_0x0c8d('0x4b')],null))[_0x0c8d('0x16')](function(_0x1df1f8){if(_0x1df1f8){_0x38bf7f[_0x0c8d('0x1c')]=_0x1df1f8[_0x0c8d('0x71')]({'plain':!![]});return db['MailInteraction'][_0x0c8d('0x4a')]({'where':{'id':_0x1df1f8[_0x0c8d('0x72')]}});}return null;})[_0x0c8d('0x16')](handleEntityNotFound(_0x31d2bc,null))['then'](function(_0x1b8ec4){if(_0x1b8ec4){return _0x1b8ec4['update']({'UserId':_0x31eb43[_0x0c8d('0x4b')][_0x0c8d('0x6f')],'read1stAt':_[_0x0c8d('0x73')](_0x1b8ec4[_0x0c8d('0x74')])?moment()['format'](_0x0c8d('0x6b')):undefined});}return null;})[_0x0c8d('0x16')](function(_0x255272){if(_0x255272){_0x38bf7f['interaction']=_0x255272['get']({'plain':!![]});interaction_log[_0x0c8d('0x1d')](_0x0c8d('0x75'),_0x31eb43['user']['id'],_0x31eb43[_0x0c8d('0x76')][_0x0c8d('0x2b')],_0x31eb43[_0x0c8d('0x76')]['role'],_0x38bf7f['interaction']['id'],_0x31eb43['body']?JSON['stringify'](_0x31eb43['body']):_0x0c8d('0x77'));return respondWithRpcPromise('AcceptMessage',_0x0c8d('0x78'),_0x38bf7f);}return null;})[_0x0c8d('0x16')](function(_0x27a70f){var _0x546f86=_0x0c8d('0x79')+_0x27a70f[_0x0c8d('0x1c')]['ContactId'];return db[_0x0c8d('0x7a')][_0x0c8d('0x33')](_0x546f86,{'type':db[_0x0c8d('0x7b')]['QueryTypes'][_0x0c8d('0x7c')],'raw':!![]})[_0x0c8d('0x16')](function(_0x382323){return _0x382323;});})[_0x0c8d('0x16')](function(_0x4409d0){if(_0x4409d0){_0x38bf7f['message']['contact']=_0x4409d0[0x0];if(!_0x31eb43['body'][_0x0c8d('0x6f')])return;return db[_0x0c8d('0x7d')][_0x0c8d('0x4a')]({'where':{'id':_0x31eb43['body'][_0x0c8d('0x6f')],'role':'agent'},'attributes':['id',_0x0c8d('0x2b'),'fullname',_0x0c8d('0x7e'),_0x0c8d('0x7f')],'raw':!![]});}return null;})[_0x0c8d('0x16')](function(_0x127f00){if(!_0x127f00)return null;_0x38bf7f['message'][_0x0c8d('0x70')]=_0x127f00;return _0x38bf7f;})[_0x0c8d('0x16')](function(_0x512295){if(_0x512295){if(_0x31eb43[_0x0c8d('0x4b')]['manual']){_0x38bf7f[_0x0c8d('0x1c')][_0x0c8d('0x80')]=util[_0x0c8d('0x6e')](_0x0c8d('0x81'),_0x31eb43[_0x0c8d('0x76')]['name']);_0x38bf7f['message'][_0x0c8d('0x82')]=_0x38bf7f[_0x0c8d('0x82')];_0x38bf7f['message'][_0x0c8d('0x83')]=_0x0c8d('0x6c');_0x38bf7f[_0x0c8d('0x1c')][_0x0c8d('0x4b')]=htmlToText[_0x0c8d('0x84')](_0x38bf7f[_0x0c8d('0x1c')][_0x0c8d('0x4b')]);return respondWithRpcPromise(_0x0c8d('0x85'),_0x0c8d('0x85'),{'event':'acceptmessage','message':_0x38bf7f[_0x0c8d('0x1c')]},client9002)[_0x0c8d('0x16')](function(){return _0x38bf7f;});}return _0x38bf7f;}return null;})[_0x0c8d('0x16')](respondWithResult(_0x31d2bc,null))['catch'](handleError(_0x31d2bc,null));};exports[_0x0c8d('0x86')]=function(_0x440699,_0x85149d){var _0x1d27cb={'agent':{},'channel':_0x0c8d('0x87')};if(_0x440699[_0x0c8d('0x4b')]['id']){delete _0x440699[_0x0c8d('0x4b')]['id'];}_0x440699[_0x0c8d('0x4b')][_0x0c8d('0x6f')]=_0x440699[_0x0c8d('0x4b')][_0x0c8d('0x6f')]||_0x440699['user']['id'];_0x1d27cb['agent']['id']=_0x440699['body']['UserId'];return db[_0x0c8d('0x43')][_0x0c8d('0x4a')]({'where':{'id':_0x440699[_0x0c8d('0x48')]['id'],'UserId':null}})[_0x0c8d('0x16')](handleEntityNotFound(_0x85149d,null))['then'](function(_0xe1454a){if(_0xe1454a){_0x1d27cb['message']=_0xe1454a[_0x0c8d('0x71')]({'plain':!![]});return db['MailInteraction'][_0x0c8d('0x4a')]({'where':{'id':_0xe1454a[_0x0c8d('0x72')]}});}return null;})[_0x0c8d('0x16')](handleEntityNotFound(_0x85149d,null))[_0x0c8d('0x16')](function(_0x5b3b7b){if(_0x5b3b7b){_0x1d27cb[_0x0c8d('0x88')]=_0x5b3b7b[_0x0c8d('0x71')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x440699[_0x0c8d('0x76')]['id'],_0x440699[_0x0c8d('0x76')][_0x0c8d('0x2b')],_0x440699[_0x0c8d('0x76')][_0x0c8d('0x89')],_0x1d27cb['interaction']['id'],_0x440699['body']?JSON[_0x0c8d('0x19')](_0x440699[_0x0c8d('0x4b')]):_0x0c8d('0x77'));return respondWithRpcPromise(_0x0c8d('0x8a'),'rejectMessage',_0x1d27cb);}return null;})[_0x0c8d('0x16')](function(_0x437a58){var _0x2d14f7='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x437a58['message']['ContactId'];return db[_0x0c8d('0x7a')]['query'](_0x2d14f7,{'type':db[_0x0c8d('0x7b')][_0x0c8d('0x8b')][_0x0c8d('0x7c')],'raw':!![]})['then'](function(_0x3b4fad){return _0x3b4fad;});})[_0x0c8d('0x16')](function(_0x57afa4){if(_0x57afa4){_0x1d27cb['message'][_0x0c8d('0x8c')]=_0x57afa4[0x0];if(!_0x440699[_0x0c8d('0x4b')]['UserId'])return;return db[_0x0c8d('0x7d')][_0x0c8d('0x4a')]({'where':{'id':_0x440699[_0x0c8d('0x4b')][_0x0c8d('0x6f')],'role':_0x0c8d('0x70')},'attributes':['id',_0x0c8d('0x2b'),_0x0c8d('0x8d'),_0x0c8d('0x7e'),_0x0c8d('0x7f')],'raw':!![]});}return null;})[_0x0c8d('0x16')](function(_0x4c8f99){if(!_0x4c8f99)return null;_0x1d27cb[_0x0c8d('0x1c')][_0x0c8d('0x70')]=_0x4c8f99;return _0x1d27cb;})[_0x0c8d('0x16')](function(_0x917065){if(_0x917065){_0x917065[_0x0c8d('0x1c')][_0x0c8d('0x80')]=util[_0x0c8d('0x6e')](_0x0c8d('0x81'),_0x440699[_0x0c8d('0x76')][_0x0c8d('0x2b')]);_0x917065[_0x0c8d('0x1c')][_0x0c8d('0x82')]=_0x1d27cb['channel'];_0x917065[_0x0c8d('0x1c')][_0x0c8d('0x83')]=_0x0c8d('0x86');_0x917065['message'][_0x0c8d('0x4b')]=htmlToText[_0x0c8d('0x84')](_0x1d27cb[_0x0c8d('0x1c')]['body']);respondWithRpcPromise('EventManager','EventManager',{'event':_0x0c8d('0x8e'),'message':_0x917065[_0x0c8d('0x1c')]},client9002);return _0x1d27cb;}return null;})[_0x0c8d('0x16')](respondWithResult(_0x85149d,null))[_0x0c8d('0x1e')](handleError(_0x85149d,null));};exports[_0x0c8d('0x8f')]=function(_0x375c3f,_0x2ff9b3){var _0x271e3a=moment()[_0x0c8d('0x90')]()[_0x0c8d('0x91')]();var _0x2e40b2=path[_0x0c8d('0x63')](config[_0x0c8d('0x64')],_0x0c8d('0x92'),_0x0c8d('0x93'),_0x0c8d('0x94'));var _0x897565=path['join'](config[_0x0c8d('0x64')],_0x0c8d('0x92'),_0x0c8d('0x93'),_0x0c8d('0x62'));var _0x503b1a=util['format'](_0x0c8d('0x95'),_0x271e3a);return db['MailMessage']['find']({'where':{'id':_0x375c3f['params']['id']},'attributes':['id',_0x0c8d('0x4b'),_0x0c8d('0x96'),'to','cc',_0x0c8d('0x97'),_0x0c8d('0x98'),_0x0c8d('0x99')],'include':_0x375c3f['query'][_0x0c8d('0x62')]?[{'model':db[_0x0c8d('0x9a')],'as':_0x0c8d('0x9b')}]:undefined})['then'](handleEntityNotFound(_0x2ff9b3,null))[_0x0c8d('0x16')](function(_0x1b67d){if(_0x1b67d){var _0xd3d93a=_0x1b67d;var _0xcd5344={'from':_0xd3d93a[_0x0c8d('0x96')],'to':_0xd3d93a['to'],'subject':_0xd3d93a[_0x0c8d('0x98')],'html':htmlEntities[_0x0c8d('0x9c')](_0xd3d93a[_0x0c8d('0x4b')]),'headers':{'Date':moment(_0xd3d93a[_0x0c8d('0x99')])['format'](_0x0c8d('0x9d'))},'attachments':[]};if(_0x1b67d['cc']){_0xcd5344[_0x0c8d('0x9e')]['Cc']=_0x1b67d['cc'];}if(_0x1b67d[_0x0c8d('0x97')]){_0xcd5344[_0x0c8d('0x9e')][_0x0c8d('0x9f')]=_0x1b67d[_0x0c8d('0x97')];}return new BPromise(function(_0x5c5086,_0x56ed0a){if(_0x1b67d[_0x0c8d('0x9b')]){for(var _0x27f0e9=0x0;_0x27f0e9<_0x1b67d[_0x0c8d('0x9b')][_0x0c8d('0x37')];_0x27f0e9++){var _0x154ec2=_0x1b67d[_0x0c8d('0x9b')][_0x27f0e9];var _0x49c2b6=path['join'](_0x897565,_0x154ec2[_0x0c8d('0xa0')]);if(fs[_0x0c8d('0xa1')](_0x49c2b6)){_0xcd5344['attachments']['push']({'name':_0x154ec2['name'],'contentType':_0x154ec2['type'],'data':fs[_0x0c8d('0xa2')](_0x49c2b6)});}}}emlformat['build'](_0xcd5344,function(_0x28c141,_0x3de69d){if(_0x28c141)return _0x56ed0a(_0x28c141);fs['writeFileSync'](path[_0x0c8d('0x63')](_0x2e40b2,_0x503b1a),_0x3de69d);return _0x5c5086(_0x3de69d);});});}})[_0x0c8d('0x16')](function(_0x3049f3){if(_0x3049f3){return _0x2ff9b3[_0x0c8d('0x8f')](path[_0x0c8d('0x63')](_0x2e40b2,_0x503b1a),_0x503b1a,function(_0x55dec0){if(!_0x55dec0)fs[_0x0c8d('0xa3')](path[_0x0c8d('0x63')](_0x2e40b2,_0x503b1a));});}})[_0x0c8d('0x1e')](handleError(_0x2ff9b3,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 5a8fe5b..a823e1a 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 _0xf95a=['hasOwnProperty','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit'];(function(_0x49703e,_0x3af744){var _0x392ed0=function(_0x1b701d){while(--_0x1b701d){_0x49703e['push'](_0x49703e['shift']());}};_0x392ed0(++_0x3af744);}(_0xf95a,0x174));var _0xaf95=function(_0x47eb7c,_0xe023fb){_0x47eb7c=_0x47eb7c-0x0;var _0x16c2a2=_0xf95a[_0x47eb7c];return _0x16c2a2;};'use strict';var EventEmitter=require(_0xaf95('0x0'));var MailMessage=require(_0xaf95('0x1'))['db'][_0xaf95('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xaf95('0x3')](0x0);var events={'afterCreate':_0xaf95('0x4'),'afterUpdate':_0xaf95('0x5'),'afterDestroy':_0xaf95('0x6')};function emitEvent(_0x2edf60){return function(_0x5cfd8b,_0x264984,_0x4c21c6){MailMessageEvents['emit'](_0x2edf60+':'+_0x5cfd8b['id'],_0x5cfd8b);MailMessageEvents[_0xaf95('0x7')](_0x2edf60,_0x5cfd8b);_0x4c21c6(null);};}for(var e in events){if(events[_0xaf95('0x8')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0xaf95('0x9')]=MailMessageEvents; \ No newline at end of file +var _0x1b52=['MailMessage','save','update','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0x1b52,0x1d4));var _0x21b5=function(_0x55969b,_0x1ebe62){_0x55969b=_0x55969b-0x0;var _0x3d7fc1=_0x1b52[_0x55969b];return _0x3d7fc1;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x21b5('0x0'))['db'][_0x21b5('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x21b5('0x2'),'afterUpdate':_0x21b5('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2f6f78){return function(_0x204d8c,_0x2f07c8,_0x3672db){MailMessageEvents['emit'](_0x2f6f78+':'+_0x204d8c['id'],_0x204d8c);MailMessageEvents[_0x21b5('0x4')](_0x2f6f78,_0x204d8c);_0x3672db(null);};}for(var e in events){if(events[_0x21b5('0x5')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x21b5('0x6')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 6f18d79..040ec4c 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 _0xddb9=['rimraf','../../config/environment','./mailMessage.attributes','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','get','toLowerCase','direction','out','secret','isNil','UserId','findOne','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','html-to-text','path'];(function(_0x4da6d2,_0x811b9a){var _0x278f55=function(_0x361b13){while(--_0x361b13){_0x4da6d2['push'](_0x4da6d2['shift']());}};_0x278f55(++_0x811b9a);}(_0xddb9,0x8f));var _0x9ddb=function(_0x3bf9ae,_0x3f41c4){_0x3bf9ae=_0x3bf9ae-0x0;var _0x56ddee=_0xddb9[_0x3bf9ae];return _0x56ddee;};'use strict';var _=require(_0x9ddb('0x0'));var util=require(_0x9ddb('0x1'));var logger=require(_0x9ddb('0x2'))(_0x9ddb('0x3'));var moment=require(_0x9ddb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require(_0x9ddb('0x5'));var fs=require('fs');var path=require(_0x9ddb('0x6'));var rimraf=require(_0x9ddb('0x7'));var config=require(_0x9ddb('0x8'));var attributes=require(_0x9ddb('0x9'));module['exports']=function(_0x357274,_0x573f4f){return _0x357274['define'](_0x9ddb('0xa'),attributes,{'tableName':_0x9ddb('0xb'),'paranoid':![],'indexes':[{'name':_0x9ddb('0xc'),'fields':[_0x9ddb('0xc')]},{'name':_0x9ddb('0xd'),'fields':[_0x9ddb('0xe'),_0x9ddb('0xf')],'type':_0x9ddb('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3c60d8,_0x3a316f,_0x5f55b0){if(_0x3c60d8['body']){_0x3c60d8['plainBody']=htmlToText['fromString'](_0x3c60d8['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5f55b0(null,_0x3a316f);},'afterCreate':function(_0xc443ef,_0x464cd8,_0x3d4563){var _0x58e438=_0x357274['models'];var _0x9051d4=_0xc443ef[_0x9ddb('0x11')]({'plain':!![]});if(_0x9051d4['direction'][_0x9ddb('0x12')]()==='in'||_0x9051d4[_0x9ddb('0x13')][_0x9ddb('0x12')]()===_0x9ddb('0x14')&&!_0x9051d4[_0x9ddb('0x15')]&&!_[_0x9ddb('0x16')](_0x9051d4[_0x9ddb('0x17')])){_0x58e438['MailInteraction'][_0x9ddb('0x18')]({'where':{'id':_0x9051d4['MailInteractionId']}})['then'](function(_0x1da05e){if(_0x1da05e){_0x1da05e[_0x9ddb('0x19')]({'lastMsgAt':_0x9051d4['createdAt'],'lastMsgDirection':_0x9051d4[_0x9ddb('0x13')]['toLowerCase']()});}})[_0x9ddb('0x1a')](function(_0x33df72){console[_0x9ddb('0x1b')](_0x33df72);});}_0x3d4563();}},'charset':_0x9ddb('0x1c'),'collate':_0x9ddb('0x1d')});}; \ No newline at end of file +var _0x79b4=['direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','utf8mb4','util','api','moment','bluebird','request-promise','html-to-text','path','rimraf','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','fti_mail_messages','subject','FULLTEXT','body','plainBody','models','get'];(function(_0x5c8cd3,_0x420d25){var _0x49f896=function(_0x4cc678){while(--_0x4cc678){_0x5c8cd3['push'](_0x5c8cd3['shift']());}};_0x49f896(++_0x420d25);}(_0x79b4,0xb8));var _0x479b=function(_0x595510,_0x5cc2a9){_0x595510=_0x595510-0x0;var _0x250751=_0x79b4[_0x595510];return _0x250751;};'use strict';var _=require('lodash');var util=require(_0x479b('0x0'));var logger=require('../../config/logger')(_0x479b('0x1'));var moment=require(_0x479b('0x2'));var BPromise=require(_0x479b('0x3'));var rp=require(_0x479b('0x4'));var htmlToText=require(_0x479b('0x5'));var fs=require('fs');var path=require(_0x479b('0x6'));var rimraf=require(_0x479b('0x7'));var config=require('../../config/environment');var attributes=require(_0x479b('0x8'));module['exports']=function(_0x1af18b,_0x341149){return _0x1af18b[_0x479b('0x9')](_0x479b('0xa'),attributes,{'tableName':_0x479b('0xb'),'paranoid':![],'indexes':[{'name':_0x479b('0xc'),'fields':[_0x479b('0xc')]},{'name':_0x479b('0xd'),'fields':['plainBody',_0x479b('0xe')],'type':_0x479b('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2a3ba1,_0x5758e4,_0x313fbd){if(_0x2a3ba1[_0x479b('0x10')]){_0x2a3ba1[_0x479b('0x11')]=htmlToText['fromString'](_0x2a3ba1['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x313fbd(null,_0x5758e4);},'afterCreate':function(_0x3d9b0e,_0x255d6f,_0x3813d6){var _0x3ff4d0=_0x1af18b[_0x479b('0x12')];var _0x207e0d=_0x3d9b0e[_0x479b('0x13')]({'plain':!![]});if(_0x207e0d[_0x479b('0x14')][_0x479b('0x15')]()==='in'||_0x207e0d[_0x479b('0x14')][_0x479b('0x15')]()===_0x479b('0x16')&&!_0x207e0d[_0x479b('0x17')]&&!_[_0x479b('0x18')](_0x207e0d[_0x479b('0x19')])){_0x3ff4d0[_0x479b('0x1a')][_0x479b('0x1b')]({'where':{'id':_0x207e0d[_0x479b('0x1c')]}})[_0x479b('0x1d')](function(_0x1901d0){if(_0x1901d0){_0x1901d0[_0x479b('0x1e')]({'lastMsgAt':_0x207e0d[_0x479b('0x1f')],'lastMsgDirection':_0x207e0d[_0x479b('0x14')][_0x479b('0x15')]()});}})[_0x479b('0x20')](function(_0x1f86aa){console['error'](_0x1f86aa);});}_0x3813d6();}},'charset':_0x479b('0x21'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index f809839..42545f4 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 _0xd914=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailMessage','MailMessage','create','body','options','raw','stringify','lodash'];(function(_0xa059ea,_0x5cb91e){var _0x156a4c=function(_0x1b4717){while(--_0x1b4717){_0xa059ea['push'](_0xa059ea['shift']());}};_0x156a4c(++_0x5cb91e);}(_0xd914,0x17f));var _0x4d91=function(_0x47e7dd,_0x51b041){_0x47e7dd=_0x47e7dd-0x0;var _0x38501f=_0xd914[_0x47e7dd];return _0x38501f;};'use strict';var _=require(_0x4d91('0x0'));var util=require(_0x4d91('0x1'));var moment=require('moment');var BPromise=require(_0x4d91('0x2'));var rs=require(_0x4d91('0x3'));var fs=require('fs');var Redis=require(_0x4d91('0x4'));var db=require(_0x4d91('0x5'))['db'];var utils=require(_0x4d91('0x6'));var logger=require(_0x4d91('0x7'))('rpc');var config=require(_0x4d91('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4d91('0x9')][_0x4d91('0xa')]({'port':0x232a});config[_0x4d91('0xb')]=_[_0x4d91('0xc')](config[_0x4d91('0xb')],{'host':_0x4d91('0xd'),'port':0x18eb});var socket=require(_0x4d91('0xe'))(new Redis(config[_0x4d91('0xb')]));require('./mailMessage.socket')[_0x4d91('0xf')](socket);function respondWithRpcPromise(_0xa4bb25,_0xc07c64,_0x278648){return new BPromise(function(_0xb234d2,_0x266b31){return client['request'](_0xa4bb25,_0x278648)['then'](function(_0x2ccd08){logger[_0x4d91('0x10')](_0x4d91('0x11'),_0xc07c64,_0x4d91('0x12'));logger[_0x4d91('0x13')](_0x4d91('0x14'),_0xc07c64,'request\x20sent',JSON['stringify'](_0x2ccd08));if(_0x2ccd08[_0x4d91('0x15')]){if(_0x2ccd08[_0x4d91('0x15')][_0x4d91('0x16')]===0x1f4){logger[_0x4d91('0x15')](_0x4d91('0x11'),_0xc07c64,_0x2ccd08[_0x4d91('0x15')][_0x4d91('0x17')]);return _0x266b31(_0x2ccd08['error'][_0x4d91('0x17')]);}logger[_0x4d91('0x15')](_0x4d91('0x11'),_0xc07c64,_0x2ccd08[_0x4d91('0x15')][_0x4d91('0x17')]);return _0xb234d2(_0x2ccd08['error'][_0x4d91('0x17')]);}else{logger[_0x4d91('0x10')](_0x4d91('0x11'),_0xc07c64,_0x4d91('0x12'));_0xb234d2(_0x2ccd08['result'][_0x4d91('0x17')]);}})[_0x4d91('0x18')](function(_0x13254c){logger['error'](_0x4d91('0x11'),_0xc07c64,_0x13254c);_0x266b31(_0x13254c);});});}exports[_0x4d91('0x19')]=function(_0x351388){var _0xd59fe=this;return new Promise(function(_0x10b767,_0x40cde4){return db[_0x4d91('0x1a')][_0x4d91('0x1b')](_0x351388[_0x4d91('0x1c')],{'raw':_0x351388[_0x4d91('0x1d')]?_0x351388['options'][_0x4d91('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x57913e){logger[_0x4d91('0x10')](_0x4d91('0x19'),_0x351388);logger[_0x4d91('0x13')](_0x4d91('0x19'),_0x351388,JSON[_0x4d91('0x1f')](_0x57913e));_0x10b767(_0x57913e);})[_0x4d91('0x18')](function(_0x100cd4){logger[_0x4d91('0x15')]('CreateMailMessage',_0x100cd4['message'],_0x351388);_0x40cde4(_0xd59fe[_0x4d91('0x15')](0x1f4,_0x100cd4[_0x4d91('0x17')]));});});}; \ No newline at end of file +var _0x66fa=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./mailMessage.socket','request','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','catch','CreateMailMessage','MailMessage','create','body','options','raw','stringify'];(function(_0x24a03e,_0x69f19d){var _0x13f38f=function(_0x183407){while(--_0x183407){_0x24a03e['push'](_0x24a03e['shift']());}};_0x13f38f(++_0x69f19d);}(_0x66fa,0x117));var _0xa66f=function(_0xf376e9,_0x11ab1f){_0xf376e9=_0xf376e9-0x0;var _0x353a83=_0x66fa[_0xf376e9];return _0x353a83;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});config[_0xa66f('0xb')]=_[_0xa66f('0xc')](config[_0xa66f('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa66f('0xd'))(new Redis(config['redis']));require(_0xa66f('0xe'))['register'](socket);function respondWithRpcPromise(_0x101e10,_0x53ca76,_0x52d802){return new BPromise(function(_0x55e6dc,_0x1e1997){return client[_0xa66f('0xf')](_0x101e10,_0x52d802)['then'](function(_0x14d31e){logger['info'](_0xa66f('0x10'),_0x53ca76,'request\x20sent');logger[_0xa66f('0x11')](_0xa66f('0x12'),_0x53ca76,_0xa66f('0x13'),JSON['stringify'](_0x14d31e));if(_0x14d31e['error']){if(_0x14d31e[_0xa66f('0x14')]['code']===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x53ca76,_0x14d31e[_0xa66f('0x14')][_0xa66f('0x15')]);return _0x1e1997(_0x14d31e[_0xa66f('0x14')][_0xa66f('0x15')]);}logger[_0xa66f('0x14')]('MailMessage,\x20%s,\x20%s',_0x53ca76,_0x14d31e['error'][_0xa66f('0x15')]);return _0x55e6dc(_0x14d31e[_0xa66f('0x14')][_0xa66f('0x15')]);}else{logger[_0xa66f('0x16')]('MailMessage,\x20%s,\x20%s',_0x53ca76,_0xa66f('0x13'));_0x55e6dc(_0x14d31e['result']['message']);}})[_0xa66f('0x17')](function(_0x413e80){logger[_0xa66f('0x14')](_0xa66f('0x10'),_0x53ca76,_0x413e80);_0x1e1997(_0x413e80);});});}exports[_0xa66f('0x18')]=function(_0x408bc7){var _0x251f60=this;return new Promise(function(_0x150291,_0x2033a4){return db[_0xa66f('0x19')][_0xa66f('0x1a')](_0x408bc7[_0xa66f('0x1b')],{'raw':_0x408bc7[_0xa66f('0x1c')]?_0x408bc7[_0xa66f('0x1c')][_0xa66f('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x27f570){logger[_0xa66f('0x16')](_0xa66f('0x18'),_0x408bc7);logger[_0xa66f('0x11')]('CreateMailMessage',_0x408bc7,JSON[_0xa66f('0x1e')](_0x27f570));_0x150291(_0x27f570);})[_0xa66f('0x17')](function(_0x209f4d){logger[_0xa66f('0x14')]('CreateMailMessage',_0x209f4d['message'],_0x408bc7);_0x2033a4(_0x251f60[_0xa66f('0x14')](0x1f4,_0x209f4d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 48ccab4..2329dc3 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 _0x4ccb=['update','removeListener','register','length','mailMessage:','./mailMessage.events','save','remove'];(function(_0x4ee136,_0xe43fed){var _0x1492c7=function(_0x704f2){while(--_0x704f2){_0x4ee136['push'](_0x4ee136['shift']());}};_0x1492c7(++_0xe43fed);}(_0x4ccb,0x1a5));var _0xb4cc=function(_0x2a1330,_0x118d08){_0x2a1330=_0x2a1330-0x0;var _0x520ad1=_0x4ccb[_0x2a1330];return _0x520ad1;};'use strict';var MailMessageEvents=require(_0xb4cc('0x0'));var events=[_0xb4cc('0x1'),_0xb4cc('0x2'),_0xb4cc('0x3')];function createListener(_0x5557f5,_0x102892){return function(_0x3ea038){_0x102892['emit'](_0x5557f5,_0x3ea038);};}function removeListener(_0x4b6eea,_0x9639f2){return function(){MailMessageEvents[_0xb4cc('0x4')](_0x4b6eea,_0x9639f2);};}exports[_0xb4cc('0x5')]=function(_0x27f984){for(var _0x42dc05=0x0,_0x641db0=events[_0xb4cc('0x6')];_0x42dc05<_0x641db0;_0x42dc05++){var _0x25e57e=events[_0x42dc05];var _0x29538d=createListener(_0xb4cc('0x7')+_0x25e57e,_0x27f984);MailMessageEvents['on'](_0x25e57e,_0x29538d);}}; \ No newline at end of file +var _0xee53=['remove','update','emit','removeListener','register','length','mailMessage:'];(function(_0x1d73c3,_0x1248f4){var _0x3e3c91=function(_0x3db553){while(--_0x3db553){_0x1d73c3['push'](_0x1d73c3['shift']());}};_0x3e3c91(++_0x1248f4);}(_0xee53,0xa8));var _0x3ee5=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xee53[_0x1928c9];return _0x51b5fb;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=['save',_0x3ee5('0x0'),_0x3ee5('0x1')];function createListener(_0x2a66a5,_0x5d31e0){return function(_0x3217ab){_0x5d31e0[_0x3ee5('0x2')](_0x2a66a5,_0x3217ab);};}function removeListener(_0x17d29c,_0xdd9942){return function(){MailMessageEvents[_0x3ee5('0x3')](_0x17d29c,_0xdd9942);};}exports[_0x3ee5('0x4')]=function(_0x2f826b){for(var _0x1694a3=0x0,_0x6ff422=events[_0x3ee5('0x5')];_0x1694a3<_0x6ff422;_0x1694a3++){var _0x34ebf4=events[_0x1694a3];var _0x40b821=createListener(_0x3ee5('0x6')+_0x34ebf4,_0x2f826b);MailMessageEvents['on'](_0x34ebf4,_0x40b821);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index c4b5038..f625c3b 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 _0xc2e1=['addAgents','update','delete','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc2e1,0xf8));var _0x1c2e=function(_0x4d7ca6,_0x422b3f){_0x4d7ca6=_0x4d7ca6-0x0;var _0x12ad69=_0xc2e1[_0x4d7ca6];return _0x12ad69;};'use strict';var multer=require(_0x1c2e('0x0'));var util=require(_0x1c2e('0x1'));var path=require(_0x1c2e('0x2'));var timeout=require(_0x1c2e('0x3'));var express=require('express');var router=express[_0x1c2e('0x4')]();var fs_extra=require(_0x1c2e('0x5'));var auth=require(_0x1c2e('0x6'));var interaction=require(_0x1c2e('0x7'));var config=require(_0x1c2e('0x8'));var controller=require(_0x1c2e('0x9'));router[_0x1c2e('0xa')]('/',auth[_0x1c2e('0xb')](),controller['index']);router[_0x1c2e('0xa')]('/describe',auth[_0x1c2e('0xb')](),controller['describe']);router[_0x1c2e('0xa')](_0x1c2e('0xc'),auth[_0x1c2e('0xb')](),controller[_0x1c2e('0xd')]);router[_0x1c2e('0xa')](_0x1c2e('0xe'),auth[_0x1c2e('0xb')](),controller[_0x1c2e('0xf')]);router['get'](_0x1c2e('0x10'),auth[_0x1c2e('0xb')](),controller[_0x1c2e('0x11')]);router[_0x1c2e('0xa')](_0x1c2e('0x12'),auth['isAuthenticated'](),controller[_0x1c2e('0x13')]);router[_0x1c2e('0x14')]('/',auth[_0x1c2e('0xb')](),controller['create']);router['post']('/:id/teams',auth[_0x1c2e('0xb')](),controller[_0x1c2e('0x15')]);router[_0x1c2e('0x14')](_0x1c2e('0x12'),auth['isAuthenticated'](),controller[_0x1c2e('0x16')]);router['put'](_0x1c2e('0xc'),auth[_0x1c2e('0xb')](),controller[_0x1c2e('0x17')]);router[_0x1c2e('0x18')](_0x1c2e('0xc'),auth[_0x1c2e('0xb')](),controller['destroy']);router[_0x1c2e('0x18')](_0x1c2e('0x10'),auth['isAuthenticated'](),controller['removeTeams']);router['delete']('/:id/users',auth[_0x1c2e('0xb')](),controller[_0x1c2e('0x19')]);module[_0x1c2e('0x1a')]=router; \ No newline at end of file +var _0xc3af=['addTeams','/:id/users','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','getMembers','/:id/teams','post','create'];(function(_0x57cace,_0x4c4d12){var _0x2d3313=function(_0x277b31){while(--_0x277b31){_0x57cace['push'](_0x57cace['shift']());}};_0x2d3313(++_0x4c4d12);}(_0xc3af,0xc3));var _0xfc3a=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xc3af[_0x4b7895];return _0x264180;};'use strict';var multer=require(_0xfc3a('0x0'));var util=require(_0xfc3a('0x1'));var path=require(_0xfc3a('0x2'));var timeout=require(_0xfc3a('0x3'));var express=require(_0xfc3a('0x4'));var router=express[_0xfc3a('0x5')]();var fs_extra=require(_0xfc3a('0x6'));var auth=require(_0xfc3a('0x7'));var interaction=require(_0xfc3a('0x8'));var config=require(_0xfc3a('0x9'));var controller=require(_0xfc3a('0xa'));router['get']('/',auth[_0xfc3a('0xb')](),controller[_0xfc3a('0xc')]);router[_0xfc3a('0xd')](_0xfc3a('0xe'),auth['isAuthenticated'](),controller[_0xfc3a('0xf')]);router[_0xfc3a('0xd')](_0xfc3a('0x10'),auth[_0xfc3a('0xb')](),controller[_0xfc3a('0x11')]);router[_0xfc3a('0xd')]('/:id/members',auth[_0xfc3a('0xb')](),controller[_0xfc3a('0x12')]);router['get'](_0xfc3a('0x13'),auth[_0xfc3a('0xb')](),controller['getTeams']);router[_0xfc3a('0xd')]('/:id/users',auth[_0xfc3a('0xb')](),controller['getAgents']);router[_0xfc3a('0x14')]('/',auth[_0xfc3a('0xb')](),controller[_0xfc3a('0x15')]);router[_0xfc3a('0x14')](_0xfc3a('0x13'),auth['isAuthenticated'](),controller[_0xfc3a('0x16')]);router[_0xfc3a('0x14')](_0xfc3a('0x17'),auth[_0xfc3a('0xb')](),controller[_0xfc3a('0x18')]);router[_0xfc3a('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xfc3a('0x1a')]);router[_0xfc3a('0x1b')](_0xfc3a('0x10'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xfc3a('0x13'),auth[_0xfc3a('0xb')](),controller[_0xfc3a('0x1c')]);router[_0xfc3a('0x1b')](_0xfc3a('0x17'),auth[_0xfc3a('0xb')](),controller[_0xfc3a('0x1d')]);module[_0xfc3a('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 87ea279..0cb56ac 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 _0x8fac=['ENUM','rrmemory','beepall','roundrobin','sequelize','STRING','INTEGER'];(function(_0x1f2499,_0x6f3008){var _0x4f4cdd=function(_0x9c26b1){while(--_0x9c26b1){_0x1f2499['push'](_0x1f2499['shift']());}};_0x4f4cdd(++_0x6f3008);}(_0x8fac,0xf2));var _0xc8fa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8fac[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xc8fa('0x0'));module['exports']={'name':{'type':Sequelize[_0xc8fa('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc8fa('0x1')]},'timeout':{'type':Sequelize[_0xc8fa('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc8fa('0x3')](_0xc8fa('0x4'),_0xc8fa('0x5'),_0xc8fa('0x6'))}}; \ No newline at end of file +var _0xc365=['STRING','name','ENUM','beepall','roundrobin','sequelize'];(function(_0x25fdc8,_0x4f29e8){var _0x7c12af=function(_0x32612a){while(--_0x32612a){_0x25fdc8['push'](_0x25fdc8['shift']());}};_0x7c12af(++_0x4f29e8);}(_0xc365,0x95));var _0x5c36=function(_0x23b480,_0x3d4850){_0x23b480=_0x23b480-0x0;var _0x2e507f=_0xc365[_0x23b480];return _0x2e507f;};'use strict';var Sequelize=require(_0x5c36('0x0'));module['exports']={'name':{'type':Sequelize[_0x5c36('0x1')],'unique':_0x5c36('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5c36('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5c36('0x3')]('rrmemory',_0x5c36('0x4'),_0x5c36('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 6ea6a9e..b523a0e 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 _0xaf5a=['findOne','UserMailQueue','hasOwnProperty','sort','pick','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','emit','userMailQueue:save','removeTeams','ids','select','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','QueryTypes','SELECT','every','TeamId','all','isEmpty','removeAgents','forEach','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','register','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','MailQueues','UserProfileResource','sendStatus','error','stack','index','MailQueue','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe'];(function(_0x2d4a5f,_0x3e4ea4){var _0x1aaf63=function(_0x3ad778){while(--_0x3ad778){_0x2d4a5f['push'](_0x2d4a5f['shift']());}};_0x1aaf63(++_0x3e4ea4);}(_0xaf5a,0x144));var _0xaaf5=function(_0x264e1e,_0x3af804){_0x264e1e=_0x264e1e-0x0;var _0x4b1840=_0xaf5a[_0x264e1e];return _0x4b1840;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaaf5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaaf5('0x1'));var rp=require(_0xaaf5('0x2'));var moment=require(_0xaaf5('0x3'));var BPromise=require(_0xaaf5('0x4'));var Mustache=require(_0xaaf5('0x5'));var util=require(_0xaaf5('0x6'));var path=require(_0xaaf5('0x7'));var sox=require(_0xaaf5('0x8'));var csv=require('to-csv');var ejs=require(_0xaaf5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaaf5('0xa'));var squel=require(_0xaaf5('0xb'));var crypto=require(_0xaaf5('0xc'));var jsforce=require(_0xaaf5('0xd'));var deskjs=require(_0xaaf5('0xe'));var toCsv=require('to-csv');var querystring=require(_0xaaf5('0xf'));var Papa=require(_0xaaf5('0x10'));var Redis=require(_0xaaf5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xaaf5('0x12'));var as=require(_0xaaf5('0x13'));var hardwareService=require(_0xaaf5('0x14'));var logger=require(_0xaaf5('0x15'))(_0xaaf5('0x16'));var utils=require(_0xaaf5('0x17'));var config=require(_0xaaf5('0x18'));var licenseUtil=require(_0xaaf5('0x19'));var db=require(_0xaaf5('0x1a'))['db'];config[_0xaaf5('0x1b')]=_['defaults'](config[_0xaaf5('0x1b')],{'host':_0xaaf5('0x1c'),'port':0x18eb});var socket=require(_0xaaf5('0x1d'))(new Redis(config[_0xaaf5('0x1b')]));require(_0xaaf5('0x1e'))[_0xaaf5('0x1f')](socket);function respondWithStatusCode(_0x39bf16,_0x2e45ad){_0x2e45ad=_0x2e45ad||0xcc;return function(_0x47a8aa){if(_0x47a8aa){return _0x39bf16['sendStatus'](_0x2e45ad);}return _0x39bf16['status'](_0x2e45ad)[_0xaaf5('0x20')]();};}function respondWithResult(_0x3a58e6,_0x55f8f3){_0x55f8f3=_0x55f8f3||0xc8;return function(_0x3faf68){if(_0x3faf68){return _0x3a58e6[_0xaaf5('0x21')](_0x55f8f3)[_0xaaf5('0x22')](_0x3faf68);}};}function respondWithFilteredResult(_0x5bf25e,_0x56e709){return function(_0x236371){if(_0x236371){var _0x29d42a=typeof _0x56e709[_0xaaf5('0x23')]===_0xaaf5('0x24')&&typeof _0x56e709[_0xaaf5('0x25')]==='undefined';var _0x29899a=_0x236371[_0xaaf5('0x26')];var _0x459097=_0x29d42a?0x0:_0x56e709[_0xaaf5('0x23')];var _0x22b95d=_0x29d42a?_0x236371[_0xaaf5('0x26')]:_0x56e709[_0xaaf5('0x23')]+_0x56e709[_0xaaf5('0x25')];var _0x187175;if(_0x22b95d>=_0x29899a){_0x22b95d=_0x29899a;_0x187175=0xc8;}else{_0x187175=0xce;}_0x5bf25e['status'](_0x187175);return _0x5bf25e[_0xaaf5('0x27')](_0xaaf5('0x28'),_0x459097+'-'+_0x22b95d+'/'+_0x29899a)[_0xaaf5('0x22')](_0x236371);}return null;};}function patchUpdates(_0x2ac3cf){return function(_0x8c129){try{jsonpatch[_0xaaf5('0x29')](_0x8c129,_0x2ac3cf,!![]);}catch(_0x2900bf){return BPromise[_0xaaf5('0x2a')](_0x2900bf);}return _0x8c129['save']();};}function saveUpdates(_0x290d68,_0x30f383){return function(_0x1a1ff0){if(_0x1a1ff0){return _0x1a1ff0[_0xaaf5('0x2b')](_0x290d68)[_0xaaf5('0x2c')](function(_0x46dacd){return _0x46dacd;});}return null;};}function removeEntity(_0x115800,_0x433041){return function(_0x187285){if(_0x187285){return _0x187285[_0xaaf5('0x2d')]()['then'](function(){var _0x8b417e=_0x187285[_0xaaf5('0x2e')]({'plain':!![]});var _0x27b974=_0xaaf5('0x2f');return db[_0xaaf5('0x30')][_0xaaf5('0x2d')]({'where':{'type':_0x27b974,'resourceId':_0x8b417e['id']}})[_0xaaf5('0x2c')](function(){return _0x187285;});})['then'](function(){_0x115800[_0xaaf5('0x21')](0xcc)[_0xaaf5('0x20')]();});}};}function handleEntityNotFound(_0x325ab9,_0x49c7f2){return function(_0x5e9b31){if(!_0x5e9b31){_0x325ab9[_0xaaf5('0x31')](0x194);}return _0x5e9b31;};}function handleError(_0x5b8030,_0x3240b3){_0x3240b3=_0x3240b3||0x1f4;return function(_0x481eb5){logger[_0xaaf5('0x32')](_0x481eb5[_0xaaf5('0x33')]);if(_0x481eb5['name']){delete _0x481eb5['name'];}_0x5b8030['status'](_0x3240b3)['send'](_0x481eb5);};}exports[_0xaaf5('0x34')]=function(_0x13c616,_0x21fa04){var _0x1d613d={},_0x1547d1={},_0x3d948b={'count':0x0,'rows':[]};var _0x18dbf2=_['map'](db[_0xaaf5('0x35')][_0xaaf5('0x36')],function(_0x3c5bf5){return{'name':_0x3c5bf5[_0xaaf5('0x37')],'type':_0x3c5bf5['type']['key']};});_0x1547d1[_0xaaf5('0x38')]=_[_0xaaf5('0x39')](_0x18dbf2,'name');_0x1547d1[_0xaaf5('0x3a')]=_[_0xaaf5('0x3b')](_0x13c616['query']);_0x1547d1[_0xaaf5('0x3c')]=_[_0xaaf5('0x3d')](_0x1547d1[_0xaaf5('0x38')],_0x1547d1['query']);_0x1d613d[_0xaaf5('0x3e')]=_[_0xaaf5('0x3d')](_0x1547d1['model'],qs[_0xaaf5('0x3f')](_0x13c616['query'][_0xaaf5('0x3f')]));_0x1d613d[_0xaaf5('0x3e')]=_0x1d613d[_0xaaf5('0x3e')][_0xaaf5('0x40')]?_0x1d613d[_0xaaf5('0x3e')]:_0x1547d1['model'];if(!_0x13c616[_0xaaf5('0x3a')]['hasOwnProperty'](_0xaaf5('0x41'))){_0x1d613d[_0xaaf5('0x25')]=qs['limit'](_0x13c616[_0xaaf5('0x3a')][_0xaaf5('0x25')]);_0x1d613d[_0xaaf5('0x23')]=qs[_0xaaf5('0x23')](_0x13c616['query']['offset']);}_0x1d613d[_0xaaf5('0x42')]=qs['sort'](_0x13c616[_0xaaf5('0x3a')]['sort']);_0x1d613d['where']=qs['filters'](_['pick'](_0x13c616['query'],_0x1547d1[_0xaaf5('0x3c')]),_0x18dbf2);if(_0x13c616[_0xaaf5('0x3a')][_0xaaf5('0x43')]){_0x1d613d[_0xaaf5('0x44')]=_[_0xaaf5('0x45')](_0x1d613d['where'],{'$or':_[_0xaaf5('0x39')](_0x18dbf2,function(_0x329732){if(_0x329732['type']!==_0xaaf5('0x46')){var _0x565eac={};_0x565eac[_0x329732['name']]={'$like':'%'+_0x13c616[_0xaaf5('0x3a')][_0xaaf5('0x43')]+'%'};return _0x565eac;}})});}_0x1d613d=_[_0xaaf5('0x45')]({},_0x1d613d,_0x13c616[_0xaaf5('0x47')]);var _0x6f5787={'where':_0x1d613d['where']};return db['MailQueue'][_0xaaf5('0x26')](_0x6f5787)[_0xaaf5('0x2c')](function(_0x240118){_0x3d948b[_0xaaf5('0x26')]=_0x240118;if(_0x13c616[_0xaaf5('0x3a')][_0xaaf5('0x48')]){_0x1d613d[_0xaaf5('0x49')]=[{'all':!![]}];}return db['MailQueue'][_0xaaf5('0x4a')](_0x1d613d);})[_0xaaf5('0x2c')](function(_0x2a91e8){_0x3d948b[_0xaaf5('0x4b')]=_0x2a91e8;return _0x3d948b;})['then'](respondWithFilteredResult(_0x21fa04,_0x1d613d))[_0xaaf5('0x4c')](handleError(_0x21fa04,null));};exports['show']=function(_0x2ada87,_0x54aa4d){var _0x1b7b16={'raw':!![],'where':{'id':_0x2ada87['params']['id']}},_0x5f299f={};_0x5f299f['model']=_['keys'](db[_0xaaf5('0x35')][_0xaaf5('0x36')]);_0x5f299f[_0xaaf5('0x3a')]=_[_0xaaf5('0x3b')](_0x2ada87[_0xaaf5('0x3a')]);_0x5f299f[_0xaaf5('0x3c')]=_[_0xaaf5('0x3d')](_0x5f299f['model'],_0x5f299f[_0xaaf5('0x3a')]);_0x1b7b16[_0xaaf5('0x3e')]=_['intersection'](_0x5f299f[_0xaaf5('0x38')],qs[_0xaaf5('0x3f')](_0x2ada87[_0xaaf5('0x3a')][_0xaaf5('0x3f')]));_0x1b7b16[_0xaaf5('0x3e')]=_0x1b7b16[_0xaaf5('0x3e')]['length']?_0x1b7b16['attributes']:_0x5f299f[_0xaaf5('0x38')];if(_0x2ada87[_0xaaf5('0x3a')][_0xaaf5('0x48')]){_0x1b7b16['include']=[{'all':!![]}];}_0x1b7b16=_[_0xaaf5('0x45')]({},_0x1b7b16,_0x2ada87[_0xaaf5('0x47')]);return db[_0xaaf5('0x35')][_0xaaf5('0x4d')](_0x1b7b16)[_0xaaf5('0x2c')](handleEntityNotFound(_0x54aa4d,null))[_0xaaf5('0x2c')](respondWithResult(_0x54aa4d,null))[_0xaaf5('0x4c')](handleError(_0x54aa4d,null));};exports[_0xaaf5('0x4e')]=function(_0x43e897,_0x5cc642){return db['MailQueue'][_0xaaf5('0x4e')](_0x43e897[_0xaaf5('0x4f')],{})[_0xaaf5('0x2c')](function(_0x41528a){var _0x46ddfa=_0x43e897['user'][_0xaaf5('0x2e')]({'plain':!![]});if(!_0x46ddfa)throw new Error(_0xaaf5('0x50'));if(_0x46ddfa['role']===_0xaaf5('0x51')){var _0x409b29=_0x41528a[_0xaaf5('0x2e')]({'plain':!![]});var _0x4b7b23=_0xaaf5('0x2f');return db['UserProfileSection']['find']({'where':{'name':_0x4b7b23,'userProfileId':_0x46ddfa['userProfileId']},'raw':!![]})[_0xaaf5('0x2c')](function(_0x5b1318){if(_0x5b1318&&_0x5b1318[_0xaaf5('0x52')]===0x0){return db[_0xaaf5('0x30')][_0xaaf5('0x4e')]({'name':_0x409b29[_0xaaf5('0x53')],'resourceId':_0x409b29['id'],'type':_0x5b1318[_0xaaf5('0x53')],'sectionId':_0x5b1318['id']},{})['then'](function(){return _0x41528a;});}else{return _0x41528a;}})[_0xaaf5('0x4c')](function(_0x1396a3){logger[_0xaaf5('0x32')](_0xaaf5('0x54'),_0x1396a3);throw _0x1396a3;});}return _0x41528a;})['then'](respondWithResult(_0x5cc642,0xc9))[_0xaaf5('0x4c')](handleError(_0x5cc642,null));};exports[_0xaaf5('0x2b')]=function(_0x2ad64d,_0x56381c){if(_0x2ad64d['body']['id']){delete _0x2ad64d[_0xaaf5('0x4f')]['id'];}return db[_0xaaf5('0x35')][_0xaaf5('0x4d')]({'where':{'id':_0x2ad64d[_0xaaf5('0x55')]['id']}})['then'](handleEntityNotFound(_0x56381c,null))[_0xaaf5('0x2c')](saveUpdates(_0x2ad64d[_0xaaf5('0x4f')],null))['then'](respondWithResult(_0x56381c,null))[_0xaaf5('0x4c')](handleError(_0x56381c,null));};exports[_0xaaf5('0x2d')]=function(_0x1c95cf,_0x1f1fdf){return db[_0xaaf5('0x35')][_0xaaf5('0x4d')]({'where':{'id':_0x1c95cf[_0xaaf5('0x55')]['id']}})[_0xaaf5('0x2c')](handleEntityNotFound(_0x1f1fdf,null))[_0xaaf5('0x2c')](removeEntity(_0x1f1fdf,null))[_0xaaf5('0x4c')](handleError(_0x1f1fdf,null));};exports[_0xaaf5('0x56')]=function(_0x576cd1,_0x2a5283){return db[_0xaaf5('0x35')]['describe']()['then'](respondWithResult(_0x2a5283,null))[_0xaaf5('0x4c')](handleError(_0x2a5283,null));};exports['getMembers']=function(_0x2cb1b3,_0x363597,_0xff3339){var _0x310c55={'raw':!![],'where':{}},_0x11355a={},_0x11f545;return db[_0xaaf5('0x35')][_0xaaf5('0x57')]({'where':{'id':_0x2cb1b3['params']['id']}})[_0xaaf5('0x2c')](handleEntityNotFound(_0x363597,null))[_0xaaf5('0x2c')](function(_0x5f4f9f){if(_0x5f4f9f){_0x11f545=_0x5f4f9f[_0xaaf5('0x2e')]({'plain':!![]});_0x11355a[_0xaaf5('0x38')]=_['keys'](db[_0xaaf5('0x58')][_0xaaf5('0x36')]);_0x11355a[_0xaaf5('0x3a')]=_[_0xaaf5('0x3b')](_0x2cb1b3[_0xaaf5('0x3a')]);_0x11355a[_0xaaf5('0x3c')]=_[_0xaaf5('0x3d')](_0x11355a[_0xaaf5('0x38')],_0x11355a[_0xaaf5('0x3a')]);_0x310c55[_0xaaf5('0x3e')]=_[_0xaaf5('0x3d')](_0x11355a[_0xaaf5('0x38')],qs['fields'](_0x2cb1b3['query'][_0xaaf5('0x3f')]));_0x310c55[_0xaaf5('0x3e')]=_0x310c55[_0xaaf5('0x3e')][_0xaaf5('0x40')]?_0x310c55[_0xaaf5('0x3e')]:_0x11355a[_0xaaf5('0x38')];if(!_0x2cb1b3[_0xaaf5('0x3a')][_0xaaf5('0x59')]('nolimit')){_0x310c55[_0xaaf5('0x25')]=qs['limit'](_0x2cb1b3[_0xaaf5('0x3a')][_0xaaf5('0x25')]);_0x310c55[_0xaaf5('0x23')]=qs[_0xaaf5('0x23')](_0x2cb1b3[_0xaaf5('0x3a')][_0xaaf5('0x23')]);}_0x310c55[_0xaaf5('0x42')]=qs[_0xaaf5('0x5a')](_0x2cb1b3[_0xaaf5('0x3a')]['sort']);_0x310c55[_0xaaf5('0x44')]=qs[_0xaaf5('0x3c')](_[_0xaaf5('0x5b')](_0x2cb1b3[_0xaaf5('0x3a')],_0x11355a[_0xaaf5('0x3c')]));_0x310c55[_0xaaf5('0x44')]['MailQueueId']=_0x5f4f9f['id'];if(_0x2cb1b3[_0xaaf5('0x3a')][_0xaaf5('0x43')]){_0x310c55[_0xaaf5('0x44')]=_[_0xaaf5('0x45')](_0x310c55[_0xaaf5('0x44')],{'$or':_['map'](_0x310c55[_0xaaf5('0x3e')],function(_0x1694c6){var _0x120de9={};_0x120de9[_0x1694c6]={'$like':'%'+_0x2cb1b3[_0xaaf5('0x3a')][_0xaaf5('0x43')]+'%'};return _0x120de9;})});}_0x310c55=_[_0xaaf5('0x45')]({},_0x310c55,_0x2cb1b3[_0xaaf5('0x47')]);return db[_0xaaf5('0x58')][_0xaaf5('0x4a')](_0x310c55);}})[_0xaaf5('0x2c')](function(_0x29b7ea){if(_0x29b7ea){return db[_0xaaf5('0x5c')][_0xaaf5('0x5d')]({'where':{'id':_[_0xaaf5('0x39')](_0x29b7ea,_0xaaf5('0x5e')),'role':_0xaaf5('0x5f')},'attributes':['id',_0xaaf5('0x53'),_0xaaf5('0x60'),_0xaaf5('0x61'),_0xaaf5('0x62')]});}})[_0xaaf5('0x2c')](function(_0x21aa9c){if(_0x21aa9c){return{'count':_0x21aa9c[_0xaaf5('0x26')],'rows':_[_0xaaf5('0x39')](_0x21aa9c[_0xaaf5('0x4b')],function(_0x162c65){return{'membername':_0x162c65[_0xaaf5('0x53')],'UserId':_0x162c65['id'],'queue_name':_0x11f545[_0xaaf5('0x53')],'MailQueueId':_0x11f545['id'],'interface':util[_0xaaf5('0x63')](_0xaaf5('0x64'),'SIP',_0x162c65[_0xaaf5('0x53')]),'penalty':0x0,'paused':_0x162c65[_0xaaf5('0x60')],'createdAt':_0x162c65[_0xaaf5('0x62')],'updatedAt':_0x162c65[_0xaaf5('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x363597,_0x310c55))[_0xaaf5('0x4c')](handleError(_0x363597,null));};exports[_0xaaf5('0x65')]=function(_0x43ff88,_0x20dccd,_0xc0df5a){var _0x262194={};var _0x79cc01={};var _0x9f3aa7;var _0x407bf9;return db['MailQueue'][_0xaaf5('0x57')]({'where':{'id':_0x43ff88[_0xaaf5('0x55')]['id']}})[_0xaaf5('0x2c')](handleEntityNotFound(_0x20dccd,null))[_0xaaf5('0x2c')](function(_0x285ce1){if(_0x285ce1){_0x9f3aa7=_0x285ce1;_0x79cc01[_0xaaf5('0x38')]=_[_0xaaf5('0x3b')](db[_0xaaf5('0x66')][_0xaaf5('0x36')]);_0x79cc01['query']=_[_0xaaf5('0x3b')](_0x43ff88['query']);_0x79cc01[_0xaaf5('0x3c')]=_[_0xaaf5('0x3d')](_0x79cc01[_0xaaf5('0x38')],_0x79cc01[_0xaaf5('0x3a')]);_0x262194['attributes']=_['intersection'](_0x79cc01[_0xaaf5('0x38')],qs['fields'](_0x43ff88[_0xaaf5('0x3a')]['fields']));_0x262194[_0xaaf5('0x3e')]=_0x262194[_0xaaf5('0x3e')]['length']?_0x262194['attributes']:_0x79cc01[_0xaaf5('0x38')];_0x262194[_0xaaf5('0x42')]=qs[_0xaaf5('0x5a')](_0x43ff88[_0xaaf5('0x3a')][_0xaaf5('0x5a')]);_0x262194[_0xaaf5('0x44')]=qs[_0xaaf5('0x3c')](_[_0xaaf5('0x5b')](_0x43ff88['query'],_0x79cc01[_0xaaf5('0x3c')]));if(_0x43ff88[_0xaaf5('0x3a')][_0xaaf5('0x43')]){_0x262194[_0xaaf5('0x44')]=_['merge'](_0x262194[_0xaaf5('0x44')],{'$or':_['map'](_0x262194[_0xaaf5('0x3e')],function(_0x125583){var _0x5495e1={};_0x5495e1[_0x125583]={'$like':'%'+_0x43ff88[_0xaaf5('0x3a')][_0xaaf5('0x43')]+'%'};return _0x5495e1;})});}_0x262194=_['merge']({},_0x262194,_0x43ff88[_0xaaf5('0x47')]);return _0x9f3aa7[_0xaaf5('0x65')](_0x262194);}})[_0xaaf5('0x2c')](function(_0x5f0aa1){if(_0x5f0aa1){_0x407bf9=_0x5f0aa1['length'];if(!_0x43ff88['query'][_0xaaf5('0x59')](_0xaaf5('0x41'))){_0x262194[_0xaaf5('0x25')]=qs['limit'](_0x43ff88['query'][_0xaaf5('0x25')]);_0x262194[_0xaaf5('0x23')]=qs[_0xaaf5('0x23')](_0x43ff88[_0xaaf5('0x3a')]['offset']);}return _0x9f3aa7[_0xaaf5('0x65')](_0x262194);}})['then'](function(_0x3bea2e){if(_0x3bea2e){return _0x3bea2e?{'count':_0x407bf9,'rows':_0x3bea2e}:null;}})[_0xaaf5('0x2c')](respondWithResult(_0x20dccd,null))[_0xaaf5('0x4c')](handleError(_0x20dccd,null));};exports[_0xaaf5('0x67')]=function(_0x261793,_0x1748f7,_0xbc1a4){var _0x6f47c4=_0x261793[_0xaaf5('0x4f')]['ids'];return db['Team'][_0xaaf5('0x4a')]({'where':{'id':_0x6f47c4},'attributes':['id'],'include':[{'model':db[_0xaaf5('0x5c')],'as':_0xaaf5('0x68'),'attributes':['id',_0xaaf5('0x53'),_0xaaf5('0x69'),_0xaaf5('0x6a'),_0xaaf5('0x6b')],'raw':!![]}]})[_0xaaf5('0x2c')](function(_0x1eb223){if(_0x1eb223){var _0x2a3c8a=_['flatMap'](_0x1eb223,function(_0x4791e){var _0x24c5b3=_0x4791e[_0xaaf5('0x2e')]({'plain':!![]});return _0x24c5b3['Agents'];});return db[_0xaaf5('0x35')]['find']({'where':{'id':_0x261793['params']['id']}})[_0xaaf5('0x2c')](function(_0x245b17){return db[_0xaaf5('0x6c')][_0xaaf5('0x6d')](function(_0x48d78d){return _0x245b17[_0xaaf5('0x67')](_0x6f47c4,{'transaction':_0x48d78d})[_0xaaf5('0x2c')](function(){return BPromise[_0xaaf5('0x6e')](_0x2a3c8a,function(_0x29f6b1){return db[_0xaaf5('0x58')][_0xaaf5('0x6f')]({'where':{'UserId':_0x29f6b1['id'],'MailQueueId':_0x261793['params']['id']},'transaction':_0x48d78d});});})[_0xaaf5('0x2c')](function(){_0x2a3c8a['forEach'](function(_0x4b7af4){socket[_0xaaf5('0x70')](_0xaaf5('0x71'),{'UserId':_0x4b7af4['id'],'MailQueueId':_0x245b17['id']});});});});});}})[_0xaaf5('0x2c')](respondWithStatusCode(_0x1748f7,null))[_0xaaf5('0x4c')](handleError(_0x1748f7,null));};exports[_0xaaf5('0x72')]=function(_0x112b0d,_0x19f37c,_0x45850a){return db[_0xaaf5('0x66')][_0xaaf5('0x4a')]({'where':{'id':_0x112b0d[_0xaaf5('0x3a')][_0xaaf5('0x73')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xaaf5('0x68'),'attributes':['id'],'raw':!![]}]})[_0xaaf5('0x2c')](handleEntityNotFound(_0x19f37c,null))[_0xaaf5('0x2c')](function(_0x4280f2){var _0x210ebc=_['map'](_0x4280f2,'id');var _0x16e0a5=[];var _0x59d88d=[];var _0x15b016=squel[_0xaaf5('0x74')]();_0x15b016['field']('tq.TeamId')[_0xaaf5('0x75')]('team_has_mail_queues','tq')[_0xaaf5('0x76')](_0xaaf5('0x77'),'ut',_0xaaf5('0x78'))['where'](_0xaaf5('0x79'),_0x112b0d[_0xaaf5('0x55')]['id']);for(var _0x360961=0x0;_0x360961<_0x4280f2['length'];_0x360961+=0x1){let _0x1da5b8=_0x4280f2[_0x360961];for(var _0x349238=0x0;_0x349238<_0x1da5b8[_0xaaf5('0x68')][_0xaaf5('0x40')];_0x349238+=0x1){let _0x18dedf=_0x1da5b8['Agents'][_0x349238];var _0x3a6415=_0x15b016[_0xaaf5('0x7a')]();_0x3a6415[_0xaaf5('0x44')]('ut.UserId\x20=\x20?',_0x18dedf['id']);_0x59d88d['push'](db['sequelize']['query'](_0x3a6415['toString'](),{'type':db[_0xaaf5('0x6c')][_0xaaf5('0x7b')][_0xaaf5('0x7c')]})['then'](function(_0x32f3a0){if(_0x32f3a0[_0xaaf5('0x40')]===0x1){return _0x18dedf['id'];}else{var _0x77c1e0=_[_0xaaf5('0x7d')](_[_0xaaf5('0x39')](_0x32f3a0,_0xaaf5('0x7e')),function(_0x4155f3){return _['includes'](_0x210ebc,_0x4155f3);});if(_0x77c1e0){return _0x18dedf['id'];}}}));}}return BPromise[_0xaaf5('0x7f')](_0x59d88d)['then'](function(_0x445c77){_0x16e0a5=_(_0x16e0a5)['union'](_0x445c77)['compact']()['value']();return db[_0xaaf5('0x35')]['find']({'where':{'id':_0x112b0d[_0xaaf5('0x55')]['id']}})[_0xaaf5('0x2c')](function(_0x4b2158){return db[_0xaaf5('0x6c')]['transaction'](function(_0x575f77){return _0x4b2158[_0xaaf5('0x72')](_0x112b0d[_0xaaf5('0x3a')]['ids'],{'transaction':_0x575f77})[_0xaaf5('0x2c')](function(){if(!_[_0xaaf5('0x80')](_0x16e0a5)){return _0x4b2158[_0xaaf5('0x81')](_0x16e0a5,{'transaction':_0x575f77});}})[_0xaaf5('0x2c')](function(){_0x16e0a5[_0xaaf5('0x82')](function(_0x9e60b4){socket[_0xaaf5('0x70')](_0xaaf5('0x83'),{'UserId':_0x9e60b4,'MailQueueId':_0x4b2158['id']});});});});});});})['then'](respondWithStatusCode(_0x19f37c,null))[_0xaaf5('0x4c')](handleError(_0x19f37c,null));};exports['addAgents']=function(_0x1d032c,_0x1c9cc0,_0x1fd4b2){return db[_0xaaf5('0x35')]['find']({'where':{'id':_0x1d032c[_0xaaf5('0x55')]['id']}})[_0xaaf5('0x2c')](handleEntityNotFound(_0x1c9cc0,null))[_0xaaf5('0x2c')](function(_0x7fb3ef){if(_0x7fb3ef){return _0x7fb3ef[_0xaaf5('0x84')](_0x1d032c[_0xaaf5('0x4f')][_0xaaf5('0x73')],_[_0xaaf5('0x85')](_0x1d032c[_0xaaf5('0x4f')],[_0xaaf5('0x73'),'id'])||{})[_0xaaf5('0x86')](function(_0x389a4a){for(var _0x14a0e8=0x0;_0x14a0e8<_0x1d032c[_0xaaf5('0x4f')][_0xaaf5('0x73')][_0xaaf5('0x40')];_0x14a0e8+=0x1){socket[_0xaaf5('0x70')](_0xaaf5('0x71'),{'UserId':Number(_0x1d032c[_0xaaf5('0x4f')][_0xaaf5('0x73')][_0x14a0e8]),'MailQueueId':Number(_0x1d032c[_0xaaf5('0x55')]['id'])});}return _0x389a4a;});}})[_0xaaf5('0x2c')](respondWithResult(_0x1c9cc0,null))[_0xaaf5('0x4c')](handleError(_0x1c9cc0,null));};exports[_0xaaf5('0x81')]=function(_0x96c4a6,_0x49905c,_0x49bb3b){return db[_0xaaf5('0x35')][_0xaaf5('0x4d')]({'where':{'id':_0x96c4a6[_0xaaf5('0x55')]['id']}})['then'](handleEntityNotFound(_0x49905c,null))['then'](function(_0x5f05c6){if(_0x5f05c6){return _0x5f05c6[_0xaaf5('0x81')](_0x96c4a6[_0xaaf5('0x3a')][_0xaaf5('0x73')])[_0xaaf5('0x2c')](function(){if(_[_0xaaf5('0x87')](_0x96c4a6['query'][_0xaaf5('0x73')])){for(var _0x23b501=0x0;_0x23b501<_0x96c4a6[_0xaaf5('0x3a')]['ids'][_0xaaf5('0x40')];_0x23b501+=0x1){socket[_0xaaf5('0x70')](_0xaaf5('0x83'),{'UserId':Number(_0x96c4a6[_0xaaf5('0x3a')][_0xaaf5('0x73')][_0x23b501]),'MailQueueId':Number(_0x96c4a6[_0xaaf5('0x55')]['id'])});}}else{socket[_0xaaf5('0x70')]('userMailQueue:remove',{'UserId':Number(_0x96c4a6['query']['ids']),'MailQueueId':Number(_0x96c4a6['params']['id'])});}});}})[_0xaaf5('0x2c')](respondWithStatusCode(_0x49905c,null))[_0xaaf5('0x4c')](handleError(_0x49905c,null));};exports[_0xaaf5('0x88')]=function(_0xdfb3a4,_0x47b7a5,_0x51a713){var _0x2e755f={};var _0x179ba7={};var _0x5e6d46;var _0x5ea13e;return db[_0xaaf5('0x35')][_0xaaf5('0x57')]({'where':{'id':_0xdfb3a4[_0xaaf5('0x55')]['id']}})[_0xaaf5('0x2c')](handleEntityNotFound(_0x47b7a5,null))[_0xaaf5('0x2c')](function(_0x316335){if(_0x316335){_0x5e6d46=_0x316335;_0x179ba7[_0xaaf5('0x38')]=_[_0xaaf5('0x3b')](db['User'][_0xaaf5('0x36')]);_0x179ba7[_0xaaf5('0x3a')]=_[_0xaaf5('0x3b')](_0xdfb3a4[_0xaaf5('0x3a')]);_0x179ba7['filters']=_[_0xaaf5('0x3d')](_0x179ba7[_0xaaf5('0x38')],_0x179ba7['query']);_0x2e755f[_0xaaf5('0x3e')]=_[_0xaaf5('0x3d')](_0x179ba7[_0xaaf5('0x38')],qs[_0xaaf5('0x3f')](_0xdfb3a4[_0xaaf5('0x3a')][_0xaaf5('0x3f')]));_0x2e755f[_0xaaf5('0x3e')]=_0x2e755f[_0xaaf5('0x3e')][_0xaaf5('0x40')]?_0x2e755f[_0xaaf5('0x3e')]:_0x179ba7['model'];_0x2e755f[_0xaaf5('0x42')]=qs['sort'](_0xdfb3a4[_0xaaf5('0x3a')][_0xaaf5('0x5a')]);_0x2e755f[_0xaaf5('0x44')]=qs[_0xaaf5('0x3c')](_[_0xaaf5('0x5b')](_0xdfb3a4[_0xaaf5('0x3a')],_0x179ba7['filters']));if(_0xdfb3a4[_0xaaf5('0x3a')][_0xaaf5('0x43')]){_0x2e755f[_0xaaf5('0x44')]=_[_0xaaf5('0x45')](_0x2e755f[_0xaaf5('0x44')],{'$or':_[_0xaaf5('0x39')](_0x2e755f['attributes'],function(_0xda0c29){var _0x383b4b={};_0x383b4b[_0xda0c29]={'$like':'%'+_0xdfb3a4[_0xaaf5('0x3a')]['filter']+'%'};return _0x383b4b;})});}_0x2e755f=_['merge']({},_0x2e755f,_0xdfb3a4[_0xaaf5('0x47')]);return _0x5e6d46[_0xaaf5('0x88')](_0x2e755f);}})[_0xaaf5('0x2c')](function(_0x33bb10){if(_0x33bb10){_0x5ea13e=_0x33bb10['length'];if(!_0xdfb3a4[_0xaaf5('0x3a')][_0xaaf5('0x59')](_0xaaf5('0x41'))){_0x2e755f[_0xaaf5('0x25')]=qs[_0xaaf5('0x25')](_0xdfb3a4[_0xaaf5('0x3a')][_0xaaf5('0x25')]);_0x2e755f[_0xaaf5('0x23')]=qs[_0xaaf5('0x23')](_0xdfb3a4['query'][_0xaaf5('0x23')]);}return _0x5e6d46[_0xaaf5('0x88')](_0x2e755f);}})[_0xaaf5('0x2c')](function(_0x4606bd){if(_0x4606bd){return _0x4606bd?{'count':_0x5ea13e,'rows':_0x4606bd}:null;}})['then'](respondWithResult(_0x47b7a5,null))['catch'](handleError(_0x47b7a5,null));}; \ No newline at end of file +var _0x6f4a=['keys','filters','intersection','fields','attributes','length','where','pick','filter','VIRTUAL','merge','catch','show','params','options','find','create','body','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','get','UserMailQueue','hasOwnProperty','nolimit','order','sort','findAll','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','rows','format','%s/%s','getTeams','Team','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','User','field','tq.TeamId','from','join','user_has_teams','MailQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','TeamId','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./mailQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','MailQueues','UserProfileResource','end','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','key','model','query'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6f4a,0x168));var _0xa6f4=function(_0x32d290,_0x474819){_0x32d290=_0x32d290-0x0;var _0x3d4f19=_0x6f4a[_0x32d290];return _0x3d4f19;};'use strict';var emlformat=require(_0xa6f4('0x0'));var rimraf=require(_0xa6f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa6f4('0x2'));var rp=require(_0xa6f4('0x3'));var moment=require('moment');var BPromise=require(_0xa6f4('0x4'));var Mustache=require(_0xa6f4('0x5'));var util=require(_0xa6f4('0x6'));var path=require(_0xa6f4('0x7'));var sox=require(_0xa6f4('0x8'));var csv=require(_0xa6f4('0x9'));var ejs=require(_0xa6f4('0xa'));var fs=require('fs');var fs_extra=require(_0xa6f4('0xb'));var _=require('lodash');var squel=require(_0xa6f4('0xc'));var crypto=require(_0xa6f4('0xd'));var jsforce=require(_0xa6f4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa6f4('0x9'));var querystring=require('querystring');var Papa=require(_0xa6f4('0xf'));var Redis=require(_0xa6f4('0x10'));var authService=require(_0xa6f4('0x11'));var qs=require(_0xa6f4('0x12'));var as=require(_0xa6f4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa6f4('0x14'))('api');var utils=require(_0xa6f4('0x15'));var config=require(_0xa6f4('0x16'));var licenseUtil=require(_0xa6f4('0x17'));var db=require('../../mysqldb')['db'];config[_0xa6f4('0x18')]=_[_0xa6f4('0x19')](config[_0xa6f4('0x18')],{'host':_0xa6f4('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa6f4('0x1b'))[_0xa6f4('0x1c')](socket);function respondWithStatusCode(_0x478b83,_0x4ed007){_0x4ed007=_0x4ed007||0xcc;return function(_0x366706){if(_0x366706){return _0x478b83[_0xa6f4('0x1d')](_0x4ed007);}return _0x478b83[_0xa6f4('0x1e')](_0x4ed007)['end']();};}function respondWithResult(_0x1238e7,_0x4b83cd){_0x4b83cd=_0x4b83cd||0xc8;return function(_0x528db6){if(_0x528db6){return _0x1238e7[_0xa6f4('0x1e')](_0x4b83cd)[_0xa6f4('0x1f')](_0x528db6);}};}function respondWithFilteredResult(_0x524613,_0x26909f){return function(_0x2854d3){if(_0x2854d3){var _0x24e007=typeof _0x26909f[_0xa6f4('0x20')]===_0xa6f4('0x21')&&typeof _0x26909f[_0xa6f4('0x22')]===_0xa6f4('0x21');var _0x266f3c=_0x2854d3['count'];var _0x1e495a=_0x24e007?0x0:_0x26909f[_0xa6f4('0x20')];var _0x8e3fbb=_0x24e007?_0x2854d3[_0xa6f4('0x23')]:_0x26909f[_0xa6f4('0x20')]+_0x26909f[_0xa6f4('0x22')];var _0x294a08;if(_0x8e3fbb>=_0x266f3c){_0x8e3fbb=_0x266f3c;_0x294a08=0xc8;}else{_0x294a08=0xce;}_0x524613[_0xa6f4('0x1e')](_0x294a08);return _0x524613['set'](_0xa6f4('0x24'),_0x1e495a+'-'+_0x8e3fbb+'/'+_0x266f3c)[_0xa6f4('0x1f')](_0x2854d3);}return null;};}function patchUpdates(_0xcc6c1c){return function(_0x2203da){try{jsonpatch['apply'](_0x2203da,_0xcc6c1c,!![]);}catch(_0x3f1db0){return BPromise[_0xa6f4('0x25')](_0x3f1db0);}return _0x2203da[_0xa6f4('0x26')]();};}function saveUpdates(_0x4ed3a7,_0x528f15){return function(_0x1cb5a1){if(_0x1cb5a1){return _0x1cb5a1[_0xa6f4('0x27')](_0x4ed3a7)[_0xa6f4('0x28')](function(_0x48f1a9){return _0x48f1a9;});}return null;};}function removeEntity(_0x4ee11f,_0x50c4b7){return function(_0xcf914a){if(_0xcf914a){return _0xcf914a[_0xa6f4('0x29')]()[_0xa6f4('0x28')](function(){var _0x2af1f4=_0xcf914a['get']({'plain':!![]});var _0x87dda6=_0xa6f4('0x2a');return db[_0xa6f4('0x2b')][_0xa6f4('0x29')]({'where':{'type':_0x87dda6,'resourceId':_0x2af1f4['id']}})[_0xa6f4('0x28')](function(){return _0xcf914a;});})['then'](function(){_0x4ee11f[_0xa6f4('0x1e')](0xcc)[_0xa6f4('0x2c')]();});}};}function handleEntityNotFound(_0x243d6d,_0x3da03d){return function(_0x14b562){if(!_0x14b562){_0x243d6d[_0xa6f4('0x1d')](0x194);}return _0x14b562;};}function handleError(_0xfba0df,_0x415ea6){_0x415ea6=_0x415ea6||0x1f4;return function(_0x3c1152){logger[_0xa6f4('0x2d')](_0x3c1152[_0xa6f4('0x2e')]);if(_0x3c1152[_0xa6f4('0x2f')]){delete _0x3c1152[_0xa6f4('0x2f')];}_0xfba0df[_0xa6f4('0x1e')](_0x415ea6)[_0xa6f4('0x30')](_0x3c1152);};}exports[_0xa6f4('0x31')]=function(_0x169297,_0x289725){var _0x341b5e={},_0x2f5507={},_0x329740={'count':0x0,'rows':[]};var _0x249b0a=_[_0xa6f4('0x32')](db[_0xa6f4('0x33')][_0xa6f4('0x34')],function(_0xf50eba){return{'name':_0xf50eba[_0xa6f4('0x35')],'type':_0xf50eba['type'][_0xa6f4('0x36')]};});_0x2f5507[_0xa6f4('0x37')]=_[_0xa6f4('0x32')](_0x249b0a,_0xa6f4('0x2f'));_0x2f5507[_0xa6f4('0x38')]=_[_0xa6f4('0x39')](_0x169297[_0xa6f4('0x38')]);_0x2f5507[_0xa6f4('0x3a')]=_[_0xa6f4('0x3b')](_0x2f5507['model'],_0x2f5507[_0xa6f4('0x38')]);_0x341b5e['attributes']=_[_0xa6f4('0x3b')](_0x2f5507[_0xa6f4('0x37')],qs[_0xa6f4('0x3c')](_0x169297[_0xa6f4('0x38')][_0xa6f4('0x3c')]));_0x341b5e[_0xa6f4('0x3d')]=_0x341b5e[_0xa6f4('0x3d')][_0xa6f4('0x3e')]?_0x341b5e[_0xa6f4('0x3d')]:_0x2f5507['model'];if(!_0x169297[_0xa6f4('0x38')]['hasOwnProperty']('nolimit')){_0x341b5e[_0xa6f4('0x22')]=qs[_0xa6f4('0x22')](_0x169297[_0xa6f4('0x38')][_0xa6f4('0x22')]);_0x341b5e[_0xa6f4('0x20')]=qs[_0xa6f4('0x20')](_0x169297['query'][_0xa6f4('0x20')]);}_0x341b5e['order']=qs['sort'](_0x169297[_0xa6f4('0x38')]['sort']);_0x341b5e[_0xa6f4('0x3f')]=qs[_0xa6f4('0x3a')](_[_0xa6f4('0x40')](_0x169297[_0xa6f4('0x38')],_0x2f5507[_0xa6f4('0x3a')]),_0x249b0a);if(_0x169297['query'][_0xa6f4('0x41')]){_0x341b5e[_0xa6f4('0x3f')]=_['merge'](_0x341b5e[_0xa6f4('0x3f')],{'$or':_[_0xa6f4('0x32')](_0x249b0a,function(_0x5ad1b0){if(_0x5ad1b0['type']!==_0xa6f4('0x42')){var _0x2b4d1f={};_0x2b4d1f[_0x5ad1b0['name']]={'$like':'%'+_0x169297[_0xa6f4('0x38')][_0xa6f4('0x41')]+'%'};return _0x2b4d1f;}})});}_0x341b5e=_[_0xa6f4('0x43')]({},_0x341b5e,_0x169297['options']);var _0x4288af={'where':_0x341b5e[_0xa6f4('0x3f')]};return db[_0xa6f4('0x33')]['count'](_0x4288af)[_0xa6f4('0x28')](function(_0x289ce4){_0x329740[_0xa6f4('0x23')]=_0x289ce4;if(_0x169297['query']['includeAll']){_0x341b5e['include']=[{'all':!![]}];}return db['MailQueue']['findAll'](_0x341b5e);})[_0xa6f4('0x28')](function(_0x2cc35d){_0x329740['rows']=_0x2cc35d;return _0x329740;})[_0xa6f4('0x28')](respondWithFilteredResult(_0x289725,_0x341b5e))[_0xa6f4('0x44')](handleError(_0x289725,null));};exports[_0xa6f4('0x45')]=function(_0xd695e0,_0x2ea003){var _0x1caff7={'raw':!![],'where':{'id':_0xd695e0[_0xa6f4('0x46')]['id']}},_0x12f424={};_0x12f424[_0xa6f4('0x37')]=_['keys'](db[_0xa6f4('0x33')][_0xa6f4('0x34')]);_0x12f424[_0xa6f4('0x38')]=_[_0xa6f4('0x39')](_0xd695e0[_0xa6f4('0x38')]);_0x12f424[_0xa6f4('0x3a')]=_[_0xa6f4('0x3b')](_0x12f424[_0xa6f4('0x37')],_0x12f424[_0xa6f4('0x38')]);_0x1caff7['attributes']=_['intersection'](_0x12f424[_0xa6f4('0x37')],qs[_0xa6f4('0x3c')](_0xd695e0[_0xa6f4('0x38')]['fields']));_0x1caff7['attributes']=_0x1caff7['attributes'][_0xa6f4('0x3e')]?_0x1caff7[_0xa6f4('0x3d')]:_0x12f424[_0xa6f4('0x37')];if(_0xd695e0[_0xa6f4('0x38')]['includeAll']){_0x1caff7['include']=[{'all':!![]}];}_0x1caff7=_[_0xa6f4('0x43')]({},_0x1caff7,_0xd695e0[_0xa6f4('0x47')]);return db[_0xa6f4('0x33')][_0xa6f4('0x48')](_0x1caff7)['then'](handleEntityNotFound(_0x2ea003,null))[_0xa6f4('0x28')](respondWithResult(_0x2ea003,null))[_0xa6f4('0x44')](handleError(_0x2ea003,null));};exports['create']=function(_0x10bf7d,_0x419adc){return db[_0xa6f4('0x33')][_0xa6f4('0x49')](_0x10bf7d[_0xa6f4('0x4a')],{})['then'](function(_0x4c79fb){var _0x2b8832=_0x10bf7d[_0xa6f4('0x4b')]['get']({'plain':!![]});if(!_0x2b8832)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b8832['role']==='user'){var _0x51aad9=_0x4c79fb['get']({'plain':!![]});var _0xf32d2f='MailQueues';return db['UserProfileSection']['find']({'where':{'name':_0xf32d2f,'userProfileId':_0x2b8832['userProfileId']},'raw':!![]})[_0xa6f4('0x28')](function(_0x3c4fca){if(_0x3c4fca&&_0x3c4fca[_0xa6f4('0x4c')]===0x0){return db[_0xa6f4('0x2b')][_0xa6f4('0x49')]({'name':_0x51aad9[_0xa6f4('0x2f')],'resourceId':_0x51aad9['id'],'type':_0x3c4fca['name'],'sectionId':_0x3c4fca['id']},{})[_0xa6f4('0x28')](function(){return _0x4c79fb;});}else{return _0x4c79fb;}})[_0xa6f4('0x44')](function(_0x26928f){logger['error'](_0xa6f4('0x4d'),_0x26928f);throw _0x26928f;});}return _0x4c79fb;})[_0xa6f4('0x28')](respondWithResult(_0x419adc,0xc9))[_0xa6f4('0x44')](handleError(_0x419adc,null));};exports[_0xa6f4('0x27')]=function(_0x48d0af,_0x4b6e37){if(_0x48d0af[_0xa6f4('0x4a')]['id']){delete _0x48d0af[_0xa6f4('0x4a')]['id'];}return db[_0xa6f4('0x33')][_0xa6f4('0x48')]({'where':{'id':_0x48d0af['params']['id']}})[_0xa6f4('0x28')](handleEntityNotFound(_0x4b6e37,null))['then'](saveUpdates(_0x48d0af[_0xa6f4('0x4a')],null))[_0xa6f4('0x28')](respondWithResult(_0x4b6e37,null))[_0xa6f4('0x44')](handleError(_0x4b6e37,null));};exports['destroy']=function(_0x1e5603,_0x1a6036){return db[_0xa6f4('0x33')]['find']({'where':{'id':_0x1e5603['params']['id']}})['then'](handleEntityNotFound(_0x1a6036,null))[_0xa6f4('0x28')](removeEntity(_0x1a6036,null))[_0xa6f4('0x44')](handleError(_0x1a6036,null));};exports[_0xa6f4('0x4e')]=function(_0x970918,_0x11d227){return db['MailQueue'][_0xa6f4('0x4e')]()[_0xa6f4('0x28')](respondWithResult(_0x11d227,null))[_0xa6f4('0x44')](handleError(_0x11d227,null));};exports[_0xa6f4('0x4f')]=function(_0x1ef350,_0x42423a,_0x50e042){var _0x5377e1={'raw':!![],'where':{}},_0x5d5382={},_0x590f71;return db['MailQueue'][_0xa6f4('0x50')]({'where':{'id':_0x1ef350['params']['id']}})['then'](handleEntityNotFound(_0x42423a,null))[_0xa6f4('0x28')](function(_0x84ec45){if(_0x84ec45){_0x590f71=_0x84ec45[_0xa6f4('0x51')]({'plain':!![]});_0x5d5382[_0xa6f4('0x37')]=_[_0xa6f4('0x39')](db[_0xa6f4('0x52')][_0xa6f4('0x34')]);_0x5d5382[_0xa6f4('0x38')]=_[_0xa6f4('0x39')](_0x1ef350[_0xa6f4('0x38')]);_0x5d5382['filters']=_[_0xa6f4('0x3b')](_0x5d5382[_0xa6f4('0x37')],_0x5d5382[_0xa6f4('0x38')]);_0x5377e1['attributes']=_[_0xa6f4('0x3b')](_0x5d5382[_0xa6f4('0x37')],qs[_0xa6f4('0x3c')](_0x1ef350[_0xa6f4('0x38')][_0xa6f4('0x3c')]));_0x5377e1[_0xa6f4('0x3d')]=_0x5377e1[_0xa6f4('0x3d')]['length']?_0x5377e1[_0xa6f4('0x3d')]:_0x5d5382[_0xa6f4('0x37')];if(!_0x1ef350[_0xa6f4('0x38')][_0xa6f4('0x53')](_0xa6f4('0x54'))){_0x5377e1[_0xa6f4('0x22')]=qs['limit'](_0x1ef350['query'][_0xa6f4('0x22')]);_0x5377e1[_0xa6f4('0x20')]=qs[_0xa6f4('0x20')](_0x1ef350['query'][_0xa6f4('0x20')]);}_0x5377e1[_0xa6f4('0x55')]=qs[_0xa6f4('0x56')](_0x1ef350[_0xa6f4('0x38')]['sort']);_0x5377e1[_0xa6f4('0x3f')]=qs[_0xa6f4('0x3a')](_['pick'](_0x1ef350['query'],_0x5d5382[_0xa6f4('0x3a')]));_0x5377e1[_0xa6f4('0x3f')]['MailQueueId']=_0x84ec45['id'];if(_0x1ef350['query'][_0xa6f4('0x41')]){_0x5377e1['where']=_[_0xa6f4('0x43')](_0x5377e1[_0xa6f4('0x3f')],{'$or':_[_0xa6f4('0x32')](_0x5377e1[_0xa6f4('0x3d')],function(_0x50d065){var _0x548746={};_0x548746[_0x50d065]={'$like':'%'+_0x1ef350['query'][_0xa6f4('0x41')]+'%'};return _0x548746;})});}_0x5377e1=_[_0xa6f4('0x43')]({},_0x5377e1,_0x1ef350[_0xa6f4('0x47')]);return db[_0xa6f4('0x52')][_0xa6f4('0x57')](_0x5377e1);}})[_0xa6f4('0x28')](function(_0xd859e8){if(_0xd859e8){return db['User'][_0xa6f4('0x58')]({'where':{'id':_[_0xa6f4('0x32')](_0xd859e8,_0xa6f4('0x59')),'role':_0xa6f4('0x5a')},'attributes':['id','name',_0xa6f4('0x5b'),_0xa6f4('0x5c'),_0xa6f4('0x5d')]});}})[_0xa6f4('0x28')](function(_0x453e56){if(_0x453e56){return{'count':_0x453e56[_0xa6f4('0x23')],'rows':_[_0xa6f4('0x32')](_0x453e56[_0xa6f4('0x5e')],function(_0x519464){return{'membername':_0x519464[_0xa6f4('0x2f')],'UserId':_0x519464['id'],'queue_name':_0x590f71[_0xa6f4('0x2f')],'MailQueueId':_0x590f71['id'],'interface':util[_0xa6f4('0x5f')](_0xa6f4('0x60'),'SIP',_0x519464['name']),'penalty':0x0,'paused':_0x519464['mailPause'],'createdAt':_0x519464[_0xa6f4('0x5d')],'updatedAt':_0x519464['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xa6f4('0x28')](respondWithFilteredResult(_0x42423a,_0x5377e1))[_0xa6f4('0x44')](handleError(_0x42423a,null));};exports[_0xa6f4('0x61')]=function(_0x376839,_0x13631b,_0xb4c8f4){var _0x572ff6={};var _0x7a1e41={};var _0x12c796;var _0x1c82ec;return db[_0xa6f4('0x33')][_0xa6f4('0x50')]({'where':{'id':_0x376839['params']['id']}})['then'](handleEntityNotFound(_0x13631b,null))[_0xa6f4('0x28')](function(_0x22d511){if(_0x22d511){_0x12c796=_0x22d511;_0x7a1e41[_0xa6f4('0x37')]=_[_0xa6f4('0x39')](db[_0xa6f4('0x62')][_0xa6f4('0x34')]);_0x7a1e41[_0xa6f4('0x38')]=_[_0xa6f4('0x39')](_0x376839[_0xa6f4('0x38')]);_0x7a1e41['filters']=_[_0xa6f4('0x3b')](_0x7a1e41[_0xa6f4('0x37')],_0x7a1e41[_0xa6f4('0x38')]);_0x572ff6[_0xa6f4('0x3d')]=_['intersection'](_0x7a1e41[_0xa6f4('0x37')],qs[_0xa6f4('0x3c')](_0x376839[_0xa6f4('0x38')][_0xa6f4('0x3c')]));_0x572ff6[_0xa6f4('0x3d')]=_0x572ff6[_0xa6f4('0x3d')][_0xa6f4('0x3e')]?_0x572ff6[_0xa6f4('0x3d')]:_0x7a1e41[_0xa6f4('0x37')];_0x572ff6[_0xa6f4('0x55')]=qs[_0xa6f4('0x56')](_0x376839[_0xa6f4('0x38')][_0xa6f4('0x56')]);_0x572ff6[_0xa6f4('0x3f')]=qs['filters'](_[_0xa6f4('0x40')](_0x376839[_0xa6f4('0x38')],_0x7a1e41['filters']));if(_0x376839['query']['filter']){_0x572ff6[_0xa6f4('0x3f')]=_[_0xa6f4('0x43')](_0x572ff6[_0xa6f4('0x3f')],{'$or':_['map'](_0x572ff6['attributes'],function(_0x3a682e){var _0x3e0688={};_0x3e0688[_0x3a682e]={'$like':'%'+_0x376839['query'][_0xa6f4('0x41')]+'%'};return _0x3e0688;})});}_0x572ff6=_[_0xa6f4('0x43')]({},_0x572ff6,_0x376839[_0xa6f4('0x47')]);return _0x12c796['getTeams'](_0x572ff6);}})['then'](function(_0x59fbb7){if(_0x59fbb7){_0x1c82ec=_0x59fbb7[_0xa6f4('0x3e')];if(!_0x376839[_0xa6f4('0x38')][_0xa6f4('0x53')](_0xa6f4('0x54'))){_0x572ff6[_0xa6f4('0x22')]=qs[_0xa6f4('0x22')](_0x376839[_0xa6f4('0x38')][_0xa6f4('0x22')]);_0x572ff6['offset']=qs[_0xa6f4('0x20')](_0x376839['query'][_0xa6f4('0x20')]);}return _0x12c796[_0xa6f4('0x61')](_0x572ff6);}})[_0xa6f4('0x28')](function(_0x330f4c){if(_0x330f4c){return _0x330f4c?{'count':_0x1c82ec,'rows':_0x330f4c}:null;}})[_0xa6f4('0x28')](respondWithResult(_0x13631b,null))['catch'](handleError(_0x13631b,null));};exports['addTeams']=function(_0x3952d4,_0x3b210e,_0xcf3167){var _0x27babf=_0x3952d4[_0xa6f4('0x4a')][_0xa6f4('0x63')];return db[_0xa6f4('0x62')][_0xa6f4('0x57')]({'where':{'id':_0x27babf},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xa6f4('0x2f'),_0xa6f4('0x64'),_0xa6f4('0x65'),_0xa6f4('0x66')],'raw':!![]}]})['then'](function(_0x363149){if(_0x363149){var _0x4864ea=_[_0xa6f4('0x67')](_0x363149,function(_0x4e7ec9){var _0x269f70=_0x4e7ec9[_0xa6f4('0x51')]({'plain':!![]});return _0x269f70[_0xa6f4('0x68')];});return db[_0xa6f4('0x33')][_0xa6f4('0x48')]({'where':{'id':_0x3952d4[_0xa6f4('0x46')]['id']}})[_0xa6f4('0x28')](function(_0xdb04c5){return db[_0xa6f4('0x69')][_0xa6f4('0x6a')](function(_0x246eaf){return _0xdb04c5[_0xa6f4('0x6b')](_0x27babf,{'transaction':_0x246eaf})[_0xa6f4('0x28')](function(){return BPromise[_0xa6f4('0x6c')](_0x4864ea,function(_0x75c8ba){return db[_0xa6f4('0x52')][_0xa6f4('0x6d')]({'where':{'UserId':_0x75c8ba['id'],'MailQueueId':_0x3952d4[_0xa6f4('0x46')]['id']},'transaction':_0x246eaf});});})[_0xa6f4('0x28')](function(){_0x4864ea[_0xa6f4('0x6e')](function(_0x425573){socket[_0xa6f4('0x6f')](_0xa6f4('0x70'),{'UserId':_0x425573['id'],'MailQueueId':_0xdb04c5['id']});});});});});}})['then'](respondWithStatusCode(_0x3b210e,null))[_0xa6f4('0x44')](handleError(_0x3b210e,null));};exports[_0xa6f4('0x71')]=function(_0xc400b7,_0x292804,_0x54902e){return db['Team'][_0xa6f4('0x57')]({'where':{'id':_0xc400b7[_0xa6f4('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0xa6f4('0x72')],'as':_0xa6f4('0x68'),'attributes':['id'],'raw':!![]}]})[_0xa6f4('0x28')](handleEntityNotFound(_0x292804,null))['then'](function(_0x8a074b){var _0x3eeafa=_[_0xa6f4('0x32')](_0x8a074b,'id');var _0x35d737=[];var _0x4c38f8=[];var _0x212f9c=squel['select']();_0x212f9c[_0xa6f4('0x73')](_0xa6f4('0x74'))[_0xa6f4('0x75')]('team_has_mail_queues','tq')[_0xa6f4('0x76')](_0xa6f4('0x77'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa6f4('0x3f')](_0xa6f4('0x78'),_0xc400b7[_0xa6f4('0x46')]['id']);for(var _0x7d3e3e=0x0;_0x7d3e3e<_0x8a074b[_0xa6f4('0x3e')];_0x7d3e3e+=0x1){let _0x2177bf=_0x8a074b[_0x7d3e3e];for(var _0x280023=0x0;_0x280023<_0x2177bf[_0xa6f4('0x68')]['length'];_0x280023+=0x1){let _0xe54c43=_0x2177bf[_0xa6f4('0x68')][_0x280023];var _0x40530e=_0x212f9c[_0xa6f4('0x79')]();_0x40530e['where']('ut.UserId\x20=\x20?',_0xe54c43['id']);_0x4c38f8[_0xa6f4('0x7a')](db[_0xa6f4('0x69')][_0xa6f4('0x38')](_0x40530e[_0xa6f4('0x7b')](),{'type':db[_0xa6f4('0x69')][_0xa6f4('0x7c')][_0xa6f4('0x7d')]})[_0xa6f4('0x28')](function(_0x36c46b){if(_0x36c46b[_0xa6f4('0x3e')]===0x1){return _0xe54c43['id'];}else{var _0x1577f4=_['every'](_[_0xa6f4('0x32')](_0x36c46b,_0xa6f4('0x7e')),function(_0x3ce018){return _['includes'](_0x3eeafa,_0x3ce018);});if(_0x1577f4){return _0xe54c43['id'];}}}));}}return BPromise[_0xa6f4('0x7f')](_0x4c38f8)[_0xa6f4('0x28')](function(_0x234eb9){_0x35d737=_(_0x35d737)[_0xa6f4('0x80')](_0x234eb9)[_0xa6f4('0x81')]()[_0xa6f4('0x82')]();return db[_0xa6f4('0x33')]['find']({'where':{'id':_0xc400b7[_0xa6f4('0x46')]['id']}})[_0xa6f4('0x28')](function(_0x2ee928){return db['sequelize'][_0xa6f4('0x6a')](function(_0x40003d){return _0x2ee928[_0xa6f4('0x71')](_0xc400b7[_0xa6f4('0x38')]['ids'],{'transaction':_0x40003d})[_0xa6f4('0x28')](function(){if(!_[_0xa6f4('0x83')](_0x35d737)){return _0x2ee928[_0xa6f4('0x84')](_0x35d737,{'transaction':_0x40003d});}})['then'](function(){_0x35d737[_0xa6f4('0x6e')](function(_0x4020b1){socket[_0xa6f4('0x6f')](_0xa6f4('0x85'),{'UserId':_0x4020b1,'MailQueueId':_0x2ee928['id']});});});});});});})[_0xa6f4('0x28')](respondWithStatusCode(_0x292804,null))[_0xa6f4('0x44')](handleError(_0x292804,null));};exports['addAgents']=function(_0x5ce8e4,_0x518ab8,_0xe9b4e1){return db[_0xa6f4('0x33')][_0xa6f4('0x48')]({'where':{'id':_0x5ce8e4[_0xa6f4('0x46')]['id']}})[_0xa6f4('0x28')](handleEntityNotFound(_0x518ab8,null))[_0xa6f4('0x28')](function(_0x4526e9){if(_0x4526e9){return _0x4526e9[_0xa6f4('0x86')](_0x5ce8e4[_0xa6f4('0x4a')][_0xa6f4('0x63')],_[_0xa6f4('0x87')](_0x5ce8e4['body'],['ids','id'])||{})[_0xa6f4('0x88')](function(_0x11fe32){for(var _0x27c852=0x0;_0x27c852<_0x5ce8e4[_0xa6f4('0x4a')][_0xa6f4('0x63')]['length'];_0x27c852+=0x1){socket['emit']('userMailQueue:save',{'UserId':Number(_0x5ce8e4[_0xa6f4('0x4a')][_0xa6f4('0x63')][_0x27c852]),'MailQueueId':Number(_0x5ce8e4['params']['id'])});}return _0x11fe32;});}})[_0xa6f4('0x28')](respondWithResult(_0x518ab8,null))[_0xa6f4('0x44')](handleError(_0x518ab8,null));};exports[_0xa6f4('0x84')]=function(_0x2ec97e,_0x16aaee,_0x304140){return db[_0xa6f4('0x33')][_0xa6f4('0x48')]({'where':{'id':_0x2ec97e[_0xa6f4('0x46')]['id']}})[_0xa6f4('0x28')](handleEntityNotFound(_0x16aaee,null))[_0xa6f4('0x28')](function(_0x563d91){if(_0x563d91){return _0x563d91['removeAgents'](_0x2ec97e[_0xa6f4('0x38')][_0xa6f4('0x63')])[_0xa6f4('0x28')](function(){if(_[_0xa6f4('0x89')](_0x2ec97e[_0xa6f4('0x38')][_0xa6f4('0x63')])){for(var _0x131a8f=0x0;_0x131a8f<_0x2ec97e[_0xa6f4('0x38')]['ids'][_0xa6f4('0x3e')];_0x131a8f+=0x1){socket[_0xa6f4('0x6f')](_0xa6f4('0x85'),{'UserId':Number(_0x2ec97e[_0xa6f4('0x38')][_0xa6f4('0x63')][_0x131a8f]),'MailQueueId':Number(_0x2ec97e[_0xa6f4('0x46')]['id'])});}}else{socket['emit'](_0xa6f4('0x85'),{'UserId':Number(_0x2ec97e['query'][_0xa6f4('0x63')]),'MailQueueId':Number(_0x2ec97e['params']['id'])});}});}})[_0xa6f4('0x28')](respondWithStatusCode(_0x16aaee,null))[_0xa6f4('0x44')](handleError(_0x16aaee,null));};exports['getAgents']=function(_0x354ad4,_0x405319,_0x48a76c){var _0xaf6bc5={};var _0x3ce4df={};var _0x97fdcb;var _0x59f228;return db[_0xa6f4('0x33')]['findOne']({'where':{'id':_0x354ad4['params']['id']}})[_0xa6f4('0x28')](handleEntityNotFound(_0x405319,null))['then'](function(_0x6689e7){if(_0x6689e7){_0x97fdcb=_0x6689e7;_0x3ce4df[_0xa6f4('0x37')]=_['keys'](db[_0xa6f4('0x72')][_0xa6f4('0x34')]);_0x3ce4df[_0xa6f4('0x38')]=_['keys'](_0x354ad4[_0xa6f4('0x38')]);_0x3ce4df['filters']=_['intersection'](_0x3ce4df[_0xa6f4('0x37')],_0x3ce4df[_0xa6f4('0x38')]);_0xaf6bc5[_0xa6f4('0x3d')]=_['intersection'](_0x3ce4df['model'],qs[_0xa6f4('0x3c')](_0x354ad4[_0xa6f4('0x38')][_0xa6f4('0x3c')]));_0xaf6bc5['attributes']=_0xaf6bc5[_0xa6f4('0x3d')][_0xa6f4('0x3e')]?_0xaf6bc5[_0xa6f4('0x3d')]:_0x3ce4df['model'];_0xaf6bc5[_0xa6f4('0x55')]=qs[_0xa6f4('0x56')](_0x354ad4[_0xa6f4('0x38')][_0xa6f4('0x56')]);_0xaf6bc5[_0xa6f4('0x3f')]=qs[_0xa6f4('0x3a')](_[_0xa6f4('0x40')](_0x354ad4[_0xa6f4('0x38')],_0x3ce4df[_0xa6f4('0x3a')]));if(_0x354ad4['query']['filter']){_0xaf6bc5[_0xa6f4('0x3f')]=_[_0xa6f4('0x43')](_0xaf6bc5[_0xa6f4('0x3f')],{'$or':_['map'](_0xaf6bc5['attributes'],function(_0x552d9c){var _0x6fc704={};_0x6fc704[_0x552d9c]={'$like':'%'+_0x354ad4[_0xa6f4('0x38')][_0xa6f4('0x41')]+'%'};return _0x6fc704;})});}_0xaf6bc5=_[_0xa6f4('0x43')]({},_0xaf6bc5,_0x354ad4[_0xa6f4('0x47')]);return _0x97fdcb[_0xa6f4('0x8a')](_0xaf6bc5);}})[_0xa6f4('0x28')](function(_0x33761f){if(_0x33761f){_0x59f228=_0x33761f[_0xa6f4('0x3e')];if(!_0x354ad4[_0xa6f4('0x38')][_0xa6f4('0x53')](_0xa6f4('0x54'))){_0xaf6bc5[_0xa6f4('0x22')]=qs[_0xa6f4('0x22')](_0x354ad4['query']['limit']);_0xaf6bc5[_0xa6f4('0x20')]=qs[_0xa6f4('0x20')](_0x354ad4[_0xa6f4('0x38')][_0xa6f4('0x20')]);}return _0x97fdcb[_0xa6f4('0x8a')](_0xaf6bc5);}})[_0xa6f4('0x28')](function(_0x4160ea){if(_0x4160ea){return _0x4160ea?{'count':_0x59f228,'rows':_0x4160ea}:null;}})['then'](respondWithResult(_0x405319,null))[_0xa6f4('0x44')](handleError(_0x405319,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index b4bc418..889eaf0 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 _0x2e0a=['../../mysqldb','MailQueue','save','remove','emit','hasOwnProperty','events'];(function(_0x40a22f,_0xb3bba9){var _0x3f95c9=function(_0x13766d){while(--_0x13766d){_0x40a22f['push'](_0x40a22f['shift']());}};_0x3f95c9(++_0xb3bba9);}(_0x2e0a,0xae));var _0xa2e0=function(_0x41829f,_0x30fe1b){_0x41829f=_0x41829f-0x0;var _0x69562f=_0x2e0a[_0x41829f];return _0x69562f;};'use strict';var EventEmitter=require(_0xa2e0('0x0'));var MailQueue=require(_0xa2e0('0x1'))['db'][_0xa2e0('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa2e0('0x3'),'afterUpdate':'update','afterDestroy':_0xa2e0('0x4')};function emitEvent(_0xbaa47){return function(_0x38ae52,_0x5ba2a7,_0x20c70a){MailQueueEvents[_0xa2e0('0x5')](_0xbaa47+':'+_0x38ae52['id'],_0x38ae52);MailQueueEvents[_0xa2e0('0x5')](_0xbaa47,_0x38ae52);_0x20c70a(null);};}for(var e in events){if(events[_0xa2e0('0x6')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x0fed=['exports','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2dcf72,_0x5f1abe){var _0x523435=function(_0x1f8bc6){while(--_0x1f8bc6){_0x2dcf72['push'](_0x2dcf72['shift']());}};_0x523435(++_0x5f1abe);}(_0x0fed,0x6d));var _0xd0fe=function(_0x42a0f6,_0x4ee755){_0x42a0f6=_0x42a0f6-0x0;var _0x259bdb=_0x0fed[_0x42a0f6];return _0x259bdb;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xd0fe('0x0'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xd0fe('0x1')](0x0);var events={'afterCreate':_0xd0fe('0x2'),'afterUpdate':_0xd0fe('0x3'),'afterDestroy':_0xd0fe('0x4')};function emitEvent(_0x18cad5){return function(_0x21d349,_0xfe69e0,_0x31b30f){MailQueueEvents[_0xd0fe('0x5')](_0x18cad5+':'+_0x21d349['id'],_0x21d349);MailQueueEvents['emit'](_0x18cad5,_0x21d349);_0x31b30f(null);};}for(var e in events){if(events[_0xd0fe('0x6')](e)){var event=events[e];MailQueue[_0xd0fe('0x7')](e,emitEvent(event));}}module[_0xd0fe('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 7bca724..a2f383d 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 _0x4a7b=['mail_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','MailQueue'];(function(_0xc7bc9a,_0x11cf88){var _0x28212a=function(_0x4406cd){while(--_0x4406cd){_0xc7bc9a['push'](_0xc7bc9a['shift']());}};_0x28212a(++_0x11cf88);}(_0x4a7b,0x1a3));var _0xb4a7=function(_0x72cad0,_0x1ee994){_0x72cad0=_0x72cad0-0x0;var _0xd5c9e2=_0x4a7b[_0x72cad0];return _0xd5c9e2;};'use strict';var _=require(_0xb4a7('0x0'));var util=require(_0xb4a7('0x1'));var logger=require('../../config/logger')(_0xb4a7('0x2'));var moment=require(_0xb4a7('0x3'));var BPromise=require(_0xb4a7('0x4'));var rp=require(_0xb4a7('0x5'));var fs=require('fs');var path=require(_0xb4a7('0x6'));var rimraf=require(_0xb4a7('0x7'));var config=require(_0xb4a7('0x8'));var attributes=require('./mailQueue.attributes');module['exports']=function(_0x53ff54,_0xd2cb71){return _0x53ff54['define'](_0xb4a7('0x9'),attributes,{'tableName':_0xb4a7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7be9=['request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','../../config/logger','api','moment','bluebird'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x7be9,0x64));var _0x97be=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x7be9[_0x556927];return _0x5f1235;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x97be('0x0'))(_0x97be('0x1'));var moment=require(_0x97be('0x2'));var BPromise=require(_0x97be('0x3'));var rp=require(_0x97be('0x4'));var fs=require('fs');var path=require(_0x97be('0x5'));var rimraf=require(_0x97be('0x6'));var config=require(_0x97be('0x7'));var attributes=require(_0x97be('0x8'));module[_0x97be('0x9')]=function(_0x319c81,_0x296d19){return _0x319c81[_0x97be('0xa')](_0x97be('0xb'),attributes,{'tableName':_0x97be('0xc'),'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 d9b9308..f739f48 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 _0x9f9f=['message','result','catch','MailQueue','findAll','options','where','attributes','limit','include','map','model','GetMailQueue','raw','ShowMailQueue','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5ea82f,_0x41ef96){var _0x2f38b6=function(_0x5b084e){while(--_0x5b084e){_0x5ea82f['push'](_0x5ea82f['shift']());}};_0x2f38b6(++_0x41ef96);}(_0x9f9f,0x100));var _0xf9f9=function(_0x533e8b,_0x169ad4){_0x533e8b=_0x533e8b-0x0;var _0x27e443=_0x9f9f[_0x533e8b];return _0x27e443;};'use strict';var _=require(_0xf9f9('0x0'));var util=require(_0xf9f9('0x1'));var moment=require('moment');var BPromise=require(_0xf9f9('0x2'));var rs=require(_0xf9f9('0x3'));var fs=require('fs');var Redis=require(_0xf9f9('0x4'));var db=require(_0xf9f9('0x5'))['db'];var utils=require(_0xf9f9('0x6'));var logger=require(_0xf9f9('0x7'))(_0xf9f9('0x8'));var config=require(_0xf9f9('0x9'));var jayson=require(_0xf9f9('0xa'));var client=jayson['client'][_0xf9f9('0xb')]({'port':0x232a});config[_0xf9f9('0xc')]=_['defaults'](config[_0xf9f9('0xc')],{'host':_0xf9f9('0xd'),'port':0x18eb});var socket=require(_0xf9f9('0xe'))(new Redis(config[_0xf9f9('0xc')]));require('./mailQueue.socket')[_0xf9f9('0xf')](socket);function respondWithRpcPromise(_0x462df1,_0x37bbe8,_0x230ce0){return new BPromise(function(_0x1fb55b,_0x1b390b){return client['request'](_0x462df1,_0x230ce0)[_0xf9f9('0x10')](function(_0x4cd22a){logger[_0xf9f9('0x11')](_0xf9f9('0x12'),_0x37bbe8,_0xf9f9('0x13'));logger['debug'](_0xf9f9('0x14'),_0x37bbe8,'request\x20sent',JSON[_0xf9f9('0x15')](_0x4cd22a));if(_0x4cd22a['error']){if(_0x4cd22a[_0xf9f9('0x16')][_0xf9f9('0x17')]===0x1f4){logger[_0xf9f9('0x16')](_0xf9f9('0x12'),_0x37bbe8,_0x4cd22a[_0xf9f9('0x16')]['message']);return _0x1b390b(_0x4cd22a['error'][_0xf9f9('0x18')]);}logger[_0xf9f9('0x16')](_0xf9f9('0x12'),_0x37bbe8,_0x4cd22a[_0xf9f9('0x16')][_0xf9f9('0x18')]);return _0x1fb55b(_0x4cd22a['error']['message']);}else{logger[_0xf9f9('0x11')](_0xf9f9('0x12'),_0x37bbe8,_0xf9f9('0x13'));_0x1fb55b(_0x4cd22a[_0xf9f9('0x19')][_0xf9f9('0x18')]);}})[_0xf9f9('0x1a')](function(_0x20484f){logger[_0xf9f9('0x16')](_0xf9f9('0x12'),_0x37bbe8,_0x20484f);_0x1b390b(_0x20484f);});});}exports['GetMailQueue']=function(_0x446184){var _0x5e6737=this;return new Promise(function(_0x52c65c,_0xdfbaae){return db[_0xf9f9('0x1b')][_0xf9f9('0x1c')]({'raw':_0x446184[_0xf9f9('0x1d')]?_0x446184['options']['raw']===undefined?!![]:![]:!![],'where':_0x446184[_0xf9f9('0x1d')]?_0x446184[_0xf9f9('0x1d')][_0xf9f9('0x1e')]||null:null,'attributes':_0x446184[_0xf9f9('0x1d')]?_0x446184[_0xf9f9('0x1d')][_0xf9f9('0x1f')]||null:null,'limit':_0x446184[_0xf9f9('0x1d')]?_0x446184['options'][_0xf9f9('0x20')]||null:null,'include':_0x446184[_0xf9f9('0x1d')]?_0x446184[_0xf9f9('0x1d')][_0xf9f9('0x21')]?_[_0xf9f9('0x22')](_0x446184[_0xf9f9('0x1d')][_0xf9f9('0x21')],function(_0x2042c5){return{'model':db[_0x2042c5[_0xf9f9('0x23')]],'as':_0x2042c5['as'],'attributes':_0x2042c5[_0xf9f9('0x1f')],'include':_0x2042c5[_0xf9f9('0x21')]?_[_0xf9f9('0x22')](_0x2042c5['include'],function(_0x5d31b1){return{'model':db[_0x5d31b1[_0xf9f9('0x23')]],'as':_0x5d31b1['as'],'attributes':_0x5d31b1['attributes'],'include':_0x5d31b1[_0xf9f9('0x21')]?_[_0xf9f9('0x22')](_0x5d31b1['include'],function(_0x4cb85f){return{'model':db[_0x4cb85f[_0xf9f9('0x23')]],'as':_0x4cb85f['as'],'attributes':_0x4cb85f[_0xf9f9('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e9fcb){logger[_0xf9f9('0x11')](_0xf9f9('0x24'),_0x446184);logger['debug'](_0xf9f9('0x24'),_0x446184,JSON[_0xf9f9('0x15')](_0x4e9fcb));_0x52c65c(_0x4e9fcb);})[_0xf9f9('0x1a')](function(_0x309f9a){logger[_0xf9f9('0x16')](_0xf9f9('0x24'),_0x309f9a[_0xf9f9('0x18')],_0x446184);_0xdfbaae(_0x5e6737[_0xf9f9('0x16')](0x1f4,_0x309f9a[_0xf9f9('0x18')]));});});};exports['ShowMailQueue']=function(_0x152ef1){var _0xe67f0=this;return new Promise(function(_0x24cf6b,_0x568a63){return db[_0xf9f9('0x1b')]['find']({'raw':_0x152ef1[_0xf9f9('0x1d')]?_0x152ef1[_0xf9f9('0x1d')][_0xf9f9('0x25')]===undefined?!![]:![]:!![],'where':_0x152ef1['options']?_0x152ef1['options']['where']||null:null,'attributes':_0x152ef1[_0xf9f9('0x1d')]?_0x152ef1[_0xf9f9('0x1d')][_0xf9f9('0x1f')]||null:null,'include':_0x152ef1[_0xf9f9('0x1d')]?_0x152ef1[_0xf9f9('0x1d')][_0xf9f9('0x21')]?_[_0xf9f9('0x22')](_0x152ef1[_0xf9f9('0x1d')]['include'],function(_0x694ce7){return{'model':db[_0x694ce7['model']],'as':_0x694ce7['as'],'attributes':_0x694ce7[_0xf9f9('0x1f')],'include':_0x694ce7[_0xf9f9('0x21')]?_['map'](_0x694ce7['include'],function(_0x236cb6){return{'model':db[_0x236cb6[_0xf9f9('0x23')]],'as':_0x236cb6['as'],'attributes':_0x236cb6[_0xf9f9('0x1f')],'include':_0x236cb6[_0xf9f9('0x21')]?_[_0xf9f9('0x22')](_0x236cb6[_0xf9f9('0x21')],function(_0x21c8b4){return{'model':db[_0x21c8b4['model']],'as':_0x21c8b4['as'],'attributes':_0x21c8b4[_0xf9f9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf9f9('0x10')](function(_0x4925fd){logger[_0xf9f9('0x11')](_0xf9f9('0x26'),_0x152ef1);logger[_0xf9f9('0x27')]('ShowMailQueue',_0x152ef1,JSON[_0xf9f9('0x15')](_0x4925fd));_0x24cf6b(_0x4925fd);})[_0xf9f9('0x1a')](function(_0x573bcd){logger['error'](_0xf9f9('0x26'),_0x573bcd[_0xf9f9('0x18')],_0x152ef1);_0x568a63(_0xe67f0[_0xf9f9('0x16')](0x1f4,_0x573bcd[_0xf9f9('0x18')]));});});}; \ No newline at end of file +var _0xdd51=['./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','attributes','limit','include','model','map','GetMailQueue','ShowMailQueue','where','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdd51,0x8b));var _0x1dd5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd51[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1dd5('0x0'));var BPromise=require(_0x1dd5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1dd5('0x2'));var db=require(_0x1dd5('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1dd5('0x4'))('rpc');var config=require(_0x1dd5('0x5'));var jayson=require(_0x1dd5('0x6'));var client=jayson[_0x1dd5('0x7')][_0x1dd5('0x8')]({'port':0x232a});config['redis']=_[_0x1dd5('0x9')](config[_0x1dd5('0xa')],{'host':_0x1dd5('0xb'),'port':0x18eb});var socket=require(_0x1dd5('0xc'))(new Redis(config['redis']));require(_0x1dd5('0xd'))[_0x1dd5('0xe')](socket);function respondWithRpcPromise(_0x21dce8,_0x1984bc,_0x120a70){return new BPromise(function(_0x59c872,_0x58d3fe){return client[_0x1dd5('0xf')](_0x21dce8,_0x120a70)[_0x1dd5('0x10')](function(_0x587e09){logger[_0x1dd5('0x11')](_0x1dd5('0x12'),_0x1984bc,'request\x20sent');logger[_0x1dd5('0x13')](_0x1dd5('0x14'),_0x1984bc,'request\x20sent',JSON[_0x1dd5('0x15')](_0x587e09));if(_0x587e09[_0x1dd5('0x16')]){if(_0x587e09[_0x1dd5('0x16')][_0x1dd5('0x17')]===0x1f4){logger['error'](_0x1dd5('0x12'),_0x1984bc,_0x587e09[_0x1dd5('0x16')][_0x1dd5('0x18')]);return _0x58d3fe(_0x587e09[_0x1dd5('0x16')][_0x1dd5('0x18')]);}logger['error'](_0x1dd5('0x12'),_0x1984bc,_0x587e09['error'][_0x1dd5('0x18')]);return _0x59c872(_0x587e09[_0x1dd5('0x16')][_0x1dd5('0x18')]);}else{logger[_0x1dd5('0x11')]('MailQueue,\x20%s,\x20%s',_0x1984bc,'request\x20sent');_0x59c872(_0x587e09[_0x1dd5('0x19')][_0x1dd5('0x18')]);}})[_0x1dd5('0x1a')](function(_0x202a2b){logger[_0x1dd5('0x16')](_0x1dd5('0x12'),_0x1984bc,_0x202a2b);_0x58d3fe(_0x202a2b);});});}exports['GetMailQueue']=function(_0x22cd15){var _0x3ca68f=this;return new Promise(function(_0x39a56f,_0x5be4b0){return db['MailQueue'][_0x1dd5('0x1b')]({'raw':_0x22cd15[_0x1dd5('0x1c')]?_0x22cd15['options'][_0x1dd5('0x1d')]===undefined?!![]:![]:!![],'where':_0x22cd15[_0x1dd5('0x1c')]?_0x22cd15['options']['where']||null:null,'attributes':_0x22cd15[_0x1dd5('0x1c')]?_0x22cd15['options'][_0x1dd5('0x1e')]||null:null,'limit':_0x22cd15[_0x1dd5('0x1c')]?_0x22cd15['options'][_0x1dd5('0x1f')]||null:null,'include':_0x22cd15[_0x1dd5('0x1c')]?_0x22cd15[_0x1dd5('0x1c')]['include']?_['map'](_0x22cd15[_0x1dd5('0x1c')][_0x1dd5('0x20')],function(_0x593d35){return{'model':db[_0x593d35[_0x1dd5('0x21')]],'as':_0x593d35['as'],'attributes':_0x593d35[_0x1dd5('0x1e')],'include':_0x593d35[_0x1dd5('0x20')]?_[_0x1dd5('0x22')](_0x593d35[_0x1dd5('0x20')],function(_0x38b52f){return{'model':db[_0x38b52f[_0x1dd5('0x21')]],'as':_0x38b52f['as'],'attributes':_0x38b52f['attributes'],'include':_0x38b52f[_0x1dd5('0x20')]?_[_0x1dd5('0x22')](_0x38b52f['include'],function(_0x448f3c){return{'model':db[_0x448f3c['model']],'as':_0x448f3c['as'],'attributes':_0x448f3c['attributes']};}):[]};}):[]};}):[]:[]})[_0x1dd5('0x10')](function(_0x264114){logger[_0x1dd5('0x11')](_0x1dd5('0x23'),_0x22cd15);logger[_0x1dd5('0x13')]('GetMailQueue',_0x22cd15,JSON[_0x1dd5('0x15')](_0x264114));_0x39a56f(_0x264114);})[_0x1dd5('0x1a')](function(_0x12f7ca){logger[_0x1dd5('0x16')]('GetMailQueue',_0x12f7ca[_0x1dd5('0x18')],_0x22cd15);_0x5be4b0(_0x3ca68f[_0x1dd5('0x16')](0x1f4,_0x12f7ca[_0x1dd5('0x18')]));});});};exports[_0x1dd5('0x24')]=function(_0x3a14aa){var _0x53b52e=this;return new Promise(function(_0x12aa8a,_0x2711c5){return db['MailQueue']['find']({'raw':_0x3a14aa[_0x1dd5('0x1c')]?_0x3a14aa[_0x1dd5('0x1c')][_0x1dd5('0x1d')]===undefined?!![]:![]:!![],'where':_0x3a14aa[_0x1dd5('0x1c')]?_0x3a14aa[_0x1dd5('0x1c')][_0x1dd5('0x25')]||null:null,'attributes':_0x3a14aa['options']?_0x3a14aa[_0x1dd5('0x1c')][_0x1dd5('0x1e')]||null:null,'include':_0x3a14aa['options']?_0x3a14aa[_0x1dd5('0x1c')][_0x1dd5('0x20')]?_[_0x1dd5('0x22')](_0x3a14aa[_0x1dd5('0x1c')]['include'],function(_0x5db0ca){return{'model':db[_0x5db0ca[_0x1dd5('0x21')]],'as':_0x5db0ca['as'],'attributes':_0x5db0ca[_0x1dd5('0x1e')],'include':_0x5db0ca['include']?_[_0x1dd5('0x22')](_0x5db0ca[_0x1dd5('0x20')],function(_0x4ab9f9){return{'model':db[_0x4ab9f9[_0x1dd5('0x21')]],'as':_0x4ab9f9['as'],'attributes':_0x4ab9f9[_0x1dd5('0x1e')],'include':_0x4ab9f9[_0x1dd5('0x20')]?_['map'](_0x4ab9f9[_0x1dd5('0x20')],function(_0x85dd11){return{'model':db[_0x85dd11[_0x1dd5('0x21')]],'as':_0x85dd11['as'],'attributes':_0x85dd11[_0x1dd5('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1dd5('0x10')](function(_0x235597){logger['info'](_0x1dd5('0x24'),_0x3a14aa);logger[_0x1dd5('0x13')](_0x1dd5('0x24'),_0x3a14aa,JSON[_0x1dd5('0x15')](_0x235597));_0x12aa8a(_0x235597);})[_0x1dd5('0x1a')](function(_0x298996){logger[_0x1dd5('0x16')](_0x1dd5('0x24'),_0x298996[_0x1dd5('0x18')],_0x3a14aa);_0x2711c5(_0x53b52e['error'](0x1f4,_0x298996[_0x1dd5('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 6e1520e..ed86820 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 _0x3a5c=['register','length','mailQueue:','./mailQueue.events','emit'];(function(_0x57709e,_0x443595){var _0x131292=function(_0xf90d9f){while(--_0xf90d9f){_0x57709e['push'](_0x57709e['shift']());}};_0x131292(++_0x443595);}(_0x3a5c,0x166));var _0xc3a5=function(_0x51aea3,_0x5af6dd){_0x51aea3=_0x51aea3-0x0;var _0xe3311e=_0x3a5c[_0x51aea3];return _0xe3311e;};'use strict';var MailQueueEvents=require(_0xc3a5('0x0'));var events=['save','remove','update'];function createListener(_0x36a7df,_0x39368d){return function(_0x3bbf81){_0x39368d[_0xc3a5('0x1')](_0x36a7df,_0x3bbf81);};}function removeListener(_0x4c6b44,_0x154e5c){return function(){MailQueueEvents['removeListener'](_0x4c6b44,_0x154e5c);};}exports[_0xc3a5('0x2')]=function(_0x385583){for(var _0x54f768=0x0,_0x1433ac=events[_0xc3a5('0x3')];_0x54f768<_0x1433ac;_0x54f768++){var _0x5b68de=events[_0x54f768];var _0x5db178=createListener(_0xc3a5('0x4')+_0x5b68de,_0x385583);MailQueueEvents['on'](_0x5b68de,_0x5db178);}}; \ No newline at end of file +var _0xeb3f=['./mailQueue.events','save','remove','update','emit','removeListener','register','mailQueue:'];(function(_0x34e088,_0x2ea53d){var _0x21749a=function(_0x12c261){while(--_0x12c261){_0x34e088['push'](_0x34e088['shift']());}};_0x21749a(++_0x2ea53d);}(_0xeb3f,0xa8));var _0xfeb3=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xeb3f[_0x432682];return _0x463d05;};'use strict';var MailQueueEvents=require(_0xfeb3('0x0'));var events=[_0xfeb3('0x1'),_0xfeb3('0x2'),_0xfeb3('0x3')];function createListener(_0x35e554,_0x48b70c){return function(_0x2c0229){_0x48b70c[_0xfeb3('0x4')](_0x35e554,_0x2c0229);};}function removeListener(_0x1f27f4,_0x125a2f){return function(){MailQueueEvents[_0xfeb3('0x5')](_0x1f27f4,_0x125a2f);};}exports[_0xfeb3('0x6')]=function(_0x455738){for(var _0x10fa12=0x0,_0x38379c=events['length'];_0x10fa12<_0x38379c;_0x10fa12++){var _0x20dfc4=events[_0x10fa12];var _0x1a4e9c=createListener(_0xfeb3('0x7')+_0x20dfc4,_0x455738);MailQueueEvents['on'](_0x20dfc4,_0x1a4e9c);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 89d9f49..b098d3a 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 _0x547b=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','get','/describe','/:id','show','create','put','update','destroy','exports'];(function(_0x3e67cf,_0x17d9f8){var _0x274bcf=function(_0x35ea4b){while(--_0x35ea4b){_0x3e67cf['push'](_0x3e67cf['shift']());}};_0x274bcf(++_0x17d9f8);}(_0x547b,0x72));var _0xb547=function(_0x3994b2,_0xfa48c0){_0x3994b2=_0x3994b2-0x0;var _0x476266=_0x547b[_0x3994b2];return _0x476266;};'use strict';var multer=require('multer');var util=require(_0xb547('0x0'));var path=require(_0xb547('0x1'));var timeout=require('connect-timeout');var express=require(_0xb547('0x2'));var router=express[_0xb547('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb547('0x4'));var interaction=require(_0xb547('0x5'));var config=require(_0xb547('0x6'));var controller=require(_0xb547('0x7'));router['get']('/',auth[_0xb547('0x8')](),controller[_0xb547('0x9')]);router[_0xb547('0xa')](_0xb547('0xb'),auth[_0xb547('0x8')](),controller['describe']);router['get'](_0xb547('0xc'),auth[_0xb547('0x8')](),controller[_0xb547('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb547('0xe')]);router[_0xb547('0xf')](_0xb547('0xc'),auth[_0xb547('0x8')](),controller[_0xb547('0x10')]);router['delete'](_0xb547('0xc'),auth['isAuthenticated'](),controller[_0xb547('0x11')]);module[_0xb547('0x12')]=router; \ No newline at end of file +var _0x18b8=['post','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x33d943,_0x1f1f04){var _0x212c30=function(_0x1e00f2){while(--_0x1e00f2){_0x33d943['push'](_0x33d943['shift']());}};_0x212c30(++_0x1f1f04);}(_0x18b8,0xc3));var _0x818b=function(_0x150268,_0x424e72){_0x150268=_0x150268-0x0;var _0x411336=_0x18b8[_0x150268];return _0x411336;};'use strict';var multer=require(_0x818b('0x0'));var util=require(_0x818b('0x1'));var path=require('path');var timeout=require(_0x818b('0x2'));var express=require(_0x818b('0x3'));var router=express[_0x818b('0x4')]();var fs_extra=require(_0x818b('0x5'));var auth=require(_0x818b('0x6'));var interaction=require(_0x818b('0x7'));var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router[_0x818b('0x8')]('/',auth[_0x818b('0x9')](),controller[_0x818b('0xa')]);router['get'](_0x818b('0xb'),auth['isAuthenticated'](),controller[_0x818b('0xc')]);router['get'](_0x818b('0xd'),auth[_0x818b('0x9')](),controller['show']);router[_0x818b('0xe')]('/',auth[_0x818b('0x9')](),controller['create']);router[_0x818b('0xf')](_0x818b('0xd'),auth[_0x818b('0x9')](),controller[_0x818b('0x10')]);router[_0x818b('0x11')](_0x818b('0xd'),auth[_0x818b('0x9')](),controller['destroy']);module[_0x818b('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 45975a1..f1c8790 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 _0x63aa=['STRING','DATE','moment','sequelize','exports'];(function(_0x43b5a7,_0xf5e3d6){var _0x5461fe=function(_0x5d9d5a){while(--_0x5d9d5a){_0x43b5a7['push'](_0x43b5a7['shift']());}};_0x5461fe(++_0xf5e3d6);}(_0x63aa,0x98));var _0xa63a=function(_0x81df6,_0x3a220f){_0x81df6=_0x81df6-0x0;var _0x1262ef=_0x63aa[_0x81df6];return _0x1262ef;};'use strict';var moment=require(_0xa63a('0x0'));var Sequelize=require(_0xa63a('0x1'));module[_0xa63a('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xa63a('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa63a('0x4')]},'acceptAt':{'type':Sequelize[_0xa63a('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa63a('0x3')]}}; \ No newline at end of file +var _0xf5be=['exports','STRING','DATE','moment','sequelize'];(function(_0x38d636,_0x3ad275){var _0x375ac7=function(_0x1a77ec){while(--_0x1a77ec){_0x38d636['push'](_0x38d636['shift']());}};_0x375ac7(++_0x3ad275);}(_0xf5be,0x107));var _0xef5b=function(_0x48790f,_0x1b48a8){_0x48790f=_0x48790f-0x0;var _0x5ce7bd=_0xf5be[_0x48790f];return _0x5ce7bd;};'use strict';var moment=require(_0xef5b('0x0'));var Sequelize=require(_0xef5b('0x1'));module[_0xef5b('0x2')]={'uniqueid':{'type':Sequelize[_0xef5b('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xef5b('0x3')]},'joinAt':{'type':Sequelize[_0xef5b('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xef5b('0x4')]},'exitAt':{'type':Sequelize[_0xef5b('0x4')]},'reason':{'type':Sequelize[_0xef5b('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 73b6852..d08af59 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 _0x25e7=['params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','MailQueueReport','findAll','rows','catch','show','fields','create','body','update','find'];(function(_0x319ff8,_0x45ca90){var _0x11d674=function(_0x2e8194){while(--_0x2e8194){_0x319ff8['push'](_0x319ff8['shift']());}};_0x11d674(++_0x45ca90);}(_0x25e7,0x1d6));var _0x725e=function(_0x54e335,_0x6b782d){_0x54e335=_0x54e335-0x0;var _0x5be44a=_0x25e7[_0x54e335];return _0x5be44a;};'use strict';var emlformat=require(_0x725e('0x0'));var rimraf=require(_0x725e('0x1'));var zipdir=require(_0x725e('0x2'));var jsonpatch=require(_0x725e('0x3'));var rp=require(_0x725e('0x4'));var moment=require(_0x725e('0x5'));var BPromise=require(_0x725e('0x6'));var Mustache=require(_0x725e('0x7'));var util=require(_0x725e('0x8'));var path=require(_0x725e('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x725e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x725e('0xb'));var crypto=require(_0x725e('0xc'));var jsforce=require(_0x725e('0xd'));var deskjs=require(_0x725e('0xe'));var toCsv=require(_0x725e('0xf'));var querystring=require(_0x725e('0x10'));var Papa=require(_0x725e('0x11'));var Redis=require(_0x725e('0x12'));var authService=require(_0x725e('0x13'));var qs=require(_0x725e('0x14'));var as=require(_0x725e('0x15'));var hardwareService=require(_0x725e('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x725e('0x17'));var config=require(_0x725e('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11916d,_0x14218e){_0x14218e=_0x14218e||0xcc;return function(_0x5c5e44){if(_0x5c5e44){return _0x11916d[_0x725e('0x19')](_0x14218e);}return _0x11916d[_0x725e('0x1a')](_0x14218e)[_0x725e('0x1b')]();};}function respondWithResult(_0x4e0515,_0x3f8052){_0x3f8052=_0x3f8052||0xc8;return function(_0x221e02){if(_0x221e02){return _0x4e0515[_0x725e('0x1a')](_0x3f8052)[_0x725e('0x1c')](_0x221e02);}};}function respondWithFilteredResult(_0x24c3c1,_0x13fbfe){return function(_0x523422){if(_0x523422){var _0x156b99=typeof _0x13fbfe[_0x725e('0x1d')]===_0x725e('0x1e')&&typeof _0x13fbfe['limit']===_0x725e('0x1e');var _0x125fef=_0x523422[_0x725e('0x1f')];var _0x397e33=_0x156b99?0x0:_0x13fbfe[_0x725e('0x1d')];var _0x2811e7=_0x156b99?_0x523422['count']:_0x13fbfe[_0x725e('0x1d')]+_0x13fbfe[_0x725e('0x20')];var _0x1b8879;if(_0x2811e7>=_0x125fef){_0x2811e7=_0x125fef;_0x1b8879=0xc8;}else{_0x1b8879=0xce;}_0x24c3c1[_0x725e('0x1a')](_0x1b8879);return _0x24c3c1[_0x725e('0x21')](_0x725e('0x22'),_0x397e33+'-'+_0x2811e7+'/'+_0x125fef)['json'](_0x523422);}return null;};}function patchUpdates(_0x2fc416){return function(_0xd30de9){try{jsonpatch[_0x725e('0x23')](_0xd30de9,_0x2fc416,!![]);}catch(_0x40c21b){return BPromise[_0x725e('0x24')](_0x40c21b);}return _0xd30de9[_0x725e('0x25')]();};}function saveUpdates(_0x127c99,_0x262b01){return function(_0x7d0792){if(_0x7d0792){return _0x7d0792['update'](_0x127c99)[_0x725e('0x26')](function(_0x36cbab){return _0x36cbab;});}return null;};}function removeEntity(_0x389668,_0x3facae){return function(_0x5a8191){if(_0x5a8191){return _0x5a8191[_0x725e('0x27')]()['then'](function(){_0x389668['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2aad7b,_0x1cbaae){return function(_0x2d3c55){if(!_0x2d3c55){_0x2aad7b['sendStatus'](0x194);}return _0x2d3c55;};}function handleError(_0xab6cfd,_0x8a138f){_0x8a138f=_0x8a138f||0x1f4;return function(_0x5a5bef){logger[_0x725e('0x28')](_0x5a5bef[_0x725e('0x29')]);if(_0x5a5bef['name']){delete _0x5a5bef[_0x725e('0x2a')];}_0xab6cfd['status'](_0x8a138f)['send'](_0x5a5bef);};}exports[_0x725e('0x2b')]=function(_0x5b8dec,_0x3b42bd){var _0x4cc4ad={},_0x4de2e0={},_0x9b5b7f={'count':0x0,'rows':[]};var _0x31a8ff=_[_0x725e('0x2c')](db['MailQueueReport'][_0x725e('0x2d')],function(_0x5b03d9){return{'name':_0x5b03d9[_0x725e('0x2e')],'type':_0x5b03d9[_0x725e('0x2f')][_0x725e('0x30')]};});_0x4de2e0[_0x725e('0x31')]=_[_0x725e('0x2c')](_0x31a8ff,_0x725e('0x2a'));_0x4de2e0[_0x725e('0x32')]=_[_0x725e('0x33')](_0x5b8dec[_0x725e('0x32')]);_0x4de2e0[_0x725e('0x34')]=_[_0x725e('0x35')](_0x4de2e0['model'],_0x4de2e0[_0x725e('0x32')]);_0x4cc4ad[_0x725e('0x36')]=_['intersection'](_0x4de2e0[_0x725e('0x31')],qs['fields'](_0x5b8dec[_0x725e('0x32')]['fields']));_0x4cc4ad[_0x725e('0x36')]=_0x4cc4ad[_0x725e('0x36')][_0x725e('0x37')]?_0x4cc4ad[_0x725e('0x36')]:_0x4de2e0[_0x725e('0x31')];if(!_0x5b8dec[_0x725e('0x32')]['hasOwnProperty']('nolimit')){_0x4cc4ad[_0x725e('0x20')]=qs[_0x725e('0x20')](_0x5b8dec[_0x725e('0x32')]['limit']);_0x4cc4ad[_0x725e('0x1d')]=qs['offset'](_0x5b8dec[_0x725e('0x32')][_0x725e('0x1d')]);}_0x4cc4ad[_0x725e('0x38')]=qs[_0x725e('0x39')](_0x5b8dec['query']['sort']);_0x4cc4ad[_0x725e('0x3a')]=qs[_0x725e('0x34')](_[_0x725e('0x3b')](_0x5b8dec['query'],_0x4de2e0[_0x725e('0x34')]),_0x31a8ff);if(_0x5b8dec[_0x725e('0x32')][_0x725e('0x3c')]){_0x4cc4ad['where']=_[_0x725e('0x3d')](_0x4cc4ad['where'],{'$or':_[_0x725e('0x2c')](_0x31a8ff,function(_0x462dac){if(_0x462dac[_0x725e('0x2f')]!==_0x725e('0x3e')){var _0x46eaa0={};_0x46eaa0[_0x462dac['name']]={'$like':'%'+_0x5b8dec['query'][_0x725e('0x3c')]+'%'};return _0x46eaa0;}})});}_0x4cc4ad=_[_0x725e('0x3d')]({},_0x4cc4ad,_0x5b8dec[_0x725e('0x3f')]);var _0x5dd1d1={'where':_0x4cc4ad[_0x725e('0x3a')]};return db['MailQueueReport'][_0x725e('0x1f')](_0x5dd1d1)[_0x725e('0x26')](function(_0x337e53){_0x9b5b7f[_0x725e('0x1f')]=_0x337e53;if(_0x5b8dec['query'][_0x725e('0x40')]){_0x4cc4ad[_0x725e('0x41')]=[{'all':!![]}];}return db[_0x725e('0x42')][_0x725e('0x43')](_0x4cc4ad);})[_0x725e('0x26')](function(_0x19ed0a){_0x9b5b7f[_0x725e('0x44')]=_0x19ed0a;return _0x9b5b7f;})['then'](respondWithFilteredResult(_0x3b42bd,_0x4cc4ad))[_0x725e('0x45')](handleError(_0x3b42bd,null));};exports[_0x725e('0x46')]=function(_0x58ebe3,_0x2200ad){var _0x3b7a87={'raw':!![],'where':{'id':_0x58ebe3['params']['id']}},_0x5e719e={};_0x5e719e['model']=_['keys'](db[_0x725e('0x42')][_0x725e('0x2d')]);_0x5e719e[_0x725e('0x32')]=_['keys'](_0x58ebe3[_0x725e('0x32')]);_0x5e719e['filters']=_['intersection'](_0x5e719e[_0x725e('0x31')],_0x5e719e[_0x725e('0x32')]);_0x3b7a87[_0x725e('0x36')]=_[_0x725e('0x35')](_0x5e719e[_0x725e('0x31')],qs[_0x725e('0x47')](_0x58ebe3['query'][_0x725e('0x47')]));_0x3b7a87['attributes']=_0x3b7a87[_0x725e('0x36')][_0x725e('0x37')]?_0x3b7a87['attributes']:_0x5e719e[_0x725e('0x31')];if(_0x58ebe3['query'][_0x725e('0x40')]){_0x3b7a87[_0x725e('0x41')]=[{'all':!![]}];}_0x3b7a87=_['merge']({},_0x3b7a87,_0x58ebe3['options']);return db[_0x725e('0x42')]['find'](_0x3b7a87)[_0x725e('0x26')](handleEntityNotFound(_0x2200ad,null))['then'](respondWithResult(_0x2200ad,null))['catch'](handleError(_0x2200ad,null));};exports['create']=function(_0x118ef5,_0x38a81f){return db['MailQueueReport'][_0x725e('0x48')](_0x118ef5[_0x725e('0x49')],{})['then'](respondWithResult(_0x38a81f,0xc9))[_0x725e('0x45')](handleError(_0x38a81f,null));};exports[_0x725e('0x4a')]=function(_0x4d5415,_0x19f524){if(_0x4d5415[_0x725e('0x49')]['id']){delete _0x4d5415[_0x725e('0x49')]['id'];}return db[_0x725e('0x42')][_0x725e('0x4b')]({'where':{'id':_0x4d5415[_0x725e('0x4c')]['id']}})[_0x725e('0x26')](handleEntityNotFound(_0x19f524,null))[_0x725e('0x26')](saveUpdates(_0x4d5415[_0x725e('0x49')],null))[_0x725e('0x26')](respondWithResult(_0x19f524,null))['catch'](handleError(_0x19f524,null));};exports[_0x725e('0x27')]=function(_0x5e3678,_0x11e2f7){return db[_0x725e('0x42')][_0x725e('0x4b')]({'where':{'id':_0x5e3678[_0x725e('0x4c')]['id']}})[_0x725e('0x26')](handleEntityNotFound(_0x11e2f7,null))[_0x725e('0x26')](removeEntity(_0x11e2f7,null))[_0x725e('0x45')](handleError(_0x11e2f7,null));};exports[_0x725e('0x4d')]=function(_0x1f3097,_0xd366b9){return db[_0x725e('0x42')][_0x725e('0x4d')]()[_0x725e('0x26')](respondWithResult(_0xd366b9,null))[_0x725e('0x45')](handleError(_0xd366b9,null));}; \ No newline at end of file +var _0xc2c7=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where'];(function(_0x4ca83c,_0x34ebce){var _0xadd149=function(_0x4797df){while(--_0x4797df){_0x4ca83c['push'](_0x4ca83c['shift']());}};_0xadd149(++_0x34ebce);}(_0xc2c7,0x134));var _0x7c2c=function(_0x538808,_0x17bd0b){_0x538808=_0x538808-0x0;var _0x2883f7=_0xc2c7[_0x538808];return _0x2883f7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c2c('0x0'));var zipdir=require(_0x7c2c('0x1'));var jsonpatch=require(_0x7c2c('0x2'));var rp=require(_0x7c2c('0x3'));var moment=require(_0x7c2c('0x4'));var BPromise=require(_0x7c2c('0x5'));var Mustache=require(_0x7c2c('0x6'));var util=require(_0x7c2c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7c2c('0x8'));var ejs=require(_0x7c2c('0x9'));var fs=require('fs');var fs_extra=require(_0x7c2c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c2c('0xb'));var deskjs=require(_0x7c2c('0xc'));var toCsv=require(_0x7c2c('0x8'));var querystring=require(_0x7c2c('0xd'));var Papa=require(_0x7c2c('0xe'));var Redis=require('ioredis');var authService=require(_0x7c2c('0xf'));var qs=require(_0x7c2c('0x10'));var as=require(_0x7c2c('0x11'));var hardwareService=require(_0x7c2c('0x12'));var logger=require(_0x7c2c('0x13'))(_0x7c2c('0x14'));var utils=require(_0x7c2c('0x15'));var config=require(_0x7c2c('0x16'));var licenseUtil=require(_0x7c2c('0x17'));var db=require(_0x7c2c('0x18'))['db'];function respondWithStatusCode(_0xae8441,_0x45847d){_0x45847d=_0x45847d||0xcc;return function(_0x68398a){if(_0x68398a){return _0xae8441[_0x7c2c('0x19')](_0x45847d);}return _0xae8441[_0x7c2c('0x1a')](_0x45847d)[_0x7c2c('0x1b')]();};}function respondWithResult(_0x4c4aaf,_0x5b5729){_0x5b5729=_0x5b5729||0xc8;return function(_0x102778){if(_0x102778){return _0x4c4aaf[_0x7c2c('0x1a')](_0x5b5729)[_0x7c2c('0x1c')](_0x102778);}};}function respondWithFilteredResult(_0x5ae94f,_0x11424c){return function(_0x206ecd){if(_0x206ecd){var _0x5e55e0=typeof _0x11424c[_0x7c2c('0x1d')]==='undefined'&&typeof _0x11424c[_0x7c2c('0x1e')]==='undefined';var _0x342ea2=_0x206ecd[_0x7c2c('0x1f')];var _0x14453f=_0x5e55e0?0x0:_0x11424c[_0x7c2c('0x1d')];var _0x17df4a=_0x5e55e0?_0x206ecd[_0x7c2c('0x1f')]:_0x11424c[_0x7c2c('0x1d')]+_0x11424c[_0x7c2c('0x1e')];var _0x2d356e;if(_0x17df4a>=_0x342ea2){_0x17df4a=_0x342ea2;_0x2d356e=0xc8;}else{_0x2d356e=0xce;}_0x5ae94f[_0x7c2c('0x1a')](_0x2d356e);return _0x5ae94f[_0x7c2c('0x20')](_0x7c2c('0x21'),_0x14453f+'-'+_0x17df4a+'/'+_0x342ea2)['json'](_0x206ecd);}return null;};}function patchUpdates(_0x1c5491){return function(_0x4adb62){try{jsonpatch['apply'](_0x4adb62,_0x1c5491,!![]);}catch(_0x15ae33){return BPromise[_0x7c2c('0x22')](_0x15ae33);}return _0x4adb62[_0x7c2c('0x23')]();};}function saveUpdates(_0x38ae30,_0x41552f){return function(_0x1883b5){if(_0x1883b5){return _0x1883b5[_0x7c2c('0x24')](_0x38ae30)['then'](function(_0x10c356){return _0x10c356;});}return null;};}function removeEntity(_0x4dedd8,_0x302c93){return function(_0x57f510){if(_0x57f510){return _0x57f510[_0x7c2c('0x25')]()[_0x7c2c('0x26')](function(){_0x4dedd8[_0x7c2c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d6ec7,_0x31a50c){return function(_0x30c53e){if(!_0x30c53e){_0x4d6ec7[_0x7c2c('0x19')](0x194);}return _0x30c53e;};}function handleError(_0x150690,_0x31d8f3){_0x31d8f3=_0x31d8f3||0x1f4;return function(_0xa8e145){logger[_0x7c2c('0x27')](_0xa8e145['stack']);if(_0xa8e145[_0x7c2c('0x28')]){delete _0xa8e145[_0x7c2c('0x28')];}_0x150690[_0x7c2c('0x1a')](_0x31d8f3)[_0x7c2c('0x29')](_0xa8e145);};}exports[_0x7c2c('0x2a')]=function(_0x1f8846,_0xf2bfd1){var _0x26f472={},_0xa040ff={},_0x5769ec={'count':0x0,'rows':[]};var _0x465ad6=_[_0x7c2c('0x2b')](db[_0x7c2c('0x2c')][_0x7c2c('0x2d')],function(_0x53ad23){return{'name':_0x53ad23[_0x7c2c('0x2e')],'type':_0x53ad23[_0x7c2c('0x2f')][_0x7c2c('0x30')]};});_0xa040ff[_0x7c2c('0x31')]=_[_0x7c2c('0x2b')](_0x465ad6,_0x7c2c('0x28'));_0xa040ff[_0x7c2c('0x32')]=_['keys'](_0x1f8846[_0x7c2c('0x32')]);_0xa040ff[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0xa040ff[_0x7c2c('0x31')],_0xa040ff[_0x7c2c('0x32')]);_0x26f472['attributes']=_['intersection'](_0xa040ff[_0x7c2c('0x31')],qs['fields'](_0x1f8846['query'][_0x7c2c('0x35')]));_0x26f472[_0x7c2c('0x36')]=_0x26f472[_0x7c2c('0x36')][_0x7c2c('0x37')]?_0x26f472['attributes']:_0xa040ff[_0x7c2c('0x31')];if(!_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x38')](_0x7c2c('0x39'))){_0x26f472[_0x7c2c('0x1e')]=qs[_0x7c2c('0x1e')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1e')]);_0x26f472[_0x7c2c('0x1d')]=qs[_0x7c2c('0x1d')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1d')]);}_0x26f472[_0x7c2c('0x3a')]=qs['sort'](_0x1f8846['query'][_0x7c2c('0x3b')]);_0x26f472['where']=qs['filters'](_['pick'](_0x1f8846[_0x7c2c('0x32')],_0xa040ff[_0x7c2c('0x33')]),_0x465ad6);if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]){_0x26f472[_0x7c2c('0x3d')]=_[_0x7c2c('0x3e')](_0x26f472[_0x7c2c('0x3d')],{'$or':_[_0x7c2c('0x2b')](_0x465ad6,function(_0x2b6520){if(_0x2b6520[_0x7c2c('0x2f')]!==_0x7c2c('0x3f')){var _0x58696a={};_0x58696a[_0x2b6520['name']]={'$like':'%'+_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]+'%'};return _0x58696a;}})});}_0x26f472=_[_0x7c2c('0x3e')]({},_0x26f472,_0x1f8846[_0x7c2c('0x40')]);var _0x5e8c96={'where':_0x26f472[_0x7c2c('0x3d')]};return db[_0x7c2c('0x2c')][_0x7c2c('0x1f')](_0x5e8c96)[_0x7c2c('0x26')](function(_0x18e288){_0x5769ec[_0x7c2c('0x1f')]=_0x18e288;if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x26f472[_0x7c2c('0x42')]=[{'all':!![]}];}return db['MailQueueReport'][_0x7c2c('0x43')](_0x26f472);})['then'](function(_0x2c3f40){_0x5769ec[_0x7c2c('0x44')]=_0x2c3f40;return _0x5769ec;})['then'](respondWithFilteredResult(_0xf2bfd1,_0x26f472))[_0x7c2c('0x45')](handleError(_0xf2bfd1,null));};exports['show']=function(_0x3014fb,_0x33b2be){var _0x9b9813={'raw':!![],'where':{'id':_0x3014fb['params']['id']}},_0x26351e={};_0x26351e[_0x7c2c('0x31')]=_['keys'](db['MailQueueReport'][_0x7c2c('0x2d')]);_0x26351e[_0x7c2c('0x32')]=_[_0x7c2c('0x46')](_0x3014fb['query']);_0x26351e[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0x26351e['model'],_0x26351e[_0x7c2c('0x32')]);_0x9b9813['attributes']=_[_0x7c2c('0x34')](_0x26351e[_0x7c2c('0x31')],qs['fields'](_0x3014fb['query'][_0x7c2c('0x35')]));_0x9b9813[_0x7c2c('0x36')]=_0x9b9813['attributes'][_0x7c2c('0x37')]?_0x9b9813['attributes']:_0x26351e['model'];if(_0x3014fb[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x9b9813[_0x7c2c('0x42')]=[{'all':!![]}];}_0x9b9813=_[_0x7c2c('0x3e')]({},_0x9b9813,_0x3014fb[_0x7c2c('0x40')]);return db[_0x7c2c('0x2c')][_0x7c2c('0x47')](_0x9b9813)[_0x7c2c('0x26')](handleEntityNotFound(_0x33b2be,null))[_0x7c2c('0x26')](respondWithResult(_0x33b2be,null))['catch'](handleError(_0x33b2be,null));};exports['create']=function(_0xeb067b,_0x3091bd){return db[_0x7c2c('0x2c')]['create'](_0xeb067b['body'],{})[_0x7c2c('0x26')](respondWithResult(_0x3091bd,0xc9))[_0x7c2c('0x45')](handleError(_0x3091bd,null));};exports[_0x7c2c('0x24')]=function(_0x2b79d5,_0x5f3de8){if(_0x2b79d5['body']['id']){delete _0x2b79d5['body']['id'];}return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'id':_0x2b79d5[_0x7c2c('0x48')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x5f3de8,null))[_0x7c2c('0x26')](saveUpdates(_0x2b79d5['body'],null))[_0x7c2c('0x26')](respondWithResult(_0x5f3de8,null))[_0x7c2c('0x45')](handleError(_0x5f3de8,null));};exports['destroy']=function(_0x19621a,_0x56e09d){return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'id':_0x19621a[_0x7c2c('0x48')]['id']}})['then'](handleEntityNotFound(_0x56e09d,null))['then'](removeEntity(_0x56e09d,null))[_0x7c2c('0x45')](handleError(_0x56e09d,null));};exports['describe']=function(_0x13e0bf,_0x11d337){return db['MailQueueReport'][_0x7c2c('0x49')]()[_0x7c2c('0x26')](respondWithResult(_0x11d337,null))['catch'](handleError(_0x11d337,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 8d76586..3db905b 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 _0xd9bc=['../../config/logger','request-promise','path','rimraf','./mailQueueReport.attributes','exports','MailQueueReport','report_mail_queue','uniqueid','lodash'];(function(_0x30530a,_0x6bd645){var _0x2d01b1=function(_0x810b3a){while(--_0x810b3a){_0x30530a['push'](_0x30530a['shift']());}};_0x2d01b1(++_0x6bd645);}(_0xd9bc,0x1a3));var _0xcd9b=function(_0x15d059,_0x11b426){_0x15d059=_0x15d059-0x0;var _0x27e06b=_0xd9bc[_0x15d059];return _0x27e06b;};'use strict';var _=require(_0xcd9b('0x0'));var util=require('util');var logger=require(_0xcd9b('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcd9b('0x2'));var fs=require('fs');var path=require(_0xcd9b('0x3'));var rimraf=require(_0xcd9b('0x4'));var config=require('../../config/environment');var attributes=require(_0xcd9b('0x5'));module[_0xcd9b('0x6')]=function(_0x458fc4,_0x1e92d1){return _0x458fc4['define'](_0xcd9b('0x7'),attributes,{'tableName':_0xcd9b('0x8'),'paranoid':![],'indexes':[{'name':_0xcd9b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5b4e=['moment','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','api'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5b4e,0xd7));var _0xe5b4=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5b4e[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe5b4('0x0'));var moment=require(_0xe5b4('0x1'));var BPromise=require(_0xe5b4('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe5b4('0x3'));var rimraf=require(_0xe5b4('0x4'));var config=require(_0xe5b4('0x5'));var attributes=require(_0xe5b4('0x6'));module[_0xe5b4('0x7')]=function(_0x90d0d8,_0x859998){return _0x90d0d8[_0xe5b4('0x8')](_0xe5b4('0x9'),attributes,{'tableName':_0xe5b4('0xa'),'paranoid':![],'indexes':[{'name':_0xe5b4('0xb'),'fields':[_0xe5b4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 77a282f..32bae95 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 _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x53ecdb,_0x16fdaf){var _0x49973e=function(_0xbb0036){while(--_0xbb0036){_0x53ecdb['push'](_0x53ecdb['shift']());}};_0x49973e(++_0x16fdaf);}(_0x7a54,0x106));var _0x47a5=function(_0x46bf5e,_0x1f922d){_0x46bf5e=_0x46bf5e-0x0;var _0x89a4bb=_0x7a54[_0x46bf5e];return _0x89a4bb;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5b25ee,_0x5fdd74){var _0x59910a=function(_0x34b369){while(--_0x34b369){_0x5b25ee['push'](_0x5b25ee['shift']());}};_0x59910a(++_0x5fdd74);}(_0x326f,0xd1));var _0xf326=function(_0x3e45da,_0x3c29f4){_0x3e45da=_0x3e45da-0x0;var _0x1845e5=_0x326f[_0x3e45da];return _0x1845e5;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index f404909..73588a9 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x16a049,_0x362cd0){var _0x4181cd=function(_0x3cf731){while(--_0x3cf731){_0x16a049['push'](_0x16a049['shift']());}};_0x4181cd(++_0x362cd0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x22ffbf,_0x16f31e){_0x22ffbf=_0x22ffbf-0x0;var _0x360c17=_0xcb91[_0x22ffbf];return _0x360c17;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x45aca3,_0x2dc880){var _0x540d06=function(_0x1ca425){while(--_0x1ca425){_0x45aca3['push'](_0x45aca3['shift']());}};_0x540d06(++_0x2dc880);}(_0x9c44,0x178));var _0x49c4=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9c44[_0x5f09c5];return _0x426ad9;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 89009a0..3eab5be 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 _0x6c76=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x3b941e,_0x20df78){var _0x44c514=function(_0x89072){while(--_0x89072){_0x3b941e['push'](_0x3b941e['shift']());}};_0x44c514(++_0x20df78);}(_0x6c76,0x184));var _0x66c7=function(_0x70a833,_0x27fc77){_0x70a833=_0x70a833-0x0;var _0xf93c5d=_0x6c76[_0x70a833];return _0xf93c5d;};'use strict';var Sequelize=require(_0x66c7('0x0'));module[_0x66c7('0x1')]={'description':{'type':Sequelize[_0x66c7('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x66c7('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x66c7('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x66c7('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x66c7('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x66c7('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x66c7('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x16d2=['BOOLEAN','INTEGER','INBOX','sequelize','exports','STRING'];(function(_0x357a33,_0x40d6e3){var _0x57ebf1=function(_0x5140b2){while(--_0x5140b2){_0x357a33['push'](_0x357a33['shift']());}};_0x57ebf1(++_0x40d6e3);}(_0x16d2,0x123));var _0x216d=function(_0x91384,_0x476988){_0x91384=_0x91384-0x0;var _0x1a16c2=_0x16d2[_0x91384];return _0x1a16c2;};'use strict';var Sequelize=require(_0x216d('0x0'));module[_0x216d('0x1')]={'description':{'type':Sequelize[_0x216d('0x2')]},'host':{'type':Sequelize[_0x216d('0x2')]},'authentication':{'type':Sequelize[_0x216d('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x216d('0x2')]},'password':{'type':Sequelize[_0x216d('0x2')]},'port':{'type':Sequelize[_0x216d('0x4')]},'tls':{'type':Sequelize[_0x216d('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x216d('0x5')},'connTimeout':{'type':Sequelize[_0x216d('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x216d('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x216d('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 79df01e..a173a75 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 _0x9f18=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','define','MailServerIn','mail_servers_in','lodash','util'];(function(_0x2c1812,_0x469234){var _0x22ed7d=function(_0x2f8a2d){while(--_0x2f8a2d){_0x2c1812['push'](_0x2c1812['shift']());}};_0x22ed7d(++_0x469234);}(_0x9f18,0x150));var _0x89f1=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x9f18[_0x51c819];return _0x15c5d2;};'use strict';var _=require(_0x89f1('0x0'));var util=require(_0x89f1('0x1'));var logger=require('../../config/logger')(_0x89f1('0x2'));var moment=require(_0x89f1('0x3'));var BPromise=require(_0x89f1('0x4'));var rp=require(_0x89f1('0x5'));var fs=require('fs');var path=require(_0x89f1('0x6'));var rimraf=require(_0x89f1('0x7'));var config=require(_0x89f1('0x8'));var attributes=require(_0x89f1('0x9'));module['exports']=function(_0x2ff677,_0x39f6b5){return _0x2ff677[_0x89f1('0xa')](_0x89f1('0xb'),attributes,{'tableName':_0x89f1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c60=['path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','util','../../config/logger','api','moment','request-promise'];(function(_0x3d85b2,_0x546af8){var _0x482cc8=function(_0x4f7ca3){while(--_0x4f7ca3){_0x3d85b2['push'](_0x3d85b2['shift']());}};_0x482cc8(++_0x546af8);}(_0x7c60,0xc1));var _0x07c6=function(_0x846df1,_0x555797){_0x846df1=_0x846df1-0x0;var _0x478c0f=_0x7c60[_0x846df1];return _0x478c0f;};'use strict';var _=require('lodash');var util=require(_0x07c6('0x0'));var logger=require(_0x07c6('0x1'))(_0x07c6('0x2'));var moment=require(_0x07c6('0x3'));var BPromise=require('bluebird');var rp=require(_0x07c6('0x4'));var fs=require('fs');var path=require(_0x07c6('0x5'));var rimraf=require(_0x07c6('0x6'));var config=require(_0x07c6('0x7'));var attributes=require(_0x07c6('0x8'));module[_0x07c6('0x9')]=function(_0x5136b0,_0x3f5087){return _0x5136b0[_0x07c6('0xa')]('MailServerIn',attributes,{'tableName':'mail_servers_in','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 ddc3e73..45ca6a6 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 _0x5374=['error','code','message','result','MailServerIn','findAll','options','raw','where','limit','include','map','model','attributes','GetMailServerIn','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x4ad133,_0x26fa00){var _0x2274e2=function(_0x58e822){while(--_0x58e822){_0x4ad133['push'](_0x4ad133['shift']());}};_0x2274e2(++_0x26fa00);}(_0x5374,0xd6));var _0x4537=function(_0x36a4aa,_0x129f4a){_0x36a4aa=_0x36a4aa-0x0;var _0x2743e9=_0x5374[_0x36a4aa];return _0x2743e9;};'use strict';var _=require('lodash');var util=require(_0x4537('0x0'));var moment=require(_0x4537('0x1'));var BPromise=require('bluebird');var rs=require(_0x4537('0x2'));var fs=require('fs');var Redis=require(_0x4537('0x3'));var db=require(_0x4537('0x4'))['db'];var utils=require(_0x4537('0x5'));var logger=require(_0x4537('0x6'))(_0x4537('0x7'));var config=require(_0x4537('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4537('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a1b60,_0x295733,_0x38cac9){return new BPromise(function(_0x2e3b78,_0xcbc786){return client[_0x4537('0xa')](_0x3a1b60,_0x38cac9)[_0x4537('0xb')](function(_0x2354a4){logger[_0x4537('0xc')](_0x4537('0xd'),_0x295733,'request\x20sent');logger[_0x4537('0xe')](_0x4537('0xf'),_0x295733,_0x4537('0x10'),JSON['stringify'](_0x2354a4));if(_0x2354a4[_0x4537('0x11')]){if(_0x2354a4[_0x4537('0x11')][_0x4537('0x12')]===0x1f4){logger[_0x4537('0x11')](_0x4537('0xd'),_0x295733,_0x2354a4[_0x4537('0x11')][_0x4537('0x13')]);return _0xcbc786(_0x2354a4['error'][_0x4537('0x13')]);}logger[_0x4537('0x11')](_0x4537('0xd'),_0x295733,_0x2354a4[_0x4537('0x11')]['message']);return _0x2e3b78(_0x2354a4[_0x4537('0x11')][_0x4537('0x13')]);}else{logger[_0x4537('0xc')](_0x4537('0xd'),_0x295733,_0x4537('0x10'));_0x2e3b78(_0x2354a4[_0x4537('0x14')][_0x4537('0x13')]);}})['catch'](function(_0xb65c62){logger[_0x4537('0x11')](_0x4537('0xd'),_0x295733,_0xb65c62);_0xcbc786(_0xb65c62);});});}exports['GetMailServerIn']=function(_0x5724a4){var _0x1a5363=this;return new Promise(function(_0x4a9bb0,_0x444001){return db[_0x4537('0x15')][_0x4537('0x16')]({'raw':_0x5724a4[_0x4537('0x17')]?_0x5724a4['options'][_0x4537('0x18')]===undefined?!![]:![]:!![],'where':_0x5724a4['options']?_0x5724a4[_0x4537('0x17')][_0x4537('0x19')]||null:null,'attributes':_0x5724a4[_0x4537('0x17')]?_0x5724a4['options']['attributes']||null:null,'limit':_0x5724a4[_0x4537('0x17')]?_0x5724a4[_0x4537('0x17')][_0x4537('0x1a')]||null:null,'include':_0x5724a4['options']?_0x5724a4['options'][_0x4537('0x1b')]?_[_0x4537('0x1c')](_0x5724a4[_0x4537('0x17')][_0x4537('0x1b')],function(_0x40c7ab){return{'model':db[_0x40c7ab[_0x4537('0x1d')]],'as':_0x40c7ab['as'],'attributes':_0x40c7ab[_0x4537('0x1e')],'include':_0x40c7ab[_0x4537('0x1b')]?_[_0x4537('0x1c')](_0x40c7ab[_0x4537('0x1b')],function(_0x21b70d){return{'model':db[_0x21b70d[_0x4537('0x1d')]],'as':_0x21b70d['as'],'attributes':_0x21b70d['attributes'],'include':_0x21b70d['include']?_[_0x4537('0x1c')](_0x21b70d['include'],function(_0x1ca0d6){return{'model':db[_0x1ca0d6[_0x4537('0x1d')]],'as':_0x1ca0d6['as'],'attributes':_0x1ca0d6[_0x4537('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x550338){logger['info'](_0x4537('0x1f'),_0x5724a4);logger[_0x4537('0xe')](_0x4537('0x1f'),_0x5724a4,JSON['stringify'](_0x550338));_0x4a9bb0(_0x550338);})[_0x4537('0x20')](function(_0x42fe40){logger[_0x4537('0x11')](_0x4537('0x1f'),_0x42fe40['message'],_0x5724a4);_0x444001(_0x1a5363['error'](0x1f4,_0x42fe40[_0x4537('0x13')]));});});}; \ No newline at end of file +var _0xebff=['../../mysqldb','../../config/utils','rpc','../../config/environment','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','result','GetMailServerIn','MailServerIn','options','raw','where','attributes','limit','include','map','model','then','lodash','moment','randomstring','ioredis'];(function(_0xf22d65,_0x165ede){var _0x45a419=function(_0x17ef40){while(--_0x17ef40){_0xf22d65['push'](_0xf22d65['shift']());}};_0x45a419(++_0x165ede);}(_0xebff,0xf8));var _0xfebf=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xebff[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0xfebf('0x0'));var util=require('util');var moment=require(_0xfebf('0x1'));var BPromise=require('bluebird');var rs=require(_0xfebf('0x2'));var fs=require('fs');var Redis=require(_0xfebf('0x3'));var db=require(_0xfebf('0x4'))['db'];var utils=require(_0xfebf('0x5'));var logger=require('../../config/logger')(_0xfebf('0x6'));var config=require(_0xfebf('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x256c16,_0x4b8456,_0xf4de6e){return new BPromise(function(_0x86e9c,_0x5da9e1){return client['request'](_0x256c16,_0xf4de6e)['then'](function(_0x2d9a6c){logger[_0xfebf('0x8')](_0xfebf('0x9'),_0x4b8456,_0xfebf('0xa'));logger[_0xfebf('0xb')](_0xfebf('0xc'),_0x4b8456,_0xfebf('0xa'),JSON['stringify'](_0x2d9a6c));if(_0x2d9a6c[_0xfebf('0xd')]){if(_0x2d9a6c[_0xfebf('0xd')][_0xfebf('0xe')]===0x1f4){logger[_0xfebf('0xd')](_0xfebf('0x9'),_0x4b8456,_0x2d9a6c['error'][_0xfebf('0xf')]);return _0x5da9e1(_0x2d9a6c['error']['message']);}logger[_0xfebf('0xd')](_0xfebf('0x9'),_0x4b8456,_0x2d9a6c[_0xfebf('0xd')]['message']);return _0x86e9c(_0x2d9a6c[_0xfebf('0xd')][_0xfebf('0xf')]);}else{logger[_0xfebf('0x8')]('MailServerIn,\x20%s,\x20%s',_0x4b8456,_0xfebf('0xa'));_0x86e9c(_0x2d9a6c[_0xfebf('0x10')][_0xfebf('0xf')]);}})['catch'](function(_0x3d47fc){logger[_0xfebf('0xd')]('MailServerIn,\x20%s,\x20%s',_0x4b8456,_0x3d47fc);_0x5da9e1(_0x3d47fc);});});}exports[_0xfebf('0x11')]=function(_0x117fec){var _0x500666=this;return new Promise(function(_0x36c333,_0x37d8fb){return db[_0xfebf('0x12')]['findAll']({'raw':_0x117fec[_0xfebf('0x13')]?_0x117fec[_0xfebf('0x13')][_0xfebf('0x14')]===undefined?!![]:![]:!![],'where':_0x117fec[_0xfebf('0x13')]?_0x117fec['options'][_0xfebf('0x15')]||null:null,'attributes':_0x117fec[_0xfebf('0x13')]?_0x117fec['options'][_0xfebf('0x16')]||null:null,'limit':_0x117fec['options']?_0x117fec[_0xfebf('0x13')][_0xfebf('0x17')]||null:null,'include':_0x117fec[_0xfebf('0x13')]?_0x117fec[_0xfebf('0x13')][_0xfebf('0x18')]?_['map'](_0x117fec[_0xfebf('0x13')][_0xfebf('0x18')],function(_0x44ce08){return{'model':db[_0x44ce08['model']],'as':_0x44ce08['as'],'attributes':_0x44ce08[_0xfebf('0x16')],'include':_0x44ce08[_0xfebf('0x18')]?_[_0xfebf('0x19')](_0x44ce08['include'],function(_0x3a2a29){return{'model':db[_0x3a2a29[_0xfebf('0x1a')]],'as':_0x3a2a29['as'],'attributes':_0x3a2a29[_0xfebf('0x16')],'include':_0x3a2a29[_0xfebf('0x18')]?_['map'](_0x3a2a29[_0xfebf('0x18')],function(_0x29ef2f){return{'model':db[_0x29ef2f[_0xfebf('0x1a')]],'as':_0x29ef2f['as'],'attributes':_0x29ef2f['attributes']};}):[]};}):[]};}):[]:[]})[_0xfebf('0x1b')](function(_0x3aaa68){logger[_0xfebf('0x8')]('GetMailServerIn',_0x117fec);logger[_0xfebf('0xb')]('GetMailServerIn',_0x117fec,JSON['stringify'](_0x3aaa68));_0x36c333(_0x3aaa68);})['catch'](function(_0x4089f9){logger['error']('GetMailServerIn',_0x4089f9['message'],_0x117fec);_0x37d8fb(_0x500666['error'](0x1f4,_0x4089f9[_0xfebf('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index a043e86..f96da75 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(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7a54,0x106));var _0x47a5=function(_0x2f03fe,_0xc1a3bc){_0x2f03fe=_0x2f03fe-0x0;var _0x3df498=_0x7a54[_0x2f03fe];return _0x3df498;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x7a54,0x106));var _0x47a5=function(_0x1c8b65,_0x2a4ac4){_0x1c8b65=_0x1c8b65-0x0;var _0x428f56=_0x7a54[_0x1c8b65];return _0x428f56;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index eac802a..cbc0ec0 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 _0x24c4=['BOOLEAN','sequelize','STRING','INTEGER'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x24c4,0x165));var _0x424c=function(_0x573c4c,_0x48781f){_0x573c4c=_0x573c4c-0x0;var _0x54e20a=_0x24c4[_0x573c4c];return _0x54e20a;};'use strict';var Sequelize=require(_0x424c('0x0'));module['exports']={'description':{'type':Sequelize[_0x424c('0x1')]},'host':{'type':Sequelize[_0x424c('0x1')]},'user':{'type':Sequelize[_0x424c('0x1')]},'pass':{'type':Sequelize[_0x424c('0x1')]},'port':{'type':Sequelize[_0x424c('0x2')]},'secure':{'type':Sequelize[_0x424c('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x424c('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x17bb=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x26b80e,_0x5c9333){var _0x84a8a8=function(_0x2e5b4a){while(--_0x2e5b4a){_0x26b80e['push'](_0x26b80e['shift']());}};_0x84a8a8(++_0x5c9333);}(_0x17bb,0x80));var _0xb17b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x17bb[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0xb17b('0x0'));module[_0xb17b('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xb17b('0x2')]},'user':{'type':Sequelize[_0xb17b('0x2')]},'pass':{'type':Sequelize[_0xb17b('0x2')]},'port':{'type':Sequelize[_0xb17b('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xb17b('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 ee957f5..dcfacf3 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 _0xc50a=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','MailServerOut','rawAttributes','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','map','type','VIRTUAL','filter','options','includeAll','include','rows','catch','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv'];(function(_0x595604,_0x2cc998){var _0x1466f3=function(_0x4e1d9b){while(--_0x4e1d9b){_0x595604['push'](_0x595604['shift']());}};_0x1466f3(++_0x2cc998);}(_0xc50a,0x86));var _0xac50=function(_0x28f3c6,_0x48c850){_0x28f3c6=_0x28f3c6-0x0;var _0x3a2cbb=_0xc50a[_0x28f3c6];return _0x3a2cbb;};'use strict';var emlformat=require(_0xac50('0x0'));var rimraf=require(_0xac50('0x1'));var zipdir=require(_0xac50('0x2'));var jsonpatch=require(_0xac50('0x3'));var rp=require(_0xac50('0x4'));var moment=require(_0xac50('0x5'));var BPromise=require(_0xac50('0x6'));var Mustache=require('mustache');var util=require(_0xac50('0x7'));var path=require('path');var sox=require(_0xac50('0x8'));var csv=require(_0xac50('0x9'));var ejs=require(_0xac50('0xa'));var fs=require('fs');var fs_extra=require(_0xac50('0xb'));var _=require(_0xac50('0xc'));var squel=require(_0xac50('0xd'));var crypto=require(_0xac50('0xe'));var jsforce=require(_0xac50('0xf'));var deskjs=require(_0xac50('0x10'));var toCsv=require(_0xac50('0x9'));var querystring=require(_0xac50('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xac50('0x12'));var qs=require(_0xac50('0x13'));var as=require(_0xac50('0x14'));var hardwareService=require(_0xac50('0x15'));var logger=require('../../config/logger')(_0xac50('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xac50('0x17'));var db=require(_0xac50('0x18'))['db'];function respondWithStatusCode(_0x21157b,_0x416184){_0x416184=_0x416184||0xcc;return function(_0xcc8789){if(_0xcc8789){return _0x21157b[_0xac50('0x19')](_0x416184);}return _0x21157b[_0xac50('0x1a')](_0x416184)[_0xac50('0x1b')]();};}function respondWithResult(_0x38a1dd,_0x4dbf9b){_0x4dbf9b=_0x4dbf9b||0xc8;return function(_0x38aac6){if(_0x38aac6){return _0x38a1dd[_0xac50('0x1a')](_0x4dbf9b)[_0xac50('0x1c')](_0x38aac6);}};}function respondWithFilteredResult(_0x496c71,_0x46b515){return function(_0x49aa5f){if(_0x49aa5f){var _0x4c4bb6=typeof _0x46b515[_0xac50('0x1d')]===_0xac50('0x1e')&&typeof _0x46b515[_0xac50('0x1f')]===_0xac50('0x1e');var _0x2b2f65=_0x49aa5f[_0xac50('0x20')];var _0x584a1d=_0x4c4bb6?0x0:_0x46b515[_0xac50('0x1d')];var _0x506e09=_0x4c4bb6?_0x49aa5f[_0xac50('0x20')]:_0x46b515[_0xac50('0x1d')]+_0x46b515[_0xac50('0x1f')];var _0x420cc2;if(_0x506e09>=_0x2b2f65){_0x506e09=_0x2b2f65;_0x420cc2=0xc8;}else{_0x420cc2=0xce;}_0x496c71[_0xac50('0x1a')](_0x420cc2);return _0x496c71[_0xac50('0x21')](_0xac50('0x22'),_0x584a1d+'-'+_0x506e09+'/'+_0x2b2f65)['json'](_0x49aa5f);}return null;};}function patchUpdates(_0x2d781f){return function(_0x42a7f6){try{jsonpatch[_0xac50('0x23')](_0x42a7f6,_0x2d781f,!![]);}catch(_0x415aba){return BPromise[_0xac50('0x24')](_0x415aba);}return _0x42a7f6[_0xac50('0x25')]();};}function saveUpdates(_0x5460b9,_0x3b13b2){return function(_0x12fbbd){if(_0x12fbbd){return _0x12fbbd['update'](_0x5460b9)[_0xac50('0x26')](function(_0x209d9f){return _0x209d9f;});}return null;};}function removeEntity(_0x404cd8,_0xeaa8d5){return function(_0x258923){if(_0x258923){return _0x258923[_0xac50('0x27')]()['then'](function(){_0x404cd8[_0xac50('0x1a')](0xcc)[_0xac50('0x1b')]();});}};}function handleEntityNotFound(_0x519acc,_0x1b27e6){return function(_0x48f53c){if(!_0x48f53c){_0x519acc[_0xac50('0x19')](0x194);}return _0x48f53c;};}function handleError(_0x340599,_0xcf1891){_0xcf1891=_0xcf1891||0x1f4;return function(_0x47231e){logger['error'](_0x47231e[_0xac50('0x28')]);if(_0x47231e[_0xac50('0x29')]){delete _0x47231e[_0xac50('0x29')];}_0x340599[_0xac50('0x1a')](_0xcf1891)[_0xac50('0x2a')](_0x47231e);};}exports['index']=function(_0x41272a,_0x1c0c75){var _0x331606={},_0x546b09={},_0x101922={'count':0x0,'rows':[]};var _0xd64b9e=_['map'](db[_0xac50('0x2b')][_0xac50('0x2c')],function(_0x4aeaa9){return{'name':_0x4aeaa9['fieldName'],'type':_0x4aeaa9['type']['key']};});_0x546b09['model']=_['map'](_0xd64b9e,'name');_0x546b09[_0xac50('0x2d')]=_[_0xac50('0x2e')](_0x41272a[_0xac50('0x2d')]);_0x546b09[_0xac50('0x2f')]=_[_0xac50('0x30')](_0x546b09['model'],_0x546b09[_0xac50('0x2d')]);_0x331606[_0xac50('0x31')]=_[_0xac50('0x30')](_0x546b09[_0xac50('0x32')],qs[_0xac50('0x33')](_0x41272a[_0xac50('0x2d')][_0xac50('0x33')]));_0x331606['attributes']=_0x331606[_0xac50('0x31')][_0xac50('0x34')]?_0x331606[_0xac50('0x31')]:_0x546b09[_0xac50('0x32')];if(!_0x41272a[_0xac50('0x2d')][_0xac50('0x35')](_0xac50('0x36'))){_0x331606[_0xac50('0x1f')]=qs[_0xac50('0x1f')](_0x41272a[_0xac50('0x2d')][_0xac50('0x1f')]);_0x331606[_0xac50('0x1d')]=qs[_0xac50('0x1d')](_0x41272a[_0xac50('0x2d')]['offset']);}_0x331606['order']=qs[_0xac50('0x37')](_0x41272a[_0xac50('0x2d')][_0xac50('0x37')]);_0x331606[_0xac50('0x38')]=qs['filters'](_[_0xac50('0x39')](_0x41272a[_0xac50('0x2d')],_0x546b09[_0xac50('0x2f')]),_0xd64b9e);if(_0x41272a[_0xac50('0x2d')]['filter']){_0x331606[_0xac50('0x38')]=_[_0xac50('0x3a')](_0x331606[_0xac50('0x38')],{'$or':_[_0xac50('0x3b')](_0xd64b9e,function(_0x53d281){if(_0x53d281[_0xac50('0x3c')]!==_0xac50('0x3d')){var _0x6128b5={};_0x6128b5[_0x53d281[_0xac50('0x29')]]={'$like':'%'+_0x41272a[_0xac50('0x2d')][_0xac50('0x3e')]+'%'};return _0x6128b5;}})});}_0x331606=_[_0xac50('0x3a')]({},_0x331606,_0x41272a[_0xac50('0x3f')]);var _0x4a115b={'where':_0x331606[_0xac50('0x38')]};return db[_0xac50('0x2b')]['count'](_0x4a115b)[_0xac50('0x26')](function(_0x4d7bfa){_0x101922['count']=_0x4d7bfa;if(_0x41272a['query'][_0xac50('0x40')]){_0x331606[_0xac50('0x41')]=[{'all':!![]}];}return db['MailServerOut']['findAll'](_0x331606);})[_0xac50('0x26')](function(_0x3d0337){_0x101922[_0xac50('0x42')]=_0x3d0337;return _0x101922;})[_0xac50('0x26')](respondWithFilteredResult(_0x1c0c75,_0x331606))[_0xac50('0x43')](handleError(_0x1c0c75,null));};exports['show']=function(_0xfd85a0,_0x22a101){var _0x33ee62={'raw':!![],'where':{'id':_0xfd85a0['params']['id']}},_0xa77b3b={};_0xa77b3b[_0xac50('0x32')]=_[_0xac50('0x2e')](db['MailServerOut'][_0xac50('0x2c')]);_0xa77b3b[_0xac50('0x2d')]=_[_0xac50('0x2e')](_0xfd85a0[_0xac50('0x2d')]);_0xa77b3b[_0xac50('0x2f')]=_['intersection'](_0xa77b3b[_0xac50('0x32')],_0xa77b3b[_0xac50('0x2d')]);_0x33ee62[_0xac50('0x31')]=_[_0xac50('0x30')](_0xa77b3b[_0xac50('0x32')],qs[_0xac50('0x33')](_0xfd85a0[_0xac50('0x2d')][_0xac50('0x33')]));_0x33ee62[_0xac50('0x31')]=_0x33ee62[_0xac50('0x31')][_0xac50('0x34')]?_0x33ee62[_0xac50('0x31')]:_0xa77b3b[_0xac50('0x32')];if(_0xfd85a0[_0xac50('0x2d')][_0xac50('0x40')]){_0x33ee62[_0xac50('0x41')]=[{'all':!![]}];}_0x33ee62=_[_0xac50('0x3a')]({},_0x33ee62,_0xfd85a0[_0xac50('0x3f')]);return db['MailServerOut'][_0xac50('0x44')](_0x33ee62)[_0xac50('0x26')](handleEntityNotFound(_0x22a101,null))['then'](respondWithResult(_0x22a101,null))[_0xac50('0x43')](handleError(_0x22a101,null));};exports[_0xac50('0x45')]=function(_0x41d881,_0x5746e1){return db['MailServerOut'][_0xac50('0x45')](_0x41d881[_0xac50('0x46')],{})[_0xac50('0x26')](respondWithResult(_0x5746e1,0xc9))[_0xac50('0x43')](handleError(_0x5746e1,null));};exports['update']=function(_0x5c199a,_0x41ccef){if(_0x5c199a[_0xac50('0x46')]['id']){delete _0x5c199a[_0xac50('0x46')]['id'];}return db[_0xac50('0x2b')]['find']({'where':{'id':_0x5c199a[_0xac50('0x47')]['id']}})[_0xac50('0x26')](handleEntityNotFound(_0x41ccef,null))[_0xac50('0x26')](saveUpdates(_0x5c199a[_0xac50('0x46')],null))[_0xac50('0x26')](respondWithResult(_0x41ccef,null))[_0xac50('0x43')](handleError(_0x41ccef,null));};exports['destroy']=function(_0x43b316,_0x2cbae2){return db[_0xac50('0x2b')][_0xac50('0x44')]({'where':{'id':_0x43b316['params']['id']}})['then'](handleEntityNotFound(_0x2cbae2,null))['then'](removeEntity(_0x2cbae2,null))[_0xac50('0x43')](handleError(_0x2cbae2,null));}; \ No newline at end of file +var _0x2965=['MailServerOut','rawAttributes','fieldName','type','key','model','keys','filters','intersection','fields','query','attributes','length','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','show','params','merge','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map'];(function(_0x451f88,_0x5c061a){var _0x2cc2b7=function(_0x5bb6ce){while(--_0x5bb6ce){_0x451f88['push'](_0x451f88['shift']());}};_0x2cc2b7(++_0x5c061a);}(_0x2965,0xbb));var _0x5296=function(_0x12f2ee,_0x7ebbf8){_0x12f2ee=_0x12f2ee-0x0;var _0x1bb207=_0x2965[_0x12f2ee];return _0x1bb207;};'use strict';var emlformat=require(_0x5296('0x0'));var rimraf=require(_0x5296('0x1'));var zipdir=require(_0x5296('0x2'));var jsonpatch=require(_0x5296('0x3'));var rp=require(_0x5296('0x4'));var moment=require(_0x5296('0x5'));var BPromise=require(_0x5296('0x6'));var Mustache=require(_0x5296('0x7'));var util=require(_0x5296('0x8'));var path=require(_0x5296('0x9'));var sox=require(_0x5296('0xa'));var csv=require(_0x5296('0xb'));var ejs=require(_0x5296('0xc'));var fs=require('fs');var fs_extra=require(_0x5296('0xd'));var _=require(_0x5296('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5296('0xf'));var toCsv=require(_0x5296('0xb'));var querystring=require('querystring');var Papa=require(_0x5296('0x10'));var Redis=require(_0x5296('0x11'));var authService=require(_0x5296('0x12'));var qs=require(_0x5296('0x13'));var as=require(_0x5296('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5296('0x15'))(_0x5296('0x16'));var utils=require(_0x5296('0x17'));var config=require(_0x5296('0x18'));var licenseUtil=require(_0x5296('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a3810,_0x4bd45c){_0x4bd45c=_0x4bd45c||0xcc;return function(_0x521490){if(_0x521490){return _0x3a3810[_0x5296('0x1a')](_0x4bd45c);}return _0x3a3810[_0x5296('0x1b')](_0x4bd45c)[_0x5296('0x1c')]();};}function respondWithResult(_0x5d9906,_0x48469b){_0x48469b=_0x48469b||0xc8;return function(_0x9ed520){if(_0x9ed520){return _0x5d9906[_0x5296('0x1b')](_0x48469b)[_0x5296('0x1d')](_0x9ed520);}};}function respondWithFilteredResult(_0x441261,_0x4bdaf4){return function(_0x2a9de0){if(_0x2a9de0){var _0x1a4cb6=typeof _0x4bdaf4[_0x5296('0x1e')]===_0x5296('0x1f')&&typeof _0x4bdaf4[_0x5296('0x20')]==='undefined';var _0x173afe=_0x2a9de0[_0x5296('0x21')];var _0x1f1cce=_0x1a4cb6?0x0:_0x4bdaf4[_0x5296('0x1e')];var _0x23a974=_0x1a4cb6?_0x2a9de0[_0x5296('0x21')]:_0x4bdaf4['offset']+_0x4bdaf4[_0x5296('0x20')];var _0x4a8f71;if(_0x23a974>=_0x173afe){_0x23a974=_0x173afe;_0x4a8f71=0xc8;}else{_0x4a8f71=0xce;}_0x441261[_0x5296('0x1b')](_0x4a8f71);return _0x441261[_0x5296('0x22')](_0x5296('0x23'),_0x1f1cce+'-'+_0x23a974+'/'+_0x173afe)[_0x5296('0x1d')](_0x2a9de0);}return null;};}function patchUpdates(_0x4370be){return function(_0xc24d0b){try{jsonpatch[_0x5296('0x24')](_0xc24d0b,_0x4370be,!![]);}catch(_0x1d2db0){return BPromise[_0x5296('0x25')](_0x1d2db0);}return _0xc24d0b['save']();};}function saveUpdates(_0x23a9a9,_0x49aa34){return function(_0x400fba){if(_0x400fba){return _0x400fba[_0x5296('0x26')](_0x23a9a9)[_0x5296('0x27')](function(_0x480c4a){return _0x480c4a;});}return null;};}function removeEntity(_0x42603e,_0x1df61c){return function(_0x5edb98){if(_0x5edb98){return _0x5edb98[_0x5296('0x28')]()['then'](function(){_0x42603e[_0x5296('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d2b50,_0x573fd7){return function(_0x2c8889){if(!_0x2c8889){_0x1d2b50[_0x5296('0x1a')](0x194);}return _0x2c8889;};}function handleError(_0x591bed,_0x59928b){_0x59928b=_0x59928b||0x1f4;return function(_0x2f034e){logger[_0x5296('0x29')](_0x2f034e[_0x5296('0x2a')]);if(_0x2f034e[_0x5296('0x2b')]){delete _0x2f034e[_0x5296('0x2b')];}_0x591bed['status'](_0x59928b)[_0x5296('0x2c')](_0x2f034e);};}exports[_0x5296('0x2d')]=function(_0x2e1037,_0x510161){var _0x3cbc79={},_0x564a9b={},_0x5ad107={'count':0x0,'rows':[]};var _0x165d7f=_[_0x5296('0x2e')](db[_0x5296('0x2f')][_0x5296('0x30')],function(_0x127f9d){return{'name':_0x127f9d[_0x5296('0x31')],'type':_0x127f9d[_0x5296('0x32')][_0x5296('0x33')]};});_0x564a9b[_0x5296('0x34')]=_[_0x5296('0x2e')](_0x165d7f,_0x5296('0x2b'));_0x564a9b['query']=_[_0x5296('0x35')](_0x2e1037['query']);_0x564a9b[_0x5296('0x36')]=_[_0x5296('0x37')](_0x564a9b[_0x5296('0x34')],_0x564a9b['query']);_0x3cbc79['attributes']=_['intersection'](_0x564a9b[_0x5296('0x34')],qs[_0x5296('0x38')](_0x2e1037[_0x5296('0x39')][_0x5296('0x38')]));_0x3cbc79[_0x5296('0x3a')]=_0x3cbc79[_0x5296('0x3a')][_0x5296('0x3b')]?_0x3cbc79['attributes']:_0x564a9b[_0x5296('0x34')];if(!_0x2e1037[_0x5296('0x39')]['hasOwnProperty'](_0x5296('0x3c'))){_0x3cbc79['limit']=qs[_0x5296('0x20')](_0x2e1037[_0x5296('0x39')][_0x5296('0x20')]);_0x3cbc79[_0x5296('0x1e')]=qs[_0x5296('0x1e')](_0x2e1037[_0x5296('0x39')][_0x5296('0x1e')]);}_0x3cbc79[_0x5296('0x3d')]=qs[_0x5296('0x3e')](_0x2e1037[_0x5296('0x39')][_0x5296('0x3e')]);_0x3cbc79[_0x5296('0x3f')]=qs['filters'](_[_0x5296('0x40')](_0x2e1037[_0x5296('0x39')],_0x564a9b['filters']),_0x165d7f);if(_0x2e1037[_0x5296('0x39')][_0x5296('0x41')]){_0x3cbc79['where']=_['merge'](_0x3cbc79[_0x5296('0x3f')],{'$or':_[_0x5296('0x2e')](_0x165d7f,function(_0xdf6fed){if(_0xdf6fed['type']!=='VIRTUAL'){var _0x2ae71e={};_0x2ae71e[_0xdf6fed['name']]={'$like':'%'+_0x2e1037[_0x5296('0x39')][_0x5296('0x41')]+'%'};return _0x2ae71e;}})});}_0x3cbc79=_['merge']({},_0x3cbc79,_0x2e1037[_0x5296('0x42')]);var _0xb4bd74={'where':_0x3cbc79['where']};return db[_0x5296('0x2f')][_0x5296('0x21')](_0xb4bd74)[_0x5296('0x27')](function(_0x3dd6f3){_0x5ad107[_0x5296('0x21')]=_0x3dd6f3;if(_0x2e1037[_0x5296('0x39')][_0x5296('0x43')]){_0x3cbc79[_0x5296('0x44')]=[{'all':!![]}];}return db[_0x5296('0x2f')][_0x5296('0x45')](_0x3cbc79);})[_0x5296('0x27')](function(_0x19bb0c){_0x5ad107[_0x5296('0x46')]=_0x19bb0c;return _0x5ad107;})[_0x5296('0x27')](respondWithFilteredResult(_0x510161,_0x3cbc79))['catch'](handleError(_0x510161,null));};exports[_0x5296('0x47')]=function(_0x2f0856,_0x1ff81b){var _0x345ed0={'raw':!![],'where':{'id':_0x2f0856[_0x5296('0x48')]['id']}},_0x363dbe={};_0x363dbe[_0x5296('0x34')]=_[_0x5296('0x35')](db['MailServerOut']['rawAttributes']);_0x363dbe[_0x5296('0x39')]=_[_0x5296('0x35')](_0x2f0856[_0x5296('0x39')]);_0x363dbe['filters']=_['intersection'](_0x363dbe[_0x5296('0x34')],_0x363dbe[_0x5296('0x39')]);_0x345ed0[_0x5296('0x3a')]=_[_0x5296('0x37')](_0x363dbe[_0x5296('0x34')],qs[_0x5296('0x38')](_0x2f0856['query'][_0x5296('0x38')]));_0x345ed0[_0x5296('0x3a')]=_0x345ed0[_0x5296('0x3a')][_0x5296('0x3b')]?_0x345ed0[_0x5296('0x3a')]:_0x363dbe[_0x5296('0x34')];if(_0x2f0856['query']['includeAll']){_0x345ed0[_0x5296('0x44')]=[{'all':!![]}];}_0x345ed0=_[_0x5296('0x49')]({},_0x345ed0,_0x2f0856[_0x5296('0x42')]);return db[_0x5296('0x2f')][_0x5296('0x4a')](_0x345ed0)[_0x5296('0x27')](handleEntityNotFound(_0x1ff81b,null))[_0x5296('0x27')](respondWithResult(_0x1ff81b,null))[_0x5296('0x4b')](handleError(_0x1ff81b,null));};exports[_0x5296('0x4c')]=function(_0x573e6e,_0x45e34e){return db[_0x5296('0x2f')][_0x5296('0x4c')](_0x573e6e[_0x5296('0x4d')],{})[_0x5296('0x27')](respondWithResult(_0x45e34e,0xc9))[_0x5296('0x4b')](handleError(_0x45e34e,null));};exports[_0x5296('0x26')]=function(_0x23edc5,_0x1fa024){if(_0x23edc5[_0x5296('0x4d')]['id']){delete _0x23edc5[_0x5296('0x4d')]['id'];}return db[_0x5296('0x2f')]['find']({'where':{'id':_0x23edc5['params']['id']}})[_0x5296('0x27')](handleEntityNotFound(_0x1fa024,null))[_0x5296('0x27')](saveUpdates(_0x23edc5['body'],null))['then'](respondWithResult(_0x1fa024,null))[_0x5296('0x4b')](handleError(_0x1fa024,null));};exports[_0x5296('0x28')]=function(_0x4dacb6,_0x54f2c3){return db[_0x5296('0x2f')][_0x5296('0x4a')]({'where':{'id':_0x4dacb6[_0x5296('0x48')]['id']}})['then'](handleEntityNotFound(_0x54f2c3,null))['then'](removeEntity(_0x54f2c3,null))['catch'](handleError(_0x54f2c3,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 34d3653..244137e 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 _0x452c=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out'];(function(_0x14b80c,_0x118d6c){var _0xe04a45=function(_0x2a4947){while(--_0x2a4947){_0x14b80c['push'](_0x14b80c['shift']());}};_0xe04a45(++_0x118d6c);}(_0x452c,0x9c));var _0xc452=function(_0x11d93c,_0x12e587){_0x11d93c=_0x11d93c-0x0;var _0x359382=_0x452c[_0x11d93c];return _0x359382;};'use strict';var _=require('lodash');var util=require(_0xc452('0x0'));var logger=require('../../config/logger')(_0xc452('0x1'));var moment=require(_0xc452('0x2'));var BPromise=require(_0xc452('0x3'));var rp=require(_0xc452('0x4'));var fs=require('fs');var path=require(_0xc452('0x5'));var rimraf=require(_0xc452('0x6'));var config=require(_0xc452('0x7'));var attributes=require(_0xc452('0x8'));module[_0xc452('0x9')]=function(_0x54eddf,_0x1c8abe){return _0x54eddf[_0xc452('0xa')](_0xc452('0xb'),attributes,{'tableName':_0xc452('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7290=['./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x384a15,_0x1f06c7){var _0x2d4f1d=function(_0x5a5316){while(--_0x5a5316){_0x384a15['push'](_0x384a15['shift']());}};_0x2d4f1d(++_0x1f06c7);}(_0x7290,0x12b));var _0x0729=function(_0x2c73fa,_0x41b660){_0x2c73fa=_0x2c73fa-0x0;var _0x201374=_0x7290[_0x2c73fa];return _0x201374;};'use strict';var _=require(_0x0729('0x0'));var util=require(_0x0729('0x1'));var logger=require(_0x0729('0x2'))(_0x0729('0x3'));var moment=require('moment');var BPromise=require(_0x0729('0x4'));var rp=require(_0x0729('0x5'));var fs=require('fs');var path=require(_0x0729('0x6'));var rimraf=require(_0x0729('0x7'));var config=require(_0x0729('0x8'));var attributes=require(_0x0729('0x9'));module[_0x0729('0xa')]=function(_0x51bf5c,_0x1df58e){return _0x51bf5c[_0x0729('0xb')](_0x0729('0xc'),attributes,{'tableName':_0x0729('0xd'),'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 9de918d..9739d6c 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x37445a,_0xc58f5){var _0x1c5358=function(_0x3ca945){while(--_0x3ca945){_0x37445a['push'](_0x37445a['shift']());}};_0x1c5358(++_0xc58f5);}(_0x5f2f,0x73));var _0xf5f2=function(_0xab36f5,_0x8eb92a){_0xab36f5=_0xab36f5-0x0;var _0x20c769=_0x5f2f[_0xab36f5];return _0x20c769;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x4da544,_0x3f2277){var _0x4b6f99=function(_0x58b80c){while(--_0x58b80c){_0x4da544['push'](_0x4da544['shift']());}};_0x4b6f99(++_0x3f2277);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5295d3,_0x2a71bc){_0x5295d3=_0x5295d3-0x0;var _0x52fe19=_0x5f2f[_0x5295d3];return _0x52fe19;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 752990d..72862e6 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 _0xcb27=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','/describe','describe','isAuthenticated','show','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x16021d,_0x35d0bc){var _0x376ed0=function(_0x86da0e){while(--_0x86da0e){_0x16021d['push'](_0x16021d['shift']());}};_0x376ed0(++_0x35d0bc);}(_0xcb27,0x169));var _0x7cb2=function(_0x43a253,_0x49dcfd){_0x43a253=_0x43a253-0x0;var _0x7b590a=_0xcb27[_0x43a253];return _0x7b590a;};'use strict';var multer=require(_0x7cb2('0x0'));var util=require(_0x7cb2('0x1'));var path=require(_0x7cb2('0x2'));var timeout=require(_0x7cb2('0x3'));var express=require(_0x7cb2('0x4'));var router=express[_0x7cb2('0x5')]();var fs_extra=require(_0x7cb2('0x6'));var auth=require(_0x7cb2('0x7'));var interaction=require(_0x7cb2('0x8'));var config=require(_0x7cb2('0x9'));var controller=require(_0x7cb2('0xa'));router[_0x7cb2('0xb')]('/',auth['isAuthenticated'](),controller[_0x7cb2('0xc')]);router[_0x7cb2('0xb')](_0x7cb2('0xd'),auth['isAuthenticated'](),controller[_0x7cb2('0xe')]);router[_0x7cb2('0xb')]('/:id',auth[_0x7cb2('0xf')](),controller[_0x7cb2('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7cb2('0x11')]);router[_0x7cb2('0x12')](_0x7cb2('0x13'),auth[_0x7cb2('0xf')](),controller[_0x7cb2('0x14')]);router[_0x7cb2('0x15')]('/:id',auth[_0x7cb2('0xf')](),controller[_0x7cb2('0x16')]);module['exports']=router; \ No newline at end of file +var _0xf460=['show','post','put','/:id','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf460,0x1e1));var _0x0f46=function(_0x1fc09c,_0x3a4d56){_0x1fc09c=_0x1fc09c-0x0;var _0x390272=_0xf460[_0x1fc09c];return _0x390272;};'use strict';var multer=require(_0x0f46('0x0'));var util=require(_0x0f46('0x1'));var path=require(_0x0f46('0x2'));var timeout=require(_0x0f46('0x3'));var express=require('express');var router=express[_0x0f46('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0f46('0x5'));var interaction=require(_0x0f46('0x6'));var config=require('../../config/environment');var controller=require(_0x0f46('0x7'));router[_0x0f46('0x8')]('/',auth[_0x0f46('0x9')](),controller[_0x0f46('0xa')]);router['get'](_0x0f46('0xb'),auth['isAuthenticated'](),controller[_0x0f46('0xc')]);router[_0x0f46('0x8')]('/:id',auth[_0x0f46('0x9')](),controller[_0x0f46('0xd')]);router[_0x0f46('0xe')]('/',auth[_0x0f46('0x9')](),controller['create']);router[_0x0f46('0xf')](_0x0f46('0x10'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x0f46('0x10'),auth[_0x0f46('0x9')](),controller[_0x0f46('0x11')]);module[_0x0f46('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 3cfde78..9a73321 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 _0x4873=['exports','STRING','sequelize'];(function(_0x5936e6,_0xce4f37){var _0x292974=function(_0x2ab267){while(--_0x2ab267){_0x5936e6['push'](_0x5936e6['shift']());}};_0x292974(++_0xce4f37);}(_0x4873,0x1df));var _0x3487=function(_0x563252,_0x40edfd){_0x563252=_0x563252-0x0;var _0x1f15c8=_0x4873[_0x563252];return _0x1f15c8;};'use strict';var Sequelize=require(_0x3487('0x0'));module[_0x3487('0x1')]={'name':{'type':Sequelize[_0x3487('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3487('0x2')]}}; \ No newline at end of file +var _0x13f5=['exports','STRING','name','sequelize'];(function(_0x3f52ba,_0x47b62c){var _0x22c92f=function(_0x54b42a){while(--_0x54b42a){_0x3f52ba['push'](_0x3f52ba['shift']());}};_0x22c92f(++_0x47b62c);}(_0x13f5,0xc3));var _0x513f=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x13f5[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x513f('0x0'));module[_0x513f('0x1')]={'name':{'type':Sequelize[_0x513f('0x2')],'unique':_0x513f('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 08ef4f5..1e9216d 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 _0x297e=['where','pick','merge','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x365e17,_0x18b8c2){var _0x788da7=function(_0x1f4dbb){while(--_0x1f4dbb){_0x365e17['push'](_0x365e17['shift']());}};_0x788da7(++_0x18b8c2);}(_0x297e,0xf7));var _0xe297=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x297e[_0x5d6456];return _0x4d66c1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe297('0x0'));var jsonpatch=require(_0xe297('0x1'));var rp=require(_0xe297('0x2'));var moment=require(_0xe297('0x3'));var BPromise=require(_0xe297('0x4'));var Mustache=require(_0xe297('0x5'));var util=require('util');var path=require(_0xe297('0x6'));var sox=require(_0xe297('0x7'));var csv=require(_0xe297('0x8'));var ejs=require(_0xe297('0x9'));var fs=require('fs');var fs_extra=require(_0xe297('0xa'));var _=require(_0xe297('0xb'));var squel=require(_0xe297('0xc'));var crypto=require(_0xe297('0xd'));var jsforce=require(_0xe297('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe297('0xf'));var Papa=require(_0xe297('0x10'));var Redis=require(_0xe297('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe297('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe297('0x13'));var logger=require(_0xe297('0x14'))(_0xe297('0x15'));var utils=require(_0xe297('0x16'));var config=require(_0xe297('0x17'));var licenseUtil=require(_0xe297('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2cd1de,_0x2a4a61){_0x2a4a61=_0x2a4a61||0xcc;return function(_0x40147f){if(_0x40147f){return _0x2cd1de[_0xe297('0x19')](_0x2a4a61);}return _0x2cd1de[_0xe297('0x1a')](_0x2a4a61)[_0xe297('0x1b')]();};}function respondWithResult(_0x13485d,_0x2a1b5a){_0x2a1b5a=_0x2a1b5a||0xc8;return function(_0x4788a0){if(_0x4788a0){return _0x13485d[_0xe297('0x1a')](_0x2a1b5a)['json'](_0x4788a0);}};}function respondWithFilteredResult(_0x518ba2,_0x45db64){return function(_0x328895){if(_0x328895){var _0x40b358=typeof _0x45db64[_0xe297('0x1c')]===_0xe297('0x1d')&&typeof _0x45db64[_0xe297('0x1e')]===_0xe297('0x1d');var _0x5befc5=_0x328895['count'];var _0x949589=_0x40b358?0x0:_0x45db64[_0xe297('0x1c')];var _0x5e4971=_0x40b358?_0x328895[_0xe297('0x1f')]:_0x45db64[_0xe297('0x1c')]+_0x45db64[_0xe297('0x1e')];var _0x101e29;if(_0x5e4971>=_0x5befc5){_0x5e4971=_0x5befc5;_0x101e29=0xc8;}else{_0x101e29=0xce;}_0x518ba2[_0xe297('0x1a')](_0x101e29);return _0x518ba2[_0xe297('0x20')](_0xe297('0x21'),_0x949589+'-'+_0x5e4971+'/'+_0x5befc5)[_0xe297('0x22')](_0x328895);}return null;};}function patchUpdates(_0x120fee){return function(_0x4cef8c){try{jsonpatch['apply'](_0x4cef8c,_0x120fee,!![]);}catch(_0xfeda95){return BPromise[_0xe297('0x23')](_0xfeda95);}return _0x4cef8c['save']();};}function saveUpdates(_0x32b617,_0x16764a){return function(_0x53a422){if(_0x53a422){return _0x53a422[_0xe297('0x24')](_0x32b617)[_0xe297('0x25')](function(_0x2ead3e){return _0x2ead3e;});}return null;};}function removeEntity(_0x4fd20d,_0x543f02){return function(_0x7a01cf){if(_0x7a01cf){return _0x7a01cf['destroy']()['then'](function(){_0x4fd20d['status'](0xcc)[_0xe297('0x1b')]();});}};}function handleEntityNotFound(_0x37ee2a,_0x4194cc){return function(_0x3f86c7){if(!_0x3f86c7){_0x37ee2a[_0xe297('0x19')](0x194);}return _0x3f86c7;};}function handleError(_0x54a835,_0x2b3d58){_0x2b3d58=_0x2b3d58||0x1f4;return function(_0x2d8e8f){logger[_0xe297('0x26')](_0x2d8e8f[_0xe297('0x27')]);if(_0x2d8e8f[_0xe297('0x28')]){delete _0x2d8e8f[_0xe297('0x28')];}_0x54a835[_0xe297('0x1a')](_0x2b3d58)[_0xe297('0x29')](_0x2d8e8f);};}exports[_0xe297('0x2a')]=function(_0x4e7614,_0x618a7e){var _0xa62c3b={},_0x29fcbe={},_0x3c2b5c={'count':0x0,'rows':[]};var _0xdd7de8=_[_0xe297('0x2b')](db[_0xe297('0x2c')][_0xe297('0x2d')],function(_0x3d88fc){return{'name':_0x3d88fc[_0xe297('0x2e')],'type':_0x3d88fc[_0xe297('0x2f')][_0xe297('0x30')]};});_0x29fcbe[_0xe297('0x31')]=_['map'](_0xdd7de8,_0xe297('0x28'));_0x29fcbe['query']=_[_0xe297('0x32')](_0x4e7614[_0xe297('0x33')]);_0x29fcbe[_0xe297('0x34')]=_['intersection'](_0x29fcbe[_0xe297('0x31')],_0x29fcbe['query']);_0xa62c3b[_0xe297('0x35')]=_[_0xe297('0x36')](_0x29fcbe[_0xe297('0x31')],qs[_0xe297('0x37')](_0x4e7614[_0xe297('0x33')][_0xe297('0x37')]));_0xa62c3b[_0xe297('0x35')]=_0xa62c3b[_0xe297('0x35')][_0xe297('0x38')]?_0xa62c3b[_0xe297('0x35')]:_0x29fcbe[_0xe297('0x31')];if(!_0x4e7614['query'][_0xe297('0x39')](_0xe297('0x3a'))){_0xa62c3b['limit']=qs[_0xe297('0x1e')](_0x4e7614[_0xe297('0x33')][_0xe297('0x1e')]);_0xa62c3b[_0xe297('0x1c')]=qs[_0xe297('0x1c')](_0x4e7614[_0xe297('0x33')][_0xe297('0x1c')]);}_0xa62c3b[_0xe297('0x3b')]=qs['sort'](_0x4e7614[_0xe297('0x33')][_0xe297('0x3c')]);_0xa62c3b[_0xe297('0x3d')]=qs[_0xe297('0x34')](_[_0xe297('0x3e')](_0x4e7614[_0xe297('0x33')],_0x29fcbe[_0xe297('0x34')]),_0xdd7de8);if(_0x4e7614['query']['filter']){_0xa62c3b[_0xe297('0x3d')]=_[_0xe297('0x3f')](_0xa62c3b['where'],{'$or':_[_0xe297('0x2b')](_0xdd7de8,function(_0x323973){if(_0x323973[_0xe297('0x2f')]!=='VIRTUAL'){var _0x44e46a={};_0x44e46a[_0x323973['name']]={'$like':'%'+_0x4e7614[_0xe297('0x33')][_0xe297('0x40')]+'%'};return _0x44e46a;}})});}_0xa62c3b=_[_0xe297('0x3f')]({},_0xa62c3b,_0x4e7614[_0xe297('0x41')]);var _0x1559be={'where':_0xa62c3b[_0xe297('0x3d')]};return db['MailSubstatus'][_0xe297('0x1f')](_0x1559be)[_0xe297('0x25')](function(_0x40abc2){_0x3c2b5c[_0xe297('0x1f')]=_0x40abc2;if(_0x4e7614[_0xe297('0x33')][_0xe297('0x42')]){_0xa62c3b[_0xe297('0x43')]=[{'all':!![]}];}return db['MailSubstatus'][_0xe297('0x44')](_0xa62c3b);})[_0xe297('0x25')](function(_0x1e7039){_0x3c2b5c['rows']=_0x1e7039;return _0x3c2b5c;})['then'](respondWithFilteredResult(_0x618a7e,_0xa62c3b))[_0xe297('0x45')](handleError(_0x618a7e,null));};exports[_0xe297('0x46')]=function(_0x4c220d,_0x523c4a){var _0x22185b={'raw':!![],'where':{'id':_0x4c220d[_0xe297('0x47')]['id']}},_0x30cb0d={};_0x30cb0d[_0xe297('0x31')]=_[_0xe297('0x32')](db[_0xe297('0x2c')]['rawAttributes']);_0x30cb0d[_0xe297('0x33')]=_[_0xe297('0x32')](_0x4c220d[_0xe297('0x33')]);_0x30cb0d[_0xe297('0x34')]=_[_0xe297('0x36')](_0x30cb0d['model'],_0x30cb0d['query']);_0x22185b[_0xe297('0x35')]=_[_0xe297('0x36')](_0x30cb0d['model'],qs[_0xe297('0x37')](_0x4c220d[_0xe297('0x33')][_0xe297('0x37')]));_0x22185b[_0xe297('0x35')]=_0x22185b[_0xe297('0x35')][_0xe297('0x38')]?_0x22185b[_0xe297('0x35')]:_0x30cb0d[_0xe297('0x31')];if(_0x4c220d[_0xe297('0x33')][_0xe297('0x42')]){_0x22185b['include']=[{'all':!![]}];}_0x22185b=_[_0xe297('0x3f')]({},_0x22185b,_0x4c220d[_0xe297('0x41')]);return db[_0xe297('0x2c')][_0xe297('0x48')](_0x22185b)[_0xe297('0x25')](handleEntityNotFound(_0x523c4a,null))[_0xe297('0x25')](respondWithResult(_0x523c4a,null))[_0xe297('0x45')](handleError(_0x523c4a,null));};exports[_0xe297('0x49')]=function(_0x5e2488,_0x125112){return db['MailSubstatus'][_0xe297('0x49')](_0x5e2488[_0xe297('0x4a')],{})['then'](respondWithResult(_0x125112,0xc9))[_0xe297('0x45')](handleError(_0x125112,null));};exports[_0xe297('0x24')]=function(_0x55c53c,_0x5e837b){if(_0x55c53c[_0xe297('0x4a')]['id']){delete _0x55c53c[_0xe297('0x4a')]['id'];}return db[_0xe297('0x2c')][_0xe297('0x48')]({'where':{'id':_0x55c53c[_0xe297('0x47')]['id']}})[_0xe297('0x25')](handleEntityNotFound(_0x5e837b,null))[_0xe297('0x25')](saveUpdates(_0x55c53c[_0xe297('0x4a')],null))['then'](respondWithResult(_0x5e837b,null))[_0xe297('0x45')](handleError(_0x5e837b,null));};exports[_0xe297('0x4b')]=function(_0x1059c2,_0x526e76){return db['MailSubstatus'][_0xe297('0x48')]({'where':{'id':_0x1059c2[_0xe297('0x47')]['id']}})[_0xe297('0x25')](handleEntityNotFound(_0x526e76,null))['then'](removeEntity(_0x526e76,null))[_0xe297('0x45')](handleError(_0x526e76,null));};exports[_0xe297('0x4c')]=function(_0x27fe86,_0x1e7900){return db['MailSubstatus'][_0xe297('0x4c')]()['then'](respondWithResult(_0x1e7900,null))['catch'](handleError(_0x1e7900,null));}; \ No newline at end of file +var _0x55e3=['squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','then','sendStatus','error','stack','name','send','index','map','MailSubstatus','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','findAll','rows','show','rawAttributes','keys','length','includeAll','catch','create','body','destroy','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x55e3,0xd4));var _0x355e=function(_0x4ca9d9,_0x3a7325){_0x4ca9d9=_0x4ca9d9-0x0;var _0x4b628d=_0x55e3[_0x4ca9d9];return _0x4b628d;};'use strict';var emlformat=require(_0x355e('0x0'));var rimraf=require(_0x355e('0x1'));var zipdir=require(_0x355e('0x2'));var jsonpatch=require(_0x355e('0x3'));var rp=require(_0x355e('0x4'));var moment=require(_0x355e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x355e('0x6'));var util=require(_0x355e('0x7'));var path=require(_0x355e('0x8'));var sox=require(_0x355e('0x9'));var csv=require(_0x355e('0xa'));var ejs=require(_0x355e('0xb'));var fs=require('fs');var fs_extra=require(_0x355e('0xc'));var _=require('lodash');var squel=require(_0x355e('0xd'));var crypto=require(_0x355e('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x355e('0xa'));var querystring=require(_0x355e('0xf'));var Papa=require(_0x355e('0x10'));var Redis=require(_0x355e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x355e('0x12'));var hardwareService=require(_0x355e('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x355e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x355e('0x15'));var db=require(_0x355e('0x16'))['db'];function respondWithStatusCode(_0x2ee4cc,_0x5d2ec6){_0x5d2ec6=_0x5d2ec6||0xcc;return function(_0x1d5022){if(_0x1d5022){return _0x2ee4cc['sendStatus'](_0x5d2ec6);}return _0x2ee4cc[_0x355e('0x17')](_0x5d2ec6)[_0x355e('0x18')]();};}function respondWithResult(_0x1ed400,_0x2faa8e){_0x2faa8e=_0x2faa8e||0xc8;return function(_0xdf1180){if(_0xdf1180){return _0x1ed400['status'](_0x2faa8e)[_0x355e('0x19')](_0xdf1180);}};}function respondWithFilteredResult(_0x1cc719,_0x4bfbf2){return function(_0x5d52c2){if(_0x5d52c2){var _0xc5783=typeof _0x4bfbf2['offset']===_0x355e('0x1a')&&typeof _0x4bfbf2[_0x355e('0x1b')]===_0x355e('0x1a');var _0x1f9b6b=_0x5d52c2['count'];var _0x1b3cac=_0xc5783?0x0:_0x4bfbf2[_0x355e('0x1c')];var _0x2713fa=_0xc5783?_0x5d52c2[_0x355e('0x1d')]:_0x4bfbf2[_0x355e('0x1c')]+_0x4bfbf2[_0x355e('0x1b')];var _0x5465fe;if(_0x2713fa>=_0x1f9b6b){_0x2713fa=_0x1f9b6b;_0x5465fe=0xc8;}else{_0x5465fe=0xce;}_0x1cc719[_0x355e('0x17')](_0x5465fe);return _0x1cc719[_0x355e('0x1e')](_0x355e('0x1f'),_0x1b3cac+'-'+_0x2713fa+'/'+_0x1f9b6b)[_0x355e('0x19')](_0x5d52c2);}return null;};}function patchUpdates(_0x54b6b6){return function(_0x170972){try{jsonpatch[_0x355e('0x20')](_0x170972,_0x54b6b6,!![]);}catch(_0x4f5f17){return BPromise['reject'](_0x4f5f17);}return _0x170972['save']();};}function saveUpdates(_0x51b687,_0x56582b){return function(_0x3b1959){if(_0x3b1959){return _0x3b1959['update'](_0x51b687)[_0x355e('0x21')](function(_0x3f7c16){return _0x3f7c16;});}return null;};}function removeEntity(_0x1341be,_0xc58e4e){return function(_0x43c165){if(_0x43c165){return _0x43c165['destroy']()['then'](function(){_0x1341be[_0x355e('0x17')](0xcc)[_0x355e('0x18')]();});}};}function handleEntityNotFound(_0x50a39b,_0x32133e){return function(_0x558385){if(!_0x558385){_0x50a39b[_0x355e('0x22')](0x194);}return _0x558385;};}function handleError(_0x236ca7,_0xed4dfd){_0xed4dfd=_0xed4dfd||0x1f4;return function(_0x468aa4){logger[_0x355e('0x23')](_0x468aa4[_0x355e('0x24')]);if(_0x468aa4[_0x355e('0x25')]){delete _0x468aa4[_0x355e('0x25')];}_0x236ca7[_0x355e('0x17')](_0xed4dfd)[_0x355e('0x26')](_0x468aa4);};}exports[_0x355e('0x27')]=function(_0x168706,_0x5f3977){var _0x26ddaf={},_0x13c228={},_0x5a8ff8={'count':0x0,'rows':[]};var _0x24e6b2=_[_0x355e('0x28')](db[_0x355e('0x29')]['rawAttributes'],function(_0x3501cb){return{'name':_0x3501cb[_0x355e('0x2a')],'type':_0x3501cb['type'][_0x355e('0x2b')]};});_0x13c228[_0x355e('0x2c')]=_[_0x355e('0x28')](_0x24e6b2,'name');_0x13c228[_0x355e('0x2d')]=_['keys'](_0x168706['query']);_0x13c228[_0x355e('0x2e')]=_[_0x355e('0x2f')](_0x13c228[_0x355e('0x2c')],_0x13c228[_0x355e('0x2d')]);_0x26ddaf['attributes']=_['intersection'](_0x13c228[_0x355e('0x2c')],qs['fields'](_0x168706[_0x355e('0x2d')][_0x355e('0x30')]));_0x26ddaf[_0x355e('0x31')]=_0x26ddaf[_0x355e('0x31')]['length']?_0x26ddaf['attributes']:_0x13c228[_0x355e('0x2c')];if(!_0x168706['query'][_0x355e('0x32')](_0x355e('0x33'))){_0x26ddaf['limit']=qs['limit'](_0x168706[_0x355e('0x2d')][_0x355e('0x1b')]);_0x26ddaf['offset']=qs[_0x355e('0x1c')](_0x168706[_0x355e('0x2d')]['offset']);}_0x26ddaf[_0x355e('0x34')]=qs['sort'](_0x168706[_0x355e('0x2d')][_0x355e('0x35')]);_0x26ddaf['where']=qs[_0x355e('0x2e')](_[_0x355e('0x36')](_0x168706['query'],_0x13c228[_0x355e('0x2e')]),_0x24e6b2);if(_0x168706[_0x355e('0x2d')][_0x355e('0x37')]){_0x26ddaf[_0x355e('0x38')]=_['merge'](_0x26ddaf[_0x355e('0x38')],{'$or':_[_0x355e('0x28')](_0x24e6b2,function(_0x2f83e5){if(_0x2f83e5[_0x355e('0x39')]!==_0x355e('0x3a')){var _0x2272d8={};_0x2272d8[_0x2f83e5['name']]={'$like':'%'+_0x168706['query'][_0x355e('0x37')]+'%'};return _0x2272d8;}})});}_0x26ddaf=_[_0x355e('0x3b')]({},_0x26ddaf,_0x168706[_0x355e('0x3c')]);var _0x1d46ac={'where':_0x26ddaf[_0x355e('0x38')]};return db[_0x355e('0x29')][_0x355e('0x1d')](_0x1d46ac)['then'](function(_0x25690b){_0x5a8ff8[_0x355e('0x1d')]=_0x25690b;if(_0x168706[_0x355e('0x2d')]['includeAll']){_0x26ddaf['include']=[{'all':!![]}];}return db[_0x355e('0x29')][_0x355e('0x3d')](_0x26ddaf);})[_0x355e('0x21')](function(_0x3c5e9a){_0x5a8ff8[_0x355e('0x3e')]=_0x3c5e9a;return _0x5a8ff8;})[_0x355e('0x21')](respondWithFilteredResult(_0x5f3977,_0x26ddaf))['catch'](handleError(_0x5f3977,null));};exports[_0x355e('0x3f')]=function(_0x2e9c70,_0x56b4b7){var _0xa1ff80={'raw':!![],'where':{'id':_0x2e9c70['params']['id']}},_0x52c3ba={};_0x52c3ba['model']=_['keys'](db[_0x355e('0x29')][_0x355e('0x40')]);_0x52c3ba['query']=_[_0x355e('0x41')](_0x2e9c70[_0x355e('0x2d')]);_0x52c3ba['filters']=_[_0x355e('0x2f')](_0x52c3ba[_0x355e('0x2c')],_0x52c3ba[_0x355e('0x2d')]);_0xa1ff80['attributes']=_[_0x355e('0x2f')](_0x52c3ba['model'],qs[_0x355e('0x30')](_0x2e9c70[_0x355e('0x2d')][_0x355e('0x30')]));_0xa1ff80[_0x355e('0x31')]=_0xa1ff80['attributes'][_0x355e('0x42')]?_0xa1ff80['attributes']:_0x52c3ba[_0x355e('0x2c')];if(_0x2e9c70[_0x355e('0x2d')][_0x355e('0x43')]){_0xa1ff80['include']=[{'all':!![]}];}_0xa1ff80=_[_0x355e('0x3b')]({},_0xa1ff80,_0x2e9c70[_0x355e('0x3c')]);return db[_0x355e('0x29')]['find'](_0xa1ff80)[_0x355e('0x21')](handleEntityNotFound(_0x56b4b7,null))[_0x355e('0x21')](respondWithResult(_0x56b4b7,null))[_0x355e('0x44')](handleError(_0x56b4b7,null));};exports[_0x355e('0x45')]=function(_0x38eae0,_0x344ee7){return db[_0x355e('0x29')][_0x355e('0x45')](_0x38eae0[_0x355e('0x46')],{})[_0x355e('0x21')](respondWithResult(_0x344ee7,0xc9))[_0x355e('0x44')](handleError(_0x344ee7,null));};exports['update']=function(_0x40e0d6,_0x3f1090){if(_0x40e0d6[_0x355e('0x46')]['id']){delete _0x40e0d6[_0x355e('0x46')]['id'];}return db[_0x355e('0x29')]['find']({'where':{'id':_0x40e0d6['params']['id']}})[_0x355e('0x21')](handleEntityNotFound(_0x3f1090,null))['then'](saveUpdates(_0x40e0d6['body'],null))[_0x355e('0x21')](respondWithResult(_0x3f1090,null))[_0x355e('0x44')](handleError(_0x3f1090,null));};exports[_0x355e('0x47')]=function(_0x607a34,_0x8a4175){return db[_0x355e('0x29')][_0x355e('0x48')]({'where':{'id':_0x607a34[_0x355e('0x49')]['id']}})[_0x355e('0x21')](handleEntityNotFound(_0x8a4175,null))['then'](removeEntity(_0x8a4175,null))['catch'](handleError(_0x8a4175,null));};exports[_0x355e('0x4a')]=function(_0x4ca499,_0xd5f9b1){return db[_0x355e('0x29')][_0x355e('0x4a')]()['then'](respondWithResult(_0xd5f9b1,null))[_0x355e('0x44')](handleError(_0xd5f9b1,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 2cfe2bb..a5dfd98 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 _0xc720=['exports','define','MailSubstatus','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./mailSubstatus.attributes'];(function(_0x427994,_0xb2b596){var _0x55cc9a=function(_0x5bffdc){while(--_0x5bffdc){_0x427994['push'](_0x427994['shift']());}};_0x55cc9a(++_0xb2b596);}(_0xc720,0x1e3));var _0x0c72=function(_0x39797f,_0xdce63b){_0x39797f=_0x39797f-0x0;var _0x54d63d=_0xc720[_0x39797f];return _0x54d63d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0c72('0x0'))(_0x0c72('0x1'));var moment=require(_0x0c72('0x2'));var BPromise=require('bluebird');var rp=require(_0x0c72('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0c72('0x4'));var config=require(_0x0c72('0x5'));var attributes=require(_0x0c72('0x6'));module[_0x0c72('0x7')]=function(_0x30c9ec,_0x1b4296){return _0x30c9ec[_0x0c72('0x8')](_0x0c72('0x9'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa93d=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses','lodash','util'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0xa93d,0xf5));var _0xda93=function(_0x221abd,_0x621d76){_0x221abd=_0x221abd-0x0;var _0x47e399=_0xa93d[_0x221abd];return _0x47e399;};'use strict';var _=require(_0xda93('0x0'));var util=require(_0xda93('0x1'));var logger=require(_0xda93('0x2'))('api');var moment=require(_0xda93('0x3'));var BPromise=require('bluebird');var rp=require(_0xda93('0x4'));var fs=require('fs');var path=require(_0xda93('0x5'));var rimraf=require(_0xda93('0x6'));var config=require(_0xda93('0x7'));var attributes=require(_0xda93('0x8'));module[_0xda93('0x9')]=function(_0x34ee8e,_0x434851){return _0x34ee8e[_0xda93('0xa')](_0xda93('0xb'),attributes,{'tableName':_0xda93('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index bc182fd..26dcf79 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 _0x1791=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x1791,0x192));var _0x1179=function(_0x438912,_0x3f7f74){_0x438912=_0x438912-0x0;var _0x18112f=_0x1791[_0x438912];return _0x18112f;};'use strict';var _=require(_0x1179('0x0'));var util=require(_0x1179('0x1'));var moment=require(_0x1179('0x2'));var BPromise=require(_0x1179('0x3'));var rs=require(_0x1179('0x4'));var fs=require('fs');var Redis=require(_0x1179('0x5'));var db=require(_0x1179('0x6'))['db'];var utils=require(_0x1179('0x7'));var logger=require(_0x1179('0x8'))('rpc');var config=require(_0x1179('0x9'));var jayson=require(_0x1179('0xa'));var client=jayson[_0x1179('0xb')][_0x1179('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c71e0,_0x55a746,_0x13c57f){return new BPromise(function(_0x574250,_0x3d7065){return client['request'](_0x2c71e0,_0x13c57f)[_0x1179('0xd')](function(_0x5a21ca){logger[_0x1179('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x55a746,_0x1179('0xf'));logger[_0x1179('0x10')](_0x1179('0x11'),_0x55a746,_0x1179('0xf'),JSON[_0x1179('0x12')](_0x5a21ca));if(_0x5a21ca[_0x1179('0x13')]){if(_0x5a21ca['error'][_0x1179('0x14')]===0x1f4){logger[_0x1179('0x13')](_0x1179('0x15'),_0x55a746,_0x5a21ca[_0x1179('0x13')][_0x1179('0x16')]);return _0x3d7065(_0x5a21ca['error'][_0x1179('0x16')]);}logger[_0x1179('0x13')](_0x1179('0x15'),_0x55a746,_0x5a21ca[_0x1179('0x13')][_0x1179('0x16')]);return _0x574250(_0x5a21ca[_0x1179('0x13')][_0x1179('0x16')]);}else{logger[_0x1179('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x55a746,'request\x20sent');_0x574250(_0x5a21ca[_0x1179('0x17')][_0x1179('0x16')]);}})[_0x1179('0x18')](function(_0x1a4351){logger[_0x1179('0x13')](_0x1179('0x15'),_0x55a746,_0x1a4351);_0x3d7065(_0x1a4351);});});} \ No newline at end of file +var _0x91d4=['request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s'];(function(_0x3be0c4,_0x5b7eff){var _0x11af9f=function(_0x3f5113){while(--_0x3f5113){_0x3be0c4['push'](_0x3be0c4['shift']());}};_0x11af9f(++_0x5b7eff);}(_0x91d4,0x140));var _0x491d=function(_0x263a09,_0x1054e3){_0x263a09=_0x263a09-0x0;var _0x38dd46=_0x91d4[_0x263a09];return _0x38dd46;};'use strict';var _=require(_0x491d('0x0'));var util=require(_0x491d('0x1'));var moment=require('moment');var BPromise=require(_0x491d('0x2'));var rs=require(_0x491d('0x3'));var fs=require('fs');var Redis=require(_0x491d('0x4'));var db=require(_0x491d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x491d('0x6'))(_0x491d('0x7'));var config=require(_0x491d('0x8'));var jayson=require(_0x491d('0x9'));var client=jayson[_0x491d('0xa')][_0x491d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23de64,_0x104974,_0x3f78cd){return new BPromise(function(_0x1a2788,_0x37a02b){return client[_0x491d('0xc')](_0x23de64,_0x3f78cd)[_0x491d('0xd')](function(_0x369ba1){logger[_0x491d('0xe')](_0x491d('0xf'),_0x104974,_0x491d('0x10'));logger[_0x491d('0x11')](_0x491d('0x12'),_0x104974,_0x491d('0x10'),JSON[_0x491d('0x13')](_0x369ba1));if(_0x369ba1[_0x491d('0x14')]){if(_0x369ba1[_0x491d('0x14')][_0x491d('0x15')]===0x1f4){logger[_0x491d('0x14')]('MailSubstatus,\x20%s,\x20%s',_0x104974,_0x369ba1[_0x491d('0x14')][_0x491d('0x16')]);return _0x37a02b(_0x369ba1[_0x491d('0x14')][_0x491d('0x16')]);}logger[_0x491d('0x14')](_0x491d('0xf'),_0x104974,_0x369ba1['error'][_0x491d('0x16')]);return _0x1a2788(_0x369ba1['error']['message']);}else{logger[_0x491d('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x104974,_0x491d('0x10'));_0x1a2788(_0x369ba1[_0x491d('0x17')]['message']);}})['catch'](function(_0x47d756){logger['error'](_0x491d('0xf'),_0x104974,_0x47d756);_0x37a02b(_0x47d756);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 7c23beb..344e852 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 _0x8631=['show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','index','/describe','describe','/:id'];(function(_0x5c23d0,_0x17aca8){var _0x11286a=function(_0x33bb11){while(--_0x33bb11){_0x5c23d0['push'](_0x5c23d0['shift']());}};_0x11286a(++_0x17aca8);}(_0x8631,0x1d1));var _0x1863=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x8631[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x1863('0x0'));var util=require(_0x1863('0x1'));var path=require(_0x1863('0x2'));var timeout=require(_0x1863('0x3'));var express=require(_0x1863('0x4'));var router=express[_0x1863('0x5')]();var fs_extra=require(_0x1863('0x6'));var auth=require(_0x1863('0x7'));var interaction=require(_0x1863('0x8'));var config=require('../../config/environment');var controller=require(_0x1863('0x9'));router[_0x1863('0xa')]('/',auth['isAuthenticated'](),controller[_0x1863('0xb')]);router[_0x1863('0xa')](_0x1863('0xc'),auth['isAuthenticated'](),controller[_0x1863('0xd')]);router[_0x1863('0xa')](_0x1863('0xe'),auth['isAuthenticated'](),controller[_0x1863('0xf')]);router[_0x1863('0x10')]('/',auth[_0x1863('0x11')](),controller[_0x1863('0x12')]);router[_0x1863('0x13')](_0x1863('0xe'),auth[_0x1863('0x11')](),controller[_0x1863('0x14')]);router[_0x1863('0x15')](_0x1863('0xe'),auth[_0x1863('0x11')](),controller[_0x1863('0x16')]);module[_0x1863('0x17')]=router; \ No newline at end of file +var _0x0541=['../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','put','delete','exports','multer','path','express','Router','fs-extra'];(function(_0x552e13,_0x46e4d9){var _0x50db5f=function(_0x4978b3){while(--_0x4978b3){_0x552e13['push'](_0x552e13['shift']());}};_0x50db5f(++_0x46e4d9);}(_0x0541,0x177));var _0x1054=function(_0x408762,_0x1e2f39){_0x408762=_0x408762-0x0;var _0x5e9e3e=_0x0541[_0x408762];return _0x5e9e3e;};'use strict';var multer=require(_0x1054('0x0'));var util=require('util');var path=require(_0x1054('0x1'));var timeout=require('connect-timeout');var express=require(_0x1054('0x2'));var router=express[_0x1054('0x3')]();var fs_extra=require(_0x1054('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1054('0x5'));var config=require(_0x1054('0x6'));var controller=require(_0x1054('0x7'));router[_0x1054('0x8')]('/',auth['isAuthenticated'](),controller[_0x1054('0x9')]);router['get'](_0x1054('0xa'),auth[_0x1054('0xb')](),controller[_0x1054('0xc')]);router['get'](_0x1054('0xd'),auth['isAuthenticated'](),controller[_0x1054('0xe')]);router['post']('/',auth[_0x1054('0xb')](),controller[_0x1054('0xf')]);router[_0x1054('0x10')](_0x1054('0xd'),auth[_0x1054('0xb')](),controller['update']);router[_0x1054('0x11')](_0x1054('0xd'),auth[_0x1054('0xb')](),controller['destroy']);module[_0x1054('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 8d587a4..b04d523 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x2450a2,_0x5279da){var _0x454d95=function(_0x25fa3d){while(--_0x25fa3d){_0x2450a2['push'](_0x2450a2['shift']());}};_0x454d95(++_0x5279da);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3f94f9,_0x42774b){_0x3f94f9=_0x3f94f9-0x0;var _0x46f84f=_0xcb91[_0x3f94f9];return _0x46f84f;};'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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x5e9b53,_0x4b8fdc){var _0x12df57=function(_0x579744){while(--_0x579744){_0x5e9b53['push'](_0x5e9b53['shift']());}};_0x12df57(++_0x4b8fdc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 26916c2..9da5dd1 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 _0x473b=['offset','set','Content-Range','apply','reject','update','then','destroy','error','name','index','map','MailTransferReport','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','length','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x473b,0x113));var _0xb473=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x473b[_0x36eaaa];return _0x461349;};'use strict';var emlformat=require(_0xb473('0x0'));var rimraf=require(_0xb473('0x1'));var zipdir=require(_0xb473('0x2'));var jsonpatch=require(_0xb473('0x3'));var rp=require(_0xb473('0x4'));var moment=require(_0xb473('0x5'));var BPromise=require(_0xb473('0x6'));var Mustache=require(_0xb473('0x7'));var util=require(_0xb473('0x8'));var path=require(_0xb473('0x9'));var sox=require('sox');var csv=require(_0xb473('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb473('0xb'));var squel=require(_0xb473('0xc'));var crypto=require('crypto');var jsforce=require(_0xb473('0xd'));var deskjs=require(_0xb473('0xe'));var toCsv=require(_0xb473('0xa'));var querystring=require(_0xb473('0xf'));var Papa=require(_0xb473('0x10'));var Redis=require(_0xb473('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb473('0x12'));var as=require(_0xb473('0x13'));var hardwareService=require(_0xb473('0x14'));var logger=require(_0xb473('0x15'))(_0xb473('0x16'));var utils=require(_0xb473('0x17'));var config=require(_0xb473('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb473('0x19'))['db'];function respondWithStatusCode(_0x3748d7,_0x1d96d3){_0x1d96d3=_0x1d96d3||0xcc;return function(_0x396511){if(_0x396511){return _0x3748d7[_0xb473('0x1a')](_0x1d96d3);}return _0x3748d7[_0xb473('0x1b')](_0x1d96d3)[_0xb473('0x1c')]();};}function respondWithResult(_0x3e2d28,_0x241794){_0x241794=_0x241794||0xc8;return function(_0x44bea4){if(_0x44bea4){return _0x3e2d28['status'](_0x241794)[_0xb473('0x1d')](_0x44bea4);}};}function respondWithFilteredResult(_0x29d0e4,_0x201b42){return function(_0x450ac0){if(_0x450ac0){var _0x1d263f=typeof _0x201b42['offset']===_0xb473('0x1e')&&typeof _0x201b42[_0xb473('0x1f')]===_0xb473('0x1e');var _0x56b665=_0x450ac0[_0xb473('0x20')];var _0x5689cd=_0x1d263f?0x0:_0x201b42[_0xb473('0x21')];var _0x390599=_0x1d263f?_0x450ac0[_0xb473('0x20')]:_0x201b42[_0xb473('0x21')]+_0x201b42[_0xb473('0x1f')];var _0x39b078;if(_0x390599>=_0x56b665){_0x390599=_0x56b665;_0x39b078=0xc8;}else{_0x39b078=0xce;}_0x29d0e4[_0xb473('0x1b')](_0x39b078);return _0x29d0e4[_0xb473('0x22')](_0xb473('0x23'),_0x5689cd+'-'+_0x390599+'/'+_0x56b665)['json'](_0x450ac0);}return null;};}function patchUpdates(_0x46083e){return function(_0x1f942a){try{jsonpatch[_0xb473('0x24')](_0x1f942a,_0x46083e,!![]);}catch(_0x7ec891){return BPromise[_0xb473('0x25')](_0x7ec891);}return _0x1f942a['save']();};}function saveUpdates(_0x3355e3,_0x8c12b4){return function(_0x5f275c){if(_0x5f275c){return _0x5f275c[_0xb473('0x26')](_0x3355e3)[_0xb473('0x27')](function(_0x28bf23){return _0x28bf23;});}return null;};}function removeEntity(_0x219e77,_0x5ab988){return function(_0x360b34){if(_0x360b34){return _0x360b34[_0xb473('0x28')]()[_0xb473('0x27')](function(){_0x219e77[_0xb473('0x1b')](0xcc)[_0xb473('0x1c')]();});}};}function handleEntityNotFound(_0x30f117,_0x589d8d){return function(_0x144dd5){if(!_0x144dd5){_0x30f117[_0xb473('0x1a')](0x194);}return _0x144dd5;};}function handleError(_0x2eb713,_0x2ee18c){_0x2ee18c=_0x2ee18c||0x1f4;return function(_0xf6b256){logger[_0xb473('0x29')](_0xf6b256['stack']);if(_0xf6b256[_0xb473('0x2a')]){delete _0xf6b256[_0xb473('0x2a')];}_0x2eb713['status'](_0x2ee18c)['send'](_0xf6b256);};}exports[_0xb473('0x2b')]=function(_0x4dda24,_0x15ca45){var _0x281838={},_0x25bee7={},_0x30d746={'count':0x0,'rows':[]};var _0x8a8524=_[_0xb473('0x2c')](db[_0xb473('0x2d')][_0xb473('0x2e')],function(_0x4b9827){return{'name':_0x4b9827[_0xb473('0x2f')],'type':_0x4b9827[_0xb473('0x30')][_0xb473('0x31')]};});_0x25bee7['model']=_['map'](_0x8a8524,_0xb473('0x2a'));_0x25bee7[_0xb473('0x32')]=_['keys'](_0x4dda24[_0xb473('0x32')]);_0x25bee7[_0xb473('0x33')]=_[_0xb473('0x34')](_0x25bee7['model'],_0x25bee7[_0xb473('0x32')]);_0x281838[_0xb473('0x35')]=_[_0xb473('0x34')](_0x25bee7['model'],qs[_0xb473('0x36')](_0x4dda24['query'][_0xb473('0x36')]));_0x281838[_0xb473('0x35')]=_0x281838[_0xb473('0x35')]['length']?_0x281838[_0xb473('0x35')]:_0x25bee7[_0xb473('0x37')];if(!_0x4dda24[_0xb473('0x32')][_0xb473('0x38')](_0xb473('0x39'))){_0x281838[_0xb473('0x1f')]=qs[_0xb473('0x1f')](_0x4dda24[_0xb473('0x32')][_0xb473('0x1f')]);_0x281838[_0xb473('0x21')]=qs['offset'](_0x4dda24[_0xb473('0x32')][_0xb473('0x21')]);}_0x281838[_0xb473('0x3a')]=qs[_0xb473('0x3b')](_0x4dda24[_0xb473('0x32')]['sort']);_0x281838[_0xb473('0x3c')]=qs[_0xb473('0x33')](_[_0xb473('0x3d')](_0x4dda24[_0xb473('0x32')],_0x25bee7[_0xb473('0x33')]),_0x8a8524);if(_0x4dda24[_0xb473('0x32')]['filter']){_0x281838[_0xb473('0x3c')]=_[_0xb473('0x3e')](_0x281838[_0xb473('0x3c')],{'$or':_[_0xb473('0x2c')](_0x8a8524,function(_0x9b8678){if(_0x9b8678[_0xb473('0x30')]!==_0xb473('0x3f')){var _0x1ec3ec={};_0x1ec3ec[_0x9b8678[_0xb473('0x2a')]]={'$like':'%'+_0x4dda24[_0xb473('0x32')]['filter']+'%'};return _0x1ec3ec;}})});}_0x281838=_[_0xb473('0x3e')]({},_0x281838,_0x4dda24[_0xb473('0x40')]);var _0x1f8a58={'where':_0x281838[_0xb473('0x3c')]};return db['MailTransferReport']['count'](_0x1f8a58)[_0xb473('0x27')](function(_0x67fb18){_0x30d746[_0xb473('0x20')]=_0x67fb18;if(_0x4dda24[_0xb473('0x32')][_0xb473('0x41')]){_0x281838['include']=[{'all':!![]}];}return db[_0xb473('0x2d')][_0xb473('0x42')](_0x281838);})[_0xb473('0x27')](function(_0x1a0e53){_0x30d746['rows']=_0x1a0e53;return _0x30d746;})['then'](respondWithFilteredResult(_0x15ca45,_0x281838))[_0xb473('0x43')](handleError(_0x15ca45,null));};exports[_0xb473('0x44')]=function(_0x2f9172,_0x4d4d7a){var _0x4a85ba={'raw':!![],'where':{'id':_0x2f9172[_0xb473('0x45')]['id']}},_0x2a444f={};_0x2a444f[_0xb473('0x37')]=_['keys'](db[_0xb473('0x2d')][_0xb473('0x2e')]);_0x2a444f[_0xb473('0x32')]=_[_0xb473('0x46')](_0x2f9172[_0xb473('0x32')]);_0x2a444f[_0xb473('0x33')]=_['intersection'](_0x2a444f[_0xb473('0x37')],_0x2a444f[_0xb473('0x32')]);_0x4a85ba[_0xb473('0x35')]=_[_0xb473('0x34')](_0x2a444f[_0xb473('0x37')],qs[_0xb473('0x36')](_0x2f9172[_0xb473('0x32')]['fields']));_0x4a85ba[_0xb473('0x35')]=_0x4a85ba[_0xb473('0x35')][_0xb473('0x47')]?_0x4a85ba[_0xb473('0x35')]:_0x2a444f[_0xb473('0x37')];if(_0x2f9172[_0xb473('0x32')][_0xb473('0x41')]){_0x4a85ba[_0xb473('0x48')]=[{'all':!![]}];}_0x4a85ba=_[_0xb473('0x3e')]({},_0x4a85ba,_0x2f9172[_0xb473('0x40')]);return db[_0xb473('0x2d')][_0xb473('0x49')](_0x4a85ba)[_0xb473('0x27')](handleEntityNotFound(_0x4d4d7a,null))[_0xb473('0x27')](respondWithResult(_0x4d4d7a,null))[_0xb473('0x43')](handleError(_0x4d4d7a,null));};exports[_0xb473('0x4a')]=function(_0x428df0,_0xf6c01){return db[_0xb473('0x2d')]['create'](_0x428df0['body'],{})[_0xb473('0x27')](respondWithResult(_0xf6c01,0xc9))[_0xb473('0x43')](handleError(_0xf6c01,null));};exports[_0xb473('0x26')]=function(_0x49b588,_0x8f1b4a){if(_0x49b588['body']['id']){delete _0x49b588[_0xb473('0x4b')]['id'];}return db['MailTransferReport']['find']({'where':{'id':_0x49b588[_0xb473('0x45')]['id']}})[_0xb473('0x27')](handleEntityNotFound(_0x8f1b4a,null))[_0xb473('0x27')](saveUpdates(_0x49b588[_0xb473('0x4b')],null))[_0xb473('0x27')](respondWithResult(_0x8f1b4a,null))['catch'](handleError(_0x8f1b4a,null));};exports[_0xb473('0x28')]=function(_0x222ebe,_0x583aeb){return db[_0xb473('0x2d')][_0xb473('0x49')]({'where':{'id':_0x222ebe[_0xb473('0x45')]['id']}})['then'](handleEntityNotFound(_0x583aeb,null))['then'](removeEntity(_0x583aeb,null))['catch'](handleError(_0x583aeb,null));};exports[_0xb473('0x4c')]=function(_0x277695,_0x2f349c){return db['MailTransferReport'][_0xb473('0x4c')]()['then'](respondWithResult(_0x2f349c,null))[_0xb473('0x43')](handleError(_0x2f349c,null));}; \ No newline at end of file +var _0xbbd6=['moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailTransferReport','fieldName','type','key','model','keys','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','intersection','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xbbd6,0x12d));var _0x6bbd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbd6[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6bbd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6bbd('0x1'));var jsonpatch=require(_0x6bbd('0x2'));var rp=require('request-promise');var moment=require(_0x6bbd('0x3'));var BPromise=require(_0x6bbd('0x4'));var Mustache=require(_0x6bbd('0x5'));var util=require('util');var path=require('path');var sox=require(_0x6bbd('0x6'));var csv=require(_0x6bbd('0x7'));var ejs=require(_0x6bbd('0x8'));var fs=require('fs');var fs_extra=require(_0x6bbd('0x9'));var _=require(_0x6bbd('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6bbd('0xb'));var deskjs=require(_0x6bbd('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6bbd('0xd'));var Papa=require(_0x6bbd('0xe'));var Redis=require(_0x6bbd('0xf'));var authService=require(_0x6bbd('0x10'));var qs=require(_0x6bbd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6bbd('0x12'));var logger=require(_0x6bbd('0x13'))('api');var utils=require(_0x6bbd('0x14'));var config=require(_0x6bbd('0x15'));var licenseUtil=require(_0x6bbd('0x16'));var db=require(_0x6bbd('0x17'))['db'];function respondWithStatusCode(_0x9a3c13,_0x531b6f){_0x531b6f=_0x531b6f||0xcc;return function(_0x275173){if(_0x275173){return _0x9a3c13[_0x6bbd('0x18')](_0x531b6f);}return _0x9a3c13[_0x6bbd('0x19')](_0x531b6f)[_0x6bbd('0x1a')]();};}function respondWithResult(_0x376c45,_0x2b9229){_0x2b9229=_0x2b9229||0xc8;return function(_0x2dda71){if(_0x2dda71){return _0x376c45['status'](_0x2b9229)[_0x6bbd('0x1b')](_0x2dda71);}};}function respondWithFilteredResult(_0x1a228c,_0x1820aa){return function(_0x15e1cb){if(_0x15e1cb){var _0xd6b5bc=typeof _0x1820aa[_0x6bbd('0x1c')]===_0x6bbd('0x1d')&&typeof _0x1820aa[_0x6bbd('0x1e')]===_0x6bbd('0x1d');var _0x5bd457=_0x15e1cb[_0x6bbd('0x1f')];var _0x1befbe=_0xd6b5bc?0x0:_0x1820aa[_0x6bbd('0x1c')];var _0x5a953a=_0xd6b5bc?_0x15e1cb[_0x6bbd('0x1f')]:_0x1820aa['offset']+_0x1820aa['limit'];var _0x1a7675;if(_0x5a953a>=_0x5bd457){_0x5a953a=_0x5bd457;_0x1a7675=0xc8;}else{_0x1a7675=0xce;}_0x1a228c['status'](_0x1a7675);return _0x1a228c['set'](_0x6bbd('0x20'),_0x1befbe+'-'+_0x5a953a+'/'+_0x5bd457)[_0x6bbd('0x1b')](_0x15e1cb);}return null;};}function patchUpdates(_0x1c3bb5){return function(_0xe73ed1){try{jsonpatch[_0x6bbd('0x21')](_0xe73ed1,_0x1c3bb5,!![]);}catch(_0x1eda1b){return BPromise[_0x6bbd('0x22')](_0x1eda1b);}return _0xe73ed1[_0x6bbd('0x23')]();};}function saveUpdates(_0x436c91,_0x521a13){return function(_0x5b2523){if(_0x5b2523){return _0x5b2523[_0x6bbd('0x24')](_0x436c91)[_0x6bbd('0x25')](function(_0x484672){return _0x484672;});}return null;};}function removeEntity(_0xd5c76f,_0xc0fde1){return function(_0x248321){if(_0x248321){return _0x248321[_0x6bbd('0x26')]()[_0x6bbd('0x25')](function(){_0xd5c76f[_0x6bbd('0x19')](0xcc)[_0x6bbd('0x1a')]();});}};}function handleEntityNotFound(_0x1d6309,_0x3f050e){return function(_0x52d439){if(!_0x52d439){_0x1d6309[_0x6bbd('0x18')](0x194);}return _0x52d439;};}function handleError(_0x90fa61,_0x211f4a){_0x211f4a=_0x211f4a||0x1f4;return function(_0x49b417){logger[_0x6bbd('0x27')](_0x49b417[_0x6bbd('0x28')]);if(_0x49b417[_0x6bbd('0x29')]){delete _0x49b417[_0x6bbd('0x29')];}_0x90fa61[_0x6bbd('0x19')](_0x211f4a)[_0x6bbd('0x2a')](_0x49b417);};}exports[_0x6bbd('0x2b')]=function(_0x224b77,_0x2a43a8){var _0x571d9a={},_0x4e7e14={},_0x399577={'count':0x0,'rows':[]};var _0x227942=_[_0x6bbd('0x2c')](db[_0x6bbd('0x2d')]['rawAttributes'],function(_0xf77a87){return{'name':_0xf77a87[_0x6bbd('0x2e')],'type':_0xf77a87[_0x6bbd('0x2f')][_0x6bbd('0x30')]};});_0x4e7e14[_0x6bbd('0x31')]=_[_0x6bbd('0x2c')](_0x227942,_0x6bbd('0x29'));_0x4e7e14['query']=_[_0x6bbd('0x32')](_0x224b77[_0x6bbd('0x33')]);_0x4e7e14['filters']=_['intersection'](_0x4e7e14[_0x6bbd('0x31')],_0x4e7e14[_0x6bbd('0x33')]);_0x571d9a[_0x6bbd('0x34')]=_['intersection'](_0x4e7e14[_0x6bbd('0x31')],qs[_0x6bbd('0x35')](_0x224b77[_0x6bbd('0x33')][_0x6bbd('0x35')]));_0x571d9a[_0x6bbd('0x34')]=_0x571d9a[_0x6bbd('0x34')][_0x6bbd('0x36')]?_0x571d9a['attributes']:_0x4e7e14[_0x6bbd('0x31')];if(!_0x224b77[_0x6bbd('0x33')][_0x6bbd('0x37')](_0x6bbd('0x38'))){_0x571d9a[_0x6bbd('0x1e')]=qs[_0x6bbd('0x1e')](_0x224b77['query'][_0x6bbd('0x1e')]);_0x571d9a['offset']=qs[_0x6bbd('0x1c')](_0x224b77[_0x6bbd('0x33')][_0x6bbd('0x1c')]);}_0x571d9a['order']=qs[_0x6bbd('0x39')](_0x224b77[_0x6bbd('0x33')][_0x6bbd('0x39')]);_0x571d9a[_0x6bbd('0x3a')]=qs[_0x6bbd('0x3b')](_[_0x6bbd('0x3c')](_0x224b77[_0x6bbd('0x33')],_0x4e7e14[_0x6bbd('0x3b')]),_0x227942);if(_0x224b77[_0x6bbd('0x33')][_0x6bbd('0x3d')]){_0x571d9a[_0x6bbd('0x3a')]=_['merge'](_0x571d9a[_0x6bbd('0x3a')],{'$or':_[_0x6bbd('0x2c')](_0x227942,function(_0x3bff32){if(_0x3bff32['type']!==_0x6bbd('0x3e')){var _0x5a40d4={};_0x5a40d4[_0x3bff32[_0x6bbd('0x29')]]={'$like':'%'+_0x224b77[_0x6bbd('0x33')][_0x6bbd('0x3d')]+'%'};return _0x5a40d4;}})});}_0x571d9a=_[_0x6bbd('0x3f')]({},_0x571d9a,_0x224b77['options']);var _0x17d77e={'where':_0x571d9a[_0x6bbd('0x3a')]};return db[_0x6bbd('0x2d')]['count'](_0x17d77e)[_0x6bbd('0x25')](function(_0x61486f){_0x399577['count']=_0x61486f;if(_0x224b77[_0x6bbd('0x33')][_0x6bbd('0x40')]){_0x571d9a[_0x6bbd('0x41')]=[{'all':!![]}];}return db[_0x6bbd('0x2d')][_0x6bbd('0x42')](_0x571d9a);})[_0x6bbd('0x25')](function(_0xc8cd5e){_0x399577[_0x6bbd('0x43')]=_0xc8cd5e;return _0x399577;})[_0x6bbd('0x25')](respondWithFilteredResult(_0x2a43a8,_0x571d9a))[_0x6bbd('0x44')](handleError(_0x2a43a8,null));};exports['show']=function(_0x4e0041,_0xb2b39){var _0x4fc835={'raw':!![],'where':{'id':_0x4e0041[_0x6bbd('0x45')]['id']}},_0x2dd617={};_0x2dd617[_0x6bbd('0x31')]=_[_0x6bbd('0x32')](db['MailTransferReport']['rawAttributes']);_0x2dd617[_0x6bbd('0x33')]=_[_0x6bbd('0x32')](_0x4e0041[_0x6bbd('0x33')]);_0x2dd617['filters']=_[_0x6bbd('0x46')](_0x2dd617[_0x6bbd('0x31')],_0x2dd617[_0x6bbd('0x33')]);_0x4fc835[_0x6bbd('0x34')]=_[_0x6bbd('0x46')](_0x2dd617[_0x6bbd('0x31')],qs[_0x6bbd('0x35')](_0x4e0041['query'][_0x6bbd('0x35')]));_0x4fc835[_0x6bbd('0x34')]=_0x4fc835[_0x6bbd('0x34')]['length']?_0x4fc835[_0x6bbd('0x34')]:_0x2dd617['model'];if(_0x4e0041[_0x6bbd('0x33')]['includeAll']){_0x4fc835[_0x6bbd('0x41')]=[{'all':!![]}];}_0x4fc835=_[_0x6bbd('0x3f')]({},_0x4fc835,_0x4e0041[_0x6bbd('0x47')]);return db[_0x6bbd('0x2d')][_0x6bbd('0x48')](_0x4fc835)['then'](handleEntityNotFound(_0xb2b39,null))[_0x6bbd('0x25')](respondWithResult(_0xb2b39,null))[_0x6bbd('0x44')](handleError(_0xb2b39,null));};exports[_0x6bbd('0x49')]=function(_0x4fdc07,_0x312e52){return db[_0x6bbd('0x2d')][_0x6bbd('0x49')](_0x4fdc07['body'],{})[_0x6bbd('0x25')](respondWithResult(_0x312e52,0xc9))[_0x6bbd('0x44')](handleError(_0x312e52,null));};exports['update']=function(_0x529e8b,_0x3fd601){if(_0x529e8b['body']['id']){delete _0x529e8b[_0x6bbd('0x4a')]['id'];}return db[_0x6bbd('0x2d')]['find']({'where':{'id':_0x529e8b[_0x6bbd('0x45')]['id']}})[_0x6bbd('0x25')](handleEntityNotFound(_0x3fd601,null))['then'](saveUpdates(_0x529e8b[_0x6bbd('0x4a')],null))[_0x6bbd('0x25')](respondWithResult(_0x3fd601,null))[_0x6bbd('0x44')](handleError(_0x3fd601,null));};exports[_0x6bbd('0x26')]=function(_0x1ad1c9,_0x524943){return db['MailTransferReport']['find']({'where':{'id':_0x1ad1c9[_0x6bbd('0x45')]['id']}})[_0x6bbd('0x25')](handleEntityNotFound(_0x524943,null))[_0x6bbd('0x25')](removeEntity(_0x524943,null))[_0x6bbd('0x44')](handleError(_0x524943,null));};exports[_0x6bbd('0x4b')]=function(_0x2317c5,_0x37dd00){return db[_0x6bbd('0x2d')][_0x6bbd('0x4b')]()[_0x6bbd('0x25')](respondWithResult(_0x37dd00,null))[_0x6bbd('0x44')](handleError(_0x37dd00,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index e9edc5e..e1c4c90 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 _0xadc5=['uniqueid','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer'];(function(_0x549996,_0xd04634){var _0x4de5d1=function(_0x1883a7){while(--_0x1883a7){_0x549996['push'](_0x549996['shift']());}};_0x4de5d1(++_0xd04634);}(_0xadc5,0x1bd));var _0x5adc=function(_0x16f627,_0x41b1f0){_0x16f627=_0x16f627-0x0;var _0x2bf401=_0xadc5[_0x16f627];return _0x2bf401;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5adc('0x0'))(_0x5adc('0x1'));var moment=require(_0x5adc('0x2'));var BPromise=require(_0x5adc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5adc('0x4'));var config=require(_0x5adc('0x5'));var attributes=require(_0x5adc('0x6'));module[_0x5adc('0x7')]=function(_0x68a90d,_0x2deac9){return _0x68a90d[_0x5adc('0x8')](_0x5adc('0x9'),attributes,{'tableName':_0x5adc('0xa'),'paranoid':![],'indexes':[{'name':_0x5adc('0xb'),'fields':[_0x5adc('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2028=['exports','report_mail_transfer','uniqueid','../../config/logger','moment','bluebird','request-promise','rimraf','./mailTransferReport.attributes'];(function(_0x9b7721,_0x36ef2f){var _0x2c92de=function(_0x27e0b4){while(--_0x27e0b4){_0x9b7721['push'](_0x9b7721['shift']());}};_0x2c92de(++_0x36ef2f);}(_0x2028,0x1e0));var _0x8202=function(_0x33a53e,_0x3e6bd4){_0x33a53e=_0x33a53e-0x0;var _0xe191b=_0x2028[_0x33a53e];return _0xe191b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8202('0x0'))('api');var moment=require(_0x8202('0x1'));var BPromise=require(_0x8202('0x2'));var rp=require(_0x8202('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8202('0x4'));var config=require('../../config/environment');var attributes=require(_0x8202('0x5'));module[_0x8202('0x6')]=function(_0x2b272d,_0xda8397){return _0x2b272d['define']('MailTransferReport',attributes,{'tableName':_0x8202('0x7'),'paranoid':![],'indexes':[{'name':_0x8202('0x8'),'fields':[_0x8202('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index de6f18d..9f4e64d 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 _0xea0e=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xea0e,0x153));var _0xeea0=function(_0x48d500,_0x44e32d){_0x48d500=_0x48d500-0x0;var _0x21924b=_0xea0e[_0x48d500];return _0x21924b;};'use strict';var _=require(_0xeea0('0x0'));var util=require(_0xeea0('0x1'));var moment=require(_0xeea0('0x2'));var BPromise=require(_0xeea0('0x3'));var rs=require(_0xeea0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeea0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xeea0('0x6'))(_0xeea0('0x7'));var config=require(_0xeea0('0x8'));var jayson=require(_0xeea0('0x9'));var client=jayson[_0xeea0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14c01d,_0x5b2bea,_0x562c26){return new BPromise(function(_0x222e8b,_0x20110a){return client[_0xeea0('0xb')](_0x14c01d,_0x562c26)[_0xeea0('0xc')](function(_0x3e4e7f){logger[_0xeea0('0xd')](_0xeea0('0xe'),_0x5b2bea,_0xeea0('0xf'));logger[_0xeea0('0x10')](_0xeea0('0x11'),_0x5b2bea,_0xeea0('0xf'),JSON[_0xeea0('0x12')](_0x3e4e7f));if(_0x3e4e7f['error']){if(_0x3e4e7f[_0xeea0('0x13')][_0xeea0('0x14')]===0x1f4){logger[_0xeea0('0x13')](_0xeea0('0xe'),_0x5b2bea,_0x3e4e7f[_0xeea0('0x13')][_0xeea0('0x15')]);return _0x20110a(_0x3e4e7f[_0xeea0('0x13')][_0xeea0('0x15')]);}logger[_0xeea0('0x13')](_0xeea0('0xe'),_0x5b2bea,_0x3e4e7f['error']['message']);return _0x222e8b(_0x3e4e7f[_0xeea0('0x13')][_0xeea0('0x15')]);}else{logger['info'](_0xeea0('0xe'),_0x5b2bea,_0xeea0('0xf'));_0x222e8b(_0x3e4e7f[_0xeea0('0x16')][_0xeea0('0x15')]);}})[_0xeea0('0x17')](function(_0x1dc9c8){logger[_0xeea0('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x5b2bea,_0x1dc9c8);_0x20110a(_0x1dc9c8);});});} \ No newline at end of file +var _0x8e5b=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1da11c,_0x18ce7b){var _0x2315e6=function(_0x44f486){while(--_0x44f486){_0x1da11c['push'](_0x1da11c['shift']());}};_0x2315e6(++_0x18ce7b);}(_0x8e5b,0xf6));var _0xb8e5=function(_0x279685,_0x9c6a76){_0x279685=_0x279685-0x0;var _0x7d1bea=_0x8e5b[_0x279685];return _0x7d1bea;};'use strict';var _=require(_0xb8e5('0x0'));var util=require(_0xb8e5('0x1'));var moment=require(_0xb8e5('0x2'));var BPromise=require(_0xb8e5('0x3'));var rs=require(_0xb8e5('0x4'));var fs=require('fs');var Redis=require(_0xb8e5('0x5'));var db=require(_0xb8e5('0x6'))['db'];var utils=require(_0xb8e5('0x7'));var logger=require(_0xb8e5('0x8'))(_0xb8e5('0x9'));var config=require(_0xb8e5('0xa'));var jayson=require(_0xb8e5('0xb'));var client=jayson[_0xb8e5('0xc')][_0xb8e5('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x305e00,_0x7f1c6b,_0x1f7e58){return new BPromise(function(_0x3841ca,_0x2666a5){return client[_0xb8e5('0xe')](_0x305e00,_0x1f7e58)[_0xb8e5('0xf')](function(_0x370442){logger[_0xb8e5('0x10')](_0xb8e5('0x11'),_0x7f1c6b,_0xb8e5('0x12'));logger[_0xb8e5('0x13')](_0xb8e5('0x14'),_0x7f1c6b,_0xb8e5('0x12'),JSON[_0xb8e5('0x15')](_0x370442));if(_0x370442[_0xb8e5('0x16')]){if(_0x370442[_0xb8e5('0x16')][_0xb8e5('0x17')]===0x1f4){logger[_0xb8e5('0x16')](_0xb8e5('0x11'),_0x7f1c6b,_0x370442['error']['message']);return _0x2666a5(_0x370442[_0xb8e5('0x16')][_0xb8e5('0x18')]);}logger[_0xb8e5('0x16')](_0xb8e5('0x11'),_0x7f1c6b,_0x370442['error'][_0xb8e5('0x18')]);return _0x3841ca(_0x370442[_0xb8e5('0x16')][_0xb8e5('0x18')]);}else{logger[_0xb8e5('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x7f1c6b,_0xb8e5('0x12'));_0x3841ca(_0x370442[_0xb8e5('0x19')][_0xb8e5('0x18')]);}})[_0xb8e5('0x1a')](function(_0x249f47){logger[_0xb8e5('0x16')](_0xb8e5('0x11'),_0x7f1c6b,_0x249f47);_0x2666a5(_0x249f47);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 9856f2c..93dfcb5 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 _0x156c=['/:id','show','post','create','put','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./memberReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x42fb0e,_0x55fc22){var _0x595566=function(_0x4d7e07){while(--_0x4d7e07){_0x42fb0e['push'](_0x42fb0e['shift']());}};_0x595566(++_0x55fc22);}(_0x156c,0x119));var _0xc156=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0x156c[_0x2f45ea];return _0x485a84;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc156('0x0'));var timeout=require(_0xc156('0x1'));var express=require(_0xc156('0x2'));var router=express[_0xc156('0x3')]();var fs_extra=require(_0xc156('0x4'));var auth=require(_0xc156('0x5'));var interaction=require(_0xc156('0x6'));var config=require('../../config/environment');var controller=require(_0xc156('0x7'));router[_0xc156('0x8')]('/',auth[_0xc156('0x9')](),controller[_0xc156('0xa')]);router[_0xc156('0x8')](_0xc156('0xb'),auth['isAuthenticated'](),controller[_0xc156('0xc')]);router[_0xc156('0x8')](_0xc156('0xd'),auth[_0xc156('0x9')](),controller[_0xc156('0xe')]);router[_0xc156('0xf')]('/',auth[_0xc156('0x9')](),controller[_0xc156('0x10')]);router[_0xc156('0x11')](_0xc156('0xd'),auth['isAuthenticated'](),controller[_0xc156('0x12')]);router[_0xc156('0x13')](_0xc156('0xd'),auth[_0xc156('0x9')](),controller['destroy']);module[_0xc156('0x14')]=router; \ No newline at end of file +var _0x305e=['../../components/interaction/service','./memberReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','/:id','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x68fd87,_0x17f037){var _0x559470=function(_0x1e7b0b){while(--_0x1e7b0b){_0x68fd87['push'](_0x68fd87['shift']());}};_0x559470(++_0x17f037);}(_0x305e,0x1c7));var _0xe305=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x305e[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0xe305('0x0'));var util=require(_0xe305('0x1'));var path=require(_0xe305('0x2'));var timeout=require('connect-timeout');var express=require(_0xe305('0x3'));var router=express[_0xe305('0x4')]();var fs_extra=require(_0xe305('0x5'));var auth=require(_0xe305('0x6'));var interaction=require(_0xe305('0x7'));var config=require('../../config/environment');var controller=require(_0xe305('0x8'));router[_0xe305('0x9')]('/',auth[_0xe305('0xa')](),controller[_0xe305('0xb')]);router[_0xe305('0x9')](_0xe305('0xc'),auth[_0xe305('0xa')](),controller[_0xe305('0xd')]);router[_0xe305('0x9')]('/:id',auth[_0xe305('0xa')](),controller[_0xe305('0xe')]);router[_0xe305('0xf')]('/',auth['isAuthenticated'](),controller[_0xe305('0x10')]);router[_0xe305('0x11')]('/:id',auth[_0xe305('0xa')](),controller[_0xe305('0x12')]);router[_0xe305('0x13')](_0xe305('0x14'),auth[_0xe305('0xa')](),controller['destroy']);module[_0xe305('0x15')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index a2c2847..4d4da14 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 _0x45ea=['sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','diff','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]'];(function(_0x2dcb05,_0x4b9009){var _0x2a9e37=function(_0x119f68){while(--_0x119f68){_0x2dcb05['push'](_0x2dcb05['shift']());}};_0x2a9e37(++_0x4b9009);}(_0x45ea,0x1f0));var _0xa45e=function(_0x48e04f,_0xd2c4ed){_0x48e04f=_0x48e04f-0x0;var _0x179759=_0x45ea[_0x48e04f];return _0x179759;};'use strict';var Sequelize=require(_0xa45e('0x0'));var moment=require(_0xa45e('0x1'));module[_0xa45e('0x2')]={'channel':{'type':Sequelize[_0xa45e('0x3')]},'membername':{'type':Sequelize[_0xa45e('0x3')]},'interface':{'type':Sequelize[_0xa45e('0x3')]},'type':{'type':Sequelize[_0xa45e('0x3')],'defaultValue':_0xa45e('0x4'),'comment':_0xa45e('0x5')},'duration':{'type':Sequelize[_0xa45e('0x6')]},'enterAt':{'type':Sequelize[_0xa45e('0x7')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x418a41){var _0x3ee60d=moment(_0x418a41);var _0x573ff8=moment(this['getDataValue']('enterAt'));var _0x40befe=_0x3ee60d[_0xa45e('0x8')](_0x573ff8,_0xa45e('0x9'));this[_0xa45e('0xa')](_0xa45e('0xb'),_0x418a41);this['setDataValue']('duration',_0x40befe||null);}},'data1':{'type':Sequelize[_0xa45e('0x3')],'comment':_0xa45e('0xc')},'data2':{'type':Sequelize[_0xa45e('0x3')],'comment':_0xa45e('0xd')},'data3':{'type':Sequelize['STRING'],'comment':_0xa45e('0xe')},'data4':{'type':Sequelize['STRING'],'comment':_0xa45e('0xf')},'data5':{'type':Sequelize[_0xa45e('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xa45e('0x6')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2356=['INTEGER','diff','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','moment','exports','STRING'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x2356,0x14f));var _0x6235=function(_0x534ae9,_0x5735c1){_0x534ae9=_0x534ae9-0x0;var _0x2dc1e7=_0x2356[_0x534ae9];return _0x2dc1e7;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x6235('0x0'));module[_0x6235('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x6235('0x2')]},'type':{'type':Sequelize[_0x6235('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x6235('0x3')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x390c55){var _0x17e08f=moment(_0x390c55);var _0x3663e7=moment(this['getDataValue']('enterAt'));var _0x547159=_0x17e08f[_0x6235('0x4')](_0x3663e7,'seconds');this[_0x6235('0x5')](_0x6235('0x6'),_0x390c55);this[_0x6235('0x5')](_0x6235('0x7'),_0x547159||null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x6235('0x8')},'data2':{'type':Sequelize[_0x6235('0x2')],'comment':_0x6235('0x9')},'data3':{'type':Sequelize[_0x6235('0x2')],'comment':_0x6235('0xa')},'data4':{'type':Sequelize['STRING'],'comment':_0x6235('0xb')},'data5':{'type':Sequelize[_0x6235('0x2')],'comment':_0x6235('0xc')},'role':{'type':Sequelize[_0x6235('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x6235('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index fff8cd7..1295c34 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 _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x34e8,0x12c));var _0x834e=function(_0x3c1df5,_0x5817df){_0x3c1df5=_0x3c1df5-0x0;var _0x2cc53b=_0x34e8[_0x3c1df5];return _0x2cc53b;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file +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(_0x1d50a3,_0x3213ff){var _0x4d8902=function(_0x79d1ba){while(--_0x79d1ba){_0x1d50a3['push'](_0x1d50a3['shift']());}};_0x4d8902(++_0x3213ff);}(_0x008c,0x188));var _0xc008=function(_0x138d06,_0x33edf2){_0x138d06=_0x138d06-0x0;var _0x1a01eb=_0x008c[_0x138d06];return _0x1a01eb;};'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 diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index d5a71e8..f63f41e 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 _0x9137=['moment','request-promise','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','membername','util','../../config/logger'];(function(_0x5471ec,_0x1ce81a){var _0x121d4c=function(_0xefb655){while(--_0xefb655){_0x5471ec['push'](_0x5471ec['shift']());}};_0x121d4c(++_0x1ce81a);}(_0x9137,0x15d));var _0x7913=function(_0x21c6b8,_0x16d6f6){_0x21c6b8=_0x21c6b8-0x0;var _0x39d474=_0x9137[_0x21c6b8];return _0x39d474;};'use strict';var _=require('lodash');var util=require(_0x7913('0x0'));var logger=require(_0x7913('0x1'))('api');var moment=require(_0x7913('0x2'));var BPromise=require('bluebird');var rp=require(_0x7913('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7913('0x4'));var config=require(_0x7913('0x5'));var attributes=require(_0x7913('0x6'));module[_0x7913('0x7')]=function(_0x5aa240,_0x586799){return _0x5aa240[_0x7913('0x8')](_0x7913('0x9'),attributes,{'tableName':_0x7913('0xa'),'paranoid':![],'indexes':[{'name':_0x7913('0xb'),'fields':[_0x7913('0xc'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7182=['util','../../config/logger','bluebird','path','rimraf','../../config/environment','./memberReport.attributes','define','MemberReport','report_member','membername_interface','membername','interface','lodash'];(function(_0x6a946,_0x34b170){var _0x3ff4f1=function(_0x2f18b7){while(--_0x2f18b7){_0x6a946['push'](_0x6a946['shift']());}};_0x3ff4f1(++_0x34b170);}(_0x7182,0x187));var _0x2718=function(_0x2385ed,_0x49586f){_0x2385ed=_0x2385ed-0x0;var _0x1f1cd2=_0x7182[_0x2385ed];return _0x1f1cd2;};'use strict';var _=require(_0x2718('0x0'));var util=require(_0x2718('0x1'));var logger=require(_0x2718('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2718('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2718('0x4'));var rimraf=require(_0x2718('0x5'));var config=require(_0x2718('0x6'));var attributes=require(_0x2718('0x7'));module['exports']=function(_0x19e98f,_0x1e7303){return _0x19e98f[_0x2718('0x8')](_0x2718('0x9'),attributes,{'tableName':_0x2718('0xa'),'paranoid':![],'indexes':[{'name':_0x2718('0xb'),'fields':[_0x2718('0xc'),_0x2718('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 84736b0..38ea005 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 _0x1c3b=['findAll','options','raw','where','attributes','limit','map','model','include','then','stringify','CreateMemberReport','update','body','UpdateMemberReport','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMemberReport','MemberReport'];(function(_0x2340c8,_0x976df8){var _0x2892e0=function(_0x3334cb){while(--_0x3334cb){_0x2340c8['push'](_0x2340c8['shift']());}};_0x2892e0(++_0x976df8);}(_0x1c3b,0xab));var _0xb1c3=function(_0x9a3822,_0x2eba4d){_0x9a3822=_0x9a3822-0x0;var _0x26fed2=_0x1c3b[_0x9a3822];return _0x26fed2;};'use strict';var _=require(_0xb1c3('0x0'));var util=require(_0xb1c3('0x1'));var moment=require(_0xb1c3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb1c3('0x3'));var db=require(_0xb1c3('0x4'))['db'];var utils=require(_0xb1c3('0x5'));var logger=require(_0xb1c3('0x6'))(_0xb1c3('0x7'));var config=require(_0xb1c3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb1c3('0x9')][_0xb1c3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x211254,_0x4c26fd,_0x504fc9){return new BPromise(function(_0x4ed6cf,_0x5f1df6){return client[_0xb1c3('0xb')](_0x211254,_0x504fc9)['then'](function(_0x2879c2){logger[_0xb1c3('0xc')](_0xb1c3('0xd'),_0x4c26fd,'request\x20sent');logger[_0xb1c3('0xe')](_0xb1c3('0xf'),_0x4c26fd,_0xb1c3('0x10'),JSON['stringify'](_0x2879c2));if(_0x2879c2[_0xb1c3('0x11')]){if(_0x2879c2[_0xb1c3('0x11')][_0xb1c3('0x12')]===0x1f4){logger[_0xb1c3('0x11')]('MemberReport,\x20%s,\x20%s',_0x4c26fd,_0x2879c2[_0xb1c3('0x11')][_0xb1c3('0x13')]);return _0x5f1df6(_0x2879c2[_0xb1c3('0x11')]['message']);}logger[_0xb1c3('0x11')](_0xb1c3('0xd'),_0x4c26fd,_0x2879c2['error'][_0xb1c3('0x13')]);return _0x4ed6cf(_0x2879c2[_0xb1c3('0x11')][_0xb1c3('0x13')]);}else{logger[_0xb1c3('0xc')](_0xb1c3('0xd'),_0x4c26fd,'request\x20sent');_0x4ed6cf(_0x2879c2[_0xb1c3('0x14')][_0xb1c3('0x13')]);}})[_0xb1c3('0x15')](function(_0x41b0fb){logger[_0xb1c3('0x11')]('MemberReport,\x20%s,\x20%s',_0x4c26fd,_0x41b0fb);_0x5f1df6(_0x41b0fb);});});}exports[_0xb1c3('0x16')]=function(_0x2bdeed){var _0x1313a8=this;return new Promise(function(_0x36b25f,_0x1bb2e4){return db[_0xb1c3('0x17')][_0xb1c3('0x18')]({'raw':_0x2bdeed[_0xb1c3('0x19')]?_0x2bdeed[_0xb1c3('0x19')][_0xb1c3('0x1a')]===undefined?!![]:![]:!![],'where':_0x2bdeed[_0xb1c3('0x19')]?_0x2bdeed[_0xb1c3('0x19')][_0xb1c3('0x1b')]||null:null,'attributes':_0x2bdeed['options']?_0x2bdeed[_0xb1c3('0x19')][_0xb1c3('0x1c')]||null:null,'limit':_0x2bdeed[_0xb1c3('0x19')]?_0x2bdeed[_0xb1c3('0x19')][_0xb1c3('0x1d')]||null:null,'include':_0x2bdeed[_0xb1c3('0x19')]?_0x2bdeed['options']['include']?_[_0xb1c3('0x1e')](_0x2bdeed[_0xb1c3('0x19')]['include'],function(_0xdb96){return{'model':db[_0xdb96[_0xb1c3('0x1f')]],'as':_0xdb96['as'],'attributes':_0xdb96[_0xb1c3('0x1c')],'include':_0xdb96[_0xb1c3('0x20')]?_['map'](_0xdb96[_0xb1c3('0x20')],function(_0x1cefff){return{'model':db[_0x1cefff[_0xb1c3('0x1f')]],'as':_0x1cefff['as'],'attributes':_0x1cefff[_0xb1c3('0x1c')],'include':_0x1cefff[_0xb1c3('0x20')]?_['map'](_0x1cefff[_0xb1c3('0x20')],function(_0xc6c566){return{'model':db[_0xc6c566[_0xb1c3('0x1f')]],'as':_0xc6c566['as'],'attributes':_0xc6c566[_0xb1c3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb1c3('0x21')](function(_0x17f9e7){logger[_0xb1c3('0xc')](_0xb1c3('0x16'),_0x2bdeed);logger[_0xb1c3('0xe')](_0xb1c3('0x16'),_0x2bdeed,JSON[_0xb1c3('0x22')](_0x17f9e7));_0x36b25f(_0x17f9e7);})[_0xb1c3('0x15')](function(_0x11eb58){logger['error'](_0xb1c3('0x16'),_0x11eb58['message'],_0x2bdeed);_0x1bb2e4(_0x1313a8[_0xb1c3('0x11')](0x1f4,_0x11eb58['message']));});});};exports[_0xb1c3('0x23')]=function(_0x2d6ae7){var _0x194f94=this;return new Promise(function(_0x2714a7,_0x375b03){return db[_0xb1c3('0x17')]['create'](_0x2d6ae7['body'],{'raw':_0x2d6ae7[_0xb1c3('0x19')]?_0x2d6ae7[_0xb1c3('0x19')][_0xb1c3('0x1a')]===undefined?!![]:![]:!![]})[_0xb1c3('0x21')](function(_0x1f22b2){logger[_0xb1c3('0xc')](_0xb1c3('0x23'),_0x2d6ae7);logger['debug'](_0xb1c3('0x23'),_0x2d6ae7,JSON['stringify'](_0x1f22b2));_0x2714a7(_0x1f22b2);})[_0xb1c3('0x15')](function(_0x106e06){logger['error'](_0xb1c3('0x23'),_0x106e06[_0xb1c3('0x13')],_0x2d6ae7);_0x375b03(_0x194f94[_0xb1c3('0x11')](0x1f4,_0x106e06[_0xb1c3('0x13')]));});});};exports['UpdateMemberReport']=function(_0x417372){var _0xc28b8=this;return new Promise(function(_0x2ca797,_0x450ddb){return db[_0xb1c3('0x17')][_0xb1c3('0x24')](_0x417372[_0xb1c3('0x25')],{'raw':_0x417372[_0xb1c3('0x19')]?_0x417372[_0xb1c3('0x19')][_0xb1c3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x417372[_0xb1c3('0x19')]?_0x417372[_0xb1c3('0x19')]['where']||null:null,'attributes':_0x417372[_0xb1c3('0x19')]?_0x417372[_0xb1c3('0x19')]['attributes']||null:null,'limit':_0x417372[_0xb1c3('0x19')]?_0x417372[_0xb1c3('0x19')][_0xb1c3('0x1d')]||null:null})[_0xb1c3('0x21')](function(_0x465328){logger[_0xb1c3('0xc')](_0xb1c3('0x26'),_0x417372);logger[_0xb1c3('0xe')]('UpdateMemberReport',_0x417372,JSON[_0xb1c3('0x22')](_0x465328));_0x2ca797(_0x465328);})[_0xb1c3('0x15')](function(_0x157488){logger['error']('UpdateMemberReport',_0x157488[_0xb1c3('0x13')],_0x417372);_0x450ddb(_0xc28b8[_0xb1c3('0x11')](0x1f4,_0x157488['message']));});});}; \ No newline at end of file +var _0xa23f=['findAll','options','attributes','limit','include','map','model','GetMemberReport','stringify','MemberReport','create','body','CreateMemberReport','UpdateMemberReport','update','raw','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','debug','request\x20sent','error','code','MemberReport,\x20%s,\x20%s','message','catch'];(function(_0x2fb6f4,_0x15bea0){var _0x357f26=function(_0x4d81e8){while(--_0x4d81e8){_0x2fb6f4['push'](_0x2fb6f4['shift']());}};_0x357f26(++_0x15bea0);}(_0xa23f,0x7c));var _0xfa23=function(_0x3002fb,_0x2959f3){_0x3002fb=_0x3002fb-0x0;var _0x297676=_0xa23f[_0x3002fb];return _0x297676;};'use strict';var _=require(_0xfa23('0x0'));var util=require(_0xfa23('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfa23('0x2'));var fs=require('fs');var Redis=require(_0xfa23('0x3'));var db=require(_0xfa23('0x4'))['db'];var utils=require(_0xfa23('0x5'));var logger=require('../../config/logger')(_0xfa23('0x6'));var config=require('../../config/environment');var jayson=require(_0xfa23('0x7'));var client=jayson[_0xfa23('0x8')][_0xfa23('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3696ef,_0x4fb6e6,_0x5a7882){return new BPromise(function(_0x59d53e,_0x19a1ac){return client[_0xfa23('0xa')](_0x3696ef,_0x5a7882)[_0xfa23('0xb')](function(_0x31bb2c){logger[_0xfa23('0xc')]('MemberReport,\x20%s,\x20%s',_0x4fb6e6,'request\x20sent');logger[_0xfa23('0xd')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x4fb6e6,_0xfa23('0xe'),JSON['stringify'](_0x31bb2c));if(_0x31bb2c[_0xfa23('0xf')]){if(_0x31bb2c[_0xfa23('0xf')][_0xfa23('0x10')]===0x1f4){logger['error'](_0xfa23('0x11'),_0x4fb6e6,_0x31bb2c[_0xfa23('0xf')][_0xfa23('0x12')]);return _0x19a1ac(_0x31bb2c['error']['message']);}logger[_0xfa23('0xf')](_0xfa23('0x11'),_0x4fb6e6,_0x31bb2c[_0xfa23('0xf')][_0xfa23('0x12')]);return _0x59d53e(_0x31bb2c['error'][_0xfa23('0x12')]);}else{logger[_0xfa23('0xc')](_0xfa23('0x11'),_0x4fb6e6,_0xfa23('0xe'));_0x59d53e(_0x31bb2c['result'][_0xfa23('0x12')]);}})[_0xfa23('0x13')](function(_0x3ca6be){logger[_0xfa23('0xf')](_0xfa23('0x11'),_0x4fb6e6,_0x3ca6be);_0x19a1ac(_0x3ca6be);});});}exports['GetMemberReport']=function(_0x59610c){var _0x5c3c6d=this;return new Promise(function(_0x445bd0,_0xb3ced2){return db['MemberReport'][_0xfa23('0x14')]({'raw':_0x59610c[_0xfa23('0x15')]?_0x59610c[_0xfa23('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x59610c[_0xfa23('0x15')]?_0x59610c[_0xfa23('0x15')]['where']||null:null,'attributes':_0x59610c[_0xfa23('0x15')]?_0x59610c[_0xfa23('0x15')][_0xfa23('0x16')]||null:null,'limit':_0x59610c[_0xfa23('0x15')]?_0x59610c[_0xfa23('0x15')][_0xfa23('0x17')]||null:null,'include':_0x59610c[_0xfa23('0x15')]?_0x59610c['options'][_0xfa23('0x18')]?_[_0xfa23('0x19')](_0x59610c[_0xfa23('0x15')][_0xfa23('0x18')],function(_0x542cde){return{'model':db[_0x542cde[_0xfa23('0x1a')]],'as':_0x542cde['as'],'attributes':_0x542cde['attributes'],'include':_0x542cde[_0xfa23('0x18')]?_[_0xfa23('0x19')](_0x542cde[_0xfa23('0x18')],function(_0x26bdce){return{'model':db[_0x26bdce[_0xfa23('0x1a')]],'as':_0x26bdce['as'],'attributes':_0x26bdce[_0xfa23('0x16')],'include':_0x26bdce[_0xfa23('0x18')]?_[_0xfa23('0x19')](_0x26bdce['include'],function(_0x2ae826){return{'model':db[_0x2ae826['model']],'as':_0x2ae826['as'],'attributes':_0x2ae826[_0xfa23('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ea972){logger[_0xfa23('0xc')](_0xfa23('0x1b'),_0x59610c);logger[_0xfa23('0xd')](_0xfa23('0x1b'),_0x59610c,JSON[_0xfa23('0x1c')](_0x4ea972));_0x445bd0(_0x4ea972);})[_0xfa23('0x13')](function(_0x3c9d9d){logger['error'](_0xfa23('0x1b'),_0x3c9d9d['message'],_0x59610c);_0xb3ced2(_0x5c3c6d[_0xfa23('0xf')](0x1f4,_0x3c9d9d[_0xfa23('0x12')]));});});};exports['CreateMemberReport']=function(_0x1c83d0){var _0x3a6966=this;return new Promise(function(_0xf9c420,_0x3dadc0){return db[_0xfa23('0x1d')][_0xfa23('0x1e')](_0x1c83d0[_0xfa23('0x1f')],{'raw':_0x1c83d0[_0xfa23('0x15')]?_0x1c83d0[_0xfa23('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xfa23('0xb')](function(_0x59c393){logger[_0xfa23('0xc')](_0xfa23('0x20'),_0x1c83d0);logger[_0xfa23('0xd')](_0xfa23('0x20'),_0x1c83d0,JSON[_0xfa23('0x1c')](_0x59c393));_0xf9c420(_0x59c393);})[_0xfa23('0x13')](function(_0x18f549){logger[_0xfa23('0xf')](_0xfa23('0x20'),_0x18f549['message'],_0x1c83d0);_0x3dadc0(_0x3a6966[_0xfa23('0xf')](0x1f4,_0x18f549['message']));});});};exports[_0xfa23('0x21')]=function(_0x88a593){var _0x17c407=this;return new Promise(function(_0x30ea1e,_0x3fed37){return db[_0xfa23('0x1d')][_0xfa23('0x22')](_0x88a593['body'],{'raw':_0x88a593[_0xfa23('0x15')]?_0x88a593[_0xfa23('0x15')][_0xfa23('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x88a593[_0xfa23('0x15')]?_0x88a593['options']['where']||null:null,'attributes':_0x88a593['options']?_0x88a593[_0xfa23('0x15')][_0xfa23('0x16')]||null:null,'limit':_0x88a593['options']?_0x88a593[_0xfa23('0x15')][_0xfa23('0x17')]||null:null})[_0xfa23('0xb')](function(_0x588fa5){logger[_0xfa23('0xc')]('UpdateMemberReport',_0x88a593);logger[_0xfa23('0xd')](_0xfa23('0x21'),_0x88a593,JSON[_0xfa23('0x1c')](_0x588fa5));_0x30ea1e(_0x588fa5);})[_0xfa23('0x13')](function(_0x1bc029){logger[_0xfa23('0xf')]('UpdateMemberReport',_0x1bc029[_0xfa23('0x12')],_0x88a593);_0x3fed37(_0x17c407[_0xfa23('0xf')](0x1f4,_0x1bc029[_0xfa23('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index e786fb4..14d8644 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 _0x09da=['index','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./migration.controller'];(function(_0x21ed98,_0x4a4209){var _0x4012bf=function(_0x46a9df){while(--_0x46a9df){_0x21ed98['push'](_0x21ed98['shift']());}};_0x4012bf(++_0x4a4209);}(_0x09da,0xf4));var _0xa09d=function(_0x5cd9a0,_0x144f70){_0x5cd9a0=_0x5cd9a0-0x0;var _0x1a3eec=_0x09da[_0x5cd9a0];return _0x1a3eec;};'use strict';var multer=require('multer');var util=require(_0xa09d('0x0'));var path=require(_0xa09d('0x1'));var timeout=require(_0xa09d('0x2'));var express=require(_0xa09d('0x3'));var router=express[_0xa09d('0x4')]();var fs_extra=require(_0xa09d('0x5'));var auth=require(_0xa09d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa09d('0x7'));var controller=require(_0xa09d('0x8'));router['get']('/',controller[_0xa09d('0x9')]);module[_0xa09d('0xa')]=router; \ No newline at end of file +var _0xaa05=['../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x79c09c,_0x3befad){var _0x3621af=function(_0x3a9b59){while(--_0x3a9b59){_0x79c09c['push'](_0x79c09c['shift']());}};_0x3621af(++_0x3befad);}(_0xaa05,0x1c5));var _0x5aa0=function(_0x54c10d,_0x2f2251){_0x54c10d=_0x54c10d-0x0;var _0x1fa703=_0xaa05[_0x54c10d];return _0x1fa703;};'use strict';var multer=require(_0x5aa0('0x0'));var util=require(_0x5aa0('0x1'));var path=require(_0x5aa0('0x2'));var timeout=require(_0x5aa0('0x3'));var express=require(_0x5aa0('0x4'));var router=express['Router']();var fs_extra=require(_0x5aa0('0x5'));var auth=require(_0x5aa0('0x6'));var interaction=require(_0x5aa0('0x7'));var config=require(_0x5aa0('0x8'));var controller=require('./migration.controller');router['get']('/',controller['index']);module[_0x5aa0('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 889ccb1..7d12dd0 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 _0x166f=['exports','STRING','version'];(function(_0x9227eb,_0xac2a5e){var _0x33f484=function(_0x3b8147){while(--_0x3b8147){_0x9227eb['push'](_0x9227eb['shift']());}};_0x33f484(++_0xac2a5e);}(_0x166f,0x102));var _0xf166=function(_0x553c18,_0x27b54b){_0x553c18=_0x553c18-0x0;var _0xa9bc7f=_0x166f[_0x553c18];return _0xa9bc7f;};'use strict';var Sequelize=require('sequelize');module[_0xf166('0x0')]={'version':{'type':Sequelize[_0xf166('0x1')],'unique':_0xf166('0x2')}}; \ No newline at end of file +var _0x7724=['STRING','version','sequelize','exports'];(function(_0x184772,_0x169901){var _0x27b6fa=function(_0x48480d){while(--_0x48480d){_0x184772['push'](_0x184772['shift']());}};_0x27b6fa(++_0x169901);}(_0x7724,0xe6));var _0x4772=function(_0x3848e7,_0x20147a){_0x3848e7=_0x3848e7-0x0;var _0x2d21be=_0x7724[_0x3848e7];return _0x2d21be;};'use strict';var Sequelize=require(_0x4772('0x0'));module[_0x4772('0x1')]={'version':{'type':Sequelize[_0x4772('0x2')],'unique':_0x4772('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 59afbe4..819688e 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 _0x6894=['path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','error','name','send','index','Migration','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','merge','map','options','includeAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x6894,0x13d));var _0x4689=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x6894[_0x2112d4];return _0x434972;};'use strict';var emlformat=require(_0x4689('0x0'));var rimraf=require(_0x4689('0x1'));var zipdir=require(_0x4689('0x2'));var jsonpatch=require(_0x4689('0x3'));var rp=require(_0x4689('0x4'));var moment=require(_0x4689('0x5'));var BPromise=require(_0x4689('0x6'));var Mustache=require('mustache');var util=require(_0x4689('0x7'));var path=require(_0x4689('0x8'));var sox=require(_0x4689('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4689('0xa'));var _=require(_0x4689('0xb'));var squel=require('squel');var crypto=require(_0x4689('0xc'));var jsforce=require(_0x4689('0xd'));var deskjs=require(_0x4689('0xe'));var toCsv=require(_0x4689('0xf'));var querystring=require(_0x4689('0x10'));var Papa=require(_0x4689('0x11'));var Redis=require(_0x4689('0x12'));var authService=require(_0x4689('0x13'));var qs=require(_0x4689('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x4689('0x15'));var config=require(_0x4689('0x16'));var licenseUtil=require(_0x4689('0x17'));var db=require(_0x4689('0x18'))['db'];function respondWithStatusCode(_0x530b09,_0x31437a){_0x31437a=_0x31437a||0xcc;return function(_0xdba35d){if(_0xdba35d){return _0x530b09[_0x4689('0x19')](_0x31437a);}return _0x530b09[_0x4689('0x1a')](_0x31437a)[_0x4689('0x1b')]();};}function respondWithResult(_0x4afce7,_0xdd4afe){_0xdd4afe=_0xdd4afe||0xc8;return function(_0x30fdf9){if(_0x30fdf9){return _0x4afce7['status'](_0xdd4afe)[_0x4689('0x1c')](_0x30fdf9);}};}function respondWithFilteredResult(_0x19e2be,_0x44b089){return function(_0x410c03){if(_0x410c03){var _0x38b320=typeof _0x44b089[_0x4689('0x1d')]===_0x4689('0x1e')&&typeof _0x44b089[_0x4689('0x1f')]===_0x4689('0x1e');var _0x44f534=_0x410c03[_0x4689('0x20')];var _0x112f9d=_0x38b320?0x0:_0x44b089[_0x4689('0x1d')];var _0xa5d406=_0x38b320?_0x410c03[_0x4689('0x20')]:_0x44b089[_0x4689('0x1d')]+_0x44b089[_0x4689('0x1f')];var _0x1bd08d;if(_0xa5d406>=_0x44f534){_0xa5d406=_0x44f534;_0x1bd08d=0xc8;}else{_0x1bd08d=0xce;}_0x19e2be['status'](_0x1bd08d);return _0x19e2be[_0x4689('0x21')]('Content-Range',_0x112f9d+'-'+_0xa5d406+'/'+_0x44f534)[_0x4689('0x1c')](_0x410c03);}return null;};}function patchUpdates(_0x3f2415){return function(_0x5e0579){try{jsonpatch[_0x4689('0x22')](_0x5e0579,_0x3f2415,!![]);}catch(_0x3c9aec){return BPromise[_0x4689('0x23')](_0x3c9aec);}return _0x5e0579['save']();};}function saveUpdates(_0x35e625,_0x32ed08){return function(_0x6e8898){if(_0x6e8898){return _0x6e8898[_0x4689('0x24')](_0x35e625)['then'](function(_0x4b11d9){return _0x4b11d9;});}return null;};}function removeEntity(_0x48c864,_0x1f5ecb){return function(_0x217b09){if(_0x217b09){return _0x217b09[_0x4689('0x25')]()[_0x4689('0x26')](function(){_0x48c864['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x147efc,_0x531f05){return function(_0x466c9b){if(!_0x466c9b){_0x147efc[_0x4689('0x19')](0x194);}return _0x466c9b;};}function handleError(_0x443db3,_0x135ec5){_0x135ec5=_0x135ec5||0x1f4;return function(_0x407efa){logger[_0x4689('0x27')](_0x407efa['stack']);if(_0x407efa[_0x4689('0x28')]){delete _0x407efa['name'];}_0x443db3[_0x4689('0x1a')](_0x135ec5)[_0x4689('0x29')](_0x407efa);};}exports[_0x4689('0x2a')]=function(_0xbfcdc1,_0x4fdfc9){var _0x460a1b={},_0x3db207={},_0x8f09ef={'count':0x0,'rows':[]};var _0x5b139c=_['map'](db[_0x4689('0x2b')]['rawAttributes'],function(_0x50a35c){return{'name':_0x50a35c[_0x4689('0x2c')],'type':_0x50a35c[_0x4689('0x2d')][_0x4689('0x2e')]};});_0x3db207[_0x4689('0x2f')]=_['map'](_0x5b139c,_0x4689('0x28'));_0x3db207[_0x4689('0x30')]=_['keys'](_0xbfcdc1[_0x4689('0x30')]);_0x3db207['filters']=_['intersection'](_0x3db207[_0x4689('0x2f')],_0x3db207[_0x4689('0x30')]);_0x460a1b['attributes']=_[_0x4689('0x31')](_0x3db207[_0x4689('0x2f')],qs[_0x4689('0x32')](_0xbfcdc1['query'][_0x4689('0x32')]));_0x460a1b[_0x4689('0x33')]=_0x460a1b['attributes']['length']?_0x460a1b['attributes']:_0x3db207[_0x4689('0x2f')];if(!_0xbfcdc1['query'][_0x4689('0x34')]('nolimit')){_0x460a1b[_0x4689('0x1f')]=qs['limit'](_0xbfcdc1[_0x4689('0x30')][_0x4689('0x1f')]);_0x460a1b[_0x4689('0x1d')]=qs[_0x4689('0x1d')](_0xbfcdc1[_0x4689('0x30')][_0x4689('0x1d')]);}_0x460a1b[_0x4689('0x35')]=qs[_0x4689('0x36')](_0xbfcdc1[_0x4689('0x30')][_0x4689('0x36')]);_0x460a1b[_0x4689('0x37')]=qs[_0x4689('0x38')](_[_0x4689('0x39')](_0xbfcdc1[_0x4689('0x30')],_0x3db207[_0x4689('0x38')]),_0x5b139c);if(_0xbfcdc1[_0x4689('0x30')][_0x4689('0x3a')]){_0x460a1b['where']=_[_0x4689('0x3b')](_0x460a1b['where'],{'$or':_[_0x4689('0x3c')](_0x5b139c,function(_0x8f17fc){if(_0x8f17fc[_0x4689('0x2d')]!=='VIRTUAL'){var _0x319897={};_0x319897[_0x8f17fc['name']]={'$like':'%'+_0xbfcdc1[_0x4689('0x30')][_0x4689('0x3a')]+'%'};return _0x319897;}})});}_0x460a1b=_[_0x4689('0x3b')]({},_0x460a1b,_0xbfcdc1[_0x4689('0x3d')]);var _0x554130={'where':_0x460a1b[_0x4689('0x37')]};return db[_0x4689('0x2b')][_0x4689('0x20')](_0x554130)[_0x4689('0x26')](function(_0x429772){_0x8f09ef[_0x4689('0x20')]=_0x429772;if(_0xbfcdc1['query'][_0x4689('0x3e')]){_0x460a1b['include']=[{'all':!![]}];}return db[_0x4689('0x2b')]['findAll'](_0x460a1b);})[_0x4689('0x26')](function(_0x46ec0b){_0x8f09ef[_0x4689('0x3f')]=_0x46ec0b;return _0x8f09ef;})['then'](respondWithFilteredResult(_0x4fdfc9,_0x460a1b))[_0x4689('0x40')](handleError(_0x4fdfc9,null));}; \ No newline at end of file +var _0xe359=['nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','Migration','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x44dbfe,_0x4a8bb2){var _0x38d95c=function(_0x51f7d5){while(--_0x51f7d5){_0x44dbfe['push'](_0x44dbfe['shift']());}};_0x38d95c(++_0x4a8bb2);}(_0xe359,0x9b));var _0x9e35=function(_0x740abb,_0x35f52d){_0x740abb=_0x740abb-0x0;var _0x30c379=_0xe359[_0x740abb];return _0x30c379;};'use strict';var emlformat=require(_0x9e35('0x0'));var rimraf=require(_0x9e35('0x1'));var zipdir=require(_0x9e35('0x2'));var jsonpatch=require(_0x9e35('0x3'));var rp=require(_0x9e35('0x4'));var moment=require(_0x9e35('0x5'));var BPromise=require(_0x9e35('0x6'));var Mustache=require(_0x9e35('0x7'));var util=require(_0x9e35('0x8'));var path=require(_0x9e35('0x9'));var sox=require('sox');var csv=require(_0x9e35('0xa'));var ejs=require(_0x9e35('0xb'));var fs=require('fs');var fs_extra=require(_0x9e35('0xc'));var _=require(_0x9e35('0xd'));var squel=require(_0x9e35('0xe'));var crypto=require(_0x9e35('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x9e35('0x10'));var toCsv=require(_0x9e35('0xa'));var querystring=require(_0x9e35('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9e35('0x12'));var as=require(_0x9e35('0x13'));var hardwareService=require(_0x9e35('0x14'));var logger=require(_0x9e35('0x15'))(_0x9e35('0x16'));var utils=require(_0x9e35('0x17'));var config=require(_0x9e35('0x18'));var licenseUtil=require(_0x9e35('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x318400,_0x20f961){_0x20f961=_0x20f961||0xcc;return function(_0x31fda5){if(_0x31fda5){return _0x318400[_0x9e35('0x1a')](_0x20f961);}return _0x318400[_0x9e35('0x1b')](_0x20f961)[_0x9e35('0x1c')]();};}function respondWithResult(_0x1ab25e,_0x44199a){_0x44199a=_0x44199a||0xc8;return function(_0x127337){if(_0x127337){return _0x1ab25e['status'](_0x44199a)[_0x9e35('0x1d')](_0x127337);}};}function respondWithFilteredResult(_0x56bf69,_0x1ae18b){return function(_0x59f5aa){if(_0x59f5aa){var _0x4da9e0=typeof _0x1ae18b['offset']===_0x9e35('0x1e')&&typeof _0x1ae18b['limit']===_0x9e35('0x1e');var _0x32ca3e=_0x59f5aa[_0x9e35('0x1f')];var _0x2b5859=_0x4da9e0?0x0:_0x1ae18b[_0x9e35('0x20')];var _0x40584e=_0x4da9e0?_0x59f5aa[_0x9e35('0x1f')]:_0x1ae18b[_0x9e35('0x20')]+_0x1ae18b['limit'];var _0x496ea5;if(_0x40584e>=_0x32ca3e){_0x40584e=_0x32ca3e;_0x496ea5=0xc8;}else{_0x496ea5=0xce;}_0x56bf69[_0x9e35('0x1b')](_0x496ea5);return _0x56bf69[_0x9e35('0x21')](_0x9e35('0x22'),_0x2b5859+'-'+_0x40584e+'/'+_0x32ca3e)['json'](_0x59f5aa);}return null;};}function patchUpdates(_0x442bae){return function(_0x1d55ed){try{jsonpatch[_0x9e35('0x23')](_0x1d55ed,_0x442bae,!![]);}catch(_0x83689c){return BPromise[_0x9e35('0x24')](_0x83689c);}return _0x1d55ed[_0x9e35('0x25')]();};}function saveUpdates(_0x29e0ea,_0xdd2506){return function(_0x492b73){if(_0x492b73){return _0x492b73[_0x9e35('0x26')](_0x29e0ea)[_0x9e35('0x27')](function(_0x40f685){return _0x40f685;});}return null;};}function removeEntity(_0x46c180,_0xb2a1ce){return function(_0x3cef77){if(_0x3cef77){return _0x3cef77[_0x9e35('0x28')]()[_0x9e35('0x27')](function(){_0x46c180['status'](0xcc)[_0x9e35('0x1c')]();});}};}function handleEntityNotFound(_0x244ac6,_0x41d19e){return function(_0x4138ee){if(!_0x4138ee){_0x244ac6[_0x9e35('0x1a')](0x194);}return _0x4138ee;};}function handleError(_0x16861f,_0x59a946){_0x59a946=_0x59a946||0x1f4;return function(_0x3bba7d){logger['error'](_0x3bba7d[_0x9e35('0x29')]);if(_0x3bba7d[_0x9e35('0x2a')]){delete _0x3bba7d[_0x9e35('0x2a')];}_0x16861f['status'](_0x59a946)[_0x9e35('0x2b')](_0x3bba7d);};}exports[_0x9e35('0x2c')]=function(_0x2937ba,_0x36afcb){var _0x2984b7={},_0x3d65fb={},_0x2db00b={'count':0x0,'rows':[]};var _0x159c03=_[_0x9e35('0x2d')](db[_0x9e35('0x2e')][_0x9e35('0x2f')],function(_0x23962a){return{'name':_0x23962a['fieldName'],'type':_0x23962a[_0x9e35('0x30')]['key']};});_0x3d65fb[_0x9e35('0x31')]=_[_0x9e35('0x2d')](_0x159c03,'name');_0x3d65fb[_0x9e35('0x32')]=_[_0x9e35('0x33')](_0x2937ba[_0x9e35('0x32')]);_0x3d65fb[_0x9e35('0x34')]=_[_0x9e35('0x35')](_0x3d65fb['model'],_0x3d65fb[_0x9e35('0x32')]);_0x2984b7[_0x9e35('0x36')]=_[_0x9e35('0x35')](_0x3d65fb['model'],qs[_0x9e35('0x37')](_0x2937ba[_0x9e35('0x32')][_0x9e35('0x37')]));_0x2984b7[_0x9e35('0x36')]=_0x2984b7[_0x9e35('0x36')][_0x9e35('0x38')]?_0x2984b7[_0x9e35('0x36')]:_0x3d65fb['model'];if(!_0x2937ba[_0x9e35('0x32')][_0x9e35('0x39')](_0x9e35('0x3a'))){_0x2984b7[_0x9e35('0x3b')]=qs[_0x9e35('0x3b')](_0x2937ba[_0x9e35('0x32')]['limit']);_0x2984b7['offset']=qs[_0x9e35('0x20')](_0x2937ba[_0x9e35('0x32')][_0x9e35('0x20')]);}_0x2984b7[_0x9e35('0x3c')]=qs['sort'](_0x2937ba[_0x9e35('0x32')][_0x9e35('0x3d')]);_0x2984b7[_0x9e35('0x3e')]=qs[_0x9e35('0x34')](_['pick'](_0x2937ba[_0x9e35('0x32')],_0x3d65fb['filters']),_0x159c03);if(_0x2937ba['query'][_0x9e35('0x3f')]){_0x2984b7[_0x9e35('0x3e')]=_[_0x9e35('0x40')](_0x2984b7[_0x9e35('0x3e')],{'$or':_[_0x9e35('0x2d')](_0x159c03,function(_0x3ac39d){if(_0x3ac39d['type']!==_0x9e35('0x41')){var _0x3af808={};_0x3af808[_0x3ac39d[_0x9e35('0x2a')]]={'$like':'%'+_0x2937ba[_0x9e35('0x32')][_0x9e35('0x3f')]+'%'};return _0x3af808;}})});}_0x2984b7=_['merge']({},_0x2984b7,_0x2937ba[_0x9e35('0x42')]);var _0x33edc0={'where':_0x2984b7[_0x9e35('0x3e')]};return db[_0x9e35('0x2e')]['count'](_0x33edc0)[_0x9e35('0x27')](function(_0x961bc3){_0x2db00b[_0x9e35('0x1f')]=_0x961bc3;if(_0x2937ba[_0x9e35('0x32')][_0x9e35('0x43')]){_0x2984b7[_0x9e35('0x44')]=[{'all':!![]}];}return db[_0x9e35('0x2e')]['findAll'](_0x2984b7);})['then'](function(_0xea7c55){_0x2db00b[_0x9e35('0x45')]=_0xea7c55;return _0x2db00b;})[_0x9e35('0x27')](respondWithFilteredResult(_0x36afcb,_0x2984b7))[_0x9e35('0x46')](handleError(_0x36afcb,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index f8f2cae..3a7c747 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 _0x0ce0=['rimraf','../../config/environment','./migration.attributes','exports','define','migrations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1d043f,_0x334dae){var _0x1c65d2=function(_0x530e95){while(--_0x530e95){_0x1d043f['push'](_0x1d043f['shift']());}};_0x1c65d2(++_0x334dae);}(_0x0ce0,0x14a));var _0x00ce=function(_0x2d486b,_0x5f213c){_0x2d486b=_0x2d486b-0x0;var _0x4291d1=_0x0ce0[_0x2d486b];return _0x4291d1;};'use strict';var _=require(_0x00ce('0x0'));var util=require(_0x00ce('0x1'));var logger=require(_0x00ce('0x2'))(_0x00ce('0x3'));var moment=require('moment');var BPromise=require(_0x00ce('0x4'));var rp=require(_0x00ce('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x00ce('0x6'));var config=require(_0x00ce('0x7'));var attributes=require(_0x00ce('0x8'));module[_0x00ce('0x9')]=function(_0x1638b5,_0x1f81c4){return _0x1638b5[_0x00ce('0xa')]('Migration',attributes,{'tableName':_0x00ce('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb29=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','Migration','lodash','util','../../config/logger','api'];(function(_0x312d8d,_0x29b4a3){var _0x2a070=function(_0x562935){while(--_0x562935){_0x312d8d['push'](_0x312d8d['shift']());}};_0x2a070(++_0x29b4a3);}(_0xeb29,0x1a0));var _0x9eb2=function(_0x4f64ed,_0x59c8c4){_0x4f64ed=_0x4f64ed-0x0;var _0x206f04=_0xeb29[_0x4f64ed];return _0x206f04;};'use strict';var _=require(_0x9eb2('0x0'));var util=require(_0x9eb2('0x1'));var logger=require(_0x9eb2('0x2'))(_0x9eb2('0x3'));var moment=require(_0x9eb2('0x4'));var BPromise=require(_0x9eb2('0x5'));var rp=require(_0x9eb2('0x6'));var fs=require('fs');var path=require(_0x9eb2('0x7'));var rimraf=require(_0x9eb2('0x8'));var config=require(_0x9eb2('0x9'));var attributes=require('./migration.attributes');module['exports']=function(_0x38161a,_0x45e9da){return _0x38161a[_0x9eb2('0xa')](_0x9eb2('0xb'),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 86f5987..57b0ad3 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 _0x3189=['../../config/environment','jayson/promise','http','then','info','Migration,\x20%s,\x20%s','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x44781c,_0x30688f){var _0x5ece97=function(_0x33a68c){while(--_0x33a68c){_0x44781c['push'](_0x44781c['shift']());}};_0x5ece97(++_0x30688f);}(_0x3189,0xae));var _0x9318=function(_0x299267,_0x34c247){_0x299267=_0x299267-0x0;var _0x3392b0=_0x3189[_0x299267];return _0x3392b0;};'use strict';var _=require(_0x9318('0x0'));var util=require(_0x9318('0x1'));var moment=require('moment');var BPromise=require(_0x9318('0x2'));var rs=require(_0x9318('0x3'));var fs=require('fs');var Redis=require(_0x9318('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9318('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x9318('0x6'));var jayson=require(_0x9318('0x7'));var client=jayson['client'][_0x9318('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4bb3c3,_0x4dbe95,_0x2f6831){return new BPromise(function(_0x324307,_0x1bfed6){return client['request'](_0x4bb3c3,_0x2f6831)[_0x9318('0x9')](function(_0x2e8d1c){logger[_0x9318('0xa')](_0x9318('0xb'),_0x4dbe95,'request\x20sent');logger['debug'](_0x9318('0xc'),_0x4dbe95,'request\x20sent',JSON[_0x9318('0xd')](_0x2e8d1c));if(_0x2e8d1c[_0x9318('0xe')]){if(_0x2e8d1c[_0x9318('0xe')]['code']===0x1f4){logger[_0x9318('0xe')]('Migration,\x20%s,\x20%s',_0x4dbe95,_0x2e8d1c['error'][_0x9318('0xf')]);return _0x1bfed6(_0x2e8d1c['error'][_0x9318('0xf')]);}logger[_0x9318('0xe')]('Migration,\x20%s,\x20%s',_0x4dbe95,_0x2e8d1c[_0x9318('0xe')][_0x9318('0xf')]);return _0x324307(_0x2e8d1c[_0x9318('0xe')]['message']);}else{logger['info'](_0x9318('0xb'),_0x4dbe95,_0x9318('0x10'));_0x324307(_0x2e8d1c['result'][_0x9318('0xf')]);}})[_0x9318('0x11')](function(_0x5e1238){logger[_0x9318('0xe')](_0x9318('0xb'),_0x4dbe95,_0x5e1238);_0x1bfed6(_0x5e1238);});});} \ No newline at end of file +var _0xadcc=['debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','Migration,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2f815e,_0x4a048d){var _0x4a9022=function(_0x4bd1b0){while(--_0x4bd1b0){_0x2f815e['push'](_0x2f815e['shift']());}};_0x4a9022(++_0x4a048d);}(_0xadcc,0x76));var _0xcadc=function(_0x547364,_0x267aa1){_0x547364=_0x547364-0x0;var _0x50ef75=_0xadcc[_0x547364];return _0x50ef75;};'use strict';var _=require(_0xcadc('0x0'));var util=require('util');var moment=require(_0xcadc('0x1'));var BPromise=require(_0xcadc('0x2'));var rs=require(_0xcadc('0x3'));var fs=require('fs');var Redis=require(_0xcadc('0x4'));var db=require(_0xcadc('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcadc('0x6'));var config=require(_0xcadc('0x7'));var jayson=require(_0xcadc('0x8'));var client=jayson[_0xcadc('0x9')][_0xcadc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x294977,_0x4a0567,_0x346f54){return new BPromise(function(_0x1d3edf,_0x204f2b){return client[_0xcadc('0xb')](_0x294977,_0x346f54)[_0xcadc('0xc')](function(_0x22268c){logger[_0xcadc('0xd')]('Migration,\x20%s,\x20%s',_0x4a0567,'request\x20sent');logger[_0xcadc('0xe')](_0xcadc('0xf'),_0x4a0567,'request\x20sent',JSON[_0xcadc('0x10')](_0x22268c));if(_0x22268c[_0xcadc('0x11')]){if(_0x22268c[_0xcadc('0x11')]['code']===0x1f4){logger['error'](_0xcadc('0x12'),_0x4a0567,_0x22268c[_0xcadc('0x11')][_0xcadc('0x13')]);return _0x204f2b(_0x22268c[_0xcadc('0x11')]['message']);}logger[_0xcadc('0x11')]('Migration,\x20%s,\x20%s',_0x4a0567,_0x22268c[_0xcadc('0x11')][_0xcadc('0x13')]);return _0x1d3edf(_0x22268c[_0xcadc('0x11')]['message']);}else{logger[_0xcadc('0xd')](_0xcadc('0x12'),_0x4a0567,'request\x20sent');_0x1d3edf(_0x22268c[_0xcadc('0x14')]['message']);}})[_0xcadc('0x15')](function(_0x36d544){logger[_0xcadc('0x11')](_0xcadc('0x12'),_0x4a0567,_0x36d544);_0x204f2b(_0x36d544);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index e9b675c..819280d 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 _0x1c23=['../../components/auth/service','../../components/interaction/service','./network.controller','get','isAuthenticated','index','show','post','create','update','delete','/:id','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x1c23,0x1d5));var _0x31c2=function(_0x3c5e02,_0x223581){_0x3c5e02=_0x3c5e02-0x0;var _0x351027=_0x1c23[_0x3c5e02];return _0x351027;};'use strict';var multer=require(_0x31c2('0x0'));var util=require(_0x31c2('0x1'));var path=require(_0x31c2('0x2'));var timeout=require(_0x31c2('0x3'));var express=require(_0x31c2('0x4'));var router=express[_0x31c2('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x31c2('0x6'));var interaction=require(_0x31c2('0x7'));var config=require('../../config/environment');var controller=require(_0x31c2('0x8'));router[_0x31c2('0x9')]('/',auth[_0x31c2('0xa')](),controller[_0x31c2('0xb')]);router[_0x31c2('0x9')]('/:id',auth[_0x31c2('0xa')](),controller[_0x31c2('0xc')]);router[_0x31c2('0xd')]('/',auth[_0x31c2('0xa')](),controller[_0x31c2('0xe')]);router['put']('/:id',auth[_0x31c2('0xa')](),controller[_0x31c2('0xf')]);router[_0x31c2('0x10')](_0x31c2('0x11'),auth[_0x31c2('0xa')](),controller[_0x31c2('0x12')]);module['exports']=router; \ No newline at end of file +var _0x788c=['show','post','create','update','delete','destroy','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./network.controller','index','get','/:id','isAuthenticated'];(function(_0x483ab9,_0x419148){var _0x35043b=function(_0x3453a3){while(--_0x3453a3){_0x483ab9['push'](_0x483ab9['shift']());}};_0x35043b(++_0x419148);}(_0x788c,0xf6));var _0xc788=function(_0x4b2349,_0x592967){_0x4b2349=_0x4b2349-0x0;var _0x4a623e=_0x788c[_0x4b2349];return _0x4a623e;};'use strict';var multer=require('multer');var util=require(_0xc788('0x0'));var path=require('path');var timeout=require(_0xc788('0x1'));var express=require('express');var router=express[_0xc788('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc788('0x3'));var config=require(_0xc788('0x4'));var controller=require(_0xc788('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xc788('0x6')]);router[_0xc788('0x7')](_0xc788('0x8'),auth[_0xc788('0x9')](),controller[_0xc788('0xa')]);router[_0xc788('0xb')]('/',auth['isAuthenticated'](),controller[_0xc788('0xc')]);router['put'](_0xc788('0x8'),auth[_0xc788('0x9')](),controller[_0xc788('0xd')]);router[_0xc788('0xe')](_0xc788('0x8'),auth[_0xc788('0x9')](),controller[_0xc788('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index a5b009c..aeb7ec6 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 _0x8ce0=['exports','ENUM','localnet','externip','turn','STRING','sequelize'];(function(_0x3bf55c,_0x5966f6){var _0x16d47d=function(_0x2a14cd){while(--_0x2a14cd){_0x3bf55c['push'](_0x3bf55c['shift']());}};_0x16d47d(++_0x5966f6);}(_0x8ce0,0x16b));var _0x08ce=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8ce0[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x08ce('0x0'));module[_0x08ce('0x1')]={'type':{'type':Sequelize[_0x08ce('0x2')](_0x08ce('0x3'),_0x08ce('0x4'),'stun',_0x08ce('0x5'))},'value':{'type':Sequelize[_0x08ce('0x6')]},'username':{'type':Sequelize[_0x08ce('0x6')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8a51=['STRING','sequelize','exports','ENUM','localnet','externip','turn'];(function(_0x4070d9,_0x4127c4){var _0x386e76=function(_0x1211fc){while(--_0x1211fc){_0x4070d9['push'](_0x4070d9['shift']());}};_0x386e76(++_0x4127c4);}(_0x8a51,0x1d6));var _0x18a5=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8a51[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x18a5('0x0'));module[_0x18a5('0x1')]={'type':{'type':Sequelize[_0x18a5('0x2')](_0x18a5('0x3'),_0x18a5('0x4'),'stun',_0x18a5('0x5'))},'value':{'type':Sequelize[_0x18a5('0x6')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x18a5('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 8f8ec69..aa7b13c 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 _0xc698=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','http','then','Network,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','end','status','json','offset','limit','count','Content-Range','apply','save','update','destroy','sendStatus','map','Network','type','key','model','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','length','find','create','sequelize','transaction','body','toUpperCase','STUN','readFileSync','join','root','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','render','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','server/files/templates/stun_multiple.ejs','TURN','/etc/asterisk/turn_xcally.conf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce'];(function(_0x3fee84,_0x3063bb){var _0x40db4a=function(_0x5976fe){while(--_0x5976fe){_0x3fee84['push'](_0x3fee84['shift']());}};_0x40db4a(++_0x3063bb);}(_0xc698,0x116));var _0x8c69=function(_0x11a55c,_0x4eced9){_0x11a55c=_0x11a55c-0x0;var _0x26c390=_0xc698[_0x11a55c];return _0x26c390;};'use strict';var emlformat=require(_0x8c69('0x0'));var rimraf=require(_0x8c69('0x1'));var zipdir=require(_0x8c69('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c69('0x3'));var moment=require(_0x8c69('0x4'));var BPromise=require(_0x8c69('0x5'));var Mustache=require('mustache');var util=require(_0x8c69('0x6'));var path=require('path');var sox=require(_0x8c69('0x7'));var csv=require(_0x8c69('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8c69('0x9'));var squel=require(_0x8c69('0xa'));var crypto=require(_0x8c69('0xb'));var jsforce=require(_0x8c69('0xc'));var deskjs=require(_0x8c69('0xd'));var toCsv=require(_0x8c69('0x8'));var querystring=require(_0x8c69('0xe'));var Papa=require(_0x8c69('0xf'));var Redis=require(_0x8c69('0x10'));var authService=require(_0x8c69('0x11'));var qs=require(_0x8c69('0x12'));var as=require(_0x8c69('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c69('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x8c69('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8c69('0x16'))['db'];var jayson=require(_0x8c69('0x17'));var client=jayson['client'][_0x8c69('0x18')]({'port':0x232a});function respondWithRpcPromise(_0xf601dd,_0x512367,_0x3c30ac,_0x50fceb){return new BPromise(function(_0x46fe8b,_0x1b8825){var _0x4d9cf8=_0x50fceb||client;return _0x4d9cf8['request'](_0xf601dd,_0x3c30ac)[_0x8c69('0x19')](function(_0x4f9ad8){logger['info'](_0x8c69('0x1a'),_0x512367,'request\x20sent');logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x512367,_0x8c69('0x1b'),JSON[_0x8c69('0x1c')](_0x4f9ad8));if(_0x4f9ad8[_0x8c69('0x1d')]){if(_0x4f9ad8[_0x8c69('0x1d')]['code']===0x1f4){logger[_0x8c69('0x1d')](_0x8c69('0x1a'),_0x512367,_0x4f9ad8['error'][_0x8c69('0x1e')]);return _0x1b8825(_0x4f9ad8[_0x8c69('0x1d')][_0x8c69('0x1e')]);}logger[_0x8c69('0x1d')](_0x8c69('0x1a'),_0x512367,_0x4f9ad8[_0x8c69('0x1d')]['message']);return _0x46fe8b(_0x4f9ad8['error']['message']);}else{logger['info']('Network,\x20%s,\x20%s',_0x512367,'request\x20sent');_0x46fe8b(_0x4f9ad8['result'][_0x8c69('0x1e')]);}})[_0x8c69('0x1f')](function(_0x3b5b0d){logger[_0x8c69('0x1d')]('Network,\x20%s,\x20%s',_0x512367,_0x3b5b0d);_0x1b8825(_0x3b5b0d);});});}function respondWithStatusCode(_0x5c1bd7,_0x3f8895){_0x3f8895=_0x3f8895||0xcc;return function(_0x249800){if(_0x249800){return _0x5c1bd7['sendStatus'](_0x3f8895);}return _0x5c1bd7['status'](_0x3f8895)[_0x8c69('0x20')]();};}function respondWithResult(_0x4d2c30,_0x17d698){_0x17d698=_0x17d698||0xc8;return function(_0x29b9b0){if(_0x29b9b0){return _0x4d2c30[_0x8c69('0x21')](_0x17d698)[_0x8c69('0x22')](_0x29b9b0);}};}function respondWithFilteredResult(_0x2d76c7,_0x22ac6c){return function(_0xe06835){if(_0xe06835){var _0x534b8c=typeof _0x22ac6c[_0x8c69('0x23')]==='undefined'&&typeof _0x22ac6c[_0x8c69('0x24')]==='undefined';var _0x3057d8=_0xe06835[_0x8c69('0x25')];var _0x479bd6=_0x534b8c?0x0:_0x22ac6c[_0x8c69('0x23')];var _0x131106=_0x534b8c?_0xe06835[_0x8c69('0x25')]:_0x22ac6c['offset']+_0x22ac6c[_0x8c69('0x24')];var _0x2322dc;if(_0x131106>=_0x3057d8){_0x131106=_0x3057d8;_0x2322dc=0xc8;}else{_0x2322dc=0xce;}_0x2d76c7[_0x8c69('0x21')](_0x2322dc);return _0x2d76c7['set'](_0x8c69('0x26'),_0x479bd6+'-'+_0x131106+'/'+_0x3057d8)[_0x8c69('0x22')](_0xe06835);}return null;};}function patchUpdates(_0x4d3b74){return function(_0x58ce66){try{jsonpatch[_0x8c69('0x27')](_0x58ce66,_0x4d3b74,!![]);}catch(_0x545468){return BPromise['reject'](_0x545468);}return _0x58ce66[_0x8c69('0x28')]();};}function saveUpdates(_0x35ef39,_0x4e02f9){return function(_0x4beb68){if(_0x4beb68){return _0x4beb68[_0x8c69('0x29')](_0x35ef39)[_0x8c69('0x19')](function(_0x4c6c9f){return _0x4c6c9f;});}return null;};}function removeEntity(_0x4f5b3a,_0x1cbb42){return function(_0x5448cb){if(_0x5448cb){return _0x5448cb[_0x8c69('0x2a')]()[_0x8c69('0x19')](function(){_0x4f5b3a[_0x8c69('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28f646,_0x24fd59){return function(_0x3d2b8a){if(!_0x3d2b8a){_0x28f646[_0x8c69('0x2b')](0x194);}return _0x3d2b8a;};}function handleError(_0xead370,_0x1477a8){_0x1477a8=_0x1477a8||0x1f4;return function(_0x53c7f7){logger[_0x8c69('0x1d')](_0x53c7f7['stack']);if(_0x53c7f7['name']){delete _0x53c7f7['name'];}_0xead370['status'](_0x1477a8)['send'](_0x53c7f7);};}exports['index']=function(_0x142b59,_0x4f1a91){var _0x531b7f={},_0x1e2a2b={},_0x46d2fe={'count':0x0,'rows':[]};var _0x339ed4=_[_0x8c69('0x2c')](db[_0x8c69('0x2d')]['rawAttributes'],function(_0xd1bba1){return{'name':_0xd1bba1['fieldName'],'type':_0xd1bba1[_0x8c69('0x2e')][_0x8c69('0x2f')]};});_0x1e2a2b[_0x8c69('0x30')]=_[_0x8c69('0x2c')](_0x339ed4,_0x8c69('0x31'));_0x1e2a2b[_0x8c69('0x32')]=_[_0x8c69('0x33')](_0x142b59['query']);_0x1e2a2b[_0x8c69('0x34')]=_[_0x8c69('0x35')](_0x1e2a2b[_0x8c69('0x30')],_0x1e2a2b[_0x8c69('0x32')]);_0x531b7f['attributes']=_[_0x8c69('0x35')](_0x1e2a2b[_0x8c69('0x30')],qs['fields'](_0x142b59['query'][_0x8c69('0x36')]));_0x531b7f[_0x8c69('0x37')]=_0x531b7f[_0x8c69('0x37')]['length']?_0x531b7f[_0x8c69('0x37')]:_0x1e2a2b[_0x8c69('0x30')];if(!_0x142b59[_0x8c69('0x32')][_0x8c69('0x38')](_0x8c69('0x39'))){_0x531b7f['limit']=qs[_0x8c69('0x24')](_0x142b59[_0x8c69('0x32')][_0x8c69('0x24')]);_0x531b7f['offset']=qs[_0x8c69('0x23')](_0x142b59['query'][_0x8c69('0x23')]);}_0x531b7f[_0x8c69('0x3a')]=qs[_0x8c69('0x3b')](_0x142b59[_0x8c69('0x32')][_0x8c69('0x3b')]);_0x531b7f[_0x8c69('0x3c')]=qs['filters'](_[_0x8c69('0x3d')](_0x142b59[_0x8c69('0x32')],_0x1e2a2b[_0x8c69('0x34')]),_0x339ed4);if(_0x142b59[_0x8c69('0x32')][_0x8c69('0x3e')]){_0x531b7f[_0x8c69('0x3c')]=_[_0x8c69('0x3f')](_0x531b7f[_0x8c69('0x3c')],{'$or':_['map'](_0x339ed4,function(_0x1ddb02){if(_0x1ddb02[_0x8c69('0x2e')]!==_0x8c69('0x40')){var _0x15e990={};_0x15e990[_0x1ddb02['name']]={'$like':'%'+_0x142b59[_0x8c69('0x32')][_0x8c69('0x3e')]+'%'};return _0x15e990;}})});}_0x531b7f=_[_0x8c69('0x3f')]({},_0x531b7f,_0x142b59['options']);var _0xbf092b={'where':_0x531b7f[_0x8c69('0x3c')]};return db[_0x8c69('0x2d')][_0x8c69('0x25')](_0xbf092b)[_0x8c69('0x19')](function(_0x20cae2){_0x46d2fe[_0x8c69('0x25')]=_0x20cae2;if(_0x142b59['query'][_0x8c69('0x41')]){_0x531b7f[_0x8c69('0x42')]=[{'all':!![]}];}return db[_0x8c69('0x2d')][_0x8c69('0x43')](_0x531b7f);})[_0x8c69('0x19')](function(_0x15d61c){_0x46d2fe[_0x8c69('0x44')]=_0x15d61c;return _0x46d2fe;})['then'](respondWithFilteredResult(_0x4f1a91,_0x531b7f))['catch'](handleError(_0x4f1a91,null));};exports[_0x8c69('0x45')]=function(_0x54500c,_0x4713b6){var _0x151ff6={'raw':!![],'where':{'id':_0x54500c[_0x8c69('0x46')]['id']}},_0x20dfbc={};_0x20dfbc[_0x8c69('0x30')]=_[_0x8c69('0x33')](db[_0x8c69('0x2d')]['rawAttributes']);_0x20dfbc[_0x8c69('0x32')]=_[_0x8c69('0x33')](_0x54500c[_0x8c69('0x32')]);_0x20dfbc[_0x8c69('0x34')]=_['intersection'](_0x20dfbc[_0x8c69('0x30')],_0x20dfbc[_0x8c69('0x32')]);_0x151ff6[_0x8c69('0x37')]=_['intersection'](_0x20dfbc['model'],qs[_0x8c69('0x36')](_0x54500c[_0x8c69('0x32')][_0x8c69('0x36')]));_0x151ff6[_0x8c69('0x37')]=_0x151ff6[_0x8c69('0x37')][_0x8c69('0x47')]?_0x151ff6[_0x8c69('0x37')]:_0x20dfbc[_0x8c69('0x30')];if(_0x54500c[_0x8c69('0x32')][_0x8c69('0x41')]){_0x151ff6[_0x8c69('0x42')]=[{'all':!![]}];}_0x151ff6=_['merge']({},_0x151ff6,_0x54500c['options']);return db[_0x8c69('0x2d')][_0x8c69('0x48')](_0x151ff6)[_0x8c69('0x19')](handleEntityNotFound(_0x4713b6,null))[_0x8c69('0x19')](respondWithResult(_0x4713b6,null))[_0x8c69('0x1f')](handleError(_0x4713b6,null));};exports[_0x8c69('0x49')]=function(_0x8f26e8,_0x14d1d8,_0x4d64bd){var _0x529095;return db[_0x8c69('0x4a')][_0x8c69('0x4b')](function(_0x4d00c8){return db[_0x8c69('0x2d')][_0x8c69('0x49')](_0x8f26e8[_0x8c69('0x4c')],{'raw':!![]})['then'](function(_0x5d0c64){_0x529095=_0x5d0c64;return db[_0x8c69('0x2d')]['findAll']({'where':{'type':_0x8f26e8[_0x8c69('0x4c')][_0x8c69('0x2e')]},'raw':!![]});})[_0x8c69('0x19')](function(_0x410f3d){if(_0x529095[_0x8c69('0x2e')][_0x8c69('0x4d')]()==_0x8c69('0x4e')){var _0x4cb17c=fs[_0x8c69('0x4f')](path[_0x8c69('0x50')](config[_0x8c69('0x51')],'server/files/templates/stun_multiple.ejs'),_0x8c69('0x52'));var _0x154de8=ejs['render'](_0x4cb17c,{'networks':_0x410f3d||[]});fs[_0x8c69('0x53')](_0x8c69('0x54'),_0x154de8);return respondWithRpcPromise(_0x8c69('0x55'),_0x8c69('0x49'),{'module':_0x8c69('0x56')});}else if(_0x529095[_0x8c69('0x2e')][_0x8c69('0x4d')]()=='TURN'){var _0xaec233=fs[_0x8c69('0x4f')](path['join'](config['root'],_0x8c69('0x57')),_0x8c69('0x52'));var _0x12cada=ejs[_0x8c69('0x58')](_0xaec233,{'networks':_0x410f3d||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x12cada);return respondWithRpcPromise(_0x8c69('0x55'),_0x8c69('0x49'),{'module':_0x8c69('0x56')});}else{var _0x448b7c=fs[_0x8c69('0x4f')](path[_0x8c69('0x50')](config[_0x8c69('0x51')],_0x8c69('0x59')),_0x8c69('0x52'));var _0x2507f0=ejs[_0x8c69('0x58')](_0x448b7c,{'networks':_0x410f3d||[]});fs[_0x8c69('0x53')](util[_0x8c69('0x5a')](_0x8c69('0x5b'),_0x8f26e8[_0x8c69('0x4c')][_0x8c69('0x2e')][_0x8c69('0x5c')]()),_0x2507f0);return respondWithRpcPromise(_0x8c69('0x55'),'create',{'module':_0x8c69('0x5d')});}return null;})['then'](function(){return _0x529095;});})['then'](respondWithResult(_0x14d1d8,0xc9))[_0x8c69('0x1f')](handleError(_0x14d1d8,null));};exports[_0x8c69('0x29')]=function(_0x4684ea,_0x174123,_0x59c40a){var _0x5d9221;return db[_0x8c69('0x4a')][_0x8c69('0x4b')](function(_0x43520a){return db[_0x8c69('0x2d')][_0x8c69('0x48')]({'where':{'id':_0x4684ea[_0x8c69('0x46')]['id']}})[_0x8c69('0x19')](handleEntityNotFound(_0x174123,null))[_0x8c69('0x19')](saveUpdates(_0x4684ea[_0x8c69('0x4c')],null))[_0x8c69('0x19')](function(_0x2bd702){if(_0x2bd702){_0x5d9221=_0x2bd702;return db['Network'][_0x8c69('0x43')]({'where':{'type':_0x5d9221[_0x8c69('0x2e')]},'raw':!![]});}return null;})[_0x8c69('0x19')](function(_0x23ab32){if(_0x5d9221[_0x8c69('0x2e')][_0x8c69('0x4d')]()==_0x8c69('0x4e')){var _0x174e8f=fs[_0x8c69('0x4f')](path['join'](config[_0x8c69('0x51')],_0x8c69('0x5e')),'utf8');var _0x26ff0b=ejs[_0x8c69('0x58')](_0x174e8f,{'networks':_0x23ab32||[]});fs[_0x8c69('0x53')](_0x8c69('0x54'),_0x26ff0b);return respondWithRpcPromise(_0x8c69('0x55'),'update',{'module':_0x8c69('0x56')});}else if(_0x5d9221[_0x8c69('0x2e')][_0x8c69('0x4d')]()==_0x8c69('0x5f')){var _0x4cce8f=fs[_0x8c69('0x4f')](path[_0x8c69('0x50')](config[_0x8c69('0x51')],_0x8c69('0x57')),_0x8c69('0x52'));var _0x114d3a=ejs[_0x8c69('0x58')](_0x4cce8f,{'networks':_0x23ab32||[]});fs[_0x8c69('0x53')](_0x8c69('0x60'),_0x114d3a);return respondWithRpcPromise(_0x8c69('0x55'),_0x8c69('0x29'),{'module':_0x8c69('0x56')});}else{var _0x1bedc2=fs[_0x8c69('0x4f')](path[_0x8c69('0x50')](config[_0x8c69('0x51')],_0x8c69('0x59')),_0x8c69('0x52'));var _0xbba349=ejs[_0x8c69('0x58')](_0x1bedc2,{'networks':_0x23ab32||[]});fs[_0x8c69('0x53')](util[_0x8c69('0x5a')](_0x8c69('0x5b'),_0x4684ea[_0x8c69('0x4c')][_0x8c69('0x2e')]['toLowerCase']()),_0xbba349);return respondWithRpcPromise(_0x8c69('0x55'),_0x8c69('0x29'),{'module':_0x8c69('0x5d')});}return null;})['then'](function(_0x43b75f){if(_0x43b75f){return _0x5d9221;}return null;});})[_0x8c69('0x19')](respondWithResult(_0x174123,null))[_0x8c69('0x1f')](handleError(_0x174123,null));};exports[_0x8c69('0x2a')]=function(_0x5de544,_0x428007,_0x5e0c84){var _0x221b35;return db[_0x8c69('0x2d')][_0x8c69('0x48')]({'where':{'id':_0x5de544[_0x8c69('0x46')]['id']}})[_0x8c69('0x19')](function(_0x586fa){_0x221b35=_0x586fa;return _0x586fa;})[_0x8c69('0x19')](handleEntityNotFound(_0x428007,null))[_0x8c69('0x19')](removeEntity(_0x428007,null))['then'](function(){if(_0x221b35){return db['Network'][_0x8c69('0x43')]({'where':{'type':_0x221b35[_0x8c69('0x2e')]},'raw':!![]});}})[_0x8c69('0x19')](function(_0x4adae8){if(_0x221b35[_0x8c69('0x2e')]['toUpperCase']()=='STUN'){var _0x2f84c3=fs['readFileSync'](path['join'](config['root'],_0x8c69('0x5e')),_0x8c69('0x52'));var _0x34c956=ejs[_0x8c69('0x58')](_0x2f84c3,{'networks':_0x4adae8||[]});fs[_0x8c69('0x53')](_0x8c69('0x54'),_0x34c956);return respondWithRpcPromise(_0x8c69('0x55'),'destroy',{'module':'res_stun_monitor.so'});}else if(_0x221b35[_0x8c69('0x2e')][_0x8c69('0x4d')]()==_0x8c69('0x5f')){var _0x5914c9=fs[_0x8c69('0x4f')](path['join'](config[_0x8c69('0x51')],_0x8c69('0x57')),_0x8c69('0x52'));var _0x4d4b5=ejs['render'](_0x5914c9,{'networks':_0x4adae8||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x4d4b5);return respondWithRpcPromise(_0x8c69('0x55'),_0x8c69('0x2a'),{'module':_0x8c69('0x56')});}else{var _0x466f15=fs[_0x8c69('0x4f')](path[_0x8c69('0x50')](config[_0x8c69('0x51')],'server/files/templates/network.ejs'),_0x8c69('0x52'));var _0x3294c1=ejs[_0x8c69('0x58')](_0x466f15,{'networks':_0x4adae8||[]});fs[_0x8c69('0x53')](util[_0x8c69('0x5a')](_0x8c69('0x5b'),_0x5de544[_0x8c69('0x4c')][_0x8c69('0x2e')]['toLowerCase']()),_0x3294c1);return respondWithRpcPromise('Reload',_0x8c69('0x2a'),{'module':_0x8c69('0x5d')});}return null;})[_0x8c69('0x1f')](handleError(_0x428007,null));}; \ No newline at end of file +var _0x8f64=['writeFileSync','/etc/asterisk/stun_xcally.conf','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','root','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','Reload','res_stun_monitor.so','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','status','json','offset','undefined','count','limit','Content-Range','save','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','filter','options','Network','includeAll','include','findAll','rows','catch','show','params','merge','find','create','sequelize','body','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','render'];(function(_0x46906a,_0x59c364){var _0x5e011f=function(_0x45a5f9){while(--_0x45a5f9){_0x46906a['push'](_0x46906a['shift']());}};_0x5e011f(++_0x59c364);}(_0x8f64,0x150));var _0x48f6=function(_0x2854d7,_0x5aa8a9){_0x2854d7=_0x2854d7-0x0;var _0x2ea1dd=_0x8f64[_0x2854d7];return _0x2ea1dd;};'use strict';var emlformat=require(_0x48f6('0x0'));var rimraf=require(_0x48f6('0x1'));var zipdir=require(_0x48f6('0x2'));var jsonpatch=require(_0x48f6('0x3'));var rp=require(_0x48f6('0x4'));var moment=require(_0x48f6('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x48f6('0x6'));var path=require(_0x48f6('0x7'));var sox=require(_0x48f6('0x8'));var csv=require('to-csv');var ejs=require(_0x48f6('0x9'));var fs=require('fs');var fs_extra=require(_0x48f6('0xa'));var _=require(_0x48f6('0xb'));var squel=require('squel');var crypto=require(_0x48f6('0xc'));var jsforce=require(_0x48f6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x48f6('0xe'));var querystring=require(_0x48f6('0xf'));var Papa=require(_0x48f6('0x10'));var Redis=require(_0x48f6('0x11'));var authService=require(_0x48f6('0x12'));var qs=require(_0x48f6('0x13'));var as=require(_0x48f6('0x14'));var hardwareService=require(_0x48f6('0x15'));var logger=require(_0x48f6('0x16'))(_0x48f6('0x17'));var utils=require(_0x48f6('0x18'));var config=require(_0x48f6('0x19'));var licenseUtil=require(_0x48f6('0x1a'));var db=require(_0x48f6('0x1b'))['db'];var jayson=require(_0x48f6('0x1c'));var client=jayson[_0x48f6('0x1d')][_0x48f6('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x58855c,_0x5af246,_0x2b0d7b,_0x118eaa){return new BPromise(function(_0x139078,_0x5d65a6){var _0x9298ec=_0x118eaa||client;return _0x9298ec[_0x48f6('0x1f')](_0x58855c,_0x2b0d7b)['then'](function(_0x17c551){logger['info'](_0x48f6('0x20'),_0x5af246,'request\x20sent');logger[_0x48f6('0x21')](_0x48f6('0x22'),_0x5af246,'request\x20sent',JSON['stringify'](_0x17c551));if(_0x17c551[_0x48f6('0x23')]){if(_0x17c551[_0x48f6('0x23')]['code']===0x1f4){logger[_0x48f6('0x23')](_0x48f6('0x20'),_0x5af246,_0x17c551[_0x48f6('0x23')][_0x48f6('0x24')]);return _0x5d65a6(_0x17c551['error'][_0x48f6('0x24')]);}logger[_0x48f6('0x23')](_0x48f6('0x20'),_0x5af246,_0x17c551[_0x48f6('0x23')]['message']);return _0x139078(_0x17c551[_0x48f6('0x23')][_0x48f6('0x24')]);}else{logger['info'](_0x48f6('0x20'),_0x5af246,_0x48f6('0x25'));_0x139078(_0x17c551[_0x48f6('0x26')]['message']);}})['catch'](function(_0x384b11){logger[_0x48f6('0x23')](_0x48f6('0x20'),_0x5af246,_0x384b11);_0x5d65a6(_0x384b11);});});}function respondWithStatusCode(_0x287d2a,_0x3a0cc3){_0x3a0cc3=_0x3a0cc3||0xcc;return function(_0x2babf){if(_0x2babf){return _0x287d2a['sendStatus'](_0x3a0cc3);}return _0x287d2a[_0x48f6('0x27')](_0x3a0cc3)['end']();};}function respondWithResult(_0x233219,_0x20bf10){_0x20bf10=_0x20bf10||0xc8;return function(_0x666c54){if(_0x666c54){return _0x233219[_0x48f6('0x27')](_0x20bf10)[_0x48f6('0x28')](_0x666c54);}};}function respondWithFilteredResult(_0x82fed5,_0x439798){return function(_0x45dd99){if(_0x45dd99){var _0x3ad7aa=typeof _0x439798[_0x48f6('0x29')]===_0x48f6('0x2a')&&typeof _0x439798['limit']===_0x48f6('0x2a');var _0x495d6e=_0x45dd99[_0x48f6('0x2b')];var _0x5662a2=_0x3ad7aa?0x0:_0x439798[_0x48f6('0x29')];var _0x577d2d=_0x3ad7aa?_0x45dd99[_0x48f6('0x2b')]:_0x439798[_0x48f6('0x29')]+_0x439798[_0x48f6('0x2c')];var _0x3bf42d;if(_0x577d2d>=_0x495d6e){_0x577d2d=_0x495d6e;_0x3bf42d=0xc8;}else{_0x3bf42d=0xce;}_0x82fed5[_0x48f6('0x27')](_0x3bf42d);return _0x82fed5['set'](_0x48f6('0x2d'),_0x5662a2+'-'+_0x577d2d+'/'+_0x495d6e)[_0x48f6('0x28')](_0x45dd99);}return null;};}function patchUpdates(_0x1d3fe4){return function(_0x5b8185){try{jsonpatch['apply'](_0x5b8185,_0x1d3fe4,!![]);}catch(_0x582890){return BPromise['reject'](_0x582890);}return _0x5b8185[_0x48f6('0x2e')]();};}function saveUpdates(_0x578db6,_0x3881a7){return function(_0x254942){if(_0x254942){return _0x254942[_0x48f6('0x2f')](_0x578db6)[_0x48f6('0x30')](function(_0x11375c){return _0x11375c;});}return null;};}function removeEntity(_0x38f7de,_0x5b9a84){return function(_0x5ba952){if(_0x5ba952){return _0x5ba952[_0x48f6('0x31')]()[_0x48f6('0x30')](function(){_0x38f7de[_0x48f6('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56de25,_0x5e8ca9){return function(_0x2ff3eb){if(!_0x2ff3eb){_0x56de25[_0x48f6('0x32')](0x194);}return _0x2ff3eb;};}function handleError(_0x315fde,_0x527337){_0x527337=_0x527337||0x1f4;return function(_0x277a0a){logger[_0x48f6('0x23')](_0x277a0a[_0x48f6('0x33')]);if(_0x277a0a[_0x48f6('0x34')]){delete _0x277a0a[_0x48f6('0x34')];}_0x315fde[_0x48f6('0x27')](_0x527337)[_0x48f6('0x35')](_0x277a0a);};}exports[_0x48f6('0x36')]=function(_0x4a4b0b,_0x4218c8){var _0x3ecfa1={},_0x508d0a={},_0x55154a={'count':0x0,'rows':[]};var _0x1d349c=_[_0x48f6('0x37')](db['Network'][_0x48f6('0x38')],function(_0x4ee8a9){return{'name':_0x4ee8a9[_0x48f6('0x39')],'type':_0x4ee8a9['type'][_0x48f6('0x3a')]};});_0x508d0a[_0x48f6('0x3b')]=_[_0x48f6('0x37')](_0x1d349c,_0x48f6('0x34'));_0x508d0a[_0x48f6('0x3c')]=_[_0x48f6('0x3d')](_0x4a4b0b[_0x48f6('0x3c')]);_0x508d0a[_0x48f6('0x3e')]=_['intersection'](_0x508d0a[_0x48f6('0x3b')],_0x508d0a[_0x48f6('0x3c')]);_0x3ecfa1[_0x48f6('0x3f')]=_[_0x48f6('0x40')](_0x508d0a[_0x48f6('0x3b')],qs[_0x48f6('0x41')](_0x4a4b0b['query']['fields']));_0x3ecfa1[_0x48f6('0x3f')]=_0x3ecfa1[_0x48f6('0x3f')][_0x48f6('0x42')]?_0x3ecfa1['attributes']:_0x508d0a['model'];if(!_0x4a4b0b[_0x48f6('0x3c')][_0x48f6('0x43')]('nolimit')){_0x3ecfa1[_0x48f6('0x2c')]=qs[_0x48f6('0x2c')](_0x4a4b0b['query'][_0x48f6('0x2c')]);_0x3ecfa1[_0x48f6('0x29')]=qs[_0x48f6('0x29')](_0x4a4b0b[_0x48f6('0x3c')]['offset']);}_0x3ecfa1[_0x48f6('0x44')]=qs[_0x48f6('0x45')](_0x4a4b0b[_0x48f6('0x3c')]['sort']);_0x3ecfa1[_0x48f6('0x46')]=qs[_0x48f6('0x3e')](_[_0x48f6('0x47')](_0x4a4b0b[_0x48f6('0x3c')],_0x508d0a[_0x48f6('0x3e')]),_0x1d349c);if(_0x4a4b0b['query']['filter']){_0x3ecfa1['where']=_['merge'](_0x3ecfa1[_0x48f6('0x46')],{'$or':_[_0x48f6('0x37')](_0x1d349c,function(_0x2d8f65){if(_0x2d8f65[_0x48f6('0x48')]!==_0x48f6('0x49')){var _0xf088e6={};_0xf088e6[_0x2d8f65[_0x48f6('0x34')]]={'$like':'%'+_0x4a4b0b[_0x48f6('0x3c')][_0x48f6('0x4a')]+'%'};return _0xf088e6;}})});}_0x3ecfa1=_['merge']({},_0x3ecfa1,_0x4a4b0b[_0x48f6('0x4b')]);var _0x402caf={'where':_0x3ecfa1['where']};return db[_0x48f6('0x4c')][_0x48f6('0x2b')](_0x402caf)[_0x48f6('0x30')](function(_0x21bd4e){_0x55154a[_0x48f6('0x2b')]=_0x21bd4e;if(_0x4a4b0b[_0x48f6('0x3c')][_0x48f6('0x4d')]){_0x3ecfa1[_0x48f6('0x4e')]=[{'all':!![]}];}return db[_0x48f6('0x4c')][_0x48f6('0x4f')](_0x3ecfa1);})[_0x48f6('0x30')](function(_0x59e142){_0x55154a[_0x48f6('0x50')]=_0x59e142;return _0x55154a;})[_0x48f6('0x30')](respondWithFilteredResult(_0x4218c8,_0x3ecfa1))[_0x48f6('0x51')](handleError(_0x4218c8,null));};exports[_0x48f6('0x52')]=function(_0x2f2e3e,_0x2c692a){var _0x5e234b={'raw':!![],'where':{'id':_0x2f2e3e[_0x48f6('0x53')]['id']}},_0xd639cc={};_0xd639cc['model']=_[_0x48f6('0x3d')](db['Network'][_0x48f6('0x38')]);_0xd639cc[_0x48f6('0x3c')]=_[_0x48f6('0x3d')](_0x2f2e3e[_0x48f6('0x3c')]);_0xd639cc['filters']=_[_0x48f6('0x40')](_0xd639cc[_0x48f6('0x3b')],_0xd639cc['query']);_0x5e234b[_0x48f6('0x3f')]=_[_0x48f6('0x40')](_0xd639cc['model'],qs[_0x48f6('0x41')](_0x2f2e3e[_0x48f6('0x3c')][_0x48f6('0x41')]));_0x5e234b['attributes']=_0x5e234b['attributes']['length']?_0x5e234b[_0x48f6('0x3f')]:_0xd639cc[_0x48f6('0x3b')];if(_0x2f2e3e[_0x48f6('0x3c')][_0x48f6('0x4d')]){_0x5e234b[_0x48f6('0x4e')]=[{'all':!![]}];}_0x5e234b=_[_0x48f6('0x54')]({},_0x5e234b,_0x2f2e3e['options']);return db[_0x48f6('0x4c')][_0x48f6('0x55')](_0x5e234b)[_0x48f6('0x30')](handleEntityNotFound(_0x2c692a,null))[_0x48f6('0x30')](respondWithResult(_0x2c692a,null))[_0x48f6('0x51')](handleError(_0x2c692a,null));};exports[_0x48f6('0x56')]=function(_0x294f1d,_0x5bc69b,_0x49e1c5){var _0x1aec63;return db[_0x48f6('0x57')]['transaction'](function(_0x2d4b06){return db['Network'][_0x48f6('0x56')](_0x294f1d[_0x48f6('0x58')],{'raw':!![]})[_0x48f6('0x30')](function(_0x4f19e7){_0x1aec63=_0x4f19e7;return db['Network']['findAll']({'where':{'type':_0x294f1d['body']['type']},'raw':!![]});})[_0x48f6('0x30')](function(_0x3334f4){if(_0x1aec63[_0x48f6('0x48')][_0x48f6('0x59')]()==_0x48f6('0x5a')){var _0x1c273f=fs[_0x48f6('0x5b')](path[_0x48f6('0x5c')](config['root'],_0x48f6('0x5d')),_0x48f6('0x5e'));var _0x202396=ejs[_0x48f6('0x5f')](_0x1c273f,{'networks':_0x3334f4||[]});fs[_0x48f6('0x60')](_0x48f6('0x61'),_0x202396);return respondWithRpcPromise('Reload','create',{'module':'res_stun_monitor.so'});}else if(_0x1aec63[_0x48f6('0x48')][_0x48f6('0x59')]()==_0x48f6('0x62')){var _0xd90bc4=fs[_0x48f6('0x5b')](path['join'](config['root'],_0x48f6('0x63')),_0x48f6('0x5e'));var _0x2ecb74=ejs[_0x48f6('0x5f')](_0xd90bc4,{'networks':_0x3334f4||[]});fs['writeFileSync'](_0x48f6('0x64'),_0x2ecb74);return respondWithRpcPromise('Reload',_0x48f6('0x56'),{'module':'res_stun_monitor.so'});}else{var _0x2f3164=fs[_0x48f6('0x5b')](path[_0x48f6('0x5c')](config[_0x48f6('0x65')],'server/files/templates/network.ejs'),_0x48f6('0x5e'));var _0x21b7ee=ejs['render'](_0x2f3164,{'networks':_0x3334f4||[]});fs[_0x48f6('0x60')](util[_0x48f6('0x66')](_0x48f6('0x67'),_0x294f1d[_0x48f6('0x58')]['type'][_0x48f6('0x68')]()),_0x21b7ee);return respondWithRpcPromise('Reload',_0x48f6('0x56'),{'module':'chan_sip.so'});}return null;})['then'](function(){return _0x1aec63;});})['then'](respondWithResult(_0x5bc69b,0xc9))[_0x48f6('0x51')](handleError(_0x5bc69b,null));};exports[_0x48f6('0x2f')]=function(_0x4c51e2,_0x19d159,_0x426584){var _0x4b887b;return db[_0x48f6('0x57')]['transaction'](function(_0x5bea97){return db[_0x48f6('0x4c')][_0x48f6('0x55')]({'where':{'id':_0x4c51e2[_0x48f6('0x53')]['id']}})['then'](handleEntityNotFound(_0x19d159,null))['then'](saveUpdates(_0x4c51e2[_0x48f6('0x58')],null))[_0x48f6('0x30')](function(_0x5a1dca){if(_0x5a1dca){_0x4b887b=_0x5a1dca;return db['Network'][_0x48f6('0x4f')]({'where':{'type':_0x4b887b[_0x48f6('0x48')]},'raw':!![]});}return null;})['then'](function(_0x7d0a74){if(_0x4b887b[_0x48f6('0x48')][_0x48f6('0x59')]()==_0x48f6('0x5a')){var _0x434633=fs['readFileSync'](path[_0x48f6('0x5c')](config[_0x48f6('0x65')],_0x48f6('0x5d')),_0x48f6('0x5e'));var _0xa24c1d=ejs[_0x48f6('0x5f')](_0x434633,{'networks':_0x7d0a74||[]});fs['writeFileSync'](_0x48f6('0x61'),_0xa24c1d);return respondWithRpcPromise(_0x48f6('0x69'),_0x48f6('0x2f'),{'module':'res_stun_monitor.so'});}else if(_0x4b887b[_0x48f6('0x48')][_0x48f6('0x59')]()==_0x48f6('0x62')){var _0x392f75=fs[_0x48f6('0x5b')](path[_0x48f6('0x5c')](config[_0x48f6('0x65')],_0x48f6('0x63')),'utf8');var _0x324f24=ejs[_0x48f6('0x5f')](_0x392f75,{'networks':_0x7d0a74||[]});fs[_0x48f6('0x60')](_0x48f6('0x64'),_0x324f24);return respondWithRpcPromise(_0x48f6('0x69'),_0x48f6('0x2f'),{'module':_0x48f6('0x6a')});}else{var _0x5caba7=fs['readFileSync'](path[_0x48f6('0x5c')](config['root'],'server/files/templates/network.ejs'),_0x48f6('0x5e'));var _0x100e17=ejs[_0x48f6('0x5f')](_0x5caba7,{'networks':_0x7d0a74||[]});fs['writeFileSync'](util['format'](_0x48f6('0x67'),_0x4c51e2[_0x48f6('0x58')][_0x48f6('0x48')][_0x48f6('0x68')]()),_0x100e17);return respondWithRpcPromise('Reload',_0x48f6('0x2f'),{'module':_0x48f6('0x6b')});}return null;})['then'](function(_0x5a7277){if(_0x5a7277){return _0x4b887b;}return null;});})[_0x48f6('0x30')](respondWithResult(_0x19d159,null))[_0x48f6('0x51')](handleError(_0x19d159,null));};exports['destroy']=function(_0x516367,_0x1f1ed8,_0x6c2ce9){var _0x437617;return db[_0x48f6('0x4c')][_0x48f6('0x55')]({'where':{'id':_0x516367[_0x48f6('0x53')]['id']}})[_0x48f6('0x30')](function(_0x5cf9f9){_0x437617=_0x5cf9f9;return _0x5cf9f9;})[_0x48f6('0x30')](handleEntityNotFound(_0x1f1ed8,null))[_0x48f6('0x30')](removeEntity(_0x1f1ed8,null))[_0x48f6('0x30')](function(){if(_0x437617){return db[_0x48f6('0x4c')][_0x48f6('0x4f')]({'where':{'type':_0x437617[_0x48f6('0x48')]},'raw':!![]});}})['then'](function(_0x19bae4){if(_0x437617['type'][_0x48f6('0x59')]()=='STUN'){var _0x4ce6cb=fs['readFileSync'](path['join'](config[_0x48f6('0x65')],_0x48f6('0x5d')),_0x48f6('0x5e'));var _0x44e73a=ejs[_0x48f6('0x5f')](_0x4ce6cb,{'networks':_0x19bae4||[]});fs[_0x48f6('0x60')]('/etc/asterisk/stun_xcally.conf',_0x44e73a);return respondWithRpcPromise(_0x48f6('0x69'),'destroy',{'module':'res_stun_monitor.so'});}else if(_0x437617[_0x48f6('0x48')]['toUpperCase']()=='TURN'){var _0x32c85b=fs[_0x48f6('0x5b')](path[_0x48f6('0x5c')](config[_0x48f6('0x65')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x229ac1=ejs['render'](_0x32c85b,{'networks':_0x19bae4||[]});fs[_0x48f6('0x60')](_0x48f6('0x64'),_0x229ac1);return respondWithRpcPromise(_0x48f6('0x69'),'destroy',{'module':_0x48f6('0x6a')});}else{var _0x51a1ab=fs['readFileSync'](path[_0x48f6('0x5c')](config['root'],'server/files/templates/network.ejs'),_0x48f6('0x5e'));var _0xced377=ejs[_0x48f6('0x5f')](_0x51a1ab,{'networks':_0x19bae4||[]});fs[_0x48f6('0x60')](util[_0x48f6('0x66')]('/etc/asterisk/sip_xcally_%s.conf',_0x516367[_0x48f6('0x58')][_0x48f6('0x48')][_0x48f6('0x68')]()),_0xced377);return respondWithRpcPromise(_0x48f6('0x69'),'destroy',{'module':_0x48f6('0x6b')});}return null;})['catch'](handleError(_0x1f1ed8,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 9e2b43e..3359f8b 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 _0x750a=['path','rimraf','../../config/environment','./network.attributes','exports','define','Network','network','util','moment','bluebird','request-promise'];(function(_0xc57e60,_0xe3399c){var _0x5222b3=function(_0x2d9c56){while(--_0x2d9c56){_0xc57e60['push'](_0xc57e60['shift']());}};_0x5222b3(++_0xe3399c);}(_0x750a,0x140));var _0xa750=function(_0xb6f664,_0x2e976a){_0xb6f664=_0xb6f664-0x0;var _0x33c35b=_0x750a[_0xb6f664];return _0x33c35b;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa750('0x1'));var BPromise=require(_0xa750('0x2'));var rp=require(_0xa750('0x3'));var fs=require('fs');var path=require(_0xa750('0x4'));var rimraf=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var attributes=require(_0xa750('0x7'));module[_0xa750('0x8')]=function(_0x10b4d9,_0x2497df){return _0x10b4d9[_0xa750('0x9')](_0xa750('0xa'),attributes,{'tableName':_0xa750('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf290=['Network','network','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x1d7817,_0x3343f2){var _0x29198c=function(_0x4749dd){while(--_0x4749dd){_0x1d7817['push'](_0x1d7817['shift']());}};_0x29198c(++_0x3343f2);}(_0xf290,0xde));var _0x0f29=function(_0x221ba2,_0x79208){_0x221ba2=_0x221ba2-0x0;var _0x47d08e=_0xf290[_0x221ba2];return _0x47d08e;};'use strict';var _=require('lodash');var util=require(_0x0f29('0x0'));var logger=require('../../config/logger')(_0x0f29('0x1'));var moment=require('moment');var BPromise=require(_0x0f29('0x2'));var rp=require(_0x0f29('0x3'));var fs=require('fs');var path=require(_0x0f29('0x4'));var rimraf=require(_0x0f29('0x5'));var config=require(_0x0f29('0x6'));var attributes=require('./network.attributes');module[_0x0f29('0x7')]=function(_0x4911fb,_0x2d5350){return _0x4911fb[_0x0f29('0x8')](_0x0f29('0x9'),attributes,{'tableName':_0x0f29('0xa'),'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 496c4d1..657321e 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x25d69b,_0x581170){var _0x1ba84e=function(_0x368d46){while(--_0x368d46){_0x25d69b['push'](_0x25d69b['shift']());}};_0x1ba84e(++_0x581170);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4d1473,_0x5e3c67){var _0x45d7ba=function(_0x5b4e1b){while(--_0x5b4e1b){_0x4d1473['push'](_0x4d1473['shift']());}};_0x45d7ba(++_0x5e3c67);}(_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 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 d5137c8..9e81312 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 _0xee9b=['/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addDisposition','addAnswer','notify','addApplications','addAgents','/:id/send','send','put','delete','removeAnswers','removeAgents','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0xee9b,0x1b8));var _0xbee9=function(_0x3e9d17,_0x17b581){_0x3e9d17=_0x3e9d17-0x0;var _0xb14e15=_0xee9b[_0x3e9d17];return _0xb14e15;};'use strict';var multer=require(_0xbee9('0x0'));var util=require('util');var path=require(_0xbee9('0x1'));var timeout=require(_0xbee9('0x2'));var express=require('express');var router=express[_0xbee9('0x3')]();var fs_extra=require(_0xbee9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbee9('0x5'));var config=require('../../config/environment');var controller=require(_0xbee9('0x6'));router[_0xbee9('0x7')]('/',auth[_0xbee9('0x8')](),controller[_0xbee9('0x9')]);router[_0xbee9('0x7')](_0xbee9('0xa'),auth['isAuthenticated'](),controller[_0xbee9('0xb')]);router[_0xbee9('0x7')](_0xbee9('0xc'),auth[_0xbee9('0x8')](),controller[_0xbee9('0xd')]);router[_0xbee9('0x7')](_0xbee9('0xe'),auth[_0xbee9('0x8')](),controller[_0xbee9('0xf')]);router[_0xbee9('0x7')](_0xbee9('0x10'),auth[_0xbee9('0x8')](),controller[_0xbee9('0x11')]);router[_0xbee9('0x7')](_0xbee9('0x12'),auth['isAuthenticated'](),controller[_0xbee9('0x13')]);router[_0xbee9('0x7')](_0xbee9('0x14'),auth[_0xbee9('0x8')](),controller[_0xbee9('0x15')]);router[_0xbee9('0x7')](_0xbee9('0x16'),auth[_0xbee9('0x8')](),controller[_0xbee9('0x17')]);router['post']('/',auth[_0xbee9('0x8')](),controller[_0xbee9('0x18')]);router[_0xbee9('0x19')](_0xbee9('0xe'),auth[_0xbee9('0x8')](),controller[_0xbee9('0x1a')]);router['post']('/:id/canned_answers',auth[_0xbee9('0x8')](),controller[_0xbee9('0x1b')]);router['post']('/:id/notify',controller[_0xbee9('0x1c')]);router['post'](_0xbee9('0x12'),auth['isAuthenticated'](),controller[_0xbee9('0x1d')]);router[_0xbee9('0x19')](_0xbee9('0x16'),auth[_0xbee9('0x8')](),controller[_0xbee9('0x1e')]);router[_0xbee9('0x19')](_0xbee9('0x1f'),auth[_0xbee9('0x8')](),controller[_0xbee9('0x20')]);router[_0xbee9('0x21')](_0xbee9('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xbee9('0x22')](_0xbee9('0xc'),auth[_0xbee9('0x8')](),controller['destroy']);router[_0xbee9('0x22')](_0xbee9('0xe'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xbee9('0x22')](_0xbee9('0x10'),auth[_0xbee9('0x8')](),controller[_0xbee9('0x23')]);router[_0xbee9('0x22')](_0xbee9('0x16'),auth[_0xbee9('0x8')](),controller[_0xbee9('0x24')]);module[_0xbee9('0x25')]=router; \ No newline at end of file +var _0x237b=['notify','addApplications','addAgents','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','/:id/notify'];(function(_0x125494,_0x5aca7a){var _0x572b66=function(_0x2eff00){while(--_0x2eff00){_0x125494['push'](_0x125494['shift']());}};_0x572b66(++_0x5aca7a);}(_0x237b,0x139));var _0xb237=function(_0x4df5d1,_0x24dbda){_0x4df5d1=_0x4df5d1-0x0;var _0x4926d6=_0x237b[_0x4df5d1];return _0x4926d6;};'use strict';var multer=require(_0xb237('0x0'));var util=require(_0xb237('0x1'));var path=require(_0xb237('0x2'));var timeout=require(_0xb237('0x3'));var express=require(_0xb237('0x4'));var router=express[_0xb237('0x5')]();var fs_extra=require(_0xb237('0x6'));var auth=require(_0xb237('0x7'));var interaction=require(_0xb237('0x8'));var config=require('../../config/environment');var controller=require(_0xb237('0x9'));router[_0xb237('0xa')]('/',auth[_0xb237('0xb')](),controller[_0xb237('0xc')]);router['get'](_0xb237('0xd'),auth['isAuthenticated'](),controller[_0xb237('0xe')]);router[_0xb237('0xa')](_0xb237('0xf'),auth[_0xb237('0xb')](),controller[_0xb237('0x10')]);router[_0xb237('0xa')]('/:id/dispositions',auth[_0xb237('0xb')](),controller['getDispositions']);router[_0xb237('0xa')](_0xb237('0x11'),auth['isAuthenticated'](),controller[_0xb237('0x12')]);router['get'](_0xb237('0x13'),auth['isAuthenticated'](),controller[_0xb237('0x14')]);router[_0xb237('0xa')](_0xb237('0x15'),auth[_0xb237('0xb')](),controller[_0xb237('0x16')]);router[_0xb237('0xa')](_0xb237('0x17'),auth[_0xb237('0xb')](),controller[_0xb237('0x18')]);router[_0xb237('0x19')]('/',auth[_0xb237('0xb')](),controller[_0xb237('0x1a')]);router[_0xb237('0x19')](_0xb237('0x1b'),auth[_0xb237('0xb')](),controller[_0xb237('0x1c')]);router[_0xb237('0x19')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xb237('0x1d')]);router[_0xb237('0x19')](_0xb237('0x1e'),controller[_0xb237('0x1f')]);router[_0xb237('0x19')](_0xb237('0x13'),auth['isAuthenticated'](),controller[_0xb237('0x20')]);router[_0xb237('0x19')]('/:id/users',auth[_0xb237('0xb')](),controller[_0xb237('0x21')]);router[_0xb237('0x19')](_0xb237('0x22'),auth['isAuthenticated'](),controller[_0xb237('0x23')]);router[_0xb237('0x24')](_0xb237('0xf'),auth[_0xb237('0xb')](),controller[_0xb237('0x25')]);router[_0xb237('0x26')](_0xb237('0xf'),auth[_0xb237('0xb')](),controller[_0xb237('0x27')]);router[_0xb237('0x26')](_0xb237('0x1b'),auth['isAuthenticated'](),controller[_0xb237('0x28')]);router['delete'](_0xb237('0x11'),auth[_0xb237('0xb')](),controller['removeAnswers']);router[_0xb237('0x26')](_0xb237('0x17'),auth['isAuthenticated'](),controller[_0xb237('0x29')]);module[_0xb237('0x2a')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 956d62b..52150d7 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 _0xaa23=['STRING','name','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports'];(function(_0x2b850d,_0x541a0a){var _0x333dbf=function(_0xb574f9){while(--_0xb574f9){_0x2b850d['push'](_0x2b850d['shift']());}};_0x333dbf(++_0x541a0a);}(_0xaa23,0x11d));var _0x3aa2=function(_0x3c2666,_0x15fd23){_0x3c2666=_0x3c2666-0x0;var _0x10c814=_0xaa23[_0x3c2666];return _0x10c814;};'use strict';var Sequelize=require(_0x3aa2('0x0'));var rs=require(_0x3aa2('0x1'));module[_0x3aa2('0x2')]={'name':{'type':Sequelize[_0x3aa2('0x3')],'unique':_0x3aa2('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x3aa2('0x3')]},'token':{'type':Sequelize[_0x3aa2('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x3aa2('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x3aa2('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3aa2('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x3aa2('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3aa2('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x3aa2('0x3')]},'queueTransfer':{'type':Sequelize[_0x3aa2('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3aa2('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3aa2('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3aa2('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x3aa2('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x3aa2('0x6')],'defaultValue':![],'comment':_0x3aa2('0x9'),'set':function(_0x333e3a){if(!_0x333e3a)this[_0x3aa2('0xa')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x3aa2('0xb'),_0x333e3a);}}}; \ No newline at end of file +var _0x1128=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate'];(function(_0x184b40,_0x534f1d){var _0x50bbc7=function(_0xbcca7a){while(--_0xbcca7a){_0x184b40['push'](_0x184b40['shift']());}};_0x50bbc7(++_0x534f1d);}(_0x1128,0x120));var _0x8112=function(_0x21ada4,_0xc89442){_0x21ada4=_0x21ada4-0x0;var _0x2c157d=_0x1128[_0x21ada4];return _0x2c157d;};'use strict';var Sequelize=require(_0x8112('0x0'));var rs=require(_0x8112('0x1'));module[_0x8112('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x8112('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x8112('0x4')],'defaultValue':function(){return rs[_0x8112('0x5')]();}},'replyUri':{'type':Sequelize[_0x8112('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x8112('0x6')],'defaultValue':function(){return _0x8112('0x7');}},'notificationSound':{'type':Sequelize[_0x8112('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8112('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x8112('0x4')]},'queueTransfer':{'type':Sequelize[_0x8112('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8112('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8112('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0x8112('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x8112('0x8')],'defaultValue':![],'comment':_0x8112('0xb'),'set':function(_0x691524){if(!_0x691524)this[_0x8112('0xc')]('mandatoryDispositionPauseId',null);this[_0x8112('0xc')](_0x8112('0xd'),_0x691524);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index fcf718c..952f75a 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 _0xa475=['nolimit','order','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','include','removeAnswers','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','send','out','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','name','index','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','options','includeAll','findAll','show','params','Pause','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne'];(function(_0x554ebc,_0x2906ae){var _0x3640fc=function(_0x438a54){while(--_0x438a54){_0x554ebc['push'](_0x554ebc['shift']());}};_0x3640fc(++_0x2906ae);}(_0xa475,0x1d3));var _0x5a47=function(_0x5c44bd,_0x561f65){_0x5c44bd=_0x5c44bd-0x0;var _0x4f06a7=_0xa475[_0x5c44bd];return _0x4f06a7;};'use strict';var emlformat=require(_0x5a47('0x0'));var rimraf=require(_0x5a47('0x1'));var zipdir=require(_0x5a47('0x2'));var jsonpatch=require(_0x5a47('0x3'));var rp=require(_0x5a47('0x4'));var moment=require(_0x5a47('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5a47('0x6'));var util=require(_0x5a47('0x7'));var path=require(_0x5a47('0x8'));var sox=require(_0x5a47('0x9'));var csv=require('to-csv');var ejs=require(_0x5a47('0xa'));var fs=require('fs');var fs_extra=require(_0x5a47('0xb'));var _=require('lodash');var squel=require(_0x5a47('0xc'));var crypto=require(_0x5a47('0xd'));var jsforce=require(_0x5a47('0xe'));var deskjs=require(_0x5a47('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5a47('0x10'));var Papa=require(_0x5a47('0x11'));var Redis=require(_0x5a47('0x12'));var authService=require(_0x5a47('0x13'));var qs=require(_0x5a47('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5a47('0x15'));var utils=require(_0x5a47('0x16'));var config=require(_0x5a47('0x17'));var licenseUtil=require(_0x5a47('0x18'));var db=require(_0x5a47('0x19'))['db'];config['redis']=_[_0x5a47('0x1a')](config['redis'],{'host':_0x5a47('0x1b'),'port':0x18eb});var socket=require(_0x5a47('0x1c'))(new Redis(config['redis']));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0x5a47('0x1d'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x5a47('0x1e')][_0x5a47('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2056e4,_0x2a13f3,_0x109760,_0x192aa9){return new BPromise(function(_0x247e49,_0x322b1f){var _0xaf49bf=_0x192aa9||client;return _0xaf49bf[_0x5a47('0x20')](_0x2056e4,_0x109760)[_0x5a47('0x21')](function(_0x3b903b){logger[_0x5a47('0x22')](_0x5a47('0x23'),_0x2a13f3,_0x5a47('0x24'));logger[_0x5a47('0x25')](_0x5a47('0x26'),_0x2a13f3,_0x5a47('0x24'),JSON[_0x5a47('0x27')](_0x3b903b));if(_0x3b903b[_0x5a47('0x28')]){if(_0x3b903b[_0x5a47('0x28')][_0x5a47('0x29')]===0x1f4){logger[_0x5a47('0x28')](_0x5a47('0x23'),_0x2a13f3,_0x3b903b[_0x5a47('0x28')][_0x5a47('0x2a')]);return _0x322b1f(_0x3b903b[_0x5a47('0x28')][_0x5a47('0x2a')]);}logger[_0x5a47('0x28')](_0x5a47('0x23'),_0x2a13f3,_0x3b903b[_0x5a47('0x28')][_0x5a47('0x2a')]);return _0x247e49(_0x3b903b[_0x5a47('0x28')][_0x5a47('0x2a')]);}else{logger[_0x5a47('0x22')](_0x5a47('0x23'),_0x2a13f3,'request\x20sent');_0x247e49(_0x3b903b[_0x5a47('0x2b')][_0x5a47('0x2a')]);}})[_0x5a47('0x2c')](function(_0xfc698){logger['error'](_0x5a47('0x23'),_0x2a13f3,_0xfc698);_0x322b1f(_0xfc698);});});}function respondWithStatusCode(_0x318aba,_0x30d869){_0x30d869=_0x30d869||0xcc;return function(_0x4c5bed){if(_0x4c5bed){return _0x318aba[_0x5a47('0x2d')](_0x30d869);}return _0x318aba['status'](_0x30d869)[_0x5a47('0x2e')]();};}function respondWithResult(_0x1f4e6b,_0x10c3b3){_0x10c3b3=_0x10c3b3||0xc8;return function(_0x388b0f){if(_0x388b0f){return _0x1f4e6b['status'](_0x10c3b3)[_0x5a47('0x2f')](_0x388b0f);}};}function respondWithFilteredResult(_0x155d8f,_0x5bd47b){return function(_0x544066){if(_0x544066){var _0x3b662f=typeof _0x5bd47b[_0x5a47('0x30')]===_0x5a47('0x31')&&typeof _0x5bd47b[_0x5a47('0x32')]===_0x5a47('0x31');var _0x481ca8=_0x544066[_0x5a47('0x33')];var _0x156519=_0x3b662f?0x0:_0x5bd47b[_0x5a47('0x30')];var _0xbf673e=_0x3b662f?_0x544066[_0x5a47('0x33')]:_0x5bd47b[_0x5a47('0x30')]+_0x5bd47b[_0x5a47('0x32')];var _0x27937a;if(_0xbf673e>=_0x481ca8){_0xbf673e=_0x481ca8;_0x27937a=0xc8;}else{_0x27937a=0xce;}_0x155d8f['status'](_0x27937a);return _0x155d8f[_0x5a47('0x34')](_0x5a47('0x35'),_0x156519+'-'+_0xbf673e+'/'+_0x481ca8)[_0x5a47('0x2f')](_0x544066);}return null;};}function patchUpdates(_0x2ad177){return function(_0xbfd4bc){try{jsonpatch[_0x5a47('0x36')](_0xbfd4bc,_0x2ad177,!![]);}catch(_0x1c593a){return BPromise['reject'](_0x1c593a);}return _0xbfd4bc[_0x5a47('0x37')]();};}function saveUpdates(_0x2fe33a,_0x134550){return function(_0x126b2c){if(_0x126b2c){return _0x126b2c[_0x5a47('0x38')](_0x2fe33a)[_0x5a47('0x21')](function(_0x55d515){return _0x55d515;});}return null;};}function removeEntity(_0xc641c4,_0x2a41be){return function(_0x16a6eb){if(_0x16a6eb){return _0x16a6eb[_0x5a47('0x39')]()[_0x5a47('0x21')](function(){var _0x40339a=_0x16a6eb[_0x5a47('0x3a')]({'plain':!![]});var _0x5d6db1=_0x5a47('0x3b');return db[_0x5a47('0x3c')][_0x5a47('0x39')]({'where':{'type':_0x5d6db1,'resourceId':_0x40339a['id']}})[_0x5a47('0x21')](function(){return _0x16a6eb;});})[_0x5a47('0x21')](function(){_0xc641c4['status'](0xcc)[_0x5a47('0x2e')]();});}};}function handleEntityNotFound(_0x4564d4,_0x409002){return function(_0x41e7a0){if(!_0x41e7a0){_0x4564d4[_0x5a47('0x2d')](0x194);}return _0x41e7a0;};}function handleError(_0x20a443,_0x289f9d){_0x289f9d=_0x289f9d||0x1f4;return function(_0x40995c){logger[_0x5a47('0x28')](_0x40995c['stack']);if(_0x40995c[_0x5a47('0x3d')]){delete _0x40995c[_0x5a47('0x3d')];}_0x20a443['status'](_0x289f9d)['send'](_0x40995c);};}exports[_0x5a47('0x3e')]=function(_0x594c2c,_0x13f011){var _0x162d58={'include':[{'model':db['Pause'],'as':_0x5a47('0x3f')}]},_0x44c4e5={},_0xeaa626={'count':0x0,'rows':[]};var _0x10ffe6=_['map'](db[_0x5a47('0x40')][_0x5a47('0x41')],function(_0x2e6b3c){return{'name':_0x2e6b3c['fieldName'],'type':_0x2e6b3c[_0x5a47('0x42')]['key']};});_0x44c4e5[_0x5a47('0x43')]=_[_0x5a47('0x44')](_0x10ffe6,_0x5a47('0x3d'));_0x44c4e5[_0x5a47('0x45')]=_[_0x5a47('0x46')](_0x594c2c['query']);_0x44c4e5[_0x5a47('0x47')]=_[_0x5a47('0x48')](_0x44c4e5[_0x5a47('0x43')],_0x44c4e5[_0x5a47('0x45')]);_0x162d58[_0x5a47('0x49')]=_[_0x5a47('0x48')](_0x44c4e5[_0x5a47('0x43')],qs[_0x5a47('0x4a')](_0x594c2c[_0x5a47('0x45')][_0x5a47('0x4a')]));_0x162d58[_0x5a47('0x49')]=_0x162d58[_0x5a47('0x49')][_0x5a47('0x4b')]?_0x162d58[_0x5a47('0x49')]:_0x44c4e5[_0x5a47('0x43')];if(!_0x594c2c['query'][_0x5a47('0x4c')]('nolimit')){_0x162d58[_0x5a47('0x32')]=qs['limit'](_0x594c2c[_0x5a47('0x45')][_0x5a47('0x32')]);_0x162d58[_0x5a47('0x30')]=qs[_0x5a47('0x30')](_0x594c2c[_0x5a47('0x45')]['offset']);}_0x162d58['order']=qs[_0x5a47('0x4d')](_0x594c2c[_0x5a47('0x45')][_0x5a47('0x4d')]);_0x162d58[_0x5a47('0x4e')]=qs['filters'](_[_0x5a47('0x4f')](_0x594c2c[_0x5a47('0x45')],_0x44c4e5['filters']),_0x10ffe6);if(_0x594c2c[_0x5a47('0x45')][_0x5a47('0x50')]){_0x162d58[_0x5a47('0x4e')]=_['merge'](_0x162d58['where'],{'$or':_[_0x5a47('0x44')](_0x10ffe6,function(_0x2e4427){if(_0x2e4427[_0x5a47('0x42')]!=='VIRTUAL'){var _0x30605a={};_0x30605a[_0x2e4427[_0x5a47('0x3d')]]={'$like':'%'+_0x594c2c['query']['filter']+'%'};return _0x30605a;}})});}_0x162d58=_['merge']({},_0x162d58,_0x594c2c[_0x5a47('0x51')]);var _0x1fc14e={'where':_0x162d58[_0x5a47('0x4e')]};return db[_0x5a47('0x40')][_0x5a47('0x33')](_0x1fc14e)[_0x5a47('0x21')](function(_0x2eadf4){_0xeaa626[_0x5a47('0x33')]=_0x2eadf4;if(_0x594c2c[_0x5a47('0x45')][_0x5a47('0x52')]){_0x162d58['include']=[{'all':!![]}];}return db['OpenchannelAccount'][_0x5a47('0x53')](_0x162d58);})[_0x5a47('0x21')](function(_0x1d765f){_0xeaa626['rows']=_0x1d765f;return _0xeaa626;})[_0x5a47('0x21')](respondWithFilteredResult(_0x13f011,_0x162d58))['catch'](handleError(_0x13f011,null));};exports[_0x5a47('0x54')]=function(_0x14711c,_0x2dde73){var _0x3dd4bc={'raw':![],'where':{'id':_0x14711c[_0x5a47('0x55')]['id']},'include':[{'model':db[_0x5a47('0x56')],'as':_0x5a47('0x3f')}]},_0x2ee465={};_0x2ee465[_0x5a47('0x43')]=_['keys'](db[_0x5a47('0x40')][_0x5a47('0x41')]);_0x2ee465['query']=_['keys'](_0x14711c[_0x5a47('0x45')]);_0x2ee465[_0x5a47('0x47')]=_['intersection'](_0x2ee465[_0x5a47('0x43')],_0x2ee465[_0x5a47('0x45')]);_0x3dd4bc[_0x5a47('0x49')]=_[_0x5a47('0x48')](_0x2ee465[_0x5a47('0x43')],qs['fields'](_0x14711c['query']['fields']));_0x3dd4bc[_0x5a47('0x49')]=_0x3dd4bc[_0x5a47('0x49')][_0x5a47('0x4b')]?_0x3dd4bc[_0x5a47('0x49')]:_0x2ee465[_0x5a47('0x43')];if(_0x14711c[_0x5a47('0x45')][_0x5a47('0x52')]){_0x3dd4bc['include']=[{'all':!![]}];}_0x3dd4bc=_[_0x5a47('0x57')]({},_0x3dd4bc,_0x14711c[_0x5a47('0x51')]);return db['OpenchannelAccount'][_0x5a47('0x58')](_0x3dd4bc)[_0x5a47('0x21')](handleEntityNotFound(_0x2dde73,null))['then'](respondWithResult(_0x2dde73,null))['catch'](handleError(_0x2dde73,null));};exports[_0x5a47('0x59')]=function(_0x2e4135,_0x4548fe){return db[_0x5a47('0x40')][_0x5a47('0x59')](_0x2e4135['body'],{})['then'](function(_0x2ee688){var _0x3f6bd2=_0x2e4135[_0x5a47('0x5a')][_0x5a47('0x3a')]({'plain':!![]});if(!_0x3f6bd2)throw new Error(_0x5a47('0x5b'));if(_0x3f6bd2[_0x5a47('0x5c')]===_0x5a47('0x5a')){var _0x25f002=_0x2ee688[_0x5a47('0x3a')]({'plain':!![]});var _0x3f486e=_0x5a47('0x3b');return db['UserProfileSection']['find']({'where':{'name':_0x3f486e,'userProfileId':_0x3f6bd2[_0x5a47('0x5d')]},'raw':!![]})[_0x5a47('0x21')](function(_0x1d3af6){if(_0x1d3af6&&_0x1d3af6[_0x5a47('0x5e')]===0x0){return db['UserProfileResource']['create']({'name':_0x25f002[_0x5a47('0x3d')],'resourceId':_0x25f002['id'],'type':_0x1d3af6[_0x5a47('0x3d')],'sectionId':_0x1d3af6['id']},{})[_0x5a47('0x21')](function(){return _0x2ee688;});}else{return _0x2ee688;}})[_0x5a47('0x2c')](function(_0x25e672){logger[_0x5a47('0x28')](_0x5a47('0x5f'),_0x25e672);throw _0x25e672;});}return _0x2ee688;})['then'](respondWithResult(_0x4548fe,0xc9))[_0x5a47('0x2c')](handleError(_0x4548fe,null));};exports[_0x5a47('0x38')]=function(_0x59ee07,_0x1dc960){if(_0x59ee07[_0x5a47('0x60')]['id']){delete _0x59ee07[_0x5a47('0x60')]['id'];}return db[_0x5a47('0x40')][_0x5a47('0x58')]({'where':{'id':_0x59ee07['params']['id']},'include':[{'model':db['Pause'],'as':_0x5a47('0x3f')}]})[_0x5a47('0x21')](handleEntityNotFound(_0x1dc960,null))['then'](saveUpdates(_0x59ee07[_0x5a47('0x60')],null))[_0x5a47('0x21')](respondWithResult(_0x1dc960,null))['catch'](handleError(_0x1dc960,null));};exports[_0x5a47('0x39')]=function(_0x292723,_0x1031ce){return db['OpenchannelAccount'][_0x5a47('0x58')]({'where':{'id':_0x292723[_0x5a47('0x55')]['id']}})['then'](handleEntityNotFound(_0x1031ce,null))[_0x5a47('0x21')](removeEntity(_0x1031ce,null))[_0x5a47('0x2c')](handleError(_0x1031ce,null));};exports[_0x5a47('0x61')]=function(_0x3b15e7,_0x2dd7c5){return db[_0x5a47('0x40')][_0x5a47('0x61')]()[_0x5a47('0x21')](respondWithResult(_0x2dd7c5,null))[_0x5a47('0x2c')](handleError(_0x2dd7c5,null));};exports[_0x5a47('0x62')]=function(_0x2b6c5b,_0x3b331b,_0x5d88d0){if(_0x2b6c5b[_0x5a47('0x60')]['id']){delete _0x2b6c5b['body']['id'];}return db[_0x5a47('0x40')][_0x5a47('0x58')]({'where':{'id':_0x2b6c5b[_0x5a47('0x55')]['id']}})['then'](handleEntityNotFound(_0x3b331b,null))[_0x5a47('0x21')](function(_0x4d0390){if(_0x4d0390){_0x2b6c5b[_0x5a47('0x60')][_0x5a47('0x63')]=_0x4d0390['id'];return db[_0x5a47('0x64')][_0x5a47('0x59')](_0x2b6c5b['body']);}})[_0x5a47('0x21')](respondWithResult(_0x3b331b,null))[_0x5a47('0x2c')](handleError(_0x3b331b,null));};exports[_0x5a47('0x65')]=function(_0x34b0b0,_0x458f55,_0x201266){var _0x2b3b27={'raw':![],'where':{}};var _0x8ef9d3={};var _0x268749={'count':0x0,'rows':[]};return db[_0x5a47('0x40')][_0x5a47('0x66')]({'where':{'id':_0x34b0b0[_0x5a47('0x55')]['id']}})[_0x5a47('0x21')](handleEntityNotFound(_0x458f55,null))[_0x5a47('0x21')](function(_0x388e17){if(_0x388e17){_0x8ef9d3['model']=_['keys'](db[_0x5a47('0x64')]['rawAttributes']);_0x8ef9d3[_0x5a47('0x45')]=_['keys'](_0x34b0b0[_0x5a47('0x45')]);_0x8ef9d3[_0x5a47('0x47')]=_[_0x5a47('0x48')](_0x8ef9d3['model'],_0x8ef9d3[_0x5a47('0x45')]);_0x2b3b27[_0x5a47('0x49')]=_[_0x5a47('0x48')](_0x8ef9d3[_0x5a47('0x43')],qs[_0x5a47('0x4a')](_0x34b0b0[_0x5a47('0x45')][_0x5a47('0x4a')]));_0x2b3b27[_0x5a47('0x49')]=_0x2b3b27[_0x5a47('0x49')][_0x5a47('0x4b')]?_0x2b3b27[_0x5a47('0x49')]:_0x8ef9d3['model'];if(!_0x34b0b0[_0x5a47('0x45')][_0x5a47('0x4c')](_0x5a47('0x67'))){_0x2b3b27[_0x5a47('0x32')]=qs['limit'](_0x34b0b0[_0x5a47('0x45')][_0x5a47('0x32')]);_0x2b3b27['offset']=qs['offset'](_0x34b0b0['query'][_0x5a47('0x30')]);}_0x2b3b27[_0x5a47('0x68')]=qs[_0x5a47('0x4d')](_0x34b0b0[_0x5a47('0x45')][_0x5a47('0x4d')]);_0x2b3b27[_0x5a47('0x4e')]=qs[_0x5a47('0x47')](_[_0x5a47('0x4f')](_0x34b0b0[_0x5a47('0x45')],_0x8ef9d3[_0x5a47('0x47')]));_0x2b3b27[_0x5a47('0x4e')]['OpenchannelAccountId']=_0x388e17['id'];if(_0x34b0b0[_0x5a47('0x45')]['filter']){_0x2b3b27[_0x5a47('0x4e')]=_['merge'](_0x2b3b27[_0x5a47('0x4e')],{'$or':_[_0x5a47('0x44')](_0x2b3b27[_0x5a47('0x49')],function(_0xfb8972){var _0x1fe370={};_0x1fe370[_0xfb8972]={'$like':'%'+_0x34b0b0[_0x5a47('0x45')]['filter']+'%'};return _0x1fe370;})});}_0x2b3b27=_[_0x5a47('0x57')]({},_0x2b3b27,_0x34b0b0[_0x5a47('0x51')]);return db['Disposition'][_0x5a47('0x33')]({'where':_0x2b3b27[_0x5a47('0x4e')]})[_0x5a47('0x21')](function(_0x28afcf){_0x268749[_0x5a47('0x33')]=_0x28afcf;if(_0x34b0b0[_0x5a47('0x45')][_0x5a47('0x52')]){_0x2b3b27['include']=[{'all':!![]}];}return db[_0x5a47('0x64')][_0x5a47('0x53')](_0x2b3b27);})['then'](function(_0x4de070){_0x268749[_0x5a47('0x69')]=_0x4de070;return _0x268749;});}})[_0x5a47('0x21')](respondWithFilteredResult(_0x458f55,_0x2b3b27))[_0x5a47('0x2c')](handleError(_0x458f55,null));};exports[_0x5a47('0x6a')]=function(_0x13faea,_0x259667,_0x3c2da2){return db[_0x5a47('0x40')]['find']({'where':{'id':_0x13faea['params']['id']}})[_0x5a47('0x21')](handleEntityNotFound(_0x259667,null))[_0x5a47('0x21')](function(_0x3c9f2){if(_0x3c9f2){return _0x3c9f2[_0x5a47('0x6a')](_0x13faea[_0x5a47('0x45')][_0x5a47('0x6b')]);}})['then'](respondWithStatusCode(_0x259667,null))[_0x5a47('0x2c')](handleError(_0x259667,null));};exports[_0x5a47('0x6c')]=function(_0x15d627,_0x44fd84,_0x140da4){if(_0x15d627['body']['id']){delete _0x15d627[_0x5a47('0x60')]['id'];}return db[_0x5a47('0x40')][_0x5a47('0x58')]({'where':{'id':_0x15d627['params']['id']}})[_0x5a47('0x21')](handleEntityNotFound(_0x44fd84,null))[_0x5a47('0x21')](function(_0x16189f){if(_0x16189f){_0x15d627[_0x5a47('0x60')][_0x5a47('0x63')]=_0x16189f['id'];return db[_0x5a47('0x6d')][_0x5a47('0x59')](_0x15d627[_0x5a47('0x60')]);}})[_0x5a47('0x21')](respondWithResult(_0x44fd84,null))[_0x5a47('0x2c')](handleError(_0x44fd84,null));};exports[_0x5a47('0x6e')]=function(_0x5d5d28,_0x25704d,_0x45f70e){var _0x491173={'raw':![],'where':{}};var _0x49364e={};var _0x4dc36c={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x5a47('0x66')]({'where':{'id':_0x5d5d28[_0x5a47('0x55')]['id']}})['then'](handleEntityNotFound(_0x25704d,null))[_0x5a47('0x21')](function(_0x311502){if(_0x311502){_0x49364e['model']=_[_0x5a47('0x46')](db['CannedAnswer'][_0x5a47('0x41')]);_0x49364e[_0x5a47('0x45')]=_[_0x5a47('0x46')](_0x5d5d28[_0x5a47('0x45')]);_0x49364e[_0x5a47('0x47')]=_[_0x5a47('0x48')](_0x49364e['model'],_0x49364e['query']);_0x491173[_0x5a47('0x49')]=_[_0x5a47('0x48')](_0x49364e[_0x5a47('0x43')],qs[_0x5a47('0x4a')](_0x5d5d28[_0x5a47('0x45')][_0x5a47('0x4a')]));_0x491173[_0x5a47('0x49')]=_0x491173['attributes']['length']?_0x491173[_0x5a47('0x49')]:_0x49364e['model'];if(!_0x5d5d28[_0x5a47('0x45')]['hasOwnProperty']('nolimit')){_0x491173[_0x5a47('0x32')]=qs[_0x5a47('0x32')](_0x5d5d28[_0x5a47('0x45')][_0x5a47('0x32')]);_0x491173[_0x5a47('0x30')]=qs['offset'](_0x5d5d28['query'][_0x5a47('0x30')]);}_0x491173[_0x5a47('0x68')]=qs[_0x5a47('0x4d')](_0x5d5d28[_0x5a47('0x45')][_0x5a47('0x4d')]);_0x491173['where']=qs[_0x5a47('0x47')](_[_0x5a47('0x4f')](_0x5d5d28[_0x5a47('0x45')],_0x49364e['filters']));_0x491173[_0x5a47('0x4e')]['OpenchannelAccountId']=_0x311502['id'];if(_0x5d5d28[_0x5a47('0x45')][_0x5a47('0x50')]){_0x491173[_0x5a47('0x4e')]=_[_0x5a47('0x57')](_0x491173[_0x5a47('0x4e')],{'$or':_[_0x5a47('0x44')](_0x491173[_0x5a47('0x49')],function(_0x2758b8){var _0x1b9393={};_0x1b9393[_0x2758b8]={'$like':'%'+_0x5d5d28[_0x5a47('0x45')][_0x5a47('0x50')]+'%'};return _0x1b9393;})});}_0x491173=_[_0x5a47('0x57')]({},_0x491173,_0x5d5d28[_0x5a47('0x51')]);return db[_0x5a47('0x6d')][_0x5a47('0x33')]({'where':_0x491173['where']})['then'](function(_0x376650){_0x4dc36c[_0x5a47('0x33')]=_0x376650;if(_0x5d5d28[_0x5a47('0x45')]['includeAll']){_0x491173[_0x5a47('0x6f')]=[{'all':!![]}];}return db['CannedAnswer'][_0x5a47('0x53')](_0x491173);})[_0x5a47('0x21')](function(_0x4b3f3e){_0x4dc36c[_0x5a47('0x69')]=_0x4b3f3e;return _0x4dc36c;});}})['then'](respondWithFilteredResult(_0x25704d,_0x491173))['catch'](handleError(_0x25704d,null));};exports[_0x5a47('0x70')]=function(_0x40de4f,_0x187f0c,_0x528f47){return db['OpenchannelAccount'][_0x5a47('0x58')]({'where':{'id':_0x40de4f[_0x5a47('0x55')]['id']}})[_0x5a47('0x21')](handleEntityNotFound(_0x187f0c,null))['then'](function(_0x5b7884){if(_0x5b7884){return _0x5b7884['removeAnswers'](_0x40de4f['query'][_0x5a47('0x6b')]);}})[_0x5a47('0x21')](respondWithStatusCode(_0x187f0c,null))[_0x5a47('0x2c')](handleError(_0x187f0c,null));};exports['notify']=function(_0x8ae7eb,_0x2a6131,_0x21a01f){var _0x1f9f61={'body':_0x8ae7eb[_0x5a47('0x60')],'channel':_0x5a47('0x71')};var _0x4dd769=[];var _0x5d3761=[];var _0x5abb62={};var _0x216374=![];return db[_0x5a47('0x72')][_0x5a47('0x61')]()[_0x5a47('0x21')](function(_0x569332){if(!_0x569332){throw new db[(_0x5a47('0x73'))][(_0x5a47('0x74'))](_0x5a47('0x75'));}_0x4dd769=_[_0x5a47('0x76')](_[_0x5a47('0x46')](_0x569332),['createdAt','updatedAt']);_0x5d3761=_['difference'](_[_0x5a47('0x46')](_0x569332),[_0x5a47('0x77'),_0x5a47('0x78'),'CompanyId',_0x5a47('0x79')]);if(_0x8ae7eb['body']['id']){delete _0x8ae7eb['body']['id'];}if(_[_0x5a47('0x7a')](_0x8ae7eb[_0x5a47('0x60')]['from'])){throw new db[(_0x5a47('0x73'))][(_0x5a47('0x74'))](_0x5a47('0x7b'));}if(_[_0x5a47('0x7a')](_0x8ae7eb[_0x5a47('0x60')][_0x5a47('0x60')])||_0x8ae7eb[_0x5a47('0x60')][_0x5a47('0x60')]===''){throw new db[(_0x5a47('0x73'))]['ValidationError'](_0x5a47('0x7c'));}if(_[_0x5a47('0x7a')](_0x8ae7eb[_0x5a47('0x60')][_0x5a47('0x7d')])){throw new db['Sequelize'][(_0x5a47('0x74'))](_0x5a47('0x7e')+_0x5d3761);}if(!_[_0x5a47('0x7f')](_0x5d3761,_0x8ae7eb[_0x5a47('0x60')][_0x5a47('0x7d')])){throw new db['Sequelize'][(_0x5a47('0x74'))](_0x5a47('0x80')+_0x5d3761);}_0x5abb62[_0x8ae7eb[_0x5a47('0x60')]['mapKey']]=_0x8ae7eb[_0x5a47('0x60')][_0x5a47('0x81')];})[_0x5a47('0x21')](function(){return db[_0x5a47('0x40')]['find']({'where':{'id':_0x8ae7eb['params']['id']},'include':[{'model':db[_0x5a47('0x82')],'as':_0x5a47('0x83'),'include':[{'model':db[_0x5a47('0x72')],'as':_0x5a47('0x84'),'where':_0x5abb62,'limit':0x1,'order':[[_0x5a47('0x78'),_0x5a47('0x85')]]}]},{'model':db[_0x5a47('0x86')],'as':_0x5a47('0x87')}]});})[_0x5a47('0x21')](handleEntityNotFound(_0x2a6131,null))[_0x5a47('0x21')](function(_0x154817){if(_0x154817&&_0x154817['List']){_0x1f9f61[_0x5a47('0x88')]=_0x154817;_0x1f9f61[_0x5a47('0x89')]=_0x154817[_0x5a47('0x87')];_0x1f9f61[_0x5a47('0x8a')]=_0x154817[_0x5a47('0x83')];_0x1f9f61[_0x5a47('0x89')]=_[_0x5a47('0x8b')](_0x1f9f61[_0x5a47('0x89')],['priority'],['asc']);if(_0x1f9f61[_0x5a47('0x88')][_0x5a47('0x87')]){delete _0x1f9f61[_0x5a47('0x88')][_0x5a47('0x87')];}if(_0x1f9f61[_0x5a47('0x88')]['List']&&_0x1f9f61[_0x5a47('0x88')][_0x5a47('0x83')]['Contacts'][_0x5a47('0x4b')]){return _0x1f9f61[_0x5a47('0x88')][_0x5a47('0x83')]['Contacts'][0x0];}var _0x47bcd3=_[_0x5a47('0x1a')](_0x8ae7eb[_0x5a47('0x60')],{'firstName':_0x8ae7eb[_0x5a47('0x60')]['from'],'ListId':_0x154817[_0x5a47('0x79')]});_0x47bcd3[_0x8ae7eb['body'][_0x5a47('0x7d')]]=_0x8ae7eb['body'][_0x5a47('0x81')];return db[_0x5a47('0x72')]['create'](_0x47bcd3,{'fields':_0x4dd769,'raw':!![]});}})['then'](handleEntityNotFound(_0x2a6131,null))[_0x5a47('0x21')](function(_0x12ca13){_0x1f9f61[_0x5a47('0x8c')]=_0x12ca13;if(_0x12ca13){var _0x362c17={'ContactId':_0x12ca13['id'],'OpenchannelAccountId':_0x8ae7eb[_0x5a47('0x55')]['id'],'from':(_0x12ca13[_0x5a47('0x8d')]||'')+'\x20'+(_0x12ca13[_0x5a47('0x8e')]||'')};var _0x5ba174={'OpenchannelAccountId':_0x8ae7eb[_0x5a47('0x55')]['id'],'closed':![]};if(_0x8ae7eb['body'][_0x5a47('0x8f')]){_0x5ba174[_0x5a47('0x8f')]=_0x8ae7eb[_0x5a47('0x60')][_0x5a47('0x8f')];return db[_0x5a47('0x90')][_0x5a47('0x58')]({'where':_0x5ba174})['then'](function(_0x5049db){if(_0x5049db){return[_0x5049db,![]];}_0x362c17['threadId']=_0x8ae7eb['body'][_0x5a47('0x8f')];_0x362c17[_0x5a47('0x91')]=_0x8ae7eb[_0x5a47('0x60')][_0x5a47('0x91')];return db[_0x5a47('0x90')][_0x5a47('0x59')](_0x362c17)[_0x5a47('0x21')](function(_0x59ce0a){return[_0x59ce0a,!![]];});});}else{_0x5ba174[_0x5a47('0x8f')]=null;}_0x5ba174['ContactId']=_0x12ca13['id'];return db[_0x5a47('0x90')][_0x5a47('0x58')]({'where':_0x5ba174})[_0x5a47('0x21')](function(_0x2558ea){if(_0x2558ea){return[_0x2558ea,![]];}return db[_0x5a47('0x90')][_0x5a47('0x59')](_0x362c17)['then'](function(_0x2bb99e){return[_0x2bb99e,!![]];});});}})[_0x5a47('0x92')](function(_0xfc0ba2,_0x57a680){if(_0xfc0ba2){_0x216374=_0x57a680;if(!_0x57a680){var _0xf3d18d={'from':(_0x1f9f61[_0x5a47('0x8c')][_0x5a47('0x8d')]||'')+'\x20'+(_0x1f9f61['contact']['lastName']||'')};if(_0x8ae7eb['body'][_0x5a47('0x8f')]&&_0x8ae7eb['body'][_0x5a47('0x93')]&&_0x8ae7eb['body'][_0x5a47('0x8f')]!=_0x8ae7eb[_0x5a47('0x60')][_0x5a47('0x93')]){_0xf3d18d['threadId']=_0x8ae7eb[_0x5a47('0x60')][_0x5a47('0x93')];}return _0xfc0ba2[_0x5a47('0x38')](_0xf3d18d);}else{return _0xfc0ba2;}}})[_0x5a47('0x21')](function(_0x1a74c7){_0x1f9f61[_0x5a47('0x94')]=_0x1a74c7[_0x5a47('0x3a')]({'plain':!![]});_0x1f9f61['interaction'][_0x5a47('0x95')]=_0x216374;if(_0x1f9f61[_0x5a47('0x94')][_0x5a47('0x95')]){if(_0x1f9f61[_0x5a47('0x88')][_0x5a47('0x96')]){_0x1f9f61[_0x5a47('0x89')][_0x5a47('0x97')]({'id':0x0,'priority':_0x1f9f61[_0x5a47('0x89')][_0x5a47('0x4b')]+0x1,'app':'close','appdata':_0x5a47('0x98'),'interval':_0x5a47('0x99')});}}return db[_0x5a47('0x9a')][_0x5a47('0x59')]({'body':_0x8ae7eb['body']['body'],'OpenchannelAccountId':_0x8ae7eb[_0x5a47('0x55')]['id'],'OpenchannelInteractionId':_0x1a74c7['id'],'direction':'in','ContactId':_0x1f9f61[_0x5a47('0x8c')]['id'],'AttachmentId':_0x8ae7eb[_0x5a47('0x60')][_0x5a47('0x9b')]});})['then'](function(_0x5d0c98){_0x1f9f61[_0x5a47('0x2a')]=_0x5d0c98;if(_0x1f9f61[_0x5a47('0x94')][_0x5a47('0x9c')]){return db[_0x5a47('0x9d')][_0x5a47('0x58')]({'attributes':['id',_0x5a47('0x3d')],'where':{'id':_0x1f9f61[_0x5a47('0x94')][_0x5a47('0x9c')]}})['then'](function(_0x264343){if(_0x264343){_0x1f9f61[_0x5a47('0x89')][_0x5a47('0x9e')]({'id':0x0,'priority':0x0,'app':_0x5a47('0x9f'),'appdata':_0x264343[_0x5a47('0x3d')]+','+(_0x1f9f61[_0x5a47('0x88')][_0x5a47('0xa0')]||0xa),'interval':'*,*,*,*'});_0x1f9f61[_0x5a47('0xa1')]=![];}return respondWithRpcPromise(_0x5a47('0xa2'),_0x5a47('0xa3'),_0x1f9f61);});}return respondWithRpcPromise(_0x5a47('0xa2'),'startRouting',_0x1f9f61);})[_0x5a47('0x21')](function(_0x2f4359){respondWithRpcPromise(_0x5a47('0xa4'),_0x5a47('0xa4'),{'event':_0x5a47('0xa5'),'message':_0x2f4359},client9002);return _0x2f4359;})[_0x5a47('0x21')](respondWithResult(_0x2a6131,null))[_0x5a47('0x2c')](handleError(_0x2a6131,null));};exports['addApplications']=function(_0x2e3180,_0x37d037,_0x30413e){return db[_0x5a47('0x40')][_0x5a47('0x66')]({'where':{'id':_0x2e3180[_0x5a47('0x55')]['id']}})[_0x5a47('0x21')](handleEntityNotFound(_0x37d037,null))[_0x5a47('0x21')](function(_0x3090f5){if(_0x3090f5){return db[_0x5a47('0xa6')][_0x5a47('0xa7')](function(_0x8b8374){return db[_0x5a47('0x86')][_0x5a47('0x39')]({'where':{'OpenchannelAccountId':_0x2e3180[_0x5a47('0x55')]['id']},'transaction':_0x8b8374})[_0x5a47('0x21')](function(_0x5bb047){var _0x3d4d64=_['map'](_0x2e3180['body'],function(_0x2ddf76){_0x2ddf76['OpenchannelAccountId']=_0x2e3180[_0x5a47('0x55')]['id'];return _0x2ddf76;});return db['OpenchannelApplication'][_0x5a47('0xa8')](_0x3d4d64,{'transaction':_0x8b8374});});})[_0x5a47('0x21')](function(){return db[_0x5a47('0x86')][_0x5a47('0xa9')]({'where':{'OpenchannelAccountId':_0x2e3180[_0x5a47('0x55')]['id']},'order':'priority'});});}})[_0x5a47('0x21')](respondWithResult(_0x37d037,null))[_0x5a47('0x2c')](handleError(_0x37d037,null));};exports['getApplications']=function(_0x569006,_0x596962,_0x371c45){var _0x112f79={};var _0x277cbc={};var _0x3114ad;var _0x4a3e09;return db[_0x5a47('0x40')][_0x5a47('0x66')]({'where':{'id':_0x569006[_0x5a47('0x55')]['id']}})[_0x5a47('0x21')](handleEntityNotFound(_0x596962,null))[_0x5a47('0x21')](function(_0x45e6a1){if(_0x45e6a1){_0x3114ad=_0x45e6a1;_0x277cbc[_0x5a47('0x43')]=_[_0x5a47('0x46')](db[_0x5a47('0x86')][_0x5a47('0x41')]);_0x277cbc['query']=_['keys'](_0x569006['query']);_0x277cbc[_0x5a47('0x47')]=_['intersection'](_0x277cbc[_0x5a47('0x43')],_0x277cbc['query']);_0x112f79['attributes']=_[_0x5a47('0x48')](_0x277cbc[_0x5a47('0x43')],qs[_0x5a47('0x4a')](_0x569006['query'][_0x5a47('0x4a')]));_0x112f79[_0x5a47('0x49')]=_0x112f79['attributes'][_0x5a47('0x4b')]?_0x112f79[_0x5a47('0x49')]:_0x277cbc[_0x5a47('0x43')];_0x112f79[_0x5a47('0x68')]=qs[_0x5a47('0x4d')](_0x569006['query']['sort']);_0x112f79[_0x5a47('0x4e')]=qs[_0x5a47('0x47')](_['pick'](_0x569006['query'],_0x277cbc[_0x5a47('0x47')]));if(_0x569006['query']['filter']){_0x112f79['where']=_['merge'](_0x112f79[_0x5a47('0x4e')],{'$or':_[_0x5a47('0x44')](_0x112f79[_0x5a47('0x49')],function(_0x29b65a){var _0x3c0d0e={};_0x3c0d0e[_0x29b65a]={'$like':'%'+_0x569006[_0x5a47('0x45')][_0x5a47('0x50')]+'%'};return _0x3c0d0e;})});}_0x112f79=_[_0x5a47('0x57')]({},_0x112f79,_0x569006[_0x5a47('0x51')]);return _0x3114ad[_0x5a47('0xaa')](_0x112f79);}})[_0x5a47('0x21')](function(_0x44a2fb){if(_0x44a2fb){_0x4a3e09=_0x44a2fb['length'];if(!_0x569006[_0x5a47('0x45')][_0x5a47('0x4c')](_0x5a47('0x67'))){_0x112f79['limit']=qs[_0x5a47('0x32')](_0x569006['query'][_0x5a47('0x32')]);_0x112f79[_0x5a47('0x30')]=qs['offset'](_0x569006[_0x5a47('0x45')][_0x5a47('0x30')]);}return _0x3114ad[_0x5a47('0xaa')](_0x112f79);}})[_0x5a47('0x21')](function(_0x24ae53){if(_0x24ae53){return _0x24ae53?{'count':_0x4a3e09,'rows':_0x24ae53}:null;}})[_0x5a47('0x21')](respondWithResult(_0x596962,null))[_0x5a47('0x2c')](handleError(_0x596962,null));};exports[_0x5a47('0xab')]=function(_0x45cf28,_0x2156ae,_0x96a5a7){var _0x4f609f={'raw':![],'where':{}};var _0x191ef0={};var _0x44e10b={'count':0x0,'rows':[]};return db[_0x5a47('0x40')][_0x5a47('0x66')]({'where':{'id':_0x45cf28[_0x5a47('0x55')]['id']}})[_0x5a47('0x21')](handleEntityNotFound(_0x2156ae,null))['then'](function(_0x59d90f){if(_0x59d90f){_0x191ef0[_0x5a47('0x43')]=_[_0x5a47('0x46')](db['OpenchannelInteraction']['rawAttributes']);_0x191ef0[_0x5a47('0x45')]=_[_0x5a47('0x46')](_0x45cf28[_0x5a47('0x45')]);_0x191ef0[_0x5a47('0x47')]=_['intersection'](_0x191ef0[_0x5a47('0x43')],_0x191ef0[_0x5a47('0x45')]);_0x4f609f[_0x5a47('0x49')]=_[_0x5a47('0x48')](_0x191ef0['model'],qs['fields'](_0x45cf28[_0x5a47('0x45')][_0x5a47('0x4a')]));_0x4f609f['attributes']=_0x4f609f['attributes'][_0x5a47('0x4b')]?_0x4f609f['attributes']:_0x191ef0['model'];if(!_0x45cf28['query'][_0x5a47('0x4c')](_0x5a47('0x67'))){_0x4f609f['limit']=qs[_0x5a47('0x32')](_0x45cf28[_0x5a47('0x45')][_0x5a47('0x32')]);_0x4f609f['offset']=qs[_0x5a47('0x30')](_0x45cf28[_0x5a47('0x45')]['offset']);}_0x4f609f[_0x5a47('0x68')]=qs['sort'](_0x45cf28[_0x5a47('0x45')][_0x5a47('0x4d')]);_0x4f609f['where']=qs['filters'](_[_0x5a47('0x4f')](_0x45cf28['query'],_0x191ef0[_0x5a47('0x47')]));_0x4f609f[_0x5a47('0x4e')][_0x5a47('0x63')]=_0x59d90f['id'];if(_0x45cf28['query'][_0x5a47('0x50')]){_0x4f609f[_0x5a47('0x4e')]=_[_0x5a47('0x57')](_0x4f609f[_0x5a47('0x4e')],{'$or':_[_0x5a47('0x44')](_0x4f609f[_0x5a47('0x49')],function(_0x18d82f){var _0x4b8137={};_0x4b8137[_0x18d82f]={'$like':'%'+_0x45cf28[_0x5a47('0x45')][_0x5a47('0x50')]+'%'};return _0x4b8137;})});}_0x4f609f=_[_0x5a47('0x57')]({},_0x4f609f,_0x45cf28[_0x5a47('0x51')]);return db[_0x5a47('0x90')][_0x5a47('0x33')]({'where':_0x4f609f[_0x5a47('0x4e')]})[_0x5a47('0x21')](function(_0x2c4a87){_0x44e10b[_0x5a47('0x33')]=_0x2c4a87;if(_0x45cf28[_0x5a47('0x45')][_0x5a47('0x52')]){_0x4f609f[_0x5a47('0x6f')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x5a47('0x3d'),_0x5a47('0xac'),_0x5a47('0xad')],'required':![]},{'model':db[_0x5a47('0xae')],'as':_0x5a47('0xaf'),'attributes':['id',_0x5a47('0x3d'),_0x5a47('0xb0')],'where':_0x45cf28[_0x5a47('0x45')][_0x5a47('0xb1')]?{'id':_0x45cf28['query'][_0x5a47('0xb1')]}:undefined,'required':_0x45cf28[_0x5a47('0x45')][_0x5a47('0xb1')]?!![]:![]}];}return db[_0x5a47('0x90')][_0x5a47('0x53')](_0x4f609f);})[_0x5a47('0x21')](function(_0x4d2daf){_0x44e10b[_0x5a47('0x69')]=_0x4d2daf;return _0x44e10b;});}})[_0x5a47('0x21')](respondWithFilteredResult(_0x2156ae,_0x4f609f))[_0x5a47('0x2c')](handleError(_0x2156ae,null));};exports[_0x5a47('0xb2')]=function(_0x2c3148,_0x40936e,_0x307343){return db[_0x5a47('0x40')]['find']({'where':{'id':_0x2c3148[_0x5a47('0x55')]['id']}})[_0x5a47('0x21')](handleEntityNotFound(_0x40936e,null))['then'](function(_0x561520){if(_0x561520){return _0x561520['addAgents'](_0x2c3148[_0x5a47('0x60')][_0x5a47('0x6b')],_[_0x5a47('0xb3')](_0x2c3148[_0x5a47('0x60')],[_0x5a47('0x6b'),'id'])||{})[_0x5a47('0x92')](function(_0x476268){for(var _0x35f3fa=0x0;_0x35f3fa<_0x2c3148[_0x5a47('0x60')][_0x5a47('0x6b')][_0x5a47('0x4b')];_0x35f3fa+=0x1){socket[_0x5a47('0xb4')](_0x5a47('0xb5'),{'UserId':Number(_0x2c3148[_0x5a47('0x60')][_0x5a47('0x6b')][_0x35f3fa]),'OpenchannelAccountId':Number(_0x2c3148[_0x5a47('0x55')]['id'])});}return _0x476268;});}})['then'](respondWithResult(_0x40936e,null))[_0x5a47('0x2c')](handleError(_0x40936e,null));};exports[_0x5a47('0xb6')]=function(_0x55c62f,_0x53d2f7,_0x302667){return db[_0x5a47('0x40')][_0x5a47('0x58')]({'where':{'id':_0x55c62f[_0x5a47('0x55')]['id']}})[_0x5a47('0x21')](handleEntityNotFound(_0x53d2f7,null))[_0x5a47('0x21')](function(_0x59d4d4){if(_0x59d4d4){return _0x59d4d4[_0x5a47('0xb6')](_0x55c62f[_0x5a47('0x45')][_0x5a47('0x6b')])[_0x5a47('0x21')](function(){if(_[_0x5a47('0xb7')](_0x55c62f['query'][_0x5a47('0x6b')])){for(var _0x4ada7f=0x0;_0x4ada7f<_0x55c62f[_0x5a47('0x45')][_0x5a47('0x6b')][_0x5a47('0x4b')];_0x4ada7f+=0x1){socket['emit'](_0x5a47('0xb8'),{'UserId':Number(_0x55c62f[_0x5a47('0x45')][_0x5a47('0x6b')][_0x4ada7f]),'OpenchannelAccountId':Number(_0x55c62f[_0x5a47('0x55')]['id'])});}}else{socket[_0x5a47('0xb4')](_0x5a47('0xb8'),{'UserId':Number(_0x55c62f[_0x5a47('0x45')][_0x5a47('0x6b')]),'OpenchannelAccountId':Number(_0x55c62f[_0x5a47('0x55')]['id'])});}});}})[_0x5a47('0x21')](respondWithStatusCode(_0x53d2f7,null))['catch'](handleError(_0x53d2f7,null));};exports[_0x5a47('0xb9')]=function(_0x1d9c4a,_0x1652d2,_0x1ae0ba){var _0x32e6a4={};var _0x2b82f5={};var _0x15f6ac;var _0x3485e0;return db[_0x5a47('0x40')][_0x5a47('0x66')]({'where':{'id':_0x1d9c4a[_0x5a47('0x55')]['id']}})[_0x5a47('0x21')](handleEntityNotFound(_0x1652d2,null))['then'](function(_0x379379){if(_0x379379){_0x15f6ac=_0x379379;_0x2b82f5[_0x5a47('0x43')]=_[_0x5a47('0x46')](db['User']['rawAttributes']);_0x2b82f5['query']=_[_0x5a47('0x46')](_0x1d9c4a[_0x5a47('0x45')]);_0x2b82f5[_0x5a47('0x47')]=_[_0x5a47('0x48')](_0x2b82f5['model'],_0x2b82f5[_0x5a47('0x45')]);_0x32e6a4['attributes']=_[_0x5a47('0x48')](_0x2b82f5[_0x5a47('0x43')],qs[_0x5a47('0x4a')](_0x1d9c4a[_0x5a47('0x45')][_0x5a47('0x4a')]));_0x32e6a4[_0x5a47('0x49')]=_0x32e6a4[_0x5a47('0x49')][_0x5a47('0x4b')]?_0x32e6a4['attributes']:_0x2b82f5['model'];_0x32e6a4['order']=qs[_0x5a47('0x4d')](_0x1d9c4a[_0x5a47('0x45')][_0x5a47('0x4d')]);_0x32e6a4[_0x5a47('0x4e')]=qs[_0x5a47('0x47')](_[_0x5a47('0x4f')](_0x1d9c4a[_0x5a47('0x45')],_0x2b82f5[_0x5a47('0x47')]));if(_0x1d9c4a['query'][_0x5a47('0x50')]){_0x32e6a4[_0x5a47('0x4e')]=_[_0x5a47('0x57')](_0x32e6a4[_0x5a47('0x4e')],{'$or':_[_0x5a47('0x44')](_0x32e6a4[_0x5a47('0x49')],function(_0x228d86){var _0x32f5fe={};_0x32f5fe[_0x228d86]={'$like':'%'+_0x1d9c4a[_0x5a47('0x45')]['filter']+'%'};return _0x32f5fe;})});}_0x32e6a4=_['merge']({},_0x32e6a4,_0x1d9c4a[_0x5a47('0x51')]);return _0x15f6ac['getAgents'](_0x32e6a4);}})[_0x5a47('0x21')](function(_0x1e640f){if(_0x1e640f){_0x3485e0=_0x1e640f[_0x5a47('0x4b')];if(!_0x1d9c4a[_0x5a47('0x45')]['hasOwnProperty'](_0x5a47('0x67'))){_0x32e6a4['limit']=qs[_0x5a47('0x32')](_0x1d9c4a[_0x5a47('0x45')]['limit']);_0x32e6a4[_0x5a47('0x30')]=qs[_0x5a47('0x30')](_0x1d9c4a[_0x5a47('0x45')][_0x5a47('0x30')]);}return _0x15f6ac[_0x5a47('0xb9')](_0x32e6a4);}})[_0x5a47('0x21')](function(_0x16a3aa){if(_0x16a3aa){return _0x16a3aa?{'count':_0x3485e0,'rows':_0x16a3aa}:null;}})['then'](respondWithResult(_0x1652d2,null))['catch'](handleError(_0x1652d2,null));};exports[_0x5a47('0xba')]=function(_0x309397,_0x22c50b,_0x5cbc25){var _0x51d6d8,_0x3c85c0,_0x27cefd;if(_[_0x5a47('0x7a')](_0x309397['body'][_0x5a47('0x60')])||_0x309397[_0x5a47('0x60')][_0x5a47('0x60')]===''){throw new db['Sequelize'][(_0x5a47('0x74'))](_0x5a47('0x7c'));}if(_[_0x5a47('0x7a')](_0x309397[_0x5a47('0x60')]['to'])){}_0x51d6d8=_0x309397['body']['to'];return db[_0x5a47('0x40')][_0x5a47('0x66')]({'where':{'id':_0x309397[_0x5a47('0x55')]['id']}})[_0x5a47('0x21')](handleEntityNotFound(_0x22c50b,null))[_0x5a47('0x21')](function(_0x36e1e8){if(_0x36e1e8){return db[_0x5a47('0x40')][_0x5a47('0x58')]({'where':{'id':_0x36e1e8['id']},'include':[{'model':db[_0x5a47('0x82')],'as':_0x5a47('0x83'),'include':[{'model':db[_0x5a47('0x72')],'as':'Contacts','where':{[_0x36e1e8['mapKey']]:_0x51d6d8},'limit':0x1,'order':[[_0x5a47('0x78'),'DESC']]}]}]})[_0x5a47('0x21')](handleEntityNotFound(_0x22c50b,null))[_0x5a47('0x21')](function(_0x4d3597){if(_0x4d3597&&_0x4d3597[_0x5a47('0x83')]){_0x3c85c0=_0x4d3597[_0x5a47('0x3a')]({'plain':!![]});if(_0x3c85c0['List']&&_0x3c85c0[_0x5a47('0x83')][_0x5a47('0x84')][_0x5a47('0x4b')]){return _0x3c85c0[_0x5a47('0x83')][_0x5a47('0x84')][0x0];}return db[_0x5a47('0x72')][_0x5a47('0x59')](_[_0x5a47('0x1a')](_0x309397[_0x5a47('0x60')],{'firstName':_0x51d6d8,[_0x4d3597['mapKey']]:_0x51d6d8,'phone':_0x51d6d8,'ListId':_0x3c85c0['ListId']}));}})['then'](handleEntityNotFound(_0x22c50b,null))[_0x5a47('0x21')](function(_0x15e7b7){if(_0x15e7b7){_0x27cefd=_0x15e7b7;return db[_0x5a47('0x90')][_0x5a47('0x58')]({'where':{'ContactId':_0x27cefd['id'],'closed':![],'OpenchannelAccountId':_0x3c85c0['id']}})['then'](function(_0x2b66bd){if(_0x2b66bd){return[_0x2b66bd,![]];}return db[_0x5a47('0x90')][_0x5a47('0x59')]({'UserId':_0x309397[_0x5a47('0x5a')]['id'],'ContactId':_0x27cefd['id'],'OpenchannelAccountId':_0x3c85c0['id'],'lastMsgDirection':_0x5a47('0xbb'),'Messages':[_[_0x5a47('0x57')](_0x309397[_0x5a47('0x60')],{'read':![],'body':_0x309397['body'][_0x5a47('0x60')],'OpenchannelAccountId':_0x3c85c0['id'],'UserId':_0x309397[_0x5a47('0x5a')]['id'],'ContactId':_0x27cefd['id']})]},{'include':[{'model':db[_0x5a47('0x9a')],'as':'Messages'}]})['then'](function(_0x25905c){return[_0x25905c,!![]];});});}})[_0x5a47('0x92')](function(_0x4195ef,_0x43af9c){if(_0x43af9c){return _0x4195ef;}return db[_0x5a47('0x9a')][_0x5a47('0x59')](_[_0x5a47('0x57')](_0x309397[_0x5a47('0x60')],{'read':![],'body':_0x309397[_0x5a47('0x60')][_0x5a47('0x60')],'OpenchannelAccountId':_0x3c85c0['id'],'OpenchannelInteractionId':_0x4195ef['id'],'UserId':_0x309397[_0x5a47('0x5a')]['id'],'ContactId':_0x27cefd['id']}))[_0x5a47('0x21')](function(_0x3bc40a){_0x4195ef[_0x5a47('0xbc')][_0x5a47('0xbd')]=[];_0x4195ef[_0x5a47('0xbc')][_0x5a47('0xbd')][_0x5a47('0x97')](_0x3bc40a['dataValues']);return _0x4195ef;});});}})['then'](respondWithResult(_0x22c50b,null))[_0x5a47('0x2c')](handleError(_0x22c50b,null));}; \ No newline at end of file +var _0xe79a=['mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','DESC','Applications','account','applications','list','priority','asc','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','lastName','messageId','interaction','created','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','transaction','OpenchannelApplication','bulkCreate','findAndCountAll','getApplications','Contact','Owner','fullname','Tag','Tags','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','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','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','http','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','undefined','limit','offset','set','json','apply','reject','update','destroy','UserProfileResource','end','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','merge','filter','options','OpenchannelAccount','count','include','findAll','rows','show','params','keys','fields','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','Disposition','getDispositions','findOne','nolimit','order','includeAll','removeDispositions','ids','addAnswer','OpenchannelAccountId','CannedAnswer','notify','openchannel','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes'];(function(_0x1a9d5d,_0x508c47){var _0x37e2b8=function(_0x4631ed){while(--_0x4631ed){_0x1a9d5d['push'](_0x1a9d5d['shift']());}};_0x37e2b8(++_0x508c47);}(_0xe79a,0x1b1));var _0xae79=function(_0xfd0d38,_0x3e89fe){_0xfd0d38=_0xfd0d38-0x0;var _0x38eea8=_0xe79a[_0xfd0d38];return _0x38eea8;};'use strict';var emlformat=require(_0xae79('0x0'));var rimraf=require(_0xae79('0x1'));var zipdir=require(_0xae79('0x2'));var jsonpatch=require(_0xae79('0x3'));var rp=require(_0xae79('0x4'));var moment=require(_0xae79('0x5'));var BPromise=require(_0xae79('0x6'));var Mustache=require(_0xae79('0x7'));var util=require(_0xae79('0x8'));var path=require(_0xae79('0x9'));var sox=require(_0xae79('0xa'));var csv=require(_0xae79('0xb'));var ejs=require(_0xae79('0xc'));var fs=require('fs');var fs_extra=require(_0xae79('0xd'));var _=require(_0xae79('0xe'));var squel=require('squel');var crypto=require(_0xae79('0xf'));var jsforce=require(_0xae79('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xae79('0xb'));var querystring=require(_0xae79('0x11'));var Papa=require(_0xae79('0x12'));var Redis=require(_0xae79('0x13'));var authService=require(_0xae79('0x14'));var qs=require(_0xae79('0x15'));var as=require(_0xae79('0x16'));var hardwareService=require(_0xae79('0x17'));var logger=require('../../config/logger')(_0xae79('0x18'));var utils=require(_0xae79('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xae79('0x1a'));var db=require(_0xae79('0x1b'))['db'];config[_0xae79('0x1c')]=_[_0xae79('0x1d')](config['redis'],{'host':_0xae79('0x1e'),'port':0x18eb});var socket=require(_0xae79('0x1f'))(new Redis(config[_0xae79('0x1c')]));require(_0xae79('0x20'))[_0xae79('0x21')](socket);var jayson=require('jayson/promise');var client=jayson[_0xae79('0x22')][_0xae79('0x23')]({'port':0x232c});var client9002=jayson[_0xae79('0x22')][_0xae79('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x4c7271,_0x1a1ee1,_0x49ce43,_0x2e0ff0){return new BPromise(function(_0x5d8aff,_0x1e6279){var _0x4d4343=_0x2e0ff0||client;return _0x4d4343['request'](_0x4c7271,_0x49ce43)[_0xae79('0x24')](function(_0x707d8a){logger['info'](_0xae79('0x25'),_0x1a1ee1,_0xae79('0x26'));logger['debug'](_0xae79('0x27'),_0x1a1ee1,'request\x20sent',JSON[_0xae79('0x28')](_0x707d8a));if(_0x707d8a['error']){if(_0x707d8a['error']['code']===0x1f4){logger[_0xae79('0x29')](_0xae79('0x25'),_0x1a1ee1,_0x707d8a['error']['message']);return _0x1e6279(_0x707d8a[_0xae79('0x29')][_0xae79('0x2a')]);}logger[_0xae79('0x29')](_0xae79('0x25'),_0x1a1ee1,_0x707d8a[_0xae79('0x29')][_0xae79('0x2a')]);return _0x5d8aff(_0x707d8a[_0xae79('0x29')]['message']);}else{logger['info'](_0xae79('0x25'),_0x1a1ee1,'request\x20sent');_0x5d8aff(_0x707d8a[_0xae79('0x2b')]['message']);}})[_0xae79('0x2c')](function(_0x586254){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x1a1ee1,_0x586254);_0x1e6279(_0x586254);});});}function respondWithStatusCode(_0x372865,_0xd62b72){_0xd62b72=_0xd62b72||0xcc;return function(_0x19c811){if(_0x19c811){return _0x372865[_0xae79('0x2d')](_0xd62b72);}return _0x372865[_0xae79('0x2e')](_0xd62b72)['end']();};}function respondWithResult(_0x549dd2,_0x5a6df6){_0x5a6df6=_0x5a6df6||0xc8;return function(_0x3d5bc7){if(_0x3d5bc7){return _0x549dd2[_0xae79('0x2e')](_0x5a6df6)['json'](_0x3d5bc7);}};}function respondWithFilteredResult(_0x2585d7,_0x3eabb1){return function(_0x312eff){if(_0x312eff){var _0x13d08e=typeof _0x3eabb1['offset']===_0xae79('0x2f')&&typeof _0x3eabb1[_0xae79('0x30')]===_0xae79('0x2f');var _0xe2a8b8=_0x312eff['count'];var _0x10499b=_0x13d08e?0x0:_0x3eabb1[_0xae79('0x31')];var _0x419043=_0x13d08e?_0x312eff['count']:_0x3eabb1[_0xae79('0x31')]+_0x3eabb1[_0xae79('0x30')];var _0x212db6;if(_0x419043>=_0xe2a8b8){_0x419043=_0xe2a8b8;_0x212db6=0xc8;}else{_0x212db6=0xce;}_0x2585d7[_0xae79('0x2e')](_0x212db6);return _0x2585d7[_0xae79('0x32')]('Content-Range',_0x10499b+'-'+_0x419043+'/'+_0xe2a8b8)[_0xae79('0x33')](_0x312eff);}return null;};}function patchUpdates(_0x5add49){return function(_0x4c626a){try{jsonpatch[_0xae79('0x34')](_0x4c626a,_0x5add49,!![]);}catch(_0x4f88ac){return BPromise[_0xae79('0x35')](_0x4f88ac);}return _0x4c626a['save']();};}function saveUpdates(_0x2a8620,_0x5b6ed1){return function(_0x302782){if(_0x302782){return _0x302782[_0xae79('0x36')](_0x2a8620)['then'](function(_0x2194c5){return _0x2194c5;});}return null;};}function removeEntity(_0x13007a,_0x2a45b4){return function(_0x3cb08f){if(_0x3cb08f){return _0x3cb08f[_0xae79('0x37')]()[_0xae79('0x24')](function(){var _0x2f1cd1=_0x3cb08f['get']({'plain':!![]});var _0x3941f0='OpenchannelAccounts';return db[_0xae79('0x38')][_0xae79('0x37')]({'where':{'type':_0x3941f0,'resourceId':_0x2f1cd1['id']}})[_0xae79('0x24')](function(){return _0x3cb08f;});})[_0xae79('0x24')](function(){_0x13007a[_0xae79('0x2e')](0xcc)[_0xae79('0x39')]();});}};}function handleEntityNotFound(_0x1023bd,_0x1b39f3){return function(_0x19649e){if(!_0x19649e){_0x1023bd[_0xae79('0x2d')](0x194);}return _0x19649e;};}function handleError(_0x418c2e,_0x242ab9){_0x242ab9=_0x242ab9||0x1f4;return function(_0x1f3221){logger[_0xae79('0x29')](_0x1f3221['stack']);if(_0x1f3221['name']){delete _0x1f3221[_0xae79('0x3a')];}_0x418c2e['status'](_0x242ab9)[_0xae79('0x3b')](_0x1f3221);};}exports[_0xae79('0x3c')]=function(_0x3bbd82,_0x39ff1e){var _0x4a405b={'include':[{'model':db[_0xae79('0x3d')],'as':_0xae79('0x3e')}]},_0x4590cb={},_0x2e031f={'count':0x0,'rows':[]};var _0x49ddc2=_[_0xae79('0x3f')](db['OpenchannelAccount'][_0xae79('0x40')],function(_0x13f345){return{'name':_0x13f345[_0xae79('0x41')],'type':_0x13f345['type'][_0xae79('0x42')]};});_0x4590cb[_0xae79('0x43')]=_[_0xae79('0x3f')](_0x49ddc2,_0xae79('0x3a'));_0x4590cb[_0xae79('0x44')]=_['keys'](_0x3bbd82['query']);_0x4590cb[_0xae79('0x45')]=_[_0xae79('0x46')](_0x4590cb['model'],_0x4590cb[_0xae79('0x44')]);_0x4a405b[_0xae79('0x47')]=_[_0xae79('0x46')](_0x4590cb['model'],qs['fields'](_0x3bbd82[_0xae79('0x44')]['fields']));_0x4a405b[_0xae79('0x47')]=_0x4a405b['attributes'][_0xae79('0x48')]?_0x4a405b[_0xae79('0x47')]:_0x4590cb['model'];if(!_0x3bbd82[_0xae79('0x44')][_0xae79('0x49')]('nolimit')){_0x4a405b[_0xae79('0x30')]=qs[_0xae79('0x30')](_0x3bbd82[_0xae79('0x44')][_0xae79('0x30')]);_0x4a405b[_0xae79('0x31')]=qs[_0xae79('0x31')](_0x3bbd82[_0xae79('0x44')][_0xae79('0x31')]);}_0x4a405b['order']=qs[_0xae79('0x4a')](_0x3bbd82[_0xae79('0x44')][_0xae79('0x4a')]);_0x4a405b[_0xae79('0x4b')]=qs[_0xae79('0x45')](_[_0xae79('0x4c')](_0x3bbd82[_0xae79('0x44')],_0x4590cb[_0xae79('0x45')]),_0x49ddc2);if(_0x3bbd82[_0xae79('0x44')]['filter']){_0x4a405b[_0xae79('0x4b')]=_[_0xae79('0x4d')](_0x4a405b[_0xae79('0x4b')],{'$or':_['map'](_0x49ddc2,function(_0x2155ba){if(_0x2155ba['type']!=='VIRTUAL'){var _0x1e6de6={};_0x1e6de6[_0x2155ba['name']]={'$like':'%'+_0x3bbd82[_0xae79('0x44')][_0xae79('0x4e')]+'%'};return _0x1e6de6;}})});}_0x4a405b=_[_0xae79('0x4d')]({},_0x4a405b,_0x3bbd82[_0xae79('0x4f')]);var _0x309df8={'where':_0x4a405b[_0xae79('0x4b')]};return db[_0xae79('0x50')][_0xae79('0x51')](_0x309df8)['then'](function(_0x4bfd6c){_0x2e031f[_0xae79('0x51')]=_0x4bfd6c;if(_0x3bbd82['query']['includeAll']){_0x4a405b[_0xae79('0x52')]=[{'all':!![]}];}return db[_0xae79('0x50')][_0xae79('0x53')](_0x4a405b);})[_0xae79('0x24')](function(_0x171df6){_0x2e031f[_0xae79('0x54')]=_0x171df6;return _0x2e031f;})[_0xae79('0x24')](respondWithFilteredResult(_0x39ff1e,_0x4a405b))[_0xae79('0x2c')](handleError(_0x39ff1e,null));};exports[_0xae79('0x55')]=function(_0x4d4cc3,_0x5d99e2){var _0xbea316={'raw':![],'where':{'id':_0x4d4cc3[_0xae79('0x56')]['id']},'include':[{'model':db[_0xae79('0x3d')],'as':_0xae79('0x3e')}]},_0x484a2c={};_0x484a2c[_0xae79('0x43')]=_[_0xae79('0x57')](db[_0xae79('0x50')]['rawAttributes']);_0x484a2c[_0xae79('0x44')]=_[_0xae79('0x57')](_0x4d4cc3[_0xae79('0x44')]);_0x484a2c['filters']=_[_0xae79('0x46')](_0x484a2c['model'],_0x484a2c[_0xae79('0x44')]);_0xbea316[_0xae79('0x47')]=_['intersection'](_0x484a2c[_0xae79('0x43')],qs[_0xae79('0x58')](_0x4d4cc3[_0xae79('0x44')][_0xae79('0x58')]));_0xbea316[_0xae79('0x47')]=_0xbea316[_0xae79('0x47')][_0xae79('0x48')]?_0xbea316[_0xae79('0x47')]:_0x484a2c[_0xae79('0x43')];if(_0x4d4cc3['query']['includeAll']){_0xbea316['include']=[{'all':!![]}];}_0xbea316=_[_0xae79('0x4d')]({},_0xbea316,_0x4d4cc3['options']);return db[_0xae79('0x50')][_0xae79('0x59')](_0xbea316)[_0xae79('0x24')](handleEntityNotFound(_0x5d99e2,null))[_0xae79('0x24')](respondWithResult(_0x5d99e2,null))['catch'](handleError(_0x5d99e2,null));};exports[_0xae79('0x5a')]=function(_0x146d7b,_0x165807){return db[_0xae79('0x50')][_0xae79('0x5a')](_0x146d7b[_0xae79('0x5b')],{})[_0xae79('0x24')](function(_0x2409cc){var _0x374be8=_0x146d7b[_0xae79('0x5c')][_0xae79('0x5d')]({'plain':!![]});if(!_0x374be8)throw new Error(_0xae79('0x5e'));if(_0x374be8[_0xae79('0x5f')]===_0xae79('0x5c')){var _0x432b1a=_0x2409cc[_0xae79('0x5d')]({'plain':!![]});var _0x242a39=_0xae79('0x60');return db['UserProfileSection'][_0xae79('0x59')]({'where':{'name':_0x242a39,'userProfileId':_0x374be8[_0xae79('0x61')]},'raw':!![]})[_0xae79('0x24')](function(_0x4ab165){if(_0x4ab165&&_0x4ab165[_0xae79('0x62')]===0x0){return db[_0xae79('0x38')]['create']({'name':_0x432b1a['name'],'resourceId':_0x432b1a['id'],'type':_0x4ab165[_0xae79('0x3a')],'sectionId':_0x4ab165['id']},{})[_0xae79('0x24')](function(){return _0x2409cc;});}else{return _0x2409cc;}})[_0xae79('0x2c')](function(_0x38ba72){logger['error'](_0xae79('0x63'),_0x38ba72);throw _0x38ba72;});}return _0x2409cc;})[_0xae79('0x24')](respondWithResult(_0x165807,0xc9))[_0xae79('0x2c')](handleError(_0x165807,null));};exports[_0xae79('0x36')]=function(_0xbbb534,_0x544f6d){if(_0xbbb534[_0xae79('0x5b')]['id']){delete _0xbbb534['body']['id'];}return db[_0xae79('0x50')][_0xae79('0x59')]({'where':{'id':_0xbbb534['params']['id']},'include':[{'model':db[_0xae79('0x3d')],'as':_0xae79('0x3e')}]})['then'](handleEntityNotFound(_0x544f6d,null))[_0xae79('0x24')](saveUpdates(_0xbbb534[_0xae79('0x5b')],null))[_0xae79('0x24')](respondWithResult(_0x544f6d,null))['catch'](handleError(_0x544f6d,null));};exports[_0xae79('0x37')]=function(_0x3255ad,_0x1698bc){return db[_0xae79('0x50')][_0xae79('0x59')]({'where':{'id':_0x3255ad[_0xae79('0x56')]['id']}})['then'](handleEntityNotFound(_0x1698bc,null))[_0xae79('0x24')](removeEntity(_0x1698bc,null))[_0xae79('0x2c')](handleError(_0x1698bc,null));};exports['describe']=function(_0x1e1423,_0x5e3f1e){return db[_0xae79('0x50')][_0xae79('0x64')]()['then'](respondWithResult(_0x5e3f1e,null))[_0xae79('0x2c')](handleError(_0x5e3f1e,null));};exports['addDisposition']=function(_0x300d08,_0x145a42,_0x53908e){if(_0x300d08[_0xae79('0x5b')]['id']){delete _0x300d08['body']['id'];}return db[_0xae79('0x50')]['find']({'where':{'id':_0x300d08[_0xae79('0x56')]['id']}})[_0xae79('0x24')](handleEntityNotFound(_0x145a42,null))[_0xae79('0x24')](function(_0x57ec04){if(_0x57ec04){_0x300d08['body']['OpenchannelAccountId']=_0x57ec04['id'];return db[_0xae79('0x65')][_0xae79('0x5a')](_0x300d08[_0xae79('0x5b')]);}})[_0xae79('0x24')](respondWithResult(_0x145a42,null))[_0xae79('0x2c')](handleError(_0x145a42,null));};exports[_0xae79('0x66')]=function(_0x3161ec,_0x25749d,_0x1c866e){var _0x22d9f5={'raw':![],'where':{}};var _0x3f7f26={};var _0x4fa4fa={'count':0x0,'rows':[]};return db[_0xae79('0x50')][_0xae79('0x67')]({'where':{'id':_0x3161ec[_0xae79('0x56')]['id']}})[_0xae79('0x24')](handleEntityNotFound(_0x25749d,null))[_0xae79('0x24')](function(_0x868641){if(_0x868641){_0x3f7f26[_0xae79('0x43')]=_['keys'](db[_0xae79('0x65')][_0xae79('0x40')]);_0x3f7f26[_0xae79('0x44')]=_[_0xae79('0x57')](_0x3161ec['query']);_0x3f7f26[_0xae79('0x45')]=_[_0xae79('0x46')](_0x3f7f26['model'],_0x3f7f26[_0xae79('0x44')]);_0x22d9f5['attributes']=_[_0xae79('0x46')](_0x3f7f26[_0xae79('0x43')],qs[_0xae79('0x58')](_0x3161ec[_0xae79('0x44')]['fields']));_0x22d9f5[_0xae79('0x47')]=_0x22d9f5['attributes'][_0xae79('0x48')]?_0x22d9f5[_0xae79('0x47')]:_0x3f7f26[_0xae79('0x43')];if(!_0x3161ec[_0xae79('0x44')][_0xae79('0x49')](_0xae79('0x68'))){_0x22d9f5[_0xae79('0x30')]=qs[_0xae79('0x30')](_0x3161ec[_0xae79('0x44')][_0xae79('0x30')]);_0x22d9f5[_0xae79('0x31')]=qs[_0xae79('0x31')](_0x3161ec['query'][_0xae79('0x31')]);}_0x22d9f5[_0xae79('0x69')]=qs[_0xae79('0x4a')](_0x3161ec[_0xae79('0x44')][_0xae79('0x4a')]);_0x22d9f5[_0xae79('0x4b')]=qs['filters'](_[_0xae79('0x4c')](_0x3161ec[_0xae79('0x44')],_0x3f7f26['filters']));_0x22d9f5[_0xae79('0x4b')]['OpenchannelAccountId']=_0x868641['id'];if(_0x3161ec[_0xae79('0x44')][_0xae79('0x4e')]){_0x22d9f5[_0xae79('0x4b')]=_[_0xae79('0x4d')](_0x22d9f5[_0xae79('0x4b')],{'$or':_[_0xae79('0x3f')](_0x22d9f5['attributes'],function(_0x35b6f2){var _0x244c13={};_0x244c13[_0x35b6f2]={'$like':'%'+_0x3161ec[_0xae79('0x44')]['filter']+'%'};return _0x244c13;})});}_0x22d9f5=_[_0xae79('0x4d')]({},_0x22d9f5,_0x3161ec[_0xae79('0x4f')]);return db[_0xae79('0x65')]['count']({'where':_0x22d9f5[_0xae79('0x4b')]})[_0xae79('0x24')](function(_0x14b66b){_0x4fa4fa[_0xae79('0x51')]=_0x14b66b;if(_0x3161ec[_0xae79('0x44')][_0xae79('0x6a')]){_0x22d9f5[_0xae79('0x52')]=[{'all':!![]}];}return db[_0xae79('0x65')][_0xae79('0x53')](_0x22d9f5);})['then'](function(_0x31e23d){_0x4fa4fa['rows']=_0x31e23d;return _0x4fa4fa;});}})[_0xae79('0x24')](respondWithFilteredResult(_0x25749d,_0x22d9f5))['catch'](handleError(_0x25749d,null));};exports['removeDispositions']=function(_0x4a796a,_0x32e15c,_0x53cac3){return db[_0xae79('0x50')][_0xae79('0x59')]({'where':{'id':_0x4a796a[_0xae79('0x56')]['id']}})[_0xae79('0x24')](handleEntityNotFound(_0x32e15c,null))[_0xae79('0x24')](function(_0x4d67d0){if(_0x4d67d0){return _0x4d67d0[_0xae79('0x6b')](_0x4a796a[_0xae79('0x44')][_0xae79('0x6c')]);}})[_0xae79('0x24')](respondWithStatusCode(_0x32e15c,null))['catch'](handleError(_0x32e15c,null));};exports[_0xae79('0x6d')]=function(_0xcecb78,_0x3765bc,_0x3df79b){if(_0xcecb78[_0xae79('0x5b')]['id']){delete _0xcecb78[_0xae79('0x5b')]['id'];}return db['OpenchannelAccount'][_0xae79('0x59')]({'where':{'id':_0xcecb78[_0xae79('0x56')]['id']}})[_0xae79('0x24')](handleEntityNotFound(_0x3765bc,null))['then'](function(_0x4a216f){if(_0x4a216f){_0xcecb78[_0xae79('0x5b')][_0xae79('0x6e')]=_0x4a216f['id'];return db[_0xae79('0x6f')][_0xae79('0x5a')](_0xcecb78[_0xae79('0x5b')]);}})[_0xae79('0x24')](respondWithResult(_0x3765bc,null))['catch'](handleError(_0x3765bc,null));};exports['getAnswers']=function(_0x21589b,_0x38ca9f,_0x5bf030){var _0x1951d4={'raw':![],'where':{}};var _0x4db35b={};var _0x33cb3c={'count':0x0,'rows':[]};return db[_0xae79('0x50')][_0xae79('0x67')]({'where':{'id':_0x21589b['params']['id']}})[_0xae79('0x24')](handleEntityNotFound(_0x38ca9f,null))[_0xae79('0x24')](function(_0x3bb7dc){if(_0x3bb7dc){_0x4db35b[_0xae79('0x43')]=_[_0xae79('0x57')](db['CannedAnswer'][_0xae79('0x40')]);_0x4db35b[_0xae79('0x44')]=_[_0xae79('0x57')](_0x21589b['query']);_0x4db35b[_0xae79('0x45')]=_[_0xae79('0x46')](_0x4db35b[_0xae79('0x43')],_0x4db35b[_0xae79('0x44')]);_0x1951d4[_0xae79('0x47')]=_[_0xae79('0x46')](_0x4db35b[_0xae79('0x43')],qs['fields'](_0x21589b[_0xae79('0x44')][_0xae79('0x58')]));_0x1951d4[_0xae79('0x47')]=_0x1951d4['attributes'][_0xae79('0x48')]?_0x1951d4[_0xae79('0x47')]:_0x4db35b['model'];if(!_0x21589b[_0xae79('0x44')][_0xae79('0x49')](_0xae79('0x68'))){_0x1951d4[_0xae79('0x30')]=qs[_0xae79('0x30')](_0x21589b[_0xae79('0x44')][_0xae79('0x30')]);_0x1951d4['offset']=qs[_0xae79('0x31')](_0x21589b[_0xae79('0x44')][_0xae79('0x31')]);}_0x1951d4[_0xae79('0x69')]=qs['sort'](_0x21589b['query'][_0xae79('0x4a')]);_0x1951d4[_0xae79('0x4b')]=qs[_0xae79('0x45')](_[_0xae79('0x4c')](_0x21589b[_0xae79('0x44')],_0x4db35b[_0xae79('0x45')]));_0x1951d4[_0xae79('0x4b')]['OpenchannelAccountId']=_0x3bb7dc['id'];if(_0x21589b[_0xae79('0x44')][_0xae79('0x4e')]){_0x1951d4[_0xae79('0x4b')]=_[_0xae79('0x4d')](_0x1951d4[_0xae79('0x4b')],{'$or':_[_0xae79('0x3f')](_0x1951d4[_0xae79('0x47')],function(_0xea8643){var _0x1acf74={};_0x1acf74[_0xea8643]={'$like':'%'+_0x21589b['query'][_0xae79('0x4e')]+'%'};return _0x1acf74;})});}_0x1951d4=_['merge']({},_0x1951d4,_0x21589b['options']);return db[_0xae79('0x6f')]['count']({'where':_0x1951d4[_0xae79('0x4b')]})['then'](function(_0xeaf218){_0x33cb3c[_0xae79('0x51')]=_0xeaf218;if(_0x21589b[_0xae79('0x44')][_0xae79('0x6a')]){_0x1951d4[_0xae79('0x52')]=[{'all':!![]}];}return db[_0xae79('0x6f')][_0xae79('0x53')](_0x1951d4);})['then'](function(_0xc0083e){_0x33cb3c[_0xae79('0x54')]=_0xc0083e;return _0x33cb3c;});}})['then'](respondWithFilteredResult(_0x38ca9f,_0x1951d4))['catch'](handleError(_0x38ca9f,null));};exports['removeAnswers']=function(_0x515380,_0x50260a,_0x2b3ee7){return db[_0xae79('0x50')][_0xae79('0x59')]({'where':{'id':_0x515380['params']['id']}})[_0xae79('0x24')](handleEntityNotFound(_0x50260a,null))[_0xae79('0x24')](function(_0x3ba0b4){if(_0x3ba0b4){return _0x3ba0b4['removeAnswers'](_0x515380[_0xae79('0x44')]['ids']);}})[_0xae79('0x24')](respondWithStatusCode(_0x50260a,null))[_0xae79('0x2c')](handleError(_0x50260a,null));};exports[_0xae79('0x70')]=function(_0xec698d,_0x1b3ef9,_0x51cb2c){var _0x29d68a={'body':_0xec698d[_0xae79('0x5b')],'channel':_0xae79('0x71')};var _0x54aef9=[];var _0x11f144=[];var _0x39d150={};var _0x39ecef=![];return db['CmContact']['describe']()['then'](function(_0x4f0386){if(!_0x4f0386){throw new db['Sequelize'][(_0xae79('0x72'))](_0xae79('0x73'));}_0x54aef9=_['difference'](_[_0xae79('0x57')](_0x4f0386),[_0xae79('0x74'),'updatedAt']);_0x11f144=_[_0xae79('0x75')](_[_0xae79('0x57')](_0x4f0386),[_0xae79('0x74'),_0xae79('0x76'),_0xae79('0x77'),_0xae79('0x78')]);if(_0xec698d[_0xae79('0x5b')]['id']){delete _0xec698d[_0xae79('0x5b')]['id'];}if(_[_0xae79('0x79')](_0xec698d[_0xae79('0x5b')][_0xae79('0x7a')])){throw new db[(_0xae79('0x7b'))][(_0xae79('0x72'))](_0xae79('0x7c'));}if(_[_0xae79('0x79')](_0xec698d[_0xae79('0x5b')][_0xae79('0x5b')])||_0xec698d[_0xae79('0x5b')][_0xae79('0x5b')]===''){throw new db[(_0xae79('0x7b'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xae79('0x79')](_0xec698d[_0xae79('0x5b')][_0xae79('0x7d')])){throw new db[(_0xae79('0x7b'))][(_0xae79('0x72'))](_0xae79('0x7e')+_0x11f144);}if(!_[_0xae79('0x7f')](_0x11f144,_0xec698d[_0xae79('0x5b')][_0xae79('0x7d')])){throw new db[(_0xae79('0x7b'))]['ValidationError'](_0xae79('0x80')+_0x11f144);}_0x39d150[_0xec698d['body'][_0xae79('0x7d')]]=_0xec698d[_0xae79('0x5b')][_0xae79('0x7a')];})[_0xae79('0x24')](function(){return db[_0xae79('0x50')][_0xae79('0x59')]({'where':{'id':_0xec698d[_0xae79('0x56')]['id']},'include':[{'model':db[_0xae79('0x81')],'as':_0xae79('0x82'),'include':[{'model':db[_0xae79('0x83')],'as':_0xae79('0x84'),'where':_0x39d150,'limit':0x1,'order':[[_0xae79('0x76'),_0xae79('0x85')]]}]},{'model':db['OpenchannelApplication'],'as':_0xae79('0x86')}]});})[_0xae79('0x24')](handleEntityNotFound(_0x1b3ef9,null))[_0xae79('0x24')](function(_0x19c3a7){if(_0x19c3a7&&_0x19c3a7['List']){_0x29d68a[_0xae79('0x87')]=_0x19c3a7;_0x29d68a[_0xae79('0x88')]=_0x19c3a7[_0xae79('0x86')];_0x29d68a[_0xae79('0x89')]=_0x19c3a7['List'];_0x29d68a[_0xae79('0x88')]=_['orderBy'](_0x29d68a['applications'],[_0xae79('0x8a')],[_0xae79('0x8b')]);if(_0x29d68a[_0xae79('0x87')][_0xae79('0x86')]){delete _0x29d68a[_0xae79('0x87')]['Applications'];}if(_0x29d68a['account']['List']&&_0x29d68a[_0xae79('0x87')][_0xae79('0x82')][_0xae79('0x84')][_0xae79('0x48')]){return _0x29d68a[_0xae79('0x87')][_0xae79('0x82')]['Contacts'][0x0];}var _0x2bb0a8=_[_0xae79('0x1d')](_0xec698d[_0xae79('0x5b')],{'firstName':_0xec698d['body'][_0xae79('0x7a')],'ListId':_0x19c3a7[_0xae79('0x78')]});_0x2bb0a8[_0xec698d['body']['mapKey']]=_0xec698d['body'][_0xae79('0x7a')];return db['CmContact'][_0xae79('0x5a')](_0x2bb0a8,{'fields':_0x54aef9,'raw':!![]});}})['then'](handleEntityNotFound(_0x1b3ef9,null))[_0xae79('0x24')](function(_0x4d2404){_0x29d68a[_0xae79('0x8c')]=_0x4d2404;if(_0x4d2404){var _0x240c96={'ContactId':_0x4d2404['id'],'OpenchannelAccountId':_0xec698d[_0xae79('0x56')]['id'],'from':(_0x4d2404[_0xae79('0x8d')]||'')+'\x20'+(_0x4d2404['lastName']||'')};var _0x186e9c={'OpenchannelAccountId':_0xec698d['params']['id'],'closed':![]};if(_0xec698d[_0xae79('0x5b')][_0xae79('0x8e')]){_0x186e9c[_0xae79('0x8e')]=_0xec698d['body'][_0xae79('0x8e')];return db[_0xae79('0x8f')]['find']({'where':_0x186e9c})[_0xae79('0x24')](function(_0x4dec25){if(_0x4dec25){return[_0x4dec25,![]];}_0x240c96[_0xae79('0x8e')]=_0xec698d[_0xae79('0x5b')][_0xae79('0x8e')];_0x240c96[_0xae79('0x90')]=_0xec698d[_0xae79('0x5b')]['externalUrl'];return db[_0xae79('0x8f')][_0xae79('0x5a')](_0x240c96)[_0xae79('0x24')](function(_0x1ec655){return[_0x1ec655,!![]];});});}else{_0x186e9c['threadId']=null;}_0x186e9c[_0xae79('0x91')]=_0x4d2404['id'];return db[_0xae79('0x8f')][_0xae79('0x59')]({'where':_0x186e9c})['then'](function(_0x369eeb){if(_0x369eeb){return[_0x369eeb,![]];}return db[_0xae79('0x8f')][_0xae79('0x5a')](_0x240c96)[_0xae79('0x24')](function(_0xc91dca){return[_0xc91dca,!![]];});});}})['spread'](function(_0x192921,_0x5617e1){if(_0x192921){_0x39ecef=_0x5617e1;if(!_0x5617e1){var _0x294850={'from':(_0x29d68a[_0xae79('0x8c')][_0xae79('0x8d')]||'')+'\x20'+(_0x29d68a[_0xae79('0x8c')][_0xae79('0x92')]||'')};if(_0xec698d[_0xae79('0x5b')][_0xae79('0x8e')]&&_0xec698d[_0xae79('0x5b')]['messageId']&&_0xec698d[_0xae79('0x5b')][_0xae79('0x8e')]!=_0xec698d[_0xae79('0x5b')][_0xae79('0x93')]){_0x294850[_0xae79('0x8e')]=_0xec698d[_0xae79('0x5b')][_0xae79('0x93')];}return _0x192921[_0xae79('0x36')](_0x294850);}else{return _0x192921;}}})[_0xae79('0x24')](function(_0x535202){_0x29d68a[_0xae79('0x94')]=_0x535202['get']({'plain':!![]});_0x29d68a['interaction'][_0xae79('0x95')]=_0x39ecef;if(_0x29d68a[_0xae79('0x94')]['created']){if(_0x29d68a[_0xae79('0x87')]['autoclose']){_0x29d68a['applications'][_0xae79('0x96')]({'id':0x0,'priority':_0x29d68a['applications'][_0xae79('0x48')]+0x1,'app':_0xae79('0x97'),'appdata':_0xae79('0x98'),'interval':_0xae79('0x99')});}}return db[_0xae79('0x9a')][_0xae79('0x5a')]({'body':_0xec698d[_0xae79('0x5b')][_0xae79('0x5b')],'OpenchannelAccountId':_0xec698d[_0xae79('0x56')]['id'],'OpenchannelInteractionId':_0x535202['id'],'direction':'in','ContactId':_0x29d68a[_0xae79('0x8c')]['id'],'AttachmentId':_0xec698d[_0xae79('0x5b')][_0xae79('0x9b')]});})[_0xae79('0x24')](function(_0x2d4401){_0x29d68a[_0xae79('0x2a')]=_0x2d4401;if(_0x29d68a[_0xae79('0x94')][_0xae79('0x9c')]){return db[_0xae79('0x9d')][_0xae79('0x59')]({'attributes':['id',_0xae79('0x3a')],'where':{'id':_0x29d68a[_0xae79('0x94')]['UserId']}})[_0xae79('0x24')](function(_0x1529b2){if(_0x1529b2){_0x29d68a['applications'][_0xae79('0x9e')]({'id':0x0,'priority':0x0,'app':_0xae79('0x9f'),'appdata':_0x1529b2[_0xae79('0x3a')]+','+(_0x29d68a['account'][_0xae79('0xa0')]||0xa),'interval':_0xae79('0x99')});_0x29d68a[_0xae79('0xa1')]=![];}return respondWithRpcPromise(_0xae79('0xa2'),_0xae79('0xa3'),_0x29d68a);});}return respondWithRpcPromise(_0xae79('0xa2'),_0xae79('0xa3'),_0x29d68a);})[_0xae79('0x24')](function(_0x3767cf){respondWithRpcPromise(_0xae79('0xa4'),'EventManager',{'event':'notify','message':_0x3767cf},client9002);return _0x3767cf;})[_0xae79('0x24')](respondWithResult(_0x1b3ef9,null))[_0xae79('0x2c')](handleError(_0x1b3ef9,null));};exports['addApplications']=function(_0x5cb2e3,_0x50b1a7,_0xa0ff90){return db[_0xae79('0x50')][_0xae79('0x67')]({'where':{'id':_0x5cb2e3[_0xae79('0x56')]['id']}})[_0xae79('0x24')](handleEntityNotFound(_0x50b1a7,null))[_0xae79('0x24')](function(_0x3ae1bd){if(_0x3ae1bd){return db['sequelize'][_0xae79('0xa5')](function(_0x16f162){return db[_0xae79('0xa6')][_0xae79('0x37')]({'where':{'OpenchannelAccountId':_0x5cb2e3[_0xae79('0x56')]['id']},'transaction':_0x16f162})[_0xae79('0x24')](function(_0x453f5d){var _0xd4c84e=_[_0xae79('0x3f')](_0x5cb2e3[_0xae79('0x5b')],function(_0x4415f6){_0x4415f6['OpenchannelAccountId']=_0x5cb2e3[_0xae79('0x56')]['id'];return _0x4415f6;});return db[_0xae79('0xa6')][_0xae79('0xa7')](_0xd4c84e,{'transaction':_0x16f162});});})[_0xae79('0x24')](function(){return db[_0xae79('0xa6')][_0xae79('0xa8')]({'where':{'OpenchannelAccountId':_0x5cb2e3[_0xae79('0x56')]['id']},'order':_0xae79('0x8a')});});}})[_0xae79('0x24')](respondWithResult(_0x50b1a7,null))[_0xae79('0x2c')](handleError(_0x50b1a7,null));};exports['getApplications']=function(_0x36b902,_0xb9ba6d,_0x305bf7){var _0x55976c={};var _0x47c27a={};var _0x514ee7;var _0x56ce19;return db[_0xae79('0x50')][_0xae79('0x67')]({'where':{'id':_0x36b902[_0xae79('0x56')]['id']}})[_0xae79('0x24')](handleEntityNotFound(_0xb9ba6d,null))[_0xae79('0x24')](function(_0x1c2c65){if(_0x1c2c65){_0x514ee7=_0x1c2c65;_0x47c27a[_0xae79('0x43')]=_[_0xae79('0x57')](db[_0xae79('0xa6')][_0xae79('0x40')]);_0x47c27a[_0xae79('0x44')]=_[_0xae79('0x57')](_0x36b902[_0xae79('0x44')]);_0x47c27a['filters']=_[_0xae79('0x46')](_0x47c27a[_0xae79('0x43')],_0x47c27a['query']);_0x55976c[_0xae79('0x47')]=_[_0xae79('0x46')](_0x47c27a['model'],qs['fields'](_0x36b902['query']['fields']));_0x55976c[_0xae79('0x47')]=_0x55976c['attributes'][_0xae79('0x48')]?_0x55976c[_0xae79('0x47')]:_0x47c27a[_0xae79('0x43')];_0x55976c['order']=qs[_0xae79('0x4a')](_0x36b902[_0xae79('0x44')][_0xae79('0x4a')]);_0x55976c[_0xae79('0x4b')]=qs[_0xae79('0x45')](_[_0xae79('0x4c')](_0x36b902[_0xae79('0x44')],_0x47c27a[_0xae79('0x45')]));if(_0x36b902['query'][_0xae79('0x4e')]){_0x55976c[_0xae79('0x4b')]=_[_0xae79('0x4d')](_0x55976c[_0xae79('0x4b')],{'$or':_[_0xae79('0x3f')](_0x55976c[_0xae79('0x47')],function(_0x1c2781){var _0x336d0a={};_0x336d0a[_0x1c2781]={'$like':'%'+_0x36b902[_0xae79('0x44')][_0xae79('0x4e')]+'%'};return _0x336d0a;})});}_0x55976c=_[_0xae79('0x4d')]({},_0x55976c,_0x36b902[_0xae79('0x4f')]);return _0x514ee7[_0xae79('0xa9')](_0x55976c);}})['then'](function(_0x126c9c){if(_0x126c9c){_0x56ce19=_0x126c9c[_0xae79('0x48')];if(!_0x36b902[_0xae79('0x44')]['hasOwnProperty'](_0xae79('0x68'))){_0x55976c['limit']=qs[_0xae79('0x30')](_0x36b902[_0xae79('0x44')][_0xae79('0x30')]);_0x55976c[_0xae79('0x31')]=qs[_0xae79('0x31')](_0x36b902[_0xae79('0x44')][_0xae79('0x31')]);}return _0x514ee7['getApplications'](_0x55976c);}})[_0xae79('0x24')](function(_0xd83627){if(_0xd83627){return _0xd83627?{'count':_0x56ce19,'rows':_0xd83627}:null;}})['then'](respondWithResult(_0xb9ba6d,null))[_0xae79('0x2c')](handleError(_0xb9ba6d,null));};exports['getInteractions']=function(_0x8b9a34,_0x4fe961,_0x2d4068){var _0x365dd5={'raw':![],'where':{}};var _0x1d4e46={};var _0x4cc290={'count':0x0,'rows':[]};return db[_0xae79('0x50')]['findOne']({'where':{'id':_0x8b9a34[_0xae79('0x56')]['id']}})[_0xae79('0x24')](handleEntityNotFound(_0x4fe961,null))[_0xae79('0x24')](function(_0xb5d5ce){if(_0xb5d5ce){_0x1d4e46[_0xae79('0x43')]=_[_0xae79('0x57')](db['OpenchannelInteraction'][_0xae79('0x40')]);_0x1d4e46[_0xae79('0x44')]=_[_0xae79('0x57')](_0x8b9a34[_0xae79('0x44')]);_0x1d4e46[_0xae79('0x45')]=_[_0xae79('0x46')](_0x1d4e46[_0xae79('0x43')],_0x1d4e46[_0xae79('0x44')]);_0x365dd5['attributes']=_[_0xae79('0x46')](_0x1d4e46[_0xae79('0x43')],qs[_0xae79('0x58')](_0x8b9a34['query'][_0xae79('0x58')]));_0x365dd5[_0xae79('0x47')]=_0x365dd5[_0xae79('0x47')][_0xae79('0x48')]?_0x365dd5['attributes']:_0x1d4e46[_0xae79('0x43')];if(!_0x8b9a34['query']['hasOwnProperty'](_0xae79('0x68'))){_0x365dd5[_0xae79('0x30')]=qs[_0xae79('0x30')](_0x8b9a34[_0xae79('0x44')]['limit']);_0x365dd5[_0xae79('0x31')]=qs['offset'](_0x8b9a34[_0xae79('0x44')]['offset']);}_0x365dd5[_0xae79('0x69')]=qs[_0xae79('0x4a')](_0x8b9a34[_0xae79('0x44')][_0xae79('0x4a')]);_0x365dd5['where']=qs['filters'](_[_0xae79('0x4c')](_0x8b9a34[_0xae79('0x44')],_0x1d4e46['filters']));_0x365dd5[_0xae79('0x4b')]['OpenchannelAccountId']=_0xb5d5ce['id'];if(_0x8b9a34[_0xae79('0x44')][_0xae79('0x4e')]){_0x365dd5[_0xae79('0x4b')]=_['merge'](_0x365dd5[_0xae79('0x4b')],{'$or':_[_0xae79('0x3f')](_0x365dd5[_0xae79('0x47')],function(_0x346372){var _0x4e1131={};_0x4e1131[_0x346372]={'$like':'%'+_0x8b9a34[_0xae79('0x44')]['filter']+'%'};return _0x4e1131;})});}_0x365dd5=_[_0xae79('0x4d')]({},_0x365dd5,_0x8b9a34['options']);return db[_0xae79('0x8f')][_0xae79('0x51')]({'where':_0x365dd5['where']})[_0xae79('0x24')](function(_0x11a7f1){_0x4cc290['count']=_0x11a7f1;if(_0x8b9a34[_0xae79('0x44')][_0xae79('0x6a')]){_0x365dd5['include']=[{'model':db['CmContact'],'as':_0xae79('0xaa'),'required':![]},{'model':db[_0xae79('0x9d')],'as':_0xae79('0xab'),'attributes':[_0xae79('0x3a'),_0xae79('0xac'),'internal'],'required':![]},{'model':db[_0xae79('0xad')],'as':_0xae79('0xae'),'attributes':['id',_0xae79('0x3a'),'color'],'where':_0x8b9a34['query']['tag']?{'id':_0x8b9a34[_0xae79('0x44')][_0xae79('0xaf')]}:undefined,'required':_0x8b9a34['query'][_0xae79('0xaf')]?!![]:![]}];}return db[_0xae79('0x8f')]['findAll'](_0x365dd5);})['then'](function(_0x2e10ca){_0x4cc290[_0xae79('0x54')]=_0x2e10ca;return _0x4cc290;});}})[_0xae79('0x24')](respondWithFilteredResult(_0x4fe961,_0x365dd5))[_0xae79('0x2c')](handleError(_0x4fe961,null));};exports[_0xae79('0xb0')]=function(_0x1d803a,_0x4e8689,_0x4a4e43){return db['OpenchannelAccount'][_0xae79('0x59')]({'where':{'id':_0x1d803a[_0xae79('0x56')]['id']}})[_0xae79('0x24')](handleEntityNotFound(_0x4e8689,null))[_0xae79('0x24')](function(_0x2e51ee){if(_0x2e51ee){return _0x2e51ee['addAgents'](_0x1d803a[_0xae79('0x5b')][_0xae79('0x6c')],_[_0xae79('0xb1')](_0x1d803a[_0xae79('0x5b')],[_0xae79('0x6c'),'id'])||{})[_0xae79('0xb2')](function(_0xbef256){for(var _0x9b1ee=0x0;_0x9b1ee<_0x1d803a[_0xae79('0x5b')][_0xae79('0x6c')][_0xae79('0x48')];_0x9b1ee+=0x1){socket[_0xae79('0xb3')](_0xae79('0xb4'),{'UserId':Number(_0x1d803a[_0xae79('0x5b')]['ids'][_0x9b1ee]),'OpenchannelAccountId':Number(_0x1d803a[_0xae79('0x56')]['id'])});}return _0xbef256;});}})['then'](respondWithResult(_0x4e8689,null))['catch'](handleError(_0x4e8689,null));};exports[_0xae79('0xb5')]=function(_0xe49647,_0x4d8c55,_0x172f78){return db[_0xae79('0x50')][_0xae79('0x59')]({'where':{'id':_0xe49647['params']['id']}})['then'](handleEntityNotFound(_0x4d8c55,null))['then'](function(_0x441492){if(_0x441492){return _0x441492[_0xae79('0xb5')](_0xe49647[_0xae79('0x44')][_0xae79('0x6c')])[_0xae79('0x24')](function(){if(_[_0xae79('0xb6')](_0xe49647[_0xae79('0x44')]['ids'])){for(var _0x2bb823=0x0;_0x2bb823<_0xe49647[_0xae79('0x44')]['ids'][_0xae79('0x48')];_0x2bb823+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0xe49647[_0xae79('0x44')][_0xae79('0x6c')][_0x2bb823]),'OpenchannelAccountId':Number(_0xe49647[_0xae79('0x56')]['id'])});}}else{socket[_0xae79('0xb3')](_0xae79('0xb7'),{'UserId':Number(_0xe49647['query'][_0xae79('0x6c')]),'OpenchannelAccountId':Number(_0xe49647[_0xae79('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x4d8c55,null))[_0xae79('0x2c')](handleError(_0x4d8c55,null));};exports[_0xae79('0xb8')]=function(_0x49dd8d,_0x11260f,_0x1eedc7){var _0x52625a={};var _0x2f316b={};var _0x1a5e4e;var _0x353e51;return db[_0xae79('0x50')]['findOne']({'where':{'id':_0x49dd8d['params']['id']}})['then'](handleEntityNotFound(_0x11260f,null))[_0xae79('0x24')](function(_0x10cdd2){if(_0x10cdd2){_0x1a5e4e=_0x10cdd2;_0x2f316b['model']=_[_0xae79('0x57')](db[_0xae79('0x9d')][_0xae79('0x40')]);_0x2f316b[_0xae79('0x44')]=_[_0xae79('0x57')](_0x49dd8d[_0xae79('0x44')]);_0x2f316b['filters']=_[_0xae79('0x46')](_0x2f316b[_0xae79('0x43')],_0x2f316b[_0xae79('0x44')]);_0x52625a['attributes']=_['intersection'](_0x2f316b[_0xae79('0x43')],qs[_0xae79('0x58')](_0x49dd8d['query']['fields']));_0x52625a[_0xae79('0x47')]=_0x52625a[_0xae79('0x47')][_0xae79('0x48')]?_0x52625a[_0xae79('0x47')]:_0x2f316b[_0xae79('0x43')];_0x52625a[_0xae79('0x69')]=qs[_0xae79('0x4a')](_0x49dd8d[_0xae79('0x44')][_0xae79('0x4a')]);_0x52625a[_0xae79('0x4b')]=qs[_0xae79('0x45')](_['pick'](_0x49dd8d[_0xae79('0x44')],_0x2f316b[_0xae79('0x45')]));if(_0x49dd8d['query'][_0xae79('0x4e')]){_0x52625a[_0xae79('0x4b')]=_['merge'](_0x52625a['where'],{'$or':_['map'](_0x52625a[_0xae79('0x47')],function(_0x502fc4){var _0x40986c={};_0x40986c[_0x502fc4]={'$like':'%'+_0x49dd8d[_0xae79('0x44')][_0xae79('0x4e')]+'%'};return _0x40986c;})});}_0x52625a=_[_0xae79('0x4d')]({},_0x52625a,_0x49dd8d[_0xae79('0x4f')]);return _0x1a5e4e[_0xae79('0xb8')](_0x52625a);}})[_0xae79('0x24')](function(_0x454809){if(_0x454809){_0x353e51=_0x454809[_0xae79('0x48')];if(!_0x49dd8d[_0xae79('0x44')][_0xae79('0x49')](_0xae79('0x68'))){_0x52625a[_0xae79('0x30')]=qs[_0xae79('0x30')](_0x49dd8d[_0xae79('0x44')][_0xae79('0x30')]);_0x52625a[_0xae79('0x31')]=qs[_0xae79('0x31')](_0x49dd8d[_0xae79('0x44')][_0xae79('0x31')]);}return _0x1a5e4e[_0xae79('0xb8')](_0x52625a);}})[_0xae79('0x24')](function(_0x3b34b4){if(_0x3b34b4){return _0x3b34b4?{'count':_0x353e51,'rows':_0x3b34b4}:null;}})[_0xae79('0x24')](respondWithResult(_0x11260f,null))[_0xae79('0x2c')](handleError(_0x11260f,null));};exports[_0xae79('0x3b')]=function(_0x1dc02f,_0x2d4d25,_0x1390e7){var _0x390eb5,_0x159e14,_0x1d37ef;if(_['isNil'](_0x1dc02f[_0xae79('0x5b')][_0xae79('0x5b')])||_0x1dc02f[_0xae79('0x5b')][_0xae79('0x5b')]===''){throw new db['Sequelize'][(_0xae79('0x72'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x1dc02f[_0xae79('0x5b')]['to'])){}_0x390eb5=_0x1dc02f[_0xae79('0x5b')]['to'];return db[_0xae79('0x50')][_0xae79('0x67')]({'where':{'id':_0x1dc02f['params']['id']}})[_0xae79('0x24')](handleEntityNotFound(_0x2d4d25,null))['then'](function(_0x2173d1){if(_0x2173d1){return db[_0xae79('0x50')][_0xae79('0x59')]({'where':{'id':_0x2173d1['id']},'include':[{'model':db[_0xae79('0x81')],'as':_0xae79('0x82'),'include':[{'model':db[_0xae79('0x83')],'as':_0xae79('0x84'),'where':{[_0x2173d1['mapKey']]:_0x390eb5},'limit':0x1,'order':[[_0xae79('0x76'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x2d4d25,null))[_0xae79('0x24')](function(_0x4e6cd8){if(_0x4e6cd8&&_0x4e6cd8[_0xae79('0x82')]){_0x159e14=_0x4e6cd8['get']({'plain':!![]});if(_0x159e14[_0xae79('0x82')]&&_0x159e14[_0xae79('0x82')]['Contacts'][_0xae79('0x48')]){return _0x159e14[_0xae79('0x82')][_0xae79('0x84')][0x0];}return db[_0xae79('0x83')][_0xae79('0x5a')](_[_0xae79('0x1d')](_0x1dc02f[_0xae79('0x5b')],{'firstName':_0x390eb5,[_0x4e6cd8[_0xae79('0x7d')]]:_0x390eb5,'phone':_0x390eb5,'ListId':_0x159e14[_0xae79('0x78')]}));}})[_0xae79('0x24')](handleEntityNotFound(_0x2d4d25,null))[_0xae79('0x24')](function(_0x3045ac){if(_0x3045ac){_0x1d37ef=_0x3045ac;return db[_0xae79('0x8f')]['find']({'where':{'ContactId':_0x1d37ef['id'],'closed':![],'OpenchannelAccountId':_0x159e14['id']}})[_0xae79('0x24')](function(_0x32264b){if(_0x32264b){return[_0x32264b,![]];}return db[_0xae79('0x8f')][_0xae79('0x5a')]({'UserId':_0x1dc02f[_0xae79('0x5c')]['id'],'ContactId':_0x1d37ef['id'],'OpenchannelAccountId':_0x159e14['id'],'lastMsgDirection':'out','Messages':[_[_0xae79('0x4d')](_0x1dc02f[_0xae79('0x5b')],{'read':![],'body':_0x1dc02f[_0xae79('0x5b')][_0xae79('0x5b')],'OpenchannelAccountId':_0x159e14['id'],'UserId':_0x1dc02f[_0xae79('0x5c')]['id'],'ContactId':_0x1d37ef['id']})]},{'include':[{'model':db[_0xae79('0x9a')],'as':_0xae79('0xb9')}]})[_0xae79('0x24')](function(_0x42ebce){return[_0x42ebce,!![]];});});}})[_0xae79('0xb2')](function(_0x31ddf5,_0x1d9604){if(_0x1d9604){return _0x31ddf5;}return db['OpenchannelMessage']['create'](_['merge'](_0x1dc02f['body'],{'read':![],'body':_0x1dc02f[_0xae79('0x5b')][_0xae79('0x5b')],'OpenchannelAccountId':_0x159e14['id'],'OpenchannelInteractionId':_0x31ddf5['id'],'UserId':_0x1dc02f['user']['id'],'ContactId':_0x1d37ef['id']}))['then'](function(_0x21b1f3){_0x31ddf5[_0xae79('0xba')]['Messages']=[];_0x31ddf5[_0xae79('0xba')][_0xae79('0xb9')][_0xae79('0x96')](_0x21b1f3['dataValues']);return _0x31ddf5;});});}})[_0xae79('0x24')](respondWithResult(_0x2d4d25,null))[_0xae79('0x2c')](handleError(_0x2d4d25,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 5b639b8..68d68a7 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 _0xda3f=['exports','../../mysqldb','OpenchannelAccount','remove','emit'];(function(_0x57add2,_0x4f2b7d){var _0x4e3670=function(_0x3311b){while(--_0x3311b){_0x57add2['push'](_0x57add2['shift']());}};_0x4e3670(++_0x4f2b7d);}(_0xda3f,0xec));var _0xfda3=function(_0x4c1e48,_0x4c67e5){_0x4c1e48=_0x4c1e48-0x0;var _0x4385de=_0xda3f[_0x4c1e48];return _0x4385de;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xfda3('0x0'))['db'][_0xfda3('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xfda3('0x2')};function emitEvent(_0x581693){return function(_0x36dc71,_0x22187d,_0x516500){OpenchannelAccountEvents[_0xfda3('0x3')](_0x581693+':'+_0x36dc71['id'],_0x36dc71);OpenchannelAccountEvents[_0xfda3('0x3')](_0x581693,_0x36dc71);_0x516500(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0xfda3('0x4')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xe706=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','save','update','remove','emit'];(function(_0x4aef84,_0x1c79a2){var _0x8061a4=function(_0x47f6e5){while(--_0x47f6e5){_0x4aef84['push'](_0x4aef84['shift']());}};_0x8061a4(++_0x1c79a2);}(_0xe706,0xa3));var _0x6e70=function(_0x561197,_0x2d7d64){_0x561197=_0x561197-0x0;var _0x191270=_0xe706[_0x561197];return _0x191270;};'use strict';var EventEmitter=require(_0x6e70('0x0'));var OpenchannelAccount=require(_0x6e70('0x1'))['db'][_0x6e70('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6e70('0x3'),'afterUpdate':_0x6e70('0x4'),'afterDestroy':_0x6e70('0x5')};function emitEvent(_0x7dfbc3){return function(_0x142c27,_0x2164a4,_0x376a8d){OpenchannelAccountEvents[_0x6e70('0x6')](_0x7dfbc3+':'+_0x142c27['id'],_0x142c27);OpenchannelAccountEvents[_0x6e70('0x6')](_0x7dfbc3,_0x142c27);_0x376a8d(null);};}for(var e in events){if(events[_0x6e70('0x7')](e)){var event=events[e];OpenchannelAccount[_0x6e70('0x8')](e,emitEvent(event));}}module[_0x6e70('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 84e161e..f4798ef 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(_0x4ac87b,_0xd82dd8){var _0x1f7ce8=function(_0xe495ea){while(--_0xe495ea){_0x4ac87b['push'](_0x4ac87b['shift']());}};_0x1f7ce8(++_0xd82dd8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x49e1e3,_0x491e11){var _0x3c5403=function(_0x4f535e){while(--_0x4f535e){_0x49e1e3['push'](_0x49e1e3['shift']());}};_0x3c5403(++_0x491e11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 1a46db5..88e24fb 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 _0xd52d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','randomstring','../../config/utils'];(function(_0x152561,_0x16178b){var _0x491996=function(_0x28243d){while(--_0x28243d){_0x152561['push'](_0x152561['shift']());}};_0x491996(++_0x16178b);}(_0xd52d,0x1c7));var _0xdd52=function(_0x50b1ce,_0x4ee734){_0x50b1ce=_0x50b1ce-0x0;var _0x235f7b=_0xd52d[_0x50b1ce];return _0x235f7b;};'use strict';var _=require('lodash');var util=require(_0xdd52('0x0'));var moment=require(_0xdd52('0x1'));var BPromise=require('bluebird');var rs=require(_0xdd52('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdd52('0x3'));var logger=require(_0xdd52('0x4'))(_0xdd52('0x5'));var config=require(_0xdd52('0x6'));var jayson=require(_0xdd52('0x7'));var client=jayson[_0xdd52('0x8')][_0xdd52('0x9')]({'port':0x232a});config[_0xdd52('0xa')]=_['defaults'](config[_0xdd52('0xa')],{'host':_0xdd52('0xb'),'port':0x18eb});var socket=require(_0xdd52('0xc'))(new Redis(config[_0xdd52('0xa')]));require(_0xdd52('0xd'))[_0xdd52('0xe')](socket);function respondWithRpcPromise(_0x3fd2b9,_0x3e41e1,_0x20f7ba){return new BPromise(function(_0x41dabd,_0x382fcc){return client[_0xdd52('0xf')](_0x3fd2b9,_0x20f7ba)[_0xdd52('0x10')](function(_0x4d2066){logger[_0xdd52('0x11')](_0xdd52('0x12'),_0x3e41e1,_0xdd52('0x13'));logger[_0xdd52('0x14')](_0xdd52('0x15'),_0x3e41e1,_0xdd52('0x13'),JSON['stringify'](_0x4d2066));if(_0x4d2066[_0xdd52('0x16')]){if(_0x4d2066[_0xdd52('0x16')][_0xdd52('0x17')]===0x1f4){logger['error'](_0xdd52('0x12'),_0x3e41e1,_0x4d2066[_0xdd52('0x16')][_0xdd52('0x18')]);return _0x382fcc(_0x4d2066[_0xdd52('0x16')][_0xdd52('0x18')]);}logger[_0xdd52('0x16')](_0xdd52('0x12'),_0x3e41e1,_0x4d2066[_0xdd52('0x16')]['message']);return _0x41dabd(_0x4d2066[_0xdd52('0x16')]['message']);}else{logger[_0xdd52('0x11')](_0xdd52('0x12'),_0x3e41e1,_0xdd52('0x13'));_0x41dabd(_0x4d2066[_0xdd52('0x19')]['message']);}})[_0xdd52('0x1a')](function(_0x2bf6ff){logger[_0xdd52('0x16')](_0xdd52('0x12'),_0x3e41e1,_0x2bf6ff);_0x382fcc(_0x2bf6ff);});});} \ No newline at end of file +var _0xea28=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x2579bb,_0x2d7f6e){var _0x4f73b6=function(_0x41994b){while(--_0x41994b){_0x2579bb['push'](_0x2579bb['shift']());}};_0x4f73b6(++_0x2d7f6e);}(_0xea28,0x13a));var _0x8ea2=function(_0x2fb631,_0x361204){_0x2fb631=_0x2fb631-0x0;var _0x8000=_0xea28[_0x2fb631];return _0x8000;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var moment=require(_0x8ea2('0x2'));var BPromise=require(_0x8ea2('0x3'));var rs=require(_0x8ea2('0x4'));var fs=require('fs');var Redis=require(_0x8ea2('0x5'));var db=require(_0x8ea2('0x6'))['db'];var utils=require(_0x8ea2('0x7'));var logger=require('../../config/logger')(_0x8ea2('0x8'));var config=require(_0x8ea2('0x9'));var jayson=require(_0x8ea2('0xa'));var client=jayson['client'][_0x8ea2('0xb')]({'port':0x232a});config[_0x8ea2('0xc')]=_[_0x8ea2('0xd')](config[_0x8ea2('0xc')],{'host':_0x8ea2('0xe'),'port':0x18eb});var socket=require(_0x8ea2('0xf'))(new Redis(config[_0x8ea2('0xc')]));require(_0x8ea2('0x10'))[_0x8ea2('0x11')](socket);function respondWithRpcPromise(_0x3000f9,_0x3d0b35,_0x21ae3d){return new BPromise(function(_0x500b82,_0x4da3b1){return client[_0x8ea2('0x12')](_0x3000f9,_0x21ae3d)[_0x8ea2('0x13')](function(_0x374973){logger['info'](_0x8ea2('0x14'),_0x3d0b35,_0x8ea2('0x15'));logger[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x3d0b35,_0x8ea2('0x15'),JSON['stringify'](_0x374973));if(_0x374973[_0x8ea2('0x18')]){if(_0x374973['error']['code']===0x1f4){logger[_0x8ea2('0x18')](_0x8ea2('0x14'),_0x3d0b35,_0x374973[_0x8ea2('0x18')][_0x8ea2('0x19')]);return _0x4da3b1(_0x374973[_0x8ea2('0x18')][_0x8ea2('0x19')]);}logger[_0x8ea2('0x18')](_0x8ea2('0x14'),_0x3d0b35,_0x374973[_0x8ea2('0x18')][_0x8ea2('0x19')]);return _0x500b82(_0x374973[_0x8ea2('0x18')][_0x8ea2('0x19')]);}else{logger[_0x8ea2('0x1a')](_0x8ea2('0x14'),_0x3d0b35,_0x8ea2('0x15'));_0x500b82(_0x374973[_0x8ea2('0x1b')][_0x8ea2('0x19')]);}})[_0x8ea2('0x1c')](function(_0x1068b6){logger[_0x8ea2('0x18')](_0x8ea2('0x14'),_0x3d0b35,_0x1068b6);_0x4da3b1(_0x1068b6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 27231de..bb1ac17 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 _0xea70=['length','openchannelAccount:','./openchannelAccount.events','save','remove','removeListener','register'];(function(_0xd2e0e6,_0x4dab30){var _0x485ed7=function(_0x3a5a02){while(--_0x3a5a02){_0xd2e0e6['push'](_0xd2e0e6['shift']());}};_0x485ed7(++_0x4dab30);}(_0xea70,0x175));var _0x0ea7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xea70[_0x20a584];return _0x4b41a8;};'use strict';var OpenchannelAccountEvents=require(_0x0ea7('0x0'));var events=[_0x0ea7('0x1'),_0x0ea7('0x2'),'update'];function createListener(_0x28ddf0,_0x499815){return function(_0x2fad00){_0x499815['emit'](_0x28ddf0,_0x2fad00);};}function removeListener(_0x425623,_0x3138eb){return function(){OpenchannelAccountEvents[_0x0ea7('0x3')](_0x425623,_0x3138eb);};}exports[_0x0ea7('0x4')]=function(_0x168372){for(var _0x489be9=0x0,_0x144497=events[_0x0ea7('0x5')];_0x489be9<_0x144497;_0x489be9++){var _0x51b516=events[_0x489be9];var _0x48dedd=createListener(_0x0ea7('0x6')+_0x51b516,_0x168372);OpenchannelAccountEvents['on'](_0x51b516,_0x48dedd);}}; \ No newline at end of file +var _0x4b8a=['openchannelAccount:','save','update','emit','removeListener','register','length'];(function(_0x5418ad,_0x40742f){var _0x2cae56=function(_0x36d317){while(--_0x36d317){_0x5418ad['push'](_0x5418ad['shift']());}};_0x2cae56(++_0x40742f);}(_0x4b8a,0xd3));var _0xa4b8=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4b8a[_0x3bf83f];return _0x22c4a9;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xa4b8('0x0'),'remove',_0xa4b8('0x1')];function createListener(_0x3ed3b6,_0x20eea6){return function(_0x34c820){_0x20eea6[_0xa4b8('0x2')](_0x3ed3b6,_0x34c820);};}function removeListener(_0x3a22d1,_0xb147cb){return function(){OpenchannelAccountEvents[_0xa4b8('0x3')](_0x3a22d1,_0xb147cb);};}exports[_0xa4b8('0x4')]=function(_0x719605){for(var _0x2c9e45=0x0,_0x2de84d=events[_0xa4b8('0x5')];_0x2c9e45<_0x2de84d;_0x2c9e45++){var _0x1fea78=events[_0x2c9e45];var _0x517970=createListener(_0xa4b8('0x6')+_0x1fea78,_0x719605);OpenchannelAccountEvents['on'](_0x1fea78,_0x517970);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 1e7b6d9..c5a1dda 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 _0xd171=['index','/:id','show','post','isAuthenticated','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller'];(function(_0x51df00,_0x4ac573){var _0x198328=function(_0x24e0ec){while(--_0x24e0ec){_0x51df00['push'](_0x51df00['shift']());}};_0x198328(++_0x4ac573);}(_0xd171,0x14b));var _0x1d17=function(_0x15106b,_0x4d96f6){_0x15106b=_0x15106b-0x0;var _0x521203=_0xd171[_0x15106b];return _0x521203;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1d17('0x0'));var timeout=require(_0x1d17('0x1'));var express=require(_0x1d17('0x2'));var router=express[_0x1d17('0x3')]();var fs_extra=require(_0x1d17('0x4'));var auth=require(_0x1d17('0x5'));var interaction=require(_0x1d17('0x6'));var config=require(_0x1d17('0x7'));var controller=require(_0x1d17('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1d17('0x9')]);router['get'](_0x1d17('0xa'),auth['isAuthenticated'](),controller[_0x1d17('0xb')]);router[_0x1d17('0xc')]('/',auth[_0x1d17('0xd')](),controller['create']);router['put'](_0x1d17('0xa'),auth['isAuthenticated'](),controller[_0x1d17('0xe')]);router['delete'](_0x1d17('0xa'),auth['isAuthenticated'](),controller[_0x1d17('0xf')]);module[_0x1d17('0x10')]=router; \ No newline at end of file +var _0xbfd4=['show','post','create','put','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id'];(function(_0x81dcac,_0x8ff7db){var _0xc7803b=function(_0x499b29){while(--_0x499b29){_0x81dcac['push'](_0x81dcac['shift']());}};_0xc7803b(++_0x8ff7db);}(_0xbfd4,0x1ce));var _0x4bfd=function(_0x3c47a9,_0x4c8662){_0x3c47a9=_0x3c47a9-0x0;var _0x258ddc=_0xbfd4[_0x3c47a9];return _0x258ddc;};'use strict';var multer=require(_0x4bfd('0x0'));var util=require('util');var path=require(_0x4bfd('0x1'));var timeout=require(_0x4bfd('0x2'));var express=require(_0x4bfd('0x3'));var router=express[_0x4bfd('0x4')]();var fs_extra=require(_0x4bfd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4bfd('0x6'));var config=require(_0x4bfd('0x7'));var controller=require(_0x4bfd('0x8'));router[_0x4bfd('0x9')]('/',auth[_0x4bfd('0xa')](),controller[_0x4bfd('0xb')]);router[_0x4bfd('0x9')](_0x4bfd('0xc'),auth[_0x4bfd('0xa')](),controller[_0x4bfd('0xd')]);router[_0x4bfd('0xe')]('/',auth[_0x4bfd('0xa')](),controller[_0x4bfd('0xf')]);router[_0x4bfd('0x10')](_0x4bfd('0xc'),auth[_0x4bfd('0xa')](),controller[_0x4bfd('0x11')]);router['delete'](_0x4bfd('0xc'),auth[_0x4bfd('0xa')](),controller['destroy']);module[_0x4bfd('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index dd7b9d4..9e638a1 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 _0xbe5e=['noop','TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0xbe5e,0x81));var _0xebe5=function(_0x4a80b0,_0x361160){_0x4a80b0=_0x4a80b0-0x0;var _0x6eeaba=_0xbe5e[_0x4a80b0];return _0x6eeaba;};'use strict';var Sequelize=require(_0xebe5('0x0'));module[_0xebe5('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xebe5('0x2')],'allowNull':![],'defaultValue':_0xebe5('0x3')},'appdata':{'type':Sequelize[_0xebe5('0x4')]()},'description':{'type':Sequelize[_0xebe5('0x2')]},'interval':{'type':Sequelize[_0xebe5('0x2')],'defaultValue':_0xebe5('0x5')}}; \ No newline at end of file +var _0xabef=['STRING','*,*,*,*','sequelize','exports','INTEGER','TEXT'];(function(_0x258173,_0x5e5224){var _0x58ab1a=function(_0x158848){while(--_0x158848){_0x258173['push'](_0x258173['shift']());}};_0x58ab1a(++_0x5e5224);}(_0xabef,0xce));var _0xfabe=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xabef[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xfabe('0x0'));module[_0xfabe('0x1')]={'priority':{'type':Sequelize[_0xfabe('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xfabe('0x3')]()},'description':{'type':Sequelize[_0xfabe('0x4')]},'interval':{'type':Sequelize[_0xfabe('0x4')],'defaultValue':_0xfabe('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 7c67b7f..fdcd3ab 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 _0x6e3b=['../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','OpenchannelApplication','rawAttributes','key','model','map','keys','query','fields','attributes','length','nolimit','limit','sort','filters','pick','where','merge','type','options','includeAll','findAll','rows','show','intersection','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6e3b,0xbf));var _0xb6e3=function(_0x22a802,_0x3b1f38){_0x22a802=_0x22a802-0x0;var _0x7f8948=_0x6e3b[_0x22a802];return _0x7f8948;};'use strict';var emlformat=require(_0xb6e3('0x0'));var rimraf=require(_0xb6e3('0x1'));var zipdir=require(_0xb6e3('0x2'));var jsonpatch=require(_0xb6e3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb6e3('0x4'));var Mustache=require(_0xb6e3('0x5'));var util=require('util');var path=require(_0xb6e3('0x6'));var sox=require(_0xb6e3('0x7'));var csv=require(_0xb6e3('0x8'));var ejs=require(_0xb6e3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb6e3('0xa'));var crypto=require(_0xb6e3('0xb'));var jsforce=require(_0xb6e3('0xc'));var deskjs=require(_0xb6e3('0xd'));var toCsv=require(_0xb6e3('0x8'));var querystring=require(_0xb6e3('0xe'));var Papa=require(_0xb6e3('0xf'));var Redis=require('ioredis');var authService=require(_0xb6e3('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb6e3('0x11'))(_0xb6e3('0x12'));var utils=require(_0xb6e3('0x13'));var config=require(_0xb6e3('0x14'));var licenseUtil=require(_0xb6e3('0x15'));var db=require(_0xb6e3('0x16'))['db'];function respondWithStatusCode(_0x15a843,_0xacbac2){_0xacbac2=_0xacbac2||0xcc;return function(_0x2c7086){if(_0x2c7086){return _0x15a843['sendStatus'](_0xacbac2);}return _0x15a843[_0xb6e3('0x17')](_0xacbac2)[_0xb6e3('0x18')]();};}function respondWithResult(_0x3e8486,_0x4d64e6){_0x4d64e6=_0x4d64e6||0xc8;return function(_0x28099a){if(_0x28099a){return _0x3e8486[_0xb6e3('0x17')](_0x4d64e6)[_0xb6e3('0x19')](_0x28099a);}};}function respondWithFilteredResult(_0x815e99,_0x428617){return function(_0x57ff13){if(_0x57ff13){var _0xd0ad70=typeof _0x428617[_0xb6e3('0x1a')]===_0xb6e3('0x1b')&&typeof _0x428617['limit']===_0xb6e3('0x1b');var _0x1c28e9=_0x57ff13['count'];var _0xadca01=_0xd0ad70?0x0:_0x428617[_0xb6e3('0x1a')];var _0x40662e=_0xd0ad70?_0x57ff13[_0xb6e3('0x1c')]:_0x428617[_0xb6e3('0x1a')]+_0x428617['limit'];var _0x57ef7c;if(_0x40662e>=_0x1c28e9){_0x40662e=_0x1c28e9;_0x57ef7c=0xc8;}else{_0x57ef7c=0xce;}_0x815e99['status'](_0x57ef7c);return _0x815e99['set']('Content-Range',_0xadca01+'-'+_0x40662e+'/'+_0x1c28e9)[_0xb6e3('0x19')](_0x57ff13);}return null;};}function patchUpdates(_0x540c24){return function(_0x2e93b5){try{jsonpatch[_0xb6e3('0x1d')](_0x2e93b5,_0x540c24,!![]);}catch(_0x54449f){return BPromise[_0xb6e3('0x1e')](_0x54449f);}return _0x2e93b5[_0xb6e3('0x1f')]();};}function saveUpdates(_0x449a2a,_0x12b3ed){return function(_0x1b7046){if(_0x1b7046){return _0x1b7046[_0xb6e3('0x20')](_0x449a2a)[_0xb6e3('0x21')](function(_0x32ccc2){return _0x32ccc2;});}return null;};}function removeEntity(_0x2550a7,_0x4e8d86){return function(_0x215385){if(_0x215385){return _0x215385[_0xb6e3('0x22')]()['then'](function(){_0x2550a7['status'](0xcc)[_0xb6e3('0x18')]();});}};}function handleEntityNotFound(_0xe12597,_0x45652a){return function(_0x1de3eb){if(!_0x1de3eb){_0xe12597[_0xb6e3('0x23')](0x194);}return _0x1de3eb;};}function handleError(_0xce0fd0,_0x37b77a){_0x37b77a=_0x37b77a||0x1f4;return function(_0x374b5c){logger[_0xb6e3('0x24')](_0x374b5c['stack']);if(_0x374b5c['name']){delete _0x374b5c[_0xb6e3('0x25')];}_0xce0fd0[_0xb6e3('0x17')](_0x37b77a)[_0xb6e3('0x26')](_0x374b5c);};}exports[_0xb6e3('0x27')]=function(_0x16fae8,_0x3a4ece){var _0x433553={},_0x135cde={},_0x17f223={'count':0x0,'rows':[]};var _0x2476ae=_['map'](db[_0xb6e3('0x28')][_0xb6e3('0x29')],function(_0x18d435){return{'name':_0x18d435['fieldName'],'type':_0x18d435['type'][_0xb6e3('0x2a')]};});_0x135cde[_0xb6e3('0x2b')]=_[_0xb6e3('0x2c')](_0x2476ae,_0xb6e3('0x25'));_0x135cde['query']=_[_0xb6e3('0x2d')](_0x16fae8[_0xb6e3('0x2e')]);_0x135cde['filters']=_['intersection'](_0x135cde[_0xb6e3('0x2b')],_0x135cde[_0xb6e3('0x2e')]);_0x433553['attributes']=_['intersection'](_0x135cde['model'],qs[_0xb6e3('0x2f')](_0x16fae8[_0xb6e3('0x2e')][_0xb6e3('0x2f')]));_0x433553[_0xb6e3('0x30')]=_0x433553[_0xb6e3('0x30')][_0xb6e3('0x31')]?_0x433553[_0xb6e3('0x30')]:_0x135cde[_0xb6e3('0x2b')];if(!_0x16fae8[_0xb6e3('0x2e')]['hasOwnProperty'](_0xb6e3('0x32'))){_0x433553[_0xb6e3('0x33')]=qs[_0xb6e3('0x33')](_0x16fae8['query'][_0xb6e3('0x33')]);_0x433553['offset']=qs[_0xb6e3('0x1a')](_0x16fae8[_0xb6e3('0x2e')][_0xb6e3('0x1a')]);}_0x433553['order']=qs[_0xb6e3('0x34')](_0x16fae8['query'][_0xb6e3('0x34')]);_0x433553['where']=qs[_0xb6e3('0x35')](_[_0xb6e3('0x36')](_0x16fae8[_0xb6e3('0x2e')],_0x135cde['filters']),_0x2476ae);if(_0x16fae8[_0xb6e3('0x2e')]['filter']){_0x433553[_0xb6e3('0x37')]=_[_0xb6e3('0x38')](_0x433553['where'],{'$or':_['map'](_0x2476ae,function(_0x4f7e4e){if(_0x4f7e4e[_0xb6e3('0x39')]!=='VIRTUAL'){var _0x512d65={};_0x512d65[_0x4f7e4e[_0xb6e3('0x25')]]={'$like':'%'+_0x16fae8[_0xb6e3('0x2e')]['filter']+'%'};return _0x512d65;}})});}_0x433553=_[_0xb6e3('0x38')]({},_0x433553,_0x16fae8[_0xb6e3('0x3a')]);var _0xd63e85={'where':_0x433553['where']};return db[_0xb6e3('0x28')]['count'](_0xd63e85)[_0xb6e3('0x21')](function(_0x11ea99){_0x17f223[_0xb6e3('0x1c')]=_0x11ea99;if(_0x16fae8['query'][_0xb6e3('0x3b')]){_0x433553['include']=[{'all':!![]}];}return db[_0xb6e3('0x28')][_0xb6e3('0x3c')](_0x433553);})[_0xb6e3('0x21')](function(_0x3bbe15){_0x17f223[_0xb6e3('0x3d')]=_0x3bbe15;return _0x17f223;})[_0xb6e3('0x21')](respondWithFilteredResult(_0x3a4ece,_0x433553))['catch'](handleError(_0x3a4ece,null));};exports[_0xb6e3('0x3e')]=function(_0x4f90f9,_0x30affa){var _0x450e6a={'raw':!![],'where':{'id':_0x4f90f9['params']['id']}},_0x43f97a={};_0x43f97a['model']=_[_0xb6e3('0x2d')](db[_0xb6e3('0x28')]['rawAttributes']);_0x43f97a[_0xb6e3('0x2e')]=_[_0xb6e3('0x2d')](_0x4f90f9[_0xb6e3('0x2e')]);_0x43f97a[_0xb6e3('0x35')]=_[_0xb6e3('0x3f')](_0x43f97a[_0xb6e3('0x2b')],_0x43f97a[_0xb6e3('0x2e')]);_0x450e6a[_0xb6e3('0x30')]=_[_0xb6e3('0x3f')](_0x43f97a[_0xb6e3('0x2b')],qs[_0xb6e3('0x2f')](_0x4f90f9[_0xb6e3('0x2e')][_0xb6e3('0x2f')]));_0x450e6a[_0xb6e3('0x30')]=_0x450e6a['attributes']['length']?_0x450e6a[_0xb6e3('0x30')]:_0x43f97a[_0xb6e3('0x2b')];if(_0x4f90f9[_0xb6e3('0x2e')]['includeAll']){_0x450e6a['include']=[{'all':!![]}];}_0x450e6a=_[_0xb6e3('0x38')]({},_0x450e6a,_0x4f90f9[_0xb6e3('0x3a')]);return db['OpenchannelApplication'][_0xb6e3('0x40')](_0x450e6a)[_0xb6e3('0x21')](handleEntityNotFound(_0x30affa,null))['then'](respondWithResult(_0x30affa,null))[_0xb6e3('0x41')](handleError(_0x30affa,null));};exports[_0xb6e3('0x42')]=function(_0x28a6fb,_0x384242){return db[_0xb6e3('0x28')][_0xb6e3('0x42')](_0x28a6fb['body'],{})[_0xb6e3('0x21')](respondWithResult(_0x384242,0xc9))[_0xb6e3('0x41')](handleError(_0x384242,null));};exports['update']=function(_0x4ed0bd,_0xe71407){if(_0x4ed0bd[_0xb6e3('0x43')]['id']){delete _0x4ed0bd[_0xb6e3('0x43')]['id'];}return db['OpenchannelApplication'][_0xb6e3('0x40')]({'where':{'id':_0x4ed0bd[_0xb6e3('0x44')]['id']}})['then'](handleEntityNotFound(_0xe71407,null))[_0xb6e3('0x21')](saveUpdates(_0x4ed0bd[_0xb6e3('0x43')],null))[_0xb6e3('0x21')](respondWithResult(_0xe71407,null))[_0xb6e3('0x41')](handleError(_0xe71407,null));};exports[_0xb6e3('0x22')]=function(_0x406e99,_0x1b687c){return db['OpenchannelApplication'][_0xb6e3('0x40')]({'where':{'id':_0x406e99[_0xb6e3('0x44')]['id']}})[_0xb6e3('0x21')](handleEntityNotFound(_0x1b687c,null))[_0xb6e3('0x21')](removeEntity(_0x1b687c,null))[_0xb6e3('0x41')](handleError(_0x1b687c,null));}; \ No newline at end of file +var _0x5505=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','name','send','index','OpenchannelApplication','fieldName','type','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','keys','find','catch','create','body','rimraf'];(function(_0x2273ce,_0x3aa076){var _0x104ab0=function(_0x1e5455){while(--_0x1e5455){_0x2273ce['push'](_0x2273ce['shift']());}};_0x104ab0(++_0x3aa076);}(_0x5505,0x133));var _0x5550=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5505[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5550('0x0'));var zipdir=require(_0x5550('0x1'));var jsonpatch=require(_0x5550('0x2'));var rp=require(_0x5550('0x3'));var moment=require(_0x5550('0x4'));var BPromise=require(_0x5550('0x5'));var Mustache=require(_0x5550('0x6'));var util=require(_0x5550('0x7'));var path=require(_0x5550('0x8'));var sox=require(_0x5550('0x9'));var csv=require(_0x5550('0xa'));var ejs=require(_0x5550('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5550('0xc'));var squel=require(_0x5550('0xd'));var crypto=require(_0x5550('0xe'));var jsforce=require(_0x5550('0xf'));var deskjs=require(_0x5550('0x10'));var toCsv=require(_0x5550('0xa'));var querystring=require(_0x5550('0x11'));var Papa=require(_0x5550('0x12'));var Redis=require(_0x5550('0x13'));var authService=require(_0x5550('0x14'));var qs=require(_0x5550('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5550('0x16'));var logger=require(_0x5550('0x17'))(_0x5550('0x18'));var utils=require(_0x5550('0x19'));var config=require(_0x5550('0x1a'));var licenseUtil=require(_0x5550('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xaca1f0,_0x5b08cb){_0x5b08cb=_0x5b08cb||0xcc;return function(_0x8111da){if(_0x8111da){return _0xaca1f0[_0x5550('0x1c')](_0x5b08cb);}return _0xaca1f0[_0x5550('0x1d')](_0x5b08cb)[_0x5550('0x1e')]();};}function respondWithResult(_0x3138bc,_0x9200e0){_0x9200e0=_0x9200e0||0xc8;return function(_0x1c1b77){if(_0x1c1b77){return _0x3138bc[_0x5550('0x1d')](_0x9200e0)[_0x5550('0x1f')](_0x1c1b77);}};}function respondWithFilteredResult(_0x3c5f43,_0x4ca305){return function(_0x83befc){if(_0x83befc){var _0x3d81eb=typeof _0x4ca305['offset']===_0x5550('0x20')&&typeof _0x4ca305[_0x5550('0x21')]===_0x5550('0x20');var _0x23761c=_0x83befc[_0x5550('0x22')];var _0x835afe=_0x3d81eb?0x0:_0x4ca305[_0x5550('0x23')];var _0x4859b2=_0x3d81eb?_0x83befc[_0x5550('0x22')]:_0x4ca305[_0x5550('0x23')]+_0x4ca305['limit'];var _0x52de68;if(_0x4859b2>=_0x23761c){_0x4859b2=_0x23761c;_0x52de68=0xc8;}else{_0x52de68=0xce;}_0x3c5f43[_0x5550('0x1d')](_0x52de68);return _0x3c5f43['set'](_0x5550('0x24'),_0x835afe+'-'+_0x4859b2+'/'+_0x23761c)[_0x5550('0x1f')](_0x83befc);}return null;};}function patchUpdates(_0x1c81d8){return function(_0x326c2c){try{jsonpatch[_0x5550('0x25')](_0x326c2c,_0x1c81d8,!![]);}catch(_0x3923ac){return BPromise[_0x5550('0x26')](_0x3923ac);}return _0x326c2c[_0x5550('0x27')]();};}function saveUpdates(_0x59ed9a,_0x19145){return function(_0x5181bf){if(_0x5181bf){return _0x5181bf[_0x5550('0x28')](_0x59ed9a)[_0x5550('0x29')](function(_0x5e1e5d){return _0x5e1e5d;});}return null;};}function removeEntity(_0xe6632d,_0x4dbd98){return function(_0xfd1100){if(_0xfd1100){return _0xfd1100[_0x5550('0x2a')]()[_0x5550('0x29')](function(){_0xe6632d[_0x5550('0x1d')](0xcc)[_0x5550('0x1e')]();});}};}function handleEntityNotFound(_0x2d2040,_0x42ed22){return function(_0xde7b81){if(!_0xde7b81){_0x2d2040[_0x5550('0x1c')](0x194);}return _0xde7b81;};}function handleError(_0x4db7f7,_0x3ad6ca){_0x3ad6ca=_0x3ad6ca||0x1f4;return function(_0x5de078){logger['error'](_0x5de078['stack']);if(_0x5de078[_0x5550('0x2b')]){delete _0x5de078['name'];}_0x4db7f7[_0x5550('0x1d')](_0x3ad6ca)[_0x5550('0x2c')](_0x5de078);};}exports[_0x5550('0x2d')]=function(_0x289cd7,_0x4312b0){var _0x3cc76a={},_0x3d1671={},_0x749b6f={'count':0x0,'rows':[]};var _0x327036=_['map'](db[_0x5550('0x2e')]['rawAttributes'],function(_0x201d19){return{'name':_0x201d19[_0x5550('0x2f')],'type':_0x201d19[_0x5550('0x30')][_0x5550('0x31')]};});_0x3d1671[_0x5550('0x32')]=_[_0x5550('0x33')](_0x327036,_0x5550('0x2b'));_0x3d1671[_0x5550('0x34')]=_['keys'](_0x289cd7[_0x5550('0x34')]);_0x3d1671['filters']=_[_0x5550('0x35')](_0x3d1671[_0x5550('0x32')],_0x3d1671[_0x5550('0x34')]);_0x3cc76a['attributes']=_[_0x5550('0x35')](_0x3d1671[_0x5550('0x32')],qs[_0x5550('0x36')](_0x289cd7[_0x5550('0x34')][_0x5550('0x36')]));_0x3cc76a[_0x5550('0x37')]=_0x3cc76a[_0x5550('0x37')][_0x5550('0x38')]?_0x3cc76a[_0x5550('0x37')]:_0x3d1671[_0x5550('0x32')];if(!_0x289cd7[_0x5550('0x34')][_0x5550('0x39')]('nolimit')){_0x3cc76a[_0x5550('0x21')]=qs[_0x5550('0x21')](_0x289cd7['query'][_0x5550('0x21')]);_0x3cc76a[_0x5550('0x23')]=qs[_0x5550('0x23')](_0x289cd7[_0x5550('0x34')]['offset']);}_0x3cc76a[_0x5550('0x3a')]=qs[_0x5550('0x3b')](_0x289cd7[_0x5550('0x34')]['sort']);_0x3cc76a[_0x5550('0x3c')]=qs['filters'](_[_0x5550('0x3d')](_0x289cd7[_0x5550('0x34')],_0x3d1671[_0x5550('0x3e')]),_0x327036);if(_0x289cd7[_0x5550('0x34')][_0x5550('0x3f')]){_0x3cc76a[_0x5550('0x3c')]=_['merge'](_0x3cc76a[_0x5550('0x3c')],{'$or':_[_0x5550('0x33')](_0x327036,function(_0x29296b){if(_0x29296b[_0x5550('0x30')]!==_0x5550('0x40')){var _0xd63c7f={};_0xd63c7f[_0x29296b[_0x5550('0x2b')]]={'$like':'%'+_0x289cd7[_0x5550('0x34')][_0x5550('0x3f')]+'%'};return _0xd63c7f;}})});}_0x3cc76a=_[_0x5550('0x41')]({},_0x3cc76a,_0x289cd7[_0x5550('0x42')]);var _0x4e9a8a={'where':_0x3cc76a[_0x5550('0x3c')]};return db[_0x5550('0x2e')][_0x5550('0x22')](_0x4e9a8a)[_0x5550('0x29')](function(_0x4a0077){_0x749b6f[_0x5550('0x22')]=_0x4a0077;if(_0x289cd7[_0x5550('0x34')][_0x5550('0x43')]){_0x3cc76a[_0x5550('0x44')]=[{'all':!![]}];}return db[_0x5550('0x2e')]['findAll'](_0x3cc76a);})['then'](function(_0x3fd1dd){_0x749b6f[_0x5550('0x45')]=_0x3fd1dd;return _0x749b6f;})[_0x5550('0x29')](respondWithFilteredResult(_0x4312b0,_0x3cc76a))['catch'](handleError(_0x4312b0,null));};exports[_0x5550('0x46')]=function(_0x1b0b4f,_0x2b1119){var _0x267aa={'raw':!![],'where':{'id':_0x1b0b4f[_0x5550('0x47')]['id']}},_0x58f9c6={};_0x58f9c6[_0x5550('0x32')]=_[_0x5550('0x48')](db['OpenchannelApplication']['rawAttributes']);_0x58f9c6['query']=_[_0x5550('0x48')](_0x1b0b4f['query']);_0x58f9c6['filters']=_['intersection'](_0x58f9c6['model'],_0x58f9c6[_0x5550('0x34')]);_0x267aa['attributes']=_[_0x5550('0x35')](_0x58f9c6[_0x5550('0x32')],qs[_0x5550('0x36')](_0x1b0b4f[_0x5550('0x34')]['fields']));_0x267aa[_0x5550('0x37')]=_0x267aa[_0x5550('0x37')][_0x5550('0x38')]?_0x267aa[_0x5550('0x37')]:_0x58f9c6[_0x5550('0x32')];if(_0x1b0b4f['query']['includeAll']){_0x267aa[_0x5550('0x44')]=[{'all':!![]}];}_0x267aa=_[_0x5550('0x41')]({},_0x267aa,_0x1b0b4f[_0x5550('0x42')]);return db[_0x5550('0x2e')][_0x5550('0x49')](_0x267aa)[_0x5550('0x29')](handleEntityNotFound(_0x2b1119,null))[_0x5550('0x29')](respondWithResult(_0x2b1119,null))[_0x5550('0x4a')](handleError(_0x2b1119,null));};exports[_0x5550('0x4b')]=function(_0x50c0ea,_0x3b9565){return db[_0x5550('0x2e')]['create'](_0x50c0ea[_0x5550('0x4c')],{})[_0x5550('0x29')](respondWithResult(_0x3b9565,0xc9))[_0x5550('0x4a')](handleError(_0x3b9565,null));};exports['update']=function(_0x7415e1,_0x3073f5){if(_0x7415e1[_0x5550('0x4c')]['id']){delete _0x7415e1[_0x5550('0x4c')]['id'];}return db[_0x5550('0x2e')][_0x5550('0x49')]({'where':{'id':_0x7415e1[_0x5550('0x47')]['id']}})[_0x5550('0x29')](handleEntityNotFound(_0x3073f5,null))[_0x5550('0x29')](saveUpdates(_0x7415e1[_0x5550('0x4c')],null))[_0x5550('0x29')](respondWithResult(_0x3073f5,null))[_0x5550('0x4a')](handleError(_0x3073f5,null));};exports[_0x5550('0x2a')]=function(_0x5ec998,_0x2477b1){return db[_0x5550('0x2e')][_0x5550('0x49')]({'where':{'id':_0x5ec998['params']['id']}})['then'](handleEntityNotFound(_0x2477b1,null))['then'](removeEntity(_0x2477b1,null))[_0x5550('0x4a')](handleError(_0x2477b1,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 33b03e7..492fc41 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 _0x8472=['moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api'];(function(_0x1287a6,_0x38b142){var _0x3b6196=function(_0x216e82){while(--_0x216e82){_0x1287a6['push'](_0x1287a6['shift']());}};_0x3b6196(++_0x38b142);}(_0x8472,0x1ec));var _0x2847=function(_0x1e25ff,_0x194832){_0x1e25ff=_0x1e25ff-0x0;var _0x4d9ca7=_0x8472[_0x1e25ff];return _0x4d9ca7;};'use strict';var _=require(_0x2847('0x0'));var util=require(_0x2847('0x1'));var logger=require('../../config/logger')(_0x2847('0x2'));var moment=require(_0x2847('0x3'));var BPromise=require(_0x2847('0x4'));var rp=require(_0x2847('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2847('0x6'));var config=require(_0x2847('0x7'));var attributes=require(_0x2847('0x8'));module[_0x2847('0x9')]=function(_0x1ed5db,_0x3500be){return _0x1ed5db[_0x2847('0xa')](_0x2847('0xb'),attributes,{'tableName':_0x2847('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2847('0xd'),'collate':_0x2847('0xe')});}; \ No newline at end of file +var _0x7129=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','openchannel_applications','utf8mb4','lodash','../../config/logger'];(function(_0x243427,_0x784e11){var _0xc59f9a=function(_0x408037){while(--_0x408037){_0x243427['push'](_0x243427['shift']());}};_0xc59f9a(++_0x784e11);}(_0x7129,0x18a));var _0x9712=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x7129[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x9712('0x0'));var util=require('util');var logger=require(_0x9712('0x1'))('api');var moment=require(_0x9712('0x2'));var BPromise=require(_0x9712('0x3'));var rp=require(_0x9712('0x4'));var fs=require('fs');var path=require(_0x9712('0x5'));var rimraf=require(_0x9712('0x6'));var config=require(_0x9712('0x7'));var attributes=require('./openchannelApplication.attributes');module[_0x9712('0x8')]=function(_0x2f6168,_0x2a97f9){return _0x2f6168[_0x9712('0x9')]('OpenchannelApplication',attributes,{'tableName':_0x9712('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9712('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 87be29e..18931dd 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 _0x7076=['OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','body','options','where','limit','then','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x1717e5,_0x46d752){var _0x2b8c47=function(_0x25578c){while(--_0x25578c){_0x1717e5['push'](_0x1717e5['shift']());}};_0x2b8c47(++_0x46d752);}(_0x7076,0x116));var _0x6707=function(_0x12a271,_0x2bb48d){_0x12a271=_0x12a271-0x0;var _0x307fc4=_0x7076[_0x12a271];return _0x307fc4;};'use strict';var _=require(_0x6707('0x0'));var util=require(_0x6707('0x1'));var moment=require('moment');var BPromise=require(_0x6707('0x2'));var rs=require(_0x6707('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6707('0x4'))['db'];var utils=require(_0x6707('0x5'));var logger=require(_0x6707('0x6'))(_0x6707('0x7'));var config=require('../../config/environment');var jayson=require(_0x6707('0x8'));var client=jayson[_0x6707('0x9')][_0x6707('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46a4f1,_0x1e909d,_0x2eaf2e){return new BPromise(function(_0x5b188a,_0x57de4d){return client[_0x6707('0xb')](_0x46a4f1,_0x2eaf2e)['then'](function(_0x48d2d2){logger['info'](_0x6707('0xc'),_0x1e909d,_0x6707('0xd'));logger['debug'](_0x6707('0xe'),_0x1e909d,_0x6707('0xd'),JSON[_0x6707('0xf')](_0x48d2d2));if(_0x48d2d2[_0x6707('0x10')]){if(_0x48d2d2[_0x6707('0x10')][_0x6707('0x11')]===0x1f4){logger[_0x6707('0x10')](_0x6707('0xc'),_0x1e909d,_0x48d2d2[_0x6707('0x10')][_0x6707('0x12')]);return _0x57de4d(_0x48d2d2[_0x6707('0x10')][_0x6707('0x12')]);}logger[_0x6707('0x10')](_0x6707('0xc'),_0x1e909d,_0x48d2d2[_0x6707('0x10')][_0x6707('0x12')]);return _0x5b188a(_0x48d2d2[_0x6707('0x10')]['message']);}else{logger[_0x6707('0x13')](_0x6707('0xc'),_0x1e909d,'request\x20sent');_0x5b188a(_0x48d2d2[_0x6707('0x14')][_0x6707('0x12')]);}})[_0x6707('0x15')](function(_0x48110f){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x1e909d,_0x48110f);_0x57de4d(_0x48110f);});});}exports[_0x6707('0x16')]=function(_0x312094){var _0xe2ffc2=this;return new Promise(function(_0x15db03,_0x365ade){return db[_0x6707('0x17')]['update'](_0x312094[_0x6707('0x18')],{'raw':_0x312094[_0x6707('0x19')]?_0x312094[_0x6707('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x312094[_0x6707('0x19')]?_0x312094[_0x6707('0x19')][_0x6707('0x1a')]||null:null,'attributes':_0x312094[_0x6707('0x19')]?_0x312094[_0x6707('0x19')]['attributes']||null:null,'limit':_0x312094[_0x6707('0x19')]?_0x312094[_0x6707('0x19')][_0x6707('0x1b')]||null:null})[_0x6707('0x1c')](function(_0x3811d5){logger[_0x6707('0x13')](_0x6707('0x16'),_0x312094);logger['debug'](_0x6707('0x16'),_0x312094,JSON[_0x6707('0xf')](_0x3811d5));_0x15db03(_0x3811d5);})[_0x6707('0x15')](function(_0x4c564e){logger[_0x6707('0x10')](_0x6707('0x16'),_0x4c564e['message'],_0x312094);_0x365ade(_0xe2ffc2[_0x6707('0x10')](0x1f4,_0x4c564e[_0x6707('0x12')]));});});}; \ No newline at end of file +var _0x631b=['update','body','options','where','attributes','limit','then','info','stringify','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','message','catch','UpdateOpenchannelApplication','OpenchannelApplication'];(function(_0x5ca1a0,_0x361f32){var _0x4e529f=function(_0x5f59cb){while(--_0x5f59cb){_0x5ca1a0['push'](_0x5ca1a0['shift']());}};_0x4e529f(++_0x361f32);}(_0x631b,0xd4));var _0xb631=function(_0xbaeba7,_0x578dfa){_0xbaeba7=_0xbaeba7-0x0;var _0x4b42e7=_0x631b[_0xbaeba7];return _0x4b42e7;};'use strict';var _=require(_0xb631('0x0'));var util=require(_0xb631('0x1'));var moment=require(_0xb631('0x2'));var BPromise=require('bluebird');var rs=require(_0xb631('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb631('0x4'))(_0xb631('0x5'));var config=require(_0xb631('0x6'));var jayson=require(_0xb631('0x7'));var client=jayson[_0xb631('0x8')][_0xb631('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ead69,_0x5437eb,_0x5d415f){return new BPromise(function(_0x450121,_0x38fa47){return client[_0xb631('0xa')](_0x2ead69,_0x5d415f)['then'](function(_0xc1a88e){logger['info'](_0xb631('0xb'),_0x5437eb,_0xb631('0xc'));logger[_0xb631('0xd')](_0xb631('0xe'),_0x5437eb,'request\x20sent',JSON['stringify'](_0xc1a88e));if(_0xc1a88e['error']){if(_0xc1a88e[_0xb631('0xf')]['code']===0x1f4){logger[_0xb631('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x5437eb,_0xc1a88e[_0xb631('0xf')][_0xb631('0x10')]);return _0x38fa47(_0xc1a88e[_0xb631('0xf')][_0xb631('0x10')]);}logger[_0xb631('0xf')](_0xb631('0xb'),_0x5437eb,_0xc1a88e[_0xb631('0xf')]['message']);return _0x450121(_0xc1a88e['error'][_0xb631('0x10')]);}else{logger['info'](_0xb631('0xb'),_0x5437eb,_0xb631('0xc'));_0x450121(_0xc1a88e['result'][_0xb631('0x10')]);}})[_0xb631('0x11')](function(_0x361431){logger[_0xb631('0xf')](_0xb631('0xb'),_0x5437eb,_0x361431);_0x38fa47(_0x361431);});});}exports[_0xb631('0x12')]=function(_0xf5a9df){var _0x503511=this;return new Promise(function(_0x2139f8,_0x55a37f){return db[_0xb631('0x13')][_0xb631('0x14')](_0xf5a9df[_0xb631('0x15')],{'raw':_0xf5a9df[_0xb631('0x16')]?_0xf5a9df[_0xb631('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf5a9df[_0xb631('0x16')]?_0xf5a9df['options'][_0xb631('0x17')]||null:null,'attributes':_0xf5a9df['options']?_0xf5a9df['options'][_0xb631('0x18')]||null:null,'limit':_0xf5a9df['options']?_0xf5a9df[_0xb631('0x16')][_0xb631('0x19')]||null:null})[_0xb631('0x1a')](function(_0x15d824){logger[_0xb631('0x1b')](_0xb631('0x12'),_0xf5a9df);logger[_0xb631('0xd')]('UpdateOpenchannelApplication',_0xf5a9df,JSON[_0xb631('0x1c')](_0x15d824));_0x2139f8(_0x15d824);})[_0xb631('0x11')](function(_0x55cea3){logger['error']('UpdateOpenchannelApplication',_0x55cea3[_0xb631('0x10')],_0xf5a9df);_0x55a37f(_0x503511['error'](0x1f4,_0x55cea3[_0xb631('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index bfca49e..ba2f726 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 _0x0a1c=['openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','create','post','/:id/messages','/:id/tags','tracked'];(function(_0x278cbe,_0x452841){var _0x39d041=function(_0x2fbf66){while(--_0x2fbf66){_0x278cbe['push'](_0x278cbe['shift']());}};_0x39d041(++_0x452841);}(_0x0a1c,0x135));var _0xc0a1=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x0a1c[_0x8de54f];return _0x14cba4;};'use strict';var multer=require(_0xc0a1('0x0'));var util=require(_0xc0a1('0x1'));var path=require('path');var timeout=require(_0xc0a1('0x2'));var express=require(_0xc0a1('0x3'));var router=express[_0xc0a1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc0a1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc0a1('0x6'));var controller=require('./openchannelInteraction.controller');router[_0xc0a1('0x7')]('/',auth['isAuthenticated'](),controller[_0xc0a1('0x8')]);router[_0xc0a1('0x7')](_0xc0a1('0x9'),auth[_0xc0a1('0xa')](),controller[_0xc0a1('0xb')]);router[_0xc0a1('0x7')](_0xc0a1('0xc'),auth[_0xc0a1('0xa')](),controller[_0xc0a1('0xd')]);router[_0xc0a1('0x7')]('/:id/messages',auth[_0xc0a1('0xa')](),controller['getMessages']);router[_0xc0a1('0x7')](_0xc0a1('0xe'),auth[_0xc0a1('0xa')](),controller[_0xc0a1('0xf')]);router['post']('/',auth[_0xc0a1('0xa')](),controller[_0xc0a1('0x10')]);router[_0xc0a1('0x11')](_0xc0a1('0x12'),auth[_0xc0a1('0xa')](),controller['addMessage']);router[_0xc0a1('0x11')](_0xc0a1('0x13'),auth['isAuthenticated'](),interaction[_0xc0a1('0x14')](_0xc0a1('0x15'),_0xc0a1('0x16')),controller['addTags']);router[_0xc0a1('0x17')]('/:id',auth[_0xc0a1('0xa')](),interaction[_0xc0a1('0x14')](_0xc0a1('0x15'),_0xc0a1('0x18')),controller[_0xc0a1('0x19')]);router[_0xc0a1('0x1a')](_0xc0a1('0xc'),auth[_0xc0a1('0xa')](),interaction['tracked'](_0xc0a1('0x15'),_0xc0a1('0x1b')),controller[_0xc0a1('0x1c')]);router[_0xc0a1('0x1a')](_0xc0a1('0x13'),auth[_0xc0a1('0xa')](),controller[_0xc0a1('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xe978=['/describe','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','openchannel','addTags','/:id','openchannelinteraction:update','openchannelinteraction:destroy','delete','removeTags','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated'];(function(_0x3ce643,_0x53b200){var _0x4c9392=function(_0x5602da){while(--_0x5602da){_0x3ce643['push'](_0x3ce643['shift']());}};_0x4c9392(++_0x53b200);}(_0xe978,0xf1));var _0x8e97=function(_0x31bb18,_0x5741a3){_0x31bb18=_0x31bb18-0x0;var _0x308a0a=_0xe978[_0x31bb18];return _0x308a0a;};'use strict';var multer=require(_0x8e97('0x0'));var util=require('util');var path=require(_0x8e97('0x1'));var timeout=require(_0x8e97('0x2'));var express=require(_0x8e97('0x3'));var router=express[_0x8e97('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8e97('0x5'));var interaction=require(_0x8e97('0x6'));var config=require(_0x8e97('0x7'));var controller=require(_0x8e97('0x8'));router[_0x8e97('0x9')]('/',auth[_0x8e97('0xa')](),controller['index']);router[_0x8e97('0x9')](_0x8e97('0xb'),auth[_0x8e97('0xa')](),controller['describe']);router[_0x8e97('0x9')]('/:id',auth[_0x8e97('0xa')](),controller[_0x8e97('0xc')]);router[_0x8e97('0x9')](_0x8e97('0xd'),auth['isAuthenticated'](),controller[_0x8e97('0xe')]);router['get'](_0x8e97('0xf'),auth[_0x8e97('0xa')](),controller[_0x8e97('0x10')]);router[_0x8e97('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/messages',auth[_0x8e97('0xa')](),controller[_0x8e97('0x12')]);router[_0x8e97('0x11')](_0x8e97('0x13'),auth[_0x8e97('0xa')](),interaction[_0x8e97('0x14')](_0x8e97('0x15'),'openchannelinteraction:addtags'),controller[_0x8e97('0x16')]);router['put'](_0x8e97('0x17'),auth[_0x8e97('0xa')](),interaction['tracked'](_0x8e97('0x15'),_0x8e97('0x18')),controller['update']);router['delete'](_0x8e97('0x17'),auth[_0x8e97('0xa')](),interaction[_0x8e97('0x14')](_0x8e97('0x15'),_0x8e97('0x19')),controller['destroy']);router[_0x8e97('0x1a')](_0x8e97('0x13'),auth[_0x8e97('0xa')](),controller[_0x8e97('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 46353a3..e33d8ea 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 _0xe002=['ENUM','out','sequelize','exports','BOOLEAN','STRING','DATE'];(function(_0x388e6f,_0x2f18aa){var _0x281a34=function(_0x4a1b1e){while(--_0x4a1b1e){_0x388e6f['push'](_0x388e6f['shift']());}};_0x281a34(++_0x2f18aa);}(_0xe002,0xf7));var _0x2e00=function(_0x38c652,_0x1ea1b7){_0x38c652=_0x38c652-0x0;var _0x218a37=_0xe002[_0x38c652];return _0x218a37;};'use strict';var Sequelize=require(_0x2e00('0x0'));module[_0x2e00('0x1')]={'closed':{'type':Sequelize[_0x2e00('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x2e00('0x3')]},'secondDisposition':{'type':Sequelize[_0x2e00('0x3')]},'thirdDisposition':{'type':Sequelize[_0x2e00('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x2e00('0x4')]},'threadId':{'type':Sequelize[_0x2e00('0x3')]},'externalUrl':{'type':Sequelize[_0x2e00('0x3')]},'lastMsgAt':{'type':Sequelize[_0x2e00('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x2e00('0x5')]('in',_0x2e00('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x2e00('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x2e00('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xaeef=['sequelize','exports','BOOLEAN','STRING','DATE','out'];(function(_0x163a1c,_0x4f81ea){var _0x239113=function(_0x45eaeb){while(--_0x45eaeb){_0x163a1c['push'](_0x163a1c['shift']());}};_0x239113(++_0x4f81ea);}(_0xaeef,0x14a));var _0xfaee=function(_0x556f08,_0x501e7f){_0x556f08=_0x556f08-0x0;var _0x586ac9=_0xaeef[_0x556f08];return _0x586ac9;};'use strict';var Sequelize=require(_0xfaee('0x0'));module[_0xfaee('0x1')]={'closed':{'type':Sequelize[_0xfaee('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xfaee('0x3')]},'secondDisposition':{'type':Sequelize[_0xfaee('0x3')]},'thirdDisposition':{'type':Sequelize[_0xfaee('0x3')]},'note':{'type':Sequelize[_0xfaee('0x3')]},'read1stAt':{'type':Sequelize[_0xfaee('0x4')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xfaee('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xfaee('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xfaee('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index c8823c8..c03cb17 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 _0x1d6c=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','api','../../config/utils','../../config/environment','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','save','update','destroy','then','error','stack','name','send','Users','map','fullname','TagIds','forEach','push','catch','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','expr','search','conditions','find','value','having','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','some','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','parse','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','i.OpenchannelAccountId\x20IS\x20NULL','toString','sequelize','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','all','show','params','includeAll','include','options','create','describe','addMessage','ids','omit','getMessages','findOne','OpenchannelMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','color','emit','removeTags','unix','join','root','server','tmp','files','transcript-%d-%s.zip','CmContact','firstName','lastName','attachments','Attachment','createdAt','secret','Account','Owner','get','mkdirSync','N.A.','closed','closedAt','threadId','basename','existsSync','createReadStream','pipe','direction','out','System','Contact','renderFile','views','downloadInteraction.ejs','createPdfFromHTML','log','err','unlinkSync','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis'];(function(_0x12a658,_0x43a9a5){var _0x47931e=function(_0x57db8c){while(--_0x57db8c){_0x12a658['push'](_0x12a658['shift']());}};_0x47931e(++_0x43a9a5);}(_0x1d6c,0x1b2));var _0xc1d6=function(_0x1d8e7d,_0x10bce9){_0x1d8e7d=_0x1d8e7d-0x0;var _0x214545=_0x1d6c[_0x1d8e7d];return _0x214545;};'use strict';var emlformat=require(_0xc1d6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc1d6('0x1'));var rp=require(_0xc1d6('0x2'));var moment=require(_0xc1d6('0x3'));var BPromise=require(_0xc1d6('0x4'));var Mustache=require(_0xc1d6('0x5'));var util=require(_0xc1d6('0x6'));var path=require(_0xc1d6('0x7'));var sox=require(_0xc1d6('0x8'));var csv=require(_0xc1d6('0x9'));var ejs=require(_0xc1d6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc1d6('0xb'));var crypto=require('crypto');var jsforce=require(_0xc1d6('0xc'));var deskjs=require(_0xc1d6('0xd'));var toCsv=require(_0xc1d6('0x9'));var querystring=require(_0xc1d6('0xe'));var Papa=require('papaparse');var Redis=require(_0xc1d6('0xf'));var authService=require(_0xc1d6('0x10'));var qs=require(_0xc1d6('0x11'));var as=require(_0xc1d6('0x12'));var pdf=require(_0xc1d6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc1d6('0x14'));var utils=require(_0xc1d6('0x15'));var config=require(_0xc1d6('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xc1d6('0x17')]=_[_0xc1d6('0x18')](config[_0xc1d6('0x17')],{'host':_0xc1d6('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc1d6('0x17')]));require(_0xc1d6('0x1a'))[_0xc1d6('0x1b')](socket);function respondWithStatusCode(_0x211f99,_0x2bd98b){_0x2bd98b=_0x2bd98b||0xcc;return function(_0x44a406){if(_0x44a406){return _0x211f99[_0xc1d6('0x1c')](_0x2bd98b);}return _0x211f99[_0xc1d6('0x1d')](_0x2bd98b)[_0xc1d6('0x1e')]();};}function respondWithResult(_0x4513d9,_0x148687){_0x148687=_0x148687||0xc8;return function(_0x2fd842){if(_0x2fd842){return _0x4513d9[_0xc1d6('0x1d')](_0x148687)['json'](_0x2fd842);}};}function respondWithFilteredResult(_0x54f1fa,_0x54416e){return function(_0x4fb6f5){if(_0x4fb6f5){var _0x23688d=typeof _0x54416e[_0xc1d6('0x1f')]===_0xc1d6('0x20')&&typeof _0x54416e[_0xc1d6('0x21')]==='undefined';var _0x402ee5=_0x4fb6f5[_0xc1d6('0x22')];var _0x41b815=_0x23688d?0x0:_0x54416e[_0xc1d6('0x1f')];var _0x493eb2=_0x23688d?_0x4fb6f5[_0xc1d6('0x22')]:_0x54416e['offset']+_0x54416e['limit'];var _0x2edb88;if(_0x493eb2>=_0x402ee5){_0x493eb2=_0x402ee5;_0x2edb88=0xc8;}else{_0x2edb88=0xce;}_0x54f1fa[_0xc1d6('0x1d')](_0x2edb88);return _0x54f1fa[_0xc1d6('0x23')]('Content-Range',_0x41b815+'-'+_0x493eb2+'/'+_0x402ee5)[_0xc1d6('0x24')](_0x4fb6f5);}return null;};}function patchUpdates(_0xb6f199){return function(_0x3c1209){try{jsonpatch['apply'](_0x3c1209,_0xb6f199,!![]);}catch(_0x37994a){return BPromise['reject'](_0x37994a);}return _0x3c1209[_0xc1d6('0x25')]();};}function saveUpdates(_0x187f86,_0xe66025){return function(_0x3edd4){if(_0x3edd4){return _0x3edd4[_0xc1d6('0x26')](_0x187f86)['then'](function(_0xb7a23){return _0xb7a23;});}return null;};}function removeEntity(_0x5cb690,_0x17b7ad){return function(_0x40d3f8){if(_0x40d3f8){return _0x40d3f8[_0xc1d6('0x27')]()[_0xc1d6('0x28')](function(){_0x5cb690[_0xc1d6('0x1d')](0xcc)[_0xc1d6('0x1e')]();});}};}function handleEntityNotFound(_0x5cc53f,_0x59c9ed){return function(_0x2af347){if(!_0x2af347){_0x5cc53f[_0xc1d6('0x1c')](0x194);}return _0x2af347;};}function handleError(_0x38a482,_0x53e030){_0x53e030=_0x53e030||0x1f4;return function(_0x29fc18){logger[_0xc1d6('0x29')](_0x29fc18[_0xc1d6('0x2a')]);if(_0x29fc18[_0xc1d6('0x2b')]){delete _0x29fc18[_0xc1d6('0x2b')];}_0x38a482[_0xc1d6('0x1d')](_0x53e030)[_0xc1d6('0x2c')](_0x29fc18);};}function getInteractionUsers(_0x40d0fc,_0x19c001){return new BPromise(function(_0x597fa8,_0x42aba8){try{if(_0x19c001[_0x40d0fc['id']]){_0x40d0fc[_0xc1d6('0x2d')]=_[_0xc1d6('0x2e')](_0x19c001[_0x40d0fc['id']],function(_0x5626b2){return{'id':_0x5626b2['id'],'fullname':_0x5626b2[_0xc1d6('0x2f')]};});}}catch(_0x541726){_0x42aba8(_0x541726);}_0x597fa8(_0x40d0fc);});}function getInteractionTags(_0x23107b,_0x30c67d){return new BPromise(function(_0x3e2ce7,_0x56cae2){try{if(_0x23107b[_0xc1d6('0x30')]){_0x23107b['Tags']=[];_0x23107b[_0xc1d6('0x30')]['split'](',')[_0xc1d6('0x31')](function(_0x51f176){_0x23107b['Tags'][_0xc1d6('0x32')](_0x30c67d[_0x51f176]);});}delete _0x23107b[_0xc1d6('0x30')];}catch(_0x98bb70){_0x56cae2(_0x98bb70);}_0x3e2ce7(_0x23107b);});}function updateOpenchannelInteraction(_0x2be296,_0x4d9667,_0x1ed47e){return new BPromise(function(_0x18d8a0,_0x5457d9){return getInteractionUsers(_0x2be296,_0x1ed47e)[_0xc1d6('0x28')](function(_0xe54adb){return getInteractionTags(_0xe54adb,_0x4d9667);})[_0xc1d6('0x28')](function(_0x1a1b2b){_0x18d8a0(_0x1a1b2b);})[_0xc1d6('0x33')](function(_0x15d489){_0x5457d9(_0x15d489);});});}exports[_0xc1d6('0x34')]=function(_0x48f00f,_0x149453){var _0x31a52b={},_0x5d05d1={},_0x314a34={'count':0x0,'rows':[]};var _0x348fbe=_[_0xc1d6('0x2e')](db[_0xc1d6('0x35')][_0xc1d6('0x36')],function(_0x588747){return{'name':_0x588747[_0xc1d6('0x37')],'type':_0x588747[_0xc1d6('0x38')][_0xc1d6('0x39')]};});_0x5d05d1['model']=_[_0xc1d6('0x2e')](_0x348fbe,_0xc1d6('0x2b'));_0x5d05d1[_0xc1d6('0x3a')]=_[_0xc1d6('0x3b')](_0x48f00f[_0xc1d6('0x3a')]);_0x5d05d1[_0xc1d6('0x3c')]=_['intersection'](_0x5d05d1[_0xc1d6('0x3d')],_0x5d05d1[_0xc1d6('0x3a')]);_0x31a52b['attributes']=_[_0xc1d6('0x3e')](_0x5d05d1[_0xc1d6('0x3d')],qs[_0xc1d6('0x3f')](_0x48f00f[_0xc1d6('0x3a')][_0xc1d6('0x3f')]));_0x31a52b[_0xc1d6('0x40')]=_0x31a52b[_0xc1d6('0x40')][_0xc1d6('0x41')]?_0x31a52b[_0xc1d6('0x40')]:_0x5d05d1[_0xc1d6('0x3d')];if(!_0x48f00f[_0xc1d6('0x3a')][_0xc1d6('0x42')](_0xc1d6('0x43'))){_0x31a52b[_0xc1d6('0x21')]=qs[_0xc1d6('0x21')](_0x48f00f['query'][_0xc1d6('0x21')]);_0x31a52b['offset']=qs[_0xc1d6('0x1f')](_0x48f00f[_0xc1d6('0x3a')][_0xc1d6('0x1f')]);}_0x31a52b[_0xc1d6('0x44')]=qs['sort'](_0x48f00f[_0xc1d6('0x3a')][_0xc1d6('0x45')]);_0x31a52b[_0xc1d6('0x46')]=qs['filters'](_[_0xc1d6('0x47')](_0x48f00f[_0xc1d6('0x3a')],_0x5d05d1[_0xc1d6('0x3c')]),_0x348fbe);var _0x3081cd=[];var _0x58ef87=squel[_0xc1d6('0x48')]()['field']('id')[_0xc1d6('0x49')](_0xc1d6('0x2b'))[_0xc1d6('0x49')]('color')[_0xc1d6('0x4a')](_0xc1d6('0x4b'));var _0x1832fc=squel[_0xc1d6('0x48')]()[_0xc1d6('0x49')](_0xc1d6('0x4c'))[_0xc1d6('0x49')](_0xc1d6('0x4d'))[_0xc1d6('0x49')](_0xc1d6('0x4e'))['from']('user_has_openchannel_interactions','ui')[_0xc1d6('0x4f')](_0xc1d6('0x50'),'u',_0xc1d6('0x51'));var _0x44899f=squel[_0xc1d6('0x48')]()[_0xc1d6('0x4a')](_0xc1d6('0x52'),'i')[_0xc1d6('0x4f')]('cm_contacts','c',_0xc1d6('0x53'))[_0xc1d6('0x4f')]('users','o',_0xc1d6('0x54'))[_0xc1d6('0x4f')](_0xc1d6('0x55'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0xc1d6('0x4f')]('openchannel_messages','me',_0xc1d6('0x56'))['left_join'](_0xc1d6('0x57'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0xc1d6('0x4f')](_0xc1d6('0x4b'),'t','t.id\x20=\x20it.TagId');var _0x3e592c=squel[_0xc1d6('0x58')]();var _0xb53334=[];var _0x414ec2=squel['expr']();var _0xfe3e36;if(_0x48f00f[_0xc1d6('0x3a')][_0xc1d6('0x59')]){_0xfe3e36=as['parseSearch'](_0x48f00f[_0xc1d6('0x3a')][_0xc1d6('0x59')]);var _0x4f9517=_0xfe3e36['sqlOperator'];for(var _0x33d43e=0x0;_0x33d43e<_0xfe3e36[_0xc1d6('0x5a')][_0xc1d6('0x41')];_0x33d43e++){var _0x2fb779=_0xfe3e36[_0xc1d6('0x5a')][_0x33d43e];var _0x316d1b='i';var _0x4c6bea=_[_0xc1d6('0x5b')](_0x348fbe,[_0xc1d6('0x2b'),_0x2fb779[_0xc1d6('0x49')]]);if(!_0x4c6bea){switch(_0x2fb779[_0xc1d6('0x49')]){case'unreadMessages':if(_0x2fb779[_0xc1d6('0x5c')]==0x1){_0x44899f['having']('`'+_0x2fb779[_0xc1d6('0x49')]+'`\x20=\x200');}else{_0x44899f[_0xc1d6('0x5d')]('`'+_0x2fb779[_0xc1d6('0x49')]+'`\x20>\x200');}break;case'Contact':if(_0x2fb779[_0xc1d6('0x5e')]===_0xc1d6('0x5f')){if(_0x2fb779[_0xc1d6('0x5c')][_0xc1d6('0x60')]('\x20')['length']>0x1){_0x3e592c[_0x4f9517](_0xc1d6('0x61'),qs[_0xc1d6('0x62')](_0x2fb779[_0xc1d6('0x5c')]),null);}else{var _0x2bcf87='%'+_0x2fb779[_0xc1d6('0x5c')]+'%';_0x3e592c[_0x4f9517](_0xc1d6('0x63'),_0x2bcf87,_0x2bcf87,_0x2bcf87);}}else{_0x4c6bea=_[_0xc1d6('0x5b')](_0x348fbe,[_0xc1d6('0x2b'),_0xc1d6('0x64')]);_0x2fb779['field']=_0xc1d6('0x64');_0x15beda=as[_0xc1d6('0x65')](_0x316d1b,_0x4c6bea[_0xc1d6('0x38')],_0x2fb779);_0x3e592c[_0x4f9517](_0x15beda[_0xc1d6('0x66')],_0x15beda['value']['start'],_0x15beda[_0xc1d6('0x5c')]['end']);}break;case _0xc1d6('0x67'):var _0x5585a1=_0x2fb779['value'][_0xc1d6('0x60')](',')[_0xc1d6('0x2e')](function(_0x56c9ea){return Number(_0x56c9ea);});_0x5585a1['forEach'](function(_0x10be3c){_0x414ec2['or'](_0xc1d6('0x68'),'%,'+_0x10be3c+',%');});_0xb53334=_[_0xc1d6('0x69')](_0xb53334,_0x5585a1);break;case _0xc1d6('0x6a'):if(_0x2fb779[_0xc1d6('0x5e')]==='$substring'){_0x3e592c[_0x4f9517](_0xc1d6('0x6b'),'%'+_0x2fb779[_0xc1d6('0x5c')]+'%',null);}else{_0x4c6bea=_['find'](_0x348fbe,[_0xc1d6('0x2b'),_0xc1d6('0x6c')]);_0x2fb779['field']=_0xc1d6('0x6c');_0x15beda=as[_0xc1d6('0x65')](_0x316d1b,_0x4c6bea[_0xc1d6('0x38')],_0x2fb779);_0x3e592c[_0x4f9517](_0x15beda[_0xc1d6('0x66')],_0x15beda['value'][_0xc1d6('0x6d')],_0x15beda[_0xc1d6('0x5c')]['end']);}break;case _0xc1d6('0x6e'):_0x15beda=as['buildExpression']('me',null,_0x2fb779);_0x3e592c[_0x4f9517](_0x15beda[_0xc1d6('0x66')],_0x15beda['value'][_0xc1d6('0x6d')],_0x15beda[_0xc1d6('0x5c')][_0xc1d6('0x1e')]);break;}}else{var _0x15beda=as[_0xc1d6('0x65')](_0x316d1b,_0x4c6bea[_0xc1d6('0x38')],_0x2fb779);_0x3e592c[_0x4f9517](_0x15beda[_0xc1d6('0x66')],_0x15beda['value'][_0xc1d6('0x6d')],_0x15beda[_0xc1d6('0x5c')][_0xc1d6('0x1e')]);}}}else{var _0xbeb11e=_(_0x48f00f[_0xc1d6('0x3a')])[_0xc1d6('0x3b')]()[_0xc1d6('0x2e')](function(_0x5029a7){return _[_0xc1d6('0x6f')](_0x348fbe,[_0xc1d6('0x2b'),_0x5029a7])?_0x5029a7:undefined;})[_0xc1d6('0x70')]()['value']();if(!_['isEmpty'](_0xbeb11e)){_0xbeb11e[_0xc1d6('0x31')](function(_0x349148){if(_0x349148===_0xc1d6('0x71')){_0x44899f[_0xc1d6('0x46')](_0xc1d6('0x72'),[]['concat'](_0x48f00f[_0xc1d6('0x3a')][_0x349148]));}else if(_0x349148==='createdAt'){var _0x31acf8=JSON[_0xc1d6('0x73')](_0x48f00f[_0xc1d6('0x3a')][_0x349148])['$gte'];var _0x4059c5=JSON['parse'](_0x48f00f[_0xc1d6('0x3a')][_0x349148])['$lte'];_0x44899f[_0xc1d6('0x46')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x31acf8,_0x4059c5);}else{if(_0x48f00f[_0xc1d6('0x3a')][_0x349148]==='null'){_0x44899f[_0xc1d6('0x46')]('i.'+_0x349148+'\x20IS\x20NULL');}else{_0x44899f['where']('i.'+_0x349148+_0xc1d6('0x74'),_0x48f00f[_0xc1d6('0x3a')][_0x349148]);}}});}if(_0x48f00f['query'][_0xc1d6('0x75')]){if(_0x48f00f[_0xc1d6('0x3a')]['read']==0x1){_0x44899f[_0xc1d6('0x5d')](_0xc1d6('0x76'));}else{_0x44899f[_0xc1d6('0x5d')](_0xc1d6('0x77'));}}if(_0x48f00f[_0xc1d6('0x3a')]['tag']){_0xb53334=_[_0xc1d6('0x78')](_0x48f00f['query']['tag'])?_0x48f00f[_0xc1d6('0x3a')][_0xc1d6('0x79')]:new Array(_0x48f00f[_0xc1d6('0x3a')][_0xc1d6('0x79')]);_0xb53334[_0xc1d6('0x31')](function(_0x4220d9){_0x414ec2['or'](_0xc1d6('0x68'),'%,'+_0x4220d9+',%');});}if(_0x48f00f[_0xc1d6('0x3a')][_0xc1d6('0x7a')]){var _0x45e923=_0x48f00f['query']['filter']['replace']('\x5c','\x5c\x5c')[_0xc1d6('0x7b')](/'/g,'\x27\x27');if(qs[_0xc1d6('0x7c')](_0x45e923)){_0x3e592c['or']('i.id\x20LIKE\x20?',_0x45e923+'%');}else{_0x3e592c['or'](_0xc1d6('0x7d'),qs[_0xc1d6('0x62')](_0x45e923))['or'](_0xc1d6('0x7e'),_0x45e923+'%')['or'](_0xc1d6('0x7f'),_0x45e923+'%');}}}_0x44899f[_0xc1d6('0x46')](_0x3e592c);_0x44899f[_0xc1d6('0x80')](_0xc1d6('0x81'));var _0x3b4b27={'type':db['Sequelize'][_0xc1d6('0x82')]['SELECT'],'raw':!![]};var _0x5a7cf7=_0x44899f['clone']();_0x5a7cf7[_0xc1d6('0x49')]('i.id');_0x5a7cf7[_0xc1d6('0x49')](_0xc1d6('0x83'),_0xc1d6('0x84'));if(_0x31a52b[_0xc1d6('0x44')]){_0x31a52b[_0xc1d6('0x44')]['forEach'](function(_0x598026){var _0x7ef941=_0x598026[0x0]===_0xc1d6('0x85')?_0x598026[0x0]:'i.'+_0x598026[0x0];_0x44899f[_0xc1d6('0x44')](_0x7ef941,_0x598026[0x1]===_0xc1d6('0x86')?![]:!![]);});}if(!_['isEmpty'](_0xb53334)){_0x44899f['having'](_0x414ec2);_0x5a7cf7[_0xc1d6('0x46')](_0xc1d6('0x87'),_0xb53334);}BPromise['resolve']()[_0xc1d6('0x28')](function(){if(!_0xfe3e36){if(_0x48f00f['query']['OpenchannelAccountId'])return;_0x5a7cf7[_0xc1d6('0x46')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x44899f[_0xc1d6('0x46')](_0xc1d6('0x88'));return;}if(_0x48f00f[_0xc1d6('0x89')]['role']!==_0xc1d6('0x8a'))return;return _0x48f00f['user']['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0xc1d6('0x28')](function(_0x1b5c20){if(_['isEmpty'](_0x1b5c20)){_0x5a7cf7[_0xc1d6('0x46')](_0xc1d6('0x8b'));_0x44899f[_0xc1d6('0x46')](_0xc1d6('0x8b'));}else{_0x5a7cf7[_0xc1d6('0x46')](_0xc1d6('0x72'),_['map'](_0x1b5c20,'id'));_0x44899f['where'](_0xc1d6('0x72'),_[_0xc1d6('0x2e')](_0x1b5c20,'id'));}});})[_0xc1d6('0x28')](function(){if(_0x48f00f[_0xc1d6('0x89')]['role']===_0xc1d6('0x8a')&&!_0xfe3e36&&!_0x48f00f[_0xc1d6('0x3a')][_0xc1d6('0x71')])return[];return db['sequelize'][_0xc1d6('0x3a')](_0x5a7cf7[_0xc1d6('0x8c')](),_0x3b4b27);})['then'](function(_0x4b2340){_0x314a34[_0xc1d6('0x22')]=_0x4b2340[_0xc1d6('0x41')];if(_0x314a34['count']===0x0)return[];return db[_0xc1d6('0x8d')][_0xc1d6('0x3a')](_0x58ef87['toString'](),_0x3b4b27)['then'](function(_0x5c44bf){_0x3081cd=_['keyBy'](_0x5c44bf,'id');_0x3b4b27=_[_0xc1d6('0x8e')](_0x3b4b27,{'model':db[_0xc1d6('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x48f00f[_0xc1d6('0x3a')][_0xc1d6('0x3f')]){_0x31a52b[_0xc1d6('0x40')][_0xc1d6('0x31')](function(_0x4b2c9c){_0x44899f['field']('i.'+_0x4b2c9c);});}else{_0x44899f[_0xc1d6('0x49')](_0xc1d6('0x83'),'unreadMessages');_0x44899f[_0xc1d6('0x49')](_0xc1d6('0x8f'),_0xc1d6('0x90'));_0x44899f[_0xc1d6('0x49')](_0xc1d6('0x91'),_0xc1d6('0x92'));_0x44899f[_0xc1d6('0x49')](_0xc1d6('0x93'),'contactName');_0x44899f['field'](_0xc1d6('0x94'));_0x44899f[_0xc1d6('0x49')](_0xc1d6('0x95'),'Contact.firstName');_0x44899f[_0xc1d6('0x49')](_0xc1d6('0x96'),_0xc1d6('0x97'));_0x44899f['field']('c.email',_0xc1d6('0x98'));_0x44899f[_0xc1d6('0x49')](_0xc1d6('0x99'),'Contact.phone');_0x44899f[_0xc1d6('0x49')]('c.mobile',_0xc1d6('0x9a'));_0x44899f['field']('c.fax',_0xc1d6('0x9b'));_0x44899f[_0xc1d6('0x49')](_0xc1d6('0x9c'),_0xc1d6('0x9d'));_0x44899f[_0xc1d6('0x49')](_0xc1d6('0x9e'),_0xc1d6('0x9f'));_0x44899f['field'](_0xc1d6('0xa0'),_0xc1d6('0x30'));}if(_0x31a52b[_0xc1d6('0x21')])_0x44899f[_0xc1d6('0x21')](_0x31a52b[_0xc1d6('0x21')]);if(_0x31a52b[_0xc1d6('0x1f')])_0x44899f[_0xc1d6('0x1f')](_0x31a52b[_0xc1d6('0x1f')]);return db['sequelize'][_0xc1d6('0x3a')](_0x44899f[_0xc1d6('0x8c')](),_0x3b4b27);})[_0xc1d6('0x28')](function(_0x485438){if(_0x485438[_0xc1d6('0x41')]>0x0)_0x1832fc['where'](_0xc1d6('0xa1'),_[_0xc1d6('0x2e')](_0x485438,'id'));return db[_0xc1d6('0x8d')]['query'](_0x1832fc[_0xc1d6('0x8c')](),_0x3b4b27)['then'](function(_0x1bde12){var _0x18be49=_[_0xc1d6('0xa2')](_0x1bde12,'OpenchannelInteractionId');var _0x210e0e=[];_0x485438[_0xc1d6('0x31')](function(_0x1e3a15){_0x210e0e[_0xc1d6('0x32')](updateOpenchannelInteraction(_0x1e3a15,_0x3081cd,_0x18be49));});return BPromise[_0xc1d6('0xa3')](_0x210e0e);});});})['then'](function(_0xd5531b){_0x314a34['rows']=_0xd5531b;return _0x314a34;})['then'](respondWithFilteredResult(_0x149453,_0x31a52b))[_0xc1d6('0x33')](handleError(_0x149453,null));};exports[_0xc1d6('0xa4')]=function(_0x226911,_0x81dbbd){var _0x376cfb={};if(_0x226911[_0xc1d6('0x3a')][_0xc1d6('0x38')]&&_0x226911[_0xc1d6('0x3a')][_0xc1d6('0x38')]===_0xc1d6('0x4a')){_0x376cfb[_0xc1d6('0x4a')]=_0x226911[_0xc1d6('0xa5')]['id'];}else{_0x376cfb['id']=_0x226911[_0xc1d6('0xa5')]['id'];}var _0x3a9af1={'raw':![],'where':_0x376cfb},_0x5c87cd={};_0x5c87cd[_0xc1d6('0x3d')]=_[_0xc1d6('0x3b')](db[_0xc1d6('0x35')][_0xc1d6('0x36')]);_0x5c87cd[_0xc1d6('0x3a')]=_[_0xc1d6('0x3b')](_0x226911[_0xc1d6('0x3a')]);_0x5c87cd['filters']=_[_0xc1d6('0x3e')](_0x5c87cd['model'],_0x5c87cd[_0xc1d6('0x3a')]);_0x3a9af1['attributes']=_['intersection'](_0x5c87cd['model'],qs[_0xc1d6('0x3f')](_0x226911[_0xc1d6('0x3a')][_0xc1d6('0x3f')]));_0x3a9af1[_0xc1d6('0x40')]=_0x3a9af1['attributes']['length']?_0x3a9af1[_0xc1d6('0x40')]:_0x5c87cd['model'];if(_0x226911[_0xc1d6('0x3a')][_0xc1d6('0xa6')]){_0x3a9af1[_0xc1d6('0xa7')]=[{'all':!![]}];}_0x3a9af1=_[_0xc1d6('0x8e')]({},_0x3a9af1,_0x226911[_0xc1d6('0xa8')]);return db[_0xc1d6('0x35')][_0xc1d6('0x5b')](_0x3a9af1)['then'](handleEntityNotFound(_0x81dbbd,null))[_0xc1d6('0x28')](respondWithResult(_0x81dbbd,null))[_0xc1d6('0x33')](handleError(_0x81dbbd,null));};exports['create']=function(_0x253519,_0x2f0866){return db[_0xc1d6('0x35')][_0xc1d6('0xa9')](_0x253519[_0xc1d6('0x6e')],{})[_0xc1d6('0x28')](respondWithResult(_0x2f0866,0xc9))[_0xc1d6('0x33')](handleError(_0x2f0866,null));};exports[_0xc1d6('0x26')]=function(_0x440556,_0x2988e8){if(_0x440556[_0xc1d6('0x6e')]['id']){delete _0x440556[_0xc1d6('0x6e')]['id'];}return db[_0xc1d6('0x35')][_0xc1d6('0x5b')]({'where':{'id':_0x440556[_0xc1d6('0xa5')]['id']}})[_0xc1d6('0x28')](handleEntityNotFound(_0x2988e8,null))[_0xc1d6('0x28')](saveUpdates(_0x440556[_0xc1d6('0x6e')],null))[_0xc1d6('0x28')](respondWithResult(_0x2988e8,null))[_0xc1d6('0x33')](handleError(_0x2988e8,null));};exports['destroy']=function(_0x52bdb9,_0xcd92f9){return db[_0xc1d6('0x35')]['find']({'where':{'id':_0x52bdb9[_0xc1d6('0xa5')]['id']}})[_0xc1d6('0x28')](handleEntityNotFound(_0xcd92f9,null))[_0xc1d6('0x28')](removeEntity(_0xcd92f9,null))[_0xc1d6('0x33')](handleError(_0xcd92f9,null));};exports['describe']=function(_0x3ab465,_0x33c675){return db['OpenchannelInteraction'][_0xc1d6('0xaa')]()['then'](respondWithResult(_0x33c675,null))[_0xc1d6('0x33')](handleError(_0x33c675,null));};exports[_0xc1d6('0xab')]=function(_0x184215,_0x49cc3c,_0x16b358){return db['OpenchannelMessage']['find']({'where':{'id':_0x184215['params']['id']}})[_0xc1d6('0x28')](handleEntityNotFound(_0x49cc3c,null))[_0xc1d6('0x28')](function(_0x51043a){if(_0x51043a){return _0x51043a[_0xc1d6('0xab')](_0x184215['body'][_0xc1d6('0xac')],_[_0xc1d6('0xad')](_0x184215[_0xc1d6('0x6e')],['ids','id'])||{});}})[_0xc1d6('0x28')](respondWithResult(_0x49cc3c,null))[_0xc1d6('0x33')](handleError(_0x49cc3c,null));};exports[_0xc1d6('0xae')]=function(_0x53a868,_0x4fc48a,_0x2c402d){var _0x3cee5a={'raw':![],'where':{}};var _0x2bb944={};var _0x27db7f={'count':0x0,'rows':[]};return db[_0xc1d6('0x35')][_0xc1d6('0xaf')]({'where':{'id':_0x53a868['params']['id']}})['then'](handleEntityNotFound(_0x4fc48a,null))[_0xc1d6('0x28')](function(_0x3f0a51){if(_0x3f0a51){_0x2bb944[_0xc1d6('0x3d')]=_['keys'](db[_0xc1d6('0xb0')][_0xc1d6('0x36')]);_0x2bb944[_0xc1d6('0x3a')]=_[_0xc1d6('0x3b')](_0x53a868[_0xc1d6('0x3a')]);_0x2bb944[_0xc1d6('0x3c')]=_[_0xc1d6('0x3e')](_0x2bb944['model'],_0x2bb944[_0xc1d6('0x3a')]);_0x3cee5a['attributes']=_['intersection'](_0x2bb944[_0xc1d6('0x3d')],qs[_0xc1d6('0x3f')](_0x53a868[_0xc1d6('0x3a')][_0xc1d6('0x3f')]));_0x3cee5a[_0xc1d6('0x40')]=_0x3cee5a[_0xc1d6('0x40')][_0xc1d6('0x41')]?_0x3cee5a[_0xc1d6('0x40')]:_0x2bb944[_0xc1d6('0x3d')];if(!_0x53a868[_0xc1d6('0x3a')][_0xc1d6('0x42')](_0xc1d6('0x43'))){_0x3cee5a[_0xc1d6('0x21')]=qs[_0xc1d6('0x21')](_0x53a868[_0xc1d6('0x3a')][_0xc1d6('0x21')]);_0x3cee5a[_0xc1d6('0x1f')]=qs['offset'](_0x53a868[_0xc1d6('0x3a')][_0xc1d6('0x1f')]);}_0x3cee5a[_0xc1d6('0x44')]=qs[_0xc1d6('0x45')](_0x53a868['query'][_0xc1d6('0x45')]);_0x3cee5a['where']=qs[_0xc1d6('0x3c')](_[_0xc1d6('0x47')](_0x53a868[_0xc1d6('0x3a')],_0x2bb944[_0xc1d6('0x3c')]));_0x3cee5a[_0xc1d6('0x46')]['OpenchannelInteractionId']=_0x3f0a51['id'];if(_0x53a868[_0xc1d6('0x3a')][_0xc1d6('0x7a')]){_0x3cee5a['where']=_[_0xc1d6('0x8e')](_0x3cee5a['where'],{'$or':_['map'](_0x3cee5a[_0xc1d6('0x40')],function(_0x1f90d8){var _0x147060={};_0x147060[_0x1f90d8]={'$like':'%'+_0x53a868[_0xc1d6('0x3a')][_0xc1d6('0x7a')]+'%'};return _0x147060;})});}if(_0x53a868['query']['$gte']){var _0x1a6355=_0x53a868[_0xc1d6('0x3a')][_0xc1d6('0xb1')][_0xc1d6('0x60')](',');var _0x1c6bb1={};_0x1c6bb1[_0x1a6355[0x0]]={'$gte':moment(_0x1a6355[0x1])[_0xc1d6('0xb2')](_0xc1d6('0xb3'))};_0x3cee5a[_0xc1d6('0x46')]=_[_0xc1d6('0x8e')](_0x3cee5a['where'],_0x1c6bb1);}_0x3cee5a=_[_0xc1d6('0x8e')]({},_0x3cee5a,_0x53a868['options']);return db['OpenchannelMessage']['count']({'where':_0x3cee5a[_0xc1d6('0x46')]})[_0xc1d6('0x28')](function(_0x1ca600){_0x27db7f['count']=_0x1ca600;if(_0x53a868[_0xc1d6('0x3a')][_0xc1d6('0xa6')]){_0x3cee5a[_0xc1d6('0xa7')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xc1d6('0xb4')](_0x3cee5a);})[_0xc1d6('0x28')](function(_0x377471){_0x27db7f[_0xc1d6('0xb5')]=_0x377471;return _0x27db7f;});}})['then'](respondWithFilteredResult(_0x4fc48a,_0x3cee5a))[_0xc1d6('0x33')](handleError(_0x4fc48a,null));};exports[_0xc1d6('0xb6')]=function(_0x40d2f3,_0x511ed2,_0x2ae8ce){return db[_0xc1d6('0x35')][_0xc1d6('0x5b')]({'where':{'id':_0x40d2f3[_0xc1d6('0xa5')]['id']}})[_0xc1d6('0x28')](handleEntityNotFound(_0x511ed2,null))[_0xc1d6('0x28')](function(_0x42d15f){if(_0x42d15f){return _0x42d15f[_0xc1d6('0xb7')](_0x40d2f3[_0xc1d6('0x6e')][_0xc1d6('0xac')],_[_0xc1d6('0xad')](_0x40d2f3['body'],[_0xc1d6('0xac'),'id'])||{})[_0xc1d6('0xb8')](function(){return db[_0xc1d6('0x67')][_0xc1d6('0xb4')]({'attributes':['id',_0xc1d6('0x2b'),_0xc1d6('0xb9')],'where':{'id':_0x40d2f3[_0xc1d6('0x6e')][_0xc1d6('0xac')]}});})[_0xc1d6('0x28')](function(_0x4df283){socket[_0xc1d6('0xba')]('openchannelInteractionTags:save',{'id':Number(_0x40d2f3['params']['id']),'tags':_0x4df283||[]});return{'id':Number(_0x40d2f3[_0xc1d6('0xa5')]['id']),'tags':_0x4df283||[]};});}})[_0xc1d6('0x28')](respondWithResult(_0x511ed2,null))[_0xc1d6('0x33')](handleError(_0x511ed2,null));};exports[_0xc1d6('0xbb')]=function(_0x785b43,_0x4505cb,_0x3ee0f6){return db[_0xc1d6('0x35')][_0xc1d6('0x5b')]({'where':{'id':_0x785b43[_0xc1d6('0xa5')]['id']}})[_0xc1d6('0x28')](handleEntityNotFound(_0x4505cb,null))[_0xc1d6('0x28')](function(_0x29ae3d){if(_0x29ae3d){return _0x29ae3d['removeTags'](_0x785b43[_0xc1d6('0x3a')][_0xc1d6('0xac')]);}})['then'](respondWithStatusCode(_0x4505cb,null))['catch'](handleError(_0x4505cb,null));};exports['download']=function(_0x2dc92d,_0x11e3b7){var _0x5b979b=moment()[_0xc1d6('0xbc')]()[_0xc1d6('0x8c')]();var _0x270e50=path[_0xc1d6('0xbd')](config[_0xc1d6('0xbe')],_0xc1d6('0xbf'),'files',_0xc1d6('0xc0'));var _0x18e3a0=path[_0xc1d6('0xbd')](config[_0xc1d6('0xbe')],_0xc1d6('0xbf'),_0xc1d6('0xc1'),'attachments');var _0x3e75c4=path[_0xc1d6('0xbd')](_0x270e50,_0x5b979b);var _0x2c0abd=util[_0xc1d6('0xb2')](_0xc1d6('0xc2'),_0x2dc92d['params']['id'],_0x5b979b);var _0x4c35b6=path[_0xc1d6('0xbd')](_0x270e50,_0x2c0abd);var _0xbf9b94=[];_0xbf9b94[_0xc1d6('0x32')]({'model':db[_0xc1d6('0x6a')],'as':_0xc1d6('0x6a'),'attributes':['id',_0xc1d6('0x2f')],'raw':!![]});_0xbf9b94['push']({'model':db[_0xc1d6('0xc3')],'as':'Contact','attributes':['id',_0xc1d6('0xc4'),_0xc1d6('0xc5')],'raw':!![]});if(_0x2dc92d[_0xc1d6('0x3a')][_0xc1d6('0xc6')]){_0xbf9b94[_0xc1d6('0x32')]({'model':db[_0xc1d6('0xc7')],'as':_0xc1d6('0xc7'),'raw':!![]});}var _0x5aed76=[{'model':db[_0xc1d6('0xb0')],'as':'Messages','attributes':['id',_0xc1d6('0x6e'),_0xc1d6('0xc8'),'direction',_0xc1d6('0xc9'),_0xc1d6('0x75')],'include':_0xbf9b94}];_0x5aed76[_0xc1d6('0x32')]({'model':db['OpenchannelAccount'],'as':_0xc1d6('0xca'),'attributes':['id','name']});_0x5aed76[_0xc1d6('0x32')]({'model':db['User'],'as':_0xc1d6('0xcb'),'attributes':['id',_0xc1d6('0x2f')]});return db[_0xc1d6('0x35')][_0xc1d6('0x5b')]({'where':{'id':_0x2dc92d[_0xc1d6('0xa5')]['id']},'include':_0x5aed76})[_0xc1d6('0x28')](handleEntityNotFound(_0x11e3b7,null))[_0xc1d6('0x28')](function(_0x588ecf){if(_0x588ecf){var _0x505ac9=_0x588ecf[_0xc1d6('0xcc')]({'plain':!![]});fs[_0xc1d6('0xcd')](_0x3e75c4);var _0x486111={'channel':'Openchannel','account':_0x505ac9[_0xc1d6('0xca')]['name'],'agent':_0x505ac9[_0xc1d6('0xcb')]?_0x505ac9[_0xc1d6('0xcb')]['fullname']:_0xc1d6('0xce'),'createdAt':moment(_0x505ac9[_0xc1d6('0xc8')])['format'](_0xc1d6('0xb3'))[_0xc1d6('0x8c')](),'closedAt':_0x505ac9[_0xc1d6('0xcf')]?moment(_0x505ac9[_0xc1d6('0xd0')])[_0xc1d6('0xb2')](_0xc1d6('0xb3'))[_0xc1d6('0x8c')]():'','disposition':_0x505ac9['disposition'],'visibility':_0x505ac9[_0xc1d6('0xd1')]?'Public':'Private','messages':_(_0x505ac9['Messages'])[_0xc1d6('0x7a')]({'secret':![]})[_0xc1d6('0x2e')](function(_0x3de435){if(_0x3de435[_0xc1d6('0xc7')]){var _0x123532=path[_0xc1d6('0xbd')](_0x18e3a0,_0x3de435['Attachment'][_0xc1d6('0xd2')]);if(fs[_0xc1d6('0xd3')](_0x123532)){fs[_0xc1d6('0xd4')](_0x123532)[_0xc1d6('0xd5')](fs['createWriteStream'](path[_0xc1d6('0xbd')](_0x3e75c4,_0x3de435[_0xc1d6('0xc7')][_0xc1d6('0xd2')])));}}return{'date':moment(_0x3de435[_0xc1d6('0xc8')])[_0xc1d6('0xb2')](_0xc1d6('0xb3'))[_0xc1d6('0x8c')](),'sender':_0x3de435[_0xc1d6('0xd6')]===_0xc1d6('0xd7')?_0x3de435['User']?_0x3de435[_0xc1d6('0x6a')][_0xc1d6('0x2f')]:_0xc1d6('0xd8'):_0x3de435[_0xc1d6('0xd9')]['firstName']+(_0x3de435[_0xc1d6('0xd9')]['lastName']?'\x20'+_0x3de435[_0xc1d6('0xd9')]['lastName']:''),'body':_0x3de435[_0xc1d6('0xc7')]?_0x3de435[_0xc1d6('0xc7')][_0xc1d6('0xd2')]:_0x3de435[_0xc1d6('0x6e')],'direction':_0x3de435[_0xc1d6('0xd6')]===_0xc1d6('0xd7')?'A':'C','secret':_0x3de435[_0xc1d6('0xc9')],'read':_0x3de435[_0xc1d6('0x75')],'attachment':_0x3de435[_0xc1d6('0xc7')]};})[_0xc1d6('0x5c')]()};return ejs[_0xc1d6('0xda')](path[_0xc1d6('0xbd')](config[_0xc1d6('0xbe')],_0xc1d6('0xbf'),_0xc1d6('0xdb'),_0xc1d6('0xdc')),{'interaction':_0x486111})[_0xc1d6('0x28')](function(_0x2ca089){var _0x578bb9=path[_0xc1d6('0xbd')](_0x3e75c4,'transcript-'+_0x505ac9['id']+'-'+_0x5b979b+'.pdf');var _0x2aa90a={'path':_0x578bb9,'channel':'Openchannel','interactionId':_0x505ac9['id']};return pdf[_0xc1d6('0xdd')](_0x2ca089,_0x2aa90a);})['then'](function(){return new BPromise(function(_0x4ee075,_0x35b6cb){zipdir(_0x3e75c4,{'saveTo':_0x4c35b6},function(_0x2d9000,_0x178494){if(_0x2d9000)return _0x35b6cb(_0x2d9000);return _0x4ee075(_0x178494);});})[_0xc1d6('0x28')](function(){return new BPromise(function(_0x2b7663,_0x3de54f){rimraf(_0x3e75c4,function(_0x56947b){if(_0x56947b)_0x3de54f(_0x56947b);return _0x2b7663();});});})[_0xc1d6('0x28')](function(){return _0x11e3b7['download'](_0x4c35b6,_0x2c0abd,function(_0x45551f){if(_0x45551f){console[_0xc1d6('0xde')](_0xc1d6('0xdf'),_0x45551f);}else{fs[_0xc1d6('0xe0')](_0x4c35b6);}});});});}else{return _0x11e3b7[_0xc1d6('0x1c')](0xc8);}})[_0xc1d6('0x33')](handleError(_0x11e3b7,null));}; \ No newline at end of file +var _0xd719=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/export/pdf','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','reject','then','destroy','stack','name','send','Users','map','fullname','Tags','TagIds','forEach','push','catch','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','tools_tags','select','u.fullname','ui.OpenchannelInteractionId','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','split','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','some','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','`unreadMessages`\x20=\x200','tag','isArray','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','i.OpenchannelAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','OpenchannelInteractionId','all','rows','show','params','includeAll','include','create','update','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','filter','format','options','addTags','spread','removeTags','download','join','root','server','files','tmp','attachments','User','CmContact','lastName','Attachment','Messages','direction','secret','read','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','Public','Private','existsSync','createReadStream','basename','firstName','out','renderFile','transcript-','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xd719,0xdb));var _0x9d71=function(_0x57bf99,_0xcfc71d){_0x57bf99=_0x57bf99-0x0;var _0x48af18=_0xd719[_0x57bf99];return _0x48af18;};'use strict';var emlformat=require(_0x9d71('0x0'));var rimraf=require(_0x9d71('0x1'));var zipdir=require(_0x9d71('0x2'));var jsonpatch=require(_0x9d71('0x3'));var rp=require(_0x9d71('0x4'));var moment=require(_0x9d71('0x5'));var BPromise=require(_0x9d71('0x6'));var Mustache=require(_0x9d71('0x7'));var util=require(_0x9d71('0x8'));var path=require(_0x9d71('0x9'));var sox=require('sox');var csv=require(_0x9d71('0xa'));var ejs=require(_0x9d71('0xb'));var fs=require('fs');var fs_extra=require(_0x9d71('0xc'));var _=require(_0x9d71('0xd'));var squel=require(_0x9d71('0xe'));var crypto=require('crypto');var jsforce=require(_0x9d71('0xf'));var deskjs=require(_0x9d71('0x10'));var toCsv=require(_0x9d71('0xa'));var querystring=require(_0x9d71('0x11'));var Papa=require(_0x9d71('0x12'));var Redis=require(_0x9d71('0x13'));var authService=require(_0x9d71('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x9d71('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9d71('0x16'));var utils=require('../../config/utils');var config=require(_0x9d71('0x17'));var licenseUtil=require(_0x9d71('0x18'));var db=require('../../mysqldb')['db'];config[_0x9d71('0x19')]=_[_0x9d71('0x1a')](config[_0x9d71('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x9d71('0x1b'))(new Redis(config[_0x9d71('0x19')]));require(_0x9d71('0x1c'))[_0x9d71('0x1d')](socket);function respondWithStatusCode(_0x82ed42,_0x4d86d0){_0x4d86d0=_0x4d86d0||0xcc;return function(_0x3d68c4){if(_0x3d68c4){return _0x82ed42[_0x9d71('0x1e')](_0x4d86d0);}return _0x82ed42[_0x9d71('0x1f')](_0x4d86d0)[_0x9d71('0x20')]();};}function respondWithResult(_0x4123dd,_0x3a330b){_0x3a330b=_0x3a330b||0xc8;return function(_0x17b8d1){if(_0x17b8d1){return _0x4123dd[_0x9d71('0x1f')](_0x3a330b)[_0x9d71('0x21')](_0x17b8d1);}};}function respondWithFilteredResult(_0x25bc54,_0xcefdb9){return function(_0x416e0a){if(_0x416e0a){var _0x1a5468=typeof _0xcefdb9[_0x9d71('0x22')]===_0x9d71('0x23')&&typeof _0xcefdb9['limit']===_0x9d71('0x23');var _0x476938=_0x416e0a[_0x9d71('0x24')];var _0x20542b=_0x1a5468?0x0:_0xcefdb9[_0x9d71('0x22')];var _0x31cfde=_0x1a5468?_0x416e0a[_0x9d71('0x24')]:_0xcefdb9[_0x9d71('0x22')]+_0xcefdb9[_0x9d71('0x25')];var _0x356871;if(_0x31cfde>=_0x476938){_0x31cfde=_0x476938;_0x356871=0xc8;}else{_0x356871=0xce;}_0x25bc54[_0x9d71('0x1f')](_0x356871);return _0x25bc54['set']('Content-Range',_0x20542b+'-'+_0x31cfde+'/'+_0x476938)['json'](_0x416e0a);}return null;};}function patchUpdates(_0x1d77c8){return function(_0x3ebb6c){try{jsonpatch['apply'](_0x3ebb6c,_0x1d77c8,!![]);}catch(_0x8bb7dd){return BPromise[_0x9d71('0x26')](_0x8bb7dd);}return _0x3ebb6c['save']();};}function saveUpdates(_0x1df6d1,_0x5efa9e){return function(_0x2fb898){if(_0x2fb898){return _0x2fb898['update'](_0x1df6d1)[_0x9d71('0x27')](function(_0x48f950){return _0x48f950;});}return null;};}function removeEntity(_0x4564b3,_0x5ed40a){return function(_0x1aa4c7){if(_0x1aa4c7){return _0x1aa4c7[_0x9d71('0x28')]()['then'](function(){_0x4564b3['status'](0xcc)[_0x9d71('0x20')]();});}};}function handleEntityNotFound(_0x5b5cb6,_0x401e3c){return function(_0xae6dab){if(!_0xae6dab){_0x5b5cb6[_0x9d71('0x1e')](0x194);}return _0xae6dab;};}function handleError(_0x2eb685,_0x1207ed){_0x1207ed=_0x1207ed||0x1f4;return function(_0xe3ecd4){logger['error'](_0xe3ecd4[_0x9d71('0x29')]);if(_0xe3ecd4[_0x9d71('0x2a')]){delete _0xe3ecd4[_0x9d71('0x2a')];}_0x2eb685[_0x9d71('0x1f')](_0x1207ed)[_0x9d71('0x2b')](_0xe3ecd4);};}function getInteractionUsers(_0x25303b,_0x3bd38e){return new BPromise(function(_0x349533,_0x4139fe){try{if(_0x3bd38e[_0x25303b['id']]){_0x25303b[_0x9d71('0x2c')]=_[_0x9d71('0x2d')](_0x3bd38e[_0x25303b['id']],function(_0x246239){return{'id':_0x246239['id'],'fullname':_0x246239[_0x9d71('0x2e')]};});}}catch(_0x161c2e){_0x4139fe(_0x161c2e);}_0x349533(_0x25303b);});}function getInteractionTags(_0x5c535f,_0x3f1b1f){return new BPromise(function(_0x352639,_0x24b368){try{if(_0x5c535f['TagIds']){_0x5c535f[_0x9d71('0x2f')]=[];_0x5c535f[_0x9d71('0x30')]['split'](',')[_0x9d71('0x31')](function(_0x2c0271){_0x5c535f[_0x9d71('0x2f')][_0x9d71('0x32')](_0x3f1b1f[_0x2c0271]);});}delete _0x5c535f['TagIds'];}catch(_0xcabe82){_0x24b368(_0xcabe82);}_0x352639(_0x5c535f);});}function updateOpenchannelInteraction(_0x18abf7,_0x2a38a3,_0x3128b4){return new BPromise(function(_0x538763,_0x30fd94){return getInteractionUsers(_0x18abf7,_0x3128b4)[_0x9d71('0x27')](function(_0x1c813a){return getInteractionTags(_0x1c813a,_0x2a38a3);})[_0x9d71('0x27')](function(_0x46add9){_0x538763(_0x46add9);})[_0x9d71('0x33')](function(_0x3c78a9){_0x30fd94(_0x3c78a9);});});}exports['index']=function(_0x2493c6,_0x5c9d79){var _0x2ca0fa={},_0x99f3e3={},_0x4f9b05={'count':0x0,'rows':[]};var _0x3bc8ca=_[_0x9d71('0x2d')](db[_0x9d71('0x34')][_0x9d71('0x35')],function(_0x2db804){return{'name':_0x2db804[_0x9d71('0x36')],'type':_0x2db804[_0x9d71('0x37')][_0x9d71('0x38')]};});_0x99f3e3[_0x9d71('0x39')]=_[_0x9d71('0x2d')](_0x3bc8ca,'name');_0x99f3e3['query']=_[_0x9d71('0x3a')](_0x2493c6[_0x9d71('0x3b')]);_0x99f3e3[_0x9d71('0x3c')]=_[_0x9d71('0x3d')](_0x99f3e3[_0x9d71('0x39')],_0x99f3e3[_0x9d71('0x3b')]);_0x2ca0fa[_0x9d71('0x3e')]=_['intersection'](_0x99f3e3['model'],qs[_0x9d71('0x3f')](_0x2493c6['query'][_0x9d71('0x3f')]));_0x2ca0fa[_0x9d71('0x3e')]=_0x2ca0fa[_0x9d71('0x3e')][_0x9d71('0x40')]?_0x2ca0fa[_0x9d71('0x3e')]:_0x99f3e3['model'];if(!_0x2493c6[_0x9d71('0x3b')][_0x9d71('0x41')](_0x9d71('0x42'))){_0x2ca0fa[_0x9d71('0x25')]=qs['limit'](_0x2493c6[_0x9d71('0x3b')]['limit']);_0x2ca0fa[_0x9d71('0x22')]=qs[_0x9d71('0x22')](_0x2493c6[_0x9d71('0x3b')]['offset']);}_0x2ca0fa[_0x9d71('0x43')]=qs[_0x9d71('0x44')](_0x2493c6[_0x9d71('0x3b')][_0x9d71('0x44')]);_0x2ca0fa[_0x9d71('0x45')]=qs[_0x9d71('0x3c')](_[_0x9d71('0x46')](_0x2493c6[_0x9d71('0x3b')],_0x99f3e3['filters']),_0x3bc8ca);var _0x46de18=[];var _0x56b72f=squel['select']()[_0x9d71('0x47')]('id')['field'](_0x9d71('0x2a'))[_0x9d71('0x47')](_0x9d71('0x48'))[_0x9d71('0x49')](_0x9d71('0x4a'));var _0x50a989=squel[_0x9d71('0x4b')]()[_0x9d71('0x47')]('u.id')[_0x9d71('0x47')](_0x9d71('0x4c'))[_0x9d71('0x47')](_0x9d71('0x4d'))['from']('user_has_openchannel_interactions','ui')[_0x9d71('0x4e')](_0x9d71('0x4f'),'u',_0x9d71('0x50'));var _0x194059=squel['select']()['from'](_0x9d71('0x51'),'i')[_0x9d71('0x4e')](_0x9d71('0x52'),'c',_0x9d71('0x53'))['left_join'](_0x9d71('0x4f'),'o',_0x9d71('0x54'))['left_join']('openchannel_accounts','a',_0x9d71('0x55'))['left_join'](_0x9d71('0x56'),'me',_0x9d71('0x57'))[_0x9d71('0x4e')](_0x9d71('0x58'),'it',_0x9d71('0x59'))[_0x9d71('0x4e')](_0x9d71('0x4a'),'t',_0x9d71('0x5a'));var _0x55a06c=squel[_0x9d71('0x5b')]();var _0x2539aa=[];var _0x14d2f3=squel[_0x9d71('0x5b')]();var _0x1078df;if(_0x2493c6['query'][_0x9d71('0x5c')]){_0x1078df=as[_0x9d71('0x5d')](_0x2493c6[_0x9d71('0x3b')][_0x9d71('0x5c')]);var _0x1df711=_0x1078df[_0x9d71('0x5e')];for(var _0x91ddb3=0x0;_0x91ddb3<_0x1078df[_0x9d71('0x5f')]['length'];_0x91ddb3++){var _0x51bac6=_0x1078df[_0x9d71('0x5f')][_0x91ddb3];var _0x438073='i';var _0x2031ef=_[_0x9d71('0x60')](_0x3bc8ca,[_0x9d71('0x2a'),_0x51bac6[_0x9d71('0x47')]]);if(!_0x2031ef){switch(_0x51bac6['field']){case'unreadMessages':if(_0x51bac6[_0x9d71('0x61')]==0x1){_0x194059[_0x9d71('0x62')]('`'+_0x51bac6[_0x9d71('0x47')]+_0x9d71('0x63'));}else{_0x194059[_0x9d71('0x62')]('`'+_0x51bac6[_0x9d71('0x47')]+_0x9d71('0x64'));}break;case _0x9d71('0x65'):if(_0x51bac6[_0x9d71('0x66')]==='$substring'){if(_0x51bac6[_0x9d71('0x61')][_0x9d71('0x67')]('\x20')['length']>0x1){_0x55a06c[_0x1df711]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x9d71('0x68')](_0x51bac6[_0x9d71('0x61')]),null);}else{var _0x3a944e='%'+_0x51bac6[_0x9d71('0x61')]+'%';_0x55a06c[_0x1df711](_0x9d71('0x69'),_0x3a944e,_0x3a944e,_0x3a944e);}}else{_0x2031ef=_[_0x9d71('0x60')](_0x3bc8ca,[_0x9d71('0x2a'),_0x9d71('0x6a')]);_0x51bac6[_0x9d71('0x47')]='ContactId';_0x224350=as[_0x9d71('0x6b')](_0x438073,_0x2031ef[_0x9d71('0x37')],_0x51bac6);_0x55a06c[_0x1df711](_0x224350['text'],_0x224350[_0x9d71('0x61')]['start'],_0x224350[_0x9d71('0x61')]['end']);}break;case _0x9d71('0x6c'):var _0x518120=_0x51bac6['value'][_0x9d71('0x67')](',')['map'](function(_0x31aad6){return Number(_0x31aad6);});_0x518120[_0x9d71('0x31')](function(_0x429fff){_0x14d2f3['or'](_0x9d71('0x6d'),'%,'+_0x429fff+',%');});_0x2539aa=_[_0x9d71('0x6e')](_0x2539aa,_0x518120);break;case'User':if(_0x51bac6[_0x9d71('0x66')]===_0x9d71('0x6f')){_0x55a06c[_0x1df711](_0x9d71('0x70'),'%'+_0x51bac6[_0x9d71('0x61')]+'%',null);}else{_0x2031ef=_['find'](_0x3bc8ca,[_0x9d71('0x2a'),_0x9d71('0x71')]);_0x51bac6[_0x9d71('0x47')]=_0x9d71('0x71');_0x224350=as[_0x9d71('0x6b')](_0x438073,_0x2031ef[_0x9d71('0x37')],_0x51bac6);_0x55a06c[_0x1df711](_0x224350[_0x9d71('0x72')],_0x224350['value']['start'],_0x224350['value'][_0x9d71('0x20')]);}break;case _0x9d71('0x73'):_0x224350=as[_0x9d71('0x6b')]('me',null,_0x51bac6);_0x55a06c[_0x1df711](_0x224350[_0x9d71('0x72')],_0x224350[_0x9d71('0x61')]['start'],_0x224350['value'][_0x9d71('0x20')]);break;}}else{var _0x224350=as['buildExpression'](_0x438073,_0x2031ef[_0x9d71('0x37')],_0x51bac6);_0x55a06c[_0x1df711](_0x224350[_0x9d71('0x72')],_0x224350['value']['start'],_0x224350[_0x9d71('0x61')][_0x9d71('0x20')]);}}}else{var _0x343d4f=_(_0x2493c6['query'])[_0x9d71('0x3a')]()['map'](function(_0x4eab3d){return _[_0x9d71('0x74')](_0x3bc8ca,[_0x9d71('0x2a'),_0x4eab3d])?_0x4eab3d:undefined;})['compact']()[_0x9d71('0x61')]();if(!_[_0x9d71('0x75')](_0x343d4f)){_0x343d4f['forEach'](function(_0xb07374){if(_0xb07374===_0x9d71('0x76')){_0x194059[_0x9d71('0x45')](_0x9d71('0x77'),[][_0x9d71('0x78')](_0x2493c6[_0x9d71('0x3b')][_0xb07374]));}else if(_0xb07374===_0x9d71('0x79')){var _0x1b82fc=JSON[_0x9d71('0x7a')](_0x2493c6[_0x9d71('0x3b')][_0xb07374])[_0x9d71('0x7b')];var _0x5ae8a8=JSON[_0x9d71('0x7a')](_0x2493c6[_0x9d71('0x3b')][_0xb07374])[_0x9d71('0x7c')];_0x194059[_0x9d71('0x45')](_0x9d71('0x7d'),_0x1b82fc,_0x5ae8a8);}else{if(_0x2493c6[_0x9d71('0x3b')][_0xb07374]===_0x9d71('0x7e')){_0x194059[_0x9d71('0x45')]('i.'+_0xb07374+_0x9d71('0x7f'));}else{_0x194059['where']('i.'+_0xb07374+'\x20=\x20?',_0x2493c6[_0x9d71('0x3b')][_0xb07374]);}}});}if(_0x2493c6[_0x9d71('0x3b')]['read']){if(_0x2493c6[_0x9d71('0x3b')]['read']==0x1){_0x194059['having'](_0x9d71('0x80'));}else{_0x194059['having']('`unreadMessages`\x20>\x200');}}if(_0x2493c6[_0x9d71('0x3b')][_0x9d71('0x81')]){_0x2539aa=_[_0x9d71('0x82')](_0x2493c6[_0x9d71('0x3b')]['tag'])?_0x2493c6[_0x9d71('0x3b')][_0x9d71('0x81')]:new Array(_0x2493c6[_0x9d71('0x3b')][_0x9d71('0x81')]);_0x2539aa[_0x9d71('0x31')](function(_0x442a13){_0x14d2f3['or'](_0x9d71('0x6d'),'%,'+_0x442a13+',%');});}if(_0x2493c6[_0x9d71('0x3b')]['filter']){var _0x306402=_0x2493c6['query']['filter'][_0x9d71('0x83')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x306402)){_0x55a06c['or'](_0x9d71('0x84'),_0x306402+'%');}else{_0x55a06c['or'](_0x9d71('0x85'),qs[_0x9d71('0x68')](_0x306402))['or'](_0x9d71('0x86'),_0x306402+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x306402+'%');}}}_0x194059[_0x9d71('0x45')](_0x55a06c);_0x194059[_0x9d71('0x87')](_0x9d71('0x88'));var _0x5c740c={'type':db[_0x9d71('0x89')][_0x9d71('0x8a')]['SELECT'],'raw':!![]};var _0x56e413=_0x194059[_0x9d71('0x8b')]();_0x56e413[_0x9d71('0x47')](_0x9d71('0x88'));_0x56e413['field'](_0x9d71('0x8c'),_0x9d71('0x8d'));if(_0x2ca0fa[_0x9d71('0x43')]){_0x2ca0fa[_0x9d71('0x43')][_0x9d71('0x31')](function(_0x375cf5){var _0x1c2d7e=_0x375cf5[0x0]===_0x9d71('0x8e')?_0x375cf5[0x0]:'i.'+_0x375cf5[0x0];_0x194059['order'](_0x1c2d7e,_0x375cf5[0x1]===_0x9d71('0x8f')?![]:!![]);});}if(!_[_0x9d71('0x75')](_0x2539aa)){_0x194059[_0x9d71('0x62')](_0x14d2f3);_0x56e413['where'](_0x9d71('0x90'),_0x2539aa);}BPromise[_0x9d71('0x91')]()[_0x9d71('0x27')](function(){if(!_0x1078df){if(_0x2493c6[_0x9d71('0x3b')][_0x9d71('0x76')])return;_0x56e413[_0x9d71('0x45')](_0x9d71('0x92'));_0x194059[_0x9d71('0x45')](_0x9d71('0x92'));return;}if(_0x2493c6[_0x9d71('0x93')]['role']!==_0x9d71('0x94'))return;return _0x2493c6[_0x9d71('0x93')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x9d71('0x27')](function(_0x2f7137){if(_[_0x9d71('0x75')](_0x2f7137)){_0x56e413[_0x9d71('0x45')](_0x9d71('0x95'));_0x194059[_0x9d71('0x45')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x56e413[_0x9d71('0x45')](_0x9d71('0x77'),_[_0x9d71('0x2d')](_0x2f7137,'id'));_0x194059[_0x9d71('0x45')](_0x9d71('0x77'),_[_0x9d71('0x2d')](_0x2f7137,'id'));}});})[_0x9d71('0x27')](function(){if(_0x2493c6[_0x9d71('0x93')][_0x9d71('0x96')]===_0x9d71('0x94')&&!_0x1078df&&!_0x2493c6['query'][_0x9d71('0x76')])return[];return db[_0x9d71('0x97')][_0x9d71('0x3b')](_0x56e413[_0x9d71('0x98')](),_0x5c740c);})['then'](function(_0x109984){_0x4f9b05[_0x9d71('0x24')]=_0x109984[_0x9d71('0x40')];if(_0x4f9b05[_0x9d71('0x24')]===0x0)return[];return db[_0x9d71('0x97')][_0x9d71('0x3b')](_0x56b72f[_0x9d71('0x98')](),_0x5c740c)[_0x9d71('0x27')](function(_0x175b07){_0x46de18=_[_0x9d71('0x99')](_0x175b07,'id');_0x5c740c=_[_0x9d71('0x9a')](_0x5c740c,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2493c6[_0x9d71('0x3b')][_0x9d71('0x3f')]){_0x2ca0fa[_0x9d71('0x3e')][_0x9d71('0x31')](function(_0x22f11e){_0x194059[_0x9d71('0x47')]('i.'+_0x22f11e);});}else{_0x194059[_0x9d71('0x47')](_0x9d71('0x8c'),'unreadMessages');_0x194059[_0x9d71('0x47')]('a.key','Account.key');_0x194059['field'](_0x9d71('0x9b'),_0x9d71('0x9c'));_0x194059[_0x9d71('0x47')](_0x9d71('0x9d'),_0x9d71('0x8e'));_0x194059[_0x9d71('0x47')]('i.*');_0x194059[_0x9d71('0x47')](_0x9d71('0x9e'),_0x9d71('0x9f'));_0x194059['field'](_0x9d71('0xa0'),'Contact.lastName');_0x194059[_0x9d71('0x47')](_0x9d71('0xa1'),_0x9d71('0xa2'));_0x194059[_0x9d71('0x47')](_0x9d71('0xa3'),'Contact.phone');_0x194059[_0x9d71('0x47')](_0x9d71('0xa4'),_0x9d71('0xa5'));_0x194059[_0x9d71('0x47')](_0x9d71('0xa6'),_0x9d71('0xa7'));_0x194059['field'](_0x9d71('0xa8'),_0x9d71('0xa9'));_0x194059['field']('o.internal',_0x9d71('0xaa'));_0x194059[_0x9d71('0x47')](_0x9d71('0xab'),_0x9d71('0x30'));}if(_0x2ca0fa[_0x9d71('0x25')])_0x194059[_0x9d71('0x25')](_0x2ca0fa[_0x9d71('0x25')]);if(_0x2ca0fa[_0x9d71('0x22')])_0x194059['offset'](_0x2ca0fa[_0x9d71('0x22')]);return db[_0x9d71('0x97')][_0x9d71('0x3b')](_0x194059[_0x9d71('0x98')](),_0x5c740c);})[_0x9d71('0x27')](function(_0xf01aaa){if(_0xf01aaa[_0x9d71('0x40')]>0x0)_0x50a989[_0x9d71('0x45')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0x9d71('0x2d')](_0xf01aaa,'id'));return db[_0x9d71('0x97')][_0x9d71('0x3b')](_0x50a989[_0x9d71('0x98')](),_0x5c740c)['then'](function(_0x5d0f2f){var _0x3aa9d9=_[_0x9d71('0xac')](_0x5d0f2f,_0x9d71('0xad'));var _0x19af24=[];_0xf01aaa[_0x9d71('0x31')](function(_0x5cadc5){_0x19af24[_0x9d71('0x32')](updateOpenchannelInteraction(_0x5cadc5,_0x46de18,_0x3aa9d9));});return BPromise[_0x9d71('0xae')](_0x19af24);});});})[_0x9d71('0x27')](function(_0x3bd139){_0x4f9b05[_0x9d71('0xaf')]=_0x3bd139;return _0x4f9b05;})[_0x9d71('0x27')](respondWithFilteredResult(_0x5c9d79,_0x2ca0fa))[_0x9d71('0x33')](handleError(_0x5c9d79,null));};exports[_0x9d71('0xb0')]=function(_0x1febb3,_0x2a4a84){var _0x585096={};if(_0x1febb3['query'][_0x9d71('0x37')]&&_0x1febb3[_0x9d71('0x3b')]['type']===_0x9d71('0x49')){_0x585096[_0x9d71('0x49')]=_0x1febb3[_0x9d71('0xb1')]['id'];}else{_0x585096['id']=_0x1febb3[_0x9d71('0xb1')]['id'];}var _0x1d40f1={'raw':![],'where':_0x585096},_0x52d3cb={};_0x52d3cb[_0x9d71('0x39')]=_[_0x9d71('0x3a')](db[_0x9d71('0x34')][_0x9d71('0x35')]);_0x52d3cb[_0x9d71('0x3b')]=_['keys'](_0x1febb3['query']);_0x52d3cb['filters']=_[_0x9d71('0x3d')](_0x52d3cb[_0x9d71('0x39')],_0x52d3cb[_0x9d71('0x3b')]);_0x1d40f1[_0x9d71('0x3e')]=_['intersection'](_0x52d3cb[_0x9d71('0x39')],qs['fields'](_0x1febb3[_0x9d71('0x3b')][_0x9d71('0x3f')]));_0x1d40f1[_0x9d71('0x3e')]=_0x1d40f1[_0x9d71('0x3e')][_0x9d71('0x40')]?_0x1d40f1[_0x9d71('0x3e')]:_0x52d3cb[_0x9d71('0x39')];if(_0x1febb3[_0x9d71('0x3b')][_0x9d71('0xb2')]){_0x1d40f1[_0x9d71('0xb3')]=[{'all':!![]}];}_0x1d40f1=_[_0x9d71('0x9a')]({},_0x1d40f1,_0x1febb3['options']);return db['OpenchannelInteraction'][_0x9d71('0x60')](_0x1d40f1)[_0x9d71('0x27')](handleEntityNotFound(_0x2a4a84,null))[_0x9d71('0x27')](respondWithResult(_0x2a4a84,null))[_0x9d71('0x33')](handleError(_0x2a4a84,null));};exports[_0x9d71('0xb4')]=function(_0x76bf4f,_0x3cb440){return db['OpenchannelInteraction'][_0x9d71('0xb4')](_0x76bf4f['body'],{})[_0x9d71('0x27')](respondWithResult(_0x3cb440,0xc9))[_0x9d71('0x33')](handleError(_0x3cb440,null));};exports[_0x9d71('0xb5')]=function(_0x2f0c34,_0x3d157a){if(_0x2f0c34[_0x9d71('0x73')]['id']){delete _0x2f0c34[_0x9d71('0x73')]['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x2f0c34[_0x9d71('0xb1')]['id']}})[_0x9d71('0x27')](handleEntityNotFound(_0x3d157a,null))[_0x9d71('0x27')](saveUpdates(_0x2f0c34['body'],null))[_0x9d71('0x27')](respondWithResult(_0x3d157a,null))[_0x9d71('0x33')](handleError(_0x3d157a,null));};exports[_0x9d71('0x28')]=function(_0x122bf7,_0x645625){return db['OpenchannelInteraction'][_0x9d71('0x60')]({'where':{'id':_0x122bf7[_0x9d71('0xb1')]['id']}})[_0x9d71('0x27')](handleEntityNotFound(_0x645625,null))[_0x9d71('0x27')](removeEntity(_0x645625,null))[_0x9d71('0x33')](handleError(_0x645625,null));};exports[_0x9d71('0xb6')]=function(_0x2de7ab,_0x1c9aeb){return db[_0x9d71('0x34')]['describe']()[_0x9d71('0x27')](respondWithResult(_0x1c9aeb,null))[_0x9d71('0x33')](handleError(_0x1c9aeb,null));};exports[_0x9d71('0xb7')]=function(_0xf151ab,_0x296328,_0x3cd0e7){return db[_0x9d71('0xb8')][_0x9d71('0x60')]({'where':{'id':_0xf151ab[_0x9d71('0xb1')]['id']}})['then'](handleEntityNotFound(_0x296328,null))[_0x9d71('0x27')](function(_0x2280a9){if(_0x2280a9){return _0x2280a9[_0x9d71('0xb7')](_0xf151ab[_0x9d71('0x73')][_0x9d71('0xb9')],_[_0x9d71('0xba')](_0xf151ab[_0x9d71('0x73')],[_0x9d71('0xb9'),'id'])||{});}})[_0x9d71('0x27')](respondWithResult(_0x296328,null))[_0x9d71('0x33')](handleError(_0x296328,null));};exports[_0x9d71('0xbb')]=function(_0x592b87,_0xf6cb4e,_0x3caa03){var _0x40cfbe={'raw':![],'where':{}};var _0xd574da={};var _0x4647db={'count':0x0,'rows':[]};return db[_0x9d71('0x34')][_0x9d71('0xbc')]({'where':{'id':_0x592b87[_0x9d71('0xb1')]['id']}})[_0x9d71('0x27')](handleEntityNotFound(_0xf6cb4e,null))[_0x9d71('0x27')](function(_0xa21a35){if(_0xa21a35){_0xd574da[_0x9d71('0x39')]=_[_0x9d71('0x3a')](db[_0x9d71('0xb8')][_0x9d71('0x35')]);_0xd574da[_0x9d71('0x3b')]=_[_0x9d71('0x3a')](_0x592b87['query']);_0xd574da[_0x9d71('0x3c')]=_['intersection'](_0xd574da[_0x9d71('0x39')],_0xd574da[_0x9d71('0x3b')]);_0x40cfbe['attributes']=_[_0x9d71('0x3d')](_0xd574da[_0x9d71('0x39')],qs[_0x9d71('0x3f')](_0x592b87[_0x9d71('0x3b')][_0x9d71('0x3f')]));_0x40cfbe[_0x9d71('0x3e')]=_0x40cfbe['attributes'][_0x9d71('0x40')]?_0x40cfbe['attributes']:_0xd574da[_0x9d71('0x39')];if(!_0x592b87[_0x9d71('0x3b')][_0x9d71('0x41')]('nolimit')){_0x40cfbe[_0x9d71('0x25')]=qs['limit'](_0x592b87[_0x9d71('0x3b')][_0x9d71('0x25')]);_0x40cfbe[_0x9d71('0x22')]=qs['offset'](_0x592b87[_0x9d71('0x3b')][_0x9d71('0x22')]);}_0x40cfbe[_0x9d71('0x43')]=qs['sort'](_0x592b87['query'][_0x9d71('0x44')]);_0x40cfbe[_0x9d71('0x45')]=qs[_0x9d71('0x3c')](_[_0x9d71('0x46')](_0x592b87['query'],_0xd574da['filters']));_0x40cfbe[_0x9d71('0x45')][_0x9d71('0xad')]=_0xa21a35['id'];if(_0x592b87['query'][_0x9d71('0xbd')]){_0x40cfbe[_0x9d71('0x45')]=_[_0x9d71('0x9a')](_0x40cfbe[_0x9d71('0x45')],{'$or':_[_0x9d71('0x2d')](_0x40cfbe[_0x9d71('0x3e')],function(_0x3db8fc){var _0x194600={};_0x194600[_0x3db8fc]={'$like':'%'+_0x592b87['query'][_0x9d71('0xbd')]+'%'};return _0x194600;})});}if(_0x592b87['query'][_0x9d71('0x7b')]){var _0x2a1717=_0x592b87['query'][_0x9d71('0x7b')][_0x9d71('0x67')](',');var _0x2854a2={};_0x2854a2[_0x2a1717[0x0]]={'$gte':moment(_0x2a1717[0x1])[_0x9d71('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x40cfbe[_0x9d71('0x45')]=_[_0x9d71('0x9a')](_0x40cfbe[_0x9d71('0x45')],_0x2854a2);}_0x40cfbe=_[_0x9d71('0x9a')]({},_0x40cfbe,_0x592b87[_0x9d71('0xbf')]);return db[_0x9d71('0xb8')][_0x9d71('0x24')]({'where':_0x40cfbe['where']})['then'](function(_0x445693){_0x4647db[_0x9d71('0x24')]=_0x445693;if(_0x592b87[_0x9d71('0x3b')][_0x9d71('0xb2')]){_0x40cfbe[_0x9d71('0xb3')]=[{'all':!![]}];}return db[_0x9d71('0xb8')]['findAll'](_0x40cfbe);})['then'](function(_0xdfdd59){_0x4647db['rows']=_0xdfdd59;return _0x4647db;});}})[_0x9d71('0x27')](respondWithFilteredResult(_0xf6cb4e,_0x40cfbe))[_0x9d71('0x33')](handleError(_0xf6cb4e,null));};exports[_0x9d71('0xc0')]=function(_0x4fe02b,_0x17f6ff,_0xe468a8){return db['OpenchannelInteraction'][_0x9d71('0x60')]({'where':{'id':_0x4fe02b[_0x9d71('0xb1')]['id']}})[_0x9d71('0x27')](handleEntityNotFound(_0x17f6ff,null))[_0x9d71('0x27')](function(_0x5955e8){if(_0x5955e8){return _0x5955e8['setTags'](_0x4fe02b[_0x9d71('0x73')][_0x9d71('0xb9')],_[_0x9d71('0xba')](_0x4fe02b[_0x9d71('0x73')],[_0x9d71('0xb9'),'id'])||{})[_0x9d71('0xc1')](function(){return db['Tag']['findAll']({'attributes':['id',_0x9d71('0x2a'),_0x9d71('0x48')],'where':{'id':_0x4fe02b['body'][_0x9d71('0xb9')]}});})[_0x9d71('0x27')](function(_0x31e7c2){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x4fe02b[_0x9d71('0xb1')]['id']),'tags':_0x31e7c2||[]});return{'id':Number(_0x4fe02b[_0x9d71('0xb1')]['id']),'tags':_0x31e7c2||[]};});}})[_0x9d71('0x27')](respondWithResult(_0x17f6ff,null))[_0x9d71('0x33')](handleError(_0x17f6ff,null));};exports['removeTags']=function(_0x3aae73,_0x5a3109,_0x451dcd){return db[_0x9d71('0x34')][_0x9d71('0x60')]({'where':{'id':_0x3aae73['params']['id']}})[_0x9d71('0x27')](handleEntityNotFound(_0x5a3109,null))[_0x9d71('0x27')](function(_0xe1864){if(_0xe1864){return _0xe1864[_0x9d71('0xc2')](_0x3aae73[_0x9d71('0x3b')]['ids']);}})[_0x9d71('0x27')](respondWithStatusCode(_0x5a3109,null))[_0x9d71('0x33')](handleError(_0x5a3109,null));};exports[_0x9d71('0xc3')]=function(_0xd35986,_0x44e76f){var _0x16dc47=moment()['unix']()[_0x9d71('0x98')]();var _0x5538ac=path[_0x9d71('0xc4')](config[_0x9d71('0xc5')],_0x9d71('0xc6'),_0x9d71('0xc7'),_0x9d71('0xc8'));var _0x44a046=path[_0x9d71('0xc4')](config[_0x9d71('0xc5')],_0x9d71('0xc6'),_0x9d71('0xc7'),_0x9d71('0xc9'));var _0x10a546=path['join'](_0x5538ac,_0x16dc47);var _0x3af666=util[_0x9d71('0xbe')]('transcript-%d-%s.zip',_0xd35986[_0x9d71('0xb1')]['id'],_0x16dc47);var _0x5c24f6=path[_0x9d71('0xc4')](_0x5538ac,_0x3af666);var _0x305106=[];_0x305106[_0x9d71('0x32')]({'model':db[_0x9d71('0xca')],'as':_0x9d71('0xca'),'attributes':['id',_0x9d71('0x2e')],'raw':!![]});_0x305106['push']({'model':db[_0x9d71('0xcb')],'as':_0x9d71('0x65'),'attributes':['id','firstName',_0x9d71('0xcc')],'raw':!![]});if(_0xd35986[_0x9d71('0x3b')][_0x9d71('0xc9')]){_0x305106[_0x9d71('0x32')]({'model':db[_0x9d71('0xcd')],'as':'Attachment','raw':!![]});}var _0xdf73d1=[{'model':db[_0x9d71('0xb8')],'as':_0x9d71('0xce'),'attributes':['id','body',_0x9d71('0x79'),_0x9d71('0xcf'),_0x9d71('0xd0'),_0x9d71('0xd1')],'include':_0x305106}];_0xdf73d1[_0x9d71('0x32')]({'model':db[_0x9d71('0xd2')],'as':_0x9d71('0xd3'),'attributes':['id',_0x9d71('0x2a')]});_0xdf73d1['push']({'model':db[_0x9d71('0xca')],'as':_0x9d71('0xd4'),'attributes':['id',_0x9d71('0x2e')]});return db[_0x9d71('0x34')][_0x9d71('0x60')]({'where':{'id':_0xd35986[_0x9d71('0xb1')]['id']},'include':_0xdf73d1})[_0x9d71('0x27')](handleEntityNotFound(_0x44e76f,null))[_0x9d71('0x27')](function(_0x4dd3de){if(_0x4dd3de){var _0x3ec79a=_0x4dd3de[_0x9d71('0xd5')]({'plain':!![]});fs[_0x9d71('0xd6')](_0x10a546);var _0x418c5c={'channel':_0x9d71('0xd7'),'account':_0x3ec79a[_0x9d71('0xd3')][_0x9d71('0x2a')],'agent':_0x3ec79a[_0x9d71('0xd4')]?_0x3ec79a[_0x9d71('0xd4')]['fullname']:'N.A.','createdAt':moment(_0x3ec79a[_0x9d71('0x79')])[_0x9d71('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')[_0x9d71('0x98')](),'closedAt':_0x3ec79a[_0x9d71('0xd8')]?moment(_0x3ec79a[_0x9d71('0xd9')])[_0x9d71('0xbe')](_0x9d71('0xda'))[_0x9d71('0x98')]():'','disposition':_0x3ec79a[_0x9d71('0xdb')],'visibility':_0x3ec79a['threadId']?_0x9d71('0xdc'):_0x9d71('0xdd'),'messages':_(_0x3ec79a[_0x9d71('0xce')])['filter']({'secret':![]})[_0x9d71('0x2d')](function(_0x3ccea8){if(_0x3ccea8[_0x9d71('0xcd')]){var _0xe13142=path['join'](_0x44a046,_0x3ccea8[_0x9d71('0xcd')]['basename']);if(fs[_0x9d71('0xde')](_0xe13142)){fs[_0x9d71('0xdf')](_0xe13142)['pipe'](fs['createWriteStream'](path[_0x9d71('0xc4')](_0x10a546,_0x3ccea8[_0x9d71('0xcd')][_0x9d71('0xe0')])));}}return{'date':moment(_0x3ccea8[_0x9d71('0x79')])['format'](_0x9d71('0xda'))[_0x9d71('0x98')](),'sender':_0x3ccea8[_0x9d71('0xcf')]==='out'?_0x3ccea8[_0x9d71('0xca')]?_0x3ccea8[_0x9d71('0xca')]['fullname']:'System':_0x3ccea8['Contact'][_0x9d71('0xe1')]+(_0x3ccea8[_0x9d71('0x65')][_0x9d71('0xcc')]?'\x20'+_0x3ccea8[_0x9d71('0x65')][_0x9d71('0xcc')]:''),'body':_0x3ccea8['Attachment']?_0x3ccea8['Attachment'][_0x9d71('0xe0')]:_0x3ccea8[_0x9d71('0x73')],'direction':_0x3ccea8['direction']===_0x9d71('0xe2')?'A':'C','secret':_0x3ccea8['secret'],'read':_0x3ccea8[_0x9d71('0xd1')],'attachment':_0x3ccea8['Attachment']};})[_0x9d71('0x61')]()};return ejs[_0x9d71('0xe3')](path['join'](config[_0x9d71('0xc5')],_0x9d71('0xc6'),'views','downloadInteraction.ejs'),{'interaction':_0x418c5c})['then'](function(_0x24366b){var _0x3412a5=path[_0x9d71('0xc4')](_0x10a546,_0x9d71('0xe4')+_0x3ec79a['id']+'-'+_0x16dc47+'.pdf');var _0x138fd2={'path':_0x3412a5,'channel':_0x9d71('0xd7'),'interactionId':_0x3ec79a['id']};return pdf['createPdfFromHTML'](_0x24366b,_0x138fd2);})[_0x9d71('0x27')](function(){return new BPromise(function(_0x4edb3c,_0x23ebb1){zipdir(_0x10a546,{'saveTo':_0x5c24f6},function(_0x261ea2,_0x304ff1){if(_0x261ea2)return _0x23ebb1(_0x261ea2);return _0x4edb3c(_0x304ff1);});})['then'](function(){return new BPromise(function(_0xb056e4,_0x1dc3c2){rimraf(_0x10a546,function(_0x17426f){if(_0x17426f)_0x1dc3c2(_0x17426f);return _0xb056e4();});});})[_0x9d71('0x27')](function(){return _0x44e76f[_0x9d71('0xc3')](_0x5c24f6,_0x3af666,function(_0x30e98e){if(_0x30e98e){console[_0x9d71('0xe5')](_0x9d71('0xe6'),_0x30e98e);}else{fs[_0x9d71('0xe7')](_0x5c24f6);}});});});}else{return _0x44e76f[_0x9d71('0x1e')](0xc8);}})['catch'](handleError(_0x44e76f,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 708c027..2fed43b 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 _0xbf93=['getUsers','Users','findAll','then','setDataValue','length','emit','catch','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xbf93,0x14d));var _0x3bf9=function(_0x2f4096,_0x285079){_0x2f4096=_0x2f4096-0x0;var _0x598fa2=_0xbf93[_0x2f4096];return _0x598fa2;};'use strict';var EventEmitter=require(_0x3bf9('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x3bf9('0x1'))['db'][_0x3bf9('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x3bf9('0x3')](0x0);var events={'afterCreate':_0x3bf9('0x4'),'afterUpdate':_0x3bf9('0x5'),'afterDestroy':_0x3bf9('0x6')};function emitEvent(_0x407832){return function(_0x28ade7,_0x53a72c,_0x1d0159){_0x28ade7[_0x3bf9('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1a0ac0){_0x28ade7['setDataValue'](_0x3bf9('0x8'),_0x1a0ac0['map'](function(_0xa828b){return{'id':_0xa828b['id']};}));return OpenchannelMessage[_0x3bf9('0x9')]({'where':{'OpenchannelInteractionId':_0x28ade7['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3bf9('0xa')](function(_0xc7dec6){_0x28ade7[_0x3bf9('0xb')]('unreadMessages',_0xc7dec6[_0x3bf9('0xc')]);OpenchannelInteractionEvents[_0x3bf9('0xd')](_0x407832+':'+_0x28ade7['id'],_0x28ade7);OpenchannelInteractionEvents['emit'](_0x407832,_0x28ade7);_0x1d0159(null);})[_0x3bf9('0xe')](_0x1d0159(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x3bf9('0xf')](e,emitEvent(event));}}module[_0x3bf9('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x3898=['../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','getUsers','then','setDataValue','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events'];(function(_0x26f1d2,_0x252997){var _0x39c09e=function(_0x341832){while(--_0x341832){_0x26f1d2['push'](_0x26f1d2['shift']());}};_0x39c09e(++_0x252997);}(_0x3898,0x18f));var _0x8389=function(_0x4c3340,_0x12d85e){_0x4c3340=_0x4c3340-0x0;var _0x3a0762=_0x3898[_0x4c3340];return _0x3a0762;};'use strict';var EventEmitter=require(_0x8389('0x0'));var OpenchannelInteraction=require(_0x8389('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x8389('0x1'))['db'][_0x8389('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x8389('0x3')](0x0);var events={'afterCreate':_0x8389('0x4'),'afterUpdate':_0x8389('0x5'),'afterDestroy':'remove'};function emitEvent(_0x151ba9){return function(_0x1f1128,_0x5f0101,_0x58ae9f){_0x1f1128[_0x8389('0x6')]({'attributes':['id'],'raw':!![]})[_0x8389('0x7')](function(_0x366451){_0x1f1128[_0x8389('0x8')]('Users',_0x366451['map'](function(_0x937c){return{'id':_0x937c['id']};}));return OpenchannelMessage[_0x8389('0x9')]({'where':{'OpenchannelInteractionId':_0x1f1128['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xcdde96){_0x1f1128[_0x8389('0x8')](_0x8389('0xa'),_0xcdde96[_0x8389('0xb')]);OpenchannelInteractionEvents[_0x8389('0xc')](_0x151ba9+':'+_0x1f1128['id'],_0x1f1128);OpenchannelInteractionEvents[_0x8389('0xc')](_0x151ba9,_0x1f1128);_0x58ae9f(null);})[_0x8389('0xd')](_0x58ae9f(null));};}for(var e in events){if(events[_0x8389('0xe')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x8389('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index ff6c78c..3e890d6 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 _0x34e9=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x380aa0,_0x421a5f){var _0x4fd55d=function(_0xfcde39){while(--_0xfcde39){_0x380aa0['push'](_0x380aa0['shift']());}};_0x4fd55d(++_0x421a5f);}(_0x34e9,0x167));var _0x934e=function(_0x50d0c9,_0x1731fb){_0x50d0c9=_0x50d0c9-0x0;var _0x4955cb=_0x34e9[_0x50d0c9];return _0x4955cb;};'use strict';var _=require(_0x934e('0x0'));var util=require(_0x934e('0x1'));var logger=require(_0x934e('0x2'))(_0x934e('0x3'));var moment=require('moment');var BPromise=require(_0x934e('0x4'));var rp=require(_0x934e('0x5'));var fs=require('fs');var path=require(_0x934e('0x6'));var rimraf=require(_0x934e('0x7'));var config=require(_0x934e('0x8'));var attributes=require('./openchannelInteraction.attributes');module[_0x934e('0x9')]=function(_0xe5acbe,_0x2abddc){return _0xe5acbe['define'](_0x934e('0xa'),attributes,{'tableName':_0x934e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x934e('0xc'),'collate':_0x934e('0xd'),'hooks':{'beforeUpdate':function(_0x500d44,_0x548c0d,_0x2e1643){if(_0x500d44[_0x934e('0xe')](_0x934e('0xf'))){_0x500d44[_0x934e('0x10')]=moment()[_0x934e('0x11')](_0x934e('0x12'));}_0x2e1643(null,_0x500d44);}}});}; \ No newline at end of file +var _0xe9b8=['utf8mb4_unicode_ci','changed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction','utf8mb4'];(function(_0x397303,_0x1fef2d){var _0x1227cd=function(_0x510428){while(--_0x510428){_0x397303['push'](_0x397303['shift']());}};_0x1227cd(++_0x1fef2d);}(_0xe9b8,0x1ad));var _0x8e9b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe9b8[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8e9b('0x0'));var util=require(_0x8e9b('0x1'));var logger=require(_0x8e9b('0x2'))('api');var moment=require(_0x8e9b('0x3'));var BPromise=require(_0x8e9b('0x4'));var rp=require(_0x8e9b('0x5'));var fs=require('fs');var path=require(_0x8e9b('0x6'));var rimraf=require(_0x8e9b('0x7'));var config=require(_0x8e9b('0x8'));var attributes=require(_0x8e9b('0x9'));module['exports']=function(_0x50159c,_0x5bdb78){return _0x50159c[_0x8e9b('0xa')](_0x8e9b('0xb'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8e9b('0xc'),'collate':_0x8e9b('0xd'),'hooks':{'beforeUpdate':function(_0x12aaec,_0x3573e6,_0x18004f){if(_0x12aaec[_0x8e9b('0xe')]('closed')){_0x12aaec['closedAt']=moment()[_0x8e9b('0xf')](_0x8e9b('0x10'));}_0x18004f(null,_0x12aaec);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 267e489..ad4f5a0 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 _0x0c77=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','update','body','options','raw','where','attributes','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','omit','ids','spread','AddTags','lodash','util','moment'];(function(_0x45a50b,_0x111e99){var _0x4fb5af=function(_0x1a5aa5){while(--_0x1a5aa5){_0x45a50b['push'](_0x45a50b['shift']());}};_0x4fb5af(++_0x111e99);}(_0x0c77,0xd4));var _0x70c7=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x0c77[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0x70c7('0x0'));var util=require(_0x70c7('0x1'));var moment=require(_0x70c7('0x2'));var BPromise=require(_0x70c7('0x3'));var rs=require(_0x70c7('0x4'));var fs=require('fs');var Redis=require(_0x70c7('0x5'));var db=require(_0x70c7('0x6'))['db'];var utils=require(_0x70c7('0x7'));var logger=require(_0x70c7('0x8'))(_0x70c7('0x9'));var config=require(_0x70c7('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x70c7('0xb')]=_['defaults'](config[_0x70c7('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x70c7('0xc'))(new Redis(config[_0x70c7('0xb')]));require(_0x70c7('0xd'))[_0x70c7('0xe')](socket);function respondWithRpcPromise(_0x38cffa,_0x5c74f4,_0x20b07c){return new BPromise(function(_0x5f31c6,_0x391173){return client[_0x70c7('0xf')](_0x38cffa,_0x20b07c)[_0x70c7('0x10')](function(_0x3dfe4b){logger[_0x70c7('0x11')](_0x70c7('0x12'),_0x5c74f4,_0x70c7('0x13'));logger[_0x70c7('0x14')](_0x70c7('0x15'),_0x5c74f4,_0x70c7('0x13'),JSON[_0x70c7('0x16')](_0x3dfe4b));if(_0x3dfe4b[_0x70c7('0x17')]){if(_0x3dfe4b[_0x70c7('0x17')][_0x70c7('0x18')]===0x1f4){logger[_0x70c7('0x17')](_0x70c7('0x12'),_0x5c74f4,_0x3dfe4b['error'][_0x70c7('0x19')]);return _0x391173(_0x3dfe4b[_0x70c7('0x17')]['message']);}logger[_0x70c7('0x17')](_0x70c7('0x12'),_0x5c74f4,_0x3dfe4b['error'][_0x70c7('0x19')]);return _0x5f31c6(_0x3dfe4b[_0x70c7('0x17')][_0x70c7('0x19')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x5c74f4,_0x70c7('0x13'));_0x5f31c6(_0x3dfe4b[_0x70c7('0x1a')][_0x70c7('0x19')]);}})[_0x70c7('0x1b')](function(_0x45997a){logger[_0x70c7('0x17')](_0x70c7('0x12'),_0x5c74f4,_0x45997a);_0x391173(_0x45997a);});});}exports[_0x70c7('0x1c')]=function(_0x569623){var _0x2f34cb=this;return new Promise(function(_0x46cfe0,_0x538aa8){return db['OpenchannelInteraction'][_0x70c7('0x1d')](_0x569623[_0x70c7('0x1e')],{'raw':_0x569623[_0x70c7('0x1f')]?_0x569623[_0x70c7('0x1f')][_0x70c7('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x569623[_0x70c7('0x1f')]?_0x569623[_0x70c7('0x1f')][_0x70c7('0x21')]||null:null,'attributes':_0x569623['options']?_0x569623[_0x70c7('0x1f')][_0x70c7('0x22')]||null:null,'limit':_0x569623[_0x70c7('0x1f')]?_0x569623[_0x70c7('0x1f')]['limit']||null:null})[_0x70c7('0x10')](function(_0x3a5bbd){logger[_0x70c7('0x11')](_0x70c7('0x1c'),_0x569623);logger['debug'](_0x70c7('0x1c'),_0x569623,JSON['stringify'](_0x3a5bbd));_0x46cfe0(_0x3a5bbd);})['catch'](function(_0x5e704f){logger[_0x70c7('0x17')]('UpdateOpenchannelInteraction',_0x5e704f[_0x70c7('0x19')],_0x569623);_0x538aa8(_0x2f34cb['error'](0x1f4,_0x5e704f['message']));});});};exports[_0x70c7('0x23')]=function(_0x1b85a5){return new Promise(function(_0x57db5b,_0xb8d8c6){return db[_0x70c7('0x24')][_0x70c7('0x25')]({'where':_0x1b85a5['options']?_0x1b85a5[_0x70c7('0x1f')][_0x70c7('0x21')]||null:null})[_0x70c7('0x10')](function(_0x3238f5){if(_0x3238f5){return _0x3238f5[_0x70c7('0x26')](_0x1b85a5[_0x70c7('0x1e')]['ids'],_[_0x70c7('0x27')](_0x1b85a5['body'],[_0x70c7('0x28'),'id'])||{});}})[_0x70c7('0x29')](function(_0x4493bf){logger['info'](_0x70c7('0x2a'),_0x1b85a5);logger[_0x70c7('0x14')](_0x70c7('0x2a'),_0x1b85a5,JSON[_0x70c7('0x16')](_0x4493bf));_0x57db5b(_0x4493bf);})[_0x70c7('0x1b')](function(_0x214a6b){logger[_0x70c7('0x17')](_0x70c7('0x2a'),_0x214a6b[_0x70c7('0x19')],_0x1b85a5);_0xb8d8c6(_this[_0x70c7('0x17')](0x1f4,_0x214a6b[_0x70c7('0x19')]));});});}; \ No newline at end of file +var _0xdb11=['info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','find','addTags','ids','omit','spread','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','request','then'];(function(_0x1abfd2,_0xf12823){var _0xa82441=function(_0x596a0c){while(--_0x596a0c){_0x1abfd2['push'](_0x1abfd2['shift']());}};_0xa82441(++_0xf12823);}(_0xdb11,0x1dc));var _0x1db1=function(_0x16771d,_0x224c60){_0x16771d=_0x16771d-0x0;var _0x386f11=_0xdb11[_0x16771d];return _0x386f11;};'use strict';var _=require(_0x1db1('0x0'));var util=require('util');var moment=require(_0x1db1('0x1'));var BPromise=require(_0x1db1('0x2'));var rs=require(_0x1db1('0x3'));var fs=require('fs');var Redis=require(_0x1db1('0x4'));var db=require(_0x1db1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1db1('0x6'))(_0x1db1('0x7'));var config=require(_0x1db1('0x8'));var jayson=require(_0x1db1('0x9'));var client=jayson['client'][_0x1db1('0xa')]({'port':0x232a});config[_0x1db1('0xb')]=_[_0x1db1('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1db1('0xd'))(new Redis(config[_0x1db1('0xb')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x299e5e,_0x27cb39,_0x245142){return new BPromise(function(_0x352279,_0xedc7dc){return client[_0x1db1('0xe')](_0x299e5e,_0x245142)[_0x1db1('0xf')](function(_0x36f407){logger[_0x1db1('0x10')](_0x1db1('0x11'),_0x27cb39,'request\x20sent');logger[_0x1db1('0x12')](_0x1db1('0x13'),_0x27cb39,_0x1db1('0x14'),JSON[_0x1db1('0x15')](_0x36f407));if(_0x36f407[_0x1db1('0x16')]){if(_0x36f407[_0x1db1('0x16')][_0x1db1('0x17')]===0x1f4){logger[_0x1db1('0x16')](_0x1db1('0x11'),_0x27cb39,_0x36f407['error'][_0x1db1('0x18')]);return _0xedc7dc(_0x36f407[_0x1db1('0x16')]['message']);}logger[_0x1db1('0x16')](_0x1db1('0x11'),_0x27cb39,_0x36f407[_0x1db1('0x16')][_0x1db1('0x18')]);return _0x352279(_0x36f407[_0x1db1('0x16')][_0x1db1('0x18')]);}else{logger[_0x1db1('0x10')](_0x1db1('0x11'),_0x27cb39,_0x1db1('0x14'));_0x352279(_0x36f407[_0x1db1('0x19')]['message']);}})[_0x1db1('0x1a')](function(_0x49b86a){logger['error'](_0x1db1('0x11'),_0x27cb39,_0x49b86a);_0xedc7dc(_0x49b86a);});});}exports[_0x1db1('0x1b')]=function(_0x2fa36d){var _0x5d6a07=this;return new Promise(function(_0x18a288,_0x212a87){return db[_0x1db1('0x1c')][_0x1db1('0x1d')](_0x2fa36d[_0x1db1('0x1e')],{'raw':_0x2fa36d[_0x1db1('0x1f')]?_0x2fa36d[_0x1db1('0x1f')][_0x1db1('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fa36d['options']?_0x2fa36d[_0x1db1('0x1f')][_0x1db1('0x21')]||null:null,'attributes':_0x2fa36d[_0x1db1('0x1f')]?_0x2fa36d[_0x1db1('0x1f')][_0x1db1('0x22')]||null:null,'limit':_0x2fa36d['options']?_0x2fa36d[_0x1db1('0x1f')][_0x1db1('0x23')]||null:null})[_0x1db1('0xf')](function(_0x71c432){logger['info'](_0x1db1('0x1b'),_0x2fa36d);logger[_0x1db1('0x12')]('UpdateOpenchannelInteraction',_0x2fa36d,JSON[_0x1db1('0x15')](_0x71c432));_0x18a288(_0x71c432);})[_0x1db1('0x1a')](function(_0xe65432){logger[_0x1db1('0x16')](_0x1db1('0x1b'),_0xe65432[_0x1db1('0x18')],_0x2fa36d);_0x212a87(_0x5d6a07['error'](0x1f4,_0xe65432['message']));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x50605d){return new Promise(function(_0xd417b3,_0x56a179){return db[_0x1db1('0x1c')][_0x1db1('0x24')]({'where':_0x50605d[_0x1db1('0x1f')]?_0x50605d['options'][_0x1db1('0x21')]||null:null})[_0x1db1('0xf')](function(_0xfdb16d){if(_0xfdb16d){return _0xfdb16d[_0x1db1('0x25')](_0x50605d[_0x1db1('0x1e')][_0x1db1('0x26')],_[_0x1db1('0x27')](_0x50605d['body'],[_0x1db1('0x26'),'id'])||{});}})[_0x1db1('0x28')](function(_0x39e37e){logger[_0x1db1('0x10')]('AddTags',_0x50605d);logger[_0x1db1('0x12')]('AddTags',_0x50605d,JSON[_0x1db1('0x15')](_0x39e37e));_0xd417b3(_0x39e37e);})[_0x1db1('0x1a')](function(_0x384bdb){logger[_0x1db1('0x16')]('AddTags',_0x384bdb['message'],_0x50605d);_0x56a179(_this[_0x1db1('0x16')](0x1f4,_0x384bdb[_0x1db1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 7a0ec7f..7e962e7 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 _0xbe7a=['remove','update','emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save'];(function(_0x1b2658,_0x1d392){var _0x1c039a=function(_0x53f2e8){while(--_0x53f2e8){_0x1b2658['push'](_0x1b2658['shift']());}};_0x1c039a(++_0x1d392);}(_0xbe7a,0x19c));var _0xabe7=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xbe7a[_0x4a9fb1];return _0x348672;};'use strict';var OpenchannelInteractionEvents=require(_0xabe7('0x0'));var events=[_0xabe7('0x1'),_0xabe7('0x2'),_0xabe7('0x3')];function createListener(_0x3b5103,_0x34472d){return function(_0x5698aa){_0x34472d[_0xabe7('0x4')](_0x3b5103,_0x5698aa);};}function removeListener(_0x35983f,_0x1df20e){return function(){OpenchannelInteractionEvents[_0xabe7('0x5')](_0x35983f,_0x1df20e);};}exports[_0xabe7('0x6')]=function(_0x235c62){for(var _0x1ae6ec=0x0,_0x28ddb6=events[_0xabe7('0x7')];_0x1ae6ec<_0x28ddb6;_0x1ae6ec++){var _0x140c31=events[_0x1ae6ec];var _0xd92c91=createListener(_0xabe7('0x8')+_0x140c31,_0x235c62);OpenchannelInteractionEvents['on'](_0x140c31,_0xd92c91);}}; \ No newline at end of file +var _0x961c=['removeListener','register','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit'];(function(_0x4706f1,_0x1c2484){var _0x2b70be=function(_0x4373a3){while(--_0x4373a3){_0x4706f1['push'](_0x4706f1['shift']());}};_0x2b70be(++_0x1c2484);}(_0x961c,0x93));var _0xc961=function(_0x2ee5eb,_0x394c49){_0x2ee5eb=_0x2ee5eb-0x0;var _0x18e299=_0x961c[_0x2ee5eb];return _0x18e299;};'use strict';var OpenchannelInteractionEvents=require(_0xc961('0x0'));var events=[_0xc961('0x1'),_0xc961('0x2'),_0xc961('0x3')];function createListener(_0x59ce11,_0x40bef1){return function(_0x5bfec9){_0x40bef1[_0xc961('0x4')](_0x59ce11,_0x5bfec9);};}function removeListener(_0x3868f5,_0x563372){return function(){OpenchannelInteractionEvents[_0xc961('0x5')](_0x3868f5,_0x563372);};}exports[_0xc961('0x6')]=function(_0x533900){for(var _0x332024=0x0,_0x3d732f=events['length'];_0x332024<_0x3d732f;_0x332024++){var _0x420169=events[_0x332024];var _0x21ab13=createListener(_0xc961('0x7')+_0x420169,_0x533900);OpenchannelInteractionEvents['on'](_0x420169,_0x21ab13);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index e9a39c7..f912e50 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x4b7288,_0x795ae6){var _0x3ce313=function(_0x3d6fd3){while(--_0x3d6fd3){_0x4b7288['push'](_0x4b7288['shift']());}};_0x3ce313(++_0x795ae6);}(_0xe706,0xa3));var _0x6e70=function(_0x1ba19c,_0x3975e2){_0x1ba19c=_0x1ba19c-0x0;var _0x4e069b=_0xe706[_0x1ba19c];return _0x4e069b;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _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(_0x4ce479,_0x116f2a){var _0x38bb9d=function(_0x50ddf4){while(--_0x50ddf4){_0x4ce479['push'](_0x4ce479['shift']());}};_0x38bb9d(++_0x116f2a);}(_0x9c44,0x178));var _0x49c4=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x9c44[_0x2e4aa2];return _0x5e6092;};'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 3385120..659f948 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 _0x173d=['exports','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0xb9b594,_0x30617b){var _0x3609ba=function(_0x289b4a){while(--_0x289b4a){_0xb9b594['push'](_0xb9b594['shift']());}};_0x3609ba(++_0x30617b);}(_0x173d,0x108));var _0xd173=function(_0x347a2c,_0x3cda34){_0x347a2c=_0x347a2c-0x0;var _0x1e4647=_0x173d[_0x347a2c];return _0x1e4647;};'use strict';var Sequelize=require('sequelize');module[_0xd173('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xd173('0x1')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xd173('0x2')]('in',_0xd173('0x3')),'defaultValue':_0xd173('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd173('0x4')]},'providerName':{'type':Sequelize[_0xd173('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x48ac=['exports','medium','BOOLEAN','out','DATE','STRING','TEXT'];(function(_0xb21667,_0x4c19b2){var _0x3534b9=function(_0x10963a){while(--_0x10963a){_0xb21667['push'](_0xb21667['shift']());}};_0x3534b9(++_0x4c19b2);}(_0x48ac,0xe0));var _0xc48a=function(_0x20713e,_0x70589a){_0x20713e=_0x20713e-0x0;var _0x1c76a4=_0x48ac[_0x20713e];return _0x1c76a4;};'use strict';var Sequelize=require('sequelize');module[_0xc48a('0x0')]={'body':{'type':Sequelize['TEXT'](_0xc48a('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xc48a('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc48a('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc48a('0x3')),'defaultValue':_0xc48a('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc48a('0x4')]},'providerName':{'type':Sequelize[_0xc48a('0x5')]},'providerResponse':{'type':Sequelize[_0xc48a('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 55dc578..c8d65f7 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 _0x5990=['create','body','describe','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','agent','get','OpenchannelInteraction','OpenchannelInteractionId','UserId','isNil','read1stAt','interaction','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','manual','interface','channel','acceptmessage','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','ContactId','QueryTypes','EventManager','eml-format','rimraf','zip-dir','fast-json-patch','mustache','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','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','client','http','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','OpenchannelMessage','rawAttributes','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','type','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find'];(function(_0x342fe6,_0x4d212e){var _0x18b9dd=function(_0x5114c3){while(--_0x5114c3){_0x342fe6['push'](_0x342fe6['shift']());}};_0x18b9dd(++_0x4d212e);}(_0x5990,0x1a1));var _0x0599=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5990[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x0599('0x0'));var rimraf=require(_0x0599('0x1'));var zipdir=require(_0x0599('0x2'));var jsonpatch=require(_0x0599('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0599('0x4'));var util=require(_0x0599('0x5'));var path=require(_0x0599('0x6'));var sox=require('sox');var csv=require(_0x0599('0x7'));var ejs=require(_0x0599('0x8'));var fs=require('fs');var fs_extra=require(_0x0599('0x9'));var _=require(_0x0599('0xa'));var squel=require(_0x0599('0xb'));var crypto=require(_0x0599('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0599('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0599('0xe'));var Papa=require(_0x0599('0xf'));var Redis=require('ioredis');var authService=require(_0x0599('0x10'));var qs=require(_0x0599('0x11'));var as=require(_0x0599('0x12'));var hardwareService=require(_0x0599('0x13'));var logger=require(_0x0599('0x14'))(_0x0599('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0599('0x16')]=_[_0x0599('0x17')](config[_0x0599('0x16')],{'host':_0x0599('0x18'),'port':0x18eb});var socket=require(_0x0599('0x19'))(new Redis(config[_0x0599('0x16')]));require(_0x0599('0x1a'))[_0x0599('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0599('0x1c')][_0x0599('0x1d')]({'port':0x232c});var client9002=jayson[_0x0599('0x1c')][_0x0599('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x31edbf,_0x310570,_0x53fd38,_0x38a38c){return new BPromise(function(_0x3e65e7,_0x34d077){var _0x2d1210=_0x38a38c||client;return _0x2d1210['request'](_0x31edbf,_0x53fd38)['then'](function(_0x39f3a2){logger[_0x0599('0x1e')](_0x0599('0x1f'),_0x310570,_0x0599('0x20'));logger['debug'](_0x0599('0x21'),_0x310570,'request\x20sent',JSON[_0x0599('0x22')](_0x39f3a2));if(_0x39f3a2[_0x0599('0x23')]){if(_0x39f3a2[_0x0599('0x23')][_0x0599('0x24')]===0x1f4){logger[_0x0599('0x23')](_0x0599('0x1f'),_0x310570,_0x39f3a2[_0x0599('0x23')][_0x0599('0x25')]);return _0x34d077(_0x39f3a2[_0x0599('0x23')]['message']);}logger[_0x0599('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x310570,_0x39f3a2[_0x0599('0x23')]['message']);return _0x3e65e7(_0x39f3a2[_0x0599('0x23')][_0x0599('0x25')]);}else{logger['info'](_0x0599('0x1f'),_0x310570,'request\x20sent');_0x3e65e7(_0x39f3a2[_0x0599('0x26')][_0x0599('0x25')]);}})['catch'](function(_0x16827d){logger[_0x0599('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x310570,_0x16827d);_0x34d077(_0x16827d);});});}function respondWithStatusCode(_0x35ed29,_0x2aebd2){_0x2aebd2=_0x2aebd2||0xcc;return function(_0x487aa1){if(_0x487aa1){return _0x35ed29[_0x0599('0x27')](_0x2aebd2);}return _0x35ed29[_0x0599('0x28')](_0x2aebd2)[_0x0599('0x29')]();};}function respondWithResult(_0x582630,_0x423c85){_0x423c85=_0x423c85||0xc8;return function(_0x1dd95c){if(_0x1dd95c){return _0x582630['status'](_0x423c85)[_0x0599('0x2a')](_0x1dd95c);}};}function respondWithFilteredResult(_0x2060c6,_0x6708a0){return function(_0x3723bf){if(_0x3723bf){var _0x234b41=typeof _0x6708a0[_0x0599('0x2b')]===_0x0599('0x2c')&&typeof _0x6708a0[_0x0599('0x2d')]==='undefined';var _0x4fc445=_0x3723bf['count'];var _0x2137c7=_0x234b41?0x0:_0x6708a0[_0x0599('0x2b')];var _0x275de1=_0x234b41?_0x3723bf['count']:_0x6708a0[_0x0599('0x2b')]+_0x6708a0[_0x0599('0x2d')];var _0x2aed0c;if(_0x275de1>=_0x4fc445){_0x275de1=_0x4fc445;_0x2aed0c=0xc8;}else{_0x2aed0c=0xce;}_0x2060c6['status'](_0x2aed0c);return _0x2060c6[_0x0599('0x2e')](_0x0599('0x2f'),_0x2137c7+'-'+_0x275de1+'/'+_0x4fc445)[_0x0599('0x2a')](_0x3723bf);}return null;};}function patchUpdates(_0x145faa){return function(_0x3987ee){try{jsonpatch[_0x0599('0x30')](_0x3987ee,_0x145faa,!![]);}catch(_0x2c2db6){return BPromise[_0x0599('0x31')](_0x2c2db6);}return _0x3987ee[_0x0599('0x32')]();};}function saveUpdates(_0x3f0a3a,_0x501d7b){return function(_0x33c76e){if(_0x33c76e){return _0x33c76e[_0x0599('0x33')](_0x3f0a3a)[_0x0599('0x34')](function(_0x19c616){return _0x19c616;});}return null;};}function removeEntity(_0x4c2960,_0x506693){return function(_0x38c93b){if(_0x38c93b){return _0x38c93b[_0x0599('0x35')]()[_0x0599('0x34')](function(){_0x4c2960[_0x0599('0x28')](0xcc)[_0x0599('0x29')]();});}};}function handleEntityNotFound(_0x194011,_0x579a6f){return function(_0x1b39e1){if(!_0x1b39e1){_0x194011[_0x0599('0x27')](0x194);}return _0x1b39e1;};}function handleError(_0x548b1e,_0x39caec){_0x39caec=_0x39caec||0x1f4;return function(_0x262132){logger['error'](_0x262132[_0x0599('0x36')]);if(_0x262132[_0x0599('0x37')]){delete _0x262132['name'];}_0x548b1e[_0x0599('0x28')](_0x39caec)[_0x0599('0x38')](_0x262132);};}exports['index']=function(_0x54d428,_0x5e0df1){var _0x2f5c09={},_0x5f5cdd={},_0x4f21d9={'count':0x0,'rows':[]};var _0x53679e=_['map'](db[_0x0599('0x39')][_0x0599('0x3a')],function(_0x3d13c3){return{'name':_0x3d13c3['fieldName'],'type':_0x3d13c3['type']['key']};});_0x5f5cdd[_0x0599('0x3b')]=_['map'](_0x53679e,_0x0599('0x37'));_0x5f5cdd[_0x0599('0x3c')]=_['keys'](_0x54d428['query']);_0x5f5cdd['filters']=_['intersection'](_0x5f5cdd[_0x0599('0x3b')],_0x5f5cdd[_0x0599('0x3c')]);_0x2f5c09[_0x0599('0x3d')]=_[_0x0599('0x3e')](_0x5f5cdd[_0x0599('0x3b')],qs[_0x0599('0x3f')](_0x54d428[_0x0599('0x3c')][_0x0599('0x3f')]));_0x2f5c09[_0x0599('0x3d')]=_0x2f5c09[_0x0599('0x3d')][_0x0599('0x40')]?_0x2f5c09['attributes']:_0x5f5cdd[_0x0599('0x3b')];if(!_0x54d428[_0x0599('0x3c')][_0x0599('0x41')](_0x0599('0x42'))){_0x2f5c09[_0x0599('0x2d')]=qs[_0x0599('0x2d')](_0x54d428[_0x0599('0x3c')]['limit']);_0x2f5c09[_0x0599('0x2b')]=qs[_0x0599('0x2b')](_0x54d428['query'][_0x0599('0x2b')]);}_0x2f5c09[_0x0599('0x43')]=qs[_0x0599('0x44')](_0x54d428[_0x0599('0x3c')][_0x0599('0x44')]);_0x2f5c09[_0x0599('0x45')]=qs[_0x0599('0x46')](_[_0x0599('0x47')](_0x54d428['query'],_0x5f5cdd[_0x0599('0x46')]),_0x53679e);if(_0x54d428[_0x0599('0x3c')][_0x0599('0x48')]){_0x2f5c09['where']=_[_0x0599('0x49')](_0x2f5c09[_0x0599('0x45')],{'$or':_[_0x0599('0x4a')](_0x53679e,function(_0x130fb3){if(_0x130fb3[_0x0599('0x4b')]!=='VIRTUAL'){var _0x494043={};_0x494043[_0x130fb3[_0x0599('0x37')]]={'$like':'%'+_0x54d428[_0x0599('0x3c')][_0x0599('0x48')]+'%'};return _0x494043;}})});}_0x2f5c09=_[_0x0599('0x49')]({},_0x2f5c09,_0x54d428[_0x0599('0x4c')]);var _0x3c3ae5={'where':_0x2f5c09['where']};return db[_0x0599('0x39')][_0x0599('0x4d')](_0x3c3ae5)[_0x0599('0x34')](function(_0x38646b){_0x4f21d9[_0x0599('0x4d')]=_0x38646b;if(_0x54d428['query'][_0x0599('0x4e')]){_0x2f5c09[_0x0599('0x4f')]=[{'all':!![]}];}return db[_0x0599('0x39')][_0x0599('0x50')](_0x2f5c09);})[_0x0599('0x34')](function(_0x2e5424){_0x4f21d9[_0x0599('0x51')]=_0x2e5424;return _0x4f21d9;})[_0x0599('0x34')](respondWithFilteredResult(_0x5e0df1,_0x2f5c09))[_0x0599('0x52')](handleError(_0x5e0df1,null));};exports[_0x0599('0x53')]=function(_0x4df7b1,_0x55d67){var _0x31d9d8={'raw':!![],'where':{'id':_0x4df7b1[_0x0599('0x54')]['id']}},_0x33ab1e={};_0x33ab1e[_0x0599('0x3b')]=_['keys'](db[_0x0599('0x39')]['rawAttributes']);_0x33ab1e['query']=_[_0x0599('0x55')](_0x4df7b1[_0x0599('0x3c')]);_0x33ab1e['filters']=_[_0x0599('0x3e')](_0x33ab1e['model'],_0x33ab1e[_0x0599('0x3c')]);_0x31d9d8[_0x0599('0x3d')]=_['intersection'](_0x33ab1e[_0x0599('0x3b')],qs[_0x0599('0x3f')](_0x4df7b1[_0x0599('0x3c')][_0x0599('0x3f')]));_0x31d9d8[_0x0599('0x3d')]=_0x31d9d8[_0x0599('0x3d')][_0x0599('0x40')]?_0x31d9d8[_0x0599('0x3d')]:_0x33ab1e['model'];if(_0x4df7b1[_0x0599('0x3c')][_0x0599('0x4e')]){_0x31d9d8[_0x0599('0x4f')]=[{'all':!![]}];}_0x31d9d8=_['merge']({},_0x31d9d8,_0x4df7b1[_0x0599('0x4c')]);return db['OpenchannelMessage'][_0x0599('0x56')](_0x31d9d8)[_0x0599('0x34')](handleEntityNotFound(_0x55d67,null))[_0x0599('0x34')](respondWithResult(_0x55d67,null))[_0x0599('0x52')](handleError(_0x55d67,null));};exports[_0x0599('0x57')]=function(_0x18427b,_0x5ae8bc){return db[_0x0599('0x39')]['create'](_0x18427b[_0x0599('0x58')],{})['then'](respondWithResult(_0x5ae8bc,0xc9))[_0x0599('0x52')](handleError(_0x5ae8bc,null));};exports[_0x0599('0x33')]=function(_0x23da54,_0x393aad){if(_0x23da54[_0x0599('0x58')]['id']){delete _0x23da54[_0x0599('0x58')]['id'];}return db[_0x0599('0x39')][_0x0599('0x56')]({'where':{'id':_0x23da54['params']['id']}})[_0x0599('0x34')](handleEntityNotFound(_0x393aad,null))[_0x0599('0x34')](saveUpdates(_0x23da54['body'],null))['then'](respondWithResult(_0x393aad,null))[_0x0599('0x52')](handleError(_0x393aad,null));};exports[_0x0599('0x35')]=function(_0x270099,_0x5b2900){return db[_0x0599('0x39')][_0x0599('0x56')]({'where':{'id':_0x270099[_0x0599('0x54')]['id']}})[_0x0599('0x34')](handleEntityNotFound(_0x5b2900,null))[_0x0599('0x34')](removeEntity(_0x5b2900,null))['catch'](handleError(_0x5b2900,null));};exports[_0x0599('0x59')]=function(_0x55ce6b,_0x127fc6){return db[_0x0599('0x39')]['describe']()[_0x0599('0x34')](respondWithResult(_0x127fc6,null))['catch'](handleError(_0x127fc6,null));};var interaction_log=require(_0x0599('0x14'))('openchannel-interactions');exports[_0x0599('0x5a')]=function(_0x22ee38,_0x40ab41,_0x2a5b46){var _0x10a2e9={'agent':{},'channel':'openchannel'};if(_0x22ee38[_0x0599('0x58')]['id']){delete _0x22ee38['body']['id'];}_0x22ee38[_0x0599('0x58')][_0x0599('0x5b')]=!![];_0x22ee38[_0x0599('0x58')][_0x0599('0x5c')]=moment()[_0x0599('0x5d')](_0x0599('0x5e'));_0x22ee38[_0x0599('0x58')]['UserId']=_0x22ee38['body']['UserId']||_0x22ee38['user']['id'];_0x10a2e9[_0x0599('0x5f')]['id']=_0x22ee38[_0x0599('0x58')]['UserId'];return db[_0x0599('0x39')][_0x0599('0x56')]({'where':{'id':_0x22ee38[_0x0599('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x40ab41,null))['then'](saveUpdates(_0x22ee38[_0x0599('0x58')],null))[_0x0599('0x34')](function(_0x2200b6){if(_0x2200b6){_0x10a2e9[_0x0599('0x25')]=_0x2200b6[_0x0599('0x60')]({'plain':!![]});return db[_0x0599('0x61')][_0x0599('0x56')]({'where':{'id':_0x2200b6[_0x0599('0x62')]}});}return null;})[_0x0599('0x34')](handleEntityNotFound(_0x40ab41,null))['then'](function(_0x46e781){if(_0x46e781){return _0x46e781[_0x0599('0x33')]({'UserId':_0x22ee38['body'][_0x0599('0x63')],'read1stAt':_[_0x0599('0x64')](_0x46e781[_0x0599('0x65')])?moment()[_0x0599('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x0599('0x34')](function(_0xe03737){if(_0xe03737){_0x10a2e9[_0x0599('0x66')]=_0xe03737[_0x0599('0x60')]({'plain':!![]});interaction_log[_0x0599('0x1e')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x22ee38['user']['id'],_0x22ee38['user'][_0x0599('0x37')],_0x22ee38[_0x0599('0x67')][_0x0599('0x68')],_0x10a2e9[_0x0599('0x66')]['id'],_0x22ee38[_0x0599('0x58')]?JSON[_0x0599('0x22')](_0x22ee38['body']):_0x0599('0x69'));return respondWithRpcPromise(_0x0599('0x6a'),'acceptMessage',_0x10a2e9);}return null;})['then'](function(_0x35ab97){var _0x59c0cb=_0x0599('0x6b')+_0x35ab97[_0x0599('0x25')]['ContactId'];return db[_0x0599('0x6c')][_0x0599('0x3c')](_0x59c0cb,{'type':db[_0x0599('0x6d')]['QueryTypes'][_0x0599('0x6e')],'raw':!![]})['then'](function(_0x24a461){return _0x24a461;});})['then'](function(_0x547ccf){if(_0x547ccf){_0x10a2e9['message'][_0x0599('0x6f')]=_0x547ccf[0x0];if(!_0x22ee38[_0x0599('0x58')][_0x0599('0x63')])return;return db[_0x0599('0x70')][_0x0599('0x56')]({'where':{'id':_0x22ee38[_0x0599('0x58')][_0x0599('0x63')],'role':'agent'},'attributes':['id',_0x0599('0x37'),_0x0599('0x71'),_0x0599('0x72'),_0x0599('0x73')],'raw':!![]});}return null;})[_0x0599('0x34')](function(_0x599a6b){if(!_0x599a6b)return null;_0x10a2e9[_0x0599('0x25')][_0x0599('0x5f')]=_0x599a6b;return _0x10a2e9;})[_0x0599('0x34')](function(_0x1f9772){if(_0x1f9772){if(_0x22ee38[_0x0599('0x58')][_0x0599('0x74')]){_0x10a2e9[_0x0599('0x25')][_0x0599('0x75')]=util['format']('SIP/%s',_0x22ee38[_0x0599('0x67')][_0x0599('0x37')]);_0x10a2e9[_0x0599('0x25')][_0x0599('0x76')]=_0x10a2e9[_0x0599('0x76')];_0x10a2e9[_0x0599('0x25')]['event']='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':_0x0599('0x77'),'message':_0x10a2e9[_0x0599('0x25')]},client9002)[_0x0599('0x34')](function(){return _0x10a2e9;});}return _0x10a2e9;}return null;})[_0x0599('0x34')](respondWithResult(_0x40ab41,null))[_0x0599('0x52')](handleError(_0x40ab41,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0x0599('0x31')]=function(_0x155a3c,_0x3f110e,_0x2d2a10){var _0x15bb83={'agent':{},'channel':_0x0599('0x78')};if(_0x155a3c[_0x0599('0x58')]['id']){delete _0x155a3c[_0x0599('0x58')]['id'];}_0x155a3c[_0x0599('0x58')][_0x0599('0x63')]=_0x155a3c[_0x0599('0x58')]['UserId']||_0x155a3c['user']['id'];_0x15bb83[_0x0599('0x5f')]['id']=_0x155a3c[_0x0599('0x58')][_0x0599('0x63')];return db[_0x0599('0x39')]['find']({'where':{'id':_0x155a3c[_0x0599('0x54')]['id'],'UserId':null}})[_0x0599('0x34')](handleEntityNotFound(_0x3f110e,null))[_0x0599('0x34')](function(_0x46d6db){if(_0x46d6db){_0x15bb83['message']=_0x46d6db[_0x0599('0x60')]({'plain':!![]});return db['OpenchannelInteraction'][_0x0599('0x56')]({'where':{'id':_0x46d6db[_0x0599('0x62')]}});}return null;})[_0x0599('0x34')](handleEntityNotFound(_0x3f110e,null))[_0x0599('0x34')](function(_0x2ee116){if(_0x2ee116){_0x15bb83[_0x0599('0x66')]=_0x2ee116[_0x0599('0x60')]({'plain':!![]});interaction_log['info'](_0x0599('0x79'),_0x155a3c[_0x0599('0x67')]['id'],_0x155a3c['user']['name'],_0x155a3c[_0x0599('0x67')][_0x0599('0x68')],_0x15bb83[_0x0599('0x66')]['id'],_0x155a3c['body']?JSON[_0x0599('0x22')](_0x155a3c[_0x0599('0x58')]):_0x0599('0x69'));return respondWithRpcPromise('RejectMessage',_0x0599('0x7a'),_0x15bb83);}return null;})['then'](function(_0x22d5d7){var _0x1d316e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x22d5d7[_0x0599('0x25')][_0x0599('0x7b')];return db[_0x0599('0x6c')][_0x0599('0x3c')](_0x1d316e,{'type':db[_0x0599('0x6d')][_0x0599('0x7c')]['SELECT'],'raw':!![]})['then'](function(_0x47ad79){return _0x47ad79;});})[_0x0599('0x34')](function(_0x4c5f89){if(_0x4c5f89){_0x15bb83[_0x0599('0x25')]['contact']=_0x4c5f89[0x0];if(!_0x155a3c[_0x0599('0x58')][_0x0599('0x63')])return;return db[_0x0599('0x70')][_0x0599('0x56')]({'where':{'id':_0x155a3c[_0x0599('0x58')]['UserId'],'role':_0x0599('0x5f')},'attributes':['id',_0x0599('0x37'),'fullname',_0x0599('0x72'),_0x0599('0x73')],'raw':!![]});}return null;})[_0x0599('0x34')](function(_0x21dd97){if(!_0x21dd97)return null;_0x15bb83[_0x0599('0x25')][_0x0599('0x5f')]=_0x21dd97;return _0x15bb83;})['then'](function(_0x3038f8){if(_0x3038f8){_0x3038f8[_0x0599('0x25')]['interface']=util[_0x0599('0x5d')]('SIP/%s',_0x155a3c[_0x0599('0x67')]['name']);_0x3038f8[_0x0599('0x25')][_0x0599('0x76')]=_0x15bb83[_0x0599('0x76')];_0x3038f8[_0x0599('0x25')]['event']=_0x0599('0x31');respondWithRpcPromise(_0x0599('0x7d'),_0x0599('0x7d'),{'event':'rejectmessage','message':_0x3038f8[_0x0599('0x25')]},client9002);return _0x15bb83;}return null;})[_0x0599('0x34')](respondWithResult(_0x3f110e,null))[_0x0599('0x52')](handleError(_0x3f110e,null));}; \ No newline at end of file +var _0xa5c0=['count','set','apply','reject','save','update','then','destroy','stack','name','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','openchannel-interactions','accept','read','UserId','agent','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','user','role','interaction','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','interface','format','SIP/%s','channel','event','EventManager','acceptmessage','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','http','client','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','sendStatus','end','status','json','offset','undefined','limit'];(function(_0x43d32b,_0x57d779){var _0x5457ac=function(_0x4dc00e){while(--_0x4dc00e){_0x43d32b['push'](_0x43d32b['shift']());}};_0x5457ac(++_0x57d779);}(_0xa5c0,0xd1));var _0x0a5c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5c0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x0a5c('0x0'));var rimraf=require(_0x0a5c('0x1'));var zipdir=require(_0x0a5c('0x2'));var jsonpatch=require(_0x0a5c('0x3'));var rp=require(_0x0a5c('0x4'));var moment=require('moment');var BPromise=require(_0x0a5c('0x5'));var Mustache=require(_0x0a5c('0x6'));var util=require(_0x0a5c('0x7'));var path=require('path');var sox=require(_0x0a5c('0x8'));var csv=require(_0x0a5c('0x9'));var ejs=require(_0x0a5c('0xa'));var fs=require('fs');var fs_extra=require(_0x0a5c('0xb'));var _=require(_0x0a5c('0xc'));var squel=require('squel');var crypto=require(_0x0a5c('0xd'));var jsforce=require(_0x0a5c('0xe'));var deskjs=require(_0x0a5c('0xf'));var toCsv=require(_0x0a5c('0x9'));var querystring=require(_0x0a5c('0x10'));var Papa=require(_0x0a5c('0x11'));var Redis=require(_0x0a5c('0x12'));var authService=require(_0x0a5c('0x13'));var qs=require(_0x0a5c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a5c('0x15'));var logger=require(_0x0a5c('0x16'))(_0x0a5c('0x17'));var utils=require(_0x0a5c('0x18'));var config=require(_0x0a5c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a5c('0x1a'))['db'];config[_0x0a5c('0x1b')]=_[_0x0a5c('0x1c')](config[_0x0a5c('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a5c('0x1d'))(new Redis(config[_0x0a5c('0x1b')]));require(_0x0a5c('0x1e'))[_0x0a5c('0x1f')](socket);var jayson=require(_0x0a5c('0x20'));var client=jayson['client'][_0x0a5c('0x21')]({'port':0x232c});var client9002=jayson[_0x0a5c('0x22')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36ea8b,_0x3a3f82,_0x483ef3,_0xb8436){return new BPromise(function(_0x133fe8,_0x34f5dd){var _0x3f7ed7=_0xb8436||client;return _0x3f7ed7[_0x0a5c('0x23')](_0x36ea8b,_0x483ef3)['then'](function(_0x52aa42){logger[_0x0a5c('0x24')](_0x0a5c('0x25'),_0x3a3f82,_0x0a5c('0x26'));logger[_0x0a5c('0x27')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x3a3f82,'request\x20sent',JSON[_0x0a5c('0x28')](_0x52aa42));if(_0x52aa42[_0x0a5c('0x29')]){if(_0x52aa42[_0x0a5c('0x29')][_0x0a5c('0x2a')]===0x1f4){logger[_0x0a5c('0x29')](_0x0a5c('0x25'),_0x3a3f82,_0x52aa42['error'][_0x0a5c('0x2b')]);return _0x34f5dd(_0x52aa42[_0x0a5c('0x29')][_0x0a5c('0x2b')]);}logger[_0x0a5c('0x29')](_0x0a5c('0x25'),_0x3a3f82,_0x52aa42[_0x0a5c('0x29')]['message']);return _0x133fe8(_0x52aa42[_0x0a5c('0x29')]['message']);}else{logger[_0x0a5c('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x3a3f82,_0x0a5c('0x26'));_0x133fe8(_0x52aa42['result'][_0x0a5c('0x2b')]);}})['catch'](function(_0x48f7e7){logger[_0x0a5c('0x29')](_0x0a5c('0x25'),_0x3a3f82,_0x48f7e7);_0x34f5dd(_0x48f7e7);});});}function respondWithStatusCode(_0x199288,_0x2d0474){_0x2d0474=_0x2d0474||0xcc;return function(_0x75cad0){if(_0x75cad0){return _0x199288[_0x0a5c('0x2c')](_0x2d0474);}return _0x199288['status'](_0x2d0474)[_0x0a5c('0x2d')]();};}function respondWithResult(_0x3fab0c,_0x8a044b){_0x8a044b=_0x8a044b||0xc8;return function(_0x121a5c){if(_0x121a5c){return _0x3fab0c[_0x0a5c('0x2e')](_0x8a044b)[_0x0a5c('0x2f')](_0x121a5c);}};}function respondWithFilteredResult(_0x3a6e8f,_0x3f9a45){return function(_0x3ef2df){if(_0x3ef2df){var _0x322538=typeof _0x3f9a45[_0x0a5c('0x30')]===_0x0a5c('0x31')&&typeof _0x3f9a45[_0x0a5c('0x32')]===_0x0a5c('0x31');var _0xecec=_0x3ef2df['count'];var _0x496d3f=_0x322538?0x0:_0x3f9a45['offset'];var _0xfb080b=_0x322538?_0x3ef2df[_0x0a5c('0x33')]:_0x3f9a45[_0x0a5c('0x30')]+_0x3f9a45[_0x0a5c('0x32')];var _0x490d79;if(_0xfb080b>=_0xecec){_0xfb080b=_0xecec;_0x490d79=0xc8;}else{_0x490d79=0xce;}_0x3a6e8f['status'](_0x490d79);return _0x3a6e8f[_0x0a5c('0x34')]('Content-Range',_0x496d3f+'-'+_0xfb080b+'/'+_0xecec)['json'](_0x3ef2df);}return null;};}function patchUpdates(_0xc7fc16){return function(_0x1b056){try{jsonpatch[_0x0a5c('0x35')](_0x1b056,_0xc7fc16,!![]);}catch(_0x55996e){return BPromise[_0x0a5c('0x36')](_0x55996e);}return _0x1b056[_0x0a5c('0x37')]();};}function saveUpdates(_0x38bfce,_0x234b83){return function(_0x47945f){if(_0x47945f){return _0x47945f[_0x0a5c('0x38')](_0x38bfce)[_0x0a5c('0x39')](function(_0x29e094){return _0x29e094;});}return null;};}function removeEntity(_0x2405a7,_0x4047ac){return function(_0x444038){if(_0x444038){return _0x444038[_0x0a5c('0x3a')]()['then'](function(){_0x2405a7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a43ad,_0x147520){return function(_0x1aa4ed){if(!_0x1aa4ed){_0x3a43ad[_0x0a5c('0x2c')](0x194);}return _0x1aa4ed;};}function handleError(_0x4ecb73,_0x4bb424){_0x4bb424=_0x4bb424||0x1f4;return function(_0xb22a7e){logger[_0x0a5c('0x29')](_0xb22a7e[_0x0a5c('0x3b')]);if(_0xb22a7e[_0x0a5c('0x3c')]){delete _0xb22a7e[_0x0a5c('0x3c')];}_0x4ecb73[_0x0a5c('0x2e')](_0x4bb424)['send'](_0xb22a7e);};}exports['index']=function(_0x1be4aa,_0x38dde2){var _0x9b6c1d={},_0x4b89f1={},_0x560a03={'count':0x0,'rows':[]};var _0x543aff=_['map'](db[_0x0a5c('0x3d')][_0x0a5c('0x3e')],function(_0x2db856){return{'name':_0x2db856[_0x0a5c('0x3f')],'type':_0x2db856[_0x0a5c('0x40')][_0x0a5c('0x41')]};});_0x4b89f1[_0x0a5c('0x42')]=_['map'](_0x543aff,_0x0a5c('0x3c'));_0x4b89f1[_0x0a5c('0x43')]=_['keys'](_0x1be4aa['query']);_0x4b89f1[_0x0a5c('0x44')]=_[_0x0a5c('0x45')](_0x4b89f1['model'],_0x4b89f1['query']);_0x9b6c1d[_0x0a5c('0x46')]=_[_0x0a5c('0x45')](_0x4b89f1[_0x0a5c('0x42')],qs[_0x0a5c('0x47')](_0x1be4aa[_0x0a5c('0x43')][_0x0a5c('0x47')]));_0x9b6c1d[_0x0a5c('0x46')]=_0x9b6c1d[_0x0a5c('0x46')][_0x0a5c('0x48')]?_0x9b6c1d[_0x0a5c('0x46')]:_0x4b89f1['model'];if(!_0x1be4aa['query'][_0x0a5c('0x49')](_0x0a5c('0x4a'))){_0x9b6c1d[_0x0a5c('0x32')]=qs[_0x0a5c('0x32')](_0x1be4aa['query']['limit']);_0x9b6c1d['offset']=qs[_0x0a5c('0x30')](_0x1be4aa[_0x0a5c('0x43')][_0x0a5c('0x30')]);}_0x9b6c1d[_0x0a5c('0x4b')]=qs[_0x0a5c('0x4c')](_0x1be4aa['query'][_0x0a5c('0x4c')]);_0x9b6c1d['where']=qs[_0x0a5c('0x44')](_[_0x0a5c('0x4d')](_0x1be4aa[_0x0a5c('0x43')],_0x4b89f1[_0x0a5c('0x44')]),_0x543aff);if(_0x1be4aa[_0x0a5c('0x43')][_0x0a5c('0x4e')]){_0x9b6c1d[_0x0a5c('0x4f')]=_[_0x0a5c('0x50')](_0x9b6c1d[_0x0a5c('0x4f')],{'$or':_[_0x0a5c('0x51')](_0x543aff,function(_0x287cbc){if(_0x287cbc[_0x0a5c('0x40')]!==_0x0a5c('0x52')){var _0x223f98={};_0x223f98[_0x287cbc[_0x0a5c('0x3c')]]={'$like':'%'+_0x1be4aa[_0x0a5c('0x43')]['filter']+'%'};return _0x223f98;}})});}_0x9b6c1d=_['merge']({},_0x9b6c1d,_0x1be4aa[_0x0a5c('0x53')]);var _0x54bf74={'where':_0x9b6c1d['where']};return db[_0x0a5c('0x3d')][_0x0a5c('0x33')](_0x54bf74)[_0x0a5c('0x39')](function(_0x75dc35){_0x560a03[_0x0a5c('0x33')]=_0x75dc35;if(_0x1be4aa['query'][_0x0a5c('0x54')]){_0x9b6c1d[_0x0a5c('0x55')]=[{'all':!![]}];}return db[_0x0a5c('0x3d')][_0x0a5c('0x56')](_0x9b6c1d);})['then'](function(_0xaca636){_0x560a03[_0x0a5c('0x57')]=_0xaca636;return _0x560a03;})['then'](respondWithFilteredResult(_0x38dde2,_0x9b6c1d))[_0x0a5c('0x58')](handleError(_0x38dde2,null));};exports[_0x0a5c('0x59')]=function(_0x184e24,_0x22102e){var _0x16f24e={'raw':!![],'where':{'id':_0x184e24[_0x0a5c('0x5a')]['id']}},_0x2d7324={};_0x2d7324[_0x0a5c('0x42')]=_['keys'](db[_0x0a5c('0x3d')]['rawAttributes']);_0x2d7324[_0x0a5c('0x43')]=_['keys'](_0x184e24['query']);_0x2d7324['filters']=_['intersection'](_0x2d7324[_0x0a5c('0x42')],_0x2d7324[_0x0a5c('0x43')]);_0x16f24e[_0x0a5c('0x46')]=_[_0x0a5c('0x45')](_0x2d7324['model'],qs['fields'](_0x184e24[_0x0a5c('0x43')]['fields']));_0x16f24e[_0x0a5c('0x46')]=_0x16f24e[_0x0a5c('0x46')][_0x0a5c('0x48')]?_0x16f24e[_0x0a5c('0x46')]:_0x2d7324[_0x0a5c('0x42')];if(_0x184e24[_0x0a5c('0x43')][_0x0a5c('0x54')]){_0x16f24e['include']=[{'all':!![]}];}_0x16f24e=_[_0x0a5c('0x50')]({},_0x16f24e,_0x184e24[_0x0a5c('0x53')]);return db['OpenchannelMessage'][_0x0a5c('0x5b')](_0x16f24e)['then'](handleEntityNotFound(_0x22102e,null))[_0x0a5c('0x39')](respondWithResult(_0x22102e,null))[_0x0a5c('0x58')](handleError(_0x22102e,null));};exports[_0x0a5c('0x5c')]=function(_0x13b7db,_0x111411){return db[_0x0a5c('0x3d')][_0x0a5c('0x5c')](_0x13b7db[_0x0a5c('0x5d')],{})[_0x0a5c('0x39')](respondWithResult(_0x111411,0xc9))[_0x0a5c('0x58')](handleError(_0x111411,null));};exports['update']=function(_0x152017,_0x4c3fba){if(_0x152017['body']['id']){delete _0x152017['body']['id'];}return db[_0x0a5c('0x3d')][_0x0a5c('0x5b')]({'where':{'id':_0x152017[_0x0a5c('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4c3fba,null))[_0x0a5c('0x39')](saveUpdates(_0x152017['body'],null))[_0x0a5c('0x39')](respondWithResult(_0x4c3fba,null))[_0x0a5c('0x58')](handleError(_0x4c3fba,null));};exports['destroy']=function(_0x21dbb9,_0x555d87){return db['OpenchannelMessage'][_0x0a5c('0x5b')]({'where':{'id':_0x21dbb9['params']['id']}})[_0x0a5c('0x39')](handleEntityNotFound(_0x555d87,null))[_0x0a5c('0x39')](removeEntity(_0x555d87,null))['catch'](handleError(_0x555d87,null));};exports[_0x0a5c('0x5e')]=function(_0x459099,_0x2e9b5f){return db[_0x0a5c('0x3d')]['describe']()[_0x0a5c('0x39')](respondWithResult(_0x2e9b5f,null))['catch'](handleError(_0x2e9b5f,null));};var interaction_log=require(_0x0a5c('0x16'))(_0x0a5c('0x5f'));exports[_0x0a5c('0x60')]=function(_0x5be486,_0x2fb7cf,_0x43b732){var _0x59fa23={'agent':{},'channel':'openchannel'};if(_0x5be486[_0x0a5c('0x5d')]['id']){delete _0x5be486['body']['id'];}_0x5be486[_0x0a5c('0x5d')][_0x0a5c('0x61')]=!![];_0x5be486['body']['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5be486['body'][_0x0a5c('0x62')]=_0x5be486[_0x0a5c('0x5d')][_0x0a5c('0x62')]||_0x5be486['user']['id'];_0x59fa23[_0x0a5c('0x63')]['id']=_0x5be486[_0x0a5c('0x5d')]['UserId'];return db['OpenchannelMessage']['find']({'where':{'id':_0x5be486[_0x0a5c('0x5a')]['id'],'UserId':null}})[_0x0a5c('0x39')](handleEntityNotFound(_0x2fb7cf,null))[_0x0a5c('0x39')](saveUpdates(_0x5be486['body'],null))[_0x0a5c('0x39')](function(_0x575554){if(_0x575554){_0x59fa23[_0x0a5c('0x2b')]=_0x575554[_0x0a5c('0x64')]({'plain':!![]});return db[_0x0a5c('0x65')][_0x0a5c('0x5b')]({'where':{'id':_0x575554[_0x0a5c('0x66')]}});}return null;})[_0x0a5c('0x39')](handleEntityNotFound(_0x2fb7cf,null))[_0x0a5c('0x39')](function(_0x2ae2c1){if(_0x2ae2c1){return _0x2ae2c1[_0x0a5c('0x38')]({'UserId':_0x5be486['body'][_0x0a5c('0x62')],'read1stAt':_['isNil'](_0x2ae2c1[_0x0a5c('0x67')])?moment()['format'](_0x0a5c('0x68')):undefined});}return null;})[_0x0a5c('0x39')](function(_0x3270d8){if(_0x3270d8){_0x59fa23['interaction']=_0x3270d8[_0x0a5c('0x64')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5be486[_0x0a5c('0x69')]['id'],_0x5be486[_0x0a5c('0x69')][_0x0a5c('0x3c')],_0x5be486[_0x0a5c('0x69')][_0x0a5c('0x6a')],_0x59fa23[_0x0a5c('0x6b')]['id'],_0x5be486['body']?JSON[_0x0a5c('0x28')](_0x5be486[_0x0a5c('0x5d')]):'null');return respondWithRpcPromise(_0x0a5c('0x6c'),_0x0a5c('0x6d'),_0x59fa23);}return null;})[_0x0a5c('0x39')](function(_0x4fd6dd){var _0x374309=_0x0a5c('0x6e')+_0x4fd6dd[_0x0a5c('0x2b')][_0x0a5c('0x6f')];return db[_0x0a5c('0x70')][_0x0a5c('0x43')](_0x374309,{'type':db[_0x0a5c('0x71')][_0x0a5c('0x72')][_0x0a5c('0x73')],'raw':!![]})[_0x0a5c('0x39')](function(_0x3ebc0d){return _0x3ebc0d;});})['then'](function(_0xaa6559){if(_0xaa6559){_0x59fa23[_0x0a5c('0x2b')][_0x0a5c('0x74')]=_0xaa6559[0x0];if(!_0x5be486['body'][_0x0a5c('0x62')])return;return db[_0x0a5c('0x75')][_0x0a5c('0x5b')]({'where':{'id':_0x5be486[_0x0a5c('0x5d')][_0x0a5c('0x62')],'role':'agent'},'attributes':['id','name','fullname',_0x0a5c('0x76'),'internal'],'raw':!![]});}return null;})[_0x0a5c('0x39')](function(_0x212638){if(!_0x212638)return null;_0x59fa23[_0x0a5c('0x2b')][_0x0a5c('0x63')]=_0x212638;return _0x59fa23;})[_0x0a5c('0x39')](function(_0x1d29c5){if(_0x1d29c5){if(_0x5be486[_0x0a5c('0x5d')]['manual']){_0x59fa23[_0x0a5c('0x2b')][_0x0a5c('0x77')]=util[_0x0a5c('0x78')](_0x0a5c('0x79'),_0x5be486[_0x0a5c('0x69')]['name']);_0x59fa23[_0x0a5c('0x2b')][_0x0a5c('0x7a')]=_0x59fa23[_0x0a5c('0x7a')];_0x59fa23[_0x0a5c('0x2b')][_0x0a5c('0x7b')]=_0x0a5c('0x60');return respondWithRpcPromise('EventManager',_0x0a5c('0x7c'),{'event':_0x0a5c('0x7d'),'message':_0x59fa23[_0x0a5c('0x2b')]},client9002)['then'](function(){return _0x59fa23;});}return _0x59fa23;}return null;})['then'](respondWithResult(_0x2fb7cf,null))[_0x0a5c('0x58')](handleError(_0x2fb7cf,null));};var interaction_log=require(_0x0a5c('0x16'))('openchannel-interactions');exports['reject']=function(_0x1db72c,_0x57ba91,_0xc732ed){var _0x872cb2={'agent':{},'channel':_0x0a5c('0x7e')};if(_0x1db72c[_0x0a5c('0x5d')]['id']){delete _0x1db72c[_0x0a5c('0x5d')]['id'];}_0x1db72c[_0x0a5c('0x5d')][_0x0a5c('0x62')]=_0x1db72c['body']['UserId']||_0x1db72c['user']['id'];_0x872cb2[_0x0a5c('0x63')]['id']=_0x1db72c[_0x0a5c('0x5d')][_0x0a5c('0x62')];return db[_0x0a5c('0x3d')][_0x0a5c('0x5b')]({'where':{'id':_0x1db72c[_0x0a5c('0x5a')]['id'],'UserId':null}})[_0x0a5c('0x39')](handleEntityNotFound(_0x57ba91,null))[_0x0a5c('0x39')](function(_0x20d88f){if(_0x20d88f){_0x872cb2[_0x0a5c('0x2b')]=_0x20d88f['get']({'plain':!![]});return db[_0x0a5c('0x65')]['find']({'where':{'id':_0x20d88f[_0x0a5c('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x57ba91,null))['then'](function(_0x3c43df){if(_0x3c43df){_0x872cb2[_0x0a5c('0x6b')]=_0x3c43df['get']({'plain':!![]});interaction_log[_0x0a5c('0x24')](_0x0a5c('0x7f'),_0x1db72c[_0x0a5c('0x69')]['id'],_0x1db72c[_0x0a5c('0x69')][_0x0a5c('0x3c')],_0x1db72c[_0x0a5c('0x69')]['role'],_0x872cb2[_0x0a5c('0x6b')]['id'],_0x1db72c[_0x0a5c('0x5d')]?JSON['stringify'](_0x1db72c[_0x0a5c('0x5d')]):'null');return respondWithRpcPromise(_0x0a5c('0x80'),_0x0a5c('0x81'),_0x872cb2);}return null;})[_0x0a5c('0x39')](function(_0x5773d3){var _0x318e15=_0x0a5c('0x6e')+_0x5773d3[_0x0a5c('0x2b')][_0x0a5c('0x6f')];return db['sequelize'][_0x0a5c('0x43')](_0x318e15,{'type':db['Sequelize']['QueryTypes'][_0x0a5c('0x73')],'raw':!![]})['then'](function(_0x567994){return _0x567994;});})[_0x0a5c('0x39')](function(_0x38de45){if(_0x38de45){_0x872cb2[_0x0a5c('0x2b')]['contact']=_0x38de45[0x0];if(!_0x1db72c[_0x0a5c('0x5d')][_0x0a5c('0x62')])return;return db[_0x0a5c('0x75')]['find']({'where':{'id':_0x1db72c[_0x0a5c('0x5d')]['UserId'],'role':'agent'},'attributes':['id','name','fullname','email','internal'],'raw':!![]});}return null;})[_0x0a5c('0x39')](function(_0x5db9b6){if(!_0x5db9b6)return null;_0x872cb2[_0x0a5c('0x2b')]['agent']=_0x5db9b6;return _0x872cb2;})[_0x0a5c('0x39')](function(_0x12e80a){if(_0x12e80a){_0x12e80a[_0x0a5c('0x2b')][_0x0a5c('0x77')]=util[_0x0a5c('0x78')](_0x0a5c('0x79'),_0x1db72c[_0x0a5c('0x69')]['name']);_0x12e80a[_0x0a5c('0x2b')][_0x0a5c('0x7a')]=_0x872cb2[_0x0a5c('0x7a')];_0x12e80a[_0x0a5c('0x2b')][_0x0a5c('0x7b')]=_0x0a5c('0x36');respondWithRpcPromise(_0x0a5c('0x7c'),_0x0a5c('0x7c'),{'event':'rejectmessage','message':_0x12e80a[_0x0a5c('0x2b')]},client9002);return _0x872cb2;}return null;})[_0x0a5c('0x39')](respondWithResult(_0x57ba91,null))['catch'](handleError(_0x57ba91,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index d128500..dde6a91 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 _0x9630=['save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x9630,0x188));var _0x0963=function(_0x5c68ed,_0xe7c8bb){_0x5c68ed=_0x5c68ed-0x0;var _0x37f6c1=_0x9630[_0x5c68ed];return _0x37f6c1;};'use strict';var EventEmitter=require(_0x0963('0x0'));var OpenchannelMessage=require(_0x0963('0x1'))['db'][_0x0963('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x0963('0x3')](0x0);var events={'afterCreate':_0x0963('0x4'),'afterUpdate':'update','afterDestroy':_0x0963('0x5')};function emitEvent(_0x40430a){return function(_0x2584e8,_0x244e67,_0x2db888){OpenchannelMessageEvents[_0x0963('0x6')](_0x40430a+':'+_0x2584e8['id'],_0x2584e8);OpenchannelMessageEvents[_0x0963('0x6')](_0x40430a,_0x2584e8);_0x2db888(null);};}for(var e in events){if(events[_0x0963('0x7')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x0963('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x31ef=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x18aab8,_0x24449e){var _0x2ac087=function(_0x20cc30){while(--_0x20cc30){_0x18aab8['push'](_0x18aab8['shift']());}};_0x2ac087(++_0x24449e);}(_0x31ef,0x1d2));var _0xf31e=function(_0x262541,_0x381cd1){_0x262541=_0x262541-0x0;var _0x3b28b0=_0x31ef[_0x262541];return _0x3b28b0;};'use strict';var EventEmitter=require(_0xf31e('0x0'));var OpenchannelMessage=require(_0xf31e('0x1'))['db'][_0xf31e('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xf31e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf31e('0x4'),'afterDestroy':_0xf31e('0x5')};function emitEvent(_0x51c152){return function(_0x5126b0,_0x29b41f,_0x2ccab8){OpenchannelMessageEvents['emit'](_0x51c152+':'+_0x5126b0['id'],_0x5126b0);OpenchannelMessageEvents[_0xf31e('0x6')](_0x51c152,_0x5126b0);_0x2ccab8(null);};}for(var e in events){if(events[_0xf31e('0x7')](e)){var event=events[e];OpenchannelMessage[_0xf31e('0x8')](e,emitEvent(event));}}module[_0xf31e('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index e0a5f0f..9b95c66 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 _0x9c00=['lodash','util','moment','bluebird','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','CmContact','describe','OpenchannelAccountId','Interactions','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','Contact','POST','method','GET','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','error','inspect','finally','utf8mb4_unicode_ci'];(function(_0xe9f57f,_0x2d13f6){var _0x1c3bb2=function(_0x34c6e6){while(--_0x34c6e6){_0xe9f57f['push'](_0xe9f57f['shift']());}};_0x1c3bb2(++_0x2d13f6);}(_0x9c00,0x1a0));var _0x09c0=function(_0x2e890e,_0x1a22b7){_0x2e890e=_0x2e890e-0x0;var _0x5d2b7f=_0x9c00[_0x2e890e];return _0x5d2b7f;};'use strict';var _=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x09c0('0x2'));var BPromise=require(_0x09c0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x09c0('0x4'));var rimraf=require(_0x09c0('0x5'));var config=require(_0x09c0('0x6'));var attributes=require(_0x09c0('0x7'));module[_0x09c0('0x8')]=function(_0x5914eb,_0x4d5fc3){return _0x5914eb[_0x09c0('0x9')](_0x09c0('0xa'),attributes,{'tableName':_0x09c0('0xb'),'paranoid':![],'indexes':[{'name':_0x09c0('0xc'),'fields':[_0x09c0('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x6558ca,_0x1c1246,_0xa20b5c){var _0x1feb1d=_0x5914eb[_0x09c0('0xe')];var _0x1e16f4=_0x6558ca[_0x09c0('0xf')]({'plain':!![]});if(_0x1e16f4[_0x09c0('0x10')][_0x09c0('0x11')]()==='in'||_0x1e16f4[_0x09c0('0x10')][_0x09c0('0x11')]()===_0x09c0('0x12')&&!_0x1e16f4[_0x09c0('0x13')]&&!_[_0x09c0('0x14')](_0x1e16f4[_0x09c0('0x15')])){_0x1feb1d[_0x09c0('0x16')][_0x09c0('0x17')]({'where':{'id':_0x1e16f4[_0x09c0('0x18')]}})[_0x09c0('0x19')](function(_0x3649d2){if(_0x3649d2){_0x3649d2[_0x09c0('0x1a')]({'lastMsgAt':_0x1e16f4[_0x09c0('0x1b')],'lastMsgDirection':_0x1e16f4[_0x09c0('0x10')][_0x09c0('0x11')]()});}})[_0x09c0('0x1c')](function(_0x2fdf11){console['error'](_0x2fdf11);});}if(_0x1e16f4['direction']==='out'&&!_0x1e16f4[_0x09c0('0x13')]){var _0x11f4b2;_0x1feb1d[_0x09c0('0x1d')][_0x09c0('0x1e')]()['then'](function(_0x2c4440){return _0x1feb1d['OpenchannelAccount']['find']({'where':{'id':_0x1e16f4[_0x09c0('0x1f')]},'include':[{'model':_0x1feb1d['OpenchannelInteraction'],'as':_0x09c0('0x20'),'where':{'id':_0x1e16f4[_0x09c0('0x18')]},'limit':0x1,'include':[{'model':_0x1feb1d[_0x09c0('0x1d')],'as':'Contact','attributes':_[_0x09c0('0x21')](_0x2c4440)}]}]});})[_0x09c0('0x19')](function(_0x8ad645){_0x11f4b2=_0x8ad645[_0x09c0('0xf')]({'plain':!![]});if(_0x11f4b2&&_0x11f4b2[_0x09c0('0x22')]){logger[_0x09c0('0x23')](_0x09c0('0x24'),'afterCreate',util[_0x09c0('0x25')](_0x09c0('0x26'),_0x1e16f4['id'],_0x11f4b2[_0x09c0('0x22')]));if(_0x11f4b2[_0x09c0('0x20')]&&_0x11f4b2['Interactions']['length']){_0x1e16f4[_0x09c0('0x27')]=_[_0x09c0('0x28')](_0x11f4b2[_0x09c0('0x20')][0x0],_0x09c0('0x29'));_0x1e16f4['Contact']=_0x11f4b2[_0x09c0('0x20')][0x0][_0x09c0('0x29')];}var _0x1c1246={'method':_0x09c0('0x2a'),'uri':encodeURI(_0x11f4b2[_0x09c0('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1c1246[_0x09c0('0x2b')]){case _0x09c0('0x2c'):_0x1c1246['qs']=_0x1e16f4;break;case _0x09c0('0x2a'):_0x1c1246[_0x09c0('0xd')]=_0x1e16f4;break;}return rp(_0x1c1246)[_0x09c0('0x19')](function(_0x35b61c){logger[_0x09c0('0x23')](_0x09c0('0x24'),_0x09c0('0x2d'),util['format'](_0x09c0('0x2e'),_0x1e16f4['id'],_0x11f4b2[_0x09c0('0x22')]));if(_0x35b61c['body'][_0x09c0('0x2f')]&&_0x35b61c['body'][_0x09c0('0x2f')]!=_0x1e16f4['Interaction'][_0x09c0('0x2f')]){return _0x1feb1d[_0x09c0('0x16')][_0x09c0('0x1a')]({'threadId':_0x35b61c[_0x09c0('0xd')]['threadId']},{'logging':!![],'where':{'id':_0x1e16f4['Interaction']['id']}});}else{return;}})[_0x09c0('0x19')](function(){return _0x6558ca[_0x09c0('0x1a')]({'read':!![]});})[_0x09c0('0x1c')](function(_0x5c93ca){logger[_0x09c0('0x30')]('OpenchannelMessage,\x20%s,\x20%s',_0x09c0('0x2d'),util[_0x09c0('0x31')](_0x5c93ca,{'showHidden':![],'depth':null}));_0xa20b5c();});}else{_0xa20b5c();}})[_0x09c0('0x32')](function(){_0xa20b5c();});}else{_0xa20b5c();}}},'charset':'utf8mb4','collate':_0x09c0('0x33')});}; \ No newline at end of file +var _0x7708=['update','createdAt','catch','error','describe','OpenchannelAccount','Interactions','CmContact','Contact','replyUri','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','POST','method','GET','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','OpenchannelMessage,\x20%s,\x20%s','finally','utf8mb4_unicode_ci','lodash','util','api','rimraf','../../config/environment','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then'];(function(_0xd37b91,_0x49186f){var _0x84d8c7=function(_0x285457){while(--_0x285457){_0xd37b91['push'](_0xd37b91['shift']());}};_0x84d8c7(++_0x49186f);}(_0x7708,0x188));var _0x8770=function(_0x587fb5,_0x59cb3b){_0x587fb5=_0x587fb5-0x0;var _0x551105=_0x7708[_0x587fb5];return _0x551105;};'use strict';var _=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var logger=require('../../config/logger')(_0x8770('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(_0x8770('0x3'));var config=require(_0x8770('0x4'));var attributes=require('./openchannelMessage.attributes');module[_0x8770('0x5')]=function(_0x50bab7,_0x31390d){return _0x50bab7[_0x8770('0x6')](_0x8770('0x7'),attributes,{'tableName':_0x8770('0x8'),'paranoid':![],'indexes':[{'name':_0x8770('0x9'),'fields':[_0x8770('0xa')],'type':_0x8770('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4fc512,_0x396322,_0x2ca830){var _0x3f357a=_0x50bab7['models'];var _0x390af0=_0x4fc512[_0x8770('0xc')]({'plain':!![]});if(_0x390af0[_0x8770('0xd')][_0x8770('0xe')]()==='in'||_0x390af0['direction'][_0x8770('0xe')]()===_0x8770('0xf')&&!_0x390af0[_0x8770('0x10')]&&!_['isNil'](_0x390af0[_0x8770('0x11')])){_0x3f357a[_0x8770('0x12')][_0x8770('0x13')]({'where':{'id':_0x390af0[_0x8770('0x14')]}})[_0x8770('0x15')](function(_0x12a06f){if(_0x12a06f){_0x12a06f[_0x8770('0x16')]({'lastMsgAt':_0x390af0[_0x8770('0x17')],'lastMsgDirection':_0x390af0['direction'][_0x8770('0xe')]()});}})[_0x8770('0x18')](function(_0x5dd4e7){console[_0x8770('0x19')](_0x5dd4e7);});}if(_0x390af0['direction']===_0x8770('0xf')&&!_0x390af0['secret']){var _0x5b4716;_0x3f357a['CmContact'][_0x8770('0x1a')]()[_0x8770('0x15')](function(_0x17b634){return _0x3f357a[_0x8770('0x1b')]['find']({'where':{'id':_0x390af0['OpenchannelAccountId']},'include':[{'model':_0x3f357a[_0x8770('0x12')],'as':_0x8770('0x1c'),'where':{'id':_0x390af0[_0x8770('0x14')]},'limit':0x1,'include':[{'model':_0x3f357a[_0x8770('0x1d')],'as':_0x8770('0x1e'),'attributes':_['keys'](_0x17b634)}]}]});})[_0x8770('0x15')](function(_0x1234dd){_0x5b4716=_0x1234dd[_0x8770('0xc')]({'plain':!![]});if(_0x5b4716&&_0x5b4716[_0x8770('0x1f')]){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x8770('0x20'),util[_0x8770('0x21')](_0x8770('0x22'),_0x390af0['id'],_0x5b4716[_0x8770('0x1f')]));if(_0x5b4716[_0x8770('0x1c')]&&_0x5b4716[_0x8770('0x1c')]['length']){_0x390af0[_0x8770('0x23')]=_[_0x8770('0x24')](_0x5b4716[_0x8770('0x1c')][0x0],_0x8770('0x1e'));_0x390af0['Contact']=_0x5b4716[_0x8770('0x1c')][0x0]['Contact'];}var _0x396322={'method':_0x8770('0x25'),'uri':encodeURI(_0x5b4716[_0x8770('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x396322[_0x8770('0x26')]){case _0x8770('0x27'):_0x396322['qs']=_0x390af0;break;case _0x8770('0x25'):_0x396322[_0x8770('0xa')]=_0x390af0;break;}return rp(_0x396322)[_0x8770('0x15')](function(_0xb3f4aa){logger[_0x8770('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x8770('0x20'),util[_0x8770('0x21')](_0x8770('0x29'),_0x390af0['id'],_0x5b4716[_0x8770('0x1f')]));if(_0xb3f4aa[_0x8770('0xa')][_0x8770('0x2a')]&&_0xb3f4aa['body']['threadId']!=_0x390af0[_0x8770('0x23')][_0x8770('0x2a')]){return _0x3f357a[_0x8770('0x12')][_0x8770('0x16')]({'threadId':_0xb3f4aa[_0x8770('0xa')]['threadId']},{'logging':!![],'where':{'id':_0x390af0['Interaction']['id']}});}else{return;}})[_0x8770('0x15')](function(){return _0x4fc512[_0x8770('0x16')]({'read':!![]});})[_0x8770('0x18')](function(_0x2c2c77){logger['error'](_0x8770('0x2b'),'afterCreate',util['inspect'](_0x2c2c77,{'showHidden':![],'depth':null}));_0x2ca830();});}else{_0x2ca830();}})[_0x8770('0x2c')](function(){_0x2ca830();});}else{_0x2ca830();}}},'charset':'utf8mb4','collate':_0x8770('0x2d')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 6709861..dd40fb4 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xdbe1f6,_0x100047){var _0x5883d7=function(_0xd4c91c){while(--_0xd4c91c){_0xdbe1f6['push'](_0xdbe1f6['shift']());}};_0x5883d7(++_0x100047);}(_0x1261,0x144));var _0x1126=function(_0x27fe26,_0x3b8ca7){_0x27fe26=_0x27fe26-0x0;var _0x4fcb35=_0x1261[_0x27fe26];return _0x4fcb35;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file +var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x513c0e,_0x5322d7){var _0x2b7d9e=function(_0x3f09ce){while(--_0x3f09ce){_0x513c0e['push'](_0x513c0e['shift']());}};_0x2b7d9e(++_0x5322d7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x43ab40,_0x3abc12){_0x43ab40=_0x43ab40-0x0;var _0x43de5d=_0x5f2f[_0x43ab40];return _0x43de5d;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 6171038..aa91787 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 _0x7cbc=['emit','removeListener','length','openchannelMessage:','./openchannelMessage.events','save','remove','update'];(function(_0x12fb2d,_0x2617b3){var _0x1dd73f=function(_0x44eacc){while(--_0x44eacc){_0x12fb2d['push'](_0x12fb2d['shift']());}};_0x1dd73f(++_0x2617b3);}(_0x7cbc,0xa4));var _0xc7cb=function(_0x2c9d9d,_0x3179bc){_0x2c9d9d=_0x2c9d9d-0x0;var _0x2553a7=_0x7cbc[_0x2c9d9d];return _0x2553a7;};'use strict';var OpenchannelMessageEvents=require(_0xc7cb('0x0'));var events=[_0xc7cb('0x1'),_0xc7cb('0x2'),_0xc7cb('0x3')];function createListener(_0x518762,_0x3e04de){return function(_0x5952fb){_0x3e04de[_0xc7cb('0x4')](_0x518762,_0x5952fb);};}function removeListener(_0x2227de,_0x20a99f){return function(){OpenchannelMessageEvents[_0xc7cb('0x5')](_0x2227de,_0x20a99f);};}exports['register']=function(_0x3819a3){for(var _0x5c0dae=0x0,_0xb91489=events[_0xc7cb('0x6')];_0x5c0dae<_0xb91489;_0x5c0dae++){var _0x53b51e=events[_0x5c0dae];var _0x56dcc9=createListener(_0xc7cb('0x7')+_0x53b51e,_0x3819a3);OpenchannelMessageEvents['on'](_0x53b51e,_0x56dcc9);}}; \ No newline at end of file +var _0x35f5=['length','./openchannelMessage.events','remove','update','removeListener'];(function(_0x486562,_0x13eb52){var _0x35eeb9=function(_0x10f1fb){while(--_0x10f1fb){_0x486562['push'](_0x486562['shift']());}};_0x35eeb9(++_0x13eb52);}(_0x35f5,0x100));var _0x535f=function(_0xc0638b,_0x2fccf4){_0xc0638b=_0xc0638b-0x0;var _0xd57dfa=_0x35f5[_0xc0638b];return _0xd57dfa;};'use strict';var OpenchannelMessageEvents=require(_0x535f('0x0'));var events=['save',_0x535f('0x1'),_0x535f('0x2')];function createListener(_0x46e486,_0xba4dd7){return function(_0x4fd48a){_0xba4dd7['emit'](_0x46e486,_0x4fd48a);};}function removeListener(_0x5f4a18,_0x3a8b37){return function(){OpenchannelMessageEvents[_0x535f('0x3')](_0x5f4a18,_0x3a8b37);};}exports['register']=function(_0x6b403a){for(var _0x4f9d93=0x0,_0x24a137=events[_0x535f('0x4')];_0x4f9d93<_0x24a137;_0x4f9d93++){var _0x4b3440=events[_0x4f9d93];var _0x30802d=createListener('openchannelMessage:'+_0x4b3440,_0x6b403a);OpenchannelMessageEvents['on'](_0x4b3440,_0x30802d);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 3cedf27..f589cad 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 _0x8177=['getAgents','post','create','addTeams','put','update','delete','destroy','removeTeams','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','index','get','/describe','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x5f4c2b,_0x240d07){var _0x2ea5e5=function(_0xeb32a){while(--_0xeb32a){_0x5f4c2b['push'](_0x5f4c2b['shift']());}};_0x2ea5e5(++_0x240d07);}(_0x8177,0x1ca));var _0x7817=function(_0x1bbccb,_0x2e9e82){_0x1bbccb=_0x1bbccb-0x0;var _0x420c2b=_0x8177[_0x1bbccb];return _0x420c2b;};'use strict';var multer=require(_0x7817('0x0'));var util=require(_0x7817('0x1'));var path=require('path');var timeout=require(_0x7817('0x2'));var express=require(_0x7817('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7817('0x4'));var interaction=require(_0x7817('0x5'));var config=require('../../config/environment');var controller=require(_0x7817('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7817('0x7')]);router[_0x7817('0x8')](_0x7817('0x9'),auth[_0x7817('0xa')](),controller[_0x7817('0xb')]);router['get'](_0x7817('0xc'),auth['isAuthenticated'](),controller[_0x7817('0xd')]);router[_0x7817('0x8')]('/:id/members',auth[_0x7817('0xa')](),controller[_0x7817('0xe')]);router[_0x7817('0x8')](_0x7817('0xf'),auth[_0x7817('0xa')](),controller[_0x7817('0x10')]);router[_0x7817('0x8')](_0x7817('0x11'),auth[_0x7817('0xa')](),controller[_0x7817('0x12')]);router[_0x7817('0x13')]('/',auth[_0x7817('0xa')](),controller[_0x7817('0x14')]);router[_0x7817('0x13')](_0x7817('0xf'),auth[_0x7817('0xa')](),controller[_0x7817('0x15')]);router[_0x7817('0x13')](_0x7817('0x11'),auth[_0x7817('0xa')](),controller['addAgents']);router[_0x7817('0x16')](_0x7817('0xc'),auth[_0x7817('0xa')](),controller[_0x7817('0x17')]);router[_0x7817('0x18')](_0x7817('0xc'),auth[_0x7817('0xa')](),controller[_0x7817('0x19')]);router['delete'](_0x7817('0xf'),auth[_0x7817('0xa')](),controller[_0x7817('0x1a')]);router[_0x7817('0x18')](_0x7817('0x11'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x7817('0x1b')]=router; \ No newline at end of file +var _0xbeb2=['./openchannelQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2ccafd,_0x5e05e1){var _0x5461f0=function(_0x345292){while(--_0x345292){_0x2ccafd['push'](_0x2ccafd['shift']());}};_0x5461f0(++_0x5e05e1);}(_0xbeb2,0x1de));var _0x2beb=function(_0x13d82d,_0x33d75f){_0x13d82d=_0x13d82d-0x0;var _0x239dd0=_0xbeb2[_0x13d82d];return _0x239dd0;};'use strict';var multer=require(_0x2beb('0x0'));var util=require(_0x2beb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2beb('0x2'));var router=express[_0x2beb('0x3')]();var fs_extra=require(_0x2beb('0x4'));var auth=require(_0x2beb('0x5'));var interaction=require(_0x2beb('0x6'));var config=require(_0x2beb('0x7'));var controller=require(_0x2beb('0x8'));router[_0x2beb('0x9')]('/',auth[_0x2beb('0xa')](),controller[_0x2beb('0xb')]);router[_0x2beb('0x9')](_0x2beb('0xc'),auth[_0x2beb('0xa')](),controller['describe']);router[_0x2beb('0x9')](_0x2beb('0xd'),auth['isAuthenticated'](),controller[_0x2beb('0xe')]);router[_0x2beb('0x9')]('/:id/members',auth[_0x2beb('0xa')](),controller['getMembers']);router[_0x2beb('0x9')](_0x2beb('0xf'),auth['isAuthenticated'](),controller['getTeams']);router[_0x2beb('0x9')](_0x2beb('0x10'),auth[_0x2beb('0xa')](),controller[_0x2beb('0x11')]);router[_0x2beb('0x12')]('/',auth[_0x2beb('0xa')](),controller['create']);router['post'](_0x2beb('0xf'),auth[_0x2beb('0xa')](),controller[_0x2beb('0x13')]);router[_0x2beb('0x12')](_0x2beb('0x10'),auth['isAuthenticated'](),controller[_0x2beb('0x14')]);router[_0x2beb('0x15')](_0x2beb('0xd'),auth[_0x2beb('0xa')](),controller[_0x2beb('0x16')]);router[_0x2beb('0x17')](_0x2beb('0xd'),auth[_0x2beb('0xa')](),controller[_0x2beb('0x18')]);router[_0x2beb('0x17')](_0x2beb('0xf'),auth['isAuthenticated'](),controller[_0x2beb('0x19')]);router[_0x2beb('0x17')]('/:id/users',auth[_0x2beb('0xa')](),controller[_0x2beb('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 84e0d87..11e9d95 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 _0xa2ae=['rrmemory','beepall','roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0xa2ae,0xd2));var _0xea2a=function(_0x575c75,_0x120aa9){_0x575c75=_0x575c75-0x0;var _0x436370=_0xa2ae[_0x575c75];return _0x436370;};'use strict';var Sequelize=require(_0xea2a('0x0'));module[_0xea2a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xea2a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xea2a('0x3')]},'timeout':{'type':Sequelize[_0xea2a('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xea2a('0x5')](_0xea2a('0x6'),_0xea2a('0x7'),_0xea2a('0x8'))}}; \ No newline at end of file +var _0x21e6=['name','INTEGER','ENUM','rrmemory','roundrobin','sequelize','STRING'];(function(_0x5e897e,_0x530774){var _0x56260b=function(_0x3620b7){while(--_0x3620b7){_0x5e897e['push'](_0x5e897e['shift']());}};_0x56260b(++_0x530774);}(_0x21e6,0x1ef));var _0x621e=function(_0x1cf870,_0x5f172d){_0x1cf870=_0x1cf870-0x0;var _0x439018=_0x21e6[_0x1cf870];return _0x439018;};'use strict';var Sequelize=require(_0x621e('0x0'));module['exports']={'name':{'type':Sequelize[_0x621e('0x1')],'unique':_0x621e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x621e('0x1')]},'timeout':{'type':Sequelize[_0x621e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x621e('0x4')](_0x621e('0x5'),'beepall',_0x621e('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 5cfe121..e79118e 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 _0xcec2=['userOpenchannelQueue:save','ids','field','tq.TeamId','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','removeAgents','forEach','emit','addAgents','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','ejs','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','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','end','status','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','OpenchannelQueues','UserProfileResource','sendStatus','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelQueue','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','rawAttributes','OpenchannelQueueId','UserOpenchannelQueue','User','UserId','agent','openchannelPause','format','SIP','createdAt','updatedAt','getTeams','addTeams','Team','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate'];(function(_0x5e238b,_0x17ae49){var _0x389bea=function(_0x3cc1c1){while(--_0x3cc1c1){_0x5e238b['push'](_0x5e238b['shift']());}};_0x389bea(++_0x17ae49);}(_0xcec2,0x1db));var _0x2cec=function(_0x12ab90,_0x582eb6){_0x12ab90=_0x12ab90-0x0;var _0x49dd65=_0xcec2[_0x12ab90];return _0x49dd65;};'use strict';var emlformat=require(_0x2cec('0x0'));var rimraf=require(_0x2cec('0x1'));var zipdir=require(_0x2cec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2cec('0x3'));var moment=require(_0x2cec('0x4'));var BPromise=require(_0x2cec('0x5'));var Mustache=require(_0x2cec('0x6'));var util=require('util');var path=require(_0x2cec('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2cec('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2cec('0x9'));var squel=require(_0x2cec('0xa'));var crypto=require(_0x2cec('0xb'));var jsforce=require(_0x2cec('0xc'));var deskjs=require(_0x2cec('0xd'));var toCsv=require(_0x2cec('0xe'));var querystring=require(_0x2cec('0xf'));var Papa=require('papaparse');var Redis=require(_0x2cec('0x10'));var authService=require(_0x2cec('0x11'));var qs=require(_0x2cec('0x12'));var as=require(_0x2cec('0x13'));var hardwareService=require(_0x2cec('0x14'));var logger=require(_0x2cec('0x15'))(_0x2cec('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2cec('0x17'));var db=require('../../mysqldb')['db'];config[_0x2cec('0x18')]=_[_0x2cec('0x19')](config[_0x2cec('0x18')],{'host':_0x2cec('0x1a'),'port':0x18eb});var socket=require(_0x2cec('0x1b'))(new Redis(config[_0x2cec('0x18')]));require(_0x2cec('0x1c'))[_0x2cec('0x1d')](socket);function respondWithStatusCode(_0x2a6a1b,_0x3bc6e7){_0x3bc6e7=_0x3bc6e7||0xcc;return function(_0x46df0a){if(_0x46df0a){return _0x2a6a1b['sendStatus'](_0x3bc6e7);}return _0x2a6a1b['status'](_0x3bc6e7)[_0x2cec('0x1e')]();};}function respondWithResult(_0x47d87c,_0x1f59bb){_0x1f59bb=_0x1f59bb||0xc8;return function(_0x8b5601){if(_0x8b5601){return _0x47d87c[_0x2cec('0x1f')](_0x1f59bb)['json'](_0x8b5601);}};}function respondWithFilteredResult(_0x42b0a3,_0x4ca3ba){return function(_0x3f13be){if(_0x3f13be){var _0x10f5f9=typeof _0x4ca3ba[_0x2cec('0x20')]==='undefined'&&typeof _0x4ca3ba[_0x2cec('0x21')]===_0x2cec('0x22');var _0x11cc7d=_0x3f13be[_0x2cec('0x23')];var _0x10b913=_0x10f5f9?0x0:_0x4ca3ba[_0x2cec('0x20')];var _0x21d256=_0x10f5f9?_0x3f13be[_0x2cec('0x23')]:_0x4ca3ba[_0x2cec('0x20')]+_0x4ca3ba['limit'];var _0x542782;if(_0x21d256>=_0x11cc7d){_0x21d256=_0x11cc7d;_0x542782=0xc8;}else{_0x542782=0xce;}_0x42b0a3[_0x2cec('0x1f')](_0x542782);return _0x42b0a3[_0x2cec('0x24')](_0x2cec('0x25'),_0x10b913+'-'+_0x21d256+'/'+_0x11cc7d)['json'](_0x3f13be);}return null;};}function patchUpdates(_0x11aa02){return function(_0x4da7f0){try{jsonpatch[_0x2cec('0x26')](_0x4da7f0,_0x11aa02,!![]);}catch(_0xc3ad7c){return BPromise[_0x2cec('0x27')](_0xc3ad7c);}return _0x4da7f0[_0x2cec('0x28')]();};}function saveUpdates(_0x4db443,_0x58a48f){return function(_0x41c5f8){if(_0x41c5f8){return _0x41c5f8[_0x2cec('0x29')](_0x4db443)[_0x2cec('0x2a')](function(_0x3c9223){return _0x3c9223;});}return null;};}function removeEntity(_0x5f1bf4,_0x3a32e2){return function(_0x1893a1){if(_0x1893a1){return _0x1893a1[_0x2cec('0x2b')]()['then'](function(){var _0x58536a=_0x1893a1['get']({'plain':!![]});var _0x1fb913=_0x2cec('0x2c');return db[_0x2cec('0x2d')][_0x2cec('0x2b')]({'where':{'type':_0x1fb913,'resourceId':_0x58536a['id']}})[_0x2cec('0x2a')](function(){return _0x1893a1;});})['then'](function(){_0x5f1bf4[_0x2cec('0x1f')](0xcc)[_0x2cec('0x1e')]();});}};}function handleEntityNotFound(_0x3122a7,_0x297dfc){return function(_0x95ee7c){if(!_0x95ee7c){_0x3122a7[_0x2cec('0x2e')](0x194);}return _0x95ee7c;};}function handleError(_0x471041,_0x827ebc){_0x827ebc=_0x827ebc||0x1f4;return function(_0x8eb883){logger['error'](_0x8eb883[_0x2cec('0x2f')]);if(_0x8eb883['name']){delete _0x8eb883[_0x2cec('0x30')];}_0x471041['status'](_0x827ebc)[_0x2cec('0x31')](_0x8eb883);};}exports[_0x2cec('0x32')]=function(_0x2fe0b9,_0x1f81a9){var _0x1e6c65={},_0x466026={},_0x440a57={'count':0x0,'rows':[]};var _0x11a80b=_[_0x2cec('0x33')](db['OpenchannelQueue']['rawAttributes'],function(_0x466b89){return{'name':_0x466b89[_0x2cec('0x34')],'type':_0x466b89[_0x2cec('0x35')][_0x2cec('0x36')]};});_0x466026[_0x2cec('0x37')]=_[_0x2cec('0x33')](_0x11a80b,_0x2cec('0x30'));_0x466026[_0x2cec('0x38')]=_[_0x2cec('0x39')](_0x2fe0b9['query']);_0x466026[_0x2cec('0x3a')]=_[_0x2cec('0x3b')](_0x466026[_0x2cec('0x37')],_0x466026['query']);_0x1e6c65[_0x2cec('0x3c')]=_[_0x2cec('0x3b')](_0x466026[_0x2cec('0x37')],qs['fields'](_0x2fe0b9['query'][_0x2cec('0x3d')]));_0x1e6c65[_0x2cec('0x3c')]=_0x1e6c65[_0x2cec('0x3c')][_0x2cec('0x3e')]?_0x1e6c65[_0x2cec('0x3c')]:_0x466026[_0x2cec('0x37')];if(!_0x2fe0b9[_0x2cec('0x38')][_0x2cec('0x3f')](_0x2cec('0x40'))){_0x1e6c65['limit']=qs[_0x2cec('0x21')](_0x2fe0b9[_0x2cec('0x38')][_0x2cec('0x21')]);_0x1e6c65[_0x2cec('0x20')]=qs[_0x2cec('0x20')](_0x2fe0b9[_0x2cec('0x38')][_0x2cec('0x20')]);}_0x1e6c65[_0x2cec('0x41')]=qs[_0x2cec('0x42')](_0x2fe0b9[_0x2cec('0x38')][_0x2cec('0x42')]);_0x1e6c65[_0x2cec('0x43')]=qs[_0x2cec('0x3a')](_[_0x2cec('0x44')](_0x2fe0b9[_0x2cec('0x38')],_0x466026[_0x2cec('0x3a')]),_0x11a80b);if(_0x2fe0b9[_0x2cec('0x38')][_0x2cec('0x45')]){_0x1e6c65[_0x2cec('0x43')]=_[_0x2cec('0x46')](_0x1e6c65[_0x2cec('0x43')],{'$or':_[_0x2cec('0x33')](_0x11a80b,function(_0x4f8686){if(_0x4f8686['type']!==_0x2cec('0x47')){var _0xbea497={};_0xbea497[_0x4f8686[_0x2cec('0x30')]]={'$like':'%'+_0x2fe0b9[_0x2cec('0x38')][_0x2cec('0x45')]+'%'};return _0xbea497;}})});}_0x1e6c65=_[_0x2cec('0x46')]({},_0x1e6c65,_0x2fe0b9[_0x2cec('0x48')]);var _0x562188={'where':_0x1e6c65[_0x2cec('0x43')]};return db[_0x2cec('0x49')][_0x2cec('0x23')](_0x562188)[_0x2cec('0x2a')](function(_0x138b6a){_0x440a57[_0x2cec('0x23')]=_0x138b6a;if(_0x2fe0b9[_0x2cec('0x38')][_0x2cec('0x4a')]){_0x1e6c65[_0x2cec('0x4b')]=[{'all':!![]}];}return db[_0x2cec('0x49')][_0x2cec('0x4c')](_0x1e6c65);})[_0x2cec('0x2a')](function(_0x4d6d73){_0x440a57[_0x2cec('0x4d')]=_0x4d6d73;return _0x440a57;})[_0x2cec('0x2a')](respondWithFilteredResult(_0x1f81a9,_0x1e6c65))[_0x2cec('0x4e')](handleError(_0x1f81a9,null));};exports[_0x2cec('0x4f')]=function(_0x41bd65,_0x2ec896){var _0x251522={'raw':!![],'where':{'id':_0x41bd65[_0x2cec('0x50')]['id']}},_0x542e17={};_0x542e17['model']=_[_0x2cec('0x39')](db[_0x2cec('0x49')]['rawAttributes']);_0x542e17['query']=_['keys'](_0x41bd65[_0x2cec('0x38')]);_0x542e17[_0x2cec('0x3a')]=_[_0x2cec('0x3b')](_0x542e17[_0x2cec('0x37')],_0x542e17[_0x2cec('0x38')]);_0x251522[_0x2cec('0x3c')]=_['intersection'](_0x542e17[_0x2cec('0x37')],qs[_0x2cec('0x3d')](_0x41bd65[_0x2cec('0x38')][_0x2cec('0x3d')]));_0x251522['attributes']=_0x251522[_0x2cec('0x3c')][_0x2cec('0x3e')]?_0x251522['attributes']:_0x542e17[_0x2cec('0x37')];if(_0x41bd65['query']['includeAll']){_0x251522[_0x2cec('0x4b')]=[{'all':!![]}];}_0x251522=_[_0x2cec('0x46')]({},_0x251522,_0x41bd65[_0x2cec('0x48')]);return db[_0x2cec('0x49')][_0x2cec('0x51')](_0x251522)[_0x2cec('0x2a')](handleEntityNotFound(_0x2ec896,null))[_0x2cec('0x2a')](respondWithResult(_0x2ec896,null))[_0x2cec('0x4e')](handleError(_0x2ec896,null));};exports[_0x2cec('0x52')]=function(_0x5420ef,_0x42c249){return db['OpenchannelQueue'][_0x2cec('0x52')](_0x5420ef[_0x2cec('0x53')],{})[_0x2cec('0x2a')](function(_0x355404){var _0x55d562=_0x5420ef[_0x2cec('0x54')]['get']({'plain':!![]});if(!_0x55d562)throw new Error(_0x2cec('0x55'));if(_0x55d562[_0x2cec('0x56')]==='user'){var _0x2947d6=_0x355404[_0x2cec('0x57')]({'plain':!![]});var _0x197d17=_0x2cec('0x2c');return db['UserProfileSection'][_0x2cec('0x51')]({'where':{'name':_0x197d17,'userProfileId':_0x55d562[_0x2cec('0x58')]},'raw':!![]})['then'](function(_0x2edd80){if(_0x2edd80&&_0x2edd80[_0x2cec('0x59')]===0x0){return db[_0x2cec('0x2d')][_0x2cec('0x52')]({'name':_0x2947d6['name'],'resourceId':_0x2947d6['id'],'type':_0x2edd80[_0x2cec('0x30')],'sectionId':_0x2edd80['id']},{})[_0x2cec('0x2a')](function(){return _0x355404;});}else{return _0x355404;}})[_0x2cec('0x4e')](function(_0x2cee8f){logger[_0x2cec('0x5a')](_0x2cec('0x5b'),_0x2cee8f);throw _0x2cee8f;});}return _0x355404;})['then'](respondWithResult(_0x42c249,0xc9))[_0x2cec('0x4e')](handleError(_0x42c249,null));};exports['update']=function(_0x2e3bc1,_0x2e08c4){if(_0x2e3bc1['body']['id']){delete _0x2e3bc1[_0x2cec('0x53')]['id'];}return db['OpenchannelQueue'][_0x2cec('0x51')]({'where':{'id':_0x2e3bc1[_0x2cec('0x50')]['id']}})['then'](handleEntityNotFound(_0x2e08c4,null))['then'](saveUpdates(_0x2e3bc1[_0x2cec('0x53')],null))[_0x2cec('0x2a')](respondWithResult(_0x2e08c4,null))[_0x2cec('0x4e')](handleError(_0x2e08c4,null));};exports[_0x2cec('0x2b')]=function(_0x17357,_0x579b6d){return db[_0x2cec('0x49')][_0x2cec('0x51')]({'where':{'id':_0x17357[_0x2cec('0x50')]['id']}})[_0x2cec('0x2a')](handleEntityNotFound(_0x579b6d,null))[_0x2cec('0x2a')](removeEntity(_0x579b6d,null))[_0x2cec('0x4e')](handleError(_0x579b6d,null));};exports[_0x2cec('0x5c')]=function(_0x509945,_0x171737){return db['OpenchannelQueue'][_0x2cec('0x5c')]()[_0x2cec('0x2a')](respondWithResult(_0x171737,null))['catch'](handleError(_0x171737,null));};exports[_0x2cec('0x5d')]=function(_0x146595,_0x2d9774,_0x577cdc){var _0xa80062={'raw':!![],'where':{}},_0xaf1393={},_0x2af410;return db[_0x2cec('0x49')][_0x2cec('0x5e')]({'where':{'id':_0x146595[_0x2cec('0x50')]['id']}})[_0x2cec('0x2a')](handleEntityNotFound(_0x2d9774,null))[_0x2cec('0x2a')](function(_0x47d21c){if(_0x47d21c){_0x2af410=_0x47d21c[_0x2cec('0x57')]({'plain':!![]});_0xaf1393[_0x2cec('0x37')]=_['keys'](db['UserOpenchannelQueue'][_0x2cec('0x5f')]);_0xaf1393[_0x2cec('0x38')]=_['keys'](_0x146595[_0x2cec('0x38')]);_0xaf1393[_0x2cec('0x3a')]=_['intersection'](_0xaf1393['model'],_0xaf1393['query']);_0xa80062[_0x2cec('0x3c')]=_[_0x2cec('0x3b')](_0xaf1393[_0x2cec('0x37')],qs[_0x2cec('0x3d')](_0x146595['query'][_0x2cec('0x3d')]));_0xa80062[_0x2cec('0x3c')]=_0xa80062[_0x2cec('0x3c')][_0x2cec('0x3e')]?_0xa80062[_0x2cec('0x3c')]:_0xaf1393[_0x2cec('0x37')];if(!_0x146595['query']['hasOwnProperty'](_0x2cec('0x40'))){_0xa80062[_0x2cec('0x21')]=qs[_0x2cec('0x21')](_0x146595[_0x2cec('0x38')][_0x2cec('0x21')]);_0xa80062[_0x2cec('0x20')]=qs[_0x2cec('0x20')](_0x146595[_0x2cec('0x38')][_0x2cec('0x20')]);}_0xa80062['order']=qs[_0x2cec('0x42')](_0x146595[_0x2cec('0x38')]['sort']);_0xa80062['where']=qs['filters'](_[_0x2cec('0x44')](_0x146595[_0x2cec('0x38')],_0xaf1393['filters']));_0xa80062[_0x2cec('0x43')][_0x2cec('0x60')]=_0x47d21c['id'];if(_0x146595[_0x2cec('0x38')]['filter']){_0xa80062[_0x2cec('0x43')]=_[_0x2cec('0x46')](_0xa80062[_0x2cec('0x43')],{'$or':_[_0x2cec('0x33')](_0xa80062[_0x2cec('0x3c')],function(_0x58cf3c){var _0xd55218={};_0xd55218[_0x58cf3c]={'$like':'%'+_0x146595[_0x2cec('0x38')][_0x2cec('0x45')]+'%'};return _0xd55218;})});}_0xa80062=_['merge']({},_0xa80062,_0x146595['options']);return db[_0x2cec('0x61')][_0x2cec('0x4c')](_0xa80062);}})['then'](function(_0x561db6){if(_0x561db6){return db[_0x2cec('0x62')]['findAndCountAll']({'where':{'id':_[_0x2cec('0x33')](_0x561db6,_0x2cec('0x63')),'role':_0x2cec('0x64')},'attributes':['id',_0x2cec('0x30'),_0x2cec('0x65'),'updatedAt','createdAt']});}})['then'](function(_0x1e9308){if(_0x1e9308){return{'count':_0x1e9308[_0x2cec('0x23')],'rows':_[_0x2cec('0x33')](_0x1e9308[_0x2cec('0x4d')],function(_0x3709eb){return{'membername':_0x3709eb[_0x2cec('0x30')],'UserId':_0x3709eb['id'],'queue_name':_0x2af410[_0x2cec('0x30')],'OpenchannelQueueId':_0x2af410['id'],'interface':util[_0x2cec('0x66')]('%s/%s',_0x2cec('0x67'),_0x3709eb[_0x2cec('0x30')]),'penalty':0x0,'paused':_0x3709eb[_0x2cec('0x65')],'createdAt':_0x3709eb[_0x2cec('0x68')],'updatedAt':_0x3709eb[_0x2cec('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2cec('0x2a')](respondWithFilteredResult(_0x2d9774,_0xa80062))[_0x2cec('0x4e')](handleError(_0x2d9774,null));};exports['getTeams']=function(_0x5ed0e0,_0x49c8f2,_0x2450e6){var _0x580125={};var _0x5b460b={};var _0x1b08dd;var _0x336ccf;return db['OpenchannelQueue'][_0x2cec('0x5e')]({'where':{'id':_0x5ed0e0['params']['id']}})[_0x2cec('0x2a')](handleEntityNotFound(_0x49c8f2,null))['then'](function(_0x2d35fc){if(_0x2d35fc){_0x1b08dd=_0x2d35fc;_0x5b460b['model']=_[_0x2cec('0x39')](db['Team'][_0x2cec('0x5f')]);_0x5b460b['query']=_[_0x2cec('0x39')](_0x5ed0e0['query']);_0x5b460b[_0x2cec('0x3a')]=_[_0x2cec('0x3b')](_0x5b460b[_0x2cec('0x37')],_0x5b460b[_0x2cec('0x38')]);_0x580125[_0x2cec('0x3c')]=_[_0x2cec('0x3b')](_0x5b460b[_0x2cec('0x37')],qs[_0x2cec('0x3d')](_0x5ed0e0[_0x2cec('0x38')][_0x2cec('0x3d')]));_0x580125[_0x2cec('0x3c')]=_0x580125[_0x2cec('0x3c')][_0x2cec('0x3e')]?_0x580125[_0x2cec('0x3c')]:_0x5b460b['model'];_0x580125[_0x2cec('0x41')]=qs['sort'](_0x5ed0e0[_0x2cec('0x38')][_0x2cec('0x42')]);_0x580125[_0x2cec('0x43')]=qs[_0x2cec('0x3a')](_['pick'](_0x5ed0e0['query'],_0x5b460b[_0x2cec('0x3a')]));if(_0x5ed0e0[_0x2cec('0x38')][_0x2cec('0x45')]){_0x580125[_0x2cec('0x43')]=_['merge'](_0x580125[_0x2cec('0x43')],{'$or':_[_0x2cec('0x33')](_0x580125[_0x2cec('0x3c')],function(_0x4cf371){var _0x396b66={};_0x396b66[_0x4cf371]={'$like':'%'+_0x5ed0e0[_0x2cec('0x38')][_0x2cec('0x45')]+'%'};return _0x396b66;})});}_0x580125=_[_0x2cec('0x46')]({},_0x580125,_0x5ed0e0[_0x2cec('0x48')]);return _0x1b08dd[_0x2cec('0x6a')](_0x580125);}})[_0x2cec('0x2a')](function(_0x113fad){if(_0x113fad){_0x336ccf=_0x113fad[_0x2cec('0x3e')];if(!_0x5ed0e0[_0x2cec('0x38')][_0x2cec('0x3f')](_0x2cec('0x40'))){_0x580125[_0x2cec('0x21')]=qs[_0x2cec('0x21')](_0x5ed0e0[_0x2cec('0x38')][_0x2cec('0x21')]);_0x580125['offset']=qs[_0x2cec('0x20')](_0x5ed0e0[_0x2cec('0x38')][_0x2cec('0x20')]);}return _0x1b08dd[_0x2cec('0x6a')](_0x580125);}})[_0x2cec('0x2a')](function(_0x53f5b1){if(_0x53f5b1){return _0x53f5b1?{'count':_0x336ccf,'rows':_0x53f5b1}:null;}})[_0x2cec('0x2a')](respondWithResult(_0x49c8f2,null))[_0x2cec('0x4e')](handleError(_0x49c8f2,null));};exports[_0x2cec('0x6b')]=function(_0x48712b,_0x436913,_0x123018){var _0x35e263=_0x48712b[_0x2cec('0x53')]['ids'];return db[_0x2cec('0x6c')]['findAll']({'where':{'id':_0x35e263},'attributes':['id'],'include':[{'model':db[_0x2cec('0x62')],'as':_0x2cec('0x6d'),'attributes':['id',_0x2cec('0x30'),_0x2cec('0x6e'),'voicePause',_0x2cec('0x6f')],'raw':!![]}]})[_0x2cec('0x2a')](function(_0x357333){if(_0x357333){var _0xbbed89=_[_0x2cec('0x70')](_0x357333,function(_0x303db0){var _0x3169c1=_0x303db0[_0x2cec('0x57')]({'plain':!![]});return _0x3169c1[_0x2cec('0x6d')];});return db[_0x2cec('0x49')][_0x2cec('0x51')]({'where':{'id':_0x48712b['params']['id']}})[_0x2cec('0x2a')](function(_0x15df67){return db[_0x2cec('0x71')][_0x2cec('0x72')](function(_0x3e9b67){return _0x15df67[_0x2cec('0x6b')](_0x35e263,{'transaction':_0x3e9b67})[_0x2cec('0x2a')](function(){return BPromise[_0x2cec('0x73')](_0xbbed89,function(_0x11af1e){return db[_0x2cec('0x61')][_0x2cec('0x74')]({'where':{'UserId':_0x11af1e['id'],'OpenchannelQueueId':_0x48712b[_0x2cec('0x50')]['id']},'transaction':_0x3e9b67});});})[_0x2cec('0x2a')](function(){_0xbbed89['forEach'](function(_0x3241d1){socket['emit'](_0x2cec('0x75'),{'UserId':_0x3241d1['id'],'OpenchannelQueueId':_0x15df67['id']});});});});});}})[_0x2cec('0x2a')](respondWithStatusCode(_0x436913,null))[_0x2cec('0x4e')](handleError(_0x436913,null));};exports['removeTeams']=function(_0x50ef03,_0x4aebdf,_0x10e902){return db[_0x2cec('0x6c')][_0x2cec('0x4c')]({'where':{'id':_0x50ef03[_0x2cec('0x38')][_0x2cec('0x76')]},'attributes':['id'],'include':[{'model':db[_0x2cec('0x62')],'as':_0x2cec('0x6d'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4aebdf,null))[_0x2cec('0x2a')](function(_0x503393){var _0x1caad3=_[_0x2cec('0x33')](_0x503393,'id');var _0x4d7000=[];var _0x12c3f8=[];var _0x532de0=squel['select']();_0x532de0[_0x2cec('0x77')](_0x2cec('0x78'))['from'](_0x2cec('0x79'),'tq')['join'](_0x2cec('0x7a'),'ut',_0x2cec('0x7b'))[_0x2cec('0x43')](_0x2cec('0x7c'),_0x50ef03['params']['id']);for(var _0x54fd2f=0x0;_0x54fd2f<_0x503393[_0x2cec('0x3e')];_0x54fd2f+=0x1){let _0x57989f=_0x503393[_0x54fd2f];for(var _0x78c9cd=0x0;_0x78c9cd<_0x57989f['Agents'][_0x2cec('0x3e')];_0x78c9cd+=0x1){let _0x221a4e=_0x57989f[_0x2cec('0x6d')][_0x78c9cd];var _0x25fb6c=_0x532de0[_0x2cec('0x7d')]();_0x25fb6c[_0x2cec('0x43')](_0x2cec('0x7e'),_0x221a4e['id']);_0x12c3f8[_0x2cec('0x7f')](db[_0x2cec('0x71')][_0x2cec('0x38')](_0x25fb6c[_0x2cec('0x80')](),{'type':db[_0x2cec('0x71')][_0x2cec('0x81')][_0x2cec('0x82')]})['then'](function(_0x4ad2ce){if(_0x4ad2ce[_0x2cec('0x3e')]===0x1){return _0x221a4e['id'];}else{var _0x4ccfbc=_[_0x2cec('0x83')](_[_0x2cec('0x33')](_0x4ad2ce,_0x2cec('0x84')),function(_0x3d8ba7){return _[_0x2cec('0x85')](_0x1caad3,_0x3d8ba7);});if(_0x4ccfbc){return _0x221a4e['id'];}}}));}}return BPromise[_0x2cec('0x86')](_0x12c3f8)[_0x2cec('0x2a')](function(_0x254001){_0x4d7000=_(_0x4d7000)[_0x2cec('0x87')](_0x254001)[_0x2cec('0x88')]()[_0x2cec('0x89')]();return db[_0x2cec('0x49')]['find']({'where':{'id':_0x50ef03[_0x2cec('0x50')]['id']}})[_0x2cec('0x2a')](function(_0x43bf3a){return db['sequelize'][_0x2cec('0x72')](function(_0xa0056d){return _0x43bf3a[_0x2cec('0x8a')](_0x50ef03[_0x2cec('0x38')][_0x2cec('0x76')],{'transaction':_0xa0056d})['then'](function(){if(!_['isEmpty'](_0x4d7000)){return _0x43bf3a[_0x2cec('0x8b')](_0x4d7000,{'transaction':_0xa0056d});}})[_0x2cec('0x2a')](function(){_0x4d7000[_0x2cec('0x8c')](function(_0x550e33){socket[_0x2cec('0x8d')]('userOpenchannelQueue:remove',{'UserId':_0x550e33,'OpenchannelQueueId':_0x43bf3a['id']});});});});});});})['then'](respondWithStatusCode(_0x4aebdf,null))['catch'](handleError(_0x4aebdf,null));};exports[_0x2cec('0x8e')]=function(_0x354644,_0x31a425,_0x27c673){return db['OpenchannelQueue'][_0x2cec('0x51')]({'where':{'id':_0x354644[_0x2cec('0x50')]['id']}})['then'](handleEntityNotFound(_0x31a425,null))[_0x2cec('0x2a')](function(_0x21f820){if(_0x21f820){return _0x21f820['addAgents'](_0x354644['body'][_0x2cec('0x76')],_[_0x2cec('0x8f')](_0x354644[_0x2cec('0x53')],[_0x2cec('0x76'),'id'])||{})[_0x2cec('0x90')](function(_0x423fc4){for(var _0x220dc0=0x0;_0x220dc0<_0x354644[_0x2cec('0x53')][_0x2cec('0x76')][_0x2cec('0x3e')];_0x220dc0+=0x1){socket[_0x2cec('0x8d')](_0x2cec('0x75'),{'UserId':Number(_0x354644['body'][_0x2cec('0x76')][_0x220dc0]),'OpenchannelQueueId':Number(_0x354644[_0x2cec('0x50')]['id'])});}return _0x423fc4;});}})[_0x2cec('0x2a')](respondWithResult(_0x31a425,null))[_0x2cec('0x4e')](handleError(_0x31a425,null));};exports['removeAgents']=function(_0x2b4598,_0x72cf5a,_0x31eab3){return db[_0x2cec('0x49')]['find']({'where':{'id':_0x2b4598['params']['id']}})[_0x2cec('0x2a')](handleEntityNotFound(_0x72cf5a,null))[_0x2cec('0x2a')](function(_0x4bf039){if(_0x4bf039){return _0x4bf039[_0x2cec('0x8b')](_0x2b4598[_0x2cec('0x38')][_0x2cec('0x76')])[_0x2cec('0x2a')](function(){if(_[_0x2cec('0x91')](_0x2b4598[_0x2cec('0x38')]['ids'])){for(var _0x1921dc=0x0;_0x1921dc<_0x2b4598['query']['ids']['length'];_0x1921dc+=0x1){socket[_0x2cec('0x8d')](_0x2cec('0x92'),{'UserId':Number(_0x2b4598[_0x2cec('0x38')][_0x2cec('0x76')][_0x1921dc]),'OpenchannelQueueId':Number(_0x2b4598[_0x2cec('0x50')]['id'])});}}else{socket[_0x2cec('0x8d')](_0x2cec('0x92'),{'UserId':Number(_0x2b4598['query'][_0x2cec('0x76')]),'OpenchannelQueueId':Number(_0x2b4598['params']['id'])});}});}})[_0x2cec('0x2a')](respondWithStatusCode(_0x72cf5a,null))[_0x2cec('0x4e')](handleError(_0x72cf5a,null));};exports[_0x2cec('0x93')]=function(_0x1ce45c,_0x47ca12,_0x1cbfde){var _0x2ae942={};var _0x431f01={};var _0x1a2e24;var _0x259e88;return db[_0x2cec('0x49')][_0x2cec('0x5e')]({'where':{'id':_0x1ce45c[_0x2cec('0x50')]['id']}})['then'](handleEntityNotFound(_0x47ca12,null))[_0x2cec('0x2a')](function(_0x362866){if(_0x362866){_0x1a2e24=_0x362866;_0x431f01[_0x2cec('0x37')]=_[_0x2cec('0x39')](db[_0x2cec('0x62')]['rawAttributes']);_0x431f01[_0x2cec('0x38')]=_[_0x2cec('0x39')](_0x1ce45c[_0x2cec('0x38')]);_0x431f01[_0x2cec('0x3a')]=_[_0x2cec('0x3b')](_0x431f01[_0x2cec('0x37')],_0x431f01[_0x2cec('0x38')]);_0x2ae942[_0x2cec('0x3c')]=_['intersection'](_0x431f01[_0x2cec('0x37')],qs['fields'](_0x1ce45c[_0x2cec('0x38')][_0x2cec('0x3d')]));_0x2ae942[_0x2cec('0x3c')]=_0x2ae942[_0x2cec('0x3c')][_0x2cec('0x3e')]?_0x2ae942[_0x2cec('0x3c')]:_0x431f01[_0x2cec('0x37')];_0x2ae942[_0x2cec('0x41')]=qs['sort'](_0x1ce45c['query'][_0x2cec('0x42')]);_0x2ae942[_0x2cec('0x43')]=qs['filters'](_[_0x2cec('0x44')](_0x1ce45c[_0x2cec('0x38')],_0x431f01[_0x2cec('0x3a')]));if(_0x1ce45c[_0x2cec('0x38')][_0x2cec('0x45')]){_0x2ae942[_0x2cec('0x43')]=_['merge'](_0x2ae942[_0x2cec('0x43')],{'$or':_[_0x2cec('0x33')](_0x2ae942[_0x2cec('0x3c')],function(_0x28bd1e){var _0x3792f7={};_0x3792f7[_0x28bd1e]={'$like':'%'+_0x1ce45c['query'][_0x2cec('0x45')]+'%'};return _0x3792f7;})});}_0x2ae942=_[_0x2cec('0x46')]({},_0x2ae942,_0x1ce45c[_0x2cec('0x48')]);return _0x1a2e24['getAgents'](_0x2ae942);}})['then'](function(_0x5ba8f1){if(_0x5ba8f1){_0x259e88=_0x5ba8f1['length'];if(!_0x1ce45c[_0x2cec('0x38')]['hasOwnProperty']('nolimit')){_0x2ae942['limit']=qs[_0x2cec('0x21')](_0x1ce45c['query'][_0x2cec('0x21')]);_0x2ae942[_0x2cec('0x20')]=qs[_0x2cec('0x20')](_0x1ce45c[_0x2cec('0x38')]['offset']);}return _0x1a2e24[_0x2cec('0x93')](_0x2ae942);}})[_0x2cec('0x2a')](function(_0x29216f){if(_0x29216f){return _0x29216f?{'count':_0x259e88,'rows':_0x29216f}:null;}})[_0x2cec('0x2a')](respondWithResult(_0x47ca12,null))[_0x2cec('0x4e')](handleError(_0x47ca12,null));}; \ No newline at end of file +var _0x0e8b=['Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','hasOwnProperty','findAll','User','findAndCountAll','UserId','agent','updatedAt','createdAt','%s/%s','SIP','openchannelPause','getTeams','Team','ids','Agents','online','voicePause','transaction','addTeams','UserOpenchannelQueue','findOrCreate','forEach','emit','userOpenchannelQueue:save','select','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','includes','all','union','compact','removeTeams','removeAgents','userOpenchannelQueue:remove','addAgents','omit','isArray','getAgents','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','./openchannelQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','OpenchannelQueues','UserProfileResource','destroy','end','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','merge','includeAll','rows','catch','show','include','options','create','body','user'];(function(_0x14af47,_0x3a55bd){var _0x3052f0=function(_0x4e8433){while(--_0x4e8433){_0x14af47['push'](_0x14af47['shift']());}};_0x3052f0(++_0x3a55bd);}(_0x0e8b,0xc1));var _0xb0e8=function(_0x3179e1,_0x19624b){_0x3179e1=_0x3179e1-0x0;var _0x5b9fa0=_0x0e8b[_0x3179e1];return _0x5b9fa0;};'use strict';var emlformat=require(_0xb0e8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb0e8('0x1'));var jsonpatch=require(_0xb0e8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb0e8('0x3'));var Mustache=require(_0xb0e8('0x4'));var util=require(_0xb0e8('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb0e8('0x6'));var fs=require('fs');var fs_extra=require(_0xb0e8('0x7'));var _=require(_0xb0e8('0x8'));var squel=require('squel');var crypto=require(_0xb0e8('0x9'));var jsforce=require(_0xb0e8('0xa'));var deskjs=require(_0xb0e8('0xb'));var toCsv=require(_0xb0e8('0xc'));var querystring=require('querystring');var Papa=require(_0xb0e8('0xd'));var Redis=require(_0xb0e8('0xe'));var authService=require(_0xb0e8('0xf'));var qs=require(_0xb0e8('0x10'));var as=require(_0xb0e8('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb0e8('0x12'));var utils=require(_0xb0e8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xb0e8('0x14'));var db=require(_0xb0e8('0x15'))['db'];config['redis']=_[_0xb0e8('0x16')](config[_0xb0e8('0x17')],{'host':_0xb0e8('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb0e8('0x17')]));require(_0xb0e8('0x19'))[_0xb0e8('0x1a')](socket);function respondWithStatusCode(_0x48e643,_0x3f1f21){_0x3f1f21=_0x3f1f21||0xcc;return function(_0xbcacbb){if(_0xbcacbb){return _0x48e643[_0xb0e8('0x1b')](_0x3f1f21);}return _0x48e643[_0xb0e8('0x1c')](_0x3f1f21)['end']();};}function respondWithResult(_0x483393,_0x5d1d45){_0x5d1d45=_0x5d1d45||0xc8;return function(_0x4bd104){if(_0x4bd104){return _0x483393[_0xb0e8('0x1c')](_0x5d1d45)[_0xb0e8('0x1d')](_0x4bd104);}};}function respondWithFilteredResult(_0x93dc93,_0x3e7a2f){return function(_0x6eebdf){if(_0x6eebdf){var _0x4c6eb5=typeof _0x3e7a2f[_0xb0e8('0x1e')]===_0xb0e8('0x1f')&&typeof _0x3e7a2f[_0xb0e8('0x20')]===_0xb0e8('0x1f');var _0x46ec42=_0x6eebdf[_0xb0e8('0x21')];var _0x87370a=_0x4c6eb5?0x0:_0x3e7a2f[_0xb0e8('0x1e')];var _0x5e5fb9=_0x4c6eb5?_0x6eebdf[_0xb0e8('0x21')]:_0x3e7a2f['offset']+_0x3e7a2f[_0xb0e8('0x20')];var _0x46873a;if(_0x5e5fb9>=_0x46ec42){_0x5e5fb9=_0x46ec42;_0x46873a=0xc8;}else{_0x46873a=0xce;}_0x93dc93['status'](_0x46873a);return _0x93dc93['set'](_0xb0e8('0x22'),_0x87370a+'-'+_0x5e5fb9+'/'+_0x46ec42)[_0xb0e8('0x1d')](_0x6eebdf);}return null;};}function patchUpdates(_0x480717){return function(_0x464710){try{jsonpatch[_0xb0e8('0x23')](_0x464710,_0x480717,!![]);}catch(_0x3eacf0){return BPromise[_0xb0e8('0x24')](_0x3eacf0);}return _0x464710[_0xb0e8('0x25')]();};}function saveUpdates(_0x1f4203,_0x63d49a){return function(_0x7ba2c1){if(_0x7ba2c1){return _0x7ba2c1[_0xb0e8('0x26')](_0x1f4203)[_0xb0e8('0x27')](function(_0x58186d){return _0x58186d;});}return null;};}function removeEntity(_0x9bd36b,_0x49cfc7){return function(_0x4dc5a9){if(_0x4dc5a9){return _0x4dc5a9['destroy']()['then'](function(){var _0x2c7ec5=_0x4dc5a9[_0xb0e8('0x28')]({'plain':!![]});var _0x51e9aa=_0xb0e8('0x29');return db[_0xb0e8('0x2a')][_0xb0e8('0x2b')]({'where':{'type':_0x51e9aa,'resourceId':_0x2c7ec5['id']}})[_0xb0e8('0x27')](function(){return _0x4dc5a9;});})[_0xb0e8('0x27')](function(){_0x9bd36b[_0xb0e8('0x1c')](0xcc)[_0xb0e8('0x2c')]();});}};}function handleEntityNotFound(_0x35f3f9,_0x254572){return function(_0x222aa9){if(!_0x222aa9){_0x35f3f9[_0xb0e8('0x1b')](0x194);}return _0x222aa9;};}function handleError(_0x4be570,_0x3a0234){_0x3a0234=_0x3a0234||0x1f4;return function(_0x174bfc){logger['error'](_0x174bfc[_0xb0e8('0x2d')]);if(_0x174bfc['name']){delete _0x174bfc[_0xb0e8('0x2e')];}_0x4be570[_0xb0e8('0x1c')](_0x3a0234)[_0xb0e8('0x2f')](_0x174bfc);};}exports[_0xb0e8('0x30')]=function(_0x2b70d7,_0x17ca5d){var _0x53c147={},_0x3e67b2={},_0x492caf={'count':0x0,'rows':[]};var _0x1a0ec0=_[_0xb0e8('0x31')](db[_0xb0e8('0x32')][_0xb0e8('0x33')],function(_0x480270){return{'name':_0x480270[_0xb0e8('0x34')],'type':_0x480270['type'][_0xb0e8('0x35')]};});_0x3e67b2[_0xb0e8('0x36')]=_[_0xb0e8('0x31')](_0x1a0ec0,_0xb0e8('0x2e'));_0x3e67b2[_0xb0e8('0x37')]=_[_0xb0e8('0x38')](_0x2b70d7[_0xb0e8('0x37')]);_0x3e67b2[_0xb0e8('0x39')]=_[_0xb0e8('0x3a')](_0x3e67b2[_0xb0e8('0x36')],_0x3e67b2[_0xb0e8('0x37')]);_0x53c147[_0xb0e8('0x3b')]=_['intersection'](_0x3e67b2['model'],qs['fields'](_0x2b70d7['query'][_0xb0e8('0x3c')]));_0x53c147['attributes']=_0x53c147[_0xb0e8('0x3b')][_0xb0e8('0x3d')]?_0x53c147[_0xb0e8('0x3b')]:_0x3e67b2[_0xb0e8('0x36')];if(!_0x2b70d7[_0xb0e8('0x37')]['hasOwnProperty'](_0xb0e8('0x3e'))){_0x53c147[_0xb0e8('0x20')]=qs[_0xb0e8('0x20')](_0x2b70d7[_0xb0e8('0x37')][_0xb0e8('0x20')]);_0x53c147[_0xb0e8('0x1e')]=qs[_0xb0e8('0x1e')](_0x2b70d7[_0xb0e8('0x37')]['offset']);}_0x53c147[_0xb0e8('0x3f')]=qs[_0xb0e8('0x40')](_0x2b70d7[_0xb0e8('0x37')][_0xb0e8('0x40')]);_0x53c147[_0xb0e8('0x41')]=qs[_0xb0e8('0x39')](_[_0xb0e8('0x42')](_0x2b70d7['query'],_0x3e67b2[_0xb0e8('0x39')]),_0x1a0ec0);if(_0x2b70d7['query'][_0xb0e8('0x43')]){_0x53c147[_0xb0e8('0x41')]=_['merge'](_0x53c147[_0xb0e8('0x41')],{'$or':_[_0xb0e8('0x31')](_0x1a0ec0,function(_0xfa0750){if(_0xfa0750[_0xb0e8('0x44')]!=='VIRTUAL'){var _0x214e2e={};_0x214e2e[_0xfa0750['name']]={'$like':'%'+_0x2b70d7['query']['filter']+'%'};return _0x214e2e;}})});}_0x53c147=_[_0xb0e8('0x45')]({},_0x53c147,_0x2b70d7['options']);var _0x1242f7={'where':_0x53c147[_0xb0e8('0x41')]};return db[_0xb0e8('0x32')][_0xb0e8('0x21')](_0x1242f7)['then'](function(_0x27b3dc){_0x492caf[_0xb0e8('0x21')]=_0x27b3dc;if(_0x2b70d7[_0xb0e8('0x37')][_0xb0e8('0x46')]){_0x53c147['include']=[{'all':!![]}];}return db['OpenchannelQueue']['findAll'](_0x53c147);})[_0xb0e8('0x27')](function(_0x461628){_0x492caf[_0xb0e8('0x47')]=_0x461628;return _0x492caf;})[_0xb0e8('0x27')](respondWithFilteredResult(_0x17ca5d,_0x53c147))[_0xb0e8('0x48')](handleError(_0x17ca5d,null));};exports[_0xb0e8('0x49')]=function(_0x2b9a75,_0x233eb1){var _0x5b7eb6={'raw':!![],'where':{'id':_0x2b9a75['params']['id']}},_0x56cfa5={};_0x56cfa5[_0xb0e8('0x36')]=_[_0xb0e8('0x38')](db['OpenchannelQueue'][_0xb0e8('0x33')]);_0x56cfa5[_0xb0e8('0x37')]=_['keys'](_0x2b9a75[_0xb0e8('0x37')]);_0x56cfa5[_0xb0e8('0x39')]=_[_0xb0e8('0x3a')](_0x56cfa5[_0xb0e8('0x36')],_0x56cfa5[_0xb0e8('0x37')]);_0x5b7eb6[_0xb0e8('0x3b')]=_[_0xb0e8('0x3a')](_0x56cfa5[_0xb0e8('0x36')],qs['fields'](_0x2b9a75['query'][_0xb0e8('0x3c')]));_0x5b7eb6[_0xb0e8('0x3b')]=_0x5b7eb6[_0xb0e8('0x3b')][_0xb0e8('0x3d')]?_0x5b7eb6[_0xb0e8('0x3b')]:_0x56cfa5[_0xb0e8('0x36')];if(_0x2b9a75[_0xb0e8('0x37')][_0xb0e8('0x46')]){_0x5b7eb6[_0xb0e8('0x4a')]=[{'all':!![]}];}_0x5b7eb6=_[_0xb0e8('0x45')]({},_0x5b7eb6,_0x2b9a75[_0xb0e8('0x4b')]);return db[_0xb0e8('0x32')]['find'](_0x5b7eb6)[_0xb0e8('0x27')](handleEntityNotFound(_0x233eb1,null))['then'](respondWithResult(_0x233eb1,null))['catch'](handleError(_0x233eb1,null));};exports[_0xb0e8('0x4c')]=function(_0x2a74b9,_0x103211){return db[_0xb0e8('0x32')][_0xb0e8('0x4c')](_0x2a74b9[_0xb0e8('0x4d')],{})[_0xb0e8('0x27')](function(_0x365817){var _0x1ea36e=_0x2a74b9[_0xb0e8('0x4e')][_0xb0e8('0x28')]({'plain':!![]});if(!_0x1ea36e)throw new Error(_0xb0e8('0x4f'));if(_0x1ea36e['role']==='user'){var _0x1fc07a=_0x365817[_0xb0e8('0x28')]({'plain':!![]});var _0x4d5020=_0xb0e8('0x29');return db[_0xb0e8('0x50')][_0xb0e8('0x51')]({'where':{'name':_0x4d5020,'userProfileId':_0x1ea36e['userProfileId']},'raw':!![]})[_0xb0e8('0x27')](function(_0x5afade){if(_0x5afade&&_0x5afade[_0xb0e8('0x52')]===0x0){return db['UserProfileResource'][_0xb0e8('0x4c')]({'name':_0x1fc07a[_0xb0e8('0x2e')],'resourceId':_0x1fc07a['id'],'type':_0x5afade[_0xb0e8('0x2e')],'sectionId':_0x5afade['id']},{})[_0xb0e8('0x27')](function(){return _0x365817;});}else{return _0x365817;}})[_0xb0e8('0x48')](function(_0x4bd877){logger['error'](_0xb0e8('0x53'),_0x4bd877);throw _0x4bd877;});}return _0x365817;})['then'](respondWithResult(_0x103211,0xc9))['catch'](handleError(_0x103211,null));};exports['update']=function(_0x44dd69,_0xa8b6b2){if(_0x44dd69['body']['id']){delete _0x44dd69[_0xb0e8('0x4d')]['id'];}return db[_0xb0e8('0x32')]['find']({'where':{'id':_0x44dd69[_0xb0e8('0x54')]['id']}})[_0xb0e8('0x27')](handleEntityNotFound(_0xa8b6b2,null))['then'](saveUpdates(_0x44dd69[_0xb0e8('0x4d')],null))[_0xb0e8('0x27')](respondWithResult(_0xa8b6b2,null))[_0xb0e8('0x48')](handleError(_0xa8b6b2,null));};exports[_0xb0e8('0x2b')]=function(_0x456444,_0x9b0ef2){return db['OpenchannelQueue'][_0xb0e8('0x51')]({'where':{'id':_0x456444['params']['id']}})[_0xb0e8('0x27')](handleEntityNotFound(_0x9b0ef2,null))[_0xb0e8('0x27')](removeEntity(_0x9b0ef2,null))['catch'](handleError(_0x9b0ef2,null));};exports[_0xb0e8('0x55')]=function(_0xc9db70,_0x5d4b92){return db[_0xb0e8('0x32')]['describe']()[_0xb0e8('0x27')](respondWithResult(_0x5d4b92,null))[_0xb0e8('0x48')](handleError(_0x5d4b92,null));};exports['getMembers']=function(_0x43f671,_0x458c13,_0x46ae9d){var _0x4ff2d6={'raw':!![],'where':{}},_0x44675c={},_0x4935fa;return db[_0xb0e8('0x32')][_0xb0e8('0x56')]({'where':{'id':_0x43f671['params']['id']}})['then'](handleEntityNotFound(_0x458c13,null))[_0xb0e8('0x27')](function(_0x166953){if(_0x166953){_0x4935fa=_0x166953[_0xb0e8('0x28')]({'plain':!![]});_0x44675c['model']=_[_0xb0e8('0x38')](db['UserOpenchannelQueue'][_0xb0e8('0x33')]);_0x44675c[_0xb0e8('0x37')]=_[_0xb0e8('0x38')](_0x43f671[_0xb0e8('0x37')]);_0x44675c[_0xb0e8('0x39')]=_[_0xb0e8('0x3a')](_0x44675c[_0xb0e8('0x36')],_0x44675c['query']);_0x4ff2d6['attributes']=_[_0xb0e8('0x3a')](_0x44675c[_0xb0e8('0x36')],qs[_0xb0e8('0x3c')](_0x43f671['query']['fields']));_0x4ff2d6[_0xb0e8('0x3b')]=_0x4ff2d6['attributes'][_0xb0e8('0x3d')]?_0x4ff2d6[_0xb0e8('0x3b')]:_0x44675c[_0xb0e8('0x36')];if(!_0x43f671['query'][_0xb0e8('0x57')](_0xb0e8('0x3e'))){_0x4ff2d6[_0xb0e8('0x20')]=qs[_0xb0e8('0x20')](_0x43f671[_0xb0e8('0x37')]['limit']);_0x4ff2d6[_0xb0e8('0x1e')]=qs[_0xb0e8('0x1e')](_0x43f671['query'][_0xb0e8('0x1e')]);}_0x4ff2d6[_0xb0e8('0x3f')]=qs[_0xb0e8('0x40')](_0x43f671['query'][_0xb0e8('0x40')]);_0x4ff2d6['where']=qs[_0xb0e8('0x39')](_[_0xb0e8('0x42')](_0x43f671[_0xb0e8('0x37')],_0x44675c[_0xb0e8('0x39')]));_0x4ff2d6[_0xb0e8('0x41')]['OpenchannelQueueId']=_0x166953['id'];if(_0x43f671[_0xb0e8('0x37')][_0xb0e8('0x43')]){_0x4ff2d6[_0xb0e8('0x41')]=_['merge'](_0x4ff2d6[_0xb0e8('0x41')],{'$or':_['map'](_0x4ff2d6[_0xb0e8('0x3b')],function(_0x29c1e3){var _0x12b678={};_0x12b678[_0x29c1e3]={'$like':'%'+_0x43f671[_0xb0e8('0x37')][_0xb0e8('0x43')]+'%'};return _0x12b678;})});}_0x4ff2d6=_[_0xb0e8('0x45')]({},_0x4ff2d6,_0x43f671[_0xb0e8('0x4b')]);return db['UserOpenchannelQueue'][_0xb0e8('0x58')](_0x4ff2d6);}})[_0xb0e8('0x27')](function(_0x442d8e){if(_0x442d8e){return db[_0xb0e8('0x59')][_0xb0e8('0x5a')]({'where':{'id':_['map'](_0x442d8e,_0xb0e8('0x5b')),'role':_0xb0e8('0x5c')},'attributes':['id','name','openchannelPause',_0xb0e8('0x5d'),_0xb0e8('0x5e')]});}})[_0xb0e8('0x27')](function(_0xc37ec3){if(_0xc37ec3){return{'count':_0xc37ec3[_0xb0e8('0x21')],'rows':_[_0xb0e8('0x31')](_0xc37ec3['rows'],function(_0x3c319e){return{'membername':_0x3c319e['name'],'UserId':_0x3c319e['id'],'queue_name':_0x4935fa[_0xb0e8('0x2e')],'OpenchannelQueueId':_0x4935fa['id'],'interface':util['format'](_0xb0e8('0x5f'),_0xb0e8('0x60'),_0x3c319e['name']),'penalty':0x0,'paused':_0x3c319e[_0xb0e8('0x61')],'createdAt':_0x3c319e[_0xb0e8('0x5e')],'updatedAt':_0x3c319e[_0xb0e8('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb0e8('0x27')](respondWithFilteredResult(_0x458c13,_0x4ff2d6))[_0xb0e8('0x48')](handleError(_0x458c13,null));};exports[_0xb0e8('0x62')]=function(_0x55f65c,_0x28cd3b,_0x5517cc){var _0x3d4965={};var _0xbc045c={};var _0x58a4db;var _0x30002c;return db[_0xb0e8('0x32')][_0xb0e8('0x56')]({'where':{'id':_0x55f65c[_0xb0e8('0x54')]['id']}})[_0xb0e8('0x27')](handleEntityNotFound(_0x28cd3b,null))[_0xb0e8('0x27')](function(_0x1afa21){if(_0x1afa21){_0x58a4db=_0x1afa21;_0xbc045c[_0xb0e8('0x36')]=_[_0xb0e8('0x38')](db[_0xb0e8('0x63')][_0xb0e8('0x33')]);_0xbc045c[_0xb0e8('0x37')]=_[_0xb0e8('0x38')](_0x55f65c[_0xb0e8('0x37')]);_0xbc045c[_0xb0e8('0x39')]=_[_0xb0e8('0x3a')](_0xbc045c[_0xb0e8('0x36')],_0xbc045c[_0xb0e8('0x37')]);_0x3d4965['attributes']=_[_0xb0e8('0x3a')](_0xbc045c[_0xb0e8('0x36')],qs['fields'](_0x55f65c[_0xb0e8('0x37')]['fields']));_0x3d4965[_0xb0e8('0x3b')]=_0x3d4965[_0xb0e8('0x3b')][_0xb0e8('0x3d')]?_0x3d4965[_0xb0e8('0x3b')]:_0xbc045c['model'];_0x3d4965['order']=qs['sort'](_0x55f65c[_0xb0e8('0x37')]['sort']);_0x3d4965['where']=qs[_0xb0e8('0x39')](_['pick'](_0x55f65c['query'],_0xbc045c[_0xb0e8('0x39')]));if(_0x55f65c[_0xb0e8('0x37')][_0xb0e8('0x43')]){_0x3d4965[_0xb0e8('0x41')]=_['merge'](_0x3d4965[_0xb0e8('0x41')],{'$or':_[_0xb0e8('0x31')](_0x3d4965[_0xb0e8('0x3b')],function(_0x2b8457){var _0x1dca86={};_0x1dca86[_0x2b8457]={'$like':'%'+_0x55f65c[_0xb0e8('0x37')][_0xb0e8('0x43')]+'%'};return _0x1dca86;})});}_0x3d4965=_[_0xb0e8('0x45')]({},_0x3d4965,_0x55f65c[_0xb0e8('0x4b')]);return _0x58a4db[_0xb0e8('0x62')](_0x3d4965);}})[_0xb0e8('0x27')](function(_0x3b317e){if(_0x3b317e){_0x30002c=_0x3b317e[_0xb0e8('0x3d')];if(!_0x55f65c[_0xb0e8('0x37')][_0xb0e8('0x57')](_0xb0e8('0x3e'))){_0x3d4965['limit']=qs[_0xb0e8('0x20')](_0x55f65c[_0xb0e8('0x37')][_0xb0e8('0x20')]);_0x3d4965[_0xb0e8('0x1e')]=qs[_0xb0e8('0x1e')](_0x55f65c[_0xb0e8('0x37')]['offset']);}return _0x58a4db[_0xb0e8('0x62')](_0x3d4965);}})[_0xb0e8('0x27')](function(_0x5ac060){if(_0x5ac060){return _0x5ac060?{'count':_0x30002c,'rows':_0x5ac060}:null;}})[_0xb0e8('0x27')](respondWithResult(_0x28cd3b,null))['catch'](handleError(_0x28cd3b,null));};exports['addTeams']=function(_0x5047b3,_0x5017f5,_0x18d459){var _0x571001=_0x5047b3[_0xb0e8('0x4d')][_0xb0e8('0x64')];return db[_0xb0e8('0x63')]['findAll']({'where':{'id':_0x571001},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb0e8('0x65'),'attributes':['id',_0xb0e8('0x2e'),_0xb0e8('0x66'),_0xb0e8('0x67'),'interface'],'raw':!![]}]})['then'](function(_0x151786){if(_0x151786){var _0x313aec=_['flatMap'](_0x151786,function(_0x53ad7e){var _0x524b62=_0x53ad7e['get']({'plain':!![]});return _0x524b62[_0xb0e8('0x65')];});return db['OpenchannelQueue'][_0xb0e8('0x51')]({'where':{'id':_0x5047b3['params']['id']}})[_0xb0e8('0x27')](function(_0x3d11ba){return db['sequelize'][_0xb0e8('0x68')](function(_0x288702){return _0x3d11ba[_0xb0e8('0x69')](_0x571001,{'transaction':_0x288702})[_0xb0e8('0x27')](function(){return BPromise['each'](_0x313aec,function(_0x2a883b){return db[_0xb0e8('0x6a')][_0xb0e8('0x6b')]({'where':{'UserId':_0x2a883b['id'],'OpenchannelQueueId':_0x5047b3['params']['id']},'transaction':_0x288702});});})[_0xb0e8('0x27')](function(){_0x313aec[_0xb0e8('0x6c')](function(_0x148d1f){socket[_0xb0e8('0x6d')](_0xb0e8('0x6e'),{'UserId':_0x148d1f['id'],'OpenchannelQueueId':_0x3d11ba['id']});});});});});}})[_0xb0e8('0x27')](respondWithStatusCode(_0x5017f5,null))[_0xb0e8('0x48')](handleError(_0x5017f5,null));};exports['removeTeams']=function(_0x1b4450,_0x164dc3,_0x829c4b){return db['Team'][_0xb0e8('0x58')]({'where':{'id':_0x1b4450[_0xb0e8('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb0e8('0x59')],'as':_0xb0e8('0x65'),'attributes':['id'],'raw':!![]}]})[_0xb0e8('0x27')](handleEntityNotFound(_0x164dc3,null))['then'](function(_0x265ba6){var _0x2ae483=_[_0xb0e8('0x31')](_0x265ba6,'id');var _0x3890e1=[];var _0x4879e8=[];var _0x15dcdd=squel[_0xb0e8('0x6f')]();_0x15dcdd[_0xb0e8('0x70')](_0xb0e8('0x71'))[_0xb0e8('0x72')](_0xb0e8('0x73'),'tq')['join'](_0xb0e8('0x74'),'ut',_0xb0e8('0x75'))[_0xb0e8('0x41')]('OpenchannelQueueId\x20=\x20?',_0x1b4450[_0xb0e8('0x54')]['id']);for(var _0x55f770=0x0;_0x55f770<_0x265ba6[_0xb0e8('0x3d')];_0x55f770+=0x1){let _0x41ac25=_0x265ba6[_0x55f770];for(var _0x3054be=0x0;_0x3054be<_0x41ac25[_0xb0e8('0x65')][_0xb0e8('0x3d')];_0x3054be+=0x1){let _0x5ad470=_0x41ac25[_0xb0e8('0x65')][_0x3054be];var _0x7d244e=_0x15dcdd[_0xb0e8('0x76')]();_0x7d244e[_0xb0e8('0x41')](_0xb0e8('0x77'),_0x5ad470['id']);_0x4879e8['push'](db[_0xb0e8('0x78')]['query'](_0x7d244e[_0xb0e8('0x79')](),{'type':db[_0xb0e8('0x78')][_0xb0e8('0x7a')][_0xb0e8('0x7b')]})[_0xb0e8('0x27')](function(_0x33e987){if(_0x33e987[_0xb0e8('0x3d')]===0x1){return _0x5ad470['id'];}else{var _0x539de7=_[_0xb0e8('0x7c')](_[_0xb0e8('0x31')](_0x33e987,'TeamId'),function(_0x161f9a){return _[_0xb0e8('0x7d')](_0x2ae483,_0x161f9a);});if(_0x539de7){return _0x5ad470['id'];}}}));}}return BPromise[_0xb0e8('0x7e')](_0x4879e8)['then'](function(_0x501e16){_0x3890e1=_(_0x3890e1)[_0xb0e8('0x7f')](_0x501e16)[_0xb0e8('0x80')]()['value']();return db['OpenchannelQueue'][_0xb0e8('0x51')]({'where':{'id':_0x1b4450['params']['id']}})[_0xb0e8('0x27')](function(_0x51c9a4){return db[_0xb0e8('0x78')]['transaction'](function(_0x490cb8){return _0x51c9a4[_0xb0e8('0x81')](_0x1b4450[_0xb0e8('0x37')]['ids'],{'transaction':_0x490cb8})[_0xb0e8('0x27')](function(){if(!_['isEmpty'](_0x3890e1)){return _0x51c9a4[_0xb0e8('0x82')](_0x3890e1,{'transaction':_0x490cb8});}})[_0xb0e8('0x27')](function(){_0x3890e1[_0xb0e8('0x6c')](function(_0x15e5d2){socket[_0xb0e8('0x6d')](_0xb0e8('0x83'),{'UserId':_0x15e5d2,'OpenchannelQueueId':_0x51c9a4['id']});});});});});});})[_0xb0e8('0x27')](respondWithStatusCode(_0x164dc3,null))[_0xb0e8('0x48')](handleError(_0x164dc3,null));};exports['addAgents']=function(_0x63e431,_0x18a94f,_0x33c41c){return db[_0xb0e8('0x32')]['find']({'where':{'id':_0x63e431[_0xb0e8('0x54')]['id']}})[_0xb0e8('0x27')](handleEntityNotFound(_0x18a94f,null))[_0xb0e8('0x27')](function(_0x40ead6){if(_0x40ead6){return _0x40ead6[_0xb0e8('0x84')](_0x63e431[_0xb0e8('0x4d')][_0xb0e8('0x64')],_[_0xb0e8('0x85')](_0x63e431[_0xb0e8('0x4d')],[_0xb0e8('0x64'),'id'])||{})['spread'](function(_0x2c68d0){for(var _0x33ff34=0x0;_0x33ff34<_0x63e431[_0xb0e8('0x4d')][_0xb0e8('0x64')][_0xb0e8('0x3d')];_0x33ff34+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':Number(_0x63e431[_0xb0e8('0x4d')]['ids'][_0x33ff34]),'OpenchannelQueueId':Number(_0x63e431[_0xb0e8('0x54')]['id'])});}return _0x2c68d0;});}})[_0xb0e8('0x27')](respondWithResult(_0x18a94f,null))['catch'](handleError(_0x18a94f,null));};exports[_0xb0e8('0x82')]=function(_0x36cb1f,_0x1409ee,_0x26777d){return db[_0xb0e8('0x32')][_0xb0e8('0x51')]({'where':{'id':_0x36cb1f[_0xb0e8('0x54')]['id']}})[_0xb0e8('0x27')](handleEntityNotFound(_0x1409ee,null))['then'](function(_0x46dcba){if(_0x46dcba){return _0x46dcba['removeAgents'](_0x36cb1f[_0xb0e8('0x37')][_0xb0e8('0x64')])['then'](function(){if(_[_0xb0e8('0x86')](_0x36cb1f[_0xb0e8('0x37')][_0xb0e8('0x64')])){for(var _0x54705f=0x0;_0x54705f<_0x36cb1f[_0xb0e8('0x37')]['ids'][_0xb0e8('0x3d')];_0x54705f+=0x1){socket[_0xb0e8('0x6d')](_0xb0e8('0x83'),{'UserId':Number(_0x36cb1f[_0xb0e8('0x37')][_0xb0e8('0x64')][_0x54705f]),'OpenchannelQueueId':Number(_0x36cb1f[_0xb0e8('0x54')]['id'])});}}else{socket[_0xb0e8('0x6d')](_0xb0e8('0x83'),{'UserId':Number(_0x36cb1f['query'][_0xb0e8('0x64')]),'OpenchannelQueueId':Number(_0x36cb1f['params']['id'])});}});}})[_0xb0e8('0x27')](respondWithStatusCode(_0x1409ee,null))['catch'](handleError(_0x1409ee,null));};exports[_0xb0e8('0x87')]=function(_0x576ea7,_0x420fb0,_0x5d9ff1){var _0x4bf7a8={};var _0x74bc6c={};var _0x16f95b;var _0x3ffef3;return db[_0xb0e8('0x32')][_0xb0e8('0x56')]({'where':{'id':_0x576ea7['params']['id']}})[_0xb0e8('0x27')](handleEntityNotFound(_0x420fb0,null))[_0xb0e8('0x27')](function(_0x250a62){if(_0x250a62){_0x16f95b=_0x250a62;_0x74bc6c[_0xb0e8('0x36')]=_['keys'](db[_0xb0e8('0x59')]['rawAttributes']);_0x74bc6c[_0xb0e8('0x37')]=_['keys'](_0x576ea7[_0xb0e8('0x37')]);_0x74bc6c[_0xb0e8('0x39')]=_[_0xb0e8('0x3a')](_0x74bc6c[_0xb0e8('0x36')],_0x74bc6c[_0xb0e8('0x37')]);_0x4bf7a8[_0xb0e8('0x3b')]=_[_0xb0e8('0x3a')](_0x74bc6c['model'],qs[_0xb0e8('0x3c')](_0x576ea7['query'][_0xb0e8('0x3c')]));_0x4bf7a8[_0xb0e8('0x3b')]=_0x4bf7a8[_0xb0e8('0x3b')][_0xb0e8('0x3d')]?_0x4bf7a8['attributes']:_0x74bc6c['model'];_0x4bf7a8[_0xb0e8('0x3f')]=qs['sort'](_0x576ea7[_0xb0e8('0x37')][_0xb0e8('0x40')]);_0x4bf7a8[_0xb0e8('0x41')]=qs[_0xb0e8('0x39')](_['pick'](_0x576ea7['query'],_0x74bc6c[_0xb0e8('0x39')]));if(_0x576ea7[_0xb0e8('0x37')][_0xb0e8('0x43')]){_0x4bf7a8[_0xb0e8('0x41')]=_[_0xb0e8('0x45')](_0x4bf7a8['where'],{'$or':_['map'](_0x4bf7a8['attributes'],function(_0xfff04b){var _0x2c16ab={};_0x2c16ab[_0xfff04b]={'$like':'%'+_0x576ea7[_0xb0e8('0x37')]['filter']+'%'};return _0x2c16ab;})});}_0x4bf7a8=_[_0xb0e8('0x45')]({},_0x4bf7a8,_0x576ea7['options']);return _0x16f95b[_0xb0e8('0x87')](_0x4bf7a8);}})['then'](function(_0x497fab){if(_0x497fab){_0x3ffef3=_0x497fab['length'];if(!_0x576ea7[_0xb0e8('0x37')][_0xb0e8('0x57')](_0xb0e8('0x3e'))){_0x4bf7a8[_0xb0e8('0x20')]=qs[_0xb0e8('0x20')](_0x576ea7[_0xb0e8('0x37')][_0xb0e8('0x20')]);_0x4bf7a8[_0xb0e8('0x1e')]=qs[_0xb0e8('0x1e')](_0x576ea7['query'][_0xb0e8('0x1e')]);}return _0x16f95b[_0xb0e8('0x87')](_0x4bf7a8);}})[_0xb0e8('0x27')](function(_0x10aeb4){if(_0x10aeb4){return _0x10aeb4?{'count':_0x3ffef3,'rows':_0x10aeb4}:null;}})['then'](respondWithResult(_0x420fb0,null))[_0xb0e8('0x48')](handleError(_0x420fb0,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 2d1d0d9..c7d642d 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 _0xc67e=['save','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x4b0403,_0x114024){var _0x439dfd=function(_0xf8d583){while(--_0xf8d583){_0x4b0403['push'](_0x4b0403['shift']());}};_0x439dfd(++_0x114024);}(_0xc67e,0xbc));var _0xec67=function(_0x377b6f,_0x245982){_0x377b6f=_0x377b6f-0x0;var _0x2cac1b=_0xc67e[_0x377b6f];return _0x2cac1b;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xec67('0x0'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xec67('0x1'),'afterUpdate':_0xec67('0x2'),'afterDestroy':'remove'};function emitEvent(_0x1f3ca1){return function(_0x526959,_0xc02e46,_0x348ff2){OpenchannelQueueEvents[_0xec67('0x3')](_0x1f3ca1+':'+_0x526959['id'],_0x526959);OpenchannelQueueEvents['emit'](_0x1f3ca1,_0x526959);_0x348ff2(null);};}for(var e in events){if(events[_0xec67('0x4')](e)){var event=events[e];OpenchannelQueue[_0xec67('0x5')](e,emitEvent(event));}}module[_0xec67('0x6')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x1543=['events','../../mysqldb','setMaxListeners','update','emit','hook','exports'];(function(_0x51e844,_0x58d32a){var _0x5dd852=function(_0x5aa3e0){while(--_0x5aa3e0){_0x51e844['push'](_0x51e844['shift']());}};_0x5dd852(++_0x58d32a);}(_0x1543,0x1ce));var _0x3154=function(_0x25ebb5,_0x18f1c0){_0x25ebb5=_0x25ebb5-0x0;var _0x42cbc7=_0x1543[_0x25ebb5];return _0x42cbc7;};'use strict';var EventEmitter=require(_0x3154('0x0'));var OpenchannelQueue=require(_0x3154('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x3154('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3154('0x3'),'afterDestroy':'remove'};function emitEvent(_0x449609){return function(_0x839e49,_0x5617c3,_0x45f23d){OpenchannelQueueEvents[_0x3154('0x4')](_0x449609+':'+_0x839e49['id'],_0x839e49);OpenchannelQueueEvents[_0x3154('0x4')](_0x449609,_0x839e49);_0x45f23d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x3154('0x5')](e,emitEvent(event));}}module[_0x3154('0x6')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 1c16e5b..94018ce 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 _0xcce8=['moment','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcce8,0x148));var _0x8cce=function(_0x276b71,_0x1425f7){_0x276b71=_0x276b71-0x0;var _0x3d214e=_0xcce8[_0x276b71];return _0x3d214e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8cce('0x0'))(_0x8cce('0x1'));var moment=require(_0x8cce('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8cce('0x3'));var config=require(_0x8cce('0x4'));var attributes=require(_0x8cce('0x5'));module[_0x8cce('0x6')]=function(_0x370946,_0x545c1d){return _0x370946[_0x8cce('0x7')](_0x8cce('0x8'),attributes,{'tableName':_0x8cce('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0bf8=['bluebird','path','rimraf','../../config/environment','exports','define','openchannel_queues','util','../../config/logger','moment'];(function(_0x440d11,_0x4ab1b3){var _0x5a4859=function(_0x3e7f8c){while(--_0x3e7f8c){_0x440d11['push'](_0x440d11['shift']());}};_0x5a4859(++_0x4ab1b3);}(_0x0bf8,0x1ab));var _0x80bf=function(_0x593c1b,_0x35c524){_0x593c1b=_0x593c1b-0x0;var _0x4e0c07=_0x0bf8[_0x593c1b];return _0x4e0c07;};'use strict';var _=require('lodash');var util=require(_0x80bf('0x0'));var logger=require(_0x80bf('0x1'))('api');var moment=require(_0x80bf('0x2'));var BPromise=require(_0x80bf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x80bf('0x4'));var rimraf=require(_0x80bf('0x5'));var config=require(_0x80bf('0x6'));var attributes=require('./openchannelQueue.attributes');module[_0x80bf('0x7')]=function(_0x5723e0,_0x149401){return _0x5723e0[_0x80bf('0x8')]('OpenchannelQueue',attributes,{'tableName':_0x80bf('0x9'),'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 b673bfb..523ad53 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 _0xf070=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetOpenchannelQueue','findAll','raw','options','where','attributes','limit','include','map','model','ShowOpenchannelQueue','OpenchannelQueue','lodash','util','moment'];(function(_0x15d66d,_0x99094c){var _0x3e9020=function(_0x42986b){while(--_0x42986b){_0x15d66d['push'](_0x15d66d['shift']());}};_0x3e9020(++_0x99094c);}(_0xf070,0x1d1));var _0x0f07=function(_0x126a58,_0x1c03f9){_0x126a58=_0x126a58-0x0;var _0x2d9d67=_0xf070[_0x126a58];return _0x2d9d67;};'use strict';var _=require(_0x0f07('0x0'));var util=require(_0x0f07('0x1'));var moment=require(_0x0f07('0x2'));var BPromise=require('bluebird');var rs=require(_0x0f07('0x3'));var fs=require('fs');var Redis=require(_0x0f07('0x4'));var db=require(_0x0f07('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0f07('0x6'))(_0x0f07('0x7'));var config=require(_0x0f07('0x8'));var jayson=require(_0x0f07('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x0f07('0xa')]=_[_0x0f07('0xb')](config['redis'],{'host':_0x0f07('0xc'),'port':0x18eb});var socket=require(_0x0f07('0xd'))(new Redis(config[_0x0f07('0xa')]));require(_0x0f07('0xe'))[_0x0f07('0xf')](socket);function respondWithRpcPromise(_0x5afdcb,_0x3c3f87,_0x477f2a){return new BPromise(function(_0x7305b7,_0x55eb17){return client['request'](_0x5afdcb,_0x477f2a)[_0x0f07('0x10')](function(_0x337934){logger[_0x0f07('0x11')](_0x0f07('0x12'),_0x3c3f87,_0x0f07('0x13'));logger[_0x0f07('0x14')](_0x0f07('0x15'),_0x3c3f87,_0x0f07('0x13'),JSON[_0x0f07('0x16')](_0x337934));if(_0x337934[_0x0f07('0x17')]){if(_0x337934[_0x0f07('0x17')]['code']===0x1f4){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x3c3f87,_0x337934[_0x0f07('0x17')][_0x0f07('0x18')]);return _0x55eb17(_0x337934['error'][_0x0f07('0x18')]);}logger[_0x0f07('0x17')](_0x0f07('0x12'),_0x3c3f87,_0x337934['error'][_0x0f07('0x18')]);return _0x7305b7(_0x337934['error'][_0x0f07('0x18')]);}else{logger[_0x0f07('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x3c3f87,_0x0f07('0x13'));_0x7305b7(_0x337934[_0x0f07('0x19')][_0x0f07('0x18')]);}})[_0x0f07('0x1a')](function(_0x12197d){logger[_0x0f07('0x17')](_0x0f07('0x12'),_0x3c3f87,_0x12197d);_0x55eb17(_0x12197d);});});}exports[_0x0f07('0x1b')]=function(_0x50a5cf){var _0x552bf2=this;return new Promise(function(_0x54169b,_0x393c39){return db['OpenchannelQueue'][_0x0f07('0x1c')]({'raw':_0x50a5cf['options']?_0x50a5cf['options'][_0x0f07('0x1d')]===undefined?!![]:![]:!![],'where':_0x50a5cf[_0x0f07('0x1e')]?_0x50a5cf['options'][_0x0f07('0x1f')]||null:null,'attributes':_0x50a5cf['options']?_0x50a5cf[_0x0f07('0x1e')][_0x0f07('0x20')]||null:null,'limit':_0x50a5cf[_0x0f07('0x1e')]?_0x50a5cf[_0x0f07('0x1e')][_0x0f07('0x21')]||null:null,'include':_0x50a5cf[_0x0f07('0x1e')]?_0x50a5cf[_0x0f07('0x1e')][_0x0f07('0x22')]?_[_0x0f07('0x23')](_0x50a5cf[_0x0f07('0x1e')][_0x0f07('0x22')],function(_0x422355){return{'model':db[_0x422355['model']],'as':_0x422355['as'],'attributes':_0x422355[_0x0f07('0x20')],'include':_0x422355[_0x0f07('0x22')]?_[_0x0f07('0x23')](_0x422355[_0x0f07('0x22')],function(_0x552e8c){return{'model':db[_0x552e8c[_0x0f07('0x24')]],'as':_0x552e8c['as'],'attributes':_0x552e8c[_0x0f07('0x20')],'include':_0x552e8c[_0x0f07('0x22')]?_[_0x0f07('0x23')](_0x552e8c[_0x0f07('0x22')],function(_0x46898c){return{'model':db[_0x46898c[_0x0f07('0x24')]],'as':_0x46898c['as'],'attributes':_0x46898c[_0x0f07('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0f07('0x10')](function(_0x500005){logger['info'](_0x0f07('0x1b'),_0x50a5cf);logger[_0x0f07('0x14')](_0x0f07('0x1b'),_0x50a5cf,JSON['stringify'](_0x500005));_0x54169b(_0x500005);})[_0x0f07('0x1a')](function(_0x3bc6de){logger[_0x0f07('0x17')](_0x0f07('0x1b'),_0x3bc6de['message'],_0x50a5cf);_0x393c39(_0x552bf2[_0x0f07('0x17')](0x1f4,_0x3bc6de[_0x0f07('0x18')]));});});};exports[_0x0f07('0x25')]=function(_0x52715b){var _0x1af11a=this;return new Promise(function(_0x1f416f,_0x5949b1){return db[_0x0f07('0x26')]['find']({'raw':_0x52715b[_0x0f07('0x1e')]?_0x52715b['options'][_0x0f07('0x1d')]===undefined?!![]:![]:!![],'where':_0x52715b[_0x0f07('0x1e')]?_0x52715b[_0x0f07('0x1e')][_0x0f07('0x1f')]||null:null,'attributes':_0x52715b['options']?_0x52715b[_0x0f07('0x1e')][_0x0f07('0x20')]||null:null,'include':_0x52715b[_0x0f07('0x1e')]?_0x52715b[_0x0f07('0x1e')][_0x0f07('0x22')]?_[_0x0f07('0x23')](_0x52715b[_0x0f07('0x1e')][_0x0f07('0x22')],function(_0x1533f9){return{'model':db[_0x1533f9[_0x0f07('0x24')]],'as':_0x1533f9['as'],'attributes':_0x1533f9[_0x0f07('0x20')],'include':_0x1533f9['include']?_[_0x0f07('0x23')](_0x1533f9[_0x0f07('0x22')],function(_0x32400e){return{'model':db[_0x32400e[_0x0f07('0x24')]],'as':_0x32400e['as'],'attributes':_0x32400e['attributes'],'include':_0x32400e[_0x0f07('0x22')]?_[_0x0f07('0x23')](_0x32400e[_0x0f07('0x22')],function(_0xd7892b){return{'model':db[_0xd7892b[_0x0f07('0x24')]],'as':_0xd7892b['as'],'attributes':_0xd7892b[_0x0f07('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0f07('0x10')](function(_0x50c6d3){logger[_0x0f07('0x11')](_0x0f07('0x25'),_0x52715b);logger[_0x0f07('0x14')](_0x0f07('0x25'),_0x52715b,JSON[_0x0f07('0x16')](_0x50c6d3));_0x1f416f(_0x50c6d3);})[_0x0f07('0x1a')](function(_0x195e1c){logger['error']('ShowOpenchannelQueue',_0x195e1c['message'],_0x52715b);_0x5949b1(_0x1af11a[_0x0f07('0x17')](0x1f4,_0x195e1c['message']));});});}; \ No newline at end of file +var _0xec4c=['info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','attributes','limit','include','map','model','stringify','find','ShowOpenchannelQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','register','request','then'];(function(_0x371db8,_0x16eacf){var _0x20cc85=function(_0x23b09){while(--_0x23b09){_0x371db8['push'](_0x371db8['shift']());}};_0x20cc85(++_0x16eacf);}(_0xec4c,0x8f));var _0xcec4=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xec4c[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0xcec4('0x0'));var util=require('util');var moment=require(_0xcec4('0x1'));var BPromise=require(_0xcec4('0x2'));var rs=require(_0xcec4('0x3'));var fs=require('fs');var Redis=require(_0xcec4('0x4'));var db=require(_0xcec4('0x5'))['db'];var utils=require(_0xcec4('0x6'));var logger=require('../../config/logger')(_0xcec4('0x7'));var config=require(_0xcec4('0x8'));var jayson=require(_0xcec4('0x9'));var client=jayson['client'][_0xcec4('0xa')]({'port':0x232a});config[_0xcec4('0xb')]=_[_0xcec4('0xc')](config[_0xcec4('0xb')],{'host':_0xcec4('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcec4('0xb')]));require('./openchannelQueue.socket')[_0xcec4('0xe')](socket);function respondWithRpcPromise(_0x1e8baa,_0x1d0485,_0x61b7ec){return new BPromise(function(_0x22bc28,_0x41f928){return client[_0xcec4('0xf')](_0x1e8baa,_0x61b7ec)[_0xcec4('0x10')](function(_0x37e34c){logger[_0xcec4('0x11')](_0xcec4('0x12'),_0x1d0485,_0xcec4('0x13'));logger[_0xcec4('0x14')](_0xcec4('0x15'),_0x1d0485,_0xcec4('0x13'),JSON['stringify'](_0x37e34c));if(_0x37e34c['error']){if(_0x37e34c[_0xcec4('0x16')][_0xcec4('0x17')]===0x1f4){logger[_0xcec4('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x1d0485,_0x37e34c[_0xcec4('0x16')]['message']);return _0x41f928(_0x37e34c['error'][_0xcec4('0x18')]);}logger[_0xcec4('0x16')](_0xcec4('0x12'),_0x1d0485,_0x37e34c[_0xcec4('0x16')][_0xcec4('0x18')]);return _0x22bc28(_0x37e34c[_0xcec4('0x16')][_0xcec4('0x18')]);}else{logger[_0xcec4('0x11')](_0xcec4('0x12'),_0x1d0485,_0xcec4('0x13'));_0x22bc28(_0x37e34c[_0xcec4('0x19')]['message']);}})[_0xcec4('0x1a')](function(_0x25295c){logger[_0xcec4('0x16')](_0xcec4('0x12'),_0x1d0485,_0x25295c);_0x41f928(_0x25295c);});});}exports[_0xcec4('0x1b')]=function(_0x402571){var _0x59195c=this;return new Promise(function(_0x570699,_0x347a80){return db[_0xcec4('0x1c')]['findAll']({'raw':_0x402571['options']?_0x402571[_0xcec4('0x1d')][_0xcec4('0x1e')]===undefined?!![]:![]:!![],'where':_0x402571[_0xcec4('0x1d')]?_0x402571[_0xcec4('0x1d')][_0xcec4('0x1f')]||null:null,'attributes':_0x402571[_0xcec4('0x1d')]?_0x402571[_0xcec4('0x1d')][_0xcec4('0x20')]||null:null,'limit':_0x402571[_0xcec4('0x1d')]?_0x402571[_0xcec4('0x1d')][_0xcec4('0x21')]||null:null,'include':_0x402571[_0xcec4('0x1d')]?_0x402571['options'][_0xcec4('0x22')]?_[_0xcec4('0x23')](_0x402571['options'][_0xcec4('0x22')],function(_0x4e5fde){return{'model':db[_0x4e5fde[_0xcec4('0x24')]],'as':_0x4e5fde['as'],'attributes':_0x4e5fde['attributes'],'include':_0x4e5fde[_0xcec4('0x22')]?_['map'](_0x4e5fde['include'],function(_0x3803ce){return{'model':db[_0x3803ce[_0xcec4('0x24')]],'as':_0x3803ce['as'],'attributes':_0x3803ce[_0xcec4('0x20')],'include':_0x3803ce[_0xcec4('0x22')]?_[_0xcec4('0x23')](_0x3803ce['include'],function(_0x1d1cca){return{'model':db[_0x1d1cca[_0xcec4('0x24')]],'as':_0x1d1cca['as'],'attributes':_0x1d1cca[_0xcec4('0x20')]};}):[]};}):[]};}):[]:[]})[_0xcec4('0x10')](function(_0xe08e69){logger[_0xcec4('0x11')](_0xcec4('0x1b'),_0x402571);logger[_0xcec4('0x14')](_0xcec4('0x1b'),_0x402571,JSON[_0xcec4('0x25')](_0xe08e69));_0x570699(_0xe08e69);})['catch'](function(_0x1ef769){logger['error'](_0xcec4('0x1b'),_0x1ef769[_0xcec4('0x18')],_0x402571);_0x347a80(_0x59195c['error'](0x1f4,_0x1ef769['message']));});});};exports['ShowOpenchannelQueue']=function(_0x1e21f){var _0x38a305=this;return new Promise(function(_0x244760,_0x5d14ce){return db[_0xcec4('0x1c')][_0xcec4('0x26')]({'raw':_0x1e21f[_0xcec4('0x1d')]?_0x1e21f[_0xcec4('0x1d')][_0xcec4('0x1e')]===undefined?!![]:![]:!![],'where':_0x1e21f[_0xcec4('0x1d')]?_0x1e21f['options']['where']||null:null,'attributes':_0x1e21f[_0xcec4('0x1d')]?_0x1e21f[_0xcec4('0x1d')][_0xcec4('0x20')]||null:null,'include':_0x1e21f[_0xcec4('0x1d')]?_0x1e21f[_0xcec4('0x1d')][_0xcec4('0x22')]?_[_0xcec4('0x23')](_0x1e21f[_0xcec4('0x1d')]['include'],function(_0x515b7a){return{'model':db[_0x515b7a['model']],'as':_0x515b7a['as'],'attributes':_0x515b7a[_0xcec4('0x20')],'include':_0x515b7a[_0xcec4('0x22')]?_[_0xcec4('0x23')](_0x515b7a['include'],function(_0x803098){return{'model':db[_0x803098[_0xcec4('0x24')]],'as':_0x803098['as'],'attributes':_0x803098['attributes'],'include':_0x803098[_0xcec4('0x22')]?_[_0xcec4('0x23')](_0x803098[_0xcec4('0x22')],function(_0x430061){return{'model':db[_0x430061[_0xcec4('0x24')]],'as':_0x430061['as'],'attributes':_0x430061['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x21fe71){logger[_0xcec4('0x11')]('ShowOpenchannelQueue',_0x1e21f);logger['debug'](_0xcec4('0x27'),_0x1e21f,JSON['stringify'](_0x21fe71));_0x244760(_0x21fe71);})['catch'](function(_0x212eba){logger[_0xcec4('0x16')](_0xcec4('0x27'),_0x212eba[_0xcec4('0x18')],_0x1e21f);_0x5d14ce(_0x38a305[_0xcec4('0x16')](0x1f4,_0x212eba[_0xcec4('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index da4a005..a14e8cd 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 _0xcf8f=['openchannelQueue:','./openchannelQueue.events','remove','emit','removeListener'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0xcf8f,0x1cd));var _0xfcf8=function(_0x3d38df,_0x17e701){_0x3d38df=_0x3d38df-0x0;var _0x5d089d=_0xcf8f[_0x3d38df];return _0x5d089d;};'use strict';var OpenchannelQueueEvents=require(_0xfcf8('0x0'));var events=['save',_0xfcf8('0x1'),'update'];function createListener(_0x4a51ce,_0x2410c7){return function(_0x3ba057){_0x2410c7[_0xfcf8('0x2')](_0x4a51ce,_0x3ba057);};}function removeListener(_0x20e873,_0x14c9e1){return function(){OpenchannelQueueEvents[_0xfcf8('0x3')](_0x20e873,_0x14c9e1);};}exports['register']=function(_0x113b9f){for(var _0x14d42d=0x0,_0x437998=events['length'];_0x14d42d<_0x437998;_0x14d42d++){var _0x629167=events[_0x14d42d];var _0x5500f6=createListener(_0xfcf8('0x4')+_0x629167,_0x113b9f);OpenchannelQueueEvents['on'](_0x629167,_0x5500f6);}}; \ No newline at end of file +var _0x5837=['update','emit','removeListener','length','openchannelQueue:','save','remove'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x5837,0x16a));var _0x7583=function(_0x39c084,_0xbc0456){_0x39c084=_0x39c084-0x0;var _0x5e6575=_0x5837[_0x39c084];return _0x5e6575;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x7583('0x0'),_0x7583('0x1'),_0x7583('0x2')];function createListener(_0x58ae22,_0x410acf){return function(_0x3c5f06){_0x410acf[_0x7583('0x3')](_0x58ae22,_0x3c5f06);};}function removeListener(_0x284102,_0x5ac3cf){return function(){OpenchannelQueueEvents[_0x7583('0x4')](_0x284102,_0x5ac3cf);};}exports['register']=function(_0x1f8ee3){for(var _0x3d5e4c=0x0,_0x1b0d0b=events[_0x7583('0x5')];_0x3d5e4c<_0x1b0d0b;_0x3d5e4c++){var _0x335f25=events[_0x3d5e4c];var _0x1a6eeb=createListener(_0x7583('0x6')+_0x335f25,_0x1f8ee3);OpenchannelQueueEvents['on'](_0x335f25,_0x1a6eeb);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 622bd6a..8460b78 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 _0x8c9d=['delete','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','show','post','create','/:id'];(function(_0x10f659,_0x3d1409){var _0x1e3fb5=function(_0x404e24){while(--_0x404e24){_0x10f659['push'](_0x10f659['shift']());}};_0x1e3fb5(++_0x3d1409);}(_0x8c9d,0x1a1));var _0xd8c9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8c9d[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd8c9('0x0'));var timeout=require(_0xd8c9('0x1'));var express=require(_0xd8c9('0x2'));var router=express['Router']();var fs_extra=require(_0xd8c9('0x3'));var auth=require(_0xd8c9('0x4'));var interaction=require(_0xd8c9('0x5'));var config=require(_0xd8c9('0x6'));var controller=require(_0xd8c9('0x7'));router['get']('/',auth[_0xd8c9('0x8')](),controller[_0xd8c9('0x9')]);router[_0xd8c9('0xa')]('/describe',auth[_0xd8c9('0x8')](),controller['describe']);router[_0xd8c9('0xa')]('/:id',auth[_0xd8c9('0x8')](),controller[_0xd8c9('0xb')]);router[_0xd8c9('0xc')]('/',auth[_0xd8c9('0x8')](),controller[_0xd8c9('0xd')]);router['put'](_0xd8c9('0xe'),auth[_0xd8c9('0x8')](),controller['update']);router[_0xd8c9('0xf')](_0xd8c9('0xe'),auth[_0xd8c9('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1bbd=['delete','destroy','multer','util','path','connect-timeout','express','Router','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','show','post','create','/:id','update'];(function(_0x5f4c9b,_0x61bc){var _0x5eabde=function(_0x29ef79){while(--_0x29ef79){_0x5f4c9b['push'](_0x5f4c9b['shift']());}};_0x5eabde(++_0x61bc);}(_0x1bbd,0xec));var _0xd1bb=function(_0x156b1b,_0x107157){_0x156b1b=_0x156b1b-0x0;var _0x5018e8=_0x1bbd[_0x156b1b];return _0x5018e8;};'use strict';var multer=require(_0xd1bb('0x0'));var util=require(_0xd1bb('0x1'));var path=require(_0xd1bb('0x2'));var timeout=require(_0xd1bb('0x3'));var express=require(_0xd1bb('0x4'));var router=express[_0xd1bb('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd1bb('0x6'));router[_0xd1bb('0x7')]('/',auth[_0xd1bb('0x8')](),controller[_0xd1bb('0x9')]);router[_0xd1bb('0x7')](_0xd1bb('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xd1bb('0x7')]('/:id',auth[_0xd1bb('0x8')](),controller[_0xd1bb('0xb')]);router[_0xd1bb('0xc')]('/',auth['isAuthenticated'](),controller[_0xd1bb('0xd')]);router['put'](_0xd1bb('0xe'),auth['isAuthenticated'](),controller[_0xd1bb('0xf')]);router[_0xd1bb('0x10')](_0xd1bb('0xe'),auth['isAuthenticated'](),controller[_0xd1bb('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 1db802d..c654516 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 _0x1e2a=['moment','sequelize','exports','STRING','DATE'];(function(_0x28723d,_0x4e6100){var _0x1c41a2=function(_0x45b628){while(--_0x45b628){_0x28723d['push'](_0x28723d['shift']());}};_0x1c41a2(++_0x4e6100);}(_0x1e2a,0x1c7));var _0xa1e2=function(_0x1ca85e,_0x4641b6){_0x1ca85e=_0x1ca85e-0x0;var _0xf14771=_0x1e2a[_0x1ca85e];return _0xf14771;};'use strict';var moment=require(_0xa1e2('0x0'));var Sequelize=require(_0xa1e2('0x1'));module[_0xa1e2('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xa1e2('0x3')]},'joinAt':{'type':Sequelize[_0xa1e2('0x4')]},'leaveAt':{'type':Sequelize[_0xa1e2('0x4')]},'acceptAt':{'type':Sequelize[_0xa1e2('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa1e2('0x3')]}}; \ No newline at end of file +var _0xcff4=['DATE','moment','sequelize','exports','STRING'];(function(_0x159765,_0x288667){var _0x36aadb=function(_0x420e6f){while(--_0x420e6f){_0x159765['push'](_0x159765['shift']());}};_0x36aadb(++_0x288667);}(_0xcff4,0x11e));var _0x4cff=function(_0x4fd2d2,_0x329b0f){_0x4fd2d2=_0x4fd2d2-0x0;var _0x1b9f0d=_0xcff4[_0x4fd2d2];return _0x1b9f0d;};'use strict';var moment=require(_0x4cff('0x0'));var Sequelize=require(_0x4cff('0x1'));module[_0x4cff('0x2')]={'uniqueid':{'type':Sequelize[_0x4cff('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x4cff('0x3')]},'joinAt':{'type':Sequelize[_0x4cff('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x4cff('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x4cff('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 3e1cab7..18c1bf4 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 _0xee6b=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query'];(function(_0x26c1be,_0x42ddf4){var _0x2f1b34=function(_0xd505c7){while(--_0xd505c7){_0x26c1be['push'](_0x26c1be['shift']());}};_0x2f1b34(++_0x42ddf4);}(_0xee6b,0x15d));var _0xbee6=function(_0x3f9ac2,_0x1b670b){_0x3f9ac2=_0x3f9ac2-0x0;var _0xe6a436=_0xee6b[_0x3f9ac2];return _0xe6a436;};'use strict';var emlformat=require(_0xbee6('0x0'));var rimraf=require(_0xbee6('0x1'));var zipdir=require(_0xbee6('0x2'));var jsonpatch=require(_0xbee6('0x3'));var rp=require(_0xbee6('0x4'));var moment=require(_0xbee6('0x5'));var BPromise=require(_0xbee6('0x6'));var Mustache=require('mustache');var util=require(_0xbee6('0x7'));var path=require(_0xbee6('0x8'));var sox=require(_0xbee6('0x9'));var csv=require(_0xbee6('0xa'));var ejs=require(_0xbee6('0xb'));var fs=require('fs');var fs_extra=require(_0xbee6('0xc'));var _=require(_0xbee6('0xd'));var squel=require(_0xbee6('0xe'));var crypto=require(_0xbee6('0xf'));var jsforce=require(_0xbee6('0x10'));var deskjs=require(_0xbee6('0x11'));var toCsv=require('to-csv');var querystring=require(_0xbee6('0x12'));var Papa=require(_0xbee6('0x13'));var Redis=require(_0xbee6('0x14'));var authService=require(_0xbee6('0x15'));var qs=require(_0xbee6('0x16'));var as=require(_0xbee6('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbee6('0x18'))(_0xbee6('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbee6('0x1a'));var db=require(_0xbee6('0x1b'))['db'];function respondWithStatusCode(_0x4539b3,_0x25d28f){_0x25d28f=_0x25d28f||0xcc;return function(_0x4d8af1){if(_0x4d8af1){return _0x4539b3[_0xbee6('0x1c')](_0x25d28f);}return _0x4539b3[_0xbee6('0x1d')](_0x25d28f)[_0xbee6('0x1e')]();};}function respondWithResult(_0x4f998e,_0x3a5f98){_0x3a5f98=_0x3a5f98||0xc8;return function(_0x596536){if(_0x596536){return _0x4f998e[_0xbee6('0x1d')](_0x3a5f98)['json'](_0x596536);}};}function respondWithFilteredResult(_0x83f7a1,_0x5d2e68){return function(_0x3497da){if(_0x3497da){var _0x502b17=typeof _0x5d2e68['offset']===_0xbee6('0x1f')&&typeof _0x5d2e68['limit']===_0xbee6('0x1f');var _0x110c76=_0x3497da[_0xbee6('0x20')];var _0x4599a9=_0x502b17?0x0:_0x5d2e68[_0xbee6('0x21')];var _0xca487=_0x502b17?_0x3497da[_0xbee6('0x20')]:_0x5d2e68['offset']+_0x5d2e68[_0xbee6('0x22')];var _0x5c8281;if(_0xca487>=_0x110c76){_0xca487=_0x110c76;_0x5c8281=0xc8;}else{_0x5c8281=0xce;}_0x83f7a1[_0xbee6('0x1d')](_0x5c8281);return _0x83f7a1[_0xbee6('0x23')](_0xbee6('0x24'),_0x4599a9+'-'+_0xca487+'/'+_0x110c76)[_0xbee6('0x25')](_0x3497da);}return null;};}function patchUpdates(_0x488639){return function(_0x1704e9){try{jsonpatch[_0xbee6('0x26')](_0x1704e9,_0x488639,!![]);}catch(_0x51e38f){return BPromise[_0xbee6('0x27')](_0x51e38f);}return _0x1704e9[_0xbee6('0x28')]();};}function saveUpdates(_0x66f4d4,_0x4f05a4){return function(_0x546a5a){if(_0x546a5a){return _0x546a5a['update'](_0x66f4d4)[_0xbee6('0x29')](function(_0x3516cb){return _0x3516cb;});}return null;};}function removeEntity(_0xc19c6,_0x481b33){return function(_0x1bf6f2){if(_0x1bf6f2){return _0x1bf6f2[_0xbee6('0x2a')]()[_0xbee6('0x29')](function(){_0xc19c6[_0xbee6('0x1d')](0xcc)[_0xbee6('0x1e')]();});}};}function handleEntityNotFound(_0x267f23,_0x3b90c6){return function(_0x5e4779){if(!_0x5e4779){_0x267f23[_0xbee6('0x1c')](0x194);}return _0x5e4779;};}function handleError(_0x31e1ef,_0x48d1f3){_0x48d1f3=_0x48d1f3||0x1f4;return function(_0x217cec){logger[_0xbee6('0x2b')](_0x217cec[_0xbee6('0x2c')]);if(_0x217cec['name']){delete _0x217cec[_0xbee6('0x2d')];}_0x31e1ef[_0xbee6('0x1d')](_0x48d1f3)[_0xbee6('0x2e')](_0x217cec);};}exports[_0xbee6('0x2f')]=function(_0x538a76,_0x5d9c0f){var _0x1386c3={},_0x42cb7f={},_0x1ea18f={'count':0x0,'rows':[]};var _0x1431b0=_[_0xbee6('0x30')](db[_0xbee6('0x31')][_0xbee6('0x32')],function(_0x5b9773){return{'name':_0x5b9773[_0xbee6('0x33')],'type':_0x5b9773[_0xbee6('0x34')][_0xbee6('0x35')]};});_0x42cb7f[_0xbee6('0x36')]=_[_0xbee6('0x30')](_0x1431b0,_0xbee6('0x2d'));_0x42cb7f[_0xbee6('0x37')]=_[_0xbee6('0x38')](_0x538a76[_0xbee6('0x37')]);_0x42cb7f[_0xbee6('0x39')]=_[_0xbee6('0x3a')](_0x42cb7f['model'],_0x42cb7f['query']);_0x1386c3[_0xbee6('0x3b')]=_[_0xbee6('0x3a')](_0x42cb7f[_0xbee6('0x36')],qs['fields'](_0x538a76[_0xbee6('0x37')][_0xbee6('0x3c')]));_0x1386c3[_0xbee6('0x3b')]=_0x1386c3[_0xbee6('0x3b')][_0xbee6('0x3d')]?_0x1386c3[_0xbee6('0x3b')]:_0x42cb7f[_0xbee6('0x36')];if(!_0x538a76['query'][_0xbee6('0x3e')](_0xbee6('0x3f'))){_0x1386c3['limit']=qs[_0xbee6('0x22')](_0x538a76[_0xbee6('0x37')][_0xbee6('0x22')]);_0x1386c3[_0xbee6('0x21')]=qs[_0xbee6('0x21')](_0x538a76[_0xbee6('0x37')][_0xbee6('0x21')]);}_0x1386c3['order']=qs['sort'](_0x538a76['query'][_0xbee6('0x40')]);_0x1386c3[_0xbee6('0x41')]=qs['filters'](_['pick'](_0x538a76[_0xbee6('0x37')],_0x42cb7f['filters']),_0x1431b0);if(_0x538a76[_0xbee6('0x37')][_0xbee6('0x42')]){_0x1386c3['where']=_[_0xbee6('0x43')](_0x1386c3[_0xbee6('0x41')],{'$or':_['map'](_0x1431b0,function(_0xc8228){if(_0xc8228[_0xbee6('0x34')]!==_0xbee6('0x44')){var _0x56993c={};_0x56993c[_0xc8228[_0xbee6('0x2d')]]={'$like':'%'+_0x538a76[_0xbee6('0x37')][_0xbee6('0x42')]+'%'};return _0x56993c;}})});}_0x1386c3=_[_0xbee6('0x43')]({},_0x1386c3,_0x538a76[_0xbee6('0x45')]);var _0x4e901e={'where':_0x1386c3[_0xbee6('0x41')]};return db[_0xbee6('0x31')][_0xbee6('0x20')](_0x4e901e)[_0xbee6('0x29')](function(_0x1ed0e0){_0x1ea18f[_0xbee6('0x20')]=_0x1ed0e0;if(_0x538a76[_0xbee6('0x37')][_0xbee6('0x46')]){_0x1386c3['include']=[{'all':!![]}];}return db[_0xbee6('0x31')]['findAll'](_0x1386c3);})['then'](function(_0x453844){_0x1ea18f[_0xbee6('0x47')]=_0x453844;return _0x1ea18f;})[_0xbee6('0x29')](respondWithFilteredResult(_0x5d9c0f,_0x1386c3))[_0xbee6('0x48')](handleError(_0x5d9c0f,null));};exports[_0xbee6('0x49')]=function(_0x2f18c4,_0x497c7e){var _0x324b93={'raw':!![],'where':{'id':_0x2f18c4[_0xbee6('0x4a')]['id']}},_0x42404d={};_0x42404d[_0xbee6('0x36')]=_['keys'](db[_0xbee6('0x31')][_0xbee6('0x32')]);_0x42404d[_0xbee6('0x37')]=_[_0xbee6('0x38')](_0x2f18c4['query']);_0x42404d['filters']=_[_0xbee6('0x3a')](_0x42404d[_0xbee6('0x36')],_0x42404d[_0xbee6('0x37')]);_0x324b93[_0xbee6('0x3b')]=_[_0xbee6('0x3a')](_0x42404d[_0xbee6('0x36')],qs[_0xbee6('0x3c')](_0x2f18c4[_0xbee6('0x37')][_0xbee6('0x3c')]));_0x324b93[_0xbee6('0x3b')]=_0x324b93[_0xbee6('0x3b')][_0xbee6('0x3d')]?_0x324b93['attributes']:_0x42404d['model'];if(_0x2f18c4['query'][_0xbee6('0x46')]){_0x324b93[_0xbee6('0x4b')]=[{'all':!![]}];}_0x324b93=_[_0xbee6('0x43')]({},_0x324b93,_0x2f18c4[_0xbee6('0x45')]);return db[_0xbee6('0x31')][_0xbee6('0x4c')](_0x324b93)[_0xbee6('0x29')](handleEntityNotFound(_0x497c7e,null))[_0xbee6('0x29')](respondWithResult(_0x497c7e,null))[_0xbee6('0x48')](handleError(_0x497c7e,null));};exports[_0xbee6('0x4d')]=function(_0x401017,_0x16a1a3){return db[_0xbee6('0x31')][_0xbee6('0x4d')](_0x401017[_0xbee6('0x4e')],{})[_0xbee6('0x29')](respondWithResult(_0x16a1a3,0xc9))['catch'](handleError(_0x16a1a3,null));};exports[_0xbee6('0x4f')]=function(_0x33a16d,_0x1627e6){if(_0x33a16d[_0xbee6('0x4e')]['id']){delete _0x33a16d[_0xbee6('0x4e')]['id'];}return db[_0xbee6('0x31')][_0xbee6('0x4c')]({'where':{'id':_0x33a16d[_0xbee6('0x4a')]['id']}})[_0xbee6('0x29')](handleEntityNotFound(_0x1627e6,null))['then'](saveUpdates(_0x33a16d[_0xbee6('0x4e')],null))[_0xbee6('0x29')](respondWithResult(_0x1627e6,null))[_0xbee6('0x48')](handleError(_0x1627e6,null));};exports[_0xbee6('0x2a')]=function(_0x530632,_0x1ba89f){return db['OpenchannelQueueReport'][_0xbee6('0x4c')]({'where':{'id':_0x530632['params']['id']}})[_0xbee6('0x29')](handleEntityNotFound(_0x1ba89f,null))[_0xbee6('0x29')](removeEntity(_0x1ba89f,null))['catch'](handleError(_0x1ba89f,null));};exports[_0xbee6('0x50')]=function(_0x328345,_0x4b0708){return db[_0xbee6('0x31')][_0xbee6('0x50')]()[_0xbee6('0x29')](respondWithResult(_0x4b0708,null))['catch'](handleError(_0x4b0708,null));}; \ No newline at end of file +var _0x4e1b=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','limit','count','set','json','apply','reject','then','destroy','stack','name','map','OpenchannelQueueReport','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','find','catch','create','body','update','describe','eml-format','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','../../components/parsers/qs','../../components/parsers/advancedSearch','api'];(function(_0x439205,_0x4531e4){var _0xb18d9b=function(_0x499873){while(--_0x499873){_0x439205['push'](_0x439205['shift']());}};_0xb18d9b(++_0x4531e4);}(_0x4e1b,0x109));var _0xb4e1=function(_0x31fcda,_0x3433fe){_0x31fcda=_0x31fcda-0x0;var _0x45e7ea=_0x4e1b[_0x31fcda];return _0x45e7ea;};'use strict';var emlformat=require(_0xb4e1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb4e1('0x1'));var jsonpatch=require(_0xb4e1('0x2'));var rp=require(_0xb4e1('0x3'));var moment=require(_0xb4e1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb4e1('0x5'));var util=require(_0xb4e1('0x6'));var path=require(_0xb4e1('0x7'));var sox=require(_0xb4e1('0x8'));var csv=require('to-csv');var ejs=require(_0xb4e1('0x9'));var fs=require('fs');var fs_extra=require(_0xb4e1('0xa'));var _=require(_0xb4e1('0xb'));var squel=require(_0xb4e1('0xc'));var crypto=require(_0xb4e1('0xd'));var jsforce=require(_0xb4e1('0xe'));var deskjs=require(_0xb4e1('0xf'));var toCsv=require(_0xb4e1('0x10'));var querystring=require(_0xb4e1('0x11'));var Papa=require(_0xb4e1('0x12'));var Redis=require(_0xb4e1('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xb4e1('0x14'));var as=require(_0xb4e1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb4e1('0x16'));var utils=require(_0xb4e1('0x17'));var config=require(_0xb4e1('0x18'));var licenseUtil=require(_0xb4e1('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32db38,_0x30a7f7){_0x30a7f7=_0x30a7f7||0xcc;return function(_0x112ab2){if(_0x112ab2){return _0x32db38[_0xb4e1('0x1a')](_0x30a7f7);}return _0x32db38['status'](_0x30a7f7)[_0xb4e1('0x1b')]();};}function respondWithResult(_0x377ddb,_0x5d27f0){_0x5d27f0=_0x5d27f0||0xc8;return function(_0x38ff67){if(_0x38ff67){return _0x377ddb[_0xb4e1('0x1c')](_0x5d27f0)['json'](_0x38ff67);}};}function respondWithFilteredResult(_0x1dda7f,_0x45b46a){return function(_0x2d55dd){if(_0x2d55dd){var _0x2bdc47=typeof _0x45b46a[_0xb4e1('0x1d')]==='undefined'&&typeof _0x45b46a[_0xb4e1('0x1e')]==='undefined';var _0x32c910=_0x2d55dd[_0xb4e1('0x1f')];var _0x33e495=_0x2bdc47?0x0:_0x45b46a['offset'];var _0x5a7300=_0x2bdc47?_0x2d55dd[_0xb4e1('0x1f')]:_0x45b46a[_0xb4e1('0x1d')]+_0x45b46a['limit'];var _0x3749b9;if(_0x5a7300>=_0x32c910){_0x5a7300=_0x32c910;_0x3749b9=0xc8;}else{_0x3749b9=0xce;}_0x1dda7f['status'](_0x3749b9);return _0x1dda7f[_0xb4e1('0x20')]('Content-Range',_0x33e495+'-'+_0x5a7300+'/'+_0x32c910)[_0xb4e1('0x21')](_0x2d55dd);}return null;};}function patchUpdates(_0x47557c){return function(_0xda055){try{jsonpatch[_0xb4e1('0x22')](_0xda055,_0x47557c,!![]);}catch(_0x25e86c){return BPromise[_0xb4e1('0x23')](_0x25e86c);}return _0xda055['save']();};}function saveUpdates(_0x49d065,_0x1c4caf){return function(_0x2b8da6){if(_0x2b8da6){return _0x2b8da6['update'](_0x49d065)[_0xb4e1('0x24')](function(_0x29f702){return _0x29f702;});}return null;};}function removeEntity(_0x3ad1d9,_0x1dc9f2){return function(_0x318636){if(_0x318636){return _0x318636[_0xb4e1('0x25')]()[_0xb4e1('0x24')](function(){_0x3ad1d9[_0xb4e1('0x1c')](0xcc)[_0xb4e1('0x1b')]();});}};}function handleEntityNotFound(_0x4389d0,_0x34ff7c){return function(_0x2da573){if(!_0x2da573){_0x4389d0[_0xb4e1('0x1a')](0x194);}return _0x2da573;};}function handleError(_0x5be558,_0x2a036d){_0x2a036d=_0x2a036d||0x1f4;return function(_0x5c52eb){logger['error'](_0x5c52eb[_0xb4e1('0x26')]);if(_0x5c52eb[_0xb4e1('0x27')]){delete _0x5c52eb[_0xb4e1('0x27')];}_0x5be558[_0xb4e1('0x1c')](_0x2a036d)['send'](_0x5c52eb);};}exports['index']=function(_0x49f2af,_0x9a2100){var _0x53c78c={},_0x3cbc6a={},_0x3829c6={'count':0x0,'rows':[]};var _0x27e0c8=_[_0xb4e1('0x28')](db[_0xb4e1('0x29')]['rawAttributes'],function(_0x18ffcd){return{'name':_0x18ffcd[_0xb4e1('0x2a')],'type':_0x18ffcd[_0xb4e1('0x2b')]['key']};});_0x3cbc6a[_0xb4e1('0x2c')]=_[_0xb4e1('0x28')](_0x27e0c8,'name');_0x3cbc6a[_0xb4e1('0x2d')]=_[_0xb4e1('0x2e')](_0x49f2af[_0xb4e1('0x2d')]);_0x3cbc6a['filters']=_[_0xb4e1('0x2f')](_0x3cbc6a['model'],_0x3cbc6a[_0xb4e1('0x2d')]);_0x53c78c[_0xb4e1('0x30')]=_[_0xb4e1('0x2f')](_0x3cbc6a[_0xb4e1('0x2c')],qs[_0xb4e1('0x31')](_0x49f2af[_0xb4e1('0x2d')][_0xb4e1('0x31')]));_0x53c78c[_0xb4e1('0x30')]=_0x53c78c[_0xb4e1('0x30')][_0xb4e1('0x32')]?_0x53c78c['attributes']:_0x3cbc6a[_0xb4e1('0x2c')];if(!_0x49f2af[_0xb4e1('0x2d')][_0xb4e1('0x33')](_0xb4e1('0x34'))){_0x53c78c[_0xb4e1('0x1e')]=qs['limit'](_0x49f2af['query']['limit']);_0x53c78c['offset']=qs['offset'](_0x49f2af[_0xb4e1('0x2d')]['offset']);}_0x53c78c[_0xb4e1('0x35')]=qs['sort'](_0x49f2af[_0xb4e1('0x2d')]['sort']);_0x53c78c[_0xb4e1('0x36')]=qs[_0xb4e1('0x37')](_[_0xb4e1('0x38')](_0x49f2af[_0xb4e1('0x2d')],_0x3cbc6a['filters']),_0x27e0c8);if(_0x49f2af['query']['filter']){_0x53c78c[_0xb4e1('0x36')]=_[_0xb4e1('0x39')](_0x53c78c[_0xb4e1('0x36')],{'$or':_[_0xb4e1('0x28')](_0x27e0c8,function(_0x22333b){if(_0x22333b[_0xb4e1('0x2b')]!==_0xb4e1('0x3a')){var _0x48e353={};_0x48e353[_0x22333b[_0xb4e1('0x27')]]={'$like':'%'+_0x49f2af['query'][_0xb4e1('0x3b')]+'%'};return _0x48e353;}})});}_0x53c78c=_[_0xb4e1('0x39')]({},_0x53c78c,_0x49f2af[_0xb4e1('0x3c')]);var _0x2f6f34={'where':_0x53c78c['where']};return db['OpenchannelQueueReport']['count'](_0x2f6f34)['then'](function(_0x300451){_0x3829c6['count']=_0x300451;if(_0x49f2af[_0xb4e1('0x2d')][_0xb4e1('0x3d')]){_0x53c78c[_0xb4e1('0x3e')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xb4e1('0x3f')](_0x53c78c);})[_0xb4e1('0x24')](function(_0x4c3e9a){_0x3829c6['rows']=_0x4c3e9a;return _0x3829c6;})['then'](respondWithFilteredResult(_0x9a2100,_0x53c78c))['catch'](handleError(_0x9a2100,null));};exports[_0xb4e1('0x40')]=function(_0x3a6ce4,_0x5975b3){var _0x28a6ae={'raw':!![],'where':{'id':_0x3a6ce4[_0xb4e1('0x41')]['id']}},_0x4c21b1={};_0x4c21b1[_0xb4e1('0x2c')]=_[_0xb4e1('0x2e')](db[_0xb4e1('0x29')]['rawAttributes']);_0x4c21b1[_0xb4e1('0x2d')]=_[_0xb4e1('0x2e')](_0x3a6ce4[_0xb4e1('0x2d')]);_0x4c21b1['filters']=_[_0xb4e1('0x2f')](_0x4c21b1[_0xb4e1('0x2c')],_0x4c21b1[_0xb4e1('0x2d')]);_0x28a6ae['attributes']=_['intersection'](_0x4c21b1['model'],qs['fields'](_0x3a6ce4[_0xb4e1('0x2d')]['fields']));_0x28a6ae['attributes']=_0x28a6ae[_0xb4e1('0x30')][_0xb4e1('0x32')]?_0x28a6ae[_0xb4e1('0x30')]:_0x4c21b1['model'];if(_0x3a6ce4[_0xb4e1('0x2d')][_0xb4e1('0x3d')]){_0x28a6ae[_0xb4e1('0x3e')]=[{'all':!![]}];}_0x28a6ae=_['merge']({},_0x28a6ae,_0x3a6ce4[_0xb4e1('0x3c')]);return db[_0xb4e1('0x29')][_0xb4e1('0x42')](_0x28a6ae)[_0xb4e1('0x24')](handleEntityNotFound(_0x5975b3,null))[_0xb4e1('0x24')](respondWithResult(_0x5975b3,null))[_0xb4e1('0x43')](handleError(_0x5975b3,null));};exports[_0xb4e1('0x44')]=function(_0x23b08f,_0x15ff47){return db[_0xb4e1('0x29')][_0xb4e1('0x44')](_0x23b08f[_0xb4e1('0x45')],{})[_0xb4e1('0x24')](respondWithResult(_0x15ff47,0xc9))[_0xb4e1('0x43')](handleError(_0x15ff47,null));};exports[_0xb4e1('0x46')]=function(_0x348d77,_0x3909f0){if(_0x348d77[_0xb4e1('0x45')]['id']){delete _0x348d77[_0xb4e1('0x45')]['id'];}return db[_0xb4e1('0x29')][_0xb4e1('0x42')]({'where':{'id':_0x348d77['params']['id']}})[_0xb4e1('0x24')](handleEntityNotFound(_0x3909f0,null))['then'](saveUpdates(_0x348d77[_0xb4e1('0x45')],null))[_0xb4e1('0x24')](respondWithResult(_0x3909f0,null))[_0xb4e1('0x43')](handleError(_0x3909f0,null));};exports[_0xb4e1('0x25')]=function(_0xd23f5a,_0x22e08f){return db[_0xb4e1('0x29')][_0xb4e1('0x42')]({'where':{'id':_0xd23f5a[_0xb4e1('0x41')]['id']}})[_0xb4e1('0x24')](handleEntityNotFound(_0x22e08f,null))[_0xb4e1('0x24')](removeEntity(_0x22e08f,null))[_0xb4e1('0x43')](handleError(_0x22e08f,null));};exports['describe']=function(_0x4aa413,_0x32dfe7){return db[_0xb4e1('0x29')][_0xb4e1('0x47')]()[_0xb4e1('0x24')](respondWithResult(_0x32dfe7,null))[_0xb4e1('0x43')](handleError(_0x32dfe7,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 8f25bbc..5932b57 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x52eea6,_0x184e3e){var _0x80de8a=function(_0x2b632c){while(--_0x2b632c){_0x52eea6['push'](_0x52eea6['shift']());}};_0x80de8a(++_0x184e3e);}(_0x326f,0xd1));var _0xf326=function(_0x2125fe,_0x401ff8){_0x2125fe=_0x2125fe-0x0;var _0x22ffdc=_0x326f[_0x2125fe];return _0x22ffdc;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x131800,_0x4af3de){var _0x297f4b=function(_0x5ca43e){while(--_0x5ca43e){_0x131800['push'](_0x131800['shift']());}};_0x297f4b(++_0x4af3de);}(_0x1261,0x144));var _0x1126=function(_0x58da8a,_0x1fb6ff){_0x58da8a=_0x58da8a-0x0;var _0x5294b9=_0x1261[_0x58da8a];return _0x5294b9;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 8924fd3..84ac2fa 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 _0xd4f4=['options','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','raw','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateOpenchannelQueueReport','create','body'];(function(_0x4f5076,_0x3deea8){var _0x2d8036=function(_0x323276){while(--_0x323276){_0x4f5076['push'](_0x4f5076['shift']());}};_0x2d8036(++_0x3deea8);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x181359,_0x37fe9d){_0x181359=_0x181359-0x0;var _0x653370=_0xd4f4[_0x181359];return _0x653370;};'use strict';var _=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var moment=require(_0x4d4f('0x2'));var BPromise=require(_0x4d4f('0x3'));var rs=require(_0x4d4f('0x4'));var fs=require('fs');var Redis=require(_0x4d4f('0x5'));var db=require(_0x4d4f('0x6'))['db'];var utils=require(_0x4d4f('0x7'));var logger=require(_0x4d4f('0x8'))(_0x4d4f('0x9'));var config=require(_0x4d4f('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d7aa8,_0xecc103,_0x150bd6){return new BPromise(function(_0xea29b,_0x40be66){return client[_0x4d4f('0xb')](_0x1d7aa8,_0x150bd6)[_0x4d4f('0xc')](function(_0x226837){logger[_0x4d4f('0xd')](_0x4d4f('0xe'),_0xecc103,_0x4d4f('0xf'));logger[_0x4d4f('0x10')](_0x4d4f('0x11'),_0xecc103,_0x4d4f('0xf'),JSON[_0x4d4f('0x12')](_0x226837));if(_0x226837[_0x4d4f('0x13')]){if(_0x226837[_0x4d4f('0x13')][_0x4d4f('0x14')]===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0xecc103,_0x226837['error'][_0x4d4f('0x15')]);return _0x40be66(_0x226837[_0x4d4f('0x13')]['message']);}logger[_0x4d4f('0x13')](_0x4d4f('0xe'),_0xecc103,_0x226837[_0x4d4f('0x13')]['message']);return _0xea29b(_0x226837[_0x4d4f('0x13')][_0x4d4f('0x15')]);}else{logger[_0x4d4f('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xecc103,_0x4d4f('0xf'));_0xea29b(_0x226837['result'][_0x4d4f('0x15')]);}})[_0x4d4f('0x16')](function(_0x4170ca){logger['error'](_0x4d4f('0xe'),_0xecc103,_0x4170ca);_0x40be66(_0x4170ca);});});}exports[_0x4d4f('0x17')]=function(_0x51dcf1){var _0x5dbbeb=this;return new Promise(function(_0x519501,_0x5a58af){return db['OpenchannelQueueReport'][_0x4d4f('0x18')](_0x51dcf1[_0x4d4f('0x19')],{'raw':_0x51dcf1[_0x4d4f('0x1a')]?_0x51dcf1[_0x4d4f('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e1ae2){logger['info'](_0x4d4f('0x17'),_0x51dcf1);logger[_0x4d4f('0x10')](_0x4d4f('0x17'),_0x51dcf1,JSON[_0x4d4f('0x12')](_0x1e1ae2));_0x519501(_0x1e1ae2);})[_0x4d4f('0x16')](function(_0x5beab4){logger['error'](_0x4d4f('0x17'),_0x5beab4['message'],_0x51dcf1);_0x5a58af(_0x5dbbeb[_0x4d4f('0x13')](0x1f4,_0x5beab4[_0x4d4f('0x15')]));});});};exports[_0x4d4f('0x1b')]=function(_0x3f4a55){var _0xf3f7a4=this;return new Promise(function(_0x497cec,_0x44bd2f){return db[_0x4d4f('0x1c')][_0x4d4f('0x1d')](_0x3f4a55[_0x4d4f('0x19')],{'raw':_0x3f4a55['options']?_0x3f4a55['options'][_0x4d4f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f4a55[_0x4d4f('0x1a')]?_0x3f4a55[_0x4d4f('0x1a')][_0x4d4f('0x1f')]||null:null,'attributes':_0x3f4a55['options']?_0x3f4a55[_0x4d4f('0x1a')][_0x4d4f('0x20')]||null:null,'limit':_0x3f4a55[_0x4d4f('0x1a')]?_0x3f4a55[_0x4d4f('0x1a')]['limit']||null:null})[_0x4d4f('0xc')](function(_0x51cb3d){logger[_0x4d4f('0xd')](_0x4d4f('0x1b'),_0x3f4a55);logger['debug'](_0x4d4f('0x1b'),_0x3f4a55,JSON[_0x4d4f('0x12')](_0x51cb3d));_0x497cec(_0x51cb3d);})[_0x4d4f('0x16')](function(_0x3d7f14){logger[_0x4d4f('0x13')](_0x4d4f('0x1b'),_0x3d7f14['message'],_0x3f4a55);_0x44bd2f(_0xf3f7a4[_0x4d4f('0x13')](0x1f4,_0x3d7f14[_0x4d4f('0x15')]));});});}; \ No newline at end of file +var _0x06ef=['rpc','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','code','message','result','catch','OpenchannelQueueReport,\x20%s,\x20%s','body','options','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','raw','where','attributes','limit','moment','../../config/utils','../../config/logger'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x06ef,0x185));var _0xf06e=function(_0x597655,_0x47f4e8){_0x597655=_0x597655-0x0;var _0x4999d2=_0x06ef[_0x597655];return _0x4999d2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf06e('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf06e('0x1'));var logger=require(_0xf06e('0x2'))(_0xf06e('0x3'));var config=require('../../config/environment');var jayson=require(_0xf06e('0x4'));var client=jayson[_0xf06e('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59b74b,_0x4e05dc,_0x5cddf1){return new BPromise(function(_0x4ccbee,_0x25b56e){return client[_0xf06e('0x6')](_0x59b74b,_0x5cddf1)[_0xf06e('0x7')](function(_0x2bb08c){logger[_0xf06e('0x8')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4e05dc,_0xf06e('0x9'));logger[_0xf06e('0xa')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x4e05dc,_0xf06e('0x9'),JSON[_0xf06e('0xb')](_0x2bb08c));if(_0x2bb08c[_0xf06e('0xc')]){if(_0x2bb08c[_0xf06e('0xc')][_0xf06e('0xd')]===0x1f4){logger[_0xf06e('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4e05dc,_0x2bb08c[_0xf06e('0xc')][_0xf06e('0xe')]);return _0x25b56e(_0x2bb08c['error'][_0xf06e('0xe')]);}logger[_0xf06e('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4e05dc,_0x2bb08c['error']['message']);return _0x4ccbee(_0x2bb08c[_0xf06e('0xc')][_0xf06e('0xe')]);}else{logger[_0xf06e('0x8')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4e05dc,_0xf06e('0x9'));_0x4ccbee(_0x2bb08c[_0xf06e('0xf')][_0xf06e('0xe')]);}})[_0xf06e('0x10')](function(_0x44157a){logger[_0xf06e('0xc')](_0xf06e('0x11'),_0x4e05dc,_0x44157a);_0x25b56e(_0x44157a);});});}exports['CreateOpenchannelQueueReport']=function(_0x380c07){var _0x55dabf=this;return new Promise(function(_0x251c9f,_0x7a9f4b){return db['OpenchannelQueueReport']['create'](_0x380c07[_0xf06e('0x12')],{'raw':_0x380c07[_0xf06e('0x13')]?_0x380c07['options']['raw']===undefined?!![]:![]:!![]})[_0xf06e('0x7')](function(_0x211590){logger[_0xf06e('0x8')]('CreateOpenchannelQueueReport',_0x380c07);logger[_0xf06e('0xa')](_0xf06e('0x14'),_0x380c07,JSON['stringify'](_0x211590));_0x251c9f(_0x211590);})[_0xf06e('0x10')](function(_0x1ba130){logger[_0xf06e('0xc')]('CreateOpenchannelQueueReport',_0x1ba130[_0xf06e('0xe')],_0x380c07);_0x7a9f4b(_0x55dabf[_0xf06e('0xc')](0x1f4,_0x1ba130[_0xf06e('0xe')]));});});};exports[_0xf06e('0x15')]=function(_0x3b410e){var _0x4c2d01=this;return new Promise(function(_0x3a969c,_0x4923d3){return db[_0xf06e('0x16')][_0xf06e('0x17')](_0x3b410e[_0xf06e('0x12')],{'raw':_0x3b410e[_0xf06e('0x13')]?_0x3b410e[_0xf06e('0x13')][_0xf06e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b410e['options']?_0x3b410e[_0xf06e('0x13')][_0xf06e('0x19')]||null:null,'attributes':_0x3b410e[_0xf06e('0x13')]?_0x3b410e[_0xf06e('0x13')][_0xf06e('0x1a')]||null:null,'limit':_0x3b410e['options']?_0x3b410e[_0xf06e('0x13')][_0xf06e('0x1b')]||null:null})[_0xf06e('0x7')](function(_0x89a74f){logger[_0xf06e('0x8')](_0xf06e('0x15'),_0x3b410e);logger['debug'](_0xf06e('0x15'),_0x3b410e,JSON[_0xf06e('0xb')](_0x89a74f));_0x3a969c(_0x89a74f);})[_0xf06e('0x10')](function(_0x5d21f7){logger[_0xf06e('0xc')](_0xf06e('0x15'),_0x5d21f7[_0xf06e('0xe')],_0x3b410e);_0x4923d3(_0x4c2d01[_0xf06e('0xc')](0x1f4,_0x5d21f7[_0xf06e('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 8c96000..8aa1a36 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 _0x7d12=['../../config/environment','get','isAuthenticated','/describe','post','create','put','/:id','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2833da,_0x512321){var _0x49968a=function(_0x52e88e){while(--_0x52e88e){_0x2833da['push'](_0x2833da['shift']());}};_0x49968a(++_0x512321);}(_0x7d12,0x91));var _0x27d1=function(_0x1886d0,_0x36d4b4){_0x1886d0=_0x1886d0-0x0;var _0x152689=_0x7d12[_0x1886d0];return _0x152689;};'use strict';var multer=require('multer');var util=require(_0x27d1('0x0'));var path=require('path');var timeout=require(_0x27d1('0x1'));var express=require(_0x27d1('0x2'));var router=express[_0x27d1('0x3')]();var fs_extra=require(_0x27d1('0x4'));var auth=require(_0x27d1('0x5'));var interaction=require(_0x27d1('0x6'));var config=require(_0x27d1('0x7'));var controller=require('./openchannelTransferReport.controller');router[_0x27d1('0x8')]('/',auth[_0x27d1('0x9')](),controller['index']);router[_0x27d1('0x8')](_0x27d1('0xa'),auth[_0x27d1('0x9')](),controller['describe']);router[_0x27d1('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x27d1('0xb')]('/',auth[_0x27d1('0x9')](),controller[_0x27d1('0xc')]);router[_0x27d1('0xd')](_0x27d1('0xe'),auth['isAuthenticated'](),controller[_0x27d1('0xf')]);router[_0x27d1('0x10')](_0x27d1('0xe'),auth[_0x27d1('0x9')](),controller[_0x27d1('0x11')]);module[_0x27d1('0x12')]=router; \ No newline at end of file +var _0x6d51=['show','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x1c95a1,_0x3fe773){var _0x5a015e=function(_0x493f95){while(--_0x493f95){_0x1c95a1['push'](_0x1c95a1['shift']());}};_0x5a015e(++_0x3fe773);}(_0x6d51,0x1eb));var _0x16d5=function(_0x3df6af,_0x3dca23){_0x3df6af=_0x3df6af-0x0;var _0x28cb3d=_0x6d51[_0x3df6af];return _0x28cb3d;};'use strict';var multer=require(_0x16d5('0x0'));var util=require(_0x16d5('0x1'));var path=require(_0x16d5('0x2'));var timeout=require(_0x16d5('0x3'));var express=require(_0x16d5('0x4'));var router=express[_0x16d5('0x5')]();var fs_extra=require(_0x16d5('0x6'));var auth=require(_0x16d5('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x16d5('0x8'));var controller=require(_0x16d5('0x9'));router[_0x16d5('0xa')]('/',auth[_0x16d5('0xb')](),controller[_0x16d5('0xc')]);router['get'](_0x16d5('0xd'),auth[_0x16d5('0xb')](),controller[_0x16d5('0xe')]);router['get']('/:id',auth[_0x16d5('0xb')](),controller[_0x16d5('0xf')]);router[_0x16d5('0x10')]('/',auth[_0x16d5('0xb')](),controller[_0x16d5('0x11')]);router['put'](_0x16d5('0x12'),auth[_0x16d5('0xb')](),controller['update']);router[_0x16d5('0x13')](_0x16d5('0x12'),auth[_0x16d5('0xb')](),controller[_0x16d5('0x14')]);module[_0x16d5('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 1313d5a..698607e 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x57fe34,_0x400bda){var _0x3cdcdf=function(_0x403770){while(--_0x403770){_0x57fe34['push'](_0x57fe34['shift']());}};_0x3cdcdf(++_0x400bda);}(_0xedd9,0xfc));var _0x9edd=function(_0x3a3525,_0x5bee02){_0x3a3525=_0x3a3525-0x0;var _0x56e306=_0xedd9[_0x3a3525];return _0x56e306;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x1ce61e,_0x1cb067){var _0x7d0ea9=function(_0x50038b){while(--_0x50038b){_0x1ce61e['push'](_0x1ce61e['shift']());}};_0x7d0ea9(++_0x1cb067);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x1476ba,_0x446421){_0x1476ba=_0x1476ba-0x0;var _0x5e7bc1=_0xf3cd[_0x1476ba];return _0x5e7bc1;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index f7ec7dc..33fdf7a 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 _0x4924=['fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','reject','save','update','then','destroy','end','error','name','send','map','OpenchannelTransferReport','rawAttributes','fieldName','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','params','includeAll','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs'];(function(_0x5c756f,_0x230e49){var _0x1bdecb=function(_0x2a77c5){while(--_0x2a77c5){_0x5c756f['push'](_0x5c756f['shift']());}};_0x1bdecb(++_0x230e49);}(_0x4924,0x157));var _0x4492=function(_0x400322,_0x4353a8){_0x400322=_0x400322-0x0;var _0xfdd597=_0x4924[_0x400322];return _0xfdd597;};'use strict';var emlformat=require(_0x4492('0x0'));var rimraf=require(_0x4492('0x1'));var zipdir=require(_0x4492('0x2'));var jsonpatch=require(_0x4492('0x3'));var rp=require(_0x4492('0x4'));var moment=require(_0x4492('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4492('0x6'));var util=require(_0x4492('0x7'));var path=require(_0x4492('0x8'));var sox=require(_0x4492('0x9'));var csv=require(_0x4492('0xa'));var ejs=require(_0x4492('0xb'));var fs=require('fs');var fs_extra=require(_0x4492('0xc'));var _=require(_0x4492('0xd'));var squel=require('squel');var crypto=require(_0x4492('0xe'));var jsforce=require(_0x4492('0xf'));var deskjs=require(_0x4492('0x10'));var toCsv=require(_0x4492('0xa'));var querystring=require(_0x4492('0x11'));var Papa=require(_0x4492('0x12'));var Redis=require('ioredis');var authService=require(_0x4492('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4492('0x14'));var hardwareService=require(_0x4492('0x15'));var logger=require(_0x4492('0x16'))(_0x4492('0x17'));var utils=require(_0x4492('0x18'));var config=require(_0x4492('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d5810,_0x81b50e){_0x81b50e=_0x81b50e||0xcc;return function(_0x1d3e9a){if(_0x1d3e9a){return _0x4d5810[_0x4492('0x1a')](_0x81b50e);}return _0x4d5810['status'](_0x81b50e)['end']();};}function respondWithResult(_0x1f1616,_0x5b8b83){_0x5b8b83=_0x5b8b83||0xc8;return function(_0x3292e3){if(_0x3292e3){return _0x1f1616[_0x4492('0x1b')](_0x5b8b83)[_0x4492('0x1c')](_0x3292e3);}};}function respondWithFilteredResult(_0x4ecd41,_0x59ab8d){return function(_0x4cff8a){if(_0x4cff8a){var _0x286f27=typeof _0x59ab8d[_0x4492('0x1d')]===_0x4492('0x1e')&&typeof _0x59ab8d[_0x4492('0x1f')]===_0x4492('0x1e');var _0x4909f3=_0x4cff8a['count'];var _0x2b5d26=_0x286f27?0x0:_0x59ab8d['offset'];var _0xc29e8b=_0x286f27?_0x4cff8a['count']:_0x59ab8d[_0x4492('0x1d')]+_0x59ab8d[_0x4492('0x1f')];var _0x3655f8;if(_0xc29e8b>=_0x4909f3){_0xc29e8b=_0x4909f3;_0x3655f8=0xc8;}else{_0x3655f8=0xce;}_0x4ecd41[_0x4492('0x1b')](_0x3655f8);return _0x4ecd41['set']('Content-Range',_0x2b5d26+'-'+_0xc29e8b+'/'+_0x4909f3)[_0x4492('0x1c')](_0x4cff8a);}return null;};}function patchUpdates(_0x1dd88d){return function(_0x3a7954){try{jsonpatch['apply'](_0x3a7954,_0x1dd88d,!![]);}catch(_0x15abc3){return BPromise[_0x4492('0x20')](_0x15abc3);}return _0x3a7954[_0x4492('0x21')]();};}function saveUpdates(_0x3a4cbf,_0x2f4a12){return function(_0x3ea0f1){if(_0x3ea0f1){return _0x3ea0f1[_0x4492('0x22')](_0x3a4cbf)[_0x4492('0x23')](function(_0x3b55ad){return _0x3b55ad;});}return null;};}function removeEntity(_0x5a2bd8,_0x48531d){return function(_0x4793d8){if(_0x4793d8){return _0x4793d8[_0x4492('0x24')]()['then'](function(){_0x5a2bd8[_0x4492('0x1b')](0xcc)[_0x4492('0x25')]();});}};}function handleEntityNotFound(_0x5b73e0,_0x129de7){return function(_0x2e798b){if(!_0x2e798b){_0x5b73e0[_0x4492('0x1a')](0x194);}return _0x2e798b;};}function handleError(_0x1782e9,_0x46beaa){_0x46beaa=_0x46beaa||0x1f4;return function(_0x1bcd23){logger[_0x4492('0x26')](_0x1bcd23['stack']);if(_0x1bcd23[_0x4492('0x27')]){delete _0x1bcd23[_0x4492('0x27')];}_0x1782e9[_0x4492('0x1b')](_0x46beaa)[_0x4492('0x28')](_0x1bcd23);};}exports['index']=function(_0x3bc361,_0x5c78ad){var _0x5c132f={},_0x257d4f={},_0x575ee6={'count':0x0,'rows':[]};var _0x26f016=_[_0x4492('0x29')](db[_0x4492('0x2a')][_0x4492('0x2b')],function(_0x567f86){return{'name':_0x567f86[_0x4492('0x2c')],'type':_0x567f86['type']['key']};});_0x257d4f['model']=_[_0x4492('0x29')](_0x26f016,'name');_0x257d4f['query']=_[_0x4492('0x2d')](_0x3bc361[_0x4492('0x2e')]);_0x257d4f['filters']=_[_0x4492('0x2f')](_0x257d4f[_0x4492('0x30')],_0x257d4f[_0x4492('0x2e')]);_0x5c132f[_0x4492('0x31')]=_[_0x4492('0x2f')](_0x257d4f['model'],qs[_0x4492('0x32')](_0x3bc361['query'][_0x4492('0x32')]));_0x5c132f['attributes']=_0x5c132f[_0x4492('0x31')][_0x4492('0x33')]?_0x5c132f['attributes']:_0x257d4f[_0x4492('0x30')];if(!_0x3bc361[_0x4492('0x2e')][_0x4492('0x34')]('nolimit')){_0x5c132f['limit']=qs[_0x4492('0x1f')](_0x3bc361[_0x4492('0x2e')][_0x4492('0x1f')]);_0x5c132f[_0x4492('0x1d')]=qs[_0x4492('0x1d')](_0x3bc361[_0x4492('0x2e')][_0x4492('0x1d')]);}_0x5c132f['order']=qs[_0x4492('0x35')](_0x3bc361[_0x4492('0x2e')]['sort']);_0x5c132f[_0x4492('0x36')]=qs[_0x4492('0x37')](_[_0x4492('0x38')](_0x3bc361[_0x4492('0x2e')],_0x257d4f[_0x4492('0x37')]),_0x26f016);if(_0x3bc361[_0x4492('0x2e')][_0x4492('0x39')]){_0x5c132f['where']=_[_0x4492('0x3a')](_0x5c132f[_0x4492('0x36')],{'$or':_[_0x4492('0x29')](_0x26f016,function(_0x3abcb0){if(_0x3abcb0['type']!==_0x4492('0x3b')){var _0x200d9f={};_0x200d9f[_0x3abcb0[_0x4492('0x27')]]={'$like':'%'+_0x3bc361[_0x4492('0x2e')][_0x4492('0x39')]+'%'};return _0x200d9f;}})});}_0x5c132f=_[_0x4492('0x3a')]({},_0x5c132f,_0x3bc361[_0x4492('0x3c')]);var _0x21dbf8={'where':_0x5c132f[_0x4492('0x36')]};return db[_0x4492('0x2a')][_0x4492('0x3d')](_0x21dbf8)[_0x4492('0x23')](function(_0x3c0dab){_0x575ee6[_0x4492('0x3d')]=_0x3c0dab;if(_0x3bc361[_0x4492('0x2e')]['includeAll']){_0x5c132f[_0x4492('0x3e')]=[{'all':!![]}];}return db[_0x4492('0x2a')][_0x4492('0x3f')](_0x5c132f);})[_0x4492('0x23')](function(_0x35e4d0){_0x575ee6[_0x4492('0x40')]=_0x35e4d0;return _0x575ee6;})[_0x4492('0x23')](respondWithFilteredResult(_0x5c78ad,_0x5c132f))[_0x4492('0x41')](handleError(_0x5c78ad,null));};exports['show']=function(_0x538177,_0x190b5e){var _0x39091e={'raw':!![],'where':{'id':_0x538177[_0x4492('0x42')]['id']}},_0x53c3f1={};_0x53c3f1['model']=_[_0x4492('0x2d')](db[_0x4492('0x2a')][_0x4492('0x2b')]);_0x53c3f1['query']=_[_0x4492('0x2d')](_0x538177[_0x4492('0x2e')]);_0x53c3f1[_0x4492('0x37')]=_[_0x4492('0x2f')](_0x53c3f1[_0x4492('0x30')],_0x53c3f1['query']);_0x39091e['attributes']=_[_0x4492('0x2f')](_0x53c3f1['model'],qs[_0x4492('0x32')](_0x538177[_0x4492('0x2e')][_0x4492('0x32')]));_0x39091e[_0x4492('0x31')]=_0x39091e[_0x4492('0x31')][_0x4492('0x33')]?_0x39091e[_0x4492('0x31')]:_0x53c3f1[_0x4492('0x30')];if(_0x538177[_0x4492('0x2e')][_0x4492('0x43')]){_0x39091e[_0x4492('0x3e')]=[{'all':!![]}];}_0x39091e=_[_0x4492('0x3a')]({},_0x39091e,_0x538177[_0x4492('0x3c')]);return db[_0x4492('0x2a')]['find'](_0x39091e)[_0x4492('0x23')](handleEntityNotFound(_0x190b5e,null))['then'](respondWithResult(_0x190b5e,null))[_0x4492('0x41')](handleError(_0x190b5e,null));};exports['create']=function(_0x5b9e1c,_0x4e6e81){return db[_0x4492('0x2a')][_0x4492('0x44')](_0x5b9e1c[_0x4492('0x45')],{})[_0x4492('0x23')](respondWithResult(_0x4e6e81,0xc9))[_0x4492('0x41')](handleError(_0x4e6e81,null));};exports[_0x4492('0x22')]=function(_0x5a01c6,_0xd00886){if(_0x5a01c6[_0x4492('0x45')]['id']){delete _0x5a01c6['body']['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x5a01c6[_0x4492('0x42')]['id']}})[_0x4492('0x23')](handleEntityNotFound(_0xd00886,null))['then'](saveUpdates(_0x5a01c6[_0x4492('0x45')],null))[_0x4492('0x23')](respondWithResult(_0xd00886,null))[_0x4492('0x41')](handleError(_0xd00886,null));};exports['destroy']=function(_0x5a6f4f,_0x3afb82){return db[_0x4492('0x2a')]['find']({'where':{'id':_0x5a6f4f[_0x4492('0x42')]['id']}})[_0x4492('0x23')](handleEntityNotFound(_0x3afb82,null))['then'](removeEntity(_0x3afb82,null))[_0x4492('0x41')](handleError(_0x3afb82,null));};exports['describe']=function(_0x340b33,_0x24ed65){return db[_0x4492('0x2a')][_0x4492('0x46')]()[_0x4492('0x23')](respondWithResult(_0x24ed65,null))['catch'](handleError(_0x24ed65,null));}; \ No newline at end of file +var _0xba26=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','count','set','save','destroy','then','error','stack','name','send','map','OpenchannelTransferReport','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','pick','filter','where','type','merge','includeAll','rows','catch','params','rawAttributes','include','options','find','create','body','update','describe','eml-format','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x30efc1,_0xce84de){var _0x46d79e=function(_0x397ace){while(--_0x397ace){_0x30efc1['push'](_0x30efc1['shift']());}};_0x46d79e(++_0xce84de);}(_0xba26,0xbc));var _0x6ba2=function(_0x1a5bbd,_0x4a34f4){_0x1a5bbd=_0x1a5bbd-0x0;var _0xbd42aa=_0xba26[_0x1a5bbd];return _0xbd42aa;};'use strict';var emlformat=require(_0x6ba2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6ba2('0x1'));var fs=require('fs');var fs_extra=require(_0x6ba2('0x2'));var _=require(_0x6ba2('0x3'));var squel=require(_0x6ba2('0x4'));var crypto=require(_0x6ba2('0x5'));var jsforce=require(_0x6ba2('0x6'));var deskjs=require(_0x6ba2('0x7'));var toCsv=require(_0x6ba2('0x8'));var querystring=require(_0x6ba2('0x9'));var Papa=require(_0x6ba2('0xa'));var Redis=require(_0x6ba2('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x6ba2('0xc'));var as=require(_0x6ba2('0xd'));var hardwareService=require(_0x6ba2('0xe'));var logger=require(_0x6ba2('0xf'))(_0x6ba2('0x10'));var utils=require(_0x6ba2('0x11'));var config=require(_0x6ba2('0x12'));var licenseUtil=require(_0x6ba2('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fcda5,_0x35995b){_0x35995b=_0x35995b||0xcc;return function(_0xecbd86){if(_0xecbd86){return _0x1fcda5[_0x6ba2('0x14')](_0x35995b);}return _0x1fcda5['status'](_0x35995b)[_0x6ba2('0x15')]();};}function respondWithResult(_0x542903,_0x3b4818){_0x3b4818=_0x3b4818||0xc8;return function(_0x19918f){if(_0x19918f){return _0x542903[_0x6ba2('0x16')](_0x3b4818)[_0x6ba2('0x17')](_0x19918f);}};}function respondWithFilteredResult(_0x3fabfb,_0x4ff24b){return function(_0x19ac33){if(_0x19ac33){var _0x2c93f2=typeof _0x4ff24b[_0x6ba2('0x18')]==='undefined'&&typeof _0x4ff24b[_0x6ba2('0x19')]==='undefined';var _0x56f43c=_0x19ac33['count'];var _0x21b12b=_0x2c93f2?0x0:_0x4ff24b[_0x6ba2('0x18')];var _0x262e7a=_0x2c93f2?_0x19ac33[_0x6ba2('0x1a')]:_0x4ff24b[_0x6ba2('0x18')]+_0x4ff24b[_0x6ba2('0x19')];var _0x4b8b23;if(_0x262e7a>=_0x56f43c){_0x262e7a=_0x56f43c;_0x4b8b23=0xc8;}else{_0x4b8b23=0xce;}_0x3fabfb['status'](_0x4b8b23);return _0x3fabfb[_0x6ba2('0x1b')]('Content-Range',_0x21b12b+'-'+_0x262e7a+'/'+_0x56f43c)[_0x6ba2('0x17')](_0x19ac33);}return null;};}function patchUpdates(_0x54072b){return function(_0x422e6d){try{jsonpatch['apply'](_0x422e6d,_0x54072b,!![]);}catch(_0x3b5b17){return BPromise['reject'](_0x3b5b17);}return _0x422e6d[_0x6ba2('0x1c')]();};}function saveUpdates(_0x3a5a91,_0x442f75){return function(_0x532d67){if(_0x532d67){return _0x532d67['update'](_0x3a5a91)['then'](function(_0x3f283f){return _0x3f283f;});}return null;};}function removeEntity(_0x4bc350,_0xceed65){return function(_0x5996f){if(_0x5996f){return _0x5996f[_0x6ba2('0x1d')]()[_0x6ba2('0x1e')](function(){_0x4bc350[_0x6ba2('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21e8dd,_0x13c0fe){return function(_0x5bf4f9){if(!_0x5bf4f9){_0x21e8dd[_0x6ba2('0x14')](0x194);}return _0x5bf4f9;};}function handleError(_0x3e81bb,_0x338639){_0x338639=_0x338639||0x1f4;return function(_0x1fe5e7){logger[_0x6ba2('0x1f')](_0x1fe5e7[_0x6ba2('0x20')]);if(_0x1fe5e7[_0x6ba2('0x21')]){delete _0x1fe5e7['name'];}_0x3e81bb[_0x6ba2('0x16')](_0x338639)[_0x6ba2('0x22')](_0x1fe5e7);};}exports['index']=function(_0x1e5abc,_0x4fdbf4){var _0x33a7fc={},_0x103666={},_0x2f42b8={'count':0x0,'rows':[]};var _0x5a76c=_[_0x6ba2('0x23')](db[_0x6ba2('0x24')]['rawAttributes'],function(_0x15be44){return{'name':_0x15be44[_0x6ba2('0x25')],'type':_0x15be44['type'][_0x6ba2('0x26')]};});_0x103666['model']=_[_0x6ba2('0x23')](_0x5a76c,'name');_0x103666[_0x6ba2('0x27')]=_[_0x6ba2('0x28')](_0x1e5abc['query']);_0x103666[_0x6ba2('0x29')]=_[_0x6ba2('0x2a')](_0x103666['model'],_0x103666['query']);_0x33a7fc[_0x6ba2('0x2b')]=_[_0x6ba2('0x2a')](_0x103666[_0x6ba2('0x2c')],qs[_0x6ba2('0x2d')](_0x1e5abc[_0x6ba2('0x27')]['fields']));_0x33a7fc[_0x6ba2('0x2b')]=_0x33a7fc[_0x6ba2('0x2b')][_0x6ba2('0x2e')]?_0x33a7fc[_0x6ba2('0x2b')]:_0x103666[_0x6ba2('0x2c')];if(!_0x1e5abc[_0x6ba2('0x27')][_0x6ba2('0x2f')](_0x6ba2('0x30'))){_0x33a7fc[_0x6ba2('0x19')]=qs[_0x6ba2('0x19')](_0x1e5abc[_0x6ba2('0x27')]['limit']);_0x33a7fc[_0x6ba2('0x18')]=qs[_0x6ba2('0x18')](_0x1e5abc[_0x6ba2('0x27')][_0x6ba2('0x18')]);}_0x33a7fc['order']=qs['sort'](_0x1e5abc['query']['sort']);_0x33a7fc['where']=qs[_0x6ba2('0x29')](_[_0x6ba2('0x31')](_0x1e5abc['query'],_0x103666['filters']),_0x5a76c);if(_0x1e5abc[_0x6ba2('0x27')][_0x6ba2('0x32')]){_0x33a7fc[_0x6ba2('0x33')]=_['merge'](_0x33a7fc['where'],{'$or':_[_0x6ba2('0x23')](_0x5a76c,function(_0x57c171){if(_0x57c171[_0x6ba2('0x34')]!=='VIRTUAL'){var _0x459c32={};_0x459c32[_0x57c171[_0x6ba2('0x21')]]={'$like':'%'+_0x1e5abc['query'][_0x6ba2('0x32')]+'%'};return _0x459c32;}})});}_0x33a7fc=_[_0x6ba2('0x35')]({},_0x33a7fc,_0x1e5abc['options']);var _0x232ce7={'where':_0x33a7fc[_0x6ba2('0x33')]};return db[_0x6ba2('0x24')][_0x6ba2('0x1a')](_0x232ce7)['then'](function(_0x1dde5b){_0x2f42b8[_0x6ba2('0x1a')]=_0x1dde5b;if(_0x1e5abc[_0x6ba2('0x27')][_0x6ba2('0x36')]){_0x33a7fc['include']=[{'all':!![]}];}return db[_0x6ba2('0x24')]['findAll'](_0x33a7fc);})[_0x6ba2('0x1e')](function(_0x2d73af){_0x2f42b8[_0x6ba2('0x37')]=_0x2d73af;return _0x2f42b8;})['then'](respondWithFilteredResult(_0x4fdbf4,_0x33a7fc))[_0x6ba2('0x38')](handleError(_0x4fdbf4,null));};exports['show']=function(_0x1607a1,_0x2b88c7){var _0x590a67={'raw':!![],'where':{'id':_0x1607a1[_0x6ba2('0x39')]['id']}},_0x30a55b={};_0x30a55b[_0x6ba2('0x2c')]=_[_0x6ba2('0x28')](db[_0x6ba2('0x24')][_0x6ba2('0x3a')]);_0x30a55b[_0x6ba2('0x27')]=_['keys'](_0x1607a1[_0x6ba2('0x27')]);_0x30a55b[_0x6ba2('0x29')]=_['intersection'](_0x30a55b[_0x6ba2('0x2c')],_0x30a55b['query']);_0x590a67['attributes']=_[_0x6ba2('0x2a')](_0x30a55b[_0x6ba2('0x2c')],qs['fields'](_0x1607a1[_0x6ba2('0x27')][_0x6ba2('0x2d')]));_0x590a67[_0x6ba2('0x2b')]=_0x590a67[_0x6ba2('0x2b')][_0x6ba2('0x2e')]?_0x590a67[_0x6ba2('0x2b')]:_0x30a55b[_0x6ba2('0x2c')];if(_0x1607a1['query']['includeAll']){_0x590a67[_0x6ba2('0x3b')]=[{'all':!![]}];}_0x590a67=_['merge']({},_0x590a67,_0x1607a1[_0x6ba2('0x3c')]);return db[_0x6ba2('0x24')][_0x6ba2('0x3d')](_0x590a67)[_0x6ba2('0x1e')](handleEntityNotFound(_0x2b88c7,null))[_0x6ba2('0x1e')](respondWithResult(_0x2b88c7,null))['catch'](handleError(_0x2b88c7,null));};exports[_0x6ba2('0x3e')]=function(_0x2bf8f1,_0x29cc22){return db[_0x6ba2('0x24')][_0x6ba2('0x3e')](_0x2bf8f1[_0x6ba2('0x3f')],{})['then'](respondWithResult(_0x29cc22,0xc9))[_0x6ba2('0x38')](handleError(_0x29cc22,null));};exports[_0x6ba2('0x40')]=function(_0x4be17b,_0x275c60){if(_0x4be17b['body']['id']){delete _0x4be17b[_0x6ba2('0x3f')]['id'];}return db[_0x6ba2('0x24')]['find']({'where':{'id':_0x4be17b[_0x6ba2('0x39')]['id']}})[_0x6ba2('0x1e')](handleEntityNotFound(_0x275c60,null))[_0x6ba2('0x1e')](saveUpdates(_0x4be17b[_0x6ba2('0x3f')],null))[_0x6ba2('0x1e')](respondWithResult(_0x275c60,null))[_0x6ba2('0x38')](handleError(_0x275c60,null));};exports[_0x6ba2('0x1d')]=function(_0x4b7bff,_0x38b5ab){return db[_0x6ba2('0x24')]['find']({'where':{'id':_0x4b7bff['params']['id']}})['then'](handleEntityNotFound(_0x38b5ab,null))['then'](removeEntity(_0x38b5ab,null))[_0x6ba2('0x38')](handleError(_0x38b5ab,null));};exports[_0x6ba2('0x41')]=function(_0x13d4c0,_0xdd4f25){return db[_0x6ba2('0x24')][_0x6ba2('0x41')]()[_0x6ba2('0x1e')](respondWithResult(_0xdd4f25,null))[_0x6ba2('0x38')](handleError(_0xdd4f25,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 80b2439..7039f95 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 _0x27cb=['request-promise','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer','uniqueid','util','api','moment','bluebird'];(function(_0x1cd85a,_0x12ab1b){var _0x1c4a8e=function(_0x21d59c){while(--_0x21d59c){_0x1cd85a['push'](_0x1cd85a['shift']());}};_0x1c4a8e(++_0x12ab1b);}(_0x27cb,0xd4));var _0xb27c=function(_0x15ce17,_0x13068d){_0x15ce17=_0x15ce17-0x0;var _0x4856e3=_0x27cb[_0x15ce17];return _0x4856e3;};'use strict';var _=require('lodash');var util=require(_0xb27c('0x0'));var logger=require('../../config/logger')(_0xb27c('0x1'));var moment=require(_0xb27c('0x2'));var BPromise=require(_0xb27c('0x3'));var rp=require(_0xb27c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb27c('0x5'));var config=require(_0xb27c('0x6'));var attributes=require(_0xb27c('0x7'));module[_0xb27c('0x8')]=function(_0x62c5c1,_0x33d1ee){return _0x62c5c1[_0xb27c('0x9')]('OpenchannelTransferReport',attributes,{'tableName':_0xb27c('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xb27c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2603=['request-promise','path','rimraf','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x4055b3,_0x19d733){var _0x194589=function(_0x5c7b15){while(--_0x5c7b15){_0x4055b3['push'](_0x4055b3['shift']());}};_0x194589(++_0x19d733);}(_0x2603,0x8a));var _0x3260=function(_0x4d58ce,_0x47fb4f){_0x4d58ce=_0x4d58ce-0x0;var _0x504769=_0x2603[_0x4d58ce];return _0x504769;};'use strict';var _=require(_0x3260('0x0'));var util=require(_0x3260('0x1'));var logger=require('../../config/logger')(_0x3260('0x2'));var moment=require(_0x3260('0x3'));var BPromise=require(_0x3260('0x4'));var rp=require(_0x3260('0x5'));var fs=require('fs');var path=require(_0x3260('0x6'));var rimraf=require(_0x3260('0x7'));var config=require('../../config/environment');var attributes=require(_0x3260('0x8'));module[_0x3260('0x9')]=function(_0x40bf82,_0xd9cf72){return _0x40bf82[_0x3260('0xa')](_0x3260('0xb'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x3260('0xc'),'fields':[_0x3260('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 864ff8c..e2e0db4 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 _0xc978=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8c97('0x0'));var util=require(_0x8c97('0x1'));var moment=require(_0x8c97('0x2'));var BPromise=require(_0x8c97('0x3'));var rs=require(_0x8c97('0x4'));var fs=require('fs');var Redis=require(_0x8c97('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8c97('0x6'));var logger=require(_0x8c97('0x7'))(_0x8c97('0x8'));var config=require(_0x8c97('0x9'));var jayson=require(_0x8c97('0xa'));var client=jayson[_0x8c97('0xb')][_0x8c97('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x524196,_0x41a511,_0x1b5864){return new BPromise(function(_0x332cd1,_0x26ff40){return client[_0x8c97('0xd')](_0x524196,_0x1b5864)[_0x8c97('0xe')](function(_0x17aef0){logger['info'](_0x8c97('0xf'),_0x41a511,_0x8c97('0x10'));logger[_0x8c97('0x11')](_0x8c97('0x12'),_0x41a511,_0x8c97('0x10'),JSON[_0x8c97('0x13')](_0x17aef0));if(_0x17aef0[_0x8c97('0x14')]){if(_0x17aef0[_0x8c97('0x14')][_0x8c97('0x15')]===0x1f4){logger['error'](_0x8c97('0xf'),_0x41a511,_0x17aef0[_0x8c97('0x14')]['message']);return _0x26ff40(_0x17aef0[_0x8c97('0x14')][_0x8c97('0x16')]);}logger['error'](_0x8c97('0xf'),_0x41a511,_0x17aef0['error']['message']);return _0x332cd1(_0x17aef0['error'][_0x8c97('0x16')]);}else{logger[_0x8c97('0x17')](_0x8c97('0xf'),_0x41a511,_0x8c97('0x10'));_0x332cd1(_0x17aef0[_0x8c97('0x18')][_0x8c97('0x16')]);}})[_0x8c97('0x19')](function(_0xe3be1){logger[_0x8c97('0x14')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x41a511,_0xe3be1);_0x26ff40(_0xe3be1);});});} \ No newline at end of file +var _0x29b1=['../../config/environment','jayson/promise','client','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','message','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x409fb8,_0x5ab3d3){var _0x278270=function(_0x58849c){while(--_0x58849c){_0x409fb8['push'](_0x409fb8['shift']());}};_0x278270(++_0x5ab3d3);}(_0x29b1,0x13b));var _0x129b=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x29b1[_0xf71120];return _0xbe2fd3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x129b('0x0'));var BPromise=require(_0x129b('0x1'));var rs=require(_0x129b('0x2'));var fs=require('fs');var Redis=require(_0x129b('0x3'));var db=require(_0x129b('0x4'))['db'];var utils=require(_0x129b('0x5'));var logger=require(_0x129b('0x6'))(_0x129b('0x7'));var config=require(_0x129b('0x8'));var jayson=require(_0x129b('0x9'));var client=jayson[_0x129b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b0923,_0x5f0bcc,_0x1155dd){return new BPromise(function(_0x31e697,_0x54a406){return client['request'](_0x4b0923,_0x1155dd)[_0x129b('0xb')](function(_0x5b7597){logger[_0x129b('0xc')](_0x129b('0xd'),_0x5f0bcc,_0x129b('0xe'));logger[_0x129b('0xf')](_0x129b('0x10'),_0x5f0bcc,_0x129b('0xe'),JSON['stringify'](_0x5b7597));if(_0x5b7597[_0x129b('0x11')]){if(_0x5b7597[_0x129b('0x11')]['code']===0x1f4){logger[_0x129b('0x11')](_0x129b('0xd'),_0x5f0bcc,_0x5b7597['error'][_0x129b('0x12')]);return _0x54a406(_0x5b7597[_0x129b('0x11')][_0x129b('0x12')]);}logger[_0x129b('0x11')](_0x129b('0xd'),_0x5f0bcc,_0x5b7597['error'][_0x129b('0x12')]);return _0x31e697(_0x5b7597[_0x129b('0x11')][_0x129b('0x12')]);}else{logger['info'](_0x129b('0xd'),_0x5f0bcc,_0x129b('0xe'));_0x31e697(_0x5b7597['result'][_0x129b('0x12')]);}})['catch'](function(_0x168620){logger[_0x129b('0x11')](_0x129b('0xd'),_0x5f0bcc,_0x168620);_0x54a406(_0x168620);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 9d8f45c..fc8ab30 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 _0x0a78=['../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','put','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0a78,0x1ab));var _0x80a7=function(_0x1504f9,_0x17e295){_0x1504f9=_0x1504f9-0x0;var _0x2dc464=_0x0a78[_0x1504f9];return _0x2dc464;};'use strict';var multer=require(_0x80a7('0x0'));var util=require(_0x80a7('0x1'));var path=require('path');var timeout=require(_0x80a7('0x2'));var express=require('express');var router=express[_0x80a7('0x3')]();var fs_extra=require(_0x80a7('0x4'));var auth=require(_0x80a7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x80a7('0x6'));var controller=require('./pause.controller');router[_0x80a7('0x7')]('/',auth[_0x80a7('0x8')](),controller['index']);router[_0x80a7('0x7')](_0x80a7('0x9'),auth[_0x80a7('0x8')](),controller[_0x80a7('0xa')]);router[_0x80a7('0xb')]('/',auth[_0x80a7('0x8')](),controller['create']);router[_0x80a7('0xc')](_0x80a7('0x9'),auth[_0x80a7('0x8')](),controller['update']);router[_0x80a7('0xd')](_0x80a7('0x9'),auth['isAuthenticated'](),controller[_0x80a7('0xe')]);module[_0x80a7('0xf')]=router; \ No newline at end of file +var _0xd6f4=['exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','post','create','put','update','delete','destroy'];(function(_0x1c1fdd,_0x3330da){var _0x25ff90=function(_0x3a6615){while(--_0x3a6615){_0x1c1fdd['push'](_0x1c1fdd['shift']());}};_0x25ff90(++_0x3330da);}(_0xd6f4,0x7f));var _0x4d6f=function(_0x6726fd,_0x428da2){_0x6726fd=_0x6726fd-0x0;var _0x115454=_0xd6f4[_0x6726fd];return _0x115454;};'use strict';var multer=require(_0x4d6f('0x0'));var util=require('util');var path=require(_0x4d6f('0x1'));var timeout=require(_0x4d6f('0x2'));var express=require(_0x4d6f('0x3'));var router=express[_0x4d6f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4d6f('0x5'));var config=require(_0x4d6f('0x6'));var controller=require('./pause.controller');router[_0x4d6f('0x7')]('/',auth['isAuthenticated'](),controller[_0x4d6f('0x8')]);router['get']('/:id',auth[_0x4d6f('0x9')](),controller[_0x4d6f('0xa')]);router[_0x4d6f('0xb')]('/',auth[_0x4d6f('0x9')](),controller[_0x4d6f('0xc')]);router[_0x4d6f('0xd')]('/:id',auth[_0x4d6f('0x9')](),controller[_0x4d6f('0xe')]);router[_0x4d6f('0xf')]('/:id',auth[_0x4d6f('0x9')](),controller[_0x4d6f('0x10')]);module[_0x4d6f('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 31a5ae9..cb92887 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 _0x0cbb=['name','sequelize','exports','STRING'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x0cbb,0x1b5));var _0xb0cb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0cbb[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb0cb('0x0'));module[_0xb0cb('0x1')]={'name':{'type':Sequelize[_0xb0cb('0x2')],'unique':_0xb0cb('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2566=['name','sequelize','STRING'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x2566,0x76));var _0x6256=function(_0x2eb739,_0x30968b){_0x2eb739=_0x2eb739-0x0;var _0x247822=_0x2566[_0x2eb739];return _0x247822;};'use strict';var Sequelize=require(_0x6256('0x0'));module['exports']={'name':{'type':Sequelize[_0x6256('0x1')],'unique':_0x6256('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x6256('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 3e43ec5..6b80834 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 _0x250d=['user','UserProfileSection','userProfileId','UserProfileResource','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','update','then','destroy','get','Pauses','error','name','send','index','Pause','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','catch','show','params','rawAttributes','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x352d28,_0x444033){var _0x387d7e=function(_0x40be0e){while(--_0x40be0e){_0x352d28['push'](_0x352d28['shift']());}};_0x387d7e(++_0x444033);}(_0x250d,0x1f0));var _0xd250=function(_0x53b133,_0x176261){_0x53b133=_0x53b133-0x0;var _0x5647e0=_0x250d[_0x53b133];return _0x5647e0;};'use strict';var emlformat=require(_0xd250('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd250('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd250('0x2'));var moment=require(_0xd250('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd250('0x4'));var util=require(_0xd250('0x5'));var path=require(_0xd250('0x6'));var sox=require(_0xd250('0x7'));var csv=require(_0xd250('0x8'));var ejs=require(_0xd250('0x9'));var fs=require('fs');var fs_extra=require(_0xd250('0xa'));var _=require(_0xd250('0xb'));var squel=require('squel');var crypto=require(_0xd250('0xc'));var jsforce=require(_0xd250('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd250('0xe'));var Papa=require(_0xd250('0xf'));var Redis=require(_0xd250('0x10'));var authService=require(_0xd250('0x11'));var qs=require(_0xd250('0x12'));var as=require(_0xd250('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd250('0x14'))('api');var utils=require(_0xd250('0x15'));var config=require(_0xd250('0x16'));var licenseUtil=require(_0xd250('0x17'));var db=require(_0xd250('0x18'))['db'];function respondWithStatusCode(_0x4a5b61,_0x4d1dd6){_0x4d1dd6=_0x4d1dd6||0xcc;return function(_0x22eed6){if(_0x22eed6){return _0x4a5b61[_0xd250('0x19')](_0x4d1dd6);}return _0x4a5b61[_0xd250('0x1a')](_0x4d1dd6)[_0xd250('0x1b')]();};}function respondWithResult(_0x1adfbe,_0x587677){_0x587677=_0x587677||0xc8;return function(_0x47b73d){if(_0x47b73d){return _0x1adfbe['status'](_0x587677)[_0xd250('0x1c')](_0x47b73d);}};}function respondWithFilteredResult(_0x25da95,_0x21fa5a){return function(_0x4d7911){if(_0x4d7911){var _0x59ff8e=typeof _0x21fa5a[_0xd250('0x1d')]===_0xd250('0x1e')&&typeof _0x21fa5a['limit']==='undefined';var _0x1ddf3f=_0x4d7911['count'];var _0x537d1a=_0x59ff8e?0x0:_0x21fa5a[_0xd250('0x1d')];var _0x11e721=_0x59ff8e?_0x4d7911[_0xd250('0x1f')]:_0x21fa5a[_0xd250('0x1d')]+_0x21fa5a['limit'];var _0x4f0d3c;if(_0x11e721>=_0x1ddf3f){_0x11e721=_0x1ddf3f;_0x4f0d3c=0xc8;}else{_0x4f0d3c=0xce;}_0x25da95[_0xd250('0x1a')](_0x4f0d3c);return _0x25da95['set'](_0xd250('0x20'),_0x537d1a+'-'+_0x11e721+'/'+_0x1ddf3f)[_0xd250('0x1c')](_0x4d7911);}return null;};}function patchUpdates(_0x20ac1c){return function(_0x57aa4d){try{jsonpatch[_0xd250('0x21')](_0x57aa4d,_0x20ac1c,!![]);}catch(_0x403b6a){return BPromise[_0xd250('0x22')](_0x403b6a);}return _0x57aa4d['save']();};}function saveUpdates(_0x3626f0,_0x40be7d){return function(_0x71f107){if(_0x71f107){return _0x71f107[_0xd250('0x23')](_0x3626f0)[_0xd250('0x24')](function(_0x5d782b){return _0x5d782b;});}return null;};}function removeEntity(_0x145080,_0x581ff5){return function(_0x19454d){if(_0x19454d){return _0x19454d[_0xd250('0x25')]()[_0xd250('0x24')](function(){var _0x1c94f9=_0x19454d[_0xd250('0x26')]({'plain':!![]});var _0x4736a9=_0xd250('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x4736a9,'resourceId':_0x1c94f9['id']}})[_0xd250('0x24')](function(){return _0x19454d;});})[_0xd250('0x24')](function(){_0x145080[_0xd250('0x1a')](0xcc)[_0xd250('0x1b')]();});}};}function handleEntityNotFound(_0xc1a4e,_0x1ab03c){return function(_0x4c8d7e){if(!_0x4c8d7e){_0xc1a4e['sendStatus'](0x194);}return _0x4c8d7e;};}function handleError(_0x29212f,_0x2e2427){_0x2e2427=_0x2e2427||0x1f4;return function(_0x49b4af){logger[_0xd250('0x28')](_0x49b4af['stack']);if(_0x49b4af[_0xd250('0x29')]){delete _0x49b4af[_0xd250('0x29')];}_0x29212f[_0xd250('0x1a')](_0x2e2427)[_0xd250('0x2a')](_0x49b4af);};}exports[_0xd250('0x2b')]=function(_0x39e397,_0x1d5002){var _0x22891f={},_0x9a4df={},_0x12238c={'count':0x0,'rows':[]};var _0x37acac=_['map'](db[_0xd250('0x2c')]['rawAttributes'],function(_0x59acac){return{'name':_0x59acac[_0xd250('0x2d')],'type':_0x59acac['type'][_0xd250('0x2e')]};});_0x9a4df[_0xd250('0x2f')]=_['map'](_0x37acac,'name');_0x9a4df[_0xd250('0x30')]=_[_0xd250('0x31')](_0x39e397[_0xd250('0x30')]);_0x9a4df[_0xd250('0x32')]=_[_0xd250('0x33')](_0x9a4df[_0xd250('0x2f')],_0x9a4df['query']);_0x22891f['attributes']=_['intersection'](_0x9a4df[_0xd250('0x2f')],qs[_0xd250('0x34')](_0x39e397[_0xd250('0x30')][_0xd250('0x34')]));_0x22891f[_0xd250('0x35')]=_0x22891f['attributes']['length']?_0x22891f[_0xd250('0x35')]:_0x9a4df[_0xd250('0x2f')];if(!_0x39e397[_0xd250('0x30')][_0xd250('0x36')](_0xd250('0x37'))){_0x22891f[_0xd250('0x38')]=qs[_0xd250('0x38')](_0x39e397[_0xd250('0x30')]['limit']);_0x22891f[_0xd250('0x1d')]=qs['offset'](_0x39e397['query'][_0xd250('0x1d')]);}_0x22891f[_0xd250('0x39')]=qs[_0xd250('0x3a')](_0x39e397[_0xd250('0x30')][_0xd250('0x3a')]);_0x22891f[_0xd250('0x3b')]=qs['filters'](_[_0xd250('0x3c')](_0x39e397[_0xd250('0x30')],_0x9a4df[_0xd250('0x32')]),_0x37acac);if(_0x39e397[_0xd250('0x30')][_0xd250('0x3d')]){_0x22891f['where']=_[_0xd250('0x3e')](_0x22891f[_0xd250('0x3b')],{'$or':_[_0xd250('0x3f')](_0x37acac,function(_0x5e50a6){if(_0x5e50a6['type']!==_0xd250('0x40')){var _0x45e9ca={};_0x45e9ca[_0x5e50a6['name']]={'$like':'%'+_0x39e397[_0xd250('0x30')][_0xd250('0x3d')]+'%'};return _0x45e9ca;}})});}_0x22891f=_['merge']({},_0x22891f,_0x39e397[_0xd250('0x41')]);var _0x352e11={'where':_0x22891f[_0xd250('0x3b')]};return db[_0xd250('0x2c')]['count'](_0x352e11)[_0xd250('0x24')](function(_0x2af2e3){_0x12238c[_0xd250('0x1f')]=_0x2af2e3;if(_0x39e397[_0xd250('0x30')][_0xd250('0x42')]){_0x22891f[_0xd250('0x43')]=[{'all':!![]}];}return db[_0xd250('0x2c')]['findAll'](_0x22891f);})[_0xd250('0x24')](function(_0x584550){_0x12238c['rows']=_0x584550;return _0x12238c;})[_0xd250('0x24')](respondWithFilteredResult(_0x1d5002,_0x22891f))[_0xd250('0x44')](handleError(_0x1d5002,null));};exports[_0xd250('0x45')]=function(_0x55dde1,_0x246831){var _0x392d05={'raw':!![],'where':{'id':_0x55dde1[_0xd250('0x46')]['id']}},_0x2d245b={};_0x2d245b[_0xd250('0x2f')]=_[_0xd250('0x31')](db[_0xd250('0x2c')][_0xd250('0x47')]);_0x2d245b[_0xd250('0x30')]=_['keys'](_0x55dde1[_0xd250('0x30')]);_0x2d245b[_0xd250('0x32')]=_[_0xd250('0x33')](_0x2d245b[_0xd250('0x2f')],_0x2d245b[_0xd250('0x30')]);_0x392d05[_0xd250('0x35')]=_[_0xd250('0x33')](_0x2d245b[_0xd250('0x2f')],qs[_0xd250('0x34')](_0x55dde1[_0xd250('0x30')][_0xd250('0x34')]));_0x392d05[_0xd250('0x35')]=_0x392d05['attributes'][_0xd250('0x48')]?_0x392d05[_0xd250('0x35')]:_0x2d245b[_0xd250('0x2f')];if(_0x55dde1[_0xd250('0x30')][_0xd250('0x42')]){_0x392d05[_0xd250('0x43')]=[{'all':!![]}];}_0x392d05=_['merge']({},_0x392d05,_0x55dde1[_0xd250('0x41')]);return db[_0xd250('0x2c')][_0xd250('0x49')](_0x392d05)[_0xd250('0x24')](handleEntityNotFound(_0x246831,null))[_0xd250('0x24')](respondWithResult(_0x246831,null))['catch'](handleError(_0x246831,null));};exports[_0xd250('0x4a')]=function(_0x42658e,_0x2fa4dc){return db[_0xd250('0x2c')][_0xd250('0x4a')](_0x42658e[_0xd250('0x4b')],{})[_0xd250('0x24')](function(_0x278da9){var _0x334a2d=_0x42658e['user'][_0xd250('0x26')]({'plain':!![]});if(!_0x334a2d)throw new Error(_0xd250('0x4c'));if(_0x334a2d[_0xd250('0x4d')]===_0xd250('0x4e')){var _0x3e3622=_0x278da9[_0xd250('0x26')]({'plain':!![]});var _0x174ee9=_0xd250('0x27');return db[_0xd250('0x4f')][_0xd250('0x49')]({'where':{'name':_0x174ee9,'userProfileId':_0x334a2d[_0xd250('0x50')]},'raw':!![]})['then'](function(_0x27fd91){if(_0x27fd91&&_0x27fd91['autoAssociation']===0x0){return db[_0xd250('0x51')][_0xd250('0x4a')]({'name':_0x3e3622[_0xd250('0x29')],'resourceId':_0x3e3622['id'],'type':_0x27fd91[_0xd250('0x29')],'sectionId':_0x27fd91['id']},{})['then'](function(){return _0x278da9;});}else{return _0x278da9;}})[_0xd250('0x44')](function(_0x589079){logger[_0xd250('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x589079);throw _0x589079;});}return _0x278da9;})['then'](respondWithResult(_0x2fa4dc,0xc9))[_0xd250('0x44')](handleError(_0x2fa4dc,null));};exports[_0xd250('0x23')]=function(_0x5311ab,_0x346833){if(_0x5311ab[_0xd250('0x4b')]['id']){delete _0x5311ab[_0xd250('0x4b')]['id'];}return db[_0xd250('0x2c')][_0xd250('0x49')]({'where':{'id':_0x5311ab[_0xd250('0x46')]['id']}})['then'](handleEntityNotFound(_0x346833,null))[_0xd250('0x24')](saveUpdates(_0x5311ab['body'],null))[_0xd250('0x24')](respondWithResult(_0x346833,null))[_0xd250('0x44')](handleError(_0x346833,null));};exports[_0xd250('0x25')]=function(_0x3ff681,_0x503ad7){return db[_0xd250('0x2c')][_0xd250('0x49')]({'where':{'id':_0x3ff681[_0xd250('0x46')]['id']}})[_0xd250('0x24')](handleEntityNotFound(_0x503ad7,null))[_0xd250('0x24')](removeEntity(_0x503ad7,null))[_0xd250('0x44')](handleError(_0x503ad7,null));}; \ No newline at end of file +var _0xa2c2=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','Pauses','UserProfileResource','end','error','name','index','map','Pause','fieldName','type','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','options','includeAll','include','findAll','catch','show','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x1344d6,_0x2181e6){var _0xf45b24=function(_0x2d90c1){while(--_0x2d90c1){_0x1344d6['push'](_0x1344d6['shift']());}};_0xf45b24(++_0x2181e6);}(_0xa2c2,0xe4));var _0x2a2c=function(_0x49d6f0,_0x492fee){_0x49d6f0=_0x49d6f0-0x0;var _0x33b6dc=_0xa2c2[_0x49d6f0];return _0x33b6dc;};'use strict';var emlformat=require(_0x2a2c('0x0'));var rimraf=require(_0x2a2c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2a2c('0x2'));var rp=require(_0x2a2c('0x3'));var moment=require(_0x2a2c('0x4'));var BPromise=require(_0x2a2c('0x5'));var Mustache=require(_0x2a2c('0x6'));var util=require(_0x2a2c('0x7'));var path=require('path');var sox=require(_0x2a2c('0x8'));var csv=require('to-csv');var ejs=require(_0x2a2c('0x9'));var fs=require('fs');var fs_extra=require(_0x2a2c('0xa'));var _=require(_0x2a2c('0xb'));var squel=require(_0x2a2c('0xc'));var crypto=require(_0x2a2c('0xd'));var jsforce=require(_0x2a2c('0xe'));var deskjs=require(_0x2a2c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2a2c('0x10'));var Papa=require(_0x2a2c('0x11'));var Redis=require(_0x2a2c('0x12'));var authService=require(_0x2a2c('0x13'));var qs=require(_0x2a2c('0x14'));var as=require(_0x2a2c('0x15'));var hardwareService=require(_0x2a2c('0x16'));var logger=require(_0x2a2c('0x17'))(_0x2a2c('0x18'));var utils=require('../../config/utils');var config=require(_0x2a2c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a2c('0x1a'))['db'];function respondWithStatusCode(_0x57339f,_0x3cafea){_0x3cafea=_0x3cafea||0xcc;return function(_0x33278c){if(_0x33278c){return _0x57339f['sendStatus'](_0x3cafea);}return _0x57339f[_0x2a2c('0x1b')](_0x3cafea)['end']();};}function respondWithResult(_0x45b102,_0x5a0444){_0x5a0444=_0x5a0444||0xc8;return function(_0x81d896){if(_0x81d896){return _0x45b102[_0x2a2c('0x1b')](_0x5a0444)[_0x2a2c('0x1c')](_0x81d896);}};}function respondWithFilteredResult(_0x43a94a,_0x35709c){return function(_0x181c6a){if(_0x181c6a){var _0x5c2b7c=typeof _0x35709c[_0x2a2c('0x1d')]===_0x2a2c('0x1e')&&typeof _0x35709c[_0x2a2c('0x1f')]===_0x2a2c('0x1e');var _0x3eeec0=_0x181c6a[_0x2a2c('0x20')];var _0xa66a77=_0x5c2b7c?0x0:_0x35709c[_0x2a2c('0x1d')];var _0x2ea197=_0x5c2b7c?_0x181c6a[_0x2a2c('0x20')]:_0x35709c['offset']+_0x35709c[_0x2a2c('0x1f')];var _0x5d3098;if(_0x2ea197>=_0x3eeec0){_0x2ea197=_0x3eeec0;_0x5d3098=0xc8;}else{_0x5d3098=0xce;}_0x43a94a[_0x2a2c('0x1b')](_0x5d3098);return _0x43a94a[_0x2a2c('0x21')](_0x2a2c('0x22'),_0xa66a77+'-'+_0x2ea197+'/'+_0x3eeec0)[_0x2a2c('0x1c')](_0x181c6a);}return null;};}function patchUpdates(_0x1a33b3){return function(_0x162601){try{jsonpatch[_0x2a2c('0x23')](_0x162601,_0x1a33b3,!![]);}catch(_0x4d3e1e){return BPromise['reject'](_0x4d3e1e);}return _0x162601[_0x2a2c('0x24')]();};}function saveUpdates(_0x1de8cf,_0x35d47c){return function(_0x50b21d){if(_0x50b21d){return _0x50b21d[_0x2a2c('0x25')](_0x1de8cf)[_0x2a2c('0x26')](function(_0x510dc3){return _0x510dc3;});}return null;};}function removeEntity(_0x4b87ea,_0x37c6c5){return function(_0x98c874){if(_0x98c874){return _0x98c874[_0x2a2c('0x27')]()[_0x2a2c('0x26')](function(){var _0x3deef9=_0x98c874[_0x2a2c('0x28')]({'plain':!![]});var _0x442cff=_0x2a2c('0x29');return db[_0x2a2c('0x2a')][_0x2a2c('0x27')]({'where':{'type':_0x442cff,'resourceId':_0x3deef9['id']}})['then'](function(){return _0x98c874;});})[_0x2a2c('0x26')](function(){_0x4b87ea[_0x2a2c('0x1b')](0xcc)[_0x2a2c('0x2b')]();});}};}function handleEntityNotFound(_0x613d6c,_0x49f427){return function(_0x1237af){if(!_0x1237af){_0x613d6c['sendStatus'](0x194);}return _0x1237af;};}function handleError(_0x8fd301,_0x1148e6){_0x1148e6=_0x1148e6||0x1f4;return function(_0x5a97e9){logger[_0x2a2c('0x2c')](_0x5a97e9['stack']);if(_0x5a97e9['name']){delete _0x5a97e9[_0x2a2c('0x2d')];}_0x8fd301[_0x2a2c('0x1b')](_0x1148e6)['send'](_0x5a97e9);};}exports[_0x2a2c('0x2e')]=function(_0x1d6217,_0x122e73){var _0x3a2f8e={},_0x33ca20={},_0x158021={'count':0x0,'rows':[]};var _0x114c67=_[_0x2a2c('0x2f')](db[_0x2a2c('0x30')]['rawAttributes'],function(_0x1e446c){return{'name':_0x1e446c[_0x2a2c('0x31')],'type':_0x1e446c[_0x2a2c('0x32')]['key']};});_0x33ca20[_0x2a2c('0x33')]=_[_0x2a2c('0x2f')](_0x114c67,_0x2a2c('0x2d'));_0x33ca20['query']=_[_0x2a2c('0x34')](_0x1d6217['query']);_0x33ca20[_0x2a2c('0x35')]=_[_0x2a2c('0x36')](_0x33ca20[_0x2a2c('0x33')],_0x33ca20[_0x2a2c('0x37')]);_0x3a2f8e['attributes']=_['intersection'](_0x33ca20[_0x2a2c('0x33')],qs[_0x2a2c('0x38')](_0x1d6217[_0x2a2c('0x37')][_0x2a2c('0x38')]));_0x3a2f8e[_0x2a2c('0x39')]=_0x3a2f8e[_0x2a2c('0x39')][_0x2a2c('0x3a')]?_0x3a2f8e[_0x2a2c('0x39')]:_0x33ca20[_0x2a2c('0x33')];if(!_0x1d6217[_0x2a2c('0x37')][_0x2a2c('0x3b')](_0x2a2c('0x3c'))){_0x3a2f8e[_0x2a2c('0x1f')]=qs['limit'](_0x1d6217['query'][_0x2a2c('0x1f')]);_0x3a2f8e[_0x2a2c('0x1d')]=qs[_0x2a2c('0x1d')](_0x1d6217['query'][_0x2a2c('0x1d')]);}_0x3a2f8e['order']=qs[_0x2a2c('0x3d')](_0x1d6217[_0x2a2c('0x37')][_0x2a2c('0x3d')]);_0x3a2f8e[_0x2a2c('0x3e')]=qs[_0x2a2c('0x35')](_[_0x2a2c('0x3f')](_0x1d6217[_0x2a2c('0x37')],_0x33ca20[_0x2a2c('0x35')]),_0x114c67);if(_0x1d6217['query']['filter']){_0x3a2f8e[_0x2a2c('0x3e')]=_[_0x2a2c('0x40')](_0x3a2f8e['where'],{'$or':_[_0x2a2c('0x2f')](_0x114c67,function(_0x11d82e){if(_0x11d82e[_0x2a2c('0x32')]!=='VIRTUAL'){var _0x5b03f8={};_0x5b03f8[_0x11d82e[_0x2a2c('0x2d')]]={'$like':'%'+_0x1d6217['query']['filter']+'%'};return _0x5b03f8;}})});}_0x3a2f8e=_[_0x2a2c('0x40')]({},_0x3a2f8e,_0x1d6217[_0x2a2c('0x41')]);var _0x25ea81={'where':_0x3a2f8e[_0x2a2c('0x3e')]};return db['Pause'][_0x2a2c('0x20')](_0x25ea81)[_0x2a2c('0x26')](function(_0x10bbb1){_0x158021[_0x2a2c('0x20')]=_0x10bbb1;if(_0x1d6217[_0x2a2c('0x37')][_0x2a2c('0x42')]){_0x3a2f8e[_0x2a2c('0x43')]=[{'all':!![]}];}return db[_0x2a2c('0x30')][_0x2a2c('0x44')](_0x3a2f8e);})[_0x2a2c('0x26')](function(_0x2dcfe0){_0x158021['rows']=_0x2dcfe0;return _0x158021;})[_0x2a2c('0x26')](respondWithFilteredResult(_0x122e73,_0x3a2f8e))[_0x2a2c('0x45')](handleError(_0x122e73,null));};exports[_0x2a2c('0x46')]=function(_0x43e1cf,_0x85e76d){var _0x11cfed={'raw':!![],'where':{'id':_0x43e1cf['params']['id']}},_0x5b6348={};_0x5b6348[_0x2a2c('0x33')]=_[_0x2a2c('0x34')](db['Pause'][_0x2a2c('0x47')]);_0x5b6348['query']=_[_0x2a2c('0x34')](_0x43e1cf[_0x2a2c('0x37')]);_0x5b6348[_0x2a2c('0x35')]=_[_0x2a2c('0x36')](_0x5b6348[_0x2a2c('0x33')],_0x5b6348[_0x2a2c('0x37')]);_0x11cfed[_0x2a2c('0x39')]=_['intersection'](_0x5b6348[_0x2a2c('0x33')],qs[_0x2a2c('0x38')](_0x43e1cf['query'][_0x2a2c('0x38')]));_0x11cfed[_0x2a2c('0x39')]=_0x11cfed[_0x2a2c('0x39')][_0x2a2c('0x3a')]?_0x11cfed[_0x2a2c('0x39')]:_0x5b6348['model'];if(_0x43e1cf['query']['includeAll']){_0x11cfed[_0x2a2c('0x43')]=[{'all':!![]}];}_0x11cfed=_[_0x2a2c('0x40')]({},_0x11cfed,_0x43e1cf['options']);return db[_0x2a2c('0x30')][_0x2a2c('0x48')](_0x11cfed)[_0x2a2c('0x26')](handleEntityNotFound(_0x85e76d,null))[_0x2a2c('0x26')](respondWithResult(_0x85e76d,null))[_0x2a2c('0x45')](handleError(_0x85e76d,null));};exports[_0x2a2c('0x49')]=function(_0x14a7de,_0xed135a){return db[_0x2a2c('0x30')]['create'](_0x14a7de[_0x2a2c('0x4a')],{})[_0x2a2c('0x26')](function(_0x45c447){var _0x2be312=_0x14a7de['user'][_0x2a2c('0x28')]({'plain':!![]});if(!_0x2be312)throw new Error(_0x2a2c('0x4b'));if(_0x2be312[_0x2a2c('0x4c')]===_0x2a2c('0x4d')){var _0x2e0d5e=_0x45c447[_0x2a2c('0x28')]({'plain':!![]});var _0x56fce0=_0x2a2c('0x29');return db[_0x2a2c('0x4e')][_0x2a2c('0x48')]({'where':{'name':_0x56fce0,'userProfileId':_0x2be312['userProfileId']},'raw':!![]})[_0x2a2c('0x26')](function(_0x30abf9){if(_0x30abf9&&_0x30abf9['autoAssociation']===0x0){return db[_0x2a2c('0x2a')]['create']({'name':_0x2e0d5e['name'],'resourceId':_0x2e0d5e['id'],'type':_0x30abf9[_0x2a2c('0x2d')],'sectionId':_0x30abf9['id']},{})[_0x2a2c('0x26')](function(){return _0x45c447;});}else{return _0x45c447;}})[_0x2a2c('0x45')](function(_0x500ce2){logger[_0x2a2c('0x2c')](_0x2a2c('0x4f'),_0x500ce2);throw _0x500ce2;});}return _0x45c447;})[_0x2a2c('0x26')](respondWithResult(_0xed135a,0xc9))[_0x2a2c('0x45')](handleError(_0xed135a,null));};exports['update']=function(_0x2f056c,_0x299bcb){if(_0x2f056c['body']['id']){delete _0x2f056c[_0x2a2c('0x4a')]['id'];}return db[_0x2a2c('0x30')]['find']({'where':{'id':_0x2f056c[_0x2a2c('0x50')]['id']}})[_0x2a2c('0x26')](handleEntityNotFound(_0x299bcb,null))[_0x2a2c('0x26')](saveUpdates(_0x2f056c[_0x2a2c('0x4a')],null))[_0x2a2c('0x26')](respondWithResult(_0x299bcb,null))[_0x2a2c('0x45')](handleError(_0x299bcb,null));};exports[_0x2a2c('0x27')]=function(_0x35760f,_0x3fdac9){return db[_0x2a2c('0x30')][_0x2a2c('0x48')]({'where':{'id':_0x35760f[_0x2a2c('0x50')]['id']}})[_0x2a2c('0x26')](handleEntityNotFound(_0x3fdac9,null))[_0x2a2c('0x26')](removeEntity(_0x3fdac9,null))['catch'](handleError(_0x3fdac9,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 84eaea5..8a310fe 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 _0xc4aa=['bluebird','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xc4aa[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['./pause.attributes','exports','define','Pause','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x1c9f9b,_0x32b776){var _0x305aed=function(_0x57bed9){while(--_0x57bed9){_0x1c9f9b['push'](_0x1c9f9b['shift']());}};_0x305aed(++_0x32b776);}(_0x1cb9,0x14e));var _0x91cb=function(_0x11d5f0,_0x1618bc){_0x11d5f0=_0x11d5f0-0x0;var _0x30196e=_0x1cb9[_0x11d5f0];return _0x30196e;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 9305dd1..6fccde7 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x3bf298,_0x40793a){var _0x4f9268=function(_0x36540e){while(--_0x36540e){_0x3bf298['push'](_0x3bf298['shift']());}};_0x4f9268(++_0x40793a);}(_0xb10b,0x12a));var _0xbb10=function(_0x556dda,_0x3180e8){_0x556dda=_0x556dda-0x0;var _0x3405ce=_0xb10b[_0x556dda];return _0x3405ce;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x4adba3,_0x4b89eb){var _0x40dc67=function(_0x207201){while(--_0x207201){_0x4adba3['push'](_0x4adba3['shift']());}};_0x40dc67(++_0x4b89eb);}(_0xb10b,0x12a));var _0xbb10=function(_0x121328,_0x2c3815){_0x121328=_0x121328-0x0;var _0x28548a=_0xb10b[_0x121328];return _0x28548a;};'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 b4c7732..84a4bfc 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 _0x57d4=['../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','show','diskStorage','join','root','server/files/plugins','originalname','%s-%s%s','basename','extname','now','single','file','upload','webhookPost','/:id','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x14d3cc,_0x567831){var _0x1f822b=function(_0x1eeeb9){while(--_0x1eeeb9){_0x14d3cc['push'](_0x14d3cc['shift']());}};_0x1f822b(++_0x567831);}(_0x57d4,0x78));var _0x457d=function(_0x549779,_0x4afa01){_0x549779=_0x549779-0x0;var _0x223e3c=_0x57d4[_0x549779];return _0x223e3c;};'use strict';var multer=require(_0x457d('0x0'));var util=require(_0x457d('0x1'));var path=require('path');var timeout=require(_0x457d('0x2'));var express=require(_0x457d('0x3'));var router=express[_0x457d('0x4')]();var fs_extra=require(_0x457d('0x5'));var auth=require(_0x457d('0x6'));var interaction=require(_0x457d('0x7'));var config=require(_0x457d('0x8'));var controller=require(_0x457d('0x9'));router[_0x457d('0xa')]('/',auth[_0x457d('0xb')](),controller[_0x457d('0xc')]);router['get'](_0x457d('0xd'),controller[_0x457d('0xe')]);router['get']('/:id',auth[_0x457d('0xb')](),controller[_0x457d('0xf')]);router[_0x457d('0xa')]('/:id/download',auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x457d('0x10')]({'destination':function(_0x38ec93,_0x449f48,_0x128e09){_0x128e09(null,path[_0x457d('0x11')](config[_0x457d('0x12')],_0x457d('0x13')));},'filename':function(_0x24cf65,_0xe7d200,_0x5abf49){_0xe7d200[_0x457d('0x14')]=_0xe7d200[_0x457d('0x14')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5abf49(null,util['format'](_0x457d('0x15'),path[_0x457d('0x16')](_0xe7d200[_0x457d('0x14')],path[_0x457d('0x17')](_0xe7d200[_0x457d('0x14')])),Date[_0x457d('0x18')](),path[_0x457d('0x17')](_0xe7d200[_0x457d('0x14')])));}})});router['post']('/',upload[_0x457d('0x19')](_0x457d('0x1a')),controller[_0x457d('0x1b')]);router['post']('/webhook',controller[_0x457d('0x1c')]);router['put'](_0x457d('0x1d'),auth[_0x457d('0xb')](),controller['update']);router[_0x457d('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0x457d('0x1e')]);module[_0x457d('0x1f')]=router; \ No newline at end of file +var _0xfd28=['webhookPost','put','update','delete','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','isAuthenticated','index','/:id','diskStorage','join','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','/webhook'];(function(_0x273c02,_0x568c91){var _0x3b0c6b=function(_0x1e8bf5){while(--_0x1e8bf5){_0x273c02['push'](_0x273c02['shift']());}};_0x3b0c6b(++_0x568c91);}(_0xfd28,0x148));var _0x8fd2=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xfd28[_0x1e4360];return _0x31e6b4;};'use strict';var multer=require('multer');var util=require(_0x8fd2('0x0'));var path=require(_0x8fd2('0x1'));var timeout=require('connect-timeout');var express=require(_0x8fd2('0x2'));var router=express['Router']();var fs_extra=require(_0x8fd2('0x3'));var auth=require(_0x8fd2('0x4'));var interaction=require(_0x8fd2('0x5'));var config=require('../../config/environment');var controller=require(_0x8fd2('0x6'));router[_0x8fd2('0x7')]('/',auth[_0x8fd2('0x8')](),controller[_0x8fd2('0x9')]);router[_0x8fd2('0x7')]('/webhook',controller['webhookGet']);router[_0x8fd2('0x7')](_0x8fd2('0xa'),auth[_0x8fd2('0x8')](),controller['show']);router[_0x8fd2('0x7')]('/:id/download',auth[_0x8fd2('0x8')](),controller['download']);var upload=multer({'storage':multer[_0x8fd2('0xb')]({'destination':function(_0x4fdf0b,_0x1ca2a1,_0x5244ed){_0x5244ed(null,path[_0x8fd2('0xc')](config['root'],_0x8fd2('0xd')));},'filename':function(_0x207298,_0xfd78d,_0xa6d7ca){_0xfd78d[_0x8fd2('0xe')]=_0xfd78d[_0x8fd2('0xe')][_0x8fd2('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xa6d7ca(null,util[_0x8fd2('0x10')](_0x8fd2('0x11'),path[_0x8fd2('0x12')](_0xfd78d[_0x8fd2('0xe')],path[_0x8fd2('0x13')](_0xfd78d[_0x8fd2('0xe')])),Date[_0x8fd2('0x14')](),path[_0x8fd2('0x13')](_0xfd78d['originalname'])));}})});router[_0x8fd2('0x15')]('/',upload['single']('file'),controller['upload']);router[_0x8fd2('0x15')](_0x8fd2('0x16'),controller[_0x8fd2('0x17')]);router[_0x8fd2('0x18')]('/:id',auth[_0x8fd2('0x8')](),controller[_0x8fd2('0x19')]);router[_0x8fd2('0x1a')](_0x8fd2('0xa'),auth[_0x8fd2('0x8')](),controller['delete']);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 e63de33..6ef0640 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 _0x1961=['always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM','TEXT','STRING','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(_0x15413e,_0x36ccf6){var _0x3b58ff=function(_0x3cfd75){while(--_0x3cfd75){_0x15413e['push'](_0x15413e['shift']());}};_0x3b58ff(++_0x36ccf6);}(_0x1961,0xfa));var _0x1196=function(_0x1f1405,_0x20d0ae){_0x1f1405=_0x1f1405-0x0;var _0x330a27=_0x1961[_0x1f1405];return _0x330a27;};'use strict';var Sequelize=require(_0x1196('0x0'));module[_0x1196('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x1196('0x2')]('html','script')},'description':{'type':Sequelize[_0x1196('0x3')]},'version':{'type':Sequelize[_0x1196('0x3')]},'path':{'type':Sequelize[_0x1196('0x4')],'comment':_0x1196('0x5')},'active':{'type':Sequelize[_0x1196('0x6')],'defaultValue':0x0,'comment':_0x1196('0x7')},'sidebar':{'type':Sequelize[_0x1196('0x2')](_0x1196('0x8'),_0x1196('0x9'),_0x1196('0xa'),_0x1196('0xb')),'defaultValue':_0x1196('0xa'),'comment':_0x1196('0xc')},'icon':{'type':Sequelize[_0x1196('0x4')]},'adminUrl':{'type':Sequelize[_0x1196('0x4')]},'agentUrl':{'type':Sequelize[_0x1196('0x4')]},'scriptName':{'type':Sequelize[_0x1196('0x4')]},'scriptPath':{'type':Sequelize[_0x1196('0x4')]}}; \ No newline at end of file +var _0x0183=['script','TEXT','ENUM','adminOnly','never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING'];(function(_0x3da7c2,_0x5c0ec3){var _0x4eb160=function(_0x583c71){while(--_0x583c71){_0x3da7c2['push'](_0x3da7c2['shift']());}};_0x4eb160(++_0x5c0ec3);}(_0x0183,0x197));var _0x3018=function(_0x12da50,_0x4eab81){_0x12da50=_0x12da50-0x0;var _0x4159b0=_0x0183[_0x12da50];return _0x4159b0;};'use strict';var Sequelize=require(_0x3018('0x0'));module[_0x3018('0x1')]={'name':{'type':Sequelize[_0x3018('0x2')]},'type':{'type':Sequelize['ENUM']('html',_0x3018('0x3'))},'description':{'type':Sequelize[_0x3018('0x4')]},'version':{'type':Sequelize[_0x3018('0x4')]},'path':{'type':Sequelize[_0x3018('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x3018('0x5')](_0x3018('0x6'),'agentOnly','always',_0x3018('0x7')),'defaultValue':_0x3018('0x8'),'comment':_0x3018('0x9')},'icon':{'type':Sequelize[_0x3018('0x2')]},'adminUrl':{'type':Sequelize[_0x3018('0x2')]},'agentUrl':{'type':Sequelize[_0x3018('0x2')]},'scriptName':{'type':Sequelize[_0x3018('0x2')]},'scriptPath':{'type':Sequelize[_0x3018('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 94231a8..af5d9db 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 _0x19af=['socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','keys','includeAll','find','root','server/files/plugins','format','%s.zip','basename','createWriteStream','warning','code','ENOENT','Error','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','join','dirname','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found','download','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','Invalid\x20manifest:\x20views\x20missing','views','agent','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','html','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Plugins','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','statusCode','webhookPost','hostname','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','localhost'];(function(_0x3662db,_0x3c33cd){var _0x1b9792=function(_0x45a22d){while(--_0x45a22d){_0x3662db['push'](_0x3662db['shift']());}};_0x1b9792(++_0x3c33cd);}(_0x19af,0x14e));var _0xf19a=function(_0x5a2697,_0x12dc85){_0x5a2697=_0x5a2697-0x0;var _0x1d800b=_0x19af[_0x5a2697];return _0x1d800b;};'use strict';var emlformat=require(_0xf19a('0x0'));var rimraf=require(_0xf19a('0x1'));var zipdir=require(_0xf19a('0x2'));var jsonpatch=require(_0xf19a('0x3'));var rp=require(_0xf19a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf19a('0x5'));var util=require(_0xf19a('0x6'));var path=require(_0xf19a('0x7'));var sox=require(_0xf19a('0x8'));var csv=require(_0xf19a('0x9'));var ejs=require(_0xf19a('0xa'));var fs=require('fs');var fs_extra=require(_0xf19a('0xb'));var _=require(_0xf19a('0xc'));var squel=require(_0xf19a('0xd'));var crypto=require(_0xf19a('0xe'));var jsforce=require(_0xf19a('0xf'));var deskjs=require(_0xf19a('0x10'));var toCsv=require('to-csv');var querystring=require(_0xf19a('0x11'));var Papa=require('papaparse');var extract=require(_0xf19a('0x12'));var rimraf=require(_0xf19a('0x1'));var archiver=require(_0xf19a('0x13'));var Redis=require(_0xf19a('0x14'));var authService=require(_0xf19a('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xf19a('0x16'));var hardwareService=require(_0xf19a('0x17'));var logger=require('../../config/logger')(_0xf19a('0x18'));var utils=require('../../config/utils');var config=require(_0xf19a('0x19'));var licenseUtil=require(_0xf19a('0x1a'));var db=require('../../mysqldb')['db'];config[_0xf19a('0x1b')]=_[_0xf19a('0x1c')](config['redis'],{'host':_0xf19a('0x1d'),'port':0x18eb});var socket=require(_0xf19a('0x1e'))(new Redis(config[_0xf19a('0x1b')]));require(_0xf19a('0x1f'))[_0xf19a('0x20')](socket);function respondWithStatusCode(_0x50d81b,_0x3cb1ba){_0x3cb1ba=_0x3cb1ba||0xcc;return function(_0x219850){if(_0x219850){return _0x50d81b[_0xf19a('0x21')](_0x3cb1ba);}return _0x50d81b[_0xf19a('0x22')](_0x3cb1ba)[_0xf19a('0x23')]();};}function respondWithResult(_0x58c3a7,_0x5800e6){_0x5800e6=_0x5800e6||0xc8;return function(_0x5d072c){if(_0x5d072c){return _0x58c3a7['status'](_0x5800e6)[_0xf19a('0x24')](_0x5d072c);}};}function respondWithFilteredResult(_0x3b5888,_0x5f58f2){return function(_0x155d4e){if(_0x155d4e){var _0x1e5ac5=typeof _0x5f58f2['offset']===_0xf19a('0x25')&&typeof _0x5f58f2[_0xf19a('0x26')]===_0xf19a('0x25');var _0x18f542=_0x155d4e[_0xf19a('0x27')];var _0x37f80b=_0x1e5ac5?0x0:_0x5f58f2[_0xf19a('0x28')];var _0x27f396=_0x1e5ac5?_0x155d4e[_0xf19a('0x27')]:_0x5f58f2[_0xf19a('0x28')]+_0x5f58f2['limit'];var _0x3eac2d;if(_0x27f396>=_0x18f542){_0x27f396=_0x18f542;_0x3eac2d=0xc8;}else{_0x3eac2d=0xce;}_0x3b5888['status'](_0x3eac2d);return _0x3b5888['set']('Content-Range',_0x37f80b+'-'+_0x27f396+'/'+_0x18f542)[_0xf19a('0x24')](_0x155d4e);}return null;};}function patchUpdates(_0x262e9c){return function(_0x17c9a6){try{jsonpatch[_0xf19a('0x29')](_0x17c9a6,_0x262e9c,!![]);}catch(_0xf2bedf){return BPromise[_0xf19a('0x2a')](_0xf2bedf);}return _0x17c9a6[_0xf19a('0x2b')]();};}function saveUpdates(_0x539d07,_0x365bd4){return function(_0x1be7c2){if(_0x1be7c2){return _0x1be7c2[_0xf19a('0x2c')](_0x539d07)['then'](function(_0x5b5cb5){return _0x5b5cb5;});}return null;};}function removeEntity(_0x8abfda,_0x1b8de9){return function(_0x3ae2c5){if(_0x3ae2c5){return _0x3ae2c5[_0xf19a('0x2d')]()[_0xf19a('0x2e')](function(){var _0x9e6079=_0x3ae2c5[_0xf19a('0x2f')]({'plain':!![]});var _0x35af1f='Plugins';return db[_0xf19a('0x30')][_0xf19a('0x2d')]({'where':{'type':_0x35af1f,'resourceId':_0x9e6079['id']}})[_0xf19a('0x2e')](function(){return _0x3ae2c5;});})[_0xf19a('0x2e')](function(){_0x8abfda[_0xf19a('0x22')](0xcc)[_0xf19a('0x23')]();});}};}function handleEntityNotFound(_0x118bcc,_0x5c3f3b){return function(_0x38111d){if(!_0x38111d){_0x118bcc[_0xf19a('0x21')](0x194);}return _0x38111d;};}function handleError(_0x49f53a,_0x28b60d){_0x28b60d=_0x28b60d||0x1f4;return function(_0x2188be){logger[_0xf19a('0x31')](_0x2188be[_0xf19a('0x32')]);if(_0x2188be[_0xf19a('0x33')]){delete _0x2188be['name'];}_0x49f53a[_0xf19a('0x22')](_0x28b60d)[_0xf19a('0x34')](_0x2188be);};}exports[_0xf19a('0x35')]=function(_0xc00bd9,_0x2d839a){var _0x3ed6f2={},_0x49e6ce={},_0x43542b={'count':0x0,'rows':[]};var _0x2910fa=_[_0xf19a('0x36')](db[_0xf19a('0x37')][_0xf19a('0x38')],function(_0x539853){return{'name':_0x539853[_0xf19a('0x39')],'type':_0x539853[_0xf19a('0x3a')][_0xf19a('0x3b')]};});_0x49e6ce[_0xf19a('0x3c')]=_[_0xf19a('0x36')](_0x2910fa,_0xf19a('0x33'));_0x49e6ce[_0xf19a('0x3d')]=_['keys'](_0xc00bd9[_0xf19a('0x3d')]);_0x49e6ce['filters']=_[_0xf19a('0x3e')](_0x49e6ce['model'],_0x49e6ce[_0xf19a('0x3d')]);_0x3ed6f2[_0xf19a('0x3f')]=_['intersection'](_0x49e6ce[_0xf19a('0x3c')],qs['fields'](_0xc00bd9[_0xf19a('0x3d')][_0xf19a('0x40')]));_0x3ed6f2['attributes']=_0x3ed6f2[_0xf19a('0x3f')][_0xf19a('0x41')]?_0x3ed6f2[_0xf19a('0x3f')]:_0x49e6ce[_0xf19a('0x3c')];if(!_0xc00bd9[_0xf19a('0x3d')][_0xf19a('0x42')](_0xf19a('0x43'))){_0x3ed6f2[_0xf19a('0x26')]=qs['limit'](_0xc00bd9[_0xf19a('0x3d')][_0xf19a('0x26')]);_0x3ed6f2['offset']=qs[_0xf19a('0x28')](_0xc00bd9['query'][_0xf19a('0x28')]);}_0x3ed6f2[_0xf19a('0x44')]=qs['sort'](_0xc00bd9['query'][_0xf19a('0x45')]);_0x3ed6f2[_0xf19a('0x46')]=qs['filters'](_[_0xf19a('0x47')](_0xc00bd9[_0xf19a('0x3d')],_0x49e6ce[_0xf19a('0x48')]),_0x2910fa);if(_0xc00bd9[_0xf19a('0x3d')][_0xf19a('0x49')]){_0x3ed6f2['where']=_[_0xf19a('0x4a')](_0x3ed6f2[_0xf19a('0x46')],{'$or':_[_0xf19a('0x36')](_0x2910fa,function(_0x4e9f8d){if(_0x4e9f8d[_0xf19a('0x3a')]!==_0xf19a('0x4b')){var _0x2fdcf7={};_0x2fdcf7[_0x4e9f8d[_0xf19a('0x33')]]={'$like':'%'+_0xc00bd9[_0xf19a('0x3d')][_0xf19a('0x49')]+'%'};return _0x2fdcf7;}})});}_0x3ed6f2=_['merge']({},_0x3ed6f2,_0xc00bd9[_0xf19a('0x4c')]);var _0x4f5ce9={'where':_0x3ed6f2[_0xf19a('0x46')]};return db[_0xf19a('0x37')][_0xf19a('0x27')](_0x4f5ce9)[_0xf19a('0x2e')](function(_0x1bb31d){_0x43542b['count']=_0x1bb31d;if(_0xc00bd9['query']['includeAll']){_0x3ed6f2[_0xf19a('0x4d')]=[{'all':!![]}];}return db[_0xf19a('0x37')][_0xf19a('0x4e')](_0x3ed6f2);})[_0xf19a('0x2e')](function(_0xc23aef){_0x43542b['rows']=_0xc23aef;return _0x43542b;})[_0xf19a('0x2e')](respondWithFilteredResult(_0x2d839a,_0x3ed6f2))[_0xf19a('0x4f')](handleError(_0x2d839a,null));};exports[_0xf19a('0x50')]=function(_0x545848,_0x7bc059){var _0x33f1ef={'raw':!![],'where':{'id':_0x545848[_0xf19a('0x51')]['id']}},_0x16aa35={};_0x16aa35[_0xf19a('0x3c')]=_[_0xf19a('0x52')](db[_0xf19a('0x37')][_0xf19a('0x38')]);_0x16aa35['query']=_[_0xf19a('0x52')](_0x545848[_0xf19a('0x3d')]);_0x16aa35[_0xf19a('0x48')]=_[_0xf19a('0x3e')](_0x16aa35[_0xf19a('0x3c')],_0x16aa35[_0xf19a('0x3d')]);_0x33f1ef[_0xf19a('0x3f')]=_[_0xf19a('0x3e')](_0x16aa35[_0xf19a('0x3c')],qs[_0xf19a('0x40')](_0x545848[_0xf19a('0x3d')]['fields']));_0x33f1ef[_0xf19a('0x3f')]=_0x33f1ef[_0xf19a('0x3f')][_0xf19a('0x41')]?_0x33f1ef[_0xf19a('0x3f')]:_0x16aa35[_0xf19a('0x3c')];if(_0x545848['query'][_0xf19a('0x53')]){_0x33f1ef[_0xf19a('0x4d')]=[{'all':!![]}];}_0x33f1ef=_[_0xf19a('0x4a')]({},_0x33f1ef,_0x545848[_0xf19a('0x4c')]);return db[_0xf19a('0x37')][_0xf19a('0x54')](_0x33f1ef)[_0xf19a('0x2e')](handleEntityNotFound(_0x7bc059,null))[_0xf19a('0x2e')](respondWithResult(_0x7bc059,null))['catch'](handleError(_0x7bc059,null));};exports['download']=function(_0x26d951,_0x27ef7b,_0x3b77d0){return db['Plugin'][_0xf19a('0x54')]({'where':{'id':_0x26d951['params']['id']},'attributes':[_0xf19a('0x33'),'path'],'raw':!![]})[_0xf19a('0x2e')](handleEntityNotFound(_0x27ef7b,null))['then'](function(_0x29a062){if(_0x29a062){var _0x4d3bee=path['join'](config[_0xf19a('0x55')],_0xf19a('0x56'),util[_0xf19a('0x57')](_0xf19a('0x58'),path[_0xf19a('0x59')](_0x29a062[_0xf19a('0x7')])));var _0xec064f=fs[_0xf19a('0x5a')](_0x4d3bee);var _0x4b8679=archiver('zip',{'zlib':{'level':0x9}});_0x4b8679['on'](_0xf19a('0x5b'),function(_0x78c19c){if(_0x78c19c[_0xf19a('0x5c')]===_0xf19a('0x5d')){logger[_0xf19a('0x31')](_0x78c19c);}else{throw new db['Sequelize'][(_0xf19a('0x5e'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x4b8679['on'](_0xf19a('0x31'),function(_0x176aab){throw new db[(_0xf19a('0x5f'))][(_0xf19a('0x5e'))](_0xf19a('0x60'));});_0x4b8679[_0xf19a('0x61')](_0xec064f);_0x4b8679[_0xf19a('0x62')](_0xf19a('0x63'),{'cwd':path[_0xf19a('0x64')](config['root'],_0xf19a('0x56'),path[_0xf19a('0x65')](_0x29a062[_0xf19a('0x7')])),'ignore':[path[_0xf19a('0x64')](path[_0xf19a('0x59')](_0x29a062[_0xf19a('0x7')]),_0xf19a('0x66')),path['join'](path[_0xf19a('0x59')](_0x29a062['path']),_0xf19a('0x67'))],'nodir':!![]})[_0xf19a('0x68')]();_0xec064f['on'](_0xf19a('0x69'),function(){if(!fs['existsSync'](_0x4d3bee)){throw new db[(_0xf19a('0x5f'))][(_0xf19a('0x5e'))](_0xf19a('0x6a'));}return _0x27ef7b[_0xf19a('0x6b')](_0x4d3bee,util['format'](_0xf19a('0x58'),path[_0xf19a('0x59')](_0x29a062[_0xf19a('0x7')])),function(_0x11b641){if(_0x11b641){throw new db[(_0xf19a('0x5f'))][(_0xf19a('0x5e'))](_0xf19a('0x6c'));}fs[_0xf19a('0x6d')](_0x4d3bee);logger['info'](_0xf19a('0x6e'));logger[_0xf19a('0x6f')](_0xf19a('0x70'));});});}return null;})[_0xf19a('0x4f')](handleError(_0x27ef7b,null));};exports[_0xf19a('0x71')]=function(_0x5b54c0,_0x344139,_0x17a332){var _0x310c82=path[_0xf19a('0x59')](_0x5b54c0[_0xf19a('0x72')][_0xf19a('0x73')],path[_0xf19a('0x74')](_0x5b54c0[_0xf19a('0x72')][_0xf19a('0x73')]));var _0x50d1a6=path[_0xf19a('0x64')](config['root'],_0xf19a('0x56'),_0x5b54c0[_0xf19a('0x72')][_0xf19a('0x73')]);var _0xe5f6a1=path[_0xf19a('0x64')](config[_0xf19a('0x55')],_0xf19a('0x56'),_0x310c82);logger[_0xf19a('0x6f')](_0xf19a('0x75'),_0x50d1a6);logger[_0xf19a('0x6f')](_0xf19a('0x76'),_0xe5f6a1);try{fs[_0xf19a('0x77')](_0x50d1a6,parseInt(_0xf19a('0x78'),0x8));extract(_0x50d1a6,{'dir':_0xe5f6a1},function(_0x361207){if(_0x361207){logger[_0xf19a('0x31')](_0x361207);handleError(_0x361207,!![]);};var _0x18e87e=fs['readdirSync'](_0xe5f6a1);if(_0x18e87e[_0xf19a('0x41')]>0x1){removeReferences(_0x50d1a6,_0xe5f6a1);logger[_0xf19a('0x31')](_0xf19a('0x79'));return _0x17a332(new Error(_0xf19a('0x79')));}var _0x13e20c=fs[_0xf19a('0x7a')](path[_0xf19a('0x64')](_0xe5f6a1,_0x18e87e[0x0]));if(_0x13e20c[_0xf19a('0x7b')]()){removeReferences(_0x50d1a6,_0xe5f6a1);logger[_0xf19a('0x31')]('Invalid\x20plugin\x20structure');return _0x17a332(new Error(_0xf19a('0x79')));}if(_0x13e20c[_0xf19a('0x7c')]()){var _0xa118da=fs['readdirSync'](path[_0xf19a('0x64')](_0xe5f6a1,_0x18e87e[0x0]));if(_0xa118da[_0xf19a('0x41')]===0x0){removeReferences(_0x50d1a6,_0xe5f6a1);logger['error'](_0xf19a('0x79'));return _0x17a332(new Error(_0xf19a('0x79')));}var _0x28e7e7=_0xa118da['some'](function(_0x506f68){return _0x506f68==='manifest.json';});if(!_0x28e7e7){return _0x17a332(new Error(_0xf19a('0x7d')));}var _0x23a54d=fs[_0xf19a('0x7e')](path[_0xf19a('0x64')](_0xe5f6a1,_0x18e87e[0x0],_0xf19a('0x7f')));var _0x279570=JSON[_0xf19a('0x80')](_0x23a54d);if(_0xf19a('0x25')==typeof _0x279570[_0xf19a('0x33')]){return _0x17a332(new Error(_0xf19a('0x81')));}if(_0xf19a('0x25')==typeof _0x279570[_0xf19a('0x3a')]){return _0x17a332(new Error(_0xf19a('0x82')));}if('undefined'==typeof _0x279570[_0xf19a('0x83')]){return _0x17a332(new Error(_0xf19a('0x84')));}if(_0xf19a('0x25')==typeof _0x279570[_0xf19a('0x85')]){return _0x17a332(new Error(_0xf19a('0x86')));}if(_0x279570[_0xf19a('0x3a')]==='html'){if(_0xf19a('0x25')==typeof _0x279570[_0xf19a('0x85')]['views']){return _0x17a332(new Error(_0xf19a('0x87')));}if(_0xf19a('0x25')==typeof _0x279570[_0xf19a('0x85')]['views']['admin']&&_0xf19a('0x25')==typeof _0x279570[_0xf19a('0x85')][_0xf19a('0x88')][_0xf19a('0x89')]){return _0x17a332(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x279570[_0xf19a('0x3a')]===_0xf19a('0x8a')){if(_0xf19a('0x25')==typeof _0x279570[_0xf19a('0x85')]['scriptName']){return _0x17a332(new Error(_0xf19a('0x8b')));}if('undefined'==typeof _0x279570[_0xf19a('0x85')][_0xf19a('0x8c')]){return _0x17a332(new Error(_0xf19a('0x8d')));}}else{return _0x17a332(new Error(_0xf19a('0x8e')));}var _0x42b67b=_0x279570['name'];var _0x57ca2c=_0x279570[_0xf19a('0x8f')];var _0x525854=_0x279570[_0xf19a('0x3a')];var _0x13a934=_0x279570[_0xf19a('0x90')]?_0x279570[_0xf19a('0x90')]:_0xf19a('0x91');var _0x4093b4=_0x279570[_0xf19a('0x92')]?_0x279570[_0xf19a('0x92')]:_0xf19a('0x93');var _0x536ac0='';var _0x4f7746='';var _0x2ff674='';var _0x16f1e3='';var _0x2056f4=_0x279570[_0xf19a('0x83')];if(_0x525854===_0xf19a('0x94')){if('undefined'!=typeof _0x279570['parameters'][_0xf19a('0x88')]['admin']){var _0x18a4e1=_0x279570[_0xf19a('0x85')][_0xf19a('0x88')][_0xf19a('0x95')];if(!/^(f|ht)tps?:\/\//i[_0xf19a('0x96')](_0x18a4e1)){_0x536ac0=path[_0xf19a('0x64')](_0xf19a('0x97'),_0x310c82,_0x18e87e[0x0],_0x18a4e1);}else{_0x536ac0=_0x18a4e1;}}else{logger[_0xf19a('0x6f')](_0xf19a('0x98'));}if(_0xf19a('0x25')!=typeof _0x279570['parameters'][_0xf19a('0x88')][_0xf19a('0x89')]){var _0x5120fb=_0x279570[_0xf19a('0x85')]['views'][_0xf19a('0x89')];if(!/^(f|ht)tps?:\/\//i[_0xf19a('0x96')](_0x5120fb)){_0x4f7746=path[_0xf19a('0x64')](_0xf19a('0x97'),_0x310c82,_0x18e87e[0x0],_0x5120fb);}else{_0x4f7746=_0x5120fb;}}else{logger[_0xf19a('0x6f')](_0xf19a('0x99'));}}else if(_0x525854===_0xf19a('0x8a')){_0x2ff674=_0x279570[_0xf19a('0x85')]['scriptName'];_0x16f1e3=_0x279570['parameters'][_0xf19a('0x8c')];if(_0xf19a('0x25')!=typeof _0x279570[_0xf19a('0x85')]['views']){if(_0xf19a('0x25')!=typeof _0x279570[_0xf19a('0x85')][_0xf19a('0x88')][_0xf19a('0x95')]){var _0x18a4e1=_0x279570[_0xf19a('0x85')][_0xf19a('0x88')][_0xf19a('0x95')];if(!/^(f|ht)tps?:\/\//i['test'](_0x18a4e1)){_0x536ac0=path[_0xf19a('0x64')](_0xf19a('0x97'),_0x310c82,_0x18e87e[0x0],_0x18a4e1);}else{_0x536ac0=_0x18a4e1;}}if('undefined'!=typeof _0x279570[_0xf19a('0x85')]['views'][_0xf19a('0x89')]){var _0x5120fb=_0x279570[_0xf19a('0x85')][_0xf19a('0x88')][_0xf19a('0x89')];if(!/^(f|ht)tps?:\/\//i['test'](_0x5120fb)){_0x4f7746=path[_0xf19a('0x64')](_0xf19a('0x97'),_0x310c82,_0x18e87e[0x0],_0x5120fb);}else{_0x4f7746=_0x5120fb;}}}}var _0x544780={'name':_0x42b67b,'description':_0x57ca2c,'path':path[_0xf19a('0x64')](_0x310c82,_0x18e87e[0x0]),'type':_0x525854,'sidebar':_0x13a934,'icon':_0x4093b4,'adminUrl':_0x536ac0,'agentUrl':_0x4f7746,'scriptName':_0x2ff674,'scriptPath':_0x16f1e3,'version':_0x2056f4};removeReferences(_0x50d1a6,null);return db['Plugin']['create'](_0x544780)[_0xf19a('0x2e')](function(_0x24f0a1){var _0x2c9338={'role':_0x5b54c0[_0xf19a('0x9a')]['role'],'userProfileId':_0x5b54c0[_0xf19a('0x9a')][_0xf19a('0x9b')]};if(!_0x2c9338)throw new Error(_0xf19a('0x9c'));if(_0x2c9338[_0xf19a('0x9d')]===_0xf19a('0x9e')){var _0x5624dc=_0x24f0a1[_0xf19a('0x2f')]({'plain':!![]});return db[_0xf19a('0x9f')][_0xf19a('0x54')]({'where':{'name':_0xf19a('0xa0'),'userProfileId':_0x2c9338[_0xf19a('0x9b')]},'raw':!![]})[_0xf19a('0x2e')](function(_0x1654a4){if(_0x1654a4&&_0x1654a4[_0xf19a('0xa1')]===0x0){return db[_0xf19a('0x30')][_0xf19a('0xa2')]({'name':_0x5624dc[_0xf19a('0x33')],'resourceId':_0x5624dc['id'],'type':_0x1654a4[_0xf19a('0x33')],'sectionId':_0x1654a4['id']},{})[_0xf19a('0x2e')](function(){return _0x24f0a1;});}else{return _0x24f0a1;}})[_0xf19a('0x4f')](function(_0x18b867){logger[_0xf19a('0x31')](_0xf19a('0xa3'),_0x18b867);throw _0x18b867;});}return _0x24f0a1;})[_0xf19a('0x2e')](respondWithResult(_0x344139,null))[_0xf19a('0x4f')](handleError(_0x344139,null));}});}catch(_0x20558d){_0x344139[_0xf19a('0x22')](0x1f4)[_0xf19a('0x34')](_0x20558d);}};function removeReferences(_0x55a631,_0x3f73b5){try{if(_0x55a631){fs[_0xf19a('0x6d')](_0x55a631);logger['info'](_0xf19a('0xa4'));}if(_0x3f73b5){rimraf(_0x3f73b5,function(){});logger['info']('Extracted\x20folder\x20removed');}}catch(_0x3a9074){logger[_0xf19a('0x31')](_0x3a9074);}}exports[_0xf19a('0x2c')]=function(_0x2760a5,_0x18352b,_0x424c27){return db['Plugin'][_0xf19a('0x54')]({'where':{'id':_0x2760a5[_0xf19a('0x51')]['id']}})[_0xf19a('0x2e')](handleEntityNotFound(_0x18352b,null))['then'](saveUpdates(_0x2760a5[_0xf19a('0x9a')],null))[_0xf19a('0x2e')](respondWithResult(_0x18352b,null))[_0xf19a('0x4f')](handleError(_0x18352b,null));};exports[_0xf19a('0xa5')]=function(_0x25e247,_0x30b5d9,_0x101d38){return db[_0xf19a('0x37')]['find']({'where':{'id':_0x25e247[_0xf19a('0x51')]['id']}})[_0xf19a('0x2e')](function(_0x3de0b7){if(_0x3de0b7){return _0x3de0b7[_0xf19a('0x2d')]();}})[_0xf19a('0x2e')](function(_0x292eb4){rimraf(path[_0xf19a('0x64')](config['root'],_0xf19a('0x56'),path[_0xf19a('0x65')](_0x292eb4[_0xf19a('0x7')])),function(){});return _0x292eb4;})['then'](handleEntityNotFound(_0x30b5d9,null))[_0xf19a('0x2e')](respondWithStatusCode(_0x30b5d9,null))[_0xf19a('0x4f')](handleError(_0x30b5d9,null));};exports[_0xf19a('0xa6')]=function(_0xe37e08,_0x405fba,_0xe93a07){return BPromise[_0xf19a('0xa7')]()['then'](function(){if(!_0xe37e08[_0xf19a('0x3d')][_0xf19a('0x7')]){throw new Error(_0xf19a('0xa8'));}if(!_0xe37e08[_0xf19a('0x3d')][_0xf19a('0xa9')]){throw new Error(_0xf19a('0xaa'));}var _0x56eeb5=_0xe37e08['query']['hostname']?_0xe37e08[_0xf19a('0x3d')]['hostname']+':'+_0xe37e08[_0xf19a('0x3d')][_0xf19a('0xa9')]:_0xf19a('0xab')+_0xe37e08[_0xf19a('0x3d')][_0xf19a('0xa9')];var _0x2ef275=_0xe37e08[_0xf19a('0x3d')][_0xf19a('0x24')]?_0xe37e08[_0xf19a('0x3d')]['json']:!![];var _0x1066d8=_0xe37e08[_0xf19a('0x3d')]['encoding']?_0xe37e08['query'][_0xf19a('0xac')]:null;var _0x1a2d4d={'method':_0xe37e08[_0xf19a('0xad')],'uri':util['format'](_0xf19a('0xae'),_0x56eeb5,_0xe37e08[_0xf19a('0x3d')][_0xf19a('0x7')]),'json':_0x2ef275,'resolveWithFullResponse':!![],'encoding':_0x1066d8,'qs':_0xe37e08[_0xf19a('0x3d')]};if(_0xe37e08[_0xf19a('0xaf')]){_0x1a2d4d[_0xf19a('0xaf')]=_0xe37e08[_0xf19a('0xaf')];if(_0x1a2d4d[_0xf19a('0xaf')][_0xf19a('0xb0')]){delete _0x1a2d4d[_0xf19a('0xaf')][_0xf19a('0xb0')];}}if(_0x1a2d4d[_0xf19a('0xaf')][_0xf19a('0xb1')]){delete _0x1a2d4d['headers'][_0xf19a('0xb1')];}return rp(_0x1a2d4d);})[_0xf19a('0x2e')](function(_0x464716){if(_0x464716){_0x405fba[_0xf19a('0xb2')](_0x464716[_0xf19a('0xaf')]);logger[_0xf19a('0x6f')](_0x464716[_0xf19a('0x9a')]);if(_['endsWith'](_0xe37e08[_0xf19a('0x3d')]['path'],_0xf19a('0x6b'))&&_0x464716[_0xf19a('0xb3')]==0x1f4){return _0x405fba[_0xf19a('0x21')](_0x464716[_0xf19a('0xb3')]);}else{return _0x405fba['status'](_0x464716['statusCode'])[_0xf19a('0x34')](_0x464716[_0xf19a('0x9a')]);}}else{return _0x405fba[_0xf19a('0x21')](0xc8);}})[_0xf19a('0x4f')](handleError(_0x405fba,null));};exports[_0xf19a('0xb4')]=function(_0x4797e2,_0x4d8b51,_0x3d7c3d){return BPromise[_0xf19a('0xa7')]()[_0xf19a('0x2e')](function(){if(!_0x4797e2[_0xf19a('0x3d')][_0xf19a('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x4797e2['query'][_0xf19a('0xa9')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x4666db=_0x4797e2[_0xf19a('0x3d')][_0xf19a('0xb5')]?_0x4797e2[_0xf19a('0x3d')][_0xf19a('0xb5')]+':'+_0x4797e2[_0xf19a('0x3d')][_0xf19a('0xa9')]:_0xf19a('0xab')+_0x4797e2[_0xf19a('0x3d')]['port'];var _0x3f1ae6=_0x4797e2[_0xf19a('0x3d')][_0xf19a('0x24')]?_0x4797e2[_0xf19a('0x3d')][_0xf19a('0x24')]:!![];var _0x3a8433=_0x4797e2[_0xf19a('0x3d')][_0xf19a('0xac')]?_0x4797e2[_0xf19a('0x3d')][_0xf19a('0xac')]:null;var _0x53fefe={'method':_0x4797e2['method'],'uri':util[_0xf19a('0x57')](_0xf19a('0xae'),_0x4666db,_0x4797e2[_0xf19a('0x3d')][_0xf19a('0x7')]),'json':_0x3f1ae6,'resolveWithFullResponse':!![],'encoding':_0x3a8433,'body':_0x4797e2[_0xf19a('0x9a')]};if(_0x4797e2[_0xf19a('0xaf')]){_0x53fefe['headers']=_0x4797e2[_0xf19a('0xaf')];if(_0x53fefe[_0xf19a('0xaf')]['content-length']){delete _0x53fefe[_0xf19a('0xaf')]['content-length'];}}if(_0x53fefe[_0xf19a('0xaf')][_0xf19a('0xb1')]){delete _0x53fefe[_0xf19a('0xaf')]['content-type'];}return rp(_0x53fefe);})[_0xf19a('0x2e')](function(_0x1965ff){if(_0x1965ff){_0x4d8b51['set'](_0x1965ff['headers']);logger['info'](_0x1965ff['body']);return _0x4d8b51[_0xf19a('0x22')](_0x1965ff['statusCode'])[_0xf19a('0x34')](_0x1965ff[_0xf19a('0x9a')]);}else{return _0x4d8b51[_0xf19a('0x21')](0xc8);}})[_0xf19a('0x4f')](handleError(_0x4d8b51,null));}; \ No newline at end of file +var _0xc84b=['extname','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','some','manifest.json','readFileSync','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','admin','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Plugins','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','headers','content-type','endsWith','sendStatus','statusCode','method','%s%s','content-length','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','Plugin','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','VIRTUAL','options','rows','catch','params','includeAll','include','find','join','root','%s.zip','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','server/files/plugins','dirname','basename','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','download','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','upload','file','filename'];(function(_0x34d068,_0x17a58c){var _0x24e72d=function(_0x46a458){while(--_0x46a458){_0x34d068['push'](_0x34d068['shift']());}};_0x24e72d(++_0x17a58c);}(_0xc84b,0xe9));var _0xbc84=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0xc84b[_0x486f4a];return _0x135d99;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbc84('0x0'));var zipdir=require(_0xbc84('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbc84('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbc84('0x3'));var util=require(_0xbc84('0x4'));var path=require(_0xbc84('0x5'));var sox=require(_0xbc84('0x6'));var csv=require(_0xbc84('0x7'));var ejs=require(_0xbc84('0x8'));var fs=require('fs');var fs_extra=require(_0xbc84('0x9'));var _=require(_0xbc84('0xa'));var squel=require('squel');var crypto=require(_0xbc84('0xb'));var jsforce=require(_0xbc84('0xc'));var deskjs=require(_0xbc84('0xd'));var toCsv=require(_0xbc84('0x7'));var querystring=require('querystring');var Papa=require(_0xbc84('0xe'));var extract=require(_0xbc84('0xf'));var rimraf=require(_0xbc84('0x0'));var archiver=require(_0xbc84('0x10'));var Redis=require(_0xbc84('0x11'));var authService=require(_0xbc84('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xbc84('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbc84('0x14'));var utils=require(_0xbc84('0x15'));var config=require(_0xbc84('0x16'));var licenseUtil=require(_0xbc84('0x17'));var db=require(_0xbc84('0x18'))['db'];config[_0xbc84('0x19')]=_[_0xbc84('0x1a')](config[_0xbc84('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xbc84('0x1b'))(new Redis(config['redis']));require('./plugin.socket')[_0xbc84('0x1c')](socket);function respondWithStatusCode(_0x230340,_0x436520){_0x436520=_0x436520||0xcc;return function(_0x1775f4){if(_0x1775f4){return _0x230340['sendStatus'](_0x436520);}return _0x230340[_0xbc84('0x1d')](_0x436520)[_0xbc84('0x1e')]();};}function respondWithResult(_0x1497af,_0x351bfb){_0x351bfb=_0x351bfb||0xc8;return function(_0x519cbd){if(_0x519cbd){return _0x1497af[_0xbc84('0x1d')](_0x351bfb)[_0xbc84('0x1f')](_0x519cbd);}};}function respondWithFilteredResult(_0x34a1cd,_0x3a5006){return function(_0x3f3724){if(_0x3f3724){var _0x4879ad=typeof _0x3a5006[_0xbc84('0x20')]==='undefined'&&typeof _0x3a5006[_0xbc84('0x21')]==='undefined';var _0x227151=_0x3f3724[_0xbc84('0x22')];var _0x4a3f87=_0x4879ad?0x0:_0x3a5006[_0xbc84('0x20')];var _0x15d360=_0x4879ad?_0x3f3724[_0xbc84('0x22')]:_0x3a5006[_0xbc84('0x20')]+_0x3a5006[_0xbc84('0x21')];var _0x51b307;if(_0x15d360>=_0x227151){_0x15d360=_0x227151;_0x51b307=0xc8;}else{_0x51b307=0xce;}_0x34a1cd[_0xbc84('0x1d')](_0x51b307);return _0x34a1cd[_0xbc84('0x23')](_0xbc84('0x24'),_0x4a3f87+'-'+_0x15d360+'/'+_0x227151)[_0xbc84('0x1f')](_0x3f3724);}return null;};}function patchUpdates(_0x37bd43){return function(_0x137b6b){try{jsonpatch[_0xbc84('0x25')](_0x137b6b,_0x37bd43,!![]);}catch(_0x13da44){return BPromise[_0xbc84('0x26')](_0x13da44);}return _0x137b6b[_0xbc84('0x27')]();};}function saveUpdates(_0x3b0dc3,_0x5cfa63){return function(_0x500c40){if(_0x500c40){return _0x500c40[_0xbc84('0x28')](_0x3b0dc3)[_0xbc84('0x29')](function(_0x48c2db){return _0x48c2db;});}return null;};}function removeEntity(_0x3ebe61,_0xad29eb){return function(_0x4cf233){if(_0x4cf233){return _0x4cf233[_0xbc84('0x2a')]()[_0xbc84('0x29')](function(){var _0xa07a85=_0x4cf233[_0xbc84('0x2b')]({'plain':!![]});var _0x4b168d='Plugins';return db[_0xbc84('0x2c')][_0xbc84('0x2a')]({'where':{'type':_0x4b168d,'resourceId':_0xa07a85['id']}})['then'](function(){return _0x4cf233;});})[_0xbc84('0x29')](function(){_0x3ebe61[_0xbc84('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1972d7,_0x8b3a0e){return function(_0x3de431){if(!_0x3de431){_0x1972d7['sendStatus'](0x194);}return _0x3de431;};}function handleError(_0x17e133,_0x400828){_0x400828=_0x400828||0x1f4;return function(_0x2479f0){logger[_0xbc84('0x2d')](_0x2479f0[_0xbc84('0x2e')]);if(_0x2479f0[_0xbc84('0x2f')]){delete _0x2479f0[_0xbc84('0x2f')];}_0x17e133[_0xbc84('0x1d')](_0x400828)[_0xbc84('0x30')](_0x2479f0);};}exports[_0xbc84('0x31')]=function(_0x19094a,_0x3cc85e){var _0x26cd2e={},_0x919c30={},_0x1a8eb5={'count':0x0,'rows':[]};var _0x241ea0=_['map'](db[_0xbc84('0x32')][_0xbc84('0x33')],function(_0x5b165c){return{'name':_0x5b165c[_0xbc84('0x34')],'type':_0x5b165c['type'][_0xbc84('0x35')]};});_0x919c30[_0xbc84('0x36')]=_['map'](_0x241ea0,_0xbc84('0x2f'));_0x919c30['query']=_[_0xbc84('0x37')](_0x19094a[_0xbc84('0x38')]);_0x919c30[_0xbc84('0x39')]=_[_0xbc84('0x3a')](_0x919c30[_0xbc84('0x36')],_0x919c30[_0xbc84('0x38')]);_0x26cd2e[_0xbc84('0x3b')]=_[_0xbc84('0x3a')](_0x919c30[_0xbc84('0x36')],qs[_0xbc84('0x3c')](_0x19094a[_0xbc84('0x38')][_0xbc84('0x3c')]));_0x26cd2e[_0xbc84('0x3b')]=_0x26cd2e[_0xbc84('0x3b')][_0xbc84('0x3d')]?_0x26cd2e[_0xbc84('0x3b')]:_0x919c30[_0xbc84('0x36')];if(!_0x19094a['query'][_0xbc84('0x3e')](_0xbc84('0x3f'))){_0x26cd2e[_0xbc84('0x21')]=qs[_0xbc84('0x21')](_0x19094a[_0xbc84('0x38')][_0xbc84('0x21')]);_0x26cd2e[_0xbc84('0x20')]=qs[_0xbc84('0x20')](_0x19094a[_0xbc84('0x38')][_0xbc84('0x20')]);}_0x26cd2e[_0xbc84('0x40')]=qs[_0xbc84('0x41')](_0x19094a[_0xbc84('0x38')][_0xbc84('0x41')]);_0x26cd2e[_0xbc84('0x42')]=qs[_0xbc84('0x39')](_[_0xbc84('0x43')](_0x19094a['query'],_0x919c30[_0xbc84('0x39')]),_0x241ea0);if(_0x19094a['query']['filter']){_0x26cd2e['where']=_[_0xbc84('0x44')](_0x26cd2e['where'],{'$or':_[_0xbc84('0x45')](_0x241ea0,function(_0x28be47){if(_0x28be47[_0xbc84('0x46')]!==_0xbc84('0x47')){var _0x28171d={};_0x28171d[_0x28be47['name']]={'$like':'%'+_0x19094a['query']['filter']+'%'};return _0x28171d;}})});}_0x26cd2e=_[_0xbc84('0x44')]({},_0x26cd2e,_0x19094a[_0xbc84('0x48')]);var _0x120851={'where':_0x26cd2e['where']};return db[_0xbc84('0x32')]['count'](_0x120851)['then'](function(_0x29e243){_0x1a8eb5['count']=_0x29e243;if(_0x19094a[_0xbc84('0x38')]['includeAll']){_0x26cd2e['include']=[{'all':!![]}];}return db[_0xbc84('0x32')]['findAll'](_0x26cd2e);})[_0xbc84('0x29')](function(_0x2eae8a){_0x1a8eb5[_0xbc84('0x49')]=_0x2eae8a;return _0x1a8eb5;})[_0xbc84('0x29')](respondWithFilteredResult(_0x3cc85e,_0x26cd2e))[_0xbc84('0x4a')](handleError(_0x3cc85e,null));};exports['show']=function(_0x1235a8,_0x12c36d){var _0x5f2f6a={'raw':!![],'where':{'id':_0x1235a8[_0xbc84('0x4b')]['id']}},_0x1c213d={};_0x1c213d[_0xbc84('0x36')]=_['keys'](db[_0xbc84('0x32')][_0xbc84('0x33')]);_0x1c213d[_0xbc84('0x38')]=_[_0xbc84('0x37')](_0x1235a8[_0xbc84('0x38')]);_0x1c213d[_0xbc84('0x39')]=_[_0xbc84('0x3a')](_0x1c213d[_0xbc84('0x36')],_0x1c213d[_0xbc84('0x38')]);_0x5f2f6a['attributes']=_[_0xbc84('0x3a')](_0x1c213d[_0xbc84('0x36')],qs['fields'](_0x1235a8[_0xbc84('0x38')][_0xbc84('0x3c')]));_0x5f2f6a[_0xbc84('0x3b')]=_0x5f2f6a[_0xbc84('0x3b')]['length']?_0x5f2f6a[_0xbc84('0x3b')]:_0x1c213d[_0xbc84('0x36')];if(_0x1235a8[_0xbc84('0x38')][_0xbc84('0x4c')]){_0x5f2f6a[_0xbc84('0x4d')]=[{'all':!![]}];}_0x5f2f6a=_[_0xbc84('0x44')]({},_0x5f2f6a,_0x1235a8['options']);return db[_0xbc84('0x32')][_0xbc84('0x4e')](_0x5f2f6a)[_0xbc84('0x29')](handleEntityNotFound(_0x12c36d,null))[_0xbc84('0x29')](respondWithResult(_0x12c36d,null))[_0xbc84('0x4a')](handleError(_0x12c36d,null));};exports['download']=function(_0x45efbd,_0x39cf30,_0x41d56f){return db['Plugin'][_0xbc84('0x4e')]({'where':{'id':_0x45efbd['params']['id']},'attributes':[_0xbc84('0x2f'),_0xbc84('0x5')],'raw':!![]})[_0xbc84('0x29')](handleEntityNotFound(_0x39cf30,null))[_0xbc84('0x29')](function(_0x4853ec){if(_0x4853ec){var _0x53f89a=path[_0xbc84('0x4f')](config[_0xbc84('0x50')],'server/files/plugins',util['format'](_0xbc84('0x51'),path['basename'](_0x4853ec[_0xbc84('0x5')])));var _0x216214=fs[_0xbc84('0x52')](_0x53f89a);var _0x5b3bcd=archiver(_0xbc84('0x53'),{'zlib':{'level':0x9}});_0x5b3bcd['on'](_0xbc84('0x54'),function(_0x5267ff){if(_0x5267ff[_0xbc84('0x55')]===_0xbc84('0x56')){logger[_0xbc84('0x2d')](_0x5267ff);}else{throw new db[(_0xbc84('0x57'))][(_0xbc84('0x58'))](_0xbc84('0x59'));}});_0x5b3bcd['on'](_0xbc84('0x2d'),function(_0x324dab){throw new db[(_0xbc84('0x57'))]['Error'](_0xbc84('0x59'));});_0x5b3bcd['pipe'](_0x216214);_0x5b3bcd[_0xbc84('0x5a')](_0xbc84('0x5b'),{'cwd':path[_0xbc84('0x4f')](config[_0xbc84('0x50')],_0xbc84('0x5c'),path[_0xbc84('0x5d')](_0x4853ec[_0xbc84('0x5')])),'ignore':[path[_0xbc84('0x4f')](path[_0xbc84('0x5e')](_0x4853ec[_0xbc84('0x5')]),_0xbc84('0x5f')),path[_0xbc84('0x4f')](path[_0xbc84('0x5e')](_0x4853ec['path']),_0xbc84('0x60'))],'nodir':!![]})[_0xbc84('0x61')]();_0x216214['on']('close',function(){if(!fs[_0xbc84('0x62')](_0x53f89a)){throw new db[(_0xbc84('0x57'))][(_0xbc84('0x58'))](_0xbc84('0x63'));}return _0x39cf30[_0xbc84('0x64')](_0x53f89a,util[_0xbc84('0x65')](_0xbc84('0x51'),path[_0xbc84('0x5e')](_0x4853ec[_0xbc84('0x5')])),function(_0x364488){if(_0x364488){throw new db[(_0xbc84('0x57'))][(_0xbc84('0x58'))](_0xbc84('0x66'));}fs[_0xbc84('0x67')](_0x53f89a);logger[_0xbc84('0x68')](_0xbc84('0x69'));logger['info']('Temporary\x20file\x20removed');});});}return null;})['catch'](handleError(_0x39cf30,null));};exports[_0xbc84('0x6a')]=function(_0x4c7eaf,_0x473753,_0x7410df){var _0x1c417a=path[_0xbc84('0x5e')](_0x4c7eaf[_0xbc84('0x6b')][_0xbc84('0x6c')],path[_0xbc84('0x6d')](_0x4c7eaf[_0xbc84('0x6b')][_0xbc84('0x6c')]));var _0x1a70d6=path[_0xbc84('0x4f')](config[_0xbc84('0x50')],'server/files/plugins',_0x4c7eaf[_0xbc84('0x6b')][_0xbc84('0x6c')]);var _0x56ecfa=path[_0xbc84('0x4f')](config[_0xbc84('0x50')],'server/files/plugins',_0x1c417a);logger[_0xbc84('0x68')](_0xbc84('0x6e'),_0x1a70d6);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x56ecfa);try{fs[_0xbc84('0x6f')](_0x1a70d6,parseInt(_0xbc84('0x70'),0x8));extract(_0x1a70d6,{'dir':_0x56ecfa},function(_0x21f2e5){if(_0x21f2e5){logger['error'](_0x21f2e5);handleError(_0x21f2e5,!![]);};var _0x2930c8=fs[_0xbc84('0x71')](_0x56ecfa);if(_0x2930c8[_0xbc84('0x3d')]>0x1){removeReferences(_0x1a70d6,_0x56ecfa);logger[_0xbc84('0x2d')](_0xbc84('0x72'));return _0x7410df(new Error(_0xbc84('0x72')));}var _0x49a7ce=fs[_0xbc84('0x73')](path[_0xbc84('0x4f')](_0x56ecfa,_0x2930c8[0x0]));if(_0x49a7ce[_0xbc84('0x74')]()){removeReferences(_0x1a70d6,_0x56ecfa);logger['error'](_0xbc84('0x72'));return _0x7410df(new Error('Invalid\x20plugin\x20structure'));}if(_0x49a7ce['isDirectory']()){var _0x115901=fs['readdirSync'](path[_0xbc84('0x4f')](_0x56ecfa,_0x2930c8[0x0]));if(_0x115901[_0xbc84('0x3d')]===0x0){removeReferences(_0x1a70d6,_0x56ecfa);logger[_0xbc84('0x2d')](_0xbc84('0x72'));return _0x7410df(new Error(_0xbc84('0x72')));}var _0x5b6047=_0x115901[_0xbc84('0x75')](function(_0x169924){return _0x169924===_0xbc84('0x76');});if(!_0x5b6047){return _0x7410df(new Error('Plugin\x20manifest\x20missing'));}var _0xf6dffc=fs[_0xbc84('0x77')](path[_0xbc84('0x4f')](_0x56ecfa,_0x2930c8[0x0],'manifest.json'));var _0x1fbb31=JSON['parse'](_0xf6dffc);if(_0xbc84('0x78')==typeof _0x1fbb31[_0xbc84('0x2f')]){return _0x7410df(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xbc84('0x78')==typeof _0x1fbb31['type']){return _0x7410df(new Error(_0xbc84('0x79')));}if(_0xbc84('0x78')==typeof _0x1fbb31[_0xbc84('0x7a')]){return _0x7410df(new Error(_0xbc84('0x7b')));}if(_0xbc84('0x78')==typeof _0x1fbb31[_0xbc84('0x7c')]){return _0x7410df(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x1fbb31[_0xbc84('0x46')]===_0xbc84('0x7d')){if('undefined'==typeof _0x1fbb31[_0xbc84('0x7c')]['views']){return _0x7410df(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x1fbb31[_0xbc84('0x7c')][_0xbc84('0x7e')]['admin']&&'undefined'==typeof _0x1fbb31[_0xbc84('0x7c')][_0xbc84('0x7e')][_0xbc84('0x7f')]){return _0x7410df(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x1fbb31['type']===_0xbc84('0x80')){if('undefined'==typeof _0x1fbb31['parameters'][_0xbc84('0x81')]){return _0x7410df(new Error(_0xbc84('0x82')));}if(_0xbc84('0x78')==typeof _0x1fbb31[_0xbc84('0x7c')][_0xbc84('0x83')]){return _0x7410df(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x7410df(new Error(_0xbc84('0x84')));}var _0x4afb02=_0x1fbb31['name'];var _0x43993b=_0x1fbb31[_0xbc84('0x85')];var _0x4d1dc8=_0x1fbb31['type'];var _0x5ca4a9=_0x1fbb31[_0xbc84('0x86')]?_0x1fbb31['sidebar']:_0xbc84('0x87');var _0x533270=_0x1fbb31[_0xbc84('0x88')]?_0x1fbb31[_0xbc84('0x88')]:_0xbc84('0x89');var _0x1adc1f='';var _0x17d522='';var _0x572c7e='';var _0x100535='';var _0x44d3a0=_0x1fbb31[_0xbc84('0x7a')];if(_0x4d1dc8==='html'){if(_0xbc84('0x78')!=typeof _0x1fbb31[_0xbc84('0x7c')][_0xbc84('0x7e')][_0xbc84('0x8a')]){var _0x22689f=_0x1fbb31[_0xbc84('0x7c')][_0xbc84('0x7e')][_0xbc84('0x8a')];if(!/^(f|ht)tps?:\/\//i['test'](_0x22689f)){_0x1adc1f=path['join'](_0xbc84('0x8b'),_0x1c417a,_0x2930c8[0x0],_0x22689f);}else{_0x1adc1f=_0x22689f;}}else{logger[_0xbc84('0x68')](_0xbc84('0x8c'));}if('undefined'!=typeof _0x1fbb31[_0xbc84('0x7c')][_0xbc84('0x7e')][_0xbc84('0x7f')]){var _0x35ea06=_0x1fbb31[_0xbc84('0x7c')][_0xbc84('0x7e')][_0xbc84('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0xbc84('0x8d')](_0x35ea06)){_0x17d522=path[_0xbc84('0x4f')]('plugins',_0x1c417a,_0x2930c8[0x0],_0x35ea06);}else{_0x17d522=_0x35ea06;}}else{logger[_0xbc84('0x68')](_0xbc84('0x8e'));}}else if(_0x4d1dc8==='script'){_0x572c7e=_0x1fbb31[_0xbc84('0x7c')]['scriptName'];_0x100535=_0x1fbb31[_0xbc84('0x7c')]['scriptPath'];if('undefined'!=typeof _0x1fbb31[_0xbc84('0x7c')][_0xbc84('0x7e')]){if(_0xbc84('0x78')!=typeof _0x1fbb31[_0xbc84('0x7c')][_0xbc84('0x7e')][_0xbc84('0x8a')]){var _0x22689f=_0x1fbb31[_0xbc84('0x7c')][_0xbc84('0x7e')][_0xbc84('0x8a')];if(!/^(f|ht)tps?:\/\//i[_0xbc84('0x8d')](_0x22689f)){_0x1adc1f=path['join'](_0xbc84('0x8b'),_0x1c417a,_0x2930c8[0x0],_0x22689f);}else{_0x1adc1f=_0x22689f;}}if(_0xbc84('0x78')!=typeof _0x1fbb31[_0xbc84('0x7c')]['views']['agent']){var _0x35ea06=_0x1fbb31['parameters']['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0xbc84('0x8d')](_0x35ea06)){_0x17d522=path[_0xbc84('0x4f')](_0xbc84('0x8b'),_0x1c417a,_0x2930c8[0x0],_0x35ea06);}else{_0x17d522=_0x35ea06;}}}}var _0x17d89e={'name':_0x4afb02,'description':_0x43993b,'path':path[_0xbc84('0x4f')](_0x1c417a,_0x2930c8[0x0]),'type':_0x4d1dc8,'sidebar':_0x5ca4a9,'icon':_0x533270,'adminUrl':_0x1adc1f,'agentUrl':_0x17d522,'scriptName':_0x572c7e,'scriptPath':_0x100535,'version':_0x44d3a0};removeReferences(_0x1a70d6,null);return db[_0xbc84('0x32')][_0xbc84('0x8f')](_0x17d89e)[_0xbc84('0x29')](function(_0x11f4e2){var _0x5c13e6={'role':_0x4c7eaf[_0xbc84('0x90')][_0xbc84('0x91')],'userProfileId':_0x4c7eaf['body'][_0xbc84('0x92')]};if(!_0x5c13e6)throw new Error(_0xbc84('0x93'));if(_0x5c13e6['role']===_0xbc84('0x94')){var _0x1d4332=_0x11f4e2[_0xbc84('0x2b')]({'plain':!![]});return db[_0xbc84('0x95')][_0xbc84('0x4e')]({'where':{'name':_0xbc84('0x96'),'userProfileId':_0x5c13e6[_0xbc84('0x92')]},'raw':!![]})[_0xbc84('0x29')](function(_0x541531){if(_0x541531&&_0x541531['autoAssociation']===0x0){return db[_0xbc84('0x2c')][_0xbc84('0x8f')]({'name':_0x1d4332['name'],'resourceId':_0x1d4332['id'],'type':_0x541531[_0xbc84('0x2f')],'sectionId':_0x541531['id']},{})[_0xbc84('0x29')](function(){return _0x11f4e2;});}else{return _0x11f4e2;}})[_0xbc84('0x4a')](function(_0x1aedcf){logger[_0xbc84('0x2d')](_0xbc84('0x97'),_0x1aedcf);throw _0x1aedcf;});}return _0x11f4e2;})['then'](respondWithResult(_0x473753,null))[_0xbc84('0x4a')](handleError(_0x473753,null));}});}catch(_0x1bff6d){_0x473753[_0xbc84('0x1d')](0x1f4)[_0xbc84('0x30')](_0x1bff6d);}};function removeReferences(_0x560165,_0x4a1989){try{if(_0x560165){fs['unlinkSync'](_0x560165);logger[_0xbc84('0x68')](_0xbc84('0x98'));}if(_0x4a1989){rimraf(_0x4a1989,function(){});logger[_0xbc84('0x68')](_0xbc84('0x99'));}}catch(_0xf08cc2){logger[_0xbc84('0x2d')](_0xf08cc2);}}exports[_0xbc84('0x28')]=function(_0x556973,_0x1a40c5,_0x5b916f){return db[_0xbc84('0x32')][_0xbc84('0x4e')]({'where':{'id':_0x556973[_0xbc84('0x4b')]['id']}})[_0xbc84('0x29')](handleEntityNotFound(_0x1a40c5,null))[_0xbc84('0x29')](saveUpdates(_0x556973[_0xbc84('0x90')],null))[_0xbc84('0x29')](respondWithResult(_0x1a40c5,null))[_0xbc84('0x4a')](handleError(_0x1a40c5,null));};exports[_0xbc84('0x9a')]=function(_0x5b1eb9,_0x22c1ac,_0x43bbf3){return db[_0xbc84('0x32')]['find']({'where':{'id':_0x5b1eb9[_0xbc84('0x4b')]['id']}})[_0xbc84('0x29')](function(_0x133d70){if(_0x133d70){return _0x133d70[_0xbc84('0x2a')]();}})[_0xbc84('0x29')](function(_0x5bf06e){rimraf(path[_0xbc84('0x4f')](config[_0xbc84('0x50')],_0xbc84('0x5c'),path[_0xbc84('0x5d')](_0x5bf06e[_0xbc84('0x5')])),function(){});return _0x5bf06e;})[_0xbc84('0x29')](handleEntityNotFound(_0x22c1ac,null))['then'](respondWithStatusCode(_0x22c1ac,null))['catch'](handleError(_0x22c1ac,null));};exports[_0xbc84('0x9b')]=function(_0x548d52,_0x245433,_0x3e131e){return BPromise[_0xbc84('0x9c')]()[_0xbc84('0x29')](function(){if(!_0x548d52[_0xbc84('0x38')][_0xbc84('0x5')]){throw new Error(_0xbc84('0x9d'));}if(!_0x548d52[_0xbc84('0x38')][_0xbc84('0x9e')]){throw new Error(_0xbc84('0x9f'));}var _0x56f252=_0x548d52[_0xbc84('0x38')][_0xbc84('0xa0')]?_0x548d52[_0xbc84('0x38')]['hostname']+':'+_0x548d52[_0xbc84('0x38')][_0xbc84('0x9e')]:_0xbc84('0xa1')+_0x548d52[_0xbc84('0x38')][_0xbc84('0x9e')];var _0x25b8a9=_0x548d52[_0xbc84('0x38')][_0xbc84('0x1f')]?_0x548d52[_0xbc84('0x38')]['json']:!![];var _0x2070a1=_0x548d52[_0xbc84('0x38')]['encoding']?_0x548d52[_0xbc84('0x38')][_0xbc84('0xa2')]:null;var _0x4ee5cb={'method':_0x548d52['method'],'uri':util[_0xbc84('0x65')]('%s%s',_0x56f252,_0x548d52['query']['path']),'json':_0x25b8a9,'resolveWithFullResponse':!![],'encoding':_0x2070a1,'qs':_0x548d52[_0xbc84('0x38')]};if(_0x548d52[_0xbc84('0xa3')]){_0x4ee5cb['headers']=_0x548d52[_0xbc84('0xa3')];if(_0x4ee5cb[_0xbc84('0xa3')]['content-length']){delete _0x4ee5cb[_0xbc84('0xa3')]['content-length'];}}if(_0x4ee5cb[_0xbc84('0xa3')]['content-type']){delete _0x4ee5cb['headers'][_0xbc84('0xa4')];}return rp(_0x4ee5cb);})['then'](function(_0x36e189){if(_0x36e189){_0x245433[_0xbc84('0x23')](_0x36e189[_0xbc84('0xa3')]);logger[_0xbc84('0x68')](_0x36e189[_0xbc84('0x90')]);if(_[_0xbc84('0xa5')](_0x548d52[_0xbc84('0x38')][_0xbc84('0x5')],'download')&&_0x36e189['statusCode']==0x1f4){return _0x245433[_0xbc84('0xa6')](_0x36e189[_0xbc84('0xa7')]);}else{return _0x245433[_0xbc84('0x1d')](_0x36e189['statusCode'])[_0xbc84('0x30')](_0x36e189[_0xbc84('0x90')]);}}else{return _0x245433[_0xbc84('0xa6')](0xc8);}})[_0xbc84('0x4a')](handleError(_0x245433,null));};exports['webhookPost']=function(_0x59b2da,_0x4cb888,_0x5e84df){return BPromise['resolve']()[_0xbc84('0x29')](function(){if(!_0x59b2da['query'][_0xbc84('0x5')]){throw new Error(_0xbc84('0x9d'));}if(!_0x59b2da[_0xbc84('0x38')][_0xbc84('0x9e')]){throw new Error(_0xbc84('0x9f'));}var _0x543731=_0x59b2da[_0xbc84('0x38')]['hostname']?_0x59b2da[_0xbc84('0x38')][_0xbc84('0xa0')]+':'+_0x59b2da[_0xbc84('0x38')]['port']:'http://localhost:'+_0x59b2da['query']['port'];var _0x1c8ba7=_0x59b2da[_0xbc84('0x38')]['json']?_0x59b2da['query'][_0xbc84('0x1f')]:!![];var _0x15db5c=_0x59b2da[_0xbc84('0x38')][_0xbc84('0xa2')]?_0x59b2da[_0xbc84('0x38')][_0xbc84('0xa2')]:null;var _0x3abf65={'method':_0x59b2da[_0xbc84('0xa8')],'uri':util[_0xbc84('0x65')](_0xbc84('0xa9'),_0x543731,_0x59b2da[_0xbc84('0x38')][_0xbc84('0x5')]),'json':_0x1c8ba7,'resolveWithFullResponse':!![],'encoding':_0x15db5c,'body':_0x59b2da[_0xbc84('0x90')]};if(_0x59b2da[_0xbc84('0xa3')]){_0x3abf65[_0xbc84('0xa3')]=_0x59b2da[_0xbc84('0xa3')];if(_0x3abf65[_0xbc84('0xa3')][_0xbc84('0xaa')]){delete _0x3abf65[_0xbc84('0xa3')][_0xbc84('0xaa')];}}if(_0x3abf65[_0xbc84('0xa3')][_0xbc84('0xa4')]){delete _0x3abf65[_0xbc84('0xa3')][_0xbc84('0xa4')];}return rp(_0x3abf65);})[_0xbc84('0x29')](function(_0x56fe0d){if(_0x56fe0d){_0x4cb888['set'](_0x56fe0d[_0xbc84('0xa3')]);logger[_0xbc84('0x68')](_0x56fe0d[_0xbc84('0x90')]);return _0x4cb888[_0xbc84('0x1d')](_0x56fe0d['statusCode'])[_0xbc84('0x30')](_0x56fe0d[_0xbc84('0x90')]);}else{return _0x4cb888[_0xbc84('0xa6')](0xc8);}})[_0xbc84('0x4a')](handleError(_0x4cb888,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 0de0859..67c0865 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 _0x9fe7=['hook','exports','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x9fe7,0x1df));var _0x79fe=function(_0x1c92fd,_0x1af3e8){_0x1c92fd=_0x1c92fd-0x0;var _0x4f8d4e=_0x9fe7[_0x1c92fd];return _0x4f8d4e;};'use strict';var EventEmitter=require(_0x79fe('0x0'));var Plugin=require(_0x79fe('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x79fe('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x79fe('0x3'),'afterDestroy':_0x79fe('0x4')};function emitEvent(_0x277bb5){return function(_0x50423a,_0x44c145,_0x627ec4){PluginEvents[_0x79fe('0x5')](_0x277bb5+':'+_0x50423a['id'],_0x50423a);PluginEvents['emit'](_0x277bb5,_0x50423a);_0x627ec4(null);};}for(var e in events){if(events[_0x79fe('0x6')](e)){var event=events[e];Plugin[_0x79fe('0x7')](e,emitEvent(event));}}module[_0x79fe('0x8')]=PluginEvents; \ No newline at end of file +var _0xd634=['emit','hasOwnProperty','hook','exports','../../mysqldb','Plugin','update','remove'];(function(_0x3844df,_0x48d374){var _0x33cfeb=function(_0x2a14ed){while(--_0x2a14ed){_0x3844df['push'](_0x3844df['shift']());}};_0x33cfeb(++_0x48d374);}(_0xd634,0xf4));var _0x4d63=function(_0xd816e2,_0x5edac2){_0xd816e2=_0xd816e2-0x0;var _0x1f5924=_0xd634[_0xd816e2];return _0x1f5924;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x4d63('0x0'))['db'][_0x4d63('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4d63('0x2'),'afterDestroy':_0x4d63('0x3')};function emitEvent(_0x478b56){return function(_0x4f99ac,_0x2b8d62,_0x35ba45){PluginEvents[_0x4d63('0x4')](_0x478b56+':'+_0x4f99ac['id'],_0x4f99ac);PluginEvents[_0x4d63('0x4')](_0x478b56,_0x4f99ac);_0x35ba45(null);};}for(var e in events){if(events[_0x4d63('0x5')](e)){var event=events[e];Plugin[_0x4d63('0x6')](e,emitEvent(event));}}module[_0x4d63('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 45caa07..f8303bf 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 _0xe16f=['../../config/environment','./plugin.attributes','exports','define','Plugin','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x57ad2b,_0x2e9ede){var _0x1c7858=function(_0x2e6378){while(--_0x2e6378){_0x57ad2b['push'](_0x57ad2b['shift']());}};_0x1c7858(++_0x2e9ede);}(_0xe16f,0x9f));var _0xfe16=function(_0xb86682,_0x226d51){_0xb86682=_0xb86682-0x0;var _0x3a8502=_0xe16f[_0xb86682];return _0x3a8502;};'use strict';var _=require('lodash');var util=require(_0xfe16('0x0'));var logger=require(_0xfe16('0x1'))(_0xfe16('0x2'));var moment=require('moment');var BPromise=require(_0xfe16('0x3'));var rp=require(_0xfe16('0x4'));var fs=require('fs');var path=require(_0xfe16('0x5'));var rimraf=require('rimraf');var config=require(_0xfe16('0x6'));var attributes=require(_0xfe16('0x7'));module[_0xfe16('0x8')]=function(_0x28f661,_0x53c46b){return _0x28f661[_0xfe16('0x9')](_0xfe16('0xa'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1ba=['bluebird','request-promise','path','Plugin','plugins','lodash','util','../../config/logger'];(function(_0x487476,_0x1f226c){var _0x4a41d1=function(_0x1a3d40){while(--_0x1a3d40){_0x487476['push'](_0x487476['shift']());}};_0x4a41d1(++_0x1f226c);}(_0xc1ba,0x18d));var _0xac1b=function(_0x2e30f4,_0x40e9b7){_0x2e30f4=_0x2e30f4-0x0;var _0x3550e6=_0xc1ba[_0x2e30f4];return _0x3550e6;};'use strict';var _=require(_0xac1b('0x0'));var util=require(_0xac1b('0x1'));var logger=require(_0xac1b('0x2'))('api');var moment=require('moment');var BPromise=require(_0xac1b('0x3'));var rp=require(_0xac1b('0x4'));var fs=require('fs');var path=require(_0xac1b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./plugin.attributes');module['exports']=function(_0x160dfb,_0x497af4){return _0x160dfb['define'](_0xac1b('0x6'),attributes,{'tableName':_0xac1b('0x7'),'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 c848ad2..fa2413c 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 _0x8b59=['client','http','defaults','redis','localhost','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreatePlugin','create','options','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x412f04,_0x5ca97b){var _0x2434a2=function(_0x31fc2b){while(--_0x31fc2b){_0x412f04['push'](_0x412f04['shift']());}};_0x2434a2(++_0x5ca97b);}(_0x8b59,0x1d7));var _0x98b5=function(_0x17b705,_0xab483){_0x17b705=_0x17b705-0x0;var _0x57cd8c=_0x8b59[_0x17b705];return _0x57cd8c;};'use strict';var _=require(_0x98b5('0x0'));var util=require(_0x98b5('0x1'));var moment=require('moment');var BPromise=require(_0x98b5('0x2'));var rs=require(_0x98b5('0x3'));var fs=require('fs');var Redis=require(_0x98b5('0x4'));var db=require(_0x98b5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x98b5('0x6'))(_0x98b5('0x7'));var config=require(_0x98b5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x98b5('0x9')][_0x98b5('0xa')]({'port':0x232a});config['redis']=_[_0x98b5('0xb')](config[_0x98b5('0xc')],{'host':_0x98b5('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x98b5('0xc')]));require(_0x98b5('0xe'))[_0x98b5('0xf')](socket);function respondWithRpcPromise(_0x39787c,_0xe33f09,_0x1419ad){return new BPromise(function(_0x2ff081,_0x4dc95b){return client[_0x98b5('0x10')](_0x39787c,_0x1419ad)['then'](function(_0x326f75){logger[_0x98b5('0x11')](_0x98b5('0x12'),_0xe33f09,_0x98b5('0x13'));logger[_0x98b5('0x14')]('Plugin,\x20%s,\x20%s,\x20%s',_0xe33f09,_0x98b5('0x13'),JSON[_0x98b5('0x15')](_0x326f75));if(_0x326f75[_0x98b5('0x16')]){if(_0x326f75[_0x98b5('0x16')][_0x98b5('0x17')]===0x1f4){logger['error'](_0x98b5('0x12'),_0xe33f09,_0x326f75[_0x98b5('0x16')][_0x98b5('0x18')]);return _0x4dc95b(_0x326f75[_0x98b5('0x16')][_0x98b5('0x18')]);}logger[_0x98b5('0x16')]('Plugin,\x20%s,\x20%s',_0xe33f09,_0x326f75[_0x98b5('0x16')][_0x98b5('0x18')]);return _0x2ff081(_0x326f75[_0x98b5('0x16')][_0x98b5('0x18')]);}else{logger[_0x98b5('0x11')](_0x98b5('0x12'),_0xe33f09,_0x98b5('0x13'));_0x2ff081(_0x326f75[_0x98b5('0x19')][_0x98b5('0x18')]);}})[_0x98b5('0x1a')](function(_0x1506b2){logger[_0x98b5('0x16')]('Plugin,\x20%s,\x20%s',_0xe33f09,_0x1506b2);_0x4dc95b(_0x1506b2);});});}exports[_0x98b5('0x1b')]=function(_0x290dc6){var _0x8f6b4f=this;return new Promise(function(_0x586356,_0xeef07d){return db['Plugin'][_0x98b5('0x1c')](_0x290dc6['body'],{'raw':_0x290dc6['options']?_0x290dc6[_0x98b5('0x1d')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4dacc0){logger[_0x98b5('0x11')]('CreatePlugin',_0x290dc6);logger['debug'](_0x98b5('0x1b'),_0x290dc6,JSON[_0x98b5('0x15')](_0x4dacc0));_0x586356(_0x4dacc0);})[_0x98b5('0x1a')](function(_0x5f16d8){logger[_0x98b5('0x16')](_0x98b5('0x1b'),_0x5f16d8[_0x98b5('0x18')],_0x290dc6);_0xeef07d(_0x8f6b4f[_0x98b5('0x16')](0x1f4,_0x5f16d8[_0x98b5('0x18')]));});});}; \ No newline at end of file +var _0x2781=['../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./plugin.socket','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreatePlugin','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3898fd,_0x4fad32){var _0x42b0b1=function(_0x4fd74a){while(--_0x4fd74a){_0x3898fd['push'](_0x3898fd['shift']());}};_0x42b0b1(++_0x4fad32);}(_0x2781,0x76));var _0x1278=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x2781[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x1278('0x0'));var util=require('util');var moment=require(_0x1278('0x1'));var BPromise=require(_0x1278('0x2'));var rs=require(_0x1278('0x3'));var fs=require('fs');var Redis=require(_0x1278('0x4'));var db=require(_0x1278('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1278('0x6'))(_0x1278('0x7'));var config=require(_0x1278('0x8'));var jayson=require(_0x1278('0x9'));var client=jayson['client'][_0x1278('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x1278('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1278('0xc'))(new Redis(config[_0x1278('0xb')]));require(_0x1278('0xd'))['register'](socket);function respondWithRpcPromise(_0x4c0e3b,_0x555256,_0x55a37e){return new BPromise(function(_0x200a80,_0x467ae5){return client[_0x1278('0xe')](_0x4c0e3b,_0x55a37e)[_0x1278('0xf')](function(_0x1dcb78){logger['info'](_0x1278('0x10'),_0x555256,_0x1278('0x11'));logger[_0x1278('0x12')](_0x1278('0x13'),_0x555256,_0x1278('0x11'),JSON[_0x1278('0x14')](_0x1dcb78));if(_0x1dcb78[_0x1278('0x15')]){if(_0x1dcb78[_0x1278('0x15')][_0x1278('0x16')]===0x1f4){logger[_0x1278('0x15')](_0x1278('0x10'),_0x555256,_0x1dcb78['error'][_0x1278('0x17')]);return _0x467ae5(_0x1dcb78[_0x1278('0x15')][_0x1278('0x17')]);}logger['error'](_0x1278('0x10'),_0x555256,_0x1dcb78[_0x1278('0x15')][_0x1278('0x17')]);return _0x200a80(_0x1dcb78[_0x1278('0x15')]['message']);}else{logger[_0x1278('0x18')](_0x1278('0x10'),_0x555256,'request\x20sent');_0x200a80(_0x1dcb78['result'][_0x1278('0x17')]);}})[_0x1278('0x19')](function(_0x3cd18c){logger[_0x1278('0x15')](_0x1278('0x10'),_0x555256,_0x3cd18c);_0x467ae5(_0x3cd18c);});});}exports[_0x1278('0x1a')]=function(_0x5e4002){var _0x236ad4=this;return new Promise(function(_0x262756,_0x1af8e0){return db['Plugin'][_0x1278('0x1b')](_0x5e4002[_0x1278('0x1c')],{'raw':_0x5e4002[_0x1278('0x1d')]?_0x5e4002['options'][_0x1278('0x1e')]===undefined?!![]:![]:!![]})[_0x1278('0xf')](function(_0x4d5708){logger[_0x1278('0x18')](_0x1278('0x1a'),_0x5e4002);logger[_0x1278('0x12')]('CreatePlugin',_0x5e4002,JSON[_0x1278('0x14')](_0x4d5708));_0x262756(_0x4d5708);})['catch'](function(_0x1d8746){logger[_0x1278('0x15')](_0x1278('0x1a'),_0x1d8746['message'],_0x5e4002);_0x1af8e0(_0x236ad4[_0x1278('0x15')](0x1f4,_0x1d8746[_0x1278('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 5c1e776..dae6a2c 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 _0xd2e4=['plugin:','./plugin.events','save','emit','removeListener','length'];(function(_0x375ba8,_0x3119af){var _0x84f35c=function(_0x4d0d0e){while(--_0x4d0d0e){_0x375ba8['push'](_0x375ba8['shift']());}};_0x84f35c(++_0x3119af);}(_0xd2e4,0xaf));var _0x4d2e=function(_0x3f3083,_0x229b41){_0x3f3083=_0x3f3083-0x0;var _0x499e65=_0xd2e4[_0x3f3083];return _0x499e65;};'use strict';var PluginEvents=require(_0x4d2e('0x0'));var events=[_0x4d2e('0x1'),'remove','update'];function createListener(_0x289217,_0x1193be){return function(_0x535212){_0x1193be[_0x4d2e('0x2')](_0x289217,_0x535212);};}function removeListener(_0x2d17dd,_0x3bd0f0){return function(){PluginEvents[_0x4d2e('0x3')](_0x2d17dd,_0x3bd0f0);};}exports['register']=function(_0x4043ff){for(var _0x4c9222=0x0,_0x3b3760=events[_0x4d2e('0x4')];_0x4c9222<_0x3b3760;_0x4c9222++){var _0x109c42=events[_0x4c9222];var _0x5dfc2a=createListener(_0x4d2e('0x5')+_0x109c42,_0x4043ff);PluginEvents['on'](_0x109c42,_0x5dfc2a);}}; \ No newline at end of file +var _0x0ba9=['removeListener','register','length','./plugin.events','save','update'];(function(_0xbd6776,_0x55f759){var _0x60b1fa=function(_0x2458b7){while(--_0x2458b7){_0xbd6776['push'](_0xbd6776['shift']());}};_0x60b1fa(++_0x55f759);}(_0x0ba9,0x17d));var _0x90ba=function(_0x1f80ac,_0x37fb2a){_0x1f80ac=_0x1f80ac-0x0;var _0x2a8e0c=_0x0ba9[_0x1f80ac];return _0x2a8e0c;};'use strict';var PluginEvents=require(_0x90ba('0x0'));var events=[_0x90ba('0x1'),'remove',_0x90ba('0x2')];function createListener(_0x6b436f,_0x29e747){return function(_0x54dc81){_0x29e747['emit'](_0x6b436f,_0x54dc81);};}function removeListener(_0x538cf7,_0x2869fb){return function(){PluginEvents[_0x90ba('0x3')](_0x538cf7,_0x2869fb);};}exports[_0x90ba('0x4')]=function(_0x18fe6e){for(var _0xcac1ae=0x0,_0x29c90e=events[_0x90ba('0x5')];_0xcac1ae<_0x29c90e;_0xcac1ae++){var _0x58a3b8=events[_0xcac1ae];var _0x375280=createListener('plugin:'+_0x58a3b8,_0x18fe6e);PluginEvents['on'](_0x58a3b8,_0x375280);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index f7d2448..921ef6a 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(_0x59f1d8,_0x528767){var _0x3f590a=function(_0x38d6ae){while(--_0x38d6ae){_0x59f1d8['push'](_0x59f1d8['shift']());}};_0x3f590a(++_0x528767);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x8b5b4,_0x4869da){var _0x5281e1=function(_0x5c665f){while(--_0x5c665f){_0x8b5b4['push'](_0x8b5b4['shift']());}};_0x5281e1(++_0x4869da);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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 28eda2d..a803970 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 _0xb469=['motion2','show','create','body','join','../../files/plugins','chdir','dirname','start','dump','catch','status','update','restart','hasOwnProperty','params','Unknown\x20status','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','sendStatus','error','stack','name','send','info','index','list','then','reject','express'];(function(_0x9abc1d,_0x942017){var _0x1d0c93=function(_0x427f7d){while(--_0x427f7d){_0x9abc1d['push'](_0x9abc1d['shift']());}};_0x1d0c93(++_0x942017);}(_0xb469,0x13b));var _0x9b46=function(_0x436c67,_0x4729d3){_0x436c67=_0x436c67-0x0;var _0x15cc09=_0xb469[_0x436c67];return _0x15cc09;};'use strict';var _=require(_0x9b46('0x0'));var pm2=require(_0x9b46('0x1'));var logger=require(_0x9b46('0x2'))(_0x9b46('0x3'));var path=require(_0x9b46('0x4'));var exec=require(_0x9b46('0x5'))[_0x9b46('0x6')];var BPromise=require('bluebird');function handleEntityNotFound(_0x31f853,_0x45322f){return function(_0x538fc4){if(!_0x538fc4){_0x31f853[_0x9b46('0x7')](0x194);;}return _0x538fc4;};}function respondWithResult(_0x405d1c,_0x50b49e){_0x50b49e=_0x50b49e||0xc8;return function(_0x1b2dd3){if(_0x1b2dd3){return _0x405d1c['status'](_0x50b49e)['json'](_0x1b2dd3);}return null;};}function handleError(_0x34c0de,_0x545b6c){_0x545b6c=_0x545b6c||0x1f4;return function(_0x402595){logger[_0x9b46('0x8')](_0x402595[_0x9b46('0x9')]);if(_0x402595['name']){delete _0x402595[_0x9b46('0xa')];}_0x34c0de['status'](_0x545b6c)[_0x9b46('0xb')](_0x402595);};}function execChildProcess(){return new BPromise(function(_0x568d9a,_0x2c29a7){exec('npm\x20install',function(_0x672157,_0x233b6b,_0x563de4){logger[_0x9b46('0xc')](_0x233b6b);logger[_0x9b46('0xc')](_0x563de4);if(_0x672157){logger['error'](_0x672157);return _0x2c29a7(_0x672157);}return _0x568d9a(_0x233b6b);});});}exports[_0x9b46('0xd')]=function(_0x2cfb35,_0x3d9618){return pm2[_0x9b46('0xe')]()[_0x9b46('0xf')](function(_0x35c5c1){if(_0x35c5c1){var _0x2136bc=_[_0x9b46('0x10')](_0x35c5c1,function(_0x3f2b28){return _0x3f2b28[_0x9b46('0xa')]===_0x9b46('0x11')||_0x3f2b28[_0x9b46('0xa')]===_0x9b46('0x12');});return{'rows':_0x2136bc,'count':_0x2136bc['length']};}return null;})['then'](respondWithResult(_0x3d9618,null))['catch'](handleError(_0x3d9618,null));};exports[_0x9b46('0x13')]=function(_0x5a380c,_0x29fec9){return pm2['describe'](_0x5a380c['params']['id'])[_0x9b46('0xf')](respondWithResult(_0x29fec9,null))['then'](handleEntityNotFound(_0x29fec9,null))['catch'](handleError(_0x29fec9,null));};exports[_0x9b46('0x14')]=function(_0x3a15cc,_0x5a0d25){if(_0x3a15cc[_0x9b46('0x15')][_0x9b46('0xa')]&&_0x3a15cc['body']['script']){var _0xbec2ea=path[_0x9b46('0x16')](__dirname,_0x9b46('0x17'),_0x3a15cc['body']['script']);var _0x2b3440=process['cwd']();process[_0x9b46('0x18')](path[_0x9b46('0x19')](_0xbec2ea));return execChildProcess()['then'](function(_0xadff19){process['chdir'](_0x2b3440);return pm2[_0x9b46('0x1a')]({'name':_0x3a15cc[_0x9b46('0x15')]['name'],'script':_0xbec2ea});})[_0x9b46('0xf')](function(_0x31ca63){pm2[_0x9b46('0x1b')]();return _0x31ca63[0x0];})[_0x9b46('0xf')](respondWithResult(_0x5a0d25,0xc9))[_0x9b46('0x1c')](handleError(_0x5a0d25,null));}else{return _0x5a0d25[_0x9b46('0x1d')](0x1f4)[_0x9b46('0xb')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x9b46('0x1e')]=function(_0x3ac37e,_0x478105){if(_0x3ac37e[_0x9b46('0x15')]['id']){delete _0x3ac37e[_0x9b46('0x15')]['id'];}var _0x2a79a5={'online':_0x9b46('0x1f'),'stopped':'stop'};if(_0x2a79a5[_0x9b46('0x20')](_0x3ac37e[_0x9b46('0x15')][_0x9b46('0x1d')])){return pm2[_0x2a79a5[_0x3ac37e[_0x9b46('0x15')][_0x9b46('0x1d')]]](_0x3ac37e[_0x9b46('0x21')]['id'])[_0x9b46('0xf')](respondWithResult(_0x478105,0xc8))[_0x9b46('0x1c')](handleError(_0x478105,null));}else{return _0x478105[_0x9b46('0x1d')](0x1f4)[_0x9b46('0xb')]({'message':_0x9b46('0x22')});}};exports['destroy']=function(_0x1f722d,_0x27f326){if(_0x1f722d[_0x9b46('0x15')]['id']){delete _0x1f722d[_0x9b46('0x15')]['id'];}if(_0x1f722d[_0x9b46('0x21')]['id']){return pm2[_0x9b46('0x23')](_0x1f722d[_0x9b46('0x21')]['id'])[_0x9b46('0xf')](function(_0x3ab49a){pm2[_0x9b46('0x1b')]();return _0x3ab49a[0x0];})[_0x9b46('0xf')](respondWithResult(_0x27f326,null))['catch'](handleError(_0x27f326,null));}else{return _0x27f326[_0x9b46('0x1d')](0x1f4)['send']({'message':_0x9b46('0x24')});}}; \ No newline at end of file +var _0x7af2=['sendStatus','json','error','stack','name','status','info','index','list','then','reject','express','motion2','length','catch','show','describe','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','params','send','destroy','Unknown\x20id','../../config/pm2','../../config/logger','api','path','exec','bluebird'];(function(_0x9fa1d9,_0x26899f){var _0x14b09f=function(_0x5f1450){while(--_0x5f1450){_0x9fa1d9['push'](_0x9fa1d9['shift']());}};_0x14b09f(++_0x26899f);}(_0x7af2,0x119));var _0x27af=function(_0xf74372,_0x51fe82){_0xf74372=_0xf74372-0x0;var _0x36bb65=_0x7af2[_0xf74372];return _0x36bb65;};'use strict';var _=require('lodash');var pm2=require(_0x27af('0x0'));var logger=require(_0x27af('0x1'))(_0x27af('0x2'));var path=require(_0x27af('0x3'));var exec=require('child_process')[_0x27af('0x4')];var BPromise=require(_0x27af('0x5'));function handleEntityNotFound(_0x709cb6,_0x2a542f){return function(_0x22ae46){if(!_0x22ae46){_0x709cb6[_0x27af('0x6')](0x194);;}return _0x22ae46;};}function respondWithResult(_0x350532,_0x184630){_0x184630=_0x184630||0xc8;return function(_0x2193c6){if(_0x2193c6){return _0x350532['status'](_0x184630)[_0x27af('0x7')](_0x2193c6);}return null;};}function handleError(_0x366868,_0x389e97){_0x389e97=_0x389e97||0x1f4;return function(_0x583db8){logger[_0x27af('0x8')](_0x583db8[_0x27af('0x9')]);if(_0x583db8[_0x27af('0xa')]){delete _0x583db8['name'];}_0x366868[_0x27af('0xb')](_0x389e97)['send'](_0x583db8);};}function execChildProcess(){return new BPromise(function(_0x4d4729,_0x3e4b33){exec('npm\x20install',function(_0x50fe01,_0x184e25,_0x59c073){logger[_0x27af('0xc')](_0x184e25);logger['info'](_0x59c073);if(_0x50fe01){logger[_0x27af('0x8')](_0x50fe01);return _0x3e4b33(_0x50fe01);}return _0x4d4729(_0x184e25);});});}exports[_0x27af('0xd')]=function(_0x1fd964,_0x23f9ec){return pm2[_0x27af('0xe')]()[_0x27af('0xf')](function(_0x234825){if(_0x234825){var _0x3da435=_[_0x27af('0x10')](_0x234825,function(_0x4724e0){return _0x4724e0[_0x27af('0xa')]===_0x27af('0x11')||_0x4724e0[_0x27af('0xa')]===_0x27af('0x12');});return{'rows':_0x3da435,'count':_0x3da435[_0x27af('0x13')]};}return null;})[_0x27af('0xf')](respondWithResult(_0x23f9ec,null))[_0x27af('0x14')](handleError(_0x23f9ec,null));};exports[_0x27af('0x15')]=function(_0x58583a,_0x315661){return pm2[_0x27af('0x16')](_0x58583a['params']['id'])['then'](respondWithResult(_0x315661,null))[_0x27af('0xf')](handleEntityNotFound(_0x315661,null))[_0x27af('0x14')](handleError(_0x315661,null));};exports[_0x27af('0x17')]=function(_0x31573a,_0xec699a){if(_0x31573a['body'][_0x27af('0xa')]&&_0x31573a[_0x27af('0x18')][_0x27af('0x19')]){var _0x5e7c19=path[_0x27af('0x1a')](__dirname,_0x27af('0x1b'),_0x31573a[_0x27af('0x18')]['script']);var _0x2dce2b=process[_0x27af('0x1c')]();process[_0x27af('0x1d')](path[_0x27af('0x1e')](_0x5e7c19));return execChildProcess()[_0x27af('0xf')](function(_0x396156){process[_0x27af('0x1d')](_0x2dce2b);return pm2[_0x27af('0x1f')]({'name':_0x31573a[_0x27af('0x18')]['name'],'script':_0x5e7c19});})['then'](function(_0x4b8fe6){pm2[_0x27af('0x20')]();return _0x4b8fe6[0x0];})['then'](respondWithResult(_0xec699a,0xc9))[_0x27af('0x14')](handleError(_0xec699a,null));}else{return _0xec699a[_0x27af('0xb')](0x1f4)['send']({'message':_0x27af('0x21')});}};exports[_0x27af('0x22')]=function(_0x463e36,_0x424490){if(_0x463e36[_0x27af('0x18')]['id']){delete _0x463e36[_0x27af('0x18')]['id'];}var _0x775d4e={'online':'restart','stopped':_0x27af('0x23')};if(_0x775d4e[_0x27af('0x24')](_0x463e36[_0x27af('0x18')][_0x27af('0xb')])){return pm2[_0x775d4e[_0x463e36[_0x27af('0x18')][_0x27af('0xb')]]](_0x463e36[_0x27af('0x25')]['id'])[_0x27af('0xf')](respondWithResult(_0x424490,0xc8))[_0x27af('0x14')](handleError(_0x424490,null));}else{return _0x424490[_0x27af('0xb')](0x1f4)[_0x27af('0x26')]({'message':'Unknown\x20status'});}};exports[_0x27af('0x27')]=function(_0x14b2e7,_0x3800a1){if(_0x14b2e7[_0x27af('0x18')]['id']){delete _0x14b2e7[_0x27af('0x18')]['id'];}if(_0x14b2e7[_0x27af('0x25')]['id']){return pm2['delete'](_0x14b2e7['params']['id'])[_0x27af('0xf')](function(_0x37cb41){pm2['dump']();return _0x37cb41[0x0];})[_0x27af('0xf')](respondWithResult(_0x3800a1,null))[_0x27af('0x14')](handleError(_0x3800a1,null));}else{return _0x3800a1[_0x27af('0xb')](0x1f4)[_0x27af('0x26')]({'message':_0x27af('0x28')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index a5f715a..0b2c9eb 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 _0xa4e3=['isAuthenticated','getQueues','exports','express','../../components/auth/service','get','/queues'];(function(_0x2b3b60,_0x1fafc6){var _0x35099f=function(_0x19c3b6){while(--_0x19c3b6){_0x2b3b60['push'](_0x2b3b60['shift']());}};_0x35099f(++_0x1fafc6);}(_0xa4e3,0x129));var _0x3a4e=function(_0x15962c,_0x37a716){_0x15962c=_0x15962c-0x0;var _0x3d86ce=_0xa4e3[_0x15962c];return _0x3d86ce;};'use strict';var express=require(_0x3a4e('0x0'));var router=express['Router']();var auth=require(_0x3a4e('0x1'));var controller=require('./realtime.controller');router[_0x3a4e('0x2')](_0x3a4e('0x3'),auth[_0x3a4e('0x4')](),controller[_0x3a4e('0x5')]);module[_0x3a4e('0x6')]=router; \ No newline at end of file +var _0xaf11=['isAuthenticated','getQueues','express','Router','../../components/auth/service','./realtime.controller','/queues'];(function(_0x185fbf,_0x3d147f){var _0x169eef=function(_0x4f8a33){while(--_0x4f8a33){_0x185fbf['push'](_0x185fbf['shift']());}};_0x169eef(++_0x3d147f);}(_0xaf11,0x12f));var _0x1af1=function(_0x2043f8,_0x189ceb){_0x2043f8=_0x2043f8-0x0;var _0x12a443=_0xaf11[_0x2043f8];return _0x12a443;};'use strict';var express=require(_0x1af1('0x0'));var router=express[_0x1af1('0x1')]();var auth=require(_0x1af1('0x2'));var controller=require(_0x1af1('0x3'));router['get'](_0x1af1('0x4'),auth[_0x1af1('0x5')](),controller[_0x1af1('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 736dd13..c72600f 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 _0x187d=['undefined','limit','count','status','set','Content-Range','stack','name','getQueues','chat','fax','resolve','then','query','channel','includes','toLowerCase','Invalid\x20channel','startCase','rawAttributes','fieldName','key','user','userProfileId','type','Queues','filter','getResources','findAndCountAll','voice','request','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','loggedIn','available','waiting','talking','push','originated','message','dialActive','startPredictive','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','map','get','loggedInDb','paused','outbound','pTalking','agents','find','getAgents','online','getMembers','length','User','Queue','findAll','UserId','agent','rows','catch','util','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','offset'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x187d,0x93));var _0xd187=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x187d[_0x1b349a];return _0x5d1f7c;};'use strict';var util=require(_0xd187('0x0'));var _=require('lodash');var jayson=require(_0xd187('0x1'));var qs=require(_0xd187('0x2'));var logger=require(_0xd187('0x3'))(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var client=jayson[_0xd187('0x6')]['http']({'port':0x232a});var routingClient=jayson[_0xd187('0x6')][_0xd187('0x7')]({'port':0x232c});function respondWithFilteredResult(_0x4ebc8d,_0x1d2533){return function(_0x58ee7){if(_0x58ee7){var _0x444a60=typeof _0x1d2533[_0xd187('0x8')]===_0xd187('0x9')&&typeof _0x1d2533[_0xd187('0xa')]===_0xd187('0x9');var _0x461a44=_0x58ee7['count'];var _0x342539=_0x444a60?0x0:_0x1d2533[_0xd187('0x8')];var _0x4039f6=_0x444a60?_0x58ee7[_0xd187('0xb')]:_0x1d2533[_0xd187('0x8')]+_0x1d2533[_0xd187('0xa')];var _0x59c194;if(_0x4039f6>=_0x461a44){_0x4039f6=_0x461a44;_0x59c194=0xc8;}else{_0x59c194=0xce;}_0x4ebc8d[_0xd187('0xc')](_0x59c194);return _0x4ebc8d[_0xd187('0xd')](_0xd187('0xe'),_0x342539+'-'+_0x4039f6+'/'+_0x461a44)['json'](_0x58ee7);}return null;};}function handleError(_0x37e80c,_0x4545cf){_0x4545cf=_0x4545cf||0x1f4;return function(_0x32ba07){logger['error'](_0x32ba07[_0xd187('0xf')]);if(_0x32ba07[_0xd187('0x10')]){delete _0x32ba07[_0xd187('0x10')];}_0x37e80c[_0xd187('0xc')](_0x4545cf)['send'](_0x32ba07);};}exports[_0xd187('0x11')]=function(_0x2050d5,_0x45ab10){var _0x188cfe=['mail',_0xd187('0x12'),'sms','openchannel',_0xd187('0x13'),'whatsapp','voice'];var _0x207b36={'count':0x0,'rows':[]},_0x2b3290={},_0x374fe0;Promise[_0xd187('0x14')]()[_0xd187('0x15')](function(){if(_0x2050d5[_0xd187('0x16')][_0xd187('0x17')]){if(!_[_0xd187('0x18')](_0x188cfe,_0x2050d5[_0xd187('0x16')][_0xd187('0x17')][_0xd187('0x19')]()))throw new Error(_0xd187('0x1a'));_0x374fe0=_0x2050d5[_0xd187('0x16')]['channel'][_0xd187('0x19')]();}var _0x81b988=_[_0xd187('0x1b')](_0x374fe0)+'Queue';var _0x5a0360=_['map'](db[_0x81b988][_0xd187('0x1c')],function(_0x33741d){return{'name':_0x33741d[_0xd187('0x1d')],'type':_0x33741d['type'][_0xd187('0x1e')]};});_0x2b3290=qs['getOptions'](_0x5a0360,_0x2050d5);if(_0x2050d5[_0xd187('0x1f')]['role']===_0xd187('0x1f')){var _0x54f340={'params':{'id':_0x2050d5['user'][_0xd187('0x20')]},'query':{'section':_0x374fe0==='voice'&&_0x2050d5[_0xd187('0x16')][_0xd187('0x21')]==='outbound'?'QueueCampaigns':_[_0xd187('0x1b')](_0x374fe0)+_0xd187('0x22'),'type':_0x2050d5[_0xd187('0x16')][_0xd187('0x21')],'nolimit':!![],'sort':'name','filter':_0x2050d5[_0xd187('0x16')][_0xd187('0x23')]}};return db['UserProfile'][_0xd187('0x24')](_0x54f340);}return db[_0x81b988][_0xd187('0x25')](_0x2b3290);})[_0xd187('0x15')](function(_0x4c50a5){_0x207b36[_0xd187('0xb')]=_0x4c50a5['count'];var _0x263e31=_0x374fe0===_0xd187('0x26')?client:routingClient;return _0x263e31[_0xd187('0x27')](_[_0xd187('0x1b')](_0x374fe0)+'Queues',_0x2050d5)[_0xd187('0x15')](function(_0xb38778){if(_0xb38778['error'])throw new Error(util['format'](_0xd187('0x28'),_0x374fe0));var _0x1836cf=_0xb38778[_0xd187('0x29')];var _0x481346=[_0xd187('0x2a'),_0xd187('0x2b'),_0xd187('0x2c'),_0xd187('0x2d'),'paused'];if(_0x374fe0===_0xd187('0x26')&&_0x2050d5[_0xd187('0x16')][_0xd187('0x21')]==='outbound'){_0x481346[_0xd187('0x2e')]('pTalking',_0xd187('0x2f'),_0xd187('0x30'),_0xd187('0x31'),'dialMethod','Trunk',_0xd187('0x32'),_0xd187('0x33'),'erlangCalls',_0xd187('0x34'),_0xd187('0x35'),_0xd187('0x36'),'dialPredictiveInterval','dialPredictiveIntervalMaxThreshold',_0xd187('0x37'),_0xd187('0x38'),'predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout',_0xd187('0x39'),'predictiveIntervalAvgHoldtime',_0xd187('0x3a'));}var _0x35c381=_0x4c50a5['rows'][_0xd187('0x3b')](function(_0x5674ca){var _0x293ce9=_0x5674ca[_0xd187('0x3c')]({'plain':!![]});_0x293ce9['paused']=0x0;_0x293ce9[_0xd187('0x3d')]=0x0;_0x293ce9[_0xd187('0x2a')]=0x0;_0x293ce9['available']=0x0;_0x293ce9[_0xd187('0x3e')]=0x0;_0x293ce9['waiting']=0x0;if(_0x374fe0==='voice'){_0x293ce9[_0xd187('0x2d')]=0x0;if(_0x2050d5[_0xd187('0x16')][_0xd187('0x21')]===_0xd187('0x3f')){_0x293ce9[_0xd187('0x40')]=0x0;_0x293ce9['originated']=0x0;}}_0x293ce9[_0xd187('0x41')]=[];var _0xe090ad=_[_0xd187('0x42')](_0x1836cf['rows'],['id',_0x293ce9['id']]);if(_0xe090ad)_['merge'](_0x293ce9,_['pick'](_0xe090ad,_0x481346));if(_0x374fe0==='voice'){return _0x5674ca[_0xd187('0x43')]({'attributes':['id',_0xd187('0x10'),_0xd187('0x44')],'joinTableAttributes':[],'raw':!![]})[_0xd187('0x15')](function(_0x13436d){return _0x5674ca[_0xd187('0x45')]({'raw':!![]})[_0xd187('0x15')](function(_0x791ea0){for(var _0x526060=0x0;_0x526060<_0x13436d[_0xd187('0x46')];_0x526060++){var _0x3b1b30=_[_0xd187('0x42')](_0x791ea0,['UserId',_0x13436d[_0x526060]['id']]);var _0x21cbf6={'id':_0x13436d[_0x526060]['id'],'name':_0x13436d[_0x526060]['name'],'online':Boolean(_0x13436d[_0x526060][_0xd187('0x44')]),'paused':_0x3b1b30?Boolean(_0x3b1b30[_0xd187('0x3e')]):![]};if(_0x21cbf6[_0xd187('0x44')])_0x293ce9[_0xd187('0x3d')]++;if(_0x21cbf6[_0xd187('0x3e')])_0x293ce9['paused']++;_0x293ce9[_0xd187('0x41')][_0xd187('0x2e')](_0x21cbf6);}return _0x293ce9;});});}else{var _0x3215b1=_0xd187('0x47')+_['startCase'](_0x374fe0)+_0xd187('0x48');var _0x3a5b74=_0x374fe0+'Pause';return db[_0x3215b1][_0xd187('0x49')]({'where':{[_[_0xd187('0x1b')](_0x374fe0)+'QueueId']:_0x5674ca['id']},'raw':!![]})['then'](function(_0x3eca08){return db[_0xd187('0x47')]['findAll']({'attributes':['id','name','online',_0x3a5b74],'where':{'id':_[_0xd187('0x3b')](_0x3eca08,_0xd187('0x4a')),'role':_0xd187('0x4b')},'raw':!![]});})[_0xd187('0x15')](function(_0x321b86){for(var _0x60062b=0x0;_0x60062b<_0x321b86[_0xd187('0x46')];_0x60062b++){var _0x573155={'id':_0x321b86[_0x60062b]['id'],'name':_0x321b86[_0x60062b][_0xd187('0x10')],'online':Boolean(_0x321b86[_0x60062b][_0xd187('0x44')]),'paused':Boolean(_0x321b86[_0x60062b][_0x3a5b74])};if(_0x573155[_0xd187('0x44')])_0x293ce9[_0xd187('0x3d')]++;if(_0x573155[_0xd187('0x3e')])_0x293ce9[_0xd187('0x3e')]++;_0x293ce9[_0xd187('0x41')][_0xd187('0x2e')](_0x573155);}return _0x293ce9;});}});return Promise['all'](_0x35c381);});})[_0xd187('0x15')](function(_0x2657be){_0x207b36[_0xd187('0x4c')]=_0x2657be;return _0x207b36;})[_0xd187('0x15')](respondWithFilteredResult(_0x45ab10,_0x2b3290))[_0xd187('0x4d')](handleError(_0x45ab10,null));}; \ No newline at end of file +var _0xffd6=['getQueues','mail','sms','openchannel','fax','whatsapp','voice','then','includes','query','toLowerCase','Invalid\x20channel','Queue','map','fieldName','key','getOptions','role','user','userProfileId','outbound','startCase','Queues','filter','findAndCountAll','request','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','talking','paused','type','push','pTalking','originated','message','dialActive','dialMethod','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','rows','loggedInDb','available','waiting','agents','find','merge','pick','online','getMembers','UserId','User','Pause','findAll','agent','length','all','catch','util','lodash','jayson/promise','api','../../mysqldb','client','http','offset','undefined','limit','count','status','set','json','error','stack','name'];(function(_0x1dd706,_0xb6166b){var _0x5c45aa=function(_0x116854){while(--_0x116854){_0x1dd706['push'](_0x1dd706['shift']());}};_0x5c45aa(++_0xb6166b);}(_0xffd6,0x97));var _0x6ffd=function(_0x1780f8,_0x11ba93){_0x1780f8=_0x1780f8-0x0;var _0x33a410=_0xffd6[_0x1780f8];return _0x33a410;};'use strict';var util=require(_0x6ffd('0x0'));var _=require(_0x6ffd('0x1'));var jayson=require(_0x6ffd('0x2'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x6ffd('0x3'));var db=require(_0x6ffd('0x4'))['db'];var client=jayson[_0x6ffd('0x5')]['http']({'port':0x232a});var routingClient=jayson[_0x6ffd('0x5')][_0x6ffd('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x3b8a46,_0x2949a4){return function(_0x561055){if(_0x561055){var _0x122b71=typeof _0x2949a4[_0x6ffd('0x7')]===_0x6ffd('0x8')&&typeof _0x2949a4[_0x6ffd('0x9')]===_0x6ffd('0x8');var _0x4a9f85=_0x561055[_0x6ffd('0xa')];var _0x417f34=_0x122b71?0x0:_0x2949a4['offset'];var _0x469d0d=_0x122b71?_0x561055[_0x6ffd('0xa')]:_0x2949a4[_0x6ffd('0x7')]+_0x2949a4[_0x6ffd('0x9')];var _0x262023;if(_0x469d0d>=_0x4a9f85){_0x469d0d=_0x4a9f85;_0x262023=0xc8;}else{_0x262023=0xce;}_0x3b8a46[_0x6ffd('0xb')](_0x262023);return _0x3b8a46[_0x6ffd('0xc')]('Content-Range',_0x417f34+'-'+_0x469d0d+'/'+_0x4a9f85)[_0x6ffd('0xd')](_0x561055);}return null;};}function handleError(_0x46936d,_0x5e8d6d){_0x5e8d6d=_0x5e8d6d||0x1f4;return function(_0x2d0b63){logger[_0x6ffd('0xe')](_0x2d0b63[_0x6ffd('0xf')]);if(_0x2d0b63[_0x6ffd('0x10')]){delete _0x2d0b63['name'];}_0x46936d[_0x6ffd('0xb')](_0x5e8d6d)['send'](_0x2d0b63);};}exports[_0x6ffd('0x11')]=function(_0x4d163f,_0xfd9569){var _0x261ed7=[_0x6ffd('0x12'),'chat',_0x6ffd('0x13'),_0x6ffd('0x14'),_0x6ffd('0x15'),_0x6ffd('0x16'),_0x6ffd('0x17')];var _0x19a772={'count':0x0,'rows':[]},_0x3f38e7={},_0x889a4b;Promise['resolve']()[_0x6ffd('0x18')](function(){if(_0x4d163f['query']['channel']){if(!_[_0x6ffd('0x19')](_0x261ed7,_0x4d163f[_0x6ffd('0x1a')]['channel'][_0x6ffd('0x1b')]()))throw new Error(_0x6ffd('0x1c'));_0x889a4b=_0x4d163f['query']['channel'][_0x6ffd('0x1b')]();}var _0x1c9d19=_['startCase'](_0x889a4b)+_0x6ffd('0x1d');var _0x39f25c=_[_0x6ffd('0x1e')](db[_0x1c9d19]['rawAttributes'],function(_0x3ba429){return{'name':_0x3ba429[_0x6ffd('0x1f')],'type':_0x3ba429['type'][_0x6ffd('0x20')]};});_0x3f38e7=qs[_0x6ffd('0x21')](_0x39f25c,_0x4d163f);if(_0x4d163f['user'][_0x6ffd('0x22')]===_0x6ffd('0x23')){var _0xb504e5={'params':{'id':_0x4d163f['user'][_0x6ffd('0x24')]},'query':{'section':_0x889a4b===_0x6ffd('0x17')&&_0x4d163f[_0x6ffd('0x1a')]['type']===_0x6ffd('0x25')?'QueueCampaigns':_[_0x6ffd('0x26')](_0x889a4b)+_0x6ffd('0x27'),'type':_0x4d163f['query']['type'],'nolimit':!![],'sort':_0x6ffd('0x10'),'filter':_0x4d163f[_0x6ffd('0x1a')][_0x6ffd('0x28')]}};return db['UserProfile']['getResources'](_0xb504e5);}return db[_0x1c9d19][_0x6ffd('0x29')](_0x3f38e7);})['then'](function(_0x470021){_0x19a772[_0x6ffd('0xa')]=_0x470021['count'];var _0x6b5aba=_0x889a4b===_0x6ffd('0x17')?client:routingClient;return _0x6b5aba[_0x6ffd('0x2a')](_[_0x6ffd('0x26')](_0x889a4b)+_0x6ffd('0x27'),_0x4d163f)[_0x6ffd('0x18')](function(_0x225c66){if(_0x225c66[_0x6ffd('0xe')])throw new Error(util[_0x6ffd('0x2b')](_0x6ffd('0x2c'),_0x889a4b));var _0x295a37=_0x225c66[_0x6ffd('0x2d')];var _0x2b9873=['loggedIn','available','waiting',_0x6ffd('0x2e'),_0x6ffd('0x2f')];if(_0x889a4b===_0x6ffd('0x17')&&_0x4d163f[_0x6ffd('0x1a')][_0x6ffd('0x30')]===_0x6ffd('0x25')){_0x2b9873[_0x6ffd('0x31')](_0x6ffd('0x32'),_0x6ffd('0x33'),_0x6ffd('0x34'),_0x6ffd('0x35'),_0x6ffd('0x36'),_0x6ffd('0x37'),'startPredictive',_0x6ffd('0x38'),_0x6ffd('0x39'),_0x6ffd('0x3a'),_0x6ffd('0x3b'),'erlangBusyFactor',_0x6ffd('0x3c'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0x6ffd('0x3d'),_0x6ffd('0x3e'),_0x6ffd('0x3f'),_0x6ffd('0x40'),'predictiveIntervalDroppedCallsCallersExit',_0x6ffd('0x41'),'predictiveIntervalAvgTalktime');}var _0x5848bb=_0x470021[_0x6ffd('0x42')][_0x6ffd('0x1e')](function(_0x399984){var _0x23fae4=_0x399984['get']({'plain':!![]});_0x23fae4['paused']=0x0;_0x23fae4[_0x6ffd('0x43')]=0x0;_0x23fae4['loggedIn']=0x0;_0x23fae4[_0x6ffd('0x44')]=0x0;_0x23fae4[_0x6ffd('0x2f')]=0x0;_0x23fae4[_0x6ffd('0x45')]=0x0;if(_0x889a4b===_0x6ffd('0x17')){_0x23fae4[_0x6ffd('0x2e')]=0x0;if(_0x4d163f[_0x6ffd('0x1a')]['type']===_0x6ffd('0x25')){_0x23fae4[_0x6ffd('0x32')]=0x0;_0x23fae4[_0x6ffd('0x33')]=0x0;}}_0x23fae4[_0x6ffd('0x46')]=[];var _0x4c536d=_[_0x6ffd('0x47')](_0x295a37['rows'],['id',_0x23fae4['id']]);if(_0x4c536d)_[_0x6ffd('0x48')](_0x23fae4,_[_0x6ffd('0x49')](_0x4c536d,_0x2b9873));if(_0x889a4b===_0x6ffd('0x17')){return _0x399984['getAgents']({'attributes':['id',_0x6ffd('0x10'),_0x6ffd('0x4a')],'joinTableAttributes':[],'raw':!![]})[_0x6ffd('0x18')](function(_0x27b6fd){return _0x399984[_0x6ffd('0x4b')]({'raw':!![]})[_0x6ffd('0x18')](function(_0x14608b){for(var _0x4da181=0x0;_0x4da181<_0x27b6fd['length'];_0x4da181++){var _0x595ceb=_[_0x6ffd('0x47')](_0x14608b,[_0x6ffd('0x4c'),_0x27b6fd[_0x4da181]['id']]);var _0x51ae8d={'id':_0x27b6fd[_0x4da181]['id'],'name':_0x27b6fd[_0x4da181][_0x6ffd('0x10')],'online':Boolean(_0x27b6fd[_0x4da181][_0x6ffd('0x4a')]),'paused':_0x595ceb?Boolean(_0x595ceb[_0x6ffd('0x2f')]):![]};if(_0x51ae8d[_0x6ffd('0x4a')])_0x23fae4['loggedInDb']++;if(_0x51ae8d[_0x6ffd('0x2f')])_0x23fae4[_0x6ffd('0x2f')]++;_0x23fae4[_0x6ffd('0x46')][_0x6ffd('0x31')](_0x51ae8d);}return _0x23fae4;});});}else{var _0x2b8a8e=_0x6ffd('0x4d')+_[_0x6ffd('0x26')](_0x889a4b)+_0x6ffd('0x1d');var _0x188a56=_0x889a4b+_0x6ffd('0x4e');return db[_0x2b8a8e][_0x6ffd('0x4f')]({'where':{[_['startCase'](_0x889a4b)+'QueueId']:_0x399984['id']},'raw':!![]})['then'](function(_0x440fb3){return db[_0x6ffd('0x4d')]['findAll']({'attributes':['id',_0x6ffd('0x10'),_0x6ffd('0x4a'),_0x188a56],'where':{'id':_[_0x6ffd('0x1e')](_0x440fb3,_0x6ffd('0x4c')),'role':_0x6ffd('0x50')},'raw':!![]});})['then'](function(_0x376864){for(var _0x28e9a1=0x0;_0x28e9a1<_0x376864[_0x6ffd('0x51')];_0x28e9a1++){var _0x495a8d={'id':_0x376864[_0x28e9a1]['id'],'name':_0x376864[_0x28e9a1][_0x6ffd('0x10')],'online':Boolean(_0x376864[_0x28e9a1][_0x6ffd('0x4a')]),'paused':Boolean(_0x376864[_0x28e9a1][_0x188a56])};if(_0x495a8d[_0x6ffd('0x4a')])_0x23fae4[_0x6ffd('0x43')]++;if(_0x495a8d[_0x6ffd('0x2f')])_0x23fae4[_0x6ffd('0x2f')]++;_0x23fae4['agents'][_0x6ffd('0x31')](_0x495a8d);}return _0x23fae4;});}});return Promise[_0x6ffd('0x52')](_0x5848bb);});})[_0x6ffd('0x18')](function(_0xbb803b){_0x19a772[_0x6ffd('0x42')]=_0xbb803b;return _0x19a772;})[_0x6ffd('0x18')](respondWithFilteredResult(_0xfd9569,_0x3f38e7))[_0x6ffd('0x53')](handleError(_0xfd9569,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index d467ff9..037dad5 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x545521,_0x3602a9){var _0x48907c=function(_0x2a5df8){while(--_0x2a5df8){_0x545521['push'](_0x545521['shift']());}};_0x48907c(++_0x3602a9);}(_0x70e0,0x17b));var _0x070e=function(_0x4c77f2,_0x220719){_0x4c77f2=_0x4c77f2-0x0;var _0x38e988=_0x70e0[_0x4c77f2];return _0x38e988;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x17315a,_0xec91b4){var _0x38f114=function(_0x3f88ae){while(--_0x3f88ae){_0x17315a['push'](_0x17315a['shift']());}};_0x38f114(++_0xec91b4);}(_0xe706,0xa3));var _0x6e70=function(_0x24ddf6,_0x114e56){_0x24ddf6=_0x24ddf6-0x0;var _0x393d70=_0xe706[_0x24ddf6];return _0x393d70;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index b7e0f17..9744b3e 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 _0xbe3b=['exports','INTEGER','DATE','STRING'];(function(_0x231828,_0x57b6c4){var _0x2598ed=function(_0x1f3953){while(--_0x1f3953){_0x231828['push'](_0x231828['shift']());}};_0x2598ed(++_0x57b6c4);}(_0xbe3b,0x19c));var _0xbbe3=function(_0x59f655,_0x1c12aa){_0x59f655=_0x59f655-0x0;var _0x1dbb6e=_0xbe3b[_0x59f655];return _0x1dbb6e;};'use strict';var Sequelize=require('sequelize');module[_0xbbe3('0x0')]={'state':{'type':Sequelize[_0xbbe3('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xbbe3('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xbbe3('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xbbe3('0x3')]},'membername':{'type':Sequelize[_0xbbe3('0x3')]}}; \ No newline at end of file +var _0x0f4d=['STRING','DATE','INTEGER'];(function(_0x124cbd,_0xf3a808){var _0x40a853=function(_0x4ed1d7){while(--_0x4ed1d7){_0x124cbd['push'](_0x124cbd['shift']());}};_0x40a853(++_0xf3a808);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x2a44ee,_0x4f0c65){_0x2a44ee=_0x2a44ee-0x0;var _0x36ceb4=_0x0f4d[_0x2a44ee];return _0x36ceb4;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xd0f4('0x0')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xd0f4('0x0')]},'starttime':{'type':Sequelize[_0xd0f4('0x1')]},'responsetime':{'type':Sequelize[_0xd0f4('0x1')]},'ringtime':{'type':Sequelize[_0xd0f4('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xd0f4('0x0')]},'campaigntype':{'type':Sequelize[_0xd0f4('0x0')]},'membername':{'type':Sequelize[_0xd0f4('0x0')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 0b1e5ae..998072b 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 _0x99d7=['bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment'];(function(_0x39e810,_0x44be39){var _0xddd88c=function(_0x595179){while(--_0x595179){_0x39e810['push'](_0x39e810['shift']());}};_0xddd88c(++_0x44be39);}(_0x99d7,0xfa));var _0x799d=function(_0x2993af,_0x47d0d6){_0x2993af=_0x2993af-0x0;var _0x5ca10f=_0x99d7[_0x2993af];return _0x5ca10f;};'use strict';var _=require(_0x799d('0x0'));var util=require(_0x799d('0x1'));var logger=require(_0x799d('0x2'))(_0x799d('0x3'));var moment=require(_0x799d('0x4'));var BPromise=require(_0x799d('0x5'));var rp=require(_0x799d('0x6'));var fs=require('fs');var path=require(_0x799d('0x7'));var rimraf=require(_0x799d('0x8'));var config=require(_0x799d('0x9'));var attributes=require(_0x799d('0xa'));module[_0x799d('0xb')]=function(_0x5a6e39,_0xd1830a){return _0x5a6e39[_0x799d('0xc')](_0x799d('0xd'),attributes,{'tableName':_0x799d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x14ac=['define','ReportAgentPreview','report_agent_preview','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports'];(function(_0x3951e5,_0x3532f4){var _0x5101aa=function(_0x205f85){while(--_0x205f85){_0x3951e5['push'](_0x3951e5['shift']());}};_0x5101aa(++_0x3532f4);}(_0x14ac,0xe0));var _0xc14a=function(_0x458a20,_0x206f85){_0x458a20=_0x458a20-0x0;var _0x3cce8a=_0x14ac[_0x458a20];return _0x3cce8a;};'use strict';var _=require(_0xc14a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc14a('0x1'));var moment=require(_0xc14a('0x2'));var BPromise=require(_0xc14a('0x3'));var rp=require(_0xc14a('0x4'));var fs=require('fs');var path=require(_0xc14a('0x5'));var rimraf=require(_0xc14a('0x6'));var config=require(_0xc14a('0x7'));var attributes=require(_0xc14a('0x8'));module[_0xc14a('0x9')]=function(_0xb272b2,_0x1c0a27){return _0xb272b2[_0xc14a('0xa')](_0xc14a('0xb'),attributes,{'tableName':_0xc14a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 4374f1c..b11511a 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 _0x9808=['CreateReportAgentPreview','ReportAgentPreview','create','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','catch'];(function(_0x28407a,_0x2a7269){var _0x8bd6ef=function(_0x3c886f){while(--_0x3c886f){_0x28407a['push'](_0x28407a['shift']());}};_0x8bd6ef(++_0x2a7269);}(_0x9808,0xb3));var _0x8980=function(_0x2534cf,_0x545be6){_0x2534cf=_0x2534cf-0x0;var _0x221461=_0x9808[_0x2534cf];return _0x221461;};'use strict';var _=require(_0x8980('0x0'));var util=require(_0x8980('0x1'));var moment=require(_0x8980('0x2'));var BPromise=require(_0x8980('0x3'));var rs=require(_0x8980('0x4'));var fs=require('fs');var Redis=require(_0x8980('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8980('0x6'));var logger=require(_0x8980('0x7'))('rpc');var config=require(_0x8980('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8980('0x9')][_0x8980('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4eaca3,_0x3e369c,_0x487a71){return new BPromise(function(_0x1b5cf0,_0x2f8aea){return client[_0x8980('0xb')](_0x4eaca3,_0x487a71)[_0x8980('0xc')](function(_0x343bdd){logger[_0x8980('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x3e369c,_0x8980('0xe'));logger[_0x8980('0xf')](_0x8980('0x10'),_0x3e369c,_0x8980('0xe'),JSON[_0x8980('0x11')](_0x343bdd));if(_0x343bdd['error']){if(_0x343bdd[_0x8980('0x12')][_0x8980('0x13')]===0x1f4){logger['error'](_0x8980('0x14'),_0x3e369c,_0x343bdd[_0x8980('0x12')][_0x8980('0x15')]);return _0x2f8aea(_0x343bdd[_0x8980('0x12')]['message']);}logger[_0x8980('0x12')](_0x8980('0x14'),_0x3e369c,_0x343bdd[_0x8980('0x12')][_0x8980('0x15')]);return _0x1b5cf0(_0x343bdd['error'][_0x8980('0x15')]);}else{logger[_0x8980('0xd')](_0x8980('0x14'),_0x3e369c,'request\x20sent');_0x1b5cf0(_0x343bdd[_0x8980('0x16')][_0x8980('0x15')]);}})[_0x8980('0x17')](function(_0x4b84c2){logger[_0x8980('0x12')](_0x8980('0x14'),_0x3e369c,_0x4b84c2);_0x2f8aea(_0x4b84c2);});});}exports[_0x8980('0x18')]=function(_0x456e1d){var _0x490d21=this;return new Promise(function(_0xcc787,_0xf0ba4d){return db[_0x8980('0x19')][_0x8980('0x1a')](_0x456e1d[_0x8980('0x1b')],{'raw':_0x456e1d[_0x8980('0x1c')]?_0x456e1d[_0x8980('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4527f0){logger[_0x8980('0xd')](_0x8980('0x18'),_0x456e1d);logger[_0x8980('0xf')](_0x8980('0x18'),_0x456e1d,JSON[_0x8980('0x11')](_0x4527f0));_0xcc787(_0x4527f0);})['catch'](function(_0x453749){logger[_0x8980('0x12')](_0x8980('0x18'),_0x453749[_0x8980('0x15')],_0x456e1d);_0xf0ba4d(_0x490d21[_0x8980('0x12')](0x1f4,_0x453749['message']));});});}; \ No newline at end of file +var _0x5670=['message','result','catch','ReportAgentPreview','body','options','then','CreateReportAgentPreview','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2e7a43,_0x3b3df4){var _0x52e9e1=function(_0x2c08cf){while(--_0x2c08cf){_0x2e7a43['push'](_0x2e7a43['shift']());}};_0x52e9e1(++_0x3b3df4);}(_0x5670,0xaa));var _0x0567=function(_0x38b313,_0x4c5217){_0x38b313=_0x38b313-0x0;var _0x5d393d=_0x5670[_0x38b313];return _0x5d393d;};'use strict';var _=require(_0x0567('0x0'));var util=require(_0x0567('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0567('0x2'));var fs=require('fs');var Redis=require(_0x0567('0x3'));var db=require(_0x0567('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0567('0x5'));var config=require(_0x0567('0x6'));var jayson=require(_0x0567('0x7'));var client=jayson[_0x0567('0x8')][_0x0567('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2936bb,_0x38cf7c,_0x55bf61){return new BPromise(function(_0x5e1dcc,_0x3e9f22){return client[_0x0567('0xa')](_0x2936bb,_0x55bf61)['then'](function(_0xe7f032){logger[_0x0567('0xb')](_0x0567('0xc'),_0x38cf7c,'request\x20sent');logger[_0x0567('0xd')](_0x0567('0xe'),_0x38cf7c,_0x0567('0xf'),JSON[_0x0567('0x10')](_0xe7f032));if(_0xe7f032[_0x0567('0x11')]){if(_0xe7f032['error'][_0x0567('0x12')]===0x1f4){logger[_0x0567('0x11')](_0x0567('0xc'),_0x38cf7c,_0xe7f032[_0x0567('0x11')][_0x0567('0x13')]);return _0x3e9f22(_0xe7f032[_0x0567('0x11')][_0x0567('0x13')]);}logger[_0x0567('0x11')](_0x0567('0xc'),_0x38cf7c,_0xe7f032[_0x0567('0x11')][_0x0567('0x13')]);return _0x5e1dcc(_0xe7f032['error']['message']);}else{logger[_0x0567('0xb')](_0x0567('0xc'),_0x38cf7c,'request\x20sent');_0x5e1dcc(_0xe7f032[_0x0567('0x14')][_0x0567('0x13')]);}})[_0x0567('0x15')](function(_0x138780){logger[_0x0567('0x11')](_0x0567('0xc'),_0x38cf7c,_0x138780);_0x3e9f22(_0x138780);});});}exports['CreateReportAgentPreview']=function(_0x21ec74){var _0x462963=this;return new Promise(function(_0x4632bb,_0x209a50){return db[_0x0567('0x16')]['create'](_0x21ec74[_0x0567('0x17')],{'raw':_0x21ec74[_0x0567('0x18')]?_0x21ec74[_0x0567('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x0567('0x19')](function(_0x1adaac){logger[_0x0567('0xb')]('CreateReportAgentPreview',_0x21ec74);logger[_0x0567('0xd')]('CreateReportAgentPreview',_0x21ec74,JSON[_0x0567('0x10')](_0x1adaac));_0x4632bb(_0x1adaac);})['catch'](function(_0x185daf){logger[_0x0567('0x11')](_0x0567('0x1a'),_0x185daf[_0x0567('0x13')],_0x21ec74);_0x209a50(_0x462963[_0x0567('0x11')](0x1f4,_0x185daf[_0x0567('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index b449ea0..79fc902 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 _0xb306=['outboundChannels','agents','/agents/:id/capacity','agentCapacity','telephones','/trunks','trunks','/campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','showChatQueues','post','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','util','path','express','Router','../../components/auth/service','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','/chat/queues','/mail/queues','mailQueues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/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','put','updateVoiceQueue','outbound','/outbound/channels'];(function(_0x14eaba,_0x3c9bed){var _0x52e428=function(_0x3f51de){while(--_0x3f51de){_0x14eaba['push'](_0x14eaba['shift']());}};_0x52e428(++_0x3c9bed);}(_0xb306,0x132));var _0x6b30=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb306[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x6b30('0x0'));var path=require(_0x6b30('0x1'));var express=require(_0x6b30('0x2'));var router=express[_0x6b30('0x3')]();var auth=require(_0x6b30('0x4'));var controller=require('./rpc.controller');router[_0x6b30('0x5')](_0x6b30('0x6'),auth[_0x6b30('0x7')](),controller[_0x6b30('0x8')]);router['get'](_0x6b30('0x9'),auth[_0x6b30('0x7')](),controller[_0x6b30('0xa')]);router[_0x6b30('0x5')](_0x6b30('0xb'),auth[_0x6b30('0x7')](),controller['voiceChannelStopMixMonitor']);router[_0x6b30('0x5')](_0x6b30('0xc'),auth[_0x6b30('0x7')](),controller['voiceQueues']);router['get'](_0x6b30('0xd'),auth[_0x6b30('0x7')](),controller['chatQueues']);router[_0x6b30('0x5')](_0x6b30('0xe'),auth['isAuthenticated'](),controller[_0x6b30('0xf')]);router[_0x6b30('0x5')]('/mail/accounts',auth[_0x6b30('0x7')](),controller['mailAccounts']);router[_0x6b30('0x5')]('/openchannel/queues',auth[_0x6b30('0x7')](),controller[_0x6b30('0x10')]);router[_0x6b30('0x5')](_0x6b30('0x11'),auth[_0x6b30('0x7')](),controller[_0x6b30('0x12')]);router[_0x6b30('0x5')](_0x6b30('0x13'),auth['isAuthenticated'](),controller[_0x6b30('0x14')]);router['get'](_0x6b30('0x15'),auth['isAuthenticated'](),controller[_0x6b30('0x16')]);router['get']('/voice/queues/preview/:id',auth[_0x6b30('0x7')](),controller[_0x6b30('0x17')]);router[_0x6b30('0x5')](_0x6b30('0x18'),auth['isAuthenticated'](),controller[_0x6b30('0x19')]);router[_0x6b30('0x5')](_0x6b30('0x1a'),auth[_0x6b30('0x7')](),controller[_0x6b30('0x1b')]);router[_0x6b30('0x5')](_0x6b30('0x1c'),auth[_0x6b30('0x7')](),controller[_0x6b30('0x1d')]);router['get'](_0x6b30('0x1e'),auth['isAuthenticated'](),controller[_0x6b30('0x1f')]);router[_0x6b30('0x5')](_0x6b30('0x20'),auth[_0x6b30('0x7')](),controller[_0x6b30('0x21')]);router[_0x6b30('0x22')](_0x6b30('0x20'),auth[_0x6b30('0x7')](),controller[_0x6b30('0x23')]);router['get']('/outbound',auth[_0x6b30('0x7')](),controller[_0x6b30('0x24')]);router[_0x6b30('0x5')](_0x6b30('0x25'),auth[_0x6b30('0x7')](),controller[_0x6b30('0x26')]);router[_0x6b30('0x5')]('/agents',auth[_0x6b30('0x7')](),controller[_0x6b30('0x27')]);router[_0x6b30('0x22')](_0x6b30('0x28'),auth[_0x6b30('0x7')](),controller[_0x6b30('0x29')]);router[_0x6b30('0x5')]('/telephones',auth['isAuthenticated'](),controller[_0x6b30('0x2a')]);router[_0x6b30('0x5')](_0x6b30('0x2b'),auth[_0x6b30('0x7')](),controller[_0x6b30('0x2c')]);router[_0x6b30('0x5')](_0x6b30('0x2d'),auth[_0x6b30('0x7')](),controller['campaigns']);router[_0x6b30('0x5')]('/fax/accounts',auth[_0x6b30('0x7')](),controller[_0x6b30('0x2e')]);router[_0x6b30('0x5')](_0x6b30('0x2f'),auth['isAuthenticated'](),controller[_0x6b30('0x30')]);router[_0x6b30('0x5')](_0x6b30('0x31'),auth[_0x6b30('0x7')](),controller[_0x6b30('0x32')]);router[_0x6b30('0x5')](_0x6b30('0x33'),auth[_0x6b30('0x7')](),controller[_0x6b30('0x34')]);router['get'](_0x6b30('0x35'),auth['isAuthenticated'](),controller[_0x6b30('0x36')]);router[_0x6b30('0x5')](_0x6b30('0x37'),auth[_0x6b30('0x7')](),controller[_0x6b30('0x38')]);router[_0x6b30('0x5')](_0x6b30('0x39'),auth[_0x6b30('0x7')](),controller[_0x6b30('0x3a')]);router[_0x6b30('0x5')](_0x6b30('0x3b'),auth[_0x6b30('0x7')](),controller['faxQueuesWaitingInteractions']);router['post']('/mail/queues/:id/notify',auth[_0x6b30('0x7')](),controller['queueNotify'](_0x6b30('0x3c')));router[_0x6b30('0x5')](_0x6b30('0x3d'),auth[_0x6b30('0x7')](),controller[_0x6b30('0x3e')]);router['post'](_0x6b30('0x3f'),auth['isAuthenticated'](),controller[_0x6b30('0x40')](_0x6b30('0x41')));router[_0x6b30('0x5')](_0x6b30('0x42'),auth['isAuthenticated'](),controller[_0x6b30('0x43')]);router[_0x6b30('0x44')](_0x6b30('0x45'),auth[_0x6b30('0x7')](),controller[_0x6b30('0x40')](_0x6b30('0x46')));router['get'](_0x6b30('0x47'),auth['isAuthenticated'](),controller[_0x6b30('0x48')]);router[_0x6b30('0x44')](_0x6b30('0x49'),auth[_0x6b30('0x7')](),controller[_0x6b30('0x40')](_0x6b30('0x4a')));router[_0x6b30('0x5')](_0x6b30('0x4b'),auth[_0x6b30('0x7')](),controller[_0x6b30('0x4c')]);router[_0x6b30('0x44')]('/sms/queues/:id/notify',auth[_0x6b30('0x7')](),controller[_0x6b30('0x40')](_0x6b30('0x4d')));router[_0x6b30('0x44')](_0x6b30('0x4e'),auth[_0x6b30('0x7')](),controller[_0x6b30('0x40')]('whatsapp'));router['get'](_0x6b30('0x4f'),auth[_0x6b30('0x7')](),controller[_0x6b30('0x50')]);router['get'](_0x6b30('0x51'),auth[_0x6b30('0x7')](),controller[_0x6b30('0x52')]);router[_0x6b30('0x44')](_0x6b30('0x53'),auth[_0x6b30('0x7')](),controller[_0x6b30('0x54')]);module[_0x6b30('0x55')]=router; \ No newline at end of file +var _0x87f8=['/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','updateVoiceQueue','/outbound','/outbound/channels','/agents','/agents/:id/capacity','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','isAuthenticated','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x87f8,0x11f));var _0x887f=function(_0x221916,_0x307415){_0x221916=_0x221916-0x0;var _0x99cb72=_0x87f8[_0x221916];return _0x99cb72;};'use strict';var multer=require(_0x887f('0x0'));var util=require(_0x887f('0x1'));var path=require(_0x887f('0x2'));var express=require(_0x887f('0x3'));var router=express[_0x887f('0x4')]();var auth=require(_0x887f('0x5'));var controller=require(_0x887f('0x6'));router[_0x887f('0x7')]('/voice/channels',auth['isAuthenticated'](),controller['voiceChannels']);router[_0x887f('0x7')](_0x887f('0x8'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router['get'](_0x887f('0x9'),auth['isAuthenticated'](),controller[_0x887f('0xa')]);router[_0x887f('0x7')](_0x887f('0xb'),auth[_0x887f('0xc')](),controller[_0x887f('0xd')]);router['get'](_0x887f('0xe'),auth['isAuthenticated'](),controller[_0x887f('0xf')]);router[_0x887f('0x7')](_0x887f('0x10'),auth[_0x887f('0xc')](),controller[_0x887f('0x11')]);router[_0x887f('0x7')]('/mail/accounts',auth[_0x887f('0xc')](),controller[_0x887f('0x12')]);router['get'](_0x887f('0x13'),auth[_0x887f('0xc')](),controller[_0x887f('0x14')]);router[_0x887f('0x7')](_0x887f('0x15'),auth[_0x887f('0xc')](),controller[_0x887f('0x16')]);router[_0x887f('0x7')](_0x887f('0x17'),auth['isAuthenticated'](),controller[_0x887f('0x18')]);router[_0x887f('0x7')]('/fax/queues',auth[_0x887f('0xc')](),controller[_0x887f('0x19')]);router[_0x887f('0x7')]('/voice/queues/preview/:id',auth[_0x887f('0xc')](),controller[_0x887f('0x1a')]);router[_0x887f('0x7')]('/voice/queues/channels',auth[_0x887f('0xc')](),controller[_0x887f('0x1b')]);router['get'](_0x887f('0x1c'),auth['isAuthenticated'](),controller[_0x887f('0x1d')]);router[_0x887f('0x7')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x887f('0xc')](),controller['voiceQueuesChannelHangup']);router[_0x887f('0x7')](_0x887f('0x1e'),auth[_0x887f('0xc')](),controller[_0x887f('0x1f')]);router[_0x887f('0x7')]('/voice/queues/:id',auth['isAuthenticated'](),controller[_0x887f('0x20')]);router[_0x887f('0x21')]('/voice/queues/:id',auth['isAuthenticated'](),controller[_0x887f('0x22')]);router[_0x887f('0x7')](_0x887f('0x23'),auth['isAuthenticated'](),controller['outbound']);router[_0x887f('0x7')](_0x887f('0x24'),auth[_0x887f('0xc')](),controller['outboundChannels']);router[_0x887f('0x7')](_0x887f('0x25'),auth[_0x887f('0xc')](),controller['agents']);router[_0x887f('0x21')](_0x887f('0x26'),auth['isAuthenticated'](),controller['agentCapacity']);router[_0x887f('0x7')]('/telephones',auth[_0x887f('0xc')](),controller['telephones']);router[_0x887f('0x7')](_0x887f('0x27'),auth['isAuthenticated'](),controller[_0x887f('0x28')]);router[_0x887f('0x7')](_0x887f('0x29'),auth[_0x887f('0xc')](),controller[_0x887f('0x2a')]);router[_0x887f('0x7')](_0x887f('0x2b'),auth['isAuthenticated'](),controller[_0x887f('0x2c')]);router[_0x887f('0x7')](_0x887f('0x2d'),auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router[_0x887f('0x7')](_0x887f('0x2e'),auth[_0x887f('0xc')](),controller[_0x887f('0x2f')]);router[_0x887f('0x7')](_0x887f('0x30'),auth['isAuthenticated'](),controller[_0x887f('0x31')]);router[_0x887f('0x7')]('/openchannel/queues/:id/waitinginteractions',auth[_0x887f('0xc')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x887f('0x7')](_0x887f('0x32'),auth[_0x887f('0xc')](),controller[_0x887f('0x33')]);router[_0x887f('0x7')](_0x887f('0x34'),auth[_0x887f('0xc')](),controller[_0x887f('0x35')]);router[_0x887f('0x7')]('/fax/queues/waitinginteractions',auth[_0x887f('0xc')](),controller[_0x887f('0x36')]);router[_0x887f('0x37')](_0x887f('0x38'),auth['isAuthenticated'](),controller[_0x887f('0x39')](_0x887f('0x3a')));router[_0x887f('0x7')](_0x887f('0x3b'),auth[_0x887f('0xc')](),controller[_0x887f('0x3c')]);router[_0x887f('0x37')](_0x887f('0x3d'),auth['isAuthenticated'](),controller['queueNotify']('chat'));router[_0x887f('0x7')](_0x887f('0x3e'),auth[_0x887f('0xc')](),controller[_0x887f('0x3f')]);router[_0x887f('0x37')](_0x887f('0x40'),auth[_0x887f('0xc')](),controller[_0x887f('0x39')](_0x887f('0x41')));router[_0x887f('0x7')](_0x887f('0x42'),auth[_0x887f('0xc')](),controller[_0x887f('0x43')]);router[_0x887f('0x37')](_0x887f('0x44'),auth[_0x887f('0xc')](),controller[_0x887f('0x39')]('openchannel'));router[_0x887f('0x7')](_0x887f('0x45'),auth[_0x887f('0xc')](),controller['showOpenchannelQueues']);router[_0x887f('0x37')](_0x887f('0x46'),auth[_0x887f('0xc')](),controller['queueNotify'](_0x887f('0x47')));router[_0x887f('0x37')](_0x887f('0x48'),auth['isAuthenticated'](),controller[_0x887f('0x39')](_0x887f('0x49')));router[_0x887f('0x7')]('/sms/queues/:id',auth[_0x887f('0xc')](),controller[_0x887f('0x4a')]);router[_0x887f('0x7')](_0x887f('0x4b'),auth[_0x887f('0xc')](),controller['showWhatsappQueues']);router[_0x887f('0x37')]('/agents/:id/notify',auth[_0x887f('0xc')](),controller['agentNotify']);module[_0x887f('0x4c')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 45e4c2d..50ed786 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 _0x24ca=['telephones','Telephones','trunks','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Interaction','update','queue','MessageId','InteractionId','From','QueueId','Start','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','TransferReport','create','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','api','jayson/promise','client','http','request','error','code','message','result','json','sendStatus','stack','status','send','isNil','rows','voiceChannels','VoiceChannels','query','then','VoiceChannelMixMonitor','merge','params','catch','VoiceQueues','showVoiceQueues','updateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','name','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity'];(function(_0x106e02,_0x3664fe){var _0x15e21c=function(_0x4d47d2){while(--_0x4d47d2){_0x106e02['push'](_0x106e02['shift']());}};_0x15e21c(++_0x3664fe);}(_0x24ca,0x1bc));var _0xa24c=function(_0x4854d6,_0x2f1264){_0x4854d6=_0x4854d6-0x0;var _0x3885c0=_0x24ca[_0x4854d6];return _0x3885c0;};'use strict';var BPromise=require(_0xa24c('0x0'));var moment=require('moment');var _=require(_0xa24c('0x1'));var util=require(_0xa24c('0x2'));var db=require(_0xa24c('0x3'))['db'];var logger=require('../../config/logger')(_0xa24c('0x4'));var jayson=require(_0xa24c('0x5'));var amiClient=jayson[_0xa24c('0x6')][_0xa24c('0x7')]({'port':0x232a});var mailClient=jayson[_0xa24c('0x6')][_0xa24c('0x7')]({'port':0x232b});var routingClient=jayson[_0xa24c('0x6')][_0xa24c('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x2dd348,_0x257264,_0x9a5013){return new BPromise(function(_0x481196,_0x42d89c){var _0x3a5727=_0x9a5013?_0x9a5013:amiClient;return _0x3a5727[_0xa24c('0x8')](_0x2dd348,_0x257264)['then'](function(_0x399f32){if(_0x399f32[_0xa24c('0x9')]){if(_0x399f32[_0xa24c('0x9')][_0xa24c('0xa')]===0x1f4){return _0x42d89c(_0x399f32[_0xa24c('0x9')][_0xa24c('0xb')]);}return _0x481196(_0x399f32[_0xa24c('0x9')][_0xa24c('0xb')]);}else{_0x481196(_0x399f32[_0xa24c('0xc')]);}})['catch'](function(_0x43bcd3){_0x42d89c(_0x43bcd3);});});}function respondWithResult(_0x11090c,_0xcee4fe){_0xcee4fe=_0xcee4fe||0xc8;return function(_0x2c2af8){if(_0x2c2af8){return _0x11090c['status'](_0xcee4fe)[_0xa24c('0xd')](_0x2c2af8);}return _0x11090c[_0xa24c('0xe')](0x194);};}function handleError(_0x26ff28,_0x2fcd8b){_0x2fcd8b=_0x2fcd8b||0x1f4;return function(_0x1cb08e){logger[_0xa24c('0x9')](_0x1cb08e[_0xa24c('0xf')]);if(_0x1cb08e['name']){delete _0x1cb08e['name'];}_0x26ff28[_0xa24c('0x10')](_0x2fcd8b)[_0xa24c('0x11')](_0x1cb08e);};}function findById(_0x49ce53){return function(_0x5babb5){if(!_[_0xa24c('0x12')](_0x49ce53)&&!_[_0xa24c('0x12')](_0x5babb5)&&!_['isNil'](_0x5babb5[_0xa24c('0x13')])){return _['find'](_0x5babb5[_0xa24c('0x13')],function(_0x2a610a){return _0x2a610a['id']==_0x49ce53;});}return null;};}exports[_0xa24c('0x14')]=function(_0xefdbd9,_0x4ff97c){return respondWithRpcPromise(_0xa24c('0x15'),_0xefdbd9[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x4ff97c,null))['catch'](handleError(_0x4ff97c,null));};exports['voiceChannelMixMonitor']=function(_0x506424,_0x4cd77e){return respondWithRpcPromise(_0xa24c('0x18'),_[_0xa24c('0x19')](_0x506424[_0xa24c('0x16')],_0x506424[_0xa24c('0x1a')]))['then'](respondWithResult(_0x4cd77e,null))[_0xa24c('0x1b')](handleError(_0x4cd77e,null));};exports['voiceChannelStopMixMonitor']=function(_0x224bca,_0xb81d97){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0xa24c('0x19')](_0x224bca[_0xa24c('0x16')],_0x224bca[_0xa24c('0x1a')]))[_0xa24c('0x17')](respondWithResult(_0xb81d97,null))[_0xa24c('0x1b')](handleError(_0xb81d97,null));};exports['voiceQueues']=function(_0xec9167,_0x5cc9cb){return respondWithRpcPromise(_0xa24c('0x1c'),_0xec9167[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x5cc9cb,null))['catch'](handleError(_0x5cc9cb,null));};exports[_0xa24c('0x1d')]=function(_0x31c4d9,_0x14fd5a){return respondWithRpcPromise(_0xa24c('0x1c'),_0x31c4d9[_0xa24c('0x16')])[_0xa24c('0x17')](findById(_0x31c4d9[_0xa24c('0x1a')]['id']))['then'](respondWithResult(_0x14fd5a,null))[_0xa24c('0x1b')](handleError(_0x14fd5a,null));};exports[_0xa24c('0x1e')]=function(_0x152120,_0x12dbdc){return respondWithRpcPromise('UpdateVoiceQueue',_[_0xa24c('0x19')](_0x152120[_0xa24c('0x1f')],_0x152120[_0xa24c('0x1a')]))['then'](respondWithResult(_0x12dbdc,null))[_0xa24c('0x1b')](handleError(_0x12dbdc,null));};exports[_0xa24c('0x20')]=function(_0x253d83,_0x4ae35c){return respondWithRpcPromise(_0xa24c('0x21'),_['merge'](_0x253d83[_0xa24c('0x16')],_0x253d83[_0xa24c('0x1a')]))[_0xa24c('0x17')](respondWithResult(_0x4ae35c,null))['catch'](handleError(_0x4ae35c,null));};exports[_0xa24c('0x22')]=function(_0x53f90,_0x1d0379){return respondWithRpcPromise('VoiceQueuesChannels',_0x53f90[_0xa24c('0x16')])['then'](respondWithResult(_0x1d0379,null))[_0xa24c('0x1b')](handleError(_0x1d0379,null));};exports[_0xa24c('0x23')]=function(_0x592198,_0x5680f5){return respondWithRpcPromise(_0xa24c('0x24'),_[_0xa24c('0x19')](_0x592198[_0xa24c('0x16')],_0x592198[_0xa24c('0x1a')]))[_0xa24c('0x17')](respondWithResult(_0x5680f5,null))[_0xa24c('0x1b')](handleError(_0x5680f5,null));};exports[_0xa24c('0x25')]=function(_0x4b4dc2,_0x39f146){return respondWithRpcPromise(_0xa24c('0x26'),_[_0xa24c('0x19')](_0x4b4dc2[_0xa24c('0x16')],_0x4b4dc2[_0xa24c('0x1a')]))[_0xa24c('0x17')](respondWithResult(_0x39f146,null))[_0xa24c('0x1b')](handleError(_0x39f146,null));};exports[_0xa24c('0x27')]=function(_0x1ea166,_0x129bb9){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xa24c('0x19')](_0x1ea166[_0xa24c('0x16')],_0x1ea166[_0xa24c('0x1a')]))[_0xa24c('0x17')](respondWithResult(_0x129bb9,null))['catch'](handleError(_0x129bb9,null));};exports['outbound']=function(_0x19a65f,_0x56ef4d){return respondWithRpcPromise(_0xa24c('0x28'),_0x19a65f[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x56ef4d,null))[_0xa24c('0x1b')](handleError(_0x56ef4d,null));};exports[_0xa24c('0x29')]=function(_0x4c0fb9,_0x532875){return respondWithRpcPromise(_0xa24c('0x2a'),_0x4c0fb9[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x532875,null))[_0xa24c('0x1b')](handleError(_0x532875,null));};exports[_0xa24c('0x2b')]=function(_0x472912,_0x5080d0){var _0x56f392;return respondWithRpcPromise(_0xa24c('0x2c'),_0x472912[_0xa24c('0x16')])[_0xa24c('0x17')](function(_0x2101f8){_0x56f392=_0x2101f8;return respondWithRpcPromise(_0xa24c('0x2c'),_0x472912['query'],routingClient);})[_0xa24c('0x17')](function(_0x7895e){return _['merge']({},_0x7895e,_0x56f392);})['then'](respondWithResult(_0x5080d0,null))[_0xa24c('0x1b')](handleError(_0x5080d0,null));};exports[_0xa24c('0x2d')]=function(_0x231eea,_0x537849){if(_0x231eea['body']&&_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')]&&_0x231eea[_0xa24c('0x2f')]&&_0x231eea[_0xa24c('0x2f')][_0xa24c('0x30')]){for(var _0x1b7faf in _0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')]){if(_0x231eea['body']['interaction'][_0xa24c('0x31')](_0x1b7faf)){db[_0xa24c('0x32')][_0xa24c('0x33')]({'where':{'channel':_0x1b7faf,'membername':_0x231eea['user'][_0xa24c('0x30')],'type':_0xa24c('0x34'),'exitAt':null,'uniqueid':_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')][_0x1b7faf]&&_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')][_0x1b7faf][_0xa24c('0x35')]?{'$notIn':_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')][_0x1b7faf]}:{'$ne':null}}})[_0xa24c('0x17')](function(_0x4bbf93){var _0xb8c7a5=moment()[_0xa24c('0x36')](_0xa24c('0x37'));for(var _0x5aa2b2=0x0,_0x3a85cb=_0x4bbf93[_0xa24c('0x35')];_0x5aa2b2<_0x3a85cb;_0x5aa2b2+=0x1){_0x4bbf93[_0x5aa2b2][_0xa24c('0x38')]({'exitAt':_0xb8c7a5});}});for(var _0x31f05b=0x0;_0x31f05b<_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')][_0x1b7faf][_0xa24c('0x35')];_0x31f05b+=0x1){db[_0xa24c('0x32')][_0xa24c('0x39')]({'where':{'channel':_0x1b7faf,'membername':_0x231eea[_0xa24c('0x2f')][_0xa24c('0x30')],'type':'INTERACTION','uniqueid':_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')][_0x1b7faf][_0x31f05b],'exitAt':null},'defaults':{'channel':_0x1b7faf,'membername':_0x231eea[_0xa24c('0x2f')][_0xa24c('0x30')],'interface':_[_0xa24c('0x12')](_0x231eea[_0xa24c('0x2f')][_0xa24c('0x3a')])?util[_0xa24c('0x36')](_0xa24c('0x3b'),_0x231eea['user']['name']):_0x231eea[_0xa24c('0x2f')]['interface'],'type':_0xa24c('0x34'),'enterAt':moment()[_0xa24c('0x36')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xa24c('0x3c'),'internal':_0x231eea[_0xa24c('0x2f')][_0xa24c('0x3d')],'uniqueid':_0x231eea['body']['interaction'][_0x1b7faf][_0x31f05b]}});}}}}return respondWithRpcPromise(_0xa24c('0x3e'),{'id':_0x231eea['params']['id'],'capacity':_0x231eea[_0xa24c('0x1f')][_0xa24c('0x3f')]},routingClient)[_0xa24c('0x17')](respondWithResult(_0x537849,null))[_0xa24c('0x1b')](handleError(_0x537849,null));};exports[_0xa24c('0x40')]=function(_0x1fa739,_0x3f3ce6){return respondWithRpcPromise(_0xa24c('0x41'),_0x1fa739[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x3f3ce6,null))['catch'](handleError(_0x3f3ce6,null));};exports[_0xa24c('0x42')]=function(_0x2759c1,_0x233f8e){return respondWithRpcPromise('Trunks',_0x2759c1['query'])['then'](respondWithResult(_0x233f8e,null))[_0xa24c('0x1b')](handleError(_0x233f8e,null));};exports['campaigns']=function(_0x4757ff,_0x21d0fc){return respondWithRpcPromise('Campaigns',_0x4757ff[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x21d0fc,null))[_0xa24c('0x1b')](handleError(_0x21d0fc,null));};exports[_0xa24c('0x43')]=function(_0x162a11,_0x3a72e3){return respondWithRpcPromise(_0xa24c('0x44'),_0x162a11[_0xa24c('0x16')],routingClient)['then'](respondWithResult(_0x3a72e3,null))[_0xa24c('0x1b')](handleError(_0x3a72e3,null));};exports['showChatQueues']=function(_0x5abd45,_0x565f0a){return respondWithRpcPromise('ChatQueues',_0x5abd45['query'],routingClient)[_0xa24c('0x17')](findById(_0x5abd45['params']['id']))[_0xa24c('0x17')](respondWithResult(_0x565f0a,null))[_0xa24c('0x1b')](handleError(_0x565f0a,null));};exports[_0xa24c('0x45')]=function(_0x1a5f17,_0xa371d2){return respondWithRpcPromise(_0xa24c('0x46'),_0x1a5f17[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0xa371d2,null))[_0xa24c('0x1b')](handleError(_0xa371d2,null));};exports[_0xa24c('0x47')]=function(_0x303b7d,_0x37dbbd){return respondWithRpcPromise(_0xa24c('0x46'),_0x303b7d[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](findById(_0x303b7d['params']['id']))[_0xa24c('0x17')](respondWithResult(_0x37dbbd,null))[_0xa24c('0x1b')](handleError(_0x37dbbd,null));};exports['mailAccounts']=function(_0x1e08bb,_0x179ae1){return respondWithRpcPromise(_0xa24c('0x48'),_0x1e08bb[_0xa24c('0x16')],mailClient)['then'](respondWithResult(_0x179ae1,null))['catch'](handleError(_0x179ae1,null));};exports[_0xa24c('0x49')]=function(_0x5e9631,_0x486040){return respondWithRpcPromise(_0xa24c('0x4a'),_0x5e9631[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x486040,null))[_0xa24c('0x1b')](handleError(_0x486040,null));};exports['showOpenchannelQueues']=function(_0x48a7b2,_0x29b836){return respondWithRpcPromise('OpenchannelQueues',_0x48a7b2['query'],routingClient)[_0xa24c('0x17')](findById(_0x48a7b2[_0xa24c('0x1a')]['id']))[_0xa24c('0x17')](respondWithResult(_0x29b836,null))['catch'](handleError(_0x29b836,null));};exports[_0xa24c('0x4b')]=function(_0x128e5b,_0x5c3285){return respondWithRpcPromise(_0xa24c('0x4c'),_0x128e5b[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x5c3285,null))['catch'](handleError(_0x5c3285,null));};exports[_0xa24c('0x4d')]=function(_0x34e261,_0x21439a){return respondWithRpcPromise(_0xa24c('0x4c'),_0x34e261[_0xa24c('0x16')],routingClient)['then'](findById(_0x34e261[_0xa24c('0x1a')]['id']))[_0xa24c('0x17')](respondWithResult(_0x21439a,null))[_0xa24c('0x1b')](handleError(_0x21439a,null));};exports[_0xa24c('0x4e')]=function(_0xab5260,_0x2ca3fa){return respondWithRpcPromise(_0xa24c('0x4f'),_0xab5260['query'],routingClient)[_0xa24c('0x17')](respondWithResult(_0x2ca3fa,null))[_0xa24c('0x1b')](handleError(_0x2ca3fa,null));};exports['showWhatsappQueues']=function(_0xb1048a,_0x3e455b){return respondWithRpcPromise(_0xa24c('0x4f'),_0xb1048a[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](findById(_0xb1048a[_0xa24c('0x1a')]['id']))[_0xa24c('0x17')](respondWithResult(_0x3e455b,null))[_0xa24c('0x1b')](handleError(_0x3e455b,null));};exports[_0xa24c('0x50')]=function(_0x32ddc3,_0x50141e){return respondWithRpcPromise(_0xa24c('0x51'),_0x32ddc3[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x50141e,null))['catch'](handleError(_0x50141e,null));};exports[_0xa24c('0x52')]=function(_0xfd57fb,_0x2cc592){return respondWithRpcPromise('FaxQueues',_0xfd57fb[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](findById(_0xfd57fb[_0xa24c('0x1a')]['id']))[_0xa24c('0x17')](respondWithResult(_0x2cc592,null))[_0xa24c('0x1b')](handleError(_0x2cc592,null));};exports[_0xa24c('0x53')]=function(_0x4f9b56,_0x4c374d){return respondWithRpcPromise(_0xa24c('0x54'),_0x4f9b56['query'])[_0xa24c('0x17')](respondWithResult(_0x4c374d,null))[_0xa24c('0x1b')](handleError(_0x4c374d,null));};exports[_0xa24c('0x55')]=function(_0x4073c5,_0x12d715){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x4073c5[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x12d715,null))[_0xa24c('0x1b')](handleError(_0x12d715,null));};exports[_0xa24c('0x56')]=function(_0x987aca,_0x389c08){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x987aca[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x389c08,null))[_0xa24c('0x1b')](handleError(_0x389c08,null));};exports[_0xa24c('0x57')]=function(_0x5ebdd1,_0x403bf1){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x5ebdd1[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x403bf1,null))[_0xa24c('0x1b')](handleError(_0x403bf1,null));};exports[_0xa24c('0x58')]=function(_0x5726e1,_0x2e612d){return respondWithRpcPromise(_0xa24c('0x59'),_0x5726e1['query'],routingClient)[_0xa24c('0x17')](function(_0x168a8b){if(_0x5726e1[_0xa24c('0x16')][_0xa24c('0x5a')]!==undefined){var _0x8bd3fb=_(_0x168a8b[_0xa24c('0x13')])[_0xa24c('0x5b')]([_0x5726e1[_0xa24c('0x16')]['type'],_0x5726e1[_0xa24c('0x1a')]['id']])[_0xa24c('0x5c')](_0xa24c('0x5d'))[_0xa24c('0x5e')]()[_0xa24c('0x5f')]();return _0x168a8b[_0xa24c('0x13')][_0xa24c('0x5b')](function(_0x13dbef){return _0x8bd3fb[_0xa24c('0x60')](_0x13dbef[_0xa24c('0x5d')])>-0x1;});}else{return _0x168a8b[_0xa24c('0x13')]['filter'](function(_0x283c5b){return _0x283c5b[_0xa24c('0x5d')]===parseInt(_0x5726e1['params']['id']);});}})[_0xa24c('0x17')](respondWithResult(_0x2e612d,null))[_0xa24c('0x1b')](handleError(_0x2e612d,null));};exports[_0xa24c('0x61')]=function(_0x4f0f11,_0x5b4468){return respondWithRpcPromise(_0xa24c('0x62'),_0x4f0f11[_0xa24c('0x16')],routingClient)['then'](respondWithResult(_0x5b4468,null))[_0xa24c('0x1b')](handleError(_0x5b4468,null));};exports[_0xa24c('0x63')]=function(_0x106178,_0x27a666){return respondWithRpcPromise(_0xa24c('0x64'),_0x106178[_0xa24c('0x16')],routingClient)['then'](respondWithResult(_0x27a666,null))['catch'](handleError(_0x27a666,null));};exports['faxQueuesWaitingInteractions']=function(_0x263dab,_0x521894){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x263dab[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x521894,null))[_0xa24c('0x1b')](handleError(_0x521894,null));};exports[_0xa24c('0x65')]=function(_0x84ddcc){return function(_0x45b2fe,_0x16f93a){var _0x170b65,_0x2544fc;var _0x4ee10d=_[_0xa24c('0x66')](_0x84ddcc);var _0xa077c8=_0x84ddcc===_0xa24c('0x67')?_0xa24c('0x68'):_0xa24c('0x69');return db[_0x4ee10d+_0xa24c('0x6a')][_0xa24c('0x6b')]({'raw':!![],'where':{'id':_0x45b2fe[_0xa24c('0x1a')]['id']}})[_0xa24c('0x17')](function(_0x3c5495){if(_[_0xa24c('0x12')](_0x3c5495)){throw new Error(_0x4ee10d+_0xa24c('0x6c'));}_0x170b65=_0x3c5495;return db[_0x4ee10d+'Message'][_0xa24c('0x6b')]({'where':{'id':_0x45b2fe[_0xa24c('0x1f')]['messageId']},'include':[{'model':db[_0x4ee10d+_0xa24c('0x6d')],'as':_0xa24c('0x6d')},{'model':db[_0x4ee10d+_0xa077c8],'as':_0xa24c('0x69')}]});})['then'](function(_0x549e07){if(_[_0xa24c('0x12')](_0x549e07)){throw new Error(_0x4ee10d+'\x20Message\x20not\x20found');}_0x2544fc=_0x549e07;return _0x549e07[_0xa24c('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0xa24c('0x17')](function(){var _0x4c108f={'uniqueid':_0x84ddcc+'.'+_0x2544fc['id']+'.'+_0x2544fc['Interaction']['id'],'FromUserId':_0x45b2fe[_0xa24c('0x2f')]['id'],'type':_0xa24c('0x6f')};_0x4c108f[_0x4ee10d+_0xa24c('0x70')]=_0x2544fc['id'];_0x4c108f[_0x4ee10d+_0xa24c('0x71')]=_0x2544fc['Interaction']['id'];_0x4c108f[_0xa24c('0x72')+_0x4ee10d+_0xa077c8+'Id']=_0x2544fc[_0xa24c('0x69')]['id'];_0x4c108f['To'+_0x4ee10d+_0xa24c('0x73')]=_0x170b65['id'];return db[_0x4ee10d+'TransferReport']['create'](_0x4c108f);})[_0xa24c('0x17')](function(){return respondWithRpcPromise(_0xa24c('0x74'),{'channel':_0x84ddcc,'interaction':_0x2544fc[_0xa24c('0x6d')],'message':_0x2544fc,'account':_0x2544fc['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x170b65[_0xa24c('0x30')]+','+(_0x2544fc['Account']['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xa24c('0x17')](respondWithResult(_0x16f93a,null))[_0xa24c('0x1b')](handleError(_0x16f93a,null));};};exports[_0xa24c('0x75')]=function(_0xd23eb3,_0x890e15){var _0x12836d,_0x280fa2;if(_[_0xa24c('0x12')](_0xd23eb3[_0xa24c('0x1f')][_0xa24c('0x76')])){throw new Error(_0xa24c('0x77'));}var _0x24b28c=_0xd23eb3['body'][_0xa24c('0x76')];var _0x292c22=_['capitalize'](_0x24b28c);var _0x2fd4a2=_0x24b28c==='chat'?'Website':'Account';return db[_0xa24c('0x78')]['findOne']({'raw':!![],'where':{'id':_0xd23eb3[_0xa24c('0x1a')]['id'],'role':'agent'}})[_0xa24c('0x17')](function(_0x144c3b){if(_['isNil'](_0x144c3b)){throw new Error(_0xa24c('0x79'));}_0x12836d=_0x144c3b;return db[_0x292c22+'Message'][_0xa24c('0x6b')]({'where':{'id':_0xd23eb3[_0xa24c('0x1f')][_0xa24c('0x7a')]},'include':[{'model':db[_0x292c22+_0xa24c('0x6d')],'as':_0xa24c('0x6d')},{'model':db[_0x292c22+_0x2fd4a2],'as':'Account'}]});})[_0xa24c('0x17')](function(_0x5774d2){if(_[_0xa24c('0x12')](_0x5774d2)){throw new Error(_0x292c22+_0xa24c('0x7b'));}_0x280fa2=_0x5774d2;return _0x5774d2[_0xa24c('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0xa24c('0x17')](function(){var _0x4b848d={'uniqueid':_0x24b28c+'.'+_0x280fa2['id']+'.'+_0x280fa2[_0xa24c('0x6d')]['id'],'FromUserId':_0xd23eb3[_0xa24c('0x2f')]['id'],'type':_0xa24c('0x6f'),'ToUserId':_0x12836d['id']};_0x4b848d[_0x292c22+_0xa24c('0x70')]=_0x280fa2['id'];_0x4b848d[_0x292c22+'InteractionId']=_0x280fa2[_0xa24c('0x6d')]['id'];_0x4b848d[_0xa24c('0x72')+_0x292c22+_0x2fd4a2+'Id']=_0x280fa2[_0xa24c('0x69')]['id'];return db[_0x292c22+_0xa24c('0x7c')][_0xa24c('0x7d')](_0x4b848d);})[_0xa24c('0x17')](function(){return respondWithRpcPromise(_0xa24c('0x74'),{'channel':_0x24b28c,'interaction':_0x280fa2[_0xa24c('0x6d')],'message':_0x280fa2,'account':_0x280fa2[_0xa24c('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':_0xa24c('0x3c'),'appdata':_0x12836d[_0xa24c('0x30')]+','+(_0x280fa2[_0xa24c('0x69')][_0xa24c('0x7e')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xa24c('0x17')](respondWithResult(_0x890e15,null))[_0xa24c('0x1b')](handleError(_0x890e15,null));}; \ No newline at end of file +var _0x5fc3=['openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','uniq','value','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','chat','User','\x20Message\x20not\x20found','Start','agentTransferTimeout','bluebird','moment','util','../../mysqldb','../../config/logger','api','jayson/promise','http','client','request','then','error','code','message','result','catch','status','json','sendStatus','name','send','isNil','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','format','length','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions'];(function(_0x776da7,_0x59ff73){var _0x78d758=function(_0x361396){while(--_0x361396){_0x776da7['push'](_0x776da7['shift']());}};_0x78d758(++_0x59ff73);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5280f4,_0x3c36d0){_0x5280f4=_0x5280f4-0x0;var _0xba93e7=_0x5fc3[_0x5280f4];return _0xba93e7;};'use strict';var BPromise=require(_0x35fc('0x0'));var moment=require(_0x35fc('0x1'));var _=require('lodash');var util=require(_0x35fc('0x2'));var db=require(_0x35fc('0x3'))['db'];var logger=require(_0x35fc('0x4'))(_0x35fc('0x5'));var jayson=require(_0x35fc('0x6'));var amiClient=jayson['client'][_0x35fc('0x7')]({'port':0x232a});var mailClient=jayson[_0x35fc('0x8')][_0x35fc('0x7')]({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){var _0x1e5f90=_0x16e153?_0x16e153:amiClient;return _0x1e5f90[_0x35fc('0x9')](_0x19a0d1,_0x508b32)[_0x35fc('0xa')](function(_0x2051ab){if(_0x2051ab['error']){if(_0x2051ab[_0x35fc('0xb')][_0x35fc('0xc')]===0x1f4){return _0xc72d93(_0x2051ab['error'][_0x35fc('0xd')]);}return _0x27524f(_0x2051ab[_0x35fc('0xb')]['message']);}else{_0x27524f(_0x2051ab[_0x35fc('0xe')]);}})[_0x35fc('0xf')](function(_0x5469f5){_0xc72d93(_0x5469f5);});});}function respondWithResult(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xc8;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x10')](_0x409357)[_0x35fc('0x11')](_0x5d462a);}return _0x4cbe74[_0x35fc('0x12')](0x194);};}function handleError(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0x1f4;return function(_0x5cfe94){logger['error'](_0x5cfe94['stack']);if(_0x5cfe94['name']){delete _0x5cfe94[_0x35fc('0x13')];}_0x29730f[_0x35fc('0x10')](_0x38d9f2)[_0x35fc('0x14')](_0x5cfe94);};}function findById(_0x154958){return function(_0x227a49){if(!_[_0x35fc('0x15')](_0x154958)&&!_['isNil'](_0x227a49)&&!_[_0x35fc('0x15')](_0x227a49[_0x35fc('0x16')])){return _['find'](_0x227a49[_0x35fc('0x16')],function(_0x363e47){return _0x363e47['id']==_0x154958;});}return null;};}exports[_0x35fc('0x17')]=function(_0x5f56c6,_0x1a86e9){return respondWithRpcPromise(_0x35fc('0x18'),_0x5f56c6[_0x35fc('0x19')])['then'](respondWithResult(_0x1a86e9,null))[_0x35fc('0xf')](handleError(_0x1a86e9,null));};exports[_0x35fc('0x1a')]=function(_0x3229d1,_0x251a1f){return respondWithRpcPromise(_0x35fc('0x1b'),_[_0x35fc('0x1c')](_0x3229d1[_0x35fc('0x19')],_0x3229d1[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x251a1f,null))[_0x35fc('0xf')](handleError(_0x251a1f,null));};exports['voiceChannelStopMixMonitor']=function(_0x323aee,_0xd5399f){return respondWithRpcPromise(_0x35fc('0x1e'),_[_0x35fc('0x1c')](_0x323aee[_0x35fc('0x19')],_0x323aee['params']))[_0x35fc('0xa')](respondWithResult(_0xd5399f,null))[_0x35fc('0xf')](handleError(_0xd5399f,null));};exports['voiceQueues']=function(_0x265324,_0x5a93df){return respondWithRpcPromise(_0x35fc('0x1f'),_0x265324['query'])[_0x35fc('0xa')](respondWithResult(_0x5a93df,null))['catch'](handleError(_0x5a93df,null));};exports[_0x35fc('0x20')]=function(_0xdfab9f,_0x5cb986){return respondWithRpcPromise('VoiceQueues',_0xdfab9f[_0x35fc('0x19')])['then'](findById(_0xdfab9f[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x5cb986,null))['catch'](handleError(_0x5cb986,null));};exports[_0x35fc('0x21')]=function(_0x645eac,_0x383837){return respondWithRpcPromise(_0x35fc('0x22'),_[_0x35fc('0x1c')](_0x645eac[_0x35fc('0x23')],_0x645eac[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x383837,null))['catch'](handleError(_0x383837,null));};exports[_0x35fc('0x24')]=function(_0x220931,_0x22af18){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x35fc('0x1c')](_0x220931[_0x35fc('0x19')],_0x220931[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x22af18,null))[_0x35fc('0xf')](handleError(_0x22af18,null));};exports[_0x35fc('0x25')]=function(_0x222ddb,_0x37b435){return respondWithRpcPromise(_0x35fc('0x26'),_0x222ddb[_0x35fc('0x19')])['then'](respondWithResult(_0x37b435,null))['catch'](handleError(_0x37b435,null));};exports[_0x35fc('0x27')]=function(_0x4af5fe,_0x37b394){return respondWithRpcPromise(_0x35fc('0x28'),_[_0x35fc('0x1c')](_0x4af5fe[_0x35fc('0x19')],_0x4af5fe[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x37b394,null))['catch'](handleError(_0x37b394,null));};exports[_0x35fc('0x29')]=function(_0x330a14,_0x46b9ef){return respondWithRpcPromise(_0x35fc('0x2a'),_[_0x35fc('0x1c')](_0x330a14[_0x35fc('0x19')],_0x330a14['params']))[_0x35fc('0xa')](respondWithResult(_0x46b9ef,null))[_0x35fc('0xf')](handleError(_0x46b9ef,null));};exports[_0x35fc('0x2b')]=function(_0x52f53d,_0x2c657d){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x35fc('0x1c')](_0x52f53d[_0x35fc('0x19')],_0x52f53d[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x2c657d,null))['catch'](handleError(_0x2c657d,null));};exports['outbound']=function(_0x59e4fb,_0x20f5fe){return respondWithRpcPromise('Outbound',_0x59e4fb[_0x35fc('0x19')])['then'](respondWithResult(_0x20f5fe,null))[_0x35fc('0xf')](handleError(_0x20f5fe,null));};exports[_0x35fc('0x2c')]=function(_0x2ca9ac,_0x22b724){return respondWithRpcPromise(_0x35fc('0x2d'),_0x2ca9ac[_0x35fc('0x19')])[_0x35fc('0xa')](respondWithResult(_0x22b724,null))['catch'](handleError(_0x22b724,null));};exports[_0x35fc('0x2e')]=function(_0x16087d,_0x4e0ce3){var _0x1feda5;return respondWithRpcPromise(_0x35fc('0x2f'),_0x16087d[_0x35fc('0x19')])[_0x35fc('0xa')](function(_0x813866){_0x1feda5=_0x813866;return respondWithRpcPromise(_0x35fc('0x2f'),_0x16087d['query'],routingClient);})[_0x35fc('0xa')](function(_0x267858){return _[_0x35fc('0x1c')]({},_0x267858,_0x1feda5);})['then'](respondWithResult(_0x4e0ce3,null))[_0x35fc('0xf')](handleError(_0x4e0ce3,null));};exports[_0x35fc('0x30')]=function(_0x596919,_0x237548){if(_0x596919[_0x35fc('0x23')]&&_0x596919[_0x35fc('0x23')][_0x35fc('0x31')]&&_0x596919[_0x35fc('0x32')]&&_0x596919[_0x35fc('0x32')][_0x35fc('0x13')]){for(var _0x3ec51f in _0x596919['body']['interaction']){if(_0x596919[_0x35fc('0x23')][_0x35fc('0x31')]['hasOwnProperty'](_0x3ec51f)){db['MemberReport']['findAll']({'where':{'channel':_0x3ec51f,'membername':_0x596919[_0x35fc('0x32')][_0x35fc('0x13')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f]&&_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f]['length']?{'$notIn':_0x596919['body']['interaction'][_0x3ec51f]}:{'$ne':null}}})['then'](function(_0x56bdb9){var _0xb26e3f=moment()[_0x35fc('0x33')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x119925=0x0,_0x56cf1f=_0x56bdb9[_0x35fc('0x34')];_0x119925<_0x56cf1f;_0x119925+=0x1){_0x56bdb9[_0x119925][_0x35fc('0x35')]({'exitAt':_0xb26e3f});}});for(var _0x350237=0x0;_0x350237<_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f]['length'];_0x350237+=0x1){db[_0x35fc('0x36')][_0x35fc('0x37')]({'where':{'channel':_0x3ec51f,'membername':_0x596919['user'][_0x35fc('0x13')],'type':_0x35fc('0x38'),'uniqueid':_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f][_0x350237],'exitAt':null},'defaults':{'channel':_0x3ec51f,'membername':_0x596919['user'][_0x35fc('0x13')],'interface':_['isNil'](_0x596919['user'][_0x35fc('0x39')])?util[_0x35fc('0x33')](_0x35fc('0x3a'),_0x596919[_0x35fc('0x32')][_0x35fc('0x13')]):_0x596919[_0x35fc('0x32')][_0x35fc('0x39')],'type':_0x35fc('0x38'),'enterAt':moment()['format'](_0x35fc('0x3b')),'role':_0x35fc('0x3c'),'internal':_0x596919[_0x35fc('0x32')][_0x35fc('0x3d')],'uniqueid':_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f][_0x350237]}});}}}}return respondWithRpcPromise(_0x35fc('0x3e'),{'id':_0x596919[_0x35fc('0x1d')]['id'],'capacity':_0x596919[_0x35fc('0x23')][_0x35fc('0x3f')]},routingClient)[_0x35fc('0xa')](respondWithResult(_0x237548,null))[_0x35fc('0xf')](handleError(_0x237548,null));};exports[_0x35fc('0x40')]=function(_0x3146e2,_0x59c666){return respondWithRpcPromise('Telephones',_0x3146e2[_0x35fc('0x19')])[_0x35fc('0xa')](respondWithResult(_0x59c666,null))[_0x35fc('0xf')](handleError(_0x59c666,null));};exports[_0x35fc('0x41')]=function(_0x3ee296,_0x3e6494){return respondWithRpcPromise('Trunks',_0x3ee296['query'])[_0x35fc('0xa')](respondWithResult(_0x3e6494,null))[_0x35fc('0xf')](handleError(_0x3e6494,null));};exports[_0x35fc('0x42')]=function(_0x38bc78,_0x5b2595){return respondWithRpcPromise(_0x35fc('0x43'),_0x38bc78[_0x35fc('0x19')])['then'](respondWithResult(_0x5b2595,null))[_0x35fc('0xf')](handleError(_0x5b2595,null));};exports[_0x35fc('0x44')]=function(_0x590faa,_0x3e12e4){return respondWithRpcPromise(_0x35fc('0x45'),_0x590faa[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x3e12e4,null))['catch'](handleError(_0x3e12e4,null));};exports['showChatQueues']=function(_0x502a15,_0x240338){return respondWithRpcPromise(_0x35fc('0x45'),_0x502a15['query'],routingClient)[_0x35fc('0xa')](findById(_0x502a15[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x240338,null))[_0x35fc('0xf')](handleError(_0x240338,null));};exports[_0x35fc('0x46')]=function(_0x538be0,_0x2d9d45){return respondWithRpcPromise(_0x35fc('0x47'),_0x538be0[_0x35fc('0x19')],routingClient)['then'](respondWithResult(_0x2d9d45,null))[_0x35fc('0xf')](handleError(_0x2d9d45,null));};exports[_0x35fc('0x48')]=function(_0x47fb1a,_0x35a676){return respondWithRpcPromise(_0x35fc('0x47'),_0x47fb1a[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](findById(_0x47fb1a[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x35a676,null))[_0x35fc('0xf')](handleError(_0x35a676,null));};exports[_0x35fc('0x49')]=function(_0x53a79d,_0x10a5b8){return respondWithRpcPromise(_0x35fc('0x4a'),_0x53a79d[_0x35fc('0x19')],mailClient)['then'](respondWithResult(_0x10a5b8,null))[_0x35fc('0xf')](handleError(_0x10a5b8,null));};exports['openchannelQueues']=function(_0x4ceacc,_0x5d4a39){return respondWithRpcPromise(_0x35fc('0x4b'),_0x4ceacc[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x5d4a39,null))[_0x35fc('0xf')](handleError(_0x5d4a39,null));};exports[_0x35fc('0x4c')]=function(_0x4bbea0,_0x579f5a){return respondWithRpcPromise('OpenchannelQueues',_0x4bbea0['query'],routingClient)['then'](findById(_0x4bbea0[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x579f5a,null))[_0x35fc('0xf')](handleError(_0x579f5a,null));};exports[_0x35fc('0x4d')]=function(_0x511e8b,_0x458eb8){return respondWithRpcPromise(_0x35fc('0x4e'),_0x511e8b[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x458eb8,null))[_0x35fc('0xf')](handleError(_0x458eb8,null));};exports[_0x35fc('0x4f')]=function(_0x27071b,_0x2127e0){return respondWithRpcPromise(_0x35fc('0x4e'),_0x27071b['query'],routingClient)[_0x35fc('0xa')](findById(_0x27071b['params']['id']))[_0x35fc('0xa')](respondWithResult(_0x2127e0,null))[_0x35fc('0xf')](handleError(_0x2127e0,null));};exports[_0x35fc('0x50')]=function(_0x2bc76c,_0x4bdde7){return respondWithRpcPromise(_0x35fc('0x51'),_0x2bc76c['query'],routingClient)['then'](respondWithResult(_0x4bdde7,null))['catch'](handleError(_0x4bdde7,null));};exports[_0x35fc('0x52')]=function(_0x5dfeb7,_0x3c9027){return respondWithRpcPromise('WhatsappQueues',_0x5dfeb7[_0x35fc('0x19')],routingClient)['then'](findById(_0x5dfeb7[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x3c9027,null))[_0x35fc('0xf')](handleError(_0x3c9027,null));};exports[_0x35fc('0x53')]=function(_0x5c2ec0,_0x3d0ecc){return respondWithRpcPromise(_0x35fc('0x54'),_0x5c2ec0[_0x35fc('0x19')],routingClient)['then'](respondWithResult(_0x3d0ecc,null))[_0x35fc('0xf')](handleError(_0x3d0ecc,null));};exports[_0x35fc('0x55')]=function(_0x37764b,_0x3c1b56){return respondWithRpcPromise(_0x35fc('0x54'),_0x37764b[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](findById(_0x37764b[_0x35fc('0x1d')]['id']))['then'](respondWithResult(_0x3c1b56,null))[_0x35fc('0xf')](handleError(_0x3c1b56,null));};exports[_0x35fc('0x56')]=function(_0x2600d2,_0x4a926d){return respondWithRpcPromise(_0x35fc('0x57'),_0x2600d2[_0x35fc('0x19')])['then'](respondWithResult(_0x4a926d,null))['catch'](handleError(_0x4a926d,null));};exports[_0x35fc('0x58')]=function(_0x4835c2,_0x223ad3){return respondWithRpcPromise(_0x35fc('0x59'),_0x4835c2[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x223ad3,null))[_0x35fc('0xf')](handleError(_0x223ad3,null));};exports[_0x35fc('0x5a')]=function(_0x13f602,_0x104b1d){return respondWithRpcPromise(_0x35fc('0x5b'),_0x13f602[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x104b1d,null))[_0x35fc('0xf')](handleError(_0x104b1d,null));};exports[_0x35fc('0x5c')]=function(_0x9f034e,_0x184f28){return respondWithRpcPromise(_0x35fc('0x5d'),_0x9f034e[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x184f28,null))[_0x35fc('0xf')](handleError(_0x184f28,null));};exports[_0x35fc('0x5e')]=function(_0x4ba1b0,_0x1797d0){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4ba1b0[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](function(_0x2185ce){if(_0x4ba1b0[_0x35fc('0x19')][_0x35fc('0x5f')]!==undefined){var _0x3f56f4=_(_0x2185ce[_0x35fc('0x16')])[_0x35fc('0x60')]([_0x4ba1b0[_0x35fc('0x19')][_0x35fc('0x5f')],_0x4ba1b0[_0x35fc('0x1d')]['id']])['map'](_0x35fc('0x61'))[_0x35fc('0x62')]()[_0x35fc('0x63')]();return _0x2185ce[_0x35fc('0x16')][_0x35fc('0x60')](function(_0x41a6de){return _0x3f56f4['indexOf'](_0x41a6de[_0x35fc('0x61')])>-0x1;});}else{return _0x2185ce[_0x35fc('0x16')][_0x35fc('0x60')](function(_0x23206d){return _0x23206d[_0x35fc('0x61')]===parseInt(_0x4ba1b0[_0x35fc('0x1d')]['id']);});}})[_0x35fc('0xa')](respondWithResult(_0x1797d0,null))[_0x35fc('0xf')](handleError(_0x1797d0,null));};exports[_0x35fc('0x64')]=function(_0x5f23d8,_0x28f02b){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x5f23d8[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x28f02b,null))['catch'](handleError(_0x28f02b,null));};exports[_0x35fc('0x65')]=function(_0x41002a,_0xcaa49){return respondWithRpcPromise(_0x35fc('0x66'),_0x41002a[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0xcaa49,null))[_0x35fc('0xf')](handleError(_0xcaa49,null));};exports[_0x35fc('0x67')]=function(_0x25ee61,_0x5806bf){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x25ee61['query'],routingClient)['then'](respondWithResult(_0x5806bf,null))[_0x35fc('0xf')](handleError(_0x5806bf,null));};exports[_0x35fc('0x68')]=function(_0x8fc410){return function(_0x1f5cbc,_0x35ef53){var _0x4f535a,_0x226fdf;var _0x19682e=_[_0x35fc('0x69')](_0x8fc410);var _0x169ea2=_0x8fc410==='chat'?_0x35fc('0x6a'):_0x35fc('0x6b');return db[_0x19682e+_0x35fc('0x6c')]['findOne']({'raw':!![],'where':{'id':_0x1f5cbc[_0x35fc('0x1d')]['id']}})[_0x35fc('0xa')](function(_0x319033){if(_[_0x35fc('0x15')](_0x319033)){throw new Error(_0x19682e+_0x35fc('0x6d'));}_0x4f535a=_0x319033;return db[_0x19682e+_0x35fc('0x6e')][_0x35fc('0x6f')]({'where':{'id':_0x1f5cbc[_0x35fc('0x23')]['messageId']},'include':[{'model':db[_0x19682e+_0x35fc('0x70')],'as':_0x35fc('0x70')},{'model':db[_0x19682e+_0x169ea2],'as':_0x35fc('0x6b')}]});})[_0x35fc('0xa')](function(_0x221c5b){if(_[_0x35fc('0x15')](_0x221c5b)){throw new Error(_0x19682e+'\x20Message\x20not\x20found');}_0x226fdf=_0x221c5b;return _0x221c5b[_0x35fc('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x4855ee={'uniqueid':_0x8fc410+'.'+_0x226fdf['id']+'.'+_0x226fdf[_0x35fc('0x70')]['id'],'FromUserId':_0x1f5cbc['user']['id'],'type':_0x35fc('0x72')};_0x4855ee[_0x19682e+_0x35fc('0x73')]=_0x226fdf['id'];_0x4855ee[_0x19682e+_0x35fc('0x74')]=_0x226fdf['Interaction']['id'];_0x4855ee[_0x35fc('0x75')+_0x19682e+_0x169ea2+'Id']=_0x226fdf[_0x35fc('0x6b')]['id'];_0x4855ee['To'+_0x19682e+_0x35fc('0x76')]=_0x4f535a['id'];return db[_0x19682e+_0x35fc('0x77')][_0x35fc('0x78')](_0x4855ee);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x8fc410,'interaction':_0x226fdf['Interaction'],'message':_0x226fdf,'account':_0x226fdf[_0x35fc('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4f535a[_0x35fc('0x13')]+','+(_0x226fdf[_0x35fc('0x6b')][_0x35fc('0x79')]||0x12c),'interval':_0x35fc('0x7a')}]},routingClient);})['then'](respondWithResult(_0x35ef53,null))[_0x35fc('0xf')](handleError(_0x35ef53,null));};};exports[_0x35fc('0x7b')]=function(_0x312827,_0x47c507){var _0x128286,_0x175cc7;if(_[_0x35fc('0x15')](_0x312827['body']['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x32b9e1=_0x312827[_0x35fc('0x23')][_0x35fc('0x7c')];var _0x3858a9=_['capitalize'](_0x32b9e1);var _0x3ead4e=_0x32b9e1===_0x35fc('0x7d')?'Website':'Account';return db[_0x35fc('0x7e')][_0x35fc('0x6f')]({'raw':!![],'where':{'id':_0x312827[_0x35fc('0x1d')]['id'],'role':'agent'}})['then'](function(_0x134e60){if(_[_0x35fc('0x15')](_0x134e60)){throw new Error('Agent\x20not\x20found');}_0x128286=_0x134e60;return db[_0x3858a9+_0x35fc('0x6e')][_0x35fc('0x6f')]({'where':{'id':_0x312827[_0x35fc('0x23')]['messageId']},'include':[{'model':db[_0x3858a9+_0x35fc('0x70')],'as':_0x35fc('0x70')},{'model':db[_0x3858a9+_0x3ead4e],'as':_0x35fc('0x6b')}]});})[_0x35fc('0xa')](function(_0x4fd676){if(_[_0x35fc('0x15')](_0x4fd676)){throw new Error(_0x3858a9+_0x35fc('0x7f'));}_0x175cc7=_0x4fd676;return _0x4fd676[_0x35fc('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x96dfc={'uniqueid':_0x32b9e1+'.'+_0x175cc7['id']+'.'+_0x175cc7[_0x35fc('0x70')]['id'],'FromUserId':_0x312827[_0x35fc('0x32')]['id'],'type':'queue','ToUserId':_0x128286['id']};_0x96dfc[_0x3858a9+_0x35fc('0x73')]=_0x175cc7['id'];_0x96dfc[_0x3858a9+_0x35fc('0x74')]=_0x175cc7['Interaction']['id'];_0x96dfc[_0x35fc('0x75')+_0x3858a9+_0x3ead4e+'Id']=_0x175cc7[_0x35fc('0x6b')]['id'];return db[_0x3858a9+_0x35fc('0x77')][_0x35fc('0x78')](_0x96dfc);})[_0x35fc('0xa')](function(){return respondWithRpcPromise(_0x35fc('0x80'),{'channel':_0x32b9e1,'interaction':_0x175cc7[_0x35fc('0x70')],'message':_0x175cc7,'account':_0x175cc7[_0x35fc('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':_0x35fc('0x3c'),'appdata':_0x128286['name']+','+(_0x175cc7[_0x35fc('0x6b')][_0x35fc('0x81')]||0x12c),'interval':_0x35fc('0x7a')}]},routingClient);})[_0x35fc('0xa')](respondWithResult(_0x47c507,null))['catch'](handleError(_0x47c507,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 76db281..21623f1 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 _0x4116=['../../config/environment','get','index','isAuthenticated','run','post','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4fb001,_0x3f9e2e){var _0x207eda=function(_0x2d5b05){while(--_0x2d5b05){_0x4fb001['push'](_0x4fb001['shift']());}};_0x207eda(++_0x3f9e2e);}(_0x4116,0x161));var _0x6411=function(_0x5d1044,_0x18f656){_0x5d1044=_0x5d1044-0x0;var _0x3cd90e=_0x4116[_0x5d1044];return _0x3cd90e;};'use strict';var multer=require('multer');var util=require(_0x6411('0x0'));var path=require(_0x6411('0x1'));var timeout=require('connect-timeout');var express=require(_0x6411('0x2'));var router=express[_0x6411('0x3')]();var fs_extra=require(_0x6411('0x4'));var auth=require(_0x6411('0x5'));var interaction=require(_0x6411('0x6'));var config=require(_0x6411('0x7'));var controller=require('./schedule.controller');router[_0x6411('0x8')]('/',auth['isAuthenticated'](),controller[_0x6411('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6411('0x8')]('/:id/run',auth[_0x6411('0xa')](),controller[_0x6411('0xb')]);router[_0x6411('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x6411('0xa')](),controller['update']);router['delete']('/:id',auth[_0x6411('0xa')](),controller[_0x6411('0xd')]);module[_0x6411('0xe')]=router; \ No newline at end of file +var _0xfa6f=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./schedule.controller','isAuthenticated','get','/:id','show','run','update','delete','exports'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xfa6f,0x177));var _0xffa6=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0xfa6f[_0x3207aa];return _0x51758f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xffa6('0x0'));var timeout=require(_0xffa6('0x1'));var express=require(_0xffa6('0x2'));var router=express['Router']();var fs_extra=require(_0xffa6('0x3'));var auth=require(_0xffa6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xffa6('0x5'));var controller=require(_0xffa6('0x6'));router['get']('/',auth[_0xffa6('0x7')](),controller['index']);router[_0xffa6('0x8')](_0xffa6('0x9'),auth[_0xffa6('0x7')](),controller[_0xffa6('0xa')]);router['get']('/:id/run',auth[_0xffa6('0x7')](),controller[_0xffa6('0xb')]);router['post']('/',auth[_0xffa6('0x7')](),controller['create']);router['put']('/:id',auth[_0xffa6('0x7')](),controller[_0xffa6('0xc')]);router[_0xffa6('0xd')](_0xffa6('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xffa6('0xe')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index ef99d28..0ecceaf 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 _0x10b9=['0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','minutes','csv','xlsx','default','custom','BOOLEAN','TEXT','sequelize','exports','STRING'];(function(_0x2f5a6e,_0x5b2e4d){var _0x346350=function(_0x26bd67){while(--_0x26bd67){_0x2f5a6e['push'](_0x2f5a6e['shift']());}};_0x346350(++_0x5b2e4d);}(_0x10b9,0x1b2));var _0x910b=function(_0x328f00,_0x3378b1){_0x328f00=_0x328f00-0x0;var _0x5d863d=_0x10b9[_0x328f00];return _0x5d863d;};'use strict';var Sequelize=require(_0x910b('0x0'));module[_0x910b('0x1')]={'name':{'type':Sequelize[_0x910b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x910b('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x910b('0x2')],'allowNull':![],'defaultValue':_0x910b('0x3')},'startAt':{'type':Sequelize[_0x910b('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x910b('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x910b('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x910b('0x6')](_0x910b('0x7'),_0x910b('0x8'),_0x910b('0x9'),_0x910b('0xa'),_0x910b('0xb'),'hours',_0x910b('0xc')),'allowNull':![],'defaultValue':_0x910b('0xb')},'output':{'type':Sequelize[_0x910b('0x6')](_0x910b('0xd'),'pdf',_0x910b('0xe')),'allowNull':![],'defaultValue':_0x910b('0xd')},'type':{'type':Sequelize[_0x910b('0x6')]('custom',_0x910b('0xf')),'allowNull':![],'defaultValue':_0x910b('0x10')},'sendMail':{'type':Sequelize[_0x910b('0x11')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x910b('0x12')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x5bc6=['months','days','hours','minutes','csv','pdf','xlsx','custom','default','TEXT','sequelize','BOOLEAN','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters'];(function(_0x4c43fd,_0x48c00e){var _0x5cde73=function(_0x51df75){while(--_0x51df75){_0x4c43fd['push'](_0x4c43fd['shift']());}};_0x5cde73(++_0x48c00e);}(_0x5bc6,0x199));var _0x65bc=function(_0x5b3fb7,_0x24fcf6){_0x5b3fb7=_0x5b3fb7-0x0;var _0x4b947b=_0x5bc6[_0x5b3fb7];return _0x4b947b;};'use strict';var Sequelize=require(_0x65bc('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x65bc('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x65bc('0x2')],'allowNull':![],'defaultValue':_0x65bc('0x3')},'startAt':{'type':Sequelize[_0x65bc('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x65bc('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x65bc('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x65bc('0x6')](_0x65bc('0x7'),_0x65bc('0x8'),_0x65bc('0x9'),'weeks',_0x65bc('0xa'),_0x65bc('0xb'),_0x65bc('0xc')),'allowNull':![],'defaultValue':_0x65bc('0xa')},'output':{'type':Sequelize['ENUM'](_0x65bc('0xd'),_0x65bc('0xe'),_0x65bc('0xf')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x65bc('0x6')](_0x65bc('0x10'),_0x65bc('0x11')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x65bc('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0x65bc('0x2')]},'cc':{'type':Sequelize[_0x65bc('0x12')]},'bcc':{'type':Sequelize[_0x65bc('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x65bc('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index bd21946..e094c37 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 _0x54db=['update','then','destroy','get','UserProfileResource','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Schedule','includeAll','include','rows','catch','show','params','keys','find','create','body','user','role','Scheduler','UserProfileSection','userProfileId','autoAssociation','error','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','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject'];(function(_0x1c2ee5,_0x4208b1){var _0x3211b9=function(_0x5db4e2){while(--_0x5db4e2){_0x1c2ee5['push'](_0x1c2ee5['shift']());}};_0x3211b9(++_0x4208b1);}(_0x54db,0x18a));var _0xb54d=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0x54db[_0x424a9a];return _0xa7831c;};'use strict';var emlformat=require(_0xb54d('0x0'));var rimraf=require(_0xb54d('0x1'));var zipdir=require(_0xb54d('0x2'));var jsonpatch=require(_0xb54d('0x3'));var rp=require(_0xb54d('0x4'));var moment=require(_0xb54d('0x5'));var BPromise=require(_0xb54d('0x6'));var Mustache=require('mustache');var util=require(_0xb54d('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xb54d('0x8'));var ejs=require(_0xb54d('0x9'));var fs=require('fs');var fs_extra=require(_0xb54d('0xa'));var _=require(_0xb54d('0xb'));var squel=require(_0xb54d('0xc'));var crypto=require(_0xb54d('0xd'));var jsforce=require(_0xb54d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb54d('0x8'));var querystring=require(_0xb54d('0xf'));var Papa=require(_0xb54d('0x10'));var Redis=require(_0xb54d('0x11'));var authService=require(_0xb54d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb54d('0x13'));var hardwareService=require(_0xb54d('0x14'));var logger=require(_0xb54d('0x15'))('api');var utils=require(_0xb54d('0x16'));var config=require(_0xb54d('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3038ea,_0xcb487b){_0xcb487b=_0xcb487b||0xcc;return function(_0x31fa25){if(_0x31fa25){return _0x3038ea[_0xb54d('0x18')](_0xcb487b);}return _0x3038ea[_0xb54d('0x19')](_0xcb487b)[_0xb54d('0x1a')]();};}function respondWithResult(_0x441a34,_0x2cfbb0){_0x2cfbb0=_0x2cfbb0||0xc8;return function(_0x16179e){if(_0x16179e){return _0x441a34[_0xb54d('0x19')](_0x2cfbb0)[_0xb54d('0x1b')](_0x16179e);}};}function respondWithFilteredResult(_0x66d712,_0x31199a){return function(_0x1970f2){if(_0x1970f2){var _0x218fcd=typeof _0x31199a['offset']===_0xb54d('0x1c')&&typeof _0x31199a[_0xb54d('0x1d')]===_0xb54d('0x1c');var _0x17a0dd=_0x1970f2[_0xb54d('0x1e')];var _0x2a3011=_0x218fcd?0x0:_0x31199a[_0xb54d('0x1f')];var _0xf2a6ba=_0x218fcd?_0x1970f2[_0xb54d('0x1e')]:_0x31199a['offset']+_0x31199a['limit'];var _0xfe6098;if(_0xf2a6ba>=_0x17a0dd){_0xf2a6ba=_0x17a0dd;_0xfe6098=0xc8;}else{_0xfe6098=0xce;}_0x66d712[_0xb54d('0x19')](_0xfe6098);return _0x66d712[_0xb54d('0x20')](_0xb54d('0x21'),_0x2a3011+'-'+_0xf2a6ba+'/'+_0x17a0dd)[_0xb54d('0x1b')](_0x1970f2);}return null;};}function patchUpdates(_0x4e4c14){return function(_0x448818){try{jsonpatch[_0xb54d('0x22')](_0x448818,_0x4e4c14,!![]);}catch(_0x5d92dd){return BPromise[_0xb54d('0x23')](_0x5d92dd);}return _0x448818['save']();};}function saveUpdates(_0x1436ba,_0x2597b9){return function(_0x547590){if(_0x547590){return _0x547590[_0xb54d('0x24')](_0x1436ba)[_0xb54d('0x25')](function(_0x4a2fa2){return _0x4a2fa2;});}return null;};}function removeEntity(_0x20f63f,_0x28e9bd){return function(_0x238405){if(_0x238405){return _0x238405[_0xb54d('0x26')]()[_0xb54d('0x25')](function(){var _0xec6729=_0x238405[_0xb54d('0x27')]({'plain':!![]});var _0x548bc9='Scheduler';return db[_0xb54d('0x28')]['destroy']({'where':{'type':_0x548bc9,'resourceId':_0xec6729['id']}})['then'](function(){return _0x238405;});})[_0xb54d('0x25')](function(){_0x20f63f[_0xb54d('0x19')](0xcc)[_0xb54d('0x1a')]();});}};}function handleEntityNotFound(_0x10fbad,_0x5c3c34){return function(_0xe150e6){if(!_0xe150e6){_0x10fbad[_0xb54d('0x18')](0x194);}return _0xe150e6;};}function handleError(_0x263016,_0x1f370f){_0x1f370f=_0x1f370f||0x1f4;return function(_0x1264f1){logger['error'](_0x1264f1['stack']);if(_0x1264f1[_0xb54d('0x29')]){delete _0x1264f1[_0xb54d('0x29')];}_0x263016['status'](_0x1f370f)[_0xb54d('0x2a')](_0x1264f1);};}exports['index']=function(_0x2ee4d3,_0x56ecee){var _0x358207={},_0x1154e0={},_0x6ba34={'count':0x0,'rows':[]};var _0x5f533e=_[_0xb54d('0x2b')](db['Schedule'][_0xb54d('0x2c')],function(_0x29eb7a){return{'name':_0x29eb7a[_0xb54d('0x2d')],'type':_0x29eb7a[_0xb54d('0x2e')][_0xb54d('0x2f')]};});_0x1154e0[_0xb54d('0x30')]=_[_0xb54d('0x2b')](_0x5f533e,_0xb54d('0x29'));_0x1154e0[_0xb54d('0x31')]=_['keys'](_0x2ee4d3[_0xb54d('0x31')]);_0x1154e0[_0xb54d('0x32')]=_[_0xb54d('0x33')](_0x1154e0[_0xb54d('0x30')],_0x1154e0[_0xb54d('0x31')]);_0x358207[_0xb54d('0x34')]=_[_0xb54d('0x33')](_0x1154e0[_0xb54d('0x30')],qs['fields'](_0x2ee4d3['query'][_0xb54d('0x35')]));_0x358207[_0xb54d('0x34')]=_0x358207[_0xb54d('0x34')][_0xb54d('0x36')]?_0x358207[_0xb54d('0x34')]:_0x1154e0[_0xb54d('0x30')];if(!_0x2ee4d3['query'][_0xb54d('0x37')](_0xb54d('0x38'))){_0x358207['limit']=qs[_0xb54d('0x1d')](_0x2ee4d3[_0xb54d('0x31')][_0xb54d('0x1d')]);_0x358207[_0xb54d('0x1f')]=qs[_0xb54d('0x1f')](_0x2ee4d3[_0xb54d('0x31')][_0xb54d('0x1f')]);}_0x358207[_0xb54d('0x39')]=qs[_0xb54d('0x3a')](_0x2ee4d3[_0xb54d('0x31')]['sort']);_0x358207[_0xb54d('0x3b')]=qs[_0xb54d('0x32')](_[_0xb54d('0x3c')](_0x2ee4d3[_0xb54d('0x31')],_0x1154e0['filters']),_0x5f533e);if(_0x2ee4d3[_0xb54d('0x31')][_0xb54d('0x3d')]){_0x358207[_0xb54d('0x3b')]=_[_0xb54d('0x3e')](_0x358207[_0xb54d('0x3b')],{'$or':_[_0xb54d('0x2b')](_0x5f533e,function(_0x16fc43){if(_0x16fc43[_0xb54d('0x2e')]!==_0xb54d('0x3f')){var _0x1e5ce5={};_0x1e5ce5[_0x16fc43[_0xb54d('0x29')]]={'$like':'%'+_0x2ee4d3[_0xb54d('0x31')][_0xb54d('0x3d')]+'%'};return _0x1e5ce5;}})});}_0x358207=_[_0xb54d('0x3e')]({},_0x358207,_0x2ee4d3[_0xb54d('0x40')]);var _0x4f48cd={'where':_0x358207[_0xb54d('0x3b')]};return db[_0xb54d('0x41')]['count'](_0x4f48cd)[_0xb54d('0x25')](function(_0x33bf3c){_0x6ba34[_0xb54d('0x1e')]=_0x33bf3c;if(_0x2ee4d3[_0xb54d('0x31')][_0xb54d('0x42')]){_0x358207[_0xb54d('0x43')]=[{'all':!![]}];}return db[_0xb54d('0x41')]['findAll'](_0x358207);})['then'](function(_0x4cd1b6){_0x6ba34[_0xb54d('0x44')]=_0x4cd1b6;return _0x6ba34;})[_0xb54d('0x25')](respondWithFilteredResult(_0x56ecee,_0x358207))[_0xb54d('0x45')](handleError(_0x56ecee,null));};exports[_0xb54d('0x46')]=function(_0x126105,_0x259455){var _0x117bcd={'raw':![],'where':{'id':_0x126105[_0xb54d('0x47')]['id']}},_0x56c40b={};_0x56c40b[_0xb54d('0x30')]=_[_0xb54d('0x48')](db['Schedule']['rawAttributes']);_0x56c40b[_0xb54d('0x31')]=_[_0xb54d('0x48')](_0x126105[_0xb54d('0x31')]);_0x56c40b[_0xb54d('0x32')]=_[_0xb54d('0x33')](_0x56c40b[_0xb54d('0x30')],_0x56c40b[_0xb54d('0x31')]);_0x117bcd[_0xb54d('0x34')]=_[_0xb54d('0x33')](_0x56c40b[_0xb54d('0x30')],qs[_0xb54d('0x35')](_0x126105[_0xb54d('0x31')]['fields']));_0x117bcd[_0xb54d('0x34')]=_0x117bcd['attributes'][_0xb54d('0x36')]?_0x117bcd[_0xb54d('0x34')]:_0x56c40b[_0xb54d('0x30')];if(_0x126105[_0xb54d('0x31')][_0xb54d('0x42')]){_0x117bcd[_0xb54d('0x43')]=[{'all':!![]}];}_0x117bcd=_[_0xb54d('0x3e')]({},_0x117bcd,_0x126105['options']);return db[_0xb54d('0x41')][_0xb54d('0x49')](_0x117bcd)[_0xb54d('0x25')](handleEntityNotFound(_0x259455,null))['then'](respondWithResult(_0x259455,null))[_0xb54d('0x45')](handleError(_0x259455,null));};exports[_0xb54d('0x4a')]=function(_0x383a3b,_0x2aae95){return db[_0xb54d('0x41')][_0xb54d('0x4a')](_0x383a3b[_0xb54d('0x4b')],{})[_0xb54d('0x25')](function(_0x24414a){var _0x816270=_0x383a3b[_0xb54d('0x4c')]['get']({'plain':!![]});if(!_0x816270)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x816270[_0xb54d('0x4d')]===_0xb54d('0x4c')){var _0x3d0e79=_0x24414a[_0xb54d('0x27')]({'plain':!![]});var _0x50bd3f=_0xb54d('0x4e');return db[_0xb54d('0x4f')]['find']({'where':{'name':_0x50bd3f,'userProfileId':_0x816270[_0xb54d('0x50')]},'raw':!![]})[_0xb54d('0x25')](function(_0x457fa3){if(_0x457fa3&&_0x457fa3[_0xb54d('0x51')]===0x0){return db[_0xb54d('0x28')][_0xb54d('0x4a')]({'name':_0x3d0e79[_0xb54d('0x29')],'resourceId':_0x3d0e79['id'],'type':_0x457fa3[_0xb54d('0x29')],'sectionId':_0x457fa3['id']},{})[_0xb54d('0x25')](function(){return _0x24414a;});}else{return _0x24414a;}})[_0xb54d('0x45')](function(_0x188524){logger[_0xb54d('0x52')](_0xb54d('0x53'),_0x188524);throw _0x188524;});}return _0x24414a;})[_0xb54d('0x25')](respondWithResult(_0x2aae95,0xc9))[_0xb54d('0x45')](handleError(_0x2aae95,null));};exports[_0xb54d('0x24')]=function(_0x34552e,_0x64338b){if(_0x34552e['body']['id']){delete _0x34552e[_0xb54d('0x4b')]['id'];}return db['Schedule'][_0xb54d('0x49')]({'where':{'id':_0x34552e[_0xb54d('0x47')]['id']}})[_0xb54d('0x25')](handleEntityNotFound(_0x64338b,null))[_0xb54d('0x25')](saveUpdates(_0x34552e['body'],null))[_0xb54d('0x25')](respondWithResult(_0x64338b,null))['catch'](handleError(_0x64338b,null));};exports['destroy']=function(_0x27cf8d,_0x207bc5){return db[_0xb54d('0x41')][_0xb54d('0x49')]({'where':{'id':_0x27cf8d[_0xb54d('0x47')]['id']}})['then'](handleEntityNotFound(_0x207bc5,null))[_0xb54d('0x25')](removeEntity(_0x207bc5,null))[_0xb54d('0x45')](handleError(_0x207bc5,null));};exports[_0xb54d('0x54')]=function(_0xeb3eee,_0x42f429,_0x1dd3af){var _0x191179=require(_0xb54d('0x55'));return db['Schedule'][_0xb54d('0x49')]({'where':{'id':_0xeb3eee['params']['id']},'raw':!![]})[_0xb54d('0x25')](handleEntityNotFound(_0x42f429,null))[_0xb54d('0x25')](function(){_0x191179[_0xb54d('0x54')](_0xeb3eee['params']['id']);})[_0xb54d('0x25')](respondWithStatusCode(_0x42f429,null))[_0xb54d('0x45')](handleError(_0x42f429,null));}; \ No newline at end of file +var _0x9a56=['bluebird','mustache','path','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','count','limit','apply','reject','save','then','destroy','get','Scheduler','UserProfileResource','end','error','name','send','index','Schedule','rawAttributes','type','key','model','map','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','update','run','../../config/schedule','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x394d83,_0x35522d){var _0x411295=function(_0x3173a9){while(--_0x3173a9){_0x394d83['push'](_0x394d83['shift']());}};_0x411295(++_0x35522d);}(_0x9a56,0x134));var _0x69a5=function(_0x5cd405,_0x509baf){_0x5cd405=_0x5cd405-0x0;var _0x39ed5c=_0x9a56[_0x5cd405];return _0x39ed5c;};'use strict';var emlformat=require(_0x69a5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x69a5('0x1'));var jsonpatch=require(_0x69a5('0x2'));var rp=require(_0x69a5('0x3'));var moment=require('moment');var BPromise=require(_0x69a5('0x4'));var Mustache=require(_0x69a5('0x5'));var util=require('util');var path=require(_0x69a5('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x69a5('0x7'));var crypto=require('crypto');var jsforce=require(_0x69a5('0x8'));var deskjs=require(_0x69a5('0x9'));var toCsv=require(_0x69a5('0xa'));var querystring=require(_0x69a5('0xb'));var Papa=require(_0x69a5('0xc'));var Redis=require('ioredis');var authService=require(_0x69a5('0xd'));var qs=require(_0x69a5('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x69a5('0xf'));var logger=require(_0x69a5('0x10'))(_0x69a5('0x11'));var utils=require(_0x69a5('0x12'));var config=require(_0x69a5('0x13'));var licenseUtil=require(_0x69a5('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42825a,_0xd91a90){_0xd91a90=_0xd91a90||0xcc;return function(_0x52936c){if(_0x52936c){return _0x42825a['sendStatus'](_0xd91a90);}return _0x42825a[_0x69a5('0x15')](_0xd91a90)['end']();};}function respondWithResult(_0x2b91f7,_0x4db1f4){_0x4db1f4=_0x4db1f4||0xc8;return function(_0x5376e2){if(_0x5376e2){return _0x2b91f7[_0x69a5('0x15')](_0x4db1f4)[_0x69a5('0x16')](_0x5376e2);}};}function respondWithFilteredResult(_0x510aa5,_0x50e02e){return function(_0x3ade57){if(_0x3ade57){var _0x194cea=typeof _0x50e02e[_0x69a5('0x17')]==='undefined'&&typeof _0x50e02e['limit']===_0x69a5('0x18');var _0xe02886=_0x3ade57['count'];var _0x4c522d=_0x194cea?0x0:_0x50e02e[_0x69a5('0x17')];var _0x498e0b=_0x194cea?_0x3ade57[_0x69a5('0x19')]:_0x50e02e[_0x69a5('0x17')]+_0x50e02e[_0x69a5('0x1a')];var _0x5618de;if(_0x498e0b>=_0xe02886){_0x498e0b=_0xe02886;_0x5618de=0xc8;}else{_0x5618de=0xce;}_0x510aa5[_0x69a5('0x15')](_0x5618de);return _0x510aa5['set']('Content-Range',_0x4c522d+'-'+_0x498e0b+'/'+_0xe02886)['json'](_0x3ade57);}return null;};}function patchUpdates(_0x2d42e3){return function(_0x26a4e7){try{jsonpatch[_0x69a5('0x1b')](_0x26a4e7,_0x2d42e3,!![]);}catch(_0x193857){return BPromise[_0x69a5('0x1c')](_0x193857);}return _0x26a4e7[_0x69a5('0x1d')]();};}function saveUpdates(_0x241257,_0x4112dd){return function(_0x212313){if(_0x212313){return _0x212313['update'](_0x241257)[_0x69a5('0x1e')](function(_0x512fcf){return _0x512fcf;});}return null;};}function removeEntity(_0x3b7e13,_0x1778e3){return function(_0x29578d){if(_0x29578d){return _0x29578d[_0x69a5('0x1f')]()[_0x69a5('0x1e')](function(){var _0x59153d=_0x29578d[_0x69a5('0x20')]({'plain':!![]});var _0x5be2c5=_0x69a5('0x21');return db[_0x69a5('0x22')]['destroy']({'where':{'type':_0x5be2c5,'resourceId':_0x59153d['id']}})['then'](function(){return _0x29578d;});})[_0x69a5('0x1e')](function(){_0x3b7e13[_0x69a5('0x15')](0xcc)[_0x69a5('0x23')]();});}};}function handleEntityNotFound(_0x1c194,_0xe1f6be){return function(_0x2475fe){if(!_0x2475fe){_0x1c194['sendStatus'](0x194);}return _0x2475fe;};}function handleError(_0x4d9c6f,_0x137208){_0x137208=_0x137208||0x1f4;return function(_0x47f3d5){logger[_0x69a5('0x24')](_0x47f3d5['stack']);if(_0x47f3d5[_0x69a5('0x25')]){delete _0x47f3d5[_0x69a5('0x25')];}_0x4d9c6f[_0x69a5('0x15')](_0x137208)[_0x69a5('0x26')](_0x47f3d5);};}exports[_0x69a5('0x27')]=function(_0x5b1602,_0x49664f){var _0x5d6153={},_0x253d26={},_0x461d7b={'count':0x0,'rows':[]};var _0x2651ee=_['map'](db[_0x69a5('0x28')][_0x69a5('0x29')],function(_0x1f88dc){return{'name':_0x1f88dc['fieldName'],'type':_0x1f88dc[_0x69a5('0x2a')][_0x69a5('0x2b')]};});_0x253d26[_0x69a5('0x2c')]=_[_0x69a5('0x2d')](_0x2651ee,_0x69a5('0x25'));_0x253d26[_0x69a5('0x2e')]=_[_0x69a5('0x2f')](_0x5b1602[_0x69a5('0x2e')]);_0x253d26['filters']=_['intersection'](_0x253d26[_0x69a5('0x2c')],_0x253d26[_0x69a5('0x2e')]);_0x5d6153[_0x69a5('0x30')]=_['intersection'](_0x253d26[_0x69a5('0x2c')],qs[_0x69a5('0x31')](_0x5b1602[_0x69a5('0x2e')]['fields']));_0x5d6153[_0x69a5('0x30')]=_0x5d6153['attributes'][_0x69a5('0x32')]?_0x5d6153[_0x69a5('0x30')]:_0x253d26[_0x69a5('0x2c')];if(!_0x5b1602[_0x69a5('0x2e')][_0x69a5('0x33')](_0x69a5('0x34'))){_0x5d6153[_0x69a5('0x1a')]=qs[_0x69a5('0x1a')](_0x5b1602[_0x69a5('0x2e')]['limit']);_0x5d6153[_0x69a5('0x17')]=qs[_0x69a5('0x17')](_0x5b1602[_0x69a5('0x2e')][_0x69a5('0x17')]);}_0x5d6153[_0x69a5('0x35')]=qs[_0x69a5('0x36')](_0x5b1602[_0x69a5('0x2e')][_0x69a5('0x36')]);_0x5d6153[_0x69a5('0x37')]=qs[_0x69a5('0x38')](_['pick'](_0x5b1602[_0x69a5('0x2e')],_0x253d26[_0x69a5('0x38')]),_0x2651ee);if(_0x5b1602[_0x69a5('0x2e')][_0x69a5('0x39')]){_0x5d6153[_0x69a5('0x37')]=_[_0x69a5('0x3a')](_0x5d6153[_0x69a5('0x37')],{'$or':_['map'](_0x2651ee,function(_0x2b229b){if(_0x2b229b[_0x69a5('0x2a')]!=='VIRTUAL'){var _0x40067c={};_0x40067c[_0x2b229b[_0x69a5('0x25')]]={'$like':'%'+_0x5b1602[_0x69a5('0x2e')][_0x69a5('0x39')]+'%'};return _0x40067c;}})});}_0x5d6153=_[_0x69a5('0x3a')]({},_0x5d6153,_0x5b1602[_0x69a5('0x3b')]);var _0xc6df4f={'where':_0x5d6153[_0x69a5('0x37')]};return db[_0x69a5('0x28')][_0x69a5('0x19')](_0xc6df4f)['then'](function(_0x17cc70){_0x461d7b[_0x69a5('0x19')]=_0x17cc70;if(_0x5b1602[_0x69a5('0x2e')][_0x69a5('0x3c')]){_0x5d6153[_0x69a5('0x3d')]=[{'all':!![]}];}return db[_0x69a5('0x28')][_0x69a5('0x3e')](_0x5d6153);})[_0x69a5('0x1e')](function(_0x400516){_0x461d7b[_0x69a5('0x3f')]=_0x400516;return _0x461d7b;})[_0x69a5('0x1e')](respondWithFilteredResult(_0x49664f,_0x5d6153))[_0x69a5('0x40')](handleError(_0x49664f,null));};exports['show']=function(_0x17cac0,_0x59d094){var _0x1e4b93={'raw':![],'where':{'id':_0x17cac0[_0x69a5('0x41')]['id']}},_0x5ae287={};_0x5ae287['model']=_['keys'](db[_0x69a5('0x28')]['rawAttributes']);_0x5ae287['query']=_[_0x69a5('0x2f')](_0x17cac0[_0x69a5('0x2e')]);_0x5ae287[_0x69a5('0x38')]=_[_0x69a5('0x42')](_0x5ae287[_0x69a5('0x2c')],_0x5ae287[_0x69a5('0x2e')]);_0x1e4b93[_0x69a5('0x30')]=_[_0x69a5('0x42')](_0x5ae287[_0x69a5('0x2c')],qs[_0x69a5('0x31')](_0x17cac0['query'][_0x69a5('0x31')]));_0x1e4b93['attributes']=_0x1e4b93['attributes'][_0x69a5('0x32')]?_0x1e4b93[_0x69a5('0x30')]:_0x5ae287[_0x69a5('0x2c')];if(_0x17cac0['query'][_0x69a5('0x3c')]){_0x1e4b93[_0x69a5('0x3d')]=[{'all':!![]}];}_0x1e4b93=_[_0x69a5('0x3a')]({},_0x1e4b93,_0x17cac0[_0x69a5('0x3b')]);return db[_0x69a5('0x28')][_0x69a5('0x43')](_0x1e4b93)[_0x69a5('0x1e')](handleEntityNotFound(_0x59d094,null))[_0x69a5('0x1e')](respondWithResult(_0x59d094,null))[_0x69a5('0x40')](handleError(_0x59d094,null));};exports[_0x69a5('0x44')]=function(_0x2bc35b,_0x2507a2){return db[_0x69a5('0x28')][_0x69a5('0x44')](_0x2bc35b[_0x69a5('0x45')],{})[_0x69a5('0x1e')](function(_0x129a8b){var _0x152b9e=_0x2bc35b[_0x69a5('0x46')]['get']({'plain':!![]});if(!_0x152b9e)throw new Error(_0x69a5('0x47'));if(_0x152b9e[_0x69a5('0x48')]===_0x69a5('0x46')){var _0x44d98c=_0x129a8b[_0x69a5('0x20')]({'plain':!![]});var _0x5b6ddf=_0x69a5('0x21');return db[_0x69a5('0x49')][_0x69a5('0x43')]({'where':{'name':_0x5b6ddf,'userProfileId':_0x152b9e['userProfileId']},'raw':!![]})[_0x69a5('0x1e')](function(_0x52aaa5){if(_0x52aaa5&&_0x52aaa5[_0x69a5('0x4a')]===0x0){return db[_0x69a5('0x22')]['create']({'name':_0x44d98c['name'],'resourceId':_0x44d98c['id'],'type':_0x52aaa5[_0x69a5('0x25')],'sectionId':_0x52aaa5['id']},{})[_0x69a5('0x1e')](function(){return _0x129a8b;});}else{return _0x129a8b;}})['catch'](function(_0x381452){logger[_0x69a5('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x381452);throw _0x381452;});}return _0x129a8b;})[_0x69a5('0x1e')](respondWithResult(_0x2507a2,0xc9))[_0x69a5('0x40')](handleError(_0x2507a2,null));};exports[_0x69a5('0x4b')]=function(_0xea8f6c,_0x1c12d6){if(_0xea8f6c['body']['id']){delete _0xea8f6c[_0x69a5('0x45')]['id'];}return db[_0x69a5('0x28')][_0x69a5('0x43')]({'where':{'id':_0xea8f6c[_0x69a5('0x41')]['id']}})['then'](handleEntityNotFound(_0x1c12d6,null))['then'](saveUpdates(_0xea8f6c[_0x69a5('0x45')],null))[_0x69a5('0x1e')](respondWithResult(_0x1c12d6,null))[_0x69a5('0x40')](handleError(_0x1c12d6,null));};exports[_0x69a5('0x1f')]=function(_0x528f56,_0x48951c){return db[_0x69a5('0x28')][_0x69a5('0x43')]({'where':{'id':_0x528f56[_0x69a5('0x41')]['id']}})[_0x69a5('0x1e')](handleEntityNotFound(_0x48951c,null))[_0x69a5('0x1e')](removeEntity(_0x48951c,null))[_0x69a5('0x40')](handleError(_0x48951c,null));};exports[_0x69a5('0x4c')]=function(_0x1e9f07,_0x4462cf,_0x1e452a){var _0x273f69=require(_0x69a5('0x4d'));return db[_0x69a5('0x28')][_0x69a5('0x43')]({'where':{'id':_0x1e9f07[_0x69a5('0x41')]['id']},'raw':!![]})[_0x69a5('0x1e')](handleEntityNotFound(_0x4462cf,null))['then'](function(){_0x273f69[_0x69a5('0x4c')](_0x1e9f07[_0x69a5('0x41')]['id']);})[_0x69a5('0x1e')](respondWithStatusCode(_0x4462cf,null))[_0x69a5('0x40')](handleError(_0x4462cf,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 2ce3cfb..0ce50e6 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 _0x8456=['request-promise','path','exports','define','Schedule','tools_schedules','util','../../config/logger','api'];(function(_0x4973b7,_0x463138){var _0x40fb49=function(_0x1b9c32){while(--_0x1b9c32){_0x4973b7['push'](_0x4973b7['shift']());}};_0x40fb49(++_0x463138);}(_0x8456,0x126));var _0x6845=function(_0x47e5ce,_0x1d87f0){_0x47e5ce=_0x47e5ce-0x0;var _0xa78774=_0x8456[_0x47e5ce];return _0xa78774;};'use strict';var _=require('lodash');var util=require(_0x6845('0x0'));var logger=require(_0x6845('0x1'))(_0x6845('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6845('0x3'));var fs=require('fs');var path=require(_0x6845('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./schedule.attributes');module[_0x6845('0x5')]=function(_0x543f8e,_0x5a7928){return _0x543f8e[_0x6845('0x6')](_0x6845('0x7'),attributes,{'tableName':_0x6845('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed0d=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./schedule.attributes','define','Schedule','tools_schedules'];(function(_0x3e182f,_0x380ec7){var _0x23edc9=function(_0x3ca65e){while(--_0x3ca65e){_0x3e182f['push'](_0x3e182f['shift']());}};_0x23edc9(++_0x380ec7);}(_0xed0d,0x75));var _0xded0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xed0d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xded0('0x0'));var util=require(_0xded0('0x1'));var logger=require(_0xded0('0x2'))(_0xded0('0x3'));var moment=require(_0xded0('0x4'));var BPromise=require(_0xded0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xded0('0x6'));var rimraf=require(_0xded0('0x7'));var config=require(_0xded0('0x8'));var attributes=require(_0xded0('0x9'));module['exports']=function(_0xf1f295,_0x290f13){return _0xf1f295[_0xded0('0xa')](_0xded0('0xb'),attributes,{'tableName':_0xded0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index f746444..0927245 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 _0x279b=['client','http','then','info','debug','request\x20sent','stringify','error','code','Schedule,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x279b,0xe5));var _0xb279=function(_0x3187a7,_0x4c7bf5){_0x3187a7=_0x3187a7-0x0;var _0x30ce86=_0x279b[_0x3187a7];return _0x30ce86;};'use strict';var _=require(_0xb279('0x0'));var util=require(_0xb279('0x1'));var moment=require(_0xb279('0x2'));var BPromise=require(_0xb279('0x3'));var rs=require(_0xb279('0x4'));var fs=require('fs');var Redis=require(_0xb279('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb279('0x6'));var logger=require(_0xb279('0x7'))(_0xb279('0x8'));var config=require(_0xb279('0x9'));var jayson=require(_0xb279('0xa'));var client=jayson[_0xb279('0xb')][_0xb279('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x15737b,_0x3a7b12,_0x35feb4){return new BPromise(function(_0x20d4e9,_0x266b24){return client['request'](_0x15737b,_0x35feb4)[_0xb279('0xd')](function(_0x5c6b2a){logger[_0xb279('0xe')]('Schedule,\x20%s,\x20%s',_0x3a7b12,'request\x20sent');logger[_0xb279('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x3a7b12,_0xb279('0x10'),JSON[_0xb279('0x11')](_0x5c6b2a));if(_0x5c6b2a[_0xb279('0x12')]){if(_0x5c6b2a['error'][_0xb279('0x13')]===0x1f4){logger['error'](_0xb279('0x14'),_0x3a7b12,_0x5c6b2a[_0xb279('0x12')]['message']);return _0x266b24(_0x5c6b2a[_0xb279('0x12')][_0xb279('0x15')]);}logger[_0xb279('0x12')]('Schedule,\x20%s,\x20%s',_0x3a7b12,_0x5c6b2a[_0xb279('0x12')][_0xb279('0x15')]);return _0x20d4e9(_0x5c6b2a[_0xb279('0x12')][_0xb279('0x15')]);}else{logger['info'](_0xb279('0x14'),_0x3a7b12,'request\x20sent');_0x20d4e9(_0x5c6b2a[_0xb279('0x16')][_0xb279('0x15')]);}})[_0xb279('0x17')](function(_0x3ce438){logger[_0xb279('0x12')]('Schedule,\x20%s,\x20%s',_0x3a7b12,_0x3ce438);_0x266b24(_0x3ce438);});});} \ No newline at end of file +var _0xdcd3=['info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','then'];(function(_0x434e6a,_0x21339b){var _0x154b69=function(_0xe36402){while(--_0xe36402){_0x434e6a['push'](_0x434e6a['shift']());}};_0x154b69(++_0x21339b);}(_0xdcd3,0x15e));var _0x3dcd=function(_0x1d717f,_0x45d90d){_0x1d717f=_0x1d717f-0x0;var _0x578f33=_0xdcd3[_0x1d717f];return _0x578f33;};'use strict';var _=require(_0x3dcd('0x0'));var util=require(_0x3dcd('0x1'));var moment=require('moment');var BPromise=require(_0x3dcd('0x2'));var rs=require(_0x3dcd('0x3'));var fs=require('fs');var Redis=require(_0x3dcd('0x4'));var db=require(_0x3dcd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3dcd('0x6'))(_0x3dcd('0x7'));var config=require(_0x3dcd('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2be1da,_0x1a58f3,_0x31ebd4){return new BPromise(function(_0x42b4fa,_0x2ecc40){return client['request'](_0x2be1da,_0x31ebd4)[_0x3dcd('0x9')](function(_0x18c939){logger[_0x3dcd('0xa')](_0x3dcd('0xb'),_0x1a58f3,_0x3dcd('0xc'));logger[_0x3dcd('0xd')](_0x3dcd('0xe'),_0x1a58f3,'request\x20sent',JSON['stringify'](_0x18c939));if(_0x18c939[_0x3dcd('0xf')]){if(_0x18c939['error'][_0x3dcd('0x10')]===0x1f4){logger[_0x3dcd('0xf')]('Schedule,\x20%s,\x20%s',_0x1a58f3,_0x18c939[_0x3dcd('0xf')]['message']);return _0x2ecc40(_0x18c939[_0x3dcd('0xf')][_0x3dcd('0x11')]);}logger[_0x3dcd('0xf')](_0x3dcd('0xb'),_0x1a58f3,_0x18c939[_0x3dcd('0xf')][_0x3dcd('0x11')]);return _0x42b4fa(_0x18c939[_0x3dcd('0xf')][_0x3dcd('0x11')]);}else{logger[_0x3dcd('0xa')](_0x3dcd('0xb'),_0x1a58f3,_0x3dcd('0xc'));_0x42b4fa(_0x18c939[_0x3dcd('0x12')]['message']);}})[_0x3dcd('0x13')](function(_0x42107d){logger[_0x3dcd('0xf')](_0x3dcd('0xb'),_0x1a58f3,_0x42107d);_0x2ecc40(_0x42107d);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index f3b37c2..7c7c64a 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 _0x6a38=['download','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/download'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x6a38,0x1eb));var _0x86a3=function(_0x13f72c,_0x27ea71){_0x13f72c=_0x13f72c-0x0;var _0x5900be=_0x6a38[_0x13f72c];return _0x5900be;};'use strict';var multer=require(_0x86a3('0x0'));var util=require(_0x86a3('0x1'));var path=require('path');var timeout=require(_0x86a3('0x2'));var express=require(_0x86a3('0x3'));var router=express['Router']();var fs_extra=require(_0x86a3('0x4'));var auth=require(_0x86a3('0x5'));var interaction=require(_0x86a3('0x6'));var config=require('../../config/environment');var controller=require(_0x86a3('0x7'));router['get']('/',auth[_0x86a3('0x8')](),controller['index']);router[_0x86a3('0x9')](_0x86a3('0xa'),auth[_0x86a3('0x8')](),controller[_0x86a3('0xb')]);router[_0x86a3('0x9')](_0x86a3('0xc'),auth['isAuthenticated'](),controller[_0x86a3('0xd')]);router['get'](_0x86a3('0xe'),auth[_0x86a3('0x8')](),controller[_0x86a3('0xf')]);router[_0x86a3('0x10')]('/',auth['isAuthenticated'](),controller[_0x86a3('0x11')]);router[_0x86a3('0x12')](_0x86a3('0xc'),auth['isAuthenticated'](),controller[_0x86a3('0x13')]);router[_0x86a3('0x14')](_0x86a3('0xc'),auth['isAuthenticated'](),controller[_0x86a3('0x15')]);module[_0x86a3('0x16')]=router; \ No newline at end of file +var _0xafc1=['isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x301652,_0x1adc45){var _0x3d38b6=function(_0x38fc37){while(--_0x38fc37){_0x301652['push'](_0x301652['shift']());}};_0x3d38b6(++_0x1adc45);}(_0xafc1,0xae));var _0x1afc=function(_0x5efa1b,_0x21dba7){_0x5efa1b=_0x5efa1b-0x0;var _0x373d7a=_0xafc1[_0x5efa1b];return _0x373d7a;};'use strict';var multer=require(_0x1afc('0x0'));var util=require('util');var path=require(_0x1afc('0x1'));var timeout=require(_0x1afc('0x2'));var express=require(_0x1afc('0x3'));var router=express[_0x1afc('0x4')]();var fs_extra=require(_0x1afc('0x5'));var auth=require(_0x1afc('0x6'));var interaction=require(_0x1afc('0x7'));var config=require(_0x1afc('0x8'));var controller=require('./screenRecording.controller');router[_0x1afc('0x9')]('/',auth[_0x1afc('0xa')](),controller[_0x1afc('0xb')]);router[_0x1afc('0x9')](_0x1afc('0xc'),auth[_0x1afc('0xa')](),controller[_0x1afc('0xd')]);router[_0x1afc('0x9')](_0x1afc('0xe'),auth[_0x1afc('0xa')](),controller[_0x1afc('0xf')]);router[_0x1afc('0x9')](_0x1afc('0x10'),auth[_0x1afc('0xa')](),controller[_0x1afc('0x11')]);router[_0x1afc('0x12')]('/',auth[_0x1afc('0xa')](),controller['create']);router[_0x1afc('0x13')](_0x1afc('0xe'),auth[_0x1afc('0xa')](),controller['update']);router[_0x1afc('0x14')](_0x1afc('0xe'),auth[_0x1afc('0xa')](),controller[_0x1afc('0x15')]);module[_0x1afc('0x16')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 232cb10..aedfc4e 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 _0xa1c5=['DATE','format','MM-DD-YYYY\x20HH:mm','createdAt','toString','updatedAt','sequelize','moment','path','VIRTUAL','getDataValue','value','STRING','replace','INTEGER','setDataValue','subtract','closedAt'];(function(_0xce5c3c,_0x317488){var _0x3a1ae8=function(_0x2b323e){while(--_0x2b323e){_0xce5c3c['push'](_0xce5c3c['shift']());}};_0x3a1ae8(++_0x317488);}(_0xa1c5,0x96));var _0x5a1c=function(_0x775773,_0x588708){_0x775773=_0x775773-0x0;var _0x4149a7=_0xa1c5[_0x775773];return _0x4149a7;};'use strict';var Sequelize=require(_0x5a1c('0x0'));var moment=require(_0x5a1c('0x1'));var path=require(_0x5a1c('0x2'));var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0x5a1c('0x3')],'get':function(){return this[_0x5a1c('0x4')](_0x5a1c('0x5'))?path['extname'](this[_0x5a1c('0x4')](_0x5a1c('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x5a1c('0x6')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x5a1c('0x6')],'set':function(_0x471644){var _0x5a77f6=_0x471644[_0x5a1c('0x7')](/\\/g,'/');this['setDataValue'](_0x5a1c('0x5'),_0x5a77f6);}},'rating':{'type':Sequelize[_0x5a1c('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x5a1c('0x8')],'set':function(_0x2214b7){this[_0x5a1c('0x9')]('startedAt',moment()[_0x5a1c('0xa')](_0x2214b7,'ms'));this['setDataValue'](_0x5a1c('0xb'),moment());this[_0x5a1c('0x9')]('duration',_0x2214b7);}},'startedAt':{'type':Sequelize[_0x5a1c('0xc')],'get':function(){return moment(this[_0x5a1c('0x4')]('startedAt'))[_0x5a1c('0xd')](_0x5a1c('0xe'))['toString']();}},'closedAt':{'type':Sequelize[_0x5a1c('0xc')],'get':function(){return moment(this[_0x5a1c('0x4')]('closedAt'))['format'](_0x5a1c('0xe'))['toString']();}},'createdAt':{'type':Sequelize[_0x5a1c('0xc')],'get':function(){return moment(this[_0x5a1c('0x4')](_0x5a1c('0xf')))['format']('MM-DD-YYYY\x20HH:mm')[_0x5a1c('0x10')]();}},'updatedAt':{'type':Sequelize[_0x5a1c('0xc')],'get':function(){return moment(this[_0x5a1c('0x4')](_0x5a1c('0x11')))[_0x5a1c('0xd')]('MM-DD-YYYY\x20HH:mm')[_0x5a1c('0x10')]();}}}; \ No newline at end of file +var _0x2a07=['DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration'];(function(_0x4e8c32,_0x2e170e){var _0x5e35e1=function(_0x305685){while(--_0x305685){_0x4e8c32['push'](_0x4e8c32['shift']());}};_0x5e35e1(++_0x2e170e);}(_0x2a07,0x74));var _0x72a0=function(_0x2610db,_0x454344){_0x2610db=_0x2610db-0x0;var _0x5d4d96=_0x2a07[_0x2610db];return _0x5d4d96;};'use strict';var Sequelize=require(_0x72a0('0x0'));var moment=require(_0x72a0('0x1'));var path=require(_0x72a0('0x2'));var config=require(_0x72a0('0x3'));module[_0x72a0('0x4')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x72a0('0x5')](_0x72a0('0x6'))?path[_0x72a0('0x7')](this[_0x72a0('0x5')](_0x72a0('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x72a0('0x8')]},'channel':{'type':Sequelize[_0x72a0('0x8')]},'value':{'type':Sequelize[_0x72a0('0x8')],'set':function(_0x193e3b){var _0x287b06=_0x193e3b[_0x72a0('0x9')](/\\/g,'/');this[_0x72a0('0xa')](_0x72a0('0x6'),_0x287b06);}},'rating':{'type':Sequelize[_0x72a0('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x72a0('0xb')],'set':function(_0x2bc45b){this['setDataValue'](_0x72a0('0xc'),moment()[_0x72a0('0xd')](_0x2bc45b,'ms'));this['setDataValue'](_0x72a0('0xe'),moment());this[_0x72a0('0xa')](_0x72a0('0xf'),_0x2bc45b);}},'startedAt':{'type':Sequelize[_0x72a0('0x10')],'get':function(){return moment(this[_0x72a0('0x5')]('startedAt'))[_0x72a0('0x11')](_0x72a0('0x12'))[_0x72a0('0x13')]();}},'closedAt':{'type':Sequelize[_0x72a0('0x10')],'get':function(){return moment(this[_0x72a0('0x5')](_0x72a0('0xe')))[_0x72a0('0x11')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize[_0x72a0('0x10')],'get':function(){return moment(this[_0x72a0('0x5')](_0x72a0('0x14')))[_0x72a0('0x11')](_0x72a0('0x12'))[_0x72a0('0x13')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x72a0('0x5')](_0x72a0('0x15')))[_0x72a0('0x11')](_0x72a0('0x12'))[_0x72a0('0x13')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 7008073..b0b8e3d 100644 --- a/server/api/screenRecording/screenRecording.controller.js +++ b/server/api/screenRecording/screenRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee14=['path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','ScreenRecording','includeAll','include','findAll','rows','catch','params','find','create','body','duration','describe','../../components/encryptor','uniqueid','value','server/files/screen_recordings','existsSync','decryptFile','secrets','recording','root','Sequelize','ValidationError','filename','download','unlink','ScreenRecording\x20not\x20found','isNil','Entity\x20not\x20found','join','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x2d80da,_0x4153a5){var _0x4189ff=function(_0x537789){while(--_0x537789){_0x2d80da['push'](_0x2d80da['shift']());}};_0x4189ff(++_0x4153a5);}(_0xee14,0x13a));var _0x4ee1=function(_0x14aaae,_0x1a261){_0x14aaae=_0x14aaae-0x0;var _0x5a1189=_0xee14[_0x14aaae];return _0x5a1189;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4ee1('0x0'));var jsonpatch=require(_0x4ee1('0x1'));var rp=require(_0x4ee1('0x2'));var moment=require(_0x4ee1('0x3'));var BPromise=require(_0x4ee1('0x4'));var Mustache=require(_0x4ee1('0x5'));var util=require(_0x4ee1('0x6'));var path=require(_0x4ee1('0x7'));var sox=require(_0x4ee1('0x8'));var csv=require('to-csv');var ejs=require(_0x4ee1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ee1('0xa'));var squel=require(_0x4ee1('0xb'));var crypto=require(_0x4ee1('0xc'));var jsforce=require(_0x4ee1('0xd'));var deskjs=require(_0x4ee1('0xe'));var toCsv=require(_0x4ee1('0xf'));var querystring=require('querystring');var Papa=require(_0x4ee1('0x10'));var Redis=require(_0x4ee1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4ee1('0x12'));var as=require(_0x4ee1('0x13'));var hardwareService=require(_0x4ee1('0x14'));var logger=require(_0x4ee1('0x15'))('api');var utils=require(_0x4ee1('0x16'));var config=require(_0x4ee1('0x17'));var licenseUtil=require(_0x4ee1('0x18'));var db=require(_0x4ee1('0x19'))['db'];function respondWithStatusCode(_0x2f864e,_0x174427){_0x174427=_0x174427||0xcc;return function(_0x5616d6){if(_0x5616d6){return _0x2f864e[_0x4ee1('0x1a')](_0x174427);}return _0x2f864e[_0x4ee1('0x1b')](_0x174427)[_0x4ee1('0x1c')]();};}function respondWithResult(_0x24a915,_0x46d2c2){_0x46d2c2=_0x46d2c2||0xc8;return function(_0x1c342a){if(_0x1c342a){return _0x24a915[_0x4ee1('0x1b')](_0x46d2c2)[_0x4ee1('0x1d')](_0x1c342a);}};}function respondWithFilteredResult(_0xb7eafd,_0x4e3490){return function(_0x2f9194){if(_0x2f9194){var _0x38008f=typeof _0x4e3490[_0x4ee1('0x1e')]===_0x4ee1('0x1f')&&typeof _0x4e3490[_0x4ee1('0x20')]===_0x4ee1('0x1f');var _0x2eff91=_0x2f9194[_0x4ee1('0x21')];var _0x360056=_0x38008f?0x0:_0x4e3490[_0x4ee1('0x1e')];var _0x274de5=_0x38008f?_0x2f9194['count']:_0x4e3490[_0x4ee1('0x1e')]+_0x4e3490[_0x4ee1('0x20')];var _0x173388;if(_0x274de5>=_0x2eff91){_0x274de5=_0x2eff91;_0x173388=0xc8;}else{_0x173388=0xce;}_0xb7eafd[_0x4ee1('0x1b')](_0x173388);return _0xb7eafd[_0x4ee1('0x22')](_0x4ee1('0x23'),_0x360056+'-'+_0x274de5+'/'+_0x2eff91)['json'](_0x2f9194);}return null;};}function patchUpdates(_0x8a631f){return function(_0x333e96){try{jsonpatch[_0x4ee1('0x24')](_0x333e96,_0x8a631f,!![]);}catch(_0x3f0d59){return BPromise[_0x4ee1('0x25')](_0x3f0d59);}return _0x333e96[_0x4ee1('0x26')]();};}function saveUpdates(_0x328f21,_0x40fd98){return function(_0x1dc1a8){if(_0x1dc1a8){return _0x1dc1a8[_0x4ee1('0x27')](_0x328f21)['then'](function(_0x53d43f){return _0x53d43f;});}return null;};}function removeEntity(_0x14110c,_0x459e2e){return function(_0xaf87e7){if(_0xaf87e7){return _0xaf87e7[_0x4ee1('0x28')]()[_0x4ee1('0x29')](function(){_0x14110c[_0x4ee1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cc0b5,_0x442c71){return function(_0x28b7e1){if(!_0x28b7e1){_0x5cc0b5['sendStatus'](0x194);}return _0x28b7e1;};}function handleError(_0x35900d,_0x213db8){_0x213db8=_0x213db8||0x1f4;return function(_0x36654c){logger[_0x4ee1('0x2a')](_0x36654c[_0x4ee1('0x2b')]);if(_0x36654c[_0x4ee1('0x2c')]){delete _0x36654c[_0x4ee1('0x2c')];}_0x35900d['status'](_0x213db8)[_0x4ee1('0x2d')](_0x36654c);};}exports['index']=function(_0x4746c2,_0x4ec408){var _0x3dc870={},_0x1d91be={},_0x59a34e={'count':0x0,'rows':[]};var _0x13944c=_[_0x4ee1('0x2e')](db['ScreenRecording'][_0x4ee1('0x2f')],function(_0x5b3792){return{'name':_0x5b3792[_0x4ee1('0x30')],'type':_0x5b3792[_0x4ee1('0x31')][_0x4ee1('0x32')]};});_0x1d91be[_0x4ee1('0x33')]=_[_0x4ee1('0x34')](_['map'](_0x13944c,_0x4ee1('0x2c')),[_0x4ee1('0x35')]);_0x1d91be[_0x4ee1('0x36')]=_[_0x4ee1('0x37')](_0x4746c2[_0x4ee1('0x36')]);_0x1d91be[_0x4ee1('0x38')]=_['intersection'](_0x1d91be['model'],_0x1d91be[_0x4ee1('0x36')]);_0x3dc870[_0x4ee1('0x39')]=_[_0x4ee1('0x3a')](_0x1d91be['model'],qs[_0x4ee1('0x3b')](_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x3b')]));_0x3dc870[_0x4ee1('0x39')]=_0x3dc870[_0x4ee1('0x39')][_0x4ee1('0x3c')]?_0x3dc870[_0x4ee1('0x39')]:_0x1d91be[_0x4ee1('0x33')];if(!_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x3d')](_0x4ee1('0x3e'))){_0x3dc870[_0x4ee1('0x20')]=qs[_0x4ee1('0x20')](_0x4746c2['query'][_0x4ee1('0x20')]);_0x3dc870[_0x4ee1('0x1e')]=qs[_0x4ee1('0x1e')](_0x4746c2['query']['offset']);}_0x3dc870[_0x4ee1('0x3f')]=qs[_0x4ee1('0x40')](_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x40')]);_0x3dc870['where']=qs[_0x4ee1('0x38')](_[_0x4ee1('0x41')](_0x4746c2[_0x4ee1('0x36')],_0x1d91be[_0x4ee1('0x38')]),_0x13944c);if(_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x42')]){_0x3dc870[_0x4ee1('0x43')]=_[_0x4ee1('0x44')](_0x3dc870['where'],{'$or':_[_0x4ee1('0x2e')](_0x13944c,function(_0x1116b4){if(_0x1116b4[_0x4ee1('0x31')]!==_0x4ee1('0x45')){var _0x45bb22={};_0x45bb22[_0x1116b4[_0x4ee1('0x2c')]]={'$like':'%'+_0x4746c2['query'][_0x4ee1('0x42')]+'%'};return _0x45bb22;}})});}_0x3dc870=_[_0x4ee1('0x44')]({},_0x3dc870,_0x4746c2[_0x4ee1('0x46')]);var _0x333690={'where':_0x3dc870[_0x4ee1('0x43')]};return db[_0x4ee1('0x47')][_0x4ee1('0x21')](_0x333690)[_0x4ee1('0x29')](function(_0x23bb5f){_0x59a34e[_0x4ee1('0x21')]=_0x23bb5f;if(_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x48')]){_0x3dc870[_0x4ee1('0x49')]=[{'all':!![]}];}return db['ScreenRecording'][_0x4ee1('0x4a')](_0x3dc870);})[_0x4ee1('0x29')](function(_0x5ee7b4){_0x59a34e[_0x4ee1('0x4b')]=_0x5ee7b4;return _0x59a34e;})['then'](respondWithFilteredResult(_0x4ec408,_0x3dc870))[_0x4ee1('0x4c')](handleError(_0x4ec408,null));};exports['show']=function(_0x14c333,_0xc7580c){var _0x557126={'raw':![],'where':{'id':_0x14c333[_0x4ee1('0x4d')]['id']}},_0x25d683={};_0x25d683[_0x4ee1('0x33')]=_[_0x4ee1('0x37')](db['ScreenRecording'][_0x4ee1('0x2f')]);_0x25d683[_0x4ee1('0x36')]=_[_0x4ee1('0x37')](_0x14c333['query']);_0x25d683['filters']=_[_0x4ee1('0x3a')](_0x25d683[_0x4ee1('0x33')],_0x25d683[_0x4ee1('0x36')]);_0x557126[_0x4ee1('0x39')]=_[_0x4ee1('0x3a')](_0x25d683['model'],qs['fields'](_0x14c333[_0x4ee1('0x36')][_0x4ee1('0x3b')]));_0x557126[_0x4ee1('0x39')]=_0x557126[_0x4ee1('0x39')]['length']?_0x557126[_0x4ee1('0x39')]:_0x25d683[_0x4ee1('0x33')];if(_0x14c333['query'][_0x4ee1('0x48')]){_0x557126[_0x4ee1('0x49')]=[{'all':!![]}];}_0x557126=_[_0x4ee1('0x44')]({},_0x557126,_0x14c333[_0x4ee1('0x46')]);return db[_0x4ee1('0x47')][_0x4ee1('0x4e')](_0x557126)[_0x4ee1('0x29')](handleEntityNotFound(_0xc7580c,null))[_0x4ee1('0x29')](respondWithResult(_0xc7580c,null))[_0x4ee1('0x4c')](handleError(_0xc7580c,null));};exports['create']=function(_0x49b667,_0x1a972b){return db[_0x4ee1('0x47')][_0x4ee1('0x4f')](_0x49b667[_0x4ee1('0x50')],{})['then'](respondWithResult(_0x1a972b,0xc9))[_0x4ee1('0x4c')](handleError(_0x1a972b,null));};exports[_0x4ee1('0x27')]=function(_0x42dd8d,_0x2bc77f){if(_0x42dd8d[_0x4ee1('0x50')]['id']){delete _0x42dd8d['body']['id'];}delete _0x42dd8d[_0x4ee1('0x50')][_0x4ee1('0x51')];delete _0x42dd8d[_0x4ee1('0x50')]['createdAt'];delete _0x42dd8d[_0x4ee1('0x50')]['closedAt'];delete _0x42dd8d[_0x4ee1('0x50')]['value'];return db[_0x4ee1('0x47')]['find']({'where':{'id':_0x42dd8d[_0x4ee1('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2bc77f,null))[_0x4ee1('0x29')](saveUpdates(_0x42dd8d[_0x4ee1('0x50')],null))[_0x4ee1('0x29')](respondWithResult(_0x2bc77f,null))['catch'](handleError(_0x2bc77f,null));};exports[_0x4ee1('0x52')]=function(_0x4118d7,_0xcdb873){return db[_0x4ee1('0x47')][_0x4ee1('0x52')]()[_0x4ee1('0x29')](respondWithResult(_0xcdb873,null))[_0x4ee1('0x4c')](handleError(_0xcdb873,null));};exports['download']=function(_0x4c4178,_0x1feb78,_0xcddc5d){var _0xf58cd8=require(_0x4ee1('0x53'));var _0x44e65f=![];var _0x31e82d={};if(_0x4c4178[_0x4ee1('0x36')][_0x4ee1('0x31')]&&_0x4c4178[_0x4ee1('0x36')][_0x4ee1('0x31')]===_0x4ee1('0x54')){_0x31e82d[_0x4ee1('0x54')]=_0x4c4178[_0x4ee1('0x4d')]['id'];}else{_0x31e82d['id']=_0x4c4178['params']['id'];}return db[_0x4ee1('0x47')]['find']({'where':_0x31e82d,'attributes':['id',_0x4ee1('0x55')],'raw':!![]})[_0x4ee1('0x29')](handleEntityNotFound(_0x1feb78,null))['then'](function(_0x1e0aac){if(_0x1e0aac){var _0x184e36=path['join'](config['root'],_0x4ee1('0x56'),_0x1e0aac['value']);var _0x1ce99e=util[_0x4ee1('0x35')]('%s.cypher',_0x184e36);if(fs[_0x4ee1('0x57')](_0x1ce99e)){_0x44e65f=!![];return _0xf58cd8[_0x4ee1('0x58')](_0x1ce99e,_0x184e36,config[_0x4ee1('0x59')][_0x4ee1('0x5a')])[_0x4ee1('0x29')](function(){return _0x1e0aac;});}return _0x1e0aac;}})[_0x4ee1('0x29')](function(_0x11f619){if(_0x11f619){var _0x5f5694=path['join'](config[_0x4ee1('0x5b')],_0x4ee1('0x56'),_0x11f619['value']);if(!fs[_0x4ee1('0x57')](_0x5f5694)){throw new db[(_0x4ee1('0x5c'))][(_0x4ee1('0x5d'))]('ScreenRecording\x20not\x20found');}if(_0x11f619[_0x4ee1('0x5e')]){return _0x1feb78['download'](_0x5f5694,_0x11f619[_0x4ee1('0x5e')]+path['extname'](_0x5f5694),function(){if(_0x44e65f){fs['unlink'](_0x5f5694);}});}else{return _0x1feb78[_0x4ee1('0x5f')](_0x5f5694,function(_0x16fcd0){if(_0x44e65f){fs[_0x4ee1('0x60')](_0x5f5694);}});}}})[_0x4ee1('0x4c')](function(_0x38e889){if(_0x38e889['message']===_0x4ee1('0x61')){_0x1feb78[_0x4ee1('0x1b')](0x194)[_0x4ee1('0x2d')]('Not\x20found');}else{return handleError(_0x1feb78,null);}});};exports[_0x4ee1('0x28')]=function(_0x109dc6,_0x3fdd61){return db[_0x4ee1('0x47')][_0x4ee1('0x4e')]({'where':{'id':_0x109dc6[_0x4ee1('0x4d')]['id']}})[_0x4ee1('0x29')](function(_0x20ca0b){if(_[_0x4ee1('0x62')](_0x20ca0b)){throw new ReferenceError(_0x4ee1('0x63'));}return _0x20ca0b;})[_0x4ee1('0x29')](function(_0x38e86f){var _0x5d396c=path[_0x4ee1('0x64')](config['root'],_0x4ee1('0x56'),_0x38e86f['value']);logger[_0x4ee1('0x65')](_0x4ee1('0x66'),_0x5d396c);if(!_[_0x4ee1('0x62')](_0x38e86f[_0x4ee1('0x55')])&&fs[_0x4ee1('0x57')](_0x5d396c)){logger[_0x4ee1('0x65')](_0x4ee1('0x67')+_0x5d396c+_0x4ee1('0x68'));fs[_0x4ee1('0x69')](_0x5d396c);}_0x5d396c=_0x5d396c+_0x4ee1('0x6a');if(!_[_0x4ee1('0x62')](_0x38e86f[_0x4ee1('0x55')])&&fs['existsSync'](_0x5d396c)){logger[_0x4ee1('0x65')](_0x4ee1('0x67')+_0x5d396c+_0x4ee1('0x68'));fs['unlinkSync'](_0x5d396c);}return _0x38e86f;})['then'](function(_0x40dac3){if(!_0x40dac3)throw new InternalError();return _0x40dac3[_0x4ee1('0x28')]();})['then'](function(){_0x3fdd61[_0x4ee1('0x1b')](0xcc)[_0x4ee1('0x1c')]();})[_0x4ee1('0x4c')](handleError(_0x3fdd61,null));}; \ No newline at end of file +var _0xbd50=['unlinkSync','.cypher','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','error','stack','name','send','index','map','rawAttributes','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','ScreenRecording','includeAll','findAll','rows','catch','params','include','find','create','body','update','duration','value','describe','../../components/encryptor','uniqueid','join','root','%s.cypher','existsSync','decryptFile','recording','server/files/screen_recordings','ValidationError','filename','extname','download','unlink','message','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione'];(function(_0x1c682e,_0x36456c){var _0x5c8512=function(_0x41cf4c){while(--_0x41cf4c){_0x1c682e['push'](_0x1c682e['shift']());}};_0x5c8512(++_0x36456c);}(_0xbd50,0x196));var _0x0bd5=function(_0x58482c,_0x10c672){_0x58482c=_0x58482c-0x0;var _0x449f6c=_0xbd50[_0x58482c];return _0x449f6c;};'use strict';var emlformat=require(_0x0bd5('0x0'));var rimraf=require(_0x0bd5('0x1'));var zipdir=require(_0x0bd5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0bd5('0x3'));var moment=require(_0x0bd5('0x4'));var BPromise=require(_0x0bd5('0x5'));var Mustache=require(_0x0bd5('0x6'));var util=require(_0x0bd5('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0bd5('0x8'));var fs=require('fs');var fs_extra=require(_0x0bd5('0x9'));var _=require(_0x0bd5('0xa'));var squel=require(_0x0bd5('0xb'));var crypto=require(_0x0bd5('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0bd5('0xd'));var querystring=require(_0x0bd5('0xe'));var Papa=require(_0x0bd5('0xf'));var Redis=require('ioredis');var authService=require(_0x0bd5('0x10'));var qs=require(_0x0bd5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0bd5('0x12'));var logger=require(_0x0bd5('0x13'))('api');var utils=require(_0x0bd5('0x14'));var config=require(_0x0bd5('0x15'));var licenseUtil=require(_0x0bd5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f7a0c,_0x23982f){_0x23982f=_0x23982f||0xcc;return function(_0x2f9588){if(_0x2f9588){return _0x2f7a0c[_0x0bd5('0x17')](_0x23982f);}return _0x2f7a0c[_0x0bd5('0x18')](_0x23982f)[_0x0bd5('0x19')]();};}function respondWithResult(_0x30765e,_0x1e961d){_0x1e961d=_0x1e961d||0xc8;return function(_0x4f485b){if(_0x4f485b){return _0x30765e[_0x0bd5('0x18')](_0x1e961d)[_0x0bd5('0x1a')](_0x4f485b);}};}function respondWithFilteredResult(_0x574315,_0x31349f){return function(_0x23ef4e){if(_0x23ef4e){var _0x3a34e4=typeof _0x31349f[_0x0bd5('0x1b')]==='undefined'&&typeof _0x31349f[_0x0bd5('0x1c')]===_0x0bd5('0x1d');var _0xa890be=_0x23ef4e[_0x0bd5('0x1e')];var _0x833c14=_0x3a34e4?0x0:_0x31349f[_0x0bd5('0x1b')];var _0xc58e12=_0x3a34e4?_0x23ef4e[_0x0bd5('0x1e')]:_0x31349f[_0x0bd5('0x1b')]+_0x31349f[_0x0bd5('0x1c')];var _0x27bc1e;if(_0xc58e12>=_0xa890be){_0xc58e12=_0xa890be;_0x27bc1e=0xc8;}else{_0x27bc1e=0xce;}_0x574315[_0x0bd5('0x18')](_0x27bc1e);return _0x574315[_0x0bd5('0x1f')](_0x0bd5('0x20'),_0x833c14+'-'+_0xc58e12+'/'+_0xa890be)['json'](_0x23ef4e);}return null;};}function patchUpdates(_0x5ba943){return function(_0x596b6a){try{jsonpatch['apply'](_0x596b6a,_0x5ba943,!![]);}catch(_0x47d74a){return BPromise[_0x0bd5('0x21')](_0x47d74a);}return _0x596b6a[_0x0bd5('0x22')]();};}function saveUpdates(_0x13ce46,_0x4a6910){return function(_0x6ee1a8){if(_0x6ee1a8){return _0x6ee1a8['update'](_0x13ce46)[_0x0bd5('0x23')](function(_0x3b235b){return _0x3b235b;});}return null;};}function removeEntity(_0x38c21d,_0x5a8139){return function(_0x5b6dde){if(_0x5b6dde){return _0x5b6dde['destroy']()['then'](function(){_0x38c21d[_0x0bd5('0x18')](0xcc)[_0x0bd5('0x19')]();});}};}function handleEntityNotFound(_0x184db3,_0x4fde84){return function(_0x42428c){if(!_0x42428c){_0x184db3['sendStatus'](0x194);}return _0x42428c;};}function handleError(_0x456e87,_0x3ffb08){_0x3ffb08=_0x3ffb08||0x1f4;return function(_0x18cec3){logger[_0x0bd5('0x24')](_0x18cec3[_0x0bd5('0x25')]);if(_0x18cec3[_0x0bd5('0x26')]){delete _0x18cec3[_0x0bd5('0x26')];}_0x456e87[_0x0bd5('0x18')](_0x3ffb08)[_0x0bd5('0x27')](_0x18cec3);};}exports[_0x0bd5('0x28')]=function(_0x15561b,_0xcbfc51){var _0x2e10ce={},_0x2704ee={},_0x5e5a33={'count':0x0,'rows':[]};var _0x461ae3=_[_0x0bd5('0x29')](db['ScreenRecording'][_0x0bd5('0x2a')],function(_0x8eccc9){return{'name':_0x8eccc9['fieldName'],'type':_0x8eccc9[_0x0bd5('0x2b')][_0x0bd5('0x2c')]};});_0x2704ee[_0x0bd5('0x2d')]=_[_0x0bd5('0x2e')](_['map'](_0x461ae3,_0x0bd5('0x26')),[_0x0bd5('0x2f')]);_0x2704ee[_0x0bd5('0x30')]=_[_0x0bd5('0x31')](_0x15561b[_0x0bd5('0x30')]);_0x2704ee[_0x0bd5('0x32')]=_['intersection'](_0x2704ee[_0x0bd5('0x2d')],_0x2704ee['query']);_0x2e10ce[_0x0bd5('0x33')]=_[_0x0bd5('0x34')](_0x2704ee[_0x0bd5('0x2d')],qs[_0x0bd5('0x35')](_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x35')]));_0x2e10ce[_0x0bd5('0x33')]=_0x2e10ce[_0x0bd5('0x33')][_0x0bd5('0x36')]?_0x2e10ce[_0x0bd5('0x33')]:_0x2704ee[_0x0bd5('0x2d')];if(!_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x37')]('nolimit')){_0x2e10ce[_0x0bd5('0x1c')]=qs[_0x0bd5('0x1c')](_0x15561b['query']['limit']);_0x2e10ce[_0x0bd5('0x1b')]=qs[_0x0bd5('0x1b')](_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x1b')]);}_0x2e10ce[_0x0bd5('0x38')]=qs[_0x0bd5('0x39')](_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x39')]);_0x2e10ce[_0x0bd5('0x3a')]=qs[_0x0bd5('0x32')](_[_0x0bd5('0x3b')](_0x15561b[_0x0bd5('0x30')],_0x2704ee[_0x0bd5('0x32')]),_0x461ae3);if(_0x15561b['query'][_0x0bd5('0x3c')]){_0x2e10ce['where']=_[_0x0bd5('0x3d')](_0x2e10ce[_0x0bd5('0x3a')],{'$or':_[_0x0bd5('0x29')](_0x461ae3,function(_0x1fcc49){if(_0x1fcc49[_0x0bd5('0x2b')]!==_0x0bd5('0x3e')){var _0x53a682={};_0x53a682[_0x1fcc49[_0x0bd5('0x26')]]={'$like':'%'+_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x3c')]+'%'};return _0x53a682;}})});}_0x2e10ce=_[_0x0bd5('0x3d')]({},_0x2e10ce,_0x15561b[_0x0bd5('0x3f')]);var _0x493089={'where':_0x2e10ce[_0x0bd5('0x3a')]};return db[_0x0bd5('0x40')][_0x0bd5('0x1e')](_0x493089)['then'](function(_0x177aa3){_0x5e5a33['count']=_0x177aa3;if(_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x41')]){_0x2e10ce['include']=[{'all':!![]}];}return db[_0x0bd5('0x40')][_0x0bd5('0x42')](_0x2e10ce);})[_0x0bd5('0x23')](function(_0x3ec4b0){_0x5e5a33[_0x0bd5('0x43')]=_0x3ec4b0;return _0x5e5a33;})[_0x0bd5('0x23')](respondWithFilteredResult(_0xcbfc51,_0x2e10ce))[_0x0bd5('0x44')](handleError(_0xcbfc51,null));};exports['show']=function(_0x4d3ca5,_0x994f24){var _0x545b63={'raw':![],'where':{'id':_0x4d3ca5[_0x0bd5('0x45')]['id']}},_0x5dd42b={};_0x5dd42b[_0x0bd5('0x2d')]=_['keys'](db['ScreenRecording']['rawAttributes']);_0x5dd42b[_0x0bd5('0x30')]=_['keys'](_0x4d3ca5['query']);_0x5dd42b[_0x0bd5('0x32')]=_[_0x0bd5('0x34')](_0x5dd42b['model'],_0x5dd42b['query']);_0x545b63[_0x0bd5('0x33')]=_[_0x0bd5('0x34')](_0x5dd42b[_0x0bd5('0x2d')],qs[_0x0bd5('0x35')](_0x4d3ca5['query'][_0x0bd5('0x35')]));_0x545b63[_0x0bd5('0x33')]=_0x545b63[_0x0bd5('0x33')][_0x0bd5('0x36')]?_0x545b63[_0x0bd5('0x33')]:_0x5dd42b[_0x0bd5('0x2d')];if(_0x4d3ca5['query'][_0x0bd5('0x41')]){_0x545b63[_0x0bd5('0x46')]=[{'all':!![]}];}_0x545b63=_[_0x0bd5('0x3d')]({},_0x545b63,_0x4d3ca5['options']);return db[_0x0bd5('0x40')][_0x0bd5('0x47')](_0x545b63)[_0x0bd5('0x23')](handleEntityNotFound(_0x994f24,null))['then'](respondWithResult(_0x994f24,null))[_0x0bd5('0x44')](handleError(_0x994f24,null));};exports[_0x0bd5('0x48')]=function(_0x54cd78,_0x18c7c7){return db[_0x0bd5('0x40')]['create'](_0x54cd78[_0x0bd5('0x49')],{})[_0x0bd5('0x23')](respondWithResult(_0x18c7c7,0xc9))['catch'](handleError(_0x18c7c7,null));};exports[_0x0bd5('0x4a')]=function(_0x20960a,_0x146bdc){if(_0x20960a[_0x0bd5('0x49')]['id']){delete _0x20960a[_0x0bd5('0x49')]['id'];}delete _0x20960a['body'][_0x0bd5('0x4b')];delete _0x20960a[_0x0bd5('0x49')]['createdAt'];delete _0x20960a[_0x0bd5('0x49')]['closedAt'];delete _0x20960a[_0x0bd5('0x49')][_0x0bd5('0x4c')];return db[_0x0bd5('0x40')][_0x0bd5('0x47')]({'where':{'id':_0x20960a['params']['id']}})[_0x0bd5('0x23')](handleEntityNotFound(_0x146bdc,null))['then'](saveUpdates(_0x20960a['body'],null))[_0x0bd5('0x23')](respondWithResult(_0x146bdc,null))[_0x0bd5('0x44')](handleError(_0x146bdc,null));};exports[_0x0bd5('0x4d')]=function(_0x4c9a79,_0x424187){return db['ScreenRecording'][_0x0bd5('0x4d')]()[_0x0bd5('0x23')](respondWithResult(_0x424187,null))[_0x0bd5('0x44')](handleError(_0x424187,null));};exports['download']=function(_0x512fe3,_0x4f0467,_0x122f84){var _0x21db5d=require(_0x0bd5('0x4e'));var _0x5b06c6=![];var _0x2b174a={};if(_0x512fe3[_0x0bd5('0x30')]['type']&&_0x512fe3[_0x0bd5('0x30')]['type']==='uniqueid'){_0x2b174a[_0x0bd5('0x4f')]=_0x512fe3[_0x0bd5('0x45')]['id'];}else{_0x2b174a['id']=_0x512fe3[_0x0bd5('0x45')]['id'];}return db[_0x0bd5('0x40')]['find']({'where':_0x2b174a,'attributes':['id',_0x0bd5('0x4c')],'raw':!![]})[_0x0bd5('0x23')](handleEntityNotFound(_0x4f0467,null))[_0x0bd5('0x23')](function(_0x5cf2f2){if(_0x5cf2f2){var _0x504e46=path[_0x0bd5('0x50')](config[_0x0bd5('0x51')],'server/files/screen_recordings',_0x5cf2f2['value']);var _0x2b11e8=util['format'](_0x0bd5('0x52'),_0x504e46);if(fs[_0x0bd5('0x53')](_0x2b11e8)){_0x5b06c6=!![];return _0x21db5d[_0x0bd5('0x54')](_0x2b11e8,_0x504e46,config['secrets'][_0x0bd5('0x55')])[_0x0bd5('0x23')](function(){return _0x5cf2f2;});}return _0x5cf2f2;}})[_0x0bd5('0x23')](function(_0x38aae5){if(_0x38aae5){var _0x5e93fa=path[_0x0bd5('0x50')](config[_0x0bd5('0x51')],_0x0bd5('0x56'),_0x38aae5[_0x0bd5('0x4c')]);if(!fs[_0x0bd5('0x53')](_0x5e93fa)){throw new db['Sequelize'][(_0x0bd5('0x57'))]('ScreenRecording\x20not\x20found');}if(_0x38aae5[_0x0bd5('0x58')]){return _0x4f0467['download'](_0x5e93fa,_0x38aae5['filename']+path[_0x0bd5('0x59')](_0x5e93fa),function(){if(_0x5b06c6){fs['unlink'](_0x5e93fa);}});}else{return _0x4f0467[_0x0bd5('0x5a')](_0x5e93fa,function(_0x3087de){if(_0x5b06c6){fs[_0x0bd5('0x5b')](_0x5e93fa);}});}}})['catch'](function(_0x4f7e86){if(_0x4f7e86[_0x0bd5('0x5c')]==='ScreenRecording\x20not\x20found'){_0x4f0467[_0x0bd5('0x18')](0x194)[_0x0bd5('0x27')]('Not\x20found');}else{return handleError(_0x4f0467,null);}});};exports[_0x0bd5('0x5d')]=function(_0x5a38b1,_0x45ccf5){return db[_0x0bd5('0x40')][_0x0bd5('0x47')]({'where':{'id':_0x5a38b1[_0x0bd5('0x45')]['id']}})[_0x0bd5('0x23')](function(_0x467488){if(_[_0x0bd5('0x5e')](_0x467488)){throw new ReferenceError('Entity\x20not\x20found');}return _0x467488;})[_0x0bd5('0x23')](function(_0x1e5e7d){var _0x33c5eb=path['join'](config['root'],_0x0bd5('0x56'),_0x1e5e7d[_0x0bd5('0x4c')]);logger[_0x0bd5('0x5f')](_0x0bd5('0x60'),_0x33c5eb);if(!_[_0x0bd5('0x5e')](_0x1e5e7d[_0x0bd5('0x4c')])&&fs[_0x0bd5('0x53')](_0x33c5eb)){logger[_0x0bd5('0x5f')](_0x0bd5('0x61')+_0x33c5eb+_0x0bd5('0x62'));fs[_0x0bd5('0x63')](_0x33c5eb);}_0x33c5eb=_0x33c5eb+_0x0bd5('0x64');if(!_[_0x0bd5('0x5e')](_0x1e5e7d[_0x0bd5('0x4c')])&&fs[_0x0bd5('0x53')](_0x33c5eb)){logger[_0x0bd5('0x5f')](_0x0bd5('0x61')+_0x33c5eb+_0x0bd5('0x62'));fs['unlinkSync'](_0x33c5eb);}return _0x1e5e7d;})[_0x0bd5('0x23')](function(_0x32eaaf){if(!_0x32eaaf)throw new InternalError();return _0x32eaaf['destroy']();})[_0x0bd5('0x23')](function(){_0x45ccf5['status'](0xcc)[_0x0bd5('0x19')]();})[_0x0bd5('0x44')](handleError(_0x45ccf5,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 281975e..8979f43 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 _0xb4c9=['define','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','exports'];(function(_0x2e989a,_0x433b3f){var _0x108279=function(_0x170c2c){while(--_0x170c2c){_0x2e989a['push'](_0x2e989a['shift']());}};_0x108279(++_0x433b3f);}(_0xb4c9,0x93));var _0x9b4c=function(_0x4b5fc5,_0x34f9d6){_0x4b5fc5=_0x4b5fc5-0x0;var _0x5d69e3=_0xb4c9[_0x4b5fc5];return _0x5d69e3;};'use strict';var _=require(_0x9b4c('0x0'));var util=require(_0x9b4c('0x1'));var logger=require(_0x9b4c('0x2'))(_0x9b4c('0x3'));var moment=require(_0x9b4c('0x4'));var BPromise=require(_0x9b4c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b4c('0x6'));var rimraf=require(_0x9b4c('0x7'));var config=require('../../config/environment');var attributes=require('./screenRecording.attributes');module[_0x9b4c('0x8')]=function(_0x2629d2,_0x43806f){return _0x2629d2[_0x9b4c('0x9')]('ScreenRecording',attributes,{'tableName':_0x9b4c('0xa'),'paranoid':![],'indexes':[{'name':_0x9b4c('0xb'),'fields':[_0x9b4c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf507=['../../config/environment','define','ScreenRecording','screen_recordings','interactionid','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0xc445e2,_0x199367){var _0x3198ed=function(_0x47df8e){while(--_0x47df8e){_0xc445e2['push'](_0xc445e2['shift']());}};_0x3198ed(++_0x199367);}(_0xf507,0xdd));var _0x7f50=function(_0x242876,_0x40c095){_0x242876=_0x242876-0x0;var _0x2e2718=_0xf507[_0x242876];return _0x2e2718;};'use strict';var _=require(_0x7f50('0x0'));var util=require('util');var logger=require(_0x7f50('0x1'))(_0x7f50('0x2'));var moment=require(_0x7f50('0x3'));var BPromise=require('bluebird');var rp=require(_0x7f50('0x4'));var fs=require('fs');var path=require(_0x7f50('0x5'));var rimraf=require(_0x7f50('0x6'));var config=require(_0x7f50('0x7'));var attributes=require('./screenRecording.attributes');module['exports']=function(_0x2d0a62,_0x41d3eb){return _0x2d0a62[_0x7f50('0x8')](_0x7f50('0x9'),attributes,{'tableName':_0x7f50('0xa'),'paranoid':![],'indexes':[{'name':_0x7f50('0xb'),'fields':[_0x7f50('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 8dae52f..f4df556 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 _0x01bc=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x17cb9c,_0xe7d521){var _0x577521=function(_0x1d1ba4){while(--_0x1d1ba4){_0x17cb9c['push'](_0x17cb9c['shift']());}};_0x577521(++_0xe7d521);}(_0x01bc,0x12d));var _0xc01b=function(_0x23ccef,_0x27056f){_0x23ccef=_0x23ccef-0x0;var _0x4dcada=_0x01bc[_0x23ccef];return _0x4dcada;};'use strict';var _=require(_0xc01b('0x0'));var util=require(_0xc01b('0x1'));var moment=require(_0xc01b('0x2'));var BPromise=require(_0xc01b('0x3'));var rs=require(_0xc01b('0x4'));var fs=require('fs');var Redis=require(_0xc01b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc01b('0x6'));var logger=require(_0xc01b('0x7'))('rpc');var config=require(_0xc01b('0x8'));var jayson=require(_0xc01b('0x9'));var client=jayson[_0xc01b('0xa')][_0xc01b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b2f37,_0x1620ca,_0x1ba30d){return new BPromise(function(_0x3e2303,_0x30408e){return client[_0xc01b('0xc')](_0x5b2f37,_0x1ba30d)[_0xc01b('0xd')](function(_0x29d6b9){logger[_0xc01b('0xe')](_0xc01b('0xf'),_0x1620ca,_0xc01b('0x10'));logger[_0xc01b('0x11')](_0xc01b('0x12'),_0x1620ca,_0xc01b('0x10'),JSON['stringify'](_0x29d6b9));if(_0x29d6b9[_0xc01b('0x13')]){if(_0x29d6b9['error']['code']===0x1f4){logger[_0xc01b('0x13')]('ScreenRecording,\x20%s,\x20%s',_0x1620ca,_0x29d6b9[_0xc01b('0x13')]['message']);return _0x30408e(_0x29d6b9[_0xc01b('0x13')][_0xc01b('0x14')]);}logger[_0xc01b('0x13')](_0xc01b('0xf'),_0x1620ca,_0x29d6b9[_0xc01b('0x13')]['message']);return _0x3e2303(_0x29d6b9[_0xc01b('0x13')]['message']);}else{logger[_0xc01b('0xe')](_0xc01b('0xf'),_0x1620ca,_0xc01b('0x10'));_0x3e2303(_0x29d6b9[_0xc01b('0x15')][_0xc01b('0x14')]);}})[_0xc01b('0x16')](function(_0x109de6){logger[_0xc01b('0x13')](_0xc01b('0xf'),_0x1620ca,_0x109de6);_0x30408e(_0x109de6);});});} \ No newline at end of file +var _0x03f8=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x3c1ea9,_0x385421){var _0x4cbe96=function(_0x241d06){while(--_0x241d06){_0x3c1ea9['push'](_0x3c1ea9['shift']());}};_0x4cbe96(++_0x385421);}(_0x03f8,0x1b1));var _0x803f=function(_0xa2c0a3,_0x5bbac0){_0xa2c0a3=_0xa2c0a3-0x0;var _0x52c618=_0x03f8[_0xa2c0a3];return _0x52c618;};'use strict';var _=require('lodash');var util=require(_0x803f('0x0'));var moment=require(_0x803f('0x1'));var BPromise=require(_0x803f('0x2'));var rs=require(_0x803f('0x3'));var fs=require('fs');var Redis=require(_0x803f('0x4'));var db=require(_0x803f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x803f('0x6'))(_0x803f('0x7'));var config=require(_0x803f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x803f('0x9')][_0x803f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x596f7b,_0x23101b,_0x3e0d9a){return new BPromise(function(_0x260fb1,_0x503b85){return client[_0x803f('0xb')](_0x596f7b,_0x3e0d9a)[_0x803f('0xc')](function(_0x29a164){logger[_0x803f('0xd')](_0x803f('0xe'),_0x23101b,'request\x20sent');logger[_0x803f('0xf')](_0x803f('0x10'),_0x23101b,_0x803f('0x11'),JSON[_0x803f('0x12')](_0x29a164));if(_0x29a164[_0x803f('0x13')]){if(_0x29a164[_0x803f('0x13')][_0x803f('0x14')]===0x1f4){logger[_0x803f('0x13')](_0x803f('0xe'),_0x23101b,_0x29a164['error']['message']);return _0x503b85(_0x29a164[_0x803f('0x13')]['message']);}logger[_0x803f('0x13')]('ScreenRecording,\x20%s,\x20%s',_0x23101b,_0x29a164[_0x803f('0x13')][_0x803f('0x15')]);return _0x260fb1(_0x29a164[_0x803f('0x13')]['message']);}else{logger['info']('ScreenRecording,\x20%s,\x20%s',_0x23101b,_0x803f('0x11'));_0x260fb1(_0x29a164[_0x803f('0x16')][_0x803f('0x15')]);}})[_0x803f('0x17')](function(_0x1b890f){logger[_0x803f('0x13')](_0x803f('0xe'),_0x23101b,_0x1b890f);_0x503b85(_0x1b890f);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 7a6ac4b..2602476 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 _0xe10d=['getDate','/:id','show','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','server/files/images/logos/','%s%s','logo','extname','originalname','post','/:id/logo','file','addLogo','format','logologin','single','addLogoLogin','root','preferred','addPreferred','favicon','update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/now'];(function(_0x5de8bf,_0x24e115){var _0x2be3e3=function(_0x385e2c){while(--_0x385e2c){_0x5de8bf['push'](_0x5de8bf['shift']());}};_0x2be3e3(++_0x24e115);}(_0xe10d,0x180));var _0xde10=function(_0x1b51c3,_0x20fa89){_0x1b51c3=_0x1b51c3-0x0;var _0x376a30=_0xe10d[_0x1b51c3];return _0x376a30;};'use strict';var multer=require(_0xde10('0x0'));var util=require(_0xde10('0x1'));var path=require(_0xde10('0x2'));var timeout=require('connect-timeout');var express=require(_0xde10('0x3'));var router=express[_0xde10('0x4')]();var fs_extra=require(_0xde10('0x5'));var auth=require(_0xde10('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xde10('0x7'));var controller=require('./setting.controller');router[_0xde10('0x8')]('/',auth[_0xde10('0x9')](),controller[_0xde10('0xa')]);router[_0xde10('0x8')](_0xde10('0xb'),controller[_0xde10('0xc')]);router[_0xde10('0x8')](_0xde10('0xd'),controller[_0xde10('0xe')]);router[_0xde10('0x8')]('/:id/logo',controller['getLogo']);router[_0xde10('0x8')](_0xde10('0xf'),controller[_0xde10('0x10')]);router[_0xde10('0x8')](_0xde10('0x11'),controller[_0xde10('0x12')]);router[_0xde10('0x8')](_0xde10('0x13'),controller[_0xde10('0x14')]);router[_0xde10('0x8')](_0xde10('0x15'),controller[_0xde10('0x16')]);var upload=multer({'storage':multer[_0xde10('0x17')]({'destination':function(_0x38263a,_0x131dce,_0x2c9c84){_0x2c9c84(null,path[_0xde10('0x18')](config['root'],_0xde10('0x19')));},'filename':function(_0x3809f3,_0x174511,_0x3730f1){_0x3730f1(null,util['format'](_0xde10('0x1a'),_0xde10('0x1b'),path[_0xde10('0x1c')](_0x174511[_0xde10('0x1d')])));}})});router[_0xde10('0x1e')](_0xde10('0x1f'),upload['single'](_0xde10('0x20')),controller[_0xde10('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x412650,_0x3a8df8,_0x33c8a6){_0x33c8a6(null,path[_0xde10('0x18')](config['root'],'server/files/images/logos/'));},'filename':function(_0x274a97,_0x20ee7d,_0x211a27){_0x211a27(null,util[_0xde10('0x22')]('%s%s',_0xde10('0x23'),path[_0xde10('0x1c')](_0x20ee7d[_0xde10('0x1d')])));}})});router[_0xde10('0x1e')](_0xde10('0xf'),upload[_0xde10('0x24')]('file'),controller[_0xde10('0x25')]);var upload=multer({'storage':multer[_0xde10('0x17')]({'destination':function(_0x182a67,_0x504d01,_0x2265ba){_0x2265ba(null,path[_0xde10('0x18')](config[_0xde10('0x26')],'server/files/images/logos/'));},'filename':function(_0x4b20c2,_0x1a0d91,_0x2a8219){_0x2a8219(null,util[_0xde10('0x22')](_0xde10('0x1a'),_0xde10('0x27'),path['extname'](_0x1a0d91[_0xde10('0x1d')])));}})});router[_0xde10('0x1e')](_0xde10('0x13'),upload[_0xde10('0x24')](_0xde10('0x20')),controller[_0xde10('0x28')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xb1cb88,_0x1152f9,_0x5275ed){_0x5275ed(null,path[_0xde10('0x18')](config['root'],'server/files/images/logos/'));},'filename':function(_0x173bfb,_0x13f2b3,_0x3510bd){_0x3510bd(null,util[_0xde10('0x22')](_0xde10('0x1a'),_0xde10('0x29'),path['extname'](_0x13f2b3[_0xde10('0x1d')])));}})});router['post'](_0xde10('0x15'),upload['single'](_0xde10('0x20')),controller['addFavicon']);router['put'](_0xde10('0xd'),auth[_0xde10('0x9')](),controller[_0xde10('0x2a')]);module[_0xde10('0x2b')]=router; \ No newline at end of file +var _0xe4d0=['post','/:id/logo','single','server/files/images/logos/','logologin','addLogoLogin','root','preferred','file','favicon','addFavicon','put','isAuthenticated','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','getDate','/:id','show','/:id/logo_login','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','join','format','%s%s','logo','extname','originalname'];(function(_0x84562b,_0x520d17){var _0x1b590c=function(_0x1026b6){while(--_0x1026b6){_0x84562b['push'](_0x84562b['shift']());}};_0x1b590c(++_0x520d17);}(_0xe4d0,0x1f3));var _0x0e4d=function(_0x173113,_0x316a7c){_0x173113=_0x173113-0x0;var _0x3bea89=_0xe4d0[_0x173113];return _0x3bea89;};'use strict';var multer=require(_0x0e4d('0x0'));var util=require(_0x0e4d('0x1'));var path=require(_0x0e4d('0x2'));var timeout=require(_0x0e4d('0x3'));var express=require(_0x0e4d('0x4'));var router=express[_0x0e4d('0x5')]();var fs_extra=require(_0x0e4d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0e4d('0x7'));var config=require(_0x0e4d('0x8'));var controller=require(_0x0e4d('0x9'));router[_0x0e4d('0xa')]('/',auth['isAuthenticated'](),controller[_0x0e4d('0xb')]);router[_0x0e4d('0xa')](_0x0e4d('0xc'),controller[_0x0e4d('0xd')]);router[_0x0e4d('0xa')](_0x0e4d('0xe'),controller[_0x0e4d('0xf')]);router[_0x0e4d('0xa')]('/:id/logo',controller['getLogo']);router[_0x0e4d('0xa')](_0x0e4d('0x10'),controller['getLogoLogin']);router['get'](_0x0e4d('0x11'),controller[_0x0e4d('0x12')]);router[_0x0e4d('0xa')](_0x0e4d('0x13'),controller[_0x0e4d('0x14')]);router[_0x0e4d('0xa')](_0x0e4d('0x15'),controller['getFavicon']);var upload=multer({'storage':multer[_0x0e4d('0x16')]({'destination':function(_0x5cafa2,_0x2ef79b,_0xf64e2f){_0xf64e2f(null,path[_0x0e4d('0x17')](config['root'],'server/files/images/logos/'));},'filename':function(_0x681dbe,_0x56a715,_0x18509c){_0x18509c(null,util[_0x0e4d('0x18')](_0x0e4d('0x19'),_0x0e4d('0x1a'),path[_0x0e4d('0x1b')](_0x56a715[_0x0e4d('0x1c')])));}})});router[_0x0e4d('0x1d')](_0x0e4d('0x1e'),upload[_0x0e4d('0x1f')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x0e4d('0x16')]({'destination':function(_0x42c21c,_0x89036d,_0x22cf1a){_0x22cf1a(null,path[_0x0e4d('0x17')](config['root'],_0x0e4d('0x20')));},'filename':function(_0x5ad30d,_0x4ff4b6,_0x1fed17){_0x1fed17(null,util[_0x0e4d('0x18')](_0x0e4d('0x19'),_0x0e4d('0x21'),path[_0x0e4d('0x1b')](_0x4ff4b6[_0x0e4d('0x1c')])));}})});router[_0x0e4d('0x1d')](_0x0e4d('0x10'),upload['single']('file'),controller[_0x0e4d('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x17c47,_0x242f42,_0x2358e6){_0x2358e6(null,path['join'](config[_0x0e4d('0x23')],'server/files/images/logos/'));},'filename':function(_0x4af988,_0x4a220f,_0x292c18){_0x292c18(null,util[_0x0e4d('0x18')](_0x0e4d('0x19'),_0x0e4d('0x24'),path['extname'](_0x4a220f[_0x0e4d('0x1c')])));}})});router[_0x0e4d('0x1d')]('/:id/preferred',upload[_0x0e4d('0x1f')](_0x0e4d('0x25')),controller['addPreferred']);var upload=multer({'storage':multer[_0x0e4d('0x16')]({'destination':function(_0xf72f89,_0x2bc8d2,_0x4edd81){_0x4edd81(null,path['join'](config['root'],_0x0e4d('0x20')));},'filename':function(_0x1edd89,_0x45c1b1,_0x12a76d){_0x12a76d(null,util[_0x0e4d('0x18')](_0x0e4d('0x19'),_0x0e4d('0x26'),path[_0x0e4d('0x1b')](_0x45c1b1['originalname'])));}})});router[_0x0e4d('0x1d')](_0x0e4d('0x15'),upload[_0x0e4d('0x1f')](_0x0e4d('0x25')),controller[_0x0e4d('0x27')]);router[_0x0e4d('0x28')](_0x0e4d('0xe'),auth[_0x0e4d('0x29')](),controller[_0x0e4d('0x2a')]);module[_0x0e4d('0x2b')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 1451855..faa81f4 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 _0x0b0e=['INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','UNSIGNED','sequelize'];(function(_0x2492af,_0x53058c){var _0x924f79=function(_0x1230c7){while(--_0x1230c7){_0x2492af['push'](_0x2492af['shift']());}};_0x924f79(++_0x53058c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2384f6,_0x167775){_0x2384f6=_0x2384f6-0x0;var _0x370294=_0x0b0e[_0x2384f6];return _0x370294;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0xe0b0('0x1')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xe0b0('0x1')](0xb),'unique':_0xe0b0('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xe0b0('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xe0b0('0x3')],'defaultValue':_0xe0b0('0x4')},'logo':{'type':Sequelize[_0xe0b0('0x3')]},'defaultLogo':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xe0b0('0x3')]},'defaultLoginLogo':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xe0b0('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xe0b0('0x3')]},'turnaddr':{'type':Sequelize[_0xe0b0('0x3')]},'turnusername':{'type':Sequelize[_0xe0b0('0x3')]},'turnpassword':{'type':Sequelize[_0xe0b0('0x3')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xe0b0('0x3')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xe0b0('0x3')],'defaultValue':_0xe0b0('0x6')},'chatTimeout':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xe0b0('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0xe0b0('0x3')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xe0b0('0x1')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0xe0b0('0x3')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0xe0b0('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xe0b0('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xe0b0('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5f66=['STRING','BOOLEAN','UNSIGNED','exports','min_internal','INTEGER','min_mailbox'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x5f66,0x1a0));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x65f6('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x65f6('0x2')](0xb),'unique':_0x65f6('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x65f6('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x65f6('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x65f6('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x65f6('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x65f6('0x4')]},'turnaddr':{'type':Sequelize[_0x65f6('0x4')]},'turnusername':{'type':Sequelize[_0x65f6('0x4')]},'turnpassword':{'type':Sequelize[_0x65f6('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x65f6('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x65f6('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x65f6('0x4')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x65f6('0x4')]},'defaultPreferred':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x65f6('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x65f6('0x4')]},'defaultFavicon':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x65f6('0x4')]},'sentiment':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x65f6('0x2')]},'sentimentRegion':{'type':Sequelize[_0x65f6('0x4')]},'language':{'type':Sequelize[_0x65f6('0x4')]},'bucket':{'type':Sequelize[_0x65f6('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x65f6('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0x65f6('0x6')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x65f6('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 32e8437..2ba2d8d 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 _0xaafc=['rows','params','length','find','body','addLogo','file','filename','logo','addLogoLogin','getLogo','server/files/images/logos','getLicense','loginLogo','preferred','favicon','defaultLoginLogo','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','download','getLogoLogin','defaultLogo','defaultPreferred','\x20not\x20found','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','default_favicon.ico','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','save','update','destroy','then','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','sort','where','filter','merge','VIRTUAL','options','Setting','includeAll','include','findAll'];(function(_0x2569d0,_0x4e2953){var _0x4c5555=function(_0x34f5b3){while(--_0x34f5b3){_0x2569d0['push'](_0x2569d0['shift']());}};_0x4c5555(++_0x4e2953);}(_0xaafc,0x18f));var _0xcaaf=function(_0x1da07a,_0x734263){_0x1da07a=_0x1da07a-0x0;var _0x5233e6=_0xaafc[_0x1da07a];return _0x5233e6;};'use strict';var emlformat=require(_0xcaaf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcaaf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcaaf('0x2'));var moment=require('moment');var BPromise=require(_0xcaaf('0x3'));var Mustache=require(_0xcaaf('0x4'));var util=require(_0xcaaf('0x5'));var path=require(_0xcaaf('0x6'));var sox=require('sox');var csv=require(_0xcaaf('0x7'));var ejs=require(_0xcaaf('0x8'));var fs=require('fs');var fs_extra=require(_0xcaaf('0x9'));var _=require(_0xcaaf('0xa'));var squel=require('squel');var crypto=require(_0xcaaf('0xb'));var jsforce=require(_0xcaaf('0xc'));var deskjs=require(_0xcaaf('0xd'));var toCsv=require(_0xcaaf('0x7'));var querystring=require(_0xcaaf('0xe'));var Papa=require(_0xcaaf('0xf'));var Redis=require(_0xcaaf('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xcaaf('0x11'));var as=require(_0xcaaf('0x12'));var hardwareService=require(_0xcaaf('0x13'));var logger=require(_0xcaaf('0x14'))('api');var utils=require(_0xcaaf('0x15'));var config=require(_0xcaaf('0x16'));var licenseUtil=require(_0xcaaf('0x17'));var db=require(_0xcaaf('0x18'))['db'];var jayson=require(_0xcaaf('0x19'));var client=jayson[_0xcaaf('0x1a')][_0xcaaf('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x1bd138,_0x5009e9,_0x3d442b,_0x2df79f){return new BPromise(function(_0x2491df,_0x106656){var _0x3f10e2=_0x2df79f||client;return _0x3f10e2[_0xcaaf('0x1c')](_0x1bd138,_0x3d442b)['then'](function(_0x5b9537){logger['info'](_0xcaaf('0x1d'),_0x5009e9,_0xcaaf('0x1e'));logger[_0xcaaf('0x1f')]('Setting,\x20%s,\x20%s,\x20%s',_0x5009e9,'request\x20sent',JSON[_0xcaaf('0x20')](_0x5b9537));if(_0x5b9537['error']){if(_0x5b9537[_0xcaaf('0x21')][_0xcaaf('0x22')]===0x1f4){logger[_0xcaaf('0x21')]('Setting,\x20%s,\x20%s',_0x5009e9,_0x5b9537['error']['message']);return _0x106656(_0x5b9537[_0xcaaf('0x21')][_0xcaaf('0x23')]);}logger['error'](_0xcaaf('0x1d'),_0x5009e9,_0x5b9537[_0xcaaf('0x21')][_0xcaaf('0x23')]);return _0x2491df(_0x5b9537[_0xcaaf('0x21')][_0xcaaf('0x23')]);}else{logger['info'](_0xcaaf('0x1d'),_0x5009e9,_0xcaaf('0x1e'));_0x2491df(_0x5b9537['result'][_0xcaaf('0x23')]);}})[_0xcaaf('0x24')](function(_0x4973a3){logger[_0xcaaf('0x21')]('Setting,\x20%s,\x20%s',_0x5009e9,_0x4973a3);_0x106656(_0x4973a3);});});}function respondWithStatusCode(_0x1a4805,_0x523480){_0x523480=_0x523480||0xcc;return function(_0x6c3bc){if(_0x6c3bc){return _0x1a4805[_0xcaaf('0x25')](_0x523480);}return _0x1a4805['status'](_0x523480)[_0xcaaf('0x26')]();};}function respondWithResult(_0x20480a,_0x48c899){_0x48c899=_0x48c899||0xc8;return function(_0x14469d){if(_0x14469d){return _0x20480a['status'](_0x48c899)[_0xcaaf('0x27')](_0x14469d);}};}function respondWithFilteredResult(_0x271557,_0xae97fc){return function(_0x4d19be){if(_0x4d19be){var _0x19db65=typeof _0xae97fc[_0xcaaf('0x28')]===_0xcaaf('0x29')&&typeof _0xae97fc[_0xcaaf('0x2a')]===_0xcaaf('0x29');var _0x208f04=_0x4d19be[_0xcaaf('0x2b')];var _0x799bb5=_0x19db65?0x0:_0xae97fc['offset'];var _0x86d16c=_0x19db65?_0x4d19be[_0xcaaf('0x2b')]:_0xae97fc['offset']+_0xae97fc[_0xcaaf('0x2a')];var _0x14ab02;if(_0x86d16c>=_0x208f04){_0x86d16c=_0x208f04;_0x14ab02=0xc8;}else{_0x14ab02=0xce;}_0x271557[_0xcaaf('0x2c')](_0x14ab02);return _0x271557['set'](_0xcaaf('0x2d'),_0x799bb5+'-'+_0x86d16c+'/'+_0x208f04)['json'](_0x4d19be);}return null;};}function patchUpdates(_0x2d7316){return function(_0x1d3454){try{jsonpatch[_0xcaaf('0x2e')](_0x1d3454,_0x2d7316,!![]);}catch(_0x26cd9f){return BPromise['reject'](_0x26cd9f);}return _0x1d3454[_0xcaaf('0x2f')]();};}function saveUpdates(_0x11e509,_0x2f5727){return function(_0x214227){if(_0x214227){return _0x214227[_0xcaaf('0x30')](_0x11e509)['then'](function(_0x34a47e){return _0x34a47e;});}return null;};}function removeEntity(_0xa615a6,_0x5e2c80){return function(_0x53c3ea){if(_0x53c3ea){return _0x53c3ea[_0xcaaf('0x31')]()[_0xcaaf('0x32')](function(){_0xa615a6[_0xcaaf('0x2c')](0xcc)[_0xcaaf('0x26')]();});}};}function handleEntityNotFound(_0x57774f,_0x57e376){return function(_0x5615d3){if(!_0x5615d3){_0x57774f[_0xcaaf('0x25')](0x194);}return _0x5615d3;};}function handleError(_0x310112,_0x24cf44){_0x24cf44=_0x24cf44||0x1f4;return function(_0x326114){logger[_0xcaaf('0x21')](_0x326114[_0xcaaf('0x33')]);if(_0x326114['name']){delete _0x326114[_0xcaaf('0x34')];}_0x310112['status'](_0x24cf44)[_0xcaaf('0x35')](_0x326114);};}exports[_0xcaaf('0x36')]=function(_0x24e5c8,_0x524d70){var _0x4156e2={},_0x210bed={},_0x3761ce={'count':0x0,'rows':[]};var _0x226fc3=_['map'](db['Setting'][_0xcaaf('0x37')],function(_0x4eb9e0){return{'name':_0x4eb9e0[_0xcaaf('0x38')],'type':_0x4eb9e0[_0xcaaf('0x39')][_0xcaaf('0x3a')]};});_0x210bed[_0xcaaf('0x3b')]=_[_0xcaaf('0x3c')](_0x226fc3,'name');_0x210bed['query']=_[_0xcaaf('0x3d')](_0x24e5c8[_0xcaaf('0x3e')]);_0x210bed[_0xcaaf('0x3f')]=_[_0xcaaf('0x40')](_0x210bed[_0xcaaf('0x3b')],_0x210bed['query']);_0x4156e2[_0xcaaf('0x41')]=_['intersection'](_0x210bed[_0xcaaf('0x3b')],qs[_0xcaaf('0x42')](_0x24e5c8[_0xcaaf('0x3e')][_0xcaaf('0x42')]));_0x4156e2['attributes']=_0x4156e2['attributes']['length']?_0x4156e2[_0xcaaf('0x41')]:_0x210bed['model'];if(!_0x24e5c8[_0xcaaf('0x3e')]['hasOwnProperty']('nolimit')){_0x4156e2['limit']=qs['limit'](_0x24e5c8[_0xcaaf('0x3e')][_0xcaaf('0x2a')]);_0x4156e2[_0xcaaf('0x28')]=qs['offset'](_0x24e5c8[_0xcaaf('0x3e')][_0xcaaf('0x28')]);}_0x4156e2['order']=qs[_0xcaaf('0x43')](_0x24e5c8[_0xcaaf('0x3e')][_0xcaaf('0x43')]);_0x4156e2[_0xcaaf('0x44')]=qs['filters'](_['pick'](_0x24e5c8[_0xcaaf('0x3e')],_0x210bed[_0xcaaf('0x3f')]),_0x226fc3);if(_0x24e5c8[_0xcaaf('0x3e')][_0xcaaf('0x45')]){_0x4156e2['where']=_[_0xcaaf('0x46')](_0x4156e2['where'],{'$or':_[_0xcaaf('0x3c')](_0x226fc3,function(_0x21b5fc){if(_0x21b5fc[_0xcaaf('0x39')]!==_0xcaaf('0x47')){var _0x1d5971={};_0x1d5971[_0x21b5fc[_0xcaaf('0x34')]]={'$like':'%'+_0x24e5c8[_0xcaaf('0x3e')][_0xcaaf('0x45')]+'%'};return _0x1d5971;}})});}_0x4156e2=_[_0xcaaf('0x46')]({},_0x4156e2,_0x24e5c8[_0xcaaf('0x48')]);var _0x14dda8={'where':_0x4156e2['where']};return db[_0xcaaf('0x49')][_0xcaaf('0x2b')](_0x14dda8)['then'](function(_0x185f25){_0x3761ce['count']=_0x185f25;if(_0x24e5c8[_0xcaaf('0x3e')][_0xcaaf('0x4a')]){_0x4156e2[_0xcaaf('0x4b')]=[{'all':!![]}];}return db[_0xcaaf('0x49')][_0xcaaf('0x4c')](_0x4156e2);})[_0xcaaf('0x32')](function(_0x1c0179){_0x3761ce[_0xcaaf('0x4d')]=_0x1c0179;return _0x3761ce;})[_0xcaaf('0x32')](respondWithFilteredResult(_0x524d70,_0x4156e2))[_0xcaaf('0x24')](handleError(_0x524d70,null));};exports['show']=function(_0x57c09b,_0x472a00){var _0xedb069={'raw':![],'where':{'id':_0x57c09b[_0xcaaf('0x4e')]['id']}},_0x2127f1={};_0x2127f1[_0xcaaf('0x3b')]=_[_0xcaaf('0x3d')](db[_0xcaaf('0x49')][_0xcaaf('0x37')]);_0x2127f1['query']=_[_0xcaaf('0x3d')](_0x57c09b[_0xcaaf('0x3e')]);_0x2127f1['filters']=_[_0xcaaf('0x40')](_0x2127f1[_0xcaaf('0x3b')],_0x2127f1[_0xcaaf('0x3e')]);_0xedb069[_0xcaaf('0x41')]=_[_0xcaaf('0x40')](_0x2127f1[_0xcaaf('0x3b')],qs[_0xcaaf('0x42')](_0x57c09b[_0xcaaf('0x3e')][_0xcaaf('0x42')]));_0xedb069[_0xcaaf('0x41')]=_0xedb069[_0xcaaf('0x41')][_0xcaaf('0x4f')]?_0xedb069['attributes']:_0x2127f1[_0xcaaf('0x3b')];if(_0x57c09b[_0xcaaf('0x3e')][_0xcaaf('0x4a')]){_0xedb069[_0xcaaf('0x4b')]=[{'all':!![]}];}_0xedb069=_[_0xcaaf('0x46')]({},_0xedb069,_0x57c09b[_0xcaaf('0x48')]);return db[_0xcaaf('0x49')][_0xcaaf('0x50')](_0xedb069)[_0xcaaf('0x32')](handleEntityNotFound(_0x472a00,null))['then'](respondWithResult(_0x472a00,null))[_0xcaaf('0x24')](handleError(_0x472a00,null));};exports[_0xcaaf('0x30')]=function(_0x3eb140,_0xcdf3fc){if(_0x3eb140[_0xcaaf('0x51')]['id']){delete _0x3eb140[_0xcaaf('0x51')]['id'];}return db[_0xcaaf('0x49')][_0xcaaf('0x50')]({'where':{'id':_0x3eb140[_0xcaaf('0x4e')]['id']}})[_0xcaaf('0x32')](handleEntityNotFound(_0xcdf3fc,null))[_0xcaaf('0x32')](saveUpdates(_0x3eb140[_0xcaaf('0x51')],null))[_0xcaaf('0x32')](respondWithResult(_0xcdf3fc,null))[_0xcaaf('0x24')](handleError(_0xcdf3fc,null));};exports[_0xcaaf('0x52')]=function(_0x57fbce,_0x234189,_0x4d4888){if(_0x57fbce[_0xcaaf('0x53')]&&_0x57fbce[_0xcaaf('0x53')][_0xcaaf('0x54')]){_0x57fbce['body'][_0xcaaf('0x55')]=_0x57fbce['file']['filename'];}return db[_0xcaaf('0x49')][_0xcaaf('0x50')]({'where':{'id':_0x57fbce[_0xcaaf('0x4e')]['id']}})[_0xcaaf('0x32')](handleEntityNotFound(_0x234189,null))[_0xcaaf('0x32')](saveUpdates(_0x57fbce['body'],null))['then'](respondWithResult(_0x234189,null))[_0xcaaf('0x24')](handleError(_0x234189,null));};exports[_0xcaaf('0x56')]=function(_0x14173f,_0x47a73a,_0x5c80b3){if(_0x14173f[_0xcaaf('0x53')]&&_0x14173f[_0xcaaf('0x53')][_0xcaaf('0x54')]){_0x14173f[_0xcaaf('0x51')]['loginLogo']=_0x14173f['file'][_0xcaaf('0x54')];}return db['Setting'][_0xcaaf('0x50')]({'where':{'id':_0x14173f['params']['id']}})['then'](handleEntityNotFound(_0x47a73a,null))[_0xcaaf('0x32')](saveUpdates(_0x14173f[_0xcaaf('0x51')],null))[_0xcaaf('0x32')](respondWithResult(_0x47a73a,null))['catch'](handleError(_0x47a73a,null));};var utilLicense=require(_0xcaaf('0x17'));exports[_0xcaaf('0x57')]=function(_0x5ac758,_0x2c27db,_0x541863){var _0x1a1ec3=_0xcaaf('0x58');var _0x202297={'custom':![]};return utilLicense[_0xcaaf('0x59')]()['then'](function(_0x1a52b3){if(_0x1a52b3){_0x202297=_0x1a52b3;}return db[_0xcaaf('0x49')]['find']({'where':{'id':_0x5ac758[_0xcaaf('0x4e')]['id']},'attributes':[_0xcaaf('0x55'),_0xcaaf('0x5a'),_0xcaaf('0x5b'),_0xcaaf('0x5c'),'defaultLogo',_0xcaaf('0x5d'),'defaultPreferred',_0xcaaf('0x5e')],'raw':!![]});})['then'](handleEntityNotFound(_0x2c27db,null))[_0xcaaf('0x32')](function(_0x48ce22){if(_0x48ce22){var _0x17e7c9=_0x48ce22[_0xcaaf('0x55')]&&fs[_0xcaaf('0x5f')](path[_0xcaaf('0x60')](config[_0xcaaf('0x61')],_0x1a1ec3,_[_0xcaaf('0x62')](_0x48ce22[_0xcaaf('0x55')])))?path[_0xcaaf('0x60')](config[_0xcaaf('0x61')],_0x1a1ec3,_[_0xcaaf('0x62')](_0x48ce22[_0xcaaf('0x55')])):path[_0xcaaf('0x60')](config['root'],_0x1a1ec3,_['toLower'](_0xcaaf('0x63')));var _0x419394=_0xcaaf('0x64')+_[_0xcaaf('0x65')](_0xcaaf('0x55'));if(_0x48ce22[_0x419394]||!_0x202297[_0xcaaf('0x66')]){_0x17e7c9=path[_0xcaaf('0x60')](config[_0xcaaf('0x61')],_0x1a1ec3,_['toLower'](_0xcaaf('0x63')));}if(!fs[_0xcaaf('0x5f')](_0x17e7c9)){throw new db[(_0xcaaf('0x67'))][(_0xcaaf('0x68'))](_['upperFirst'](_0xcaaf('0x55'))+'\x20not\x20found');}return _0x2c27db[_0xcaaf('0x69')](_0x17e7c9);}})[_0xcaaf('0x24')](handleError(_0x2c27db,null));};var utilLicense=require(_0xcaaf('0x17'));exports[_0xcaaf('0x6a')]=function(_0x27b1c8,_0x49c08c,_0x239b36){var _0x3b52d3=_0xcaaf('0x58');var _0x1e9d65={'custom':![]};return utilLicense[_0xcaaf('0x59')]()['then'](function(_0x1b1165){if(_0x1b1165){_0x1e9d65=_0x1b1165;}return db['Setting'][_0xcaaf('0x50')]({'where':{'id':_0x27b1c8[_0xcaaf('0x4e')]['id']},'attributes':['logo',_0xcaaf('0x5a'),_0xcaaf('0x5b'),'favicon',_0xcaaf('0x6b'),_0xcaaf('0x5d'),_0xcaaf('0x6c'),_0xcaaf('0x5e')],'raw':!![]});})['then'](handleEntityNotFound(_0x49c08c,null))[_0xcaaf('0x32')](function(_0x4cd0ba){if(_0x4cd0ba){var _0x5bfa5b=_0x4cd0ba['loginLogo']&&fs[_0xcaaf('0x5f')](path[_0xcaaf('0x60')](config[_0xcaaf('0x61')],_0x3b52d3,_[_0xcaaf('0x62')](_0x4cd0ba[_0xcaaf('0x5a')])))?path[_0xcaaf('0x60')](config['root'],_0x3b52d3,_[_0xcaaf('0x62')](_0x4cd0ba[_0xcaaf('0x5a')])):path['join'](config[_0xcaaf('0x61')],_0x3b52d3,_[_0xcaaf('0x62')]('default_loginLogo.svg'));var _0x4eb5bf='default'+_['upperFirst'](_0xcaaf('0x5a'));if(_0x4cd0ba[_0x4eb5bf]||!_0x1e9d65[_0xcaaf('0x66')]){_0x5bfa5b=path[_0xcaaf('0x60')](config[_0xcaaf('0x61')],_0x3b52d3,_[_0xcaaf('0x62')]('default_loginLogo.svg'));}if(!fs[_0xcaaf('0x5f')](_0x5bfa5b)){throw new db['Sequelize'][(_0xcaaf('0x68'))](_['upperFirst']('loginLogo')+_0xcaaf('0x6d'));}return _0x49c08c[_0xcaaf('0x69')](_0x5bfa5b);}})[_0xcaaf('0x24')](handleError(_0x49c08c,null));};exports[_0xcaaf('0x6e')]=function(_0x3bcc5f,_0x46cefb){return db[_0xcaaf('0x49')][_0xcaaf('0x50')]({'where':{'id':_0x3bcc5f['params']['id']},'attributes':[_0xcaaf('0x6f')]})[_0xcaaf('0x32')](respondWithResult(_0x46cefb,null))[_0xcaaf('0x24')](handleError(_0x46cefb,null));};exports[_0xcaaf('0x70')]=function(_0x1fbdf1,_0x20bdc0,_0x2e774c){if(_0x1fbdf1[_0xcaaf('0x53')]&&_0x1fbdf1[_0xcaaf('0x53')][_0xcaaf('0x54')]){_0x1fbdf1[_0xcaaf('0x51')][_0xcaaf('0x5b')]=_0x1fbdf1[_0xcaaf('0x53')]['filename'];}return db[_0xcaaf('0x49')][_0xcaaf('0x50')]({'where':{'id':_0x1fbdf1[_0xcaaf('0x4e')]['id']}})['then'](handleEntityNotFound(_0x20bdc0,null))[_0xcaaf('0x32')](saveUpdates(_0x1fbdf1['body'],null))['then'](respondWithResult(_0x20bdc0,null))[_0xcaaf('0x24')](handleError(_0x20bdc0,null));};var utilLicense=require(_0xcaaf('0x17'));exports[_0xcaaf('0x71')]=function(_0x4dee30,_0x2a0e9c,_0xc5d2c6){var _0x3166e6=_0xcaaf('0x58');var _0x1b1e62={'custom':![]};return utilLicense[_0xcaaf('0x59')]()['then'](function(_0x35e49c){if(_0x35e49c){_0x1b1e62=_0x35e49c;}return db[_0xcaaf('0x49')][_0xcaaf('0x50')]({'where':{'id':_0x4dee30['params']['id']},'attributes':[_0xcaaf('0x55'),_0xcaaf('0x5a'),_0xcaaf('0x5b'),_0xcaaf('0x5c'),_0xcaaf('0x6b'),_0xcaaf('0x5d'),_0xcaaf('0x6c'),_0xcaaf('0x5e')],'raw':!![]});})[_0xcaaf('0x32')](handleEntityNotFound(_0x2a0e9c,null))[_0xcaaf('0x32')](function(_0x39265b){if(_0x39265b){var _0x5adec6=_0x39265b[_0xcaaf('0x5b')]&&fs[_0xcaaf('0x5f')](path[_0xcaaf('0x60')](config[_0xcaaf('0x61')],_0x3166e6,_['toLower'](_0x39265b[_0xcaaf('0x5b')])))?path['join'](config[_0xcaaf('0x61')],_0x3166e6,_[_0xcaaf('0x62')](_0x39265b[_0xcaaf('0x5b')])):path[_0xcaaf('0x60')](config[_0xcaaf('0x61')],_0x3166e6,_['toLower']('default_preferred.png'));var _0x105cb6=_0xcaaf('0x64')+_['upperFirst'](_0xcaaf('0x5b'));if(_0x39265b[_0x105cb6]||!_0x1b1e62['custom']||!_0x1b1e62[_0xcaaf('0x5b')]){_0x5adec6=path[_0xcaaf('0x60')](config[_0xcaaf('0x61')],_0x3166e6,_[_0xcaaf('0x62')](_0xcaaf('0x72')));}if(!fs[_0xcaaf('0x5f')](_0x5adec6)){throw new db[(_0xcaaf('0x67'))][(_0xcaaf('0x68'))](_[_0xcaaf('0x65')](_0xcaaf('0x5b'))+_0xcaaf('0x6d'));}return _0x2a0e9c[_0xcaaf('0x69')](_0x5adec6);}})[_0xcaaf('0x24')](handleError(_0x2a0e9c,null));};exports['addFavicon']=function(_0x57e3dc,_0x1c2fac,_0x153674){if(_0x57e3dc[_0xcaaf('0x53')]&&_0x57e3dc[_0xcaaf('0x53')]['filename']){_0x57e3dc[_0xcaaf('0x51')][_0xcaaf('0x5c')]=_0x57e3dc[_0xcaaf('0x53')][_0xcaaf('0x54')];}return db[_0xcaaf('0x49')][_0xcaaf('0x50')]({'where':{'id':_0x57e3dc[_0xcaaf('0x4e')]['id']}})[_0xcaaf('0x32')](handleEntityNotFound(_0x1c2fac,null))[_0xcaaf('0x32')](saveUpdates(_0x57e3dc['body'],null))[_0xcaaf('0x32')](respondWithResult(_0x1c2fac,null))['catch'](handleError(_0x1c2fac,null));};var utilLicense=require(_0xcaaf('0x17'));exports['getFavicon']=function(_0x516832,_0x33c027,_0x3c98b2){var _0x4c98ec='server/files/images/logos';var _0x2ae4e4={'custom':![]};return utilLicense[_0xcaaf('0x59')]()[_0xcaaf('0x32')](function(_0x3f15cd){if(_0x3f15cd){_0x2ae4e4=_0x3f15cd;}return db[_0xcaaf('0x49')]['find']({'where':{'id':_0x516832[_0xcaaf('0x4e')]['id']},'attributes':['logo','loginLogo',_0xcaaf('0x5b'),_0xcaaf('0x5c'),_0xcaaf('0x6b'),'defaultLoginLogo',_0xcaaf('0x6c'),'defaultFavicon'],'raw':!![]});})[_0xcaaf('0x32')](handleEntityNotFound(_0x33c027,null))[_0xcaaf('0x32')](function(_0x4c2f3e){if(_0x4c2f3e){var _0x50cb0f=_0x4c2f3e[_0xcaaf('0x5c')]&&fs[_0xcaaf('0x5f')](path[_0xcaaf('0x60')](config[_0xcaaf('0x61')],_0x4c98ec,_[_0xcaaf('0x62')](_0x4c2f3e[_0xcaaf('0x5c')])))?path['join'](config['root'],_0x4c98ec,_[_0xcaaf('0x62')](_0x4c2f3e[_0xcaaf('0x5c')])):path[_0xcaaf('0x60')](config[_0xcaaf('0x61')],_0x4c98ec,_[_0xcaaf('0x62')](_0xcaaf('0x73')));var _0x5b8042=_0xcaaf('0x64')+_[_0xcaaf('0x65')](_0xcaaf('0x5c'));if(_0x4c2f3e[_0x5b8042]||!_0x2ae4e4[_0xcaaf('0x66')]){_0x50cb0f=path['join'](config[_0xcaaf('0x61')],_0x4c98ec,_[_0xcaaf('0x62')](_0xcaaf('0x73')));}if(!fs[_0xcaaf('0x5f')](_0x50cb0f)){throw new db[(_0xcaaf('0x67'))]['ValidationError'](_[_0xcaaf('0x65')]('favicon')+'\x20not\x20found');}return _0x33c027['download'](_0x50cb0f);}})['catch'](handleError(_0x33c027,null));};exports['getDate']=function(_0x223d8a,_0x4c9e1b){var _0x5cae69={'offset':moment()['utcOffset']()};_0x5cae69['now']=moment()[_0xcaaf('0x74')](_0x5cae69[_0xcaaf('0x28')])[_0xcaaf('0x75')](_0xcaaf('0x76'));return _0x4c9e1b[_0xcaaf('0x2c')](0xc8)[_0xcaaf('0x35')](_0x5cae69);}; \ No newline at end of file +var _0xabc4=['lodash','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','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','catch','status','end','offset','undefined','limit','count','set','json','apply','reject','destroy','sendStatus','name','send','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','body','addLogo','file','filename','logo','find','addLogoLogin','loginLogo','getLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','upperFirst','\x20not\x20found','server/files/images/logos','getLicense','default_loginLogo.svg','default','custom','Sequelize','ValidationError','gdpr','securePassword','getPreferred','default_preferred.png','download','getFavicon','default_favicon.ico','getDate','now','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra'];(function(_0x279732,_0x2c13af){var _0x576ce2=function(_0x2e54e6){while(--_0x2e54e6){_0x279732['push'](_0x279732['shift']());}};_0x576ce2(++_0x2c13af);}(_0xabc4,0x160));var _0x4abc=function(_0x5b494c,_0x182312){_0x5b494c=_0x5b494c-0x0;var _0x5d8bac=_0xabc4[_0x5b494c];return _0x5d8bac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4abc('0x0'));var zipdir=require(_0x4abc('0x1'));var jsonpatch=require(_0x4abc('0x2'));var rp=require('request-promise');var moment=require(_0x4abc('0x3'));var BPromise=require(_0x4abc('0x4'));var Mustache=require(_0x4abc('0x5'));var util=require(_0x4abc('0x6'));var path=require(_0x4abc('0x7'));var sox=require(_0x4abc('0x8'));var csv=require('to-csv');var ejs=require(_0x4abc('0x9'));var fs=require('fs');var fs_extra=require(_0x4abc('0xa'));var _=require(_0x4abc('0xb'));var squel=require('squel');var crypto=require(_0x4abc('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4abc('0xd'));var querystring=require(_0x4abc('0xe'));var Papa=require('papaparse');var Redis=require(_0x4abc('0xf'));var authService=require(_0x4abc('0x10'));var qs=require(_0x4abc('0x11'));var as=require(_0x4abc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4abc('0x13'));var utils=require(_0x4abc('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4abc('0x15'));var db=require(_0x4abc('0x16'))['db'];var jayson=require(_0x4abc('0x17'));var client=jayson[_0x4abc('0x18')][_0x4abc('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x8203d,_0x1304d0,_0x26b53a,_0x35c02d){return new BPromise(function(_0x17efaf,_0x2f9c59){var _0x300aa4=_0x35c02d||client;return _0x300aa4[_0x4abc('0x1a')](_0x8203d,_0x26b53a)[_0x4abc('0x1b')](function(_0x79abbb){logger[_0x4abc('0x1c')]('Setting,\x20%s,\x20%s',_0x1304d0,_0x4abc('0x1d'));logger[_0x4abc('0x1e')](_0x4abc('0x1f'),_0x1304d0,_0x4abc('0x1d'),JSON[_0x4abc('0x20')](_0x79abbb));if(_0x79abbb[_0x4abc('0x21')]){if(_0x79abbb[_0x4abc('0x21')][_0x4abc('0x22')]===0x1f4){logger['error'](_0x4abc('0x23'),_0x1304d0,_0x79abbb['error'][_0x4abc('0x24')]);return _0x2f9c59(_0x79abbb[_0x4abc('0x21')][_0x4abc('0x24')]);}logger['error'](_0x4abc('0x23'),_0x1304d0,_0x79abbb[_0x4abc('0x21')][_0x4abc('0x24')]);return _0x17efaf(_0x79abbb[_0x4abc('0x21')]['message']);}else{logger[_0x4abc('0x1c')](_0x4abc('0x23'),_0x1304d0,_0x4abc('0x1d'));_0x17efaf(_0x79abbb['result']['message']);}})[_0x4abc('0x25')](function(_0x20d2ab){logger['error'](_0x4abc('0x23'),_0x1304d0,_0x20d2ab);_0x2f9c59(_0x20d2ab);});});}function respondWithStatusCode(_0xa1642c,_0x1faae2){_0x1faae2=_0x1faae2||0xcc;return function(_0x3879d0){if(_0x3879d0){return _0xa1642c['sendStatus'](_0x1faae2);}return _0xa1642c[_0x4abc('0x26')](_0x1faae2)[_0x4abc('0x27')]();};}function respondWithResult(_0x33caef,_0x246f45){_0x246f45=_0x246f45||0xc8;return function(_0x262dff){if(_0x262dff){return _0x33caef[_0x4abc('0x26')](_0x246f45)['json'](_0x262dff);}};}function respondWithFilteredResult(_0x4393c6,_0x1f5130){return function(_0x228830){if(_0x228830){var _0x93e528=typeof _0x1f5130[_0x4abc('0x28')]===_0x4abc('0x29')&&typeof _0x1f5130[_0x4abc('0x2a')]==='undefined';var _0xd179fb=_0x228830[_0x4abc('0x2b')];var _0x5505c2=_0x93e528?0x0:_0x1f5130[_0x4abc('0x28')];var _0x4e899c=_0x93e528?_0x228830[_0x4abc('0x2b')]:_0x1f5130[_0x4abc('0x28')]+_0x1f5130[_0x4abc('0x2a')];var _0x370d5d;if(_0x4e899c>=_0xd179fb){_0x4e899c=_0xd179fb;_0x370d5d=0xc8;}else{_0x370d5d=0xce;}_0x4393c6[_0x4abc('0x26')](_0x370d5d);return _0x4393c6[_0x4abc('0x2c')]('Content-Range',_0x5505c2+'-'+_0x4e899c+'/'+_0xd179fb)[_0x4abc('0x2d')](_0x228830);}return null;};}function patchUpdates(_0x1d4f5e){return function(_0x22d0ab){try{jsonpatch[_0x4abc('0x2e')](_0x22d0ab,_0x1d4f5e,!![]);}catch(_0x1b98fb){return BPromise[_0x4abc('0x2f')](_0x1b98fb);}return _0x22d0ab['save']();};}function saveUpdates(_0x5e565f,_0x3188ca){return function(_0x475d32){if(_0x475d32){return _0x475d32['update'](_0x5e565f)[_0x4abc('0x1b')](function(_0xa2cf4d){return _0xa2cf4d;});}return null;};}function removeEntity(_0x458962,_0x478c43){return function(_0x1923e4){if(_0x1923e4){return _0x1923e4[_0x4abc('0x30')]()[_0x4abc('0x1b')](function(){_0x458962[_0x4abc('0x26')](0xcc)[_0x4abc('0x27')]();});}};}function handleEntityNotFound(_0x50d4d1,_0x126676){return function(_0x369eee){if(!_0x369eee){_0x50d4d1[_0x4abc('0x31')](0x194);}return _0x369eee;};}function handleError(_0xbb0ddf,_0x1d0d0b){_0x1d0d0b=_0x1d0d0b||0x1f4;return function(_0x5cd4be){logger['error'](_0x5cd4be['stack']);if(_0x5cd4be[_0x4abc('0x32')]){delete _0x5cd4be[_0x4abc('0x32')];}_0xbb0ddf[_0x4abc('0x26')](_0x1d0d0b)[_0x4abc('0x33')](_0x5cd4be);};}exports['index']=function(_0x28900e,_0x3076b8){var _0x388603={},_0x345ec7={},_0x1880b0={'count':0x0,'rows':[]};var _0x28afbf=_[_0x4abc('0x34')](db[_0x4abc('0x35')][_0x4abc('0x36')],function(_0x28722f){return{'name':_0x28722f[_0x4abc('0x37')],'type':_0x28722f[_0x4abc('0x38')][_0x4abc('0x39')]};});_0x345ec7[_0x4abc('0x3a')]=_[_0x4abc('0x34')](_0x28afbf,_0x4abc('0x32'));_0x345ec7[_0x4abc('0x3b')]=_[_0x4abc('0x3c')](_0x28900e[_0x4abc('0x3b')]);_0x345ec7['filters']=_[_0x4abc('0x3d')](_0x345ec7['model'],_0x345ec7[_0x4abc('0x3b')]);_0x388603[_0x4abc('0x3e')]=_[_0x4abc('0x3d')](_0x345ec7[_0x4abc('0x3a')],qs[_0x4abc('0x3f')](_0x28900e['query'][_0x4abc('0x3f')]));_0x388603[_0x4abc('0x3e')]=_0x388603[_0x4abc('0x3e')][_0x4abc('0x40')]?_0x388603[_0x4abc('0x3e')]:_0x345ec7[_0x4abc('0x3a')];if(!_0x28900e[_0x4abc('0x3b')][_0x4abc('0x41')](_0x4abc('0x42'))){_0x388603[_0x4abc('0x2a')]=qs['limit'](_0x28900e[_0x4abc('0x3b')][_0x4abc('0x2a')]);_0x388603[_0x4abc('0x28')]=qs[_0x4abc('0x28')](_0x28900e[_0x4abc('0x3b')][_0x4abc('0x28')]);}_0x388603[_0x4abc('0x43')]=qs[_0x4abc('0x44')](_0x28900e[_0x4abc('0x3b')][_0x4abc('0x44')]);_0x388603[_0x4abc('0x45')]=qs[_0x4abc('0x46')](_[_0x4abc('0x47')](_0x28900e['query'],_0x345ec7['filters']),_0x28afbf);if(_0x28900e[_0x4abc('0x3b')][_0x4abc('0x48')]){_0x388603[_0x4abc('0x45')]=_[_0x4abc('0x49')](_0x388603[_0x4abc('0x45')],{'$or':_['map'](_0x28afbf,function(_0x3c4a13){if(_0x3c4a13['type']!==_0x4abc('0x4a')){var _0x557030={};_0x557030[_0x3c4a13[_0x4abc('0x32')]]={'$like':'%'+_0x28900e[_0x4abc('0x3b')][_0x4abc('0x48')]+'%'};return _0x557030;}})});}_0x388603=_[_0x4abc('0x49')]({},_0x388603,_0x28900e[_0x4abc('0x4b')]);var _0x5d2148={'where':_0x388603[_0x4abc('0x45')]};return db['Setting'][_0x4abc('0x2b')](_0x5d2148)[_0x4abc('0x1b')](function(_0xea0198){_0x1880b0['count']=_0xea0198;if(_0x28900e[_0x4abc('0x3b')][_0x4abc('0x4c')]){_0x388603[_0x4abc('0x4d')]=[{'all':!![]}];}return db[_0x4abc('0x35')][_0x4abc('0x4e')](_0x388603);})[_0x4abc('0x1b')](function(_0x26ce33){_0x1880b0[_0x4abc('0x4f')]=_0x26ce33;return _0x1880b0;})[_0x4abc('0x1b')](respondWithFilteredResult(_0x3076b8,_0x388603))[_0x4abc('0x25')](handleError(_0x3076b8,null));};exports[_0x4abc('0x50')]=function(_0x3bf978,_0x4e92cf){var _0x53b09d={'raw':![],'where':{'id':_0x3bf978[_0x4abc('0x51')]['id']}},_0x16e977={};_0x16e977[_0x4abc('0x3a')]=_[_0x4abc('0x3c')](db[_0x4abc('0x35')][_0x4abc('0x36')]);_0x16e977['query']=_[_0x4abc('0x3c')](_0x3bf978[_0x4abc('0x3b')]);_0x16e977['filters']=_[_0x4abc('0x3d')](_0x16e977[_0x4abc('0x3a')],_0x16e977[_0x4abc('0x3b')]);_0x53b09d['attributes']=_[_0x4abc('0x3d')](_0x16e977['model'],qs[_0x4abc('0x3f')](_0x3bf978[_0x4abc('0x3b')]['fields']));_0x53b09d[_0x4abc('0x3e')]=_0x53b09d['attributes'][_0x4abc('0x40')]?_0x53b09d[_0x4abc('0x3e')]:_0x16e977[_0x4abc('0x3a')];if(_0x3bf978[_0x4abc('0x3b')][_0x4abc('0x4c')]){_0x53b09d[_0x4abc('0x4d')]=[{'all':!![]}];}_0x53b09d=_[_0x4abc('0x49')]({},_0x53b09d,_0x3bf978[_0x4abc('0x4b')]);return db[_0x4abc('0x35')]['find'](_0x53b09d)['then'](handleEntityNotFound(_0x4e92cf,null))['then'](respondWithResult(_0x4e92cf,null))[_0x4abc('0x25')](handleError(_0x4e92cf,null));};exports['update']=function(_0x13a55b,_0xac2efb){if(_0x13a55b[_0x4abc('0x52')]['id']){delete _0x13a55b['body']['id'];}return db[_0x4abc('0x35')]['find']({'where':{'id':_0x13a55b[_0x4abc('0x51')]['id']}})[_0x4abc('0x1b')](handleEntityNotFound(_0xac2efb,null))[_0x4abc('0x1b')](saveUpdates(_0x13a55b[_0x4abc('0x52')],null))['then'](respondWithResult(_0xac2efb,null))[_0x4abc('0x25')](handleError(_0xac2efb,null));};exports[_0x4abc('0x53')]=function(_0x13ba31,_0x409943,_0x2390f0){if(_0x13ba31[_0x4abc('0x54')]&&_0x13ba31[_0x4abc('0x54')][_0x4abc('0x55')]){_0x13ba31[_0x4abc('0x52')][_0x4abc('0x56')]=_0x13ba31[_0x4abc('0x54')][_0x4abc('0x55')];}return db[_0x4abc('0x35')][_0x4abc('0x57')]({'where':{'id':_0x13ba31['params']['id']}})['then'](handleEntityNotFound(_0x409943,null))['then'](saveUpdates(_0x13ba31[_0x4abc('0x52')],null))['then'](respondWithResult(_0x409943,null))[_0x4abc('0x25')](handleError(_0x409943,null));};exports[_0x4abc('0x58')]=function(_0x20cac1,_0x31afbd,_0x2a3542){if(_0x20cac1[_0x4abc('0x54')]&&_0x20cac1['file'][_0x4abc('0x55')]){_0x20cac1[_0x4abc('0x52')][_0x4abc('0x59')]=_0x20cac1['file'][_0x4abc('0x55')];}return db[_0x4abc('0x35')][_0x4abc('0x57')]({'where':{'id':_0x20cac1['params']['id']}})[_0x4abc('0x1b')](handleEntityNotFound(_0x31afbd,null))['then'](saveUpdates(_0x20cac1[_0x4abc('0x52')],null))['then'](respondWithResult(_0x31afbd,null))['catch'](handleError(_0x31afbd,null));};var utilLicense=require('../../config/license/util');exports[_0x4abc('0x5a')]=function(_0x272bbc,_0x33dcd7,_0x4580dd){var _0x3f5c8d='server/files/images/logos';var _0x4acdde={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x74e877){if(_0x74e877){_0x4acdde=_0x74e877;}return db[_0x4abc('0x35')][_0x4abc('0x57')]({'where':{'id':_0x272bbc[_0x4abc('0x51')]['id']},'attributes':['logo',_0x4abc('0x59'),_0x4abc('0x5b'),_0x4abc('0x5c'),_0x4abc('0x5d'),_0x4abc('0x5e'),_0x4abc('0x5f'),_0x4abc('0x60')],'raw':!![]});})[_0x4abc('0x1b')](handleEntityNotFound(_0x33dcd7,null))['then'](function(_0x2bc90a){if(_0x2bc90a){var _0x36dab2=_0x2bc90a[_0x4abc('0x56')]&&fs[_0x4abc('0x61')](path[_0x4abc('0x62')](config[_0x4abc('0x63')],_0x3f5c8d,_[_0x4abc('0x64')](_0x2bc90a[_0x4abc('0x56')])))?path[_0x4abc('0x62')](config[_0x4abc('0x63')],_0x3f5c8d,_[_0x4abc('0x64')](_0x2bc90a[_0x4abc('0x56')])):path['join'](config['root'],_0x3f5c8d,_[_0x4abc('0x64')](_0x4abc('0x65')));var _0x365b2b='default'+_[_0x4abc('0x66')]('logo');if(_0x2bc90a[_0x365b2b]||!_0x4acdde['custom']){_0x36dab2=path[_0x4abc('0x62')](config['root'],_0x3f5c8d,_[_0x4abc('0x64')](_0x4abc('0x65')));}if(!fs[_0x4abc('0x61')](_0x36dab2)){throw new db['Sequelize']['ValidationError'](_['upperFirst'](_0x4abc('0x56'))+_0x4abc('0x67'));}return _0x33dcd7['download'](_0x36dab2);}})[_0x4abc('0x25')](handleError(_0x33dcd7,null));};var utilLicense=require(_0x4abc('0x15'));exports['getLogoLogin']=function(_0x5f4331,_0x4fee6d,_0x451eff){var _0x593f6d=_0x4abc('0x68');var _0xa6695f={'custom':![]};return utilLicense[_0x4abc('0x69')]()[_0x4abc('0x1b')](function(_0x51e52d){if(_0x51e52d){_0xa6695f=_0x51e52d;}return db[_0x4abc('0x35')][_0x4abc('0x57')]({'where':{'id':_0x5f4331[_0x4abc('0x51')]['id']},'attributes':['logo',_0x4abc('0x59'),_0x4abc('0x5b'),_0x4abc('0x5c'),_0x4abc('0x5d'),_0x4abc('0x5e'),_0x4abc('0x5f'),_0x4abc('0x60')],'raw':!![]});})[_0x4abc('0x1b')](handleEntityNotFound(_0x4fee6d,null))['then'](function(_0x4bd08b){if(_0x4bd08b){var _0x53f41f=_0x4bd08b[_0x4abc('0x59')]&&fs[_0x4abc('0x61')](path['join'](config[_0x4abc('0x63')],_0x593f6d,_[_0x4abc('0x64')](_0x4bd08b[_0x4abc('0x59')])))?path[_0x4abc('0x62')](config['root'],_0x593f6d,_[_0x4abc('0x64')](_0x4bd08b[_0x4abc('0x59')])):path[_0x4abc('0x62')](config[_0x4abc('0x63')],_0x593f6d,_[_0x4abc('0x64')](_0x4abc('0x6a')));var _0x2881a4=_0x4abc('0x6b')+_[_0x4abc('0x66')](_0x4abc('0x59'));if(_0x4bd08b[_0x2881a4]||!_0xa6695f[_0x4abc('0x6c')]){_0x53f41f=path['join'](config[_0x4abc('0x63')],_0x593f6d,_[_0x4abc('0x64')](_0x4abc('0x6a')));}if(!fs[_0x4abc('0x61')](_0x53f41f)){throw new db[(_0x4abc('0x6d'))][(_0x4abc('0x6e'))](_[_0x4abc('0x66')](_0x4abc('0x59'))+'\x20not\x20found');}return _0x4fee6d['download'](_0x53f41f);}})[_0x4abc('0x25')](handleError(_0x4fee6d,null));};exports[_0x4abc('0x6f')]=function(_0x1cb945,_0x129de4){return db['Setting'][_0x4abc('0x57')]({'where':{'id':_0x1cb945['params']['id']},'attributes':[_0x4abc('0x70')]})[_0x4abc('0x1b')](respondWithResult(_0x129de4,null))[_0x4abc('0x25')](handleError(_0x129de4,null));};exports['addPreferred']=function(_0x21d650,_0x3c6174,_0x35cef7){if(_0x21d650[_0x4abc('0x54')]&&_0x21d650[_0x4abc('0x54')][_0x4abc('0x55')]){_0x21d650[_0x4abc('0x52')]['preferred']=_0x21d650[_0x4abc('0x54')][_0x4abc('0x55')];}return db['Setting'][_0x4abc('0x57')]({'where':{'id':_0x21d650['params']['id']}})[_0x4abc('0x1b')](handleEntityNotFound(_0x3c6174,null))[_0x4abc('0x1b')](saveUpdates(_0x21d650['body'],null))[_0x4abc('0x1b')](respondWithResult(_0x3c6174,null))[_0x4abc('0x25')](handleError(_0x3c6174,null));};var utilLicense=require(_0x4abc('0x15'));exports[_0x4abc('0x71')]=function(_0x1f6952,_0x5275e7,_0x1c89d3){var _0x57fb32='server/files/images/logos';var _0x2d2070={'custom':![]};return utilLicense[_0x4abc('0x69')]()[_0x4abc('0x1b')](function(_0x469a11){if(_0x469a11){_0x2d2070=_0x469a11;}return db[_0x4abc('0x35')][_0x4abc('0x57')]({'where':{'id':_0x1f6952[_0x4abc('0x51')]['id']},'attributes':[_0x4abc('0x56'),'loginLogo',_0x4abc('0x5b'),_0x4abc('0x5c'),'defaultLogo',_0x4abc('0x5e'),_0x4abc('0x5f'),_0x4abc('0x60')],'raw':!![]});})[_0x4abc('0x1b')](handleEntityNotFound(_0x5275e7,null))[_0x4abc('0x1b')](function(_0x182be9){if(_0x182be9){var _0x5d8624=_0x182be9['preferred']&&fs['existsSync'](path[_0x4abc('0x62')](config[_0x4abc('0x63')],_0x57fb32,_[_0x4abc('0x64')](_0x182be9[_0x4abc('0x5b')])))?path[_0x4abc('0x62')](config['root'],_0x57fb32,_[_0x4abc('0x64')](_0x182be9[_0x4abc('0x5b')])):path[_0x4abc('0x62')](config[_0x4abc('0x63')],_0x57fb32,_['toLower'](_0x4abc('0x72')));var _0x2c25b9=_0x4abc('0x6b')+_[_0x4abc('0x66')](_0x4abc('0x5b'));if(_0x182be9[_0x2c25b9]||!_0x2d2070[_0x4abc('0x6c')]||!_0x2d2070[_0x4abc('0x5b')]){_0x5d8624=path['join'](config[_0x4abc('0x63')],_0x57fb32,_[_0x4abc('0x64')]('default_preferred.png'));}if(!fs[_0x4abc('0x61')](_0x5d8624)){throw new db[(_0x4abc('0x6d'))][(_0x4abc('0x6e'))](_['upperFirst'](_0x4abc('0x5b'))+_0x4abc('0x67'));}return _0x5275e7[_0x4abc('0x73')](_0x5d8624);}})['catch'](handleError(_0x5275e7,null));};exports['addFavicon']=function(_0x19b63e,_0x23ff6b,_0x2542f5){if(_0x19b63e[_0x4abc('0x54')]&&_0x19b63e[_0x4abc('0x54')]['filename']){_0x19b63e[_0x4abc('0x52')]['favicon']=_0x19b63e[_0x4abc('0x54')][_0x4abc('0x55')];}return db[_0x4abc('0x35')][_0x4abc('0x57')]({'where':{'id':_0x19b63e['params']['id']}})['then'](handleEntityNotFound(_0x23ff6b,null))[_0x4abc('0x1b')](saveUpdates(_0x19b63e[_0x4abc('0x52')],null))[_0x4abc('0x1b')](respondWithResult(_0x23ff6b,null))['catch'](handleError(_0x23ff6b,null));};var utilLicense=require(_0x4abc('0x15'));exports[_0x4abc('0x74')]=function(_0x4acd19,_0x5a73f8,_0x47acfc){var _0x5f4ac3=_0x4abc('0x68');var _0x109b53={'custom':![]};return utilLicense[_0x4abc('0x69')]()[_0x4abc('0x1b')](function(_0x4aed13){if(_0x4aed13){_0x109b53=_0x4aed13;}return db[_0x4abc('0x35')][_0x4abc('0x57')]({'where':{'id':_0x4acd19[_0x4abc('0x51')]['id']},'attributes':[_0x4abc('0x56'),_0x4abc('0x59'),'preferred','favicon',_0x4abc('0x5d'),_0x4abc('0x5e'),_0x4abc('0x5f'),_0x4abc('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x5a73f8,null))['then'](function(_0x37be27){if(_0x37be27){var _0x1f1dfd=_0x37be27[_0x4abc('0x5c')]&&fs[_0x4abc('0x61')](path[_0x4abc('0x62')](config[_0x4abc('0x63')],_0x5f4ac3,_[_0x4abc('0x64')](_0x37be27[_0x4abc('0x5c')])))?path[_0x4abc('0x62')](config['root'],_0x5f4ac3,_[_0x4abc('0x64')](_0x37be27['favicon'])):path['join'](config[_0x4abc('0x63')],_0x5f4ac3,_['toLower']('default_favicon.ico'));var _0x8a4cab='default'+_[_0x4abc('0x66')](_0x4abc('0x5c'));if(_0x37be27[_0x8a4cab]||!_0x109b53[_0x4abc('0x6c')]){_0x1f1dfd=path[_0x4abc('0x62')](config[_0x4abc('0x63')],_0x5f4ac3,_[_0x4abc('0x64')](_0x4abc('0x75')));}if(!fs[_0x4abc('0x61')](_0x1f1dfd)){throw new db[(_0x4abc('0x6d'))]['ValidationError'](_['upperFirst'](_0x4abc('0x5c'))+_0x4abc('0x67'));}return _0x5a73f8[_0x4abc('0x73')](_0x1f1dfd);}})[_0x4abc('0x25')](handleError(_0x5a73f8,null));};exports[_0x4abc('0x76')]=function(_0x4d33a5,_0xf695d6){var _0x19acd7={'offset':moment()['utcOffset']()};_0x19acd7[_0x4abc('0x77')]=moment()['utcOffset'](_0x19acd7[_0x4abc('0x28')])['format'](_0x4abc('0x78'));return _0xf695d6[_0x4abc('0x26')](0xc8)[_0x4abc('0x33')](_0x19acd7);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 57375c4..6085ab5 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x4c2623,_0x4838bb){var _0x2be431=function(_0x55829d){while(--_0x55829d){_0x4c2623['push'](_0x4c2623['shift']());}};_0x2be431(++_0x4838bb);}(_0x008c,0x188));var _0xc008=function(_0x49f19e,_0x1c3aa3){_0x49f19e=_0x49f19e-0x0;var _0x280b5a=_0x008c[_0x49f19e];return _0x280b5a;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x148c09,_0x4fd39f){var _0x18e613=function(_0xfaa810){while(--_0xfaa810){_0x148c09['push'](_0x148c09['shift']());}};_0x18e613(++_0x4fd39f);}(_0x55ca,0x126));var _0xa55c=function(_0x1af469,_0x584d95){_0x1af469=_0x1af469-0x0;var _0x336171=_0x55ca[_0x1af469];return _0x336171;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 2b99a78..97b8c62 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 _0xfa4b=['map','include','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSetting','Setting','find','options','raw','where','attributes'];(function(_0x7d6674,_0x2c9e4d){var _0x10825c=function(_0x517abf){while(--_0x517abf){_0x7d6674['push'](_0x7d6674['shift']());}};_0x10825c(++_0x2c9e4d);}(_0xfa4b,0xcf));var _0xbfa4=function(_0x58d585,_0x27dffb){_0x58d585=_0x58d585-0x0;var _0x47ab48=_0xfa4b[_0x58d585];return _0x47ab48;};'use strict';var _=require(_0xbfa4('0x0'));var util=require(_0xbfa4('0x1'));var moment=require(_0xbfa4('0x2'));var BPromise=require('bluebird');var rs=require(_0xbfa4('0x3'));var fs=require('fs');var Redis=require(_0xbfa4('0x4'));var db=require(_0xbfa4('0x5'))['db'];var utils=require(_0xbfa4('0x6'));var logger=require('../../config/logger')(_0xbfa4('0x7'));var config=require(_0xbfa4('0x8'));var jayson=require(_0xbfa4('0x9'));var client=jayson[_0xbfa4('0xa')][_0xbfa4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a19e9,_0x9a06a3,_0x280f0c){return new BPromise(function(_0x4dbf9b,_0x3e7d8c){return client['request'](_0x3a19e9,_0x280f0c)[_0xbfa4('0xc')](function(_0x61d3d9){logger[_0xbfa4('0xd')](_0xbfa4('0xe'),_0x9a06a3,'request\x20sent');logger[_0xbfa4('0xf')](_0xbfa4('0x10'),_0x9a06a3,_0xbfa4('0x11'),JSON[_0xbfa4('0x12')](_0x61d3d9));if(_0x61d3d9['error']){if(_0x61d3d9[_0xbfa4('0x13')][_0xbfa4('0x14')]===0x1f4){logger['error'](_0xbfa4('0xe'),_0x9a06a3,_0x61d3d9[_0xbfa4('0x13')][_0xbfa4('0x15')]);return _0x3e7d8c(_0x61d3d9['error'][_0xbfa4('0x15')]);}logger[_0xbfa4('0x13')](_0xbfa4('0xe'),_0x9a06a3,_0x61d3d9[_0xbfa4('0x13')]['message']);return _0x4dbf9b(_0x61d3d9[_0xbfa4('0x13')][_0xbfa4('0x15')]);}else{logger[_0xbfa4('0xd')]('Setting,\x20%s,\x20%s',_0x9a06a3,_0xbfa4('0x11'));_0x4dbf9b(_0x61d3d9[_0xbfa4('0x16')][_0xbfa4('0x15')]);}})[_0xbfa4('0x17')](function(_0x7e9cf3){logger[_0xbfa4('0x13')](_0xbfa4('0xe'),_0x9a06a3,_0x7e9cf3);_0x3e7d8c(_0x7e9cf3);});});}exports[_0xbfa4('0x18')]=function(_0xfe64bc){var _0x2a3072=this;return new Promise(function(_0x399e7e,_0x2e43b9){return db[_0xbfa4('0x19')][_0xbfa4('0x1a')]({'raw':_0xfe64bc[_0xbfa4('0x1b')]?_0xfe64bc[_0xbfa4('0x1b')][_0xbfa4('0x1c')]===undefined?!![]:![]:!![],'where':_0xfe64bc[_0xbfa4('0x1b')]?_0xfe64bc[_0xbfa4('0x1b')][_0xbfa4('0x1d')]||null:null,'attributes':_0xfe64bc['options']?_0xfe64bc['options'][_0xbfa4('0x1e')]||null:null,'include':_0xfe64bc[_0xbfa4('0x1b')]?_0xfe64bc[_0xbfa4('0x1b')]['include']?_[_0xbfa4('0x1f')](_0xfe64bc[_0xbfa4('0x1b')][_0xbfa4('0x20')],function(_0x482719){return{'model':db[_0x482719[_0xbfa4('0x21')]],'as':_0x482719['as'],'attributes':_0x482719[_0xbfa4('0x1e')],'include':_0x482719[_0xbfa4('0x20')]?_['map'](_0x482719[_0xbfa4('0x20')],function(_0x34a392){return{'model':db[_0x34a392[_0xbfa4('0x21')]],'as':_0x34a392['as'],'attributes':_0x34a392[_0xbfa4('0x1e')],'include':_0x34a392['include']?_[_0xbfa4('0x1f')](_0x34a392[_0xbfa4('0x20')],function(_0x240533){return{'model':db[_0x240533[_0xbfa4('0x21')]],'as':_0x240533['as'],'attributes':_0x240533[_0xbfa4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbfa4('0xc')](function(_0x59ff0b){logger[_0xbfa4('0xd')](_0xbfa4('0x18'),_0xfe64bc);logger[_0xbfa4('0xf')](_0xbfa4('0x18'),_0xfe64bc,JSON['stringify'](_0x59ff0b));_0x399e7e(_0x59ff0b);})['catch'](function(_0x4f5730){logger[_0xbfa4('0x13')]('ShowSetting',_0x4f5730['message'],_0xfe64bc);_0x2e43b9(_0x2a3072[_0xbfa4('0x13')](0x1f4,_0x4f5730[_0xbfa4('0x15')]));});});}; \ No newline at end of file +var _0xf8b4=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ShowSetting','Setting','find','options','raw','include','map','model','attributes','lodash'];(function(_0x143e58,_0x35d2d4){var _0x515630=function(_0x504575){while(--_0x504575){_0x143e58['push'](_0x143e58['shift']());}};_0x515630(++_0x35d2d4);}(_0xf8b4,0x128));var _0x4f8b=function(_0x2282c2,_0x46dbd6){_0x2282c2=_0x2282c2-0x0;var _0x63e743=_0xf8b4[_0x2282c2];return _0x63e743;};'use strict';var _=require(_0x4f8b('0x0'));var util=require(_0x4f8b('0x1'));var moment=require(_0x4f8b('0x2'));var BPromise=require(_0x4f8b('0x3'));var rs=require(_0x4f8b('0x4'));var fs=require('fs');var Redis=require(_0x4f8b('0x5'));var db=require(_0x4f8b('0x6'))['db'];var utils=require(_0x4f8b('0x7'));var logger=require('../../config/logger')(_0x4f8b('0x8'));var config=require(_0x4f8b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4f8b('0xa')][_0x4f8b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x626114,_0x2881f3,_0x218ec5){return new BPromise(function(_0x46e828,_0x22b6ff){return client[_0x4f8b('0xc')](_0x626114,_0x218ec5)[_0x4f8b('0xd')](function(_0x1a2ca0){logger[_0x4f8b('0xe')](_0x4f8b('0xf'),_0x2881f3,'request\x20sent');logger[_0x4f8b('0x10')](_0x4f8b('0x11'),_0x2881f3,_0x4f8b('0x12'),JSON[_0x4f8b('0x13')](_0x1a2ca0));if(_0x1a2ca0[_0x4f8b('0x14')]){if(_0x1a2ca0[_0x4f8b('0x14')]['code']===0x1f4){logger[_0x4f8b('0x14')](_0x4f8b('0xf'),_0x2881f3,_0x1a2ca0[_0x4f8b('0x14')][_0x4f8b('0x15')]);return _0x22b6ff(_0x1a2ca0[_0x4f8b('0x14')]['message']);}logger[_0x4f8b('0x14')](_0x4f8b('0xf'),_0x2881f3,_0x1a2ca0[_0x4f8b('0x14')][_0x4f8b('0x15')]);return _0x46e828(_0x1a2ca0['error']['message']);}else{logger[_0x4f8b('0xe')](_0x4f8b('0xf'),_0x2881f3,_0x4f8b('0x12'));_0x46e828(_0x1a2ca0[_0x4f8b('0x16')]['message']);}})[_0x4f8b('0x17')](function(_0x2e21c8){logger[_0x4f8b('0x14')](_0x4f8b('0xf'),_0x2881f3,_0x2e21c8);_0x22b6ff(_0x2e21c8);});});}exports[_0x4f8b('0x18')]=function(_0xf9d8a1){var _0x4300c9=this;return new Promise(function(_0x232fcb,_0x4e1dd0){return db[_0x4f8b('0x19')][_0x4f8b('0x1a')]({'raw':_0xf9d8a1[_0x4f8b('0x1b')]?_0xf9d8a1[_0x4f8b('0x1b')][_0x4f8b('0x1c')]===undefined?!![]:![]:!![],'where':_0xf9d8a1['options']?_0xf9d8a1['options']['where']||null:null,'attributes':_0xf9d8a1['options']?_0xf9d8a1[_0x4f8b('0x1b')]['attributes']||null:null,'include':_0xf9d8a1['options']?_0xf9d8a1[_0x4f8b('0x1b')][_0x4f8b('0x1d')]?_[_0x4f8b('0x1e')](_0xf9d8a1[_0x4f8b('0x1b')]['include'],function(_0x12fb76){return{'model':db[_0x12fb76[_0x4f8b('0x1f')]],'as':_0x12fb76['as'],'attributes':_0x12fb76[_0x4f8b('0x20')],'include':_0x12fb76[_0x4f8b('0x1d')]?_[_0x4f8b('0x1e')](_0x12fb76[_0x4f8b('0x1d')],function(_0x207cfa){return{'model':db[_0x207cfa[_0x4f8b('0x1f')]],'as':_0x207cfa['as'],'attributes':_0x207cfa['attributes'],'include':_0x207cfa[_0x4f8b('0x1d')]?_['map'](_0x207cfa[_0x4f8b('0x1d')],function(_0x2a1ed4){return{'model':db[_0x2a1ed4[_0x4f8b('0x1f')]],'as':_0x2a1ed4['as'],'attributes':_0x2a1ed4['attributes']};}):[]};}):[]};}):[]:[]})[_0x4f8b('0xd')](function(_0x1ba419){logger['info'](_0x4f8b('0x18'),_0xf9d8a1);logger[_0x4f8b('0x10')](_0x4f8b('0x18'),_0xf9d8a1,JSON[_0x4f8b('0x13')](_0x1ba419));_0x232fcb(_0x1ba419);})[_0x4f8b('0x17')](function(_0x62551b){logger[_0x4f8b('0x14')](_0x4f8b('0x18'),_0x62551b[_0x4f8b('0x15')],_0xf9d8a1);_0x4e1dd0(_0x4300c9[_0x4f8b('0x14')](0x1f4,_0x62551b['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 6414f21..132768d 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 _0xc4aa=['statusGet','/:id/users','getAgents','post','addDisposition','addAnswer','notify','addApplications','/:id/send','send','status','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0x43b106,_0x255209){var _0x1157ec=function(_0x2593f7){while(--_0x2593f7){_0x43b106['push'](_0x43b106['shift']());}};_0x1157ec(++_0x255209);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xc4aa[_0x3d42d8];return _0x27fc41;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['describe']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['get'](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);router['get'](_0xac4a('0x10'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);router['get'](_0xac4a('0x12'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x13')]);router['get'](_0xac4a('0x14'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x15')]);router[_0xac4a('0x8')](_0xac4a('0x16'),controller[_0xac4a('0x17')]);router[_0xac4a('0x8')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x19')]);router[_0xac4a('0x1a')]('/',auth[_0xac4a('0x9')](),controller['create']);router[_0xac4a('0x1a')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1b')]);router[_0xac4a('0x1a')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1c')]);router['post']('/:id/notify',controller[_0xac4a('0x1d')]);router[_0xac4a('0x1a')](_0xac4a('0x12'),auth['isAuthenticated'](),controller[_0xac4a('0x1e')]);router[_0xac4a('0x1a')](_0xac4a('0x1f'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x20')]);router[_0xac4a('0x1a')](_0xac4a('0x16'),controller[_0xac4a('0x21')]);router['post'](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller['addAgents']);router[_0xac4a('0x22')](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x23')]);router['delete'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x24')]);router[_0xac4a('0x25')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x26')]);router[_0xac4a('0x25')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x27')]);router[_0xac4a('0x25')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x28')]);module[_0xac4a('0x29')]=router; \ No newline at end of file +var _0x7fbe=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','post','create','/:id/notify','notify','put','delete','removeAnswers','path','connect-timeout','express'];(function(_0x1f320a,_0x5318e2){var _0x19b92c=function(_0x513762){while(--_0x513762){_0x1f320a['push'](_0x1f320a['shift']());}};_0x19b92c(++_0x5318e2);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x80eb99,_0xf5b711){_0x80eb99=_0x80eb99-0x0;var _0x398203=_0x7fbe[_0x80eb99];return _0x398203;};'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')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['show']);router['get'](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x10')]);router[_0xe7fb('0x9')](_0xe7fb('0x11'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x12')]);router[_0xe7fb('0x9')](_0xe7fb('0x13'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x14')]);router[_0xe7fb('0x9')](_0xe7fb('0x15'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x16')]);router['get'](_0xe7fb('0x17'),controller[_0xe7fb('0x18')]);router['get'](_0xe7fb('0x19'),auth[_0xe7fb('0xa')](),controller['getAgents']);router[_0xe7fb('0x1a')]('/',auth['isAuthenticated'](),controller[_0xe7fb('0x1b')]);router[_0xe7fb('0x1a')](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller['addDisposition']);router[_0xe7fb('0x1a')]('/:id/canned_answers',auth[_0xe7fb('0xa')](),controller['addAnswer']);router[_0xe7fb('0x1a')](_0xe7fb('0x1c'),controller[_0xe7fb('0x1d')]);router[_0xe7fb('0x1a')]('/:id/applications',auth[_0xe7fb('0xa')](),controller['addApplications']);router[_0xe7fb('0x1a')]('/:id/send',auth[_0xe7fb('0xa')](),controller['send']);router[_0xe7fb('0x1a')](_0xe7fb('0x17'),controller['status']);router[_0xe7fb('0x1a')](_0xe7fb('0x19'),auth[_0xe7fb('0xa')](),controller['addAgents']);router[_0xe7fb('0x1e')](_0xe7fb('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xe7fb('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0xe7fb('0x1f')](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller['removeDispositions']);router[_0xe7fb('0x1f')](_0xe7fb('0x11'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x20')]);router[_0xe7fb('0x1f')](_0xe7fb('0x19'),auth[_0xe7fb('0xa')](),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 6607b9f..1bc4f6c 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 _0x85ce=['connectel','clicksend','plivo','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','name','ENUM'];(function(_0x5cee53,_0x16d99d){var _0x474479=function(_0x403385){while(--_0x403385){_0x5cee53['push'](_0x5cee53['shift']());}};_0x474479(++_0x16d99d);}(_0x85ce,0x106));var _0xe85c=function(_0x47de17,_0x17c4f){_0x47de17=_0x47de17-0x0;var _0x18ad38=_0x85ce[_0x47de17];return _0x18ad38;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xe85c('0x0')]={'name':{'type':Sequelize[_0xe85c('0x1')],'unique':_0xe85c('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xe85c('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0xe85c('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0xe85c('0x1')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xe85c('0x1')]},'type':{'type':Sequelize[_0xe85c('0x3')]('twilio','skebby',_0xe85c('0x4'),_0xe85c('0x5'),_0xe85c('0x6'),'clickatell',_0xe85c('0x7'),_0xe85c('0x8'),_0xe85c('0x9'),_0xe85c('0xa'))},'accountSid':{'type':Sequelize[_0xe85c('0x1')]},'authId':{'type':Sequelize[_0xe85c('0x1')]},'authToken':{'type':Sequelize[_0xe85c('0x1')]},'smsMethod':{'type':Sequelize[_0xe85c('0x3')]('SI','TI','GP')},'username':{'type':Sequelize[_0xe85c('0x1')]},'password':{'type':Sequelize[_0xe85c('0x1')]},'apiKey':{'type':Sequelize[_0xe85c('0x1')]},'applicationId':{'type':Sequelize[_0xe85c('0x1')]},'accountId':{'type':Sequelize[_0xe85c('0x1')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0xe85c('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0xe85c('0x1')]},'notificationTemplate':{'type':Sequelize[_0xe85c('0xc')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xe85c('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe85c('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe85c('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe85c('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe85c('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe85c('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xe85c('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe85c('0xd')],'comment':_0xe85c('0xe')},'mandatoryDisposition':{'type':Sequelize[_0xe85c('0xb')],'defaultValue':![],'comment':_0xe85c('0xf'),'set':function(_0x4ff8f8){if(!_0x4ff8f8)this[_0xe85c('0x10')](_0xe85c('0x11'),null);this['setDataValue'](_0xe85c('0x12'),_0x4ff8f8);}}}; \ No newline at end of file +var _0x576a=['randomstring','exports','name','STRING','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x13dfca,_0x1c4fb9){var _0x515eab=function(_0x467a33){while(--_0x467a33){_0x13dfca['push'](_0x13dfca['shift']());}};_0x515eab(++_0x1c4fb9);}(_0x576a,0x186));var _0xa576=function(_0x5b2106,_0x357840){_0x5b2106=_0x5b2106-0x0;var _0x640bf3=_0x576a[_0x5b2106];return _0x640bf3;};'use strict';var Sequelize=require(_0xa576('0x0'));var rs=require(_0xa576('0x1'));module[_0xa576('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xa576('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xa576('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0xa576('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0xa576('0x4')],'defaultValue':function(){return rs[_0xa576('0x5')]();}},'phone':{'type':Sequelize[_0xa576('0x4')]},'type':{'type':Sequelize[_0xa576('0x6')](_0xa576('0x7'),_0xa576('0x8'),_0xa576('0x9'),_0xa576('0xa'),_0xa576('0xb'),_0xa576('0xc'),_0xa576('0xd'),_0xa576('0xe'),_0xa576('0xf'),'intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xa576('0x4')]},'smsMethod':{'type':Sequelize[_0xa576('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0xa576('0x4')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xa576('0x4')]},'applicationId':{'type':Sequelize[_0xa576('0x4')]},'accountId':{'type':Sequelize[_0xa576('0x4')]},'senderString':{'type':Sequelize[_0xa576('0x4')]},'deliveryReport':{'type':Sequelize[_0xa576('0x10')],'defaultValue':![]},'description':{'type':Sequelize[_0xa576('0x4')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xa576('0x11');}},'notificationSound':{'type':Sequelize[_0xa576('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa576('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa576('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa576('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa576('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa576('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa576('0x12')],'comment':_0xa576('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x375ce6){if(!_0x375ce6)this[_0xa576('0x14')](_0xa576('0x15'),null);this[_0xa576('0x14')](_0xa576('0x16'),_0x375ce6);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index cc21bd1..e88b175 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 _0x8929=['apply','reject','save','destroy','SmsAccounts','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','includeAll','findAll','rows','show','params','include','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','SmsAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','CannedAnswer','getAnswers','length','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','Body','messageId','MessageSid','text','connectel','message_id','plivo','From','Text','infobip','results','csc','fromNumber','replyMessageId','bandwidth','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','list','CmContact','contact','SmsInteraction','spread','interaction','created','close','unmanaged','*,*,*,*','SmsMessage','AttachmentId','UserId','User','unshift','agent','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','sequelize','transaction','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','List','DESC','out','Messages','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','statusInt','groupName','clickatell','redif','DELIVERED','update','clicksend','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','intelepeer','DELIVRD','message-id','state','addAgents','omit','emit','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range'];(function(_0x546c4d,_0x461326){var _0x279afc=function(_0x3c888d){while(--_0x3c888d){_0x546c4d['push'](_0x546c4d['shift']());}};_0x279afc(++_0x461326);}(_0x8929,0x18b));var _0x9892=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x8929[_0x1deb03];return _0x189fe7;};'use strict';var emlformat=require(_0x9892('0x0'));var rimraf=require(_0x9892('0x1'));var zipdir=require(_0x9892('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9892('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9892('0x4'));var path=require(_0x9892('0x5'));var sox=require(_0x9892('0x6'));var csv=require('to-csv');var ejs=require(_0x9892('0x7'));var fs=require('fs');var fs_extra=require(_0x9892('0x8'));var _=require('lodash');var squel=require(_0x9892('0x9'));var crypto=require('crypto');var jsforce=require(_0x9892('0xa'));var deskjs=require(_0x9892('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9892('0xc'));var Papa=require(_0x9892('0xd'));var Redis=require(_0x9892('0xe'));var authService=require(_0x9892('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9892('0x10'));var hardwareService=require(_0x9892('0x11'));var logger=require('../../config/logger')(_0x9892('0x12'));var utils=require(_0x9892('0x13'));var config=require(_0x9892('0x14'));var licenseUtil=require(_0x9892('0x15'));var db=require(_0x9892('0x16'))['db'];config[_0x9892('0x17')]=_[_0x9892('0x18')](config[_0x9892('0x17')],{'host':_0x9892('0x19'),'port':0x18eb});var socket=require(_0x9892('0x1a'))(new Redis(config[_0x9892('0x17')]));require('./smsAccount.socket')[_0x9892('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9892('0x1c')][_0x9892('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x16a9ea,_0x59a3a2,_0x557c38,_0x2cb8f1){return new BPromise(function(_0x2c3fab,_0x179815){var _0x705f12=_0x2cb8f1||client;return _0x705f12[_0x9892('0x1e')](_0x16a9ea,_0x557c38)[_0x9892('0x1f')](function(_0x254530){logger[_0x9892('0x20')]('SmsAccount,\x20%s,\x20%s',_0x59a3a2,_0x9892('0x21'));logger[_0x9892('0x22')](_0x9892('0x23'),_0x59a3a2,_0x9892('0x21'),JSON['stringify'](_0x254530));if(_0x254530[_0x9892('0x24')]){if(_0x254530[_0x9892('0x24')][_0x9892('0x25')]===0x1f4){logger[_0x9892('0x24')](_0x9892('0x26'),_0x59a3a2,_0x254530[_0x9892('0x24')]['message']);return _0x179815(_0x254530[_0x9892('0x24')][_0x9892('0x27')]);}logger[_0x9892('0x24')](_0x9892('0x26'),_0x59a3a2,_0x254530[_0x9892('0x24')][_0x9892('0x27')]);return _0x2c3fab(_0x254530['error']['message']);}else{logger[_0x9892('0x20')]('SmsAccount,\x20%s,\x20%s',_0x59a3a2,_0x9892('0x21'));_0x2c3fab(_0x254530[_0x9892('0x28')][_0x9892('0x27')]);}})[_0x9892('0x29')](function(_0x194878){logger['error'](_0x9892('0x26'),_0x59a3a2,_0x194878);_0x179815(_0x194878);});});}function respondWithStatusCode(_0x1f4b8d,_0x3444ff){_0x3444ff=_0x3444ff||0xcc;return function(_0x5a5671){if(_0x5a5671){return _0x1f4b8d[_0x9892('0x2a')](_0x3444ff);}return _0x1f4b8d[_0x9892('0x2b')](_0x3444ff)['end']();};}function respondWithResult(_0x31b5cd,_0x915b22){_0x915b22=_0x915b22||0xc8;return function(_0x58fc94){if(_0x58fc94){return _0x31b5cd[_0x9892('0x2b')](_0x915b22)[_0x9892('0x2c')](_0x58fc94);}};}function respondWithFilteredResult(_0x14211b,_0x4c0a0e){return function(_0x56c931){if(_0x56c931){var _0x5715a6=typeof _0x4c0a0e['offset']===_0x9892('0x2d')&&typeof _0x4c0a0e[_0x9892('0x2e')]===_0x9892('0x2d');var _0x2d2354=_0x56c931['count'];var _0x949911=_0x5715a6?0x0:_0x4c0a0e[_0x9892('0x2f')];var _0x42a004=_0x5715a6?_0x56c931[_0x9892('0x30')]:_0x4c0a0e['offset']+_0x4c0a0e[_0x9892('0x2e')];var _0x2da7f6;if(_0x42a004>=_0x2d2354){_0x42a004=_0x2d2354;_0x2da7f6=0xc8;}else{_0x2da7f6=0xce;}_0x14211b[_0x9892('0x2b')](_0x2da7f6);return _0x14211b[_0x9892('0x31')](_0x9892('0x32'),_0x949911+'-'+_0x42a004+'/'+_0x2d2354)['json'](_0x56c931);}return null;};}function patchUpdates(_0xcda26){return function(_0x271ec3){try{jsonpatch[_0x9892('0x33')](_0x271ec3,_0xcda26,!![]);}catch(_0x3e22d9){return BPromise[_0x9892('0x34')](_0x3e22d9);}return _0x271ec3[_0x9892('0x35')]();};}function saveUpdates(_0x3ddb29,_0x447f0c){return function(_0x50cb26){if(_0x50cb26){return _0x50cb26['update'](_0x3ddb29)['then'](function(_0x240873){return _0x240873;});}return null;};}function removeEntity(_0x44623c,_0x53a6d2){return function(_0x536e74){if(_0x536e74){return _0x536e74[_0x9892('0x36')]()['then'](function(){var _0x3cd599=_0x536e74['get']({'plain':!![]});var _0x50c525=_0x9892('0x37');return db['UserProfileResource'][_0x9892('0x36')]({'where':{'type':_0x50c525,'resourceId':_0x3cd599['id']}})['then'](function(){return _0x536e74;});})[_0x9892('0x1f')](function(){_0x44623c['status'](0xcc)[_0x9892('0x38')]();});}};}function handleEntityNotFound(_0x31bef1,_0x1176cb){return function(_0x3cc013){if(!_0x3cc013){_0x31bef1[_0x9892('0x2a')](0x194);}return _0x3cc013;};}function handleError(_0x3ccaf6,_0x3f80c6){_0x3f80c6=_0x3f80c6||0x1f4;return function(_0x3ad45d){logger['error'](_0x3ad45d[_0x9892('0x39')]);if(_0x3ad45d['name']){delete _0x3ad45d[_0x9892('0x3a')];}_0x3ccaf6['status'](_0x3f80c6)[_0x9892('0x3b')](_0x3ad45d);};}exports[_0x9892('0x3c')]=function(_0x466f34,_0x8e48e2){var _0x39db81={'include':[{'model':db[_0x9892('0x3d')],'as':_0x9892('0x3e')}]},_0x5b37b5={},_0x811b3a={'count':0x0,'rows':[]};var _0x16dc3f=_[_0x9892('0x3f')](db[_0x9892('0x40')][_0x9892('0x41')],function(_0x4a1315){return{'name':_0x4a1315[_0x9892('0x42')],'type':_0x4a1315[_0x9892('0x43')][_0x9892('0x44')]};});_0x5b37b5[_0x9892('0x45')]=_[_0x9892('0x3f')](_0x16dc3f,_0x9892('0x3a'));_0x5b37b5[_0x9892('0x46')]=_[_0x9892('0x47')](_0x466f34[_0x9892('0x46')]);_0x5b37b5['filters']=_[_0x9892('0x48')](_0x5b37b5[_0x9892('0x45')],_0x5b37b5['query']);_0x39db81[_0x9892('0x49')]=_[_0x9892('0x48')](_0x5b37b5[_0x9892('0x45')],qs[_0x9892('0x4a')](_0x466f34[_0x9892('0x46')][_0x9892('0x4a')]));_0x39db81[_0x9892('0x49')]=_0x39db81['attributes']['length']?_0x39db81['attributes']:_0x5b37b5[_0x9892('0x45')];if(!_0x466f34[_0x9892('0x46')][_0x9892('0x4b')](_0x9892('0x4c'))){_0x39db81[_0x9892('0x2e')]=qs[_0x9892('0x2e')](_0x466f34['query'][_0x9892('0x2e')]);_0x39db81[_0x9892('0x2f')]=qs['offset'](_0x466f34['query'][_0x9892('0x2f')]);}_0x39db81[_0x9892('0x4d')]=qs[_0x9892('0x4e')](_0x466f34['query'][_0x9892('0x4e')]);_0x39db81['where']=qs[_0x9892('0x4f')](_[_0x9892('0x50')](_0x466f34[_0x9892('0x46')],_0x5b37b5[_0x9892('0x4f')]),_0x16dc3f);if(_0x466f34[_0x9892('0x46')]['filter']){_0x39db81[_0x9892('0x51')]=_[_0x9892('0x52')](_0x39db81[_0x9892('0x51')],{'$or':_[_0x9892('0x3f')](_0x16dc3f,function(_0x4b617f){if(_0x4b617f[_0x9892('0x43')]!==_0x9892('0x53')){var _0x1e368e={};_0x1e368e[_0x4b617f['name']]={'$like':'%'+_0x466f34[_0x9892('0x46')][_0x9892('0x54')]+'%'};return _0x1e368e;}})});}_0x39db81=_['merge']({},_0x39db81,_0x466f34['options']);var _0x592c62={'where':_0x39db81[_0x9892('0x51')]};return db[_0x9892('0x40')][_0x9892('0x30')](_0x592c62)[_0x9892('0x1f')](function(_0x52aede){_0x811b3a[_0x9892('0x30')]=_0x52aede;if(_0x466f34['query'][_0x9892('0x55')]){_0x39db81['include']=[{'all':!![]}];}return db[_0x9892('0x40')][_0x9892('0x56')](_0x39db81);})[_0x9892('0x1f')](function(_0x2b1c99){_0x811b3a[_0x9892('0x57')]=_0x2b1c99;return _0x811b3a;})[_0x9892('0x1f')](respondWithFilteredResult(_0x8e48e2,_0x39db81))[_0x9892('0x29')](handleError(_0x8e48e2,null));};exports[_0x9892('0x58')]=function(_0x421907,_0x91085){var _0x3812bb={'raw':![],'where':{'id':_0x421907[_0x9892('0x59')]['id']},'include':[{'model':db[_0x9892('0x3d')],'as':'mandatoryDispositionPause'}]},_0x203e79={};_0x203e79[_0x9892('0x45')]=_[_0x9892('0x47')](db[_0x9892('0x40')][_0x9892('0x41')]);_0x203e79[_0x9892('0x46')]=_[_0x9892('0x47')](_0x421907[_0x9892('0x46')]);_0x203e79[_0x9892('0x4f')]=_[_0x9892('0x48')](_0x203e79[_0x9892('0x45')],_0x203e79[_0x9892('0x46')]);_0x3812bb[_0x9892('0x49')]=_[_0x9892('0x48')](_0x203e79[_0x9892('0x45')],qs['fields'](_0x421907[_0x9892('0x46')][_0x9892('0x4a')]));_0x3812bb[_0x9892('0x49')]=_0x3812bb[_0x9892('0x49')]['length']?_0x3812bb[_0x9892('0x49')]:_0x203e79[_0x9892('0x45')];if(_0x421907[_0x9892('0x46')][_0x9892('0x55')]){_0x3812bb[_0x9892('0x5a')]=[{'all':!![]}];}_0x3812bb=_[_0x9892('0x52')]({},_0x3812bb,_0x421907[_0x9892('0x5b')]);return db[_0x9892('0x40')][_0x9892('0x5c')](_0x3812bb)['then'](handleEntityNotFound(_0x91085,null))['then'](respondWithResult(_0x91085,null))['catch'](handleError(_0x91085,null));};exports[_0x9892('0x5d')]=function(_0xc54c03,_0x5ee072){return db[_0x9892('0x40')][_0x9892('0x5d')](_0xc54c03[_0x9892('0x5e')],{})['then'](function(_0x1deae1){var _0x2c16a0=_0xc54c03[_0x9892('0x5f')][_0x9892('0x60')]({'plain':!![]});if(!_0x2c16a0)throw new Error(_0x9892('0x61'));if(_0x2c16a0[_0x9892('0x62')]===_0x9892('0x5f')){var _0x2c1761=_0x1deae1['get']({'plain':!![]});var _0x3921b3=_0x9892('0x37');return db[_0x9892('0x63')][_0x9892('0x5c')]({'where':{'name':_0x3921b3,'userProfileId':_0x2c16a0[_0x9892('0x64')]},'raw':!![]})['then'](function(_0xfb93b7){if(_0xfb93b7&&_0xfb93b7[_0x9892('0x65')]===0x0){return db[_0x9892('0x66')]['create']({'name':_0x2c1761[_0x9892('0x3a')],'resourceId':_0x2c1761['id'],'type':_0xfb93b7[_0x9892('0x3a')],'sectionId':_0xfb93b7['id']},{})['then'](function(){return _0x1deae1;});}else{return _0x1deae1;}})[_0x9892('0x29')](function(_0x3aff9b){logger[_0x9892('0x24')](_0x9892('0x67'),_0x3aff9b);throw _0x3aff9b;});}return _0x1deae1;})['then'](respondWithResult(_0x5ee072,0xc9))[_0x9892('0x29')](handleError(_0x5ee072,null));};exports['update']=function(_0x3ce47e,_0xcd3ea){if(_0x3ce47e[_0x9892('0x5e')]['id']){delete _0x3ce47e[_0x9892('0x5e')]['id'];}return db[_0x9892('0x40')]['find']({'where':{'id':_0x3ce47e[_0x9892('0x59')]['id']},'include':[{'model':db[_0x9892('0x3d')],'as':'mandatoryDispositionPause'}]})[_0x9892('0x1f')](handleEntityNotFound(_0xcd3ea,null))[_0x9892('0x1f')](saveUpdates(_0x3ce47e[_0x9892('0x5e')],null))[_0x9892('0x1f')](respondWithResult(_0xcd3ea,null))['catch'](handleError(_0xcd3ea,null));};exports['destroy']=function(_0x50bfaf,_0x3ee9a1){return db[_0x9892('0x40')][_0x9892('0x5c')]({'where':{'id':_0x50bfaf[_0x9892('0x59')]['id']}})['then'](handleEntityNotFound(_0x3ee9a1,null))[_0x9892('0x1f')](removeEntity(_0x3ee9a1,null))['catch'](handleError(_0x3ee9a1,null));};exports[_0x9892('0x68')]=function(_0x5c0456,_0x4a871c){return db[_0x9892('0x40')][_0x9892('0x68')]()[_0x9892('0x1f')](respondWithResult(_0x4a871c,null))['catch'](handleError(_0x4a871c,null));};exports['addDisposition']=function(_0x98fada,_0x19297c,_0x437ef5){if(_0x98fada[_0x9892('0x5e')]['id']){delete _0x98fada[_0x9892('0x5e')]['id'];}return db[_0x9892('0x40')][_0x9892('0x5c')]({'where':{'id':_0x98fada[_0x9892('0x59')]['id']}})['then'](handleEntityNotFound(_0x19297c,null))[_0x9892('0x1f')](function(_0x18fce8){if(_0x18fce8){_0x98fada[_0x9892('0x5e')][_0x9892('0x69')]=_0x18fce8['id'];return db[_0x9892('0x6a')][_0x9892('0x5d')](_0x98fada['body']);}})['then'](respondWithResult(_0x19297c,null))['catch'](handleError(_0x19297c,null));};exports[_0x9892('0x6b')]=function(_0x157ac6,_0x12d35a,_0x11a01f){var _0x10129a={'raw':![],'where':{}};var _0x3297f6={};var _0x9ed858={'count':0x0,'rows':[]};return db[_0x9892('0x40')][_0x9892('0x6c')]({'where':{'id':_0x157ac6[_0x9892('0x59')]['id']}})[_0x9892('0x1f')](handleEntityNotFound(_0x12d35a,null))[_0x9892('0x1f')](function(_0x238365){if(_0x238365){_0x3297f6[_0x9892('0x45')]=_[_0x9892('0x47')](db[_0x9892('0x6a')]['rawAttributes']);_0x3297f6[_0x9892('0x46')]=_[_0x9892('0x47')](_0x157ac6[_0x9892('0x46')]);_0x3297f6[_0x9892('0x4f')]=_['intersection'](_0x3297f6[_0x9892('0x45')],_0x3297f6[_0x9892('0x46')]);_0x10129a[_0x9892('0x49')]=_[_0x9892('0x48')](_0x3297f6[_0x9892('0x45')],qs[_0x9892('0x4a')](_0x157ac6[_0x9892('0x46')]['fields']));_0x10129a[_0x9892('0x49')]=_0x10129a['attributes']['length']?_0x10129a[_0x9892('0x49')]:_0x3297f6[_0x9892('0x45')];if(!_0x157ac6[_0x9892('0x46')][_0x9892('0x4b')]('nolimit')){_0x10129a[_0x9892('0x2e')]=qs[_0x9892('0x2e')](_0x157ac6[_0x9892('0x46')][_0x9892('0x2e')]);_0x10129a[_0x9892('0x2f')]=qs[_0x9892('0x2f')](_0x157ac6['query']['offset']);}_0x10129a[_0x9892('0x4d')]=qs[_0x9892('0x4e')](_0x157ac6['query'][_0x9892('0x4e')]);_0x10129a[_0x9892('0x51')]=qs[_0x9892('0x4f')](_[_0x9892('0x50')](_0x157ac6[_0x9892('0x46')],_0x3297f6[_0x9892('0x4f')]));_0x10129a[_0x9892('0x51')]['SmsAccountId']=_0x238365['id'];if(_0x157ac6['query'][_0x9892('0x54')]){_0x10129a[_0x9892('0x51')]=_[_0x9892('0x52')](_0x10129a[_0x9892('0x51')],{'$or':_[_0x9892('0x3f')](_0x10129a['attributes'],function(_0x46534d){var _0x322eb8={};_0x322eb8[_0x46534d]={'$like':'%'+_0x157ac6['query'][_0x9892('0x54')]+'%'};return _0x322eb8;})});}_0x10129a=_[_0x9892('0x52')]({},_0x10129a,_0x157ac6[_0x9892('0x5b')]);return db[_0x9892('0x6a')]['count']({'where':_0x10129a[_0x9892('0x51')]})['then'](function(_0x1e996d){_0x9ed858[_0x9892('0x30')]=_0x1e996d;if(_0x157ac6[_0x9892('0x46')][_0x9892('0x55')]){_0x10129a['include']=[{'all':!![]}];}return db['Disposition'][_0x9892('0x56')](_0x10129a);})[_0x9892('0x1f')](function(_0x44b8bc){_0x9ed858[_0x9892('0x57')]=_0x44b8bc;return _0x9ed858;});}})[_0x9892('0x1f')](respondWithFilteredResult(_0x12d35a,_0x10129a))[_0x9892('0x29')](handleError(_0x12d35a,null));};exports[_0x9892('0x6d')]=function(_0x7164a,_0x1bcfa1,_0x338d4c){return db[_0x9892('0x40')][_0x9892('0x5c')]({'where':{'id':_0x7164a['params']['id']}})[_0x9892('0x1f')](handleEntityNotFound(_0x1bcfa1,null))[_0x9892('0x1f')](function(_0x4362b2){if(_0x4362b2){return _0x4362b2[_0x9892('0x6d')](_0x7164a[_0x9892('0x46')][_0x9892('0x6e')]);}})[_0x9892('0x1f')](respondWithStatusCode(_0x1bcfa1,null))[_0x9892('0x29')](handleError(_0x1bcfa1,null));};exports['addAnswer']=function(_0x52eef1,_0x1a4405,_0x2a26cc){if(_0x52eef1[_0x9892('0x5e')]['id']){delete _0x52eef1[_0x9892('0x5e')]['id'];}return db[_0x9892('0x40')]['find']({'where':{'id':_0x52eef1[_0x9892('0x59')]['id']}})['then'](handleEntityNotFound(_0x1a4405,null))[_0x9892('0x1f')](function(_0x5a5c8a){if(_0x5a5c8a){_0x52eef1[_0x9892('0x5e')][_0x9892('0x69')]=_0x5a5c8a['id'];return db[_0x9892('0x6f')][_0x9892('0x5d')](_0x52eef1[_0x9892('0x5e')]);}})[_0x9892('0x1f')](respondWithResult(_0x1a4405,null))[_0x9892('0x29')](handleError(_0x1a4405,null));};exports[_0x9892('0x70')]=function(_0x43455e,_0x3d2e99,_0x6c03a3){var _0x486813={'raw':![],'where':{}};var _0x559675={};var _0x43f443={'count':0x0,'rows':[]};return db['SmsAccount'][_0x9892('0x6c')]({'where':{'id':_0x43455e[_0x9892('0x59')]['id']}})[_0x9892('0x1f')](handleEntityNotFound(_0x3d2e99,null))['then'](function(_0xaa8576){if(_0xaa8576){_0x559675['model']=_[_0x9892('0x47')](db[_0x9892('0x6f')][_0x9892('0x41')]);_0x559675[_0x9892('0x46')]=_[_0x9892('0x47')](_0x43455e['query']);_0x559675[_0x9892('0x4f')]=_['intersection'](_0x559675[_0x9892('0x45')],_0x559675[_0x9892('0x46')]);_0x486813[_0x9892('0x49')]=_[_0x9892('0x48')](_0x559675[_0x9892('0x45')],qs[_0x9892('0x4a')](_0x43455e['query']['fields']));_0x486813[_0x9892('0x49')]=_0x486813[_0x9892('0x49')][_0x9892('0x71')]?_0x486813[_0x9892('0x49')]:_0x559675[_0x9892('0x45')];if(!_0x43455e[_0x9892('0x46')][_0x9892('0x4b')](_0x9892('0x4c'))){_0x486813[_0x9892('0x2e')]=qs[_0x9892('0x2e')](_0x43455e[_0x9892('0x46')][_0x9892('0x2e')]);_0x486813[_0x9892('0x2f')]=qs[_0x9892('0x2f')](_0x43455e[_0x9892('0x46')][_0x9892('0x2f')]);}_0x486813[_0x9892('0x4d')]=qs[_0x9892('0x4e')](_0x43455e[_0x9892('0x46')][_0x9892('0x4e')]);_0x486813[_0x9892('0x51')]=qs[_0x9892('0x4f')](_[_0x9892('0x50')](_0x43455e[_0x9892('0x46')],_0x559675[_0x9892('0x4f')]));_0x486813[_0x9892('0x51')][_0x9892('0x69')]=_0xaa8576['id'];if(_0x43455e[_0x9892('0x46')]['filter']){_0x486813[_0x9892('0x51')]=_[_0x9892('0x52')](_0x486813[_0x9892('0x51')],{'$or':_[_0x9892('0x3f')](_0x486813[_0x9892('0x49')],function(_0x4c27a9){var _0x252fe0={};_0x252fe0[_0x4c27a9]={'$like':'%'+_0x43455e[_0x9892('0x46')][_0x9892('0x54')]+'%'};return _0x252fe0;})});}_0x486813=_['merge']({},_0x486813,_0x43455e[_0x9892('0x5b')]);return db['CannedAnswer'][_0x9892('0x30')]({'where':_0x486813['where']})[_0x9892('0x1f')](function(_0x3905fe){_0x43f443[_0x9892('0x30')]=_0x3905fe;if(_0x43455e[_0x9892('0x46')][_0x9892('0x55')]){_0x486813[_0x9892('0x5a')]=[{'all':!![]}];}return db[_0x9892('0x6f')]['findAll'](_0x486813);})[_0x9892('0x1f')](function(_0x3243a5){_0x43f443['rows']=_0x3243a5;return _0x43f443;});}})[_0x9892('0x1f')](respondWithFilteredResult(_0x3d2e99,_0x486813))[_0x9892('0x29')](handleError(_0x3d2e99,null));};exports[_0x9892('0x72')]=function(_0x290c65,_0x5c7043,_0x258415){return db[_0x9892('0x40')]['find']({'where':{'id':_0x290c65[_0x9892('0x59')]['id']}})[_0x9892('0x1f')](handleEntityNotFound(_0x5c7043,null))[_0x9892('0x1f')](function(_0x1e4f2b){if(_0x1e4f2b){return _0x1e4f2b['removeAnswers'](_0x290c65[_0x9892('0x46')]['ids']);}})[_0x9892('0x1f')](respondWithStatusCode(_0x5c7043,null))[_0x9892('0x29')](handleError(_0x5c7043,null));};exports[_0x9892('0x73')]=function(_0x2a4865,_0x23dfce,_0x4a3b53){var _0x21547f={'channel':_0x9892('0x74')};var _0x23d9c6=[];var _0x5702cc=[];var _0x67617a={};return db['SmsAccount']['find']({'where':{'id':_0x2a4865[_0x9892('0x59')]['id']},'include':[{'model':db[_0x9892('0x75')],'as':_0x9892('0x76')}]})[_0x9892('0x1f')](handleEntityNotFound(_0x23dfce,null))['then'](function(_0x1a2b0c){_0x21547f[_0x9892('0x77')]=_0x1a2b0c;_0x21547f[_0x9892('0x78')]=_[_0x9892('0x79')](_0x1a2b0c[_0x9892('0x76')],['priority'],['asc']);if(_0x21547f[_0x9892('0x77')][_0x9892('0x76')]){delete _0x21547f[_0x9892('0x77')][_0x9892('0x76')];}return db['CmContact'][_0x9892('0x68')]();})['then'](function(_0x35a7bf){if(!_0x35a7bf){throw new db[(_0x9892('0x7a'))][(_0x9892('0x7b'))](_0x9892('0x7c'));}_0x23d9c6=_[_0x9892('0x7d')](_['keys'](_0x35a7bf),[_0x9892('0x7e'),'updatedAt']);_0x5702cc=_[_0x9892('0x7d')](_[_0x9892('0x47')](_0x35a7bf),[_0x9892('0x7e'),_0x9892('0x7f'),_0x9892('0x80'),'ListId']);_0x21547f['body']={'mapKey':_0x9892('0x81')};if(_0x21547f[_0x9892('0x77')][_0x9892('0x43')]){switch(_0x21547f[_0x9892('0x77')]['type']){case _0x9892('0x82'):_0x21547f[_0x9892('0x5e')][_0x9892('0x83')]=_0x2a4865['body']['From'];_0x21547f[_0x9892('0x5e')][_0x9892('0x5e')]=_0x2a4865[_0x9892('0x5e')][_0x9892('0x84')];_0x21547f[_0x9892('0x5e')][_0x9892('0x85')]=_0x2a4865['body'][_0x9892('0x86')];break;case'skebby':_0x21547f[_0x9892('0x5e')][_0x9892('0x83')]='+'+_0x2a4865[_0x9892('0x5e')]['sender'];_0x21547f[_0x9892('0x5e')][_0x9892('0x5e')]=_0x2a4865[_0x9892('0x5e')][_0x9892('0x87')];break;case _0x9892('0x88'):_0x21547f[_0x9892('0x5e')][_0x9892('0x83')]=_0x2a4865['body']['from'];_0x21547f[_0x9892('0x5e')][_0x9892('0x5e')]=_0x2a4865[_0x9892('0x5e')]['message'];break;case'clicksend':_0x21547f[_0x9892('0x5e')][_0x9892('0x83')]=_0x2a4865[_0x9892('0x5e')][_0x9892('0x83')];_0x21547f[_0x9892('0x5e')][_0x9892('0x5e')]=_0x2a4865['body'][_0x9892('0x5e')];_0x21547f[_0x9892('0x5e')]['messageId']=_0x2a4865[_0x9892('0x5e')][_0x9892('0x89')];break;case _0x9892('0x8a'):_0x21547f[_0x9892('0x5e')][_0x9892('0x83')]=_0x2a4865[_0x9892('0x5e')][_0x9892('0x8b')];_0x21547f[_0x9892('0x5e')][_0x9892('0x5e')]=_0x2a4865[_0x9892('0x5e')][_0x9892('0x8c')];_0x21547f[_0x9892('0x5e')][_0x9892('0x85')]=_0x2a4865[_0x9892('0x5e')]['MessageUUID'];break;case _0x9892('0x8d'):_0x21547f[_0x9892('0x5e')][_0x9892('0x83')]='+'+_0x2a4865['body'][_0x9892('0x8e')][0x0][_0x9892('0x83')];_0x21547f[_0x9892('0x5e')][_0x9892('0x5e')]=_0x2a4865[_0x9892('0x5e')]['results'][0x0]['text'];_0x21547f[_0x9892('0x5e')][_0x9892('0x85')]=_0x2a4865[_0x9892('0x5e')][_0x9892('0x8e')][0x0][_0x9892('0x85')];break;case _0x9892('0x8f'):_0x21547f[_0x9892('0x5e')]['from']=_0x2a4865['body']['originatingAddress'];_0x21547f['body'][_0x9892('0x5e')]=_0x2a4865[_0x9892('0x5e')]['segmentedMessage'][_0x9892('0x27')];break;case'clickatell':_0x21547f[_0x9892('0x5e')][_0x9892('0x83')]=_0x2a4865[_0x9892('0x5e')][_0x9892('0x90')];_0x21547f['body'][_0x9892('0x5e')]=_0x2a4865['body'][_0x9892('0x87')];_0x21547f[_0x9892('0x5e')][_0x9892('0x85')]=_0x2a4865[_0x9892('0x5e')][_0x9892('0x91')];break;case _0x9892('0x92'):_0x21547f['body']['messageId']=_0x2a4865[_0x9892('0x5e')][0x0]['message']['id'];_0x21547f[_0x9892('0x5e')][_0x9892('0x83')]=_0x2a4865[_0x9892('0x5e')][0x0][_0x9892('0x27')]['from'];_0x21547f['body'][_0x9892('0x5e')]=_0x2a4865['body'][0x0][_0x9892('0x27')][_0x9892('0x87')];break;case'intelepeer':_0x21547f['body'][_0x9892('0x83')]=_0x2a4865[_0x9892('0x5e')][_0x9892('0x83')];_0x21547f['body'][_0x9892('0x5e')]=_0x2a4865['body'][_0x9892('0x27')];_0x21547f[_0x9892('0x5e')][_0x9892('0x85')]=_0x2a4865[_0x9892('0x5e')]['refid'];break;}}if(_0x21547f[_0x9892('0x5e')]['id']){delete _0x21547f['body']['id'];}if(_[_0x9892('0x93')](_0x21547f[_0x9892('0x5e')]['from'])){throw new db['Sequelize']['ValidationError'](_0x9892('0x94'));}if(_[_0x9892('0x93')](_0x21547f['body'][_0x9892('0x5e')])||_0x21547f[_0x9892('0x5e')]['body']===''){throw new db[(_0x9892('0x7a'))][(_0x9892('0x7b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x9892('0x93')](_0x21547f[_0x9892('0x5e')][_0x9892('0x95')])){throw new db['Sequelize'][(_0x9892('0x7b'))](_0x9892('0x96')+_0x5702cc);}if(!_[_0x9892('0x97')](_0x5702cc,_0x21547f['body'][_0x9892('0x95')])){throw new db[(_0x9892('0x7a'))][(_0x9892('0x7b'))](_0x9892('0x98')+_0x5702cc);}_0x67617a[_0x21547f[_0x9892('0x5e')][_0x9892('0x95')]]=_0x21547f[_0x9892('0x5e')]['from'];return db[_0x9892('0x99')][_0x9892('0x5c')]({'where':{'id':_0x21547f[_0x9892('0x77')][_0x9892('0x9a')]},'include':[{'model':db['CmContact'],'as':_0x9892('0x9b'),'where':_0x67617a,'limit':0x1,'order':[[_0x9892('0x7f'),'DESC']]}]});})[_0x9892('0x1f')](handleEntityNotFound(_0x23dfce,null))[_0x9892('0x1f')](function(_0x583271){if(_0x583271){_0x21547f[_0x9892('0x9c')]=_['omit'](_0x583271,[_0x9892('0x9b')]);if(_0x583271['Contacts'][_0x9892('0x71')]){return _0x583271[_0x9892('0x9b')][0x0];}var _0x47620b=_[_0x9892('0x18')](_0x21547f[_0x9892('0x5e')],{'firstName':_0x21547f[_0x9892('0x5e')]['from'],'ListId':_0x583271['id']});_0x47620b[_0x21547f[_0x9892('0x5e')]['mapKey']]=_0x21547f[_0x9892('0x5e')][_0x9892('0x83')];return db[_0x9892('0x9d')][_0x9892('0x5d')](_0x47620b,{'fields':_0x23d9c6,'raw':!![]});}})[_0x9892('0x1f')](handleEntityNotFound(_0x23dfce,null))[_0x9892('0x1f')](function(_0x4e77ca){if(_0x4e77ca){_0x21547f[_0x9892('0x9e')]=_0x4e77ca;var _0x3b9305={'ContactId':_0x4e77ca['id'],'phone':_0x21547f[_0x9892('0x5e')]['from'],'SmsAccountId':_0x2a4865[_0x9892('0x59')]['id']};var _0x441225={'ContactId':_0x4e77ca['id'],'SmsAccountId':_0x2a4865[_0x9892('0x59')]['id'],'closed':![]};return db[_0x9892('0x9f')][_0x9892('0x5c')]({'where':_0x441225})[_0x9892('0x1f')](function(_0x3aebe4){if(_0x3aebe4){return[_0x3aebe4,![]];}return db[_0x9892('0x9f')][_0x9892('0x5d')](_0x3b9305)[_0x9892('0x1f')](function(_0x49bc8e){return[_0x49bc8e,!![]];});});}})[_0x9892('0xa0')](function(_0x438cdc,_0x189f69){_0x21547f[_0x9892('0xa1')]=_0x438cdc[_0x9892('0x60')]({'plain':!![]});_0x21547f[_0x9892('0xa1')][_0x9892('0xa2')]=![];if(_0x189f69){if(_0x21547f[_0x9892('0x77')]['autoclose']){_0x21547f[_0x9892('0x78')]['push']({'id':0x0,'priority':_0x21547f[_0x9892('0x78')][_0x9892('0x71')]+0x1,'app':_0x9892('0xa3'),'appdata':_0x9892('0xa4'),'interval':_0x9892('0xa5')});}_0x21547f[_0x9892('0xa1')][_0x9892('0xa2')]=!![];}return db[_0x9892('0xa6')]['create']({'phone':_0x21547f[_0x9892('0x5e')][_0x9892('0x83')],'messageId':_0x21547f[_0x9892('0x5e')][_0x9892('0x85')],'body':_0x21547f['body'][_0x9892('0x5e')],'SmsAccountId':_0x2a4865[_0x9892('0x59')]['id'],'SmsInteractionId':_0x438cdc['id'],'direction':'in','ContactId':_0x438cdc['ContactId'],'AttachmentId':_0x21547f[_0x9892('0x5e')][_0x9892('0xa7')]});})[_0x9892('0x1f')](function(_0x1e4489){_0x21547f['message']=_0x1e4489;if(_0x21547f[_0x9892('0xa1')][_0x9892('0xa8')]){return db[_0x9892('0xa9')][_0x9892('0x5c')]({'attributes':['id','name'],'where':{'id':_0x21547f[_0x9892('0xa1')][_0x9892('0xa8')]}})['then'](function(_0x5b8468){if(_0x5b8468){_0x21547f[_0x9892('0x78')][_0x9892('0xaa')]({'id':0x0,'priority':0x0,'app':_0x9892('0xab'),'appdata':_0x5b8468[_0x9892('0x3a')]+','+(_0x21547f[_0x9892('0x77')]['waitForTheAssignedAgent']||0xa),'interval':_0x9892('0xa5')});}return respondWithRpcPromise('Start',_0x9892('0xac'),_0x21547f);});}return respondWithRpcPromise('Start','startRouting',_0x21547f);})[_0x9892('0x1f')](function(_0x3bfab2){if(_0x3bfab2){var _0x3e879f=0xc8;var _0x3919c3=_0x9892('0xad');logger[_0x9892('0x20')](_0x9892('0x23'),_0x3919c3,_0x3e879f,_0x9892('0xae'));logger[_0x9892('0x22')](_0x9892('0xaf'),_0x3919c3,_0x3e879f,_0x9892('0xae'),JSON[_0x9892('0xb0')](_0x3bfab2));if(_0x21547f[_0x9892('0x77')]['type']===_0x9892('0x82')){return _0x23dfce[_0x9892('0x2b')](_0x3e879f)[_0x9892('0x31')](_0x9892('0xb1'),'text/xml')['send']('\x0a');}else{return _0x23dfce[_0x9892('0x2b')](_0x3e879f)['json'](_0x3bfab2);}}})[_0x9892('0x29')](handleError(_0x23dfce,null));};exports['addApplications']=function(_0x1a2895,_0x145efe,_0x511145){return db[_0x9892('0x40')]['findOne']({'where':{'id':_0x1a2895[_0x9892('0x59')]['id']}})[_0x9892('0x1f')](handleEntityNotFound(_0x145efe,null))['then'](function(_0x15c1d1){if(_0x15c1d1){return db[_0x9892('0xb2')][_0x9892('0xb3')](function(_0x46226f){return db[_0x9892('0x75')][_0x9892('0x36')]({'where':{'SmsAccountId':_0x1a2895[_0x9892('0x59')]['id']},'transaction':_0x46226f})[_0x9892('0x1f')](function(_0x18bdb3){var _0x3b96fe=_['map'](_0x1a2895[_0x9892('0x5e')],function(_0x46b920){_0x46b920[_0x9892('0x69')]=_0x1a2895[_0x9892('0x59')]['id'];return _0x46b920;});return db[_0x9892('0x75')]['bulkCreate'](_0x3b96fe,{'transaction':_0x46226f});});})['then'](function(){return db[_0x9892('0x75')][_0x9892('0xb4')]({'where':{'SmsAccountId':_0x1a2895[_0x9892('0x59')]['id']},'order':_0x9892('0xb5')});});}})['then'](respondWithResult(_0x145efe,null))[_0x9892('0x29')](handleError(_0x145efe,null));};exports['getApplications']=function(_0x2876b6,_0x1074b9,_0x500bf2){var _0x2dfcb3={};var _0x4d1e5f={};var _0x547780;var _0x36208b;return db['SmsAccount'][_0x9892('0x6c')]({'where':{'id':_0x2876b6[_0x9892('0x59')]['id']}})[_0x9892('0x1f')](handleEntityNotFound(_0x1074b9,null))[_0x9892('0x1f')](function(_0x3c9a7a){if(_0x3c9a7a){_0x547780=_0x3c9a7a;_0x4d1e5f[_0x9892('0x45')]=_[_0x9892('0x47')](db[_0x9892('0x75')]['rawAttributes']);_0x4d1e5f[_0x9892('0x46')]=_['keys'](_0x2876b6['query']);_0x4d1e5f[_0x9892('0x4f')]=_[_0x9892('0x48')](_0x4d1e5f[_0x9892('0x45')],_0x4d1e5f['query']);_0x2dfcb3['attributes']=_[_0x9892('0x48')](_0x4d1e5f[_0x9892('0x45')],qs[_0x9892('0x4a')](_0x2876b6['query'][_0x9892('0x4a')]));_0x2dfcb3['attributes']=_0x2dfcb3[_0x9892('0x49')][_0x9892('0x71')]?_0x2dfcb3[_0x9892('0x49')]:_0x4d1e5f[_0x9892('0x45')];_0x2dfcb3['order']=qs[_0x9892('0x4e')](_0x2876b6[_0x9892('0x46')][_0x9892('0x4e')]);_0x2dfcb3[_0x9892('0x51')]=qs[_0x9892('0x4f')](_[_0x9892('0x50')](_0x2876b6['query'],_0x4d1e5f['filters']));if(_0x2876b6[_0x9892('0x46')][_0x9892('0x54')]){_0x2dfcb3[_0x9892('0x51')]=_['merge'](_0x2dfcb3[_0x9892('0x51')],{'$or':_[_0x9892('0x3f')](_0x2dfcb3[_0x9892('0x49')],function(_0x51bb7f){var _0x3874ee={};_0x3874ee[_0x51bb7f]={'$like':'%'+_0x2876b6['query'][_0x9892('0x54')]+'%'};return _0x3874ee;})});}_0x2dfcb3=_[_0x9892('0x52')]({},_0x2dfcb3,_0x2876b6[_0x9892('0x5b')]);return _0x547780[_0x9892('0xb6')](_0x2dfcb3);}})['then'](function(_0x53f9b6){if(_0x53f9b6){_0x36208b=_0x53f9b6[_0x9892('0x71')];if(!_0x2876b6[_0x9892('0x46')][_0x9892('0x4b')](_0x9892('0x4c'))){_0x2dfcb3[_0x9892('0x2e')]=qs[_0x9892('0x2e')](_0x2876b6[_0x9892('0x46')]['limit']);_0x2dfcb3[_0x9892('0x2f')]=qs[_0x9892('0x2f')](_0x2876b6[_0x9892('0x46')]['offset']);}return _0x547780['getApplications'](_0x2dfcb3);}})[_0x9892('0x1f')](function(_0x2b635a){if(_0x2b635a){return _0x2b635a?{'count':_0x36208b,'rows':_0x2b635a}:null;}})[_0x9892('0x1f')](respondWithResult(_0x1074b9,null))[_0x9892('0x29')](handleError(_0x1074b9,null));};exports[_0x9892('0xb7')]=function(_0x835607,_0x5f4471,_0x656d54){var _0x26bda5={'raw':![],'where':{}};var _0x30b8cb={};var _0x14e21b={'count':0x0,'rows':[]};return db[_0x9892('0x40')][_0x9892('0x6c')]({'where':{'id':_0x835607[_0x9892('0x59')]['id']}})['then'](handleEntityNotFound(_0x5f4471,null))[_0x9892('0x1f')](function(_0x1acd97){if(_0x1acd97){_0x30b8cb[_0x9892('0x45')]=_[_0x9892('0x47')](db['SmsInteraction']['rawAttributes']);_0x30b8cb['query']=_[_0x9892('0x47')](_0x835607[_0x9892('0x46')]);_0x30b8cb[_0x9892('0x4f')]=_['intersection'](_0x30b8cb[_0x9892('0x45')],_0x30b8cb[_0x9892('0x46')]);_0x26bda5[_0x9892('0x49')]=_[_0x9892('0x48')](_0x30b8cb['model'],qs[_0x9892('0x4a')](_0x835607['query'][_0x9892('0x4a')]));_0x26bda5[_0x9892('0x49')]=_0x26bda5[_0x9892('0x49')][_0x9892('0x71')]?_0x26bda5[_0x9892('0x49')]:_0x30b8cb[_0x9892('0x45')];if(!_0x835607['query']['hasOwnProperty'](_0x9892('0x4c'))){_0x26bda5['limit']=qs[_0x9892('0x2e')](_0x835607['query'][_0x9892('0x2e')]);_0x26bda5[_0x9892('0x2f')]=qs['offset'](_0x835607[_0x9892('0x46')]['offset']);}_0x26bda5[_0x9892('0x4d')]=qs[_0x9892('0x4e')](_0x835607['query'][_0x9892('0x4e')]);_0x26bda5[_0x9892('0x51')]=qs[_0x9892('0x4f')](_[_0x9892('0x50')](_0x835607[_0x9892('0x46')],_0x30b8cb['filters']));_0x26bda5[_0x9892('0x51')]['SmsAccountId']=_0x1acd97['id'];if(_0x835607['query'][_0x9892('0x54')]){_0x26bda5[_0x9892('0x51')]=_['merge'](_0x26bda5[_0x9892('0x51')],{'$or':_[_0x9892('0x3f')](_0x26bda5['attributes'],function(_0x1f0939){var _0x3cf4a4={};_0x3cf4a4[_0x1f0939]={'$like':'%'+_0x835607[_0x9892('0x46')][_0x9892('0x54')]+'%'};return _0x3cf4a4;})});}_0x26bda5=_[_0x9892('0x52')]({},_0x26bda5,_0x835607[_0x9892('0x5b')]);return db[_0x9892('0x9f')][_0x9892('0x30')]({'where':_0x26bda5['where']})[_0x9892('0x1f')](function(_0x2ff9d7){_0x14e21b[_0x9892('0x30')]=_0x2ff9d7;if(_0x835607[_0x9892('0x46')][_0x9892('0x55')]){_0x26bda5[_0x9892('0x5a')]=[{'model':db[_0x9892('0x9d')],'as':_0x9892('0xb8'),'required':![]},{'model':db[_0x9892('0xa9')],'as':_0x9892('0xb9'),'attributes':[_0x9892('0x3a'),_0x9892('0xba'),_0x9892('0xbb')],'required':![]},{'model':db['Tag'],'as':_0x9892('0xbc'),'attributes':['id',_0x9892('0x3a'),_0x9892('0xbd')],'where':_0x835607[_0x9892('0x46')][_0x9892('0xbe')]?{'id':_0x835607[_0x9892('0x46')][_0x9892('0xbe')]}:undefined,'required':_0x835607[_0x9892('0x46')]['tag']?!![]:![]}];}return db[_0x9892('0x9f')][_0x9892('0x56')](_0x26bda5);})[_0x9892('0x1f')](function(_0x43cdd7){_0x14e21b[_0x9892('0x57')]=_0x43cdd7;return _0x14e21b;});}})[_0x9892('0x1f')](respondWithFilteredResult(_0x5f4471,_0x26bda5))['catch'](handleError(_0x5f4471,null));};exports['send']=function(_0x353641,_0x48717b,_0x2a75a8){var _0x5357ed,_0x556ab5,_0xca9e68;if(_[_0x9892('0x93')](_0x353641[_0x9892('0x5e')][_0x9892('0x5e')])||_0x353641['body'][_0x9892('0x5e')]===''){throw new db[(_0x9892('0x7a'))][(_0x9892('0x7b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x353641[_0x9892('0x5e')]['to'])){throw new db[(_0x9892('0x7a'))][(_0x9892('0x7b'))]('to\x20is\x20mandatory');}_0x5357ed=_0x353641[_0x9892('0x5e')]['to'];return db[_0x9892('0x40')][_0x9892('0x5c')]({'where':{'id':_0x353641[_0x9892('0x59')]['id']},'include':[{'model':db[_0x9892('0x99')],'as':_0x9892('0xbf'),'include':[{'model':db[_0x9892('0x9d')],'as':'Contacts','where':{'mobile':_0x5357ed},'limit':0x1,'order':[[_0x9892('0x7f'),_0x9892('0xc0')]]}]}]})[_0x9892('0x1f')](handleEntityNotFound(_0x48717b,null))[_0x9892('0x1f')](function(_0x4cbd43){if(_0x4cbd43&&_0x4cbd43[_0x9892('0xbf')]){_0x556ab5=_0x4cbd43[_0x9892('0x60')]({'plain':!![]});if(_0x556ab5['List']&&_0x556ab5[_0x9892('0xbf')]['Contacts'][_0x9892('0x71')]){return _0x556ab5[_0x9892('0xbf')][_0x9892('0x9b')][0x0];}return db[_0x9892('0x9d')][_0x9892('0x5d')](_['defaults'](_0x353641[_0x9892('0x5e')],{'firstName':_0x5357ed,'mobile':_0x5357ed,'phone':_0x5357ed,'ListId':_0x556ab5['ListId']}));}})[_0x9892('0x1f')](handleEntityNotFound(_0x48717b,null))[_0x9892('0x1f')](function(_0x250ec6){if(_0x250ec6){_0xca9e68=_0x250ec6;return db[_0x9892('0x9f')][_0x9892('0x5c')]({'where':{'ContactId':_0xca9e68['id'],'closed':![],'SmsAccountId':_0x556ab5['id']}})[_0x9892('0x1f')](function(_0x2b9726){if(_0x2b9726){return[_0x2b9726,![]];}return db[_0x9892('0x9f')][_0x9892('0x5d')]({'UserId':_0x353641['user']['id'],'ContactId':_0xca9e68['id'],'SmsAccountId':_0x556ab5['id'],'phone':_0x5357ed,'firstMsgDirection':_0x9892('0xc1'),'Messages':[_['merge'](_0x353641['body'],{'read':![],'body':_0x353641['body'][_0x9892('0x5e')],'phone':_0x5357ed,'SmsAccountId':_0x556ab5['id'],'UserId':_0x353641[_0x9892('0x5f')]['id'],'ContactId':_0xca9e68['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x9892('0xc2')}]})[_0x9892('0x1f')](function(_0x79392f){return[_0x79392f,!![]];});});}})[_0x9892('0xa0')](function(_0x2d8376,_0x3d3444){if(_0x3d3444){return _0x2d8376;}return db[_0x9892('0xa6')][_0x9892('0x5d')](_[_0x9892('0x52')](_0x353641['body'],{'read':![],'body':_0x353641[_0x9892('0x5e')][_0x9892('0x5e')],'phone':_0x5357ed,'SmsAccountId':_0x556ab5['id'],'SmsInteractionId':_0x2d8376['id'],'UserId':_0x353641[_0x9892('0x5f')]['id'],'ContactId':_0xca9e68['id']}))[_0x9892('0x1f')](function(_0xc2b8e1){_0x2d8376[_0x9892('0xc3')][_0x9892('0xc2')]=[];_0x2d8376[_0x9892('0xc3')][_0x9892('0xc2')][_0x9892('0xc4')](_0xc2b8e1[_0x9892('0xc3')]);return _0x2d8376;});})['then'](respondWithResult(_0x48717b,null))[_0x9892('0x29')](handleError(_0x48717b,null));};exports[_0x9892('0x2b')]=function(_0x39b68c,_0x30ba59,_0x2c8119){if(_0x39b68c[_0x9892('0x5e')]['id']){delete _0x39b68c['body']['id'];}var _0x461407,_0x348996,_0x27413f;return db['SmsAccount']['find']({'where':{'id':_0x39b68c[_0x9892('0x59')]['id']}})[_0x9892('0x1f')](handleEntityNotFound(_0x30ba59,null))[_0x9892('0x1f')](function(_0x432eaa){if(_0x432eaa){_0x27413f=_0x432eaa;logger[_0x9892('0x22')](_0x9892('0x23'),_0x9892('0x2b'),_0x9892('0xc5'),_0x432eaa[_0x9892('0x43')],util[_0x9892('0xc6')](_0x39b68c[_0x9892('0x5e')],{'showHidden':![],'depth':null}));switch(_0x432eaa[_0x9892('0x43')]){case _0x9892('0xc7'):if(_0x39b68c[_0x9892('0x5e')][_0x9892('0xc8')]&&_0x39b68c['body'][_0x9892('0x2b')]){_0x348996=_0x39b68c[_0x9892('0x5e')][_0x9892('0x2b')];return db[_0x9892('0xa6')][_0x9892('0x5c')]({'where':{'messageId':_0x39b68c[_0x9892('0x5e')][_0x9892('0xc8')]}});}break;case'connectel':if(_0x39b68c[_0x9892('0x5e')][_0x9892('0xc9')]&&_0x39b68c[_0x9892('0x5e')][_0x9892('0xca')]){_0x348996=_0x39b68c[_0x9892('0x5e')][_0x9892('0xca')];return db[_0x9892('0xa6')]['find']({'where':{'messageId':_0x39b68c[_0x9892('0x5e')]['requestid']}});}break;case'clicksend':if(_0x39b68c['body'][_0x9892('0x89')]&&_0x39b68c['body']['status_code']){_0x348996=_0x39b68c[_0x9892('0x5e')]['status_code'];return db['SmsMessage'][_0x9892('0x5c')]({'where':{'messageId':_0x39b68c['body'][_0x9892('0x89')]}});}break;case _0x9892('0x8d'):var _0x3a58fc=_0x39b68c[_0x9892('0x5e')][_0x9892('0x8e')][0x0];if(_0x3a58fc[_0x9892('0x85')]&&_0x3a58fc[_0x9892('0x2b')]['groupName']==='DELIVERED'){_0x348996=_0x3a58fc[_0x9892('0x2b')][_0x9892('0xcb')];return db[_0x9892('0xa6')][_0x9892('0x5c')]({'where':{'messageId':_0x3a58fc[_0x9892('0x85')]}});}break;case _0x9892('0xcc'):if(_0x39b68c['body']['messageId']&&_0x39b68c[_0x9892('0x5e')]['status']){_0x348996=_0x39b68c[_0x9892('0x5e')][_0x9892('0x2b')];return db[_0x9892('0xa6')][_0x9892('0x5c')]({'where':{'messageId':_0x39b68c[_0x9892('0x5e')][_0x9892('0x85')]}});}break;case _0x9892('0x92'):if(_0x39b68c[_0x9892('0x5e')][0x0][_0x9892('0x27')]['id']){_0x348996=_0x39b68c['body'][0x0][_0x9892('0x43')];return db['SmsMessage']['find']({'where':{'messageId':_0x39b68c[_0x9892('0x5e')][0x0][_0x9892('0x27')]['id']}});}break;case'intelepeer':if(_0x39b68c['body'][_0x9892('0xcd')]&&_0x39b68c['body'][_0x9892('0x2b')]){_0x348996=_0x39b68c[_0x9892('0x5e')][_0x9892('0x2b')];return db['SmsMessage'][_0x9892('0x5c')]({'where':{'messageId':_0x39b68c[_0x9892('0x5e')][_0x9892('0xcd')]}});}break;}}})[_0x9892('0x1f')](handleEntityNotFound(_0x30ba59,null))[_0x9892('0x1f')](function(_0x424ca4){if(_0x424ca4){_0x461407=_0x424ca4;switch(_0x27413f[_0x9892('0x43')]){case _0x9892('0xc7'):if(_0x348996===_0x9892('0xce')){return _0x461407[_0x9892('0xcf')]({'read':!![]});}else{logger[_0x9892('0x24')](_0x9892('0x23'),_0x9892('0x2b'),'skebby',util[_0x9892('0xc6')](_0x39b68c[_0x9892('0x5e')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x348996==='1'){return _0x461407[_0x9892('0xcf')]({'read':!![]});}else{logger['error'](_0x9892('0x23'),_0x9892('0x2b'),_0x9892('0xc7'),util[_0x9892('0xc6')](_0x39b68c[_0x9892('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x9892('0xd0'):if(!_0x39b68c[_0x9892('0x5e')][_0x9892('0xd1')]&&_0x348996>=0xc8&&_0x348996<=0xce){return _0x461407['update']({'read':!![]});}else{logger[_0x9892('0x24')](_0x9892('0x23'),_0x9892('0x2b'),'clicksend',util[_0x9892('0xc6')](_0x39b68c[_0x9892('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x9892('0x8d'):var _0x251c97=_0x39b68c['body'][_0x9892('0x8e')][0x0];if(_0x251c97[_0x9892('0x2b')][_0x9892('0xcb')]===_0x9892('0xce')){return _0x461407[_0x9892('0xcf')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9892('0x2b'),_0x9892('0x8d'),util[_0x9892('0xc6')](_0x39b68c[_0x9892('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x9892('0xcc'):if(_0x348996==_0x9892('0xd2')||_0x348996==_0x9892('0xd3')){return _0x461407[_0x9892('0xcf')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9892('0x2b'),_0x9892('0xcc'),util[_0x9892('0xc6')](_0x39b68c[_0x9892('0x5e')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x348996==_0x9892('0xd4')){return _0x461407[_0x9892('0xcf')]({'read':!![]});}else{logger[_0x9892('0x24')](_0x9892('0x23'),'status','bandwidth',util[_0x9892('0xc6')](_0x39b68c[_0x9892('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x9892('0xd5'):if(_0x348996===_0x9892('0xd6')||_0x348996==='ACCEPTD'){return _0x461407[_0x9892('0xcf')]({'read':!![]});}else{logger[_0x9892('0x24')](_0x9892('0x23'),_0x9892('0x2b'),_0x9892('0xd5'),util['inspect'](_0x39b68c[_0x9892('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x461407;}})[_0x9892('0x1f')](respondWithResult(_0x30ba59,null))['catch'](handleError(_0x30ba59,null));};exports['statusGet']=function(_0x3f068a,_0x671d36,_0x2bcb8b){var _0x4d8369,_0x2624f9,_0x41c8b4;return db[_0x9892('0x40')][_0x9892('0x5c')]({'where':{'id':_0x3f068a[_0x9892('0x59')]['id']}})[_0x9892('0x1f')](handleEntityNotFound(_0x671d36,null))[_0x9892('0x1f')](function(_0xd2c645){if(_0xd2c645){_0x41c8b4=_0xd2c645;logger[_0x9892('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x9892('0xc5'),_0xd2c645[_0x9892('0x43')],util[_0x9892('0xc6')](_0x3f068a[_0x9892('0x46')],{'showHidden':![],'depth':null}));switch(_0xd2c645[_0x9892('0x43')]){case _0x9892('0x8f'):if(_0x3f068a['query'][_0x9892('0xd7')]&&_0x3f068a[_0x9892('0x46')][_0x9892('0xd8')]){_0x2624f9=_0x3f068a[_0x9892('0x46')][_0x9892('0xd8')];return db[_0x9892('0xa6')][_0x9892('0x5c')]({'where':{'messageId':_0x3f068a[_0x9892('0x46')][_0x9892('0xd7')]}});}break;}}})['then'](handleEntityNotFound(_0x671d36,null))['then'](function(_0xaae7d2){if(_0xaae7d2){_0x4d8369=_0xaae7d2;switch(_0x41c8b4[_0x9892('0x43')]){case _0x9892('0x8f'):if(_0x2624f9==='2'||_0x2624f9==='6'){return _0x4d8369[_0x9892('0xcf')]({'read':!![]});}else{logger[_0x9892('0x24')](_0x9892('0x23'),_0x9892('0x2b'),_0x9892('0x8f'),util[_0x9892('0xc6')](_0x3f068a[_0x9892('0x46')],{'showHidden':![],'depth':null}));};break;}return _0x4d8369;}})[_0x9892('0x1f')](respondWithResult(_0x671d36,null))[_0x9892('0x29')](handleError(_0x671d36,null));};exports[_0x9892('0xd9')]=function(_0x28b033,_0x439b5,_0x1429c2){return db[_0x9892('0x40')][_0x9892('0x5c')]({'where':{'id':_0x28b033['params']['id']}})[_0x9892('0x1f')](handleEntityNotFound(_0x439b5,null))[_0x9892('0x1f')](function(_0x1b84ef){if(_0x1b84ef){return _0x1b84ef[_0x9892('0xd9')](_0x28b033['body'][_0x9892('0x6e')],_[_0x9892('0xda')](_0x28b033[_0x9892('0x5e')],[_0x9892('0x6e'),'id'])||{})[_0x9892('0xa0')](function(_0x5f390d){for(var _0x4014c7=0x0;_0x4014c7<_0x28b033[_0x9892('0x5e')][_0x9892('0x6e')]['length'];_0x4014c7+=0x1){socket[_0x9892('0xdb')]('userSmsAccount:save',{'UserId':Number(_0x28b033[_0x9892('0x5e')][_0x9892('0x6e')][_0x4014c7]),'SmsAccountId':Number(_0x28b033[_0x9892('0x59')]['id'])});}return _0x5f390d;});}})[_0x9892('0x1f')](respondWithResult(_0x439b5,null))['catch'](handleError(_0x439b5,null));};exports[_0x9892('0xdc')]=function(_0x110f7c,_0x19fcc8,_0x58da6b){return db['SmsAccount']['find']({'where':{'id':_0x110f7c['params']['id']}})[_0x9892('0x1f')](handleEntityNotFound(_0x19fcc8,null))[_0x9892('0x1f')](function(_0x1d0a38){if(_0x1d0a38){return _0x1d0a38['removeAgents'](_0x110f7c[_0x9892('0x46')][_0x9892('0x6e')])[_0x9892('0x1f')](function(){if(_['isArray'](_0x110f7c[_0x9892('0x46')][_0x9892('0x6e')])){for(var _0x53dd13=0x0;_0x53dd13<_0x110f7c[_0x9892('0x46')][_0x9892('0x6e')]['length'];_0x53dd13+=0x1){socket[_0x9892('0xdb')](_0x9892('0xdd'),{'UserId':Number(_0x110f7c[_0x9892('0x46')][_0x9892('0x6e')][_0x53dd13]),'SmsAccountId':Number(_0x110f7c[_0x9892('0x59')]['id'])});}}else{socket[_0x9892('0xdb')](_0x9892('0xdd'),{'UserId':Number(_0x110f7c[_0x9892('0x46')][_0x9892('0x6e')]),'SmsAccountId':Number(_0x110f7c[_0x9892('0x59')]['id'])});}});}})[_0x9892('0x1f')](respondWithStatusCode(_0x19fcc8,null))[_0x9892('0x29')](handleError(_0x19fcc8,null));};exports[_0x9892('0xde')]=function(_0x1e9d58,_0x3378e2,_0xab1797){var _0x25498b={};var _0x4f72a2={};var _0x1f85a3;var _0x345f2d;return db[_0x9892('0x40')][_0x9892('0x6c')]({'where':{'id':_0x1e9d58['params']['id']}})[_0x9892('0x1f')](handleEntityNotFound(_0x3378e2,null))[_0x9892('0x1f')](function(_0xdd6430){if(_0xdd6430){_0x1f85a3=_0xdd6430;_0x4f72a2[_0x9892('0x45')]=_[_0x9892('0x47')](db[_0x9892('0xa9')][_0x9892('0x41')]);_0x4f72a2[_0x9892('0x46')]=_[_0x9892('0x47')](_0x1e9d58['query']);_0x4f72a2['filters']=_[_0x9892('0x48')](_0x4f72a2[_0x9892('0x45')],_0x4f72a2[_0x9892('0x46')]);_0x25498b[_0x9892('0x49')]=_['intersection'](_0x4f72a2[_0x9892('0x45')],qs[_0x9892('0x4a')](_0x1e9d58['query'][_0x9892('0x4a')]));_0x25498b[_0x9892('0x49')]=_0x25498b[_0x9892('0x49')]['length']?_0x25498b[_0x9892('0x49')]:_0x4f72a2['model'];_0x25498b['order']=qs[_0x9892('0x4e')](_0x1e9d58['query'][_0x9892('0x4e')]);_0x25498b[_0x9892('0x51')]=qs[_0x9892('0x4f')](_[_0x9892('0x50')](_0x1e9d58['query'],_0x4f72a2[_0x9892('0x4f')]));if(_0x1e9d58['query'][_0x9892('0x54')]){_0x25498b['where']=_[_0x9892('0x52')](_0x25498b[_0x9892('0x51')],{'$or':_['map'](_0x25498b[_0x9892('0x49')],function(_0x2c014a){var _0x5a1634={};_0x5a1634[_0x2c014a]={'$like':'%'+_0x1e9d58[_0x9892('0x46')][_0x9892('0x54')]+'%'};return _0x5a1634;})});}_0x25498b=_[_0x9892('0x52')]({},_0x25498b,_0x1e9d58[_0x9892('0x5b')]);return _0x1f85a3[_0x9892('0xde')](_0x25498b);}})[_0x9892('0x1f')](function(_0x103c61){if(_0x103c61){_0x345f2d=_0x103c61['length'];if(!_0x1e9d58[_0x9892('0x46')][_0x9892('0x4b')]('nolimit')){_0x25498b[_0x9892('0x2e')]=qs['limit'](_0x1e9d58[_0x9892('0x46')][_0x9892('0x2e')]);_0x25498b[_0x9892('0x2f')]=qs[_0x9892('0x2f')](_0x1e9d58[_0x9892('0x46')][_0x9892('0x2f')]);}return _0x1f85a3[_0x9892('0xde')](_0x25498b);}})[_0x9892('0x1f')](function(_0x11d64e){if(_0x11d64e){return _0x11d64e?{'count':_0x345f2d,'rows':_0x11d64e}:null;}})[_0x9892('0x1f')](respondWithResult(_0x3378e2,null))['catch'](handleError(_0x3378e2,null));}; \ No newline at end of file +var _0x988d=['../../config/license/util','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','SmsAccounts','UserProfileResource','destroy','sendStatus','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','find','params','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','Sequelize','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','Body','messageId','MessageSid','skebby','sender','text','clicksend','plivo','Text','MessageUUID','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','bandwidth','intelepeer','refid','ValidationError','from\x20is\x20mandatory','isNil','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','CmContact','Contacts','list','omit','contact','SmsInteraction','spread','interaction','autoclose','close','unmanaged','*,*,*,*','SmsMessage','ContactId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','findAndCountAll','getApplications','Contact','Owner','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','message_id','status_code','groupName','DELIVERED','redif','error_code','infobip','message-delivered','DELIVRD','ACCEPTD','statusGet','state','message-id','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x469fcd,_0x1b8c77){var _0x1298ad=function(_0x4f0c0d){while(--_0x4f0c0d){_0x469fcd['push'](_0x469fcd['shift']());}};_0x1298ad(++_0x1b8c77);}(_0x988d,0x1b0));var _0xd988=function(_0x3b50e6,_0x347347){_0x3b50e6=_0x3b50e6-0x0;var _0x359a7e=_0x988d[_0x3b50e6];return _0x359a7e;};'use strict';var emlformat=require(_0xd988('0x0'));var rimraf=require(_0xd988('0x1'));var zipdir=require(_0xd988('0x2'));var jsonpatch=require(_0xd988('0x3'));var rp=require(_0xd988('0x4'));var moment=require(_0xd988('0x5'));var BPromise=require(_0xd988('0x6'));var Mustache=require(_0xd988('0x7'));var util=require(_0xd988('0x8'));var path=require(_0xd988('0x9'));var sox=require(_0xd988('0xa'));var csv=require(_0xd988('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd988('0xc'));var _=require(_0xd988('0xd'));var squel=require('squel');var crypto=require(_0xd988('0xe'));var jsforce=require(_0xd988('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd988('0x10'));var authService=require(_0xd988('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd988('0x12'));var hardwareService=require(_0xd988('0x13'));var logger=require(_0xd988('0x14'))(_0xd988('0x15'));var utils=require(_0xd988('0x16'));var config=require(_0xd988('0x17'));var licenseUtil=require(_0xd988('0x18'));var db=require('../../mysqldb')['db'];config[_0xd988('0x19')]=_[_0xd988('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd988('0x1b'))(new Redis(config[_0xd988('0x19')]));require('./smsAccount.socket')[_0xd988('0x1c')](socket);var jayson=require(_0xd988('0x1d'));var client=jayson[_0xd988('0x1e')][_0xd988('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x2f61f,_0x2dab9e,_0x2afe7c,_0x49056e){return new BPromise(function(_0x91f064,_0x1043e2){var _0x301d9b=_0x49056e||client;return _0x301d9b['request'](_0x2f61f,_0x2afe7c)[_0xd988('0x20')](function(_0x170076){logger[_0xd988('0x21')](_0xd988('0x22'),_0x2dab9e,_0xd988('0x23'));logger[_0xd988('0x24')](_0xd988('0x25'),_0x2dab9e,_0xd988('0x23'),JSON[_0xd988('0x26')](_0x170076));if(_0x170076['error']){if(_0x170076['error']['code']===0x1f4){logger['error'](_0xd988('0x22'),_0x2dab9e,_0x170076[_0xd988('0x27')][_0xd988('0x28')]);return _0x1043e2(_0x170076[_0xd988('0x27')][_0xd988('0x28')]);}logger[_0xd988('0x27')](_0xd988('0x22'),_0x2dab9e,_0x170076['error']['message']);return _0x91f064(_0x170076['error'][_0xd988('0x28')]);}else{logger[_0xd988('0x21')](_0xd988('0x22'),_0x2dab9e,_0xd988('0x23'));_0x91f064(_0x170076[_0xd988('0x29')][_0xd988('0x28')]);}})[_0xd988('0x2a')](function(_0x48c038){logger['error'](_0xd988('0x22'),_0x2dab9e,_0x48c038);_0x1043e2(_0x48c038);});});}function respondWithStatusCode(_0x47919f,_0x5241c7){_0x5241c7=_0x5241c7||0xcc;return function(_0x11c3df){if(_0x11c3df){return _0x47919f['sendStatus'](_0x5241c7);}return _0x47919f[_0xd988('0x2b')](_0x5241c7)[_0xd988('0x2c')]();};}function respondWithResult(_0x408d67,_0x538d52){_0x538d52=_0x538d52||0xc8;return function(_0x4af1de){if(_0x4af1de){return _0x408d67[_0xd988('0x2b')](_0x538d52)[_0xd988('0x2d')](_0x4af1de);}};}function respondWithFilteredResult(_0x57255f,_0x255d1b){return function(_0xa7f9db){if(_0xa7f9db){var _0x4eead4=typeof _0x255d1b[_0xd988('0x2e')]===_0xd988('0x2f')&&typeof _0x255d1b['limit']===_0xd988('0x2f');var _0x402f51=_0xa7f9db[_0xd988('0x30')];var _0x23a51b=_0x4eead4?0x0:_0x255d1b['offset'];var _0x3c8b51=_0x4eead4?_0xa7f9db[_0xd988('0x30')]:_0x255d1b['offset']+_0x255d1b[_0xd988('0x31')];var _0x8a4b3f;if(_0x3c8b51>=_0x402f51){_0x3c8b51=_0x402f51;_0x8a4b3f=0xc8;}else{_0x8a4b3f=0xce;}_0x57255f[_0xd988('0x2b')](_0x8a4b3f);return _0x57255f[_0xd988('0x32')](_0xd988('0x33'),_0x23a51b+'-'+_0x3c8b51+'/'+_0x402f51)[_0xd988('0x2d')](_0xa7f9db);}return null;};}function patchUpdates(_0x20135d){return function(_0x2f53eb){try{jsonpatch[_0xd988('0x34')](_0x2f53eb,_0x20135d,!![]);}catch(_0x364a46){return BPromise['reject'](_0x364a46);}return _0x2f53eb['save']();};}function saveUpdates(_0x47b7e9,_0x50e062){return function(_0x3a5350){if(_0x3a5350){return _0x3a5350['update'](_0x47b7e9)[_0xd988('0x20')](function(_0x2e9530){return _0x2e9530;});}return null;};}function removeEntity(_0x48c07f,_0xa65360){return function(_0x13b90a){if(_0x13b90a){return _0x13b90a['destroy']()['then'](function(){var _0x4fc272=_0x13b90a['get']({'plain':!![]});var _0x106b29=_0xd988('0x35');return db[_0xd988('0x36')][_0xd988('0x37')]({'where':{'type':_0x106b29,'resourceId':_0x4fc272['id']}})[_0xd988('0x20')](function(){return _0x13b90a;});})[_0xd988('0x20')](function(){_0x48c07f[_0xd988('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48e694,_0x2ce2a2){return function(_0xfe7b33){if(!_0xfe7b33){_0x48e694[_0xd988('0x38')](0x194);}return _0xfe7b33;};}function handleError(_0x2d03f2,_0x16a401){_0x16a401=_0x16a401||0x1f4;return function(_0x19a501){logger['error'](_0x19a501['stack']);if(_0x19a501[_0xd988('0x39')]){delete _0x19a501[_0xd988('0x39')];}_0x2d03f2[_0xd988('0x2b')](_0x16a401)[_0xd988('0x3a')](_0x19a501);};}exports[_0xd988('0x3b')]=function(_0x36a856,_0x390ed5){var _0x38216b={'include':[{'model':db[_0xd988('0x3c')],'as':_0xd988('0x3d')}]},_0x5eb836={},_0x4c7be1={'count':0x0,'rows':[]};var _0x3e4956=_[_0xd988('0x3e')](db[_0xd988('0x3f')][_0xd988('0x40')],function(_0xdff62c){return{'name':_0xdff62c[_0xd988('0x41')],'type':_0xdff62c[_0xd988('0x42')][_0xd988('0x43')]};});_0x5eb836[_0xd988('0x44')]=_['map'](_0x3e4956,_0xd988('0x39'));_0x5eb836[_0xd988('0x45')]=_[_0xd988('0x46')](_0x36a856[_0xd988('0x45')]);_0x5eb836[_0xd988('0x47')]=_[_0xd988('0x48')](_0x5eb836[_0xd988('0x44')],_0x5eb836[_0xd988('0x45')]);_0x38216b[_0xd988('0x49')]=_[_0xd988('0x48')](_0x5eb836[_0xd988('0x44')],qs['fields'](_0x36a856[_0xd988('0x45')][_0xd988('0x4a')]));_0x38216b[_0xd988('0x49')]=_0x38216b[_0xd988('0x49')][_0xd988('0x4b')]?_0x38216b['attributes']:_0x5eb836[_0xd988('0x44')];if(!_0x36a856[_0xd988('0x45')][_0xd988('0x4c')](_0xd988('0x4d'))){_0x38216b[_0xd988('0x31')]=qs[_0xd988('0x31')](_0x36a856[_0xd988('0x45')][_0xd988('0x31')]);_0x38216b[_0xd988('0x2e')]=qs[_0xd988('0x2e')](_0x36a856[_0xd988('0x45')][_0xd988('0x2e')]);}_0x38216b[_0xd988('0x4e')]=qs[_0xd988('0x4f')](_0x36a856[_0xd988('0x45')][_0xd988('0x4f')]);_0x38216b[_0xd988('0x50')]=qs['filters'](_[_0xd988('0x51')](_0x36a856[_0xd988('0x45')],_0x5eb836['filters']),_0x3e4956);if(_0x36a856['query']['filter']){_0x38216b[_0xd988('0x50')]=_[_0xd988('0x52')](_0x38216b[_0xd988('0x50')],{'$or':_[_0xd988('0x3e')](_0x3e4956,function(_0x1c1049){if(_0x1c1049[_0xd988('0x42')]!==_0xd988('0x53')){var _0x59e409={};_0x59e409[_0x1c1049[_0xd988('0x39')]]={'$like':'%'+_0x36a856[_0xd988('0x45')][_0xd988('0x54')]+'%'};return _0x59e409;}})});}_0x38216b=_[_0xd988('0x52')]({},_0x38216b,_0x36a856[_0xd988('0x55')]);var _0x118a95={'where':_0x38216b[_0xd988('0x50')]};return db[_0xd988('0x3f')]['count'](_0x118a95)[_0xd988('0x20')](function(_0x2652db){_0x4c7be1['count']=_0x2652db;if(_0x36a856[_0xd988('0x45')][_0xd988('0x56')]){_0x38216b[_0xd988('0x57')]=[{'all':!![]}];}return db[_0xd988('0x3f')][_0xd988('0x58')](_0x38216b);})[_0xd988('0x20')](function(_0x3bf4d7){_0x4c7be1['rows']=_0x3bf4d7;return _0x4c7be1;})[_0xd988('0x20')](respondWithFilteredResult(_0x390ed5,_0x38216b))['catch'](handleError(_0x390ed5,null));};exports[_0xd988('0x59')]=function(_0x4a0973,_0x170c0c){var _0x5f590b={'raw':![],'where':{'id':_0x4a0973['params']['id']},'include':[{'model':db['Pause'],'as':_0xd988('0x3d')}]},_0x2e9903={};_0x2e9903[_0xd988('0x44')]=_[_0xd988('0x46')](db[_0xd988('0x3f')]['rawAttributes']);_0x2e9903['query']=_[_0xd988('0x46')](_0x4a0973[_0xd988('0x45')]);_0x2e9903['filters']=_[_0xd988('0x48')](_0x2e9903['model'],_0x2e9903['query']);_0x5f590b['attributes']=_['intersection'](_0x2e9903[_0xd988('0x44')],qs[_0xd988('0x4a')](_0x4a0973[_0xd988('0x45')][_0xd988('0x4a')]));_0x5f590b[_0xd988('0x49')]=_0x5f590b[_0xd988('0x49')][_0xd988('0x4b')]?_0x5f590b[_0xd988('0x49')]:_0x2e9903[_0xd988('0x44')];if(_0x4a0973['query'][_0xd988('0x56')]){_0x5f590b[_0xd988('0x57')]=[{'all':!![]}];}_0x5f590b=_[_0xd988('0x52')]({},_0x5f590b,_0x4a0973['options']);return db[_0xd988('0x3f')]['find'](_0x5f590b)[_0xd988('0x20')](handleEntityNotFound(_0x170c0c,null))['then'](respondWithResult(_0x170c0c,null))['catch'](handleError(_0x170c0c,null));};exports[_0xd988('0x5a')]=function(_0xf5434e,_0x103ff7){return db['SmsAccount'][_0xd988('0x5a')](_0xf5434e[_0xd988('0x5b')],{})[_0xd988('0x20')](function(_0x1ea894){var _0x22863c=_0xf5434e[_0xd988('0x5c')][_0xd988('0x5d')]({'plain':!![]});if(!_0x22863c)throw new Error(_0xd988('0x5e'));if(_0x22863c[_0xd988('0x5f')]==='user'){var _0x2aecd8=_0x1ea894['get']({'plain':!![]});var _0x10e4a5=_0xd988('0x35');return db[_0xd988('0x60')]['find']({'where':{'name':_0x10e4a5,'userProfileId':_0x22863c[_0xd988('0x61')]},'raw':!![]})[_0xd988('0x20')](function(_0x15d0ae){if(_0x15d0ae&&_0x15d0ae[_0xd988('0x62')]===0x0){return db[_0xd988('0x36')]['create']({'name':_0x2aecd8['name'],'resourceId':_0x2aecd8['id'],'type':_0x15d0ae[_0xd988('0x39')],'sectionId':_0x15d0ae['id']},{})[_0xd988('0x20')](function(){return _0x1ea894;});}else{return _0x1ea894;}})[_0xd988('0x2a')](function(_0x40214e){logger[_0xd988('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x40214e);throw _0x40214e;});}return _0x1ea894;})[_0xd988('0x20')](respondWithResult(_0x103ff7,0xc9))['catch'](handleError(_0x103ff7,null));};exports[_0xd988('0x63')]=function(_0x24c953,_0x5d5eeb){if(_0x24c953[_0xd988('0x5b')]['id']){delete _0x24c953['body']['id'];}return db[_0xd988('0x3f')][_0xd988('0x64')]({'where':{'id':_0x24c953[_0xd988('0x65')]['id']},'include':[{'model':db['Pause'],'as':_0xd988('0x3d')}]})['then'](handleEntityNotFound(_0x5d5eeb,null))[_0xd988('0x20')](saveUpdates(_0x24c953[_0xd988('0x5b')],null))[_0xd988('0x20')](respondWithResult(_0x5d5eeb,null))[_0xd988('0x2a')](handleError(_0x5d5eeb,null));};exports[_0xd988('0x37')]=function(_0x18d989,_0x145586){return db[_0xd988('0x3f')][_0xd988('0x64')]({'where':{'id':_0x18d989[_0xd988('0x65')]['id']}})[_0xd988('0x20')](handleEntityNotFound(_0x145586,null))[_0xd988('0x20')](removeEntity(_0x145586,null))[_0xd988('0x2a')](handleError(_0x145586,null));};exports[_0xd988('0x66')]=function(_0x492ac0,_0x18d45f){return db['SmsAccount'][_0xd988('0x66')]()[_0xd988('0x20')](respondWithResult(_0x18d45f,null))['catch'](handleError(_0x18d45f,null));};exports[_0xd988('0x67')]=function(_0xaafed6,_0xd7dbf9,_0x33dff9){if(_0xaafed6[_0xd988('0x5b')]['id']){delete _0xaafed6[_0xd988('0x5b')]['id'];}return db[_0xd988('0x3f')]['find']({'where':{'id':_0xaafed6[_0xd988('0x65')]['id']}})['then'](handleEntityNotFound(_0xd7dbf9,null))[_0xd988('0x20')](function(_0x3cc9da){if(_0x3cc9da){_0xaafed6[_0xd988('0x5b')][_0xd988('0x68')]=_0x3cc9da['id'];return db[_0xd988('0x69')][_0xd988('0x5a')](_0xaafed6[_0xd988('0x5b')]);}})[_0xd988('0x20')](respondWithResult(_0xd7dbf9,null))['catch'](handleError(_0xd7dbf9,null));};exports[_0xd988('0x6a')]=function(_0x355a16,_0x53a3a8,_0x48bf0f){var _0x2baeef={'raw':![],'where':{}};var _0x425844={};var _0x3b6d2c={'count':0x0,'rows':[]};return db['SmsAccount'][_0xd988('0x6b')]({'where':{'id':_0x355a16[_0xd988('0x65')]['id']}})['then'](handleEntityNotFound(_0x53a3a8,null))[_0xd988('0x20')](function(_0x147a1a){if(_0x147a1a){_0x425844[_0xd988('0x44')]=_[_0xd988('0x46')](db['Disposition'][_0xd988('0x40')]);_0x425844[_0xd988('0x45')]=_['keys'](_0x355a16[_0xd988('0x45')]);_0x425844[_0xd988('0x47')]=_[_0xd988('0x48')](_0x425844[_0xd988('0x44')],_0x425844[_0xd988('0x45')]);_0x2baeef[_0xd988('0x49')]=_[_0xd988('0x48')](_0x425844[_0xd988('0x44')],qs[_0xd988('0x4a')](_0x355a16['query']['fields']));_0x2baeef[_0xd988('0x49')]=_0x2baeef[_0xd988('0x49')][_0xd988('0x4b')]?_0x2baeef[_0xd988('0x49')]:_0x425844[_0xd988('0x44')];if(!_0x355a16[_0xd988('0x45')][_0xd988('0x4c')](_0xd988('0x4d'))){_0x2baeef[_0xd988('0x31')]=qs[_0xd988('0x31')](_0x355a16[_0xd988('0x45')][_0xd988('0x31')]);_0x2baeef[_0xd988('0x2e')]=qs[_0xd988('0x2e')](_0x355a16[_0xd988('0x45')][_0xd988('0x2e')]);}_0x2baeef[_0xd988('0x4e')]=qs[_0xd988('0x4f')](_0x355a16[_0xd988('0x45')][_0xd988('0x4f')]);_0x2baeef[_0xd988('0x50')]=qs[_0xd988('0x47')](_[_0xd988('0x51')](_0x355a16['query'],_0x425844[_0xd988('0x47')]));_0x2baeef['where'][_0xd988('0x68')]=_0x147a1a['id'];if(_0x355a16['query'][_0xd988('0x54')]){_0x2baeef['where']=_[_0xd988('0x52')](_0x2baeef[_0xd988('0x50')],{'$or':_['map'](_0x2baeef[_0xd988('0x49')],function(_0x2cfdb){var _0x13ef48={};_0x13ef48[_0x2cfdb]={'$like':'%'+_0x355a16[_0xd988('0x45')]['filter']+'%'};return _0x13ef48;})});}_0x2baeef=_[_0xd988('0x52')]({},_0x2baeef,_0x355a16['options']);return db[_0xd988('0x69')][_0xd988('0x30')]({'where':_0x2baeef[_0xd988('0x50')]})['then'](function(_0x40ad10){_0x3b6d2c[_0xd988('0x30')]=_0x40ad10;if(_0x355a16['query']['includeAll']){_0x2baeef[_0xd988('0x57')]=[{'all':!![]}];}return db[_0xd988('0x69')]['findAll'](_0x2baeef);})[_0xd988('0x20')](function(_0x1adc2d){_0x3b6d2c[_0xd988('0x6c')]=_0x1adc2d;return _0x3b6d2c;});}})[_0xd988('0x20')](respondWithFilteredResult(_0x53a3a8,_0x2baeef))['catch'](handleError(_0x53a3a8,null));};exports[_0xd988('0x6d')]=function(_0x45a2d4,_0x40cdbe,_0x15e264){return db[_0xd988('0x3f')][_0xd988('0x64')]({'where':{'id':_0x45a2d4[_0xd988('0x65')]['id']}})[_0xd988('0x20')](handleEntityNotFound(_0x40cdbe,null))[_0xd988('0x20')](function(_0x18ea6b){if(_0x18ea6b){return _0x18ea6b['removeDispositions'](_0x45a2d4[_0xd988('0x45')][_0xd988('0x6e')]);}})[_0xd988('0x20')](respondWithStatusCode(_0x40cdbe,null))[_0xd988('0x2a')](handleError(_0x40cdbe,null));};exports[_0xd988('0x6f')]=function(_0x32d182,_0x5ac1fb,_0x3f4dc6){if(_0x32d182[_0xd988('0x5b')]['id']){delete _0x32d182[_0xd988('0x5b')]['id'];}return db[_0xd988('0x3f')][_0xd988('0x64')]({'where':{'id':_0x32d182[_0xd988('0x65')]['id']}})[_0xd988('0x20')](handleEntityNotFound(_0x5ac1fb,null))[_0xd988('0x20')](function(_0x2ffe18){if(_0x2ffe18){_0x32d182[_0xd988('0x5b')][_0xd988('0x68')]=_0x2ffe18['id'];return db[_0xd988('0x70')][_0xd988('0x5a')](_0x32d182[_0xd988('0x5b')]);}})[_0xd988('0x20')](respondWithResult(_0x5ac1fb,null))[_0xd988('0x2a')](handleError(_0x5ac1fb,null));};exports[_0xd988('0x71')]=function(_0x24d798,_0x2dad6f,_0x4809c8){var _0x4fe1fd={'raw':![],'where':{}};var _0x38c1e4={};var _0x2f3c38={'count':0x0,'rows':[]};return db[_0xd988('0x3f')]['findOne']({'where':{'id':_0x24d798[_0xd988('0x65')]['id']}})[_0xd988('0x20')](handleEntityNotFound(_0x2dad6f,null))[_0xd988('0x20')](function(_0x28dca4){if(_0x28dca4){_0x38c1e4['model']=_[_0xd988('0x46')](db[_0xd988('0x70')][_0xd988('0x40')]);_0x38c1e4[_0xd988('0x45')]=_['keys'](_0x24d798[_0xd988('0x45')]);_0x38c1e4[_0xd988('0x47')]=_[_0xd988('0x48')](_0x38c1e4[_0xd988('0x44')],_0x38c1e4[_0xd988('0x45')]);_0x4fe1fd[_0xd988('0x49')]=_['intersection'](_0x38c1e4[_0xd988('0x44')],qs['fields'](_0x24d798['query'][_0xd988('0x4a')]));_0x4fe1fd['attributes']=_0x4fe1fd[_0xd988('0x49')]['length']?_0x4fe1fd[_0xd988('0x49')]:_0x38c1e4[_0xd988('0x44')];if(!_0x24d798[_0xd988('0x45')][_0xd988('0x4c')](_0xd988('0x4d'))){_0x4fe1fd[_0xd988('0x31')]=qs[_0xd988('0x31')](_0x24d798[_0xd988('0x45')][_0xd988('0x31')]);_0x4fe1fd[_0xd988('0x2e')]=qs['offset'](_0x24d798['query']['offset']);}_0x4fe1fd[_0xd988('0x4e')]=qs[_0xd988('0x4f')](_0x24d798[_0xd988('0x45')]['sort']);_0x4fe1fd[_0xd988('0x50')]=qs[_0xd988('0x47')](_[_0xd988('0x51')](_0x24d798[_0xd988('0x45')],_0x38c1e4[_0xd988('0x47')]));_0x4fe1fd[_0xd988('0x50')][_0xd988('0x68')]=_0x28dca4['id'];if(_0x24d798[_0xd988('0x45')][_0xd988('0x54')]){_0x4fe1fd[_0xd988('0x50')]=_['merge'](_0x4fe1fd[_0xd988('0x50')],{'$or':_['map'](_0x4fe1fd[_0xd988('0x49')],function(_0x1883ed){var _0x14a787={};_0x14a787[_0x1883ed]={'$like':'%'+_0x24d798['query'][_0xd988('0x54')]+'%'};return _0x14a787;})});}_0x4fe1fd=_[_0xd988('0x52')]({},_0x4fe1fd,_0x24d798['options']);return db[_0xd988('0x70')][_0xd988('0x30')]({'where':_0x4fe1fd[_0xd988('0x50')]})[_0xd988('0x20')](function(_0x49105a){_0x2f3c38[_0xd988('0x30')]=_0x49105a;if(_0x24d798[_0xd988('0x45')][_0xd988('0x56')]){_0x4fe1fd[_0xd988('0x57')]=[{'all':!![]}];}return db[_0xd988('0x70')][_0xd988('0x58')](_0x4fe1fd);})['then'](function(_0xad093b){_0x2f3c38[_0xd988('0x6c')]=_0xad093b;return _0x2f3c38;});}})[_0xd988('0x20')](respondWithFilteredResult(_0x2dad6f,_0x4fe1fd))[_0xd988('0x2a')](handleError(_0x2dad6f,null));};exports[_0xd988('0x72')]=function(_0x439968,_0x3b8b0e,_0x5f21ab){return db[_0xd988('0x3f')]['find']({'where':{'id':_0x439968[_0xd988('0x65')]['id']}})[_0xd988('0x20')](handleEntityNotFound(_0x3b8b0e,null))[_0xd988('0x20')](function(_0x1cdc38){if(_0x1cdc38){return _0x1cdc38[_0xd988('0x72')](_0x439968['query'][_0xd988('0x6e')]);}})['then'](respondWithStatusCode(_0x3b8b0e,null))['catch'](handleError(_0x3b8b0e,null));};exports[_0xd988('0x73')]=function(_0x434da7,_0x35b354,_0x456b64){var _0x35271c={'channel':_0xd988('0x74')};var _0x4186f5=[];var _0x1b7488=[];var _0x559645={};return db[_0xd988('0x3f')][_0xd988('0x64')]({'where':{'id':_0x434da7['params']['id']},'include':[{'model':db[_0xd988('0x75')],'as':_0xd988('0x76')}]})['then'](handleEntityNotFound(_0x35b354,null))['then'](function(_0x1fbeb0){_0x35271c[_0xd988('0x77')]=_0x1fbeb0;_0x35271c[_0xd988('0x78')]=_[_0xd988('0x79')](_0x1fbeb0[_0xd988('0x76')],[_0xd988('0x7a')],[_0xd988('0x7b')]);if(_0x35271c[_0xd988('0x77')][_0xd988('0x76')]){delete _0x35271c[_0xd988('0x77')][_0xd988('0x76')];}return db['CmContact']['describe']();})['then'](function(_0x1bdfa9){if(!_0x1bdfa9){throw new db[(_0xd988('0x7c'))]['ValidationError']('no\x20available\x20attributes');}_0x4186f5=_['difference'](_[_0xd988('0x46')](_0x1bdfa9),[_0xd988('0x7d'),_0xd988('0x7e')]);_0x1b7488=_['difference'](_[_0xd988('0x46')](_0x1bdfa9),[_0xd988('0x7d'),'updatedAt',_0xd988('0x7f'),_0xd988('0x80')]);_0x35271c[_0xd988('0x5b')]={'mapKey':_0xd988('0x81')};if(_0x35271c[_0xd988('0x77')]['type']){switch(_0x35271c[_0xd988('0x77')][_0xd988('0x42')]){case'twilio':_0x35271c[_0xd988('0x5b')][_0xd988('0x82')]=_0x434da7[_0xd988('0x5b')][_0xd988('0x83')];_0x35271c['body'][_0xd988('0x5b')]=_0x434da7[_0xd988('0x5b')][_0xd988('0x84')];_0x35271c[_0xd988('0x5b')][_0xd988('0x85')]=_0x434da7['body'][_0xd988('0x86')];break;case _0xd988('0x87'):_0x35271c[_0xd988('0x5b')][_0xd988('0x82')]='+'+_0x434da7[_0xd988('0x5b')][_0xd988('0x88')];_0x35271c[_0xd988('0x5b')][_0xd988('0x5b')]=_0x434da7[_0xd988('0x5b')][_0xd988('0x89')];break;case'connectel':_0x35271c['body'][_0xd988('0x82')]=_0x434da7[_0xd988('0x5b')][_0xd988('0x82')];_0x35271c['body']['body']=_0x434da7['body']['message'];break;case _0xd988('0x8a'):_0x35271c[_0xd988('0x5b')][_0xd988('0x82')]=_0x434da7[_0xd988('0x5b')][_0xd988('0x82')];_0x35271c[_0xd988('0x5b')][_0xd988('0x5b')]=_0x434da7[_0xd988('0x5b')][_0xd988('0x5b')];_0x35271c[_0xd988('0x5b')]['messageId']=_0x434da7['body']['message_id'];break;case _0xd988('0x8b'):_0x35271c[_0xd988('0x5b')][_0xd988('0x82')]=_0x434da7[_0xd988('0x5b')][_0xd988('0x83')];_0x35271c['body'][_0xd988('0x5b')]=_0x434da7[_0xd988('0x5b')][_0xd988('0x8c')];_0x35271c[_0xd988('0x5b')][_0xd988('0x85')]=_0x434da7[_0xd988('0x5b')][_0xd988('0x8d')];break;case'infobip':_0x35271c[_0xd988('0x5b')][_0xd988('0x82')]='+'+_0x434da7[_0xd988('0x5b')][_0xd988('0x8e')][0x0][_0xd988('0x82')];_0x35271c[_0xd988('0x5b')]['body']=_0x434da7['body'][_0xd988('0x8e')][0x0]['text'];_0x35271c['body'][_0xd988('0x85')]=_0x434da7[_0xd988('0x5b')][_0xd988('0x8e')][0x0]['messageId'];break;case _0xd988('0x8f'):_0x35271c[_0xd988('0x5b')]['from']=_0x434da7[_0xd988('0x5b')][_0xd988('0x90')];_0x35271c[_0xd988('0x5b')][_0xd988('0x5b')]=_0x434da7[_0xd988('0x5b')][_0xd988('0x91')][_0xd988('0x28')];break;case _0xd988('0x92'):_0x35271c['body']['from']=_0x434da7[_0xd988('0x5b')][_0xd988('0x93')];_0x35271c['body']['body']=_0x434da7[_0xd988('0x5b')][_0xd988('0x89')];_0x35271c['body'][_0xd988('0x85')]=_0x434da7[_0xd988('0x5b')]['replyMessageId'];break;case _0xd988('0x94'):_0x35271c[_0xd988('0x5b')][_0xd988('0x85')]=_0x434da7[_0xd988('0x5b')][0x0][_0xd988('0x28')]['id'];_0x35271c[_0xd988('0x5b')][_0xd988('0x82')]=_0x434da7[_0xd988('0x5b')][0x0]['message'][_0xd988('0x82')];_0x35271c['body'][_0xd988('0x5b')]=_0x434da7['body'][0x0]['message']['text'];break;case _0xd988('0x95'):_0x35271c[_0xd988('0x5b')][_0xd988('0x82')]=_0x434da7[_0xd988('0x5b')][_0xd988('0x82')];_0x35271c[_0xd988('0x5b')][_0xd988('0x5b')]=_0x434da7[_0xd988('0x5b')][_0xd988('0x28')];_0x35271c[_0xd988('0x5b')]['messageId']=_0x434da7['body'][_0xd988('0x96')];break;}}if(_0x35271c[_0xd988('0x5b')]['id']){delete _0x35271c[_0xd988('0x5b')]['id'];}if(_['isNil'](_0x35271c[_0xd988('0x5b')][_0xd988('0x82')])){throw new db[(_0xd988('0x7c'))][(_0xd988('0x97'))](_0xd988('0x98'));}if(_['isNil'](_0x35271c[_0xd988('0x5b')][_0xd988('0x5b')])||_0x35271c['body']['body']===''){throw new db[(_0xd988('0x7c'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xd988('0x99')](_0x35271c[_0xd988('0x5b')]['mapKey'])){throw new db[(_0xd988('0x7c'))][(_0xd988('0x97'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1b7488);}if(!_[_0xd988('0x9a')](_0x1b7488,_0x35271c['body']['mapKey'])){throw new db['Sequelize']['ValidationError'](_0xd988('0x9b')+_0x1b7488);}_0x559645[_0x35271c[_0xd988('0x5b')][_0xd988('0x9c')]]=_0x35271c[_0xd988('0x5b')][_0xd988('0x82')];return db[_0xd988('0x9d')][_0xd988('0x64')]({'where':{'id':_0x35271c['account'][_0xd988('0x80')]},'include':[{'model':db[_0xd988('0x9e')],'as':_0xd988('0x9f'),'where':_0x559645,'limit':0x1,'order':[['updatedAt','DESC']]}]});})['then'](handleEntityNotFound(_0x35b354,null))[_0xd988('0x20')](function(_0x1b5463){if(_0x1b5463){_0x35271c[_0xd988('0xa0')]=_[_0xd988('0xa1')](_0x1b5463,['Contacts']);if(_0x1b5463['Contacts'][_0xd988('0x4b')]){return _0x1b5463['Contacts'][0x0];}var _0x5a435c=_[_0xd988('0x1a')](_0x35271c['body'],{'firstName':_0x35271c[_0xd988('0x5b')]['from'],'ListId':_0x1b5463['id']});_0x5a435c[_0x35271c[_0xd988('0x5b')]['mapKey']]=_0x35271c[_0xd988('0x5b')][_0xd988('0x82')];return db[_0xd988('0x9e')][_0xd988('0x5a')](_0x5a435c,{'fields':_0x4186f5,'raw':!![]});}})[_0xd988('0x20')](handleEntityNotFound(_0x35b354,null))[_0xd988('0x20')](function(_0x1750d3){if(_0x1750d3){_0x35271c[_0xd988('0xa2')]=_0x1750d3;var _0xd0e58={'ContactId':_0x1750d3['id'],'phone':_0x35271c[_0xd988('0x5b')][_0xd988('0x82')],'SmsAccountId':_0x434da7[_0xd988('0x65')]['id']};var _0x317107={'ContactId':_0x1750d3['id'],'SmsAccountId':_0x434da7['params']['id'],'closed':![]};return db['SmsInteraction'][_0xd988('0x64')]({'where':_0x317107})[_0xd988('0x20')](function(_0x82d99e){if(_0x82d99e){return[_0x82d99e,![]];}return db[_0xd988('0xa3')][_0xd988('0x5a')](_0xd0e58)['then'](function(_0x27a741){return[_0x27a741,!![]];});});}})[_0xd988('0xa4')](function(_0x15396d,_0x3abcf3){_0x35271c[_0xd988('0xa5')]=_0x15396d[_0xd988('0x5d')]({'plain':!![]});_0x35271c['interaction']['created']=![];if(_0x3abcf3){if(_0x35271c[_0xd988('0x77')][_0xd988('0xa6')]){_0x35271c['applications']['push']({'id':0x0,'priority':_0x35271c[_0xd988('0x78')][_0xd988('0x4b')]+0x1,'app':_0xd988('0xa7'),'appdata':_0xd988('0xa8'),'interval':_0xd988('0xa9')});}_0x35271c['interaction']['created']=!![];}return db[_0xd988('0xaa')][_0xd988('0x5a')]({'phone':_0x35271c[_0xd988('0x5b')][_0xd988('0x82')],'messageId':_0x35271c['body'][_0xd988('0x85')],'body':_0x35271c[_0xd988('0x5b')][_0xd988('0x5b')],'SmsAccountId':_0x434da7['params']['id'],'SmsInteractionId':_0x15396d['id'],'direction':'in','ContactId':_0x15396d[_0xd988('0xab')],'AttachmentId':_0x35271c[_0xd988('0x5b')]['AttachmentId']});})[_0xd988('0x20')](function(_0x4c356d){_0x35271c[_0xd988('0x28')]=_0x4c356d;if(_0x35271c[_0xd988('0xa5')][_0xd988('0xac')]){return db[_0xd988('0xad')][_0xd988('0x64')]({'attributes':['id',_0xd988('0x39')],'where':{'id':_0x35271c[_0xd988('0xa5')][_0xd988('0xac')]}})[_0xd988('0x20')](function(_0x5abedb){if(_0x5abedb){_0x35271c['applications'][_0xd988('0xae')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5abedb[_0xd988('0x39')]+','+(_0x35271c[_0xd988('0x77')][_0xd988('0xaf')]||0xa),'interval':_0xd988('0xa9')});}return respondWithRpcPromise(_0xd988('0xb0'),_0xd988('0xb1'),_0x35271c);});}return respondWithRpcPromise(_0xd988('0xb0'),'startRouting',_0x35271c);})[_0xd988('0x20')](function(_0x482f29){if(_0x482f29){var _0x4beb6b=0xc8;var _0x447aa7='receiveMessage';logger[_0xd988('0x21')](_0xd988('0x25'),_0x447aa7,_0x4beb6b,_0xd988('0xb2'));logger['debug'](_0xd988('0xb3'),_0x447aa7,_0x4beb6b,_0xd988('0xb2'),JSON[_0xd988('0x26')](_0x482f29));if(_0x35271c[_0xd988('0x77')]['type']===_0xd988('0xb4')){return _0x35b354['status'](_0x4beb6b)['set'](_0xd988('0xb5'),_0xd988('0xb6'))[_0xd988('0x3a')](_0xd988('0xb7'));}else{return _0x35b354[_0xd988('0x2b')](_0x4beb6b)[_0xd988('0x2d')](_0x482f29);}}})['catch'](handleError(_0x35b354,null));};exports[_0xd988('0xb8')]=function(_0xb11960,_0x1375bd,_0x122f6c){return db[_0xd988('0x3f')][_0xd988('0x6b')]({'where':{'id':_0xb11960[_0xd988('0x65')]['id']}})[_0xd988('0x20')](handleEntityNotFound(_0x1375bd,null))[_0xd988('0x20')](function(_0x3c22ff){if(_0x3c22ff){return db[_0xd988('0xb9')][_0xd988('0xba')](function(_0x4a6694){return db['SmsApplication'][_0xd988('0x37')]({'where':{'SmsAccountId':_0xb11960[_0xd988('0x65')]['id']},'transaction':_0x4a6694})[_0xd988('0x20')](function(_0x36ae18){var _0x2de258=_[_0xd988('0x3e')](_0xb11960[_0xd988('0x5b')],function(_0x19f33a){_0x19f33a['SmsAccountId']=_0xb11960[_0xd988('0x65')]['id'];return _0x19f33a;});return db[_0xd988('0x75')]['bulkCreate'](_0x2de258,{'transaction':_0x4a6694});});})['then'](function(){return db[_0xd988('0x75')][_0xd988('0xbb')]({'where':{'SmsAccountId':_0xb11960[_0xd988('0x65')]['id']},'order':'priority'});});}})[_0xd988('0x20')](respondWithResult(_0x1375bd,null))[_0xd988('0x2a')](handleError(_0x1375bd,null));};exports[_0xd988('0xbc')]=function(_0x2bb5b9,_0x18c981,_0x19917c){var _0x3b7abb={};var _0xda1780={};var _0x2d91a8;var _0x19c65b;return db[_0xd988('0x3f')][_0xd988('0x6b')]({'where':{'id':_0x2bb5b9[_0xd988('0x65')]['id']}})[_0xd988('0x20')](handleEntityNotFound(_0x18c981,null))[_0xd988('0x20')](function(_0x6f0c66){if(_0x6f0c66){_0x2d91a8=_0x6f0c66;_0xda1780[_0xd988('0x44')]=_[_0xd988('0x46')](db[_0xd988('0x75')][_0xd988('0x40')]);_0xda1780[_0xd988('0x45')]=_['keys'](_0x2bb5b9['query']);_0xda1780['filters']=_[_0xd988('0x48')](_0xda1780['model'],_0xda1780[_0xd988('0x45')]);_0x3b7abb['attributes']=_['intersection'](_0xda1780[_0xd988('0x44')],qs[_0xd988('0x4a')](_0x2bb5b9['query'][_0xd988('0x4a')]));_0x3b7abb[_0xd988('0x49')]=_0x3b7abb[_0xd988('0x49')][_0xd988('0x4b')]?_0x3b7abb[_0xd988('0x49')]:_0xda1780[_0xd988('0x44')];_0x3b7abb['order']=qs[_0xd988('0x4f')](_0x2bb5b9['query'][_0xd988('0x4f')]);_0x3b7abb[_0xd988('0x50')]=qs[_0xd988('0x47')](_[_0xd988('0x51')](_0x2bb5b9[_0xd988('0x45')],_0xda1780[_0xd988('0x47')]));if(_0x2bb5b9[_0xd988('0x45')]['filter']){_0x3b7abb[_0xd988('0x50')]=_['merge'](_0x3b7abb['where'],{'$or':_[_0xd988('0x3e')](_0x3b7abb[_0xd988('0x49')],function(_0x3180d5){var _0x41bcca={};_0x41bcca[_0x3180d5]={'$like':'%'+_0x2bb5b9[_0xd988('0x45')]['filter']+'%'};return _0x41bcca;})});}_0x3b7abb=_[_0xd988('0x52')]({},_0x3b7abb,_0x2bb5b9['options']);return _0x2d91a8[_0xd988('0xbc')](_0x3b7abb);}})[_0xd988('0x20')](function(_0x544102){if(_0x544102){_0x19c65b=_0x544102[_0xd988('0x4b')];if(!_0x2bb5b9['query'][_0xd988('0x4c')](_0xd988('0x4d'))){_0x3b7abb[_0xd988('0x31')]=qs[_0xd988('0x31')](_0x2bb5b9[_0xd988('0x45')][_0xd988('0x31')]);_0x3b7abb[_0xd988('0x2e')]=qs[_0xd988('0x2e')](_0x2bb5b9[_0xd988('0x45')][_0xd988('0x2e')]);}return _0x2d91a8['getApplications'](_0x3b7abb);}})[_0xd988('0x20')](function(_0x29a2f1){if(_0x29a2f1){return _0x29a2f1?{'count':_0x19c65b,'rows':_0x29a2f1}:null;}})[_0xd988('0x20')](respondWithResult(_0x18c981,null))['catch'](handleError(_0x18c981,null));};exports['getInteractions']=function(_0x207602,_0x5d84ad,_0x460ab7){var _0x25df74={'raw':![],'where':{}};var _0x239c62={};var _0x44dec5={'count':0x0,'rows':[]};return db[_0xd988('0x3f')][_0xd988('0x6b')]({'where':{'id':_0x207602[_0xd988('0x65')]['id']}})[_0xd988('0x20')](handleEntityNotFound(_0x5d84ad,null))['then'](function(_0x131360){if(_0x131360){_0x239c62[_0xd988('0x44')]=_['keys'](db[_0xd988('0xa3')][_0xd988('0x40')]);_0x239c62[_0xd988('0x45')]=_[_0xd988('0x46')](_0x207602['query']);_0x239c62[_0xd988('0x47')]=_[_0xd988('0x48')](_0x239c62['model'],_0x239c62['query']);_0x25df74['attributes']=_[_0xd988('0x48')](_0x239c62['model'],qs[_0xd988('0x4a')](_0x207602[_0xd988('0x45')][_0xd988('0x4a')]));_0x25df74[_0xd988('0x49')]=_0x25df74[_0xd988('0x49')][_0xd988('0x4b')]?_0x25df74[_0xd988('0x49')]:_0x239c62[_0xd988('0x44')];if(!_0x207602[_0xd988('0x45')][_0xd988('0x4c')](_0xd988('0x4d'))){_0x25df74['limit']=qs['limit'](_0x207602['query'][_0xd988('0x31')]);_0x25df74['offset']=qs[_0xd988('0x2e')](_0x207602[_0xd988('0x45')][_0xd988('0x2e')]);}_0x25df74[_0xd988('0x4e')]=qs[_0xd988('0x4f')](_0x207602['query'][_0xd988('0x4f')]);_0x25df74['where']=qs[_0xd988('0x47')](_[_0xd988('0x51')](_0x207602[_0xd988('0x45')],_0x239c62[_0xd988('0x47')]));_0x25df74[_0xd988('0x50')]['SmsAccountId']=_0x131360['id'];if(_0x207602[_0xd988('0x45')]['filter']){_0x25df74[_0xd988('0x50')]=_[_0xd988('0x52')](_0x25df74['where'],{'$or':_[_0xd988('0x3e')](_0x25df74[_0xd988('0x49')],function(_0x43c55f){var _0x539507={};_0x539507[_0x43c55f]={'$like':'%'+_0x207602[_0xd988('0x45')][_0xd988('0x54')]+'%'};return _0x539507;})});}_0x25df74=_[_0xd988('0x52')]({},_0x25df74,_0x207602['options']);return db[_0xd988('0xa3')][_0xd988('0x30')]({'where':_0x25df74['where']})[_0xd988('0x20')](function(_0x473d43){_0x44dec5[_0xd988('0x30')]=_0x473d43;if(_0x207602[_0xd988('0x45')][_0xd988('0x56')]){_0x25df74[_0xd988('0x57')]=[{'model':db[_0xd988('0x9e')],'as':_0xd988('0xbd'),'required':![]},{'model':db[_0xd988('0xad')],'as':_0xd988('0xbe'),'attributes':[_0xd988('0x39'),'fullname',_0xd988('0xbf')],'required':![]},{'model':db[_0xd988('0xc0')],'as':_0xd988('0xc1'),'attributes':['id',_0xd988('0x39'),_0xd988('0xc2')],'where':_0x207602[_0xd988('0x45')][_0xd988('0xc3')]?{'id':_0x207602[_0xd988('0x45')][_0xd988('0xc3')]}:undefined,'required':_0x207602[_0xd988('0x45')][_0xd988('0xc3')]?!![]:![]}];}return db[_0xd988('0xa3')][_0xd988('0x58')](_0x25df74);})[_0xd988('0x20')](function(_0x7065f6){_0x44dec5[_0xd988('0x6c')]=_0x7065f6;return _0x44dec5;});}})[_0xd988('0x20')](respondWithFilteredResult(_0x5d84ad,_0x25df74))['catch'](handleError(_0x5d84ad,null));};exports[_0xd988('0x3a')]=function(_0x3168d7,_0x17e7e2,_0x2a7787){var _0x471e66,_0x3a56b7,_0x95048a;if(_[_0xd988('0x99')](_0x3168d7['body'][_0xd988('0x5b')])||_0x3168d7[_0xd988('0x5b')][_0xd988('0x5b')]===''){throw new db[(_0xd988('0x7c'))][(_0xd988('0x97'))](_0xd988('0xc4'));}if(_['isNil'](_0x3168d7[_0xd988('0x5b')]['to'])){throw new db[(_0xd988('0x7c'))][(_0xd988('0x97'))](_0xd988('0xc5'));}_0x471e66=_0x3168d7['body']['to'];return db['SmsAccount']['find']({'where':{'id':_0x3168d7[_0xd988('0x65')]['id']},'include':[{'model':db[_0xd988('0x9d')],'as':_0xd988('0xc6'),'include':[{'model':db[_0xd988('0x9e')],'as':_0xd988('0x9f'),'where':{'mobile':_0x471e66},'limit':0x1,'order':[[_0xd988('0x7e'),'DESC']]}]}]})[_0xd988('0x20')](handleEntityNotFound(_0x17e7e2,null))[_0xd988('0x20')](function(_0x3c1a6e){if(_0x3c1a6e&&_0x3c1a6e[_0xd988('0xc6')]){_0x3a56b7=_0x3c1a6e[_0xd988('0x5d')]({'plain':!![]});if(_0x3a56b7[_0xd988('0xc6')]&&_0x3a56b7[_0xd988('0xc6')]['Contacts']['length']){return _0x3a56b7['List'][_0xd988('0x9f')][0x0];}return db[_0xd988('0x9e')][_0xd988('0x5a')](_[_0xd988('0x1a')](_0x3168d7[_0xd988('0x5b')],{'firstName':_0x471e66,'mobile':_0x471e66,'phone':_0x471e66,'ListId':_0x3a56b7['ListId']}));}})[_0xd988('0x20')](handleEntityNotFound(_0x17e7e2,null))[_0xd988('0x20')](function(_0x3d7784){if(_0x3d7784){_0x95048a=_0x3d7784;return db[_0xd988('0xa3')][_0xd988('0x64')]({'where':{'ContactId':_0x95048a['id'],'closed':![],'SmsAccountId':_0x3a56b7['id']}})[_0xd988('0x20')](function(_0x2100e4){if(_0x2100e4){return[_0x2100e4,![]];}return db[_0xd988('0xa3')][_0xd988('0x5a')]({'UserId':_0x3168d7['user']['id'],'ContactId':_0x95048a['id'],'SmsAccountId':_0x3a56b7['id'],'phone':_0x471e66,'firstMsgDirection':_0xd988('0xc7'),'Messages':[_[_0xd988('0x52')](_0x3168d7[_0xd988('0x5b')],{'read':![],'body':_0x3168d7[_0xd988('0x5b')]['body'],'phone':_0x471e66,'SmsAccountId':_0x3a56b7['id'],'UserId':_0x3168d7['user']['id'],'ContactId':_0x95048a['id']})]},{'include':[{'model':db[_0xd988('0xaa')],'as':_0xd988('0xc8')}]})[_0xd988('0x20')](function(_0x2165e0){return[_0x2165e0,!![]];});});}})[_0xd988('0xa4')](function(_0x106861,_0x1d9659){if(_0x1d9659){return _0x106861;}return db[_0xd988('0xaa')][_0xd988('0x5a')](_['merge'](_0x3168d7[_0xd988('0x5b')],{'read':![],'body':_0x3168d7[_0xd988('0x5b')][_0xd988('0x5b')],'phone':_0x471e66,'SmsAccountId':_0x3a56b7['id'],'SmsInteractionId':_0x106861['id'],'UserId':_0x3168d7[_0xd988('0x5c')]['id'],'ContactId':_0x95048a['id']}))[_0xd988('0x20')](function(_0x28db8c){_0x106861['dataValues'][_0xd988('0xc8')]=[];_0x106861[_0xd988('0xc9')][_0xd988('0xc8')][_0xd988('0xca')](_0x28db8c[_0xd988('0xc9')]);return _0x106861;});})['then'](respondWithResult(_0x17e7e2,null))[_0xd988('0x2a')](handleError(_0x17e7e2,null));};exports[_0xd988('0x2b')]=function(_0x4b1f02,_0x221fc6,_0x5d2804){if(_0x4b1f02[_0xd988('0x5b')]['id']){delete _0x4b1f02[_0xd988('0x5b')]['id'];}var _0x4334ed,_0x1bc909,_0x231a65;return db[_0xd988('0x3f')][_0xd988('0x64')]({'where':{'id':_0x4b1f02[_0xd988('0x65')]['id']}})[_0xd988('0x20')](handleEntityNotFound(_0x221fc6,null))['then'](function(_0x3deb1a){if(_0x3deb1a){_0x231a65=_0x3deb1a;logger[_0xd988('0x24')](_0xd988('0x25'),_0xd988('0x2b'),_0xd988('0xcb'),_0x3deb1a[_0xd988('0x42')],util[_0xd988('0xcc')](_0x4b1f02[_0xd988('0x5b')],{'showHidden':![],'depth':null}));switch(_0x3deb1a['type']){case _0xd988('0x87'):if(_0x4b1f02['body']['skebby_dispatch_id']&&_0x4b1f02[_0xd988('0x5b')][_0xd988('0x2b')]){_0x1bc909=_0x4b1f02[_0xd988('0x5b')][_0xd988('0x2b')];return db[_0xd988('0xaa')][_0xd988('0x64')]({'where':{'messageId':_0x4b1f02[_0xd988('0x5b')][_0xd988('0xcd')]}});}break;case _0xd988('0xce'):if(_0x4b1f02[_0xd988('0x5b')][_0xd988('0xcf')]&&_0x4b1f02['body'][_0xd988('0xd0')]){_0x1bc909=_0x4b1f02[_0xd988('0x5b')][_0xd988('0xd0')];return db[_0xd988('0xaa')][_0xd988('0x64')]({'where':{'messageId':_0x4b1f02[_0xd988('0x5b')][_0xd988('0xcf')]}});}break;case _0xd988('0x8a'):if(_0x4b1f02['body'][_0xd988('0xd1')]&&_0x4b1f02[_0xd988('0x5b')][_0xd988('0xd2')]){_0x1bc909=_0x4b1f02[_0xd988('0x5b')]['status_code'];return db[_0xd988('0xaa')]['find']({'where':{'messageId':_0x4b1f02[_0xd988('0x5b')][_0xd988('0xd1')]}});}break;case'infobip':var _0x34d44b=_0x4b1f02[_0xd988('0x5b')][_0xd988('0x8e')][0x0];if(_0x34d44b['messageId']&&_0x34d44b[_0xd988('0x2b')][_0xd988('0xd3')]===_0xd988('0xd4')){_0x1bc909=_0x34d44b[_0xd988('0x2b')][_0xd988('0xd3')];return db[_0xd988('0xaa')]['find']({'where':{'messageId':_0x34d44b[_0xd988('0x85')]}});}break;case'clickatell':if(_0x4b1f02[_0xd988('0x5b')][_0xd988('0x85')]&&_0x4b1f02[_0xd988('0x5b')]['status']){_0x1bc909=_0x4b1f02[_0xd988('0x5b')][_0xd988('0x2b')];return db[_0xd988('0xaa')][_0xd988('0x64')]({'where':{'messageId':_0x4b1f02[_0xd988('0x5b')][_0xd988('0x85')]}});}break;case _0xd988('0x94'):if(_0x4b1f02['body'][0x0]['message']['id']){_0x1bc909=_0x4b1f02['body'][0x0][_0xd988('0x42')];return db[_0xd988('0xaa')]['find']({'where':{'messageId':_0x4b1f02[_0xd988('0x5b')][0x0][_0xd988('0x28')]['id']}});}break;case _0xd988('0x95'):if(_0x4b1f02[_0xd988('0x5b')][_0xd988('0xd5')]&&_0x4b1f02[_0xd988('0x5b')][_0xd988('0x2b')]){_0x1bc909=_0x4b1f02[_0xd988('0x5b')][_0xd988('0x2b')];return db[_0xd988('0xaa')][_0xd988('0x64')]({'where':{'messageId':_0x4b1f02['body'][_0xd988('0xd5')]}});}break;}}})[_0xd988('0x20')](handleEntityNotFound(_0x221fc6,null))[_0xd988('0x20')](function(_0x198b18){if(_0x198b18){_0x4334ed=_0x198b18;switch(_0x231a65[_0xd988('0x42')]){case _0xd988('0x87'):if(_0x1bc909===_0xd988('0xd4')){return _0x4334ed[_0xd988('0x63')]({'read':!![]});}else{logger[_0xd988('0x27')](_0xd988('0x25'),'status','skebby',util[_0xd988('0xcc')](_0x4b1f02[_0xd988('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xd988('0xce'):if(_0x1bc909==='1'){return _0x4334ed[_0xd988('0x63')]({'read':!![]});}else{logger[_0xd988('0x27')](_0xd988('0x25'),'status',_0xd988('0x87'),util[_0xd988('0xcc')](_0x4b1f02[_0xd988('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xd988('0x8a'):if(!_0x4b1f02[_0xd988('0x5b')][_0xd988('0xd6')]&&_0x1bc909>=0xc8&&_0x1bc909<=0xce){return _0x4334ed['update']({'read':!![]});}else{logger['error'](_0xd988('0x25'),_0xd988('0x2b'),_0xd988('0x8a'),util[_0xd988('0xcc')](_0x4b1f02[_0xd988('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xd988('0xd7'):var _0x41fbbc=_0x4b1f02[_0xd988('0x5b')][_0xd988('0x8e')][0x0];if(_0x41fbbc[_0xd988('0x2b')][_0xd988('0xd3')]===_0xd988('0xd4')){return _0x4334ed[_0xd988('0x63')]({'read':!![]});}else{logger[_0xd988('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xd988('0xd7'),util[_0xd988('0xcc')](_0x4b1f02[_0xd988('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xd988('0x92'):if(_0x1bc909=='DELIVERED_TO_GATEWAY'||_0x1bc909=='RECEIVED_BY_RECIPIENT'){return _0x4334ed[_0xd988('0x63')]({'read':!![]});}else{logger[_0xd988('0x27')](_0xd988('0x25'),_0xd988('0x2b'),_0xd988('0x92'),util[_0xd988('0xcc')](_0x4b1f02['body'],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x1bc909==_0xd988('0xd8')){return _0x4334ed[_0xd988('0x63')]({'read':!![]});}else{logger['error'](_0xd988('0x25'),_0xd988('0x2b'),_0xd988('0x94'),util['inspect'](_0x4b1f02[_0xd988('0x5b')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x1bc909===_0xd988('0xd9')||_0x1bc909===_0xd988('0xda')){return _0x4334ed[_0xd988('0x63')]({'read':!![]});}else{logger[_0xd988('0x27')](_0xd988('0x25'),_0xd988('0x2b'),_0xd988('0x95'),util[_0xd988('0xcc')](_0x4b1f02[_0xd988('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x4334ed;}})['then'](respondWithResult(_0x221fc6,null))[_0xd988('0x2a')](handleError(_0x221fc6,null));};exports[_0xd988('0xdb')]=function(_0x2c69bd,_0x3bfd3c,_0xd4526b){var _0x1f8057,_0x6339bd,_0x121266;return db['SmsAccount']['find']({'where':{'id':_0x2c69bd['params']['id']}})[_0xd988('0x20')](handleEntityNotFound(_0x3bfd3c,null))[_0xd988('0x20')](function(_0x38cdaa){if(_0x38cdaa){_0x121266=_0x38cdaa;logger[_0xd988('0x24')](_0xd988('0x25'),'status','received\x20delivery\x20report\x20from',_0x38cdaa['type'],util[_0xd988('0xcc')](_0x2c69bd[_0xd988('0x45')],{'showHidden':![],'depth':null}));switch(_0x38cdaa['type']){case _0xd988('0x8f'):if(_0x2c69bd['query']['message-id']&&_0x2c69bd[_0xd988('0x45')]['state']){_0x6339bd=_0x2c69bd[_0xd988('0x45')][_0xd988('0xdc')];return db[_0xd988('0xaa')][_0xd988('0x64')]({'where':{'messageId':_0x2c69bd[_0xd988('0x45')][_0xd988('0xdd')]}});}break;}}})[_0xd988('0x20')](handleEntityNotFound(_0x3bfd3c,null))['then'](function(_0x165848){if(_0x165848){_0x1f8057=_0x165848;switch(_0x121266[_0xd988('0x42')]){case _0xd988('0x8f'):if(_0x6339bd==='2'||_0x6339bd==='6'){return _0x1f8057['update']({'read':!![]});}else{logger['error'](_0xd988('0x25'),'status','csc',util[_0xd988('0xcc')](_0x2c69bd['query'],{'showHidden':![],'depth':null}));};break;}return _0x1f8057;}})[_0xd988('0x20')](respondWithResult(_0x3bfd3c,null))['catch'](handleError(_0x3bfd3c,null));};exports[_0xd988('0xde')]=function(_0x21e247,_0x1b21b8,_0x1cf553){return db['SmsAccount']['find']({'where':{'id':_0x21e247[_0xd988('0x65')]['id']}})['then'](handleEntityNotFound(_0x1b21b8,null))[_0xd988('0x20')](function(_0x3d6c82){if(_0x3d6c82){return _0x3d6c82[_0xd988('0xde')](_0x21e247[_0xd988('0x5b')][_0xd988('0x6e')],_[_0xd988('0xa1')](_0x21e247[_0xd988('0x5b')],['ids','id'])||{})[_0xd988('0xa4')](function(_0x534e5a){for(var _0x3e9dd6=0x0;_0x3e9dd6<_0x21e247[_0xd988('0x5b')]['ids'][_0xd988('0x4b')];_0x3e9dd6+=0x1){socket[_0xd988('0xdf')](_0xd988('0xe0'),{'UserId':Number(_0x21e247[_0xd988('0x5b')][_0xd988('0x6e')][_0x3e9dd6]),'SmsAccountId':Number(_0x21e247[_0xd988('0x65')]['id'])});}return _0x534e5a;});}})[_0xd988('0x20')](respondWithResult(_0x1b21b8,null))[_0xd988('0x2a')](handleError(_0x1b21b8,null));};exports[_0xd988('0xe1')]=function(_0xbcb32,_0x56990f,_0x18ce7e){return db[_0xd988('0x3f')][_0xd988('0x64')]({'where':{'id':_0xbcb32[_0xd988('0x65')]['id']}})[_0xd988('0x20')](handleEntityNotFound(_0x56990f,null))[_0xd988('0x20')](function(_0x3a50dc){if(_0x3a50dc){return _0x3a50dc[_0xd988('0xe1')](_0xbcb32['query']['ids'])[_0xd988('0x20')](function(){if(_['isArray'](_0xbcb32[_0xd988('0x45')][_0xd988('0x6e')])){for(var _0x1d86a7=0x0;_0x1d86a7<_0xbcb32[_0xd988('0x45')]['ids'][_0xd988('0x4b')];_0x1d86a7+=0x1){socket[_0xd988('0xdf')](_0xd988('0xe2'),{'UserId':Number(_0xbcb32[_0xd988('0x45')][_0xd988('0x6e')][_0x1d86a7]),'SmsAccountId':Number(_0xbcb32[_0xd988('0x65')]['id'])});}}else{socket[_0xd988('0xdf')](_0xd988('0xe2'),{'UserId':Number(_0xbcb32[_0xd988('0x45')][_0xd988('0x6e')]),'SmsAccountId':Number(_0xbcb32[_0xd988('0x65')]['id'])});}});}})[_0xd988('0x20')](respondWithStatusCode(_0x56990f,null))[_0xd988('0x2a')](handleError(_0x56990f,null));};exports[_0xd988('0xe3')]=function(_0x53c359,_0x11df48,_0x491047){var _0x213dab={};var _0x477157={};var _0x560ee6;var _0x18db89;return db[_0xd988('0x3f')][_0xd988('0x6b')]({'where':{'id':_0x53c359[_0xd988('0x65')]['id']}})[_0xd988('0x20')](handleEntityNotFound(_0x11df48,null))['then'](function(_0x204666){if(_0x204666){_0x560ee6=_0x204666;_0x477157[_0xd988('0x44')]=_[_0xd988('0x46')](db[_0xd988('0xad')][_0xd988('0x40')]);_0x477157[_0xd988('0x45')]=_['keys'](_0x53c359[_0xd988('0x45')]);_0x477157[_0xd988('0x47')]=_[_0xd988('0x48')](_0x477157['model'],_0x477157['query']);_0x213dab[_0xd988('0x49')]=_[_0xd988('0x48')](_0x477157['model'],qs[_0xd988('0x4a')](_0x53c359['query'][_0xd988('0x4a')]));_0x213dab['attributes']=_0x213dab[_0xd988('0x49')][_0xd988('0x4b')]?_0x213dab[_0xd988('0x49')]:_0x477157[_0xd988('0x44')];_0x213dab[_0xd988('0x4e')]=qs[_0xd988('0x4f')](_0x53c359['query'][_0xd988('0x4f')]);_0x213dab[_0xd988('0x50')]=qs[_0xd988('0x47')](_[_0xd988('0x51')](_0x53c359[_0xd988('0x45')],_0x477157[_0xd988('0x47')]));if(_0x53c359[_0xd988('0x45')]['filter']){_0x213dab[_0xd988('0x50')]=_[_0xd988('0x52')](_0x213dab['where'],{'$or':_[_0xd988('0x3e')](_0x213dab[_0xd988('0x49')],function(_0x41d311){var _0x1e33b0={};_0x1e33b0[_0x41d311]={'$like':'%'+_0x53c359[_0xd988('0x45')][_0xd988('0x54')]+'%'};return _0x1e33b0;})});}_0x213dab=_['merge']({},_0x213dab,_0x53c359[_0xd988('0x55')]);return _0x560ee6[_0xd988('0xe3')](_0x213dab);}})[_0xd988('0x20')](function(_0x3229ca){if(_0x3229ca){_0x18db89=_0x3229ca[_0xd988('0x4b')];if(!_0x53c359[_0xd988('0x45')]['hasOwnProperty']('nolimit')){_0x213dab['limit']=qs[_0xd988('0x31')](_0x53c359['query'][_0xd988('0x31')]);_0x213dab[_0xd988('0x2e')]=qs[_0xd988('0x2e')](_0x53c359[_0xd988('0x45')][_0xd988('0x2e')]);}return _0x560ee6[_0xd988('0xe3')](_0x213dab);}})[_0xd988('0x20')](function(_0x58ffcf){if(_0x58ffcf){return _0x58ffcf?{'count':_0x18db89,'rows':_0x58ffcf}:null;}})['then'](respondWithResult(_0x11df48,null))['catch'](handleError(_0x11df48,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index a0ac1a7..3cae663 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 _0x3336=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners'];(function(_0x3467be,_0x2ac1e4){var _0x17638e=function(_0x403cd9){while(--_0x403cd9){_0x3467be['push'](_0x3467be['shift']());}};_0x17638e(++_0x2ac1e4);}(_0x3336,0xec));var _0x6333=function(_0x3ceb54,_0x5bddfd){_0x3ceb54=_0x3ceb54-0x0;var _0x26d8a6=_0x3336[_0x3ceb54];return _0x26d8a6;};'use strict';var EventEmitter=require(_0x6333('0x0'));var SmsAccount=require(_0x6333('0x1'))['db'][_0x6333('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x6333('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6333('0x4'),'afterDestroy':_0x6333('0x5')};function emitEvent(_0x4522d2){return function(_0x598c75,_0xe29d53,_0x397361){SmsAccountEvents[_0x6333('0x6')](_0x4522d2+':'+_0x598c75['id'],_0x598c75);SmsAccountEvents[_0x6333('0x6')](_0x4522d2,_0x598c75);_0x397361(null);};}for(var e in events){if(events[_0x6333('0x7')](e)){var event=events[e];SmsAccount[_0x6333('0x8')](e,emitEvent(event));}}module[_0x6333('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0x96f0=['SmsAccount','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xd4db61,_0x5959e7){var _0x5dd72d=function(_0x5c6c18){while(--_0x5c6c18){_0xd4db61['push'](_0xd4db61['shift']());}};_0x5dd72d(++_0x5959e7);}(_0x96f0,0x19c));var _0x096f=function(_0x454165,_0x1f3e74){_0x454165=_0x454165-0x0;var _0x56db53=_0x96f0[_0x454165];return _0x56db53;};'use strict';var EventEmitter=require(_0x096f('0x0'));var SmsAccount=require(_0x096f('0x1'))['db'][_0x096f('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x096f('0x3'),'afterDestroy':_0x096f('0x4')};function emitEvent(_0x1454ff){return function(_0x4e9147,_0xc261c2,_0xb070d1){SmsAccountEvents['emit'](_0x1454ff+':'+_0x4e9147['id'],_0x4e9147);SmsAccountEvents[_0x096f('0x5')](_0x1454ff,_0x4e9147);_0xb070d1(null);};}for(var e in events){if(events[_0x096f('0x6')](e)){var event=events[e];SmsAccount[_0x096f('0x7')](e,emitEvent(event));}}module[_0x096f('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index e4a780d..a759b4d 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 _0x1172=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsAccount','sms_accounts','lodash'];(function(_0x21a209,_0x1b8347){var _0x40c2a8=function(_0x25ed46){while(--_0x25ed46){_0x21a209['push'](_0x21a209['shift']());}};_0x40c2a8(++_0x1b8347);}(_0x1172,0x74));var _0x2117=function(_0xaddc10,_0x245577){_0xaddc10=_0xaddc10-0x0;var _0x53f756=_0x1172[_0xaddc10];return _0x53f756;};'use strict';var _=require(_0x2117('0x0'));var util=require(_0x2117('0x1'));var logger=require('../../config/logger')(_0x2117('0x2'));var moment=require(_0x2117('0x3'));var BPromise=require(_0x2117('0x4'));var rp=require(_0x2117('0x5'));var fs=require('fs');var path=require(_0x2117('0x6'));var rimraf=require(_0x2117('0x7'));var config=require(_0x2117('0x8'));var attributes=require('./smsAccount.attributes');module[_0x2117('0x9')]=function(_0x3635f3,_0x239fee){return _0x3635f3[_0x2117('0xa')](_0x2117('0xb'),attributes,{'tableName':_0x2117('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x234e=['request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','sms_accounts','lodash','../../config/logger','api','moment','bluebird'];(function(_0x5b13c3,_0x378e0a){var _0x3d6780=function(_0x6327a6){while(--_0x6327a6){_0x5b13c3['push'](_0x5b13c3['shift']());}};_0x3d6780(++_0x378e0a);}(_0x234e,0x1db));var _0xe234=function(_0x4da94f,_0x1abacc){_0x4da94f=_0x4da94f-0x0;var _0x278995=_0x234e[_0x4da94f];return _0x278995;};'use strict';var _=require(_0xe234('0x0'));var util=require('util');var logger=require(_0xe234('0x1'))(_0xe234('0x2'));var moment=require(_0xe234('0x3'));var BPromise=require(_0xe234('0x4'));var rp=require(_0xe234('0x5'));var fs=require('fs');var path=require(_0xe234('0x6'));var rimraf=require(_0xe234('0x7'));var config=require(_0xe234('0x8'));var attributes=require(_0xe234('0x9'));module[_0xe234('0xa')]=function(_0x4e51f8,_0x1021a0){return _0x4e51f8['define']('SmsAccount',attributes,{'tableName':_0xe234('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 5a26078..00d07a6 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 _0xf7c0=['socket.io-emitter','./smsAccount.socket','register','request','then','request\x20sent','debug','error','code','SmsAccount,\x20%s,\x20%s','message','result','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','model','info','stringify','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0xf5dbcd,_0x357be8){var _0x22fc45=function(_0x24adf8){while(--_0x24adf8){_0xf5dbcd['push'](_0xf5dbcd['shift']());}};_0x22fc45(++_0x357be8);}(_0xf7c0,0x12f));var _0x0f7c=function(_0x4cf01b,_0x51aada){_0x4cf01b=_0x4cf01b-0x0;var _0x1c1669=_0xf7c0[_0x4cf01b];return _0x1c1669;};'use strict';var _=require(_0x0f7c('0x0'));var util=require('util');var moment=require(_0x0f7c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f7c('0x2'));var db=require(_0x0f7c('0x3'))['db'];var utils=require(_0x0f7c('0x4'));var logger=require('../../config/logger')(_0x0f7c('0x5'));var config=require(_0x0f7c('0x6'));var jayson=require(_0x0f7c('0x7'));var client=jayson[_0x0f7c('0x8')][_0x0f7c('0x9')]({'port':0x232a});config[_0x0f7c('0xa')]=_['defaults'](config['redis'],{'host':_0x0f7c('0xb'),'port':0x18eb});var socket=require(_0x0f7c('0xc'))(new Redis(config['redis']));require(_0x0f7c('0xd'))[_0x0f7c('0xe')](socket);function respondWithRpcPromise(_0x4a0499,_0x31f6b5,_0x24be77){return new BPromise(function(_0x3e2bc3,_0xd99ab1){return client[_0x0f7c('0xf')](_0x4a0499,_0x24be77)[_0x0f7c('0x10')](function(_0x327064){logger['info']('SmsAccount,\x20%s,\x20%s',_0x31f6b5,_0x0f7c('0x11'));logger[_0x0f7c('0x12')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x31f6b5,'request\x20sent',JSON['stringify'](_0x327064));if(_0x327064[_0x0f7c('0x13')]){if(_0x327064['error'][_0x0f7c('0x14')]===0x1f4){logger[_0x0f7c('0x13')](_0x0f7c('0x15'),_0x31f6b5,_0x327064[_0x0f7c('0x13')][_0x0f7c('0x16')]);return _0xd99ab1(_0x327064['error'][_0x0f7c('0x16')]);}logger[_0x0f7c('0x13')]('SmsAccount,\x20%s,\x20%s',_0x31f6b5,_0x327064[_0x0f7c('0x13')]['message']);return _0x3e2bc3(_0x327064[_0x0f7c('0x13')][_0x0f7c('0x16')]);}else{logger['info'](_0x0f7c('0x15'),_0x31f6b5,'request\x20sent');_0x3e2bc3(_0x327064[_0x0f7c('0x17')][_0x0f7c('0x16')]);}})['catch'](function(_0x21b79a){logger[_0x0f7c('0x13')]('SmsAccount,\x20%s,\x20%s',_0x31f6b5,_0x21b79a);_0xd99ab1(_0x21b79a);});});}exports[_0x0f7c('0x18')]=function(_0x290fce){var _0x3fcbda=this;return new Promise(function(_0x159a2d,_0x2d0b49){return db[_0x0f7c('0x19')][_0x0f7c('0x1a')]({'raw':_0x290fce[_0x0f7c('0x1b')]?_0x290fce[_0x0f7c('0x1b')][_0x0f7c('0x1c')]===undefined?!![]:![]:!![],'where':_0x290fce[_0x0f7c('0x1b')]?_0x290fce['options'][_0x0f7c('0x1d')]||null:null,'attributes':_0x290fce[_0x0f7c('0x1b')]?_0x290fce[_0x0f7c('0x1b')][_0x0f7c('0x1e')]||null:null,'include':_0x290fce[_0x0f7c('0x1b')]?_0x290fce[_0x0f7c('0x1b')]['include']?_['map'](_0x290fce[_0x0f7c('0x1b')][_0x0f7c('0x1f')],function(_0x56794b){return{'model':db[_0x56794b[_0x0f7c('0x20')]],'as':_0x56794b['as'],'attributes':_0x56794b[_0x0f7c('0x1e')],'include':_0x56794b[_0x0f7c('0x1f')]?_['map'](_0x56794b[_0x0f7c('0x1f')],function(_0x4ccf72){return{'model':db[_0x4ccf72['model']],'as':_0x4ccf72['as'],'attributes':_0x4ccf72[_0x0f7c('0x1e')],'include':_0x4ccf72[_0x0f7c('0x1f')]?_['map'](_0x4ccf72[_0x0f7c('0x1f')],function(_0x3be7ca){return{'model':db[_0x3be7ca['model']],'as':_0x3be7ca['as'],'attributes':_0x3be7ca['attributes']};}):[]};}):[]};}):[]:[]})[_0x0f7c('0x10')](function(_0xac92ea){logger[_0x0f7c('0x21')](_0x0f7c('0x18'),_0x290fce);logger[_0x0f7c('0x12')](_0x0f7c('0x18'),_0x290fce,JSON[_0x0f7c('0x22')](_0xac92ea));_0x159a2d(_0xac92ea);})['catch'](function(_0x182aac){logger[_0x0f7c('0x13')]('ShowSmsAccount',_0x182aac['message'],_0x290fce);_0x2d0b49(_0x3fcbda[_0x0f7c('0x13')](0x1f4,_0x182aac['message']));});});}; \ No newline at end of file +var _0xc74f=['http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','attributes','map','include','model','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x144aa4,_0x4f2d0c){var _0x43368c=function(_0x30cbaf){while(--_0x30cbaf){_0x144aa4['push'](_0x144aa4['shift']());}};_0x43368c(++_0x4f2d0c);}(_0xc74f,0x1a8));var _0xfc74=function(_0x4dece9,_0x1627e3){_0x4dece9=_0x4dece9-0x0;var _0x404d91=_0xc74f[_0x4dece9];return _0x404d91;};'use strict';var _=require('lodash');var util=require(_0xfc74('0x0'));var moment=require('moment');var BPromise=require(_0xfc74('0x1'));var rs=require(_0xfc74('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc74('0x3'))['db'];var utils=require(_0xfc74('0x4'));var logger=require(_0xfc74('0x5'))(_0xfc74('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfc74('0x7')][_0xfc74('0x8')]({'port':0x232a});config[_0xfc74('0x9')]=_[_0xfc74('0xa')](config[_0xfc74('0x9')],{'host':_0xfc74('0xb'),'port':0x18eb});var socket=require(_0xfc74('0xc'))(new Redis(config[_0xfc74('0x9')]));require('./smsAccount.socket')[_0xfc74('0xd')](socket);function respondWithRpcPromise(_0x1c1665,_0x25f8d0,_0x3e979a){return new BPromise(function(_0xc1fdea,_0x4e2f04){return client[_0xfc74('0xe')](_0x1c1665,_0x3e979a)[_0xfc74('0xf')](function(_0x30ba66){logger[_0xfc74('0x10')](_0xfc74('0x11'),_0x25f8d0,'request\x20sent');logger[_0xfc74('0x12')](_0xfc74('0x13'),_0x25f8d0,_0xfc74('0x14'),JSON[_0xfc74('0x15')](_0x30ba66));if(_0x30ba66[_0xfc74('0x16')]){if(_0x30ba66[_0xfc74('0x16')][_0xfc74('0x17')]===0x1f4){logger[_0xfc74('0x16')](_0xfc74('0x11'),_0x25f8d0,_0x30ba66[_0xfc74('0x16')][_0xfc74('0x18')]);return _0x4e2f04(_0x30ba66['error'][_0xfc74('0x18')]);}logger[_0xfc74('0x16')]('SmsAccount,\x20%s,\x20%s',_0x25f8d0,_0x30ba66[_0xfc74('0x16')]['message']);return _0xc1fdea(_0x30ba66[_0xfc74('0x16')]['message']);}else{logger['info'](_0xfc74('0x11'),_0x25f8d0,_0xfc74('0x14'));_0xc1fdea(_0x30ba66[_0xfc74('0x19')]['message']);}})[_0xfc74('0x1a')](function(_0x394c31){logger['error'](_0xfc74('0x11'),_0x25f8d0,_0x394c31);_0x4e2f04(_0x394c31);});});}exports[_0xfc74('0x1b')]=function(_0x17487f){var _0x409770=this;return new Promise(function(_0x834093,_0x5dca6f){return db[_0xfc74('0x1c')][_0xfc74('0x1d')]({'raw':_0x17487f['options']?_0x17487f[_0xfc74('0x1e')][_0xfc74('0x1f')]===undefined?!![]:![]:!![],'where':_0x17487f[_0xfc74('0x1e')]?_0x17487f[_0xfc74('0x1e')]['where']||null:null,'attributes':_0x17487f[_0xfc74('0x1e')]?_0x17487f[_0xfc74('0x1e')][_0xfc74('0x20')]||null:null,'include':_0x17487f['options']?_0x17487f[_0xfc74('0x1e')]['include']?_[_0xfc74('0x21')](_0x17487f[_0xfc74('0x1e')][_0xfc74('0x22')],function(_0x47d032){return{'model':db[_0x47d032['model']],'as':_0x47d032['as'],'attributes':_0x47d032[_0xfc74('0x20')],'include':_0x47d032['include']?_[_0xfc74('0x21')](_0x47d032[_0xfc74('0x22')],function(_0x200a70){return{'model':db[_0x200a70[_0xfc74('0x23')]],'as':_0x200a70['as'],'attributes':_0x200a70[_0xfc74('0x20')],'include':_0x200a70[_0xfc74('0x22')]?_[_0xfc74('0x21')](_0x200a70[_0xfc74('0x22')],function(_0x2b772f){return{'model':db[_0x2b772f['model']],'as':_0x2b772f['as'],'attributes':_0x2b772f['attributes']};}):[]};}):[]};}):[]:[]})[_0xfc74('0xf')](function(_0x4f3d57){logger[_0xfc74('0x10')]('ShowSmsAccount',_0x17487f);logger['debug']('ShowSmsAccount',_0x17487f,JSON['stringify'](_0x4f3d57));_0x834093(_0x4f3d57);})[_0xfc74('0x1a')](function(_0x37eee5){logger[_0xfc74('0x16')](_0xfc74('0x1b'),_0x37eee5[_0xfc74('0x18')],_0x17487f);_0x5dca6f(_0x409770['error'](0x1f4,_0x37eee5['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 0a49b45..c52dcca 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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 51dc436..15229b2 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 _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x56a7dd,_0x3fd9ae){var _0xc7b980=function(_0x34221b){while(--_0x34221b){_0x56a7dd['push'](_0x56a7dd['shift']());}};_0xc7b980(++_0x3fd9ae);}(_0x34e8,0x12c));var _0x834e=function(_0x179bd2,_0x3ac4c7){_0x179bd2=_0x179bd2-0x0;var _0x1d9d25=_0x34e8[_0x179bd2];return _0x1d9d25;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file +var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x29975a,_0x2ca253){var _0x41bcac=function(_0x4023ba){while(--_0x4023ba){_0x29975a['push'](_0x29975a['shift']());}};_0x41bcac(++_0x2ca253);}(_0x3e74,0x175));var _0x43e7=function(_0x208578,_0x41abc9){_0x208578=_0x208578-0x0;var _0x195163=_0x3e74[_0x208578];return _0x195163;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index d9dcbad..a2ec04c 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 _0xabbb=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x47408e,_0x481428){var _0x1636bc=function(_0x2fe7a6){while(--_0x2fe7a6){_0x47408e['push'](_0x47408e['shift']());}};_0x1636bc(++_0x481428);}(_0xabbb,0x167));var _0xbabb=function(_0x283142,_0x1d50e4){_0x283142=_0x283142-0x0;var _0x49aa77=_0xabbb[_0x283142];return _0x49aa77;};'use strict';var Sequelize=require(_0xbabb('0x0'));module[_0xbabb('0x1')]={'priority':{'type':Sequelize[_0xbabb('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xbabb('0x3')],'allowNull':![],'defaultValue':_0xbabb('0x4')},'appdata':{'type':Sequelize[_0xbabb('0x5')]()},'description':{'type':Sequelize[_0xbabb('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xbabb('0x6')}}; \ No newline at end of file +var _0x72cc=['TEXT','*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x38f3dd,_0x2000f5){var _0x3e062a=function(_0x33d12a){while(--_0x33d12a){_0x38f3dd['push'](_0x38f3dd['shift']());}};_0x3e062a(++_0x2000f5);}(_0x72cc,0x152));var _0xc72c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x72cc[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0xc72c('0x0'));module['exports']={'priority':{'type':Sequelize[_0xc72c('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xc72c('0x2')],'allowNull':![],'defaultValue':_0xc72c('0x3')},'appdata':{'type':Sequelize[_0xc72c('0x4')]()},'description':{'type':Sequelize[_0xc72c('0x2')]},'interval':{'type':Sequelize[_0xc72c('0x2')],'defaultValue':_0xc72c('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index c319ec9..6e40571 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 _0x5f91=['destroy','sendStatus','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','keys','length','create','body','find','params','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then'];(function(_0x1711fa,_0xcc2e28){var _0x4c615c=function(_0x138f60){while(--_0x138f60){_0x1711fa['push'](_0x1711fa['shift']());}};_0x4c615c(++_0xcc2e28);}(_0x5f91,0x1ea));var _0x15f9=function(_0x2f63a9,_0x1cb005){_0x2f63a9=_0x2f63a9-0x0;var _0xdb29ef=_0x5f91[_0x2f63a9];return _0xdb29ef;};'use strict';var emlformat=require(_0x15f9('0x0'));var rimraf=require(_0x15f9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x15f9('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x15f9('0x3'));var Mustache=require(_0x15f9('0x4'));var util=require(_0x15f9('0x5'));var path=require(_0x15f9('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x15f9('0x7'));var _=require('lodash');var squel=require(_0x15f9('0x8'));var crypto=require(_0x15f9('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x15f9('0xa'));var toCsv=require(_0x15f9('0xb'));var querystring=require(_0x15f9('0xc'));var Papa=require(_0x15f9('0xd'));var Redis=require(_0x15f9('0xe'));var authService=require(_0x15f9('0xf'));var qs=require(_0x15f9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x15f9('0x11'));var logger=require('../../config/logger')(_0x15f9('0x12'));var utils=require(_0x15f9('0x13'));var config=require(_0x15f9('0x14'));var licenseUtil=require(_0x15f9('0x15'));var db=require(_0x15f9('0x16'))['db'];function respondWithStatusCode(_0x5310c7,_0xbd1818){_0xbd1818=_0xbd1818||0xcc;return function(_0xa25095){if(_0xa25095){return _0x5310c7['sendStatus'](_0xbd1818);}return _0x5310c7[_0x15f9('0x17')](_0xbd1818)[_0x15f9('0x18')]();};}function respondWithResult(_0x2f13f0,_0x2cdfef){_0x2cdfef=_0x2cdfef||0xc8;return function(_0x453e44){if(_0x453e44){return _0x2f13f0['status'](_0x2cdfef)[_0x15f9('0x19')](_0x453e44);}};}function respondWithFilteredResult(_0x5097e8,_0x4dba54){return function(_0x59d8ce){if(_0x59d8ce){var _0x674f7d=typeof _0x4dba54[_0x15f9('0x1a')]===_0x15f9('0x1b')&&typeof _0x4dba54['limit']==='undefined';var _0x3f71a5=_0x59d8ce[_0x15f9('0x1c')];var _0x5cecc1=_0x674f7d?0x0:_0x4dba54[_0x15f9('0x1a')];var _0x3e553d=_0x674f7d?_0x59d8ce[_0x15f9('0x1c')]:_0x4dba54[_0x15f9('0x1a')]+_0x4dba54['limit'];var _0x34224e;if(_0x3e553d>=_0x3f71a5){_0x3e553d=_0x3f71a5;_0x34224e=0xc8;}else{_0x34224e=0xce;}_0x5097e8['status'](_0x34224e);return _0x5097e8[_0x15f9('0x1d')](_0x15f9('0x1e'),_0x5cecc1+'-'+_0x3e553d+'/'+_0x3f71a5)[_0x15f9('0x19')](_0x59d8ce);}return null;};}function patchUpdates(_0x2cfb45){return function(_0x41a20f){try{jsonpatch[_0x15f9('0x1f')](_0x41a20f,_0x2cfb45,!![]);}catch(_0xd844a9){return BPromise[_0x15f9('0x20')](_0xd844a9);}return _0x41a20f['save']();};}function saveUpdates(_0x2d5e42,_0xcdc604){return function(_0x3d5f8e){if(_0x3d5f8e){return _0x3d5f8e[_0x15f9('0x21')](_0x2d5e42)[_0x15f9('0x22')](function(_0x44fd33){return _0x44fd33;});}return null;};}function removeEntity(_0x1285e4,_0x280a0c){return function(_0x57ddd5){if(_0x57ddd5){return _0x57ddd5[_0x15f9('0x23')]()[_0x15f9('0x22')](function(){_0x1285e4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x373af2,_0x4ad95a){return function(_0xcd98f6){if(!_0xcd98f6){_0x373af2[_0x15f9('0x24')](0x194);}return _0xcd98f6;};}function handleError(_0x5e0555,_0x5de864){_0x5de864=_0x5de864||0x1f4;return function(_0x30aee1){logger[_0x15f9('0x25')](_0x30aee1[_0x15f9('0x26')]);if(_0x30aee1[_0x15f9('0x27')]){delete _0x30aee1[_0x15f9('0x27')];}_0x5e0555[_0x15f9('0x17')](_0x5de864)[_0x15f9('0x28')](_0x30aee1);};}exports[_0x15f9('0x29')]=function(_0x716ead,_0x18a0d1){var _0x3e43f6={},_0x1361cb={},_0x5ce7ad={'count':0x0,'rows':[]};var _0x331121=_[_0x15f9('0x2a')](db[_0x15f9('0x2b')][_0x15f9('0x2c')],function(_0x4f81e2){return{'name':_0x4f81e2[_0x15f9('0x2d')],'type':_0x4f81e2[_0x15f9('0x2e')][_0x15f9('0x2f')]};});_0x1361cb[_0x15f9('0x30')]=_[_0x15f9('0x2a')](_0x331121,_0x15f9('0x27'));_0x1361cb[_0x15f9('0x31')]=_['keys'](_0x716ead[_0x15f9('0x31')]);_0x1361cb[_0x15f9('0x32')]=_[_0x15f9('0x33')](_0x1361cb['model'],_0x1361cb[_0x15f9('0x31')]);_0x3e43f6[_0x15f9('0x34')]=_[_0x15f9('0x33')](_0x1361cb['model'],qs['fields'](_0x716ead['query'][_0x15f9('0x35')]));_0x3e43f6[_0x15f9('0x34')]=_0x3e43f6[_0x15f9('0x34')]['length']?_0x3e43f6['attributes']:_0x1361cb['model'];if(!_0x716ead[_0x15f9('0x31')][_0x15f9('0x36')]('nolimit')){_0x3e43f6[_0x15f9('0x37')]=qs[_0x15f9('0x37')](_0x716ead[_0x15f9('0x31')][_0x15f9('0x37')]);_0x3e43f6[_0x15f9('0x1a')]=qs['offset'](_0x716ead[_0x15f9('0x31')][_0x15f9('0x1a')]);}_0x3e43f6[_0x15f9('0x38')]=qs[_0x15f9('0x39')](_0x716ead[_0x15f9('0x31')][_0x15f9('0x39')]);_0x3e43f6[_0x15f9('0x3a')]=qs[_0x15f9('0x32')](_['pick'](_0x716ead[_0x15f9('0x31')],_0x1361cb[_0x15f9('0x32')]),_0x331121);if(_0x716ead['query'][_0x15f9('0x3b')]){_0x3e43f6[_0x15f9('0x3a')]=_['merge'](_0x3e43f6['where'],{'$or':_[_0x15f9('0x2a')](_0x331121,function(_0x499c9b){if(_0x499c9b[_0x15f9('0x2e')]!==_0x15f9('0x3c')){var _0x1412ee={};_0x1412ee[_0x499c9b[_0x15f9('0x27')]]={'$like':'%'+_0x716ead[_0x15f9('0x31')][_0x15f9('0x3b')]+'%'};return _0x1412ee;}})});}_0x3e43f6=_[_0x15f9('0x3d')]({},_0x3e43f6,_0x716ead[_0x15f9('0x3e')]);var _0x4c6132={'where':_0x3e43f6[_0x15f9('0x3a')]};return db[_0x15f9('0x2b')]['count'](_0x4c6132)[_0x15f9('0x22')](function(_0x2279c0){_0x5ce7ad['count']=_0x2279c0;if(_0x716ead[_0x15f9('0x31')][_0x15f9('0x3f')]){_0x3e43f6[_0x15f9('0x40')]=[{'all':!![]}];}return db[_0x15f9('0x2b')][_0x15f9('0x41')](_0x3e43f6);})[_0x15f9('0x22')](function(_0x1b2d6f){_0x5ce7ad[_0x15f9('0x42')]=_0x1b2d6f;return _0x5ce7ad;})[_0x15f9('0x22')](respondWithFilteredResult(_0x18a0d1,_0x3e43f6))[_0x15f9('0x43')](handleError(_0x18a0d1,null));};exports[_0x15f9('0x44')]=function(_0x502f8e,_0x2b2a38){var _0x372997={'raw':!![],'where':{'id':_0x502f8e['params']['id']}},_0x469a5f={};_0x469a5f[_0x15f9('0x30')]=_[_0x15f9('0x45')](db['SmsApplication'][_0x15f9('0x2c')]);_0x469a5f[_0x15f9('0x31')]=_[_0x15f9('0x45')](_0x502f8e[_0x15f9('0x31')]);_0x469a5f['filters']=_['intersection'](_0x469a5f[_0x15f9('0x30')],_0x469a5f[_0x15f9('0x31')]);_0x372997['attributes']=_[_0x15f9('0x33')](_0x469a5f['model'],qs[_0x15f9('0x35')](_0x502f8e[_0x15f9('0x31')][_0x15f9('0x35')]));_0x372997[_0x15f9('0x34')]=_0x372997['attributes'][_0x15f9('0x46')]?_0x372997[_0x15f9('0x34')]:_0x469a5f[_0x15f9('0x30')];if(_0x502f8e[_0x15f9('0x31')][_0x15f9('0x3f')]){_0x372997[_0x15f9('0x40')]=[{'all':!![]}];}_0x372997=_['merge']({},_0x372997,_0x502f8e[_0x15f9('0x3e')]);return db[_0x15f9('0x2b')]['find'](_0x372997)[_0x15f9('0x22')](handleEntityNotFound(_0x2b2a38,null))[_0x15f9('0x22')](respondWithResult(_0x2b2a38,null))['catch'](handleError(_0x2b2a38,null));};exports[_0x15f9('0x47')]=function(_0x3368e3,_0x5da53a){return db[_0x15f9('0x2b')][_0x15f9('0x47')](_0x3368e3['body'],{})[_0x15f9('0x22')](respondWithResult(_0x5da53a,0xc9))[_0x15f9('0x43')](handleError(_0x5da53a,null));};exports[_0x15f9('0x21')]=function(_0x579f29,_0x150448){if(_0x579f29[_0x15f9('0x48')]['id']){delete _0x579f29['body']['id'];}return db[_0x15f9('0x2b')][_0x15f9('0x49')]({'where':{'id':_0x579f29['params']['id']}})[_0x15f9('0x22')](handleEntityNotFound(_0x150448,null))[_0x15f9('0x22')](saveUpdates(_0x579f29['body'],null))[_0x15f9('0x22')](respondWithResult(_0x150448,null))[_0x15f9('0x43')](handleError(_0x150448,null));};exports[_0x15f9('0x23')]=function(_0x5285b6,_0xa62c2c){return db[_0x15f9('0x2b')][_0x15f9('0x49')]({'where':{'id':_0x5285b6[_0x15f9('0x4a')]['id']}})[_0x15f9('0x22')](handleEntityNotFound(_0xa62c2c,null))['then'](removeEntity(_0xa62c2c,null))[_0x15f9('0x43')](handleError(_0xa62c2c,null));}; \ No newline at end of file +var _0x8850=['undefined','limit','count','offset','Content-Range','reject','update','destroy','end','sendStatus','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','include','catch','show','params','options','find','create','body','eml-format','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json'];(function(_0x5da0fd,_0x18a7c7){var _0x5a2412=function(_0x21374b){while(--_0x21374b){_0x5da0fd['push'](_0x5da0fd['shift']());}};_0x5a2412(++_0x18a7c7);}(_0x8850,0x17d));var _0x0885=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8850[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x0885('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0885('0x1'));var jsonpatch=require(_0x0885('0x2'));var rp=require('request-promise');var moment=require(_0x0885('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0885('0x4'));var path=require(_0x0885('0x5'));var sox=require(_0x0885('0x6'));var csv=require(_0x0885('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0885('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x0885('0x9'));var toCsv=require(_0x0885('0x7'));var querystring=require(_0x0885('0xa'));var Papa=require(_0x0885('0xb'));var Redis=require('ioredis');var authService=require(_0x0885('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x0885('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0885('0xe'))(_0x0885('0xf'));var utils=require('../../config/utils');var config=require(_0x0885('0x10'));var licenseUtil=require(_0x0885('0x11'));var db=require(_0x0885('0x12'))['db'];function respondWithStatusCode(_0x36bf20,_0x292f19){_0x292f19=_0x292f19||0xcc;return function(_0x3edab6){if(_0x3edab6){return _0x36bf20['sendStatus'](_0x292f19);}return _0x36bf20[_0x0885('0x13')](_0x292f19)['end']();};}function respondWithResult(_0x3dfee8,_0x27ab9c){_0x27ab9c=_0x27ab9c||0xc8;return function(_0x3ccc15){if(_0x3ccc15){return _0x3dfee8[_0x0885('0x13')](_0x27ab9c)[_0x0885('0x14')](_0x3ccc15);}};}function respondWithFilteredResult(_0x56c6cf,_0x1303ca){return function(_0x4dca06){if(_0x4dca06){var _0x48f7f5=typeof _0x1303ca['offset']===_0x0885('0x15')&&typeof _0x1303ca[_0x0885('0x16')]==='undefined';var _0x45bab1=_0x4dca06[_0x0885('0x17')];var _0x37739d=_0x48f7f5?0x0:_0x1303ca['offset'];var _0x5222a3=_0x48f7f5?_0x4dca06[_0x0885('0x17')]:_0x1303ca[_0x0885('0x18')]+_0x1303ca[_0x0885('0x16')];var _0x1b1ee9;if(_0x5222a3>=_0x45bab1){_0x5222a3=_0x45bab1;_0x1b1ee9=0xc8;}else{_0x1b1ee9=0xce;}_0x56c6cf[_0x0885('0x13')](_0x1b1ee9);return _0x56c6cf['set'](_0x0885('0x19'),_0x37739d+'-'+_0x5222a3+'/'+_0x45bab1)[_0x0885('0x14')](_0x4dca06);}return null;};}function patchUpdates(_0x2b626a){return function(_0x2a74fd){try{jsonpatch['apply'](_0x2a74fd,_0x2b626a,!![]);}catch(_0x3ef3b0){return BPromise[_0x0885('0x1a')](_0x3ef3b0);}return _0x2a74fd['save']();};}function saveUpdates(_0xa11ed9,_0x5957da){return function(_0x2129ac){if(_0x2129ac){return _0x2129ac[_0x0885('0x1b')](_0xa11ed9)['then'](function(_0x24ad02){return _0x24ad02;});}return null;};}function removeEntity(_0x30e1e5,_0x593ab5){return function(_0x3e73c5){if(_0x3e73c5){return _0x3e73c5[_0x0885('0x1c')]()['then'](function(){_0x30e1e5[_0x0885('0x13')](0xcc)[_0x0885('0x1d')]();});}};}function handleEntityNotFound(_0x3e35fd,_0x435f09){return function(_0x6a62cf){if(!_0x6a62cf){_0x3e35fd[_0x0885('0x1e')](0x194);}return _0x6a62cf;};}function handleError(_0x275d7a,_0x19ca03){_0x19ca03=_0x19ca03||0x1f4;return function(_0x794aab){logger[_0x0885('0x1f')](_0x794aab[_0x0885('0x20')]);if(_0x794aab[_0x0885('0x21')]){delete _0x794aab['name'];}_0x275d7a[_0x0885('0x13')](_0x19ca03)[_0x0885('0x22')](_0x794aab);};}exports[_0x0885('0x23')]=function(_0xd3c67,_0x4d0469){var _0x2510c2={},_0x509a68={},_0x17891={'count':0x0,'rows':[]};var _0x49471f=_[_0x0885('0x24')](db[_0x0885('0x25')][_0x0885('0x26')],function(_0x237046){return{'name':_0x237046[_0x0885('0x27')],'type':_0x237046[_0x0885('0x28')][_0x0885('0x29')]};});_0x509a68[_0x0885('0x2a')]=_['map'](_0x49471f,_0x0885('0x21'));_0x509a68[_0x0885('0x2b')]=_[_0x0885('0x2c')](_0xd3c67['query']);_0x509a68[_0x0885('0x2d')]=_['intersection'](_0x509a68[_0x0885('0x2a')],_0x509a68[_0x0885('0x2b')]);_0x2510c2[_0x0885('0x2e')]=_[_0x0885('0x2f')](_0x509a68[_0x0885('0x2a')],qs[_0x0885('0x30')](_0xd3c67[_0x0885('0x2b')]['fields']));_0x2510c2[_0x0885('0x2e')]=_0x2510c2['attributes'][_0x0885('0x31')]?_0x2510c2[_0x0885('0x2e')]:_0x509a68[_0x0885('0x2a')];if(!_0xd3c67[_0x0885('0x2b')][_0x0885('0x32')]('nolimit')){_0x2510c2[_0x0885('0x16')]=qs[_0x0885('0x16')](_0xd3c67[_0x0885('0x2b')]['limit']);_0x2510c2[_0x0885('0x18')]=qs[_0x0885('0x18')](_0xd3c67[_0x0885('0x2b')][_0x0885('0x18')]);}_0x2510c2['order']=qs['sort'](_0xd3c67[_0x0885('0x2b')][_0x0885('0x33')]);_0x2510c2[_0x0885('0x34')]=qs[_0x0885('0x2d')](_[_0x0885('0x35')](_0xd3c67['query'],_0x509a68[_0x0885('0x2d')]),_0x49471f);if(_0xd3c67[_0x0885('0x2b')][_0x0885('0x36')]){_0x2510c2[_0x0885('0x34')]=_[_0x0885('0x37')](_0x2510c2['where'],{'$or':_[_0x0885('0x24')](_0x49471f,function(_0x326398){if(_0x326398[_0x0885('0x28')]!==_0x0885('0x38')){var _0x50ca66={};_0x50ca66[_0x326398[_0x0885('0x21')]]={'$like':'%'+_0xd3c67[_0x0885('0x2b')]['filter']+'%'};return _0x50ca66;}})});}_0x2510c2=_[_0x0885('0x37')]({},_0x2510c2,_0xd3c67['options']);var _0x1abc2b={'where':_0x2510c2['where']};return db[_0x0885('0x25')][_0x0885('0x17')](_0x1abc2b)[_0x0885('0x39')](function(_0x45c6b5){_0x17891[_0x0885('0x17')]=_0x45c6b5;if(_0xd3c67[_0x0885('0x2b')][_0x0885('0x3a')]){_0x2510c2[_0x0885('0x3b')]=[{'all':!![]}];}return db[_0x0885('0x25')]['findAll'](_0x2510c2);})[_0x0885('0x39')](function(_0x198610){_0x17891['rows']=_0x198610;return _0x17891;})[_0x0885('0x39')](respondWithFilteredResult(_0x4d0469,_0x2510c2))[_0x0885('0x3c')](handleError(_0x4d0469,null));};exports[_0x0885('0x3d')]=function(_0x4f7130,_0x101ad3){var _0x401890={'raw':!![],'where':{'id':_0x4f7130[_0x0885('0x3e')]['id']}},_0x32e8d0={};_0x32e8d0[_0x0885('0x2a')]=_[_0x0885('0x2c')](db['SmsApplication'][_0x0885('0x26')]);_0x32e8d0[_0x0885('0x2b')]=_[_0x0885('0x2c')](_0x4f7130['query']);_0x32e8d0['filters']=_[_0x0885('0x2f')](_0x32e8d0[_0x0885('0x2a')],_0x32e8d0[_0x0885('0x2b')]);_0x401890[_0x0885('0x2e')]=_[_0x0885('0x2f')](_0x32e8d0['model'],qs['fields'](_0x4f7130['query'][_0x0885('0x30')]));_0x401890[_0x0885('0x2e')]=_0x401890[_0x0885('0x2e')]['length']?_0x401890['attributes']:_0x32e8d0[_0x0885('0x2a')];if(_0x4f7130[_0x0885('0x2b')]['includeAll']){_0x401890[_0x0885('0x3b')]=[{'all':!![]}];}_0x401890=_[_0x0885('0x37')]({},_0x401890,_0x4f7130[_0x0885('0x3f')]);return db['SmsApplication'][_0x0885('0x40')](_0x401890)[_0x0885('0x39')](handleEntityNotFound(_0x101ad3,null))[_0x0885('0x39')](respondWithResult(_0x101ad3,null))['catch'](handleError(_0x101ad3,null));};exports[_0x0885('0x41')]=function(_0x2995bf,_0x3a0725){return db[_0x0885('0x25')][_0x0885('0x41')](_0x2995bf[_0x0885('0x42')],{})['then'](respondWithResult(_0x3a0725,0xc9))[_0x0885('0x3c')](handleError(_0x3a0725,null));};exports[_0x0885('0x1b')]=function(_0x9fa9b3,_0xb5853e){if(_0x9fa9b3[_0x0885('0x42')]['id']){delete _0x9fa9b3['body']['id'];}return db['SmsApplication'][_0x0885('0x40')]({'where':{'id':_0x9fa9b3['params']['id']}})[_0x0885('0x39')](handleEntityNotFound(_0xb5853e,null))[_0x0885('0x39')](saveUpdates(_0x9fa9b3[_0x0885('0x42')],null))[_0x0885('0x39')](respondWithResult(_0xb5853e,null))[_0x0885('0x3c')](handleError(_0xb5853e,null));};exports[_0x0885('0x1c')]=function(_0x26de4f,_0x60fa9){return db[_0x0885('0x25')]['find']({'where':{'id':_0x26de4f[_0x0885('0x3e')]['id']}})[_0x0885('0x39')](handleEntityNotFound(_0x60fa9,null))[_0x0885('0x39')](removeEntity(_0x60fa9,null))[_0x0885('0x3c')](handleError(_0x60fa9,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index a68c2a6..48d7e33 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 _0xe142=['utf8mb4_unicode_ci','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsApplication','sms_applications','utf8mb4'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe142,0xaa));var _0x2e14=function(_0x422fa0,_0x4cd88a){_0x422fa0=_0x422fa0-0x0;var _0x2c6d22=_0xe142[_0x422fa0];return _0x2c6d22;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2e14('0x0'))('api');var moment=require(_0x2e14('0x1'));var BPromise=require(_0x2e14('0x2'));var rp=require(_0x2e14('0x3'));var fs=require('fs');var path=require(_0x2e14('0x4'));var rimraf=require(_0x2e14('0x5'));var config=require(_0x2e14('0x6'));var attributes=require('./smsApplication.attributes');module[_0x2e14('0x7')]=function(_0x33e99b,_0x1bfd45){return _0x33e99b[_0x2e14('0x8')](_0x2e14('0x9'),attributes,{'tableName':_0x2e14('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2e14('0xb'),'collate':_0x2e14('0xc')});}; \ No newline at end of file +var _0xbda9=['./smsApplication.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3f9ec3,_0x3dfd37){var _0xe85b13=function(_0x10e8ed){while(--_0x10e8ed){_0x3f9ec3['push'](_0x3f9ec3['shift']());}};_0xe85b13(++_0x3dfd37);}(_0xbda9,0x101));var _0x9bda=function(_0x25fbf2,_0x35de8d){_0x25fbf2=_0x25fbf2-0x0;var _0x57519e=_0xbda9[_0x25fbf2];return _0x57519e;};'use strict';var _=require(_0x9bda('0x0'));var util=require(_0x9bda('0x1'));var logger=require(_0x9bda('0x2'))(_0x9bda('0x3'));var moment=require(_0x9bda('0x4'));var BPromise=require(_0x9bda('0x5'));var rp=require(_0x9bda('0x6'));var fs=require('fs');var path=require(_0x9bda('0x7'));var rimraf=require(_0x9bda('0x8'));var config=require('../../config/environment');var attributes=require(_0x9bda('0x9'));module[_0x9bda('0xa')]=function(_0x26544e,_0x4d2979){return _0x26544e[_0x9bda('0xb')]('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9bda('0xc'),'collate':_0x9bda('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 462a007..d5f5051 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 _0x65c9=['then','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x461886,_0x4fc171){var _0x295e0a=function(_0x451524){while(--_0x451524){_0x461886['push'](_0x461886['shift']());}};_0x295e0a(++_0x4fc171);}(_0x65c9,0x182));var _0x965c=function(_0x11f304,_0x2bbc42){_0x11f304=_0x11f304-0x0;var _0x57268c=_0x65c9[_0x11f304];return _0x57268c;};'use strict';var _=require(_0x965c('0x0'));var util=require(_0x965c('0x1'));var moment=require('moment');var BPromise=require(_0x965c('0x2'));var rs=require(_0x965c('0x3'));var fs=require('fs');var Redis=require(_0x965c('0x4'));var db=require(_0x965c('0x5'))['db'];var utils=require(_0x965c('0x6'));var logger=require(_0x965c('0x7'))(_0x965c('0x8'));var config=require(_0x965c('0x9'));var jayson=require(_0x965c('0xa'));var client=jayson[_0x965c('0xb')][_0x965c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x849260,_0x5ec702,_0xd19e57){return new BPromise(function(_0x263652,_0x41d248){return client[_0x965c('0xd')](_0x849260,_0xd19e57)[_0x965c('0xe')](function(_0x26d859){logger[_0x965c('0xf')]('SmsApplication,\x20%s,\x20%s',_0x5ec702,_0x965c('0x10'));logger[_0x965c('0x11')](_0x965c('0x12'),_0x5ec702,_0x965c('0x10'),JSON[_0x965c('0x13')](_0x26d859));if(_0x26d859[_0x965c('0x14')]){if(_0x26d859[_0x965c('0x14')][_0x965c('0x15')]===0x1f4){logger[_0x965c('0x14')](_0x965c('0x16'),_0x5ec702,_0x26d859[_0x965c('0x14')][_0x965c('0x17')]);return _0x41d248(_0x26d859[_0x965c('0x14')][_0x965c('0x17')]);}logger['error'](_0x965c('0x16'),_0x5ec702,_0x26d859[_0x965c('0x14')][_0x965c('0x17')]);return _0x263652(_0x26d859['error'][_0x965c('0x17')]);}else{logger[_0x965c('0xf')](_0x965c('0x16'),_0x5ec702,'request\x20sent');_0x263652(_0x26d859[_0x965c('0x18')]['message']);}})['catch'](function(_0x542499){logger[_0x965c('0x14')](_0x965c('0x16'),_0x5ec702,_0x542499);_0x41d248(_0x542499);});});} \ No newline at end of file +var _0x3e94=['rpc','jayson/promise','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x12dbb5,_0x1c0f0f){var _0xf922ac=function(_0x3e8631){while(--_0x3e8631){_0x12dbb5['push'](_0x12dbb5['shift']());}};_0xf922ac(++_0x1c0f0f);}(_0x3e94,0x67));var _0x43e9=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x3e94[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x43e9('0x0'));var util=require(_0x43e9('0x1'));var moment=require('moment');var BPromise=require(_0x43e9('0x2'));var rs=require(_0x43e9('0x3'));var fs=require('fs');var Redis=require(_0x43e9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x43e9('0x5'));var logger=require(_0x43e9('0x6'))(_0x43e9('0x7'));var config=require('../../config/environment');var jayson=require(_0x43e9('0x8'));var client=jayson['client'][_0x43e9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b35f1,_0x1183a0,_0x2989fe){return new BPromise(function(_0x287aaf,_0x510ee7){return client[_0x43e9('0xa')](_0x4b35f1,_0x2989fe)[_0x43e9('0xb')](function(_0x43d6e8){logger[_0x43e9('0xc')](_0x43e9('0xd'),_0x1183a0,_0x43e9('0xe'));logger[_0x43e9('0xf')](_0x43e9('0x10'),_0x1183a0,_0x43e9('0xe'),JSON['stringify'](_0x43d6e8));if(_0x43d6e8[_0x43e9('0x11')]){if(_0x43d6e8[_0x43e9('0x11')][_0x43e9('0x12')]===0x1f4){logger['error'](_0x43e9('0xd'),_0x1183a0,_0x43d6e8[_0x43e9('0x11')][_0x43e9('0x13')]);return _0x510ee7(_0x43d6e8[_0x43e9('0x11')][_0x43e9('0x13')]);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x1183a0,_0x43d6e8[_0x43e9('0x11')]['message']);return _0x287aaf(_0x43d6e8[_0x43e9('0x11')][_0x43e9('0x13')]);}else{logger[_0x43e9('0xc')](_0x43e9('0xd'),_0x1183a0,_0x43e9('0xe'));_0x287aaf(_0x43d6e8[_0x43e9('0x14')][_0x43e9('0x13')]);}})[_0x43e9('0x15')](function(_0x3f7164){logger[_0x43e9('0x11')](_0x43e9('0xd'),_0x1183a0,_0x3f7164);_0x510ee7(_0x3f7164);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 5a69818..6838e74 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 _0x34b7=['/:id/tags','removeTags','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','tracked','sms','smsinteraction:addtags','addTags','put','/:id','smsinteraction:update','delete','destroy'];(function(_0x5cab28,_0x307622){var _0xa3554d=function(_0x330139){while(--_0x330139){_0x5cab28['push'](_0x5cab28['shift']());}};_0xa3554d(++_0x307622);}(_0x34b7,0x196));var _0x734b=function(_0x3ad191,_0x29e58b){_0x3ad191=_0x3ad191-0x0;var _0x4384e5=_0x34b7[_0x3ad191];return _0x4384e5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x734b('0x0'));var timeout=require(_0x734b('0x1'));var express=require(_0x734b('0x2'));var router=express[_0x734b('0x3')]();var fs_extra=require(_0x734b('0x4'));var auth=require(_0x734b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x734b('0x6'));router[_0x734b('0x7')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0x9')]);router[_0x734b('0x7')](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xb')]);router[_0x734b('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x734b('0x7')]('/:id/messages',auth[_0x734b('0x8')](),controller[_0x734b('0xc')]);router[_0x734b('0x7')](_0x734b('0xd'),auth[_0x734b('0x8')](),controller[_0x734b('0xe')]);router[_0x734b('0xf')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0x10')]);router[_0x734b('0xf')](_0x734b('0x11'),auth[_0x734b('0x8')](),controller[_0x734b('0x12')]);router[_0x734b('0xf')]('/:id/tags',auth[_0x734b('0x8')](),interaction[_0x734b('0x13')](_0x734b('0x14'),_0x734b('0x15')),controller[_0x734b('0x16')]);router[_0x734b('0x17')](_0x734b('0x18'),auth[_0x734b('0x8')](),interaction[_0x734b('0x13')](_0x734b('0x14'),_0x734b('0x19')),controller['update']);router[_0x734b('0x1a')](_0x734b('0x18'),auth[_0x734b('0x8')](),interaction[_0x734b('0x13')]('sms','smsinteraction:destroy'),controller[_0x734b('0x1b')]);router[_0x734b('0x1a')](_0x734b('0x1c'),auth[_0x734b('0x8')](),controller[_0x734b('0x1d')]);module[_0x734b('0x1e')]=router; \ No newline at end of file +var _0x7708=['removeTags','exports','multer','util','connect-timeout','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','sms','addTags','put','delete'];(function(_0x3e37b3,_0x570305){var _0x47e724=function(_0x3f4884){while(--_0x3f4884){_0x3e37b3['push'](_0x3e37b3['shift']());}};_0x47e724(++_0x570305);}(_0x7708,0x188));var _0x8770=function(_0x53e3fa,_0x50c5f2){_0x53e3fa=_0x53e3fa-0x0;var _0xe8584a=_0x7708[_0x53e3fa];return _0xe8584a;};'use strict';var multer=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var path=require('path');var timeout=require(_0x8770('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8770('0x3'));var config=require(_0x8770('0x4'));var controller=require('./smsInteraction.controller');router[_0x8770('0x5')]('/',auth['isAuthenticated'](),controller[_0x8770('0x6')]);router[_0x8770('0x5')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller[_0x8770('0x9')]);router[_0x8770('0x5')](_0x8770('0xa'),auth['isAuthenticated'](),controller[_0x8770('0xb')]);router[_0x8770('0x5')](_0x8770('0xc'),auth['isAuthenticated'](),controller[_0x8770('0xd')]);router[_0x8770('0x5')](_0x8770('0xe'),auth[_0x8770('0x8')](),controller['download']);router[_0x8770('0xf')]('/',auth[_0x8770('0x8')](),controller[_0x8770('0x10')]);router['post'](_0x8770('0xc'),auth[_0x8770('0x8')](),controller[_0x8770('0x11')]);router[_0x8770('0xf')](_0x8770('0x12'),auth[_0x8770('0x8')](),interaction[_0x8770('0x13')](_0x8770('0x14'),'smsinteraction:addtags'),controller[_0x8770('0x15')]);router[_0x8770('0x16')]('/:id',auth[_0x8770('0x8')](),interaction['tracked'](_0x8770('0x14'),'smsinteraction:update'),controller['update']);router['delete'](_0x8770('0xa'),auth[_0x8770('0x8')](),interaction[_0x8770('0x13')](_0x8770('0x14'),'smsinteraction:destroy'),controller['destroy']);router[_0x8770('0x17')](_0x8770('0x12'),auth[_0x8770('0x8')](),controller[_0x8770('0x18')]);module[_0x8770('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 836e435..930d453 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 _0x423b=['BOOLEAN','STRING','DATE','out','ENUM','moment'];(function(_0x10a212,_0x579d85){var _0x23c82b=function(_0x412ea9){while(--_0x412ea9){_0x10a212['push'](_0x10a212['shift']());}};_0x23c82b(++_0x579d85);}(_0x423b,0x12b));var _0xb423=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x423b[_0x1573ea];return _0x51c0e2;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb423('0x0'));module['exports']={'closed':{'type':Sequelize[_0xb423('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xb423('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xb423('0x2')]},'read1stAt':{'type':Sequelize[_0xb423('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xb423('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb423('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xb423('0x5')]('in',_0xb423('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x51f2=['STRING','ENUM','out','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x510b98,_0x4c4cbb){var _0x45e775=function(_0x29ec11){while(--_0x29ec11){_0x510b98['push'](_0x510b98['shift']());}};_0x45e775(++_0x4c4cbb);}(_0x51f2,0xeb));var _0x251f=function(_0x572667,_0x1db39a){_0x572667=_0x572667-0x0;var _0x417936=_0x51f2[_0x572667];return _0x417936;};'use strict';var Sequelize=require(_0x251f('0x0'));var moment=require(_0x251f('0x1'));module[_0x251f('0x2')]={'closed':{'type':Sequelize[_0x251f('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x251f('0x4')]},'disposition':{'type':Sequelize[_0x251f('0x5')]},'secondDisposition':{'type':Sequelize[_0x251f('0x5')]},'thirdDisposition':{'type':Sequelize[_0x251f('0x5')]},'note':{'type':Sequelize[_0x251f('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x251f('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x251f('0x6')]('in',_0x251f('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x251f('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x251f('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x251f('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index ae46449..db07b1c 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 _0x84c9=['filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','SmsAccountId','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SmsInteraction','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.fax','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','show','params','rawAttributes','options','create','destroy','describe','addMessage','ids','getMessages','findOne','SmsMessage','hasOwnProperty','nolimit','$gte','YYYY-MM-DD\x20HH:mm:ss','include','findAll','setTags','omit','spread','Tag','emit','smsInteractionTags:save','removeTags','download','unix','root','server','tmp','files','attachments','format','transcript-%d-%s.zip','join','fullname','CmContact','firstName','lastName','direction','secret','Account','get','mkdirSync','Sms','Owner','N.A.','closedAt','Messages','out','System','renderFile','views','downloadInteraction.ejs','createPdfFromHTML','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','stack','name','send','map','Tags','TagIds','split','forEach','push','catch','index','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','compact','isEmpty','i.SmsAccountId\x20IN\x20?','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','isArray','tag'];(function(_0x2bcddb,_0x3eaf37){var _0x12a9e8=function(_0xeeb678){while(--_0xeeb678){_0x2bcddb['push'](_0x2bcddb['shift']());}};_0x12a9e8(++_0x3eaf37);}(_0x84c9,0x66));var _0x984c=function(_0x228658,_0xc5e4ac){_0x228658=_0x228658-0x0;var _0x831c09=_0x84c9[_0x228658];return _0x831c09;};'use strict';var emlformat=require(_0x984c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x984c('0x1'));var jsonpatch=require(_0x984c('0x2'));var rp=require(_0x984c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x984c('0x4'));var path=require(_0x984c('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x984c('0x6'));var _=require(_0x984c('0x7'));var squel=require(_0x984c('0x8'));var crypto=require(_0x984c('0x9'));var jsforce=require(_0x984c('0xa'));var deskjs=require(_0x984c('0xb'));var toCsv=require(_0x984c('0xc'));var querystring=require(_0x984c('0xd'));var Papa=require(_0x984c('0xe'));var Redis=require(_0x984c('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x984c('0x10'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x984c('0x11'));var logger=require(_0x984c('0x12'))(_0x984c('0x13'));var utils=require(_0x984c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x984c('0x15'));var db=require(_0x984c('0x16'))['db'];config[_0x984c('0x17')]=_[_0x984c('0x18')](config[_0x984c('0x17')],{'host':_0x984c('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x984c('0x17')]));require(_0x984c('0x1a'))['register'](socket);function respondWithStatusCode(_0x28352c,_0x25aeaf){_0x25aeaf=_0x25aeaf||0xcc;return function(_0xb22a89){if(_0xb22a89){return _0x28352c[_0x984c('0x1b')](_0x25aeaf);}return _0x28352c['status'](_0x25aeaf)[_0x984c('0x1c')]();};}function respondWithResult(_0x59237c,_0x1a30f9){_0x1a30f9=_0x1a30f9||0xc8;return function(_0x15f9c4){if(_0x15f9c4){return _0x59237c[_0x984c('0x1d')](_0x1a30f9)[_0x984c('0x1e')](_0x15f9c4);}};}function respondWithFilteredResult(_0x3bb17d,_0x1c5997){return function(_0x543047){if(_0x543047){var _0x4bc510=typeof _0x1c5997[_0x984c('0x1f')]===_0x984c('0x20')&&typeof _0x1c5997['limit']==='undefined';var _0x45d98a=_0x543047[_0x984c('0x21')];var _0x5582cd=_0x4bc510?0x0:_0x1c5997[_0x984c('0x1f')];var _0x3d37c3=_0x4bc510?_0x543047[_0x984c('0x21')]:_0x1c5997[_0x984c('0x1f')]+_0x1c5997[_0x984c('0x22')];var _0x4336bf;if(_0x3d37c3>=_0x45d98a){_0x3d37c3=_0x45d98a;_0x4336bf=0xc8;}else{_0x4336bf=0xce;}_0x3bb17d[_0x984c('0x1d')](_0x4336bf);return _0x3bb17d[_0x984c('0x23')](_0x984c('0x24'),_0x5582cd+'-'+_0x3d37c3+'/'+_0x45d98a)[_0x984c('0x1e')](_0x543047);}return null;};}function patchUpdates(_0x201ba8){return function(_0x3363ba){try{jsonpatch[_0x984c('0x25')](_0x3363ba,_0x201ba8,!![]);}catch(_0x95659f){return BPromise[_0x984c('0x26')](_0x95659f);}return _0x3363ba['save']();};}function saveUpdates(_0x5a241a,_0xe11be8){return function(_0x1ff63f){if(_0x1ff63f){return _0x1ff63f[_0x984c('0x27')](_0x5a241a)[_0x984c('0x28')](function(_0x4211c5){return _0x4211c5;});}return null;};}function removeEntity(_0x3660ee,_0x2d04e8){return function(_0x3b397b){if(_0x3b397b){return _0x3b397b['destroy']()[_0x984c('0x28')](function(){_0x3660ee[_0x984c('0x1d')](0xcc)[_0x984c('0x1c')]();});}};}function handleEntityNotFound(_0x3155bc,_0x101e4e){return function(_0x338c1e){if(!_0x338c1e){_0x3155bc[_0x984c('0x1b')](0x194);}return _0x338c1e;};}function handleError(_0x13a2fc,_0xfee2e9){_0xfee2e9=_0xfee2e9||0x1f4;return function(_0x39799d){logger['error'](_0x39799d[_0x984c('0x29')]);if(_0x39799d[_0x984c('0x2a')]){delete _0x39799d[_0x984c('0x2a')];}_0x13a2fc[_0x984c('0x1d')](_0xfee2e9)[_0x984c('0x2b')](_0x39799d);};}function getInteractionUsers(_0x5994b3,_0x4bb1e4){return new BPromise(function(_0x30d2df,_0x36947b){try{if(_0x4bb1e4[_0x5994b3['id']]){_0x5994b3['Users']=_[_0x984c('0x2c')](_0x4bb1e4[_0x5994b3['id']],function(_0x45fdb1){return{'id':_0x45fdb1['id'],'fullname':_0x45fdb1['fullname']};});}}catch(_0x35542b){_0x36947b(_0x35542b);}_0x30d2df(_0x5994b3);});}function getInteractionTags(_0x5dda84,_0x255ce5){return new BPromise(function(_0x4b4cf2,_0x1eefd3){try{if(_0x5dda84['TagIds']){_0x5dda84[_0x984c('0x2d')]=[];_0x5dda84[_0x984c('0x2e')][_0x984c('0x2f')](',')[_0x984c('0x30')](function(_0x2af821){_0x5dda84['Tags'][_0x984c('0x31')](_0x255ce5[_0x2af821]);});}delete _0x5dda84[_0x984c('0x2e')];}catch(_0x4e46fa){_0x1eefd3(_0x4e46fa);}_0x4b4cf2(_0x5dda84);});}function updateSmsInteraction(_0x40ba30,_0x1313a0,_0xf089c1){return new BPromise(function(_0x4c7f88,_0x482bb9){return getInteractionUsers(_0x40ba30,_0xf089c1)['then'](function(_0x1cad56){return getInteractionTags(_0x1cad56,_0x1313a0);})[_0x984c('0x28')](function(_0x34bf17){_0x4c7f88(_0x34bf17);})[_0x984c('0x32')](function(_0x43ab08){_0x482bb9(_0x43ab08);});});}exports[_0x984c('0x33')]=function(_0x393d43,_0x2444b1){var _0x21418d={},_0xf2a6b5={},_0x2a9620={'count':0x0,'rows':[]};var _0x2131c7=_[_0x984c('0x2c')](db['SmsInteraction']['rawAttributes'],function(_0x238457){return{'name':_0x238457[_0x984c('0x34')],'type':_0x238457[_0x984c('0x35')][_0x984c('0x36')]};});_0xf2a6b5[_0x984c('0x37')]=_[_0x984c('0x2c')](_0x2131c7,'name');_0xf2a6b5['query']=_[_0x984c('0x38')](_0x393d43[_0x984c('0x39')]);_0xf2a6b5[_0x984c('0x3a')]=_[_0x984c('0x3b')](_0xf2a6b5[_0x984c('0x37')],_0xf2a6b5[_0x984c('0x39')]);_0x21418d['attributes']=_[_0x984c('0x3b')](_0xf2a6b5[_0x984c('0x37')],qs[_0x984c('0x3c')](_0x393d43[_0x984c('0x39')]['fields']));_0x21418d[_0x984c('0x3d')]=_0x21418d[_0x984c('0x3d')][_0x984c('0x3e')]?_0x21418d[_0x984c('0x3d')]:_0xf2a6b5['model'];if(!_0x393d43[_0x984c('0x39')]['hasOwnProperty']('nolimit')){_0x21418d['limit']=qs[_0x984c('0x22')](_0x393d43[_0x984c('0x39')][_0x984c('0x22')]);_0x21418d[_0x984c('0x1f')]=qs[_0x984c('0x1f')](_0x393d43[_0x984c('0x39')]['offset']);}_0x21418d[_0x984c('0x3f')]=qs['sort'](_0x393d43[_0x984c('0x39')][_0x984c('0x40')]);_0x21418d[_0x984c('0x41')]=qs['filters'](_[_0x984c('0x42')](_0x393d43[_0x984c('0x39')],_0xf2a6b5[_0x984c('0x3a')]),_0x2131c7);var _0x3b0a49=[];var _0x220b29=squel[_0x984c('0x43')]()[_0x984c('0x44')]('id')[_0x984c('0x44')](_0x984c('0x2a'))[_0x984c('0x44')](_0x984c('0x45'))[_0x984c('0x46')](_0x984c('0x47'));var _0x9d602b=squel[_0x984c('0x43')]()['field'](_0x984c('0x48'))[_0x984c('0x44')](_0x984c('0x49'))[_0x984c('0x44')]('ui.SmsInteractionId')['from'](_0x984c('0x4a'),'ui')[_0x984c('0x4b')](_0x984c('0x4c'),'u',_0x984c('0x4d'));var _0x5681e=squel[_0x984c('0x43')]()[_0x984c('0x46')](_0x984c('0x4e'),'i')['left_join']('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x984c('0x4c'),'o',_0x984c('0x4f'))['left_join'](_0x984c('0x50'),'a','a.id\x20=\x20i.SmsAccountId')[_0x984c('0x4b')](_0x984c('0x51'),'me',_0x984c('0x52'))[_0x984c('0x4b')](_0x984c('0x53'),'it',_0x984c('0x54'))[_0x984c('0x4b')](_0x984c('0x47'),'t',_0x984c('0x55'));var _0x3a75a5=squel[_0x984c('0x56')]();var _0x16a823=[];var _0xe020a7=squel['expr']();var _0x4d08e7;if(_0x393d43[_0x984c('0x39')][_0x984c('0x57')]){_0x4d08e7=as[_0x984c('0x58')](_0x393d43[_0x984c('0x39')][_0x984c('0x57')]);var _0x428daf=_0x4d08e7[_0x984c('0x59')];for(var _0x1de601=0x0;_0x1de601<_0x4d08e7['conditions'][_0x984c('0x3e')];_0x1de601++){var _0x4a0a7f=_0x4d08e7[_0x984c('0x5a')][_0x1de601];var _0x568097='i';var _0x4b784d=_[_0x984c('0x5b')](_0x2131c7,[_0x984c('0x2a'),_0x4a0a7f['field']]);if(!_0x4b784d){switch(_0x4a0a7f[_0x984c('0x44')]){case _0x984c('0x5c'):if(_0x4a0a7f[_0x984c('0x5d')]==0x1){_0x5681e['having']('`'+_0x4a0a7f[_0x984c('0x44')]+_0x984c('0x5e'));}else{_0x5681e[_0x984c('0x5f')]('`'+_0x4a0a7f[_0x984c('0x44')]+_0x984c('0x60'));}break;case _0x984c('0x61'):if(_0x4a0a7f[_0x984c('0x62')]===_0x984c('0x63')){if(_0x4a0a7f[_0x984c('0x5d')][_0x984c('0x2f')]('\x20')[_0x984c('0x3e')]>0x1){_0x3a75a5[_0x428daf]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4a0a7f[_0x984c('0x5d')]),null);}else{var _0x1abeb3='%'+_0x4a0a7f[_0x984c('0x5d')]+'%';_0x3a75a5[_0x428daf](_0x984c('0x64'),_0x1abeb3,_0x1abeb3,_0x1abeb3);}}else{_0x4b784d=_[_0x984c('0x5b')](_0x2131c7,[_0x984c('0x2a'),_0x984c('0x65')]);_0x4a0a7f[_0x984c('0x44')]=_0x984c('0x65');_0x3d1ef9=as[_0x984c('0x66')](_0x568097,_0x4b784d[_0x984c('0x35')],_0x4a0a7f);_0x3a75a5[_0x428daf](_0x3d1ef9[_0x984c('0x67')],_0x3d1ef9[_0x984c('0x5d')][_0x984c('0x68')],_0x3d1ef9[_0x984c('0x5d')]['end']);}break;case'Tag':var _0x4d0c2e=_0x4a0a7f[_0x984c('0x5d')]['split'](',')[_0x984c('0x2c')](function(_0x457db9){return Number(_0x457db9);});_0x4d0c2e['forEach'](function(_0x385180){_0xe020a7['or'](_0x984c('0x69'),'%,'+_0x385180+',%');});_0x16a823=_[_0x984c('0x6a')](_0x16a823,_0x4d0c2e);break;case _0x984c('0x6b'):if(_0x4a0a7f['operator']===_0x984c('0x63')){_0x3a75a5[_0x428daf](_0x984c('0x6c'),'%'+_0x4a0a7f[_0x984c('0x5d')]+'%',null);}else{_0x4b784d=_[_0x984c('0x5b')](_0x2131c7,['name',_0x984c('0x6d')]);_0x4a0a7f[_0x984c('0x44')]='UserId';_0x3d1ef9=as[_0x984c('0x66')](_0x568097,_0x4b784d[_0x984c('0x35')],_0x4a0a7f);_0x3a75a5[_0x428daf](_0x3d1ef9[_0x984c('0x67')],_0x3d1ef9[_0x984c('0x5d')][_0x984c('0x68')],_0x3d1ef9[_0x984c('0x5d')]['end']);}break;case _0x984c('0x6e'):_0x3d1ef9=as['buildExpression']('me',null,_0x4a0a7f);_0x3a75a5[_0x428daf](_0x3d1ef9[_0x984c('0x67')],_0x3d1ef9[_0x984c('0x5d')][_0x984c('0x68')],_0x3d1ef9[_0x984c('0x5d')][_0x984c('0x1c')]);break;}}else{var _0x3d1ef9=as[_0x984c('0x66')](_0x568097,_0x4b784d[_0x984c('0x35')],_0x4a0a7f);_0x3a75a5[_0x428daf](_0x3d1ef9[_0x984c('0x67')],_0x3d1ef9[_0x984c('0x5d')][_0x984c('0x68')],_0x3d1ef9[_0x984c('0x5d')][_0x984c('0x1c')]);}}}else{var _0x20e205=_(_0x393d43[_0x984c('0x39')])['keys']()['map'](function(_0x107a2b){return _['some'](_0x2131c7,[_0x984c('0x2a'),_0x107a2b])?_0x107a2b:undefined;})[_0x984c('0x6f')]()[_0x984c('0x5d')]();if(!_[_0x984c('0x70')](_0x20e205)){_0x20e205[_0x984c('0x30')](function(_0x2f7493){if(_0x2f7493==='SmsAccountId'){_0x5681e[_0x984c('0x41')](_0x984c('0x71'),[]['concat'](_0x393d43['query'][_0x2f7493]));}else if(_0x2f7493===_0x984c('0x72')){var _0x11986f=JSON[_0x984c('0x73')](_0x393d43[_0x984c('0x39')][_0x2f7493])['$gte'];var _0x43b5b4=JSON[_0x984c('0x73')](_0x393d43['query'][_0x2f7493])[_0x984c('0x74')];_0x5681e[_0x984c('0x41')](_0x984c('0x75'),_0x11986f,_0x43b5b4);}else{if(_0x393d43[_0x984c('0x39')][_0x2f7493]===_0x984c('0x76')){_0x5681e[_0x984c('0x41')]('i.'+_0x2f7493+_0x984c('0x77'));}else{_0x5681e[_0x984c('0x41')]('i.'+_0x2f7493+_0x984c('0x78'),_0x393d43[_0x984c('0x39')][_0x2f7493]);}}});}if(_0x393d43[_0x984c('0x39')][_0x984c('0x79')]){if(_0x393d43[_0x984c('0x39')][_0x984c('0x79')]==0x1){_0x5681e[_0x984c('0x5f')](_0x984c('0x7a'));}else{_0x5681e[_0x984c('0x5f')]('`unreadMessages`\x20>\x200');}}if(_0x393d43['query']['tag']){_0x16a823=_[_0x984c('0x7b')](_0x393d43[_0x984c('0x39')]['tag'])?_0x393d43[_0x984c('0x39')][_0x984c('0x7c')]:new Array(_0x393d43[_0x984c('0x39')][_0x984c('0x7c')]);_0x16a823[_0x984c('0x30')](function(_0x24eefd){_0xe020a7['or'](_0x984c('0x69'),'%,'+_0x24eefd+',%');});}if(_0x393d43[_0x984c('0x39')][_0x984c('0x7d')]){var _0x5ca128=_0x393d43['query'][_0x984c('0x7d')][_0x984c('0x7e')]('\x5c','\x5c\x5c')[_0x984c('0x7e')](/'/g,'\x27\x27');if(qs[_0x984c('0x7f')](_0x5ca128)){_0x3a75a5['or'](_0x984c('0x80'),_0x5ca128+'%')['or'](_0x984c('0x81'),_0x5ca128+'%');}else{_0x3a75a5['or'](_0x984c('0x82'),qs['getFullTextValue'](_0x5ca128))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x5ca128+'%');}}}_0x5681e['where'](_0x3a75a5);_0x5681e[_0x984c('0x83')]('i.id');var _0x48c7e6={'type':db[_0x984c('0x84')][_0x984c('0x85')]['SELECT'],'raw':!![]};var _0xf27c5c=_0x5681e[_0x984c('0x86')]();_0xf27c5c['field'](_0x984c('0x87'));_0xf27c5c[_0x984c('0x44')](_0x984c('0x88'),_0x984c('0x5c'));if(_0x21418d['order']){_0x21418d[_0x984c('0x3f')]['forEach'](function(_0x2de42a){var _0x364fd3=_0x2de42a[0x0]===_0x984c('0x89')?_0x2de42a[0x0]:'i.'+_0x2de42a[0x0];_0x5681e[_0x984c('0x3f')](_0x364fd3,_0x2de42a[0x1]==='DESC'?![]:!![]);});}if(!_[_0x984c('0x70')](_0x16a823)){_0x5681e[_0x984c('0x5f')](_0xe020a7);_0xf27c5c[_0x984c('0x41')](_0x984c('0x8a'),_0x16a823);}BPromise[_0x984c('0x8b')]()[_0x984c('0x28')](function(){if(!_0x4d08e7){if(_0x393d43['query'][_0x984c('0x8c')])return;_0xf27c5c[_0x984c('0x41')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x5681e[_0x984c('0x41')](_0x984c('0x8d'));return;}if(_0x393d43[_0x984c('0x8e')][_0x984c('0x8f')]!==_0x984c('0x90'))return;return _0x393d43[_0x984c('0x8e')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0x984c('0x28')](function(_0x2d80f1){if(_[_0x984c('0x70')](_0x2d80f1)){_0xf27c5c[_0x984c('0x41')](_0x984c('0x91'));_0x5681e[_0x984c('0x41')](_0x984c('0x91'));}else{_0xf27c5c[_0x984c('0x41')](_0x984c('0x71'),_[_0x984c('0x2c')](_0x2d80f1,'id'));_0x5681e[_0x984c('0x41')]('i.SmsAccountId\x20IN\x20?',_[_0x984c('0x2c')](_0x2d80f1,'id'));}});})[_0x984c('0x28')](function(){if(_0x393d43[_0x984c('0x8e')][_0x984c('0x8f')]===_0x984c('0x90')&&!_0x4d08e7&&!_0x393d43['query'][_0x984c('0x8c')])return[];return db[_0x984c('0x92')][_0x984c('0x39')](_0xf27c5c[_0x984c('0x93')](),_0x48c7e6);})[_0x984c('0x28')](function(_0x262edc){_0x2a9620[_0x984c('0x21')]=_0x262edc[_0x984c('0x3e')];if(_0x2a9620[_0x984c('0x21')]===0x0)return[];return db[_0x984c('0x92')][_0x984c('0x39')](_0x220b29[_0x984c('0x93')](),_0x48c7e6)[_0x984c('0x28')](function(_0x5e6962){_0x3b0a49=_[_0x984c('0x94')](_0x5e6962,'id');_0x48c7e6=_[_0x984c('0x95')](_0x48c7e6,{'model':db[_0x984c('0x96')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x393d43[_0x984c('0x39')][_0x984c('0x3c')]){_0x21418d[_0x984c('0x3d')]['forEach'](function(_0x2c2c32){_0x5681e[_0x984c('0x44')]('i.'+_0x2c2c32);});}else{_0x5681e[_0x984c('0x44')](_0x984c('0x88'),_0x984c('0x5c'));_0x5681e[_0x984c('0x44')]('a.key','Account.key');_0x5681e['field'](_0x984c('0x97'),_0x984c('0x98'));_0x5681e[_0x984c('0x44')](_0x984c('0x99'),'contactName');_0x5681e[_0x984c('0x44')]('i.*');_0x5681e[_0x984c('0x44')](_0x984c('0x9a'),_0x984c('0x9b'));_0x5681e[_0x984c('0x44')](_0x984c('0x9c'),_0x984c('0x9d'));_0x5681e[_0x984c('0x44')](_0x984c('0x9e'),'Contact.email');_0x5681e[_0x984c('0x44')](_0x984c('0x9f'),_0x984c('0xa0'));_0x5681e[_0x984c('0x44')](_0x984c('0xa1'),'Contact.mobile');_0x5681e[_0x984c('0x44')]('c.fax',_0x984c('0xa2'));_0x5681e['field']('o.fullname',_0x984c('0xa3'));_0x5681e['field']('o.internal','Owner.internal');_0x5681e[_0x984c('0x44')](_0x984c('0xa4'),'TagIds');}if(_0x21418d['limit'])_0x5681e['limit'](_0x21418d[_0x984c('0x22')]);if(_0x21418d[_0x984c('0x1f')])_0x5681e[_0x984c('0x1f')](_0x21418d[_0x984c('0x1f')]);return db['sequelize'][_0x984c('0x39')](_0x5681e[_0x984c('0x93')](),_0x48c7e6);})[_0x984c('0x28')](function(_0x589f6e){if(_0x589f6e[_0x984c('0x3e')]>0x0)_0x9d602b['where'](_0x984c('0xa5'),_[_0x984c('0x2c')](_0x589f6e,'id'));return db[_0x984c('0x92')][_0x984c('0x39')](_0x9d602b[_0x984c('0x93')](),_0x48c7e6)['then'](function(_0x3da0b6){var _0x2da48a=_[_0x984c('0xa6')](_0x3da0b6,_0x984c('0xa7'));var _0x59af25=[];_0x589f6e[_0x984c('0x30')](function(_0x43a294){_0x59af25[_0x984c('0x31')](updateSmsInteraction(_0x43a294,_0x3b0a49,_0x2da48a));});return BPromise[_0x984c('0xa8')](_0x59af25);});});})['then'](function(_0x2ee194){_0x2a9620[_0x984c('0xa9')]=_0x2ee194;return _0x2a9620;})['then'](respondWithFilteredResult(_0x2444b1,_0x21418d))[_0x984c('0x32')](handleError(_0x2444b1,null));};exports[_0x984c('0xaa')]=function(_0x131c60,_0x379055){var _0x200c6a={'raw':![],'where':{'id':_0x131c60[_0x984c('0xab')]['id']}},_0x160b90={};_0x160b90[_0x984c('0x37')]=_[_0x984c('0x38')](db[_0x984c('0x96')][_0x984c('0xac')]);_0x160b90[_0x984c('0x39')]=_[_0x984c('0x38')](_0x131c60[_0x984c('0x39')]);_0x160b90[_0x984c('0x3a')]=_[_0x984c('0x3b')](_0x160b90[_0x984c('0x37')],_0x160b90[_0x984c('0x39')]);_0x200c6a['attributes']=_[_0x984c('0x3b')](_0x160b90[_0x984c('0x37')],qs[_0x984c('0x3c')](_0x131c60[_0x984c('0x39')][_0x984c('0x3c')]));_0x200c6a[_0x984c('0x3d')]=_0x200c6a[_0x984c('0x3d')]['length']?_0x200c6a[_0x984c('0x3d')]:_0x160b90[_0x984c('0x37')];if(_0x131c60['query']['includeAll']){_0x200c6a['include']=[{'all':!![]}];}_0x200c6a=_[_0x984c('0x95')]({},_0x200c6a,_0x131c60[_0x984c('0xad')]);return db[_0x984c('0x96')][_0x984c('0x5b')](_0x200c6a)[_0x984c('0x28')](handleEntityNotFound(_0x379055,null))[_0x984c('0x28')](respondWithResult(_0x379055,null))[_0x984c('0x32')](handleError(_0x379055,null));};exports[_0x984c('0xae')]=function(_0x48cf7e,_0x29e9e6){return db[_0x984c('0x96')]['create'](_0x48cf7e['body'],{})['then'](respondWithResult(_0x29e9e6,0xc9))['catch'](handleError(_0x29e9e6,null));};exports[_0x984c('0x27')]=function(_0x4f1542,_0x77a03e){if(_0x4f1542[_0x984c('0x6e')]['id']){delete _0x4f1542['body']['id'];}return db[_0x984c('0x96')][_0x984c('0x5b')]({'where':{'id':_0x4f1542['params']['id']}})['then'](handleEntityNotFound(_0x77a03e,null))[_0x984c('0x28')](saveUpdates(_0x4f1542[_0x984c('0x6e')],null))[_0x984c('0x28')](respondWithResult(_0x77a03e,null))['catch'](handleError(_0x77a03e,null));};exports[_0x984c('0xaf')]=function(_0x524fbb,_0x29d25e){return db[_0x984c('0x96')]['find']({'where':{'id':_0x524fbb[_0x984c('0xab')]['id']}})[_0x984c('0x28')](handleEntityNotFound(_0x29d25e,null))['then'](removeEntity(_0x29d25e,null))[_0x984c('0x32')](handleError(_0x29d25e,null));};exports[_0x984c('0xb0')]=function(_0x34d9c8,_0x29223c){return db[_0x984c('0x96')]['describe']()[_0x984c('0x28')](respondWithResult(_0x29223c,null))['catch'](handleError(_0x29223c,null));};exports[_0x984c('0xb1')]=function(_0x2b1bdf,_0x204688,_0x119730){return db['SmsMessage'][_0x984c('0x5b')]({'where':{'id':_0x2b1bdf[_0x984c('0xab')]['id']}})['then'](handleEntityNotFound(_0x204688,null))[_0x984c('0x28')](function(_0x1bafaa){if(_0x1bafaa){return _0x1bafaa[_0x984c('0xb1')](_0x2b1bdf[_0x984c('0x6e')][_0x984c('0xb2')],_['omit'](_0x2b1bdf[_0x984c('0x6e')],[_0x984c('0xb2'),'id'])||{});}})['then'](respondWithResult(_0x204688,null))[_0x984c('0x32')](handleError(_0x204688,null));};exports[_0x984c('0xb3')]=function(_0x2d3f20,_0x5cd5c6,_0x70eefa){var _0x427761={'raw':![],'where':{}};var _0xbc030c={};var _0x573727={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x984c('0xb4')]({'where':{'id':_0x2d3f20[_0x984c('0xab')]['id']}})[_0x984c('0x28')](handleEntityNotFound(_0x5cd5c6,null))['then'](function(_0xda1c7d){if(_0xda1c7d){_0xbc030c[_0x984c('0x37')]=_[_0x984c('0x38')](db[_0x984c('0xb5')][_0x984c('0xac')]);_0xbc030c[_0x984c('0x39')]=_[_0x984c('0x38')](_0x2d3f20['query']);_0xbc030c['filters']=_[_0x984c('0x3b')](_0xbc030c[_0x984c('0x37')],_0xbc030c['query']);_0x427761[_0x984c('0x3d')]=_['intersection'](_0xbc030c[_0x984c('0x37')],qs[_0x984c('0x3c')](_0x2d3f20[_0x984c('0x39')][_0x984c('0x3c')]));_0x427761[_0x984c('0x3d')]=_0x427761['attributes'][_0x984c('0x3e')]?_0x427761[_0x984c('0x3d')]:_0xbc030c['model'];if(!_0x2d3f20[_0x984c('0x39')][_0x984c('0xb6')](_0x984c('0xb7'))){_0x427761[_0x984c('0x22')]=qs['limit'](_0x2d3f20[_0x984c('0x39')][_0x984c('0x22')]);_0x427761[_0x984c('0x1f')]=qs[_0x984c('0x1f')](_0x2d3f20[_0x984c('0x39')][_0x984c('0x1f')]);}_0x427761['order']=qs[_0x984c('0x40')](_0x2d3f20[_0x984c('0x39')][_0x984c('0x40')]);_0x427761[_0x984c('0x41')]=qs['filters'](_[_0x984c('0x42')](_0x2d3f20['query'],_0xbc030c['filters']));_0x427761[_0x984c('0x41')][_0x984c('0xa7')]=_0xda1c7d['id'];if(_0x2d3f20['query'][_0x984c('0x7d')]){_0x427761[_0x984c('0x41')]=_[_0x984c('0x95')](_0x427761[_0x984c('0x41')],{'$or':_[_0x984c('0x2c')](_0x427761[_0x984c('0x3d')],function(_0x5c6317){var _0x389876={};_0x389876[_0x5c6317]={'$like':'%'+_0x2d3f20[_0x984c('0x39')][_0x984c('0x7d')]+'%'};return _0x389876;})});}if(_0x2d3f20[_0x984c('0x39')][_0x984c('0xb8')]){var _0x36b349=_0x2d3f20[_0x984c('0x39')][_0x984c('0xb8')][_0x984c('0x2f')](',');var _0x7f0f3e={};_0x7f0f3e[_0x36b349[0x0]]={'$gte':moment(_0x36b349[0x1])['format'](_0x984c('0xb9'))};_0x427761[_0x984c('0x41')]=_['merge'](_0x427761['where'],_0x7f0f3e);}_0x427761=_['merge']({},_0x427761,_0x2d3f20['options']);return db['SmsMessage'][_0x984c('0x21')]({'where':_0x427761['where']})[_0x984c('0x28')](function(_0xdaf362){_0x573727['count']=_0xdaf362;if(_0x2d3f20[_0x984c('0x39')]['includeAll']){_0x427761[_0x984c('0xba')]=[{'all':!![]}];}return db[_0x984c('0xb5')][_0x984c('0xbb')](_0x427761);})[_0x984c('0x28')](function(_0x511ff7){_0x573727[_0x984c('0xa9')]=_0x511ff7;return _0x573727;});}})[_0x984c('0x28')](respondWithFilteredResult(_0x5cd5c6,_0x427761))[_0x984c('0x32')](handleError(_0x5cd5c6,null));};exports['addTags']=function(_0x5c5261,_0x40c929,_0x2ca5d6){return db[_0x984c('0x96')][_0x984c('0x5b')]({'where':{'id':_0x5c5261[_0x984c('0xab')]['id']}})[_0x984c('0x28')](handleEntityNotFound(_0x40c929,null))['then'](function(_0xa29374){if(_0xa29374){return _0xa29374[_0x984c('0xbc')](_0x5c5261[_0x984c('0x6e')][_0x984c('0xb2')],_[_0x984c('0xbd')](_0x5c5261[_0x984c('0x6e')],['ids','id'])||{})[_0x984c('0xbe')](function(){return db[_0x984c('0xbf')][_0x984c('0xbb')]({'attributes':['id',_0x984c('0x2a'),'color'],'where':{'id':_0x5c5261[_0x984c('0x6e')]['ids']}});})[_0x984c('0x28')](function(_0x5640e7){socket[_0x984c('0xc0')](_0x984c('0xc1'),{'id':Number(_0x5c5261[_0x984c('0xab')]['id']),'tags':_0x5640e7||[]});return{'id':Number(_0x5c5261[_0x984c('0xab')]['id']),'tags':_0x5640e7||[]};});}})['then'](respondWithResult(_0x40c929,null))['catch'](handleError(_0x40c929,null));};exports[_0x984c('0xc2')]=function(_0x4272c9,_0x1de48f,_0x31319b){return db[_0x984c('0x96')][_0x984c('0x5b')]({'where':{'id':_0x4272c9[_0x984c('0xab')]['id']}})[_0x984c('0x28')](handleEntityNotFound(_0x1de48f,null))['then'](function(_0x2a319f){if(_0x2a319f){return _0x2a319f[_0x984c('0xc2')](_0x4272c9[_0x984c('0x39')][_0x984c('0xb2')]);}})[_0x984c('0x28')](respondWithStatusCode(_0x1de48f,null))[_0x984c('0x32')](handleError(_0x1de48f,null));};exports[_0x984c('0xc3')]=function(_0x15ffad,_0x5cdac2){var _0x5e2cf7=moment()[_0x984c('0xc4')]()['toString']();var _0x2915fc=path['join'](config[_0x984c('0xc5')],_0x984c('0xc6'),'files',_0x984c('0xc7'));var _0x5487de=path['join'](config[_0x984c('0xc5')],_0x984c('0xc6'),_0x984c('0xc8'),_0x984c('0xc9'));var _0x37f597=path['join'](_0x2915fc,_0x5e2cf7);var _0x5bbb76=util[_0x984c('0xca')](_0x984c('0xcb'),_0x15ffad[_0x984c('0xab')]['id'],_0x5e2cf7);var _0x310124=path[_0x984c('0xcc')](_0x2915fc,_0x5bbb76);var _0x209385=[];_0x209385[_0x984c('0x31')]({'model':db['User'],'as':'User','attributes':['id',_0x984c('0xcd')],'raw':!![]});_0x209385[_0x984c('0x31')]({'model':db[_0x984c('0xce')],'as':_0x984c('0x61'),'attributes':['id',_0x984c('0xcf'),_0x984c('0xd0')],'raw':!![]});var _0x427ff6=[{'model':db[_0x984c('0xb5')],'as':'Messages','attributes':['id',_0x984c('0x6e'),_0x984c('0x72'),_0x984c('0xd1'),_0x984c('0xd2'),'read'],'include':_0x209385}];_0x427ff6[_0x984c('0x31')]({'model':db['SmsAccount'],'as':_0x984c('0xd3'),'attributes':['id',_0x984c('0x2a')]});_0x427ff6[_0x984c('0x31')]({'model':db['User'],'as':'Owner','attributes':['id',_0x984c('0xcd')]});return db[_0x984c('0x96')][_0x984c('0x5b')]({'where':{'id':_0x15ffad[_0x984c('0xab')]['id']},'include':_0x427ff6})[_0x984c('0x28')](handleEntityNotFound(_0x5cdac2,null))[_0x984c('0x28')](function(_0x4bdad3){if(_0x4bdad3){var _0x1546a1=_0x4bdad3[_0x984c('0xd4')]({'plain':!![]});fs[_0x984c('0xd5')](_0x37f597);var _0x279ddf={'channel':_0x984c('0xd6'),'account':_0x1546a1[_0x984c('0xd3')][_0x984c('0x2a')],'agent':_0x1546a1['Owner']?_0x1546a1[_0x984c('0xd7')][_0x984c('0xcd')]:_0x984c('0xd8'),'createdAt':moment(_0x1546a1[_0x984c('0x72')])[_0x984c('0xca')]('YYYY-MM-DD\x20HH:mm:ss')[_0x984c('0x93')](),'closedAt':_0x1546a1['closed']?moment(_0x1546a1[_0x984c('0xd9')])[_0x984c('0xca')](_0x984c('0xb9'))[_0x984c('0x93')]():'','disposition':_0x1546a1['disposition'],'messages':_(_0x1546a1[_0x984c('0xda')])[_0x984c('0x7d')]({'secret':![]})[_0x984c('0x2c')](function(_0x46a8b0){return{'date':moment(_0x46a8b0['createdAt'])['format'](_0x984c('0xb9'))[_0x984c('0x93')](),'sender':_0x46a8b0[_0x984c('0xd1')]===_0x984c('0xdb')?_0x46a8b0[_0x984c('0x6b')]?_0x46a8b0[_0x984c('0x6b')][_0x984c('0xcd')]:_0x984c('0xdc'):_0x46a8b0[_0x984c('0x61')][_0x984c('0xcf')]+(_0x46a8b0[_0x984c('0x61')][_0x984c('0xd0')]?'\x20'+_0x46a8b0[_0x984c('0x61')][_0x984c('0xd0')]:''),'body':_0x46a8b0[_0x984c('0x6e')],'direction':_0x46a8b0[_0x984c('0xd1')]===_0x984c('0xdb')?'A':'C','secret':_0x46a8b0['secret'],'read':_0x46a8b0[_0x984c('0x79')]};})[_0x984c('0x5d')]()};return ejs[_0x984c('0xdd')](path['join'](config[_0x984c('0xc5')],_0x984c('0xc6'),_0x984c('0xde'),_0x984c('0xdf')),{'interaction':_0x279ddf})[_0x984c('0x28')](function(_0x3e0c7c){var _0x3a6d04=path[_0x984c('0xcc')](_0x37f597,'transcript-'+_0x1546a1['id']+'-'+_0x5e2cf7+'.pdf');var _0x286e3c={'path':_0x3a6d04,'channel':_0x984c('0xd6'),'interactionId':_0x1546a1['id']};return pdf[_0x984c('0xe0')](_0x3e0c7c,_0x286e3c);})[_0x984c('0x28')](function(){return new BPromise(function(_0x6bc144,_0x26103a){zipdir(_0x37f597,{'saveTo':_0x310124},function(_0x53e3df,_0x3a51d5){if(_0x53e3df)return _0x26103a(_0x53e3df);return _0x6bc144(_0x3a51d5);});})[_0x984c('0x28')](function(){return new BPromise(function(_0x5e7193,_0x18d865){rimraf(_0x37f597,function(_0x417065){if(_0x417065)_0x18d865(_0x417065);return _0x5e7193();});});})['then'](function(){return _0x5cdac2[_0x984c('0xc3')](_0x310124,_0x5bbb76,function(_0x53cbe3){if(_0x53cbe3){console['log'](_0x984c('0xe1'),_0x53cbe3);}else{fs[_0x984c('0xe2')](_0x310124);}});});});}else{return _0x5cdac2[_0x984c('0x1b')](0xc8);}})[_0x984c('0x32')](handleError(_0x5cdac2,null));}; \ No newline at end of file +var _0xee68=['log','err','unlinkSync','eml-format','rimraf','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','save','update','then','destroy','stack','name','send','Users','map','fullname','Tags','split','forEach','push','index','SmsInteraction','rawAttributes','fieldName','key','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filters','select','field','from','tools_tags','u.id','u.fullname','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','buildExpression','keys','some','compact','isEmpty','i.SmsAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','unreadMessages','DESC','resolve','SmsAccountId','i.SmsAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','all','rows','catch','show','params','includeAll','include','create','body','describe','addMessage','SmsMessage','ids','getMessages','findOne','pick','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','omit','spread','color','removeTags','download','unix','join','root','tmp','server','files','attachments','format','transcript-%d-%s.zip','firstName','lastName','Messages','direction','secret','SmsAccount','Owner','get','mkdirSync','Sms','Account','closed','closedAt','out','System','Contact','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML'];(function(_0x1c4e3d,_0x4b5da5){var _0xc03b3b=function(_0x16a471){while(--_0x16a471){_0x1c4e3d['push'](_0x1c4e3d['shift']());}};_0xc03b3b(++_0x4b5da5);}(_0xee68,0x1d7));var _0x8ee6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xee68[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0x8ee6('0x0'));var rimraf=require(_0x8ee6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8ee6('0x2'));var BPromise=require(_0x8ee6('0x3'));var Mustache=require(_0x8ee6('0x4'));var util=require(_0x8ee6('0x5'));var path=require('path');var sox=require(_0x8ee6('0x6'));var csv=require(_0x8ee6('0x7'));var ejs=require(_0x8ee6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8ee6('0x9'));var squel=require(_0x8ee6('0xa'));var crypto=require(_0x8ee6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8ee6('0xc'));var toCsv=require(_0x8ee6('0x7'));var querystring=require(_0x8ee6('0xd'));var Papa=require(_0x8ee6('0xe'));var Redis=require(_0x8ee6('0xf'));var authService=require(_0x8ee6('0x10'));var qs=require(_0x8ee6('0x11'));var as=require(_0x8ee6('0x12'));var pdf=require(_0x8ee6('0x13'));var hardwareService=require(_0x8ee6('0x14'));var logger=require('../../config/logger')(_0x8ee6('0x15'));var utils=require(_0x8ee6('0x16'));var config=require(_0x8ee6('0x17'));var licenseUtil=require(_0x8ee6('0x18'));var db=require(_0x8ee6('0x19'))['db'];config[_0x8ee6('0x1a')]=_[_0x8ee6('0x1b')](config[_0x8ee6('0x1a')],{'host':_0x8ee6('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8ee6('0x1a')]));require(_0x8ee6('0x1d'))[_0x8ee6('0x1e')](socket);function respondWithStatusCode(_0x438eb8,_0x548c43){_0x548c43=_0x548c43||0xcc;return function(_0x547ccc){if(_0x547ccc){return _0x438eb8[_0x8ee6('0x1f')](_0x548c43);}return _0x438eb8['status'](_0x548c43)[_0x8ee6('0x20')]();};}function respondWithResult(_0x41473a,_0x583984){_0x583984=_0x583984||0xc8;return function(_0x4c563c){if(_0x4c563c){return _0x41473a[_0x8ee6('0x21')](_0x583984)['json'](_0x4c563c);}};}function respondWithFilteredResult(_0x3f150e,_0x47a1e1){return function(_0x3c4849){if(_0x3c4849){var _0x2e8592=typeof _0x47a1e1[_0x8ee6('0x22')]===_0x8ee6('0x23')&&typeof _0x47a1e1[_0x8ee6('0x24')]===_0x8ee6('0x23');var _0x1858a6=_0x3c4849[_0x8ee6('0x25')];var _0x43214e=_0x2e8592?0x0:_0x47a1e1['offset'];var _0x349668=_0x2e8592?_0x3c4849[_0x8ee6('0x25')]:_0x47a1e1[_0x8ee6('0x22')]+_0x47a1e1['limit'];var _0x724e9e;if(_0x349668>=_0x1858a6){_0x349668=_0x1858a6;_0x724e9e=0xc8;}else{_0x724e9e=0xce;}_0x3f150e[_0x8ee6('0x21')](_0x724e9e);return _0x3f150e[_0x8ee6('0x26')](_0x8ee6('0x27'),_0x43214e+'-'+_0x349668+'/'+_0x1858a6)[_0x8ee6('0x28')](_0x3c4849);}return null;};}function patchUpdates(_0x1f47cf){return function(_0x27832d){try{jsonpatch['apply'](_0x27832d,_0x1f47cf,!![]);}catch(_0x22cc86){return BPromise['reject'](_0x22cc86);}return _0x27832d[_0x8ee6('0x29')]();};}function saveUpdates(_0xb2affd,_0x3a05ea){return function(_0x46b5f6){if(_0x46b5f6){return _0x46b5f6[_0x8ee6('0x2a')](_0xb2affd)[_0x8ee6('0x2b')](function(_0x2ff971){return _0x2ff971;});}return null;};}function removeEntity(_0x3e65bb,_0x5569a9){return function(_0x57ac3c){if(_0x57ac3c){return _0x57ac3c[_0x8ee6('0x2c')]()[_0x8ee6('0x2b')](function(){_0x3e65bb[_0x8ee6('0x21')](0xcc)[_0x8ee6('0x20')]();});}};}function handleEntityNotFound(_0x31615d,_0x45c65e){return function(_0x1c2be4){if(!_0x1c2be4){_0x31615d['sendStatus'](0x194);}return _0x1c2be4;};}function handleError(_0xd16f39,_0x447d32){_0x447d32=_0x447d32||0x1f4;return function(_0x453998){logger['error'](_0x453998[_0x8ee6('0x2d')]);if(_0x453998[_0x8ee6('0x2e')]){delete _0x453998[_0x8ee6('0x2e')];}_0xd16f39[_0x8ee6('0x21')](_0x447d32)[_0x8ee6('0x2f')](_0x453998);};}function getInteractionUsers(_0x24e2eb,_0x3ba319){return new BPromise(function(_0x3becff,_0x48490e){try{if(_0x3ba319[_0x24e2eb['id']]){_0x24e2eb[_0x8ee6('0x30')]=_[_0x8ee6('0x31')](_0x3ba319[_0x24e2eb['id']],function(_0x848daa){return{'id':_0x848daa['id'],'fullname':_0x848daa[_0x8ee6('0x32')]};});}}catch(_0x43b17d){_0x48490e(_0x43b17d);}_0x3becff(_0x24e2eb);});}function getInteractionTags(_0x30e8a0,_0x4ef330){return new BPromise(function(_0x105235,_0x218718){try{if(_0x30e8a0['TagIds']){_0x30e8a0[_0x8ee6('0x33')]=[];_0x30e8a0['TagIds'][_0x8ee6('0x34')](',')[_0x8ee6('0x35')](function(_0x23bd52){_0x30e8a0[_0x8ee6('0x33')][_0x8ee6('0x36')](_0x4ef330[_0x23bd52]);});}delete _0x30e8a0['TagIds'];}catch(_0x411c6b){_0x218718(_0x411c6b);}_0x105235(_0x30e8a0);});}function updateSmsInteraction(_0x16de58,_0x24febd,_0x1b0c2f){return new BPromise(function(_0x1324b6,_0x1eaafd){return getInteractionUsers(_0x16de58,_0x1b0c2f)[_0x8ee6('0x2b')](function(_0x403d23){return getInteractionTags(_0x403d23,_0x24febd);})[_0x8ee6('0x2b')](function(_0x3aef23){_0x1324b6(_0x3aef23);})['catch'](function(_0x434e37){_0x1eaafd(_0x434e37);});});}exports[_0x8ee6('0x37')]=function(_0x198e87,_0x4efa0f){var _0x3d9cbf={},_0x19226b={},_0x10159e={'count':0x0,'rows':[]};var _0x3ce3ba=_['map'](db[_0x8ee6('0x38')][_0x8ee6('0x39')],function(_0x16cb4e){return{'name':_0x16cb4e[_0x8ee6('0x3a')],'type':_0x16cb4e['type'][_0x8ee6('0x3b')]};});_0x19226b['model']=_['map'](_0x3ce3ba,'name');_0x19226b[_0x8ee6('0x3c')]=_['keys'](_0x198e87[_0x8ee6('0x3c')]);_0x19226b['filters']=_[_0x8ee6('0x3d')](_0x19226b[_0x8ee6('0x3e')],_0x19226b[_0x8ee6('0x3c')]);_0x3d9cbf[_0x8ee6('0x3f')]=_[_0x8ee6('0x3d')](_0x19226b[_0x8ee6('0x3e')],qs[_0x8ee6('0x40')](_0x198e87[_0x8ee6('0x3c')][_0x8ee6('0x40')]));_0x3d9cbf['attributes']=_0x3d9cbf[_0x8ee6('0x3f')][_0x8ee6('0x41')]?_0x3d9cbf[_0x8ee6('0x3f')]:_0x19226b[_0x8ee6('0x3e')];if(!_0x198e87[_0x8ee6('0x3c')][_0x8ee6('0x42')]('nolimit')){_0x3d9cbf['limit']=qs[_0x8ee6('0x24')](_0x198e87['query'][_0x8ee6('0x24')]);_0x3d9cbf[_0x8ee6('0x22')]=qs[_0x8ee6('0x22')](_0x198e87['query'][_0x8ee6('0x22')]);}_0x3d9cbf[_0x8ee6('0x43')]=qs[_0x8ee6('0x44')](_0x198e87[_0x8ee6('0x3c')][_0x8ee6('0x44')]);_0x3d9cbf['where']=qs['filters'](_['pick'](_0x198e87[_0x8ee6('0x3c')],_0x19226b[_0x8ee6('0x45')]),_0x3ce3ba);var _0x2f686b=[];var _0x1e07bd=squel[_0x8ee6('0x46')]()[_0x8ee6('0x47')]('id')['field'](_0x8ee6('0x2e'))[_0x8ee6('0x47')]('color')[_0x8ee6('0x48')](_0x8ee6('0x49'));var _0x14728e=squel['select']()['field'](_0x8ee6('0x4a'))['field'](_0x8ee6('0x4b'))[_0x8ee6('0x47')]('ui.SmsInteractionId')[_0x8ee6('0x48')](_0x8ee6('0x4c'),'ui')[_0x8ee6('0x4d')](_0x8ee6('0x4e'),'u',_0x8ee6('0x4f'));var _0x4aa43b=squel[_0x8ee6('0x46')]()[_0x8ee6('0x48')](_0x8ee6('0x50'),'i')[_0x8ee6('0x4d')]('cm_contacts','c',_0x8ee6('0x51'))[_0x8ee6('0x4d')](_0x8ee6('0x4e'),'o',_0x8ee6('0x52'))[_0x8ee6('0x4d')](_0x8ee6('0x53'),'a',_0x8ee6('0x54'))[_0x8ee6('0x4d')](_0x8ee6('0x55'),'me',_0x8ee6('0x56'))[_0x8ee6('0x4d')]('sms_interaction_has_tags','it','it.SmsInteractionId\x20=\x20i.id')['left_join']('tools_tags','t',_0x8ee6('0x57'));var _0x49e734=squel[_0x8ee6('0x58')]();var _0x354272=[];var _0xfcd327=squel[_0x8ee6('0x58')]();var _0x10a479;if(_0x198e87[_0x8ee6('0x3c')]['search']){_0x10a479=as[_0x8ee6('0x59')](_0x198e87[_0x8ee6('0x3c')]['search']);var _0x16536e=_0x10a479[_0x8ee6('0x5a')];for(var _0x261bc5=0x0;_0x261bc5<_0x10a479[_0x8ee6('0x5b')][_0x8ee6('0x41')];_0x261bc5++){var _0xb2bbfd=_0x10a479[_0x8ee6('0x5b')][_0x261bc5];var _0xcffc4='i';var _0xe10741=_['find'](_0x3ce3ba,['name',_0xb2bbfd[_0x8ee6('0x47')]]);if(!_0xe10741){switch(_0xb2bbfd[_0x8ee6('0x47')]){case'unreadMessages':if(_0xb2bbfd[_0x8ee6('0x5c')]==0x1){_0x4aa43b[_0x8ee6('0x5d')]('`'+_0xb2bbfd[_0x8ee6('0x47')]+_0x8ee6('0x5e'));}else{_0x4aa43b[_0x8ee6('0x5d')]('`'+_0xb2bbfd[_0x8ee6('0x47')]+_0x8ee6('0x5f'));}break;case'Contact':if(_0xb2bbfd[_0x8ee6('0x60')]===_0x8ee6('0x61')){if(_0xb2bbfd[_0x8ee6('0x5c')][_0x8ee6('0x34')]('\x20')[_0x8ee6('0x41')]>0x1){_0x49e734[_0x16536e](_0x8ee6('0x62'),qs['getFullTextValue'](_0xb2bbfd[_0x8ee6('0x5c')]),null);}else{var _0x55b0fc='%'+_0xb2bbfd[_0x8ee6('0x5c')]+'%';_0x49e734[_0x16536e](_0x8ee6('0x63'),_0x55b0fc,_0x55b0fc,_0x55b0fc);}}else{_0xe10741=_['find'](_0x3ce3ba,[_0x8ee6('0x2e'),_0x8ee6('0x64')]);_0xb2bbfd[_0x8ee6('0x47')]=_0x8ee6('0x64');_0x176408=as['buildExpression'](_0xcffc4,_0xe10741[_0x8ee6('0x65')],_0xb2bbfd);_0x49e734[_0x16536e](_0x176408[_0x8ee6('0x66')],_0x176408[_0x8ee6('0x5c')][_0x8ee6('0x67')],_0x176408[_0x8ee6('0x5c')][_0x8ee6('0x20')]);}break;case _0x8ee6('0x68'):var _0x10e6ac=_0xb2bbfd[_0x8ee6('0x5c')][_0x8ee6('0x34')](',')[_0x8ee6('0x31')](function(_0x2d5e85){return Number(_0x2d5e85);});_0x10e6ac[_0x8ee6('0x35')](function(_0x28ad37){_0xfcd327['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x28ad37+',%');});_0x354272=_[_0x8ee6('0x69')](_0x354272,_0x10e6ac);break;case _0x8ee6('0x6a'):if(_0xb2bbfd[_0x8ee6('0x60')]===_0x8ee6('0x61')){_0x49e734[_0x16536e](_0x8ee6('0x6b'),'%'+_0xb2bbfd[_0x8ee6('0x5c')]+'%',null);}else{_0xe10741=_[_0x8ee6('0x6c')](_0x3ce3ba,['name',_0x8ee6('0x6d')]);_0xb2bbfd[_0x8ee6('0x47')]=_0x8ee6('0x6d');_0x176408=as['buildExpression'](_0xcffc4,_0xe10741[_0x8ee6('0x65')],_0xb2bbfd);_0x49e734[_0x16536e](_0x176408[_0x8ee6('0x66')],_0x176408[_0x8ee6('0x5c')][_0x8ee6('0x67')],_0x176408[_0x8ee6('0x5c')][_0x8ee6('0x20')]);}break;case'body':_0x176408=as[_0x8ee6('0x6e')]('me',null,_0xb2bbfd);_0x49e734[_0x16536e](_0x176408[_0x8ee6('0x66')],_0x176408['value'][_0x8ee6('0x67')],_0x176408[_0x8ee6('0x5c')]['end']);break;}}else{var _0x176408=as['buildExpression'](_0xcffc4,_0xe10741[_0x8ee6('0x65')],_0xb2bbfd);_0x49e734[_0x16536e](_0x176408[_0x8ee6('0x66')],_0x176408[_0x8ee6('0x5c')]['start'],_0x176408[_0x8ee6('0x5c')]['end']);}}}else{var _0xced575=_(_0x198e87[_0x8ee6('0x3c')])[_0x8ee6('0x6f')]()[_0x8ee6('0x31')](function(_0x28a12b){return _[_0x8ee6('0x70')](_0x3ce3ba,['name',_0x28a12b])?_0x28a12b:undefined;})[_0x8ee6('0x71')]()[_0x8ee6('0x5c')]();if(!_[_0x8ee6('0x72')](_0xced575)){_0xced575[_0x8ee6('0x35')](function(_0x90f770){if(_0x90f770==='SmsAccountId'){_0x4aa43b['where'](_0x8ee6('0x73'),[][_0x8ee6('0x74')](_0x198e87[_0x8ee6('0x3c')][_0x90f770]));}else if(_0x90f770===_0x8ee6('0x75')){var _0x5904ae=JSON['parse'](_0x198e87['query'][_0x90f770])[_0x8ee6('0x76')];var _0xa84dbe=JSON[_0x8ee6('0x77')](_0x198e87['query'][_0x90f770])[_0x8ee6('0x78')];_0x4aa43b[_0x8ee6('0x79')](_0x8ee6('0x7a'),_0x5904ae,_0xa84dbe);}else{if(_0x198e87['query'][_0x90f770]===_0x8ee6('0x7b')){_0x4aa43b[_0x8ee6('0x79')]('i.'+_0x90f770+_0x8ee6('0x7c'));}else{_0x4aa43b[_0x8ee6('0x79')]('i.'+_0x90f770+_0x8ee6('0x7d'),_0x198e87['query'][_0x90f770]);}}});}if(_0x198e87[_0x8ee6('0x3c')][_0x8ee6('0x7e')]){if(_0x198e87[_0x8ee6('0x3c')][_0x8ee6('0x7e')]==0x1){_0x4aa43b[_0x8ee6('0x5d')]('`unreadMessages`\x20=\x200');}else{_0x4aa43b[_0x8ee6('0x5d')](_0x8ee6('0x7f'));}}if(_0x198e87['query'][_0x8ee6('0x80')]){_0x354272=_[_0x8ee6('0x81')](_0x198e87['query'][_0x8ee6('0x80')])?_0x198e87[_0x8ee6('0x3c')][_0x8ee6('0x80')]:new Array(_0x198e87[_0x8ee6('0x3c')][_0x8ee6('0x80')]);_0x354272[_0x8ee6('0x35')](function(_0x479294){_0xfcd327['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x479294+',%');});}if(_0x198e87[_0x8ee6('0x3c')][_0x8ee6('0x82')]){var _0x4797b3=_0x198e87[_0x8ee6('0x3c')][_0x8ee6('0x82')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x4797b3)){_0x49e734['or'](_0x8ee6('0x83'),_0x4797b3+'%')['or'](_0x8ee6('0x84'),_0x4797b3+'%');}else{_0x49e734['or'](_0x8ee6('0x85'),qs[_0x8ee6('0x86')](_0x4797b3))['or'](_0x8ee6('0x87'),_0x4797b3+'%');}}}_0x4aa43b[_0x8ee6('0x79')](_0x49e734);_0x4aa43b[_0x8ee6('0x88')](_0x8ee6('0x89'));var _0x430e9f={'type':db[_0x8ee6('0x8a')][_0x8ee6('0x8b')][_0x8ee6('0x8c')],'raw':!![]};var _0x4c9789=_0x4aa43b['clone']();_0x4c9789['field'](_0x8ee6('0x89'));_0x4c9789[_0x8ee6('0x47')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x8ee6('0x8d'));if(_0x3d9cbf[_0x8ee6('0x43')]){_0x3d9cbf[_0x8ee6('0x43')][_0x8ee6('0x35')](function(_0x2896d9){var _0x35813f=_0x2896d9[0x0]==='contactName'?_0x2896d9[0x0]:'i.'+_0x2896d9[0x0];_0x4aa43b[_0x8ee6('0x43')](_0x35813f,_0x2896d9[0x1]===_0x8ee6('0x8e')?![]:!![]);});}if(!_[_0x8ee6('0x72')](_0x354272)){_0x4aa43b[_0x8ee6('0x5d')](_0xfcd327);_0x4c9789[_0x8ee6('0x79')]('t.id\x20IN\x20?',_0x354272);}BPromise[_0x8ee6('0x8f')]()[_0x8ee6('0x2b')](function(){if(!_0x10a479){if(_0x198e87[_0x8ee6('0x3c')][_0x8ee6('0x90')])return;_0x4c9789[_0x8ee6('0x79')](_0x8ee6('0x91'));_0x4aa43b[_0x8ee6('0x79')](_0x8ee6('0x91'));return;}if(_0x198e87['user'][_0x8ee6('0x92')]!==_0x8ee6('0x93'))return;return _0x198e87[_0x8ee6('0x94')][_0x8ee6('0x95')]({'attributes':['id'],'raw':!![]})[_0x8ee6('0x2b')](function(_0x47e538){if(_['isEmpty'](_0x47e538)){_0x4c9789['where']('i.SmsAccountId\x20IS\x20NULL');_0x4aa43b[_0x8ee6('0x79')](_0x8ee6('0x96'));}else{_0x4c9789[_0x8ee6('0x79')](_0x8ee6('0x73'),_['map'](_0x47e538,'id'));_0x4aa43b['where']('i.SmsAccountId\x20IN\x20?',_[_0x8ee6('0x31')](_0x47e538,'id'));}});})[_0x8ee6('0x2b')](function(){if(_0x198e87['user'][_0x8ee6('0x92')]==='agent'&&!_0x10a479&&!_0x198e87[_0x8ee6('0x3c')][_0x8ee6('0x90')])return[];return db['sequelize'][_0x8ee6('0x3c')](_0x4c9789[_0x8ee6('0x97')](),_0x430e9f);})['then'](function(_0x50160b){_0x10159e[_0x8ee6('0x25')]=_0x50160b[_0x8ee6('0x41')];if(_0x10159e['count']===0x0)return[];return db[_0x8ee6('0x98')][_0x8ee6('0x3c')](_0x1e07bd[_0x8ee6('0x97')](),_0x430e9f)[_0x8ee6('0x2b')](function(_0x363262){_0x2f686b=_[_0x8ee6('0x99')](_0x363262,'id');_0x430e9f=_[_0x8ee6('0x9a')](_0x430e9f,{'model':db[_0x8ee6('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x198e87[_0x8ee6('0x3c')][_0x8ee6('0x40')]){_0x3d9cbf[_0x8ee6('0x3f')][_0x8ee6('0x35')](function(_0x19ba4d){_0x4aa43b['field']('i.'+_0x19ba4d);});}else{_0x4aa43b[_0x8ee6('0x47')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x8ee6('0x8d'));_0x4aa43b['field']('a.key','Account.key');_0x4aa43b['field'](_0x8ee6('0x9b'),_0x8ee6('0x9c'));_0x4aa43b[_0x8ee6('0x47')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x4aa43b[_0x8ee6('0x47')](_0x8ee6('0x9d'));_0x4aa43b[_0x8ee6('0x47')]('c.firstName',_0x8ee6('0x9e'));_0x4aa43b['field'](_0x8ee6('0x9f'),'Contact.lastName');_0x4aa43b[_0x8ee6('0x47')](_0x8ee6('0xa0'),_0x8ee6('0xa1'));_0x4aa43b[_0x8ee6('0x47')](_0x8ee6('0xa2'),_0x8ee6('0xa3'));_0x4aa43b[_0x8ee6('0x47')](_0x8ee6('0xa4'),_0x8ee6('0xa5'));_0x4aa43b[_0x8ee6('0x47')](_0x8ee6('0xa6'),_0x8ee6('0xa7'));_0x4aa43b['field']('o.fullname',_0x8ee6('0xa8'));_0x4aa43b[_0x8ee6('0x47')](_0x8ee6('0xa9'),_0x8ee6('0xaa'));_0x4aa43b[_0x8ee6('0x47')](_0x8ee6('0xab'),_0x8ee6('0xac'));}if(_0x3d9cbf[_0x8ee6('0x24')])_0x4aa43b['limit'](_0x3d9cbf[_0x8ee6('0x24')]);if(_0x3d9cbf[_0x8ee6('0x22')])_0x4aa43b[_0x8ee6('0x22')](_0x3d9cbf[_0x8ee6('0x22')]);return db['sequelize'][_0x8ee6('0x3c')](_0x4aa43b[_0x8ee6('0x97')](),_0x430e9f);})[_0x8ee6('0x2b')](function(_0x48689d){if(_0x48689d[_0x8ee6('0x41')]>0x0)_0x14728e[_0x8ee6('0x79')](_0x8ee6('0xad'),_['map'](_0x48689d,'id'));return db['sequelize'][_0x8ee6('0x3c')](_0x14728e[_0x8ee6('0x97')](),_0x430e9f)[_0x8ee6('0x2b')](function(_0x1fc1e2){var _0x411d0d=_['groupBy'](_0x1fc1e2,_0x8ee6('0xae'));var _0x5e16ff=[];_0x48689d[_0x8ee6('0x35')](function(_0x16df08){_0x5e16ff[_0x8ee6('0x36')](updateSmsInteraction(_0x16df08,_0x2f686b,_0x411d0d));});return BPromise[_0x8ee6('0xaf')](_0x5e16ff);});});})[_0x8ee6('0x2b')](function(_0x3e0dfd){_0x10159e[_0x8ee6('0xb0')]=_0x3e0dfd;return _0x10159e;})[_0x8ee6('0x2b')](respondWithFilteredResult(_0x4efa0f,_0x3d9cbf))[_0x8ee6('0xb1')](handleError(_0x4efa0f,null));};exports[_0x8ee6('0xb2')]=function(_0x5bbd6b,_0xfb051a){var _0x2fb8b3={'raw':![],'where':{'id':_0x5bbd6b[_0x8ee6('0xb3')]['id']}},_0x98927={};_0x98927['model']=_['keys'](db[_0x8ee6('0x38')][_0x8ee6('0x39')]);_0x98927[_0x8ee6('0x3c')]=_['keys'](_0x5bbd6b[_0x8ee6('0x3c')]);_0x98927[_0x8ee6('0x45')]=_[_0x8ee6('0x3d')](_0x98927[_0x8ee6('0x3e')],_0x98927[_0x8ee6('0x3c')]);_0x2fb8b3[_0x8ee6('0x3f')]=_[_0x8ee6('0x3d')](_0x98927[_0x8ee6('0x3e')],qs[_0x8ee6('0x40')](_0x5bbd6b['query'][_0x8ee6('0x40')]));_0x2fb8b3[_0x8ee6('0x3f')]=_0x2fb8b3[_0x8ee6('0x3f')]['length']?_0x2fb8b3[_0x8ee6('0x3f')]:_0x98927[_0x8ee6('0x3e')];if(_0x5bbd6b['query'][_0x8ee6('0xb4')]){_0x2fb8b3[_0x8ee6('0xb5')]=[{'all':!![]}];}_0x2fb8b3=_[_0x8ee6('0x9a')]({},_0x2fb8b3,_0x5bbd6b['options']);return db[_0x8ee6('0x38')]['find'](_0x2fb8b3)[_0x8ee6('0x2b')](handleEntityNotFound(_0xfb051a,null))['then'](respondWithResult(_0xfb051a,null))[_0x8ee6('0xb1')](handleError(_0xfb051a,null));};exports['create']=function(_0x3e073a,_0x3f204b){return db['SmsInteraction'][_0x8ee6('0xb6')](_0x3e073a[_0x8ee6('0xb7')],{})[_0x8ee6('0x2b')](respondWithResult(_0x3f204b,0xc9))[_0x8ee6('0xb1')](handleError(_0x3f204b,null));};exports['update']=function(_0x1141ac,_0x30ae3a){if(_0x1141ac[_0x8ee6('0xb7')]['id']){delete _0x1141ac['body']['id'];}return db[_0x8ee6('0x38')][_0x8ee6('0x6c')]({'where':{'id':_0x1141ac[_0x8ee6('0xb3')]['id']}})['then'](handleEntityNotFound(_0x30ae3a,null))['then'](saveUpdates(_0x1141ac['body'],null))[_0x8ee6('0x2b')](respondWithResult(_0x30ae3a,null))[_0x8ee6('0xb1')](handleError(_0x30ae3a,null));};exports[_0x8ee6('0x2c')]=function(_0xa9bef3,_0x42f4b4){return db[_0x8ee6('0x38')]['find']({'where':{'id':_0xa9bef3[_0x8ee6('0xb3')]['id']}})['then'](handleEntityNotFound(_0x42f4b4,null))['then'](removeEntity(_0x42f4b4,null))[_0x8ee6('0xb1')](handleError(_0x42f4b4,null));};exports[_0x8ee6('0xb8')]=function(_0x4eab31,_0x2c49f9){return db[_0x8ee6('0x38')][_0x8ee6('0xb8')]()[_0x8ee6('0x2b')](respondWithResult(_0x2c49f9,null))['catch'](handleError(_0x2c49f9,null));};exports[_0x8ee6('0xb9')]=function(_0x23f43d,_0x2e1a9f,_0x7e1a8a){return db[_0x8ee6('0xba')][_0x8ee6('0x6c')]({'where':{'id':_0x23f43d[_0x8ee6('0xb3')]['id']}})[_0x8ee6('0x2b')](handleEntityNotFound(_0x2e1a9f,null))[_0x8ee6('0x2b')](function(_0x37a7f2){if(_0x37a7f2){return _0x37a7f2[_0x8ee6('0xb9')](_0x23f43d[_0x8ee6('0xb7')][_0x8ee6('0xbb')],_['omit'](_0x23f43d[_0x8ee6('0xb7')],[_0x8ee6('0xbb'),'id'])||{});}})[_0x8ee6('0x2b')](respondWithResult(_0x2e1a9f,null))['catch'](handleError(_0x2e1a9f,null));};exports[_0x8ee6('0xbc')]=function(_0x14453a,_0x3f0959,_0xa2a384){var _0x3e9adf={'raw':![],'where':{}};var _0x5eb3b2={};var _0x2bd843={'count':0x0,'rows':[]};return db[_0x8ee6('0x38')][_0x8ee6('0xbd')]({'where':{'id':_0x14453a['params']['id']}})[_0x8ee6('0x2b')](handleEntityNotFound(_0x3f0959,null))[_0x8ee6('0x2b')](function(_0x35c857){if(_0x35c857){_0x5eb3b2[_0x8ee6('0x3e')]=_[_0x8ee6('0x6f')](db[_0x8ee6('0xba')][_0x8ee6('0x39')]);_0x5eb3b2['query']=_[_0x8ee6('0x6f')](_0x14453a[_0x8ee6('0x3c')]);_0x5eb3b2[_0x8ee6('0x45')]=_['intersection'](_0x5eb3b2[_0x8ee6('0x3e')],_0x5eb3b2[_0x8ee6('0x3c')]);_0x3e9adf[_0x8ee6('0x3f')]=_[_0x8ee6('0x3d')](_0x5eb3b2['model'],qs['fields'](_0x14453a[_0x8ee6('0x3c')][_0x8ee6('0x40')]));_0x3e9adf[_0x8ee6('0x3f')]=_0x3e9adf[_0x8ee6('0x3f')][_0x8ee6('0x41')]?_0x3e9adf[_0x8ee6('0x3f')]:_0x5eb3b2[_0x8ee6('0x3e')];if(!_0x14453a[_0x8ee6('0x3c')][_0x8ee6('0x42')]('nolimit')){_0x3e9adf[_0x8ee6('0x24')]=qs[_0x8ee6('0x24')](_0x14453a[_0x8ee6('0x3c')][_0x8ee6('0x24')]);_0x3e9adf[_0x8ee6('0x22')]=qs[_0x8ee6('0x22')](_0x14453a[_0x8ee6('0x3c')][_0x8ee6('0x22')]);}_0x3e9adf[_0x8ee6('0x43')]=qs[_0x8ee6('0x44')](_0x14453a[_0x8ee6('0x3c')][_0x8ee6('0x44')]);_0x3e9adf[_0x8ee6('0x79')]=qs['filters'](_[_0x8ee6('0xbe')](_0x14453a[_0x8ee6('0x3c')],_0x5eb3b2[_0x8ee6('0x45')]));_0x3e9adf['where'][_0x8ee6('0xae')]=_0x35c857['id'];if(_0x14453a[_0x8ee6('0x3c')][_0x8ee6('0x82')]){_0x3e9adf[_0x8ee6('0x79')]=_[_0x8ee6('0x9a')](_0x3e9adf[_0x8ee6('0x79')],{'$or':_['map'](_0x3e9adf[_0x8ee6('0x3f')],function(_0x21df36){var _0x3c677a={};_0x3c677a[_0x21df36]={'$like':'%'+_0x14453a[_0x8ee6('0x3c')][_0x8ee6('0x82')]+'%'};return _0x3c677a;})});}if(_0x14453a[_0x8ee6('0x3c')]['$gte']){var _0x14ef95=_0x14453a['query'][_0x8ee6('0x76')][_0x8ee6('0x34')](',');var _0xd6bff1={};_0xd6bff1[_0x14ef95[0x0]]={'$gte':moment(_0x14ef95[0x1])['format'](_0x8ee6('0xbf'))};_0x3e9adf[_0x8ee6('0x79')]=_[_0x8ee6('0x9a')](_0x3e9adf['where'],_0xd6bff1);}_0x3e9adf=_[_0x8ee6('0x9a')]({},_0x3e9adf,_0x14453a['options']);return db[_0x8ee6('0xba')][_0x8ee6('0x25')]({'where':_0x3e9adf['where']})[_0x8ee6('0x2b')](function(_0x588f43){_0x2bd843[_0x8ee6('0x25')]=_0x588f43;if(_0x14453a[_0x8ee6('0x3c')][_0x8ee6('0xb4')]){_0x3e9adf[_0x8ee6('0xb5')]=[{'all':!![]}];}return db[_0x8ee6('0xba')][_0x8ee6('0xc0')](_0x3e9adf);})[_0x8ee6('0x2b')](function(_0x19ebb3){_0x2bd843['rows']=_0x19ebb3;return _0x2bd843;});}})[_0x8ee6('0x2b')](respondWithFilteredResult(_0x3f0959,_0x3e9adf))[_0x8ee6('0xb1')](handleError(_0x3f0959,null));};exports[_0x8ee6('0xc1')]=function(_0x119331,_0x569647,_0x2ac0df){return db[_0x8ee6('0x38')][_0x8ee6('0x6c')]({'where':{'id':_0x119331[_0x8ee6('0xb3')]['id']}})[_0x8ee6('0x2b')](handleEntityNotFound(_0x569647,null))[_0x8ee6('0x2b')](function(_0x25e412){if(_0x25e412){return _0x25e412[_0x8ee6('0xc2')](_0x119331[_0x8ee6('0xb7')][_0x8ee6('0xbb')],_[_0x8ee6('0xc3')](_0x119331[_0x8ee6('0xb7')],[_0x8ee6('0xbb'),'id'])||{})[_0x8ee6('0xc4')](function(){return db['Tag'][_0x8ee6('0xc0')]({'attributes':['id',_0x8ee6('0x2e'),_0x8ee6('0xc5')],'where':{'id':_0x119331[_0x8ee6('0xb7')]['ids']}});})[_0x8ee6('0x2b')](function(_0x254690){socket['emit']('smsInteractionTags:save',{'id':Number(_0x119331[_0x8ee6('0xb3')]['id']),'tags':_0x254690||[]});return{'id':Number(_0x119331[_0x8ee6('0xb3')]['id']),'tags':_0x254690||[]};});}})[_0x8ee6('0x2b')](respondWithResult(_0x569647,null))['catch'](handleError(_0x569647,null));};exports[_0x8ee6('0xc6')]=function(_0x21f4a6,_0x490b88,_0x26ab06){return db['SmsInteraction']['find']({'where':{'id':_0x21f4a6[_0x8ee6('0xb3')]['id']}})[_0x8ee6('0x2b')](handleEntityNotFound(_0x490b88,null))['then'](function(_0xd340f1){if(_0xd340f1){return _0xd340f1[_0x8ee6('0xc6')](_0x21f4a6[_0x8ee6('0x3c')][_0x8ee6('0xbb')]);}})['then'](respondWithStatusCode(_0x490b88,null))['catch'](handleError(_0x490b88,null));};exports[_0x8ee6('0xc7')]=function(_0x4e0faf,_0x41c85e){var _0x14d3fa=moment()[_0x8ee6('0xc8')]()['toString']();var _0xeaf1d1=path[_0x8ee6('0xc9')](config[_0x8ee6('0xca')],'server','files',_0x8ee6('0xcb'));var _0x5bc4ef=path[_0x8ee6('0xc9')](config[_0x8ee6('0xca')],_0x8ee6('0xcc'),_0x8ee6('0xcd'),_0x8ee6('0xce'));var _0x4b25f4=path[_0x8ee6('0xc9')](_0xeaf1d1,_0x14d3fa);var _0x130b45=util[_0x8ee6('0xcf')](_0x8ee6('0xd0'),_0x4e0faf[_0x8ee6('0xb3')]['id'],_0x14d3fa);var _0x3cae08=path[_0x8ee6('0xc9')](_0xeaf1d1,_0x130b45);var _0x216dc4=[];_0x216dc4[_0x8ee6('0x36')]({'model':db['User'],'as':_0x8ee6('0x6a'),'attributes':['id',_0x8ee6('0x32')],'raw':!![]});_0x216dc4['push']({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x8ee6('0xd1'),_0x8ee6('0xd2')],'raw':!![]});var _0x43a288=[{'model':db[_0x8ee6('0xba')],'as':_0x8ee6('0xd3'),'attributes':['id',_0x8ee6('0xb7'),'createdAt',_0x8ee6('0xd4'),_0x8ee6('0xd5'),_0x8ee6('0x7e')],'include':_0x216dc4}];_0x43a288[_0x8ee6('0x36')]({'model':db[_0x8ee6('0xd6')],'as':'Account','attributes':['id',_0x8ee6('0x2e')]});_0x43a288[_0x8ee6('0x36')]({'model':db[_0x8ee6('0x6a')],'as':_0x8ee6('0xd7'),'attributes':['id',_0x8ee6('0x32')]});return db[_0x8ee6('0x38')][_0x8ee6('0x6c')]({'where':{'id':_0x4e0faf[_0x8ee6('0xb3')]['id']},'include':_0x43a288})[_0x8ee6('0x2b')](handleEntityNotFound(_0x41c85e,null))['then'](function(_0x2b80e0){if(_0x2b80e0){var _0x294112=_0x2b80e0[_0x8ee6('0xd8')]({'plain':!![]});fs[_0x8ee6('0xd9')](_0x4b25f4);var _0x1d6d69={'channel':_0x8ee6('0xda'),'account':_0x294112[_0x8ee6('0xdb')][_0x8ee6('0x2e')],'agent':_0x294112[_0x8ee6('0xd7')]?_0x294112['Owner'][_0x8ee6('0x32')]:'N.A.','createdAt':moment(_0x294112['createdAt'])[_0x8ee6('0xcf')]('YYYY-MM-DD\x20HH:mm:ss')[_0x8ee6('0x97')](),'closedAt':_0x294112[_0x8ee6('0xdc')]?moment(_0x294112[_0x8ee6('0xdd')])[_0x8ee6('0xcf')](_0x8ee6('0xbf'))['toString']():'','disposition':_0x294112['disposition'],'messages':_(_0x294112[_0x8ee6('0xd3')])['filter']({'secret':![]})['map'](function(_0x52ed9f){return{'date':moment(_0x52ed9f[_0x8ee6('0x75')])[_0x8ee6('0xcf')](_0x8ee6('0xbf'))[_0x8ee6('0x97')](),'sender':_0x52ed9f[_0x8ee6('0xd4')]===_0x8ee6('0xde')?_0x52ed9f[_0x8ee6('0x6a')]?_0x52ed9f[_0x8ee6('0x6a')]['fullname']:_0x8ee6('0xdf'):_0x52ed9f[_0x8ee6('0xe0')]['firstName']+(_0x52ed9f[_0x8ee6('0xe0')][_0x8ee6('0xd2')]?'\x20'+_0x52ed9f[_0x8ee6('0xe0')][_0x8ee6('0xd2')]:''),'body':_0x52ed9f[_0x8ee6('0xb7')],'direction':_0x52ed9f[_0x8ee6('0xd4')]==='out'?'A':'C','secret':_0x52ed9f['secret'],'read':_0x52ed9f['read']};})['value']()};return ejs[_0x8ee6('0xe1')](path[_0x8ee6('0xc9')](config[_0x8ee6('0xca')],'server',_0x8ee6('0xe2'),_0x8ee6('0xe3')),{'interaction':_0x1d6d69})[_0x8ee6('0x2b')](function(_0x5871d9){var _0x309f34=path[_0x8ee6('0xc9')](_0x4b25f4,_0x8ee6('0xe4')+_0x294112['id']+'-'+_0x14d3fa+_0x8ee6('0xe5'));var _0x42381a={'path':_0x309f34,'channel':_0x8ee6('0xda'),'interactionId':_0x294112['id']};return pdf[_0x8ee6('0xe6')](_0x5871d9,_0x42381a);})['then'](function(){return new BPromise(function(_0x747ccf,_0x3a6b3d){zipdir(_0x4b25f4,{'saveTo':_0x3cae08},function(_0x14a9f0,_0x31c6c2){if(_0x14a9f0)return _0x3a6b3d(_0x14a9f0);return _0x747ccf(_0x31c6c2);});})['then'](function(){return new BPromise(function(_0x9bb3d2,_0x329793){rimraf(_0x4b25f4,function(_0x3b6f72){if(_0x3b6f72)_0x329793(_0x3b6f72);return _0x9bb3d2();});});})[_0x8ee6('0x2b')](function(){return _0x41c85e[_0x8ee6('0xc7')](_0x3cae08,_0x130b45,function(_0x122cd1){if(_0x122cd1){console[_0x8ee6('0xe7')](_0x8ee6('0xe8'),_0x122cd1);}else{fs[_0x8ee6('0xe9')](_0x3cae08);}});});});}else{return _0x41c85e['sendStatus'](0xc8);}})[_0x8ee6('0xb1')](handleError(_0x41c85e,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 7716185..7a48bd5 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 _0x4137=['setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage'];(function(_0x3357df,_0x26b7d3){var _0x1ece50=function(_0x30e7ef){while(--_0x30e7ef){_0x3357df['push'](_0x3357df['shift']());}};_0x1ece50(++_0x26b7d3);}(_0x4137,0xf8));var _0x7413=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4137[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0x7413('0x0'));var SmsInteraction=require(_0x7413('0x1'))['db'][_0x7413('0x2')];var SmsMessage=require(_0x7413('0x1'))['db'][_0x7413('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x7413('0x4')](0x0);var events={'afterCreate':_0x7413('0x5'),'afterUpdate':_0x7413('0x6'),'afterDestroy':_0x7413('0x7')};function emitEvent(_0x3dc48a){return function(_0x451a96,_0x3bb181,_0x4fbade){_0x451a96[_0x7413('0x8')]({'attributes':['id'],'raw':!![]})[_0x7413('0x9')](function(_0x5b39ac){_0x451a96[_0x7413('0xa')]('Users',_0x5b39ac[_0x7413('0xb')](function(_0x120dc2){return{'id':_0x120dc2['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x451a96['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7413('0x9')](function(_0x2f4b54){_0x451a96['setDataValue'](_0x7413('0xc'),_0x2f4b54[_0x7413('0xd')]);SmsInteractionEvents[_0x7413('0xe')](_0x3dc48a+':'+_0x451a96['id'],_0x451a96);SmsInteractionEvents[_0x7413('0xe')](_0x3dc48a,_0x451a96);_0x4fbade(null);})[_0x7413('0xf')](_0x4fbade(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x7413('0x10')](e,emitEvent(event));}}module[_0x7413('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0xd7d1=['SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x17b6b4,_0x41253e){var _0x16d1c1=function(_0x4bed40){while(--_0x4bed40){_0x17b6b4['push'](_0x17b6b4['shift']());}};_0x16d1c1(++_0x41253e);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x465d00,_0x3fdb0f){_0x465d00=_0x465d00-0x0;var _0x4aa533=_0xd7d1[_0x465d00];return _0x4aa533;};'use strict';var EventEmitter=require(_0x1d7d('0x0'));var SmsInteraction=require(_0x1d7d('0x1'))['db'][_0x1d7d('0x2')];var SmsMessage=require(_0x1d7d('0x1'))['db'][_0x1d7d('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x1d7d('0x4')](0x0);var events={'afterCreate':_0x1d7d('0x5'),'afterUpdate':_0x1d7d('0x6'),'afterDestroy':_0x1d7d('0x7')};function emitEvent(_0x1adb6b){return function(_0x3c0839,_0x1a2564,_0x14b2b9){_0x3c0839['getUsers']({'attributes':['id'],'raw':!![]})[_0x1d7d('0x8')](function(_0x1aa456){_0x3c0839[_0x1d7d('0x9')](_0x1d7d('0xa'),_0x1aa456[_0x1d7d('0xb')](function(_0x268732){return{'id':_0x268732['id']};}));return SmsMessage[_0x1d7d('0xc')]({'where':{'SmsInteractionId':_0x3c0839['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1d7d('0x8')](function(_0x1ad06f){_0x3c0839[_0x1d7d('0x9')](_0x1d7d('0xd'),_0x1ad06f['length']);SmsInteractionEvents[_0x1d7d('0xe')](_0x1adb6b+':'+_0x3c0839['id'],_0x3c0839);SmsInteractionEvents['emit'](_0x1adb6b,_0x3c0839);_0x14b2b9(null);})[_0x1d7d('0xf')](_0x14b2b9(null));};}for(var e in events){if(events[_0x1d7d('0x10')](e)){var event=events[e];SmsInteraction[_0x1d7d('0x11')](e,emitEvent(event));}}module[_0x1d7d('0x12')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 63d4057..6c37766 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 _0x22a3=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','api','bluebird','request-promise','path','../../config/environment','exports','define','SmsInteraction','sms_interactions'];(function(_0x3e91a9,_0x53c466){var _0x25c9ad=function(_0x69ee2d){while(--_0x69ee2d){_0x3e91a9['push'](_0x3e91a9['shift']());}};_0x25c9ad(++_0x53c466);}(_0x22a3,0x6e));var _0x322a=function(_0xb6a965,_0x5c5ace){_0xb6a965=_0xb6a965-0x0;var _0x51d37d=_0x22a3[_0xb6a965];return _0x51d37d;};'use strict';var _=require('lodash');var util=require(_0x322a('0x0'));var logger=require('../../config/logger')(_0x322a('0x1'));var moment=require('moment');var BPromise=require(_0x322a('0x2'));var rp=require(_0x322a('0x3'));var fs=require('fs');var path=require(_0x322a('0x4'));var rimraf=require('rimraf');var config=require(_0x322a('0x5'));var attributes=require('./smsInteraction.attributes');module[_0x322a('0x6')]=function(_0x56c43e,_0x2681eb){return _0x56c43e[_0x322a('0x7')](_0x322a('0x8'),attributes,{'tableName':_0x322a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x47a048,_0x230001,_0x2df465){if(_0x47a048[_0x322a('0xa')](_0x322a('0xb'))){_0x47a048[_0x322a('0xc')]=moment()[_0x322a('0xd')](_0x322a('0xe'));}_0x2df465(null,_0x47a048);}}});}; \ No newline at end of file +var _0x8921=['./smsInteraction.attributes','exports','define','SmsInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','request-promise','path','../../config/environment'];(function(_0x58e35c,_0xa4ed5a){var _0x27a7de=function(_0x2ec406){while(--_0x2ec406){_0x58e35c['push'](_0x58e35c['shift']());}};_0x27a7de(++_0xa4ed5a);}(_0x8921,0x143));var _0x1892=function(_0x3e9bd3,_0x3e6201){_0x3e9bd3=_0x3e9bd3-0x0;var _0x3a11be=_0x8921[_0x3e9bd3];return _0x3a11be;};'use strict';var _=require(_0x1892('0x0'));var util=require(_0x1892('0x1'));var logger=require(_0x1892('0x2'))(_0x1892('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1892('0x4'));var fs=require('fs');var path=require(_0x1892('0x5'));var rimraf=require('rimraf');var config=require(_0x1892('0x6'));var attributes=require(_0x1892('0x7'));module[_0x1892('0x8')]=function(_0x480d1c,_0x591f7a){return _0x480d1c[_0x1892('0x9')](_0x1892('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5eb0a0,_0x348191,_0x24d169){if(_0x5eb0a0[_0x1892('0xb')]('closed')){_0x5eb0a0[_0x1892('0xc')]=moment()[_0x1892('0xd')](_0x1892('0xe'));}_0x24d169(null,_0x5eb0a0);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 7440e5c..618cc0b 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 _0xfb4c=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost','./smsInteraction.socket','register','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','SmsInteraction','update','options','raw','where','attributes','limit','debug','UpdateSmsInteraction','AddTagsToSmsInteraction','find','addTags','ids','body','spread','AddTags','lodash','util','bluebird','randomstring'];(function(_0x639430,_0x3c1d15){var _0x282adb=function(_0x115d59){while(--_0x115d59){_0x639430['push'](_0x639430['shift']());}};_0x282adb(++_0x3c1d15);}(_0xfb4c,0xf8));var _0xcfb4=function(_0x45793d,_0x27c175){_0x45793d=_0x45793d-0x0;var _0x569f4d=_0xfb4c[_0x45793d];return _0x569f4d;};'use strict';var _=require(_0xcfb4('0x0'));var util=require(_0xcfb4('0x1'));var moment=require('moment');var BPromise=require(_0xcfb4('0x2'));var rs=require(_0xcfb4('0x3'));var fs=require('fs');var Redis=require(_0xcfb4('0x4'));var db=require(_0xcfb4('0x5'))['db'];var utils=require(_0xcfb4('0x6'));var logger=require(_0xcfb4('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcfb4('0x8'));var client=jayson['client'][_0xcfb4('0x9')]({'port':0x232a});config[_0xcfb4('0xa')]=_[_0xcfb4('0xb')](config['redis'],{'host':_0xcfb4('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcfb4('0xa')]));require(_0xcfb4('0xd'))[_0xcfb4('0xe')](socket);function respondWithRpcPromise(_0x493050,_0x209b4f,_0xb2bf1d){return new BPromise(function(_0x31fb86,_0x471846){return client[_0xcfb4('0xf')](_0x493050,_0xb2bf1d)[_0xcfb4('0x10')](function(_0x211436){logger['info'](_0xcfb4('0x11'),_0x209b4f,_0xcfb4('0x12'));logger['debug'](_0xcfb4('0x13'),_0x209b4f,'request\x20sent',JSON[_0xcfb4('0x14')](_0x211436));if(_0x211436[_0xcfb4('0x15')]){if(_0x211436[_0xcfb4('0x15')][_0xcfb4('0x16')]===0x1f4){logger['error'](_0xcfb4('0x11'),_0x209b4f,_0x211436[_0xcfb4('0x15')]['message']);return _0x471846(_0x211436['error'][_0xcfb4('0x17')]);}logger[_0xcfb4('0x15')](_0xcfb4('0x11'),_0x209b4f,_0x211436[_0xcfb4('0x15')][_0xcfb4('0x17')]);return _0x31fb86(_0x211436[_0xcfb4('0x15')]['message']);}else{logger[_0xcfb4('0x18')](_0xcfb4('0x11'),_0x209b4f,_0xcfb4('0x12'));_0x31fb86(_0x211436['result'][_0xcfb4('0x17')]);}})[_0xcfb4('0x19')](function(_0x5f9335){logger['error'](_0xcfb4('0x11'),_0x209b4f,_0x5f9335);_0x471846(_0x5f9335);});});}exports['UpdateSmsInteraction']=function(_0x1de11d){var _0x1ce63c=this;return new Promise(function(_0x20fe9f,_0x4cf6a0){return db[_0xcfb4('0x1a')][_0xcfb4('0x1b')](_0x1de11d['body'],{'raw':_0x1de11d[_0xcfb4('0x1c')]?_0x1de11d[_0xcfb4('0x1c')][_0xcfb4('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1de11d['options']?_0x1de11d['options'][_0xcfb4('0x1e')]||null:null,'attributes':_0x1de11d[_0xcfb4('0x1c')]?_0x1de11d[_0xcfb4('0x1c')][_0xcfb4('0x1f')]||null:null,'limit':_0x1de11d[_0xcfb4('0x1c')]?_0x1de11d['options'][_0xcfb4('0x20')]||null:null})['then'](function(_0x161633){logger[_0xcfb4('0x18')]('UpdateSmsInteraction',_0x1de11d);logger[_0xcfb4('0x21')](_0xcfb4('0x22'),_0x1de11d,JSON[_0xcfb4('0x14')](_0x161633));_0x20fe9f(_0x161633);})[_0xcfb4('0x19')](function(_0x491893){logger[_0xcfb4('0x15')](_0xcfb4('0x22'),_0x491893[_0xcfb4('0x17')],_0x1de11d);_0x4cf6a0(_0x1ce63c[_0xcfb4('0x15')](0x1f4,_0x491893[_0xcfb4('0x17')]));});});};exports[_0xcfb4('0x23')]=function(_0x1a96f0){return new Promise(function(_0x465151,_0x1307fa){return db[_0xcfb4('0x1a')][_0xcfb4('0x24')]({'where':_0x1a96f0[_0xcfb4('0x1c')]?_0x1a96f0['options'][_0xcfb4('0x1e')]||null:null})[_0xcfb4('0x10')](function(_0x379a8a){if(_0x379a8a){return _0x379a8a[_0xcfb4('0x25')](_0x1a96f0['body'][_0xcfb4('0x26')],_['omit'](_0x1a96f0[_0xcfb4('0x27')],[_0xcfb4('0x26'),'id'])||{});}})[_0xcfb4('0x28')](function(_0x36c825){logger['info'](_0xcfb4('0x29'),_0x1a96f0);logger[_0xcfb4('0x21')](_0xcfb4('0x29'),_0x1a96f0,JSON['stringify'](_0x36c825));_0x465151(_0x36c825);})['catch'](function(_0x35c77d){logger[_0xcfb4('0x15')](_0xcfb4('0x29'),_0x35c77d['message'],_0x1a96f0);_0x1307fa(_this['error'](0x1f4,_0x35c77d[_0xcfb4('0x17')]));});});}; \ No newline at end of file +var _0x89bc=['util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','catch','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags'];(function(_0x2053ea,_0x1ab2d4){var _0x2232c4=function(_0x4230df){while(--_0x4230df){_0x2053ea['push'](_0x2053ea['shift']());}};_0x2232c4(++_0x1ab2d4);}(_0x89bc,0x183));var _0xc89b=function(_0x3d9b04,_0x1e851a){_0x3d9b04=_0x3d9b04-0x0;var _0x557936=_0x89bc[_0x3d9b04];return _0x557936;};'use strict';var _=require('lodash');var util=require(_0xc89b('0x0'));var moment=require('moment');var BPromise=require(_0xc89b('0x1'));var rs=require(_0xc89b('0x2'));var fs=require('fs');var Redis=require(_0xc89b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc89b('0x4'));var logger=require('../../config/logger')(_0xc89b('0x5'));var config=require(_0xc89b('0x6'));var jayson=require(_0xc89b('0x7'));var client=jayson[_0xc89b('0x8')][_0xc89b('0x9')]({'port':0x232a});config['redis']=_[_0xc89b('0xa')](config[_0xc89b('0xb')],{'host':_0xc89b('0xc'),'port':0x18eb});var socket=require(_0xc89b('0xd'))(new Redis(config[_0xc89b('0xb')]));require(_0xc89b('0xe'))['register'](socket);function respondWithRpcPromise(_0x27c5c1,_0x47a67c,_0x30d359){return new BPromise(function(_0x2cffba,_0x4f81ab){return client[_0xc89b('0xf')](_0x27c5c1,_0x30d359)[_0xc89b('0x10')](function(_0xc3266f){logger[_0xc89b('0x11')](_0xc89b('0x12'),_0x47a67c,_0xc89b('0x13'));logger[_0xc89b('0x14')](_0xc89b('0x15'),_0x47a67c,'request\x20sent',JSON[_0xc89b('0x16')](_0xc3266f));if(_0xc3266f[_0xc89b('0x17')]){if(_0xc3266f[_0xc89b('0x17')]['code']===0x1f4){logger[_0xc89b('0x17')](_0xc89b('0x12'),_0x47a67c,_0xc3266f[_0xc89b('0x17')][_0xc89b('0x18')]);return _0x4f81ab(_0xc3266f[_0xc89b('0x17')][_0xc89b('0x18')]);}logger[_0xc89b('0x17')](_0xc89b('0x12'),_0x47a67c,_0xc3266f[_0xc89b('0x17')]['message']);return _0x2cffba(_0xc3266f[_0xc89b('0x17')][_0xc89b('0x18')]);}else{logger['info'](_0xc89b('0x12'),_0x47a67c,'request\x20sent');_0x2cffba(_0xc3266f[_0xc89b('0x19')][_0xc89b('0x18')]);}})['catch'](function(_0x55213c){logger[_0xc89b('0x17')](_0xc89b('0x12'),_0x47a67c,_0x55213c);_0x4f81ab(_0x55213c);});});}exports[_0xc89b('0x1a')]=function(_0x375d7c){var _0x5e0ae3=this;return new Promise(function(_0xabfe9b,_0x5e847b){return db[_0xc89b('0x1b')][_0xc89b('0x1c')](_0x375d7c[_0xc89b('0x1d')],{'raw':_0x375d7c[_0xc89b('0x1e')]?_0x375d7c[_0xc89b('0x1e')][_0xc89b('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x375d7c[_0xc89b('0x1e')]?_0x375d7c[_0xc89b('0x1e')][_0xc89b('0x20')]||null:null,'attributes':_0x375d7c[_0xc89b('0x1e')]?_0x375d7c[_0xc89b('0x1e')][_0xc89b('0x21')]||null:null,'limit':_0x375d7c['options']?_0x375d7c[_0xc89b('0x1e')][_0xc89b('0x22')]||null:null})['then'](function(_0x152665){logger[_0xc89b('0x11')](_0xc89b('0x1a'),_0x375d7c);logger[_0xc89b('0x14')](_0xc89b('0x1a'),_0x375d7c,JSON[_0xc89b('0x16')](_0x152665));_0xabfe9b(_0x152665);})[_0xc89b('0x23')](function(_0x3a7f8b){logger['error'](_0xc89b('0x1a'),_0x3a7f8b[_0xc89b('0x18')],_0x375d7c);_0x5e847b(_0x5e0ae3[_0xc89b('0x17')](0x1f4,_0x3a7f8b[_0xc89b('0x18')]));});});};exports[_0xc89b('0x24')]=function(_0x28d986){return new Promise(function(_0xb6c4cb,_0x3f8448){return db[_0xc89b('0x1b')][_0xc89b('0x25')]({'where':_0x28d986[_0xc89b('0x1e')]?_0x28d986['options'][_0xc89b('0x20')]||null:null})[_0xc89b('0x10')](function(_0xf01bcd){if(_0xf01bcd){return _0xf01bcd[_0xc89b('0x26')](_0x28d986[_0xc89b('0x1d')][_0xc89b('0x27')],_[_0xc89b('0x28')](_0x28d986[_0xc89b('0x1d')],[_0xc89b('0x27'),'id'])||{});}})[_0xc89b('0x29')](function(_0x58c351){logger[_0xc89b('0x11')](_0xc89b('0x2a'),_0x28d986);logger[_0xc89b('0x14')](_0xc89b('0x2a'),_0x28d986,JSON[_0xc89b('0x16')](_0x58c351));_0xb6c4cb(_0x58c351);})['catch'](function(_0x50a52d){logger['error'](_0xc89b('0x2a'),_0x50a52d[_0xc89b('0x18')],_0x28d986);_0x3f8448(_this[_0xc89b('0x17')](0x1f4,_0x50a52d[_0xc89b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 8affee4..8c46792 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 _0xbd09=['smsInteraction:','./smsInteraction.events','remove','emit','register','length'];(function(_0x2139fc,_0x5acac0){var _0x15ad19=function(_0x2a396e){while(--_0x2a396e){_0x2139fc['push'](_0x2139fc['shift']());}};_0x15ad19(++_0x5acac0);}(_0xbd09,0x10f));var _0x9bd0=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xbd09[_0x31e29a];return _0x32d892;};'use strict';var SmsInteractionEvents=require(_0x9bd0('0x0'));var events=['save',_0x9bd0('0x1'),'update'];function createListener(_0x3365ab,_0x3b9b20){return function(_0x39b7a8){_0x3b9b20[_0x9bd0('0x2')](_0x3365ab,_0x39b7a8);};}function removeListener(_0x58bf1b,_0x4aef4e){return function(){SmsInteractionEvents['removeListener'](_0x58bf1b,_0x4aef4e);};}exports[_0x9bd0('0x3')]=function(_0x5c14fa){for(var _0x4f6ac9=0x0,_0x128b1d=events[_0x9bd0('0x4')];_0x4f6ac9<_0x128b1d;_0x4f6ac9++){var _0x1259e3=events[_0x4f6ac9];var _0x3b3de6=createListener(_0x9bd0('0x5')+_0x1259e3,_0x5c14fa);SmsInteractionEvents['on'](_0x1259e3,_0x3b3de6);}}; \ No newline at end of file +var _0xd967=['save','remove','update','emit'];(function(_0x1bc553,_0x329d78){var _0x2f9699=function(_0x13ec03){while(--_0x13ec03){_0x1bc553['push'](_0x1bc553['shift']());}};_0x2f9699(++_0x329d78);}(_0xd967,0x94));var _0x7d96=function(_0x3889ae,_0x4770c3){_0x3889ae=_0x3889ae-0x0;var _0x6533dd=_0xd967[_0x3889ae];return _0x6533dd;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x7d96('0x0'),_0x7d96('0x1'),_0x7d96('0x2')];function createListener(_0xe9e256,_0x3d5eb5){return function(_0x3ee3b8){_0x3d5eb5[_0x7d96('0x3')](_0xe9e256,_0x3ee3b8);};}function removeListener(_0x530439,_0x32ba4d){return function(){SmsInteractionEvents['removeListener'](_0x530439,_0x32ba4d);};}exports['register']=function(_0x5280c9){for(var _0x35a926=0x0,_0x51bb2e=events['length'];_0x35a926<_0x51bb2e;_0x35a926++){var _0x5d0a7e=events[_0x35a926];var _0x18eb95=createListener('smsInteraction:'+_0x5d0a7e,_0x5280c9);SmsInteractionEvents['on'](_0x5d0a7e,_0x18eb95);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 6497a57..2079388 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 _0x9245=['reject','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','smsmessage:create','post','/:id/status','put','update','/:id/accept','accept','/:id/reject'];(function(_0x5e2cb4,_0x592c64){var _0x282902=function(_0x1c1836){while(--_0x1c1836){_0x5e2cb4['push'](_0x5e2cb4['shift']());}};_0x282902(++_0x592c64);}(_0x9245,0x99));var _0x5924=function(_0x36cb69,_0x14878f){_0x36cb69=_0x36cb69-0x0;var _0x84e43d=_0x9245[_0x36cb69];return _0x84e43d;};'use strict';var multer=require(_0x5924('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5924('0x1'));var express=require(_0x5924('0x2'));var router=express[_0x5924('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5924('0x4'));var interaction=require(_0x5924('0x5'));var config=require('../../config/environment');var controller=require(_0x5924('0x6'));router[_0x5924('0x7')]('/',auth[_0x5924('0x8')](),controller[_0x5924('0x9')]);router['get'](_0x5924('0xa'),auth['isAuthenticated'](),controller[_0x5924('0xb')]);router[_0x5924('0x7')](_0x5924('0xc'),auth[_0x5924('0x8')](),controller[_0x5924('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked']('sms',_0x5924('0xe')),controller['create']);router[_0x5924('0xf')](_0x5924('0x10'),controller['status']);router[_0x5924('0x11')](_0x5924('0xc'),auth[_0x5924('0x8')](),controller[_0x5924('0x12')]);router['put'](_0x5924('0x13'),auth['isAuthenticated'](),controller[_0x5924('0x14')]);router['put'](_0x5924('0x15'),auth[_0x5924('0x8')](),controller[_0x5924('0x16')]);router[_0x5924('0x17')](_0x5924('0xc'),auth['isAuthenticated'](),controller[_0x5924('0x18')]);module['exports']=router; \ No newline at end of file +var _0x180d=['/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','create','status','put','update','accept','/:id/reject','reject','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x180d,0xf9));var _0xd180=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x180d[_0x126558];return _0x1f6d14;};'use strict';var multer=require('multer');var util=require(_0xd180('0x0'));var path=require(_0xd180('0x1'));var timeout=require(_0xd180('0x2'));var express=require(_0xd180('0x3'));var router=express[_0xd180('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd180('0x5'));var interaction=require(_0xd180('0x6'));var config=require(_0xd180('0x7'));var controller=require(_0xd180('0x8'));router[_0xd180('0x9')]('/',auth[_0xd180('0xa')](),controller['index']);router['get'](_0xd180('0xb'),auth[_0xd180('0xa')](),controller[_0xd180('0xc')]);router[_0xd180('0x9')](_0xd180('0xd'),auth[_0xd180('0xa')](),controller[_0xd180('0xe')]);router[_0xd180('0xf')]('/',auth[_0xd180('0xa')](),interaction[_0xd180('0x10')](_0xd180('0x11'),_0xd180('0x12')),controller[_0xd180('0x13')]);router[_0xd180('0xf')]('/:id/status',controller[_0xd180('0x14')]);router[_0xd180('0x15')](_0xd180('0xd'),auth[_0xd180('0xa')](),controller[_0xd180('0x16')]);router['put']('/:id/accept',auth[_0xd180('0xa')](),controller[_0xd180('0x17')]);router[_0xd180('0x15')](_0xd180('0x18'),auth[_0xd180('0xa')](),controller[_0xd180('0x19')]);router['delete']('/:id',auth[_0xd180('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index e5771e2..f68e792 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 _0x2fa9=['exports','BOOLEAN','ENUM','out','STRING','TEXT','sequelize'];(function(_0x4fd288,_0x3ed14c){var _0x5b9b5b=function(_0x8bb98f){while(--_0x8bb98f){_0x4fd288['push'](_0x4fd288['shift']());}};_0x5b9b5b(++_0x3ed14c);}(_0x2fa9,0x1e9));var _0x92fa=function(_0x5e41d1,_0x626fa8){_0x5e41d1=_0x5e41d1-0x0;var _0x2ad97b=_0x2fa9[_0x5e41d1];return _0x2ad97b;};'use strict';var Sequelize=require(_0x92fa('0x0'));module[_0x92fa('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x92fa('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x92fa('0x3')]('in',_0x92fa('0x4')),'defaultValue':_0x92fa('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x92fa('0x5')](0xbe)},'phone':{'type':Sequelize[_0x92fa('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x92fa('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x92fa('0x6')]}}; \ No newline at end of file +var _0xc651=['STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x3e961c,_0x5747e7){var _0x474f9c=function(_0x33f8ea){while(--_0x33f8ea){_0x3e961c['push'](_0x3e961c['shift']());}};_0x474f9c(++_0x5747e7);}(_0xc651,0x16a));var _0x1c65=function(_0x50b410,_0x3741be){_0x50b410=_0x50b410-0x0;var _0x2d9eeb=_0xc651[_0x50b410];return _0x2d9eeb;};'use strict';var Sequelize=require(_0x1c65('0x0'));module[_0x1c65('0x1')]={'body':{'type':Sequelize[_0x1c65('0x2')](_0x1c65('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x1c65('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1c65('0x5')]('in',_0x1c65('0x6')),'defaultValue':_0x1c65('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1c65('0x7')](0xbe)},'phone':{'type':Sequelize[_0x1c65('0x7')]},'readAt':{'type':Sequelize[_0x1c65('0x8')]},'secret':{'type':Sequelize[_0x1c65('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1c65('0x7')]},'providerResponse':{'type':Sequelize[_0x1c65('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 4546c54..a7e1638 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 _0x6535=['../../mysqldb','redis','localhost','./smsMessage.socket','register','client','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','offset','undefined','limit','count','set','json','apply','reject','update','destroy','end','stack','name','index','SmsMessage','fieldName','type','key','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','keys','options','find','create','body','catch','params','describe','sms-interactions','accept','read','readAt','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','format','YYYY-MM-DD\x20HH:mm:ss','interaction','role','null','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','email','rejectmessage','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x2fc5e5,_0x30b410){var _0x48a119=function(_0xd7e872){while(--_0xd7e872){_0x2fc5e5['push'](_0x2fc5e5['shift']());}};_0x48a119(++_0x30b410);}(_0x6535,0x74));var _0x5653=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x6535[_0x8c43de];return _0xa6591b;};'use strict';var emlformat=require(_0x5653('0x0'));var rimraf=require(_0x5653('0x1'));var zipdir=require(_0x5653('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5653('0x3'));var BPromise=require(_0x5653('0x4'));var Mustache=require(_0x5653('0x5'));var util=require(_0x5653('0x6'));var path=require(_0x5653('0x7'));var sox=require(_0x5653('0x8'));var csv=require(_0x5653('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5653('0xa'));var _=require(_0x5653('0xb'));var squel=require(_0x5653('0xc'));var crypto=require(_0x5653('0xd'));var jsforce=require(_0x5653('0xe'));var deskjs=require(_0x5653('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5653('0x10'));var Papa=require('papaparse');var Redis=require(_0x5653('0x11'));var authService=require(_0x5653('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5653('0x13'));var hardwareService=require(_0x5653('0x14'));var logger=require(_0x5653('0x15'))(_0x5653('0x16'));var utils=require(_0x5653('0x17'));var config=require(_0x5653('0x18'));var licenseUtil=require(_0x5653('0x19'));var db=require(_0x5653('0x1a'))['db'];config[_0x5653('0x1b')]=_['defaults'](config['redis'],{'host':_0x5653('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5653('0x1b')]));require(_0x5653('0x1d'))[_0x5653('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5653('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x5653('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x110c0b,_0x32be3e,_0x1f27a2,_0xc371fd){return new BPromise(function(_0x483adb,_0x2efcfd){var _0x1d3080=_0xc371fd||client;return _0x1d3080['request'](_0x110c0b,_0x1f27a2)[_0x5653('0x20')](function(_0x3c4be9){logger[_0x5653('0x21')](_0x5653('0x22'),_0x32be3e,_0x5653('0x23'));logger[_0x5653('0x24')](_0x5653('0x25'),_0x32be3e,_0x5653('0x23'),JSON[_0x5653('0x26')](_0x3c4be9));if(_0x3c4be9[_0x5653('0x27')]){if(_0x3c4be9['error'][_0x5653('0x28')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x32be3e,_0x3c4be9['error']['message']);return _0x2efcfd(_0x3c4be9['error'][_0x5653('0x29')]);}logger[_0x5653('0x27')]('SmsMessage,\x20%s,\x20%s',_0x32be3e,_0x3c4be9[_0x5653('0x27')]['message']);return _0x483adb(_0x3c4be9[_0x5653('0x27')][_0x5653('0x29')]);}else{logger[_0x5653('0x21')](_0x5653('0x22'),_0x32be3e,_0x5653('0x23'));_0x483adb(_0x3c4be9[_0x5653('0x2a')][_0x5653('0x29')]);}})['catch'](function(_0x4b31bd){logger['error'](_0x5653('0x22'),_0x32be3e,_0x4b31bd);_0x2efcfd(_0x4b31bd);});});}function respondWithStatusCode(_0x3904ff,_0x48b9ae){_0x48b9ae=_0x48b9ae||0xcc;return function(_0x2ac1bd){if(_0x2ac1bd){return _0x3904ff['sendStatus'](_0x48b9ae);}return _0x3904ff[_0x5653('0x2b')](_0x48b9ae)['end']();};}function respondWithResult(_0x2d3e30,_0x41e4b9){_0x41e4b9=_0x41e4b9||0xc8;return function(_0xb8576e){if(_0xb8576e){return _0x2d3e30[_0x5653('0x2b')](_0x41e4b9)['json'](_0xb8576e);}};}function respondWithFilteredResult(_0x1d170d,_0x213ccc){return function(_0xe2ba6c){if(_0xe2ba6c){var _0x41c58f=typeof _0x213ccc[_0x5653('0x2c')]===_0x5653('0x2d')&&typeof _0x213ccc[_0x5653('0x2e')]===_0x5653('0x2d');var _0x3d08b0=_0xe2ba6c[_0x5653('0x2f')];var _0x2883af=_0x41c58f?0x0:_0x213ccc[_0x5653('0x2c')];var _0x15d497=_0x41c58f?_0xe2ba6c[_0x5653('0x2f')]:_0x213ccc['offset']+_0x213ccc[_0x5653('0x2e')];var _0x18dbfc;if(_0x15d497>=_0x3d08b0){_0x15d497=_0x3d08b0;_0x18dbfc=0xc8;}else{_0x18dbfc=0xce;}_0x1d170d['status'](_0x18dbfc);return _0x1d170d[_0x5653('0x30')]('Content-Range',_0x2883af+'-'+_0x15d497+'/'+_0x3d08b0)[_0x5653('0x31')](_0xe2ba6c);}return null;};}function patchUpdates(_0x54ff03){return function(_0x33c05a){try{jsonpatch[_0x5653('0x32')](_0x33c05a,_0x54ff03,!![]);}catch(_0x3e7cfc){return BPromise[_0x5653('0x33')](_0x3e7cfc);}return _0x33c05a['save']();};}function saveUpdates(_0x45ac40,_0x1e5d43){return function(_0x4fd89e){if(_0x4fd89e){return _0x4fd89e[_0x5653('0x34')](_0x45ac40)[_0x5653('0x20')](function(_0x45b9ad){return _0x45b9ad;});}return null;};}function removeEntity(_0x3f0e55,_0x5d3fe6){return function(_0x403c70){if(_0x403c70){return _0x403c70[_0x5653('0x35')]()['then'](function(){_0x3f0e55[_0x5653('0x2b')](0xcc)[_0x5653('0x36')]();});}};}function handleEntityNotFound(_0x577dd8,_0x19a055){return function(_0x2dc7b8){if(!_0x2dc7b8){_0x577dd8['sendStatus'](0x194);}return _0x2dc7b8;};}function handleError(_0x45034f,_0x54d1aa){_0x54d1aa=_0x54d1aa||0x1f4;return function(_0x12c04c){logger[_0x5653('0x27')](_0x12c04c[_0x5653('0x37')]);if(_0x12c04c['name']){delete _0x12c04c[_0x5653('0x38')];}_0x45034f[_0x5653('0x2b')](_0x54d1aa)['send'](_0x12c04c);};}exports[_0x5653('0x39')]=function(_0x836636,_0x35b228){var _0x2db15c={},_0x18b872={},_0x172136={'count':0x0,'rows':[]};var _0x3dd53c=_['map'](db[_0x5653('0x3a')]['rawAttributes'],function(_0x514f20){return{'name':_0x514f20[_0x5653('0x3b')],'type':_0x514f20[_0x5653('0x3c')][_0x5653('0x3d')]};});_0x18b872[_0x5653('0x3e')]=_[_0x5653('0x3f')](_0x3dd53c,'name');_0x18b872['query']=_['keys'](_0x836636[_0x5653('0x40')]);_0x18b872['filters']=_[_0x5653('0x41')](_0x18b872['model'],_0x18b872[_0x5653('0x40')]);_0x2db15c[_0x5653('0x42')]=_[_0x5653('0x41')](_0x18b872[_0x5653('0x3e')],qs[_0x5653('0x43')](_0x836636[_0x5653('0x40')][_0x5653('0x43')]));_0x2db15c['attributes']=_0x2db15c[_0x5653('0x42')]['length']?_0x2db15c['attributes']:_0x18b872['model'];if(!_0x836636[_0x5653('0x40')][_0x5653('0x44')](_0x5653('0x45'))){_0x2db15c[_0x5653('0x2e')]=qs[_0x5653('0x2e')](_0x836636[_0x5653('0x40')][_0x5653('0x2e')]);_0x2db15c['offset']=qs[_0x5653('0x2c')](_0x836636[_0x5653('0x40')][_0x5653('0x2c')]);}_0x2db15c[_0x5653('0x46')]=qs[_0x5653('0x47')](_0x836636[_0x5653('0x40')]['sort']);_0x2db15c[_0x5653('0x48')]=qs[_0x5653('0x49')](_['pick'](_0x836636[_0x5653('0x40')],_0x18b872[_0x5653('0x49')]),_0x3dd53c);if(_0x836636[_0x5653('0x40')][_0x5653('0x4a')]){_0x2db15c['where']=_['merge'](_0x2db15c[_0x5653('0x48')],{'$or':_[_0x5653('0x3f')](_0x3dd53c,function(_0x443824){if(_0x443824[_0x5653('0x3c')]!==_0x5653('0x4b')){var _0x572a26={};_0x572a26[_0x443824['name']]={'$like':'%'+_0x836636['query'][_0x5653('0x4a')]+'%'};return _0x572a26;}})});}_0x2db15c=_[_0x5653('0x4c')]({},_0x2db15c,_0x836636['options']);var _0x55e555={'where':_0x2db15c[_0x5653('0x48')]};return db[_0x5653('0x3a')][_0x5653('0x2f')](_0x55e555)['then'](function(_0x453932){_0x172136['count']=_0x453932;if(_0x836636[_0x5653('0x40')][_0x5653('0x4d')]){_0x2db15c[_0x5653('0x4e')]=[{'all':!![]}];}return db[_0x5653('0x3a')][_0x5653('0x4f')](_0x2db15c);})[_0x5653('0x20')](function(_0x15b8d0){_0x172136[_0x5653('0x50')]=_0x15b8d0;return _0x172136;})[_0x5653('0x20')](respondWithFilteredResult(_0x35b228,_0x2db15c))['catch'](handleError(_0x35b228,null));};exports[_0x5653('0x51')]=function(_0x2b324c,_0x251903){var _0x397da0={'raw':!![],'where':{'id':_0x2b324c['params']['id']}},_0x2f2436={};_0x2f2436[_0x5653('0x3e')]=_[_0x5653('0x52')](db[_0x5653('0x3a')]['rawAttributes']);_0x2f2436['query']=_['keys'](_0x2b324c[_0x5653('0x40')]);_0x2f2436[_0x5653('0x49')]=_[_0x5653('0x41')](_0x2f2436[_0x5653('0x3e')],_0x2f2436['query']);_0x397da0[_0x5653('0x42')]=_[_0x5653('0x41')](_0x2f2436[_0x5653('0x3e')],qs['fields'](_0x2b324c['query'][_0x5653('0x43')]));_0x397da0[_0x5653('0x42')]=_0x397da0[_0x5653('0x42')]['length']?_0x397da0[_0x5653('0x42')]:_0x2f2436[_0x5653('0x3e')];if(_0x2b324c[_0x5653('0x40')][_0x5653('0x4d')]){_0x397da0[_0x5653('0x4e')]=[{'all':!![]}];}_0x397da0=_[_0x5653('0x4c')]({},_0x397da0,_0x2b324c[_0x5653('0x53')]);return db[_0x5653('0x3a')][_0x5653('0x54')](_0x397da0)['then'](handleEntityNotFound(_0x251903,null))[_0x5653('0x20')](respondWithResult(_0x251903,null))['catch'](handleError(_0x251903,null));};exports[_0x5653('0x55')]=function(_0x1044f4,_0x9537bb){return db['SmsMessage'][_0x5653('0x55')](_0x1044f4[_0x5653('0x56')],{})['then'](respondWithResult(_0x9537bb,0xc9))[_0x5653('0x57')](handleError(_0x9537bb,null));};exports['update']=function(_0x501d6f,_0x35cbec){if(_0x501d6f[_0x5653('0x56')]['id']){delete _0x501d6f[_0x5653('0x56')]['id'];}return db[_0x5653('0x3a')]['find']({'where':{'id':_0x501d6f[_0x5653('0x58')]['id']}})[_0x5653('0x20')](handleEntityNotFound(_0x35cbec,null))[_0x5653('0x20')](saveUpdates(_0x501d6f['body'],null))['then'](respondWithResult(_0x35cbec,null))[_0x5653('0x57')](handleError(_0x35cbec,null));};exports[_0x5653('0x35')]=function(_0x4246c7,_0x670832){return db[_0x5653('0x3a')][_0x5653('0x54')]({'where':{'id':_0x4246c7[_0x5653('0x58')]['id']}})[_0x5653('0x20')](handleEntityNotFound(_0x670832,null))[_0x5653('0x20')](removeEntity(_0x670832,null))['catch'](handleError(_0x670832,null));};exports[_0x5653('0x59')]=function(_0x3ef404,_0x56c6ba){return db[_0x5653('0x3a')][_0x5653('0x59')]()[_0x5653('0x20')](respondWithResult(_0x56c6ba,null))[_0x5653('0x57')](handleError(_0x56c6ba,null));};var interaction_log=require(_0x5653('0x15'))(_0x5653('0x5a'));exports[_0x5653('0x5b')]=function(_0x28a8bb,_0x22f01a,_0x79e83b){var _0x406c01={'agent':{},'channel':'sms'};if(_0x28a8bb[_0x5653('0x56')]['id']){delete _0x28a8bb['body']['id'];}_0x28a8bb[_0x5653('0x56')][_0x5653('0x5c')]=!![];_0x28a8bb['body'][_0x5653('0x5d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x28a8bb['body'][_0x5653('0x5e')]=_0x28a8bb['body'][_0x5653('0x5e')]||_0x28a8bb[_0x5653('0x5f')]['id'];_0x406c01[_0x5653('0x60')]['id']=_0x28a8bb['body'][_0x5653('0x5e')];return db['SmsMessage'][_0x5653('0x54')]({'where':{'id':_0x28a8bb['params']['id'],'UserId':null}})[_0x5653('0x20')](handleEntityNotFound(_0x22f01a,null))[_0x5653('0x20')](saveUpdates(_0x28a8bb[_0x5653('0x56')],null))[_0x5653('0x20')](function(_0x61fbc9){if(_0x61fbc9){_0x406c01[_0x5653('0x29')]=_0x61fbc9[_0x5653('0x61')]({'plain':!![]});return db[_0x5653('0x62')][_0x5653('0x54')]({'where':{'id':_0x61fbc9[_0x5653('0x63')]}});}return null;})[_0x5653('0x20')](handleEntityNotFound(_0x22f01a,null))[_0x5653('0x20')](function(_0x195fb0){if(_0x195fb0){return _0x195fb0[_0x5653('0x34')]({'UserId':_0x28a8bb['body'][_0x5653('0x5e')],'read1stAt':_[_0x5653('0x64')](_0x195fb0['read1stAt'])?moment()[_0x5653('0x65')](_0x5653('0x66')):undefined});}return null;})[_0x5653('0x20')](function(_0x1d7086){if(_0x1d7086){_0x406c01[_0x5653('0x67')]=_0x1d7086[_0x5653('0x61')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x28a8bb['user']['id'],_0x28a8bb[_0x5653('0x5f')][_0x5653('0x38')],_0x28a8bb[_0x5653('0x5f')][_0x5653('0x68')],_0x406c01['interaction']['id'],_0x28a8bb[_0x5653('0x56')]?JSON[_0x5653('0x26')](_0x28a8bb[_0x5653('0x56')]):_0x5653('0x69'));return respondWithRpcPromise(_0x5653('0x6a'),_0x5653('0x6b'),_0x406c01);}return null;})[_0x5653('0x20')](function(_0x518b75){var _0x39ab6d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x518b75[_0x5653('0x29')][_0x5653('0x6c')];return db['sequelize'][_0x5653('0x40')](_0x39ab6d,{'type':db[_0x5653('0x6d')][_0x5653('0x6e')][_0x5653('0x6f')],'raw':!![]})[_0x5653('0x20')](function(_0x4ccc54){return _0x4ccc54;});})['then'](function(_0x36fde2){if(_0x36fde2){_0x406c01[_0x5653('0x29')][_0x5653('0x70')]=_0x36fde2[0x0];if(!_0x28a8bb[_0x5653('0x56')]['UserId'])return;return db['User'][_0x5653('0x54')]({'where':{'id':_0x28a8bb[_0x5653('0x56')][_0x5653('0x5e')],'role':_0x5653('0x60')},'attributes':['id',_0x5653('0x38'),_0x5653('0x71'),'email',_0x5653('0x72')],'raw':!![]});}return null;})[_0x5653('0x20')](function(_0x382614){if(!_0x382614)return null;_0x406c01[_0x5653('0x29')][_0x5653('0x60')]=_0x382614;return _0x406c01;})['then'](function(_0x360d23){if(_0x360d23){if(_0x28a8bb[_0x5653('0x56')][_0x5653('0x73')]){_0x406c01[_0x5653('0x29')][_0x5653('0x74')]=util['format'](_0x5653('0x75'),_0x28a8bb[_0x5653('0x5f')][_0x5653('0x38')]);_0x406c01[_0x5653('0x29')][_0x5653('0x76')]=_0x406c01[_0x5653('0x76')];_0x406c01[_0x5653('0x29')][_0x5653('0x77')]=_0x5653('0x5b');return respondWithRpcPromise(_0x5653('0x78'),'EventManager',{'event':_0x5653('0x79'),'message':_0x406c01[_0x5653('0x29')]},client9002)[_0x5653('0x20')](function(){return _0x406c01;});}return _0x406c01;}return null;})[_0x5653('0x20')](respondWithResult(_0x22f01a,null))['catch'](handleError(_0x22f01a,null));};var interaction_log=require('../../config/logger')(_0x5653('0x5a'));exports[_0x5653('0x33')]=function(_0x581367,_0x471532,_0x2a674a){var _0x5225e0={'agent':{},'channel':'sms'};if(_0x581367['body']['id']){delete _0x581367['body']['id'];}_0x581367['body'][_0x5653('0x5e')]=_0x581367[_0x5653('0x56')][_0x5653('0x5e')]||_0x581367[_0x5653('0x5f')]['id'];_0x5225e0['agent']['id']=_0x581367['body'][_0x5653('0x5e')];return db[_0x5653('0x3a')]['find']({'where':{'id':_0x581367[_0x5653('0x58')]['id'],'UserId':null}})[_0x5653('0x20')](handleEntityNotFound(_0x471532,null))[_0x5653('0x20')](function(_0x4567c7){if(_0x4567c7){_0x5225e0[_0x5653('0x29')]=_0x4567c7[_0x5653('0x61')]({'plain':!![]});return db[_0x5653('0x62')][_0x5653('0x54')]({'where':{'id':_0x4567c7[_0x5653('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x471532,null))['then'](function(_0x4cf4f0){if(_0x4cf4f0){_0x5225e0[_0x5653('0x67')]=_0x4cf4f0[_0x5653('0x61')]({'plain':!![]});interaction_log[_0x5653('0x21')](_0x5653('0x7a'),_0x581367[_0x5653('0x5f')]['id'],_0x581367[_0x5653('0x5f')][_0x5653('0x38')],_0x581367[_0x5653('0x5f')][_0x5653('0x68')],_0x5225e0['interaction']['id'],_0x581367[_0x5653('0x56')]?JSON['stringify'](_0x581367[_0x5653('0x56')]):_0x5653('0x69'));return respondWithRpcPromise(_0x5653('0x7b'),_0x5653('0x7c'),_0x5225e0);}return null;})[_0x5653('0x20')](function(_0x364353){var _0xd5faff=_0x5653('0x7d')+_0x364353[_0x5653('0x29')][_0x5653('0x6c')];return db['sequelize']['query'](_0xd5faff,{'type':db[_0x5653('0x6d')][_0x5653('0x6e')][_0x5653('0x6f')],'raw':!![]})[_0x5653('0x20')](function(_0x524c4b){return _0x524c4b;});})[_0x5653('0x20')](function(_0x305cf7){if(_0x305cf7){_0x5225e0[_0x5653('0x29')][_0x5653('0x70')]=_0x305cf7[0x0];if(!_0x581367[_0x5653('0x56')][_0x5653('0x5e')])return;return db['User'][_0x5653('0x54')]({'where':{'id':_0x581367[_0x5653('0x56')][_0x5653('0x5e')],'role':_0x5653('0x60')},'attributes':['id','name','fullname',_0x5653('0x7e'),_0x5653('0x72')],'raw':!![]});}return null;})[_0x5653('0x20')](function(_0x34101f){if(!_0x34101f)return null;_0x5225e0[_0x5653('0x29')][_0x5653('0x60')]=_0x34101f;return _0x5225e0;})[_0x5653('0x20')](function(_0x17baa0){if(_0x17baa0){_0x17baa0[_0x5653('0x29')]['interface']=util['format'](_0x5653('0x75'),_0x581367['user'][_0x5653('0x38')]);_0x17baa0['message']['channel']=_0x5225e0['channel'];_0x17baa0[_0x5653('0x29')][_0x5653('0x77')]='reject';respondWithRpcPromise(_0x5653('0x78'),'EventManager',{'event':_0x5653('0x7f'),'message':_0x17baa0[_0x5653('0x29')]},client9002);return _0x5225e0;}return null;})[_0x5653('0x20')](respondWithResult(_0x471532,null))[_0x5653('0x57')](handleError(_0x471532,null));};exports[_0x5653('0x2b')]=function(_0x2e0318,_0x4e193a,_0x337a68){if(_0x2e0318[_0x5653('0x56')]['id']){delete _0x2e0318['body']['id'];}var _0x267482;return db[_0x5653('0x3a')][_0x5653('0x54')]({'where':{'id':_0x2e0318['params']['id']}})[_0x5653('0x20')](handleEntityNotFound(_0x4e193a,null))[_0x5653('0x20')](function(_0x1b1408){if(_0x1b1408){_0x267482=_0x1b1408;return db['SmsAccount'][_0x5653('0x54')]({'where':{'id':_0x1b1408['SmsAccountId']}});}})[_0x5653('0x20')](handleEntityNotFound(_0x4e193a,null))[_0x5653('0x20')](function(_0x5b12d7){if(_0x5b12d7){logger[_0x5653('0x24')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5653('0x2b'),'received\x20delivery\x20report\x20from',_0x5b12d7[_0x5653('0x3c')],util[_0x5653('0x80')](_0x2e0318['body'],{'showHidden':![],'depth':null}));switch(_0x5b12d7[_0x5653('0x3c')]){case _0x5653('0x81'):if(_0x2e0318[_0x5653('0x56')][_0x5653('0x82')]&&_0x2e0318[_0x5653('0x56')]['MessageSid']===_0x267482[_0x5653('0x83')]){return _0x267482[_0x5653('0x34')]({'read':!![]});}else{logger[_0x5653('0x27')](_0x5653('0x84'),_0x5653('0x2b'),_0x5653('0x81'),util['inspect'](_0x2e0318[_0x5653('0x56')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x2e0318[_0x5653('0x56')]['MessageUUID']&&_0x2e0318[_0x5653('0x56')][_0x5653('0x85')]===_0x267482[_0x5653('0x83')]&&_[_0x5653('0x86')]([_0x5653('0x87'),_0x5653('0x88')],_0x2e0318[_0x5653('0x56')][_0x5653('0x89')])>=0x0){return _0x267482[_0x5653('0x34')]({'read':!![]});}else{logger[_0x5653('0x27')](_0x5653('0x84'),_0x5653('0x2b'),_0x5653('0x8a'),util[_0x5653('0x80')](_0x2e0318['body'],{'showHidden':![],'depth':null}));}break;case _0x5653('0x8b'):var _0x55e9d0=_0x2e0318['body'][_0x5653('0x8c')][0x0];if(_0x55e9d0[_0x5653('0x2b')][_0x5653('0x8d')]==='DELIVERED'){return _0x267482[_0x5653('0x34')]({'read':!![]});}else{logger[_0x5653('0x27')](_0x5653('0x84'),_0x5653('0x2b'),'infobip',util[_0x5653('0x80')](_0x2e0318[_0x5653('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x267482;}})[_0x5653('0x20')](respondWithResult(_0x4e193a,null))[_0x5653('0x57')](handleError(_0x4e193a,null));}; \ No newline at end of file +var _0xfe99=['filter','SmsMessage','includeAll','include','findAll','rows','catch','show','params','keys','merge','options','find','body','describe','accept','sms','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','read1stAt','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','fullname','internal','manual','interface','SIP/%s','channel','event','EventManager','sms-interactions','SmsInteractionId','null','RejectMessage','rejectMessage','SELECT','email','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageUUID','indexOf','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','client','http','request','info','debug','request\x20sent','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xfe99,0xda));var _0x9fe9=function(_0x54b2ef,_0x98e281){_0x54b2ef=_0x54b2ef-0x0;var _0x45afe7=_0xfe99[_0x54b2ef];return _0x45afe7;};'use strict';var emlformat=require(_0x9fe9('0x0'));var rimraf=require(_0x9fe9('0x1'));var zipdir=require(_0x9fe9('0x2'));var jsonpatch=require(_0x9fe9('0x3'));var rp=require('request-promise');var moment=require(_0x9fe9('0x4'));var BPromise=require(_0x9fe9('0x5'));var Mustache=require(_0x9fe9('0x6'));var util=require('util');var path=require(_0x9fe9('0x7'));var sox=require(_0x9fe9('0x8'));var csv=require('to-csv');var ejs=require(_0x9fe9('0x9'));var fs=require('fs');var fs_extra=require(_0x9fe9('0xa'));var _=require(_0x9fe9('0xb'));var squel=require(_0x9fe9('0xc'));var crypto=require('crypto');var jsforce=require(_0x9fe9('0xd'));var deskjs=require(_0x9fe9('0xe'));var toCsv=require(_0x9fe9('0xf'));var querystring=require('querystring');var Papa=require(_0x9fe9('0x10'));var Redis=require(_0x9fe9('0x11'));var authService=require(_0x9fe9('0x12'));var qs=require(_0x9fe9('0x13'));var as=require(_0x9fe9('0x14'));var hardwareService=require(_0x9fe9('0x15'));var logger=require(_0x9fe9('0x16'))(_0x9fe9('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9fe9('0x18'));var db=require('../../mysqldb')['db'];config[_0x9fe9('0x19')]=_[_0x9fe9('0x1a')](config[_0x9fe9('0x19')],{'host':_0x9fe9('0x1b'),'port':0x18eb});var socket=require(_0x9fe9('0x1c'))(new Redis(config[_0x9fe9('0x19')]));require(_0x9fe9('0x1d'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x9fe9('0x1e')][_0x9fe9('0x1f')]({'port':0x232c});var client9002=jayson[_0x9fe9('0x1e')][_0x9fe9('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5180d9,_0x302110,_0x3f6490,_0x44e2f9){return new BPromise(function(_0x2c2d2c,_0x5dd5a8){var _0x24c500=_0x44e2f9||client;return _0x24c500[_0x9fe9('0x20')](_0x5180d9,_0x3f6490)['then'](function(_0xd03ada){logger[_0x9fe9('0x21')]('SmsMessage,\x20%s,\x20%s',_0x302110,'request\x20sent');logger[_0x9fe9('0x22')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x302110,_0x9fe9('0x23'),JSON[_0x9fe9('0x24')](_0xd03ada));if(_0xd03ada['error']){if(_0xd03ada[_0x9fe9('0x25')][_0x9fe9('0x26')]===0x1f4){logger[_0x9fe9('0x25')](_0x9fe9('0x27'),_0x302110,_0xd03ada[_0x9fe9('0x25')][_0x9fe9('0x28')]);return _0x5dd5a8(_0xd03ada[_0x9fe9('0x25')][_0x9fe9('0x28')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x302110,_0xd03ada[_0x9fe9('0x25')][_0x9fe9('0x28')]);return _0x2c2d2c(_0xd03ada[_0x9fe9('0x25')][_0x9fe9('0x28')]);}else{logger[_0x9fe9('0x21')](_0x9fe9('0x27'),_0x302110,'request\x20sent');_0x2c2d2c(_0xd03ada[_0x9fe9('0x29')][_0x9fe9('0x28')]);}})['catch'](function(_0x4f0e07){logger[_0x9fe9('0x25')]('SmsMessage,\x20%s,\x20%s',_0x302110,_0x4f0e07);_0x5dd5a8(_0x4f0e07);});});}function respondWithStatusCode(_0x46dc21,_0x3cc528){_0x3cc528=_0x3cc528||0xcc;return function(_0x34ded6){if(_0x34ded6){return _0x46dc21['sendStatus'](_0x3cc528);}return _0x46dc21[_0x9fe9('0x2a')](_0x3cc528)[_0x9fe9('0x2b')]();};}function respondWithResult(_0x2dc9a9,_0x494e87){_0x494e87=_0x494e87||0xc8;return function(_0x208856){if(_0x208856){return _0x2dc9a9[_0x9fe9('0x2a')](_0x494e87)[_0x9fe9('0x2c')](_0x208856);}};}function respondWithFilteredResult(_0x55f059,_0x229e5a){return function(_0xfa6bad){if(_0xfa6bad){var _0x3be098=typeof _0x229e5a[_0x9fe9('0x2d')]===_0x9fe9('0x2e')&&typeof _0x229e5a[_0x9fe9('0x2f')]===_0x9fe9('0x2e');var _0x5af2d8=_0xfa6bad[_0x9fe9('0x30')];var _0x53494d=_0x3be098?0x0:_0x229e5a[_0x9fe9('0x2d')];var _0x94b2c9=_0x3be098?_0xfa6bad[_0x9fe9('0x30')]:_0x229e5a['offset']+_0x229e5a[_0x9fe9('0x2f')];var _0x23ea68;if(_0x94b2c9>=_0x5af2d8){_0x94b2c9=_0x5af2d8;_0x23ea68=0xc8;}else{_0x23ea68=0xce;}_0x55f059[_0x9fe9('0x2a')](_0x23ea68);return _0x55f059[_0x9fe9('0x31')]('Content-Range',_0x53494d+'-'+_0x94b2c9+'/'+_0x5af2d8)[_0x9fe9('0x2c')](_0xfa6bad);}return null;};}function patchUpdates(_0x16451e){return function(_0x3181db){try{jsonpatch[_0x9fe9('0x32')](_0x3181db,_0x16451e,!![]);}catch(_0x42a2ad){return BPromise[_0x9fe9('0x33')](_0x42a2ad);}return _0x3181db[_0x9fe9('0x34')]();};}function saveUpdates(_0x29afb2,_0x1edfae){return function(_0x5844f9){if(_0x5844f9){return _0x5844f9[_0x9fe9('0x35')](_0x29afb2)[_0x9fe9('0x36')](function(_0x425556){return _0x425556;});}return null;};}function removeEntity(_0x5a09ff,_0x28e629){return function(_0x1f8215){if(_0x1f8215){return _0x1f8215[_0x9fe9('0x37')]()[_0x9fe9('0x36')](function(){_0x5a09ff[_0x9fe9('0x2a')](0xcc)[_0x9fe9('0x2b')]();});}};}function handleEntityNotFound(_0x4d0e88,_0x5499e3){return function(_0x484a9e){if(!_0x484a9e){_0x4d0e88[_0x9fe9('0x38')](0x194);}return _0x484a9e;};}function handleError(_0x4bfa2e,_0x4c56e2){_0x4c56e2=_0x4c56e2||0x1f4;return function(_0x207ff0){logger[_0x9fe9('0x25')](_0x207ff0[_0x9fe9('0x39')]);if(_0x207ff0['name']){delete _0x207ff0[_0x9fe9('0x3a')];}_0x4bfa2e[_0x9fe9('0x2a')](_0x4c56e2)[_0x9fe9('0x3b')](_0x207ff0);};}exports[_0x9fe9('0x3c')]=function(_0x28df96,_0x37d15f){var _0x49c0d9={},_0x575cdc={},_0x52247a={'count':0x0,'rows':[]};var _0x559b1d=_[_0x9fe9('0x3d')](db['SmsMessage'][_0x9fe9('0x3e')],function(_0x17aaa4){return{'name':_0x17aaa4[_0x9fe9('0x3f')],'type':_0x17aaa4[_0x9fe9('0x40')][_0x9fe9('0x41')]};});_0x575cdc['model']=_['map'](_0x559b1d,_0x9fe9('0x3a'));_0x575cdc[_0x9fe9('0x42')]=_['keys'](_0x28df96[_0x9fe9('0x42')]);_0x575cdc[_0x9fe9('0x43')]=_['intersection'](_0x575cdc[_0x9fe9('0x44')],_0x575cdc['query']);_0x49c0d9['attributes']=_[_0x9fe9('0x45')](_0x575cdc['model'],qs[_0x9fe9('0x46')](_0x28df96[_0x9fe9('0x42')][_0x9fe9('0x46')]));_0x49c0d9['attributes']=_0x49c0d9[_0x9fe9('0x47')][_0x9fe9('0x48')]?_0x49c0d9['attributes']:_0x575cdc[_0x9fe9('0x44')];if(!_0x28df96['query'][_0x9fe9('0x49')](_0x9fe9('0x4a'))){_0x49c0d9[_0x9fe9('0x2f')]=qs[_0x9fe9('0x2f')](_0x28df96[_0x9fe9('0x42')][_0x9fe9('0x2f')]);_0x49c0d9['offset']=qs[_0x9fe9('0x2d')](_0x28df96['query'][_0x9fe9('0x2d')]);}_0x49c0d9['order']=qs['sort'](_0x28df96['query'][_0x9fe9('0x4b')]);_0x49c0d9[_0x9fe9('0x4c')]=qs[_0x9fe9('0x43')](_[_0x9fe9('0x4d')](_0x28df96[_0x9fe9('0x42')],_0x575cdc[_0x9fe9('0x43')]),_0x559b1d);if(_0x28df96[_0x9fe9('0x42')][_0x9fe9('0x4e')]){_0x49c0d9['where']=_['merge'](_0x49c0d9[_0x9fe9('0x4c')],{'$or':_['map'](_0x559b1d,function(_0x2f0819){if(_0x2f0819['type']!=='VIRTUAL'){var _0x59e025={};_0x59e025[_0x2f0819[_0x9fe9('0x3a')]]={'$like':'%'+_0x28df96[_0x9fe9('0x42')][_0x9fe9('0x4e')]+'%'};return _0x59e025;}})});}_0x49c0d9=_['merge']({},_0x49c0d9,_0x28df96['options']);var _0x281c7f={'where':_0x49c0d9[_0x9fe9('0x4c')]};return db[_0x9fe9('0x4f')]['count'](_0x281c7f)[_0x9fe9('0x36')](function(_0x3b4658){_0x52247a['count']=_0x3b4658;if(_0x28df96['query'][_0x9fe9('0x50')]){_0x49c0d9[_0x9fe9('0x51')]=[{'all':!![]}];}return db[_0x9fe9('0x4f')][_0x9fe9('0x52')](_0x49c0d9);})[_0x9fe9('0x36')](function(_0x431ba5){_0x52247a[_0x9fe9('0x53')]=_0x431ba5;return _0x52247a;})['then'](respondWithFilteredResult(_0x37d15f,_0x49c0d9))[_0x9fe9('0x54')](handleError(_0x37d15f,null));};exports[_0x9fe9('0x55')]=function(_0x51052e,_0x578331){var _0x1906b6={'raw':!![],'where':{'id':_0x51052e[_0x9fe9('0x56')]['id']}},_0x418ec0={};_0x418ec0[_0x9fe9('0x44')]=_[_0x9fe9('0x57')](db[_0x9fe9('0x4f')]['rawAttributes']);_0x418ec0[_0x9fe9('0x42')]=_['keys'](_0x51052e[_0x9fe9('0x42')]);_0x418ec0[_0x9fe9('0x43')]=_[_0x9fe9('0x45')](_0x418ec0[_0x9fe9('0x44')],_0x418ec0[_0x9fe9('0x42')]);_0x1906b6[_0x9fe9('0x47')]=_[_0x9fe9('0x45')](_0x418ec0[_0x9fe9('0x44')],qs[_0x9fe9('0x46')](_0x51052e['query'][_0x9fe9('0x46')]));_0x1906b6[_0x9fe9('0x47')]=_0x1906b6[_0x9fe9('0x47')][_0x9fe9('0x48')]?_0x1906b6[_0x9fe9('0x47')]:_0x418ec0['model'];if(_0x51052e['query'][_0x9fe9('0x50')]){_0x1906b6[_0x9fe9('0x51')]=[{'all':!![]}];}_0x1906b6=_[_0x9fe9('0x58')]({},_0x1906b6,_0x51052e[_0x9fe9('0x59')]);return db[_0x9fe9('0x4f')][_0x9fe9('0x5a')](_0x1906b6)[_0x9fe9('0x36')](handleEntityNotFound(_0x578331,null))[_0x9fe9('0x36')](respondWithResult(_0x578331,null))[_0x9fe9('0x54')](handleError(_0x578331,null));};exports['create']=function(_0x339641,_0x3c567d){return db[_0x9fe9('0x4f')]['create'](_0x339641['body'],{})[_0x9fe9('0x36')](respondWithResult(_0x3c567d,0xc9))['catch'](handleError(_0x3c567d,null));};exports[_0x9fe9('0x35')]=function(_0x52f03c,_0x1b3d18){if(_0x52f03c[_0x9fe9('0x5b')]['id']){delete _0x52f03c[_0x9fe9('0x5b')]['id'];}return db[_0x9fe9('0x4f')][_0x9fe9('0x5a')]({'where':{'id':_0x52f03c[_0x9fe9('0x56')]['id']}})[_0x9fe9('0x36')](handleEntityNotFound(_0x1b3d18,null))[_0x9fe9('0x36')](saveUpdates(_0x52f03c[_0x9fe9('0x5b')],null))['then'](respondWithResult(_0x1b3d18,null))['catch'](handleError(_0x1b3d18,null));};exports['destroy']=function(_0x148cf0,_0x29090a){return db['SmsMessage'][_0x9fe9('0x5a')]({'where':{'id':_0x148cf0['params']['id']}})['then'](handleEntityNotFound(_0x29090a,null))[_0x9fe9('0x36')](removeEntity(_0x29090a,null))['catch'](handleError(_0x29090a,null));};exports[_0x9fe9('0x5c')]=function(_0x1d00db,_0xbea391){return db['SmsMessage'][_0x9fe9('0x5c')]()[_0x9fe9('0x36')](respondWithResult(_0xbea391,null))[_0x9fe9('0x54')](handleError(_0xbea391,null));};var interaction_log=require(_0x9fe9('0x16'))('sms-interactions');exports[_0x9fe9('0x5d')]=function(_0x27e2b7,_0x159006,_0x53d103){var _0x53b741={'agent':{},'channel':_0x9fe9('0x5e')};if(_0x27e2b7[_0x9fe9('0x5b')]['id']){delete _0x27e2b7[_0x9fe9('0x5b')]['id'];}_0x27e2b7[_0x9fe9('0x5b')][_0x9fe9('0x5f')]=!![];_0x27e2b7[_0x9fe9('0x5b')]['readAt']=moment()['format'](_0x9fe9('0x60'));_0x27e2b7[_0x9fe9('0x5b')][_0x9fe9('0x61')]=_0x27e2b7[_0x9fe9('0x5b')][_0x9fe9('0x61')]||_0x27e2b7[_0x9fe9('0x62')]['id'];_0x53b741[_0x9fe9('0x63')]['id']=_0x27e2b7['body'][_0x9fe9('0x61')];return db['SmsMessage'][_0x9fe9('0x5a')]({'where':{'id':_0x27e2b7[_0x9fe9('0x56')]['id'],'UserId':null}})[_0x9fe9('0x36')](handleEntityNotFound(_0x159006,null))[_0x9fe9('0x36')](saveUpdates(_0x27e2b7[_0x9fe9('0x5b')],null))[_0x9fe9('0x36')](function(_0x523cb1){if(_0x523cb1){_0x53b741[_0x9fe9('0x28')]=_0x523cb1[_0x9fe9('0x64')]({'plain':!![]});return db[_0x9fe9('0x65')][_0x9fe9('0x5a')]({'where':{'id':_0x523cb1['SmsInteractionId']}});}return null;})[_0x9fe9('0x36')](handleEntityNotFound(_0x159006,null))[_0x9fe9('0x36')](function(_0x2dfb4a){if(_0x2dfb4a){return _0x2dfb4a['update']({'UserId':_0x27e2b7[_0x9fe9('0x5b')][_0x9fe9('0x61')],'read1stAt':_['isNil'](_0x2dfb4a[_0x9fe9('0x66')])?moment()[_0x9fe9('0x67')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x9fe9('0x36')](function(_0x1e1f46){if(_0x1e1f46){_0x53b741[_0x9fe9('0x68')]=_0x1e1f46[_0x9fe9('0x64')]({'plain':!![]});interaction_log[_0x9fe9('0x21')](_0x9fe9('0x69'),_0x27e2b7[_0x9fe9('0x62')]['id'],_0x27e2b7['user'][_0x9fe9('0x3a')],_0x27e2b7[_0x9fe9('0x62')][_0x9fe9('0x6a')],_0x53b741[_0x9fe9('0x68')]['id'],_0x27e2b7[_0x9fe9('0x5b')]?JSON[_0x9fe9('0x24')](_0x27e2b7[_0x9fe9('0x5b')]):'null');return respondWithRpcPromise(_0x9fe9('0x6b'),'acceptMessage',_0x53b741);}return null;})[_0x9fe9('0x36')](function(_0x200d6a){var _0x4a6e13=_0x9fe9('0x6c')+_0x200d6a[_0x9fe9('0x28')][_0x9fe9('0x6d')];return db[_0x9fe9('0x6e')][_0x9fe9('0x42')](_0x4a6e13,{'type':db[_0x9fe9('0x6f')][_0x9fe9('0x70')]['SELECT'],'raw':!![]})[_0x9fe9('0x36')](function(_0xc8af67){return _0xc8af67;});})[_0x9fe9('0x36')](function(_0x7eae8f){if(_0x7eae8f){_0x53b741[_0x9fe9('0x28')][_0x9fe9('0x71')]=_0x7eae8f[0x0];if(!_0x27e2b7[_0x9fe9('0x5b')][_0x9fe9('0x61')])return;return db[_0x9fe9('0x72')][_0x9fe9('0x5a')]({'where':{'id':_0x27e2b7[_0x9fe9('0x5b')][_0x9fe9('0x61')],'role':_0x9fe9('0x63')},'attributes':['id',_0x9fe9('0x3a'),_0x9fe9('0x73'),'email',_0x9fe9('0x74')],'raw':!![]});}return null;})[_0x9fe9('0x36')](function(_0x26848e){if(!_0x26848e)return null;_0x53b741[_0x9fe9('0x28')][_0x9fe9('0x63')]=_0x26848e;return _0x53b741;})[_0x9fe9('0x36')](function(_0x5878fc){if(_0x5878fc){if(_0x27e2b7[_0x9fe9('0x5b')][_0x9fe9('0x75')]){_0x53b741['message'][_0x9fe9('0x76')]=util[_0x9fe9('0x67')](_0x9fe9('0x77'),_0x27e2b7[_0x9fe9('0x62')][_0x9fe9('0x3a')]);_0x53b741[_0x9fe9('0x28')][_0x9fe9('0x78')]=_0x53b741[_0x9fe9('0x78')];_0x53b741[_0x9fe9('0x28')][_0x9fe9('0x79')]=_0x9fe9('0x5d');return respondWithRpcPromise(_0x9fe9('0x7a'),_0x9fe9('0x7a'),{'event':'acceptmessage','message':_0x53b741[_0x9fe9('0x28')]},client9002)[_0x9fe9('0x36')](function(){return _0x53b741;});}return _0x53b741;}return null;})[_0x9fe9('0x36')](respondWithResult(_0x159006,null))[_0x9fe9('0x54')](handleError(_0x159006,null));};var interaction_log=require(_0x9fe9('0x16'))(_0x9fe9('0x7b'));exports[_0x9fe9('0x33')]=function(_0x1620f1,_0x50c131,_0xa086e){var _0x32aa55={'agent':{},'channel':_0x9fe9('0x5e')};if(_0x1620f1['body']['id']){delete _0x1620f1[_0x9fe9('0x5b')]['id'];}_0x1620f1['body'][_0x9fe9('0x61')]=_0x1620f1[_0x9fe9('0x5b')][_0x9fe9('0x61')]||_0x1620f1[_0x9fe9('0x62')]['id'];_0x32aa55[_0x9fe9('0x63')]['id']=_0x1620f1[_0x9fe9('0x5b')][_0x9fe9('0x61')];return db['SmsMessage'][_0x9fe9('0x5a')]({'where':{'id':_0x1620f1['params']['id'],'UserId':null}})[_0x9fe9('0x36')](handleEntityNotFound(_0x50c131,null))[_0x9fe9('0x36')](function(_0x3dbe45){if(_0x3dbe45){_0x32aa55[_0x9fe9('0x28')]=_0x3dbe45[_0x9fe9('0x64')]({'plain':!![]});return db[_0x9fe9('0x65')][_0x9fe9('0x5a')]({'where':{'id':_0x3dbe45[_0x9fe9('0x7c')]}});}return null;})[_0x9fe9('0x36')](handleEntityNotFound(_0x50c131,null))[_0x9fe9('0x36')](function(_0x935906){if(_0x935906){_0x32aa55[_0x9fe9('0x68')]=_0x935906['get']({'plain':!![]});interaction_log[_0x9fe9('0x21')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1620f1[_0x9fe9('0x62')]['id'],_0x1620f1[_0x9fe9('0x62')]['name'],_0x1620f1['user'][_0x9fe9('0x6a')],_0x32aa55[_0x9fe9('0x68')]['id'],_0x1620f1['body']?JSON[_0x9fe9('0x24')](_0x1620f1[_0x9fe9('0x5b')]):_0x9fe9('0x7d'));return respondWithRpcPromise(_0x9fe9('0x7e'),_0x9fe9('0x7f'),_0x32aa55);}return null;})[_0x9fe9('0x36')](function(_0x5f546f){var _0x57f3b0=_0x9fe9('0x6c')+_0x5f546f[_0x9fe9('0x28')][_0x9fe9('0x6d')];return db[_0x9fe9('0x6e')]['query'](_0x57f3b0,{'type':db[_0x9fe9('0x6f')]['QueryTypes'][_0x9fe9('0x80')],'raw':!![]})[_0x9fe9('0x36')](function(_0x22ef4f){return _0x22ef4f;});})[_0x9fe9('0x36')](function(_0x13eba5){if(_0x13eba5){_0x32aa55[_0x9fe9('0x28')]['contact']=_0x13eba5[0x0];if(!_0x1620f1[_0x9fe9('0x5b')][_0x9fe9('0x61')])return;return db['User']['find']({'where':{'id':_0x1620f1[_0x9fe9('0x5b')][_0x9fe9('0x61')],'role':_0x9fe9('0x63')},'attributes':['id',_0x9fe9('0x3a'),'fullname',_0x9fe9('0x81'),_0x9fe9('0x74')],'raw':!![]});}return null;})[_0x9fe9('0x36')](function(_0x4ce36f){if(!_0x4ce36f)return null;_0x32aa55['message'][_0x9fe9('0x63')]=_0x4ce36f;return _0x32aa55;})[_0x9fe9('0x36')](function(_0x3325c1){if(_0x3325c1){_0x3325c1['message'][_0x9fe9('0x76')]=util[_0x9fe9('0x67')]('SIP/%s',_0x1620f1['user'][_0x9fe9('0x3a')]);_0x3325c1[_0x9fe9('0x28')]['channel']=_0x32aa55[_0x9fe9('0x78')];_0x3325c1[_0x9fe9('0x28')][_0x9fe9('0x79')]=_0x9fe9('0x33');respondWithRpcPromise('EventManager',_0x9fe9('0x7a'),{'event':'rejectmessage','message':_0x3325c1['message']},client9002);return _0x32aa55;}return null;})[_0x9fe9('0x36')](respondWithResult(_0x50c131,null))[_0x9fe9('0x54')](handleError(_0x50c131,null));};exports[_0x9fe9('0x2a')]=function(_0x106958,_0x19e594,_0x31a06e){if(_0x106958[_0x9fe9('0x5b')]['id']){delete _0x106958['body']['id'];}var _0x55b225;return db[_0x9fe9('0x4f')][_0x9fe9('0x5a')]({'where':{'id':_0x106958['params']['id']}})['then'](handleEntityNotFound(_0x19e594,null))['then'](function(_0x56cbec){if(_0x56cbec){_0x55b225=_0x56cbec;return db[_0x9fe9('0x82')]['find']({'where':{'id':_0x56cbec[_0x9fe9('0x83')]}});}})[_0x9fe9('0x36')](handleEntityNotFound(_0x19e594,null))[_0x9fe9('0x36')](function(_0x588c39){if(_0x588c39){logger[_0x9fe9('0x22')](_0x9fe9('0x84'),_0x9fe9('0x2a'),_0x9fe9('0x85'),_0x588c39[_0x9fe9('0x40')],util[_0x9fe9('0x86')](_0x106958[_0x9fe9('0x5b')],{'showHidden':![],'depth':null}));switch(_0x588c39[_0x9fe9('0x40')]){case _0x9fe9('0x87'):if(_0x106958[_0x9fe9('0x5b')][_0x9fe9('0x88')]&&_0x106958[_0x9fe9('0x5b')]['MessageSid']===_0x55b225[_0x9fe9('0x89')]){return _0x55b225[_0x9fe9('0x35')]({'read':!![]});}else{logger[_0x9fe9('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','twilio',util['inspect'](_0x106958['body'],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x106958[_0x9fe9('0x5b')][_0x9fe9('0x8a')]&&_0x106958[_0x9fe9('0x5b')][_0x9fe9('0x8a')]===_0x55b225[_0x9fe9('0x89')]&&_[_0x9fe9('0x8b')]([_0x9fe9('0x8c'),_0x9fe9('0x8d')],_0x106958[_0x9fe9('0x5b')][_0x9fe9('0x8e')])>=0x0){return _0x55b225[_0x9fe9('0x35')]({'read':!![]});}else{logger[_0x9fe9('0x25')](_0x9fe9('0x8f'),_0x9fe9('0x2a'),_0x9fe9('0x90'),util[_0x9fe9('0x86')](_0x106958['body'],{'showHidden':![],'depth':null}));}break;case _0x9fe9('0x91'):var _0x51adb2=_0x106958[_0x9fe9('0x5b')][_0x9fe9('0x92')][0x0];if(_0x51adb2['status'][_0x9fe9('0x93')]==='DELIVERED'){return _0x55b225['update']({'read':!![]});}else{logger[_0x9fe9('0x25')](_0x9fe9('0x8f'),_0x9fe9('0x2a'),_0x9fe9('0x91'),util[_0x9fe9('0x86')](_0x106958[_0x9fe9('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x55b225;}})[_0x9fe9('0x36')](respondWithResult(_0x19e594,null))['catch'](handleError(_0x19e594,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 86aa1b7..250a456 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 _0xcc43=['SmsMessage','setMaxListeners','save','update','emit','hook','exports','events'];(function(_0x508685,_0x9f94af){var _0x976a76=function(_0x1bcb05){while(--_0x1bcb05){_0x508685['push'](_0x508685['shift']());}};_0x976a76(++_0x9f94af);}(_0xcc43,0x1d7));var _0x3cc4=function(_0x2db8d7,_0x551c99){_0x2db8d7=_0x2db8d7-0x0;var _0x1fffdd=_0xcc43[_0x2db8d7];return _0x1fffdd;};'use strict';var EventEmitter=require(_0x3cc4('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x3cc4('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x3cc4('0x2')](0x0);var events={'afterCreate':_0x3cc4('0x3'),'afterUpdate':_0x3cc4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5b73eb){return function(_0x22e18f,_0x1f897f,_0x5b6d12){SmsMessageEvents[_0x3cc4('0x5')](_0x5b73eb+':'+_0x22e18f['id'],_0x22e18f);SmsMessageEvents[_0x3cc4('0x5')](_0x5b73eb,_0x22e18f);_0x5b6d12(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x3cc4('0x6')](e,emitEvent(event));}}module[_0x3cc4('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0x5f78=['exports','events','../../mysqldb','setMaxListeners','remove','hasOwnProperty','hook'];(function(_0x1539ff,_0x13582d){var _0x440930=function(_0x253b57){while(--_0x253b57){_0x1539ff['push'](_0x1539ff['shift']());}};_0x440930(++_0x13582d);}(_0x5f78,0xb7));var _0x85f7=function(_0x7148a3,_0x1c6652){_0x7148a3=_0x7148a3-0x0;var _0x52f31d=_0x5f78[_0x7148a3];return _0x52f31d;};'use strict';var EventEmitter=require(_0x85f7('0x0'));var SmsMessage=require(_0x85f7('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x85f7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x85f7('0x3')};function emitEvent(_0x231ff8){return function(_0x120401,_0xd7b8ea,_0x537651){SmsMessageEvents['emit'](_0x231ff8+':'+_0x120401['id'],_0x120401);SmsMessageEvents['emit'](_0x231ff8,_0x120401);_0x537651(null);};}for(var e in events){if(events[_0x85f7('0x4')](e)){var event=events[e];SmsMessage[_0x85f7('0x5')](e,emitEvent(event));}}module[_0x85f7('0x6')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 4d797aa..42afe0a 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 _0x7ee1=['read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','message_id','clickSend','plivo','authId','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','token','application/json','IBSSO\x20','csc','crypto','apiKey','login','timestamp','keys','sort','length','createHash','md5','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','bandwidth','accountId','/messages','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','intelepeer','finally','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define','SmsMessage','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','out','isNil','UserId','findOne','then','update','createdAt','catch','secret','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','sid','error','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport'];(function(_0x2a7d57,_0x27a648){var _0x5daa90=function(_0x211cac){while(--_0x211cac){_0x2a7d57['push'](_0x2a7d57['shift']());}};_0x5daa90(++_0x27a648);}(_0x7ee1,0xab));var _0x17ee=function(_0x463751,_0x3742aa){_0x463751=_0x463751-0x0;var _0x5a6968=_0x7ee1[_0x463751];return _0x5a6968;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var logger=require(_0x17ee('0x1'))(_0x17ee('0x2'));var moment=require(_0x17ee('0x3'));var BPromise=require(_0x17ee('0x4'));var rp=require(_0x17ee('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17ee('0x6'));var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module[_0x17ee('0x7')]=function(_0x2e4db0,_0x2efefb){return _0x2e4db0[_0x17ee('0x8')](_0x17ee('0x9'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x17ee('0xa'),'fields':['messageId']},{'name':_0x17ee('0xb'),'fields':[_0x17ee('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xb3aa42,_0x36d73a,_0xa9902e){var _0x3c879d=_0x2e4db0[_0x17ee('0xd')];var _0x352d60=_0xb3aa42[_0x17ee('0xe')]({'plain':!![]});if(_0x352d60[_0x17ee('0xf')][_0x17ee('0x10')]()==='in'||_0x352d60[_0x17ee('0xf')][_0x17ee('0x10')]()===_0x17ee('0x11')&&!_0x352d60['secret']&&!_[_0x17ee('0x12')](_0x352d60[_0x17ee('0x13')])){_0x3c879d['SmsInteraction'][_0x17ee('0x14')]({'where':{'id':_0x352d60['SmsInteractionId']}})[_0x17ee('0x15')](function(_0x27447d){if(_0x27447d){_0x27447d[_0x17ee('0x16')]({'lastMsgAt':_0x352d60[_0x17ee('0x17')],'lastMsgDirection':_0x352d60['direction'][_0x17ee('0x10')]()});}})[_0x17ee('0x18')](function(_0x1b09a3){console['error'](_0x1b09a3);});}if(_0x352d60[_0x17ee('0xf')]===_0x17ee('0x11')&&!_0x352d60[_0x17ee('0x19')]){var _0x384eaa;_0x3c879d[_0x17ee('0x1a')][_0x17ee('0x1b')]({'where':{'id':_0x352d60[_0x17ee('0x1c')]},'raw':!![]})['then'](function(_0x536c75){_0x384eaa=_0x536c75;if(_0x384eaa&&_0x384eaa[_0x17ee('0x1d')]){switch(_0x384eaa[_0x17ee('0x1d')]){case _0x17ee('0x1e'):var _0x2f908f=require('twilio');if(_0x384eaa[_0x17ee('0x1f')]&&_0x384eaa[_0x17ee('0x20')]&&_0x384eaa[_0x17ee('0x21')]){var _0x3ace7f=new _0x2f908f(_0x384eaa['accountSid'],_0x384eaa[_0x17ee('0x20')]);_0x3ace7f[_0x17ee('0x22')][_0x17ee('0x23')]({'body':_0x352d60['body'],'to':_0x352d60[_0x17ee('0x21')],'from':_0x384eaa[_0x17ee('0x21')],'statusCallback':_0x384eaa[_0x17ee('0x24')]+_0x17ee('0x25')+_0x352d60['id']+_0x17ee('0x26')+_0x384eaa['token']})[_0x17ee('0x15')](function(_0xc01da5){if(_0xc01da5[_0x17ee('0x27')]){return _0xb3aa42[_0x17ee('0x16')]({'messageId':_0xc01da5[_0x17ee('0x27')]});}})[_0x17ee('0x18')](function(_0x13e8ff){logger[_0x17ee('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x17ee('0x29'),_0x17ee('0x1e'),util[_0x17ee('0x2a')](_0x13e8ff,{'showHidden':![],'depth':null}));});}else{logger[_0x17ee('0x28')](_0x17ee('0x2b'),_0x17ee('0x29'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x17ee('0x2c'):var _0x400306=_0x17ee('0x2d');if(_0x384eaa['username']&&_0x384eaa[_0x17ee('0x2e')]){var _0x34b003={'recipient':[_0x352d60[_0x17ee('0x21')]],'message':_0x352d60['body'],'message_type':_0x384eaa[_0x17ee('0x2f')]};if(_0x384eaa[_0x17ee('0x2f')]&&_0x384eaa[_0x17ee('0x2f')]!=='SI'){_0x34b003[_0x17ee('0x30')]=_0x384eaa['phone'];}var _0x49e8b7={'url':_0x400306+_0x17ee('0x31')+_0x384eaa[_0x17ee('0x32')]+'&password='+_0x384eaa[_0x17ee('0x2e')],'method':'GET'};rp(_0x49e8b7)[_0x17ee('0x15')](function(_0x1cf8b9){var _0x126f3a=_0x1cf8b9['split'](';');var _0x2356fd={'user_key':_0x126f3a[0x0],'session_key':_0x126f3a[0x1]};_0x49e8b7={'url':_0x400306+'sms','method':_0x17ee('0x33'),'headers':{'user_key':_0x2356fd[_0x17ee('0x34')],'Session_key':_0x2356fd[_0x17ee('0x35')]},'json':!![],'body':_0x34b003};return rp(_0x49e8b7);})[_0x17ee('0x15')](function(_0x514114){if(_0x514114[_0x17ee('0x36')]>=0x1){var _0x27e103={'messageId':_0x514114[_0x17ee('0x37')]};if(_0x384eaa['smsMethod']!=='GP'||!_0x384eaa[_0x17ee('0x38')]){_0x27e103[_0x17ee('0x39')]=!![];}return _0xb3aa42[_0x17ee('0x16')](_0x27e103);}else{return logger['error'](_0x17ee('0x2b'),_0x17ee('0x29'),_0x17ee('0x2c'),util[_0x17ee('0x2a')](_0x514114,{'showHidden':![],'depth':null}));}})[_0x17ee('0x18')](function(_0x423079){return logger[_0x17ee('0x28')](_0x17ee('0x2b'),_0x17ee('0x29'),_0x17ee('0x2c'),util['inspect'](_0x423079,{'showHidden':![],'depth':null}));});}else{logger[_0x17ee('0x28')](_0x17ee('0x2b'),_0x17ee('0x29'),_0x17ee('0x2c'),_0x17ee('0x3a'));}break;case _0x17ee('0x3b'):if(_0x384eaa[_0x17ee('0x20')]){var _0x1c6924={'recipient':_0x352d60[_0x17ee('0x21')],'message':_0x352d60[_0x17ee('0xc')],'sender':_0x384eaa[_0x17ee('0x3c')]||_0x384eaa['phone'],'authorization':_0x384eaa[_0x17ee('0x20')]};var _0x36d73a={'method':'POST','uri':_0x17ee('0x3d'),'body':_0x1c6924,'json':!![]};rp(_0x36d73a)[_0x17ee('0x15')](function(_0x21cdf6){var _0x29e163={'messageId':_0x21cdf6[_0x17ee('0x3e')]};if(!_0x384eaa[_0x17ee('0x38')]){_0x29e163['read']=!![];}return _0xb3aa42['update'](_0x29e163);})[_0x17ee('0x18')](function(_0x20c6e9){logger[_0x17ee('0x28')](_0x17ee('0x2b'),_0x17ee('0x29'),_0x17ee('0x3b'),util['inspect'](_0x20c6e9,{'showHidden':![],'depth':null}));});}else{logger[_0x17ee('0x28')](_0x17ee('0x2b'),'afterCreate',_0x17ee('0x3b'),'Missing\x20parameters:\x20authToken');}break;case _0x17ee('0x3f'):if(_0x384eaa['username']&&_0x384eaa[_0x17ee('0x2e')]){var _0x1c6924={'messages':[{'source':_0x17ee('0x40'),'to':_0x352d60[_0x17ee('0x21')],'body':_0x352d60['body'],'from':_0x384eaa['senderString']||_0x384eaa['phone']}]};var _0x58106c=util[_0x17ee('0x41')](_0x17ee('0x42'),_0x384eaa['username'],_0x384eaa[_0x17ee('0x2e')]);var _0x36d73a={'method':_0x17ee('0x33'),'uri':_0x17ee('0x43'),'body':_0x1c6924,'headers':{'Authorization':util[_0x17ee('0x41')](_0x17ee('0x44'),new Buffer(_0x58106c)[_0x17ee('0x45')](_0x17ee('0x46')))},'json':!![]};rp(_0x36d73a)['then'](function(_0x4664f7){if(_0x4664f7[_0x17ee('0x47')]>=0xc8&&_0x4664f7['http_code']<=0xce){if(_0x4664f7[_0x17ee('0x48')]&&_0x4664f7[_0x17ee('0x48')][_0x17ee('0x49')]>0x0){var _0x55f597=_['head'](_0x4664f7['data'][_0x17ee('0x22')]);var _0x2a8a48={'messageId':_0x55f597[_0x17ee('0x4a')]};if(!_0x384eaa[_0x17ee('0x38')]){_0x2a8a48[_0x17ee('0x39')]=!![];}return _0xb3aa42[_0x17ee('0x16')](_0x2a8a48);}else{logger[_0x17ee('0x28')](_0x17ee('0x2b'),'afterCreate',_0x17ee('0x4b'),util[_0x17ee('0x2a')](_0x4664f7,{'showHidden':![],'depth':null}));}}else{logger[_0x17ee('0x28')](_0x17ee('0x2b'),_0x17ee('0x29'),_0x17ee('0x4b'),util[_0x17ee('0x2a')](_0x4664f7,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3d7ba1){logger[_0x17ee('0x28')](_0x17ee('0x2b'),_0x17ee('0x29'),'clickSend',util[_0x17ee('0x2a')](_0x3d7ba1,{'showHidden':![],'depth':null}));});}else{logger[_0x17ee('0x28')](_0x17ee('0x2b'),_0x17ee('0x29'),'clickSend',_0x17ee('0x3a'));}break;case _0x17ee('0x4c'):if(_0x384eaa[_0x17ee('0x4d')]&&_0x384eaa[_0x17ee('0x20')]){var _0x1c6924={'dst':_0x352d60[_0x17ee('0x21')],'text':_0x352d60[_0x17ee('0xc')],'src':_0x384eaa[_0x17ee('0x3c')]||_0x384eaa['phone'],'url':_0x384eaa['remote']+_0x17ee('0x25')+_0x352d60['id']+_0x17ee('0x26')+_0x384eaa['token']};var _0x58106c=util[_0x17ee('0x41')](_0x17ee('0x42'),_0x384eaa[_0x17ee('0x4d')],_0x384eaa['authToken']);var _0x36d73a={'method':_0x17ee('0x33'),'uri':util[_0x17ee('0x41')]('https://api.plivo.com/v1/Account/%s/Message/',_0x384eaa['authId']),'body':_0x1c6924,'headers':{'Authorization':util[_0x17ee('0x41')]('Basic\x20%s',new Buffer(_0x58106c)[_0x17ee('0x45')]('base64'))},'json':!![]};rp(_0x36d73a)[_0x17ee('0x15')](function(_0x537958){var _0x329c99={'messageId':_0x537958[_0x17ee('0x4e')][0x0]};return _0xb3aa42[_0x17ee('0x16')](_0x329c99);})['catch'](function(_0x151b4d){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x17ee('0x4c'),util[_0x17ee('0x2a')](_0x151b4d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x17ee('0x2b'),_0x17ee('0x29'),_0x17ee('0x4c'),_0x17ee('0x4f'));}break;case _0x17ee('0x50'):if(_0x384eaa['username']&&_0x384eaa[_0x17ee('0x2e')]){if(_0x384eaa[_0x17ee('0x51')]){var _0x54527d={'method':_0x17ee('0x33'),'uri':_0x384eaa['baseUrl']+_0x17ee('0x52'),'body':{'username':_0x384eaa[_0x17ee('0x32')],'password':_0x384eaa['password']},'json':!![]};return rp(_0x54527d)[_0x17ee('0x15')](function(_0x8e7e69){var _0x201c57={'method':_0x17ee('0x33'),'uri':_0x384eaa['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x384eaa['phone'],'destinations':[{'to':_0x352d60[_0x17ee('0x21')]}],'text':_0x352d60['body'],'notifyUrl':_0x384eaa[_0x17ee('0x24')]+_0x17ee('0x25')+_0x352d60['id']+'/status?token='+_0x384eaa[_0x17ee('0x53')],'notifyContentType':_0x17ee('0x54'),'callbackData':_0x384eaa[_0x17ee('0x21')]+';'+_0x352d60['body']}]},'headers':{'Authorization':_0x17ee('0x55')+_0x8e7e69[_0x17ee('0x53')]},'json':!![]};return rp(_0x201c57)['then'](function(_0x1254df){if(_0x1254df[_0x17ee('0x22')]){var _0x155ede={'messageId':_0x1254df[_0x17ee('0x22')][0x0][_0x17ee('0xa')]};if(!_0x384eaa[_0x17ee('0x38')]){_0x155ede['read']=!![];}return _0xb3aa42['update'](_0x155ede);}else{return logger[_0x17ee('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x17ee('0x50'),util[_0x17ee('0x2a')](_0x1254df,{'showHidden':![],'depth':null}));}});})[_0x17ee('0x18')](function(_0x5615e3){return logger['error'](_0x17ee('0x2b'),_0x17ee('0x29'),_0x17ee('0x50'),util[_0x17ee('0x2a')](_0x5615e3,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x17ee('0x29'),'infobip','Missing\x20parameters:\x20base_url');}}else{logger[_0x17ee('0x28')](_0x17ee('0x2b'),'afterCreate',_0x17ee('0x50'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x17ee('0x56'):var _0x26717c=require(_0x17ee('0x57'));if(_0x384eaa[_0x17ee('0x58')]){var _0x5b9a57={};_0x5b9a57[_0x17ee('0x59')]=_0x384eaa[_0x17ee('0x32')];_0x5b9a57[_0x17ee('0x21')]=_0x352d60[_0x17ee('0x21')];_0x5b9a57[_0x17ee('0x30')]=_0x384eaa['phone'];_0x5b9a57['text']=_0x352d60[_0x17ee('0xc')];_0x5b9a57[_0x17ee('0x5a')]=+new Date();var _0xa02147='';var _0x235b4f='';var _0x38f3ec=Object[_0x17ee('0x5b')](_0x5b9a57);_0x38f3ec[_0x17ee('0x5c')]();for(var _0x22002a=0x0;_0x22002a<_0x38f3ec[_0x17ee('0x5d')];_0x22002a++){if(_0xa02147!=''){_0xa02147+='&';}_0xa02147+=_0x38f3ec[_0x22002a]+'='+encodeURIComponent(_0x5b9a57[_0x38f3ec[_0x22002a]]);_0x235b4f+=_0x5b9a57[_0x38f3ec[_0x22002a]];}_0x235b4f+=_0x384eaa[_0x17ee('0x58')];_0x235b4f=_0x26717c[_0x17ee('0x5e')](_0x17ee('0x5f'))[_0x17ee('0x16')](_0x235b4f)['digest'](_0x17ee('0x60'));if(_0xa02147!==''){_0xa02147+='&';}_0xa02147+=_0x17ee('0x61')+_0x235b4f;var _0x49e8b7={'method':'GET','uri':_0x384eaa['baseUrl']+_0x17ee('0x62')+_0xa02147,'json':!![]};return rp(_0x49e8b7)['then'](function(_0x44966b){var _0x1d043e=Object[_0x17ee('0x5b')](_0x44966b);if(_0x44966b[_0x1d043e[0x0]][_0x17ee('0x28')]&&parseInt(_0x44966b[_0x1d043e[0x0]]['error'])===0x0){var _0x56087d={'messageId':_0x44966b[_0x1d043e[0x0]][_0x17ee('0x63')]};if(!_0x384eaa[_0x17ee('0x38')]){_0x56087d['read']=!![];}return _0xb3aa42[_0x17ee('0x16')](_0x56087d);}else{return logger[_0x17ee('0x28')](_0x17ee('0x2b'),'afterCreate',_0x17ee('0x56'),util['inspect'](_0x44966b[_0x17ee('0x28')],{'showHidden':![],'depth':null}));}})[_0x17ee('0x18')](function(_0x522e8e){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x17ee('0x29'),_0x17ee('0x56'),util[_0x17ee('0x2a')](_0x522e8e,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x17ee('0x29'),_0x17ee('0x56'),_0x17ee('0x64'));}break;case _0x17ee('0x65'):if(_0x384eaa['apiKey']){var _0x22d5f2={'method':_0x17ee('0x33'),'uri':_0x17ee('0x66'),'headers':{'Authorization':_0x384eaa[_0x17ee('0x58')]},'body':{'content':_0x352d60[_0x17ee('0xc')],'to':[_0x352d60[_0x17ee('0x21')]],'from':_0x384eaa[_0x17ee('0x21')],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x22d5f2)[_0x17ee('0x15')](function(_0x555302){if(!_0x555302['error']){var _0x497dc7={'messageId':_0x555302['messages'][0x0]['apiMessageId']};if(!_0x384eaa[_0x17ee('0x38')]){_0x497dc7[_0x17ee('0x39')]=!![];}return _0xb3aa42[_0x17ee('0x16')](_0x497dc7);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x17ee('0x29'),'clickatell',util[_0x17ee('0x2a')](_0x555302['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x65e755){return logger[_0x17ee('0x28')](_0x17ee('0x2b'),'afterCreate',_0x17ee('0x65'),util[_0x17ee('0x2a')](_0x65e755,{'showHidden':![],'depth':null}));});}else{logger[_0x17ee('0x28')](_0x17ee('0x2b'),_0x17ee('0x29'),_0x17ee('0x65'),_0x17ee('0x64'));}break;case _0x17ee('0x67'):if(_0x384eaa[_0x17ee('0x32')]&&_0x384eaa[_0x17ee('0x2e')]){var _0x58106c=util[_0x17ee('0x41')]('%s:%s',_0x384eaa['username'],_0x384eaa[_0x17ee('0x2e')]);var _0x36d73a={'method':_0x17ee('0x33'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x384eaa[_0x17ee('0x68')]+_0x17ee('0x69'),'body':{'to':[_0x352d60[_0x17ee('0x21')]],'text':_0x352d60[_0x17ee('0xc')],'from':_0x384eaa[_0x17ee('0x21')],'applicationId':_0x384eaa['applicationId']},'headers':{'Authorization':util[_0x17ee('0x41')]('Basic\x20%s',new Buffer(_0x58106c)[_0x17ee('0x45')](_0x17ee('0x46')))},'json':!![]};rp(_0x36d73a)[_0x17ee('0x15')](function(_0x16c6df){if(_0x16c6df['id']){var _0x176f19={'messageId':_0x16c6df['id']};return _0xb3aa42[_0x17ee('0x16')](_0x176f19);}else{logger[_0x17ee('0x28')](_0x17ee('0x2b'),'afterCreate',_0x17ee('0x67'),util['inspect'](_0x16c6df,{'showHidden':![],'depth':null}));}})[_0x17ee('0x18')](function(_0x1857fa){logger[_0x17ee('0x28')](_0x17ee('0x2b'),'afterCreate',_0x17ee('0x67'),util[_0x17ee('0x2a')](_0x1857fa,{'showHidden':![],'depth':null}));});}else{logger[_0x17ee('0x28')](_0x17ee('0x2b'),_0x17ee('0x29'),_0x17ee('0x67'),_0x17ee('0x3a'));}break;case'intelepeer':if(_0x384eaa[_0x17ee('0x58')]){var _0x36884e={};var _0x49e8b7={'method':_0x17ee('0x33'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x17ee('0x6a')+_0x384eaa['apiKey'],'Content-Type':_0x17ee('0x54')},'body':{'from':_0x384eaa['phone'],'to':_0x352d60[_0x17ee('0x21')],'text':_0x352d60[_0x17ee('0xc')]},'json':!![]};return rp(_0x49e8b7)[_0x17ee('0x15')](function(_0x296303){if(_0x296303[_0x17ee('0x6b')]==0xca){_0x36884e[_0x17ee('0x6c')]=_0x296303;var _0x19b456={'method':_0x17ee('0x33'),'uri':_0x17ee('0x6d'),'headers':{'Authorization':_0x17ee('0x6a')+_0x384eaa[_0x17ee('0x58')],'Content-Type':_0x17ee('0x54')},'body':{'refid':_0x36884e[_0x17ee('0x6c')][_0x17ee('0x6e')]},'json':!![]};return rp(_0x19b456)[_0x17ee('0x15')](function(_0x48ea15){_0x36884e['status']=_0x48ea15;var _0x4a6af4={'messageId':_0x36884e[_0x17ee('0x6c')][_0x17ee('0x6e')],'read':!![]};return _0xb3aa42[_0x17ee('0x16')](_0x4a6af4);});}else{return logger[_0x17ee('0x28')](_0x17ee('0x2b'),'afterCreate','intelepeer',util['inspect'](_0x296303,{'showHidden':![],'depth':null}));}})['catch'](function(_0x20e9c4){return logger[_0x17ee('0x28')](_0x17ee('0x2b'),_0x17ee('0x29'),_0x17ee('0x6f'),util['inspect'](_0x20e9c4,{'showHidden':![],'depth':null}));});}else{return logger[_0x17ee('0x28')](_0x17ee('0x2b'),_0x17ee('0x29'),_0x17ee('0x6f'),'Token\x20not\x20received');}break;}}})[_0x17ee('0x70')](function(){_0xa9902e();});}else{_0xa9902e();}}},'charset':'utf8mb4','collate':_0x17ee('0x71')});}; \ No newline at end of file +var _0xaf9b=['direction','out','isNil','UserId','findOne','SmsInteractionId','then','createdAt','catch','error','secret','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','&password=','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','update','afterCreate','inspect','connectel','clicksend','password','xCALLY\x20Motion','senderString','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','infobip','Missing\x20parameters:\x20base_url','crypto','apiKey','login','text','timestamp','keys','sort','createHash','digest','GET','/external/get/send.php?','csc','Missing\x20parameters:\x20apiKey','clickatell','uuid','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','bandwidth','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','intelepeer','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./smsMessage.attributes','exports','define','messageId','fti_sms_messages','body','FULLTEXT','models','get','toLowerCase'];(function(_0xb39081,_0x53f065){var _0x503a3f=function(_0x3ea885){while(--_0x3ea885){_0xb39081['push'](_0xb39081['shift']());}};_0x503a3f(++_0x53f065);}(_0xaf9b,0x1d7));var _0xbaf9=function(_0x5ca7e2,_0x5e1f8e){_0x5ca7e2=_0x5ca7e2-0x0;var _0x27faa5=_0xaf9b[_0x5ca7e2];return _0x27faa5;};'use strict';var _=require(_0xbaf9('0x0'));var util=require('util');var logger=require(_0xbaf9('0x1'))('api');var moment=require(_0xbaf9('0x2'));var BPromise=require(_0xbaf9('0x3'));var rp=require(_0xbaf9('0x4'));var fs=require('fs');var path=require(_0xbaf9('0x5'));var rimraf=require('rimraf');var config=require(_0xbaf9('0x6'));var attributes=require(_0xbaf9('0x7'));module[_0xbaf9('0x8')]=function(_0x4b443e,_0x40b949){return _0x4b443e[_0xbaf9('0x9')]('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xbaf9('0xa'),'fields':[_0xbaf9('0xa')]},{'name':_0xbaf9('0xb'),'fields':[_0xbaf9('0xc')],'type':_0xbaf9('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1356fb,_0x3281cd,_0x34c5da){var _0x37a933=_0x4b443e[_0xbaf9('0xe')];var _0x30fa1f=_0x1356fb[_0xbaf9('0xf')]({'plain':!![]});if(_0x30fa1f['direction'][_0xbaf9('0x10')]()==='in'||_0x30fa1f[_0xbaf9('0x11')][_0xbaf9('0x10')]()===_0xbaf9('0x12')&&!_0x30fa1f['secret']&&!_[_0xbaf9('0x13')](_0x30fa1f[_0xbaf9('0x14')])){_0x37a933['SmsInteraction'][_0xbaf9('0x15')]({'where':{'id':_0x30fa1f[_0xbaf9('0x16')]}})[_0xbaf9('0x17')](function(_0x488d4a){if(_0x488d4a){_0x488d4a['update']({'lastMsgAt':_0x30fa1f[_0xbaf9('0x18')],'lastMsgDirection':_0x30fa1f['direction'][_0xbaf9('0x10')]()});}})[_0xbaf9('0x19')](function(_0x2cd568){console[_0xbaf9('0x1a')](_0x2cd568);});}if(_0x30fa1f['direction']==='out'&&!_0x30fa1f[_0xbaf9('0x1b')]){var _0x3e3d4c;_0x37a933[_0xbaf9('0x1c')][_0xbaf9('0x1d')]({'where':{'id':_0x30fa1f[_0xbaf9('0x1e')]},'raw':!![]})[_0xbaf9('0x17')](function(_0x1a1d1b){_0x3e3d4c=_0x1a1d1b;if(_0x3e3d4c&&_0x3e3d4c['type']){switch(_0x3e3d4c[_0xbaf9('0x1f')]){case _0xbaf9('0x20'):var _0x16f0e3=require('twilio');if(_0x3e3d4c[_0xbaf9('0x21')]&&_0x3e3d4c[_0xbaf9('0x22')]&&_0x3e3d4c[_0xbaf9('0x23')]){var _0x4dece7=new _0x16f0e3(_0x3e3d4c[_0xbaf9('0x21')],_0x3e3d4c[_0xbaf9('0x22')]);_0x4dece7[_0xbaf9('0x24')]['create']({'body':_0x30fa1f[_0xbaf9('0xc')],'to':_0x30fa1f[_0xbaf9('0x23')],'from':_0x3e3d4c['phone'],'statusCallback':_0x3e3d4c[_0xbaf9('0x25')]+_0xbaf9('0x26')+_0x30fa1f['id']+_0xbaf9('0x27')+_0x3e3d4c[_0xbaf9('0x28')]})['then'](function(_0x225334){if(_0x225334[_0xbaf9('0x29')]){return _0x1356fb['update']({'messageId':_0x225334[_0xbaf9('0x29')]});}})[_0xbaf9('0x19')](function(_0x135d46){logger[_0xbaf9('0x1a')](_0xbaf9('0x2a'),'afterCreate',_0xbaf9('0x20'),util['inspect'](_0x135d46,{'showHidden':![],'depth':null}));});}else{logger[_0xbaf9('0x1a')](_0xbaf9('0x2a'),'afterCreate','twilio',_0xbaf9('0x2b'));}break;case _0xbaf9('0x2c'):var _0x5a3fd1=_0xbaf9('0x2d');if(_0x3e3d4c[_0xbaf9('0x2e')]&&_0x3e3d4c['password']){var _0x11eeb5={'recipient':[_0x30fa1f[_0xbaf9('0x23')]],'message':_0x30fa1f['body'],'message_type':_0x3e3d4c[_0xbaf9('0x2f')]};if(_0x3e3d4c['smsMethod']&&_0x3e3d4c['smsMethod']!=='SI'){_0x11eeb5[_0xbaf9('0x30')]=_0x3e3d4c[_0xbaf9('0x23')];}var _0x4d8460={'url':_0x5a3fd1+_0xbaf9('0x31')+_0x3e3d4c[_0xbaf9('0x2e')]+_0xbaf9('0x32')+_0x3e3d4c['password'],'method':'GET'};rp(_0x4d8460)[_0xbaf9('0x17')](function(_0x5cfe2c){var _0x1e1ccb=_0x5cfe2c[_0xbaf9('0x33')](';');var _0x37d809={'user_key':_0x1e1ccb[0x0],'session_key':_0x1e1ccb[0x1]};_0x4d8460={'url':_0x5a3fd1+_0xbaf9('0x34'),'method':_0xbaf9('0x35'),'headers':{'user_key':_0x37d809[_0xbaf9('0x36')],'Session_key':_0x37d809[_0xbaf9('0x37')]},'json':!![],'body':_0x11eeb5};return rp(_0x4d8460);})[_0xbaf9('0x17')](function(_0x4f6153){if(_0x4f6153[_0xbaf9('0x38')]>=0x1){var _0x347039={'messageId':_0x4f6153[_0xbaf9('0x39')]};if(_0x3e3d4c[_0xbaf9('0x2f')]!=='GP'||!_0x3e3d4c[_0xbaf9('0x3a')]){_0x347039[_0xbaf9('0x3b')]=!![];}return _0x1356fb[_0xbaf9('0x3c')](_0x347039);}else{return logger['error'](_0xbaf9('0x2a'),_0xbaf9('0x3d'),'skebby',util['inspect'](_0x4f6153,{'showHidden':![],'depth':null}));}})['catch'](function(_0x25719e){return logger['error'](_0xbaf9('0x2a'),'afterCreate',_0xbaf9('0x2c'),util[_0xbaf9('0x3e')](_0x25719e,{'showHidden':![],'depth':null}));});}else{logger[_0xbaf9('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbaf9('0x3d'),'skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0xbaf9('0x3f'):if(_0x3e3d4c[_0xbaf9('0x22')]){var _0x473a6f={'recipient':_0x30fa1f[_0xbaf9('0x23')],'message':_0x30fa1f['body'],'sender':_0x3e3d4c['senderString']||_0x3e3d4c[_0xbaf9('0x23')],'authorization':_0x3e3d4c['authToken']};var _0x3281cd={'method':_0xbaf9('0x35'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x473a6f,'json':!![]};rp(_0x3281cd)['then'](function(_0x581bf5){var _0x4eb9c5={'messageId':_0x581bf5['requestid']};if(!_0x3e3d4c['deliveryReport']){_0x4eb9c5[_0xbaf9('0x3b')]=!![];}return _0x1356fb[_0xbaf9('0x3c')](_0x4eb9c5);})['catch'](function(_0x551da7){logger['error'](_0xbaf9('0x2a'),_0xbaf9('0x3d'),_0xbaf9('0x3f'),util[_0xbaf9('0x3e')](_0x551da7,{'showHidden':![],'depth':null}));});}else{logger[_0xbaf9('0x1a')](_0xbaf9('0x2a'),_0xbaf9('0x3d'),_0xbaf9('0x3f'),'Missing\x20parameters:\x20authToken');}break;case _0xbaf9('0x40'):if(_0x3e3d4c[_0xbaf9('0x2e')]&&_0x3e3d4c[_0xbaf9('0x41')]){var _0x473a6f={'messages':[{'source':_0xbaf9('0x42'),'to':_0x30fa1f['phone'],'body':_0x30fa1f['body'],'from':_0x3e3d4c[_0xbaf9('0x43')]||_0x3e3d4c[_0xbaf9('0x23')]}]};var _0x4a674f=util[_0xbaf9('0x44')](_0xbaf9('0x45'),_0x3e3d4c['username'],_0x3e3d4c[_0xbaf9('0x41')]);var _0x3281cd={'method':_0xbaf9('0x35'),'uri':_0xbaf9('0x46'),'body':_0x473a6f,'headers':{'Authorization':util['format'](_0xbaf9('0x47'),new Buffer(_0x4a674f)['toString'](_0xbaf9('0x48')))},'json':!![]};rp(_0x3281cd)['then'](function(_0x433bce){if(_0x433bce[_0xbaf9('0x49')]>=0xc8&&_0x433bce['http_code']<=0xce){if(_0x433bce['data']&&_0x433bce[_0xbaf9('0x4a')][_0xbaf9('0x4b')]>0x0){var _0x5ee43f=_[_0xbaf9('0x4c')](_0x433bce[_0xbaf9('0x4a')][_0xbaf9('0x24')]);var _0x161d0c={'messageId':_0x5ee43f[_0xbaf9('0x4d')]};if(!_0x3e3d4c['deliveryReport']){_0x161d0c[_0xbaf9('0x3b')]=!![];}return _0x1356fb[_0xbaf9('0x3c')](_0x161d0c);}else{logger[_0xbaf9('0x1a')](_0xbaf9('0x2a'),_0xbaf9('0x3d'),'clickSend',util[_0xbaf9('0x3e')](_0x433bce,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xbaf9('0x2a'),_0xbaf9('0x3d'),_0xbaf9('0x4e'),util['inspect'](_0x433bce,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2c89f1){logger['error'](_0xbaf9('0x2a'),_0xbaf9('0x3d'),_0xbaf9('0x4e'),util[_0xbaf9('0x3e')](_0x2c89f1,{'showHidden':![],'depth':null}));});}else{logger[_0xbaf9('0x1a')](_0xbaf9('0x2a'),_0xbaf9('0x3d'),_0xbaf9('0x4e'),_0xbaf9('0x4f'));}break;case _0xbaf9('0x50'):if(_0x3e3d4c[_0xbaf9('0x51')]&&_0x3e3d4c[_0xbaf9('0x22')]){var _0x473a6f={'dst':_0x30fa1f[_0xbaf9('0x23')],'text':_0x30fa1f[_0xbaf9('0xc')],'src':_0x3e3d4c[_0xbaf9('0x43')]||_0x3e3d4c[_0xbaf9('0x23')],'url':_0x3e3d4c[_0xbaf9('0x25')]+_0xbaf9('0x26')+_0x30fa1f['id']+'/status?token='+_0x3e3d4c[_0xbaf9('0x28')]};var _0x4a674f=util[_0xbaf9('0x44')]('%s:%s',_0x3e3d4c['authId'],_0x3e3d4c[_0xbaf9('0x22')]);var _0x3281cd={'method':_0xbaf9('0x35'),'uri':util[_0xbaf9('0x44')]('https://api.plivo.com/v1/Account/%s/Message/',_0x3e3d4c['authId']),'body':_0x473a6f,'headers':{'Authorization':util[_0xbaf9('0x44')](_0xbaf9('0x47'),new Buffer(_0x4a674f)[_0xbaf9('0x52')](_0xbaf9('0x48')))},'json':!![]};rp(_0x3281cd)['then'](function(_0x29052d){var _0xe04fd0={'messageId':_0x29052d[_0xbaf9('0x53')][0x0]};return _0x1356fb['update'](_0xe04fd0);})[_0xbaf9('0x19')](function(_0xe72140){logger[_0xbaf9('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbaf9('0x3d'),_0xbaf9('0x50'),util[_0xbaf9('0x3e')](_0xe72140,{'showHidden':![],'depth':null}));});}else{logger[_0xbaf9('0x1a')](_0xbaf9('0x2a'),_0xbaf9('0x3d'),'plivo',_0xbaf9('0x54'));}break;case'infobip':if(_0x3e3d4c[_0xbaf9('0x2e')]&&_0x3e3d4c[_0xbaf9('0x41')]){if(_0x3e3d4c[_0xbaf9('0x55')]){var _0x35c69b={'method':'POST','uri':_0x3e3d4c[_0xbaf9('0x55')]+_0xbaf9('0x56'),'body':{'username':_0x3e3d4c[_0xbaf9('0x2e')],'password':_0x3e3d4c['password']},'json':!![]};return rp(_0x35c69b)[_0xbaf9('0x17')](function(_0x2d3658){var _0x2e72c2={'method':'POST','uri':_0x3e3d4c[_0xbaf9('0x55')]+_0xbaf9('0x57'),'body':{'messages':[{'from':_0x3e3d4c[_0xbaf9('0x23')],'destinations':[{'to':_0x30fa1f[_0xbaf9('0x23')]}],'text':_0x30fa1f['body'],'notifyUrl':_0x3e3d4c[_0xbaf9('0x25')]+_0xbaf9('0x26')+_0x30fa1f['id']+_0xbaf9('0x27')+_0x3e3d4c[_0xbaf9('0x28')],'notifyContentType':_0xbaf9('0x58'),'callbackData':_0x3e3d4c[_0xbaf9('0x23')]+';'+_0x30fa1f['body']}]},'headers':{'Authorization':'IBSSO\x20'+_0x2d3658[_0xbaf9('0x28')]},'json':!![]};return rp(_0x2e72c2)[_0xbaf9('0x17')](function(_0x54a50c){if(_0x54a50c[_0xbaf9('0x24')]){var _0x5e0b5a={'messageId':_0x54a50c[_0xbaf9('0x24')][0x0][_0xbaf9('0xa')]};if(!_0x3e3d4c[_0xbaf9('0x3a')]){_0x5e0b5a[_0xbaf9('0x3b')]=!![];}return _0x1356fb[_0xbaf9('0x3c')](_0x5e0b5a);}else{return logger[_0xbaf9('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbaf9('0x3d'),_0xbaf9('0x59'),util[_0xbaf9('0x3e')](_0x54a50c,{'showHidden':![],'depth':null}));}});})[_0xbaf9('0x19')](function(_0x3186fd){return logger[_0xbaf9('0x1a')](_0xbaf9('0x2a'),_0xbaf9('0x3d'),'infobip',util[_0xbaf9('0x3e')](_0x3186fd,{'showHidden':![],'depth':null}));});}else{logger[_0xbaf9('0x1a')](_0xbaf9('0x2a'),_0xbaf9('0x3d'),_0xbaf9('0x59'),_0xbaf9('0x5a'));}}else{logger[_0xbaf9('0x1a')](_0xbaf9('0x2a'),_0xbaf9('0x3d'),_0xbaf9('0x59'),_0xbaf9('0x4f'));}break;case'csc':var _0x37719c=require(_0xbaf9('0x5b'));if(_0x3e3d4c[_0xbaf9('0x5c')]){var _0x4e33ce={};_0x4e33ce[_0xbaf9('0x5d')]=_0x3e3d4c[_0xbaf9('0x2e')];_0x4e33ce[_0xbaf9('0x23')]=_0x30fa1f[_0xbaf9('0x23')];_0x4e33ce['sender']=_0x3e3d4c[_0xbaf9('0x23')];_0x4e33ce[_0xbaf9('0x5e')]=_0x30fa1f['body'];_0x4e33ce[_0xbaf9('0x5f')]=+new Date();var _0x8af71='';var _0x1a135b='';var _0x3724d9=Object[_0xbaf9('0x60')](_0x4e33ce);_0x3724d9[_0xbaf9('0x61')]();for(var _0x764854=0x0;_0x764854<_0x3724d9['length'];_0x764854++){if(_0x8af71!=''){_0x8af71+='&';}_0x8af71+=_0x3724d9[_0x764854]+'='+encodeURIComponent(_0x4e33ce[_0x3724d9[_0x764854]]);_0x1a135b+=_0x4e33ce[_0x3724d9[_0x764854]];}_0x1a135b+=_0x3e3d4c[_0xbaf9('0x5c')];_0x1a135b=_0x37719c[_0xbaf9('0x62')]('md5')[_0xbaf9('0x3c')](_0x1a135b)[_0xbaf9('0x63')]('hex');if(_0x8af71!==''){_0x8af71+='&';}_0x8af71+='signature='+_0x1a135b;var _0x4d8460={'method':_0xbaf9('0x64'),'uri':_0x3e3d4c[_0xbaf9('0x55')]+_0xbaf9('0x65')+_0x8af71,'json':!![]};return rp(_0x4d8460)[_0xbaf9('0x17')](function(_0x453dc1){var _0x5b859b=Object['keys'](_0x453dc1);if(_0x453dc1[_0x5b859b[0x0]]['error']&&parseInt(_0x453dc1[_0x5b859b[0x0]][_0xbaf9('0x1a')])===0x0){var _0x5be939={'messageId':_0x453dc1[_0x5b859b[0x0]]['id_sms']};if(!_0x3e3d4c[_0xbaf9('0x3a')]){_0x5be939[_0xbaf9('0x3b')]=!![];}return _0x1356fb['update'](_0x5be939);}else{return logger[_0xbaf9('0x1a')](_0xbaf9('0x2a'),_0xbaf9('0x3d'),_0xbaf9('0x66'),util[_0xbaf9('0x3e')](_0x453dc1[_0xbaf9('0x1a')],{'showHidden':![],'depth':null}));}})[_0xbaf9('0x19')](function(_0x3e2f6e){return logger[_0xbaf9('0x1a')](_0xbaf9('0x2a'),'afterCreate',_0xbaf9('0x66'),util[_0xbaf9('0x3e')](_0x3e2f6e,{'showHidden':![],'depth':null}));});}else{logger[_0xbaf9('0x1a')](_0xbaf9('0x2a'),_0xbaf9('0x3d'),'csc',_0xbaf9('0x67'));}break;case _0xbaf9('0x68'):if(_0x3e3d4c[_0xbaf9('0x5c')]){var _0x114abd={'method':'POST','uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x3e3d4c[_0xbaf9('0x5c')]},'body':{'content':_0x30fa1f[_0xbaf9('0xc')],'to':[_0x30fa1f[_0xbaf9('0x23')]],'from':_0x3e3d4c[_0xbaf9('0x23')],'binary':![],'clientMessageId':_0xbaf9('0x69'),'charset':'UTF-8'},'json':!![]};rp(_0x114abd)[_0xbaf9('0x17')](function(_0x34109b){if(!_0x34109b['error']){var _0x34e0cf={'messageId':_0x34109b[_0xbaf9('0x24')][0x0][_0xbaf9('0x6a')]};if(!_0x3e3d4c[_0xbaf9('0x3a')]){_0x34e0cf[_0xbaf9('0x3b')]=!![];}return _0x1356fb[_0xbaf9('0x3c')](_0x34e0cf);}else{return logger[_0xbaf9('0x1a')](_0xbaf9('0x2a'),_0xbaf9('0x3d'),_0xbaf9('0x68'),util[_0xbaf9('0x3e')](_0x34109b['error'],{'showHidden':![],'depth':null}));}})[_0xbaf9('0x19')](function(_0x47893d){return logger[_0xbaf9('0x1a')](_0xbaf9('0x2a'),_0xbaf9('0x3d'),'clickatell',util[_0xbaf9('0x3e')](_0x47893d,{'showHidden':![],'depth':null}));});}else{logger[_0xbaf9('0x1a')](_0xbaf9('0x2a'),_0xbaf9('0x3d'),_0xbaf9('0x68'),_0xbaf9('0x67'));}break;case'bandwidth':if(_0x3e3d4c[_0xbaf9('0x2e')]&&_0x3e3d4c[_0xbaf9('0x41')]){var _0x4a674f=util[_0xbaf9('0x44')](_0xbaf9('0x45'),_0x3e3d4c['username'],_0x3e3d4c['password']);var _0x3281cd={'method':_0xbaf9('0x35'),'uri':_0xbaf9('0x6b')+_0x3e3d4c[_0xbaf9('0x6c')]+_0xbaf9('0x6d'),'body':{'to':[_0x30fa1f[_0xbaf9('0x23')]],'text':_0x30fa1f[_0xbaf9('0xc')],'from':_0x3e3d4c[_0xbaf9('0x23')],'applicationId':_0x3e3d4c['applicationId']},'headers':{'Authorization':util[_0xbaf9('0x44')]('Basic\x20%s',new Buffer(_0x4a674f)[_0xbaf9('0x52')](_0xbaf9('0x48')))},'json':!![]};rp(_0x3281cd)['then'](function(_0x2a2853){if(_0x2a2853['id']){var _0x26623b={'messageId':_0x2a2853['id']};return _0x1356fb[_0xbaf9('0x3c')](_0x26623b);}else{logger[_0xbaf9('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbaf9('0x3d'),_0xbaf9('0x6e'),util[_0xbaf9('0x3e')](_0x2a2853,{'showHidden':![],'depth':null}));}})[_0xbaf9('0x19')](function(_0xfd13a9){logger[_0xbaf9('0x1a')](_0xbaf9('0x2a'),'afterCreate',_0xbaf9('0x6e'),util['inspect'](_0xfd13a9,{'showHidden':![],'depth':null}));});}else{logger[_0xbaf9('0x1a')](_0xbaf9('0x2a'),_0xbaf9('0x3d'),_0xbaf9('0x6e'),_0xbaf9('0x4f'));}break;case'intelepeer':if(_0x3e3d4c[_0xbaf9('0x5c')]){var _0x50a2d6={};var _0x4d8460={'method':_0xbaf9('0x35'),'uri':_0xbaf9('0x6f'),'headers':{'Authorization':_0xbaf9('0x70')+_0x3e3d4c[_0xbaf9('0x5c')],'Content-Type':'application/json'},'body':{'from':_0x3e3d4c['phone'],'to':_0x30fa1f[_0xbaf9('0x23')],'text':_0x30fa1f['body']},'json':!![]};return rp(_0x4d8460)[_0xbaf9('0x17')](function(_0x4b64dc){if(_0x4b64dc[_0xbaf9('0x71')]==0xca){_0x50a2d6[_0xbaf9('0x72')]=_0x4b64dc;var _0xa954ba={'method':'POST','uri':_0xbaf9('0x73'),'headers':{'Authorization':_0xbaf9('0x70')+_0x3e3d4c[_0xbaf9('0x5c')],'Content-Type':_0xbaf9('0x58')},'body':{'refid':_0x50a2d6['message']['refid']},'json':!![]};return rp(_0xa954ba)[_0xbaf9('0x17')](function(_0x13a7e7){_0x50a2d6[_0xbaf9('0x74')]=_0x13a7e7;var _0x276867={'messageId':_0x50a2d6[_0xbaf9('0x72')][_0xbaf9('0x75')],'read':!![]};return _0x1356fb[_0xbaf9('0x3c')](_0x276867);});}else{return logger[_0xbaf9('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbaf9('0x3d'),_0xbaf9('0x76'),util[_0xbaf9('0x3e')](_0x4b64dc,{'showHidden':![],'depth':null}));}})[_0xbaf9('0x19')](function(_0x550f3d){return logger[_0xbaf9('0x1a')](_0xbaf9('0x2a'),_0xbaf9('0x3d'),_0xbaf9('0x76'),util[_0xbaf9('0x3e')](_0x550f3d,{'showHidden':![],'depth':null}));});}else{return logger[_0xbaf9('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbaf9('0x3d'),_0xbaf9('0x76'),'Token\x20not\x20received');}break;}}})[_0xbaf9('0x77')](function(){_0x34c5da();});}else{_0x34c5da();}}},'charset':_0xbaf9('0x78'),'collate':_0xbaf9('0x79')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 2bf3d44..141731f 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 _0xff73=['localhost','socket.io-emitter','register','request','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','info','catch','CreateSmsMessage','SmsMessage','create','options','raw','then','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','http','defaults','redis'];(function(_0x35c221,_0x19b148){var _0x484c4a=function(_0x38032c){while(--_0x38032c){_0x35c221['push'](_0x35c221['shift']());}};_0x484c4a(++_0x19b148);}(_0xff73,0x15e));var _0x3ff7=function(_0x5b445b,_0xd251da){_0x5b445b=_0x5b445b-0x0;var _0x1a40fe=_0xff73[_0x5b445b];return _0x1a40fe;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3ff7('0x0'));var BPromise=require(_0x3ff7('0x1'));var rs=require(_0x3ff7('0x2'));var fs=require('fs');var Redis=require(_0x3ff7('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3ff7('0x4'));var config=require(_0x3ff7('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x3ff7('0x6')][_0x3ff7('0x7')]({'port':0x232a});config['redis']=_[_0x3ff7('0x8')](config[_0x3ff7('0x9')],{'host':_0x3ff7('0xa'),'port':0x18eb});var socket=require(_0x3ff7('0xb'))(new Redis(config[_0x3ff7('0x9')]));require('./smsMessage.socket')[_0x3ff7('0xc')](socket);function respondWithRpcPromise(_0x7fb30b,_0x567d9e,_0x19f52a){return new BPromise(function(_0x2f98c9,_0x130e34){return client[_0x3ff7('0xd')](_0x7fb30b,_0x19f52a)['then'](function(_0x2d613d){logger['info']('SmsMessage,\x20%s,\x20%s',_0x567d9e,_0x3ff7('0xe'));logger[_0x3ff7('0xf')](_0x3ff7('0x10'),_0x567d9e,_0x3ff7('0xe'),JSON[_0x3ff7('0x11')](_0x2d613d));if(_0x2d613d[_0x3ff7('0x12')]){if(_0x2d613d['error'][_0x3ff7('0x13')]===0x1f4){logger[_0x3ff7('0x12')](_0x3ff7('0x14'),_0x567d9e,_0x2d613d[_0x3ff7('0x12')][_0x3ff7('0x15')]);return _0x130e34(_0x2d613d[_0x3ff7('0x12')][_0x3ff7('0x15')]);}logger[_0x3ff7('0x12')](_0x3ff7('0x14'),_0x567d9e,_0x2d613d[_0x3ff7('0x12')]['message']);return _0x2f98c9(_0x2d613d[_0x3ff7('0x12')][_0x3ff7('0x15')]);}else{logger[_0x3ff7('0x16')](_0x3ff7('0x14'),_0x567d9e,_0x3ff7('0xe'));_0x2f98c9(_0x2d613d['result']['message']);}})[_0x3ff7('0x17')](function(_0x1ccc1d){logger['error']('SmsMessage,\x20%s,\x20%s',_0x567d9e,_0x1ccc1d);_0x130e34(_0x1ccc1d);});});}exports[_0x3ff7('0x18')]=function(_0x14ace8){var _0x10170d=this;return new Promise(function(_0xfec504,_0x221cd7){return db[_0x3ff7('0x19')][_0x3ff7('0x1a')](_0x14ace8['body'],{'raw':_0x14ace8[_0x3ff7('0x1b')]?_0x14ace8[_0x3ff7('0x1b')][_0x3ff7('0x1c')]===undefined?!![]:![]:!![]})[_0x3ff7('0x1d')](function(_0x5efee6){logger[_0x3ff7('0x16')](_0x3ff7('0x18'),_0x14ace8);logger[_0x3ff7('0xf')](_0x3ff7('0x18'),_0x14ace8,JSON[_0x3ff7('0x11')](_0x5efee6));_0xfec504(_0x5efee6);})['catch'](function(_0x218521){logger[_0x3ff7('0x12')](_0x3ff7('0x18'),_0x218521[_0x3ff7('0x15')],_0x14ace8);_0x221cd7(_0x10170d[_0x3ff7('0x12')](0x1f4,_0x218521[_0x3ff7('0x15')]));});});}; \ No newline at end of file +var _0x4c15=['socket.io-emitter','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateSmsMessage','body','options','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','redis'];(function(_0x4cd125,_0xf61237){var _0x33358a=function(_0x40ba76){while(--_0x40ba76){_0x4cd125['push'](_0x4cd125['shift']());}};_0x33358a(++_0xf61237);}(_0x4c15,0x103));var _0x54c1=function(_0x5c5381,_0x428f55){_0x5c5381=_0x5c5381-0x0;var _0x45f881=_0x4c15[_0x5c5381];return _0x45f881;};'use strict';var _=require(_0x54c1('0x0'));var util=require(_0x54c1('0x1'));var moment=require(_0x54c1('0x2'));var BPromise=require('bluebird');var rs=require(_0x54c1('0x3'));var fs=require('fs');var Redis=require(_0x54c1('0x4'));var db=require(_0x54c1('0x5'))['db'];var utils=require(_0x54c1('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x54c1('0x7'));var client=jayson[_0x54c1('0x8')][_0x54c1('0x9')]({'port':0x232a});config[_0x54c1('0xa')]=_['defaults'](config[_0x54c1('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x54c1('0xb'))(new Redis(config[_0x54c1('0xa')]));require('./smsMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2721db,_0x33a7dd,_0x27c4a2){return new BPromise(function(_0x25353f,_0x1ae69e){return client[_0x54c1('0xc')](_0x2721db,_0x27c4a2)[_0x54c1('0xd')](function(_0x32f326){logger['info'](_0x54c1('0xe'),_0x33a7dd,_0x54c1('0xf'));logger[_0x54c1('0x10')](_0x54c1('0x11'),_0x33a7dd,'request\x20sent',JSON[_0x54c1('0x12')](_0x32f326));if(_0x32f326[_0x54c1('0x13')]){if(_0x32f326['error'][_0x54c1('0x14')]===0x1f4){logger['error'](_0x54c1('0xe'),_0x33a7dd,_0x32f326['error']['message']);return _0x1ae69e(_0x32f326[_0x54c1('0x13')][_0x54c1('0x15')]);}logger[_0x54c1('0x13')](_0x54c1('0xe'),_0x33a7dd,_0x32f326['error']['message']);return _0x25353f(_0x32f326['error'][_0x54c1('0x15')]);}else{logger[_0x54c1('0x16')](_0x54c1('0xe'),_0x33a7dd,_0x54c1('0xf'));_0x25353f(_0x32f326['result'][_0x54c1('0x15')]);}})[_0x54c1('0x17')](function(_0x4b049a){logger['error'](_0x54c1('0xe'),_0x33a7dd,_0x4b049a);_0x1ae69e(_0x4b049a);});});}exports[_0x54c1('0x18')]=function(_0x1a1446){var _0x575f3c=this;return new Promise(function(_0x3e7700,_0x4849b6){return db['SmsMessage']['create'](_0x1a1446[_0x54c1('0x19')],{'raw':_0x1a1446[_0x54c1('0x1a')]?_0x1a1446[_0x54c1('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x7d81c9){logger[_0x54c1('0x16')]('CreateSmsMessage',_0x1a1446);logger[_0x54c1('0x10')](_0x54c1('0x18'),_0x1a1446,JSON[_0x54c1('0x12')](_0x7d81c9));_0x3e7700(_0x7d81c9);})[_0x54c1('0x17')](function(_0x25b834){logger[_0x54c1('0x13')]('CreateSmsMessage',_0x25b834[_0x54c1('0x15')],_0x1a1446);_0x4849b6(_0x575f3c[_0x54c1('0x13')](0x1f4,_0x25b834[_0x54c1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 909c87e..8e03f94 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 _0xefc4=['register','length','smsMessage:','./smsMessage.events','save','remove','emit','removeListener'];(function(_0x1c1d24,_0x28c7ad){var _0x3161f5=function(_0xfe030b){while(--_0xfe030b){_0x1c1d24['push'](_0x1c1d24['shift']());}};_0x3161f5(++_0x28c7ad);}(_0xefc4,0x123));var _0x4efc=function(_0x441563,_0x1d4a28){_0x441563=_0x441563-0x0;var _0x2369ec=_0xefc4[_0x441563];return _0x2369ec;};'use strict';var SmsMessageEvents=require(_0x4efc('0x0'));var events=[_0x4efc('0x1'),_0x4efc('0x2'),'update'];function createListener(_0x51331c,_0x56fd89){return function(_0x459ab9){_0x56fd89[_0x4efc('0x3')](_0x51331c,_0x459ab9);};}function removeListener(_0x2cfcd8,_0x112a61){return function(){SmsMessageEvents[_0x4efc('0x4')](_0x2cfcd8,_0x112a61);};}exports[_0x4efc('0x5')]=function(_0x2b5d0c){for(var _0xd03078=0x0,_0x4d23dd=events[_0x4efc('0x6')];_0xd03078<_0x4d23dd;_0xd03078++){var _0x2bbbab=events[_0xd03078];var _0x1d067d=createListener(_0x4efc('0x7')+_0x2bbbab,_0x2b5d0c);SmsMessageEvents['on'](_0x2bbbab,_0x1d067d);}}; \ No newline at end of file +var _0x938b=['emit','removeListener','register','length','smsMessage:','./smsMessage.events','remove','update'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x938b,0x1bd));var _0xb938=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x938b[_0x3dd15e];return _0x231fd0;};'use strict';var SmsMessageEvents=require(_0xb938('0x0'));var events=['save',_0xb938('0x1'),_0xb938('0x2')];function createListener(_0x37ee5d,_0x424115){return function(_0x258634){_0x424115[_0xb938('0x3')](_0x37ee5d,_0x258634);};}function removeListener(_0xb687bc,_0xb2bdd){return function(){SmsMessageEvents[_0xb938('0x4')](_0xb687bc,_0xb2bdd);};}exports[_0xb938('0x5')]=function(_0x18e969){for(var _0x299afa=0x0,_0x1b8fb9=events[_0xb938('0x6')];_0x299afa<_0x1b8fb9;_0x299afa++){var _0x47a158=events[_0x299afa];var _0x41c411=createListener(_0xb938('0x7')+_0x47a158,_0x18e969);SmsMessageEvents['on'](_0x47a158,_0x41c411);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 343af1c..e4d5098 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 _0xe8dd=['express','Router','fs-extra','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0xf312f7,_0x41edc7){var _0x297f67=function(_0x3f0274){while(--_0x3f0274){_0xf312f7['push'](_0xf312f7['shift']());}};_0x297f67(++_0x41edc7);}(_0xe8dd,0x1e9));var _0xde8d=function(_0x4fe095,_0x182acb){_0x4fe095=_0x4fe095-0x0;var _0x6ceac4=_0xe8dd[_0x4fe095];return _0x6ceac4;};'use strict';var multer=require(_0xde8d('0x0'));var util=require(_0xde8d('0x1'));var path=require(_0xde8d('0x2'));var timeout=require(_0xde8d('0x3'));var express=require(_0xde8d('0x4'));var router=express[_0xde8d('0x5')]();var fs_extra=require(_0xde8d('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xde8d('0x7'));var controller=require('./smsQueue.controller');router[_0xde8d('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xde8d('0x8')](_0xde8d('0x9'),auth[_0xde8d('0xa')](),controller[_0xde8d('0xb')]);router['get'](_0xde8d('0xc'),auth['isAuthenticated'](),controller[_0xde8d('0xd')]);router[_0xde8d('0x8')](_0xde8d('0xe'),auth[_0xde8d('0xa')](),controller[_0xde8d('0xf')]);router[_0xde8d('0x8')](_0xde8d('0x10'),auth['isAuthenticated'](),controller[_0xde8d('0x11')]);router[_0xde8d('0x8')](_0xde8d('0x12'),auth[_0xde8d('0xa')](),controller[_0xde8d('0x13')]);router[_0xde8d('0x14')]('/',auth[_0xde8d('0xa')](),controller['create']);router[_0xde8d('0x14')](_0xde8d('0x10'),auth[_0xde8d('0xa')](),controller[_0xde8d('0x15')]);router[_0xde8d('0x14')]('/:id/users',auth['isAuthenticated'](),controller[_0xde8d('0x16')]);router[_0xde8d('0x17')](_0xde8d('0xc'),auth[_0xde8d('0xa')](),controller[_0xde8d('0x18')]);router[_0xde8d('0x19')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xde8d('0x19')](_0xde8d('0x10'),auth[_0xde8d('0xa')](),controller[_0xde8d('0x1a')]);router[_0xde8d('0x19')](_0xde8d('0x12'),auth['isAuthenticated'](),controller[_0xde8d('0x1b')]);module[_0xde8d('0x1c')]=router; \ No newline at end of file +var _0x7560=['/:id/users','put','/:id','destroy','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','describe','show','/:id/members','/:id/teams','getTeams','getAgents','post','create'];(function(_0x5ba95d,_0x55090b){var _0x14949b=function(_0x569a13){while(--_0x569a13){_0x5ba95d['push'](_0x5ba95d['shift']());}};_0x14949b(++_0x55090b);}(_0x7560,0x18c));var _0x0756=function(_0x5b7d6a,_0x63e6a2){_0x5b7d6a=_0x5b7d6a-0x0;var _0x992adf=_0x7560[_0x5b7d6a];return _0x992adf;};'use strict';var multer=require(_0x0756('0x0'));var util=require(_0x0756('0x1'));var path=require(_0x0756('0x2'));var timeout=require(_0x0756('0x3'));var express=require('express');var router=express[_0x0756('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0756('0x5'));var interaction=require(_0x0756('0x6'));var config=require(_0x0756('0x7'));var controller=require(_0x0756('0x8'));router[_0x0756('0x9')]('/',auth[_0x0756('0xa')](),controller[_0x0756('0xb')]);router[_0x0756('0x9')]('/describe',auth[_0x0756('0xa')](),controller[_0x0756('0xc')]);router[_0x0756('0x9')]('/:id',auth[_0x0756('0xa')](),controller[_0x0756('0xd')]);router['get'](_0x0756('0xe'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0x0756('0xf'),auth[_0x0756('0xa')](),controller[_0x0756('0x10')]);router[_0x0756('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x0756('0x11')]);router[_0x0756('0x12')]('/',auth[_0x0756('0xa')](),controller[_0x0756('0x13')]);router['post']('/:id/teams',auth[_0x0756('0xa')](),controller['addTeams']);router[_0x0756('0x12')](_0x0756('0x14'),auth[_0x0756('0xa')](),controller['addAgents']);router[_0x0756('0x15')](_0x0756('0x16'),auth[_0x0756('0xa')](),controller['update']);router['delete'](_0x0756('0x16'),auth[_0x0756('0xa')](),controller[_0x0756('0x17')]);router[_0x0756('0x18')](_0x0756('0xf'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x0756('0x18')]('/:id/users',auth[_0x0756('0xa')](),controller['removeAgents']);module[_0x0756('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 bfb1037..de07704 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 _0xca87=['rrmemory','beepall','roundrobin','exports','name','INTEGER','ENUM'];(function(_0x1610eb,_0x481da3){var _0x2bd7d2=function(_0x29ae44){while(--_0x29ae44){_0x1610eb['push'](_0x1610eb['shift']());}};_0x2bd7d2(++_0x481da3);}(_0xca87,0x14c));var _0x7ca8=function(_0x2e7944,_0x549797){_0x2e7944=_0x2e7944-0x0;var _0x1305c2=_0xca87[_0x2e7944];return _0x1305c2;};'use strict';var Sequelize=require('sequelize');module[_0x7ca8('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x7ca8('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x7ca8('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7ca8('0x3')](_0x7ca8('0x4'),_0x7ca8('0x5'),_0x7ca8('0x6'))}}; \ No newline at end of file +var _0x753e=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x3df897,_0x3b1a8c){var _0x43ebf3=function(_0x591289){while(--_0x591289){_0x3df897['push'](_0x3df897['shift']());}};_0x43ebf3(++_0x3b1a8c);}(_0x753e,0x19b));var _0xe753=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x753e[_0xefd519];return _0x4bb882;};'use strict';var Sequelize=require(_0xe753('0x0'));module[_0xe753('0x1')]={'name':{'type':Sequelize[_0xe753('0x2')],'unique':_0xe753('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe753('0x2')]},'timeout':{'type':Sequelize[_0xe753('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe753('0x5')](_0xe753('0x6'),_0xe753('0x7'),_0xe753('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 21b4e9d..647b02b 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 _0x4295=['UserId','smsPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','User','voicePause','interface','Agents','sequelize','transaction','each','userSmsQueue:save','removeTeams','ids','select','tq.TeamId','from','team_has_sms_queues','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','forEach','emit','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','SmsQueues','UserProfileResource','destroy','then','error','name','send','rawAttributes','fieldName','key','model','map','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','SmsQueue','count','include','findAll','catch','show','params','intersection','find','create','body','get','role','user','userProfileId','autoAssociation','update','describe','findOne','UserSmsQueue','SmsQueueId','findAndCountAll'];(function(_0xee7ee7,_0x2b9817){var _0x56a7c4=function(_0x4ce58a){while(--_0x4ce58a){_0xee7ee7['push'](_0xee7ee7['shift']());}};_0x56a7c4(++_0x2b9817);}(_0x4295,0x147));var _0x5429=function(_0x3b87f4,_0x112243){_0x3b87f4=_0x3b87f4-0x0;var _0x63d16e=_0x4295[_0x3b87f4];return _0x63d16e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5429('0x0'));var zipdir=require(_0x5429('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5429('0x2'));var moment=require(_0x5429('0x3'));var BPromise=require(_0x5429('0x4'));var Mustache=require(_0x5429('0x5'));var util=require(_0x5429('0x6'));var path=require('path');var sox=require(_0x5429('0x7'));var csv=require(_0x5429('0x8'));var ejs=require(_0x5429('0x9'));var fs=require('fs');var fs_extra=require(_0x5429('0xa'));var _=require(_0x5429('0xb'));var squel=require(_0x5429('0xc'));var crypto=require(_0x5429('0xd'));var jsforce=require(_0x5429('0xe'));var deskjs=require(_0x5429('0xf'));var toCsv=require(_0x5429('0x8'));var querystring=require('querystring');var Papa=require(_0x5429('0x10'));var Redis=require(_0x5429('0x11'));var authService=require(_0x5429('0x12'));var qs=require(_0x5429('0x13'));var as=require(_0x5429('0x14'));var hardwareService=require(_0x5429('0x15'));var logger=require('../../config/logger')(_0x5429('0x16'));var utils=require(_0x5429('0x17'));var config=require(_0x5429('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5429('0x19'))['db'];config[_0x5429('0x1a')]=_[_0x5429('0x1b')](config['redis'],{'host':_0x5429('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5429('0x1a')]));require(_0x5429('0x1d'))[_0x5429('0x1e')](socket);function respondWithStatusCode(_0x2f621c,_0xa00327){_0xa00327=_0xa00327||0xcc;return function(_0x26fd06){if(_0x26fd06){return _0x2f621c[_0x5429('0x1f')](_0xa00327);}return _0x2f621c[_0x5429('0x20')](_0xa00327)[_0x5429('0x21')]();};}function respondWithResult(_0x28ccf5,_0x240f6d){_0x240f6d=_0x240f6d||0xc8;return function(_0x23eb53){if(_0x23eb53){return _0x28ccf5[_0x5429('0x20')](_0x240f6d)[_0x5429('0x22')](_0x23eb53);}};}function respondWithFilteredResult(_0x56fc5f,_0x5a2a85){return function(_0x2604ea){if(_0x2604ea){var _0x2fac03=typeof _0x5a2a85[_0x5429('0x23')]===_0x5429('0x24')&&typeof _0x5a2a85[_0x5429('0x25')]==='undefined';var _0x6d9750=_0x2604ea['count'];var _0x4c1733=_0x2fac03?0x0:_0x5a2a85[_0x5429('0x23')];var _0x53c310=_0x2fac03?_0x2604ea['count']:_0x5a2a85[_0x5429('0x23')]+_0x5a2a85[_0x5429('0x25')];var _0x74341c;if(_0x53c310>=_0x6d9750){_0x53c310=_0x6d9750;_0x74341c=0xc8;}else{_0x74341c=0xce;}_0x56fc5f['status'](_0x74341c);return _0x56fc5f[_0x5429('0x26')]('Content-Range',_0x4c1733+'-'+_0x53c310+'/'+_0x6d9750)[_0x5429('0x22')](_0x2604ea);}return null;};}function patchUpdates(_0x31c8dc){return function(_0x3d46ff){try{jsonpatch[_0x5429('0x27')](_0x3d46ff,_0x31c8dc,!![]);}catch(_0x244713){return BPromise[_0x5429('0x28')](_0x244713);}return _0x3d46ff[_0x5429('0x29')]();};}function saveUpdates(_0x3e656c,_0x4e9d51){return function(_0x5358b1){if(_0x5358b1){return _0x5358b1['update'](_0x3e656c)['then'](function(_0x4ce40d){return _0x4ce40d;});}return null;};}function removeEntity(_0x2200a6,_0x17f9a7){return function(_0x21edb7){if(_0x21edb7){return _0x21edb7['destroy']()['then'](function(){var _0x4a2f41=_0x21edb7['get']({'plain':!![]});var _0x2282d4=_0x5429('0x2a');return db[_0x5429('0x2b')][_0x5429('0x2c')]({'where':{'type':_0x2282d4,'resourceId':_0x4a2f41['id']}})[_0x5429('0x2d')](function(){return _0x21edb7;});})[_0x5429('0x2d')](function(){_0x2200a6[_0x5429('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13efa8,_0x5ee24b){return function(_0x165cdb){if(!_0x165cdb){_0x13efa8[_0x5429('0x1f')](0x194);}return _0x165cdb;};}function handleError(_0x308e2c,_0x23cad7){_0x23cad7=_0x23cad7||0x1f4;return function(_0x1bbe27){logger[_0x5429('0x2e')](_0x1bbe27['stack']);if(_0x1bbe27['name']){delete _0x1bbe27[_0x5429('0x2f')];}_0x308e2c[_0x5429('0x20')](_0x23cad7)[_0x5429('0x30')](_0x1bbe27);};}exports['index']=function(_0x6981ea,_0x35c19e){var _0x53cea8={},_0x4c7363={},_0x2f10d3={'count':0x0,'rows':[]};var _0x181b51=_['map'](db['SmsQueue'][_0x5429('0x31')],function(_0x50dbc6){return{'name':_0x50dbc6[_0x5429('0x32')],'type':_0x50dbc6['type'][_0x5429('0x33')]};});_0x4c7363[_0x5429('0x34')]=_[_0x5429('0x35')](_0x181b51,_0x5429('0x2f'));_0x4c7363['query']=_[_0x5429('0x36')](_0x6981ea[_0x5429('0x37')]);_0x4c7363[_0x5429('0x38')]=_['intersection'](_0x4c7363[_0x5429('0x34')],_0x4c7363[_0x5429('0x37')]);_0x53cea8['attributes']=_['intersection'](_0x4c7363[_0x5429('0x34')],qs[_0x5429('0x39')](_0x6981ea[_0x5429('0x37')][_0x5429('0x39')]));_0x53cea8[_0x5429('0x3a')]=_0x53cea8[_0x5429('0x3a')][_0x5429('0x3b')]?_0x53cea8[_0x5429('0x3a')]:_0x4c7363['model'];if(!_0x6981ea[_0x5429('0x37')][_0x5429('0x3c')](_0x5429('0x3d'))){_0x53cea8[_0x5429('0x25')]=qs[_0x5429('0x25')](_0x6981ea['query'][_0x5429('0x25')]);_0x53cea8['offset']=qs[_0x5429('0x23')](_0x6981ea[_0x5429('0x37')]['offset']);}_0x53cea8[_0x5429('0x3e')]=qs['sort'](_0x6981ea[_0x5429('0x37')][_0x5429('0x3f')]);_0x53cea8['where']=qs['filters'](_[_0x5429('0x40')](_0x6981ea['query'],_0x4c7363[_0x5429('0x38')]),_0x181b51);if(_0x6981ea[_0x5429('0x37')][_0x5429('0x41')]){_0x53cea8[_0x5429('0x42')]=_['merge'](_0x53cea8[_0x5429('0x42')],{'$or':_[_0x5429('0x35')](_0x181b51,function(_0x5c2f4d){if(_0x5c2f4d[_0x5429('0x43')]!==_0x5429('0x44')){var _0x50883f={};_0x50883f[_0x5c2f4d[_0x5429('0x2f')]]={'$like':'%'+_0x6981ea[_0x5429('0x37')][_0x5429('0x41')]+'%'};return _0x50883f;}})});}_0x53cea8=_[_0x5429('0x45')]({},_0x53cea8,_0x6981ea[_0x5429('0x46')]);var _0x5ac8ef={'where':_0x53cea8[_0x5429('0x42')]};return db[_0x5429('0x47')][_0x5429('0x48')](_0x5ac8ef)[_0x5429('0x2d')](function(_0x5ec14f){_0x2f10d3['count']=_0x5ec14f;if(_0x6981ea[_0x5429('0x37')]['includeAll']){_0x53cea8[_0x5429('0x49')]=[{'all':!![]}];}return db['SmsQueue'][_0x5429('0x4a')](_0x53cea8);})[_0x5429('0x2d')](function(_0xf12e6b){_0x2f10d3['rows']=_0xf12e6b;return _0x2f10d3;})[_0x5429('0x2d')](respondWithFilteredResult(_0x35c19e,_0x53cea8))[_0x5429('0x4b')](handleError(_0x35c19e,null));};exports[_0x5429('0x4c')]=function(_0x5d6dce,_0x21c64f){var _0x45289e={'raw':!![],'where':{'id':_0x5d6dce[_0x5429('0x4d')]['id']}},_0x4769df={};_0x4769df[_0x5429('0x34')]=_[_0x5429('0x36')](db[_0x5429('0x47')][_0x5429('0x31')]);_0x4769df[_0x5429('0x37')]=_[_0x5429('0x36')](_0x5d6dce[_0x5429('0x37')]);_0x4769df[_0x5429('0x38')]=_[_0x5429('0x4e')](_0x4769df['model'],_0x4769df['query']);_0x45289e['attributes']=_[_0x5429('0x4e')](_0x4769df[_0x5429('0x34')],qs[_0x5429('0x39')](_0x5d6dce[_0x5429('0x37')][_0x5429('0x39')]));_0x45289e[_0x5429('0x3a')]=_0x45289e[_0x5429('0x3a')][_0x5429('0x3b')]?_0x45289e[_0x5429('0x3a')]:_0x4769df[_0x5429('0x34')];if(_0x5d6dce['query']['includeAll']){_0x45289e[_0x5429('0x49')]=[{'all':!![]}];}_0x45289e=_[_0x5429('0x45')]({},_0x45289e,_0x5d6dce[_0x5429('0x46')]);return db[_0x5429('0x47')][_0x5429('0x4f')](_0x45289e)[_0x5429('0x2d')](handleEntityNotFound(_0x21c64f,null))[_0x5429('0x2d')](respondWithResult(_0x21c64f,null))[_0x5429('0x4b')](handleError(_0x21c64f,null));};exports['create']=function(_0x4eead3,_0x28429f){return db[_0x5429('0x47')][_0x5429('0x50')](_0x4eead3[_0x5429('0x51')],{})[_0x5429('0x2d')](function(_0x7254a){var _0x129b2a=_0x4eead3['user'][_0x5429('0x52')]({'plain':!![]});if(!_0x129b2a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x129b2a[_0x5429('0x53')]===_0x5429('0x54')){var _0x3404bd=_0x7254a['get']({'plain':!![]});var _0x59d84f=_0x5429('0x2a');return db['UserProfileSection'][_0x5429('0x4f')]({'where':{'name':_0x59d84f,'userProfileId':_0x129b2a[_0x5429('0x55')]},'raw':!![]})[_0x5429('0x2d')](function(_0x293993){if(_0x293993&&_0x293993[_0x5429('0x56')]===0x0){return db['UserProfileResource'][_0x5429('0x50')]({'name':_0x3404bd[_0x5429('0x2f')],'resourceId':_0x3404bd['id'],'type':_0x293993[_0x5429('0x2f')],'sectionId':_0x293993['id']},{})[_0x5429('0x2d')](function(){return _0x7254a;});}else{return _0x7254a;}})[_0x5429('0x4b')](function(_0x54ad43){logger[_0x5429('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54ad43);throw _0x54ad43;});}return _0x7254a;})[_0x5429('0x2d')](respondWithResult(_0x28429f,0xc9))[_0x5429('0x4b')](handleError(_0x28429f,null));};exports[_0x5429('0x57')]=function(_0x151f64,_0x527312){if(_0x151f64[_0x5429('0x51')]['id']){delete _0x151f64[_0x5429('0x51')]['id'];}return db[_0x5429('0x47')]['find']({'where':{'id':_0x151f64[_0x5429('0x4d')]['id']}})[_0x5429('0x2d')](handleEntityNotFound(_0x527312,null))[_0x5429('0x2d')](saveUpdates(_0x151f64[_0x5429('0x51')],null))['then'](respondWithResult(_0x527312,null))[_0x5429('0x4b')](handleError(_0x527312,null));};exports['destroy']=function(_0x18fc87,_0x2068b4){return db[_0x5429('0x47')][_0x5429('0x4f')]({'where':{'id':_0x18fc87[_0x5429('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2068b4,null))[_0x5429('0x2d')](removeEntity(_0x2068b4,null))[_0x5429('0x4b')](handleError(_0x2068b4,null));};exports[_0x5429('0x58')]=function(_0x4436bc,_0x442eb3){return db[_0x5429('0x47')]['describe']()['then'](respondWithResult(_0x442eb3,null))['catch'](handleError(_0x442eb3,null));};exports['getMembers']=function(_0x4b901f,_0x40636f,_0x2c0339){var _0x337cb9={'raw':!![],'where':{}},_0x387e34={},_0x414b75;return db['SmsQueue'][_0x5429('0x59')]({'where':{'id':_0x4b901f[_0x5429('0x4d')]['id']}})[_0x5429('0x2d')](handleEntityNotFound(_0x40636f,null))[_0x5429('0x2d')](function(_0x27d6f7){if(_0x27d6f7){_0x414b75=_0x27d6f7[_0x5429('0x52')]({'plain':!![]});_0x387e34[_0x5429('0x34')]=_['keys'](db[_0x5429('0x5a')][_0x5429('0x31')]);_0x387e34['query']=_[_0x5429('0x36')](_0x4b901f[_0x5429('0x37')]);_0x387e34[_0x5429('0x38')]=_[_0x5429('0x4e')](_0x387e34['model'],_0x387e34['query']);_0x337cb9['attributes']=_[_0x5429('0x4e')](_0x387e34[_0x5429('0x34')],qs[_0x5429('0x39')](_0x4b901f[_0x5429('0x37')][_0x5429('0x39')]));_0x337cb9[_0x5429('0x3a')]=_0x337cb9[_0x5429('0x3a')][_0x5429('0x3b')]?_0x337cb9[_0x5429('0x3a')]:_0x387e34['model'];if(!_0x4b901f['query'][_0x5429('0x3c')](_0x5429('0x3d'))){_0x337cb9[_0x5429('0x25')]=qs['limit'](_0x4b901f[_0x5429('0x37')][_0x5429('0x25')]);_0x337cb9[_0x5429('0x23')]=qs['offset'](_0x4b901f['query']['offset']);}_0x337cb9[_0x5429('0x3e')]=qs['sort'](_0x4b901f['query']['sort']);_0x337cb9[_0x5429('0x42')]=qs[_0x5429('0x38')](_[_0x5429('0x40')](_0x4b901f['query'],_0x387e34[_0x5429('0x38')]));_0x337cb9['where'][_0x5429('0x5b')]=_0x27d6f7['id'];if(_0x4b901f['query']['filter']){_0x337cb9[_0x5429('0x42')]=_[_0x5429('0x45')](_0x337cb9[_0x5429('0x42')],{'$or':_[_0x5429('0x35')](_0x337cb9[_0x5429('0x3a')],function(_0x37ac82){var _0x2c7ac9={};_0x2c7ac9[_0x37ac82]={'$like':'%'+_0x4b901f[_0x5429('0x37')][_0x5429('0x41')]+'%'};return _0x2c7ac9;})});}_0x337cb9=_[_0x5429('0x45')]({},_0x337cb9,_0x4b901f['options']);return db[_0x5429('0x5a')][_0x5429('0x4a')](_0x337cb9);}})[_0x5429('0x2d')](function(_0x393695){if(_0x393695){return db['User'][_0x5429('0x5c')]({'where':{'id':_['map'](_0x393695,_0x5429('0x5d')),'role':'agent'},'attributes':['id',_0x5429('0x2f'),_0x5429('0x5e'),_0x5429('0x5f'),'createdAt']});}})[_0x5429('0x2d')](function(_0x25a497){if(_0x25a497){return{'count':_0x25a497['count'],'rows':_[_0x5429('0x35')](_0x25a497['rows'],function(_0xb6498c){return{'membername':_0xb6498c[_0x5429('0x2f')],'UserId':_0xb6498c['id'],'queue_name':_0x414b75[_0x5429('0x2f')],'SmsQueueId':_0x414b75['id'],'interface':util[_0x5429('0x60')](_0x5429('0x61'),_0x5429('0x62'),_0xb6498c[_0x5429('0x2f')]),'penalty':0x0,'paused':_0xb6498c[_0x5429('0x5e')],'createdAt':_0xb6498c[_0x5429('0x63')],'updatedAt':_0xb6498c[_0x5429('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5429('0x2d')](respondWithFilteredResult(_0x40636f,_0x337cb9))['catch'](handleError(_0x40636f,null));};exports[_0x5429('0x64')]=function(_0x1f649b,_0x4af7db,_0x471cec){var _0x2c215b={};var _0xc26c19={};var _0x4fa86a;var _0x1377ea;return db[_0x5429('0x47')][_0x5429('0x59')]({'where':{'id':_0x1f649b[_0x5429('0x4d')]['id']}})[_0x5429('0x2d')](handleEntityNotFound(_0x4af7db,null))[_0x5429('0x2d')](function(_0x3f5309){if(_0x3f5309){_0x4fa86a=_0x3f5309;_0xc26c19[_0x5429('0x34')]=_[_0x5429('0x36')](db[_0x5429('0x65')][_0x5429('0x31')]);_0xc26c19['query']=_['keys'](_0x1f649b[_0x5429('0x37')]);_0xc26c19[_0x5429('0x38')]=_[_0x5429('0x4e')](_0xc26c19[_0x5429('0x34')],_0xc26c19['query']);_0x2c215b['attributes']=_[_0x5429('0x4e')](_0xc26c19[_0x5429('0x34')],qs['fields'](_0x1f649b[_0x5429('0x37')][_0x5429('0x39')]));_0x2c215b[_0x5429('0x3a')]=_0x2c215b[_0x5429('0x3a')][_0x5429('0x3b')]?_0x2c215b[_0x5429('0x3a')]:_0xc26c19[_0x5429('0x34')];_0x2c215b['order']=qs[_0x5429('0x3f')](_0x1f649b[_0x5429('0x37')][_0x5429('0x3f')]);_0x2c215b[_0x5429('0x42')]=qs[_0x5429('0x38')](_[_0x5429('0x40')](_0x1f649b[_0x5429('0x37')],_0xc26c19[_0x5429('0x38')]));if(_0x1f649b['query']['filter']){_0x2c215b[_0x5429('0x42')]=_[_0x5429('0x45')](_0x2c215b[_0x5429('0x42')],{'$or':_['map'](_0x2c215b[_0x5429('0x3a')],function(_0x1b54da){var _0x365e3d={};_0x365e3d[_0x1b54da]={'$like':'%'+_0x1f649b[_0x5429('0x37')]['filter']+'%'};return _0x365e3d;})});}_0x2c215b=_[_0x5429('0x45')]({},_0x2c215b,_0x1f649b[_0x5429('0x46')]);return _0x4fa86a[_0x5429('0x64')](_0x2c215b);}})['then'](function(_0xa56cc4){if(_0xa56cc4){_0x1377ea=_0xa56cc4[_0x5429('0x3b')];if(!_0x1f649b[_0x5429('0x37')][_0x5429('0x3c')](_0x5429('0x3d'))){_0x2c215b['limit']=qs[_0x5429('0x25')](_0x1f649b[_0x5429('0x37')][_0x5429('0x25')]);_0x2c215b[_0x5429('0x23')]=qs[_0x5429('0x23')](_0x1f649b[_0x5429('0x37')][_0x5429('0x23')]);}return _0x4fa86a['getTeams'](_0x2c215b);}})[_0x5429('0x2d')](function(_0x276b75){if(_0x276b75){return _0x276b75?{'count':_0x1377ea,'rows':_0x276b75}:null;}})['then'](respondWithResult(_0x4af7db,null))[_0x5429('0x4b')](handleError(_0x4af7db,null));};exports[_0x5429('0x66')]=function(_0xe72679,_0x4e604a,_0x400ec4){var _0x401626=_0xe72679[_0x5429('0x51')]['ids'];return db['Team']['findAll']({'where':{'id':_0x401626},'attributes':['id'],'include':[{'model':db[_0x5429('0x67')],'as':'Agents','attributes':['id',_0x5429('0x2f'),'online',_0x5429('0x68'),_0x5429('0x69')],'raw':!![]}]})['then'](function(_0x5950cf){if(_0x5950cf){var _0x916640=_['flatMap'](_0x5950cf,function(_0x2dd195){var _0x1e7ed3=_0x2dd195[_0x5429('0x52')]({'plain':!![]});return _0x1e7ed3[_0x5429('0x6a')];});return db['SmsQueue'][_0x5429('0x4f')]({'where':{'id':_0xe72679['params']['id']}})['then'](function(_0x1d777c){return db[_0x5429('0x6b')][_0x5429('0x6c')](function(_0x22a762){return _0x1d777c[_0x5429('0x66')](_0x401626,{'transaction':_0x22a762})[_0x5429('0x2d')](function(){return BPromise[_0x5429('0x6d')](_0x916640,function(_0x299514){return db[_0x5429('0x5a')]['findOrCreate']({'where':{'UserId':_0x299514['id'],'SmsQueueId':_0xe72679[_0x5429('0x4d')]['id']},'transaction':_0x22a762});});})[_0x5429('0x2d')](function(){_0x916640['forEach'](function(_0x50f8b0){socket['emit'](_0x5429('0x6e'),{'UserId':_0x50f8b0['id'],'SmsQueueId':_0x1d777c['id']});});});});});}})[_0x5429('0x2d')](respondWithStatusCode(_0x4e604a,null))[_0x5429('0x4b')](handleError(_0x4e604a,null));};exports[_0x5429('0x6f')]=function(_0x2417ba,_0x23faa0,_0x2db154){return db['Team']['findAll']({'where':{'id':_0x2417ba[_0x5429('0x37')][_0x5429('0x70')]},'attributes':['id'],'include':[{'model':db[_0x5429('0x67')],'as':_0x5429('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x5429('0x2d')](handleEntityNotFound(_0x23faa0,null))[_0x5429('0x2d')](function(_0x55e8fc){var _0x514b83=_[_0x5429('0x35')](_0x55e8fc,'id');var _0x4ff269=[];var _0x51f9c8=[];var _0xd44647=squel[_0x5429('0x71')]();_0xd44647['field'](_0x5429('0x72'))[_0x5429('0x73')](_0x5429('0x74'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x5429('0x42')](_0x5429('0x75'),_0x2417ba[_0x5429('0x4d')]['id']);for(var _0x28a46f=0x0;_0x28a46f<_0x55e8fc[_0x5429('0x3b')];_0x28a46f+=0x1){let _0x488179=_0x55e8fc[_0x28a46f];for(var _0x423871=0x0;_0x423871<_0x488179[_0x5429('0x6a')][_0x5429('0x3b')];_0x423871+=0x1){let _0x42a199=_0x488179[_0x5429('0x6a')][_0x423871];var _0x430ca3=_0xd44647[_0x5429('0x76')]();_0x430ca3[_0x5429('0x42')](_0x5429('0x77'),_0x42a199['id']);_0x51f9c8['push'](db[_0x5429('0x6b')][_0x5429('0x37')](_0x430ca3[_0x5429('0x78')](),{'type':db[_0x5429('0x6b')][_0x5429('0x79')][_0x5429('0x7a')]})[_0x5429('0x2d')](function(_0x361a08){if(_0x361a08[_0x5429('0x3b')]===0x1){return _0x42a199['id'];}else{var _0x4560ca=_[_0x5429('0x7b')](_[_0x5429('0x35')](_0x361a08,_0x5429('0x7c')),function(_0x43d23f){return _[_0x5429('0x7d')](_0x514b83,_0x43d23f);});if(_0x4560ca){return _0x42a199['id'];}}}));}}return BPromise[_0x5429('0x7e')](_0x51f9c8)[_0x5429('0x2d')](function(_0x2fd200){_0x4ff269=_(_0x4ff269)[_0x5429('0x7f')](_0x2fd200)[_0x5429('0x80')]()[_0x5429('0x81')]();return db['SmsQueue'][_0x5429('0x4f')]({'where':{'id':_0x2417ba['params']['id']}})[_0x5429('0x2d')](function(_0x147d2f){return db[_0x5429('0x6b')]['transaction'](function(_0x24c399){return _0x147d2f[_0x5429('0x6f')](_0x2417ba['query'][_0x5429('0x70')],{'transaction':_0x24c399})[_0x5429('0x2d')](function(){if(!_[_0x5429('0x82')](_0x4ff269)){return _0x147d2f[_0x5429('0x83')](_0x4ff269,{'transaction':_0x24c399});}})[_0x5429('0x2d')](function(){_0x4ff269[_0x5429('0x84')](function(_0x2aefe2){socket[_0x5429('0x85')]('userSmsQueue:remove',{'UserId':_0x2aefe2,'SmsQueueId':_0x147d2f['id']});});});});});});})['then'](respondWithStatusCode(_0x23faa0,null))[_0x5429('0x4b')](handleError(_0x23faa0,null));};exports[_0x5429('0x86')]=function(_0x40866c,_0x422bc2,_0x4684cf){return db[_0x5429('0x47')][_0x5429('0x4f')]({'where':{'id':_0x40866c['params']['id']}})['then'](handleEntityNotFound(_0x422bc2,null))[_0x5429('0x2d')](function(_0x4c55b4){if(_0x4c55b4){return _0x4c55b4[_0x5429('0x86')](_0x40866c['body']['ids'],_[_0x5429('0x87')](_0x40866c['body'],[_0x5429('0x70'),'id'])||{})[_0x5429('0x88')](function(_0x3ffb23){for(var _0x411823=0x0;_0x411823<_0x40866c[_0x5429('0x51')]['ids'][_0x5429('0x3b')];_0x411823+=0x1){socket[_0x5429('0x85')](_0x5429('0x6e'),{'UserId':Number(_0x40866c[_0x5429('0x51')][_0x5429('0x70')][_0x411823]),'SmsQueueId':Number(_0x40866c[_0x5429('0x4d')]['id'])});}return _0x3ffb23;});}})[_0x5429('0x2d')](respondWithResult(_0x422bc2,null))[_0x5429('0x4b')](handleError(_0x422bc2,null));};exports[_0x5429('0x83')]=function(_0x537151,_0x30084,_0x8b2b89){return db['SmsQueue'][_0x5429('0x4f')]({'where':{'id':_0x537151[_0x5429('0x4d')]['id']}})[_0x5429('0x2d')](handleEntityNotFound(_0x30084,null))[_0x5429('0x2d')](function(_0x45ab8f){if(_0x45ab8f){return _0x45ab8f[_0x5429('0x83')](_0x537151['query'][_0x5429('0x70')])[_0x5429('0x2d')](function(){if(_[_0x5429('0x89')](_0x537151[_0x5429('0x37')]['ids'])){for(var _0x5660f3=0x0;_0x5660f3<_0x537151[_0x5429('0x37')][_0x5429('0x70')][_0x5429('0x3b')];_0x5660f3+=0x1){socket[_0x5429('0x85')](_0x5429('0x8a'),{'UserId':Number(_0x537151[_0x5429('0x37')][_0x5429('0x70')][_0x5660f3]),'SmsQueueId':Number(_0x537151[_0x5429('0x4d')]['id'])});}}else{socket['emit'](_0x5429('0x8a'),{'UserId':Number(_0x537151[_0x5429('0x37')][_0x5429('0x70')]),'SmsQueueId':Number(_0x537151[_0x5429('0x4d')]['id'])});}});}})[_0x5429('0x2d')](respondWithStatusCode(_0x30084,null))[_0x5429('0x4b')](handleError(_0x30084,null));};exports['getAgents']=function(_0x3c1b08,_0x498326,_0x2106ab){var _0x5118f6={};var _0x5bd516={};var _0x5b5bd1;var _0x184c80;return db[_0x5429('0x47')][_0x5429('0x59')]({'where':{'id':_0x3c1b08[_0x5429('0x4d')]['id']}})[_0x5429('0x2d')](handleEntityNotFound(_0x498326,null))[_0x5429('0x2d')](function(_0x1e67a7){if(_0x1e67a7){_0x5b5bd1=_0x1e67a7;_0x5bd516['model']=_['keys'](db['User'][_0x5429('0x31')]);_0x5bd516[_0x5429('0x37')]=_[_0x5429('0x36')](_0x3c1b08[_0x5429('0x37')]);_0x5bd516['filters']=_[_0x5429('0x4e')](_0x5bd516[_0x5429('0x34')],_0x5bd516['query']);_0x5118f6[_0x5429('0x3a')]=_[_0x5429('0x4e')](_0x5bd516[_0x5429('0x34')],qs[_0x5429('0x39')](_0x3c1b08[_0x5429('0x37')][_0x5429('0x39')]));_0x5118f6['attributes']=_0x5118f6['attributes']['length']?_0x5118f6[_0x5429('0x3a')]:_0x5bd516['model'];_0x5118f6[_0x5429('0x3e')]=qs[_0x5429('0x3f')](_0x3c1b08[_0x5429('0x37')]['sort']);_0x5118f6[_0x5429('0x42')]=qs[_0x5429('0x38')](_[_0x5429('0x40')](_0x3c1b08[_0x5429('0x37')],_0x5bd516['filters']));if(_0x3c1b08[_0x5429('0x37')][_0x5429('0x41')]){_0x5118f6[_0x5429('0x42')]=_[_0x5429('0x45')](_0x5118f6['where'],{'$or':_[_0x5429('0x35')](_0x5118f6[_0x5429('0x3a')],function(_0x5782ea){var _0x4f73a1={};_0x4f73a1[_0x5782ea]={'$like':'%'+_0x3c1b08['query'][_0x5429('0x41')]+'%'};return _0x4f73a1;})});}_0x5118f6=_[_0x5429('0x45')]({},_0x5118f6,_0x3c1b08[_0x5429('0x46')]);return _0x5b5bd1[_0x5429('0x8b')](_0x5118f6);}})[_0x5429('0x2d')](function(_0x5bfa3e){if(_0x5bfa3e){_0x184c80=_0x5bfa3e[_0x5429('0x3b')];if(!_0x3c1b08[_0x5429('0x37')][_0x5429('0x3c')](_0x5429('0x3d'))){_0x5118f6['limit']=qs[_0x5429('0x25')](_0x3c1b08['query'][_0x5429('0x25')]);_0x5118f6['offset']=qs[_0x5429('0x23')](_0x3c1b08[_0x5429('0x37')][_0x5429('0x23')]);}return _0x5b5bd1[_0x5429('0x8b')](_0x5118f6);}})[_0x5429('0x2d')](function(_0x4c8edc){if(_0x4c8edc){return _0x4c8edc?{'count':_0x184c80,'rows':_0x4c8edc}:null;}})[_0x5429('0x2d')](respondWithResult(_0x498326,null))[_0x5429('0x4b')](handleError(_0x498326,null));}; \ No newline at end of file +var _0xd906=['localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','limit','count','offset','Content-Range','apply','reject','save','update','then','get','SmsQueues','UserProfileResource','destroy','error','stack','name','send','index','SmsQueue','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','find','describe','getMembers','nolimit','sort','pick','SmsQueueId','User','UserId','smsPause','updatedAt','createdAt','SIP','Team','getTeams','addTeams','ids','online','interface','flatMap','Agents','transaction','each','findOrCreate','forEach','removeTeams','field','tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','includes','all','union','compact','value','isEmpty','emit','userSmsQueue:remove','addAgents','omit','userSmsQueue:save','removeAgents','isArray','getAgents','findOne','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults'];(function(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0xd906,0x6b));var _0x6d90=function(_0x5eaf8e,_0x2056f4){_0x5eaf8e=_0x5eaf8e-0x0;var _0x3165ab=_0xd906[_0x5eaf8e];return _0x3165ab;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6d90('0x0'));var jsonpatch=require(_0x6d90('0x1'));var rp=require(_0x6d90('0x2'));var moment=require(_0x6d90('0x3'));var BPromise=require(_0x6d90('0x4'));var Mustache=require('mustache');var util=require(_0x6d90('0x5'));var path=require(_0x6d90('0x6'));var sox=require(_0x6d90('0x7'));var csv=require(_0x6d90('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d90('0x9'));var _=require(_0x6d90('0xa'));var squel=require(_0x6d90('0xb'));var crypto=require(_0x6d90('0xc'));var jsforce=require(_0x6d90('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6d90('0xe'));var Redis=require(_0x6d90('0xf'));var authService=require(_0x6d90('0x10'));var qs=require(_0x6d90('0x11'));var as=require(_0x6d90('0x12'));var hardwareService=require(_0x6d90('0x13'));var logger=require(_0x6d90('0x14'))('api');var utils=require(_0x6d90('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6d90('0x16'));var db=require('../../mysqldb')['db'];config[_0x6d90('0x17')]=_[_0x6d90('0x18')](config[_0x6d90('0x17')],{'host':_0x6d90('0x19'),'port':0x18eb});var socket=require(_0x6d90('0x1a'))(new Redis(config[_0x6d90('0x17')]));require(_0x6d90('0x1b'))[_0x6d90('0x1c')](socket);function respondWithStatusCode(_0x50b642,_0x35994a){_0x35994a=_0x35994a||0xcc;return function(_0x513417){if(_0x513417){return _0x50b642[_0x6d90('0x1d')](_0x35994a);}return _0x50b642[_0x6d90('0x1e')](_0x35994a)[_0x6d90('0x1f')]();};}function respondWithResult(_0x4dc4e3,_0x1e44db){_0x1e44db=_0x1e44db||0xc8;return function(_0x49b4ad){if(_0x49b4ad){return _0x4dc4e3[_0x6d90('0x1e')](_0x1e44db)['json'](_0x49b4ad);}};}function respondWithFilteredResult(_0x179703,_0xeb9d15){return function(_0x352736){if(_0x352736){var _0x3d37c6=typeof _0xeb9d15['offset']==='undefined'&&typeof _0xeb9d15[_0x6d90('0x20')]==='undefined';var _0x3aaa84=_0x352736[_0x6d90('0x21')];var _0x4f97ea=_0x3d37c6?0x0:_0xeb9d15['offset'];var _0x3f383d=_0x3d37c6?_0x352736[_0x6d90('0x21')]:_0xeb9d15[_0x6d90('0x22')]+_0xeb9d15['limit'];var _0x5cf8dc;if(_0x3f383d>=_0x3aaa84){_0x3f383d=_0x3aaa84;_0x5cf8dc=0xc8;}else{_0x5cf8dc=0xce;}_0x179703['status'](_0x5cf8dc);return _0x179703['set'](_0x6d90('0x23'),_0x4f97ea+'-'+_0x3f383d+'/'+_0x3aaa84)['json'](_0x352736);}return null;};}function patchUpdates(_0x19eb9d){return function(_0x3f9314){try{jsonpatch[_0x6d90('0x24')](_0x3f9314,_0x19eb9d,!![]);}catch(_0x470b5c){return BPromise[_0x6d90('0x25')](_0x470b5c);}return _0x3f9314[_0x6d90('0x26')]();};}function saveUpdates(_0x3aef5b,_0x43c927){return function(_0x243a32){if(_0x243a32){return _0x243a32[_0x6d90('0x27')](_0x3aef5b)[_0x6d90('0x28')](function(_0x597386){return _0x597386;});}return null;};}function removeEntity(_0x18f9aa,_0x2036f1){return function(_0x447070){if(_0x447070){return _0x447070['destroy']()[_0x6d90('0x28')](function(){var _0x1fefae=_0x447070[_0x6d90('0x29')]({'plain':!![]});var _0x46d76b=_0x6d90('0x2a');return db[_0x6d90('0x2b')][_0x6d90('0x2c')]({'where':{'type':_0x46d76b,'resourceId':_0x1fefae['id']}})[_0x6d90('0x28')](function(){return _0x447070;});})[_0x6d90('0x28')](function(){_0x18f9aa[_0x6d90('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ec50d,_0x5e1ab7){return function(_0xf4fb3){if(!_0xf4fb3){_0x5ec50d['sendStatus'](0x194);}return _0xf4fb3;};}function handleError(_0x53a2bd,_0x6a4f09){_0x6a4f09=_0x6a4f09||0x1f4;return function(_0x148cf5){logger[_0x6d90('0x2d')](_0x148cf5[_0x6d90('0x2e')]);if(_0x148cf5[_0x6d90('0x2f')]){delete _0x148cf5[_0x6d90('0x2f')];}_0x53a2bd[_0x6d90('0x1e')](_0x6a4f09)[_0x6d90('0x30')](_0x148cf5);};}exports[_0x6d90('0x31')]=function(_0xb20831,_0x378b93){var _0x2b325a={},_0x4da0ec={},_0x385758={'count':0x0,'rows':[]};var _0x56384d=_['map'](db[_0x6d90('0x32')][_0x6d90('0x33')],function(_0x5f3e6e){return{'name':_0x5f3e6e[_0x6d90('0x34')],'type':_0x5f3e6e[_0x6d90('0x35')][_0x6d90('0x36')]};});_0x4da0ec[_0x6d90('0x37')]=_[_0x6d90('0x38')](_0x56384d,_0x6d90('0x2f'));_0x4da0ec[_0x6d90('0x39')]=_[_0x6d90('0x3a')](_0xb20831[_0x6d90('0x39')]);_0x4da0ec[_0x6d90('0x3b')]=_[_0x6d90('0x3c')](_0x4da0ec[_0x6d90('0x37')],_0x4da0ec[_0x6d90('0x39')]);_0x2b325a[_0x6d90('0x3d')]=_[_0x6d90('0x3c')](_0x4da0ec[_0x6d90('0x37')],qs[_0x6d90('0x3e')](_0xb20831[_0x6d90('0x39')]['fields']));_0x2b325a[_0x6d90('0x3d')]=_0x2b325a['attributes'][_0x6d90('0x3f')]?_0x2b325a[_0x6d90('0x3d')]:_0x4da0ec['model'];if(!_0xb20831[_0x6d90('0x39')][_0x6d90('0x40')]('nolimit')){_0x2b325a[_0x6d90('0x20')]=qs[_0x6d90('0x20')](_0xb20831[_0x6d90('0x39')][_0x6d90('0x20')]);_0x2b325a[_0x6d90('0x22')]=qs['offset'](_0xb20831[_0x6d90('0x39')][_0x6d90('0x22')]);}_0x2b325a[_0x6d90('0x41')]=qs['sort'](_0xb20831[_0x6d90('0x39')]['sort']);_0x2b325a[_0x6d90('0x42')]=qs['filters'](_['pick'](_0xb20831[_0x6d90('0x39')],_0x4da0ec[_0x6d90('0x3b')]),_0x56384d);if(_0xb20831[_0x6d90('0x39')][_0x6d90('0x43')]){_0x2b325a[_0x6d90('0x42')]=_[_0x6d90('0x44')](_0x2b325a[_0x6d90('0x42')],{'$or':_[_0x6d90('0x38')](_0x56384d,function(_0x12c5a8){if(_0x12c5a8[_0x6d90('0x35')]!=='VIRTUAL'){var _0x4b352d={};_0x4b352d[_0x12c5a8['name']]={'$like':'%'+_0xb20831['query']['filter']+'%'};return _0x4b352d;}})});}_0x2b325a=_['merge']({},_0x2b325a,_0xb20831[_0x6d90('0x45')]);var _0x5b0ea7={'where':_0x2b325a[_0x6d90('0x42')]};return db[_0x6d90('0x32')][_0x6d90('0x21')](_0x5b0ea7)[_0x6d90('0x28')](function(_0x5ed325){_0x385758[_0x6d90('0x21')]=_0x5ed325;if(_0xb20831['query'][_0x6d90('0x46')]){_0x2b325a[_0x6d90('0x47')]=[{'all':!![]}];}return db[_0x6d90('0x32')][_0x6d90('0x48')](_0x2b325a);})[_0x6d90('0x28')](function(_0x5d39d0){_0x385758[_0x6d90('0x49')]=_0x5d39d0;return _0x385758;})[_0x6d90('0x28')](respondWithFilteredResult(_0x378b93,_0x2b325a))[_0x6d90('0x4a')](handleError(_0x378b93,null));};exports[_0x6d90('0x4b')]=function(_0x390149,_0x5bfd1d){var _0x1554b8={'raw':!![],'where':{'id':_0x390149['params']['id']}},_0x40957a={};_0x40957a[_0x6d90('0x37')]=_[_0x6d90('0x3a')](db['SmsQueue']['rawAttributes']);_0x40957a[_0x6d90('0x39')]=_[_0x6d90('0x3a')](_0x390149[_0x6d90('0x39')]);_0x40957a[_0x6d90('0x3b')]=_[_0x6d90('0x3c')](_0x40957a[_0x6d90('0x37')],_0x40957a[_0x6d90('0x39')]);_0x1554b8[_0x6d90('0x3d')]=_[_0x6d90('0x3c')](_0x40957a[_0x6d90('0x37')],qs[_0x6d90('0x3e')](_0x390149['query'][_0x6d90('0x3e')]));_0x1554b8['attributes']=_0x1554b8['attributes']['length']?_0x1554b8[_0x6d90('0x3d')]:_0x40957a[_0x6d90('0x37')];if(_0x390149[_0x6d90('0x39')][_0x6d90('0x46')]){_0x1554b8[_0x6d90('0x47')]=[{'all':!![]}];}_0x1554b8=_[_0x6d90('0x44')]({},_0x1554b8,_0x390149[_0x6d90('0x45')]);return db[_0x6d90('0x32')]['find'](_0x1554b8)[_0x6d90('0x28')](handleEntityNotFound(_0x5bfd1d,null))[_0x6d90('0x28')](respondWithResult(_0x5bfd1d,null))['catch'](handleError(_0x5bfd1d,null));};exports[_0x6d90('0x4c')]=function(_0x394947,_0x2ebc12){return db[_0x6d90('0x32')][_0x6d90('0x4c')](_0x394947[_0x6d90('0x4d')],{})['then'](function(_0x464a23){var _0x16e9cd=_0x394947['user'][_0x6d90('0x29')]({'plain':!![]});if(!_0x16e9cd)throw new Error(_0x6d90('0x4e'));if(_0x16e9cd[_0x6d90('0x4f')]==='user'){var _0x35a69b=_0x464a23[_0x6d90('0x29')]({'plain':!![]});var _0x317d2e=_0x6d90('0x2a');return db[_0x6d90('0x50')]['find']({'where':{'name':_0x317d2e,'userProfileId':_0x16e9cd['userProfileId']},'raw':!![]})[_0x6d90('0x28')](function(_0x4c6838){if(_0x4c6838&&_0x4c6838['autoAssociation']===0x0){return db[_0x6d90('0x2b')][_0x6d90('0x4c')]({'name':_0x35a69b[_0x6d90('0x2f')],'resourceId':_0x35a69b['id'],'type':_0x4c6838['name'],'sectionId':_0x4c6838['id']},{})[_0x6d90('0x28')](function(){return _0x464a23;});}else{return _0x464a23;}})[_0x6d90('0x4a')](function(_0x37de50){logger[_0x6d90('0x2d')](_0x6d90('0x51'),_0x37de50);throw _0x37de50;});}return _0x464a23;})[_0x6d90('0x28')](respondWithResult(_0x2ebc12,0xc9))[_0x6d90('0x4a')](handleError(_0x2ebc12,null));};exports[_0x6d90('0x27')]=function(_0x1886ed,_0x91a03c){if(_0x1886ed[_0x6d90('0x4d')]['id']){delete _0x1886ed['body']['id'];}return db['SmsQueue']['find']({'where':{'id':_0x1886ed[_0x6d90('0x52')]['id']}})[_0x6d90('0x28')](handleEntityNotFound(_0x91a03c,null))[_0x6d90('0x28')](saveUpdates(_0x1886ed[_0x6d90('0x4d')],null))[_0x6d90('0x28')](respondWithResult(_0x91a03c,null))[_0x6d90('0x4a')](handleError(_0x91a03c,null));};exports[_0x6d90('0x2c')]=function(_0x521f62,_0x2547fd){return db[_0x6d90('0x32')][_0x6d90('0x53')]({'where':{'id':_0x521f62['params']['id']}})[_0x6d90('0x28')](handleEntityNotFound(_0x2547fd,null))['then'](removeEntity(_0x2547fd,null))['catch'](handleError(_0x2547fd,null));};exports[_0x6d90('0x54')]=function(_0x5e234,_0xedfacc){return db[_0x6d90('0x32')]['describe']()['then'](respondWithResult(_0xedfacc,null))[_0x6d90('0x4a')](handleError(_0xedfacc,null));};exports[_0x6d90('0x55')]=function(_0x4672e1,_0x557d92,_0x53e4f0){var _0x38b1d0={'raw':!![],'where':{}},_0x264d65={},_0x59eaab;return db[_0x6d90('0x32')]['findOne']({'where':{'id':_0x4672e1[_0x6d90('0x52')]['id']}})[_0x6d90('0x28')](handleEntityNotFound(_0x557d92,null))['then'](function(_0x102e4a){if(_0x102e4a){_0x59eaab=_0x102e4a[_0x6d90('0x29')]({'plain':!![]});_0x264d65[_0x6d90('0x37')]=_[_0x6d90('0x3a')](db['UserSmsQueue']['rawAttributes']);_0x264d65[_0x6d90('0x39')]=_['keys'](_0x4672e1[_0x6d90('0x39')]);_0x264d65[_0x6d90('0x3b')]=_[_0x6d90('0x3c')](_0x264d65['model'],_0x264d65[_0x6d90('0x39')]);_0x38b1d0['attributes']=_['intersection'](_0x264d65['model'],qs['fields'](_0x4672e1[_0x6d90('0x39')][_0x6d90('0x3e')]));_0x38b1d0['attributes']=_0x38b1d0[_0x6d90('0x3d')]['length']?_0x38b1d0[_0x6d90('0x3d')]:_0x264d65[_0x6d90('0x37')];if(!_0x4672e1[_0x6d90('0x39')][_0x6d90('0x40')](_0x6d90('0x56'))){_0x38b1d0[_0x6d90('0x20')]=qs['limit'](_0x4672e1[_0x6d90('0x39')][_0x6d90('0x20')]);_0x38b1d0['offset']=qs[_0x6d90('0x22')](_0x4672e1[_0x6d90('0x39')][_0x6d90('0x22')]);}_0x38b1d0[_0x6d90('0x41')]=qs[_0x6d90('0x57')](_0x4672e1[_0x6d90('0x39')][_0x6d90('0x57')]);_0x38b1d0[_0x6d90('0x42')]=qs[_0x6d90('0x3b')](_[_0x6d90('0x58')](_0x4672e1[_0x6d90('0x39')],_0x264d65['filters']));_0x38b1d0[_0x6d90('0x42')][_0x6d90('0x59')]=_0x102e4a['id'];if(_0x4672e1[_0x6d90('0x39')][_0x6d90('0x43')]){_0x38b1d0[_0x6d90('0x42')]=_[_0x6d90('0x44')](_0x38b1d0['where'],{'$or':_[_0x6d90('0x38')](_0x38b1d0[_0x6d90('0x3d')],function(_0x3e732c){var _0x5a8419={};_0x5a8419[_0x3e732c]={'$like':'%'+_0x4672e1['query']['filter']+'%'};return _0x5a8419;})});}_0x38b1d0=_[_0x6d90('0x44')]({},_0x38b1d0,_0x4672e1[_0x6d90('0x45')]);return db['UserSmsQueue']['findAll'](_0x38b1d0);}})[_0x6d90('0x28')](function(_0x132338){if(_0x132338){return db[_0x6d90('0x5a')]['findAndCountAll']({'where':{'id':_[_0x6d90('0x38')](_0x132338,_0x6d90('0x5b')),'role':'agent'},'attributes':['id',_0x6d90('0x2f'),_0x6d90('0x5c'),_0x6d90('0x5d'),_0x6d90('0x5e')]});}})['then'](function(_0x4b8edd){if(_0x4b8edd){return{'count':_0x4b8edd[_0x6d90('0x21')],'rows':_[_0x6d90('0x38')](_0x4b8edd['rows'],function(_0x3b1dd6){return{'membername':_0x3b1dd6[_0x6d90('0x2f')],'UserId':_0x3b1dd6['id'],'queue_name':_0x59eaab[_0x6d90('0x2f')],'SmsQueueId':_0x59eaab['id'],'interface':util['format']('%s/%s',_0x6d90('0x5f'),_0x3b1dd6[_0x6d90('0x2f')]),'penalty':0x0,'paused':_0x3b1dd6[_0x6d90('0x5c')],'createdAt':_0x3b1dd6['createdAt'],'updatedAt':_0x3b1dd6[_0x6d90('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6d90('0x28')](respondWithFilteredResult(_0x557d92,_0x38b1d0))[_0x6d90('0x4a')](handleError(_0x557d92,null));};exports['getTeams']=function(_0x206c59,_0xc1b982,_0x4c8d25){var _0x552dca={};var _0x243079={};var _0x5a298d;var _0x4ba9b1;return db[_0x6d90('0x32')]['findOne']({'where':{'id':_0x206c59[_0x6d90('0x52')]['id']}})['then'](handleEntityNotFound(_0xc1b982,null))['then'](function(_0x4dae43){if(_0x4dae43){_0x5a298d=_0x4dae43;_0x243079[_0x6d90('0x37')]=_[_0x6d90('0x3a')](db[_0x6d90('0x60')]['rawAttributes']);_0x243079['query']=_[_0x6d90('0x3a')](_0x206c59['query']);_0x243079[_0x6d90('0x3b')]=_[_0x6d90('0x3c')](_0x243079[_0x6d90('0x37')],_0x243079[_0x6d90('0x39')]);_0x552dca['attributes']=_[_0x6d90('0x3c')](_0x243079[_0x6d90('0x37')],qs[_0x6d90('0x3e')](_0x206c59['query']['fields']));_0x552dca[_0x6d90('0x3d')]=_0x552dca[_0x6d90('0x3d')]['length']?_0x552dca[_0x6d90('0x3d')]:_0x243079[_0x6d90('0x37')];_0x552dca['order']=qs[_0x6d90('0x57')](_0x206c59[_0x6d90('0x39')][_0x6d90('0x57')]);_0x552dca[_0x6d90('0x42')]=qs[_0x6d90('0x3b')](_[_0x6d90('0x58')](_0x206c59[_0x6d90('0x39')],_0x243079[_0x6d90('0x3b')]));if(_0x206c59['query'][_0x6d90('0x43')]){_0x552dca[_0x6d90('0x42')]=_['merge'](_0x552dca[_0x6d90('0x42')],{'$or':_[_0x6d90('0x38')](_0x552dca[_0x6d90('0x3d')],function(_0x2eadb8){var _0x5c3ca1={};_0x5c3ca1[_0x2eadb8]={'$like':'%'+_0x206c59['query']['filter']+'%'};return _0x5c3ca1;})});}_0x552dca=_[_0x6d90('0x44')]({},_0x552dca,_0x206c59[_0x6d90('0x45')]);return _0x5a298d[_0x6d90('0x61')](_0x552dca);}})['then'](function(_0xaeb7fb){if(_0xaeb7fb){_0x4ba9b1=_0xaeb7fb[_0x6d90('0x3f')];if(!_0x206c59[_0x6d90('0x39')][_0x6d90('0x40')](_0x6d90('0x56'))){_0x552dca[_0x6d90('0x20')]=qs[_0x6d90('0x20')](_0x206c59['query'][_0x6d90('0x20')]);_0x552dca[_0x6d90('0x22')]=qs[_0x6d90('0x22')](_0x206c59[_0x6d90('0x39')][_0x6d90('0x22')]);}return _0x5a298d[_0x6d90('0x61')](_0x552dca);}})[_0x6d90('0x28')](function(_0x38eb34){if(_0x38eb34){return _0x38eb34?{'count':_0x4ba9b1,'rows':_0x38eb34}:null;}})[_0x6d90('0x28')](respondWithResult(_0xc1b982,null))[_0x6d90('0x4a')](handleError(_0xc1b982,null));};exports[_0x6d90('0x62')]=function(_0x1dfe60,_0x36dd50,_0x3bea3b){var _0x2f7ee7=_0x1dfe60[_0x6d90('0x4d')][_0x6d90('0x63')];return db[_0x6d90('0x60')][_0x6d90('0x48')]({'where':{'id':_0x2f7ee7},'attributes':['id'],'include':[{'model':db[_0x6d90('0x5a')],'as':'Agents','attributes':['id','name',_0x6d90('0x64'),'voicePause',_0x6d90('0x65')],'raw':!![]}]})[_0x6d90('0x28')](function(_0x504b02){if(_0x504b02){var _0x3db585=_[_0x6d90('0x66')](_0x504b02,function(_0x512c85){var _0x45260f=_0x512c85['get']({'plain':!![]});return _0x45260f[_0x6d90('0x67')];});return db[_0x6d90('0x32')]['find']({'where':{'id':_0x1dfe60[_0x6d90('0x52')]['id']}})[_0x6d90('0x28')](function(_0x2cc07e){return db['sequelize'][_0x6d90('0x68')](function(_0xcd6e4e){return _0x2cc07e[_0x6d90('0x62')](_0x2f7ee7,{'transaction':_0xcd6e4e})[_0x6d90('0x28')](function(){return BPromise[_0x6d90('0x69')](_0x3db585,function(_0x4be376){return db['UserSmsQueue'][_0x6d90('0x6a')]({'where':{'UserId':_0x4be376['id'],'SmsQueueId':_0x1dfe60[_0x6d90('0x52')]['id']},'transaction':_0xcd6e4e});});})[_0x6d90('0x28')](function(){_0x3db585[_0x6d90('0x6b')](function(_0x49cd68){socket['emit']('userSmsQueue:save',{'UserId':_0x49cd68['id'],'SmsQueueId':_0x2cc07e['id']});});});});});}})[_0x6d90('0x28')](respondWithStatusCode(_0x36dd50,null))[_0x6d90('0x4a')](handleError(_0x36dd50,null));};exports[_0x6d90('0x6c')]=function(_0x1a051e,_0x87c427,_0x51280c){return db[_0x6d90('0x60')][_0x6d90('0x48')]({'where':{'id':_0x1a051e[_0x6d90('0x39')][_0x6d90('0x63')]},'attributes':['id'],'include':[{'model':db[_0x6d90('0x5a')],'as':_0x6d90('0x67'),'attributes':['id'],'raw':!![]}]})[_0x6d90('0x28')](handleEntityNotFound(_0x87c427,null))[_0x6d90('0x28')](function(_0x4f9946){var _0x5a5fd6=_[_0x6d90('0x38')](_0x4f9946,'id');var _0x2813e4=[];var _0x132853=[];var _0x339a19=squel['select']();_0x339a19[_0x6d90('0x6d')](_0x6d90('0x6e'))['from']('team_has_sms_queues','tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x6d90('0x42')](_0x6d90('0x6f'),_0x1a051e[_0x6d90('0x52')]['id']);for(var _0x45b251=0x0;_0x45b251<_0x4f9946[_0x6d90('0x3f')];_0x45b251+=0x1){let _0x501fb3=_0x4f9946[_0x45b251];for(var _0x29db93=0x0;_0x29db93<_0x501fb3[_0x6d90('0x67')][_0x6d90('0x3f')];_0x29db93+=0x1){let _0x41fdc9=_0x501fb3[_0x6d90('0x67')][_0x29db93];var _0x573407=_0x339a19[_0x6d90('0x70')]();_0x573407['where'](_0x6d90('0x71'),_0x41fdc9['id']);_0x132853[_0x6d90('0x72')](db[_0x6d90('0x73')][_0x6d90('0x39')](_0x573407[_0x6d90('0x74')](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0x6d90('0x28')](function(_0x20f370){if(_0x20f370[_0x6d90('0x3f')]===0x1){return _0x41fdc9['id'];}else{var _0x291ae3=_['every'](_['map'](_0x20f370,'TeamId'),function(_0x96ea60){return _[_0x6d90('0x75')](_0x5a5fd6,_0x96ea60);});if(_0x291ae3){return _0x41fdc9['id'];}}}));}}return BPromise[_0x6d90('0x76')](_0x132853)[_0x6d90('0x28')](function(_0x22e8bd){_0x2813e4=_(_0x2813e4)[_0x6d90('0x77')](_0x22e8bd)[_0x6d90('0x78')]()[_0x6d90('0x79')]();return db['SmsQueue']['find']({'where':{'id':_0x1a051e[_0x6d90('0x52')]['id']}})[_0x6d90('0x28')](function(_0x49e1f4){return db[_0x6d90('0x73')][_0x6d90('0x68')](function(_0x1804cf){return _0x49e1f4['removeTeams'](_0x1a051e[_0x6d90('0x39')][_0x6d90('0x63')],{'transaction':_0x1804cf})[_0x6d90('0x28')](function(){if(!_[_0x6d90('0x7a')](_0x2813e4)){return _0x49e1f4['removeAgents'](_0x2813e4,{'transaction':_0x1804cf});}})[_0x6d90('0x28')](function(){_0x2813e4[_0x6d90('0x6b')](function(_0x425e08){socket[_0x6d90('0x7b')](_0x6d90('0x7c'),{'UserId':_0x425e08,'SmsQueueId':_0x49e1f4['id']});});});});});});})[_0x6d90('0x28')](respondWithStatusCode(_0x87c427,null))[_0x6d90('0x4a')](handleError(_0x87c427,null));};exports[_0x6d90('0x7d')]=function(_0x2dd4e3,_0x8af858,_0x3b90af){return db[_0x6d90('0x32')][_0x6d90('0x53')]({'where':{'id':_0x2dd4e3[_0x6d90('0x52')]['id']}})[_0x6d90('0x28')](handleEntityNotFound(_0x8af858,null))[_0x6d90('0x28')](function(_0x5898ac){if(_0x5898ac){return _0x5898ac[_0x6d90('0x7d')](_0x2dd4e3[_0x6d90('0x4d')]['ids'],_[_0x6d90('0x7e')](_0x2dd4e3[_0x6d90('0x4d')],[_0x6d90('0x63'),'id'])||{})['spread'](function(_0x336844){for(var _0x1fb3b2=0x0;_0x1fb3b2<_0x2dd4e3[_0x6d90('0x4d')][_0x6d90('0x63')][_0x6d90('0x3f')];_0x1fb3b2+=0x1){socket[_0x6d90('0x7b')](_0x6d90('0x7f'),{'UserId':Number(_0x2dd4e3[_0x6d90('0x4d')]['ids'][_0x1fb3b2]),'SmsQueueId':Number(_0x2dd4e3[_0x6d90('0x52')]['id'])});}return _0x336844;});}})[_0x6d90('0x28')](respondWithResult(_0x8af858,null))[_0x6d90('0x4a')](handleError(_0x8af858,null));};exports[_0x6d90('0x80')]=function(_0x4aa9c0,_0x22edcc,_0x2125d3){return db[_0x6d90('0x32')][_0x6d90('0x53')]({'where':{'id':_0x4aa9c0[_0x6d90('0x52')]['id']}})[_0x6d90('0x28')](handleEntityNotFound(_0x22edcc,null))['then'](function(_0x196691){if(_0x196691){return _0x196691[_0x6d90('0x80')](_0x4aa9c0[_0x6d90('0x39')][_0x6d90('0x63')])['then'](function(){if(_[_0x6d90('0x81')](_0x4aa9c0[_0x6d90('0x39')][_0x6d90('0x63')])){for(var _0x159ffb=0x0;_0x159ffb<_0x4aa9c0[_0x6d90('0x39')]['ids'][_0x6d90('0x3f')];_0x159ffb+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x4aa9c0[_0x6d90('0x39')][_0x6d90('0x63')][_0x159ffb]),'SmsQueueId':Number(_0x4aa9c0[_0x6d90('0x52')]['id'])});}}else{socket['emit'](_0x6d90('0x7c'),{'UserId':Number(_0x4aa9c0['query']['ids']),'SmsQueueId':Number(_0x4aa9c0[_0x6d90('0x52')]['id'])});}});}})['then'](respondWithStatusCode(_0x22edcc,null))[_0x6d90('0x4a')](handleError(_0x22edcc,null));};exports[_0x6d90('0x82')]=function(_0x3aa479,_0x341a5d,_0x1d010a){var _0x1300d7={};var _0x91f48a={};var _0x203558;var _0x5daa38;return db['SmsQueue'][_0x6d90('0x83')]({'where':{'id':_0x3aa479[_0x6d90('0x52')]['id']}})['then'](handleEntityNotFound(_0x341a5d,null))[_0x6d90('0x28')](function(_0xe32dfd){if(_0xe32dfd){_0x203558=_0xe32dfd;_0x91f48a[_0x6d90('0x37')]=_[_0x6d90('0x3a')](db['User'][_0x6d90('0x33')]);_0x91f48a[_0x6d90('0x39')]=_[_0x6d90('0x3a')](_0x3aa479[_0x6d90('0x39')]);_0x91f48a['filters']=_[_0x6d90('0x3c')](_0x91f48a[_0x6d90('0x37')],_0x91f48a[_0x6d90('0x39')]);_0x1300d7['attributes']=_[_0x6d90('0x3c')](_0x91f48a[_0x6d90('0x37')],qs[_0x6d90('0x3e')](_0x3aa479[_0x6d90('0x39')]['fields']));_0x1300d7[_0x6d90('0x3d')]=_0x1300d7[_0x6d90('0x3d')][_0x6d90('0x3f')]?_0x1300d7[_0x6d90('0x3d')]:_0x91f48a['model'];_0x1300d7[_0x6d90('0x41')]=qs[_0x6d90('0x57')](_0x3aa479['query'][_0x6d90('0x57')]);_0x1300d7[_0x6d90('0x42')]=qs[_0x6d90('0x3b')](_[_0x6d90('0x58')](_0x3aa479['query'],_0x91f48a[_0x6d90('0x3b')]));if(_0x3aa479[_0x6d90('0x39')][_0x6d90('0x43')]){_0x1300d7[_0x6d90('0x42')]=_[_0x6d90('0x44')](_0x1300d7[_0x6d90('0x42')],{'$or':_[_0x6d90('0x38')](_0x1300d7[_0x6d90('0x3d')],function(_0x60490f){var _0x3d276d={};_0x3d276d[_0x60490f]={'$like':'%'+_0x3aa479[_0x6d90('0x39')]['filter']+'%'};return _0x3d276d;})});}_0x1300d7=_[_0x6d90('0x44')]({},_0x1300d7,_0x3aa479[_0x6d90('0x45')]);return _0x203558[_0x6d90('0x82')](_0x1300d7);}})['then'](function(_0x18bf10){if(_0x18bf10){_0x5daa38=_0x18bf10['length'];if(!_0x3aa479[_0x6d90('0x39')][_0x6d90('0x40')](_0x6d90('0x56'))){_0x1300d7['limit']=qs[_0x6d90('0x20')](_0x3aa479[_0x6d90('0x39')][_0x6d90('0x20')]);_0x1300d7[_0x6d90('0x22')]=qs[_0x6d90('0x22')](_0x3aa479[_0x6d90('0x39')][_0x6d90('0x22')]);}return _0x203558['getAgents'](_0x1300d7);}})['then'](function(_0x54b812){if(_0x54b812){return _0x54b812?{'count':_0x5daa38,'rows':_0x54b812}:null;}})['then'](respondWithResult(_0x341a5d,null))[_0x6d90('0x4a')](handleError(_0x341a5d,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 026c3dc..60691f4 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 _0x8bb1=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x1731c7,_0x45b1c2){var _0xe9c5d=function(_0x4c385e){while(--_0x4c385e){_0x1731c7['push'](_0x1731c7['shift']());}};_0xe9c5d(++_0x45b1c2);}(_0x8bb1,0x12c));var _0x18bb=function(_0x33cec5,_0x4327fa){_0x33cec5=_0x33cec5-0x0;var _0x3901e5=_0x8bb1[_0x33cec5];return _0x3901e5;};'use strict';var EventEmitter=require(_0x18bb('0x0'));var SmsQueue=require(_0x18bb('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x18bb('0x2')](0x0);var events={'afterCreate':_0x18bb('0x3'),'afterUpdate':_0x18bb('0x4'),'afterDestroy':'remove'};function emitEvent(_0x401e72){return function(_0x2ef9b2,_0x3293a9,_0x17544b){SmsQueueEvents[_0x18bb('0x5')](_0x401e72+':'+_0x2ef9b2['id'],_0x2ef9b2);SmsQueueEvents[_0x18bb('0x5')](_0x401e72,_0x2ef9b2);_0x17544b(null);};}for(var e in events){if(events[_0x18bb('0x6')](e)){var event=events[e];SmsQueue[_0x18bb('0x7')](e,emitEvent(event));}}module[_0x18bb('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x10fc=['SmsQueue','setMaxListeners','emit','hasOwnProperty','hook','exports','events'];(function(_0x4796a9,_0x30d627){var _0x1858b7=function(_0x409795){while(--_0x409795){_0x4796a9['push'](_0x4796a9['shift']());}};_0x1858b7(++_0x30d627);}(_0x10fc,0x1b1));var _0xc10f=function(_0x4c75e1,_0x1ff897){_0x4c75e1=_0x4c75e1-0x0;var _0x278ad0=_0x10fc[_0x4c75e1];return _0x278ad0;};'use strict';var EventEmitter=require(_0xc10f('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xc10f('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xc10f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x7a937e){return function(_0x2e79b5,_0x240b33,_0x57ab53){SmsQueueEvents[_0xc10f('0x3')](_0x7a937e+':'+_0x2e79b5['id'],_0x2e79b5);SmsQueueEvents['emit'](_0x7a937e,_0x2e79b5);_0x57ab53(null);};}for(var e in events){if(events[_0xc10f('0x4')](e)){var event=events[e];SmsQueue[_0xc10f('0x5')](e,emitEvent(event));}}module[_0xc10f('0x6')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 42924d3..dbabe4b 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 _0x570f=['lodash','util','../../config/logger','api','bluebird','request-promise','path','./smsQueue.attributes','exports','define','sms_queues'];(function(_0x5c1401,_0x3ec444){var _0x50cf10=function(_0xe0c4b){while(--_0xe0c4b){_0x5c1401['push'](_0x5c1401['shift']());}};_0x50cf10(++_0x3ec444);}(_0x570f,0x176));var _0xf570=function(_0x559e51,_0x2836f7){_0x559e51=_0x559e51-0x0;var _0x3d228c=_0x570f[_0x559e51];return _0x3d228c;};'use strict';var _=require(_0xf570('0x0'));var util=require(_0xf570('0x1'));var logger=require(_0xf570('0x2'))(_0xf570('0x3'));var moment=require('moment');var BPromise=require(_0xf570('0x4'));var rp=require(_0xf570('0x5'));var fs=require('fs');var path=require(_0xf570('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf570('0x7'));module[_0xf570('0x8')]=function(_0x5a1adf,_0x5136e8){return _0x5a1adf[_0xf570('0x9')]('SmsQueue',attributes,{'tableName':_0xf570('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb1fe=['moment','request-promise','path','../../config/environment','./smsQueue.attributes','exports','sms_queues','lodash','../../config/logger'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb1fe,0xa0));var _0xeb1f=function(_0xe73202,_0x24aa8e){_0xe73202=_0xe73202-0x0;var _0x514092=_0xb1fe[_0xe73202];return _0x514092;};'use strict';var _=require(_0xeb1f('0x0'));var util=require('util');var logger=require(_0xeb1f('0x1'))('api');var moment=require(_0xeb1f('0x2'));var BPromise=require('bluebird');var rp=require(_0xeb1f('0x3'));var fs=require('fs');var path=require(_0xeb1f('0x4'));var rimraf=require('rimraf');var config=require(_0xeb1f('0x5'));var attributes=require(_0xeb1f('0x6'));module[_0xeb1f('0x7')]=function(_0xdaa6cc,_0x4e7fa1){return _0xdaa6cc['define']('SmsQueue',attributes,{'tableName':_0xeb1f('0x8'),'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 acda46e..61cdfef 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 _0x1f2d=['where','attributes','map','include','model','GetSmsQueue','ShowSmsQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./smsQueue.socket','request','then','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','catch','SmsQueue','findAll','options','raw'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1f2d,0x13f));var _0xd1f2=function(_0x5ac7d7,_0x109040){_0x5ac7d7=_0x5ac7d7-0x0;var _0x23955f=_0x1f2d[_0x5ac7d7];return _0x23955f;};'use strict';var _=require(_0xd1f2('0x0'));var util=require(_0xd1f2('0x1'));var moment=require(_0xd1f2('0x2'));var BPromise=require('bluebird');var rs=require(_0xd1f2('0x3'));var fs=require('fs');var Redis=require(_0xd1f2('0x4'));var db=require(_0xd1f2('0x5'))['db'];var utils=require(_0xd1f2('0x6'));var logger=require(_0xd1f2('0x7'))(_0xd1f2('0x8'));var config=require(_0xd1f2('0x9'));var jayson=require(_0xd1f2('0xa'));var client=jayson[_0xd1f2('0xb')][_0xd1f2('0xc')]({'port':0x232a});config[_0xd1f2('0xd')]=_['defaults'](config[_0xd1f2('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xd1f2('0xe'))(new Redis(config[_0xd1f2('0xd')]));require(_0xd1f2('0xf'))['register'](socket);function respondWithRpcPromise(_0x4ffaf1,_0x286f3c,_0x27cd5e){return new BPromise(function(_0x231753,_0x1ed12d){return client[_0xd1f2('0x10')](_0x4ffaf1,_0x27cd5e)[_0xd1f2('0x11')](function(_0x387df4){logger[_0xd1f2('0x12')]('SmsQueue,\x20%s,\x20%s',_0x286f3c,_0xd1f2('0x13'));logger[_0xd1f2('0x14')](_0xd1f2('0x15'),_0x286f3c,_0xd1f2('0x13'),JSON[_0xd1f2('0x16')](_0x387df4));if(_0x387df4[_0xd1f2('0x17')]){if(_0x387df4['error'][_0xd1f2('0x18')]===0x1f4){logger[_0xd1f2('0x17')](_0xd1f2('0x19'),_0x286f3c,_0x387df4[_0xd1f2('0x17')][_0xd1f2('0x1a')]);return _0x1ed12d(_0x387df4['error']['message']);}logger[_0xd1f2('0x17')](_0xd1f2('0x19'),_0x286f3c,_0x387df4['error'][_0xd1f2('0x1a')]);return _0x231753(_0x387df4[_0xd1f2('0x17')][_0xd1f2('0x1a')]);}else{logger[_0xd1f2('0x12')](_0xd1f2('0x19'),_0x286f3c,_0xd1f2('0x13'));_0x231753(_0x387df4['result'][_0xd1f2('0x1a')]);}})[_0xd1f2('0x1b')](function(_0x5f4f33){logger[_0xd1f2('0x17')](_0xd1f2('0x19'),_0x286f3c,_0x5f4f33);_0x1ed12d(_0x5f4f33);});});}exports['GetSmsQueue']=function(_0x2b1c26){var _0x2da11e=this;return new Promise(function(_0x2a0f9d,_0x450833){return db[_0xd1f2('0x1c')][_0xd1f2('0x1d')]({'raw':_0x2b1c26[_0xd1f2('0x1e')]?_0x2b1c26[_0xd1f2('0x1e')][_0xd1f2('0x1f')]===undefined?!![]:![]:!![],'where':_0x2b1c26[_0xd1f2('0x1e')]?_0x2b1c26[_0xd1f2('0x1e')][_0xd1f2('0x20')]||null:null,'attributes':_0x2b1c26[_0xd1f2('0x1e')]?_0x2b1c26[_0xd1f2('0x1e')][_0xd1f2('0x21')]||null:null,'limit':_0x2b1c26['options']?_0x2b1c26[_0xd1f2('0x1e')]['limit']||null:null,'include':_0x2b1c26[_0xd1f2('0x1e')]?_0x2b1c26[_0xd1f2('0x1e')]['include']?_[_0xd1f2('0x22')](_0x2b1c26[_0xd1f2('0x1e')][_0xd1f2('0x23')],function(_0x38dc13){return{'model':db[_0x38dc13[_0xd1f2('0x24')]],'as':_0x38dc13['as'],'attributes':_0x38dc13[_0xd1f2('0x21')],'include':_0x38dc13[_0xd1f2('0x23')]?_[_0xd1f2('0x22')](_0x38dc13[_0xd1f2('0x23')],function(_0x241a68){return{'model':db[_0x241a68[_0xd1f2('0x24')]],'as':_0x241a68['as'],'attributes':_0x241a68[_0xd1f2('0x21')],'include':_0x241a68[_0xd1f2('0x23')]?_['map'](_0x241a68[_0xd1f2('0x23')],function(_0x3e45c4){return{'model':db[_0x3e45c4[_0xd1f2('0x24')]],'as':_0x3e45c4['as'],'attributes':_0x3e45c4['attributes']};}):[]};}):[]};}):[]:[]})[_0xd1f2('0x11')](function(_0x175b5d){logger[_0xd1f2('0x12')](_0xd1f2('0x25'),_0x2b1c26);logger[_0xd1f2('0x14')]('GetSmsQueue',_0x2b1c26,JSON[_0xd1f2('0x16')](_0x175b5d));_0x2a0f9d(_0x175b5d);})[_0xd1f2('0x1b')](function(_0x11de47){logger[_0xd1f2('0x17')](_0xd1f2('0x25'),_0x11de47['message'],_0x2b1c26);_0x450833(_0x2da11e[_0xd1f2('0x17')](0x1f4,_0x11de47['message']));});});};exports['ShowSmsQueue']=function(_0x35aad3){var _0x27dc13=this;return new Promise(function(_0x3f60d6,_0x1fe9c6){return db[_0xd1f2('0x1c')]['find']({'raw':_0x35aad3['options']?_0x35aad3[_0xd1f2('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x35aad3[_0xd1f2('0x1e')]?_0x35aad3[_0xd1f2('0x1e')][_0xd1f2('0x20')]||null:null,'attributes':_0x35aad3[_0xd1f2('0x1e')]?_0x35aad3['options'][_0xd1f2('0x21')]||null:null,'include':_0x35aad3[_0xd1f2('0x1e')]?_0x35aad3[_0xd1f2('0x1e')][_0xd1f2('0x23')]?_[_0xd1f2('0x22')](_0x35aad3['options'][_0xd1f2('0x23')],function(_0x38a11d){return{'model':db[_0x38a11d['model']],'as':_0x38a11d['as'],'attributes':_0x38a11d[_0xd1f2('0x21')],'include':_0x38a11d[_0xd1f2('0x23')]?_['map'](_0x38a11d[_0xd1f2('0x23')],function(_0xeaa97d){return{'model':db[_0xeaa97d[_0xd1f2('0x24')]],'as':_0xeaa97d['as'],'attributes':_0xeaa97d['attributes'],'include':_0xeaa97d[_0xd1f2('0x23')]?_[_0xd1f2('0x22')](_0xeaa97d['include'],function(_0x1b2679){return{'model':db[_0x1b2679[_0xd1f2('0x24')]],'as':_0x1b2679['as'],'attributes':_0x1b2679[_0xd1f2('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5cd665){logger[_0xd1f2('0x12')](_0xd1f2('0x26'),_0x35aad3);logger[_0xd1f2('0x14')](_0xd1f2('0x26'),_0x35aad3,JSON[_0xd1f2('0x16')](_0x5cd665));_0x3f60d6(_0x5cd665);})[_0xd1f2('0x1b')](function(_0x5373be){logger[_0xd1f2('0x17')](_0xd1f2('0x26'),_0x5373be['message'],_0x35aad3);_0x1fe9c6(_0x27dc13['error'](0x1f4,_0x5373be[_0xd1f2('0x1a')]));});});}; \ No newline at end of file +var _0xb495=['debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SmsQueue','findAll','options','raw','attributes','limit','include','map','model','GetSmsQueue','ShowSmsQueue','find','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s'];(function(_0x56a81d,_0x7ed51c){var _0xe918bd=function(_0x96dedd){while(--_0x96dedd){_0x56a81d['push'](_0x56a81d['shift']());}};_0xe918bd(++_0x7ed51c);}(_0xb495,0x151));var _0x5b49=function(_0x33a99c,_0x207417){_0x33a99c=_0x33a99c-0x0;var _0x5e45d2=_0xb495[_0x33a99c];return _0x5e45d2;};'use strict';var _=require(_0x5b49('0x0'));var util=require(_0x5b49('0x1'));var moment=require(_0x5b49('0x2'));var BPromise=require(_0x5b49('0x3'));var rs=require(_0x5b49('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b49('0x5'))['db'];var utils=require(_0x5b49('0x6'));var logger=require(_0x5b49('0x7'))(_0x5b49('0x8'));var config=require(_0x5b49('0x9'));var jayson=require(_0x5b49('0xa'));var client=jayson[_0x5b49('0xb')][_0x5b49('0xc')]({'port':0x232a});config[_0x5b49('0xd')]=_[_0x5b49('0xe')](config[_0x5b49('0xd')],{'host':_0x5b49('0xf'),'port':0x18eb});var socket=require(_0x5b49('0x10'))(new Redis(config[_0x5b49('0xd')]));require(_0x5b49('0x11'))[_0x5b49('0x12')](socket);function respondWithRpcPromise(_0x233ff5,_0x4e8fc3,_0x433391){return new BPromise(function(_0x3c7abd,_0x4acbe1){return client[_0x5b49('0x13')](_0x233ff5,_0x433391)[_0x5b49('0x14')](function(_0x22a8d3){logger[_0x5b49('0x15')](_0x5b49('0x16'),_0x4e8fc3,'request\x20sent');logger[_0x5b49('0x17')](_0x5b49('0x18'),_0x4e8fc3,_0x5b49('0x19'),JSON[_0x5b49('0x1a')](_0x22a8d3));if(_0x22a8d3[_0x5b49('0x1b')]){if(_0x22a8d3[_0x5b49('0x1b')][_0x5b49('0x1c')]===0x1f4){logger[_0x5b49('0x1b')](_0x5b49('0x16'),_0x4e8fc3,_0x22a8d3[_0x5b49('0x1b')][_0x5b49('0x1d')]);return _0x4acbe1(_0x22a8d3[_0x5b49('0x1b')]['message']);}logger[_0x5b49('0x1b')](_0x5b49('0x16'),_0x4e8fc3,_0x22a8d3['error'][_0x5b49('0x1d')]);return _0x3c7abd(_0x22a8d3[_0x5b49('0x1b')]['message']);}else{logger[_0x5b49('0x15')](_0x5b49('0x16'),_0x4e8fc3,'request\x20sent');_0x3c7abd(_0x22a8d3[_0x5b49('0x1e')][_0x5b49('0x1d')]);}})[_0x5b49('0x1f')](function(_0x12bdf7){logger[_0x5b49('0x1b')](_0x5b49('0x16'),_0x4e8fc3,_0x12bdf7);_0x4acbe1(_0x12bdf7);});});}exports['GetSmsQueue']=function(_0xbfa428){var _0x44b7cc=this;return new Promise(function(_0x4e372d,_0x3042d6){return db[_0x5b49('0x20')][_0x5b49('0x21')]({'raw':_0xbfa428['options']?_0xbfa428[_0x5b49('0x22')][_0x5b49('0x23')]===undefined?!![]:![]:!![],'where':_0xbfa428[_0x5b49('0x22')]?_0xbfa428[_0x5b49('0x22')]['where']||null:null,'attributes':_0xbfa428[_0x5b49('0x22')]?_0xbfa428[_0x5b49('0x22')][_0x5b49('0x24')]||null:null,'limit':_0xbfa428[_0x5b49('0x22')]?_0xbfa428[_0x5b49('0x22')][_0x5b49('0x25')]||null:null,'include':_0xbfa428['options']?_0xbfa428[_0x5b49('0x22')][_0x5b49('0x26')]?_[_0x5b49('0x27')](_0xbfa428[_0x5b49('0x22')][_0x5b49('0x26')],function(_0xdb15e9){return{'model':db[_0xdb15e9[_0x5b49('0x28')]],'as':_0xdb15e9['as'],'attributes':_0xdb15e9[_0x5b49('0x24')],'include':_0xdb15e9[_0x5b49('0x26')]?_[_0x5b49('0x27')](_0xdb15e9[_0x5b49('0x26')],function(_0x3dfe61){return{'model':db[_0x3dfe61['model']],'as':_0x3dfe61['as'],'attributes':_0x3dfe61['attributes'],'include':_0x3dfe61[_0x5b49('0x26')]?_['map'](_0x3dfe61[_0x5b49('0x26')],function(_0x42379e){return{'model':db[_0x42379e[_0x5b49('0x28')]],'as':_0x42379e['as'],'attributes':_0x42379e[_0x5b49('0x24')]};}):[]};}):[]};}):[]:[]})[_0x5b49('0x14')](function(_0x5834bc){logger[_0x5b49('0x15')]('GetSmsQueue',_0xbfa428);logger[_0x5b49('0x17')](_0x5b49('0x29'),_0xbfa428,JSON['stringify'](_0x5834bc));_0x4e372d(_0x5834bc);})[_0x5b49('0x1f')](function(_0x641455){logger[_0x5b49('0x1b')](_0x5b49('0x29'),_0x641455['message'],_0xbfa428);_0x3042d6(_0x44b7cc[_0x5b49('0x1b')](0x1f4,_0x641455['message']));});});};exports[_0x5b49('0x2a')]=function(_0x415ec0){var _0x493d7b=this;return new Promise(function(_0x28c027,_0x52ef23){return db[_0x5b49('0x20')][_0x5b49('0x2b')]({'raw':_0x415ec0['options']?_0x415ec0[_0x5b49('0x22')]['raw']===undefined?!![]:![]:!![],'where':_0x415ec0['options']?_0x415ec0['options'][_0x5b49('0x2c')]||null:null,'attributes':_0x415ec0[_0x5b49('0x22')]?_0x415ec0[_0x5b49('0x22')][_0x5b49('0x24')]||null:null,'include':_0x415ec0[_0x5b49('0x22')]?_0x415ec0[_0x5b49('0x22')][_0x5b49('0x26')]?_[_0x5b49('0x27')](_0x415ec0[_0x5b49('0x22')][_0x5b49('0x26')],function(_0x524c58){return{'model':db[_0x524c58[_0x5b49('0x28')]],'as':_0x524c58['as'],'attributes':_0x524c58['attributes'],'include':_0x524c58['include']?_[_0x5b49('0x27')](_0x524c58[_0x5b49('0x26')],function(_0x2fdb3f){return{'model':db[_0x2fdb3f[_0x5b49('0x28')]],'as':_0x2fdb3f['as'],'attributes':_0x2fdb3f[_0x5b49('0x24')],'include':_0x2fdb3f[_0x5b49('0x26')]?_[_0x5b49('0x27')](_0x2fdb3f[_0x5b49('0x26')],function(_0x151c63){return{'model':db[_0x151c63[_0x5b49('0x28')]],'as':_0x151c63['as'],'attributes':_0x151c63[_0x5b49('0x24')]};}):[]};}):[]};}):[]:[]})[_0x5b49('0x14')](function(_0x207f07){logger['info'](_0x5b49('0x2a'),_0x415ec0);logger[_0x5b49('0x17')](_0x5b49('0x2a'),_0x415ec0,JSON[_0x5b49('0x1a')](_0x207f07));_0x28c027(_0x207f07);})[_0x5b49('0x1f')](function(_0x3ea906){logger[_0x5b49('0x1b')](_0x5b49('0x2a'),_0x3ea906[_0x5b49('0x1d')],_0x415ec0);_0x52ef23(_0x493d7b[_0x5b49('0x1b')](0x1f4,_0x3ea906[_0x5b49('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index afec973..b527007 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 _0x78b7=['removeListener','length','smsQueue:','./smsQueue.events','save','remove','update'];(function(_0x559ce2,_0x257fe8){var _0x5f31a4=function(_0x33cb27){while(--_0x33cb27){_0x559ce2['push'](_0x559ce2['shift']());}};_0x5f31a4(++_0x257fe8);}(_0x78b7,0x9d));var _0x778b=function(_0x3ecd06,_0x5246c8){_0x3ecd06=_0x3ecd06-0x0;var _0x31606d=_0x78b7[_0x3ecd06];return _0x31606d;};'use strict';var SmsQueueEvents=require(_0x778b('0x0'));var events=[_0x778b('0x1'),_0x778b('0x2'),_0x778b('0x3')];function createListener(_0x5ebde7,_0x1a21cc){return function(_0x350c6b){_0x1a21cc['emit'](_0x5ebde7,_0x350c6b);};}function removeListener(_0x1205fd,_0x34d449){return function(){SmsQueueEvents[_0x778b('0x4')](_0x1205fd,_0x34d449);};}exports['register']=function(_0x496647){for(var _0x3cfedb=0x0,_0x43b469=events[_0x778b('0x5')];_0x3cfedb<_0x43b469;_0x3cfedb++){var _0x15008e=events[_0x3cfedb];var _0x220519=createListener(_0x778b('0x6')+_0x15008e,_0x496647);SmsQueueEvents['on'](_0x15008e,_0x220519);}}; \ No newline at end of file +var _0xb9cf=['register','length','smsQueue:','./smsQueue.events','save','remove','update','removeListener'];(function(_0x36d64f,_0x125060){var _0x444629=function(_0x2f8025){while(--_0x2f8025){_0x36d64f['push'](_0x36d64f['shift']());}};_0x444629(++_0x125060);}(_0xb9cf,0x14b));var _0xfb9c=function(_0x4dcbef,_0x1aca1c){_0x4dcbef=_0x4dcbef-0x0;var _0x283f61=_0xb9cf[_0x4dcbef];return _0x283f61;};'use strict';var SmsQueueEvents=require(_0xfb9c('0x0'));var events=[_0xfb9c('0x1'),_0xfb9c('0x2'),_0xfb9c('0x3')];function createListener(_0x391623,_0x58d24c){return function(_0x4ac27f){_0x58d24c['emit'](_0x391623,_0x4ac27f);};}function removeListener(_0x3a7434,_0x1845c7){return function(){SmsQueueEvents[_0xfb9c('0x4')](_0x3a7434,_0x1845c7);};}exports[_0xfb9c('0x5')]=function(_0x5a3611){for(var _0x6ce4cc=0x0,_0x3f9b83=events[_0xfb9c('0x6')];_0x6ce4cc<_0x3f9b83;_0x6ce4cc++){var _0x38b187=events[_0x6ce4cc];var _0x328eca=createListener(_0xfb9c('0x7')+_0x38b187,_0x5a3611);SmsQueueEvents['on'](_0x38b187,_0x328eca);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 83e4aad..7924c53 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 _0x1c3b=['isAuthenticated','index','get','/:id','show','post','put','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller'];(function(_0x17369c,_0x57e58f){var _0x5d558e=function(_0x2c1039){while(--_0x2c1039){_0x17369c['push'](_0x17369c['shift']());}};_0x5d558e(++_0x57e58f);}(_0x1c3b,0xab));var _0xb1c3=function(_0x4ec082,_0x283489){_0x4ec082=_0x4ec082-0x0;var _0x31deb0=_0x1c3b[_0x4ec082];return _0x31deb0;};'use strict';var multer=require(_0xb1c3('0x0'));var util=require(_0xb1c3('0x1'));var path=require(_0xb1c3('0x2'));var timeout=require('connect-timeout');var express=require('express');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')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xb1c3('0xc'),auth['isAuthenticated'](),controller[_0xb1c3('0xd')]);router[_0xb1c3('0xe')]('/',auth[_0xb1c3('0x9')](),controller['create']);router[_0xb1c3('0xf')](_0xb1c3('0xc'),auth[_0xb1c3('0x9')](),controller['update']);router[_0xb1c3('0x10')](_0xb1c3('0xc'),auth[_0xb1c3('0x9')](),controller[_0xb1c3('0x11')]);module['exports']=router; \ No newline at end of file +var _0xbfc0=['index','/describe','describe','/:id','show','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x9007ea,_0x4094cf){var _0x43f6ee=function(_0x1f5fd4){while(--_0x1f5fd4){_0x9007ea['push'](_0x9007ea['shift']());}};_0x43f6ee(++_0x4094cf);}(_0xbfc0,0x125));var _0x0bfc=function(_0x1894e7,_0x1253e6){_0x1894e7=_0x1894e7-0x0;var _0x5e857f=_0xbfc0[_0x1894e7];return _0x5e857f;};'use strict';var multer=require(_0x0bfc('0x0'));var util=require(_0x0bfc('0x1'));var path=require(_0x0bfc('0x2'));var timeout=require(_0x0bfc('0x3'));var express=require(_0x0bfc('0x4'));var router=express[_0x0bfc('0x5')]();var fs_extra=require(_0x0bfc('0x6'));var auth=require(_0x0bfc('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0bfc('0x8'));var controller=require('./smsQueueReport.controller');router[_0x0bfc('0x9')]('/',auth[_0x0bfc('0xa')](),controller[_0x0bfc('0xb')]);router[_0x0bfc('0x9')](_0x0bfc('0xc'),auth[_0x0bfc('0xa')](),controller[_0x0bfc('0xd')]);router[_0x0bfc('0x9')](_0x0bfc('0xe'),auth['isAuthenticated'](),controller[_0x0bfc('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x0bfc('0x10')]('/:id',auth[_0x0bfc('0xa')](),controller['update']);router['delete'](_0x0bfc('0xe'),auth[_0x0bfc('0xa')](),controller[_0x0bfc('0x11')]);module[_0x0bfc('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 567e019..7062c45 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 _0xb046=['exports','STRING','DATE','moment','sequelize'];(function(_0x379d16,_0x330a57){var _0x2a9e29=function(_0x321967){while(--_0x321967){_0x379d16['push'](_0x379d16['shift']());}};_0x2a9e29(++_0x330a57);}(_0xb046,0x193));var _0x6b04=function(_0x3c6dce,_0x5424dd){_0x3c6dce=_0x3c6dce-0x0;var _0x1450e9=_0xb046[_0x3c6dce];return _0x1450e9;};'use strict';var moment=require(_0x6b04('0x0'));var Sequelize=require(_0x6b04('0x1'));module[_0x6b04('0x2')]={'uniqueid':{'type':Sequelize[_0x6b04('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x6b04('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x6b04('0x4')]},'acceptAt':{'type':Sequelize[_0x6b04('0x4')]},'exitAt':{'type':Sequelize[_0x6b04('0x4')]},'reason':{'type':Sequelize[_0x6b04('0x3')]}}; \ No newline at end of file +var _0x6927=['STRING','DATE','moment','exports'];(function(_0x3c99f6,_0x44a9bd){var _0x3feccd=function(_0x215704){while(--_0x215704){_0x3c99f6['push'](_0x3c99f6['shift']());}};_0x3feccd(++_0x44a9bd);}(_0x6927,0xf6));var _0x7692=function(_0x5a367c,_0x30a599){_0x5a367c=_0x5a367c-0x0;var _0x13be54=_0x6927[_0x5a367c];return _0x13be54;};'use strict';var moment=require(_0x7692('0x0'));var Sequelize=require('sequelize');module[_0x7692('0x1')]={'uniqueid':{'type':Sequelize[_0x7692('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7692('0x2')]},'joinAt':{'type':Sequelize[_0x7692('0x3')]},'leaveAt':{'type':Sequelize[_0x7692('0x3')]},'acceptAt':{'type':Sequelize[_0x7692('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x7692('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 42053b8..b50826e 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 _0x34c1=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','destroy','error','stack','name','send','map','SmsQueueReport','rawAttributes','type','model','query','keys','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','rows','catch','params','intersection','create','update','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0xeb3872,_0x9b3206){var _0x3f8e1b=function(_0x1a3b6e){while(--_0x1a3b6e){_0xeb3872['push'](_0xeb3872['shift']());}};_0x3f8e1b(++_0x9b3206);}(_0x34c1,0x81));var _0x134c=function(_0x2258e8,_0x396f17){_0x2258e8=_0x2258e8-0x0;var _0x539892=_0x34c1[_0x2258e8];return _0x539892;};'use strict';var emlformat=require(_0x134c('0x0'));var rimraf=require(_0x134c('0x1'));var zipdir=require(_0x134c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x134c('0x3'));var moment=require(_0x134c('0x4'));var BPromise=require(_0x134c('0x5'));var Mustache=require(_0x134c('0x6'));var util=require(_0x134c('0x7'));var path=require(_0x134c('0x8'));var sox=require(_0x134c('0x9'));var csv=require(_0x134c('0xa'));var ejs=require(_0x134c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x134c('0xc'));var squel=require(_0x134c('0xd'));var crypto=require(_0x134c('0xe'));var jsforce=require(_0x134c('0xf'));var deskjs=require(_0x134c('0x10'));var toCsv=require(_0x134c('0xa'));var querystring=require(_0x134c('0x11'));var Papa=require(_0x134c('0x12'));var Redis=require(_0x134c('0x13'));var authService=require(_0x134c('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x134c('0x15'));var hardwareService=require(_0x134c('0x16'));var logger=require(_0x134c('0x17'))(_0x134c('0x18'));var utils=require(_0x134c('0x19'));var config=require(_0x134c('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x134c('0x1b'))['db'];function respondWithStatusCode(_0x3aa1b0,_0x3aa999){_0x3aa999=_0x3aa999||0xcc;return function(_0x4378bd){if(_0x4378bd){return _0x3aa1b0[_0x134c('0x1c')](_0x3aa999);}return _0x3aa1b0[_0x134c('0x1d')](_0x3aa999)[_0x134c('0x1e')]();};}function respondWithResult(_0x2b3c47,_0x307030){_0x307030=_0x307030||0xc8;return function(_0x13f4cd){if(_0x13f4cd){return _0x2b3c47['status'](_0x307030)[_0x134c('0x1f')](_0x13f4cd);}};}function respondWithFilteredResult(_0x2de9f9,_0x389ae0){return function(_0x3fe672){if(_0x3fe672){var _0x526a0f=typeof _0x389ae0[_0x134c('0x20')]===_0x134c('0x21')&&typeof _0x389ae0['limit']===_0x134c('0x21');var _0x36d9a0=_0x3fe672['count'];var _0x1d3f49=_0x526a0f?0x0:_0x389ae0['offset'];var _0x43c27f=_0x526a0f?_0x3fe672[_0x134c('0x22')]:_0x389ae0['offset']+_0x389ae0[_0x134c('0x23')];var _0x3f3d21;if(_0x43c27f>=_0x36d9a0){_0x43c27f=_0x36d9a0;_0x3f3d21=0xc8;}else{_0x3f3d21=0xce;}_0x2de9f9[_0x134c('0x1d')](_0x3f3d21);return _0x2de9f9['set'](_0x134c('0x24'),_0x1d3f49+'-'+_0x43c27f+'/'+_0x36d9a0)[_0x134c('0x1f')](_0x3fe672);}return null;};}function patchUpdates(_0x10b0d){return function(_0x42d0b8){try{jsonpatch[_0x134c('0x25')](_0x42d0b8,_0x10b0d,!![]);}catch(_0x36c998){return BPromise[_0x134c('0x26')](_0x36c998);}return _0x42d0b8[_0x134c('0x27')]();};}function saveUpdates(_0x55e3e6,_0x3a17e3){return function(_0x3d8ecd){if(_0x3d8ecd){return _0x3d8ecd['update'](_0x55e3e6)['then'](function(_0x11f4c9){return _0x11f4c9;});}return null;};}function removeEntity(_0x41304f,_0x3fffe9){return function(_0x48e56c){if(_0x48e56c){return _0x48e56c[_0x134c('0x28')]()['then'](function(){_0x41304f[_0x134c('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x107d21,_0x213a07){return function(_0x5c3de0){if(!_0x5c3de0){_0x107d21[_0x134c('0x1c')](0x194);}return _0x5c3de0;};}function handleError(_0x3dc949,_0x488a34){_0x488a34=_0x488a34||0x1f4;return function(_0x5f3aed){logger[_0x134c('0x29')](_0x5f3aed[_0x134c('0x2a')]);if(_0x5f3aed[_0x134c('0x2b')]){delete _0x5f3aed[_0x134c('0x2b')];}_0x3dc949[_0x134c('0x1d')](_0x488a34)[_0x134c('0x2c')](_0x5f3aed);};}exports['index']=function(_0x11983c,_0x3bb522){var _0x3150b3={},_0x280f5b={},_0x18262c={'count':0x0,'rows':[]};var _0x230b60=_[_0x134c('0x2d')](db[_0x134c('0x2e')][_0x134c('0x2f')],function(_0x1c664a){return{'name':_0x1c664a['fieldName'],'type':_0x1c664a[_0x134c('0x30')]['key']};});_0x280f5b[_0x134c('0x31')]=_[_0x134c('0x2d')](_0x230b60,_0x134c('0x2b'));_0x280f5b[_0x134c('0x32')]=_[_0x134c('0x33')](_0x11983c[_0x134c('0x32')]);_0x280f5b['filters']=_['intersection'](_0x280f5b[_0x134c('0x31')],_0x280f5b[_0x134c('0x32')]);_0x3150b3[_0x134c('0x34')]=_['intersection'](_0x280f5b['model'],qs[_0x134c('0x35')](_0x11983c[_0x134c('0x32')]['fields']));_0x3150b3[_0x134c('0x34')]=_0x3150b3[_0x134c('0x34')][_0x134c('0x36')]?_0x3150b3[_0x134c('0x34')]:_0x280f5b[_0x134c('0x31')];if(!_0x11983c[_0x134c('0x32')][_0x134c('0x37')]('nolimit')){_0x3150b3[_0x134c('0x23')]=qs[_0x134c('0x23')](_0x11983c[_0x134c('0x32')][_0x134c('0x23')]);_0x3150b3[_0x134c('0x20')]=qs[_0x134c('0x20')](_0x11983c[_0x134c('0x32')]['offset']);}_0x3150b3['order']=qs[_0x134c('0x38')](_0x11983c['query'][_0x134c('0x38')]);_0x3150b3[_0x134c('0x39')]=qs[_0x134c('0x3a')](_[_0x134c('0x3b')](_0x11983c[_0x134c('0x32')],_0x280f5b['filters']),_0x230b60);if(_0x11983c[_0x134c('0x32')]['filter']){_0x3150b3[_0x134c('0x39')]=_[_0x134c('0x3c')](_0x3150b3[_0x134c('0x39')],{'$or':_[_0x134c('0x2d')](_0x230b60,function(_0x4866a2){if(_0x4866a2[_0x134c('0x30')]!==_0x134c('0x3d')){var _0x158ec6={};_0x158ec6[_0x4866a2[_0x134c('0x2b')]]={'$like':'%'+_0x11983c[_0x134c('0x32')][_0x134c('0x3e')]+'%'};return _0x158ec6;}})});}_0x3150b3=_[_0x134c('0x3c')]({},_0x3150b3,_0x11983c[_0x134c('0x3f')]);var _0x3bd67b={'where':_0x3150b3[_0x134c('0x39')]};return db[_0x134c('0x2e')]['count'](_0x3bd67b)[_0x134c('0x40')](function(_0x1f999b){_0x18262c[_0x134c('0x22')]=_0x1f999b;if(_0x11983c[_0x134c('0x32')][_0x134c('0x41')]){_0x3150b3[_0x134c('0x42')]=[{'all':!![]}];}return db[_0x134c('0x2e')][_0x134c('0x43')](_0x3150b3);})['then'](function(_0x349422){_0x18262c[_0x134c('0x44')]=_0x349422;return _0x18262c;})['then'](respondWithFilteredResult(_0x3bb522,_0x3150b3))[_0x134c('0x45')](handleError(_0x3bb522,null));};exports['show']=function(_0x537a1e,_0x50f0d1){var _0x361122={'raw':!![],'where':{'id':_0x537a1e[_0x134c('0x46')]['id']}},_0x546851={};_0x546851[_0x134c('0x31')]=_['keys'](db[_0x134c('0x2e')]['rawAttributes']);_0x546851['query']=_['keys'](_0x537a1e[_0x134c('0x32')]);_0x546851['filters']=_['intersection'](_0x546851[_0x134c('0x31')],_0x546851['query']);_0x361122['attributes']=_[_0x134c('0x47')](_0x546851[_0x134c('0x31')],qs[_0x134c('0x35')](_0x537a1e[_0x134c('0x32')][_0x134c('0x35')]));_0x361122[_0x134c('0x34')]=_0x361122[_0x134c('0x34')][_0x134c('0x36')]?_0x361122['attributes']:_0x546851[_0x134c('0x31')];if(_0x537a1e[_0x134c('0x32')][_0x134c('0x41')]){_0x361122[_0x134c('0x42')]=[{'all':!![]}];}_0x361122=_['merge']({},_0x361122,_0x537a1e[_0x134c('0x3f')]);return db['SmsQueueReport']['find'](_0x361122)[_0x134c('0x40')](handleEntityNotFound(_0x50f0d1,null))['then'](respondWithResult(_0x50f0d1,null))[_0x134c('0x45')](handleError(_0x50f0d1,null));};exports['create']=function(_0x322e5f,_0x4a5d61){return db[_0x134c('0x2e')][_0x134c('0x48')](_0x322e5f['body'],{})[_0x134c('0x40')](respondWithResult(_0x4a5d61,0xc9))[_0x134c('0x45')](handleError(_0x4a5d61,null));};exports[_0x134c('0x49')]=function(_0x568453,_0x2df2b3){if(_0x568453[_0x134c('0x4a')]['id']){delete _0x568453[_0x134c('0x4a')]['id'];}return db['SmsQueueReport'][_0x134c('0x4b')]({'where':{'id':_0x568453[_0x134c('0x46')]['id']}})[_0x134c('0x40')](handleEntityNotFound(_0x2df2b3,null))[_0x134c('0x40')](saveUpdates(_0x568453[_0x134c('0x4a')],null))[_0x134c('0x40')](respondWithResult(_0x2df2b3,null))['catch'](handleError(_0x2df2b3,null));};exports[_0x134c('0x28')]=function(_0x5512b7,_0x51cdd3){return db[_0x134c('0x2e')][_0x134c('0x4b')]({'where':{'id':_0x5512b7['params']['id']}})[_0x134c('0x40')](handleEntityNotFound(_0x51cdd3,null))[_0x134c('0x40')](removeEntity(_0x51cdd3,null))['catch'](handleError(_0x51cdd3,null));};exports[_0x134c('0x4c')]=function(_0x8826a9,_0x5d4586){return db[_0x134c('0x2e')][_0x134c('0x4c')]()[_0x134c('0x40')](respondWithResult(_0x5d4586,null))[_0x134c('0x45')](handleError(_0x5d4586,null));}; \ No newline at end of file +var _0xcfbc=['eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','SmsQueueReport','includeAll','include','findAll','rows','catch','show','params','options','create','body','find'];(function(_0x304d22,_0x40537c){var _0x11694b=function(_0x121b59){while(--_0x121b59){_0x304d22['push'](_0x304d22['shift']());}};_0x11694b(++_0x40537c);}(_0xcfbc,0xf0));var _0xccfb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcfbc[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xccfb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xccfb('0x1'));var jsonpatch=require(_0xccfb('0x2'));var rp=require(_0xccfb('0x3'));var moment=require(_0xccfb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xccfb('0x5'));var util=require(_0xccfb('0x6'));var path=require(_0xccfb('0x7'));var sox=require(_0xccfb('0x8'));var csv=require(_0xccfb('0x9'));var ejs=require(_0xccfb('0xa'));var fs=require('fs');var fs_extra=require(_0xccfb('0xb'));var _=require(_0xccfb('0xc'));var squel=require(_0xccfb('0xd'));var crypto=require(_0xccfb('0xe'));var jsforce=require(_0xccfb('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xccfb('0x9'));var querystring=require(_0xccfb('0x10'));var Papa=require(_0xccfb('0x11'));var Redis=require(_0xccfb('0x12'));var authService=require(_0xccfb('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xccfb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xccfb('0x15'))(_0xccfb('0x16'));var utils=require(_0xccfb('0x17'));var config=require(_0xccfb('0x18'));var licenseUtil=require(_0xccfb('0x19'));var db=require(_0xccfb('0x1a'))['db'];function respondWithStatusCode(_0x2711b5,_0x512dcf){_0x512dcf=_0x512dcf||0xcc;return function(_0x33c7aa){if(_0x33c7aa){return _0x2711b5[_0xccfb('0x1b')](_0x512dcf);}return _0x2711b5[_0xccfb('0x1c')](_0x512dcf)[_0xccfb('0x1d')]();};}function respondWithResult(_0x36f60c,_0x5f1021){_0x5f1021=_0x5f1021||0xc8;return function(_0x2bc71a){if(_0x2bc71a){return _0x36f60c['status'](_0x5f1021)[_0xccfb('0x1e')](_0x2bc71a);}};}function respondWithFilteredResult(_0x52f462,_0x43cdec){return function(_0x3346ea){if(_0x3346ea){var _0x3f5c2c=typeof _0x43cdec[_0xccfb('0x1f')]===_0xccfb('0x20')&&typeof _0x43cdec[_0xccfb('0x21')]===_0xccfb('0x20');var _0x208259=_0x3346ea[_0xccfb('0x22')];var _0x591d94=_0x3f5c2c?0x0:_0x43cdec[_0xccfb('0x1f')];var _0x5f524c=_0x3f5c2c?_0x3346ea[_0xccfb('0x22')]:_0x43cdec['offset']+_0x43cdec[_0xccfb('0x21')];var _0x6ee579;if(_0x5f524c>=_0x208259){_0x5f524c=_0x208259;_0x6ee579=0xc8;}else{_0x6ee579=0xce;}_0x52f462[_0xccfb('0x1c')](_0x6ee579);return _0x52f462['set'](_0xccfb('0x23'),_0x591d94+'-'+_0x5f524c+'/'+_0x208259)[_0xccfb('0x1e')](_0x3346ea);}return null;};}function patchUpdates(_0x49c17c){return function(_0x2d93e4){try{jsonpatch[_0xccfb('0x24')](_0x2d93e4,_0x49c17c,!![]);}catch(_0x2274cb){return BPromise[_0xccfb('0x25')](_0x2274cb);}return _0x2d93e4[_0xccfb('0x26')]();};}function saveUpdates(_0x936b67,_0x2312ad){return function(_0x28e382){if(_0x28e382){return _0x28e382[_0xccfb('0x27')](_0x936b67)[_0xccfb('0x28')](function(_0x18d103){return _0x18d103;});}return null;};}function removeEntity(_0x73c1c2,_0x96fa92){return function(_0x59612d){if(_0x59612d){return _0x59612d[_0xccfb('0x29')]()[_0xccfb('0x28')](function(){_0x73c1c2[_0xccfb('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b1a05,_0x23297b){return function(_0x278261){if(!_0x278261){_0x5b1a05[_0xccfb('0x1b')](0x194);}return _0x278261;};}function handleError(_0x16d0b7,_0x524524){_0x524524=_0x524524||0x1f4;return function(_0x17d6da){logger[_0xccfb('0x2a')](_0x17d6da[_0xccfb('0x2b')]);if(_0x17d6da[_0xccfb('0x2c')]){delete _0x17d6da[_0xccfb('0x2c')];}_0x16d0b7[_0xccfb('0x1c')](_0x524524)[_0xccfb('0x2d')](_0x17d6da);};}exports[_0xccfb('0x2e')]=function(_0x1c4881,_0x20fc5e){var _0x4d208d={},_0x16837f={},_0x432f08={'count':0x0,'rows':[]};var _0x24be9e=_[_0xccfb('0x2f')](db['SmsQueueReport'][_0xccfb('0x30')],function(_0x2ec075){return{'name':_0x2ec075[_0xccfb('0x31')],'type':_0x2ec075[_0xccfb('0x32')][_0xccfb('0x33')]};});_0x16837f[_0xccfb('0x34')]=_[_0xccfb('0x2f')](_0x24be9e,_0xccfb('0x2c'));_0x16837f['query']=_[_0xccfb('0x35')](_0x1c4881[_0xccfb('0x36')]);_0x16837f[_0xccfb('0x37')]=_[_0xccfb('0x38')](_0x16837f[_0xccfb('0x34')],_0x16837f[_0xccfb('0x36')]);_0x4d208d['attributes']=_[_0xccfb('0x38')](_0x16837f[_0xccfb('0x34')],qs[_0xccfb('0x39')](_0x1c4881[_0xccfb('0x36')]['fields']));_0x4d208d[_0xccfb('0x3a')]=_0x4d208d[_0xccfb('0x3a')][_0xccfb('0x3b')]?_0x4d208d[_0xccfb('0x3a')]:_0x16837f[_0xccfb('0x34')];if(!_0x1c4881[_0xccfb('0x36')][_0xccfb('0x3c')]('nolimit')){_0x4d208d[_0xccfb('0x21')]=qs['limit'](_0x1c4881[_0xccfb('0x36')][_0xccfb('0x21')]);_0x4d208d['offset']=qs['offset'](_0x1c4881['query'][_0xccfb('0x1f')]);}_0x4d208d[_0xccfb('0x3d')]=qs[_0xccfb('0x3e')](_0x1c4881['query'][_0xccfb('0x3e')]);_0x4d208d['where']=qs['filters'](_[_0xccfb('0x3f')](_0x1c4881[_0xccfb('0x36')],_0x16837f['filters']),_0x24be9e);if(_0x1c4881[_0xccfb('0x36')][_0xccfb('0x40')]){_0x4d208d[_0xccfb('0x41')]=_[_0xccfb('0x42')](_0x4d208d['where'],{'$or':_[_0xccfb('0x2f')](_0x24be9e,function(_0x2cca49){if(_0x2cca49[_0xccfb('0x32')]!==_0xccfb('0x43')){var _0x35d4ee={};_0x35d4ee[_0x2cca49[_0xccfb('0x2c')]]={'$like':'%'+_0x1c4881[_0xccfb('0x36')][_0xccfb('0x40')]+'%'};return _0x35d4ee;}})});}_0x4d208d=_[_0xccfb('0x42')]({},_0x4d208d,_0x1c4881['options']);var _0x12db07={'where':_0x4d208d['where']};return db[_0xccfb('0x44')][_0xccfb('0x22')](_0x12db07)[_0xccfb('0x28')](function(_0x241506){_0x432f08[_0xccfb('0x22')]=_0x241506;if(_0x1c4881[_0xccfb('0x36')][_0xccfb('0x45')]){_0x4d208d[_0xccfb('0x46')]=[{'all':!![]}];}return db[_0xccfb('0x44')][_0xccfb('0x47')](_0x4d208d);})[_0xccfb('0x28')](function(_0x5835f8){_0x432f08[_0xccfb('0x48')]=_0x5835f8;return _0x432f08;})['then'](respondWithFilteredResult(_0x20fc5e,_0x4d208d))[_0xccfb('0x49')](handleError(_0x20fc5e,null));};exports[_0xccfb('0x4a')]=function(_0x57eb3a,_0x6fa99b){var _0x741259={'raw':!![],'where':{'id':_0x57eb3a[_0xccfb('0x4b')]['id']}},_0x52dd93={};_0x52dd93[_0xccfb('0x34')]=_[_0xccfb('0x35')](db['SmsQueueReport'][_0xccfb('0x30')]);_0x52dd93[_0xccfb('0x36')]=_[_0xccfb('0x35')](_0x57eb3a[_0xccfb('0x36')]);_0x52dd93[_0xccfb('0x37')]=_[_0xccfb('0x38')](_0x52dd93[_0xccfb('0x34')],_0x52dd93[_0xccfb('0x36')]);_0x741259[_0xccfb('0x3a')]=_[_0xccfb('0x38')](_0x52dd93[_0xccfb('0x34')],qs['fields'](_0x57eb3a[_0xccfb('0x36')][_0xccfb('0x39')]));_0x741259[_0xccfb('0x3a')]=_0x741259[_0xccfb('0x3a')][_0xccfb('0x3b')]?_0x741259['attributes']:_0x52dd93[_0xccfb('0x34')];if(_0x57eb3a[_0xccfb('0x36')][_0xccfb('0x45')]){_0x741259[_0xccfb('0x46')]=[{'all':!![]}];}_0x741259=_['merge']({},_0x741259,_0x57eb3a[_0xccfb('0x4c')]);return db[_0xccfb('0x44')]['find'](_0x741259)[_0xccfb('0x28')](handleEntityNotFound(_0x6fa99b,null))[_0xccfb('0x28')](respondWithResult(_0x6fa99b,null))[_0xccfb('0x49')](handleError(_0x6fa99b,null));};exports[_0xccfb('0x4d')]=function(_0x1c5704,_0x1cdc26){return db[_0xccfb('0x44')][_0xccfb('0x4d')](_0x1c5704[_0xccfb('0x4e')],{})[_0xccfb('0x28')](respondWithResult(_0x1cdc26,0xc9))['catch'](handleError(_0x1cdc26,null));};exports['update']=function(_0x33be66,_0x27c243){if(_0x33be66['body']['id']){delete _0x33be66[_0xccfb('0x4e')]['id'];}return db[_0xccfb('0x44')][_0xccfb('0x4f')]({'where':{'id':_0x33be66[_0xccfb('0x4b')]['id']}})[_0xccfb('0x28')](handleEntityNotFound(_0x27c243,null))[_0xccfb('0x28')](saveUpdates(_0x33be66[_0xccfb('0x4e')],null))['then'](respondWithResult(_0x27c243,null))[_0xccfb('0x49')](handleError(_0x27c243,null));};exports[_0xccfb('0x29')]=function(_0xba129c,_0x1e6d36){return db[_0xccfb('0x44')][_0xccfb('0x4f')]({'where':{'id':_0xba129c['params']['id']}})[_0xccfb('0x28')](handleEntityNotFound(_0x1e6d36,null))[_0xccfb('0x28')](removeEntity(_0x1e6d36,null))[_0xccfb('0x49')](handleError(_0x1e6d36,null));};exports['describe']=function(_0x4eb2a4,_0xbf63e3){return db[_0xccfb('0x44')]['describe']()[_0xccfb('0x28')](respondWithResult(_0xbf63e3,null))[_0xccfb('0x49')](handleError(_0xbf63e3,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 68a826f..5aac525 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xb5a683,_0x17e5ab){var _0x56d26e=function(_0x5a2003){while(--_0x5a2003){_0xb5a683['push'](_0xb5a683['shift']());}};_0x56d26e(++_0x17e5ab);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5d2450,_0x15d4a4){var _0x394ef3=function(_0x4cb4c9){while(--_0x4cb4c9){_0x5d2450['push'](_0x5d2450['shift']());}};_0x394ef3(++_0x15d4a4);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 61f5355..5e3bb26 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 _0x0b80=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','result','SmsQueueReport','create','body','options','raw','info','CreateSmsQueueReport','debug','UpdateSmsQueueReport','update','where','attributes','limit','moment','bluebird','randomstring','ioredis'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x0b80,0x125));var _0x00b8=function(_0x5e0363,_0x4c49fb){_0x5e0363=_0x5e0363-0x0;var _0x5d55a8=_0x0b80[_0x5e0363];return _0x5d55a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x00b8('0x0'));var BPromise=require(_0x00b8('0x1'));var rs=require(_0x00b8('0x2'));var fs=require('fs');var Redis=require(_0x00b8('0x3'));var db=require(_0x00b8('0x4'))['db'];var utils=require(_0x00b8('0x5'));var logger=require(_0x00b8('0x6'))(_0x00b8('0x7'));var config=require(_0x00b8('0x8'));var jayson=require(_0x00b8('0x9'));var client=jayson[_0x00b8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xad9693,_0x1de817,_0x4a4002){return new BPromise(function(_0x4688e4,_0x45ce12){return client[_0x00b8('0xb')](_0xad9693,_0x4a4002)[_0x00b8('0xc')](function(_0x1e294f){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x1de817,_0x00b8('0xd'));logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x1de817,_0x00b8('0xd'),JSON[_0x00b8('0xe')](_0x1e294f));if(_0x1e294f['error']){if(_0x1e294f[_0x00b8('0xf')][_0x00b8('0x10')]===0x1f4){logger['error'](_0x00b8('0x11'),_0x1de817,_0x1e294f[_0x00b8('0xf')][_0x00b8('0x12')]);return _0x45ce12(_0x1e294f[_0x00b8('0xf')][_0x00b8('0x12')]);}logger['error'](_0x00b8('0x11'),_0x1de817,_0x1e294f[_0x00b8('0xf')][_0x00b8('0x12')]);return _0x4688e4(_0x1e294f['error'][_0x00b8('0x12')]);}else{logger['info'](_0x00b8('0x11'),_0x1de817,'request\x20sent');_0x4688e4(_0x1e294f[_0x00b8('0x13')][_0x00b8('0x12')]);}})['catch'](function(_0xc5340f){logger[_0x00b8('0xf')](_0x00b8('0x11'),_0x1de817,_0xc5340f);_0x45ce12(_0xc5340f);});});}exports['CreateSmsQueueReport']=function(_0x492e69){var _0x2514bd=this;return new Promise(function(_0x1d787e,_0x169e88){return db[_0x00b8('0x14')][_0x00b8('0x15')](_0x492e69[_0x00b8('0x16')],{'raw':_0x492e69['options']?_0x492e69[_0x00b8('0x17')][_0x00b8('0x18')]===undefined?!![]:![]:!![]})[_0x00b8('0xc')](function(_0xbcb10c){logger[_0x00b8('0x19')](_0x00b8('0x1a'),_0x492e69);logger[_0x00b8('0x1b')](_0x00b8('0x1a'),_0x492e69,JSON['stringify'](_0xbcb10c));_0x1d787e(_0xbcb10c);})['catch'](function(_0x371f7c){logger[_0x00b8('0xf')](_0x00b8('0x1a'),_0x371f7c[_0x00b8('0x12')],_0x492e69);_0x169e88(_0x2514bd[_0x00b8('0xf')](0x1f4,_0x371f7c['message']));});});};exports[_0x00b8('0x1c')]=function(_0x5b7804){var _0x1d6ead=this;return new Promise(function(_0x4c2773,_0x34e91f){return db[_0x00b8('0x14')][_0x00b8('0x1d')](_0x5b7804[_0x00b8('0x16')],{'raw':_0x5b7804[_0x00b8('0x17')]?_0x5b7804[_0x00b8('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b7804[_0x00b8('0x17')]?_0x5b7804[_0x00b8('0x17')][_0x00b8('0x1e')]||null:null,'attributes':_0x5b7804[_0x00b8('0x17')]?_0x5b7804[_0x00b8('0x17')][_0x00b8('0x1f')]||null:null,'limit':_0x5b7804[_0x00b8('0x17')]?_0x5b7804[_0x00b8('0x17')][_0x00b8('0x20')]||null:null})[_0x00b8('0xc')](function(_0x43945d){logger[_0x00b8('0x19')]('UpdateSmsQueueReport',_0x5b7804);logger[_0x00b8('0x1b')](_0x00b8('0x1c'),_0x5b7804,JSON[_0x00b8('0xe')](_0x43945d));_0x4c2773(_0x43945d);})['catch'](function(_0x14000d){logger[_0x00b8('0xf')](_0x00b8('0x1c'),_0x14000d['message'],_0x5b7804);_0x34e91f(_0x1d6ead['error'](0x1f4,_0x14000d['message']));});});}; \ No newline at end of file +var _0x9a3c=['debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsQueueReport,\x20%s,\x20%s','result','catch','CreateSmsQueueReport','SmsQueueReport','body','options','raw','then','UpdateSmsQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent'];(function(_0x347884,_0xd8ef37){var _0x2cd3fa=function(_0xbeb1b8){while(--_0xbeb1b8){_0x347884['push'](_0x347884['shift']());}};_0x2cd3fa(++_0xd8ef37);}(_0x9a3c,0x1a0));var _0xc9a3=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x9a3c[_0x53cf8e];return _0x459197;};'use strict';var _=require(_0xc9a3('0x0'));var util=require(_0xc9a3('0x1'));var moment=require(_0xc9a3('0x2'));var BPromise=require(_0xc9a3('0x3'));var rs=require(_0xc9a3('0x4'));var fs=require('fs');var Redis=require(_0xc9a3('0x5'));var db=require(_0xc9a3('0x6'))['db'];var utils=require(_0xc9a3('0x7'));var logger=require(_0xc9a3('0x8'))(_0xc9a3('0x9'));var config=require(_0xc9a3('0xa'));var jayson=require(_0xc9a3('0xb'));var client=jayson[_0xc9a3('0xc')][_0xc9a3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x338b37,_0x9e4fac,_0x2df2e2){return new BPromise(function(_0x4e4eee,_0x2102e2){return client['request'](_0x338b37,_0x2df2e2)['then'](function(_0x1a678c){logger[_0xc9a3('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x9e4fac,_0xc9a3('0xf'));logger[_0xc9a3('0x10')](_0xc9a3('0x11'),_0x9e4fac,_0xc9a3('0xf'),JSON[_0xc9a3('0x12')](_0x1a678c));if(_0x1a678c[_0xc9a3('0x13')]){if(_0x1a678c[_0xc9a3('0x13')][_0xc9a3('0x14')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x9e4fac,_0x1a678c[_0xc9a3('0x13')][_0xc9a3('0x15')]);return _0x2102e2(_0x1a678c['error'][_0xc9a3('0x15')]);}logger[_0xc9a3('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x9e4fac,_0x1a678c[_0xc9a3('0x13')][_0xc9a3('0x15')]);return _0x4e4eee(_0x1a678c[_0xc9a3('0x13')][_0xc9a3('0x15')]);}else{logger[_0xc9a3('0xe')](_0xc9a3('0x16'),_0x9e4fac,_0xc9a3('0xf'));_0x4e4eee(_0x1a678c[_0xc9a3('0x17')]['message']);}})[_0xc9a3('0x18')](function(_0x1fb0c1){logger[_0xc9a3('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x9e4fac,_0x1fb0c1);_0x2102e2(_0x1fb0c1);});});}exports[_0xc9a3('0x19')]=function(_0x2fc2dd){var _0x2c700b=this;return new Promise(function(_0xbd2f69,_0x234dba){return db[_0xc9a3('0x1a')]['create'](_0x2fc2dd[_0xc9a3('0x1b')],{'raw':_0x2fc2dd['options']?_0x2fc2dd[_0xc9a3('0x1c')][_0xc9a3('0x1d')]===undefined?!![]:![]:!![]})[_0xc9a3('0x1e')](function(_0x2d6286){logger[_0xc9a3('0xe')](_0xc9a3('0x19'),_0x2fc2dd);logger['debug'](_0xc9a3('0x19'),_0x2fc2dd,JSON[_0xc9a3('0x12')](_0x2d6286));_0xbd2f69(_0x2d6286);})['catch'](function(_0x4effd9){logger['error'](_0xc9a3('0x19'),_0x4effd9[_0xc9a3('0x15')],_0x2fc2dd);_0x234dba(_0x2c700b[_0xc9a3('0x13')](0x1f4,_0x4effd9['message']));});});};exports[_0xc9a3('0x1f')]=function(_0x48d3f6){var _0x246688=this;return new Promise(function(_0x5caa4e,_0x383076){return db[_0xc9a3('0x1a')][_0xc9a3('0x20')](_0x48d3f6['body'],{'raw':_0x48d3f6[_0xc9a3('0x1c')]?_0x48d3f6['options'][_0xc9a3('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48d3f6[_0xc9a3('0x1c')]?_0x48d3f6[_0xc9a3('0x1c')][_0xc9a3('0x21')]||null:null,'attributes':_0x48d3f6[_0xc9a3('0x1c')]?_0x48d3f6[_0xc9a3('0x1c')][_0xc9a3('0x22')]||null:null,'limit':_0x48d3f6['options']?_0x48d3f6[_0xc9a3('0x1c')][_0xc9a3('0x23')]||null:null})[_0xc9a3('0x1e')](function(_0x2cac39){logger[_0xc9a3('0xe')](_0xc9a3('0x1f'),_0x48d3f6);logger['debug'](_0xc9a3('0x1f'),_0x48d3f6,JSON[_0xc9a3('0x12')](_0x2cac39));_0x5caa4e(_0x2cac39);})[_0xc9a3('0x18')](function(_0x415588){logger['error'](_0xc9a3('0x1f'),_0x415588[_0xc9a3('0x15')],_0x48d3f6);_0x383076(_0x246688[_0xc9a3('0x13')](0x1f4,_0x415588['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index b6fcf4c..2a8cb2f 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 _0x31af=['delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','update'];(function(_0x297162,_0x2a1207){var _0x1c1b89=function(_0x1d4c5a){while(--_0x1d4c5a){_0x297162['push'](_0x297162['shift']());}};_0x1c1b89(++_0x2a1207);}(_0x31af,0xde));var _0xf31a=function(_0x58727c,_0x1f16d7){_0x58727c=_0x58727c-0x0;var _0x5356e1=_0x31af[_0x58727c];return _0x5356e1;};'use strict';var multer=require(_0xf31a('0x0'));var util=require(_0xf31a('0x1'));var path=require(_0xf31a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf31a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf31a('0x4'));var interaction=require(_0xf31a('0x5'));var config=require(_0xf31a('0x6'));var controller=require(_0xf31a('0x7'));router['get']('/',auth[_0xf31a('0x8')](),controller[_0xf31a('0x9')]);router[_0xf31a('0xa')](_0xf31a('0xb'),auth['isAuthenticated'](),controller[_0xf31a('0xc')]);router[_0xf31a('0xa')](_0xf31a('0xd'),auth[_0xf31a('0x8')](),controller['show']);router[_0xf31a('0xe')]('/',auth[_0xf31a('0x8')](),controller[_0xf31a('0xf')]);router[_0xf31a('0x10')](_0xf31a('0xd'),auth['isAuthenticated'](),controller[_0xf31a('0x11')]);router[_0xf31a('0x12')](_0xf31a('0xd'),auth[_0xf31a('0x8')](),controller['destroy']);module[_0xf31a('0x13')]=router; \ No newline at end of file +var _0xe132=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe132,0x162));var _0x2e13=function(_0x3a1083,_0x175e1f){_0x3a1083=_0x3a1083-0x0;var _0x179a6d=_0xe132[_0x3a1083];return _0x179a6d;};'use strict';var multer=require(_0x2e13('0x0'));var util=require('util');var path=require(_0x2e13('0x1'));var timeout=require(_0x2e13('0x2'));var express=require(_0x2e13('0x3'));var router=express[_0x2e13('0x4')]();var fs_extra=require(_0x2e13('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2e13('0x6'));var config=require(_0x2e13('0x7'));var controller=require('./smsTransferReport.controller');router['get']('/',auth[_0x2e13('0x8')](),controller[_0x2e13('0x9')]);router[_0x2e13('0xa')](_0x2e13('0xb'),auth[_0x2e13('0x8')](),controller[_0x2e13('0xc')]);router[_0x2e13('0xa')](_0x2e13('0xd'),auth[_0x2e13('0x8')](),controller[_0x2e13('0xe')]);router['post']('/',auth[_0x2e13('0x8')](),controller[_0x2e13('0xf')]);router[_0x2e13('0x10')](_0x2e13('0xd'),auth[_0x2e13('0x8')](),controller[_0x2e13('0x11')]);router[_0x2e13('0x12')]('/:id',auth[_0x2e13('0x8')](),controller[_0x2e13('0x13')]);module[_0x2e13('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 559fc82..73d78cd 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0xb4cc12,_0x41436e){var _0x8593b5=function(_0x13b840){while(--_0x13b840){_0xb4cc12['push'](_0xb4cc12['shift']());}};_0x8593b5(++_0x41436e);}(_0xb43b,0x1b2));var _0xbb43=function(_0x27f29d,_0x245708){_0x27f29d=_0x27f29d-0x0;var _0x5b8aa9=_0xb43b[_0x27f29d];return _0x5b8aa9;};'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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0x9bde,0xe1));var _0xe9bd=function(_0xd08cdf,_0x1b73d2){_0xd08cdf=_0xd08cdf-0x0;var _0x5ca766=_0x9bde[_0xd08cdf];return _0x5ca766;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 107a5a7..c1164ab 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 _0x7328=['pick','filter','merge','options','include','SmsTransferReport','rows','catch','show','params','length','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','end','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','where'];(function(_0x1566a8,_0x1c71e4){var _0x88e2f5=function(_0x32b5d9){while(--_0x32b5d9){_0x1566a8['push'](_0x1566a8['shift']());}};_0x88e2f5(++_0x1c71e4);}(_0x7328,0xa5));var _0x8732=function(_0x3ac7de,_0x1aad90){_0x3ac7de=_0x3ac7de-0x0;var _0x2fb1f2=_0x7328[_0x3ac7de];return _0x2fb1f2;};'use strict';var emlformat=require(_0x8732('0x0'));var rimraf=require(_0x8732('0x1'));var zipdir=require(_0x8732('0x2'));var jsonpatch=require(_0x8732('0x3'));var rp=require(_0x8732('0x4'));var moment=require(_0x8732('0x5'));var BPromise=require(_0x8732('0x6'));var Mustache=require('mustache');var util=require(_0x8732('0x7'));var path=require(_0x8732('0x8'));var sox=require('sox');var csv=require(_0x8732('0x9'));var ejs=require(_0x8732('0xa'));var fs=require('fs');var fs_extra=require(_0x8732('0xb'));var _=require(_0x8732('0xc'));var squel=require(_0x8732('0xd'));var crypto=require(_0x8732('0xe'));var jsforce=require(_0x8732('0xf'));var deskjs=require(_0x8732('0x10'));var toCsv=require(_0x8732('0x9'));var querystring=require(_0x8732('0x11'));var Papa=require(_0x8732('0x12'));var Redis=require(_0x8732('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x8732('0x14'));var as=require(_0x8732('0x15'));var hardwareService=require(_0x8732('0x16'));var logger=require(_0x8732('0x17'))(_0x8732('0x18'));var utils=require('../../config/utils');var config=require(_0x8732('0x19'));var licenseUtil=require(_0x8732('0x1a'));var db=require(_0x8732('0x1b'))['db'];function respondWithStatusCode(_0x58c200,_0x122555){_0x122555=_0x122555||0xcc;return function(_0x1a3035){if(_0x1a3035){return _0x58c200[_0x8732('0x1c')](_0x122555);}return _0x58c200[_0x8732('0x1d')](_0x122555)['end']();};}function respondWithResult(_0x36d7dd,_0x3a9f33){_0x3a9f33=_0x3a9f33||0xc8;return function(_0x37253c){if(_0x37253c){return _0x36d7dd[_0x8732('0x1d')](_0x3a9f33)[_0x8732('0x1e')](_0x37253c);}};}function respondWithFilteredResult(_0x28a32e,_0x245208){return function(_0x1642fd){if(_0x1642fd){var _0x5a1563=typeof _0x245208['offset']===_0x8732('0x1f')&&typeof _0x245208[_0x8732('0x20')]===_0x8732('0x1f');var _0x4a1e54=_0x1642fd['count'];var _0x2bbbf9=_0x5a1563?0x0:_0x245208['offset'];var _0x4264f7=_0x5a1563?_0x1642fd[_0x8732('0x21')]:_0x245208[_0x8732('0x22')]+_0x245208[_0x8732('0x20')];var _0x3bf767;if(_0x4264f7>=_0x4a1e54){_0x4264f7=_0x4a1e54;_0x3bf767=0xc8;}else{_0x3bf767=0xce;}_0x28a32e[_0x8732('0x1d')](_0x3bf767);return _0x28a32e['set']('Content-Range',_0x2bbbf9+'-'+_0x4264f7+'/'+_0x4a1e54)['json'](_0x1642fd);}return null;};}function patchUpdates(_0x1aa41d){return function(_0x48d86f){try{jsonpatch[_0x8732('0x23')](_0x48d86f,_0x1aa41d,!![]);}catch(_0xe6bdf5){return BPromise[_0x8732('0x24')](_0xe6bdf5);}return _0x48d86f[_0x8732('0x25')]();};}function saveUpdates(_0x4517ef,_0x28734e){return function(_0x3d623a){if(_0x3d623a){return _0x3d623a[_0x8732('0x26')](_0x4517ef)[_0x8732('0x27')](function(_0x586ffe){return _0x586ffe;});}return null;};}function removeEntity(_0x53516f,_0x2c3df8){return function(_0xd57386){if(_0xd57386){return _0xd57386[_0x8732('0x28')]()[_0x8732('0x27')](function(){_0x53516f[_0x8732('0x1d')](0xcc)[_0x8732('0x29')]();});}};}function handleEntityNotFound(_0x1b9e70,_0x271a55){return function(_0xcd6b75){if(!_0xcd6b75){_0x1b9e70[_0x8732('0x1c')](0x194);}return _0xcd6b75;};}function handleError(_0x34f229,_0x4c06c2){_0x4c06c2=_0x4c06c2||0x1f4;return function(_0x1e8214){logger[_0x8732('0x2a')](_0x1e8214['stack']);if(_0x1e8214[_0x8732('0x2b')]){delete _0x1e8214[_0x8732('0x2b')];}_0x34f229['status'](_0x4c06c2)[_0x8732('0x2c')](_0x1e8214);};}exports['index']=function(_0xba1c28,_0x3315ba){var _0x2b515e={},_0x4b2fce={},_0x3028d5={'count':0x0,'rows':[]};var _0x29c1f3=_[_0x8732('0x2d')](db['SmsTransferReport'][_0x8732('0x2e')],function(_0x5ec062){return{'name':_0x5ec062[_0x8732('0x2f')],'type':_0x5ec062[_0x8732('0x30')][_0x8732('0x31')]};});_0x4b2fce[_0x8732('0x32')]=_['map'](_0x29c1f3,_0x8732('0x2b'));_0x4b2fce[_0x8732('0x33')]=_[_0x8732('0x34')](_0xba1c28[_0x8732('0x33')]);_0x4b2fce[_0x8732('0x35')]=_[_0x8732('0x36')](_0x4b2fce[_0x8732('0x32')],_0x4b2fce[_0x8732('0x33')]);_0x2b515e[_0x8732('0x37')]=_[_0x8732('0x36')](_0x4b2fce['model'],qs['fields'](_0xba1c28[_0x8732('0x33')][_0x8732('0x38')]));_0x2b515e[_0x8732('0x37')]=_0x2b515e[_0x8732('0x37')]['length']?_0x2b515e['attributes']:_0x4b2fce[_0x8732('0x32')];if(!_0xba1c28['query']['hasOwnProperty'](_0x8732('0x39'))){_0x2b515e['limit']=qs[_0x8732('0x20')](_0xba1c28[_0x8732('0x33')][_0x8732('0x20')]);_0x2b515e[_0x8732('0x22')]=qs[_0x8732('0x22')](_0xba1c28[_0x8732('0x33')][_0x8732('0x22')]);}_0x2b515e[_0x8732('0x3a')]=qs['sort'](_0xba1c28[_0x8732('0x33')]['sort']);_0x2b515e[_0x8732('0x3b')]=qs[_0x8732('0x35')](_[_0x8732('0x3c')](_0xba1c28[_0x8732('0x33')],_0x4b2fce[_0x8732('0x35')]),_0x29c1f3);if(_0xba1c28[_0x8732('0x33')][_0x8732('0x3d')]){_0x2b515e[_0x8732('0x3b')]=_[_0x8732('0x3e')](_0x2b515e['where'],{'$or':_[_0x8732('0x2d')](_0x29c1f3,function(_0x561fb3){if(_0x561fb3[_0x8732('0x30')]!=='VIRTUAL'){var _0x5a7d7c={};_0x5a7d7c[_0x561fb3['name']]={'$like':'%'+_0xba1c28['query'][_0x8732('0x3d')]+'%'};return _0x5a7d7c;}})});}_0x2b515e=_['merge']({},_0x2b515e,_0xba1c28[_0x8732('0x3f')]);var _0x124119={'where':_0x2b515e[_0x8732('0x3b')]};return db['SmsTransferReport'][_0x8732('0x21')](_0x124119)[_0x8732('0x27')](function(_0x9ae3a1){_0x3028d5[_0x8732('0x21')]=_0x9ae3a1;if(_0xba1c28[_0x8732('0x33')]['includeAll']){_0x2b515e[_0x8732('0x40')]=[{'all':!![]}];}return db[_0x8732('0x41')]['findAll'](_0x2b515e);})['then'](function(_0x362eda){_0x3028d5[_0x8732('0x42')]=_0x362eda;return _0x3028d5;})['then'](respondWithFilteredResult(_0x3315ba,_0x2b515e))[_0x8732('0x43')](handleError(_0x3315ba,null));};exports[_0x8732('0x44')]=function(_0x31efb4,_0x4c8ae5){var _0x2914e2={'raw':!![],'where':{'id':_0x31efb4[_0x8732('0x45')]['id']}},_0x11047b={};_0x11047b[_0x8732('0x32')]=_[_0x8732('0x34')](db[_0x8732('0x41')][_0x8732('0x2e')]);_0x11047b['query']=_['keys'](_0x31efb4[_0x8732('0x33')]);_0x11047b[_0x8732('0x35')]=_[_0x8732('0x36')](_0x11047b['model'],_0x11047b[_0x8732('0x33')]);_0x2914e2[_0x8732('0x37')]=_[_0x8732('0x36')](_0x11047b['model'],qs[_0x8732('0x38')](_0x31efb4[_0x8732('0x33')][_0x8732('0x38')]));_0x2914e2[_0x8732('0x37')]=_0x2914e2[_0x8732('0x37')][_0x8732('0x46')]?_0x2914e2[_0x8732('0x37')]:_0x11047b[_0x8732('0x32')];if(_0x31efb4[_0x8732('0x33')]['includeAll']){_0x2914e2[_0x8732('0x40')]=[{'all':!![]}];}_0x2914e2=_['merge']({},_0x2914e2,_0x31efb4[_0x8732('0x3f')]);return db['SmsTransferReport']['find'](_0x2914e2)[_0x8732('0x27')](handleEntityNotFound(_0x4c8ae5,null))['then'](respondWithResult(_0x4c8ae5,null))['catch'](handleError(_0x4c8ae5,null));};exports[_0x8732('0x47')]=function(_0x16e22b,_0x41095a){return db[_0x8732('0x41')]['create'](_0x16e22b[_0x8732('0x48')],{})[_0x8732('0x27')](respondWithResult(_0x41095a,0xc9))['catch'](handleError(_0x41095a,null));};exports[_0x8732('0x26')]=function(_0x1fb56e,_0x3a4f92){if(_0x1fb56e['body']['id']){delete _0x1fb56e['body']['id'];}return db['SmsTransferReport'][_0x8732('0x49')]({'where':{'id':_0x1fb56e[_0x8732('0x45')]['id']}})[_0x8732('0x27')](handleEntityNotFound(_0x3a4f92,null))['then'](saveUpdates(_0x1fb56e[_0x8732('0x48')],null))[_0x8732('0x27')](respondWithResult(_0x3a4f92,null))[_0x8732('0x43')](handleError(_0x3a4f92,null));};exports[_0x8732('0x28')]=function(_0x523cd5,_0x4d6879){return db[_0x8732('0x41')]['find']({'where':{'id':_0x523cd5[_0x8732('0x45')]['id']}})[_0x8732('0x27')](handleEntityNotFound(_0x4d6879,null))['then'](removeEntity(_0x4d6879,null))[_0x8732('0x43')](handleError(_0x4d6879,null));};exports[_0x8732('0x4a')]=function(_0x268254,_0x269527){return db[_0x8732('0x41')]['describe']()[_0x8732('0x27')](respondWithResult(_0x269527,null))['catch'](handleError(_0x269527,null));}; \ No newline at end of file +var _0x8fd3=['filter','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','update','describe','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','then','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL'];(function(_0x4a0f60,_0x298c30){var _0x59b579=function(_0x28e479){while(--_0x28e479){_0x4a0f60['push'](_0x4a0f60['shift']());}};_0x59b579(++_0x298c30);}(_0x8fd3,0xa2));var _0x38fd=function(_0x596684,_0x113a46){_0x596684=_0x596684-0x0;var _0x2f1664=_0x8fd3[_0x596684];return _0x2f1664;};'use strict';var emlformat=require(_0x38fd('0x0'));var rimraf=require(_0x38fd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x38fd('0x2'));var moment=require('moment');var BPromise=require(_0x38fd('0x3'));var Mustache=require(_0x38fd('0x4'));var util=require(_0x38fd('0x5'));var path=require(_0x38fd('0x6'));var sox=require(_0x38fd('0x7'));var csv=require(_0x38fd('0x8'));var ejs=require(_0x38fd('0x9'));var fs=require('fs');var fs_extra=require(_0x38fd('0xa'));var _=require('lodash');var squel=require(_0x38fd('0xb'));var crypto=require(_0x38fd('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x38fd('0x8'));var querystring=require(_0x38fd('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x38fd('0xe'));var qs=require(_0x38fd('0xf'));var as=require(_0x38fd('0x10'));var hardwareService=require(_0x38fd('0x11'));var logger=require('../../config/logger')(_0x38fd('0x12'));var utils=require(_0x38fd('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x38fd('0x14'));var db=require(_0x38fd('0x15'))['db'];function respondWithStatusCode(_0x44c695,_0xc176f8){_0xc176f8=_0xc176f8||0xcc;return function(_0x37b18b){if(_0x37b18b){return _0x44c695[_0x38fd('0x16')](_0xc176f8);}return _0x44c695[_0x38fd('0x17')](_0xc176f8)[_0x38fd('0x18')]();};}function respondWithResult(_0x2d9bcc,_0x128e24){_0x128e24=_0x128e24||0xc8;return function(_0x4c52f5){if(_0x4c52f5){return _0x2d9bcc['status'](_0x128e24)['json'](_0x4c52f5);}};}function respondWithFilteredResult(_0x674e5a,_0x2644c2){return function(_0x213f0a){if(_0x213f0a){var _0xa1f038=typeof _0x2644c2[_0x38fd('0x19')]===_0x38fd('0x1a')&&typeof _0x2644c2['limit']===_0x38fd('0x1a');var _0x1d4a11=_0x213f0a['count'];var _0x21c414=_0xa1f038?0x0:_0x2644c2['offset'];var _0xe73829=_0xa1f038?_0x213f0a[_0x38fd('0x1b')]:_0x2644c2[_0x38fd('0x19')]+_0x2644c2['limit'];var _0x32d2b6;if(_0xe73829>=_0x1d4a11){_0xe73829=_0x1d4a11;_0x32d2b6=0xc8;}else{_0x32d2b6=0xce;}_0x674e5a['status'](_0x32d2b6);return _0x674e5a['set'](_0x38fd('0x1c'),_0x21c414+'-'+_0xe73829+'/'+_0x1d4a11)[_0x38fd('0x1d')](_0x213f0a);}return null;};}function patchUpdates(_0x45d1eb){return function(_0x331140){try{jsonpatch[_0x38fd('0x1e')](_0x331140,_0x45d1eb,!![]);}catch(_0x489967){return BPromise[_0x38fd('0x1f')](_0x489967);}return _0x331140[_0x38fd('0x20')]();};}function saveUpdates(_0x367979,_0x4b8af7){return function(_0x2afb7f){if(_0x2afb7f){return _0x2afb7f['update'](_0x367979)[_0x38fd('0x21')](function(_0x3ec24b){return _0x3ec24b;});}return null;};}function removeEntity(_0x4a67e0,_0x25d5f6){return function(_0x23c136){if(_0x23c136){return _0x23c136['destroy']()[_0x38fd('0x21')](function(){_0x4a67e0[_0x38fd('0x17')](0xcc)[_0x38fd('0x18')]();});}};}function handleEntityNotFound(_0x27b02e,_0x3d824d){return function(_0x315e9b){if(!_0x315e9b){_0x27b02e[_0x38fd('0x16')](0x194);}return _0x315e9b;};}function handleError(_0x286220,_0x1ef8ab){_0x1ef8ab=_0x1ef8ab||0x1f4;return function(_0x4053b6){logger[_0x38fd('0x22')](_0x4053b6[_0x38fd('0x23')]);if(_0x4053b6[_0x38fd('0x24')]){delete _0x4053b6['name'];}_0x286220[_0x38fd('0x17')](_0x1ef8ab)[_0x38fd('0x25')](_0x4053b6);};}exports[_0x38fd('0x26')]=function(_0x5dee21,_0x1664bb){var _0x315aca={},_0x2e9265={},_0x2efe2e={'count':0x0,'rows':[]};var _0x2eb1d6=_[_0x38fd('0x27')](db[_0x38fd('0x28')][_0x38fd('0x29')],function(_0x49fdf0){return{'name':_0x49fdf0['fieldName'],'type':_0x49fdf0[_0x38fd('0x2a')][_0x38fd('0x2b')]};});_0x2e9265[_0x38fd('0x2c')]=_[_0x38fd('0x27')](_0x2eb1d6,_0x38fd('0x24'));_0x2e9265[_0x38fd('0x2d')]=_['keys'](_0x5dee21[_0x38fd('0x2d')]);_0x2e9265[_0x38fd('0x2e')]=_[_0x38fd('0x2f')](_0x2e9265[_0x38fd('0x2c')],_0x2e9265[_0x38fd('0x2d')]);_0x315aca[_0x38fd('0x30')]=_[_0x38fd('0x2f')](_0x2e9265['model'],qs[_0x38fd('0x31')](_0x5dee21[_0x38fd('0x2d')]['fields']));_0x315aca['attributes']=_0x315aca[_0x38fd('0x30')][_0x38fd('0x32')]?_0x315aca[_0x38fd('0x30')]:_0x2e9265['model'];if(!_0x5dee21[_0x38fd('0x2d')][_0x38fd('0x33')](_0x38fd('0x34'))){_0x315aca[_0x38fd('0x35')]=qs[_0x38fd('0x35')](_0x5dee21[_0x38fd('0x2d')][_0x38fd('0x35')]);_0x315aca[_0x38fd('0x19')]=qs[_0x38fd('0x19')](_0x5dee21['query'][_0x38fd('0x19')]);}_0x315aca[_0x38fd('0x36')]=qs[_0x38fd('0x37')](_0x5dee21[_0x38fd('0x2d')][_0x38fd('0x37')]);_0x315aca[_0x38fd('0x38')]=qs['filters'](_[_0x38fd('0x39')](_0x5dee21[_0x38fd('0x2d')],_0x2e9265['filters']),_0x2eb1d6);if(_0x5dee21['query']['filter']){_0x315aca[_0x38fd('0x38')]=_[_0x38fd('0x3a')](_0x315aca['where'],{'$or':_['map'](_0x2eb1d6,function(_0x20eff5){if(_0x20eff5[_0x38fd('0x2a')]!==_0x38fd('0x3b')){var _0x3e5b72={};_0x3e5b72[_0x20eff5['name']]={'$like':'%'+_0x5dee21[_0x38fd('0x2d')][_0x38fd('0x3c')]+'%'};return _0x3e5b72;}})});}_0x315aca=_['merge']({},_0x315aca,_0x5dee21['options']);var _0x4df0f1={'where':_0x315aca['where']};return db[_0x38fd('0x28')]['count'](_0x4df0f1)[_0x38fd('0x21')](function(_0x5224ac){_0x2efe2e['count']=_0x5224ac;if(_0x5dee21[_0x38fd('0x2d')][_0x38fd('0x3d')]){_0x315aca['include']=[{'all':!![]}];}return db['SmsTransferReport'][_0x38fd('0x3e')](_0x315aca);})[_0x38fd('0x21')](function(_0x5434ea){_0x2efe2e[_0x38fd('0x3f')]=_0x5434ea;return _0x2efe2e;})[_0x38fd('0x21')](respondWithFilteredResult(_0x1664bb,_0x315aca))[_0x38fd('0x40')](handleError(_0x1664bb,null));};exports[_0x38fd('0x41')]=function(_0x46c7e4,_0x4db923){var _0xbc16a8={'raw':!![],'where':{'id':_0x46c7e4[_0x38fd('0x42')]['id']}},_0x48cfb4={};_0x48cfb4[_0x38fd('0x2c')]=_['keys'](db['SmsTransferReport'][_0x38fd('0x29')]);_0x48cfb4['query']=_['keys'](_0x46c7e4[_0x38fd('0x2d')]);_0x48cfb4['filters']=_[_0x38fd('0x2f')](_0x48cfb4['model'],_0x48cfb4[_0x38fd('0x2d')]);_0xbc16a8[_0x38fd('0x30')]=_[_0x38fd('0x2f')](_0x48cfb4[_0x38fd('0x2c')],qs[_0x38fd('0x31')](_0x46c7e4[_0x38fd('0x2d')]['fields']));_0xbc16a8['attributes']=_0xbc16a8[_0x38fd('0x30')]['length']?_0xbc16a8['attributes']:_0x48cfb4[_0x38fd('0x2c')];if(_0x46c7e4[_0x38fd('0x2d')]['includeAll']){_0xbc16a8[_0x38fd('0x43')]=[{'all':!![]}];}_0xbc16a8=_[_0x38fd('0x3a')]({},_0xbc16a8,_0x46c7e4[_0x38fd('0x44')]);return db['SmsTransferReport'][_0x38fd('0x45')](_0xbc16a8)[_0x38fd('0x21')](handleEntityNotFound(_0x4db923,null))[_0x38fd('0x21')](respondWithResult(_0x4db923,null))['catch'](handleError(_0x4db923,null));};exports[_0x38fd('0x46')]=function(_0x9be94a,_0x1cb217){return db[_0x38fd('0x28')][_0x38fd('0x46')](_0x9be94a[_0x38fd('0x47')],{})[_0x38fd('0x21')](respondWithResult(_0x1cb217,0xc9))[_0x38fd('0x40')](handleError(_0x1cb217,null));};exports[_0x38fd('0x48')]=function(_0x368538,_0x21657e){if(_0x368538[_0x38fd('0x47')]['id']){delete _0x368538[_0x38fd('0x47')]['id'];}return db[_0x38fd('0x28')][_0x38fd('0x45')]({'where':{'id':_0x368538[_0x38fd('0x42')]['id']}})[_0x38fd('0x21')](handleEntityNotFound(_0x21657e,null))[_0x38fd('0x21')](saveUpdates(_0x368538['body'],null))['then'](respondWithResult(_0x21657e,null))['catch'](handleError(_0x21657e,null));};exports['destroy']=function(_0x5856f2,_0x4ea838){return db[_0x38fd('0x28')][_0x38fd('0x45')]({'where':{'id':_0x5856f2[_0x38fd('0x42')]['id']}})['then'](handleEntityNotFound(_0x4ea838,null))['then'](removeEntity(_0x4ea838,null))[_0x38fd('0x40')](handleError(_0x4ea838,null));};exports[_0x38fd('0x49')]=function(_0x10ac21,_0x38719c){return db[_0x38fd('0x28')][_0x38fd('0x49')]()['then'](respondWithResult(_0x38719c,null))[_0x38fd('0x40')](handleError(_0x38719c,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 63da018..5835ebc 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 _0x8d3f=['SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./smsTransferReport.attributes','exports','define'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x8d3f,0x1e4));var _0xf8d3=function(_0xc7419e,_0x4a883e){_0xc7419e=_0xc7419e-0x0;var _0x3b693f=_0x8d3f[_0xc7419e];return _0x3b693f;};'use strict';var _=require(_0xf8d3('0x0'));var util=require(_0xf8d3('0x1'));var logger=require(_0xf8d3('0x2'))('api');var moment=require(_0xf8d3('0x3'));var BPromise=require(_0xf8d3('0x4'));var rp=require(_0xf8d3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf8d3('0x6'));var attributes=require(_0xf8d3('0x7'));module[_0xf8d3('0x8')]=function(_0x208cc1,_0x2b67b9){return _0x208cc1[_0xf8d3('0x9')](_0xf8d3('0xa'),attributes,{'tableName':_0xf8d3('0xb'),'paranoid':![],'indexes':[{'name':_0xf8d3('0xc'),'fields':[_0xf8d3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xea11=['./smsTransferReport.attributes','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x829e6,_0x53ace7){var _0x3c36f5=function(_0x5032a6){while(--_0x5032a6){_0x829e6['push'](_0x829e6['shift']());}};_0x3c36f5(++_0x53ace7);}(_0xea11,0x10c));var _0x1ea1=function(_0x1e432d,_0x35df07){_0x1e432d=_0x1e432d-0x0;var _0x2cc650=_0xea11[_0x1e432d];return _0x2cc650;};'use strict';var _=require(_0x1ea1('0x0'));var util=require(_0x1ea1('0x1'));var logger=require('../../config/logger')(_0x1ea1('0x2'));var moment=require(_0x1ea1('0x3'));var BPromise=require(_0x1ea1('0x4'));var rp=require(_0x1ea1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ea1('0x6'));var config=require(_0x1ea1('0x7'));var attributes=require(_0x1ea1('0x8'));module['exports']=function(_0x597279,_0x37bb21){return _0x597279['define'](_0x1ea1('0x9'),attributes,{'tableName':_0x1ea1('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1ea1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 5d44f21..2285fde 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 _0x8fed=['stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8fed,0xf5));var _0xd8fe=function(_0x41b6b5,_0x645e16){_0x41b6b5=_0x41b6b5-0x0;var _0x3964c7=_0x8fed[_0x41b6b5];return _0x3964c7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd8fe('0x0'));var BPromise=require(_0xd8fe('0x1'));var rs=require(_0xd8fe('0x2'));var fs=require('fs');var Redis=require(_0xd8fe('0x3'));var db=require(_0xd8fe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd8fe('0x5'))(_0xd8fe('0x6'));var config=require(_0xd8fe('0x7'));var jayson=require(_0xd8fe('0x8'));var client=jayson[_0xd8fe('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7e3b94,_0x1747b3,_0xa33e22){return new BPromise(function(_0x26d33d,_0x5e48f9){return client[_0xd8fe('0xa')](_0x7e3b94,_0xa33e22)['then'](function(_0x410d44){logger[_0xd8fe('0xb')](_0xd8fe('0xc'),_0x1747b3,_0xd8fe('0xd'));logger[_0xd8fe('0xe')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x1747b3,_0xd8fe('0xd'),JSON[_0xd8fe('0xf')](_0x410d44));if(_0x410d44[_0xd8fe('0x10')]){if(_0x410d44['error'][_0xd8fe('0x11')]===0x1f4){logger['error'](_0xd8fe('0xc'),_0x1747b3,_0x410d44[_0xd8fe('0x10')][_0xd8fe('0x12')]);return _0x5e48f9(_0x410d44[_0xd8fe('0x10')][_0xd8fe('0x12')]);}logger['error'](_0xd8fe('0xc'),_0x1747b3,_0x410d44[_0xd8fe('0x10')]['message']);return _0x26d33d(_0x410d44[_0xd8fe('0x10')][_0xd8fe('0x12')]);}else{logger[_0xd8fe('0xb')](_0xd8fe('0xc'),_0x1747b3,_0xd8fe('0xd'));_0x26d33d(_0x410d44[_0xd8fe('0x13')][_0xd8fe('0x12')]);}})['catch'](function(_0x260a7f){logger['error'](_0xd8fe('0xc'),_0x1747b3,_0x260a7f);_0x5e48f9(_0x260a7f);});});} \ No newline at end of file +var _0x7266=['request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x1c7811,_0xf012fa){var _0x5eb147=function(_0xe04d31){while(--_0xe04d31){_0x1c7811['push'](_0x1c7811['shift']());}};_0x5eb147(++_0xf012fa);}(_0x7266,0xec));var _0x6726=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x7266[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x6726('0x0'));var util=require(_0x6726('0x1'));var moment=require(_0x6726('0x2'));var BPromise=require(_0x6726('0x3'));var rs=require(_0x6726('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6726('0x5'));var logger=require(_0x6726('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6726('0x7'));var client=jayson[_0x6726('0x8')][_0x6726('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x180502,_0x217972,_0x3c8020){return new BPromise(function(_0x126ba7,_0x3d9f0f){return client[_0x6726('0xa')](_0x180502,_0x3c8020)[_0x6726('0xb')](function(_0x9f993){logger[_0x6726('0xc')](_0x6726('0xd'),_0x217972,'request\x20sent');logger[_0x6726('0xe')](_0x6726('0xf'),_0x217972,_0x6726('0x10'),JSON[_0x6726('0x11')](_0x9f993));if(_0x9f993['error']){if(_0x9f993[_0x6726('0x12')]['code']===0x1f4){logger[_0x6726('0x12')](_0x6726('0xd'),_0x217972,_0x9f993['error'][_0x6726('0x13')]);return _0x3d9f0f(_0x9f993[_0x6726('0x12')][_0x6726('0x13')]);}logger[_0x6726('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x217972,_0x9f993[_0x6726('0x12')][_0x6726('0x13')]);return _0x126ba7(_0x9f993['error'][_0x6726('0x13')]);}else{logger['info'](_0x6726('0xd'),_0x217972,_0x6726('0x10'));_0x126ba7(_0x9f993[_0x6726('0x14')][_0x6726('0x13')]);}})['catch'](function(_0x8323b2){logger[_0x6726('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x217972,_0x8323b2);_0x3d9f0f(_0x8323b2);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 01b3fa8..76bed29 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 _0x254d=['now','post','single','file','create','put','update','delete','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname'];(function(_0x5e67be,_0x271ac8){var _0x45c259=function(_0x5eb9d7){while(--_0x5eb9d7){_0x5e67be['push'](_0x5e67be['shift']());}};_0x45c259(++_0x271ac8);}(_0x254d,0xc2));var _0xd254=function(_0x3ef45e,_0xe84f33){_0x3ef45e=_0x3ef45e-0x0;var _0x69e7c=_0x254d[_0x3ef45e];return _0x69e7c;};'use strict';var multer=require(_0xd254('0x0'));var util=require(_0xd254('0x1'));var path=require(_0xd254('0x2'));var timeout=require('connect-timeout');var express=require(_0xd254('0x3'));var router=express['Router']();var fs_extra=require(_0xd254('0x4'));var auth=require(_0xd254('0x5'));var interaction=require(_0xd254('0x6'));var config=require(_0xd254('0x7'));var controller=require('./sound.controller');router[_0xd254('0x8')]('/',auth[_0xd254('0x9')](),controller[_0xd254('0xa')]);router[_0xd254('0x8')](_0xd254('0xb'),auth[_0xd254('0x9')](),controller[_0xd254('0xc')]);router[_0xd254('0x8')](_0xd254('0xd'),auth['isAuthenticated'](),controller[_0xd254('0xe')]);var upload=multer({'storage':multer[_0xd254('0xf')]({'destination':function(_0x25b1b6,_0x396f4b,_0x4042ee){_0x4042ee(null,path[_0xd254('0x10')](config['root'],_0xd254('0x11')));},'filename':function(_0x3ecc0c,_0x92cb02,_0x5880aa){_0x92cb02[_0xd254('0x12')]=_0x92cb02['originalname'][_0xd254('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5880aa(null,util[_0xd254('0x14')](_0xd254('0x15'),path['basename'](_0x92cb02[_0xd254('0x12')],path[_0xd254('0x16')](_0x92cb02[_0xd254('0x12')])),Date[_0xd254('0x17')](),path[_0xd254('0x16')](_0x92cb02[_0xd254('0x12')])));}})});router[_0xd254('0x18')]('/',upload[_0xd254('0x19')](_0xd254('0x1a')),controller[_0xd254('0x1b')]);router[_0xd254('0x1c')](_0xd254('0xb'),auth[_0xd254('0x9')](),controller[_0xd254('0x1d')]);router[_0xd254('0x1e')](_0xd254('0xb'),auth[_0xd254('0x9')](),controller[_0xd254('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xd72a=['diskStorage','join','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname','file','create','put','update','/:id','delete','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','index','get','show','download'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd72a,0x138));var _0xad72=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xd72a[_0x4fde08];return _0x12e725;};'use strict';var multer=require(_0xad72('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xad72('0x1'));var express=require(_0xad72('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xad72('0x3'));var interaction=require(_0xad72('0x4'));var config=require(_0xad72('0x5'));var controller=require(_0xad72('0x6'));router['get']('/',auth[_0xad72('0x7')](),controller[_0xad72('0x8')]);router[_0xad72('0x9')]('/:id',auth[_0xad72('0x7')](),controller[_0xad72('0xa')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xad72('0xb')]);var upload=multer({'storage':multer[_0xad72('0xc')]({'destination':function(_0xb3798f,_0x266021,_0x19be1a){_0x19be1a(null,path[_0xad72('0xd')](config['root'],_0xad72('0xe')));},'filename':function(_0x24fc25,_0xf5f10a,_0x5b16f9){_0xf5f10a[_0xad72('0xf')]=_0xf5f10a['originalname'][_0xad72('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5b16f9(null,util[_0xad72('0x11')](_0xad72('0x12'),path['basename'](_0xf5f10a[_0xad72('0xf')],path[_0xad72('0x13')](_0xf5f10a[_0xad72('0xf')])),Date['now'](),path[_0xad72('0x13')](_0xf5f10a[_0xad72('0xf')])));}})});router['post']('/',upload['single'](_0xad72('0x14')),controller[_0xad72('0x15')]);router[_0xad72('0x16')]('/:id',auth[_0xad72('0x7')](),controller[_0xad72('0x17')]);router['delete'](_0xad72('0x18'),auth[_0xad72('0x7')](),controller[_0xad72('0x19')]);module[_0xad72('0x1a')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index cbb1b99..3d94a0b 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 _0x773d=['name','STRING','FLOAT','BIGINT','INTEGER','exports'];(function(_0x50b451,_0xba9b68){var _0xd58466=function(_0x46b91c){while(--_0x46b91c){_0x50b451['push'](_0x50b451['shift']());}};_0xd58466(++_0xba9b68);}(_0x773d,0xa1));var _0xd773=function(_0x574c85,_0x1c8179){_0x574c85=_0x574c85-0x0;var _0x1e0989=_0x773d[_0x574c85];return _0x1e0989;};'use strict';var Sequelize=require('sequelize');module[_0xd773('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xd773('0x1'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xd773('0x2')]},'original_format':{'type':Sequelize[_0xd773('0x2')]},'original_duration':{'type':Sequelize[_0xd773('0x3')]},'original_sampleCount':{'type':Sequelize[_0xd773('0x4')]},'original_channelCount':{'type':Sequelize[_0xd773('0x5')]},'original_bitRate':{'type':Sequelize[_0xd773('0x4')]},'original_sampleRate':{'type':Sequelize[_0xd773('0x5')]},'converted_format':{'type':Sequelize[_0xd773('0x2')]},'converted_duration':{'type':Sequelize[_0xd773('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xd773('0x5')]},'converted_bitRate':{'type':Sequelize[_0xd773('0x4')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x797a=['BIGINT','FLOAT','name','STRING','INTEGER'];(function(_0x1d2946,_0x41fa09){var _0x2dc9b4=function(_0x333068){while(--_0x333068){_0x1d2946['push'](_0x1d2946['shift']());}};_0x2dc9b4(++_0x41fa09);}(_0x797a,0x7a));var _0xa797=function(_0xebc93c,_0x50bec3){_0xebc93c=_0xebc93c-0x0;var _0x3795ed=_0x797a[_0xebc93c];return _0x3795ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xa797('0x0'),'allowNull':![]},'save_name':{'type':Sequelize[_0xa797('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xa797('0x1')]},'original_format':{'type':Sequelize[_0xa797('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xa797('0x2')]},'original_bitRate':{'type':Sequelize[_0xa797('0x3')]},'original_sampleRate':{'type':Sequelize[_0xa797('0x2')]},'converted_format':{'type':Sequelize[_0xa797('0x1')]},'converted_duration':{'type':Sequelize[_0xa797('0x4')]},'converted_sampleCount':{'type':Sequelize[_0xa797('0x3')]},'converted_channelCount':{'type':Sequelize[_0xa797('0x2')]},'converted_bitRate':{'type':Sequelize[_0xa797('0x3')]},'converted_sampleRate':{'type':Sequelize[_0xa797('0x2')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 9bf6478..4552f8c 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 _0x98a7=['../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','end','error','stack','name','send','Sound','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','map','includeAll','include','findAll','rows','show','params','length','options','find','catch','download','save_name','existsSync','join','root','converted_format','Sound\x20not\x20found','server/files/sounds/converted','format','%s.%s','basename','originalname','file','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_sampleRate','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','delete','original_format','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x262b11,_0x39937){var _0x3013ed=function(_0x525a11){while(--_0x525a11){_0x262b11['push'](_0x262b11['shift']());}};_0x3013ed(++_0x39937);}(_0x98a7,0x15a));var _0x798a=function(_0x2e787b,_0x371e3b){_0x2e787b=_0x2e787b-0x0;var _0x2c69e8=_0x98a7[_0x2e787b];return _0x2c69e8;};'use strict';var emlformat=require(_0x798a('0x0'));var rimraf=require(_0x798a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x798a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x798a('0x3'));var Mustache=require('mustache');var util=require(_0x798a('0x4'));var path=require(_0x798a('0x5'));var sox=require(_0x798a('0x6'));var csv=require(_0x798a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x798a('0x8'));var _=require(_0x798a('0x9'));var squel=require(_0x798a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x798a('0xb'));var toCsv=require(_0x798a('0x7'));var querystring=require(_0x798a('0xc'));var Papa=require(_0x798a('0xd'));var Redis=require(_0x798a('0xe'));var authService=require(_0x798a('0xf'));var qs=require(_0x798a('0x10'));var as=require(_0x798a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x798a('0x12'));var utils=require(_0x798a('0x13'));var config=require(_0x798a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x798a('0x15'))['db'];function respondWithStatusCode(_0x2a80da,_0x56216f){_0x56216f=_0x56216f||0xcc;return function(_0x4b693b){if(_0x4b693b){return _0x2a80da[_0x798a('0x16')](_0x56216f);}return _0x2a80da['status'](_0x56216f)['end']();};}function respondWithResult(_0x649e9c,_0x2d9533){_0x2d9533=_0x2d9533||0xc8;return function(_0x2be908){if(_0x2be908){return _0x649e9c[_0x798a('0x17')](_0x2d9533)[_0x798a('0x18')](_0x2be908);}};}function respondWithFilteredResult(_0x197459,_0x2601df){return function(_0x3f6343){if(_0x3f6343){var _0xb321fa=typeof _0x2601df[_0x798a('0x19')]==='undefined'&&typeof _0x2601df[_0x798a('0x1a')]===_0x798a('0x1b');var _0x197079=_0x3f6343[_0x798a('0x1c')];var _0x562b55=_0xb321fa?0x0:_0x2601df['offset'];var _0x407757=_0xb321fa?_0x3f6343[_0x798a('0x1c')]:_0x2601df[_0x798a('0x19')]+_0x2601df[_0x798a('0x1a')];var _0x1f174d;if(_0x407757>=_0x197079){_0x407757=_0x197079;_0x1f174d=0xc8;}else{_0x1f174d=0xce;}_0x197459['status'](_0x1f174d);return _0x197459['set'](_0x798a('0x1d'),_0x562b55+'-'+_0x407757+'/'+_0x197079)[_0x798a('0x18')](_0x3f6343);}return null;};}function patchUpdates(_0x319619){return function(_0x40a9cd){try{jsonpatch[_0x798a('0x1e')](_0x40a9cd,_0x319619,!![]);}catch(_0x3fb944){return BPromise[_0x798a('0x1f')](_0x3fb944);}return _0x40a9cd[_0x798a('0x20')]();};}function saveUpdates(_0x2cc17a,_0x31813f){return function(_0x502a42){if(_0x502a42){return _0x502a42[_0x798a('0x21')](_0x2cc17a)[_0x798a('0x22')](function(_0x243dae){return _0x243dae;});}return null;};}function removeEntity(_0x31ccb8,_0x35521d){return function(_0x479e98){if(_0x479e98){return _0x479e98[_0x798a('0x23')]()[_0x798a('0x22')](function(){var _0x446d94=_0x479e98[_0x798a('0x24')]({'plain':!![]});var _0x24f085=_0x798a('0x25');return db['UserProfileResource'][_0x798a('0x23')]({'where':{'type':_0x24f085,'resourceId':_0x446d94['id']}})[_0x798a('0x22')](function(){return _0x479e98;});})[_0x798a('0x22')](function(){_0x31ccb8[_0x798a('0x17')](0xcc)[_0x798a('0x26')]();});}};}function handleEntityNotFound(_0x2267ef,_0x5f42a4){return function(_0x4933f0){if(!_0x4933f0){_0x2267ef[_0x798a('0x16')](0x194);}return _0x4933f0;};}function handleError(_0x4749ff,_0x87a8c5){_0x87a8c5=_0x87a8c5||0x1f4;return function(_0x5800d4){logger[_0x798a('0x27')](_0x5800d4[_0x798a('0x28')]);if(_0x5800d4[_0x798a('0x29')]){delete _0x5800d4['name'];}_0x4749ff[_0x798a('0x17')](_0x87a8c5)[_0x798a('0x2a')](_0x5800d4);};}exports['index']=function(_0x11dc8a,_0x3eda6e){var _0x1c9fa8={},_0x3a6146={},_0x5aa090={'count':0x0,'rows':[]};var _0x49afbf=_['map'](db[_0x798a('0x2b')][_0x798a('0x2c')],function(_0x4a0dee){return{'name':_0x4a0dee['fieldName'],'type':_0x4a0dee[_0x798a('0x2d')][_0x798a('0x2e')]};});_0x3a6146[_0x798a('0x2f')]=_['map'](_0x49afbf,_0x798a('0x29'));_0x3a6146[_0x798a('0x30')]=_[_0x798a('0x31')](_0x11dc8a[_0x798a('0x30')]);_0x3a6146[_0x798a('0x32')]=_[_0x798a('0x33')](_0x3a6146[_0x798a('0x2f')],_0x3a6146[_0x798a('0x30')]);_0x1c9fa8['attributes']=_[_0x798a('0x33')](_0x3a6146['model'],qs[_0x798a('0x34')](_0x11dc8a['query']['fields']));_0x1c9fa8[_0x798a('0x35')]=_0x1c9fa8['attributes']['length']?_0x1c9fa8['attributes']:_0x3a6146[_0x798a('0x2f')];if(!_0x11dc8a[_0x798a('0x30')]['hasOwnProperty'](_0x798a('0x36'))){_0x1c9fa8[_0x798a('0x1a')]=qs[_0x798a('0x1a')](_0x11dc8a[_0x798a('0x30')][_0x798a('0x1a')]);_0x1c9fa8['offset']=qs['offset'](_0x11dc8a['query'][_0x798a('0x19')]);}_0x1c9fa8[_0x798a('0x37')]=qs[_0x798a('0x38')](_0x11dc8a[_0x798a('0x30')]['sort']);_0x1c9fa8[_0x798a('0x39')]=qs[_0x798a('0x32')](_[_0x798a('0x3a')](_0x11dc8a['query'],_0x3a6146[_0x798a('0x32')]),_0x49afbf);if(_0x11dc8a['query'][_0x798a('0x3b')]){_0x1c9fa8[_0x798a('0x39')]=_[_0x798a('0x3c')](_0x1c9fa8[_0x798a('0x39')],{'$or':_[_0x798a('0x3d')](_0x49afbf,function(_0x3605f7){if(_0x3605f7[_0x798a('0x2d')]!=='VIRTUAL'){var _0x432b74={};_0x432b74[_0x3605f7[_0x798a('0x29')]]={'$like':'%'+_0x11dc8a['query'][_0x798a('0x3b')]+'%'};return _0x432b74;}})});}_0x1c9fa8=_[_0x798a('0x3c')]({},_0x1c9fa8,_0x11dc8a['options']);var _0x5f9e0={'where':_0x1c9fa8['where']};return db[_0x798a('0x2b')][_0x798a('0x1c')](_0x5f9e0)['then'](function(_0x535128){_0x5aa090[_0x798a('0x1c')]=_0x535128;if(_0x11dc8a[_0x798a('0x30')][_0x798a('0x3e')]){_0x1c9fa8[_0x798a('0x3f')]=[{'all':!![]}];}return db[_0x798a('0x2b')][_0x798a('0x40')](_0x1c9fa8);})[_0x798a('0x22')](function(_0x4fdb7f){_0x5aa090[_0x798a('0x41')]=_0x4fdb7f;return _0x5aa090;})[_0x798a('0x22')](respondWithFilteredResult(_0x3eda6e,_0x1c9fa8))['catch'](handleError(_0x3eda6e,null));};exports[_0x798a('0x42')]=function(_0x29b022,_0x1333fc){var _0x328584={'raw':!![],'where':{'id':_0x29b022[_0x798a('0x43')]['id']}},_0x9c1e69={};_0x9c1e69[_0x798a('0x2f')]=_['keys'](db[_0x798a('0x2b')]['rawAttributes']);_0x9c1e69[_0x798a('0x30')]=_[_0x798a('0x31')](_0x29b022[_0x798a('0x30')]);_0x9c1e69[_0x798a('0x32')]=_[_0x798a('0x33')](_0x9c1e69[_0x798a('0x2f')],_0x9c1e69['query']);_0x328584['attributes']=_[_0x798a('0x33')](_0x9c1e69[_0x798a('0x2f')],qs['fields'](_0x29b022['query'][_0x798a('0x34')]));_0x328584[_0x798a('0x35')]=_0x328584[_0x798a('0x35')][_0x798a('0x44')]?_0x328584[_0x798a('0x35')]:_0x9c1e69[_0x798a('0x2f')];if(_0x29b022[_0x798a('0x30')][_0x798a('0x3e')]){_0x328584[_0x798a('0x3f')]=[{'all':!![]}];}_0x328584=_[_0x798a('0x3c')]({},_0x328584,_0x29b022[_0x798a('0x45')]);return db[_0x798a('0x2b')][_0x798a('0x46')](_0x328584)[_0x798a('0x22')](handleEntityNotFound(_0x1333fc,null))[_0x798a('0x22')](respondWithResult(_0x1333fc,null))[_0x798a('0x47')](handleError(_0x1333fc,null));};exports[_0x798a('0x48')]=function(_0x120786,_0x5023e,_0x3b2634){return db[_0x798a('0x2b')][_0x798a('0x46')]({'where':{'id':_0x120786[_0x798a('0x43')]['id']},'attributes':[_0x798a('0x29'),_0x798a('0x49'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x5023e,null))[_0x798a('0x22')](function(_0xc18718){if(_0xc18718){if(!fs[_0x798a('0x4a')](path[_0x798a('0x4b')](config[_0x798a('0x4c')],'server/files/sounds/converted',_0xc18718[_0x798a('0x49')]+'.'+_0xc18718[_0x798a('0x4d')]))){throw new db['Sequelize']['ValidationError'](_0x798a('0x4e'));}return _0x5023e['download'](path[_0x798a('0x4b')](config[_0x798a('0x4c')],_0x798a('0x4f'),util[_0x798a('0x50')](_0x798a('0x51'),_0xc18718['save_name'],_0xc18718[_0x798a('0x4d')])),util[_0x798a('0x50')]('%s.%s',_0xc18718['name'],_0xc18718['converted_format']));}return null;})[_0x798a('0x47')](handleError(_0x5023e,null));};exports['create']=function(_0x2789f7,_0x2451f3,_0x3e07db){var _0x2910bf={'name':path[_0x798a('0x52')](_0x2789f7['file'][_0x798a('0x53')],path['extname'](_0x2789f7['file'][_0x798a('0x53')])),'save_name':path[_0x798a('0x52')](_0x2789f7[_0x798a('0x54')]['filename'],path[_0x798a('0x55')](_0x2789f7[_0x798a('0x54')][_0x798a('0x56')])),'original_format':path['extname'](_0x2789f7[_0x798a('0x54')][_0x798a('0x53')])[_0x798a('0x57')](0x1),'converted_format':_0x798a('0x58')};var _0x4f93df=path['join'](config[_0x798a('0x4c')],_0x798a('0x59'),_0x2789f7[_0x798a('0x54')]['filename']);var _0x1eda4e=path[_0x798a('0x4b')](config['root'],'server/files/sounds/converted',util[_0x798a('0x50')](_0x798a('0x51'),path[_0x798a('0x52')](_0x2789f7[_0x798a('0x54')][_0x798a('0x56')],path[_0x798a('0x55')](_0x2789f7['file'][_0x798a('0x56')])),_0x2910bf[_0x798a('0x4d')]));logger[_0x798a('0x5a')](_0x798a('0x5b'),_0x4f93df);logger[_0x798a('0x5a')](_0x798a('0x5c'),_0x1eda4e);try{fs[_0x798a('0x5d')](_0x4f93df,parseInt(_0x798a('0x5e'),0x8));var _0x5890a8=sox[_0x798a('0x5f')](_0x4f93df,_0x1eda4e,{'sampleRate':0x1f40,'format':_0x798a('0x58'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5890a8['on'](_0x798a('0x27'),function(_0x50cf3d){fs[_0x798a('0x60')](_0x4f93df);_0x2451f3[_0x798a('0x17')](0x1f4)[_0x798a('0x2a')](_0x50cf3d);});_0x5890a8['on']('src',function(_0x257224){_0x2910bf[_0x798a('0x61')]=isNaN(_0x257224[_0x798a('0x62')])?null:_0x257224['duration']*0x3e8;_0x2910bf[_0x798a('0x63')]=isNaN(_0x257224[_0x798a('0x64')])?null:_0x257224[_0x798a('0x64')];_0x2910bf[_0x798a('0x65')]=isNaN(_0x257224[_0x798a('0x66')])?null:_0x257224[_0x798a('0x66')];_0x2910bf[_0x798a('0x67')]=isNaN(_0x257224['bitRate'])?null:_0x257224[_0x798a('0x68')];_0x2910bf[_0x798a('0x69')]=isNaN(_0x257224[_0x798a('0x6a')])?null:_0x257224[_0x798a('0x6a')];});_0x5890a8['on'](_0x798a('0x6b'),function(_0x2fa1fc){_0x2910bf[_0x798a('0x6c')]=isNaN(_0x2fa1fc[_0x798a('0x62')])?null:_0x2fa1fc[_0x798a('0x62')]*0x3e8;_0x2910bf[_0x798a('0x6d')]=isNaN(_0x2fa1fc[_0x798a('0x64')])?null:_0x2fa1fc[_0x798a('0x64')];_0x2910bf['converted_channelCount']=isNaN(_0x2fa1fc['channelCount'])?null:_0x2fa1fc[_0x798a('0x66')];_0x2910bf['converted_bitRate']=isNaN(_0x2fa1fc['bitRate'])?null:_0x2fa1fc[_0x798a('0x68')];_0x2910bf[_0x798a('0x6e')]=isNaN(_0x2fa1fc['sampleRate'])?null:_0x2fa1fc[_0x798a('0x6a')];});_0x5890a8['on'](_0x798a('0x26'),function(){fs[_0x798a('0x5d')](_0x1eda4e,parseInt('0777',0x8));return db[_0x798a('0x2b')]['create'](_0x2910bf)[_0x798a('0x22')](function(_0x5aed04){var _0x6f56a6={'role':_0x2789f7[_0x798a('0x6f')]['role'],'userProfileId':_0x2789f7[_0x798a('0x6f')]['userProfileId']};if(!_0x6f56a6)throw new Error(_0x798a('0x70'));if(_0x6f56a6[_0x798a('0x71')]===_0x798a('0x72')){var _0x31b2d3=_0x5aed04[_0x798a('0x24')]({'plain':!![]});return db[_0x798a('0x73')][_0x798a('0x46')]({'where':{'name':_0x798a('0x25'),'userProfileId':_0x6f56a6['userProfileId']},'raw':!![]})[_0x798a('0x22')](function(_0x414dd3){if(_0x414dd3&&_0x414dd3['autoAssociation']===0x0){return db[_0x798a('0x74')][_0x798a('0x75')]({'name':_0x31b2d3[_0x798a('0x29')],'resourceId':_0x31b2d3['id'],'type':_0x414dd3[_0x798a('0x29')],'sectionId':_0x414dd3['id']},{})[_0x798a('0x22')](function(){return _0x5aed04;});}else{return _0x5aed04;}})['catch'](function(_0x3cbbb5){logger['error'](_0x798a('0x76'),_0x3cbbb5);throw _0x3cbbb5;});}return _0x5aed04;})[_0x798a('0x22')](respondWithResult(_0x2451f3,null))[_0x798a('0x47')](handleError(_0x2451f3,null));});_0x5890a8['start']();}catch(_0x539e5f){_0x2451f3[_0x798a('0x17')](0x1f4)[_0x798a('0x2a')](_0x539e5f);}};exports[_0x798a('0x21')]=function(_0x10e4e3,_0x5bc354,_0x15e890){return db['Sound'][_0x798a('0x46')]({'where':{'id':_0x10e4e3[_0x798a('0x43')]['id']}})['then'](handleEntityNotFound(_0x5bc354,null))['then'](saveUpdates(_[_0x798a('0x3a')](_0x10e4e3[_0x798a('0x6f')],[_0x798a('0x29'),'description']),null))[_0x798a('0x22')](respondWithResult(_0x5bc354,null))[_0x798a('0x47')](handleError(_0x5bc354,null));};exports[_0x798a('0x77')]=function(_0x35576e,_0x4257c1,_0x25d882){return db[_0x798a('0x2b')][_0x798a('0x46')]({'where':{'id':_0x35576e['params']['id']}})[_0x798a('0x22')](function(_0x295605){if(_0x295605){return _0x295605[_0x798a('0x23')]();}})[_0x798a('0x22')](function(_0x447534){var _0x390aae=path['join'](config[_0x798a('0x4c')],_0x798a('0x59'),util[_0x798a('0x50')]('%s.%s',_0x447534['save_name'],_0x447534[_0x798a('0x78')]));var _0x48f7ca=path[_0x798a('0x4b')](config[_0x798a('0x4c')],_0x798a('0x4f'),util['format'](_0x798a('0x51'),_0x447534[_0x798a('0x49')],_0x447534[_0x798a('0x4d')]));fs['unlinkSync'](_0x390aae);fs[_0x798a('0x60')](_0x48f7ca);return _0x447534;})['then'](function(_0x367455){if(_0x367455){return _0x4257c1[_0x798a('0x17')](0xcc)[_0x798a('0x26')]();}})[_0x798a('0x22')](handleEntityNotFound(_0x4257c1,null))[_0x798a('0x47')](handleError(_0x4257c1,null));}; \ No newline at end of file +var _0x6b73=['Unable\x20to\x20retrieve\x20the\x20current\x20user','user','find','Sounds','userProfileId','autoAssociation','start','body','description','delete','original_format','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','get','error','stack','name','map','Sound','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','intersection','download','params','converted_format','existsSync','root','server/files/sounds/converted','save_name','Sequelize','ValidationError','format','%s.%s','create','basename','file','originalname','filename','extname','substring','join','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','0777','transcode','wav','unlinkSync','send','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','chmodSync','role'];(function(_0x30d546,_0xa70200){var _0x79d19d=function(_0x4a9c4d){while(--_0x4a9c4d){_0x30d546['push'](_0x30d546['shift']());}};_0x79d19d(++_0xa70200);}(_0x6b73,0xfb));var _0x36b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b73[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x36b7('0x0'));var rimraf=require(_0x36b7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x36b7('0x2'));var rp=require(_0x36b7('0x3'));var moment=require(_0x36b7('0x4'));var BPromise=require(_0x36b7('0x5'));var Mustache=require(_0x36b7('0x6'));var util=require(_0x36b7('0x7'));var path=require(_0x36b7('0x8'));var sox=require('sox');var csv=require(_0x36b7('0x9'));var ejs=require(_0x36b7('0xa'));var fs=require('fs');var fs_extra=require(_0x36b7('0xb'));var _=require(_0x36b7('0xc'));var squel=require(_0x36b7('0xd'));var crypto=require(_0x36b7('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x36b7('0xf'));var toCsv=require(_0x36b7('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x36b7('0x10'));var qs=require(_0x36b7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x36b7('0x12'))('api');var utils=require(_0x36b7('0x13'));var config=require(_0x36b7('0x14'));var licenseUtil=require(_0x36b7('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54f5a5,_0x3046c){_0x3046c=_0x3046c||0xcc;return function(_0x813ac9){if(_0x813ac9){return _0x54f5a5[_0x36b7('0x16')](_0x3046c);}return _0x54f5a5[_0x36b7('0x17')](_0x3046c)[_0x36b7('0x18')]();};}function respondWithResult(_0x36e8ef,_0x31334d){_0x31334d=_0x31334d||0xc8;return function(_0x62dc8c){if(_0x62dc8c){return _0x36e8ef[_0x36b7('0x17')](_0x31334d)[_0x36b7('0x19')](_0x62dc8c);}};}function respondWithFilteredResult(_0x5a8f16,_0xcc6bd6){return function(_0x707871){if(_0x707871){var _0x246702=typeof _0xcc6bd6[_0x36b7('0x1a')]===_0x36b7('0x1b')&&typeof _0xcc6bd6[_0x36b7('0x1c')]===_0x36b7('0x1b');var _0x146c1b=_0x707871[_0x36b7('0x1d')];var _0x2910af=_0x246702?0x0:_0xcc6bd6[_0x36b7('0x1a')];var _0x3f1e74=_0x246702?_0x707871[_0x36b7('0x1d')]:_0xcc6bd6[_0x36b7('0x1a')]+_0xcc6bd6[_0x36b7('0x1c')];var _0x4be8ff;if(_0x3f1e74>=_0x146c1b){_0x3f1e74=_0x146c1b;_0x4be8ff=0xc8;}else{_0x4be8ff=0xce;}_0x5a8f16[_0x36b7('0x17')](_0x4be8ff);return _0x5a8f16[_0x36b7('0x1e')]('Content-Range',_0x2910af+'-'+_0x3f1e74+'/'+_0x146c1b)[_0x36b7('0x19')](_0x707871);}return null;};}function patchUpdates(_0x25402f){return function(_0x3e651f){try{jsonpatch['apply'](_0x3e651f,_0x25402f,!![]);}catch(_0x1bff3a){return BPromise[_0x36b7('0x1f')](_0x1bff3a);}return _0x3e651f[_0x36b7('0x20')]();};}function saveUpdates(_0x183c5a,_0x341b1b){return function(_0x441495){if(_0x441495){return _0x441495[_0x36b7('0x21')](_0x183c5a)['then'](function(_0x1c36fb){return _0x1c36fb;});}return null;};}function removeEntity(_0x692dff,_0x3fab4c){return function(_0x4f78aa){if(_0x4f78aa){return _0x4f78aa[_0x36b7('0x22')]()[_0x36b7('0x23')](function(){var _0x4b1ad8=_0x4f78aa[_0x36b7('0x24')]({'plain':!![]});var _0x4c189c='Sounds';return db['UserProfileResource'][_0x36b7('0x22')]({'where':{'type':_0x4c189c,'resourceId':_0x4b1ad8['id']}})[_0x36b7('0x23')](function(){return _0x4f78aa;});})['then'](function(){_0x692dff[_0x36b7('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ff9de,_0x98d463){return function(_0x850925){if(!_0x850925){_0x4ff9de[_0x36b7('0x16')](0x194);}return _0x850925;};}function handleError(_0xf21a00,_0x504a84){_0x504a84=_0x504a84||0x1f4;return function(_0x9acc3e){logger[_0x36b7('0x25')](_0x9acc3e[_0x36b7('0x26')]);if(_0x9acc3e[_0x36b7('0x27')]){delete _0x9acc3e[_0x36b7('0x27')];}_0xf21a00[_0x36b7('0x17')](_0x504a84)['send'](_0x9acc3e);};}exports['index']=function(_0x4824d6,_0x344d2e){var _0x575fa1={},_0x57e0a9={},_0x1d0adb={'count':0x0,'rows':[]};var _0x39f54f=_[_0x36b7('0x28')](db[_0x36b7('0x29')][_0x36b7('0x2a')],function(_0x3d59c5){return{'name':_0x3d59c5['fieldName'],'type':_0x3d59c5[_0x36b7('0x2b')][_0x36b7('0x2c')]};});_0x57e0a9[_0x36b7('0x2d')]=_[_0x36b7('0x28')](_0x39f54f,'name');_0x57e0a9[_0x36b7('0x2e')]=_[_0x36b7('0x2f')](_0x4824d6[_0x36b7('0x2e')]);_0x57e0a9[_0x36b7('0x30')]=_['intersection'](_0x57e0a9['model'],_0x57e0a9[_0x36b7('0x2e')]);_0x575fa1[_0x36b7('0x31')]=_['intersection'](_0x57e0a9[_0x36b7('0x2d')],qs[_0x36b7('0x32')](_0x4824d6[_0x36b7('0x2e')][_0x36b7('0x32')]));_0x575fa1[_0x36b7('0x31')]=_0x575fa1['attributes'][_0x36b7('0x33')]?_0x575fa1[_0x36b7('0x31')]:_0x57e0a9['model'];if(!_0x4824d6[_0x36b7('0x2e')]['hasOwnProperty']('nolimit')){_0x575fa1['limit']=qs[_0x36b7('0x1c')](_0x4824d6['query']['limit']);_0x575fa1[_0x36b7('0x1a')]=qs[_0x36b7('0x1a')](_0x4824d6[_0x36b7('0x2e')][_0x36b7('0x1a')]);}_0x575fa1[_0x36b7('0x34')]=qs[_0x36b7('0x35')](_0x4824d6[_0x36b7('0x2e')][_0x36b7('0x35')]);_0x575fa1['where']=qs[_0x36b7('0x30')](_[_0x36b7('0x36')](_0x4824d6[_0x36b7('0x2e')],_0x57e0a9[_0x36b7('0x30')]),_0x39f54f);if(_0x4824d6[_0x36b7('0x2e')][_0x36b7('0x37')]){_0x575fa1[_0x36b7('0x38')]=_['merge'](_0x575fa1['where'],{'$or':_[_0x36b7('0x28')](_0x39f54f,function(_0x5e3e8c){if(_0x5e3e8c[_0x36b7('0x2b')]!==_0x36b7('0x39')){var _0xf2d025={};_0xf2d025[_0x5e3e8c[_0x36b7('0x27')]]={'$like':'%'+_0x4824d6[_0x36b7('0x2e')][_0x36b7('0x37')]+'%'};return _0xf2d025;}})});}_0x575fa1=_['merge']({},_0x575fa1,_0x4824d6[_0x36b7('0x3a')]);var _0x5e9ebd={'where':_0x575fa1['where']};return db[_0x36b7('0x29')][_0x36b7('0x1d')](_0x5e9ebd)[_0x36b7('0x23')](function(_0x2ccebd){_0x1d0adb[_0x36b7('0x1d')]=_0x2ccebd;if(_0x4824d6[_0x36b7('0x2e')][_0x36b7('0x3b')]){_0x575fa1[_0x36b7('0x3c')]=[{'all':!![]}];}return db[_0x36b7('0x29')][_0x36b7('0x3d')](_0x575fa1);})['then'](function(_0x383fe4){_0x1d0adb[_0x36b7('0x3e')]=_0x383fe4;return _0x1d0adb;})[_0x36b7('0x23')](respondWithFilteredResult(_0x344d2e,_0x575fa1))[_0x36b7('0x3f')](handleError(_0x344d2e,null));};exports[_0x36b7('0x40')]=function(_0x1feb2e,_0x2017a7){var _0x4966ef={'raw':!![],'where':{'id':_0x1feb2e['params']['id']}},_0x316f22={};_0x316f22[_0x36b7('0x2d')]=_[_0x36b7('0x2f')](db[_0x36b7('0x29')][_0x36b7('0x2a')]);_0x316f22[_0x36b7('0x2e')]=_[_0x36b7('0x2f')](_0x1feb2e['query']);_0x316f22[_0x36b7('0x30')]=_[_0x36b7('0x41')](_0x316f22[_0x36b7('0x2d')],_0x316f22[_0x36b7('0x2e')]);_0x4966ef['attributes']=_[_0x36b7('0x41')](_0x316f22['model'],qs['fields'](_0x1feb2e[_0x36b7('0x2e')]['fields']));_0x4966ef[_0x36b7('0x31')]=_0x4966ef[_0x36b7('0x31')][_0x36b7('0x33')]?_0x4966ef[_0x36b7('0x31')]:_0x316f22['model'];if(_0x1feb2e[_0x36b7('0x2e')][_0x36b7('0x3b')]){_0x4966ef[_0x36b7('0x3c')]=[{'all':!![]}];}_0x4966ef=_['merge']({},_0x4966ef,_0x1feb2e[_0x36b7('0x3a')]);return db['Sound']['find'](_0x4966ef)['then'](handleEntityNotFound(_0x2017a7,null))['then'](respondWithResult(_0x2017a7,null))[_0x36b7('0x3f')](handleError(_0x2017a7,null));};exports[_0x36b7('0x42')]=function(_0x42d51a,_0x2439ef,_0x36168b){return db[_0x36b7('0x29')]['find']({'where':{'id':_0x42d51a[_0x36b7('0x43')]['id']},'attributes':[_0x36b7('0x27'),'save_name',_0x36b7('0x44')],'raw':!![]})['then'](handleEntityNotFound(_0x2439ef,null))[_0x36b7('0x23')](function(_0x5294bb){if(_0x5294bb){if(!fs[_0x36b7('0x45')](path['join'](config[_0x36b7('0x46')],_0x36b7('0x47'),_0x5294bb[_0x36b7('0x48')]+'.'+_0x5294bb['converted_format']))){throw new db[(_0x36b7('0x49'))][(_0x36b7('0x4a'))]('Sound\x20not\x20found');}return _0x2439ef[_0x36b7('0x42')](path['join'](config[_0x36b7('0x46')],'server/files/sounds/converted',util[_0x36b7('0x4b')](_0x36b7('0x4c'),_0x5294bb[_0x36b7('0x48')],_0x5294bb[_0x36b7('0x44')])),util[_0x36b7('0x4b')]('%s.%s',_0x5294bb[_0x36b7('0x27')],_0x5294bb[_0x36b7('0x44')]));}return null;})['catch'](handleError(_0x2439ef,null));};exports[_0x36b7('0x4d')]=function(_0x366d81,_0x599ef4,_0x53f0f6){var _0x2eb925={'name':path[_0x36b7('0x4e')](_0x366d81[_0x36b7('0x4f')][_0x36b7('0x50')],path['extname'](_0x366d81[_0x36b7('0x4f')][_0x36b7('0x50')])),'save_name':path[_0x36b7('0x4e')](_0x366d81[_0x36b7('0x4f')][_0x36b7('0x51')],path[_0x36b7('0x52')](_0x366d81['file']['filename'])),'original_format':path[_0x36b7('0x52')](_0x366d81[_0x36b7('0x4f')]['originalname'])[_0x36b7('0x53')](0x1),'converted_format':'wav'};var _0x3e41ac=path[_0x36b7('0x54')](config[_0x36b7('0x46')],_0x36b7('0x55'),_0x366d81[_0x36b7('0x4f')][_0x36b7('0x51')]);var _0x5eb640=path[_0x36b7('0x54')](config[_0x36b7('0x46')],_0x36b7('0x47'),util[_0x36b7('0x4b')](_0x36b7('0x4c'),path[_0x36b7('0x4e')](_0x366d81['file'][_0x36b7('0x51')],path['extname'](_0x366d81['file'][_0x36b7('0x51')])),_0x2eb925[_0x36b7('0x44')]));logger[_0x36b7('0x56')]('Sound\x20upload\x20filepath:\x20%s',_0x3e41ac);logger[_0x36b7('0x56')](_0x36b7('0x57'),_0x5eb640);try{fs['chmodSync'](_0x3e41ac,parseInt(_0x36b7('0x58'),0x8));var _0x34c863=sox[_0x36b7('0x59')](_0x3e41ac,_0x5eb640,{'sampleRate':0x1f40,'format':_0x36b7('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x34c863['on'](_0x36b7('0x25'),function(_0x1c1fe8){fs[_0x36b7('0x5b')](_0x3e41ac);_0x599ef4[_0x36b7('0x17')](0x1f4)[_0x36b7('0x5c')](_0x1c1fe8);});_0x34c863['on'](_0x36b7('0x5d'),function(_0xef6f78){_0x2eb925[_0x36b7('0x5e')]=isNaN(_0xef6f78[_0x36b7('0x5f')])?null:_0xef6f78[_0x36b7('0x5f')]*0x3e8;_0x2eb925[_0x36b7('0x60')]=isNaN(_0xef6f78[_0x36b7('0x61')])?null:_0xef6f78[_0x36b7('0x61')];_0x2eb925['original_channelCount']=isNaN(_0xef6f78[_0x36b7('0x62')])?null:_0xef6f78[_0x36b7('0x62')];_0x2eb925[_0x36b7('0x63')]=isNaN(_0xef6f78['bitRate'])?null:_0xef6f78[_0x36b7('0x64')];_0x2eb925[_0x36b7('0x65')]=isNaN(_0xef6f78[_0x36b7('0x66')])?null:_0xef6f78[_0x36b7('0x66')];});_0x34c863['on'](_0x36b7('0x67'),function(_0x5ccebc){_0x2eb925[_0x36b7('0x68')]=isNaN(_0x5ccebc[_0x36b7('0x5f')])?null:_0x5ccebc[_0x36b7('0x5f')]*0x3e8;_0x2eb925[_0x36b7('0x69')]=isNaN(_0x5ccebc[_0x36b7('0x61')])?null:_0x5ccebc[_0x36b7('0x61')];_0x2eb925[_0x36b7('0x6a')]=isNaN(_0x5ccebc[_0x36b7('0x62')])?null:_0x5ccebc[_0x36b7('0x62')];_0x2eb925['converted_bitRate']=isNaN(_0x5ccebc['bitRate'])?null:_0x5ccebc[_0x36b7('0x64')];_0x2eb925['converted_sampleRate']=isNaN(_0x5ccebc[_0x36b7('0x66')])?null:_0x5ccebc[_0x36b7('0x66')];});_0x34c863['on'](_0x36b7('0x18'),function(){fs[_0x36b7('0x6b')](_0x5eb640,parseInt(_0x36b7('0x58'),0x8));return db['Sound']['create'](_0x2eb925)[_0x36b7('0x23')](function(_0x32eb4d){var _0x3811d2={'role':_0x366d81['body'][_0x36b7('0x6c')],'userProfileId':_0x366d81['body']['userProfileId']};if(!_0x3811d2)throw new Error(_0x36b7('0x6d'));if(_0x3811d2[_0x36b7('0x6c')]===_0x36b7('0x6e')){var _0x2021fd=_0x32eb4d['get']({'plain':!![]});return db['UserProfileSection'][_0x36b7('0x6f')]({'where':{'name':_0x36b7('0x70'),'userProfileId':_0x3811d2[_0x36b7('0x71')]},'raw':!![]})[_0x36b7('0x23')](function(_0x516dd9){if(_0x516dd9&&_0x516dd9[_0x36b7('0x72')]===0x0){return db['UserProfileResource']['create']({'name':_0x2021fd[_0x36b7('0x27')],'resourceId':_0x2021fd['id'],'type':_0x516dd9['name'],'sectionId':_0x516dd9['id']},{})[_0x36b7('0x23')](function(){return _0x32eb4d;});}else{return _0x32eb4d;}})[_0x36b7('0x3f')](function(_0x13e03a){logger[_0x36b7('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13e03a);throw _0x13e03a;});}return _0x32eb4d;})[_0x36b7('0x23')](respondWithResult(_0x599ef4,null))['catch'](handleError(_0x599ef4,null));});_0x34c863[_0x36b7('0x73')]();}catch(_0x338ca3){_0x599ef4[_0x36b7('0x17')](0x1f4)['send'](_0x338ca3);}};exports[_0x36b7('0x21')]=function(_0x5eb83a,_0x365907,_0x38d188){return db[_0x36b7('0x29')][_0x36b7('0x6f')]({'where':{'id':_0x5eb83a[_0x36b7('0x43')]['id']}})[_0x36b7('0x23')](handleEntityNotFound(_0x365907,null))[_0x36b7('0x23')](saveUpdates(_[_0x36b7('0x36')](_0x5eb83a[_0x36b7('0x74')],['name',_0x36b7('0x75')]),null))[_0x36b7('0x23')](respondWithResult(_0x365907,null))[_0x36b7('0x3f')](handleError(_0x365907,null));};exports[_0x36b7('0x76')]=function(_0x473646,_0x31bfd1,_0xc25170){return db['Sound']['find']({'where':{'id':_0x473646['params']['id']}})[_0x36b7('0x23')](function(_0x57abf6){if(_0x57abf6){return _0x57abf6[_0x36b7('0x22')]();}})[_0x36b7('0x23')](function(_0x518d3d){var _0x4d2d53=path[_0x36b7('0x54')](config['root'],_0x36b7('0x55'),util[_0x36b7('0x4b')](_0x36b7('0x4c'),_0x518d3d[_0x36b7('0x48')],_0x518d3d[_0x36b7('0x77')]));var _0x534a47=path[_0x36b7('0x54')](config['root'],'server/files/sounds/converted',util[_0x36b7('0x4b')]('%s.%s',_0x518d3d['save_name'],_0x518d3d[_0x36b7('0x44')]));fs[_0x36b7('0x5b')](_0x4d2d53);fs['unlinkSync'](_0x534a47);return _0x518d3d;})['then'](function(_0x3dab21){if(_0x3dab21){return _0x31bfd1[_0x36b7('0x17')](0xcc)[_0x36b7('0x18')]();}})['then'](handleEntityNotFound(_0x31bfd1,null))[_0x36b7('0x3f')](handleError(_0x31bfd1,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index d4eb261..e24b66a 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 _0x1900=['moment','request-promise','rimraf','../../config/environment','./sound.attributes','exports','Sound','lodash','util','../../config/logger','api'];(function(_0x65200e,_0x44e42b){var _0x2f57de=function(_0x864b3c){while(--_0x864b3c){_0x65200e['push'](_0x65200e['shift']());}};_0x2f57de(++_0x44e42b);}(_0x1900,0x172));var _0x0190=function(_0xe06a8e,_0x197e62){_0xe06a8e=_0xe06a8e-0x0;var _0x3dc1d0=_0x1900[_0xe06a8e];return _0x3dc1d0;};'use strict';var _=require(_0x0190('0x0'));var util=require(_0x0190('0x1'));var logger=require(_0x0190('0x2'))(_0x0190('0x3'));var moment=require(_0x0190('0x4'));var BPromise=require('bluebird');var rp=require(_0x0190('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0190('0x6'));var config=require(_0x0190('0x7'));var attributes=require(_0x0190('0x8'));module[_0x0190('0x9')]=function(_0x1469ca,_0x3b5ebd){return _0x1469ca['define'](_0x0190('0xa'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x09a5=['tools_sounds','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x09a5,0x85));var _0x509a=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x09a5[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x509a('0x0'))(_0x509a('0x1'));var moment=require(_0x509a('0x2'));var BPromise=require('bluebird');var rp=require(_0x509a('0x3'));var fs=require('fs');var path=require(_0x509a('0x4'));var rimraf=require(_0x509a('0x5'));var config=require(_0x509a('0x6'));var attributes=require(_0x509a('0x7'));module[_0x509a('0x8')]=function(_0xbf2b09,_0x48912c){return _0xbf2b09[_0x509a('0x9')](_0x509a('0xa'),attributes,{'tableName':_0x509a('0xb'),'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 b4f3bed..8262297 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 _0xf41e=['message','info','result','catch','ShowSound','find','options','raw','include','map','model','attributes','lodash','util','moment','randomstring','../../mysqldb','rpc','jayson/promise','client','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x15c19a,_0xd4667b){var _0x3290d9=function(_0x1c533d){while(--_0x1c533d){_0x15c19a['push'](_0x15c19a['shift']());}};_0x3290d9(++_0xd4667b);}(_0xf41e,0x194));var _0xef41=function(_0x4996af,_0x3a1ef9){_0x4996af=_0x4996af-0x0;var _0x55eab0=_0xf41e[_0x4996af];return _0x55eab0;};'use strict';var _=require(_0xef41('0x0'));var util=require(_0xef41('0x1'));var moment=require(_0xef41('0x2'));var BPromise=require('bluebird');var rs=require(_0xef41('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef41('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xef41('0x5'));var config=require('../../config/environment');var jayson=require(_0xef41('0x6'));var client=jayson[_0xef41('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26ec60,_0x49f7e4,_0x2a28f2){return new BPromise(function(_0x31b10a,_0x5cb12c){return client[_0xef41('0x8')](_0x26ec60,_0x2a28f2)[_0xef41('0x9')](function(_0x50d286){logger['info'](_0xef41('0xa'),_0x49f7e4,_0xef41('0xb'));logger[_0xef41('0xc')](_0xef41('0xd'),_0x49f7e4,_0xef41('0xb'),JSON[_0xef41('0xe')](_0x50d286));if(_0x50d286['error']){if(_0x50d286[_0xef41('0xf')]['code']===0x1f4){logger['error'](_0xef41('0xa'),_0x49f7e4,_0x50d286[_0xef41('0xf')]['message']);return _0x5cb12c(_0x50d286['error']['message']);}logger[_0xef41('0xf')](_0xef41('0xa'),_0x49f7e4,_0x50d286[_0xef41('0xf')][_0xef41('0x10')]);return _0x31b10a(_0x50d286[_0xef41('0xf')][_0xef41('0x10')]);}else{logger[_0xef41('0x11')]('Sound,\x20%s,\x20%s',_0x49f7e4,'request\x20sent');_0x31b10a(_0x50d286[_0xef41('0x12')][_0xef41('0x10')]);}})[_0xef41('0x13')](function(_0x4ed8f4){logger['error'](_0xef41('0xa'),_0x49f7e4,_0x4ed8f4);_0x5cb12c(_0x4ed8f4);});});}exports[_0xef41('0x14')]=function(_0x568592){var _0x6c978a=this;return new Promise(function(_0x17d3f7,_0x48621c){return db['Sound'][_0xef41('0x15')]({'raw':_0x568592[_0xef41('0x16')]?_0x568592['options'][_0xef41('0x17')]===undefined?!![]:![]:!![],'where':_0x568592[_0xef41('0x16')]?_0x568592[_0xef41('0x16')]['where']||null:null,'attributes':_0x568592[_0xef41('0x16')]?_0x568592[_0xef41('0x16')]['attributes']||null:null,'include':_0x568592[_0xef41('0x16')]?_0x568592['options'][_0xef41('0x18')]?_[_0xef41('0x19')](_0x568592[_0xef41('0x16')][_0xef41('0x18')],function(_0x13a94c){return{'model':db[_0x13a94c[_0xef41('0x1a')]],'as':_0x13a94c['as'],'attributes':_0x13a94c['attributes'],'include':_0x13a94c[_0xef41('0x18')]?_[_0xef41('0x19')](_0x13a94c[_0xef41('0x18')],function(_0x16def4){return{'model':db[_0x16def4['model']],'as':_0x16def4['as'],'attributes':_0x16def4['attributes'],'include':_0x16def4[_0xef41('0x18')]?_[_0xef41('0x19')](_0x16def4[_0xef41('0x18')],function(_0xc66ad1){return{'model':db[_0xc66ad1[_0xef41('0x1a')]],'as':_0xc66ad1['as'],'attributes':_0xc66ad1[_0xef41('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xef41('0x9')](function(_0x18fb3a){logger[_0xef41('0x11')](_0xef41('0x14'),_0x568592);logger['debug']('ShowSound',_0x568592,JSON[_0xef41('0xe')](_0x18fb3a));_0x17d3f7(_0x18fb3a);})[_0xef41('0x13')](function(_0x300aac){logger[_0xef41('0xf')]('ShowSound',_0x300aac[_0xef41('0x10')],_0x568592);_0x48621c(_0x6c978a[_0xef41('0xf')](0x1f4,_0x300aac[_0xef41('0x10')]));});});}; \ No newline at end of file +var _0xe061=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','Sound,\x20%s,\x20%s','message','info','result','catch','ShowSound','Sound','find','options','raw','where','attributes','include','model','map','then','lodash','util','moment'];(function(_0x2716e3,_0x4680bb){var _0x1e4ad5=function(_0x4d4c9c){while(--_0x4d4c9c){_0x2716e3['push'](_0x2716e3['shift']());}};_0x1e4ad5(++_0x4680bb);}(_0xe061,0x85));var _0x1e06=function(_0x3ac2cd,_0x153d1a){_0x3ac2cd=_0x3ac2cd-0x0;var _0x3c23ca=_0xe061[_0x3ac2cd];return _0x3c23ca;};'use strict';var _=require(_0x1e06('0x0'));var util=require(_0x1e06('0x1'));var moment=require(_0x1e06('0x2'));var BPromise=require(_0x1e06('0x3'));var rs=require(_0x1e06('0x4'));var fs=require('fs');var Redis=require(_0x1e06('0x5'));var db=require(_0x1e06('0x6'))['db'];var utils=require(_0x1e06('0x7'));var logger=require(_0x1e06('0x8'))(_0x1e06('0x9'));var config=require(_0x1e06('0xa'));var jayson=require(_0x1e06('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x12aa83,_0x26016f,_0x5274d0){return new BPromise(function(_0x566797,_0x4acc53){return client[_0x1e06('0xc')](_0x12aa83,_0x5274d0)['then'](function(_0x592c6f){logger['info']('Sound,\x20%s,\x20%s',_0x26016f,_0x1e06('0xd'));logger[_0x1e06('0xe')](_0x1e06('0xf'),_0x26016f,_0x1e06('0xd'),JSON[_0x1e06('0x10')](_0x592c6f));if(_0x592c6f[_0x1e06('0x11')]){if(_0x592c6f[_0x1e06('0x11')]['code']===0x1f4){logger[_0x1e06('0x11')](_0x1e06('0x12'),_0x26016f,_0x592c6f[_0x1e06('0x11')][_0x1e06('0x13')]);return _0x4acc53(_0x592c6f['error'][_0x1e06('0x13')]);}logger['error'](_0x1e06('0x12'),_0x26016f,_0x592c6f[_0x1e06('0x11')][_0x1e06('0x13')]);return _0x566797(_0x592c6f[_0x1e06('0x11')][_0x1e06('0x13')]);}else{logger[_0x1e06('0x14')]('Sound,\x20%s,\x20%s',_0x26016f,'request\x20sent');_0x566797(_0x592c6f[_0x1e06('0x15')][_0x1e06('0x13')]);}})[_0x1e06('0x16')](function(_0x5b1652){logger['error'](_0x1e06('0x12'),_0x26016f,_0x5b1652);_0x4acc53(_0x5b1652);});});}exports[_0x1e06('0x17')]=function(_0x5ddee7){var _0x5dab02=this;return new Promise(function(_0x1a4080,_0xe8ca74){return db[_0x1e06('0x18')][_0x1e06('0x19')]({'raw':_0x5ddee7[_0x1e06('0x1a')]?_0x5ddee7['options'][_0x1e06('0x1b')]===undefined?!![]:![]:!![],'where':_0x5ddee7[_0x1e06('0x1a')]?_0x5ddee7[_0x1e06('0x1a')][_0x1e06('0x1c')]||null:null,'attributes':_0x5ddee7['options']?_0x5ddee7[_0x1e06('0x1a')][_0x1e06('0x1d')]||null:null,'include':_0x5ddee7[_0x1e06('0x1a')]?_0x5ddee7['options'][_0x1e06('0x1e')]?_['map'](_0x5ddee7[_0x1e06('0x1a')][_0x1e06('0x1e')],function(_0x5e5d32){return{'model':db[_0x5e5d32[_0x1e06('0x1f')]],'as':_0x5e5d32['as'],'attributes':_0x5e5d32[_0x1e06('0x1d')],'include':_0x5e5d32[_0x1e06('0x1e')]?_[_0x1e06('0x20')](_0x5e5d32[_0x1e06('0x1e')],function(_0x31dd0a){return{'model':db[_0x31dd0a[_0x1e06('0x1f')]],'as':_0x31dd0a['as'],'attributes':_0x31dd0a['attributes'],'include':_0x31dd0a[_0x1e06('0x1e')]?_['map'](_0x31dd0a[_0x1e06('0x1e')],function(_0x502f2a){return{'model':db[_0x502f2a[_0x1e06('0x1f')]],'as':_0x502f2a['as'],'attributes':_0x502f2a[_0x1e06('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1e06('0x21')](function(_0x29d159){logger['info'](_0x1e06('0x17'),_0x5ddee7);logger[_0x1e06('0xe')]('ShowSound',_0x5ddee7,JSON[_0x1e06('0x10')](_0x29d159));_0x1a4080(_0x29d159);})[_0x1e06('0x16')](function(_0x590519){logger[_0x1e06('0x11')](_0x1e06('0x17'),_0x590519[_0x1e06('0x13')],_0x5ddee7);_0xe8ca74(_0x5dab02[_0x1e06('0x11')](0x1f4,_0x590519[_0x1e06('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 9ddae9d..82a9b1b 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x596e98,_0xc326c9){var _0x1c09ac=function(_0x3d839d){while(--_0x3d839d){_0x596e98['push'](_0x596e98['shift']());}};_0x1c09ac(++_0xc326c9);}(_0x2032,0xd9));var _0x2203=function(_0x245567,_0x2708ff){_0x245567=_0x245567-0x0;var _0x4e0e0e=_0x2032[_0x245567];return _0x4e0e0e;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('0x11')]=router; \ No newline at end of file +var _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x508e17,_0x1a0cb6){var _0x485044=function(_0xd31847){while(--_0xd31847){_0x508e17['push'](_0x508e17['shift']());}};_0x485044(++_0x1a0cb6);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0xb7e7[_0x5d80de];return _0x1c7556;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 749f149..ae602ee 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 _0x9c5e=['out','sequelize','STRING','TEXT','medium','ENUM'];(function(_0x7894bf,_0x5bbdc0){var _0x2e36d6=function(_0x5ba193){while(--_0x5ba193){_0x7894bf['push'](_0x7894bf['shift']());}};_0x2e36d6(++_0x5bbdc0);}(_0x9c5e,0xc1));var _0xe9c5=function(_0x3215c8,_0x329596){_0x3215c8=_0x3215c8-0x0;var _0x4570a8=_0x9c5e[_0x3215c8];return _0x4570a8;};'use strict';var Sequelize=require(_0xe9c5('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9c5('0x1')]},'body':{'type':Sequelize[_0xe9c5('0x2')](_0xe9c5('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xe9c5('0x4')]('in',_0xe9c5('0x5')),'defaultValue':_0xe9c5('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0xe9c5('0x1')]},'providerResponse':{'type':Sequelize[_0xe9c5('0x2')]}}; \ No newline at end of file +var _0x7abe=['TEXT','medium','ENUM','out','sequelize','STRING'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x7abe,0xf4));var _0xe7ab=function(_0x4a4eb6,_0x34e9a3){_0x4a4eb6=_0x4a4eb6-0x0;var _0x105085=_0x7abe[_0x4a4eb6];return _0x105085;};'use strict';var Sequelize=require(_0xe7ab('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe7ab('0x1')]},'body':{'type':Sequelize[_0xe7ab('0x2')](_0xe7ab('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xe7ab('0x4')]('in',_0xe7ab('0x5')),'defaultValue':_0xe7ab('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0xe7ab('0x1')]},'providerResponse':{'type':Sequelize[_0xe7ab('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index a958b7e..d1d4a9e 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 _0xb248=['sort','pick','filter','where','merge','includeAll','rows','catch','show','params','options','create','body','find','destroy','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','SquareMessage','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x4aa7bd,_0x497f8e){var _0x45445e=function(_0x33c6f1){while(--_0x33c6f1){_0x4aa7bd['push'](_0x4aa7bd['shift']());}};_0x45445e(++_0x497f8e);}(_0xb248,0x1b9));var _0x8b24=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xb248[_0x4fde08];return _0x12e725;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b24('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8b24('0x1'));var moment=require(_0x8b24('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8b24('0x3'));var util=require(_0x8b24('0x4'));var path=require(_0x8b24('0x5'));var sox=require(_0x8b24('0x6'));var csv=require(_0x8b24('0x7'));var ejs=require(_0x8b24('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8b24('0x9'));var squel=require(_0x8b24('0xa'));var crypto=require(_0x8b24('0xb'));var jsforce=require(_0x8b24('0xc'));var deskjs=require(_0x8b24('0xd'));var toCsv=require(_0x8b24('0x7'));var querystring=require(_0x8b24('0xe'));var Papa=require(_0x8b24('0xf'));var Redis=require('ioredis');var authService=require(_0x8b24('0x10'));var qs=require(_0x8b24('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8b24('0x12'));var logger=require(_0x8b24('0x13'))(_0x8b24('0x14'));var utils=require(_0x8b24('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8b24('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x559609,_0x30a717){_0x30a717=_0x30a717||0xcc;return function(_0x307b2b){if(_0x307b2b){return _0x559609[_0x8b24('0x17')](_0x30a717);}return _0x559609[_0x8b24('0x18')](_0x30a717)[_0x8b24('0x19')]();};}function respondWithResult(_0x5e2c45,_0x4c3668){_0x4c3668=_0x4c3668||0xc8;return function(_0x24def3){if(_0x24def3){return _0x5e2c45['status'](_0x4c3668)[_0x8b24('0x1a')](_0x24def3);}};}function respondWithFilteredResult(_0x4474e4,_0x36c5c3){return function(_0x2100a9){if(_0x2100a9){var _0x3e24af=typeof _0x36c5c3['offset']===_0x8b24('0x1b')&&typeof _0x36c5c3[_0x8b24('0x1c')]==='undefined';var _0x3b0acc=_0x2100a9['count'];var _0x1769ea=_0x3e24af?0x0:_0x36c5c3[_0x8b24('0x1d')];var _0x2a89f9=_0x3e24af?_0x2100a9[_0x8b24('0x1e')]:_0x36c5c3[_0x8b24('0x1d')]+_0x36c5c3['limit'];var _0x4301ef;if(_0x2a89f9>=_0x3b0acc){_0x2a89f9=_0x3b0acc;_0x4301ef=0xc8;}else{_0x4301ef=0xce;}_0x4474e4[_0x8b24('0x18')](_0x4301ef);return _0x4474e4[_0x8b24('0x1f')](_0x8b24('0x20'),_0x1769ea+'-'+_0x2a89f9+'/'+_0x3b0acc)[_0x8b24('0x1a')](_0x2100a9);}return null;};}function patchUpdates(_0x1b2933){return function(_0x4f23ab){try{jsonpatch['apply'](_0x4f23ab,_0x1b2933,!![]);}catch(_0x542ed7){return BPromise[_0x8b24('0x21')](_0x542ed7);}return _0x4f23ab[_0x8b24('0x22')]();};}function saveUpdates(_0x591ada,_0x27fdd3){return function(_0x26b867){if(_0x26b867){return _0x26b867[_0x8b24('0x23')](_0x591ada)[_0x8b24('0x24')](function(_0x38bb05){return _0x38bb05;});}return null;};}function removeEntity(_0x524e7e,_0x35f965){return function(_0x286523){if(_0x286523){return _0x286523['destroy']()[_0x8b24('0x24')](function(){_0x524e7e[_0x8b24('0x18')](0xcc)[_0x8b24('0x19')]();});}};}function handleEntityNotFound(_0x10bc19,_0x47049b){return function(_0x5333ad){if(!_0x5333ad){_0x10bc19[_0x8b24('0x17')](0x194);}return _0x5333ad;};}function handleError(_0x5e87d7,_0x121e5c){_0x121e5c=_0x121e5c||0x1f4;return function(_0x40de5a){logger[_0x8b24('0x25')](_0x40de5a[_0x8b24('0x26')]);if(_0x40de5a[_0x8b24('0x27')]){delete _0x40de5a[_0x8b24('0x27')];}_0x5e87d7['status'](_0x121e5c)[_0x8b24('0x28')](_0x40de5a);};}exports[_0x8b24('0x29')]=function(_0x25eb46,_0x29b1c0){var _0x7f851b={},_0x209b4c={},_0xa7aff0={'count':0x0,'rows':[]};var _0x218cc5=_[_0x8b24('0x2a')](db[_0x8b24('0x2b')]['rawAttributes'],function(_0x3f0bc2){return{'name':_0x3f0bc2['fieldName'],'type':_0x3f0bc2[_0x8b24('0x2c')][_0x8b24('0x2d')]};});_0x209b4c[_0x8b24('0x2e')]=_[_0x8b24('0x2a')](_0x218cc5,_0x8b24('0x27'));_0x209b4c[_0x8b24('0x2f')]=_[_0x8b24('0x30')](_0x25eb46[_0x8b24('0x2f')]);_0x209b4c[_0x8b24('0x31')]=_[_0x8b24('0x32')](_0x209b4c[_0x8b24('0x2e')],_0x209b4c[_0x8b24('0x2f')]);_0x7f851b[_0x8b24('0x33')]=_[_0x8b24('0x32')](_0x209b4c[_0x8b24('0x2e')],qs[_0x8b24('0x34')](_0x25eb46['query'][_0x8b24('0x34')]));_0x7f851b[_0x8b24('0x33')]=_0x7f851b['attributes'][_0x8b24('0x35')]?_0x7f851b[_0x8b24('0x33')]:_0x209b4c[_0x8b24('0x2e')];if(!_0x25eb46['query'][_0x8b24('0x36')](_0x8b24('0x37'))){_0x7f851b[_0x8b24('0x1c')]=qs[_0x8b24('0x1c')](_0x25eb46['query'][_0x8b24('0x1c')]);_0x7f851b[_0x8b24('0x1d')]=qs[_0x8b24('0x1d')](_0x25eb46['query']['offset']);}_0x7f851b['order']=qs[_0x8b24('0x38')](_0x25eb46[_0x8b24('0x2f')][_0x8b24('0x38')]);_0x7f851b['where']=qs[_0x8b24('0x31')](_[_0x8b24('0x39')](_0x25eb46[_0x8b24('0x2f')],_0x209b4c[_0x8b24('0x31')]),_0x218cc5);if(_0x25eb46['query'][_0x8b24('0x3a')]){_0x7f851b[_0x8b24('0x3b')]=_[_0x8b24('0x3c')](_0x7f851b[_0x8b24('0x3b')],{'$or':_['map'](_0x218cc5,function(_0x4c280d){if(_0x4c280d[_0x8b24('0x2c')]!=='VIRTUAL'){var _0x6f9398={};_0x6f9398[_0x4c280d[_0x8b24('0x27')]]={'$like':'%'+_0x25eb46[_0x8b24('0x2f')][_0x8b24('0x3a')]+'%'};return _0x6f9398;}})});}_0x7f851b=_[_0x8b24('0x3c')]({},_0x7f851b,_0x25eb46['options']);var _0x3e23b7={'where':_0x7f851b['where']};return db[_0x8b24('0x2b')][_0x8b24('0x1e')](_0x3e23b7)[_0x8b24('0x24')](function(_0x112977){_0xa7aff0[_0x8b24('0x1e')]=_0x112977;if(_0x25eb46[_0x8b24('0x2f')][_0x8b24('0x3d')]){_0x7f851b['include']=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x7f851b);})[_0x8b24('0x24')](function(_0x1f5ba2){_0xa7aff0[_0x8b24('0x3e')]=_0x1f5ba2;return _0xa7aff0;})['then'](respondWithFilteredResult(_0x29b1c0,_0x7f851b))[_0x8b24('0x3f')](handleError(_0x29b1c0,null));};exports[_0x8b24('0x40')]=function(_0x3726dc,_0x5d0e1a){var _0x5f0972={'raw':!![],'where':{'id':_0x3726dc[_0x8b24('0x41')]['id']}},_0x5e0f57={};_0x5e0f57['model']=_[_0x8b24('0x30')](db[_0x8b24('0x2b')]['rawAttributes']);_0x5e0f57[_0x8b24('0x2f')]=_[_0x8b24('0x30')](_0x3726dc['query']);_0x5e0f57[_0x8b24('0x31')]=_[_0x8b24('0x32')](_0x5e0f57[_0x8b24('0x2e')],_0x5e0f57[_0x8b24('0x2f')]);_0x5f0972[_0x8b24('0x33')]=_[_0x8b24('0x32')](_0x5e0f57[_0x8b24('0x2e')],qs['fields'](_0x3726dc[_0x8b24('0x2f')]['fields']));_0x5f0972['attributes']=_0x5f0972[_0x8b24('0x33')][_0x8b24('0x35')]?_0x5f0972[_0x8b24('0x33')]:_0x5e0f57[_0x8b24('0x2e')];if(_0x3726dc[_0x8b24('0x2f')][_0x8b24('0x3d')]){_0x5f0972['include']=[{'all':!![]}];}_0x5f0972=_['merge']({},_0x5f0972,_0x3726dc[_0x8b24('0x42')]);return db['SquareMessage']['find'](_0x5f0972)[_0x8b24('0x24')](handleEntityNotFound(_0x5d0e1a,null))[_0x8b24('0x24')](respondWithResult(_0x5d0e1a,null))['catch'](handleError(_0x5d0e1a,null));};exports[_0x8b24('0x43')]=function(_0x5f4500,_0x4f8a2d){return db[_0x8b24('0x2b')][_0x8b24('0x43')](_0x5f4500['body'],{})['then'](respondWithResult(_0x4f8a2d,0xc9))['catch'](handleError(_0x4f8a2d,null));};exports['update']=function(_0x5af749,_0x18edca){if(_0x5af749['body']['id']){delete _0x5af749[_0x8b24('0x44')]['id'];}return db['SquareMessage'][_0x8b24('0x45')]({'where':{'id':_0x5af749[_0x8b24('0x41')]['id']}})['then'](handleEntityNotFound(_0x18edca,null))[_0x8b24('0x24')](saveUpdates(_0x5af749[_0x8b24('0x44')],null))[_0x8b24('0x24')](respondWithResult(_0x18edca,null))[_0x8b24('0x3f')](handleError(_0x18edca,null));};exports[_0x8b24('0x46')]=function(_0x3362ad,_0x124566){return db[_0x8b24('0x2b')][_0x8b24('0x45')]({'where':{'id':_0x3362ad[_0x8b24('0x41')]['id']}})[_0x8b24('0x24')](handleEntityNotFound(_0x124566,null))['then'](removeEntity(_0x124566,null))[_0x8b24('0x3f')](handleError(_0x124566,null));}; \ No newline at end of file +var _0x556a=['model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','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/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','reject','update','then','destroy','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','key'];(function(_0x4e697a,_0x56a14b){var _0x88850c=function(_0x4e368a){while(--_0x4e368a){_0x4e697a['push'](_0x4e697a['shift']());}};_0x88850c(++_0x56a14b);}(_0x556a,0x1dd));var _0xa556=function(_0xa12506,_0x31ef96){_0xa12506=_0xa12506-0x0;var _0x2a836e=_0x556a[_0xa12506];return _0x2a836e;};'use strict';var emlformat=require(_0xa556('0x0'));var rimraf=require(_0xa556('0x1'));var zipdir=require(_0xa556('0x2'));var jsonpatch=require(_0xa556('0x3'));var rp=require(_0xa556('0x4'));var moment=require(_0xa556('0x5'));var BPromise=require(_0xa556('0x6'));var Mustache=require(_0xa556('0x7'));var util=require(_0xa556('0x8'));var path=require('path');var sox=require(_0xa556('0x9'));var csv=require(_0xa556('0xa'));var ejs=require(_0xa556('0xb'));var fs=require('fs');var fs_extra=require(_0xa556('0xc'));var _=require(_0xa556('0xd'));var squel=require('squel');var crypto=require(_0xa556('0xe'));var jsforce=require(_0xa556('0xf'));var deskjs=require(_0xa556('0x10'));var toCsv=require(_0xa556('0xa'));var querystring=require('querystring');var Papa=require(_0xa556('0x11'));var Redis=require(_0xa556('0x12'));var authService=require(_0xa556('0x13'));var qs=require(_0xa556('0x14'));var as=require(_0xa556('0x15'));var hardwareService=require(_0xa556('0x16'));var logger=require(_0xa556('0x17'))(_0xa556('0x18'));var utils=require('../../config/utils');var config=require(_0xa556('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa556('0x1a'))['db'];function respondWithStatusCode(_0x552788,_0x562211){_0x562211=_0x562211||0xcc;return function(_0x2de803){if(_0x2de803){return _0x552788[_0xa556('0x1b')](_0x562211);}return _0x552788[_0xa556('0x1c')](_0x562211)[_0xa556('0x1d')]();};}function respondWithResult(_0x59b04e,_0x2f20cb){_0x2f20cb=_0x2f20cb||0xc8;return function(_0x10f9bc){if(_0x10f9bc){return _0x59b04e[_0xa556('0x1c')](_0x2f20cb)[_0xa556('0x1e')](_0x10f9bc);}};}function respondWithFilteredResult(_0x1f8b7c,_0x570ed0){return function(_0x5cee6c){if(_0x5cee6c){var _0xbdb988=typeof _0x570ed0[_0xa556('0x1f')]==='undefined'&&typeof _0x570ed0[_0xa556('0x20')]==='undefined';var _0x47b96a=_0x5cee6c[_0xa556('0x21')];var _0x529879=_0xbdb988?0x0:_0x570ed0[_0xa556('0x1f')];var _0x46b205=_0xbdb988?_0x5cee6c[_0xa556('0x21')]:_0x570ed0[_0xa556('0x1f')]+_0x570ed0['limit'];var _0x452e6f;if(_0x46b205>=_0x47b96a){_0x46b205=_0x47b96a;_0x452e6f=0xc8;}else{_0x452e6f=0xce;}_0x1f8b7c[_0xa556('0x1c')](_0x452e6f);return _0x1f8b7c[_0xa556('0x22')]('Content-Range',_0x529879+'-'+_0x46b205+'/'+_0x47b96a)[_0xa556('0x1e')](_0x5cee6c);}return null;};}function patchUpdates(_0x11ab73){return function(_0x5bfa4d){try{jsonpatch['apply'](_0x5bfa4d,_0x11ab73,!![]);}catch(_0x31c8c6){return BPromise[_0xa556('0x23')](_0x31c8c6);}return _0x5bfa4d['save']();};}function saveUpdates(_0x22e9d0,_0x50bc16){return function(_0x22718a){if(_0x22718a){return _0x22718a[_0xa556('0x24')](_0x22e9d0)[_0xa556('0x25')](function(_0x39cae2){return _0x39cae2;});}return null;};}function removeEntity(_0x3e8628,_0xfb4dda){return function(_0x1bcecb){if(_0x1bcecb){return _0x1bcecb[_0xa556('0x26')]()[_0xa556('0x25')](function(){_0x3e8628[_0xa556('0x1c')](0xcc)[_0xa556('0x1d')]();});}};}function handleEntityNotFound(_0xec6fbb,_0x4bf442){return function(_0x2ca8b6){if(!_0x2ca8b6){_0xec6fbb[_0xa556('0x1b')](0x194);}return _0x2ca8b6;};}function handleError(_0x518557,_0x20ec86){_0x20ec86=_0x20ec86||0x1f4;return function(_0x169d01){logger['error'](_0x169d01[_0xa556('0x27')]);if(_0x169d01[_0xa556('0x28')]){delete _0x169d01[_0xa556('0x28')];}_0x518557['status'](_0x20ec86)[_0xa556('0x29')](_0x169d01);};}exports[_0xa556('0x2a')]=function(_0x19f1b8,_0x57da1a){var _0x25dab6={},_0x1f5ce4={},_0x20accc={'count':0x0,'rows':[]};var _0x385fb1=_[_0xa556('0x2b')](db[_0xa556('0x2c')][_0xa556('0x2d')],function(_0x4d0a30){return{'name':_0x4d0a30[_0xa556('0x2e')],'type':_0x4d0a30['type'][_0xa556('0x2f')]};});_0x1f5ce4[_0xa556('0x30')]=_[_0xa556('0x2b')](_0x385fb1,_0xa556('0x28'));_0x1f5ce4[_0xa556('0x31')]=_[_0xa556('0x32')](_0x19f1b8[_0xa556('0x31')]);_0x1f5ce4['filters']=_[_0xa556('0x33')](_0x1f5ce4[_0xa556('0x30')],_0x1f5ce4[_0xa556('0x31')]);_0x25dab6[_0xa556('0x34')]=_[_0xa556('0x33')](_0x1f5ce4[_0xa556('0x30')],qs[_0xa556('0x35')](_0x19f1b8[_0xa556('0x31')][_0xa556('0x35')]));_0x25dab6['attributes']=_0x25dab6[_0xa556('0x34')][_0xa556('0x36')]?_0x25dab6[_0xa556('0x34')]:_0x1f5ce4['model'];if(!_0x19f1b8[_0xa556('0x31')][_0xa556('0x37')](_0xa556('0x38'))){_0x25dab6[_0xa556('0x20')]=qs['limit'](_0x19f1b8[_0xa556('0x31')]['limit']);_0x25dab6[_0xa556('0x1f')]=qs['offset'](_0x19f1b8[_0xa556('0x31')][_0xa556('0x1f')]);}_0x25dab6[_0xa556('0x39')]=qs[_0xa556('0x3a')](_0x19f1b8[_0xa556('0x31')]['sort']);_0x25dab6['where']=qs[_0xa556('0x3b')](_[_0xa556('0x3c')](_0x19f1b8[_0xa556('0x31')],_0x1f5ce4[_0xa556('0x3b')]),_0x385fb1);if(_0x19f1b8[_0xa556('0x31')][_0xa556('0x3d')]){_0x25dab6[_0xa556('0x3e')]=_[_0xa556('0x3f')](_0x25dab6[_0xa556('0x3e')],{'$or':_[_0xa556('0x2b')](_0x385fb1,function(_0x1cd7e0){if(_0x1cd7e0[_0xa556('0x40')]!==_0xa556('0x41')){var _0x3a4d27={};_0x3a4d27[_0x1cd7e0[_0xa556('0x28')]]={'$like':'%'+_0x19f1b8['query'][_0xa556('0x3d')]+'%'};return _0x3a4d27;}})});}_0x25dab6=_[_0xa556('0x3f')]({},_0x25dab6,_0x19f1b8[_0xa556('0x42')]);var _0x2fc959={'where':_0x25dab6['where']};return db[_0xa556('0x2c')][_0xa556('0x21')](_0x2fc959)[_0xa556('0x25')](function(_0x41bc2e){_0x20accc[_0xa556('0x21')]=_0x41bc2e;if(_0x19f1b8['query'][_0xa556('0x43')]){_0x25dab6[_0xa556('0x44')]=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x25dab6);})[_0xa556('0x25')](function(_0x544579){_0x20accc[_0xa556('0x45')]=_0x544579;return _0x20accc;})['then'](respondWithFilteredResult(_0x57da1a,_0x25dab6))[_0xa556('0x46')](handleError(_0x57da1a,null));};exports['show']=function(_0x483475,_0x48f2dc){var _0x5b405c={'raw':!![],'where':{'id':_0x483475[_0xa556('0x47')]['id']}},_0x3c700e={};_0x3c700e['model']=_[_0xa556('0x32')](db[_0xa556('0x2c')]['rawAttributes']);_0x3c700e['query']=_[_0xa556('0x32')](_0x483475['query']);_0x3c700e['filters']=_['intersection'](_0x3c700e[_0xa556('0x30')],_0x3c700e[_0xa556('0x31')]);_0x5b405c['attributes']=_[_0xa556('0x33')](_0x3c700e[_0xa556('0x30')],qs[_0xa556('0x35')](_0x483475['query']['fields']));_0x5b405c[_0xa556('0x34')]=_0x5b405c[_0xa556('0x34')][_0xa556('0x36')]?_0x5b405c[_0xa556('0x34')]:_0x3c700e[_0xa556('0x30')];if(_0x483475[_0xa556('0x31')]['includeAll']){_0x5b405c['include']=[{'all':!![]}];}_0x5b405c=_['merge']({},_0x5b405c,_0x483475[_0xa556('0x42')]);return db[_0xa556('0x2c')]['find'](_0x5b405c)[_0xa556('0x25')](handleEntityNotFound(_0x48f2dc,null))['then'](respondWithResult(_0x48f2dc,null))[_0xa556('0x46')](handleError(_0x48f2dc,null));};exports[_0xa556('0x48')]=function(_0x213c4d,_0x3cd157){return db['SquareMessage'][_0xa556('0x48')](_0x213c4d[_0xa556('0x49')],{})[_0xa556('0x25')](respondWithResult(_0x3cd157,0xc9))[_0xa556('0x46')](handleError(_0x3cd157,null));};exports[_0xa556('0x24')]=function(_0x64781a,_0x41171c){if(_0x64781a['body']['id']){delete _0x64781a[_0xa556('0x49')]['id'];}return db[_0xa556('0x2c')]['find']({'where':{'id':_0x64781a[_0xa556('0x47')]['id']}})[_0xa556('0x25')](handleEntityNotFound(_0x41171c,null))[_0xa556('0x25')](saveUpdates(_0x64781a['body'],null))[_0xa556('0x25')](respondWithResult(_0x41171c,null))[_0xa556('0x46')](handleError(_0x41171c,null));};exports[_0xa556('0x26')]=function(_0x1256a6,_0x1536eb){return db[_0xa556('0x2c')][_0xa556('0x4a')]({'where':{'id':_0x1256a6[_0xa556('0x47')]['id']}})[_0xa556('0x25')](handleEntityNotFound(_0x1536eb,null))[_0xa556('0x25')](removeEntity(_0x1536eb,null))['catch'](handleError(_0x1536eb,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index b813ba5..f9deed5 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 _0x05c6=['rimraf','../../config/environment','./squareMessage.attributes','exports','define','lodash','util','../../config/logger','moment','bluebird'];(function(_0x320db2,_0x5c7dfa){var _0x558ece=function(_0x16ebd1){while(--_0x16ebd1){_0x320db2['push'](_0x320db2['shift']());}};_0x558ece(++_0x5c7dfa);}(_0x05c6,0x1e5));var _0x605c=function(_0x345d05,_0x4b42b9){_0x345d05=_0x345d05-0x0;var _0x29ea23=_0x05c6[_0x345d05];return _0x29ea23;};'use strict';var _=require(_0x605c('0x0'));var util=require(_0x605c('0x1'));var logger=require(_0x605c('0x2'))('api');var moment=require(_0x605c('0x3'));var BPromise=require(_0x605c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x605c('0x5'));var config=require(_0x605c('0x6'));var attributes=require(_0x605c('0x7'));module[_0x605c('0x8')]=function(_0x1c2949,_0x5cdc00){return _0x1c2949[_0x605c('0x9')]('SquareMessage',attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x916f=['moment','bluebird','request-promise','rimraf','../../config/environment','./squareMessage.attributes','define','SquareMessage','square_messages','lodash','util','api'];(function(_0x526eb9,_0x54fa63){var _0x52f83b=function(_0x3f8e07){while(--_0x3f8e07){_0x526eb9['push'](_0x526eb9['shift']());}};_0x52f83b(++_0x54fa63);}(_0x916f,0x141));var _0xf916=function(_0x559bc4,_0x1c5809){_0x559bc4=_0x559bc4-0x0;var _0x140122=_0x916f[_0x559bc4];return _0x140122;};'use strict';var _=require(_0xf916('0x0'));var util=require(_0xf916('0x1'));var logger=require('../../config/logger')(_0xf916('0x2'));var moment=require(_0xf916('0x3'));var BPromise=require(_0xf916('0x4'));var rp=require(_0xf916('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf916('0x6'));var config=require(_0xf916('0x7'));var attributes=require(_0xf916('0x8'));module['exports']=function(_0x3fd8b6,_0x405fe7){return _0x3fd8b6[_0xf916('0x9')](_0xf916('0xa'),attributes,{'tableName':_0xf916('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index f5823c1..2633549 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 _0xf6a1=['then','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareMessage','SquareMessage','create','options','raw'];(function(_0x560448,_0x2c1082){var _0x550276=function(_0x37e949){while(--_0x37e949){_0x560448['push'](_0x560448['shift']());}};_0x550276(++_0x2c1082);}(_0xf6a1,0x197));var _0x1f6a=function(_0x7680b6,_0x2d3934){_0x7680b6=_0x7680b6-0x0;var _0x49eefc=_0xf6a1[_0x7680b6];return _0x49eefc;};'use strict';var _=require(_0x1f6a('0x0'));var util=require(_0x1f6a('0x1'));var moment=require(_0x1f6a('0x2'));var BPromise=require(_0x1f6a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f6a('0x4'))['db'];var utils=require(_0x1f6a('0x5'));var logger=require(_0x1f6a('0x6'))(_0x1f6a('0x7'));var config=require(_0x1f6a('0x8'));var jayson=require(_0x1f6a('0x9'));var client=jayson[_0x1f6a('0xa')][_0x1f6a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ea81f,_0x2e10ac,_0x418dd7){return new BPromise(function(_0x14f49,_0x58ba69){return client[_0x1f6a('0xc')](_0x3ea81f,_0x418dd7)['then'](function(_0x3d0eaf){logger[_0x1f6a('0xd')](_0x1f6a('0xe'),_0x2e10ac,_0x1f6a('0xf'));logger[_0x1f6a('0x10')](_0x1f6a('0x11'),_0x2e10ac,_0x1f6a('0xf'),JSON[_0x1f6a('0x12')](_0x3d0eaf));if(_0x3d0eaf[_0x1f6a('0x13')]){if(_0x3d0eaf[_0x1f6a('0x13')][_0x1f6a('0x14')]===0x1f4){logger[_0x1f6a('0x13')](_0x1f6a('0xe'),_0x2e10ac,_0x3d0eaf[_0x1f6a('0x13')]['message']);return _0x58ba69(_0x3d0eaf[_0x1f6a('0x13')][_0x1f6a('0x15')]);}logger[_0x1f6a('0x13')]('SquareMessage,\x20%s,\x20%s',_0x2e10ac,_0x3d0eaf[_0x1f6a('0x13')][_0x1f6a('0x15')]);return _0x14f49(_0x3d0eaf[_0x1f6a('0x13')][_0x1f6a('0x15')]);}else{logger['info'](_0x1f6a('0xe'),_0x2e10ac,_0x1f6a('0xf'));_0x14f49(_0x3d0eaf['result'][_0x1f6a('0x15')]);}})[_0x1f6a('0x16')](function(_0xf95760){logger[_0x1f6a('0x13')](_0x1f6a('0xe'),_0x2e10ac,_0xf95760);_0x58ba69(_0xf95760);});});}exports[_0x1f6a('0x17')]=function(_0x552e7e){var _0x210c06=this;return new Promise(function(_0x2b4d16,_0x573613){return db[_0x1f6a('0x18')][_0x1f6a('0x19')](_0x552e7e['body'],{'raw':_0x552e7e['options']?_0x552e7e[_0x1f6a('0x1a')][_0x1f6a('0x1b')]===undefined?!![]:![]:!![]})[_0x1f6a('0x1c')](function(_0xccfb41){logger[_0x1f6a('0xd')](_0x1f6a('0x17'),_0x552e7e);logger['debug']('CreateSquareMessage',_0x552e7e,JSON[_0x1f6a('0x12')](_0xccfb41));_0x2b4d16(_0xccfb41);})['catch'](function(_0x1c7310){logger[_0x1f6a('0x13')](_0x1f6a('0x17'),_0x1c7310[_0x1f6a('0x15')],_0x552e7e);_0x573613(_0x210c06[_0x1f6a('0x13')](0x1f4,_0x1c7310['message']));});});}; \ No newline at end of file +var _0x01cb=['../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','body','options','raw','then','CreateSquareMessage','lodash','util','bluebird','randomstring','ioredis'];(function(_0x3b765f,_0xaac966){var _0x152f0=function(_0x2ae249){while(--_0x2ae249){_0x3b765f['push'](_0x3b765f['shift']());}};_0x152f0(++_0xaac966);}(_0x01cb,0x124));var _0xb01c=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0x01cb[_0x247fa1];return _0x244f35;};'use strict';var _=require(_0xb01c('0x0'));var util=require(_0xb01c('0x1'));var moment=require('moment');var BPromise=require(_0xb01c('0x2'));var rs=require(_0xb01c('0x3'));var fs=require('fs');var Redis=require(_0xb01c('0x4'));var db=require(_0xb01c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb01c('0x6'))(_0xb01c('0x7'));var config=require('../../config/environment');var jayson=require(_0xb01c('0x8'));var client=jayson['client'][_0xb01c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11b1ca,_0x167991,_0x512ba4){return new BPromise(function(_0x12b586,_0x5dd9f6){return client[_0xb01c('0xa')](_0x11b1ca,_0x512ba4)['then'](function(_0x133b9e){logger[_0xb01c('0xb')](_0xb01c('0xc'),_0x167991,_0xb01c('0xd'));logger[_0xb01c('0xe')](_0xb01c('0xf'),_0x167991,_0xb01c('0xd'),JSON[_0xb01c('0x10')](_0x133b9e));if(_0x133b9e['error']){if(_0x133b9e[_0xb01c('0x11')][_0xb01c('0x12')]===0x1f4){logger[_0xb01c('0x11')](_0xb01c('0xc'),_0x167991,_0x133b9e[_0xb01c('0x11')][_0xb01c('0x13')]);return _0x5dd9f6(_0x133b9e[_0xb01c('0x11')][_0xb01c('0x13')]);}logger[_0xb01c('0x11')]('SquareMessage,\x20%s,\x20%s',_0x167991,_0x133b9e[_0xb01c('0x11')][_0xb01c('0x13')]);return _0x12b586(_0x133b9e[_0xb01c('0x11')]['message']);}else{logger[_0xb01c('0xb')]('SquareMessage,\x20%s,\x20%s',_0x167991,'request\x20sent');_0x12b586(_0x133b9e[_0xb01c('0x14')]['message']);}})[_0xb01c('0x15')](function(_0x2dfcf3){logger[_0xb01c('0x11')](_0xb01c('0xc'),_0x167991,_0x2dfcf3);_0x5dd9f6(_0x2dfcf3);});});}exports['CreateSquareMessage']=function(_0x288768){var _0x38beec=this;return new Promise(function(_0x6dac3d,_0x4b53e8){return db['SquareMessage']['create'](_0x288768[_0xb01c('0x16')],{'raw':_0x288768['options']?_0x288768[_0xb01c('0x17')][_0xb01c('0x18')]===undefined?!![]:![]:!![]})[_0xb01c('0x19')](function(_0x83766b){logger['info'](_0xb01c('0x1a'),_0x288768);logger[_0xb01c('0xe')](_0xb01c('0x1a'),_0x288768,JSON[_0xb01c('0x10')](_0x83766b));_0x6dac3d(_0x83766b);})[_0xb01c('0x15')](function(_0x665c46){logger['error'](_0xb01c('0x1a'),_0x665c46['message'],_0x288768);_0x4b53e8(_0x38beec['error'](0x1f4,_0x665c46[_0xb01c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 8639f59..5c8f1c5 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 _0x9aba=['isAuthenticated','show','/:id/test','15s','post','update','delete','/:id','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get'];(function(_0x650acd,_0x220f8c){var _0x1f7660=function(_0x3c2f27){while(--_0x3c2f27){_0x650acd['push'](_0x650acd['shift']());}};_0x1f7660(++_0x220f8c);}(_0x9aba,0x15e));var _0xa9ab=function(_0x1a561e,_0x41f864){_0x1a561e=_0x1a561e-0x0;var _0xcad153=_0x9aba[_0x1a561e];return _0xcad153;};'use strict';var multer=require(_0xa9ab('0x0'));var util=require(_0xa9ab('0x1'));var path=require(_0xa9ab('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa9ab('0x3')]();var fs_extra=require(_0xa9ab('0x4'));var auth=require(_0xa9ab('0x5'));var interaction=require(_0xa9ab('0x6'));var config=require(_0xa9ab('0x7'));var controller=require(_0xa9ab('0x8'));router[_0xa9ab('0x9')]('/',auth[_0xa9ab('0xa')](),controller['index']);router[_0xa9ab('0x9')]('/:id',auth[_0xa9ab('0xa')](),controller[_0xa9ab('0xb')]);router[_0xa9ab('0x9')](_0xa9ab('0xc'),auth['isAuthenticated'](),timeout(_0xa9ab('0xd')),controller['test']);router[_0xa9ab('0xe')]('/',auth[_0xa9ab('0xa')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xa9ab('0xf')]);router[_0xa9ab('0x10')](_0xa9ab('0x11'),auth[_0xa9ab('0xa')](),controller[_0xa9ab('0x12')]);module[_0xa9ab('0x13')]=router; \ No newline at end of file +var _0xad50=['../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','15s','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x15dac9,_0x3f9493){var _0x122b1b=function(_0x5cf148){while(--_0x5cf148){_0x15dac9['push'](_0x15dac9['shift']());}};_0x122b1b(++_0x3f9493);}(_0xad50,0xe0));var _0x0ad5=function(_0x352d28,_0x444033){_0x352d28=_0x352d28-0x0;var _0x387d7e=_0xad50[_0x352d28];return _0x387d7e;};'use strict';var multer=require(_0x0ad5('0x0'));var util=require(_0x0ad5('0x1'));var path=require(_0x0ad5('0x2'));var timeout=require(_0x0ad5('0x3'));var express=require(_0x0ad5('0x4'));var router=express[_0x0ad5('0x5')]();var fs_extra=require(_0x0ad5('0x6'));var auth=require(_0x0ad5('0x7'));var interaction=require(_0x0ad5('0x8'));var config=require('../../config/environment');var controller=require('./squareOdbc.controller');router[_0x0ad5('0x9')]('/',auth['isAuthenticated'](),controller[_0x0ad5('0xa')]);router[_0x0ad5('0x9')](_0x0ad5('0xb'),auth[_0x0ad5('0xc')](),controller[_0x0ad5('0xd')]);router[_0x0ad5('0x9')]('/:id/test',auth[_0x0ad5('0xc')](),timeout(_0x0ad5('0xe')),controller['test']);router[_0x0ad5('0xf')]('/',auth['isAuthenticated'](),controller[_0x0ad5('0x10')]);router[_0x0ad5('0x11')](_0x0ad5('0xb'),auth[_0x0ad5('0xc')](),controller['update']);router[_0x0ad5('0x12')]('/:id',auth[_0x0ad5('0xc')](),controller[_0x0ad5('0x13')]);module[_0x0ad5('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index e1020a9..4ec64d7 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 _0xcb3c=['exports','STRING','name','sequelize'];(function(_0x47d493,_0x3bedfb){var _0x50242a=function(_0x473bd6){while(--_0x473bd6){_0x47d493['push'](_0x47d493['shift']());}};_0x50242a(++_0x3bedfb);}(_0xcb3c,0x197));var _0xccb3=function(_0x4a450a,_0x54d42f){_0x4a450a=_0x4a450a-0x0;var _0x28baf9=_0xcb3c[_0x4a450a];return _0x28baf9;};'use strict';var Sequelize=require(_0xccb3('0x0'));module[_0xccb3('0x1')]={'name':{'type':Sequelize[_0xccb3('0x2')],'unique':_0xccb3('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xccb3('0x2')]},'description':{'type':Sequelize[_0xccb3('0x2')]}}; \ No newline at end of file +var _0x5ee1=['sequelize','exports','STRING','name'];(function(_0x195335,_0x431773){var _0x90b087=function(_0x3660fd){while(--_0x3660fd){_0x195335['push'](_0x195335['shift']());}};_0x90b087(++_0x431773);}(_0x5ee1,0xb8));var _0x15ee=function(_0x167323,_0x1a2478){_0x167323=_0x167323-0x0;var _0x5a56f0=_0x5ee1[_0x167323];return _0x5a56f0;};'use strict';var Sequelize=require(_0x15ee('0x0'));module[_0x15ee('0x1')]={'name':{'type':Sequelize[_0x15ee('0x2')],'unique':_0x15ee('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x15ee('0x2')]},'description':{'type':Sequelize[_0x15ee('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 901f259..a05ec03 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 _0xc506=['apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','UserProfileSection','userProfileId','autoAssociation','test','dsn','odbc','openSync','closeSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range'];(function(_0x19e870,_0x364831){var _0x274e94=function(_0x759a49){while(--_0x759a49){_0x19e870['push'](_0x19e870['shift']());}};_0x274e94(++_0x364831);}(_0xc506,0x1a9));var _0x6c50=function(_0x52849b,_0x190993){_0x52849b=_0x52849b-0x0;var _0x2413f8=_0xc506[_0x52849b];return _0x2413f8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6c50('0x0'));var zipdir=require(_0x6c50('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c50('0x2'));var moment=require(_0x6c50('0x3'));var BPromise=require(_0x6c50('0x4'));var Mustache=require(_0x6c50('0x5'));var util=require(_0x6c50('0x6'));var path=require('path');var sox=require(_0x6c50('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c50('0x8'));var _=require(_0x6c50('0x9'));var squel=require(_0x6c50('0xa'));var crypto=require('crypto');var jsforce=require(_0x6c50('0xb'));var deskjs=require(_0x6c50('0xc'));var toCsv=require(_0x6c50('0xd'));var querystring=require(_0x6c50('0xe'));var Papa=require(_0x6c50('0xf'));var Redis=require('ioredis');var authService=require(_0x6c50('0x10'));var qs=require(_0x6c50('0x11'));var as=require(_0x6c50('0x12'));var hardwareService=require(_0x6c50('0x13'));var logger=require(_0x6c50('0x14'))(_0x6c50('0x15'));var utils=require(_0x6c50('0x16'));var config=require(_0x6c50('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c50('0x18'))['db'];function respondWithStatusCode(_0x1e48fe,_0x46a2c4){_0x46a2c4=_0x46a2c4||0xcc;return function(_0x22f5e9){if(_0x22f5e9){return _0x1e48fe[_0x6c50('0x19')](_0x46a2c4);}return _0x1e48fe[_0x6c50('0x1a')](_0x46a2c4)[_0x6c50('0x1b')]();};}function respondWithResult(_0x845a54,_0x147784){_0x147784=_0x147784||0xc8;return function(_0x3f0734){if(_0x3f0734){return _0x845a54[_0x6c50('0x1a')](_0x147784)[_0x6c50('0x1c')](_0x3f0734);}};}function respondWithFilteredResult(_0x593583,_0x3d6e42){return function(_0x200803){if(_0x200803){var _0x4b20ba=typeof _0x3d6e42['offset']==='undefined'&&typeof _0x3d6e42[_0x6c50('0x1d')]===_0x6c50('0x1e');var _0x30fee8=_0x200803[_0x6c50('0x1f')];var _0x5eb9ad=_0x4b20ba?0x0:_0x3d6e42[_0x6c50('0x20')];var _0x53d0ad=_0x4b20ba?_0x200803[_0x6c50('0x1f')]:_0x3d6e42[_0x6c50('0x20')]+_0x3d6e42[_0x6c50('0x1d')];var _0x35bd6e;if(_0x53d0ad>=_0x30fee8){_0x53d0ad=_0x30fee8;_0x35bd6e=0xc8;}else{_0x35bd6e=0xce;}_0x593583[_0x6c50('0x1a')](_0x35bd6e);return _0x593583[_0x6c50('0x21')](_0x6c50('0x22'),_0x5eb9ad+'-'+_0x53d0ad+'/'+_0x30fee8)[_0x6c50('0x1c')](_0x200803);}return null;};}function patchUpdates(_0x19ce02){return function(_0xd9e410){try{jsonpatch[_0x6c50('0x23')](_0xd9e410,_0x19ce02,!![]);}catch(_0x4dfb74){return BPromise[_0x6c50('0x24')](_0x4dfb74);}return _0xd9e410[_0x6c50('0x25')]();};}function saveUpdates(_0x2d849b,_0x184916){return function(_0x4531d7){if(_0x4531d7){return _0x4531d7[_0x6c50('0x26')](_0x2d849b)[_0x6c50('0x27')](function(_0x3b050a){return _0x3b050a;});}return null;};}function removeEntity(_0x1a19bf,_0x3233e7){return function(_0x54103d){if(_0x54103d){return _0x54103d['destroy']()['then'](function(){var _0x5c20f3=_0x54103d[_0x6c50('0x28')]({'plain':!![]});var _0x362823='ODBC';return db[_0x6c50('0x29')][_0x6c50('0x2a')]({'where':{'type':_0x362823,'resourceId':_0x5c20f3['id']}})[_0x6c50('0x27')](function(){return _0x54103d;});})[_0x6c50('0x27')](function(){_0x1a19bf[_0x6c50('0x1a')](0xcc)[_0x6c50('0x1b')]();});}};}function handleEntityNotFound(_0x4b641c,_0x5b1ecd){return function(_0x2aa1b5){if(!_0x2aa1b5){_0x4b641c['sendStatus'](0x194);}return _0x2aa1b5;};}function handleError(_0x41cd99,_0x110796){_0x110796=_0x110796||0x1f4;return function(_0x2d2fff){logger[_0x6c50('0x2b')](_0x2d2fff[_0x6c50('0x2c')]);if(_0x2d2fff[_0x6c50('0x2d')]){delete _0x2d2fff[_0x6c50('0x2d')];}_0x41cd99[_0x6c50('0x1a')](_0x110796)[_0x6c50('0x2e')](_0x2d2fff);};}exports[_0x6c50('0x2f')]=function(_0x4e9bec,_0x1d6b75){var _0x255e6c={},_0x23b11c={},_0x281a03={'count':0x0,'rows':[]};var _0x1f1a8d=_[_0x6c50('0x30')](db[_0x6c50('0x31')][_0x6c50('0x32')],function(_0xdfe3ae){return{'name':_0xdfe3ae[_0x6c50('0x33')],'type':_0xdfe3ae[_0x6c50('0x34')][_0x6c50('0x35')]};});_0x23b11c[_0x6c50('0x36')]=_['map'](_0x1f1a8d,'name');_0x23b11c[_0x6c50('0x37')]=_[_0x6c50('0x38')](_0x4e9bec[_0x6c50('0x37')]);_0x23b11c['filters']=_[_0x6c50('0x39')](_0x23b11c['model'],_0x23b11c[_0x6c50('0x37')]);_0x255e6c[_0x6c50('0x3a')]=_[_0x6c50('0x39')](_0x23b11c[_0x6c50('0x36')],qs[_0x6c50('0x3b')](_0x4e9bec[_0x6c50('0x37')][_0x6c50('0x3b')]));_0x255e6c['attributes']=_0x255e6c[_0x6c50('0x3a')]['length']?_0x255e6c[_0x6c50('0x3a')]:_0x23b11c[_0x6c50('0x36')];if(!_0x4e9bec[_0x6c50('0x37')]['hasOwnProperty'](_0x6c50('0x3c'))){_0x255e6c['limit']=qs['limit'](_0x4e9bec[_0x6c50('0x37')][_0x6c50('0x1d')]);_0x255e6c[_0x6c50('0x20')]=qs[_0x6c50('0x20')](_0x4e9bec[_0x6c50('0x37')][_0x6c50('0x20')]);}_0x255e6c[_0x6c50('0x3d')]=qs['sort'](_0x4e9bec[_0x6c50('0x37')][_0x6c50('0x3e')]);_0x255e6c[_0x6c50('0x3f')]=qs[_0x6c50('0x40')](_[_0x6c50('0x41')](_0x4e9bec[_0x6c50('0x37')],_0x23b11c[_0x6c50('0x40')]),_0x1f1a8d);if(_0x4e9bec[_0x6c50('0x37')][_0x6c50('0x42')]){_0x255e6c[_0x6c50('0x3f')]=_[_0x6c50('0x43')](_0x255e6c['where'],{'$or':_[_0x6c50('0x30')](_0x1f1a8d,function(_0x430172){if(_0x430172[_0x6c50('0x34')]!==_0x6c50('0x44')){var _0x5e671a={};_0x5e671a[_0x430172[_0x6c50('0x2d')]]={'$like':'%'+_0x4e9bec['query'][_0x6c50('0x42')]+'%'};return _0x5e671a;}})});}_0x255e6c=_['merge']({},_0x255e6c,_0x4e9bec[_0x6c50('0x45')]);var _0x153b88={'where':_0x255e6c['where']};return db[_0x6c50('0x31')]['count'](_0x153b88)[_0x6c50('0x27')](function(_0x4784ea){_0x281a03[_0x6c50('0x1f')]=_0x4784ea;if(_0x4e9bec['query'][_0x6c50('0x46')]){_0x255e6c[_0x6c50('0x47')]=[{'all':!![]}];}return db[_0x6c50('0x31')][_0x6c50('0x48')](_0x255e6c);})[_0x6c50('0x27')](function(_0x267bb1){_0x281a03[_0x6c50('0x49')]=_0x267bb1;return _0x281a03;})[_0x6c50('0x27')](respondWithFilteredResult(_0x1d6b75,_0x255e6c))[_0x6c50('0x4a')](handleError(_0x1d6b75,null));};exports['show']=function(_0x451aa9,_0x4d55e2){var _0x522ccc={'raw':!![],'where':{'id':_0x451aa9[_0x6c50('0x4b')]['id']}},_0x33bf71={};_0x33bf71[_0x6c50('0x36')]=_[_0x6c50('0x38')](db[_0x6c50('0x31')][_0x6c50('0x32')]);_0x33bf71[_0x6c50('0x37')]=_[_0x6c50('0x38')](_0x451aa9['query']);_0x33bf71[_0x6c50('0x40')]=_[_0x6c50('0x39')](_0x33bf71[_0x6c50('0x36')],_0x33bf71[_0x6c50('0x37')]);_0x522ccc[_0x6c50('0x3a')]=_[_0x6c50('0x39')](_0x33bf71[_0x6c50('0x36')],qs[_0x6c50('0x3b')](_0x451aa9[_0x6c50('0x37')]['fields']));_0x522ccc[_0x6c50('0x3a')]=_0x522ccc[_0x6c50('0x3a')][_0x6c50('0x4c')]?_0x522ccc[_0x6c50('0x3a')]:_0x33bf71['model'];if(_0x451aa9[_0x6c50('0x37')][_0x6c50('0x46')]){_0x522ccc[_0x6c50('0x47')]=[{'all':!![]}];}_0x522ccc=_[_0x6c50('0x43')]({},_0x522ccc,_0x451aa9['options']);return db['SquareOdbc'][_0x6c50('0x4d')](_0x522ccc)['then'](handleEntityNotFound(_0x4d55e2,null))['then'](respondWithResult(_0x4d55e2,null))['catch'](handleError(_0x4d55e2,null));};exports[_0x6c50('0x4e')]=function(_0x5eb629,_0x524a7){return db[_0x6c50('0x31')]['create'](_0x5eb629[_0x6c50('0x4f')],{})[_0x6c50('0x27')](function(_0x861281){var _0x3cd12c=_0x5eb629[_0x6c50('0x50')][_0x6c50('0x28')]({'plain':!![]});if(!_0x3cd12c)throw new Error(_0x6c50('0x51'));if(_0x3cd12c[_0x6c50('0x52')]==='user'){var _0x4bd70d=_0x861281[_0x6c50('0x28')]({'plain':!![]});var _0x180741=_0x6c50('0x53');return db[_0x6c50('0x54')][_0x6c50('0x4d')]({'where':{'name':_0x180741,'userProfileId':_0x3cd12c[_0x6c50('0x55')]},'raw':!![]})[_0x6c50('0x27')](function(_0x21fa4a){if(_0x21fa4a&&_0x21fa4a[_0x6c50('0x56')]===0x0){return db[_0x6c50('0x29')]['create']({'name':_0x4bd70d[_0x6c50('0x2d')],'resourceId':_0x4bd70d['id'],'type':_0x21fa4a['name'],'sectionId':_0x21fa4a['id']},{})[_0x6c50('0x27')](function(){return _0x861281;});}else{return _0x861281;}})[_0x6c50('0x4a')](function(_0x27877e){logger[_0x6c50('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27877e);throw _0x27877e;});}return _0x861281;})[_0x6c50('0x27')](respondWithResult(_0x524a7,0xc9))['catch'](handleError(_0x524a7,null));};exports[_0x6c50('0x26')]=function(_0x4f1a1f,_0x2620e8){if(_0x4f1a1f[_0x6c50('0x4f')]['id']){delete _0x4f1a1f[_0x6c50('0x4f')]['id'];}return db[_0x6c50('0x31')][_0x6c50('0x4d')]({'where':{'id':_0x4f1a1f[_0x6c50('0x4b')]['id']}})[_0x6c50('0x27')](handleEntityNotFound(_0x2620e8,null))[_0x6c50('0x27')](saveUpdates(_0x4f1a1f[_0x6c50('0x4f')],null))[_0x6c50('0x27')](respondWithResult(_0x2620e8,null))[_0x6c50('0x4a')](handleError(_0x2620e8,null));};exports[_0x6c50('0x2a')]=function(_0x2ba4af,_0x382070){return db[_0x6c50('0x31')]['find']({'where':{'id':_0x2ba4af[_0x6c50('0x4b')]['id']}})['then'](handleEntityNotFound(_0x382070,null))[_0x6c50('0x27')](removeEntity(_0x382070,null))[_0x6c50('0x4a')](handleError(_0x382070,null));};exports[_0x6c50('0x57')]=function(_0x561c0b,_0x3a1a24,_0x1cddb4){var _0x365dde;return db[_0x6c50('0x31')][_0x6c50('0x4d')]({'where':{'id':_0x561c0b[_0x6c50('0x4b')]['id']},'attributes':['id',_0x6c50('0x58')]})['then'](handleEntityNotFound(_0x3a1a24,null))[_0x6c50('0x27')](function(_0x227757){if(_0x227757){var _0x2c6d10=require(_0x6c50('0x59'))();_0x2c6d10[_0x6c50('0x5a')](_0x227757[_0x6c50('0x58')]);_0x2c6d10[_0x6c50('0x5b')]();return _0x227757;}})[_0x6c50('0x27')](respondWithResult(_0x3a1a24,null))['catch'](handleError(_0x3a1a24,null));}; \ No newline at end of file +var _0x2b80=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','odbc','openSync','closeSync','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','ODBC','error','stack','name','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','filters','intersection','attributes','length','query','hasOwnProperty','order','sort'];(function(_0x368613,_0x5f5f6b){var _0x5e3b00=function(_0x2035ce){while(--_0x2035ce){_0x368613['push'](_0x368613['shift']());}};_0x5e3b00(++_0x5f5f6b);}(_0x2b80,0x74));var _0x02b8=function(_0x37e2db,_0x2e77a0){_0x37e2db=_0x37e2db-0x0;var _0x362746=_0x2b80[_0x37e2db];return _0x362746;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x02b8('0x0'));var jsonpatch=require(_0x02b8('0x1'));var rp=require(_0x02b8('0x2'));var moment=require('moment');var BPromise=require(_0x02b8('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x02b8('0x4'));var sox=require('sox');var csv=require(_0x02b8('0x5'));var ejs=require(_0x02b8('0x6'));var fs=require('fs');var fs_extra=require(_0x02b8('0x7'));var _=require(_0x02b8('0x8'));var squel=require(_0x02b8('0x9'));var crypto=require('crypto');var jsforce=require(_0x02b8('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x02b8('0x5'));var querystring=require('querystring');var Papa=require(_0x02b8('0xb'));var Redis=require(_0x02b8('0xc'));var authService=require(_0x02b8('0xd'));var qs=require(_0x02b8('0xe'));var as=require(_0x02b8('0xf'));var hardwareService=require(_0x02b8('0x10'));var logger=require('../../config/logger')(_0x02b8('0x11'));var utils=require(_0x02b8('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x02b8('0x13'));var db=require(_0x02b8('0x14'))['db'];function respondWithStatusCode(_0x628c64,_0xfdcf6f){_0xfdcf6f=_0xfdcf6f||0xcc;return function(_0x2d9598){if(_0x2d9598){return _0x628c64[_0x02b8('0x15')](_0xfdcf6f);}return _0x628c64[_0x02b8('0x16')](_0xfdcf6f)[_0x02b8('0x17')]();};}function respondWithResult(_0x4ad615,_0xc5ba98){_0xc5ba98=_0xc5ba98||0xc8;return function(_0x3324e2){if(_0x3324e2){return _0x4ad615[_0x02b8('0x16')](_0xc5ba98)[_0x02b8('0x18')](_0x3324e2);}};}function respondWithFilteredResult(_0x4debb3,_0x14636c){return function(_0x4a6ee8){if(_0x4a6ee8){var _0x3b4ced=typeof _0x14636c['offset']==='undefined'&&typeof _0x14636c[_0x02b8('0x19')]===_0x02b8('0x1a');var _0x4b5d50=_0x4a6ee8[_0x02b8('0x1b')];var _0x4779ac=_0x3b4ced?0x0:_0x14636c[_0x02b8('0x1c')];var _0x59380b=_0x3b4ced?_0x4a6ee8[_0x02b8('0x1b')]:_0x14636c[_0x02b8('0x1c')]+_0x14636c[_0x02b8('0x19')];var _0x56e270;if(_0x59380b>=_0x4b5d50){_0x59380b=_0x4b5d50;_0x56e270=0xc8;}else{_0x56e270=0xce;}_0x4debb3['status'](_0x56e270);return _0x4debb3[_0x02b8('0x1d')](_0x02b8('0x1e'),_0x4779ac+'-'+_0x59380b+'/'+_0x4b5d50)['json'](_0x4a6ee8);}return null;};}function patchUpdates(_0x3ed534){return function(_0x3a8330){try{jsonpatch[_0x02b8('0x1f')](_0x3a8330,_0x3ed534,!![]);}catch(_0xa7c0d4){return BPromise[_0x02b8('0x20')](_0xa7c0d4);}return _0x3a8330[_0x02b8('0x21')]();};}function saveUpdates(_0x2d4571,_0x317a5d){return function(_0x2fa6c6){if(_0x2fa6c6){return _0x2fa6c6[_0x02b8('0x22')](_0x2d4571)['then'](function(_0x3859c0){return _0x3859c0;});}return null;};}function removeEntity(_0x3d7454,_0x139eb7){return function(_0xbb52ff){if(_0xbb52ff){return _0xbb52ff[_0x02b8('0x23')]()[_0x02b8('0x24')](function(){var _0x4137a7=_0xbb52ff[_0x02b8('0x25')]({'plain':!![]});var _0x360e83=_0x02b8('0x26');return db['UserProfileResource'][_0x02b8('0x23')]({'where':{'type':_0x360e83,'resourceId':_0x4137a7['id']}})[_0x02b8('0x24')](function(){return _0xbb52ff;});})[_0x02b8('0x24')](function(){_0x3d7454[_0x02b8('0x16')](0xcc)[_0x02b8('0x17')]();});}};}function handleEntityNotFound(_0xa5d2f0,_0x1ead2e){return function(_0x31095f){if(!_0x31095f){_0xa5d2f0[_0x02b8('0x15')](0x194);}return _0x31095f;};}function handleError(_0x1563b0,_0x3eb1d8){_0x3eb1d8=_0x3eb1d8||0x1f4;return function(_0x4a35b4){logger[_0x02b8('0x27')](_0x4a35b4[_0x02b8('0x28')]);if(_0x4a35b4[_0x02b8('0x29')]){delete _0x4a35b4[_0x02b8('0x29')];}_0x1563b0[_0x02b8('0x16')](_0x3eb1d8)['send'](_0x4a35b4);};}exports[_0x02b8('0x2a')]=function(_0x4c49f4,_0x260a21){var _0x2d60f9={},_0x250ab9={},_0x19616={'count':0x0,'rows':[]};var _0x56f817=_[_0x02b8('0x2b')](db[_0x02b8('0x2c')][_0x02b8('0x2d')],function(_0x596aae){return{'name':_0x596aae[_0x02b8('0x2e')],'type':_0x596aae[_0x02b8('0x2f')][_0x02b8('0x30')]};});_0x250ab9[_0x02b8('0x31')]=_[_0x02b8('0x2b')](_0x56f817,_0x02b8('0x29'));_0x250ab9['query']=_['keys'](_0x4c49f4['query']);_0x250ab9[_0x02b8('0x32')]=_[_0x02b8('0x33')](_0x250ab9[_0x02b8('0x31')],_0x250ab9['query']);_0x2d60f9[_0x02b8('0x34')]=_[_0x02b8('0x33')](_0x250ab9[_0x02b8('0x31')],qs['fields'](_0x4c49f4['query']['fields']));_0x2d60f9[_0x02b8('0x34')]=_0x2d60f9[_0x02b8('0x34')][_0x02b8('0x35')]?_0x2d60f9['attributes']:_0x250ab9[_0x02b8('0x31')];if(!_0x4c49f4[_0x02b8('0x36')][_0x02b8('0x37')]('nolimit')){_0x2d60f9[_0x02b8('0x19')]=qs['limit'](_0x4c49f4['query']['limit']);_0x2d60f9[_0x02b8('0x1c')]=qs[_0x02b8('0x1c')](_0x4c49f4[_0x02b8('0x36')][_0x02b8('0x1c')]);}_0x2d60f9[_0x02b8('0x38')]=qs[_0x02b8('0x39')](_0x4c49f4['query'][_0x02b8('0x39')]);_0x2d60f9[_0x02b8('0x3a')]=qs['filters'](_[_0x02b8('0x3b')](_0x4c49f4[_0x02b8('0x36')],_0x250ab9[_0x02b8('0x32')]),_0x56f817);if(_0x4c49f4[_0x02b8('0x36')][_0x02b8('0x3c')]){_0x2d60f9['where']=_[_0x02b8('0x3d')](_0x2d60f9[_0x02b8('0x3a')],{'$or':_[_0x02b8('0x2b')](_0x56f817,function(_0x3c18dd){if(_0x3c18dd[_0x02b8('0x2f')]!==_0x02b8('0x3e')){var _0x2bc700={};_0x2bc700[_0x3c18dd[_0x02b8('0x29')]]={'$like':'%'+_0x4c49f4[_0x02b8('0x36')][_0x02b8('0x3c')]+'%'};return _0x2bc700;}})});}_0x2d60f9=_['merge']({},_0x2d60f9,_0x4c49f4[_0x02b8('0x3f')]);var _0x34f1a8={'where':_0x2d60f9[_0x02b8('0x3a')]};return db['SquareOdbc'][_0x02b8('0x1b')](_0x34f1a8)[_0x02b8('0x24')](function(_0x41e6ab){_0x19616[_0x02b8('0x1b')]=_0x41e6ab;if(_0x4c49f4[_0x02b8('0x36')][_0x02b8('0x40')]){_0x2d60f9[_0x02b8('0x41')]=[{'all':!![]}];}return db[_0x02b8('0x2c')][_0x02b8('0x42')](_0x2d60f9);})[_0x02b8('0x24')](function(_0x204004){_0x19616[_0x02b8('0x43')]=_0x204004;return _0x19616;})['then'](respondWithFilteredResult(_0x260a21,_0x2d60f9))[_0x02b8('0x44')](handleError(_0x260a21,null));};exports['show']=function(_0x3e726c,_0x2901ec){var _0x28181c={'raw':!![],'where':{'id':_0x3e726c[_0x02b8('0x45')]['id']}},_0x43c627={};_0x43c627['model']=_[_0x02b8('0x46')](db[_0x02b8('0x2c')][_0x02b8('0x2d')]);_0x43c627[_0x02b8('0x36')]=_[_0x02b8('0x46')](_0x3e726c['query']);_0x43c627[_0x02b8('0x32')]=_[_0x02b8('0x33')](_0x43c627[_0x02b8('0x31')],_0x43c627[_0x02b8('0x36')]);_0x28181c[_0x02b8('0x34')]=_[_0x02b8('0x33')](_0x43c627['model'],qs['fields'](_0x3e726c[_0x02b8('0x36')][_0x02b8('0x47')]));_0x28181c[_0x02b8('0x34')]=_0x28181c[_0x02b8('0x34')]['length']?_0x28181c[_0x02b8('0x34')]:_0x43c627[_0x02b8('0x31')];if(_0x3e726c[_0x02b8('0x36')]['includeAll']){_0x28181c[_0x02b8('0x41')]=[{'all':!![]}];}_0x28181c=_[_0x02b8('0x3d')]({},_0x28181c,_0x3e726c['options']);return db[_0x02b8('0x2c')][_0x02b8('0x48')](_0x28181c)[_0x02b8('0x24')](handleEntityNotFound(_0x2901ec,null))['then'](respondWithResult(_0x2901ec,null))[_0x02b8('0x44')](handleError(_0x2901ec,null));};exports[_0x02b8('0x49')]=function(_0x44feab,_0x5bb944){return db[_0x02b8('0x2c')][_0x02b8('0x49')](_0x44feab['body'],{})[_0x02b8('0x24')](function(_0x4b099b){var _0x450ac5=_0x44feab[_0x02b8('0x4a')][_0x02b8('0x25')]({'plain':!![]});if(!_0x450ac5)throw new Error(_0x02b8('0x4b'));if(_0x450ac5[_0x02b8('0x4c')]===_0x02b8('0x4a')){var _0x4f48f5=_0x4b099b['get']({'plain':!![]});var _0x481b8d='ODBC';return db['UserProfileSection'][_0x02b8('0x48')]({'where':{'name':_0x481b8d,'userProfileId':_0x450ac5[_0x02b8('0x4d')]},'raw':!![]})[_0x02b8('0x24')](function(_0x9124ef){if(_0x9124ef&&_0x9124ef[_0x02b8('0x4e')]===0x0){return db[_0x02b8('0x4f')][_0x02b8('0x49')]({'name':_0x4f48f5[_0x02b8('0x29')],'resourceId':_0x4f48f5['id'],'type':_0x9124ef[_0x02b8('0x29')],'sectionId':_0x9124ef['id']},{})[_0x02b8('0x24')](function(){return _0x4b099b;});}else{return _0x4b099b;}})['catch'](function(_0x52ad8f){logger[_0x02b8('0x27')](_0x02b8('0x50'),_0x52ad8f);throw _0x52ad8f;});}return _0x4b099b;})['then'](respondWithResult(_0x5bb944,0xc9))[_0x02b8('0x44')](handleError(_0x5bb944,null));};exports[_0x02b8('0x22')]=function(_0x3b1508,_0x540575){if(_0x3b1508[_0x02b8('0x51')]['id']){delete _0x3b1508[_0x02b8('0x51')]['id'];}return db[_0x02b8('0x2c')]['find']({'where':{'id':_0x3b1508[_0x02b8('0x45')]['id']}})[_0x02b8('0x24')](handleEntityNotFound(_0x540575,null))['then'](saveUpdates(_0x3b1508['body'],null))[_0x02b8('0x24')](respondWithResult(_0x540575,null))[_0x02b8('0x44')](handleError(_0x540575,null));};exports[_0x02b8('0x23')]=function(_0x4f22fa,_0x36fce0){return db[_0x02b8('0x2c')]['find']({'where':{'id':_0x4f22fa[_0x02b8('0x45')]['id']}})[_0x02b8('0x24')](handleEntityNotFound(_0x36fce0,null))[_0x02b8('0x24')](removeEntity(_0x36fce0,null))[_0x02b8('0x44')](handleError(_0x36fce0,null));};exports[_0x02b8('0x52')]=function(_0x5676fb,_0x58abb7,_0x5a740f){var _0x142919;return db['SquareOdbc'][_0x02b8('0x48')]({'where':{'id':_0x5676fb[_0x02b8('0x45')]['id']},'attributes':['id',_0x02b8('0x53')]})[_0x02b8('0x24')](handleEntityNotFound(_0x58abb7,null))[_0x02b8('0x24')](function(_0x3f1eac){if(_0x3f1eac){var _0x2c5a12=require(_0x02b8('0x54'))();_0x2c5a12[_0x02b8('0x55')](_0x3f1eac[_0x02b8('0x53')]);_0x2c5a12[_0x02b8('0x56')]();return _0x3f1eac;}})[_0x02b8('0x24')](respondWithResult(_0x58abb7,null))[_0x02b8('0x44')](handleError(_0x58abb7,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 9ed1cd2..bc70781 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 _0xf188=['request-promise','path','../../config/environment','./squareOdbc.attributes','exports','define','square_odbc','lodash','util','moment'];(function(_0x4812c9,_0x154b76){var _0x4de61f=function(_0x42cd33){while(--_0x42cd33){_0x4812c9['push'](_0x4812c9['shift']());}};_0x4de61f(++_0x154b76);}(_0xf188,0x1f1));var _0x8f18=function(_0x501a7d,_0x5990ea){_0x501a7d=_0x501a7d-0x0;var _0x5bd8d8=_0xf188[_0x501a7d];return _0x5bd8d8;};'use strict';var _=require(_0x8f18('0x0'));var util=require(_0x8f18('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8f18('0x2'));var BPromise=require('bluebird');var rp=require(_0x8f18('0x3'));var fs=require('fs');var path=require(_0x8f18('0x4'));var rimraf=require('rimraf');var config=require(_0x8f18('0x5'));var attributes=require(_0x8f18('0x6'));module[_0x8f18('0x7')]=function(_0x26968e,_0x1e447d){return _0x26968e[_0x8f18('0x8')]('SquareOdbc',attributes,{'tableName':_0x8f18('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b37=['rimraf','../../config/environment','define','square_odbc','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3a38bd,_0x5bfb4d){var _0x38a03d=function(_0x4136b1){while(--_0x4136b1){_0x3a38bd['push'](_0x3a38bd['shift']());}};_0x38a03d(++_0x5bfb4d);}(_0x4b37,0x1bc));var _0x74b3=function(_0x2ac896,_0x1b6e58){_0x2ac896=_0x2ac896-0x0;var _0x5154e1=_0x4b37[_0x2ac896];return _0x5154e1;};'use strict';var _=require(_0x74b3('0x0'));var util=require(_0x74b3('0x1'));var logger=require(_0x74b3('0x2'))(_0x74b3('0x3'));var moment=require('moment');var BPromise=require(_0x74b3('0x4'));var rp=require(_0x74b3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x74b3('0x6'));var config=require(_0x74b3('0x7'));var attributes=require('./squareOdbc.attributes');module['exports']=function(_0x4ad5c4,_0x5889d4){return _0x4ad5c4[_0x74b3('0x8')]('SquareOdbc',attributes,{'tableName':_0x74b3('0x9'),'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 c4dbb06..b91430c 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 _0x0ec2=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x2d240d,_0x126e93){var _0x46e0f6=function(_0x230720){while(--_0x230720){_0x2d240d['push'](_0x2d240d['shift']());}};_0x46e0f6(++_0x126e93);}(_0x0ec2,0xd3));var _0x20ec=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x0ec2[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0x20ec('0x0'));var util=require(_0x20ec('0x1'));var moment=require(_0x20ec('0x2'));var BPromise=require(_0x20ec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x20ec('0x4'));var db=require(_0x20ec('0x5'))['db'];var utils=require(_0x20ec('0x6'));var logger=require(_0x20ec('0x7'))('rpc');var config=require(_0x20ec('0x8'));var jayson=require(_0x20ec('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x239af1,_0x33f165,_0x317e19){return new BPromise(function(_0x150dae,_0x24a298){return client['request'](_0x239af1,_0x317e19)[_0x20ec('0xa')](function(_0x49e74b){logger[_0x20ec('0xb')](_0x20ec('0xc'),_0x33f165,_0x20ec('0xd'));logger[_0x20ec('0xe')](_0x20ec('0xf'),_0x33f165,_0x20ec('0xd'),JSON[_0x20ec('0x10')](_0x49e74b));if(_0x49e74b[_0x20ec('0x11')]){if(_0x49e74b['error']['code']===0x1f4){logger[_0x20ec('0x11')](_0x20ec('0xc'),_0x33f165,_0x49e74b[_0x20ec('0x11')][_0x20ec('0x12')]);return _0x24a298(_0x49e74b['error'][_0x20ec('0x12')]);}logger[_0x20ec('0x11')](_0x20ec('0xc'),_0x33f165,_0x49e74b[_0x20ec('0x11')][_0x20ec('0x12')]);return _0x150dae(_0x49e74b[_0x20ec('0x11')][_0x20ec('0x12')]);}else{logger[_0x20ec('0xb')]('SquareOdbc,\x20%s,\x20%s',_0x33f165,_0x20ec('0xd'));_0x150dae(_0x49e74b[_0x20ec('0x13')][_0x20ec('0x12')]);}})[_0x20ec('0x14')](function(_0x4865a2){logger[_0x20ec('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x33f165,_0x4865a2);_0x24a298(_0x4865a2);});});}exports[_0x20ec('0x15')]=function(_0x4551b2){var _0x491052=this;return new Promise(function(_0x2c9b63,_0x3a444d){return db[_0x20ec('0x16')][_0x20ec('0x17')]({'raw':_0x4551b2[_0x20ec('0x18')]?_0x4551b2[_0x20ec('0x18')][_0x20ec('0x19')]===undefined?!![]:![]:!![],'where':_0x4551b2['options']?_0x4551b2[_0x20ec('0x18')][_0x20ec('0x1a')]||null:null,'attributes':_0x4551b2[_0x20ec('0x18')]?_0x4551b2['options'][_0x20ec('0x1b')]||null:null,'include':_0x4551b2[_0x20ec('0x18')]?_0x4551b2['options'][_0x20ec('0x1c')]?_[_0x20ec('0x1d')](_0x4551b2[_0x20ec('0x18')]['include'],function(_0x393304){return{'model':db[_0x393304[_0x20ec('0x1e')]],'as':_0x393304['as'],'attributes':_0x393304[_0x20ec('0x1b')],'include':_0x393304['include']?_['map'](_0x393304[_0x20ec('0x1c')],function(_0x1c6b84){return{'model':db[_0x1c6b84[_0x20ec('0x1e')]],'as':_0x1c6b84['as'],'attributes':_0x1c6b84[_0x20ec('0x1b')],'include':_0x1c6b84[_0x20ec('0x1c')]?_['map'](_0x1c6b84[_0x20ec('0x1c')],function(_0x588dc6){return{'model':db[_0x588dc6[_0x20ec('0x1e')]],'as':_0x588dc6['as'],'attributes':_0x588dc6[_0x20ec('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x20ec('0xa')](function(_0x1d1010){logger[_0x20ec('0xb')](_0x20ec('0x15'),_0x4551b2);logger[_0x20ec('0xe')](_0x20ec('0x15'),_0x4551b2,JSON[_0x20ec('0x10')](_0x1d1010));_0x2c9b63(_0x1d1010);})['catch'](function(_0x5dccb4){logger[_0x20ec('0x11')](_0x20ec('0x15'),_0x5dccb4[_0x20ec('0x12')],_0x4551b2);_0x3a444d(_0x491052[_0x20ec('0x11')](0x1f4,_0x5dccb4[_0x20ec('0x12')]));});});}; \ No newline at end of file +var _0x7d0f=['where','attributes','include','map','model','then','lodash','util','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','request','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw'];(function(_0x1a7262,_0x462d83){var _0x3cb606=function(_0x568393){while(--_0x568393){_0x1a7262['push'](_0x1a7262['shift']());}};_0x3cb606(++_0x462d83);}(_0x7d0f,0x9c));var _0xf7d0=function(_0x15e176,_0x58a3f4){_0x15e176=_0x15e176-0x0;var _0x3a5fff=_0x7d0f[_0x15e176];return _0x3a5fff;};'use strict';var _=require(_0xf7d0('0x0'));var util=require(_0xf7d0('0x1'));var moment=require(_0xf7d0('0x2'));var BPromise=require(_0xf7d0('0x3'));var rs=require(_0xf7d0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf7d0('0x5'));var config=require(_0xf7d0('0x6'));var jayson=require(_0xf7d0('0x7'));var client=jayson[_0xf7d0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f0d6e,_0x659c4,_0x5722e8){return new BPromise(function(_0x1b4083,_0x536549){return client[_0xf7d0('0x9')](_0x1f0d6e,_0x5722e8)['then'](function(_0x476cc4){logger[_0xf7d0('0xa')](_0xf7d0('0xb'),_0x659c4,'request\x20sent');logger[_0xf7d0('0xc')](_0xf7d0('0xd'),_0x659c4,'request\x20sent',JSON['stringify'](_0x476cc4));if(_0x476cc4[_0xf7d0('0xe')]){if(_0x476cc4[_0xf7d0('0xe')][_0xf7d0('0xf')]===0x1f4){logger[_0xf7d0('0xe')](_0xf7d0('0xb'),_0x659c4,_0x476cc4[_0xf7d0('0xe')][_0xf7d0('0x10')]);return _0x536549(_0x476cc4[_0xf7d0('0xe')][_0xf7d0('0x10')]);}logger[_0xf7d0('0xe')](_0xf7d0('0xb'),_0x659c4,_0x476cc4[_0xf7d0('0xe')]['message']);return _0x1b4083(_0x476cc4[_0xf7d0('0xe')][_0xf7d0('0x10')]);}else{logger[_0xf7d0('0xa')]('SquareOdbc,\x20%s,\x20%s',_0x659c4,'request\x20sent');_0x1b4083(_0x476cc4[_0xf7d0('0x11')][_0xf7d0('0x10')]);}})[_0xf7d0('0x12')](function(_0x5280d7){logger['error'](_0xf7d0('0xb'),_0x659c4,_0x5280d7);_0x536549(_0x5280d7);});});}exports[_0xf7d0('0x13')]=function(_0x14ca91){var _0x4c1ed3=this;return new Promise(function(_0xfdce8f,_0x140c2d){return db[_0xf7d0('0x14')][_0xf7d0('0x15')]({'raw':_0x14ca91['options']?_0x14ca91[_0xf7d0('0x16')][_0xf7d0('0x17')]===undefined?!![]:![]:!![],'where':_0x14ca91[_0xf7d0('0x16')]?_0x14ca91['options'][_0xf7d0('0x18')]||null:null,'attributes':_0x14ca91[_0xf7d0('0x16')]?_0x14ca91[_0xf7d0('0x16')][_0xf7d0('0x19')]||null:null,'include':_0x14ca91[_0xf7d0('0x16')]?_0x14ca91[_0xf7d0('0x16')][_0xf7d0('0x1a')]?_['map'](_0x14ca91[_0xf7d0('0x16')][_0xf7d0('0x1a')],function(_0x112a27){return{'model':db[_0x112a27['model']],'as':_0x112a27['as'],'attributes':_0x112a27[_0xf7d0('0x19')],'include':_0x112a27[_0xf7d0('0x1a')]?_[_0xf7d0('0x1b')](_0x112a27[_0xf7d0('0x1a')],function(_0x4e133a){return{'model':db[_0x4e133a['model']],'as':_0x4e133a['as'],'attributes':_0x4e133a[_0xf7d0('0x19')],'include':_0x4e133a[_0xf7d0('0x1a')]?_[_0xf7d0('0x1b')](_0x4e133a[_0xf7d0('0x1a')],function(_0x2e3566){return{'model':db[_0x2e3566[_0xf7d0('0x1c')]],'as':_0x2e3566['as'],'attributes':_0x2e3566[_0xf7d0('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf7d0('0x1d')](function(_0x56dd46){logger[_0xf7d0('0xa')](_0xf7d0('0x13'),_0x14ca91);logger[_0xf7d0('0xc')](_0xf7d0('0x13'),_0x14ca91,JSON['stringify'](_0x56dd46));_0xfdce8f(_0x56dd46);})[_0xf7d0('0x12')](function(_0x13a4c8){logger['error'](_0xf7d0('0x13'),_0x13a4c8[_0xf7d0('0x10')],_0x14ca91);_0x140c2d(_0x4c1ed3['error'](0x1f4,_0x13a4c8[_0xf7d0('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 498485a..a427374 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 _0x8ce3=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareProject.controller','get','/:id','isAuthenticated','show','/:id/users','getUsers','post','addUsers','put','delete','removeUsers','exports'];(function(_0x1e4078,_0x155a20){var _0x1129fa=function(_0x344446){while(--_0x344446){_0x1e4078['push'](_0x1e4078['shift']());}};_0x1129fa(++_0x155a20);}(_0x8ce3,0x1b9));var _0x38ce=function(_0x7e918f,_0x48cf10){_0x7e918f=_0x7e918f-0x0;var _0x5b35ab=_0x8ce3[_0x7e918f];return _0x5b35ab;};'use strict';var multer=require('multer');var util=require(_0x38ce('0x0'));var path=require(_0x38ce('0x1'));var timeout=require(_0x38ce('0x2'));var express=require(_0x38ce('0x3'));var router=express[_0x38ce('0x4')]();var fs_extra=require(_0x38ce('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x38ce('0x6'));var config=require(_0x38ce('0x7'));var controller=require(_0x38ce('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x38ce('0x9')](_0x38ce('0xa'),auth[_0x38ce('0xb')](),controller[_0x38ce('0xc')]);router['get'](_0x38ce('0xd'),auth[_0x38ce('0xb')](),controller[_0x38ce('0xe')]);router[_0x38ce('0xf')]('/',auth[_0x38ce('0xb')](),controller['create']);router[_0x38ce('0xf')](_0x38ce('0xd'),auth[_0x38ce('0xb')](),controller[_0x38ce('0x10')]);router[_0x38ce('0x11')]('/:id',auth[_0x38ce('0xb')](),controller['update']);router[_0x38ce('0x12')](_0x38ce('0xa'),auth['isAuthenticated'](),controller['destroy']);router[_0x38ce('0x12')](_0x38ce('0xd'),auth[_0x38ce('0xb')](),controller[_0x38ce('0x13')]);module[_0x38ce('0x14')]=router; \ No newline at end of file +var _0x7008=['delete','/:id','destroy','removeUsers','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','show','/:id/users','getUsers','post','create','addUsers','update'];(function(_0xdc922,_0x2a301a){var _0x5c3fe2=function(_0x504c89){while(--_0x504c89){_0xdc922['push'](_0xdc922['shift']());}};_0x5c3fe2(++_0x2a301a);}(_0x7008,0x185));var _0x8700=function(_0x24037f,_0x4c2296){_0x24037f=_0x24037f-0x0;var _0x126a28=_0x7008[_0x24037f];return _0x126a28;};'use strict';var multer=require(_0x8700('0x0'));var util=require(_0x8700('0x1'));var path=require(_0x8700('0x2'));var timeout=require(_0x8700('0x3'));var express=require('express');var router=express[_0x8700('0x4')]();var fs_extra=require(_0x8700('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8700('0x6'));var config=require(_0x8700('0x7'));var controller=require(_0x8700('0x8'));router[_0x8700('0x9')]('/',auth[_0x8700('0xa')](),controller[_0x8700('0xb')]);router[_0x8700('0x9')]('/:id',auth[_0x8700('0xa')](),controller[_0x8700('0xc')]);router[_0x8700('0x9')](_0x8700('0xd'),auth[_0x8700('0xa')](),controller[_0x8700('0xe')]);router[_0x8700('0xf')]('/',auth[_0x8700('0xa')](),controller[_0x8700('0x10')]);router[_0x8700('0xf')]('/:id/users',auth['isAuthenticated'](),controller[_0x8700('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x8700('0x12')]);router[_0x8700('0x13')](_0x8700('0x14'),auth[_0x8700('0xa')](),controller[_0x8700('0x15')]);router[_0x8700('0x13')](_0x8700('0xd'),auth['isAuthenticated'](),controller[_0x8700('0x16')]);module[_0x8700('0x17')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 104845b..ae18fdf 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 _0x79a3=['sequelize','exports','STRING','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE'];(function(_0x3a5916,_0xa2cb1e){var _0x3ce568=function(_0x4e5401){while(--_0x4e5401){_0x3a5916['push'](_0x3a5916['shift']());}};_0x3ce568(++_0xa2cb1e);}(_0x79a3,0x113));var _0x379a=function(_0x3db327,_0x357573){_0x3db327=_0x3db327-0x0;var _0x4b82ef=_0x79a3[_0x3db327];return _0x4b82ef;};'use strict';var Sequelize=require(_0x379a('0x0'));module[_0x379a('0x1')]={'name':{'type':Sequelize[_0x379a('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x379a('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x379a('0x3')](_0x379a('0x4')),'get':function(){if(this[_0x379a('0x5')](_0x379a('0x6'))){return this['getDataValue'](_0x379a('0x6'))[_0x379a('0x7')](_0x379a('0x8'));}}},'production':{'type':Sequelize['BLOB'](_0x379a('0x4')),'get':function(){if(this['getDataValue'](_0x379a('0x9'))){return this[_0x379a('0x5')]('production')[_0x379a('0x7')](_0x379a('0x8'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x379a('0xa')]}}; \ No newline at end of file +var _0xb4b9=['utf8','sequelize','exports','STRING','name','BLOB','long','getDataValue','preproduction','toString','production'];(function(_0x1b58c5,_0x44eb0f){var _0x2c8cb6=function(_0x508dc4){while(--_0x508dc4){_0x1b58c5['push'](_0x1b58c5['shift']());}};_0x2c8cb6(++_0x44eb0f);}(_0xb4b9,0xd2));var _0x9b4b=function(_0xe6fa71,_0x45b669){_0xe6fa71=_0xe6fa71-0x0;var _0x5a6d62=_0xb4b9[_0xe6fa71];return _0x5a6d62;};'use strict';var Sequelize=require(_0x9b4b('0x0'));module[_0x9b4b('0x1')]={'name':{'type':Sequelize[_0x9b4b('0x2')],'unique':_0x9b4b('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x9b4b('0x4')](_0x9b4b('0x5')),'get':function(){if(this[_0x9b4b('0x6')](_0x9b4b('0x7'))){return this[_0x9b4b('0x6')](_0x9b4b('0x7'))[_0x9b4b('0x8')]('utf8');}}},'production':{'type':Sequelize['BLOB'](_0x9b4b('0x5')),'get':function(){if(this[_0x9b4b('0x6')](_0x9b4b('0x9'))){return this[_0x9b4b('0x6')]('production')['toString'](_0x9b4b('0xa'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 25f5308..20bed49 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 _0x7d23=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./squareProject.socket','register','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','SquareProjects','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','filters','where','merge','VIRTUAL','include','SquareProject','findAll','catch','params','includeAll','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','addUsers','ids','omit','removeUsers','emit','userSquareProject:remove','getUsers','User','pick','filter','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x29469a,_0x3020d9){var _0x4a7911=function(_0x1d01e4){while(--_0x1d01e4){_0x29469a['push'](_0x29469a['shift']());}};_0x4a7911(++_0x3020d9);}(_0x7d23,0x172));var _0x37d2=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0x7d23[_0x5a95fa];return _0x1a61b8;};'use strict';var emlformat=require(_0x37d2('0x0'));var rimraf=require(_0x37d2('0x1'));var zipdir=require(_0x37d2('0x2'));var jsonpatch=require(_0x37d2('0x3'));var rp=require(_0x37d2('0x4'));var moment=require(_0x37d2('0x5'));var BPromise=require(_0x37d2('0x6'));var Mustache=require(_0x37d2('0x7'));var util=require(_0x37d2('0x8'));var path=require('path');var sox=require(_0x37d2('0x9'));var csv=require(_0x37d2('0xa'));var ejs=require(_0x37d2('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x37d2('0xc'));var deskjs=require(_0x37d2('0xd'));var toCsv=require('to-csv');var querystring=require(_0x37d2('0xe'));var Papa=require(_0x37d2('0xf'));var Redis=require(_0x37d2('0x10'));var authService=require(_0x37d2('0x11'));var qs=require(_0x37d2('0x12'));var as=require(_0x37d2('0x13'));var hardwareService=require(_0x37d2('0x14'));var logger=require(_0x37d2('0x15'))(_0x37d2('0x16'));var utils=require(_0x37d2('0x17'));var config=require(_0x37d2('0x18'));var licenseUtil=require(_0x37d2('0x19'));var db=require(_0x37d2('0x1a'))['db'];config[_0x37d2('0x1b')]=_[_0x37d2('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x37d2('0x1b')]));require(_0x37d2('0x1d'))[_0x37d2('0x1e')](socket);function respondWithStatusCode(_0xc91944,_0x313e52){_0x313e52=_0x313e52||0xcc;return function(_0x571fa0){if(_0x571fa0){return _0xc91944['sendStatus'](_0x313e52);}return _0xc91944[_0x37d2('0x1f')](_0x313e52)[_0x37d2('0x20')]();};}function respondWithResult(_0x3787a6,_0xf996a4){_0xf996a4=_0xf996a4||0xc8;return function(_0x41870d){if(_0x41870d){return _0x3787a6[_0x37d2('0x1f')](_0xf996a4)[_0x37d2('0x21')](_0x41870d);}};}function respondWithFilteredResult(_0x343cf8,_0x3400ac){return function(_0x198a6e){if(_0x198a6e){var _0x2a04b7=typeof _0x3400ac[_0x37d2('0x22')]===_0x37d2('0x23')&&typeof _0x3400ac[_0x37d2('0x24')]===_0x37d2('0x23');var _0x529930=_0x198a6e[_0x37d2('0x25')];var _0x272bc8=_0x2a04b7?0x0:_0x3400ac['offset'];var _0x5169eb=_0x2a04b7?_0x198a6e[_0x37d2('0x25')]:_0x3400ac['offset']+_0x3400ac[_0x37d2('0x24')];var _0x55614c;if(_0x5169eb>=_0x529930){_0x5169eb=_0x529930;_0x55614c=0xc8;}else{_0x55614c=0xce;}_0x343cf8[_0x37d2('0x1f')](_0x55614c);return _0x343cf8[_0x37d2('0x26')]('Content-Range',_0x272bc8+'-'+_0x5169eb+'/'+_0x529930)[_0x37d2('0x21')](_0x198a6e);}return null;};}function patchUpdates(_0x5a19a2){return function(_0x106c6d){try{jsonpatch[_0x37d2('0x27')](_0x106c6d,_0x5a19a2,!![]);}catch(_0x1d24a0){return BPromise[_0x37d2('0x28')](_0x1d24a0);}return _0x106c6d[_0x37d2('0x29')]();};}function saveUpdates(_0x300f08,_0xbcea0a){return function(_0xefbde2){if(_0xefbde2){return _0xefbde2[_0x37d2('0x2a')](_0x300f08)[_0x37d2('0x2b')](function(_0x3cf260){return _0x3cf260;});}return null;};}function removeEntity(_0x137b1a,_0x1393b0){return function(_0x4a2091){if(_0x4a2091){return _0x4a2091[_0x37d2('0x2c')]()[_0x37d2('0x2b')](function(){var _0x1a3e1a=_0x4a2091['get']({'plain':!![]});var _0x2d9e65=_0x37d2('0x2d');return db[_0x37d2('0x2e')][_0x37d2('0x2c')]({'where':{'type':_0x2d9e65,'resourceId':_0x1a3e1a['id']}})[_0x37d2('0x2b')](function(){return _0x4a2091;});})['then'](function(){_0x137b1a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41a898,_0x49a13c){return function(_0x55661e){if(!_0x55661e){_0x41a898['sendStatus'](0x194);}return _0x55661e;};}function handleError(_0x69383d,_0x1be418){_0x1be418=_0x1be418||0x1f4;return function(_0x29c432){logger[_0x37d2('0x2f')](_0x29c432[_0x37d2('0x30')]);if(_0x29c432[_0x37d2('0x31')]){delete _0x29c432[_0x37d2('0x31')];}_0x69383d['status'](_0x1be418)[_0x37d2('0x32')](_0x29c432);};}exports[_0x37d2('0x33')]=function(_0x3aa11d,_0x378af5){var _0x21882d={},_0x45af78={},_0x1a1590={'count':0x0,'rows':[]};var _0x3ce539=_[_0x37d2('0x34')](db['SquareProject'][_0x37d2('0x35')],function(_0x5c091f){return{'name':_0x5c091f[_0x37d2('0x36')],'type':_0x5c091f[_0x37d2('0x37')][_0x37d2('0x38')]};});_0x45af78[_0x37d2('0x39')]=_['map'](_0x3ce539,_0x37d2('0x31'));_0x45af78[_0x37d2('0x3a')]=_[_0x37d2('0x3b')](_0x3aa11d[_0x37d2('0x3a')]);_0x45af78['filters']=_['intersection'](_0x45af78[_0x37d2('0x39')],_0x45af78[_0x37d2('0x3a')]);_0x21882d['attributes']=_[_0x37d2('0x3c')](_0x45af78[_0x37d2('0x39')],qs[_0x37d2('0x3d')](_0x3aa11d[_0x37d2('0x3a')][_0x37d2('0x3d')]));_0x21882d[_0x37d2('0x3e')]=_0x21882d['attributes'][_0x37d2('0x3f')]?_0x21882d[_0x37d2('0x3e')]:_0x45af78[_0x37d2('0x39')];if(!_0x3aa11d[_0x37d2('0x3a')]['hasOwnProperty'](_0x37d2('0x40'))){_0x21882d[_0x37d2('0x24')]=qs[_0x37d2('0x24')](_0x3aa11d[_0x37d2('0x3a')][_0x37d2('0x24')]);_0x21882d[_0x37d2('0x22')]=qs[_0x37d2('0x22')](_0x3aa11d[_0x37d2('0x3a')]['offset']);}_0x21882d[_0x37d2('0x41')]=qs['sort'](_0x3aa11d[_0x37d2('0x3a')][_0x37d2('0x42')]);_0x21882d['where']=qs['filters'](_['pick'](_0x3aa11d[_0x37d2('0x3a')],_0x45af78[_0x37d2('0x43')]),_0x3ce539);if(_0x3aa11d['query']['filter']){_0x21882d[_0x37d2('0x44')]=_[_0x37d2('0x45')](_0x21882d[_0x37d2('0x44')],{'$or':_[_0x37d2('0x34')](_0x3ce539,function(_0x94009f){if(_0x94009f[_0x37d2('0x37')]!==_0x37d2('0x46')){var _0x58ccac={};_0x58ccac[_0x94009f[_0x37d2('0x31')]]={'$like':'%'+_0x3aa11d[_0x37d2('0x3a')]['filter']+'%'};return _0x58ccac;}})});}_0x21882d=_[_0x37d2('0x45')]({},_0x21882d,_0x3aa11d['options']);var _0x515718={'where':_0x21882d[_0x37d2('0x44')]};return db['SquareProject']['count'](_0x515718)['then'](function(_0x15935c){_0x1a1590[_0x37d2('0x25')]=_0x15935c;if(_0x3aa11d[_0x37d2('0x3a')]['includeAll']){_0x21882d[_0x37d2('0x47')]=[{'all':!![]}];}return db[_0x37d2('0x48')][_0x37d2('0x49')](_0x21882d);})['then'](function(_0x3c0732){_0x1a1590['rows']=_0x3c0732;return _0x1a1590;})[_0x37d2('0x2b')](respondWithFilteredResult(_0x378af5,_0x21882d))[_0x37d2('0x4a')](handleError(_0x378af5,null));};exports['show']=function(_0x1ddc41,_0x252d58){var _0x155c7b={'raw':![],'where':{'id':_0x1ddc41[_0x37d2('0x4b')]['id']}},_0x14e868={};_0x14e868[_0x37d2('0x39')]=_['keys'](db[_0x37d2('0x48')]['rawAttributes']);_0x14e868[_0x37d2('0x3a')]=_['keys'](_0x1ddc41[_0x37d2('0x3a')]);_0x14e868[_0x37d2('0x43')]=_[_0x37d2('0x3c')](_0x14e868[_0x37d2('0x39')],_0x14e868[_0x37d2('0x3a')]);_0x155c7b[_0x37d2('0x3e')]=_[_0x37d2('0x3c')](_0x14e868[_0x37d2('0x39')],qs[_0x37d2('0x3d')](_0x1ddc41['query'][_0x37d2('0x3d')]));_0x155c7b[_0x37d2('0x3e')]=_0x155c7b[_0x37d2('0x3e')][_0x37d2('0x3f')]?_0x155c7b[_0x37d2('0x3e')]:_0x14e868[_0x37d2('0x39')];if(_0x1ddc41[_0x37d2('0x3a')][_0x37d2('0x4c')]){_0x155c7b[_0x37d2('0x47')]=[{'all':!![]}];}_0x155c7b=_['merge']({},_0x155c7b,_0x1ddc41[_0x37d2('0x4d')]);return db['SquareProject'][_0x37d2('0x4e')](_0x155c7b)['then'](handleEntityNotFound(_0x252d58,null))[_0x37d2('0x2b')](respondWithResult(_0x252d58,null))[_0x37d2('0x4a')](handleError(_0x252d58,null));};exports[_0x37d2('0x4f')]=function(_0x29d88a,_0x181862){return db[_0x37d2('0x48')][_0x37d2('0x4f')](_0x29d88a[_0x37d2('0x50')],{})[_0x37d2('0x2b')](function(_0x3deb42){var _0x51c57b=_0x29d88a[_0x37d2('0x51')][_0x37d2('0x52')]({'plain':!![]});if(!_0x51c57b)throw new Error(_0x37d2('0x53'));if(_0x51c57b[_0x37d2('0x54')]===_0x37d2('0x51')){var _0x36b1d7=_0x3deb42[_0x37d2('0x52')]({'plain':!![]});var _0x87944b=_0x37d2('0x2d');return db[_0x37d2('0x55')][_0x37d2('0x4e')]({'where':{'name':_0x87944b,'userProfileId':_0x51c57b[_0x37d2('0x56')]},'raw':!![]})[_0x37d2('0x2b')](function(_0x48126a){if(_0x48126a&&_0x48126a[_0x37d2('0x57')]===0x0){return db['UserProfileResource'][_0x37d2('0x4f')]({'name':_0x36b1d7[_0x37d2('0x31')],'resourceId':_0x36b1d7['id'],'type':_0x48126a[_0x37d2('0x31')],'sectionId':_0x48126a['id']},{})[_0x37d2('0x2b')](function(){return _0x3deb42;});}else{return _0x3deb42;}})['catch'](function(_0x19547a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19547a);throw _0x19547a;});}return _0x3deb42;})[_0x37d2('0x2b')](respondWithResult(_0x181862,0xc9))[_0x37d2('0x4a')](handleError(_0x181862,null));};exports[_0x37d2('0x2a')]=function(_0x17abea,_0x4ed745){if(_0x17abea[_0x37d2('0x50')]['id']){delete _0x17abea[_0x37d2('0x50')]['id'];}return db['SquareProject'][_0x37d2('0x4e')]({'where':{'id':_0x17abea[_0x37d2('0x4b')]['id']}})[_0x37d2('0x2b')](handleEntityNotFound(_0x4ed745,null))[_0x37d2('0x2b')](saveUpdates(_0x17abea[_0x37d2('0x50')],null))['then'](respondWithResult(_0x4ed745,null))['catch'](handleError(_0x4ed745,null));};exports['destroy']=function(_0x2dc922,_0x520f62){return db[_0x37d2('0x48')]['find']({'where':{'id':_0x2dc922[_0x37d2('0x4b')]['id']}})[_0x37d2('0x2b')](handleEntityNotFound(_0x520f62,null))[_0x37d2('0x2b')](removeEntity(_0x520f62,null))[_0x37d2('0x4a')](handleError(_0x520f62,null));};exports[_0x37d2('0x58')]=function(_0x1c7b43,_0x282a49,_0xe89f3b){return db['SquareProject'][_0x37d2('0x4e')]({'where':{'id':_0x1c7b43[_0x37d2('0x4b')]['id']}})[_0x37d2('0x2b')](handleEntityNotFound(_0x282a49,null))['then'](function(_0x319d1f){if(_0x319d1f){return _0x319d1f['addUsers'](_0x1c7b43[_0x37d2('0x50')][_0x37d2('0x59')],_[_0x37d2('0x5a')](_0x1c7b43['body'],['ids','id'])||{});}})[_0x37d2('0x2b')](respondWithResult(_0x282a49,null))['catch'](handleError(_0x282a49,null));};exports[_0x37d2('0x5b')]=function(_0x190c1e,_0x1040f8,_0x367b82){return db['SquareProject'][_0x37d2('0x4e')]({'where':{'id':_0x190c1e[_0x37d2('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1040f8,null))[_0x37d2('0x2b')](function(_0x493ecb){if(_0x493ecb){return _0x493ecb[_0x37d2('0x5b')](_0x190c1e['query'][_0x37d2('0x59')])['then'](function(){if(_['isArray'](_0x190c1e[_0x37d2('0x3a')][_0x37d2('0x59')])){for(var _0x44a653=0x0;_0x44a653<_0x190c1e[_0x37d2('0x3a')][_0x37d2('0x59')]['length'];_0x44a653+=0x1){socket['emit']('userSquareProject:remove',{'UserId':Number(_0x190c1e[_0x37d2('0x3a')][_0x37d2('0x59')][_0x44a653]),'SquareProjectId':Number(_0x190c1e[_0x37d2('0x4b')]['id'])});}}else{socket[_0x37d2('0x5c')](_0x37d2('0x5d'),{'UserId':Number(_0x190c1e['query'][_0x37d2('0x59')]),'SquareProjectId':Number(_0x190c1e[_0x37d2('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x1040f8,null))[_0x37d2('0x4a')](handleError(_0x1040f8,null));};exports[_0x37d2('0x5e')]=function(_0x5c632c,_0x303015,_0x19fe08){var _0x34a857={};var _0x329124={};var _0x54c274;var _0x40727c;return db['SquareProject']['findOne']({'where':{'id':_0x5c632c[_0x37d2('0x4b')]['id']}})['then'](handleEntityNotFound(_0x303015,null))['then'](function(_0x2d88c1){if(_0x2d88c1){_0x54c274=_0x2d88c1;_0x329124[_0x37d2('0x39')]=_['keys'](db[_0x37d2('0x5f')][_0x37d2('0x35')]);_0x329124['query']=_['keys'](_0x5c632c[_0x37d2('0x3a')]);_0x329124['filters']=_[_0x37d2('0x3c')](_0x329124[_0x37d2('0x39')],_0x329124[_0x37d2('0x3a')]);_0x34a857[_0x37d2('0x3e')]=_['intersection'](_0x329124['model'],qs[_0x37d2('0x3d')](_0x5c632c[_0x37d2('0x3a')][_0x37d2('0x3d')]));_0x34a857[_0x37d2('0x3e')]=_0x34a857[_0x37d2('0x3e')]['length']?_0x34a857[_0x37d2('0x3e')]:_0x329124[_0x37d2('0x39')];_0x34a857['order']=qs[_0x37d2('0x42')](_0x5c632c[_0x37d2('0x3a')][_0x37d2('0x42')]);_0x34a857['where']=qs['filters'](_[_0x37d2('0x60')](_0x5c632c[_0x37d2('0x3a')],_0x329124[_0x37d2('0x43')]));if(_0x5c632c[_0x37d2('0x3a')][_0x37d2('0x61')]){_0x34a857[_0x37d2('0x44')]=_[_0x37d2('0x45')](_0x34a857['where'],{'$or':_[_0x37d2('0x34')](_0x34a857[_0x37d2('0x3e')],function(_0x5578f4){var _0x4df279={};_0x4df279[_0x5578f4]={'$like':'%'+_0x5c632c[_0x37d2('0x3a')][_0x37d2('0x61')]+'%'};return _0x4df279;})});}_0x34a857=_[_0x37d2('0x45')]({},_0x34a857,_0x5c632c[_0x37d2('0x4d')]);return _0x54c274['getUsers'](_0x34a857);}})[_0x37d2('0x2b')](function(_0x4d7851){if(_0x4d7851){_0x40727c=_0x4d7851['length'];if(!_0x5c632c[_0x37d2('0x3a')]['hasOwnProperty'](_0x37d2('0x40'))){_0x34a857[_0x37d2('0x24')]=qs[_0x37d2('0x24')](_0x5c632c[_0x37d2('0x3a')][_0x37d2('0x24')]);_0x34a857[_0x37d2('0x22')]=qs[_0x37d2('0x22')](_0x5c632c['query']['offset']);}return _0x54c274['getUsers'](_0x34a857);}})['then'](function(_0x4e5610){if(_0x4e5610){return _0x4e5610?{'count':_0x40727c,'rows':_0x4e5610}:null;}})[_0x37d2('0x2b')](respondWithResult(_0x303015,null))[_0x37d2('0x4a')](handleError(_0x303015,null));}; \ No newline at end of file +var _0x1f18=['findOne','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','register','sendStatus','end','status','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','SquareProjects','UserProfileResource','error','stack','name','map','SquareProject','rawAttributes','type','model','query','filters','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','intersection','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','removeUsers','emit','userSquareProject:remove','getUsers'];(function(_0x24431a,_0x52459a){var _0x454ec7=function(_0x34cd60){while(--_0x34cd60){_0x24431a['push'](_0x24431a['shift']());}};_0x454ec7(++_0x52459a);}(_0x1f18,0x1ce));var _0x81f1=function(_0x1f824b,_0x1f9910){_0x1f824b=_0x1f824b-0x0;var _0x2a4acb=_0x1f18[_0x1f824b];return _0x2a4acb;};'use strict';var emlformat=require(_0x81f1('0x0'));var rimraf=require(_0x81f1('0x1'));var zipdir=require(_0x81f1('0x2'));var jsonpatch=require(_0x81f1('0x3'));var rp=require(_0x81f1('0x4'));var moment=require(_0x81f1('0x5'));var BPromise=require(_0x81f1('0x6'));var Mustache=require(_0x81f1('0x7'));var util=require('util');var path=require('path');var sox=require(_0x81f1('0x8'));var csv=require(_0x81f1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x81f1('0xa'));var squel=require(_0x81f1('0xb'));var crypto=require('crypto');var jsforce=require(_0x81f1('0xc'));var deskjs=require(_0x81f1('0xd'));var toCsv=require(_0x81f1('0x9'));var querystring=require('querystring');var Papa=require(_0x81f1('0xe'));var Redis=require(_0x81f1('0xf'));var authService=require(_0x81f1('0x10'));var qs=require(_0x81f1('0x11'));var as=require(_0x81f1('0x12'));var hardwareService=require(_0x81f1('0x13'));var logger=require(_0x81f1('0x14'))('api');var utils=require(_0x81f1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x81f1('0x16'));var db=require(_0x81f1('0x17'))['db'];config['redis']=_['defaults'](config[_0x81f1('0x18')],{'host':_0x81f1('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x81f1('0x18')]));require('./squareProject.socket')[_0x81f1('0x1a')](socket);function respondWithStatusCode(_0xb6c5df,_0x3ec5f4){_0x3ec5f4=_0x3ec5f4||0xcc;return function(_0x1c4aaf){if(_0x1c4aaf){return _0xb6c5df[_0x81f1('0x1b')](_0x3ec5f4);}return _0xb6c5df['status'](_0x3ec5f4)[_0x81f1('0x1c')]();};}function respondWithResult(_0xb21e2d,_0x10cb9f){_0x10cb9f=_0x10cb9f||0xc8;return function(_0x58b55d){if(_0x58b55d){return _0xb21e2d[_0x81f1('0x1d')](_0x10cb9f)['json'](_0x58b55d);}};}function respondWithFilteredResult(_0x4c67e2,_0xceb34f){return function(_0x5ae31c){if(_0x5ae31c){var _0x5dd906=typeof _0xceb34f[_0x81f1('0x1e')]===_0x81f1('0x1f')&&typeof _0xceb34f[_0x81f1('0x20')]==='undefined';var _0x17d305=_0x5ae31c[_0x81f1('0x21')];var _0x1d39d2=_0x5dd906?0x0:_0xceb34f[_0x81f1('0x1e')];var _0x41d2a5=_0x5dd906?_0x5ae31c['count']:_0xceb34f[_0x81f1('0x1e')]+_0xceb34f[_0x81f1('0x20')];var _0x364108;if(_0x41d2a5>=_0x17d305){_0x41d2a5=_0x17d305;_0x364108=0xc8;}else{_0x364108=0xce;}_0x4c67e2[_0x81f1('0x1d')](_0x364108);return _0x4c67e2[_0x81f1('0x22')]('Content-Range',_0x1d39d2+'-'+_0x41d2a5+'/'+_0x17d305)['json'](_0x5ae31c);}return null;};}function patchUpdates(_0x53fd83){return function(_0x4cea49){try{jsonpatch[_0x81f1('0x23')](_0x4cea49,_0x53fd83,!![]);}catch(_0x27c187){return BPromise[_0x81f1('0x24')](_0x27c187);}return _0x4cea49[_0x81f1('0x25')]();};}function saveUpdates(_0x1e3be4,_0x449be8){return function(_0x46e693){if(_0x46e693){return _0x46e693[_0x81f1('0x26')](_0x1e3be4)[_0x81f1('0x27')](function(_0x1ca581){return _0x1ca581;});}return null;};}function removeEntity(_0x15d0a1,_0x510e9b){return function(_0x345c3e){if(_0x345c3e){return _0x345c3e[_0x81f1('0x28')]()[_0x81f1('0x27')](function(){var _0x591f2a=_0x345c3e['get']({'plain':!![]});var _0x1beb58=_0x81f1('0x29');return db[_0x81f1('0x2a')][_0x81f1('0x28')]({'where':{'type':_0x1beb58,'resourceId':_0x591f2a['id']}})[_0x81f1('0x27')](function(){return _0x345c3e;});})['then'](function(){_0x15d0a1[_0x81f1('0x1d')](0xcc)[_0x81f1('0x1c')]();});}};}function handleEntityNotFound(_0x2a5f22,_0x337dcc){return function(_0x35109b){if(!_0x35109b){_0x2a5f22[_0x81f1('0x1b')](0x194);}return _0x35109b;};}function handleError(_0x290517,_0x7037de){_0x7037de=_0x7037de||0x1f4;return function(_0x24b769){logger[_0x81f1('0x2b')](_0x24b769[_0x81f1('0x2c')]);if(_0x24b769['name']){delete _0x24b769[_0x81f1('0x2d')];}_0x290517[_0x81f1('0x1d')](_0x7037de)['send'](_0x24b769);};}exports['index']=function(_0x53be95,_0x4fa093){var _0x4162b5={},_0x383d1a={},_0x10d4e5={'count':0x0,'rows':[]};var _0x3c8c74=_[_0x81f1('0x2e')](db[_0x81f1('0x2f')][_0x81f1('0x30')],function(_0x4ad901){return{'name':_0x4ad901['fieldName'],'type':_0x4ad901[_0x81f1('0x31')]['key']};});_0x383d1a[_0x81f1('0x32')]=_[_0x81f1('0x2e')](_0x3c8c74,'name');_0x383d1a[_0x81f1('0x33')]=_['keys'](_0x53be95[_0x81f1('0x33')]);_0x383d1a[_0x81f1('0x34')]=_['intersection'](_0x383d1a[_0x81f1('0x32')],_0x383d1a[_0x81f1('0x33')]);_0x4162b5[_0x81f1('0x35')]=_['intersection'](_0x383d1a[_0x81f1('0x32')],qs[_0x81f1('0x36')](_0x53be95['query'][_0x81f1('0x36')]));_0x4162b5[_0x81f1('0x35')]=_0x4162b5[_0x81f1('0x35')][_0x81f1('0x37')]?_0x4162b5[_0x81f1('0x35')]:_0x383d1a[_0x81f1('0x32')];if(!_0x53be95['query']['hasOwnProperty'](_0x81f1('0x38'))){_0x4162b5[_0x81f1('0x20')]=qs[_0x81f1('0x20')](_0x53be95[_0x81f1('0x33')][_0x81f1('0x20')]);_0x4162b5[_0x81f1('0x1e')]=qs[_0x81f1('0x1e')](_0x53be95[_0x81f1('0x33')][_0x81f1('0x1e')]);}_0x4162b5[_0x81f1('0x39')]=qs[_0x81f1('0x3a')](_0x53be95['query']['sort']);_0x4162b5[_0x81f1('0x3b')]=qs[_0x81f1('0x34')](_[_0x81f1('0x3c')](_0x53be95[_0x81f1('0x33')],_0x383d1a[_0x81f1('0x34')]),_0x3c8c74);if(_0x53be95['query']['filter']){_0x4162b5[_0x81f1('0x3b')]=_['merge'](_0x4162b5[_0x81f1('0x3b')],{'$or':_[_0x81f1('0x2e')](_0x3c8c74,function(_0xa51045){if(_0xa51045[_0x81f1('0x31')]!==_0x81f1('0x3d')){var _0x5a6449={};_0x5a6449[_0xa51045[_0x81f1('0x2d')]]={'$like':'%'+_0x53be95['query'][_0x81f1('0x3e')]+'%'};return _0x5a6449;}})});}_0x4162b5=_[_0x81f1('0x3f')]({},_0x4162b5,_0x53be95[_0x81f1('0x40')]);var _0xa29a0c={'where':_0x4162b5['where']};return db[_0x81f1('0x2f')][_0x81f1('0x21')](_0xa29a0c)['then'](function(_0x2a4c46){_0x10d4e5[_0x81f1('0x21')]=_0x2a4c46;if(_0x53be95['query'][_0x81f1('0x41')]){_0x4162b5[_0x81f1('0x42')]=[{'all':!![]}];}return db[_0x81f1('0x2f')][_0x81f1('0x43')](_0x4162b5);})['then'](function(_0x7e9ed5){_0x10d4e5[_0x81f1('0x44')]=_0x7e9ed5;return _0x10d4e5;})[_0x81f1('0x27')](respondWithFilteredResult(_0x4fa093,_0x4162b5))[_0x81f1('0x45')](handleError(_0x4fa093,null));};exports['show']=function(_0x5010d8,_0x254b20){var _0x5c6c5b={'raw':![],'where':{'id':_0x5010d8[_0x81f1('0x46')]['id']}},_0x43c057={};_0x43c057[_0x81f1('0x32')]=_[_0x81f1('0x47')](db[_0x81f1('0x2f')][_0x81f1('0x30')]);_0x43c057[_0x81f1('0x33')]=_['keys'](_0x5010d8[_0x81f1('0x33')]);_0x43c057[_0x81f1('0x34')]=_[_0x81f1('0x48')](_0x43c057[_0x81f1('0x32')],_0x43c057['query']);_0x5c6c5b[_0x81f1('0x35')]=_[_0x81f1('0x48')](_0x43c057[_0x81f1('0x32')],qs[_0x81f1('0x36')](_0x5010d8[_0x81f1('0x33')][_0x81f1('0x36')]));_0x5c6c5b[_0x81f1('0x35')]=_0x5c6c5b[_0x81f1('0x35')]['length']?_0x5c6c5b['attributes']:_0x43c057['model'];if(_0x5010d8[_0x81f1('0x33')][_0x81f1('0x41')]){_0x5c6c5b[_0x81f1('0x42')]=[{'all':!![]}];}_0x5c6c5b=_[_0x81f1('0x3f')]({},_0x5c6c5b,_0x5010d8[_0x81f1('0x40')]);return db['SquareProject'][_0x81f1('0x49')](_0x5c6c5b)['then'](handleEntityNotFound(_0x254b20,null))[_0x81f1('0x27')](respondWithResult(_0x254b20,null))[_0x81f1('0x45')](handleError(_0x254b20,null));};exports['create']=function(_0x3e5025,_0x15c289){return db[_0x81f1('0x2f')][_0x81f1('0x4a')](_0x3e5025[_0x81f1('0x4b')],{})['then'](function(_0x451fc3){var _0x51c9dc=_0x3e5025[_0x81f1('0x4c')][_0x81f1('0x4d')]({'plain':!![]});if(!_0x51c9dc)throw new Error(_0x81f1('0x4e'));if(_0x51c9dc[_0x81f1('0x4f')]===_0x81f1('0x4c')){var _0x37f27f=_0x451fc3[_0x81f1('0x4d')]({'plain':!![]});var _0x1850b9=_0x81f1('0x29');return db[_0x81f1('0x50')][_0x81f1('0x49')]({'where':{'name':_0x1850b9,'userProfileId':_0x51c9dc['userProfileId']},'raw':!![]})['then'](function(_0x43c2c3){if(_0x43c2c3&&_0x43c2c3[_0x81f1('0x51')]===0x0){return db[_0x81f1('0x2a')][_0x81f1('0x4a')]({'name':_0x37f27f[_0x81f1('0x2d')],'resourceId':_0x37f27f['id'],'type':_0x43c2c3['name'],'sectionId':_0x43c2c3['id']},{})[_0x81f1('0x27')](function(){return _0x451fc3;});}else{return _0x451fc3;}})['catch'](function(_0x4eb2ac){logger[_0x81f1('0x2b')](_0x81f1('0x52'),_0x4eb2ac);throw _0x4eb2ac;});}return _0x451fc3;})['then'](respondWithResult(_0x15c289,0xc9))[_0x81f1('0x45')](handleError(_0x15c289,null));};exports[_0x81f1('0x26')]=function(_0x3b472e,_0x48b6d0){if(_0x3b472e[_0x81f1('0x4b')]['id']){delete _0x3b472e['body']['id'];}return db[_0x81f1('0x2f')]['find']({'where':{'id':_0x3b472e['params']['id']}})[_0x81f1('0x27')](handleEntityNotFound(_0x48b6d0,null))['then'](saveUpdates(_0x3b472e[_0x81f1('0x4b')],null))['then'](respondWithResult(_0x48b6d0,null))[_0x81f1('0x45')](handleError(_0x48b6d0,null));};exports['destroy']=function(_0x1136aa,_0x12529a){return db[_0x81f1('0x2f')]['find']({'where':{'id':_0x1136aa[_0x81f1('0x46')]['id']}})[_0x81f1('0x27')](handleEntityNotFound(_0x12529a,null))[_0x81f1('0x27')](removeEntity(_0x12529a,null))['catch'](handleError(_0x12529a,null));};exports[_0x81f1('0x53')]=function(_0x531b1b,_0x195f8d,_0x3b124b){return db[_0x81f1('0x2f')][_0x81f1('0x49')]({'where':{'id':_0x531b1b['params']['id']}})[_0x81f1('0x27')](handleEntityNotFound(_0x195f8d,null))['then'](function(_0x34f4d3){if(_0x34f4d3){return _0x34f4d3[_0x81f1('0x53')](_0x531b1b['body'][_0x81f1('0x54')],_[_0x81f1('0x55')](_0x531b1b[_0x81f1('0x4b')],[_0x81f1('0x54'),'id'])||{});}})[_0x81f1('0x27')](respondWithResult(_0x195f8d,null))['catch'](handleError(_0x195f8d,null));};exports[_0x81f1('0x56')]=function(_0x2b4a4b,_0x8bbbcf,_0xc982b2){return db[_0x81f1('0x2f')]['find']({'where':{'id':_0x2b4a4b[_0x81f1('0x46')]['id']}})[_0x81f1('0x27')](handleEntityNotFound(_0x8bbbcf,null))[_0x81f1('0x27')](function(_0x2d4e51){if(_0x2d4e51){return _0x2d4e51['removeUsers'](_0x2b4a4b[_0x81f1('0x33')][_0x81f1('0x54')])[_0x81f1('0x27')](function(){if(_['isArray'](_0x2b4a4b[_0x81f1('0x33')][_0x81f1('0x54')])){for(var _0x222c32=0x0;_0x222c32<_0x2b4a4b[_0x81f1('0x33')][_0x81f1('0x54')][_0x81f1('0x37')];_0x222c32+=0x1){socket[_0x81f1('0x57')](_0x81f1('0x58'),{'UserId':Number(_0x2b4a4b['query'][_0x81f1('0x54')][_0x222c32]),'SquareProjectId':Number(_0x2b4a4b[_0x81f1('0x46')]['id'])});}}else{socket[_0x81f1('0x57')]('userSquareProject:remove',{'UserId':Number(_0x2b4a4b[_0x81f1('0x33')][_0x81f1('0x54')]),'SquareProjectId':Number(_0x2b4a4b[_0x81f1('0x46')]['id'])});}});}})['then'](respondWithStatusCode(_0x8bbbcf,null))[_0x81f1('0x45')](handleError(_0x8bbbcf,null));};exports[_0x81f1('0x59')]=function(_0x3582ec,_0x3b7516,_0x47676b){var _0x4ab260={};var _0x9b0023={};var _0x23d925;var _0x3385c8;return db[_0x81f1('0x2f')][_0x81f1('0x5a')]({'where':{'id':_0x3582ec['params']['id']}})[_0x81f1('0x27')](handleEntityNotFound(_0x3b7516,null))[_0x81f1('0x27')](function(_0xa3ca2a){if(_0xa3ca2a){_0x23d925=_0xa3ca2a;_0x9b0023[_0x81f1('0x32')]=_['keys'](db[_0x81f1('0x5b')][_0x81f1('0x30')]);_0x9b0023['query']=_[_0x81f1('0x47')](_0x3582ec[_0x81f1('0x33')]);_0x9b0023['filters']=_[_0x81f1('0x48')](_0x9b0023[_0x81f1('0x32')],_0x9b0023['query']);_0x4ab260[_0x81f1('0x35')]=_[_0x81f1('0x48')](_0x9b0023[_0x81f1('0x32')],qs['fields'](_0x3582ec[_0x81f1('0x33')][_0x81f1('0x36')]));_0x4ab260[_0x81f1('0x35')]=_0x4ab260[_0x81f1('0x35')][_0x81f1('0x37')]?_0x4ab260[_0x81f1('0x35')]:_0x9b0023[_0x81f1('0x32')];_0x4ab260[_0x81f1('0x39')]=qs['sort'](_0x3582ec['query'][_0x81f1('0x3a')]);_0x4ab260[_0x81f1('0x3b')]=qs[_0x81f1('0x34')](_['pick'](_0x3582ec[_0x81f1('0x33')],_0x9b0023['filters']));if(_0x3582ec['query']['filter']){_0x4ab260[_0x81f1('0x3b')]=_[_0x81f1('0x3f')](_0x4ab260[_0x81f1('0x3b')],{'$or':_[_0x81f1('0x2e')](_0x4ab260[_0x81f1('0x35')],function(_0x5a27bd){var _0x5309e0={};_0x5309e0[_0x5a27bd]={'$like':'%'+_0x3582ec[_0x81f1('0x33')]['filter']+'%'};return _0x5309e0;})});}_0x4ab260=_[_0x81f1('0x3f')]({},_0x4ab260,_0x3582ec[_0x81f1('0x40')]);return _0x23d925['getUsers'](_0x4ab260);}})[_0x81f1('0x27')](function(_0x384707){if(_0x384707){_0x3385c8=_0x384707[_0x81f1('0x37')];if(!_0x3582ec['query']['hasOwnProperty'](_0x81f1('0x38'))){_0x4ab260[_0x81f1('0x20')]=qs[_0x81f1('0x20')](_0x3582ec[_0x81f1('0x33')]['limit']);_0x4ab260[_0x81f1('0x1e')]=qs['offset'](_0x3582ec[_0x81f1('0x33')][_0x81f1('0x1e')]);}return _0x23d925['getUsers'](_0x4ab260);}})['then'](function(_0x25c91e){if(_0x25c91e){return _0x25c91e?{'count':_0x3385c8,'rows':_0x25c91e}:null;}})[_0x81f1('0x27')](respondWithResult(_0x3b7516,null))[_0x81f1('0x45')](handleError(_0x3b7516,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 161e590..7c40b77 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 _0x2a50=['events','../../mysqldb','save','update','remove','emit','hook','exports'];(function(_0x3b054a,_0x3620f8){var _0x1d2316=function(_0xc833bd){while(--_0xc833bd){_0x3b054a['push'](_0x3b054a['shift']());}};_0x1d2316(++_0x3620f8);}(_0x2a50,0xc8));var _0x02a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a50[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x02a5('0x0'));var SquareProject=require(_0x02a5('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x02a5('0x2'),'afterUpdate':_0x02a5('0x3'),'afterDestroy':_0x02a5('0x4')};function emitEvent(_0x106850){return function(_0x35b12a,_0x6cb3d,_0x3d0941){SquareProjectEvents[_0x02a5('0x5')](_0x106850+':'+_0x35b12a['id'],_0x35b12a);SquareProjectEvents[_0x02a5('0x5')](_0x106850,_0x35b12a);_0x3d0941(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x02a5('0x6')](e,emitEvent(event));}}module[_0x02a5('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x198e=['save','update','remove','emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners'];(function(_0x377d12,_0x4e9fd0){var _0x3b4c41=function(_0x1e706d){while(--_0x1e706d){_0x377d12['push'](_0x377d12['shift']());}};_0x3b4c41(++_0x4e9fd0);}(_0x198e,0x1de));var _0xe198=function(_0x21235e,_0x3b40e3){_0x21235e=_0x21235e-0x0;var _0x479e51=_0x198e[_0x21235e];return _0x479e51;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xe198('0x0'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xe198('0x1')](0x0);var events={'afterCreate':_0xe198('0x2'),'afterUpdate':_0xe198('0x3'),'afterDestroy':_0xe198('0x4')};function emitEvent(_0x371c9f){return function(_0x2d05fb,_0x43616d,_0x40c6fa){SquareProjectEvents[_0xe198('0x5')](_0x371c9f+':'+_0x2d05fb['id'],_0x2d05fb);SquareProjectEvents[_0xe198('0x5')](_0x371c9f,_0x2d05fb);_0x40c6fa(null);};}for(var e in events){if(events[_0xe198('0x6')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xe198('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 079bc67..192df8c 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 _0x9bfc=['request-promise','rimraf','./squareProject.attributes','SquareProject','square_projects','changed','preproduction','savedAt','format','production','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','bluebird'];(function(_0x4d5a49,_0x38d185){var _0x47b712=function(_0x146e79){while(--_0x146e79){_0x4d5a49['push'](_0x4d5a49['shift']());}};_0x47b712(++_0x38d185);}(_0x9bfc,0x173));var _0xc9bf=function(_0x2ff17f,_0xf7c1a1){_0x2ff17f=_0x2ff17f-0x0;var _0xcdcd31=_0x9bfc[_0x2ff17f];return _0xcdcd31;};'use strict';var _=require(_0xc9bf('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc9bf('0x1'));var moment=require(_0xc9bf('0x2'));var BPromise=require(_0xc9bf('0x3'));var rp=require(_0xc9bf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc9bf('0x5'));var config=require('../../config/environment');var attributes=require(_0xc9bf('0x6'));module['exports']=function(_0x3486bc,_0x4e641f){return _0x3486bc['define'](_0xc9bf('0x7'),attributes,{'tableName':_0xc9bf('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x24d48c,_0x2f4c90,_0x3935b7){if(_0x24d48c[_0xc9bf('0x9')](_0xc9bf('0xa'))){_0x24d48c[_0xc9bf('0xb')]=moment()[_0xc9bf('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x24d48c[_0xc9bf('0x9')](_0xc9bf('0xd'))){_0x24d48c['publishedAt']=moment()[_0xc9bf('0xc')](_0xc9bf('0xe'));}_0x3935b7(null,_0x24d48c);}}});}; \ No newline at end of file +var _0xbf35=['rimraf','./squareProject.attributes','define','SquareProject','square_projects','preproduction','savedAt','format','changed','production','publishedAt','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x5a5acc,_0x20b7a7){var _0x2c4e0e=function(_0x5e1010){while(--_0x5e1010){_0x5a5acc['push'](_0x5a5acc['shift']());}};_0x2c4e0e(++_0x20b7a7);}(_0xbf35,0x185));var _0x5bf3=function(_0x2e5915,_0x54ada9){_0x2e5915=_0x2e5915-0x0;var _0x252d64=_0xbf35[_0x2e5915];return _0x252d64;};'use strict';var _=require(_0x5bf3('0x0'));var util=require(_0x5bf3('0x1'));var logger=require(_0x5bf3('0x2'))(_0x5bf3('0x3'));var moment=require(_0x5bf3('0x4'));var BPromise=require(_0x5bf3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5bf3('0x6'));var rimraf=require(_0x5bf3('0x7'));var config=require('../../config/environment');var attributes=require(_0x5bf3('0x8'));module['exports']=function(_0x154f5,_0x228509){return _0x154f5[_0x5bf3('0x9')](_0x5bf3('0xa'),attributes,{'tableName':_0x5bf3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x353438,_0x583cf3,_0x1bf63e){if(_0x353438['changed'](_0x5bf3('0xc'))){_0x353438[_0x5bf3('0xd')]=moment()[_0x5bf3('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x353438[_0x5bf3('0xf')](_0x5bf3('0x10'))){_0x353438[_0x5bf3('0x11')]=moment()[_0x5bf3('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1bf63e(null,_0x353438);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 0c2a129..0ffbaf8 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 _0x38bd=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','request','then','info','SquareProject,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','ShowSquareProject','SquareProject','options','raw','where','attributes','map','include','model','stringify'];(function(_0x3fe1a5,_0x1a7d99){var _0x389d8d=function(_0x13e6f8){while(--_0x13e6f8){_0x3fe1a5['push'](_0x3fe1a5['shift']());}};_0x389d8d(++_0x1a7d99);}(_0x38bd,0xe4));var _0xd38b=function(_0x189057,_0x5969f9){_0x189057=_0x189057-0x0;var _0x2fa38a=_0x38bd[_0x189057];return _0x2fa38a;};'use strict';var _=require(_0xd38b('0x0'));var util=require(_0xd38b('0x1'));var moment=require(_0xd38b('0x2'));var BPromise=require(_0xd38b('0x3'));var rs=require(_0xd38b('0x4'));var fs=require('fs');var Redis=require(_0xd38b('0x5'));var db=require(_0xd38b('0x6'))['db'];var utils=require(_0xd38b('0x7'));var logger=require(_0xd38b('0x8'))(_0xd38b('0x9'));var config=require(_0xd38b('0xa'));var jayson=require(_0xd38b('0xb'));var client=jayson['client'][_0xd38b('0xc')]({'port':0x232a});config[_0xd38b('0xd')]=_[_0xd38b('0xe')](config[_0xd38b('0xd')],{'host':_0xd38b('0xf'),'port':0x18eb});var socket=require(_0xd38b('0x10'))(new Redis(config['redis']));require(_0xd38b('0x11'))['register'](socket);function respondWithRpcPromise(_0x49e95e,_0x3a5bbf,_0x254057){return new BPromise(function(_0x569451,_0x3e42b1){return client[_0xd38b('0x12')](_0x49e95e,_0x254057)[_0xd38b('0x13')](function(_0x58e496){logger[_0xd38b('0x14')](_0xd38b('0x15'),_0x3a5bbf,'request\x20sent');logger[_0xd38b('0x16')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x3a5bbf,_0xd38b('0x17'),JSON['stringify'](_0x58e496));if(_0x58e496[_0xd38b('0x18')]){if(_0x58e496['error'][_0xd38b('0x19')]===0x1f4){logger[_0xd38b('0x18')](_0xd38b('0x15'),_0x3a5bbf,_0x58e496[_0xd38b('0x18')]['message']);return _0x3e42b1(_0x58e496['error'][_0xd38b('0x1a')]);}logger[_0xd38b('0x18')](_0xd38b('0x15'),_0x3a5bbf,_0x58e496[_0xd38b('0x18')][_0xd38b('0x1a')]);return _0x569451(_0x58e496['error'][_0xd38b('0x1a')]);}else{logger[_0xd38b('0x14')](_0xd38b('0x15'),_0x3a5bbf,_0xd38b('0x17'));_0x569451(_0x58e496[_0xd38b('0x1b')][_0xd38b('0x1a')]);}})['catch'](function(_0x33a152){logger[_0xd38b('0x18')](_0xd38b('0x15'),_0x3a5bbf,_0x33a152);_0x3e42b1(_0x33a152);});});}exports[_0xd38b('0x1c')]=function(_0x48696c){var _0x2a64c8=this;return new Promise(function(_0x11d31a,_0x4dac4f){return db[_0xd38b('0x1d')]['find']({'raw':_0x48696c[_0xd38b('0x1e')]?_0x48696c[_0xd38b('0x1e')][_0xd38b('0x1f')]===undefined?!![]:![]:!![],'where':_0x48696c['options']?_0x48696c['options'][_0xd38b('0x20')]||null:null,'attributes':_0x48696c[_0xd38b('0x1e')]?_0x48696c[_0xd38b('0x1e')][_0xd38b('0x21')]||null:null,'include':_0x48696c['options']?_0x48696c[_0xd38b('0x1e')]['include']?_[_0xd38b('0x22')](_0x48696c[_0xd38b('0x1e')][_0xd38b('0x23')],function(_0x3920a0){return{'model':db[_0x3920a0['model']],'as':_0x3920a0['as'],'attributes':_0x3920a0[_0xd38b('0x21')],'include':_0x3920a0[_0xd38b('0x23')]?_[_0xd38b('0x22')](_0x3920a0[_0xd38b('0x23')],function(_0x2d2cba){return{'model':db[_0x2d2cba['model']],'as':_0x2d2cba['as'],'attributes':_0x2d2cba[_0xd38b('0x21')],'include':_0x2d2cba[_0xd38b('0x23')]?_[_0xd38b('0x22')](_0x2d2cba[_0xd38b('0x23')],function(_0x577925){return{'model':db[_0x577925[_0xd38b('0x24')]],'as':_0x577925['as'],'attributes':_0x577925[_0xd38b('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd38b('0x13')](function(_0x241272){logger['info']('ShowSquareProject',_0x48696c);logger[_0xd38b('0x16')](_0xd38b('0x1c'),_0x48696c,JSON[_0xd38b('0x25')](_0x241272));_0x11d31a(_0x241272);})['catch'](function(_0x5b9741){logger['error'](_0xd38b('0x1c'),_0x5b9741[_0xd38b('0x1a')],_0x48696c);_0x4dac4f(_0x2a64c8[_0xd38b('0x18')](0x1f4,_0x5b9741[_0xd38b('0x1a')]));});});}; \ No newline at end of file +var _0x1d03=['ShowSquareProject','SquareProject','find','options','attributes','include','map','model','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','./squareProject.socket','register','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x2c768d,_0x5b3efb){var _0x2e0941=function(_0x3caae9){while(--_0x3caae9){_0x2c768d['push'](_0x2c768d['shift']());}};_0x2e0941(++_0x5b3efb);}(_0x1d03,0x18a));var _0x31d0=function(_0x539e36,_0xe85f1a){_0x539e36=_0x539e36-0x0;var _0x958c58=_0x1d03[_0x539e36];return _0x958c58;};'use strict';var _=require('lodash');var util=require(_0x31d0('0x0'));var moment=require(_0x31d0('0x1'));var BPromise=require(_0x31d0('0x2'));var rs=require(_0x31d0('0x3'));var fs=require('fs');var Redis=require(_0x31d0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x31d0('0x5'));var logger=require('../../config/logger')(_0x31d0('0x6'));var config=require(_0x31d0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x31d0('0x8')][_0x31d0('0x9')]({'port':0x232a});config[_0x31d0('0xa')]=_[_0x31d0('0xb')](config[_0x31d0('0xa')],{'host':_0x31d0('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x31d0('0xa')]));require(_0x31d0('0xd'))[_0x31d0('0xe')](socket);function respondWithRpcPromise(_0x32a15a,_0xba72de,_0x57de5e){return new BPromise(function(_0x5c095d,_0x3048f4){return client['request'](_0x32a15a,_0x57de5e)[_0x31d0('0xf')](function(_0x1e2d34){logger[_0x31d0('0x10')](_0x31d0('0x11'),_0xba72de,_0x31d0('0x12'));logger[_0x31d0('0x13')](_0x31d0('0x14'),_0xba72de,_0x31d0('0x12'),JSON[_0x31d0('0x15')](_0x1e2d34));if(_0x1e2d34['error']){if(_0x1e2d34[_0x31d0('0x16')][_0x31d0('0x17')]===0x1f4){logger[_0x31d0('0x16')](_0x31d0('0x11'),_0xba72de,_0x1e2d34[_0x31d0('0x16')]['message']);return _0x3048f4(_0x1e2d34[_0x31d0('0x16')][_0x31d0('0x18')]);}logger['error'](_0x31d0('0x11'),_0xba72de,_0x1e2d34['error']['message']);return _0x5c095d(_0x1e2d34[_0x31d0('0x16')][_0x31d0('0x18')]);}else{logger[_0x31d0('0x10')]('SquareProject,\x20%s,\x20%s',_0xba72de,_0x31d0('0x12'));_0x5c095d(_0x1e2d34[_0x31d0('0x19')][_0x31d0('0x18')]);}})['catch'](function(_0x23ce01){logger['error'](_0x31d0('0x11'),_0xba72de,_0x23ce01);_0x3048f4(_0x23ce01);});});}exports[_0x31d0('0x1a')]=function(_0x6f87dc){var _0x2a582e=this;return new Promise(function(_0x6a427f,_0x3f7454){return db[_0x31d0('0x1b')][_0x31d0('0x1c')]({'raw':_0x6f87dc[_0x31d0('0x1d')]?_0x6f87dc[_0x31d0('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x6f87dc[_0x31d0('0x1d')]?_0x6f87dc[_0x31d0('0x1d')]['where']||null:null,'attributes':_0x6f87dc[_0x31d0('0x1d')]?_0x6f87dc['options'][_0x31d0('0x1e')]||null:null,'include':_0x6f87dc[_0x31d0('0x1d')]?_0x6f87dc['options'][_0x31d0('0x1f')]?_[_0x31d0('0x20')](_0x6f87dc[_0x31d0('0x1d')][_0x31d0('0x1f')],function(_0x3e9dc0){return{'model':db[_0x3e9dc0[_0x31d0('0x21')]],'as':_0x3e9dc0['as'],'attributes':_0x3e9dc0['attributes'],'include':_0x3e9dc0[_0x31d0('0x1f')]?_[_0x31d0('0x20')](_0x3e9dc0[_0x31d0('0x1f')],function(_0x2cd88f){return{'model':db[_0x2cd88f['model']],'as':_0x2cd88f['as'],'attributes':_0x2cd88f['attributes'],'include':_0x2cd88f[_0x31d0('0x1f')]?_[_0x31d0('0x20')](_0x2cd88f[_0x31d0('0x1f')],function(_0x456ac0){return{'model':db[_0x456ac0[_0x31d0('0x21')]],'as':_0x456ac0['as'],'attributes':_0x456ac0[_0x31d0('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5495cd){logger[_0x31d0('0x10')]('ShowSquareProject',_0x6f87dc);logger['debug'](_0x31d0('0x1a'),_0x6f87dc,JSON['stringify'](_0x5495cd));_0x6a427f(_0x5495cd);})[_0x31d0('0x22')](function(_0x33e1e9){logger[_0x31d0('0x16')](_0x31d0('0x1a'),_0x33e1e9['message'],_0x6f87dc);_0x3f7454(_0x2a582e[_0x31d0('0x16')](0x1f4,_0x33e1e9[_0x31d0('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 86218cf..bcc5a19 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 _0x4a70=['emit','removeListener','register','save','remove'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x4a70,0xe4));var _0x04a7=function(_0x263f4c,_0x438626){_0x263f4c=_0x263f4c-0x0;var _0x3a78d3=_0x4a70[_0x263f4c];return _0x3a78d3;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x04a7('0x0'),_0x04a7('0x1'),'update'];function createListener(_0x37ce28,_0x39e45d){return function(_0xbc7c92){_0x39e45d[_0x04a7('0x2')](_0x37ce28,_0xbc7c92);};}function removeListener(_0x2f8c2e,_0x56de86){return function(){SquareProjectEvents[_0x04a7('0x3')](_0x2f8c2e,_0x56de86);};}exports[_0x04a7('0x4')]=function(_0xa5e3b7){for(var _0x546279=0x0,_0x5c38c1=events['length'];_0x546279<_0x5c38c1;_0x546279++){var _0x5a580f=events[_0x546279];var _0x44aa7e=createListener('squareProject:'+_0x5a580f,_0xa5e3b7);SquareProjectEvents['on'](_0x5a580f,_0x44aa7e);}}; \ No newline at end of file +var _0x3136=['emit','removeListener','register','length','squareProject:','save','remove','update'];(function(_0x189c9e,_0x1c3b55){var _0x3f38ca=function(_0x4c05ec){while(--_0x4c05ec){_0x189c9e['push'](_0x189c9e['shift']());}};_0x3f38ca(++_0x1c3b55);}(_0x3136,0xf5));var _0x6313=function(_0x50917b,_0x56cf1b){_0x50917b=_0x50917b-0x0;var _0x259324=_0x3136[_0x50917b];return _0x259324;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x6313('0x0'),_0x6313('0x1'),_0x6313('0x2')];function createListener(_0x40ea9a,_0x6b853d){return function(_0x2758a9){_0x6b853d[_0x6313('0x3')](_0x40ea9a,_0x2758a9);};}function removeListener(_0x7567ef,_0xcd00a7){return function(){SquareProjectEvents[_0x6313('0x4')](_0x7567ef,_0xcd00a7);};}exports[_0x6313('0x5')]=function(_0x3795ca){for(var _0xea6750=0x0,_0x589fbe=events[_0x6313('0x6')];_0xea6750<_0x589fbe;_0xea6750++){var _0x547e35=events[_0xea6750];var _0x3a4166=createListener(_0x6313('0x7')+_0x547e35,_0x3795ca);SquareProjectEvents['on'](_0x547e35,_0x3a4166);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 1a7e76d..47d0d46 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 _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(_0x342db9,_0x50ea26){var _0x2b4d61=function(_0x3688a9){while(--_0x3688a9){_0x342db9['push'](_0x342db9['shift']());}};_0x2b4d61(++_0x50ea26);}(_0x5fc3,0xa8));var _0x35fc=function(_0x11a55c,_0x4eced9){_0x11a55c=_0x11a55c-0x0;var _0x26c390=_0x5fc3[_0x11a55c];return _0x26c390;};'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 +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(_0x213143,_0x2e370c){var _0x13aa33=function(_0x12404f){while(--_0x12404f){_0x213143['push'](_0x213143['shift']());}};_0x13aa33(++_0x2e370c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x58a4fe,_0x11d439){_0x58a4fe=_0x58a4fe-0x0;var _0x697de2=_0x5fc3[_0x58a4fe];return _0x697de2;};'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 2775166..1f9111e 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 _0xeda8=['substring','sequelize','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xeda8,0x104));var _0x8eda=function(_0x4dbe6c,_0x395bb2){_0x4dbe6c=_0x4dbe6c-0x0;var _0x46c68f=_0xeda8[_0x4dbe6c];return _0x46c68f;};'use strict';var Sequelize=require(_0x8eda('0x0'));module[_0x8eda('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x8eda('0x2')]},'calleridname':{'type':Sequelize[_0x8eda('0x2')]},'context':{'type':Sequelize[_0x8eda('0x2')]},'extension':{'type':Sequelize[_0x8eda('0x2')]},'priority':{'type':Sequelize[_0x8eda('0x2')]},'accountcode':{'type':Sequelize[_0x8eda('0x2')]},'dnid':{'type':Sequelize[_0x8eda('0x2')]},'projectName':{'type':Sequelize[_0x8eda('0x2')]},'saveName':{'type':Sequelize[_0x8eda('0x2')]},'filename':{'type':Sequelize[_0x8eda('0x2')]},'savePath':{'type':Sequelize[_0x8eda('0x2')]},'format':{'type':Sequelize[_0x8eda('0x3')],'get':function(){var _0x4e2ebb='';var _0x28b721=this[_0x8eda('0x4')](_0x8eda('0x5'));if(_0x28b721){_0x4e2ebb=_0x28b721[_0x8eda('0x6')](_0x28b721['lastIndexOf']('.'));}return _0x4e2ebb;}}}; \ No newline at end of file +var _0x31f0=['getDataValue','savePath','substring','sequelize','STRING','VIRTUAL'];(function(_0x5f3e11,_0x1e5b9d){var _0x3f6149=function(_0x34ecad){while(--_0x34ecad){_0x5f3e11['push'](_0x5f3e11['shift']());}};_0x3f6149(++_0x1e5b9d);}(_0x31f0,0xb7));var _0x031f=function(_0x1d9368,_0x546b95){_0x1d9368=_0x1d9368-0x0;var _0x3b2555=_0x31f0[_0x1d9368];return _0x3b2555;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x031f('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x031f('0x1')]},'context':{'type':Sequelize[_0x031f('0x1')]},'extension':{'type':Sequelize[_0x031f('0x1')]},'priority':{'type':Sequelize[_0x031f('0x1')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x031f('0x1')]},'projectName':{'type':Sequelize[_0x031f('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x031f('0x2')],'get':function(){var _0x487e65='';var _0x365f59=this[_0x031f('0x3')](_0x031f('0x4'));if(_0x365f59){_0x487e65=_0x365f59[_0x031f('0x5')](_0x365f59['lastIndexOf']('.'));}return _0x487e65;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 8478e98..277377c 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 _0x168e=['download','extname','unlink','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','SquareRecording','includeAll','include','catch','params','body','update','find','../../components/encryptor','uniqueid','savePath','filename','format','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found'];(function(_0x24679e,_0x22d9d7){var _0x291f21=function(_0x329529){while(--_0x329529){_0x24679e['push'](_0x24679e['shift']());}};_0x291f21(++_0x22d9d7);}(_0x168e,0x167));var _0xe168=function(_0x25f176,_0x1eda24){_0x25f176=_0x25f176-0x0;var _0x35d725=_0x168e[_0x25f176];return _0x35d725;};'use strict';var emlformat=require(_0xe168('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe168('0x1'));var moment=require(_0xe168('0x2'));var BPromise=require(_0xe168('0x3'));var Mustache=require('mustache');var util=require(_0xe168('0x4'));var path=require(_0xe168('0x5'));var sox=require(_0xe168('0x6'));var csv=require(_0xe168('0x7'));var ejs=require(_0xe168('0x8'));var fs=require('fs');var fs_extra=require(_0xe168('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe168('0xa'));var jsforce=require(_0xe168('0xb'));var deskjs=require(_0xe168('0xc'));var toCsv=require(_0xe168('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe168('0xd'));var as=require(_0xe168('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe168('0xf'))(_0xe168('0x10'));var utils=require(_0xe168('0x11'));var config=require(_0xe168('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xe168('0x13'))['db'];function respondWithStatusCode(_0x56127b,_0x342ace){_0x342ace=_0x342ace||0xcc;return function(_0x133f9e){if(_0x133f9e){return _0x56127b[_0xe168('0x14')](_0x342ace);}return _0x56127b[_0xe168('0x15')](_0x342ace)[_0xe168('0x16')]();};}function respondWithResult(_0x4d5ccd,_0x2719dd){_0x2719dd=_0x2719dd||0xc8;return function(_0x2598b9){if(_0x2598b9){return _0x4d5ccd[_0xe168('0x15')](_0x2719dd)[_0xe168('0x17')](_0x2598b9);}};}function respondWithFilteredResult(_0x53808f,_0x4fcaea){return function(_0x470a46){if(_0x470a46){var _0x40832f=typeof _0x4fcaea[_0xe168('0x18')]===_0xe168('0x19')&&typeof _0x4fcaea['limit']==='undefined';var _0x1373b7=_0x470a46[_0xe168('0x1a')];var _0x2de445=_0x40832f?0x0:_0x4fcaea[_0xe168('0x18')];var _0x16d985=_0x40832f?_0x470a46['count']:_0x4fcaea[_0xe168('0x18')]+_0x4fcaea[_0xe168('0x1b')];var _0x58e1da;if(_0x16d985>=_0x1373b7){_0x16d985=_0x1373b7;_0x58e1da=0xc8;}else{_0x58e1da=0xce;}_0x53808f[_0xe168('0x15')](_0x58e1da);return _0x53808f['set'](_0xe168('0x1c'),_0x2de445+'-'+_0x16d985+'/'+_0x1373b7)[_0xe168('0x17')](_0x470a46);}return null;};}function patchUpdates(_0x37856f){return function(_0x3d75af){try{jsonpatch[_0xe168('0x1d')](_0x3d75af,_0x37856f,!![]);}catch(_0x265e92){return BPromise['reject'](_0x265e92);}return _0x3d75af[_0xe168('0x1e')]();};}function saveUpdates(_0x1dafa0,_0x4d75b7){return function(_0x271690){if(_0x271690){return _0x271690['update'](_0x1dafa0)[_0xe168('0x1f')](function(_0x1d0bf2){return _0x1d0bf2;});}return null;};}function removeEntity(_0x179a12,_0x19bdb2){return function(_0x2bfb1b){if(_0x2bfb1b){return _0x2bfb1b[_0xe168('0x20')]()[_0xe168('0x1f')](function(){_0x179a12[_0xe168('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5112e2,_0x1f8407){return function(_0x561bcd){if(!_0x561bcd){_0x5112e2[_0xe168('0x14')](0x194);}return _0x561bcd;};}function handleError(_0x1eb265,_0x4a20d1){_0x4a20d1=_0x4a20d1||0x1f4;return function(_0x29c987){logger[_0xe168('0x21')](_0x29c987['stack']);if(_0x29c987[_0xe168('0x22')]){delete _0x29c987[_0xe168('0x22')];}_0x1eb265['status'](_0x4a20d1)[_0xe168('0x23')](_0x29c987);};}exports['index']=function(_0x316fa4,_0x5e02e6){var _0x163143={},_0x55a433={},_0x19fee2={'count':0x0,'rows':[]};var _0x107fc5=_[_0xe168('0x24')](db['SquareRecording'][_0xe168('0x25')],function(_0xcbd6b3){return{'name':_0xcbd6b3[_0xe168('0x26')],'type':_0xcbd6b3[_0xe168('0x27')][_0xe168('0x28')]};});_0x55a433[_0xe168('0x29')]=_['map'](_0x107fc5,_0xe168('0x22'));_0x55a433[_0xe168('0x2a')]=_[_0xe168('0x2b')](_0x316fa4[_0xe168('0x2a')]);_0x55a433['filters']=_[_0xe168('0x2c')](_0x55a433[_0xe168('0x29')],_0x55a433['query']);_0x163143[_0xe168('0x2d')]=_[_0xe168('0x2c')](_0x55a433[_0xe168('0x29')],qs[_0xe168('0x2e')](_0x316fa4[_0xe168('0x2a')][_0xe168('0x2e')]));_0x163143[_0xe168('0x2d')]=_0x163143['attributes']['length']?_0x163143[_0xe168('0x2d')]:_0x55a433['model'];if(!_0x316fa4[_0xe168('0x2a')]['hasOwnProperty'](_0xe168('0x2f'))){_0x163143[_0xe168('0x1b')]=qs[_0xe168('0x1b')](_0x316fa4[_0xe168('0x2a')][_0xe168('0x1b')]);_0x163143[_0xe168('0x18')]=qs[_0xe168('0x18')](_0x316fa4['query'][_0xe168('0x18')]);}_0x163143['order']=qs[_0xe168('0x30')](_0x316fa4[_0xe168('0x2a')][_0xe168('0x30')]);_0x163143[_0xe168('0x31')]=qs['filters'](_[_0xe168('0x32')](_0x316fa4[_0xe168('0x2a')],_0x55a433[_0xe168('0x33')]),_0x107fc5);if(_0x316fa4['query'][_0xe168('0x34')]){_0x163143['where']=_[_0xe168('0x35')](_0x163143['where'],{'$or':_[_0xe168('0x24')](_0x107fc5,function(_0x497455){if(_0x497455['type']!==_0xe168('0x36')){var _0x3b294f={};_0x3b294f[_0x497455[_0xe168('0x22')]]={'$like':'%'+_0x316fa4['query']['filter']+'%'};return _0x3b294f;}})});}_0x163143=_[_0xe168('0x35')]({},_0x163143,_0x316fa4[_0xe168('0x37')]);var _0x3f7679={'where':_0x163143[_0xe168('0x31')]};return db[_0xe168('0x38')]['count'](_0x3f7679)[_0xe168('0x1f')](function(_0x2db919){_0x19fee2[_0xe168('0x1a')]=_0x2db919;if(_0x316fa4[_0xe168('0x2a')][_0xe168('0x39')]){_0x163143[_0xe168('0x3a')]=[{'all':!![]}];}return db[_0xe168('0x38')]['findAll'](_0x163143);})['then'](function(_0x59524e){_0x19fee2['rows']=_0x59524e;return _0x19fee2;})[_0xe168('0x1f')](respondWithFilteredResult(_0x5e02e6,_0x163143))[_0xe168('0x3b')](handleError(_0x5e02e6,null));};exports['show']=function(_0x309f30,_0x59f48d){var _0x4067f3={'raw':!![],'where':{'id':_0x309f30[_0xe168('0x3c')]['id']}},_0x166ace={};_0x166ace['model']=_[_0xe168('0x2b')](db[_0xe168('0x38')][_0xe168('0x25')]);_0x166ace[_0xe168('0x2a')]=_[_0xe168('0x2b')](_0x309f30[_0xe168('0x2a')]);_0x166ace['filters']=_[_0xe168('0x2c')](_0x166ace[_0xe168('0x29')],_0x166ace['query']);_0x4067f3['attributes']=_[_0xe168('0x2c')](_0x166ace[_0xe168('0x29')],qs[_0xe168('0x2e')](_0x309f30[_0xe168('0x2a')]['fields']));_0x4067f3['attributes']=_0x4067f3[_0xe168('0x2d')]['length']?_0x4067f3[_0xe168('0x2d')]:_0x166ace['model'];if(_0x309f30[_0xe168('0x2a')][_0xe168('0x39')]){_0x4067f3[_0xe168('0x3a')]=[{'all':!![]}];}_0x4067f3=_[_0xe168('0x35')]({},_0x4067f3,_0x309f30[_0xe168('0x37')]);return db[_0xe168('0x38')]['find'](_0x4067f3)[_0xe168('0x1f')](handleEntityNotFound(_0x59f48d,null))['then'](respondWithResult(_0x59f48d,null))[_0xe168('0x3b')](handleError(_0x59f48d,null));};exports['create']=function(_0x3420e6,_0x46cd6a){return db[_0xe168('0x38')]['create'](_0x3420e6[_0xe168('0x3d')],{})['then'](respondWithResult(_0x46cd6a,0xc9))[_0xe168('0x3b')](handleError(_0x46cd6a,null));};exports[_0xe168('0x3e')]=function(_0x32e5fa,_0x5e2e9e){if(_0x32e5fa[_0xe168('0x3d')]['id']){delete _0x32e5fa[_0xe168('0x3d')]['id'];}return db[_0xe168('0x38')][_0xe168('0x3f')]({'where':{'id':_0x32e5fa[_0xe168('0x3c')]['id']}})[_0xe168('0x1f')](handleEntityNotFound(_0x5e2e9e,null))[_0xe168('0x1f')](saveUpdates(_0x32e5fa['body'],null))[_0xe168('0x1f')](respondWithResult(_0x5e2e9e,null))[_0xe168('0x3b')](handleError(_0x5e2e9e,null));};exports['download']=function(_0x5e8ae1,_0x4b9ce9,_0x56f827){var _0x417c03=require(_0xe168('0x40'));var _0xecac7=![];var _0xce8128={};if(_0x5e8ae1['query'][_0xe168('0x27')]&&_0x5e8ae1[_0xe168('0x2a')][_0xe168('0x27')]==='uniqueid'){_0xce8128[_0xe168('0x41')]=_0x5e8ae1['params']['id'];}else{_0xce8128['id']=_0x5e8ae1[_0xe168('0x3c')]['id'];}return db['SquareRecording']['find']({'where':_0xce8128,'attributes':['id',_0xe168('0x42'),_0xe168('0x43')],'raw':!![]})[_0xe168('0x1f')](handleEntityNotFound(_0x4b9ce9,null))['then'](function(_0x3eb0d6){if(_0x3eb0d6){var _0x4b8c5d=_0x3eb0d6[_0xe168('0x42')];var _0x2c1020=util[_0xe168('0x44')]('%s.cypher',_0x4b8c5d);if(fs[_0xe168('0x45')](_0x2c1020)){_0xecac7=!![];return _0x417c03[_0xe168('0x46')](_0x2c1020,_0x4b8c5d,config[_0xe168('0x47')][_0xe168('0x48')])[_0xe168('0x1f')](function(){return _0x3eb0d6;});}return _0x3eb0d6;}})[_0xe168('0x1f')](function(_0x3cf037){if(_0x3cf037){var _0x19785b=_0x3cf037[_0xe168('0x42')];if(!fs[_0xe168('0x45')](_0x19785b)){throw new db[(_0xe168('0x49'))][(_0xe168('0x4a'))](_0xe168('0x4b'));}if(_0x3cf037[_0xe168('0x43')]){return _0x4b9ce9[_0xe168('0x4c')](_0x19785b,_0x3cf037[_0xe168('0x43')]+path[_0xe168('0x4d')](_0x19785b),function(){if(_0xecac7){fs['unlink'](_0x19785b);}});}else{return _0x4b9ce9[_0xe168('0x4c')](_0x19785b,function(_0x24251e){if(_0xecac7){fs[_0xe168('0x4e')](_0x19785b);}});}}})['catch'](function(_0x543883){if(_0x543883['message']==='SquareRecording\x20not\x20found'){_0x4b9ce9[_0xe168('0x15')](0x194)[_0xe168('0x23')](_0xe168('0x4f'));}else{return handleError(_0x4b9ce9,null);}});};exports[_0xe168('0x20')]=function(_0xb9313a,_0x345128){return db['SquareRecording'][_0xe168('0x3f')]({'where':{'id':_0xb9313a['params']['id']}})[_0xe168('0x1f')](function(_0x27970a){if(_[_0xe168('0x50')](_0x27970a)){throw new ReferenceError(_0xe168('0x51'));}return _0x27970a;})[_0xe168('0x1f')](function(_0x4cb29e){var _0xcf8050=_0x4cb29e[_0xe168('0x42')];logger[_0xe168('0x52')]('cancellazione\x20fisica\x20documento\x20%s',_0xcf8050);if(!_[_0xe168('0x50')](_0x4cb29e[_0xe168('0x42')])&&fs[_0xe168('0x45')](_0xcf8050)){logger[_0xe168('0x52')](_0xe168('0x53')+_0xcf8050+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe168('0x54')](_0xcf8050);}_0xcf8050=_0xcf8050+_0xe168('0x55');if(!_['isNil'](_0x4cb29e[_0xe168('0x42')])&&fs[_0xe168('0x45')](_0xcf8050)){logger[_0xe168('0x52')](_0xe168('0x53')+_0xcf8050+_0xe168('0x56'));fs[_0xe168('0x54')](_0xcf8050);}return _0x4cb29e;})[_0xe168('0x1f')](function(_0x33576e){if(!_0x33576e)throw new InternalError();return _0x33576e[_0xe168('0x20')]();})[_0xe168('0x1f')](function(){_0x345128[_0xe168('0x15')](0xcc)[_0xe168('0x16')]();})['catch'](handleError(_0x345128,null));}; \ No newline at end of file +var _0x844b=['SquareRecording','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','download','../../components/encryptor','uniqueid','filename','savePath','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','sendStatus','error','stack','name','send','index','map'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x844b,0x1a8));var _0xb844=function(_0x3c858f,_0x235201){_0x3c858f=_0x3c858f-0x0;var _0x198090=_0x844b[_0x3c858f];return _0x198090;};'use strict';var emlformat=require(_0xb844('0x0'));var rimraf=require(_0xb844('0x1'));var zipdir=require(_0xb844('0x2'));var jsonpatch=require(_0xb844('0x3'));var rp=require(_0xb844('0x4'));var moment=require('moment');var BPromise=require(_0xb844('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xb844('0x6'));var csv=require(_0xb844('0x7'));var ejs=require(_0xb844('0x8'));var fs=require('fs');var fs_extra=require(_0xb844('0x9'));var _=require(_0xb844('0xa'));var squel=require(_0xb844('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb844('0xc'));var toCsv=require(_0xb844('0x7'));var querystring=require('querystring');var Papa=require(_0xb844('0xd'));var Redis=require('ioredis');var authService=require(_0xb844('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xb844('0xf'));var hardwareService=require(_0xb844('0x10'));var logger=require(_0xb844('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xb844('0x12'));var licenseUtil=require(_0xb844('0x13'));var db=require(_0xb844('0x14'))['db'];function respondWithStatusCode(_0x64a4b0,_0x35fead){_0x35fead=_0x35fead||0xcc;return function(_0x26afb5){if(_0x26afb5){return _0x64a4b0['sendStatus'](_0x35fead);}return _0x64a4b0[_0xb844('0x15')](_0x35fead)[_0xb844('0x16')]();};}function respondWithResult(_0x589254,_0x5d5663){_0x5d5663=_0x5d5663||0xc8;return function(_0x102f3b){if(_0x102f3b){return _0x589254[_0xb844('0x15')](_0x5d5663)[_0xb844('0x17')](_0x102f3b);}};}function respondWithFilteredResult(_0x8641bb,_0x39f16d){return function(_0x2cfde2){if(_0x2cfde2){var _0x153cef=typeof _0x39f16d[_0xb844('0x18')]===_0xb844('0x19')&&typeof _0x39f16d[_0xb844('0x1a')]===_0xb844('0x19');var _0x256a9a=_0x2cfde2['count'];var _0x200410=_0x153cef?0x0:_0x39f16d['offset'];var _0x10f6f6=_0x153cef?_0x2cfde2[_0xb844('0x1b')]:_0x39f16d['offset']+_0x39f16d[_0xb844('0x1a')];var _0x5b297e;if(_0x10f6f6>=_0x256a9a){_0x10f6f6=_0x256a9a;_0x5b297e=0xc8;}else{_0x5b297e=0xce;}_0x8641bb['status'](_0x5b297e);return _0x8641bb[_0xb844('0x1c')](_0xb844('0x1d'),_0x200410+'-'+_0x10f6f6+'/'+_0x256a9a)[_0xb844('0x17')](_0x2cfde2);}return null;};}function patchUpdates(_0x125080){return function(_0x444c1b){try{jsonpatch[_0xb844('0x1e')](_0x444c1b,_0x125080,!![]);}catch(_0xffbee4){return BPromise['reject'](_0xffbee4);}return _0x444c1b['save']();};}function saveUpdates(_0x83c74d,_0x61206a){return function(_0x27c742){if(_0x27c742){return _0x27c742[_0xb844('0x1f')](_0x83c74d)[_0xb844('0x20')](function(_0x4d0028){return _0x4d0028;});}return null;};}function removeEntity(_0x4a6dd0,_0xff900e){return function(_0x5e6b8d){if(_0x5e6b8d){return _0x5e6b8d[_0xb844('0x21')]()['then'](function(){_0x4a6dd0[_0xb844('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3407f2,_0x4ac0fb){return function(_0x2d2372){if(!_0x2d2372){_0x3407f2[_0xb844('0x22')](0x194);}return _0x2d2372;};}function handleError(_0x43eecb,_0x199c13){_0x199c13=_0x199c13||0x1f4;return function(_0x195ac8){logger[_0xb844('0x23')](_0x195ac8[_0xb844('0x24')]);if(_0x195ac8[_0xb844('0x25')]){delete _0x195ac8[_0xb844('0x25')];}_0x43eecb['status'](_0x199c13)[_0xb844('0x26')](_0x195ac8);};}exports[_0xb844('0x27')]=function(_0x2f2e13,_0x16827a){var _0xf7ad56={},_0x2ec7c1={},_0x565a98={'count':0x0,'rows':[]};var _0x16cbc8=_[_0xb844('0x28')](db[_0xb844('0x29')][_0xb844('0x2a')],function(_0xd494c8){return{'name':_0xd494c8[_0xb844('0x2b')],'type':_0xd494c8['type'][_0xb844('0x2c')]};});_0x2ec7c1['model']=_['map'](_0x16cbc8,_0xb844('0x25'));_0x2ec7c1[_0xb844('0x2d')]=_[_0xb844('0x2e')](_0x2f2e13[_0xb844('0x2d')]);_0x2ec7c1[_0xb844('0x2f')]=_[_0xb844('0x30')](_0x2ec7c1[_0xb844('0x31')],_0x2ec7c1[_0xb844('0x2d')]);_0xf7ad56[_0xb844('0x32')]=_[_0xb844('0x30')](_0x2ec7c1['model'],qs['fields'](_0x2f2e13[_0xb844('0x2d')][_0xb844('0x33')]));_0xf7ad56[_0xb844('0x32')]=_0xf7ad56[_0xb844('0x32')]['length']?_0xf7ad56[_0xb844('0x32')]:_0x2ec7c1[_0xb844('0x31')];if(!_0x2f2e13['query'][_0xb844('0x34')](_0xb844('0x35'))){_0xf7ad56[_0xb844('0x1a')]=qs[_0xb844('0x1a')](_0x2f2e13[_0xb844('0x2d')][_0xb844('0x1a')]);_0xf7ad56[_0xb844('0x18')]=qs['offset'](_0x2f2e13[_0xb844('0x2d')][_0xb844('0x18')]);}_0xf7ad56['order']=qs[_0xb844('0x36')](_0x2f2e13[_0xb844('0x2d')][_0xb844('0x36')]);_0xf7ad56[_0xb844('0x37')]=qs['filters'](_['pick'](_0x2f2e13[_0xb844('0x2d')],_0x2ec7c1[_0xb844('0x2f')]),_0x16cbc8);if(_0x2f2e13['query'][_0xb844('0x38')]){_0xf7ad56[_0xb844('0x37')]=_[_0xb844('0x39')](_0xf7ad56[_0xb844('0x37')],{'$or':_['map'](_0x16cbc8,function(_0x5470a9){if(_0x5470a9[_0xb844('0x3a')]!==_0xb844('0x3b')){var _0x4ba072={};_0x4ba072[_0x5470a9[_0xb844('0x25')]]={'$like':'%'+_0x2f2e13[_0xb844('0x2d')][_0xb844('0x38')]+'%'};return _0x4ba072;}})});}_0xf7ad56=_['merge']({},_0xf7ad56,_0x2f2e13[_0xb844('0x3c')]);var _0x46c2d9={'where':_0xf7ad56[_0xb844('0x37')]};return db[_0xb844('0x29')][_0xb844('0x1b')](_0x46c2d9)[_0xb844('0x20')](function(_0xbbf335){_0x565a98[_0xb844('0x1b')]=_0xbbf335;if(_0x2f2e13[_0xb844('0x2d')][_0xb844('0x3d')]){_0xf7ad56[_0xb844('0x3e')]=[{'all':!![]}];}return db[_0xb844('0x29')][_0xb844('0x3f')](_0xf7ad56);})[_0xb844('0x20')](function(_0x4693b2){_0x565a98[_0xb844('0x40')]=_0x4693b2;return _0x565a98;})[_0xb844('0x20')](respondWithFilteredResult(_0x16827a,_0xf7ad56))[_0xb844('0x41')](handleError(_0x16827a,null));};exports[_0xb844('0x42')]=function(_0x1b3e99,_0x52bd72){var _0x2f8956={'raw':!![],'where':{'id':_0x1b3e99['params']['id']}},_0x33e8dc={};_0x33e8dc[_0xb844('0x31')]=_['keys'](db[_0xb844('0x29')]['rawAttributes']);_0x33e8dc['query']=_[_0xb844('0x2e')](_0x1b3e99['query']);_0x33e8dc[_0xb844('0x2f')]=_[_0xb844('0x30')](_0x33e8dc[_0xb844('0x31')],_0x33e8dc['query']);_0x2f8956[_0xb844('0x32')]=_['intersection'](_0x33e8dc[_0xb844('0x31')],qs[_0xb844('0x33')](_0x1b3e99[_0xb844('0x2d')][_0xb844('0x33')]));_0x2f8956[_0xb844('0x32')]=_0x2f8956[_0xb844('0x32')][_0xb844('0x43')]?_0x2f8956[_0xb844('0x32')]:_0x33e8dc[_0xb844('0x31')];if(_0x1b3e99['query'][_0xb844('0x3d')]){_0x2f8956[_0xb844('0x3e')]=[{'all':!![]}];}_0x2f8956=_[_0xb844('0x39')]({},_0x2f8956,_0x1b3e99[_0xb844('0x3c')]);return db[_0xb844('0x29')][_0xb844('0x44')](_0x2f8956)[_0xb844('0x20')](handleEntityNotFound(_0x52bd72,null))[_0xb844('0x20')](respondWithResult(_0x52bd72,null))['catch'](handleError(_0x52bd72,null));};exports[_0xb844('0x45')]=function(_0x4cafaa,_0x17761d){return db[_0xb844('0x29')][_0xb844('0x45')](_0x4cafaa[_0xb844('0x46')],{})['then'](respondWithResult(_0x17761d,0xc9))['catch'](handleError(_0x17761d,null));};exports['update']=function(_0x4774c0,_0xc6b523){if(_0x4774c0[_0xb844('0x46')]['id']){delete _0x4774c0[_0xb844('0x46')]['id'];}return db[_0xb844('0x29')][_0xb844('0x44')]({'where':{'id':_0x4774c0[_0xb844('0x47')]['id']}})[_0xb844('0x20')](handleEntityNotFound(_0xc6b523,null))[_0xb844('0x20')](saveUpdates(_0x4774c0[_0xb844('0x46')],null))[_0xb844('0x20')](respondWithResult(_0xc6b523,null))[_0xb844('0x41')](handleError(_0xc6b523,null));};exports[_0xb844('0x48')]=function(_0x38afc1,_0x4bfd69,_0x30f9db){var _0x5efe2a=require(_0xb844('0x49'));var _0x25d941=![];var _0x575423={};if(_0x38afc1['query'][_0xb844('0x3a')]&&_0x38afc1[_0xb844('0x2d')][_0xb844('0x3a')]===_0xb844('0x4a')){_0x575423[_0xb844('0x4a')]=_0x38afc1[_0xb844('0x47')]['id'];}else{_0x575423['id']=_0x38afc1[_0xb844('0x47')]['id'];}return db[_0xb844('0x29')][_0xb844('0x44')]({'where':_0x575423,'attributes':['id','savePath',_0xb844('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x4bfd69,null))[_0xb844('0x20')](function(_0x4ad9f8){if(_0x4ad9f8){var _0x45f28c=_0x4ad9f8[_0xb844('0x4c')];var _0x4d5dd5=util['format']('%s.cypher',_0x45f28c);if(fs['existsSync'](_0x4d5dd5)){_0x25d941=!![];return _0x5efe2a[_0xb844('0x4d')](_0x4d5dd5,_0x45f28c,config[_0xb844('0x4e')][_0xb844('0x4f')])[_0xb844('0x20')](function(){return _0x4ad9f8;});}return _0x4ad9f8;}})[_0xb844('0x20')](function(_0x2549bd){if(_0x2549bd){var _0x21683b=_0x2549bd[_0xb844('0x4c')];if(!fs[_0xb844('0x50')](_0x21683b)){throw new db[(_0xb844('0x51'))][(_0xb844('0x52'))](_0xb844('0x53'));}if(_0x2549bd['filename']){return _0x4bfd69[_0xb844('0x48')](_0x21683b,_0x2549bd['filename']+path[_0xb844('0x54')](_0x21683b),function(){if(_0x25d941){fs['unlink'](_0x21683b);}});}else{return _0x4bfd69[_0xb844('0x48')](_0x21683b,function(_0x30d237){if(_0x25d941){fs[_0xb844('0x55')](_0x21683b);}});}}})[_0xb844('0x41')](function(_0x11b204){if(_0x11b204[_0xb844('0x56')]===_0xb844('0x53')){_0x4bfd69[_0xb844('0x15')](0x194)[_0xb844('0x26')]('Not\x20found');}else{return handleError(_0x4bfd69,null);}});};exports[_0xb844('0x21')]=function(_0x20afbf,_0x55aa1b){return db['SquareRecording'][_0xb844('0x44')]({'where':{'id':_0x20afbf[_0xb844('0x47')]['id']}})['then'](function(_0x2f0b91){if(_[_0xb844('0x57')](_0x2f0b91)){throw new ReferenceError(_0xb844('0x58'));}return _0x2f0b91;})[_0xb844('0x20')](function(_0x2b720e){var _0x52e331=_0x2b720e['savePath'];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x52e331);if(!_[_0xb844('0x57')](_0x2b720e['savePath'])&&fs[_0xb844('0x50')](_0x52e331)){logger[_0xb844('0x59')](_0xb844('0x5a')+_0x52e331+_0xb844('0x5b'));fs['unlinkSync'](_0x52e331);}_0x52e331=_0x52e331+_0xb844('0x5c');if(!_['isNil'](_0x2b720e['savePath'])&&fs[_0xb844('0x50')](_0x52e331)){logger[_0xb844('0x59')]('File:\x20\x22'+_0x52e331+_0xb844('0x5b'));fs['unlinkSync'](_0x52e331);}return _0x2b720e;})[_0xb844('0x20')](function(_0xc78b7c){if(!_0xc78b7c)throw new InternalError();return _0xc78b7c[_0xb844('0x21')]();})['then'](function(){_0x55aa1b[_0xb844('0x15')](0xcc)[_0xb844('0x16')]();})[_0xb844('0x41')](handleError(_0x55aa1b,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 76f3eaf..cd67b85 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 _0xa5aa=['bluebird','request-promise','path','rimraf','./squareRecording.attributes','exports','SquareRecording','square_recordings','lodash','util','api','moment'];(function(_0xef71b7,_0x300992){var _0x3e853d=function(_0x37126f){while(--_0x37126f){_0xef71b7['push'](_0xef71b7['shift']());}};_0x3e853d(++_0x300992);}(_0xa5aa,0x1ac));var _0xaa5a=function(_0x155cee,_0x42f903){_0x155cee=_0x155cee-0x0;var _0x473a4b=_0xa5aa[_0x155cee];return _0x473a4b;};'use strict';var _=require(_0xaa5a('0x0'));var util=require(_0xaa5a('0x1'));var logger=require('../../config/logger')(_0xaa5a('0x2'));var moment=require(_0xaa5a('0x3'));var BPromise=require(_0xaa5a('0x4'));var rp=require(_0xaa5a('0x5'));var fs=require('fs');var path=require(_0xaa5a('0x6'));var rimraf=require(_0xaa5a('0x7'));var config=require('../../config/environment');var attributes=require(_0xaa5a('0x8'));module[_0xaa5a('0x9')]=function(_0x46c8cc,_0x561d19){return _0x46c8cc['define'](_0xaa5a('0xa'),attributes,{'tableName':_0xaa5a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc36=['square_recordings','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','SquareRecording'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc36,0x169));var _0x6bc3=function(_0x5e7cd5,_0x2afb60){_0x5e7cd5=_0x5e7cd5-0x0;var _0x364117=_0xbc36[_0x5e7cd5];return _0x364117;};'use strict';var _=require(_0x6bc3('0x0'));var util=require('util');var logger=require(_0x6bc3('0x1'))(_0x6bc3('0x2'));var moment=require(_0x6bc3('0x3'));var BPromise=require(_0x6bc3('0x4'));var rp=require(_0x6bc3('0x5'));var fs=require('fs');var path=require(_0x6bc3('0x6'));var rimraf=require(_0x6bc3('0x7'));var config=require(_0x6bc3('0x8'));var attributes=require(_0x6bc3('0x9'));module['exports']=function(_0x1c47e8,_0x4715c8){return _0x1c47e8['define'](_0x6bc3('0xa'),attributes,{'tableName':_0x6bc3('0xb'),'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 a99332d..116b925 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 _0x16fd=['result','CreateSquareRecording','SquareRecording','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','then','info','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message'];(function(_0x2df4d7,_0x57da82){var _0x40787a=function(_0x5e8a31){while(--_0x5e8a31){_0x2df4d7['push'](_0x2df4d7['shift']());}};_0x40787a(++_0x57da82);}(_0x16fd,0x1b5));var _0xd16f=function(_0x2ef8c1,_0x2f72f4){_0x2ef8c1=_0x2ef8c1-0x0;var _0x288305=_0x16fd[_0x2ef8c1];return _0x288305;};'use strict';var _=require(_0xd16f('0x0'));var util=require('util');var moment=require(_0xd16f('0x1'));var BPromise=require(_0xd16f('0x2'));var rs=require(_0xd16f('0x3'));var fs=require('fs');var Redis=require(_0xd16f('0x4'));var db=require(_0xd16f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd16f('0x6'))(_0xd16f('0x7'));var config=require('../../config/environment');var jayson=require(_0xd16f('0x8'));var client=jayson[_0xd16f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a2fe5,_0x274430,_0x132140){return new BPromise(function(_0x114156,_0x87cbea){return client['request'](_0x3a2fe5,_0x132140)[_0xd16f('0xa')](function(_0x58d395){logger[_0xd16f('0xb')]('SquareRecording,\x20%s,\x20%s',_0x274430,_0xd16f('0xc'));logger['debug'](_0xd16f('0xd'),_0x274430,'request\x20sent',JSON[_0xd16f('0xe')](_0x58d395));if(_0x58d395[_0xd16f('0xf')]){if(_0x58d395[_0xd16f('0xf')][_0xd16f('0x10')]===0x1f4){logger[_0xd16f('0xf')](_0xd16f('0x11'),_0x274430,_0x58d395['error'][_0xd16f('0x12')]);return _0x87cbea(_0x58d395['error'][_0xd16f('0x12')]);}logger[_0xd16f('0xf')]('SquareRecording,\x20%s,\x20%s',_0x274430,_0x58d395[_0xd16f('0xf')]['message']);return _0x114156(_0x58d395['error'][_0xd16f('0x12')]);}else{logger[_0xd16f('0xb')](_0xd16f('0x11'),_0x274430,_0xd16f('0xc'));_0x114156(_0x58d395[_0xd16f('0x13')][_0xd16f('0x12')]);}})['catch'](function(_0x27f7f6){logger[_0xd16f('0xf')](_0xd16f('0x11'),_0x274430,_0x27f7f6);_0x87cbea(_0x27f7f6);});});}exports[_0xd16f('0x14')]=function(_0x4a6f05){var _0x51e9e6=this;return new Promise(function(_0x54881f,_0x4f4dad){return db[_0xd16f('0x15')]['create'](_0x4a6f05['body'],{'raw':_0x4a6f05[_0xd16f('0x16')]?_0x4a6f05[_0xd16f('0x16')][_0xd16f('0x17')]===undefined?!![]:![]:!![]})[_0xd16f('0xa')](function(_0x3f53e4){logger['info']('CreateSquareRecording',_0x4a6f05);logger['debug'](_0xd16f('0x14'),_0x4a6f05,JSON[_0xd16f('0xe')](_0x3f53e4));_0x54881f(_0x3f53e4);})['catch'](function(_0x227895){logger[_0xd16f('0xf')](_0xd16f('0x14'),_0x227895[_0xd16f('0x12')],_0x4a6f05);_0x4f4dad(_0x51e9e6[_0xd16f('0xf')](0x1f4,_0x227895[_0xd16f('0x12')]));});});}; \ No newline at end of file +var _0x3a61=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareRecording','create','body','options','raw','CreateSquareRecording','lodash','bluebird','ioredis'];(function(_0x270bda,_0x15d488){var _0x1e9d9f=function(_0x2b0aa5){while(--_0x2b0aa5){_0x270bda['push'](_0x270bda['shift']());}};_0x1e9d9f(++_0x15d488);}(_0x3a61,0x192));var _0x13a6=function(_0x531424,_0x215494){_0x531424=_0x531424-0x0;var _0x83c322=_0x3a61[_0x531424];return _0x83c322;};'use strict';var _=require(_0x13a6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x13a6('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x13a6('0x2'));var db=require(_0x13a6('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x13a6('0x4'))(_0x13a6('0x5'));var config=require('../../config/environment');var jayson=require(_0x13a6('0x6'));var client=jayson[_0x13a6('0x7')][_0x13a6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x6d0c1,_0x2ec5a7,_0x241608){return new BPromise(function(_0x2d09d3,_0x3222c8){return client['request'](_0x6d0c1,_0x241608)[_0x13a6('0x9')](function(_0x2989e2){logger[_0x13a6('0xa')](_0x13a6('0xb'),_0x2ec5a7,_0x13a6('0xc'));logger[_0x13a6('0xd')](_0x13a6('0xe'),_0x2ec5a7,_0x13a6('0xc'),JSON[_0x13a6('0xf')](_0x2989e2));if(_0x2989e2[_0x13a6('0x10')]){if(_0x2989e2[_0x13a6('0x10')][_0x13a6('0x11')]===0x1f4){logger[_0x13a6('0x10')](_0x13a6('0xb'),_0x2ec5a7,_0x2989e2['error'][_0x13a6('0x12')]);return _0x3222c8(_0x2989e2['error'][_0x13a6('0x12')]);}logger[_0x13a6('0x10')]('SquareRecording,\x20%s,\x20%s',_0x2ec5a7,_0x2989e2[_0x13a6('0x10')][_0x13a6('0x12')]);return _0x2d09d3(_0x2989e2[_0x13a6('0x10')]['message']);}else{logger[_0x13a6('0xa')]('SquareRecording,\x20%s,\x20%s',_0x2ec5a7,_0x13a6('0xc'));_0x2d09d3(_0x2989e2[_0x13a6('0x13')][_0x13a6('0x12')]);}})[_0x13a6('0x14')](function(_0x50ff9e){logger[_0x13a6('0x10')](_0x13a6('0xb'),_0x2ec5a7,_0x50ff9e);_0x3222c8(_0x50ff9e);});});}exports['CreateSquareRecording']=function(_0x42f3fd){var _0x56ecc8=this;return new Promise(function(_0x5be9f9,_0x4034f1){return db[_0x13a6('0x15')][_0x13a6('0x16')](_0x42f3fd[_0x13a6('0x17')],{'raw':_0x42f3fd['options']?_0x42f3fd[_0x13a6('0x18')][_0x13a6('0x19')]===undefined?!![]:![]:!![]})[_0x13a6('0x9')](function(_0x414a64){logger[_0x13a6('0xa')](_0x13a6('0x1a'),_0x42f3fd);logger[_0x13a6('0xd')](_0x13a6('0x1a'),_0x42f3fd,JSON['stringify'](_0x414a64));_0x5be9f9(_0x414a64);})[_0x13a6('0x14')](function(_0x1599ba){logger[_0x13a6('0x10')](_0x13a6('0x1a'),_0x1599ba[_0x13a6('0x12')],_0x42f3fd);_0x4034f1(_0x56ecc8[_0x13a6('0x10')](0x1f4,_0x1599ba[_0x13a6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 344d970..f4255fd 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 _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x534dfb,_0x512008){var _0x55e9c2=function(_0x888092){while(--_0x888092){_0x534dfb['push'](_0x534dfb['shift']());}};_0x55e9c2(++_0x512008);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x427c98,_0x521679){var _0x2eebd8=function(_0x5997cc){while(--_0x5997cc){_0x427c98['push'](_0x427c98['shift']());}};_0x2eebd8(++_0x521679);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 6dccedf..8cdccf0 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 _0xd61e=['BOOLEAN','sequelize','exports','STRING'];(function(_0x3d0240,_0x21509a){var _0xdf8a7d=function(_0x5628a3){while(--_0x5628a3){_0x3d0240['push'](_0x3d0240['shift']());}};_0xdf8a7d(++_0x21509a);}(_0xd61e,0x13d));var _0xed61=function(_0x7496ee,_0x287ee6){_0x7496ee=_0x7496ee-0x0;var _0x481696=_0xd61e[_0x7496ee];return _0x481696;};'use strict';var Sequelize=require(_0xed61('0x0'));module[_0xed61('0x1')]={'network':{'type':Sequelize[_0xed61('0x2')]},'network_script':{'type':Sequelize[_0xed61('0x2')]},'request':{'type':Sequelize[_0xed61('0x2')]},'channel':{'type':Sequelize[_0xed61('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xed61('0x2')]},'uniqueid':{'type':Sequelize[_0xed61('0x2')]},'version':{'type':Sequelize[_0xed61('0x2')]},'callerid':{'type':Sequelize[_0xed61('0x2')]},'calleridname':{'type':Sequelize[_0xed61('0x2')]},'callingpres':{'type':Sequelize[_0xed61('0x2')]},'callingani2':{'type':Sequelize[_0xed61('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xed61('0x2')]},'priority':{'type':Sequelize[_0xed61('0x2')]},'enhanced':{'type':Sequelize[_0xed61('0x2')]},'accountcode':{'type':Sequelize[_0xed61('0x2')]},'threadid':{'type':Sequelize[_0xed61('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xed61('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe6ba=['BOOLEAN','exports','STRING'];(function(_0x549caa,_0x50012b){var _0x5e4ac9=function(_0x539c08){while(--_0x539c08){_0x549caa['push'](_0x549caa['shift']());}};_0x5e4ac9(++_0x50012b);}(_0xe6ba,0x1d5));var _0xae6b=function(_0x1592e3,_0x45e4f9){_0x1592e3=_0x1592e3-0x0;var _0x19e1e0=_0xe6ba[_0x1592e3];return _0x19e1e0;};'use strict';var Sequelize=require('sequelize');module[_0xae6b('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xae6b('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xae6b('0x1')]},'language':{'type':Sequelize[_0xae6b('0x1')]},'type':{'type':Sequelize[_0xae6b('0x1')]},'uniqueid':{'type':Sequelize[_0xae6b('0x1')]},'version':{'type':Sequelize[_0xae6b('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xae6b('0x1')]},'callingpres':{'type':Sequelize[_0xae6b('0x1')]},'callingani2':{'type':Sequelize[_0xae6b('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xae6b('0x1')]},'dnid':{'type':Sequelize[_0xae6b('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xae6b('0x1')]},'extension':{'type':Sequelize[_0xae6b('0x1')]},'priority':{'type':Sequelize[_0xae6b('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xae6b('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xae6b('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index b5e7e77..b309d18 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 _0x8530=['create','body','find','describe','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','filters','length','options'];(function(_0x34215d,_0x4a0d80){var _0x20e9bd=function(_0x3dc835){while(--_0x3dc835){_0x34215d['push'](_0x34215d['shift']());}};_0x20e9bd(++_0x4a0d80);}(_0x8530,0xf4));var _0x0853=function(_0x2af34a,_0x4e3d01){_0x2af34a=_0x2af34a-0x0;var _0x26fe52=_0x8530[_0x2af34a];return _0x26fe52;};'use strict';var emlformat=require(_0x0853('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0853('0x1'));var moment=require(_0x0853('0x2'));var BPromise=require(_0x0853('0x3'));var Mustache=require(_0x0853('0x4'));var util=require(_0x0853('0x5'));var path=require(_0x0853('0x6'));var sox=require(_0x0853('0x7'));var csv=require('to-csv');var ejs=require(_0x0853('0x8'));var fs=require('fs');var fs_extra=require(_0x0853('0x9'));var _=require(_0x0853('0xa'));var squel=require(_0x0853('0xb'));var crypto=require(_0x0853('0xc'));var jsforce=require(_0x0853('0xd'));var deskjs=require(_0x0853('0xe'));var toCsv=require(_0x0853('0xf'));var querystring=require('querystring');var Papa=require(_0x0853('0x10'));var Redis=require(_0x0853('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0853('0x12'));var as=require(_0x0853('0x13'));var hardwareService=require(_0x0853('0x14'));var logger=require(_0x0853('0x15'))(_0x0853('0x16'));var utils=require('../../config/utils');var config=require(_0x0853('0x17'));var licenseUtil=require(_0x0853('0x18'));var db=require(_0x0853('0x19'))['db'];function respondWithStatusCode(_0x27fe96,_0x45fe1c){_0x45fe1c=_0x45fe1c||0xcc;return function(_0x4b061d){if(_0x4b061d){return _0x27fe96[_0x0853('0x1a')](_0x45fe1c);}return _0x27fe96[_0x0853('0x1b')](_0x45fe1c)[_0x0853('0x1c')]();};}function respondWithResult(_0x3c9722,_0xcf9a5){_0xcf9a5=_0xcf9a5||0xc8;return function(_0x599877){if(_0x599877){return _0x3c9722[_0x0853('0x1b')](_0xcf9a5)[_0x0853('0x1d')](_0x599877);}};}function respondWithFilteredResult(_0x3a494a,_0x856ecc){return function(_0x4f558d){if(_0x4f558d){var _0x3720c5=typeof _0x856ecc[_0x0853('0x1e')]===_0x0853('0x1f')&&typeof _0x856ecc[_0x0853('0x20')]===_0x0853('0x1f');var _0x278565=_0x4f558d['count'];var _0x394e33=_0x3720c5?0x0:_0x856ecc['offset'];var _0x2f1f01=_0x3720c5?_0x4f558d[_0x0853('0x21')]:_0x856ecc[_0x0853('0x1e')]+_0x856ecc[_0x0853('0x20')];var _0x343e61;if(_0x2f1f01>=_0x278565){_0x2f1f01=_0x278565;_0x343e61=0xc8;}else{_0x343e61=0xce;}_0x3a494a[_0x0853('0x1b')](_0x343e61);return _0x3a494a[_0x0853('0x22')](_0x0853('0x23'),_0x394e33+'-'+_0x2f1f01+'/'+_0x278565)[_0x0853('0x1d')](_0x4f558d);}return null;};}function patchUpdates(_0x3c2ece){return function(_0x15db4f){try{jsonpatch[_0x0853('0x24')](_0x15db4f,_0x3c2ece,!![]);}catch(_0x54c247){return BPromise[_0x0853('0x25')](_0x54c247);}return _0x15db4f[_0x0853('0x26')]();};}function saveUpdates(_0x272ecb,_0x96e4e6){return function(_0x3a52d1){if(_0x3a52d1){return _0x3a52d1[_0x0853('0x27')](_0x272ecb)[_0x0853('0x28')](function(_0x184545){return _0x184545;});}return null;};}function removeEntity(_0x43b39e,_0x17b836){return function(_0x488c0a){if(_0x488c0a){return _0x488c0a[_0x0853('0x29')]()[_0x0853('0x28')](function(){_0x43b39e[_0x0853('0x1b')](0xcc)[_0x0853('0x1c')]();});}};}function handleEntityNotFound(_0x551f8a,_0x29700c){return function(_0x3172c3){if(!_0x3172c3){_0x551f8a[_0x0853('0x1a')](0x194);}return _0x3172c3;};}function handleError(_0x40a117,_0x4c0192){_0x4c0192=_0x4c0192||0x1f4;return function(_0x54733e){logger[_0x0853('0x2a')](_0x54733e['stack']);if(_0x54733e[_0x0853('0x2b')]){delete _0x54733e[_0x0853('0x2b')];}_0x40a117['status'](_0x4c0192)['send'](_0x54733e);};}exports[_0x0853('0x2c')]=function(_0x10f59a,_0x5b1570){var _0x23e0f3={},_0x25ad54={},_0xdfb16e={'count':0x0,'rows':[]};var _0x3a82f6=_[_0x0853('0x2d')](db[_0x0853('0x2e')][_0x0853('0x2f')],function(_0x1b05c1){return{'name':_0x1b05c1[_0x0853('0x30')],'type':_0x1b05c1[_0x0853('0x31')][_0x0853('0x32')]};});_0x25ad54[_0x0853('0x33')]=_[_0x0853('0x2d')](_0x3a82f6,_0x0853('0x2b'));_0x25ad54[_0x0853('0x34')]=_[_0x0853('0x35')](_0x10f59a[_0x0853('0x34')]);_0x25ad54['filters']=_[_0x0853('0x36')](_0x25ad54[_0x0853('0x33')],_0x25ad54[_0x0853('0x34')]);_0x23e0f3['attributes']=_[_0x0853('0x36')](_0x25ad54[_0x0853('0x33')],qs[_0x0853('0x37')](_0x10f59a[_0x0853('0x34')][_0x0853('0x37')]));_0x23e0f3[_0x0853('0x38')]=_0x23e0f3[_0x0853('0x38')]['length']?_0x23e0f3[_0x0853('0x38')]:_0x25ad54[_0x0853('0x33')];if(!_0x10f59a['query'][_0x0853('0x39')](_0x0853('0x3a'))){_0x23e0f3[_0x0853('0x20')]=qs['limit'](_0x10f59a[_0x0853('0x34')][_0x0853('0x20')]);_0x23e0f3[_0x0853('0x1e')]=qs['offset'](_0x10f59a[_0x0853('0x34')][_0x0853('0x1e')]);}_0x23e0f3[_0x0853('0x3b')]=qs[_0x0853('0x3c')](_0x10f59a[_0x0853('0x34')][_0x0853('0x3c')]);_0x23e0f3[_0x0853('0x3d')]=qs['filters'](_[_0x0853('0x3e')](_0x10f59a[_0x0853('0x34')],_0x25ad54['filters']),_0x3a82f6);if(_0x10f59a[_0x0853('0x34')][_0x0853('0x3f')]){_0x23e0f3[_0x0853('0x3d')]=_[_0x0853('0x40')](_0x23e0f3[_0x0853('0x3d')],{'$or':_['map'](_0x3a82f6,function(_0x56f2a3){if(_0x56f2a3[_0x0853('0x31')]!==_0x0853('0x41')){var _0x321330={};_0x321330[_0x56f2a3['name']]={'$like':'%'+_0x10f59a['query']['filter']+'%'};return _0x321330;}})});}_0x23e0f3=_[_0x0853('0x40')]({},_0x23e0f3,_0x10f59a['options']);var _0x22a4ff={'where':_0x23e0f3[_0x0853('0x3d')]};return db[_0x0853('0x2e')][_0x0853('0x21')](_0x22a4ff)[_0x0853('0x28')](function(_0x3b356b){_0xdfb16e['count']=_0x3b356b;if(_0x10f59a[_0x0853('0x34')][_0x0853('0x42')]){_0x23e0f3[_0x0853('0x43')]=[{'all':!![]}];}return db[_0x0853('0x2e')][_0x0853('0x44')](_0x23e0f3);})[_0x0853('0x28')](function(_0x28af8a){_0xdfb16e[_0x0853('0x45')]=_0x28af8a;return _0xdfb16e;})[_0x0853('0x28')](respondWithFilteredResult(_0x5b1570,_0x23e0f3))[_0x0853('0x46')](handleError(_0x5b1570,null));};exports[_0x0853('0x47')]=function(_0x2eab6c,_0x2d3858){var _0xeddad3={'raw':!![],'where':{'id':_0x2eab6c[_0x0853('0x48')]['id']}},_0x433224={};_0x433224['model']=_['keys'](db[_0x0853('0x2e')][_0x0853('0x2f')]);_0x433224[_0x0853('0x34')]=_[_0x0853('0x35')](_0x2eab6c[_0x0853('0x34')]);_0x433224[_0x0853('0x49')]=_[_0x0853('0x36')](_0x433224[_0x0853('0x33')],_0x433224[_0x0853('0x34')]);_0xeddad3['attributes']=_[_0x0853('0x36')](_0x433224[_0x0853('0x33')],qs[_0x0853('0x37')](_0x2eab6c['query'][_0x0853('0x37')]));_0xeddad3[_0x0853('0x38')]=_0xeddad3[_0x0853('0x38')][_0x0853('0x4a')]?_0xeddad3['attributes']:_0x433224[_0x0853('0x33')];if(_0x2eab6c[_0x0853('0x34')][_0x0853('0x42')]){_0xeddad3[_0x0853('0x43')]=[{'all':!![]}];}_0xeddad3=_[_0x0853('0x40')]({},_0xeddad3,_0x2eab6c[_0x0853('0x4b')]);return db[_0x0853('0x2e')]['find'](_0xeddad3)['then'](handleEntityNotFound(_0x2d3858,null))['then'](respondWithResult(_0x2d3858,null))['catch'](handleError(_0x2d3858,null));};exports[_0x0853('0x4c')]=function(_0x5304ff,_0x327319){return db[_0x0853('0x2e')][_0x0853('0x4c')](_0x5304ff[_0x0853('0x4d')],{})[_0x0853('0x28')](respondWithResult(_0x327319,0xc9))['catch'](handleError(_0x327319,null));};exports[_0x0853('0x27')]=function(_0x12f7bc,_0x5c2d0b){if(_0x12f7bc[_0x0853('0x4d')]['id']){delete _0x12f7bc[_0x0853('0x4d')]['id'];}return db['SquareReport'][_0x0853('0x4e')]({'where':{'id':_0x12f7bc[_0x0853('0x48')]['id']}})[_0x0853('0x28')](handleEntityNotFound(_0x5c2d0b,null))['then'](saveUpdates(_0x12f7bc[_0x0853('0x4d')],null))[_0x0853('0x28')](respondWithResult(_0x5c2d0b,null))[_0x0853('0x46')](handleError(_0x5c2d0b,null));};exports[_0x0853('0x29')]=function(_0x49218f,_0xf123e7){return db[_0x0853('0x2e')]['find']({'where':{'id':_0x49218f[_0x0853('0x48')]['id']}})[_0x0853('0x28')](handleEntityNotFound(_0xf123e7,null))['then'](removeEntity(_0xf123e7,null))[_0x0853('0x46')](handleError(_0xf123e7,null));};exports[_0x0853('0x4f')]=function(_0x3ccd9c,_0x3cccea){return db[_0x0853('0x2e')][_0x0853('0x4f')]()[_0x0853('0x28')](respondWithResult(_0x3cccea,null))[_0x0853('0x46')](handleError(_0x3cccea,null));}; \ No newline at end of file +var _0xa844=['SquareReport','include','rows','show','params','rawAttributes','length','options','catch','create','update','body','find','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa844,0x9e));var _0x4a84=function(_0x4ebe52,_0x3b8e6a){_0x4ebe52=_0x4ebe52-0x0;var _0x3fb2bb=_0xa844[_0x4ebe52];return _0x3fb2bb;};'use strict';var emlformat=require(_0x4a84('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4a84('0x1'));var rp=require('request-promise');var moment=require(_0x4a84('0x2'));var BPromise=require(_0x4a84('0x3'));var Mustache=require(_0x4a84('0x4'));var util=require(_0x4a84('0x5'));var path=require(_0x4a84('0x6'));var sox=require(_0x4a84('0x7'));var csv=require(_0x4a84('0x8'));var ejs=require(_0x4a84('0x9'));var fs=require('fs');var fs_extra=require(_0x4a84('0xa'));var _=require(_0x4a84('0xb'));var squel=require(_0x4a84('0xc'));var crypto=require(_0x4a84('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4a84('0x8'));var querystring=require(_0x4a84('0xe'));var Papa=require(_0x4a84('0xf'));var Redis=require('ioredis');var authService=require(_0x4a84('0x10'));var qs=require(_0x4a84('0x11'));var as=require(_0x4a84('0x12'));var hardwareService=require(_0x4a84('0x13'));var logger=require(_0x4a84('0x14'))('api');var utils=require(_0x4a84('0x15'));var config=require(_0x4a84('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcd1517,_0x21105b){_0x21105b=_0x21105b||0xcc;return function(_0x3774c8){if(_0x3774c8){return _0xcd1517[_0x4a84('0x17')](_0x21105b);}return _0xcd1517[_0x4a84('0x18')](_0x21105b)[_0x4a84('0x19')]();};}function respondWithResult(_0x4baba1,_0x3a0fa5){_0x3a0fa5=_0x3a0fa5||0xc8;return function(_0xae846b){if(_0xae846b){return _0x4baba1['status'](_0x3a0fa5)[_0x4a84('0x1a')](_0xae846b);}};}function respondWithFilteredResult(_0x2fc5ff,_0x4ede80){return function(_0xb054a1){if(_0xb054a1){var _0x39b55b=typeof _0x4ede80[_0x4a84('0x1b')]===_0x4a84('0x1c')&&typeof _0x4ede80['limit']===_0x4a84('0x1c');var _0x28c1f0=_0xb054a1[_0x4a84('0x1d')];var _0x48d95d=_0x39b55b?0x0:_0x4ede80[_0x4a84('0x1b')];var _0x35ba84=_0x39b55b?_0xb054a1[_0x4a84('0x1d')]:_0x4ede80[_0x4a84('0x1b')]+_0x4ede80['limit'];var _0x223e1f;if(_0x35ba84>=_0x28c1f0){_0x35ba84=_0x28c1f0;_0x223e1f=0xc8;}else{_0x223e1f=0xce;}_0x2fc5ff[_0x4a84('0x18')](_0x223e1f);return _0x2fc5ff[_0x4a84('0x1e')](_0x4a84('0x1f'),_0x48d95d+'-'+_0x35ba84+'/'+_0x28c1f0)[_0x4a84('0x1a')](_0xb054a1);}return null;};}function patchUpdates(_0x309ef3){return function(_0x26c058){try{jsonpatch[_0x4a84('0x20')](_0x26c058,_0x309ef3,!![]);}catch(_0x38f3c2){return BPromise[_0x4a84('0x21')](_0x38f3c2);}return _0x26c058[_0x4a84('0x22')]();};}function saveUpdates(_0x1d6f01,_0x56fa1f){return function(_0xe4117f){if(_0xe4117f){return _0xe4117f['update'](_0x1d6f01)['then'](function(_0x4c60b4){return _0x4c60b4;});}return null;};}function removeEntity(_0x4da976,_0x4ae103){return function(_0x51e9b5){if(_0x51e9b5){return _0x51e9b5[_0x4a84('0x23')]()[_0x4a84('0x24')](function(){_0x4da976[_0x4a84('0x18')](0xcc)[_0x4a84('0x19')]();});}};}function handleEntityNotFound(_0x33c627,_0x56a19b){return function(_0x1779c0){if(!_0x1779c0){_0x33c627[_0x4a84('0x17')](0x194);}return _0x1779c0;};}function handleError(_0x9404ca,_0x52443e){_0x52443e=_0x52443e||0x1f4;return function(_0x243208){logger[_0x4a84('0x25')](_0x243208['stack']);if(_0x243208[_0x4a84('0x26')]){delete _0x243208[_0x4a84('0x26')];}_0x9404ca[_0x4a84('0x18')](_0x52443e)[_0x4a84('0x27')](_0x243208);};}exports[_0x4a84('0x28')]=function(_0x176d94,_0x54e8ef){var _0x324dc7={},_0x5e122b={},_0x48f673={'count':0x0,'rows':[]};var _0x581c24=_[_0x4a84('0x29')](db['SquareReport']['rawAttributes'],function(_0x1892e1){return{'name':_0x1892e1['fieldName'],'type':_0x1892e1[_0x4a84('0x2a')]['key']};});_0x5e122b[_0x4a84('0x2b')]=_[_0x4a84('0x29')](_0x581c24,_0x4a84('0x26'));_0x5e122b['query']=_[_0x4a84('0x2c')](_0x176d94[_0x4a84('0x2d')]);_0x5e122b[_0x4a84('0x2e')]=_[_0x4a84('0x2f')](_0x5e122b[_0x4a84('0x2b')],_0x5e122b[_0x4a84('0x2d')]);_0x324dc7[_0x4a84('0x30')]=_[_0x4a84('0x2f')](_0x5e122b[_0x4a84('0x2b')],qs[_0x4a84('0x31')](_0x176d94[_0x4a84('0x2d')][_0x4a84('0x31')]));_0x324dc7[_0x4a84('0x30')]=_0x324dc7['attributes']['length']?_0x324dc7[_0x4a84('0x30')]:_0x5e122b['model'];if(!_0x176d94['query'][_0x4a84('0x32')](_0x4a84('0x33'))){_0x324dc7['limit']=qs[_0x4a84('0x34')](_0x176d94[_0x4a84('0x2d')]['limit']);_0x324dc7[_0x4a84('0x1b')]=qs[_0x4a84('0x1b')](_0x176d94['query']['offset']);}_0x324dc7[_0x4a84('0x35')]=qs[_0x4a84('0x36')](_0x176d94[_0x4a84('0x2d')][_0x4a84('0x36')]);_0x324dc7[_0x4a84('0x37')]=qs[_0x4a84('0x2e')](_[_0x4a84('0x38')](_0x176d94[_0x4a84('0x2d')],_0x5e122b['filters']),_0x581c24);if(_0x176d94[_0x4a84('0x2d')]['filter']){_0x324dc7['where']=_[_0x4a84('0x39')](_0x324dc7[_0x4a84('0x37')],{'$or':_[_0x4a84('0x29')](_0x581c24,function(_0x423657){if(_0x423657[_0x4a84('0x2a')]!=='VIRTUAL'){var _0x29d0bb={};_0x29d0bb[_0x423657['name']]={'$like':'%'+_0x176d94['query']['filter']+'%'};return _0x29d0bb;}})});}_0x324dc7=_['merge']({},_0x324dc7,_0x176d94['options']);var _0x30ddc1={'where':_0x324dc7[_0x4a84('0x37')]};return db[_0x4a84('0x3a')][_0x4a84('0x1d')](_0x30ddc1)[_0x4a84('0x24')](function(_0x1a33a7){_0x48f673[_0x4a84('0x1d')]=_0x1a33a7;if(_0x176d94[_0x4a84('0x2d')]['includeAll']){_0x324dc7[_0x4a84('0x3b')]=[{'all':!![]}];}return db[_0x4a84('0x3a')]['findAll'](_0x324dc7);})['then'](function(_0x250caa){_0x48f673[_0x4a84('0x3c')]=_0x250caa;return _0x48f673;})[_0x4a84('0x24')](respondWithFilteredResult(_0x54e8ef,_0x324dc7))['catch'](handleError(_0x54e8ef,null));};exports[_0x4a84('0x3d')]=function(_0x19597d,_0x2b3e46){var _0xd99a5={'raw':!![],'where':{'id':_0x19597d[_0x4a84('0x3e')]['id']}},_0x33d279={};_0x33d279[_0x4a84('0x2b')]=_[_0x4a84('0x2c')](db[_0x4a84('0x3a')][_0x4a84('0x3f')]);_0x33d279['query']=_[_0x4a84('0x2c')](_0x19597d[_0x4a84('0x2d')]);_0x33d279[_0x4a84('0x2e')]=_[_0x4a84('0x2f')](_0x33d279['model'],_0x33d279[_0x4a84('0x2d')]);_0xd99a5[_0x4a84('0x30')]=_[_0x4a84('0x2f')](_0x33d279[_0x4a84('0x2b')],qs[_0x4a84('0x31')](_0x19597d[_0x4a84('0x2d')][_0x4a84('0x31')]));_0xd99a5[_0x4a84('0x30')]=_0xd99a5['attributes'][_0x4a84('0x40')]?_0xd99a5[_0x4a84('0x30')]:_0x33d279['model'];if(_0x19597d[_0x4a84('0x2d')]['includeAll']){_0xd99a5[_0x4a84('0x3b')]=[{'all':!![]}];}_0xd99a5=_[_0x4a84('0x39')]({},_0xd99a5,_0x19597d[_0x4a84('0x41')]);return db['SquareReport']['find'](_0xd99a5)[_0x4a84('0x24')](handleEntityNotFound(_0x2b3e46,null))['then'](respondWithResult(_0x2b3e46,null))[_0x4a84('0x42')](handleError(_0x2b3e46,null));};exports[_0x4a84('0x43')]=function(_0x4de3a5,_0x5c9eed){return db[_0x4a84('0x3a')][_0x4a84('0x43')](_0x4de3a5['body'],{})[_0x4a84('0x24')](respondWithResult(_0x5c9eed,0xc9))['catch'](handleError(_0x5c9eed,null));};exports[_0x4a84('0x44')]=function(_0x1f79d2,_0x576ab5){if(_0x1f79d2[_0x4a84('0x45')]['id']){delete _0x1f79d2[_0x4a84('0x45')]['id'];}return db[_0x4a84('0x3a')]['find']({'where':{'id':_0x1f79d2[_0x4a84('0x3e')]['id']}})[_0x4a84('0x24')](handleEntityNotFound(_0x576ab5,null))[_0x4a84('0x24')](saveUpdates(_0x1f79d2[_0x4a84('0x45')],null))['then'](respondWithResult(_0x576ab5,null))[_0x4a84('0x42')](handleError(_0x576ab5,null));};exports[_0x4a84('0x23')]=function(_0x1d8d01,_0x2abd73){return db[_0x4a84('0x3a')][_0x4a84('0x46')]({'where':{'id':_0x1d8d01[_0x4a84('0x3e')]['id']}})[_0x4a84('0x24')](handleEntityNotFound(_0x2abd73,null))[_0x4a84('0x24')](removeEntity(_0x2abd73,null))[_0x4a84('0x42')](handleError(_0x2abd73,null));};exports['describe']=function(_0x38565a,_0x3e8b80){return db[_0x4a84('0x3a')][_0x4a84('0x47')]()['then'](respondWithResult(_0x3e8b80,null))[_0x4a84('0x42')](handleError(_0x3e8b80,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 65d39e9..0ed46f0 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 _0xa639=['../../config/logger','api','moment','request-promise','path','../../config/environment','./squareReport.attributes','exports','define','SquareReport','uid_pname','uniqueid','project_name','leaveAt','lodash','util'];(function(_0x4a0c35,_0x457442){var _0x564b17=function(_0x5bdb85){while(--_0x5bdb85){_0x4a0c35['push'](_0x4a0c35['shift']());}};_0x564b17(++_0x457442);}(_0xa639,0x11e));var _0x9a63=function(_0x536cd5,_0x18c540){_0x536cd5=_0x536cd5-0x0;var _0x1be13e=_0xa639[_0x536cd5];return _0x1be13e;};'use strict';var _=require(_0x9a63('0x0'));var util=require(_0x9a63('0x1'));var logger=require(_0x9a63('0x2'))(_0x9a63('0x3'));var moment=require(_0x9a63('0x4'));var BPromise=require('bluebird');var rp=require(_0x9a63('0x5'));var fs=require('fs');var path=require(_0x9a63('0x6'));var rimraf=require('rimraf');var config=require(_0x9a63('0x7'));var attributes=require(_0x9a63('0x8'));module[_0x9a63('0x9')]=function(_0x1e3902,_0xf951e9){return _0x1e3902[_0x9a63('0xa')](_0x9a63('0xb'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x9a63('0xc'),'fields':[_0x9a63('0xd'),_0x9a63('0xe')]},{'name':_0x9a63('0xf'),'fields':[_0x9a63('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xad75=['bluebird','path','rimraf','../../config/environment','exports','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment'];(function(_0x271b73,_0x37ac84){var _0x267965=function(_0x2793f3){while(--_0x2793f3){_0x271b73['push'](_0x271b73['shift']());}};_0x267965(++_0x37ac84);}(_0xad75,0xdb));var _0x5ad7=function(_0x4e516d,_0x482c2f){_0x4e516d=_0x4e516d-0x0;var _0x4adae3=_0xad75[_0x4e516d];return _0x4adae3;};'use strict';var _=require(_0x5ad7('0x0'));var util=require(_0x5ad7('0x1'));var logger=require(_0x5ad7('0x2'))(_0x5ad7('0x3'));var moment=require(_0x5ad7('0x4'));var BPromise=require(_0x5ad7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ad7('0x6'));var rimraf=require(_0x5ad7('0x7'));var config=require(_0x5ad7('0x8'));var attributes=require('./squareReport.attributes');module[_0x5ad7('0x9')]=function(_0x36f296,_0x4a4846){return _0x36f296['define']('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x5ad7('0xa'),'fields':[_0x5ad7('0xb'),_0x5ad7('0xc')]},{'name':_0x5ad7('0xd'),'fields':[_0x5ad7('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 07fe566..bb6ac5e 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 _0x4ad7=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','SquareReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','CreateSquareReport','SquareReport','body','options','raw','catch','UpdateSquareReport','stringify','lodash'];(function(_0x24f2dc,_0x4ad7e6){var _0x2becfe=function(_0x557a00){while(--_0x557a00){_0x24f2dc['push'](_0x24f2dc['shift']());}};_0x2becfe(++_0x4ad7e6);}(_0x4ad7,0xcf));var _0x74ad=function(_0x20d919,_0x106eb9){_0x20d919=_0x20d919-0x0;var _0x2726b0=_0x4ad7[_0x20d919];return _0x2726b0;};'use strict';var _=require(_0x74ad('0x0'));var util=require('util');var moment=require(_0x74ad('0x1'));var BPromise=require(_0x74ad('0x2'));var rs=require(_0x74ad('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x74ad('0x4'));var logger=require(_0x74ad('0x5'))(_0x74ad('0x6'));var config=require('../../config/environment');var jayson=require(_0x74ad('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5d197e,_0x43bde0,_0x496c72){return new BPromise(function(_0x2e065d,_0x2213ef){return client[_0x74ad('0x8')](_0x5d197e,_0x496c72)[_0x74ad('0x9')](function(_0x21f0de){logger[_0x74ad('0xa')](_0x74ad('0xb'),_0x43bde0,'request\x20sent');logger[_0x74ad('0xc')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x43bde0,_0x74ad('0xd'),JSON['stringify'](_0x21f0de));if(_0x21f0de['error']){if(_0x21f0de[_0x74ad('0xe')][_0x74ad('0xf')]===0x1f4){logger['error'](_0x74ad('0xb'),_0x43bde0,_0x21f0de[_0x74ad('0xe')][_0x74ad('0x10')]);return _0x2213ef(_0x21f0de[_0x74ad('0xe')]['message']);}logger[_0x74ad('0xe')](_0x74ad('0xb'),_0x43bde0,_0x21f0de[_0x74ad('0xe')][_0x74ad('0x10')]);return _0x2e065d(_0x21f0de['error']['message']);}else{logger['info'](_0x74ad('0xb'),_0x43bde0,_0x74ad('0xd'));_0x2e065d(_0x21f0de[_0x74ad('0x11')][_0x74ad('0x10')]);}})['catch'](function(_0x4d989e){logger[_0x74ad('0xe')](_0x74ad('0xb'),_0x43bde0,_0x4d989e);_0x2213ef(_0x4d989e);});});}exports[_0x74ad('0x12')]=function(_0x3689dd){var _0x17c092=this;return new Promise(function(_0x323430,_0x1ae39b){return db[_0x74ad('0x13')]['create'](_0x3689dd[_0x74ad('0x14')],{'raw':_0x3689dd[_0x74ad('0x15')]?_0x3689dd[_0x74ad('0x15')][_0x74ad('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x4962d8){logger['info']('CreateSquareReport',_0x3689dd);logger['debug']('CreateSquareReport',_0x3689dd,JSON['stringify'](_0x4962d8));_0x323430(_0x4962d8);})[_0x74ad('0x17')](function(_0x1c760c){logger[_0x74ad('0xe')](_0x74ad('0x12'),_0x1c760c[_0x74ad('0x10')],_0x3689dd);_0x1ae39b(_0x17c092[_0x74ad('0xe')](0x1f4,_0x1c760c[_0x74ad('0x10')]));});});};exports[_0x74ad('0x18')]=function(_0x5e90c1){var _0x48ada1=this;return new Promise(function(_0x54c008,_0x5c2f98){return db[_0x74ad('0x13')]['update'](_0x5e90c1[_0x74ad('0x14')],{'raw':_0x5e90c1['options']?_0x5e90c1[_0x74ad('0x15')][_0x74ad('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e90c1[_0x74ad('0x15')]?_0x5e90c1[_0x74ad('0x15')]['where']||null:null,'attributes':_0x5e90c1[_0x74ad('0x15')]?_0x5e90c1[_0x74ad('0x15')]['attributes']||null:null,'limit':_0x5e90c1['options']?_0x5e90c1['options']['limit']||null:null})[_0x74ad('0x9')](function(_0x5632a1){logger[_0x74ad('0xa')](_0x74ad('0x18'),_0x5e90c1);logger[_0x74ad('0xc')]('UpdateSquareReport',_0x5e90c1,JSON[_0x74ad('0x19')](_0x5632a1));_0x54c008(_0x5632a1);})[_0x74ad('0x17')](function(_0x2b0605){logger[_0x74ad('0xe')](_0x74ad('0x18'),_0x2b0605[_0x74ad('0x10')],_0x5e90c1);_0x5c2f98(_0x48ada1[_0x74ad('0xe')](0x1f4,_0x2b0605[_0x74ad('0x10')]));});});}; \ No newline at end of file +var _0xa87c=['then','debug','CreateSquareReport','UpdateSquareReport','update','body','where','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','SquareReport','create','options'];(function(_0x5d1a82,_0x2d1fec){var _0x2ad31c=function(_0xe91aea){while(--_0xe91aea){_0x5d1a82['push'](_0x5d1a82['shift']());}};_0x2ad31c(++_0x2d1fec);}(_0xa87c,0x110));var _0xca87=function(_0x4bc65f,_0x39ec43){_0x4bc65f=_0x4bc65f-0x0;var _0x44f85f=_0xa87c[_0x4bc65f];return _0x44f85f;};'use strict';var _=require(_0xca87('0x0'));var util=require(_0xca87('0x1'));var moment=require('moment');var BPromise=require(_0xca87('0x2'));var rs=require(_0xca87('0x3'));var fs=require('fs');var Redis=require(_0xca87('0x4'));var db=require(_0xca87('0x5'))['db'];var utils=require(_0xca87('0x6'));var logger=require(_0xca87('0x7'))(_0xca87('0x8'));var config=require('../../config/environment');var jayson=require(_0xca87('0x9'));var client=jayson[_0xca87('0xa')][_0xca87('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x172cbf,_0x2fd1eb,_0x479e1b){return new BPromise(function(_0x41025b,_0x4c27aa){return client[_0xca87('0xc')](_0x172cbf,_0x479e1b)['then'](function(_0x5b9667){logger[_0xca87('0xd')](_0xca87('0xe'),_0x2fd1eb,_0xca87('0xf'));logger['debug'](_0xca87('0x10'),_0x2fd1eb,'request\x20sent',JSON[_0xca87('0x11')](_0x5b9667));if(_0x5b9667[_0xca87('0x12')]){if(_0x5b9667['error'][_0xca87('0x13')]===0x1f4){logger[_0xca87('0x12')](_0xca87('0xe'),_0x2fd1eb,_0x5b9667[_0xca87('0x12')]['message']);return _0x4c27aa(_0x5b9667[_0xca87('0x12')][_0xca87('0x14')]);}logger[_0xca87('0x12')](_0xca87('0xe'),_0x2fd1eb,_0x5b9667[_0xca87('0x12')]['message']);return _0x41025b(_0x5b9667[_0xca87('0x12')]['message']);}else{logger[_0xca87('0xd')](_0xca87('0xe'),_0x2fd1eb,_0xca87('0xf'));_0x41025b(_0x5b9667['result'][_0xca87('0x14')]);}})[_0xca87('0x15')](function(_0x283311){logger[_0xca87('0x12')](_0xca87('0xe'),_0x2fd1eb,_0x283311);_0x4c27aa(_0x283311);});});}exports['CreateSquareReport']=function(_0x364dfb){var _0x4d5167=this;return new Promise(function(_0x198f2a,_0x1204fa){return db[_0xca87('0x16')][_0xca87('0x17')](_0x364dfb['body'],{'raw':_0x364dfb[_0xca87('0x18')]?_0x364dfb[_0xca87('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xca87('0x19')](function(_0x3a8f28){logger[_0xca87('0xd')]('CreateSquareReport',_0x364dfb);logger[_0xca87('0x1a')](_0xca87('0x1b'),_0x364dfb,JSON[_0xca87('0x11')](_0x3a8f28));_0x198f2a(_0x3a8f28);})['catch'](function(_0x196a76){logger[_0xca87('0x12')](_0xca87('0x1b'),_0x196a76[_0xca87('0x14')],_0x364dfb);_0x1204fa(_0x4d5167[_0xca87('0x12')](0x1f4,_0x196a76[_0xca87('0x14')]));});});};exports[_0xca87('0x1c')]=function(_0x2afd6c){var _0xfd11fc=this;return new Promise(function(_0x18da63,_0x596d8a){return db['SquareReport'][_0xca87('0x1d')](_0x2afd6c[_0xca87('0x1e')],{'raw':_0x2afd6c['options']?_0x2afd6c[_0xca87('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2afd6c[_0xca87('0x18')]?_0x2afd6c[_0xca87('0x18')][_0xca87('0x1f')]||null:null,'attributes':_0x2afd6c[_0xca87('0x18')]?_0x2afd6c[_0xca87('0x18')]['attributes']||null:null,'limit':_0x2afd6c[_0xca87('0x18')]?_0x2afd6c[_0xca87('0x18')][_0xca87('0x20')]||null:null})[_0xca87('0x19')](function(_0x2d6e92){logger[_0xca87('0xd')]('UpdateSquareReport',_0x2afd6c);logger[_0xca87('0x1a')](_0xca87('0x1c'),_0x2afd6c,JSON[_0xca87('0x11')](_0x2d6e92));_0x18da63(_0x2d6e92);})[_0xca87('0x15')](function(_0x1e33fd){logger[_0xca87('0x12')]('UpdateSquareReport',_0x1e33fd[_0xca87('0x14')],_0x2afd6c);_0x596d8a(_0xfd11fc[_0xca87('0x12')](0x1f4,_0x1e33fd[_0xca87('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 1789b0f..85770f1 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 _0xb6ad=['create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0x1d1172,_0x5ecc98){var _0x4a30ad=function(_0x4483b7){while(--_0x4483b7){_0x1d1172['push'](_0x1d1172['shift']());}};_0x4a30ad(++_0x5ecc98);}(_0xb6ad,0x165));var _0xdb6a=function(_0x26d0ff,_0x3cdbf5){_0x26d0ff=_0x26d0ff-0x0;var _0x5c8866=_0xb6ad[_0x26d0ff];return _0x5c8866;};'use strict';var multer=require(_0xdb6a('0x0'));var util=require(_0xdb6a('0x1'));var path=require(_0xdb6a('0x2'));var timeout=require(_0xdb6a('0x3'));var express=require(_0xdb6a('0x4'));var router=express[_0xdb6a('0x5')]();var fs_extra=require(_0xdb6a('0x6'));var auth=require(_0xdb6a('0x7'));var interaction=require(_0xdb6a('0x8'));var config=require(_0xdb6a('0x9'));var controller=require(_0xdb6a('0xa'));router[_0xdb6a('0xb')]('/',auth[_0xdb6a('0xc')](),controller[_0xdb6a('0xd')]);router[_0xdb6a('0xb')]('/describe',auth[_0xdb6a('0xc')](),controller[_0xdb6a('0xe')]);router[_0xdb6a('0xb')](_0xdb6a('0xf'),auth[_0xdb6a('0xc')](),controller[_0xdb6a('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdb6a('0x11')]);router[_0xdb6a('0x12')]('/:id',auth[_0xdb6a('0xc')](),controller['update']);router[_0xdb6a('0x13')](_0xdb6a('0xf'),auth['isAuthenticated'](),controller[_0xdb6a('0x14')]);module[_0xdb6a('0x15')]=router; \ No newline at end of file +var _0xf4d2=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','util','path'];(function(_0x267750,_0x54f315){var _0x12f0dd=function(_0x2ea032){while(--_0x2ea032){_0x267750['push'](_0x267750['shift']());}};_0x12f0dd(++_0x54f315);}(_0xf4d2,0x139));var _0x2f4d=function(_0x959354,_0x21b8cc){_0x959354=_0x959354-0x0;var _0x49adb8=_0xf4d2[_0x959354];return _0x49adb8;};'use strict';var multer=require('multer');var util=require(_0x2f4d('0x0'));var path=require(_0x2f4d('0x1'));var timeout=require(_0x2f4d('0x2'));var express=require('express');var router=express[_0x2f4d('0x3')]();var fs_extra=require(_0x2f4d('0x4'));var auth=require(_0x2f4d('0x5'));var interaction=require(_0x2f4d('0x6'));var config=require(_0x2f4d('0x7'));var controller=require(_0x2f4d('0x8'));router[_0x2f4d('0x9')]('/',auth[_0x2f4d('0xa')](),controller[_0x2f4d('0xb')]);router[_0x2f4d('0x9')](_0x2f4d('0xc'),auth[_0x2f4d('0xa')](),controller[_0x2f4d('0xd')]);router[_0x2f4d('0x9')](_0x2f4d('0xe'),auth[_0x2f4d('0xa')](),controller[_0x2f4d('0xf')]);router['post']('/',auth[_0x2f4d('0xa')](),controller[_0x2f4d('0x10')]);router[_0x2f4d('0x11')](_0x2f4d('0xe'),auth[_0x2f4d('0xa')](),controller['update']);router[_0x2f4d('0x12')](_0x2f4d('0xe'),auth[_0x2f4d('0xa')](),controller[_0x2f4d('0x13')]);module[_0x2f4d('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 3e8d539..689348d 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 _0xb7f0=['STRING'];(function(_0x1bef07,_0x2a4e64){var _0x29edf6=function(_0x3e0230){while(--_0x3e0230){_0x1bef07['push'](_0x1bef07['shift']());}};_0x29edf6(++_0x2a4e64);}(_0xb7f0,0x9d));var _0x0b7f=function(_0x205e5b,_0x3d9293){_0x205e5b=_0x205e5b-0x0;var _0x2e60db=_0xb7f0[_0x205e5b];return _0x2e60db;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x0b7f('0x0')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x0b7f('0x0')]}}; \ No newline at end of file +var _0xaeb9=['exports','STRING','TEXT','sequelize'];(function(_0x1fd0ac,_0x554f3c){var _0x4a9deb=function(_0xf81e52){while(--_0xf81e52){_0x1fd0ac['push'](_0x1fd0ac['shift']());}};_0x4a9deb(++_0x554f3c);}(_0xaeb9,0x1d3));var _0x9aeb=function(_0x225a30,_0x22bc59){_0x225a30=_0x225a30-0x0;var _0x33066d=_0xaeb9[_0x225a30];return _0x33066d;};'use strict';var Sequelize=require(_0x9aeb('0x0'));module[_0x9aeb('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x9aeb('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x9aeb('0x3')]},'project_name':{'type':Sequelize[_0x9aeb('0x2')]},'callerid':{'type':Sequelize[_0x9aeb('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index fec2213..e2b57be 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 _0x0e79=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','count','set','Content-Range','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','filters','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','catch','length','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3febd9,_0x37aa62){var _0x2168b9=function(_0x33739e){while(--_0x33739e){_0x3febd9['push'](_0x3febd9['shift']());}};_0x2168b9(++_0x37aa62);}(_0x0e79,0xd0));var _0x90e7=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x0e79[_0x110c3d];return _0x226d67;};'use strict';var emlformat=require(_0x90e7('0x0'));var rimraf=require(_0x90e7('0x1'));var zipdir=require(_0x90e7('0x2'));var jsonpatch=require(_0x90e7('0x3'));var rp=require(_0x90e7('0x4'));var moment=require(_0x90e7('0x5'));var BPromise=require(_0x90e7('0x6'));var Mustache=require(_0x90e7('0x7'));var util=require('util');var path=require(_0x90e7('0x8'));var sox=require(_0x90e7('0x9'));var csv=require(_0x90e7('0xa'));var ejs=require(_0x90e7('0xb'));var fs=require('fs');var fs_extra=require(_0x90e7('0xc'));var _=require(_0x90e7('0xd'));var squel=require(_0x90e7('0xe'));var crypto=require(_0x90e7('0xf'));var jsforce=require(_0x90e7('0x10'));var deskjs=require(_0x90e7('0x11'));var toCsv=require(_0x90e7('0xa'));var querystring=require(_0x90e7('0x12'));var Papa=require(_0x90e7('0x13'));var Redis=require('ioredis');var authService=require(_0x90e7('0x14'));var qs=require(_0x90e7('0x15'));var as=require(_0x90e7('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x90e7('0x17'))('api');var utils=require(_0x90e7('0x18'));var config=require(_0x90e7('0x19'));var licenseUtil=require(_0x90e7('0x1a'));var db=require(_0x90e7('0x1b'))['db'];function respondWithStatusCode(_0x57a793,_0x3e9dde){_0x3e9dde=_0x3e9dde||0xcc;return function(_0x2a4ef5){if(_0x2a4ef5){return _0x57a793['sendStatus'](_0x3e9dde);}return _0x57a793[_0x90e7('0x1c')](_0x3e9dde)['end']();};}function respondWithResult(_0xce9fe1,_0x44596e){_0x44596e=_0x44596e||0xc8;return function(_0x3eadb7){if(_0x3eadb7){return _0xce9fe1['status'](_0x44596e)[_0x90e7('0x1d')](_0x3eadb7);}};}function respondWithFilteredResult(_0x2bec44,_0x4979ca){return function(_0x6831b2){if(_0x6831b2){var _0x221176=typeof _0x4979ca['offset']===_0x90e7('0x1e')&&typeof _0x4979ca['limit']===_0x90e7('0x1e');var _0x3d80fe=_0x6831b2[_0x90e7('0x1f')];var _0x8a76cd=_0x221176?0x0:_0x4979ca['offset'];var _0x491865=_0x221176?_0x6831b2[_0x90e7('0x1f')]:_0x4979ca['offset']+_0x4979ca['limit'];var _0x32dbd3;if(_0x491865>=_0x3d80fe){_0x491865=_0x3d80fe;_0x32dbd3=0xc8;}else{_0x32dbd3=0xce;}_0x2bec44[_0x90e7('0x1c')](_0x32dbd3);return _0x2bec44[_0x90e7('0x20')](_0x90e7('0x21'),_0x8a76cd+'-'+_0x491865+'/'+_0x3d80fe)[_0x90e7('0x1d')](_0x6831b2);}return null;};}function patchUpdates(_0x45d1a0){return function(_0x50af40){try{jsonpatch['apply'](_0x50af40,_0x45d1a0,!![]);}catch(_0x10517d){return BPromise['reject'](_0x10517d);}return _0x50af40[_0x90e7('0x22')]();};}function saveUpdates(_0x233bac,_0x2ec0c9){return function(_0x29bee0){if(_0x29bee0){return _0x29bee0[_0x90e7('0x23')](_0x233bac)['then'](function(_0x13587c){return _0x13587c;});}return null;};}function removeEntity(_0x376d49,_0x57d7d1){return function(_0x1f9be7){if(_0x1f9be7){return _0x1f9be7[_0x90e7('0x24')]()[_0x90e7('0x25')](function(){_0x376d49['status'](0xcc)[_0x90e7('0x26')]();});}};}function handleEntityNotFound(_0x11cbe5,_0x3537a4){return function(_0x27348a){if(!_0x27348a){_0x11cbe5[_0x90e7('0x27')](0x194);}return _0x27348a;};}function handleError(_0x2354ee,_0xdf4b41){_0xdf4b41=_0xdf4b41||0x1f4;return function(_0x33bc70){logger[_0x90e7('0x28')](_0x33bc70[_0x90e7('0x29')]);if(_0x33bc70[_0x90e7('0x2a')]){delete _0x33bc70[_0x90e7('0x2a')];}_0x2354ee['status'](_0xdf4b41)[_0x90e7('0x2b')](_0x33bc70);};}exports[_0x90e7('0x2c')]=function(_0x47a786,_0x41905c){var _0x2ab969={},_0x522c63={},_0x58538e={'count':0x0,'rows':[]};var _0x34cd38=_[_0x90e7('0x2d')](db[_0x90e7('0x2e')][_0x90e7('0x2f')],function(_0x42bb94){return{'name':_0x42bb94[_0x90e7('0x30')],'type':_0x42bb94['type'][_0x90e7('0x31')]};});_0x522c63[_0x90e7('0x32')]=_[_0x90e7('0x2d')](_0x34cd38,_0x90e7('0x2a'));_0x522c63[_0x90e7('0x33')]=_[_0x90e7('0x34')](_0x47a786[_0x90e7('0x33')]);_0x522c63['filters']=_[_0x90e7('0x35')](_0x522c63[_0x90e7('0x32')],_0x522c63['query']);_0x2ab969['attributes']=_[_0x90e7('0x35')](_0x522c63[_0x90e7('0x32')],qs[_0x90e7('0x36')](_0x47a786[_0x90e7('0x33')]['fields']));_0x2ab969[_0x90e7('0x37')]=_0x2ab969[_0x90e7('0x37')]['length']?_0x2ab969['attributes']:_0x522c63[_0x90e7('0x32')];if(!_0x47a786[_0x90e7('0x33')][_0x90e7('0x38')](_0x90e7('0x39'))){_0x2ab969[_0x90e7('0x3a')]=qs[_0x90e7('0x3a')](_0x47a786[_0x90e7('0x33')][_0x90e7('0x3a')]);_0x2ab969['offset']=qs[_0x90e7('0x3b')](_0x47a786[_0x90e7('0x33')][_0x90e7('0x3b')]);}_0x2ab969[_0x90e7('0x3c')]=qs[_0x90e7('0x3d')](_0x47a786['query'][_0x90e7('0x3d')]);_0x2ab969['where']=qs['filters'](_['pick'](_0x47a786[_0x90e7('0x33')],_0x522c63[_0x90e7('0x3e')]),_0x34cd38);if(_0x47a786[_0x90e7('0x33')][_0x90e7('0x3f')]){_0x2ab969[_0x90e7('0x40')]=_[_0x90e7('0x41')](_0x2ab969['where'],{'$or':_[_0x90e7('0x2d')](_0x34cd38,function(_0x361a96){if(_0x361a96[_0x90e7('0x42')]!==_0x90e7('0x43')){var _0x2a47a9={};_0x2a47a9[_0x361a96['name']]={'$like':'%'+_0x47a786[_0x90e7('0x33')][_0x90e7('0x3f')]+'%'};return _0x2a47a9;}})});}_0x2ab969=_['merge']({},_0x2ab969,_0x47a786[_0x90e7('0x44')]);var _0x7fd4f9={'where':_0x2ab969[_0x90e7('0x40')]};return db[_0x90e7('0x2e')][_0x90e7('0x1f')](_0x7fd4f9)[_0x90e7('0x25')](function(_0x152aa0){_0x58538e['count']=_0x152aa0;if(_0x47a786[_0x90e7('0x33')][_0x90e7('0x45')]){_0x2ab969['include']=[{'all':!![]}];}return db['SquareDetailsReport'][_0x90e7('0x46')](_0x2ab969);})[_0x90e7('0x25')](function(_0x13b22e){_0x58538e['rows']=_0x13b22e;return _0x58538e;})[_0x90e7('0x25')](respondWithFilteredResult(_0x41905c,_0x2ab969))[_0x90e7('0x47')](handleError(_0x41905c,null));};exports['show']=function(_0x2148c3,_0x389e68){var _0x590427={'raw':!![],'where':{'id':_0x2148c3['params']['id']}},_0x6d28f2={};_0x6d28f2[_0x90e7('0x32')]=_[_0x90e7('0x34')](db[_0x90e7('0x2e')][_0x90e7('0x2f')]);_0x6d28f2['query']=_[_0x90e7('0x34')](_0x2148c3[_0x90e7('0x33')]);_0x6d28f2[_0x90e7('0x3e')]=_['intersection'](_0x6d28f2[_0x90e7('0x32')],_0x6d28f2[_0x90e7('0x33')]);_0x590427['attributes']=_[_0x90e7('0x35')](_0x6d28f2['model'],qs[_0x90e7('0x36')](_0x2148c3[_0x90e7('0x33')][_0x90e7('0x36')]));_0x590427[_0x90e7('0x37')]=_0x590427['attributes'][_0x90e7('0x48')]?_0x590427[_0x90e7('0x37')]:_0x6d28f2[_0x90e7('0x32')];if(_0x2148c3['query'][_0x90e7('0x45')]){_0x590427['include']=[{'all':!![]}];}_0x590427=_[_0x90e7('0x41')]({},_0x590427,_0x2148c3['options']);return db[_0x90e7('0x2e')][_0x90e7('0x49')](_0x590427)[_0x90e7('0x25')](handleEntityNotFound(_0x389e68,null))[_0x90e7('0x25')](respondWithResult(_0x389e68,null))[_0x90e7('0x47')](handleError(_0x389e68,null));};exports['create']=function(_0x552a58,_0x23715d){return db[_0x90e7('0x2e')]['create'](_0x552a58[_0x90e7('0x4a')],{})['then'](respondWithResult(_0x23715d,0xc9))[_0x90e7('0x47')](handleError(_0x23715d,null));};exports['update']=function(_0x886d16,_0x1bcf22){if(_0x886d16[_0x90e7('0x4a')]['id']){delete _0x886d16[_0x90e7('0x4a')]['id'];}return db['SquareDetailsReport']['find']({'where':{'id':_0x886d16[_0x90e7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1bcf22,null))['then'](saveUpdates(_0x886d16['body'],null))[_0x90e7('0x25')](respondWithResult(_0x1bcf22,null))[_0x90e7('0x47')](handleError(_0x1bcf22,null));};exports[_0x90e7('0x24')]=function(_0x17c73c,_0x43ba9a){return db['SquareDetailsReport'][_0x90e7('0x49')]({'where':{'id':_0x17c73c['params']['id']}})[_0x90e7('0x25')](handleEntityNotFound(_0x43ba9a,null))[_0x90e7('0x25')](removeEntity(_0x43ba9a,null))[_0x90e7('0x47')](handleError(_0x43ba9a,null));};exports[_0x90e7('0x4c')]=function(_0x237997,_0x155319){return db[_0x90e7('0x2e')][_0x90e7('0x4c')]()[_0x90e7('0x25')](respondWithResult(_0x155319,null))[_0x90e7('0x47')](handleError(_0x155319,null));}; \ No newline at end of file +var _0x970c=['../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','intersection','find','catch','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x9331c0,_0x2940a6){var _0x9878c7=function(_0x2c672a){while(--_0x2c672a){_0x9331c0['push'](_0x9331c0['shift']());}};_0x9878c7(++_0x2940a6);}(_0x970c,0xce));var _0xc970=function(_0x4a6573,_0xe9c4af){_0x4a6573=_0x4a6573-0x0;var _0x46ccc8=_0x970c[_0x4a6573];return _0x46ccc8;};'use strict';var emlformat=require(_0xc970('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc970('0x1'));var jsonpatch=require(_0xc970('0x2'));var rp=require(_0xc970('0x3'));var moment=require(_0xc970('0x4'));var BPromise=require(_0xc970('0x5'));var Mustache=require('mustache');var util=require(_0xc970('0x6'));var path=require(_0xc970('0x7'));var sox=require(_0xc970('0x8'));var csv=require(_0xc970('0x9'));var ejs=require(_0xc970('0xa'));var fs=require('fs');var fs_extra=require(_0xc970('0xb'));var _=require(_0xc970('0xc'));var squel=require('squel');var crypto=require(_0xc970('0xd'));var jsforce=require(_0xc970('0xe'));var deskjs=require(_0xc970('0xf'));var toCsv=require(_0xc970('0x9'));var querystring=require(_0xc970('0x10'));var Papa=require(_0xc970('0x11'));var Redis=require(_0xc970('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc970('0x13'));var hardwareService=require(_0xc970('0x14'));var logger=require(_0xc970('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xc970('0x16'));var licenseUtil=require(_0xc970('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25d6e0,_0x3a1bde){_0x3a1bde=_0x3a1bde||0xcc;return function(_0x18754c){if(_0x18754c){return _0x25d6e0['sendStatus'](_0x3a1bde);}return _0x25d6e0[_0xc970('0x18')](_0x3a1bde)[_0xc970('0x19')]();};}function respondWithResult(_0x352a9f,_0x35acc9){_0x35acc9=_0x35acc9||0xc8;return function(_0x47fc62){if(_0x47fc62){return _0x352a9f[_0xc970('0x18')](_0x35acc9)[_0xc970('0x1a')](_0x47fc62);}};}function respondWithFilteredResult(_0x7fe9e1,_0x29dd26){return function(_0x3960c8){if(_0x3960c8){var _0x2ce72d=typeof _0x29dd26[_0xc970('0x1b')]===_0xc970('0x1c')&&typeof _0x29dd26[_0xc970('0x1d')]===_0xc970('0x1c');var _0x2413d9=_0x3960c8['count'];var _0x117a18=_0x2ce72d?0x0:_0x29dd26[_0xc970('0x1b')];var _0x236d31=_0x2ce72d?_0x3960c8[_0xc970('0x1e')]:_0x29dd26['offset']+_0x29dd26[_0xc970('0x1d')];var _0x5f4ba0;if(_0x236d31>=_0x2413d9){_0x236d31=_0x2413d9;_0x5f4ba0=0xc8;}else{_0x5f4ba0=0xce;}_0x7fe9e1['status'](_0x5f4ba0);return _0x7fe9e1[_0xc970('0x1f')](_0xc970('0x20'),_0x117a18+'-'+_0x236d31+'/'+_0x2413d9)[_0xc970('0x1a')](_0x3960c8);}return null;};}function patchUpdates(_0x49e95a){return function(_0x1a9858){try{jsonpatch[_0xc970('0x21')](_0x1a9858,_0x49e95a,!![]);}catch(_0x2aba09){return BPromise[_0xc970('0x22')](_0x2aba09);}return _0x1a9858[_0xc970('0x23')]();};}function saveUpdates(_0x2c63f0,_0x48e2f1){return function(_0x4526af){if(_0x4526af){return _0x4526af[_0xc970('0x24')](_0x2c63f0)['then'](function(_0x36ec11){return _0x36ec11;});}return null;};}function removeEntity(_0x40b708,_0x41752c){return function(_0x2304f4){if(_0x2304f4){return _0x2304f4['destroy']()[_0xc970('0x25')](function(){_0x40b708['status'](0xcc)[_0xc970('0x19')]();});}};}function handleEntityNotFound(_0x3a9f34,_0x4817c7){return function(_0x24be29){if(!_0x24be29){_0x3a9f34['sendStatus'](0x194);}return _0x24be29;};}function handleError(_0x325a97,_0x1340c1){_0x1340c1=_0x1340c1||0x1f4;return function(_0x4361b4){logger[_0xc970('0x26')](_0x4361b4['stack']);if(_0x4361b4[_0xc970('0x27')]){delete _0x4361b4[_0xc970('0x27')];}_0x325a97[_0xc970('0x18')](_0x1340c1)[_0xc970('0x28')](_0x4361b4);};}exports[_0xc970('0x29')]=function(_0x3dd03a,_0xcc47f1){var _0x2d6fd9={},_0x29a65e={},_0x4a4eeb={'count':0x0,'rows':[]};var _0x32f29a=_[_0xc970('0x2a')](db[_0xc970('0x2b')][_0xc970('0x2c')],function(_0x228f6a){return{'name':_0x228f6a[_0xc970('0x2d')],'type':_0x228f6a[_0xc970('0x2e')][_0xc970('0x2f')]};});_0x29a65e[_0xc970('0x30')]=_[_0xc970('0x2a')](_0x32f29a,_0xc970('0x27'));_0x29a65e[_0xc970('0x31')]=_[_0xc970('0x32')](_0x3dd03a[_0xc970('0x31')]);_0x29a65e[_0xc970('0x33')]=_['intersection'](_0x29a65e[_0xc970('0x30')],_0x29a65e['query']);_0x2d6fd9['attributes']=_['intersection'](_0x29a65e[_0xc970('0x30')],qs[_0xc970('0x34')](_0x3dd03a[_0xc970('0x31')]['fields']));_0x2d6fd9['attributes']=_0x2d6fd9['attributes'][_0xc970('0x35')]?_0x2d6fd9[_0xc970('0x36')]:_0x29a65e['model'];if(!_0x3dd03a[_0xc970('0x31')][_0xc970('0x37')](_0xc970('0x38'))){_0x2d6fd9[_0xc970('0x1d')]=qs[_0xc970('0x1d')](_0x3dd03a[_0xc970('0x31')][_0xc970('0x1d')]);_0x2d6fd9['offset']=qs[_0xc970('0x1b')](_0x3dd03a[_0xc970('0x31')][_0xc970('0x1b')]);}_0x2d6fd9[_0xc970('0x39')]=qs[_0xc970('0x3a')](_0x3dd03a[_0xc970('0x31')][_0xc970('0x3a')]);_0x2d6fd9[_0xc970('0x3b')]=qs[_0xc970('0x33')](_[_0xc970('0x3c')](_0x3dd03a[_0xc970('0x31')],_0x29a65e[_0xc970('0x33')]),_0x32f29a);if(_0x3dd03a[_0xc970('0x31')][_0xc970('0x3d')]){_0x2d6fd9[_0xc970('0x3b')]=_[_0xc970('0x3e')](_0x2d6fd9[_0xc970('0x3b')],{'$or':_[_0xc970('0x2a')](_0x32f29a,function(_0x2209f3){if(_0x2209f3[_0xc970('0x2e')]!=='VIRTUAL'){var _0xe85e06={};_0xe85e06[_0x2209f3[_0xc970('0x27')]]={'$like':'%'+_0x3dd03a[_0xc970('0x31')][_0xc970('0x3d')]+'%'};return _0xe85e06;}})});}_0x2d6fd9=_[_0xc970('0x3e')]({},_0x2d6fd9,_0x3dd03a['options']);var _0x33f6d={'where':_0x2d6fd9[_0xc970('0x3b')]};return db[_0xc970('0x2b')][_0xc970('0x1e')](_0x33f6d)[_0xc970('0x25')](function(_0x3e7424){_0x4a4eeb[_0xc970('0x1e')]=_0x3e7424;if(_0x3dd03a[_0xc970('0x31')][_0xc970('0x3f')]){_0x2d6fd9[_0xc970('0x40')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0xc970('0x41')](_0x2d6fd9);})['then'](function(_0x545c02){_0x4a4eeb[_0xc970('0x42')]=_0x545c02;return _0x4a4eeb;})[_0xc970('0x25')](respondWithFilteredResult(_0xcc47f1,_0x2d6fd9))['catch'](handleError(_0xcc47f1,null));};exports[_0xc970('0x43')]=function(_0x4a0aa1,_0x10004f){var _0x12e859={'raw':!![],'where':{'id':_0x4a0aa1[_0xc970('0x44')]['id']}},_0x3e11e0={};_0x3e11e0[_0xc970('0x30')]=_['keys'](db[_0xc970('0x2b')][_0xc970('0x2c')]);_0x3e11e0[_0xc970('0x31')]=_[_0xc970('0x32')](_0x4a0aa1['query']);_0x3e11e0[_0xc970('0x33')]=_[_0xc970('0x45')](_0x3e11e0[_0xc970('0x30')],_0x3e11e0[_0xc970('0x31')]);_0x12e859['attributes']=_['intersection'](_0x3e11e0['model'],qs[_0xc970('0x34')](_0x4a0aa1[_0xc970('0x31')][_0xc970('0x34')]));_0x12e859[_0xc970('0x36')]=_0x12e859[_0xc970('0x36')][_0xc970('0x35')]?_0x12e859['attributes']:_0x3e11e0[_0xc970('0x30')];if(_0x4a0aa1[_0xc970('0x31')]['includeAll']){_0x12e859[_0xc970('0x40')]=[{'all':!![]}];}_0x12e859=_['merge']({},_0x12e859,_0x4a0aa1['options']);return db['SquareDetailsReport'][_0xc970('0x46')](_0x12e859)['then'](handleEntityNotFound(_0x10004f,null))['then'](respondWithResult(_0x10004f,null))[_0xc970('0x47')](handleError(_0x10004f,null));};exports[_0xc970('0x48')]=function(_0x1f7ff,_0x150c85){return db[_0xc970('0x2b')][_0xc970('0x48')](_0x1f7ff[_0xc970('0x49')],{})[_0xc970('0x25')](respondWithResult(_0x150c85,0xc9))[_0xc970('0x47')](handleError(_0x150c85,null));};exports['update']=function(_0x5ba94c,_0x4aad8a){if(_0x5ba94c[_0xc970('0x49')]['id']){delete _0x5ba94c[_0xc970('0x49')]['id'];}return db['SquareDetailsReport'][_0xc970('0x46')]({'where':{'id':_0x5ba94c[_0xc970('0x44')]['id']}})[_0xc970('0x25')](handleEntityNotFound(_0x4aad8a,null))[_0xc970('0x25')](saveUpdates(_0x5ba94c[_0xc970('0x49')],null))['then'](respondWithResult(_0x4aad8a,null))[_0xc970('0x47')](handleError(_0x4aad8a,null));};exports[_0xc970('0x4a')]=function(_0x5b1054,_0x2df31c){return db['SquareDetailsReport'][_0xc970('0x46')]({'where':{'id':_0x5b1054[_0xc970('0x44')]['id']}})[_0xc970('0x25')](handleEntityNotFound(_0x2df31c,null))[_0xc970('0x25')](removeEntity(_0x2df31c,null))[_0xc970('0x47')](handleError(_0x2df31c,null));};exports[_0xc970('0x4b')]=function(_0x48b46a,_0x58f30e){return db[_0xc970('0x2b')][_0xc970('0x4b')]()['then'](respondWithResult(_0x58f30e,null))[_0xc970('0x47')](handleError(_0x58f30e,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 8d3a0e3..693d8d2 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 _0x9421=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareDetailsReport','util'];(function(_0xdbd6be,_0x1a1535){var _0x251c45=function(_0x38b25e){while(--_0x38b25e){_0xdbd6be['push'](_0xdbd6be['shift']());}};_0x251c45(++_0x1a1535);}(_0x9421,0x1bb));var _0x1942=function(_0x9d1102,_0x5c55c9){_0x9d1102=_0x9d1102-0x0;var _0x2c668e=_0x9421[_0x9d1102];return _0x2c668e;};'use strict';var _=require('lodash');var util=require(_0x1942('0x0'));var logger=require(_0x1942('0x1'))(_0x1942('0x2'));var moment=require(_0x1942('0x3'));var BPromise=require(_0x1942('0x4'));var rp=require(_0x1942('0x5'));var fs=require('fs');var path=require(_0x1942('0x6'));var rimraf=require(_0x1942('0x7'));var config=require(_0x1942('0x8'));var attributes=require('./squareReportDetail.attributes');module[_0x1942('0x9')]=function(_0x36ab0e,_0x5ba47b){return _0x36ab0e[_0x1942('0xa')](_0x1942('0xb'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x031d=['../../config/environment','./squareReportDetail.attributes','exports','report_square_details','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5ecac8,_0x246286){var _0x255862=function(_0x1a2d83){while(--_0x1a2d83){_0x5ecac8['push'](_0x5ecac8['shift']());}};_0x255862(++_0x246286);}(_0x031d,0x1c6));var _0xd031=function(_0x578275,_0xe7ae46){_0x578275=_0x578275-0x0;var _0xf78041=_0x031d[_0x578275];return _0xf78041;};'use strict';var _=require(_0xd031('0x0'));var util=require(_0xd031('0x1'));var logger=require(_0xd031('0x2'))(_0xd031('0x3'));var moment=require(_0xd031('0x4'));var BPromise=require(_0xd031('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd031('0x6'));var attributes=require(_0xd031('0x7'));module[_0xd031('0x8')]=function(_0x3da97e,_0x78bb7b){return _0x3da97e['define']('SquareDetailsReport',attributes,{'tableName':_0xd031('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 87c438a..666ba3c 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 _0xfcbb=['code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x8a7e38,_0x473a5d){var _0x228609=function(_0x5dcb5c){while(--_0x5dcb5c){_0x8a7e38['push'](_0x8a7e38['shift']());}};_0x228609(++_0x473a5d);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x5744d5,_0x5be579){_0x5744d5=_0x5744d5-0x0;var _0x19304c=_0xfcbb[_0x5744d5];return _0x19304c;};'use strict';var _=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var moment=require(_0xbfcb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfcb('0x3'));var db=require(_0xbfcb('0x4'))['db'];var utils=require(_0xbfcb('0x5'));var logger=require(_0xbfcb('0x6'))(_0xbfcb('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbfcb('0x8')][_0xbfcb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8d4e6a,_0x2df839,_0x288ee5){return new BPromise(function(_0x2f875c,_0x49717b){return client['request'](_0x8d4e6a,_0x288ee5)[_0xbfcb('0xa')](function(_0x331173){logger[_0xbfcb('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x2df839,_0xbfcb('0xc'));logger[_0xbfcb('0xd')](_0xbfcb('0xe'),_0x2df839,_0xbfcb('0xc'),JSON[_0xbfcb('0xf')](_0x331173));if(_0x331173[_0xbfcb('0x10')]){if(_0x331173['error'][_0xbfcb('0x11')]===0x1f4){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')]['message']);return _0x49717b(_0x331173[_0xbfcb('0x10')]['message']);}logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);return _0x2f875c(_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);}else{logger[_0xbfcb('0xb')](_0xbfcb('0x12'),_0x2df839,_0xbfcb('0xc'));_0x2f875c(_0x331173[_0xbfcb('0x14')][_0xbfcb('0x13')]);}})[_0xbfcb('0x15')](function(_0x26f335){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x26f335);_0x49717b(_0x26f335);});});}exports[_0xbfcb('0x16')]=function(_0xba1d6){var _0x38689e=this;return new Promise(function(_0x3404aa,_0x46b8d2){return db[_0xbfcb('0x17')][_0xbfcb('0x18')](_0xba1d6['body'],{'raw':_0xba1d6[_0xbfcb('0x19')]?_0xba1d6[_0xbfcb('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xbfcb('0xa')](function(_0x1a7225){logger['info']('CreateSquareDetailsReport',_0xba1d6);logger[_0xbfcb('0xd')](_0xbfcb('0x16'),_0xba1d6,JSON[_0xbfcb('0xf')](_0x1a7225));_0x3404aa(_0x1a7225);})[_0xbfcb('0x15')](function(_0x1c5924){logger['error'](_0xbfcb('0x16'),_0x1c5924[_0xbfcb('0x13')],_0xba1d6);_0x46b8d2(_0x38689e[_0xbfcb('0x10')](0x1f4,_0x1c5924[_0xbfcb('0x13')]));});});}; \ No newline at end of file +var _0xda3f=['options','raw','util','moment','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body'];(function(_0x57230e,_0x3d28af){var _0x304c64=function(_0x213a33){while(--_0x213a33){_0x57230e['push'](_0x57230e['shift']());}};_0x304c64(++_0x3d28af);}(_0xda3f,0xec));var _0xfda3=function(_0x1d9c98,_0x3b4fac){_0x1d9c98=_0x1d9c98-0x0;var _0x336e28=_0xda3f[_0x1d9c98];return _0x336e28;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});}exports[_0xfda3('0x14')]=function(_0x4680bf){var _0xc62ae6=this;return new Promise(function(_0x54a7c6,_0x15ddb9){return db[_0xfda3('0x15')][_0xfda3('0x16')](_0x4680bf[_0xfda3('0x17')],{'raw':_0x4680bf['options']?_0x4680bf[_0xfda3('0x18')][_0xfda3('0x19')]===undefined?!![]:![]:!![]})[_0xfda3('0x8')](function(_0x51e731){logger['info'](_0xfda3('0x14'),_0x4680bf);logger[_0xfda3('0xc')](_0xfda3('0x14'),_0x4680bf,JSON['stringify'](_0x51e731));_0x54a7c6(_0x51e731);})[_0xfda3('0x13')](function(_0xef2535){logger[_0xfda3('0xf')](_0xfda3('0x14'),_0xef2535[_0xfda3('0x11')],_0x4680bf);_0x15ddb9(_0xc62ae6[_0xfda3('0xf')](0x1f4,_0xef2535[_0xfda3('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 0b71f27..3d9f642 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 _0x7b0a=['isAuthenticated','index','/process/:pid/kill','killProcess','exports','express','Router','../../components/auth/service','./system.controller','get'];(function(_0x232009,_0x36eb63){var _0x24c448=function(_0x582069){while(--_0x582069){_0x232009['push'](_0x232009['shift']());}};_0x24c448(++_0x36eb63);}(_0x7b0a,0x1db));var _0xa7b0=function(_0x2c3044,_0x874808){_0x2c3044=_0x2c3044-0x0;var _0x4baeb3=_0x7b0a[_0x2c3044];return _0x4baeb3;};'use strict';var express=require(_0xa7b0('0x0'));var router=express[_0xa7b0('0x1')]();var auth=require(_0xa7b0('0x2'));var controller=require(_0xa7b0('0x3'));router[_0xa7b0('0x4')]('/',auth[_0xa7b0('0x5')](),controller[_0xa7b0('0x6')]);router['get'](_0xa7b0('0x7'),auth[_0xa7b0('0x5')](),controller[_0xa7b0('0x8')]);module[_0xa7b0('0x9')]=router; \ No newline at end of file +var _0x52eb=['killProcess','exports','Router','./system.controller','get','index','/process/:pid/kill','isAuthenticated'];(function(_0x2a6398,_0x17fe47){var _0x11f5f8=function(_0x57aa84){while(--_0x57aa84){_0x2a6398['push'](_0x2a6398['shift']());}};_0x11f5f8(++_0x17fe47);}(_0x52eb,0xa2));var _0xb52e=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0x52eb[_0x4d1ee9];return _0x9a5456;};'use strict';var express=require('express');var router=express[_0xb52e('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xb52e('0x1'));router[_0xb52e('0x2')]('/',auth['isAuthenticated'](),controller[_0xb52e('0x3')]);router[_0xb52e('0x2')](_0xb52e('0x4'),auth[_0xb52e('0x5')](),controller[_0xb52e('0x6')]);module[_0xb52e('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 5a09a7d..11de7c2 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 _0x1e90=['SIGINT','killProcess','exec','../../config/logger','api','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','catch','components/import/cm','format','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill'];(function(_0x571118,_0x201a59){var _0x5da3eb=function(_0x2e8bb1){while(--_0x2e8bb1){_0x571118['push'](_0x571118['shift']());}};_0x5da3eb(++_0x201a59);}(_0x1e90,0xb1));var _0x01e9=function(_0x1853a7,_0x3685d7){_0x1853a7=_0x1853a7-0x0;var _0x3ad016=_0x1e90[_0x1853a7];return _0x3ad016;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0x01e9('0x0')];var logger=require(_0x01e9('0x1'))(_0x01e9('0x2'));var util=require('util');var BPromise=require('bluebird');var _=require(_0x01e9('0x3'));function handleError(_0x4751a6,_0x973fb9,_0x136c23){_0x973fb9=_0x973fb9||0x1f4;return function(_0x4a6bf7){logger['error'](_0x01e9('0x4'),_0x136c23,_0x973fb9,util[_0x01e9('0x5')](_0x4a6bf7,{'showHidden':![],'depth':null}));delete _0x4a6bf7[_0x01e9('0x6')];_0x4751a6[_0x01e9('0x7')](_0x973fb9)[_0x01e9('0x8')](_0x4a6bf7);};}exports[_0x01e9('0x9')]=function(_0x950711,_0x5c4096){return info[_0x01e9('0xa')]()[_0x01e9('0xb')](function(_0x3db051){return _0x5c4096[_0x01e9('0x7')](0xc8)[_0x01e9('0xc')](_0x3db051);})[_0x01e9('0xd')](function(_0x1adbe5){return _0x5c4096['status'](0x1f4)[_0x01e9('0xc')](_0x1adbe5);});};exports['killProcess']=function(_0x3b0a08,_0x2ea86c){var _0x397574=[_0x01e9('0xe')];return new BPromise(function(_0x10b56c,_0x2dfe85){return exec(util[_0x01e9('0xf')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x3b0a08[_0x01e9('0x10')][_0x01e9('0x11')]),function(_0x2f7771,_0x4c6120,_0x4dc9b4){if(_0x2f7771){return _0x2dfe85(_0x2f7771);}return _0x10b56c(_0x4c6120);});})[_0x01e9('0xb')](function(_0x5df676){var _0x2184d1=![];var _0x44f505=_0x5df676[_0x01e9('0x12')](/\n/);for(var _0x343cf4=0x0,_0xe70368=_0x397574[_0x01e9('0x13')];_0x343cf4<_0xe70368,_0x2184d1===![];_0x343cf4+=0x1){if(_0x5df676[_0x01e9('0x14')](_0x397574[_0x343cf4])>=0x0){_0x2184d1=!![];}}if(!_0x2184d1){throw new Error(util['format'](_0x01e9('0x15'),_0x3b0a08['params'][_0x01e9('0x11')]));}process[_0x01e9('0x16')](_0x3b0a08[_0x01e9('0x10')][_0x01e9('0x11')],_0x01e9('0x17'));return _0x2ea86c['status'](0xc8)['json']({'message':util[_0x01e9('0xf')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x3b0a08['params'][_0x01e9('0x11')])});})['catch'](handleError(_0x2ea86c,null,_0x01e9('0x18')));}; \ No newline at end of file +var _0x1809=['kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','api','util','bluebird','lodash','inspect','status','send','index','json','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','then','split','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!'];(function(_0x3a0ed4,_0x5c9fe3){var _0x4805cf=function(_0x4ee1fc){while(--_0x4ee1fc){_0x3a0ed4['push'](_0x3a0ed4['shift']());}};_0x4805cf(++_0x5c9fe3);}(_0x1809,0x183));var _0x9180=function(_0x335161,_0x4ed3a7){_0x335161=_0x335161-0x0;var _0x2ff2e1=_0x1809[_0x335161];return _0x2ff2e1;};'use strict';var info=require(_0x9180('0x0'));var exec=require('child_process')[_0x9180('0x1')];var logger=require('../../config/logger')(_0x9180('0x2'));var util=require(_0x9180('0x3'));var BPromise=require(_0x9180('0x4'));var _=require(_0x9180('0x5'));function handleError(_0x5ea01e,_0x563e37,_0x2c082){_0x563e37=_0x563e37||0x1f4;return function(_0x3be5c8){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x2c082,_0x563e37,util[_0x9180('0x6')](_0x3be5c8,{'showHidden':![],'depth':null}));delete _0x3be5c8['name'];_0x5ea01e[_0x9180('0x7')](_0x563e37)[_0x9180('0x8')](_0x3be5c8);};}exports[_0x9180('0x9')]=function(_0x4124f0,_0x1f7305){return info['getAllData']()['then'](function(_0x441f6c){return _0x1f7305[_0x9180('0x7')](0xc8)[_0x9180('0xa')](_0x441f6c);})['catch'](function(_0x58d11b){return _0x1f7305[_0x9180('0x7')](0x1f4)['json'](_0x58d11b);});};exports[_0x9180('0xb')]=function(_0xab26e8,_0x106740){var _0x1d166a=[_0x9180('0xc')];return new BPromise(function(_0x246c3c,_0x4c543d){return exec(util['format'](_0x9180('0xd'),_0xab26e8[_0x9180('0xe')][_0x9180('0xf')]),function(_0x417afc,_0x3db8a8,_0x5973d8){if(_0x417afc){return _0x4c543d(_0x417afc);}return _0x246c3c(_0x3db8a8);});})[_0x9180('0x10')](function(_0x3a5c0b){var _0x58de9e=![];var _0x14c3d2=_0x3a5c0b[_0x9180('0x11')](/\n/);for(var _0x505f4a=0x0,_0x4517e6=_0x1d166a['length'];_0x505f4a<_0x4517e6,_0x58de9e===![];_0x505f4a+=0x1){if(_0x3a5c0b[_0x9180('0x12')](_0x1d166a[_0x505f4a])>=0x0){_0x58de9e=!![];}}if(!_0x58de9e){throw new Error(util[_0x9180('0x13')](_0x9180('0x14'),_0xab26e8['params'][_0x9180('0xf')]));}process[_0x9180('0x15')](_0xab26e8[_0x9180('0xe')][_0x9180('0xf')],_0x9180('0x16'));return _0x106740['status'](0xc8)['json']({'message':util[_0x9180('0x13')](_0x9180('0x17'),_0xab26e8[_0x9180('0xe')]['pid'])});})['catch'](handleError(_0x106740,null,_0x9180('0xb')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 88a4cfc..da4bcb1 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 _0x8212=['isAuthenticated','get','/: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','./tag.controller'];(function(_0x54e0bb,_0x140919){var _0x4897ea=function(_0x2f54c0){while(--_0x2f54c0){_0x54e0bb['push'](_0x54e0bb['shift']());}};_0x4897ea(++_0x140919);}(_0x8212,0xb3));var _0x2821=function(_0x536f07,_0x1a1a14){_0x536f07=_0x536f07-0x0;var _0xc1ac5b=_0x8212[_0x536f07];return _0xc1ac5b;};'use strict';var multer=require(_0x2821('0x0'));var util=require(_0x2821('0x1'));var path=require('path');var timeout=require(_0x2821('0x2'));var express=require(_0x2821('0x3'));var router=express[_0x2821('0x4')]();var fs_extra=require(_0x2821('0x5'));var auth=require(_0x2821('0x6'));var interaction=require(_0x2821('0x7'));var config=require(_0x2821('0x8'));var controller=require(_0x2821('0x9'));router['get']('/',auth[_0x2821('0xa')](),controller['index']);router[_0x2821('0xb')](_0x2821('0xc'),auth['isAuthenticated'](),controller[_0x2821('0xd')]);router[_0x2821('0xe')]('/',auth[_0x2821('0xa')](),controller[_0x2821('0xf')]);router[_0x2821('0x10')](_0x2821('0xc'),auth[_0x2821('0xa')](),controller[_0x2821('0x11')]);router[_0x2821('0x12')]('/:id',auth[_0x2821('0xa')](),controller[_0x2821('0x13')]);module[_0x2821('0x14')]=router; \ No newline at end of file +var _0xe083=['isAuthenticated','index','post','create','put','/:id','update','delete','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get'];(function(_0x37d214,_0x16f70){var _0x5bbf89=function(_0x1c3612){while(--_0x1c3612){_0x37d214['push'](_0x37d214['shift']());}};_0x5bbf89(++_0x16f70);}(_0xe083,0x1dc));var _0x3e08=function(_0x942858,_0xcee991){_0x942858=_0x942858-0x0;var _0x4d302b=_0xe083[_0x942858];return _0x4d302b;};'use strict';var multer=require(_0x3e08('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3e08('0x1'));var express=require(_0x3e08('0x2'));var router=express[_0x3e08('0x3')]();var fs_extra=require(_0x3e08('0x4'));var auth=require(_0x3e08('0x5'));var interaction=require(_0x3e08('0x6'));var config=require(_0x3e08('0x7'));var controller=require(_0x3e08('0x8'));router[_0x3e08('0x9')]('/',auth[_0x3e08('0xa')](),controller[_0x3e08('0xb')]);router['get']('/:id',auth[_0x3e08('0xa')](),controller['show']);router[_0x3e08('0xc')]('/',auth[_0x3e08('0xa')](),controller[_0x3e08('0xd')]);router[_0x3e08('0xe')](_0x3e08('0xf'),auth[_0x3e08('0xa')](),controller[_0x3e08('0x10')]);router[_0x3e08('0x11')](_0x3e08('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 0fa267e..b1b8883 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 _0x5525=['exports','STRING','name','#0091EA','sequelize'];(function(_0xef47a3,_0x141d61){var _0x407ffe=function(_0x2702bb){while(--_0x2702bb){_0xef47a3['push'](_0xef47a3['shift']());}};_0x407ffe(++_0x141d61);}(_0x5525,0xd1));var _0x5552=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5525[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x5552('0x0'));module[_0x5552('0x1')]={'name':{'type':Sequelize[_0x5552('0x2')],'unique':_0x5552('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x5552('0x2')],'defaultValue':_0x5552('0x4')},'description':{'type':Sequelize[_0x5552('0x2')]}}; \ No newline at end of file +var _0x8e44=['sequelize','exports','STRING','#0091EA'];(function(_0x1f1816,_0x2031e2){var _0x4f4cc9=function(_0x28fb7d){while(--_0x28fb7d){_0x1f1816['push'](_0x1f1816['shift']());}};_0x4f4cc9(++_0x2031e2);}(_0x8e44,0x1ac));var _0x48e4=function(_0x517082,_0xc70ef9){_0x517082=_0x517082-0x0;var _0x560118=_0x8e44[_0x517082];return _0x560118;};'use strict';var Sequelize=require(_0x48e4('0x0'));module[_0x48e4('0x1')]={'name':{'type':Sequelize[_0x48e4('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x48e4('0x3')},'description':{'type':Sequelize[_0x48e4('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 38bb225..7e6925a 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 _0x7794=['stack','name','send','Tag','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','fs-extra','lodash','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','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','get','Tags','UserProfileResource','sendStatus','error'];(function(_0x3d77a3,_0x95660e){var _0x58fefc=function(_0x579ef1){while(--_0x579ef1){_0x3d77a3['push'](_0x3d77a3['shift']());}};_0x58fefc(++_0x95660e);}(_0x7794,0x7b));var _0x4779=function(_0x5aef4b,_0x13bd17){_0x5aef4b=_0x5aef4b-0x0;var _0x5eb33e=_0x7794[_0x5aef4b];return _0x5eb33e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4779('0x0'));var zipdir=require(_0x4779('0x1'));var jsonpatch=require(_0x4779('0x2'));var rp=require(_0x4779('0x3'));var moment=require('moment');var BPromise=require(_0x4779('0x4'));var Mustache=require(_0x4779('0x5'));var util=require('util');var path=require(_0x4779('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4779('0x7'));var _=require(_0x4779('0x8'));var squel=require('squel');var crypto=require(_0x4779('0x9'));var jsforce=require(_0x4779('0xa'));var deskjs=require(_0x4779('0xb'));var toCsv=require(_0x4779('0xc'));var querystring=require(_0x4779('0xd'));var Papa=require(_0x4779('0xe'));var Redis=require(_0x4779('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4779('0x10'));var as=require(_0x4779('0x11'));var hardwareService=require(_0x4779('0x12'));var logger=require(_0x4779('0x13'))(_0x4779('0x14'));var utils=require(_0x4779('0x15'));var config=require(_0x4779('0x16'));var licenseUtil=require(_0x4779('0x17'));var db=require(_0x4779('0x18'))['db'];function respondWithStatusCode(_0x13c989,_0x50e17e){_0x50e17e=_0x50e17e||0xcc;return function(_0x5b1219){if(_0x5b1219){return _0x13c989['sendStatus'](_0x50e17e);}return _0x13c989[_0x4779('0x19')](_0x50e17e)[_0x4779('0x1a')]();};}function respondWithResult(_0xb9a06f,_0xddf5cd){_0xddf5cd=_0xddf5cd||0xc8;return function(_0x4fe370){if(_0x4fe370){return _0xb9a06f[_0x4779('0x19')](_0xddf5cd)[_0x4779('0x1b')](_0x4fe370);}};}function respondWithFilteredResult(_0x4d71a0,_0x599deb){return function(_0x1dbbe1){if(_0x1dbbe1){var _0x2de2be=typeof _0x599deb[_0x4779('0x1c')]===_0x4779('0x1d')&&typeof _0x599deb['limit']==='undefined';var _0x445e0b=_0x1dbbe1[_0x4779('0x1e')];var _0x19fbb6=_0x2de2be?0x0:_0x599deb['offset'];var _0x3dbe70=_0x2de2be?_0x1dbbe1['count']:_0x599deb[_0x4779('0x1c')]+_0x599deb[_0x4779('0x1f')];var _0x478fa5;if(_0x3dbe70>=_0x445e0b){_0x3dbe70=_0x445e0b;_0x478fa5=0xc8;}else{_0x478fa5=0xce;}_0x4d71a0[_0x4779('0x19')](_0x478fa5);return _0x4d71a0['set'](_0x4779('0x20'),_0x19fbb6+'-'+_0x3dbe70+'/'+_0x445e0b)[_0x4779('0x1b')](_0x1dbbe1);}return null;};}function patchUpdates(_0x143ef6){return function(_0x298e25){try{jsonpatch[_0x4779('0x21')](_0x298e25,_0x143ef6,!![]);}catch(_0x1ce270){return BPromise['reject'](_0x1ce270);}return _0x298e25[_0x4779('0x22')]();};}function saveUpdates(_0x4f2158,_0x4ad246){return function(_0xd983f0){if(_0xd983f0){return _0xd983f0[_0x4779('0x23')](_0x4f2158)[_0x4779('0x24')](function(_0x2b7ab6){return _0x2b7ab6;});}return null;};}function removeEntity(_0x555cd6,_0x152887){return function(_0x29a39a){if(_0x29a39a){return _0x29a39a[_0x4779('0x25')]()['then'](function(){var _0x340648=_0x29a39a[_0x4779('0x26')]({'plain':!![]});var _0x577b13=_0x4779('0x27');return db[_0x4779('0x28')]['destroy']({'where':{'type':_0x577b13,'resourceId':_0x340648['id']}})[_0x4779('0x24')](function(){return _0x29a39a;});})[_0x4779('0x24')](function(){_0x555cd6[_0x4779('0x19')](0xcc)[_0x4779('0x1a')]();});}};}function handleEntityNotFound(_0x2634c2,_0x254562){return function(_0xeb1850){if(!_0xeb1850){_0x2634c2[_0x4779('0x29')](0x194);}return _0xeb1850;};}function handleError(_0x4b9066,_0x44c162){_0x44c162=_0x44c162||0x1f4;return function(_0x1607a5){logger[_0x4779('0x2a')](_0x1607a5[_0x4779('0x2b')]);if(_0x1607a5[_0x4779('0x2c')]){delete _0x1607a5[_0x4779('0x2c')];}_0x4b9066[_0x4779('0x19')](_0x44c162)[_0x4779('0x2d')](_0x1607a5);};}exports['index']=function(_0x5b1b36,_0x179717){var _0x986bed={},_0xc7e4d1={},_0x15da6d={'count':0x0,'rows':[]};var _0x335d48=_['map'](db[_0x4779('0x2e')][_0x4779('0x2f')],function(_0x1fa222){return{'name':_0x1fa222[_0x4779('0x30')],'type':_0x1fa222['type']['key']};});_0xc7e4d1[_0x4779('0x31')]=_['map'](_0x335d48,_0x4779('0x2c'));_0xc7e4d1[_0x4779('0x32')]=_[_0x4779('0x33')](_0x5b1b36[_0x4779('0x32')]);_0xc7e4d1[_0x4779('0x34')]=_[_0x4779('0x35')](_0xc7e4d1[_0x4779('0x31')],_0xc7e4d1[_0x4779('0x32')]);_0x986bed[_0x4779('0x36')]=_[_0x4779('0x35')](_0xc7e4d1[_0x4779('0x31')],qs[_0x4779('0x37')](_0x5b1b36['query']['fields']));_0x986bed[_0x4779('0x36')]=_0x986bed['attributes'][_0x4779('0x38')]?_0x986bed['attributes']:_0xc7e4d1[_0x4779('0x31')];if(!_0x5b1b36[_0x4779('0x32')][_0x4779('0x39')](_0x4779('0x3a'))){_0x986bed[_0x4779('0x1f')]=qs['limit'](_0x5b1b36['query'][_0x4779('0x1f')]);_0x986bed[_0x4779('0x1c')]=qs[_0x4779('0x1c')](_0x5b1b36[_0x4779('0x32')][_0x4779('0x1c')]);}_0x986bed[_0x4779('0x3b')]=qs[_0x4779('0x3c')](_0x5b1b36[_0x4779('0x32')][_0x4779('0x3c')]);_0x986bed[_0x4779('0x3d')]=qs[_0x4779('0x34')](_[_0x4779('0x3e')](_0x5b1b36[_0x4779('0x32')],_0xc7e4d1[_0x4779('0x34')]),_0x335d48);if(_0x5b1b36[_0x4779('0x32')][_0x4779('0x3f')]){_0x986bed[_0x4779('0x3d')]=_[_0x4779('0x40')](_0x986bed[_0x4779('0x3d')],{'$or':_['map'](_0x335d48,function(_0xa48aa1){if(_0xa48aa1['type']!==_0x4779('0x41')){var _0x1cc7da={};_0x1cc7da[_0xa48aa1[_0x4779('0x2c')]]={'$like':'%'+_0x5b1b36[_0x4779('0x32')][_0x4779('0x3f')]+'%'};return _0x1cc7da;}})});}_0x986bed=_[_0x4779('0x40')]({},_0x986bed,_0x5b1b36['options']);var _0x2ab9c3={'where':_0x986bed['where']};return db[_0x4779('0x2e')][_0x4779('0x1e')](_0x2ab9c3)[_0x4779('0x24')](function(_0x3a3589){_0x15da6d[_0x4779('0x1e')]=_0x3a3589;if(_0x5b1b36[_0x4779('0x32')]['includeAll']){_0x986bed[_0x4779('0x42')]=[{'all':!![]}];}return db['Tag'][_0x4779('0x43')](_0x986bed);})[_0x4779('0x24')](function(_0x2e60ab){_0x15da6d['rows']=_0x2e60ab;return _0x15da6d;})[_0x4779('0x24')](respondWithFilteredResult(_0x179717,_0x986bed))[_0x4779('0x44')](handleError(_0x179717,null));};exports[_0x4779('0x45')]=function(_0x15520d,_0xbc5a86){var _0x3b0bfd={'raw':!![],'where':{'id':_0x15520d[_0x4779('0x46')]['id']}},_0x13f768={};_0x13f768[_0x4779('0x31')]=_[_0x4779('0x33')](db[_0x4779('0x2e')][_0x4779('0x2f')]);_0x13f768[_0x4779('0x32')]=_[_0x4779('0x33')](_0x15520d[_0x4779('0x32')]);_0x13f768['filters']=_['intersection'](_0x13f768[_0x4779('0x31')],_0x13f768[_0x4779('0x32')]);_0x3b0bfd[_0x4779('0x36')]=_[_0x4779('0x35')](_0x13f768[_0x4779('0x31')],qs[_0x4779('0x37')](_0x15520d[_0x4779('0x32')][_0x4779('0x37')]));_0x3b0bfd['attributes']=_0x3b0bfd[_0x4779('0x36')][_0x4779('0x38')]?_0x3b0bfd[_0x4779('0x36')]:_0x13f768[_0x4779('0x31')];if(_0x15520d[_0x4779('0x32')][_0x4779('0x47')]){_0x3b0bfd['include']=[{'all':!![]}];}_0x3b0bfd=_[_0x4779('0x40')]({},_0x3b0bfd,_0x15520d[_0x4779('0x48')]);return db[_0x4779('0x2e')][_0x4779('0x49')](_0x3b0bfd)[_0x4779('0x24')](handleEntityNotFound(_0xbc5a86,null))['then'](respondWithResult(_0xbc5a86,null))[_0x4779('0x44')](handleError(_0xbc5a86,null));};exports[_0x4779('0x4a')]=function(_0x3873d4,_0x4a1040){return db[_0x4779('0x2e')]['create'](_0x3873d4[_0x4779('0x4b')],{})[_0x4779('0x24')](function(_0x397216){var _0x4f0aaf=_0x3873d4[_0x4779('0x4c')]['get']({'plain':!![]});if(!_0x4f0aaf)throw new Error(_0x4779('0x4d'));if(_0x4f0aaf[_0x4779('0x4e')]===_0x4779('0x4c')){var _0x58e14e=_0x397216['get']({'plain':!![]});var _0x5dc79a=_0x4779('0x27');return db[_0x4779('0x4f')]['find']({'where':{'name':_0x5dc79a,'userProfileId':_0x4f0aaf[_0x4779('0x50')]},'raw':!![]})[_0x4779('0x24')](function(_0x3c7493){if(_0x3c7493&&_0x3c7493[_0x4779('0x51')]===0x0){return db[_0x4779('0x28')]['create']({'name':_0x58e14e[_0x4779('0x2c')],'resourceId':_0x58e14e['id'],'type':_0x3c7493[_0x4779('0x2c')],'sectionId':_0x3c7493['id']},{})[_0x4779('0x24')](function(){return _0x397216;});}else{return _0x397216;}})[_0x4779('0x44')](function(_0x15c180){logger[_0x4779('0x2a')](_0x4779('0x52'),_0x15c180);throw _0x15c180;});}return _0x397216;})[_0x4779('0x24')](respondWithResult(_0x4a1040,0xc9))['catch'](handleError(_0x4a1040,null));};exports['update']=function(_0x1e4bff,_0x34e951){if(_0x1e4bff[_0x4779('0x4b')]['id']){delete _0x1e4bff[_0x4779('0x4b')]['id'];}return db['Tag'][_0x4779('0x49')]({'where':{'id':_0x1e4bff[_0x4779('0x46')]['id']}})['then'](handleEntityNotFound(_0x34e951,null))[_0x4779('0x24')](saveUpdates(_0x1e4bff[_0x4779('0x4b')],null))[_0x4779('0x24')](respondWithResult(_0x34e951,null))['catch'](handleError(_0x34e951,null));};exports['destroy']=function(_0x225734,_0xe836e0){return db['Tag'][_0x4779('0x49')]({'where':{'id':_0x225734[_0x4779('0x46')]['id']}})[_0x4779('0x24')](handleEntityNotFound(_0xe836e0,null))[_0x4779('0x24')](removeEntity(_0xe836e0,null))[_0x4779('0x44')](handleError(_0xe836e0,null));}; \ No newline at end of file +var _0x9099=['includeAll','findAll','rows','catch','show','keys','length','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','UserProfileResource','update','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','then','get','Tags','destroy','error','stack','name','index','map','Tag','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x407d07,_0x515a81){var _0x562ae8=function(_0x1426d0){while(--_0x1426d0){_0x407d07['push'](_0x407d07['shift']());}};_0x562ae8(++_0x515a81);}(_0x9099,0x1ac));var _0x9909=function(_0x2405bc,_0x2f28a1){_0x2405bc=_0x2405bc-0x0;var _0x5272d4=_0x9099[_0x2405bc];return _0x5272d4;};'use strict';var emlformat=require(_0x9909('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9909('0x1'));var jsonpatch=require(_0x9909('0x2'));var rp=require(_0x9909('0x3'));var moment=require(_0x9909('0x4'));var BPromise=require(_0x9909('0x5'));var Mustache=require(_0x9909('0x6'));var util=require(_0x9909('0x7'));var path=require(_0x9909('0x8'));var sox=require(_0x9909('0x9'));var csv=require(_0x9909('0xa'));var ejs=require(_0x9909('0xb'));var fs=require('fs');var fs_extra=require(_0x9909('0xc'));var _=require(_0x9909('0xd'));var squel=require(_0x9909('0xe'));var crypto=require('crypto');var jsforce=require(_0x9909('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9909('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9909('0x11'));var as=require(_0x9909('0x12'));var hardwareService=require(_0x9909('0x13'));var logger=require('../../config/logger')(_0x9909('0x14'));var utils=require('../../config/utils');var config=require(_0x9909('0x15'));var licenseUtil=require(_0x9909('0x16'));var db=require(_0x9909('0x17'))['db'];function respondWithStatusCode(_0x3ba080,_0x1c69bb){_0x1c69bb=_0x1c69bb||0xcc;return function(_0x5cc11e){if(_0x5cc11e){return _0x3ba080[_0x9909('0x18')](_0x1c69bb);}return _0x3ba080[_0x9909('0x19')](_0x1c69bb)[_0x9909('0x1a')]();};}function respondWithResult(_0xef3295,_0x1c2668){_0x1c2668=_0x1c2668||0xc8;return function(_0x38c2e3){if(_0x38c2e3){return _0xef3295[_0x9909('0x19')](_0x1c2668)['json'](_0x38c2e3);}};}function respondWithFilteredResult(_0x33a8e3,_0x55e800){return function(_0x1f32cc){if(_0x1f32cc){var _0x5bd7e7=typeof _0x55e800[_0x9909('0x1b')]===_0x9909('0x1c')&&typeof _0x55e800[_0x9909('0x1d')]==='undefined';var _0x9a16a6=_0x1f32cc[_0x9909('0x1e')];var _0x180929=_0x5bd7e7?0x0:_0x55e800[_0x9909('0x1b')];var _0x1106e5=_0x5bd7e7?_0x1f32cc[_0x9909('0x1e')]:_0x55e800[_0x9909('0x1b')]+_0x55e800['limit'];var _0x1b038f;if(_0x1106e5>=_0x9a16a6){_0x1106e5=_0x9a16a6;_0x1b038f=0xc8;}else{_0x1b038f=0xce;}_0x33a8e3[_0x9909('0x19')](_0x1b038f);return _0x33a8e3['set'](_0x9909('0x1f'),_0x180929+'-'+_0x1106e5+'/'+_0x9a16a6)[_0x9909('0x20')](_0x1f32cc);}return null;};}function patchUpdates(_0x20c236){return function(_0x1553ae){try{jsonpatch[_0x9909('0x21')](_0x1553ae,_0x20c236,!![]);}catch(_0x222cd9){return BPromise[_0x9909('0x22')](_0x222cd9);}return _0x1553ae['save']();};}function saveUpdates(_0x112727,_0x319c31){return function(_0x4a626b){if(_0x4a626b){return _0x4a626b['update'](_0x112727)[_0x9909('0x23')](function(_0x176593){return _0x176593;});}return null;};}function removeEntity(_0xdd5088,_0x19e66b){return function(_0x2f15fa){if(_0x2f15fa){return _0x2f15fa['destroy']()['then'](function(){var _0x2d83a5=_0x2f15fa[_0x9909('0x24')]({'plain':!![]});var _0x614308=_0x9909('0x25');return db['UserProfileResource'][_0x9909('0x26')]({'where':{'type':_0x614308,'resourceId':_0x2d83a5['id']}})[_0x9909('0x23')](function(){return _0x2f15fa;});})[_0x9909('0x23')](function(){_0xdd5088[_0x9909('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x405c5e,_0x22ff12){return function(_0x19c7e8){if(!_0x19c7e8){_0x405c5e[_0x9909('0x18')](0x194);}return _0x19c7e8;};}function handleError(_0x5250d8,_0xb0b66f){_0xb0b66f=_0xb0b66f||0x1f4;return function(_0x175d52){logger[_0x9909('0x27')](_0x175d52[_0x9909('0x28')]);if(_0x175d52[_0x9909('0x29')]){delete _0x175d52[_0x9909('0x29')];}_0x5250d8[_0x9909('0x19')](_0xb0b66f)['send'](_0x175d52);};}exports[_0x9909('0x2a')]=function(_0x3a3f4f,_0x87ac8a){var _0x42f1e5={},_0x3e4e07={},_0x519066={'count':0x0,'rows':[]};var _0x4245eb=_[_0x9909('0x2b')](db[_0x9909('0x2c')][_0x9909('0x2d')],function(_0xc1bd06){return{'name':_0xc1bd06[_0x9909('0x2e')],'type':_0xc1bd06[_0x9909('0x2f')][_0x9909('0x30')]};});_0x3e4e07['model']=_['map'](_0x4245eb,_0x9909('0x29'));_0x3e4e07[_0x9909('0x31')]=_['keys'](_0x3a3f4f[_0x9909('0x31')]);_0x3e4e07[_0x9909('0x32')]=_[_0x9909('0x33')](_0x3e4e07[_0x9909('0x34')],_0x3e4e07[_0x9909('0x31')]);_0x42f1e5[_0x9909('0x35')]=_[_0x9909('0x33')](_0x3e4e07['model'],qs[_0x9909('0x36')](_0x3a3f4f[_0x9909('0x31')][_0x9909('0x36')]));_0x42f1e5[_0x9909('0x35')]=_0x42f1e5[_0x9909('0x35')]['length']?_0x42f1e5[_0x9909('0x35')]:_0x3e4e07[_0x9909('0x34')];if(!_0x3a3f4f['query'][_0x9909('0x37')](_0x9909('0x38'))){_0x42f1e5[_0x9909('0x1d')]=qs[_0x9909('0x1d')](_0x3a3f4f[_0x9909('0x31')][_0x9909('0x1d')]);_0x42f1e5['offset']=qs[_0x9909('0x1b')](_0x3a3f4f[_0x9909('0x31')][_0x9909('0x1b')]);}_0x42f1e5[_0x9909('0x39')]=qs[_0x9909('0x3a')](_0x3a3f4f[_0x9909('0x31')][_0x9909('0x3a')]);_0x42f1e5[_0x9909('0x3b')]=qs[_0x9909('0x32')](_[_0x9909('0x3c')](_0x3a3f4f[_0x9909('0x31')],_0x3e4e07[_0x9909('0x32')]),_0x4245eb);if(_0x3a3f4f[_0x9909('0x31')][_0x9909('0x3d')]){_0x42f1e5[_0x9909('0x3b')]=_[_0x9909('0x3e')](_0x42f1e5[_0x9909('0x3b')],{'$or':_[_0x9909('0x2b')](_0x4245eb,function(_0x1b5e2b){if(_0x1b5e2b[_0x9909('0x2f')]!==_0x9909('0x3f')){var _0x1b224d={};_0x1b224d[_0x1b5e2b[_0x9909('0x29')]]={'$like':'%'+_0x3a3f4f['query']['filter']+'%'};return _0x1b224d;}})});}_0x42f1e5=_[_0x9909('0x3e')]({},_0x42f1e5,_0x3a3f4f['options']);var _0x52724f={'where':_0x42f1e5[_0x9909('0x3b')]};return db[_0x9909('0x2c')][_0x9909('0x1e')](_0x52724f)[_0x9909('0x23')](function(_0x556fad){_0x519066[_0x9909('0x1e')]=_0x556fad;if(_0x3a3f4f[_0x9909('0x31')][_0x9909('0x40')]){_0x42f1e5['include']=[{'all':!![]}];}return db[_0x9909('0x2c')][_0x9909('0x41')](_0x42f1e5);})[_0x9909('0x23')](function(_0x4b0a4c){_0x519066[_0x9909('0x42')]=_0x4b0a4c;return _0x519066;})[_0x9909('0x23')](respondWithFilteredResult(_0x87ac8a,_0x42f1e5))[_0x9909('0x43')](handleError(_0x87ac8a,null));};exports[_0x9909('0x44')]=function(_0x1f57bd,_0x856057){var _0xef5aa6={'raw':!![],'where':{'id':_0x1f57bd['params']['id']}},_0x3b1844={};_0x3b1844[_0x9909('0x34')]=_[_0x9909('0x45')](db['Tag'][_0x9909('0x2d')]);_0x3b1844[_0x9909('0x31')]=_['keys'](_0x1f57bd['query']);_0x3b1844[_0x9909('0x32')]=_[_0x9909('0x33')](_0x3b1844[_0x9909('0x34')],_0x3b1844[_0x9909('0x31')]);_0xef5aa6[_0x9909('0x35')]=_[_0x9909('0x33')](_0x3b1844[_0x9909('0x34')],qs[_0x9909('0x36')](_0x1f57bd[_0x9909('0x31')][_0x9909('0x36')]));_0xef5aa6['attributes']=_0xef5aa6[_0x9909('0x35')][_0x9909('0x46')]?_0xef5aa6[_0x9909('0x35')]:_0x3b1844[_0x9909('0x34')];if(_0x1f57bd['query']['includeAll']){_0xef5aa6[_0x9909('0x47')]=[{'all':!![]}];}_0xef5aa6=_['merge']({},_0xef5aa6,_0x1f57bd[_0x9909('0x48')]);return db[_0x9909('0x2c')][_0x9909('0x49')](_0xef5aa6)['then'](handleEntityNotFound(_0x856057,null))[_0x9909('0x23')](respondWithResult(_0x856057,null))[_0x9909('0x43')](handleError(_0x856057,null));};exports[_0x9909('0x4a')]=function(_0x54152c,_0x271984){return db[_0x9909('0x2c')][_0x9909('0x4a')](_0x54152c[_0x9909('0x4b')],{})[_0x9909('0x23')](function(_0x137fb6){var _0x8fbd0c=_0x54152c['user'][_0x9909('0x24')]({'plain':!![]});if(!_0x8fbd0c)throw new Error(_0x9909('0x4c'));if(_0x8fbd0c['role']===_0x9909('0x4d')){var _0x240947=_0x137fb6[_0x9909('0x24')]({'plain':!![]});var _0x37697d=_0x9909('0x25');return db['UserProfileSection'][_0x9909('0x49')]({'where':{'name':_0x37697d,'userProfileId':_0x8fbd0c['userProfileId']},'raw':!![]})[_0x9909('0x23')](function(_0x159e08){if(_0x159e08&&_0x159e08[_0x9909('0x4e')]===0x0){return db[_0x9909('0x4f')][_0x9909('0x4a')]({'name':_0x240947[_0x9909('0x29')],'resourceId':_0x240947['id'],'type':_0x159e08[_0x9909('0x29')],'sectionId':_0x159e08['id']},{})[_0x9909('0x23')](function(){return _0x137fb6;});}else{return _0x137fb6;}})['catch'](function(_0x51b214){logger[_0x9909('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x51b214);throw _0x51b214;});}return _0x137fb6;})['then'](respondWithResult(_0x271984,0xc9))[_0x9909('0x43')](handleError(_0x271984,null));};exports[_0x9909('0x50')]=function(_0x49659a,_0x1144e0){if(_0x49659a[_0x9909('0x4b')]['id']){delete _0x49659a[_0x9909('0x4b')]['id'];}return db[_0x9909('0x2c')][_0x9909('0x49')]({'where':{'id':_0x49659a[_0x9909('0x51')]['id']}})['then'](handleEntityNotFound(_0x1144e0,null))[_0x9909('0x23')](saveUpdates(_0x49659a[_0x9909('0x4b')],null))['then'](respondWithResult(_0x1144e0,null))['catch'](handleError(_0x1144e0,null));};exports[_0x9909('0x26')]=function(_0x508b6a,_0x180cf5){return db[_0x9909('0x2c')][_0x9909('0x49')]({'where':{'id':_0x508b6a[_0x9909('0x51')]['id']}})['then'](handleEntityNotFound(_0x180cf5,null))['then'](removeEntity(_0x180cf5,null))['catch'](handleError(_0x180cf5,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index cbff002..cb2e57a 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 _0x8a9c=['Tag','tools_tags','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./tag.attributes','exports','define'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x8a9c,0x12d));var _0xc8a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a9c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc8a9('0x0'));var util=require(_0xc8a9('0x1'));var logger=require(_0xc8a9('0x2'))(_0xc8a9('0x3'));var moment=require(_0xc8a9('0x4'));var BPromise=require('bluebird');var rp=require(_0xc8a9('0x5'));var fs=require('fs');var path=require(_0xc8a9('0x6'));var rimraf=require('rimraf');var config=require(_0xc8a9('0x7'));var attributes=require(_0xc8a9('0x8'));module[_0xc8a9('0x9')]=function(_0x4c1e04,_0xb4340b){return _0x4c1e04[_0xc8a9('0xa')](_0xc8a9('0xb'),attributes,{'tableName':_0xc8a9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x757f=['./tag.attributes','define','Tag','tools_tags','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0x757f,0xee));var _0xf757=function(_0x32be82,_0x21b592){_0x32be82=_0x32be82-0x0;var _0x35aa04=_0x757f[_0x32be82];return _0x35aa04;};'use strict';var _=require(_0xf757('0x0'));var util=require('util');var logger=require(_0xf757('0x1'))(_0xf757('0x2'));var moment=require(_0xf757('0x3'));var BPromise=require(_0xf757('0x4'));var rp=require(_0xf757('0x5'));var fs=require('fs');var path=require(_0xf757('0x6'));var rimraf=require(_0xf757('0x7'));var config=require(_0xf757('0x8'));var attributes=require(_0xf757('0x9'));module['exports']=function(_0x36b04b,_0x30ccea){return _0x36b04b[_0xf757('0xa')](_0xf757('0xb'),attributes,{'tableName':_0xf757('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 eba7f35..34cba79 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 _0x919e=['client','http','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','Tag,\x20%s,\x20%s','message','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x34dbf7,_0x32f0ad){var _0x509757=function(_0x502cc5){while(--_0x502cc5){_0x34dbf7['push'](_0x34dbf7['shift']());}};_0x509757(++_0x32f0ad);}(_0x919e,0x1d7));var _0xe919=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x919e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe919('0x0'));var util=require(_0xe919('0x1'));var moment=require(_0xe919('0x2'));var BPromise=require('bluebird');var rs=require(_0xe919('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe919('0x4'));var logger=require(_0xe919('0x5'))(_0xe919('0x6'));var config=require(_0xe919('0x7'));var jayson=require(_0xe919('0x8'));var client=jayson[_0xe919('0x9')][_0xe919('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x493b47,_0x7c1fa4,_0x2ceb41){return new BPromise(function(_0x57c3fe,_0x44d418){return client['request'](_0x493b47,_0x2ceb41)[_0xe919('0xb')](function(_0x22ea65){logger[_0xe919('0xc')]('Tag,\x20%s,\x20%s',_0x7c1fa4,_0xe919('0xd'));logger[_0xe919('0xe')](_0xe919('0xf'),_0x7c1fa4,'request\x20sent',JSON[_0xe919('0x10')](_0x22ea65));if(_0x22ea65['error']){if(_0x22ea65['error']['code']===0x1f4){logger[_0xe919('0x11')](_0xe919('0x12'),_0x7c1fa4,_0x22ea65[_0xe919('0x11')]['message']);return _0x44d418(_0x22ea65['error'][_0xe919('0x13')]);}logger[_0xe919('0x11')]('Tag,\x20%s,\x20%s',_0x7c1fa4,_0x22ea65[_0xe919('0x11')][_0xe919('0x13')]);return _0x57c3fe(_0x22ea65[_0xe919('0x11')][_0xe919('0x13')]);}else{logger[_0xe919('0xc')](_0xe919('0x12'),_0x7c1fa4,_0xe919('0xd'));_0x57c3fe(_0x22ea65['result'][_0xe919('0x13')]);}})['catch'](function(_0x5ba7ad){logger[_0xe919('0x11')](_0xe919('0x12'),_0x7c1fa4,_0x5ba7ad);_0x44d418(_0x5ba7ad);});});} \ No newline at end of file +var _0x3937=['error','code','Tag,\x20%s,\x20%s','message','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x225b4b,_0xf57141){var _0x256965=function(_0x44fd7e){while(--_0x44fd7e){_0x225b4b['push'](_0x225b4b['shift']());}};_0x256965(++_0xf57141);}(_0x3937,0xbf));var _0x7393=function(_0x18cd3c,_0x44f48f){_0x18cd3c=_0x18cd3c-0x0;var _0x49af3e=_0x3937[_0x18cd3c];return _0x49af3e;};'use strict';var _=require(_0x7393('0x0'));var util=require('util');var moment=require(_0x7393('0x1'));var BPromise=require(_0x7393('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7393('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7393('0x4'));var logger=require('../../config/logger')(_0x7393('0x5'));var config=require(_0x7393('0x6'));var jayson=require(_0x7393('0x7'));var client=jayson[_0x7393('0x8')][_0x7393('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42bdd1,_0x3f0800,_0x26668a){return new BPromise(function(_0x944b0b,_0x4efb50){return client['request'](_0x42bdd1,_0x26668a)[_0x7393('0xa')](function(_0x3b7bbc){logger[_0x7393('0xb')]('Tag,\x20%s,\x20%s',_0x3f0800,_0x7393('0xc'));logger['debug']('Tag,\x20%s,\x20%s,\x20%s',_0x3f0800,'request\x20sent',JSON['stringify'](_0x3b7bbc));if(_0x3b7bbc[_0x7393('0xd')]){if(_0x3b7bbc[_0x7393('0xd')][_0x7393('0xe')]===0x1f4){logger['error'](_0x7393('0xf'),_0x3f0800,_0x3b7bbc[_0x7393('0xd')][_0x7393('0x10')]);return _0x4efb50(_0x3b7bbc[_0x7393('0xd')][_0x7393('0x10')]);}logger[_0x7393('0xd')](_0x7393('0xf'),_0x3f0800,_0x3b7bbc[_0x7393('0xd')][_0x7393('0x10')]);return _0x944b0b(_0x3b7bbc['error']['message']);}else{logger[_0x7393('0xb')]('Tag,\x20%s,\x20%s',_0x3f0800,'request\x20sent');_0x944b0b(_0x3b7bbc['result'][_0x7393('0x10')]);}})['catch'](function(_0x2a1180){logger[_0x7393('0xd')]('Tag,\x20%s,\x20%s',_0x3f0800,_0x2a1180);_0x4efb50(_0x2a1180);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 5c6794d..a26b75b 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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 f29d3fb..17adf77 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 _0x2032=['name','exports','STRING'];(function(_0x20a17e,_0x256cb9){var _0x531898=function(_0xdca534){while(--_0xdca534){_0x20a17e['push'](_0x20a17e['shift']());}};_0x531898(++_0x256cb9);}(_0x2032,0xd9));var _0x2203=function(_0x401af7,_0x5bbf0e){_0x401af7=_0x401af7-0x0;var _0x1db3b6=_0x2032[_0x401af7];return _0x1db3b6;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x20ec6e,_0x3286ea){var _0x3c6ca=function(_0x3e4791){while(--_0x3e4791){_0x20ec6e['push'](_0x20ec6e['shift']());}};_0x3c6ca(++_0x3286ea);}(_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 diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 3a0da90..96da38b 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 _0xcc8f=['SIP/%s','penalty','all','spread','Sms','transaction','parse','Queue:remove','removeAgents','getAgents','nolimit','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./team.socket','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Teams','error','stack','name','index','map','Team','fieldName','type','query','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','keys','length','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','rawAttributes','addQueues','Sequelize','add','ids','isValidChannel','remove','Queues','addAgents','Voice','Chat','Fax','Openchannel','Whatsapp','sequelize','through','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','online','interface','UserVoiceQueueRt','upsert','isNil'];(function(_0x544a22,_0x4f762e){var _0x45911f=function(_0x26a6eb){while(--_0x26a6eb){_0x544a22['push'](_0x544a22['shift']());}};_0x45911f(++_0x4f762e);}(_0xcc8f,0x10d));var _0xfcc8=function(_0x3aaf10,_0x2117a2){_0x3aaf10=_0x3aaf10-0x0;var _0x83c78a=_0xcc8f[_0x3aaf10];return _0x83c78a;};'use strict';var emlformat=require(_0xfcc8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfcc8('0x1'));var rp=require(_0xfcc8('0x2'));var moment=require('moment');var BPromise=require(_0xfcc8('0x3'));var Mustache=require(_0xfcc8('0x4'));var util=require(_0xfcc8('0x5'));var path=require(_0xfcc8('0x6'));var sox=require('sox');var csv=require(_0xfcc8('0x7'));var ejs=require(_0xfcc8('0x8'));var fs=require('fs');var fs_extra=require(_0xfcc8('0x9'));var _=require(_0xfcc8('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfcc8('0xb'));var toCsv=require(_0xfcc8('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfcc8('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xfcc8('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfcc8('0xe'));var logger=require(_0xfcc8('0xf'))(_0xfcc8('0x10'));var utils=require(_0xfcc8('0x11'));var config=require(_0xfcc8('0x12'));var licenseUtil=require(_0xfcc8('0x13'));var db=require(_0xfcc8('0x14'))['db'];config['redis']=_[_0xfcc8('0x15')](config[_0xfcc8('0x16')],{'host':_0xfcc8('0x17'),'port':0x18eb});var socket=require(_0xfcc8('0x18'))(new Redis(config['redis']));require(_0xfcc8('0x19'))['register'](socket);function respondWithStatusCode(_0x302b18,_0x25f611){_0x25f611=_0x25f611||0xcc;return function(_0x1383b5){if(_0x1383b5){return _0x302b18[_0xfcc8('0x1a')](_0x25f611);}return _0x302b18[_0xfcc8('0x1b')](_0x25f611)[_0xfcc8('0x1c')]();};}function respondWithResult(_0x202485,_0x4de9bc){_0x4de9bc=_0x4de9bc||0xc8;return function(_0x2f7de4){if(_0x2f7de4){return _0x202485[_0xfcc8('0x1b')](_0x4de9bc)[_0xfcc8('0x1d')](_0x2f7de4);}};}function respondWithFilteredResult(_0x4f9a33,_0x218ce6){return function(_0x171a28){if(_0x171a28){var _0x38c86a=typeof _0x218ce6['offset']==='undefined'&&typeof _0x218ce6[_0xfcc8('0x1e')]==='undefined';var _0x24005d=_0x171a28[_0xfcc8('0x1f')];var _0x22cdc4=_0x38c86a?0x0:_0x218ce6[_0xfcc8('0x20')];var _0x14e035=_0x38c86a?_0x171a28[_0xfcc8('0x1f')]:_0x218ce6[_0xfcc8('0x20')]+_0x218ce6[_0xfcc8('0x1e')];var _0x54898e;if(_0x14e035>=_0x24005d){_0x14e035=_0x24005d;_0x54898e=0xc8;}else{_0x54898e=0xce;}_0x4f9a33[_0xfcc8('0x1b')](_0x54898e);return _0x4f9a33[_0xfcc8('0x21')](_0xfcc8('0x22'),_0x22cdc4+'-'+_0x14e035+'/'+_0x24005d)[_0xfcc8('0x1d')](_0x171a28);}return null;};}function patchUpdates(_0x14888f){return function(_0x3c2f75){try{jsonpatch[_0xfcc8('0x23')](_0x3c2f75,_0x14888f,!![]);}catch(_0x1c35a8){return BPromise[_0xfcc8('0x24')](_0x1c35a8);}return _0x3c2f75[_0xfcc8('0x25')]();};}function saveUpdates(_0xa9f222,_0x2e4505){return function(_0x546cac){if(_0x546cac){return _0x546cac[_0xfcc8('0x26')](_0xa9f222)[_0xfcc8('0x27')](function(_0x23390f){return _0x23390f;});}return null;};}function removeEntity(_0x2c7a60,_0x1458ba){return function(_0x315c43){if(_0x315c43){return _0x315c43[_0xfcc8('0x28')]()[_0xfcc8('0x27')](function(){var _0x39cf29=_0x315c43[_0xfcc8('0x29')]({'plain':!![]});var _0x340f20=_0xfcc8('0x2a');return db['UserProfileResource'][_0xfcc8('0x28')]({'where':{'type':_0x340f20,'resourceId':_0x39cf29['id']}})[_0xfcc8('0x27')](function(){return _0x315c43;});})[_0xfcc8('0x27')](function(){_0x2c7a60[_0xfcc8('0x1b')](0xcc)[_0xfcc8('0x1c')]();});}};}function handleEntityNotFound(_0x74ab56,_0x51de27){return function(_0x3f3b90){if(!_0x3f3b90){_0x74ab56[_0xfcc8('0x1a')](0x194);}return _0x3f3b90;};}function handleError(_0x38c5b0,_0x2308d2){_0x2308d2=_0x2308d2||0x1f4;return function(_0x1fa740){logger[_0xfcc8('0x2b')](_0x1fa740[_0xfcc8('0x2c')]);if(_0x1fa740[_0xfcc8('0x2d')]){delete _0x1fa740[_0xfcc8('0x2d')];}_0x38c5b0['status'](_0x2308d2)['send'](_0x1fa740);};}exports[_0xfcc8('0x2e')]=function(_0x56b589,_0x1eb1ee){var _0x28cec1={},_0xae163b={},_0x44c979={'count':0x0,'rows':[]};var _0xd742e3=_[_0xfcc8('0x2f')](db[_0xfcc8('0x30')]['rawAttributes'],function(_0x300bfa){return{'name':_0x300bfa[_0xfcc8('0x31')],'type':_0x300bfa[_0xfcc8('0x32')]['key']};});_0xae163b['model']=_['map'](_0xd742e3,'name');_0xae163b[_0xfcc8('0x33')]=_['keys'](_0x56b589['query']);_0xae163b[_0xfcc8('0x34')]=_[_0xfcc8('0x35')](_0xae163b['model'],_0xae163b[_0xfcc8('0x33')]);_0x28cec1[_0xfcc8('0x36')]=_['intersection'](_0xae163b[_0xfcc8('0x37')],qs[_0xfcc8('0x38')](_0x56b589['query'][_0xfcc8('0x38')]));_0x28cec1[_0xfcc8('0x36')]=_0x28cec1[_0xfcc8('0x36')]['length']?_0x28cec1[_0xfcc8('0x36')]:_0xae163b[_0xfcc8('0x37')];if(!_0x56b589['query'][_0xfcc8('0x39')]('nolimit')){_0x28cec1[_0xfcc8('0x1e')]=qs['limit'](_0x56b589[_0xfcc8('0x33')][_0xfcc8('0x1e')]);_0x28cec1[_0xfcc8('0x20')]=qs['offset'](_0x56b589[_0xfcc8('0x33')]['offset']);}_0x28cec1[_0xfcc8('0x3a')]=qs[_0xfcc8('0x3b')](_0x56b589[_0xfcc8('0x33')][_0xfcc8('0x3b')]);_0x28cec1[_0xfcc8('0x3c')]=qs[_0xfcc8('0x34')](_[_0xfcc8('0x3d')](_0x56b589[_0xfcc8('0x33')],_0xae163b[_0xfcc8('0x34')]),_0xd742e3);if(_0x56b589[_0xfcc8('0x33')][_0xfcc8('0x3e')]){_0x28cec1[_0xfcc8('0x3c')]=_[_0xfcc8('0x3f')](_0x28cec1[_0xfcc8('0x3c')],{'$or':_[_0xfcc8('0x2f')](_0xd742e3,function(_0x281ca0){if(_0x281ca0['type']!==_0xfcc8('0x40')){var _0x42000f={};_0x42000f[_0x281ca0[_0xfcc8('0x2d')]]={'$like':'%'+_0x56b589['query']['filter']+'%'};return _0x42000f;}})});}_0x28cec1=_[_0xfcc8('0x3f')]({},_0x28cec1,_0x56b589['options']);var _0x480ce2={'where':_0x28cec1[_0xfcc8('0x3c')]};return db[_0xfcc8('0x30')][_0xfcc8('0x1f')](_0x480ce2)['then'](function(_0xe96f5d){_0x44c979[_0xfcc8('0x1f')]=_0xe96f5d;if(_0x56b589[_0xfcc8('0x33')][_0xfcc8('0x41')]){_0x28cec1[_0xfcc8('0x42')]=[{'all':!![]}];}return db['Team']['findAll'](_0x28cec1);})[_0xfcc8('0x27')](function(_0x404289){_0x44c979[_0xfcc8('0x43')]=_0x404289;return _0x44c979;})[_0xfcc8('0x27')](respondWithFilteredResult(_0x1eb1ee,_0x28cec1))[_0xfcc8('0x44')](handleError(_0x1eb1ee,null));};exports[_0xfcc8('0x45')]=function(_0x587434,_0x4df93d){var _0x2f5e56={'raw':![],'where':{'id':_0x587434[_0xfcc8('0x46')]['id']}},_0xe21e1f={};_0xe21e1f[_0xfcc8('0x37')]=_[_0xfcc8('0x47')](db[_0xfcc8('0x30')]['rawAttributes']);_0xe21e1f[_0xfcc8('0x33')]=_[_0xfcc8('0x47')](_0x587434[_0xfcc8('0x33')]);_0xe21e1f[_0xfcc8('0x34')]=_['intersection'](_0xe21e1f[_0xfcc8('0x37')],_0xe21e1f[_0xfcc8('0x33')]);_0x2f5e56[_0xfcc8('0x36')]=_[_0xfcc8('0x35')](_0xe21e1f[_0xfcc8('0x37')],qs[_0xfcc8('0x38')](_0x587434[_0xfcc8('0x33')][_0xfcc8('0x38')]));_0x2f5e56[_0xfcc8('0x36')]=_0x2f5e56['attributes'][_0xfcc8('0x48')]?_0x2f5e56['attributes']:_0xe21e1f[_0xfcc8('0x37')];if(_0x587434['query'][_0xfcc8('0x41')]){_0x2f5e56['include']=[{'all':!![]}];}_0x2f5e56=_['merge']({},_0x2f5e56,_0x587434[_0xfcc8('0x49')]);return db[_0xfcc8('0x30')][_0xfcc8('0x4a')](_0x2f5e56)[_0xfcc8('0x27')](handleEntityNotFound(_0x4df93d,null))['then'](respondWithResult(_0x4df93d,null))['catch'](handleError(_0x4df93d,null));};exports[_0xfcc8('0x4b')]=function(_0x1d09d8,_0x3652d1){return db[_0xfcc8('0x30')][_0xfcc8('0x4b')](_0x1d09d8['body'],{})[_0xfcc8('0x27')](function(_0x11e7aa){var _0x217273=_0x1d09d8['user']['get']({'plain':!![]});if(!_0x217273)throw new Error(_0xfcc8('0x4c'));if(_0x217273[_0xfcc8('0x4d')]===_0xfcc8('0x4e')){var _0x188b60=_0x11e7aa[_0xfcc8('0x29')]({'plain':!![]});var _0x11dde3=_0xfcc8('0x2a');return db[_0xfcc8('0x4f')][_0xfcc8('0x4a')]({'where':{'name':_0x11dde3,'userProfileId':_0x217273[_0xfcc8('0x50')]},'raw':!![]})['then'](function(_0x40ecfb){if(_0x40ecfb&&_0x40ecfb['autoAssociation']===0x0){return db[_0xfcc8('0x51')][_0xfcc8('0x4b')]({'name':_0x188b60[_0xfcc8('0x2d')],'resourceId':_0x188b60['id'],'type':_0x40ecfb[_0xfcc8('0x2d')],'sectionId':_0x40ecfb['id']},{})[_0xfcc8('0x27')](function(){return _0x11e7aa;});}else{return _0x11e7aa;}})[_0xfcc8('0x44')](function(_0x30b963){logger['error'](_0xfcc8('0x52'),_0x30b963);throw _0x30b963;});}return _0x11e7aa;})[_0xfcc8('0x27')](respondWithResult(_0x3652d1,0xc9))[_0xfcc8('0x44')](handleError(_0x3652d1,null));};exports[_0xfcc8('0x26')]=function(_0x976595,_0xdba5a0){if(_0x976595[_0xfcc8('0x53')]['id']){delete _0x976595['body']['id'];}return db[_0xfcc8('0x30')][_0xfcc8('0x4a')]({'where':{'id':_0x976595[_0xfcc8('0x46')]['id']}})[_0xfcc8('0x27')](handleEntityNotFound(_0xdba5a0,null))['then'](saveUpdates(_0x976595[_0xfcc8('0x53')],null))[_0xfcc8('0x27')](respondWithResult(_0xdba5a0,null))[_0xfcc8('0x44')](handleError(_0xdba5a0,null));};exports[_0xfcc8('0x28')]=function(_0x57dcc9,_0xcfe31b){return db[_0xfcc8('0x30')][_0xfcc8('0x4a')]({'where':{'id':_0x57dcc9[_0xfcc8('0x46')]['id']}})[_0xfcc8('0x27')](handleEntityNotFound(_0xcfe31b,null))['then'](removeEntity(_0xcfe31b,null))[_0xfcc8('0x44')](handleError(_0xcfe31b,null));};exports['getQueues']=function(_0x113b2c,_0x575d3e,_0xcd6638){return db[_0xfcc8('0x30')][_0xfcc8('0x54')]({'where':{'id':_0x113b2c[_0xfcc8('0x46')]['id']}})[_0xfcc8('0x27')](handleEntityNotFound(_0x575d3e,null))[_0xfcc8('0x27')](function(_0x586185){if(!_0x113b2c[_0xfcc8('0x33')][_0xfcc8('0x55')]||!utils['isValidChannel'](_0x113b2c['query'][_0xfcc8('0x55')])){throw new db['Sequelize'][(_0xfcc8('0x56'))](_0xfcc8('0x57'));}var _0x53dd1f={};var _0x19f0f5={};_0x19f0f5[_0xfcc8('0x37')]=_[_0xfcc8('0x47')](db[_[_0xfcc8('0x58')](_0x113b2c[_0xfcc8('0x33')][_0xfcc8('0x55')][_0xfcc8('0x59')]())+_0xfcc8('0x5a')][_0xfcc8('0x5b')]);_0x19f0f5['query']=_['keys'](_0x113b2c[_0xfcc8('0x33')]);_0x19f0f5[_0xfcc8('0x34')]=_[_0xfcc8('0x35')](_0x19f0f5[_0xfcc8('0x37')],_0x19f0f5[_0xfcc8('0x33')]);_0x53dd1f['attributes']=_['intersection'](_0x19f0f5[_0xfcc8('0x37')],qs[_0xfcc8('0x38')](_0x113b2c[_0xfcc8('0x33')]['fields']));_0x53dd1f['attributes']=_0x53dd1f[_0xfcc8('0x36')][_0xfcc8('0x48')]?_0x53dd1f[_0xfcc8('0x36')]:_0x19f0f5[_0xfcc8('0x37')];_0x53dd1f[_0xfcc8('0x1e')]=qs[_0xfcc8('0x1e')](_0x113b2c['query'][_0xfcc8('0x1e')]);_0x53dd1f[_0xfcc8('0x20')]=qs['offset'](_0x113b2c[_0xfcc8('0x33')][_0xfcc8('0x20')]);_0x53dd1f['order']=qs[_0xfcc8('0x3b')](_0x113b2c['query'][_0xfcc8('0x3b')]);_0x53dd1f[_0xfcc8('0x3c')]=qs[_0xfcc8('0x34')](_[_0xfcc8('0x3d')](_0x113b2c[_0xfcc8('0x33')],_0x19f0f5['filters']));_0x53dd1f=_[_0xfcc8('0x3f')]({},_0x53dd1f,_0x113b2c[_0xfcc8('0x49')]);return _0x586185[_0xfcc8('0x29')+_[_0xfcc8('0x58')](_0x113b2c[_0xfcc8('0x33')][_0xfcc8('0x55')][_0xfcc8('0x59')]())+'Queues'](_0x53dd1f);})['then'](respondWithResult(_0x575d3e,null))[_0xfcc8('0x44')](handleError(_0x575d3e,null));};exports[_0xfcc8('0x5c')]=function(_0x168821,_0x34a548,_0x584e92){return db['Team'][_0xfcc8('0x54')]({'where':{'id':_0x168821[_0xfcc8('0x46')]['id']}})[_0xfcc8('0x27')](function(_0x2750b6){if(_0x2750b6){if(!_0x168821[_0xfcc8('0x53')][_0xfcc8('0x55')]||!utils['isValidChannel'](_0x168821['body'][_0xfcc8('0x55')])){throw new db[(_0xfcc8('0x5d'))]['ValidationError'](_0xfcc8('0x57'));}return _0x2750b6[_0xfcc8('0x5e')+_[_0xfcc8('0x58')](_0x168821[_0xfcc8('0x53')]['channel'][_0xfcc8('0x59')]())+'Queues'](_0x168821['body'][_0xfcc8('0x5f')]);}return null;})[_0xfcc8('0x27')](handleEntityNotFound(_0x34a548,null))[_0xfcc8('0x27')](respondWithStatusCode(_0x34a548,null))['catch'](handleError(_0x34a548,null));};exports['removeQueues']=function(_0x2c99a1,_0x5e9629,_0x17fcfc){return db[_0xfcc8('0x30')][_0xfcc8('0x54')]({'where':{'id':_0x2c99a1[_0xfcc8('0x46')]['id']}})['then'](function(_0x186db3){if(_0x186db3){if(!_0x2c99a1[_0xfcc8('0x33')][_0xfcc8('0x55')]||!utils[_0xfcc8('0x60')](_0x2c99a1[_0xfcc8('0x33')][_0xfcc8('0x55')])){throw new db[(_0xfcc8('0x5d'))][(_0xfcc8('0x56'))](_0xfcc8('0x57'));}return _0x186db3[_0xfcc8('0x61')+_['capitalize'](_0x2c99a1[_0xfcc8('0x33')][_0xfcc8('0x55')][_0xfcc8('0x59')]())+_0xfcc8('0x62')](_0x2c99a1[_0xfcc8('0x33')][_0xfcc8('0x5f')]);}return null;})[_0xfcc8('0x27')](handleEntityNotFound(_0x5e9629,null))[_0xfcc8('0x27')](respondWithStatusCode(_0x5e9629,null))[_0xfcc8('0x44')](handleError(_0x5e9629,null));};exports[_0xfcc8('0x63')]=function(_0x463b20,_0x528353){return db['Team']['find']({'where':{'id':_0x463b20[_0xfcc8('0x46')]['id']}})['then'](handleEntityNotFound(_0x528353,null))[_0xfcc8('0x27')](function(_0x2745e5){if(_0x2745e5){var _0x541b2a=[_0xfcc8('0x64'),_0xfcc8('0x65'),'Mail','Sms',_0xfcc8('0x66'),_0xfcc8('0x67'),_0xfcc8('0x68')];return db[_0xfcc8('0x69')]['transaction'](function(_0xc7d18a){var _0x5267a6=_['map'](_0x541b2a,function(_0x2d44d8){var _0x2e8b8f={'attributes':['id',_0xfcc8('0x2d')]};if(_0x2d44d8===_0xfcc8('0x64')){_0x2e8b8f[_0xfcc8('0x6a')]={'attributes':['penalty']};}return _0x2745e5[_0xfcc8('0x29')+_0x2d44d8+_0xfcc8('0x62')](_0x2e8b8f)[_0xfcc8('0x27')](function(_0x5808d7){var _0x4a7c7e=_['map'](_0x5808d7,function(_0x441b30){var _0x397377=_['map'](_0x463b20[_0xfcc8('0x53')][_0xfcc8('0x5f')],function(_0x3c2ea1){var _0x26f427={'where':{'UserId':_0x3c2ea1,[_0x2d44d8+_0xfcc8('0x6b')]:_0x441b30['id']},'transaction':_0xc7d18a};if(_0x2d44d8===_0xfcc8('0x64')){_0x26f427['defaults']={'penalty':_0x441b30[_0xfcc8('0x6c')]['penalty']};}return db[_0xfcc8('0x6d')+_0x2d44d8+_0xfcc8('0x5a')][_0xfcc8('0x6e')](_0x26f427)['then'](function(){socket[_0xfcc8('0x6f')]('user'+_0x2d44d8+_0xfcc8('0x70'),{'UserId':_0x3c2ea1,[_0x2d44d8+'QueueId']:_0x441b30['id']});if(_0x2d44d8!==_0xfcc8('0x64'))return;return db[_0xfcc8('0x6d')]['findAll']({'where':{'id':_0x463b20[_0xfcc8('0x53')]['ids'],'online':0x1},'attributes':['id',_0xfcc8('0x2d'),_0xfcc8('0x71'),'voicePause',_0xfcc8('0x72')],'raw':!![]})[_0xfcc8('0x27')](function(_0x279407){var _0x4667ca=_[_0xfcc8('0x2f')](_0x279407,function(_0x4cab8d){return db[_0xfcc8('0x73')][_0xfcc8('0x74')]({'membername':_0x4cab8d[_0xfcc8('0x2d')],'UserId':_0x4cab8d['id'],'queue_name':_0x441b30[_0xfcc8('0x2d')],'VoiceQueueId':_0x441b30['id'],'interface':_[_0xfcc8('0x75')](_0x4cab8d[_0xfcc8('0x72')])?util['format'](_0xfcc8('0x76'),_0x4cab8d[_0xfcc8('0x2d')]):_0x4cab8d[_0xfcc8('0x72')],'paused':_0x4cab8d['voicePause']||![],'penalty':_0x441b30[_0xfcc8('0x6c')][_0xfcc8('0x77')]},{'transaction':_0xc7d18a});});return Promise[_0xfcc8('0x78')](_0x4667ca);});});});return Promise[_0xfcc8('0x78')](_0x397377);});return Promise[_0xfcc8('0x78')](_0x4a7c7e);});});return Promise['all'](_0x5267a6)[_0xfcc8('0x27')](function(){return _0x2745e5[_0xfcc8('0x63')](_0x463b20['body'][_0xfcc8('0x5f')],{'transaction':_0xc7d18a})[_0xfcc8('0x79')](function(_0x25e82d){return _0x25e82d;});});});}})['then'](respondWithResult(_0x528353,null))['catch'](handleError(_0x528353,null));};exports['removeAgents']=function(_0x472a65,_0x290a73){return db[_0xfcc8('0x30')]['find']({'where':{'id':_0x472a65[_0xfcc8('0x46')]['id']}})[_0xfcc8('0x27')](handleEntityNotFound(_0x290a73,null))[_0xfcc8('0x27')](function(_0x512618){if(_0x512618){var _0x4a78a5=[_0xfcc8('0x64'),_0xfcc8('0x65'),'Mail',_0xfcc8('0x7a'),_0xfcc8('0x66'),_0xfcc8('0x67'),_0xfcc8('0x68')];return db[_0xfcc8('0x69')][_0xfcc8('0x7b')](function(_0x21788a){var _0xc81c67=_['map'](_0x4a78a5,function(_0x19cec9){var _0xc2b1cb={'attributes':['id',_0xfcc8('0x2d')]};return _0x512618[_0xfcc8('0x29')+_0x19cec9+_0xfcc8('0x62')](_0xc2b1cb)[_0xfcc8('0x27')](function(_0x3f3065){var _0x3070ca=_[_0xfcc8('0x2f')](_0x3f3065,function(_0x27c68d){return _0x27c68d['removeAgents'](_0x472a65[_0xfcc8('0x33')]['ids'],{'transaction':_0x21788a})[_0xfcc8('0x27')](function(){var _0xd8756f=JSON[_0xfcc8('0x7c')]('['+_0x472a65[_0xfcc8('0x33')][_0xfcc8('0x5f')]+']');var _0x158fb2=_[_0xfcc8('0x2f')](_0xd8756f,function(_0x2c5c0f){socket[_0xfcc8('0x6f')](_0xfcc8('0x4e')+_0x19cec9+_0xfcc8('0x7d'),{'UserId':Number(_0x2c5c0f),[_0x19cec9+_0xfcc8('0x6b')]:_0x27c68d['id']});if(_0x19cec9!=='Voice')return;return db[_0xfcc8('0x73')][_0xfcc8('0x28')]({'where':{'VoiceQueueId':_0x27c68d['id'],'UserId':_0x2c5c0f},'transaction':_0x21788a});});return Promise[_0xfcc8('0x78')](_0x158fb2);});});return Promise[_0xfcc8('0x78')](_0x3070ca);});});return Promise[_0xfcc8('0x78')](_0xc81c67)['then'](function(){return _0x512618[_0xfcc8('0x7e')](_0x472a65['query'][_0xfcc8('0x5f')],{'transaction':_0x21788a});});});}})[_0xfcc8('0x27')](respondWithStatusCode(_0x290a73,null))['catch'](handleError(_0x290a73,null));};exports[_0xfcc8('0x7f')]=function(_0x3e30d8,_0x2e9137,_0x420362){var _0x2db9df={};var _0x2bec94={};var _0x535b36;var _0x307d9e;return db[_0xfcc8('0x30')][_0xfcc8('0x54')]({'where':{'id':_0x3e30d8[_0xfcc8('0x46')]['id']}})[_0xfcc8('0x27')](handleEntityNotFound(_0x2e9137,null))[_0xfcc8('0x27')](function(_0x2b677f){if(_0x2b677f){_0x535b36=_0x2b677f;_0x2bec94['model']=_['keys'](db[_0xfcc8('0x6d')][_0xfcc8('0x5b')]);_0x2bec94[_0xfcc8('0x33')]=_['keys'](_0x3e30d8[_0xfcc8('0x33')]);_0x2bec94[_0xfcc8('0x34')]=_[_0xfcc8('0x35')](_0x2bec94[_0xfcc8('0x37')],_0x2bec94[_0xfcc8('0x33')]);_0x2db9df[_0xfcc8('0x36')]=_['intersection'](_0x2bec94[_0xfcc8('0x37')],qs[_0xfcc8('0x38')](_0x3e30d8[_0xfcc8('0x33')][_0xfcc8('0x38')]));_0x2db9df[_0xfcc8('0x36')]=_0x2db9df['attributes'][_0xfcc8('0x48')]?_0x2db9df[_0xfcc8('0x36')]:_0x2bec94[_0xfcc8('0x37')];_0x2db9df['order']=qs[_0xfcc8('0x3b')](_0x3e30d8[_0xfcc8('0x33')]['sort']);_0x2db9df[_0xfcc8('0x3c')]=qs[_0xfcc8('0x34')](_[_0xfcc8('0x3d')](_0x3e30d8[_0xfcc8('0x33')],_0x2bec94[_0xfcc8('0x34')]));if(_0x3e30d8['query'][_0xfcc8('0x3e')]){_0x2db9df[_0xfcc8('0x3c')]=_[_0xfcc8('0x3f')](_0x2db9df[_0xfcc8('0x3c')],{'$or':_['map'](_0x2db9df[_0xfcc8('0x36')],function(_0x216d14){var _0x44e222={};_0x44e222[_0x216d14]={'$like':'%'+_0x3e30d8[_0xfcc8('0x33')]['filter']+'%'};return _0x44e222;})});}_0x2db9df=_[_0xfcc8('0x3f')]({},_0x2db9df,_0x3e30d8['options']);return _0x535b36[_0xfcc8('0x7f')](_0x2db9df);}})[_0xfcc8('0x27')](function(_0x4d6624){if(_0x4d6624){_0x307d9e=_0x4d6624[_0xfcc8('0x48')];if(!_0x3e30d8[_0xfcc8('0x33')]['hasOwnProperty'](_0xfcc8('0x80'))){_0x2db9df[_0xfcc8('0x1e')]=qs['limit'](_0x3e30d8[_0xfcc8('0x33')][_0xfcc8('0x1e')]);_0x2db9df[_0xfcc8('0x20')]=qs[_0xfcc8('0x20')](_0x3e30d8[_0xfcc8('0x33')]['offset']);}return _0x535b36[_0xfcc8('0x7f')](_0x2db9df);}})['then'](function(_0x42d86c){if(_0x42d86c){return _0x42d86c?{'count':_0x307d9e,'rows':_0x42d86c}:null;}})[_0xfcc8('0x27')](respondWithResult(_0x2e9137,null))['catch'](handleError(_0x2e9137,null));}; \ No newline at end of file +var _0xa3f0=['toLowerCase','Queues','addQueues','Sequelize','add','ids','removeQueues','remove','addAgents','Chat','Sms','Fax','Whatsapp','transaction','Voice','through','TeamVoiceQueue','penalty','User','findOrCreate','emit','Queue:save','QueueId','voicePause','interface','UserVoiceQueueRt','upsert','format','SIP/%s','all','Mail','Openchannel','sequelize','parse','removeAgents','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','redis','defaults','localhost','register','status','end','offset','undefined','limit','count','set','json','reject','update','then','destroy','get','Teams','sendStatus','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','merge','VIRTUAL','filter','options','Team','findAll','rows','catch','params','includeAll','include','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','Queue','order','pick','capitalize'];(function(_0x3d2511,_0x2938e7){var _0x1cc3c0=function(_0x113bd2){while(--_0x113bd2){_0x3d2511['push'](_0x3d2511['shift']());}};_0x1cc3c0(++_0x2938e7);}(_0xa3f0,0x1ad));var _0x0a3f=function(_0x26e3cb,_0x3e38c3){_0x26e3cb=_0x26e3cb-0x0;var _0x15e990=_0xa3f0[_0x26e3cb];return _0x15e990;};'use strict';var emlformat=require(_0x0a3f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0a3f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0a3f('0x2'));var moment=require(_0x0a3f('0x3'));var BPromise=require(_0x0a3f('0x4'));var Mustache=require(_0x0a3f('0x5'));var util=require(_0x0a3f('0x6'));var path=require(_0x0a3f('0x7'));var sox=require('sox');var csv=require(_0x0a3f('0x8'));var ejs=require(_0x0a3f('0x9'));var fs=require('fs');var fs_extra=require(_0x0a3f('0xa'));var _=require(_0x0a3f('0xb'));var squel=require(_0x0a3f('0xc'));var crypto=require(_0x0a3f('0xd'));var jsforce=require(_0x0a3f('0xe'));var deskjs=require(_0x0a3f('0xf'));var toCsv=require(_0x0a3f('0x8'));var querystring=require(_0x0a3f('0x10'));var Papa=require(_0x0a3f('0x11'));var Redis=require(_0x0a3f('0x12'));var authService=require(_0x0a3f('0x13'));var qs=require(_0x0a3f('0x14'));var as=require(_0x0a3f('0x15'));var hardwareService=require(_0x0a3f('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x0a3f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0a3f('0x18'));var db=require('../../mysqldb')['db'];config[_0x0a3f('0x19')]=_[_0x0a3f('0x1a')](config[_0x0a3f('0x19')],{'host':_0x0a3f('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./team.socket')[_0x0a3f('0x1c')](socket);function respondWithStatusCode(_0x5dc34c,_0x1b9b1d){_0x1b9b1d=_0x1b9b1d||0xcc;return function(_0x2af39e){if(_0x2af39e){return _0x5dc34c['sendStatus'](_0x1b9b1d);}return _0x5dc34c[_0x0a3f('0x1d')](_0x1b9b1d)[_0x0a3f('0x1e')]();};}function respondWithResult(_0x1f569c,_0x39f7ab){_0x39f7ab=_0x39f7ab||0xc8;return function(_0x1b0f00){if(_0x1b0f00){return _0x1f569c['status'](_0x39f7ab)['json'](_0x1b0f00);}};}function respondWithFilteredResult(_0x1cc52e,_0x498b91){return function(_0x1d26aa){if(_0x1d26aa){var _0x5bdae7=typeof _0x498b91[_0x0a3f('0x1f')]===_0x0a3f('0x20')&&typeof _0x498b91[_0x0a3f('0x21')]===_0x0a3f('0x20');var _0x2ce2f7=_0x1d26aa['count'];var _0x1dd779=_0x5bdae7?0x0:_0x498b91[_0x0a3f('0x1f')];var _0x39ac1e=_0x5bdae7?_0x1d26aa[_0x0a3f('0x22')]:_0x498b91[_0x0a3f('0x1f')]+_0x498b91[_0x0a3f('0x21')];var _0x20d82f;if(_0x39ac1e>=_0x2ce2f7){_0x39ac1e=_0x2ce2f7;_0x20d82f=0xc8;}else{_0x20d82f=0xce;}_0x1cc52e[_0x0a3f('0x1d')](_0x20d82f);return _0x1cc52e[_0x0a3f('0x23')]('Content-Range',_0x1dd779+'-'+_0x39ac1e+'/'+_0x2ce2f7)[_0x0a3f('0x24')](_0x1d26aa);}return null;};}function patchUpdates(_0x386550){return function(_0xc3759e){try{jsonpatch['apply'](_0xc3759e,_0x386550,!![]);}catch(_0x2547e4){return BPromise[_0x0a3f('0x25')](_0x2547e4);}return _0xc3759e['save']();};}function saveUpdates(_0x270d1a,_0x48276a){return function(_0x5e87b1){if(_0x5e87b1){return _0x5e87b1[_0x0a3f('0x26')](_0x270d1a)[_0x0a3f('0x27')](function(_0x5acf28){return _0x5acf28;});}return null;};}function removeEntity(_0x2ecfd7,_0x1165ed){return function(_0x59496c){if(_0x59496c){return _0x59496c[_0x0a3f('0x28')]()[_0x0a3f('0x27')](function(){var _0x15ac78=_0x59496c[_0x0a3f('0x29')]({'plain':!![]});var _0x47395e=_0x0a3f('0x2a');return db['UserProfileResource'][_0x0a3f('0x28')]({'where':{'type':_0x47395e,'resourceId':_0x15ac78['id']}})[_0x0a3f('0x27')](function(){return _0x59496c;});})[_0x0a3f('0x27')](function(){_0x2ecfd7[_0x0a3f('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f150b,_0x450d72){return function(_0x374737){if(!_0x374737){_0x4f150b[_0x0a3f('0x2b')](0x194);}return _0x374737;};}function handleError(_0x3aa272,_0x3b74c1){_0x3b74c1=_0x3b74c1||0x1f4;return function(_0x1a5bdb){logger[_0x0a3f('0x2c')](_0x1a5bdb[_0x0a3f('0x2d')]);if(_0x1a5bdb[_0x0a3f('0x2e')]){delete _0x1a5bdb['name'];}_0x3aa272['status'](_0x3b74c1)[_0x0a3f('0x2f')](_0x1a5bdb);};}exports['index']=function(_0x34fa26,_0xae90ca){var _0x24ba82={},_0x3a368d={},_0x52bcad={'count':0x0,'rows':[]};var _0x5711d0=_['map'](db['Team'][_0x0a3f('0x30')],function(_0x5b42b8){return{'name':_0x5b42b8[_0x0a3f('0x31')],'type':_0x5b42b8[_0x0a3f('0x32')][_0x0a3f('0x33')]};});_0x3a368d[_0x0a3f('0x34')]=_[_0x0a3f('0x35')](_0x5711d0,_0x0a3f('0x2e'));_0x3a368d['query']=_[_0x0a3f('0x36')](_0x34fa26[_0x0a3f('0x37')]);_0x3a368d[_0x0a3f('0x38')]=_[_0x0a3f('0x39')](_0x3a368d[_0x0a3f('0x34')],_0x3a368d[_0x0a3f('0x37')]);_0x24ba82[_0x0a3f('0x3a')]=_[_0x0a3f('0x39')](_0x3a368d[_0x0a3f('0x34')],qs[_0x0a3f('0x3b')](_0x34fa26['query'][_0x0a3f('0x3b')]));_0x24ba82[_0x0a3f('0x3a')]=_0x24ba82[_0x0a3f('0x3a')][_0x0a3f('0x3c')]?_0x24ba82['attributes']:_0x3a368d[_0x0a3f('0x34')];if(!_0x34fa26['query'][_0x0a3f('0x3d')]('nolimit')){_0x24ba82[_0x0a3f('0x21')]=qs['limit'](_0x34fa26[_0x0a3f('0x37')][_0x0a3f('0x21')]);_0x24ba82['offset']=qs[_0x0a3f('0x1f')](_0x34fa26[_0x0a3f('0x37')][_0x0a3f('0x1f')]);}_0x24ba82['order']=qs[_0x0a3f('0x3e')](_0x34fa26['query']['sort']);_0x24ba82[_0x0a3f('0x3f')]=qs[_0x0a3f('0x38')](_['pick'](_0x34fa26[_0x0a3f('0x37')],_0x3a368d['filters']),_0x5711d0);if(_0x34fa26[_0x0a3f('0x37')]['filter']){_0x24ba82[_0x0a3f('0x3f')]=_[_0x0a3f('0x40')](_0x24ba82['where'],{'$or':_[_0x0a3f('0x35')](_0x5711d0,function(_0x439926){if(_0x439926[_0x0a3f('0x32')]!==_0x0a3f('0x41')){var _0x4a0a04={};_0x4a0a04[_0x439926['name']]={'$like':'%'+_0x34fa26[_0x0a3f('0x37')][_0x0a3f('0x42')]+'%'};return _0x4a0a04;}})});}_0x24ba82=_[_0x0a3f('0x40')]({},_0x24ba82,_0x34fa26[_0x0a3f('0x43')]);var _0xca2d35={'where':_0x24ba82[_0x0a3f('0x3f')]};return db[_0x0a3f('0x44')][_0x0a3f('0x22')](_0xca2d35)[_0x0a3f('0x27')](function(_0x4e15fd){_0x52bcad[_0x0a3f('0x22')]=_0x4e15fd;if(_0x34fa26[_0x0a3f('0x37')]['includeAll']){_0x24ba82['include']=[{'all':!![]}];}return db[_0x0a3f('0x44')][_0x0a3f('0x45')](_0x24ba82);})[_0x0a3f('0x27')](function(_0x2c96b5){_0x52bcad[_0x0a3f('0x46')]=_0x2c96b5;return _0x52bcad;})['then'](respondWithFilteredResult(_0xae90ca,_0x24ba82))[_0x0a3f('0x47')](handleError(_0xae90ca,null));};exports['show']=function(_0x49b308,_0x18f216){var _0x3a7ff2={'raw':![],'where':{'id':_0x49b308[_0x0a3f('0x48')]['id']}},_0x543ffa={};_0x543ffa[_0x0a3f('0x34')]=_[_0x0a3f('0x36')](db['Team'][_0x0a3f('0x30')]);_0x543ffa[_0x0a3f('0x37')]=_[_0x0a3f('0x36')](_0x49b308[_0x0a3f('0x37')]);_0x543ffa[_0x0a3f('0x38')]=_['intersection'](_0x543ffa[_0x0a3f('0x34')],_0x543ffa[_0x0a3f('0x37')]);_0x3a7ff2[_0x0a3f('0x3a')]=_['intersection'](_0x543ffa[_0x0a3f('0x34')],qs[_0x0a3f('0x3b')](_0x49b308['query'][_0x0a3f('0x3b')]));_0x3a7ff2[_0x0a3f('0x3a')]=_0x3a7ff2[_0x0a3f('0x3a')]['length']?_0x3a7ff2[_0x0a3f('0x3a')]:_0x543ffa[_0x0a3f('0x34')];if(_0x49b308[_0x0a3f('0x37')][_0x0a3f('0x49')]){_0x3a7ff2[_0x0a3f('0x4a')]=[{'all':!![]}];}_0x3a7ff2=_[_0x0a3f('0x40')]({},_0x3a7ff2,_0x49b308[_0x0a3f('0x43')]);return db[_0x0a3f('0x44')]['find'](_0x3a7ff2)['then'](handleEntityNotFound(_0x18f216,null))[_0x0a3f('0x27')](respondWithResult(_0x18f216,null))[_0x0a3f('0x47')](handleError(_0x18f216,null));};exports[_0x0a3f('0x4b')]=function(_0x411da1,_0x10aa0c){return db[_0x0a3f('0x44')][_0x0a3f('0x4b')](_0x411da1['body'],{})[_0x0a3f('0x27')](function(_0x510597){var _0x5838a8=_0x411da1[_0x0a3f('0x4c')]['get']({'plain':!![]});if(!_0x5838a8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5838a8[_0x0a3f('0x4d')]===_0x0a3f('0x4c')){var _0x384a3c=_0x510597[_0x0a3f('0x29')]({'plain':!![]});var _0x20745e=_0x0a3f('0x2a');return db[_0x0a3f('0x4e')][_0x0a3f('0x4f')]({'where':{'name':_0x20745e,'userProfileId':_0x5838a8[_0x0a3f('0x50')]},'raw':!![]})[_0x0a3f('0x27')](function(_0x17d6b4){if(_0x17d6b4&&_0x17d6b4[_0x0a3f('0x51')]===0x0){return db[_0x0a3f('0x52')][_0x0a3f('0x4b')]({'name':_0x384a3c['name'],'resourceId':_0x384a3c['id'],'type':_0x17d6b4[_0x0a3f('0x2e')],'sectionId':_0x17d6b4['id']},{})[_0x0a3f('0x27')](function(){return _0x510597;});}else{return _0x510597;}})['catch'](function(_0x9141e){logger[_0x0a3f('0x2c')](_0x0a3f('0x53'),_0x9141e);throw _0x9141e;});}return _0x510597;})[_0x0a3f('0x27')](respondWithResult(_0x10aa0c,0xc9))[_0x0a3f('0x47')](handleError(_0x10aa0c,null));};exports[_0x0a3f('0x26')]=function(_0x3cb648,_0x2e0f1b){if(_0x3cb648[_0x0a3f('0x54')]['id']){delete _0x3cb648[_0x0a3f('0x54')]['id'];}return db[_0x0a3f('0x44')][_0x0a3f('0x4f')]({'where':{'id':_0x3cb648['params']['id']}})[_0x0a3f('0x27')](handleEntityNotFound(_0x2e0f1b,null))[_0x0a3f('0x27')](saveUpdates(_0x3cb648[_0x0a3f('0x54')],null))[_0x0a3f('0x27')](respondWithResult(_0x2e0f1b,null))['catch'](handleError(_0x2e0f1b,null));};exports[_0x0a3f('0x28')]=function(_0x49796b,_0x57e755){return db[_0x0a3f('0x44')]['find']({'where':{'id':_0x49796b[_0x0a3f('0x48')]['id']}})[_0x0a3f('0x27')](handleEntityNotFound(_0x57e755,null))['then'](removeEntity(_0x57e755,null))[_0x0a3f('0x47')](handleError(_0x57e755,null));};exports[_0x0a3f('0x55')]=function(_0x5688ae,_0x3338e8,_0x2b8aa3){return db[_0x0a3f('0x44')][_0x0a3f('0x56')]({'where':{'id':_0x5688ae[_0x0a3f('0x48')]['id']}})[_0x0a3f('0x27')](handleEntityNotFound(_0x3338e8,null))[_0x0a3f('0x27')](function(_0x37d520){if(!_0x5688ae['query'][_0x0a3f('0x57')]||!utils[_0x0a3f('0x58')](_0x5688ae['query'][_0x0a3f('0x57')])){throw new db['Sequelize'][(_0x0a3f('0x59'))](_0x0a3f('0x5a'));}var _0x400525={};var _0x4678a9={};_0x4678a9[_0x0a3f('0x34')]=_['keys'](db[_['capitalize'](_0x5688ae[_0x0a3f('0x37')][_0x0a3f('0x57')]['toLowerCase']())+_0x0a3f('0x5b')]['rawAttributes']);_0x4678a9[_0x0a3f('0x37')]=_[_0x0a3f('0x36')](_0x5688ae[_0x0a3f('0x37')]);_0x4678a9[_0x0a3f('0x38')]=_['intersection'](_0x4678a9[_0x0a3f('0x34')],_0x4678a9[_0x0a3f('0x37')]);_0x400525[_0x0a3f('0x3a')]=_['intersection'](_0x4678a9[_0x0a3f('0x34')],qs[_0x0a3f('0x3b')](_0x5688ae['query'][_0x0a3f('0x3b')]));_0x400525[_0x0a3f('0x3a')]=_0x400525['attributes'][_0x0a3f('0x3c')]?_0x400525['attributes']:_0x4678a9[_0x0a3f('0x34')];_0x400525[_0x0a3f('0x21')]=qs[_0x0a3f('0x21')](_0x5688ae['query']['limit']);_0x400525[_0x0a3f('0x1f')]=qs[_0x0a3f('0x1f')](_0x5688ae['query'][_0x0a3f('0x1f')]);_0x400525[_0x0a3f('0x5c')]=qs['sort'](_0x5688ae[_0x0a3f('0x37')][_0x0a3f('0x3e')]);_0x400525[_0x0a3f('0x3f')]=qs['filters'](_[_0x0a3f('0x5d')](_0x5688ae[_0x0a3f('0x37')],_0x4678a9[_0x0a3f('0x38')]));_0x400525=_[_0x0a3f('0x40')]({},_0x400525,_0x5688ae[_0x0a3f('0x43')]);return _0x37d520[_0x0a3f('0x29')+_[_0x0a3f('0x5e')](_0x5688ae[_0x0a3f('0x37')][_0x0a3f('0x57')][_0x0a3f('0x5f')]())+_0x0a3f('0x60')](_0x400525);})[_0x0a3f('0x27')](respondWithResult(_0x3338e8,null))['catch'](handleError(_0x3338e8,null));};exports[_0x0a3f('0x61')]=function(_0x721d19,_0x538d6f,_0x493302){return db[_0x0a3f('0x44')][_0x0a3f('0x56')]({'where':{'id':_0x721d19[_0x0a3f('0x48')]['id']}})[_0x0a3f('0x27')](function(_0xa87067){if(_0xa87067){if(!_0x721d19[_0x0a3f('0x54')][_0x0a3f('0x57')]||!utils[_0x0a3f('0x58')](_0x721d19[_0x0a3f('0x54')][_0x0a3f('0x57')])){throw new db[(_0x0a3f('0x62'))]['ValidationError'](_0x0a3f('0x5a'));}return _0xa87067[_0x0a3f('0x63')+_[_0x0a3f('0x5e')](_0x721d19[_0x0a3f('0x54')]['channel']['toLowerCase']())+_0x0a3f('0x60')](_0x721d19[_0x0a3f('0x54')][_0x0a3f('0x64')]);}return null;})[_0x0a3f('0x27')](handleEntityNotFound(_0x538d6f,null))[_0x0a3f('0x27')](respondWithStatusCode(_0x538d6f,null))['catch'](handleError(_0x538d6f,null));};exports[_0x0a3f('0x65')]=function(_0x247c9f,_0x4ebd12,_0x1e91bb){return db['Team'][_0x0a3f('0x56')]({'where':{'id':_0x247c9f[_0x0a3f('0x48')]['id']}})[_0x0a3f('0x27')](function(_0x3af3e6){if(_0x3af3e6){if(!_0x247c9f[_0x0a3f('0x37')][_0x0a3f('0x57')]||!utils[_0x0a3f('0x58')](_0x247c9f[_0x0a3f('0x37')]['channel'])){throw new db['Sequelize'][(_0x0a3f('0x59'))]('Unknown\x20channel');}return _0x3af3e6[_0x0a3f('0x66')+_['capitalize'](_0x247c9f[_0x0a3f('0x37')]['channel'][_0x0a3f('0x5f')]())+'Queues'](_0x247c9f[_0x0a3f('0x37')]['ids']);}return null;})[_0x0a3f('0x27')](handleEntityNotFound(_0x4ebd12,null))['then'](respondWithStatusCode(_0x4ebd12,null))[_0x0a3f('0x47')](handleError(_0x4ebd12,null));};exports[_0x0a3f('0x67')]=function(_0x1a4ba4,_0x54adb9){return db[_0x0a3f('0x44')][_0x0a3f('0x4f')]({'where':{'id':_0x1a4ba4[_0x0a3f('0x48')]['id']}})[_0x0a3f('0x27')](handleEntityNotFound(_0x54adb9,null))[_0x0a3f('0x27')](function(_0x197a5b){if(_0x197a5b){var _0x74d5d7=['Voice',_0x0a3f('0x68'),'Mail',_0x0a3f('0x69'),_0x0a3f('0x6a'),'Openchannel',_0x0a3f('0x6b')];return db['sequelize'][_0x0a3f('0x6c')](function(_0x1f4a20){var _0x5b3302=_[_0x0a3f('0x35')](_0x74d5d7,function(_0x4ca970){var _0x57b4a4={'attributes':['id',_0x0a3f('0x2e')]};if(_0x4ca970===_0x0a3f('0x6d')){_0x57b4a4[_0x0a3f('0x6e')]={'attributes':['penalty']};}return _0x197a5b[_0x0a3f('0x29')+_0x4ca970+_0x0a3f('0x60')](_0x57b4a4)[_0x0a3f('0x27')](function(_0x437933){var _0x51fe28=_[_0x0a3f('0x35')](_0x437933,function(_0x4cb75d){var _0x3772b5=_[_0x0a3f('0x35')](_0x1a4ba4[_0x0a3f('0x54')]['ids'],function(_0x8e353f){var _0x367f8d={'where':{'UserId':_0x8e353f,[_0x4ca970+'QueueId']:_0x4cb75d['id']},'transaction':_0x1f4a20};if(_0x4ca970===_0x0a3f('0x6d')){_0x367f8d[_0x0a3f('0x1a')]={'penalty':_0x4cb75d[_0x0a3f('0x6f')][_0x0a3f('0x70')]};}return db[_0x0a3f('0x71')+_0x4ca970+_0x0a3f('0x5b')][_0x0a3f('0x72')](_0x367f8d)['then'](function(){socket[_0x0a3f('0x73')](_0x0a3f('0x4c')+_0x4ca970+_0x0a3f('0x74'),{'UserId':_0x8e353f,[_0x4ca970+_0x0a3f('0x75')]:_0x4cb75d['id']});if(_0x4ca970!==_0x0a3f('0x6d'))return;return db[_0x0a3f('0x71')][_0x0a3f('0x45')]({'where':{'id':_0x1a4ba4[_0x0a3f('0x54')][_0x0a3f('0x64')],'online':0x1},'attributes':['id','name','online',_0x0a3f('0x76'),_0x0a3f('0x77')],'raw':!![]})['then'](function(_0x87a4f5){var _0xdcaf1b=_[_0x0a3f('0x35')](_0x87a4f5,function(_0x1b990f){return db[_0x0a3f('0x78')][_0x0a3f('0x79')]({'membername':_0x1b990f[_0x0a3f('0x2e')],'UserId':_0x1b990f['id'],'queue_name':_0x4cb75d['name'],'VoiceQueueId':_0x4cb75d['id'],'interface':_['isNil'](_0x1b990f[_0x0a3f('0x77')])?util[_0x0a3f('0x7a')](_0x0a3f('0x7b'),_0x1b990f[_0x0a3f('0x2e')]):_0x1b990f[_0x0a3f('0x77')],'paused':_0x1b990f[_0x0a3f('0x76')]||![],'penalty':_0x4cb75d[_0x0a3f('0x6f')][_0x0a3f('0x70')]},{'transaction':_0x1f4a20});});return Promise['all'](_0xdcaf1b);});});});return Promise['all'](_0x3772b5);});return Promise[_0x0a3f('0x7c')](_0x51fe28);});});return Promise[_0x0a3f('0x7c')](_0x5b3302)['then'](function(){return _0x197a5b[_0x0a3f('0x67')](_0x1a4ba4[_0x0a3f('0x54')][_0x0a3f('0x64')],{'transaction':_0x1f4a20})['spread'](function(_0x495721){return _0x495721;});});});}})[_0x0a3f('0x27')](respondWithResult(_0x54adb9,null))[_0x0a3f('0x47')](handleError(_0x54adb9,null));};exports['removeAgents']=function(_0x2d9ed4,_0x53b67c){return db['Team'][_0x0a3f('0x4f')]({'where':{'id':_0x2d9ed4[_0x0a3f('0x48')]['id']}})['then'](handleEntityNotFound(_0x53b67c,null))[_0x0a3f('0x27')](function(_0x54f388){if(_0x54f388){var _0x4bed62=['Voice',_0x0a3f('0x68'),_0x0a3f('0x7d'),_0x0a3f('0x69'),_0x0a3f('0x6a'),_0x0a3f('0x7e'),_0x0a3f('0x6b')];return db[_0x0a3f('0x7f')]['transaction'](function(_0x2beafb){var _0x75b46b=_[_0x0a3f('0x35')](_0x4bed62,function(_0x500340){var _0x5a6180={'attributes':['id',_0x0a3f('0x2e')]};return _0x54f388['get'+_0x500340+'Queues'](_0x5a6180)[_0x0a3f('0x27')](function(_0x1c1abd){var _0x3639a6=_['map'](_0x1c1abd,function(_0x3b0a9e){return _0x3b0a9e['removeAgents'](_0x2d9ed4[_0x0a3f('0x37')][_0x0a3f('0x64')],{'transaction':_0x2beafb})[_0x0a3f('0x27')](function(){var _0x120cb6=JSON[_0x0a3f('0x80')]('['+_0x2d9ed4['query'][_0x0a3f('0x64')]+']');var _0x5dafd0=_[_0x0a3f('0x35')](_0x120cb6,function(_0x5ec6c0){socket[_0x0a3f('0x73')](_0x0a3f('0x4c')+_0x500340+'Queue:remove',{'UserId':Number(_0x5ec6c0),[_0x500340+_0x0a3f('0x75')]:_0x3b0a9e['id']});if(_0x500340!==_0x0a3f('0x6d'))return;return db['UserVoiceQueueRt'][_0x0a3f('0x28')]({'where':{'VoiceQueueId':_0x3b0a9e['id'],'UserId':_0x5ec6c0},'transaction':_0x2beafb});});return Promise[_0x0a3f('0x7c')](_0x5dafd0);});});return Promise[_0x0a3f('0x7c')](_0x3639a6);});});return Promise['all'](_0x75b46b)[_0x0a3f('0x27')](function(){return _0x54f388[_0x0a3f('0x81')](_0x2d9ed4[_0x0a3f('0x37')][_0x0a3f('0x64')],{'transaction':_0x2beafb});});});}})[_0x0a3f('0x27')](respondWithStatusCode(_0x53b67c,null))['catch'](handleError(_0x53b67c,null));};exports[_0x0a3f('0x82')]=function(_0x3ff1c7,_0x12b129,_0x1102ac){var _0x1aaead={};var _0x709232={};var _0x3df172;var _0x1bb66b;return db[_0x0a3f('0x44')]['findOne']({'where':{'id':_0x3ff1c7[_0x0a3f('0x48')]['id']}})[_0x0a3f('0x27')](handleEntityNotFound(_0x12b129,null))[_0x0a3f('0x27')](function(_0x371f83){if(_0x371f83){_0x3df172=_0x371f83;_0x709232[_0x0a3f('0x34')]=_[_0x0a3f('0x36')](db[_0x0a3f('0x71')][_0x0a3f('0x30')]);_0x709232[_0x0a3f('0x37')]=_[_0x0a3f('0x36')](_0x3ff1c7[_0x0a3f('0x37')]);_0x709232[_0x0a3f('0x38')]=_[_0x0a3f('0x39')](_0x709232[_0x0a3f('0x34')],_0x709232[_0x0a3f('0x37')]);_0x1aaead['attributes']=_['intersection'](_0x709232[_0x0a3f('0x34')],qs[_0x0a3f('0x3b')](_0x3ff1c7['query'][_0x0a3f('0x3b')]));_0x1aaead[_0x0a3f('0x3a')]=_0x1aaead[_0x0a3f('0x3a')][_0x0a3f('0x3c')]?_0x1aaead[_0x0a3f('0x3a')]:_0x709232[_0x0a3f('0x34')];_0x1aaead[_0x0a3f('0x5c')]=qs[_0x0a3f('0x3e')](_0x3ff1c7[_0x0a3f('0x37')][_0x0a3f('0x3e')]);_0x1aaead[_0x0a3f('0x3f')]=qs[_0x0a3f('0x38')](_['pick'](_0x3ff1c7[_0x0a3f('0x37')],_0x709232[_0x0a3f('0x38')]));if(_0x3ff1c7[_0x0a3f('0x37')][_0x0a3f('0x42')]){_0x1aaead[_0x0a3f('0x3f')]=_['merge'](_0x1aaead['where'],{'$or':_['map'](_0x1aaead[_0x0a3f('0x3a')],function(_0x3692de){var _0x5a4a7d={};_0x5a4a7d[_0x3692de]={'$like':'%'+_0x3ff1c7[_0x0a3f('0x37')]['filter']+'%'};return _0x5a4a7d;})});}_0x1aaead=_['merge']({},_0x1aaead,_0x3ff1c7[_0x0a3f('0x43')]);return _0x3df172[_0x0a3f('0x82')](_0x1aaead);}})['then'](function(_0x3a02f5){if(_0x3a02f5){_0x1bb66b=_0x3a02f5[_0x0a3f('0x3c')];if(!_0x3ff1c7[_0x0a3f('0x37')][_0x0a3f('0x3d')]('nolimit')){_0x1aaead[_0x0a3f('0x21')]=qs[_0x0a3f('0x21')](_0x3ff1c7[_0x0a3f('0x37')][_0x0a3f('0x21')]);_0x1aaead['offset']=qs[_0x0a3f('0x1f')](_0x3ff1c7['query'][_0x0a3f('0x1f')]);}return _0x3df172[_0x0a3f('0x82')](_0x1aaead);}})[_0x0a3f('0x27')](function(_0x3e5579){if(_0x3e5579){return _0x3e5579?{'count':_0x1bb66b,'rows':_0x3e5579}:null;}})['then'](respondWithResult(_0x12b129,null))['catch'](handleError(_0x12b129,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 7567bfd..d24a673 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 _0xb722=['exports','events','Team','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2cf72d,_0x1f8d24){var _0x417ef4=function(_0x1a0c4d){while(--_0x1a0c4d){_0x2cf72d['push'](_0x2cf72d['shift']());}};_0x417ef4(++_0x1f8d24);}(_0xb722,0x191));var _0x2b72=function(_0x4a0b37,_0x4026b7){_0x4a0b37=_0x4a0b37-0x0;var _0x3c5c8a=_0xb722[_0x4a0b37];return _0x3c5c8a;};'use strict';var EventEmitter=require(_0x2b72('0x0'));var Team=require('../../mysqldb')['db'][_0x2b72('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x2b72('0x2')](0x0);var events={'afterCreate':_0x2b72('0x3'),'afterUpdate':_0x2b72('0x4'),'afterDestroy':_0x2b72('0x5')};function emitEvent(_0x246d4c){return function(_0x16c456,_0x4e8154,_0xd163b5){TeamEvents[_0x2b72('0x6')](_0x246d4c+':'+_0x16c456['id'],_0x16c456);TeamEvents[_0x2b72('0x6')](_0x246d4c,_0x16c456);_0xd163b5(null);};}for(var e in events){if(events[_0x2b72('0x7')](e)){var event=events[e];Team[_0x2b72('0x8')](e,emitEvent(event));}}module[_0x2b72('0x9')]=TeamEvents; \ No newline at end of file +var _0xff4f=['remove','emit','hasOwnProperty','exports','Team','setMaxListeners'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0xff4f,0x1e4));var _0xfff4=function(_0x5e99ff,_0x5e7a57){_0x5e99ff=_0x5e99ff-0x0;var _0xf9d4b5=_0xff4f[_0x5e99ff];return _0xf9d4b5;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db'][_0xfff4('0x0')];var TeamEvents=new EventEmitter();TeamEvents[_0xfff4('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xfff4('0x2')};function emitEvent(_0xd7d6d9){return function(_0xb00dd6,_0x3fbcaa,_0x34e0ac){TeamEvents['emit'](_0xd7d6d9+':'+_0xb00dd6['id'],_0xb00dd6);TeamEvents[_0xfff4('0x3')](_0xd7d6d9,_0xb00dd6);_0x34e0ac(null);};}for(var e in events){if(events[_0xfff4('0x4')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xfff4('0x5')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 7ebe23d..674766f 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 _0xfa61=['teams','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./team.attributes','define','Team'];(function(_0x46581f,_0x54be61){var _0x308dba=function(_0x69ee08){while(--_0x69ee08){_0x46581f['push'](_0x46581f['shift']());}};_0x308dba(++_0x54be61);}(_0xfa61,0xa9));var _0x1fa6=function(_0x2e88c5,_0x2498f4){_0x2e88c5=_0x2e88c5-0x0;var _0x169ea2=_0xfa61[_0x2e88c5];return _0x169ea2;};'use strict';var _=require(_0x1fa6('0x0'));var util=require(_0x1fa6('0x1'));var logger=require(_0x1fa6('0x2'))(_0x1fa6('0x3'));var moment=require(_0x1fa6('0x4'));var BPromise=require(_0x1fa6('0x5'));var rp=require(_0x1fa6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1fa6('0x7'));var config=require('../../config/environment');var attributes=require(_0x1fa6('0x8'));module['exports']=function(_0x2e356b,_0x390f1d){return _0x2e356b[_0x1fa6('0x9')](_0x1fa6('0xa'),attributes,{'tableName':_0x1fa6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ef9=['request-promise','path','rimraf','../../config/environment','./team.attributes','exports','define','Team','teams','lodash','../../config/logger','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4ef9,0x1b9));var _0x94ef=function(_0xd2548e,_0x556106){_0xd2548e=_0xd2548e-0x0;var _0x1258d3=_0x4ef9[_0xd2548e];return _0x1258d3;};'use strict';var _=require(_0x94ef('0x0'));var util=require('util');var logger=require(_0x94ef('0x1'))('api');var moment=require(_0x94ef('0x2'));var BPromise=require('bluebird');var rp=require(_0x94ef('0x3'));var fs=require('fs');var path=require(_0x94ef('0x4'));var rimraf=require(_0x94ef('0x5'));var config=require(_0x94ef('0x6'));var attributes=require(_0x94ef('0x7'));module[_0x94ef('0x8')]=function(_0x2e6802,_0x4595ee){return _0x2e6802[_0x94ef('0x9')](_0x94ef('0xa'),attributes,{'tableName':_0x94ef('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 8ae3145..de05fe9 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 _0xc347=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./team.socket','request','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util'];(function(_0x2ea9ce,_0x4f8890){var _0x1aec12=function(_0x49687a){while(--_0x49687a){_0x2ea9ce['push'](_0x2ea9ce['shift']());}};_0x1aec12(++_0x4f8890);}(_0xc347,0x132));var _0x7c34=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xc347[_0x432682];return _0x463d05;};'use strict';var _=require(_0x7c34('0x0'));var util=require(_0x7c34('0x1'));var moment=require(_0x7c34('0x2'));var BPromise=require(_0x7c34('0x3'));var rs=require(_0x7c34('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c34('0x5'))['db'];var utils=require(_0x7c34('0x6'));var logger=require(_0x7c34('0x7'))(_0x7c34('0x8'));var config=require(_0x7c34('0x9'));var jayson=require(_0x7c34('0xa'));var client=jayson[_0x7c34('0xb')][_0x7c34('0xc')]({'port':0x232a});config[_0x7c34('0xd')]=_[_0x7c34('0xe')](config[_0x7c34('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x7c34('0xf'))(new Redis(config[_0x7c34('0xd')]));require(_0x7c34('0x10'))['register'](socket);function respondWithRpcPromise(_0x437517,_0xcd3f73,_0x2ef54b){return new BPromise(function(_0x80417,_0x294f0d){return client[_0x7c34('0x11')](_0x437517,_0x2ef54b)['then'](function(_0x20bc2c){logger[_0x7c34('0x12')](_0x7c34('0x13'),_0xcd3f73,'request\x20sent');logger[_0x7c34('0x14')](_0x7c34('0x15'),_0xcd3f73,_0x7c34('0x16'),JSON[_0x7c34('0x17')](_0x20bc2c));if(_0x20bc2c['error']){if(_0x20bc2c[_0x7c34('0x18')]['code']===0x1f4){logger[_0x7c34('0x18')](_0x7c34('0x13'),_0xcd3f73,_0x20bc2c[_0x7c34('0x18')][_0x7c34('0x19')]);return _0x294f0d(_0x20bc2c[_0x7c34('0x18')]['message']);}logger[_0x7c34('0x18')]('Team,\x20%s,\x20%s',_0xcd3f73,_0x20bc2c[_0x7c34('0x18')][_0x7c34('0x19')]);return _0x80417(_0x20bc2c['error'][_0x7c34('0x19')]);}else{logger[_0x7c34('0x12')](_0x7c34('0x13'),_0xcd3f73,_0x7c34('0x16'));_0x80417(_0x20bc2c[_0x7c34('0x1a')]['message']);}})[_0x7c34('0x1b')](function(_0x16aca4){logger['error'](_0x7c34('0x13'),_0xcd3f73,_0x16aca4);_0x294f0d(_0x16aca4);});});} \ No newline at end of file +var _0x42c1=['message','info','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','register','request','then','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x45745d,_0x541e6d){var _0x3c1408=function(_0x18f383){while(--_0x18f383){_0x45745d['push'](_0x45745d['shift']());}};_0x3c1408(++_0x541e6d);}(_0x42c1,0x145));var _0x142c=function(_0x323676,_0x50863e){_0x323676=_0x323676-0x0;var _0x580101=_0x42c1[_0x323676];return _0x580101;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x142c('0x0'));var rs=require(_0x142c('0x1'));var fs=require('fs');var Redis=require(_0x142c('0x2'));var db=require(_0x142c('0x3'))['db'];var utils=require(_0x142c('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x142c('0x5'));var jayson=require(_0x142c('0x6'));var client=jayson[_0x142c('0x7')][_0x142c('0x8')]({'port':0x232a});config[_0x142c('0x9')]=_[_0x142c('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./team.socket')[_0x142c('0xb')](socket);function respondWithRpcPromise(_0x58a9b6,_0x5b0614,_0x4bdce5){return new BPromise(function(_0xeb3445,_0x536f54){return client[_0x142c('0xc')](_0x58a9b6,_0x4bdce5)[_0x142c('0xd')](function(_0x35780f){logger['info'](_0x142c('0xe'),_0x5b0614,_0x142c('0xf'));logger['debug'](_0x142c('0x10'),_0x5b0614,'request\x20sent',JSON[_0x142c('0x11')](_0x35780f));if(_0x35780f[_0x142c('0x12')]){if(_0x35780f['error'][_0x142c('0x13')]===0x1f4){logger['error'](_0x142c('0xe'),_0x5b0614,_0x35780f[_0x142c('0x12')][_0x142c('0x14')]);return _0x536f54(_0x35780f[_0x142c('0x12')][_0x142c('0x14')]);}logger['error']('Team,\x20%s,\x20%s',_0x5b0614,_0x35780f['error'][_0x142c('0x14')]);return _0xeb3445(_0x35780f[_0x142c('0x12')]['message']);}else{logger[_0x142c('0x15')](_0x142c('0xe'),_0x5b0614,'request\x20sent');_0xeb3445(_0x35780f['result'][_0x142c('0x14')]);}})[_0x142c('0x16')](function(_0x283fc7){logger['error'](_0x142c('0xe'),_0x5b0614,_0x283fc7);_0x536f54(_0x283fc7);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 5765aef..c9a3761 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 _0xc933=['team:','./team.events','save','remove','update','emit','removeListener','length'];(function(_0x1b3fc5,_0x576f1d){var _0x42f248=function(_0x397304){while(--_0x397304){_0x1b3fc5['push'](_0x1b3fc5['shift']());}};_0x42f248(++_0x576f1d);}(_0xc933,0xf9));var _0x3c93=function(_0x326eb3,_0x5ae4df){_0x326eb3=_0x326eb3-0x0;var _0x3b9d30=_0xc933[_0x326eb3];return _0x3b9d30;};'use strict';var TeamEvents=require(_0x3c93('0x0'));var events=[_0x3c93('0x1'),_0x3c93('0x2'),_0x3c93('0x3')];function createListener(_0x3ce54a,_0x547097){return function(_0xfd3bb5){_0x547097[_0x3c93('0x4')](_0x3ce54a,_0xfd3bb5);};}function removeListener(_0x20d680,_0x343f96){return function(){TeamEvents[_0x3c93('0x5')](_0x20d680,_0x343f96);};}exports['register']=function(_0x1f2667){for(var _0x19939f=0x0,_0x52c22c=events[_0x3c93('0x6')];_0x19939f<_0x52c22c;_0x19939f++){var _0x489139=events[_0x19939f];var _0x1b505a=createListener(_0x3c93('0x7')+_0x489139,_0x1f2667);TeamEvents['on'](_0x489139,_0x1b505a);}}; \ No newline at end of file +var _0x67da=['removeListener','length','team:','save','remove','update','emit'];(function(_0x30d3b5,_0x1e9bcb){var _0x37603a=function(_0x35c140){while(--_0x35c140){_0x30d3b5['push'](_0x30d3b5['shift']());}};_0x37603a(++_0x1e9bcb);}(_0x67da,0x192));var _0xa67d=function(_0x2daf49,_0x131e8a){_0x2daf49=_0x2daf49-0x0;var _0x67085d=_0x67da[_0x2daf49];return _0x67085d;};'use strict';var TeamEvents=require('./team.events');var events=[_0xa67d('0x0'),_0xa67d('0x1'),_0xa67d('0x2')];function createListener(_0x3cae01,_0x472755){return function(_0x3633a0){_0x472755[_0xa67d('0x3')](_0x3cae01,_0x3633a0);};}function removeListener(_0x1a8b5e,_0x3dcee7){return function(){TeamEvents[_0xa67d('0x4')](_0x1a8b5e,_0x3dcee7);};}exports['register']=function(_0x5b8ec7){for(var _0x408786=0x0,_0x4d2734=events[_0xa67d('0x5')];_0x408786<_0x4d2734;_0x408786++){var _0x2346f4=events[_0x408786];var _0x10f89a=createListener(_0xa67d('0x6')+_0x2346f4,_0x5b8ec7);TeamEvents['on'](_0x2346f4,_0x10f89a);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 786be7d..2ece227 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(_0x2a4095,_0x13f4f0){var _0x52eeab=function(_0x3950dd){while(--_0x3950dd){_0x2a4095['push'](_0x2a4095['shift']());}};_0x52eeab(++_0x13f4f0);}(_0x9c44,0x178));var _0x49c4=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9c44[_0x13b02f];return _0x12e9a6;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x33e450,_0x4929be){var _0xebfe73=function(_0x5098c1){while(--_0x5098c1){_0x33e450['push'](_0x33e450['shift']());}};_0xebfe73(++_0x4929be);}(_0x70e0,0x17b));var _0x070e=function(_0x1b0335,_0x38326c){_0x1b0335=_0x1b0335-0x0;var _0x5ecde8=_0x70e0[_0x1b0335];return _0x5ecde8;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 9136e3c..8eb2ea1 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 _0x7de4=['sequelize','INTEGER'];(function(_0x4366ef,_0x26b905){var _0x29f35e=function(_0xb6333e){while(--_0xb6333e){_0x4366ef['push'](_0x4366ef['shift']());}};_0x29f35e(++_0x26b905);}(_0x7de4,0xb4));var _0x47de=function(_0x21ffd6,_0xca87bb){_0x21ffd6=_0x21ffd6-0x0;var _0x37dff7=_0x7de4[_0x21ffd6];return _0x37dff7;};'use strict';var Sequelize=require(_0x47de('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x47de('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf4b6=['INTEGER','exports'];(function(_0x53c085,_0x5049b5){var _0xfc210a=function(_0x40b46c){while(--_0x40b46c){_0x53c085['push'](_0x53c085['shift']());}};_0xfc210a(++_0x5049b5);}(_0xf4b6,0x85));var _0x6f4b=function(_0x623401,_0x1ec322){_0x623401=_0x623401-0x0;var _0x424849=_0xf4b6[_0x623401];return _0x424849;};'use strict';var Sequelize=require('sequelize');module[_0x6f4b('0x0')]={'penalty':{'type':Sequelize[_0x6f4b('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 8a01cc1..40662c1 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 _0x07c3=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash'];(function(_0x14525d,_0x747b83){var _0x26b05c=function(_0xf98e52){while(--_0xf98e52){_0x14525d['push'](_0x14525d['shift']());}};_0x26b05c(++_0x747b83);}(_0x07c3,0x1bf));var _0x307c=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x07c3[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0x307c('0x0'));var util=require(_0x307c('0x1'));var logger=require(_0x307c('0x2'))(_0x307c('0x3'));var moment=require(_0x307c('0x4'));var BPromise=require(_0x307c('0x5'));var rp=require(_0x307c('0x6'));var fs=require('fs');var path=require(_0x307c('0x7'));var rimraf=require('rimraf');var config=require(_0x307c('0x8'));var attributes=require(_0x307c('0x9'));module[_0x307c('0xa')]=function(_0x317066,_0x250f22){return _0x317066[_0x307c('0xb')](_0x307c('0xc'),attributes,{'tableName':_0x307c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb18e=['request-promise','path','../../config/environment','./teamVoiceQueue.attributes','exports','define','team_has_voice_queues','../../config/logger','moment'];(function(_0x9a9f24,_0x47ed04){var _0x3422cb=function(_0x4431a4){while(--_0x4431a4){_0x9a9f24['push'](_0x9a9f24['shift']());}};_0x3422cb(++_0x47ed04);}(_0xb18e,0x181));var _0xeb18=function(_0xdaab62,_0x2728ab){_0xdaab62=_0xdaab62-0x0;var _0x13d767=_0xb18e[_0xdaab62];return _0x13d767;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeb18('0x0'))('api');var moment=require(_0xeb18('0x1'));var BPromise=require('bluebird');var rp=require(_0xeb18('0x2'));var fs=require('fs');var path=require(_0xeb18('0x3'));var rimraf=require('rimraf');var config=require(_0xeb18('0x4'));var attributes=require(_0xeb18('0x5'));module[_0xeb18('0x6')]=function(_0x409efb,_0x46d281){return _0x409efb[_0xeb18('0x7')]('TeamVoiceQueue',attributes,{'tableName':_0xeb18('0x8'),'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 7a4bee7..87759e0 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 _0x9251=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x3c9831,_0x147bf6){var _0x221fcf=function(_0x45ad37){while(--_0x45ad37){_0x3c9831['push'](_0x3c9831['shift']());}};_0x221fcf(++_0x147bf6);}(_0x9251,0x1e6));var _0x1925=function(_0x29dda1,_0x508e13){_0x29dda1=_0x29dda1-0x0;var _0x21b0ef=_0x9251[_0x29dda1];return _0x21b0ef;};'use strict';var _=require('lodash');var util=require(_0x1925('0x0'));var moment=require(_0x1925('0x1'));var BPromise=require(_0x1925('0x2'));var rs=require(_0x1925('0x3'));var fs=require('fs');var Redis=require(_0x1925('0x4'));var db=require(_0x1925('0x5'))['db'];var utils=require(_0x1925('0x6'));var logger=require(_0x1925('0x7'))(_0x1925('0x8'));var config=require(_0x1925('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1925('0xa')][_0x1925('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a6313,_0x3dd721,_0x4f8d6c){return new BPromise(function(_0x4cfd03,_0x41d888){return client[_0x1925('0xc')](_0x1a6313,_0x4f8d6c)['then'](function(_0x4a37e1){logger[_0x1925('0xd')](_0x1925('0xe'),_0x3dd721,_0x1925('0xf'));logger[_0x1925('0x10')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x3dd721,_0x1925('0xf'),JSON[_0x1925('0x11')](_0x4a37e1));if(_0x4a37e1['error']){if(_0x4a37e1[_0x1925('0x12')][_0x1925('0x13')]===0x1f4){logger[_0x1925('0x12')](_0x1925('0xe'),_0x3dd721,_0x4a37e1[_0x1925('0x12')][_0x1925('0x14')]);return _0x41d888(_0x4a37e1['error']['message']);}logger[_0x1925('0x12')](_0x1925('0xe'),_0x3dd721,_0x4a37e1[_0x1925('0x12')][_0x1925('0x14')]);return _0x4cfd03(_0x4a37e1['error']['message']);}else{logger[_0x1925('0xd')](_0x1925('0xe'),_0x3dd721,_0x1925('0xf'));_0x4cfd03(_0x4a37e1[_0x1925('0x15')][_0x1925('0x14')]);}})[_0x1925('0x16')](function(_0x568257){logger[_0x1925('0x12')](_0x1925('0xe'),_0x3dd721,_0x568257);_0x41d888(_0x568257);});});} \ No newline at end of file +var _0xc5ba=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2d718b,_0x1f53f2){var _0x27144c=function(_0x402ec2){while(--_0x402ec2){_0x2d718b['push'](_0x2d718b['shift']());}};_0x27144c(++_0x1f53f2);}(_0xc5ba,0xb9));var _0xac5b=function(_0x20008a,_0x362490){_0x20008a=_0x20008a-0x0;var _0x5d0f1c=_0xc5ba[_0x20008a];return _0x5d0f1c;};'use strict';var _=require(_0xac5b('0x0'));var util=require(_0xac5b('0x1'));var moment=require(_0xac5b('0x2'));var BPromise=require(_0xac5b('0x3'));var rs=require(_0xac5b('0x4'));var fs=require('fs');var Redis=require(_0xac5b('0x5'));var db=require(_0xac5b('0x6'))['db'];var utils=require(_0xac5b('0x7'));var logger=require(_0xac5b('0x8'))(_0xac5b('0x9'));var config=require(_0xac5b('0xa'));var jayson=require(_0xac5b('0xb'));var client=jayson[_0xac5b('0xc')][_0xac5b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x38602a,_0xc09fbc,_0xc193a7){return new BPromise(function(_0x4a7fc7,_0x525e20){return client[_0xac5b('0xe')](_0x38602a,_0xc193a7)['then'](function(_0x3c5bd3){logger[_0xac5b('0xf')](_0xac5b('0x10'),_0xc09fbc,_0xac5b('0x11'));logger[_0xac5b('0x12')](_0xac5b('0x13'),_0xc09fbc,_0xac5b('0x11'),JSON[_0xac5b('0x14')](_0x3c5bd3));if(_0x3c5bd3[_0xac5b('0x15')]){if(_0x3c5bd3['error'][_0xac5b('0x16')]===0x1f4){logger[_0xac5b('0x15')](_0xac5b('0x10'),_0xc09fbc,_0x3c5bd3[_0xac5b('0x15')][_0xac5b('0x17')]);return _0x525e20(_0x3c5bd3[_0xac5b('0x15')][_0xac5b('0x17')]);}logger[_0xac5b('0x15')](_0xac5b('0x10'),_0xc09fbc,_0x3c5bd3[_0xac5b('0x15')][_0xac5b('0x17')]);return _0x4a7fc7(_0x3c5bd3[_0xac5b('0x15')]['message']);}else{logger[_0xac5b('0xf')](_0xac5b('0x10'),_0xc09fbc,_0xac5b('0x11'));_0x4a7fc7(_0x3c5bd3[_0xac5b('0x18')][_0xac5b('0x17')]);}})[_0xac5b('0x19')](function(_0x363de5){logger[_0xac5b('0x15')](_0xac5b('0x10'),_0xc09fbc,_0x363de5);_0x525e20(_0x363de5);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 5ae0b06..6798336 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 _0x955f=['path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','multer','util'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x955f,0x1eb));var _0xf955=function(_0x65f169,_0x42fc3f){_0x65f169=_0x65f169-0x0;var _0xf716d7=_0x955f[_0x65f169];return _0xf716d7;};'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('./template.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 _0x26c2=['index','post','put','/:id','update','delete','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x26c2,0x1d6));var _0x226c=function(_0x39952e,_0x40c621){_0x39952e=_0x39952e-0x0;var _0x5004de=_0x26c2[_0x39952e];return _0x5004de;};'use strict';var multer=require('multer');var util=require(_0x226c('0x0'));var path=require(_0x226c('0x1'));var timeout=require(_0x226c('0x2'));var express=require(_0x226c('0x3'));var router=express['Router']();var fs_extra=require(_0x226c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x226c('0x5'));var config=require(_0x226c('0x6'));var controller=require(_0x226c('0x7'));router[_0x226c('0x8')]('/',auth[_0x226c('0x9')](),controller[_0x226c('0xa')]);router[_0x226c('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x226c('0xb')]('/',auth[_0x226c('0x9')](),controller['create']);router[_0x226c('0xc')](_0x226c('0xd'),auth[_0x226c('0x9')](),controller[_0x226c('0xe')]);router[_0x226c('0xf')](_0x226c('0xd'),auth[_0x226c('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 0a57f0a..edbace6 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 _0xef9f=['TEXT','sequelize','exports','STRING'];(function(_0x57d628,_0xda6747){var _0x2f8486=function(_0x5f2cba){while(--_0x5f2cba){_0x57d628['push'](_0x57d628['shift']());}};_0x2f8486(++_0xda6747);}(_0xef9f,0x95));var _0xfef9=function(_0x2a5949,_0x2126c0){_0x2a5949=_0x2a5949-0x0;var _0x116094=_0xef9f[_0x2a5949];return _0x116094;};'use strict';var Sequelize=require(_0xfef9('0x0'));module[_0xfef9('0x1')]={'name':{'type':Sequelize[_0xfef9('0x2')]},'description':{'type':Sequelize[_0xfef9('0x2')]},'html':{'type':Sequelize[_0xfef9('0x3')]}}; \ No newline at end of file +var _0xfce0=['sequelize','exports','STRING','TEXT'];(function(_0x5b7361,_0xa93e5a){var _0x21c7a4=function(_0x5142e9){while(--_0x5142e9){_0x5b7361['push'](_0x5b7361['shift']());}};_0x21c7a4(++_0xa93e5a);}(_0xfce0,0x78));var _0x0fce=function(_0x5b7412,_0x28b1ed){_0x5b7412=_0x5b7412-0x0;var _0x2a55f5=_0xfce0[_0x5b7412];return _0x2a55f5;};'use strict';var Sequelize=require(_0x0fce('0x0'));module[_0x0fce('0x1')]={'name':{'type':Sequelize[_0x0fce('0x2')]},'description':{'type':Sequelize[_0x0fce('0x2')]},'html':{'type':Sequelize[_0x0fce('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 1ec844e..38ab21e 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 _0xa571=['apply','reject','save','update','destroy','then','get','Templates','UserProfileResource','stack','name','index','Template','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa571,0x1e6));var _0x1a57=function(_0x95cf71,_0x597e5b){_0x95cf71=_0x95cf71-0x0;var _0x979b54=_0xa571[_0x95cf71];return _0x979b54;};'use strict';var emlformat=require(_0x1a57('0x0'));var rimraf=require(_0x1a57('0x1'));var zipdir=require(_0x1a57('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1a57('0x3'));var moment=require(_0x1a57('0x4'));var BPromise=require(_0x1a57('0x5'));var Mustache=require(_0x1a57('0x6'));var util=require(_0x1a57('0x7'));var path=require(_0x1a57('0x8'));var sox=require(_0x1a57('0x9'));var csv=require(_0x1a57('0xa'));var ejs=require(_0x1a57('0xb'));var fs=require('fs');var fs_extra=require(_0x1a57('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1a57('0xd'));var jsforce=require(_0x1a57('0xe'));var deskjs=require(_0x1a57('0xf'));var toCsv=require(_0x1a57('0xa'));var querystring=require(_0x1a57('0x10'));var Papa=require('papaparse');var Redis=require(_0x1a57('0x11'));var authService=require(_0x1a57('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1a57('0x13'));var hardwareService=require(_0x1a57('0x14'));var logger=require(_0x1a57('0x15'))(_0x1a57('0x16'));var utils=require(_0x1a57('0x17'));var config=require(_0x1a57('0x18'));var licenseUtil=require(_0x1a57('0x19'));var db=require(_0x1a57('0x1a'))['db'];function respondWithStatusCode(_0x18ccf2,_0x4202a5){_0x4202a5=_0x4202a5||0xcc;return function(_0x1ea571){if(_0x1ea571){return _0x18ccf2[_0x1a57('0x1b')](_0x4202a5);}return _0x18ccf2[_0x1a57('0x1c')](_0x4202a5)['end']();};}function respondWithResult(_0x1684f1,_0x20f724){_0x20f724=_0x20f724||0xc8;return function(_0x4e0b93){if(_0x4e0b93){return _0x1684f1[_0x1a57('0x1c')](_0x20f724)['json'](_0x4e0b93);}};}function respondWithFilteredResult(_0x588d52,_0x31b2f9){return function(_0x1b6320){if(_0x1b6320){var _0x483544=typeof _0x31b2f9[_0x1a57('0x1d')]==='undefined'&&typeof _0x31b2f9[_0x1a57('0x1e')]===_0x1a57('0x1f');var _0x5a7afe=_0x1b6320[_0x1a57('0x20')];var _0x5b8d55=_0x483544?0x0:_0x31b2f9['offset'];var _0x51de0c=_0x483544?_0x1b6320[_0x1a57('0x20')]:_0x31b2f9[_0x1a57('0x1d')]+_0x31b2f9[_0x1a57('0x1e')];var _0x52465d;if(_0x51de0c>=_0x5a7afe){_0x51de0c=_0x5a7afe;_0x52465d=0xc8;}else{_0x52465d=0xce;}_0x588d52[_0x1a57('0x1c')](_0x52465d);return _0x588d52[_0x1a57('0x21')](_0x1a57('0x22'),_0x5b8d55+'-'+_0x51de0c+'/'+_0x5a7afe)[_0x1a57('0x23')](_0x1b6320);}return null;};}function patchUpdates(_0x7a5ff4){return function(_0x4faf74){try{jsonpatch[_0x1a57('0x24')](_0x4faf74,_0x7a5ff4,!![]);}catch(_0x448dfd){return BPromise[_0x1a57('0x25')](_0x448dfd);}return _0x4faf74[_0x1a57('0x26')]();};}function saveUpdates(_0x12ffb2,_0x4d45b5){return function(_0x46d94b){if(_0x46d94b){return _0x46d94b[_0x1a57('0x27')](_0x12ffb2)['then'](function(_0x10134a){return _0x10134a;});}return null;};}function removeEntity(_0x4b9d58,_0x336785){return function(_0x38fb19){if(_0x38fb19){return _0x38fb19[_0x1a57('0x28')]()[_0x1a57('0x29')](function(){var _0x58c855=_0x38fb19[_0x1a57('0x2a')]({'plain':!![]});var _0x3fd30a=_0x1a57('0x2b');return db[_0x1a57('0x2c')][_0x1a57('0x28')]({'where':{'type':_0x3fd30a,'resourceId':_0x58c855['id']}})[_0x1a57('0x29')](function(){return _0x38fb19;});})[_0x1a57('0x29')](function(){_0x4b9d58[_0x1a57('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x470a95,_0x5bee43){return function(_0x59ece6){if(!_0x59ece6){_0x470a95[_0x1a57('0x1b')](0x194);}return _0x59ece6;};}function handleError(_0x968168,_0xd8e52e){_0xd8e52e=_0xd8e52e||0x1f4;return function(_0x132eda){logger['error'](_0x132eda[_0x1a57('0x2d')]);if(_0x132eda[_0x1a57('0x2e')]){delete _0x132eda[_0x1a57('0x2e')];}_0x968168['status'](_0xd8e52e)['send'](_0x132eda);};}exports[_0x1a57('0x2f')]=function(_0x4b4789,_0x226876){var _0x2cfef6={},_0x33c17f={},_0x31d548={'count':0x0,'rows':[]};var _0x417284=_['map'](db[_0x1a57('0x30')][_0x1a57('0x31')],function(_0x9f18a0){return{'name':_0x9f18a0[_0x1a57('0x32')],'type':_0x9f18a0[_0x1a57('0x33')]['key']};});_0x33c17f[_0x1a57('0x34')]=_[_0x1a57('0x35')](_0x417284,_0x1a57('0x2e'));_0x33c17f[_0x1a57('0x36')]=_['keys'](_0x4b4789[_0x1a57('0x36')]);_0x33c17f['filters']=_[_0x1a57('0x37')](_0x33c17f[_0x1a57('0x34')],_0x33c17f[_0x1a57('0x36')]);_0x2cfef6[_0x1a57('0x38')]=_[_0x1a57('0x37')](_0x33c17f[_0x1a57('0x34')],qs[_0x1a57('0x39')](_0x4b4789[_0x1a57('0x36')][_0x1a57('0x39')]));_0x2cfef6[_0x1a57('0x38')]=_0x2cfef6[_0x1a57('0x38')][_0x1a57('0x3a')]?_0x2cfef6['attributes']:_0x33c17f[_0x1a57('0x34')];if(!_0x4b4789[_0x1a57('0x36')]['hasOwnProperty'](_0x1a57('0x3b'))){_0x2cfef6[_0x1a57('0x1e')]=qs[_0x1a57('0x1e')](_0x4b4789[_0x1a57('0x36')]['limit']);_0x2cfef6[_0x1a57('0x1d')]=qs[_0x1a57('0x1d')](_0x4b4789[_0x1a57('0x36')][_0x1a57('0x1d')]);}_0x2cfef6[_0x1a57('0x3c')]=qs[_0x1a57('0x3d')](_0x4b4789[_0x1a57('0x36')][_0x1a57('0x3d')]);_0x2cfef6[_0x1a57('0x3e')]=qs[_0x1a57('0x3f')](_[_0x1a57('0x40')](_0x4b4789[_0x1a57('0x36')],_0x33c17f[_0x1a57('0x3f')]),_0x417284);if(_0x4b4789[_0x1a57('0x36')][_0x1a57('0x41')]){_0x2cfef6[_0x1a57('0x3e')]=_[_0x1a57('0x42')](_0x2cfef6[_0x1a57('0x3e')],{'$or':_[_0x1a57('0x35')](_0x417284,function(_0x237f8f){if(_0x237f8f[_0x1a57('0x33')]!==_0x1a57('0x43')){var _0x527ef8={};_0x527ef8[_0x237f8f[_0x1a57('0x2e')]]={'$like':'%'+_0x4b4789[_0x1a57('0x36')][_0x1a57('0x41')]+'%'};return _0x527ef8;}})});}_0x2cfef6=_[_0x1a57('0x42')]({},_0x2cfef6,_0x4b4789[_0x1a57('0x44')]);var _0x2adc63={'where':_0x2cfef6[_0x1a57('0x3e')]};return db[_0x1a57('0x30')][_0x1a57('0x20')](_0x2adc63)[_0x1a57('0x29')](function(_0x11c018){_0x31d548['count']=_0x11c018;if(_0x4b4789[_0x1a57('0x36')]['includeAll']){_0x2cfef6[_0x1a57('0x45')]=[{'all':!![]}];}return db[_0x1a57('0x30')][_0x1a57('0x46')](_0x2cfef6);})['then'](function(_0x305701){_0x31d548[_0x1a57('0x47')]=_0x305701;return _0x31d548;})[_0x1a57('0x29')](respondWithFilteredResult(_0x226876,_0x2cfef6))[_0x1a57('0x48')](handleError(_0x226876,null));};exports[_0x1a57('0x49')]=function(_0x277bab,_0xb3765f){var _0x41ca08={'raw':!![],'where':{'id':_0x277bab['params']['id']}},_0x118100={};_0x118100[_0x1a57('0x34')]=_['keys'](db[_0x1a57('0x30')][_0x1a57('0x31')]);_0x118100[_0x1a57('0x36')]=_[_0x1a57('0x4a')](_0x277bab[_0x1a57('0x36')]);_0x118100['filters']=_[_0x1a57('0x37')](_0x118100[_0x1a57('0x34')],_0x118100[_0x1a57('0x36')]);_0x41ca08[_0x1a57('0x38')]=_[_0x1a57('0x37')](_0x118100[_0x1a57('0x34')],qs[_0x1a57('0x39')](_0x277bab['query']['fields']));_0x41ca08[_0x1a57('0x38')]=_0x41ca08[_0x1a57('0x38')][_0x1a57('0x3a')]?_0x41ca08[_0x1a57('0x38')]:_0x118100[_0x1a57('0x34')];if(_0x277bab['query'][_0x1a57('0x4b')]){_0x41ca08[_0x1a57('0x45')]=[{'all':!![]}];}_0x41ca08=_[_0x1a57('0x42')]({},_0x41ca08,_0x277bab[_0x1a57('0x44')]);return db[_0x1a57('0x30')][_0x1a57('0x4c')](_0x41ca08)[_0x1a57('0x29')](handleEntityNotFound(_0xb3765f,null))['then'](respondWithResult(_0xb3765f,null))[_0x1a57('0x48')](handleError(_0xb3765f,null));};exports[_0x1a57('0x4d')]=function(_0x4525b0,_0x1e1621){return db[_0x1a57('0x30')]['create'](_0x4525b0[_0x1a57('0x4e')],{})['then'](function(_0x51fb14){var _0x398b4e=_0x4525b0[_0x1a57('0x4f')][_0x1a57('0x2a')]({'plain':!![]});if(!_0x398b4e)throw new Error(_0x1a57('0x50'));if(_0x398b4e[_0x1a57('0x51')]===_0x1a57('0x4f')){var _0x3952ee=_0x51fb14['get']({'plain':!![]});var _0x1ffdc1=_0x1a57('0x2b');return db[_0x1a57('0x52')][_0x1a57('0x4c')]({'where':{'name':_0x1ffdc1,'userProfileId':_0x398b4e[_0x1a57('0x53')]},'raw':!![]})[_0x1a57('0x29')](function(_0x481d26){if(_0x481d26&&_0x481d26['autoAssociation']===0x0){return db['UserProfileResource'][_0x1a57('0x4d')]({'name':_0x3952ee[_0x1a57('0x2e')],'resourceId':_0x3952ee['id'],'type':_0x481d26['name'],'sectionId':_0x481d26['id']},{})['then'](function(){return _0x51fb14;});}else{return _0x51fb14;}})['catch'](function(_0x519815){logger[_0x1a57('0x54')](_0x1a57('0x55'),_0x519815);throw _0x519815;});}return _0x51fb14;})[_0x1a57('0x29')](respondWithResult(_0x1e1621,0xc9))[_0x1a57('0x48')](handleError(_0x1e1621,null));};exports[_0x1a57('0x27')]=function(_0x964c32,_0x49040e){if(_0x964c32[_0x1a57('0x4e')]['id']){delete _0x964c32[_0x1a57('0x4e')]['id'];}return db['Template']['find']({'where':{'id':_0x964c32[_0x1a57('0x56')]['id']}})['then'](handleEntityNotFound(_0x49040e,null))['then'](saveUpdates(_0x964c32[_0x1a57('0x4e')],null))['then'](respondWithResult(_0x49040e,null))['catch'](handleError(_0x49040e,null));};exports[_0x1a57('0x28')]=function(_0x177b72,_0x57fed5){return db[_0x1a57('0x30')][_0x1a57('0x4c')]({'where':{'id':_0x177b72[_0x1a57('0x56')]['id']}})[_0x1a57('0x29')](handleEntityNotFound(_0x57fed5,null))[_0x1a57('0x29')](removeEntity(_0x57fed5,null))[_0x1a57('0x48')](handleError(_0x57fed5,null));}; \ No newline at end of file +var _0xf16e=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','count','limit','Content-Range','save','update','then','destroy','get','Templates','stack','name','send','index','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','map','VIRTUAL','merge','options','Template','findAll','show','params','includeAll','include','find','catch','create'];(function(_0x267dd0,_0x41e87b){var _0x1a2fd9=function(_0x57a2a8){while(--_0x57a2a8){_0x267dd0['push'](_0x267dd0['shift']());}};_0x1a2fd9(++_0x41e87b);}(_0xf16e,0x19e));var _0xef16=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xf16e[_0x243b2f];return _0xcb3c2d;};'use strict';var emlformat=require(_0xef16('0x0'));var rimraf=require(_0xef16('0x1'));var zipdir=require(_0xef16('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef16('0x3'));var moment=require(_0xef16('0x4'));var BPromise=require(_0xef16('0x5'));var Mustache=require(_0xef16('0x6'));var util=require('util');var path=require(_0xef16('0x7'));var sox=require(_0xef16('0x8'));var csv=require(_0xef16('0x9'));var ejs=require(_0xef16('0xa'));var fs=require('fs');var fs_extra=require(_0xef16('0xb'));var _=require(_0xef16('0xc'));var squel=require(_0xef16('0xd'));var crypto=require(_0xef16('0xe'));var jsforce=require(_0xef16('0xf'));var deskjs=require(_0xef16('0x10'));var toCsv=require(_0xef16('0x9'));var querystring=require(_0xef16('0x11'));var Papa=require(_0xef16('0x12'));var Redis=require(_0xef16('0x13'));var authService=require(_0xef16('0x14'));var qs=require(_0xef16('0x15'));var as=require(_0xef16('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xef16('0x17'))('api');var utils=require(_0xef16('0x18'));var config=require(_0xef16('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bbc0c,_0x514ac0){_0x514ac0=_0x514ac0||0xcc;return function(_0x26d035){if(_0x26d035){return _0x1bbc0c[_0xef16('0x1a')](_0x514ac0);}return _0x1bbc0c[_0xef16('0x1b')](_0x514ac0)[_0xef16('0x1c')]();};}function respondWithResult(_0x54f3ad,_0x5f12a3){_0x5f12a3=_0x5f12a3||0xc8;return function(_0x290adb){if(_0x290adb){return _0x54f3ad['status'](_0x5f12a3)[_0xef16('0x1d')](_0x290adb);}};}function respondWithFilteredResult(_0x33f598,_0x14bab6){return function(_0xa31eae){if(_0xa31eae){var _0x360c38=typeof _0x14bab6[_0xef16('0x1e')]==='undefined'&&typeof _0x14bab6['limit']==='undefined';var _0x38c75e=_0xa31eae[_0xef16('0x1f')];var _0x1b30da=_0x360c38?0x0:_0x14bab6[_0xef16('0x1e')];var _0x29599d=_0x360c38?_0xa31eae[_0xef16('0x1f')]:_0x14bab6[_0xef16('0x1e')]+_0x14bab6[_0xef16('0x20')];var _0x337a4f;if(_0x29599d>=_0x38c75e){_0x29599d=_0x38c75e;_0x337a4f=0xc8;}else{_0x337a4f=0xce;}_0x33f598[_0xef16('0x1b')](_0x337a4f);return _0x33f598['set'](_0xef16('0x21'),_0x1b30da+'-'+_0x29599d+'/'+_0x38c75e)[_0xef16('0x1d')](_0xa31eae);}return null;};}function patchUpdates(_0x16ab7f){return function(_0x4fa080){try{jsonpatch['apply'](_0x4fa080,_0x16ab7f,!![]);}catch(_0x5aa993){return BPromise['reject'](_0x5aa993);}return _0x4fa080[_0xef16('0x22')]();};}function saveUpdates(_0x2501de,_0x396ae5){return function(_0x254ad9){if(_0x254ad9){return _0x254ad9[_0xef16('0x23')](_0x2501de)[_0xef16('0x24')](function(_0x395277){return _0x395277;});}return null;};}function removeEntity(_0x58ea0a,_0x4793ff){return function(_0x54b2eb){if(_0x54b2eb){return _0x54b2eb[_0xef16('0x25')]()[_0xef16('0x24')](function(){var _0x2d26f3=_0x54b2eb[_0xef16('0x26')]({'plain':!![]});var _0x139751=_0xef16('0x27');return db['UserProfileResource'][_0xef16('0x25')]({'where':{'type':_0x139751,'resourceId':_0x2d26f3['id']}})[_0xef16('0x24')](function(){return _0x54b2eb;});})[_0xef16('0x24')](function(){_0x58ea0a[_0xef16('0x1b')](0xcc)[_0xef16('0x1c')]();});}};}function handleEntityNotFound(_0x2ab2a1,_0x4605fb){return function(_0x88c781){if(!_0x88c781){_0x2ab2a1[_0xef16('0x1a')](0x194);}return _0x88c781;};}function handleError(_0xe37576,_0x125dac){_0x125dac=_0x125dac||0x1f4;return function(_0x2d35e4){logger['error'](_0x2d35e4[_0xef16('0x28')]);if(_0x2d35e4[_0xef16('0x29')]){delete _0x2d35e4[_0xef16('0x29')];}_0xe37576['status'](_0x125dac)[_0xef16('0x2a')](_0x2d35e4);};}exports[_0xef16('0x2b')]=function(_0x2bba0c,_0x538458){var _0x57da45={},_0x39bdca={},_0x2620bd={'count':0x0,'rows':[]};var _0x82eea6=_['map'](db['Template']['rawAttributes'],function(_0x211c2b){return{'name':_0x211c2b[_0xef16('0x2c')],'type':_0x211c2b[_0xef16('0x2d')]['key']};});_0x39bdca[_0xef16('0x2e')]=_['map'](_0x82eea6,_0xef16('0x29'));_0x39bdca[_0xef16('0x2f')]=_[_0xef16('0x30')](_0x2bba0c['query']);_0x39bdca[_0xef16('0x31')]=_[_0xef16('0x32')](_0x39bdca['model'],_0x39bdca['query']);_0x57da45[_0xef16('0x33')]=_[_0xef16('0x32')](_0x39bdca[_0xef16('0x2e')],qs[_0xef16('0x34')](_0x2bba0c[_0xef16('0x2f')][_0xef16('0x34')]));_0x57da45[_0xef16('0x33')]=_0x57da45[_0xef16('0x33')][_0xef16('0x35')]?_0x57da45[_0xef16('0x33')]:_0x39bdca['model'];if(!_0x2bba0c[_0xef16('0x2f')][_0xef16('0x36')]('nolimit')){_0x57da45[_0xef16('0x20')]=qs[_0xef16('0x20')](_0x2bba0c[_0xef16('0x2f')][_0xef16('0x20')]);_0x57da45[_0xef16('0x1e')]=qs['offset'](_0x2bba0c[_0xef16('0x2f')][_0xef16('0x1e')]);}_0x57da45['order']=qs['sort'](_0x2bba0c[_0xef16('0x2f')][_0xef16('0x37')]);_0x57da45[_0xef16('0x38')]=qs[_0xef16('0x31')](_[_0xef16('0x39')](_0x2bba0c[_0xef16('0x2f')],_0x39bdca['filters']),_0x82eea6);if(_0x2bba0c[_0xef16('0x2f')][_0xef16('0x3a')]){_0x57da45['where']=_['merge'](_0x57da45[_0xef16('0x38')],{'$or':_[_0xef16('0x3b')](_0x82eea6,function(_0x31be2a){if(_0x31be2a[_0xef16('0x2d')]!==_0xef16('0x3c')){var _0x1feb01={};_0x1feb01[_0x31be2a[_0xef16('0x29')]]={'$like':'%'+_0x2bba0c[_0xef16('0x2f')]['filter']+'%'};return _0x1feb01;}})});}_0x57da45=_[_0xef16('0x3d')]({},_0x57da45,_0x2bba0c[_0xef16('0x3e')]);var _0x353acd={'where':_0x57da45[_0xef16('0x38')]};return db[_0xef16('0x3f')][_0xef16('0x1f')](_0x353acd)[_0xef16('0x24')](function(_0x5d5828){_0x2620bd[_0xef16('0x1f')]=_0x5d5828;if(_0x2bba0c['query']['includeAll']){_0x57da45['include']=[{'all':!![]}];}return db['Template'][_0xef16('0x40')](_0x57da45);})[_0xef16('0x24')](function(_0x10aa8b){_0x2620bd['rows']=_0x10aa8b;return _0x2620bd;})['then'](respondWithFilteredResult(_0x538458,_0x57da45))['catch'](handleError(_0x538458,null));};exports[_0xef16('0x41')]=function(_0x21814f,_0x2566e5){var _0x20ed40={'raw':!![],'where':{'id':_0x21814f[_0xef16('0x42')]['id']}},_0x330658={};_0x330658[_0xef16('0x2e')]=_[_0xef16('0x30')](db[_0xef16('0x3f')]['rawAttributes']);_0x330658[_0xef16('0x2f')]=_[_0xef16('0x30')](_0x21814f['query']);_0x330658[_0xef16('0x31')]=_[_0xef16('0x32')](_0x330658[_0xef16('0x2e')],_0x330658[_0xef16('0x2f')]);_0x20ed40[_0xef16('0x33')]=_[_0xef16('0x32')](_0x330658[_0xef16('0x2e')],qs['fields'](_0x21814f[_0xef16('0x2f')][_0xef16('0x34')]));_0x20ed40[_0xef16('0x33')]=_0x20ed40['attributes']['length']?_0x20ed40[_0xef16('0x33')]:_0x330658['model'];if(_0x21814f[_0xef16('0x2f')][_0xef16('0x43')]){_0x20ed40[_0xef16('0x44')]=[{'all':!![]}];}_0x20ed40=_[_0xef16('0x3d')]({},_0x20ed40,_0x21814f['options']);return db[_0xef16('0x3f')][_0xef16('0x45')](_0x20ed40)[_0xef16('0x24')](handleEntityNotFound(_0x2566e5,null))[_0xef16('0x24')](respondWithResult(_0x2566e5,null))[_0xef16('0x46')](handleError(_0x2566e5,null));};exports[_0xef16('0x47')]=function(_0x346d57,_0x5dbae5){return db[_0xef16('0x3f')][_0xef16('0x47')](_0x346d57[_0xef16('0x48')],{})[_0xef16('0x24')](function(_0x2cd21f){var _0x2c81bc=_0x346d57[_0xef16('0x49')][_0xef16('0x26')]({'plain':!![]});if(!_0x2c81bc)throw new Error(_0xef16('0x4a'));if(_0x2c81bc[_0xef16('0x4b')]===_0xef16('0x49')){var _0xdcf1ed=_0x2cd21f[_0xef16('0x26')]({'plain':!![]});var _0x281df2=_0xef16('0x27');return db[_0xef16('0x4c')][_0xef16('0x45')]({'where':{'name':_0x281df2,'userProfileId':_0x2c81bc[_0xef16('0x4d')]},'raw':!![]})['then'](function(_0x554d45){if(_0x554d45&&_0x554d45[_0xef16('0x4e')]===0x0){return db[_0xef16('0x4f')]['create']({'name':_0xdcf1ed[_0xef16('0x29')],'resourceId':_0xdcf1ed['id'],'type':_0x554d45[_0xef16('0x29')],'sectionId':_0x554d45['id']},{})['then'](function(){return _0x2cd21f;});}else{return _0x2cd21f;}})[_0xef16('0x46')](function(_0x501683){logger[_0xef16('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x501683);throw _0x501683;});}return _0x2cd21f;})[_0xef16('0x24')](respondWithResult(_0x5dbae5,0xc9))['catch'](handleError(_0x5dbae5,null));};exports[_0xef16('0x23')]=function(_0x3c68a1,_0x3246c9){if(_0x3c68a1['body']['id']){delete _0x3c68a1[_0xef16('0x48')]['id'];}return db[_0xef16('0x3f')]['find']({'where':{'id':_0x3c68a1['params']['id']}})[_0xef16('0x24')](handleEntityNotFound(_0x3246c9,null))[_0xef16('0x24')](saveUpdates(_0x3c68a1[_0xef16('0x48')],null))[_0xef16('0x24')](respondWithResult(_0x3246c9,null))[_0xef16('0x46')](handleError(_0x3246c9,null));};exports['destroy']=function(_0x5da31c,_0x415998){return db['Template'][_0xef16('0x45')]({'where':{'id':_0x5da31c[_0xef16('0x42')]['id']}})[_0xef16('0x24')](handleEntityNotFound(_0x415998,null))[_0xef16('0x24')](removeEntity(_0x415998,null))['catch'](handleError(_0x415998,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index c90536d..f3c2df8 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 _0x1155=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','util','../../config/logger'];(function(_0x15aa73,_0x4eea3f){var _0x3fe2f5=function(_0x4c5b4c){while(--_0x4c5b4c){_0x15aa73['push'](_0x15aa73['shift']());}};_0x3fe2f5(++_0x4eea3f);}(_0x1155,0x1cb));var _0x5115=function(_0x7a68c7,_0x1cfb76){_0x7a68c7=_0x7a68c7-0x0;var _0x40e6fa=_0x1155[_0x7a68c7];return _0x40e6fa;};'use strict';var _=require(_0x5115('0x0'));var util=require(_0x5115('0x1'));var logger=require(_0x5115('0x2'))('api');var moment=require(_0x5115('0x3'));var BPromise=require(_0x5115('0x4'));var rp=require(_0x5115('0x5'));var fs=require('fs');var path=require(_0x5115('0x6'));var rimraf=require(_0x5115('0x7'));var config=require(_0x5115('0x8'));var attributes=require(_0x5115('0x9'));module[_0x5115('0xa')]=function(_0x286262,_0x49ffda){return _0x286262[_0x5115('0xb')](_0x5115('0xc'),attributes,{'tableName':_0x5115('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc92=['rimraf','../../config/environment','./template.attributes','define','Template','bluebird','request-promise','path'];(function(_0x128c97,_0x30f201){var _0x139f59=function(_0x2dacfa){while(--_0x2dacfa){_0x128c97['push'](_0x128c97['shift']());}};_0x139f59(++_0x30f201);}(_0xdc92,0x1b5));var _0x2dc9=function(_0x454e6d,_0x1e1f38){_0x454e6d=_0x454e6d-0x0;var _0x4bc294=_0xdc92[_0x454e6d];return _0x4bc294;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2dc9('0x0'));var rp=require(_0x2dc9('0x1'));var fs=require('fs');var path=require(_0x2dc9('0x2'));var rimraf=require(_0x2dc9('0x3'));var config=require(_0x2dc9('0x4'));var attributes=require(_0x2dc9('0x5'));module['exports']=function(_0x16d095,_0x2667f5){return _0x16d095[_0x2dc9('0x6')](_0x2dc9('0x7'),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 018fd2b..edf7666 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 _0xa811=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','Template,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','Template','findAll','options','attributes','include','map','model','GetTemplate','stringify','lodash','util'];(function(_0x5c81d1,_0x3e1d94){var _0x275777=function(_0x3db1e7){while(--_0x3db1e7){_0x5c81d1['push'](_0x5c81d1['shift']());}};_0x275777(++_0x3e1d94);}(_0xa811,0x1de));var _0x1a81=function(_0x303fe3,_0x55290e){_0x303fe3=_0x303fe3-0x0;var _0x4b479f=_0xa811[_0x303fe3];return _0x4b479f;};'use strict';var _=require(_0x1a81('0x0'));var util=require(_0x1a81('0x1'));var moment=require(_0x1a81('0x2'));var BPromise=require(_0x1a81('0x3'));var rs=require(_0x1a81('0x4'));var fs=require('fs');var Redis=require(_0x1a81('0x5'));var db=require(_0x1a81('0x6'))['db'];var utils=require(_0x1a81('0x7'));var logger=require(_0x1a81('0x8'))(_0x1a81('0x9'));var config=require(_0x1a81('0xa'));var jayson=require(_0x1a81('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x125b8b,_0x53fca7,_0x16a418){return new BPromise(function(_0x25b20b,_0x4c9ab2){return client[_0x1a81('0xc')](_0x125b8b,_0x16a418)[_0x1a81('0xd')](function(_0x146e8c){logger['info'](_0x1a81('0xe'),_0x53fca7,_0x1a81('0xf'));logger[_0x1a81('0x10')]('Template,\x20%s,\x20%s,\x20%s',_0x53fca7,_0x1a81('0xf'),JSON['stringify'](_0x146e8c));if(_0x146e8c[_0x1a81('0x11')]){if(_0x146e8c[_0x1a81('0x11')][_0x1a81('0x12')]===0x1f4){logger['error'](_0x1a81('0xe'),_0x53fca7,_0x146e8c[_0x1a81('0x11')][_0x1a81('0x13')]);return _0x4c9ab2(_0x146e8c['error']['message']);}logger['error'](_0x1a81('0xe'),_0x53fca7,_0x146e8c['error'][_0x1a81('0x13')]);return _0x25b20b(_0x146e8c[_0x1a81('0x11')]['message']);}else{logger[_0x1a81('0x14')](_0x1a81('0xe'),_0x53fca7,_0x1a81('0xf'));_0x25b20b(_0x146e8c[_0x1a81('0x15')][_0x1a81('0x13')]);}})[_0x1a81('0x16')](function(_0x52b03e){logger['error']('Template,\x20%s,\x20%s',_0x53fca7,_0x52b03e);_0x4c9ab2(_0x52b03e);});});}exports['GetTemplate']=function(_0x4aa6a0){var _0x359684=this;return new Promise(function(_0x36e56f,_0x45728e){return db[_0x1a81('0x17')][_0x1a81('0x18')]({'raw':_0x4aa6a0[_0x1a81('0x19')]?_0x4aa6a0[_0x1a81('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4aa6a0[_0x1a81('0x19')]?_0x4aa6a0[_0x1a81('0x19')]['where']||null:null,'attributes':_0x4aa6a0[_0x1a81('0x19')]?_0x4aa6a0[_0x1a81('0x19')][_0x1a81('0x1a')]||null:null,'limit':_0x4aa6a0[_0x1a81('0x19')]?_0x4aa6a0[_0x1a81('0x19')]['limit']||null:null,'include':_0x4aa6a0[_0x1a81('0x19')]?_0x4aa6a0[_0x1a81('0x19')][_0x1a81('0x1b')]?_[_0x1a81('0x1c')](_0x4aa6a0[_0x1a81('0x19')][_0x1a81('0x1b')],function(_0x3d43ca){return{'model':db[_0x3d43ca[_0x1a81('0x1d')]],'as':_0x3d43ca['as'],'attributes':_0x3d43ca[_0x1a81('0x1a')],'include':_0x3d43ca[_0x1a81('0x1b')]?_[_0x1a81('0x1c')](_0x3d43ca[_0x1a81('0x1b')],function(_0x38e58d){return{'model':db[_0x38e58d[_0x1a81('0x1d')]],'as':_0x38e58d['as'],'attributes':_0x38e58d['attributes'],'include':_0x38e58d['include']?_[_0x1a81('0x1c')](_0x38e58d[_0x1a81('0x1b')],function(_0x894b46){return{'model':db[_0x894b46[_0x1a81('0x1d')]],'as':_0x894b46['as'],'attributes':_0x894b46[_0x1a81('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a0ea8){logger[_0x1a81('0x14')](_0x1a81('0x1e'),_0x4aa6a0);logger[_0x1a81('0x10')](_0x1a81('0x1e'),_0x4aa6a0,JSON[_0x1a81('0x1f')](_0x1a0ea8));_0x36e56f(_0x1a0ea8);})[_0x1a81('0x16')](function(_0x186510){logger[_0x1a81('0x11')]('GetTemplate',_0x186510[_0x1a81('0x13')],_0x4aa6a0);_0x45728e(_0x359684[_0x1a81('0x11')](0x1f4,_0x186510[_0x1a81('0x13')]));});});}; \ No newline at end of file +var _0x82f4=['map','include','model','debug','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','Template,\x20%s,\x20%s','message','info','result','GetTemplate','Template','options','raw','where','attributes','limit'];(function(_0x19159a,_0x1cb5c3){var _0xa677f4=function(_0x24bb85){while(--_0x24bb85){_0x19159a['push'](_0x19159a['shift']());}};_0xa677f4(++_0x1cb5c3);}(_0x82f4,0x1bf));var _0x482f=function(_0x4f1ef3,_0x2f4764){_0x4f1ef3=_0x4f1ef3-0x0;var _0x3f6294=_0x82f4[_0x4f1ef3];return _0x3f6294;};'use strict';var _=require(_0x482f('0x0'));var util=require(_0x482f('0x1'));var moment=require('moment');var BPromise=require(_0x482f('0x2'));var rs=require(_0x482f('0x3'));var fs=require('fs');var Redis=require(_0x482f('0x4'));var db=require(_0x482f('0x5'))['db'];var utils=require(_0x482f('0x6'));var logger=require(_0x482f('0x7'))('rpc');var config=require(_0x482f('0x8'));var jayson=require(_0x482f('0x9'));var client=jayson[_0x482f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25509e,_0x3d8b14,_0x42b36b){return new BPromise(function(_0x549235,_0x28c43b){return client[_0x482f('0xb')](_0x25509e,_0x42b36b)[_0x482f('0xc')](function(_0x8aab6b){logger['info']('Template,\x20%s,\x20%s',_0x3d8b14,_0x482f('0xd'));logger['debug'](_0x482f('0xe'),_0x3d8b14,_0x482f('0xd'),JSON[_0x482f('0xf')](_0x8aab6b));if(_0x8aab6b[_0x482f('0x10')]){if(_0x8aab6b[_0x482f('0x10')][_0x482f('0x11')]===0x1f4){logger['error'](_0x482f('0x12'),_0x3d8b14,_0x8aab6b[_0x482f('0x10')][_0x482f('0x13')]);return _0x28c43b(_0x8aab6b[_0x482f('0x10')][_0x482f('0x13')]);}logger[_0x482f('0x10')]('Template,\x20%s,\x20%s',_0x3d8b14,_0x8aab6b['error'][_0x482f('0x13')]);return _0x549235(_0x8aab6b[_0x482f('0x10')][_0x482f('0x13')]);}else{logger[_0x482f('0x14')]('Template,\x20%s,\x20%s',_0x3d8b14,_0x482f('0xd'));_0x549235(_0x8aab6b[_0x482f('0x15')][_0x482f('0x13')]);}})['catch'](function(_0xa2ff14){logger['error']('Template,\x20%s,\x20%s',_0x3d8b14,_0xa2ff14);_0x28c43b(_0xa2ff14);});});}exports[_0x482f('0x16')]=function(_0x97db2c){var _0x49da93=this;return new Promise(function(_0x323d87,_0x579b67){return db[_0x482f('0x17')]['findAll']({'raw':_0x97db2c[_0x482f('0x18')]?_0x97db2c[_0x482f('0x18')][_0x482f('0x19')]===undefined?!![]:![]:!![],'where':_0x97db2c[_0x482f('0x18')]?_0x97db2c[_0x482f('0x18')][_0x482f('0x1a')]||null:null,'attributes':_0x97db2c[_0x482f('0x18')]?_0x97db2c['options'][_0x482f('0x1b')]||null:null,'limit':_0x97db2c[_0x482f('0x18')]?_0x97db2c[_0x482f('0x18')][_0x482f('0x1c')]||null:null,'include':_0x97db2c[_0x482f('0x18')]?_0x97db2c[_0x482f('0x18')]['include']?_[_0x482f('0x1d')](_0x97db2c[_0x482f('0x18')][_0x482f('0x1e')],function(_0x13dd80){return{'model':db[_0x13dd80[_0x482f('0x1f')]],'as':_0x13dd80['as'],'attributes':_0x13dd80['attributes'],'include':_0x13dd80[_0x482f('0x1e')]?_[_0x482f('0x1d')](_0x13dd80[_0x482f('0x1e')],function(_0x22dc00){return{'model':db[_0x22dc00['model']],'as':_0x22dc00['as'],'attributes':_0x22dc00[_0x482f('0x1b')],'include':_0x22dc00['include']?_[_0x482f('0x1d')](_0x22dc00[_0x482f('0x1e')],function(_0x582805){return{'model':db[_0x582805[_0x482f('0x1f')]],'as':_0x582805['as'],'attributes':_0x582805['attributes']};}):[]};}):[]};}):[]:[]})[_0x482f('0xc')](function(_0x3fa7d6){logger[_0x482f('0x14')](_0x482f('0x16'),_0x97db2c);logger[_0x482f('0x20')](_0x482f('0x16'),_0x97db2c,JSON[_0x482f('0xf')](_0x3fa7d6));_0x323d87(_0x3fa7d6);})[_0x482f('0x21')](function(_0x5e38b5){logger['error'](_0x482f('0x16'),_0x5e38b5[_0x482f('0x13')],_0x97db2c);_0x579b67(_0x49da93['error'](0x1f4,_0x5e38b5[_0x482f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index f8a41d4..49c72cf 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 _0x678e=['put','update','delete','multer','util','path','connect-timeout','fs-extra','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','/:id/all_conditions','addAction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x678e,0x153));var _0xe678=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x678e[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xe678('0x0'));var util=require(_0xe678('0x1'));var path=require(_0xe678('0x2'));var timeout=require(_0xe678('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe678('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe678('0x5'));var controller=require(_0xe678('0x6'));router[_0xe678('0x7')]('/',auth[_0xe678('0x8')](),controller[_0xe678('0x9')]);router[_0xe678('0x7')](_0xe678('0xa'),auth['isAuthenticated'](),controller[_0xe678('0xb')]);router[_0xe678('0x7')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0xe678('0xc')]);router[_0xe678('0x7')](_0xe678('0xd'),auth[_0xe678('0x8')](),controller[_0xe678('0xe')]);router[_0xe678('0x7')](_0xe678('0xf'),auth[_0xe678('0x8')](),controller[_0xe678('0x10')]);router[_0xe678('0x11')]('/',auth[_0xe678('0x8')](),controller[_0xe678('0x12')]);router[_0xe678('0x11')](_0xe678('0x13'),auth[_0xe678('0x8')](),controller['addAllCondition']);router[_0xe678('0x11')]('/:id/any_conditions',auth[_0xe678('0x8')](),controller['addAnyCondition']);router[_0xe678('0x11')]('/:id/actions',auth[_0xe678('0x8')](),controller[_0xe678('0x14')]);router[_0xe678('0x15')](_0xe678('0xa'),auth['isAuthenticated'](),controller[_0xe678('0x16')]);router[_0xe678('0x17')](_0xe678('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x088d=['index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','create','post','addAnyCondition','addAction','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x088d,0x10a));var _0xd088=function(_0x58168a,_0x18f374){_0x58168a=_0x58168a-0x0;var _0x1b9e79=_0x088d[_0x58168a];return _0x1b9e79;};'use strict';var multer=require('multer');var util=require(_0xd088('0x0'));var path=require(_0xd088('0x1'));var timeout=require(_0xd088('0x2'));var express=require(_0xd088('0x3'));var router=express[_0xd088('0x4')]();var fs_extra=require(_0xd088('0x5'));var auth=require(_0xd088('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./trigger.controller');router[_0xd088('0x7')]('/',auth[_0xd088('0x8')](),controller[_0xd088('0x9')]);router[_0xd088('0x7')](_0xd088('0xa'),auth['isAuthenticated'](),controller[_0xd088('0xb')]);router[_0xd088('0x7')](_0xd088('0xc'),auth[_0xd088('0x8')](),controller[_0xd088('0xd')]);router[_0xd088('0x7')](_0xd088('0xe'),auth[_0xd088('0x8')](),controller['getAnyConditions']);router[_0xd088('0x7')](_0xd088('0xf'),auth[_0xd088('0x8')](),controller['getActions']);router['post']('/',auth[_0xd088('0x8')](),controller[_0xd088('0x10')]);router[_0xd088('0x11')]('/:id/all_conditions',auth[_0xd088('0x8')](),controller['addAllCondition']);router[_0xd088('0x11')]('/:id/any_conditions',auth[_0xd088('0x8')](),controller[_0xd088('0x12')]);router['post'](_0xd088('0xf'),auth[_0xd088('0x8')](),controller[_0xd088('0x13')]);router[_0xd088('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xd088('0x15')]);router[_0xd088('0x16')](_0xd088('0xa'),auth[_0xd088('0x8')](),controller[_0xd088('0x17')]);module[_0xd088('0x18')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 9b96ae4..88a3095 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 _0x5b90=['exports','STRING','sequelize'];(function(_0xf2f72b,_0x39d723){var _0xd7891c=function(_0x5a8709){while(--_0x5a8709){_0xf2f72b['push'](_0xf2f72b['shift']());}};_0xd7891c(++_0x39d723);}(_0x5b90,0x80));var _0x05b9=function(_0x15b380,_0x1a3c5f){_0x15b380=_0x15b380-0x0;var _0x232c5c=_0x5b90[_0x15b380];return _0x232c5c;};'use strict';var Sequelize=require(_0x05b9('0x0'));module[_0x05b9('0x1')]={'name':{'type':Sequelize[_0x05b9('0x2')]},'channel':{'type':Sequelize[_0x05b9('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6d7e=['STRING','BOOLEAN'];(function(_0x40597a,_0x30410d){var _0x423296=function(_0x116441){while(--_0x116441){_0x40597a['push'](_0x40597a['shift']());}};_0x423296(++_0x30410d);}(_0x6d7e,0xaa));var _0xe6d7=function(_0x409197,_0x51280f){_0x409197=_0x409197-0x0;var _0x16a6f5=_0x6d7e[_0x409197];return _0x16a6f5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe6d7('0x0')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xe6d7('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 8726b38..cca73cc 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 _0x2e6f=['Trigger','rawAttributes','type','key','filters','intersection','model','attributes','query','fields','hasOwnProperty','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','rows','params','keys','length','catch','create','body','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','nolimit','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','Triggers','UserProfileResource','error','stack','name','send','index','map'];(function(_0x36bbbb,_0x3f6709){var _0x3ca0eb=function(_0x299763){while(--_0x299763){_0x36bbbb['push'](_0x36bbbb['shift']());}};_0x3ca0eb(++_0x3f6709);}(_0x2e6f,0xf5));var _0xf2e6=function(_0x15e3d0,_0x491297){_0x15e3d0=_0x15e3d0-0x0;var _0x4124e4=_0x2e6f[_0x15e3d0];return _0x4124e4;};'use strict';var emlformat=require(_0xf2e6('0x0'));var rimraf=require(_0xf2e6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf2e6('0x2'));var moment=require(_0xf2e6('0x3'));var BPromise=require(_0xf2e6('0x4'));var Mustache=require(_0xf2e6('0x5'));var util=require(_0xf2e6('0x6'));var path=require(_0xf2e6('0x7'));var sox=require(_0xf2e6('0x8'));var csv=require(_0xf2e6('0x9'));var ejs=require(_0xf2e6('0xa'));var fs=require('fs');var fs_extra=require(_0xf2e6('0xb'));var _=require('lodash');var squel=require(_0xf2e6('0xc'));var crypto=require(_0xf2e6('0xd'));var jsforce=require(_0xf2e6('0xe'));var deskjs=require(_0xf2e6('0xf'));var toCsv=require(_0xf2e6('0x9'));var querystring=require(_0xf2e6('0x10'));var Papa=require(_0xf2e6('0x11'));var Redis=require(_0xf2e6('0x12'));var authService=require(_0xf2e6('0x13'));var qs=require(_0xf2e6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf2e6('0x15'));var logger=require(_0xf2e6('0x16'))(_0xf2e6('0x17'));var utils=require(_0xf2e6('0x18'));var config=require(_0xf2e6('0x19'));var licenseUtil=require(_0xf2e6('0x1a'));var db=require(_0xf2e6('0x1b'))['db'];function respondWithStatusCode(_0x52dfa6,_0x38e43f){_0x38e43f=_0x38e43f||0xcc;return function(_0xdfa91b){if(_0xdfa91b){return _0x52dfa6[_0xf2e6('0x1c')](_0x38e43f);}return _0x52dfa6['status'](_0x38e43f)[_0xf2e6('0x1d')]();};}function respondWithResult(_0x13fef6,_0x3b315a){_0x3b315a=_0x3b315a||0xc8;return function(_0x5031d4){if(_0x5031d4){return _0x13fef6[_0xf2e6('0x1e')](_0x3b315a)[_0xf2e6('0x1f')](_0x5031d4);}};}function respondWithFilteredResult(_0x559d8b,_0x5b0e98){return function(_0x325169){if(_0x325169){var _0x21d87b=typeof _0x5b0e98[_0xf2e6('0x20')]===_0xf2e6('0x21')&&typeof _0x5b0e98[_0xf2e6('0x22')]===_0xf2e6('0x21');var _0x33a97b=_0x325169[_0xf2e6('0x23')];var _0x246a90=_0x21d87b?0x0:_0x5b0e98['offset'];var _0x5b5621=_0x21d87b?_0x325169['count']:_0x5b0e98[_0xf2e6('0x20')]+_0x5b0e98[_0xf2e6('0x22')];var _0x5708bb;if(_0x5b5621>=_0x33a97b){_0x5b5621=_0x33a97b;_0x5708bb=0xc8;}else{_0x5708bb=0xce;}_0x559d8b[_0xf2e6('0x1e')](_0x5708bb);return _0x559d8b[_0xf2e6('0x24')]('Content-Range',_0x246a90+'-'+_0x5b5621+'/'+_0x33a97b)['json'](_0x325169);}return null;};}function patchUpdates(_0x4e9fb4){return function(_0x4e63d8){try{jsonpatch[_0xf2e6('0x25')](_0x4e63d8,_0x4e9fb4,!![]);}catch(_0x3a6689){return BPromise[_0xf2e6('0x26')](_0x3a6689);}return _0x4e63d8[_0xf2e6('0x27')]();};}function saveUpdates(_0x502f01,_0x3c1a14){return function(_0x23a9b2){if(_0x23a9b2){return _0x23a9b2[_0xf2e6('0x28')](_0x502f01)[_0xf2e6('0x29')](function(_0x472e46){return _0x472e46;});}return null;};}function removeEntity(_0x1aa85d,_0x4a103a){return function(_0x2cabb5){if(_0x2cabb5){return _0x2cabb5[_0xf2e6('0x2a')]()['then'](function(){var _0x467ddf=_0x2cabb5[_0xf2e6('0x2b')]({'plain':!![]});var _0x5028c7=_0xf2e6('0x2c');return db[_0xf2e6('0x2d')][_0xf2e6('0x2a')]({'where':{'type':_0x5028c7,'resourceId':_0x467ddf['id']}})['then'](function(){return _0x2cabb5;});})[_0xf2e6('0x29')](function(){_0x1aa85d[_0xf2e6('0x1e')](0xcc)[_0xf2e6('0x1d')]();});}};}function handleEntityNotFound(_0x49458f,_0x4b525b){return function(_0x52b215){if(!_0x52b215){_0x49458f[_0xf2e6('0x1c')](0x194);}return _0x52b215;};}function handleError(_0x5cf44a,_0x2d838d){_0x2d838d=_0x2d838d||0x1f4;return function(_0x557be7){logger[_0xf2e6('0x2e')](_0x557be7[_0xf2e6('0x2f')]);if(_0x557be7[_0xf2e6('0x30')]){delete _0x557be7['name'];}_0x5cf44a[_0xf2e6('0x1e')](_0x2d838d)[_0xf2e6('0x31')](_0x557be7);};}exports[_0xf2e6('0x32')]=function(_0x5b8684,_0x51b8f6){var _0x567160={},_0x3e67c6={},_0x11b70f={'count':0x0,'rows':[]};var _0x4f69c6=_[_0xf2e6('0x33')](db[_0xf2e6('0x34')][_0xf2e6('0x35')],function(_0xff1e7f){return{'name':_0xff1e7f['fieldName'],'type':_0xff1e7f[_0xf2e6('0x36')][_0xf2e6('0x37')]};});_0x3e67c6['model']=_['map'](_0x4f69c6,'name');_0x3e67c6['query']=_['keys'](_0x5b8684['query']);_0x3e67c6[_0xf2e6('0x38')]=_[_0xf2e6('0x39')](_0x3e67c6[_0xf2e6('0x3a')],_0x3e67c6['query']);_0x567160[_0xf2e6('0x3b')]=_[_0xf2e6('0x39')](_0x3e67c6[_0xf2e6('0x3a')],qs['fields'](_0x5b8684[_0xf2e6('0x3c')][_0xf2e6('0x3d')]));_0x567160['attributes']=_0x567160[_0xf2e6('0x3b')]['length']?_0x567160['attributes']:_0x3e67c6[_0xf2e6('0x3a')];if(!_0x5b8684[_0xf2e6('0x3c')][_0xf2e6('0x3e')]('nolimit')){_0x567160[_0xf2e6('0x22')]=qs[_0xf2e6('0x22')](_0x5b8684[_0xf2e6('0x3c')][_0xf2e6('0x22')]);_0x567160[_0xf2e6('0x20')]=qs[_0xf2e6('0x20')](_0x5b8684[_0xf2e6('0x3c')][_0xf2e6('0x20')]);}_0x567160[_0xf2e6('0x3f')]=qs[_0xf2e6('0x40')](_0x5b8684[_0xf2e6('0x3c')][_0xf2e6('0x40')]);_0x567160['where']=qs[_0xf2e6('0x38')](_[_0xf2e6('0x41')](_0x5b8684['query'],_0x3e67c6[_0xf2e6('0x38')]),_0x4f69c6);if(_0x5b8684[_0xf2e6('0x3c')]['filter']){_0x567160['where']=_[_0xf2e6('0x42')](_0x567160[_0xf2e6('0x43')],{'$or':_[_0xf2e6('0x33')](_0x4f69c6,function(_0x4ad552){if(_0x4ad552[_0xf2e6('0x36')]!==_0xf2e6('0x44')){var _0x3e7c6f={};_0x3e7c6f[_0x4ad552['name']]={'$like':'%'+_0x5b8684['query'][_0xf2e6('0x45')]+'%'};return _0x3e7c6f;}})});}_0x567160=_['merge']({},_0x567160,_0x5b8684[_0xf2e6('0x46')]);var _0x37b54e={'where':_0x567160[_0xf2e6('0x43')]};return db[_0xf2e6('0x34')][_0xf2e6('0x23')](_0x37b54e)[_0xf2e6('0x29')](function(_0x550630){_0x11b70f[_0xf2e6('0x23')]=_0x550630;if(_0x5b8684['query'][_0xf2e6('0x47')]){_0x567160[_0xf2e6('0x48')]=[{'all':!![]}];}return db[_0xf2e6('0x34')]['findAll'](_0x567160);})['then'](function(_0x13ea71){_0x11b70f[_0xf2e6('0x49')]=_0x13ea71;return _0x11b70f;})['then'](respondWithFilteredResult(_0x51b8f6,_0x567160))['catch'](handleError(_0x51b8f6,null));};exports['show']=function(_0x3b165e,_0x4a50c0){var _0x4cfd47={'raw':![],'where':{'id':_0x3b165e[_0xf2e6('0x4a')]['id']}},_0xcf269e={};_0xcf269e['model']=_[_0xf2e6('0x4b')](db[_0xf2e6('0x34')][_0xf2e6('0x35')]);_0xcf269e[_0xf2e6('0x3c')]=_[_0xf2e6('0x4b')](_0x3b165e[_0xf2e6('0x3c')]);_0xcf269e[_0xf2e6('0x38')]=_[_0xf2e6('0x39')](_0xcf269e[_0xf2e6('0x3a')],_0xcf269e[_0xf2e6('0x3c')]);_0x4cfd47[_0xf2e6('0x3b')]=_[_0xf2e6('0x39')](_0xcf269e[_0xf2e6('0x3a')],qs[_0xf2e6('0x3d')](_0x3b165e[_0xf2e6('0x3c')][_0xf2e6('0x3d')]));_0x4cfd47[_0xf2e6('0x3b')]=_0x4cfd47[_0xf2e6('0x3b')][_0xf2e6('0x4c')]?_0x4cfd47[_0xf2e6('0x3b')]:_0xcf269e[_0xf2e6('0x3a')];if(_0x3b165e[_0xf2e6('0x3c')][_0xf2e6('0x47')]){_0x4cfd47[_0xf2e6('0x48')]=[{'all':!![]}];}_0x4cfd47=_[_0xf2e6('0x42')]({},_0x4cfd47,_0x3b165e[_0xf2e6('0x46')]);return db[_0xf2e6('0x34')]['find'](_0x4cfd47)['then'](handleEntityNotFound(_0x4a50c0,null))[_0xf2e6('0x29')](respondWithResult(_0x4a50c0,null))[_0xf2e6('0x4d')](handleError(_0x4a50c0,null));};exports[_0xf2e6('0x4e')]=function(_0x2b9ac0,_0x112c37){return db['Trigger'][_0xf2e6('0x4e')](_0x2b9ac0[_0xf2e6('0x4f')],{})[_0xf2e6('0x29')](function(_0x5814e3){var _0x3c8c86=_0x2b9ac0['user'][_0xf2e6('0x2b')]({'plain':!![]});if(!_0x3c8c86)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c8c86[_0xf2e6('0x50')]===_0xf2e6('0x51')){var _0x274bb5=_0x5814e3[_0xf2e6('0x2b')]({'plain':!![]});var _0x21f981=_0xf2e6('0x2c');return db[_0xf2e6('0x52')][_0xf2e6('0x53')]({'where':{'name':_0x21f981,'userProfileId':_0x3c8c86[_0xf2e6('0x54')]},'raw':!![]})['then'](function(_0xe10f86){if(_0xe10f86&&_0xe10f86[_0xf2e6('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x274bb5[_0xf2e6('0x30')],'resourceId':_0x274bb5['id'],'type':_0xe10f86[_0xf2e6('0x30')],'sectionId':_0xe10f86['id']},{})[_0xf2e6('0x29')](function(){return _0x5814e3;});}else{return _0x5814e3;}})[_0xf2e6('0x4d')](function(_0x1edcf5){logger[_0xf2e6('0x2e')](_0xf2e6('0x56'),_0x1edcf5);throw _0x1edcf5;});}return _0x5814e3;})['then'](respondWithResult(_0x112c37,0xc9))[_0xf2e6('0x4d')](handleError(_0x112c37,null));};exports['update']=function(_0x182eb7,_0x239bed){if(_0x182eb7[_0xf2e6('0x4f')]['id']){delete _0x182eb7[_0xf2e6('0x4f')]['id'];}return db[_0xf2e6('0x34')]['find']({'where':{'id':_0x182eb7[_0xf2e6('0x4a')]['id']}})[_0xf2e6('0x29')](handleEntityNotFound(_0x239bed,null))[_0xf2e6('0x29')](saveUpdates(_0x182eb7[_0xf2e6('0x4f')],null))[_0xf2e6('0x29')](respondWithResult(_0x239bed,null))['catch'](handleError(_0x239bed,null));};exports[_0xf2e6('0x2a')]=function(_0x230ad6,_0x709af2){return db[_0xf2e6('0x34')][_0xf2e6('0x53')]({'where':{'id':_0x230ad6['params']['id']}})['then'](handleEntityNotFound(_0x709af2,null))[_0xf2e6('0x29')](removeEntity(_0x709af2,null))[_0xf2e6('0x4d')](handleError(_0x709af2,null));};exports['addAllCondition']=function(_0xd0f688,_0x39db6e,_0x146a85){if(_0xd0f688[_0xf2e6('0x4f')]['id']){delete _0xd0f688['body']['id'];}return db[_0xf2e6('0x34')]['find']({'where':{'id':_0xd0f688[_0xf2e6('0x4a')]['id']}})[_0xf2e6('0x29')](handleEntityNotFound(_0x39db6e,null))['then'](function(_0x2b92ec){if(_0x2b92ec){_0xd0f688[_0xf2e6('0x4f')][_0xf2e6('0x57')]=_0x2b92ec['id'];return db[_0xf2e6('0x58')][_0xf2e6('0x4e')](_0xd0f688[_0xf2e6('0x4f')]);}})['then'](respondWithResult(_0x39db6e,null))[_0xf2e6('0x4d')](handleError(_0x39db6e,null));};exports[_0xf2e6('0x59')]=function(_0x3fa1ab,_0x14a93c,_0xf29dec){if(_0x3fa1ab[_0xf2e6('0x4f')]['id']){delete _0x3fa1ab[_0xf2e6('0x4f')]['id'];}return db[_0xf2e6('0x34')][_0xf2e6('0x53')]({'where':{'id':_0x3fa1ab['params']['id']}})[_0xf2e6('0x29')](handleEntityNotFound(_0x14a93c,null))[_0xf2e6('0x29')](function(_0x397cdf){if(_0x397cdf){_0x3fa1ab[_0xf2e6('0x4f')][_0xf2e6('0x5a')]=_0x397cdf['id'];return db[_0xf2e6('0x58')][_0xf2e6('0x4e')](_0x3fa1ab[_0xf2e6('0x4f')]);}})[_0xf2e6('0x29')](respondWithResult(_0x14a93c,null))['catch'](handleError(_0x14a93c,null));};exports['getAllConditions']=function(_0x380b1b,_0x959fe2,_0x448120){var _0x441de3={};var _0x346729={};var _0x255507;var _0x4520ce;return db[_0xf2e6('0x34')]['findOne']({'where':{'id':_0x380b1b[_0xf2e6('0x4a')]['id']}})[_0xf2e6('0x29')](handleEntityNotFound(_0x959fe2,null))['then'](function(_0x3371f8){if(_0x3371f8){_0x255507=_0x3371f8;_0x346729['model']=_[_0xf2e6('0x4b')](db[_0xf2e6('0x58')][_0xf2e6('0x35')]);_0x346729['query']=_[_0xf2e6('0x4b')](_0x380b1b[_0xf2e6('0x3c')]);_0x346729['filters']=_['intersection'](_0x346729[_0xf2e6('0x3a')],_0x346729[_0xf2e6('0x3c')]);_0x441de3[_0xf2e6('0x3b')]=_[_0xf2e6('0x39')](_0x346729[_0xf2e6('0x3a')],qs['fields'](_0x380b1b[_0xf2e6('0x3c')][_0xf2e6('0x3d')]));_0x441de3[_0xf2e6('0x3b')]=_0x441de3[_0xf2e6('0x3b')][_0xf2e6('0x4c')]?_0x441de3[_0xf2e6('0x3b')]:_0x346729[_0xf2e6('0x3a')];_0x441de3[_0xf2e6('0x3f')]=qs[_0xf2e6('0x40')](_0x380b1b[_0xf2e6('0x3c')][_0xf2e6('0x40')]);_0x441de3['where']=qs[_0xf2e6('0x38')](_['pick'](_0x380b1b['query'],_0x346729[_0xf2e6('0x38')]));if(_0x380b1b[_0xf2e6('0x3c')][_0xf2e6('0x45')]){_0x441de3[_0xf2e6('0x43')]=_['merge'](_0x441de3[_0xf2e6('0x43')],{'$or':_[_0xf2e6('0x33')](_0x441de3[_0xf2e6('0x3b')],function(_0x34ab13){var _0x5bf850={};_0x5bf850[_0x34ab13]={'$like':'%'+_0x380b1b[_0xf2e6('0x3c')][_0xf2e6('0x45')]+'%'};return _0x5bf850;})});}_0x441de3=_[_0xf2e6('0x42')]({},_0x441de3,_0x380b1b[_0xf2e6('0x46')]);return _0x255507[_0xf2e6('0x5b')](_0x441de3);}})[_0xf2e6('0x29')](function(_0x4a7128){if(_0x4a7128){_0x4520ce=_0x4a7128['length'];if(!_0x380b1b[_0xf2e6('0x3c')]['hasOwnProperty'](_0xf2e6('0x5c'))){_0x441de3['limit']=qs[_0xf2e6('0x22')](_0x380b1b[_0xf2e6('0x3c')][_0xf2e6('0x22')]);_0x441de3[_0xf2e6('0x20')]=qs[_0xf2e6('0x20')](_0x380b1b['query'][_0xf2e6('0x20')]);}return _0x255507[_0xf2e6('0x5b')](_0x441de3);}})[_0xf2e6('0x29')](function(_0x1c42f3){if(_0x1c42f3){return _0x1c42f3?{'count':_0x4520ce,'rows':_0x1c42f3}:null;}})[_0xf2e6('0x29')](respondWithResult(_0x959fe2,null))[_0xf2e6('0x4d')](handleError(_0x959fe2,null));};exports['getAnyConditions']=function(_0x56fcef,_0x324b7f,_0x169ad1){var _0x150cee={};var _0x512d39={};var _0x2e889d;var _0x122342;return db['Trigger'][_0xf2e6('0x5d')]({'where':{'id':_0x56fcef[_0xf2e6('0x4a')]['id']}})[_0xf2e6('0x29')](handleEntityNotFound(_0x324b7f,null))['then'](function(_0x3afde6){if(_0x3afde6){_0x2e889d=_0x3afde6;_0x512d39[_0xf2e6('0x3a')]=_[_0xf2e6('0x4b')](db[_0xf2e6('0x58')][_0xf2e6('0x35')]);_0x512d39['query']=_['keys'](_0x56fcef[_0xf2e6('0x3c')]);_0x512d39[_0xf2e6('0x38')]=_[_0xf2e6('0x39')](_0x512d39['model'],_0x512d39[_0xf2e6('0x3c')]);_0x150cee[_0xf2e6('0x3b')]=_['intersection'](_0x512d39[_0xf2e6('0x3a')],qs[_0xf2e6('0x3d')](_0x56fcef[_0xf2e6('0x3c')]['fields']));_0x150cee[_0xf2e6('0x3b')]=_0x150cee[_0xf2e6('0x3b')][_0xf2e6('0x4c')]?_0x150cee[_0xf2e6('0x3b')]:_0x512d39[_0xf2e6('0x3a')];_0x150cee['order']=qs[_0xf2e6('0x40')](_0x56fcef[_0xf2e6('0x3c')][_0xf2e6('0x40')]);_0x150cee[_0xf2e6('0x43')]=qs[_0xf2e6('0x38')](_[_0xf2e6('0x41')](_0x56fcef['query'],_0x512d39['filters']));if(_0x56fcef['query'][_0xf2e6('0x45')]){_0x150cee[_0xf2e6('0x43')]=_[_0xf2e6('0x42')](_0x150cee[_0xf2e6('0x43')],{'$or':_[_0xf2e6('0x33')](_0x150cee[_0xf2e6('0x3b')],function(_0x4bad8f){var _0x48cc77={};_0x48cc77[_0x4bad8f]={'$like':'%'+_0x56fcef['query'][_0xf2e6('0x45')]+'%'};return _0x48cc77;})});}_0x150cee=_[_0xf2e6('0x42')]({},_0x150cee,_0x56fcef[_0xf2e6('0x46')]);return _0x2e889d[_0xf2e6('0x5e')](_0x150cee);}})[_0xf2e6('0x29')](function(_0x5105b9){if(_0x5105b9){_0x122342=_0x5105b9['length'];if(!_0x56fcef[_0xf2e6('0x3c')]['hasOwnProperty'](_0xf2e6('0x5c'))){_0x150cee[_0xf2e6('0x22')]=qs[_0xf2e6('0x22')](_0x56fcef[_0xf2e6('0x3c')]['limit']);_0x150cee[_0xf2e6('0x20')]=qs[_0xf2e6('0x20')](_0x56fcef['query'][_0xf2e6('0x20')]);}return _0x2e889d['getAnyConditions'](_0x150cee);}})[_0xf2e6('0x29')](function(_0x222d29){if(_0x222d29){return _0x222d29?{'count':_0x122342,'rows':_0x222d29}:null;}})[_0xf2e6('0x29')](respondWithResult(_0x324b7f,null))[_0xf2e6('0x4d')](handleError(_0x324b7f,null));};exports[_0xf2e6('0x5f')]=function(_0x45e32e,_0x339592,_0x513c0b){if(_0x45e32e[_0xf2e6('0x4f')]['id']){delete _0x45e32e[_0xf2e6('0x4f')]['id'];}return db[_0xf2e6('0x34')][_0xf2e6('0x53')]({'where':{'id':_0x45e32e[_0xf2e6('0x4a')]['id']}})[_0xf2e6('0x29')](handleEntityNotFound(_0x339592,null))[_0xf2e6('0x29')](function(_0x5d1cad){if(_0x5d1cad){_0x45e32e[_0xf2e6('0x4f')][_0xf2e6('0x60')]=_0x5d1cad['id'];return db['Action'][_0xf2e6('0x4e')](_0x45e32e['body']);}})[_0xf2e6('0x29')](respondWithResult(_0x339592,null))[_0xf2e6('0x4d')](handleError(_0x339592,null));};exports['getActions']=function(_0x5b6cf1,_0x349e68,_0x3621ca){var _0x49ebb2={};var _0x11eb66={};var _0x598c5c;var _0x1a47a3;return db[_0xf2e6('0x34')][_0xf2e6('0x5d')]({'where':{'id':_0x5b6cf1[_0xf2e6('0x4a')]['id']}})[_0xf2e6('0x29')](handleEntityNotFound(_0x349e68,null))[_0xf2e6('0x29')](function(_0x11e6e0){if(_0x11e6e0){_0x598c5c=_0x11e6e0;_0x11eb66[_0xf2e6('0x3a')]=_[_0xf2e6('0x4b')](db[_0xf2e6('0x61')][_0xf2e6('0x35')]);_0x11eb66[_0xf2e6('0x3c')]=_[_0xf2e6('0x4b')](_0x5b6cf1[_0xf2e6('0x3c')]);_0x11eb66['filters']=_['intersection'](_0x11eb66[_0xf2e6('0x3a')],_0x11eb66[_0xf2e6('0x3c')]);_0x49ebb2[_0xf2e6('0x3b')]=_[_0xf2e6('0x39')](_0x11eb66[_0xf2e6('0x3a')],qs['fields'](_0x5b6cf1[_0xf2e6('0x3c')][_0xf2e6('0x3d')]));_0x49ebb2[_0xf2e6('0x3b')]=_0x49ebb2[_0xf2e6('0x3b')][_0xf2e6('0x4c')]?_0x49ebb2[_0xf2e6('0x3b')]:_0x11eb66['model'];_0x49ebb2[_0xf2e6('0x3f')]=qs[_0xf2e6('0x40')](_0x5b6cf1[_0xf2e6('0x3c')][_0xf2e6('0x40')]);_0x49ebb2[_0xf2e6('0x43')]=qs[_0xf2e6('0x38')](_['pick'](_0x5b6cf1[_0xf2e6('0x3c')],_0x11eb66[_0xf2e6('0x38')]));if(_0x5b6cf1[_0xf2e6('0x3c')][_0xf2e6('0x45')]){_0x49ebb2[_0xf2e6('0x43')]=_[_0xf2e6('0x42')](_0x49ebb2[_0xf2e6('0x43')],{'$or':_[_0xf2e6('0x33')](_0x49ebb2['attributes'],function(_0x5add21){var _0x22b541={};_0x22b541[_0x5add21]={'$like':'%'+_0x5b6cf1[_0xf2e6('0x3c')][_0xf2e6('0x45')]+'%'};return _0x22b541;})});}_0x49ebb2=_[_0xf2e6('0x42')]({},_0x49ebb2,_0x5b6cf1[_0xf2e6('0x46')]);return _0x598c5c[_0xf2e6('0x62')](_0x49ebb2);}})[_0xf2e6('0x29')](function(_0x1e4e7c){if(_0x1e4e7c){_0x1a47a3=_0x1e4e7c[_0xf2e6('0x4c')];if(!_0x5b6cf1[_0xf2e6('0x3c')][_0xf2e6('0x3e')]('nolimit')){_0x49ebb2[_0xf2e6('0x22')]=qs[_0xf2e6('0x22')](_0x5b6cf1[_0xf2e6('0x3c')]['limit']);_0x49ebb2[_0xf2e6('0x20')]=qs['offset'](_0x5b6cf1[_0xf2e6('0x3c')][_0xf2e6('0x20')]);}return _0x598c5c[_0xf2e6('0x62')](_0x49ebb2);}})[_0xf2e6('0x29')](function(_0x5c495d){if(_0x5c495d){return _0x5c495d?{'count':_0x1a47a3,'rows':_0x5c495d}:null;}})[_0xf2e6('0x29')](respondWithResult(_0x349e68,null))[_0xf2e6('0x4d')](handleError(_0x349e68,null));}; \ No newline at end of file +var _0x816f=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','options','hasOwnProperty','getAnyConditions','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x525037,_0x3e72d4){var _0x3157e8=function(_0x4b7ce1){while(--_0x4b7ce1){_0x525037['push'](_0x525037['shift']());}};_0x3157e8(++_0x3e72d4);}(_0x816f,0x1cf));var _0xf816=function(_0x3e2e13,_0x300b0f){_0x3e2e13=_0x3e2e13-0x0;var _0x32e50d=_0x816f[_0x3e2e13];return _0x32e50d;};'use strict';var emlformat=require(_0xf816('0x0'));var rimraf=require(_0xf816('0x1'));var zipdir=require(_0xf816('0x2'));var jsonpatch=require(_0xf816('0x3'));var rp=require(_0xf816('0x4'));var moment=require(_0xf816('0x5'));var BPromise=require(_0xf816('0x6'));var Mustache=require('mustache');var util=require(_0xf816('0x7'));var path=require(_0xf816('0x8'));var sox=require(_0xf816('0x9'));var csv=require(_0xf816('0xa'));var ejs=require(_0xf816('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf816('0xc'));var crypto=require(_0xf816('0xd'));var jsforce=require(_0xf816('0xe'));var deskjs=require(_0xf816('0xf'));var toCsv=require(_0xf816('0xa'));var querystring=require(_0xf816('0x10'));var Papa=require(_0xf816('0x11'));var Redis=require(_0xf816('0x12'));var authService=require(_0xf816('0x13'));var qs=require(_0xf816('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf816('0x15'));var logger=require(_0xf816('0x16'))('api');var utils=require(_0xf816('0x17'));var config=require(_0xf816('0x18'));var licenseUtil=require(_0xf816('0x19'));var db=require(_0xf816('0x1a'))['db'];function respondWithStatusCode(_0x26a866,_0x95fb71){_0x95fb71=_0x95fb71||0xcc;return function(_0x51e9a3){if(_0x51e9a3){return _0x26a866[_0xf816('0x1b')](_0x95fb71);}return _0x26a866['status'](_0x95fb71)[_0xf816('0x1c')]();};}function respondWithResult(_0x3f1faa,_0x5308dd){_0x5308dd=_0x5308dd||0xc8;return function(_0x34fd15){if(_0x34fd15){return _0x3f1faa[_0xf816('0x1d')](_0x5308dd)[_0xf816('0x1e')](_0x34fd15);}};}function respondWithFilteredResult(_0x926cea,_0x44a858){return function(_0x19b8db){if(_0x19b8db){var _0xb7ef23=typeof _0x44a858[_0xf816('0x1f')]===_0xf816('0x20')&&typeof _0x44a858[_0xf816('0x21')]===_0xf816('0x20');var _0x34b914=_0x19b8db['count'];var _0x300b9d=_0xb7ef23?0x0:_0x44a858['offset'];var _0x2cdd1f=_0xb7ef23?_0x19b8db[_0xf816('0x22')]:_0x44a858[_0xf816('0x1f')]+_0x44a858[_0xf816('0x21')];var _0x5d787c;if(_0x2cdd1f>=_0x34b914){_0x2cdd1f=_0x34b914;_0x5d787c=0xc8;}else{_0x5d787c=0xce;}_0x926cea[_0xf816('0x1d')](_0x5d787c);return _0x926cea[_0xf816('0x23')]('Content-Range',_0x300b9d+'-'+_0x2cdd1f+'/'+_0x34b914)[_0xf816('0x1e')](_0x19b8db);}return null;};}function patchUpdates(_0x2a870d){return function(_0x454fde){try{jsonpatch['apply'](_0x454fde,_0x2a870d,!![]);}catch(_0x1f33a9){return BPromise[_0xf816('0x24')](_0x1f33a9);}return _0x454fde[_0xf816('0x25')]();};}function saveUpdates(_0x1053b2,_0x2f0f87){return function(_0x50293b){if(_0x50293b){return _0x50293b[_0xf816('0x26')](_0x1053b2)['then'](function(_0x586642){return _0x586642;});}return null;};}function removeEntity(_0x422af4,_0xc95b04){return function(_0x4e4f16){if(_0x4e4f16){return _0x4e4f16[_0xf816('0x27')]()[_0xf816('0x28')](function(){var _0x3d842d=_0x4e4f16[_0xf816('0x29')]({'plain':!![]});var _0x4b8c86='Triggers';return db[_0xf816('0x2a')][_0xf816('0x27')]({'where':{'type':_0x4b8c86,'resourceId':_0x3d842d['id']}})['then'](function(){return _0x4e4f16;});})['then'](function(){_0x422af4[_0xf816('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d6f0c,_0x10a3f6){return function(_0x53bc01){if(!_0x53bc01){_0x4d6f0c[_0xf816('0x1b')](0x194);}return _0x53bc01;};}function handleError(_0x397538,_0x2499c6){_0x2499c6=_0x2499c6||0x1f4;return function(_0x312cea){logger[_0xf816('0x2b')](_0x312cea[_0xf816('0x2c')]);if(_0x312cea['name']){delete _0x312cea[_0xf816('0x2d')];}_0x397538[_0xf816('0x1d')](_0x2499c6)[_0xf816('0x2e')](_0x312cea);};}exports[_0xf816('0x2f')]=function(_0x43b170,_0xd4f546){var _0x5d1910={},_0x5d374f={},_0x4ff720={'count':0x0,'rows':[]};var _0x1b495c=_[_0xf816('0x30')](db[_0xf816('0x31')][_0xf816('0x32')],function(_0x55c154){return{'name':_0x55c154[_0xf816('0x33')],'type':_0x55c154['type'][_0xf816('0x34')]};});_0x5d374f[_0xf816('0x35')]=_['map'](_0x1b495c,'name');_0x5d374f[_0xf816('0x36')]=_['keys'](_0x43b170['query']);_0x5d374f[_0xf816('0x37')]=_[_0xf816('0x38')](_0x5d374f[_0xf816('0x35')],_0x5d374f[_0xf816('0x36')]);_0x5d1910[_0xf816('0x39')]=_[_0xf816('0x38')](_0x5d374f[_0xf816('0x35')],qs[_0xf816('0x3a')](_0x43b170[_0xf816('0x36')][_0xf816('0x3a')]));_0x5d1910['attributes']=_0x5d1910[_0xf816('0x39')][_0xf816('0x3b')]?_0x5d1910[_0xf816('0x39')]:_0x5d374f['model'];if(!_0x43b170[_0xf816('0x36')]['hasOwnProperty'](_0xf816('0x3c'))){_0x5d1910['limit']=qs['limit'](_0x43b170[_0xf816('0x36')][_0xf816('0x21')]);_0x5d1910[_0xf816('0x1f')]=qs['offset'](_0x43b170[_0xf816('0x36')][_0xf816('0x1f')]);}_0x5d1910[_0xf816('0x3d')]=qs[_0xf816('0x3e')](_0x43b170[_0xf816('0x36')]['sort']);_0x5d1910[_0xf816('0x3f')]=qs['filters'](_[_0xf816('0x40')](_0x43b170['query'],_0x5d374f[_0xf816('0x37')]),_0x1b495c);if(_0x43b170['query'][_0xf816('0x41')]){_0x5d1910['where']=_[_0xf816('0x42')](_0x5d1910[_0xf816('0x3f')],{'$or':_[_0xf816('0x30')](_0x1b495c,function(_0x2b1ddb){if(_0x2b1ddb[_0xf816('0x43')]!==_0xf816('0x44')){var _0x3dfd60={};_0x3dfd60[_0x2b1ddb[_0xf816('0x2d')]]={'$like':'%'+_0x43b170[_0xf816('0x36')][_0xf816('0x41')]+'%'};return _0x3dfd60;}})});}_0x5d1910=_['merge']({},_0x5d1910,_0x43b170['options']);var _0x552467={'where':_0x5d1910[_0xf816('0x3f')]};return db[_0xf816('0x31')][_0xf816('0x22')](_0x552467)['then'](function(_0x2953b9){_0x4ff720[_0xf816('0x22')]=_0x2953b9;if(_0x43b170[_0xf816('0x36')][_0xf816('0x45')]){_0x5d1910[_0xf816('0x46')]=[{'all':!![]}];}return db['Trigger'][_0xf816('0x47')](_0x5d1910);})[_0xf816('0x28')](function(_0x1e2746){_0x4ff720[_0xf816('0x48')]=_0x1e2746;return _0x4ff720;})[_0xf816('0x28')](respondWithFilteredResult(_0xd4f546,_0x5d1910))[_0xf816('0x49')](handleError(_0xd4f546,null));};exports[_0xf816('0x4a')]=function(_0x893236,_0x38261c){var _0xee69da={'raw':![],'where':{'id':_0x893236[_0xf816('0x4b')]['id']}},_0x3a1e0b={};_0x3a1e0b[_0xf816('0x35')]=_[_0xf816('0x4c')](db[_0xf816('0x31')][_0xf816('0x32')]);_0x3a1e0b[_0xf816('0x36')]=_[_0xf816('0x4c')](_0x893236[_0xf816('0x36')]);_0x3a1e0b[_0xf816('0x37')]=_[_0xf816('0x38')](_0x3a1e0b[_0xf816('0x35')],_0x3a1e0b['query']);_0xee69da[_0xf816('0x39')]=_['intersection'](_0x3a1e0b[_0xf816('0x35')],qs[_0xf816('0x3a')](_0x893236[_0xf816('0x36')][_0xf816('0x3a')]));_0xee69da[_0xf816('0x39')]=_0xee69da[_0xf816('0x39')][_0xf816('0x3b')]?_0xee69da['attributes']:_0x3a1e0b['model'];if(_0x893236[_0xf816('0x36')][_0xf816('0x45')]){_0xee69da[_0xf816('0x46')]=[{'all':!![]}];}_0xee69da=_[_0xf816('0x42')]({},_0xee69da,_0x893236['options']);return db[_0xf816('0x31')]['find'](_0xee69da)[_0xf816('0x28')](handleEntityNotFound(_0x38261c,null))['then'](respondWithResult(_0x38261c,null))['catch'](handleError(_0x38261c,null));};exports[_0xf816('0x4d')]=function(_0x12853b,_0x4927ca){return db[_0xf816('0x31')][_0xf816('0x4d')](_0x12853b[_0xf816('0x4e')],{})[_0xf816('0x28')](function(_0x4b1686){var _0x3caddd=_0x12853b[_0xf816('0x4f')]['get']({'plain':!![]});if(!_0x3caddd)throw new Error(_0xf816('0x50'));if(_0x3caddd[_0xf816('0x51')]===_0xf816('0x4f')){var _0x53c76f=_0x4b1686['get']({'plain':!![]});var _0x542e74=_0xf816('0x52');return db[_0xf816('0x53')]['find']({'where':{'name':_0x542e74,'userProfileId':_0x3caddd['userProfileId']},'raw':!![]})[_0xf816('0x28')](function(_0x2ec866){if(_0x2ec866&&_0x2ec866['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x53c76f[_0xf816('0x2d')],'resourceId':_0x53c76f['id'],'type':_0x2ec866[_0xf816('0x2d')],'sectionId':_0x2ec866['id']},{})[_0xf816('0x28')](function(){return _0x4b1686;});}else{return _0x4b1686;}})[_0xf816('0x49')](function(_0x1c4bcb){logger['error'](_0xf816('0x54'),_0x1c4bcb);throw _0x1c4bcb;});}return _0x4b1686;})['then'](respondWithResult(_0x4927ca,0xc9))[_0xf816('0x49')](handleError(_0x4927ca,null));};exports[_0xf816('0x26')]=function(_0x2f5ff7,_0xa0d1b8){if(_0x2f5ff7[_0xf816('0x4e')]['id']){delete _0x2f5ff7[_0xf816('0x4e')]['id'];}return db[_0xf816('0x31')][_0xf816('0x55')]({'where':{'id':_0x2f5ff7[_0xf816('0x4b')]['id']}})[_0xf816('0x28')](handleEntityNotFound(_0xa0d1b8,null))[_0xf816('0x28')](saveUpdates(_0x2f5ff7[_0xf816('0x4e')],null))['then'](respondWithResult(_0xa0d1b8,null))[_0xf816('0x49')](handleError(_0xa0d1b8,null));};exports['destroy']=function(_0x1e980f,_0x185047){return db[_0xf816('0x31')][_0xf816('0x55')]({'where':{'id':_0x1e980f['params']['id']}})[_0xf816('0x28')](handleEntityNotFound(_0x185047,null))[_0xf816('0x28')](removeEntity(_0x185047,null))['catch'](handleError(_0x185047,null));};exports['addAllCondition']=function(_0x307b8d,_0x5b1102,_0x227dc4){if(_0x307b8d['body']['id']){delete _0x307b8d[_0xf816('0x4e')]['id'];}return db[_0xf816('0x31')][_0xf816('0x55')]({'where':{'id':_0x307b8d[_0xf816('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5b1102,null))[_0xf816('0x28')](function(_0x140d03){if(_0x140d03){_0x307b8d[_0xf816('0x4e')][_0xf816('0x56')]=_0x140d03['id'];return db[_0xf816('0x57')][_0xf816('0x4d')](_0x307b8d[_0xf816('0x4e')]);}})['then'](respondWithResult(_0x5b1102,null))[_0xf816('0x49')](handleError(_0x5b1102,null));};exports[_0xf816('0x58')]=function(_0x329e74,_0x130b72,_0x541730){if(_0x329e74['body']['id']){delete _0x329e74[_0xf816('0x4e')]['id'];}return db[_0xf816('0x31')][_0xf816('0x55')]({'where':{'id':_0x329e74[_0xf816('0x4b')]['id']}})[_0xf816('0x28')](handleEntityNotFound(_0x130b72,null))['then'](function(_0x1c5000){if(_0x1c5000){_0x329e74[_0xf816('0x4e')][_0xf816('0x59')]=_0x1c5000['id'];return db[_0xf816('0x57')]['create'](_0x329e74['body']);}})[_0xf816('0x28')](respondWithResult(_0x130b72,null))[_0xf816('0x49')](handleError(_0x130b72,null));};exports[_0xf816('0x5a')]=function(_0x544192,_0x5bfd78,_0x1fdaef){var _0x117f7e={};var _0x480c2c={};var _0x17924e;var _0x338086;return db[_0xf816('0x31')]['findOne']({'where':{'id':_0x544192[_0xf816('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5bfd78,null))[_0xf816('0x28')](function(_0x109179){if(_0x109179){_0x17924e=_0x109179;_0x480c2c[_0xf816('0x35')]=_['keys'](db['Condition'][_0xf816('0x32')]);_0x480c2c[_0xf816('0x36')]=_['keys'](_0x544192['query']);_0x480c2c['filters']=_[_0xf816('0x38')](_0x480c2c[_0xf816('0x35')],_0x480c2c[_0xf816('0x36')]);_0x117f7e[_0xf816('0x39')]=_[_0xf816('0x38')](_0x480c2c[_0xf816('0x35')],qs[_0xf816('0x3a')](_0x544192[_0xf816('0x36')][_0xf816('0x3a')]));_0x117f7e[_0xf816('0x39')]=_0x117f7e[_0xf816('0x39')]['length']?_0x117f7e[_0xf816('0x39')]:_0x480c2c[_0xf816('0x35')];_0x117f7e[_0xf816('0x3d')]=qs[_0xf816('0x3e')](_0x544192[_0xf816('0x36')][_0xf816('0x3e')]);_0x117f7e['where']=qs[_0xf816('0x37')](_[_0xf816('0x40')](_0x544192['query'],_0x480c2c[_0xf816('0x37')]));if(_0x544192[_0xf816('0x36')][_0xf816('0x41')]){_0x117f7e[_0xf816('0x3f')]=_['merge'](_0x117f7e['where'],{'$or':_[_0xf816('0x30')](_0x117f7e['attributes'],function(_0x4cd63e){var _0x322862={};_0x322862[_0x4cd63e]={'$like':'%'+_0x544192[_0xf816('0x36')][_0xf816('0x41')]+'%'};return _0x322862;})});}_0x117f7e=_[_0xf816('0x42')]({},_0x117f7e,_0x544192[_0xf816('0x5b')]);return _0x17924e[_0xf816('0x5a')](_0x117f7e);}})[_0xf816('0x28')](function(_0x1e12fb){if(_0x1e12fb){_0x338086=_0x1e12fb[_0xf816('0x3b')];if(!_0x544192[_0xf816('0x36')][_0xf816('0x5c')](_0xf816('0x3c'))){_0x117f7e[_0xf816('0x21')]=qs[_0xf816('0x21')](_0x544192[_0xf816('0x36')][_0xf816('0x21')]);_0x117f7e[_0xf816('0x1f')]=qs[_0xf816('0x1f')](_0x544192['query']['offset']);}return _0x17924e[_0xf816('0x5a')](_0x117f7e);}})[_0xf816('0x28')](function(_0x52f313){if(_0x52f313){return _0x52f313?{'count':_0x338086,'rows':_0x52f313}:null;}})[_0xf816('0x28')](respondWithResult(_0x5bfd78,null))[_0xf816('0x49')](handleError(_0x5bfd78,null));};exports[_0xf816('0x5d')]=function(_0x43f025,_0x1ea937,_0x21ac64){var _0x24b5bc={};var _0xa38a1e={};var _0x7b6f35;var _0xea4cfb;return db[_0xf816('0x31')]['findOne']({'where':{'id':_0x43f025['params']['id']}})[_0xf816('0x28')](handleEntityNotFound(_0x1ea937,null))[_0xf816('0x28')](function(_0x4fadf9){if(_0x4fadf9){_0x7b6f35=_0x4fadf9;_0xa38a1e[_0xf816('0x35')]=_[_0xf816('0x4c')](db[_0xf816('0x57')]['rawAttributes']);_0xa38a1e[_0xf816('0x36')]=_[_0xf816('0x4c')](_0x43f025[_0xf816('0x36')]);_0xa38a1e[_0xf816('0x37')]=_[_0xf816('0x38')](_0xa38a1e[_0xf816('0x35')],_0xa38a1e[_0xf816('0x36')]);_0x24b5bc[_0xf816('0x39')]=_[_0xf816('0x38')](_0xa38a1e[_0xf816('0x35')],qs['fields'](_0x43f025[_0xf816('0x36')][_0xf816('0x3a')]));_0x24b5bc[_0xf816('0x39')]=_0x24b5bc[_0xf816('0x39')][_0xf816('0x3b')]?_0x24b5bc['attributes']:_0xa38a1e[_0xf816('0x35')];_0x24b5bc[_0xf816('0x3d')]=qs['sort'](_0x43f025['query'][_0xf816('0x3e')]);_0x24b5bc[_0xf816('0x3f')]=qs[_0xf816('0x37')](_[_0xf816('0x40')](_0x43f025[_0xf816('0x36')],_0xa38a1e['filters']));if(_0x43f025[_0xf816('0x36')]['filter']){_0x24b5bc[_0xf816('0x3f')]=_[_0xf816('0x42')](_0x24b5bc['where'],{'$or':_[_0xf816('0x30')](_0x24b5bc[_0xf816('0x39')],function(_0xb68d3f){var _0x1a9649={};_0x1a9649[_0xb68d3f]={'$like':'%'+_0x43f025['query'][_0xf816('0x41')]+'%'};return _0x1a9649;})});}_0x24b5bc=_['merge']({},_0x24b5bc,_0x43f025[_0xf816('0x5b')]);return _0x7b6f35[_0xf816('0x5d')](_0x24b5bc);}})[_0xf816('0x28')](function(_0x1325e9){if(_0x1325e9){_0xea4cfb=_0x1325e9[_0xf816('0x3b')];if(!_0x43f025[_0xf816('0x36')][_0xf816('0x5c')](_0xf816('0x3c'))){_0x24b5bc['limit']=qs[_0xf816('0x21')](_0x43f025[_0xf816('0x36')][_0xf816('0x21')]);_0x24b5bc['offset']=qs[_0xf816('0x1f')](_0x43f025[_0xf816('0x36')]['offset']);}return _0x7b6f35[_0xf816('0x5d')](_0x24b5bc);}})['then'](function(_0x4309f7){if(_0x4309f7){return _0x4309f7?{'count':_0xea4cfb,'rows':_0x4309f7}:null;}})['then'](respondWithResult(_0x1ea937,null))[_0xf816('0x49')](handleError(_0x1ea937,null));};exports['addAction']=function(_0x5678b6,_0x1681e5,_0x7bc550){if(_0x5678b6[_0xf816('0x4e')]['id']){delete _0x5678b6[_0xf816('0x4e')]['id'];}return db[_0xf816('0x31')][_0xf816('0x55')]({'where':{'id':_0x5678b6[_0xf816('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1681e5,null))[_0xf816('0x28')](function(_0x17e4cd){if(_0x17e4cd){_0x5678b6[_0xf816('0x4e')][_0xf816('0x5e')]=_0x17e4cd['id'];return db[_0xf816('0x5f')][_0xf816('0x4d')](_0x5678b6['body']);}})[_0xf816('0x28')](respondWithResult(_0x1681e5,null))[_0xf816('0x49')](handleError(_0x1681e5,null));};exports[_0xf816('0x60')]=function(_0x3d953b,_0x1a67b7,_0x732ba2){var _0x2865f2={};var _0x265713={};var _0x1c8bb5;var _0x1f140b;return db['Trigger']['findOne']({'where':{'id':_0x3d953b[_0xf816('0x4b')]['id']}})[_0xf816('0x28')](handleEntityNotFound(_0x1a67b7,null))[_0xf816('0x28')](function(_0x1ae527){if(_0x1ae527){_0x1c8bb5=_0x1ae527;_0x265713[_0xf816('0x35')]=_[_0xf816('0x4c')](db['Action'][_0xf816('0x32')]);_0x265713['query']=_[_0xf816('0x4c')](_0x3d953b['query']);_0x265713[_0xf816('0x37')]=_[_0xf816('0x38')](_0x265713[_0xf816('0x35')],_0x265713[_0xf816('0x36')]);_0x2865f2[_0xf816('0x39')]=_[_0xf816('0x38')](_0x265713[_0xf816('0x35')],qs[_0xf816('0x3a')](_0x3d953b[_0xf816('0x36')][_0xf816('0x3a')]));_0x2865f2['attributes']=_0x2865f2[_0xf816('0x39')][_0xf816('0x3b')]?_0x2865f2['attributes']:_0x265713['model'];_0x2865f2['order']=qs['sort'](_0x3d953b[_0xf816('0x36')][_0xf816('0x3e')]);_0x2865f2['where']=qs['filters'](_[_0xf816('0x40')](_0x3d953b[_0xf816('0x36')],_0x265713[_0xf816('0x37')]));if(_0x3d953b[_0xf816('0x36')][_0xf816('0x41')]){_0x2865f2[_0xf816('0x3f')]=_[_0xf816('0x42')](_0x2865f2[_0xf816('0x3f')],{'$or':_[_0xf816('0x30')](_0x2865f2[_0xf816('0x39')],function(_0x57a7a0){var _0x28a9cd={};_0x28a9cd[_0x57a7a0]={'$like':'%'+_0x3d953b[_0xf816('0x36')][_0xf816('0x41')]+'%'};return _0x28a9cd;})});}_0x2865f2=_[_0xf816('0x42')]({},_0x2865f2,_0x3d953b[_0xf816('0x5b')]);return _0x1c8bb5[_0xf816('0x60')](_0x2865f2);}})[_0xf816('0x28')](function(_0x5b3c3d){if(_0x5b3c3d){_0x1f140b=_0x5b3c3d[_0xf816('0x3b')];if(!_0x3d953b[_0xf816('0x36')][_0xf816('0x5c')](_0xf816('0x3c'))){_0x2865f2[_0xf816('0x21')]=qs[_0xf816('0x21')](_0x3d953b[_0xf816('0x36')]['limit']);_0x2865f2['offset']=qs[_0xf816('0x1f')](_0x3d953b['query']['offset']);}return _0x1c8bb5[_0xf816('0x60')](_0x2865f2);}})[_0xf816('0x28')](function(_0x1bd00c){if(_0x1bd00c){return _0x1bd00c?{'count':_0x1f140b,'rows':_0x1bd00c}:null;}})[_0xf816('0x28')](respondWithResult(_0x1a67b7,null))[_0xf816('0x49')](handleError(_0x1a67b7,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 970bb88..bddf6d1 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 _0x63b6=['rimraf','../../config/environment','./trigger.attributes','define','tools_triggers','lodash','util','../../config/logger','moment','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x63b6,0x127));var _0x663b=function(_0x298edb,_0x32aec8){_0x298edb=_0x298edb-0x0;var _0x2c9d09=_0x63b6[_0x298edb];return _0x2c9d09;};'use strict';var _=require(_0x663b('0x0'));var util=require(_0x663b('0x1'));var logger=require(_0x663b('0x2'))('api');var moment=require(_0x663b('0x3'));var BPromise=require('bluebird');var rp=require(_0x663b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x663b('0x5'));var config=require(_0x663b('0x6'));var attributes=require(_0x663b('0x7'));module['exports']=function(_0x4486b1,_0x57e43e){return _0x4486b1[_0x663b('0x8')]('Trigger',attributes,{'tableName':_0x663b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7118=['request-promise','path','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','../../config/logger','api','bluebird'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x7118,0x159));var _0x8711=function(_0x18026a,_0x2f0708){_0x18026a=_0x18026a-0x0;var _0x42df34=_0x7118[_0x18026a];return _0x42df34;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8711('0x0'))(_0x8711('0x1'));var moment=require('moment');var BPromise=require(_0x8711('0x2'));var rp=require(_0x8711('0x3'));var fs=require('fs');var path=require(_0x8711('0x4'));var rimraf=require(_0x8711('0x5'));var config=require(_0x8711('0x6'));var attributes=require(_0x8711('0x7'));module[_0x8711('0x8')]=function(_0x54885e,_0x385033){return _0x54885e[_0x8711('0x9')](_0x8711('0xa'),attributes,{'tableName':_0x8711('0xb'),'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 d574e2f..4b39d6b 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 _0x8555=['limit','include','map','model','stringify','ShowTrigger','Trigger','find','where','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','Trigger,\x20%s,\x20%s','message','result','GetTrigger','options','raw','attributes'];(function(_0x4154fe,_0x3dc862){var _0x54612a=function(_0x3c16a6){while(--_0x3c16a6){_0x4154fe['push'](_0x4154fe['shift']());}};_0x54612a(++_0x3dc862);}(_0x8555,0x8e));var _0x5855=function(_0x216ce7,_0xb65bdd){_0x216ce7=_0x216ce7-0x0;var _0x15181d=_0x8555[_0x216ce7];return _0x15181d;};'use strict';var _=require(_0x5855('0x0'));var util=require('util');var moment=require(_0x5855('0x1'));var BPromise=require(_0x5855('0x2'));var rs=require(_0x5855('0x3'));var fs=require('fs');var Redis=require(_0x5855('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5855('0x5'));var logger=require('../../config/logger')(_0x5855('0x6'));var config=require(_0x5855('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5855('0x8')][_0x5855('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14cbd6,_0x24a06e,_0x346390){return new BPromise(function(_0x5569ed,_0x2044d6){return client['request'](_0x14cbd6,_0x346390)[_0x5855('0xa')](function(_0x7991b4){logger[_0x5855('0xb')]('Trigger,\x20%s,\x20%s',_0x24a06e,_0x5855('0xc'));logger[_0x5855('0xd')](_0x5855('0xe'),_0x24a06e,_0x5855('0xc'),JSON['stringify'](_0x7991b4));if(_0x7991b4[_0x5855('0xf')]){if(_0x7991b4[_0x5855('0xf')]['code']===0x1f4){logger[_0x5855('0xf')](_0x5855('0x10'),_0x24a06e,_0x7991b4[_0x5855('0xf')][_0x5855('0x11')]);return _0x2044d6(_0x7991b4['error']['message']);}logger['error'](_0x5855('0x10'),_0x24a06e,_0x7991b4[_0x5855('0xf')][_0x5855('0x11')]);return _0x5569ed(_0x7991b4[_0x5855('0xf')][_0x5855('0x11')]);}else{logger[_0x5855('0xb')](_0x5855('0x10'),_0x24a06e,_0x5855('0xc'));_0x5569ed(_0x7991b4[_0x5855('0x12')]['message']);}})['catch'](function(_0x1e1f08){logger['error']('Trigger,\x20%s,\x20%s',_0x24a06e,_0x1e1f08);_0x2044d6(_0x1e1f08);});});}exports[_0x5855('0x13')]=function(_0x3416c2){var _0x4e7f0e=this;return new Promise(function(_0x2cc9e8,_0x1bf4cc){return db['Trigger']['findAll']({'raw':_0x3416c2['options']?_0x3416c2[_0x5855('0x14')][_0x5855('0x15')]===undefined?!![]:![]:!![],'where':_0x3416c2[_0x5855('0x14')]?_0x3416c2[_0x5855('0x14')]['where']||null:null,'attributes':_0x3416c2[_0x5855('0x14')]?_0x3416c2[_0x5855('0x14')][_0x5855('0x16')]||null:null,'limit':_0x3416c2[_0x5855('0x14')]?_0x3416c2['options'][_0x5855('0x17')]||null:null,'include':_0x3416c2['options']?_0x3416c2[_0x5855('0x14')][_0x5855('0x18')]?_[_0x5855('0x19')](_0x3416c2[_0x5855('0x14')][_0x5855('0x18')],function(_0x330294){return{'model':db[_0x330294['model']],'as':_0x330294['as'],'attributes':_0x330294[_0x5855('0x16')],'include':_0x330294[_0x5855('0x18')]?_['map'](_0x330294[_0x5855('0x18')],function(_0x312e06){return{'model':db[_0x312e06[_0x5855('0x1a')]],'as':_0x312e06['as'],'attributes':_0x312e06[_0x5855('0x16')],'include':_0x312e06[_0x5855('0x18')]?_[_0x5855('0x19')](_0x312e06[_0x5855('0x18')],function(_0x1284dd){return{'model':db[_0x1284dd[_0x5855('0x1a')]],'as':_0x1284dd['as'],'attributes':_0x1284dd[_0x5855('0x16')]};}):[]};}):[]};}):[]:[]})[_0x5855('0xa')](function(_0x3522be){logger['info']('GetTrigger',_0x3416c2);logger[_0x5855('0xd')](_0x5855('0x13'),_0x3416c2,JSON[_0x5855('0x1b')](_0x3522be));_0x2cc9e8(_0x3522be);})['catch'](function(_0x3eaec3){logger[_0x5855('0xf')](_0x5855('0x13'),_0x3eaec3[_0x5855('0x11')],_0x3416c2);_0x1bf4cc(_0x4e7f0e['error'](0x1f4,_0x3eaec3[_0x5855('0x11')]));});});};exports[_0x5855('0x1c')]=function(_0x2675eb){var _0x10c896=this;return new Promise(function(_0x712414,_0x146d11){return db[_0x5855('0x1d')][_0x5855('0x1e')]({'raw':_0x2675eb[_0x5855('0x14')]?_0x2675eb['options'][_0x5855('0x15')]===undefined?!![]:![]:!![],'where':_0x2675eb[_0x5855('0x14')]?_0x2675eb['options'][_0x5855('0x1f')]||null:null,'attributes':_0x2675eb[_0x5855('0x14')]?_0x2675eb[_0x5855('0x14')][_0x5855('0x16')]||null:null,'include':_0x2675eb[_0x5855('0x14')]?_0x2675eb[_0x5855('0x14')][_0x5855('0x18')]?_[_0x5855('0x19')](_0x2675eb[_0x5855('0x14')][_0x5855('0x18')],function(_0x166920){return{'model':db[_0x166920['model']],'as':_0x166920['as'],'attributes':_0x166920[_0x5855('0x16')],'include':_0x166920[_0x5855('0x18')]?_['map'](_0x166920[_0x5855('0x18')],function(_0xc29467){return{'model':db[_0xc29467[_0x5855('0x1a')]],'as':_0xc29467['as'],'attributes':_0xc29467[_0x5855('0x16')],'include':_0xc29467['include']?_[_0x5855('0x19')](_0xc29467[_0x5855('0x18')],function(_0xa97048){return{'model':db[_0xa97048[_0x5855('0x1a')]],'as':_0xa97048['as'],'attributes':_0xa97048['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x218b20){logger['info'](_0x5855('0x1c'),_0x2675eb);logger[_0x5855('0xd')](_0x5855('0x1c'),_0x2675eb,JSON['stringify'](_0x218b20));_0x712414(_0x218b20);})[_0x5855('0x20')](function(_0x3df9cf){logger['error'](_0x5855('0x1c'),_0x3df9cf[_0x5855('0x11')],_0x2675eb);_0x146d11(_0x10c896[_0x5855('0xf')](0x1f4,_0x3df9cf[_0x5855('0x11')]));});});}; \ No newline at end of file +var _0xbdea=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','Trigger,\x20%s,\x20%s','message','result','Trigger','findAll','raw','options','where','attributes','limit','include','map','model','GetTrigger','ShowTrigger','catch','lodash'];(function(_0x5bd6e3,_0x23d132){var _0x3cbebc=function(_0x3da13e){while(--_0x3da13e){_0x5bd6e3['push'](_0x5bd6e3['shift']());}};_0x3cbebc(++_0x23d132);}(_0xbdea,0x1e9));var _0xabde=function(_0x45385c,_0x840419){_0x45385c=_0x45385c-0x0;var _0x523eb1=_0xbdea[_0x45385c];return _0x523eb1;};'use strict';var _=require(_0xabde('0x0'));var util=require(_0xabde('0x1'));var moment=require(_0xabde('0x2'));var BPromise=require(_0xabde('0x3'));var rs=require(_0xabde('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xabde('0x5'))['db'];var utils=require(_0xabde('0x6'));var logger=require(_0xabde('0x7'))(_0xabde('0x8'));var config=require('../../config/environment');var jayson=require(_0xabde('0x9'));var client=jayson[_0xabde('0xa')][_0xabde('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfdfa9,_0x262af6,_0x347a45){return new BPromise(function(_0x402c7a,_0x5906d){return client[_0xabde('0xc')](_0xfdfa9,_0x347a45)[_0xabde('0xd')](function(_0x3765c7){logger[_0xabde('0xe')]('Trigger,\x20%s,\x20%s',_0x262af6,'request\x20sent');logger[_0xabde('0xf')](_0xabde('0x10'),_0x262af6,'request\x20sent',JSON[_0xabde('0x11')](_0x3765c7));if(_0x3765c7[_0xabde('0x12')]){if(_0x3765c7[_0xabde('0x12')]['code']===0x1f4){logger[_0xabde('0x12')](_0xabde('0x13'),_0x262af6,_0x3765c7[_0xabde('0x12')]['message']);return _0x5906d(_0x3765c7[_0xabde('0x12')][_0xabde('0x14')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x262af6,_0x3765c7[_0xabde('0x12')][_0xabde('0x14')]);return _0x402c7a(_0x3765c7[_0xabde('0x12')][_0xabde('0x14')]);}else{logger[_0xabde('0xe')](_0xabde('0x13'),_0x262af6,'request\x20sent');_0x402c7a(_0x3765c7[_0xabde('0x15')][_0xabde('0x14')]);}})['catch'](function(_0xbc51ad){logger[_0xabde('0x12')](_0xabde('0x13'),_0x262af6,_0xbc51ad);_0x5906d(_0xbc51ad);});});}exports['GetTrigger']=function(_0x5d70be){var _0x172f7d=this;return new Promise(function(_0x490767,_0x54700d){return db[_0xabde('0x16')][_0xabde('0x17')]({'raw':_0x5d70be['options']?_0x5d70be['options'][_0xabde('0x18')]===undefined?!![]:![]:!![],'where':_0x5d70be[_0xabde('0x19')]?_0x5d70be[_0xabde('0x19')][_0xabde('0x1a')]||null:null,'attributes':_0x5d70be[_0xabde('0x19')]?_0x5d70be[_0xabde('0x19')][_0xabde('0x1b')]||null:null,'limit':_0x5d70be['options']?_0x5d70be['options'][_0xabde('0x1c')]||null:null,'include':_0x5d70be[_0xabde('0x19')]?_0x5d70be[_0xabde('0x19')][_0xabde('0x1d')]?_[_0xabde('0x1e')](_0x5d70be[_0xabde('0x19')][_0xabde('0x1d')],function(_0x4d81ba){return{'model':db[_0x4d81ba[_0xabde('0x1f')]],'as':_0x4d81ba['as'],'attributes':_0x4d81ba['attributes'],'include':_0x4d81ba[_0xabde('0x1d')]?_[_0xabde('0x1e')](_0x4d81ba[_0xabde('0x1d')],function(_0x361fab){return{'model':db[_0x361fab[_0xabde('0x1f')]],'as':_0x361fab['as'],'attributes':_0x361fab[_0xabde('0x1b')],'include':_0x361fab[_0xabde('0x1d')]?_[_0xabde('0x1e')](_0x361fab['include'],function(_0x5c26c9){return{'model':db[_0x5c26c9[_0xabde('0x1f')]],'as':_0x5c26c9['as'],'attributes':_0x5c26c9[_0xabde('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b4b59){logger['info'](_0xabde('0x20'),_0x5d70be);logger['debug'](_0xabde('0x20'),_0x5d70be,JSON[_0xabde('0x11')](_0x1b4b59));_0x490767(_0x1b4b59);})['catch'](function(_0x299daf){logger['error'](_0xabde('0x20'),_0x299daf['message'],_0x5d70be);_0x54700d(_0x172f7d[_0xabde('0x12')](0x1f4,_0x299daf[_0xabde('0x14')]));});});};exports[_0xabde('0x21')]=function(_0x46b266){var _0x267cf3=this;return new Promise(function(_0x491ea4,_0x2d021e){return db[_0xabde('0x16')]['find']({'raw':_0x46b266[_0xabde('0x19')]?_0x46b266[_0xabde('0x19')][_0xabde('0x18')]===undefined?!![]:![]:!![],'where':_0x46b266[_0xabde('0x19')]?_0x46b266[_0xabde('0x19')][_0xabde('0x1a')]||null:null,'attributes':_0x46b266[_0xabde('0x19')]?_0x46b266[_0xabde('0x19')]['attributes']||null:null,'include':_0x46b266[_0xabde('0x19')]?_0x46b266[_0xabde('0x19')][_0xabde('0x1d')]?_[_0xabde('0x1e')](_0x46b266[_0xabde('0x19')]['include'],function(_0xcaa2af){return{'model':db[_0xcaa2af[_0xabde('0x1f')]],'as':_0xcaa2af['as'],'attributes':_0xcaa2af['attributes'],'include':_0xcaa2af['include']?_[_0xabde('0x1e')](_0xcaa2af[_0xabde('0x1d')],function(_0x38bf9e){return{'model':db[_0x38bf9e[_0xabde('0x1f')]],'as':_0x38bf9e['as'],'attributes':_0x38bf9e[_0xabde('0x1b')],'include':_0x38bf9e[_0xabde('0x1d')]?_[_0xabde('0x1e')](_0x38bf9e[_0xabde('0x1d')],function(_0x50854f){return{'model':db[_0x50854f[_0xabde('0x1f')]],'as':_0x50854f['as'],'attributes':_0x50854f[_0xabde('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xabde('0xd')](function(_0x17bab7){logger[_0xabde('0xe')](_0xabde('0x21'),_0x46b266);logger[_0xabde('0xf')](_0xabde('0x21'),_0x46b266,JSON[_0xabde('0x11')](_0x17bab7));_0x491ea4(_0x17bab7);})[_0xabde('0x22')](function(_0x1273c5){logger[_0xabde('0x12')]('ShowTrigger',_0x1273c5['message'],_0x46b266);_0x2d021e(_0x267cf3[_0xabde('0x12')](0x1f4,_0x1273c5['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 0f4122e..c35b90c 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 _0x3bf0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','/:id/clone','clone','put','/:id','update','delete','exports','multer','util','connect-timeout','express'];(function(_0x13875a,_0x4d878b){var _0x4e2fbb=function(_0x2a94a8){while(--_0x2a94a8){_0x13875a['push'](_0x13875a['shift']());}};_0x4e2fbb(++_0x4d878b);}(_0x3bf0,0x1b5));var _0x03bf=function(_0x3edb90,_0x305612){_0x3edb90=_0x3edb90-0x0;var _0x318a53=_0x3bf0[_0x3edb90];return _0x318a53;};'use strict';var multer=require(_0x03bf('0x0'));var util=require(_0x03bf('0x1'));var path=require('path');var timeout=require(_0x03bf('0x2'));var express=require(_0x03bf('0x3'));var router=express[_0x03bf('0x4')]();var fs_extra=require(_0x03bf('0x5'));var auth=require(_0x03bf('0x6'));var interaction=require(_0x03bf('0x7'));var config=require(_0x03bf('0x8'));var controller=require('./trunk.controller');router[_0x03bf('0x9')]('/',auth[_0x03bf('0xa')](),controller[_0x03bf('0xb')]);router[_0x03bf('0x9')]('/:id',auth[_0x03bf('0xa')](),controller[_0x03bf('0xc')]);router[_0x03bf('0xd')](_0x03bf('0xe'),auth[_0x03bf('0xa')](),controller[_0x03bf('0xf')]);router[_0x03bf('0xd')]('/',auth[_0x03bf('0xa')](),controller['create']);router[_0x03bf('0x10')](_0x03bf('0x11'),auth[_0x03bf('0xa')](),controller[_0x03bf('0x12')]);router[_0x03bf('0x13')]('/:id',auth[_0x03bf('0xa')](),controller['destroy']);module[_0x03bf('0x14')]=router; \ No newline at end of file +var _0xab41=['/:id/clone','clone','create','put','delete','destroy','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id'];(function(_0x168fe1,_0x2cb0ec){var _0x1c29a5=function(_0x2b1e64){while(--_0x2b1e64){_0x168fe1['push'](_0x168fe1['shift']());}};_0x1c29a5(++_0x2cb0ec);}(_0xab41,0x97));var _0x1ab4=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xab41[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0x1ab4('0x0'));var path=require('path');var timeout=require(_0x1ab4('0x1'));var express=require(_0x1ab4('0x2'));var router=express[_0x1ab4('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1ab4('0x4'));var config=require(_0x1ab4('0x5'));var controller=require(_0x1ab4('0x6'));router[_0x1ab4('0x7')]('/',auth[_0x1ab4('0x8')](),controller[_0x1ab4('0x9')]);router[_0x1ab4('0x7')](_0x1ab4('0xa'),auth[_0x1ab4('0x8')](),controller['show']);router['post'](_0x1ab4('0xb'),auth[_0x1ab4('0x8')](),controller[_0x1ab4('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1ab4('0xd')]);router[_0x1ab4('0xe')](_0x1ab4('0xa'),auth[_0x1ab4('0x8')](),controller['update']);router[_0x1ab4('0xf')](_0x1ab4('0xa'),auth[_0x1ab4('0x8')](),controller[_0x1ab4('0x10')]);module[_0x1ab4('0x11')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 65998bc..bcfecc2 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 _0x90e5=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','accept','uas','pai','fingerprint','certificate','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','STRING','name','friend','user','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure'];(function(_0xb4788,_0x1efb8d){var _0xd49d21=function(_0x2b2a2b){while(--_0x2b2a2b){_0xb4788['push'](_0xb4788['shift']());}};_0xd49d21(++_0x1efb8d);}(_0x90e5,0x17d));var _0x590e=function(_0x270e97,_0x58a427){_0x270e97=_0x270e97-0x0;var _0x54dc12=_0x90e5[_0x270e97];return _0x54dc12;};'use strict';var Sequelize=require(_0x590e('0x0'));module['exports']={'name':{'type':Sequelize[_0x590e('0x1')],'allowNull':![],'unique':_0x590e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x590e('0x3'),_0x590e('0x4'),'peer'),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x590e('0x1')],'allowNull':![],'defaultValue':_0x590e('0x5')},'callingpres':{'type':Sequelize[_0x590e('0x6')](_0x590e('0x7'),'ALLOWED_PASSED_SCREEN',_0x590e('0x8'),'ALLOWED',_0x590e('0x9'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize[_0x590e('0x1')]},'permit':{'type':Sequelize[_0x590e('0x1')]},'secret':{'type':Sequelize[_0x590e('0x1')]},'md5secret':{'type':Sequelize[_0x590e('0x1')]},'remotesecret':{'type':Sequelize[_0x590e('0x1')]},'transport':{'type':Sequelize[_0x590e('0x1')],'defaultValue':_0x590e('0xa'),'set':function(_0x3823f6){this[_0x590e('0xb')](_0x590e('0xc'),_0x3823f6?_0x3823f6[_0x590e('0xd')](','):null);},'get':function(){return this['getDataValue'](_0x590e('0xc'))?this[_0x590e('0xe')](_0x590e('0xc'))[_0x590e('0xf')](','):null;},'comment':_0x590e('0x10')},'dtmfmode':{'type':Sequelize[_0x590e('0x6')](_0x590e('0x11'),_0x590e('0x12'),_0x590e('0x13'),_0x590e('0x14'),_0x590e('0x15')),'defaultValue':_0x590e('0x11')},'directmedia':{'type':Sequelize['ENUM'](_0x590e('0x16'),'no',_0x590e('0x17'),_0x590e('0x18'),_0x590e('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x590e('0x6')](_0x590e('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x590e('0x1')]},'directmediadeny':{'type':Sequelize[_0x590e('0x1')]},'nat':{'type':Sequelize[_0x590e('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x4183e4){this[_0x590e('0xb')](_0x590e('0x1a'),_0x4183e4?_0x4183e4[_0x590e('0xd')](','):null);},'get':function(){return this[_0x590e('0xe')](_0x590e('0x1a'))?this['getDataValue'](_0x590e('0x1a'))[_0x590e('0xf')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x590e('0x1')]},'namedcallgroup':{'type':Sequelize[_0x590e('0x1')]},'pickupgroup':{'type':Sequelize[_0x590e('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x590e('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x590e('0x1')],'defaultValue':_0x590e('0x1b')},'allow':{'type':Sequelize[_0x590e('0x1')],'allowNull':![],'defaultValue':_0x590e('0x1c'),'set':function(_0xdf5eb5){this['setDataValue']('allow',_0xdf5eb5?_0xdf5eb5[_0x590e('0xd')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x590e('0xe')]('allow')?this[_0x590e('0xe')](_0x590e('0x1d'))[_0x590e('0xf')](';'):null;},'comment':_0x590e('0x1e')},'autoframing':{'type':Sequelize[_0x590e('0x6')](_0x590e('0x16'),'no')},'insecure':{'type':Sequelize[_0x590e('0x1')],'defaultValue':_0x590e('0x1f'),'set':function(_0x17a13e){this[_0x590e('0xb')]('insecure',_0x17a13e?_0x17a13e[_0x590e('0xd')](','):null);},'get':function(){return this[_0x590e('0xe')](_0x590e('0x20'))?this[_0x590e('0xe')](_0x590e('0x20'))['split'](','):null;},'comment':_0x590e('0x21')},'trustrpid':{'type':Sequelize[_0x590e('0x6')](_0x590e('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x590e('0x6')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x590e('0x6')](_0x590e('0x16'),'no',_0x590e('0x22'))},'promiscredir':{'type':Sequelize['ENUM'](_0x590e('0x16'),'no')},'useclientcode':{'type':Sequelize[_0x590e('0x6')](_0x590e('0x16'),'no')},'accountcode':{'type':Sequelize[_0x590e('0x23')](0xb)},'setvar':{'type':Sequelize[_0x590e('0x1')]},'callerid':{'type':Sequelize[_0x590e('0x1')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x590e('0x1')]},'callcounter':{'type':Sequelize[_0x590e('0x6')](_0x590e('0x16'),'no'),'defaultValue':_0x590e('0x16')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x590e('0x6')](_0x590e('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0x590e('0x6')](_0x590e('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0x590e('0x6')](_0x590e('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0x590e('0x6')](_0x590e('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0x590e('0x1')]},'template':{'type':Sequelize[_0x590e('0x1')]},'videosupport':{'type':Sequelize[_0x590e('0x6')](_0x590e('0x16'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x590e('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x590e('0x16'),'no')},'mailbox':{'type':Sequelize[_0x590e('0x1')]},'session_timers':{'type':Sequelize[_0x590e('0x6')](_0x590e('0x24'),'refuse','originate')},'session_expires':{'type':Sequelize[_0x590e('0x23')](0xb)},'session_minse':{'type':Sequelize[_0x590e('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0x590e('0x6')]('uac','uas'),'defaultValue':_0x590e('0x25')},'t38pt_usertpsource':{'type':Sequelize[_0x590e('0x1')]},'regexten':{'type':Sequelize[_0x590e('0x1')]},'fromdomain':{'type':Sequelize[_0x590e('0x1')]},'fromuser':{'type':Sequelize[_0x590e('0x1')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x590e('0x23')](0xb)},'defaultip':{'type':Sequelize[_0x590e('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x590e('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x590e('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x590e('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0x590e('0x6')](_0x590e('0x16'),'no',_0x590e('0x26')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x590e('0x1')]},'timert1':{'type':Sequelize[_0x590e('0x23')](0xb)},'timerb':{'type':Sequelize[_0x590e('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x590e('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0x590e('0x1')]},'contactdeny':{'type':Sequelize[_0x590e('0x1')]},'contactacl':{'type':Sequelize[_0x590e('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x590e('0x1')]},'use_q850_reason':{'type':Sequelize[_0x590e('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x590e('0x6')](_0x590e('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x590e('0x6')]('yes','no')},'force_avp':{'type':Sequelize['ENUM'](_0x590e('0x16'),'no')},'icesupport':{'type':Sequelize[_0x590e('0x6')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x590e('0x6')](_0x590e('0x16'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x590e('0x16'),'no',_0x590e('0x27'),_0x590e('0x28'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x590e('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x590e('0x1')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x590e('0x29'),_0x590e('0x2a')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x590e('0x6')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x590e('0x1')]},'recordofffeature':{'type':Sequelize[_0x590e('0x1')]},'call_limit':{'type':Sequelize[_0x590e('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x590e('0x16'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x590e('0x16'),'no')},'vmexten':{'type':Sequelize[_0x590e('0x1')]},'mohinterpret':{'type':Sequelize[_0x590e('0x1')]},'mohsuggest':{'type':Sequelize[_0x590e('0x1')]},'parkinglot':{'type':Sequelize[_0x590e('0x1')]},'description':{'type':Sequelize[_0x590e('0x1')]},'host':{'type':Sequelize[_0x590e('0x1')],'defaultValue':_0x590e('0x2b')},'canreinvite':{'type':Sequelize[_0x590e('0x6')](_0x590e('0x16'),'no',_0x590e('0x17'),_0x590e('0x18'),_0x590e('0x2c')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x590e('0x1')]},'otherFields':{'type':Sequelize[_0x590e('0x1')]},'active':{'type':Sequelize[_0x590e('0x2d')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x590e('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x2969=['accept','refuse','uas','pai','fingerprint','certificate','passive','actpass','dynamic','sequelize','STRING','ENUM','peer','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED','PROHIB','setDataValue','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER','always'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x2969,0x136));var _0x9296=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2969[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x9296('0x0'));module['exports']={'name':{'type':Sequelize[_0x9296('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x9296('0x2')]('friend','user',_0x9296('0x3')),'allowNull':![],'defaultValue':_0x9296('0x4')},'context':{'type':Sequelize[_0x9296('0x1')],'allowNull':![],'defaultValue':_0x9296('0x5')},'callingpres':{'type':Sequelize['ENUM'](_0x9296('0x6'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0x9296('0x7'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0x9296('0x8'))},'deny':{'type':Sequelize[_0x9296('0x1')]},'permit':{'type':Sequelize[_0x9296('0x1')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x9296('0x1')]},'remotesecret':{'type':Sequelize[_0x9296('0x1')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x4b7e8a){this[_0x9296('0x9')]('transport',_0x4b7e8a?_0x4b7e8a[_0x9296('0xa')](','):null);},'get':function(){return this[_0x9296('0xb')](_0x9296('0xc'))?this[_0x9296('0xb')]('transport')[_0x9296('0xd')](','):null;},'comment':_0x9296('0xe')},'dtmfmode':{'type':Sequelize[_0x9296('0x2')](_0x9296('0xf'),_0x9296('0x10'),'shortinfo',_0x9296('0x11'),_0x9296('0x12')),'defaultValue':_0x9296('0xf')},'directmedia':{'type':Sequelize[_0x9296('0x2')](_0x9296('0x13'),'no',_0x9296('0x14'),_0x9296('0x15'),_0x9296('0x16')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x9296('0x13'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x9296('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x9296('0x17'),'set':function(_0x532f6e){this[_0x9296('0x9')](_0x9296('0x18'),_0x532f6e?_0x532f6e['join'](','):null);},'get':function(){return this[_0x9296('0xb')]('nat')?this[_0x9296('0xb')](_0x9296('0x18'))[_0x9296('0xd')](','):null;},'comment':_0x9296('0x19')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x9296('0x1')]},'pickupgroup':{'type':Sequelize[_0x9296('0x1')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x9296('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9296('0x1a'),'set':function(_0x2a80b0){this[_0x9296('0x9')](_0x9296('0x1b'),_0x2a80b0?_0x2a80b0[_0x9296('0xa')](';'):_0x9296('0x1a'));},'get':function(){return this[_0x9296('0xb')](_0x9296('0x1b'))?this[_0x9296('0xb')](_0x9296('0x1b'))[_0x9296('0xd')](';'):null;},'comment':_0x9296('0x1c')},'autoframing':{'type':Sequelize[_0x9296('0x2')](_0x9296('0x13'),'no')},'insecure':{'type':Sequelize[_0x9296('0x1')],'defaultValue':_0x9296('0x1d'),'set':function(_0x5b0b32){this['setDataValue'](_0x9296('0x1e'),_0x5b0b32?_0x5b0b32['join'](','):null);},'get':function(){return this[_0x9296('0xb')]('insecure')?this[_0x9296('0xb')](_0x9296('0x1e'))[_0x9296('0xd')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x9296('0x13'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x9296('0x2')](_0x9296('0x13'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x9296('0x2')]('yes','no',_0x9296('0x1f'))},'promiscredir':{'type':Sequelize[_0x9296('0x2')](_0x9296('0x13'),'no')},'useclientcode':{'type':Sequelize[_0x9296('0x2')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x9296('0x1')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x9296('0x1')]},'callcounter':{'type':Sequelize['ENUM'](_0x9296('0x13'),'no'),'defaultValue':_0x9296('0x13')},'busylevel':{'type':Sequelize[_0x9296('0x20')](0xb)},'allowoverlap':{'type':Sequelize[_0x9296('0x2')](_0x9296('0x13'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x9296('0x13'),'no')},'allowtransfer':{'type':Sequelize[_0x9296('0x2')](_0x9296('0x13'),'no')},'ignoresdpversion':{'type':Sequelize[_0x9296('0x2')](_0x9296('0x13'),'no')},'subscribecontext':{'type':Sequelize[_0x9296('0x1')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x9296('0x2')](_0x9296('0x13'),'no',_0x9296('0x21')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x9296('0x20')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x9296('0x13'),'no')},'mailbox':{'type':Sequelize[_0x9296('0x1')]},'session_timers':{'type':Sequelize['ENUM'](_0x9296('0x22'),_0x9296('0x23'),'originate')},'session_expires':{'type':Sequelize[_0x9296('0x20')](0xb)},'session_minse':{'type':Sequelize[_0x9296('0x20')](0xb)},'session_refresher':{'type':Sequelize['ENUM']('uac',_0x9296('0x24')),'defaultValue':_0x9296('0x24')},'t38pt_usertpsource':{'type':Sequelize[_0x9296('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x9296('0x1')]},'fromuser':{'type':Sequelize[_0x9296('0x1')]},'port':{'type':Sequelize[_0x9296('0x20')](0x5)},'qualify':{'type':Sequelize[_0x9296('0x2')](_0x9296('0x13'),'no'),'defaultValue':_0x9296('0x13')},'keepalive':{'type':Sequelize[_0x9296('0x20')](0xb)},'defaultip':{'type':Sequelize[_0x9296('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x9296('0x20')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x9296('0x20')](0xb)},'sendrpid':{'type':Sequelize[_0x9296('0x2')]('yes','no',_0x9296('0x25')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x9296('0x1')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x9296('0x1')]},'contactdeny':{'type':Sequelize[_0x9296('0x1')]},'contactacl':{'type':Sequelize[_0x9296('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x9296('0x1')]},'use_q850_reason':{'type':Sequelize[_0x9296('0x1')]},'maxforwards':{'type':Sequelize[_0x9296('0x20')](0xb)},'encryption':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no')},'force_avp':{'type':Sequelize[_0x9296('0x2')](_0x9296('0x13'),'no')},'icesupport':{'type':Sequelize[_0x9296('0x2')](_0x9296('0x13'),'no')},'dtlsenable':{'type':Sequelize[_0x9296('0x2')](_0x9296('0x13'),'no')},'dtlsverify':{'type':Sequelize[_0x9296('0x2')]('yes','no',_0x9296('0x26'),_0x9296('0x27'))},'dtlsrekey':{'type':Sequelize[_0x9296('0x20')](0xb)},'dtlscertfile':{'type':Sequelize[_0x9296('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x9296('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x9296('0x1')]},'dtlssetup':{'type':Sequelize[_0x9296('0x2')]('active',_0x9296('0x28'),_0x9296('0x29')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x9296('0x1')]},'usereqphone':{'type':Sequelize[_0x9296('0x2')](_0x9296('0x13'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x9296('0x20')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x9296('0x2')](_0x9296('0x13'),'no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize[_0x9296('0x1')]},'mohinterpret':{'type':Sequelize[_0x9296('0x1')]},'mohsuggest':{'type':Sequelize[_0x9296('0x1')]},'parkinglot':{'type':Sequelize[_0x9296('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0x9296('0x2a')},'canreinvite':{'type':Sequelize[_0x9296('0x2')]('yes','no',_0x9296('0x14'),_0x9296('0x15'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x9296('0x1')]},'otherFields':{'type':Sequelize[_0x9296('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x9296('0x1')],'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 e3eb2cb..dabffb9 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 _0x8ef6=['userProfileId','autoAssociation','UserProfileResource','readFileSync','join','root','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','utf8','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','Trunks','stack','name','send','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','options','Trunk','includeAll','include','findAll','rows','show','params','rawAttributes','merge','find','catch','clone','omit','createdAt','updatedAt','create','body','get','role','UserProfileSection'];(function(_0x38ed45,_0x4ca866){var _0x37ea2f=function(_0x5c4e57){while(--_0x5c4e57){_0x38ed45['push'](_0x38ed45['shift']());}};_0x37ea2f(++_0x4ca866);}(_0x8ef6,0xf2));var _0x68ef=function(_0x1f60f6,_0x3f4a7f){_0x1f60f6=_0x1f60f6-0x0;var _0x443d3f=_0x8ef6[_0x1f60f6];return _0x443d3f;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];var jayson=require(_0x68ef('0x1b'));var client=jayson[_0x68ef('0x1c')][_0x68ef('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x288cc9,_0x508671,_0x3b48dd,_0xc50cce){return new BPromise(function(_0x2657c5,_0x47fbb5){var _0x22fe96=_0xc50cce||client;return _0x22fe96[_0x68ef('0x1e')](_0x288cc9,_0x3b48dd)[_0x68ef('0x1f')](function(_0x5005ba){logger[_0x68ef('0x20')](_0x68ef('0x21'),_0x508671,_0x68ef('0x22'));logger[_0x68ef('0x23')]('Trunk,\x20%s,\x20%s,\x20%s',_0x508671,_0x68ef('0x22'),JSON['stringify'](_0x5005ba));if(_0x5005ba['error']){if(_0x5005ba[_0x68ef('0x24')][_0x68ef('0x25')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x508671,_0x5005ba[_0x68ef('0x24')][_0x68ef('0x26')]);return _0x47fbb5(_0x5005ba[_0x68ef('0x24')]['message']);}logger[_0x68ef('0x24')](_0x68ef('0x21'),_0x508671,_0x5005ba[_0x68ef('0x24')]['message']);return _0x2657c5(_0x5005ba[_0x68ef('0x24')][_0x68ef('0x26')]);}else{logger['info'](_0x68ef('0x21'),_0x508671,_0x68ef('0x22'));_0x2657c5(_0x5005ba[_0x68ef('0x27')]['message']);}})['catch'](function(_0x59bebc){logger[_0x68ef('0x24')](_0x68ef('0x21'),_0x508671,_0x59bebc);_0x47fbb5(_0x59bebc);});});}function respondWithStatusCode(_0x312cc9,_0x2e6e39){_0x2e6e39=_0x2e6e39||0xcc;return function(_0x438b4c){if(_0x438b4c){return _0x312cc9[_0x68ef('0x28')](_0x2e6e39);}return _0x312cc9[_0x68ef('0x29')](_0x2e6e39)[_0x68ef('0x2a')]();};}function respondWithResult(_0x65fd09,_0x13280b){_0x13280b=_0x13280b||0xc8;return function(_0x5e4dbe){if(_0x5e4dbe){return _0x65fd09[_0x68ef('0x29')](_0x13280b)['json'](_0x5e4dbe);}};}function respondWithFilteredResult(_0x599243,_0x55d8b0){return function(_0x1a7ce1){if(_0x1a7ce1){var _0x268f32=typeof _0x55d8b0[_0x68ef('0x2b')]===_0x68ef('0x2c')&&typeof _0x55d8b0['limit']==='undefined';var _0x1cbe4f=_0x1a7ce1[_0x68ef('0x2d')];var _0x7bf96=_0x268f32?0x0:_0x55d8b0[_0x68ef('0x2b')];var _0x22ef25=_0x268f32?_0x1a7ce1[_0x68ef('0x2d')]:_0x55d8b0[_0x68ef('0x2b')]+_0x55d8b0[_0x68ef('0x2e')];var _0x5a6dfd;if(_0x22ef25>=_0x1cbe4f){_0x22ef25=_0x1cbe4f;_0x5a6dfd=0xc8;}else{_0x5a6dfd=0xce;}_0x599243[_0x68ef('0x29')](_0x5a6dfd);return _0x599243[_0x68ef('0x2f')](_0x68ef('0x30'),_0x7bf96+'-'+_0x22ef25+'/'+_0x1cbe4f)['json'](_0x1a7ce1);}return null;};}function patchUpdates(_0x370a8f){return function(_0x523120){try{jsonpatch[_0x68ef('0x31')](_0x523120,_0x370a8f,!![]);}catch(_0x17588a){return BPromise['reject'](_0x17588a);}return _0x523120['save']();};}function saveUpdates(_0x159395,_0x5fa72a){return function(_0x4b8fc8){if(_0x4b8fc8){return _0x4b8fc8[_0x68ef('0x32')](_0x159395)[_0x68ef('0x1f')](function(_0x2d67be){return _0x2d67be;});}return null;};}function removeEntity(_0x2d1e9f,_0x59e9fb){return function(_0x2c8bd0){if(_0x2c8bd0){return _0x2c8bd0[_0x68ef('0x33')]()['then'](function(){var _0x2f8de2=_0x2c8bd0['get']({'plain':!![]});var _0x14581d=_0x68ef('0x34');return db['UserProfileResource'][_0x68ef('0x33')]({'where':{'type':_0x14581d,'resourceId':_0x2f8de2['id']}})['then'](function(){return _0x2c8bd0;});})[_0x68ef('0x1f')](function(){_0x2d1e9f['status'](0xcc)[_0x68ef('0x2a')]();});}};}function handleEntityNotFound(_0x1444e0,_0x798276){return function(_0x569949){if(!_0x569949){_0x1444e0[_0x68ef('0x28')](0x194);}return _0x569949;};}function handleError(_0x485dc3,_0x476938){_0x476938=_0x476938||0x1f4;return function(_0x4c9506){logger[_0x68ef('0x24')](_0x4c9506[_0x68ef('0x35')]);if(_0x4c9506[_0x68ef('0x36')]){delete _0x4c9506[_0x68ef('0x36')];}_0x485dc3[_0x68ef('0x29')](_0x476938)[_0x68ef('0x37')](_0x4c9506);};}exports['index']=function(_0x294fba,_0x15a6ab){var _0x32074a={},_0x52a8b9={},_0x32eddd={'count':0x0,'rows':[]};var _0x3c5de6=_[_0x68ef('0x38')](db['Trunk']['rawAttributes'],function(_0x14f0fc){return{'name':_0x14f0fc[_0x68ef('0x39')],'type':_0x14f0fc[_0x68ef('0x3a')][_0x68ef('0x3b')]};});_0x52a8b9[_0x68ef('0x3c')]=_[_0x68ef('0x38')](_0x3c5de6,_0x68ef('0x36'));_0x52a8b9['query']=_[_0x68ef('0x3d')](_0x294fba[_0x68ef('0x3e')]);_0x52a8b9[_0x68ef('0x3f')]=_[_0x68ef('0x40')](_0x52a8b9['model'],_0x52a8b9[_0x68ef('0x3e')]);_0x32074a[_0x68ef('0x41')]=_[_0x68ef('0x40')](_0x52a8b9[_0x68ef('0x3c')],qs[_0x68ef('0x42')](_0x294fba[_0x68ef('0x3e')]['fields']));_0x32074a[_0x68ef('0x41')]=_0x32074a[_0x68ef('0x41')][_0x68ef('0x43')]?_0x32074a[_0x68ef('0x41')]:_0x52a8b9[_0x68ef('0x3c')];if(!_0x294fba[_0x68ef('0x3e')][_0x68ef('0x44')](_0x68ef('0x45'))){_0x32074a[_0x68ef('0x2e')]=qs['limit'](_0x294fba[_0x68ef('0x3e')][_0x68ef('0x2e')]);_0x32074a[_0x68ef('0x2b')]=qs[_0x68ef('0x2b')](_0x294fba[_0x68ef('0x3e')][_0x68ef('0x2b')]);}_0x32074a[_0x68ef('0x46')]=qs['sort'](_0x294fba[_0x68ef('0x3e')]['sort']);_0x32074a[_0x68ef('0x47')]=qs[_0x68ef('0x3f')](_[_0x68ef('0x48')](_0x294fba[_0x68ef('0x3e')],_0x52a8b9['filters']),_0x3c5de6);if(_0x294fba[_0x68ef('0x3e')]['filter']){_0x32074a[_0x68ef('0x47')]=_['merge'](_0x32074a[_0x68ef('0x47')],{'$or':_[_0x68ef('0x38')](_0x3c5de6,function(_0x105e8c){if(_0x105e8c['type']!=='VIRTUAL'){var _0x4044d5={};_0x4044d5[_0x105e8c[_0x68ef('0x36')]]={'$like':'%'+_0x294fba['query']['filter']+'%'};return _0x4044d5;}})});}_0x32074a=_['merge']({},_0x32074a,_0x294fba[_0x68ef('0x49')]);var _0x15c753={'where':_0x32074a[_0x68ef('0x47')]};return db[_0x68ef('0x4a')][_0x68ef('0x2d')](_0x15c753)['then'](function(_0x55f385){_0x32eddd[_0x68ef('0x2d')]=_0x55f385;if(_0x294fba[_0x68ef('0x3e')][_0x68ef('0x4b')]){_0x32074a[_0x68ef('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0x68ef('0x4d')](_0x32074a);})[_0x68ef('0x1f')](function(_0x1c9b6f){_0x32eddd[_0x68ef('0x4e')]=_0x1c9b6f;return _0x32eddd;})['then'](respondWithFilteredResult(_0x15a6ab,_0x32074a))['catch'](handleError(_0x15a6ab,null));};exports[_0x68ef('0x4f')]=function(_0x3c3074,_0x566e7c){var _0xfc7a74={'raw':![],'where':{'id':_0x3c3074[_0x68ef('0x50')]['id']}},_0x12fff3={};_0x12fff3[_0x68ef('0x3c')]=_[_0x68ef('0x3d')](db['Trunk'][_0x68ef('0x51')]);_0x12fff3[_0x68ef('0x3e')]=_[_0x68ef('0x3d')](_0x3c3074['query']);_0x12fff3[_0x68ef('0x3f')]=_[_0x68ef('0x40')](_0x12fff3[_0x68ef('0x3c')],_0x12fff3['query']);_0xfc7a74[_0x68ef('0x41')]=_['intersection'](_0x12fff3['model'],qs[_0x68ef('0x42')](_0x3c3074['query'][_0x68ef('0x42')]));_0xfc7a74[_0x68ef('0x41')]=_0xfc7a74[_0x68ef('0x41')][_0x68ef('0x43')]?_0xfc7a74[_0x68ef('0x41')]:_0x12fff3[_0x68ef('0x3c')];if(_0x3c3074[_0x68ef('0x3e')][_0x68ef('0x4b')]){_0xfc7a74[_0x68ef('0x4c')]=[{'all':!![]}];}_0xfc7a74=_[_0x68ef('0x52')]({},_0xfc7a74,_0x3c3074['options']);return db['Trunk'][_0x68ef('0x53')](_0xfc7a74)[_0x68ef('0x1f')](handleEntityNotFound(_0x566e7c,null))[_0x68ef('0x1f')](respondWithResult(_0x566e7c,null))[_0x68ef('0x54')](handleError(_0x566e7c,null));};exports[_0x68ef('0x55')]=function(_0x1d11d7,_0x15400c){var _0x300a64={'where':{'id':_0x1d11d7['params']['id']}},_0x40c784={};_0x40c784['model']=_[_0x68ef('0x3d')](db['Trunk'][_0x68ef('0x51')]);_0x300a64['attributes']=_[_0x68ef('0x40')](_0x40c784[_0x68ef('0x3c')],qs['fields'](_0x1d11d7[_0x68ef('0x3e')]['fields']));_0x300a64[_0x68ef('0x41')]=_0x300a64[_0x68ef('0x41')][_0x68ef('0x43')]?_0x300a64[_0x68ef('0x41')]:_0x40c784[_0x68ef('0x3c')];if(_0x1d11d7[_0x68ef('0x3e')]['includeAll']){_0x300a64[_0x68ef('0x4c')]=[{'all':!![]}];}_0x300a64=_[_0x68ef('0x52')]({},_0x300a64,_0x1d11d7[_0x68ef('0x49')]);return db[_0x68ef('0x4a')][_0x68ef('0x53')](_0x300a64)[_0x68ef('0x1f')](handleEntityNotFound(_0x15400c,null))['then'](function(_0x9a978f){if(_0x9a978f){var _0x42d2a3=_0x9a978f['get']({'plain':!![]});_0x42d2a3=qs[_0x68ef('0x56')](_0x42d2a3,['id',_0x68ef('0x57'),_0x68ef('0x58')]);_0x1d11d7['body']=_[_0x68ef('0x56')](_0x1d11d7['body'],['id','createdAt',_0x68ef('0x58')]);return db['Trunk'][_0x68ef('0x59')](_['merge'](_0x42d2a3,_0x1d11d7[_0x68ef('0x5a')]),{'include':_0x1d11d7[_0x68ef('0x3e')][_0x68ef('0x4b')]?[{'all':!![]}]:undefined})[_0x68ef('0x1f')](function(_0x19ce17){var _0x19a9c4=_0x1d11d7['user'][_0x68ef('0x5b')]({'plain':!![]});if(!_0x19a9c4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19a9c4[_0x68ef('0x5c')]==='user'){var _0x2f97c5=_0x19ce17[_0x68ef('0x5b')]({'plain':!![]});var _0x212ec4=_0x68ef('0x34');return db[_0x68ef('0x5d')][_0x68ef('0x53')]({'where':{'name':_0x212ec4,'userProfileId':_0x19a9c4[_0x68ef('0x5e')]},'raw':!![]})['then'](function(_0x3ea4e7){if(_0x3ea4e7&&_0x3ea4e7[_0x68ef('0x5f')]===0x0){return db[_0x68ef('0x60')][_0x68ef('0x59')]({'name':_0x2f97c5[_0x68ef('0x36')],'resourceId':_0x2f97c5['id'],'type':_0x3ea4e7['name'],'sectionId':_0x3ea4e7['id']},{})[_0x68ef('0x1f')](function(){return _0x19ce17;});}else{return _0x19ce17;}})['catch'](function(_0x1ed172){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ed172);throw _0x1ed172;});}return _0x19ce17;});}})[_0x68ef('0x1f')](respondWithResult(_0x15400c,0xc9))[_0x68ef('0x54')](handleError(_0x15400c,null));};exports[_0x68ef('0x59')]=function(_0x21b2ce,_0x51f905,_0x124b49){var _0x570e0c;return db[_0x68ef('0x4a')][_0x68ef('0x59')](_0x21b2ce[_0x68ef('0x5a')],{'raw':!![]})['then'](function(_0x541e35){_0x570e0c=_0x541e35;return db[_0x68ef('0x4a')][_0x68ef('0x4d')]({'raw':!![]});})[_0x68ef('0x1f')](function(_0x454c6f){var _0x5b41e1=fs[_0x68ef('0x61')](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x64')),'utf8');var _0x3f56a7=fs['readFileSync'](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x65')),_0x68ef('0x66'));var _0xed16d1=ejs['render'](_0x5b41e1,{'trunks':_0x454c6f||[]});fs[_0x68ef('0x67')](_0x68ef('0x68'),_0xed16d1);if(_0x570e0c[_0x68ef('0x69')]){var _0x595e79=ejs[_0x68ef('0x6a')](_0x3f56a7,{'trunks':_0x454c6f||[]});fs['writeFileSync'](_0x68ef('0x6b'),_0x595e79);}})['then'](function(){return respondWithRpcPromise('Reload',_0x68ef('0x59'),{'module':_0x68ef('0x6c')});})[_0x68ef('0x1f')](function(){var _0x405971=_0x21b2ce['user'][_0x68ef('0x5b')]({'plain':!![]});if(!_0x405971)throw new Error(_0x68ef('0x6d'));if(_0x405971[_0x68ef('0x5c')]==='user'){var _0x3e14a4=_0x570e0c[_0x68ef('0x5b')]({'plain':!![]});return db[_0x68ef('0x5d')][_0x68ef('0x53')]({'where':{'name':_0x68ef('0x34'),'userProfileId':_0x405971[_0x68ef('0x5e')]},'raw':!![]})[_0x68ef('0x1f')](function(_0xfe72dc){if(_0xfe72dc&&_0xfe72dc[_0x68ef('0x5f')]===0x0){return db[_0x68ef('0x60')][_0x68ef('0x59')]({'name':_0x3e14a4[_0x68ef('0x36')],'resourceId':_0x3e14a4['id'],'type':_0xfe72dc['name'],'sectionId':_0xfe72dc['id']},{})[_0x68ef('0x1f')](function(){return _0x570e0c;});}else{return _0x570e0c;}})[_0x68ef('0x54')](function(_0x5db443){logger['error'](_0x68ef('0x6e'),_0x5db443);throw _0x5db443;});}return _0x570e0c;})['then'](respondWithResult(_0x51f905,0xc9))[_0x68ef('0x54')](handleError(_0x51f905,null));};exports[_0x68ef('0x32')]=function(_0x5f1b12,_0x4e0874,_0x31a336){var _0x5c500c;return db[_0x68ef('0x4a')]['find']({'where':{'id':_0x5f1b12[_0x68ef('0x50')]['id']}})['then'](handleEntityNotFound(_0x4e0874,null))[_0x68ef('0x1f')](saveUpdates(_0x5f1b12[_0x68ef('0x5a')],null))['then'](function(_0x3c5e35){if(_0x3c5e35){_0x5c500c=_0x3c5e35;return db[_0x68ef('0x4a')][_0x68ef('0x4d')]({'raw':!![]});}})[_0x68ef('0x1f')](function(_0x50c308){if(_0x50c308){var _0x2bebdc=fs[_0x68ef('0x61')](path['join'](config[_0x68ef('0x63')],_0x68ef('0x64')),_0x68ef('0x66'));var _0x4de1d1=fs[_0x68ef('0x61')](path['join'](config[_0x68ef('0x63')],_0x68ef('0x65')),'utf8');var _0x4b0fb4=ejs['render'](_0x2bebdc,{'trunks':_0x50c308||[]});fs['writeFileSync'](_0x68ef('0x68'),_0x4b0fb4);var _0x28ad22=ejs[_0x68ef('0x6a')](_0x4de1d1,{'trunks':_0x50c308||[]});fs[_0x68ef('0x67')](_0x68ef('0x6b'),_0x28ad22);return respondWithRpcPromise(_0x68ef('0x6f'),_0x68ef('0x32'),{'module':_0x68ef('0x6c')});}return null;})[_0x68ef('0x1f')](function(_0x3ae3e9){if(_0x3ae3e9){return _0x5c500c;}})[_0x68ef('0x1f')](respondWithResult(_0x4e0874,null))[_0x68ef('0x54')](handleError(_0x4e0874,null));};exports[_0x68ef('0x33')]=function(_0x4bd5c3,_0x2b20dc,_0x556dfc){var _0x791181;return db['Trunk']['find']({'where':{'id':_0x4bd5c3[_0x68ef('0x50')]['id']}})[_0x68ef('0x1f')](handleEntityNotFound(_0x2b20dc,null))[_0x68ef('0x1f')](removeEntity(_0x2b20dc,null))[_0x68ef('0x1f')](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0x68ef('0x1f')](function(_0x308997){var _0x1f1dfd=fs['readFileSync'](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x64')),_0x68ef('0x66'));var _0x4dc885=fs[_0x68ef('0x61')](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x65')),_0x68ef('0x66'));var _0x346049=ejs['render'](_0x1f1dfd,{'trunks':_0x308997});var _0x2a72e8=ejs['render'](_0x4dc885,{'trunks':_0x308997});fs[_0x68ef('0x67')](_0x68ef('0x68'),_0x346049);fs[_0x68ef('0x67')](_0x68ef('0x6b'),_0x2a72e8);return respondWithRpcPromise('Reload',_0x68ef('0x33'),{'module':'chan_sip.so'});})[_0x68ef('0x54')](handleError(_0x2b20dc,null));}; \ No newline at end of file +var _0x55ca=['catch','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','get','UserProfileResource','end','stack','name','send','Trunk','rawAttributes','type','model','map','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','length','options','find','clone','omit','updatedAt','body','createdAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','Reload','chan_sip.so','readFileSync','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x1c75f2,_0x155a26){var _0x9f019d=function(_0x2bb4c2){while(--_0x2bb4c2){_0x1c75f2['push'](_0x1c75f2['shift']());}};_0x9f019d(++_0x155a26);}(_0x55ca,0x126));var _0xa55c=function(_0x5a8269,_0xfb2f54){_0x5a8269=_0x5a8269-0x0;var _0x539ed7=_0x55ca[_0x5a8269];return _0x539ed7;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa55c('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x576044,_0x5a3672,_0x59ea8d,_0x18ee85){return new BPromise(function(_0x3930e4,_0x462cd6){var _0x938bd6=_0x18ee85||client;return _0x938bd6[_0xa55c('0x19')](_0x576044,_0x59ea8d)[_0xa55c('0x1a')](function(_0x4e0b2f){logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,_0xa55c('0x1d'));logger[_0xa55c('0x1e')](_0xa55c('0x1f'),_0x5a3672,_0xa55c('0x1d'),JSON[_0xa55c('0x20')](_0x4e0b2f));if(_0x4e0b2f[_0xa55c('0x21')]){if(_0x4e0b2f[_0xa55c('0x21')]['code']===0x1f4){logger[_0xa55c('0x21')](_0xa55c('0x1c'),_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x462cd6(_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x3930e4(_0x4e0b2f[_0xa55c('0x21')]['message']);}else{logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,'request\x20sent');_0x3930e4(_0x4e0b2f[_0xa55c('0x23')][_0xa55c('0x22')]);}})[_0xa55c('0x24')](function(_0x1965f1){logger[_0xa55c('0x21')]('Trunk,\x20%s,\x20%s',_0x5a3672,_0x1965f1);_0x462cd6(_0x1965f1);});});}function respondWithStatusCode(_0x1fc828,_0x504c24){_0x504c24=_0x504c24||0xcc;return function(_0x5ba836){if(_0x5ba836){return _0x1fc828['sendStatus'](_0x504c24);}return _0x1fc828[_0xa55c('0x25')](_0x504c24)['end']();};}function respondWithResult(_0x3ecbe7,_0x190757){_0x190757=_0x190757||0xc8;return function(_0x3f64de){if(_0x3f64de){return _0x3ecbe7[_0xa55c('0x25')](_0x190757)[_0xa55c('0x26')](_0x3f64de);}};}function respondWithFilteredResult(_0x170ba4,_0x1da633){return function(_0x11e7f7){if(_0x11e7f7){var _0x192df2=typeof _0x1da633[_0xa55c('0x27')]===_0xa55c('0x28')&&typeof _0x1da633['limit']===_0xa55c('0x28');var _0x28814f=_0x11e7f7[_0xa55c('0x29')];var _0x906caa=_0x192df2?0x0:_0x1da633['offset'];var _0x1377b0=_0x192df2?_0x11e7f7[_0xa55c('0x29')]:_0x1da633[_0xa55c('0x27')]+_0x1da633[_0xa55c('0x2a')];var _0x45ee8d;if(_0x1377b0>=_0x28814f){_0x1377b0=_0x28814f;_0x45ee8d=0xc8;}else{_0x45ee8d=0xce;}_0x170ba4[_0xa55c('0x25')](_0x45ee8d);return _0x170ba4['set'](_0xa55c('0x2b'),_0x906caa+'-'+_0x1377b0+'/'+_0x28814f)['json'](_0x11e7f7);}return null;};}function patchUpdates(_0x35c9c2){return function(_0x1d730b){try{jsonpatch[_0xa55c('0x2c')](_0x1d730b,_0x35c9c2,!![]);}catch(_0x223813){return BPromise['reject'](_0x223813);}return _0x1d730b[_0xa55c('0x2d')]();};}function saveUpdates(_0x2096ae,_0x331e58){return function(_0x20da31){if(_0x20da31){return _0x20da31[_0xa55c('0x2e')](_0x2096ae)[_0xa55c('0x1a')](function(_0x29748a){return _0x29748a;});}return null;};}function removeEntity(_0x24d44d,_0x2808e9){return function(_0xcbaf2e){if(_0xcbaf2e){return _0xcbaf2e[_0xa55c('0x2f')]()['then'](function(){var _0x54ca97=_0xcbaf2e[_0xa55c('0x30')]({'plain':!![]});var _0x19733e='Trunks';return db[_0xa55c('0x31')][_0xa55c('0x2f')]({'where':{'type':_0x19733e,'resourceId':_0x54ca97['id']}})[_0xa55c('0x1a')](function(){return _0xcbaf2e;});})[_0xa55c('0x1a')](function(){_0x24d44d[_0xa55c('0x25')](0xcc)[_0xa55c('0x32')]();});}};}function handleEntityNotFound(_0x3ce1b3,_0x222d4b){return function(_0x3959e3){if(!_0x3959e3){_0x3ce1b3['sendStatus'](0x194);}return _0x3959e3;};}function handleError(_0x5f3e99,_0x4b23d3){_0x4b23d3=_0x4b23d3||0x1f4;return function(_0x3fd75f){logger[_0xa55c('0x21')](_0x3fd75f[_0xa55c('0x33')]);if(_0x3fd75f['name']){delete _0x3fd75f[_0xa55c('0x34')];}_0x5f3e99['status'](_0x4b23d3)[_0xa55c('0x35')](_0x3fd75f);};}exports['index']=function(_0x18c6f1,_0x39267c){var _0x3c0ec1={},_0x4d3eb5={},_0x7c4a47={'count':0x0,'rows':[]};var _0x30f23b=_['map'](db[_0xa55c('0x36')][_0xa55c('0x37')],function(_0x4d9083){return{'name':_0x4d9083['fieldName'],'type':_0x4d9083[_0xa55c('0x38')]['key']};});_0x4d3eb5[_0xa55c('0x39')]=_[_0xa55c('0x3a')](_0x30f23b,'name');_0x4d3eb5['query']=_['keys'](_0x18c6f1['query']);_0x4d3eb5[_0xa55c('0x3b')]=_[_0xa55c('0x3c')](_0x4d3eb5[_0xa55c('0x39')],_0x4d3eb5[_0xa55c('0x3d')]);_0x3c0ec1[_0xa55c('0x3e')]=_['intersection'](_0x4d3eb5[_0xa55c('0x39')],qs[_0xa55c('0x3f')](_0x18c6f1[_0xa55c('0x3d')][_0xa55c('0x3f')]));_0x3c0ec1[_0xa55c('0x3e')]=_0x3c0ec1[_0xa55c('0x3e')]['length']?_0x3c0ec1[_0xa55c('0x3e')]:_0x4d3eb5['model'];if(!_0x18c6f1['query'][_0xa55c('0x40')](_0xa55c('0x41'))){_0x3c0ec1['limit']=qs[_0xa55c('0x2a')](_0x18c6f1['query']['limit']);_0x3c0ec1[_0xa55c('0x27')]=qs[_0xa55c('0x27')](_0x18c6f1[_0xa55c('0x3d')]['offset']);}_0x3c0ec1[_0xa55c('0x42')]=qs[_0xa55c('0x43')](_0x18c6f1['query'][_0xa55c('0x43')]);_0x3c0ec1['where']=qs[_0xa55c('0x3b')](_[_0xa55c('0x44')](_0x18c6f1['query'],_0x4d3eb5[_0xa55c('0x3b')]),_0x30f23b);if(_0x18c6f1[_0xa55c('0x3d')]['filter']){_0x3c0ec1[_0xa55c('0x45')]=_[_0xa55c('0x46')](_0x3c0ec1[_0xa55c('0x45')],{'$or':_['map'](_0x30f23b,function(_0x334f52){if(_0x334f52['type']!==_0xa55c('0x47')){var _0x3a8af4={};_0x3a8af4[_0x334f52[_0xa55c('0x34')]]={'$like':'%'+_0x18c6f1['query'][_0xa55c('0x48')]+'%'};return _0x3a8af4;}})});}_0x3c0ec1=_[_0xa55c('0x46')]({},_0x3c0ec1,_0x18c6f1['options']);var _0x3d19f5={'where':_0x3c0ec1[_0xa55c('0x45')]};return db['Trunk'][_0xa55c('0x29')](_0x3d19f5)[_0xa55c('0x1a')](function(_0x52f9a7){_0x7c4a47[_0xa55c('0x29')]=_0x52f9a7;if(_0x18c6f1[_0xa55c('0x3d')][_0xa55c('0x49')]){_0x3c0ec1[_0xa55c('0x4a')]=[{'all':!![]}];}return db['Trunk'][_0xa55c('0x4b')](_0x3c0ec1);})['then'](function(_0x2157d6){_0x7c4a47[_0xa55c('0x4c')]=_0x2157d6;return _0x7c4a47;})[_0xa55c('0x1a')](respondWithFilteredResult(_0x39267c,_0x3c0ec1))['catch'](handleError(_0x39267c,null));};exports[_0xa55c('0x4d')]=function(_0x250b00,_0x574fe9){var _0x5be06={'raw':![],'where':{'id':_0x250b00[_0xa55c('0x4e')]['id']}},_0x34de95={};_0x34de95[_0xa55c('0x39')]=_[_0xa55c('0x4f')](db[_0xa55c('0x36')][_0xa55c('0x37')]);_0x34de95[_0xa55c('0x3d')]=_[_0xa55c('0x4f')](_0x250b00[_0xa55c('0x3d')]);_0x34de95['filters']=_[_0xa55c('0x3c')](_0x34de95[_0xa55c('0x39')],_0x34de95[_0xa55c('0x3d')]);_0x5be06['attributes']=_[_0xa55c('0x3c')](_0x34de95[_0xa55c('0x39')],qs['fields'](_0x250b00[_0xa55c('0x3d')]['fields']));_0x5be06[_0xa55c('0x3e')]=_0x5be06[_0xa55c('0x3e')][_0xa55c('0x50')]?_0x5be06[_0xa55c('0x3e')]:_0x34de95[_0xa55c('0x39')];if(_0x250b00['query'][_0xa55c('0x49')]){_0x5be06[_0xa55c('0x4a')]=[{'all':!![]}];}_0x5be06=_['merge']({},_0x5be06,_0x250b00[_0xa55c('0x51')]);return db[_0xa55c('0x36')][_0xa55c('0x52')](_0x5be06)[_0xa55c('0x1a')](handleEntityNotFound(_0x574fe9,null))['then'](respondWithResult(_0x574fe9,null))['catch'](handleError(_0x574fe9,null));};exports[_0xa55c('0x53')]=function(_0x250dea,_0x3ca5b8){var _0x44ac57={'where':{'id':_0x250dea[_0xa55c('0x4e')]['id']}},_0x54cbde={};_0x54cbde['model']=_[_0xa55c('0x4f')](db[_0xa55c('0x36')][_0xa55c('0x37')]);_0x44ac57[_0xa55c('0x3e')]=_[_0xa55c('0x3c')](_0x54cbde['model'],qs[_0xa55c('0x3f')](_0x250dea['query'][_0xa55c('0x3f')]));_0x44ac57[_0xa55c('0x3e')]=_0x44ac57[_0xa55c('0x3e')][_0xa55c('0x50')]?_0x44ac57[_0xa55c('0x3e')]:_0x54cbde[_0xa55c('0x39')];if(_0x250dea[_0xa55c('0x3d')]['includeAll']){_0x44ac57[_0xa55c('0x4a')]=[{'all':!![]}];}_0x44ac57=_[_0xa55c('0x46')]({},_0x44ac57,_0x250dea[_0xa55c('0x51')]);return db[_0xa55c('0x36')][_0xa55c('0x52')](_0x44ac57)['then'](handleEntityNotFound(_0x3ca5b8,null))[_0xa55c('0x1a')](function(_0x3cd40d){if(_0x3cd40d){var _0x28bac4=_0x3cd40d[_0xa55c('0x30')]({'plain':!![]});_0x28bac4=qs[_0xa55c('0x54')](_0x28bac4,['id','createdAt',_0xa55c('0x55')]);_0x250dea[_0xa55c('0x56')]=_[_0xa55c('0x54')](_0x250dea[_0xa55c('0x56')],['id',_0xa55c('0x57'),'updatedAt']);return db[_0xa55c('0x36')]['create'](_[_0xa55c('0x46')](_0x28bac4,_0x250dea['body']),{'include':_0x250dea[_0xa55c('0x3d')]['includeAll']?[{'all':!![]}]:undefined})[_0xa55c('0x1a')](function(_0x1333da){var _0x21d6b4=_0x250dea[_0xa55c('0x58')][_0xa55c('0x30')]({'plain':!![]});if(!_0x21d6b4)throw new Error(_0xa55c('0x59'));if(_0x21d6b4[_0xa55c('0x5a')]===_0xa55c('0x58')){var _0x14b515=_0x1333da[_0xa55c('0x30')]({'plain':!![]});var _0x51c736=_0xa55c('0x5b');return db[_0xa55c('0x5c')]['find']({'where':{'name':_0x51c736,'userProfileId':_0x21d6b4[_0xa55c('0x5d')]},'raw':!![]})[_0xa55c('0x1a')](function(_0x3e3b4b){if(_0x3e3b4b&&_0x3e3b4b[_0xa55c('0x5e')]===0x0){return db[_0xa55c('0x31')][_0xa55c('0x5f')]({'name':_0x14b515[_0xa55c('0x34')],'resourceId':_0x14b515['id'],'type':_0x3e3b4b[_0xa55c('0x34')],'sectionId':_0x3e3b4b['id']},{})['then'](function(){return _0x1333da;});}else{return _0x1333da;}})[_0xa55c('0x24')](function(_0x475131){logger[_0xa55c('0x21')](_0xa55c('0x60'),_0x475131);throw _0x475131;});}return _0x1333da;});}})[_0xa55c('0x1a')](respondWithResult(_0x3ca5b8,0xc9))[_0xa55c('0x24')](handleError(_0x3ca5b8,null));};exports[_0xa55c('0x5f')]=function(_0x4249c1,_0x25d5a1,_0x4a08ca){var _0x347562;return db[_0xa55c('0x36')][_0xa55c('0x5f')](_0x4249c1[_0xa55c('0x56')],{'raw':!![]})[_0xa55c('0x1a')](function(_0x10e711){_0x347562=_0x10e711;return db[_0xa55c('0x36')][_0xa55c('0x4b')]({'raw':!![]});})[_0xa55c('0x1a')](function(_0x3178a6){var _0x3bbc4b=fs['readFileSync'](path[_0xa55c('0x61')](config['root'],_0xa55c('0x62')),_0xa55c('0x63'));var _0x129bb4=fs['readFileSync'](path['join'](config[_0xa55c('0x64')],_0xa55c('0x65')),_0xa55c('0x63'));var _0x42529f=ejs['render'](_0x3bbc4b,{'trunks':_0x3178a6||[]});fs[_0xa55c('0x66')](_0xa55c('0x67'),_0x42529f);if(_0x347562[_0xa55c('0x68')]){var _0x3a9910=ejs[_0xa55c('0x69')](_0x129bb4,{'trunks':_0x3178a6||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x3a9910);}})[_0xa55c('0x1a')](function(){return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x5f'),{'module':_0xa55c('0x6b')});})[_0xa55c('0x1a')](function(){var _0x4b2032=_0x4249c1[_0xa55c('0x58')][_0xa55c('0x30')]({'plain':!![]});if(!_0x4b2032)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b2032[_0xa55c('0x5a')]===_0xa55c('0x58')){var _0xa340fb=_0x347562['get']({'plain':!![]});return db[_0xa55c('0x5c')][_0xa55c('0x52')]({'where':{'name':_0xa55c('0x5b'),'userProfileId':_0x4b2032[_0xa55c('0x5d')]},'raw':!![]})[_0xa55c('0x1a')](function(_0x506f74){if(_0x506f74&&_0x506f74[_0xa55c('0x5e')]===0x0){return db[_0xa55c('0x31')]['create']({'name':_0xa340fb['name'],'resourceId':_0xa340fb['id'],'type':_0x506f74[_0xa55c('0x34')],'sectionId':_0x506f74['id']},{})['then'](function(){return _0x347562;});}else{return _0x347562;}})[_0xa55c('0x24')](function(_0x5ca0bc){logger[_0xa55c('0x21')](_0xa55c('0x60'),_0x5ca0bc);throw _0x5ca0bc;});}return _0x347562;})[_0xa55c('0x1a')](respondWithResult(_0x25d5a1,0xc9))[_0xa55c('0x24')](handleError(_0x25d5a1,null));};exports[_0xa55c('0x2e')]=function(_0xff7b1c,_0x16dfc6,_0x5d8551){var _0x463195;return db[_0xa55c('0x36')][_0xa55c('0x52')]({'where':{'id':_0xff7b1c[_0xa55c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x16dfc6,null))[_0xa55c('0x1a')](saveUpdates(_0xff7b1c[_0xa55c('0x56')],null))[_0xa55c('0x1a')](function(_0x2298ac){if(_0x2298ac){_0x463195=_0x2298ac;return db['Trunk']['findAll']({'raw':!![]});}})[_0xa55c('0x1a')](function(_0x428872){if(_0x428872){var _0x12e3a8=fs[_0xa55c('0x6c')](path['join'](config['root'],_0xa55c('0x62')),_0xa55c('0x63'));var _0xd33c9c=fs[_0xa55c('0x6c')](path[_0xa55c('0x61')](config[_0xa55c('0x64')],_0xa55c('0x65')),'utf8');var _0x19497b=ejs['render'](_0x12e3a8,{'trunks':_0x428872||[]});fs[_0xa55c('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x19497b);var _0x36ded7=ejs[_0xa55c('0x69')](_0xd33c9c,{'trunks':_0x428872||[]});fs[_0xa55c('0x66')](_0xa55c('0x6d'),_0x36ded7);return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x2e'),{'module':_0xa55c('0x6b')});}return null;})[_0xa55c('0x1a')](function(_0x576a1b){if(_0x576a1b){return _0x463195;}})['then'](respondWithResult(_0x16dfc6,null))[_0xa55c('0x24')](handleError(_0x16dfc6,null));};exports[_0xa55c('0x2f')]=function(_0xc2ad5c,_0x256db0,_0x1622cb){var _0x137728;return db['Trunk'][_0xa55c('0x52')]({'where':{'id':_0xc2ad5c[_0xa55c('0x4e')]['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x256db0,null))[_0xa55c('0x1a')](removeEntity(_0x256db0,null))[_0xa55c('0x1a')](function(){return db[_0xa55c('0x36')][_0xa55c('0x4b')]({'raw':!![]});})[_0xa55c('0x1a')](function(_0x58b670){var _0x25d09d=fs[_0xa55c('0x6c')](path[_0xa55c('0x61')](config[_0xa55c('0x64')],_0xa55c('0x62')),'utf8');var _0x2685d8=fs[_0xa55c('0x6c')](path['join'](config['root'],_0xa55c('0x65')),_0xa55c('0x63'));var _0x5c2229=ejs['render'](_0x25d09d,{'trunks':_0x58b670});var _0x579726=ejs['render'](_0x2685d8,{'trunks':_0x58b670});fs[_0xa55c('0x66')](_0xa55c('0x67'),_0x5c2229);fs[_0xa55c('0x66')](_0xa55c('0x6d'),_0x579726);return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x2f'),{'module':'chan_sip.so'});})[_0xa55c('0x24')](handleError(_0x256db0,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 4fbfad9..524cfd8 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 _0xff44=['util','api','request-promise','rimraf','./trunk.attributes','exports','Trunk','tools_trunks','lodash'];(function(_0x11a7f3,_0x299f5a){var _0x3d2054=function(_0x57f4bf){while(--_0x57f4bf){_0x11a7f3['push'](_0x11a7f3['shift']());}};_0x3d2054(++_0x299f5a);}(_0xff44,0x182));var _0x4ff4=function(_0x234d56,_0x4eee01){_0x234d56=_0x234d56-0x0;var _0xd47811=_0xff44[_0x234d56];return _0xd47811;};'use strict';var _=require(_0x4ff4('0x0'));var util=require(_0x4ff4('0x1'));var logger=require('../../config/logger')(_0x4ff4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4ff4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4ff4('0x4'));var config=require('../../config/environment');var attributes=require(_0x4ff4('0x5'));module[_0x4ff4('0x6')]=function(_0x273b81,_0x2e1749){return _0x273b81['define'](_0x4ff4('0x7'),attributes,{'tableName':_0x4ff4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe607=['api','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','Trunk','tools_trunks','lodash','util','../../config/logger'];(function(_0x3de147,_0x177956){var _0x2b0851=function(_0x4d1f31){while(--_0x4d1f31){_0x3de147['push'](_0x3de147['shift']());}};_0x2b0851(++_0x177956);}(_0xe607,0x99));var _0x7e60=function(_0x20a74d,_0x223174){_0x20a74d=_0x20a74d-0x0;var _0x17aefb=_0xe607[_0x20a74d];return _0x17aefb;};'use strict';var _=require(_0x7e60('0x0'));var util=require(_0x7e60('0x1'));var logger=require(_0x7e60('0x2'))(_0x7e60('0x3'));var moment=require('moment');var BPromise=require(_0x7e60('0x4'));var rp=require(_0x7e60('0x5'));var fs=require('fs');var path=require(_0x7e60('0x6'));var rimraf=require(_0x7e60('0x7'));var config=require(_0x7e60('0x8'));var attributes=require(_0x7e60('0x9'));module[_0x7e60('0xa')]=function(_0x417965,_0x283b2d){return _0x417965['define'](_0x7e60('0xb'),attributes,{'tableName':_0x7e60('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index c23caf3..c3820cf 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 _0x7515=['jayson/promise','client','request','then','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Trunk,\x20%s,\x20%s','message','info','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','ShowTrunk','find','debug','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x49c27c,_0x3fa21b){var _0x392bf5=function(_0x279aad){while(--_0x279aad){_0x49c27c['push'](_0x49c27c['shift']());}};_0x392bf5(++_0x3fa21b);}(_0x7515,0x82));var _0x5751=function(_0xaff290,_0x2ab600){_0xaff290=_0xaff290-0x0;var _0x476e68=_0x7515[_0xaff290];return _0x476e68;};'use strict';var _=require('lodash');var util=require(_0x5751('0x0'));var moment=require('moment');var BPromise=require(_0x5751('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5751('0x2'));var db=require(_0x5751('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5751('0x4'));var config=require(_0x5751('0x5'));var jayson=require(_0x5751('0x6'));var client=jayson[_0x5751('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x158b1d,_0x20b706,_0x1145ae){return new BPromise(function(_0x37e673,_0x5f02d7){return client[_0x5751('0x8')](_0x158b1d,_0x1145ae)[_0x5751('0x9')](function(_0x14b155){logger['info']('Trunk,\x20%s,\x20%s',_0x20b706,'request\x20sent');logger['debug'](_0x5751('0xa'),_0x20b706,_0x5751('0xb'),JSON[_0x5751('0xc')](_0x14b155));if(_0x14b155['error']){if(_0x14b155[_0x5751('0xd')][_0x5751('0xe')]===0x1f4){logger[_0x5751('0xd')](_0x5751('0xf'),_0x20b706,_0x14b155['error'][_0x5751('0x10')]);return _0x5f02d7(_0x14b155[_0x5751('0xd')][_0x5751('0x10')]);}logger['error'](_0x5751('0xf'),_0x20b706,_0x14b155[_0x5751('0xd')][_0x5751('0x10')]);return _0x37e673(_0x14b155['error']['message']);}else{logger[_0x5751('0x11')]('Trunk,\x20%s,\x20%s',_0x20b706,_0x5751('0xb'));_0x37e673(_0x14b155[_0x5751('0x12')][_0x5751('0x10')]);}})[_0x5751('0x13')](function(_0x19952a){logger[_0x5751('0xd')]('Trunk,\x20%s,\x20%s',_0x20b706,_0x19952a);_0x5f02d7(_0x19952a);});});}exports[_0x5751('0x14')]=function(_0x3219be){var _0x5961af=this;return new Promise(function(_0x2a600d,_0xc4dd3a){return db[_0x5751('0x15')][_0x5751('0x16')]({'raw':_0x3219be[_0x5751('0x17')]?_0x3219be[_0x5751('0x17')][_0x5751('0x18')]===undefined?!![]:![]:!![],'where':_0x3219be[_0x5751('0x17')]?_0x3219be[_0x5751('0x17')][_0x5751('0x19')]||null:null,'attributes':_0x3219be['options']?_0x3219be[_0x5751('0x17')][_0x5751('0x1a')]||null:null,'limit':_0x3219be['options']?_0x3219be[_0x5751('0x17')][_0x5751('0x1b')]||null:null,'include':_0x3219be[_0x5751('0x17')]?_0x3219be[_0x5751('0x17')][_0x5751('0x1c')]?_[_0x5751('0x1d')](_0x3219be[_0x5751('0x17')][_0x5751('0x1c')],function(_0xc47772){return{'model':db[_0xc47772['model']],'as':_0xc47772['as'],'attributes':_0xc47772[_0x5751('0x1a')],'include':_0xc47772[_0x5751('0x1c')]?_[_0x5751('0x1d')](_0xc47772[_0x5751('0x1c')],function(_0x469158){return{'model':db[_0x469158[_0x5751('0x1e')]],'as':_0x469158['as'],'attributes':_0x469158[_0x5751('0x1a')],'include':_0x469158[_0x5751('0x1c')]?_[_0x5751('0x1d')](_0x469158[_0x5751('0x1c')],function(_0xc07dc3){return{'model':db[_0xc07dc3['model']],'as':_0xc07dc3['as'],'attributes':_0xc07dc3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x268b02){logger[_0x5751('0x11')](_0x5751('0x14'),_0x3219be);logger['debug'](_0x5751('0x14'),_0x3219be,JSON['stringify'](_0x268b02));_0x2a600d(_0x268b02);})['catch'](function(_0x463d61){logger[_0x5751('0xd')](_0x5751('0x14'),_0x463d61[_0x5751('0x10')],_0x3219be);_0xc4dd3a(_0x5961af[_0x5751('0xd')](0x1f4,_0x463d61[_0x5751('0x10')]));});});};exports[_0x5751('0x1f')]=function(_0x436728){var _0x529424=this;return new Promise(function(_0x3cc3ee,_0x27b5b5){return db[_0x5751('0x15')][_0x5751('0x20')]({'raw':_0x436728[_0x5751('0x17')]?_0x436728[_0x5751('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x436728[_0x5751('0x17')]?_0x436728[_0x5751('0x17')][_0x5751('0x19')]||null:null,'attributes':_0x436728[_0x5751('0x17')]?_0x436728[_0x5751('0x17')]['attributes']||null:null,'include':_0x436728[_0x5751('0x17')]?_0x436728[_0x5751('0x17')][_0x5751('0x1c')]?_['map'](_0x436728[_0x5751('0x17')][_0x5751('0x1c')],function(_0x38b352){return{'model':db[_0x38b352[_0x5751('0x1e')]],'as':_0x38b352['as'],'attributes':_0x38b352['attributes'],'include':_0x38b352[_0x5751('0x1c')]?_['map'](_0x38b352['include'],function(_0x25e9fd){return{'model':db[_0x25e9fd['model']],'as':_0x25e9fd['as'],'attributes':_0x25e9fd['attributes'],'include':_0x25e9fd[_0x5751('0x1c')]?_[_0x5751('0x1d')](_0x25e9fd[_0x5751('0x1c')],function(_0x5da9a3){return{'model':db[_0x5da9a3[_0x5751('0x1e')]],'as':_0x5da9a3['as'],'attributes':_0x5da9a3[_0x5751('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x58fede){logger[_0x5751('0x11')]('ShowTrunk',_0x436728);logger[_0x5751('0x21')]('ShowTrunk',_0x436728,JSON[_0x5751('0xc')](_0x58fede));_0x3cc3ee(_0x58fede);})[_0x5751('0x13')](function(_0x30570a){logger['error'](_0x5751('0x1f'),_0x30570a[_0x5751('0x10')],_0x436728);_0x27b5b5(_0x529424[_0x5751('0xd')](0x1f4,_0x30570a[_0x5751('0x10')]));});});}; \ No newline at end of file +var _0x0a03=['client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetTrunk','options','raw','attributes','limit','include','map','model','stringify','ShowTrunk','Trunk','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x390878,_0xc01c24){var _0x2938af=function(_0x1fcb7a){while(--_0x1fcb7a){_0x390878['push'](_0x390878['shift']());}};_0x2938af(++_0xc01c24);}(_0x0a03,0x131));var _0x30a0=function(_0x408ca6,_0x5a036){_0x408ca6=_0x408ca6-0x0;var _0x27f3ce=_0x0a03[_0x408ca6];return _0x27f3ce;};'use strict';var _=require(_0x30a0('0x0'));var util=require(_0x30a0('0x1'));var moment=require(_0x30a0('0x2'));var BPromise=require(_0x30a0('0x3'));var rs=require(_0x30a0('0x4'));var fs=require('fs');var Redis=require(_0x30a0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x30a0('0x6'));var logger=require(_0x30a0('0x7'))('rpc');var config=require(_0x30a0('0x8'));var jayson=require(_0x30a0('0x9'));var client=jayson[_0x30a0('0xa')][_0x30a0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3fe40c,_0x3ab731,_0x4d1aea){return new BPromise(function(_0x318750,_0x4f17c2){return client[_0x30a0('0xc')](_0x3fe40c,_0x4d1aea)[_0x30a0('0xd')](function(_0x469da4){logger[_0x30a0('0xe')](_0x30a0('0xf'),_0x3ab731,_0x30a0('0x10'));logger[_0x30a0('0x11')](_0x30a0('0x12'),_0x3ab731,_0x30a0('0x10'),JSON['stringify'](_0x469da4));if(_0x469da4[_0x30a0('0x13')]){if(_0x469da4['error']['code']===0x1f4){logger[_0x30a0('0x13')](_0x30a0('0xf'),_0x3ab731,_0x469da4[_0x30a0('0x13')][_0x30a0('0x14')]);return _0x4f17c2(_0x469da4['error'][_0x30a0('0x14')]);}logger[_0x30a0('0x13')]('Trunk,\x20%s,\x20%s',_0x3ab731,_0x469da4[_0x30a0('0x13')][_0x30a0('0x14')]);return _0x318750(_0x469da4['error'][_0x30a0('0x14')]);}else{logger[_0x30a0('0xe')](_0x30a0('0xf'),_0x3ab731,_0x30a0('0x10'));_0x318750(_0x469da4[_0x30a0('0x15')][_0x30a0('0x14')]);}})[_0x30a0('0x16')](function(_0x15122b){logger[_0x30a0('0x13')](_0x30a0('0xf'),_0x3ab731,_0x15122b);_0x4f17c2(_0x15122b);});});}exports[_0x30a0('0x17')]=function(_0x3ffe1f){var _0x191298=this;return new Promise(function(_0x3452d3,_0x8c1e9e){return db['Trunk']['findAll']({'raw':_0x3ffe1f[_0x30a0('0x18')]?_0x3ffe1f[_0x30a0('0x18')][_0x30a0('0x19')]===undefined?!![]:![]:!![],'where':_0x3ffe1f['options']?_0x3ffe1f[_0x30a0('0x18')]['where']||null:null,'attributes':_0x3ffe1f[_0x30a0('0x18')]?_0x3ffe1f[_0x30a0('0x18')][_0x30a0('0x1a')]||null:null,'limit':_0x3ffe1f[_0x30a0('0x18')]?_0x3ffe1f['options'][_0x30a0('0x1b')]||null:null,'include':_0x3ffe1f['options']?_0x3ffe1f[_0x30a0('0x18')][_0x30a0('0x1c')]?_[_0x30a0('0x1d')](_0x3ffe1f[_0x30a0('0x18')]['include'],function(_0x545a58){return{'model':db[_0x545a58[_0x30a0('0x1e')]],'as':_0x545a58['as'],'attributes':_0x545a58['attributes'],'include':_0x545a58['include']?_[_0x30a0('0x1d')](_0x545a58[_0x30a0('0x1c')],function(_0x41181a){return{'model':db[_0x41181a[_0x30a0('0x1e')]],'as':_0x41181a['as'],'attributes':_0x41181a[_0x30a0('0x1a')],'include':_0x41181a[_0x30a0('0x1c')]?_[_0x30a0('0x1d')](_0x41181a['include'],function(_0x381cb1){return{'model':db[_0x381cb1['model']],'as':_0x381cb1['as'],'attributes':_0x381cb1[_0x30a0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x30a0('0xd')](function(_0x4b6675){logger[_0x30a0('0xe')](_0x30a0('0x17'),_0x3ffe1f);logger['debug'](_0x30a0('0x17'),_0x3ffe1f,JSON[_0x30a0('0x1f')](_0x4b6675));_0x3452d3(_0x4b6675);})[_0x30a0('0x16')](function(_0x407b29){logger[_0x30a0('0x13')](_0x30a0('0x17'),_0x407b29[_0x30a0('0x14')],_0x3ffe1f);_0x8c1e9e(_0x191298[_0x30a0('0x13')](0x1f4,_0x407b29[_0x30a0('0x14')]));});});};exports[_0x30a0('0x20')]=function(_0x5ac1a1){var _0x14f52c=this;return new Promise(function(_0x1dda6f,_0x45f80f){return db[_0x30a0('0x21')][_0x30a0('0x22')]({'raw':_0x5ac1a1[_0x30a0('0x18')]?_0x5ac1a1['options']['raw']===undefined?!![]:![]:!![],'where':_0x5ac1a1[_0x30a0('0x18')]?_0x5ac1a1[_0x30a0('0x18')]['where']||null:null,'attributes':_0x5ac1a1[_0x30a0('0x18')]?_0x5ac1a1[_0x30a0('0x18')]['attributes']||null:null,'include':_0x5ac1a1['options']?_0x5ac1a1[_0x30a0('0x18')][_0x30a0('0x1c')]?_[_0x30a0('0x1d')](_0x5ac1a1[_0x30a0('0x18')]['include'],function(_0x5a45eb){return{'model':db[_0x5a45eb[_0x30a0('0x1e')]],'as':_0x5a45eb['as'],'attributes':_0x5a45eb[_0x30a0('0x1a')],'include':_0x5a45eb['include']?_[_0x30a0('0x1d')](_0x5a45eb[_0x30a0('0x1c')],function(_0x1c685f){return{'model':db[_0x1c685f[_0x30a0('0x1e')]],'as':_0x1c685f['as'],'attributes':_0x1c685f[_0x30a0('0x1a')],'include':_0x1c685f[_0x30a0('0x1c')]?_[_0x30a0('0x1d')](_0x1c685f[_0x30a0('0x1c')],function(_0x5e251b){return{'model':db[_0x5e251b['model']],'as':_0x5e251b['as'],'attributes':_0x5e251b[_0x30a0('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29f3a6){logger['info'](_0x30a0('0x20'),_0x5ac1a1);logger[_0x30a0('0x11')]('ShowTrunk',_0x5ac1a1,JSON['stringify'](_0x29f3a6));_0x1dda6f(_0x29f3a6);})['catch'](function(_0x1b0e5b){logger['error'](_0x30a0('0x20'),_0x1b0e5b[_0x30a0('0x14')],_0x5ac1a1);_0x45f80f(_0x14f52c[_0x30a0('0x13')](0x1f4,_0x1b0e5b[_0x30a0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index d90b63a..c7bd306 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 _0x7dac=['/:id/scheduled_calls','getScheduledCalls','getApiKey','post','/:id/contacts','addContacts','/create_many','bulkCreate','/:id/queues','addQueues','diskStorage','join','format','now','originalname','single','addAvatar','/:id/login','login','logout','/:id/pause','pause','/:id/unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/openchannel_accounts','/:id/sms_accounts','addSmsAccounts','addWhatsappAccounts','addSquareProjects','/:id/api_key','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeOpenchannelAccounts','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','isAuthenticated','/describe','describe','whoami','getPresence','/:id','/:id/avatar','getAvatar','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','getSquareProjects'];(function(_0x12e9de,_0x30269d){var _0x3017d2=function(_0x37b27e){while(--_0x37b27e){_0x12e9de['push'](_0x12e9de['shift']());}};_0x3017d2(++_0x30269d);}(_0x7dac,0x126));var _0xc7da=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x7dac[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0xc7da('0x0'));var util=require(_0xc7da('0x1'));var path=require('path');var timeout=require(_0xc7da('0x2'));var express=require(_0xc7da('0x3'));var router=express[_0xc7da('0x4')]();var fs_extra=require(_0xc7da('0x5'));var auth=require(_0xc7da('0x6'));var interaction=require(_0xc7da('0x7'));var config=require(_0xc7da('0x8'));var controller=require(_0xc7da('0x9'));router[_0xc7da('0xa')]('/',auth[_0xc7da('0xb')](),controller['index']);router[_0xc7da('0xa')](_0xc7da('0xc'),auth[_0xc7da('0xb')](),controller[_0xc7da('0xd')]);router['get']('/whoami',auth['isAuthenticated'](),controller[_0xc7da('0xe')]);router[_0xc7da('0xa')]('/presence',auth[_0xc7da('0xb')](),controller[_0xc7da('0xf')]);router['get'](_0xc7da('0x10'),auth['isAuthenticated'](),controller['show']);router[_0xc7da('0xa')](_0xc7da('0x11'),controller[_0xc7da('0x12')]);router['get']('/:id/open_tabs',auth[_0xc7da('0xb')](),controller['getOpenTabs']);router[_0xc7da('0xa')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xc7da('0x13')]);router[_0xc7da('0xa')]('/:id/queues',auth[_0xc7da('0xb')](),controller[_0xc7da('0x14')]);router[_0xc7da('0xa')](_0xc7da('0x15'),auth['isAuthenticated'](),controller[_0xc7da('0x16')]);router[_0xc7da('0xa')](_0xc7da('0x17'),auth['isAuthenticated'](),controller[_0xc7da('0x18')]);router[_0xc7da('0xa')](_0xc7da('0x19'),auth['isAuthenticated'](),controller[_0xc7da('0x1a')]);router[_0xc7da('0xa')](_0xc7da('0x1b'),auth['isAuthenticated'](),controller[_0xc7da('0x1c')]);router[_0xc7da('0xa')](_0xc7da('0x1d'),auth[_0xc7da('0xb')](),controller[_0xc7da('0x1e')]);router[_0xc7da('0xa')]('/:id/openchannel/interactions',auth[_0xc7da('0xb')](),controller[_0xc7da('0x1f')]);router[_0xc7da('0xa')](_0xc7da('0x20'),auth['isAuthenticated'](),controller['getMailInteractions']);router['get'](_0xc7da('0x21'),auth[_0xc7da('0xb')](),controller[_0xc7da('0x22')]);router[_0xc7da('0xa')](_0xc7da('0x23'),auth[_0xc7da('0xb')](),controller[_0xc7da('0x24')]);router[_0xc7da('0xa')](_0xc7da('0x25'),auth[_0xc7da('0xb')](),controller[_0xc7da('0x26')]);router[_0xc7da('0xa')](_0xc7da('0x27'),auth[_0xc7da('0xb')](),controller[_0xc7da('0x28')]);router['get']('/:id/lists',auth['isAuthenticated'](),controller['getLists']);router['get'](_0xc7da('0x29'),auth[_0xc7da('0xb')](),controller['getAgents']);router[_0xc7da('0xa')](_0xc7da('0x2a'),auth['isAuthenticated'](),controller[_0xc7da('0x2b')]);router['get'](_0xc7da('0x2c'),auth['isAuthenticated'](),controller[_0xc7da('0x2d')]);router['get'](_0xc7da('0x2e'),auth['isAuthenticated'](),controller['getMailAccounts']);router[_0xc7da('0xa')]('/:id/openchannel_accounts',auth[_0xc7da('0xb')](),controller[_0xc7da('0x2f')]);router[_0xc7da('0xa')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0xc7da('0x30')]);router['get'](_0xc7da('0x31'),auth[_0xc7da('0xb')](),controller[_0xc7da('0x32')]);router[_0xc7da('0xa')](_0xc7da('0x33'),auth[_0xc7da('0xb')](),controller['getWhatsappAccounts']);router[_0xc7da('0xa')](_0xc7da('0x34'),auth[_0xc7da('0xb')](),controller[_0xc7da('0x35')]);router[_0xc7da('0xa')](_0xc7da('0x36'),auth[_0xc7da('0xb')](),controller[_0xc7da('0x37')]);router['get']('/:id/api_key',auth[_0xc7da('0xb')](),controller[_0xc7da('0x38')]);router[_0xc7da('0x39')](_0xc7da('0x3a'),auth[_0xc7da('0xb')](),controller[_0xc7da('0x3b')]);router['post']('/',auth[_0xc7da('0xb')](),controller['create']);router[_0xc7da('0x39')](_0xc7da('0x3c'),auth[_0xc7da('0xb')](),controller[_0xc7da('0x3d')]);router[_0xc7da('0x39')](_0xc7da('0x3e'),auth[_0xc7da('0xb')](),controller[_0xc7da('0x3f')]);var upload=multer({'storage':multer[_0xc7da('0x40')]({'destination':function(_0x58f61d,_0x1659f0,_0x10a3f2){_0x10a3f2(null,path[_0xc7da('0x41')](config['root'],'server/files/images/'));},'filename':function(_0x22bbb8,_0x36bef1,_0x17cc54){_0x17cc54(null,util[_0xc7da('0x42')]('%s-%s',Date[_0xc7da('0x43')](),_0x36bef1[_0xc7da('0x44')]));}})});router[_0xc7da('0x39')]('/:id/avatar',upload[_0xc7da('0x45')]('file'),controller[_0xc7da('0x46')]);router[_0xc7da('0x39')](_0xc7da('0x47'),auth[_0xc7da('0xb')](),controller[_0xc7da('0x48')]);router['post']('/:id/logout',auth[_0xc7da('0xb')](),controller[_0xc7da('0x49')]);router[_0xc7da('0x39')](_0xc7da('0x4a'),auth[_0xc7da('0xb')](),controller[_0xc7da('0x4b')]);router[_0xc7da('0x39')](_0xc7da('0x4c'),auth['isAuthenticated'](),controller['unpause']);router[_0xc7da('0x39')](_0xc7da('0x27'),auth[_0xc7da('0xb')](),controller['addTeams']);router['post'](_0xc7da('0x4d'),auth[_0xc7da('0xb')](),controller[_0xc7da('0x4e')]);router[_0xc7da('0x39')](_0xc7da('0x4f'),auth['isAuthenticated'](),controller[_0xc7da('0x50')]);router[_0xc7da('0x39')](_0xc7da('0x51'),auth[_0xc7da('0xb')](),controller[_0xc7da('0x52')]);router[_0xc7da('0x39')](_0xc7da('0x53'),auth['isAuthenticated'](),controller[_0xc7da('0x54')]);router['post'](_0xc7da('0x55'),auth[_0xc7da('0xb')](),controller['addOpenchannelInteractions']);router[_0xc7da('0x39')](_0xc7da('0x56'),auth['isAuthenticated'](),controller[_0xc7da('0x57')]);router[_0xc7da('0x39')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xc7da('0x58')]);router[_0xc7da('0x39')](_0xc7da('0x2e'),auth[_0xc7da('0xb')](),controller['addMailAccounts']);router[_0xc7da('0x39')](_0xc7da('0x59'),auth[_0xc7da('0xb')](),controller['addOpenchannelAccounts']);router[_0xc7da('0x39')](_0xc7da('0x5a'),auth[_0xc7da('0xb')](),controller[_0xc7da('0x5b')]);router[_0xc7da('0x39')]('/:id/chat_websites',auth[_0xc7da('0xb')](),controller['addChatWebsites']);router[_0xc7da('0x39')](_0xc7da('0x33'),auth['isAuthenticated'](),controller[_0xc7da('0x5c')]);router[_0xc7da('0x39')](_0xc7da('0x34'),auth[_0xc7da('0xb')](),controller[_0xc7da('0x5d')]);router[_0xc7da('0x39')](_0xc7da('0x5e'),auth['isAuthenticated'](),controller[_0xc7da('0x5f')]);router[_0xc7da('0x60')](_0xc7da('0x10'),auth[_0xc7da('0xb')](),controller[_0xc7da('0x61')]);router[_0xc7da('0x60')](_0xc7da('0x62'),auth[_0xc7da('0xb')](),controller[_0xc7da('0x63')]);router[_0xc7da('0x64')](_0xc7da('0x3e'),auth[_0xc7da('0xb')](),controller[_0xc7da('0x65')]);router[_0xc7da('0x64')](_0xc7da('0x27'),auth[_0xc7da('0xb')](),controller[_0xc7da('0x66')]);router[_0xc7da('0x64')](_0xc7da('0x10'),auth[_0xc7da('0xb')](),controller[_0xc7da('0x67')]);router[_0xc7da('0x64')]('/:id/chat_interactions',auth[_0xc7da('0xb')](),controller['removeChatInteractions']);router[_0xc7da('0x64')](_0xc7da('0x4f'),auth[_0xc7da('0xb')](),controller[_0xc7da('0x68')]);router[_0xc7da('0x64')](_0xc7da('0x51'),auth['isAuthenticated'](),controller[_0xc7da('0x69')]);router[_0xc7da('0x64')](_0xc7da('0x53'),auth[_0xc7da('0xb')](),controller[_0xc7da('0x6a')]);router[_0xc7da('0x64')]('/:id/openchannel_interactions',auth[_0xc7da('0xb')](),controller[_0xc7da('0x6b')]);router[_0xc7da('0x64')](_0xc7da('0x56'),auth['isAuthenticated'](),controller[_0xc7da('0x6c')]);router[_0xc7da('0x64')](_0xc7da('0x2c'),auth[_0xc7da('0xb')](),controller['removeFaxAccounts']);router['delete'](_0xc7da('0x2e'),auth[_0xc7da('0xb')](),controller['removeMailAccounts']);router[_0xc7da('0x64')](_0xc7da('0x59'),auth['isAuthenticated'](),controller[_0xc7da('0x6d')]);router[_0xc7da('0x64')](_0xc7da('0x5a'),auth['isAuthenticated'](),controller[_0xc7da('0x6e')]);router[_0xc7da('0x64')](_0xc7da('0x31'),auth[_0xc7da('0xb')](),controller[_0xc7da('0x6f')]);router[_0xc7da('0x64')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0xc7da('0x70')]);router[_0xc7da('0x64')](_0xc7da('0x34'),auth['isAuthenticated'](),controller[_0xc7da('0x71')]);router[_0xc7da('0x64')](_0xc7da('0x5e'),auth[_0xc7da('0xb')](),controller[_0xc7da('0x72')]);module[_0xc7da('0x73')]=router; \ No newline at end of file +var _0xe794=['removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','express','fs-extra','get','index','/describe','isAuthenticated','describe','/whoami','show','/:id/avatar','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','getLists','/:id/agents','getAgents','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','addContacts','create','bulkCreate','root','server/files/images/','single','/:id/login','login','/:id/logout','logout','/:id/pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addSquareProjects','createApiKey','put','/:id','update','/:id/password','changePassword','delete','removeTeams','destroy','removeFaxInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','/:id/whatsapp_interactions'];(function(_0x78dc7e,_0x286e20){var _0x101081=function(_0x127f89){while(--_0x127f89){_0x78dc7e['push'](_0x78dc7e['shift']());}};_0x101081(++_0x286e20);}(_0xe794,0xe0));var _0x4e79=function(_0x36c144,_0x5391f5){_0x36c144=_0x36c144-0x0;var _0x3dae5d=_0xe794[_0x36c144];return _0x3dae5d;};'use strict';var multer=require(_0x4e79('0x0'));var util=require(_0x4e79('0x1'));var path=require(_0x4e79('0x2'));var timeout=require(_0x4e79('0x3'));var express=require(_0x4e79('0x4'));var router=express['Router']();var fs_extra=require(_0x4e79('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./user.controller');router[_0x4e79('0x6')]('/',auth['isAuthenticated'](),controller[_0x4e79('0x7')]);router['get'](_0x4e79('0x8'),auth[_0x4e79('0x9')](),controller[_0x4e79('0xa')]);router['get'](_0x4e79('0xb'),auth['isAuthenticated'](),controller['whoami']);router[_0x4e79('0x6')]('/presence',auth['isAuthenticated'](),controller['getPresence']);router['get']('/:id',auth[_0x4e79('0x9')](),controller[_0x4e79('0xc')]);router[_0x4e79('0x6')](_0x4e79('0xd'),controller['getAvatar']);router['get']('/:id/open_tabs',auth['isAuthenticated'](),controller[_0x4e79('0xe')]);router[_0x4e79('0x6')](_0x4e79('0xf'),auth[_0x4e79('0x9')](),controller[_0x4e79('0x10')]);router['get'](_0x4e79('0x11'),auth[_0x4e79('0x9')](),controller[_0x4e79('0x12')]);router['get']('/:id/queues_rt',auth[_0x4e79('0x9')](),controller[_0x4e79('0x13')]);router[_0x4e79('0x6')]('/:id/groups',auth[_0x4e79('0x9')](),controller[_0x4e79('0x14')]);router[_0x4e79('0x6')]('/:id/recordings',auth[_0x4e79('0x9')](),controller[_0x4e79('0x15')]);router['get'](_0x4e79('0x16'),auth['isAuthenticated'](),controller[_0x4e79('0x17')]);router[_0x4e79('0x6')](_0x4e79('0x18'),auth[_0x4e79('0x9')](),controller[_0x4e79('0x19')]);router['get'](_0x4e79('0x1a'),auth[_0x4e79('0x9')](),controller[_0x4e79('0x1b')]);router['get'](_0x4e79('0x1c'),auth[_0x4e79('0x9')](),controller[_0x4e79('0x1d')]);router[_0x4e79('0x6')](_0x4e79('0x1e'),auth['isAuthenticated'](),controller['getSmsInteractions']);router[_0x4e79('0x6')]('/:id/fax/interactions',auth[_0x4e79('0x9')](),controller[_0x4e79('0x1f')]);router['get']('/:id/whatsapp/interactions',auth[_0x4e79('0x9')](),controller[_0x4e79('0x20')]);router['get'](_0x4e79('0x21'),auth['isAuthenticated'](),controller[_0x4e79('0x22')]);router['get']('/:id/lists',auth[_0x4e79('0x9')](),controller[_0x4e79('0x23')]);router[_0x4e79('0x6')](_0x4e79('0x24'),auth[_0x4e79('0x9')](),controller[_0x4e79('0x25')]);router[_0x4e79('0x6')]('/:id/prefixes',auth[_0x4e79('0x9')](),controller[_0x4e79('0x26')]);router[_0x4e79('0x6')]('/:id/fax_accounts',auth[_0x4e79('0x9')](),controller[_0x4e79('0x27')]);router[_0x4e79('0x6')](_0x4e79('0x28'),auth[_0x4e79('0x9')](),controller[_0x4e79('0x29')]);router['get'](_0x4e79('0x2a'),auth[_0x4e79('0x9')](),controller[_0x4e79('0x2b')]);router[_0x4e79('0x6')](_0x4e79('0x2c'),auth[_0x4e79('0x9')](),controller[_0x4e79('0x2d')]);router[_0x4e79('0x6')](_0x4e79('0x2e'),auth[_0x4e79('0x9')](),controller['getChatWebsites']);router[_0x4e79('0x6')](_0x4e79('0x2f'),auth[_0x4e79('0x9')](),controller[_0x4e79('0x30')]);router[_0x4e79('0x6')](_0x4e79('0x31'),auth['isAuthenticated'](),controller[_0x4e79('0x32')]);router[_0x4e79('0x6')](_0x4e79('0x33'),auth['isAuthenticated'](),controller[_0x4e79('0x34')]);router[_0x4e79('0x6')](_0x4e79('0x35'),auth[_0x4e79('0x9')](),controller['getApiKey']);router[_0x4e79('0x36')]('/:id/contacts',auth[_0x4e79('0x9')](),controller[_0x4e79('0x37')]);router[_0x4e79('0x36')]('/',auth['isAuthenticated'](),controller[_0x4e79('0x38')]);router[_0x4e79('0x36')]('/create_many',auth[_0x4e79('0x9')](),controller[_0x4e79('0x39')]);router['post'](_0x4e79('0x11'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x25d468,_0x11c2c9,_0x4a7cec){_0x4a7cec(null,path['join'](config[_0x4e79('0x3a')],_0x4e79('0x3b')));},'filename':function(_0x51e12f,_0x2eb247,_0x15459d){_0x15459d(null,util['format']('%s-%s',Date['now'](),_0x2eb247['originalname']));}})});router[_0x4e79('0x36')]('/:id/avatar',upload[_0x4e79('0x3c')]('file'),controller['addAvatar']);router[_0x4e79('0x36')](_0x4e79('0x3d'),auth[_0x4e79('0x9')](),controller[_0x4e79('0x3e')]);router['post'](_0x4e79('0x3f'),auth[_0x4e79('0x9')](),controller[_0x4e79('0x40')]);router[_0x4e79('0x36')](_0x4e79('0x41'),auth[_0x4e79('0x9')](),controller['pause']);router[_0x4e79('0x36')]('/:id/unpause',auth[_0x4e79('0x9')](),controller[_0x4e79('0x42')]);router[_0x4e79('0x36')](_0x4e79('0x21'),auth['isAuthenticated'](),controller[_0x4e79('0x43')]);router[_0x4e79('0x36')](_0x4e79('0x44'),auth[_0x4e79('0x9')](),controller[_0x4e79('0x45')]);router[_0x4e79('0x36')](_0x4e79('0x46'),auth['isAuthenticated'](),controller[_0x4e79('0x47')]);router[_0x4e79('0x36')](_0x4e79('0x48'),auth[_0x4e79('0x9')](),controller[_0x4e79('0x49')]);router[_0x4e79('0x36')](_0x4e79('0x4a'),auth['isAuthenticated'](),controller[_0x4e79('0x4b')]);router[_0x4e79('0x36')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller['addOpenchannelInteractions']);router[_0x4e79('0x36')]('/:id/whatsapp_interactions',auth[_0x4e79('0x9')](),controller[_0x4e79('0x4c')]);router[_0x4e79('0x36')](_0x4e79('0x4d'),auth[_0x4e79('0x9')](),controller[_0x4e79('0x4e')]);router[_0x4e79('0x36')]('/:id/mail_accounts',auth[_0x4e79('0x9')](),controller[_0x4e79('0x4f')]);router['post'](_0x4e79('0x2a'),auth[_0x4e79('0x9')](),controller[_0x4e79('0x50')]);router[_0x4e79('0x36')](_0x4e79('0x2c'),auth[_0x4e79('0x9')](),controller[_0x4e79('0x51')]);router[_0x4e79('0x36')](_0x4e79('0x2e'),auth[_0x4e79('0x9')](),controller[_0x4e79('0x52')]);router['post'](_0x4e79('0x2f'),auth['isAuthenticated'](),controller['addWhatsappAccounts']);router[_0x4e79('0x36')](_0x4e79('0x31'),auth[_0x4e79('0x9')](),controller[_0x4e79('0x53')]);router[_0x4e79('0x36')](_0x4e79('0x35'),auth[_0x4e79('0x9')](),controller[_0x4e79('0x54')]);router[_0x4e79('0x55')](_0x4e79('0x56'),auth['isAuthenticated'](),controller[_0x4e79('0x57')]);router[_0x4e79('0x55')](_0x4e79('0x58'),auth[_0x4e79('0x9')](),controller[_0x4e79('0x59')]);router[_0x4e79('0x5a')](_0x4e79('0x11'),auth[_0x4e79('0x9')](),controller['removeQueues']);router[_0x4e79('0x5a')](_0x4e79('0x21'),auth[_0x4e79('0x9')](),controller[_0x4e79('0x5b')]);router[_0x4e79('0x5a')](_0x4e79('0x56'),auth[_0x4e79('0x9')](),controller[_0x4e79('0x5c')]);router[_0x4e79('0x5a')](_0x4e79('0x44'),auth['isAuthenticated'](),controller['removeChatInteractions']);router[_0x4e79('0x5a')](_0x4e79('0x46'),auth[_0x4e79('0x9')](),controller['removeMailInteractions']);router[_0x4e79('0x5a')](_0x4e79('0x48'),auth[_0x4e79('0x9')](),controller[_0x4e79('0x5d')]);router['delete'](_0x4e79('0x4a'),auth[_0x4e79('0x9')](),controller['removeSmsInteractions']);router[_0x4e79('0x5a')](_0x4e79('0x5e'),auth[_0x4e79('0x9')](),controller[_0x4e79('0x5f')]);router[_0x4e79('0x5a')](_0x4e79('0x60'),auth[_0x4e79('0x9')](),controller[_0x4e79('0x61')]);router[_0x4e79('0x5a')](_0x4e79('0x4d'),auth[_0x4e79('0x9')](),controller[_0x4e79('0x62')]);router['delete'](_0x4e79('0x28'),auth[_0x4e79('0x9')](),controller[_0x4e79('0x63')]);router[_0x4e79('0x5a')](_0x4e79('0x2a'),auth[_0x4e79('0x9')](),controller[_0x4e79('0x64')]);router[_0x4e79('0x5a')](_0x4e79('0x2c'),auth['isAuthenticated'](),controller[_0x4e79('0x65')]);router[_0x4e79('0x5a')](_0x4e79('0x2e'),auth['isAuthenticated'](),controller[_0x4e79('0x66')]);router['delete'](_0x4e79('0x2f'),auth[_0x4e79('0x9')](),controller[_0x4e79('0x67')]);router[_0x4e79('0x5a')]('/:id/square_projects',auth[_0x4e79('0x9')](),controller[_0x4e79('0x68')]);router[_0x4e79('0x5a')](_0x4e79('0x35'),auth[_0x4e79('0x9')](),controller[_0x4e79('0x69')]);module[_0x4e79('0x6a')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index e0cc769..200800a 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 _0xb7ac=['accept','originate','uac','uas','certificate','active','passive','actpass','update,nonat','TEXT','showWebBar','get','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','rtcp_mux','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blockedAt','UNSIGNED','sequelize','moment','util','lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM','admin','agent','telephone','local','INTEGER','callerid','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','user','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','auto','nonat','update','yes','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always'];(function(_0x3e4bf3,_0x5ec836){var _0x29b3f9=function(_0x310696){while(--_0x310696){_0x3e4bf3['push'](_0x3e4bf3['shift']());}};_0x29b3f9(++_0x5ec836);}(_0xb7ac,0x18a));var _0xcb7a=function(_0xfd2d0b,_0xdb5e6){_0xfd2d0b=_0xfd2d0b-0x0;var _0xb901fe=_0xb7ac[_0xfd2d0b];return _0xb901fe;};'use strict';var Sequelize=require(_0xcb7a('0x0'));var moment=require(_0xcb7a('0x1'));var util=require(_0xcb7a('0x2'));var _=require(_0xcb7a('0x3'));module[_0xcb7a('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xcb7a('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4817ac){this[_0xcb7a('0x6')](_0xcb7a('0x5'),_0x4817ac);this['setDataValue'](_0xcb7a('0x7'),_0x4817ac);},'comment':_0xcb7a('0x8')},'fullname':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':![],'set':function(_0x4fe4a9){this['setDataValue'](_0xcb7a('0xa'),_0x4fe4a9);this[_0xcb7a('0x6')]('callerid',util[_0xcb7a('0xb')](_0xcb7a('0xc'),_0x4fe4a9,this[_0xcb7a('0xd')](_0xcb7a('0xe'))));}},'alias':{'type':Sequelize[_0xcb7a('0x9')]},'email':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x39742a){if(_0x39742a){this[_0xcb7a('0x6')](_0xcb7a('0xf'),_0x39742a['toLowerCase']());}}},'role':{'type':Sequelize[_0xcb7a('0x10')](_0xcb7a('0x11'),'user',_0xcb7a('0x12'),_0xcb7a('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xcb7a('0x9')],'defaultValue':_0xcb7a('0x14')},'internal':{'type':Sequelize[_0xcb7a('0x15')](0xb),'allowNull':![],'unique':_0xcb7a('0xe'),'set':function(_0x1050ca){this[_0xcb7a('0x6')]('internal',_0x1050ca);this[_0xcb7a('0x6')]('accountcode',_0x1050ca);this[_0xcb7a('0x6')](_0xcb7a('0x16'),util[_0xcb7a('0xb')](_0xcb7a('0xc'),this['getDataValue'](_0xcb7a('0xa')),_0x1050ca));}},'salt':{'type':Sequelize[_0xcb7a('0x9')]},'phone':{'type':Sequelize[_0xcb7a('0x9')]},'mobile':{'type':Sequelize[_0xcb7a('0x9')]},'address':{'type':Sequelize[_0xcb7a('0x9')]},'zipcode':{'type':Sequelize[_0xcb7a('0x9')]},'userpic':{'type':Sequelize[_0xcb7a('0x9')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xcb7a('0x9')]},'online':{'type':Sequelize[_0xcb7a('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xcb7a('0x18')]},'voicePause':{'type':Sequelize[_0xcb7a('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xcb7a('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xcb7a('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xcb7a('0x9')],'defaultValue':_0xcb7a('0x19')},'lastPauseAt':{'type':Sequelize[_0xcb7a('0x18')]},'chatCapacity':{'type':Sequelize[_0xcb7a('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xcb7a('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xcb7a('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xcb7a('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xcb7a('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xcb7a('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xcb7a('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xcb7a('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xcb7a('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xcb7a('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xcb7a('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'host':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![],'defaultValue':_0xcb7a('0x1a')},'ipaddr':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xcb7a('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xcb7a('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xcb7a('0x10')](_0xcb7a('0x1b'),_0xcb7a('0x1c'),'peer'),'allowNull':!![],'defaultValue':_0xcb7a('0x1b')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xcb7a('0x1d')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0xcb7a('0x1e'),_0xcb7a('0x1f'),_0xcb7a('0x20'),_0xcb7a('0x21'),_0xcb7a('0x22'),'PROHIB_FAILED_SCREEN',_0xcb7a('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'permit':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'secret':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'transport':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![],'defaultValue':_0xcb7a('0x24'),'set':function(_0x3bb4f6){this[_0xcb7a('0x6')](_0xcb7a('0x25'),_0x3bb4f6?_0x3bb4f6[_0xcb7a('0x26')](','):null);},'get':function(){return this[_0xcb7a('0xd')]('transport')?this[_0xcb7a('0xd')]('transport')[_0xcb7a('0x27')](','):null;},'comment':_0xcb7a('0x28')},'dtmfmode':{'type':Sequelize[_0xcb7a('0x10')](_0xcb7a('0x29'),'info',_0xcb7a('0x2a'),'inband',_0xcb7a('0x2b')),'allowNull':!![],'defaultValue':_0xcb7a('0x29')},'directmedia':{'type':Sequelize[_0xcb7a('0x10')]('yes','no',_0xcb7a('0x2c'),_0xcb7a('0x2d'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xcb7a('0x10')](_0xcb7a('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xcb7a('0x2f'),'set':function(_0x44a961){this[_0xcb7a('0x6')]('nat',_0x44a961?_0x44a961[_0xcb7a('0x26')](','):null);},'get':function(){return this[_0xcb7a('0xd')](_0xcb7a('0x30'))?this[_0xcb7a('0xd')](_0xcb7a('0x30'))[_0xcb7a('0x27')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xcb7a('0x9')]},'namedcallgroup':{'type':Sequelize[_0xcb7a('0x9')]},'pickupgroup':{'type':Sequelize[_0xcb7a('0x9')]},'namedpickupgroup':{'type':Sequelize[_0xcb7a('0x9')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xcb7a('0x9')]},'disallow':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':![],'defaultValue':_0xcb7a('0x31')},'allow':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':![],'defaultValue':_0xcb7a('0x32'),'set':function(_0x52c756){this[_0xcb7a('0x6')](_0xcb7a('0x33'),_0x52c756?_0x52c756[_0xcb7a('0x26')](';'):_0xcb7a('0x32'));},'get':function(){return this[_0xcb7a('0xd')]('allow')?this['getDataValue']('allow')[_0xcb7a('0x27')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xcb7a('0x10')](_0xcb7a('0x2e'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![],'set':function(_0x5c8e1b){this[_0xcb7a('0x6')](_0xcb7a('0x34'),_0x5c8e1b?_0x5c8e1b[_0xcb7a('0x26')](','):null);},'get':function(){return this[_0xcb7a('0xd')]('insecure')?this[_0xcb7a('0xd')](_0xcb7a('0x34'))[_0xcb7a('0x27')](','):null;},'comment':_0xcb7a('0x35')},'trustrpid':{'type':Sequelize['ENUM'](_0xcb7a('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xcb7a('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xcb7a('0x10')]('yes','no',_0xcb7a('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xcb7a('0x2e'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xcb7a('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xcb7a('0x10')](_0xcb7a('0x2e'),'no'),'allowNull':!![],'defaultValue':_0xcb7a('0x2e')},'busylevel':{'type':Sequelize[_0xcb7a('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0xcb7a('0x2e'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xcb7a('0x2e'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xcb7a('0x10')](_0xcb7a('0x2e'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xcb7a('0x10')](_0xcb7a('0x2e'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'template':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xcb7a('0x10')](_0xcb7a('0x2e'),'no',_0xcb7a('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xcb7a('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xcb7a('0x10')](_0xcb7a('0x2e'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xcb7a('0x10')](_0xcb7a('0x38'),'refuse',_0xcb7a('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xcb7a('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xcb7a('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xcb7a('0x10')](_0xcb7a('0x3a'),_0xcb7a('0x3b')),'allowNull':!![],'defaultValue':_0xcb7a('0x3b')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xcb7a('0x10')](_0xcb7a('0x2e'),'no'),'allowNull':!![],'defaultValue':_0xcb7a('0x2e')},'keepalive':{'type':Sequelize[_0xcb7a('0x15')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xcb7a('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xcb7a('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xcb7a('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xcb7a('0x10')](_0xcb7a('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xcb7a('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xcb7a('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xcb7a('0x10')](_0xcb7a('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xcb7a('0x10')](_0xcb7a('0x2e'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0xcb7a('0x2e'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xcb7a('0x10')](_0xcb7a('0x2e'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xcb7a('0x10')](_0xcb7a('0x2e'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xcb7a('0x10')](_0xcb7a('0x2e'),'no','fingerprint',_0xcb7a('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xcb7a('0x10')](_0xcb7a('0x3d'),_0xcb7a('0x3e'),_0xcb7a('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0xcb7a('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xcb7a('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xcb7a('0x2e'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xcb7a('0x2e'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xcb7a('0x10')](_0xcb7a('0x2e'),'no',_0xcb7a('0x2c'),_0xcb7a('0x2d'),_0xcb7a('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0xcb7a('0x18')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xcb7a('0x41')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x3a64b6){this[_0xcb7a('0x6')](_0xcb7a('0x42'),_0x3a64b6);var _0x213b84=this[_0xcb7a('0x43')]({'plain':!![]});switch(_0x3a64b6){case 0x0:case 0x1:var _0x5128b7=_0x213b84[_0xcb7a('0x25')]?_['isArray'](_0x213b84[_0xcb7a('0x25')])?_0x213b84[_0xcb7a('0x25')][_0xcb7a('0x26')]():_0x213b84[_0xcb7a('0x25')]:'udp';if(_0x5128b7===_0xcb7a('0x44')){_0x5128b7='udp';}this[_0xcb7a('0x6')]('transport',_0x5128b7);this[_0xcb7a('0x6')](_0xcb7a('0x45'),'no');this['setDataValue'](_0xcb7a('0x46'),null);this[_0xcb7a('0x6')](_0xcb7a('0x47'),null);this[_0xcb7a('0x6')](_0xcb7a('0x48'),null);this['setDataValue'](_0xcb7a('0x49'),null);this[_0xcb7a('0x6')](_0xcb7a('0x4a'),null);this[_0xcb7a('0x6')](_0xcb7a('0x4b'),null);this[_0xcb7a('0x6')]('dtlscertfile',null);this['setDataValue']('dtlsprivatekey',null);this['setDataValue'](_0xcb7a('0x4c'),'no');break;case 0x2:this['setDataValue']('transport',_0xcb7a('0x44'));this[_0xcb7a('0x6')](_0xcb7a('0x45'),'yes');this[_0xcb7a('0x6')]('avpf',_0xcb7a('0x2e'));this['setDataValue']('force_avp',_0xcb7a('0x2e'));this['setDataValue']('icesupport','yes');this[_0xcb7a('0x6')]('dtlsenable',_0xcb7a('0x2e'));this['setDataValue'](_0xcb7a('0x4a'),'no');this['setDataValue'](_0xcb7a('0x4b'),_0xcb7a('0x3f'));this[_0xcb7a('0x6')](_0xcb7a('0x4d'),_0x213b84[_0xcb7a('0x4d')]||_0xcb7a('0x4e'));this[_0xcb7a('0x6')](_0xcb7a('0x4f'),_0x213b84[_0xcb7a('0x4f')]||_0xcb7a('0x50'));this[_0xcb7a('0x6')](_0xcb7a('0x4c'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0xcb7a('0x41')],'set':function(_0x54b745){this['setDataValue']('permissions',_0x54b745?_0x54b745[_0xcb7a('0x26')](','):[]);},'get':function(){return this['getDataValue'](_0xcb7a('0x51'))?_[_0xcb7a('0x52')](this['getDataValue'](_0xcb7a('0x51'))[_0xcb7a('0x27')](','),function(_0xc71289){return parseInt(_0xc71289,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xcb7a('0x9')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xcb7a('0x9')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xcb7a('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xcb7a('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xcb7a('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xcb7a('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xcb7a('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xcb7a('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xcb7a('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xcb7a('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xcb7a('0x10')](_0xcb7a('0x2e'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xcb7a('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xcb7a('0x9')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xcb7a('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xcb7a('0x53')],'get':function(){return this['getDataValue'](_0xcb7a('0x54'))?this[_0xcb7a('0xd')](_0xcb7a('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xcb7a('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xcb7a('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xcb7a('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0xcb7a('0x9')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xcb7a('0x9')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xcb7a('0x17')],'defaultValue':![],'set':function(_0x1396a5){if(typeof _0x1396a5==='string'){var _0x463d0d=_0x1396a5==='1'?!![]:_0x1396a5==='0'?![]:_0x1396a5===_0xcb7a('0x55')?!![]:_0x1396a5===_0xcb7a('0x56')?![]:![];this[_0xcb7a('0x6')](_0xcb7a('0x57'),_0x463d0d);}else{this['setDataValue'](_0xcb7a('0x57'),_0x1396a5);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x459c82){this[_0xcb7a('0x6')]('blocked',_0x459c82);if(_0x459c82===!![]){this[_0xcb7a('0x6')]('blockedAt',moment());this['setDataValue']('loginAttempts',0x0);}else{this[_0xcb7a('0x6')](_0xcb7a('0x58'),null);}}},'blockedAt':{'type':Sequelize[_0xcb7a('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xcb7a('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xcb7a('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xcb7a('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xcb7a('0x15')](0x5)[_0xcb7a('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xcb7a('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xcb7a('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xed1c=['telephone','local','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','from-sip','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','passive','actpass','update,nonat','TEXT','get','wss','encryption','force_avp','icesupport','dtlsverify','dtlssetup','rtcp_mux','dtlsenable','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','UNSIGNED','sequelize','moment','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user'];(function(_0x50e593,_0x3ae998){var _0x3821d0=function(_0x53c295){while(--_0x53c295){_0x50e593['push'](_0x50e593['shift']());}};_0x3821d0(++_0x3ae998);}(_0xed1c,0xe4));var _0xced1=function(_0x6d3600,_0xd2b6a6){_0x6d3600=_0x6d3600-0x0;var _0x5a0da3=_0xed1c[_0x6d3600];return _0x5a0da3;};'use strict';var Sequelize=require(_0xced1('0x0'));var moment=require(_0xced1('0x1'));var util=require('util');var _=require('lodash');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xced1('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x329a0a){this[_0xced1('0x3')]('name',_0x329a0a);this[_0xced1('0x3')](_0xced1('0x4'),_0x329a0a);},'comment':_0xced1('0x5')},'fullname':{'type':Sequelize[_0xced1('0x6')],'allowNull':![],'set':function(_0x59399e){this[_0xced1('0x3')](_0xced1('0x7'),_0x59399e);this[_0xced1('0x3')](_0xced1('0x8'),util[_0xced1('0x9')](_0xced1('0xa'),_0x59399e,this[_0xced1('0xb')](_0xced1('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xced1('0x6')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x3464f3){if(_0x3464f3){this[_0xced1('0x3')](_0xced1('0xd'),_0x3464f3[_0xced1('0xe')]());}}},'role':{'type':Sequelize[_0xced1('0xf')](_0xced1('0x10'),_0xced1('0x11'),'agent',_0xced1('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0xced1('0x6')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xced1('0x6')],'defaultValue':_0xced1('0x13')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xced1('0xc'),'set':function(_0x31a32c){this['setDataValue'](_0xced1('0xc'),_0x31a32c);this[_0xced1('0x3')](_0xced1('0x14'),_0x31a32c);this[_0xced1('0x3')]('callerid',util['format'](_0xced1('0xa'),this[_0xced1('0xb')](_0xced1('0x7')),_0x31a32c));}},'salt':{'type':Sequelize[_0xced1('0x6')]},'phone':{'type':Sequelize[_0xced1('0x6')]},'mobile':{'type':Sequelize[_0xced1('0x6')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xced1('0x6')]},'city':{'type':Sequelize[_0xced1('0x6')]},'country':{'type':Sequelize[_0xced1('0x6')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xced1('0x15')]},'voicePause':{'type':Sequelize[_0xced1('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xced1('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xced1('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xced1('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xced1('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xced1('0x6')],'defaultValue':_0xced1('0x17')},'lastPauseAt':{'type':Sequelize[_0xced1('0x15')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xced1('0x18')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xced1('0x18')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xced1('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xced1('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xced1('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xced1('0x18')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xced1('0x18')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xced1('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xced1('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xced1('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'host':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![],'defaultValue':_0xced1('0x19')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0xced1('0x18')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xced1('0x18')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xced1('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xced1('0xf')]('friend',_0xced1('0x11'),'peer'),'allowNull':!![],'defaultValue':_0xced1('0x1a')},'context':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![],'defaultValue':_0xced1('0x1b')},'callingpres':{'type':Sequelize[_0xced1('0xf')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0xced1('0x1c'),_0xced1('0x1d'),_0xced1('0x1e'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'permit':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'secret':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![],'defaultValue':_0xced1('0x1f'),'set':function(_0x46b672){this[_0xced1('0x3')](_0xced1('0x20'),_0x46b672?_0x46b672[_0xced1('0x21')](','):null);},'get':function(){return this[_0xced1('0xb')]('transport')?this['getDataValue'](_0xced1('0x20'))[_0xced1('0x22')](','):null;},'comment':_0xced1('0x23')},'dtmfmode':{'type':Sequelize[_0xced1('0xf')](_0xced1('0x24'),_0xced1('0x25'),'shortinfo','inband','auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xced1('0xf')](_0xced1('0x26'),'no',_0xced1('0x27'),_0xced1('0x28'),_0xced1('0x29')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xced1('0xf')](_0xced1('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'nat':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![],'defaultValue':_0xced1('0x2a'),'set':function(_0x1db647){this[_0xced1('0x3')]('nat',_0x1db647?_0x1db647[_0xced1('0x21')](','):null);},'get':function(){return this[_0xced1('0xb')](_0xced1('0x2b'))?this[_0xced1('0xb')](_0xced1('0x2b'))[_0xced1('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xced1('0x6')]},'namedcallgroup':{'type':Sequelize[_0xced1('0x6')]},'pickupgroup':{'type':Sequelize[_0xced1('0x6')]},'namedpickupgroup':{'type':Sequelize[_0xced1('0x6')]},'language':{'type':Sequelize[_0xced1('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xced1('0x6')]},'disallow':{'type':Sequelize[_0xced1('0x6')],'allowNull':![],'defaultValue':_0xced1('0x2c')},'allow':{'type':Sequelize[_0xced1('0x6')],'allowNull':![],'defaultValue':_0xced1('0x2d'),'set':function(_0x1e119c){this['setDataValue']('allow',_0x1e119c?_0x1e119c[_0xced1('0x21')](';'):_0xced1('0x2d'));},'get':function(){return this[_0xced1('0xb')]('allow')?this[_0xced1('0xb')](_0xced1('0x2e'))[_0xced1('0x22')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xced1('0xf')](_0xced1('0x26'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x20ab72){this['setDataValue'](_0xced1('0x2f'),_0x20ab72?_0x20ab72[_0xced1('0x21')](','):null);},'get':function(){return this['getDataValue'](_0xced1('0x2f'))?this[_0xced1('0xb')](_0xced1('0x2f'))['split'](','):null;},'comment':_0xced1('0x30')},'trustrpid':{'type':Sequelize[_0xced1('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xced1('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xced1('0x26'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xced1('0xf')](_0xced1('0x26'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xced1('0xf')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xced1('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![],'defaultValue':_0xced1('0x31')},'amaflags':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xced1('0xf')]('yes','no'),'allowNull':!![],'defaultValue':_0xced1('0x26')},'busylevel':{'type':Sequelize[_0xced1('0x18')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0xced1('0x26'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xced1('0xf')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xced1('0xf')](_0xced1('0x26'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xced1('0xf')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'template':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xced1('0xf')](_0xced1('0x26'),'no',_0xced1('0x32')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xced1('0xf')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xced1('0xf')](_0xced1('0x33'),_0xced1('0x34'),_0xced1('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xced1('0x18')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xced1('0xf')](_0xced1('0x36'),'uas'),'allowNull':!![],'defaultValue':_0xced1('0x37')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xced1('0xf')](_0xced1('0x26'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xced1('0x18')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xced1('0x18')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xced1('0xf')](_0xced1('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xced1('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xced1('0x18')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xced1('0xf')](_0xced1('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xced1('0x26'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xced1('0xf')](_0xced1('0x26'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xced1('0x26'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xced1('0xf')](_0xced1('0x26'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xced1('0xf')]('yes','no',_0xced1('0x38'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xced1('0xf')]('active',_0xced1('0x39'),_0xced1('0x3a')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xced1('0xf')](_0xced1('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xced1('0x18')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xced1('0xf')](_0xced1('0x26'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xced1('0xf')](_0xced1('0x26'),'no',_0xced1('0x27'),'update',_0xced1('0x3b')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xced1('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xced1('0x6')]},'resetPasswordExpires':{'type':Sequelize[_0xced1('0x15')]},'passwordResetAt':{'type':Sequelize[_0xced1('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xced1('0x3c')]},'showWebBar':{'type':Sequelize[_0xced1('0x18')],'defaultValue':0x0,'set':function(_0x457e5b){this['setDataValue']('showWebBar',_0x457e5b);var _0x4cc559=this[_0xced1('0x3d')]({'plain':!![]});switch(_0x457e5b){case 0x0:case 0x1:var _0x52e873=_0x4cc559[_0xced1('0x20')]?_['isArray'](_0x4cc559['transport'])?_0x4cc559[_0xced1('0x20')][_0xced1('0x21')]():_0x4cc559[_0xced1('0x20')]:_0xced1('0x1f');if(_0x52e873===_0xced1('0x3e')){_0x52e873=_0xced1('0x1f');}this[_0xced1('0x3')](_0xced1('0x20'),_0x52e873);this[_0xced1('0x3')](_0xced1('0x3f'),'no');this[_0xced1('0x3')]('avpf',null);this[_0xced1('0x3')](_0xced1('0x40'),null);this['setDataValue'](_0xced1('0x41'),null);this[_0xced1('0x3')]('dtlsenable',null);this[_0xced1('0x3')](_0xced1('0x42'),null);this[_0xced1('0x3')](_0xced1('0x43'),null);this[_0xced1('0x3')]('dtlscertfile',null);this['setDataValue']('dtlsprivatekey',null);this[_0xced1('0x3')](_0xced1('0x44'),'no');break;case 0x2:this['setDataValue'](_0xced1('0x20'),_0xced1('0x3e'));this[_0xced1('0x3')]('encryption',_0xced1('0x26'));this[_0xced1('0x3')]('avpf',_0xced1('0x26'));this['setDataValue'](_0xced1('0x40'),_0xced1('0x26'));this[_0xced1('0x3')](_0xced1('0x41'),_0xced1('0x26'));this[_0xced1('0x3')](_0xced1('0x45'),'yes');this[_0xced1('0x3')](_0xced1('0x42'),'no');this[_0xced1('0x3')]('dtlssetup','actpass');this[_0xced1('0x3')](_0xced1('0x46'),_0x4cc559['dtlscertfile']||_0xced1('0x47'));this[_0xced1('0x3')](_0xced1('0x48'),_0x4cc559['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this[_0xced1('0x3')](_0xced1('0x44'),_0xced1('0x26'));break;default:}}},'permissions':{'type':Sequelize[_0xced1('0x3c')],'set':function(_0x95c83b){this[_0xced1('0x3')]('permissions',_0x95c83b?_0x95c83b[_0xced1('0x21')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_['map'](this['getDataValue'](_0xced1('0x49'))[_0xced1('0x22')](','),function(_0x586699){return parseInt(_0x586699,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0xced1('0x6')]},'phoneBarBusyNumber':{'type':Sequelize[_0xced1('0x6')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xced1('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xced1('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xced1('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xced1('0xf')](_0xced1('0x26'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xced1('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xced1('0x6')]},'phoneBarEnableJaws':{'type':Sequelize[_0xced1('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xced1('0x4a')],'get':function(){return this[_0xced1('0xb')](_0xced1('0x4b'))?this[_0xced1('0xb')](_0xced1('0x4b')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xced1('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xced1('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xced1('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0xced1('0x6')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xced1('0x6')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x39ffe8){if(typeof _0x39ffe8==='string'){var _0x11a86f=_0x39ffe8==='1'?!![]:_0x39ffe8==='0'?![]:_0x39ffe8===_0xced1('0x4c')?!![]:_0x39ffe8===_0xced1('0x4d')?![]:![];this[_0xced1('0x3')](_0xced1('0x4e'),_0x11a86f);}else{this[_0xced1('0x3')]('screenrecording',_0x39ffe8);}}},'blocked':{'type':Sequelize[_0xced1('0x16')],'defaultValue':![],'set':function(_0x1a0462){this[_0xced1('0x3')](_0xced1('0x4f'),_0x1a0462);if(_0x1a0462===!![]){this[_0xced1('0x3')](_0xced1('0x50'),moment());this['setDataValue']('loginAttempts',0x0);}else{this[_0xced1('0x3')](_0xced1('0x50'),null);}}},'blockedAt':{'type':Sequelize[_0xced1('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xced1('0x18')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xced1('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xced1('0x18')](0x5)[_0xced1('0x51')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xced1('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xced1('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 3d09cc0..f2a35c4 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 _0x3da6=['UserId','getChatInteractions','getOpenchannelInteractions','getMailInteractions','MailInteraction','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','socket','remoteAddress','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','LOGIN','device','PAUSE','LOGININPAUSE','concat','isMiddleware','logout','pause','QueuePause','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','whatsapppause','pauseType','lastPauseAt','manual','%s%s','Pause','Team','addTeams','Voice','getChatQueues','Chat','setDataValue','Mail','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','Queue:save','removeTeams','getMailQueues','getFaxQueues','removeAgent','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gt','$ne','$not','$between','$notBetween','$in','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','firstName','CmContact','getApiKey','retrieveApiKey','json','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','resolve','teams','queues','inbound','lower','col','toString','asc','desc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','client','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unavailable','ringing','voiceStatus','busy','slice','charAt','toUpperCase','select','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','moment','bluebird','util','path','lodash','squel','jayson/promise','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user.socket','defaults','localhost','http','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','update','destroy','role','Users','user','Agents','agent','Telephones','telephone','value','find','stack','name','send','index','map','fieldName','type','key','filter','salt','where','includeAll','includes','User','findAll','rows','query','openTabs','true','length','push','chat','dataValues','fax','mail','whatsapp','all','show','params','model','differenceBy','keys','rawAttributes','intersection','attributes','fields','include','merge','options','sms','openchannel','body','describe','addContacts','ids','omit','internal','Setting','findById','max','isNil','min_internal','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)','sequelize','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','password','fullname','email','101','102','113','104','105','106','107','111','114','115','create','Unauthorized','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','isEmpty','autoAssociation','UserProfileResource','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','updatePasswordsHistory','addQueues','loginInPause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','spread','QueueId','voice','VoiceQueue','get','online','format','SIP/%s','voicePause','penalty','UserVoiceQueueRt','upsert','removeQueues','channel','remove','emit','Queue:remove','addAvatar','userpic','file','filename','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','ChatOpenTabs','CHAT','FaxOpenTabs','FAX','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','getContacts','filters','order','sort','pick','List','Tag','tag','hasOwnProperty','nolimit','getQueues','Queue','findOne','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','getScreenRecordings','ScreenRecording'];(function(_0x594901,_0x4ebd08){var _0x3a46e0=function(_0x36b66e){while(--_0x36b66e){_0x594901['push'](_0x594901['shift']());}};_0x3a46e0(++_0x4ebd08);}(_0x3da6,0xc1));var _0x63da=function(_0x59c3d9,_0x2ccd88){_0x59c3d9=_0x59c3d9-0x0;var _0x2f3382=_0x3da6[_0x59c3d9];return _0x2f3382;};'use strict';var moment=require(_0x63da('0x0'));var BPromise=require(_0x63da('0x1'));var util=require(_0x63da('0x2'));var path=require(_0x63da('0x3'));var fs=require('fs');var _=require(_0x63da('0x4'));var squel=require(_0x63da('0x5'));var jayson=require(_0x63da('0x6'));var Redis=require('ioredis');var authService=require(_0x63da('0x7'));var qs=require(_0x63da('0x8'));var logger=require('../../config/logger')(_0x63da('0x9'));var utils=require('../../config/utils');var config=require(_0x63da('0xa'));var licenseUtil=require('../../config/license/util');var db=require(_0x63da('0xb'))['db'];var socket=require(_0x63da('0xc'))(new Redis(config[_0x63da('0xd')]));require(_0x63da('0xe'))['register'](socket);config[_0x63da('0xd')]=_[_0x63da('0xf')](config['redis'],{'host':_0x63da('0x10'),'port':0x18eb});var client=jayson['client'][_0x63da('0x11')]({'port':0x232a});var values;function respondWithRpcPromise(_0x12ac78,_0x1f545a,_0xbfba58,_0x36a372){return new BPromise(function(_0x5006ad,_0x2a3fcc){var _0x576ea2=_0x36a372||client;return _0x576ea2[_0x63da('0x12')](_0x12ac78,_0xbfba58)[_0x63da('0x13')](function(_0x30d1bd){logger[_0x63da('0x14')](_0x63da('0x15'),_0x1f545a,_0x63da('0x16'));logger[_0x63da('0x17')](_0x63da('0x18'),_0x1f545a,_0x63da('0x16'),JSON[_0x63da('0x19')](_0x30d1bd));if(_0x30d1bd[_0x63da('0x1a')]){if(_0x30d1bd[_0x63da('0x1a')][_0x63da('0x1b')]===0x1f4){logger['error']('User,\x20%s,\x20%s',_0x1f545a,_0x30d1bd[_0x63da('0x1a')]['message']);return _0x2a3fcc(_0x30d1bd[_0x63da('0x1a')][_0x63da('0x1c')]);}logger[_0x63da('0x1a')](_0x63da('0x15'),_0x1f545a,_0x30d1bd[_0x63da('0x1a')]['message']);return _0x5006ad(_0x30d1bd[_0x63da('0x1a')]['message']);}else{logger['info'](_0x63da('0x15'),_0x1f545a,'request\x20sent');_0x5006ad(_0x30d1bd[_0x63da('0x1d')][_0x63da('0x1c')]);}})[_0x63da('0x1e')](function(_0x4bf6f6){logger[_0x63da('0x1a')](_0x63da('0x15'),_0x1f545a,_0x4bf6f6);_0x2a3fcc(_0x4bf6f6);});});}function respondWithStatusCode(_0x54b6c6,_0x30d5ef){_0x30d5ef=_0x30d5ef||0xcc;return function(_0x2a9f74){if(_0x2a9f74){return _0x54b6c6[_0x63da('0x1f')](_0x30d5ef);}return _0x54b6c6[_0x63da('0x20')](_0x30d5ef)[_0x63da('0x21')]();};}function respondWithResult(_0x33e5c6,_0x131dc9){_0x131dc9=_0x131dc9||0xc8;return function(_0xd9dbf6){if(_0xd9dbf6){return _0x33e5c6[_0x63da('0x20')](_0x131dc9)['json'](_0xd9dbf6);}};}function respondWithFilteredResult(_0x55df4a,_0xef0017){return function(_0x32d43e){if(_0x32d43e){var _0x13d657=typeof _0xef0017[_0x63da('0x22')]===_0x63da('0x23')&&typeof _0xef0017[_0x63da('0x24')]==='undefined';var _0xc44172=_0x32d43e[_0x63da('0x25')];var _0x1a1889=_0x13d657?0x0:_0xef0017[_0x63da('0x22')];var _0x54acd0=_0x13d657?_0x32d43e[_0x63da('0x25')]:_0xef0017[_0x63da('0x22')]+_0xef0017[_0x63da('0x24')];var _0x3505b0;if(_0x54acd0>=_0xc44172){_0x54acd0=_0xc44172;_0x3505b0=0xc8;}else{_0x3505b0=0xce;}_0x55df4a[_0x63da('0x20')](_0x3505b0);return _0x55df4a[_0x63da('0x26')](_0x63da('0x27'),_0x1a1889+'-'+_0x54acd0+'/'+_0xc44172)['json'](_0x32d43e);}return null;};}function saveUpdates(_0x5a4628){return function(_0x3c646a){if(_0x3c646a){return _0x3c646a[_0x63da('0x28')](_0x5a4628)[_0x63da('0x13')](function(_0xdcf3cb){return _0xdcf3cb;});}return null;};}function removeEntity(_0x90788a){return function(_0x33fbca){if(_0x33fbca){return _0x33fbca[_0x63da('0x29')]()[_0x63da('0x13')](function(){var _0x56fcda=_0x33fbca['get']({'plain':!![]});if(_0x56fcda[_0x63da('0x2a')]==='admin')return;var _0x3f2ed0=[{'name':_0x63da('0x2b'),'value':_0x63da('0x2c'),'ignore':!![]},{'name':_0x63da('0x2d'),'value':_0x63da('0x2e'),'ignore':![]},{'name':_0x63da('0x2f'),'value':_0x63da('0x30'),'ignore':![]}];var _0x2171bb=_(_0x3f2ed0)['filter']('ignore')['map'](_0x63da('0x31'))['value']();if(_['includes'](_0x2171bb,_0x56fcda[_0x63da('0x2a')])){return;}var _0x1cb9e4=_[_0x63da('0x32')](_0x3f2ed0,[_0x63da('0x31'),_0x56fcda[_0x63da('0x2a')]])['name'];return db['UserProfileResource'][_0x63da('0x29')]({'where':{'type':_0x1cb9e4,'resourceId':_0x56fcda['id']}})['then'](function(){return _0x33fbca;});})[_0x63da('0x13')](function(){_0x90788a[_0x63da('0x20')](0xcc)[_0x63da('0x21')]();});}};}function handleEntityNotFound(_0x3a8bf6){return function(_0x40635d){if(!_0x40635d){_0x3a8bf6['sendStatus'](0x194);}return _0x40635d;};}function handleError(_0x57af0b,_0x5c9df0){_0x5c9df0=_0x5c9df0||0x1f4;return function(_0x8f267b){logger[_0x63da('0x1a')](_0x8f267b[_0x63da('0x33')]);if(_0x8f267b[_0x63da('0x34')]){delete _0x8f267b['name'];}_0x57af0b['status'](_0x5c9df0)[_0x63da('0x35')](_0x8f267b);};}exports[_0x63da('0x36')]=function(_0x241466,_0x444561){var _0x2cc02a={},_0x23340a={'count':0x0,'rows':[]};var _0x9cd4f=_(db['User']['rawAttributes'])[_0x63da('0x37')](function(_0x43055d){return{'name':_0x43055d[_0x63da('0x38')],'type':_0x43055d[_0x63da('0x39')][_0x63da('0x3a')]};})[_0x63da('0x3b')](function(_0x544b2b){return!_['includes'](['password',_0x63da('0x3c')],_0x544b2b['name']);})[_0x63da('0x31')]();_0x2cc02a=qs['getOptions'](_0x9cd4f,_0x241466);var _0x1c329d={'where':_0x2cc02a[_0x63da('0x3d')]};return db['User'][_0x63da('0x25')](_0x1c329d)['then'](function(_0x14c338){_0x23340a['count']=_0x14c338;if(_0x241466['query'][_0x63da('0x3e')]){_0x2cc02a['include']=[{'all':!![]}];}if(!_[_0x63da('0x3f')](_0x2cc02a['attributes'],'id')){_0x2cc02a['attributes']['push']('id');}return db[_0x63da('0x40')][_0x63da('0x41')](_0x2cc02a);})['then'](function(_0x5b999c){_0x23340a[_0x63da('0x42')]=_0x5b999c;if(_0x241466[_0x63da('0x43')][_0x63da('0x44')]===_0x63da('0x45')){var _0x1dd93c=[];for(var _0x296e03=0x0;_0x296e03<_0x23340a[_0x63da('0x42')][_0x63da('0x46')];_0x296e03++){_0x1dd93c[_0x63da('0x47')](get_open_tabs(_0x63da('0x48'),_0x23340a[_0x63da('0x42')][_0x296e03][_0x63da('0x49')]));_0x1dd93c['push'](get_open_tabs('sms',_0x23340a['rows'][_0x296e03][_0x63da('0x49')]));_0x1dd93c['push'](get_open_tabs(_0x63da('0x4a'),_0x23340a[_0x63da('0x42')][_0x296e03][_0x63da('0x49')]));_0x1dd93c[_0x63da('0x47')](get_open_tabs(_0x63da('0x4b'),_0x23340a[_0x63da('0x42')][_0x296e03][_0x63da('0x49')]));_0x1dd93c[_0x63da('0x47')](get_open_tabs('openchannel',_0x23340a['rows'][_0x296e03]['dataValues']));_0x1dd93c[_0x63da('0x47')](get_open_tabs(_0x63da('0x4c'),_0x23340a[_0x63da('0x42')][_0x296e03]['dataValues']));}return BPromise[_0x63da('0x4d')](_0x1dd93c)[_0x63da('0x13')](function(_0xef2ecf){return _0x23340a;});}else{return _0x23340a;}})[_0x63da('0x13')](respondWithFilteredResult(_0x444561,_0x2cc02a))[_0x63da('0x1e')](handleError(_0x444561,null));};exports[_0x63da('0x4e')]=function(_0x512dc3,_0x387684){var _0x2e59df={'raw':![],'where':{'id':_0x512dc3[_0x63da('0x4f')]['id']}},_0x4a7e8d={};_0x4a7e8d[_0x63da('0x50')]=_[_0x63da('0x51')](_[_0x63da('0x52')](db[_0x63da('0x40')][_0x63da('0x53')]),['password',_0x63da('0x3c')]);_0x4a7e8d['query']=_[_0x63da('0x52')](_0x512dc3['query']);_0x4a7e8d['filters']=_[_0x63da('0x54')](_0x4a7e8d[_0x63da('0x50')],_0x4a7e8d['query']);_0x2e59df[_0x63da('0x55')]=_['intersection'](_0x4a7e8d['model'],qs[_0x63da('0x56')](_0x512dc3['query']['fields']));_0x2e59df[_0x63da('0x55')]=_0x2e59df[_0x63da('0x55')][_0x63da('0x46')]?_0x2e59df[_0x63da('0x55')]:_0x4a7e8d[_0x63da('0x50')];if(_0x512dc3[_0x63da('0x43')][_0x63da('0x3e')]){_0x2e59df[_0x63da('0x57')]=[{'all':!![]}];}_0x2e59df=_[_0x63da('0x58')]({},_0x2e59df,_0x512dc3[_0x63da('0x59')]);if(!_['includes'](_0x2e59df[_0x63da('0x55')],'id')){_0x2e59df[_0x63da('0x55')][_0x63da('0x47')]('id');}return db[_0x63da('0x40')][_0x63da('0x32')](_0x2e59df)[_0x63da('0x13')](handleEntityNotFound(_0x387684,null))[_0x63da('0x13')](function(_0x2ece02){var _0x956c2a=[];values=_0x2ece02;if(_0x512dc3[_0x63da('0x43')]['openTabs']===_0x63da('0x45')){_0x956c2a[_0x63da('0x47')](get_open_tabs('chat',_0x2ece02[_0x63da('0x49')]));_0x956c2a[_0x63da('0x47')](get_open_tabs(_0x63da('0x5a'),_0x2ece02[_0x63da('0x49')]));_0x956c2a[_0x63da('0x47')](get_open_tabs(_0x63da('0x5b'),_0x2ece02[_0x63da('0x49')]));_0x956c2a[_0x63da('0x47')](get_open_tabs(_0x63da('0x4c'),_0x2ece02['dataValues']));_0x956c2a[_0x63da('0x47')](get_open_tabs(_0x63da('0x4a'),_0x2ece02[_0x63da('0x49')]));_0x956c2a[_0x63da('0x47')](get_open_tabs(_0x63da('0x4b'),_0x2ece02[_0x63da('0x49')]));return BPromise[_0x63da('0x4d')](_0x956c2a);}else{return values;}})[_0x63da('0x13')](function(_0x4d0471){return values;})[_0x63da('0x13')](respondWithResult(_0x387684,null))[_0x63da('0x1e')](handleError(_0x387684,null));};exports[_0x63da('0x28')]=function(_0x215060,_0x2c8179){if(_0x215060['body']['id']){delete _0x215060[_0x63da('0x5c')]['id'];}delete _0x215060['body'][_0x63da('0x2a')];return db[_0x63da('0x40')][_0x63da('0x32')]({'where':{'id':_0x215060[_0x63da('0x4f')]['id']}})[_0x63da('0x13')](handleEntityNotFound(_0x2c8179,null))['then'](saveUpdates(_0x215060[_0x63da('0x5c')],null))[_0x63da('0x13')](respondWithResult(_0x2c8179,null))[_0x63da('0x1e')](handleError(_0x2c8179,null));};exports[_0x63da('0x5d')]=function(_0x4977e6,_0x1738f9){return db[_0x63da('0x40')][_0x63da('0x5d')]()['then'](respondWithResult(_0x1738f9,null))[_0x63da('0x1e')](handleError(_0x1738f9,null));};exports[_0x63da('0x5e')]=function(_0x50da69,_0x2f89d3){return db[_0x63da('0x40')]['find']({'where':{'id':_0x50da69[_0x63da('0x4f')]['id']}})[_0x63da('0x13')](handleEntityNotFound(_0x2f89d3,null))[_0x63da('0x13')](function(_0x46de56){if(_0x46de56){return _0x46de56[_0x63da('0x5e')](_0x50da69['body'][_0x63da('0x5f')],_[_0x63da('0x60')](_0x50da69[_0x63da('0x5c')],[_0x63da('0x5f'),'id'])||{});}})[_0x63da('0x13')](respondWithResult(_0x2f89d3,null))[_0x63da('0x1e')](handleError(_0x2f89d3,null));};function validateUser(_0xda304c){return new BPromise(function(_0x248c9b,_0x3d5756){if(_0xda304c[_0x63da('0x61')])return _0x248c9b(_0xda304c);return db[_0x63da('0x62')][_0x63da('0x63')](0x1)['then'](function(_0x36da27){if(_0x36da27['securePassword'])authService['validatePasswordPattern'](_0xda304c['password']);db[_0x63da('0x40')][_0x63da('0x64')](_0x63da('0x61'))[_0x63da('0x13')](function(_0x35ef7d){if(_[_0x63da('0x65')](_0x35ef7d)){_0xda304c['internal']=_0x36da27[_0x63da('0x66')]||0x1;return;}if(_['isNil'](_0x36da27[_0x63da('0x66')])||_0x36da27['min_internal']===_0x35ef7d){_0xda304c['internal']=_0x35ef7d+0x1;return;}if(_0x36da27[_0x63da('0x66')]>_0x35ef7d){_0xda304c[_0x63da('0x61')]=_0x36da27[_0x63da('0x66')];return;}return db['sequelize'][_0x63da('0x43')](_0x63da('0x67'),{'type':db[_0x63da('0x68')][_0x63da('0x69')][_0x63da('0x6a')]})[_0x63da('0x13')](function(_0x5c04c1){if(_0x5c04c1&&_0x5c04c1[_0x63da('0x46')]){for(var _0x1b32a7=0x0,_0x45429d=_0x5c04c1[_0x63da('0x46')];_0x1b32a7<_0x45429d&&_[_0x63da('0x65')](_0xda304c['internal']);_0x1b32a7++){if(_0x36da27[_0x63da('0x66')]<=_0x5c04c1[_0x1b32a7][_0x63da('0x6b')]){_0xda304c[_0x63da('0x61')]=_0x5c04c1[_0x1b32a7][_0x63da('0x6b')];}else if(_0x36da27[_0x63da('0x66')]>_0x5c04c1[_0x1b32a7][_0x63da('0x6b')]&&_0x36da27[_0x63da('0x66')]<=_0x5c04c1[_0x1b32a7]['to']){_0xda304c[_0x63da('0x61')]=_0x36da27[_0x63da('0x66')];}}}if(_[_0x63da('0x65')](_0xda304c['internal'])){_0xda304c['internal']=_0x35ef7d+0x1;}return _0x248c9b(_0xda304c);});});})[_0x63da('0x1e')](function(_0x3052d2){_0x3d5756(_0x3052d2);});});}function updateUser(_0x3c352f){return new BPromise(function(_0x4614c7,_0x8e998d){try{if(_0x3c352f[_0x63da('0x6c')]){_0x3c352f[_0x63da('0x6d')]=_0x3c352f['internal'];_0x3c352f[_0x63da('0x6e')]={'mailbox':_0x3c352f['internal'],'password':_0x3c352f[_0x63da('0x6f')],'fullname':_0x3c352f[_0x63da('0x70')],'email':_0x3c352f[_0x63da('0x71')]};}if(_0x3c352f[_0x63da('0x2a')]===_0x63da('0x2e')){if(!_0x3c352f['permissions'])_0x3c352f['permissions']=[_0x63da('0x72'),_0x63da('0x73'),'103',_0x63da('0x74'),'110',_0x63da('0x75'),_0x63da('0x76'),_0x63da('0x77'),_0x63da('0x78'),'108','109','100',_0x63da('0x79'),_0x63da('0x7a'),_0x63da('0x7b')];}_0x4614c7(_0x3c352f);}catch(_0x1a6b61){_0x8e998d(_0x1a6b61);}});}exports[_0x63da('0x7c')]=function(_0x48f813,_0x617ee5){if(_0x48f813[_0x63da('0x2c')][_0x63da('0x2a')]===_0x63da('0x2e'))throw new Error(_0x63da('0x7d'));if(_0x48f813[_0x63da('0x5c')]['role']===_0x63da('0x2c')&&_0x48f813[_0x63da('0x2c')][_0x63da('0x2a')]!==_0x63da('0x7e')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x48f813['body'][_0x63da('0x2a')]===_0x63da('0x7e')&&_0x48f813['user'][_0x63da('0x2a')]!==_0x63da('0x7e')){throw new Error(_0x63da('0x7f'));}return licenseUtil[_0x63da('0x80')]([_0x48f813[_0x63da('0x5c')]])['then'](function(){return validateUser(_0x48f813[_0x63da('0x5c')]);})[_0x63da('0x13')](function(_0x3fb2dd){return updateUser(_0x3fb2dd)[_0x63da('0x13')](function(_0x3e5fa8){if(_0x3e5fa8[_0x63da('0x2a')]===_0x63da('0x7e')){_0x3e5fa8[_0x63da('0x81')]=_0x48f813[_0x63da('0x2c')][_0x63da('0x81')];delete _0x3e5fa8[_0x63da('0x82')];}return _0x3e5fa8;});})[_0x63da('0x13')](function(_0x163acc){return db[_0x63da('0x40')][_0x63da('0x7c')](_0x163acc,{'include':[{'model':db[_0x63da('0x6e')],'as':_0x63da('0x6e')}]});})[_0x63da('0x13')](function(_0x305371){if(_0x48f813[_0x63da('0x5c')][_0x63da('0x2a')]==='user')return _0x305371;if(_0x48f813[_0x63da('0x2c')][_0x63da('0x2a')]!==_0x63da('0x2c'))return _0x305371;return db[_0x63da('0x83')]['find']({'where':{'name':_0x305371['role']===_0x63da('0x2e')?_0x63da('0x2d'):_0x63da('0x2f'),'userProfileId':_0x48f813[_0x63da('0x2c')]['userProfileId']},'raw':!![]})[_0x63da('0x13')](function(_0x3cc2da){if(!_0x3cc2da||_0x3cc2da['autoAssociation']!=0x0)return _0x305371;return db['UserProfileResource']['create']({'name':_0x305371[_0x63da('0x34')],'resourceId':_0x305371['id'],'type':_0x3cc2da[_0x63da('0x34')],'sectionId':_0x3cc2da['id']},{})[_0x63da('0x13')](function(){return _0x305371;});})[_0x63da('0x1e')](function(_0x1118f1){logger[_0x63da('0x1a')](_0x63da('0x84'),_0x1118f1);throw _0x1118f1;});})['then'](respondWithResult(_0x617ee5,0xc9))[_0x63da('0x1e')](handleError(_0x617ee5,null));};exports[_0x63da('0x85')]=function(_0x1d55d7,_0x1bdcf2){var _0x5184c1=_0x1d55d7[_0x63da('0x5c')];var _0xa6b906=[];if(_0x1d55d7[_0x63da('0x2c')][_0x63da('0x2a')]===_0x63da('0x2e'))throw new Error(_0x63da('0x7d'));if(_[_0x63da('0x86')](_0x5184c1,[_0x63da('0x2a'),'user'])&&_0x1d55d7['user'][_0x63da('0x2a')]!==_0x63da('0x7e')){throw new Error(_0x63da('0x87'));}if(_[_0x63da('0x86')](_0x5184c1,[_0x63da('0x2a'),_0x63da('0x7e')])&&_0x1d55d7[_0x63da('0x2c')][_0x63da('0x2a')]!==_0x63da('0x7e')){throw new Error(_0x63da('0x88'));}return licenseUtil['checkUserLimits'](_0x5184c1)[_0x63da('0x13')](function(){return validateUser(_0x5184c1[0x0]);})[_0x63da('0x13')](function(){for(var _0x280076=0x1;_0x280076<_0x5184c1['length'];_0x280076++){var _0x2f66f6=_0x5184c1[_0x280076-0x1][_0x63da('0x61')];if(!_0x5184c1[_0x280076][_0x63da('0x61')])_0x5184c1[_0x280076][_0x63da('0x61')]=_0x2f66f6+0x1;_0xa6b906[_0x63da('0x47')](validateUser(_0x5184c1[_0x280076]));}return BPromise[_0x63da('0x4d')](_0xa6b906);})['then'](function(){_0xa6b906=[];for(var _0x59b2ab=0x0;_0x59b2ab<_0x5184c1['length'];_0x59b2ab++){_0xa6b906['push'](updateUser(_0x5184c1[_0x59b2ab]));}return BPromise['all'](_0xa6b906);})[_0x63da('0x13')](function(){return BPromise[_0x63da('0x89')](_0x5184c1,function(_0x319f68){return db['User'][_0x63da('0x7c')](_0x319f68,{'include':[{'model':db[_0x63da('0x6e')],'as':_0x63da('0x6e')}]})[_0x63da('0x13')](function(_0x649658){_0x319f68['id']=_0x649658['id'];return _0x319f68;});});})[_0x63da('0x13')](function(_0x13b02f){if(_0x1d55d7['body'][_0x63da('0x2a')]==='user')return _0x13b02f;if(_0x1d55d7[_0x63da('0x2c')][_0x63da('0x2a')]!==_0x63da('0x2c'))return _0x13b02f;var _0x3028e8=_[_0x63da('0x86')](_0x13b02f,function(_0x3f3b7d){return _0x3f3b7d[_0x63da('0x2a')]==='agent'||_0x3f3b7d[_0x63da('0x2a')]===_0x63da('0x30');});if(!_0x3028e8)return _0x13b02f;return db[_0x63da('0x83')][_0x63da('0x41')]({'where':{'name':{'$or':['Agents',_0x63da('0x2f')]},'userProfileId':_0x1d55d7[_0x63da('0x2c')][_0x63da('0x82')]},'raw':!![]})[_0x63da('0x13')](function(_0xbbaa9a){if(_[_0x63da('0x8a')](_0xbbaa9a)||!_['some'](_0xbbaa9a,[_0x63da('0x8b'),0x0]))return _0x13b02f;_0xa6b906=[];var _0x4357c6=_(_0xbbaa9a)['map'](function(_0x213273){if(_0x213273[_0x63da('0x8b')]===0x1)return;return _0x213273[_0x63da('0x34')]===_0x63da('0x2d')?_0x63da('0x2e'):_0x63da('0x30');})['compact']()['value']();for(var _0x23c538=0x0;_0x23c538<_0x13b02f['length'];_0x23c538++){if(!_[_0x63da('0x3f')](_0x4357c6,_0x13b02f[_0x23c538][_0x63da('0x2a')]))return;var _0x24021f=_0x13b02f[_0x23c538]['role']===_0x63da('0x2e')?_0x63da('0x2d'):_0x63da('0x2f');_0xa6b906[_0x63da('0x47')](db[_0x63da('0x8c')][_0x63da('0x7c')]({'name':_0x13b02f[_0x23c538][_0x63da('0x34')],'resourceId':_0x13b02f[_0x23c538]['id'],'type':_0x24021f,'sectionId':_[_0x63da('0x32')](_0xbbaa9a,[_0x63da('0x34'),_0x24021f])['id']},{}));}return BPromise[_0x63da('0x4d')](_0xa6b906);});})[_0x63da('0x13')](respondWithResult(_0x1bdcf2,0xc9))[_0x63da('0x1e')](handleError(_0x1bdcf2,null));};exports[_0x63da('0x8d')]=function(_0x4f63c1,_0x3d7dc3){if(_0x4f63c1[_0x63da('0x5c')]['id']){delete _0x4f63c1['body']['id'];}return db[_0x63da('0x40')][_0x63da('0x32')]({'where':{'id':_0x4f63c1[_0x63da('0x4f')]['id']}})[_0x63da('0x13')](function(_0x20e53a){if(!_0x20e53a)return null;if(_0x20e53a['id']===_0x4f63c1[_0x63da('0x2c')]['id']){if(!_0x4f63c1[_0x63da('0x5c')][_0x63da('0x8e')]||!_0x4f63c1[_0x63da('0x5c')][_0x63da('0x8f')]){throw new db[(_0x63da('0x90'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x20e53a['authenticate'](_0x4f63c1['body'][_0x63da('0x8e')])){throw new db['Sequelize'][(_0x63da('0x91'))](_0x63da('0x92'));}if(_0x4f63c1[_0x63da('0x5c')][_0x63da('0x8e')]===_0x4f63c1['body']['newPassword']){throw new db[(_0x63da('0x90'))][(_0x63da('0x91'))](_0x63da('0x93'));}}else if(_0x4f63c1[_0x63da('0x2c')][_0x63da('0x2a')]===_0x63da('0x7e')){if(!_0x4f63c1[_0x63da('0x5c')][_0x63da('0x8f')]){throw new db[(_0x63da('0x90'))][(_0x63da('0x91'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x4f63c1[_0x63da('0x2c')][_0x63da('0x2a')]===_0x63da('0x2c')){if(!_0x4f63c1[_0x63da('0x5c')][_0x63da('0x8f')]){throw new db[(_0x63da('0x90'))][(_0x63da('0x91'))](_0x63da('0x94'));}if(_0x20e53a['role']!==_0x63da('0x2e')){throw new db['Sequelize'][(_0x63da('0x91'))](_0x63da('0x7d'));}}else{throw new db[(_0x63da('0x90'))]['ValidationError'](_0x63da('0x7d'));}return _0x20e53a;})['then'](handleEntityNotFound(_0x3d7dc3,null))[_0x63da('0x13')](function(_0x5c5162){return db[_0x63da('0x62')]['findOne']({'attributes':['id',_0x63da('0x95'),_0x63da('0x96'),_0x63da('0x97')]})['then'](function(_0x2f9c3a){if(_0x2f9c3a[_0x63da('0x95')])authService[_0x63da('0x98')](_0x4f63c1['body']['newPassword']);if(!_0x2f9c3a[_0x63da('0x96')]||!_0x5c5162[_0x63da('0x99')])return _0x5c5162;authService['validatePasswordHistory'](_0x4f63c1[_0x63da('0x5c')][_0x63da('0x8f')],_0x5c5162[_0x63da('0x99')],_0x2f9c3a[_0x63da('0x97')]);return _0x5c5162;})[_0x63da('0x13')](saveUpdates({'password':_0x4f63c1[_0x63da('0x5c')][_0x63da('0x8f')],'passwordResetAt':_0x4f63c1[_0x63da('0x2c')]['id']==_0x4f63c1[_0x63da('0x4f')]['id']?moment():null,'previousPasswords':authService[_0x63da('0x9a')](_0x4f63c1['body'][_0x63da('0x8f')],_0x5c5162[_0x63da('0x99')])},null));})[_0x63da('0x13')](respondWithResult(_0x3d7dc3,null))[_0x63da('0x1e')](handleError(_0x3d7dc3,null));};exports[_0x63da('0x9b')]=function(_0x5e4b66,_0x183dbd){var _0x16be50=_0x5e4b66[_0x63da('0x5c')]['channel'];return db['User'][_0x63da('0x32')]({'where':{'id':_0x5e4b66[_0x63da('0x4f')]['id']},'attributes':['id',_0x63da('0x34'),_0x63da('0x2a'),'online',_0x63da('0x9c'),'voicePause',_0x63da('0x9d')]})['then'](handleEntityNotFound(_0x183dbd,null))[_0x63da('0x13')](function(_0xd0f241){if(_0xd0f241){if(!utils[_0x63da('0x9e')](_0x16be50)){throw new db[(_0x63da('0x90'))][(_0x63da('0x91'))](_0x63da('0x9f'));}return _0xd0f241[_0x63da('0xa0')+_[_0x63da('0xa1')](_0x16be50[_0x63da('0xa2')]())+_0x63da('0xa3')](_0x5e4b66[_0x63da('0x5c')]['ids'],{'penalty':_0x5e4b66[_0x63da('0x5c')]['penalty']||0x0})[_0x63da('0xa4')](function(_0x15e7b1){for(var _0x2b7da1=0x0;_0x2b7da1<_0x5e4b66['body']['ids'][_0x63da('0x46')];_0x2b7da1+=0x1){var _0x1e3d80={'UserId':Number(_0x5e4b66[_0x63da('0x4f')]['id'])};_0x1e3d80[_['capitalize'](_0x16be50[_0x63da('0xa2')]())+_0x63da('0xa5')]=Number(_0x5e4b66[_0x63da('0x5c')][_0x63da('0x5f')][_0x2b7da1]);socket['emit']('user'+_['capitalize'](_0x16be50['toLowerCase']())+'Queue:save',_0x1e3d80);}return _0x15e7b1;})[_0x63da('0x13')](function(){if(_0x16be50===_0x63da('0xa6')){return db[_0x63da('0xa7')][_0x63da('0x41')]({'where':{'id':_0x5e4b66[_0x63da('0x5c')][_0x63da('0x5f')]||[]},'raw':!![],'attributes':['id',_0x63da('0x34')]});}})[_0x63da('0x13')](function(_0x1c3591){var _0x4d6e9a=_0xd0f241[_0x63da('0xa8')]({'plain':!![]});var _0x175d0e=[];if(_0x16be50===_0x63da('0xa6')&&_0x4d6e9a[_0x63da('0x2a')]===_0x63da('0x2e')&&_0x4d6e9a[_0x63da('0xa9')]){for(var _0x5f2bd5=0x0;_0x5f2bd5<_0x1c3591[_0x63da('0x46')];_0x5f2bd5+=0x1){_0x175d0e[_0x63da('0x47')]({'membername':_0x4d6e9a[_0x63da('0x34')],'UserId':_0x4d6e9a['id'],'queue_name':_0x1c3591[_0x5f2bd5][_0x63da('0x34')],'VoiceQueueId':_0x1c3591[_0x5f2bd5]['id'],'interface':_[_0x63da('0x65')](_0x4d6e9a[_0x63da('0x9d')])?util[_0x63da('0xaa')](_0x63da('0xab'),_0x4d6e9a['name']):_0x4d6e9a['interface'],'paused':_0x4d6e9a[_0x63da('0xac')]||![],'penalty':_0x5e4b66[_0x63da('0x5c')][_0x63da('0xad')]||0x0});}return BPromise[_0x63da('0x89')](_0x175d0e,function(_0x3a3254){return db[_0x63da('0xae')][_0x63da('0xaf')](_0x3a3254);});}return _0xd0f241;});}})[_0x63da('0x13')](respondWithStatusCode(_0x183dbd,null))['catch'](handleError(_0x183dbd,null));};exports[_0x63da('0xb0')]=function(_0x1d3fcf,_0x4d9e4e){var _0x19fc86;return db['User'][_0x63da('0x32')]({'where':{'id':_0x1d3fcf['params']['id']},'attributes':['id','name',_0x63da('0x2a')]})[_0x63da('0x13')](handleEntityNotFound(_0x4d9e4e,null))[_0x63da('0x13')](function(_0x1c6dbd){if(_0x1c6dbd){_0x19fc86=_0x1c6dbd;if(!_0x1d3fcf[_0x63da('0x43')][_0x63da('0xb1')]||!utils[_0x63da('0x9e')](_0x1d3fcf[_0x63da('0x43')][_0x63da('0xb1')])){throw new db['Sequelize'][(_0x63da('0x91'))](_0x63da('0x9f'));}return _0x1c6dbd[_0x63da('0xb2')+_[_0x63da('0xa1')](_0x1d3fcf['query'][_0x63da('0xb1')][_0x63da('0xa2')]())+_0x63da('0xa3')](_0x1d3fcf['query'][_0x63da('0x5f')]);}})[_0x63da('0x13')](function(_0x32f708){if(_['isArray'](_0x1d3fcf[_0x63da('0x43')][_0x63da('0x5f')])){for(var _0x1b2449=0x0;_0x1b2449<_0x1d3fcf['query'][_0x63da('0x5f')][_0x63da('0x46')];_0x1b2449+=0x1){var _0x60c2f={'UserId':Number(_0x1d3fcf[_0x63da('0x4f')]['id'])};_0x60c2f[_['capitalize'](_0x1d3fcf['query']['channel'][_0x63da('0xa2')]())+_0x63da('0xa5')]=Number(_0x1d3fcf[_0x63da('0x43')][_0x63da('0x5f')][_0x1b2449]);socket[_0x63da('0xb3')]('user'+_['capitalize'](_0x1d3fcf[_0x63da('0x43')]['channel'][_0x63da('0xa2')]())+'Queue:remove',_0x60c2f);}}else{var _0x60c2f={'UserId':Number(_0x1d3fcf[_0x63da('0x4f')]['id'])};_0x60c2f[_['capitalize'](_0x1d3fcf[_0x63da('0x43')][_0x63da('0xb1')][_0x63da('0xa2')]())+_0x63da('0xa5')]=Number(_0x1d3fcf[_0x63da('0x43')][_0x63da('0x5f')]);socket[_0x63da('0xb3')](_0x63da('0x2c')+_[_0x63da('0xa1')](_0x1d3fcf[_0x63da('0x43')][_0x63da('0xb1')][_0x63da('0xa2')]())+_0x63da('0xb4'),_0x60c2f);}return _0x32f708;})[_0x63da('0x13')](function(){if(_0x1d3fcf[_0x63da('0x43')][_0x63da('0xb1')]===_0x63da('0xa6')){return db[_0x63da('0xae')][_0x63da('0x29')]({'where':{'UserId':_0x1d3fcf[_0x63da('0x4f')]['id'],'VoiceQueueId':_0x1d3fcf[_0x63da('0x43')][_0x63da('0x5f')]},'individualHooks':!![]})['then'](function(){return _0x19fc86;});}return _0x19fc86;})[_0x63da('0x13')](respondWithStatusCode(_0x4d9e4e,null))[_0x63da('0x1e')](handleError(_0x4d9e4e,null));};exports[_0x63da('0xb5')]=function(_0x4ae159,_0x2d79c0){_0x4ae159[_0x63da('0x5c')][_0x63da('0xb6')]=_0x4ae159[_0x63da('0xb7')][_0x63da('0xb8')];return db[_0x63da('0x40')][_0x63da('0x32')]({'where':{'id':_0x4ae159['params']['id']}})[_0x63da('0x13')](handleEntityNotFound(_0x2d79c0,null))[_0x63da('0x13')](saveUpdates(_0x4ae159['body'],null))[_0x63da('0x13')](respondWithResult(_0x2d79c0,null))['catch'](handleError(_0x2d79c0,null));};exports['getAvatar']=function(_0x5d1f5d,_0x405c69){var _0x37925f=path[_0x63da('0xb9')](config[_0x63da('0xba')],_0x63da('0xbb'));return db[_0x63da('0x40')][_0x63da('0x32')]({'where':{'id':_0x5d1f5d['params']['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x405c69,null))[_0x63da('0x13')](function(_0xf4f879){if(_0xf4f879){if(_[_0x63da('0x65')](_0xf4f879[_0x63da('0xb6')])){return _0x405c69[_0x63da('0xbc')](_0x37925f);}else{if(!fs[_0x63da('0xbd')](path[_0x63da('0xb9')](config[_0x63da('0xba')],'server/files/images/',_0xf4f879[_0x63da('0xb6')]))){return _0x405c69['download'](_0x37925f);}return _0x405c69[_0x63da('0xbc')](path[_0x63da('0xb9')](config['root'],_0x63da('0xbe'),_0xf4f879[_0x63da('0xb6')]));}}})[_0x63da('0x1e')](handleError(_0x405c69,null));};exports['getOpenTabs']=function(_0x62df58,_0x13239b){return db[_0x63da('0x40')][_0x63da('0x32')]({'where':{'id':_0x62df58[_0x63da('0x4f')]['id']},'attributes':['id']})[_0x63da('0x13')](handleEntityNotFound(_0x13239b,null))[_0x63da('0x13')](function(_0x587ec5){var _0x711851=[];values=_0x587ec5['dataValues'];_0x711851[_0x63da('0x47')](get_open_tabs(_0x63da('0x48'),_0x587ec5['dataValues']));_0x711851['push'](get_open_tabs(_0x63da('0x5a'),_0x587ec5[_0x63da('0x49')]));_0x711851[_0x63da('0x47')](get_open_tabs('openchannel',_0x587ec5[_0x63da('0x49')]));_0x711851['push'](get_open_tabs(_0x63da('0x4c'),_0x587ec5['dataValues']));_0x711851[_0x63da('0x47')](get_open_tabs(_0x63da('0x4a'),_0x587ec5[_0x63da('0x49')]));_0x711851['push'](get_open_tabs('mail',_0x587ec5[_0x63da('0x49')]));return BPromise[_0x63da('0x4d')](_0x711851);})['then'](function(_0x4c4ceb){var _0x21cfd1=[];if(_0x4c4ceb){for(var _0x4305f9=0x0;_0x4305f9=_0x5657ef){_0x3474b6=_0x5657ef;_0xdced80=0xc8;}else{_0xdced80=0xce;}_0x3c2353['status'](_0xdced80);return _0x3c2353['set'](_0x88cc('0x27'),_0x337bab+'-'+_0x3474b6+'/'+_0x5657ef)[_0x88cc('0x22')](_0xcf454c);}return null;};}function saveUpdates(_0x1c1d57){return function(_0x5b77ae){if(_0x5b77ae){return _0x5b77ae['update'](_0x1c1d57)[_0x88cc('0x15')](function(_0x2cc552){return _0x2cc552;});}return null;};}function removeEntity(_0x5511b9){return function(_0x3d2e96){if(_0x3d2e96){return _0x3d2e96[_0x88cc('0x28')]()[_0x88cc('0x15')](function(){var _0x5edea2=_0x3d2e96[_0x88cc('0x29')]({'plain':!![]});if(_0x5edea2[_0x88cc('0x2a')]===_0x88cc('0x2b'))return;var _0x59b4c5=[{'name':_0x88cc('0x2c'),'value':_0x88cc('0x2d'),'ignore':!![]},{'name':_0x88cc('0x2e'),'value':_0x88cc('0x2f'),'ignore':![]},{'name':_0x88cc('0x30'),'value':_0x88cc('0x31'),'ignore':![]}];var _0x5628d9=_(_0x59b4c5)[_0x88cc('0x32')](_0x88cc('0x33'))[_0x88cc('0x34')](_0x88cc('0x35'))[_0x88cc('0x35')]();if(_[_0x88cc('0x36')](_0x5628d9,_0x5edea2[_0x88cc('0x2a')])){return;}var _0x579a1f=_['find'](_0x59b4c5,[_0x88cc('0x35'),_0x5edea2[_0x88cc('0x2a')]])[_0x88cc('0x37')];return db[_0x88cc('0x38')][_0x88cc('0x28')]({'where':{'type':_0x579a1f,'resourceId':_0x5edea2['id']}})['then'](function(){return _0x3d2e96;});})[_0x88cc('0x15')](function(){_0x5511b9[_0x88cc('0x21')](0xcc)[_0x88cc('0x39')]();});}};}function handleEntityNotFound(_0x3baf9f){return function(_0x2bb05b){if(!_0x2bb05b){_0x3baf9f[_0x88cc('0x20')](0x194);}return _0x2bb05b;};}function handleError(_0x263ca2,_0x46fb4b){_0x46fb4b=_0x46fb4b||0x1f4;return function(_0x2841e7){logger[_0x88cc('0x1c')](_0x2841e7[_0x88cc('0x3a')]);if(_0x2841e7[_0x88cc('0x37')]){delete _0x2841e7['name'];}_0x263ca2[_0x88cc('0x21')](_0x46fb4b)[_0x88cc('0x3b')](_0x2841e7);};}exports['index']=function(_0x30bdd2,_0x47f4da){var _0x54be38={},_0x5278f2={'count':0x0,'rows':[]};var _0x2beb74=_(db['User'][_0x88cc('0x3c')])[_0x88cc('0x34')](function(_0x57bc5c){return{'name':_0x57bc5c[_0x88cc('0x3d')],'type':_0x57bc5c['type'][_0x88cc('0x3e')]};})['filter'](function(_0x31270f){return!_['includes']([_0x88cc('0x3f'),_0x88cc('0x40')],_0x31270f[_0x88cc('0x37')]);})[_0x88cc('0x35')]();_0x54be38=qs['getOptions'](_0x2beb74,_0x30bdd2);var _0x237423={'where':_0x54be38['where']};return db[_0x88cc('0x41')][_0x88cc('0x26')](_0x237423)[_0x88cc('0x15')](function(_0x1d58a6){_0x5278f2[_0x88cc('0x26')]=_0x1d58a6;if(_0x30bdd2[_0x88cc('0x42')][_0x88cc('0x43')]){_0x54be38[_0x88cc('0x44')]=[{'all':!![]}];}if(!_[_0x88cc('0x36')](_0x54be38['attributes'],'id')){_0x54be38[_0x88cc('0x45')][_0x88cc('0x46')]('id');}return db[_0x88cc('0x41')]['findAll'](_0x54be38);})[_0x88cc('0x15')](function(_0x37ad9f){_0x5278f2[_0x88cc('0x47')]=_0x37ad9f;if(_0x30bdd2['query'][_0x88cc('0x48')]===_0x88cc('0x49')){var _0x328f4b=[];for(var _0xbca88c=0x0;_0xbca88c<_0x5278f2[_0x88cc('0x47')]['length'];_0xbca88c++){_0x328f4b[_0x88cc('0x46')](get_open_tabs(_0x88cc('0x4a'),_0x5278f2[_0x88cc('0x47')][_0xbca88c][_0x88cc('0x4b')]));_0x328f4b[_0x88cc('0x46')](get_open_tabs('sms',_0x5278f2[_0x88cc('0x47')][_0xbca88c]['dataValues']));_0x328f4b['push'](get_open_tabs(_0x88cc('0x4c'),_0x5278f2[_0x88cc('0x47')][_0xbca88c]['dataValues']));_0x328f4b['push'](get_open_tabs(_0x88cc('0x4d'),_0x5278f2[_0x88cc('0x47')][_0xbca88c][_0x88cc('0x4b')]));_0x328f4b[_0x88cc('0x46')](get_open_tabs('openchannel',_0x5278f2[_0x88cc('0x47')][_0xbca88c][_0x88cc('0x4b')]));_0x328f4b[_0x88cc('0x46')](get_open_tabs(_0x88cc('0x4e'),_0x5278f2[_0x88cc('0x47')][_0xbca88c][_0x88cc('0x4b')]));}return BPromise[_0x88cc('0x4f')](_0x328f4b)[_0x88cc('0x15')](function(_0x14e889){return _0x5278f2;});}else{return _0x5278f2;}})[_0x88cc('0x15')](respondWithFilteredResult(_0x47f4da,_0x54be38))[_0x88cc('0x1f')](handleError(_0x47f4da,null));};exports['show']=function(_0x42d75d,_0x421571){var _0x16816b={'raw':![],'where':{'id':_0x42d75d[_0x88cc('0x50')]['id']}},_0x5690d2={};_0x5690d2[_0x88cc('0x51')]=_['differenceBy'](_[_0x88cc('0x52')](db[_0x88cc('0x41')][_0x88cc('0x3c')]),[_0x88cc('0x3f'),'salt']);_0x5690d2[_0x88cc('0x42')]=_[_0x88cc('0x52')](_0x42d75d['query']);_0x5690d2[_0x88cc('0x53')]=_[_0x88cc('0x54')](_0x5690d2[_0x88cc('0x51')],_0x5690d2[_0x88cc('0x42')]);_0x16816b[_0x88cc('0x45')]=_[_0x88cc('0x54')](_0x5690d2[_0x88cc('0x51')],qs[_0x88cc('0x55')](_0x42d75d[_0x88cc('0x42')][_0x88cc('0x55')]));_0x16816b[_0x88cc('0x45')]=_0x16816b[_0x88cc('0x45')][_0x88cc('0x56')]?_0x16816b[_0x88cc('0x45')]:_0x5690d2[_0x88cc('0x51')];if(_0x42d75d[_0x88cc('0x42')][_0x88cc('0x43')]){_0x16816b['include']=[{'all':!![]}];}_0x16816b=_[_0x88cc('0x57')]({},_0x16816b,_0x42d75d[_0x88cc('0x58')]);if(!_['includes'](_0x16816b['attributes'],'id')){_0x16816b[_0x88cc('0x45')][_0x88cc('0x46')]('id');}return db[_0x88cc('0x41')]['find'](_0x16816b)['then'](handleEntityNotFound(_0x421571,null))[_0x88cc('0x15')](function(_0x225e4f){var _0x36547c=[];values=_0x225e4f;if(_0x42d75d[_0x88cc('0x42')][_0x88cc('0x48')]===_0x88cc('0x49')){_0x36547c['push'](get_open_tabs(_0x88cc('0x4a'),_0x225e4f[_0x88cc('0x4b')]));_0x36547c[_0x88cc('0x46')](get_open_tabs(_0x88cc('0x59'),_0x225e4f[_0x88cc('0x4b')]));_0x36547c[_0x88cc('0x46')](get_open_tabs(_0x88cc('0x5a'),_0x225e4f[_0x88cc('0x4b')]));_0x36547c['push'](get_open_tabs(_0x88cc('0x4e'),_0x225e4f[_0x88cc('0x4b')]));_0x36547c['push'](get_open_tabs(_0x88cc('0x4c'),_0x225e4f[_0x88cc('0x4b')]));_0x36547c[_0x88cc('0x46')](get_open_tabs(_0x88cc('0x4d'),_0x225e4f[_0x88cc('0x4b')]));return BPromise[_0x88cc('0x4f')](_0x36547c);}else{return values;}})['then'](function(_0x4f5a8b){return values;})[_0x88cc('0x15')](respondWithResult(_0x421571,null))['catch'](handleError(_0x421571,null));};exports[_0x88cc('0x5b')]=function(_0x484f99,_0x2db0a6){if(_0x484f99[_0x88cc('0x5c')]['id']){delete _0x484f99[_0x88cc('0x5c')]['id'];}delete _0x484f99[_0x88cc('0x5c')][_0x88cc('0x2a')];return db[_0x88cc('0x41')][_0x88cc('0x5d')]({'where':{'id':_0x484f99[_0x88cc('0x50')]['id']}})['then'](handleEntityNotFound(_0x2db0a6,null))['then'](saveUpdates(_0x484f99[_0x88cc('0x5c')],null))[_0x88cc('0x15')](respondWithResult(_0x2db0a6,null))[_0x88cc('0x1f')](handleError(_0x2db0a6,null));};exports['describe']=function(_0xacce64,_0x28d577){return db[_0x88cc('0x41')]['describe']()[_0x88cc('0x15')](respondWithResult(_0x28d577,null))[_0x88cc('0x1f')](handleError(_0x28d577,null));};exports[_0x88cc('0x5e')]=function(_0x50ce77,_0x2f856a){return db[_0x88cc('0x41')][_0x88cc('0x5d')]({'where':{'id':_0x50ce77[_0x88cc('0x50')]['id']}})[_0x88cc('0x15')](handleEntityNotFound(_0x2f856a,null))[_0x88cc('0x15')](function(_0x1f37ac){if(_0x1f37ac){return _0x1f37ac[_0x88cc('0x5e')](_0x50ce77['body'][_0x88cc('0x5f')],_['omit'](_0x50ce77[_0x88cc('0x5c')],[_0x88cc('0x5f'),'id'])||{});}})[_0x88cc('0x15')](respondWithResult(_0x2f856a,null))[_0x88cc('0x1f')](handleError(_0x2f856a,null));};function validateUser(_0x41dddd){return new BPromise(function(_0x38411f,_0x2b3727){if(_0x41dddd['internal'])return _0x38411f(_0x41dddd);return db[_0x88cc('0x60')]['findById'](0x1)[_0x88cc('0x15')](function(_0x351c94){if(_0x351c94[_0x88cc('0x61')])authService['validatePasswordPattern'](_0x41dddd[_0x88cc('0x3f')]);db['User'][_0x88cc('0x62')](_0x88cc('0x63'))['then'](function(_0x5a0fa1){if(_[_0x88cc('0x64')](_0x5a0fa1)){_0x41dddd[_0x88cc('0x63')]=_0x351c94[_0x88cc('0x65')]||0x1;return;}if(_[_0x88cc('0x64')](_0x351c94[_0x88cc('0x65')])||_0x351c94[_0x88cc('0x65')]===_0x5a0fa1){_0x41dddd[_0x88cc('0x63')]=_0x5a0fa1+0x1;return;}if(_0x351c94[_0x88cc('0x65')]>_0x5a0fa1){_0x41dddd['internal']=_0x351c94[_0x88cc('0x65')];return;}return db[_0x88cc('0x66')][_0x88cc('0x42')](_0x88cc('0x67'),{'type':db[_0x88cc('0x66')]['QueryTypes'][_0x88cc('0x68')]})[_0x88cc('0x15')](function(_0x3857ad){if(_0x3857ad&&_0x3857ad[_0x88cc('0x56')]){for(var _0x1cba60=0x0,_0x126672=_0x3857ad[_0x88cc('0x56')];_0x1cba60<_0x126672&&_['isNil'](_0x41dddd[_0x88cc('0x63')]);_0x1cba60++){if(_0x351c94[_0x88cc('0x65')]<=_0x3857ad[_0x1cba60][_0x88cc('0x69')]){_0x41dddd[_0x88cc('0x63')]=_0x3857ad[_0x1cba60][_0x88cc('0x69')];}else if(_0x351c94[_0x88cc('0x65')]>_0x3857ad[_0x1cba60][_0x88cc('0x69')]&&_0x351c94[_0x88cc('0x65')]<=_0x3857ad[_0x1cba60]['to']){_0x41dddd['internal']=_0x351c94[_0x88cc('0x65')];}}}if(_[_0x88cc('0x64')](_0x41dddd[_0x88cc('0x63')])){_0x41dddd[_0x88cc('0x63')]=_0x5a0fa1+0x1;}return _0x38411f(_0x41dddd);});});})['catch'](function(_0x333c3c){_0x2b3727(_0x333c3c);});});}function updateUser(_0x5936f8){return new BPromise(function(_0x2591cb,_0x3ab943){try{if(_0x5936f8[_0x88cc('0x6a')]){_0x5936f8[_0x88cc('0x6b')]=_0x5936f8[_0x88cc('0x63')];_0x5936f8[_0x88cc('0x6c')]={'mailbox':_0x5936f8[_0x88cc('0x63')],'password':_0x5936f8[_0x88cc('0x3f')],'fullname':_0x5936f8['fullname'],'email':_0x5936f8['email']};}if(_0x5936f8['role']===_0x88cc('0x2f')){if(!_0x5936f8[_0x88cc('0x6d')])_0x5936f8['permissions']=[_0x88cc('0x6e'),_0x88cc('0x6f'),_0x88cc('0x70'),_0x88cc('0x71'),_0x88cc('0x72'),'104',_0x88cc('0x73'),'106',_0x88cc('0x74'),_0x88cc('0x75'),'109',_0x88cc('0x76'),_0x88cc('0x77'),_0x88cc('0x78'),_0x88cc('0x79')];}_0x2591cb(_0x5936f8);}catch(_0x12e449){_0x3ab943(_0x12e449);}});}exports[_0x88cc('0x7a')]=function(_0x46cd60,_0x1dc30d){if(_0x46cd60[_0x88cc('0x2d')][_0x88cc('0x2a')]==='agent')throw new Error('Unauthorized');if(_0x46cd60[_0x88cc('0x5c')][_0x88cc('0x2a')]===_0x88cc('0x2d')&&_0x46cd60[_0x88cc('0x2d')][_0x88cc('0x2a')]!==_0x88cc('0x2b')){throw new Error(_0x88cc('0x7b'));}if(_0x46cd60[_0x88cc('0x5c')][_0x88cc('0x2a')]===_0x88cc('0x2b')&&_0x46cd60[_0x88cc('0x2d')]['role']!==_0x88cc('0x2b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil['checkUserLimits']([_0x46cd60[_0x88cc('0x5c')]])[_0x88cc('0x15')](function(){return validateUser(_0x46cd60['body']);})['then'](function(_0x39f48d){return updateUser(_0x39f48d)['then'](function(_0x28d7d6){if(_0x28d7d6[_0x88cc('0x2a')]==='admin'){_0x28d7d6[_0x88cc('0x7c')]=_0x46cd60['user'][_0x88cc('0x7c')];delete _0x28d7d6['userProfileId'];}return _0x28d7d6;});})[_0x88cc('0x15')](function(_0xd5e338){return db[_0x88cc('0x41')]['create'](_0xd5e338,{'include':[{'model':db[_0x88cc('0x6c')],'as':_0x88cc('0x6c')}]});})[_0x88cc('0x15')](function(_0x44b7ca){if(_0x46cd60[_0x88cc('0x5c')][_0x88cc('0x2a')]==='user')return _0x44b7ca;if(_0x46cd60[_0x88cc('0x2d')][_0x88cc('0x2a')]!==_0x88cc('0x2d'))return _0x44b7ca;return db[_0x88cc('0x7d')][_0x88cc('0x5d')]({'where':{'name':_0x44b7ca['role']===_0x88cc('0x2f')?'Agents':_0x88cc('0x30'),'userProfileId':_0x46cd60[_0x88cc('0x2d')][_0x88cc('0x7e')]},'raw':!![]})[_0x88cc('0x15')](function(_0x42d58d){if(!_0x42d58d||_0x42d58d[_0x88cc('0x7f')]!=0x0)return _0x44b7ca;return db['UserProfileResource'][_0x88cc('0x7a')]({'name':_0x44b7ca[_0x88cc('0x37')],'resourceId':_0x44b7ca['id'],'type':_0x42d58d[_0x88cc('0x37')],'sectionId':_0x42d58d['id']},{})[_0x88cc('0x15')](function(){return _0x44b7ca;});})[_0x88cc('0x1f')](function(_0x125aa3){logger['error'](_0x88cc('0x80'),_0x125aa3);throw _0x125aa3;});})[_0x88cc('0x15')](respondWithResult(_0x1dc30d,0xc9))[_0x88cc('0x1f')](handleError(_0x1dc30d,null));};exports['bulkCreate']=function(_0x19b187,_0xa6f1ee){var _0x5caa1c=_0x19b187[_0x88cc('0x5c')];var _0x1f5716=[];if(_0x19b187[_0x88cc('0x2d')][_0x88cc('0x2a')]===_0x88cc('0x2f'))throw new Error('Unauthorized');if(_[_0x88cc('0x81')](_0x5caa1c,[_0x88cc('0x2a'),_0x88cc('0x2d')])&&_0x19b187[_0x88cc('0x2d')]['role']!==_0x88cc('0x2b')){throw new Error(_0x88cc('0x7b'));}if(_['some'](_0x5caa1c,[_0x88cc('0x2a'),_0x88cc('0x2b')])&&_0x19b187['user'][_0x88cc('0x2a')]!==_0x88cc('0x2b')){throw new Error(_0x88cc('0x82'));}return licenseUtil[_0x88cc('0x83')](_0x5caa1c)[_0x88cc('0x15')](function(){return validateUser(_0x5caa1c[0x0]);})[_0x88cc('0x15')](function(){for(var _0x9bad0c=0x1;_0x9bad0c<_0x5caa1c[_0x88cc('0x56')];_0x9bad0c++){var _0x2859d3=_0x5caa1c[_0x9bad0c-0x1][_0x88cc('0x63')];if(!_0x5caa1c[_0x9bad0c]['internal'])_0x5caa1c[_0x9bad0c]['internal']=_0x2859d3+0x1;_0x1f5716[_0x88cc('0x46')](validateUser(_0x5caa1c[_0x9bad0c]));}return BPromise['all'](_0x1f5716);})['then'](function(){_0x1f5716=[];for(var _0x559e10=0x0;_0x559e10<_0x5caa1c[_0x88cc('0x56')];_0x559e10++){_0x1f5716[_0x88cc('0x46')](updateUser(_0x5caa1c[_0x559e10]));}return BPromise[_0x88cc('0x4f')](_0x1f5716);})[_0x88cc('0x15')](function(){return BPromise[_0x88cc('0x84')](_0x5caa1c,function(_0x366c70){return db[_0x88cc('0x41')][_0x88cc('0x7a')](_0x366c70,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})['then'](function(_0x2a0470){_0x366c70['id']=_0x2a0470['id'];return _0x366c70;});});})[_0x88cc('0x15')](function(_0xfd11b7){if(_0x19b187[_0x88cc('0x5c')]['role']==='user')return _0xfd11b7;if(_0x19b187[_0x88cc('0x2d')]['role']!=='user')return _0xfd11b7;var _0x405eef=_['some'](_0xfd11b7,function(_0x4b87fe){return _0x4b87fe[_0x88cc('0x2a')]===_0x88cc('0x2f')||_0x4b87fe[_0x88cc('0x2a')]===_0x88cc('0x31');});if(!_0x405eef)return _0xfd11b7;return db[_0x88cc('0x7d')]['findAll']({'where':{'name':{'$or':['Agents',_0x88cc('0x30')]},'userProfileId':_0x19b187['user']['userProfileId']},'raw':!![]})[_0x88cc('0x15')](function(_0x5c7b55){if(_[_0x88cc('0x85')](_0x5c7b55)||!_['some'](_0x5c7b55,[_0x88cc('0x7f'),0x0]))return _0xfd11b7;_0x1f5716=[];var _0x49fe56=_(_0x5c7b55)[_0x88cc('0x34')](function(_0x3f175f){if(_0x3f175f[_0x88cc('0x7f')]===0x1)return;return _0x3f175f[_0x88cc('0x37')]==='Agents'?_0x88cc('0x2f'):_0x88cc('0x31');})['compact']()['value']();for(var _0x5170e7=0x0;_0x5170e7<_0xfd11b7['length'];_0x5170e7++){if(!_['includes'](_0x49fe56,_0xfd11b7[_0x5170e7]['role']))return;var _0x373468=_0xfd11b7[_0x5170e7][_0x88cc('0x2a')]===_0x88cc('0x2f')?'Agents':_0x88cc('0x30');_0x1f5716[_0x88cc('0x46')](db[_0x88cc('0x38')]['create']({'name':_0xfd11b7[_0x5170e7][_0x88cc('0x37')],'resourceId':_0xfd11b7[_0x5170e7]['id'],'type':_0x373468,'sectionId':_[_0x88cc('0x5d')](_0x5c7b55,[_0x88cc('0x37'),_0x373468])['id']},{}));}return BPromise['all'](_0x1f5716);});})[_0x88cc('0x15')](respondWithResult(_0xa6f1ee,0xc9))[_0x88cc('0x1f')](handleError(_0xa6f1ee,null));};exports[_0x88cc('0x86')]=function(_0x12405f,_0x57abc9){if(_0x12405f[_0x88cc('0x5c')]['id']){delete _0x12405f[_0x88cc('0x5c')]['id'];}return db[_0x88cc('0x41')][_0x88cc('0x5d')]({'where':{'id':_0x12405f[_0x88cc('0x50')]['id']}})['then'](function(_0x183ca6){if(!_0x183ca6)return null;if(_0x183ca6['id']===_0x12405f['user']['id']){if(!_0x12405f['body'][_0x88cc('0x87')]||!_0x12405f[_0x88cc('0x5c')]['newPassword']){throw new db[(_0x88cc('0x88'))]['ValidationError'](_0x88cc('0x89'));}if(!_0x183ca6[_0x88cc('0x8a')](_0x12405f['body'][_0x88cc('0x87')])){throw new db['Sequelize'][(_0x88cc('0x8b'))](_0x88cc('0x8c'));}if(_0x12405f[_0x88cc('0x5c')][_0x88cc('0x87')]===_0x12405f[_0x88cc('0x5c')][_0x88cc('0x8d')]){throw new db[(_0x88cc('0x88'))]['ValidationError'](_0x88cc('0x8e'));}}else if(_0x12405f['user'][_0x88cc('0x2a')]===_0x88cc('0x2b')){if(!_0x12405f[_0x88cc('0x5c')][_0x88cc('0x8d')]){throw new db[(_0x88cc('0x88'))]['ValidationError'](_0x88cc('0x8f'));}}else if(_0x12405f[_0x88cc('0x2d')][_0x88cc('0x2a')]==='user'){if(!_0x12405f['body']['newPassword']){throw new db[(_0x88cc('0x88'))]['ValidationError'](_0x88cc('0x8f'));}if(_0x183ca6['role']!==_0x88cc('0x2f')){throw new db[(_0x88cc('0x88'))][(_0x88cc('0x8b'))]('Unauthorized');}}else{throw new db[(_0x88cc('0x88'))][(_0x88cc('0x8b'))](_0x88cc('0x90'));}return _0x183ca6;})[_0x88cc('0x15')](handleEntityNotFound(_0x57abc9,null))[_0x88cc('0x15')](function(_0x19488b){return db[_0x88cc('0x60')][_0x88cc('0x91')]({'attributes':['id',_0x88cc('0x61'),_0x88cc('0x92'),_0x88cc('0x93')]})[_0x88cc('0x15')](function(_0x2efd33){if(_0x2efd33[_0x88cc('0x61')])authService['validatePasswordPattern'](_0x12405f[_0x88cc('0x5c')][_0x88cc('0x8d')]);if(!_0x2efd33[_0x88cc('0x92')]||!_0x19488b[_0x88cc('0x94')])return _0x19488b;authService['validatePasswordHistory'](_0x12405f[_0x88cc('0x5c')][_0x88cc('0x8d')],_0x19488b[_0x88cc('0x94')],_0x2efd33[_0x88cc('0x93')]);return _0x19488b;})[_0x88cc('0x15')](saveUpdates({'password':_0x12405f[_0x88cc('0x5c')][_0x88cc('0x8d')],'passwordResetAt':_0x12405f[_0x88cc('0x2d')]['id']==_0x12405f[_0x88cc('0x50')]['id']?moment():null,'previousPasswords':authService[_0x88cc('0x95')](_0x12405f['body'][_0x88cc('0x8d')],_0x19488b[_0x88cc('0x94')])},null));})['then'](respondWithResult(_0x57abc9,null))[_0x88cc('0x1f')](handleError(_0x57abc9,null));};exports['addQueues']=function(_0x49d0f4,_0x2d69e2){var _0x38964f=_0x49d0f4['body'][_0x88cc('0x96')];return db[_0x88cc('0x41')][_0x88cc('0x5d')]({'where':{'id':_0x49d0f4[_0x88cc('0x50')]['id']},'attributes':['id','name','role',_0x88cc('0x97'),'loginInPause','voicePause',_0x88cc('0x98')]})[_0x88cc('0x15')](handleEntityNotFound(_0x2d69e2,null))[_0x88cc('0x15')](function(_0x88aa95){if(_0x88aa95){if(!utils[_0x88cc('0x99')](_0x38964f)){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}return _0x88aa95[_0x88cc('0x9a')+_[_0x88cc('0x9b')](_0x38964f[_0x88cc('0x9c')]())+_0x88cc('0x9d')](_0x49d0f4[_0x88cc('0x5c')][_0x88cc('0x5f')],{'penalty':_0x49d0f4[_0x88cc('0x5c')]['penalty']||0x0})['spread'](function(_0x301beb){for(var _0x3e5ae5=0x0;_0x3e5ae5<_0x49d0f4['body'][_0x88cc('0x5f')][_0x88cc('0x56')];_0x3e5ae5+=0x1){var _0x449cf8={'UserId':Number(_0x49d0f4[_0x88cc('0x50')]['id'])};_0x449cf8[_[_0x88cc('0x9b')](_0x38964f[_0x88cc('0x9c')]())+_0x88cc('0x9e')]=Number(_0x49d0f4[_0x88cc('0x5c')]['ids'][_0x3e5ae5]);socket[_0x88cc('0x9f')](_0x88cc('0x2d')+_[_0x88cc('0x9b')](_0x38964f[_0x88cc('0x9c')]())+'Queue:save',_0x449cf8);}return _0x301beb;})[_0x88cc('0x15')](function(){if(_0x38964f==='voice'){return db['VoiceQueue'][_0x88cc('0xa0')]({'where':{'id':_0x49d0f4[_0x88cc('0x5c')][_0x88cc('0x5f')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x88cc('0x15')](function(_0x50516e){var _0xc91526=_0x88aa95[_0x88cc('0x29')]({'plain':!![]});var _0x5c1023=[];if(_0x38964f===_0x88cc('0xa1')&&_0xc91526[_0x88cc('0x2a')]===_0x88cc('0x2f')&&_0xc91526['online']){for(var _0x27550c=0x0;_0x27550c<_0x50516e[_0x88cc('0x56')];_0x27550c+=0x1){_0x5c1023[_0x88cc('0x46')]({'membername':_0xc91526[_0x88cc('0x37')],'UserId':_0xc91526['id'],'queue_name':_0x50516e[_0x27550c]['name'],'VoiceQueueId':_0x50516e[_0x27550c]['id'],'interface':_[_0x88cc('0x64')](_0xc91526[_0x88cc('0x98')])?util[_0x88cc('0xa2')]('SIP/%s',_0xc91526[_0x88cc('0x37')]):_0xc91526['interface'],'paused':_0xc91526[_0x88cc('0xa3')]||![],'penalty':_0x49d0f4[_0x88cc('0x5c')][_0x88cc('0xa4')]||0x0});}return BPromise[_0x88cc('0x84')](_0x5c1023,function(_0xfa913c){return db[_0x88cc('0xa5')][_0x88cc('0xa6')](_0xfa913c);});}return _0x88aa95;});}})[_0x88cc('0x15')](respondWithStatusCode(_0x2d69e2,null))['catch'](handleError(_0x2d69e2,null));};exports[_0x88cc('0xa7')]=function(_0x41debd,_0x2f2864){var _0x2b949c;return db[_0x88cc('0x41')][_0x88cc('0x5d')]({'where':{'id':_0x41debd[_0x88cc('0x50')]['id']},'attributes':['id',_0x88cc('0x37'),_0x88cc('0x2a')]})['then'](handleEntityNotFound(_0x2f2864,null))[_0x88cc('0x15')](function(_0x3be117){if(_0x3be117){_0x2b949c=_0x3be117;if(!_0x41debd[_0x88cc('0x42')]['channel']||!utils[_0x88cc('0x99')](_0x41debd[_0x88cc('0x42')][_0x88cc('0x96')])){throw new db[(_0x88cc('0x88'))][(_0x88cc('0x8b'))](_0x88cc('0xa8'));}return _0x3be117[_0x88cc('0xa9')+_[_0x88cc('0x9b')](_0x41debd[_0x88cc('0x42')]['channel'][_0x88cc('0x9c')]())+_0x88cc('0x9d')](_0x41debd[_0x88cc('0x42')][_0x88cc('0x5f')]);}})[_0x88cc('0x15')](function(_0x1bc3cb){if(_[_0x88cc('0xaa')](_0x41debd[_0x88cc('0x42')]['ids'])){for(var _0xbc48f=0x0;_0xbc48f<_0x41debd[_0x88cc('0x42')]['ids'][_0x88cc('0x56')];_0xbc48f+=0x1){var _0x12a7a3={'UserId':Number(_0x41debd[_0x88cc('0x50')]['id'])};_0x12a7a3[_[_0x88cc('0x9b')](_0x41debd[_0x88cc('0x42')][_0x88cc('0x96')][_0x88cc('0x9c')]())+_0x88cc('0x9e')]=Number(_0x41debd[_0x88cc('0x42')]['ids'][_0xbc48f]);socket[_0x88cc('0x9f')]('user'+_[_0x88cc('0x9b')](_0x41debd[_0x88cc('0x42')][_0x88cc('0x96')][_0x88cc('0x9c')]())+_0x88cc('0xab'),_0x12a7a3);}}else{var _0x12a7a3={'UserId':Number(_0x41debd[_0x88cc('0x50')]['id'])};_0x12a7a3[_[_0x88cc('0x9b')](_0x41debd[_0x88cc('0x42')][_0x88cc('0x96')][_0x88cc('0x9c')]())+_0x88cc('0x9e')]=Number(_0x41debd[_0x88cc('0x42')][_0x88cc('0x5f')]);socket[_0x88cc('0x9f')]('user'+_[_0x88cc('0x9b')](_0x41debd['query']['channel'][_0x88cc('0x9c')]())+_0x88cc('0xab'),_0x12a7a3);}return _0x1bc3cb;})['then'](function(){if(_0x41debd['query']['channel']===_0x88cc('0xa1')){return db['UserVoiceQueueRt']['destroy']({'where':{'UserId':_0x41debd['params']['id'],'VoiceQueueId':_0x41debd[_0x88cc('0x42')]['ids']},'individualHooks':!![]})[_0x88cc('0x15')](function(){return _0x2b949c;});}return _0x2b949c;})[_0x88cc('0x15')](respondWithStatusCode(_0x2f2864,null))[_0x88cc('0x1f')](handleError(_0x2f2864,null));};exports['addAvatar']=function(_0x45048b,_0x22d812){_0x45048b['body'][_0x88cc('0xac')]=_0x45048b['file']['filename'];return db[_0x88cc('0x41')][_0x88cc('0x5d')]({'where':{'id':_0x45048b[_0x88cc('0x50')]['id']}})['then'](handleEntityNotFound(_0x22d812,null))['then'](saveUpdates(_0x45048b[_0x88cc('0x5c')],null))[_0x88cc('0x15')](respondWithResult(_0x22d812,null))[_0x88cc('0x1f')](handleError(_0x22d812,null));};exports[_0x88cc('0xad')]=function(_0x4eec09,_0x238775){var _0x58bccc=path[_0x88cc('0xae')](config[_0x88cc('0xaf')],_0x88cc('0xb0'));return db[_0x88cc('0x41')]['find']({'where':{'id':_0x4eec09[_0x88cc('0x50')]['id']},'attributes':['id',_0x88cc('0xac')],'raw':!![]})[_0x88cc('0x15')](handleEntityNotFound(_0x238775,null))[_0x88cc('0x15')](function(_0x45dcf3){if(_0x45dcf3){if(_[_0x88cc('0x64')](_0x45dcf3['userpic'])){return _0x238775[_0x88cc('0xb1')](_0x58bccc);}else{if(!fs['existsSync'](path[_0x88cc('0xae')](config['root'],_0x88cc('0xb2'),_0x45dcf3[_0x88cc('0xac')]))){return _0x238775[_0x88cc('0xb1')](_0x58bccc);}return _0x238775[_0x88cc('0xb1')](path[_0x88cc('0xae')](config[_0x88cc('0xaf')],_0x88cc('0xb2'),_0x45dcf3[_0x88cc('0xac')]));}}})[_0x88cc('0x1f')](handleError(_0x238775,null));};exports[_0x88cc('0xb3')]=function(_0x58b267,_0x46d602){return db[_0x88cc('0x41')][_0x88cc('0x5d')]({'where':{'id':_0x58b267['params']['id']},'attributes':['id']})[_0x88cc('0x15')](handleEntityNotFound(_0x46d602,null))[_0x88cc('0x15')](function(_0x2a7f17){var _0x751b55=[];values=_0x2a7f17[_0x88cc('0x4b')];_0x751b55[_0x88cc('0x46')](get_open_tabs(_0x88cc('0x4a'),_0x2a7f17[_0x88cc('0x4b')]));_0x751b55[_0x88cc('0x46')](get_open_tabs(_0x88cc('0x59'),_0x2a7f17['dataValues']));_0x751b55[_0x88cc('0x46')](get_open_tabs(_0x88cc('0x5a'),_0x2a7f17[_0x88cc('0x4b')]));_0x751b55[_0x88cc('0x46')](get_open_tabs('whatsapp',_0x2a7f17[_0x88cc('0x4b')]));_0x751b55[_0x88cc('0x46')](get_open_tabs(_0x88cc('0x4c'),_0x2a7f17[_0x88cc('0x4b')]));_0x751b55['push'](get_open_tabs(_0x88cc('0x4d'),_0x2a7f17[_0x88cc('0x4b')]));return BPromise[_0x88cc('0x4f')](_0x751b55);})['then'](function(_0x3e7bcf){var _0x3b1f28=[];if(_0x3e7bcf){for(var _0x327b0e=0x0;_0x327b0e=_0x5cb3ff[_0xd337('0x55')]){throw new Error(_0xd337('0x56'));}})[_0xd337('0x26')](function(){if(_0x24bece){return db[_0xd337('0x41')][_0xd337('0x57')]({'where':{'membername':_0x24bece[_0xd337('0x2e')]},'individualHooks':!![]});}})['then'](function(){if(_0x24bece){return _0x24bece[_0xd337('0x58')]({'raw':!![]});}})[_0xd337('0x26')](function(_0x1b6d02){if(_0x24bece){if(_0x1b6d02){var _0x408754=[];_0x357568=_0x1b6d02;if(_0x357568[_0xd337('0x30')]){for(var _0x1ec134=0x0;_0x1ec134<_0x357568[_0xd337('0x30')];_0x1ec134++){_0x408754[_0xd337('0x33')](db[_0xd337('0x41')]['upsert']({'membername':_0x24bece[_0xd337('0x2e')],'UserId':_0x24bece['id'],'queue_name':_0x357568[_0x1ec134]['name'],'VoiceQueueId':_0x357568[_0x1ec134]['id'],'interface':_0x2493a0,'paused':_0x24bece[_0xd337('0x52')]||![],'penalty':_0x357568[_0x1ec134]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xd337('0x4f')](_0x408754);}}}})['then'](function(){if(_0x24bece){return db[_0xd337('0x2d')][_0xd337('0x1d')]({'where':{'membername':_0x24bece[_0xd337('0x2e')],'exitAt':null}});}})['then'](function(_0x38a734){if(_0x24bece){if(_0x38a734&&_0x38a734[_0xd337('0x30')]){var _0x43666c=[];_0x38a734[_0xd337('0x4c')](function(_0x466f36){_0x43666c[_0xd337('0x33')](_0x466f36[_0xd337('0x2c')]({'exitAt':moment()[_0xd337('0x31')](_0xd337('0x36'))}));});return BPromise['all'](_0x43666c);}}})[_0xd337('0x26')](function(_0x112c74){if(_0x24bece){var _0x5c0393=[];var _0x3f9268=[];var _0x57f627=utils['getChannels']();var _0x409b27={'membername':_0x24bece[_0xd337('0x2e')],'interface':_0x2493a0,'enterAt':moment()[_0xd337('0x31')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x24bece[_0xd337('0x2a')],'internal':_0x24bece['internal']};_0x57f627[_0xd337('0x4c')](function(_0xf6d3a1){_0x5c0393[_0xd337('0x33')](_[_0xd337('0x59')]({'channel':_0xf6d3a1,'type':_0xd337('0x5a'),'data1':_0xd337('0x5b'),'data2':_0x2493a0},_0x409b27));if(_0x24bece[_0xd337('0x52')]){_0x3f9268['push'](_[_0xd337('0x59')]({'channel':_0xf6d3a1,'type':_0xd337('0x2f'),'data1':'LOGININPAUSE'},_0x409b27));}});return db['MemberReport']['bulkCreate'](_0x5c0393[_0xd337('0x5c')](_0x3f9268),{'individualHooks':!![]});}})[_0xd337('0x26')](function(){if(_0x24bece){return _0x24bece[_0xd337('0x2c')]({'online':!![],'lastLoginAt':moment()[_0xd337('0x31')](_0xd337('0x36')),'voicePause':_0x24bece[_0xd337('0x52')]||![],'mailPause':_0x24bece[_0xd337('0x52')]||![],'chatPause':_0x24bece[_0xd337('0x52')]||![],'faxPause':_0x24bece[_0xd337('0x52')]||![],'smsPause':_0x24bece[_0xd337('0x52')]||![],'openchannelPause':_0x24bece[_0xd337('0x52')]||![],'pauseType':_0x24bece[_0xd337('0x52')]?_0xd337('0x5d'):null,'lastPauseAt':moment()['format'](_0xd337('0x36')),'interface':_0x2493a0});}})['then'](function(_0x213c77){_0x2afd25(_0x213c77);})[_0xd337('0x1a')](function(_0x4f39ce){_0x2910ae(_0x1b7e01[_0xd337('0x17')](0x1f4,_0x4f39ce['message']));});});}; \ No newline at end of file +var _0x5026=['User','findAll','options','raw','attributes','include','map','model','then','ShowUser','where','PauseUser','find','name','role','internal','interface','MemberReport','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','SIP/%s','body','type','DEFAULT\x20PAUSE','bulkCreate','update','UnpauseUser','findOne','channel','isValidChannel','Unknown\x20channel','UserVoiceQueueRt','system','sms','openchannel','whatsapp','set','%s%s','Pause','LogoutUser','destroy','all','LoginUser','phone','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','loginInPause','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./user.socket','register','request','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetUser'];(function(_0x16f742,_0x354373){var _0x1ac60f=function(_0xc7ca07){while(--_0xc7ca07){_0x16f742['push'](_0x16f742['shift']());}};_0x1ac60f(++_0x354373);}(_0x5026,0x159));var _0x6502=function(_0x1e55ae,_0x3f76ca){_0x1e55ae=_0x1e55ae-0x0;var _0x5f3ac7=_0x5026[_0x1e55ae];return _0x5f3ac7;};'use strict';var _=require(_0x6502('0x0'));var util=require(_0x6502('0x1'));var moment=require(_0x6502('0x2'));var BPromise=require('bluebird');var rs=require(_0x6502('0x3'));var fs=require('fs');var Redis=require(_0x6502('0x4'));var db=require(_0x6502('0x5'))['db'];var utils=require(_0x6502('0x6'));var logger=require(_0x6502('0x7'))(_0x6502('0x8'));var config=require(_0x6502('0x9'));var jayson=require(_0x6502('0xa'));var client=jayson[_0x6502('0xb')][_0x6502('0xc')]({'port':0x232a});config[_0x6502('0xd')]=_[_0x6502('0xe')](config[_0x6502('0xd')],{'host':_0x6502('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6502('0xd')]));require(_0x6502('0x10'))[_0x6502('0x11')](socket);function respondWithRpcPromise(_0x1efcb7,_0x10e2f8,_0x2808e3){return new BPromise(function(_0x57f5de,_0x3ae3c6){return client[_0x6502('0x12')](_0x1efcb7,_0x2808e3)['then'](function(_0x596916){logger[_0x6502('0x13')](_0x6502('0x14'),_0x10e2f8,_0x6502('0x15'));logger[_0x6502('0x16')](_0x6502('0x17'),_0x10e2f8,_0x6502('0x15'),JSON[_0x6502('0x18')](_0x596916));if(_0x596916[_0x6502('0x19')]){if(_0x596916[_0x6502('0x19')][_0x6502('0x1a')]===0x1f4){logger['error'](_0x6502('0x14'),_0x10e2f8,_0x596916[_0x6502('0x19')]['message']);return _0x3ae3c6(_0x596916['error']['message']);}logger[_0x6502('0x19')](_0x6502('0x14'),_0x10e2f8,_0x596916[_0x6502('0x19')][_0x6502('0x1b')]);return _0x57f5de(_0x596916['error'][_0x6502('0x1b')]);}else{logger[_0x6502('0x13')](_0x6502('0x14'),_0x10e2f8,'request\x20sent');_0x57f5de(_0x596916[_0x6502('0x1c')]['message']);}})[_0x6502('0x1d')](function(_0x1fe501){logger[_0x6502('0x19')](_0x6502('0x14'),_0x10e2f8,_0x1fe501);_0x3ae3c6(_0x1fe501);});});}exports[_0x6502('0x1e')]=function(_0x53d4b2){var _0x2ba4d5=this;return new Promise(function(_0x29158b,_0x5e6d4a){return db[_0x6502('0x1f')][_0x6502('0x20')]({'raw':_0x53d4b2['options']?_0x53d4b2[_0x6502('0x21')][_0x6502('0x22')]===undefined?!![]:![]:!![],'where':_0x53d4b2[_0x6502('0x21')]?_0x53d4b2[_0x6502('0x21')]['where']||null:null,'attributes':_0x53d4b2[_0x6502('0x21')]?_0x53d4b2['options'][_0x6502('0x23')]||null:null,'limit':_0x53d4b2[_0x6502('0x21')]?_0x53d4b2['options']['limit']||null:null,'include':_0x53d4b2[_0x6502('0x21')]?_0x53d4b2[_0x6502('0x21')][_0x6502('0x24')]?_[_0x6502('0x25')](_0x53d4b2[_0x6502('0x21')][_0x6502('0x24')],function(_0x5d8783){return{'model':db[_0x5d8783[_0x6502('0x26')]],'as':_0x5d8783['as'],'attributes':_0x5d8783['attributes'],'include':_0x5d8783[_0x6502('0x24')]?_['map'](_0x5d8783[_0x6502('0x24')],function(_0x199eba){return{'model':db[_0x199eba[_0x6502('0x26')]],'as':_0x199eba['as'],'attributes':_0x199eba[_0x6502('0x23')],'include':_0x199eba[_0x6502('0x24')]?_[_0x6502('0x25')](_0x199eba['include'],function(_0x4c0a2a){return{'model':db[_0x4c0a2a[_0x6502('0x26')]],'as':_0x4c0a2a['as'],'attributes':_0x4c0a2a[_0x6502('0x23')]};}):[]};}):[]};}):[]:[]})[_0x6502('0x27')](function(_0x234614){logger[_0x6502('0x13')](_0x6502('0x1e'),_0x53d4b2);logger[_0x6502('0x16')]('GetUser',_0x53d4b2,JSON[_0x6502('0x18')](_0x234614));_0x29158b(_0x234614);})[_0x6502('0x1d')](function(_0x23c8e3){logger[_0x6502('0x19')](_0x6502('0x1e'),_0x23c8e3[_0x6502('0x1b')],_0x53d4b2);_0x5e6d4a(_0x2ba4d5['error'](0x1f4,_0x23c8e3[_0x6502('0x1b')]));});});};exports[_0x6502('0x28')]=function(_0x14895a){var _0x299f0e=this;return new Promise(function(_0x53eac1,_0x3c38bc){return db[_0x6502('0x1f')]['find']({'raw':_0x14895a[_0x6502('0x21')]?_0x14895a[_0x6502('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x14895a['options']?_0x14895a[_0x6502('0x21')][_0x6502('0x29')]||null:null,'attributes':_0x14895a['options']?_0x14895a[_0x6502('0x21')]['attributes']||null:null,'include':_0x14895a[_0x6502('0x21')]?_0x14895a[_0x6502('0x21')][_0x6502('0x24')]?_['map'](_0x14895a[_0x6502('0x21')][_0x6502('0x24')],function(_0x771607){return{'model':db[_0x771607['model']],'as':_0x771607['as'],'attributes':_0x771607[_0x6502('0x23')],'include':_0x771607[_0x6502('0x24')]?_['map'](_0x771607[_0x6502('0x24')],function(_0x290bbb){return{'model':db[_0x290bbb['model']],'as':_0x290bbb['as'],'attributes':_0x290bbb['attributes'],'include':_0x290bbb[_0x6502('0x24')]?_[_0x6502('0x25')](_0x290bbb['include'],function(_0x189bdb){return{'model':db[_0x189bdb[_0x6502('0x26')]],'as':_0x189bdb['as'],'attributes':_0x189bdb[_0x6502('0x23')]};}):[]};}):[]};}):[]:[]})[_0x6502('0x27')](function(_0x22eb61){logger[_0x6502('0x13')](_0x6502('0x28'),_0x14895a);logger['debug'](_0x6502('0x28'),_0x14895a,JSON['stringify'](_0x22eb61));_0x53eac1(_0x22eb61);})['catch'](function(_0x38b371){logger[_0x6502('0x19')]('ShowUser',_0x38b371[_0x6502('0x1b')],_0x14895a);_0x3c38bc(_0x299f0e['error'](0x1f4,_0x38b371[_0x6502('0x1b')]));});});};exports[_0x6502('0x2a')]=function(_0x4b46e4){var _0x2e70d5=this;return new Promise(function(_0x3ef46f,_0x2f64de){var _0x1dfcc4;return db[_0x6502('0x1f')][_0x6502('0x2b')]({'where':_0x4b46e4[_0x6502('0x21')]['where']||{},'attributes':['id',_0x6502('0x2c'),_0x6502('0x2d'),_0x6502('0x2e'),_0x6502('0x2f')]})[_0x6502('0x27')](function(_0x2c26b4){if(_0x2c26b4){_0x1dfcc4=_0x2c26b4;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x1dfcc4['id']},'individualHooks':!![]});}})[_0x6502('0x27')](function(){if(_0x1dfcc4){return db[_0x6502('0x30')]['findAll']({'where':{'membername':_0x1dfcc4[_0x6502('0x2c')],'type':_0x6502('0x31'),'exitAt':null}});}})[_0x6502('0x27')](function(_0x16dd96){if(_0x1dfcc4){if(_0x16dd96&&_0x16dd96[_0x6502('0x32')]){var _0xd74f8c=moment()[_0x6502('0x33')](_0x6502('0x34'));for(var _0x2d2767=0x0,_0x32f0e8=_0x16dd96[_0x6502('0x32')];_0x2d2767<_0x32f0e8;_0x2d2767++){_0x16dd96[_0x2d2767][_0x6502('0x35')]({'exitAt':_0xd74f8c});}}}})[_0x6502('0x27')](function(){if(_0x1dfcc4){var _0x1f1960=[];var _0x92d0bf=utils[_0x6502('0x36')]();_0x92d0bf[_0x6502('0x37')](function(_0x98e374){_0x1f1960[_0x6502('0x38')]({'channel':_0x98e374,'membername':_0x1dfcc4['name'],'interface':_['isNil'](_0x1dfcc4[_0x6502('0x2f')])?util[_0x6502('0x33')](_0x6502('0x39'),_0x1dfcc4[_0x6502('0x2c')]):_0x1dfcc4[_0x6502('0x2f')],'type':'PAUSE','enterAt':moment()[_0x6502('0x33')](_0x6502('0x34')),'data1':_0x4b46e4[_0x6502('0x3a')][_0x6502('0x3b')]||_0x6502('0x3c'),'role':_0x1dfcc4['role'],'internal':_0x1dfcc4['internal'],'uniqueid':_0x4b46e4[_0x6502('0x3a')]['uniqueid']||null});});return db[_0x6502('0x30')][_0x6502('0x3d')](_0x1f1960,{'individualHooks':!![]});}})[_0x6502('0x27')](function(){if(_0x1dfcc4){return _0x1dfcc4[_0x6502('0x3e')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x4b46e4[_0x6502('0x3a')][_0x6502('0x3b')]||_0x6502('0x3c'),'lastPauseAt':moment()[_0x6502('0x33')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x6502('0x27')](function(_0x4d20dd){_0x3ef46f(_0x4d20dd);})['catch'](function(_0x580770){_0x2f64de(_0x2e70d5['error'](0x1f4,_0x580770[_0x6502('0x1b')]));});});};exports[_0x6502('0x3f')]=function(_0x244dda){var _0x44eeb0=this;return new Promise(function(_0x1db33e,_0x5344e7){var _0x4b9042;return db[_0x6502('0x1f')][_0x6502('0x40')]({'where':_0x244dda[_0x6502('0x21')][_0x6502('0x29')]||{},'attributes':['id','name']})[_0x6502('0x27')](function(_0x2bb5a3){if(_0x2bb5a3){_0x4b9042=_0x2bb5a3;if(_0x244dda[_0x6502('0x3a')][_0x6502('0x41')]&&!utils[_0x6502('0x42')](_0x244dda['body'][_0x6502('0x41')])){throw new Error(_0x6502('0x43'));}switch(_0x244dda[_0x6502('0x3a')][_0x6502('0x41')]){case'voice':return db[_0x6502('0x44')]['update']({'paused':0x0},{'where':{'UserId':_0x4b9042['id']}})[_0x6502('0x27')](function(){return db[_0x6502('0x30')][_0x6502('0x2b')]({'where':{'channel':_0x244dda[_0x6502('0x3a')]['channel'],'membername':_0x4b9042['name'],'type':_0x6502('0x31'),'exitAt':null}});})[_0x6502('0x27')](function(_0x199f5b){if(_0x199f5b){return _0x199f5b[_0x6502('0x3e')]({'exitAt':moment()[_0x6502('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x6502('0x45')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x4b9042[_0x6502('0x3e')]({'voicePause':![]});});case'mail':case'chat':case'fax':case _0x6502('0x46'):case _0x6502('0x47'):case _0x6502('0x48'):return db[_0x6502('0x30')]['find']({'where':{'channel':_0x244dda[_0x6502('0x3a')]['channel'],'membername':_0x4b9042[_0x6502('0x2c')],'type':_0x6502('0x31'),'exitAt':null}})[_0x6502('0x27')](function(_0xeb6a94){return _0xeb6a94[_0x6502('0x3e')]({'exitAt':moment()['format'](_0x6502('0x34')),'data2':_0x6502('0x45')},{'individualHooks':!![]});})[_0x6502('0x27')](function(){var _0x4923c1={};_[_0x6502('0x49')](_0x4923c1,util[_0x6502('0x33')](_0x6502('0x4a'),_0x244dda[_0x6502('0x3a')][_0x6502('0x41')],_0x6502('0x4b')),![]);return _0x4b9042['update'](_0x4923c1);});default:return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x4b9042['id']}})['then'](function(){return db[_0x6502('0x30')][_0x6502('0x20')]({'where':{'membername':_0x4b9042[_0x6502('0x2c')],'type':_0x6502('0x31'),'exitAt':null}});})['then'](function(_0x5058e8){var _0x288c41=[];_0x5058e8[_0x6502('0x37')](function(_0x11ec0e){_0x288c41[_0x6502('0x38')](_0x11ec0e[_0x6502('0x3e')]({'exitAt':moment()[_0x6502('0x33')](_0x6502('0x34')),'data2':_0x6502('0x45')}));});return BPromise['all'](_0x288c41);})['then'](function(){return _0x4b9042[_0x6502('0x3e')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x6502('0x27')](function(_0x4c8b3b){_0x1db33e(_0x4c8b3b);})['catch'](function(_0x337085){_0x5344e7(_0x44eeb0[_0x6502('0x19')](0x1f4,_0x337085[_0x6502('0x1b')]));});});};exports[_0x6502('0x4c')]=function(_0xfdf844){var _0x5a59fc=this;return new Promise(function(_0x5852c7,_0x91628c){var _0x66af82;return db['User']['findOne']({'where':_0xfdf844['options'][_0x6502('0x29')]||{},'attributes':['id','name']})[_0x6502('0x27')](function(_0x578b70){if(_0x578b70){_0x66af82=_0x578b70;return db['UserVoiceQueueRt'][_0x6502('0x4d')]({'where':{'membername':_0x66af82['name']},'individualHooks':!![]});}})['then'](function(){if(_0x66af82){return db['MemberReport'][_0x6502('0x20')]({'where':{'membername':_0x66af82[_0x6502('0x2c')],'exitAt':null}});}})['then'](function(_0x553d35){if(_0x66af82){if(_0x553d35&&_0x553d35[_0x6502('0x32')]){var _0x570aa1=[];_0x553d35[_0x6502('0x37')](function(_0x553429){_0x570aa1[_0x6502('0x38')](_0x553429[_0x6502('0x3e')]({'exitAt':moment()[_0x6502('0x33')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x6502('0x4e')](_0x570aa1);}}})[_0x6502('0x27')](function(){if(_0x66af82){return _0x66af82[_0x6502('0x3e')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x6502('0x27')](function(_0x5d2d10){_0x5852c7(_0x5d2d10);})[_0x6502('0x1d')](function(_0x36bd74){_0x91628c(_0x5a59fc[_0x6502('0x19')](0x1f4,_0x36bd74[_0x6502('0x1b')]));});});};exports[_0x6502('0x4f')]=function(_0x30baa7){var _0x462aa9=this;return new Promise(function(_0x5a858e,_0x370578){var _0x28f075;var _0x2cc09d;var _0x3a3112;var _0xe905ac;return db[_0x6502('0x1f')][_0x6502('0x40')]({'where':_0x30baa7['options'][_0x6502('0x29')]||{},'attributes':['id',_0x6502('0x2c'),_0x6502('0x2d'),'mobile',_0x6502('0x50'),_0x6502('0x2e'),'loginInPause',_0x6502('0x2f')]})[_0x6502('0x27')](function(_0x5cbf4c){if(_0x5cbf4c){_0x28f075=_0x5cbf4c;_0xe905ac=_0x30baa7[_0x6502('0x3a')][_0x6502('0x2f')]?_0x30baa7[_0x6502('0x3a')][_0x6502('0x2f')]:util[_0x6502('0x33')](_0x6502('0x39'),_0x28f075['name']);return db[_0x6502('0x1f')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x28f075['id']}}});}})['then'](function(_0x126421){if(_0x126421){_0x3a3112=_0x126421;return require(_0x6502('0x51'))[_0x6502('0x52')]();}})[_0x6502('0x27')](function(_0xda604b){if(_0xda604b&&_0xda604b['agents']&&_0x3a3112>=_0xda604b[_0x6502('0x53')]){throw new Error(_0x6502('0x54'));}})['then'](function(){if(_0x28f075){return db['UserVoiceQueueRt'][_0x6502('0x4d')]({'where':{'membername':_0x28f075['name']},'individualHooks':!![]});}})['then'](function(){if(_0x28f075){return _0x28f075[_0x6502('0x55')]({'raw':!![]});}})[_0x6502('0x27')](function(_0x18ea62){if(_0x28f075){if(_0x18ea62){var _0x55988d=[];_0x2cc09d=_0x18ea62;if(_0x2cc09d[_0x6502('0x32')]){for(var _0x247026=0x0;_0x247026<_0x2cc09d[_0x6502('0x32')];_0x247026++){_0x55988d[_0x6502('0x38')](db[_0x6502('0x44')][_0x6502('0x56')]({'membername':_0x28f075[_0x6502('0x2c')],'UserId':_0x28f075['id'],'queue_name':_0x2cc09d[_0x247026][_0x6502('0x2c')],'VoiceQueueId':_0x2cc09d[_0x247026]['id'],'interface':_0xe905ac,'paused':_0x28f075[_0x6502('0x57')]||![],'penalty':_0x2cc09d[_0x247026][_0x6502('0x58')]||0x0}));}return BPromise[_0x6502('0x4e')](_0x55988d);}}}})[_0x6502('0x27')](function(){if(_0x28f075){return db[_0x6502('0x30')][_0x6502('0x20')]({'where':{'membername':_0x28f075[_0x6502('0x2c')],'exitAt':null}});}})['then'](function(_0x480825){if(_0x28f075){if(_0x480825&&_0x480825[_0x6502('0x32')]){var _0x255ff5=[];_0x480825['forEach'](function(_0x483458){_0x255ff5[_0x6502('0x38')](_0x483458[_0x6502('0x3e')]({'exitAt':moment()['format'](_0x6502('0x34'))}));});return BPromise[_0x6502('0x4e')](_0x255ff5);}}})[_0x6502('0x27')](function(_0x17776c){if(_0x28f075){var _0x5a3835=[];var _0x5e3bfc=[];var _0x5b8852=utils['getChannels']();var _0x5a7eb9={'membername':_0x28f075[_0x6502('0x2c')],'interface':_0xe905ac,'enterAt':moment()[_0x6502('0x33')](_0x6502('0x34')),'role':_0x28f075[_0x6502('0x2d')],'internal':_0x28f075[_0x6502('0x2e')]};_0x5b8852[_0x6502('0x37')](function(_0x1e02f3){_0x5a3835[_0x6502('0x38')](_[_0x6502('0x59')]({'channel':_0x1e02f3,'type':_0x6502('0x5a'),'data1':_0x6502('0x5b'),'data2':_0xe905ac},_0x5a7eb9));if(_0x28f075[_0x6502('0x57')]){_0x5e3bfc[_0x6502('0x38')](_[_0x6502('0x59')]({'channel':_0x1e02f3,'type':_0x6502('0x31'),'data1':_0x6502('0x5c')},_0x5a7eb9));}});return db[_0x6502('0x30')][_0x6502('0x3d')](_0x5a3835[_0x6502('0x5d')](_0x5e3bfc),{'individualHooks':!![]});}})['then'](function(){if(_0x28f075){return _0x28f075[_0x6502('0x3e')]({'online':!![],'lastLoginAt':moment()[_0x6502('0x33')](_0x6502('0x34')),'voicePause':_0x28f075['loginInPause']||![],'mailPause':_0x28f075['loginInPause']||![],'chatPause':_0x28f075[_0x6502('0x57')]||![],'faxPause':_0x28f075[_0x6502('0x57')]||![],'smsPause':_0x28f075['loginInPause']||![],'openchannelPause':_0x28f075['loginInPause']||![],'pauseType':_0x28f075[_0x6502('0x57')]?_0x6502('0x5c'):null,'lastPauseAt':moment()[_0x6502('0x33')](_0x6502('0x34')),'interface':_0xe905ac});}})[_0x6502('0x27')](function(_0x3485aa){_0x5a858e(_0x3485aa);})['catch'](function(_0x481574){_0x370578(_0x462aa9[_0x6502('0x19')](0x1f4,_0x481574['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index e8bb93d..7619c88 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 _0x98ca=['save','update','removeListener','register','user:','./user.events'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0x98ca,0x15b));var _0xa98c=function(_0x49aa1a,_0x5a2302){_0x49aa1a=_0x49aa1a-0x0;var _0x2ab62a=_0x98ca[_0x49aa1a];return _0x2ab62a;};'use strict';var UserEvents=require(_0xa98c('0x0'));var events=[_0xa98c('0x1'),'remove',_0xa98c('0x2')];function createListener(_0x332c08,_0x1ce45d){return function(_0x28d1a4){_0x1ce45d['emit'](_0x332c08,_0x28d1a4);};}function removeListener(_0x28026b,_0x4c16d0){return function(){UserEvents[_0xa98c('0x3')](_0x28026b,_0x4c16d0);};}exports[_0xa98c('0x4')]=function(_0xb19fee){for(var _0x4f1546=0x0,_0x510eb3=events['length'];_0x4f1546<_0x510eb3;_0x4f1546++){var _0xeeae0a=events[_0x4f1546];var _0x5eb914=createListener(_0xa98c('0x5')+_0xeeae0a,_0xb19fee);UserEvents['on'](_0xeeae0a,_0x5eb914);}}; \ No newline at end of file +var _0x558f=['save','update','emit','removeListener','register','user:','./user.events'];(function(_0x31a37b,_0x826249){var _0x49ae16=function(_0x2e8d52){while(--_0x2e8d52){_0x31a37b['push'](_0x31a37b['shift']());}};_0x49ae16(++_0x826249);}(_0x558f,0xed));var _0xf558=function(_0x1bace4,_0x47f3d7){_0x1bace4=_0x1bace4-0x0;var _0x47ec01=_0x558f[_0x1bace4];return _0x47ec01;};'use strict';var UserEvents=require(_0xf558('0x0'));var events=[_0xf558('0x1'),'remove',_0xf558('0x2')];function createListener(_0x153f10,_0x5ebc4a){return function(_0x1ffa26){_0x5ebc4a[_0xf558('0x3')](_0x153f10,_0x1ffa26);};}function removeListener(_0x389714,_0x3a5782){return function(){UserEvents[_0xf558('0x4')](_0x389714,_0x3a5782);};}exports[_0xf558('0x5')]=function(_0xa730eb){for(var _0x314ff6=0x0,_0x5c9163=events['length'];_0x314ff6<_0x5c9163;_0x314ff6++){var _0x185cb3=events[_0x314ff6];var _0x30ee92=createListener(_0xf558('0x6')+_0x185cb3,_0xa730eb);UserEvents['on'](_0x185cb3,_0x30ee92);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 562f53a..c5b6199 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(_0x8495da,_0x431a31){var _0x205387=function(_0x86d1b6){while(--_0x86d1b6){_0x8495da['push'](_0x8495da['shift']());}};_0x205387(++_0x431a31);}(_0x70e0,0x17b));var _0x070e=function(_0x2885f1,_0x2645c6){_0x2885f1=_0x2885f1-0x0;var _0x349663=_0x70e0[_0x2885f1];return _0x349663;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x46efd7,_0x43f84d){var _0x5637e4=function(_0x54e078){while(--_0x54e078){_0x46efd7['push'](_0x46efd7['shift']());}};_0x5637e4(++_0x43f84d);}(_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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 438ea72..92bb546 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 _0xafa3=['INTEGER'];(function(_0x575fdc,_0x50c603){var _0x36c057=function(_0x5bfc7b){while(--_0x5bfc7b){_0x575fdc['push'](_0x575fdc['shift']());}};_0x36c057(++_0x50c603);}(_0xafa3,0x174));var _0x3afa=function(_0x11eb1f,_0x826f0b){_0x11eb1f=_0x11eb1f-0x0;var _0x2121e9=_0xafa3[_0x11eb1f];return _0x2121e9;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x3afa('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdebb=['INTEGER','exports'];(function(_0x57c8de,_0x4e354c){var _0x1c9326=function(_0x4e272d){while(--_0x4e272d){_0x57c8de['push'](_0x57c8de['shift']());}};_0x1c9326(++_0x4e354c);}(_0xdebb,0x13f));var _0xbdeb=function(_0x4b7a7c,_0x4e13ad){_0x4b7a7c=_0x4b7a7c-0x0;var _0x54ebf0=_0xdebb[_0x4b7a7c];return _0x54ebf0;};'use strict';var Sequelize=require('sequelize');module[_0xbdeb('0x0')]={'penalty':{'type':Sequelize[_0xbdeb('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 6574d11..b0ced8d 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 _0xe008=['bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','user_has_chat_queues','lodash','util','../../config/logger','api'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe008,0xf3));var _0x8e00=function(_0x5c8e6e,_0x3faa0e){_0x5c8e6e=_0x5c8e6e-0x0;var _0x1c3734=_0xe008[_0x5c8e6e];return _0x1c3734;};'use strict';var _=require(_0x8e00('0x0'));var util=require(_0x8e00('0x1'));var logger=require(_0x8e00('0x2'))(_0x8e00('0x3'));var moment=require('moment');var BPromise=require(_0x8e00('0x4'));var rp=require(_0x8e00('0x5'));var fs=require('fs');var path=require(_0x8e00('0x6'));var rimraf=require(_0x8e00('0x7'));var config=require(_0x8e00('0x8'));var attributes=require(_0x8e00('0x9'));module[_0x8e00('0xa')]=function(_0xe0469,_0x4c90a6){return _0xe0469[_0x8e00('0xb')]('UserChatQueue',attributes,{'tableName':_0x8e00('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb886=['user_has_chat_queues','lodash','bluebird','path','rimraf','../../config/environment','./userChatQueue.attributes','define'];(function(_0x403ec8,_0x579d9c){var _0x21515e=function(_0x3a12b0){while(--_0x3a12b0){_0x403ec8['push'](_0x403ec8['shift']());}};_0x21515e(++_0x579d9c);}(_0xb886,0xc1));var _0x6b88=function(_0x3f304c,_0x3f53cd){_0x3f304c=_0x3f304c-0x0;var _0x103feb=_0xb886[_0x3f304c];return _0x103feb;};'use strict';var _=require(_0x6b88('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x6b88('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6b88('0x2'));var rimraf=require(_0x6b88('0x3'));var config=require(_0x6b88('0x4'));var attributes=require(_0x6b88('0x5'));module['exports']=function(_0x452d5c,_0x4e7b21){return _0x452d5c[_0x6b88('0x6')]('UserChatQueue',attributes,{'tableName':_0x6b88('0x7'),'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 4eee520..dbfdff8 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 _0xc00e=['UserChatQueue,\x20%s,\x20%s','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x50b148,_0x198a78){var _0x371a7a=function(_0x5ab93f){while(--_0x5ab93f){_0x50b148['push'](_0x50b148['shift']());}};_0x371a7a(++_0x198a78);}(_0xc00e,0xdd));var _0xec00=function(_0x523615,_0x11ae42){_0x523615=_0x523615-0x0;var _0x5ef9b3=_0xc00e[_0x523615];return _0x5ef9b3;};'use strict';var _=require(_0xec00('0x0'));var util=require(_0xec00('0x1'));var moment=require('moment');var BPromise=require(_0xec00('0x2'));var rs=require(_0xec00('0x3'));var fs=require('fs');var Redis=require(_0xec00('0x4'));var db=require(_0xec00('0x5'))['db'];var utils=require(_0xec00('0x6'));var logger=require('../../config/logger')(_0xec00('0x7'));var config=require(_0xec00('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xec00('0x9')][_0xec00('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22408f,_0xc5ea4a,_0x5c7dd7){return new BPromise(function(_0x2efad7,_0x13e6bf){return client[_0xec00('0xb')](_0x22408f,_0x5c7dd7)[_0xec00('0xc')](function(_0xa42d1c){logger[_0xec00('0xd')]('UserChatQueue,\x20%s,\x20%s',_0xc5ea4a,_0xec00('0xe'));logger[_0xec00('0xf')](_0xec00('0x10'),_0xc5ea4a,_0xec00('0xe'),JSON[_0xec00('0x11')](_0xa42d1c));if(_0xa42d1c[_0xec00('0x12')]){if(_0xa42d1c['error'][_0xec00('0x13')]===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0xc5ea4a,_0xa42d1c[_0xec00('0x12')][_0xec00('0x14')]);return _0x13e6bf(_0xa42d1c['error'][_0xec00('0x14')]);}logger[_0xec00('0x12')](_0xec00('0x15'),_0xc5ea4a,_0xa42d1c['error'][_0xec00('0x14')]);return _0x2efad7(_0xa42d1c[_0xec00('0x12')]['message']);}else{logger[_0xec00('0xd')](_0xec00('0x15'),_0xc5ea4a,_0xec00('0xe'));_0x2efad7(_0xa42d1c['result']['message']);}})['catch'](function(_0x186972){logger[_0xec00('0x12')]('UserChatQueue,\x20%s,\x20%s',_0xc5ea4a,_0x186972);_0x13e6bf(_0x186972);});});} \ No newline at end of file +var _0xdb4d=['jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xdefbc3,_0x1ea49a){var _0x367798=function(_0x594678){while(--_0x594678){_0xdefbc3['push'](_0xdefbc3['shift']());}};_0x367798(++_0x1ea49a);}(_0xdb4d,0x72));var _0xddb4=function(_0x581f6d,_0x600d39){_0x581f6d=_0x581f6d-0x0;var _0x11f192=_0xdb4d[_0x581f6d];return _0x11f192;};'use strict';var _=require(_0xddb4('0x0'));var util=require(_0xddb4('0x1'));var moment=require(_0xddb4('0x2'));var BPromise=require(_0xddb4('0x3'));var rs=require(_0xddb4('0x4'));var fs=require('fs');var Redis=require(_0xddb4('0x5'));var db=require(_0xddb4('0x6'))['db'];var utils=require(_0xddb4('0x7'));var logger=require(_0xddb4('0x8'))(_0xddb4('0x9'));var config=require(_0xddb4('0xa'));var jayson=require(_0xddb4('0xb'));var client=jayson[_0xddb4('0xc')][_0xddb4('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3c5e01,_0x28d02b,_0x3cb87f){return new BPromise(function(_0x53a8c2,_0x5984e1){return client[_0xddb4('0xe')](_0x3c5e01,_0x3cb87f)[_0xddb4('0xf')](function(_0x21b80f){logger[_0xddb4('0x10')](_0xddb4('0x11'),_0x28d02b,'request\x20sent');logger[_0xddb4('0x12')](_0xddb4('0x13'),_0x28d02b,'request\x20sent',JSON['stringify'](_0x21b80f));if(_0x21b80f['error']){if(_0x21b80f[_0xddb4('0x14')][_0xddb4('0x15')]===0x1f4){logger[_0xddb4('0x14')](_0xddb4('0x11'),_0x28d02b,_0x21b80f['error'][_0xddb4('0x16')]);return _0x5984e1(_0x21b80f['error'][_0xddb4('0x16')]);}logger[_0xddb4('0x14')]('UserChatQueue,\x20%s,\x20%s',_0x28d02b,_0x21b80f[_0xddb4('0x14')][_0xddb4('0x16')]);return _0x53a8c2(_0x21b80f[_0xddb4('0x14')]['message']);}else{logger[_0xddb4('0x10')](_0xddb4('0x11'),_0x28d02b,'request\x20sent');_0x53a8c2(_0x21b80f[_0xddb4('0x17')][_0xddb4('0x16')]);}})[_0xddb4('0x18')](function(_0x133f06){logger[_0xddb4('0x14')]('UserChatQueue,\x20%s,\x20%s',_0x28d02b,_0x133f06);_0x5984e1(_0x133f06);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 8cdfa29..c811bf0 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x13ab7f,_0x35c4f9){var _0x28c68e=function(_0x570aea){while(--_0x570aea){_0x13ab7f['push'](_0x13ab7f['shift']());}};_0x28c68e(++_0x35c4f9);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5d0aeb,_0x33a0cf){var _0x4efe9b=function(_0x1f39ef){while(--_0x1f39ef){_0x5d0aeb['push'](_0x5d0aeb['shift']());}};_0x4efe9b(++_0x33a0cf);}(_0x70e0,0x17b));var _0x070e=function(_0xab5ece,_0x48e1f1){_0xab5ece=_0xab5ece-0x0;var _0x1f84a3=_0x70e0[_0xab5ece];return _0x1f84a3;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 4bf930e..5677a4d 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 _0x7580=['STRING','sequelize','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7580,0x1ed));var _0x0758=function(_0x4c80a6,_0x405a07){_0x4c80a6=_0x4c80a6-0x0;var _0xee6071=_0x7580[_0x4c80a6];return _0xee6071;};'use strict';var Sequelize=require(_0x0758('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x0758('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x0758('0x2')]}}; \ No newline at end of file +var _0x0d26=['exports','INTEGER','STRING','sequelize'];(function(_0x462695,_0x2a8cf0){var _0x49c1d1=function(_0x3043e5){while(--_0x3043e5){_0x462695['push'](_0x462695['shift']());}};_0x49c1d1(++_0x2a8cf0);}(_0x0d26,0x14f));var _0x60d2=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x0d26[_0x580576];return _0x3f55a0;};'use strict';var Sequelize=require(_0x60d2('0x0'));module[_0x60d2('0x1')]={'penalty':{'type':Sequelize[_0x60d2('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x60d2('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x60d2('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 2da683e..a45dca6 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 _0x6221=['api','moment','bluebird','request-promise','path','rimraf','./userFaxQueue.attributes','define','UserFaxQueue','lodash','util','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6221,0xed));var _0x1622=function(_0x4e198a,_0x5a6bad){_0x4e198a=_0x4e198a-0x0;var _0xb84bfe=_0x6221[_0x4e198a];return _0xb84bfe;};'use strict';var _=require(_0x1622('0x0'));var util=require(_0x1622('0x1'));var logger=require(_0x1622('0x2'))(_0x1622('0x3'));var moment=require(_0x1622('0x4'));var BPromise=require(_0x1622('0x5'));var rp=require(_0x1622('0x6'));var fs=require('fs');var path=require(_0x1622('0x7'));var rimraf=require(_0x1622('0x8'));var config=require('../../config/environment');var attributes=require(_0x1622('0x9'));module['exports']=function(_0x58d8be,_0x59c3ef){return _0x58d8be[_0x1622('0xa')](_0x1622('0xb'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x210f=['exports','define','UserFaxQueue','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes'];(function(_0x8d6c19,_0x513845){var _0x10ad87=function(_0x2a8a68){while(--_0x2a8a68){_0x8d6c19['push'](_0x8d6c19['shift']());}};_0x10ad87(++_0x513845);}(_0x210f,0x1b3));var _0xf210=function(_0xa04413,_0x518cb3){_0xa04413=_0xa04413-0x0;var _0x5d2f2c=_0x210f[_0xa04413];return _0x5d2f2c;};'use strict';var _=require(_0xf210('0x0'));var util=require(_0xf210('0x1'));var logger=require(_0xf210('0x2'))('api');var moment=require(_0xf210('0x3'));var BPromise=require('bluebird');var rp=require(_0xf210('0x4'));var fs=require('fs');var path=require(_0xf210('0x5'));var rimraf=require(_0xf210('0x6'));var config=require(_0xf210('0x7'));var attributes=require(_0xf210('0x8'));module[_0xf210('0x9')]=function(_0x3e1737,_0x433a08){return _0x3e1737[_0xf210('0xa')](_0xf210('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 09f0a9b..8e55f35 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 _0xe016=['message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4b5c23,_0x101faa){var _0x262cfd=function(_0x48aa2a){while(--_0x48aa2a){_0x4b5c23['push'](_0x4b5c23['shift']());}};_0x262cfd(++_0x101faa);}(_0xe016,0xcc));var _0x6e01=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0xe016[_0x5a3cf0];return _0x5a64ee;};'use strict';var _=require(_0x6e01('0x0'));var util=require('util');var moment=require(_0x6e01('0x1'));var BPromise=require(_0x6e01('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6e01('0x3'));var db=require(_0x6e01('0x4'))['db'];var utils=require(_0x6e01('0x5'));var logger=require(_0x6e01('0x6'))(_0x6e01('0x7'));var config=require(_0x6e01('0x8'));var jayson=require(_0x6e01('0x9'));var client=jayson[_0x6e01('0xa')][_0x6e01('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b6b14,_0x459feb,_0x3b2d5a){return new BPromise(function(_0x4dfb47,_0x3f4e44){return client[_0x6e01('0xc')](_0x5b6b14,_0x3b2d5a)[_0x6e01('0xd')](function(_0x4f7c59){logger['info'](_0x6e01('0xe'),_0x459feb,_0x6e01('0xf'));logger[_0x6e01('0x10')](_0x6e01('0x11'),_0x459feb,_0x6e01('0xf'),JSON[_0x6e01('0x12')](_0x4f7c59));if(_0x4f7c59[_0x6e01('0x13')]){if(_0x4f7c59[_0x6e01('0x13')][_0x6e01('0x14')]===0x1f4){logger['error'](_0x6e01('0xe'),_0x459feb,_0x4f7c59[_0x6e01('0x13')][_0x6e01('0x15')]);return _0x3f4e44(_0x4f7c59[_0x6e01('0x13')][_0x6e01('0x15')]);}logger[_0x6e01('0x13')](_0x6e01('0xe'),_0x459feb,_0x4f7c59[_0x6e01('0x13')][_0x6e01('0x15')]);return _0x4dfb47(_0x4f7c59['error']['message']);}else{logger[_0x6e01('0x16')](_0x6e01('0xe'),_0x459feb,'request\x20sent');_0x4dfb47(_0x4f7c59[_0x6e01('0x17')][_0x6e01('0x15')]);}})[_0x6e01('0x18')](function(_0x395833){logger[_0x6e01('0x13')](_0x6e01('0xe'),_0x459feb,_0x395833);_0x3f4e44(_0x395833);});});} \ No newline at end of file +var _0xe4c3=['rpc','../../config/environment','jayson/promise','client','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1c0f3d,_0x55a9e2){var _0x4d71a8=function(_0xeff131){while(--_0xeff131){_0x1c0f3d['push'](_0x1c0f3d['shift']());}};_0x4d71a8(++_0x55a9e2);}(_0xe4c3,0x1ee));var _0x3e4c=function(_0x17b974,_0xe012f){_0x17b974=_0x17b974-0x0;var _0x3244dd=_0xe4c3[_0x17b974];return _0x3244dd;};'use strict';var _=require(_0x3e4c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3e4c('0x1'));var rs=require(_0x3e4c('0x2'));var fs=require('fs');var Redis=require(_0x3e4c('0x3'));var db=require(_0x3e4c('0x4'))['db'];var utils=require(_0x3e4c('0x5'));var logger=require('../../config/logger')(_0x3e4c('0x6'));var config=require(_0x3e4c('0x7'));var jayson=require(_0x3e4c('0x8'));var client=jayson[_0x3e4c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bf903,_0x376b5a,_0x15f9d6){return new BPromise(function(_0x1b37f9,_0x36b10b){return client[_0x3e4c('0xa')](_0x5bf903,_0x15f9d6)[_0x3e4c('0xb')](function(_0x5dce87){logger[_0x3e4c('0xc')](_0x3e4c('0xd'),_0x376b5a,_0x3e4c('0xe'));logger[_0x3e4c('0xf')](_0x3e4c('0x10'),_0x376b5a,_0x3e4c('0xe'),JSON[_0x3e4c('0x11')](_0x5dce87));if(_0x5dce87['error']){if(_0x5dce87['error']['code']===0x1f4){logger[_0x3e4c('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x376b5a,_0x5dce87[_0x3e4c('0x12')]['message']);return _0x36b10b(_0x5dce87[_0x3e4c('0x12')][_0x3e4c('0x13')]);}logger[_0x3e4c('0x12')](_0x3e4c('0xd'),_0x376b5a,_0x5dce87[_0x3e4c('0x12')][_0x3e4c('0x13')]);return _0x1b37f9(_0x5dce87[_0x3e4c('0x12')][_0x3e4c('0x13')]);}else{logger[_0x3e4c('0xc')](_0x3e4c('0xd'),_0x376b5a,_0x3e4c('0xe'));_0x1b37f9(_0x5dce87['result']['message']);}})['catch'](function(_0x586e44){logger[_0x3e4c('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x376b5a,_0x586e44);_0x36b10b(_0x586e44);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 20a5af7..66816e1 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3003bf,_0x4d4531){var _0x543559=function(_0x1a871d){while(--_0x1a871d){_0x3003bf['push'](_0x3003bf['shift']());}};_0x543559(++_0x4d4531);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x55d2b3,_0x20c0ff){var _0x488908=function(_0x8038d5){while(--_0x8038d5){_0x55d2b3['push'](_0x55d2b3['shift']());}};_0x488908(++_0x20c0ff);}(_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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 5a2b384..215e6e8 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 _0xaff8=['INTEGER','sequelize','exports'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0xaff8,0x1c6));var _0x8aff=function(_0x3d8ca8,_0x1a9764){_0x3d8ca8=_0x3d8ca8-0x0;var _0x517e45=_0xaff8[_0x3d8ca8];return _0x517e45;};'use strict';var Sequelize=require(_0x8aff('0x0'));module[_0x8aff('0x1')]={'penalty':{'type':Sequelize[_0x8aff('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xedc4=['exports','INTEGER','sequelize'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xedc4,0x13a));var _0x4edc=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xedc4[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x4edc('0x0'));module[_0x4edc('0x1')]={'penalty':{'type':Sequelize[_0x4edc('0x2')],'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 c676db1..29782b3 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 _0x1654=['define','UserMailQueue','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports'];(function(_0x15349f,_0x164701){var _0x5d770f=function(_0x5ee13f){while(--_0x5ee13f){_0x15349f['push'](_0x15349f['shift']());}};_0x5d770f(++_0x164701);}(_0x1654,0x17e));var _0x4165=function(_0x175c92,_0x28c731){_0x175c92=_0x175c92-0x0;var _0x44cc1b=_0x1654[_0x175c92];return _0x44cc1b;};'use strict';var _=require('lodash');var util=require(_0x4165('0x0'));var logger=require(_0x4165('0x1'))(_0x4165('0x2'));var moment=require(_0x4165('0x3'));var BPromise=require(_0x4165('0x4'));var rp=require(_0x4165('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4165('0x6'));var config=require('../../config/environment');var attributes=require('./userMailQueue.attributes');module[_0x4165('0x7')]=function(_0x53d196,_0xfd86ce){return _0x53d196[_0x4165('0x8')](_0x4165('0x9'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb512=['moment','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger'];(function(_0x1514dc,_0x4de402){var _0x72ca6=function(_0x2b8768){while(--_0x2b8768){_0x1514dc['push'](_0x1514dc['shift']());}};_0x72ca6(++_0x4de402);}(_0xb512,0x1dd));var _0x2b51=function(_0x2d0027,_0x23213c){_0x2d0027=_0x2d0027-0x0;var _0x7fbf1c=_0xb512[_0x2d0027];return _0x7fbf1c;};'use strict';var _=require(_0x2b51('0x0'));var util=require(_0x2b51('0x1'));var logger=require(_0x2b51('0x2'))('api');var moment=require(_0x2b51('0x3'));var BPromise=require('bluebird');var rp=require(_0x2b51('0x4'));var fs=require('fs');var path=require(_0x2b51('0x5'));var rimraf=require(_0x2b51('0x6'));var config=require(_0x2b51('0x7'));var attributes=require(_0x2b51('0x8'));module['exports']=function(_0x591878,_0x147852){return _0x591878[_0x2b51('0x9')](_0x2b51('0xa'),attributes,{'tableName':_0x2b51('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 1070abc..bf7cbdd 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 _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x7217,0x19e));var _0x7721=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x7217[_0x3e112d];return _0x531c31;};'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')]('UserMailQueue,\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']('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file +var _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x49a8ef,_0x2da913){var _0x316572=function(_0x8bffd9){while(--_0x8bffd9){_0x49a8ef['push'](_0x49a8ef['shift']());}};_0x316572(++_0x2da913);}(_0x8ef6,0xf2));var _0x68ef=function(_0x4e291c,_0x3d2678){_0x4e291c=_0x4e291c-0x0;var _0x4c9625=_0x8ef6[_0x4e291c];return _0x4c9625;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 15e3889..2eb64d6 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 _0xe7dd=['exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification'];(function(_0xef3ae2,_0x4c63b8){var _0x1cc22b=function(_0x4de2da){while(--_0x4de2da){_0xef3ae2['push'](_0xef3ae2['shift']());}};_0x1cc22b(++_0x4c63b8);}(_0xe7dd,0x1bb));var _0xde7d=function(_0x583dfd,_0x4a5251){_0x583dfd=_0x583dfd-0x0;var _0x1ecc79=_0xe7dd[_0x583dfd];return _0x1ecc79;};'use strict';var multer=require('multer');var util=require(_0xde7d('0x0'));var path=require(_0xde7d('0x1'));var timeout=require(_0xde7d('0x2'));var express=require('express');var router=express[_0xde7d('0x3')]();var fs_extra=require(_0xde7d('0x4'));var auth=require(_0xde7d('0x5'));var interaction=require(_0xde7d('0x6'));var config=require(_0xde7d('0x7'));var controller=require(_0xde7d('0x8'));router[_0xde7d('0x9')]('/',auth[_0xde7d('0xa')](),controller[_0xde7d('0xb')]);module[_0xde7d('0xc')]=router; \ No newline at end of file +var _0x0fc4=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','sendUserNotification','exports','multer'];(function(_0x17ef17,_0x1e9a56){var _0x2bb6c3=function(_0xf864df){while(--_0xf864df){_0x17ef17['push'](_0x17ef17['shift']());}};_0x2bb6c3(++_0x1e9a56);}(_0x0fc4,0x13f));var _0x40fc=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x0fc4[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require(_0x40fc('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x40fc('0x1'));var express=require(_0x40fc('0x2'));var router=express[_0x40fc('0x3')]();var fs_extra=require(_0x40fc('0x4'));var auth=require(_0x40fc('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x40fc('0x6'));var controller=require('./userNotification.controller');router['post']('/',auth[_0x40fc('0x7')](),controller[_0x40fc('0x8')]);module[_0x40fc('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 68de36d..ef864f0 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 _0x9f79=['TEXT','STRING','exports'];(function(_0x562aa9,_0x4ab1ce){var _0x23728e=function(_0x43f086){while(--_0x43f086){_0x562aa9['push'](_0x562aa9['shift']());}};_0x23728e(++_0x4ab1ce);}(_0x9f79,0x101));var _0x99f7=function(_0x5b2453,_0x1220d5){_0x5b2453=_0x5b2453-0x0;var _0x152105=_0x9f79[_0x5b2453];return _0x152105;};'use strict';var Sequelize=require('sequelize');module[_0x99f7('0x0')]={'body':{'type':Sequelize[_0x99f7('0x1')]},'senderName':{'type':Sequelize[_0x99f7('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x99f7('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0xfba2=['STRING','BOOLEAN','TEXT'];(function(_0x519c88,_0xb84103){var _0x4668d7=function(_0x596c2c){while(--_0x596c2c){_0x519c88['push'](_0x519c88['shift']());}};_0x4668d7(++_0xb84103);}(_0xfba2,0x1df));var _0x2fba=function(_0x2eb13f,_0x2e1b1a){_0x2eb13f=_0x2eb13f-0x0;var _0x2d073e=_0xfba2[_0x2eb13f];return _0x2d073e;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x2fba('0x0')]},'senderName':{'type':Sequelize[_0x2fba('0x1')]},'recipientsId':{'type':Sequelize[_0x2fba('0x0')]},'recipientsDescription':{'type':Sequelize[_0x2fba('0x1')]},'beep':{'type':Sequelize[_0x2fba('0x2')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 83a30f6..424e6c2 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 _0x95e9=['voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','userNotification:send','catch','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','User','union','ids','queue','replace','Queue','push','all','getAgents','map','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','name','sendUserNotification','hasOwnProperty','text','body','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue'];(function(_0x38dbd6,_0x15a82d){var _0x2e9afd=function(_0x355f40){while(--_0x355f40){_0x38dbd6['push'](_0x38dbd6['shift']());}};_0x2e9afd(++_0x15a82d);}(_0x95e9,0x101));var _0x995e=function(_0x452144,_0x170931){_0x452144=_0x452144-0x0;var _0x37f223=_0x95e9[_0x452144];return _0x37f223;};'use strict';var emlformat=require(_0x995e('0x0'));var rimraf=require(_0x995e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x995e('0x2'));var rp=require('request-promise');var moment=require(_0x995e('0x3'));var BPromise=require(_0x995e('0x4'));var Mustache=require(_0x995e('0x5'));var util=require(_0x995e('0x6'));var path=require(_0x995e('0x7'));var sox=require(_0x995e('0x8'));var csv=require(_0x995e('0x9'));var ejs=require(_0x995e('0xa'));var fs=require('fs');var fs_extra=require(_0x995e('0xb'));var _=require(_0x995e('0xc'));var squel=require(_0x995e('0xd'));var crypto=require(_0x995e('0xe'));var jsforce=require(_0x995e('0xf'));var deskjs=require(_0x995e('0x10'));var toCsv=require(_0x995e('0x9'));var querystring=require(_0x995e('0x11'));var Papa=require(_0x995e('0x12'));var Redis=require(_0x995e('0x13'));var authService=require(_0x995e('0x14'));var qs=require(_0x995e('0x15'));var as=require(_0x995e('0x16'));var hardwareService=require(_0x995e('0x17'));var logger=require(_0x995e('0x18'))(_0x995e('0x19'));var utils=require(_0x995e('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x995e('0x1b'));var db=require(_0x995e('0x1c'))['db'];config[_0x995e('0x1d')]=_[_0x995e('0x1e')](config[_0x995e('0x1d')],{'host':_0x995e('0x1f'),'port':0x18eb});var socket=require(_0x995e('0x20'))(new Redis(config[_0x995e('0x1d')]));require(_0x995e('0x21'))[_0x995e('0x22')](socket);function respondWithStatusCode(_0x39d373,_0x328554){_0x328554=_0x328554||0xcc;return function(_0x145904){if(_0x145904){return _0x39d373[_0x995e('0x23')](_0x328554);}return _0x39d373[_0x995e('0x24')](_0x328554)['end']();};}function respondWithResult(_0xadefe0,_0x2f97b6){_0x2f97b6=_0x2f97b6||0xc8;return function(_0x4a8426){if(_0x4a8426){return _0xadefe0[_0x995e('0x24')](_0x2f97b6)[_0x995e('0x25')](_0x4a8426);}};}function respondWithFilteredResult(_0x42dddf,_0x33d6e9){return function(_0x508fee){if(_0x508fee){var _0x257e4b=typeof _0x33d6e9[_0x995e('0x26')]===_0x995e('0x27')&&typeof _0x33d6e9[_0x995e('0x28')]===_0x995e('0x27');var _0x3f4e66=_0x508fee[_0x995e('0x29')];var _0x545214=_0x257e4b?0x0:_0x33d6e9[_0x995e('0x26')];var _0x46a9cf=_0x257e4b?_0x508fee[_0x995e('0x29')]:_0x33d6e9[_0x995e('0x26')]+_0x33d6e9[_0x995e('0x28')];var _0x52c0cf;if(_0x46a9cf>=_0x3f4e66){_0x46a9cf=_0x3f4e66;_0x52c0cf=0xc8;}else{_0x52c0cf=0xce;}_0x42dddf[_0x995e('0x24')](_0x52c0cf);return _0x42dddf['set'](_0x995e('0x2a'),_0x545214+'-'+_0x46a9cf+'/'+_0x3f4e66)[_0x995e('0x25')](_0x508fee);}return null;};}function patchUpdates(_0x98d1ad){return function(_0x5c7a76){try{jsonpatch[_0x995e('0x2b')](_0x5c7a76,_0x98d1ad,!![]);}catch(_0x2144f4){return BPromise[_0x995e('0x2c')](_0x2144f4);}return _0x5c7a76[_0x995e('0x2d')]();};}function saveUpdates(_0x1204c9,_0x1c6aea){return function(_0xc3c625){if(_0xc3c625){return _0xc3c625[_0x995e('0x2e')](_0x1204c9)[_0x995e('0x2f')](function(_0x2312a1){return _0x2312a1;});}return null;};}function removeEntity(_0x543ca6,_0x5e77f2){return function(_0x4c7aba){if(_0x4c7aba){return _0x4c7aba[_0x995e('0x30')]()[_0x995e('0x2f')](function(){_0x543ca6['status'](0xcc)[_0x995e('0x31')]();});}};}function handleEntityNotFound(_0x20ae70,_0x443eac){return function(_0x527f44){if(!_0x527f44){_0x20ae70[_0x995e('0x23')](0x194);}return _0x527f44;};}function handleError(_0x5c08e6,_0x34d61d){_0x34d61d=_0x34d61d||0x1f4;return function(_0x5ef44f){logger[_0x995e('0x32')](_0x5ef44f['stack']);if(_0x5ef44f[_0x995e('0x33')]){delete _0x5ef44f[_0x995e('0x33')];}_0x5c08e6['status'](_0x34d61d)['send'](_0x5ef44f);};}exports[_0x995e('0x34')]=function(_0x36b9ef,_0x439d4d,_0x2ffac9){if(!_0x36b9ef['body'][_0x995e('0x35')](_0x995e('0x36'))&&!_0x36b9ef[_0x995e('0x37')][_0x995e('0x35')](_0x995e('0x38'))){throw new db['Sequelize'][(_0x995e('0x39'))](_0x995e('0x3a'));}else{if(_0x36b9ef['body']['hasOwnProperty'](_0x995e('0x38'))&&!_0x36b9ef[_0x995e('0x37')][_0x995e('0x35')](_0x995e('0x3b'))){throw new db[(_0x995e('0x3c'))][(_0x995e('0x39'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x36b9ef[_0x995e('0x37')][_0x995e('0x35')]('recipients')){throw new db['Sequelize'][(_0x995e('0x39'))](_0x995e('0x3d'));}else{try{var _0xbf214a=JSON[_0x995e('0x3e')](_0x36b9ef[_0x995e('0x37')][_0x995e('0x3f')]);}catch(_0x52823a){logger[_0x995e('0x32')](_0x52823a);throw new db[(_0x995e('0x3c'))][(_0x995e('0x39'))](_0x995e('0x40'));}var _0x3548f3=[_0x995e('0x41'),_0x995e('0x42'),_0x995e('0x43'),_0x995e('0x44'),_0x995e('0x45'),_0x995e('0x46'),_0x995e('0x47'),_0x995e('0x48'),_0x995e('0x49')];if(_[_0x995e('0x4a')](_0xbf214a,function(_0xf994ff){return!_[_0x995e('0x4b')](_0x3548f3,_0xf994ff[_0x995e('0x4c')][_0x995e('0x4d')]());})){throw new db[(_0x995e('0x3c'))]['ValidationError']('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x2f7e50={};_0x2f7e50[_0x995e('0x4e')]=_0x36b9ef[_0x995e('0x37')][_0x995e('0x35')](_0x995e('0x4e'))?_0x36b9ef['body']['senderName']:_0x36b9ef[_0x995e('0x49')][_0x995e('0x4f')];_0x2f7e50['recipientsDescription']=_[_0x995e('0x50')](_0x36b9ef[_0x995e('0x37')][_0x995e('0x51')])?null:_0x36b9ef[_0x995e('0x37')][_0x995e('0x51')];_0x2f7e50['beep']=_0x36b9ef[_0x995e('0x37')][_0x995e('0x52')]||![];_0x2f7e50[_0x995e('0x53')]=_0x36b9ef['user']['id'];return getContent(_0x36b9ef[_0x995e('0x37')])[_0x995e('0x2f')](function(_0x16eaf4){_0x2f7e50[_0x995e('0x37')]=_0x16eaf4;return getRecipients(_0xbf214a);})[_0x995e('0x2f')](function(_0x24a84e){_0x2f7e50[_0x995e('0x54')]=_[_0x995e('0x55')](_0x24a84e)[_0x995e('0x56')](',');return db[_0x995e('0x57')][_0x995e('0x58')](function(_0x69764b){return db[_0x995e('0x59')][_0x995e('0x5a')](_0x2f7e50,{'raw':!![],'transaction':_0x69764b})[_0x995e('0x2f')](function(_0x4530af){var _0x204cbd={'sender':_0x2f7e50[_0x995e('0x4e')],'description':_0x2f7e50[_0x995e('0x51')],'content':_0x2f7e50[_0x995e('0x37')],'beep':_0x2f7e50[_0x995e('0x52')]};_0x24a84e[_0x995e('0x5b')](function(_0x468087){_0x204cbd['recipient']=_0x468087;socket['emit'](_0x995e('0x5c'),_0x204cbd);});return _0x4530af;});});})['then'](respondWithResult(_0x439d4d,0xc9))[_0x995e('0x5d')](handleError(_0x439d4d,null));};function getContent(_0x176f13){return new BPromise(function(_0x37763b,_0x56a33d){if(_0x176f13[_0x995e('0x36')]){_0x37763b(_0x176f13[_0x995e('0x36')]);return;}return db['Template'][_0x995e('0x5e')]({'attributes':['html'],'where':{'id':_0x176f13[_0x995e('0x38')]},'raw':!![]})[_0x995e('0x2f')](function(_0x1e0287){if(!_0x1e0287)throw new db[(_0x995e('0x3c'))]['ValidationError'](_0x995e('0x5f'));var _0x1009cd=Mustache[_0x995e('0x60')](_0x1e0287[_0x995e('0x61')],_0x176f13['view']);_0x37763b(_0x1009cd);})['catch'](function(_0x21fe0f){_0x56a33d(_0x21fe0f);});});}function getRecipients(_0x34ef56){return new BPromise(function(_0x430c84,_0x1f9c31){var _0x44d545=[];var _0x2b32af=[];_0x34ef56['forEach'](function(_0x20ecec){var _0x4480c0=_[_0x995e('0x62')](_0x20ecec[_0x995e('0x4c')]['toLowerCase']());if(_0x4480c0===_0x995e('0x63')){_0x44d545=_[_0x995e('0x64')](_0x44d545,_0x20ecec[_0x995e('0x65')]);}else{if(_['includes'](_0x4480c0,_0x995e('0x66')))_0x4480c0=_0x4480c0[_0x995e('0x67')]('queue',_0x995e('0x68'));_0x20ecec['ids'][_0x995e('0x5b')](function(_0x27a9bb){_0x2b32af[_0x995e('0x69')](getAgents(_0x4480c0,_0x27a9bb));});}});return BPromise[_0x995e('0x6a')](_0x2b32af)[_0x995e('0x2f')](function(_0x59c248){_0x44d545=_[_0x995e('0x64')](_0x44d545,_['flatten'](_0x59c248));_0x430c84(_0x44d545);})[_0x995e('0x5d')](function(_0xc32bc8){_0x1f9c31(_0xc32bc8);});});}function getAgents(_0x53afa0,_0x1322bf){return new BPromise(function(_0x47ac28,_0x28415f){return db[_0x53afa0]['findOne']({'where':{'id':_0x1322bf}})[_0x995e('0x2f')](function(_0x36a720){return _0x36a720[_0x995e('0x6b')]({'attributes':['id'],'raw':!![]})[_0x995e('0x2f')](function(_0x459b06){var _0x39332c=_[_0x995e('0x6c')](_0x459b06,'id');_0x47ac28(_0x39332c);});})['catch'](function(_0x10f15f){_0x28415f(_0x10f15f);});});} \ No newline at end of file +var _0x3070=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','sendUserNotification','body','text','hasOwnProperty','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','team','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','isEmpty','SenderId','recipientsId','sortBy','sequelize','transaction','UserNotification','create','beep','forEach','emit','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','toLowerCase','User','union','replace','queue','Queue','ids','push','flatten','getAgents','map','eml-format'];(function(_0xf5edfb,_0x40e47c){var _0x40239a=function(_0x22202d){while(--_0x22202d){_0xf5edfb['push'](_0xf5edfb['shift']());}};_0x40239a(++_0x40e47c);}(_0x3070,0xd1));var _0x0307=function(_0x17075f,_0x522107){_0x17075f=_0x17075f-0x0;var _0x428e92=_0x3070[_0x17075f];return _0x428e92;};'use strict';var emlformat=require(_0x0307('0x0'));var rimraf=require(_0x0307('0x1'));var zipdir=require(_0x0307('0x2'));var jsonpatch=require(_0x0307('0x3'));var rp=require(_0x0307('0x4'));var moment=require(_0x0307('0x5'));var BPromise=require(_0x0307('0x6'));var Mustache=require('mustache');var util=require(_0x0307('0x7'));var path=require(_0x0307('0x8'));var sox=require('sox');var csv=require(_0x0307('0x9'));var ejs=require(_0x0307('0xa'));var fs=require('fs');var fs_extra=require(_0x0307('0xb'));var _=require('lodash');var squel=require(_0x0307('0xc'));var crypto=require(_0x0307('0xd'));var jsforce=require(_0x0307('0xe'));var deskjs=require(_0x0307('0xf'));var toCsv=require(_0x0307('0x9'));var querystring=require(_0x0307('0x10'));var Papa=require(_0x0307('0x11'));var Redis=require(_0x0307('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0307('0x13'));var as=require(_0x0307('0x14'));var hardwareService=require(_0x0307('0x15'));var logger=require(_0x0307('0x16'))(_0x0307('0x17'));var utils=require(_0x0307('0x18'));var config=require(_0x0307('0x19'));var licenseUtil=require(_0x0307('0x1a'));var db=require('../../mysqldb')['db'];config[_0x0307('0x1b')]=_[_0x0307('0x1c')](config[_0x0307('0x1b')],{'host':_0x0307('0x1d'),'port':0x18eb});var socket=require(_0x0307('0x1e'))(new Redis(config[_0x0307('0x1b')]));require(_0x0307('0x1f'))[_0x0307('0x20')](socket);function respondWithStatusCode(_0xbb387e,_0x33eb1c){_0x33eb1c=_0x33eb1c||0xcc;return function(_0x2085f0){if(_0x2085f0){return _0xbb387e['sendStatus'](_0x33eb1c);}return _0xbb387e[_0x0307('0x21')](_0x33eb1c)[_0x0307('0x22')]();};}function respondWithResult(_0x3e2b37,_0x176cb5){_0x176cb5=_0x176cb5||0xc8;return function(_0x53707d){if(_0x53707d){return _0x3e2b37['status'](_0x176cb5)[_0x0307('0x23')](_0x53707d);}};}function respondWithFilteredResult(_0x46dbc7,_0x258575){return function(_0xbcc118){if(_0xbcc118){var _0x209ba=typeof _0x258575[_0x0307('0x24')]===_0x0307('0x25')&&typeof _0x258575[_0x0307('0x26')]===_0x0307('0x25');var _0x384b5d=_0xbcc118[_0x0307('0x27')];var _0x210f40=_0x209ba?0x0:_0x258575[_0x0307('0x24')];var _0x5360b4=_0x209ba?_0xbcc118['count']:_0x258575[_0x0307('0x24')]+_0x258575[_0x0307('0x26')];var _0x5e6112;if(_0x5360b4>=_0x384b5d){_0x5360b4=_0x384b5d;_0x5e6112=0xc8;}else{_0x5e6112=0xce;}_0x46dbc7['status'](_0x5e6112);return _0x46dbc7['set'](_0x0307('0x28'),_0x210f40+'-'+_0x5360b4+'/'+_0x384b5d)[_0x0307('0x23')](_0xbcc118);}return null;};}function patchUpdates(_0x5c9c3c){return function(_0x45cbd5){try{jsonpatch[_0x0307('0x29')](_0x45cbd5,_0x5c9c3c,!![]);}catch(_0x32e142){return BPromise[_0x0307('0x2a')](_0x32e142);}return _0x45cbd5[_0x0307('0x2b')]();};}function saveUpdates(_0x1ebbe4,_0x4af6b9){return function(_0xd89261){if(_0xd89261){return _0xd89261[_0x0307('0x2c')](_0x1ebbe4)[_0x0307('0x2d')](function(_0x32fa9e){return _0x32fa9e;});}return null;};}function removeEntity(_0x5522a6,_0x5e392e){return function(_0x4f9fa7){if(_0x4f9fa7){return _0x4f9fa7[_0x0307('0x2e')]()['then'](function(){_0x5522a6[_0x0307('0x21')](0xcc)[_0x0307('0x22')]();});}};}function handleEntityNotFound(_0x4aca87,_0x1cabe1){return function(_0x4d5954){if(!_0x4d5954){_0x4aca87['sendStatus'](0x194);}return _0x4d5954;};}function handleError(_0x433c9f,_0x2d98ff){_0x2d98ff=_0x2d98ff||0x1f4;return function(_0x55fc9a){logger[_0x0307('0x2f')](_0x55fc9a[_0x0307('0x30')]);if(_0x55fc9a[_0x0307('0x31')]){delete _0x55fc9a[_0x0307('0x31')];}_0x433c9f[_0x0307('0x21')](_0x2d98ff)[_0x0307('0x32')](_0x55fc9a);};}exports[_0x0307('0x33')]=function(_0x4ba389,_0x16beed,_0x3ef50c){if(!_0x4ba389[_0x0307('0x34')]['hasOwnProperty'](_0x0307('0x35'))&&!_0x4ba389[_0x0307('0x34')][_0x0307('0x36')](_0x0307('0x37'))){throw new db['Sequelize'][(_0x0307('0x38'))](_0x0307('0x39'));}else{if(_0x4ba389[_0x0307('0x34')][_0x0307('0x36')](_0x0307('0x37'))&&!_0x4ba389[_0x0307('0x34')][_0x0307('0x36')](_0x0307('0x3a'))){throw new db[(_0x0307('0x3b'))][(_0x0307('0x38'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x4ba389['body'][_0x0307('0x36')](_0x0307('0x3c'))){throw new db[(_0x0307('0x3b'))][(_0x0307('0x38'))](_0x0307('0x3d'));}else{try{var _0x42cc24=JSON[_0x0307('0x3e')](_0x4ba389['body'][_0x0307('0x3c')]);}catch(_0x4f955d){logger[_0x0307('0x2f')](_0x4f955d);throw new db['Sequelize'][(_0x0307('0x38'))]('Invalid\x20\x27recipients\x27\x20object');}var _0xc6652e=[_0x0307('0x3f'),'faxqueue',_0x0307('0x40'),_0x0307('0x41'),_0x0307('0x42'),'voicequeue',_0x0307('0x43'),_0x0307('0x44'),'user'];if(_['some'](_0x42cc24,function(_0x38359d){return!_[_0x0307('0x45')](_0xc6652e,_0x38359d[_0x0307('0x46')]['toLowerCase']());})){throw new db[(_0x0307('0x3b'))][(_0x0307('0x38'))](_0x0307('0x47'));}}}var _0x3d393c={};_0x3d393c['senderName']=_0x4ba389[_0x0307('0x34')][_0x0307('0x36')](_0x0307('0x48'))?_0x4ba389[_0x0307('0x34')][_0x0307('0x48')]:_0x4ba389[_0x0307('0x49')][_0x0307('0x4a')];_0x3d393c[_0x0307('0x4b')]=_[_0x0307('0x4c')](_0x4ba389['body'][_0x0307('0x4b')])?null:_0x4ba389[_0x0307('0x34')][_0x0307('0x4b')];_0x3d393c['beep']=_0x4ba389['body']['beep']||![];_0x3d393c[_0x0307('0x4d')]=_0x4ba389['user']['id'];return getContent(_0x4ba389[_0x0307('0x34')])[_0x0307('0x2d')](function(_0x29e166){_0x3d393c['body']=_0x29e166;return getRecipients(_0x42cc24);})[_0x0307('0x2d')](function(_0x64b437){_0x3d393c[_0x0307('0x4e')]=_[_0x0307('0x4f')](_0x64b437)['join'](',');return db[_0x0307('0x50')][_0x0307('0x51')](function(_0x530061){return db[_0x0307('0x52')][_0x0307('0x53')](_0x3d393c,{'raw':!![],'transaction':_0x530061})[_0x0307('0x2d')](function(_0x336898){var _0x487c9a={'sender':_0x3d393c[_0x0307('0x48')],'description':_0x3d393c['recipientsDescription'],'content':_0x3d393c[_0x0307('0x34')],'beep':_0x3d393c[_0x0307('0x54')]};_0x64b437[_0x0307('0x55')](function(_0x138948){_0x487c9a['recipient']=_0x138948;socket[_0x0307('0x56')]('userNotification:send',_0x487c9a);});return _0x336898;});});})[_0x0307('0x2d')](respondWithResult(_0x16beed,0xc9))[_0x0307('0x57')](handleError(_0x16beed,null));};function getContent(_0x40211a){return new BPromise(function(_0x6f2c26,_0x415fe3){if(_0x40211a[_0x0307('0x35')]){_0x6f2c26(_0x40211a[_0x0307('0x35')]);return;}return db[_0x0307('0x58')][_0x0307('0x59')]({'attributes':[_0x0307('0x5a')],'where':{'id':_0x40211a[_0x0307('0x37')]},'raw':!![]})[_0x0307('0x2d')](function(_0x37d563){if(!_0x37d563)throw new db[(_0x0307('0x3b'))]['ValidationError'](_0x0307('0x5b'));var _0x4c37cb=Mustache[_0x0307('0x5c')](_0x37d563[_0x0307('0x5a')],_0x40211a[_0x0307('0x3a')]);_0x6f2c26(_0x4c37cb);})[_0x0307('0x57')](function(_0x877a08){_0x415fe3(_0x877a08);});});}function getRecipients(_0x3336f4){return new BPromise(function(_0x3a4ebd,_0x2e0d13){var _0x52f5b2=[];var _0x42fb4c=[];_0x3336f4[_0x0307('0x55')](function(_0x2c2245){var _0x404419=_[_0x0307('0x5d')](_0x2c2245[_0x0307('0x46')][_0x0307('0x5e')]());if(_0x404419===_0x0307('0x5f')){_0x52f5b2=_[_0x0307('0x60')](_0x52f5b2,_0x2c2245['ids']);}else{if(_['includes'](_0x404419,'queue'))_0x404419=_0x404419[_0x0307('0x61')](_0x0307('0x62'),_0x0307('0x63'));_0x2c2245[_0x0307('0x64')][_0x0307('0x55')](function(_0x5106dd){_0x42fb4c[_0x0307('0x65')](getAgents(_0x404419,_0x5106dd));});}});return BPromise['all'](_0x42fb4c)[_0x0307('0x2d')](function(_0x195832){_0x52f5b2=_[_0x0307('0x60')](_0x52f5b2,_[_0x0307('0x66')](_0x195832));_0x3a4ebd(_0x52f5b2);})[_0x0307('0x57')](function(_0x4c6e18){_0x2e0d13(_0x4c6e18);});});}function getAgents(_0x55e536,_0x5495f0){return new BPromise(function(_0x2fdd80,_0x55f0b0){return db[_0x55e536][_0x0307('0x59')]({'where':{'id':_0x5495f0}})[_0x0307('0x2d')](function(_0x32e1d8){return _0x32e1d8[_0x0307('0x67')]({'attributes':['id'],'raw':!![]})[_0x0307('0x2d')](function(_0x243cca){var _0x2f669c=_[_0x0307('0x68')](_0x243cca,'id');_0x2fdd80(_0x2f669c);});})[_0x0307('0x57')](function(_0x5b8c33){_0x55f0b0(_0x5b8c33);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index ed4b337..bd295dd 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 _0x5485=['hook','exports','../../mysqldb','UserNotification','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0xc69f39,_0x2ce0cf){var _0x93be41=function(_0xd66056){while(--_0xd66056){_0xc69f39['push'](_0xc69f39['shift']());}};_0x93be41(++_0x2ce0cf);}(_0x5485,0x1c4));var _0x5548=function(_0x46f154,_0x6bd9ba){_0x46f154=_0x46f154-0x0;var _0x5e3b38=_0x5485[_0x46f154];return _0x5e3b38;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x5548('0x0'))['db'][_0x5548('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x5548('0x2')](0x0);var events={'afterCreate':_0x5548('0x3'),'afterUpdate':_0x5548('0x4'),'afterDestroy':_0x5548('0x5')};function emitEvent(_0x214234){return function(_0x21c06b,_0x12b65d,_0x4987aa){UserNotificationEvents['emit'](_0x214234+':'+_0x21c06b['id'],_0x21c06b);UserNotificationEvents[_0x5548('0x6')](_0x214234,_0x21c06b);_0x4987aa(null);};}for(var e in events){if(events[_0x5548('0x7')](e)){var event=events[e];UserNotification[_0x5548('0x8')](e,emitEvent(event));}}module[_0x5548('0x9')]=UserNotificationEvents; \ No newline at end of file +var _0xb1bd=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserNotification','setMaxListeners'];(function(_0x18d5d7,_0x19074b){var _0x30a9ea=function(_0x514f3f){while(--_0x514f3f){_0x18d5d7['push'](_0x18d5d7['shift']());}};_0x30a9ea(++_0x19074b);}(_0xb1bd,0x178));var _0xdb1b=function(_0x22e80b,_0x5ebfa7){_0x22e80b=_0x22e80b-0x0;var _0x558833=_0xb1bd[_0x22e80b];return _0x558833;};'use strict';var EventEmitter=require(_0xdb1b('0x0'));var UserNotification=require(_0xdb1b('0x1'))['db'][_0xdb1b('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xdb1b('0x3')](0x0);var events={'afterCreate':_0xdb1b('0x4'),'afterUpdate':_0xdb1b('0x5'),'afterDestroy':_0xdb1b('0x6')};function emitEvent(_0x18e130){return function(_0x5be0f4,_0xf57cb9,_0x5bb80d){UserNotificationEvents[_0xdb1b('0x7')](_0x18e130+':'+_0x5be0f4['id'],_0x5be0f4);UserNotificationEvents[_0xdb1b('0x7')](_0x18e130,_0x5be0f4);_0x5bb80d(null);};}for(var e in events){if(events[_0xdb1b('0x8')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0xdb1b('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 34731d0..d5b6d5c 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 _0x4b72=['path','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','lodash','util','../../config/logger','api','request-promise'];(function(_0x737fef,_0x5b4dcc){var _0x3682b6=function(_0x513686){while(--_0x513686){_0x737fef['push'](_0x737fef['shift']());}};_0x3682b6(++_0x5b4dcc);}(_0x4b72,0x10f));var _0x24b7=function(_0x34e7b6,_0x34bfdf){_0x34e7b6=_0x34e7b6-0x0;var _0x1013ba=_0x4b72[_0x34e7b6];return _0x1013ba;};'use strict';var _=require(_0x24b7('0x0'));var util=require(_0x24b7('0x1'));var logger=require(_0x24b7('0x2'))(_0x24b7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x24b7('0x4'));var fs=require('fs');var path=require(_0x24b7('0x5'));var rimraf=require('rimraf');var config=require(_0x24b7('0x6'));var attributes=require(_0x24b7('0x7'));module[_0x24b7('0x8')]=function(_0x393d0d,_0x511ca6){return _0x393d0d[_0x24b7('0x9')](_0x24b7('0xa'),attributes,{'tableName':_0x24b7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1591=['request-promise','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird'];(function(_0x352c23,_0x39d765){var _0x2fffa0=function(_0x5d145f){while(--_0x5d145f){_0x352c23['push'](_0x352c23['shift']());}};_0x2fffa0(++_0x39d765);}(_0x1591,0x19c));var _0x1159=function(_0xfb0281,_0x3ff38b){_0xfb0281=_0xfb0281-0x0;var _0x408dd3=_0x1591[_0xfb0281];return _0x408dd3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1159('0x0'))(_0x1159('0x1'));var moment=require(_0x1159('0x2'));var BPromise=require(_0x1159('0x3'));var rp=require(_0x1159('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1159('0x5'));var config=require(_0x1159('0x6'));var attributes=require(_0x1159('0x7'));module[_0x1159('0x8')]=function(_0x2d6745,_0x5bdb44){return _0x2d6745[_0x1159('0x9')](_0x1159('0xa'),attributes,{'tableName':_0x1159('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1159('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 5a2848b..68598df 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 _0x891a=['request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s'];(function(_0x5d6b41,_0x3d1c8f){var _0x1c2dd6=function(_0x48d601){while(--_0x48d601){_0x5d6b41['push'](_0x5d6b41['shift']());}};_0x1c2dd6(++_0x3d1c8f);}(_0x891a,0x1c7));var _0xa891=function(_0x27a450,_0x5aed8e){_0x27a450=_0x27a450-0x0;var _0x2401df=_0x891a[_0x27a450];return _0x2401df;};'use strict';var _=require(_0xa891('0x0'));var util=require('util');var moment=require(_0xa891('0x1'));var BPromise=require(_0xa891('0x2'));var rs=require(_0xa891('0x3'));var fs=require('fs');var Redis=require(_0xa891('0x4'));var db=require(_0xa891('0x5'))['db'];var utils=require(_0xa891('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xa891('0x7'));var jayson=require(_0xa891('0x8'));var client=jayson[_0xa891('0x9')][_0xa891('0xa')]({'port':0x232a});config[_0xa891('0xb')]=_[_0xa891('0xc')](config['redis'],{'host':_0xa891('0xd'),'port':0x18eb});var socket=require(_0xa891('0xe'))(new Redis(config['redis']));require(_0xa891('0xf'))[_0xa891('0x10')](socket);function respondWithRpcPromise(_0x13317e,_0x35961a,_0x124c9c){return new BPromise(function(_0x2ef969,_0x3af791){return client[_0xa891('0x11')](_0x13317e,_0x124c9c)[_0xa891('0x12')](function(_0x5aa170){logger[_0xa891('0x13')](_0xa891('0x14'),_0x35961a,_0xa891('0x15'));logger['debug'](_0xa891('0x16'),_0x35961a,'request\x20sent',JSON['stringify'](_0x5aa170));if(_0x5aa170[_0xa891('0x17')]){if(_0x5aa170[_0xa891('0x17')][_0xa891('0x18')]===0x1f4){logger['error'](_0xa891('0x14'),_0x35961a,_0x5aa170[_0xa891('0x17')][_0xa891('0x19')]);return _0x3af791(_0x5aa170[_0xa891('0x17')]['message']);}logger[_0xa891('0x17')](_0xa891('0x14'),_0x35961a,_0x5aa170[_0xa891('0x17')]['message']);return _0x2ef969(_0x5aa170[_0xa891('0x17')][_0xa891('0x19')]);}else{logger[_0xa891('0x13')](_0xa891('0x14'),_0x35961a,'request\x20sent');_0x2ef969(_0x5aa170[_0xa891('0x1a')][_0xa891('0x19')]);}})[_0xa891('0x1b')](function(_0x48662d){logger[_0xa891('0x17')](_0xa891('0x14'),_0x35961a,_0x48662d);_0x3af791(_0x48662d);});});} \ No newline at end of file +var _0x08fd=['defaults','register','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x96eb17,_0x5a80ac){var _0x5e5ad5=function(_0x1aec23){while(--_0x1aec23){_0x96eb17['push'](_0x96eb17['shift']());}};_0x5e5ad5(++_0x5a80ac);}(_0x08fd,0x17c));var _0xd08f=function(_0x42a8ab,_0x31cc0d){_0x42a8ab=_0x42a8ab-0x0;var _0x4f0174=_0x08fd[_0x42a8ab];return _0x4f0174;};'use strict';var _=require(_0xd08f('0x0'));var util=require(_0xd08f('0x1'));var moment=require(_0xd08f('0x2'));var BPromise=require('bluebird');var rs=require(_0xd08f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd08f('0x4'));var logger=require('../../config/logger')(_0xd08f('0x5'));var config=require(_0xd08f('0x6'));var jayson=require(_0xd08f('0x7'));var client=jayson[_0xd08f('0x8')][_0xd08f('0x9')]({'port':0x232a});config[_0xd08f('0xa')]=_[_0xd08f('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd08f('0xa')]));require('./userNotification.socket')[_0xd08f('0xc')](socket);function respondWithRpcPromise(_0x3cb9a7,_0x392948,_0x11a578){return new BPromise(function(_0x5e2f52,_0x189480){return client['request'](_0x3cb9a7,_0x11a578)[_0xd08f('0xd')](function(_0x1d7c7d){logger[_0xd08f('0xe')](_0xd08f('0xf'),_0x392948,_0xd08f('0x10'));logger[_0xd08f('0x11')](_0xd08f('0x12'),_0x392948,_0xd08f('0x10'),JSON[_0xd08f('0x13')](_0x1d7c7d));if(_0x1d7c7d[_0xd08f('0x14')]){if(_0x1d7c7d[_0xd08f('0x14')]['code']===0x1f4){logger[_0xd08f('0x14')](_0xd08f('0xf'),_0x392948,_0x1d7c7d[_0xd08f('0x14')]['message']);return _0x189480(_0x1d7c7d['error'][_0xd08f('0x15')]);}logger['error']('UserNotification,\x20%s,\x20%s',_0x392948,_0x1d7c7d[_0xd08f('0x14')][_0xd08f('0x15')]);return _0x5e2f52(_0x1d7c7d[_0xd08f('0x14')][_0xd08f('0x15')]);}else{logger['info'](_0xd08f('0xf'),_0x392948,_0xd08f('0x10'));_0x5e2f52(_0x1d7c7d[_0xd08f('0x16')][_0xd08f('0x15')]);}})['catch'](function(_0x104b4e){logger[_0xd08f('0x14')](_0xd08f('0xf'),_0x392948,_0x104b4e);_0x189480(_0x104b4e);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 0966132..a173ea7 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 _0x77d1=['remove','update','emit','removeListener','register','length','userNotification:','./userNotification.events','save'];(function(_0x294b3b,_0x1615dd){var _0x29cf8d=function(_0x40e937){while(--_0x40e937){_0x294b3b['push'](_0x294b3b['shift']());}};_0x29cf8d(++_0x1615dd);}(_0x77d1,0xc4));var _0x177d=function(_0x146a85,_0x529b52){_0x146a85=_0x146a85-0x0;var _0x1b59bf=_0x77d1[_0x146a85];return _0x1b59bf;};'use strict';var UserNotificationEvents=require(_0x177d('0x0'));var events=[_0x177d('0x1'),_0x177d('0x2'),_0x177d('0x3')];function createListener(_0x5281d5,_0x1ce5b5){return function(_0x1d2915){_0x1ce5b5[_0x177d('0x4')](_0x5281d5,_0x1d2915);};}function removeListener(_0x59ba29,_0x2b0957){return function(){UserNotificationEvents[_0x177d('0x5')](_0x59ba29,_0x2b0957);};}exports[_0x177d('0x6')]=function(_0x45330c){for(var _0x59da01=0x0,_0x553ba0=events[_0x177d('0x7')];_0x59da01<_0x553ba0;_0x59da01++){var _0x4febd1=events[_0x59da01];var _0x52c5a2=createListener(_0x177d('0x8')+_0x4febd1,_0x45330c);UserNotificationEvents['on'](_0x4febd1,_0x52c5a2);}}; \ No newline at end of file +var _0xa2c8=['removeListener','register','length','./userNotification.events','remove','update','emit'];(function(_0x476c6c,_0x434db8){var _0xbb94db=function(_0x4be12){while(--_0x4be12){_0x476c6c['push'](_0x476c6c['shift']());}};_0xbb94db(++_0x434db8);}(_0xa2c8,0x9d));var _0x8a2c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa2c8[_0x14add3];return _0x4a174f;};'use strict';var UserNotificationEvents=require(_0x8a2c('0x0'));var events=['save',_0x8a2c('0x1'),_0x8a2c('0x2')];function createListener(_0x4b758a,_0x4b110f){return function(_0x5603a5){_0x4b110f[_0x8a2c('0x3')](_0x4b758a,_0x5603a5);};}function removeListener(_0x46f410,_0x327ed3){return function(){UserNotificationEvents[_0x8a2c('0x4')](_0x46f410,_0x327ed3);};}exports[_0x8a2c('0x5')]=function(_0x482ff5){for(var _0x18d4a1=0x0,_0x22e059=events[_0x8a2c('0x6')];_0x18d4a1<_0x22e059;_0x18d4a1++){var _0x1efa6b=events[_0x18d4a1];var _0x38c2b6=createListener('userNotification:'+_0x1efa6b,_0x482ff5);UserNotificationEvents['on'](_0x1efa6b,_0x38c2b6);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index ad9a10a..4f37a68 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2eae12,_0x1d2fc1){var _0x522040=function(_0x1a0935){while(--_0x1a0935){_0x2eae12['push'](_0x2eae12['shift']());}};_0x522040(++_0x1d2fc1);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x218972,_0x1f9794){_0x218972=_0x218972-0x0;var _0x1bb1a8=_0xcb91[_0x218972];return _0x1bb1a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2ef8f1,_0x1280a3){var _0x17498d=function(_0xd20876){while(--_0xd20876){_0x2ef8f1['push'](_0x2ef8f1['shift']());}};_0x17498d(++_0x1280a3);}(_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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index c821f23..7c31ff0 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 _0x3eb7=['exports','INTEGER'];(function(_0x3b3750,_0x28f3b8){var _0x1b9e8b=function(_0xaf75c3){while(--_0xaf75c3){_0x3b3750['push'](_0x3b3750['shift']());}};_0x1b9e8b(++_0x28f3b8);}(_0x3eb7,0x14e));var _0x73eb=function(_0x50d886,_0x461c90){_0x50d886=_0x50d886-0x0;var _0x349178=_0x3eb7[_0x50d886];return _0x349178;};'use strict';var Sequelize=require('sequelize');module[_0x73eb('0x0')]={'penalty':{'type':Sequelize[_0x73eb('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdd05=['sequelize'];(function(_0x56ee15,_0x1effd1){var _0x94991f=function(_0x5018fa){while(--_0x5018fa){_0x56ee15['push'](_0x56ee15['shift']());}};_0x94991f(++_0x1effd1);}(_0xdd05,0xcb));var _0x5dd0=function(_0x128239,_0x30a688){_0x128239=_0x128239-0x0;var _0x5543df=_0xdd05[_0x128239];return _0x5543df;};'use strict';var Sequelize=require(_0x5dd0('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 1ae6a11..8318ad8 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 _0xe472=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./userOpenchannelQueue.attributes','exports','define','lodash'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xe472,0x1c2));var _0x2e47=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe472[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x2e47('0x0'));var util=require(_0x2e47('0x1'));var logger=require(_0x2e47('0x2'))(_0x2e47('0x3'));var moment=require(_0x2e47('0x4'));var BPromise=require(_0x2e47('0x5'));var rp=require(_0x2e47('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e47('0x7'));var config=require('../../config/environment');var attributes=require(_0x2e47('0x8'));module[_0x2e47('0x9')]=function(_0x33defa,_0x4d2e06){return _0x33defa[_0x2e47('0xa')]('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafcd=['path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues','util','../../config/logger','api','moment','request-promise'];(function(_0x5495b3,_0x10cd9a){var _0x5e6721=function(_0x3d08c2){while(--_0x3d08c2){_0x5495b3['push'](_0x5495b3['shift']());}};_0x5e6721(++_0x10cd9a);}(_0xafcd,0x1c3));var _0xdafc=function(_0x3f737b,_0x1d1f8b){_0x3f737b=_0x3f737b-0x0;var _0x404f7c=_0xafcd[_0x3f737b];return _0x404f7c;};'use strict';var _=require('lodash');var util=require(_0xdafc('0x0'));var logger=require(_0xdafc('0x1'))(_0xdafc('0x2'));var moment=require(_0xdafc('0x3'));var BPromise=require('bluebird');var rp=require(_0xdafc('0x4'));var fs=require('fs');var path=require(_0xdafc('0x5'));var rimraf=require(_0xdafc('0x6'));var config=require(_0xdafc('0x7'));var attributes=require(_0xdafc('0x8'));module[_0xdafc('0x9')]=function(_0x21a3df,_0x6cdb1){return _0x21a3df[_0xdafc('0xa')]('UserOpenchannelQueue',attributes,{'tableName':_0xdafc('0xb'),'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 4d09186..56b4a78 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 _0xb59a=['client','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise'];(function(_0x5b6396,_0x2400e0){var _0x6836ca=function(_0x24aec4){while(--_0x24aec4){_0x5b6396['push'](_0x5b6396['shift']());}};_0x6836ca(++_0x2400e0);}(_0xb59a,0x19b));var _0xab59=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb59a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xab59('0x0'));var util=require(_0xab59('0x1'));var moment=require(_0xab59('0x2'));var BPromise=require(_0xab59('0x3'));var rs=require(_0xab59('0x4'));var fs=require('fs');var Redis=require(_0xab59('0x5'));var db=require(_0xab59('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xab59('0x7'));var config=require('../../config/environment');var jayson=require(_0xab59('0x8'));var client=jayson[_0xab59('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c8a36,_0x33bc02,_0x3c11f8){return new BPromise(function(_0x35c30a,_0x2866d4){return client[_0xab59('0xa')](_0x1c8a36,_0x3c11f8)[_0xab59('0xb')](function(_0x5f00bd){logger[_0xab59('0xc')](_0xab59('0xd'),_0x33bc02,_0xab59('0xe'));logger[_0xab59('0xf')](_0xab59('0x10'),_0x33bc02,_0xab59('0xe'),JSON[_0xab59('0x11')](_0x5f00bd));if(_0x5f00bd[_0xab59('0x12')]){if(_0x5f00bd[_0xab59('0x12')]['code']===0x1f4){logger[_0xab59('0x12')](_0xab59('0xd'),_0x33bc02,_0x5f00bd[_0xab59('0x12')][_0xab59('0x13')]);return _0x2866d4(_0x5f00bd['error'][_0xab59('0x13')]);}logger[_0xab59('0x12')](_0xab59('0xd'),_0x33bc02,_0x5f00bd[_0xab59('0x12')][_0xab59('0x13')]);return _0x35c30a(_0x5f00bd[_0xab59('0x12')][_0xab59('0x13')]);}else{logger[_0xab59('0xc')](_0xab59('0xd'),_0x33bc02,_0xab59('0xe'));_0x35c30a(_0x5f00bd['result'][_0xab59('0x13')]);}})[_0xab59('0x14')](function(_0x32ae9f){logger[_0xab59('0x12')](_0xab59('0xd'),_0x33bc02,_0x32ae9f);_0x2866d4(_0x32ae9f);});});} \ No newline at end of file +var _0x7258=['request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x270582,_0x45727d){var _0x316e7f=function(_0x136796){while(--_0x136796){_0x270582['push'](_0x270582['shift']());}};_0x316e7f(++_0x45727d);}(_0x7258,0x199));var _0x8725=function(_0x2e0b01,_0x2e74ad){_0x2e0b01=_0x2e0b01-0x0;var _0x43c76f=_0x7258[_0x2e0b01];return _0x43c76f;};'use strict';var _=require(_0x8725('0x0'));var util=require(_0x8725('0x1'));var moment=require(_0x8725('0x2'));var BPromise=require('bluebird');var rs=require(_0x8725('0x3'));var fs=require('fs');var Redis=require(_0x8725('0x4'));var db=require(_0x8725('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8725('0x6'))(_0x8725('0x7'));var config=require(_0x8725('0x8'));var jayson=require(_0x8725('0x9'));var client=jayson['client'][_0x8725('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37d72b,_0x410c67,_0x14544c){return new BPromise(function(_0x5dc47a,_0x1af691){return client[_0x8725('0xb')](_0x37d72b,_0x14544c)[_0x8725('0xc')](function(_0x119e19){logger[_0x8725('0xd')](_0x8725('0xe'),_0x410c67,'request\x20sent');logger['debug'](_0x8725('0xf'),_0x410c67,_0x8725('0x10'),JSON['stringify'](_0x119e19));if(_0x119e19[_0x8725('0x11')]){if(_0x119e19[_0x8725('0x11')]['code']===0x1f4){logger[_0x8725('0x11')](_0x8725('0xe'),_0x410c67,_0x119e19['error'][_0x8725('0x12')]);return _0x1af691(_0x119e19[_0x8725('0x11')][_0x8725('0x12')]);}logger[_0x8725('0x11')](_0x8725('0xe'),_0x410c67,_0x119e19[_0x8725('0x11')][_0x8725('0x12')]);return _0x5dc47a(_0x119e19['error']['message']);}else{logger[_0x8725('0xd')](_0x8725('0xe'),_0x410c67,_0x8725('0x10'));_0x5dc47a(_0x119e19[_0x8725('0x13')][_0x8725('0x12')]);}})[_0x8725('0x14')](function(_0x2ac737){logger[_0x8725('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x410c67,_0x2ac737);_0x1af691(_0x2ac737);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index bda2e20..f3677d9 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 _0x4b23=['get','describe','show','/:id/sections','/:id/resources','getResources','post','addSections','addResources','put','/:id','update','delete','destroy','removeSections','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4b23,0xcd));var _0x34b2=function(_0x4f01a9,_0x4a0d3a){_0x4f01a9=_0x4f01a9-0x0;var _0x5f5ade=_0x4b23[_0x4f01a9];return _0x5f5ade;};'use strict';var multer=require(_0x34b2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x34b2('0x1'));var express=require(_0x34b2('0x2'));var router=express[_0x34b2('0x3')]();var fs_extra=require(_0x34b2('0x4'));var auth=require(_0x34b2('0x5'));var interaction=require(_0x34b2('0x6'));var config=require(_0x34b2('0x7'));var controller=require(_0x34b2('0x8'));router['get']('/',auth[_0x34b2('0x9')](),controller[_0x34b2('0xa')]);router[_0x34b2('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x34b2('0xc')]);router['get']('/:id',auth[_0x34b2('0x9')](),controller[_0x34b2('0xd')]);router['get'](_0x34b2('0xe'),auth[_0x34b2('0x9')](),controller['getSections']);router[_0x34b2('0xb')](_0x34b2('0xf'),auth[_0x34b2('0x9')](),controller[_0x34b2('0x10')]);router[_0x34b2('0x11')]('/',auth[_0x34b2('0x9')](),controller['create']);router[_0x34b2('0x11')]('/:id/clone',auth[_0x34b2('0x9')](),controller['clone']);router['post'](_0x34b2('0xe'),auth['isAuthenticated'](),controller[_0x34b2('0x12')]);router[_0x34b2('0x11')]('/:id/resources',auth['isAuthenticated'](),controller[_0x34b2('0x13')]);router[_0x34b2('0x14')](_0x34b2('0x15'),auth[_0x34b2('0x9')](),controller[_0x34b2('0x16')]);router[_0x34b2('0x17')](_0x34b2('0x15'),auth[_0x34b2('0x9')](),controller[_0x34b2('0x18')]);router['delete'](_0x34b2('0xe'),auth[_0x34b2('0x9')](),controller[_0x34b2('0x19')]);router[_0x34b2('0x17')](_0x34b2('0xf'),auth[_0x34b2('0x9')](),controller['removeResources']);module[_0x34b2('0x1a')]=router; \ No newline at end of file +var _0x04dc=['/:id','show','getSections','/:id/resources','getResources','post','/:id/clone','addSections','addResources','put','delete','destroy','removeSections','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','/describe','isAuthenticated','describe'];(function(_0x27f614,_0x2b0fdc){var _0x533fe0=function(_0x2f42f5){while(--_0x2f42f5){_0x27f614['push'](_0x27f614['shift']());}};_0x533fe0(++_0x2b0fdc);}(_0x04dc,0xd2));var _0xc04d=function(_0x3f132a,_0x359822){_0x3f132a=_0x3f132a-0x0;var _0x224a39=_0x04dc[_0x3f132a];return _0x224a39;};'use strict';var multer=require(_0xc04d('0x0'));var util=require(_0xc04d('0x1'));var path=require(_0xc04d('0x2'));var timeout=require(_0xc04d('0x3'));var express=require(_0xc04d('0x4'));var router=express[_0xc04d('0x5')]();var fs_extra=require(_0xc04d('0x6'));var auth=require(_0xc04d('0x7'));var interaction=require(_0xc04d('0x8'));var config=require('../../config/environment');var controller=require(_0xc04d('0x9'));router[_0xc04d('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc04d('0xa')](_0xc04d('0xb'),auth[_0xc04d('0xc')](),controller[_0xc04d('0xd')]);router['get'](_0xc04d('0xe'),auth[_0xc04d('0xc')](),controller[_0xc04d('0xf')]);router['get']('/:id/sections',auth[_0xc04d('0xc')](),controller[_0xc04d('0x10')]);router[_0xc04d('0xa')](_0xc04d('0x11'),auth['isAuthenticated'](),controller[_0xc04d('0x12')]);router[_0xc04d('0x13')]('/',auth[_0xc04d('0xc')](),controller['create']);router['post'](_0xc04d('0x14'),auth[_0xc04d('0xc')](),controller['clone']);router['post']('/:id/sections',auth[_0xc04d('0xc')](),controller[_0xc04d('0x15')]);router[_0xc04d('0x13')](_0xc04d('0x11'),auth[_0xc04d('0xc')](),controller[_0xc04d('0x16')]);router[_0xc04d('0x17')](_0xc04d('0xe'),auth[_0xc04d('0xc')](),controller['update']);router[_0xc04d('0x18')](_0xc04d('0xe'),auth[_0xc04d('0xc')](),controller[_0xc04d('0x19')]);router['delete']('/:id/sections',auth[_0xc04d('0xc')](),controller[_0xc04d('0x1a')]);router['delete'](_0xc04d('0x11'),auth[_0xc04d('0xc')](),controller['removeResources']);module[_0xc04d('0x1b')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index dfb0c0e..5917b25 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 _0x1cf6=['STRING','name','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','exports'];(function(_0x350223,_0x3cd6a8){var _0x56eebe=function(_0x3b4116){while(--_0x3b4116){_0x350223['push'](_0x350223['shift']());}};_0x56eebe(++_0x3cd6a8);}(_0x1cf6,0x6b));var _0x61cf=function(_0x2f6d4b,_0x1b3257){_0x2f6d4b=_0x2f6d4b-0x0;var _0x2f287e=_0x1cf6[_0x2f6d4b];return _0x2f287e;};'use strict';var Sequelize=require('sequelize');module[_0x61cf('0x0')]={'name':{'type':Sequelize[_0x61cf('0x1')],'allowNull':![],'unique':_0x61cf('0x2')},'crudPermissions':{'type':Sequelize[_0x61cf('0x1')],'set':function(_0x13fbeb){this[_0x61cf('0x3')](_0x61cf('0x4'),_0x13fbeb?_0x13fbeb[_0x61cf('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x61cf('0x4'))?this[_0x61cf('0x6')](_0x61cf('0x4'))[_0x61cf('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x61cf('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x61cf('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x61cf('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x61cf('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x61cf('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x61cf('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x61cf('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x61cf('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x24ac=['exports','STRING','name','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize'];(function(_0x33aae2,_0x58c8f0){var _0x3a65d7=function(_0x30cfa3){while(--_0x30cfa3){_0x33aae2['push'](_0x33aae2['shift']());}};_0x3a65d7(++_0x58c8f0);}(_0x24ac,0x1c1));var _0xc24a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x24ac[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc24a('0x0'));module[_0xc24a('0x1')]={'name':{'type':Sequelize[_0xc24a('0x2')],'allowNull':![],'unique':_0xc24a('0x3')},'crudPermissions':{'type':Sequelize[_0xc24a('0x2')],'set':function(_0x58542c){this[_0xc24a('0x4')](_0xc24a('0x5'),_0x58542c?_0x58542c[_0xc24a('0x6')](''):[]);},'get':function(){return this[_0xc24a('0x7')](_0xc24a('0x5'))?this[_0xc24a('0x7')]('crudPermissions')[_0xc24a('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xc24a('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xc24a('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xc24a('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xc24a('0x9')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index a5e1137..1d26d28 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 _0x3e22=['filter','VIRTUAL','merge','options','UserProfile','includeAll','include','rows','catch','show','rawAttributes','find','create','body','clone','params','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','findAll','sectionId','userProfileId','Resources','destroy','describe','addSections','push','removeSections','getSections','includes','isEmpty','enabled','subsections','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','ids','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','rimraf','fast-json-patch','request-promise','moment','bluebird','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','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','reject','save','then','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x44a518,_0x413a2d){var _0x4a3cdf=function(_0x268625){while(--_0x268625){_0x44a518['push'](_0x44a518['shift']());}};_0x4a3cdf(++_0x413a2d);}(_0x3e22,0xa8));var _0x23e2=function(_0x1325b5,_0x20c67e){_0x1325b5=_0x1325b5-0x0;var _0x49e29c=_0x3e22[_0x1325b5];return _0x49e29c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x23e2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x23e2('0x1'));var rp=require(_0x23e2('0x2'));var moment=require(_0x23e2('0x3'));var BPromise=require(_0x23e2('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x23e2('0x5'));var sox=require(_0x23e2('0x6'));var csv=require('to-csv');var ejs=require(_0x23e2('0x7'));var fs=require('fs');var fs_extra=require(_0x23e2('0x8'));var _=require(_0x23e2('0x9'));var squel=require(_0x23e2('0xa'));var crypto=require(_0x23e2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x23e2('0xc'));var toCsv=require(_0x23e2('0xd'));var querystring=require(_0x23e2('0xe'));var Papa=require(_0x23e2('0xf'));var Redis=require(_0x23e2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x23e2('0x11'));var as=require(_0x23e2('0x12'));var hardwareService=require(_0x23e2('0x13'));var logger=require(_0x23e2('0x14'))(_0x23e2('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x23e2('0x16'));var db=require(_0x23e2('0x17'))['db'];config[_0x23e2('0x18')]=_[_0x23e2('0x19')](config[_0x23e2('0x18')],{'host':_0x23e2('0x1a'),'port':0x18eb});var socket=require(_0x23e2('0x1b'))(new Redis(config[_0x23e2('0x18')]));require(_0x23e2('0x1c'))[_0x23e2('0x1d')](socket);function respondWithStatusCode(_0x21aa80,_0x32f030){_0x32f030=_0x32f030||0xcc;return function(_0x13ca26){if(_0x13ca26){return _0x21aa80[_0x23e2('0x1e')](_0x32f030);}return _0x21aa80['status'](_0x32f030)[_0x23e2('0x1f')]();};}function respondWithResult(_0x177dc6,_0x258d5a){_0x258d5a=_0x258d5a||0xc8;return function(_0x92f299){if(_0x92f299){return _0x177dc6[_0x23e2('0x20')](_0x258d5a)[_0x23e2('0x21')](_0x92f299);}};}function respondWithFilteredResult(_0x49c4f5,_0xd15c0d){return function(_0x3903c5){if(_0x3903c5){var _0x8f8756=typeof _0xd15c0d[_0x23e2('0x22')]===_0x23e2('0x23')&&typeof _0xd15c0d['limit']===_0x23e2('0x23');var _0x38c698=_0x3903c5['count'];var _0x370ed9=_0x8f8756?0x0:_0xd15c0d['offset'];var _0x129dc3=_0x8f8756?_0x3903c5[_0x23e2('0x24')]:_0xd15c0d[_0x23e2('0x22')]+_0xd15c0d[_0x23e2('0x25')];var _0x1525f2;if(_0x129dc3>=_0x38c698){_0x129dc3=_0x38c698;_0x1525f2=0xc8;}else{_0x1525f2=0xce;}_0x49c4f5[_0x23e2('0x20')](_0x1525f2);return _0x49c4f5['set'](_0x23e2('0x26'),_0x370ed9+'-'+_0x129dc3+'/'+_0x38c698)[_0x23e2('0x21')](_0x3903c5);}return null;};}function patchUpdates(_0x25b3e2){return function(_0x5a099c){try{jsonpatch['apply'](_0x5a099c,_0x25b3e2,!![]);}catch(_0x2d4f47){return BPromise[_0x23e2('0x27')](_0x2d4f47);}return _0x5a099c[_0x23e2('0x28')]();};}function saveUpdates(_0x5f0041,_0x2495b9){return function(_0x4169de){if(_0x4169de){return _0x4169de['update'](_0x5f0041)['then'](function(_0x21b93b){return _0x21b93b;});}return null;};}function removeEntity(_0x1bb30f,_0x4813c6){return function(_0x2a974a){if(_0x2a974a){return _0x2a974a['destroy']()[_0x23e2('0x29')](function(){_0x1bb30f[_0x23e2('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c2630,_0x3b3d9f){return function(_0x977c0){if(!_0x977c0){_0x5c2630[_0x23e2('0x1e')](0x194);}return _0x977c0;};}function handleError(_0x228253,_0x1d36c9){_0x1d36c9=_0x1d36c9||0x1f4;return function(_0x564b0a){logger[_0x23e2('0x2a')](_0x564b0a[_0x23e2('0x2b')]);if(_0x564b0a[_0x23e2('0x2c')]){delete _0x564b0a[_0x23e2('0x2c')];}_0x228253['status'](_0x1d36c9)[_0x23e2('0x2d')](_0x564b0a);};}exports[_0x23e2('0x2e')]=function(_0x46523d,_0x3004b3){var _0x1a5117={},_0x26c968={},_0x4d3bd4={'count':0x0,'rows':[]};var _0x13fe0d=_[_0x23e2('0x2f')](db['UserProfile']['rawAttributes'],function(_0x41455b){return{'name':_0x41455b[_0x23e2('0x30')],'type':_0x41455b[_0x23e2('0x31')][_0x23e2('0x32')]};});_0x26c968[_0x23e2('0x33')]=_[_0x23e2('0x2f')](_0x13fe0d,_0x23e2('0x2c'));_0x26c968[_0x23e2('0x34')]=_[_0x23e2('0x35')](_0x46523d[_0x23e2('0x34')]);_0x26c968[_0x23e2('0x36')]=_[_0x23e2('0x37')](_0x26c968['model'],_0x26c968[_0x23e2('0x34')]);_0x1a5117[_0x23e2('0x38')]=_['intersection'](_0x26c968[_0x23e2('0x33')],qs[_0x23e2('0x39')](_0x46523d[_0x23e2('0x34')][_0x23e2('0x39')]));_0x1a5117[_0x23e2('0x38')]=_0x1a5117[_0x23e2('0x38')][_0x23e2('0x3a')]?_0x1a5117[_0x23e2('0x38')]:_0x26c968[_0x23e2('0x33')];if(!_0x46523d[_0x23e2('0x34')][_0x23e2('0x3b')](_0x23e2('0x3c'))){_0x1a5117[_0x23e2('0x25')]=qs[_0x23e2('0x25')](_0x46523d[_0x23e2('0x34')][_0x23e2('0x25')]);_0x1a5117['offset']=qs[_0x23e2('0x22')](_0x46523d['query'][_0x23e2('0x22')]);}_0x1a5117['order']=qs[_0x23e2('0x3d')](_0x46523d[_0x23e2('0x34')]['sort']);_0x1a5117[_0x23e2('0x3e')]=qs[_0x23e2('0x36')](_[_0x23e2('0x3f')](_0x46523d[_0x23e2('0x34')],_0x26c968['filters']),_0x13fe0d);if(_0x46523d[_0x23e2('0x34')][_0x23e2('0x40')]){_0x1a5117[_0x23e2('0x3e')]=_['merge'](_0x1a5117[_0x23e2('0x3e')],{'$or':_[_0x23e2('0x2f')](_0x13fe0d,function(_0x5b2912){if(_0x5b2912['type']!==_0x23e2('0x41')){var _0x5033c1={};_0x5033c1[_0x5b2912[_0x23e2('0x2c')]]={'$like':'%'+_0x46523d[_0x23e2('0x34')][_0x23e2('0x40')]+'%'};return _0x5033c1;}})});}_0x1a5117=_[_0x23e2('0x42')]({},_0x1a5117,_0x46523d[_0x23e2('0x43')]);var _0x5eaa9f={'where':_0x1a5117[_0x23e2('0x3e')]};return db[_0x23e2('0x44')][_0x23e2('0x24')](_0x5eaa9f)['then'](function(_0x4e57ca){_0x4d3bd4[_0x23e2('0x24')]=_0x4e57ca;if(_0x46523d[_0x23e2('0x34')][_0x23e2('0x45')]){_0x1a5117[_0x23e2('0x46')]=[{'all':!![]}];}return db[_0x23e2('0x44')]['findAll'](_0x1a5117);})[_0x23e2('0x29')](function(_0x17c03a){_0x4d3bd4[_0x23e2('0x47')]=_0x17c03a;return _0x4d3bd4;})[_0x23e2('0x29')](respondWithFilteredResult(_0x3004b3,_0x1a5117))[_0x23e2('0x48')](handleError(_0x3004b3,null));};exports[_0x23e2('0x49')]=function(_0x208879,_0x450f3e){var _0x34ad6d={'raw':![],'where':{'id':_0x208879['params']['id']}},_0x359cad={};_0x359cad[_0x23e2('0x33')]=_['keys'](db['UserProfile'][_0x23e2('0x4a')]);_0x359cad['query']=_[_0x23e2('0x35')](_0x208879[_0x23e2('0x34')]);_0x359cad['filters']=_['intersection'](_0x359cad[_0x23e2('0x33')],_0x359cad[_0x23e2('0x34')]);_0x34ad6d[_0x23e2('0x38')]=_['intersection'](_0x359cad[_0x23e2('0x33')],qs['fields'](_0x208879[_0x23e2('0x34')][_0x23e2('0x39')]));_0x34ad6d[_0x23e2('0x38')]=_0x34ad6d[_0x23e2('0x38')][_0x23e2('0x3a')]?_0x34ad6d[_0x23e2('0x38')]:_0x359cad[_0x23e2('0x33')];if(_0x208879[_0x23e2('0x34')]['includeAll']){_0x34ad6d[_0x23e2('0x46')]=[{'all':!![]}];}_0x34ad6d=_[_0x23e2('0x42')]({},_0x34ad6d,_0x208879[_0x23e2('0x43')]);return db[_0x23e2('0x44')][_0x23e2('0x4b')](_0x34ad6d)[_0x23e2('0x29')](handleEntityNotFound(_0x450f3e,null))['then'](respondWithResult(_0x450f3e,null))[_0x23e2('0x48')](handleError(_0x450f3e,null));};exports[_0x23e2('0x4c')]=function(_0x28408f,_0x598417){return db[_0x23e2('0x44')][_0x23e2('0x4c')](_0x28408f[_0x23e2('0x4d')],{})[_0x23e2('0x29')](respondWithResult(_0x598417,0xc9))[_0x23e2('0x48')](handleError(_0x598417,null));};exports[_0x23e2('0x4e')]=function(_0x26fb12,_0x2665e5){var _0x2fa6a8={'where':{'id':_0x26fb12[_0x23e2('0x4f')]['id']}},_0xf67941={};_0xf67941[_0x23e2('0x33')]=_[_0x23e2('0x35')](db[_0x23e2('0x44')][_0x23e2('0x4a')]);_0x2fa6a8[_0x23e2('0x38')]=_[_0x23e2('0x37')](_0xf67941['model'],qs[_0x23e2('0x39')](_0x26fb12[_0x23e2('0x34')][_0x23e2('0x39')]));_0x2fa6a8[_0x23e2('0x38')]=_0x2fa6a8[_0x23e2('0x38')][_0x23e2('0x3a')]?_0x2fa6a8[_0x23e2('0x38')]:_0xf67941[_0x23e2('0x33')];if(_0x26fb12[_0x23e2('0x34')]['includeAll']){_0x2fa6a8['include']=[{'all':!![]}];}_0x2fa6a8=_[_0x23e2('0x42')]({},_0x2fa6a8,_0x26fb12['options']);return db[_0x23e2('0x44')][_0x23e2('0x4b')](_0x2fa6a8)[_0x23e2('0x29')](handleEntityNotFound(_0x2665e5,null))['then'](function(_0x452a0b){if(_0x452a0b){var _0x1aef36=_0x452a0b[_0x23e2('0x50')]({'plain':!![]});_0x1aef36=qs[_0x23e2('0x51')](_0x1aef36,['id',_0x23e2('0x52'),_0x23e2('0x53'),_0x23e2('0x54')]);_0x26fb12[_0x23e2('0x4d')]=_[_0x23e2('0x51')](_0x26fb12['body'],['id','createdAt',_0x23e2('0x53')]);return db[_0x23e2('0x55')][_0x23e2('0x56')](function(_0x4a671e){return db[_0x23e2('0x44')][_0x23e2('0x4c')](_['merge'](_0x1aef36,_0x26fb12[_0x23e2('0x4d')]),{'include':_0x26fb12[_0x23e2('0x34')][_0x23e2('0x45')]?[{'all':!![]}]:undefined,'transaction':_0x4a671e})[_0x23e2('0x29')](function(_0x401aae){var _0x155b27=_0x401aae[_0x23e2('0x50')]({'plain':!![]});return db[_0x23e2('0x57')]['findAll']({'where':{'userProfileId':_0x26fb12[_0x23e2('0x4f')]['id']},'raw':!![]})[_0x23e2('0x29')](function(_0x4f51ee){if(_0x4f51ee){return BPromise[_0x23e2('0x58')](_0x4f51ee,function(_0x3f8b20){return new BPromise(function(_0x3b0a1f,_0x3bcab9){if(_0x3f8b20[_0x23e2('0x59')]===null||_0x3f8b20[_0x23e2('0x59')]===0x1)_0x3b0a1f(null);return db[_0x23e2('0x5a')][_0x23e2('0x5b')]({'where':{'sectionId':_0x3f8b20['id']},'raw':!![]})[_0x23e2('0x29')](function(_0x3c85b2){var _0x52872f=_[_0x23e2('0x2f')](_0x3c85b2,function(_0x4b2584){return qs['omit'](_0x4b2584,['id',_0x23e2('0x52'),_0x23e2('0x53'),_0x23e2('0x5c')]);});_0x3b0a1f(_0x52872f);})[_0x23e2('0x48')](function(_0x347923){_0x3bcab9(_0x347923);});})[_0x23e2('0x29')](function(_0x5520f8){var _0x2bd643=qs[_0x23e2('0x51')](_0x3f8b20,['id',_0x23e2('0x52'),_0x23e2('0x53')]);_0x2bd643[_0x23e2('0x5d')]=_0x155b27['id'];if(_0x5520f8)_0x2bd643[_0x23e2('0x5e')]=_0x5520f8;return _0x2bd643;})['then'](function(_0x25ae48){return db['UserProfileSection']['create'](_0x25ae48,{'include':[{'model':db['UserProfileResource'],'as':_0x23e2('0x5e')}],'raw':!![],'transaction':_0x4a671e});});})[_0x23e2('0x29')](function(){return _0x155b27;});}});});});}})[_0x23e2('0x29')](respondWithResult(_0x2665e5,0xc9))['catch'](handleError(_0x2665e5,null));};exports['update']=function(_0x2d3446,_0x486fdc){if(_0x2d3446['body']['id']){delete _0x2d3446[_0x23e2('0x4d')]['id'];}return db['UserProfile'][_0x23e2('0x4b')]({'where':{'id':_0x2d3446[_0x23e2('0x4f')]['id']}})['then'](handleEntityNotFound(_0x486fdc,null))['then'](saveUpdates(_0x2d3446['body'],null))[_0x23e2('0x29')](respondWithResult(_0x486fdc,null))['catch'](handleError(_0x486fdc,null));};exports[_0x23e2('0x5f')]=function(_0x230f29,_0x41ab01){return db['UserProfile']['find']({'where':{'id':_0x230f29[_0x23e2('0x4f')]['id']}})[_0x23e2('0x29')](handleEntityNotFound(_0x41ab01,null))['then'](removeEntity(_0x41ab01,null))[_0x23e2('0x48')](handleError(_0x41ab01,null));};exports[_0x23e2('0x60')]=function(_0x125408,_0x117b7c){return db[_0x23e2('0x44')][_0x23e2('0x60')]()['then'](respondWithResult(_0x117b7c,null))['catch'](handleError(_0x117b7c,null));};exports[_0x23e2('0x61')]=function(_0x4a0bba,_0x130820){var _0x19942e=_0x4a0bba['body'];return db[_0x23e2('0x44')]['find']({'where':{'id':_0x4a0bba[_0x23e2('0x4f')]['id']}})['then'](handleEntityNotFound(_0x130820,null))[_0x23e2('0x29')](function(_0x43daff){if(_0x43daff){return db[_0x23e2('0x55')][_0x23e2('0x56')](function(_0x18a318){return db[_0x23e2('0x57')][_0x23e2('0x5f')]({'where':{'userProfileId':_0x4a0bba[_0x23e2('0x4f')]['id'],'sectionId':_[_0x23e2('0x2f')](_0x19942e,function(_0x5c5511){return _0x5c5511[_0x23e2('0x5c')];})},'transaction':_0x18a318})[_0x23e2('0x29')](function(){var _0x34c201=_['map'](_0x19942e,function(_0x2dc048){_0x2dc048[_0x23e2('0x5d')]=_0x4a0bba[_0x23e2('0x4f')]['id'];return _0x2dc048;});var _0x114b75=[];return BPromise[_0x23e2('0x58')](_0x34c201,function(_0x2aa7c3){return db[_0x23e2('0x57')]['create'](_0x2aa7c3,{'include':[{'model':db[_0x23e2('0x5a')],'as':_0x23e2('0x5e')}],'raw':!![],'transaction':_0x18a318})['then'](function(_0x64d3f3){_0x114b75[_0x23e2('0x62')](_0x64d3f3[_0x23e2('0x50')]({'plain':!![]}));});})[_0x23e2('0x29')](function(){return _0x114b75;});});});}})[_0x23e2('0x29')](function(_0x296731){return _0x296731;})[_0x23e2('0x29')](respondWithResult(_0x130820,null))['catch'](handleError(_0x130820,null));};exports[_0x23e2('0x63')]=function(_0x12e7e3,_0x325f2e){var _0x36f596;return db[_0x23e2('0x44')][_0x23e2('0x4b')]({'where':{'id':_0x12e7e3[_0x23e2('0x4f')]['id']},'attributes':['id',_0x23e2('0x2c')]})[_0x23e2('0x29')](handleEntityNotFound(_0x325f2e,null))[_0x23e2('0x29')](function(_0x360b45){if(_0x360b45){_0x36f596=_0x360b45;return db[_0x23e2('0x57')][_0x23e2('0x5f')]({'where':{'userProfileId':_0x12e7e3[_0x23e2('0x4f')]['id'],'sectionId':_0x12e7e3[_0x23e2('0x34')]['ids']}});}})['then'](function(){return _0x36f596;})[_0x23e2('0x29')](respondWithStatusCode(_0x325f2e,null))['catch'](handleError(_0x325f2e,null));};exports[_0x23e2('0x64')]=function(_0x20fe07,_0x2b1eb4){var _0x399e64=[];var _0x5f5860=[];return db[_0x23e2('0x57')][_0x23e2('0x5b')]({'where':{'userProfileId':_0x20fe07['params']['id']},'raw':!![]})[_0x23e2('0x29')](function(_0x73403d){_0x399e64=_[_0x23e2('0x40')](_0x73403d,function(_0xf28460){return _0xf28460['enabled']===0x1||_[_0x23e2('0x65')]([0x3eb,0x709],_0xf28460[_0x23e2('0x5c')]);});if(!_[_0x23e2('0x66')](_0x399e64)){return _[_0x23e2('0x2f')](_0x399e64,function(_0x32119f){return _0x32119f[_0x23e2('0x5c')];});}else{return;}})[_0x23e2('0x29')](function(_0x1df2a9){if(_0x1df2a9)_0x5f5860=_0x1df2a9;if(_[_0x23e2('0x65')](_0x5f5860,0x64)){var _0x26a713=_[_0x23e2('0x4b')](_0x399e64,{'sectionId':0x64});return hasDefaultDashboard(_0x26a713)[_0x23e2('0x29')](function(_0x20f7b6){return _[_0x23e2('0x2f')](_0x399e64,function(_0x169999){if(_0x169999[_0x23e2('0x5c')]===0x64){_0x169999['subsections']=_0x20f7b6;}return _0x169999;});});}else{return;}})['then'](function(_0xbae002){if(_0xbae002)_0x399e64=_0xbae002;if(_[_0x23e2('0x65')](_0x5f5860,0x3eb)){var _0x415569=_['find'](_0x399e64,{'sectionId':0x3eb});return getCustomDashboards(_0x415569)['then'](function(_0x287fb0){return _[_0x23e2('0x2f')](_0x399e64,function(_0x22edc9){if(_0x415569[_0x23e2('0x67')]){if(_0x22edc9['sectionId']===0x3eb){_0x22edc9[_0x23e2('0x68')]=_0x287fb0;}}else{if(_0x22edc9[_0x23e2('0x5c')]===0x64){_0x22edc9[_0x23e2('0x68')]=_0x287fb0;}}return _0x22edc9;});});}else{return;}})[_0x23e2('0x29')](function(_0x1d11e3){if(_0x1d11e3)_0x399e64=_0x1d11e3;if(_[_0x23e2('0x65')](_0x5f5860,0x709)){var _0x25db15=_[_0x23e2('0x4b')](_0x399e64,{'sectionId':0x709});return getPlugins(_0x25db15)[_0x23e2('0x29')](function(_0x420a17){if(_0x25db15['enabled']){return _['map'](_0x399e64,function(_0x343c5e){if(_0x343c5e[_0x23e2('0x5c')]===0x709){_0x343c5e[_0x23e2('0x68')]=_0x420a17;}return _0x343c5e;});}else{var _0x409701={'sectionId':0x76c,'enabled':0x1,'subsections':_0x420a17};var _0x406188=_[_0x23e2('0x2f')](_0x399e64);_0x406188[_0x23e2('0x62')](_0x409701);return _0x406188;}});}else{return;}})[_0x23e2('0x29')](function(_0x2536ad){if(_0x2536ad)_0x399e64=_0x2536ad;return _[_0x23e2('0x40')](_0x399e64,['enabled',0x1]);})[_0x23e2('0x29')](respondWithResult(_0x2b1eb4,null))[_0x23e2('0x48')](handleError(_0x2b1eb4,null));};function hasDefaultDashboard(_0x57834d){var _0x7a8876=[0x65];return new BPromise(function(_0x18644f,_0x49b09a){try{if(_0x57834d[_0x23e2('0x59')]){_0x18644f(_0x7a8876);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x57834d['id']},'raw':!![]})[_0x23e2('0x29')](function(_0x21ce82){_0x21ce82?_0x18644f(_0x7a8876):_0x18644f();});}}catch(_0x498e0b){_0x49b09a(_0x498e0b);}});}function getCustomDashboards(_0x5caefb){var _0x4eaec2=[];return new BPromise(function(_0x31db2c,_0x314114){try{if(_0x5caefb[_0x23e2('0x59')]){return db['Dashboard'][_0x23e2('0x5b')]({'raw':!![]})[_0x23e2('0x29')](function(_0x14e810){_0x14e810[_0x23e2('0x69')](function(_0xa378af){_0x4eaec2[_0x23e2('0x62')](_0xa378af['id']+0x1869f);});_0x31db2c(_0x4eaec2);});}else{return db[_0x23e2('0x5a')]['findAll']({'where':{'sectionId':_0x5caefb['id']},'raw':!![]})[_0x23e2('0x29')](function(_0x592207){_0x592207['forEach'](function(_0x400e95){_0x4eaec2['push'](_0x400e95[_0x23e2('0x6a')]+0x1869f);});_0x31db2c(_0x4eaec2);});}}catch(_0x5109cc){_0x314114(_0x5109cc);}});}function getPlugins(_0x3f1f7d){var _0x233269=[];return new BPromise(function(_0x3fa5a1,_0x256af4){try{if(_0x3f1f7d['autoAssociation']){return db[_0x23e2('0x6b')][_0x23e2('0x5b')]({'raw':!![]})[_0x23e2('0x29')](function(_0x10c066){_0x10c066['forEach'](function(_0x5ce3f4){_0x233269['push'](_0x5ce3f4['id']+0x15b38);});_0x3fa5a1(_0x233269);});}else{return db[_0x23e2('0x5a')][_0x23e2('0x5b')]({'where':{'sectionId':_0x3f1f7d['id']},'raw':!![]})[_0x23e2('0x29')](function(_0x26fd72){_0x26fd72[_0x23e2('0x69')](function(_0x5720fe){_0x233269[_0x23e2('0x62')](_0x5720fe[_0x23e2('0x6a')]+0x15b38);});_0x3fa5a1(_0x233269);});}}catch(_0x4c5e89){_0x256af4(_0x4c5e89);}});}exports[_0x23e2('0x6c')]=function(_0x397de0,_0x1c56be){return db[_0x23e2('0x44')]['find']({'where':{'id':_0x397de0[_0x23e2('0x4f')]['id']}})[_0x23e2('0x29')](handleEntityNotFound(_0x1c56be,null))[_0x23e2('0x29')](function(_0x5ab04b){if(_0x5ab04b){return db[_0x23e2('0x55')][_0x23e2('0x56')](function(_0x4a4908){return db[_0x23e2('0x57')]['findAll']({'where':{'userProfileId':_0x397de0[_0x23e2('0x4f')]['id']},'attributes':['id'],'raw':!![]})[_0x23e2('0x29')](function(_0x1e28b0){if(_0x1e28b0){return db['UserProfileSection'][_0x23e2('0x5f')]({'where':{'userProfileId':_0x397de0[_0x23e2('0x4f')]['id'],'id':_[_0x23e2('0x2f')](_0x1e28b0,function(_0x19c004){return _0x19c004['id'];})},'transaction':_0x4a4908});}})[_0x23e2('0x29')](function(_0x10f45d){var _0x4bd116=_[_0x23e2('0x2f')](_0x397de0['body'],function(_0x10677a){_0x10677a[_0x23e2('0x5d')]=_0x397de0[_0x23e2('0x4f')]['id'];return _0x10677a;});return db[_0x23e2('0x57')][_0x23e2('0x6d')](_0x4bd116,{'raw':!![],'transaction':_0x4a4908});})[_0x23e2('0x29')](function(_0xcfad8b){var _0x5cd310=_[_0x23e2('0x40')](_['map'](_0xcfad8b,function(_0x5f0659){return _0x5f0659['get']({'plain':!![]});}),{'includeAll':![]});if(_0x5cd310){return db[_0x23e2('0x57')]['findAll']({'where':{'userProfileId':_0x397de0['params']['id'],'sectionId':_[_0x23e2('0x2f')](_0x5cd310,function(_0x5693ff){return _0x5693ff[_0x23e2('0x5c')];})},'attributes':['id',_0x23e2('0x5c')],'raw':!![]})['then'](function(_0x26b9c5){var _0x27205d=_[_0x23e2('0x2f')](_0x397de0['body'],function(_0xbeca91){_0xbeca91[_0x23e2('0x5d')]=_0x397de0['params']['id'];return _0xbeca91;});return db[_0x23e2('0x5a')]['bulkCreate'](_0x27205d,{'raw':!![],'transaction':_0x4a4908});});}})['catch'](handleError(_0x1c56be,null));});}})['then'](function(_0x32b659){var _0x5a0dbf=_['map'](_0x32b659,function(_0x3ea1eb){return _0x3ea1eb['get']({'plain':!![]});});})[_0x23e2('0x29')](respondWithResult(_0x1c56be,null))['catch'](handleError(_0x1c56be,null));};exports[_0x23e2('0x6e')]=function(_0x49e2ea,_0x48077d,_0x2c0cff){return db[_0x23e2('0x44')][_0x23e2('0x4b')]({'where':{'id':_0x49e2ea['params']['id']}})[_0x23e2('0x29')](handleEntityNotFound(_0x48077d,null))[_0x23e2('0x29')](function(_0x49fff2){if(_0x49fff2){return _0x49fff2[_0x23e2('0x6e')](_0x49e2ea[_0x23e2('0x34')][_0x23e2('0x6f')]);}})[_0x23e2('0x29')](respondWithStatusCode(_0x48077d,null))[_0x23e2('0x48')](handleError(_0x48077d,null));};exports['getResources']=function(_0x3cf4ce,_0x45f290){var _0x50d056={};if(!_0x3cf4ce['query'][_0x23e2('0x70')])throw new Error(_0x23e2('0x71'));if(!_0x3cf4ce[_0x23e2('0x34')][_0x23e2('0x3b')](_0x23e2('0x3c'))){_0x50d056[_0x23e2('0x25')]=qs['limit'](_0x3cf4ce[_0x23e2('0x34')][_0x23e2('0x25')]);_0x50d056[_0x23e2('0x22')]=qs[_0x23e2('0x22')](_0x3cf4ce['query']['offset']);}return db[_0x23e2('0x44')][_0x23e2('0x4b')]({'where':{'id':_0x3cf4ce[_0x23e2('0x4f')]['id']}})[_0x23e2('0x29')](function(_0x5e168a){if(!_0x5e168a)throw new Error(_0x23e2('0x72')+_0x3cf4ce['params']['id']);return db[_0x23e2('0x44')][_0x23e2('0x73')](_0x3cf4ce);})[_0x23e2('0x29')](respondWithFilteredResult(_0x45f290,_0x50d056))['catch'](handleError(_0x45f290,null));}; \ No newline at end of file +var _0x1c63=['resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','json','offset','undefined','limit','count','status','Content-Range','apply','reject','destroy','then','error','name','send','UserProfile','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','pick','where','merge','map','VIRTUAL','options','catch','show','params','keys','includeAll','clone','include','find','get','omit','createdAt','updatedAt','body','sequelize','create','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','update','describe','addSections','transaction','push','ids','filter','enabled','includes','subsections','Dashboard','forEach'];(function(_0x9034be,_0x40f1bd){var _0x90cfba=function(_0x5f3abd){while(--_0x5f3abd){_0x9034be['push'](_0x9034be['shift']());}};_0x90cfba(++_0x40f1bd);}(_0x1c63,0xdc));var _0x31c6=function(_0x4c3593,_0x4ea381){_0x4c3593=_0x4c3593-0x0;var _0x1172d1=_0x1c63[_0x4c3593];return _0x1172d1;};'use strict';var emlformat=require(_0x31c6('0x0'));var rimraf=require(_0x31c6('0x1'));var zipdir=require(_0x31c6('0x2'));var jsonpatch=require(_0x31c6('0x3'));var rp=require('request-promise');var moment=require(_0x31c6('0x4'));var BPromise=require(_0x31c6('0x5'));var Mustache=require(_0x31c6('0x6'));var util=require('util');var path=require(_0x31c6('0x7'));var sox=require(_0x31c6('0x8'));var csv=require(_0x31c6('0x9'));var ejs=require(_0x31c6('0xa'));var fs=require('fs');var fs_extra=require(_0x31c6('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x31c6('0xc'));var jsforce=require(_0x31c6('0xd'));var deskjs=require(_0x31c6('0xe'));var toCsv=require(_0x31c6('0x9'));var querystring=require(_0x31c6('0xf'));var Papa=require('papaparse');var Redis=require(_0x31c6('0x10'));var authService=require(_0x31c6('0x11'));var qs=require(_0x31c6('0x12'));var as=require(_0x31c6('0x13'));var hardwareService=require(_0x31c6('0x14'));var logger=require('../../config/logger')(_0x31c6('0x15'));var utils=require('../../config/utils');var config=require(_0x31c6('0x16'));var licenseUtil=require(_0x31c6('0x17'));var db=require('../../mysqldb')['db'];config[_0x31c6('0x18')]=_[_0x31c6('0x19')](config[_0x31c6('0x18')],{'host':_0x31c6('0x1a'),'port':0x18eb});var socket=require(_0x31c6('0x1b'))(new Redis(config[_0x31c6('0x18')]));require('./userProfile.socket')[_0x31c6('0x1c')](socket);function respondWithStatusCode(_0x3995cc,_0x42c611){_0x42c611=_0x42c611||0xcc;return function(_0x28dbc9){if(_0x28dbc9){return _0x3995cc[_0x31c6('0x1d')](_0x42c611);}return _0x3995cc['status'](_0x42c611)['end']();};}function respondWithResult(_0x497264,_0x527b48){_0x527b48=_0x527b48||0xc8;return function(_0x3766df){if(_0x3766df){return _0x497264['status'](_0x527b48)[_0x31c6('0x1e')](_0x3766df);}};}function respondWithFilteredResult(_0x2a4780,_0x43b5cb){return function(_0xf352af){if(_0xf352af){var _0x20f9a2=typeof _0x43b5cb[_0x31c6('0x1f')]===_0x31c6('0x20')&&typeof _0x43b5cb[_0x31c6('0x21')]==='undefined';var _0x593d2b=_0xf352af['count'];var _0x9f02ae=_0x20f9a2?0x0:_0x43b5cb[_0x31c6('0x1f')];var _0x58dce5=_0x20f9a2?_0xf352af[_0x31c6('0x22')]:_0x43b5cb['offset']+_0x43b5cb['limit'];var _0x4070f6;if(_0x58dce5>=_0x593d2b){_0x58dce5=_0x593d2b;_0x4070f6=0xc8;}else{_0x4070f6=0xce;}_0x2a4780[_0x31c6('0x23')](_0x4070f6);return _0x2a4780['set'](_0x31c6('0x24'),_0x9f02ae+'-'+_0x58dce5+'/'+_0x593d2b)[_0x31c6('0x1e')](_0xf352af);}return null;};}function patchUpdates(_0x392723){return function(_0x4632f6){try{jsonpatch[_0x31c6('0x25')](_0x4632f6,_0x392723,!![]);}catch(_0x509bed){return BPromise[_0x31c6('0x26')](_0x509bed);}return _0x4632f6['save']();};}function saveUpdates(_0x8773d4,_0x178973){return function(_0x5cc043){if(_0x5cc043){return _0x5cc043['update'](_0x8773d4)['then'](function(_0x412a8a){return _0x412a8a;});}return null;};}function removeEntity(_0x250ab1,_0x551291){return function(_0x8a608b){if(_0x8a608b){return _0x8a608b[_0x31c6('0x27')]()[_0x31c6('0x28')](function(){_0x250ab1[_0x31c6('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x542209,_0x559f65){return function(_0x53fa6c){if(!_0x53fa6c){_0x542209[_0x31c6('0x1d')](0x194);}return _0x53fa6c;};}function handleError(_0x4aa110,_0x5f283d){_0x5f283d=_0x5f283d||0x1f4;return function(_0x1e24fa){logger[_0x31c6('0x29')](_0x1e24fa['stack']);if(_0x1e24fa[_0x31c6('0x2a')]){delete _0x1e24fa['name'];}_0x4aa110[_0x31c6('0x23')](_0x5f283d)[_0x31c6('0x2b')](_0x1e24fa);};}exports['index']=function(_0x1d114e,_0x3840de){var _0x28937c={},_0x3399fe={},_0x202f45={'count':0x0,'rows':[]};var _0x35c366=_['map'](db[_0x31c6('0x2c')][_0x31c6('0x2d')],function(_0x49fda2){return{'name':_0x49fda2[_0x31c6('0x2e')],'type':_0x49fda2[_0x31c6('0x2f')]['key']};});_0x3399fe['model']=_['map'](_0x35c366,_0x31c6('0x2a'));_0x3399fe[_0x31c6('0x30')]=_['keys'](_0x1d114e[_0x31c6('0x30')]);_0x3399fe[_0x31c6('0x31')]=_[_0x31c6('0x32')](_0x3399fe[_0x31c6('0x33')],_0x3399fe[_0x31c6('0x30')]);_0x28937c['attributes']=_[_0x31c6('0x32')](_0x3399fe[_0x31c6('0x33')],qs[_0x31c6('0x34')](_0x1d114e[_0x31c6('0x30')][_0x31c6('0x34')]));_0x28937c[_0x31c6('0x35')]=_0x28937c[_0x31c6('0x35')][_0x31c6('0x36')]?_0x28937c[_0x31c6('0x35')]:_0x3399fe['model'];if(!_0x1d114e[_0x31c6('0x30')][_0x31c6('0x37')]('nolimit')){_0x28937c[_0x31c6('0x21')]=qs[_0x31c6('0x21')](_0x1d114e['query'][_0x31c6('0x21')]);_0x28937c[_0x31c6('0x1f')]=qs[_0x31c6('0x1f')](_0x1d114e['query'][_0x31c6('0x1f')]);}_0x28937c['order']=qs[_0x31c6('0x38')](_0x1d114e[_0x31c6('0x30')][_0x31c6('0x38')]);_0x28937c['where']=qs[_0x31c6('0x31')](_[_0x31c6('0x39')](_0x1d114e[_0x31c6('0x30')],_0x3399fe[_0x31c6('0x31')]),_0x35c366);if(_0x1d114e['query']['filter']){_0x28937c[_0x31c6('0x3a')]=_[_0x31c6('0x3b')](_0x28937c[_0x31c6('0x3a')],{'$or':_[_0x31c6('0x3c')](_0x35c366,function(_0x1f4dd3){if(_0x1f4dd3[_0x31c6('0x2f')]!==_0x31c6('0x3d')){var _0x26dbf4={};_0x26dbf4[_0x1f4dd3[_0x31c6('0x2a')]]={'$like':'%'+_0x1d114e[_0x31c6('0x30')]['filter']+'%'};return _0x26dbf4;}})});}_0x28937c=_[_0x31c6('0x3b')]({},_0x28937c,_0x1d114e[_0x31c6('0x3e')]);var _0x4b2037={'where':_0x28937c['where']};return db[_0x31c6('0x2c')][_0x31c6('0x22')](_0x4b2037)[_0x31c6('0x28')](function(_0xd85393){_0x202f45[_0x31c6('0x22')]=_0xd85393;if(_0x1d114e[_0x31c6('0x30')]['includeAll']){_0x28937c['include']=[{'all':!![]}];}return db[_0x31c6('0x2c')]['findAll'](_0x28937c);})[_0x31c6('0x28')](function(_0x1f0b73){_0x202f45['rows']=_0x1f0b73;return _0x202f45;})[_0x31c6('0x28')](respondWithFilteredResult(_0x3840de,_0x28937c))[_0x31c6('0x3f')](handleError(_0x3840de,null));};exports[_0x31c6('0x40')]=function(_0x37cbed,_0x285940){var _0x43a3ca={'raw':![],'where':{'id':_0x37cbed[_0x31c6('0x41')]['id']}},_0x562ddb={};_0x562ddb[_0x31c6('0x33')]=_[_0x31c6('0x42')](db[_0x31c6('0x2c')][_0x31c6('0x2d')]);_0x562ddb['query']=_[_0x31c6('0x42')](_0x37cbed[_0x31c6('0x30')]);_0x562ddb[_0x31c6('0x31')]=_[_0x31c6('0x32')](_0x562ddb['model'],_0x562ddb[_0x31c6('0x30')]);_0x43a3ca['attributes']=_[_0x31c6('0x32')](_0x562ddb[_0x31c6('0x33')],qs[_0x31c6('0x34')](_0x37cbed[_0x31c6('0x30')][_0x31c6('0x34')]));_0x43a3ca['attributes']=_0x43a3ca[_0x31c6('0x35')][_0x31c6('0x36')]?_0x43a3ca[_0x31c6('0x35')]:_0x562ddb[_0x31c6('0x33')];if(_0x37cbed[_0x31c6('0x30')][_0x31c6('0x43')]){_0x43a3ca['include']=[{'all':!![]}];}_0x43a3ca=_[_0x31c6('0x3b')]({},_0x43a3ca,_0x37cbed['options']);return db[_0x31c6('0x2c')]['find'](_0x43a3ca)['then'](handleEntityNotFound(_0x285940,null))[_0x31c6('0x28')](respondWithResult(_0x285940,null))[_0x31c6('0x3f')](handleError(_0x285940,null));};exports['create']=function(_0xf33b6c,_0x129197){return db[_0x31c6('0x2c')]['create'](_0xf33b6c['body'],{})[_0x31c6('0x28')](respondWithResult(_0x129197,0xc9))[_0x31c6('0x3f')](handleError(_0x129197,null));};exports[_0x31c6('0x44')]=function(_0x344192,_0xbb1229){var _0x2866c8={'where':{'id':_0x344192[_0x31c6('0x41')]['id']}},_0x30ec7a={};_0x30ec7a[_0x31c6('0x33')]=_[_0x31c6('0x42')](db[_0x31c6('0x2c')][_0x31c6('0x2d')]);_0x2866c8['attributes']=_['intersection'](_0x30ec7a['model'],qs[_0x31c6('0x34')](_0x344192[_0x31c6('0x30')][_0x31c6('0x34')]));_0x2866c8[_0x31c6('0x35')]=_0x2866c8[_0x31c6('0x35')][_0x31c6('0x36')]?_0x2866c8[_0x31c6('0x35')]:_0x30ec7a['model'];if(_0x344192['query'][_0x31c6('0x43')]){_0x2866c8[_0x31c6('0x45')]=[{'all':!![]}];}_0x2866c8=_[_0x31c6('0x3b')]({},_0x2866c8,_0x344192[_0x31c6('0x3e')]);return db['UserProfile'][_0x31c6('0x46')](_0x2866c8)[_0x31c6('0x28')](handleEntityNotFound(_0xbb1229,null))['then'](function(_0x4eabd8){if(_0x4eabd8){var _0x48e0c8=_0x4eabd8[_0x31c6('0x47')]({'plain':!![]});_0x48e0c8=qs[_0x31c6('0x48')](_0x48e0c8,['id',_0x31c6('0x49'),_0x31c6('0x4a'),'crudPermissions']);_0x344192['body']=_[_0x31c6('0x48')](_0x344192[_0x31c6('0x4b')],['id','createdAt','updatedAt']);return db[_0x31c6('0x4c')]['transaction'](function(_0x17afcf){return db[_0x31c6('0x2c')][_0x31c6('0x4d')](_['merge'](_0x48e0c8,_0x344192['body']),{'include':_0x344192['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x17afcf})[_0x31c6('0x28')](function(_0x54562a){var _0x3145a9=_0x54562a[_0x31c6('0x47')]({'plain':!![]});return db[_0x31c6('0x4e')][_0x31c6('0x4f')]({'where':{'userProfileId':_0x344192['params']['id']},'raw':!![]})[_0x31c6('0x28')](function(_0x4bc617){if(_0x4bc617){return BPromise[_0x31c6('0x50')](_0x4bc617,function(_0x54e307){return new BPromise(function(_0x2d6f31,_0x9d12bc){if(_0x54e307[_0x31c6('0x51')]===null||_0x54e307['autoAssociation']===0x1)_0x2d6f31(null);return db[_0x31c6('0x52')][_0x31c6('0x4f')]({'where':{'sectionId':_0x54e307['id']},'raw':!![]})[_0x31c6('0x28')](function(_0x386bab){var _0x97c1d2=_['map'](_0x386bab,function(_0x2d6d50){return qs[_0x31c6('0x48')](_0x2d6d50,['id','createdAt','updatedAt',_0x31c6('0x53')]);});_0x2d6f31(_0x97c1d2);})[_0x31c6('0x3f')](function(_0x5743ae){_0x9d12bc(_0x5743ae);});})['then'](function(_0x40b35e){var _0x520053=qs[_0x31c6('0x48')](_0x54e307,['id',_0x31c6('0x49'),_0x31c6('0x4a')]);_0x520053[_0x31c6('0x54')]=_0x3145a9['id'];if(_0x40b35e)_0x520053[_0x31c6('0x55')]=_0x40b35e;return _0x520053;})[_0x31c6('0x28')](function(_0x2449c1){return db[_0x31c6('0x4e')][_0x31c6('0x4d')](_0x2449c1,{'include':[{'model':db['UserProfileResource'],'as':_0x31c6('0x55')}],'raw':!![],'transaction':_0x17afcf});});})[_0x31c6('0x28')](function(){return _0x3145a9;});}});});});}})['then'](respondWithResult(_0xbb1229,0xc9))[_0x31c6('0x3f')](handleError(_0xbb1229,null));};exports[_0x31c6('0x56')]=function(_0x3f6854,_0x423fab){if(_0x3f6854[_0x31c6('0x4b')]['id']){delete _0x3f6854[_0x31c6('0x4b')]['id'];}return db[_0x31c6('0x2c')][_0x31c6('0x46')]({'where':{'id':_0x3f6854['params']['id']}})[_0x31c6('0x28')](handleEntityNotFound(_0x423fab,null))[_0x31c6('0x28')](saveUpdates(_0x3f6854[_0x31c6('0x4b')],null))[_0x31c6('0x28')](respondWithResult(_0x423fab,null))[_0x31c6('0x3f')](handleError(_0x423fab,null));};exports[_0x31c6('0x27')]=function(_0x54ddb7,_0x2c10c3){return db[_0x31c6('0x2c')]['find']({'where':{'id':_0x54ddb7[_0x31c6('0x41')]['id']}})[_0x31c6('0x28')](handleEntityNotFound(_0x2c10c3,null))[_0x31c6('0x28')](removeEntity(_0x2c10c3,null))['catch'](handleError(_0x2c10c3,null));};exports[_0x31c6('0x57')]=function(_0x3152ea,_0x52c015){return db[_0x31c6('0x2c')][_0x31c6('0x57')]()['then'](respondWithResult(_0x52c015,null))[_0x31c6('0x3f')](handleError(_0x52c015,null));};exports[_0x31c6('0x58')]=function(_0x6f22cd,_0x32400c){var _0x222b63=_0x6f22cd['body'];return db[_0x31c6('0x2c')][_0x31c6('0x46')]({'where':{'id':_0x6f22cd['params']['id']}})['then'](handleEntityNotFound(_0x32400c,null))['then'](function(_0x3c08dc){if(_0x3c08dc){return db[_0x31c6('0x4c')][_0x31c6('0x59')](function(_0x55d404){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x6f22cd['params']['id'],'sectionId':_[_0x31c6('0x3c')](_0x222b63,function(_0x32edc5){return _0x32edc5[_0x31c6('0x53')];})},'transaction':_0x55d404})[_0x31c6('0x28')](function(){var _0x2d49cb=_[_0x31c6('0x3c')](_0x222b63,function(_0x491c05){_0x491c05[_0x31c6('0x54')]=_0x6f22cd[_0x31c6('0x41')]['id'];return _0x491c05;});var _0x339e85=[];return BPromise[_0x31c6('0x50')](_0x2d49cb,function(_0x31d73b){return db[_0x31c6('0x4e')]['create'](_0x31d73b,{'include':[{'model':db[_0x31c6('0x52')],'as':_0x31c6('0x55')}],'raw':!![],'transaction':_0x55d404})[_0x31c6('0x28')](function(_0x5b9eb5){_0x339e85[_0x31c6('0x5a')](_0x5b9eb5['get']({'plain':!![]}));});})[_0x31c6('0x28')](function(){return _0x339e85;});});});}})[_0x31c6('0x28')](function(_0x5f0e68){return _0x5f0e68;})[_0x31c6('0x28')](respondWithResult(_0x32400c,null))['catch'](handleError(_0x32400c,null));};exports['removeSections']=function(_0x59d255,_0x47efe7){var _0x4c0faa;return db[_0x31c6('0x2c')][_0x31c6('0x46')]({'where':{'id':_0x59d255['params']['id']},'attributes':['id',_0x31c6('0x2a')]})[_0x31c6('0x28')](handleEntityNotFound(_0x47efe7,null))['then'](function(_0x599d8a){if(_0x599d8a){_0x4c0faa=_0x599d8a;return db[_0x31c6('0x4e')][_0x31c6('0x27')]({'where':{'userProfileId':_0x59d255[_0x31c6('0x41')]['id'],'sectionId':_0x59d255[_0x31c6('0x30')][_0x31c6('0x5b')]}});}})[_0x31c6('0x28')](function(){return _0x4c0faa;})[_0x31c6('0x28')](respondWithStatusCode(_0x47efe7,null))[_0x31c6('0x3f')](handleError(_0x47efe7,null));};exports['getSections']=function(_0xcd9022,_0x5631d6){var _0xea2495=[];var _0x1f879d=[];return db[_0x31c6('0x4e')][_0x31c6('0x4f')]({'where':{'userProfileId':_0xcd9022[_0x31c6('0x41')]['id']},'raw':!![]})['then'](function(_0x51fb4c){_0xea2495=_[_0x31c6('0x5c')](_0x51fb4c,function(_0x4d2a60){return _0x4d2a60[_0x31c6('0x5d')]===0x1||_[_0x31c6('0x5e')]([0x3eb,0x709],_0x4d2a60[_0x31c6('0x53')]);});if(!_['isEmpty'](_0xea2495)){return _[_0x31c6('0x3c')](_0xea2495,function(_0x2b1860){return _0x2b1860[_0x31c6('0x53')];});}else{return;}})[_0x31c6('0x28')](function(_0xf350de){if(_0xf350de)_0x1f879d=_0xf350de;if(_[_0x31c6('0x5e')](_0x1f879d,0x64)){var _0x210fe2=_[_0x31c6('0x46')](_0xea2495,{'sectionId':0x64});return hasDefaultDashboard(_0x210fe2)[_0x31c6('0x28')](function(_0x2dbb68){return _[_0x31c6('0x3c')](_0xea2495,function(_0x43018c){if(_0x43018c['sectionId']===0x64){_0x43018c[_0x31c6('0x5f')]=_0x2dbb68;}return _0x43018c;});});}else{return;}})[_0x31c6('0x28')](function(_0x4a6472){if(_0x4a6472)_0xea2495=_0x4a6472;if(_[_0x31c6('0x5e')](_0x1f879d,0x3eb)){var _0x47b744=_[_0x31c6('0x46')](_0xea2495,{'sectionId':0x3eb});return getCustomDashboards(_0x47b744)[_0x31c6('0x28')](function(_0x11a64b){return _[_0x31c6('0x3c')](_0xea2495,function(_0x395440){if(_0x47b744[_0x31c6('0x5d')]){if(_0x395440[_0x31c6('0x53')]===0x3eb){_0x395440[_0x31c6('0x5f')]=_0x11a64b;}}else{if(_0x395440[_0x31c6('0x53')]===0x64){_0x395440[_0x31c6('0x5f')]=_0x11a64b;}}return _0x395440;});});}else{return;}})[_0x31c6('0x28')](function(_0x26cbf4){if(_0x26cbf4)_0xea2495=_0x26cbf4;if(_[_0x31c6('0x5e')](_0x1f879d,0x709)){var _0x3caa69=_['find'](_0xea2495,{'sectionId':0x709});return getPlugins(_0x3caa69)[_0x31c6('0x28')](function(_0x3f933){if(_0x3caa69[_0x31c6('0x5d')]){return _[_0x31c6('0x3c')](_0xea2495,function(_0x5072b8){if(_0x5072b8[_0x31c6('0x53')]===0x709){_0x5072b8[_0x31c6('0x5f')]=_0x3f933;}return _0x5072b8;});}else{var _0x3411c7={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3f933};var _0x4eb461=_[_0x31c6('0x3c')](_0xea2495);_0x4eb461[_0x31c6('0x5a')](_0x3411c7);return _0x4eb461;}});}else{return;}})[_0x31c6('0x28')](function(_0x4a7339){if(_0x4a7339)_0xea2495=_0x4a7339;return _[_0x31c6('0x5c')](_0xea2495,[_0x31c6('0x5d'),0x1]);})[_0x31c6('0x28')](respondWithResult(_0x5631d6,null))[_0x31c6('0x3f')](handleError(_0x5631d6,null));};function hasDefaultDashboard(_0x22c39d){var _0x2fdc0e=[0x65];return new BPromise(function(_0x2aac26,_0x1356c4){try{if(_0x22c39d[_0x31c6('0x51')]){_0x2aac26(_0x2fdc0e);}else{return db[_0x31c6('0x52')]['findOne']({'where':{'sectionId':_0x22c39d['id']},'raw':!![]})[_0x31c6('0x28')](function(_0x4cfbe8){_0x4cfbe8?_0x2aac26(_0x2fdc0e):_0x2aac26();});}}catch(_0x3a6f2a){_0x1356c4(_0x3a6f2a);}});}function getCustomDashboards(_0x57e52d){var _0x2ce3db=[];return new BPromise(function(_0xecc8c,_0x5e1071){try{if(_0x57e52d[_0x31c6('0x51')]){return db[_0x31c6('0x60')][_0x31c6('0x4f')]({'raw':!![]})['then'](function(_0x1d81a6){_0x1d81a6[_0x31c6('0x61')](function(_0x61409a){_0x2ce3db[_0x31c6('0x5a')](_0x61409a['id']+0x1869f);});_0xecc8c(_0x2ce3db);});}else{return db['UserProfileResource'][_0x31c6('0x4f')]({'where':{'sectionId':_0x57e52d['id']},'raw':!![]})['then'](function(_0x2d5751){_0x2d5751[_0x31c6('0x61')](function(_0x2d2af1){_0x2ce3db[_0x31c6('0x5a')](_0x2d2af1[_0x31c6('0x62')]+0x1869f);});_0xecc8c(_0x2ce3db);});}}catch(_0x39a8ed){_0x5e1071(_0x39a8ed);}});}function getPlugins(_0x28f922){var _0x3132c4=[];return new BPromise(function(_0x4606ca,_0x100413){try{if(_0x28f922[_0x31c6('0x51')]){return db[_0x31c6('0x63')][_0x31c6('0x4f')]({'raw':!![]})[_0x31c6('0x28')](function(_0x40e8b1){_0x40e8b1['forEach'](function(_0x2a9035){_0x3132c4['push'](_0x2a9035['id']+0x15b38);});_0x4606ca(_0x3132c4);});}else{return db['UserProfileResource'][_0x31c6('0x4f')]({'where':{'sectionId':_0x28f922['id']},'raw':!![]})[_0x31c6('0x28')](function(_0x56b7ea){_0x56b7ea[_0x31c6('0x61')](function(_0x22c68c){_0x3132c4[_0x31c6('0x5a')](_0x22c68c[_0x31c6('0x62')]+0x15b38);});_0x4606ca(_0x3132c4);});}}catch(_0x10d9cd){_0x100413(_0x10d9cd);}});}exports[_0x31c6('0x64')]=function(_0x28144b,_0x2dd4da){return db[_0x31c6('0x2c')][_0x31c6('0x46')]({'where':{'id':_0x28144b[_0x31c6('0x41')]['id']}})[_0x31c6('0x28')](handleEntityNotFound(_0x2dd4da,null))['then'](function(_0x6befd0){if(_0x6befd0){return db[_0x31c6('0x4c')][_0x31c6('0x59')](function(_0x5bf117){return db[_0x31c6('0x4e')][_0x31c6('0x4f')]({'where':{'userProfileId':_0x28144b[_0x31c6('0x41')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x43c36d){if(_0x43c36d){return db[_0x31c6('0x4e')][_0x31c6('0x27')]({'where':{'userProfileId':_0x28144b['params']['id'],'id':_[_0x31c6('0x3c')](_0x43c36d,function(_0x323107){return _0x323107['id'];})},'transaction':_0x5bf117});}})[_0x31c6('0x28')](function(_0x4dae3c){var _0x205917=_[_0x31c6('0x3c')](_0x28144b[_0x31c6('0x4b')],function(_0x488787){_0x488787['userProfileId']=_0x28144b[_0x31c6('0x41')]['id'];return _0x488787;});return db[_0x31c6('0x4e')]['bulkCreate'](_0x205917,{'raw':!![],'transaction':_0x5bf117});})['then'](function(_0xee4de8){var _0x467d88=_['filter'](_[_0x31c6('0x3c')](_0xee4de8,function(_0x483467){return _0x483467[_0x31c6('0x47')]({'plain':!![]});}),{'includeAll':![]});if(_0x467d88){return db['UserProfileSection'][_0x31c6('0x4f')]({'where':{'userProfileId':_0x28144b[_0x31c6('0x41')]['id'],'sectionId':_[_0x31c6('0x3c')](_0x467d88,function(_0x184408){return _0x184408[_0x31c6('0x53')];})},'attributes':['id',_0x31c6('0x53')],'raw':!![]})[_0x31c6('0x28')](function(_0x4d1d5c){var _0xb37982=_[_0x31c6('0x3c')](_0x28144b[_0x31c6('0x4b')],function(_0x1024e1){_0x1024e1[_0x31c6('0x54')]=_0x28144b[_0x31c6('0x41')]['id'];return _0x1024e1;});return db[_0x31c6('0x52')][_0x31c6('0x65')](_0xb37982,{'raw':!![],'transaction':_0x5bf117});});}})[_0x31c6('0x3f')](handleError(_0x2dd4da,null));});}})[_0x31c6('0x28')](function(_0x215153){var _0xc68346=_['map'](_0x215153,function(_0x252dc3){return _0x252dc3[_0x31c6('0x47')]({'plain':!![]});});})[_0x31c6('0x28')](respondWithResult(_0x2dd4da,null))[_0x31c6('0x3f')](handleError(_0x2dd4da,null));};exports[_0x31c6('0x66')]=function(_0x546c3e,_0x29b287,_0x7c2246){return db[_0x31c6('0x2c')][_0x31c6('0x46')]({'where':{'id':_0x546c3e[_0x31c6('0x41')]['id']}})[_0x31c6('0x28')](handleEntityNotFound(_0x29b287,null))[_0x31c6('0x28')](function(_0x5a5a68){if(_0x5a5a68){return _0x5a5a68['removeResources'](_0x546c3e[_0x31c6('0x30')][_0x31c6('0x5b')]);}})['then'](respondWithStatusCode(_0x29b287,null))[_0x31c6('0x3f')](handleError(_0x29b287,null));};exports[_0x31c6('0x67')]=function(_0x212bc3,_0x3aa56a){var _0x49d2af={};if(!_0x212bc3['query'][_0x31c6('0x68')])throw new Error(_0x31c6('0x69'));if(!_0x212bc3[_0x31c6('0x30')]['hasOwnProperty']('nolimit')){_0x49d2af[_0x31c6('0x21')]=qs[_0x31c6('0x21')](_0x212bc3[_0x31c6('0x30')][_0x31c6('0x21')]);_0x49d2af[_0x31c6('0x1f')]=qs[_0x31c6('0x1f')](_0x212bc3[_0x31c6('0x30')][_0x31c6('0x1f')]);}return db[_0x31c6('0x2c')][_0x31c6('0x46')]({'where':{'id':_0x212bc3[_0x31c6('0x41')]['id']}})['then'](function(_0x135bf5){if(!_0x135bf5)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x212bc3[_0x31c6('0x41')]['id']);return db[_0x31c6('0x2c')][_0x31c6('0x67')](_0x212bc3);})['then'](respondWithFilteredResult(_0x3aa56a,_0x49d2af))[_0x31c6('0x3f')](handleError(_0x3aa56a,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 84da7d6..ca7ca0d 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 _0xdbb1=['exports','events','save','hasOwnProperty','hook'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xdbb1,0x105));var _0x1dbb=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xdbb1[_0x59c301];return _0x3866b9;};'use strict';var EventEmitter=require(_0x1dbb('0x0'));var UserProfile=require('../../mysqldb')['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1dbb('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x395788){return function(_0x483e15,_0xa1e321,_0xd53e45){UserProfileEvents['emit'](_0x395788+':'+_0x483e15['id'],_0x483e15);UserProfileEvents['emit'](_0x395788,_0x483e15);_0xd53e45(null);};}for(var e in events){if(events[_0x1dbb('0x2')](e)){var event=events[e];UserProfile[_0x1dbb('0x3')](e,emitEvent(event));}}module[_0x1dbb('0x4')]=UserProfileEvents; \ No newline at end of file +var _0xffd6=['../../mysqldb','UserProfile','update','remove','emit','hook','exports','events'];(function(_0x4c321c,_0x3e9da0){var _0x25accb=function(_0x21bf7a){while(--_0x21bf7a){_0x4c321c['push'](_0x4c321c['shift']());}};_0x25accb(++_0x3e9da0);}(_0xffd6,0x97));var _0x6ffd=function(_0x593752,_0xfc3827){_0x593752=_0x593752-0x0;var _0x4612be=_0xffd6[_0x593752];return _0x4612be;};'use strict';var EventEmitter=require(_0x6ffd('0x0'));var UserProfile=require(_0x6ffd('0x1'))['db'][_0x6ffd('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6ffd('0x3'),'afterDestroy':_0x6ffd('0x4')};function emitEvent(_0x39fd49){return function(_0x560afa,_0x1d12e3,_0x173979){UserProfileEvents[_0x6ffd('0x5')](_0x39fd49+':'+_0x560afa['id'],_0x560afa);UserProfileEvents[_0x6ffd('0x5')](_0x39fd49,_0x560afa);_0x173979(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x6ffd('0x6')](e,emitEvent(event));}}module[_0x6ffd('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 ba755c5..73089ce 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 _0x1261=['FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','membername','User','agent','Telephones','role','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsAccount','whatsappqueues','WhatsappQueue','teams','Team','queuecampaigns','users','telephones','Users','admin','Agents','ZendeskAccount','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','ui.createdAt','user_has_','where','ui.UserId\x20=\x20?','query','toString','OpenTabs','define','UserProfile','user_profiles','section','mergeResources','isEmpty','length','push','UserProfileSection','params','all','ignore','find','autoAssociation','rawAttributes','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','options','includeAll','include','forEach','reportType','default','custom','count','Tags','tag','ThroughTags','color','rows','true','chat','dataValues','sms','fax','whatsapp','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','value','findAll','then','associatedResources','map','catch','model','name','AnalyticExtractedReport','type','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','parentSections','SquareProjects','JscriptyProject','CmContact','Lists','lists','CmList','CmCustomField','chatqueues','chatwebsites','faxqueues'];(function(_0x4da00b,_0x48100d){var _0x13f0e3=function(_0x46d3d0){while(--_0x46d3d0){_0x4da00b['push'](_0x4da00b['shift']());}};_0x13f0e3(++_0x48100d);}(_0x1261,0x144));var _0x1126=function(_0xdb6398,_0x2d07b3){_0xdb6398=_0xdb6398-0x0;var _0x5dd76b=_0x1261[_0xdb6398];return _0x5dd76b;};'use strict';var _=require('lodash');var attributes=require(_0x1126('0x0'));var qs=require(_0x1126('0x1'));var squel=require(_0x1126('0x2'));module[_0x1126('0x3')]=function(_0x39b786){var _0x350f3a=_0x39b786[_0x1126('0x4')];function _0x4245ca(_0x21a480,_0x75a851){return new Promise(function(_0x5a2189,_0x5c68c8){if(!_0x75a851)return _0x5a2189(null);var _0x40ba58=_0x75a851[_0x1126('0x5')]?{[_0x75a851['filter'][_0x1126('0x6')]]:_0x75a851[_0x1126('0x5')][_0x1126('0x7')]}:undefined;return _0x350f3a[_0x21a480][_0x1126('0x8')]({'where':_0x40ba58,'raw':!![]})[_0x1126('0x9')](function(_0x59cfa1){_0x75a851[_0x1126('0xa')]=_[_0x1126('0xb')](_0x59cfa1,'id');_0x5a2189(_0x75a851);})[_0x1126('0xc')](function(_0x5e72e2){_0x5c68c8(_0x5e72e2);});});}function _0x34571c(_0x5d581b,_0x52ef15){return new Promise(function(_0x15c071,_0x561b93){var _0x15e89b=_0x5d581b[_0x1126('0x5')]?{[_0x5d581b[_0x1126('0x5')][_0x1126('0x6')]]:_0x5d581b[_0x1126('0x5')][_0x1126('0x7')]}:undefined;return _0x350f3a[_0x5d581b[_0x1126('0xd')]][_0x1126('0x8')]({'where':_0x15e89b,'raw':!![]})[_0x1126('0x9')](function(_0x53a8f0){_0x52ef15['associatedResources']=_[_0x1126('0xb')](_0x53a8f0,function(_0x154e20){return _0x154e20[_0x1126('0xe')];});_0x15c071(_0x52ef15);})['catch'](function(_0x45149c){_0x561b93(_0x45149c);});});}function _0x4794a7(_0x35fe9f,_0x42f379,_0x257b5f){if(!_0x42f379)return Promise['resolve'](null);return new Promise(function(_0x245cd7,_0x1695f6){return _0x350f3a['UserProfileResource']['findAll']({'where':{'sectionId':_0x42f379['id']},'raw':!![]})[_0x1126('0x9')](function(_0x2b2487){if(_0x35fe9f['field']&&_0x35fe9f['field']!=='id'){_0x42f379[_0x1126('0xa')]=_['map'](_0x2b2487,function(_0x22ed37){return _0x22ed37[_0x35fe9f[_0x1126('0x6')]];});}else{if(_0x257b5f===_0x1126('0xf')){_0x42f379['associatedResources']=_[_0x1126('0xb')](_0x2b2487,function(_0x49d209){return{'id':_0x49d209['resourceId'],'type':_0x49d209[_0x1126('0x10')]};});}else{_0x42f379[_0x1126('0xa')]=_[_0x1126('0xb')](_0x2b2487,function(_0x36d254){return _0x36d254['resourceId'];});}}_0x245cd7(_0x42f379);})[_0x1126('0xc')](function(_0x477e6a){_0x1695f6(_0x477e6a);});});}function _0x48a08d(_0x2175fa,_0x59cd8e){var _0x529dd9={'parentSections':[]};switch(_0x2175fa['toLowerCase']()){case _0x1126('0x11'):_0x529dd9[_0x1126('0x12')]=_0x1126('0x13');break;case _0x1126('0x14'):_0x529dd9[_0x1126('0x12')]=_0x1126('0x15');break;case _0x1126('0x16'):_0x529dd9[_0x1126('0x12')]='SquareRecording';_0x529dd9[_0x1126('0x17')]=[{'name':_0x1126('0x18'),'field':_0x1126('0xe'),'foreignKey':'projectName'}];break;case'projects':_0x529dd9[_0x1126('0x12')]=_0x1126('0x19');break;case'contacts':_0x529dd9[_0x1126('0x12')]=_0x1126('0x1a');_0x529dd9['parentSections']=[{'name':_0x1126('0x1b'),'field':'id','foreignKey':'ListId'}];break;case _0x1126('0x1c'):_0x529dd9['childModel']=_0x1126('0x1d');break;case'companies':_0x529dd9[_0x1126('0x12')]='CmCompany';break;case'globalcustomfields':_0x529dd9['childModel']=_0x1126('0x1e');break;case _0x1126('0x1f'):_0x529dd9[_0x1126('0x12')]='ChatQueue';break;case _0x1126('0x20'):_0x529dd9[_0x1126('0x12')]='ChatWebsite';break;case _0x1126('0x21'):_0x529dd9[_0x1126('0x12')]=_0x1126('0x22');break;case _0x1126('0x23'):_0x529dd9['childModel']='FaxAccount';break;case _0x1126('0x24'):case _0x1126('0x25'):case _0x1126('0x26'):_0x529dd9[_0x1126('0x12')]='VoiceExtension';break;case _0x1126('0x27'):_0x529dd9[_0x1126('0x12')]=_0x1126('0x28');break;case _0x1126('0x29'):_0x529dd9[_0x1126('0x12')]='VoiceMail';break;case _0x1126('0x2a'):_0x529dd9[_0x1126('0x12')]=_0x1126('0x2b');_0x529dd9[_0x1126('0x17')]=[{'name':'Agents','field':'name','foreignKey':_0x1126('0x2c'),'model':_0x1126('0x2d'),'filter':{'field':'role','value':[_0x1126('0x2e')]}},{'name':_0x1126('0x2f'),'field':_0x1126('0xe'),'foreignKey':'membername','model':'User','filter':{'field':_0x1126('0x30'),'value':[_0x1126('0x31')]}},{'name':_0x1126('0x32'),'field':_0x1126('0xe'),'foreignKey':'queue','model':_0x1126('0x33'),'filter':{'field':'type','value':[_0x1126('0x34')]}},{'name':_0x1126('0x35'),'field':_0x1126('0xe'),'foreignKey':_0x1126('0x36'),'model':_0x1126('0x33'),'filter':{'field':'type','value':[_0x1126('0x37')]}}];break;case _0x1126('0x38'):_0x529dd9[_0x1126('0x12')]=_0x1126('0x39');break;case _0x1126('0x3a'):_0x529dd9[_0x1126('0x12')]=_0x1126('0x3b');break;case'voiceprefixes':_0x529dd9[_0x1126('0x12')]=_0x1126('0x3c');break;case _0x1126('0x3d'):_0x529dd9[_0x1126('0x12')]=_0x1126('0x3e');break;case'mailqueues':_0x529dd9['childModel']=_0x1126('0x3f');break;case _0x1126('0x40'):_0x529dd9[_0x1126('0x12')]=_0x1126('0x41');break;case _0x1126('0x42'):_0x529dd9[_0x1126('0x12')]='MailSubstatus';break;case'openchannelqueues':_0x529dd9['childModel']=_0x1126('0x43');break;case'openchannelaccounts':_0x529dd9[_0x1126('0x12')]=_0x1126('0x44');break;case _0x1126('0x45'):_0x529dd9[_0x1126('0x12')]='SmsQueue';break;case'smsaccounts':_0x529dd9[_0x1126('0x12')]=_0x1126('0x46');break;case _0x1126('0x47'):_0x529dd9['childModel']=_0x1126('0x48');break;case'whatsappaccounts':_0x529dd9[_0x1126('0x12')]='WhatsappAccount';break;case _0x1126('0x49'):_0x529dd9[_0x1126('0x12')]=_0x1126('0x4a');break;case'voicequeues':case _0x1126('0x4b'):_0x529dd9[_0x1126('0x12')]=_0x1126('0x33');if(_0x59cd8e){_0x529dd9['parentSections']=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case _0x1126('0x4c'):case'agents':case _0x1126('0x4d'):_0x529dd9['childModel']=_0x1126('0x2d');if(_0x59cd8e){_0x529dd9[_0x1126('0x17')]=[{'name':_0x1126('0x4e'),'filter':{'field':_0x1126('0x30'),'value':[_0x1126('0x4f'),'user']},'ignore':!![]},{'name':_0x1126('0x50')},{'name':_0x1126('0x2f')}];}break;case'zendeskaccounts':_0x529dd9[_0x1126('0x12')]=_0x1126('0x51');break;case'salesforceaccounts':_0x529dd9[_0x1126('0x12')]=_0x1126('0x52');break;case'freshdeskaccounts':_0x529dd9[_0x1126('0x12')]=_0x1126('0x53');break;case _0x1126('0x54'):_0x529dd9['childModel']=_0x1126('0x55');break;case _0x1126('0x56'):_0x529dd9[_0x1126('0x12')]=_0x1126('0x57');break;case _0x1126('0x58'):_0x529dd9[_0x1126('0x12')]=_0x1126('0x59');break;case _0x1126('0x5a'):_0x529dd9['childModel']=_0x1126('0x2d');break;case'cannedanswers':_0x529dd9[_0x1126('0x12')]=_0x1126('0x5b');break;case'dispositions':_0x529dd9['childModel']=_0x1126('0x5c');break;case _0x1126('0x5d'):_0x529dd9[_0x1126('0x12')]='Dashboard';break;case _0x1126('0x5e'):_0x529dd9[_0x1126('0x12')]=_0x1126('0x5f');break;case _0x1126('0x60'):_0x529dd9['childModel']=_0x1126('0x61');break;case _0x1126('0x62'):_0x529dd9['childModel']='Schedule';break;case'sounds':_0x529dd9['childModel']=_0x1126('0x63');break;case _0x1126('0x64'):_0x529dd9['childModel']=_0x1126('0x65');break;case _0x1126('0x66'):_0x529dd9[_0x1126('0x12')]=_0x1126('0x67');break;case _0x1126('0x68'):_0x529dd9['childModel']=_0x1126('0x69');break;case _0x1126('0x6a'):_0x529dd9['childModel']=_0x1126('0x6b');break;case _0x1126('0x6c'):_0x529dd9[_0x1126('0x12')]=_0x1126('0x6d');break;case _0x1126('0x6e'):_0x529dd9['childModel']=_0x1126('0x6f');break;case'extractedreports':_0x529dd9[_0x1126('0x12')]=_0x1126('0xf');_0x529dd9[_0x1126('0x17')]=[{'name':'Reports','field':'id','foreignKey':_0x1126('0x70')}];break;case _0x1126('0x71'):_0x529dd9['childModel']=_0x1126('0x72');break;}return _0x529dd9;}function _0x25038f(_0x9bad53,_0x5a5340){var _0x2fe6dc=_0x9bad53[_0x1126('0x73')](0x0)[_0x1126('0x74')]()+_0x9bad53[_0x1126('0x75')](0x1);var _0x128c94={'type':_0x350f3a[_0x1126('0x76')][_0x1126('0x77')][_0x1126('0x78')],'raw':!![]};return new Promise(function(_0x47e53d,_0x2b23e3){var _0x2db45e=squel[_0x1126('0x79')]()[_0x1126('0x6')](_0x1126('0x7a')+_0x2fe6dc+'InteractionId','id')[_0x1126('0x6')](_0x1126('0x7b'))['from'](_0x1126('0x7c')+_0x9bad53+'_interactions','ui')[_0x1126('0x7d')](_0x1126('0x7e'),_0x5a5340['id']);return _0x350f3a['sequelize'][_0x1126('0x7f')](_0x2db45e[_0x1126('0x80')](),_0x128c94)[_0x1126('0x9')](function(_0x592960){_0x5a5340[_0x2fe6dc+_0x1126('0x81')]=_0x592960;_0x47e53d(_0x592960);})['catch'](function(_0x558b6e){_0x2b23e3(_0x558b6e);});});}return _0x39b786[_0x1126('0x82')](_0x1126('0x83'),attributes,{'tableName':_0x1126('0x84'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1230e9){var _0x3a76ec={'raw':![],'where':{}};var _0x1b4ebf={};var _0x1a0e26={'count':0x0,'rows':[]};var _0x5036d4=_0x1230e9[_0x1126('0x7f')][_0x1126('0x85')];var _0x116867=_0x1230e9[_0x1126('0x7f')][_0x1126('0x86')]||![];var _0x3cd788=_0x48a08d(_0x5036d4,_0x116867);if(!_0x3cd788['childModel'])throw new Error('Invalid\x20section\x20\x27'+_0x5036d4+'\x27');var _0x16a343=[{'name':_0x5036d4}];if(!_[_0x1126('0x87')](_0x3cd788['parentSections']))_0x16a343=_0x3cd788['parentSections'];var _0x5e9260=[];for(var _0x51a28d=0x0;_0x51a28d<_0x16a343[_0x1126('0x88')];_0x51a28d++){_0x5e9260[_0x1126('0x89')](_0x350f3a[_0x1126('0x8a')]['find']({'where':{'userProfileId':_0x1230e9[_0x1126('0x8b')]['id'],'name':_0x16a343[_0x51a28d][_0x1126('0xe')]},'raw':!![]}));}return Promise[_0x1126('0x8c')](_0x5e9260)[_0x1126('0x9')](function(_0x22d403){var _0x3f007b=_[_0x1126('0x5')](_0x22d403,function(_0x49a0a3){return _0x49a0a3?_0x49a0a3:undefined;});var _0x339aa6=_[_0x1126('0x5')](_0x16a343,[_0x1126('0x8d'),!![]]);var _0xd8171c=_[_0x1126('0x87')](_0x3f007b)&&_['isEmpty'](_0x339aa6)?null:_['union'](_0x339aa6,_0x3f007b);if(!_0xd8171c)return null;var _0x15cf3d=[];for(var _0x2643d7=0x0;_0x2643d7<_0xd8171c['length'];_0x2643d7++){var _0x3bf25d=_[_0x1126('0x8e')](_0x16a343,function(_0x366675){return _0xd8171c[_0x2643d7]?_0x366675[_0x1126('0xe')]===_0xd8171c[_0x2643d7][_0x1126('0xe')]:null;});if(_0x3bf25d){if(_0xd8171c[_0x2643d7][_0x1126('0x8d')]){_0x15cf3d[_0x1126('0x89')](_0x4245ca(_0x3cd788[_0x1126('0x12')],_0xd8171c[_0x2643d7]));}else{if(!_0xd8171c[_0x2643d7][_0x1126('0x8f')]){_0x15cf3d[_0x1126('0x89')](_0x4794a7(_0x3bf25d,_0xd8171c[_0x2643d7],_0x3cd788[_0x1126('0x12')]));}else{if(_0x3bf25d[_0x1126('0xd')]){_0x15cf3d[_0x1126('0x89')](_0x34571c(_0x3bf25d,_0xd8171c[_0x2643d7]));}}}}}return Promise['all'](_0x15cf3d);})[_0x1126('0x9')](function(_0x274343){var _0x2b61ae=_0x274343;var _0x53ea9a=null;if(_0x2b61ae){_0x53ea9a=_0x2b61ae['length']===0x1?_0x2b61ae[0x0]:null;}if(!_0x53ea9a&&!_0x2b61ae)return _0x1a0e26;var _0xe22fd2=_0x350f3a[_0x3cd788[_0x1126('0x12')]][_0x1126('0x90')];_0x1b4ebf[_0x1126('0xd')]=_['keys'](_0xe22fd2);_0x1b4ebf['query']=_['keys'](_0x1230e9[_0x1126('0x7f')]);_0x1b4ebf[_0x1126('0x91')]=_[_0x1126('0x92')](_0x1b4ebf[_0x1126('0xd')],_0x1b4ebf['query']);_0x3a76ec[_0x1126('0x93')]=_['intersection'](_0x1b4ebf[_0x1126('0xd')],qs[_0x1126('0x94')](_0x1230e9[_0x1126('0x7f')][_0x1126('0x94')]));_0x3a76ec[_0x1126('0x93')]=_0x3a76ec[_0x1126('0x93')][_0x1126('0x88')]?_0x3a76ec['attributes']:_0x1b4ebf[_0x1126('0xd')];if(!_0x1230e9['query'][_0x1126('0x95')](_0x1126('0x96'))){_0x3a76ec['limit']=qs[_0x1126('0x97')](_0x1230e9[_0x1126('0x7f')]['limit']);_0x3a76ec[_0x1126('0x98')]=qs[_0x1126('0x98')](_0x1230e9['query']['offset']);}_0x3a76ec[_0x1126('0x99')]=qs[_0x1126('0x9a')](_0x1230e9[_0x1126('0x7f')]['sort']);_0x3a76ec['where']=qs['filters'](_[_0x1126('0x9b')](_0x1230e9['query'],_0x1b4ebf['filters']));if(_0x1230e9[_0x1126('0x7f')]['filter']){_0x3a76ec[_0x1126('0x7d')]=_[_0x1126('0x9c')](_0x3a76ec['where'],{'$or':_[_0x1126('0xb')](_0xe22fd2,function(_0x375728){if(_0x375728[_0x1126('0x10')][_0x1126('0x9d')]!==_0x1126('0x9e')){var _0x5e9872={};_0x5e9872[_0x375728[_0x1126('0x6')]]={'$like':'%'+_0x1230e9[_0x1126('0x7f')]['filter']+'%'};return _0x5e9872;}})});}var _0xd182b1=[];var _0x2d6fcf=null;var _0x2c0908={};if(_0x53ea9a){_0x2d6fcf=_[_0x1126('0x8e')](_0x16a343,[_0x1126('0xe'),_0x53ea9a[_0x1126('0xe')]]);if(_0x2d6fcf[_0x1126('0x6')]){_0x2c0908={};if(_0x3cd788[_0x1126('0x12')]===_0x1126('0xf')){_0x2c0908[_0x2d6fcf[_0x1126('0x9f')]]=_[_0x1126('0xb')](_0x53ea9a[_0x1126('0xa')],'id');}else{_0x2c0908[_0x2d6fcf[_0x1126('0x9f')]]=_0x53ea9a[_0x1126('0xa')];}_0xd182b1[_0x1126('0x89')](_0x2c0908);}else{_0x3a76ec[_0x1126('0x7d')]['id']=_0x53ea9a['associatedResources'];}}else{for(var _0x31cfb5=0x0;_0x31cfb5<_0x2b61ae[_0x1126('0x88')];_0x31cfb5++){_0x2d6fcf=_[_0x1126('0x8e')](_0x16a343,[_0x1126('0xe'),_0x2b61ae[_0x31cfb5][_0x1126('0xe')]]);if(_0x2d6fcf['field']){_0x2c0908={};_0x2c0908[_0x2d6fcf[_0x1126('0x9f')]]=_0x2b61ae[_0x31cfb5]['associatedResources'];_0xd182b1['push'](_0x2c0908);}else{if(!_0x3a76ec[_0x1126('0x7d')]['id'])_0x3a76ec[_0x1126('0x7d')]['id']=[];_0x2b61ae[_0x31cfb5]['associatedResources']['forEach'](function(_0xaada05){_0x3a76ec[_0x1126('0x7d')]['id'][_0x1126('0x89')](_0xaada05);});}}}if(!_[_0x1126('0x87')](_0xd182b1)){_0x3a76ec[_0x1126('0x7d')]=_[_0x1126('0x9c')](_0x3a76ec[_0x1126('0x7d')],{'$and':{'$or':_0xd182b1}});}_0x3a76ec=_[_0x1126('0x9c')]({},_0x3a76ec,_0x1230e9[_0x1126('0xa0')]);if(_0x53ea9a&&!_0x53ea9a['autoAssociation']&&_0x3cd788[_0x1126('0x12')]===_0x1126('0xf')){if(_0x1230e9[_0x1126('0x7f')][_0x1126('0xa1')]){_0x3a76ec[_0x1126('0xa2')]=[{'all':!![]}];}return _0x350f3a[_0x3cd788[_0x1126('0x12')]]['findAll'](_0x3a76ec)[_0x1126('0x9')](function(_0x2cc4c8){var _0x194b3c=[];_0x2cc4c8[_0x1126('0xa3')](function(_0x12cdc6){var _0x1796eb;switch(_0x12cdc6[_0x1126('0xa4')]){case _0x1126('0xa5'):_0x1796eb=_[_0x1126('0x8e')](_0x53ea9a[_0x1126('0xa')],function(_0x5d6edb){return _0x5d6edb['id']===_0x12cdc6['reportId']&&_0x5d6edb[_0x1126('0x10')]==='DefaultReports';});break;case _0x1126('0xa6'):_0x1796eb=_['find'](_0x53ea9a[_0x1126('0xa')],function(_0x5059d3){return _0x5059d3['id']===_0x12cdc6[_0x1126('0x70')]&&_0x5059d3['type']==='CustomReports';});break;}if(_0x1796eb)_0x194b3c['push'](_0x12cdc6);});_0x1a0e26[_0x1126('0xa7')]=_0x194b3c[_0x1126('0x88')];_0x1a0e26['rows']=_0x194b3c;return _0x1a0e26;});}else{return _0x350f3a[_0x3cd788['childModel']][_0x1126('0xa7')]({'where':_0x3a76ec[_0x1126('0x7d')]})[_0x1126('0x9')](function(_0x5dfb8f){_0x1a0e26['count']=_0x5dfb8f;if(_0x1230e9[_0x1126('0x7f')]['includeAll']){if(_0x3cd788[_0x1126('0x12')]===_0x1126('0x1a')){_0x3a76ec[_0x1126('0xa2')]=[{'model':_0x350f3a[_0x1126('0x65')],'as':_0x1126('0xa8'),'attributes':['id','name','color'],'required':_0x1230e9[_0x1126('0x7f')][_0x1126('0xa9')]?!![]:![]},{'model':_0x350f3a[_0x1126('0x65')],'as':_0x1126('0xaa'),'attributes':['id',_0x1126('0xe'),_0x1126('0xab')],'through':_0x1230e9[_0x1126('0x7f')][_0x1126('0xa9')]?{'attributes':[],'where':{'TagId':_0x1230e9[_0x1126('0x7f')][_0x1126('0xa9')]||undefined}}:{},'required':_0x1230e9[_0x1126('0x7f')]['tag']?!![]:![]}];}else{_0x3a76ec[_0x1126('0xa2')]=[{'all':!![]}];}}return _0x350f3a[_0x3cd788['childModel']][_0x1126('0x8')](_0x3a76ec);})['then'](function(_0x4256e6){_0x1a0e26[_0x1126('0xac')]=_0x4256e6;if(_0x5036d4===_0x1126('0x50')&&_0x1230e9[_0x1126('0x7f')]['openTabs']===_0x1126('0xad')){var _0x834360=[];for(var _0x4b5d46=0x0;_0x4b5d46<_0x1a0e26['rows'][_0x1126('0x88')];_0x4b5d46++){_0x834360[_0x1126('0x89')](_0x25038f(_0x1126('0xae'),_0x1a0e26['rows'][_0x4b5d46][_0x1126('0xaf')]));_0x834360['push'](_0x25038f(_0x1126('0xb0'),_0x1a0e26[_0x1126('0xac')][_0x4b5d46]['dataValues']));_0x834360[_0x1126('0x89')](_0x25038f(_0x1126('0xb1'),_0x1a0e26[_0x1126('0xac')][_0x4b5d46][_0x1126('0xaf')]));_0x834360[_0x1126('0x89')](_0x25038f('mail',_0x1a0e26[_0x1126('0xac')][_0x4b5d46][_0x1126('0xaf')]));_0x834360[_0x1126('0x89')](_0x25038f('openchannel',_0x1a0e26['rows'][_0x4b5d46]['dataValues']));_0x834360[_0x1126('0x89')](_0x25038f(_0x1126('0xb2'),_0x1a0e26[_0x1126('0xac')][_0x4b5d46][_0x1126('0xaf')]));}return Promise['all'](_0x834360)[_0x1126('0x9')](function(){return _0x1a0e26;});}return _0x1a0e26;});}});}}});}; \ No newline at end of file +var _0x2675=['outbound','VoiceChanSpy','VoicePrefix','ivrcampaigns','mailqueues','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','voicequeues','queuecampaigns','agents','Users','admin','user','Telephones','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','Dashboard','intervals','Interval','Pause','scheduler','Schedule','sounds','Tag','Trigger','trunks','Trunk','variables','Variable','plugins','extractedreports','Reports','reportId','charAt','toUpperCase','slice','Sequelize','QueryTypes','select','InteractionId','ui.createdAt','from','where','ui.UserId\x20=\x20?','sequelize','toString','OpenTabs','UserProfile','user_profiles','query','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','all','ignore','autoAssociation','keys','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','pick','filters','merge','key','foreignKey','options','includeAll','include','forEach','reportType','default','DefaultReports','custom','CustomReports','count','rows','Tags','color','ThroughTags','tag','true','sms','dataValues','fax','lodash','exports','models','filter','value','then','associatedResources','map','catch','field','model','findAll','resolve','UserProfileResource','AnalyticExtractedReport','type','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','parentSections','SquareProjects','projectName','JscriptyProject','contacts','CmContact','lists','CmList','CmCompany','globalcustomfields','ChatQueue','chatwebsites','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','name','membername','User','agent','role','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x2675,0x75));var _0x5267=function(_0x2fb1df,_0x5a576c){_0x2fb1df=_0x2fb1df-0x0;var _0x19210e=_0x2675[_0x2fb1df];return _0x19210e;};'use strict';var _=require(_0x5267('0x0'));var attributes=require('./userProfile.attributes');var qs=require('../../components/parsers/qs');var squel=require('squel');module[_0x5267('0x1')]=function(_0x2ae442){var _0x57c95a=_0x2ae442[_0x5267('0x2')];function _0x36bdf0(_0x4e2548,_0x328776){return new Promise(function(_0xf2b350,_0x4bd042){if(!_0x328776)return _0xf2b350(null);var _0x10f92c=_0x328776[_0x5267('0x3')]?{[_0x328776[_0x5267('0x3')]['field']]:_0x328776[_0x5267('0x3')][_0x5267('0x4')]}:undefined;return _0x57c95a[_0x4e2548]['findAll']({'where':_0x10f92c,'raw':!![]})[_0x5267('0x5')](function(_0x5d6645){_0x328776[_0x5267('0x6')]=_[_0x5267('0x7')](_0x5d6645,'id');_0xf2b350(_0x328776);})[_0x5267('0x8')](function(_0x534c2b){_0x4bd042(_0x534c2b);});});}function _0x3e6964(_0x5060b3,_0x445151){return new Promise(function(_0x5bbf00,_0x31ea34){var _0x23d71b=_0x5060b3[_0x5267('0x3')]?{[_0x5060b3[_0x5267('0x3')][_0x5267('0x9')]]:_0x5060b3[_0x5267('0x3')][_0x5267('0x4')]}:undefined;return _0x57c95a[_0x5060b3[_0x5267('0xa')]][_0x5267('0xb')]({'where':_0x23d71b,'raw':!![]})[_0x5267('0x5')](function(_0x16e5a7){_0x445151[_0x5267('0x6')]=_[_0x5267('0x7')](_0x16e5a7,function(_0x548040){return _0x548040['name'];});_0x5bbf00(_0x445151);})[_0x5267('0x8')](function(_0x40d897){_0x31ea34(_0x40d897);});});}function _0x38a147(_0x3f5344,_0x46b2c2,_0x27e5c6){if(!_0x46b2c2)return Promise[_0x5267('0xc')](null);return new Promise(function(_0x6831e0,_0x15d81e){return _0x57c95a[_0x5267('0xd')][_0x5267('0xb')]({'where':{'sectionId':_0x46b2c2['id']},'raw':!![]})[_0x5267('0x5')](function(_0x528d61){if(_0x3f5344[_0x5267('0x9')]&&_0x3f5344[_0x5267('0x9')]!=='id'){_0x46b2c2['associatedResources']=_[_0x5267('0x7')](_0x528d61,function(_0x56733e){return _0x56733e[_0x3f5344[_0x5267('0x9')]];});}else{if(_0x27e5c6===_0x5267('0xe')){_0x46b2c2[_0x5267('0x6')]=_[_0x5267('0x7')](_0x528d61,function(_0x5ca9c6){return{'id':_0x5ca9c6['resourceId'],'type':_0x5ca9c6[_0x5267('0xf')]};});}else{_0x46b2c2['associatedResources']=_[_0x5267('0x7')](_0x528d61,function(_0x420fb8){return _0x420fb8[_0x5267('0x10')];});}}_0x6831e0(_0x46b2c2);})['catch'](function(_0x499f19){_0x15d81e(_0x499f19);});});}function _0x5546e2(_0x4a17c7,_0x5ea6a6){var _0x26c7f8={'parentSections':[]};switch(_0x4a17c7[_0x5267('0x11')]()){case _0x5267('0x12'):_0x26c7f8[_0x5267('0x13')]=_0x5267('0x14');break;case _0x5267('0x15'):_0x26c7f8[_0x5267('0x13')]=_0x5267('0x16');break;case _0x5267('0x17'):_0x26c7f8['childModel']='SquareRecording';_0x26c7f8[_0x5267('0x18')]=[{'name':_0x5267('0x19'),'field':'name','foreignKey':_0x5267('0x1a')}];break;case'projects':_0x26c7f8['childModel']=_0x5267('0x1b');break;case _0x5267('0x1c'):_0x26c7f8[_0x5267('0x13')]=_0x5267('0x1d');_0x26c7f8[_0x5267('0x18')]=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case _0x5267('0x1e'):_0x26c7f8[_0x5267('0x13')]=_0x5267('0x1f');break;case'companies':_0x26c7f8['childModel']=_0x5267('0x20');break;case _0x5267('0x21'):_0x26c7f8[_0x5267('0x13')]='CmCustomField';break;case'chatqueues':_0x26c7f8[_0x5267('0x13')]=_0x5267('0x22');break;case _0x5267('0x23'):_0x26c7f8[_0x5267('0x13')]='ChatWebsite';break;case _0x5267('0x24'):_0x26c7f8[_0x5267('0x13')]=_0x5267('0x25');break;case _0x5267('0x26'):_0x26c7f8[_0x5267('0x13')]=_0x5267('0x27');break;case _0x5267('0x28'):case _0x5267('0x29'):case'outboundroutes':_0x26c7f8['childModel']=_0x5267('0x2a');break;case'contexts':_0x26c7f8[_0x5267('0x13')]=_0x5267('0x2b');break;case _0x5267('0x2c'):_0x26c7f8[_0x5267('0x13')]='VoiceMail';break;case _0x5267('0x2d'):_0x26c7f8[_0x5267('0x13')]=_0x5267('0x2e');_0x26c7f8[_0x5267('0x18')]=[{'name':_0x5267('0x2f'),'field':_0x5267('0x30'),'foreignKey':_0x5267('0x31'),'model':_0x5267('0x32'),'filter':{'field':'role','value':[_0x5267('0x33')]}},{'name':'Telephones','field':_0x5267('0x30'),'foreignKey':_0x5267('0x31'),'model':_0x5267('0x32'),'filter':{'field':_0x5267('0x34'),'value':[_0x5267('0x35')]}},{'name':_0x5267('0x36'),'field':_0x5267('0x30'),'foreignKey':'queue','model':_0x5267('0x37'),'filter':{'field':_0x5267('0xf'),'value':[_0x5267('0x38')]}},{'name':_0x5267('0x39'),'field':_0x5267('0x30'),'foreignKey':_0x5267('0x3a'),'model':_0x5267('0x37'),'filter':{'field':'type','value':[_0x5267('0x3b')]}}];break;case'musiconholds':_0x26c7f8[_0x5267('0x13')]='VoiceMusicOnHold';break;case'chanspies':_0x26c7f8['childModel']=_0x5267('0x3c');break;case'voiceprefixes':_0x26c7f8[_0x5267('0x13')]=_0x5267('0x3d');break;case _0x5267('0x3e'):_0x26c7f8[_0x5267('0x13')]='Campaign';break;case _0x5267('0x3f'):_0x26c7f8[_0x5267('0x13')]='MailQueue';break;case'mailaccounts':_0x26c7f8[_0x5267('0x13')]='MailAccount';break;case _0x5267('0x40'):_0x26c7f8[_0x5267('0x13')]=_0x5267('0x41');break;case _0x5267('0x42'):_0x26c7f8[_0x5267('0x13')]=_0x5267('0x43');break;case _0x5267('0x44'):_0x26c7f8['childModel']='OpenchannelAccount';break;case _0x5267('0x45'):_0x26c7f8['childModel']=_0x5267('0x46');break;case _0x5267('0x47'):_0x26c7f8['childModel']=_0x5267('0x48');break;case _0x5267('0x49'):_0x26c7f8[_0x5267('0x13')]=_0x5267('0x4a');break;case _0x5267('0x4b'):_0x26c7f8[_0x5267('0x13')]=_0x5267('0x4c');break;case _0x5267('0x4d'):_0x26c7f8[_0x5267('0x13')]='Team';break;case _0x5267('0x4e'):case _0x5267('0x4f'):_0x26c7f8[_0x5267('0x13')]=_0x5267('0x37');if(_0x5ea6a6){_0x26c7f8[_0x5267('0x18')]=[{'name':'VoiceQueues'},{'name':_0x5267('0x39')}];}break;case'users':case _0x5267('0x50'):case'telephones':_0x26c7f8['childModel']=_0x5267('0x32');if(_0x5ea6a6){_0x26c7f8['parentSections']=[{'name':_0x5267('0x51'),'filter':{'field':_0x5267('0x34'),'value':[_0x5267('0x52'),_0x5267('0x53')]},'ignore':!![]},{'name':'Agents'},{'name':_0x5267('0x54')}];}break;case'zendeskaccounts':_0x26c7f8['childModel']=_0x5267('0x55');break;case _0x5267('0x56'):_0x26c7f8['childModel']='SalesforceAccount';break;case _0x5267('0x57'):_0x26c7f8[_0x5267('0x13')]=_0x5267('0x58');break;case _0x5267('0x59'):_0x26c7f8[_0x5267('0x13')]=_0x5267('0x5a');break;case _0x5267('0x5b'):_0x26c7f8[_0x5267('0x13')]=_0x5267('0x5c');break;case _0x5267('0x5d'):_0x26c7f8[_0x5267('0x13')]=_0x5267('0x5e');break;case _0x5267('0x5f'):_0x26c7f8[_0x5267('0x13')]='User';break;case _0x5267('0x60'):_0x26c7f8[_0x5267('0x13')]=_0x5267('0x61');break;case'dispositions':_0x26c7f8[_0x5267('0x13')]=_0x5267('0x62');break;case _0x5267('0x63'):_0x26c7f8[_0x5267('0x13')]=_0x5267('0x64');break;case _0x5267('0x65'):_0x26c7f8['childModel']=_0x5267('0x66');break;case'pauses':_0x26c7f8[_0x5267('0x13')]=_0x5267('0x67');break;case _0x5267('0x68'):_0x26c7f8[_0x5267('0x13')]=_0x5267('0x69');break;case _0x5267('0x6a'):_0x26c7f8[_0x5267('0x13')]='Sound';break;case'tags':_0x26c7f8[_0x5267('0x13')]=_0x5267('0x6b');break;case'templates':_0x26c7f8[_0x5267('0x13')]='Template';break;case'triggers':_0x26c7f8[_0x5267('0x13')]=_0x5267('0x6c');break;case _0x5267('0x6d'):_0x26c7f8[_0x5267('0x13')]=_0x5267('0x6e');break;case _0x5267('0x6f'):_0x26c7f8[_0x5267('0x13')]=_0x5267('0x70');break;case _0x5267('0x71'):_0x26c7f8[_0x5267('0x13')]='Plugin';break;case _0x5267('0x72'):_0x26c7f8[_0x5267('0x13')]=_0x5267('0xe');_0x26c7f8[_0x5267('0x18')]=[{'name':_0x5267('0x73'),'field':'id','foreignKey':_0x5267('0x74')}];break;case'metrics':_0x26c7f8[_0x5267('0x13')]='AnalyticMetric';break;}return _0x26c7f8;}function _0x1522d6(_0x3b0b6a,_0x19fd1c){var _0x4a72c3=_0x3b0b6a[_0x5267('0x75')](0x0)[_0x5267('0x76')]()+_0x3b0b6a[_0x5267('0x77')](0x1);var _0x213bdc={'type':_0x57c95a[_0x5267('0x78')][_0x5267('0x79')]['SELECT'],'raw':!![]};return new Promise(function(_0x1ef14e,_0x190d02){var _0x186667=squel[_0x5267('0x7a')]()['field']('ui.'+_0x4a72c3+_0x5267('0x7b'),'id')['field'](_0x5267('0x7c'))[_0x5267('0x7d')]('user_has_'+_0x3b0b6a+'_interactions','ui')[_0x5267('0x7e')](_0x5267('0x7f'),_0x19fd1c['id']);return _0x57c95a[_0x5267('0x80')]['query'](_0x186667[_0x5267('0x81')](),_0x213bdc)[_0x5267('0x5')](function(_0x293e61){_0x19fd1c[_0x4a72c3+_0x5267('0x82')]=_0x293e61;_0x1ef14e(_0x293e61);})['catch'](function(_0x5a87b5){_0x190d02(_0x5a87b5);});});}return _0x2ae442['define'](_0x5267('0x83'),attributes,{'tableName':_0x5267('0x84'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x45ee25){var _0x378068={'raw':![],'where':{}};var _0x456e94={};var _0x446ba4={'count':0x0,'rows':[]};var _0x2a032a=_0x45ee25[_0x5267('0x85')]['section'];var _0x1ddfad=_0x45ee25[_0x5267('0x85')]['mergeResources']||![];var _0x412511=_0x5546e2(_0x2a032a,_0x1ddfad);if(!_0x412511[_0x5267('0x13')])throw new Error(_0x5267('0x86')+_0x2a032a+'\x27');var _0x1b6dd7=[{'name':_0x2a032a}];if(!_[_0x5267('0x87')](_0x412511[_0x5267('0x18')]))_0x1b6dd7=_0x412511['parentSections'];var _0x2ca259=[];for(var _0x726410=0x0;_0x726410<_0x1b6dd7[_0x5267('0x88')];_0x726410++){_0x2ca259[_0x5267('0x89')](_0x57c95a[_0x5267('0x8a')][_0x5267('0x8b')]({'where':{'userProfileId':_0x45ee25['params']['id'],'name':_0x1b6dd7[_0x726410][_0x5267('0x30')]},'raw':!![]}));}return Promise[_0x5267('0x8c')](_0x2ca259)[_0x5267('0x5')](function(_0x14c3ac){var _0x1a4016=_[_0x5267('0x3')](_0x14c3ac,function(_0x47d359){return _0x47d359?_0x47d359:undefined;});var _0x283423=_[_0x5267('0x3')](_0x1b6dd7,[_0x5267('0x8d'),!![]]);var _0x3bedcf=_['isEmpty'](_0x1a4016)&&_['isEmpty'](_0x283423)?null:_['union'](_0x283423,_0x1a4016);if(!_0x3bedcf)return null;var _0x910f97=[];for(var _0x5cca85=0x0;_0x5cca85<_0x3bedcf[_0x5267('0x88')];_0x5cca85++){var _0x580748=_[_0x5267('0x8b')](_0x1b6dd7,function(_0x1150ba){return _0x3bedcf[_0x5cca85]?_0x1150ba[_0x5267('0x30')]===_0x3bedcf[_0x5cca85][_0x5267('0x30')]:null;});if(_0x580748){if(_0x3bedcf[_0x5cca85][_0x5267('0x8d')]){_0x910f97[_0x5267('0x89')](_0x36bdf0(_0x412511[_0x5267('0x13')],_0x3bedcf[_0x5cca85]));}else{if(!_0x3bedcf[_0x5cca85][_0x5267('0x8e')]){_0x910f97['push'](_0x38a147(_0x580748,_0x3bedcf[_0x5cca85],_0x412511['childModel']));}else{if(_0x580748['model']){_0x910f97[_0x5267('0x89')](_0x3e6964(_0x580748,_0x3bedcf[_0x5cca85]));}}}}}return Promise[_0x5267('0x8c')](_0x910f97);})[_0x5267('0x5')](function(_0x457d84){var _0x4974d1=_0x457d84;var _0x3f2b5d=null;if(_0x4974d1){_0x3f2b5d=_0x4974d1[_0x5267('0x88')]===0x1?_0x4974d1[0x0]:null;}if(!_0x3f2b5d&&!_0x4974d1)return _0x446ba4;var _0x3c547f=_0x57c95a[_0x412511[_0x5267('0x13')]]['rawAttributes'];_0x456e94[_0x5267('0xa')]=_[_0x5267('0x8f')](_0x3c547f);_0x456e94['query']=_[_0x5267('0x8f')](_0x45ee25[_0x5267('0x85')]);_0x456e94['filters']=_['intersection'](_0x456e94[_0x5267('0xa')],_0x456e94[_0x5267('0x85')]);_0x378068['attributes']=_['intersection'](_0x456e94[_0x5267('0xa')],qs[_0x5267('0x90')](_0x45ee25[_0x5267('0x85')][_0x5267('0x90')]));_0x378068[_0x5267('0x91')]=_0x378068['attributes'][_0x5267('0x88')]?_0x378068[_0x5267('0x91')]:_0x456e94['model'];if(!_0x45ee25[_0x5267('0x85')][_0x5267('0x92')](_0x5267('0x93'))){_0x378068[_0x5267('0x94')]=qs[_0x5267('0x94')](_0x45ee25[_0x5267('0x85')][_0x5267('0x94')]);_0x378068[_0x5267('0x95')]=qs['offset'](_0x45ee25['query'][_0x5267('0x95')]);}_0x378068[_0x5267('0x96')]=qs[_0x5267('0x97')](_0x45ee25[_0x5267('0x85')]['sort']);_0x378068[_0x5267('0x7e')]=qs['filters'](_[_0x5267('0x98')](_0x45ee25[_0x5267('0x85')],_0x456e94[_0x5267('0x99')]));if(_0x45ee25[_0x5267('0x85')]['filter']){_0x378068['where']=_[_0x5267('0x9a')](_0x378068[_0x5267('0x7e')],{'$or':_[_0x5267('0x7')](_0x3c547f,function(_0x360a1b){if(_0x360a1b[_0x5267('0xf')][_0x5267('0x9b')]!=='VIRTUAL'){var _0x1b8d72={};_0x1b8d72[_0x360a1b['field']]={'$like':'%'+_0x45ee25[_0x5267('0x85')]['filter']+'%'};return _0x1b8d72;}})});}var _0x2c2b95=[];var _0x20888d=null;var _0x3f31ac={};if(_0x3f2b5d){_0x20888d=_[_0x5267('0x8b')](_0x1b6dd7,[_0x5267('0x30'),_0x3f2b5d[_0x5267('0x30')]]);if(_0x20888d[_0x5267('0x9')]){_0x3f31ac={};if(_0x412511[_0x5267('0x13')]===_0x5267('0xe')){_0x3f31ac[_0x20888d[_0x5267('0x9c')]]=_[_0x5267('0x7')](_0x3f2b5d['associatedResources'],'id');}else{_0x3f31ac[_0x20888d[_0x5267('0x9c')]]=_0x3f2b5d[_0x5267('0x6')];}_0x2c2b95['push'](_0x3f31ac);}else{_0x378068[_0x5267('0x7e')]['id']=_0x3f2b5d[_0x5267('0x6')];}}else{for(var _0x3ebda6=0x0;_0x3ebda6<_0x4974d1[_0x5267('0x88')];_0x3ebda6++){_0x20888d=_[_0x5267('0x8b')](_0x1b6dd7,[_0x5267('0x30'),_0x4974d1[_0x3ebda6][_0x5267('0x30')]]);if(_0x20888d['field']){_0x3f31ac={};_0x3f31ac[_0x20888d[_0x5267('0x9c')]]=_0x4974d1[_0x3ebda6][_0x5267('0x6')];_0x2c2b95[_0x5267('0x89')](_0x3f31ac);}else{if(!_0x378068[_0x5267('0x7e')]['id'])_0x378068[_0x5267('0x7e')]['id']=[];_0x4974d1[_0x3ebda6]['associatedResources']['forEach'](function(_0x34d446){_0x378068[_0x5267('0x7e')]['id'][_0x5267('0x89')](_0x34d446);});}}}if(!_[_0x5267('0x87')](_0x2c2b95)){_0x378068['where']=_[_0x5267('0x9a')](_0x378068[_0x5267('0x7e')],{'$and':{'$or':_0x2c2b95}});}_0x378068=_[_0x5267('0x9a')]({},_0x378068,_0x45ee25[_0x5267('0x9d')]);if(_0x3f2b5d&&!_0x3f2b5d[_0x5267('0x8e')]&&_0x412511[_0x5267('0x13')]===_0x5267('0xe')){if(_0x45ee25[_0x5267('0x85')][_0x5267('0x9e')]){_0x378068[_0x5267('0x9f')]=[{'all':!![]}];}return _0x57c95a[_0x412511[_0x5267('0x13')]][_0x5267('0xb')](_0x378068)[_0x5267('0x5')](function(_0x4a0422){var _0x29c114=[];_0x4a0422[_0x5267('0xa0')](function(_0x45d1cc){var _0x16374d;switch(_0x45d1cc[_0x5267('0xa1')]){case _0x5267('0xa2'):_0x16374d=_[_0x5267('0x8b')](_0x3f2b5d[_0x5267('0x6')],function(_0x42694a){return _0x42694a['id']===_0x45d1cc[_0x5267('0x74')]&&_0x42694a[_0x5267('0xf')]===_0x5267('0xa3');});break;case _0x5267('0xa4'):_0x16374d=_[_0x5267('0x8b')](_0x3f2b5d[_0x5267('0x6')],function(_0x78a2a4){return _0x78a2a4['id']===_0x45d1cc[_0x5267('0x74')]&&_0x78a2a4[_0x5267('0xf')]===_0x5267('0xa5');});break;}if(_0x16374d)_0x29c114[_0x5267('0x89')](_0x45d1cc);});_0x446ba4[_0x5267('0xa6')]=_0x29c114[_0x5267('0x88')];_0x446ba4[_0x5267('0xa7')]=_0x29c114;return _0x446ba4;});}else{return _0x57c95a[_0x412511['childModel']][_0x5267('0xa6')]({'where':_0x378068[_0x5267('0x7e')]})[_0x5267('0x5')](function(_0x405eb4){_0x446ba4[_0x5267('0xa6')]=_0x405eb4;if(_0x45ee25['query'][_0x5267('0x9e')]){if(_0x412511[_0x5267('0x13')]==='CmContact'){_0x378068['include']=[{'model':_0x57c95a['Tag'],'as':_0x5267('0xa8'),'attributes':['id','name',_0x5267('0xa9')],'required':_0x45ee25['query']['tag']?!![]:![]},{'model':_0x57c95a[_0x5267('0x6b')],'as':_0x5267('0xaa'),'attributes':['id',_0x5267('0x30'),_0x5267('0xa9')],'through':_0x45ee25[_0x5267('0x85')]['tag']?{'attributes':[],'where':{'TagId':_0x45ee25['query'][_0x5267('0xab')]||undefined}}:{},'required':_0x45ee25[_0x5267('0x85')][_0x5267('0xab')]?!![]:![]}];}else{_0x378068[_0x5267('0x9f')]=[{'all':!![]}];}}return _0x57c95a[_0x412511[_0x5267('0x13')]]['findAll'](_0x378068);})[_0x5267('0x5')](function(_0x5bece1){_0x446ba4['rows']=_0x5bece1;if(_0x2a032a===_0x5267('0x2f')&&_0x45ee25['query']['openTabs']===_0x5267('0xac')){var _0x321322=[];for(var _0x5085d8=0x0;_0x5085d8<_0x446ba4['rows']['length'];_0x5085d8++){_0x321322[_0x5267('0x89')](_0x1522d6('chat',_0x446ba4[_0x5267('0xa7')][_0x5085d8]['dataValues']));_0x321322[_0x5267('0x89')](_0x1522d6(_0x5267('0xad'),_0x446ba4['rows'][_0x5085d8][_0x5267('0xae')]));_0x321322[_0x5267('0x89')](_0x1522d6(_0x5267('0xaf'),_0x446ba4[_0x5267('0xa7')][_0x5085d8][_0x5267('0xae')]));_0x321322[_0x5267('0x89')](_0x1522d6('mail',_0x446ba4['rows'][_0x5085d8][_0x5267('0xae')]));_0x321322['push'](_0x1522d6('openchannel',_0x446ba4[_0x5267('0xa7')][_0x5085d8]['dataValues']));_0x321322[_0x5267('0x89')](_0x1522d6('whatsapp',_0x446ba4[_0x5267('0xa7')][_0x5085d8]['dataValues']));}return Promise[_0x5267('0x8c')](_0x321322)[_0x5267('0x5')](function(){return _0x446ba4;});}return _0x446ba4;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 252b812..20164c7 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 _0xafc4=['error','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userProfile.socket','register','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5840a5,_0x3d8dd9){var _0x323368=function(_0x17c3d1){while(--_0x17c3d1){_0x5840a5['push'](_0x5840a5['shift']());}};_0x323368(++_0x3d8dd9);}(_0xafc4,0x69));var _0x4afc=function(_0x5da023,_0x1272bb){_0x5da023=_0x5da023-0x0;var _0x555c71=_0xafc4[_0x5da023];return _0x555c71;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var moment=require(_0x4afc('0x1'));var BPromise=require('bluebird');var rs=require(_0x4afc('0x2'));var fs=require('fs');var Redis=require(_0x4afc('0x3'));var db=require(_0x4afc('0x4'))['db'];var utils=require(_0x4afc('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4afc('0x6'));var client=jayson[_0x4afc('0x7')][_0x4afc('0x8')]({'port':0x232a});config[_0x4afc('0x9')]=_[_0x4afc('0xa')](config[_0x4afc('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4afc('0xb'))(new Redis(config[_0x4afc('0x9')]));require(_0x4afc('0xc'))[_0x4afc('0xd')](socket);function respondWithRpcPromise(_0x1b8981,_0x458fde,_0x5542ec){return new BPromise(function(_0x5c523b,_0x7f127f){return client['request'](_0x1b8981,_0x5542ec)[_0x4afc('0xe')](function(_0x225793){logger['info'](_0x4afc('0xf'),_0x458fde,_0x4afc('0x10'));logger[_0x4afc('0x11')](_0x4afc('0x12'),_0x458fde,_0x4afc('0x10'),JSON[_0x4afc('0x13')](_0x225793));if(_0x225793[_0x4afc('0x14')]){if(_0x225793[_0x4afc('0x14')]['code']===0x1f4){logger[_0x4afc('0x14')](_0x4afc('0xf'),_0x458fde,_0x225793[_0x4afc('0x14')][_0x4afc('0x15')]);return _0x7f127f(_0x225793['error']['message']);}logger[_0x4afc('0x14')]('UserProfile,\x20%s,\x20%s',_0x458fde,_0x225793[_0x4afc('0x14')][_0x4afc('0x15')]);return _0x5c523b(_0x225793[_0x4afc('0x14')][_0x4afc('0x15')]);}else{logger[_0x4afc('0x16')](_0x4afc('0xf'),_0x458fde,_0x4afc('0x10'));_0x5c523b(_0x225793[_0x4afc('0x17')][_0x4afc('0x15')]);}})[_0x4afc('0x18')](function(_0x178229){logger['error'](_0x4afc('0xf'),_0x458fde,_0x178229);_0x7f127f(_0x178229);});});} \ No newline at end of file +var _0x21b7=['request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','error','message','catch','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./userProfile.socket','register'];(function(_0xe5011a,_0x10e87f){var _0x444fd5=function(_0x464bf6){while(--_0x464bf6){_0xe5011a['push'](_0xe5011a['shift']());}};_0x444fd5(++_0x10e87f);}(_0x21b7,0xef));var _0x721b=function(_0x51e01a,_0x39bae4){_0x51e01a=_0x51e01a-0x0;var _0x187997=_0x21b7[_0x51e01a];return _0x187997;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x721b('0x0'));var rs=require(_0x721b('0x1'));var fs=require('fs');var Redis=require(_0x721b('0x2'));var db=require(_0x721b('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x721b('0x4'));var config=require(_0x721b('0x5'));var jayson=require(_0x721b('0x6'));var client=jayson[_0x721b('0x7')][_0x721b('0x8')]({'port':0x232a});config[_0x721b('0x9')]=_['defaults'](config[_0x721b('0x9')],{'host':_0x721b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x721b('0xb'))[_0x721b('0xc')](socket);function respondWithRpcPromise(_0xe13699,_0x35f524,_0xfcc6d7){return new BPromise(function(_0x5e11e3,_0x302bfd){return client[_0x721b('0xd')](_0xe13699,_0xfcc6d7)[_0x721b('0xe')](function(_0x2c6f5a){logger[_0x721b('0xf')](_0x721b('0x10'),_0x35f524,_0x721b('0x11'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x35f524,_0x721b('0x11'),JSON['stringify'](_0x2c6f5a));if(_0x2c6f5a[_0x721b('0x12')]){if(_0x2c6f5a[_0x721b('0x12')]['code']===0x1f4){logger['error'](_0x721b('0x10'),_0x35f524,_0x2c6f5a[_0x721b('0x12')][_0x721b('0x13')]);return _0x302bfd(_0x2c6f5a[_0x721b('0x12')][_0x721b('0x13')]);}logger[_0x721b('0x12')](_0x721b('0x10'),_0x35f524,_0x2c6f5a[_0x721b('0x12')][_0x721b('0x13')]);return _0x5e11e3(_0x2c6f5a[_0x721b('0x12')][_0x721b('0x13')]);}else{logger[_0x721b('0xf')](_0x721b('0x10'),_0x35f524,_0x721b('0x11'));_0x5e11e3(_0x2c6f5a['result'][_0x721b('0x13')]);}})[_0x721b('0x14')](function(_0x821d77){logger[_0x721b('0x12')](_0x721b('0x10'),_0x35f524,_0x821d77);_0x302bfd(_0x821d77);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 178c906..4367361 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 _0x4331=['register','length','userProfile:','./userProfile.events','remove','emit','removeListener'];(function(_0x3b5fda,_0xde2b62){var _0x5bfd99=function(_0x384ffc){while(--_0x384ffc){_0x3b5fda['push'](_0x3b5fda['shift']());}};_0x5bfd99(++_0xde2b62);}(_0x4331,0xdc));var _0x1433=function(_0x5886b1,_0x8c78aa){_0x5886b1=_0x5886b1-0x0;var _0x2713f9=_0x4331[_0x5886b1];return _0x2713f9;};'use strict';var UserProfileEvents=require(_0x1433('0x0'));var events=['save',_0x1433('0x1'),'update'];function createListener(_0x559526,_0x2dd60d){return function(_0x26c1fe){_0x2dd60d[_0x1433('0x2')](_0x559526,_0x26c1fe);};}function removeListener(_0x3f0d80,_0x162019){return function(){UserProfileEvents[_0x1433('0x3')](_0x3f0d80,_0x162019);};}exports[_0x1433('0x4')]=function(_0x5c7eee){for(var _0x990f0e=0x0,_0x5a6e2c=events[_0x1433('0x5')];_0x990f0e<_0x5a6e2c;_0x990f0e++){var _0x4fab56=events[_0x990f0e];var _0x4e34c2=createListener(_0x1433('0x6')+_0x4fab56,_0x5c7eee);UserProfileEvents['on'](_0x4fab56,_0x4e34c2);}}; \ No newline at end of file +var _0xa1f0=['length','userProfile:','./userProfile.events','save','remove','emit','removeListener','register'];(function(_0xabbd2f,_0x44d05a){var _0x34a040=function(_0x3736d9){while(--_0x3736d9){_0xabbd2f['push'](_0xabbd2f['shift']());}};_0x34a040(++_0x44d05a);}(_0xa1f0,0x162));var _0x0a1f=function(_0x2f3f58,_0xdd6784){_0x2f3f58=_0x2f3f58-0x0;var _0x19fdd1=_0xa1f0[_0x2f3f58];return _0x19fdd1;};'use strict';var UserProfileEvents=require(_0x0a1f('0x0'));var events=[_0x0a1f('0x1'),_0x0a1f('0x2'),'update'];function createListener(_0x2dc645,_0x5530ac){return function(_0x9511ff){_0x5530ac[_0x0a1f('0x3')](_0x2dc645,_0x9511ff);};}function removeListener(_0x49532d,_0x40ee06){return function(){UserProfileEvents[_0x0a1f('0x4')](_0x49532d,_0x40ee06);};}exports[_0x0a1f('0x5')]=function(_0x36626c){for(var _0x421298=0x0,_0xa9f624=events[_0x0a1f('0x6')];_0x421298<_0xa9f624;_0x421298++){var _0x5c36fa=events[_0x421298];var _0x4dfb3b=createListener(_0x0a1f('0x7')+_0x5c36fa,_0x36626c);UserProfileEvents['on'](_0x5c36fa,_0x4dfb3b);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 76c3762..cb394a5 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 _0x5fe8=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','destroy','exports','connect-timeout'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5fe8,0x1cb));var _0x85fe=function(_0x28ace8,_0x131557){_0x28ace8=_0x28ace8-0x0;var _0x3957e0=_0x5fe8[_0x28ace8];return _0x3957e0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x85fe('0x0'));var express=require(_0x85fe('0x1'));var router=express[_0x85fe('0x2')]();var fs_extra=require(_0x85fe('0x3'));var auth=require(_0x85fe('0x4'));var interaction=require(_0x85fe('0x5'));var config=require('../../config/environment');var controller=require(_0x85fe('0x6'));router[_0x85fe('0x7')]('/',auth[_0x85fe('0x8')](),controller[_0x85fe('0x9')]);router[_0x85fe('0x7')](_0x85fe('0xa'),auth[_0x85fe('0x8')](),controller[_0x85fe('0xb')]);router[_0x85fe('0x7')]('/:id',auth[_0x85fe('0x8')](),controller[_0x85fe('0xc')]);router[_0x85fe('0xd')]('/',auth[_0x85fe('0x8')](),controller[_0x85fe('0xe')]);router[_0x85fe('0xf')](_0x85fe('0x10'),auth[_0x85fe('0x8')](),controller[_0x85fe('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x85fe('0x12')]);module[_0x85fe('0x13')]=router; \ No newline at end of file +var _0x73fa=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports'];(function(_0x2a3698,_0x1d96d3){var _0x3a20c2=function(_0x1fffc1){while(--_0x1fffc1){_0x2a3698['push'](_0x2a3698['shift']());}};_0x3a20c2(++_0x1d96d3);}(_0x73fa,0x1f4));var _0xa73f=function(_0x43f585,_0x3f8ba8){_0x43f585=_0x43f585-0x0;var _0x399005=_0x73fa[_0x43f585];return _0x399005;};'use strict';var multer=require(_0xa73f('0x0'));var util=require(_0xa73f('0x1'));var path=require('path');var timeout=require(_0xa73f('0x2'));var express=require(_0xa73f('0x3'));var router=express[_0xa73f('0x4')]();var fs_extra=require(_0xa73f('0x5'));var auth=require(_0xa73f('0x6'));var interaction=require(_0xa73f('0x7'));var config=require(_0xa73f('0x8'));var controller=require('./userProfileResource.controller');router[_0xa73f('0x9')]('/',auth[_0xa73f('0xa')](),controller['index']);router[_0xa73f('0x9')]('/describe',auth[_0xa73f('0xa')](),controller[_0xa73f('0xb')]);router[_0xa73f('0x9')](_0xa73f('0xc'),auth['isAuthenticated'](),controller[_0xa73f('0xd')]);router[_0xa73f('0xe')]('/',auth[_0xa73f('0xa')](),controller[_0xa73f('0xf')]);router[_0xa73f('0x10')](_0xa73f('0xc'),auth['isAuthenticated'](),controller[_0xa73f('0x11')]);router['delete'](_0xa73f('0xc'),auth['isAuthenticated'](),controller[_0xa73f('0x12')]);module[_0xa73f('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 7c362a0..68de3cb 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 _0xe773=['sequelize','STRING'];(function(_0x548dc4,_0x5163fc){var _0x5e9272=function(_0x3de7ec){while(--_0x3de7ec){_0x548dc4['push'](_0x548dc4['shift']());}};_0x5e9272(++_0x5163fc);}(_0xe773,0x16c));var _0x3e77=function(_0x442089,_0x54906a){_0x442089=_0x442089-0x0;var _0x2f1cc4=_0xe773[_0x442089];return _0x2f1cc4;};'use strict';var Sequelize=require(_0x3e77('0x0'));module['exports']={'name':{'type':Sequelize[_0x3e77('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x3e77('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xbb0b=['INTEGER','STRING','sequelize'];(function(_0x34c3f3,_0x15f139){var _0x3ca5cb=function(_0x1c7ed6){while(--_0x1c7ed6){_0x34c3f3['push'](_0x34c3f3['shift']());}};_0x3ca5cb(++_0x15f139);}(_0xbb0b,0x1af));var _0xbbb0=function(_0x1c14e6,_0x12c86d){_0x1c14e6=_0x1c14e6-0x0;var _0x243c81=_0xbb0b[_0x1c14e6];return _0x243c81;};'use strict';var Sequelize=require(_0xbbb0('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xbbb0('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xbbb0('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 4e24125..4f7f625 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 _0x57ca=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','UserProfileResource','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','params','find','catch','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox'];(function(_0xdc0d16,_0x2e7bac){var _0x31f716=function(_0xe1a7a1){while(--_0xe1a7a1){_0xdc0d16['push'](_0xdc0d16['shift']());}};_0x31f716(++_0x2e7bac);}(_0x57ca,0x108));var _0xa57c=function(_0x59941b,_0x121697){_0x59941b=_0x59941b-0x0;var _0x43d0b2=_0x57ca[_0x59941b];return _0x43d0b2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa57c('0x0'));var zipdir=require(_0xa57c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var BPromise=require(_0xa57c('0x4'));var Mustache=require(_0xa57c('0x5'));var util=require(_0xa57c('0x6'));var path=require('path');var sox=require(_0xa57c('0x7'));var csv=require(_0xa57c('0x8'));var ejs=require(_0xa57c('0x9'));var fs=require('fs');var fs_extra=require(_0xa57c('0xa'));var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x8'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa57c('0x15'));var db=require(_0xa57c('0x16'))['db'];function respondWithStatusCode(_0x1f2bb5,_0x9e25bf){_0x9e25bf=_0x9e25bf||0xcc;return function(_0x205e72){if(_0x205e72){return _0x1f2bb5['sendStatus'](_0x9e25bf);}return _0x1f2bb5[_0xa57c('0x17')](_0x9e25bf)['end']();};}function respondWithResult(_0x30d23d,_0x3d5995){_0x3d5995=_0x3d5995||0xc8;return function(_0x30940d){if(_0x30940d){return _0x30d23d[_0xa57c('0x17')](_0x3d5995)[_0xa57c('0x18')](_0x30940d);}};}function respondWithFilteredResult(_0x37a323,_0x3f900a){return function(_0x4b4bdb){if(_0x4b4bdb){var _0x26607a=typeof _0x3f900a[_0xa57c('0x19')]===_0xa57c('0x1a')&&typeof _0x3f900a['limit']===_0xa57c('0x1a');var _0x5f33f1=_0x4b4bdb[_0xa57c('0x1b')];var _0x3d781d=_0x26607a?0x0:_0x3f900a[_0xa57c('0x19')];var _0xe3d505=_0x26607a?_0x4b4bdb[_0xa57c('0x1b')]:_0x3f900a[_0xa57c('0x19')]+_0x3f900a[_0xa57c('0x1c')];var _0x595c7a;if(_0xe3d505>=_0x5f33f1){_0xe3d505=_0x5f33f1;_0x595c7a=0xc8;}else{_0x595c7a=0xce;}_0x37a323['status'](_0x595c7a);return _0x37a323[_0xa57c('0x1d')]('Content-Range',_0x3d781d+'-'+_0xe3d505+'/'+_0x5f33f1)['json'](_0x4b4bdb);}return null;};}function patchUpdates(_0x418415){return function(_0xa5b314){try{jsonpatch[_0xa57c('0x1e')](_0xa5b314,_0x418415,!![]);}catch(_0x23bec0){return BPromise['reject'](_0x23bec0);}return _0xa5b314[_0xa57c('0x1f')]();};}function saveUpdates(_0x25715f,_0x34d1bc){return function(_0x2213b2){if(_0x2213b2){return _0x2213b2[_0xa57c('0x20')](_0x25715f)[_0xa57c('0x21')](function(_0x1e0192){return _0x1e0192;});}return null;};}function removeEntity(_0x42038e,_0x2e99ed){return function(_0xdf65dd){if(_0xdf65dd){return _0xdf65dd[_0xa57c('0x22')]()[_0xa57c('0x21')](function(){_0x42038e[_0xa57c('0x17')](0xcc)[_0xa57c('0x23')]();});}};}function handleEntityNotFound(_0x431bec,_0x511a26){return function(_0x2db443){if(!_0x2db443){_0x431bec[_0xa57c('0x24')](0x194);}return _0x2db443;};}function handleError(_0x27884d,_0x5228b9){_0x5228b9=_0x5228b9||0x1f4;return function(_0x315ad7){logger[_0xa57c('0x25')](_0x315ad7[_0xa57c('0x26')]);if(_0x315ad7[_0xa57c('0x27')]){delete _0x315ad7[_0xa57c('0x27')];}_0x27884d[_0xa57c('0x17')](_0x5228b9)['send'](_0x315ad7);};}exports[_0xa57c('0x28')]=function(_0x4c1478,_0x54a18b){var _0x257661={},_0x7d10ec={},_0x5a3e03={'count':0x0,'rows':[]};var _0x12898b=_[_0xa57c('0x29')](db[_0xa57c('0x2a')]['rawAttributes'],function(_0xd779f1){return{'name':_0xd779f1['fieldName'],'type':_0xd779f1[_0xa57c('0x2b')]['key']};});_0x7d10ec[_0xa57c('0x2c')]=_['map'](_0x12898b,_0xa57c('0x27'));_0x7d10ec['query']=_[_0xa57c('0x2d')](_0x4c1478[_0xa57c('0x2e')]);_0x7d10ec[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x7d10ec[_0xa57c('0x2c')],_0x7d10ec[_0xa57c('0x2e')]);_0x257661[_0xa57c('0x31')]=_['intersection'](_0x7d10ec[_0xa57c('0x2c')],qs['fields'](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x257661[_0xa57c('0x31')]=_0x257661['attributes'][_0xa57c('0x33')]?_0x257661['attributes']:_0x7d10ec[_0xa57c('0x2c')];if(!_0x4c1478['query'][_0xa57c('0x34')]('nolimit')){_0x257661[_0xa57c('0x1c')]=qs[_0xa57c('0x1c')](_0x4c1478['query'][_0xa57c('0x1c')]);_0x257661['offset']=qs[_0xa57c('0x19')](_0x4c1478['query'][_0xa57c('0x19')]);}_0x257661[_0xa57c('0x35')]=qs[_0xa57c('0x36')](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x36')]);_0x257661[_0xa57c('0x37')]=qs['filters'](_['pick'](_0x4c1478[_0xa57c('0x2e')],_0x7d10ec[_0xa57c('0x2f')]),_0x12898b);if(_0x4c1478[_0xa57c('0x2e')]['filter']){_0x257661[_0xa57c('0x37')]=_['merge'](_0x257661[_0xa57c('0x37')],{'$or':_[_0xa57c('0x29')](_0x12898b,function(_0x5c8256){if(_0x5c8256['type']!=='VIRTUAL'){var _0x3be888={};_0x3be888[_0x5c8256[_0xa57c('0x27')]]={'$like':'%'+_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x38')]+'%'};return _0x3be888;}})});}_0x257661=_[_0xa57c('0x39')]({},_0x257661,_0x4c1478[_0xa57c('0x3a')]);var _0x5a444a={'where':_0x257661[_0xa57c('0x37')]};return db[_0xa57c('0x2a')]['count'](_0x5a444a)['then'](function(_0x5e10b){_0x5a3e03[_0xa57c('0x1b')]=_0x5e10b;if(_0x4c1478['query'][_0xa57c('0x3b')]){_0x257661[_0xa57c('0x3c')]=[{'all':!![]}];}return db[_0xa57c('0x2a')][_0xa57c('0x3d')](_0x257661);})[_0xa57c('0x21')](function(_0x43c1d7){_0x5a3e03['rows']=_0x43c1d7;return _0x5a3e03;})[_0xa57c('0x21')](respondWithFilteredResult(_0x54a18b,_0x257661))['catch'](handleError(_0x54a18b,null));};exports['show']=function(_0x5b3300,_0x520383){var _0x588199={'raw':![],'where':{'id':_0x5b3300[_0xa57c('0x3e')]['id']}},_0x39b20f={};_0x39b20f[_0xa57c('0x2c')]=_['keys'](db['UserProfileResource']['rawAttributes']);_0x39b20f[_0xa57c('0x2e')]=_[_0xa57c('0x2d')](_0x5b3300[_0xa57c('0x2e')]);_0x39b20f[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],_0x39b20f['query']);_0x588199[_0xa57c('0x31')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],qs[_0xa57c('0x32')](_0x5b3300[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x588199['attributes']=_0x588199[_0xa57c('0x31')][_0xa57c('0x33')]?_0x588199[_0xa57c('0x31')]:_0x39b20f[_0xa57c('0x2c')];if(_0x5b3300[_0xa57c('0x2e')]['includeAll']){_0x588199[_0xa57c('0x3c')]=[{'all':!![]}];}_0x588199=_[_0xa57c('0x39')]({},_0x588199,_0x5b3300[_0xa57c('0x3a')]);return db[_0xa57c('0x2a')][_0xa57c('0x3f')](_0x588199)[_0xa57c('0x21')](handleEntityNotFound(_0x520383,null))['then'](respondWithResult(_0x520383,null))[_0xa57c('0x40')](handleError(_0x520383,null));};exports[_0xa57c('0x41')]=function(_0x247906,_0x44ea0a){return db[_0xa57c('0x2a')][_0xa57c('0x41')](_0x247906['body'],{})['then'](respondWithResult(_0x44ea0a,0xc9))['catch'](handleError(_0x44ea0a,null));};exports['update']=function(_0x232675,_0x49492f){if(_0x232675[_0xa57c('0x42')]['id']){delete _0x232675[_0xa57c('0x42')]['id'];}return db['UserProfileResource'][_0xa57c('0x3f')]({'where':{'id':_0x232675[_0xa57c('0x3e')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x49492f,null))[_0xa57c('0x21')](saveUpdates(_0x232675[_0xa57c('0x42')],null))['then'](respondWithResult(_0x49492f,null))[_0xa57c('0x40')](handleError(_0x49492f,null));};exports[_0xa57c('0x22')]=function(_0x4584e8,_0xd57bac){return db[_0xa57c('0x2a')]['find']({'where':{'id':_0x4584e8[_0xa57c('0x3e')]['id']}})['then'](handleEntityNotFound(_0xd57bac,null))['then'](removeEntity(_0xd57bac,null))[_0xa57c('0x40')](handleError(_0xd57bac,null));};exports[_0xa57c('0x43')]=function(_0x5ded49,_0x5bf336){return db['UserProfileResource'][_0xa57c('0x43')]()[_0xa57c('0x21')](respondWithResult(_0x5bf336,null))[_0xa57c('0x40')](handleError(_0x5bf336,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(_0x438434,_0x36f21f){var _0x3b97c9=function(_0x1ecb7b){while(--_0x1ecb7b){_0x438434['push'](_0x438434['shift']());}};_0x3b97c9(++_0x36f21f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1237d4,_0x20bbfc){_0x1237d4=_0x1237d4-0x0;var _0x441fb6=_0x5f2f[_0x1237d4];return _0x441fb6;};'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 d61753c..8534899 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 _0xfdf0=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','sectionId','lodash'];(function(_0x40a397,_0x4fa39c){var _0x464c33=function(_0x29125c){while(--_0x29125c){_0x40a397['push'](_0x40a397['shift']());}};_0x464c33(++_0x4fa39c);}(_0xfdf0,0x1b2));var _0x0fdf=function(_0x55d8c5,_0x10287a){_0x55d8c5=_0x55d8c5-0x0;var _0x225ae5=_0xfdf0[_0x55d8c5];return _0x225ae5;};'use strict';var _=require(_0x0fdf('0x0'));var util=require(_0x0fdf('0x1'));var logger=require('../../config/logger')(_0x0fdf('0x2'));var moment=require(_0x0fdf('0x3'));var BPromise=require(_0x0fdf('0x4'));var rp=require(_0x0fdf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fdf('0x6'));var config=require(_0x0fdf('0x7'));var attributes=require(_0x0fdf('0x8'));module[_0x0fdf('0x9')]=function(_0x4b7f8a,_0x226e6c){return _0x4b7f8a[_0x0fdf('0xa')](_0x0fdf('0xb'),attributes,{'tableName':_0x0fdf('0xc'),'paranoid':![],'indexes':[{'name':_0x0fdf('0xd'),'fields':['resourceId',_0x0fdf('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x82ac=['resourceId','sectionId','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources'];(function(_0x12fc43,_0x5b4d63){var _0x572142=function(_0x4d5855){while(--_0x4d5855){_0x12fc43['push'](_0x12fc43['shift']());}};_0x572142(++_0x5b4d63);}(_0x82ac,0x179));var _0xc82a=function(_0x3e154e,_0x18d45c){_0x3e154e=_0x3e154e-0x0;var _0x1c387a=_0x82ac[_0x3e154e];return _0x1c387a;};'use strict';var _=require(_0xc82a('0x0'));var util=require(_0xc82a('0x1'));var logger=require('../../config/logger')(_0xc82a('0x2'));var moment=require(_0xc82a('0x3'));var BPromise=require(_0xc82a('0x4'));var rp=require(_0xc82a('0x5'));var fs=require('fs');var path=require(_0xc82a('0x6'));var rimraf=require('rimraf');var config=require(_0xc82a('0x7'));var attributes=require(_0xc82a('0x8'));module[_0xc82a('0x9')]=function(_0x174d32,_0x122498){return _0x174d32[_0xc82a('0xa')](_0xc82a('0xb'),attributes,{'tableName':_0xc82a('0xc'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xc82a('0xd'),_0xc82a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 905debd..0d6b059 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 _0x9609=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','bluebird','ioredis'];(function(_0x85961a,_0x58a6f5){var _0x43d5d7=function(_0x22fcec){while(--_0x22fcec){_0x85961a['push'](_0x85961a['shift']());}};_0x43d5d7(++_0x58a6f5);}(_0x9609,0x146));var _0x9960=function(_0x156fba,_0x3a5026){_0x156fba=_0x156fba-0x0;var _0x7c7f24=_0x9609[_0x156fba];return _0x7c7f24;};'use strict';var _=require(_0x9960('0x0'));var util=require(_0x9960('0x1'));var moment=require('moment');var BPromise=require(_0x9960('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9960('0x3'));var db=require(_0x9960('0x4'))['db'];var utils=require(_0x9960('0x5'));var logger=require(_0x9960('0x6'))(_0x9960('0x7'));var config=require(_0x9960('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9960('0x9')][_0x9960('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f6810,_0x51b3fa,_0x557c9a){return new BPromise(function(_0x3613c4,_0x391092){return client[_0x9960('0xb')](_0x1f6810,_0x557c9a)[_0x9960('0xc')](function(_0x576de5){logger[_0x9960('0xd')](_0x9960('0xe'),_0x51b3fa,_0x9960('0xf'));logger[_0x9960('0x10')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x51b3fa,_0x9960('0xf'),JSON[_0x9960('0x11')](_0x576de5));if(_0x576de5[_0x9960('0x12')]){if(_0x576de5[_0x9960('0x12')]['code']===0x1f4){logger[_0x9960('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x51b3fa,_0x576de5[_0x9960('0x12')][_0x9960('0x13')]);return _0x391092(_0x576de5[_0x9960('0x12')]['message']);}logger['error'](_0x9960('0xe'),_0x51b3fa,_0x576de5[_0x9960('0x12')][_0x9960('0x13')]);return _0x3613c4(_0x576de5['error'][_0x9960('0x13')]);}else{logger['info']('UserProfileResource,\x20%s,\x20%s',_0x51b3fa,_0x9960('0xf'));_0x3613c4(_0x576de5[_0x9960('0x14')][_0x9960('0x13')]);}})[_0x9960('0x15')](function(_0x35ef24){logger[_0x9960('0x12')](_0x9960('0xe'),_0x51b3fa,_0x35ef24);_0x391092(_0x35ef24);});});} \ No newline at end of file +var _0x624d=['info','UserProfileResource,\x20%s,\x20%s','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x624d,0x1ed));var _0xd624=function(_0x590b61,_0x4c4335){_0x590b61=_0x590b61-0x0;var _0x1a14dc=_0x624d[_0x590b61];return _0x1a14dc;};'use strict';var _=require(_0xd624('0x0'));var util=require(_0xd624('0x1'));var moment=require(_0xd624('0x2'));var BPromise=require(_0xd624('0x3'));var rs=require(_0xd624('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd624('0x5'))(_0xd624('0x6'));var config=require(_0xd624('0x7'));var jayson=require(_0xd624('0x8'));var client=jayson[_0xd624('0x9')][_0xd624('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d8b1e,_0x3fa6af,_0x1f43b1){return new BPromise(function(_0x916e0b,_0x2bf2d7){return client[_0xd624('0xb')](_0x2d8b1e,_0x1f43b1)[_0xd624('0xc')](function(_0x2d7791){logger[_0xd624('0xd')](_0xd624('0xe'),_0x3fa6af,'request\x20sent');logger['debug'](_0xd624('0xf'),_0x3fa6af,_0xd624('0x10'),JSON[_0xd624('0x11')](_0x2d7791));if(_0x2d7791[_0xd624('0x12')]){if(_0x2d7791[_0xd624('0x12')][_0xd624('0x13')]===0x1f4){logger[_0xd624('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x3fa6af,_0x2d7791[_0xd624('0x12')]['message']);return _0x2bf2d7(_0x2d7791[_0xd624('0x12')]['message']);}logger[_0xd624('0x12')](_0xd624('0xe'),_0x3fa6af,_0x2d7791[_0xd624('0x12')][_0xd624('0x14')]);return _0x916e0b(_0x2d7791['error'][_0xd624('0x14')]);}else{logger[_0xd624('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x3fa6af,_0xd624('0x10'));_0x916e0b(_0x2d7791[_0xd624('0x15')][_0xd624('0x14')]);}})[_0xd624('0x16')](function(_0x23b0a2){logger[_0xd624('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x3fa6af,_0x23b0a2);_0x2bf2d7(_0x23b0a2);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 12d3a06..285fb03 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 _0x8e18=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','post','put','update','destroy','exports','multer'];(function(_0x53da4e,_0x1fb698){var _0x321239=function(_0x4ab228){while(--_0x4ab228){_0x53da4e['push'](_0x53da4e['shift']());}};_0x321239(++_0x1fb698);}(_0x8e18,0x1df));var _0x88e1=function(_0x11063b,_0x5f0f9d){_0x11063b=_0x11063b-0x0;var _0x491bb6=_0x8e18[_0x11063b];return _0x491bb6;};'use strict';var multer=require(_0x88e1('0x0'));var util=require(_0x88e1('0x1'));var path=require('path');var timeout=require(_0x88e1('0x2'));var express=require(_0x88e1('0x3'));var router=express[_0x88e1('0x4')]();var fs_extra=require(_0x88e1('0x5'));var auth=require(_0x88e1('0x6'));var interaction=require(_0x88e1('0x7'));var config=require(_0x88e1('0x8'));var controller=require('./userProfileSection.controller');router[_0x88e1('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x88e1('0x9')](_0x88e1('0xa'),auth[_0x88e1('0xb')](),controller[_0x88e1('0xc')]);router[_0x88e1('0x9')](_0x88e1('0xd'),auth[_0x88e1('0xb')](),controller[_0x88e1('0xe')]);router[_0x88e1('0xf')]('/',auth[_0x88e1('0xb')](),controller['create']);router[_0x88e1('0x10')]('/:id',auth[_0x88e1('0xb')](),controller[_0x88e1('0x11')]);router['delete'](_0x88e1('0xd'),auth[_0x88e1('0xb')](),controller[_0x88e1('0x12')]);module[_0x88e1('0x13')]=router; \ No newline at end of file +var _0x9f22=['isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x9f22,0x96));var _0x29f2=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9f22[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0x29f2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x29f2('0x1'));var express=require(_0x29f2('0x2'));var router=express[_0x29f2('0x3')]();var fs_extra=require(_0x29f2('0x4'));var auth=require(_0x29f2('0x5'));var interaction=require(_0x29f2('0x6'));var config=require(_0x29f2('0x7'));var controller=require(_0x29f2('0x8'));router[_0x29f2('0x9')]('/',auth[_0x29f2('0xa')](),controller[_0x29f2('0xb')]);router[_0x29f2('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x29f2('0xc'),auth['isAuthenticated'](),controller[_0x29f2('0xd')]);router[_0x29f2('0xe')]('/',auth[_0x29f2('0xa')](),controller['create']);router[_0x29f2('0xf')](_0x29f2('0xc'),auth['isAuthenticated'](),controller[_0x29f2('0x10')]);router[_0x29f2('0x11')](_0x29f2('0xc'),auth[_0x29f2('0xa')](),controller[_0x29f2('0x12')]);module[_0x29f2('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index d6ac077..2b6e8fe 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 _0xb9a7=['getDataValue','split','exports','BOOLEAN','STRING','setDataValue','crudPermissions','join'];(function(_0x4f5dd5,_0x1fb6d8){var _0x26dc3a=function(_0x26ed32){while(--_0x26ed32){_0x4f5dd5['push'](_0x4f5dd5['shift']());}};_0x26dc3a(++_0x1fb6d8);}(_0xb9a7,0x112));var _0x7b9a=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xb9a7[_0x2064e5];return _0x21a233;};'use strict';var Sequelize=require('sequelize');module[_0x7b9a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x7b9a('0x1')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x7b9a('0x2')],'set':function(_0x40ef7d){this[_0x7b9a('0x3')](_0x7b9a('0x4'),_0x40ef7d?_0x40ef7d[_0x7b9a('0x5')](''):[]);},'get':function(){return this[_0x7b9a('0x6')](_0x7b9a('0x4'))?this[_0x7b9a('0x6')](_0x7b9a('0x4'))[_0x7b9a('0x7')](''):[];}}}; \ No newline at end of file +var _0xac4a=['setDataValue','crudPermissions','getDataValue','split','sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x560a4d,_0x4a2527){var _0x2cd885=function(_0x3708e8){while(--_0x3708e8){_0x560a4d['push'](_0x560a4d['shift']());}};_0x2cd885(++_0x4a2527);}(_0xac4a,0x13f));var _0xaac4=function(_0x412b24,_0x3bec97){_0x412b24=_0x412b24-0x0;var _0x83af99=_0xac4a[_0x412b24];return _0x83af99;};'use strict';var Sequelize=require(_0xaac4('0x0'));module[_0xaac4('0x1')]={'name':{'type':Sequelize[_0xaac4('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xaac4('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xaac4('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xaac4('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x2af0f6){this[_0xaac4('0x5')](_0xaac4('0x6'),_0x2af0f6?_0x2af0f6['join'](''):[]);},'get':function(){return this[_0xaac4('0x7')]('crudPermissions')?this[_0xaac4('0x7')]('crudPermissions')[_0xaac4('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 9612016..9b1c16d 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 _0xb9ee=['save','update','then','destroy','error','stack','name','send','index','UserProfileSection','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','findAll','rows','show','include','find','create','body','catch','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','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','json','limit','undefined','count','offset','set','Content-Range','apply','reject'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb9ee,0x7a));var _0xeb9e=function(_0x4c06ac,_0x568788){_0x4c06ac=_0x4c06ac-0x0;var _0x2333cb=_0xb9ee[_0x4c06ac];return _0x2333cb;};'use strict';var emlformat=require(_0xeb9e('0x0'));var rimraf=require(_0xeb9e('0x1'));var zipdir=require(_0xeb9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb9e('0x3'));var moment=require(_0xeb9e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xeb9e('0x5'));var util=require(_0xeb9e('0x6'));var path=require(_0xeb9e('0x7'));var sox=require(_0xeb9e('0x8'));var csv=require(_0xeb9e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeb9e('0xa'));var _=require(_0xeb9e('0xb'));var squel=require('squel');var crypto=require(_0xeb9e('0xc'));var jsforce=require(_0xeb9e('0xd'));var deskjs=require(_0xeb9e('0xe'));var toCsv=require(_0xeb9e('0x9'));var querystring=require('querystring');var Papa=require(_0xeb9e('0xf'));var Redis=require(_0xeb9e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xeb9e('0x11'));var as=require(_0xeb9e('0x12'));var hardwareService=require(_0xeb9e('0x13'));var logger=require(_0xeb9e('0x14'))(_0xeb9e('0x15'));var utils=require(_0xeb9e('0x16'));var config=require(_0xeb9e('0x17'));var licenseUtil=require(_0xeb9e('0x18'));var db=require(_0xeb9e('0x19'))['db'];function respondWithStatusCode(_0x113ff2,_0x346d45){_0x346d45=_0x346d45||0xcc;return function(_0x1b1082){if(_0x1b1082){return _0x113ff2[_0xeb9e('0x1a')](_0x346d45);}return _0x113ff2[_0xeb9e('0x1b')](_0x346d45)[_0xeb9e('0x1c')]();};}function respondWithResult(_0x6effe6,_0x298927){_0x298927=_0x298927||0xc8;return function(_0x5b48b7){if(_0x5b48b7){return _0x6effe6[_0xeb9e('0x1b')](_0x298927)[_0xeb9e('0x1d')](_0x5b48b7);}};}function respondWithFilteredResult(_0x5dce50,_0x161989){return function(_0x5ccac2){if(_0x5ccac2){var _0x1e4d89=typeof _0x161989['offset']==='undefined'&&typeof _0x161989[_0xeb9e('0x1e')]===_0xeb9e('0x1f');var _0x47960d=_0x5ccac2[_0xeb9e('0x20')];var _0x17fc9b=_0x1e4d89?0x0:_0x161989[_0xeb9e('0x21')];var _0x2e6fbb=_0x1e4d89?_0x5ccac2['count']:_0x161989[_0xeb9e('0x21')]+_0x161989[_0xeb9e('0x1e')];var _0x42e2e3;if(_0x2e6fbb>=_0x47960d){_0x2e6fbb=_0x47960d;_0x42e2e3=0xc8;}else{_0x42e2e3=0xce;}_0x5dce50[_0xeb9e('0x1b')](_0x42e2e3);return _0x5dce50[_0xeb9e('0x22')](_0xeb9e('0x23'),_0x17fc9b+'-'+_0x2e6fbb+'/'+_0x47960d)[_0xeb9e('0x1d')](_0x5ccac2);}return null;};}function patchUpdates(_0x26bc7e){return function(_0x4beb5e){try{jsonpatch[_0xeb9e('0x24')](_0x4beb5e,_0x26bc7e,!![]);}catch(_0x45b8d7){return BPromise[_0xeb9e('0x25')](_0x45b8d7);}return _0x4beb5e[_0xeb9e('0x26')]();};}function saveUpdates(_0x20721b,_0x507217){return function(_0x3cb4e4){if(_0x3cb4e4){return _0x3cb4e4[_0xeb9e('0x27')](_0x20721b)[_0xeb9e('0x28')](function(_0x5d72d3){return _0x5d72d3;});}return null;};}function removeEntity(_0x4e265e,_0x41e860){return function(_0x4039eb){if(_0x4039eb){return _0x4039eb[_0xeb9e('0x29')]()[_0xeb9e('0x28')](function(){_0x4e265e[_0xeb9e('0x1b')](0xcc)[_0xeb9e('0x1c')]();});}};}function handleEntityNotFound(_0x207771,_0x232ed7){return function(_0x14faf9){if(!_0x14faf9){_0x207771['sendStatus'](0x194);}return _0x14faf9;};}function handleError(_0x6db0cc,_0x3b3560){_0x3b3560=_0x3b3560||0x1f4;return function(_0x52ae01){logger[_0xeb9e('0x2a')](_0x52ae01[_0xeb9e('0x2b')]);if(_0x52ae01[_0xeb9e('0x2c')]){delete _0x52ae01[_0xeb9e('0x2c')];}_0x6db0cc[_0xeb9e('0x1b')](_0x3b3560)[_0xeb9e('0x2d')](_0x52ae01);};}exports[_0xeb9e('0x2e')]=function(_0x107906,_0x16a768){var _0x4d64b3={},_0x3c8f01={},_0x5cfffc={'count':0x0,'rows':[]};var _0x358885=_['map'](db[_0xeb9e('0x2f')][_0xeb9e('0x30')],function(_0x1fa68a){return{'name':_0x1fa68a['fieldName'],'type':_0x1fa68a[_0xeb9e('0x31')]['key']};});_0x3c8f01[_0xeb9e('0x32')]=_[_0xeb9e('0x33')](_0x358885,_0xeb9e('0x2c'));_0x3c8f01[_0xeb9e('0x34')]=_[_0xeb9e('0x35')](_0x107906[_0xeb9e('0x34')]);_0x3c8f01[_0xeb9e('0x36')]=_[_0xeb9e('0x37')](_0x3c8f01['model'],_0x3c8f01[_0xeb9e('0x34')]);_0x4d64b3[_0xeb9e('0x38')]=_[_0xeb9e('0x37')](_0x3c8f01[_0xeb9e('0x32')],qs[_0xeb9e('0x39')](_0x107906['query'][_0xeb9e('0x39')]));_0x4d64b3[_0xeb9e('0x38')]=_0x4d64b3[_0xeb9e('0x38')][_0xeb9e('0x3a')]?_0x4d64b3[_0xeb9e('0x38')]:_0x3c8f01['model'];if(!_0x107906['query'][_0xeb9e('0x3b')](_0xeb9e('0x3c'))){_0x4d64b3['limit']=qs['limit'](_0x107906[_0xeb9e('0x34')]['limit']);_0x4d64b3['offset']=qs[_0xeb9e('0x21')](_0x107906['query'][_0xeb9e('0x21')]);}_0x4d64b3[_0xeb9e('0x3d')]=qs['sort'](_0x107906['query'][_0xeb9e('0x3e')]);_0x4d64b3['where']=qs[_0xeb9e('0x36')](_[_0xeb9e('0x3f')](_0x107906[_0xeb9e('0x34')],_0x3c8f01[_0xeb9e('0x36')]),_0x358885);if(_0x107906['query']['filter']){_0x4d64b3['where']=_[_0xeb9e('0x40')](_0x4d64b3[_0xeb9e('0x41')],{'$or':_['map'](_0x358885,function(_0x3872af){if(_0x3872af[_0xeb9e('0x31')]!==_0xeb9e('0x42')){var _0x1db46b={};_0x1db46b[_0x3872af[_0xeb9e('0x2c')]]={'$like':'%'+_0x107906[_0xeb9e('0x34')][_0xeb9e('0x43')]+'%'};return _0x1db46b;}})});}_0x4d64b3=_['merge']({},_0x4d64b3,_0x107906[_0xeb9e('0x44')]);var _0x592798={'where':_0x4d64b3['where']};return db[_0xeb9e('0x2f')][_0xeb9e('0x20')](_0x592798)['then'](function(_0x2ccc98){_0x5cfffc[_0xeb9e('0x20')]=_0x2ccc98;if(_0x107906[_0xeb9e('0x34')][_0xeb9e('0x45')]){_0x4d64b3['include']=[{'all':!![]}];}return db[_0xeb9e('0x2f')][_0xeb9e('0x46')](_0x4d64b3);})[_0xeb9e('0x28')](function(_0x5ca452){_0x5cfffc[_0xeb9e('0x47')]=_0x5ca452;return _0x5cfffc;})[_0xeb9e('0x28')](respondWithFilteredResult(_0x16a768,_0x4d64b3))['catch'](handleError(_0x16a768,null));};exports[_0xeb9e('0x48')]=function(_0x30c5c5,_0x59f518){var _0x35b676={'raw':![],'where':{'id':_0x30c5c5['params']['id']}},_0x4c0ceb={};_0x4c0ceb[_0xeb9e('0x32')]=_[_0xeb9e('0x35')](db[_0xeb9e('0x2f')][_0xeb9e('0x30')]);_0x4c0ceb[_0xeb9e('0x34')]=_[_0xeb9e('0x35')](_0x30c5c5[_0xeb9e('0x34')]);_0x4c0ceb[_0xeb9e('0x36')]=_[_0xeb9e('0x37')](_0x4c0ceb['model'],_0x4c0ceb[_0xeb9e('0x34')]);_0x35b676[_0xeb9e('0x38')]=_[_0xeb9e('0x37')](_0x4c0ceb[_0xeb9e('0x32')],qs[_0xeb9e('0x39')](_0x30c5c5[_0xeb9e('0x34')][_0xeb9e('0x39')]));_0x35b676[_0xeb9e('0x38')]=_0x35b676[_0xeb9e('0x38')][_0xeb9e('0x3a')]?_0x35b676[_0xeb9e('0x38')]:_0x4c0ceb['model'];if(_0x30c5c5[_0xeb9e('0x34')][_0xeb9e('0x45')]){_0x35b676[_0xeb9e('0x49')]=[{'all':!![]}];}_0x35b676=_[_0xeb9e('0x40')]({},_0x35b676,_0x30c5c5[_0xeb9e('0x44')]);return db['UserProfileSection'][_0xeb9e('0x4a')](_0x35b676)['then'](handleEntityNotFound(_0x59f518,null))[_0xeb9e('0x28')](respondWithResult(_0x59f518,null))['catch'](handleError(_0x59f518,null));};exports['create']=function(_0x41713a,_0xf3ff1b){return db[_0xeb9e('0x2f')][_0xeb9e('0x4b')](_0x41713a[_0xeb9e('0x4c')],{})['then'](respondWithResult(_0xf3ff1b,0xc9))[_0xeb9e('0x4d')](handleError(_0xf3ff1b,null));};exports[_0xeb9e('0x27')]=function(_0x339fd7,_0x48d215){if(_0x339fd7[_0xeb9e('0x4c')]['id']){delete _0x339fd7[_0xeb9e('0x4c')]['id'];}return db[_0xeb9e('0x2f')][_0xeb9e('0x4a')]({'where':{'id':_0x339fd7['params']['id']}})['then'](handleEntityNotFound(_0x48d215,null))['then'](saveUpdates(_0x339fd7['body'],null))[_0xeb9e('0x28')](respondWithResult(_0x48d215,null))[_0xeb9e('0x4d')](handleError(_0x48d215,null));};exports[_0xeb9e('0x29')]=function(_0x3bc147,_0x36f58d){return db[_0xeb9e('0x2f')][_0xeb9e('0x4a')]({'where':{'id':_0x3bc147[_0xeb9e('0x4e')]['id']}})[_0xeb9e('0x28')](handleEntityNotFound(_0x36f58d,null))['then'](removeEntity(_0x36f58d,null))[_0xeb9e('0x4d')](handleError(_0x36f58d,null));};exports[_0xeb9e('0x4f')]=function(_0x17c575,_0x332dbd){return db[_0xeb9e('0x2f')][_0xeb9e('0x4f')]()[_0xeb9e('0x28')](respondWithResult(_0x332dbd,null))[_0xeb9e('0x4d')](handleError(_0x332dbd,null));}; \ No newline at end of file +var _0xa6be=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','then','error','stack','name','send','map','UserProfileSection','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','destroy','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0xa6be,0xdd));var _0xea6b=function(_0x117109,_0x1c8d5f){_0x117109=_0x117109-0x0;var _0x56b766=_0xa6be[_0x117109];return _0x56b766;};'use strict';var emlformat=require(_0xea6b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xea6b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xea6b('0x2'));var moment=require(_0xea6b('0x3'));var BPromise=require(_0xea6b('0x4'));var Mustache=require(_0xea6b('0x5'));var util=require(_0xea6b('0x6'));var path=require(_0xea6b('0x7'));var sox=require(_0xea6b('0x8'));var csv=require(_0xea6b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xea6b('0xa'));var squel=require(_0xea6b('0xb'));var crypto=require(_0xea6b('0xc'));var jsforce=require(_0xea6b('0xd'));var deskjs=require(_0xea6b('0xe'));var toCsv=require(_0xea6b('0x9'));var querystring=require(_0xea6b('0xf'));var Papa=require(_0xea6b('0x10'));var Redis=require(_0xea6b('0x11'));var authService=require(_0xea6b('0x12'));var qs=require(_0xea6b('0x13'));var as=require(_0xea6b('0x14'));var hardwareService=require(_0xea6b('0x15'));var logger=require(_0xea6b('0x16'))(_0xea6b('0x17'));var utils=require(_0xea6b('0x18'));var config=require(_0xea6b('0x19'));var licenseUtil=require(_0xea6b('0x1a'));var db=require(_0xea6b('0x1b'))['db'];function respondWithStatusCode(_0xaffc1c,_0x1c5113){_0x1c5113=_0x1c5113||0xcc;return function(_0x267d32){if(_0x267d32){return _0xaffc1c[_0xea6b('0x1c')](_0x1c5113);}return _0xaffc1c[_0xea6b('0x1d')](_0x1c5113)[_0xea6b('0x1e')]();};}function respondWithResult(_0x360273,_0x1c9c1a){_0x1c9c1a=_0x1c9c1a||0xc8;return function(_0xf8487){if(_0xf8487){return _0x360273['status'](_0x1c9c1a)['json'](_0xf8487);}};}function respondWithFilteredResult(_0x392131,_0x11ccd2){return function(_0x5a78b6){if(_0x5a78b6){var _0x4a2203=typeof _0x11ccd2['offset']===_0xea6b('0x1f')&&typeof _0x11ccd2[_0xea6b('0x20')]===_0xea6b('0x1f');var _0x13f4ef=_0x5a78b6[_0xea6b('0x21')];var _0x352674=_0x4a2203?0x0:_0x11ccd2['offset'];var _0x1095b3=_0x4a2203?_0x5a78b6[_0xea6b('0x21')]:_0x11ccd2[_0xea6b('0x22')]+_0x11ccd2[_0xea6b('0x20')];var _0x2ee1d6;if(_0x1095b3>=_0x13f4ef){_0x1095b3=_0x13f4ef;_0x2ee1d6=0xc8;}else{_0x2ee1d6=0xce;}_0x392131[_0xea6b('0x1d')](_0x2ee1d6);return _0x392131['set'](_0xea6b('0x23'),_0x352674+'-'+_0x1095b3+'/'+_0x13f4ef)[_0xea6b('0x24')](_0x5a78b6);}return null;};}function patchUpdates(_0x500c7e){return function(_0x23cc1e){try{jsonpatch[_0xea6b('0x25')](_0x23cc1e,_0x500c7e,!![]);}catch(_0x151b92){return BPromise[_0xea6b('0x26')](_0x151b92);}return _0x23cc1e[_0xea6b('0x27')]();};}function saveUpdates(_0x507152,_0x5cc3f2){return function(_0x361ab4){if(_0x361ab4){return _0x361ab4['update'](_0x507152)[_0xea6b('0x28')](function(_0x42de59){return _0x42de59;});}return null;};}function removeEntity(_0x490d73,_0x197e90){return function(_0x439ac3){if(_0x439ac3){return _0x439ac3['destroy']()['then'](function(){_0x490d73[_0xea6b('0x1d')](0xcc)[_0xea6b('0x1e')]();});}};}function handleEntityNotFound(_0x2c4975,_0x578ded){return function(_0x2c000e){if(!_0x2c000e){_0x2c4975[_0xea6b('0x1c')](0x194);}return _0x2c000e;};}function handleError(_0x192984,_0x7d5d73){_0x7d5d73=_0x7d5d73||0x1f4;return function(_0x28e40b){logger[_0xea6b('0x29')](_0x28e40b[_0xea6b('0x2a')]);if(_0x28e40b[_0xea6b('0x2b')]){delete _0x28e40b[_0xea6b('0x2b')];}_0x192984['status'](_0x7d5d73)[_0xea6b('0x2c')](_0x28e40b);};}exports['index']=function(_0x2cdf83,_0x858af0){var _0xd57a94={},_0x1d5d25={},_0x25b78d={'count':0x0,'rows':[]};var _0x73f789=_[_0xea6b('0x2d')](db[_0xea6b('0x2e')][_0xea6b('0x2f')],function(_0x1db5c1){return{'name':_0x1db5c1[_0xea6b('0x30')],'type':_0x1db5c1[_0xea6b('0x31')][_0xea6b('0x32')]};});_0x1d5d25['model']=_[_0xea6b('0x2d')](_0x73f789,_0xea6b('0x2b'));_0x1d5d25[_0xea6b('0x33')]=_['keys'](_0x2cdf83['query']);_0x1d5d25[_0xea6b('0x34')]=_[_0xea6b('0x35')](_0x1d5d25[_0xea6b('0x36')],_0x1d5d25[_0xea6b('0x33')]);_0xd57a94[_0xea6b('0x37')]=_[_0xea6b('0x35')](_0x1d5d25[_0xea6b('0x36')],qs[_0xea6b('0x38')](_0x2cdf83[_0xea6b('0x33')][_0xea6b('0x38')]));_0xd57a94[_0xea6b('0x37')]=_0xd57a94[_0xea6b('0x37')][_0xea6b('0x39')]?_0xd57a94[_0xea6b('0x37')]:_0x1d5d25['model'];if(!_0x2cdf83[_0xea6b('0x33')][_0xea6b('0x3a')](_0xea6b('0x3b'))){_0xd57a94['limit']=qs[_0xea6b('0x20')](_0x2cdf83[_0xea6b('0x33')]['limit']);_0xd57a94['offset']=qs['offset'](_0x2cdf83[_0xea6b('0x33')][_0xea6b('0x22')]);}_0xd57a94[_0xea6b('0x3c')]=qs[_0xea6b('0x3d')](_0x2cdf83['query'][_0xea6b('0x3d')]);_0xd57a94[_0xea6b('0x3e')]=qs[_0xea6b('0x34')](_[_0xea6b('0x3f')](_0x2cdf83[_0xea6b('0x33')],_0x1d5d25['filters']),_0x73f789);if(_0x2cdf83[_0xea6b('0x33')][_0xea6b('0x40')]){_0xd57a94[_0xea6b('0x3e')]=_['merge'](_0xd57a94[_0xea6b('0x3e')],{'$or':_[_0xea6b('0x2d')](_0x73f789,function(_0x135fd9){if(_0x135fd9['type']!==_0xea6b('0x41')){var _0x1be029={};_0x1be029[_0x135fd9[_0xea6b('0x2b')]]={'$like':'%'+_0x2cdf83[_0xea6b('0x33')]['filter']+'%'};return _0x1be029;}})});}_0xd57a94=_[_0xea6b('0x42')]({},_0xd57a94,_0x2cdf83[_0xea6b('0x43')]);var _0x3c5a27={'where':_0xd57a94[_0xea6b('0x3e')]};return db[_0xea6b('0x2e')][_0xea6b('0x21')](_0x3c5a27)[_0xea6b('0x28')](function(_0x2d2e69){_0x25b78d[_0xea6b('0x21')]=_0x2d2e69;if(_0x2cdf83[_0xea6b('0x33')][_0xea6b('0x44')]){_0xd57a94[_0xea6b('0x45')]=[{'all':!![]}];}return db[_0xea6b('0x2e')][_0xea6b('0x46')](_0xd57a94);})[_0xea6b('0x28')](function(_0x2eebff){_0x25b78d[_0xea6b('0x47')]=_0x2eebff;return _0x25b78d;})['then'](respondWithFilteredResult(_0x858af0,_0xd57a94))[_0xea6b('0x48')](handleError(_0x858af0,null));};exports[_0xea6b('0x49')]=function(_0x19c4a7,_0x4cd67a){var _0x68241={'raw':![],'where':{'id':_0x19c4a7[_0xea6b('0x4a')]['id']}},_0x33a484={};_0x33a484['model']=_[_0xea6b('0x4b')](db[_0xea6b('0x2e')][_0xea6b('0x2f')]);_0x33a484[_0xea6b('0x33')]=_[_0xea6b('0x4b')](_0x19c4a7[_0xea6b('0x33')]);_0x33a484[_0xea6b('0x34')]=_['intersection'](_0x33a484['model'],_0x33a484[_0xea6b('0x33')]);_0x68241['attributes']=_[_0xea6b('0x35')](_0x33a484[_0xea6b('0x36')],qs[_0xea6b('0x38')](_0x19c4a7[_0xea6b('0x33')][_0xea6b('0x38')]));_0x68241[_0xea6b('0x37')]=_0x68241['attributes'][_0xea6b('0x39')]?_0x68241['attributes']:_0x33a484[_0xea6b('0x36')];if(_0x19c4a7[_0xea6b('0x33')][_0xea6b('0x44')]){_0x68241[_0xea6b('0x45')]=[{'all':!![]}];}_0x68241=_[_0xea6b('0x42')]({},_0x68241,_0x19c4a7[_0xea6b('0x43')]);return db['UserProfileSection'][_0xea6b('0x4c')](_0x68241)[_0xea6b('0x28')](handleEntityNotFound(_0x4cd67a,null))[_0xea6b('0x28')](respondWithResult(_0x4cd67a,null))[_0xea6b('0x48')](handleError(_0x4cd67a,null));};exports['create']=function(_0x46f26e,_0x318465){return db['UserProfileSection'][_0xea6b('0x4d')](_0x46f26e[_0xea6b('0x4e')],{})[_0xea6b('0x28')](respondWithResult(_0x318465,0xc9))[_0xea6b('0x48')](handleError(_0x318465,null));};exports[_0xea6b('0x4f')]=function(_0xd9eeec,_0x59e485){if(_0xd9eeec[_0xea6b('0x4e')]['id']){delete _0xd9eeec[_0xea6b('0x4e')]['id'];}return db[_0xea6b('0x2e')][_0xea6b('0x4c')]({'where':{'id':_0xd9eeec['params']['id']}})[_0xea6b('0x28')](handleEntityNotFound(_0x59e485,null))[_0xea6b('0x28')](saveUpdates(_0xd9eeec[_0xea6b('0x4e')],null))[_0xea6b('0x28')](respondWithResult(_0x59e485,null))[_0xea6b('0x48')](handleError(_0x59e485,null));};exports[_0xea6b('0x50')]=function(_0x377b78,_0x1b55a7){return db[_0xea6b('0x2e')][_0xea6b('0x4c')]({'where':{'id':_0x377b78['params']['id']}})['then'](handleEntityNotFound(_0x1b55a7,null))[_0xea6b('0x28')](removeEntity(_0x1b55a7,null))[_0xea6b('0x48')](handleError(_0x1b55a7,null));};exports[_0xea6b('0x51')]=function(_0x166bba,_0x3335ee){return db[_0xea6b('0x2e')]['describe']()[_0xea6b('0x28')](respondWithResult(_0x3335ee,null))[_0xea6b('0x48')](handleError(_0x3335ee,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 7b5398d..b61fca6 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 _0xbdb0=['../../config/environment','./userProfileSection.attributes','exports','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x5b6fe5,_0x5ddf47){var _0x5928d4=function(_0x3e0846){while(--_0x3e0846){_0x5b6fe5['push'](_0x5b6fe5['shift']());}};_0x5928d4(++_0x5ddf47);}(_0xbdb0,0x165));var _0x0bdb=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xbdb0[_0x5037ab];return _0x512adb;};'use strict';var _=require(_0x0bdb('0x0'));var util=require(_0x0bdb('0x1'));var logger=require('../../config/logger')(_0x0bdb('0x2'));var moment=require(_0x0bdb('0x3'));var BPromise=require(_0x0bdb('0x4'));var rp=require(_0x0bdb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0bdb('0x6'));var config=require(_0x0bdb('0x7'));var attributes=require(_0x0bdb('0x8'));module[_0x0bdb('0x9')]=function(_0x42161b,_0x56b99c){return _0x42161b['define'](_0x0bdb('0xa'),attributes,{'tableName':_0x0bdb('0xb'),'paranoid':![],'indexes':[{'name':_0x0bdb('0xc'),'fields':[_0x0bdb('0xd'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x43bd=['path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','sectionId','userProfileId','lodash','../../config/logger','api','moment','bluebird'];(function(_0x33187b,_0x591a68){var _0x5155fb=function(_0xb5e52b){while(--_0xb5e52b){_0x33187b['push'](_0x33187b['shift']());}};_0x5155fb(++_0x591a68);}(_0x43bd,0xa0));var _0xd43b=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x43bd[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xd43b('0x0'));var util=require('util');var logger=require(_0xd43b('0x1'))(_0xd43b('0x2'));var moment=require(_0xd43b('0x3'));var BPromise=require(_0xd43b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd43b('0x5'));var rimraf=require(_0xd43b('0x6'));var config=require(_0xd43b('0x7'));var attributes=require(_0xd43b('0x8'));module[_0xd43b('0x9')]=function(_0x48493d,_0x4c5f40){return _0x48493d[_0xd43b('0xa')](_0xd43b('0xb'),attributes,{'tableName':_0xd43b('0xc'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xd43b('0xd'),_0xd43b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index a849862..8f8968d 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 _0x8f57=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x424501,_0x42096d){var _0xb719af=function(_0x37adcf){while(--_0x37adcf){_0x424501['push'](_0x424501['shift']());}};_0xb719af(++_0x42096d);}(_0x8f57,0xfb));var _0x78f5=function(_0x48eb11,_0x2a697c){_0x48eb11=_0x48eb11-0x0;var _0x2b1a9c=_0x8f57[_0x48eb11];return _0x2b1a9c;};'use strict';var _=require(_0x78f5('0x0'));var util=require(_0x78f5('0x1'));var moment=require(_0x78f5('0x2'));var BPromise=require(_0x78f5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78f5('0x4'));var db=require(_0x78f5('0x5'))['db'];var utils=require(_0x78f5('0x6'));var logger=require('../../config/logger')(_0x78f5('0x7'));var config=require(_0x78f5('0x8'));var jayson=require(_0x78f5('0x9'));var client=jayson[_0x78f5('0xa')][_0x78f5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x413513,_0x2eefbc,_0x353d21){return new BPromise(function(_0x3de497,_0x54180c){return client[_0x78f5('0xc')](_0x413513,_0x353d21)[_0x78f5('0xd')](function(_0x43cdcc){logger[_0x78f5('0xe')](_0x78f5('0xf'),_0x2eefbc,_0x78f5('0x10'));logger['debug'](_0x78f5('0x11'),_0x2eefbc,'request\x20sent',JSON[_0x78f5('0x12')](_0x43cdcc));if(_0x43cdcc[_0x78f5('0x13')]){if(_0x43cdcc[_0x78f5('0x13')]['code']===0x1f4){logger['error'](_0x78f5('0xf'),_0x2eefbc,_0x43cdcc['error'][_0x78f5('0x14')]);return _0x54180c(_0x43cdcc[_0x78f5('0x13')][_0x78f5('0x14')]);}logger[_0x78f5('0x13')](_0x78f5('0xf'),_0x2eefbc,_0x43cdcc[_0x78f5('0x13')][_0x78f5('0x14')]);return _0x3de497(_0x43cdcc['error'][_0x78f5('0x14')]);}else{logger['info'](_0x78f5('0xf'),_0x2eefbc,_0x78f5('0x10'));_0x3de497(_0x43cdcc[_0x78f5('0x15')]['message']);}})[_0x78f5('0x16')](function(_0x39eac1){logger['error'](_0x78f5('0xf'),_0x2eefbc,_0x39eac1);_0x54180c(_0x39eac1);});});} \ No newline at end of file +var _0x4f97=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x2fdb78,_0x885ca5){var _0x1fec71=function(_0x2ecd88){while(--_0x2ecd88){_0x2fdb78['push'](_0x2fdb78['shift']());}};_0x1fec71(++_0x885ca5);}(_0x4f97,0x132));var _0x74f9=function(_0xf322f2,_0x1d1616){_0xf322f2=_0xf322f2-0x0;var _0x5a924c=_0x4f97[_0xf322f2];return _0x5a924c;};'use strict';var _=require(_0x74f9('0x0'));var util=require(_0x74f9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x74f9('0x2'))['db'];var utils=require(_0x74f9('0x3'));var logger=require(_0x74f9('0x4'))(_0x74f9('0x5'));var config=require(_0x74f9('0x6'));var jayson=require(_0x74f9('0x7'));var client=jayson[_0x74f9('0x8')][_0x74f9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3bf791,_0x2036cf,_0x43ee5d){return new BPromise(function(_0x35d50d,_0x5c317b){return client['request'](_0x3bf791,_0x43ee5d)[_0x74f9('0xa')](function(_0x58c05c){logger[_0x74f9('0xb')](_0x74f9('0xc'),_0x2036cf,'request\x20sent');logger[_0x74f9('0xd')](_0x74f9('0xe'),_0x2036cf,_0x74f9('0xf'),JSON[_0x74f9('0x10')](_0x58c05c));if(_0x58c05c[_0x74f9('0x11')]){if(_0x58c05c[_0x74f9('0x11')][_0x74f9('0x12')]===0x1f4){logger[_0x74f9('0x11')](_0x74f9('0xc'),_0x2036cf,_0x58c05c[_0x74f9('0x11')][_0x74f9('0x13')]);return _0x5c317b(_0x58c05c['error']['message']);}logger[_0x74f9('0x11')](_0x74f9('0xc'),_0x2036cf,_0x58c05c[_0x74f9('0x11')]['message']);return _0x35d50d(_0x58c05c['error']['message']);}else{logger[_0x74f9('0xb')](_0x74f9('0xc'),_0x2036cf,_0x74f9('0xf'));_0x35d50d(_0x58c05c[_0x74f9('0x14')][_0x74f9('0x13')]);}})[_0x74f9('0x15')](function(_0x305e1b){logger[_0x74f9('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x2036cf,_0x305e1b);_0x5c317b(_0x305e1b);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 7996b8b..72de924 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x52d5df,_0x3a6baa){var _0x374a89=function(_0x168536){while(--_0x168536){_0x52d5df['push'](_0x52d5df['shift']());}};_0x374a89(++_0x3a6baa);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x17cb36,_0x3cfc3e){var _0x3ae236=function(_0x47530f){while(--_0x47530f){_0x17cb36['push'](_0x17cb36['shift']());}};_0x3ae236(++_0x3cfc3e);}(_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 diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 90158e4..f3275d7 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 _0x13ff=['sequelize','INTEGER'];(function(_0x178cc1,_0xbf86e0){var _0x17459e=function(_0x5eaf49){while(--_0x5eaf49){_0x178cc1['push'](_0x178cc1['shift']());}};_0x17459e(++_0xbf86e0);}(_0x13ff,0xe6));var _0xf13f=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x13ff[_0x5317b5];return _0x3b7ce2;};'use strict';var Sequelize=require(_0xf13f('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xf13f('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6df5=['INTEGER','sequelize','exports'];(function(_0x11d08e,_0x1cd670){var _0x19c8cb=function(_0xbc63bc){while(--_0xbc63bc){_0x11d08e['push'](_0x11d08e['shift']());}};_0x19c8cb(++_0x1cd670);}(_0x6df5,0x154));var _0x56df=function(_0x1ec6b3,_0x4d613c){_0x1ec6b3=_0x1ec6b3-0x0;var _0x7f842c=_0x6df5[_0x1ec6b3];return _0x7f842c;};'use strict';var Sequelize=require(_0x56df('0x0'));module[_0x56df('0x1')]={'penalty':{'type':Sequelize[_0x56df('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 907d527..62d4c3b 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 _0x7880=['../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x2db0f5,_0x4f0409){var _0x376493=function(_0x3ae9d8){while(--_0x3ae9d8){_0x2db0f5['push'](_0x2db0f5['shift']());}};_0x376493(++_0x4f0409);}(_0x7880,0x1f4));var _0x0788=function(_0x4cbf20,_0x1bfa66){_0x4cbf20=_0x4cbf20-0x0;var _0x582ae4=_0x7880[_0x4cbf20];return _0x582ae4;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var logger=require(_0x0788('0x1'))(_0x0788('0x2'));var moment=require(_0x0788('0x3'));var BPromise=require(_0x0788('0x4'));var rp=require(_0x0788('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var attributes=require(_0x0788('0x8'));module[_0x0788('0x9')]=function(_0x262f5c,_0x775629){return _0x262f5c[_0x0788('0xa')](_0x0788('0xb'),attributes,{'tableName':_0x0788('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8cad=['UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x24b724,_0x5a5a2f){var _0xa308ef=function(_0x578c75){while(--_0x578c75){_0x24b724['push'](_0x24b724['shift']());}};_0xa308ef(++_0x5a5a2f);}(_0x8cad,0xfe));var _0xd8ca=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x8cad[_0x243b59];return _0x3e1676;};'use strict';var _=require(_0xd8ca('0x0'));var util=require(_0xd8ca('0x1'));var logger=require(_0xd8ca('0x2'))(_0xd8ca('0x3'));var moment=require(_0xd8ca('0x4'));var BPromise=require(_0xd8ca('0x5'));var rp=require(_0xd8ca('0x6'));var fs=require('fs');var path=require(_0xd8ca('0x7'));var rimraf=require(_0xd8ca('0x8'));var config=require(_0xd8ca('0x9'));var attributes=require(_0xd8ca('0xa'));module[_0xd8ca('0xb')]=function(_0x14c73e,_0x6d5070){return _0x14c73e['define'](_0xd8ca('0xc'),attributes,{'tableName':_0xd8ca('0xd'),'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 5384266..9746b47 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 _0xaee7=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','ioredis'];(function(_0x28e845,_0x363b75){var _0x1f6a57=function(_0x5e7f50){while(--_0x5e7f50){_0x28e845['push'](_0x28e845['shift']());}};_0x1f6a57(++_0x363b75);}(_0xaee7,0x9d));var _0x7aee=function(_0x2fa6c3,_0x5ec2b7){_0x2fa6c3=_0x2fa6c3-0x0;var _0xedce18=_0xaee7[_0x2fa6c3];return _0xedce18;};'use strict';var _=require('lodash');var util=require(_0x7aee('0x0'));var moment=require(_0x7aee('0x1'));var BPromise=require(_0x7aee('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7aee('0x3'));var db=require(_0x7aee('0x4'))['db'];var utils=require(_0x7aee('0x5'));var logger=require(_0x7aee('0x6'))(_0x7aee('0x7'));var config=require(_0x7aee('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7aee('0x9')][_0x7aee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bcc5c,_0xc29be2,_0x5cb338){return new BPromise(function(_0x49f2e0,_0xace48c){return client[_0x7aee('0xb')](_0x4bcc5c,_0x5cb338)[_0x7aee('0xc')](function(_0x500d1d){logger[_0x7aee('0xd')](_0x7aee('0xe'),_0xc29be2,_0x7aee('0xf'));logger[_0x7aee('0x10')](_0x7aee('0x11'),_0xc29be2,_0x7aee('0xf'),JSON[_0x7aee('0x12')](_0x500d1d));if(_0x500d1d[_0x7aee('0x13')]){if(_0x500d1d[_0x7aee('0x13')][_0x7aee('0x14')]===0x1f4){logger[_0x7aee('0x13')](_0x7aee('0xe'),_0xc29be2,_0x500d1d['error'][_0x7aee('0x15')]);return _0xace48c(_0x500d1d[_0x7aee('0x13')][_0x7aee('0x15')]);}logger[_0x7aee('0x13')](_0x7aee('0xe'),_0xc29be2,_0x500d1d['error']['message']);return _0x49f2e0(_0x500d1d[_0x7aee('0x13')][_0x7aee('0x15')]);}else{logger[_0x7aee('0xd')](_0x7aee('0xe'),_0xc29be2,_0x7aee('0xf'));_0x49f2e0(_0x500d1d[_0x7aee('0x16')][_0x7aee('0x15')]);}})['catch'](function(_0x5a701b){logger[_0x7aee('0x13')](_0x7aee('0xe'),_0xc29be2,_0x5a701b);_0xace48c(_0x5a701b);});});} \ No newline at end of file +var _0x9541=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util'];(function(_0xe16fcf,_0x2b5918){var _0x5981e9=function(_0x494df2){while(--_0x494df2){_0xe16fcf['push'](_0xe16fcf['shift']());}};_0x5981e9(++_0x2b5918);}(_0x9541,0x9e));var _0x1954=function(_0x570b36,_0x36fe12){_0x570b36=_0x570b36-0x0;var _0x4e229f=_0x9541[_0x570b36];return _0x4e229f;};'use strict';var _=require(_0x1954('0x0'));var util=require(_0x1954('0x1'));var moment=require(_0x1954('0x2'));var BPromise=require(_0x1954('0x3'));var rs=require(_0x1954('0x4'));var fs=require('fs');var Redis=require(_0x1954('0x5'));var db=require(_0x1954('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1954('0x7'))(_0x1954('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1954('0x9')][_0x1954('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16c629,_0x2dafed,_0x3a258b){return new BPromise(function(_0x100f61,_0x3cdea7){return client[_0x1954('0xb')](_0x16c629,_0x3a258b)[_0x1954('0xc')](function(_0x2869f5){logger['info'](_0x1954('0xd'),_0x2dafed,_0x1954('0xe'));logger[_0x1954('0xf')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x2dafed,_0x1954('0xe'),JSON['stringify'](_0x2869f5));if(_0x2869f5[_0x1954('0x10')]){if(_0x2869f5[_0x1954('0x10')]['code']===0x1f4){logger[_0x1954('0x10')](_0x1954('0xd'),_0x2dafed,_0x2869f5[_0x1954('0x10')][_0x1954('0x11')]);return _0x3cdea7(_0x2869f5['error'][_0x1954('0x11')]);}logger[_0x1954('0x10')](_0x1954('0xd'),_0x2dafed,_0x2869f5[_0x1954('0x10')]['message']);return _0x100f61(_0x2869f5[_0x1954('0x10')]['message']);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x2dafed,_0x1954('0xe'));_0x100f61(_0x2869f5[_0x1954('0x12')][_0x1954('0x11')]);}})[_0x1954('0x13')](function(_0x5d2441){logger[_0x1954('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x2dafed,_0x5d2441);_0x3cdea7(_0x5d2441);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 39d57cf..e1f2fbf 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x9da774,_0x5a9d80){var _0x49cfdd=function(_0x32d958){while(--_0x32d958){_0x9da774['push'](_0x9da774['shift']());}};_0x49cfdd(++_0x5a9d80);}(_0xedd9,0xfc));var _0x9edd=function(_0x49ffb4,_0x5150b6){_0x49ffb4=_0x49ffb4-0x0;var _0x16259e=_0xedd9[_0x49ffb4];return _0x16259e;};'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(_0x592eaa,_0x26d920){var _0x502849=function(_0x21fcfb){while(--_0x21fcfb){_0x592eaa['push'](_0x592eaa['shift']());}};_0x502849(++_0x26d920);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index a56f4bb..647d864 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 _0xc4b6=['exports','INTEGER'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xc4b6,0x1b8));var _0x6c4b=function(_0x734cd4,_0x48841b){_0x734cd4=_0x734cd4-0x0;var _0xcc66ad=_0xc4b6[_0x734cd4];return _0xcc66ad;};'use strict';var Sequelize=require('sequelize');module[_0x6c4b('0x0')]={'penalty':{'type':Sequelize[_0x6c4b('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3204=['exports','INTEGER','sequelize'];(function(_0x2dfeb8,_0x3daa57){var _0x22e6ba=function(_0x142b3a){while(--_0x142b3a){_0x2dfeb8['push'](_0x2dfeb8['shift']());}};_0x22e6ba(++_0x3daa57);}(_0x3204,0x12e));var _0x4320=function(_0x32ee5e,_0xbc70a0){_0x32ee5e=_0x32ee5e-0x0;var _0x160b2b=_0x3204[_0x32ee5e];return _0x160b2b;};'use strict';var Sequelize=require(_0x4320('0x0'));module[_0x4320('0x1')]={'penalty':{'type':Sequelize[_0x4320('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 1108c5c..bc07ed0 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 _0xd816=['api','moment','request-promise','rimraf','exports','define','UserVoiceQueue','lodash','util','../../config/logger'];(function(_0x28ac0e,_0x1b2592){var _0x10a35e=function(_0x205382){while(--_0x205382){_0x28ac0e['push'](_0x28ac0e['shift']());}};_0x10a35e(++_0x1b2592);}(_0xd816,0x1c9));var _0x6d81=function(_0x2e20de,_0x18b8ed){_0x2e20de=_0x2e20de-0x0;var _0x2d365e=_0xd816[_0x2e20de];return _0x2d365e;};'use strict';var _=require(_0x6d81('0x0'));var util=require(_0x6d81('0x1'));var logger=require(_0x6d81('0x2'))(_0x6d81('0x3'));var moment=require(_0x6d81('0x4'));var BPromise=require('bluebird');var rp=require(_0x6d81('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6d81('0x6'));var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module[_0x6d81('0x7')]=function(_0x2b36b2,_0x2c34af){return _0x2b36b2[_0x6d81('0x8')](_0x6d81('0x9'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0bd4=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger'];(function(_0x2d324d,_0x1fb855){var _0x44b2cc=function(_0x44ed74){while(--_0x44ed74){_0x2d324d['push'](_0x2d324d['shift']());}};_0x44b2cc(++_0x1fb855);}(_0x0bd4,0x6d));var _0x40bd=function(_0x25cd2c,_0x57498e){_0x25cd2c=_0x25cd2c-0x0;var _0x1e364c=_0x0bd4[_0x25cd2c];return _0x1e364c;};'use strict';var _=require(_0x40bd('0x0'));var util=require(_0x40bd('0x1'));var logger=require(_0x40bd('0x2'))(_0x40bd('0x3'));var moment=require(_0x40bd('0x4'));var BPromise=require(_0x40bd('0x5'));var rp=require(_0x40bd('0x6'));var fs=require('fs');var path=require(_0x40bd('0x7'));var rimraf=require(_0x40bd('0x8'));var config=require(_0x40bd('0x9'));var attributes=require('./userVoiceQueue.attributes');module[_0x40bd('0xa')]=function(_0x179aa6,_0x29f21e){return _0x179aa6[_0x40bd('0xb')](_0x40bd('0xc'),attributes,{'tableName':_0x40bd('0xd'),'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 a2c477f..be52669 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 _0x9d76=['client','request','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9d76,0x17c));var _0x69d7=function(_0x58c414,_0x5c7e9d){_0x58c414=_0x58c414-0x0;var _0x166b9d=_0x9d76[_0x58c414];return _0x166b9d;};'use strict';var _=require(_0x69d7('0x0'));var util=require(_0x69d7('0x1'));var moment=require(_0x69d7('0x2'));var BPromise=require(_0x69d7('0x3'));var rs=require(_0x69d7('0x4'));var fs=require('fs');var Redis=require(_0x69d7('0x5'));var db=require(_0x69d7('0x6'))['db'];var utils=require(_0x69d7('0x7'));var logger=require(_0x69d7('0x8'))('rpc');var config=require(_0x69d7('0x9'));var jayson=require(_0x69d7('0xa'));var client=jayson[_0x69d7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c4f90,_0x3bc4d5,_0x4ae2b1){return new BPromise(function(_0x53307c,_0x5e5e37){return client[_0x69d7('0xc')](_0x3c4f90,_0x4ae2b1)[_0x69d7('0xd')](function(_0x20f599){logger[_0x69d7('0xe')](_0x69d7('0xf'),_0x3bc4d5,'request\x20sent');logger[_0x69d7('0x10')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x3bc4d5,_0x69d7('0x11'),JSON[_0x69d7('0x12')](_0x20f599));if(_0x20f599[_0x69d7('0x13')]){if(_0x20f599['error']['code']===0x1f4){logger['error'](_0x69d7('0xf'),_0x3bc4d5,_0x20f599['error'][_0x69d7('0x14')]);return _0x5e5e37(_0x20f599[_0x69d7('0x13')][_0x69d7('0x14')]);}logger[_0x69d7('0x13')](_0x69d7('0xf'),_0x3bc4d5,_0x20f599[_0x69d7('0x13')][_0x69d7('0x14')]);return _0x53307c(_0x20f599['error']['message']);}else{logger[_0x69d7('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x3bc4d5,'request\x20sent');_0x53307c(_0x20f599[_0x69d7('0x15')][_0x69d7('0x14')]);}})[_0x69d7('0x16')](function(_0x1f2596){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x3bc4d5,_0x1f2596);_0x5e5e37(_0x1f2596);});});} \ No newline at end of file +var _0xd1d9=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xd1d9,0x174));var _0x9d1d=function(_0x260862,_0x219290){_0x260862=_0x260862-0x0;var _0x115f6=_0xd1d9[_0x260862];return _0x115f6;};'use strict';var _=require(_0x9d1d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9d1d('0x1'));var rs=require(_0x9d1d('0x2'));var fs=require('fs');var Redis=require(_0x9d1d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9d1d('0x4'));var logger=require(_0x9d1d('0x5'))(_0x9d1d('0x6'));var config=require(_0x9d1d('0x7'));var jayson=require(_0x9d1d('0x8'));var client=jayson[_0x9d1d('0x9')][_0x9d1d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x210367,_0x1bf906,_0x390ee3){return new BPromise(function(_0x1fe865,_0x25977d){return client[_0x9d1d('0xb')](_0x210367,_0x390ee3)['then'](function(_0x1fbcd2){logger['info'](_0x9d1d('0xc'),_0x1bf906,_0x9d1d('0xd'));logger[_0x9d1d('0xe')](_0x9d1d('0xf'),_0x1bf906,_0x9d1d('0xd'),JSON[_0x9d1d('0x10')](_0x1fbcd2));if(_0x1fbcd2[_0x9d1d('0x11')]){if(_0x1fbcd2['error'][_0x9d1d('0x12')]===0x1f4){logger[_0x9d1d('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x1bf906,_0x1fbcd2[_0x9d1d('0x11')][_0x9d1d('0x13')]);return _0x25977d(_0x1fbcd2['error']['message']);}logger[_0x9d1d('0x11')](_0x9d1d('0xc'),_0x1bf906,_0x1fbcd2[_0x9d1d('0x11')][_0x9d1d('0x13')]);return _0x1fe865(_0x1fbcd2[_0x9d1d('0x11')][_0x9d1d('0x13')]);}else{logger['info'](_0x9d1d('0xc'),_0x1bf906,'request\x20sent');_0x1fe865(_0x1fbcd2[_0x9d1d('0x14')]['message']);}})[_0x9d1d('0x15')](function(_0x362d42){logger[_0x9d1d('0x11')](_0x9d1d('0xc'),_0x1bf906,_0x362d42);_0x25977d(_0x362d42);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index b32a785..db58ce9 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x55a76a,_0x2d0203){var _0x45885a=function(_0x4348d5){while(--_0x4348d5){_0x55a76a['push'](_0x55a76a['shift']());}};_0x45885a(++_0x2d0203);}(_0x9c44,0x178));var _0x49c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9c44[_0x465a0c];return _0x1e202e;};'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(_0x14ca26,_0xf6f7c2){var _0x2061e9=function(_0x4883bc){while(--_0x4883bc){_0x14ca26['push'](_0x14ca26['shift']());}};_0x2061e9(++_0xf6f7c2);}(_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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index d566743..6fc91f8 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 _0xde72=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x412ed6,_0x5ac827){var _0x3883d2=function(_0x5f3380){while(--_0x5f3380){_0x412ed6['push'](_0x412ed6['shift']());}};_0x3883d2(++_0x5ac827);}(_0xde72,0x1a4));var _0x2de7=function(_0x1060d9,_0x47f741){_0x1060d9=_0x1060d9-0x0;var _0x5d71ca=_0xde72[_0x1060d9];return _0x5d71ca;};'use strict';var Sequelize=require('sequelize');module[_0x2de7('0x0')]={'uniqueid':{'type':Sequelize[_0x2de7('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x2de7('0x2')},'membername':{'type':Sequelize[_0x2de7('0x3')],'allowNull':![],'comment':_0x2de7('0x2')},'UserId':{'type':Sequelize[_0x2de7('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x2de7('0x3')],'allowNull':![],'unique':_0x2de7('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x2de7('0x2')},'paused':{'type':Sequelize[_0x2de7('0x1')](0xb),'defaultValue':0x0,'comment':_0x2de7('0x2')}}; \ No newline at end of file +var _0x7f52=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0x7f52,0x1cc));var _0x27f5=function(_0x5de255,_0x2bd804){_0x5de255=_0x5de255-0x0;var _0x440d42=_0x7f52[_0x5de255];return _0x440d42;};'use strict';var Sequelize=require(_0x27f5('0x0'));module[_0x27f5('0x1')]={'uniqueid':{'type':Sequelize[_0x27f5('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x27f5('0x3')},'UserId':{'type':Sequelize[_0x27f5('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x27f5('0x4')],'allowNull':![],'unique':_0x27f5('0x5'),'comment':_0x27f5('0x3')},'VoiceQueueId':{'type':Sequelize[_0x27f5('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x27f5('0x5'),'comment':_0x27f5('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x27f5('0x3')},'paused':{'type':Sequelize[_0x27f5('0x2')](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 f267217..a9f2e02 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 _0xed71=['update','remove','emit','hasOwnProperty','events','../../mysqldb','UserVoiceQueueRt','save'];(function(_0x2f1433,_0x3c48d8){var _0xd6f1af=function(_0x560e28){while(--_0x560e28){_0x2f1433['push'](_0x2f1433['shift']());}};_0xd6f1af(++_0x3c48d8);}(_0xed71,0x12c));var _0x1ed7=function(_0x4a3554,_0x14f2fd){_0x4a3554=_0x4a3554-0x0;var _0x12e4cb=_0xed71[_0x4a3554];return _0x12e4cb;};'use strict';var EventEmitter=require(_0x1ed7('0x0'));var UserVoiceQueueRt=require(_0x1ed7('0x1'))['db'][_0x1ed7('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1ed7('0x3'),'afterUpdate':_0x1ed7('0x4'),'afterDestroy':_0x1ed7('0x5')};function emitEvent(_0x2b19d1){return function(_0x580bf5,_0x17ffca,_0x992648){UserVoiceQueueRtEvents[_0x1ed7('0x6')](_0x2b19d1+':'+_0x580bf5['id'],_0x580bf5);UserVoiceQueueRtEvents[_0x1ed7('0x6')](_0x2b19d1,_0x580bf5);_0x992648(null);};}for(var e in events){if(events[_0x1ed7('0x7')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x0265=['events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x13bd2c,_0x4fac72){var _0x52a10b=function(_0x4d94b8){while(--_0x4d94b8){_0x13bd2c['push'](_0x13bd2c['shift']());}};_0x52a10b(++_0x4fac72);}(_0x0265,0x6c));var _0x5026=function(_0x255b4e,_0xdf14cb){_0x255b4e=_0x255b4e-0x0;var _0x41363f=_0x0265[_0x255b4e];return _0x41363f;};'use strict';var EventEmitter=require(_0x5026('0x0'));var UserVoiceQueueRt=require(_0x5026('0x1'))['db'][_0x5026('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x5026('0x3')](0x0);var events={'afterCreate':_0x5026('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x35aaf7){return function(_0x192fe9,_0x44e113,_0x7aafa6){UserVoiceQueueRtEvents['emit'](_0x35aaf7+':'+_0x192fe9['id'],_0x192fe9);UserVoiceQueueRtEvents[_0x5026('0x5')](_0x35aaf7,_0x192fe9);_0x7aafa6(null);};}for(var e in events){if(events[_0x5026('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x5026('0x7')](e,emitEvent(event));}}module[_0x5026('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 4f0e4a2..8f3f13a 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 _0xaf47=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','user_has_voice_queues_rt','util'];(function(_0x27d8a2,_0x3700ef){var _0x299b7c=function(_0x34d5f9){while(--_0x34d5f9){_0x27d8a2['push'](_0x27d8a2['shift']());}};_0x299b7c(++_0x3700ef);}(_0xaf47,0xaf));var _0x7af4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaf47[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7af4('0x0'));var logger=require(_0x7af4('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7af4('0x2'));var rp=require(_0x7af4('0x3'));var fs=require('fs');var path=require(_0x7af4('0x4'));var rimraf=require(_0x7af4('0x5'));var config=require(_0x7af4('0x6'));var attributes=require(_0x7af4('0x7'));module[_0x7af4('0x8')]=function(_0x986752,_0x284894){return _0x986752[_0x7af4('0x9')]('UserVoiceQueueRt',attributes,{'tableName':_0x7af4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x158f=['path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','lodash','moment','bluebird'];(function(_0x26bccf,_0x21da48){var _0x568320=function(_0x3b8d05){while(--_0x3b8d05){_0x26bccf['push'](_0x26bccf['shift']());}};_0x568320(++_0x21da48);}(_0x158f,0xc3));var _0xf158=function(_0xe04198,_0x1bd4ab){_0xe04198=_0xe04198-0x0;var _0x1a9526=_0x158f[_0xe04198];return _0x1a9526;};'use strict';var _=require(_0xf158('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf158('0x1'));var BPromise=require(_0xf158('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf158('0x3'));var rimraf=require(_0xf158('0x4'));var config=require(_0xf158('0x5'));var attributes=require(_0xf158('0x6'));module[_0xf158('0x7')]=function(_0x17b6dc,_0x1183cc){return _0x17b6dc[_0xf158('0x8')]('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','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 c56a10e..8000ea3 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 _0xf308=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./userVoiceQueueRt.socket','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','lodash','util','moment','bluebird'];(function(_0x4de246,_0x5bdf27){var _0x24c4a8=function(_0x33edd4){while(--_0x33edd4){_0x4de246['push'](_0x4de246['shift']());}};_0x24c4a8(++_0x5bdf27);}(_0xf308,0x68));var _0x8f30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf308[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8f30('0x0'));var util=require(_0x8f30('0x1'));var moment=require(_0x8f30('0x2'));var BPromise=require(_0x8f30('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f30('0x4'))['db'];var utils=require(_0x8f30('0x5'));var logger=require('../../config/logger')(_0x8f30('0x6'));var config=require(_0x8f30('0x7'));var jayson=require(_0x8f30('0x8'));var client=jayson[_0x8f30('0x9')][_0x8f30('0xa')]({'port':0x232a});config[_0x8f30('0xb')]=_[_0x8f30('0xc')](config[_0x8f30('0xb')],{'host':_0x8f30('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8f30('0xb')]));require(_0x8f30('0xe'))['register'](socket);function respondWithRpcPromise(_0x3749b8,_0x475cc6,_0x11f0df){return new BPromise(function(_0x1d6aa9,_0x19821d){return client[_0x8f30('0xf')](_0x3749b8,_0x11f0df)[_0x8f30('0x10')](function(_0x453070){logger['info'](_0x8f30('0x11'),_0x475cc6,_0x8f30('0x12'));logger['debug'](_0x8f30('0x13'),_0x475cc6,'request\x20sent',JSON[_0x8f30('0x14')](_0x453070));if(_0x453070[_0x8f30('0x15')]){if(_0x453070[_0x8f30('0x15')][_0x8f30('0x16')]===0x1f4){logger[_0x8f30('0x15')](_0x8f30('0x11'),_0x475cc6,_0x453070[_0x8f30('0x15')]['message']);return _0x19821d(_0x453070['error']['message']);}logger[_0x8f30('0x15')](_0x8f30('0x11'),_0x475cc6,_0x453070['error'][_0x8f30('0x17')]);return _0x1d6aa9(_0x453070['error'][_0x8f30('0x17')]);}else{logger[_0x8f30('0x18')](_0x8f30('0x11'),_0x475cc6,_0x8f30('0x12'));_0x1d6aa9(_0x453070[_0x8f30('0x19')]['message']);}})[_0x8f30('0x1a')](function(_0x1ce9c9){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x475cc6,_0x1ce9c9);_0x19821d(_0x1ce9c9);});});}exports[_0x8f30('0x1b')]=function(_0x5852a0){var _0x59334b=this;return new Promise(function(_0x3fc0af,_0x5e7031){return db[_0x8f30('0x1c')][_0x8f30('0x1d')]({'raw':_0x5852a0[_0x8f30('0x1e')]?_0x5852a0['options'][_0x8f30('0x1f')]===undefined?!![]:![]:!![],'where':_0x5852a0[_0x8f30('0x1e')]?_0x5852a0[_0x8f30('0x1e')]['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x8f30('0x20')]['fn']('IF',db[_0x8f30('0x20')]['literal'](_0x8f30('0x21')))),_0x8f30('0x22')]]})[_0x8f30('0x10')](function(_0x54d7bf){logger[_0x8f30('0x18')]('GetVoiceQueueRtPauses',_0x5852a0);logger[_0x8f30('0x23')]('GetVoiceQueueRtPauses',_0x5852a0,JSON[_0x8f30('0x14')](_0x54d7bf));_0x3fc0af(_0x54d7bf);})[_0x8f30('0x1a')](function(_0x19bdb8){logger[_0x8f30('0x15')](_0x8f30('0x1b'),_0x19bdb8['message'],_0x5852a0);_0x5e7031(_0x59334b[_0x8f30('0x15')](0x1f4,_0x19bdb8[_0x8f30('0x17')]));});});}; \ No newline at end of file +var _0x7067=['rpc','../../config/environment','jayson/promise','defaults','localhost','socket.io-emitter','redis','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x20d4e7,_0x5f29f7){var _0x125131=function(_0x10dc57){while(--_0x10dc57){_0x20d4e7['push'](_0x20d4e7['shift']());}};_0x125131(++_0x5f29f7);}(_0x7067,0xb2));var _0x7706=function(_0x2f4f36,_0x2d892e){_0x2f4f36=_0x2f4f36-0x0;var _0x145963=_0x7067[_0x2f4f36];return _0x145963;};'use strict';var _=require(_0x7706('0x0'));var util=require('util');var moment=require(_0x7706('0x1'));var BPromise=require(_0x7706('0x2'));var rs=require(_0x7706('0x3'));var fs=require('fs');var Redis=require(_0x7706('0x4'));var db=require(_0x7706('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7706('0x6'))(_0x7706('0x7'));var config=require(_0x7706('0x8'));var jayson=require(_0x7706('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x7706('0xa')](config['redis'],{'host':_0x7706('0xb'),'port':0x18eb});var socket=require(_0x7706('0xc'))(new Redis(config[_0x7706('0xd')]));require('./userVoiceQueueRt.socket')[_0x7706('0xe')](socket);function respondWithRpcPromise(_0x5e8d4c,_0x290d55,_0x29eaea){return new BPromise(function(_0x923f07,_0x53a68c){return client[_0x7706('0xf')](_0x5e8d4c,_0x29eaea)['then'](function(_0x543f2c){logger[_0x7706('0x10')](_0x7706('0x11'),_0x290d55,_0x7706('0x12'));logger[_0x7706('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x290d55,'request\x20sent',JSON[_0x7706('0x14')](_0x543f2c));if(_0x543f2c[_0x7706('0x15')]){if(_0x543f2c[_0x7706('0x15')][_0x7706('0x16')]===0x1f4){logger['error'](_0x7706('0x11'),_0x290d55,_0x543f2c[_0x7706('0x15')]['message']);return _0x53a68c(_0x543f2c[_0x7706('0x15')]['message']);}logger[_0x7706('0x15')](_0x7706('0x11'),_0x290d55,_0x543f2c[_0x7706('0x15')][_0x7706('0x17')]);return _0x923f07(_0x543f2c['error'][_0x7706('0x17')]);}else{logger[_0x7706('0x10')](_0x7706('0x11'),_0x290d55,_0x7706('0x12'));_0x923f07(_0x543f2c[_0x7706('0x18')][_0x7706('0x17')]);}})[_0x7706('0x19')](function(_0x40fdd1){logger[_0x7706('0x15')](_0x7706('0x11'),_0x290d55,_0x40fdd1);_0x53a68c(_0x40fdd1);});});}exports[_0x7706('0x1a')]=function(_0x3ac4ad){var _0x4857c6=this;return new Promise(function(_0x925ab6,_0x4b71d3){return db[_0x7706('0x1b')][_0x7706('0x1c')]({'raw':_0x3ac4ad[_0x7706('0x1d')]?_0x3ac4ad[_0x7706('0x1d')][_0x7706('0x1e')]===undefined?!![]:![]:!![],'where':_0x3ac4ad['options']?_0x3ac4ad[_0x7706('0x1d')][_0x7706('0x1f')]||null:null,'attributes':[[db[_0x7706('0x20')]['fn'](_0x7706('0x21'),db[_0x7706('0x20')]['fn']('IF',db['sequelize']['literal'](_0x7706('0x22')))),_0x7706('0x23')]]})[_0x7706('0x24')](function(_0x5e5d02){logger[_0x7706('0x10')](_0x7706('0x1a'),_0x3ac4ad);logger[_0x7706('0x13')]('GetVoiceQueueRtPauses',_0x3ac4ad,JSON[_0x7706('0x14')](_0x5e5d02));_0x925ab6(_0x5e5d02);})[_0x7706('0x19')](function(_0x2ef54c){logger['error'](_0x7706('0x1a'),_0x2ef54c[_0x7706('0x17')],_0x3ac4ad);_0x4b71d3(_0x4857c6[_0x7706('0x15')](0x1f4,_0x2ef54c[_0x7706('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index efc1c08..60ba094 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 _0x0650=['./userVoiceQueueRt.events','save','remove','update','removeListener','userVoiceQueueRt:'];(function(_0x2cfd1e,_0x4dfc49){var _0x2e6e33=function(_0x2a1cd9){while(--_0x2a1cd9){_0x2cfd1e['push'](_0x2cfd1e['shift']());}};_0x2e6e33(++_0x4dfc49);}(_0x0650,0x1aa));var _0x0065=function(_0x62ff29,_0x5b5d4c){_0x62ff29=_0x62ff29-0x0;var _0x63583b=_0x0650[_0x62ff29];return _0x63583b;};'use strict';var UserVoiceQueueRtEvents=require(_0x0065('0x0'));var events=[_0x0065('0x1'),_0x0065('0x2'),_0x0065('0x3')];function createListener(_0x4e8ee5,_0x19fb0e){return function(_0x5d831c){_0x19fb0e['emit'](_0x4e8ee5,_0x5d831c);};}function removeListener(_0x1798d6,_0xe2785){return function(){UserVoiceQueueRtEvents[_0x0065('0x4')](_0x1798d6,_0xe2785);};}exports['register']=function(_0x4aab3a){for(var _0x456a74=0x0,_0x5792dc=events['length'];_0x456a74<_0x5792dc;_0x456a74++){var _0x49d04d=events[_0x456a74];var _0x576ca0=createListener(_0x0065('0x5')+_0x49d04d,_0x4aab3a);UserVoiceQueueRtEvents['on'](_0x49d04d,_0x576ca0);}}; \ No newline at end of file +var _0xc43c=['length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','removeListener','register'];(function(_0xac8ea3,_0x2d9fc9){var _0x1c1354=function(_0x161740){while(--_0x161740){_0xac8ea3['push'](_0xac8ea3['shift']());}};_0x1c1354(++_0x2d9fc9);}(_0xc43c,0xd4));var _0xcc43=function(_0x2d49d9,_0x27dd59){_0x2d49d9=_0x2d49d9-0x0;var _0x4ac193=_0xc43c[_0x2d49d9];return _0x4ac193;};'use strict';var UserVoiceQueueRtEvents=require(_0xcc43('0x0'));var events=[_0xcc43('0x1'),_0xcc43('0x2'),'update'];function createListener(_0x508584,_0x4796a8){return function(_0x3f0c49){_0x4796a8['emit'](_0x508584,_0x3f0c49);};}function removeListener(_0x484b53,_0x4c59cc){return function(){UserVoiceQueueRtEvents[_0xcc43('0x3')](_0x484b53,_0x4c59cc);};}exports[_0xcc43('0x4')]=function(_0x13d329){for(var _0x5e818f=0x0,_0x359663=events[_0xcc43('0x5')];_0x5e818f<_0x359663;_0x5e818f++){var _0x36e3a5=events[_0x5e818f];var _0x25528e=createListener(_0xcc43('0x6')+_0x36e3a5,_0x13d329);UserVoiceQueueRtEvents['on'](_0x36e3a5,_0x25528e);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 331058f..e541e97 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2f9cdb,_0x11aed7){var _0x233491=function(_0x5bcbf4){while(--_0x5bcbf4){_0x2f9cdb['push'](_0x2f9cdb['shift']());}};_0x233491(++_0x11aed7);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0xcb91[_0x5cbf0e];return _0x1c76f8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x409d89,_0x4687c8){var _0xdd0bb7=function(_0x28704b){while(--_0x28704b){_0x409d89['push'](_0x409d89['shift']());}};_0xdd0bb7(++_0x4687c8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xcb91[_0x68c979];return _0x4f0001;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 9d90b58..8e5a634 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 _0x8478=['exports','INTEGER','sequelize'];(function(_0x2ebb32,_0x56de24){var _0x224d00=function(_0x34e182){while(--_0x34e182){_0x2ebb32['push'](_0x2ebb32['shift']());}};_0x224d00(++_0x56de24);}(_0x8478,0x149));var _0x8847=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x8478[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x8847('0x0'));module[_0x8847('0x1')]={'penalty':{'type':Sequelize[_0x8847('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd943=['sequelize','exports','INTEGER'];(function(_0x53e548,_0x345863){var _0x124c39=function(_0x175328){while(--_0x175328){_0x53e548['push'](_0x53e548['shift']());}};_0x124c39(++_0x345863);}(_0xd943,0x114));var _0x3d94=function(_0x13b384,_0x274645){_0x13b384=_0x13b384-0x0;var _0x305031=_0xd943[_0x13b384];return _0x305031;};'use strict';var Sequelize=require(_0x3d94('0x0'));module[_0x3d94('0x1')]={'penalty':{'type':Sequelize[_0x3d94('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 62bdc2b..1b248db 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 _0x050c=['user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','request-promise','path','./userWhatsappQueue.attributes','exports','define'];(function(_0x117473,_0x485375){var _0x38711a=function(_0x33e119){while(--_0x33e119){_0x117473['push'](_0x117473['shift']());}};_0x38711a(++_0x485375);}(_0x050c,0x1b9));var _0xc050=function(_0x4983ce,_0x13f756){_0x4983ce=_0x4983ce-0x0;var _0x2ad4c4=_0x050c[_0x4983ce];return _0x2ad4c4;};'use strict';var _=require(_0xc050('0x0'));var util=require(_0xc050('0x1'));var logger=require(_0xc050('0x2'))(_0xc050('0x3'));var moment=require(_0xc050('0x4'));var BPromise=require('bluebird');var rp=require(_0xc050('0x5'));var fs=require('fs');var path=require(_0xc050('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc050('0x7'));module[_0xc050('0x8')]=function(_0x39a9d9,_0x15dc5c){return _0x39a9d9[_0xc050('0x9')]('UserWhatsappQueue',attributes,{'tableName':_0xc050('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97e2=['path','rimraf','./userWhatsappQueue.attributes','UserWhatsappQueue','lodash','util','../../config/logger','moment','bluebird'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x97e2,0x1bd));var _0x297e=function(_0x1948d8,_0x1ed6f4){_0x1948d8=_0x1948d8-0x0;var _0x3ac510=_0x97e2[_0x1948d8];return _0x3ac510;};'use strict';var _=require(_0x297e('0x0'));var util=require(_0x297e('0x1'));var logger=require(_0x297e('0x2'))('api');var moment=require(_0x297e('0x3'));var BPromise=require(_0x297e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x297e('0x5'));var rimraf=require(_0x297e('0x6'));var config=require('../../config/environment');var attributes=require(_0x297e('0x7'));module['exports']=function(_0x50758a,_0x39b439){return _0x50758a['define'](_0x297e('0x8'),attributes,{'tableName':'user_has_whatsapp_queues','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 8ae87d0..9cfc1c0 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 _0xc0ee=['info','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','then'];(function(_0xb19183,_0x145763){var _0x33b014=function(_0x35db27){while(--_0x35db27){_0xb19183['push'](_0xb19183['shift']());}};_0x33b014(++_0x145763);}(_0xc0ee,0x19a));var _0xec0e=function(_0x126fb9,_0x122c59){_0x126fb9=_0x126fb9-0x0;var _0xc8a3b1=_0xc0ee[_0x126fb9];return _0xc8a3b1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xec0e('0x0'));var BPromise=require(_0xec0e('0x1'));var rs=require(_0xec0e('0x2'));var fs=require('fs');var Redis=require(_0xec0e('0x3'));var db=require(_0xec0e('0x4'))['db'];var utils=require(_0xec0e('0x5'));var logger=require(_0xec0e('0x6'))('rpc');var config=require(_0xec0e('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x469cb7,_0x3e3511,_0x453af3){return new BPromise(function(_0x3d292d,_0x45a246){return client[_0xec0e('0x8')](_0x469cb7,_0x453af3)[_0xec0e('0x9')](function(_0x158afe){logger[_0xec0e('0xa')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3e3511,_0xec0e('0xb'));logger[_0xec0e('0xc')](_0xec0e('0xd'),_0x3e3511,_0xec0e('0xb'),JSON['stringify'](_0x158afe));if(_0x158afe[_0xec0e('0xe')]){if(_0x158afe['error'][_0xec0e('0xf')]===0x1f4){logger[_0xec0e('0xe')](_0xec0e('0x10'),_0x3e3511,_0x158afe['error'][_0xec0e('0x11')]);return _0x45a246(_0x158afe[_0xec0e('0xe')][_0xec0e('0x11')]);}logger[_0xec0e('0xe')](_0xec0e('0x10'),_0x3e3511,_0x158afe['error']['message']);return _0x3d292d(_0x158afe['error'][_0xec0e('0x11')]);}else{logger[_0xec0e('0xa')](_0xec0e('0x10'),_0x3e3511,_0xec0e('0xb'));_0x3d292d(_0x158afe[_0xec0e('0x12')][_0xec0e('0x11')]);}})[_0xec0e('0x13')](function(_0x12809d){logger[_0xec0e('0xe')](_0xec0e('0x10'),_0x3e3511,_0x12809d);_0x45a246(_0x12809d);});});} \ No newline at end of file +var _0x08f2=['code','message','info','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2a38ac,_0x533316){var _0x382218=function(_0x3509a9){while(--_0x3509a9){_0x2a38ac['push'](_0x2a38ac['shift']());}};_0x382218(++_0x533316);}(_0x08f2,0x17a));var _0x208f=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x08f2[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x208f('0x0'));var util=require(_0x208f('0x1'));var moment=require('moment');var BPromise=require(_0x208f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x208f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x208f('0x4'));var logger=require(_0x208f('0x5'))(_0x208f('0x6'));var config=require(_0x208f('0x7'));var jayson=require(_0x208f('0x8'));var client=jayson['client'][_0x208f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b86d6,_0xf496ee,_0x558f2d){return new BPromise(function(_0x2da3e6,_0x3b9eb4){return client[_0x208f('0xa')](_0x3b86d6,_0x558f2d)[_0x208f('0xb')](function(_0x286271){logger['info'](_0x208f('0xc'),_0xf496ee,_0x208f('0xd'));logger[_0x208f('0xe')](_0x208f('0xf'),_0xf496ee,_0x208f('0xd'),JSON[_0x208f('0x10')](_0x286271));if(_0x286271[_0x208f('0x11')]){if(_0x286271[_0x208f('0x11')][_0x208f('0x12')]===0x1f4){logger[_0x208f('0x11')](_0x208f('0xc'),_0xf496ee,_0x286271[_0x208f('0x11')][_0x208f('0x13')]);return _0x3b9eb4(_0x286271['error'][_0x208f('0x13')]);}logger[_0x208f('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0xf496ee,_0x286271[_0x208f('0x11')][_0x208f('0x13')]);return _0x2da3e6(_0x286271['error'][_0x208f('0x13')]);}else{logger[_0x208f('0x14')](_0x208f('0xc'),_0xf496ee,_0x208f('0xd'));_0x2da3e6(_0x286271['result']['message']);}})[_0x208f('0x15')](function(_0x5aa180){logger[_0x208f('0x11')](_0x208f('0xc'),_0xf496ee,_0x5aa180);_0x3b9eb4(_0x5aa180);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index e8b302f..dc2d96f 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 _0xe14d=['../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x3d938d,_0x5ed96d){var _0x2b721f=function(_0x3f5ca2){while(--_0x3f5ca2){_0x3d938d['push'](_0x3d938d['shift']());}};_0x2b721f(++_0x5ed96d);}(_0xe14d,0x1ee));var _0xde14=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe14d[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var path=require(_0xde14('0x2'));var timeout=require(_0xde14('0x3'));var express=require('express');var router=express[_0xde14('0x4')]();var fs_extra=require(_0xde14('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var controller=require(_0xde14('0x8'));router[_0xde14('0x9')]('/',auth[_0xde14('0xa')](),controller[_0xde14('0xb')]);router['get']('/:id',auth[_0xde14('0xa')](),controller[_0xde14('0xc')]);router[_0xde14('0xd')]('/',auth[_0xde14('0xa')](),controller[_0xde14('0xe')]);router[_0xde14('0xf')](_0xde14('0x10'),auth[_0xde14('0xa')](),controller['update']);router[_0xde14('0x11')](_0xde14('0x10'),auth[_0xde14('0xa')](),controller[_0xde14('0x12')]);module[_0xde14('0x13')]=router; \ No newline at end of file +var _0x861c=['get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller'];(function(_0x260d3f,_0x5c0c51){var _0x1bbb43=function(_0x3f6393){while(--_0x3f6393){_0x260d3f['push'](_0x260d3f['shift']());}};_0x1bbb43(++_0x5c0c51);}(_0x861c,0xdb));var _0xc861=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x861c[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xc861('0x0'));var util=require(_0xc861('0x1'));var path=require(_0xc861('0x2'));var timeout=require(_0xc861('0x3'));var express=require(_0xc861('0x4'));var router=express[_0xc861('0x5')]();var fs_extra=require(_0xc861('0x6'));var auth=require(_0xc861('0x7'));var interaction=require(_0xc861('0x8'));var config=require(_0xc861('0x9'));var controller=require(_0xc861('0xa'));router[_0xc861('0xb')]('/',auth['isAuthenticated'](),controller[_0xc861('0xc')]);router[_0xc861('0xb')](_0xc861('0xd'),auth[_0xc861('0xe')](),controller[_0xc861('0xf')]);router[_0xc861('0x10')]('/',auth[_0xc861('0xe')](),controller[_0xc861('0x11')]);router[_0xc861('0x12')](_0xc861('0xd'),auth[_0xc861('0xe')](),controller[_0xc861('0x13')]);router[_0xc861('0x14')]('/:id',auth[_0xc861('0xe')](),controller[_0xc861('0x15')]);module[_0xc861('0x16')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index e4ccc4b..b2de0ba 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 _0x60d4=['sequelize','exports','STRING','name'];(function(_0x554824,_0x26abe4){var _0x39e60d=function(_0x493228){while(--_0x493228){_0x554824['push'](_0x554824['shift']());}};_0x39e60d(++_0x26abe4);}(_0x60d4,0xa4));var _0x460d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x60d4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x460d('0x0'));module[_0x460d('0x1')]={'name':{'type':Sequelize[_0x460d('0x2')],'unique':_0x460d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb31a=['sequelize','exports','STRING','name'];(function(_0x323dea,_0x3f00a4){var _0x5a3494=function(_0xc94c90){while(--_0xc94c90){_0x323dea['push'](_0x323dea['shift']());}};_0x5a3494(++_0x3f00a4);}(_0xb31a,0xd4));var _0xab31=function(_0x148eef,_0x732161){_0x148eef=_0x148eef-0x0;var _0x35c4fd=_0xb31a[_0x148eef];return _0x35c4fd;};'use strict';var Sequelize=require(_0xab31('0x0'));module[_0xab31('0x1')]={'name':{'type':Sequelize[_0xab31('0x2')],'unique':_0xab31('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xab31('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index d940684..c6d307c 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 _0x8b90=['catch','user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','get','Variables','UserProfileResource','destroy','error','name','send','index','Variable','fieldName','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x8b90,0xaa));var _0x08b9=function(_0x52a08b,_0x12388d){_0x52a08b=_0x52a08b-0x0;var _0x2c6670=_0x8b90[_0x52a08b];return _0x2c6670;};'use strict';var emlformat=require(_0x08b9('0x0'));var rimraf=require(_0x08b9('0x1'));var zipdir=require(_0x08b9('0x2'));var jsonpatch=require(_0x08b9('0x3'));var rp=require('request-promise');var moment=require(_0x08b9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x08b9('0x5'));var util=require(_0x08b9('0x6'));var path=require(_0x08b9('0x7'));var sox=require(_0x08b9('0x8'));var csv=require(_0x08b9('0x9'));var ejs=require(_0x08b9('0xa'));var fs=require('fs');var fs_extra=require(_0x08b9('0xb'));var _=require(_0x08b9('0xc'));var squel=require('squel');var crypto=require(_0x08b9('0xd'));var jsforce=require(_0x08b9('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x08b9('0xf'));var Papa=require('papaparse');var Redis=require(_0x08b9('0x10'));var authService=require(_0x08b9('0x11'));var qs=require(_0x08b9('0x12'));var as=require(_0x08b9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x08b9('0x14'))(_0x08b9('0x15'));var utils=require(_0x08b9('0x16'));var config=require(_0x08b9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x08b9('0x18'))['db'];function respondWithStatusCode(_0x1ba62f,_0x1a578e){_0x1a578e=_0x1a578e||0xcc;return function(_0x290a65){if(_0x290a65){return _0x1ba62f[_0x08b9('0x19')](_0x1a578e);}return _0x1ba62f[_0x08b9('0x1a')](_0x1a578e)[_0x08b9('0x1b')]();};}function respondWithResult(_0x2e9b54,_0x100271){_0x100271=_0x100271||0xc8;return function(_0x5a454a){if(_0x5a454a){return _0x2e9b54['status'](_0x100271)[_0x08b9('0x1c')](_0x5a454a);}};}function respondWithFilteredResult(_0x221447,_0x4259e1){return function(_0x1665c3){if(_0x1665c3){var _0x31daad=typeof _0x4259e1[_0x08b9('0x1d')]===_0x08b9('0x1e')&&typeof _0x4259e1[_0x08b9('0x1f')]===_0x08b9('0x1e');var _0x50aec6=_0x1665c3['count'];var _0x1d2c78=_0x31daad?0x0:_0x4259e1['offset'];var _0x4fb897=_0x31daad?_0x1665c3[_0x08b9('0x20')]:_0x4259e1[_0x08b9('0x1d')]+_0x4259e1[_0x08b9('0x1f')];var _0x45fac4;if(_0x4fb897>=_0x50aec6){_0x4fb897=_0x50aec6;_0x45fac4=0xc8;}else{_0x45fac4=0xce;}_0x221447[_0x08b9('0x1a')](_0x45fac4);return _0x221447[_0x08b9('0x21')]('Content-Range',_0x1d2c78+'-'+_0x4fb897+'/'+_0x50aec6)[_0x08b9('0x1c')](_0x1665c3);}return null;};}function patchUpdates(_0xc6dff6){return function(_0x4ffb8c){try{jsonpatch['apply'](_0x4ffb8c,_0xc6dff6,!![]);}catch(_0x20e5f1){return BPromise[_0x08b9('0x22')](_0x20e5f1);}return _0x4ffb8c[_0x08b9('0x23')]();};}function saveUpdates(_0x10a451,_0x2b193c){return function(_0x386bff){if(_0x386bff){return _0x386bff[_0x08b9('0x24')](_0x10a451)['then'](function(_0x38f362){return _0x38f362;});}return null;};}function removeEntity(_0x2ae5d8,_0x4e3ab3){return function(_0x5eb950){if(_0x5eb950){return _0x5eb950['destroy']()[_0x08b9('0x25')](function(){var _0x4dea63=_0x5eb950[_0x08b9('0x26')]({'plain':!![]});var _0x3a69c6=_0x08b9('0x27');return db[_0x08b9('0x28')][_0x08b9('0x29')]({'where':{'type':_0x3a69c6,'resourceId':_0x4dea63['id']}})['then'](function(){return _0x5eb950;});})['then'](function(){_0x2ae5d8[_0x08b9('0x1a')](0xcc)[_0x08b9('0x1b')]();});}};}function handleEntityNotFound(_0x518599,_0x190ba7){return function(_0x4ed9da){if(!_0x4ed9da){_0x518599[_0x08b9('0x19')](0x194);}return _0x4ed9da;};}function handleError(_0x28563f,_0x1a81b5){_0x1a81b5=_0x1a81b5||0x1f4;return function(_0x5a3f5a){logger[_0x08b9('0x2a')](_0x5a3f5a['stack']);if(_0x5a3f5a[_0x08b9('0x2b')]){delete _0x5a3f5a['name'];}_0x28563f['status'](_0x1a81b5)[_0x08b9('0x2c')](_0x5a3f5a);};}exports[_0x08b9('0x2d')]=function(_0x2e8eab,_0x13886e){var _0x3c0bb9={},_0x2aed37={},_0x300086={'count':0x0,'rows':[]};var _0x394bab=_['map'](db[_0x08b9('0x2e')]['rawAttributes'],function(_0x20fad5){return{'name':_0x20fad5[_0x08b9('0x2f')],'type':_0x20fad5['type']['key']};});_0x2aed37['model']=_['map'](_0x394bab,'name');_0x2aed37[_0x08b9('0x30')]=_[_0x08b9('0x31')](_0x2e8eab['query']);_0x2aed37['filters']=_[_0x08b9('0x32')](_0x2aed37[_0x08b9('0x33')],_0x2aed37[_0x08b9('0x30')]);_0x3c0bb9[_0x08b9('0x34')]=_['intersection'](_0x2aed37[_0x08b9('0x33')],qs[_0x08b9('0x35')](_0x2e8eab['query'][_0x08b9('0x35')]));_0x3c0bb9[_0x08b9('0x34')]=_0x3c0bb9['attributes'][_0x08b9('0x36')]?_0x3c0bb9[_0x08b9('0x34')]:_0x2aed37['model'];if(!_0x2e8eab[_0x08b9('0x30')][_0x08b9('0x37')]('nolimit')){_0x3c0bb9[_0x08b9('0x1f')]=qs[_0x08b9('0x1f')](_0x2e8eab[_0x08b9('0x30')][_0x08b9('0x1f')]);_0x3c0bb9[_0x08b9('0x1d')]=qs[_0x08b9('0x1d')](_0x2e8eab['query'][_0x08b9('0x1d')]);}_0x3c0bb9['order']=qs[_0x08b9('0x38')](_0x2e8eab[_0x08b9('0x30')][_0x08b9('0x38')]);_0x3c0bb9[_0x08b9('0x39')]=qs[_0x08b9('0x3a')](_[_0x08b9('0x3b')](_0x2e8eab[_0x08b9('0x30')],_0x2aed37[_0x08b9('0x3a')]),_0x394bab);if(_0x2e8eab['query'][_0x08b9('0x3c')]){_0x3c0bb9[_0x08b9('0x39')]=_[_0x08b9('0x3d')](_0x3c0bb9[_0x08b9('0x39')],{'$or':_['map'](_0x394bab,function(_0x55a28f){if(_0x55a28f['type']!==_0x08b9('0x3e')){var _0x415c9d={};_0x415c9d[_0x55a28f[_0x08b9('0x2b')]]={'$like':'%'+_0x2e8eab[_0x08b9('0x30')][_0x08b9('0x3c')]+'%'};return _0x415c9d;}})});}_0x3c0bb9=_[_0x08b9('0x3d')]({},_0x3c0bb9,_0x2e8eab[_0x08b9('0x3f')]);var _0x2a38b1={'where':_0x3c0bb9[_0x08b9('0x39')]};return db['Variable']['count'](_0x2a38b1)[_0x08b9('0x25')](function(_0x4d409e){_0x300086[_0x08b9('0x20')]=_0x4d409e;if(_0x2e8eab[_0x08b9('0x30')][_0x08b9('0x40')]){_0x3c0bb9[_0x08b9('0x41')]=[{'all':!![]}];}return db['Variable'][_0x08b9('0x42')](_0x3c0bb9);})[_0x08b9('0x25')](function(_0x3df532){_0x300086[_0x08b9('0x43')]=_0x3df532;return _0x300086;})[_0x08b9('0x25')](respondWithFilteredResult(_0x13886e,_0x3c0bb9))['catch'](handleError(_0x13886e,null));};exports[_0x08b9('0x44')]=function(_0x4d1b69,_0x372000){var _0x123a7c={'raw':!![],'where':{'id':_0x4d1b69['params']['id']}},_0x1c2195={};_0x1c2195[_0x08b9('0x33')]=_[_0x08b9('0x31')](db['Variable']['rawAttributes']);_0x1c2195[_0x08b9('0x30')]=_['keys'](_0x4d1b69['query']);_0x1c2195[_0x08b9('0x3a')]=_[_0x08b9('0x32')](_0x1c2195[_0x08b9('0x33')],_0x1c2195[_0x08b9('0x30')]);_0x123a7c['attributes']=_[_0x08b9('0x32')](_0x1c2195[_0x08b9('0x33')],qs[_0x08b9('0x35')](_0x4d1b69[_0x08b9('0x30')][_0x08b9('0x35')]));_0x123a7c[_0x08b9('0x34')]=_0x123a7c[_0x08b9('0x34')][_0x08b9('0x36')]?_0x123a7c[_0x08b9('0x34')]:_0x1c2195[_0x08b9('0x33')];if(_0x4d1b69['query']['includeAll']){_0x123a7c['include']=[{'all':!![]}];}_0x123a7c=_[_0x08b9('0x3d')]({},_0x123a7c,_0x4d1b69[_0x08b9('0x3f')]);return db[_0x08b9('0x2e')][_0x08b9('0x45')](_0x123a7c)['then'](handleEntityNotFound(_0x372000,null))[_0x08b9('0x25')](respondWithResult(_0x372000,null))[_0x08b9('0x46')](handleError(_0x372000,null));};exports['create']=function(_0x4fce76,_0x173a3d){return db['Variable']['create'](_0x4fce76['body'],{})[_0x08b9('0x25')](function(_0x17173f){var _0x44255b=_0x4fce76[_0x08b9('0x47')]['get']({'plain':!![]});if(!_0x44255b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x44255b[_0x08b9('0x48')]===_0x08b9('0x47')){var _0xc6d493=_0x17173f[_0x08b9('0x26')]({'plain':!![]});var _0x24522a=_0x08b9('0x27');return db[_0x08b9('0x49')][_0x08b9('0x45')]({'where':{'name':_0x24522a,'userProfileId':_0x44255b[_0x08b9('0x4a')]},'raw':!![]})[_0x08b9('0x25')](function(_0x4ab76e){if(_0x4ab76e&&_0x4ab76e[_0x08b9('0x4b')]===0x0){return db['UserProfileResource'][_0x08b9('0x4c')]({'name':_0xc6d493[_0x08b9('0x2b')],'resourceId':_0xc6d493['id'],'type':_0x4ab76e[_0x08b9('0x2b')],'sectionId':_0x4ab76e['id']},{})['then'](function(){return _0x17173f;});}else{return _0x17173f;}})[_0x08b9('0x46')](function(_0xdd4d79){logger['error'](_0x08b9('0x4d'),_0xdd4d79);throw _0xdd4d79;});}return _0x17173f;})[_0x08b9('0x25')](respondWithResult(_0x173a3d,0xc9))[_0x08b9('0x46')](handleError(_0x173a3d,null));};exports[_0x08b9('0x24')]=function(_0x104f13,_0x418abd){if(_0x104f13[_0x08b9('0x4e')]['id']){delete _0x104f13[_0x08b9('0x4e')]['id'];}return db[_0x08b9('0x2e')]['find']({'where':{'id':_0x104f13[_0x08b9('0x4f')]['id']}})['then'](handleEntityNotFound(_0x418abd,null))['then'](saveUpdates(_0x104f13[_0x08b9('0x4e')],null))[_0x08b9('0x25')](respondWithResult(_0x418abd,null))[_0x08b9('0x46')](handleError(_0x418abd,null));};exports['destroy']=function(_0x375c13,_0x33d47d){return db[_0x08b9('0x2e')][_0x08b9('0x45')]({'where':{'id':_0x375c13['params']['id']}})[_0x08b9('0x25')](handleEntityNotFound(_0x33d47d,null))[_0x08b9('0x25')](removeEntity(_0x33d47d,null))[_0x08b9('0x46')](handleError(_0x33d47d,null));}; \ No newline at end of file +var _0xc548=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','offset','set','Content-Range','json','reject','then','destroy','get','Variables','UserProfileResource','error','name','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','nolimit','sort','where','pick','filter','merge','options','Variable','count','includeAll','include','rows','catch','show','params','length','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','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','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xba1760,_0x191969){var _0x1f3143=function(_0x5aa807){while(--_0x5aa807){_0xba1760['push'](_0xba1760['shift']());}};_0x1f3143(++_0x191969);}(_0xc548,0xd3));var _0x8c54=function(_0x11a95c,_0x3f5a3e){_0x11a95c=_0x11a95c-0x0;var _0x27b8ed=_0xc548[_0x11a95c];return _0x27b8ed;};'use strict';var emlformat=require(_0x8c54('0x0'));var rimraf=require(_0x8c54('0x1'));var zipdir=require(_0x8c54('0x2'));var jsonpatch=require(_0x8c54('0x3'));var rp=require(_0x8c54('0x4'));var moment=require(_0x8c54('0x5'));var BPromise=require(_0x8c54('0x6'));var Mustache=require(_0x8c54('0x7'));var util=require('util');var path=require('path');var sox=require(_0x8c54('0x8'));var csv=require(_0x8c54('0x9'));var ejs=require(_0x8c54('0xa'));var fs=require('fs');var fs_extra=require(_0x8c54('0xb'));var _=require('lodash');var squel=require(_0x8c54('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8c54('0xd'));var toCsv=require(_0x8c54('0x9'));var querystring=require(_0x8c54('0xe'));var Papa=require(_0x8c54('0xf'));var Redis=require(_0x8c54('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8c54('0x11'));var as=require(_0x8c54('0x12'));var hardwareService=require(_0x8c54('0x13'));var logger=require(_0x8c54('0x14'))('api');var utils=require(_0x8c54('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8c54('0x16'));var db=require(_0x8c54('0x17'))['db'];function respondWithStatusCode(_0x3d5c5a,_0x1cba4f){_0x1cba4f=_0x1cba4f||0xcc;return function(_0x237d9a){if(_0x237d9a){return _0x3d5c5a[_0x8c54('0x18')](_0x1cba4f);}return _0x3d5c5a[_0x8c54('0x19')](_0x1cba4f)[_0x8c54('0x1a')]();};}function respondWithResult(_0x344ae0,_0x30b0e8){_0x30b0e8=_0x30b0e8||0xc8;return function(_0x50394d){if(_0x50394d){return _0x344ae0['status'](_0x30b0e8)['json'](_0x50394d);}};}function respondWithFilteredResult(_0x28314e,_0x2161c5){return function(_0x5e4f1f){if(_0x5e4f1f){var _0x26135c=typeof _0x2161c5['offset']==='undefined'&&typeof _0x2161c5[_0x8c54('0x1b')]===_0x8c54('0x1c');var _0x34de9c=_0x5e4f1f['count'];var _0x291d33=_0x26135c?0x0:_0x2161c5[_0x8c54('0x1d')];var _0x340175=_0x26135c?_0x5e4f1f['count']:_0x2161c5[_0x8c54('0x1d')]+_0x2161c5['limit'];var _0x16c36e;if(_0x340175>=_0x34de9c){_0x340175=_0x34de9c;_0x16c36e=0xc8;}else{_0x16c36e=0xce;}_0x28314e[_0x8c54('0x19')](_0x16c36e);return _0x28314e[_0x8c54('0x1e')](_0x8c54('0x1f'),_0x291d33+'-'+_0x340175+'/'+_0x34de9c)[_0x8c54('0x20')](_0x5e4f1f);}return null;};}function patchUpdates(_0x56d2db){return function(_0x622a93){try{jsonpatch['apply'](_0x622a93,_0x56d2db,!![]);}catch(_0x3eebb2){return BPromise[_0x8c54('0x21')](_0x3eebb2);}return _0x622a93['save']();};}function saveUpdates(_0x5f07e6,_0x5c3f9a){return function(_0x28b0b4){if(_0x28b0b4){return _0x28b0b4['update'](_0x5f07e6)[_0x8c54('0x22')](function(_0xf5014f){return _0xf5014f;});}return null;};}function removeEntity(_0x148844,_0xeed4){return function(_0x2a3178){if(_0x2a3178){return _0x2a3178[_0x8c54('0x23')]()[_0x8c54('0x22')](function(){var _0x293165=_0x2a3178[_0x8c54('0x24')]({'plain':!![]});var _0x3dd3f7=_0x8c54('0x25');return db[_0x8c54('0x26')][_0x8c54('0x23')]({'where':{'type':_0x3dd3f7,'resourceId':_0x293165['id']}})[_0x8c54('0x22')](function(){return _0x2a3178;});})['then'](function(){_0x148844[_0x8c54('0x19')](0xcc)[_0x8c54('0x1a')]();});}};}function handleEntityNotFound(_0x59c361,_0x2f7770){return function(_0x232804){if(!_0x232804){_0x59c361[_0x8c54('0x18')](0x194);}return _0x232804;};}function handleError(_0x5d8846,_0x25741f){_0x25741f=_0x25741f||0x1f4;return function(_0x1592fb){logger[_0x8c54('0x27')](_0x1592fb['stack']);if(_0x1592fb[_0x8c54('0x28')]){delete _0x1592fb[_0x8c54('0x28')];}_0x5d8846[_0x8c54('0x19')](_0x25741f)['send'](_0x1592fb);};}exports['index']=function(_0x4a1a9b,_0x456fd4){var _0x416348={},_0x57d2f5={},_0x266fa0={'count':0x0,'rows':[]};var _0x1b5f2a=_[_0x8c54('0x29')](db['Variable'][_0x8c54('0x2a')],function(_0x502111){return{'name':_0x502111[_0x8c54('0x2b')],'type':_0x502111[_0x8c54('0x2c')]['key']};});_0x57d2f5[_0x8c54('0x2d')]=_['map'](_0x1b5f2a,_0x8c54('0x28'));_0x57d2f5[_0x8c54('0x2e')]=_[_0x8c54('0x2f')](_0x4a1a9b[_0x8c54('0x2e')]);_0x57d2f5[_0x8c54('0x30')]=_['intersection'](_0x57d2f5['model'],_0x57d2f5[_0x8c54('0x2e')]);_0x416348[_0x8c54('0x31')]=_[_0x8c54('0x32')](_0x57d2f5['model'],qs[_0x8c54('0x33')](_0x4a1a9b[_0x8c54('0x2e')][_0x8c54('0x33')]));_0x416348[_0x8c54('0x31')]=_0x416348[_0x8c54('0x31')]['length']?_0x416348['attributes']:_0x57d2f5[_0x8c54('0x2d')];if(!_0x4a1a9b[_0x8c54('0x2e')]['hasOwnProperty'](_0x8c54('0x34'))){_0x416348[_0x8c54('0x1b')]=qs['limit'](_0x4a1a9b[_0x8c54('0x2e')]['limit']);_0x416348['offset']=qs[_0x8c54('0x1d')](_0x4a1a9b[_0x8c54('0x2e')]['offset']);}_0x416348['order']=qs[_0x8c54('0x35')](_0x4a1a9b[_0x8c54('0x2e')][_0x8c54('0x35')]);_0x416348[_0x8c54('0x36')]=qs[_0x8c54('0x30')](_[_0x8c54('0x37')](_0x4a1a9b[_0x8c54('0x2e')],_0x57d2f5[_0x8c54('0x30')]),_0x1b5f2a);if(_0x4a1a9b[_0x8c54('0x2e')][_0x8c54('0x38')]){_0x416348[_0x8c54('0x36')]=_[_0x8c54('0x39')](_0x416348[_0x8c54('0x36')],{'$or':_['map'](_0x1b5f2a,function(_0x16eac5){if(_0x16eac5['type']!=='VIRTUAL'){var _0x3d7aaa={};_0x3d7aaa[_0x16eac5[_0x8c54('0x28')]]={'$like':'%'+_0x4a1a9b['query'][_0x8c54('0x38')]+'%'};return _0x3d7aaa;}})});}_0x416348=_[_0x8c54('0x39')]({},_0x416348,_0x4a1a9b[_0x8c54('0x3a')]);var _0x1c8e91={'where':_0x416348['where']};return db[_0x8c54('0x3b')][_0x8c54('0x3c')](_0x1c8e91)['then'](function(_0x4c5b29){_0x266fa0[_0x8c54('0x3c')]=_0x4c5b29;if(_0x4a1a9b[_0x8c54('0x2e')][_0x8c54('0x3d')]){_0x416348[_0x8c54('0x3e')]=[{'all':!![]}];}return db[_0x8c54('0x3b')]['findAll'](_0x416348);})['then'](function(_0x2941ed){_0x266fa0[_0x8c54('0x3f')]=_0x2941ed;return _0x266fa0;})[_0x8c54('0x22')](respondWithFilteredResult(_0x456fd4,_0x416348))[_0x8c54('0x40')](handleError(_0x456fd4,null));};exports[_0x8c54('0x41')]=function(_0x3cac2b,_0x2ac470){var _0x4e26c6={'raw':!![],'where':{'id':_0x3cac2b[_0x8c54('0x42')]['id']}},_0x3b189f={};_0x3b189f[_0x8c54('0x2d')]=_[_0x8c54('0x2f')](db[_0x8c54('0x3b')][_0x8c54('0x2a')]);_0x3b189f[_0x8c54('0x2e')]=_[_0x8c54('0x2f')](_0x3cac2b[_0x8c54('0x2e')]);_0x3b189f['filters']=_[_0x8c54('0x32')](_0x3b189f[_0x8c54('0x2d')],_0x3b189f[_0x8c54('0x2e')]);_0x4e26c6[_0x8c54('0x31')]=_['intersection'](_0x3b189f[_0x8c54('0x2d')],qs['fields'](_0x3cac2b[_0x8c54('0x2e')][_0x8c54('0x33')]));_0x4e26c6['attributes']=_0x4e26c6['attributes'][_0x8c54('0x43')]?_0x4e26c6['attributes']:_0x3b189f[_0x8c54('0x2d')];if(_0x3cac2b[_0x8c54('0x2e')][_0x8c54('0x3d')]){_0x4e26c6[_0x8c54('0x3e')]=[{'all':!![]}];}_0x4e26c6=_[_0x8c54('0x39')]({},_0x4e26c6,_0x3cac2b[_0x8c54('0x3a')]);return db[_0x8c54('0x3b')][_0x8c54('0x44')](_0x4e26c6)[_0x8c54('0x22')](handleEntityNotFound(_0x2ac470,null))[_0x8c54('0x22')](respondWithResult(_0x2ac470,null))[_0x8c54('0x40')](handleError(_0x2ac470,null));};exports['create']=function(_0x5bdb5a,_0x4b94f3){return db[_0x8c54('0x3b')]['create'](_0x5bdb5a[_0x8c54('0x45')],{})['then'](function(_0x54ff10){var _0x3c24cf=_0x5bdb5a[_0x8c54('0x46')]['get']({'plain':!![]});if(!_0x3c24cf)throw new Error(_0x8c54('0x47'));if(_0x3c24cf[_0x8c54('0x48')]==='user'){var _0x1fd11a=_0x54ff10[_0x8c54('0x24')]({'plain':!![]});var _0x4ae28c='Variables';return db[_0x8c54('0x49')]['find']({'where':{'name':_0x4ae28c,'userProfileId':_0x3c24cf['userProfileId']},'raw':!![]})['then'](function(_0x576280){if(_0x576280&&_0x576280[_0x8c54('0x4a')]===0x0){return db[_0x8c54('0x26')]['create']({'name':_0x1fd11a[_0x8c54('0x28')],'resourceId':_0x1fd11a['id'],'type':_0x576280[_0x8c54('0x28')],'sectionId':_0x576280['id']},{})['then'](function(){return _0x54ff10;});}else{return _0x54ff10;}})[_0x8c54('0x40')](function(_0x1a180b){logger[_0x8c54('0x27')](_0x8c54('0x4b'),_0x1a180b);throw _0x1a180b;});}return _0x54ff10;})[_0x8c54('0x22')](respondWithResult(_0x4b94f3,0xc9))['catch'](handleError(_0x4b94f3,null));};exports[_0x8c54('0x4c')]=function(_0x11d92a,_0x23333c){if(_0x11d92a['body']['id']){delete _0x11d92a[_0x8c54('0x45')]['id'];}return db['Variable'][_0x8c54('0x44')]({'where':{'id':_0x11d92a[_0x8c54('0x42')]['id']}})[_0x8c54('0x22')](handleEntityNotFound(_0x23333c,null))[_0x8c54('0x22')](saveUpdates(_0x11d92a[_0x8c54('0x45')],null))[_0x8c54('0x22')](respondWithResult(_0x23333c,null))[_0x8c54('0x40')](handleError(_0x23333c,null));};exports[_0x8c54('0x23')]=function(_0x73737f,_0x176fd8){return db[_0x8c54('0x3b')][_0x8c54('0x44')]({'where':{'id':_0x73737f['params']['id']}})[_0x8c54('0x22')](handleEntityNotFound(_0x176fd8,null))[_0x8c54('0x22')](removeEntity(_0x176fd8,null))[_0x8c54('0x40')](handleError(_0x176fd8,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 557ebb0..0af4cf0 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 _0x591d=['lodash','util','api','moment','request-promise','path','rimraf','./variable.attributes','exports','Variable','tools_variables'];(function(_0x25c2e3,_0x4e93d1){var _0xc504f6=function(_0x285ded){while(--_0x285ded){_0x25c2e3['push'](_0x25c2e3['shift']());}};_0xc504f6(++_0x4e93d1);}(_0x591d,0x16b));var _0xd591=function(_0x6af0cf,_0x572f40){_0x6af0cf=_0x6af0cf-0x0;var _0x4e99ae=_0x591d[_0x6af0cf];return _0x4e99ae;};'use strict';var _=require(_0xd591('0x0'));var util=require(_0xd591('0x1'));var logger=require('../../config/logger')(_0xd591('0x2'));var moment=require(_0xd591('0x3'));var BPromise=require('bluebird');var rp=require(_0xd591('0x4'));var fs=require('fs');var path=require(_0xd591('0x5'));var rimraf=require(_0xd591('0x6'));var config=require('../../config/environment');var attributes=require(_0xd591('0x7'));module[_0xd591('0x8')]=function(_0x3eeee0,_0x520bd0){return _0x3eeee0['define'](_0xd591('0x9'),attributes,{'tableName':_0xd591('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81e9=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables'];(function(_0x32e4b8,_0x450750){var _0x8dc057=function(_0x4720aa){while(--_0x4720aa){_0x32e4b8['push'](_0x32e4b8['shift']());}};_0x8dc057(++_0x450750);}(_0x81e9,0xd0));var _0x981e=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x81e9[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x981e('0x0'));var util=require(_0x981e('0x1'));var logger=require(_0x981e('0x2'))('api');var moment=require(_0x981e('0x3'));var BPromise=require(_0x981e('0x4'));var rp=require(_0x981e('0x5'));var fs=require('fs');var path=require(_0x981e('0x6'));var rimraf=require('rimraf');var config=require(_0x981e('0x7'));var attributes=require(_0x981e('0x8'));module[_0x981e('0x9')]=function(_0x2a6549,_0x5ab8db){return _0x2a6549[_0x981e('0xa')](_0x981e('0xb'),attributes,{'tableName':_0x981e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 1d0f623..c359ff2 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowVariable','Variable','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x57a489,_0x189abc){var _0x1988a7=function(_0x2e9e03){while(--_0x2e9e03){_0x57a489['push'](_0x57a489['shift']());}};_0x1988a7(++_0x189abc);}(_0xe14b,0x93));var _0xbe14=function(_0x3ceb60,_0x3d61f2){_0x3ceb60=_0x3ceb60-0x0;var _0x447e41=_0xe14b[_0x3ceb60];return _0x447e41;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file +var _0x9957=['stringify','error','code','message','result','catch','ShowVariable','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x23a770,_0x2228e4){var _0x43cd3f=function(_0x41cd3e){while(--_0x41cd3e){_0x23a770['push'](_0x23a770['shift']());}};_0x43cd3f(++_0x2228e4);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Variable,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Variable'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowVariable',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 1876408..b0273c4 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 _0xd968=['express','../../components/auth/service','./version.controller','get','canUpdate','fetch','/reset','isAuthenticated','reset','/pull','/restart','restart','/migrations','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd968,0x1b2));var _0x8d96=function(_0x231a02,_0x2a9e36){_0x231a02=_0x231a02-0x0;var _0x3ae533=_0xd968[_0x231a02];return _0x3ae533;};'use strict';var express=require(_0x8d96('0x0'));var router=express['Router']();var auth=require(_0x8d96('0x1'));var controller=require(_0x8d96('0x2'));router[_0x8d96('0x3')]('/',controller['index']);router[_0x8d96('0x3')]('/fetch',auth['isAuthenticated'](),auth[_0x8d96('0x4')](),controller[_0x8d96('0x5')]);router['get'](_0x8d96('0x6'),auth[_0x8d96('0x7')](),auth[_0x8d96('0x4')](),controller[_0x8d96('0x8')]);router[_0x8d96('0x3')](_0x8d96('0x9'),auth[_0x8d96('0x7')](),auth['canUpdate'](),controller['pull']);router[_0x8d96('0x3')](_0x8d96('0xa'),auth['isAuthenticated'](),controller[_0x8d96('0xb')]);router[_0x8d96('0x3')](_0x8d96('0xc'),controller['migrations']);module[_0x8d96('0xd')]=router; \ No newline at end of file +var _0x61d1=['Router','../../components/auth/service','get','index','/fetch','fetch','/reset','/pull','canUpdate','pull','/restart','isAuthenticated','migrations','exports'];(function(_0x4dcb77,_0x2a15d1){var _0x24f17e=function(_0x357a67){while(--_0x357a67){_0x4dcb77['push'](_0x4dcb77['shift']());}};_0x24f17e(++_0x2a15d1);}(_0x61d1,0x8c));var _0x161d=function(_0x5df036,_0x5064d7){_0x5df036=_0x5df036-0x0;var _0x433c8d=_0x61d1[_0x5df036];return _0x433c8d;};'use strict';var express=require('express');var router=express[_0x161d('0x0')]();var auth=require(_0x161d('0x1'));var controller=require('./version.controller');router[_0x161d('0x2')]('/',controller[_0x161d('0x3')]);router[_0x161d('0x2')](_0x161d('0x4'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x161d('0x5')]);router[_0x161d('0x2')](_0x161d('0x6'),auth['isAuthenticated'](),auth['canUpdate'](),controller['reset']);router['get'](_0x161d('0x7'),auth['isAuthenticated'](),auth[_0x161d('0x8')](),controller[_0x161d('0x9')]);router[_0x161d('0x2')](_0x161d('0xa'),auth[_0x161d('0xb')](),controller['restart']);router[_0x161d('0x2')]('/migrations',controller[_0x161d('0xc')]);module[_0x161d('0xd')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 210f3f5..dcbdcc2 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 _0x0300=['join','server','replace','.js','length','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','version','compare-versions','exec','../../mysqldb','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','latest','2.0.0','status','json','error','git\x20fetch','reset','--hard','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync'];(function(_0x57b30a,_0x8f1ffc){var _0x337ab2=function(_0x81d79){while(--_0x81d79){_0x57b30a['push'](_0x57b30a['shift']());}};_0x337ab2(++_0x8f1ffc);}(_0x0300,0x161));var _0x0030=function(_0x9cf9ba,_0x235c1c){_0x9cf9ba=_0x9cf9ba-0x0;var _0x14cec1=_0x0300[_0x9cf9ba];return _0x14cec1;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,_0x0030('0x0'));var compareVersions=require(_0x0030('0x1'));var exec=require('child_process')[_0x0030('0x2')];var db=require(_0x0030('0x3'))['db'];var config=require('../../config/environment');var pm2=require(_0x0030('0x4'));var logger=require(_0x0030('0x5'))(_0x0030('0x6'));var git=require(_0x0030('0x7'))(config[_0x0030('0x8')]);exports[_0x0030('0x9')]=function(_0x274b53,_0x5098ca){var _0xd0f612={'current':module[_0x0030('0xa')]['version'],'phonebar':0x2};if(_0x274b53['query']&&_0x274b53['query'][_0x0030('0xb')]){return git['fetch']()['tags'](function(_0x5c112c,_0xc2b213){_0xd0f612['latest']=(_0x5c112c?module[_0x0030('0xa')]['version']:_0xc2b213[_0x0030('0xb')])||_0x0030('0xc');return _0x5098ca[_0x0030('0xd')](0xc8)[_0x0030('0xe')](_0xd0f612);});}else{return _0x5098ca['status'](0xc8)[_0x0030('0xe')](_0xd0f612);}};exports['fetch']=function(_0x5a693a,_0x1e06d5){return git['fetch'](['origin','master'],function(_0x282121){if(_0x282121){logger[_0x0030('0xf')](_0x282121);return _0x1e06d5['status'](0x1f4)[_0x0030('0xe')](_0x282121);}logger['info'](_0x0030('0x10'));return _0x1e06d5[_0x0030('0xd')](0xc8)[_0x0030('0xe')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x0030('0x11')]=function(_0x198b5e,_0x4b09a9){return git['reset']([_0x0030('0x12'),'FETCH_HEAD'],function(_0x2abe92){if(_0x2abe92){logger[_0x0030('0xf')](_0x2abe92);return _0x4b09a9[_0x0030('0xd')](0x1f4)[_0x0030('0xe')](_0x2abe92);}logger[_0x0030('0x13')](_0x0030('0x14'));return _0x4b09a9[_0x0030('0xd')](0xc8)[_0x0030('0xe')]({'output':_0x0030('0x15')});});};exports[_0x0030('0x16')]=function(_0x2adcd6,_0x1fc976){exec(_0x0030('0x17'),function(_0x4ea879,_0x4892c1,_0x5abb1c){logger['info'](_0x4892c1);logger['info'](_0x5abb1c);if(_0x4ea879){logger[_0x0030('0xf')](_0x4ea879);return _0x1fc976[_0x0030('0xd')](0x1f4)[_0x0030('0xe')](_0x4ea879);}return _0x1fc976[_0x0030('0xd')](0xc8)[_0x0030('0xe')]({'output':_0x4892c1});});};exports[_0x0030('0x18')]=function(_0x3cccf7,_0x255361){return pm2['restart'](_0x0030('0x19'))['then'](function(_0x204cfe){logger[_0x0030('0x13')](_0x0030('0x1a'),_0x204cfe);return _0x255361[_0x0030('0xd')](0xc8)['json']({'output':_0x0030('0x1b')});})[_0x0030('0x1c')](function(_0x2acc31){logger['error'](_0x2acc31);return _0x255361[_0x0030('0xd')](0x1f4)[_0x0030('0xe')](_0x2acc31);});};exports[_0x0030('0x1d')]=function(_0x21548b,_0x18ce2b){var _0x5835b9=fs[_0x0030('0x1e')](path[_0x0030('0x1f')](config[_0x0030('0x8')],_0x0030('0x20'),_0x0030('0x1d')));var _0x4a54a9=[];for(var _0x511d19=0x0;_0x511d19<_0x5835b9['length'];_0x511d19++){var _0x3bcf7f=_0x5835b9[_0x511d19][_0x0030('0x21')](_0x0030('0x22'),'');if(compareVersions(module[_0x0030('0xa')][_0x0030('0x0')],_0x3bcf7f)===-0x1){_0x4a54a9['push'](_0x3bcf7f);}}if(_0x4a54a9[_0x0030('0x23')]){var _0x277faf=_0x4a54a9[_0x0030('0x24')](compareVersions);var _0x45c3fc=new Umzug({'storage':_0x0030('0x25'),'storageOptions':{'model':db['Migration'],'modelName':_0x0030('0x26'),'columnName':_0x0030('0x0')},'migrations':{'params':[db[_0x0030('0x25')][_0x0030('0x27')](),db[_0x0030('0x25')][_0x0030('0x28')],function(){throw new Error(_0x0030('0x29'));}],'path':path['join'](config['root'],_0x0030('0x20'),_0x0030('0x1d')),'pattern':/\.js$/}});_0x45c3fc['up']({'migrations':_[_0x0030('0x2a')](_0x277faf,function(_0xdf25f){return _0xdf25f+_0x0030('0x22');})})[_0x0030('0x2b')](function(){return _0x18ce2b['status'](0xc8)[_0x0030('0xe')]({'output':_0x0030('0x2c')+module[_0x0030('0xa')][_0x0030('0x0')]+'\x20to\x20'+_[_0x0030('0x2d')](_0x277faf),'migrations':_[_0x0030('0x1f')](_0x277faf)});})[_0x0030('0x1c')](function(_0x5262c9){if(_0x5262c9 instanceof db[_0x0030('0x25')][_0x0030('0x2e')]){return _0x18ce2b[_0x0030('0xd')](0xc8)[_0x0030('0xe')]({'output':_0x0030('0x2f')});}else{return _0x18ce2b['status'](0x1f4)['json'](_0x5262c9);}});}else{return _0x18ce2b['status'](0xc8)[_0x0030('0xe')]({'output':_0x0030('0x2f')});}}; \ No newline at end of file +var _0xffe1=['umzug','lodash','pkginfo','compare-versions','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','simple-git','root','query','latest','exports','2.0.0','status','json','fetch','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','length','replace','.js','version','push','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','server','map','then','\x20to\x20','last','UniqueConstraintError'];(function(_0x2d120e,_0x3ce8bf){var _0x49c7e7=function(_0xe23153){while(--_0xe23153){_0x2d120e['push'](_0x2d120e['shift']());}};_0x49c7e7(++_0x3ce8bf);}(_0xffe1,0x1a0));var _0x1ffe=function(_0x458595,_0x37c456){_0x458595=_0x458595-0x0;var _0x5edd95=_0xffe1[_0x458595];return _0x5edd95;};'use strict';var Umzug=require(_0x1ffe('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x1ffe('0x1'));var pkginfo=require(_0x1ffe('0x2'))(module,'version');var compareVersions=require(_0x1ffe('0x3'));var exec=require('child_process')['exec'];var db=require(_0x1ffe('0x4'))['db'];var config=require(_0x1ffe('0x5'));var pm2=require(_0x1ffe('0x6'));var logger=require(_0x1ffe('0x7'))('update');var git=require(_0x1ffe('0x8'))(config[_0x1ffe('0x9')]);exports['index']=function(_0x33237b,_0x2cd547){var _0x2c149f={'current':module['exports']['version'],'phonebar':0x2};if(_0x33237b[_0x1ffe('0xa')]&&_0x33237b[_0x1ffe('0xa')]['latest']){return git['fetch']()['tags'](function(_0x503bb7,_0xc752a6){_0x2c149f[_0x1ffe('0xb')]=(_0x503bb7?module[_0x1ffe('0xc')]['version']:_0xc752a6['latest'])||_0x1ffe('0xd');return _0x2cd547[_0x1ffe('0xe')](0xc8)['json'](_0x2c149f);});}else{return _0x2cd547[_0x1ffe('0xe')](0xc8)[_0x1ffe('0xf')](_0x2c149f);}};exports[_0x1ffe('0x10')]=function(_0x5d4ffb,_0x3f4ec4){return git[_0x1ffe('0x10')]([_0x1ffe('0x11'),_0x1ffe('0x12')],function(_0x9cc0fc){if(_0x9cc0fc){logger[_0x1ffe('0x13')](_0x9cc0fc);return _0x3f4ec4[_0x1ffe('0xe')](0x1f4)['json'](_0x9cc0fc);}logger[_0x1ffe('0x14')](_0x1ffe('0x15'));return _0x3f4ec4['status'](0xc8)['json']({'output':_0x1ffe('0x16')});});};exports[_0x1ffe('0x17')]=function(_0x25715b,_0x4962f9){return git[_0x1ffe('0x17')]([_0x1ffe('0x18'),_0x1ffe('0x19')],function(_0x3f481e){if(_0x3f481e){logger[_0x1ffe('0x13')](_0x3f481e);return _0x4962f9[_0x1ffe('0xe')](0x1f4)[_0x1ffe('0xf')](_0x3f481e);}logger[_0x1ffe('0x14')](_0x1ffe('0x1a'));return _0x4962f9[_0x1ffe('0xe')](0xc8)[_0x1ffe('0xf')]({'output':_0x1ffe('0x1b')});});};exports['pull']=function(_0x32d3ab,_0x52770e){exec(_0x1ffe('0x1c'),function(_0x44cf2d,_0x427581,_0xb4cd17){logger[_0x1ffe('0x14')](_0x427581);logger['info'](_0xb4cd17);if(_0x44cf2d){logger[_0x1ffe('0x13')](_0x44cf2d);return _0x52770e[_0x1ffe('0xe')](0x1f4)[_0x1ffe('0xf')](_0x44cf2d);}return _0x52770e[_0x1ffe('0xe')](0xc8)['json']({'output':_0x427581});});};exports[_0x1ffe('0x1d')]=function(_0x3a6203,_0xbc45a6){return pm2[_0x1ffe('0x1d')](_0x1ffe('0x1e'))['then'](function(_0x5b4dbb){logger['info'](_0x1ffe('0x1f'),_0x5b4dbb);return _0xbc45a6[_0x1ffe('0xe')](0xc8)[_0x1ffe('0xf')]({'output':_0x1ffe('0x20')});})[_0x1ffe('0x21')](function(_0x2fb942){logger['error'](_0x2fb942);return _0xbc45a6['status'](0x1f4)[_0x1ffe('0xf')](_0x2fb942);});};exports[_0x1ffe('0x22')]=function(_0x42a13e,_0x25b21c){var _0x270f57=fs[_0x1ffe('0x23')](path['join'](config[_0x1ffe('0x9')],'server','migrations'));var _0x148109=[];for(var _0x3ea83c=0x0;_0x3ea83c<_0x270f57[_0x1ffe('0x24')];_0x3ea83c++){var _0x3bea29=_0x270f57[_0x3ea83c][_0x1ffe('0x25')](_0x1ffe('0x26'),'');if(compareVersions(module[_0x1ffe('0xc')][_0x1ffe('0x27')],_0x3bea29)===-0x1){_0x148109[_0x1ffe('0x28')](_0x3bea29);}}if(_0x148109['length']){var _0x4d2277=_0x148109['sort'](compareVersions);var _0x54399e=new Umzug({'storage':_0x1ffe('0x29'),'storageOptions':{'model':db[_0x1ffe('0x2a')],'modelName':'Migration','columnName':_0x1ffe('0x27')},'migrations':{'params':[db[_0x1ffe('0x29')][_0x1ffe('0x2b')](),db['sequelize']['constructor'],function(){throw new Error(_0x1ffe('0x2c'));}],'path':path[_0x1ffe('0x2d')](config[_0x1ffe('0x9')],_0x1ffe('0x2e'),'migrations'),'pattern':/\.js$/}});_0x54399e['up']({'migrations':_[_0x1ffe('0x2f')](_0x4d2277,function(_0x529ce2){return _0x529ce2+_0x1ffe('0x26');})})[_0x1ffe('0x30')](function(){return _0x25b21c[_0x1ffe('0xe')](0xc8)[_0x1ffe('0xf')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0x1ffe('0x27')]+_0x1ffe('0x31')+_[_0x1ffe('0x32')](_0x4d2277),'migrations':_[_0x1ffe('0x2d')](_0x4d2277)});})['catch'](function(_0x4e5709){if(_0x4e5709 instanceof db[_0x1ffe('0x29')][_0x1ffe('0x33')]){return _0x25b21c[_0x1ffe('0xe')](0xc8)[_0x1ffe('0xf')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x25b21c['status'](0x1f4)[_0x1ffe('0xf')](_0x4e5709);}});}else{return _0x25b21c[_0x1ffe('0xe')](0xc8)[_0x1ffe('0xf')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 2e4b697..0727955 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 _0x23c1=['./voiceAgentReport.controller','get','isAuthenticated','index','describe','/:id','show','post','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x579802,_0x1cf14a){var _0x3efeb8=function(_0xd388f3){while(--_0xd388f3){_0x579802['push'](_0x579802['shift']());}};_0x3efeb8(++_0x1cf14a);}(_0x23c1,0x19a));var _0x123c=function(_0x5a5b60,_0x548df6){_0x5a5b60=_0x5a5b60-0x0;var _0x5cbaac=_0x23c1[_0x5a5b60];return _0x5cbaac;};'use strict';var multer=require(_0x123c('0x0'));var util=require(_0x123c('0x1'));var path=require(_0x123c('0x2'));var timeout=require(_0x123c('0x3'));var express=require(_0x123c('0x4'));var router=express[_0x123c('0x5')]();var fs_extra=require(_0x123c('0x6'));var auth=require(_0x123c('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x123c('0x8'));router[_0x123c('0x9')]('/',auth[_0x123c('0xa')](),controller[_0x123c('0xb')]);router[_0x123c('0x9')]('/describe',auth[_0x123c('0xa')](),controller[_0x123c('0xc')]);router['get'](_0x123c('0xd'),auth[_0x123c('0xa')](),controller[_0x123c('0xe')]);router[_0x123c('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x123c('0x10')]('/:id',auth[_0x123c('0xa')](),controller[_0x123c('0x11')]);router[_0x123c('0x12')](_0x123c('0xd'),auth[_0x123c('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd12a=['/describe','describe','/:id','show','post','create','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index'];(function(_0x5e6bec,_0x1eb54d){var _0x5dc5cf=function(_0x59429a){while(--_0x59429a){_0x5e6bec['push'](_0x5e6bec['shift']());}};_0x5dc5cf(++_0x1eb54d);}(_0xd12a,0xaa));var _0xad12=function(_0x15bf58,_0x170ea4){_0x15bf58=_0x15bf58-0x0;var _0x5d6c96=_0xd12a[_0x15bf58];return _0x5d6c96;};'use strict';var multer=require('multer');var util=require(_0xad12('0x0'));var path=require('path');var timeout=require(_0xad12('0x1'));var express=require('express');var router=express[_0xad12('0x2')]();var fs_extra=require(_0xad12('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xad12('0x4'));var config=require(_0xad12('0x5'));var controller=require(_0xad12('0x6'));router[_0xad12('0x7')]('/',auth[_0xad12('0x8')](),controller[_0xad12('0x9')]);router[_0xad12('0x7')](_0xad12('0xa'),auth[_0xad12('0x8')](),controller[_0xad12('0xb')]);router[_0xad12('0x7')](_0xad12('0xc'),auth['isAuthenticated'](),controller[_0xad12('0xd')]);router[_0xad12('0xe')]('/',auth['isAuthenticated'](),controller[_0xad12('0xf')]);router['put'](_0xad12('0xc'),auth[_0xad12('0x8')](),controller['update']);router['delete'](_0xad12('0xc'),auth[_0xad12('0x8')](),controller[_0xad12('0x10')]);module[_0xad12('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 6148416..9594f51 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 _0x1399=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x18cca1,_0x190962){var _0x3261c7=function(_0x1e2bf3){while(--_0x1e2bf3){_0x18cca1['push'](_0x18cca1['shift']());}};_0x3261c7(++_0x190962);}(_0x1399,0x16c));var _0x9139=function(_0x151e0b,_0x3bec86){_0x151e0b=_0x151e0b-0x0;var _0x5d4a5c=_0x1399[_0x151e0b];return _0x5d4a5c;};'use strict';var Sequelize=require(_0x9139('0x0'));module[_0x9139('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x9139('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9139('0x2')]},'queue':{'type':Sequelize[_0x9139('0x2')]},'interface':{'type':Sequelize[_0x9139('0x2')]},'membername':{'type':Sequelize[_0x9139('0x2')]},'agentcalledAt':{'type':Sequelize[_0x9139('0x3')]},'agentconnectAt':{'type':Sequelize[_0x9139('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x9139('0x3')]},'holdtime':{'type':Sequelize[_0x9139('0x4')]},'agentcomplete':{'type':Sequelize[_0x9139('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x9139('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x9139('0x4')]},'reason':{'type':Sequelize[_0x9139('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x9139('0x2')]},'channelstate':{'type':Sequelize[_0x9139('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x9139('0x2')]},'language':{'type':Sequelize[_0x9139('0x2')]},'accountcode':{'type':Sequelize[_0x9139('0x2')]},'context':{'type':Sequelize[_0x9139('0x2')]},'exten':{'type':Sequelize[_0x9139('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x9139('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x9139('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x9139('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x9139('0x2')]},'destlanguage':{'type':Sequelize[_0x9139('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x9139('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x9139('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x9139('0x2')]},'transfer':{'type':Sequelize[_0x9139('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x9139('0x2')],'comment':_0x9139('0x6')},'transferexten':{'type':Sequelize[_0x9139('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x065e=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE'];(function(_0x41886e,_0x2f9b3e){var _0x10e7f4=function(_0x267c43){while(--_0x267c43){_0x41886e['push'](_0x41886e['shift']());}};_0x10e7f4(++_0x2f9b3e);}(_0x065e,0x1a7));var _0xe065=function(_0x48def0,_0x2a17c4){_0x48def0=_0x48def0-0x0;var _0x3a896c=_0x065e[_0x48def0];return _0x3a896c;};'use strict';var Sequelize=require(_0xe065('0x0'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe065('0x1')]},'calleridname':{'type':Sequelize[_0xe065('0x1')]},'queue':{'type':Sequelize[_0xe065('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xe065('0x2')]},'agentconnectAt':{'type':Sequelize[_0xe065('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xe065('0x2')]},'agentdumpAt':{'type':Sequelize[_0xe065('0x2')]},'holdtime':{'type':Sequelize[_0xe065('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xe065('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xe065('0x3')]},'agentacw':{'type':Sequelize[_0xe065('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe065('0x3')]},'reason':{'type':Sequelize[_0xe065('0x1')]},'lastevent':{'type':Sequelize[_0xe065('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xe065('0x3')]},'channelstatedesc':{'type':Sequelize[_0xe065('0x1')]},'connectedlinenum':{'type':Sequelize[_0xe065('0x1')]},'connectedlinename':{'type':Sequelize[_0xe065('0x1')]},'language':{'type':Sequelize[_0xe065('0x1')]},'accountcode':{'type':Sequelize[_0xe065('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xe065('0x1')]},'destchannel':{'type':Sequelize[_0xe065('0x1')]},'destchannelstate':{'type':Sequelize[_0xe065('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xe065('0x1')]},'destcalleridname':{'type':Sequelize[_0xe065('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xe065('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xe065('0x1')]},'destlanguage':{'type':Sequelize[_0xe065('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xe065('0x1')]},'destexten':{'type':Sequelize[_0xe065('0x1')]},'destpriority':{'type':Sequelize[_0xe065('0x1')]},'destuniqueid':{'type':Sequelize[_0xe065('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xe065('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xe065('0x1')]},'transfer':{'type':Sequelize[_0xe065('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xe065('0x5')},'transferexten':{'type':Sequelize[_0xe065('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xe065('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 13a7be1..283273c 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(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index d7fb6cb..590ca31 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 _0xae1c=['VoiceAgentReport','report_agent','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define'];(function(_0x37425b,_0x3b8678){var _0x10fa19=function(_0x19e6a5){while(--_0x19e6a5){_0x37425b['push'](_0x37425b['shift']());}};_0x10fa19(++_0x3b8678);}(_0xae1c,0xff));var _0xcae1=function(_0x5e9a7e,_0x1175c2){_0x5e9a7e=_0x5e9a7e-0x0;var _0x59bb96=_0xae1c[_0x5e9a7e];return _0x59bb96;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xcae1('0x0'));var BPromise=require(_0xcae1('0x1'));var rp=require(_0xcae1('0x2'));var fs=require('fs');var path=require(_0xcae1('0x3'));var rimraf=require(_0xcae1('0x4'));var config=require(_0xcae1('0x5'));var attributes=require(_0xcae1('0x6'));module[_0xcae1('0x7')]=function(_0x3513e5,_0x40fcec){return _0x3513e5[_0xcae1('0x8')](_0xcae1('0x9'),attributes,{'tableName':_0xcae1('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xdc59=['./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x24edef,_0x3012f1){var _0xb87be8=function(_0x58f38f){while(--_0x58f38f){_0x24edef['push'](_0x24edef['shift']());}};_0xb87be8(++_0x3012f1);}(_0xdc59,0x12c));var _0x9dc5=function(_0x14fad0,_0x278d75){_0x14fad0=_0x14fad0-0x0;var _0x5c665f=_0xdc59[_0x14fad0];return _0x5c665f;};'use strict';var _=require(_0x9dc5('0x0'));var util=require(_0x9dc5('0x1'));var logger=require(_0x9dc5('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9dc5('0x3'));var rp=require(_0x9dc5('0x4'));var fs=require('fs');var path=require(_0x9dc5('0x5'));var rimraf=require(_0x9dc5('0x6'));var config=require(_0x9dc5('0x7'));var attributes=require(_0x9dc5('0x8'));module[_0x9dc5('0x9')]=function(_0xf17598,_0x13e31c){return _0xf17598['define'](_0x9dc5('0xa'),attributes,{'tableName':_0x9dc5('0xb'),'paranoid':![],'indexes':[{'fields':[_0x9dc5('0xc'),_0x9dc5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 80bddc6..f5a33b6 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 _0xc18b=['client','request','info','VoiceAgentReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','CreateVoiceAgentReport','create','options','raw','then','UpdateVoiceAgentReport','VoiceAgentReport','update','body','where','attributes','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4ddc7a,_0x5b6cb8){var _0x4547c1=function(_0x3739e7){while(--_0x3739e7){_0x4ddc7a['push'](_0x4ddc7a['shift']());}};_0x4547c1(++_0x5b6cb8);}(_0xc18b,0x16b));var _0xbc18=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xc18b[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require(_0xbc18('0x0'));var util=require(_0xbc18('0x1'));var moment=require(_0xbc18('0x2'));var BPromise=require('bluebird');var rs=require(_0xbc18('0x3'));var fs=require('fs');var Redis=require(_0xbc18('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbc18('0x5'));var logger=require(_0xbc18('0x6'))(_0xbc18('0x7'));var config=require(_0xbc18('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbc18('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x254f34,_0x200b70,_0x36b980){return new BPromise(function(_0x5b595e,_0x2ea1d0){return client[_0xbc18('0xa')](_0x254f34,_0x36b980)['then'](function(_0x208c75){logger[_0xbc18('0xb')](_0xbc18('0xc'),_0x200b70,'request\x20sent');logger[_0xbc18('0xd')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x200b70,'request\x20sent',JSON[_0xbc18('0xe')](_0x208c75));if(_0x208c75[_0xbc18('0xf')]){if(_0x208c75[_0xbc18('0xf')][_0xbc18('0x10')]===0x1f4){logger[_0xbc18('0xf')](_0xbc18('0xc'),_0x200b70,_0x208c75['error']['message']);return _0x2ea1d0(_0x208c75[_0xbc18('0xf')][_0xbc18('0x11')]);}logger[_0xbc18('0xf')](_0xbc18('0xc'),_0x200b70,_0x208c75['error']['message']);return _0x5b595e(_0x208c75[_0xbc18('0xf')][_0xbc18('0x11')]);}else{logger[_0xbc18('0xb')]('VoiceAgentReport,\x20%s,\x20%s',_0x200b70,_0xbc18('0x12'));_0x5b595e(_0x208c75['result'][_0xbc18('0x11')]);}})[_0xbc18('0x13')](function(_0x57ec41){logger[_0xbc18('0xf')](_0xbc18('0xc'),_0x200b70,_0x57ec41);_0x2ea1d0(_0x57ec41);});});}exports[_0xbc18('0x14')]=function(_0x4cf31e){var _0x5415aa=this;return new Promise(function(_0xda54ce,_0x18b2b3){return db['VoiceAgentReport'][_0xbc18('0x15')](_0x4cf31e['body'],{'raw':_0x4cf31e[_0xbc18('0x16')]?_0x4cf31e[_0xbc18('0x16')][_0xbc18('0x17')]===undefined?!![]:![]:!![]})[_0xbc18('0x18')](function(_0x4f6940){logger[_0xbc18('0xb')](_0xbc18('0x14'),_0x4cf31e);logger['debug']('CreateVoiceAgentReport',_0x4cf31e,JSON[_0xbc18('0xe')](_0x4f6940));_0xda54ce(_0x4f6940);})[_0xbc18('0x13')](function(_0x36b2c2){logger[_0xbc18('0xf')]('CreateVoiceAgentReport',_0x36b2c2['message'],_0x4cf31e);_0x18b2b3(_0x5415aa[_0xbc18('0xf')](0x1f4,_0x36b2c2[_0xbc18('0x11')]));});});};exports[_0xbc18('0x19')]=function(_0x2c33ae){var _0xce5eea=this;return new Promise(function(_0x5ad23c,_0x5f0536){return db[_0xbc18('0x1a')][_0xbc18('0x1b')](_0x2c33ae[_0xbc18('0x1c')],{'raw':_0x2c33ae['options']?_0x2c33ae['options'][_0xbc18('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c33ae[_0xbc18('0x16')]?_0x2c33ae[_0xbc18('0x16')][_0xbc18('0x1d')]||null:null,'attributes':_0x2c33ae[_0xbc18('0x16')]?_0x2c33ae[_0xbc18('0x16')][_0xbc18('0x1e')]||null:null,'limit':_0x2c33ae[_0xbc18('0x16')]?_0x2c33ae['options']['limit']||null:null})[_0xbc18('0x18')](function(_0x395204){logger[_0xbc18('0xb')](_0xbc18('0x19'),_0x2c33ae);logger[_0xbc18('0xd')](_0xbc18('0x19'),_0x2c33ae,JSON[_0xbc18('0xe')](_0x395204));_0x5ad23c(_0x395204);})['catch'](function(_0xc5a0b4){logger[_0xbc18('0xf')](_0xbc18('0x19'),_0xc5a0b4[_0xbc18('0x11')],_0x2c33ae);_0x5f0536(_0xce5eea['error'](0x1f4,_0xc5a0b4[_0xbc18('0x11')]));});});}; \ No newline at end of file +var _0xd2c3=['CreateVoiceAgentReport','update','where','attributes','limit','UpdateVoiceAgentReport','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','VoiceAgentReport,\x20%s,\x20%s','catch','VoiceAgentReport','body','options','raw'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd2c3,0x1e6));var _0x3d2c=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xd2c3[_0x342baa];return _0x1208f3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3d2c('0x0'));var BPromise=require(_0x3d2c('0x1'));var rs=require(_0x3d2c('0x2'));var fs=require('fs');var Redis=require(_0x3d2c('0x3'));var db=require(_0x3d2c('0x4'))['db'];var utils=require(_0x3d2c('0x5'));var logger=require(_0x3d2c('0x6'))(_0x3d2c('0x7'));var config=require(_0x3d2c('0x8'));var jayson=require(_0x3d2c('0x9'));var client=jayson['client'][_0x3d2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fa5b5,_0x1b3558,_0x8eb5ff){return new BPromise(function(_0x42043b,_0x7782cd){return client[_0x3d2c('0xb')](_0x4fa5b5,_0x8eb5ff)[_0x3d2c('0xc')](function(_0x2b5550){logger[_0x3d2c('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x1b3558,'request\x20sent');logger[_0x3d2c('0xe')](_0x3d2c('0xf'),_0x1b3558,_0x3d2c('0x10'),JSON[_0x3d2c('0x11')](_0x2b5550));if(_0x2b5550[_0x3d2c('0x12')]){if(_0x2b5550[_0x3d2c('0x12')]['code']===0x1f4){logger[_0x3d2c('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x1b3558,_0x2b5550['error'][_0x3d2c('0x13')]);return _0x7782cd(_0x2b5550['error']['message']);}logger[_0x3d2c('0x12')](_0x3d2c('0x14'),_0x1b3558,_0x2b5550[_0x3d2c('0x12')][_0x3d2c('0x13')]);return _0x42043b(_0x2b5550['error'][_0x3d2c('0x13')]);}else{logger['info'](_0x3d2c('0x14'),_0x1b3558,_0x3d2c('0x10'));_0x42043b(_0x2b5550['result'][_0x3d2c('0x13')]);}})[_0x3d2c('0x15')](function(_0x18f446){logger[_0x3d2c('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x1b3558,_0x18f446);_0x7782cd(_0x18f446);});});}exports['CreateVoiceAgentReport']=function(_0x208500){var _0x4acdf9=this;return new Promise(function(_0x17f7fc,_0x1f0eb1){return db[_0x3d2c('0x16')]['create'](_0x208500[_0x3d2c('0x17')],{'raw':_0x208500[_0x3d2c('0x18')]?_0x208500[_0x3d2c('0x18')][_0x3d2c('0x19')]===undefined?!![]:![]:!![]})[_0x3d2c('0xc')](function(_0x4cf26b){logger[_0x3d2c('0xd')](_0x3d2c('0x1a'),_0x208500);logger[_0x3d2c('0xe')](_0x3d2c('0x1a'),_0x208500,JSON[_0x3d2c('0x11')](_0x4cf26b));_0x17f7fc(_0x4cf26b);})[_0x3d2c('0x15')](function(_0x241d29){logger[_0x3d2c('0x12')](_0x3d2c('0x1a'),_0x241d29['message'],_0x208500);_0x1f0eb1(_0x4acdf9[_0x3d2c('0x12')](0x1f4,_0x241d29['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x27820c){var _0x47f4e4=this;return new Promise(function(_0x3d0204,_0x963006){return db['VoiceAgentReport'][_0x3d2c('0x1b')](_0x27820c[_0x3d2c('0x17')],{'raw':_0x27820c['options']?_0x27820c['options'][_0x3d2c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27820c[_0x3d2c('0x18')]?_0x27820c[_0x3d2c('0x18')][_0x3d2c('0x1c')]||null:null,'attributes':_0x27820c[_0x3d2c('0x18')]?_0x27820c[_0x3d2c('0x18')][_0x3d2c('0x1d')]||null:null,'limit':_0x27820c[_0x3d2c('0x18')]?_0x27820c[_0x3d2c('0x18')][_0x3d2c('0x1e')]||null:null})[_0x3d2c('0xc')](function(_0x55bd38){logger['info']('UpdateVoiceAgentReport',_0x27820c);logger[_0x3d2c('0xe')]('UpdateVoiceAgentReport',_0x27820c,JSON[_0x3d2c('0x11')](_0x55bd38));_0x3d0204(_0x55bd38);})[_0x3d2c('0x15')](function(_0x200092){logger[_0x3d2c('0x12')](_0x3d2c('0x1f'),_0x200092[_0x3d2c('0x13')],_0x27820c);_0x963006(_0x47f4e4['error'](0x1f4,_0x200092[_0x3d2c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 21d0e48..b64f668 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 _0x4bc3=['post','put','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','describe','/:id','show'];(function(_0xf63d81,_0x4816a2){var _0x40c21d=function(_0xeacdd5){while(--_0xeacdd5){_0xf63d81['push'](_0xf63d81['shift']());}};_0x40c21d(++_0x4816a2);}(_0x4bc3,0x16e));var _0x34bc=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0x4bc3[_0x176329];return _0x31997c;};'use strict';var multer=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var path=require('path');var timeout=require(_0x34bc('0x2'));var express=require(_0x34bc('0x3'));var router=express['Router']();var fs_extra=require(_0x34bc('0x4'));var auth=require(_0x34bc('0x5'));var interaction=require(_0x34bc('0x6'));var config=require(_0x34bc('0x7'));var controller=require(_0x34bc('0x8'));router[_0x34bc('0x9')]('/',auth[_0x34bc('0xa')](),controller['index']);router[_0x34bc('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x34bc('0xb')]);router[_0x34bc('0x9')](_0x34bc('0xc'),auth[_0x34bc('0xa')](),controller[_0x34bc('0xd')]);router[_0x34bc('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x34bc('0xf')](_0x34bc('0xc'),auth[_0x34bc('0xa')](),controller['update']);router[_0x34bc('0x10')]('/:id',auth[_0x34bc('0xa')](),controller[_0x34bc('0x11')]);module[_0x34bc('0x12')]=router; \ No newline at end of file +var _0x46ed=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','delete','destroy','multer'];(function(_0x3869c8,_0x2ff137){var _0x4caf60=function(_0x224384){while(--_0x224384){_0x3869c8['push'](_0x3869c8['shift']());}};_0x4caf60(++_0x2ff137);}(_0x46ed,0x168));var _0xd46e=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x46ed[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var path=require('path');var timeout=require(_0xd46e('0x2'));var express=require(_0xd46e('0x3'));var router=express[_0xd46e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd46e('0x5'));var interaction=require(_0xd46e('0x6'));var config=require('../../config/environment');var controller=require(_0xd46e('0x7'));router[_0xd46e('0x8')]('/',auth[_0xd46e('0x9')](),controller[_0xd46e('0xa')]);router[_0xd46e('0x8')](_0xd46e('0xb'),auth[_0xd46e('0x9')](),controller[_0xd46e('0xc')]);router[_0xd46e('0x8')](_0xd46e('0xd'),auth[_0xd46e('0x9')](),controller['show']);router[_0xd46e('0xe')]('/',auth[_0xd46e('0x9')](),controller['create']);router[_0xd46e('0xf')](_0xd46e('0xd'),auth[_0xd46e('0x9')](),controller[_0xd46e('0x10')]);router[_0xd46e('0x11')](_0xd46e('0xd'),auth['isAuthenticated'](),controller[_0xd46e('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 358b9c0..0f48ce0 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 _0xe9e9=['outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','internal'];(function(_0xfc34ce,_0x4d7c98){var _0x1b8863=function(_0x854516){while(--_0x854516){_0xfc34ce['push'](_0xfc34ce['shift']());}};_0x1b8863(++_0x4d7c98);}(_0xe9e9,0x1c1));var _0x9e9e=function(_0x1ca4a9,_0x443909){_0x1ca4a9=_0x1ca4a9-0x0;var _0x5e4454=_0xe9e9[_0x1ca4a9];return _0x5e4454;};'use strict';var Sequelize=require(_0x9e9e('0x0'));module[_0x9e9e('0x1')]={'uniqueid':{'type':Sequelize[_0x9e9e('0x2')]},'type':{'type':Sequelize[_0x9e9e('0x3')](_0x9e9e('0x4'),_0x9e9e('0x5'),_0x9e9e('0x6'),_0x9e9e('0x7'),_0x9e9e('0x8'),_0x9e9e('0x9'))},'tag':{'type':Sequelize[_0x9e9e('0x2')]},'accountcode':{'type':Sequelize[_0x9e9e('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x9e9e('0x2')]},'destinationcontext':{'type':Sequelize[_0x9e9e('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x9e9e('0x2')]},'destinationchannel':{'type':Sequelize[_0x9e9e('0x2')]},'lastapplication':{'type':Sequelize[_0x9e9e('0x2')]},'lastdata':{'type':Sequelize[_0x9e9e('0xa')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x9e9e('0xb')]},'answertime':{'type':Sequelize[_0x9e9e('0xb')]},'endtime':{'type':Sequelize[_0x9e9e('0xb')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x9e9e('0xc')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x9e9e('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x9e9e('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x9e9e('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x9e9e('0x2')]},'note':{'type':Sequelize[_0x9e9e('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x9e9e('0x2')]}}; \ No newline at end of file +var _0x8ee8=['internal','outbound','inbound-fax','outbound-fax','STRING','TEXT','DATE','INTEGER','sequelize','ENUM','inbound'];(function(_0x389b0d,_0x2be94b){var _0x534eae=function(_0x2409b0){while(--_0x2409b0){_0x389b0d['push'](_0x389b0d['shift']());}};_0x534eae(++_0x2be94b);}(_0x8ee8,0xe4));var _0x88ee=function(_0x208b7a,_0x2e3baa){_0x208b7a=_0x208b7a-0x0;var _0x37b7ec=_0x8ee8[_0x208b7a];return _0x37b7ec;};'use strict';var Sequelize=require(_0x88ee('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x88ee('0x1')](_0x88ee('0x2'),_0x88ee('0x3'),_0x88ee('0x4'),_0x88ee('0x5'),_0x88ee('0x6'),'dialer')},'tag':{'type':Sequelize[_0x88ee('0x7')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x88ee('0x7')]},'destination':{'type':Sequelize[_0x88ee('0x7')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x88ee('0x7')]},'channel':{'type':Sequelize[_0x88ee('0x7')]},'destinationchannel':{'type':Sequelize[_0x88ee('0x7')]},'lastapplication':{'type':Sequelize[_0x88ee('0x7')]},'lastdata':{'type':Sequelize[_0x88ee('0x8')]},'starttime':{'type':Sequelize[_0x88ee('0x9')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x88ee('0x9')]},'endtime':{'type':Sequelize[_0x88ee('0x9')]},'duration':{'type':Sequelize[_0x88ee('0xa')]},'billableseconds':{'type':Sequelize[_0x88ee('0xa')]},'mohtime':{'type':Sequelize[_0x88ee('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x88ee('0x7')]},'userfield':{'type':Sequelize[_0x88ee('0x7')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x88ee('0x7')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x88ee('0x7')]},'routeid':{'type':Sequelize[_0x88ee('0xa')]},'sipcallid':{'type':Sequelize[_0x88ee('0x7')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 50b6f88..96d77ec 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x5235a6,_0x680b76){var _0x1cf37e=function(_0x31c173){while(--_0x31c173){_0x5235a6['push'](_0x5235a6['shift']());}};_0x1cf37e(++_0x680b76);}(_0x2ef3,0xba));var _0x32ef=function(_0x200a1a,_0x581924){_0x200a1a=_0x200a1a-0x0;var _0x128f9f=_0x2ef3[_0x200a1a];return _0x128f9f;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file +var _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0x45da14,_0xcef03d){var _0x17844c=function(_0x5d0c2d){while(--_0x5d0c2d){_0x45da14['push'](_0x45da14['shift']());}};_0x17844c(++_0xcef03d);}(_0xdb28,0x106));var _0x8db2=function(_0x46def6,_0x1ab6e6){_0x46def6=_0x46def6-0x0;var _0x55afdc=_0xdb28[_0x46def6];return _0x55afdc;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 8409d17..419397b 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 _0x162e=['request-promise','path','rimraf','exports','VoiceCallReport','report_call','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x162e,0x75));var _0xe162=function(_0x5d4fc2,_0x42ef4e){_0x5d4fc2=_0x5d4fc2-0x0;var _0x5cf632=_0x162e[_0x5d4fc2];return _0x5cf632;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe162('0x0'))(_0xe162('0x1'));var moment=require(_0xe162('0x2'));var BPromise=require(_0xe162('0x3'));var rp=require(_0xe162('0x4'));var fs=require('fs');var path=require(_0xe162('0x5'));var rimraf=require(_0xe162('0x6'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0xe162('0x7')]=function(_0x5d378e,_0x506e35){return _0x5d378e['define'](_0xe162('0x8'),attributes,{'tableName':_0xe162('0x9'),'paranoid':![],'indexes':[{'fields':[_0xe162('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7c85=['exports','define','VoiceCallReport','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./voiceCallReport.attributes'];(function(_0x31ded7,_0x4dcc52){var _0x21c75e=function(_0x37ce73){while(--_0x37ce73){_0x31ded7['push'](_0x31ded7['shift']());}};_0x21c75e(++_0x4dcc52);}(_0x7c85,0x108));var _0x57c8=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x7c85[_0x55abd9];return _0x3e5669;};'use strict';var _=require(_0x57c8('0x0'));var util=require(_0x57c8('0x1'));var logger=require(_0x57c8('0x2'))('api');var moment=require(_0x57c8('0x3'));var BPromise=require(_0x57c8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x57c8('0x5'));var rimraf=require(_0x57c8('0x6'));var config=require(_0x57c8('0x7'));var attributes=require(_0x57c8('0x8'));module[_0x57c8('0x9')]=function(_0x3c3fc6,_0x55543d){return _0x3c3fc6[_0x57c8('0xa')](_0x57c8('0xb'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x57c8('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 5ff1a2f..bd892a5 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 _0x5072=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVoiceCallReport','options','raw','where','attributes','include','map','model','catch','CreateVoiceCallReport','VoiceCallReport','create','body','UpdateVoiceCallReport','update','limit','lodash','util','moment','bluebird','randomstring'];(function(_0x271144,_0x1f8516){var _0x288a40=function(_0x3c5b28){while(--_0x3c5b28){_0x271144['push'](_0x271144['shift']());}};_0x288a40(++_0x1f8516);}(_0x5072,0x151));var _0x2507=function(_0x2abfb7,_0x1f6a6b){_0x2abfb7=_0x2abfb7-0x0;var _0x3cfb4e=_0x5072[_0x2abfb7];return _0x3cfb4e;};'use strict';var _=require(_0x2507('0x0'));var util=require(_0x2507('0x1'));var moment=require(_0x2507('0x2'));var BPromise=require(_0x2507('0x3'));var rs=require(_0x2507('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2507('0x5'))(_0x2507('0x6'));var config=require('../../config/environment');var jayson=require(_0x2507('0x7'));var client=jayson[_0x2507('0x8')][_0x2507('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x502da8,_0x378f28,_0x3c45e2){return new BPromise(function(_0x4f220f,_0x54f28e){return client[_0x2507('0xa')](_0x502da8,_0x3c45e2)[_0x2507('0xb')](function(_0x22616d){logger[_0x2507('0xc')](_0x2507('0xd'),_0x378f28,'request\x20sent');logger[_0x2507('0xe')](_0x2507('0xf'),_0x378f28,_0x2507('0x10'),JSON[_0x2507('0x11')](_0x22616d));if(_0x22616d[_0x2507('0x12')]){if(_0x22616d[_0x2507('0x12')][_0x2507('0x13')]===0x1f4){logger[_0x2507('0x12')](_0x2507('0xd'),_0x378f28,_0x22616d[_0x2507('0x12')][_0x2507('0x14')]);return _0x54f28e(_0x22616d[_0x2507('0x12')][_0x2507('0x14')]);}logger[_0x2507('0x12')](_0x2507('0xd'),_0x378f28,_0x22616d[_0x2507('0x12')]['message']);return _0x4f220f(_0x22616d['error'][_0x2507('0x14')]);}else{logger[_0x2507('0xc')](_0x2507('0xd'),_0x378f28,_0x2507('0x10'));_0x4f220f(_0x22616d[_0x2507('0x15')][_0x2507('0x14')]);}})['catch'](function(_0x1776d9){logger[_0x2507('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x378f28,_0x1776d9);_0x54f28e(_0x1776d9);});});}exports[_0x2507('0x16')]=function(_0xb3a488){var _0x25e74d=this;return new Promise(function(_0x15deb2,_0x3a2e17){return db['VoiceCallReport']['findAll']({'raw':_0xb3a488[_0x2507('0x17')]?_0xb3a488[_0x2507('0x17')][_0x2507('0x18')]===undefined?!![]:![]:!![],'where':_0xb3a488['options']?_0xb3a488[_0x2507('0x17')][_0x2507('0x19')]||null:null,'attributes':_0xb3a488['options']?_0xb3a488[_0x2507('0x17')][_0x2507('0x1a')]||null:null,'limit':_0xb3a488['options']?_0xb3a488[_0x2507('0x17')]['limit']||null:null,'include':_0xb3a488[_0x2507('0x17')]?_0xb3a488[_0x2507('0x17')][_0x2507('0x1b')]?_[_0x2507('0x1c')](_0xb3a488[_0x2507('0x17')]['include'],function(_0x5f3c9f){return{'model':db[_0x5f3c9f[_0x2507('0x1d')]],'as':_0x5f3c9f['as'],'attributes':_0x5f3c9f[_0x2507('0x1a')],'include':_0x5f3c9f[_0x2507('0x1b')]?_[_0x2507('0x1c')](_0x5f3c9f[_0x2507('0x1b')],function(_0x1017f3){return{'model':db[_0x1017f3['model']],'as':_0x1017f3['as'],'attributes':_0x1017f3[_0x2507('0x1a')],'include':_0x1017f3[_0x2507('0x1b')]?_[_0x2507('0x1c')](_0x1017f3[_0x2507('0x1b')],function(_0x45d1a7){return{'model':db[_0x45d1a7['model']],'as':_0x45d1a7['as'],'attributes':_0x45d1a7[_0x2507('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2507('0xb')](function(_0x2a59ed){logger[_0x2507('0xc')](_0x2507('0x16'),_0xb3a488);logger['debug'](_0x2507('0x16'),_0xb3a488,JSON[_0x2507('0x11')](_0x2a59ed));_0x15deb2(_0x2a59ed);})[_0x2507('0x1e')](function(_0x2a5e67){logger[_0x2507('0x12')](_0x2507('0x16'),_0x2a5e67[_0x2507('0x14')],_0xb3a488);_0x3a2e17(_0x25e74d[_0x2507('0x12')](0x1f4,_0x2a5e67[_0x2507('0x14')]));});});};exports[_0x2507('0x1f')]=function(_0x2a1f7c){var _0x466ced=this;return new Promise(function(_0x1b5a18,_0x508d0e){return db[_0x2507('0x20')][_0x2507('0x21')](_0x2a1f7c[_0x2507('0x22')],{'raw':_0x2a1f7c['options']?_0x2a1f7c[_0x2507('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x2507('0xb')](function(_0x2f84a7){logger['info']('CreateVoiceCallReport',_0x2a1f7c);logger[_0x2507('0xe')](_0x2507('0x1f'),_0x2a1f7c,JSON[_0x2507('0x11')](_0x2f84a7));_0x1b5a18(_0x2f84a7);})['catch'](function(_0xa5283d){logger['error'](_0x2507('0x1f'),_0xa5283d[_0x2507('0x14')],_0x2a1f7c);_0x508d0e(_0x466ced[_0x2507('0x12')](0x1f4,_0xa5283d[_0x2507('0x14')]));});});};exports[_0x2507('0x23')]=function(_0x98b5b6){var _0x5b120e=this;return new Promise(function(_0x80e9c7,_0x429d17){return db[_0x2507('0x20')][_0x2507('0x24')](_0x98b5b6[_0x2507('0x22')],{'raw':_0x98b5b6[_0x2507('0x17')]?_0x98b5b6[_0x2507('0x17')][_0x2507('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x98b5b6[_0x2507('0x17')]?_0x98b5b6[_0x2507('0x17')]['where']||null:null,'attributes':_0x98b5b6[_0x2507('0x17')]?_0x98b5b6['options']['attributes']||null:null,'limit':_0x98b5b6[_0x2507('0x17')]?_0x98b5b6[_0x2507('0x17')][_0x2507('0x25')]||null:null})['then'](function(_0x2d591f){logger[_0x2507('0xc')](_0x2507('0x23'),_0x98b5b6);logger[_0x2507('0xe')]('UpdateVoiceCallReport',_0x98b5b6,JSON['stringify'](_0x2d591f));_0x80e9c7(_0x2d591f);})['catch'](function(_0x37c149){logger[_0x2507('0x12')](_0x2507('0x23'),_0x37c149[_0x2507('0x14')],_0x98b5b6);_0x429d17(_0x5b120e[_0x2507('0x12')](0x1f4,_0x37c149[_0x2507('0x14')]));});});}; \ No newline at end of file +var _0x9070=['map','attributes','CreateVoiceCallReport','VoiceCallReport','create','UpdateVoiceCallReport','update','body','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','http','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','GetVoiceCallReport','findAll','options','raw','where','limit','include','model'];(function(_0x342fa0,_0x308796){var _0x1f954c=function(_0x30261c){while(--_0x30261c){_0x342fa0['push'](_0x342fa0['shift']());}};_0x1f954c(++_0x308796);}(_0x9070,0x128));var _0x0907=function(_0x4492af,_0x47e25d){_0x4492af=_0x4492af-0x0;var _0x216729=_0x9070[_0x4492af];return _0x216729;};'use strict';var _=require(_0x0907('0x0'));var util=require(_0x0907('0x1'));var moment=require(_0x0907('0x2'));var BPromise=require(_0x0907('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0907('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0907('0x5'));var logger=require('../../config/logger')(_0x0907('0x6'));var config=require('../../config/environment');var jayson=require(_0x0907('0x7'));var client=jayson[_0x0907('0x8')][_0x0907('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e9259,_0x325fe7,_0x4a0c33){return new BPromise(function(_0x13ea72,_0x72518d){return client['request'](_0x2e9259,_0x4a0c33)[_0x0907('0xa')](function(_0x17b6d8){logger['info'](_0x0907('0xb'),_0x325fe7,_0x0907('0xc'));logger[_0x0907('0xd')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x325fe7,_0x0907('0xc'),JSON[_0x0907('0xe')](_0x17b6d8));if(_0x17b6d8['error']){if(_0x17b6d8[_0x0907('0xf')]['code']===0x1f4){logger[_0x0907('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x325fe7,_0x17b6d8[_0x0907('0xf')][_0x0907('0x10')]);return _0x72518d(_0x17b6d8['error'][_0x0907('0x10')]);}logger[_0x0907('0xf')](_0x0907('0xb'),_0x325fe7,_0x17b6d8[_0x0907('0xf')]['message']);return _0x13ea72(_0x17b6d8['error'][_0x0907('0x10')]);}else{logger[_0x0907('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x325fe7,_0x0907('0xc'));_0x13ea72(_0x17b6d8[_0x0907('0x12')][_0x0907('0x10')]);}})[_0x0907('0x13')](function(_0x133801){logger[_0x0907('0xf')](_0x0907('0xb'),_0x325fe7,_0x133801);_0x72518d(_0x133801);});});}exports[_0x0907('0x14')]=function(_0x673e62){var _0x4549f7=this;return new Promise(function(_0x41e6e5,_0x415449){return db['VoiceCallReport'][_0x0907('0x15')]({'raw':_0x673e62['options']?_0x673e62[_0x0907('0x16')][_0x0907('0x17')]===undefined?!![]:![]:!![],'where':_0x673e62[_0x0907('0x16')]?_0x673e62['options'][_0x0907('0x18')]||null:null,'attributes':_0x673e62['options']?_0x673e62[_0x0907('0x16')]['attributes']||null:null,'limit':_0x673e62['options']?_0x673e62[_0x0907('0x16')][_0x0907('0x19')]||null:null,'include':_0x673e62[_0x0907('0x16')]?_0x673e62[_0x0907('0x16')][_0x0907('0x1a')]?_['map'](_0x673e62[_0x0907('0x16')]['include'],function(_0x5c457d){return{'model':db[_0x5c457d[_0x0907('0x1b')]],'as':_0x5c457d['as'],'attributes':_0x5c457d['attributes'],'include':_0x5c457d[_0x0907('0x1a')]?_[_0x0907('0x1c')](_0x5c457d[_0x0907('0x1a')],function(_0xf5b39c){return{'model':db[_0xf5b39c['model']],'as':_0xf5b39c['as'],'attributes':_0xf5b39c[_0x0907('0x1d')],'include':_0xf5b39c[_0x0907('0x1a')]?_['map'](_0xf5b39c[_0x0907('0x1a')],function(_0x53d9a6){return{'model':db[_0x53d9a6[_0x0907('0x1b')]],'as':_0x53d9a6['as'],'attributes':_0x53d9a6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xe1c42){logger[_0x0907('0x11')]('GetVoiceCallReport',_0x673e62);logger[_0x0907('0xd')](_0x0907('0x14'),_0x673e62,JSON[_0x0907('0xe')](_0xe1c42));_0x41e6e5(_0xe1c42);})[_0x0907('0x13')](function(_0x2585a7){logger['error'](_0x0907('0x14'),_0x2585a7[_0x0907('0x10')],_0x673e62);_0x415449(_0x4549f7['error'](0x1f4,_0x2585a7[_0x0907('0x10')]));});});};exports[_0x0907('0x1e')]=function(_0x3914f6){var _0x3cc5a2=this;return new Promise(function(_0x2f84b2,_0x411903){return db[_0x0907('0x1f')][_0x0907('0x20')](_0x3914f6['body'],{'raw':_0x3914f6['options']?_0x3914f6[_0x0907('0x16')][_0x0907('0x17')]===undefined?!![]:![]:!![]})[_0x0907('0xa')](function(_0x1a1428){logger['info'](_0x0907('0x1e'),_0x3914f6);logger['debug'](_0x0907('0x1e'),_0x3914f6,JSON['stringify'](_0x1a1428));_0x2f84b2(_0x1a1428);})['catch'](function(_0x2e4efc){logger[_0x0907('0xf')](_0x0907('0x1e'),_0x2e4efc[_0x0907('0x10')],_0x3914f6);_0x411903(_0x3cc5a2[_0x0907('0xf')](0x1f4,_0x2e4efc[_0x0907('0x10')]));});});};exports[_0x0907('0x21')]=function(_0x594896){var _0xe0e4f4=this;return new Promise(function(_0x336986,_0x3c05d7){return db[_0x0907('0x1f')][_0x0907('0x22')](_0x594896[_0x0907('0x23')],{'raw':_0x594896[_0x0907('0x16')]?_0x594896[_0x0907('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x594896[_0x0907('0x16')]?_0x594896[_0x0907('0x16')][_0x0907('0x18')]||null:null,'attributes':_0x594896[_0x0907('0x16')]?_0x594896[_0x0907('0x16')]['attributes']||null:null,'limit':_0x594896[_0x0907('0x16')]?_0x594896['options']['limit']||null:null})[_0x0907('0xa')](function(_0x42a05a){logger[_0x0907('0x11')]('UpdateVoiceCallReport',_0x594896);logger[_0x0907('0xd')](_0x0907('0x21'),_0x594896,JSON[_0x0907('0xe')](_0x42a05a));_0x336986(_0x42a05a);})[_0x0907('0x13')](function(_0x42d6fc){logger[_0x0907('0xf')](_0x0907('0x21'),_0x42d6fc[_0x0907('0x10')],_0x594896);_0x3c05d7(_0xe0e4f4['error'](0x1f4,_0x42d6fc[_0x0907('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index e6f4dcb..4e621be 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 _0x41a8=['multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','index','/:id','isAuthenticated','show','create','update','delete','destroy'];(function(_0x4177ca,_0x432293){var _0x10ee2b=function(_0x1c1c20){while(--_0x1c1c20){_0x4177ca['push'](_0x4177ca['shift']());}};_0x10ee2b(++_0x432293);}(_0x41a8,0x176));var _0x841a=function(_0x27665c,_0x3bbac6){_0x27665c=_0x27665c-0x0;var _0x235f39=_0x41a8[_0x27665c];return _0x235f39;};'use strict';var multer=require(_0x841a('0x0'));var util=require('util');var path=require(_0x841a('0x1'));var timeout=require(_0x841a('0x2'));var express=require(_0x841a('0x3'));var router=express['Router']();var fs_extra=require(_0x841a('0x4'));var auth=require(_0x841a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x841a('0x6'));var controller=require(_0x841a('0x7'));router[_0x841a('0x8')]('/',auth['isAuthenticated'](),controller[_0x841a('0x9')]);router['get'](_0x841a('0xa'),auth[_0x841a('0xb')](),controller[_0x841a('0xc')]);router['post']('/',auth[_0x841a('0xb')](),controller[_0x841a('0xd')]);router['put'](_0x841a('0xa'),auth[_0x841a('0xb')](),controller[_0x841a('0xe')]);router[_0x841a('0xf')](_0x841a('0xa'),auth[_0x841a('0xb')](),controller[_0x841a('0x10')]);module['exports']=router; \ No newline at end of file +var _0xefa8=['put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','show','post','isAuthenticated','create'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0xefa8,0x76));var _0x8efa=function(_0x5e0baa,_0x14f1e7){_0x5e0baa=_0x5e0baa-0x0;var _0x2c8957=_0xefa8[_0x5e0baa];return _0x2c8957;};'use strict';var multer=require(_0x8efa('0x0'));var util=require(_0x8efa('0x1'));var path=require('path');var timeout=require(_0x8efa('0x2'));var express=require(_0x8efa('0x3'));var router=express[_0x8efa('0x4')]();var fs_extra=require(_0x8efa('0x5'));var auth=require(_0x8efa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8efa('0x7'));var controller=require('./voiceChanSpy.controller');router[_0x8efa('0x8')]('/',auth['isAuthenticated'](),controller[_0x8efa('0x9')]);router[_0x8efa('0x8')](_0x8efa('0xa'),auth['isAuthenticated'](),controller[_0x8efa('0xb')]);router[_0x8efa('0xc')]('/',auth[_0x8efa('0xd')](),controller[_0x8efa('0xe')]);router[_0x8efa('0xf')](_0x8efa('0xa'),auth[_0x8efa('0xd')](),controller[_0x8efa('0x10')]);router[_0x8efa('0x11')](_0x8efa('0xa'),auth[_0x8efa('0xd')](),controller['destroy']);module[_0x8efa('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 2f67d27..a505d9a 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 _0x54b4=['BOOLEAN','sequelize','exports','STRING','name','setDataValue','options','getDataValue','split'];(function(_0x17727e,_0xc002d0){var _0x303082=function(_0x198c3b){while(--_0x198c3b){_0x17727e['push'](_0x17727e['shift']());}};_0x303082(++_0xc002d0);}(_0x54b4,0x14e));var _0x454b=function(_0x5c0795,_0x751672){_0x5c0795=_0x5c0795-0x0;var _0x3711ab=_0x54b4[_0x5c0795];return _0x3711ab;};'use strict';var Sequelize=require(_0x454b('0x0'));module[_0x454b('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x454b('0x2')],'unique':_0x454b('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x454b('0x2')],'set':function(_0x79b1f){this[_0x454b('0x4')](_0x454b('0x5'),_0x79b1f?_0x79b1f['join'](''):[]);},'get':function(){return this[_0x454b('0x6')](_0x454b('0x5'))?this[_0x454b('0x6')](_0x454b('0x5'))[_0x454b('0x7')](''):[];}},'auth':{'type':Sequelize[_0x454b('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x454b('0x2')]},'record':{'type':Sequelize[_0x454b('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x454b('0x2')]}}; \ No newline at end of file +var _0x573e=['getDataValue','split','BOOLEAN','sequelize','exports','STRING','options','join'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x573e,0x193));var _0xe573=function(_0x148045,_0x592b68){_0x148045=_0x148045-0x0;var _0x277d39=_0x573e[_0x148045];return _0x277d39;};'use strict';var Sequelize=require(_0xe573('0x0'));module[_0xe573('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xe573('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xe573('0x2')],'set':function(_0x5b58a7){this['setDataValue'](_0xe573('0x3'),_0x5b58a7?_0x5b58a7[_0xe573('0x4')](''):[]);},'get':function(){return this[_0xe573('0x5')](_0xe573('0x3'))?this[_0xe573('0x5')](_0xe573('0x3'))[_0xe573('0x6')](''):[];}},'auth':{'type':Sequelize[_0xe573('0x7')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xe573('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xe573('0x2')]},'description':{'type':Sequelize[_0xe573('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index d57f0d2..fbd56df 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 _0xbee3=['set','Content-Range','apply','reject','save','update','then','destroy','get','end','error','stack','name','send','index','map','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','VoiceChanSpy','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','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'];(function(_0x4b8f9c,_0x4078b1){var _0x4b7122=function(_0x1476ac){while(--_0x1476ac){_0x4b8f9c['push'](_0x4b8f9c['shift']());}};_0x4b7122(++_0x4078b1);}(_0xbee3,0xd5));var _0x3bee=function(_0x5d868c,_0x1b2d37){_0x5d868c=_0x5d868c-0x0;var _0x5bba2f=_0xbee3[_0x5d868c];return _0x5bba2f;};'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='ChanSpies';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['VoiceChanSpy']['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='ChanSpies';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));}; \ No newline at end of file +var _0x2bbb=['json','offset','undefined','limit','count','Content-Range','reject','update','then','get','UserProfileResource','destroy','sendStatus','error','name','send','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','findAll','catch','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x132903,_0x5f451a){var _0x11211b=function(_0x3d6b76){while(--_0x3d6b76){_0x132903['push'](_0x132903['shift']());}};_0x11211b(++_0x5f451a);}(_0x2bbb,0x85));var _0xb2bb=function(_0x23fc74,_0x5c3b14){_0x23fc74=_0x23fc74-0x0;var _0x30cd9f=_0x2bbb[_0x23fc74];return _0x30cd9f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb2bb('0x0'));var zipdir=require(_0xb2bb('0x1'));var jsonpatch=require(_0xb2bb('0x2'));var rp=require('request-promise');var moment=require(_0xb2bb('0x3'));var BPromise=require(_0xb2bb('0x4'));var Mustache=require(_0xb2bb('0x5'));var util=require(_0xb2bb('0x6'));var path=require(_0xb2bb('0x7'));var sox=require(_0xb2bb('0x8'));var csv=require('to-csv');var ejs=require(_0xb2bb('0x9'));var fs=require('fs');var fs_extra=require(_0xb2bb('0xa'));var _=require('lodash');var squel=require(_0xb2bb('0xb'));var crypto=require(_0xb2bb('0xc'));var jsforce=require(_0xb2bb('0xd'));var deskjs=require(_0xb2bb('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb2bb('0xf'));var Papa=require('papaparse');var Redis=require(_0xb2bb('0x10'));var authService=require(_0xb2bb('0x11'));var qs=require(_0xb2bb('0x12'));var as=require(_0xb2bb('0x13'));var hardwareService=require(_0xb2bb('0x14'));var logger=require('../../config/logger')(_0xb2bb('0x15'));var utils=require('../../config/utils');var config=require(_0xb2bb('0x16'));var licenseUtil=require(_0xb2bb('0x17'));var db=require(_0xb2bb('0x18'))['db'];function respondWithStatusCode(_0x43950f,_0x38ea15){_0x38ea15=_0x38ea15||0xcc;return function(_0x14c05e){if(_0x14c05e){return _0x43950f['sendStatus'](_0x38ea15);}return _0x43950f[_0xb2bb('0x19')](_0x38ea15)[_0xb2bb('0x1a')]();};}function respondWithResult(_0x332903,_0x2905e2){_0x2905e2=_0x2905e2||0xc8;return function(_0x50a32e){if(_0x50a32e){return _0x332903[_0xb2bb('0x19')](_0x2905e2)[_0xb2bb('0x1b')](_0x50a32e);}};}function respondWithFilteredResult(_0x3bb017,_0x28b73c){return function(_0x367c6f){if(_0x367c6f){var _0x48d630=typeof _0x28b73c[_0xb2bb('0x1c')]===_0xb2bb('0x1d')&&typeof _0x28b73c[_0xb2bb('0x1e')]===_0xb2bb('0x1d');var _0x2dcb2d=_0x367c6f[_0xb2bb('0x1f')];var _0x35c4de=_0x48d630?0x0:_0x28b73c[_0xb2bb('0x1c')];var _0x8d2033=_0x48d630?_0x367c6f[_0xb2bb('0x1f')]:_0x28b73c[_0xb2bb('0x1c')]+_0x28b73c[_0xb2bb('0x1e')];var _0x5e8d6a;if(_0x8d2033>=_0x2dcb2d){_0x8d2033=_0x2dcb2d;_0x5e8d6a=0xc8;}else{_0x5e8d6a=0xce;}_0x3bb017[_0xb2bb('0x19')](_0x5e8d6a);return _0x3bb017['set'](_0xb2bb('0x20'),_0x35c4de+'-'+_0x8d2033+'/'+_0x2dcb2d)['json'](_0x367c6f);}return null;};}function patchUpdates(_0x3e7028){return function(_0x8f37d9){try{jsonpatch['apply'](_0x8f37d9,_0x3e7028,!![]);}catch(_0x302cd4){return BPromise[_0xb2bb('0x21')](_0x302cd4);}return _0x8f37d9['save']();};}function saveUpdates(_0x5ab483,_0x4a428f){return function(_0x2f1e0f){if(_0x2f1e0f){return _0x2f1e0f[_0xb2bb('0x22')](_0x5ab483)[_0xb2bb('0x23')](function(_0x494344){return _0x494344;});}return null;};}function removeEntity(_0x297d52,_0x2b1f94){return function(_0x250c3f){if(_0x250c3f){return _0x250c3f['destroy']()[_0xb2bb('0x23')](function(){var _0x962b0a=_0x250c3f[_0xb2bb('0x24')]({'plain':!![]});var _0x14aba5='ChanSpies';return db[_0xb2bb('0x25')][_0xb2bb('0x26')]({'where':{'type':_0x14aba5,'resourceId':_0x962b0a['id']}})[_0xb2bb('0x23')](function(){return _0x250c3f;});})['then'](function(){_0x297d52[_0xb2bb('0x19')](0xcc)[_0xb2bb('0x1a')]();});}};}function handleEntityNotFound(_0x400fff,_0x35949b){return function(_0x149ab2){if(!_0x149ab2){_0x400fff[_0xb2bb('0x27')](0x194);}return _0x149ab2;};}function handleError(_0x4a1b3d,_0x279baa){_0x279baa=_0x279baa||0x1f4;return function(_0x48d96f){logger[_0xb2bb('0x28')](_0x48d96f['stack']);if(_0x48d96f[_0xb2bb('0x29')]){delete _0x48d96f[_0xb2bb('0x29')];}_0x4a1b3d['status'](_0x279baa)[_0xb2bb('0x2a')](_0x48d96f);};}exports['index']=function(_0x232f27,_0x115202){var _0x51a013={},_0xef2655={},_0x8cbc9f={'count':0x0,'rows':[]};var _0x214649=_[_0xb2bb('0x2b')](db[_0xb2bb('0x2c')][_0xb2bb('0x2d')],function(_0x289d11){return{'name':_0x289d11[_0xb2bb('0x2e')],'type':_0x289d11[_0xb2bb('0x2f')][_0xb2bb('0x30')]};});_0xef2655[_0xb2bb('0x31')]=_['map'](_0x214649,_0xb2bb('0x29'));_0xef2655[_0xb2bb('0x32')]=_[_0xb2bb('0x33')](_0x232f27[_0xb2bb('0x32')]);_0xef2655[_0xb2bb('0x34')]=_['intersection'](_0xef2655[_0xb2bb('0x31')],_0xef2655[_0xb2bb('0x32')]);_0x51a013[_0xb2bb('0x35')]=_[_0xb2bb('0x36')](_0xef2655[_0xb2bb('0x31')],qs['fields'](_0x232f27['query'][_0xb2bb('0x37')]));_0x51a013[_0xb2bb('0x35')]=_0x51a013['attributes'][_0xb2bb('0x38')]?_0x51a013[_0xb2bb('0x35')]:_0xef2655['model'];if(!_0x232f27[_0xb2bb('0x32')]['hasOwnProperty'](_0xb2bb('0x39'))){_0x51a013[_0xb2bb('0x1e')]=qs['limit'](_0x232f27[_0xb2bb('0x32')][_0xb2bb('0x1e')]);_0x51a013[_0xb2bb('0x1c')]=qs[_0xb2bb('0x1c')](_0x232f27['query'][_0xb2bb('0x1c')]);}_0x51a013[_0xb2bb('0x3a')]=qs[_0xb2bb('0x3b')](_0x232f27[_0xb2bb('0x32')][_0xb2bb('0x3b')]);_0x51a013[_0xb2bb('0x3c')]=qs[_0xb2bb('0x34')](_[_0xb2bb('0x3d')](_0x232f27[_0xb2bb('0x32')],_0xef2655['filters']),_0x214649);if(_0x232f27[_0xb2bb('0x32')][_0xb2bb('0x3e')]){_0x51a013[_0xb2bb('0x3c')]=_[_0xb2bb('0x3f')](_0x51a013[_0xb2bb('0x3c')],{'$or':_[_0xb2bb('0x2b')](_0x214649,function(_0x397589){if(_0x397589[_0xb2bb('0x2f')]!=='VIRTUAL'){var _0x24888c={};_0x24888c[_0x397589['name']]={'$like':'%'+_0x232f27[_0xb2bb('0x32')][_0xb2bb('0x3e')]+'%'};return _0x24888c;}})});}_0x51a013=_[_0xb2bb('0x3f')]({},_0x51a013,_0x232f27[_0xb2bb('0x40')]);var _0x546945={'where':_0x51a013[_0xb2bb('0x3c')]};return db['VoiceChanSpy']['count'](_0x546945)[_0xb2bb('0x23')](function(_0x51c19b){_0x8cbc9f[_0xb2bb('0x1f')]=_0x51c19b;if(_0x232f27['query']['includeAll']){_0x51a013['include']=[{'all':!![]}];}return db[_0xb2bb('0x2c')][_0xb2bb('0x41')](_0x51a013);})[_0xb2bb('0x23')](function(_0x5dab12){_0x8cbc9f['rows']=_0x5dab12;return _0x8cbc9f;})[_0xb2bb('0x23')](respondWithFilteredResult(_0x115202,_0x51a013))[_0xb2bb('0x42')](handleError(_0x115202,null));};exports['show']=function(_0x1f808d,_0xd7b090){var _0x500918={'raw':![],'where':{'id':_0x1f808d[_0xb2bb('0x43')]['id']}},_0x44b65f={};_0x44b65f['model']=_['keys'](db[_0xb2bb('0x2c')][_0xb2bb('0x2d')]);_0x44b65f[_0xb2bb('0x32')]=_[_0xb2bb('0x33')](_0x1f808d['query']);_0x44b65f[_0xb2bb('0x34')]=_[_0xb2bb('0x36')](_0x44b65f[_0xb2bb('0x31')],_0x44b65f[_0xb2bb('0x32')]);_0x500918[_0xb2bb('0x35')]=_[_0xb2bb('0x36')](_0x44b65f['model'],qs[_0xb2bb('0x37')](_0x1f808d['query'][_0xb2bb('0x37')]));_0x500918[_0xb2bb('0x35')]=_0x500918[_0xb2bb('0x35')][_0xb2bb('0x38')]?_0x500918[_0xb2bb('0x35')]:_0x44b65f[_0xb2bb('0x31')];if(_0x1f808d[_0xb2bb('0x32')][_0xb2bb('0x44')]){_0x500918['include']=[{'all':!![]}];}_0x500918=_[_0xb2bb('0x3f')]({},_0x500918,_0x1f808d['options']);return db[_0xb2bb('0x2c')][_0xb2bb('0x45')](_0x500918)[_0xb2bb('0x23')](handleEntityNotFound(_0xd7b090,null))['then'](respondWithResult(_0xd7b090,null))[_0xb2bb('0x42')](handleError(_0xd7b090,null));};exports[_0xb2bb('0x46')]=function(_0x4a3fb2,_0x47ac7d){return db['VoiceChanSpy'][_0xb2bb('0x46')](_0x4a3fb2['body'],{})[_0xb2bb('0x23')](function(_0x2cbeb3){var _0x5f351e=_0x4a3fb2[_0xb2bb('0x47')][_0xb2bb('0x24')]({'plain':!![]});if(!_0x5f351e)throw new Error(_0xb2bb('0x48'));if(_0x5f351e[_0xb2bb('0x49')]===_0xb2bb('0x47')){var _0xb883ef=_0x2cbeb3[_0xb2bb('0x24')]({'plain':!![]});var _0x52d100=_0xb2bb('0x4a');return db[_0xb2bb('0x4b')][_0xb2bb('0x45')]({'where':{'name':_0x52d100,'userProfileId':_0x5f351e[_0xb2bb('0x4c')]},'raw':!![]})['then'](function(_0x444426){if(_0x444426&&_0x444426[_0xb2bb('0x4d')]===0x0){return db['UserProfileResource'][_0xb2bb('0x46')]({'name':_0xb883ef[_0xb2bb('0x29')],'resourceId':_0xb883ef['id'],'type':_0x444426[_0xb2bb('0x29')],'sectionId':_0x444426['id']},{})[_0xb2bb('0x23')](function(){return _0x2cbeb3;});}else{return _0x2cbeb3;}})['catch'](function(_0x38e6df){logger[_0xb2bb('0x28')](_0xb2bb('0x4e'),_0x38e6df);throw _0x38e6df;});}return _0x2cbeb3;})['then'](respondWithResult(_0x47ac7d,0xc9))[_0xb2bb('0x42')](handleError(_0x47ac7d,null));};exports[_0xb2bb('0x22')]=function(_0x48222c,_0x165cee){if(_0x48222c[_0xb2bb('0x4f')]['id']){delete _0x48222c[_0xb2bb('0x4f')]['id'];}return db[_0xb2bb('0x2c')][_0xb2bb('0x45')]({'where':{'id':_0x48222c[_0xb2bb('0x43')]['id']}})[_0xb2bb('0x23')](handleEntityNotFound(_0x165cee,null))[_0xb2bb('0x23')](saveUpdates(_0x48222c[_0xb2bb('0x4f')],null))[_0xb2bb('0x23')](respondWithResult(_0x165cee,null))['catch'](handleError(_0x165cee,null));};exports[_0xb2bb('0x26')]=function(_0x341ee3,_0x231b42){return db['VoiceChanSpy'][_0xb2bb('0x45')]({'where':{'id':_0x341ee3['params']['id']}})[_0xb2bb('0x23')](handleEntityNotFound(_0x231b42,null))['then'](removeEntity(_0x231b42,null))[_0xb2bb('0x42')](handleError(_0x231b42,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 0e4e9dd..9805ae1 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 _0x879b=['User','findAll','agent','then','catch','models','define','VoiceChanSpy','bulkCreate','VoiceExtension','destroy','lodash','util','./voiceChanSpy.attributes','context','format','%s%s','prefix','push','merge','Set','CDR(type)=%s','MixMonitor','${UNIQUEID}.%s,a','auth','password','SIP/%s,%s','name','options','record','StopMixMonitor','length','concat','internal'];(function(_0x56a908,_0x39d50e){var _0x3f9f62=function(_0x36b547){while(--_0x36b547){_0x56a908['push'](_0x56a908['shift']());}};_0x3f9f62(++_0x39d50e);}(_0x879b,0x1c5));var _0xb879=function(_0x5c8a11,_0x10805f){_0x5c8a11=_0x5c8a11-0x0;var _0x116b22=_0x879b[_0x5c8a11];return _0x116b22;};'use strict';var _=require(_0xb879('0x0'));var util=require(_0xb879('0x1'));var BPromise=require('bluebird');var attributes=require(_0xb879('0x2'));var getUserApplications=function(_0x2f573c,_0xea715d,_0x476f78){var _0x4a233d=0x1;var _0x3434ad=[];var _0x2e1272={'context':_0xea715d[_0xb879('0x3')]||'from-sip','exten':util[_0xb879('0x4')](_0xb879('0x5'),_0x2f573c[_0xb879('0x6')],_0x476f78),'type':'system','isApp':![],'ChanSpyId':_0x2f573c['id'],'UserId':_0xea715d['id']};_0x3434ad[_0xb879('0x7')](_[_0xb879('0x8')]({'app':_0xb879('0x9'),'appdata':util[_0xb879('0x4')](_0xb879('0xa'),'chanspy'),'priority':_0x4a233d++},_0x2e1272));if(_0x2f573c['record']){_0x3434ad['push'](_[_0xb879('0x8')]({'app':_0xb879('0xb'),'appdata':util[_0xb879('0x4')](_0xb879('0xc'),_0x2f573c['recordingFormat']),'priority':_0x4a233d++},_0x2e1272));}if(_0x2f573c[_0xb879('0xd')]){_0x3434ad['push'](_[_0xb879('0x8')]({'app':'Authenticate','appdata':_0x2f573c[_0xb879('0xe')],'priority':_0x4a233d++},_0x2e1272));}_0x3434ad[_0xb879('0x7')](_[_0xb879('0x8')]({'app':'ChanSpy','appdata':util[_0xb879('0x4')](_0xb879('0xf'),_0xea715d[_0xb879('0x10')],_0x2f573c[_0xb879('0x11')]?_0x2f573c[_0xb879('0x11')]['join'](''):''),'priority':_0x4a233d++},_0x2e1272));if(_0x2f573c[_0xb879('0x12')]){_0x3434ad['push'](_[_0xb879('0x8')]({'app':_0xb879('0x13'),'priority':_0x4a233d++},_0x2e1272));}return _0x3434ad;};var getChanSpyApplications=function(_0x572c9a,_0x2494c3){var _0x339b9d=[];for(var _0x331d8a=0x0,_0x3d40f2=0x1;_0x331d8a<_0x2494c3[_0xb879('0x14')];_0x331d8a++,_0x3d40f2=0x1){_0x339b9d=_0x339b9d[_0xb879('0x15')](getUserApplications(_0x572c9a,_0x2494c3[_0x331d8a],_0x2494c3[_0x331d8a][_0xb879('0x16')]));if(_0x2494c3[_0x331d8a][_0xb879('0x16')]!=_0x2494c3[_0x331d8a][_0xb879('0x10')]){_0x339b9d=_0x339b9d[_0xb879('0x15')](getUserApplications(_0x572c9a,_0x2494c3[_0x331d8a],_0x2494c3[_0x331d8a][_0xb879('0x10')]));}}return _0x339b9d;};var getChanSpyPromise=function(_0x29cfbe,_0x5d187b){return new BPromise(function(_0x233d53,_0x393c10){return _0x29cfbe[_0xb879('0x17')][_0xb879('0x18')]({'attributes':['id','name',_0xb879('0x16')],'where':{'role':_0xb879('0x19'),'chanspy':!![]},'raw':!![]})[_0xb879('0x1a')](function(_0x4a7ec9){if(_0x4a7ec9){return _0x233d53(getChanSpyApplications(_0x5d187b,_0x4a7ec9));}return _0x233d53([]);})[_0xb879('0x1b')](function(_0x23237c){_0x393c10(_0x23237c);});});};module['exports']=function(_0x3462f3,_0x348977){var _0xed09ec=_0x3462f3[_0xb879('0x1c')];return _0x3462f3[_0xb879('0x1d')](_0xb879('0x1e'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3208b3,_0x16b5e1,_0x9d034c){return getChanSpyPromise(_0xed09ec,_0x3208b3)[_0xb879('0x1a')](function(_0x2159fa){if(_0x2159fa&&_0x2159fa[_0xb879('0x14')]){return _0xed09ec['VoiceExtension'][_0xb879('0x1f')](_0x2159fa);}})[_0xb879('0x1a')](function(){_0x9d034c();})[_0xb879('0x1b')](function(_0x40c03c){_0x9d034c(_0x40c03c);});},'afterUpdate':function(_0x5e0716,_0x142b07,_0x26b568){return _0xed09ec['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x5e0716['id']}})[_0xb879('0x1a')](function(){return getChanSpyPromise(_0xed09ec,_0x5e0716);})['then'](function(_0x5bad07){if(_0x5bad07&&_0x5bad07['length']){return _0xed09ec[_0xb879('0x20')][_0xb879('0x1f')](_0x5bad07);}})[_0xb879('0x1a')](function(){_0x26b568();})[_0xb879('0x1b')](function(_0x5607a9){_0x26b568(_0x5607a9);});},'afterDestroy':function(_0x1ee646,_0x2d3ae2,_0x2b9072){return _0xed09ec[_0xb879('0x20')][_0xb879('0x21')]({'where':{'ChanSpyId':_0x1ee646['id']}})[_0xb879('0x1a')](function(){_0x2b9072();})[_0xb879('0x1b')](function(_0x36c5e6){_0x2b9072(_0x36c5e6);});}}});}; \ No newline at end of file +var _0xade2=['VoiceExtension','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','%s%s','prefix','system','push','merge','format','chanspy','record','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','agent','then','catch','models','VoiceChanSpy','voice_chanspy','bulkCreate','destroy'];(function(_0x4726ff,_0x5c5c3d){var _0x4274f1=function(_0x9d4b0d){while(--_0x9d4b0d){_0x4726ff['push'](_0x4726ff['shift']());}};_0x4274f1(++_0x5c5c3d);}(_0xade2,0x173));var _0x2ade=function(_0x46e4ce,_0x493d12){_0x46e4ce=_0x46e4ce-0x0;var _0x310e17=_0xade2[_0x46e4ce];return _0x310e17;};'use strict';var _=require(_0x2ade('0x0'));var util=require(_0x2ade('0x1'));var BPromise=require(_0x2ade('0x2'));var attributes=require(_0x2ade('0x3'));var getUserApplications=function(_0xe28c43,_0x20d0f0,_0x5b092c){var _0x47e424=0x1;var _0x5a1098=[];var _0x18e636={'context':_0x20d0f0[_0x2ade('0x4')]||_0x2ade('0x5'),'exten':util['format'](_0x2ade('0x6'),_0xe28c43[_0x2ade('0x7')],_0x5b092c),'type':_0x2ade('0x8'),'isApp':![],'ChanSpyId':_0xe28c43['id'],'UserId':_0x20d0f0['id']};_0x5a1098[_0x2ade('0x9')](_[_0x2ade('0xa')]({'app':'Set','appdata':util[_0x2ade('0xb')]('CDR(type)=%s',_0x2ade('0xc')),'priority':_0x47e424++},_0x18e636));if(_0xe28c43[_0x2ade('0xd')]){_0x5a1098['push'](_[_0x2ade('0xa')]({'app':'MixMonitor','appdata':util[_0x2ade('0xb')](_0x2ade('0xe'),_0xe28c43[_0x2ade('0xf')]),'priority':_0x47e424++},_0x18e636));}if(_0xe28c43['auth']){_0x5a1098['push'](_['merge']({'app':_0x2ade('0x10'),'appdata':_0xe28c43[_0x2ade('0x11')],'priority':_0x47e424++},_0x18e636));}_0x5a1098[_0x2ade('0x9')](_[_0x2ade('0xa')]({'app':_0x2ade('0x12'),'appdata':util['format'](_0x2ade('0x13'),_0x20d0f0[_0x2ade('0x14')],_0xe28c43[_0x2ade('0x15')]?_0xe28c43[_0x2ade('0x15')][_0x2ade('0x16')](''):''),'priority':_0x47e424++},_0x18e636));if(_0xe28c43[_0x2ade('0xd')]){_0x5a1098['push'](_['merge']({'app':_0x2ade('0x17'),'priority':_0x47e424++},_0x18e636));}return _0x5a1098;};var getChanSpyApplications=function(_0x3839c7,_0x2e5403){var _0x2aa766=[];for(var _0x46bfa1=0x0,_0x53d1dc=0x1;_0x46bfa1<_0x2e5403[_0x2ade('0x18')];_0x46bfa1++,_0x53d1dc=0x1){_0x2aa766=_0x2aa766[_0x2ade('0x19')](getUserApplications(_0x3839c7,_0x2e5403[_0x46bfa1],_0x2e5403[_0x46bfa1][_0x2ade('0x1a')]));if(_0x2e5403[_0x46bfa1][_0x2ade('0x1a')]!=_0x2e5403[_0x46bfa1]['name']){_0x2aa766=_0x2aa766[_0x2ade('0x19')](getUserApplications(_0x3839c7,_0x2e5403[_0x46bfa1],_0x2e5403[_0x46bfa1][_0x2ade('0x14')]));}}return _0x2aa766;};var getChanSpyPromise=function(_0x4f06c1,_0x5c1907){return new BPromise(function(_0x1b541e,_0x550574){return _0x4f06c1[_0x2ade('0x1b')]['findAll']({'attributes':['id',_0x2ade('0x14'),_0x2ade('0x1a')],'where':{'role':_0x2ade('0x1c'),'chanspy':!![]},'raw':!![]})[_0x2ade('0x1d')](function(_0x2ef23e){if(_0x2ef23e){return _0x1b541e(getChanSpyApplications(_0x5c1907,_0x2ef23e));}return _0x1b541e([]);})[_0x2ade('0x1e')](function(_0x34fc9d){_0x550574(_0x34fc9d);});});};module['exports']=function(_0x45af8d,_0x4a9408){var _0x420fc2=_0x45af8d[_0x2ade('0x1f')];return _0x45af8d['define'](_0x2ade('0x20'),attributes,{'tableName':_0x2ade('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b6d13,_0x4d0647,_0x1b6adf){return getChanSpyPromise(_0x420fc2,_0x4b6d13)[_0x2ade('0x1d')](function(_0x24e94c){if(_0x24e94c&&_0x24e94c[_0x2ade('0x18')]){return _0x420fc2['VoiceExtension'][_0x2ade('0x22')](_0x24e94c);}})['then'](function(){_0x1b6adf();})[_0x2ade('0x1e')](function(_0x10c1a9){_0x1b6adf(_0x10c1a9);});},'afterUpdate':function(_0x25b929,_0x3c0d70,_0x49fe09){return _0x420fc2['VoiceExtension'][_0x2ade('0x23')]({'where':{'ChanSpyId':_0x25b929['id']}})[_0x2ade('0x1d')](function(){return getChanSpyPromise(_0x420fc2,_0x25b929);})[_0x2ade('0x1d')](function(_0x498af5){if(_0x498af5&&_0x498af5[_0x2ade('0x18')]){return _0x420fc2[_0x2ade('0x24')][_0x2ade('0x22')](_0x498af5);}})[_0x2ade('0x1d')](function(){_0x49fe09();})[_0x2ade('0x1e')](function(_0x5d8817){_0x49fe09(_0x5d8817);});},'afterDestroy':function(_0x5fd392,_0x1fa433,_0x4e6f62){return _0x420fc2[_0x2ade('0x24')]['destroy']({'where':{'ChanSpyId':_0x5fd392['id']}})[_0x2ade('0x1d')](function(){_0x4e6f62();})['catch'](function(_0x27ab1a){_0x4e6f62(_0x27ab1a);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 5a8e626..fc0f0ae 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 _0x2f68=['VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','VoiceChanSpy,\x20%s,\x20%s','debug'];(function(_0x1149c4,_0xcecf28){var _0xac8165=function(_0x19cd04){while(--_0x19cd04){_0x1149c4['push'](_0x1149c4['shift']());}};_0xac8165(++_0xcecf28);}(_0x2f68,0x9a));var _0x82f6=function(_0xc41519,_0x460fce){_0xc41519=_0xc41519-0x0;var _0x55f792=_0x2f68[_0xc41519];return _0x55f792;};'use strict';var _=require('lodash');var util=require(_0x82f6('0x0'));var moment=require(_0x82f6('0x1'));var BPromise=require(_0x82f6('0x2'));var rs=require(_0x82f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x82f6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x82f6('0x5'))(_0x82f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x82f6('0x7'));var client=jayson[_0x82f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a8089,_0x1bc0be,_0x5660bf){return new BPromise(function(_0x5daa3c,_0x864400){return client[_0x82f6('0x9')](_0x5a8089,_0x5660bf)[_0x82f6('0xa')](function(_0x5ee0e5){logger[_0x82f6('0xb')](_0x82f6('0xc'),_0x1bc0be,'request\x20sent');logger[_0x82f6('0xd')](_0x82f6('0xe'),_0x1bc0be,_0x82f6('0xf'),JSON[_0x82f6('0x10')](_0x5ee0e5));if(_0x5ee0e5[_0x82f6('0x11')]){if(_0x5ee0e5[_0x82f6('0x11')]['code']===0x1f4){logger[_0x82f6('0x11')](_0x82f6('0xc'),_0x1bc0be,_0x5ee0e5['error'][_0x82f6('0x12')]);return _0x864400(_0x5ee0e5[_0x82f6('0x11')][_0x82f6('0x12')]);}logger[_0x82f6('0x11')](_0x82f6('0xc'),_0x1bc0be,_0x5ee0e5[_0x82f6('0x11')][_0x82f6('0x12')]);return _0x5daa3c(_0x5ee0e5[_0x82f6('0x11')][_0x82f6('0x12')]);}else{logger['info'](_0x82f6('0xc'),_0x1bc0be,'request\x20sent');_0x5daa3c(_0x5ee0e5[_0x82f6('0x13')][_0x82f6('0x12')]);}})[_0x82f6('0x14')](function(_0x1033d3){logger[_0x82f6('0x11')](_0x82f6('0xc'),_0x1bc0be,_0x1033d3);_0x864400(_0x1033d3);});});} \ No newline at end of file +var _0x3eec=['debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','message','VoiceChanSpy,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x55af6b,_0x391a1d){_0x55af6b=_0x55af6b-0x0;var _0x18a2bd=_0x3eec[_0x55af6b];return _0x18a2bd;};'use strict';var _=require(_0xc3ee('0x0'));var util=require(_0xc3ee('0x1'));var moment=require(_0xc3ee('0x2'));var BPromise=require(_0xc3ee('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc3ee('0x4'));var db=require(_0xc3ee('0x5'))['db'];var utils=require(_0xc3ee('0x6'));var logger=require(_0xc3ee('0x7'))(_0xc3ee('0x8'));var config=require(_0xc3ee('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc3ee('0xa')][_0xc3ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xea4318,_0x2cc750,_0x356374){return new BPromise(function(_0x3d74c0,_0xd88f6){return client[_0xc3ee('0xc')](_0xea4318,_0x356374)[_0xc3ee('0xd')](function(_0x23e9c0){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x2cc750,_0xc3ee('0xe'));logger[_0xc3ee('0xf')](_0xc3ee('0x10'),_0x2cc750,_0xc3ee('0xe'),JSON['stringify'](_0x23e9c0));if(_0x23e9c0[_0xc3ee('0x11')]){if(_0x23e9c0['error'][_0xc3ee('0x12')]===0x1f4){logger[_0xc3ee('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x2cc750,_0x23e9c0['error'][_0xc3ee('0x13')]);return _0xd88f6(_0x23e9c0['error'][_0xc3ee('0x13')]);}logger['error'](_0xc3ee('0x14'),_0x2cc750,_0x23e9c0['error'][_0xc3ee('0x13')]);return _0x3d74c0(_0x23e9c0[_0xc3ee('0x11')][_0xc3ee('0x13')]);}else{logger[_0xc3ee('0x15')](_0xc3ee('0x14'),_0x2cc750,_0xc3ee('0xe'));_0x3d74c0(_0x23e9c0[_0xc3ee('0x16')]['message']);}})[_0xc3ee('0x17')](function(_0x4eea89){logger[_0xc3ee('0x11')](_0xc3ee('0x14'),_0x2cc750,_0x4eea89);_0xd88f6(_0x4eea89);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index f5e8221..25c00be 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 _0xd947=['update','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0xc36d01,_0x3bf1a6){var _0xecb231=function(_0x2fb301){while(--_0x2fb301){_0xc36d01['push'](_0xc36d01['shift']());}};_0xecb231(++_0x3bf1a6);}(_0xd947,0x1cb));var _0x7d94=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xd947[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7d94('0x0'));var timeout=require('connect-timeout');var express=require(_0x7d94('0x1'));var router=express[_0x7d94('0x2')]();var fs_extra=require(_0x7d94('0x3'));var auth=require(_0x7d94('0x4'));var interaction=require(_0x7d94('0x5'));var config=require(_0x7d94('0x6'));var controller=require(_0x7d94('0x7'));router[_0x7d94('0x8')]('/',auth[_0x7d94('0x9')](),controller[_0x7d94('0xa')]);router['get'](_0x7d94('0xb'),auth[_0x7d94('0x9')](),controller[_0x7d94('0xc')]);router[_0x7d94('0xd')]('/',auth[_0x7d94('0x9')](),controller[_0x7d94('0xe')]);router[_0x7d94('0xf')](_0x7d94('0xb'),auth[_0x7d94('0x9')](),controller[_0x7d94('0x10')]);router['delete'](_0x7d94('0xb'),auth[_0x7d94('0x9')](),controller[_0x7d94('0x11')]);module[_0x7d94('0x12')]=router; \ No newline at end of file +var _0x756d=['delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','show','post','create','update'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x756d,0x80));var _0xd756=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x756d[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0xd756('0x0'));var util=require(_0xd756('0x1'));var path=require(_0xd756('0x2'));var timeout=require('connect-timeout');var express=require(_0xd756('0x3'));var router=express[_0xd756('0x4')]();var fs_extra=require(_0xd756('0x5'));var auth=require(_0xd756('0x6'));var interaction=require(_0xd756('0x7'));var config=require(_0xd756('0x8'));var controller=require('./voiceContext.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xd756('0x9')]);router['get'](_0xd756('0xa'),auth[_0xd756('0xb')](),controller[_0xd756('0xc')]);router[_0xd756('0xd')]('/',auth[_0xd756('0xb')](),controller[_0xd756('0xe')]);router['put']('/:id',auth[_0xd756('0xb')](),controller[_0xd756('0xf')]);router[_0xd756('0x10')]('/:id',auth[_0xd756('0xb')](),controller[_0xd756('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index bc4b730..9044d35 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 _0x9d3a=['STRING','name','BOOLEAN','sequelize'];(function(_0x1f8f66,_0x5dc25a){var _0x3b992d=function(_0x25dadb){while(--_0x25dadb){_0x1f8f66['push'](_0x1f8f66['shift']());}};_0x3b992d(++_0x5dc25a);}(_0x9d3a,0x1a7));var _0xa9d3=function(_0x1df3ec,_0x3a8b71){_0x1df3ec=_0x1df3ec-0x0;var _0x353b67=_0x9d3a[_0x1df3ec];return _0x353b67;};'use strict';var Sequelize=require(_0xa9d3('0x0'));module['exports']={'name':{'type':Sequelize[_0xa9d3('0x1')],'unique':_0xa9d3('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xa9d3('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3319=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x342553,_0x1df1a1){var _0x19e6a0=function(_0x11e6e0){while(--_0x11e6e0){_0x342553['push'](_0x342553['shift']());}};_0x19e6a0(++_0x1df1a1);}(_0x3319,0x1e7));var _0x9331=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3319[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x9331('0x0'));module[_0x9331('0x1')]={'name':{'type':Sequelize[_0x9331('0x2')],'unique':_0x9331('0x3')},'description':{'type':Sequelize[_0x9331('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x9331('0x4')],'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 6d7d03d..681833d 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 _0x948d=['role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','Contexts','UserProfileResource','destroy','sendStatus','stack','name','send','index','map','VoiceContext','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','includeAll','include','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','Reload','chan_sip.so','user'];(function(_0x1c5899,_0x1cd098){var _0x3a34cd=function(_0xb2a5d9){while(--_0xb2a5d9){_0x1c5899['push'](_0x1c5899['shift']());}};_0x3a34cd(++_0x1cd098);}(_0x948d,0x1b8));var _0xd948=function(_0x4833f4,_0x7f50db){_0x4833f4=_0x4833f4-0x0;var _0x1c172a=_0x948d[_0x4833f4];return _0x1c172a;};'use strict';var emlformat=require(_0xd948('0x0'));var rimraf=require(_0xd948('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd948('0x2'));var rp=require(_0xd948('0x3'));var moment=require(_0xd948('0x4'));var BPromise=require(_0xd948('0x5'));var Mustache=require('mustache');var util=require(_0xd948('0x6'));var path=require('path');var sox=require(_0xd948('0x7'));var csv=require(_0xd948('0x8'));var ejs=require(_0xd948('0x9'));var fs=require('fs');var fs_extra=require(_0xd948('0xa'));var _=require(_0xd948('0xb'));var squel=require(_0xd948('0xc'));var crypto=require(_0xd948('0xd'));var jsforce=require(_0xd948('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd948('0x8'));var querystring=require(_0xd948('0xf'));var Papa=require(_0xd948('0x10'));var Redis=require('ioredis');var authService=require(_0xd948('0x11'));var qs=require(_0xd948('0x12'));var as=require(_0xd948('0x13'));var hardwareService=require(_0xd948('0x14'));var logger=require(_0xd948('0x15'))(_0xd948('0x16'));var utils=require(_0xd948('0x17'));var config=require(_0xd948('0x18'));var licenseUtil=require(_0xd948('0x19'));var db=require(_0xd948('0x1a'))['db'];var jayson=require(_0xd948('0x1b'));var client=jayson['client'][_0xd948('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x330c64,_0x50059f,_0x3254d3,_0x1c2e53){return new BPromise(function(_0x19fb68,_0x27142f){var _0x33767b=_0x1c2e53||client;return _0x33767b['request'](_0x330c64,_0x3254d3)['then'](function(_0x31a295){logger[_0xd948('0x1d')](_0xd948('0x1e'),_0x50059f,_0xd948('0x1f'));logger[_0xd948('0x20')](_0xd948('0x21'),_0x50059f,_0xd948('0x1f'),JSON[_0xd948('0x22')](_0x31a295));if(_0x31a295[_0xd948('0x23')]){if(_0x31a295[_0xd948('0x23')][_0xd948('0x24')]===0x1f4){logger[_0xd948('0x23')](_0xd948('0x1e'),_0x50059f,_0x31a295['error']['message']);return _0x27142f(_0x31a295[_0xd948('0x23')]['message']);}logger['error'](_0xd948('0x1e'),_0x50059f,_0x31a295[_0xd948('0x23')][_0xd948('0x25')]);return _0x19fb68(_0x31a295[_0xd948('0x23')][_0xd948('0x25')]);}else{logger[_0xd948('0x1d')](_0xd948('0x1e'),_0x50059f,'request\x20sent');_0x19fb68(_0x31a295[_0xd948('0x26')][_0xd948('0x25')]);}})['catch'](function(_0x5e2345){logger[_0xd948('0x23')](_0xd948('0x1e'),_0x50059f,_0x5e2345);_0x27142f(_0x5e2345);});});}function respondWithStatusCode(_0x8fe67d,_0x4103ba){_0x4103ba=_0x4103ba||0xcc;return function(_0x30ca0d){if(_0x30ca0d){return _0x8fe67d['sendStatus'](_0x4103ba);}return _0x8fe67d[_0xd948('0x27')](_0x4103ba)[_0xd948('0x28')]();};}function respondWithResult(_0x101ec4,_0x1dd29f){_0x1dd29f=_0x1dd29f||0xc8;return function(_0x520425){if(_0x520425){return _0x101ec4['status'](_0x1dd29f)[_0xd948('0x29')](_0x520425);}};}function respondWithFilteredResult(_0x452c26,_0x13eb95){return function(_0x24ddeb){if(_0x24ddeb){var _0x283883=typeof _0x13eb95[_0xd948('0x2a')]===_0xd948('0x2b')&&typeof _0x13eb95[_0xd948('0x2c')]===_0xd948('0x2b');var _0x3a4fb6=_0x24ddeb[_0xd948('0x2d')];var _0x2b6849=_0x283883?0x0:_0x13eb95[_0xd948('0x2a')];var _0x5e4a7d=_0x283883?_0x24ddeb[_0xd948('0x2d')]:_0x13eb95['offset']+_0x13eb95[_0xd948('0x2c')];var _0x54f67f;if(_0x5e4a7d>=_0x3a4fb6){_0x5e4a7d=_0x3a4fb6;_0x54f67f=0xc8;}else{_0x54f67f=0xce;}_0x452c26['status'](_0x54f67f);return _0x452c26[_0xd948('0x2e')](_0xd948('0x2f'),_0x2b6849+'-'+_0x5e4a7d+'/'+_0x3a4fb6)[_0xd948('0x29')](_0x24ddeb);}return null;};}function patchUpdates(_0x1f205c){return function(_0x16fad7){try{jsonpatch[_0xd948('0x30')](_0x16fad7,_0x1f205c,!![]);}catch(_0x3e8a28){return BPromise[_0xd948('0x31')](_0x3e8a28);}return _0x16fad7['save']();};}function saveUpdates(_0x5334af,_0xb78eff){return function(_0x5f2b1b){if(_0x5f2b1b){return _0x5f2b1b[_0xd948('0x32')](_0x5334af)[_0xd948('0x33')](function(_0x2fdb30){return _0x2fdb30;});}return null;};}function removeEntity(_0x245efe,_0x1e8a59){return function(_0x50d17c){if(_0x50d17c){return _0x50d17c['destroy']()[_0xd948('0x33')](function(){var _0x279bd8=_0x50d17c[_0xd948('0x34')]({'plain':!![]});var _0x351eea=_0xd948('0x35');return db[_0xd948('0x36')][_0xd948('0x37')]({'where':{'type':_0x351eea,'resourceId':_0x279bd8['id']}})['then'](function(){return _0x50d17c;});})[_0xd948('0x33')](function(){_0x245efe[_0xd948('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d8c1d,_0x3381da){return function(_0x21d501){if(!_0x21d501){_0x5d8c1d[_0xd948('0x38')](0x194);}return _0x21d501;};}function handleError(_0x137c70,_0x4cc7b3){_0x4cc7b3=_0x4cc7b3||0x1f4;return function(_0x361774){logger[_0xd948('0x23')](_0x361774[_0xd948('0x39')]);if(_0x361774[_0xd948('0x3a')]){delete _0x361774[_0xd948('0x3a')];}_0x137c70[_0xd948('0x27')](_0x4cc7b3)[_0xd948('0x3b')](_0x361774);};}exports[_0xd948('0x3c')]=function(_0x1174a9,_0x32e4ea){var _0x5996f8={},_0xcb174a={},_0x1ce6c6={'count':0x0,'rows':[]};var _0xf2aa34=_[_0xd948('0x3d')](db[_0xd948('0x3e')][_0xd948('0x3f')],function(_0x46db70){return{'name':_0x46db70['fieldName'],'type':_0x46db70[_0xd948('0x40')]['key']};});_0xcb174a[_0xd948('0x41')]=_[_0xd948('0x3d')](_0xf2aa34,_0xd948('0x3a'));_0xcb174a[_0xd948('0x42')]=_[_0xd948('0x43')](_0x1174a9[_0xd948('0x42')]);_0xcb174a[_0xd948('0x44')]=_[_0xd948('0x45')](_0xcb174a['model'],_0xcb174a[_0xd948('0x42')]);_0x5996f8['attributes']=_[_0xd948('0x45')](_0xcb174a[_0xd948('0x41')],qs[_0xd948('0x46')](_0x1174a9[_0xd948('0x42')][_0xd948('0x46')]));_0x5996f8[_0xd948('0x47')]=_0x5996f8['attributes'][_0xd948('0x48')]?_0x5996f8[_0xd948('0x47')]:_0xcb174a[_0xd948('0x41')];if(!_0x1174a9['query'][_0xd948('0x49')](_0xd948('0x4a'))){_0x5996f8[_0xd948('0x2c')]=qs[_0xd948('0x2c')](_0x1174a9[_0xd948('0x42')][_0xd948('0x2c')]);_0x5996f8[_0xd948('0x2a')]=qs[_0xd948('0x2a')](_0x1174a9[_0xd948('0x42')][_0xd948('0x2a')]);}_0x5996f8['order']=qs[_0xd948('0x4b')](_0x1174a9['query']['sort']);_0x5996f8[_0xd948('0x4c')]=qs[_0xd948('0x44')](_[_0xd948('0x4d')](_0x1174a9['query'],_0xcb174a[_0xd948('0x44')]),_0xf2aa34);if(_0x1174a9['query'][_0xd948('0x4e')]){_0x5996f8[_0xd948('0x4c')]=_[_0xd948('0x4f')](_0x5996f8[_0xd948('0x4c')],{'$or':_[_0xd948('0x3d')](_0xf2aa34,function(_0x4e3c14){if(_0x4e3c14[_0xd948('0x40')]!==_0xd948('0x50')){var _0x49fede={};_0x49fede[_0x4e3c14[_0xd948('0x3a')]]={'$like':'%'+_0x1174a9['query']['filter']+'%'};return _0x49fede;}})});}_0x5996f8=_[_0xd948('0x4f')]({},_0x5996f8,_0x1174a9[_0xd948('0x51')]);var _0x1f5c62={'where':_0x5996f8[_0xd948('0x4c')]};return db[_0xd948('0x3e')][_0xd948('0x2d')](_0x1f5c62)['then'](function(_0x48a928){_0x1ce6c6['count']=_0x48a928;if(_0x1174a9[_0xd948('0x42')]['includeAll']){_0x5996f8['include']=[{'all':!![]}];}return db['VoiceContext'][_0xd948('0x52')](_0x5996f8);})[_0xd948('0x33')](function(_0x2ddafa){_0x1ce6c6[_0xd948('0x53')]=_0x2ddafa;return _0x1ce6c6;})['then'](respondWithFilteredResult(_0x32e4ea,_0x5996f8))[_0xd948('0x54')](handleError(_0x32e4ea,null));};exports[_0xd948('0x55')]=function(_0x391348,_0x1b3805){var _0x3b4e78={'raw':![],'where':{'id':_0x391348['params']['id']}},_0x2acb0d={};_0x2acb0d[_0xd948('0x41')]=_[_0xd948('0x43')](db[_0xd948('0x3e')]['rawAttributes']);_0x2acb0d[_0xd948('0x42')]=_[_0xd948('0x43')](_0x391348[_0xd948('0x42')]);_0x2acb0d[_0xd948('0x44')]=_[_0xd948('0x45')](_0x2acb0d[_0xd948('0x41')],_0x2acb0d['query']);_0x3b4e78['attributes']=_['intersection'](_0x2acb0d[_0xd948('0x41')],qs[_0xd948('0x46')](_0x391348['query']['fields']));_0x3b4e78[_0xd948('0x47')]=_0x3b4e78[_0xd948('0x47')][_0xd948('0x48')]?_0x3b4e78[_0xd948('0x47')]:_0x2acb0d[_0xd948('0x41')];if(_0x391348['query'][_0xd948('0x56')]){_0x3b4e78[_0xd948('0x57')]=[{'all':!![]}];}_0x3b4e78=_[_0xd948('0x4f')]({},_0x3b4e78,_0x391348[_0xd948('0x51')]);return db[_0xd948('0x3e')][_0xd948('0x58')](_0x3b4e78)[_0xd948('0x33')](handleEntityNotFound(_0x1b3805,null))[_0xd948('0x33')](respondWithResult(_0x1b3805,null))['catch'](handleError(_0x1b3805,null));};exports[_0xd948('0x59')]=function(_0x336797,_0x2ac5da,_0x3cf829){var _0x221cca;return db[_0xd948('0x3e')][_0xd948('0x59')](_0x336797[_0xd948('0x5a')],{'raw':!![]})[_0xd948('0x33')](function(_0x44023d){_0x221cca=_0x44023d;return db[_0xd948('0x3e')][_0xd948('0x52')]({'raw':!![]});})['then'](function(_0x783799){var _0x1cb214=fs[_0xd948('0x5b')](path[_0xd948('0x5c')](config[_0xd948('0x5d')],_0xd948('0x5e')),_0xd948('0x5f'));var _0x4540f0=ejs[_0xd948('0x60')](_0x1cb214,{'contexts':_0x783799||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x4540f0);})[_0xd948('0x33')](function(){return respondWithRpcPromise(_0xd948('0x61'),'create',{'module':_0xd948('0x62')});})[_0xd948('0x33')](function(){var _0xf8a772=_0x336797[_0xd948('0x63')]['get']({'plain':!![]});if(!_0xf8a772)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf8a772[_0xd948('0x64')]===_0xd948('0x63')){var _0x3c8be8=_0x221cca[_0xd948('0x34')]({'plain':!![]});return db[_0xd948('0x65')][_0xd948('0x58')]({'where':{'name':_0xd948('0x35'),'userProfileId':_0xf8a772[_0xd948('0x66')]},'raw':!![]})[_0xd948('0x33')](function(_0x28c56d){if(_0x28c56d&&_0x28c56d[_0xd948('0x67')]===0x0){return db[_0xd948('0x36')][_0xd948('0x59')]({'name':_0x3c8be8[_0xd948('0x3a')],'resourceId':_0x3c8be8['id'],'type':_0x28c56d[_0xd948('0x3a')],'sectionId':_0x28c56d['id']},{})[_0xd948('0x33')](function(){return _0x221cca;});}else{return _0x221cca;}})[_0xd948('0x54')](function(_0x258dec){logger[_0xd948('0x23')](_0xd948('0x68'),_0x258dec);throw _0x258dec;});}return _0x221cca;})[_0xd948('0x33')](respondWithResult(_0x2ac5da,0xc9))[_0xd948('0x54')](handleError(_0x2ac5da,null));};exports['update']=function(_0x308e37,_0x3a6b94,_0x46e558){var _0x19aaa6;return db['VoiceContext']['find']({'where':{'id':_0x308e37[_0xd948('0x69')]['id']}})['then'](handleEntityNotFound(_0x3a6b94,null))[_0xd948('0x33')](saveUpdates(_0x308e37[_0xd948('0x5a')],null))[_0xd948('0x33')](function(_0x23369c){if(_0x23369c){_0x19aaa6=_0x23369c;return db[_0xd948('0x3e')][_0xd948('0x52')]({'raw':!![]});}})[_0xd948('0x33')](function(_0x207841){var _0x204c85=fs[_0xd948('0x5b')](path[_0xd948('0x5c')](config['root'],_0xd948('0x5e')),_0xd948('0x5f'));var _0x1a7f4c=ejs[_0xd948('0x60')](_0x204c85,{'contexts':_0x207841||[]});fs[_0xd948('0x6a')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x1a7f4c);})[_0xd948('0x33')](function(){return respondWithRpcPromise('Reload',_0xd948('0x32'),{'module':_0xd948('0x62')});})[_0xd948('0x33')](function(){return _0x19aaa6;})[_0xd948('0x33')](respondWithResult(_0x3a6b94,null))[_0xd948('0x54')](handleError(_0x3a6b94,null));};exports[_0xd948('0x37')]=function(_0x4752a6,_0x1ce8e4,_0x3c0853){var _0x24f017;return db['VoiceContext'][_0xd948('0x58')]({'where':{'id':_0x4752a6[_0xd948('0x69')]['id']}})[_0xd948('0x33')](handleEntityNotFound(_0x1ce8e4,null))[_0xd948('0x33')](removeEntity(_0x1ce8e4,null))[_0xd948('0x33')](function(){return db[_0xd948('0x3e')][_0xd948('0x52')]({'raw':!![]});})[_0xd948('0x33')](function(_0x213d53){var _0x4549ea=fs['readFileSync'](path[_0xd948('0x5c')](config['root'],'server/files/templates/context.ejs'),_0xd948('0x5f'));var _0x528ab9=ejs[_0xd948('0x60')](_0x4549ea,{'contexts':_0x213d53});fs[_0xd948('0x6a')](_0xd948('0x6b'),_0x528ab9);return respondWithRpcPromise(_0xd948('0x61'),_0xd948('0x37'),{'module':_0xd948('0x62')});})[_0xd948('0x54')](handleError(_0x1ce8e4,null));}; \ No newline at end of file +var _0x8296=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceContext,\x20%s,\x20%s','info','catch','end','status','json','limit','undefined','offset','count','set','Content-Range','reject','save','update','destroy','Contexts','UserProfileResource','stack','name','index','map','VoiceContext','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','includeAll','include','findAll','rows','show','find','create','body','readFileSync','join','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','root','utf8','rimraf'];(function(_0x3bb2e7,_0x32c33a){var _0x2f7207=function(_0x561856){while(--_0x561856){_0x3bb2e7['push'](_0x3bb2e7['shift']());}};_0x2f7207(++_0x32c33a);}(_0x8296,0x140));var _0x6829=function(_0xf11c6e,_0x4a4132){_0xf11c6e=_0xf11c6e-0x0;var _0x1b4e3d=_0x8296[_0xf11c6e];return _0x1b4e3d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6829('0x0'));var zipdir=require(_0x6829('0x1'));var jsonpatch=require(_0x6829('0x2'));var rp=require(_0x6829('0x3'));var moment=require(_0x6829('0x4'));var BPromise=require(_0x6829('0x5'));var Mustache=require(_0x6829('0x6'));var util=require(_0x6829('0x7'));var path=require('path');var sox=require(_0x6829('0x8'));var csv=require(_0x6829('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6829('0xa'));var _=require(_0x6829('0xb'));var squel=require(_0x6829('0xc'));var crypto=require(_0x6829('0xd'));var jsforce=require(_0x6829('0xe'));var deskjs=require(_0x6829('0xf'));var toCsv=require(_0x6829('0x9'));var querystring=require(_0x6829('0x10'));var Papa=require(_0x6829('0x11'));var Redis=require('ioredis');var authService=require(_0x6829('0x12'));var qs=require(_0x6829('0x13'));var as=require(_0x6829('0x14'));var hardwareService=require(_0x6829('0x15'));var logger=require(_0x6829('0x16'))(_0x6829('0x17'));var utils=require(_0x6829('0x18'));var config=require(_0x6829('0x19'));var licenseUtil=require(_0x6829('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0x6829('0x1b'));var client=jayson[_0x6829('0x1c')][_0x6829('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x599671,_0x32c466,_0x2d3577,_0x70fc0c){return new BPromise(function(_0x2da5d7,_0x1132c4){var _0x164205=_0x70fc0c||client;return _0x164205[_0x6829('0x1e')](_0x599671,_0x2d3577)[_0x6829('0x1f')](function(_0x47ca0b){logger['info']('VoiceContext,\x20%s,\x20%s',_0x32c466,_0x6829('0x20'));logger[_0x6829('0x21')](_0x6829('0x22'),_0x32c466,'request\x20sent',JSON[_0x6829('0x23')](_0x47ca0b));if(_0x47ca0b[_0x6829('0x24')]){if(_0x47ca0b[_0x6829('0x24')][_0x6829('0x25')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x32c466,_0x47ca0b[_0x6829('0x24')][_0x6829('0x26')]);return _0x1132c4(_0x47ca0b['error'][_0x6829('0x26')]);}logger[_0x6829('0x24')](_0x6829('0x27'),_0x32c466,_0x47ca0b[_0x6829('0x24')][_0x6829('0x26')]);return _0x2da5d7(_0x47ca0b[_0x6829('0x24')]['message']);}else{logger[_0x6829('0x28')](_0x6829('0x27'),_0x32c466,'request\x20sent');_0x2da5d7(_0x47ca0b['result'][_0x6829('0x26')]);}})[_0x6829('0x29')](function(_0x4cd02f){logger[_0x6829('0x24')](_0x6829('0x27'),_0x32c466,_0x4cd02f);_0x1132c4(_0x4cd02f);});});}function respondWithStatusCode(_0x25962b,_0x568240){_0x568240=_0x568240||0xcc;return function(_0x5bc36c){if(_0x5bc36c){return _0x25962b['sendStatus'](_0x568240);}return _0x25962b['status'](_0x568240)[_0x6829('0x2a')]();};}function respondWithResult(_0x4f9a1f,_0x283f19){_0x283f19=_0x283f19||0xc8;return function(_0x30f8c6){if(_0x30f8c6){return _0x4f9a1f[_0x6829('0x2b')](_0x283f19)[_0x6829('0x2c')](_0x30f8c6);}};}function respondWithFilteredResult(_0x5a7471,_0x1c30ba){return function(_0x2422d1){if(_0x2422d1){var _0x1197d1=typeof _0x1c30ba['offset']==='undefined'&&typeof _0x1c30ba[_0x6829('0x2d')]===_0x6829('0x2e');var _0x395db7=_0x2422d1['count'];var _0x3a2c21=_0x1197d1?0x0:_0x1c30ba[_0x6829('0x2f')];var _0x3249ab=_0x1197d1?_0x2422d1[_0x6829('0x30')]:_0x1c30ba['offset']+_0x1c30ba[_0x6829('0x2d')];var _0x2c5670;if(_0x3249ab>=_0x395db7){_0x3249ab=_0x395db7;_0x2c5670=0xc8;}else{_0x2c5670=0xce;}_0x5a7471[_0x6829('0x2b')](_0x2c5670);return _0x5a7471[_0x6829('0x31')](_0x6829('0x32'),_0x3a2c21+'-'+_0x3249ab+'/'+_0x395db7)['json'](_0x2422d1);}return null;};}function patchUpdates(_0x534122){return function(_0x233f46){try{jsonpatch['apply'](_0x233f46,_0x534122,!![]);}catch(_0x44da03){return BPromise[_0x6829('0x33')](_0x44da03);}return _0x233f46[_0x6829('0x34')]();};}function saveUpdates(_0x2e9ef5,_0x20ae64){return function(_0xfb5392){if(_0xfb5392){return _0xfb5392[_0x6829('0x35')](_0x2e9ef5)[_0x6829('0x1f')](function(_0x555962){return _0x555962;});}return null;};}function removeEntity(_0x18d9b5,_0x31af37){return function(_0x4947cc){if(_0x4947cc){return _0x4947cc[_0x6829('0x36')]()[_0x6829('0x1f')](function(){var _0x54d0df=_0x4947cc['get']({'plain':!![]});var _0x23738c=_0x6829('0x37');return db[_0x6829('0x38')][_0x6829('0x36')]({'where':{'type':_0x23738c,'resourceId':_0x54d0df['id']}})['then'](function(){return _0x4947cc;});})[_0x6829('0x1f')](function(){_0x18d9b5[_0x6829('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x247dfa,_0x119d50){return function(_0x488c55){if(!_0x488c55){_0x247dfa['sendStatus'](0x194);}return _0x488c55;};}function handleError(_0x599ed5,_0x485314){_0x485314=_0x485314||0x1f4;return function(_0x312dd0){logger['error'](_0x312dd0[_0x6829('0x39')]);if(_0x312dd0[_0x6829('0x3a')]){delete _0x312dd0[_0x6829('0x3a')];}_0x599ed5['status'](_0x485314)['send'](_0x312dd0);};}exports[_0x6829('0x3b')]=function(_0x441c84,_0x42efec){var _0x2c5944={},_0x124482={},_0x2d836a={'count':0x0,'rows':[]};var _0x43c04e=_[_0x6829('0x3c')](db[_0x6829('0x3d')][_0x6829('0x3e')],function(_0x27a0a9){return{'name':_0x27a0a9[_0x6829('0x3f')],'type':_0x27a0a9[_0x6829('0x40')]['key']};});_0x124482[_0x6829('0x41')]=_[_0x6829('0x3c')](_0x43c04e,_0x6829('0x3a'));_0x124482[_0x6829('0x42')]=_[_0x6829('0x43')](_0x441c84[_0x6829('0x42')]);_0x124482[_0x6829('0x44')]=_['intersection'](_0x124482[_0x6829('0x41')],_0x124482[_0x6829('0x42')]);_0x2c5944[_0x6829('0x45')]=_[_0x6829('0x46')](_0x124482[_0x6829('0x41')],qs[_0x6829('0x47')](_0x441c84['query'][_0x6829('0x47')]));_0x2c5944[_0x6829('0x45')]=_0x2c5944[_0x6829('0x45')][_0x6829('0x48')]?_0x2c5944['attributes']:_0x124482[_0x6829('0x41')];if(!_0x441c84['query'][_0x6829('0x49')](_0x6829('0x4a'))){_0x2c5944['limit']=qs['limit'](_0x441c84['query']['limit']);_0x2c5944['offset']=qs[_0x6829('0x2f')](_0x441c84[_0x6829('0x42')][_0x6829('0x2f')]);}_0x2c5944[_0x6829('0x4b')]=qs['sort'](_0x441c84[_0x6829('0x42')][_0x6829('0x4c')]);_0x2c5944['where']=qs[_0x6829('0x44')](_[_0x6829('0x4d')](_0x441c84[_0x6829('0x42')],_0x124482[_0x6829('0x44')]),_0x43c04e);if(_0x441c84['query'][_0x6829('0x4e')]){_0x2c5944['where']=_[_0x6829('0x4f')](_0x2c5944[_0x6829('0x50')],{'$or':_['map'](_0x43c04e,function(_0x293c2f){if(_0x293c2f['type']!=='VIRTUAL'){var _0xd58a31={};_0xd58a31[_0x293c2f[_0x6829('0x3a')]]={'$like':'%'+_0x441c84[_0x6829('0x42')][_0x6829('0x4e')]+'%'};return _0xd58a31;}})});}_0x2c5944=_[_0x6829('0x4f')]({},_0x2c5944,_0x441c84[_0x6829('0x51')]);var _0x116b17={'where':_0x2c5944[_0x6829('0x50')]};return db[_0x6829('0x3d')][_0x6829('0x30')](_0x116b17)['then'](function(_0xed93cb){_0x2d836a[_0x6829('0x30')]=_0xed93cb;if(_0x441c84['query'][_0x6829('0x52')]){_0x2c5944[_0x6829('0x53')]=[{'all':!![]}];}return db['VoiceContext'][_0x6829('0x54')](_0x2c5944);})[_0x6829('0x1f')](function(_0x24f4dc){_0x2d836a[_0x6829('0x55')]=_0x24f4dc;return _0x2d836a;})[_0x6829('0x1f')](respondWithFilteredResult(_0x42efec,_0x2c5944))[_0x6829('0x29')](handleError(_0x42efec,null));};exports[_0x6829('0x56')]=function(_0x592845,_0x256368){var _0x57a0d9={'raw':![],'where':{'id':_0x592845['params']['id']}},_0x17b4c5={};_0x17b4c5['model']=_[_0x6829('0x43')](db[_0x6829('0x3d')]['rawAttributes']);_0x17b4c5[_0x6829('0x42')]=_[_0x6829('0x43')](_0x592845[_0x6829('0x42')]);_0x17b4c5[_0x6829('0x44')]=_[_0x6829('0x46')](_0x17b4c5[_0x6829('0x41')],_0x17b4c5['query']);_0x57a0d9[_0x6829('0x45')]=_[_0x6829('0x46')](_0x17b4c5[_0x6829('0x41')],qs[_0x6829('0x47')](_0x592845[_0x6829('0x42')][_0x6829('0x47')]));_0x57a0d9[_0x6829('0x45')]=_0x57a0d9[_0x6829('0x45')]['length']?_0x57a0d9[_0x6829('0x45')]:_0x17b4c5[_0x6829('0x41')];if(_0x592845[_0x6829('0x42')][_0x6829('0x52')]){_0x57a0d9[_0x6829('0x53')]=[{'all':!![]}];}_0x57a0d9=_[_0x6829('0x4f')]({},_0x57a0d9,_0x592845[_0x6829('0x51')]);return db[_0x6829('0x3d')][_0x6829('0x57')](_0x57a0d9)[_0x6829('0x1f')](handleEntityNotFound(_0x256368,null))[_0x6829('0x1f')](respondWithResult(_0x256368,null))[_0x6829('0x29')](handleError(_0x256368,null));};exports[_0x6829('0x58')]=function(_0x324362,_0x2d62ae,_0x3322a6){var _0x106aca;return db[_0x6829('0x3d')][_0x6829('0x58')](_0x324362[_0x6829('0x59')],{'raw':!![]})[_0x6829('0x1f')](function(_0x10e5d2){_0x106aca=_0x10e5d2;return db[_0x6829('0x3d')]['findAll']({'raw':!![]});})['then'](function(_0x1b06e2){var _0x57c12a=fs[_0x6829('0x5a')](path[_0x6829('0x5b')](config['root'],_0x6829('0x5c')),'utf8');var _0x3b16fe=ejs[_0x6829('0x5d')](_0x57c12a,{'contexts':_0x1b06e2||[]});fs[_0x6829('0x5e')](_0x6829('0x5f'),_0x3b16fe);})[_0x6829('0x1f')](function(){return respondWithRpcPromise(_0x6829('0x60'),_0x6829('0x58'),{'module':_0x6829('0x61')});})[_0x6829('0x1f')](function(){var _0x412522=_0x324362['user'][_0x6829('0x62')]({'plain':!![]});if(!_0x412522)throw new Error(_0x6829('0x63'));if(_0x412522['role']===_0x6829('0x64')){var _0xc090fd=_0x106aca['get']({'plain':!![]});return db[_0x6829('0x65')][_0x6829('0x57')]({'where':{'name':_0x6829('0x37'),'userProfileId':_0x412522[_0x6829('0x66')]},'raw':!![]})['then'](function(_0x4c618b){if(_0x4c618b&&_0x4c618b['autoAssociation']===0x0){return db[_0x6829('0x38')][_0x6829('0x58')]({'name':_0xc090fd[_0x6829('0x3a')],'resourceId':_0xc090fd['id'],'type':_0x4c618b[_0x6829('0x3a')],'sectionId':_0x4c618b['id']},{})['then'](function(){return _0x106aca;});}else{return _0x106aca;}})[_0x6829('0x29')](function(_0x3426ef){logger[_0x6829('0x24')](_0x6829('0x67'),_0x3426ef);throw _0x3426ef;});}return _0x106aca;})[_0x6829('0x1f')](respondWithResult(_0x2d62ae,0xc9))['catch'](handleError(_0x2d62ae,null));};exports[_0x6829('0x35')]=function(_0x50723a,_0x1bf485,_0xfa2c48){var _0xec606f;return db[_0x6829('0x3d')][_0x6829('0x57')]({'where':{'id':_0x50723a[_0x6829('0x68')]['id']}})[_0x6829('0x1f')](handleEntityNotFound(_0x1bf485,null))[_0x6829('0x1f')](saveUpdates(_0x50723a[_0x6829('0x59')],null))[_0x6829('0x1f')](function(_0x181550){if(_0x181550){_0xec606f=_0x181550;return db[_0x6829('0x3d')][_0x6829('0x54')]({'raw':!![]});}})[_0x6829('0x1f')](function(_0x4b7939){var _0x7581d4=fs[_0x6829('0x5a')](path[_0x6829('0x5b')](config['root'],_0x6829('0x5c')),'utf8');var _0x2410a4=ejs[_0x6829('0x5d')](_0x7581d4,{'contexts':_0x4b7939||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x2410a4);})[_0x6829('0x1f')](function(){return respondWithRpcPromise('Reload','update',{'module':_0x6829('0x61')});})[_0x6829('0x1f')](function(){return _0xec606f;})['then'](respondWithResult(_0x1bf485,null))[_0x6829('0x29')](handleError(_0x1bf485,null));};exports[_0x6829('0x36')]=function(_0xae1323,_0x124512,_0x487949){var _0x323b63;return db[_0x6829('0x3d')]['find']({'where':{'id':_0xae1323[_0x6829('0x68')]['id']}})['then'](handleEntityNotFound(_0x124512,null))[_0x6829('0x1f')](removeEntity(_0x124512,null))[_0x6829('0x1f')](function(){return db['VoiceContext'][_0x6829('0x54')]({'raw':!![]});})['then'](function(_0x3fc2f4){var _0x35efcd=fs[_0x6829('0x5a')](path['join'](config[_0x6829('0x69')],_0x6829('0x5c')),_0x6829('0x6a'));var _0x6e8be0=ejs[_0x6829('0x5d')](_0x35efcd,{'contexts':_0x3fc2f4});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x6e8be0);return respondWithRpcPromise(_0x6829('0x60'),'destroy',{'module':_0x6829('0x61')});})[_0x6829('0x29')](handleError(_0x124512,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 297679e..82196ec 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 _0x26dc=['path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x26dc,0x1b9));var _0xc26d=function(_0x38a803,_0x1b15b2){_0x38a803=_0x38a803-0x0;var _0x5e8b65=_0x26dc[_0x38a803];return _0x5e8b65;};'use strict';var _=require(_0xc26d('0x0'));var util=require(_0xc26d('0x1'));var logger=require(_0xc26d('0x2'))(_0xc26d('0x3'));var moment=require(_0xc26d('0x4'));var BPromise=require(_0xc26d('0x5'));var rp=require(_0xc26d('0x6'));var fs=require('fs');var path=require(_0xc26d('0x7'));var rimraf=require(_0xc26d('0x8'));var config=require(_0xc26d('0x9'));var attributes=require(_0xc26d('0xa'));module[_0xc26d('0xb')]=function(_0x430182,_0x500d97){return _0x430182[_0xc26d('0xc')]('VoiceContext',attributes,{'tableName':_0xc26d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd91c=['define','voice_contexts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports'];(function(_0x543a4e,_0x544f2e){var _0x27a3a9=function(_0x5aac67){while(--_0x5aac67){_0x543a4e['push'](_0x543a4e['shift']());}};_0x27a3a9(++_0x544f2e);}(_0xd91c,0x17b));var _0xcd91=function(_0x24a105,_0x5c3246){_0x24a105=_0x24a105-0x0;var _0x497c26=_0xd91c[_0x24a105];return _0x497c26;};'use strict';var _=require(_0xcd91('0x0'));var util=require(_0xcd91('0x1'));var logger=require(_0xcd91('0x2'))(_0xcd91('0x3'));var moment=require('moment');var BPromise=require(_0xcd91('0x4'));var rp=require(_0xcd91('0x5'));var fs=require('fs');var path=require(_0xcd91('0x6'));var rimraf=require(_0xcd91('0x7'));var config=require(_0xcd91('0x8'));var attributes=require(_0xcd91('0x9'));module[_0xcd91('0xa')]=function(_0x41d25e,_0x3be965){return _0x41d25e[_0xcd91('0xb')]('VoiceContext',attributes,{'tableName':_0xcd91('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index f9cb3bc..3169f59 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 _0x10a5=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x2bf888,_0x374f0b){var _0x3038d6=function(_0xe1b6d9){while(--_0xe1b6d9){_0x2bf888['push'](_0x2bf888['shift']());}};_0x3038d6(++_0x374f0b);}(_0x10a5,0x163));var _0x510a=function(_0x56b138,_0x2396d6){_0x56b138=_0x56b138-0x0;var _0x3df878=_0x10a5[_0x56b138];return _0x3df878;};'use strict';var _=require(_0x510a('0x0'));var util=require(_0x510a('0x1'));var moment=require(_0x510a('0x2'));var BPromise=require(_0x510a('0x3'));var rs=require(_0x510a('0x4'));var fs=require('fs');var Redis=require(_0x510a('0x5'));var db=require(_0x510a('0x6'))['db'];var utils=require(_0x510a('0x7'));var logger=require(_0x510a('0x8'))(_0x510a('0x9'));var config=require(_0x510a('0xa'));var jayson=require(_0x510a('0xb'));var client=jayson[_0x510a('0xc')][_0x510a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4bdf71,_0x5a9ffa,_0x1484a1){return new BPromise(function(_0x1639dc,_0x149a3d){return client[_0x510a('0xe')](_0x4bdf71,_0x1484a1)[_0x510a('0xf')](function(_0x4737d0){logger[_0x510a('0x10')](_0x510a('0x11'),_0x5a9ffa,_0x510a('0x12'));logger['debug'](_0x510a('0x13'),_0x5a9ffa,_0x510a('0x12'),JSON['stringify'](_0x4737d0));if(_0x4737d0[_0x510a('0x14')]){if(_0x4737d0[_0x510a('0x14')][_0x510a('0x15')]===0x1f4){logger[_0x510a('0x14')](_0x510a('0x11'),_0x5a9ffa,_0x4737d0[_0x510a('0x14')][_0x510a('0x16')]);return _0x149a3d(_0x4737d0[_0x510a('0x14')]['message']);}logger[_0x510a('0x14')](_0x510a('0x11'),_0x5a9ffa,_0x4737d0['error']['message']);return _0x1639dc(_0x4737d0['error'][_0x510a('0x16')]);}else{logger[_0x510a('0x10')](_0x510a('0x11'),_0x5a9ffa,_0x510a('0x12'));_0x1639dc(_0x4737d0[_0x510a('0x17')][_0x510a('0x16')]);}})['catch'](function(_0x19f5c4){logger[_0x510a('0x14')]('VoiceContext,\x20%s,\x20%s',_0x5a9ffa,_0x19f5c4);_0x149a3d(_0x19f5c4);});});} \ No newline at end of file +var _0x9a86=['then','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4384df,_0x51b065){var _0x690d2e=function(_0xd4736a){while(--_0xd4736a){_0x4384df['push'](_0x4384df['shift']());}};_0x690d2e(++_0x51b065);}(_0x9a86,0x1ed));var _0x69a8=function(_0x408e38,_0x23cda8){_0x408e38=_0x408e38-0x0;var _0x426b0e=_0x9a86[_0x408e38];return _0x426b0e;};'use strict';var _=require(_0x69a8('0x0'));var util=require(_0x69a8('0x1'));var moment=require('moment');var BPromise=require(_0x69a8('0x2'));var rs=require(_0x69a8('0x3'));var fs=require('fs');var Redis=require(_0x69a8('0x4'));var db=require(_0x69a8('0x5'))['db'];var utils=require(_0x69a8('0x6'));var logger=require(_0x69a8('0x7'))(_0x69a8('0x8'));var config=require(_0x69a8('0x9'));var jayson=require(_0x69a8('0xa'));var client=jayson[_0x69a8('0xb')][_0x69a8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x47592b,_0x40d196,_0x308ef9){return new BPromise(function(_0x1909fc,_0x1c826b){return client['request'](_0x47592b,_0x308ef9)[_0x69a8('0xd')](function(_0xaf3ed6){logger['info'](_0x69a8('0xe'),_0x40d196,_0x69a8('0xf'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x40d196,_0x69a8('0xf'),JSON[_0x69a8('0x10')](_0xaf3ed6));if(_0xaf3ed6[_0x69a8('0x11')]){if(_0xaf3ed6[_0x69a8('0x11')]['code']===0x1f4){logger['error'](_0x69a8('0xe'),_0x40d196,_0xaf3ed6['error'][_0x69a8('0x12')]);return _0x1c826b(_0xaf3ed6[_0x69a8('0x11')][_0x69a8('0x12')]);}logger[_0x69a8('0x11')](_0x69a8('0xe'),_0x40d196,_0xaf3ed6['error'][_0x69a8('0x12')]);return _0x1909fc(_0xaf3ed6['error'][_0x69a8('0x12')]);}else{logger[_0x69a8('0x13')]('VoiceContext,\x20%s,\x20%s',_0x40d196,_0x69a8('0xf'));_0x1909fc(_0xaf3ed6[_0x69a8('0x14')][_0x69a8('0x12')]);}})[_0x69a8('0x15')](function(_0x1d3ebf){logger[_0x69a8('0x11')](_0x69a8('0xe'),_0x40d196,_0x1d3ebf);_0x1c826b(_0x1d3ebf);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index c05cb49..b21167a 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 _0xd749=['exports','multer','path','connect-timeout','Router','../../components/auth/service','get','isAuthenticated','index','/describe','/:id','show','create','put','destroy'];(function(_0x5c17d9,_0x392dab){var _0x50afa5=function(_0xa591e1){while(--_0xa591e1){_0x5c17d9['push'](_0x5c17d9['shift']());}};_0x50afa5(++_0x392dab);}(_0xd749,0x11e));var _0x9d74=function(_0x23cbbb,_0x47464c){_0x23cbbb=_0x23cbbb-0x0;var _0x5016a1=_0xd749[_0x23cbbb];return _0x5016a1;};'use strict';var multer=require(_0x9d74('0x0'));var util=require('util');var path=require(_0x9d74('0x1'));var timeout=require(_0x9d74('0x2'));var express=require('express');var router=express[_0x9d74('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9d74('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceDialReport.controller');router[_0x9d74('0x5')]('/',auth[_0x9d74('0x6')](),controller[_0x9d74('0x7')]);router[_0x9d74('0x5')](_0x9d74('0x8'),auth[_0x9d74('0x6')](),controller['describe']);router[_0x9d74('0x5')](_0x9d74('0x9'),auth[_0x9d74('0x6')](),controller[_0x9d74('0xa')]);router['post']('/',auth[_0x9d74('0x6')](),controller[_0x9d74('0xb')]);router[_0x9d74('0xc')](_0x9d74('0x9'),auth[_0x9d74('0x6')](),controller['update']);router['delete'](_0x9d74('0x9'),auth[_0x9d74('0x6')](),controller[_0x9d74('0xd')]);module[_0x9d74('0xe')]=router; \ No newline at end of file +var _0xba40=['create','update','delete','destroy','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/describe','/:id','post'];(function(_0x43f881,_0xd6e5a2){var _0x365c14=function(_0x50d386){while(--_0x50d386){_0x43f881['push'](_0x43f881['shift']());}};_0x365c14(++_0xd6e5a2);}(_0xba40,0x7b));var _0x0ba4=function(_0x4606be,_0x55649e){_0x4606be=_0x4606be-0x0;var _0x22fec4=_0xba40[_0x4606be];return _0x22fec4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0ba4('0x0'));var timeout=require(_0x0ba4('0x1'));var express=require('express');var router=express[_0x0ba4('0x2')]();var fs_extra=require(_0x0ba4('0x3'));var auth=require(_0x0ba4('0x4'));var interaction=require(_0x0ba4('0x5'));var config=require(_0x0ba4('0x6'));var controller=require(_0x0ba4('0x7'));router[_0x0ba4('0x8')]('/',auth[_0x0ba4('0x9')](),controller['index']);router[_0x0ba4('0x8')](_0x0ba4('0xa'),auth[_0x0ba4('0x9')](),controller['describe']);router[_0x0ba4('0x8')](_0x0ba4('0xb'),auth[_0x0ba4('0x9')](),controller['show']);router[_0x0ba4('0xc')]('/',auth[_0x0ba4('0x9')](),controller[_0x0ba4('0xd')]);router['put'](_0x0ba4('0xb'),auth['isAuthenticated'](),controller[_0x0ba4('0xe')]);router[_0x0ba4('0xf')](_0x0ba4('0xb'),auth[_0x0ba4('0x9')](),controller[_0x0ba4('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index f5158da..c13c8d8 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(_0x3a68c6,_0x4e14c8){var _0x1c14b5=function(_0x2c81bd){while(--_0x2c81bd){_0x3a68c6['push'](_0x3a68c6['shift']());}};_0x1c14b5(++_0x4e14c8);}(_0x34e8,0x12c));var _0x834e=function(_0x2ea16d,_0x1b1246){_0x2ea16d=_0x2ea16d-0x0;var _0x450eaf=_0x34e8[_0x2ea16d];return _0x450eaf;};'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 _0xe5b3=['STRING','INTEGER','DATE','exports'];(function(_0x41393a,_0xb93e63){var _0x9d51cd=function(_0x378b37){while(--_0x378b37){_0x41393a['push'](_0x41393a['shift']());}};_0x9d51cd(++_0xb93e63);}(_0xe5b3,0x133));var _0x3e5b=function(_0x33c0b0,_0x412ecc){_0x33c0b0=_0x33c0b0-0x0;var _0x30296b=_0xe5b3[_0x33c0b0];return _0x30296b;};'use strict';var Sequelize=require('sequelize');module[_0x3e5b('0x0')]={'privilege':{'type':Sequelize[_0x3e5b('0x1')]},'channel':{'type':Sequelize[_0x3e5b('0x1')]},'channelstate':{'type':Sequelize[_0x3e5b('0x2')]},'channelstatedesc':{'type':Sequelize[_0x3e5b('0x1')]},'calleridnum':{'type':Sequelize[_0x3e5b('0x1')]},'calleridname':{'type':Sequelize[_0x3e5b('0x1')]},'connectedlinenum':{'type':Sequelize[_0x3e5b('0x1')]},'connectedlinename':{'type':Sequelize[_0x3e5b('0x1')]},'language':{'type':Sequelize[_0x3e5b('0x1')]},'accountcode':{'type':Sequelize[_0x3e5b('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3e5b('0x1')]},'priority':{'type':Sequelize[_0x3e5b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x3e5b('0x1')]},'destchannel':{'type':Sequelize[_0x3e5b('0x1')]},'destchannelstate':{'type':Sequelize[_0x3e5b('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x3e5b('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x3e5b('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x3e5b('0x1')]},'destlanguage':{'type':Sequelize[_0x3e5b('0x1')]},'destaccountcode':{'type':Sequelize[_0x3e5b('0x1')]},'destcontext':{'type':Sequelize[_0x3e5b('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x3e5b('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x3e5b('0x1')]},'dialstring':{'type':Sequelize[_0x3e5b('0x1')]},'dialstatus':{'type':Sequelize[_0x3e5b('0x1')]},'starttime':{'type':Sequelize[_0x3e5b('0x3')]},'answertime':{'type':Sequelize[_0x3e5b('0x3')]},'endtime':{'type':Sequelize[_0x3e5b('0x3')]},'lastevent':{'type':Sequelize[_0x3e5b('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x3e5b('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index dc9308a..284f71c 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 _0x2cb9=['../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','VoiceDialReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','length','includeAll','create','body','find','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x2cb9,0x82));var _0x92cb=function(_0x24c5b1,_0x1e986b){_0x24c5b1=_0x24c5b1-0x0;var _0x3f2140=_0x2cb9[_0x24c5b1];return _0x3f2140;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x92cb('0x0'));var zipdir=require(_0x92cb('0x1'));var jsonpatch=require(_0x92cb('0x2'));var rp=require(_0x92cb('0x3'));var moment=require(_0x92cb('0x4'));var BPromise=require(_0x92cb('0x5'));var Mustache=require(_0x92cb('0x6'));var util=require('util');var path=require(_0x92cb('0x7'));var sox=require(_0x92cb('0x8'));var csv=require(_0x92cb('0x9'));var ejs=require(_0x92cb('0xa'));var fs=require('fs');var fs_extra=require(_0x92cb('0xb'));var _=require(_0x92cb('0xc'));var squel=require(_0x92cb('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x92cb('0xe'));var toCsv=require(_0x92cb('0x9'));var querystring=require('querystring');var Papa=require(_0x92cb('0xf'));var Redis=require('ioredis');var authService=require(_0x92cb('0x10'));var qs=require(_0x92cb('0x11'));var as=require(_0x92cb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x92cb('0x13'));var utils=require(_0x92cb('0x14'));var config=require(_0x92cb('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x92cb('0x16'))['db'];function respondWithStatusCode(_0x396295,_0xf45c59){_0xf45c59=_0xf45c59||0xcc;return function(_0x47949f){if(_0x47949f){return _0x396295[_0x92cb('0x17')](_0xf45c59);}return _0x396295[_0x92cb('0x18')](_0xf45c59)[_0x92cb('0x19')]();};}function respondWithResult(_0x55f2ad,_0x2d0403){_0x2d0403=_0x2d0403||0xc8;return function(_0xa06e5a){if(_0xa06e5a){return _0x55f2ad[_0x92cb('0x18')](_0x2d0403)[_0x92cb('0x1a')](_0xa06e5a);}};}function respondWithFilteredResult(_0x41eabb,_0x1a28d5){return function(_0x352dee){if(_0x352dee){var _0xe0f46d=typeof _0x1a28d5['offset']===_0x92cb('0x1b')&&typeof _0x1a28d5[_0x92cb('0x1c')]===_0x92cb('0x1b');var _0x5d545d=_0x352dee[_0x92cb('0x1d')];var _0x10a70b=_0xe0f46d?0x0:_0x1a28d5[_0x92cb('0x1e')];var _0xc55651=_0xe0f46d?_0x352dee[_0x92cb('0x1d')]:_0x1a28d5[_0x92cb('0x1e')]+_0x1a28d5['limit'];var _0x1cf6c2;if(_0xc55651>=_0x5d545d){_0xc55651=_0x5d545d;_0x1cf6c2=0xc8;}else{_0x1cf6c2=0xce;}_0x41eabb[_0x92cb('0x18')](_0x1cf6c2);return _0x41eabb[_0x92cb('0x1f')](_0x92cb('0x20'),_0x10a70b+'-'+_0xc55651+'/'+_0x5d545d)['json'](_0x352dee);}return null;};}function patchUpdates(_0x58a1eb){return function(_0x9dc54d){try{jsonpatch[_0x92cb('0x21')](_0x9dc54d,_0x58a1eb,!![]);}catch(_0xcc844f){return BPromise[_0x92cb('0x22')](_0xcc844f);}return _0x9dc54d[_0x92cb('0x23')]();};}function saveUpdates(_0x4abb47,_0x1dda2f){return function(_0x270f2f){if(_0x270f2f){return _0x270f2f[_0x92cb('0x24')](_0x4abb47)[_0x92cb('0x25')](function(_0x401542){return _0x401542;});}return null;};}function removeEntity(_0x59bb01,_0x1a4e8a){return function(_0x3e9c48){if(_0x3e9c48){return _0x3e9c48[_0x92cb('0x26')]()[_0x92cb('0x25')](function(){_0x59bb01[_0x92cb('0x18')](0xcc)[_0x92cb('0x19')]();});}};}function handleEntityNotFound(_0x294efd,_0x54ad90){return function(_0x3a9af5){if(!_0x3a9af5){_0x294efd['sendStatus'](0x194);}return _0x3a9af5;};}function handleError(_0x41da66,_0x4e2e08){_0x4e2e08=_0x4e2e08||0x1f4;return function(_0x4dffd5){logger['error'](_0x4dffd5[_0x92cb('0x27')]);if(_0x4dffd5[_0x92cb('0x28')]){delete _0x4dffd5[_0x92cb('0x28')];}_0x41da66['status'](_0x4e2e08)[_0x92cb('0x29')](_0x4dffd5);};}exports[_0x92cb('0x2a')]=function(_0x1ee195,_0x15efc3){var _0x290148={},_0xfdb5fd={},_0x572115={'count':0x0,'rows':[]};var _0x1f46e4=_[_0x92cb('0x2b')](db[_0x92cb('0x2c')][_0x92cb('0x2d')],function(_0x31d335){return{'name':_0x31d335['fieldName'],'type':_0x31d335[_0x92cb('0x2e')]['key']};});_0xfdb5fd[_0x92cb('0x2f')]=_[_0x92cb('0x2b')](_0x1f46e4,'name');_0xfdb5fd[_0x92cb('0x30')]=_[_0x92cb('0x31')](_0x1ee195[_0x92cb('0x30')]);_0xfdb5fd[_0x92cb('0x32')]=_[_0x92cb('0x33')](_0xfdb5fd[_0x92cb('0x2f')],_0xfdb5fd[_0x92cb('0x30')]);_0x290148[_0x92cb('0x34')]=_[_0x92cb('0x33')](_0xfdb5fd[_0x92cb('0x2f')],qs[_0x92cb('0x35')](_0x1ee195[_0x92cb('0x30')][_0x92cb('0x35')]));_0x290148[_0x92cb('0x34')]=_0x290148['attributes']['length']?_0x290148[_0x92cb('0x34')]:_0xfdb5fd['model'];if(!_0x1ee195[_0x92cb('0x30')][_0x92cb('0x36')](_0x92cb('0x37'))){_0x290148[_0x92cb('0x1c')]=qs[_0x92cb('0x1c')](_0x1ee195[_0x92cb('0x30')][_0x92cb('0x1c')]);_0x290148[_0x92cb('0x1e')]=qs['offset'](_0x1ee195[_0x92cb('0x30')][_0x92cb('0x1e')]);}_0x290148['order']=qs[_0x92cb('0x38')](_0x1ee195['query'][_0x92cb('0x38')]);_0x290148[_0x92cb('0x39')]=qs['filters'](_['pick'](_0x1ee195[_0x92cb('0x30')],_0xfdb5fd['filters']),_0x1f46e4);if(_0x1ee195[_0x92cb('0x30')][_0x92cb('0x3a')]){_0x290148['where']=_['merge'](_0x290148[_0x92cb('0x39')],{'$or':_[_0x92cb('0x2b')](_0x1f46e4,function(_0x18cd2a){if(_0x18cd2a[_0x92cb('0x2e')]!==_0x92cb('0x3b')){var _0x1d881e={};_0x1d881e[_0x18cd2a['name']]={'$like':'%'+_0x1ee195['query'][_0x92cb('0x3a')]+'%'};return _0x1d881e;}})});}_0x290148=_[_0x92cb('0x3c')]({},_0x290148,_0x1ee195[_0x92cb('0x3d')]);var _0x3f5429={'where':_0x290148[_0x92cb('0x39')]};return db['VoiceDialReport'][_0x92cb('0x1d')](_0x3f5429)[_0x92cb('0x25')](function(_0x4f7cf4){_0x572115[_0x92cb('0x1d')]=_0x4f7cf4;if(_0x1ee195[_0x92cb('0x30')]['includeAll']){_0x290148[_0x92cb('0x3e')]=[{'all':!![]}];}return db[_0x92cb('0x2c')][_0x92cb('0x3f')](_0x290148);})[_0x92cb('0x25')](function(_0x4ac6f4){_0x572115[_0x92cb('0x40')]=_0x4ac6f4;return _0x572115;})['then'](respondWithFilteredResult(_0x15efc3,_0x290148))['catch'](handleError(_0x15efc3,null));};exports[_0x92cb('0x41')]=function(_0x505f91,_0x2b0d05){var _0x26ead6={'raw':!![],'where':{'id':_0x505f91[_0x92cb('0x42')]['id']}},_0x514747={};_0x514747[_0x92cb('0x2f')]=_[_0x92cb('0x31')](db[_0x92cb('0x2c')][_0x92cb('0x2d')]);_0x514747['query']=_[_0x92cb('0x31')](_0x505f91[_0x92cb('0x30')]);_0x514747[_0x92cb('0x32')]=_[_0x92cb('0x33')](_0x514747[_0x92cb('0x2f')],_0x514747[_0x92cb('0x30')]);_0x26ead6[_0x92cb('0x34')]=_[_0x92cb('0x33')](_0x514747[_0x92cb('0x2f')],qs[_0x92cb('0x35')](_0x505f91[_0x92cb('0x30')]['fields']));_0x26ead6[_0x92cb('0x34')]=_0x26ead6[_0x92cb('0x34')][_0x92cb('0x43')]?_0x26ead6[_0x92cb('0x34')]:_0x514747[_0x92cb('0x2f')];if(_0x505f91[_0x92cb('0x30')][_0x92cb('0x44')]){_0x26ead6[_0x92cb('0x3e')]=[{'all':!![]}];}_0x26ead6=_['merge']({},_0x26ead6,_0x505f91[_0x92cb('0x3d')]);return db[_0x92cb('0x2c')]['find'](_0x26ead6)[_0x92cb('0x25')](handleEntityNotFound(_0x2b0d05,null))['then'](respondWithResult(_0x2b0d05,null))['catch'](handleError(_0x2b0d05,null));};exports[_0x92cb('0x45')]=function(_0x2fc9df,_0x48a29d){return db[_0x92cb('0x2c')][_0x92cb('0x45')](_0x2fc9df[_0x92cb('0x46')],{})['then'](respondWithResult(_0x48a29d,0xc9))['catch'](handleError(_0x48a29d,null));};exports[_0x92cb('0x24')]=function(_0x4ff1df,_0x3c3246){if(_0x4ff1df[_0x92cb('0x46')]['id']){delete _0x4ff1df[_0x92cb('0x46')]['id'];}return db['VoiceDialReport'][_0x92cb('0x47')]({'where':{'id':_0x4ff1df[_0x92cb('0x42')]['id']}})[_0x92cb('0x25')](handleEntityNotFound(_0x3c3246,null))[_0x92cb('0x25')](saveUpdates(_0x4ff1df[_0x92cb('0x46')],null))[_0x92cb('0x25')](respondWithResult(_0x3c3246,null))[_0x92cb('0x48')](handleError(_0x3c3246,null));};exports[_0x92cb('0x26')]=function(_0x3d6a54,_0x2a3bc5){return db[_0x92cb('0x2c')][_0x92cb('0x47')]({'where':{'id':_0x3d6a54['params']['id']}})[_0x92cb('0x25')](handleEntityNotFound(_0x2a3bc5,null))[_0x92cb('0x25')](removeEntity(_0x2a3bc5,null))[_0x92cb('0x48')](handleError(_0x2a3bc5,null));};exports[_0x92cb('0x49')]=function(_0x263975,_0x23135b){return db[_0x92cb('0x2c')][_0x92cb('0x49')]()[_0x92cb('0x25')](respondWithResult(_0x23135b,null))['catch'](handleError(_0x23135b,null));}; \ No newline at end of file +var _0x891b=['includeAll','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','sendStatus','error','stack','name','send','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','length'];(function(_0x2443aa,_0xf16068){var _0x52af88=function(_0x5ac633){while(--_0x5ac633){_0x2443aa['push'](_0x2443aa['shift']());}};_0x52af88(++_0xf16068);}(_0x891b,0x1c2));var _0xb891=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x891b[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xb891('0x0'));var rimraf=require(_0xb891('0x1'));var zipdir=require(_0xb891('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb891('0x3'));var moment=require(_0xb891('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb891('0x5'));var util=require('util');var path=require(_0xb891('0x6'));var sox=require(_0xb891('0x7'));var csv=require(_0xb891('0x8'));var ejs=require(_0xb891('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb891('0xa'));var crypto=require(_0xb891('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb891('0x8'));var querystring=require('querystring');var Papa=require(_0xb891('0xc'));var Redis=require(_0xb891('0xd'));var authService=require(_0xb891('0xe'));var qs=require(_0xb891('0xf'));var as=require(_0xb891('0x10'));var hardwareService=require(_0xb891('0x11'));var logger=require(_0xb891('0x12'))(_0xb891('0x13'));var utils=require('../../config/utils');var config=require(_0xb891('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb891('0x15'))['db'];function respondWithStatusCode(_0x5817fa,_0x389335){_0x389335=_0x389335||0xcc;return function(_0x525fd6){if(_0x525fd6){return _0x5817fa['sendStatus'](_0x389335);}return _0x5817fa[_0xb891('0x16')](_0x389335)[_0xb891('0x17')]();};}function respondWithResult(_0x535c94,_0x5f079d){_0x5f079d=_0x5f079d||0xc8;return function(_0x32e8bf){if(_0x32e8bf){return _0x535c94[_0xb891('0x16')](_0x5f079d)[_0xb891('0x18')](_0x32e8bf);}};}function respondWithFilteredResult(_0x3344f2,_0x298716){return function(_0x2da5c3){if(_0x2da5c3){var _0x17a69e=typeof _0x298716['offset']===_0xb891('0x19')&&typeof _0x298716[_0xb891('0x1a')]===_0xb891('0x19');var _0x444110=_0x2da5c3[_0xb891('0x1b')];var _0x416d70=_0x17a69e?0x0:_0x298716[_0xb891('0x1c')];var _0x320fde=_0x17a69e?_0x2da5c3['count']:_0x298716[_0xb891('0x1c')]+_0x298716[_0xb891('0x1a')];var _0x441e58;if(_0x320fde>=_0x444110){_0x320fde=_0x444110;_0x441e58=0xc8;}else{_0x441e58=0xce;}_0x3344f2[_0xb891('0x16')](_0x441e58);return _0x3344f2['set'](_0xb891('0x1d'),_0x416d70+'-'+_0x320fde+'/'+_0x444110)[_0xb891('0x18')](_0x2da5c3);}return null;};}function patchUpdates(_0x5996a4){return function(_0x6a7cbe){try{jsonpatch[_0xb891('0x1e')](_0x6a7cbe,_0x5996a4,!![]);}catch(_0x3f29c6){return BPromise['reject'](_0x3f29c6);}return _0x6a7cbe[_0xb891('0x1f')]();};}function saveUpdates(_0x4b3010,_0x4a9800){return function(_0x171a82){if(_0x171a82){return _0x171a82[_0xb891('0x20')](_0x4b3010)[_0xb891('0x21')](function(_0x18798c){return _0x18798c;});}return null;};}function removeEntity(_0x34ab19,_0x3e553c){return function(_0x34ab17){if(_0x34ab17){return _0x34ab17['destroy']()['then'](function(){_0x34ab19[_0xb891('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ca6cc,_0x120390){return function(_0x5d01){if(!_0x5d01){_0x2ca6cc[_0xb891('0x22')](0x194);}return _0x5d01;};}function handleError(_0x3d5aa0,_0x539373){_0x539373=_0x539373||0x1f4;return function(_0x5daf32){logger[_0xb891('0x23')](_0x5daf32[_0xb891('0x24')]);if(_0x5daf32[_0xb891('0x25')]){delete _0x5daf32['name'];}_0x3d5aa0[_0xb891('0x16')](_0x539373)[_0xb891('0x26')](_0x5daf32);};}exports['index']=function(_0x3282a9,_0x17b9a4){var _0x53046f={},_0x11737b={},_0x3577bb={'count':0x0,'rows':[]};var _0x3976b6=_[_0xb891('0x27')](db[_0xb891('0x28')][_0xb891('0x29')],function(_0x5122aa){return{'name':_0x5122aa[_0xb891('0x2a')],'type':_0x5122aa[_0xb891('0x2b')][_0xb891('0x2c')]};});_0x11737b[_0xb891('0x2d')]=_[_0xb891('0x27')](_0x3976b6,_0xb891('0x25'));_0x11737b[_0xb891('0x2e')]=_[_0xb891('0x2f')](_0x3282a9[_0xb891('0x2e')]);_0x11737b['filters']=_[_0xb891('0x30')](_0x11737b[_0xb891('0x2d')],_0x11737b[_0xb891('0x2e')]);_0x53046f['attributes']=_[_0xb891('0x30')](_0x11737b[_0xb891('0x2d')],qs[_0xb891('0x31')](_0x3282a9['query'][_0xb891('0x31')]));_0x53046f[_0xb891('0x32')]=_0x53046f[_0xb891('0x32')]['length']?_0x53046f[_0xb891('0x32')]:_0x11737b[_0xb891('0x2d')];if(!_0x3282a9[_0xb891('0x2e')]['hasOwnProperty'](_0xb891('0x33'))){_0x53046f[_0xb891('0x1a')]=qs['limit'](_0x3282a9[_0xb891('0x2e')][_0xb891('0x1a')]);_0x53046f['offset']=qs[_0xb891('0x1c')](_0x3282a9[_0xb891('0x2e')]['offset']);}_0x53046f[_0xb891('0x34')]=qs[_0xb891('0x35')](_0x3282a9[_0xb891('0x2e')][_0xb891('0x35')]);_0x53046f[_0xb891('0x36')]=qs[_0xb891('0x37')](_[_0xb891('0x38')](_0x3282a9['query'],_0x11737b[_0xb891('0x37')]),_0x3976b6);if(_0x3282a9[_0xb891('0x2e')]['filter']){_0x53046f[_0xb891('0x36')]=_[_0xb891('0x39')](_0x53046f[_0xb891('0x36')],{'$or':_[_0xb891('0x27')](_0x3976b6,function(_0x115146){if(_0x115146[_0xb891('0x2b')]!==_0xb891('0x3a')){var _0x59c500={};_0x59c500[_0x115146['name']]={'$like':'%'+_0x3282a9['query'][_0xb891('0x3b')]+'%'};return _0x59c500;}})});}_0x53046f=_[_0xb891('0x39')]({},_0x53046f,_0x3282a9[_0xb891('0x3c')]);var _0x216928={'where':_0x53046f['where']};return db[_0xb891('0x28')]['count'](_0x216928)[_0xb891('0x21')](function(_0xdffc3a){_0x3577bb[_0xb891('0x1b')]=_0xdffc3a;if(_0x3282a9[_0xb891('0x2e')]['includeAll']){_0x53046f[_0xb891('0x3d')]=[{'all':!![]}];}return db[_0xb891('0x28')][_0xb891('0x3e')](_0x53046f);})[_0xb891('0x21')](function(_0x5c9e5e){_0x3577bb[_0xb891('0x3f')]=_0x5c9e5e;return _0x3577bb;})[_0xb891('0x21')](respondWithFilteredResult(_0x17b9a4,_0x53046f))[_0xb891('0x40')](handleError(_0x17b9a4,null));};exports[_0xb891('0x41')]=function(_0x1ac4f9,_0x5e73ac){var _0x2b5836={'raw':!![],'where':{'id':_0x1ac4f9[_0xb891('0x42')]['id']}},_0xa172bb={};_0xa172bb['model']=_['keys'](db['VoiceDialReport'][_0xb891('0x29')]);_0xa172bb['query']=_[_0xb891('0x2f')](_0x1ac4f9['query']);_0xa172bb[_0xb891('0x37')]=_[_0xb891('0x30')](_0xa172bb[_0xb891('0x2d')],_0xa172bb[_0xb891('0x2e')]);_0x2b5836[_0xb891('0x32')]=_[_0xb891('0x30')](_0xa172bb[_0xb891('0x2d')],qs['fields'](_0x1ac4f9[_0xb891('0x2e')]['fields']));_0x2b5836['attributes']=_0x2b5836[_0xb891('0x32')][_0xb891('0x43')]?_0x2b5836[_0xb891('0x32')]:_0xa172bb[_0xb891('0x2d')];if(_0x1ac4f9[_0xb891('0x2e')][_0xb891('0x44')]){_0x2b5836[_0xb891('0x3d')]=[{'all':!![]}];}_0x2b5836=_[_0xb891('0x39')]({},_0x2b5836,_0x1ac4f9['options']);return db['VoiceDialReport'][_0xb891('0x45')](_0x2b5836)[_0xb891('0x21')](handleEntityNotFound(_0x5e73ac,null))[_0xb891('0x21')](respondWithResult(_0x5e73ac,null))[_0xb891('0x40')](handleError(_0x5e73ac,null));};exports[_0xb891('0x46')]=function(_0x3f4eb2,_0x3a29b5){return db['VoiceDialReport'][_0xb891('0x46')](_0x3f4eb2[_0xb891('0x47')],{})['then'](respondWithResult(_0x3a29b5,0xc9))['catch'](handleError(_0x3a29b5,null));};exports[_0xb891('0x20')]=function(_0x4d67a2,_0xa52d83){if(_0x4d67a2[_0xb891('0x47')]['id']){delete _0x4d67a2[_0xb891('0x47')]['id'];}return db[_0xb891('0x28')][_0xb891('0x45')]({'where':{'id':_0x4d67a2[_0xb891('0x42')]['id']}})[_0xb891('0x21')](handleEntityNotFound(_0xa52d83,null))[_0xb891('0x21')](saveUpdates(_0x4d67a2['body'],null))['then'](respondWithResult(_0xa52d83,null))['catch'](handleError(_0xa52d83,null));};exports[_0xb891('0x48')]=function(_0x4c3130,_0x16524c){return db[_0xb891('0x28')]['find']({'where':{'id':_0x4c3130[_0xb891('0x42')]['id']}})[_0xb891('0x21')](handleEntityNotFound(_0x16524c,null))[_0xb891('0x21')](removeEntity(_0x16524c,null))[_0xb891('0x40')](handleError(_0x16524c,null));};exports[_0xb891('0x49')]=function(_0x1d400a,_0x72cf6c){return db['VoiceDialReport'][_0xb891('0x49')]()['then'](respondWithResult(_0x72cf6c,null))[_0xb891('0x40')](handleError(_0x72cf6c,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 9545cb2..b3bc55f 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 _0xfbb8=['VoiceDialReport','uniqueid','lodash','util','../../config/logger','api','bluebird','path','rimraf','./voiceDialReport.attributes'];(function(_0x255f3b,_0x5e4699){var _0x849fda=function(_0x2d31ca){while(--_0x2d31ca){_0x255f3b['push'](_0x255f3b['shift']());}};_0x849fda(++_0x5e4699);}(_0xfbb8,0x160));var _0x8fbb=function(_0x590381,_0x5c3948){_0x590381=_0x590381-0x0;var _0xe300df=_0xfbb8[_0x590381];return _0xe300df;};'use strict';var _=require(_0x8fbb('0x0'));var util=require(_0x8fbb('0x1'));var logger=require(_0x8fbb('0x2'))(_0x8fbb('0x3'));var moment=require('moment');var BPromise=require(_0x8fbb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8fbb('0x5'));var rimraf=require(_0x8fbb('0x6'));var config=require('../../config/environment');var attributes=require(_0x8fbb('0x7'));module['exports']=function(_0x292a4a,_0x3c14a9){return _0x292a4a['define'](_0x8fbb('0x8'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x8fbb('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd7ff=['define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceDialReport.attributes','exports'];(function(_0x1b1b2c,_0x3ebae4){var _0x55e805=function(_0x1ee3f3){while(--_0x1ee3f3){_0x1b1b2c['push'](_0x1b1b2c['shift']());}};_0x55e805(++_0x3ebae4);}(_0xd7ff,0x100));var _0xfd7f=function(_0x9e6a6e,_0x33d8c3){_0x9e6a6e=_0x9e6a6e-0x0;var _0x2a5bee=_0xd7ff[_0x9e6a6e];return _0x2a5bee;};'use strict';var _=require(_0xfd7f('0x0'));var util=require(_0xfd7f('0x1'));var logger=require(_0xfd7f('0x2'))(_0xfd7f('0x3'));var moment=require(_0xfd7f('0x4'));var BPromise=require(_0xfd7f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfd7f('0x6'));var config=require(_0xfd7f('0x7'));var attributes=require(_0xfd7f('0x8'));module[_0xfd7f('0x9')]=function(_0x552335,_0x38bdfe){return _0x552335[_0xfd7f('0xa')](_0xfd7f('0xb'),attributes,{'tableName':_0xfd7f('0xc'),'paranoid':![],'indexes':[{'fields':[_0xfd7f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index a4bd405..77bc30f 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 _0x16bb=['rpc','../../config/environment','jayson/promise','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','update','where','limit','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x10c190,_0xda61fe){var _0x3ed8ec=function(_0x2dbbfd){while(--_0x2dbbfd){_0x10c190['push'](_0x10c190['shift']());}};_0x3ed8ec(++_0xda61fe);}(_0x16bb,0x72));var _0xb16b=function(_0x3d8f21,_0x359d21){_0x3d8f21=_0x3d8f21-0x0;var _0x3cdde5=_0x16bb[_0x3d8f21];return _0x3cdde5;};'use strict';var _=require('lodash');var util=require(_0xb16b('0x0'));var moment=require(_0xb16b('0x1'));var BPromise=require('bluebird');var rs=require(_0xb16b('0x2'));var fs=require('fs');var Redis=require(_0xb16b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb16b('0x4'));var logger=require(_0xb16b('0x5'))(_0xb16b('0x6'));var config=require(_0xb16b('0x7'));var jayson=require(_0xb16b('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x37ca56,_0x539bde,_0x1ab1a4){return new BPromise(function(_0x316c85,_0x3d7a1e){return client['request'](_0x37ca56,_0x1ab1a4)[_0xb16b('0x9')](function(_0x132d8b){logger[_0xb16b('0xa')](_0xb16b('0xb'),_0x539bde,_0xb16b('0xc'));logger[_0xb16b('0xd')](_0xb16b('0xe'),_0x539bde,_0xb16b('0xc'),JSON[_0xb16b('0xf')](_0x132d8b));if(_0x132d8b['error']){if(_0x132d8b['error']['code']===0x1f4){logger[_0xb16b('0x10')](_0xb16b('0xb'),_0x539bde,_0x132d8b['error'][_0xb16b('0x11')]);return _0x3d7a1e(_0x132d8b['error'][_0xb16b('0x11')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x539bde,_0x132d8b[_0xb16b('0x10')]['message']);return _0x316c85(_0x132d8b[_0xb16b('0x10')][_0xb16b('0x11')]);}else{logger[_0xb16b('0xa')](_0xb16b('0xb'),_0x539bde,_0xb16b('0xc'));_0x316c85(_0x132d8b[_0xb16b('0x12')]['message']);}})[_0xb16b('0x13')](function(_0x47e1d1){logger[_0xb16b('0x10')](_0xb16b('0xb'),_0x539bde,_0x47e1d1);_0x3d7a1e(_0x47e1d1);});});}exports[_0xb16b('0x14')]=function(_0x2a8918){var _0x59f423=this;return new Promise(function(_0x5092f7,_0x1e6c2c){return db[_0xb16b('0x15')][_0xb16b('0x16')](_0x2a8918[_0xb16b('0x17')],{'raw':_0x2a8918[_0xb16b('0x18')]?_0x2a8918['options'][_0xb16b('0x19')]===undefined?!![]:![]:!![]})[_0xb16b('0x9')](function(_0x447647){logger[_0xb16b('0xa')](_0xb16b('0x14'),_0x2a8918);logger['debug'](_0xb16b('0x14'),_0x2a8918,JSON[_0xb16b('0xf')](_0x447647));_0x5092f7(_0x447647);})[_0xb16b('0x13')](function(_0x342f5a){logger[_0xb16b('0x10')](_0xb16b('0x14'),_0x342f5a['message'],_0x2a8918);_0x1e6c2c(_0x59f423[_0xb16b('0x10')](0x1f4,_0x342f5a[_0xb16b('0x11')]));});});};exports[_0xb16b('0x1a')]=function(_0x54175a){var _0x320434=this;return new Promise(function(_0x2b3d05,_0x4cbc92){return db['VoiceDialReport'][_0xb16b('0x1b')](_0x54175a[_0xb16b('0x17')],{'raw':_0x54175a[_0xb16b('0x18')]?_0x54175a['options'][_0xb16b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54175a[_0xb16b('0x18')]?_0x54175a['options'][_0xb16b('0x1c')]||null:null,'attributes':_0x54175a[_0xb16b('0x18')]?_0x54175a[_0xb16b('0x18')]['attributes']||null:null,'limit':_0x54175a[_0xb16b('0x18')]?_0x54175a[_0xb16b('0x18')][_0xb16b('0x1d')]||null:null})[_0xb16b('0x9')](function(_0x1ee6f4){logger['info'](_0xb16b('0x1a'),_0x54175a);logger[_0xb16b('0xd')](_0xb16b('0x1a'),_0x54175a,JSON[_0xb16b('0xf')](_0x1ee6f4));_0x2b3d05(_0x1ee6f4);})[_0xb16b('0x13')](function(_0x27099c){logger[_0xb16b('0x10')]('UpdateVoiceDialReport',_0x27099c[_0xb16b('0x11')],_0x54175a);_0x4cbc92(_0x320434[_0xb16b('0x10')](0x1f4,_0x27099c['message']));});});}; \ No newline at end of file +var _0x934b=['limit','UpdateVoiceDialReport','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','options','raw','update','body','where'];(function(_0x176144,_0x5d86bf){var _0x5e7ba7=function(_0xf754f3){while(--_0xf754f3){_0x176144['push'](_0x176144['shift']());}};_0x5e7ba7(++_0x5d86bf);}(_0x934b,0x176));var _0xb934=function(_0x5c846d,_0x5c02ce){_0x5c846d=_0x5c846d-0x0;var _0xd064e4=_0x934b[_0x5c846d];return _0xd064e4;};'use strict';var _=require(_0xb934('0x0'));var util=require(_0xb934('0x1'));var moment=require('moment');var BPromise=require(_0xb934('0x2'));var rs=require(_0xb934('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb934('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb934('0x5'))('rpc');var config=require(_0xb934('0x6'));var jayson=require(_0xb934('0x7'));var client=jayson[_0xb934('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x480399,_0x50ceaf,_0xf736e1){return new BPromise(function(_0x1cfb1b,_0x5732a2){return client[_0xb934('0x9')](_0x480399,_0xf736e1)[_0xb934('0xa')](function(_0x3267d1){logger[_0xb934('0xb')](_0xb934('0xc'),_0x50ceaf,_0xb934('0xd'));logger[_0xb934('0xe')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x50ceaf,_0xb934('0xd'),JSON[_0xb934('0xf')](_0x3267d1));if(_0x3267d1[_0xb934('0x10')]){if(_0x3267d1['error'][_0xb934('0x11')]===0x1f4){logger['error'](_0xb934('0xc'),_0x50ceaf,_0x3267d1[_0xb934('0x10')][_0xb934('0x12')]);return _0x5732a2(_0x3267d1[_0xb934('0x10')][_0xb934('0x12')]);}logger[_0xb934('0x10')](_0xb934('0xc'),_0x50ceaf,_0x3267d1[_0xb934('0x10')][_0xb934('0x12')]);return _0x1cfb1b(_0x3267d1['error'][_0xb934('0x12')]);}else{logger[_0xb934('0xb')](_0xb934('0xc'),_0x50ceaf,'request\x20sent');_0x1cfb1b(_0x3267d1[_0xb934('0x13')][_0xb934('0x12')]);}})[_0xb934('0x14')](function(_0x5e20d0){logger[_0xb934('0x10')](_0xb934('0xc'),_0x50ceaf,_0x5e20d0);_0x5732a2(_0x5e20d0);});});}exports[_0xb934('0x15')]=function(_0x69b453){var _0xa29515=this;return new Promise(function(_0x3643ab,_0x4eb51a){return db[_0xb934('0x16')][_0xb934('0x17')](_0x69b453['body'],{'raw':_0x69b453['options']?_0x69b453[_0xb934('0x18')][_0xb934('0x19')]===undefined?!![]:![]:!![]})[_0xb934('0xa')](function(_0x4cf985){logger[_0xb934('0xb')](_0xb934('0x15'),_0x69b453);logger[_0xb934('0xe')](_0xb934('0x15'),_0x69b453,JSON[_0xb934('0xf')](_0x4cf985));_0x3643ab(_0x4cf985);})[_0xb934('0x14')](function(_0x4864ab){logger[_0xb934('0x10')](_0xb934('0x15'),_0x4864ab['message'],_0x69b453);_0x4eb51a(_0xa29515[_0xb934('0x10')](0x1f4,_0x4864ab[_0xb934('0x12')]));});});};exports['UpdateVoiceDialReport']=function(_0x41be9c){var _0x517c4f=this;return new Promise(function(_0x2f059c,_0x3fe1d2){return db[_0xb934('0x16')][_0xb934('0x1a')](_0x41be9c[_0xb934('0x1b')],{'raw':_0x41be9c['options']?_0x41be9c[_0xb934('0x18')][_0xb934('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41be9c[_0xb934('0x18')]?_0x41be9c['options'][_0xb934('0x1c')]||null:null,'attributes':_0x41be9c[_0xb934('0x18')]?_0x41be9c[_0xb934('0x18')]['attributes']||null:null,'limit':_0x41be9c[_0xb934('0x18')]?_0x41be9c[_0xb934('0x18')][_0xb934('0x1d')]||null:null})[_0xb934('0xa')](function(_0x5e9afa){logger[_0xb934('0xb')]('UpdateVoiceDialReport',_0x41be9c);logger[_0xb934('0xe')](_0xb934('0x1e'),_0x41be9c,JSON['stringify'](_0x5e9afa));_0x2f059c(_0x5e9afa);})[_0xb934('0x14')](function(_0x376892){logger[_0xb934('0x10')](_0xb934('0x1e'),_0x376892[_0xb934('0x12')],_0x41be9c);_0x3fe1d2(_0x517c4f[_0xb934('0x10')](0x1f4,_0x376892[_0xb934('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 48d1a6e..8b2c3f1 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 _0x9b6a=['../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','create','post','/:id/applications','addApplications','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service'];(function(_0x3895b7,_0xd4796b){var _0x3f3b8c=function(_0x43a116){while(--_0x43a116){_0x3895b7['push'](_0x3895b7['shift']());}};_0x3f3b8c(++_0xd4796b);}(_0x9b6a,0xdf));var _0xa9b6=function(_0x5b3487,_0x27dc26){_0x5b3487=_0x5b3487-0x0;var _0x2a8f2e=_0x9b6a[_0x5b3487];return _0x2a8f2e;};'use strict';var multer=require(_0xa9b6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa9b6('0x1'));var router=express[_0xa9b6('0x2')]();var fs_extra=require(_0xa9b6('0x3'));var auth=require(_0xa9b6('0x4'));var interaction=require(_0xa9b6('0x5'));var config=require(_0xa9b6('0x6'));var controller=require(_0xa9b6('0x7'));router[_0xa9b6('0x8')]('/',auth[_0xa9b6('0x9')](),controller[_0xa9b6('0xa')]);router['get'](_0xa9b6('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xa9b6('0x9')](),controller[_0xa9b6('0xc')]);router[_0xa9b6('0xd')](_0xa9b6('0xe'),auth[_0xa9b6('0x9')](),controller[_0xa9b6('0xf')]);router['put'](_0xa9b6('0xb'),auth[_0xa9b6('0x9')](),controller['update']);router[_0xa9b6('0x10')](_0xa9b6('0xb'),auth[_0xa9b6('0x9')](),controller[_0xa9b6('0x11')]);module[_0xa9b6('0x12')]=router; \ No newline at end of file +var _0xf6ba=['isAuthenticated','index','/:id','post','create','/:id/applications','addApplications','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0xf6ba,0x10e));var _0xaf6b=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xf6ba[_0x173441];return _0x2423a8;};'use strict';var multer=require(_0xaf6b('0x0'));var util=require(_0xaf6b('0x1'));var path=require('path');var timeout=require(_0xaf6b('0x2'));var express=require(_0xaf6b('0x3'));var router=express[_0xaf6b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xaf6b('0x5'));var interaction=require(_0xaf6b('0x6'));var config=require(_0xaf6b('0x7'));var controller=require(_0xaf6b('0x8'));router[_0xaf6b('0x9')]('/',auth[_0xaf6b('0xa')](),controller[_0xaf6b('0xb')]);router[_0xaf6b('0x9')](_0xaf6b('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xaf6b('0xd')]('/',auth[_0xaf6b('0xa')](),controller[_0xaf6b('0xe')]);router['post'](_0xaf6b('0xf'),auth[_0xaf6b('0xa')](),controller[_0xaf6b('0x10')]);router['put'](_0xaf6b('0xc'),auth[_0xaf6b('0xa')](),controller[_0xaf6b('0x11')]);router['delete']('/:id',auth[_0xaf6b('0xa')](),controller[_0xaf6b('0x12')]);module[_0xaf6b('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index d26477e..3b9a052 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 _0x2c34=['compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x2c34,0xe1));var _0x42c3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x2c34[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x42c3('0x0'));module[_0x42c3('0x1')]={'context':{'type':Sequelize[_0x42c3('0x2')],'allowNull':![],'unique':_0x42c3('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x42c3('0x2')],'allowNull':![],'unique':_0x42c3('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x42c3('0x3')},'tag':{'type':Sequelize[_0x42c3('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x42c3('0x2')],'allowNull':![],'defaultValue':_0x42c3('0x4')},'appdata':{'type':Sequelize[_0x42c3('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x42c3('0x5')](_0x42c3('0x6'),_0x42c3('0x7'),_0x42c3('0x8'),_0x42c3('0x9'),_0x42c3('0xa'),'system',_0x42c3('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0x42c3('0x2')]},'interval':{'type':Sequelize[_0x42c3('0x2')],'allowNull':![],'defaultValue':_0x42c3('0xc')},'IntervalId':{'type':Sequelize[_0x42c3('0xd')]},'isApp':{'type':Sequelize[_0x42c3('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x42c3('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x42c3('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x42c3('0xe')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x42c3('0xd')]},'recordingFormat':{'type':Sequelize[_0x42c3('0x2')],'defaultValue':_0x42c3('0xf')},'answer':{'type':Sequelize[_0x42c3('0xe')],'defaultValue':!![]},'name':{'type':Sequelize[_0x42c3('0x10')],'get':function(_0x5d32cf){return this[_0x42c3('0x11')](_0x42c3('0x12'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x4b3d=['any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','inbound-fax','outbound-fax','system'];(function(_0x63a22,_0x5107ab){var _0x44a5f7=function(_0x24be7e){while(--_0x24be7e){_0x63a22['push'](_0x63a22['shift']());}};_0x44a5f7(++_0x5107ab);}(_0x4b3d,0x1e3));var _0xd4b3=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x4b3d[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0xd4b3('0x0'));module[_0xd4b3('0x1')]={'context':{'type':Sequelize[_0xd4b3('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xd4b3('0x2')],'allowNull':![],'unique':_0xd4b3('0x3')},'priority':{'type':Sequelize[_0xd4b3('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xd4b3('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd4b3('0x4')},'appdata':{'type':Sequelize[_0xd4b3('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xd4b3('0x5')](_0xd4b3('0x6'),_0xd4b3('0x7'),'internal',_0xd4b3('0x8'),_0xd4b3('0x9'),_0xd4b3('0xa'),_0xd4b3('0xb')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd4b3('0xc')},'IntervalId':{'type':Sequelize[_0xd4b3('0xd')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xd4b3('0x2')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0xd4b3('0xe')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xd4b3('0xd')]},'recordingFormat':{'type':Sequelize[_0xd4b3('0x2')],'defaultValue':_0xd4b3('0xf')},'answer':{'type':Sequelize[_0xd4b3('0xe')],'defaultValue':!![]},'name':{'type':Sequelize[_0xd4b3('0x10')],'get':function(_0x57b53a){return this[_0xd4b3('0x11')](_0xd4b3('0x12'));}},'alias':{'type':Sequelize[_0xd4b3('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 9716113..437404c 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 _0xc0c2=['ignore','value','includes','type','find','name','UserProfileResource','error','stack','send','index','map','VoiceExtension','fieldName','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','recordingFormat','cutdigits','alias','context','addApplications','findOne','sequelize','transaction','rewriteDial','toLowerCase','true','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','end','status','json','offset','undefined','limit','count','set','save','update','then','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter'];(function(_0x40bde9,_0x50f93d){var _0x3195b0=function(_0x146205){while(--_0x146205){_0x40bde9['push'](_0x40bde9['shift']());}};_0x3195b0(++_0x50f93d);}(_0xc0c2,0x195));var _0x2c0c=function(_0x40b723,_0x118b22){_0x40b723=_0x40b723-0x0;var _0x1981ad=_0xc0c2[_0x40b723];return _0x1981ad;};'use strict';var emlformat=require(_0x2c0c('0x0'));var rimraf=require(_0x2c0c('0x1'));var zipdir=require(_0x2c0c('0x2'));var jsonpatch=require(_0x2c0c('0x3'));var rp=require(_0x2c0c('0x4'));var moment=require('moment');var BPromise=require(_0x2c0c('0x5'));var Mustache=require(_0x2c0c('0x6'));var util=require('util');var path=require(_0x2c0c('0x7'));var sox=require('sox');var csv=require(_0x2c0c('0x8'));var ejs=require(_0x2c0c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2c0c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2c0c('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2c0c('0xc'));var Papa=require(_0x2c0c('0xd'));var Redis=require(_0x2c0c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2c0c('0xf'));var as=require(_0x2c0c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2c0c('0x11'))(_0x2c0c('0x12'));var utils=require('../../config/utils');var config=require(_0x2c0c('0x13'));var licenseUtil=require(_0x2c0c('0x14'));var db=require(_0x2c0c('0x15'))['db'];config['redis']=_[_0x2c0c('0x16')](config[_0x2c0c('0x17')],{'host':_0x2c0c('0x18'),'port':0x18eb});var socket=require(_0x2c0c('0x19'))(new Redis(config[_0x2c0c('0x17')]));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x4c87e1,_0xa84d82){_0xa84d82=_0xa84d82||0xcc;return function(_0x5c56f7){if(_0x5c56f7){return _0x4c87e1[_0x2c0c('0x1a')](_0xa84d82);}return _0x4c87e1['status'](_0xa84d82)[_0x2c0c('0x1b')]();};}function respondWithResult(_0x835566,_0x54e436){_0x54e436=_0x54e436||0xc8;return function(_0x5237e9){if(_0x5237e9){return _0x835566[_0x2c0c('0x1c')](_0x54e436)[_0x2c0c('0x1d')](_0x5237e9);}};}function respondWithFilteredResult(_0x3b9eb5,_0x4035c8){return function(_0xbe3188){if(_0xbe3188){var _0x165060=typeof _0x4035c8[_0x2c0c('0x1e')]===_0x2c0c('0x1f')&&typeof _0x4035c8[_0x2c0c('0x20')]==='undefined';var _0x433fe8=_0xbe3188[_0x2c0c('0x21')];var _0x1c037f=_0x165060?0x0:_0x4035c8[_0x2c0c('0x1e')];var _0x5a83fe=_0x165060?_0xbe3188[_0x2c0c('0x21')]:_0x4035c8[_0x2c0c('0x1e')]+_0x4035c8['limit'];var _0xc81656;if(_0x5a83fe>=_0x433fe8){_0x5a83fe=_0x433fe8;_0xc81656=0xc8;}else{_0xc81656=0xce;}_0x3b9eb5['status'](_0xc81656);return _0x3b9eb5[_0x2c0c('0x22')]('Content-Range',_0x1c037f+'-'+_0x5a83fe+'/'+_0x433fe8)[_0x2c0c('0x1d')](_0xbe3188);}return null;};}function patchUpdates(_0x193f10){return function(_0x4610df){try{jsonpatch['apply'](_0x4610df,_0x193f10,!![]);}catch(_0x171292){return BPromise['reject'](_0x171292);}return _0x4610df[_0x2c0c('0x23')]();};}function saveUpdates(_0x41ccee,_0x1c7290){return function(_0x534697){if(_0x534697){return _0x534697[_0x2c0c('0x24')](_0x41ccee)[_0x2c0c('0x25')](function(_0x178cf4){return _0x178cf4;});}return null;};}function removeEntity(_0x49805c,_0x3eba15){return function(_0x17e109){if(_0x17e109){return _0x17e109[_0x2c0c('0x26')]()[_0x2c0c('0x25')](function(){var _0x41f726=_0x17e109[_0x2c0c('0x27')]({'plain':!![]});var _0x49d6fe=[{'name':_0x2c0c('0x28'),'value':_0x2c0c('0x29'),'ignore':![]},{'name':_0x2c0c('0x2a'),'value':_0x2c0c('0x2b'),'ignore':![]},{'name':_0x2c0c('0x2c'),'value':_0x2c0c('0x2d'),'ignore':![]}];var _0x4ceb7c=_(_0x49d6fe)[_0x2c0c('0x2e')](_0x2c0c('0x2f'))['map'](_0x2c0c('0x30'))['value']();if(_[_0x2c0c('0x31')](_0x4ceb7c,_0x41f726[_0x2c0c('0x32')])){return;}var _0x32eaa4=_[_0x2c0c('0x33')](_0x49d6fe,[_0x2c0c('0x30'),_0x41f726[_0x2c0c('0x32')]])[_0x2c0c('0x34')];return db[_0x2c0c('0x35')]['destroy']({'where':{'type':_0x32eaa4,'resourceId':_0x41f726['id']}})[_0x2c0c('0x25')](function(){return _0x17e109;});})[_0x2c0c('0x25')](function(){_0x49805c[_0x2c0c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x252ad6,_0x3a4959){return function(_0x116d45){if(!_0x116d45){_0x252ad6[_0x2c0c('0x1a')](0x194);}return _0x116d45;};}function handleError(_0x2d44aa,_0x1c1aee){_0x1c1aee=_0x1c1aee||0x1f4;return function(_0x248af4){logger[_0x2c0c('0x36')](_0x248af4[_0x2c0c('0x37')]);if(_0x248af4[_0x2c0c('0x34')]){delete _0x248af4[_0x2c0c('0x34')];}_0x2d44aa[_0x2c0c('0x1c')](_0x1c1aee)[_0x2c0c('0x38')](_0x248af4);};}exports[_0x2c0c('0x39')]=function(_0x2794ff,_0x341da3){var _0x4b69b9={},_0x3f2584={},_0x5b04d7={'count':0x0,'rows':[]};var _0x17b214=_[_0x2c0c('0x3a')](db[_0x2c0c('0x3b')]['rawAttributes'],function(_0x4133e1){return{'name':_0x4133e1[_0x2c0c('0x3c')],'type':_0x4133e1[_0x2c0c('0x32')]['key']};});_0x3f2584['model']=_['map'](_0x17b214,'name');_0x3f2584[_0x2c0c('0x3d')]=_['keys'](_0x2794ff['query']);_0x3f2584[_0x2c0c('0x3e')]=_[_0x2c0c('0x3f')](_0x3f2584['model'],_0x3f2584['query']);_0x4b69b9['attributes']=_[_0x2c0c('0x3f')](_0x3f2584[_0x2c0c('0x40')],qs[_0x2c0c('0x41')](_0x2794ff[_0x2c0c('0x3d')][_0x2c0c('0x41')]));_0x4b69b9['attributes']=_0x4b69b9[_0x2c0c('0x42')][_0x2c0c('0x43')]?_0x4b69b9[_0x2c0c('0x42')]:_0x3f2584['model'];if(!_0x2794ff[_0x2c0c('0x3d')][_0x2c0c('0x44')](_0x2c0c('0x45'))){_0x4b69b9['limit']=qs[_0x2c0c('0x20')](_0x2794ff[_0x2c0c('0x3d')][_0x2c0c('0x20')]);_0x4b69b9[_0x2c0c('0x1e')]=qs['offset'](_0x2794ff[_0x2c0c('0x3d')]['offset']);}_0x4b69b9[_0x2c0c('0x46')]=qs[_0x2c0c('0x47')](_0x2794ff['query'][_0x2c0c('0x47')]);_0x4b69b9[_0x2c0c('0x48')]=qs[_0x2c0c('0x3e')](_[_0x2c0c('0x49')](_0x2794ff[_0x2c0c('0x3d')],_0x3f2584[_0x2c0c('0x3e')]),_0x17b214);if(_0x2794ff['query'][_0x2c0c('0x2e')]){_0x4b69b9[_0x2c0c('0x48')]=_[_0x2c0c('0x4a')](_0x4b69b9[_0x2c0c('0x48')],{'$or':_[_0x2c0c('0x3a')](_0x17b214,function(_0x2e5e60){if(_0x2e5e60[_0x2c0c('0x32')]!==_0x2c0c('0x4b')){var _0x58a797={};_0x58a797[_0x2e5e60[_0x2c0c('0x34')]]={'$like':'%'+_0x2794ff[_0x2c0c('0x3d')][_0x2c0c('0x2e')]+'%'};return _0x58a797;}})});}_0x4b69b9=_[_0x2c0c('0x4a')]({},_0x4b69b9,_0x2794ff[_0x2c0c('0x4c')]);var _0x44411c={'where':_0x4b69b9[_0x2c0c('0x48')]};return db['VoiceExtension'][_0x2c0c('0x21')](_0x44411c)[_0x2c0c('0x25')](function(_0x10931f){_0x5b04d7[_0x2c0c('0x21')]=_0x10931f;if(_0x2794ff[_0x2c0c('0x3d')][_0x2c0c('0x4d')]){_0x4b69b9['include']=[{'all':!![]}];}return db[_0x2c0c('0x3b')][_0x2c0c('0x4e')](_0x4b69b9);})['then'](function(_0x1e2503){_0x5b04d7[_0x2c0c('0x4f')]=_0x1e2503;return _0x5b04d7;})[_0x2c0c('0x25')](respondWithFilteredResult(_0x341da3,_0x4b69b9))[_0x2c0c('0x50')](handleError(_0x341da3,null));};exports[_0x2c0c('0x51')]=function(_0x10d2b1,_0x48de09){var _0x435c8e={'raw':![],'where':{'id':_0x10d2b1[_0x2c0c('0x52')]['id']}},_0x24ec56={};_0x24ec56[_0x2c0c('0x40')]=_['keys'](db[_0x2c0c('0x3b')]['rawAttributes']);_0x24ec56[_0x2c0c('0x3d')]=_[_0x2c0c('0x53')](_0x10d2b1[_0x2c0c('0x3d')]);_0x24ec56['filters']=_['intersection'](_0x24ec56[_0x2c0c('0x40')],_0x24ec56[_0x2c0c('0x3d')]);_0x435c8e[_0x2c0c('0x42')]=_['intersection'](_0x24ec56['model'],qs['fields'](_0x10d2b1[_0x2c0c('0x3d')]['fields']));_0x435c8e['attributes']=_0x435c8e[_0x2c0c('0x42')]['length']?_0x435c8e[_0x2c0c('0x42')]:_0x24ec56[_0x2c0c('0x40')];if(_0x10d2b1[_0x2c0c('0x3d')][_0x2c0c('0x4d')]){_0x435c8e[_0x2c0c('0x54')]=[{'all':!![]}];}_0x435c8e=_[_0x2c0c('0x4a')]({},_0x435c8e,_0x10d2b1[_0x2c0c('0x4c')]);return db[_0x2c0c('0x3b')]['find'](_0x435c8e)[_0x2c0c('0x25')](handleEntityNotFound(_0x48de09,null))[_0x2c0c('0x25')](respondWithResult(_0x48de09,null))[_0x2c0c('0x50')](handleError(_0x48de09,null));};exports['destroy']=function(_0x352733,_0x2e0ff8){return db[_0x2c0c('0x3b')][_0x2c0c('0x33')]({'where':{'id':_0x352733[_0x2c0c('0x52')]['id']}})[_0x2c0c('0x25')](handleEntityNotFound(_0x2e0ff8,null))[_0x2c0c('0x25')](removeEntity(_0x2e0ff8,null))[_0x2c0c('0x50')](handleError(_0x2e0ff8,null));};exports[_0x2c0c('0x55')]=function(_0x249806,_0x5eae5a){if(_0x249806[_0x2c0c('0x56')]['type']==='outbound'&&!_[_0x2c0c('0x57')](_0x249806['body'][_0x2c0c('0x58')],'_')){_0x249806[_0x2c0c('0x56')]['exten']='_'[_0x2c0c('0x59')](_0x249806[_0x2c0c('0x56')]['exten']);}return db[_0x2c0c('0x3b')][_0x2c0c('0x55')](_0x249806[_0x2c0c('0x56')],{'raw':![]})[_0x2c0c('0x25')](function(_0x3fdfa2){var _0x2594bd=_0x249806[_0x2c0c('0x5a')][_0x2c0c('0x27')]({'plain':!![]});if(!_0x2594bd)throw new Error(_0x2c0c('0x5b'));if(_0x2594bd[_0x2c0c('0x5c')]===_0x2c0c('0x5a')){var _0x3bce9a=_0x3fdfa2['get']({'plain':!![]});var _0x4556c7=[{'name':'InboundRoutes','value':_0x2c0c('0x29')},{'name':_0x2c0c('0x2a'),'value':_0x2c0c('0x2b')},{'name':_0x2c0c('0x2c'),'value':_0x2c0c('0x2d')}];var _0x176a72=_[_0x2c0c('0x33')](_0x4556c7,[_0x2c0c('0x30'),_0x3bce9a['type']])['name'];return db[_0x2c0c('0x5d')][_0x2c0c('0x33')]({'where':{'name':_0x176a72,'userProfileId':_0x2594bd[_0x2c0c('0x5e')]},'raw':!![]})[_0x2c0c('0x25')](function(_0xa14a57){if(_0xa14a57&&_0xa14a57[_0x2c0c('0x5f')]===0x0){return db[_0x2c0c('0x35')]['create']({'name':_0x3bce9a[_0x2c0c('0x34')],'resourceId':_0x3bce9a['id'],'type':_0xa14a57['name'],'sectionId':_0xa14a57['id']},{})[_0x2c0c('0x25')](function(){return _0x3fdfa2;});}else{return _0x3fdfa2;}})['catch'](function(_0x437917){logger[_0x2c0c('0x36')](_0x2c0c('0x60'),_0x437917);throw _0x437917;});}return _0x3fdfa2;})['then'](respondWithResult(_0x5eae5a,0xc9))['catch'](handleError(_0x5eae5a,null));};exports[_0x2c0c('0x24')]=function(_0x2a8262,_0x1ab913){if(_0x2a8262[_0x2c0c('0x56')]['id']){delete _0x2a8262[_0x2c0c('0x56')]['id'];}return db[_0x2c0c('0x3b')][_0x2c0c('0x33')]({'where':{'id':_0x2a8262[_0x2c0c('0x52')]['id']}})['then'](handleEntityNotFound(_0x1ab913,null))[_0x2c0c('0x25')](function(_0x477b3f){if(_0x477b3f){return db[_0x2c0c('0x3b')][_0x2c0c('0x24')](_[_0x2c0c('0x49')](_0x2a8262[_0x2c0c('0x56')],[_0x2c0c('0x58'),'context',_0x2c0c('0x61'),_0x2c0c('0x62'),_0x2c0c('0x63'),'mandatoryDisposition',_0x2c0c('0x64')]),{'where':{'context':_0x477b3f[_0x2c0c('0x65')],'exten':_0x477b3f[_0x2c0c('0x58')]},'individualHooks':!![]})[_0x2c0c('0x25')](function(_0x481612){return _0x481612;});}return null;})[_0x2c0c('0x25')](respondWithStatusCode(_0x1ab913,null))[_0x2c0c('0x50')](handleError(_0x1ab913,null));};exports[_0x2c0c('0x66')]=function(_0x2362ad,_0x4acc79){return db[_0x2c0c('0x3b')][_0x2c0c('0x67')]({'where':{'id':_0x2362ad['params']['id']}})[_0x2c0c('0x25')](function(_0x8bfcc2){if(_0x8bfcc2){return db[_0x2c0c('0x68')][_0x2c0c('0x69')](function(_0x108f9a){return db[_0x2c0c('0x3b')][_0x2c0c('0x26')]({'where':{'VoiceExtensionId':_0x2362ad[_0x2c0c('0x52')]['id']},'transaction':_0x108f9a})[_0x2c0c('0x25')](function(){var _0x2aaad0=_[_0x2c0c('0x3a')](_0x2362ad['body'],function(_0x4e56bf){_0x4e56bf['VoiceExtensionId']=_0x2362ad['params']['id'];_0x4e56bf['isApp']=!![];return _0x4e56bf;});var _0x3d5b1d=_0x2362ad[_0x2c0c('0x3d')][_0x2c0c('0x6a')]&&_0x2362ad[_0x2c0c('0x3d')][_0x2c0c('0x6a')][_0x2c0c('0x6b')]()===_0x2c0c('0x6c')?!![]:![];return _0x8bfcc2[_0x2c0c('0x6d')](_0x2aaad0,_0x3d5b1d);})[_0x2c0c('0x25')](function(_0x58b24a){return db['VoiceExtension'][_0x2c0c('0x6e')](_0x58b24a,{'transaction':_0x108f9a});});})['then'](function(){return db['VoiceExtension'][_0x2c0c('0x6f')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2362ad[_0x2c0c('0x52')]['id']},'order':_0x2c0c('0x70')});});}})[_0x2c0c('0x25')](respondWithResult(_0x4acc79,null))[_0x2c0c('0x50')](handleError(_0x4acc79,null));}; \ No newline at end of file +var _0xc2b5=['sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','get','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','find','type','name','UserProfileResource','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','includeAll','include','findAll','rows','catch','show','params','create','startsWith','body','exten','user','role','InboundRoutes','UserProfileSection','userProfileId','autoAssociation','update','context','mandatoryDisposition','alias','transaction','VoiceExtensionId','isApp','rewriteDial','toLowerCase','true','createRouting','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register'];(function(_0x1d73a5,_0x3fe1c2){var _0x1a7511=function(_0x5c47d4){while(--_0x5c47d4){_0x1d73a5['push'](_0x1d73a5['shift']());}};_0x1a7511(++_0x3fe1c2);}(_0xc2b5,0x129));var _0x5c2b=function(_0x32346a,_0x138d23){_0x32346a=_0x32346a-0x0;var _0x518ddd=_0xc2b5[_0x32346a];return _0x518ddd;};'use strict';var emlformat=require(_0x5c2b('0x0'));var rimraf=require(_0x5c2b('0x1'));var zipdir=require(_0x5c2b('0x2'));var jsonpatch=require(_0x5c2b('0x3'));var rp=require(_0x5c2b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5c2b('0x5'));var util=require(_0x5c2b('0x6'));var path=require(_0x5c2b('0x7'));var sox=require(_0x5c2b('0x8'));var csv=require(_0x5c2b('0x9'));var ejs=require(_0x5c2b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5c2b('0xb'));var squel=require(_0x5c2b('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5c2b('0xd'));var toCsv=require(_0x5c2b('0x9'));var querystring=require(_0x5c2b('0xe'));var Papa=require(_0x5c2b('0xf'));var Redis=require(_0x5c2b('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5c2b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x5c2b('0x12'));var config=require(_0x5c2b('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c2b('0x14'))['db'];config['redis']=_[_0x5c2b('0x15')](config[_0x5c2b('0x16')],{'host':_0x5c2b('0x17'),'port':0x18eb});var socket=require(_0x5c2b('0x18'))(new Redis(config[_0x5c2b('0x16')]));require(_0x5c2b('0x19'))[_0x5c2b('0x1a')](socket);function respondWithStatusCode(_0xd51537,_0xc3c28f){_0xc3c28f=_0xc3c28f||0xcc;return function(_0x341cf0){if(_0x341cf0){return _0xd51537[_0x5c2b('0x1b')](_0xc3c28f);}return _0xd51537[_0x5c2b('0x1c')](_0xc3c28f)[_0x5c2b('0x1d')]();};}function respondWithResult(_0x25d06c,_0x335f6f){_0x335f6f=_0x335f6f||0xc8;return function(_0x271744){if(_0x271744){return _0x25d06c[_0x5c2b('0x1c')](_0x335f6f)[_0x5c2b('0x1e')](_0x271744);}};}function respondWithFilteredResult(_0x1b69a4,_0x1d1727){return function(_0x410d3b){if(_0x410d3b){var _0x13ccec=typeof _0x1d1727['offset']===_0x5c2b('0x1f')&&typeof _0x1d1727[_0x5c2b('0x20')]==='undefined';var _0x50d81b=_0x410d3b[_0x5c2b('0x21')];var _0x2796c0=_0x13ccec?0x0:_0x1d1727[_0x5c2b('0x22')];var _0x3e1c11=_0x13ccec?_0x410d3b[_0x5c2b('0x21')]:_0x1d1727[_0x5c2b('0x22')]+_0x1d1727[_0x5c2b('0x20')];var _0x550728;if(_0x3e1c11>=_0x50d81b){_0x3e1c11=_0x50d81b;_0x550728=0xc8;}else{_0x550728=0xce;}_0x1b69a4['status'](_0x550728);return _0x1b69a4[_0x5c2b('0x23')]('Content-Range',_0x2796c0+'-'+_0x3e1c11+'/'+_0x50d81b)[_0x5c2b('0x1e')](_0x410d3b);}return null;};}function patchUpdates(_0x34fa4d){return function(_0x28d3b0){try{jsonpatch[_0x5c2b('0x24')](_0x28d3b0,_0x34fa4d,!![]);}catch(_0x223b91){return BPromise[_0x5c2b('0x25')](_0x223b91);}return _0x28d3b0[_0x5c2b('0x26')]();};}function saveUpdates(_0x4683d7,_0x5b5a33){return function(_0x516e5e){if(_0x516e5e){return _0x516e5e['update'](_0x4683d7)[_0x5c2b('0x27')](function(_0xb9f8a2){return _0xb9f8a2;});}return null;};}function removeEntity(_0x2d5e51,_0x3ebd56){return function(_0x2cfeb1){if(_0x2cfeb1){return _0x2cfeb1[_0x5c2b('0x28')]()['then'](function(){var _0x4e32f7=_0x2cfeb1[_0x5c2b('0x29')]({'plain':!![]});var _0x4fc0d8=[{'name':'InboundRoutes','value':_0x5c2b('0x2a'),'ignore':![]},{'name':_0x5c2b('0x2b'),'value':_0x5c2b('0x2c'),'ignore':![]},{'name':_0x5c2b('0x2d'),'value':_0x5c2b('0x2e'),'ignore':![]}];var _0x5cb642=_(_0x4fc0d8)[_0x5c2b('0x2f')](_0x5c2b('0x30'))[_0x5c2b('0x31')]('value')[_0x5c2b('0x32')]();if(_[_0x5c2b('0x33')](_0x5cb642,_0x4e32f7['type'])){return;}var _0x49c278=_[_0x5c2b('0x34')](_0x4fc0d8,[_0x5c2b('0x32'),_0x4e32f7[_0x5c2b('0x35')]])[_0x5c2b('0x36')];return db[_0x5c2b('0x37')]['destroy']({'where':{'type':_0x49c278,'resourceId':_0x4e32f7['id']}})[_0x5c2b('0x27')](function(){return _0x2cfeb1;});})[_0x5c2b('0x27')](function(){_0x2d5e51['status'](0xcc)[_0x5c2b('0x1d')]();});}};}function handleEntityNotFound(_0x47a1ef,_0x47f915){return function(_0x2b78e9){if(!_0x2b78e9){_0x47a1ef[_0x5c2b('0x1b')](0x194);}return _0x2b78e9;};}function handleError(_0x489f68,_0x3c0c6b){_0x3c0c6b=_0x3c0c6b||0x1f4;return function(_0x261003){logger[_0x5c2b('0x38')](_0x261003[_0x5c2b('0x39')]);if(_0x261003[_0x5c2b('0x36')]){delete _0x261003['name'];}_0x489f68[_0x5c2b('0x1c')](_0x3c0c6b)[_0x5c2b('0x3a')](_0x261003);};}exports[_0x5c2b('0x3b')]=function(_0xae2413,_0x104c03){var _0x2affb3={},_0xa484c7={},_0x19b31c={'count':0x0,'rows':[]};var _0x44e3f0=_[_0x5c2b('0x31')](db[_0x5c2b('0x3c')][_0x5c2b('0x3d')],function(_0x5e3e7b){return{'name':_0x5e3e7b[_0x5c2b('0x3e')],'type':_0x5e3e7b['type'][_0x5c2b('0x3f')]};});_0xa484c7['model']=_[_0x5c2b('0x31')](_0x44e3f0,_0x5c2b('0x36'));_0xa484c7[_0x5c2b('0x40')]=_[_0x5c2b('0x41')](_0xae2413[_0x5c2b('0x40')]);_0xa484c7[_0x5c2b('0x42')]=_[_0x5c2b('0x43')](_0xa484c7[_0x5c2b('0x44')],_0xa484c7[_0x5c2b('0x40')]);_0x2affb3['attributes']=_[_0x5c2b('0x43')](_0xa484c7[_0x5c2b('0x44')],qs['fields'](_0xae2413[_0x5c2b('0x40')][_0x5c2b('0x45')]));_0x2affb3['attributes']=_0x2affb3[_0x5c2b('0x46')][_0x5c2b('0x47')]?_0x2affb3[_0x5c2b('0x46')]:_0xa484c7[_0x5c2b('0x44')];if(!_0xae2413['query'][_0x5c2b('0x48')]('nolimit')){_0x2affb3[_0x5c2b('0x20')]=qs[_0x5c2b('0x20')](_0xae2413[_0x5c2b('0x40')][_0x5c2b('0x20')]);_0x2affb3[_0x5c2b('0x22')]=qs[_0x5c2b('0x22')](_0xae2413[_0x5c2b('0x40')][_0x5c2b('0x22')]);}_0x2affb3[_0x5c2b('0x49')]=qs['sort'](_0xae2413[_0x5c2b('0x40')][_0x5c2b('0x4a')]);_0x2affb3[_0x5c2b('0x4b')]=qs[_0x5c2b('0x42')](_[_0x5c2b('0x4c')](_0xae2413[_0x5c2b('0x40')],_0xa484c7[_0x5c2b('0x42')]),_0x44e3f0);if(_0xae2413[_0x5c2b('0x40')][_0x5c2b('0x2f')]){_0x2affb3[_0x5c2b('0x4b')]=_['merge'](_0x2affb3[_0x5c2b('0x4b')],{'$or':_[_0x5c2b('0x31')](_0x44e3f0,function(_0x3e1ecc){if(_0x3e1ecc['type']!=='VIRTUAL'){var _0x460fc7={};_0x460fc7[_0x3e1ecc['name']]={'$like':'%'+_0xae2413['query'][_0x5c2b('0x2f')]+'%'};return _0x460fc7;}})});}_0x2affb3=_[_0x5c2b('0x4d')]({},_0x2affb3,_0xae2413['options']);var _0x3bb549={'where':_0x2affb3[_0x5c2b('0x4b')]};return db[_0x5c2b('0x3c')][_0x5c2b('0x21')](_0x3bb549)[_0x5c2b('0x27')](function(_0x3ea186){_0x19b31c[_0x5c2b('0x21')]=_0x3ea186;if(_0xae2413[_0x5c2b('0x40')][_0x5c2b('0x4e')]){_0x2affb3[_0x5c2b('0x4f')]=[{'all':!![]}];}return db[_0x5c2b('0x3c')][_0x5c2b('0x50')](_0x2affb3);})[_0x5c2b('0x27')](function(_0xcc03b4){_0x19b31c[_0x5c2b('0x51')]=_0xcc03b4;return _0x19b31c;})[_0x5c2b('0x27')](respondWithFilteredResult(_0x104c03,_0x2affb3))[_0x5c2b('0x52')](handleError(_0x104c03,null));};exports[_0x5c2b('0x53')]=function(_0x4c7392,_0x16908c){var _0x205eb1={'raw':![],'where':{'id':_0x4c7392[_0x5c2b('0x54')]['id']}},_0x3ae88d={};_0x3ae88d['model']=_['keys'](db[_0x5c2b('0x3c')][_0x5c2b('0x3d')]);_0x3ae88d['query']=_[_0x5c2b('0x41')](_0x4c7392[_0x5c2b('0x40')]);_0x3ae88d[_0x5c2b('0x42')]=_[_0x5c2b('0x43')](_0x3ae88d[_0x5c2b('0x44')],_0x3ae88d['query']);_0x205eb1['attributes']=_[_0x5c2b('0x43')](_0x3ae88d[_0x5c2b('0x44')],qs['fields'](_0x4c7392['query'][_0x5c2b('0x45')]));_0x205eb1[_0x5c2b('0x46')]=_0x205eb1[_0x5c2b('0x46')][_0x5c2b('0x47')]?_0x205eb1[_0x5c2b('0x46')]:_0x3ae88d[_0x5c2b('0x44')];if(_0x4c7392['query'][_0x5c2b('0x4e')]){_0x205eb1[_0x5c2b('0x4f')]=[{'all':!![]}];}_0x205eb1=_[_0x5c2b('0x4d')]({},_0x205eb1,_0x4c7392['options']);return db[_0x5c2b('0x3c')][_0x5c2b('0x34')](_0x205eb1)[_0x5c2b('0x27')](handleEntityNotFound(_0x16908c,null))['then'](respondWithResult(_0x16908c,null))[_0x5c2b('0x52')](handleError(_0x16908c,null));};exports[_0x5c2b('0x28')]=function(_0x580333,_0x4cdc9b){return db[_0x5c2b('0x3c')]['find']({'where':{'id':_0x580333[_0x5c2b('0x54')]['id']}})['then'](handleEntityNotFound(_0x4cdc9b,null))[_0x5c2b('0x27')](removeEntity(_0x4cdc9b,null))[_0x5c2b('0x52')](handleError(_0x4cdc9b,null));};exports[_0x5c2b('0x55')]=function(_0x57a2f0,_0x21fac3){if(_0x57a2f0['body'][_0x5c2b('0x35')]===_0x5c2b('0x2c')&&!_[_0x5c2b('0x56')](_0x57a2f0[_0x5c2b('0x57')][_0x5c2b('0x58')],'_')){_0x57a2f0[_0x5c2b('0x57')][_0x5c2b('0x58')]='_'['concat'](_0x57a2f0[_0x5c2b('0x57')][_0x5c2b('0x58')]);}return db[_0x5c2b('0x3c')][_0x5c2b('0x55')](_0x57a2f0[_0x5c2b('0x57')],{'raw':![]})[_0x5c2b('0x27')](function(_0x4b4330){var _0x30f576=_0x57a2f0[_0x5c2b('0x59')][_0x5c2b('0x29')]({'plain':!![]});if(!_0x30f576)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30f576[_0x5c2b('0x5a')]===_0x5c2b('0x59')){var _0x3cfbd1=_0x4b4330['get']({'plain':!![]});var _0x2c65f0=[{'name':_0x5c2b('0x5b'),'value':_0x5c2b('0x2a')},{'name':'OutboundRoutes','value':_0x5c2b('0x2c')},{'name':_0x5c2b('0x2d'),'value':_0x5c2b('0x2e')}];var _0x2f78cd=_[_0x5c2b('0x34')](_0x2c65f0,[_0x5c2b('0x32'),_0x3cfbd1[_0x5c2b('0x35')]])['name'];return db[_0x5c2b('0x5c')][_0x5c2b('0x34')]({'where':{'name':_0x2f78cd,'userProfileId':_0x30f576[_0x5c2b('0x5d')]},'raw':!![]})['then'](function(_0x177dfa){if(_0x177dfa&&_0x177dfa[_0x5c2b('0x5e')]===0x0){return db[_0x5c2b('0x37')][_0x5c2b('0x55')]({'name':_0x3cfbd1[_0x5c2b('0x36')],'resourceId':_0x3cfbd1['id'],'type':_0x177dfa['name'],'sectionId':_0x177dfa['id']},{})[_0x5c2b('0x27')](function(){return _0x4b4330;});}else{return _0x4b4330;}})[_0x5c2b('0x52')](function(_0x173aab){logger[_0x5c2b('0x38')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x173aab);throw _0x173aab;});}return _0x4b4330;})[_0x5c2b('0x27')](respondWithResult(_0x21fac3,0xc9))[_0x5c2b('0x52')](handleError(_0x21fac3,null));};exports[_0x5c2b('0x5f')]=function(_0x5c3b18,_0x200005){if(_0x5c3b18['body']['id']){delete _0x5c3b18[_0x5c2b('0x57')]['id'];}return db[_0x5c2b('0x3c')][_0x5c2b('0x34')]({'where':{'id':_0x5c3b18[_0x5c2b('0x54')]['id']}})[_0x5c2b('0x27')](handleEntityNotFound(_0x200005,null))[_0x5c2b('0x27')](function(_0xc97b09){if(_0xc97b09){return db['VoiceExtension']['update'](_[_0x5c2b('0x4c')](_0x5c3b18[_0x5c2b('0x57')],[_0x5c2b('0x58'),_0x5c2b('0x60'),'description','recordingFormat','cutdigits',_0x5c2b('0x61'),_0x5c2b('0x62')]),{'where':{'context':_0xc97b09['context'],'exten':_0xc97b09[_0x5c2b('0x58')]},'individualHooks':!![]})[_0x5c2b('0x27')](function(_0x26adfd){return _0x26adfd;});}return null;})['then'](respondWithStatusCode(_0x200005,null))[_0x5c2b('0x52')](handleError(_0x200005,null));};exports['addApplications']=function(_0x25347f,_0x57cf9c){return db['VoiceExtension']['findOne']({'where':{'id':_0x25347f[_0x5c2b('0x54')]['id']}})['then'](function(_0x578889){if(_0x578889){return db['sequelize'][_0x5c2b('0x63')](function(_0x14919b){return db[_0x5c2b('0x3c')][_0x5c2b('0x28')]({'where':{'VoiceExtensionId':_0x25347f[_0x5c2b('0x54')]['id']},'transaction':_0x14919b})[_0x5c2b('0x27')](function(){var _0xfea792=_[_0x5c2b('0x31')](_0x25347f[_0x5c2b('0x57')],function(_0x2f5fca){_0x2f5fca[_0x5c2b('0x64')]=_0x25347f[_0x5c2b('0x54')]['id'];_0x2f5fca[_0x5c2b('0x65')]=!![];return _0x2f5fca;});var _0x3e40d8=_0x25347f[_0x5c2b('0x40')][_0x5c2b('0x66')]&&_0x25347f[_0x5c2b('0x40')]['rewriteDial'][_0x5c2b('0x67')]()===_0x5c2b('0x68')?!![]:![];return _0x578889[_0x5c2b('0x69')](_0xfea792,_0x3e40d8);})[_0x5c2b('0x27')](function(_0x38093f){return db['VoiceExtension']['bulkCreate'](_0x38093f,{'transaction':_0x14919b});});})[_0x5c2b('0x27')](function(){return db[_0x5c2b('0x3c')][_0x5c2b('0x6a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x25347f[_0x5c2b('0x54')]['id']},'order':_0x5c2b('0x6b')});});}})[_0x5c2b('0x27')](respondWithResult(_0x57cf9c,null))['catch'](handleError(_0x57cf9c,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index e68f392..0010209 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 _0xd820=['update','remove','hasOwnProperty','hook','../../mysqldb','VoiceExtension','setMaxListeners'];(function(_0x235acb,_0x151fb6){var _0x24d52a=function(_0xe41e7f){while(--_0xe41e7f){_0x235acb['push'](_0x235acb['shift']());}};_0x24d52a(++_0x151fb6);}(_0xd820,0x1c4));var _0x0d82=function(_0xb2d973,_0x469f4f){_0xb2d973=_0xb2d973-0x0;var _0xd1a153=_0xd820[_0xb2d973];return _0xd1a153;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x0d82('0x0'))['db'][_0x0d82('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x0d82('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0d82('0x3'),'afterDestroy':_0x0d82('0x4')};function emitEvent(_0x481368){return function(_0x4e2573,_0xd714be,_0x8babe0){VoiceExtensionEvents['emit'](_0x481368+':'+_0x4e2573['id'],_0x4e2573);VoiceExtensionEvents['emit'](_0x481368,_0x4e2573);_0x8babe0(null);};}for(var e in events){if(events[_0x0d82('0x5')](e)){var event=events[e];VoiceExtension[_0x0d82('0x6')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x9f67=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','update','remove'];(function(_0x1a1e8c,_0x3d2df3){var _0x29b0c9=function(_0xb4f77e){while(--_0xb4f77e){_0x1a1e8c['push'](_0x1a1e8c['shift']());}};_0x29b0c9(++_0x3d2df3);}(_0x9f67,0x11b));var _0x79f6=function(_0x5245ab,_0x469723){_0x5245ab=_0x5245ab-0x0;var _0x247dc8=_0x9f67[_0x5245ab];return _0x247dc8;};'use strict';var EventEmitter=require(_0x79f6('0x0'));var VoiceExtension=require(_0x79f6('0x1'))['db'][_0x79f6('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x79f6('0x3'),'afterDestroy':_0x79f6('0x4')};function emitEvent(_0x8595bd){return function(_0x3d41cc,_0xb5be25,_0x12b847){VoiceExtensionEvents[_0x79f6('0x5')](_0x8595bd+':'+_0x3d41cc['id'],_0x3d41cc);VoiceExtensionEvents['emit'](_0x8595bd,_0x3d41cc);_0x12b847(null);};}for(var e in events){if(events[_0x79f6('0x6')](e)){var event=events[e];VoiceExtension[_0x79f6('0x7')](e,emitEvent(event));}}module[_0x79f6('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 62e5ad3..05912a4 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 _0x0cf3=['_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','split','length','name','param','phone','prefix','${EXTEN}','SIP','join','none','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','intervals','IntervalId','map','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','define','VoiceExtension','Hangup','./voiceExtension.attributes','exports','models','Set','context','type','NoOp','alias','No\x20alias\x20set','inbound','push','exten','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(routeAlias)=','CDR(destination)=','cutdigits','${EXTEN:','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','hasOwnProperty','recordingFormat'];(function(_0x142020,_0x1f7233){var _0x40da8f=function(_0x17f0a3){while(--_0x17f0a3){_0x142020['push'](_0x142020['shift']());}};_0x40da8f(++_0x1f7233);}(_0x0cf3,0x173));var _0x30cf=function(_0x2caa42,_0x3e766e){_0x2caa42=_0x2caa42-0x0;var _0x3af036=_0x0cf3[_0x2caa42];return _0x3af036;};'use strict';var util=require('util');var _=require('lodash');var attributes=require(_0x30cf('0x0'));module[_0x30cf('0x1')]=function(_0x42bdf0){var _0x281d08=_0x42bdf0[_0x30cf('0x2')];function _0x1a80a7(_0x2f7455){var _0x3a5ee5=0x2;var _0x2eb2d9=[{'type':_0x2f7455['type'],'app':_0x30cf('0x3'),'appdata':'CDR(type)='+_0x2f7455['type'],'context':_0x2f7455[_0x30cf('0x4')],'exten':_0x2f7455['exten'],'priority':_0x3a5ee5++,'VoiceExtensionId':_0x2f7455['id']},{'type':_0x2f7455[_0x30cf('0x5')],'app':_0x2f7455['alias']?_0x30cf('0x3'):_0x30cf('0x6'),'appdata':_0x2f7455[_0x30cf('0x7')]?'CDR(routeAlias)='+_0x2f7455['alias']:_0x30cf('0x8'),'context':_0x2f7455[_0x30cf('0x4')],'exten':_0x2f7455['exten'],'priority':_0x3a5ee5++,'VoiceExtensionId':_0x2f7455['id']}];if(_0x2f7455[_0x30cf('0x5')]===_0x30cf('0x9')){_0x2eb2d9[_0x30cf('0xa')]({'type':_0x30cf('0x9'),'app':_0x30cf('0x3'),'appdata':'CDR(routeid)='+_0x2f7455['id'],'context':_0x2f7455[_0x30cf('0x4')],'exten':_0x2f7455[_0x30cf('0xb')],'priority':_0x3a5ee5++,'VoiceExtensionId':_0x2f7455['id']});}_0x2eb2d9[_0x30cf('0xa')]({'type':_0x2f7455['type'],'app':_0x30cf('0x3'),'appdata':_0x30cf('0xc'),'context':_0x2f7455[_0x30cf('0x4')],'exten':_0x2f7455[_0x30cf('0xb')],'priority':_0x3a5ee5++,'VoiceExtensionId':_0x2f7455['id']},{'type':_0x2f7455['type'],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x2f7455[_0x30cf('0x4')],'exten':_0x2f7455['exten'],'priority':_0x3a5ee5++,'VoiceExtensionId':_0x2f7455['id']},{'type':_0x2f7455[_0x30cf('0x5')],'app':_0x30cf('0x3'),'appdata':_0x30cf('0xd'),'context':_0x2f7455[_0x30cf('0x4')],'exten':_0x2f7455['exten'],'priority':_0x3a5ee5++,'VoiceExtensionId':_0x2f7455['id']});return _0x2eb2d9;}function _0xe1db33(_0x587970){var _0x554e5b=0x2;var _0xddcdc8=[{'type':'outbound','app':'Set','appdata':_0x30cf('0xe'),'context':_0x587970[_0x30cf('0x4')],'exten':_0x587970[_0x30cf('0xb')],'priority':_0x554e5b++,'VoiceExtensionId':_0x587970['id']},{'type':_0x30cf('0xf'),'app':_0x587970[_0x30cf('0x7')]?'Set':_0x30cf('0x6'),'appdata':_0x587970[_0x30cf('0x7')]?_0x30cf('0x10')+_0x587970[_0x30cf('0x7')]:_0x30cf('0x8'),'context':_0x587970[_0x30cf('0x4')],'exten':_0x587970['exten'],'priority':_0x554e5b++,'VoiceExtensionId':_0x587970['id']},{'type':'outbound','app':_0x30cf('0x3'),'appdata':_0x30cf('0x11')+(_0x587970[_0x30cf('0x12')]?_0x30cf('0x13')+_0x587970[_0x30cf('0x12')]+'}':'${EXTEN}'),'context':_0x587970[_0x30cf('0x4')],'exten':_0x587970['exten'],'priority':_0x554e5b++,'VoiceExtensionId':_0x587970['id']},{'type':_0x30cf('0xf'),'app':_0x30cf('0x3'),'appdata':_0x30cf('0x14')+_0x587970['id'],'context':_0x587970[_0x30cf('0x4')],'exten':_0x587970[_0x30cf('0xb')],'priority':_0x554e5b++,'VoiceExtensionId':_0x587970['id']},{'type':_0x30cf('0xf'),'app':_0x30cf('0x15'),'appdata':_0x30cf('0x16')+(_0x554e5b+0x2)+_0x30cf('0x17')+(_0x554e5b+0x1)+')','context':_0x587970['context'],'exten':_0x587970[_0x30cf('0xb')],'priority':_0x554e5b++,'VoiceExtensionId':_0x587970['id']},{'type':_0x30cf('0xf'),'app':_0x30cf('0x3'),'appdata':_0x587970[_0x30cf('0x12')]?_0x30cf('0x18')+_0x587970[_0x30cf('0x12')]+'}':'CDR(prefix)=noprefix','context':_0x587970[_0x30cf('0x4')],'exten':_0x587970['exten'],'priority':_0x554e5b++,'VoiceExtensionId':_0x587970['id']},{'type':'outbound','app':_0x30cf('0x3'),'appdata':_0x30cf('0xc'),'context':_0x587970[_0x30cf('0x4')],'exten':_0x587970[_0x30cf('0xb')],'priority':_0x554e5b++,'VoiceExtensionId':_0x587970['id']},{'type':'outbound','app':_0x30cf('0x3'),'appdata':_0x30cf('0x19'),'context':_0x587970[_0x30cf('0x4')],'exten':_0x587970[_0x30cf('0xb')],'priority':_0x554e5b++,'VoiceExtensionId':_0x587970['id']},{'type':_0x30cf('0xf'),'app':_0x30cf('0x3'),'appdata':'MONITOR_OPTIONS=ab','context':_0x587970['context'],'exten':_0x587970[_0x30cf('0xb')],'priority':_0x554e5b++,'VoiceExtensionId':_0x587970['id']},{'type':'outbound','app':_0x30cf('0x3'),'appdata':_0x30cf('0x1a')+_0x587970['id'],'context':_0x587970[_0x30cf('0x4')],'exten':_0x587970[_0x30cf('0xb')],'priority':_0x554e5b++,'VoiceExtensionId':_0x587970['id']}];if(_0x587970[_0x30cf('0x1b')](_0x30cf('0x1c'))&&_0x587970[_0x30cf('0x1c')]!=='none'){_0xddcdc8[_0x30cf('0xa')]({'type':_0x30cf('0xf'),'app':_0x30cf('0x3'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x587970[_0x30cf('0x4')],'exten':_0x587970[_0x30cf('0xb')],'priority':_0x554e5b++,'VoiceExtensionId':_0x587970['id']},{'type':_0x30cf('0xf'),'app':_0x30cf('0x3'),'appdata':_0x30cf('0x1d')+_0x587970['recordingFormat']||_0x30cf('0x1e'),'context':_0x587970[_0x30cf('0x4')],'exten':_0x587970[_0x30cf('0xb')],'priority':_0x554e5b++,'VoiceExtensionId':_0x587970['id']});}return _0xddcdc8;}function _0x17b18c(_0x3f6c59){var _0x3d64f7=[{'name':_0x30cf('0x1f'),'param':0x0},{'name':_0x30cf('0x20'),'param':0x1},{'name':_0x30cf('0x21'),'param':0x2},{'name':'url','param':0x3}];var _0x592d5b={};var _0x5858e4=_0x3f6c59[_0x30cf('0x22')](',');var _0x2a6caf=[];for(var _0x1acb11=0x0;_0x1acb11<_0x3d64f7[_0x30cf('0x23')];_0x1acb11++){switch(_0x3d64f7[_0x1acb11][_0x30cf('0x24')]){case'trunk':_0x592d5b[_0x30cf('0x1f')]=_0x5858e4[_0x3d64f7[_0x1acb11][_0x30cf('0x25')]][_0x30cf('0x22')]('/')[0x1];_0x592d5b[_0x30cf('0x26')]=_0x5858e4[_0x3d64f7[_0x1acb11][_0x30cf('0x25')]][_0x30cf('0x22')]('/')[0x2];_0x592d5b[_0x30cf('0x27')]=_0x592d5b[_0x30cf('0x26')]?_0x592d5b[_0x30cf('0x26')][_0x30cf('0x22')]('$')[0x0]:undefined;_0x592d5b['phone']=route[_0x30cf('0x12')]?(_0x592d5b['prefix']||'')+_0x30cf('0x13')+route[_0x30cf('0x12')]+'}':(_0x592d5b[_0x30cf('0x27')]||'')+_0x30cf('0x28');_0x2a6caf[_0x3d64f7[_0x1acb11][_0x30cf('0x25')]]=[_0x30cf('0x29'),_0x592d5b[_0x30cf('0x1f')],_0x592d5b[_0x30cf('0x26')]][_0x30cf('0x2a')]('/');break;case'options':_0x592d5b['options']=_0x5858e4[_0x3d64f7[_0x1acb11][_0x30cf('0x25')]];if(route['recordingFormat']!==_0x30cf('0x2b')){if(_0x592d5b[_0x30cf('0x21')]['indexOf']('U(xcally-mixmonitor-context)')<0x0){_0x592d5b[_0x30cf('0x21')]+=_0x30cf('0x2c');}}else{_0x592d5b[_0x30cf('0x21')]=_0x592d5b[_0x30cf('0x21')][_0x30cf('0x2d')](_0x30cf('0x2c'),'');}_0x2a6caf[_0x3d64f7[_0x1acb11]['param']]=_0x592d5b[_0x30cf('0x21')];break;default:_0x2a6caf[_0x3d64f7[_0x1acb11][_0x30cf('0x25')]]=_0x5858e4[_0x3d64f7[_0x1acb11][_0x30cf('0x25')]];}}return _0x2a6caf[_0x30cf('0x2a')](',');}function _0x3b7bae(_0x585fb1,_0x108d8e,_0x30c7fe,_0x2e5fbb){return new Promise(function(_0xc53b41,_0x4bfff1){var _0x20cd3d=[];if(_[_0x30cf('0x2e')](_0x108d8e))return _0xc53b41(_0x20cd3d);_0x281d08[_0x30cf('0x2f')][_0x30cf('0x30')]({'attributes':['id',_0x30cf('0x31'),'IntervalId'],'raw':!![]})['then'](function(_0x23a1c6){for(var _0x5e7cd5=0x0,_0x47e68d=0x0;_0x5e7cd5<_0x108d8e[_0x30cf('0x23')];_0x5e7cd5++,_0x47e68d=0x0){var _0x213f3d=_0x108d8e[_0x5e7cd5];var _0x3ca484=[];var _0x4db6e7=[];if(_0x213f3d[_0x30cf('0x31')]!=='*,*,*,*'){_0x213f3d[_0x30cf('0x32')]=[_0x213f3d[_0x30cf('0x31')]];}else{_0x213f3d[_0x30cf('0x32')]=_0x213f3d[_0x30cf('0x33')]?_[_0x30cf('0x34')](_['filter'](_0x23a1c6,{'IntervalId':_0x213f3d[_0x30cf('0x33')]}),'interval'):[];}_0x213f3d['context']=_0x585fb1[_0x30cf('0x4')];_0x213f3d[_0x30cf('0xb')]=_0x585fb1[_0x30cf('0xb')];if(_0x213f3d[_0x30cf('0x5')])_0x213f3d['type']=_0x213f3d[_0x30cf('0x5')][_0x30cf('0x35')]();if(_0x585fb1[_0x30cf('0x5')]===_0x30cf('0xf')){if(_0x213f3d[_0x30cf('0x1b')](_0x30cf('0x36'))&&_0x213f3d[_0x30cf('0x36')]&&_0x213f3d['tag']!=='--'){_0x3ca484[_0x30cf('0xa')]({'type':_0x213f3d[_0x30cf('0x5')]['toLowerCase'](),'app':'Set','appdata':_0x30cf('0x37')+_0x213f3d[_0x30cf('0x36')],'context':_0x585fb1[_0x30cf('0x4')],'exten':_0x585fb1[_0x30cf('0xb')],'priority':_0x213f3d['intervals'][_0x30cf('0x23')]+_0x30c7fe+_0x47e68d++,'VoiceExtensionId':_0x585fb1['id']});}_0x3ca484[_0x30cf('0xa')]({'type':_0x213f3d['type']['toLowerCase'](),'app':'ExecIf','appdata':_0x30cf('0x38')+(_0x213f3d[_0x30cf('0x39')]?_0x30cf('0x3a')+_0x213f3d[_0x30cf('0x39')]+')':_0x30cf('0x3b')),'context':_0x585fb1[_0x30cf('0x4')],'exten':_0x585fb1['exten'],'priority':_0x213f3d['intervals'][_0x30cf('0x23')]+_0x30c7fe+_0x47e68d++,'VoiceExtensionId':_0x585fb1['id']});}else{if(_0x213f3d[_0x30cf('0x1b')](_0x30cf('0x3c'))){if([_0x30cf('0x3d'),_0x30cf('0x3e')][_0x30cf('0x3f')](_0x213f3d[_0x30cf('0x40')][_0x30cf('0x35')]())&&_0x213f3d['appType']!==_0x30cf('0x41')){if(_0x213f3d[_0x30cf('0x3c')]){_0x3ca484['push']({'type':_0x213f3d[_0x30cf('0x5')]['toLowerCase'](),'app':_0x30cf('0x15'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x585fb1[_0x30cf('0x4')],'exten':_0x585fb1[_0x30cf('0xb')],'priority':_0x213f3d[_0x30cf('0x32')][_0x30cf('0x23')]+_0x30c7fe+_0x47e68d++,'VoiceExtensionId':_0x585fb1['id']});_0x3ca484[_0x30cf('0xa')]({'type':_0x213f3d[_0x30cf('0x5')][_0x30cf('0x35')](),'app':'Set','appdata':_0x30cf('0x42'),'context':_0x585fb1[_0x30cf('0x4')],'exten':_0x585fb1[_0x30cf('0xb')],'priority':_0x213f3d[_0x30cf('0x32')]['length']+_0x30c7fe+_0x47e68d++,'VoiceExtensionId':_0x585fb1['id']});}else{_0x3ca484['push']({'type':_0x213f3d[_0x30cf('0x5')]['toLowerCase'](),'app':_0x30cf('0x15'),'appdata':_0x30cf('0x43'),'context':_0x585fb1[_0x30cf('0x4')],'exten':_0x585fb1['exten'],'priority':_0x213f3d[_0x30cf('0x32')][_0x30cf('0x23')]+_0x30c7fe+_0x47e68d++,'VoiceExtensionId':_0x585fb1['id']});_0x3ca484['push']({'type':_0x213f3d[_0x30cf('0x5')][_0x30cf('0x35')](),'app':_0x30cf('0x3'),'appdata':_0x30cf('0x44'),'context':_0x585fb1['context'],'exten':_0x585fb1[_0x30cf('0xb')],'priority':_0x213f3d[_0x30cf('0x32')]['length']+_0x30c7fe+_0x47e68d++,'VoiceExtensionId':_0x585fb1['id']});}}}}for(var _0x219abe=0x0;_0x219abe<_0x213f3d[_0x30cf('0x32')][_0x30cf('0x23')];_0x219abe++){var _0x5a1b9c=_0x30c7fe+_0x213f3d[_0x30cf('0x32')][_0x30cf('0x23')];var _0x20d4f8=_0x219abe===_0x213f3d[_0x30cf('0x32')]['length']-0x1?_0x30c7fe+_0x3ca484['length']+_0x4db6e7[_0x30cf('0x23')]+0x2:_0x30c7fe+_0x219abe+0x1;_0x3ca484[_0x30cf('0x45')](_0x219abe,0x0,{'type':_0x585fb1[_0x30cf('0x5')],'app':_0x30cf('0x46'),'appdata':_0x213f3d[_0x30cf('0x32')][_0x219abe]+'?'+_0x585fb1[_0x30cf('0x4')]+_0x30cf('0x47')+_0x5a1b9c+':'+_0x585fb1[_0x30cf('0x4')]+',${EXTEN},'+_0x20d4f8,'exten':_0x585fb1[_0x30cf('0xb')],'context':_0x585fb1['context'],'priority':_0x30c7fe+_0x219abe,'VoiceExtensionId':_0x585fb1['id']});}if(_0x2e5fbb&&_0x213f3d['appType']===_0x30cf('0x48'))_0x213f3d[_0x30cf('0x49')]=_0x17b18c(_0x213f3d['appdata']);_0x213f3d[_0x30cf('0x4a')]=_0x3ca484[_0x30cf('0x23')]?_[_0x30cf('0x4b')](_0x3ca484)['priority']+0x1:_0x30c7fe;_0x20cd3d=_[_0x30cf('0x4c')](_0x20cd3d,_0x3ca484,[_0x213f3d],_0x4db6e7);_0x30c7fe=_[_0x30cf('0x4b')](_0x20cd3d)['priority']+0x1;}return _0xc53b41(_0x20cd3d);})['catch'](function(_0x5763b4){_0x4bfff1(_0x5763b4);});});}return _0x42bdf0[_0x30cf('0x4d')](_0x30cf('0x4e'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x18c7f0,_0x56d381){var _0x329a5a=this;var _0x13ed2c=_0x329a5a['type']===_0x30cf('0xf')?_0xe1db33(_0x329a5a):_0x1a80a7(_0x329a5a);return _0x3b7bae(_0x329a5a,_0x18c7f0,_[_0x30cf('0x4b')](_0x13ed2c)[_0x30cf('0x4a')]+0x1,_0x56d381)['then'](function(_0x74cd09){var _0x52bf6c=_[_0x30cf('0x4c')](_0x13ed2c,_0x74cd09);_0x52bf6c[_0x30cf('0xa')]({'type':_0x329a5a['type'],'app':_0x30cf('0x4f'),'exten':_0x329a5a['exten'],'context':_0x329a5a['context'],'priority':_[_0x30cf('0x4b')](_0x52bf6c)[_0x30cf('0x4a')]+0x1,'VoiceExtensionId':_0x329a5a['id']});return _0x52bf6c;});}}});}; \ No newline at end of file +var _0xc026=['$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','last','priority','concat','catch','define','VoiceExtension','voice_extensions','Hangup','util','lodash','./voiceExtension.attributes','models','type','CDR(type)=','context','exten','Set','NoOp','alias','CDR(routeAlias)=','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','${EXTEN:','cutdigits','${EXTEN}','ExecIf','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','none','wav','trunk','options','split','name','param','phone','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','interval','IntervalId','then','length','*,*,*,*','intervals','map','filter','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','queue','playback','includes','app','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1'];(function(_0x285ae2,_0x47d83c){var _0x653ee8=function(_0x284d45){while(--_0x284d45){_0x285ae2['push'](_0x285ae2['shift']());}};_0x653ee8(++_0x47d83c);}(_0xc026,0x154));var _0x6c02=function(_0x5cacd6,_0x28cec1){_0x5cacd6=_0x5cacd6-0x0;var _0x2f85d6=_0xc026[_0x5cacd6];return _0x2f85d6;};'use strict';var util=require(_0x6c02('0x0'));var _=require(_0x6c02('0x1'));var attributes=require(_0x6c02('0x2'));module['exports']=function(_0x38bdb1){var _0x41f3da=_0x38bdb1[_0x6c02('0x3')];function _0x4c0e02(_0x47d89a){var _0x217846=0x2;var _0xfe61df=[{'type':_0x47d89a[_0x6c02('0x4')],'app':'Set','appdata':_0x6c02('0x5')+_0x47d89a[_0x6c02('0x4')],'context':_0x47d89a[_0x6c02('0x6')],'exten':_0x47d89a[_0x6c02('0x7')],'priority':_0x217846++,'VoiceExtensionId':_0x47d89a['id']},{'type':_0x47d89a[_0x6c02('0x4')],'app':_0x47d89a['alias']?_0x6c02('0x8'):_0x6c02('0x9'),'appdata':_0x47d89a[_0x6c02('0xa')]?_0x6c02('0xb')+_0x47d89a['alias']:'No\x20alias\x20set','context':_0x47d89a[_0x6c02('0x6')],'exten':_0x47d89a['exten'],'priority':_0x217846++,'VoiceExtensionId':_0x47d89a['id']}];if(_0x47d89a['type']===_0x6c02('0xc')){_0xfe61df['push']({'type':_0x6c02('0xc'),'app':'Set','appdata':_0x6c02('0xd')+_0x47d89a['id'],'context':_0x47d89a[_0x6c02('0x6')],'exten':_0x47d89a[_0x6c02('0x7')],'priority':_0x217846++,'VoiceExtensionId':_0x47d89a['id']});}_0xfe61df[_0x6c02('0xe')]({'type':_0x47d89a[_0x6c02('0x4')],'app':_0x6c02('0x8'),'appdata':_0x6c02('0xf'),'context':_0x47d89a['context'],'exten':_0x47d89a['exten'],'priority':_0x217846++,'VoiceExtensionId':_0x47d89a['id']},{'type':_0x47d89a['type'],'app':_0x6c02('0x8'),'appdata':_0x6c02('0x10'),'context':_0x47d89a[_0x6c02('0x6')],'exten':_0x47d89a['exten'],'priority':_0x217846++,'VoiceExtensionId':_0x47d89a['id']},{'type':_0x47d89a[_0x6c02('0x4')],'app':_0x6c02('0x8'),'appdata':_0x6c02('0x11'),'context':_0x47d89a[_0x6c02('0x6')],'exten':_0x47d89a[_0x6c02('0x7')],'priority':_0x217846++,'VoiceExtensionId':_0x47d89a['id']});return _0xfe61df;}function _0x2cde36(_0x109976){var _0x1255e6=0x2;var _0x54dd53=[{'type':_0x6c02('0x12'),'app':_0x6c02('0x8'),'appdata':'CDR(type)=outbound','context':_0x109976['context'],'exten':_0x109976[_0x6c02('0x7')],'priority':_0x1255e6++,'VoiceExtensionId':_0x109976['id']},{'type':_0x6c02('0x12'),'app':_0x109976[_0x6c02('0xa')]?_0x6c02('0x8'):_0x6c02('0x9'),'appdata':_0x109976['alias']?_0x6c02('0xb')+_0x109976['alias']:'No\x20alias\x20set','context':_0x109976['context'],'exten':_0x109976[_0x6c02('0x7')],'priority':_0x1255e6++,'VoiceExtensionId':_0x109976['id']},{'type':_0x6c02('0x12'),'app':_0x6c02('0x8'),'appdata':'CDR(destination)='+(_0x109976['cutdigits']?_0x6c02('0x13')+_0x109976[_0x6c02('0x14')]+'}':_0x6c02('0x15')),'context':_0x109976['context'],'exten':_0x109976[_0x6c02('0x7')],'priority':_0x1255e6++,'VoiceExtensionId':_0x109976['id']},{'type':_0x6c02('0x12'),'app':_0x6c02('0x8'),'appdata':_0x6c02('0xd')+_0x109976['id'],'context':_0x109976[_0x6c02('0x6')],'exten':_0x109976[_0x6c02('0x7')],'priority':_0x1255e6++,'VoiceExtensionId':_0x109976['id']},{'type':_0x6c02('0x12'),'app':_0x6c02('0x16'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x1255e6+0x2)+'):Goto('+(_0x1255e6+0x1)+')','context':_0x109976[_0x6c02('0x6')],'exten':_0x109976[_0x6c02('0x7')],'priority':_0x1255e6++,'VoiceExtensionId':_0x109976['id']},{'type':_0x6c02('0x12'),'app':_0x6c02('0x8'),'appdata':_0x109976[_0x6c02('0x14')]?_0x6c02('0x17')+_0x109976[_0x6c02('0x14')]+'}':'CDR(prefix)=noprefix','context':_0x109976[_0x6c02('0x6')],'exten':_0x109976[_0x6c02('0x7')],'priority':_0x1255e6++,'VoiceExtensionId':_0x109976['id']},{'type':_0x6c02('0x12'),'app':_0x6c02('0x8'),'appdata':_0x6c02('0xf'),'context':_0x109976[_0x6c02('0x6')],'exten':_0x109976['exten'],'priority':_0x1255e6++,'VoiceExtensionId':_0x109976['id']},{'type':'outbound','app':'Set','appdata':_0x6c02('0x10'),'context':_0x109976[_0x6c02('0x6')],'exten':_0x109976['exten'],'priority':_0x1255e6++,'VoiceExtensionId':_0x109976['id']},{'type':'outbound','app':_0x6c02('0x8'),'appdata':_0x6c02('0x11'),'context':_0x109976['context'],'exten':_0x109976['exten'],'priority':_0x1255e6++,'VoiceExtensionId':_0x109976['id']},{'type':_0x6c02('0x12'),'app':_0x6c02('0x8'),'appdata':_0x6c02('0x18')+_0x109976['id'],'context':_0x109976['context'],'exten':_0x109976['exten'],'priority':_0x1255e6++,'VoiceExtensionId':_0x109976['id']}];if(_0x109976[_0x6c02('0x19')](_0x6c02('0x1a'))&&_0x109976[_0x6c02('0x1a')]!==_0x6c02('0x1b')){_0x54dd53[_0x6c02('0xe')]({'type':_0x6c02('0x12'),'app':_0x6c02('0x8'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x109976[_0x6c02('0x6')],'exten':_0x109976[_0x6c02('0x7')],'priority':_0x1255e6++,'VoiceExtensionId':_0x109976['id']},{'type':_0x6c02('0x12'),'app':_0x6c02('0x8'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x109976['recordingFormat']||_0x6c02('0x1c'),'context':_0x109976['context'],'exten':_0x109976[_0x6c02('0x7')],'priority':_0x1255e6++,'VoiceExtensionId':_0x109976['id']});}return _0x54dd53;}function _0x410002(_0x535a53){var _0xeb03b4=[{'name':_0x6c02('0x1d'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0x6c02('0x1e'),'param':0x2},{'name':'url','param':0x3}];var _0x3fc80d={};var _0x3d0143=_0x535a53[_0x6c02('0x1f')](',');var _0x4e65d2=[];for(var _0x2165f5=0x0;_0x2165f5<_0xeb03b4['length'];_0x2165f5++){switch(_0xeb03b4[_0x2165f5][_0x6c02('0x20')]){case _0x6c02('0x1d'):_0x3fc80d['trunk']=_0x3d0143[_0xeb03b4[_0x2165f5][_0x6c02('0x21')]][_0x6c02('0x1f')]('/')[0x1];_0x3fc80d[_0x6c02('0x22')]=_0x3d0143[_0xeb03b4[_0x2165f5][_0x6c02('0x21')]][_0x6c02('0x1f')]('/')[0x2];_0x3fc80d[_0x6c02('0x23')]=_0x3fc80d[_0x6c02('0x22')]?_0x3fc80d[_0x6c02('0x22')]['split']('$')[0x0]:undefined;_0x3fc80d[_0x6c02('0x22')]=route[_0x6c02('0x14')]?(_0x3fc80d[_0x6c02('0x23')]||'')+'${EXTEN:'+route[_0x6c02('0x14')]+'}':(_0x3fc80d[_0x6c02('0x23')]||'')+'${EXTEN}';_0x4e65d2[_0xeb03b4[_0x2165f5]['param']]=[_0x6c02('0x24'),_0x3fc80d['trunk'],_0x3fc80d['phone']][_0x6c02('0x25')]('/');break;case _0x6c02('0x1e'):_0x3fc80d['options']=_0x3d0143[_0xeb03b4[_0x2165f5][_0x6c02('0x21')]];if(route[_0x6c02('0x1a')]!==_0x6c02('0x1b')){if(_0x3fc80d[_0x6c02('0x1e')][_0x6c02('0x26')](_0x6c02('0x27'))<0x0){_0x3fc80d['options']+=_0x6c02('0x27');}}else{_0x3fc80d[_0x6c02('0x1e')]=_0x3fc80d['options']['replace'](_0x6c02('0x27'),'');}_0x4e65d2[_0xeb03b4[_0x2165f5][_0x6c02('0x21')]]=_0x3fc80d[_0x6c02('0x1e')];break;default:_0x4e65d2[_0xeb03b4[_0x2165f5][_0x6c02('0x21')]]=_0x3d0143[_0xeb03b4[_0x2165f5][_0x6c02('0x21')]];}}return _0x4e65d2[_0x6c02('0x25')](',');}function _0x5f2919(_0x28fac2,_0x318e99,_0x342c9b,_0x1a4ab2){return new Promise(function(_0x2c22d7,_0x2a00bc){var _0x5285c0=[];if(_[_0x6c02('0x28')](_0x318e99))return _0x2c22d7(_0x5285c0);_0x41f3da[_0x6c02('0x29')][_0x6c02('0x2a')]({'attributes':['id',_0x6c02('0x2b'),_0x6c02('0x2c')],'raw':!![]})[_0x6c02('0x2d')](function(_0x3300cb){for(var _0x511ab6=0x0,_0x1b27db=0x0;_0x511ab6<_0x318e99[_0x6c02('0x2e')];_0x511ab6++,_0x1b27db=0x0){var _0x29d60e=_0x318e99[_0x511ab6];var _0x1f6259=[];var _0x1847a5=[];if(_0x29d60e['interval']!==_0x6c02('0x2f')){_0x29d60e['intervals']=[_0x29d60e[_0x6c02('0x2b')]];}else{_0x29d60e[_0x6c02('0x30')]=_0x29d60e[_0x6c02('0x2c')]?_[_0x6c02('0x31')](_[_0x6c02('0x32')](_0x3300cb,{'IntervalId':_0x29d60e[_0x6c02('0x2c')]}),_0x6c02('0x2b')):[];}_0x29d60e[_0x6c02('0x6')]=_0x28fac2['context'];_0x29d60e['exten']=_0x28fac2[_0x6c02('0x7')];if(_0x29d60e[_0x6c02('0x4')])_0x29d60e[_0x6c02('0x4')]=_0x29d60e[_0x6c02('0x4')][_0x6c02('0x33')]();if(_0x28fac2['type']===_0x6c02('0x12')){if(_0x29d60e[_0x6c02('0x19')]('tag')&&_0x29d60e[_0x6c02('0x34')]&&_0x29d60e[_0x6c02('0x34')]!=='--'){_0x1f6259['push']({'type':_0x29d60e[_0x6c02('0x4')][_0x6c02('0x33')](),'app':_0x6c02('0x8'),'appdata':'CDR(tag)='+_0x29d60e[_0x6c02('0x34')],'context':_0x28fac2[_0x6c02('0x6')],'exten':_0x28fac2[_0x6c02('0x7')],'priority':_0x29d60e[_0x6c02('0x30')][_0x6c02('0x2e')]+_0x342c9b+_0x1b27db++,'VoiceExtensionId':_0x28fac2['id']});}_0x1f6259['push']({'type':_0x29d60e[_0x6c02('0x4')][_0x6c02('0x33')](),'app':_0x6c02('0x16'),'appdata':_0x6c02('0x35')+(_0x29d60e[_0x6c02('0x36')]?_0x6c02('0x37')+_0x29d60e[_0x6c02('0x36')]+')':_0x6c02('0x38')),'context':_0x28fac2[_0x6c02('0x6')],'exten':_0x28fac2['exten'],'priority':_0x29d60e['intervals'][_0x6c02('0x2e')]+_0x342c9b+_0x1b27db++,'VoiceExtensionId':_0x28fac2['id']});}else{if(_0x29d60e[_0x6c02('0x19')]('answer')){if([_0x6c02('0x39'),_0x6c02('0x3a')][_0x6c02('0x3b')](_0x29d60e[_0x6c02('0x3c')][_0x6c02('0x33')]())&&_0x29d60e['appType']!==_0x6c02('0x3d')){if(_0x29d60e[_0x6c02('0x3e')]){_0x1f6259[_0x6c02('0xe')]({'type':_0x29d60e['type'][_0x6c02('0x33')](),'app':_0x6c02('0x16'),'appdata':_0x6c02('0x3f'),'context':_0x28fac2[_0x6c02('0x6')],'exten':_0x28fac2[_0x6c02('0x7')],'priority':_0x29d60e[_0x6c02('0x30')][_0x6c02('0x2e')]+_0x342c9b+_0x1b27db++,'VoiceExtensionId':_0x28fac2['id']});_0x1f6259[_0x6c02('0xe')]({'type':_0x29d60e['type'][_0x6c02('0x33')](),'app':'Set','appdata':_0x6c02('0x40'),'context':_0x28fac2['context'],'exten':_0x28fac2[_0x6c02('0x7')],'priority':_0x29d60e[_0x6c02('0x30')]['length']+_0x342c9b+_0x1b27db++,'VoiceExtensionId':_0x28fac2['id']});}else{_0x1f6259[_0x6c02('0xe')]({'type':_0x29d60e['type'][_0x6c02('0x33')](),'app':'ExecIf','appdata':_0x6c02('0x41'),'context':_0x28fac2[_0x6c02('0x6')],'exten':_0x28fac2[_0x6c02('0x7')],'priority':_0x29d60e[_0x6c02('0x30')][_0x6c02('0x2e')]+_0x342c9b+_0x1b27db++,'VoiceExtensionId':_0x28fac2['id']});_0x1f6259['push']({'type':_0x29d60e[_0x6c02('0x4')][_0x6c02('0x33')](),'app':'Set','appdata':_0x6c02('0x42'),'context':_0x28fac2[_0x6c02('0x6')],'exten':_0x28fac2['exten'],'priority':_0x29d60e[_0x6c02('0x30')][_0x6c02('0x2e')]+_0x342c9b+_0x1b27db++,'VoiceExtensionId':_0x28fac2['id']});}}}}for(var _0x45f9de=0x0;_0x45f9de<_0x29d60e['intervals'][_0x6c02('0x2e')];_0x45f9de++){var _0x21fd68=_0x342c9b+_0x29d60e['intervals'][_0x6c02('0x2e')];var _0x175e95=_0x45f9de===_0x29d60e[_0x6c02('0x30')]['length']-0x1?_0x342c9b+_0x1f6259[_0x6c02('0x2e')]+_0x1847a5['length']+0x2:_0x342c9b+_0x45f9de+0x1;_0x1f6259[_0x6c02('0x43')](_0x45f9de,0x0,{'type':_0x28fac2[_0x6c02('0x4')],'app':_0x6c02('0x44'),'appdata':_0x29d60e[_0x6c02('0x30')][_0x45f9de]+'?'+_0x28fac2['context']+_0x6c02('0x45')+_0x21fd68+':'+_0x28fac2['context']+_0x6c02('0x45')+_0x175e95,'exten':_0x28fac2['exten'],'context':_0x28fac2[_0x6c02('0x6')],'priority':_0x342c9b+_0x45f9de,'VoiceExtensionId':_0x28fac2['id']});}if(_0x1a4ab2&&_0x29d60e[_0x6c02('0x46')]===_0x6c02('0x47'))_0x29d60e[_0x6c02('0x48')]=_0x410002(_0x29d60e['appdata']);_0x29d60e['priority']=_0x1f6259[_0x6c02('0x2e')]?_[_0x6c02('0x49')](_0x1f6259)[_0x6c02('0x4a')]+0x1:_0x342c9b;_0x5285c0=_[_0x6c02('0x4b')](_0x5285c0,_0x1f6259,[_0x29d60e],_0x1847a5);_0x342c9b=_['last'](_0x5285c0)[_0x6c02('0x4a')]+0x1;}return _0x2c22d7(_0x5285c0);})[_0x6c02('0x4c')](function(_0x3acb2a){_0x2a00bc(_0x3acb2a);});});}return _0x38bdb1[_0x6c02('0x4d')](_0x6c02('0x4e'),attributes,{'tableName':_0x6c02('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x3f5029,_0x218495){var _0x21b54f=this;var _0xfc7a9b=_0x21b54f[_0x6c02('0x4')]===_0x6c02('0x12')?_0x2cde36(_0x21b54f):_0x4c0e02(_0x21b54f);return _0x5f2919(_0x21b54f,_0x3f5029,_[_0x6c02('0x49')](_0xfc7a9b)[_0x6c02('0x4a')]+0x1,_0x218495)['then'](function(_0x462919){var _0x1257af=_[_0x6c02('0x4b')](_0xfc7a9b,_0x462919);_0x1257af[_0x6c02('0xe')]({'type':_0x21b54f['type'],'app':_0x6c02('0x50'),'exten':_0x21b54f['exten'],'context':_0x21b54f[_0x6c02('0x6')],'priority':_[_0x6c02('0x49')](_0x1257af)[_0x6c02('0x4a')]+0x1,'VoiceExtensionId':_0x21b54f['id']});return _0x1257af;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index c700d6c..2bf1f8c 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 _0x746f=['client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','VoiceExtension','findAll','options','attributes','limit','include','map','model','GetVoiceExtension','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x500362,_0x677617){var _0x3bcc99=function(_0x1eb9eb){while(--_0x1eb9eb){_0x500362['push'](_0x500362['shift']());}};_0x3bcc99(++_0x677617);}(_0x746f,0x9c));var _0xf746=function(_0x29b38c,_0x377fae){_0x29b38c=_0x29b38c-0x0;var _0x514494=_0x746f[_0x29b38c];return _0x514494;};'use strict';var _=require(_0xf746('0x0'));var util=require(_0xf746('0x1'));var moment=require(_0xf746('0x2'));var BPromise=require(_0xf746('0x3'));var rs=require(_0xf746('0x4'));var fs=require('fs');var Redis=require(_0xf746('0x5'));var db=require(_0xf746('0x6'))['db'];var utils=require(_0xf746('0x7'));var logger=require(_0xf746('0x8'))(_0xf746('0x9'));var config=require(_0xf746('0xa'));var jayson=require(_0xf746('0xb'));var client=jayson[_0xf746('0xc')][_0xf746('0xd')]({'port':0x232a});config[_0xf746('0xe')]=_[_0xf746('0xf')](config[_0xf746('0xe')],{'host':_0xf746('0x10'),'port':0x18eb});var socket=require(_0xf746('0x11'))(new Redis(config[_0xf746('0xe')]));require(_0xf746('0x12'))[_0xf746('0x13')](socket);function respondWithRpcPromise(_0xfe206a,_0xb5d59f,_0xf72dfd){return new BPromise(function(_0x5dc740,_0x3a0fa8){return client[_0xf746('0x14')](_0xfe206a,_0xf72dfd)[_0xf746('0x15')](function(_0x47ce05){logger[_0xf746('0x16')]('VoiceExtension,\x20%s,\x20%s',_0xb5d59f,_0xf746('0x17'));logger[_0xf746('0x18')](_0xf746('0x19'),_0xb5d59f,_0xf746('0x17'),JSON[_0xf746('0x1a')](_0x47ce05));if(_0x47ce05[_0xf746('0x1b')]){if(_0x47ce05['error'][_0xf746('0x1c')]===0x1f4){logger[_0xf746('0x1b')](_0xf746('0x1d'),_0xb5d59f,_0x47ce05['error'][_0xf746('0x1e')]);return _0x3a0fa8(_0x47ce05[_0xf746('0x1b')][_0xf746('0x1e')]);}logger[_0xf746('0x1b')](_0xf746('0x1d'),_0xb5d59f,_0x47ce05[_0xf746('0x1b')]['message']);return _0x5dc740(_0x47ce05[_0xf746('0x1b')]['message']);}else{logger[_0xf746('0x16')](_0xf746('0x1d'),_0xb5d59f,'request\x20sent');_0x5dc740(_0x47ce05[_0xf746('0x1f')][_0xf746('0x1e')]);}})[_0xf746('0x20')](function(_0x11d8db){logger[_0xf746('0x1b')](_0xf746('0x1d'),_0xb5d59f,_0x11d8db);_0x3a0fa8(_0x11d8db);});});}exports['GetVoiceExtension']=function(_0x37b1c9){var _0x486c27=this;return new Promise(function(_0x15465c,_0x386445){return db[_0xf746('0x21')][_0xf746('0x22')]({'raw':_0x37b1c9[_0xf746('0x23')]?_0x37b1c9[_0xf746('0x23')]['raw']===undefined?!![]:![]:!![],'where':_0x37b1c9[_0xf746('0x23')]?_0x37b1c9['options']['where']||null:null,'attributes':_0x37b1c9[_0xf746('0x23')]?_0x37b1c9[_0xf746('0x23')][_0xf746('0x24')]||null:null,'limit':_0x37b1c9[_0xf746('0x23')]?_0x37b1c9[_0xf746('0x23')][_0xf746('0x25')]||null:null,'include':_0x37b1c9['options']?_0x37b1c9[_0xf746('0x23')][_0xf746('0x26')]?_[_0xf746('0x27')](_0x37b1c9[_0xf746('0x23')]['include'],function(_0x4be1c1){return{'model':db[_0x4be1c1[_0xf746('0x28')]],'as':_0x4be1c1['as'],'attributes':_0x4be1c1['attributes'],'include':_0x4be1c1[_0xf746('0x26')]?_[_0xf746('0x27')](_0x4be1c1[_0xf746('0x26')],function(_0x24fe20){return{'model':db[_0x24fe20[_0xf746('0x28')]],'as':_0x24fe20['as'],'attributes':_0x24fe20['attributes'],'include':_0x24fe20['include']?_[_0xf746('0x27')](_0x24fe20[_0xf746('0x26')],function(_0x2c76a2){return{'model':db[_0x2c76a2[_0xf746('0x28')]],'as':_0x2c76a2['as'],'attributes':_0x2c76a2['attributes']};}):[]};}):[]};}):[]:[]})[_0xf746('0x15')](function(_0x596b9f){logger[_0xf746('0x16')]('GetVoiceExtension',_0x37b1c9);logger[_0xf746('0x18')](_0xf746('0x29'),_0x37b1c9,JSON[_0xf746('0x1a')](_0x596b9f));_0x15465c(_0x596b9f);})[_0xf746('0x20')](function(_0x3eb10c){logger[_0xf746('0x1b')]('GetVoiceExtension',_0x3eb10c[_0xf746('0x1e')],_0x37b1c9);_0x386445(_0x486c27[_0xf746('0x1b')](0x1f4,_0x3eb10c[_0xf746('0x1e')]));});});}; \ No newline at end of file +var _0x31af=['lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','limit','map','include','model','attributes'];(function(_0x465aa9,_0x1bf1c8){var _0x4104e4=function(_0x388bb8){while(--_0x388bb8){_0x465aa9['push'](_0x465aa9['shift']());}};_0x4104e4(++_0x1bf1c8);}(_0x31af,0xde));var _0xf31a=function(_0x26f4d4,_0x7e5472){_0x26f4d4=_0x26f4d4-0x0;var _0xaead60=_0x31af[_0x26f4d4];return _0xaead60;};'use strict';var _=require(_0xf31a('0x0'));var util=require(_0xf31a('0x1'));var moment=require(_0xf31a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf31a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf31a('0x4'));var logger=require(_0xf31a('0x5'))(_0xf31a('0x6'));var config=require(_0xf31a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf31a('0x8')][_0xf31a('0x9')]({'port':0x232a});config[_0xf31a('0xa')]=_[_0xf31a('0xb')](config['redis'],{'host':_0xf31a('0xc'),'port':0x18eb});var socket=require(_0xf31a('0xd'))(new Redis(config[_0xf31a('0xa')]));require(_0xf31a('0xe'))['register'](socket);function respondWithRpcPromise(_0x1c56e9,_0x138d52,_0xcff55c){return new BPromise(function(_0x1ceac2,_0xf2e284){return client['request'](_0x1c56e9,_0xcff55c)[_0xf31a('0xf')](function(_0x1e31d3){logger[_0xf31a('0x10')](_0xf31a('0x11'),_0x138d52,'request\x20sent');logger[_0xf31a('0x12')](_0xf31a('0x13'),_0x138d52,'request\x20sent',JSON[_0xf31a('0x14')](_0x1e31d3));if(_0x1e31d3[_0xf31a('0x15')]){if(_0x1e31d3[_0xf31a('0x15')][_0xf31a('0x16')]===0x1f4){logger[_0xf31a('0x15')](_0xf31a('0x11'),_0x138d52,_0x1e31d3[_0xf31a('0x15')][_0xf31a('0x17')]);return _0xf2e284(_0x1e31d3[_0xf31a('0x15')][_0xf31a('0x17')]);}logger[_0xf31a('0x15')](_0xf31a('0x11'),_0x138d52,_0x1e31d3[_0xf31a('0x15')][_0xf31a('0x17')]);return _0x1ceac2(_0x1e31d3[_0xf31a('0x15')]['message']);}else{logger[_0xf31a('0x10')](_0xf31a('0x11'),_0x138d52,_0xf31a('0x18'));_0x1ceac2(_0x1e31d3[_0xf31a('0x19')]['message']);}})[_0xf31a('0x1a')](function(_0x15f6a9){logger[_0xf31a('0x15')](_0xf31a('0x11'),_0x138d52,_0x15f6a9);_0xf2e284(_0x15f6a9);});});}exports[_0xf31a('0x1b')]=function(_0x516672){var _0xcd2148=this;return new Promise(function(_0xd3ac94,_0x5861df){return db[_0xf31a('0x1c')][_0xf31a('0x1d')]({'raw':_0x516672['options']?_0x516672[_0xf31a('0x1e')][_0xf31a('0x1f')]===undefined?!![]:![]:!![],'where':_0x516672['options']?_0x516672['options']['where']||null:null,'attributes':_0x516672[_0xf31a('0x1e')]?_0x516672[_0xf31a('0x1e')]['attributes']||null:null,'limit':_0x516672[_0xf31a('0x1e')]?_0x516672[_0xf31a('0x1e')][_0xf31a('0x20')]||null:null,'include':_0x516672[_0xf31a('0x1e')]?_0x516672['options']['include']?_[_0xf31a('0x21')](_0x516672[_0xf31a('0x1e')]['include'],function(_0x4e115c){return{'model':db[_0x4e115c['model']],'as':_0x4e115c['as'],'attributes':_0x4e115c['attributes'],'include':_0x4e115c[_0xf31a('0x22')]?_[_0xf31a('0x21')](_0x4e115c[_0xf31a('0x22')],function(_0x595db6){return{'model':db[_0x595db6[_0xf31a('0x23')]],'as':_0x595db6['as'],'attributes':_0x595db6[_0xf31a('0x24')],'include':_0x595db6[_0xf31a('0x22')]?_[_0xf31a('0x21')](_0x595db6[_0xf31a('0x22')],function(_0x5a55c6){return{'model':db[_0x5a55c6[_0xf31a('0x23')]],'as':_0x5a55c6['as'],'attributes':_0x5a55c6[_0xf31a('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x52da7d){logger[_0xf31a('0x10')](_0xf31a('0x1b'),_0x516672);logger['debug'](_0xf31a('0x1b'),_0x516672,JSON[_0xf31a('0x14')](_0x52da7d));_0xd3ac94(_0x52da7d);})[_0xf31a('0x1a')](function(_0x5385ba){logger[_0xf31a('0x15')](_0xf31a('0x1b'),_0x5385ba[_0xf31a('0x17')],_0x516672);_0x5861df(_0xcd2148[_0xf31a('0x15')](0x1f4,_0x5385ba[_0xf31a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 4cedc5f..19db9c6 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 _0x4975=['length','./voiceExtension.events','remove','update','emit','removeListener','register'];(function(_0xb5abf3,_0x39dfed){var _0x126395=function(_0x36c078){while(--_0x36c078){_0xb5abf3['push'](_0xb5abf3['shift']());}};_0x126395(++_0x39dfed);}(_0x4975,0x86));var _0x5497=function(_0x13c809,_0x4e119a){_0x13c809=_0x13c809-0x0;var _0x6d13e=_0x4975[_0x13c809];return _0x6d13e;};'use strict';var VoiceExtensionEvents=require(_0x5497('0x0'));var events=['save',_0x5497('0x1'),_0x5497('0x2')];function createListener(_0xfc7927,_0x349f5f){return function(_0x135f6f){_0x349f5f[_0x5497('0x3')](_0xfc7927,_0x135f6f);};}function removeListener(_0x14cecb,_0xeb31af){return function(){VoiceExtensionEvents[_0x5497('0x4')](_0x14cecb,_0xeb31af);};}exports[_0x5497('0x5')]=function(_0x539a27){for(var _0x37e48d=0x0,_0x4f563d=events[_0x5497('0x6')];_0x37e48d<_0x4f563d;_0x37e48d++){var _0x674a2a=events[_0x37e48d];var _0x368e8b=createListener('voiceExtension:'+_0x674a2a,_0x539a27);VoiceExtensionEvents['on'](_0x674a2a,_0x368e8b);}}; \ No newline at end of file +var _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0x54c0d2,_0x1972c1){var _0x349f85=function(_0x360c46){while(--_0x360c46){_0x54c0d2['push'](_0x54c0d2['shift']());}};_0x349f85(++_0x1972c1);}(_0x1261,0x144));var _0x1126=function(_0x332109,_0x474add){_0x332109=_0x332109-0x0;var _0x7a6ab2=_0x1261[_0x332109];return _0x7a6ab2;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2')];function createListener(_0x331a2c,_0x39b786){return function(_0x350f3a){_0x39b786[_0x1126('0x3')](_0x331a2c,_0x350f3a);};}function removeListener(_0x4245ca,_0x21a480){return function(){VoiceExtensionEvents[_0x1126('0x4')](_0x4245ca,_0x21a480);};}exports['register']=function(_0x5c68c8){for(var _0x40ba58=0x0,_0x907180=events['length'];_0x40ba58<_0x907180;_0x40ba58++){var _0x17e5f0=events[_0x40ba58];var _0x28772d=createListener(_0x1126('0x5')+_0x17e5f0,_0x5c68c8);VoiceExtensionEvents['on'](_0x17e5f0,_0x28772d);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index db6184c..a809ad8 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 _0x4745=['/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','isAuthenticated','/:id/messages','getMessages','post','create','put'];(function(_0x16916f,_0x1655ee){var _0x536d2a=function(_0x8cdc62){while(--_0x8cdc62){_0x16916f['push'](_0x16916f['shift']());}};_0x536d2a(++_0x1655ee);}(_0x4745,0x1e7));var _0x5474=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x4745[_0x484e36];return _0xafc85d;};'use strict';var multer=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var path=require(_0x5474('0x2'));var timeout=require(_0x5474('0x3'));var express=require(_0x5474('0x4'));var router=express[_0x5474('0x5')]();var fs_extra=require(_0x5474('0x6'));var auth=require(_0x5474('0x7'));var interaction=require(_0x5474('0x8'));var config=require(_0x5474('0x9'));var controller=require(_0x5474('0xa'));router[_0x5474('0xb')]('/',auth['isAuthenticated'](),controller[_0x5474('0xc')]);router[_0x5474('0xb')]('/:id',auth[_0x5474('0xd')](),controller['show']);router[_0x5474('0xb')](_0x5474('0xe'),auth['isAuthenticated'](),controller[_0x5474('0xf')]);router[_0x5474('0x10')]('/',auth[_0x5474('0xd')](),controller[_0x5474('0x11')]);router[_0x5474('0x12')](_0x5474('0x13'),auth[_0x5474('0xd')](),controller[_0x5474('0x14')]);router['delete'](_0x5474('0x13'),auth[_0x5474('0xd')](),controller[_0x5474('0x15')]);module[_0x5474('0x16')]=router; \ No newline at end of file +var _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id','show','/:id/messages','getMessages','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x5a3511,_0x1318b4){var _0x575df5=function(_0x5046a4){while(--_0x5046a4){_0x5a3511['push'](_0x5a3511['shift']());}};_0x575df5(++_0x1318b4);}(_0x5fab,0x177));var _0xb5fa=function(_0x2027f5,_0x5a68c1){_0x2027f5=_0x2027f5-0x0;var _0x346d21=_0x5fab[_0x2027f5];return _0x346d21;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index ddac454..e828e7d 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 _0xeb6b=['ENUM','yes','TINYINT(4)','VIRTUAL','fullname','getDataValue','mailbox','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','trim','central'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xeb6b,0x17e));var _0xbeb6=function(_0x3d225f,_0x154f3d){_0x3d225f=_0x3d225f-0x0;var _0xa583ae=_0xeb6b[_0x3d225f];return _0xa583ae;};'use strict';var Sequelize=require('sequelize');module[_0xbeb6('0x0')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xbeb6('0x1')],'defaultValue':_0xbeb6('0x2'),'unique':_0xbeb6('0x3')},'mailbox':{'type':Sequelize[_0xbeb6('0x1')],'defaultValue':'','allowNull':![],'unique':_0xbeb6('0x3')},'password':{'type':Sequelize[_0xbeb6('0x1')]},'fullname':{'type':Sequelize[_0xbeb6('0x1')]},'email':{'type':Sequelize[_0xbeb6('0x1')],'validate':{'isEmail':!![]},'set':function(_0x1876e3){this[_0xbeb6('0x4')](_0xbeb6('0x5'),typeof _0x1876e3==='string'&&_0x1876e3[_0xbeb6('0x6')]()?_0x1876e3['trim']():null);}},'pager':{'type':Sequelize[_0xbeb6('0x1')]},'tz':{'type':Sequelize[_0xbeb6('0x1')],'defaultValue':_0xbeb6('0x7')},'attach':{'type':Sequelize[_0xbeb6('0x8')](_0xbeb6('0x9'),'no'),'defaultValue':_0xbeb6('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0xbeb6('0x8')](_0xbeb6('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xbeb6('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xbeb6('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xbeb6('0x8')](_0xbeb6('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xbeb6('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xbeb6('0x8')](_0xbeb6('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0xbeb6('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xbeb6('0x8')]('yes','no'),'defaultValue':_0xbeb6('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xbeb6('0x8')](_0xbeb6('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xbeb6('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xbeb6('0x8')]('yes','no'),'defaultValue':_0xbeb6('0x9'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xbeb6('0xb')],'get':function(){return this['getDataValue'](_0xbeb6('0xc'))+'\x20-\x20'+this[_0xbeb6('0xd')](_0xbeb6('0xe'));}}}; \ No newline at end of file +var _0xd0e5=['TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','mailbox','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','ENUM','yes'];(function(_0x241fd8,_0x568e21){var _0x3c260e=function(_0x3dfc17){while(--_0x3dfc17){_0x241fd8['push'](_0x241fd8['shift']());}};_0x3c260e(++_0x568e21);}(_0xd0e5,0xab));var _0x5d0e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xd0e5[_0x4ea69d];return _0x5318e0;};'use strict';var Sequelize=require('sequelize');module[_0x5d0e('0x0')]={'customer_id':{'type':Sequelize[_0x5d0e('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x5d0e('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x5d0e('0x1')],'defaultValue':'','allowNull':![],'unique':_0x5d0e('0x3')},'password':{'type':Sequelize[_0x5d0e('0x1')]},'fullname':{'type':Sequelize[_0x5d0e('0x1')]},'email':{'type':Sequelize[_0x5d0e('0x1')],'validate':{'isEmail':!![]},'set':function(_0x1e3a64){this[_0x5d0e('0x4')](_0x5d0e('0x5'),typeof _0x1e3a64===_0x5d0e('0x6')&&_0x1e3a64['trim']()?_0x1e3a64['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x5d0e('0x1')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x5d0e('0x7')]('yes','no'),'defaultValue':_0x5d0e('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x5d0e('0x7')]('yes','no'),'defaultValue':_0x5d0e('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x5d0e('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x5d0e('0x7')](_0x5d0e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x5d0e('0x7')](_0x5d0e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x5d0e('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x5d0e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x5d0e('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x5d0e('0x7')](_0x5d0e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x5d0e('0x7')](_0x5d0e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x5d0e('0x8'),'no'),'defaultValue':_0x5d0e('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x5d0e('0x7')](_0x5d0e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x5d0e('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x5d0e('0x7')](_0x5d0e('0x8'),'no'),'defaultValue':_0x5d0e('0x8'),'allowNull':![]},'stamp':{'type':_0x5d0e('0xa')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x5d0e('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x5d0e('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x5d0e('0xc')],'get':function(){return this['getDataValue']('fullname')+'\x20-\x20'+this[_0x5d0e('0xd')](_0x5d0e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index f6e18e0..4bc3fc4 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 _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(_0x4fc99b,_0x3199fe){var _0x3d31d3=function(_0x468dec){while(--_0x468dec){_0x4fc99b['push'](_0x4fc99b['shift']());}};_0x3d31d3(++_0x3199fe);}(_0xbee3,0xd5));var _0x3bee=function(_0x453ef9,_0x32c3be){_0x453ef9=_0x453ef9-0x0;var _0x319c3a=_0xbee3[_0x453ef9];return _0x319c3a;};'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 +var _0x6f7a=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','Voicemails','destroy','then','sendStatus','error','stack','name','send','index','VoiceMail','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','update','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll'];(function(_0x32a4a3,_0x59db5b){var _0xed38ac=function(_0x457eba){while(--_0x457eba){_0x32a4a3['push'](_0x32a4a3['shift']());}};_0xed38ac(++_0x59db5b);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x5c766f,_0x277f11){_0x5c766f=_0x5c766f-0x0;var _0x234a69=_0x6f7a[_0x5c766f];return _0x234a69;};'use strict';var emlformat=require(_0xa6f7('0x0'));var rimraf=require(_0xa6f7('0x1'));var zipdir=require(_0xa6f7('0x2'));var jsonpatch=require(_0xa6f7('0x3'));var rp=require('request-promise');var moment=require(_0xa6f7('0x4'));var BPromise=require(_0xa6f7('0x5'));var Mustache=require(_0xa6f7('0x6'));var util=require(_0xa6f7('0x7'));var path=require(_0xa6f7('0x8'));var sox=require(_0xa6f7('0x9'));var csv=require(_0xa6f7('0xa'));var ejs=require(_0xa6f7('0xb'));var fs=require('fs');var fs_extra=require(_0xa6f7('0xc'));var _=require(_0xa6f7('0xd'));var squel=require(_0xa6f7('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa6f7('0xf'));var toCsv=require(_0xa6f7('0xa'));var querystring=require(_0xa6f7('0x10'));var Papa=require(_0xa6f7('0x11'));var Redis=require(_0xa6f7('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa6f7('0x13'));var hardwareService=require(_0xa6f7('0x14'));var logger=require('../../config/logger')(_0xa6f7('0x15'));var utils=require('../../config/utils');var config=require(_0xa6f7('0x16'));var licenseUtil=require(_0xa6f7('0x17'));var db=require(_0xa6f7('0x18'))['db'];function respondWithStatusCode(_0xd5558b,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x3fc7f1){if(_0x3fc7f1){return _0xd5558b['sendStatus'](_0x5a3035);}return _0xd5558b[_0xa6f7('0x19')](_0x5a3035)[_0xa6f7('0x1a')]();};}function respondWithResult(_0x25c123,_0x4d3d59){_0x4d3d59=_0x4d3d59||0xc8;return function(_0x34c02d){if(_0x34c02d){return _0x25c123['status'](_0x4d3d59)[_0xa6f7('0x1b')](_0x34c02d);}};}function respondWithFilteredResult(_0x57308a,_0x17b814){return function(_0x17f9c5){if(_0x17f9c5){var _0x6efd38=typeof _0x17b814['offset']===_0xa6f7('0x1c')&&typeof _0x17b814[_0xa6f7('0x1d')]===_0xa6f7('0x1c');var _0x2401b9=_0x17f9c5['count'];var _0x4a8827=_0x6efd38?0x0:_0x17b814[_0xa6f7('0x1e')];var _0x5298ba=_0x6efd38?_0x17f9c5[_0xa6f7('0x1f')]:_0x17b814[_0xa6f7('0x1e')]+_0x17b814['limit'];var _0x18fc4a;if(_0x5298ba>=_0x2401b9){_0x5298ba=_0x2401b9;_0x18fc4a=0xc8;}else{_0x18fc4a=0xce;}_0x57308a[_0xa6f7('0x19')](_0x18fc4a);return _0x57308a[_0xa6f7('0x20')](_0xa6f7('0x21'),_0x4a8827+'-'+_0x5298ba+'/'+_0x2401b9)[_0xa6f7('0x1b')](_0x17f9c5);}return null;};}function patchUpdates(_0x1aa8dc){return function(_0x4887ad){try{jsonpatch[_0xa6f7('0x22')](_0x4887ad,_0x1aa8dc,!![]);}catch(_0x45d79e){return BPromise['reject'](_0x45d79e);}return _0x4887ad['save']();};}function saveUpdates(_0x5ddc8d,_0x1de6c9){return function(_0x119950){if(_0x119950){return _0x119950['update'](_0x5ddc8d)['then'](function(_0x50e2be){return _0x50e2be;});}return null;};}function removeEntity(_0x2b6a84,_0xc77e8e){return function(_0x28263e){if(_0x28263e){return _0x28263e['destroy']()['then'](function(){var _0x2f4907=_0x28263e['get']({'plain':!![]});var _0x47ef97=_0xa6f7('0x23');return db['UserProfileResource'][_0xa6f7('0x24')]({'where':{'type':_0x47ef97,'resourceId':_0x2f4907['id']}})[_0xa6f7('0x25')](function(){return _0x28263e;});})[_0xa6f7('0x25')](function(){_0x2b6a84[_0xa6f7('0x19')](0xcc)[_0xa6f7('0x1a')]();});}};}function handleEntityNotFound(_0x4b8d2b,_0x51db47){return function(_0x1c419b){if(!_0x1c419b){_0x4b8d2b[_0xa6f7('0x26')](0x194);}return _0x1c419b;};}function handleError(_0x55d45a,_0x267917){_0x267917=_0x267917||0x1f4;return function(_0x27babb){logger[_0xa6f7('0x27')](_0x27babb[_0xa6f7('0x28')]);if(_0x27babb[_0xa6f7('0x29')]){delete _0x27babb[_0xa6f7('0x29')];}_0x55d45a[_0xa6f7('0x19')](_0x267917)[_0xa6f7('0x2a')](_0x27babb);};}exports[_0xa6f7('0x2b')]=function(_0x3dee2e,_0x40b0f8){var _0x278bad={},_0x52f9c1={},_0x442ccf={'count':0x0,'rows':[]};var _0x42dc49=_['map'](db[_0xa6f7('0x2c')][_0xa6f7('0x2d')],function(_0x4d79d8){return{'name':_0x4d79d8['fieldName'],'type':_0x4d79d8[_0xa6f7('0x2e')][_0xa6f7('0x2f')]};});_0x52f9c1[_0xa6f7('0x30')]=_[_0xa6f7('0x31')](_0x42dc49,_0xa6f7('0x29'));_0x52f9c1['query']=_['keys'](_0x3dee2e[_0xa6f7('0x32')]);_0x52f9c1['filters']=_[_0xa6f7('0x33')](_0x52f9c1[_0xa6f7('0x30')],_0x52f9c1[_0xa6f7('0x32')]);_0x278bad[_0xa6f7('0x34')]=_[_0xa6f7('0x33')](_0x52f9c1[_0xa6f7('0x30')],qs['fields'](_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x35')]));_0x278bad[_0xa6f7('0x34')]=_0x278bad['attributes'][_0xa6f7('0x36')]?_0x278bad['attributes']:_0x52f9c1[_0xa6f7('0x30')];if(!_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x37')]('nolimit')){_0x278bad[_0xa6f7('0x1d')]=qs[_0xa6f7('0x1d')](_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x1d')]);_0x278bad[_0xa6f7('0x1e')]=qs[_0xa6f7('0x1e')](_0x3dee2e['query'][_0xa6f7('0x1e')]);}_0x278bad[_0xa6f7('0x38')]=qs[_0xa6f7('0x39')](_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x39')]);_0x278bad[_0xa6f7('0x3a')]=qs[_0xa6f7('0x3b')](_[_0xa6f7('0x3c')](_0x3dee2e['query'],_0x52f9c1[_0xa6f7('0x3b')]),_0x42dc49);if(_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x3d')]){_0x278bad['where']=_[_0xa6f7('0x3e')](_0x278bad[_0xa6f7('0x3a')],{'$or':_['map'](_0x42dc49,function(_0x39349a){if(_0x39349a[_0xa6f7('0x2e')]!==_0xa6f7('0x3f')){var _0x14d532={};_0x14d532[_0x39349a[_0xa6f7('0x29')]]={'$like':'%'+_0x3dee2e['query'][_0xa6f7('0x3d')]+'%'};return _0x14d532;}})});}_0x278bad=_[_0xa6f7('0x3e')]({},_0x278bad,_0x3dee2e[_0xa6f7('0x40')]);var _0x1b8bf3={'where':_0x278bad[_0xa6f7('0x3a')]};return db[_0xa6f7('0x2c')][_0xa6f7('0x1f')](_0x1b8bf3)[_0xa6f7('0x25')](function(_0x5646b9){_0x442ccf['count']=_0x5646b9;if(_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x41')]){_0x278bad[_0xa6f7('0x42')]=[{'all':!![]}];}return db[_0xa6f7('0x2c')][_0xa6f7('0x43')](_0x278bad);})[_0xa6f7('0x25')](function(_0x21fdd7){_0x442ccf[_0xa6f7('0x44')]=_0x21fdd7;return _0x442ccf;})[_0xa6f7('0x25')](respondWithFilteredResult(_0x40b0f8,_0x278bad))[_0xa6f7('0x45')](handleError(_0x40b0f8,null));};exports['show']=function(_0x41917c,_0x30be3b){var _0x4d5846={'raw':!![],'where':{'id':_0x41917c[_0xa6f7('0x46')]['id']}},_0x22d500={};_0x22d500[_0xa6f7('0x30')]=_[_0xa6f7('0x47')](db['VoiceMail'][_0xa6f7('0x2d')]);_0x22d500['query']=_['keys'](_0x41917c[_0xa6f7('0x32')]);_0x22d500[_0xa6f7('0x3b')]=_[_0xa6f7('0x33')](_0x22d500[_0xa6f7('0x30')],_0x22d500[_0xa6f7('0x32')]);_0x4d5846[_0xa6f7('0x34')]=_[_0xa6f7('0x33')](_0x22d500['model'],qs[_0xa6f7('0x35')](_0x41917c[_0xa6f7('0x32')]['fields']));_0x4d5846[_0xa6f7('0x34')]=_0x4d5846[_0xa6f7('0x34')][_0xa6f7('0x36')]?_0x4d5846['attributes']:_0x22d500[_0xa6f7('0x30')];if(_0x41917c['query'][_0xa6f7('0x41')]){_0x4d5846[_0xa6f7('0x42')]=[{'all':!![]}];}_0x4d5846=_[_0xa6f7('0x3e')]({},_0x4d5846,_0x41917c['options']);return db['VoiceMail'][_0xa6f7('0x48')](_0x4d5846)['then'](handleEntityNotFound(_0x30be3b,null))[_0xa6f7('0x25')](respondWithResult(_0x30be3b,null))['catch'](handleError(_0x30be3b,null));};exports['create']=function(_0x1e7089,_0x2e3a04){return db[_0xa6f7('0x2c')][_0xa6f7('0x49')](_0x1e7089[_0xa6f7('0x4a')],{})[_0xa6f7('0x25')](function(_0x5d9b6f){var _0x4032fc=_0x1e7089[_0xa6f7('0x4b')]['get']({'plain':!![]});if(!_0x4032fc)throw new Error(_0xa6f7('0x4c'));if(_0x4032fc['role']===_0xa6f7('0x4b')){var _0x59091a=_0x5d9b6f['get']({'plain':!![]});var _0x60eacc=_0xa6f7('0x23');return db[_0xa6f7('0x4d')][_0xa6f7('0x48')]({'where':{'name':_0x60eacc,'userProfileId':_0x4032fc[_0xa6f7('0x4e')]},'raw':!![]})['then'](function(_0x340d3f){if(_0x340d3f&&_0x340d3f[_0xa6f7('0x4f')]===0x0){return db['UserProfileResource'][_0xa6f7('0x49')]({'name':_0x59091a['name'],'resourceId':_0x59091a['id'],'type':_0x340d3f[_0xa6f7('0x29')],'sectionId':_0x340d3f['id']},{})[_0xa6f7('0x25')](function(){return _0x5d9b6f;});}else{return _0x5d9b6f;}})[_0xa6f7('0x45')](function(_0x55369a){logger[_0xa6f7('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55369a);throw _0x55369a;});}return _0x5d9b6f;})[_0xa6f7('0x25')](respondWithResult(_0x2e3a04,0xc9))[_0xa6f7('0x45')](handleError(_0x2e3a04,null));};exports[_0xa6f7('0x50')]=function(_0x1dcb45,_0xa6bff9){if(_0x1dcb45['body']['id']){delete _0x1dcb45['body']['id'];}return db[_0xa6f7('0x2c')][_0xa6f7('0x48')]({'where':{'id':_0x1dcb45[_0xa6f7('0x46')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0xa6bff9,null))['then'](saveUpdates(_0x1dcb45[_0xa6f7('0x4a')],null))[_0xa6f7('0x25')](respondWithResult(_0xa6bff9,null))[_0xa6f7('0x45')](handleError(_0xa6bff9,null));};exports[_0xa6f7('0x24')]=function(_0x1b33a5,_0x39538e){return db['VoiceMail'][_0xa6f7('0x48')]({'where':{'id':_0x1b33a5[_0xa6f7('0x46')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0x39538e,null))['then'](removeEntity(_0x39538e,null))[_0xa6f7('0x45')](handleError(_0x39538e,null));};exports[_0xa6f7('0x51')]=function(_0x139192,_0x4496f1,_0x5908e3){return db['VoiceMail'][_0xa6f7('0x52')]({'where':{'id':_0x139192[_0xa6f7('0x46')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0x4496f1,null))[_0xa6f7('0x25')](function(_0x301327){var _0x269249;var _0x1fcb72={},_0x5efd49={};_0x5efd49[_0xa6f7('0x30')]=_[_0xa6f7('0x47')](db[_0xa6f7('0x53')][_0xa6f7('0x2d')]);_0x5efd49[_0xa6f7('0x32')]=_[_0xa6f7('0x47')](_0x139192[_0xa6f7('0x32')]);_0x5efd49[_0xa6f7('0x3b')]=_[_0xa6f7('0x33')](_0x5efd49[_0xa6f7('0x30')],_0x5efd49[_0xa6f7('0x32')]);_0x1fcb72['attributes']=_[_0xa6f7('0x33')](_0x5efd49['model'],qs[_0xa6f7('0x35')](_0x139192['query'][_0xa6f7('0x35')]));_0x1fcb72[_0xa6f7('0x34')]=_0x1fcb72['attributes'][_0xa6f7('0x36')]?_0x1fcb72[_0xa6f7('0x34')]:_0x5efd49[_0xa6f7('0x30')];if(!_0x139192['query'][_0xa6f7('0x37')]('nolimit')){_0x1fcb72[_0xa6f7('0x1d')]=qs[_0xa6f7('0x1d')](_0x139192['query'][_0xa6f7('0x1d')]);_0x1fcb72['offset']=qs[_0xa6f7('0x1e')](_0x139192['query'][_0xa6f7('0x1e')]);}_0x1fcb72[_0xa6f7('0x38')]=qs[_0xa6f7('0x39')](_0x139192[_0xa6f7('0x32')][_0xa6f7('0x39')]);_0x1fcb72[_0xa6f7('0x3a')]=qs[_0xa6f7('0x3b')](_[_0xa6f7('0x3c')](_0x139192[_0xa6f7('0x32')],_0x5efd49[_0xa6f7('0x3b')]));if(_0x139192[_0xa6f7('0x32')][_0xa6f7('0x3d')]){_0x1fcb72['where']=_[_0xa6f7('0x3e')](_0x1fcb72[_0xa6f7('0x3a')],{'$or':_[_0xa6f7('0x31')](_0x1fcb72[_0xa6f7('0x34')],function(_0x154c78){var _0x3a464e={};_0x3a464e[_0x154c78]={'$like':'%'+_0x139192[_0xa6f7('0x32')][_0xa6f7('0x3d')]+'%'};return _0x3a464e;})});}_0x1fcb72['where']=_[_0xa6f7('0x3e')](_0x1fcb72[_0xa6f7('0x3a')],{'mailboxuser':_0x301327[_0xa6f7('0x54')]});_0x1fcb72=_['merge']({},_0x1fcb72,_0x139192[_0xa6f7('0x40')]);return db[_0xa6f7('0x53')][_0xa6f7('0x55')](_0x1fcb72)[_0xa6f7('0x25')](respondWithFilteredResult(_0x4496f1,_0x1fcb72));})[_0xa6f7('0x45')](handleError(_0x4496f1,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 0c29fc1..69cb349 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 _0x0a6d=['api','moment','rimraf','../../config/environment','exports','define','VoiceMail','mailbox_context','mailbox','context','lodash','util','../../config/logger'];(function(_0x12387d,_0x4bb008){var _0x78d5d3=function(_0x3ec1cd){while(--_0x3ec1cd){_0x12387d['push'](_0x12387d['shift']());}};_0x78d5d3(++_0x4bb008);}(_0x0a6d,0xa6));var _0xd0a6=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x0a6d[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0xd0a6('0x0'));var util=require(_0xd0a6('0x1'));var logger=require(_0xd0a6('0x2'))(_0xd0a6('0x3'));var moment=require(_0xd0a6('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd0a6('0x5'));var config=require(_0xd0a6('0x6'));var attributes=require('./voiceMail.attributes');module[_0xd0a6('0x7')]=function(_0x3d78bf,_0x14eb86){return _0x3d78bf[_0xd0a6('0x8')](_0xd0a6('0x9'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xd0a6('0xa'),'fields':[_0xd0a6('0xb'),_0xd0a6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc2cd=['VoiceMail','voice_voicemail','mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceMail.attributes','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc2cd,0x1b7));var _0xdc2c=function(_0x1af4bc,_0x1761e5){_0x1af4bc=_0x1af4bc-0x0;var _0x17459a=_0xc2cd[_0x1af4bc];return _0x17459a;};'use strict';var _=require(_0xdc2c('0x0'));var util=require(_0xdc2c('0x1'));var logger=require(_0xdc2c('0x2'))(_0xdc2c('0x3'));var moment=require(_0xdc2c('0x4'));var BPromise=require(_0xdc2c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc2c('0x6'));var rimraf=require(_0xdc2c('0x7'));var config=require(_0xdc2c('0x8'));var attributes=require(_0xdc2c('0x9'));module[_0xdc2c('0xa')]=function(_0x28f01d,_0x44efc4){return _0x28f01d['define'](_0xdc2c('0xb'),attributes,{'tableName':_0xdc2c('0xc'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xdc2c('0xd'),_0xdc2c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 783c750..512942d 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 _0xc2cd=['../../config/environment','jayson/promise','client','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x20f5ea,_0x5146ef){var _0x3dee4f=function(_0x3c418f){while(--_0x3c418f){_0x20f5ea['push'](_0x20f5ea['shift']());}};_0x3dee4f(++_0x5146ef);}(_0xc2cd,0x12e));var _0xdc2c=function(_0x16d786,_0x5cd7ff){_0x16d786=_0x16d786-0x0;var _0x375e28=_0xc2cd[_0x16d786];return _0x375e28;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xdc2c('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdc2c('0x1'));var db=require(_0xdc2c('0x2'))['db'];var utils=require(_0xdc2c('0x3'));var logger=require(_0xdc2c('0x4'))(_0xdc2c('0x5'));var config=require(_0xdc2c('0x6'));var jayson=require(_0xdc2c('0x7'));var client=jayson[_0xdc2c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x77906e,_0x50fb8f,_0x123114){return new BPromise(function(_0x1a2200,_0x2a3173){return client[_0xdc2c('0x9')](_0x77906e,_0x123114)[_0xdc2c('0xa')](function(_0x483182){logger[_0xdc2c('0xb')](_0xdc2c('0xc'),_0x50fb8f,_0xdc2c('0xd'));logger[_0xdc2c('0xe')](_0xdc2c('0xf'),_0x50fb8f,_0xdc2c('0xd'),JSON[_0xdc2c('0x10')](_0x483182));if(_0x483182[_0xdc2c('0x11')]){if(_0x483182[_0xdc2c('0x11')][_0xdc2c('0x12')]===0x1f4){logger[_0xdc2c('0x11')]('VoiceMail,\x20%s,\x20%s',_0x50fb8f,_0x483182[_0xdc2c('0x11')]['message']);return _0x2a3173(_0x483182[_0xdc2c('0x11')][_0xdc2c('0x13')]);}logger[_0xdc2c('0x11')](_0xdc2c('0xc'),_0x50fb8f,_0x483182[_0xdc2c('0x11')][_0xdc2c('0x13')]);return _0x1a2200(_0x483182['error'][_0xdc2c('0x13')]);}else{logger[_0xdc2c('0xb')]('VoiceMail,\x20%s,\x20%s',_0x50fb8f,_0xdc2c('0xd'));_0x1a2200(_0x483182[_0xdc2c('0x14')][_0xdc2c('0x13')]);}})[_0xdc2c('0x15')](function(_0x43ed9a){logger[_0xdc2c('0x11')]('VoiceMail,\x20%s,\x20%s',_0x50fb8f,_0x43ed9a);_0x2a3173(_0x43ed9a);});});} \ No newline at end of file +var _0x5a40=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x475c60,_0x1209c9){var _0x225a7b=function(_0x1241b4){while(--_0x1241b4){_0x475c60['push'](_0x475c60['shift']());}};_0x225a7b(++_0x1209c9);}(_0x5a40,0xf5));var _0x05a4=function(_0x351056,_0x4a65fa){_0x351056=_0x351056-0x0;var _0x236a39=_0x5a40[_0x351056];return _0x236a39;};'use strict';var _=require(_0x05a4('0x0'));var util=require(_0x05a4('0x1'));var moment=require(_0x05a4('0x2'));var BPromise=require(_0x05a4('0x3'));var rs=require(_0x05a4('0x4'));var fs=require('fs');var Redis=require(_0x05a4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x05a4('0x6'));var config=require(_0x05a4('0x7'));var jayson=require(_0x05a4('0x8'));var client=jayson['client'][_0x05a4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2404e2,_0x2aa926,_0x4be311){return new BPromise(function(_0xab414d,_0x2ffbcd){return client[_0x05a4('0xa')](_0x2404e2,_0x4be311)['then'](function(_0x3fb59d){logger[_0x05a4('0xb')](_0x05a4('0xc'),_0x2aa926,_0x05a4('0xd'));logger[_0x05a4('0xe')](_0x05a4('0xf'),_0x2aa926,'request\x20sent',JSON[_0x05a4('0x10')](_0x3fb59d));if(_0x3fb59d['error']){if(_0x3fb59d[_0x05a4('0x11')][_0x05a4('0x12')]===0x1f4){logger[_0x05a4('0x11')](_0x05a4('0xc'),_0x2aa926,_0x3fb59d[_0x05a4('0x11')]['message']);return _0x2ffbcd(_0x3fb59d[_0x05a4('0x11')][_0x05a4('0x13')]);}logger[_0x05a4('0x11')](_0x05a4('0xc'),_0x2aa926,_0x3fb59d['error']['message']);return _0xab414d(_0x3fb59d[_0x05a4('0x11')][_0x05a4('0x13')]);}else{logger['info'](_0x05a4('0xc'),_0x2aa926,_0x05a4('0xd'));_0xab414d(_0x3fb59d[_0x05a4('0x14')][_0x05a4('0x13')]);}})[_0x05a4('0x15')](function(_0x350c1a){logger[_0x05a4('0x11')](_0x05a4('0xc'),_0x2aa926,_0x350c1a);_0x2ffbcd(_0x350c1a);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index cfbcfdd..db604ee 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 _0x9c10=['download','put','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','/:id','isAuthenticated','show'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9c10,0xe1));var _0x09c1=function(_0x7bb4e,_0x4f9a3e){_0x7bb4e=_0x7bb4e-0x0;var _0x1f2978=_0x9c10[_0x7bb4e];return _0x1f2978;};'use strict';var multer=require(_0x09c1('0x0'));var util=require(_0x09c1('0x1'));var path=require('path');var timeout=require(_0x09c1('0x2'));var express=require(_0x09c1('0x3'));var router=express[_0x09c1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x09c1('0x5'));var interaction=require(_0x09c1('0x6'));var config=require(_0x09c1('0x7'));var controller=require(_0x09c1('0x8'));router[_0x09c1('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x09c1('0x9')](_0x09c1('0xa'),auth[_0x09c1('0xb')](),controller[_0x09c1('0xc')]);router[_0x09c1('0x9')]('/:id/download',auth[_0x09c1('0xb')](),controller[_0x09c1('0xd')]);router['post']('/',auth[_0x09c1('0xb')](),controller['create']);router[_0x09c1('0xe')]('/:id',auth[_0x09c1('0xb')](),controller['update']);router['delete']('/:id',auth[_0x09c1('0xb')](),controller[_0x09c1('0xf')]);module[_0x09c1('0x10')]=router; \ No newline at end of file +var _0x2b3c=['show','/:id/download','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','/:id','isAuthenticated'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x2b3c,0x1ac));var _0xc2b3=function(_0x359f25,_0x15f761){_0x359f25=_0x359f25-0x0;var _0x3c4fc2=_0x2b3c[_0x359f25];return _0x3c4fc2;};'use strict';var multer=require(_0xc2b3('0x0'));var util=require(_0xc2b3('0x1'));var path=require(_0xc2b3('0x2'));var timeout=require(_0xc2b3('0x3'));var express=require('express');var router=express[_0xc2b3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc2b3('0x5'));var interaction=require(_0xc2b3('0x6'));var config=require(_0xc2b3('0x7'));var controller=require(_0xc2b3('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc2b3('0x9')](_0xc2b3('0xa'),auth[_0xc2b3('0xb')](),controller[_0xc2b3('0xc')]);router['get'](_0xc2b3('0xd'),auth['isAuthenticated'](),controller['download']);router[_0xc2b3('0xe')]('/',auth[_0xc2b3('0xb')](),controller[_0xc2b3('0xf')]);router[_0xc2b3('0x10')](_0xc2b3('0xa'),auth['isAuthenticated'](),controller[_0xc2b3('0x11')]);router[_0xc2b3('0x12')](_0xc2b3('0xa'),auth[_0xc2b3('0xb')](),controller[_0xc2b3('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 8ed0a79..4888050 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 _0x7085=['getDataValue','INTEGER','STRING','long','TIMESTAMP','literal','sequelize'];(function(_0x1c6719,_0x2a9c16){var _0x6a7ae3=function(_0x49be1d){while(--_0x49be1d){_0x1c6719['push'](_0x1c6719['shift']());}};_0x6a7ae3(++_0x2a9c16);}(_0x7085,0x133));var _0x5708=function(_0xd70344,_0x304eac){_0xd70344=_0xd70344-0x0;var _0x338d4b=_0x7085[_0xd70344];return _0x338d4b;};'use strict';var Sequelize=require(_0x5708('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0xa85546){return this[_0x5708('0x1')]('id');}},'msgnum':{'type':Sequelize[_0x5708('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x5708('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x5708('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x5708('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x5708('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x5708('0x3')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x5708('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0x5708('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x5708('0x3')],'defaultValue':''},'stamp':{'type':_0x5708('0x5'),'defaultValue':Sequelize[_0x5708('0x6')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x6eba=['VIRTUAL','getDataValue','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports'];(function(_0x303c30,_0x16edcb){var _0x43161b=function(_0x3330ff){while(--_0x3330ff){_0x303c30['push'](_0x303c30['shift']());}};_0x43161b(++_0x16edcb);}(_0x6eba,0x143));var _0xa6eb=function(_0x4072fa,_0x46c0f8){_0x4072fa=_0x4072fa-0x0;var _0x10e45a=_0x6eba[_0x4072fa];return _0x10e45a;};'use strict';var Sequelize=require('sequelize');module[_0xa6eb('0x0')]={'name':{'type':Sequelize[_0xa6eb('0x1')],'get':function(_0x4f25d7){return this[_0xa6eb('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xa6eb('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xa6eb('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xa6eb('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xa6eb('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xa6eb('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xa6eb('0x4')](_0xa6eb('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xa6eb('0x3')],'defaultValue':''},'stamp':{'type':_0xa6eb('0x6'),'defaultValue':Sequelize[_0xa6eb('0x7')](_0xa6eb('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index d2f4706..3f5cfc1 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 _0xcc36=['length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','body','params','destroy','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','stack','name','send','VoiceMailMessage','rawAttributes','key','model','differenceBy','map','query','keys','filters','intersection','attributes','fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc36,0xc7));var _0x6cc3=function(_0x4be43e,_0x22febf){_0x4be43e=_0x4be43e-0x0;var _0xb3b959=_0xcc36[_0x4be43e];return _0xb3b959;};'use strict';var emlformat=require(_0x6cc3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6cc3('0x1'));var jsonpatch=require(_0x6cc3('0x2'));var rp=require(_0x6cc3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6cc3('0x4'));var path=require('path');var sox=require(_0x6cc3('0x5'));var csv=require(_0x6cc3('0x6'));var ejs=require(_0x6cc3('0x7'));var fs=require('fs');var fs_extra=require(_0x6cc3('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6cc3('0x9'));var jsforce=require(_0x6cc3('0xa'));var deskjs=require(_0x6cc3('0xb'));var toCsv=require('to-csv');var querystring=require(_0x6cc3('0xc'));var Papa=require(_0x6cc3('0xd'));var Redis=require(_0x6cc3('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6cc3('0xf'));var hardwareService=require(_0x6cc3('0x10'));var logger=require('../../config/logger')(_0x6cc3('0x11'));var utils=require(_0x6cc3('0x12'));var config=require(_0x6cc3('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x6cc3('0x14'))['db'];function respondWithStatusCode(_0x1dfdaf,_0x37ef96){_0x37ef96=_0x37ef96||0xcc;return function(_0x5623f1){if(_0x5623f1){return _0x1dfdaf[_0x6cc3('0x15')](_0x37ef96);}return _0x1dfdaf[_0x6cc3('0x16')](_0x37ef96)[_0x6cc3('0x17')]();};}function respondWithResult(_0x167b48,_0xfb6943){_0xfb6943=_0xfb6943||0xc8;return function(_0x5f416f){if(_0x5f416f){return _0x167b48['status'](_0xfb6943)['json'](_0x5f416f);}};}function respondWithFilteredResult(_0x40242e,_0x505246){return function(_0xf292f1){if(_0xf292f1){var _0x321c01=typeof _0x505246[_0x6cc3('0x18')]==='undefined'&&typeof _0x505246[_0x6cc3('0x19')]===_0x6cc3('0x1a');var _0x35200f=_0xf292f1[_0x6cc3('0x1b')];var _0x261797=_0x321c01?0x0:_0x505246['offset'];var _0x15766a=_0x321c01?_0xf292f1[_0x6cc3('0x1b')]:_0x505246[_0x6cc3('0x18')]+_0x505246[_0x6cc3('0x19')];var _0x25639e;if(_0x15766a>=_0x35200f){_0x15766a=_0x35200f;_0x25639e=0xc8;}else{_0x25639e=0xce;}_0x40242e[_0x6cc3('0x16')](_0x25639e);return _0x40242e[_0x6cc3('0x1c')](_0x6cc3('0x1d'),_0x261797+'-'+_0x15766a+'/'+_0x35200f)[_0x6cc3('0x1e')](_0xf292f1);}return null;};}function patchUpdates(_0x29b531){return function(_0x4bd6b0){try{jsonpatch[_0x6cc3('0x1f')](_0x4bd6b0,_0x29b531,!![]);}catch(_0x1bed00){return BPromise[_0x6cc3('0x20')](_0x1bed00);}return _0x4bd6b0['save']();};}function saveUpdates(_0x345c49,_0x4d357f){return function(_0x457aca){if(_0x457aca){return _0x457aca[_0x6cc3('0x21')](_0x345c49)[_0x6cc3('0x22')](function(_0x20ebe2){return _0x20ebe2;});}return null;};}function removeEntity(_0x74e7b0,_0x2bca44){return function(_0x8b5c03){if(_0x8b5c03){return _0x8b5c03['destroy']()['then'](function(){_0x74e7b0[_0x6cc3('0x16')](0xcc)[_0x6cc3('0x17')]();});}};}function handleEntityNotFound(_0x30ac78,_0x4779a5){return function(_0x50423b){if(!_0x50423b){_0x30ac78[_0x6cc3('0x15')](0x194);}return _0x50423b;};}function handleError(_0xfe3a6b,_0x2b019f){_0x2b019f=_0x2b019f||0x1f4;return function(_0x27991e){logger['error'](_0x27991e[_0x6cc3('0x23')]);if(_0x27991e[_0x6cc3('0x24')]){delete _0x27991e['name'];}_0xfe3a6b['status'](_0x2b019f)[_0x6cc3('0x25')](_0x27991e);};}exports['index']=function(_0x1aa476,_0x18d7ec){var _0x33ff05={},_0x57ee0e={},_0x17fb84={'count':0x0,'rows':[]};var _0x4be9c1=_['map'](db[_0x6cc3('0x26')][_0x6cc3('0x27')],function(_0x15ad6c){return{'name':_0x15ad6c['fieldName'],'type':_0x15ad6c['type'][_0x6cc3('0x28')]};});_0x57ee0e[_0x6cc3('0x29')]=_[_0x6cc3('0x2a')](_[_0x6cc3('0x2b')](_0x4be9c1,'name'),[_0x6cc3('0x24')]);_0x57ee0e[_0x6cc3('0x2c')]=_[_0x6cc3('0x2d')](_0x1aa476[_0x6cc3('0x2c')]);_0x57ee0e[_0x6cc3('0x2e')]=_[_0x6cc3('0x2f')](_0x57ee0e[_0x6cc3('0x29')],_0x57ee0e['query']);_0x33ff05[_0x6cc3('0x30')]=_[_0x6cc3('0x2f')](_0x57ee0e[_0x6cc3('0x29')],qs[_0x6cc3('0x31')](_0x1aa476['query']['fields']));_0x33ff05[_0x6cc3('0x30')]=_0x33ff05[_0x6cc3('0x30')][_0x6cc3('0x32')]?_0x33ff05[_0x6cc3('0x30')]:_0x57ee0e[_0x6cc3('0x29')];if(!_0x1aa476[_0x6cc3('0x2c')][_0x6cc3('0x33')](_0x6cc3('0x34'))){_0x33ff05[_0x6cc3('0x19')]=qs[_0x6cc3('0x19')](_0x1aa476[_0x6cc3('0x2c')][_0x6cc3('0x19')]);_0x33ff05[_0x6cc3('0x18')]=qs['offset'](_0x1aa476[_0x6cc3('0x2c')][_0x6cc3('0x18')]);}_0x33ff05[_0x6cc3('0x35')]=qs[_0x6cc3('0x36')](_0x1aa476[_0x6cc3('0x2c')][_0x6cc3('0x36')]);_0x33ff05['where']=qs[_0x6cc3('0x2e')](_[_0x6cc3('0x37')](_0x1aa476[_0x6cc3('0x2c')],_0x57ee0e[_0x6cc3('0x2e')]),_0x4be9c1);if(_0x1aa476[_0x6cc3('0x2c')][_0x6cc3('0x38')]){_0x33ff05[_0x6cc3('0x39')]=_[_0x6cc3('0x3a')](_0x33ff05[_0x6cc3('0x39')],{'$or':_[_0x6cc3('0x2b')](_0x4be9c1,function(_0x1d2a58){if(_0x1d2a58[_0x6cc3('0x3b')]!==_0x6cc3('0x3c')){var _0x52e86a={};_0x52e86a[_0x1d2a58[_0x6cc3('0x24')]]={'$like':'%'+_0x1aa476[_0x6cc3('0x2c')]['filter']+'%'};return _0x52e86a;}})});}_0x33ff05=_[_0x6cc3('0x3a')]({},_0x33ff05,_0x1aa476[_0x6cc3('0x3d')]);var _0x9c32b3={'where':_0x33ff05[_0x6cc3('0x39')]};return db[_0x6cc3('0x26')]['count'](_0x9c32b3)[_0x6cc3('0x22')](function(_0x1587d0){_0x17fb84[_0x6cc3('0x1b')]=_0x1587d0;if(_0x1aa476[_0x6cc3('0x2c')]['includeAll']){_0x33ff05[_0x6cc3('0x3e')]=[{'all':!![]}];}return db[_0x6cc3('0x26')][_0x6cc3('0x3f')](_0x33ff05);})[_0x6cc3('0x22')](function(_0x23f12d){_0x17fb84[_0x6cc3('0x40')]=_0x23f12d;return _0x17fb84;})[_0x6cc3('0x22')](respondWithFilteredResult(_0x18d7ec,_0x33ff05))[_0x6cc3('0x41')](handleError(_0x18d7ec,null));};exports[_0x6cc3('0x42')]=function(_0x468e0b,_0x59e711){var _0x2fb506={'raw':!![],'where':{'id':_0x468e0b['params']['id']}},_0x5a2c78={};_0x5a2c78['model']=_[_0x6cc3('0x2d')](db[_0x6cc3('0x26')][_0x6cc3('0x27')]);_0x5a2c78[_0x6cc3('0x2c')]=_[_0x6cc3('0x2d')](_0x468e0b[_0x6cc3('0x2c')]);_0x5a2c78[_0x6cc3('0x2e')]=_['intersection'](_0x5a2c78['model'],_0x5a2c78[_0x6cc3('0x2c')]);_0x2fb506[_0x6cc3('0x30')]=_['intersection'](_0x5a2c78[_0x6cc3('0x29')],qs[_0x6cc3('0x31')](_0x468e0b[_0x6cc3('0x2c')][_0x6cc3('0x31')]));_0x2fb506[_0x6cc3('0x30')]=_0x2fb506[_0x6cc3('0x30')]['length']?_0x2fb506['attributes']:_0x5a2c78['model'];if(_0x468e0b['query'][_0x6cc3('0x43')]){_0x2fb506[_0x6cc3('0x3e')]=[{'all':!![]}];}_0x2fb506=_['merge']({},_0x2fb506,_0x468e0b['options']);return db[_0x6cc3('0x26')][_0x6cc3('0x44')](_0x2fb506)['then'](handleEntityNotFound(_0x59e711,null))[_0x6cc3('0x22')](respondWithResult(_0x59e711,null))[_0x6cc3('0x41')](handleError(_0x59e711,null));};exports['create']=function(_0x4add7e,_0x289c22){return db[_0x6cc3('0x26')][_0x6cc3('0x45')](_0x4add7e['body'],{})[_0x6cc3('0x22')](respondWithResult(_0x289c22,0xc9))[_0x6cc3('0x41')](handleError(_0x289c22,null));};exports[_0x6cc3('0x21')]=function(_0x1a94e0,_0xf4b05f){if(_0x1a94e0[_0x6cc3('0x46')]['id']){delete _0x1a94e0['body']['id'];}return db[_0x6cc3('0x26')]['find']({'where':{'id':_0x1a94e0[_0x6cc3('0x47')]['id']}})[_0x6cc3('0x22')](handleEntityNotFound(_0xf4b05f,null))[_0x6cc3('0x22')](saveUpdates(_0x1a94e0[_0x6cc3('0x46')],null))[_0x6cc3('0x22')](respondWithResult(_0xf4b05f,null))[_0x6cc3('0x41')](handleError(_0xf4b05f,null));};exports[_0x6cc3('0x48')]=function(_0x270bbb,_0x3edba8){return db[_0x6cc3('0x26')][_0x6cc3('0x44')]({'where':{'id':_0x270bbb[_0x6cc3('0x47')]['id']}})[_0x6cc3('0x22')](handleEntityNotFound(_0x3edba8,null))['then'](removeEntity(_0x3edba8,null))[_0x6cc3('0x41')](handleError(_0x3edba8,null));};exports[_0x6cc3('0x49')]=function(_0x13f8d4,_0x574679,_0x3786d1){return db['VoiceMailMessage'][_0x6cc3('0x44')]({'where':{'id':_0x13f8d4[_0x6cc3('0x47')]['id']},'attributes':['id',_0x6cc3('0x4a'),_0x6cc3('0x4b')]})[_0x6cc3('0x22')](handleEntityNotFound(_0x574679,null))[_0x6cc3('0x22')](function(_0x3465e0){if(_0x3465e0){if(!_0x3465e0['recording']){throw new db[(_0x6cc3('0x4c'))]['ValidationError'](_0x6cc3('0x4d'));}var _0x364895={'Content-Type':_0x6cc3('0x4e'),'Content-Disposition':_0x6cc3('0x4f')};if(_0x3465e0[_0x6cc3('0x4b')]){_0x364895[_0x6cc3('0x50')]=_0x6cc3('0x51')+_0x3465e0[_0x6cc3('0x4b')]+_0x6cc3('0x52');}_0x574679['set'](_0x364895);return _0x574679['send'](new Buffer(_0x3465e0[_0x6cc3('0x4a')]));}})[_0x6cc3('0x41')](handleError(_0x574679,null));}; \ No newline at end of file +var _0x125d=['ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','set','Content-Range','apply','update','destroy','then','end','error','stack','index','VoiceMailMessage','rawAttributes','fieldName','type','model','differenceBy','map','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','params','catch','create','body','find','download','recording','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','msg_id','attachment;\x20filename=\x22','.wav\x22','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x2fb8e8,_0xda5c71){var _0x4e5d03=function(_0x4fe370){while(--_0x4fe370){_0x2fb8e8['push'](_0x2fb8e8['shift']());}};_0x4e5d03(++_0xda5c71);}(_0x125d,0x94));var _0xd125=function(_0x2a3f36,_0x494ff3){_0x2a3f36=_0x2a3f36-0x0;var _0x2d5690=_0x125d[_0x2a3f36];return _0x2d5690;};'use strict';var emlformat=require(_0xd125('0x0'));var rimraf=require(_0xd125('0x1'));var zipdir=require(_0xd125('0x2'));var jsonpatch=require(_0xd125('0x3'));var rp=require(_0xd125('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd125('0x5'));var util=require('util');var path=require(_0xd125('0x6'));var sox=require(_0xd125('0x7'));var csv=require(_0xd125('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd125('0x9'));var _=require('lodash');var squel=require(_0xd125('0xa'));var crypto=require(_0xd125('0xb'));var jsforce=require(_0xd125('0xc'));var deskjs=require(_0xd125('0xd'));var toCsv=require(_0xd125('0x8'));var querystring=require(_0xd125('0xe'));var Papa=require(_0xd125('0xf'));var Redis=require(_0xd125('0x10'));var authService=require(_0xd125('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd125('0x12'))(_0xd125('0x13'));var utils=require(_0xd125('0x14'));var config=require(_0xd125('0x15'));var licenseUtil=require(_0xd125('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d6f36,_0x31f8ad){_0x31f8ad=_0x31f8ad||0xcc;return function(_0x5f2a6f){if(_0x5f2a6f){return _0x5d6f36[_0xd125('0x17')](_0x31f8ad);}return _0x5d6f36[_0xd125('0x18')](_0x31f8ad)['end']();};}function respondWithResult(_0x49b72e,_0xf2c93){_0xf2c93=_0xf2c93||0xc8;return function(_0x198b79){if(_0x198b79){return _0x49b72e['status'](_0xf2c93)[_0xd125('0x19')](_0x198b79);}};}function respondWithFilteredResult(_0x27f4e8,_0x4209a5){return function(_0x5840b5){if(_0x5840b5){var _0x36097a=typeof _0x4209a5[_0xd125('0x1a')]==='undefined'&&typeof _0x4209a5[_0xd125('0x1b')]===_0xd125('0x1c');var _0x202391=_0x5840b5['count'];var _0xd09f6=_0x36097a?0x0:_0x4209a5[_0xd125('0x1a')];var _0x212785=_0x36097a?_0x5840b5['count']:_0x4209a5[_0xd125('0x1a')]+_0x4209a5['limit'];var _0x3492f7;if(_0x212785>=_0x202391){_0x212785=_0x202391;_0x3492f7=0xc8;}else{_0x3492f7=0xce;}_0x27f4e8['status'](_0x3492f7);return _0x27f4e8[_0xd125('0x1d')](_0xd125('0x1e'),_0xd09f6+'-'+_0x212785+'/'+_0x202391)[_0xd125('0x19')](_0x5840b5);}return null;};}function patchUpdates(_0x45df27){return function(_0x602dca){try{jsonpatch[_0xd125('0x1f')](_0x602dca,_0x45df27,!![]);}catch(_0x34326a){return BPromise['reject'](_0x34326a);}return _0x602dca['save']();};}function saveUpdates(_0x493d7d,_0x14b275){return function(_0x3e25d5){if(_0x3e25d5){return _0x3e25d5[_0xd125('0x20')](_0x493d7d)['then'](function(_0x3a9311){return _0x3a9311;});}return null;};}function removeEntity(_0x21e7a2,_0x5e64eb){return function(_0x49dc99){if(_0x49dc99){return _0x49dc99[_0xd125('0x21')]()[_0xd125('0x22')](function(){_0x21e7a2['status'](0xcc)[_0xd125('0x23')]();});}};}function handleEntityNotFound(_0xdae5b7,_0x20695e){return function(_0x37114b){if(!_0x37114b){_0xdae5b7[_0xd125('0x17')](0x194);}return _0x37114b;};}function handleError(_0x49a0cd,_0x4f4480){_0x4f4480=_0x4f4480||0x1f4;return function(_0x1eeb28){logger[_0xd125('0x24')](_0x1eeb28[_0xd125('0x25')]);if(_0x1eeb28['name']){delete _0x1eeb28['name'];}_0x49a0cd[_0xd125('0x18')](_0x4f4480)['send'](_0x1eeb28);};}exports[_0xd125('0x26')]=function(_0x4b35c4,_0x16fb0a){var _0xfba0b={},_0x1e88b2={},_0x338212={'count':0x0,'rows':[]};var _0x290ac3=_['map'](db[_0xd125('0x27')][_0xd125('0x28')],function(_0x1495aa){return{'name':_0x1495aa[_0xd125('0x29')],'type':_0x1495aa[_0xd125('0x2a')]['key']};});_0x1e88b2[_0xd125('0x2b')]=_[_0xd125('0x2c')](_[_0xd125('0x2d')](_0x290ac3,_0xd125('0x2e')),[_0xd125('0x2e')]);_0x1e88b2[_0xd125('0x2f')]=_[_0xd125('0x30')](_0x4b35c4[_0xd125('0x2f')]);_0x1e88b2[_0xd125('0x31')]=_[_0xd125('0x32')](_0x1e88b2[_0xd125('0x2b')],_0x1e88b2['query']);_0xfba0b['attributes']=_['intersection'](_0x1e88b2[_0xd125('0x2b')],qs[_0xd125('0x33')](_0x4b35c4[_0xd125('0x2f')][_0xd125('0x33')]));_0xfba0b[_0xd125('0x34')]=_0xfba0b['attributes'][_0xd125('0x35')]?_0xfba0b['attributes']:_0x1e88b2[_0xd125('0x2b')];if(!_0x4b35c4[_0xd125('0x2f')][_0xd125('0x36')]('nolimit')){_0xfba0b[_0xd125('0x1b')]=qs[_0xd125('0x1b')](_0x4b35c4['query']['limit']);_0xfba0b['offset']=qs['offset'](_0x4b35c4[_0xd125('0x2f')][_0xd125('0x1a')]);}_0xfba0b[_0xd125('0x37')]=qs[_0xd125('0x38')](_0x4b35c4['query']['sort']);_0xfba0b[_0xd125('0x39')]=qs[_0xd125('0x31')](_[_0xd125('0x3a')](_0x4b35c4['query'],_0x1e88b2[_0xd125('0x31')]),_0x290ac3);if(_0x4b35c4[_0xd125('0x2f')][_0xd125('0x3b')]){_0xfba0b[_0xd125('0x39')]=_[_0xd125('0x3c')](_0xfba0b['where'],{'$or':_['map'](_0x290ac3,function(_0x2f653c){if(_0x2f653c[_0xd125('0x2a')]!==_0xd125('0x3d')){var _0x2ab667={};_0x2ab667[_0x2f653c[_0xd125('0x2e')]]={'$like':'%'+_0x4b35c4['query'][_0xd125('0x3b')]+'%'};return _0x2ab667;}})});}_0xfba0b=_[_0xd125('0x3c')]({},_0xfba0b,_0x4b35c4[_0xd125('0x3e')]);var _0x3bd675={'where':_0xfba0b['where']};return db['VoiceMailMessage'][_0xd125('0x3f')](_0x3bd675)[_0xd125('0x22')](function(_0x1092d4){_0x338212['count']=_0x1092d4;if(_0x4b35c4[_0xd125('0x2f')][_0xd125('0x40')]){_0xfba0b[_0xd125('0x41')]=[{'all':!![]}];}return db[_0xd125('0x27')][_0xd125('0x42')](_0xfba0b);})[_0xd125('0x22')](function(_0x32ad83){_0x338212[_0xd125('0x43')]=_0x32ad83;return _0x338212;})['then'](respondWithFilteredResult(_0x16fb0a,_0xfba0b))['catch'](handleError(_0x16fb0a,null));};exports['show']=function(_0x2fe38a,_0x140eff){var _0x2ed445={'raw':!![],'where':{'id':_0x2fe38a[_0xd125('0x44')]['id']}},_0x42c93c={};_0x42c93c['model']=_[_0xd125('0x30')](db[_0xd125('0x27')]['rawAttributes']);_0x42c93c[_0xd125('0x2f')]=_[_0xd125('0x30')](_0x2fe38a[_0xd125('0x2f')]);_0x42c93c[_0xd125('0x31')]=_[_0xd125('0x32')](_0x42c93c[_0xd125('0x2b')],_0x42c93c[_0xd125('0x2f')]);_0x2ed445[_0xd125('0x34')]=_[_0xd125('0x32')](_0x42c93c[_0xd125('0x2b')],qs[_0xd125('0x33')](_0x2fe38a[_0xd125('0x2f')]['fields']));_0x2ed445['attributes']=_0x2ed445['attributes'][_0xd125('0x35')]?_0x2ed445[_0xd125('0x34')]:_0x42c93c['model'];if(_0x2fe38a[_0xd125('0x2f')][_0xd125('0x40')]){_0x2ed445[_0xd125('0x41')]=[{'all':!![]}];}_0x2ed445=_['merge']({},_0x2ed445,_0x2fe38a['options']);return db['VoiceMailMessage']['find'](_0x2ed445)['then'](handleEntityNotFound(_0x140eff,null))[_0xd125('0x22')](respondWithResult(_0x140eff,null))[_0xd125('0x45')](handleError(_0x140eff,null));};exports[_0xd125('0x46')]=function(_0x42025b,_0x49f1ff){return db[_0xd125('0x27')][_0xd125('0x46')](_0x42025b['body'],{})['then'](respondWithResult(_0x49f1ff,0xc9))['catch'](handleError(_0x49f1ff,null));};exports[_0xd125('0x20')]=function(_0x1b9b7b,_0x2f13bb){if(_0x1b9b7b[_0xd125('0x47')]['id']){delete _0x1b9b7b[_0xd125('0x47')]['id'];}return db[_0xd125('0x27')][_0xd125('0x48')]({'where':{'id':_0x1b9b7b[_0xd125('0x44')]['id']}})['then'](handleEntityNotFound(_0x2f13bb,null))[_0xd125('0x22')](saveUpdates(_0x1b9b7b[_0xd125('0x47')],null))[_0xd125('0x22')](respondWithResult(_0x2f13bb,null))[_0xd125('0x45')](handleError(_0x2f13bb,null));};exports[_0xd125('0x21')]=function(_0x4ce363,_0x3fe275){return db[_0xd125('0x27')][_0xd125('0x48')]({'where':{'id':_0x4ce363['params']['id']}})[_0xd125('0x22')](handleEntityNotFound(_0x3fe275,null))[_0xd125('0x22')](removeEntity(_0x3fe275,null))[_0xd125('0x45')](handleError(_0x3fe275,null));};exports[_0xd125('0x49')]=function(_0x22cd40,_0x2fee05,_0x3d089d){return db[_0xd125('0x27')][_0xd125('0x48')]({'where':{'id':_0x22cd40[_0xd125('0x44')]['id']},'attributes':['id',_0xd125('0x4a'),'msg_id']})[_0xd125('0x22')](handleEntityNotFound(_0x2fee05,null))['then'](function(_0x4c4f23){if(_0x4c4f23){if(!_0x4c4f23[_0xd125('0x4a')]){throw new db[(_0xd125('0x4b'))]['ValidationError'](_0xd125('0x4c'));}var _0x5ab979={'Content-Type':_0xd125('0x4d'),'Content-Disposition':'attachment'};if(_0x4c4f23[_0xd125('0x4e')]){_0x5ab979['Content-Disposition']=_0xd125('0x4f')+_0x4c4f23[_0xd125('0x4e')]+_0xd125('0x50');}_0x2fee05[_0xd125('0x1d')](_0x5ab979);return _0x2fee05[_0xd125('0x51')](new Buffer(_0x4c4f23[_0xd125('0x4a')]));}})[_0xd125('0x45')](handleError(_0x2fee05,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index b92c2de..a55bd65 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 _0xe3c9=['api','moment','bluebird','request-promise','path','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','../../config/logger'];(function(_0x2b61a9,_0x12e8d8){var _0x278119=function(_0x45c757){while(--_0x45c757){_0x2b61a9['push'](_0x2b61a9['shift']());}};_0x278119(++_0x12e8d8);}(_0xe3c9,0x6e));var _0x9e3c=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xe3c9[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x9e3c('0x0'));var util=require('util');var logger=require(_0x9e3c('0x1'))(_0x9e3c('0x2'));var moment=require(_0x9e3c('0x3'));var BPromise=require(_0x9e3c('0x4'));var rp=require(_0x9e3c('0x5'));var fs=require('fs');var path=require(_0x9e3c('0x6'));var rimraf=require('rimraf');var config=require(_0x9e3c('0x7'));var attributes=require(_0x9e3c('0x8'));module[_0x9e3c('0x9')]=function(_0x45b798,_0x2e1f05){return _0x45b798[_0x9e3c('0xa')](_0x9e3c('0xb'),attributes,{'tableName':_0x9e3c('0xc'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x9e3c('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x3dcf=['VoiceMailMessage','dir','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./voiceMailMessage.attributes','exports','define'];(function(_0x3babca,_0x4a2446){var _0x29ad52=function(_0x37c1f1){while(--_0x37c1f1){_0x3babca['push'](_0x3babca['shift']());}};_0x29ad52(++_0x4a2446);}(_0x3dcf,0x17b));var _0xf3dc=function(_0xa3ecb,_0x58927e){_0xa3ecb=_0xa3ecb-0x0;var _0x5eca79=_0x3dcf[_0xa3ecb];return _0x5eca79;};'use strict';var _=require(_0xf3dc('0x0'));var util=require(_0xf3dc('0x1'));var logger=require(_0xf3dc('0x2'))('api');var moment=require(_0xf3dc('0x3'));var BPromise=require(_0xf3dc('0x4'));var rp=require(_0xf3dc('0x5'));var fs=require('fs');var path=require(_0xf3dc('0x6'));var rimraf=require(_0xf3dc('0x7'));var config=require('../../config/environment');var attributes=require(_0xf3dc('0x8'));module[_0xf3dc('0x9')]=function(_0x2800bf,_0xa7f3bf){return _0x2800bf[_0xf3dc('0xa')](_0xf3dc('0xb'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xf3dc('0xc'),'fields':[_0xf3dc('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 4be4bc6..2f5cb43 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 _0x5fc9=['stringify','error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s'];(function(_0x52ff77,_0x51ab49){var _0x280dae=function(_0x451c81){while(--_0x451c81){_0x52ff77['push'](_0x52ff77['shift']());}};_0x280dae(++_0x51ab49);}(_0x5fc9,0x139));var _0x95fc=function(_0x4b1fe0,_0x1036d6){_0x4b1fe0=_0x4b1fe0-0x0;var _0x155a16=_0x5fc9[_0x4b1fe0];return _0x155a16;};'use strict';var _=require(_0x95fc('0x0'));var util=require(_0x95fc('0x1'));var moment=require('moment');var BPromise=require(_0x95fc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x95fc('0x3'));var db=require(_0x95fc('0x4'))['db'];var utils=require(_0x95fc('0x5'));var logger=require('../../config/logger')(_0x95fc('0x6'));var config=require('../../config/environment');var jayson=require(_0x95fc('0x7'));var client=jayson[_0x95fc('0x8')][_0x95fc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5779d9,_0x32f655,_0x21a9dd){return new BPromise(function(_0x432ed5,_0xa58a21){return client[_0x95fc('0xa')](_0x5779d9,_0x21a9dd)[_0x95fc('0xb')](function(_0x1f6578){logger[_0x95fc('0xc')](_0x95fc('0xd'),_0x32f655,_0x95fc('0xe'));logger[_0x95fc('0xf')](_0x95fc('0x10'),_0x32f655,_0x95fc('0xe'),JSON[_0x95fc('0x11')](_0x1f6578));if(_0x1f6578['error']){if(_0x1f6578[_0x95fc('0x12')]['code']===0x1f4){logger[_0x95fc('0x12')](_0x95fc('0xd'),_0x32f655,_0x1f6578[_0x95fc('0x12')]['message']);return _0xa58a21(_0x1f6578[_0x95fc('0x12')][_0x95fc('0x13')]);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x32f655,_0x1f6578[_0x95fc('0x12')][_0x95fc('0x13')]);return _0x432ed5(_0x1f6578[_0x95fc('0x12')][_0x95fc('0x13')]);}else{logger[_0x95fc('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x32f655,_0x95fc('0xe'));_0x432ed5(_0x1f6578[_0x95fc('0x14')][_0x95fc('0x13')]);}})[_0x95fc('0x15')](function(_0x3eb4c3){logger[_0x95fc('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x32f655,_0x3eb4c3);_0xa58a21(_0x3eb4c3);});});} \ No newline at end of file +var _0x6a8b=['code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x51a7d9,_0x491943){var _0x348796=function(_0x5bf85d){while(--_0x5bf85d){_0x51a7d9['push'](_0x51a7d9['shift']());}};_0x348796(++_0x491943);}(_0x6a8b,0x153));var _0xb6a8=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x6a8b[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xb6a8('0x0'));var util=require(_0xb6a8('0x1'));var moment=require(_0xb6a8('0x2'));var BPromise=require(_0xb6a8('0x3'));var rs=require(_0xb6a8('0x4'));var fs=require('fs');var Redis=require(_0xb6a8('0x5'));var db=require(_0xb6a8('0x6'))['db'];var utils=require(_0xb6a8('0x7'));var logger=require(_0xb6a8('0x8'))(_0xb6a8('0x9'));var config=require('../../config/environment');var jayson=require(_0xb6a8('0xa'));var client=jayson[_0xb6a8('0xb')][_0xb6a8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4da8ab,_0x13d79f,_0x51d3f4){return new BPromise(function(_0x2c7641,_0x1c0abf){return client[_0xb6a8('0xd')](_0x4da8ab,_0x51d3f4)[_0xb6a8('0xe')](function(_0x4d791c){logger[_0xb6a8('0xf')](_0xb6a8('0x10'),_0x13d79f,_0xb6a8('0x11'));logger[_0xb6a8('0x12')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x13d79f,_0xb6a8('0x11'),JSON[_0xb6a8('0x13')](_0x4d791c));if(_0x4d791c['error']){if(_0x4d791c[_0xb6a8('0x14')][_0xb6a8('0x15')]===0x1f4){logger[_0xb6a8('0x14')](_0xb6a8('0x10'),_0x13d79f,_0x4d791c['error'][_0xb6a8('0x16')]);return _0x1c0abf(_0x4d791c[_0xb6a8('0x14')][_0xb6a8('0x16')]);}logger[_0xb6a8('0x14')](_0xb6a8('0x10'),_0x13d79f,_0x4d791c[_0xb6a8('0x14')][_0xb6a8('0x16')]);return _0x2c7641(_0x4d791c[_0xb6a8('0x14')][_0xb6a8('0x16')]);}else{logger[_0xb6a8('0xf')](_0xb6a8('0x10'),_0x13d79f,'request\x20sent');_0x2c7641(_0x4d791c[_0xb6a8('0x17')][_0xb6a8('0x16')]);}})['catch'](function(_0x957e11){logger['error'](_0xb6a8('0x10'),_0x13d79f,_0x957e11);_0x1c0abf(_0x957e11);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index ca3e5b1..1075842 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 _0xa293=['/:id/sounds','isAuthenticated','post','create','put','update','delete','/:id','destroy','/:id/sounds/:id2','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index'];(function(_0x21c9f4,_0x21da50){var _0x3cf421=function(_0x3da8ef){while(--_0x3da8ef){_0x21c9f4['push'](_0x21c9f4['shift']());}};_0x3cf421(++_0x21da50);}(_0xa293,0x155));var _0x3a29=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xa293[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require(_0x3a29('0x0'));var util=require(_0x3a29('0x1'));var path=require(_0x3a29('0x2'));var timeout=require(_0x3a29('0x3'));var express=require(_0x3a29('0x4'));var router=express['Router']();var fs_extra=require(_0x3a29('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3a29('0x6'));var config=require(_0x3a29('0x7'));var controller=require(_0x3a29('0x8'));router[_0x3a29('0x9')]('/',auth['isAuthenticated'](),controller[_0x3a29('0xa')]);router[_0x3a29('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x3a29('0x9')](_0x3a29('0xb'),auth[_0x3a29('0xc')](),controller['getSounds']);router[_0x3a29('0xd')]('/',auth[_0x3a29('0xc')](),controller[_0x3a29('0xe')]);router[_0x3a29('0xd')]('/:id/sounds',auth[_0x3a29('0xc')](),controller['addSound']);router[_0x3a29('0xf')]('/:id',auth[_0x3a29('0xc')](),controller[_0x3a29('0x10')]);router[_0x3a29('0x11')](_0x3a29('0x12'),auth[_0x3a29('0xc')](),controller[_0x3a29('0x13')]);router[_0x3a29('0x11')](_0x3a29('0x14'),auth[_0x3a29('0xc')](),controller['removeSound']);module[_0x3a29('0x15')]=router; \ No newline at end of file +var _0x90b4=['update','delete','destroy','/:id/sounds/:id2','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','/:id/sounds','getSounds','post','create','addSound','/:id'];(function(_0x4dcc2d,_0x422839){var _0x1bbd79=function(_0x173341){while(--_0x173341){_0x4dcc2d['push'](_0x4dcc2d['shift']());}};_0x1bbd79(++_0x422839);}(_0x90b4,0x8e));var _0x490b=function(_0x500fcb,_0x42dcf9){_0x500fcb=_0x500fcb-0x0;var _0x3f6a78=_0x90b4[_0x500fcb];return _0x3f6a78;};'use strict';var multer=require(_0x490b('0x0'));var util=require(_0x490b('0x1'));var path=require(_0x490b('0x2'));var timeout=require(_0x490b('0x3'));var express=require(_0x490b('0x4'));var router=express[_0x490b('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x490b('0x6'));var config=require(_0x490b('0x7'));var controller=require(_0x490b('0x8'));router[_0x490b('0x9')]('/',auth[_0x490b('0xa')](),controller[_0x490b('0xb')]);router[_0x490b('0x9')]('/:id',auth[_0x490b('0xa')](),controller[_0x490b('0xc')]);router['get'](_0x490b('0xd'),auth[_0x490b('0xa')](),controller[_0x490b('0xe')]);router[_0x490b('0xf')]('/',auth['isAuthenticated'](),controller[_0x490b('0x10')]);router[_0x490b('0xf')](_0x490b('0xd'),auth['isAuthenticated'](),controller[_0x490b('0x11')]);router['put'](_0x490b('0x12'),auth[_0x490b('0xa')](),controller[_0x490b('0x13')]);router[_0x490b('0x14')](_0x490b('0x12'),auth['isAuthenticated'](),controller[_0x490b('0x15')]);router['delete'](_0x490b('0x16'),auth[_0x490b('0xa')](),controller['removeSound']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index f7fc318..75eb17d 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 _0xf1fa=['alpha','TIMESTAMP','BOOLEAN','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0xf1fa,0xdb));var _0xaf1f=function(_0x1dd8d4,_0x3b784b){_0x1dd8d4=_0x1dd8d4-0x0;var _0xd023c2=_0xf1fa[_0x1dd8d4];return _0xd023c2;};'use strict';var Sequelize=require('sequelize');module[_0xaf1f('0x0')]={'name':{'type':Sequelize[_0xaf1f('0x1')],'allowNull':![],'unique':_0xaf1f('0x2')},'mode':{'type':Sequelize[_0xaf1f('0x3')](_0xaf1f('0x4'),_0xaf1f('0x5'),_0xaf1f('0x6'),_0xaf1f('0x7'),_0xaf1f('0x8'),'mp3'),'allowNull':!![],'defaultValue':_0xaf1f('0x5')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xaf1f('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0xaf1f('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xaf1f('0x1')],'allowNull':!![],'defaultValue':_0xaf1f('0x9')},'format':{'type':Sequelize[_0xaf1f('0x1')],'allowNull':!![]},'stamp':{'type':_0xaf1f('0xa')},'defaultEntry':{'type':Sequelize[_0xaf1f('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2306=['files','quietmp3nb','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','custom'];(function(_0x635744,_0x2e1d27){var _0x15c7f5=function(_0x180242){while(--_0x180242){_0x635744['push'](_0x635744['shift']());}};_0x15c7f5(++_0x2e1d27);}(_0x2306,0xf8));var _0x6230=function(_0x4d2c3a,_0x506a93){_0x4d2c3a=_0x4d2c3a-0x0;var _0x480e0d=_0x2306[_0x4d2c3a];return _0x480e0d;};'use strict';var Sequelize=require(_0x6230('0x0'));module[_0x6230('0x1')]={'name':{'type':Sequelize[_0x6230('0x2')],'allowNull':![],'unique':_0x6230('0x3')},'mode':{'type':Sequelize['ENUM'](_0x6230('0x4'),_0x6230('0x5'),'mp3nb',_0x6230('0x6'),'quietmp3',_0x6230('0x7')),'allowNull':!![],'defaultValue':_0x6230('0x5')},'directory':{'type':Sequelize[_0x6230('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x6230('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x6230('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x6230('0x2')],'allowNull':!![],'defaultValue':_0x6230('0x8')},'format':{'type':Sequelize[_0x6230('0x2')],'allowNull':!![]},'stamp':{'type':_0x6230('0x9')},'defaultEntry':{'type':Sequelize[_0x6230('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 ee44662..0977106 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 _0x2faf=['sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','body','params','create','sequelize','transaction','mode','files','directory','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','Sequelize','ValidationError','addSound','save_name','converted_format','createdAt','join','root','format','basename','extname','%s.%s','symlinkSync','message','removeSound','findOne','id2','Sound','pick','getSounds','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x249509,_0x96bf5e){var _0x1ad0ab=function(_0x3456de){while(--_0x3456de){_0x249509['push'](_0x249509['shift']());}};_0x1ad0ab(++_0x96bf5e);}(_0x2faf,0x1a8));var _0xf2fa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2faf[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf2fa('0x0'));var rp=require(_0xf2fa('0x1'));var moment=require('moment');var BPromise=require(_0xf2fa('0x2'));var Mustache=require('mustache');var util=require(_0xf2fa('0x3'));var path=require(_0xf2fa('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf2fa('0x5'));var fs=require('fs');var fs_extra=require(_0xf2fa('0x6'));var _=require(_0xf2fa('0x7'));var squel=require('squel');var crypto=require(_0xf2fa('0x8'));var jsforce=require(_0xf2fa('0x9'));var deskjs=require(_0xf2fa('0xa'));var toCsv=require(_0xf2fa('0xb'));var querystring=require(_0xf2fa('0xc'));var Papa=require('papaparse');var Redis=require(_0xf2fa('0xd'));var authService=require(_0xf2fa('0xe'));var qs=require(_0xf2fa('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf2fa('0x10'));var utils=require(_0xf2fa('0x11'));var config=require(_0xf2fa('0x12'));var licenseUtil=require(_0xf2fa('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d49d4,_0x4fe3d1){_0x4fe3d1=_0x4fe3d1||0xcc;return function(_0x3e2321){if(_0x3e2321){return _0x5d49d4[_0xf2fa('0x14')](_0x4fe3d1);}return _0x5d49d4[_0xf2fa('0x15')](_0x4fe3d1)[_0xf2fa('0x16')]();};}function respondWithResult(_0x37cc84,_0x469e0f){_0x469e0f=_0x469e0f||0xc8;return function(_0x47fa3a){if(_0x47fa3a){return _0x37cc84[_0xf2fa('0x15')](_0x469e0f)[_0xf2fa('0x17')](_0x47fa3a);}};}function respondWithFilteredResult(_0x42582e,_0x10079a){return function(_0x530f03){if(_0x530f03){var _0x3d6a77=typeof _0x10079a[_0xf2fa('0x18')]===_0xf2fa('0x19')&&typeof _0x10079a['limit']===_0xf2fa('0x19');var _0x136427=_0x530f03[_0xf2fa('0x1a')];var _0x40681b=_0x3d6a77?0x0:_0x10079a[_0xf2fa('0x18')];var _0x24fa58=_0x3d6a77?_0x530f03[_0xf2fa('0x1a')]:_0x10079a[_0xf2fa('0x18')]+_0x10079a[_0xf2fa('0x1b')];var _0x4e770b;if(_0x24fa58>=_0x136427){_0x24fa58=_0x136427;_0x4e770b=0xc8;}else{_0x4e770b=0xce;}_0x42582e['status'](_0x4e770b);return _0x42582e[_0xf2fa('0x1c')](_0xf2fa('0x1d'),_0x40681b+'-'+_0x24fa58+'/'+_0x136427)[_0xf2fa('0x17')](_0x530f03);}return null;};}function patchUpdates(_0x2496e0){return function(_0x38a351){try{jsonpatch[_0xf2fa('0x1e')](_0x38a351,_0x2496e0,!![]);}catch(_0x11f896){return BPromise[_0xf2fa('0x1f')](_0x11f896);}return _0x38a351[_0xf2fa('0x20')]();};}function saveUpdates(_0x2bdb01,_0x4e88bb){return function(_0x49e470){if(_0x49e470){return _0x49e470[_0xf2fa('0x21')](_0x2bdb01)[_0xf2fa('0x22')](function(_0x3e7c91){return _0x3e7c91;});}return null;};}function removeEntity(_0x4d4ba6,_0x2d39a2){return function(_0x5c5075){if(_0x5c5075){return _0x5c5075[_0xf2fa('0x23')]()[_0xf2fa('0x22')](function(){var _0x1566bc=_0x5c5075[_0xf2fa('0x24')]({'plain':!![]});var _0x341e08=_0xf2fa('0x25');return db[_0xf2fa('0x26')][_0xf2fa('0x23')]({'where':{'type':_0x341e08,'resourceId':_0x1566bc['id']}})['then'](function(){return _0x5c5075;});})[_0xf2fa('0x22')](function(){_0x4d4ba6['status'](0xcc)[_0xf2fa('0x16')]();});}};}function handleEntityNotFound(_0x370de6,_0x319807){return function(_0x255027){if(!_0x255027){_0x370de6['sendStatus'](0x194);}return _0x255027;};}function handleError(_0x412cb4,_0x53b304){_0x53b304=_0x53b304||0x1f4;return function(_0x5570f8){logger[_0xf2fa('0x27')](_0x5570f8[_0xf2fa('0x28')]);if(_0x5570f8[_0xf2fa('0x29')]){delete _0x5570f8['name'];}_0x412cb4[_0xf2fa('0x15')](_0x53b304)[_0xf2fa('0x2a')](_0x5570f8);};}exports[_0xf2fa('0x2b')]=function(_0xec564a,_0x4cf8ff){var _0x2da6de={},_0x4ca39b={},_0x18536d={'count':0x0,'rows':[]};var _0x5efd9c=_[_0xf2fa('0x2c')](db[_0xf2fa('0x2d')][_0xf2fa('0x2e')],function(_0x5d4fbb){return{'name':_0x5d4fbb[_0xf2fa('0x2f')],'type':_0x5d4fbb[_0xf2fa('0x30')][_0xf2fa('0x31')]};});_0x4ca39b['model']=_['map'](_0x5efd9c,_0xf2fa('0x29'));_0x4ca39b[_0xf2fa('0x32')]=_[_0xf2fa('0x33')](_0xec564a[_0xf2fa('0x32')]);_0x4ca39b[_0xf2fa('0x34')]=_[_0xf2fa('0x35')](_0x4ca39b['model'],_0x4ca39b[_0xf2fa('0x32')]);_0x2da6de[_0xf2fa('0x36')]=_[_0xf2fa('0x35')](_0x4ca39b[_0xf2fa('0x37')],qs['fields'](_0xec564a[_0xf2fa('0x32')][_0xf2fa('0x38')]));_0x2da6de[_0xf2fa('0x36')]=_0x2da6de[_0xf2fa('0x36')][_0xf2fa('0x39')]?_0x2da6de[_0xf2fa('0x36')]:_0x4ca39b[_0xf2fa('0x37')];if(!_0xec564a['query'][_0xf2fa('0x3a')]('nolimit')){_0x2da6de['limit']=qs['limit'](_0xec564a[_0xf2fa('0x32')][_0xf2fa('0x1b')]);_0x2da6de[_0xf2fa('0x18')]=qs[_0xf2fa('0x18')](_0xec564a[_0xf2fa('0x32')][_0xf2fa('0x18')]);}_0x2da6de[_0xf2fa('0x3b')]=qs['sort'](_0xec564a[_0xf2fa('0x32')][_0xf2fa('0x3c')]);delete _0xec564a['query'][_0xf2fa('0x3c')];_0x2da6de[_0xf2fa('0x3d')]=qs[_0xf2fa('0x34')](_['pick'](_0xec564a[_0xf2fa('0x32')],_0x4ca39b[_0xf2fa('0x34')]),_0x5efd9c);if(_0xec564a[_0xf2fa('0x32')][_0xf2fa('0x3e')]){_0x2da6de[_0xf2fa('0x3d')]=_[_0xf2fa('0x3f')](_0x2da6de[_0xf2fa('0x3d')],{'$or':_[_0xf2fa('0x2c')](_0x5efd9c,function(_0x514b81){if(_0x514b81[_0xf2fa('0x30')]!=='VIRTUAL'){var _0x760b7c={};_0x760b7c[_0x514b81[_0xf2fa('0x29')]]={'$like':'%'+_0xec564a[_0xf2fa('0x32')][_0xf2fa('0x3e')]+'%'};return _0x760b7c;}})});}_0x2da6de=_[_0xf2fa('0x3f')]({},_0x2da6de,_0xec564a[_0xf2fa('0x40')]);var _0x2740f0={'where':_0x2da6de[_0xf2fa('0x3d')]};return db[_0xf2fa('0x2d')]['count'](_0x2740f0)[_0xf2fa('0x22')](function(_0x541ea4){_0x18536d['count']=_0x541ea4;if(_0xec564a[_0xf2fa('0x32')][_0xf2fa('0x41')]){_0x2da6de[_0xf2fa('0x42')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xf2fa('0x43')](_0x2da6de);})[_0xf2fa('0x22')](function(_0x3e6099){_0x18536d[_0xf2fa('0x44')]=_0x3e6099;return _0x18536d;})[_0xf2fa('0x22')](respondWithFilteredResult(_0x4cf8ff,_0x2da6de))[_0xf2fa('0x45')](handleError(_0x4cf8ff,null));};exports[_0xf2fa('0x46')]=function(_0x183148,_0x354911){var _0x23a37c={'raw':![],'where':{'id':_0x183148['params']['id']}},_0x535427={};_0x535427[_0xf2fa('0x37')]=_[_0xf2fa('0x33')](db['VoiceMusicOnHold'][_0xf2fa('0x2e')]);_0x535427[_0xf2fa('0x32')]=_[_0xf2fa('0x33')](_0x183148[_0xf2fa('0x32')]);_0x535427['filters']=_['intersection'](_0x535427[_0xf2fa('0x37')],_0x535427[_0xf2fa('0x32')]);_0x23a37c[_0xf2fa('0x36')]=_[_0xf2fa('0x35')](_0x535427[_0xf2fa('0x37')],qs[_0xf2fa('0x38')](_0x183148[_0xf2fa('0x32')][_0xf2fa('0x38')]));_0x23a37c['attributes']=_0x23a37c[_0xf2fa('0x36')]['length']?_0x23a37c[_0xf2fa('0x36')]:_0x535427[_0xf2fa('0x37')];if(_0x183148[_0xf2fa('0x32')][_0xf2fa('0x41')]){_0x23a37c[_0xf2fa('0x42')]=[{'all':!![]}];}_0x23a37c=_[_0xf2fa('0x3f')]({},_0x23a37c,_0x183148[_0xf2fa('0x40')]);return db[_0xf2fa('0x2d')][_0xf2fa('0x47')](_0x23a37c)[_0xf2fa('0x22')](handleEntityNotFound(_0x354911,null))['then'](respondWithResult(_0x354911,null))[_0xf2fa('0x45')](handleError(_0x354911,null));};exports[_0xf2fa('0x21')]=function(_0x394292,_0x39b192){if(_0x394292[_0xf2fa('0x48')]['id']){delete _0x394292[_0xf2fa('0x48')]['id'];}return db['VoiceMusicOnHold'][_0xf2fa('0x47')]({'where':{'id':_0x394292[_0xf2fa('0x49')]['id']}})[_0xf2fa('0x22')](handleEntityNotFound(_0x39b192,null))[_0xf2fa('0x22')](saveUpdates(_0x394292['body'],null))[_0xf2fa('0x22')](respondWithResult(_0x39b192,null))[_0xf2fa('0x45')](handleError(_0x39b192,null));};exports[_0xf2fa('0x4a')]=function(_0x619673,_0x33e4de,_0x2af1d8){return db[_0xf2fa('0x4b')][_0xf2fa('0x4c')](function(_0x24db16){if(_0x619673[_0xf2fa('0x48')][_0xf2fa('0x4d')]===_0xf2fa('0x4e')){_0x619673[_0xf2fa('0x48')][_0xf2fa('0x4f')]=path['join'](config['root'],_0xf2fa('0x50'),_0x619673[_0xf2fa('0x48')][_0xf2fa('0x29')]);}return db[_0xf2fa('0x2d')][_0xf2fa('0x4a')](_0x619673['body'],{'transaction':_0x24db16})[_0xf2fa('0x22')](function(_0x172f9e){if(_0x619673[_0xf2fa('0x48')][_0xf2fa('0x4d')]==='files'){fs['mkdirSync'](_0x172f9e[_0xf2fa('0x4f')],parseInt(_0xf2fa('0x51'),0x8));}var _0x49bd4a=_0x619673[_0xf2fa('0x52')][_0xf2fa('0x24')]({'plain':!![]});if(!_0x49bd4a)throw new Error(_0xf2fa('0x53'));if(_0x49bd4a[_0xf2fa('0x54')]===_0xf2fa('0x52')){var _0xc3a3d3=_0x172f9e[_0xf2fa('0x24')]({'plain':!![]});return db[_0xf2fa('0x55')][_0xf2fa('0x47')]({'where':{'name':_0xf2fa('0x25'),'userProfileId':_0x49bd4a['userProfileId']},'raw':!![]})[_0xf2fa('0x22')](function(_0x5e6fdd){if(_0x5e6fdd&&_0x5e6fdd[_0xf2fa('0x56')]===0x0){return db[_0xf2fa('0x26')][_0xf2fa('0x4a')]({'name':_0xc3a3d3[_0xf2fa('0x29')],'resourceId':_0xc3a3d3['id'],'type':_0x5e6fdd[_0xf2fa('0x29')],'sectionId':_0x5e6fdd['id']},{})[_0xf2fa('0x22')](function(){return _0x172f9e;});}else{return _0x172f9e;}})['catch'](function(_0x1b4af1){logger[_0xf2fa('0x27')](_0xf2fa('0x57'),_0x1b4af1);});}return _0x172f9e;});})[_0xf2fa('0x22')](respondWithResult(_0x33e4de,0xc9))[_0xf2fa('0x45')](handleError(_0x33e4de,null));};exports[_0xf2fa('0x23')]=function(_0x5a6e8d,_0x3c1c83,_0x44c84f){var _0xd19f10;return db['VoiceMusicOnHold'][_0xf2fa('0x47')]({'where':{'id':_0x5a6e8d[_0xf2fa('0x49')]['id']}})[_0xf2fa('0x22')](function(_0x24452c){if(_0x24452c){return db[_0xf2fa('0x4b')][_0xf2fa('0x4c')](function(_0x5c0d3a){return _0x24452c[_0xf2fa('0x23')]({'transaction':_0x5c0d3a,'raw':!![]})[_0xf2fa('0x22')](function(_0x5366d7){if(_0x5366d7[_0xf2fa('0x4f')]){fs[_0xf2fa('0x58')](_0x5366d7['directory'])[_0xf2fa('0x59')](function(_0x26c6be){fs[_0xf2fa('0x5a')](path['join'](_0x5366d7[_0xf2fa('0x4f')],_0x26c6be));});fs['rmdirSync'](_0x5366d7[_0xf2fa('0x4f')]);}return _0x5366d7;});})['catch'](function(_0x39098){throw new db[(_0xf2fa('0x5b'))][(_0xf2fa('0x5c'))](_0x39098['message']);});}})[_0xf2fa('0x22')](handleEntityNotFound(_0x3c1c83,null))[_0xf2fa('0x22')](removeEntity(_0x3c1c83,null))[_0xf2fa('0x45')](handleError(_0x3c1c83,null));};exports[_0xf2fa('0x5d')]=function(_0x2ab792,_0x238d03,_0x260c26){return db[_0xf2fa('0x4b')]['transaction'](function(_0xf65da5){var _0x5b53fd;return db['VoiceMusicOnHold'][_0xf2fa('0x47')]({'where':{'id':_0x2ab792[_0xf2fa('0x49')]['id']}})[_0xf2fa('0x22')](function(_0x3d9840){if(_0x3d9840){_0x5b53fd=_0x3d9840;return _0x3d9840['addSound'](_0x2ab792['body']['id'],{'transaction':_0xf65da5});}})['then'](function(_0x39a3a3){if(_0x39a3a3){return db['Sound']['findOne']({'where':{'id':_0x2ab792[_0xf2fa('0x48')]['id']},'attributes':['id',_0xf2fa('0x29'),_0xf2fa('0x5e'),_0xf2fa('0x5f'),_0xf2fa('0x60')],'raw':!![]});}})[_0xf2fa('0x22')](function(_0x366c98){if(_0x366c98){var _0x56c293=path[_0xf2fa('0x61')](config[_0xf2fa('0x62')],'server/files/sounds/converted',util[_0xf2fa('0x63')]('%s.%s',path[_0xf2fa('0x64')](_0x366c98[_0xf2fa('0x5e')],path[_0xf2fa('0x65')](_0x366c98['save_name'])),_0x366c98[_0xf2fa('0x5f')]));var _0x40efb0=path['join'](config[_0xf2fa('0x62')],_0xf2fa('0x50'),_0x5b53fd[_0xf2fa('0x29')],util['format'](_0xf2fa('0x66'),_0x366c98['name'],_0x366c98[_0xf2fa('0x5f')]));fs[_0xf2fa('0x67')](_0x56c293,_0x40efb0);return _0x366c98;}})[_0xf2fa('0x45')](function(_0x4edd71){throw new db['Sequelize'][(_0xf2fa('0x5c'))](_0x4edd71[_0xf2fa('0x68')]);});})[_0xf2fa('0x22')](handleEntityNotFound(_0x238d03,null))['then'](respondWithResult(_0x238d03,0xc9))[_0xf2fa('0x45')](handleError(_0x238d03,null));};exports[_0xf2fa('0x69')]=function(_0xc8eec7,_0x224cef,_0xec8ccb){return db[_0xf2fa('0x4b')][_0xf2fa('0x4c')](function(_0x39ffb5){var _0x5b39fd;return db['VoiceMusicOnHold'][_0xf2fa('0x6a')]({'where':{'id':_0xc8eec7['params']['id']}})['then'](handleEntityNotFound(_0x224cef,null))[_0xf2fa('0x22')](function(_0x37c97b){if(_0x37c97b){_0x5b39fd=_0x37c97b;return _0x37c97b[_0xf2fa('0x69')](_0xc8eec7[_0xf2fa('0x49')][_0xf2fa('0x6b')]);}})[_0xf2fa('0x22')](function(_0x35effc){if(_0x35effc){return db[_0xf2fa('0x6c')][_0xf2fa('0x6a')]({'where':{'id':_0xc8eec7[_0xf2fa('0x49')][_0xf2fa('0x6b')]},'attributes':['id',_0xf2fa('0x29'),_0xf2fa('0x5e'),_0xf2fa('0x5f'),_0xf2fa('0x60')],'raw':!![]});}})['then'](function(_0x3cc0f2){if(_0x3cc0f2){fs['unlinkSync'](path[_0xf2fa('0x61')](_0x5b39fd[_0xf2fa('0x4f')],util[_0xf2fa('0x63')]('%s.%s',_0x3cc0f2[_0xf2fa('0x29')],_0x3cc0f2['converted_format'])));return _0x3cc0f2;}})[_0xf2fa('0x45')](function(_0xf1977e){throw new db[(_0xf2fa('0x5b'))][(_0xf2fa('0x5c'))](_0xf1977e['message']);});})[_0xf2fa('0x22')](handleEntityNotFound(_0x224cef,null))[_0xf2fa('0x22')](respondWithStatusCode(_0x224cef,0xcc))[_0xf2fa('0x45')](handleError(_0x224cef,null));};exports['getSounds']=function(_0x466298,_0x4dcf49,_0x42e9db){var _0x2c3c91={};var _0x2d027d={};var _0x192e97;var _0x4b4df8;return db[_0xf2fa('0x2d')]['findOne']({'where':{'id':_0x466298[_0xf2fa('0x49')]['id']}})[_0xf2fa('0x22')](handleEntityNotFound(_0x4dcf49,null))[_0xf2fa('0x22')](function(_0x38feab){if(_0x38feab){_0x192e97=_0x38feab;_0x2d027d[_0xf2fa('0x37')]=_['keys'](db[_0xf2fa('0x6c')][_0xf2fa('0x2e')]);_0x2d027d[_0xf2fa('0x32')]=_[_0xf2fa('0x33')](_0x466298[_0xf2fa('0x32')]);_0x2d027d[_0xf2fa('0x34')]=_[_0xf2fa('0x35')](_0x2d027d[_0xf2fa('0x37')],_0x2d027d['query']);_0x2c3c91[_0xf2fa('0x36')]=_[_0xf2fa('0x35')](_0x2d027d[_0xf2fa('0x37')],qs['fields'](_0x466298[_0xf2fa('0x32')][_0xf2fa('0x38')]));_0x2c3c91['attributes']=_0x2c3c91[_0xf2fa('0x36')][_0xf2fa('0x39')]?_0x2c3c91[_0xf2fa('0x36')]:_0x2d027d[_0xf2fa('0x37')];_0x2c3c91[_0xf2fa('0x3b')]=qs[_0xf2fa('0x3c')](_0x466298['query'][_0xf2fa('0x3c')]);_0x2c3c91[_0xf2fa('0x3d')]=qs[_0xf2fa('0x34')](_[_0xf2fa('0x6d')](_0x466298[_0xf2fa('0x32')],_0x2d027d['filters']));if(_0x466298['query'][_0xf2fa('0x3e')]){_0x2c3c91['where']=_[_0xf2fa('0x3f')](_0x2c3c91[_0xf2fa('0x3d')],{'$or':_[_0xf2fa('0x2c')](_0x2c3c91['attributes'],function(_0x8df114){var _0x1805db={};_0x1805db[_0x8df114]={'$like':'%'+_0x466298[_0xf2fa('0x32')][_0xf2fa('0x3e')]+'%'};return _0x1805db;})});}_0x2c3c91=_[_0xf2fa('0x3f')]({},_0x2c3c91,_0x466298[_0xf2fa('0x40')]);return _0x192e97[_0xf2fa('0x6e')](_0x2c3c91);}})[_0xf2fa('0x22')](function(_0x5beb42){if(_0x5beb42){_0x4b4df8=_0x5beb42['length'];if(!_0x466298['query']['hasOwnProperty']('nolimit')){_0x2c3c91[_0xf2fa('0x1b')]=qs[_0xf2fa('0x1b')](_0x466298[_0xf2fa('0x32')][_0xf2fa('0x1b')]);_0x2c3c91[_0xf2fa('0x18')]=qs['offset'](_0x466298[_0xf2fa('0x32')][_0xf2fa('0x18')]);}return _0x192e97[_0xf2fa('0x6e')](_0x2c3c91);}})[_0xf2fa('0x22')](function(_0x4cffb3){if(_0x4cffb3){return _0x4cffb3?{'count':_0x4b4df8,'rows':_0x4cffb3}:null;}})[_0xf2fa('0x22')](respondWithResult(_0x4dcf49,null))[_0xf2fa('0x45')](handleError(_0x4dcf49,null));}; \ No newline at end of file +var _0xaf58=['findAll','rows','catch','show','params','length','find','body','create','sequelize','files','directory','join','root','server/files/moh','mkdirSync','0777','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','unlinkSync','rmdirSync','Sequelize','ValidationError','message','Sound','basename','save_name','converted_format','format','%s.%s','symlinkSync','removeSound','findOne','id2','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','then','get','MusicOnHolds','UserProfileResource','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMusicOnHold','includeAll','include'];(function(_0x481aad,_0x15d51d){var _0x118709=function(_0x576724){while(--_0x576724){_0x481aad['push'](_0x481aad['shift']());}};_0x118709(++_0x15d51d);}(_0xaf58,0x1d7));var _0x8af5=function(_0x31ea15,_0x3064bb){_0x31ea15=_0x31ea15-0x0;var _0x2dc294=_0xaf58[_0x31ea15];return _0x2dc294;};'use strict';var emlformat=require(_0x8af5('0x0'));var rimraf=require(_0x8af5('0x1'));var zipdir=require(_0x8af5('0x2'));var jsonpatch=require(_0x8af5('0x3'));var rp=require(_0x8af5('0x4'));var moment=require(_0x8af5('0x5'));var BPromise=require(_0x8af5('0x6'));var Mustache=require(_0x8af5('0x7'));var util=require('util');var path=require(_0x8af5('0x8'));var sox=require(_0x8af5('0x9'));var csv=require(_0x8af5('0xa'));var ejs=require(_0x8af5('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8af5('0xc'));var squel=require('squel');var crypto=require(_0x8af5('0xd'));var jsforce=require(_0x8af5('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8af5('0xf'));var Papa=require(_0x8af5('0x10'));var Redis=require('ioredis');var authService=require(_0x8af5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8af5('0x12'));var hardwareService=require(_0x8af5('0x13'));var logger=require(_0x8af5('0x14'))('api');var utils=require(_0x8af5('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8af5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e701e,_0x1626b1){_0x1626b1=_0x1626b1||0xcc;return function(_0x460c30){if(_0x460c30){return _0x3e701e[_0x8af5('0x17')](_0x1626b1);}return _0x3e701e[_0x8af5('0x18')](_0x1626b1)['end']();};}function respondWithResult(_0x4a9268,_0x3ff16a){_0x3ff16a=_0x3ff16a||0xc8;return function(_0x4d14b9){if(_0x4d14b9){return _0x4a9268[_0x8af5('0x18')](_0x3ff16a)[_0x8af5('0x19')](_0x4d14b9);}};}function respondWithFilteredResult(_0x22d4f5,_0x3a4b82){return function(_0x5e7e8b){if(_0x5e7e8b){var _0x59b7d9=typeof _0x3a4b82['offset']===_0x8af5('0x1a')&&typeof _0x3a4b82[_0x8af5('0x1b')]===_0x8af5('0x1a');var _0x50cf06=_0x5e7e8b[_0x8af5('0x1c')];var _0x5ef134=_0x59b7d9?0x0:_0x3a4b82[_0x8af5('0x1d')];var _0x47b0cc=_0x59b7d9?_0x5e7e8b['count']:_0x3a4b82[_0x8af5('0x1d')]+_0x3a4b82[_0x8af5('0x1b')];var _0x1ce499;if(_0x47b0cc>=_0x50cf06){_0x47b0cc=_0x50cf06;_0x1ce499=0xc8;}else{_0x1ce499=0xce;}_0x22d4f5['status'](_0x1ce499);return _0x22d4f5[_0x8af5('0x1e')]('Content-Range',_0x5ef134+'-'+_0x47b0cc+'/'+_0x50cf06)[_0x8af5('0x19')](_0x5e7e8b);}return null;};}function patchUpdates(_0x521972){return function(_0x42df66){try{jsonpatch[_0x8af5('0x1f')](_0x42df66,_0x521972,!![]);}catch(_0x5d3eeb){return BPromise[_0x8af5('0x20')](_0x5d3eeb);}return _0x42df66[_0x8af5('0x21')]();};}function saveUpdates(_0x44b3c8,_0x1d3b82){return function(_0x326285){if(_0x326285){return _0x326285[_0x8af5('0x22')](_0x44b3c8)['then'](function(_0x26811f){return _0x26811f;});}return null;};}function removeEntity(_0x35ff9c,_0x55c1eb){return function(_0x520303){if(_0x520303){return _0x520303[_0x8af5('0x23')]()[_0x8af5('0x24')](function(){var _0x2987d0=_0x520303[_0x8af5('0x25')]({'plain':!![]});var _0x485de1=_0x8af5('0x26');return db[_0x8af5('0x27')][_0x8af5('0x23')]({'where':{'type':_0x485de1,'resourceId':_0x2987d0['id']}})['then'](function(){return _0x520303;});})['then'](function(){_0x35ff9c[_0x8af5('0x18')](0xcc)[_0x8af5('0x28')]();});}};}function handleEntityNotFound(_0x33d320,_0x3f27cf){return function(_0x5f3221){if(!_0x5f3221){_0x33d320[_0x8af5('0x17')](0x194);}return _0x5f3221;};}function handleError(_0x4f118e,_0x48e6b8){_0x48e6b8=_0x48e6b8||0x1f4;return function(_0xdda823){logger['error'](_0xdda823[_0x8af5('0x29')]);if(_0xdda823[_0x8af5('0x2a')]){delete _0xdda823['name'];}_0x4f118e[_0x8af5('0x18')](_0x48e6b8)[_0x8af5('0x2b')](_0xdda823);};}exports[_0x8af5('0x2c')]=function(_0x20bea8,_0x5a0084){var _0x5c31cc={},_0x92a382={},_0x27744c={'count':0x0,'rows':[]};var _0x13486e=_[_0x8af5('0x2d')](db['VoiceMusicOnHold'][_0x8af5('0x2e')],function(_0x18ea7f){return{'name':_0x18ea7f[_0x8af5('0x2f')],'type':_0x18ea7f[_0x8af5('0x30')][_0x8af5('0x31')]};});_0x92a382[_0x8af5('0x32')]=_[_0x8af5('0x2d')](_0x13486e,_0x8af5('0x2a'));_0x92a382[_0x8af5('0x33')]=_[_0x8af5('0x34')](_0x20bea8[_0x8af5('0x33')]);_0x92a382[_0x8af5('0x35')]=_[_0x8af5('0x36')](_0x92a382[_0x8af5('0x32')],_0x92a382[_0x8af5('0x33')]);_0x5c31cc[_0x8af5('0x37')]=_['intersection'](_0x92a382[_0x8af5('0x32')],qs[_0x8af5('0x38')](_0x20bea8[_0x8af5('0x33')][_0x8af5('0x38')]));_0x5c31cc[_0x8af5('0x37')]=_0x5c31cc[_0x8af5('0x37')]['length']?_0x5c31cc[_0x8af5('0x37')]:_0x92a382[_0x8af5('0x32')];if(!_0x20bea8[_0x8af5('0x33')][_0x8af5('0x39')]('nolimit')){_0x5c31cc['limit']=qs[_0x8af5('0x1b')](_0x20bea8['query']['limit']);_0x5c31cc[_0x8af5('0x1d')]=qs[_0x8af5('0x1d')](_0x20bea8[_0x8af5('0x33')][_0x8af5('0x1d')]);}_0x5c31cc[_0x8af5('0x3a')]=qs[_0x8af5('0x3b')](_0x20bea8['query'][_0x8af5('0x3b')]);delete _0x20bea8['query']['sort'];_0x5c31cc[_0x8af5('0x3c')]=qs[_0x8af5('0x35')](_[_0x8af5('0x3d')](_0x20bea8[_0x8af5('0x33')],_0x92a382[_0x8af5('0x35')]),_0x13486e);if(_0x20bea8[_0x8af5('0x33')][_0x8af5('0x3e')]){_0x5c31cc[_0x8af5('0x3c')]=_[_0x8af5('0x3f')](_0x5c31cc[_0x8af5('0x3c')],{'$or':_['map'](_0x13486e,function(_0x28adba){if(_0x28adba[_0x8af5('0x30')]!==_0x8af5('0x40')){var _0x591e1a={};_0x591e1a[_0x28adba[_0x8af5('0x2a')]]={'$like':'%'+_0x20bea8[_0x8af5('0x33')][_0x8af5('0x3e')]+'%'};return _0x591e1a;}})});}_0x5c31cc=_[_0x8af5('0x3f')]({},_0x5c31cc,_0x20bea8[_0x8af5('0x41')]);var _0x146d95={'where':_0x5c31cc[_0x8af5('0x3c')]};return db[_0x8af5('0x42')][_0x8af5('0x1c')](_0x146d95)[_0x8af5('0x24')](function(_0x2a2a57){_0x27744c['count']=_0x2a2a57;if(_0x20bea8[_0x8af5('0x33')][_0x8af5('0x43')]){_0x5c31cc[_0x8af5('0x44')]=[{'all':!![]}];}return db[_0x8af5('0x42')][_0x8af5('0x45')](_0x5c31cc);})[_0x8af5('0x24')](function(_0x5562ac){_0x27744c[_0x8af5('0x46')]=_0x5562ac;return _0x27744c;})[_0x8af5('0x24')](respondWithFilteredResult(_0x5a0084,_0x5c31cc))[_0x8af5('0x47')](handleError(_0x5a0084,null));};exports[_0x8af5('0x48')]=function(_0x57ddbb,_0x5843f7){var _0x49bdc5={'raw':![],'where':{'id':_0x57ddbb[_0x8af5('0x49')]['id']}},_0x53f980={};_0x53f980[_0x8af5('0x32')]=_[_0x8af5('0x34')](db[_0x8af5('0x42')][_0x8af5('0x2e')]);_0x53f980['query']=_[_0x8af5('0x34')](_0x57ddbb[_0x8af5('0x33')]);_0x53f980[_0x8af5('0x35')]=_[_0x8af5('0x36')](_0x53f980[_0x8af5('0x32')],_0x53f980[_0x8af5('0x33')]);_0x49bdc5[_0x8af5('0x37')]=_[_0x8af5('0x36')](_0x53f980['model'],qs[_0x8af5('0x38')](_0x57ddbb[_0x8af5('0x33')]['fields']));_0x49bdc5['attributes']=_0x49bdc5[_0x8af5('0x37')][_0x8af5('0x4a')]?_0x49bdc5[_0x8af5('0x37')]:_0x53f980['model'];if(_0x57ddbb[_0x8af5('0x33')]['includeAll']){_0x49bdc5[_0x8af5('0x44')]=[{'all':!![]}];}_0x49bdc5=_[_0x8af5('0x3f')]({},_0x49bdc5,_0x57ddbb['options']);return db[_0x8af5('0x42')][_0x8af5('0x4b')](_0x49bdc5)[_0x8af5('0x24')](handleEntityNotFound(_0x5843f7,null))[_0x8af5('0x24')](respondWithResult(_0x5843f7,null))['catch'](handleError(_0x5843f7,null));};exports[_0x8af5('0x22')]=function(_0x493a0f,_0x3d67aa){if(_0x493a0f[_0x8af5('0x4c')]['id']){delete _0x493a0f['body']['id'];}return db[_0x8af5('0x42')][_0x8af5('0x4b')]({'where':{'id':_0x493a0f[_0x8af5('0x49')]['id']}})['then'](handleEntityNotFound(_0x3d67aa,null))[_0x8af5('0x24')](saveUpdates(_0x493a0f['body'],null))['then'](respondWithResult(_0x3d67aa,null))['catch'](handleError(_0x3d67aa,null));};exports[_0x8af5('0x4d')]=function(_0x1b2ccd,_0x5f03dd,_0x173fe4){return db[_0x8af5('0x4e')]['transaction'](function(_0x5d14ab){if(_0x1b2ccd[_0x8af5('0x4c')]['mode']===_0x8af5('0x4f')){_0x1b2ccd[_0x8af5('0x4c')][_0x8af5('0x50')]=path[_0x8af5('0x51')](config[_0x8af5('0x52')],_0x8af5('0x53'),_0x1b2ccd[_0x8af5('0x4c')]['name']);}return db['VoiceMusicOnHold'][_0x8af5('0x4d')](_0x1b2ccd['body'],{'transaction':_0x5d14ab})['then'](function(_0x4812de){if(_0x1b2ccd[_0x8af5('0x4c')]['mode']===_0x8af5('0x4f')){fs[_0x8af5('0x54')](_0x4812de['directory'],parseInt(_0x8af5('0x55'),0x8));}var _0x464cc9=_0x1b2ccd['user'][_0x8af5('0x25')]({'plain':!![]});if(!_0x464cc9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x464cc9['role']===_0x8af5('0x56')){var _0x2b4767=_0x4812de[_0x8af5('0x25')]({'plain':!![]});return db['UserProfileSection'][_0x8af5('0x4b')]({'where':{'name':_0x8af5('0x26'),'userProfileId':_0x464cc9[_0x8af5('0x57')]},'raw':!![]})['then'](function(_0x56a13b){if(_0x56a13b&&_0x56a13b[_0x8af5('0x58')]===0x0){return db['UserProfileResource'][_0x8af5('0x4d')]({'name':_0x2b4767[_0x8af5('0x2a')],'resourceId':_0x2b4767['id'],'type':_0x56a13b['name'],'sectionId':_0x56a13b['id']},{})[_0x8af5('0x24')](function(){return _0x4812de;});}else{return _0x4812de;}})['catch'](function(_0x2bcdee){logger[_0x8af5('0x59')](_0x8af5('0x5a'),_0x2bcdee);});}return _0x4812de;});})[_0x8af5('0x24')](respondWithResult(_0x5f03dd,0xc9))[_0x8af5('0x47')](handleError(_0x5f03dd,null));};exports[_0x8af5('0x23')]=function(_0xedd79f,_0x4137aa,_0xc1be92){var _0x2fa509;return db['VoiceMusicOnHold']['find']({'where':{'id':_0xedd79f['params']['id']}})[_0x8af5('0x24')](function(_0x32dcab){if(_0x32dcab){return db['sequelize'][_0x8af5('0x5b')](function(_0x58fee2){return _0x32dcab[_0x8af5('0x23')]({'transaction':_0x58fee2,'raw':!![]})['then'](function(_0x574ea6){if(_0x574ea6['directory']){fs['readdirSync'](_0x574ea6[_0x8af5('0x50')])['forEach'](function(_0x337f6c){fs[_0x8af5('0x5c')](path[_0x8af5('0x51')](_0x574ea6[_0x8af5('0x50')],_0x337f6c));});fs[_0x8af5('0x5d')](_0x574ea6[_0x8af5('0x50')]);}return _0x574ea6;});})[_0x8af5('0x47')](function(_0x451974){throw new db[(_0x8af5('0x5e'))][(_0x8af5('0x5f'))](_0x451974[_0x8af5('0x60')]);});}})['then'](handleEntityNotFound(_0x4137aa,null))[_0x8af5('0x24')](removeEntity(_0x4137aa,null))[_0x8af5('0x47')](handleError(_0x4137aa,null));};exports['addSound']=function(_0x215349,_0x1e46bb,_0x16dce4){return db[_0x8af5('0x4e')][_0x8af5('0x5b')](function(_0x34b604){var _0x539bdf;return db[_0x8af5('0x42')][_0x8af5('0x4b')]({'where':{'id':_0x215349[_0x8af5('0x49')]['id']}})['then'](function(_0x8334a7){if(_0x8334a7){_0x539bdf=_0x8334a7;return _0x8334a7['addSound'](_0x215349['body']['id'],{'transaction':_0x34b604});}})[_0x8af5('0x24')](function(_0x5e1c66){if(_0x5e1c66){return db[_0x8af5('0x61')]['findOne']({'where':{'id':_0x215349[_0x8af5('0x4c')]['id']},'attributes':['id',_0x8af5('0x2a'),'save_name','converted_format','createdAt'],'raw':!![]});}})[_0x8af5('0x24')](function(_0x24056d){if(_0x24056d){var _0x49e5a3=path[_0x8af5('0x51')](config[_0x8af5('0x52')],'server/files/sounds/converted',util['format']('%s.%s',path[_0x8af5('0x62')](_0x24056d[_0x8af5('0x63')],path['extname'](_0x24056d[_0x8af5('0x63')])),_0x24056d[_0x8af5('0x64')]));var _0x4bc9ee=path[_0x8af5('0x51')](config[_0x8af5('0x52')],_0x8af5('0x53'),_0x539bdf[_0x8af5('0x2a')],util[_0x8af5('0x65')](_0x8af5('0x66'),_0x24056d[_0x8af5('0x2a')],_0x24056d[_0x8af5('0x64')]));fs[_0x8af5('0x67')](_0x49e5a3,_0x4bc9ee);return _0x24056d;}})[_0x8af5('0x47')](function(_0x32a36f){throw new db['Sequelize'][(_0x8af5('0x5f'))](_0x32a36f[_0x8af5('0x60')]);});})[_0x8af5('0x24')](handleEntityNotFound(_0x1e46bb,null))[_0x8af5('0x24')](respondWithResult(_0x1e46bb,0xc9))[_0x8af5('0x47')](handleError(_0x1e46bb,null));};exports[_0x8af5('0x68')]=function(_0x1087c2,_0x49270f,_0x28727e){return db[_0x8af5('0x4e')][_0x8af5('0x5b')](function(_0x4d1800){var _0x3eb783;return db[_0x8af5('0x42')][_0x8af5('0x69')]({'where':{'id':_0x1087c2[_0x8af5('0x49')]['id']}})[_0x8af5('0x24')](handleEntityNotFound(_0x49270f,null))['then'](function(_0x16320d){if(_0x16320d){_0x3eb783=_0x16320d;return _0x16320d[_0x8af5('0x68')](_0x1087c2[_0x8af5('0x49')][_0x8af5('0x6a')]);}})[_0x8af5('0x24')](function(_0x553ee6){if(_0x553ee6){return db[_0x8af5('0x61')][_0x8af5('0x69')]({'where':{'id':_0x1087c2[_0x8af5('0x49')]['id2']},'attributes':['id',_0x8af5('0x2a'),_0x8af5('0x63'),_0x8af5('0x64'),'createdAt'],'raw':!![]});}})[_0x8af5('0x24')](function(_0x46440d){if(_0x46440d){fs[_0x8af5('0x5c')](path['join'](_0x3eb783['directory'],util['format'](_0x8af5('0x66'),_0x46440d[_0x8af5('0x2a')],_0x46440d[_0x8af5('0x64')])));return _0x46440d;}})[_0x8af5('0x47')](function(_0x323313){throw new db[(_0x8af5('0x5e'))][(_0x8af5('0x5f'))](_0x323313[_0x8af5('0x60')]);});})[_0x8af5('0x24')](handleEntityNotFound(_0x49270f,null))[_0x8af5('0x24')](respondWithStatusCode(_0x49270f,0xcc))['catch'](handleError(_0x49270f,null));};exports[_0x8af5('0x6b')]=function(_0x37ca55,_0xab499,_0x20be50){var _0x4c9a31={};var _0x2c24cb={};var _0x27f6a7;var _0xaf4669;return db[_0x8af5('0x42')][_0x8af5('0x69')]({'where':{'id':_0x37ca55[_0x8af5('0x49')]['id']}})[_0x8af5('0x24')](handleEntityNotFound(_0xab499,null))['then'](function(_0x52b0a0){if(_0x52b0a0){_0x27f6a7=_0x52b0a0;_0x2c24cb[_0x8af5('0x32')]=_['keys'](db['Sound'][_0x8af5('0x2e')]);_0x2c24cb['query']=_[_0x8af5('0x34')](_0x37ca55['query']);_0x2c24cb['filters']=_['intersection'](_0x2c24cb[_0x8af5('0x32')],_0x2c24cb[_0x8af5('0x33')]);_0x4c9a31['attributes']=_[_0x8af5('0x36')](_0x2c24cb[_0x8af5('0x32')],qs[_0x8af5('0x38')](_0x37ca55[_0x8af5('0x33')][_0x8af5('0x38')]));_0x4c9a31[_0x8af5('0x37')]=_0x4c9a31[_0x8af5('0x37')]['length']?_0x4c9a31[_0x8af5('0x37')]:_0x2c24cb[_0x8af5('0x32')];_0x4c9a31['order']=qs[_0x8af5('0x3b')](_0x37ca55['query'][_0x8af5('0x3b')]);_0x4c9a31[_0x8af5('0x3c')]=qs[_0x8af5('0x35')](_[_0x8af5('0x3d')](_0x37ca55['query'],_0x2c24cb[_0x8af5('0x35')]));if(_0x37ca55[_0x8af5('0x33')][_0x8af5('0x3e')]){_0x4c9a31[_0x8af5('0x3c')]=_[_0x8af5('0x3f')](_0x4c9a31['where'],{'$or':_['map'](_0x4c9a31['attributes'],function(_0xab671){var _0x196534={};_0x196534[_0xab671]={'$like':'%'+_0x37ca55[_0x8af5('0x33')][_0x8af5('0x3e')]+'%'};return _0x196534;})});}_0x4c9a31=_['merge']({},_0x4c9a31,_0x37ca55[_0x8af5('0x41')]);return _0x27f6a7[_0x8af5('0x6b')](_0x4c9a31);}})[_0x8af5('0x24')](function(_0x23a583){if(_0x23a583){_0xaf4669=_0x23a583['length'];if(!_0x37ca55['query'][_0x8af5('0x39')]('nolimit')){_0x4c9a31[_0x8af5('0x1b')]=qs['limit'](_0x37ca55[_0x8af5('0x33')][_0x8af5('0x1b')]);_0x4c9a31[_0x8af5('0x1d')]=qs[_0x8af5('0x1d')](_0x37ca55['query'][_0x8af5('0x1d')]);}return _0x27f6a7[_0x8af5('0x6b')](_0x4c9a31);}})[_0x8af5('0x24')](function(_0x483479){if(_0x483479){return _0x483479?{'count':_0xaf4669,'rows':_0x483479}:null;}})[_0x8af5('0x24')](respondWithResult(_0xab499,null))['catch'](handleError(_0xab499,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 99fca99..1002832 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 _0x4a05=['rimraf','../../config/environment','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3ca4d8,_0x14b8d3){var _0x3b1457=function(_0x1aba59){while(--_0x1aba59){_0x3ca4d8['push'](_0x3ca4d8['shift']());}};_0x3b1457(++_0x14b8d3);}(_0x4a05,0x18e));var _0x54a0=function(_0x3f9f39,_0x39d8c2){_0x3f9f39=_0x3f9f39-0x0;var _0x3de0b8=_0x4a05[_0x3f9f39];return _0x3de0b8;};'use strict';var _=require(_0x54a0('0x0'));var util=require(_0x54a0('0x1'));var logger=require(_0x54a0('0x2'))(_0x54a0('0x3'));var moment=require(_0x54a0('0x4'));var BPromise=require(_0x54a0('0x5'));var rp=require(_0x54a0('0x6'));var fs=require('fs');var path=require(_0x54a0('0x7'));var rimraf=require(_0x54a0('0x8'));var config=require(_0x54a0('0x9'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x54a0('0xa')]=function(_0x30384b,_0x341a77){return _0x30384b[_0x54a0('0xb')](_0x54a0('0xc'),attributes,{'tableName':_0x54a0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb32=['voice_musiconhold','lodash','api','moment','bluebird','request-promise','../../config/environment','./voiceMusicOnHold.attributes','exports','define'];(function(_0x165ce3,_0x32671b){var _0x2c67b7=function(_0x5b6c8a){while(--_0x5b6c8a){_0x165ce3['push'](_0x165ce3['shift']());}};_0x2c67b7(++_0x32671b);}(_0xbb32,0x1c3));var _0x2bb3=function(_0x3951ff,_0x4a06e0){_0x3951ff=_0x3951ff-0x0;var _0x487314=_0xbb32[_0x3951ff];return _0x487314;};'use strict';var _=require(_0x2bb3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2bb3('0x1'));var moment=require(_0x2bb3('0x2'));var BPromise=require(_0x2bb3('0x3'));var rp=require(_0x2bb3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2bb3('0x5'));var attributes=require(_0x2bb3('0x6'));module[_0x2bb3('0x7')]=function(_0xa5ecab,_0x274f2f){return _0xa5ecab[_0x2bb3('0x8')]('VoiceMusicOnHold',attributes,{'tableName':_0x2bb3('0x9'),'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 05415e8..1f1f43a 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0x193057,_0x19df76){var _0x50e426=function(_0x46881b){while(--_0x46881b){_0x193057['push'](_0x193057['shift']());}};_0x50e426(++_0x19df76);}(_0xedd9,0xfc));var _0x9edd=function(_0x57b5c3,_0xb62bb6){_0x57b5c3=_0x57b5c3-0x0;var _0x38692d=_0xedd9[_0x57b5c3];return _0x38692d;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file +var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4a8a80,_0x15d0be){var _0xf6308=function(_0x5e7bd0){while(--_0x5e7bd0){_0x4a8a80['push'](_0x4a8a80['shift']());}};_0xf6308(++_0x15d0be);}(_0x70e0,0x17b));var _0x070e=function(_0x32bb80,_0x4ad480){_0x32bb80=_0x32bb80-0x0;var _0x22469b=_0x70e0[_0x32bb80];return _0x22469b;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 460140e..b316af4 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 _0x795f=['post','create','addAgents','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./voicePrefix.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/users','getAgents'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x795f,0x13f));var _0xf795=function(_0xea4c4,_0x450e3f){_0xea4c4=_0xea4c4-0x0;var _0x3db169=_0x795f[_0xea4c4];return _0x3db169;};'use strict';var multer=require(_0xf795('0x0'));var util=require('util');var path=require(_0xf795('0x1'));var timeout=require(_0xf795('0x2'));var express=require(_0xf795('0x3'));var router=express[_0xf795('0x4')]();var fs_extra=require(_0xf795('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf795('0x6'));var controller=require(_0xf795('0x7'));router['get']('/',auth[_0xf795('0x8')](),controller[_0xf795('0x9')]);router['get'](_0xf795('0xa'),auth[_0xf795('0x8')](),controller[_0xf795('0xb')]);router[_0xf795('0xc')](_0xf795('0xd'),auth['isAuthenticated'](),controller[_0xf795('0xe')]);router[_0xf795('0xc')](_0xf795('0xf'),auth['isAuthenticated'](),controller[_0xf795('0x10')]);router[_0xf795('0x11')]('/',auth[_0xf795('0x8')](),controller[_0xf795('0x12')]);router['post'](_0xf795('0xf'),auth[_0xf795('0x8')](),controller[_0xf795('0x13')]);router[_0xf795('0x14')]('/:id',auth[_0xf795('0x8')](),controller[_0xf795('0x15')]);router[_0xf795('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xf795('0x16')](_0xf795('0xf'),auth[_0xf795('0x8')](),controller['removeAgents']);module[_0xf795('0x17')]=router; \ No newline at end of file +var _0x3afe=['removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','/describe','describe','/:id','/:id/users','getAgents','create','post','put','delete','destroy'];(function(_0x201da2,_0x152fdc){var _0x2afdcb=function(_0x4de387){while(--_0x4de387){_0x201da2['push'](_0x201da2['shift']());}};_0x2afdcb(++_0x152fdc);}(_0x3afe,0x135));var _0xe3af=function(_0x1c1081,_0xe2cb8c){_0x1c1081=_0x1c1081-0x0;var _0x506a1a=_0x3afe[_0x1c1081];return _0x506a1a;};'use strict';var multer=require(_0xe3af('0x0'));var util=require(_0xe3af('0x1'));var path=require(_0xe3af('0x2'));var timeout=require(_0xe3af('0x3'));var express=require(_0xe3af('0x4'));var router=express['Router']();var fs_extra=require(_0xe3af('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe3af('0x6'));var config=require(_0xe3af('0x7'));var controller=require(_0xe3af('0x8'));router[_0xe3af('0x9')]('/',auth[_0xe3af('0xa')](),controller['index']);router[_0xe3af('0x9')](_0xe3af('0xb'),auth[_0xe3af('0xa')](),controller[_0xe3af('0xc')]);router[_0xe3af('0x9')](_0xe3af('0xd'),auth[_0xe3af('0xa')](),controller['show']);router[_0xe3af('0x9')](_0xe3af('0xe'),auth[_0xe3af('0xa')](),controller[_0xe3af('0xf')]);router['post']('/',auth[_0xe3af('0xa')](),controller[_0xe3af('0x10')]);router[_0xe3af('0x11')](_0xe3af('0xe'),auth[_0xe3af('0xa')](),controller['addAgents']);router[_0xe3af('0x12')](_0xe3af('0xd'),auth[_0xe3af('0xa')](),controller['update']);router[_0xe3af('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xe3af('0x14')]);router[_0xe3af('0x13')](_0xe3af('0xe'),auth[_0xe3af('0xa')](),controller[_0xe3af('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index b1a7268..8c2fde9 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 _0x1526=['INTEGER','sequelize','exports','name','system-','STRING'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x1526,0xc1));var _0x6152=function(_0x41ab22,_0x23e9da){_0x41ab22=_0x41ab22-0x0;var _0x1aa618=_0x1526[_0x41ab22];return _0x1aa618;};'use strict';var Sequelize=require(_0x6152('0x0'));module[_0x6152('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6152('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x2ce71f){return _0x6152('0x3')+this['getDataValue'](_0x6152('0x2'))+'-';}},'description':{'type':Sequelize[_0x6152('0x4')]},'callerIdAll':{'type':Sequelize[_0x6152('0x4')]},'VoiceExtensionId':{'type':Sequelize[_0x6152('0x5')]}}; \ No newline at end of file +var _0x3c77=['STRING','VIRTUAL','system-','getDataValue','INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c77,0x1cd));var _0x73c7=function(_0x3aca41,_0x49ff3a){_0x3aca41=_0x3aca41-0x0;var _0x1a3042=_0x3c77[_0x3aca41];return _0x1a3042;};'use strict';var Sequelize=require(_0x73c7('0x0'));module['exports']={'name':{'type':Sequelize[_0x73c7('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x73c7('0x2')],'get':function(_0x3cd1d5){return _0x73c7('0x3')+this[_0x73c7('0x4')]('name')+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x73c7('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x73c7('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 3783a16..9601c2f 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 _0x6836=['filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','describe','create','sequelize','transaction','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoicePrefixes','userProfileId','autoAssociation','context','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','push','callerIdAll','goto','${EXTEN:','charAt','body','system-','addAgents','ids','emit','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x2f17cf,_0x2112a0){var _0x306a1b=function(_0x3e5f2b){while(--_0x3e5f2b){_0x2f17cf['push'](_0x2f17cf['shift']());}};_0x306a1b(++_0x2112a0);}(_0x6836,0x1c0));var _0x6683=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x6836[_0x1beef3];return _0x5af964;};'use strict';var emlformat=require(_0x6683('0x0'));var rimraf=require(_0x6683('0x1'));var zipdir=require(_0x6683('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6683('0x3'));var moment=require('moment');var BPromise=require(_0x6683('0x4'));var Mustache=require('mustache');var util=require(_0x6683('0x5'));var path=require('path');var sox=require(_0x6683('0x6'));var csv=require(_0x6683('0x7'));var ejs=require(_0x6683('0x8'));var fs=require('fs');var fs_extra=require(_0x6683('0x9'));var _=require('lodash');var squel=require(_0x6683('0xa'));var crypto=require(_0x6683('0xb'));var jsforce=require(_0x6683('0xc'));var deskjs=require(_0x6683('0xd'));var toCsv=require(_0x6683('0x7'));var querystring=require(_0x6683('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6683('0xf'));var qs=require(_0x6683('0x10'));var as=require(_0x6683('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6683('0x12'))('api');var utils=require(_0x6683('0x13'));var config=require(_0x6683('0x14'));var licenseUtil=require(_0x6683('0x15'));var db=require(_0x6683('0x16'))['db'];config[_0x6683('0x17')]=_[_0x6683('0x18')](config[_0x6683('0x17')],{'host':_0x6683('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6683('0x17')]));require(_0x6683('0x1a'))[_0x6683('0x1b')](socket);function respondWithStatusCode(_0x28985f,_0x2f6419){_0x2f6419=_0x2f6419||0xcc;return function(_0x5ea3c3){if(_0x5ea3c3){return _0x28985f[_0x6683('0x1c')](_0x2f6419);}return _0x28985f[_0x6683('0x1d')](_0x2f6419)[_0x6683('0x1e')]();};}function respondWithResult(_0x11fdef,_0xee9bd4){_0xee9bd4=_0xee9bd4||0xc8;return function(_0x1a689d){if(_0x1a689d){return _0x11fdef[_0x6683('0x1d')](_0xee9bd4)[_0x6683('0x1f')](_0x1a689d);}};}function respondWithFilteredResult(_0x47466b,_0xe808ff){return function(_0x4cad41){if(_0x4cad41){var _0x3afbec=typeof _0xe808ff[_0x6683('0x20')]===_0x6683('0x21')&&typeof _0xe808ff[_0x6683('0x22')]==='undefined';var _0x2dabc1=_0x4cad41[_0x6683('0x23')];var _0x410692=_0x3afbec?0x0:_0xe808ff[_0x6683('0x20')];var _0x258708=_0x3afbec?_0x4cad41[_0x6683('0x23')]:_0xe808ff[_0x6683('0x20')]+_0xe808ff[_0x6683('0x22')];var _0x1978a9;if(_0x258708>=_0x2dabc1){_0x258708=_0x2dabc1;_0x1978a9=0xc8;}else{_0x1978a9=0xce;}_0x47466b[_0x6683('0x1d')](_0x1978a9);return _0x47466b[_0x6683('0x24')](_0x6683('0x25'),_0x410692+'-'+_0x258708+'/'+_0x2dabc1)[_0x6683('0x1f')](_0x4cad41);}return null;};}function patchUpdates(_0x3b63e7){return function(_0x10b7c0){try{jsonpatch[_0x6683('0x26')](_0x10b7c0,_0x3b63e7,!![]);}catch(_0x55aeb3){return BPromise[_0x6683('0x27')](_0x55aeb3);}return _0x10b7c0[_0x6683('0x28')]();};}function saveUpdates(_0x49c1ce,_0x3250e5){return function(_0x4579d9){if(_0x4579d9){return _0x4579d9[_0x6683('0x29')](_0x49c1ce)['then'](function(_0x3b005e){return _0x3b005e;});}return null;};}function removeEntity(_0x2a2243,_0x43879e){return function(_0xd93a1){if(_0xd93a1){return _0xd93a1['destroy']()[_0x6683('0x2a')](function(){var _0x40959d=_0xd93a1[_0x6683('0x2b')]({'plain':!![]});var _0x234d8f='VoicePrefixes';return db[_0x6683('0x2c')][_0x6683('0x2d')]({'where':{'type':_0x234d8f,'resourceId':_0x40959d['id']}})[_0x6683('0x2a')](function(){return _0xd93a1;});})[_0x6683('0x2a')](function(){_0x2a2243[_0x6683('0x1d')](0xcc)[_0x6683('0x1e')]();});}};}function handleEntityNotFound(_0x343f4e,_0xda3a48){return function(_0x1d2b1e){if(!_0x1d2b1e){_0x343f4e['sendStatus'](0x194);}return _0x1d2b1e;};}function handleError(_0x150b8f,_0x1f57fa){_0x1f57fa=_0x1f57fa||0x1f4;return function(_0x48a4f3){logger[_0x6683('0x2e')](_0x48a4f3[_0x6683('0x2f')]);if(_0x48a4f3['name']){delete _0x48a4f3[_0x6683('0x30')];}_0x150b8f['status'](_0x1f57fa)[_0x6683('0x31')](_0x48a4f3);};}exports[_0x6683('0x32')]=function(_0x27fd8f,_0x268c54){var _0x5e6fd7={},_0xd001af={},_0x4748d8={'count':0x0,'rows':[]};var _0x1bc932=_[_0x6683('0x33')](db[_0x6683('0x34')][_0x6683('0x35')],function(_0xaa6a8c){return{'name':_0xaa6a8c[_0x6683('0x36')],'type':_0xaa6a8c[_0x6683('0x37')][_0x6683('0x38')]};});_0xd001af[_0x6683('0x39')]=_[_0x6683('0x33')](_0x1bc932,_0x6683('0x30'));_0xd001af[_0x6683('0x3a')]=_[_0x6683('0x3b')](_0x27fd8f['query']);_0xd001af[_0x6683('0x3c')]=_['intersection'](_0xd001af['model'],_0xd001af[_0x6683('0x3a')]);_0x5e6fd7[_0x6683('0x3d')]=_[_0x6683('0x3e')](_0xd001af[_0x6683('0x39')],qs[_0x6683('0x3f')](_0x27fd8f[_0x6683('0x3a')][_0x6683('0x3f')]));_0x5e6fd7[_0x6683('0x3d')]=_0x5e6fd7['attributes'][_0x6683('0x40')]?_0x5e6fd7[_0x6683('0x3d')]:_0xd001af[_0x6683('0x39')];if(!_0x27fd8f['query']['hasOwnProperty'](_0x6683('0x41'))){_0x5e6fd7['limit']=qs[_0x6683('0x22')](_0x27fd8f[_0x6683('0x3a')]['limit']);_0x5e6fd7[_0x6683('0x20')]=qs[_0x6683('0x20')](_0x27fd8f[_0x6683('0x3a')][_0x6683('0x20')]);}_0x5e6fd7[_0x6683('0x42')]=qs[_0x6683('0x43')](_0x27fd8f[_0x6683('0x3a')]['sort']);_0x5e6fd7[_0x6683('0x44')]=qs[_0x6683('0x3c')](_[_0x6683('0x45')](_0x27fd8f['query'],_0xd001af['filters']),_0x1bc932);if(_0x27fd8f[_0x6683('0x3a')][_0x6683('0x46')]){_0x5e6fd7['where']=_[_0x6683('0x47')](_0x5e6fd7[_0x6683('0x44')],{'$or':_[_0x6683('0x33')](_0x1bc932,function(_0x517fe3){if(_0x517fe3['type']!==_0x6683('0x48')){var _0x38e148={};_0x38e148[_0x517fe3[_0x6683('0x30')]]={'$like':'%'+_0x27fd8f[_0x6683('0x3a')][_0x6683('0x46')]+'%'};return _0x38e148;}})});}_0x5e6fd7=_[_0x6683('0x47')]({},_0x5e6fd7,_0x27fd8f[_0x6683('0x49')]);var _0xa78996={'where':_0x5e6fd7['where']};return db[_0x6683('0x34')]['count'](_0xa78996)[_0x6683('0x2a')](function(_0x8663ed){_0x4748d8['count']=_0x8663ed;if(_0x27fd8f['query'][_0x6683('0x4a')]){_0x5e6fd7[_0x6683('0x4b')]=[{'all':!![]}];}return db[_0x6683('0x34')][_0x6683('0x4c')](_0x5e6fd7);})[_0x6683('0x2a')](function(_0x1ce2a9){_0x4748d8[_0x6683('0x4d')]=_0x1ce2a9;return _0x4748d8;})['then'](respondWithFilteredResult(_0x268c54,_0x5e6fd7))[_0x6683('0x4e')](handleError(_0x268c54,null));};exports[_0x6683('0x4f')]=function(_0x1d3198,_0x3361e4){var _0x1d1828={'raw':![],'where':{'id':_0x1d3198[_0x6683('0x50')]['id']}},_0x4401e1={};_0x4401e1[_0x6683('0x39')]=_[_0x6683('0x3b')](db[_0x6683('0x34')][_0x6683('0x35')]);_0x4401e1[_0x6683('0x3a')]=_[_0x6683('0x3b')](_0x1d3198[_0x6683('0x3a')]);_0x4401e1[_0x6683('0x3c')]=_[_0x6683('0x3e')](_0x4401e1[_0x6683('0x39')],_0x4401e1['query']);_0x1d1828['attributes']=_['intersection'](_0x4401e1[_0x6683('0x39')],qs[_0x6683('0x3f')](_0x1d3198[_0x6683('0x3a')]['fields']));_0x1d1828[_0x6683('0x3d')]=_0x1d1828[_0x6683('0x3d')][_0x6683('0x40')]?_0x1d1828['attributes']:_0x4401e1[_0x6683('0x39')];if(_0x1d3198[_0x6683('0x3a')]['includeAll']){_0x1d1828['include']=[{'all':!![]}];}_0x1d1828=_['merge']({},_0x1d1828,_0x1d3198['options']);return db[_0x6683('0x34')][_0x6683('0x51')](_0x1d1828)[_0x6683('0x2a')](handleEntityNotFound(_0x3361e4,null))[_0x6683('0x2a')](respondWithResult(_0x3361e4,null))[_0x6683('0x4e')](handleError(_0x3361e4,null));};exports[_0x6683('0x2d')]=function(_0x3a01ed,_0x5a3bba){return db[_0x6683('0x34')][_0x6683('0x51')]({'where':{'id':_0x3a01ed[_0x6683('0x50')]['id']}})[_0x6683('0x2a')](handleEntityNotFound(_0x5a3bba,null))[_0x6683('0x2a')](removeEntity(_0x5a3bba,null))['catch'](handleError(_0x5a3bba,null));};exports[_0x6683('0x52')]=function(_0x2325ce,_0x380dbb){return db[_0x6683('0x34')][_0x6683('0x52')]()[_0x6683('0x2a')](respondWithResult(_0x380dbb,null))[_0x6683('0x4e')](handleError(_0x380dbb,null));};exports[_0x6683('0x53')]=function(_0x228fa3,_0x3f7170){var _0x101626;return db[_0x6683('0x54')][_0x6683('0x55')](function(_0x41d082){return db[_0x6683('0x34')][_0x6683('0x53')](_0x228fa3['body'],{'transaction':_0x41d082})[_0x6683('0x2a')](function(_0x5bb4ee){_0x101626=_0x5bb4ee[_0x6683('0x2b')]({'plain':!![]});return db['VoiceExtension'][_0x6683('0x51')]({'where':{'id':_0x101626[_0x6683('0x56')]},'raw':!![]})['then'](function(_0x2d8aef){return createVoicePrefixExtensions(_0x101626,_0x2d8aef,_0x41d082);});});})[_0x6683('0x2a')](function(){var _0x2d370a=_0x228fa3[_0x6683('0x57')][_0x6683('0x2b')]({'plain':!![]});if(!_0x2d370a)throw new Error(_0x6683('0x58'));if(_0x2d370a[_0x6683('0x59')]===_0x6683('0x57')){var _0x3cf45e=_0x101626;return db['UserProfileSection'][_0x6683('0x51')]({'where':{'name':_0x6683('0x5a'),'userProfileId':_0x2d370a[_0x6683('0x5b')]},'raw':!![]})[_0x6683('0x2a')](function(_0x40dd9e){if(_0x40dd9e&&_0x40dd9e[_0x6683('0x5c')]===0x0){return db[_0x6683('0x2c')][_0x6683('0x53')]({'name':_0x3cf45e[_0x6683('0x30')],'resourceId':_0x3cf45e['id'],'type':_0x40dd9e[_0x6683('0x30')],'sectionId':_0x40dd9e['id']},{})[_0x6683('0x2a')](function(){return _0x101626;});}else{return _0x101626;}})['catch'](function(_0x118ee0){logger[_0x6683('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x118ee0);throw _0x118ee0;});}return _0x101626;})[_0x6683('0x2a')](respondWithResult(_0x3f7170,null))[_0x6683('0x4e')](handleError(_0x3f7170,null));};function Extension(_0x2742fb,_0x3e4e9c,_0x195e1e,_0x2c157b){this[_0x6683('0x5d')]=_0x6683('0x5e');this[_0x6683('0x5f')]=_0x2742fb;this[_0x6683('0x60')]=_0x195e1e;this[_0x6683('0x37')]=_0x6683('0x61');this[_0x6683('0x62')]=_0x6683('0x63');this['priority']=_0x3e4e9c;this[_0x6683('0x64')]=_0x2c157b;}function createVoicePrefixExtensions(_0x198c27,_0x43aa98,_0x609020){return new BPromise(function(_0x44bf65,_0x516726){var _0x4193d1=new Extension(formatPrefixName(_0x198c27[_0x6683('0x65')]),0x1,_0x6683('0x66'),_0x6683('0x67'));_0x4193d1['VoicePrefixId']=_0x198c27['id'];return db['VoiceExtension'][_0x6683('0x53')](_0x4193d1,{'transaction':_0x609020})[_0x6683('0x2a')](function(_0x41ce7f){var _0x40a92b=_0x41ce7f[_0x6683('0x2b')]({'plain':!![]});var _0x379d34=_[_0x6683('0x33')](addVoicePrefixExtensions(_0x198c27,_0x43aa98),function(_0x3a93a7){_0x3a93a7[_0x6683('0x56')]=_0x40a92b['id'];_0x3a93a7[_0x6683('0x68')]=_0x198c27['id'];return _0x3a93a7;});return db[_0x6683('0x69')][_0x6683('0x6a')](_0x379d34,{'transaction':_0x609020})[_0x6683('0x2a')](function(_0x3a2428){if(!_0x3a2428){return _0x516726(_0x6683('0x6b'));}else{return _0x44bf65(_0x3a2428);}})[_0x6683('0x4e')](function(_0x346900){return _0x516726(_0x346900);});});;});};function addVoicePrefixExtensions(_0x340f72,_0x3b29cf){var _0x17b45a=[];var _0x5e0e10=formatPrefixName(_0x340f72['prefix']);_0x17b45a['push'](new Extension(_0x5e0e10,0x2,_0x6683('0x6c'),_0x6683('0x6d')+_0x340f72[_0x6683('0x30')]));if(_0x340f72['callerIdAll']){_0x17b45a[_0x6683('0x6e')](new Extension(_0x5e0e10,0x3,_0x6683('0x6c'),'PREFIX-CALLERIDALL='+_0x340f72[_0x6683('0x6f')]));}else{_0x17b45a[_0x6683('0x6e')](new Extension(_0x5e0e10,0x3,'NoOp','No\x20callerid\x20available'));}_0x17b45a[_0x6683('0x6e')](new Extension(_0x5e0e10,0x4,_0x6683('0x70'),_0x3b29cf['context']+','+_0x6683('0x71')+(0x8+_0x340f72['name'][_0x6683('0x40')])+'}'+','+0x1));return _0x17b45a;}function formatPrefixName(_0x551a40){var _0x12354f='_';for(var _0x5da435=0x0;_0x5da435<_0x551a40[_0x6683('0x40')];_0x5da435++){if(_0x551a40['charAt'](_0x5da435)=='-'){_0x12354f+=_0x551a40[_0x6683('0x72')](_0x5da435);}else{_0x12354f+='['+_0x551a40[_0x6683('0x72')](_0x5da435)+']';}}_0x12354f+='.';return _0x12354f;}exports[_0x6683('0x29')]=function(_0x4ba4c6,_0x4d1631,_0x4748af){var _0x3576f9=_0x4ba4c6[_0x6683('0x73')];_0x3576f9[_0x6683('0x65')]=_0x6683('0x74')+_0x3576f9[_0x6683('0x30')]+'-';return db[_0x6683('0x54')][_0x6683('0x55')](function(_0x55f434){return db[_0x6683('0x34')]['update'](_0x3576f9,{'where':{'id':_0x3576f9['id']},'transaction':_0x55f434})[_0x6683('0x2a')](function(){return db[_0x6683('0x69')]['destroy']({'where':{'VoicePrefixId':_0x3576f9['id']},'transaction':_0x55f434})[_0x6683('0x2a')](function(){return db[_0x6683('0x69')][_0x6683('0x51')]({'where':{'id':_0x3576f9[_0x6683('0x56')]},'raw':!![]})[_0x6683('0x2a')](function(_0x2aca23){return createVoicePrefixExtensions(_0x3576f9,_0x2aca23,_0x55f434);});});});})[_0x6683('0x2a')](function(){return db[_0x6683('0x34')]['findById'](_0x3576f9['id']);})['then'](respondWithResult(_0x4d1631,null))['catch'](handleError(_0x4d1631,null));};exports[_0x6683('0x75')]=function(_0x549cf4,_0x1db250,_0x59d1a6){return db[_0x6683('0x34')]['find']({'where':{'id':_0x549cf4[_0x6683('0x50')]['id']}})['then'](handleEntityNotFound(_0x1db250,null))[_0x6683('0x2a')](function(_0x56a9ea){if(_0x56a9ea){return _0x56a9ea[_0x6683('0x75')](_0x549cf4[_0x6683('0x73')][_0x6683('0x76')],_['omit'](_0x549cf4[_0x6683('0x73')],[_0x6683('0x76'),'id'])||{})['spread'](function(_0x55b2cf){for(var _0x58bcb6=0x0;_0x58bcb6<_0x549cf4[_0x6683('0x73')][_0x6683('0x76')][_0x6683('0x40')];_0x58bcb6+=0x1){socket[_0x6683('0x77')]('userVoicePrefix:save',{'UserId':Number(_0x549cf4[_0x6683('0x73')][_0x6683('0x76')][_0x58bcb6]),'VoicePrefixId':Number(_0x549cf4[_0x6683('0x50')]['id'])});}return _0x55b2cf;});}})[_0x6683('0x2a')](respondWithResult(_0x1db250,null))['catch'](handleError(_0x1db250,null));};exports[_0x6683('0x78')]=function(_0x519ce8,_0x3e0690,_0x2b8724){return db[_0x6683('0x34')][_0x6683('0x51')]({'where':{'id':_0x519ce8[_0x6683('0x50')]['id']}})[_0x6683('0x2a')](handleEntityNotFound(_0x3e0690,null))[_0x6683('0x2a')](function(_0x435eb3){if(_0x435eb3){return _0x435eb3['removeAgents'](_0x519ce8[_0x6683('0x3a')][_0x6683('0x76')])[_0x6683('0x2a')](function(){if(_[_0x6683('0x79')](_0x519ce8[_0x6683('0x3a')][_0x6683('0x76')])){for(var _0x4e38d0=0x0;_0x4e38d0<_0x519ce8['query'][_0x6683('0x76')][_0x6683('0x40')];_0x4e38d0+=0x1){socket[_0x6683('0x77')](_0x6683('0x7a'),{'UserId':Number(_0x519ce8[_0x6683('0x3a')][_0x6683('0x76')][_0x4e38d0]),'VoicePrefixId':Number(_0x519ce8[_0x6683('0x50')]['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x519ce8[_0x6683('0x3a')][_0x6683('0x76')]),'VoicePrefixId':Number(_0x519ce8['params']['id'])});}});}})[_0x6683('0x2a')](respondWithStatusCode(_0x3e0690,null))['catch'](handleError(_0x3e0690,null));};exports['getAgents']=function(_0x5a7a2d,_0x57694b,_0x43155b){var _0x51a122={};var _0x4cd707={};var _0x6f4a8;var _0x54aab6;return db[_0x6683('0x34')][_0x6683('0x7b')]({'where':{'id':_0x5a7a2d['params']['id']}})['then'](handleEntityNotFound(_0x57694b,null))['then'](function(_0x22273d){if(_0x22273d){_0x6f4a8=_0x22273d;_0x4cd707[_0x6683('0x39')]=_[_0x6683('0x3b')](db[_0x6683('0x7c')][_0x6683('0x35')]);_0x4cd707['query']=_['keys'](_0x5a7a2d[_0x6683('0x3a')]);_0x4cd707['filters']=_['intersection'](_0x4cd707['model'],_0x4cd707[_0x6683('0x3a')]);_0x51a122[_0x6683('0x3d')]=_[_0x6683('0x3e')](_0x4cd707[_0x6683('0x39')],qs['fields'](_0x5a7a2d[_0x6683('0x3a')][_0x6683('0x3f')]));_0x51a122[_0x6683('0x3d')]=_0x51a122['attributes'][_0x6683('0x40')]?_0x51a122['attributes']:_0x4cd707[_0x6683('0x39')];_0x51a122[_0x6683('0x42')]=qs[_0x6683('0x43')](_0x5a7a2d[_0x6683('0x3a')][_0x6683('0x43')]);_0x51a122[_0x6683('0x44')]=qs[_0x6683('0x3c')](_[_0x6683('0x45')](_0x5a7a2d[_0x6683('0x3a')],_0x4cd707[_0x6683('0x3c')]));if(_0x5a7a2d[_0x6683('0x3a')][_0x6683('0x46')]){_0x51a122[_0x6683('0x44')]=_[_0x6683('0x47')](_0x51a122[_0x6683('0x44')],{'$or':_['map'](_0x51a122[_0x6683('0x3d')],function(_0x41fb3a){var _0x673d3f={};_0x673d3f[_0x41fb3a]={'$like':'%'+_0x5a7a2d[_0x6683('0x3a')][_0x6683('0x46')]+'%'};return _0x673d3f;})});}_0x51a122=_[_0x6683('0x47')]({},_0x51a122,_0x5a7a2d[_0x6683('0x49')]);return _0x6f4a8[_0x6683('0x7d')](_0x51a122);}})[_0x6683('0x2a')](function(_0x5cb7dc){if(_0x5cb7dc){_0x54aab6=_0x5cb7dc[_0x6683('0x40')];if(!_0x5a7a2d[_0x6683('0x3a')][_0x6683('0x7e')](_0x6683('0x41'))){_0x51a122['limit']=qs[_0x6683('0x22')](_0x5a7a2d['query'][_0x6683('0x22')]);_0x51a122[_0x6683('0x20')]=qs[_0x6683('0x20')](_0x5a7a2d[_0x6683('0x3a')][_0x6683('0x20')]);}return _0x6f4a8[_0x6683('0x7d')](_0x51a122);}})[_0x6683('0x2a')](function(_0x5c405b){if(_0x5c405b){return _0x5c405b?{'count':_0x54aab6,'rows':_0x5c405b}:null;}})[_0x6683('0x2a')](respondWithResult(_0x57694b,null))[_0x6683('0x4e')](handleError(_0x57694b,null));}; \ No newline at end of file +var _0xe3d4=['error','name','index','VoicePrefix','rawAttributes','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','UserProfileResource','context','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','push','callerIdAll','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','omit','spread','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','findOne','User','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then','get','VoicePrefixes','destroy'];(function(_0x29fd78,_0x1d66d2){var _0x44ad0e=function(_0x10ede4){while(--_0x10ede4){_0x29fd78['push'](_0x29fd78['shift']());}};_0x44ad0e(++_0x1d66d2);}(_0xe3d4,0xc6));var _0x4e3d=function(_0x71185f,_0x371d74){_0x71185f=_0x71185f-0x0;var _0x160ffe=_0xe3d4[_0x71185f];return _0x160ffe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4e3d('0x0'));var zipdir=require(_0x4e3d('0x1'));var jsonpatch=require(_0x4e3d('0x2'));var rp=require('request-promise');var moment=require(_0x4e3d('0x3'));var BPromise=require(_0x4e3d('0x4'));var Mustache=require('mustache');var util=require(_0x4e3d('0x5'));var path=require('path');var sox=require(_0x4e3d('0x6'));var csv=require(_0x4e3d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4e3d('0x8'));var _=require(_0x4e3d('0x9'));var squel=require('squel');var crypto=require(_0x4e3d('0xa'));var jsforce=require(_0x4e3d('0xb'));var deskjs=require(_0x4e3d('0xc'));var toCsv=require(_0x4e3d('0x7'));var querystring=require(_0x4e3d('0xd'));var Papa=require(_0x4e3d('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4e3d('0xf'));var as=require(_0x4e3d('0x10'));var hardwareService=require(_0x4e3d('0x11'));var logger=require(_0x4e3d('0x12'))(_0x4e3d('0x13'));var utils=require(_0x4e3d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4e3d('0x15'));var db=require(_0x4e3d('0x16'))['db'];config[_0x4e3d('0x17')]=_[_0x4e3d('0x18')](config[_0x4e3d('0x17')],{'host':_0x4e3d('0x19'),'port':0x18eb});var socket=require(_0x4e3d('0x1a'))(new Redis(config[_0x4e3d('0x17')]));require('./voicePrefix.socket')[_0x4e3d('0x1b')](socket);function respondWithStatusCode(_0x4325b4,_0x3b7b45){_0x3b7b45=_0x3b7b45||0xcc;return function(_0x5e0d2c){if(_0x5e0d2c){return _0x4325b4[_0x4e3d('0x1c')](_0x3b7b45);}return _0x4325b4[_0x4e3d('0x1d')](_0x3b7b45)[_0x4e3d('0x1e')]();};}function respondWithResult(_0xc20768,_0x1b829e){_0x1b829e=_0x1b829e||0xc8;return function(_0x364798){if(_0x364798){return _0xc20768[_0x4e3d('0x1d')](_0x1b829e)[_0x4e3d('0x1f')](_0x364798);}};}function respondWithFilteredResult(_0x554ba6,_0x2aab75){return function(_0x5129d5){if(_0x5129d5){var _0x4b74cb=typeof _0x2aab75[_0x4e3d('0x20')]==='undefined'&&typeof _0x2aab75['limit']===_0x4e3d('0x21');var _0x2e37ad=_0x5129d5[_0x4e3d('0x22')];var _0x318bd4=_0x4b74cb?0x0:_0x2aab75['offset'];var _0x35d75c=_0x4b74cb?_0x5129d5['count']:_0x2aab75[_0x4e3d('0x20')]+_0x2aab75['limit'];var _0x170f88;if(_0x35d75c>=_0x2e37ad){_0x35d75c=_0x2e37ad;_0x170f88=0xc8;}else{_0x170f88=0xce;}_0x554ba6[_0x4e3d('0x1d')](_0x170f88);return _0x554ba6[_0x4e3d('0x23')](_0x4e3d('0x24'),_0x318bd4+'-'+_0x35d75c+'/'+_0x2e37ad)[_0x4e3d('0x1f')](_0x5129d5);}return null;};}function patchUpdates(_0x2c8186){return function(_0x575c72){try{jsonpatch['apply'](_0x575c72,_0x2c8186,!![]);}catch(_0x18271a){return BPromise[_0x4e3d('0x25')](_0x18271a);}return _0x575c72[_0x4e3d('0x26')]();};}function saveUpdates(_0x49301f,_0x3e6b53){return function(_0x58a9cb){if(_0x58a9cb){return _0x58a9cb[_0x4e3d('0x27')](_0x49301f)[_0x4e3d('0x28')](function(_0x43bc1b){return _0x43bc1b;});}return null;};}function removeEntity(_0x50d9db,_0x2434ea){return function(_0xa6569b){if(_0xa6569b){return _0xa6569b['destroy']()[_0x4e3d('0x28')](function(){var _0x21d7e4=_0xa6569b[_0x4e3d('0x29')]({'plain':!![]});var _0x4a7820=_0x4e3d('0x2a');return db['UserProfileResource'][_0x4e3d('0x2b')]({'where':{'type':_0x4a7820,'resourceId':_0x21d7e4['id']}})['then'](function(){return _0xa6569b;});})[_0x4e3d('0x28')](function(){_0x50d9db[_0x4e3d('0x1d')](0xcc)[_0x4e3d('0x1e')]();});}};}function handleEntityNotFound(_0x4dfc6b,_0x2c5935){return function(_0x9133f9){if(!_0x9133f9){_0x4dfc6b['sendStatus'](0x194);}return _0x9133f9;};}function handleError(_0x57816d,_0x27983d){_0x27983d=_0x27983d||0x1f4;return function(_0x333fff){logger[_0x4e3d('0x2c')](_0x333fff['stack']);if(_0x333fff[_0x4e3d('0x2d')]){delete _0x333fff[_0x4e3d('0x2d')];}_0x57816d['status'](_0x27983d)['send'](_0x333fff);};}exports[_0x4e3d('0x2e')]=function(_0x21c9d1,_0x575957){var _0xefeafa={},_0x521cb5={},_0x2b00f6={'count':0x0,'rows':[]};var _0x14853f=_['map'](db[_0x4e3d('0x2f')][_0x4e3d('0x30')],function(_0x199070){return{'name':_0x199070['fieldName'],'type':_0x199070[_0x4e3d('0x31')][_0x4e3d('0x32')]};});_0x521cb5['model']=_[_0x4e3d('0x33')](_0x14853f,_0x4e3d('0x2d'));_0x521cb5['query']=_[_0x4e3d('0x34')](_0x21c9d1[_0x4e3d('0x35')]);_0x521cb5[_0x4e3d('0x36')]=_[_0x4e3d('0x37')](_0x521cb5[_0x4e3d('0x38')],_0x521cb5[_0x4e3d('0x35')]);_0xefeafa[_0x4e3d('0x39')]=_[_0x4e3d('0x37')](_0x521cb5[_0x4e3d('0x38')],qs[_0x4e3d('0x3a')](_0x21c9d1[_0x4e3d('0x35')]['fields']));_0xefeafa[_0x4e3d('0x39')]=_0xefeafa[_0x4e3d('0x39')][_0x4e3d('0x3b')]?_0xefeafa[_0x4e3d('0x39')]:_0x521cb5[_0x4e3d('0x38')];if(!_0x21c9d1[_0x4e3d('0x35')]['hasOwnProperty'](_0x4e3d('0x3c'))){_0xefeafa[_0x4e3d('0x3d')]=qs[_0x4e3d('0x3d')](_0x21c9d1[_0x4e3d('0x35')][_0x4e3d('0x3d')]);_0xefeafa[_0x4e3d('0x20')]=qs[_0x4e3d('0x20')](_0x21c9d1[_0x4e3d('0x35')][_0x4e3d('0x20')]);}_0xefeafa[_0x4e3d('0x3e')]=qs[_0x4e3d('0x3f')](_0x21c9d1[_0x4e3d('0x35')][_0x4e3d('0x3f')]);_0xefeafa[_0x4e3d('0x40')]=qs[_0x4e3d('0x36')](_['pick'](_0x21c9d1[_0x4e3d('0x35')],_0x521cb5['filters']),_0x14853f);if(_0x21c9d1[_0x4e3d('0x35')][_0x4e3d('0x41')]){_0xefeafa[_0x4e3d('0x40')]=_[_0x4e3d('0x42')](_0xefeafa[_0x4e3d('0x40')],{'$or':_[_0x4e3d('0x33')](_0x14853f,function(_0x501d59){if(_0x501d59[_0x4e3d('0x31')]!==_0x4e3d('0x43')){var _0x452451={};_0x452451[_0x501d59[_0x4e3d('0x2d')]]={'$like':'%'+_0x21c9d1[_0x4e3d('0x35')]['filter']+'%'};return _0x452451;}})});}_0xefeafa=_['merge']({},_0xefeafa,_0x21c9d1[_0x4e3d('0x44')]);var _0x146227={'where':_0xefeafa[_0x4e3d('0x40')]};return db['VoicePrefix'][_0x4e3d('0x22')](_0x146227)[_0x4e3d('0x28')](function(_0x572134){_0x2b00f6[_0x4e3d('0x22')]=_0x572134;if(_0x21c9d1['query'][_0x4e3d('0x45')]){_0xefeafa[_0x4e3d('0x46')]=[{'all':!![]}];}return db[_0x4e3d('0x2f')]['findAll'](_0xefeafa);})[_0x4e3d('0x28')](function(_0x523c2b){_0x2b00f6[_0x4e3d('0x47')]=_0x523c2b;return _0x2b00f6;})[_0x4e3d('0x28')](respondWithFilteredResult(_0x575957,_0xefeafa))[_0x4e3d('0x48')](handleError(_0x575957,null));};exports['show']=function(_0x1f34b6,_0x29ca44){var _0x2dd481={'raw':![],'where':{'id':_0x1f34b6[_0x4e3d('0x49')]['id']}},_0x8e807d={};_0x8e807d[_0x4e3d('0x38')]=_[_0x4e3d('0x34')](db[_0x4e3d('0x2f')][_0x4e3d('0x30')]);_0x8e807d[_0x4e3d('0x35')]=_['keys'](_0x1f34b6[_0x4e3d('0x35')]);_0x8e807d[_0x4e3d('0x36')]=_[_0x4e3d('0x37')](_0x8e807d[_0x4e3d('0x38')],_0x8e807d[_0x4e3d('0x35')]);_0x2dd481[_0x4e3d('0x39')]=_[_0x4e3d('0x37')](_0x8e807d[_0x4e3d('0x38')],qs[_0x4e3d('0x3a')](_0x1f34b6[_0x4e3d('0x35')][_0x4e3d('0x3a')]));_0x2dd481[_0x4e3d('0x39')]=_0x2dd481['attributes']['length']?_0x2dd481[_0x4e3d('0x39')]:_0x8e807d['model'];if(_0x1f34b6[_0x4e3d('0x35')][_0x4e3d('0x45')]){_0x2dd481[_0x4e3d('0x46')]=[{'all':!![]}];}_0x2dd481=_[_0x4e3d('0x42')]({},_0x2dd481,_0x1f34b6[_0x4e3d('0x44')]);return db['VoicePrefix'][_0x4e3d('0x4a')](_0x2dd481)[_0x4e3d('0x28')](handleEntityNotFound(_0x29ca44,null))['then'](respondWithResult(_0x29ca44,null))['catch'](handleError(_0x29ca44,null));};exports['destroy']=function(_0x5e1f2e,_0x393854){return db[_0x4e3d('0x2f')][_0x4e3d('0x4a')]({'where':{'id':_0x5e1f2e[_0x4e3d('0x49')]['id']}})[_0x4e3d('0x28')](handleEntityNotFound(_0x393854,null))[_0x4e3d('0x28')](removeEntity(_0x393854,null))[_0x4e3d('0x48')](handleError(_0x393854,null));};exports['describe']=function(_0x2ca8b5,_0x1aead6){return db[_0x4e3d('0x2f')][_0x4e3d('0x4b')]()['then'](respondWithResult(_0x1aead6,null))[_0x4e3d('0x48')](handleError(_0x1aead6,null));};exports[_0x4e3d('0x4c')]=function(_0x433c70,_0x17683d){var _0x4b074a;return db[_0x4e3d('0x4d')][_0x4e3d('0x4e')](function(_0x16f081){return db['VoicePrefix'][_0x4e3d('0x4c')](_0x433c70[_0x4e3d('0x4f')],{'transaction':_0x16f081})['then'](function(_0x5c1783){_0x4b074a=_0x5c1783[_0x4e3d('0x29')]({'plain':!![]});return db[_0x4e3d('0x50')][_0x4e3d('0x4a')]({'where':{'id':_0x4b074a[_0x4e3d('0x51')]},'raw':!![]})[_0x4e3d('0x28')](function(_0x490d8e){return createVoicePrefixExtensions(_0x4b074a,_0x490d8e,_0x16f081);});});})['then'](function(){var _0x1f6e6d=_0x433c70['user'][_0x4e3d('0x29')]({'plain':!![]});if(!_0x1f6e6d)throw new Error(_0x4e3d('0x52'));if(_0x1f6e6d['role']===_0x4e3d('0x53')){var _0x392003=_0x4b074a;return db['UserProfileSection'][_0x4e3d('0x4a')]({'where':{'name':'VoicePrefixes','userProfileId':_0x1f6e6d[_0x4e3d('0x54')]},'raw':!![]})[_0x4e3d('0x28')](function(_0x1dbef0){if(_0x1dbef0&&_0x1dbef0['autoAssociation']===0x0){return db[_0x4e3d('0x55')]['create']({'name':_0x392003['name'],'resourceId':_0x392003['id'],'type':_0x1dbef0[_0x4e3d('0x2d')],'sectionId':_0x1dbef0['id']},{})[_0x4e3d('0x28')](function(){return _0x4b074a;});}else{return _0x4b074a;}})[_0x4e3d('0x48')](function(_0x30cbb0){logger[_0x4e3d('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x30cbb0);throw _0x30cbb0;});}return _0x4b074a;})[_0x4e3d('0x28')](respondWithResult(_0x17683d,null))['catch'](handleError(_0x17683d,null));};function Extension(_0x55c001,_0x515c9b,_0x5b7d99,_0x2958ca){this[_0x4e3d('0x56')]=_0x4e3d('0x57');this[_0x4e3d('0x58')]=_0x55c001;this[_0x4e3d('0x59')]=_0x5b7d99;this[_0x4e3d('0x31')]=_0x4e3d('0x5a');this[_0x4e3d('0x5b')]=_0x4e3d('0x5c');this['priority']=_0x515c9b;this[_0x4e3d('0x5d')]=_0x2958ca;}function createVoicePrefixExtensions(_0xde4cff,_0x1e983a,_0x53ab18){return new BPromise(function(_0x5f150a,_0xdf0610){var _0x62e7a4=new Extension(formatPrefixName(_0xde4cff[_0x4e3d('0x5e')]),0x1,_0x4e3d('0x5f'),_0x4e3d('0x60'));_0x62e7a4[_0x4e3d('0x61')]=_0xde4cff['id'];return db[_0x4e3d('0x50')][_0x4e3d('0x4c')](_0x62e7a4,{'transaction':_0x53ab18})[_0x4e3d('0x28')](function(_0x1530d1){var _0x45095f=_0x1530d1['get']({'plain':!![]});var _0x1bb8cf=_[_0x4e3d('0x33')](addVoicePrefixExtensions(_0xde4cff,_0x1e983a),function(_0x3d069f){_0x3d069f['VoiceExtensionId']=_0x45095f['id'];_0x3d069f[_0x4e3d('0x61')]=_0xde4cff['id'];return _0x3d069f;});return db[_0x4e3d('0x50')][_0x4e3d('0x62')](_0x1bb8cf,{'transaction':_0x53ab18})[_0x4e3d('0x28')](function(_0x1f47eb){if(!_0x1f47eb){return _0xdf0610(_0x4e3d('0x63'));}else{return _0x5f150a(_0x1f47eb);}})['catch'](function(_0xcf666b){return _0xdf0610(_0xcf666b);});});;});};function addVoicePrefixExtensions(_0x2d527f,_0x4e26ff){var _0xc2acc4=[];var _0x3839e0=formatPrefixName(_0x2d527f['prefix']);_0xc2acc4['push'](new Extension(_0x3839e0,0x2,_0x4e3d('0x64'),_0x4e3d('0x65')+_0x2d527f[_0x4e3d('0x2d')]));if(_0x2d527f['callerIdAll']){_0xc2acc4[_0x4e3d('0x66')](new Extension(_0x3839e0,0x3,'Set','PREFIX-CALLERIDALL='+_0x2d527f[_0x4e3d('0x67')]));}else{_0xc2acc4[_0x4e3d('0x66')](new Extension(_0x3839e0,0x3,'NoOp','No\x20callerid\x20available'));}_0xc2acc4[_0x4e3d('0x66')](new Extension(_0x3839e0,0x4,_0x4e3d('0x68'),_0x4e26ff[_0x4e3d('0x56')]+','+_0x4e3d('0x69')+(0x8+_0x2d527f[_0x4e3d('0x2d')][_0x4e3d('0x3b')])+'}'+','+0x1));return _0xc2acc4;}function formatPrefixName(_0x272382){var _0x597ec0='_';for(var _0x32a969=0x0;_0x32a969<_0x272382[_0x4e3d('0x3b')];_0x32a969++){if(_0x272382[_0x4e3d('0x6a')](_0x32a969)=='-'){_0x597ec0+=_0x272382[_0x4e3d('0x6a')](_0x32a969);}else{_0x597ec0+='['+_0x272382['charAt'](_0x32a969)+']';}}_0x597ec0+='.';return _0x597ec0;}exports['update']=function(_0x41f6db,_0x1a70d6,_0x10bb8f){var _0x160d3f=_0x41f6db[_0x4e3d('0x4f')];_0x160d3f[_0x4e3d('0x5e')]=_0x4e3d('0x6b')+_0x160d3f['name']+'-';return db[_0x4e3d('0x4d')][_0x4e3d('0x4e')](function(_0x29c290){return db[_0x4e3d('0x2f')][_0x4e3d('0x27')](_0x160d3f,{'where':{'id':_0x160d3f['id']},'transaction':_0x29c290})[_0x4e3d('0x28')](function(){return db[_0x4e3d('0x50')][_0x4e3d('0x2b')]({'where':{'VoicePrefixId':_0x160d3f['id']},'transaction':_0x29c290})[_0x4e3d('0x28')](function(){return db[_0x4e3d('0x50')][_0x4e3d('0x4a')]({'where':{'id':_0x160d3f[_0x4e3d('0x51')]},'raw':!![]})[_0x4e3d('0x28')](function(_0x35c824){return createVoicePrefixExtensions(_0x160d3f,_0x35c824,_0x29c290);});});});})['then'](function(){return db[_0x4e3d('0x2f')][_0x4e3d('0x6c')](_0x160d3f['id']);})[_0x4e3d('0x28')](respondWithResult(_0x1a70d6,null))['catch'](handleError(_0x1a70d6,null));};exports[_0x4e3d('0x6d')]=function(_0x373566,_0x1b45b9,_0x17b8a0){return db[_0x4e3d('0x2f')][_0x4e3d('0x4a')]({'where':{'id':_0x373566[_0x4e3d('0x49')]['id']}})[_0x4e3d('0x28')](handleEntityNotFound(_0x1b45b9,null))[_0x4e3d('0x28')](function(_0x577bfc){if(_0x577bfc){return _0x577bfc[_0x4e3d('0x6d')](_0x373566[_0x4e3d('0x4f')][_0x4e3d('0x6e')],_[_0x4e3d('0x6f')](_0x373566['body'],['ids','id'])||{})[_0x4e3d('0x70')](function(_0xc33deb){for(var _0x268297=0x0;_0x268297<_0x373566['body'][_0x4e3d('0x6e')][_0x4e3d('0x3b')];_0x268297+=0x1){socket['emit'](_0x4e3d('0x71'),{'UserId':Number(_0x373566[_0x4e3d('0x4f')][_0x4e3d('0x6e')][_0x268297]),'VoicePrefixId':Number(_0x373566[_0x4e3d('0x49')]['id'])});}return _0xc33deb;});}})['then'](respondWithResult(_0x1b45b9,null))['catch'](handleError(_0x1b45b9,null));};exports['removeAgents']=function(_0x363f71,_0x5895f7,_0x5a26a6){return db['VoicePrefix'][_0x4e3d('0x4a')]({'where':{'id':_0x363f71[_0x4e3d('0x49')]['id']}})[_0x4e3d('0x28')](handleEntityNotFound(_0x5895f7,null))[_0x4e3d('0x28')](function(_0x342098){if(_0x342098){return _0x342098[_0x4e3d('0x72')](_0x363f71[_0x4e3d('0x35')][_0x4e3d('0x6e')])[_0x4e3d('0x28')](function(){if(_[_0x4e3d('0x73')](_0x363f71['query'][_0x4e3d('0x6e')])){for(var _0x2e8f57=0x0;_0x2e8f57<_0x363f71[_0x4e3d('0x35')][_0x4e3d('0x6e')][_0x4e3d('0x3b')];_0x2e8f57+=0x1){socket[_0x4e3d('0x74')](_0x4e3d('0x75'),{'UserId':Number(_0x363f71[_0x4e3d('0x35')]['ids'][_0x2e8f57]),'VoicePrefixId':Number(_0x363f71[_0x4e3d('0x49')]['id'])});}}else{socket[_0x4e3d('0x74')](_0x4e3d('0x75'),{'UserId':Number(_0x363f71[_0x4e3d('0x35')]['ids']),'VoicePrefixId':Number(_0x363f71[_0x4e3d('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x5895f7,null))[_0x4e3d('0x48')](handleError(_0x5895f7,null));};exports[_0x4e3d('0x76')]=function(_0x3a3ebc,_0x2ceb09,_0xb3f80e){var _0x202805={};var _0x42a7b0={};var _0x29e020;var _0x2b15a5;return db[_0x4e3d('0x2f')][_0x4e3d('0x77')]({'where':{'id':_0x3a3ebc[_0x4e3d('0x49')]['id']}})[_0x4e3d('0x28')](handleEntityNotFound(_0x2ceb09,null))[_0x4e3d('0x28')](function(_0x14f259){if(_0x14f259){_0x29e020=_0x14f259;_0x42a7b0[_0x4e3d('0x38')]=_[_0x4e3d('0x34')](db[_0x4e3d('0x78')][_0x4e3d('0x30')]);_0x42a7b0[_0x4e3d('0x35')]=_[_0x4e3d('0x34')](_0x3a3ebc[_0x4e3d('0x35')]);_0x42a7b0[_0x4e3d('0x36')]=_[_0x4e3d('0x37')](_0x42a7b0[_0x4e3d('0x38')],_0x42a7b0[_0x4e3d('0x35')]);_0x202805[_0x4e3d('0x39')]=_[_0x4e3d('0x37')](_0x42a7b0['model'],qs['fields'](_0x3a3ebc[_0x4e3d('0x35')][_0x4e3d('0x3a')]));_0x202805[_0x4e3d('0x39')]=_0x202805[_0x4e3d('0x39')][_0x4e3d('0x3b')]?_0x202805[_0x4e3d('0x39')]:_0x42a7b0[_0x4e3d('0x38')];_0x202805[_0x4e3d('0x3e')]=qs[_0x4e3d('0x3f')](_0x3a3ebc[_0x4e3d('0x35')][_0x4e3d('0x3f')]);_0x202805[_0x4e3d('0x40')]=qs[_0x4e3d('0x36')](_['pick'](_0x3a3ebc['query'],_0x42a7b0['filters']));if(_0x3a3ebc[_0x4e3d('0x35')][_0x4e3d('0x41')]){_0x202805['where']=_['merge'](_0x202805[_0x4e3d('0x40')],{'$or':_[_0x4e3d('0x33')](_0x202805[_0x4e3d('0x39')],function(_0x448716){var _0x5549e9={};_0x5549e9[_0x448716]={'$like':'%'+_0x3a3ebc['query']['filter']+'%'};return _0x5549e9;})});}_0x202805=_[_0x4e3d('0x42')]({},_0x202805,_0x3a3ebc[_0x4e3d('0x44')]);return _0x29e020[_0x4e3d('0x76')](_0x202805);}})[_0x4e3d('0x28')](function(_0x5ad2e3){if(_0x5ad2e3){_0x2b15a5=_0x5ad2e3['length'];if(!_0x3a3ebc[_0x4e3d('0x35')]['hasOwnProperty'](_0x4e3d('0x3c'))){_0x202805['limit']=qs['limit'](_0x3a3ebc[_0x4e3d('0x35')]['limit']);_0x202805[_0x4e3d('0x20')]=qs[_0x4e3d('0x20')](_0x3a3ebc[_0x4e3d('0x35')][_0x4e3d('0x20')]);}return _0x29e020[_0x4e3d('0x76')](_0x202805);}})[_0x4e3d('0x28')](function(_0x224874){if(_0x224874){return _0x224874?{'count':_0x2b15a5,'rows':_0x224874}:null;}})[_0x4e3d('0x28')](respondWithResult(_0x2ceb09,null))['catch'](handleError(_0x2ceb09,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 9244851..5e97f12 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 _0xcafc=['hook','exports','events','../../mysqldb','VoicePrefix','save','update','remove','emit','hasOwnProperty'];(function(_0x29fd52,_0x28fe66){var _0x4683d9=function(_0x4c0e0a){while(--_0x4c0e0a){_0x29fd52['push'](_0x29fd52['shift']());}};_0x4683d9(++_0x28fe66);}(_0xcafc,0x66));var _0xccaf=function(_0x4efccf,_0x1f2bab){_0x4efccf=_0x4efccf-0x0;var _0x2c8b15=_0xcafc[_0x4efccf];return _0x2c8b15;};'use strict';var EventEmitter=require(_0xccaf('0x0'));var VoicePrefix=require(_0xccaf('0x1'))['db'][_0xccaf('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xccaf('0x3'),'afterUpdate':_0xccaf('0x4'),'afterDestroy':_0xccaf('0x5')};function emitEvent(_0x1a1982){return function(_0x2350a8,_0x1805b1,_0x11fa0e){VoicePrefixEvents[_0xccaf('0x6')](_0x1a1982+':'+_0x2350a8['id'],_0x2350a8);VoicePrefixEvents[_0xccaf('0x6')](_0x1a1982,_0x2350a8);_0x11fa0e(null);};}for(var e in events){if(events[_0xccaf('0x7')](e)){var event=events[e];VoicePrefix[_0xccaf('0x8')](e,emitEvent(event));}}module[_0xccaf('0x9')]=VoicePrefixEvents; \ No newline at end of file +var _0x22ff=['../../mysqldb','VoicePrefix','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x23652f,_0x1ee2bb){var _0x423a54=function(_0x1fb655){while(--_0x1fb655){_0x23652f['push'](_0x23652f['shift']());}};_0x423a54(++_0x1ee2bb);}(_0x22ff,0xbd));var _0xf22f=function(_0x409582,_0x1f0415){_0x409582=_0x409582-0x0;var _0xc9369d=_0x22ff[_0x409582];return _0xc9369d;};'use strict';var EventEmitter=require(_0xf22f('0x0'));var VoicePrefix=require(_0xf22f('0x1'))['db'][_0xf22f('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xf22f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf22f('0x4'),'afterDestroy':_0xf22f('0x5')};function emitEvent(_0x5ad975){return function(_0x30d87c,_0x39fac9,_0x579eba){VoicePrefixEvents[_0xf22f('0x6')](_0x5ad975+':'+_0x30d87c['id'],_0x30d87c);VoicePrefixEvents[_0xf22f('0x6')](_0x5ad975,_0x30d87c);_0x579eba(null);};}for(var e in events){if(events[_0xf22f('0x7')](e)){var event=events[e];VoicePrefix[_0xf22f('0x8')](e,emitEvent(event));}}module[_0xf22f('0x9')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index d4e241b..dad6a0e 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 _0x4f81=['VoicePrefix','voice_prefixes','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./voicePrefix.attributes','exports'];(function(_0x11eb2a,_0x4d1442){var _0x1a7dd8=function(_0x12ee2f){while(--_0x12ee2f){_0x11eb2a['push'](_0x11eb2a['shift']());}};_0x1a7dd8(++_0x4d1442);}(_0x4f81,0x18e));var _0x14f8=function(_0x330d06,_0x2cad74){_0x330d06=_0x330d06-0x0;var _0x5f5698=_0x4f81[_0x330d06];return _0x5f5698;};'use strict';var _=require(_0x14f8('0x0'));var util=require('util');var logger=require(_0x14f8('0x1'))(_0x14f8('0x2'));var moment=require('moment');var BPromise=require(_0x14f8('0x3'));var rp=require(_0x14f8('0x4'));var fs=require('fs');var path=require(_0x14f8('0x5'));var rimraf=require(_0x14f8('0x6'));var config=require('../../config/environment');var attributes=require(_0x14f8('0x7'));module[_0x14f8('0x8')]=function(_0x395227,_0x535f1b){return _0x395227['define'](_0x14f8('0x9'),attributes,{'tableName':_0x14f8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3738=['request-promise','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','voice_prefixes','lodash','util','../../config/logger'];(function(_0x5ec482,_0x1e5eac){var _0x4b3a20=function(_0x1775e1){while(--_0x1775e1){_0x5ec482['push'](_0x5ec482['shift']());}};_0x4b3a20(++_0x1e5eac);}(_0x3738,0x1ab));var _0x8373=function(_0x28c2ed,_0x1e0ca7){_0x28c2ed=_0x28c2ed-0x0;var _0x4213ec=_0x3738[_0x28c2ed];return _0x4213ec;};'use strict';var _=require(_0x8373('0x0'));var util=require(_0x8373('0x1'));var logger=require(_0x8373('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8373('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8373('0x4'));var config=require(_0x8373('0x5'));var attributes=require(_0x8373('0x6'));module[_0x8373('0x7')]=function(_0x5a524f,_0x24d718){return _0x5a524f[_0x8373('0x8')]('VoicePrefix',attributes,{'tableName':_0x8373('0x9'),'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 934d370..ec2ffed 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 _0x3fc6=['request\x20sent','debug','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s'];(function(_0x482a8b,_0x5eb44c){var _0x45c180=function(_0x4e6a76){while(--_0x4e6a76){_0x482a8b['push'](_0x482a8b['shift']());}};_0x45c180(++_0x5eb44c);}(_0x3fc6,0x115));var _0x63fc=function(_0xe1b9fa,_0xf43255){_0xe1b9fa=_0xe1b9fa-0x0;var _0x4a985e=_0x3fc6[_0xe1b9fa];return _0x4a985e;};'use strict';var _=require(_0x63fc('0x0'));var util=require('util');var moment=require(_0x63fc('0x1'));var BPromise=require(_0x63fc('0x2'));var rs=require(_0x63fc('0x3'));var fs=require('fs');var Redis=require(_0x63fc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x63fc('0x5'));var logger=require(_0x63fc('0x6'))(_0x63fc('0x7'));var config=require('../../config/environment');var jayson=require(_0x63fc('0x8'));var client=jayson['client'][_0x63fc('0x9')]({'port':0x232a});config[_0x63fc('0xa')]=_[_0x63fc('0xb')](config['redis'],{'host':_0x63fc('0xc'),'port':0x18eb});var socket=require(_0x63fc('0xd'))(new Redis(config[_0x63fc('0xa')]));require(_0x63fc('0xe'))[_0x63fc('0xf')](socket);function respondWithRpcPromise(_0x5f328c,_0x319f1e,_0x544f22){return new BPromise(function(_0x5ad9a0,_0x6b8e8f){return client[_0x63fc('0x10')](_0x5f328c,_0x544f22)[_0x63fc('0x11')](function(_0x4445ba){logger[_0x63fc('0x12')](_0x63fc('0x13'),_0x319f1e,_0x63fc('0x14'));logger[_0x63fc('0x15')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x319f1e,_0x63fc('0x14'),JSON[_0x63fc('0x16')](_0x4445ba));if(_0x4445ba[_0x63fc('0x17')]){if(_0x4445ba['error'][_0x63fc('0x18')]===0x1f4){logger[_0x63fc('0x17')](_0x63fc('0x13'),_0x319f1e,_0x4445ba['error'][_0x63fc('0x19')]);return _0x6b8e8f(_0x4445ba[_0x63fc('0x17')][_0x63fc('0x19')]);}logger[_0x63fc('0x17')](_0x63fc('0x13'),_0x319f1e,_0x4445ba[_0x63fc('0x17')][_0x63fc('0x19')]);return _0x5ad9a0(_0x4445ba[_0x63fc('0x17')][_0x63fc('0x19')]);}else{logger[_0x63fc('0x12')](_0x63fc('0x13'),_0x319f1e,_0x63fc('0x14'));_0x5ad9a0(_0x4445ba[_0x63fc('0x1a')][_0x63fc('0x19')]);}})['catch'](function(_0x225c93){logger[_0x63fc('0x17')](_0x63fc('0x13'),_0x319f1e,_0x225c93);_0x6b8e8f(_0x225c93);});});} \ No newline at end of file +var _0x7ad3=['socket.io-emitter','./voicePrefix.socket','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','client','http','redis','defaults','localhost'];(function(_0x5b95ec,_0x16e0d0){var _0x2af647=function(_0x4f7a18){while(--_0x4f7a18){_0x5b95ec['push'](_0x5b95ec['shift']());}};_0x2af647(++_0x16e0d0);}(_0x7ad3,0x108));var _0x37ad=function(_0xb1cf84,_0x813740){_0xb1cf84=_0xb1cf84-0x0;var _0x4bad2e=_0x7ad3[_0xb1cf84];return _0x4bad2e;};'use strict';var _=require(_0x37ad('0x0'));var util=require(_0x37ad('0x1'));var moment=require(_0x37ad('0x2'));var BPromise=require(_0x37ad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37ad('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x37ad('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x37ad('0x6')][_0x37ad('0x7')]({'port':0x232a});config[_0x37ad('0x8')]=_[_0x37ad('0x9')](config[_0x37ad('0x8')],{'host':_0x37ad('0xa'),'port':0x18eb});var socket=require(_0x37ad('0xb'))(new Redis(config[_0x37ad('0x8')]));require(_0x37ad('0xc'))['register'](socket);function respondWithRpcPromise(_0x6d601e,_0x5444ab,_0x5864f9){return new BPromise(function(_0x4c4bed,_0x4da3b7){return client[_0x37ad('0xd')](_0x6d601e,_0x5864f9)[_0x37ad('0xe')](function(_0x1a4487){logger[_0x37ad('0xf')](_0x37ad('0x10'),_0x5444ab,_0x37ad('0x11'));logger[_0x37ad('0x12')](_0x37ad('0x13'),_0x5444ab,_0x37ad('0x11'),JSON[_0x37ad('0x14')](_0x1a4487));if(_0x1a4487[_0x37ad('0x15')]){if(_0x1a4487['error']['code']===0x1f4){logger[_0x37ad('0x15')](_0x37ad('0x10'),_0x5444ab,_0x1a4487['error'][_0x37ad('0x16')]);return _0x4da3b7(_0x1a4487[_0x37ad('0x15')]['message']);}logger[_0x37ad('0x15')](_0x37ad('0x10'),_0x5444ab,_0x1a4487['error'][_0x37ad('0x16')]);return _0x4c4bed(_0x1a4487[_0x37ad('0x15')][_0x37ad('0x16')]);}else{logger['info'](_0x37ad('0x10'),_0x5444ab,_0x37ad('0x11'));_0x4c4bed(_0x1a4487[_0x37ad('0x17')]['message']);}})[_0x37ad('0x18')](function(_0x21927d){logger['error'](_0x37ad('0x10'),_0x5444ab,_0x21927d);_0x4da3b7(_0x21927d);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 47c166f..aa24a47 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 _0xb575=['voicePrefix:','./voicePrefix.events','save','update','emit','removeListener','register'];(function(_0x42c5a2,_0x38a2b9){var _0xbaf6e1=function(_0x357391){while(--_0x357391){_0x42c5a2['push'](_0x42c5a2['shift']());}};_0xbaf6e1(++_0x38a2b9);}(_0xb575,0xda));var _0x5b57=function(_0x2d3dcb,_0x1dee96){_0x2d3dcb=_0x2d3dcb-0x0;var _0x301f1a=_0xb575[_0x2d3dcb];return _0x301f1a;};'use strict';var VoicePrefixEvents=require(_0x5b57('0x0'));var events=[_0x5b57('0x1'),'remove',_0x5b57('0x2')];function createListener(_0x4c5b3f,_0x4a644c){return function(_0x585c94){_0x4a644c[_0x5b57('0x3')](_0x4c5b3f,_0x585c94);};}function removeListener(_0x34ae8e,_0x4b91c3){return function(){VoicePrefixEvents[_0x5b57('0x4')](_0x34ae8e,_0x4b91c3);};}exports[_0x5b57('0x5')]=function(_0x501a91){for(var _0x542b77=0x0,_0x672beb=events['length'];_0x542b77<_0x672beb;_0x542b77++){var _0x4232d0=events[_0x542b77];var _0x5dd0c7=createListener(_0x5b57('0x6')+_0x4232d0,_0x501a91);VoicePrefixEvents['on'](_0x4232d0,_0x5dd0c7);}}; \ No newline at end of file +var _0xf9bc=['save','remove','update','emit','removeListener','length','voicePrefix:'];(function(_0x111bed,_0x109f8f){var _0x578935=function(_0x1a69eb){while(--_0x1a69eb){_0x111bed['push'](_0x111bed['shift']());}};_0x578935(++_0x109f8f);}(_0xf9bc,0x7e));var _0xcf9b=function(_0x1e2746,_0x2f63ca){_0x1e2746=_0x1e2746-0x0;var _0x468807=_0xf9bc[_0x1e2746];return _0x468807;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xcf9b('0x0'),_0xcf9b('0x1'),_0xcf9b('0x2')];function createListener(_0x19ad1b,_0x2c385a){return function(_0x2dd51e){_0x2c385a[_0xcf9b('0x3')](_0x19ad1b,_0x2dd51e);};}function removeListener(_0x373f46,_0x6d522){return function(){VoicePrefixEvents[_0xcf9b('0x4')](_0x373f46,_0x6d522);};}exports['register']=function(_0x48a202){for(var _0x3595ac=0x0,_0x2ba407=events[_0xcf9b('0x5')];_0x3595ac<_0x2ba407;_0x3595ac++){var _0x2493f0=events[_0x3595ac];var _0x1ec363=createListener(_0xcf9b('0x6')+_0x2493f0,_0x48a202);VoicePrefixEvents['on'](_0x2493f0,_0x1ec363);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index fea8f31..3d2ff05 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 _0xf60c=['../../config/environment','get','index','/:id','isAuthenticated','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','getLists','getBlackLists','post','create','clone','addTeams','addAgents','/:id/lists','addLists','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1274dd,_0x21624b){var _0xc6919=function(_0xa90669){while(--_0xa90669){_0x1274dd['push'](_0x1274dd['shift']());}};_0xc6919(++_0x21624b);}(_0xf60c,0xcf));var _0xcf60=function(_0x3e33c6,_0x1f80e4){_0x3e33c6=_0x3e33c6-0x0;var _0x1190cc=_0xf60c[_0x3e33c6];return _0x1190cc;};'use strict';var multer=require(_0xcf60('0x0'));var util=require(_0xcf60('0x1'));var path=require(_0xcf60('0x2'));var timeout=require(_0xcf60('0x3'));var express=require(_0xcf60('0x4'));var router=express['Router']();var fs_extra=require(_0xcf60('0x5'));var auth=require(_0xcf60('0x6'));var interaction=require(_0xcf60('0x7'));var config=require(_0xcf60('0x8'));var controller=require('./voiceQueue.controller');router[_0xcf60('0x9')]('/',auth['isAuthenticated'](),controller[_0xcf60('0xa')]);router['get'](_0xcf60('0xb'),auth[_0xcf60('0xc')](),controller['show']);router[_0xcf60('0x9')](_0xcf60('0xd'),auth[_0xcf60('0xc')](),controller[_0xcf60('0xe')]);router[_0xcf60('0x9')]('/:id/hopper_histories',auth[_0xcf60('0xc')](),controller[_0xcf60('0xf')]);router[_0xcf60('0x9')](_0xcf60('0x10'),auth[_0xcf60('0xc')](),controller['getHopperFinals']);router[_0xcf60('0x9')](_0xcf60('0x11'),auth[_0xcf60('0xc')](),controller[_0xcf60('0x12')]);router[_0xcf60('0x9')](_0xcf60('0x13'),auth[_0xcf60('0xc')](),controller[_0xcf60('0x14')]);router['get'](_0xcf60('0x15'),auth[_0xcf60('0xc')](),controller[_0xcf60('0x16')]);router[_0xcf60('0x9')](_0xcf60('0x17'),auth[_0xcf60('0xc')](),controller[_0xcf60('0x18')]);router[_0xcf60('0x9')]('/:id/lists',auth['isAuthenticated'](),controller[_0xcf60('0x19')]);router['get']('/:id/blacklists',auth['isAuthenticated'](),controller[_0xcf60('0x1a')]);router[_0xcf60('0x1b')]('/',auth[_0xcf60('0xc')](),controller[_0xcf60('0x1c')]);router['post']('/:id/clone',auth[_0xcf60('0xc')](),controller[_0xcf60('0x1d')]);router[_0xcf60('0x1b')]('/:id/teams',auth[_0xcf60('0xc')](),controller[_0xcf60('0x1e')]);router[_0xcf60('0x1b')](_0xcf60('0x15'),auth[_0xcf60('0xc')](),controller[_0xcf60('0x1f')]);router[_0xcf60('0x1b')](_0xcf60('0x20'),auth[_0xcf60('0xc')](),controller[_0xcf60('0x21')]);router[_0xcf60('0x1b')](_0xcf60('0x22'),auth[_0xcf60('0xc')](),controller[_0xcf60('0x23')]);router['put']('/:id',auth[_0xcf60('0xc')](),controller[_0xcf60('0x24')]);router[_0xcf60('0x25')](_0xcf60('0xb'),auth['isAuthenticated'](),controller[_0xcf60('0x26')]);router[_0xcf60('0x25')](_0xcf60('0x13'),auth[_0xcf60('0xc')](),controller[_0xcf60('0x27')]);router['delete']('/:id/users',auth[_0xcf60('0xc')](),controller[_0xcf60('0x28')]);router[_0xcf60('0x25')]('/:id/lists',auth['isAuthenticated'](),controller[_0xcf60('0x29')]);router['delete'](_0xcf60('0x22'),auth['isAuthenticated'](),controller[_0xcf60('0x2a')]);module['exports']=router; \ No newline at end of file +var _0x1f8d=['/:id/blacklists','getBlackLists','post','create','clone','addTeams','addLists','put','destroy','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','express','Router','get','isAuthenticated','index','/:id','/:id/hoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','getHopperBlacks','/:id/teams','getTeams','/:id/users','/:id/members','/:id/lists'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1f8d,0x1eb));var _0xd1f8=function(_0x25886e,_0x50bb00){_0x25886e=_0x25886e-0x0;var _0x22ba74=_0x1f8d[_0x25886e];return _0x22ba74;};'use strict';var multer=require(_0xd1f8('0x0'));var util=require(_0xd1f8('0x1'));var path=require(_0xd1f8('0x2'));var timeout=require('connect-timeout');var express=require(_0xd1f8('0x3'));var router=express[_0xd1f8('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('./voiceQueue.controller');router[_0xd1f8('0x5')]('/',auth[_0xd1f8('0x6')](),controller[_0xd1f8('0x7')]);router[_0xd1f8('0x5')](_0xd1f8('0x8'),auth[_0xd1f8('0x6')](),controller['show']);router['get'](_0xd1f8('0x9'),auth[_0xd1f8('0x6')](),controller['getHoppers']);router[_0xd1f8('0x5')](_0xd1f8('0xa'),auth[_0xd1f8('0x6')](),controller[_0xd1f8('0xb')]);router[_0xd1f8('0x5')]('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0xd1f8('0xc')]);router[_0xd1f8('0x5')]('/:id/hopper_black',auth[_0xd1f8('0x6')](),controller[_0xd1f8('0xd')]);router[_0xd1f8('0x5')](_0xd1f8('0xe'),auth[_0xd1f8('0x6')](),controller[_0xd1f8('0xf')]);router[_0xd1f8('0x5')](_0xd1f8('0x10'),auth['isAuthenticated'](),controller['getAgents']);router['get'](_0xd1f8('0x11'),auth[_0xd1f8('0x6')](),controller['getMembers']);router['get'](_0xd1f8('0x12'),auth[_0xd1f8('0x6')](),controller['getLists']);router[_0xd1f8('0x5')](_0xd1f8('0x13'),auth['isAuthenticated'](),controller[_0xd1f8('0x14')]);router[_0xd1f8('0x15')]('/',auth[_0xd1f8('0x6')](),controller[_0xd1f8('0x16')]);router[_0xd1f8('0x15')]('/:id/clone',auth['isAuthenticated'](),controller[_0xd1f8('0x17')]);router[_0xd1f8('0x15')](_0xd1f8('0xe'),auth['isAuthenticated'](),controller[_0xd1f8('0x18')]);router[_0xd1f8('0x15')]('/:id/users',auth[_0xd1f8('0x6')](),controller['addAgents']);router[_0xd1f8('0x15')](_0xd1f8('0x12'),auth['isAuthenticated'](),controller[_0xd1f8('0x19')]);router[_0xd1f8('0x15')]('/:id/blacklists',auth['isAuthenticated'](),controller['addBlackLists']);router[_0xd1f8('0x1a')](_0xd1f8('0x8'),auth[_0xd1f8('0x6')](),controller['update']);router['delete'](_0xd1f8('0x8'),auth[_0xd1f8('0x6')](),controller[_0xd1f8('0x1b')]);router[_0xd1f8('0x1c')](_0xd1f8('0xe'),auth[_0xd1f8('0x6')](),controller[_0xd1f8('0x1d')]);router[_0xd1f8('0x1c')]('/:id/users',auth[_0xd1f8('0x6')](),controller[_0xd1f8('0x1e')]);router[_0xd1f8('0x1c')]('/:id/lists',auth[_0xd1f8('0x6')](),controller[_0xd1f8('0x1f')]);router[_0xd1f8('0x1c')](_0xd1f8('0x13'),auth[_0xd1f8('0x6')](),controller[_0xd1f8('0x20')]);module[_0xd1f8('0x21')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 1b7b05f..b9c07ad 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 _0xabce=['NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','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)','#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','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','default','ringall','fewestcalls','rrmemory','linear','wrandom','setDataValue','strategy','getDataValue','type','dialMethod','booked','roundrobin','progressive','INTEGER','yes','all','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','Active/Disactive\x20Campaign','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)'];(function(_0x5a7db2,_0x1f82f8){var _0x35b27d=function(_0x4c8cd3){while(--_0x4c8cd3){_0x5a7db2['push'](_0x5a7db2['shift']());}};_0x35b27d(++_0x1f82f8);}(_0xabce,0x103));var _0xeabc=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xabce[_0x2160a9];return _0xa88cf7;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'name':{'type':Sequelize[_0xeabc('0x2')],'allowNull':![],'unique':_0xeabc('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xeabc('0x4')]('inbound','outbound'),'allowNull':![],'defaultValue':_0xeabc('0x5')},'musiconhold':{'type':Sequelize[_0xeabc('0x2')],'defaultValue':_0xeabc('0x6')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xeabc('0x7'),'leastrecent',_0xeabc('0x8'),'random',_0xeabc('0x9'),_0xeabc('0xa'),_0xeabc('0xb'),'rrordered'),'allowNull':![],'defaultValue':_0xeabc('0x7'),'set':function(_0x341f16){this[_0xeabc('0xc')](_0xeabc('0xd'),_0x341f16?_0x341f16:_0xeabc('0x9'));},'get':function(){var _0x283cdf=this[_0xeabc('0xe')](_0xeabc('0xf'));var _0xdb5022=this[_0xeabc('0xe')](_0xeabc('0x10'));var _0x1c7eb0=this[_0xeabc('0xe')](_0xeabc('0xd'));if(_0x283cdf===_0xeabc('0x5')){return _0x1c7eb0;}if(_0xdb5022===_0xeabc('0x11')&&_0x1c7eb0==='rrmemory'||_0xdb5022===_0xeabc('0x11')&&_0x1c7eb0===_0xeabc('0x12')){return _0x1c7eb0;}if(_0xdb5022===_0xeabc('0x13')||_0xdb5022==='predictive'||_0xdb5022==='power'){return _0x1c7eb0;}return null;}},'servicelevel':{'type':Sequelize[_0xeabc('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xeabc('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xeabc('0x14')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xeabc('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xeabc('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xeabc('0x4')]('yes','no'),'defaultValue':_0xeabc('0x15')},'autopause':{'type':Sequelize[_0xeabc('0x4')](_0xeabc('0x15'),'no',_0xeabc('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xeabc('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0xeabc('0x4')](_0xeabc('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xeabc('0x4')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xeabc('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0xeabc('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xeabc('0x4')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xeabc('0x4')](_0xeabc('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xeabc('0x4')](_0xeabc('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xeabc('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xeabc('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xeabc('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xeabc('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0xeabc('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xeabc('0x4')](_0xeabc('0x15'),'no'),'defaultValue':_0xeabc('0x15')},'announce_holdtime':{'type':Sequelize['ENUM'](_0xeabc('0x15'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xeabc('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0xeabc('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0xeabc('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xeabc('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xeabc('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xeabc('0x2')]},'queue_youarenext':{'type':Sequelize[_0xeabc('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xeabc('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xeabc('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xeabc('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xeabc('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0xeabc('0x2')]},'queue_quantity2':{'type':Sequelize[_0xeabc('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xeabc('0x2')]},'queue_less_than':{'type':Sequelize[_0xeabc('0x2')]},'periodic_announce':{'type':Sequelize[_0xeabc('0x17')],'set':function(_0x481ee1){this[_0xeabc('0xc')](_0xeabc('0x18'),_0x481ee1?_0x481ee1[_0xeabc('0x19')](','):[]);},'get':function(){return this['getDataValue'](_0xeabc('0x18'))?this['getDataValue'](_0xeabc('0x18'))[_0xeabc('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0xeabc('0x2')],'defaultValue':_0xeabc('0x15'),'set':function(_0x73c8d4){this[_0xeabc('0xc')](_0xeabc('0x1b'),_0x73c8d4?_0x73c8d4['join'](','):undefined);},'get':function(){return this[_0xeabc('0xe')](_0xeabc('0x1b'))?this[_0xeabc('0xe')]('joinempty')[_0xeabc('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xeabc('0x2')],'defaultValue':'no','set':function(_0x4492fd){this['setDataValue'](_0xeabc('0x1c'),_0x4492fd?_0x4492fd[_0xeabc('0x19')](','):undefined);},'get':function(){return this[_0xeabc('0xe')]('leavewhenempty')?this[_0xeabc('0xe')](_0xeabc('0x1c'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0xeabc('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xeabc('0x4')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xeabc('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xeabc('0x4')](_0xeabc('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xeabc('0x2')]},'description':{'type':Sequelize[_0xeabc('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x353e48){this['setDataValue'](_0xeabc('0x1d'),_0x353e48);if(_0x353e48){if(this[_0xeabc('0xe')](_0xeabc('0x1e'))<0x2){this['setDataValue']('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0xeabc('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xeabc('0x1f')},'dialMethod':{'type':Sequelize['ENUM']('preview','progressive','power',_0xeabc('0x20'),'booked'),'defaultValue':_0xeabc('0x13'),'comment':_0xeabc('0x21')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0xeabc('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0xeabc('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xeabc('0x23')},'dialPowerLevel':{'type':Sequelize[_0xeabc('0x24')](0x2)[_0xeabc('0x22')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize['ENUM']('agentBusyFactor',_0xeabc('0x25')),'defaultValue':_0xeabc('0x25'),'comment':_0xeabc('0x26')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xeabc('0x27')},'dialPredictiveInterval':{'type':Sequelize[_0xeabc('0x14')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xeabc('0x28')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xeabc('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0xeabc('0x2')],'defaultValue':_0xeabc('0x29'),'comment':_0xeabc('0x2a')},'dialQueueTimeout':{'type':Sequelize[_0xeabc('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xeabc('0x2b')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0xeabc('0x2c')},'dialCongestionMaxRetry':{'type':Sequelize[_0xeabc('0x14')](0x3)[_0xeabc('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xeabc('0x2d')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xeabc('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xeabc('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xeabc('0x2e')},'dialBusyRetryFrequency':{'type':Sequelize[_0xeabc('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xeabc('0x2f')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xeabc('0x14')](0x3)[_0xeabc('0x22')],'defaultValue':0x3,'comment':_0xeabc('0x30')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xeabc('0x14')](0x5)[_0xeabc('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xeabc('0x31')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xeabc('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xeabc('0x32')},'dialTimezone':{'type':Sequelize[_0xeabc('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xeabc('0x2')],'defaultValue':_0xeabc('0x33')},'dialPrefix':{'type':Sequelize[_0xeabc('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xeabc('0x4')](_0xeabc('0x34'),_0xeabc('0x35'),_0xeabc('0x36')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xeabc('0x37')],'defaultValue':0x0,'comment':_0xeabc('0x38')},'dialAMDInitialSilence':{'type':Sequelize[_0xeabc('0x14')](0x9)[_0xeabc('0x22')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xeabc('0x39')},'dialAMDGreeting':{'type':Sequelize[_0xeabc('0x14')](0x9)[_0xeabc('0x22')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xeabc('0x14')](0x9)[_0xeabc('0x22')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xeabc('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xeabc('0x14')](0x9)[_0xeabc('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xeabc('0x14')](0x9)[_0xeabc('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xeabc('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xeabc('0x14')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xeabc('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xeabc('0x14')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xeabc('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xeabc('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xeabc('0x14')](0x9)[_0xeabc('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xeabc('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0xeabc('0x14')](0x5)[_0xeabc('0x22')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xeabc('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0xeabc('0x37')],'defaultValue':0x0,'comment':_0xeabc('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0xeabc('0x4')](_0xeabc('0x41'),'ASC'),'defaultValue':_0xeabc('0x41')},'dialQueueProject2':{'type':Sequelize[_0xeabc('0x2')],'comment':_0xeabc('0x2c')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xeabc('0x37')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xeabc('0x14')](0x3)[_0xeabc('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xeabc('0x42')},'dialCutDigit':{'type':Sequelize[_0xeabc('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xeabc('0x43')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xeabc('0x14')](0x3)[_0xeabc('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xeabc('0x44')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xeabc('0x14')](0x5)[_0xeabc('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xeabc('0x45')},'dialDropMaxRetry':{'type':Sequelize[_0xeabc('0x14')](0x3)[_0xeabc('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xeabc('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xeabc('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xeabc('0x46')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xeabc('0x14')](0x5)[_0xeabc('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xeabc('0x47')},'dialMachineMaxRetry':{'type':Sequelize[_0xeabc('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xeabc('0x48')},'dialMachineRetryFrequency':{'type':Sequelize[_0xeabc('0x14')](0x5)[_0xeabc('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xeabc('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xeabc('0x14')](0x3)[_0xeabc('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xeabc('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xeabc('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0xeabc('0x14')],'allowNull':!![],'comment':_0xeabc('0x4b')},'mandatoryDisposition':{'type':Sequelize[_0xeabc('0x37')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x287f88){if(!_0x287f88)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xeabc('0xc')](_0xeabc('0x4c'),_0x287f88);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xeabc('0x14')](0x3)[_0xeabc('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xeabc('0x14')](0x3)[_0xeabc('0x22')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0x53f3=['strategy','rrmemory','getDataValue','type','dialMethod','booked','roundrobin','predictive','power','INTEGER','yes','all','once','periodic_announce','join','split','joinempty','leavewhenempty','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','inbound','outbound','default','ENUM','ringall','leastrecent','fewestcalls','random','linear','wrandom','rrordered','setDataValue'];(function(_0x4ca41c,_0x392e85){var _0x2921fb=function(_0x4560e7){while(--_0x4560e7){_0x4ca41c['push'](_0x4ca41c['shift']());}};_0x2921fb(++_0x392e85);}(_0x53f3,0xe0));var _0x353f=function(_0x3e9bca,_0x28d703){_0x3e9bca=_0x3e9bca-0x0;var _0x1e2469=_0x53f3[_0x3e9bca];return _0x1e2469;};'use strict';var Sequelize=require(_0x353f('0x0'));module[_0x353f('0x1')]={'name':{'type':Sequelize[_0x353f('0x2')],'allowNull':![],'unique':_0x353f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x353f('0x4'),_0x353f('0x5')),'allowNull':![],'defaultValue':_0x353f('0x4')},'musiconhold':{'type':Sequelize[_0x353f('0x2')],'defaultValue':_0x353f('0x6')},'announce':{'type':Sequelize[_0x353f('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x353f('0x7')]('rr',_0x353f('0x8'),_0x353f('0x9'),_0x353f('0xa'),_0x353f('0xb'),'rrmemory',_0x353f('0xc'),_0x353f('0xd'),_0x353f('0xe')),'allowNull':![],'defaultValue':'ringall','set':function(_0x2f41f4){this[_0x353f('0xf')](_0x353f('0x10'),_0x2f41f4?_0x2f41f4:_0x353f('0x11'));},'get':function(){var _0x555e89=this[_0x353f('0x12')](_0x353f('0x13'));var _0xaefdb1=this[_0x353f('0x12')](_0x353f('0x14'));var _0x3afaf5=this[_0x353f('0x12')](_0x353f('0x10'));if(_0x555e89===_0x353f('0x4')){return _0x3afaf5;}if(_0xaefdb1===_0x353f('0x15')&&_0x3afaf5===_0x353f('0x11')||_0xaefdb1===_0x353f('0x15')&&_0x3afaf5===_0x353f('0x16')){return _0x3afaf5;}if(_0xaefdb1==='progressive'||_0xaefdb1===_0x353f('0x17')||_0xaefdb1===_0x353f('0x18')){return _0x3afaf5;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x353f('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x353f('0x19')](0xb)},'timeout':{'type':Sequelize[_0x353f('0x19')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x353f('0x19')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x353f('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x353f('0x19')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x353f('0x7')](_0x353f('0x1a'),'no'),'defaultValue':_0x353f('0x1a')},'autopause':{'type':Sequelize[_0x353f('0x7')](_0x353f('0x1a'),'no',_0x353f('0x1b')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x353f('0x19')](0xb)},'autopausebusy':{'type':Sequelize[_0x353f('0x7')](_0x353f('0x1a'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x353f('0x1a'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x353f('0x19')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x353f('0x1a'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x353f('0x7')](_0x353f('0x1a'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x353f('0x7')](_0x353f('0x1a'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x353f('0x7')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x353f('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x353f('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x353f('0x19')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x353f('0x1a'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x353f('0x7')](_0x353f('0x1a'),'no'),'defaultValue':_0x353f('0x1a')},'announce_holdtime':{'type':Sequelize[_0x353f('0x7')](_0x353f('0x1a'),'no',_0x353f('0x1c')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x353f('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x353f('0x1a'),'no')},'announce_position_limit':{'type':Sequelize[_0x353f('0x19')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x353f('0x7')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x353f('0x2')]},'queue_youarenext':{'type':Sequelize[_0x353f('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x353f('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x353f('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x353f('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x353f('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x353f('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x353f('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x353f('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x353f('0x2')]},'queue_quantity2':{'type':Sequelize[_0x353f('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x353f('0x2')]},'queue_less_than':{'type':Sequelize[_0x353f('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x34a0ec){this['setDataValue'](_0x353f('0x1d'),_0x34a0ec?_0x34a0ec[_0x353f('0x1e')](','):[]);},'get':function(){return this[_0x353f('0x12')]('periodic_announce')?this[_0x353f('0x12')]('periodic_announce')[_0x353f('0x1f')](','):[];}},'joinempty':{'type':Sequelize[_0x353f('0x2')],'defaultValue':'yes','set':function(_0x322893){this[_0x353f('0xf')](_0x353f('0x20'),_0x322893?_0x322893[_0x353f('0x1e')](','):undefined);},'get':function(){return this[_0x353f('0x12')](_0x353f('0x20'))?this['getDataValue'](_0x353f('0x20'))[_0x353f('0x1f')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x353f('0x2')],'defaultValue':'no','set':function(_0x224c70){this['setDataValue'](_0x353f('0x21'),_0x224c70?_0x224c70[_0x353f('0x1e')](','):undefined);},'get':function(){return this['getDataValue'](_0x353f('0x21'))?this[_0x353f('0x12')](_0x353f('0x21'))[_0x353f('0x1f')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x353f('0x7')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x353f('0x7')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x353f('0x19')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x353f('0x7')](_0x353f('0x1a'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x353f('0x2')]},'description':{'type':Sequelize[_0x353f('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x2aac66){this[_0x353f('0xf')]('acw',_0x2aac66);if(_0x2aac66){if(this['getDataValue'](_0x353f('0x22'))<0x2){this[_0x353f('0xf')](_0x353f('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x353f('0x19')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x353f('0x23')],'defaultValue':0x0,'comment':_0x353f('0x24')},'dialMethod':{'type':Sequelize[_0x353f('0x7')](_0x353f('0x25'),_0x353f('0x26'),'power',_0x353f('0x17'),'booked'),'defaultValue':'progressive','comment':_0x353f('0x27')},'dialLimitChannel':{'type':Sequelize[_0x353f('0x19')](0x4)[_0x353f('0x28')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x353f('0x29')},'dialLimitQueue':{'type':Sequelize[_0x353f('0x19')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x353f('0x2a')](0x2)[_0x353f('0x28')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x353f('0x2b')},'dialPredictiveOptimization':{'type':Sequelize[_0x353f('0x7')]('agentBusyFactor','dropRate'),'defaultValue':_0x353f('0x2c'),'comment':_0x353f('0x2d')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x353f('0x2a')](0x2)[_0x353f('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x353f('0x2e')},'dialPredictiveInterval':{'type':Sequelize[_0x353f('0x19')](0x3)[_0x353f('0x28')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x353f('0x2f')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x353f('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x353f('0x28')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x353f('0x30'),'comment':_0x353f('0x31')},'dialQueueTimeout':{'type':Sequelize[_0x353f('0x19')](0x3)[_0x353f('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x353f('0x2')],'comment':_0x353f('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0x353f('0x19')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x353f('0x19')](0x5)[_0x353f('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x353f('0x33')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x353f('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x353f('0x34')},'dialBusyRetryFrequency':{'type':Sequelize[_0x353f('0x19')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x353f('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x353f('0x19')](0x3)[_0x353f('0x28')],'defaultValue':0x3,'comment':_0x353f('0x36')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x353f('0x19')](0x5)[_0x353f('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x353f('0x37')},'dialGlobalMaxRetry':{'type':Sequelize[_0x353f('0x19')](0x3)[_0x353f('0x28')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x353f('0x38')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x353f('0x2')],'defaultValue':_0x353f('0x39')},'dialPrefix':{'type':Sequelize[_0x353f('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x353f('0x7')](_0x353f('0x3a'),_0x353f('0x3b'),_0x353f('0x3c')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x353f('0x23')],'defaultValue':0x0,'comment':_0x353f('0x3d')},'dialAMDInitialSilence':{'type':Sequelize[_0x353f('0x19')](0x9)[_0x353f('0x28')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x353f('0x19')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x353f('0x19')](0x9)[_0x353f('0x28')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x353f('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x353f('0x19')](0x9)[_0x353f('0x28')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x353f('0x19')](0x9)[_0x353f('0x28')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x353f('0x3f')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x353f('0x19')](0x9)[_0x353f('0x28')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x353f('0x19')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x353f('0x19')](0x5)[_0x353f('0x28')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x353f('0x19')](0x9)[_0x353f('0x28')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x353f('0x40')},'dialRecallMeTimeout':{'type':Sequelize[_0x353f('0x19')](0x5)[_0x353f('0x28')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x353f('0x41')},'dialRecallInQueue':{'type':Sequelize[_0x353f('0x23')],'defaultValue':0x0,'comment':_0x353f('0x42')},'dialOrderByScheduledAt':{'type':Sequelize[_0x353f('0x7')](_0x353f('0x43'),'ASC'),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x353f('0x2')],'comment':_0x353f('0x32')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x353f('0x23')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x353f('0x23')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x353f('0x19')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x353f('0x44')},'dialCutDigit':{'type':Sequelize[_0x353f('0x19')](0x3)[_0x353f('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x353f('0x19')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x353f('0x45')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x353f('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x353f('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x353f('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x353f('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x353f('0x19')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x353f('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x353f('0x19')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x353f('0x48')},'dialMachineMaxRetry':{'type':Sequelize[_0x353f('0x19')](0x3)[_0x353f('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x353f('0x49')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x353f('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x353f('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x353f('0x19')](0x3)[_0x353f('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x353f('0x4b')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x353f('0x19')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x353f('0x19')],'allowNull':!![],'comment':_0x353f('0x4c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x353f('0x4d'),'set':function(_0x498c32){if(!_0x498c32)this['setDataValue'](_0x353f('0x4e'),null);this[_0x353f('0xf')](_0x353f('0x4f'),_0x498c32);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x353f('0x19')](0x3)[_0x353f('0x28')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x353f('0x19')](0x3)[_0x353f('0x28')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 2b791ea..d147e7b 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 _0xabb0=['ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','removeAgents','addAgents','spread','isEmpty','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','into','fromQuery','phone','ContactId','ListId','field','CmListId','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','scheduledAt','ListId\x20=\x20?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','count','set','apply','save','update','destroy','then','VoiceQueues','outbound','map','value','type','find','name','UserProfileResource','stack','send','index','VoiceQueue','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','show','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','body','merge','inbound','getHoppers','CmHopper','VoiceQueueId','rows','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','Team','teams','User','Agents','online','interface','forEach','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','isNil','format','SIP/%s','voicePause','emit','userVoiceQueue:save','removeTeams','ids','select','tq.TeamId'];(function(_0x12d463,_0x579a31){var _0x33e6fd=function(_0x403942){while(--_0x403942){_0x12d463['push'](_0x12d463['shift']());}};_0x33e6fd(++_0x579a31);}(_0xabb0,0x1a5));var _0x0abb=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xabb0[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0x0abb('0x0'));var rimraf=require(_0x0abb('0x1'));var zipdir=require(_0x0abb('0x2'));var jsonpatch=require(_0x0abb('0x3'));var rp=require('request-promise');var moment=require(_0x0abb('0x4'));var BPromise=require(_0x0abb('0x5'));var Mustache=require(_0x0abb('0x6'));var util=require(_0x0abb('0x7'));var path=require(_0x0abb('0x8'));var sox=require(_0x0abb('0x9'));var csv=require(_0x0abb('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0abb('0xb'));var squel=require('squel');var crypto=require(_0x0abb('0xc'));var jsforce=require(_0x0abb('0xd'));var deskjs=require(_0x0abb('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0abb('0xf'));var Papa=require(_0x0abb('0x10'));var Redis=require(_0x0abb('0x11'));var authService=require(_0x0abb('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0abb('0x13'));var logger=require(_0x0abb('0x14'))(_0x0abb('0x15'));var utils=require(_0x0abb('0x16'));var config=require(_0x0abb('0x17'));var licenseUtil=require(_0x0abb('0x18'));var db=require(_0x0abb('0x19'))['db'];config[_0x0abb('0x1a')]=_[_0x0abb('0x1b')](config[_0x0abb('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x0abb('0x1c'))(new Redis(config[_0x0abb('0x1a')]));require('./voiceQueue.socket')[_0x0abb('0x1d')](socket);function respondWithStatusCode(_0x558749,_0x5803a6){_0x5803a6=_0x5803a6||0xcc;return function(_0xc83348){if(_0xc83348){return _0x558749[_0x0abb('0x1e')](_0x5803a6);}return _0x558749[_0x0abb('0x1f')](_0x5803a6)[_0x0abb('0x20')]();};}function respondWithResult(_0x58f293,_0x95c082){_0x95c082=_0x95c082||0xc8;return function(_0xfd1704){if(_0xfd1704){return _0x58f293['status'](_0x95c082)[_0x0abb('0x21')](_0xfd1704);}};}function respondWithFilteredResult(_0x17f960,_0x28a8bd){return function(_0x15c507){if(_0x15c507){var _0x209ba0=typeof _0x28a8bd[_0x0abb('0x22')]==='undefined'&&typeof _0x28a8bd[_0x0abb('0x23')]==='undefined';var _0x418c23=_0x15c507[_0x0abb('0x24')];var _0x1793da=_0x209ba0?0x0:_0x28a8bd['offset'];var _0x220660=_0x209ba0?_0x15c507['count']:_0x28a8bd['offset']+_0x28a8bd['limit'];var _0x241135;if(_0x220660>=_0x418c23){_0x220660=_0x418c23;_0x241135=0xc8;}else{_0x241135=0xce;}_0x17f960[_0x0abb('0x1f')](_0x241135);return _0x17f960[_0x0abb('0x25')]('Content-Range',_0x1793da+'-'+_0x220660+'/'+_0x418c23)[_0x0abb('0x21')](_0x15c507);}return null;};}function patchUpdates(_0x1be6ca){return function(_0x16a53c){try{jsonpatch[_0x0abb('0x26')](_0x16a53c,_0x1be6ca,!![]);}catch(_0x15cc88){return BPromise['reject'](_0x15cc88);}return _0x16a53c[_0x0abb('0x27')]();};}function saveUpdates(_0x4794e2,_0x20fbb2){return function(_0x2a227a){if(_0x2a227a){return _0x2a227a[_0x0abb('0x28')](_0x4794e2)['then'](function(_0x34b640){return _0x34b640;});}return null;};}function removeEntity(_0x4a7739,_0x7d3533){return function(_0x317894){if(_0x317894){return _0x317894[_0x0abb('0x29')]()[_0x0abb('0x2a')](function(){var _0x47723f=_0x317894['get']({'plain':!![]});var _0x42a707=[{'name':_0x0abb('0x2b'),'value':'inbound','ignore':![]},{'name':'QueueCampaigns','value':_0x0abb('0x2c'),'ignore':![]}];var _0x466018=_(_0x42a707)['filter']('ignore')[_0x0abb('0x2d')](_0x0abb('0x2e'))['value']();if(_['includes'](_0x466018,_0x47723f[_0x0abb('0x2f')])){return;}var _0x58d288=_[_0x0abb('0x30')](_0x42a707,[_0x0abb('0x2e'),_0x47723f[_0x0abb('0x2f')]])[_0x0abb('0x31')];return db[_0x0abb('0x32')][_0x0abb('0x29')]({'where':{'type':_0x58d288,'resourceId':_0x47723f['id']}})[_0x0abb('0x2a')](function(){return _0x317894;});})[_0x0abb('0x2a')](function(){_0x4a7739['status'](0xcc)[_0x0abb('0x20')]();});}};}function handleEntityNotFound(_0x364fc7,_0x30c9e5){return function(_0x5eea12){if(!_0x5eea12){_0x364fc7[_0x0abb('0x1e')](0x194);}return _0x5eea12;};}function handleError(_0x458809,_0x10fd79){_0x10fd79=_0x10fd79||0x1f4;return function(_0x5ed3e7){logger['error'](_0x5ed3e7[_0x0abb('0x33')]);if(_0x5ed3e7[_0x0abb('0x31')]){delete _0x5ed3e7[_0x0abb('0x31')];}_0x458809['status'](_0x10fd79)[_0x0abb('0x34')](_0x5ed3e7);};}exports[_0x0abb('0x35')]=function(_0x19a325,_0x3a0fda){var _0x150c9f={},_0x139eeb={},_0x1414f4={'count':0x0,'rows':[]};var _0x1a158e=_[_0x0abb('0x2d')](db[_0x0abb('0x36')][_0x0abb('0x37')],function(_0x4ea61e){return{'name':_0x4ea61e[_0x0abb('0x38')],'type':_0x4ea61e[_0x0abb('0x2f')]['key']};});_0x139eeb[_0x0abb('0x39')]=_['map'](_0x1a158e,_0x0abb('0x31'));_0x139eeb[_0x0abb('0x3a')]=_[_0x0abb('0x3b')](_0x19a325['query']);_0x139eeb[_0x0abb('0x3c')]=_[_0x0abb('0x3d')](_0x139eeb['model'],_0x139eeb['query']);_0x150c9f[_0x0abb('0x3e')]=_[_0x0abb('0x3d')](_0x139eeb[_0x0abb('0x39')],qs[_0x0abb('0x3f')](_0x19a325[_0x0abb('0x3a')][_0x0abb('0x3f')]));_0x150c9f[_0x0abb('0x3e')]=_0x150c9f[_0x0abb('0x3e')][_0x0abb('0x40')]?_0x150c9f[_0x0abb('0x3e')]:_0x139eeb[_0x0abb('0x39')];if(!_0x19a325['query'][_0x0abb('0x41')](_0x0abb('0x42'))){_0x150c9f[_0x0abb('0x23')]=qs['limit'](_0x19a325[_0x0abb('0x3a')][_0x0abb('0x23')]);_0x150c9f[_0x0abb('0x22')]=qs[_0x0abb('0x22')](_0x19a325['query'][_0x0abb('0x22')]);}_0x150c9f[_0x0abb('0x43')]=qs[_0x0abb('0x44')](_0x19a325[_0x0abb('0x3a')][_0x0abb('0x44')]);_0x150c9f[_0x0abb('0x45')]=qs[_0x0abb('0x3c')](_[_0x0abb('0x46')](_0x19a325[_0x0abb('0x3a')],_0x139eeb['filters']),_0x1a158e);if(_0x19a325['query'][_0x0abb('0x47')]){_0x150c9f['where']=_['merge'](_0x150c9f[_0x0abb('0x45')],{'$or':_[_0x0abb('0x2d')](_0x1a158e,function(_0xfc4b48){if(_0xfc4b48[_0x0abb('0x2f')]!==_0x0abb('0x48')){var _0x40c88a={};_0x40c88a[_0xfc4b48['name']]={'$like':'%'+_0x19a325[_0x0abb('0x3a')]['filter']+'%'};return _0x40c88a;}})});}_0x150c9f=_['merge']({},_0x150c9f,_0x19a325[_0x0abb('0x49')]);var _0x24c1bb={'where':_0x150c9f[_0x0abb('0x45')]};return db[_0x0abb('0x36')][_0x0abb('0x24')](_0x24c1bb)[_0x0abb('0x2a')](function(_0x3e10c2){_0x1414f4[_0x0abb('0x24')]=_0x3e10c2;if(_0x19a325[_0x0abb('0x3a')][_0x0abb('0x4a')]){_0x150c9f[_0x0abb('0x4b')]=[{'all':!![]}];}return db['VoiceQueue'][_0x0abb('0x4c')](_0x150c9f);})['then'](function(_0x51741d){_0x1414f4['rows']=_0x51741d;return _0x1414f4;})[_0x0abb('0x2a')](respondWithFilteredResult(_0x3a0fda,_0x150c9f))['catch'](handleError(_0x3a0fda,null));};exports[_0x0abb('0x4d')]=function(_0x4574c7,_0x4f6991){var _0x3fb7b0={'raw':![],'where':{'id':_0x4574c7['params']['id']}},_0x441d4a={};_0x441d4a[_0x0abb('0x39')]=_[_0x0abb('0x3b')](db[_0x0abb('0x36')]['rawAttributes']);_0x441d4a[_0x0abb('0x3a')]=_[_0x0abb('0x3b')](_0x4574c7[_0x0abb('0x3a')]);_0x441d4a[_0x0abb('0x3c')]=_['intersection'](_0x441d4a[_0x0abb('0x39')],_0x441d4a[_0x0abb('0x3a')]);_0x3fb7b0[_0x0abb('0x3e')]=_['intersection'](_0x441d4a[_0x0abb('0x39')],qs[_0x0abb('0x3f')](_0x4574c7[_0x0abb('0x3a')][_0x0abb('0x3f')]));_0x3fb7b0['attributes']=_0x3fb7b0['attributes'][_0x0abb('0x40')]?_0x3fb7b0['attributes']:_0x441d4a['model'];if(_0x4574c7[_0x0abb('0x3a')][_0x0abb('0x4a')]){_0x3fb7b0[_0x0abb('0x4b')]=[{'all':!![]}];}_0x3fb7b0=_['merge']({},_0x3fb7b0,_0x4574c7['options']);return db[_0x0abb('0x36')][_0x0abb('0x30')](_0x3fb7b0)['then'](handleEntityNotFound(_0x4f6991,null))[_0x0abb('0x2a')](respondWithResult(_0x4f6991,null))[_0x0abb('0x4e')](handleError(_0x4f6991,null));};exports[_0x0abb('0x4f')]=function(_0x3a855d,_0x171859){return db[_0x0abb('0x36')][_0x0abb('0x4f')](_0x3a855d['body'],{})[_0x0abb('0x2a')](function(_0x5a9ba0){var _0xca3513=_0x3a855d[_0x0abb('0x50')][_0x0abb('0x51')]({'plain':!![]});if(!_0xca3513)throw new Error(_0x0abb('0x52'));if(_0xca3513[_0x0abb('0x53')]===_0x0abb('0x50')){var _0x120c4f=_0x5a9ba0['get']({'plain':!![]});var _0x44c639=[{'name':_0x0abb('0x2b'),'value':'inbound'},{'name':'QueueCampaigns','value':'outbound'}];var _0x4f7e97=_[_0x0abb('0x30')](_0x44c639,[_0x0abb('0x2e'),_0x120c4f[_0x0abb('0x2f')]])[_0x0abb('0x31')];return db[_0x0abb('0x54')][_0x0abb('0x30')]({'where':{'name':_0x4f7e97,'userProfileId':_0xca3513[_0x0abb('0x55')]},'raw':!![]})[_0x0abb('0x2a')](function(_0x5e0fa2){if(_0x5e0fa2&&_0x5e0fa2[_0x0abb('0x56')]===0x0){return db[_0x0abb('0x32')]['create']({'name':_0x120c4f['name'],'resourceId':_0x120c4f['id'],'type':_0x5e0fa2[_0x0abb('0x31')],'sectionId':_0x5e0fa2['id']},{})[_0x0abb('0x2a')](function(){return _0x5a9ba0;});}else{return _0x5a9ba0;}})[_0x0abb('0x4e')](function(_0x1f4178){logger[_0x0abb('0x57')](_0x0abb('0x58'),_0x1f4178);throw _0x1f4178;});}return _0x5a9ba0;})[_0x0abb('0x2a')](respondWithResult(_0x171859,0xc9))[_0x0abb('0x4e')](handleError(_0x171859,null));};exports[_0x0abb('0x59')]=function(_0x4d2041,_0x2afb55){var _0x151734={'where':{'id':_0x4d2041[_0x0abb('0x5a')]['id']}},_0x47b37e={};_0x47b37e[_0x0abb('0x39')]=_[_0x0abb('0x3b')](db['VoiceQueue'][_0x0abb('0x37')]);_0x151734['attributes']=_[_0x0abb('0x3d')](_0x47b37e[_0x0abb('0x39')],qs[_0x0abb('0x3f')](_0x4d2041[_0x0abb('0x3a')][_0x0abb('0x3f')]));_0x151734[_0x0abb('0x3e')]=_0x151734[_0x0abb('0x3e')][_0x0abb('0x40')]?_0x151734[_0x0abb('0x3e')]:_0x47b37e[_0x0abb('0x39')];if(_0x4d2041[_0x0abb('0x3a')][_0x0abb('0x4a')]){_0x151734[_0x0abb('0x4b')]=[{'all':!![]}];}_0x151734=_['merge']({},_0x151734,_0x4d2041[_0x0abb('0x49')]);return db[_0x0abb('0x36')][_0x0abb('0x30')](_0x151734)[_0x0abb('0x2a')](handleEntityNotFound(_0x2afb55,null))['then'](function(_0x5d709b){if(_0x5d709b){var _0x4b823f=_0x5d709b[_0x0abb('0x51')]({'plain':!![]});_0x4b823f=qs[_0x0abb('0x5b')](_0x4b823f,['id',_0x0abb('0x5c'),_0x0abb('0x5d')]);_0x4d2041[_0x0abb('0x5e')]=_['omit'](_0x4d2041[_0x0abb('0x5e')],['id','createdAt',_0x0abb('0x5d')]);return db[_0x0abb('0x36')][_0x0abb('0x4f')](_[_0x0abb('0x5f')](_0x4b823f,_0x4d2041[_0x0abb('0x5e')]),{'include':_0x4d2041[_0x0abb('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0x0abb('0x2a')](function(_0x3575f3){var _0x27223e=_0x4d2041[_0x0abb('0x50')][_0x0abb('0x51')]({'plain':!![]});if(!_0x27223e)throw new Error(_0x0abb('0x52'));if(_0x27223e[_0x0abb('0x53')]==='user'){var _0x5b88e6=_0x3575f3[_0x0abb('0x51')]({'plain':!![]});var _0x264008=[{'name':'VoiceQueues','value':_0x0abb('0x60')},{'name':'QueueCampaigns','value':_0x0abb('0x2c')}];var _0x2f851b=_[_0x0abb('0x30')](_0x264008,[_0x0abb('0x2e'),_0x5b88e6[_0x0abb('0x2f')]])['name'];return db[_0x0abb('0x54')][_0x0abb('0x30')]({'where':{'name':_0x2f851b,'userProfileId':_0x27223e[_0x0abb('0x55')]},'raw':!![]})['then'](function(_0x2e40ad){if(_0x2e40ad&&_0x2e40ad[_0x0abb('0x56')]===0x0){return db[_0x0abb('0x32')][_0x0abb('0x4f')]({'name':_0x5b88e6['name'],'resourceId':_0x5b88e6['id'],'type':_0x2e40ad[_0x0abb('0x31')],'sectionId':_0x2e40ad['id']},{})['then'](function(){return _0x3575f3;});}else{return _0x3575f3;}})[_0x0abb('0x4e')](function(_0x536615){logger[_0x0abb('0x57')](_0x0abb('0x58'),_0x536615);throw _0x536615;});}return _0x3575f3;});}})['then'](respondWithResult(_0x2afb55,0xc9))[_0x0abb('0x4e')](handleError(_0x2afb55,null));};exports[_0x0abb('0x28')]=function(_0x7e16af,_0x4da1d5){if(_0x7e16af[_0x0abb('0x5e')]['id']){delete _0x7e16af[_0x0abb('0x5e')]['id'];}return db['VoiceQueue'][_0x0abb('0x30')]({'where':{'id':_0x7e16af['params']['id']}})['then'](handleEntityNotFound(_0x4da1d5,null))[_0x0abb('0x2a')](saveUpdates(_0x7e16af[_0x0abb('0x5e')],null))[_0x0abb('0x2a')](respondWithResult(_0x4da1d5,null))[_0x0abb('0x4e')](handleError(_0x4da1d5,null));};exports[_0x0abb('0x29')]=function(_0x23530d,_0x28a7e7){return db[_0x0abb('0x36')][_0x0abb('0x30')]({'where':{'id':_0x23530d[_0x0abb('0x5a')]['id']}})['then'](handleEntityNotFound(_0x28a7e7,null))[_0x0abb('0x2a')](removeEntity(_0x28a7e7,null))[_0x0abb('0x4e')](handleError(_0x28a7e7,null));};exports[_0x0abb('0x61')]=function(_0x42da12,_0x19ff15,_0x6c4738){var _0x5b034b={'raw':![],'where':{}};var _0x194389={};var _0x11be1e={'count':0x0,'rows':[]};return db[_0x0abb('0x36')]['findOne']({'where':{'id':_0x42da12[_0x0abb('0x5a')]['id']}})[_0x0abb('0x2a')](handleEntityNotFound(_0x19ff15,null))[_0x0abb('0x2a')](function(_0x2397a0){if(_0x2397a0){_0x194389[_0x0abb('0x39')]=_[_0x0abb('0x3b')](db[_0x0abb('0x62')]['rawAttributes']);_0x194389['query']=_[_0x0abb('0x3b')](_0x42da12[_0x0abb('0x3a')]);_0x194389[_0x0abb('0x3c')]=_[_0x0abb('0x3d')](_0x194389[_0x0abb('0x39')],_0x194389[_0x0abb('0x3a')]);_0x5b034b[_0x0abb('0x3e')]=_['intersection'](_0x194389[_0x0abb('0x39')],qs[_0x0abb('0x3f')](_0x42da12[_0x0abb('0x3a')][_0x0abb('0x3f')]));_0x5b034b[_0x0abb('0x3e')]=_0x5b034b[_0x0abb('0x3e')]['length']?_0x5b034b['attributes']:_0x194389[_0x0abb('0x39')];if(!_0x42da12[_0x0abb('0x3a')][_0x0abb('0x41')](_0x0abb('0x42'))){_0x5b034b[_0x0abb('0x23')]=qs[_0x0abb('0x23')](_0x42da12[_0x0abb('0x3a')][_0x0abb('0x23')]);_0x5b034b[_0x0abb('0x22')]=qs[_0x0abb('0x22')](_0x42da12[_0x0abb('0x3a')][_0x0abb('0x22')]);}_0x5b034b[_0x0abb('0x43')]=qs['sort'](_0x42da12[_0x0abb('0x3a')]['sort']);_0x5b034b[_0x0abb('0x45')]=qs[_0x0abb('0x3c')](_[_0x0abb('0x46')](_0x42da12['query'],_0x194389['filters']));_0x5b034b[_0x0abb('0x45')][_0x0abb('0x63')]=_0x2397a0['id'];if(_0x42da12['query'][_0x0abb('0x47')]){_0x5b034b[_0x0abb('0x45')]=_['merge'](_0x5b034b[_0x0abb('0x45')],{'$or':_[_0x0abb('0x2d')](_0x5b034b[_0x0abb('0x3e')],function(_0x7b851a){var _0x5aa294={};_0x5aa294[_0x7b851a]={'$like':'%'+_0x42da12[_0x0abb('0x3a')][_0x0abb('0x47')]+'%'};return _0x5aa294;})});}_0x5b034b=_[_0x0abb('0x5f')]({},_0x5b034b,_0x42da12[_0x0abb('0x49')]);return db[_0x0abb('0x62')][_0x0abb('0x24')]({'where':_0x5b034b[_0x0abb('0x45')]})['then'](function(_0x97819d){_0x11be1e[_0x0abb('0x24')]=_0x97819d;if(_0x42da12['query'][_0x0abb('0x4a')]){_0x5b034b['include']=[{'all':!![]}];}return db['CmHopper'][_0x0abb('0x4c')](_0x5b034b);})[_0x0abb('0x2a')](function(_0x58355a){_0x11be1e[_0x0abb('0x64')]=_0x58355a;return _0x11be1e;});}})[_0x0abb('0x2a')](respondWithFilteredResult(_0x19ff15,_0x5b034b))[_0x0abb('0x4e')](handleError(_0x19ff15,null));};exports[_0x0abb('0x65')]=function(_0x2c4413,_0x344da1,_0x59ccb9){var _0x1532d9={'raw':!![],'where':{}};var _0x1ea004={};var _0x25a7ba={'count':0x0,'rows':[]};return db[_0x0abb('0x36')][_0x0abb('0x66')]({'where':{'id':_0x2c4413[_0x0abb('0x5a')]['id']}})[_0x0abb('0x2a')](handleEntityNotFound(_0x344da1,null))['then'](function(_0x4e69ac){if(_0x4e69ac){_0x1ea004['model']=_[_0x0abb('0x3b')](db[_0x0abb('0x67')][_0x0abb('0x37')]);_0x1ea004[_0x0abb('0x3a')]=_['keys'](_0x2c4413['query']);_0x1ea004[_0x0abb('0x3c')]=_[_0x0abb('0x3d')](_0x1ea004[_0x0abb('0x39')],_0x1ea004[_0x0abb('0x3a')]);_0x1532d9[_0x0abb('0x3e')]=_[_0x0abb('0x3d')](_0x1ea004['model'],qs[_0x0abb('0x3f')](_0x2c4413['query']['fields']));_0x1532d9[_0x0abb('0x3e')]=_0x1532d9[_0x0abb('0x3e')][_0x0abb('0x40')]?_0x1532d9[_0x0abb('0x3e')]:_0x1ea004[_0x0abb('0x39')];if(!_0x2c4413[_0x0abb('0x3a')][_0x0abb('0x41')](_0x0abb('0x42'))){_0x1532d9[_0x0abb('0x23')]=qs[_0x0abb('0x23')](_0x2c4413['query'][_0x0abb('0x23')]);_0x1532d9['offset']=qs[_0x0abb('0x22')](_0x2c4413[_0x0abb('0x3a')][_0x0abb('0x22')]);}_0x1532d9['order']=qs[_0x0abb('0x44')](_0x2c4413['query'][_0x0abb('0x44')]);_0x1532d9[_0x0abb('0x45')]=qs[_0x0abb('0x3c')](_[_0x0abb('0x46')](_0x2c4413['query'],_0x1ea004[_0x0abb('0x3c')]));_0x1532d9[_0x0abb('0x45')][_0x0abb('0x63')]=_0x4e69ac['id'];if(_0x2c4413[_0x0abb('0x3a')][_0x0abb('0x47')]){_0x1532d9[_0x0abb('0x45')]=_[_0x0abb('0x5f')](_0x1532d9[_0x0abb('0x45')],{'$or':_[_0x0abb('0x2d')](_0x1532d9[_0x0abb('0x3e')],function(_0x170ca5){var _0x2ef3f4={};_0x2ef3f4[_0x170ca5]={'$like':'%'+_0x2c4413[_0x0abb('0x3a')][_0x0abb('0x47')]+'%'};return _0x2ef3f4;})});}_0x1532d9=_[_0x0abb('0x5f')]({},_0x1532d9,_0x2c4413[_0x0abb('0x49')]);return db[_0x0abb('0x67')][_0x0abb('0x24')]({'where':_0x1532d9['where']})[_0x0abb('0x2a')](function(_0x4bcf83){_0x25a7ba[_0x0abb('0x24')]=_0x4bcf83;if(_0x2c4413[_0x0abb('0x3a')]['includeAll']){_0x1532d9[_0x0abb('0x4b')]=[{'all':!![]}];}return db[_0x0abb('0x67')]['findAll'](_0x1532d9);})[_0x0abb('0x2a')](function(_0xaa7073){_0x25a7ba[_0x0abb('0x64')]=_0xaa7073;return _0x25a7ba;});}})[_0x0abb('0x2a')](respondWithFilteredResult(_0x344da1,_0x1532d9))[_0x0abb('0x4e')](handleError(_0x344da1,null));};exports[_0x0abb('0x68')]=function(_0x128892,_0x12295b,_0x4cc5d4){var _0x35b3dc={'raw':!![],'where':{}};var _0x406aa5={};var _0xf014de={'count':0x0,'rows':[]};return db[_0x0abb('0x36')]['findOne']({'where':{'id':_0x128892[_0x0abb('0x5a')]['id']}})[_0x0abb('0x2a')](handleEntityNotFound(_0x12295b,null))[_0x0abb('0x2a')](function(_0x4c6daf){if(_0x4c6daf){_0x406aa5[_0x0abb('0x39')]=_['keys'](db[_0x0abb('0x69')]['rawAttributes']);_0x406aa5['query']=_[_0x0abb('0x3b')](_0x128892[_0x0abb('0x3a')]);_0x406aa5[_0x0abb('0x3c')]=_[_0x0abb('0x3d')](_0x406aa5[_0x0abb('0x39')],_0x406aa5[_0x0abb('0x3a')]);_0x35b3dc[_0x0abb('0x3e')]=_[_0x0abb('0x3d')](_0x406aa5[_0x0abb('0x39')],qs[_0x0abb('0x3f')](_0x128892[_0x0abb('0x3a')]['fields']));_0x35b3dc['attributes']=_0x35b3dc['attributes']['length']?_0x35b3dc[_0x0abb('0x3e')]:_0x406aa5[_0x0abb('0x39')];if(!_0x128892[_0x0abb('0x3a')][_0x0abb('0x41')](_0x0abb('0x42'))){_0x35b3dc[_0x0abb('0x23')]=qs[_0x0abb('0x23')](_0x128892[_0x0abb('0x3a')][_0x0abb('0x23')]);_0x35b3dc[_0x0abb('0x22')]=qs[_0x0abb('0x22')](_0x128892[_0x0abb('0x3a')][_0x0abb('0x22')]);}_0x35b3dc['order']=qs['sort'](_0x128892[_0x0abb('0x3a')][_0x0abb('0x44')]);_0x35b3dc[_0x0abb('0x45')]=qs[_0x0abb('0x3c')](_['pick'](_0x128892[_0x0abb('0x3a')],_0x406aa5[_0x0abb('0x3c')]));_0x35b3dc['where'][_0x0abb('0x63')]=_0x4c6daf['id'];if(_0x128892[_0x0abb('0x3a')]['filter']){_0x35b3dc[_0x0abb('0x45')]=_[_0x0abb('0x5f')](_0x35b3dc['where'],{'$or':_[_0x0abb('0x2d')](_0x35b3dc[_0x0abb('0x3e')],function(_0x1bf618){var _0x50808b={};_0x50808b[_0x1bf618]={'$like':'%'+_0x128892[_0x0abb('0x3a')][_0x0abb('0x47')]+'%'};return _0x50808b;})});}_0x35b3dc=_[_0x0abb('0x5f')]({},_0x35b3dc,_0x128892[_0x0abb('0x49')]);return db[_0x0abb('0x69')][_0x0abb('0x24')]({'where':_0x35b3dc[_0x0abb('0x45')]})[_0x0abb('0x2a')](function(_0x559da0){_0xf014de[_0x0abb('0x24')]=_0x559da0;if(_0x128892[_0x0abb('0x3a')][_0x0abb('0x4a')]){_0x35b3dc[_0x0abb('0x4b')]=[{'all':!![]}];}return db[_0x0abb('0x69')][_0x0abb('0x4c')](_0x35b3dc);})[_0x0abb('0x2a')](function(_0x43f9d6){_0xf014de[_0x0abb('0x64')]=_0x43f9d6;return _0xf014de;});}})['then'](respondWithFilteredResult(_0x12295b,_0x35b3dc))[_0x0abb('0x4e')](handleError(_0x12295b,null));};exports['getHopperBlacks']=function(_0x51d83e,_0x10d1ba,_0x53debf){var _0x77d859={'raw':!![],'where':{}};var _0x4c52e8={};var _0x2a2eb6={'count':0x0,'rows':[]};return db[_0x0abb('0x36')][_0x0abb('0x66')]({'where':{'id':_0x51d83e[_0x0abb('0x5a')]['id']}})['then'](handleEntityNotFound(_0x10d1ba,null))[_0x0abb('0x2a')](function(_0x11a1cd){if(_0x11a1cd){_0x4c52e8['model']=_[_0x0abb('0x3b')](db[_0x0abb('0x6a')][_0x0abb('0x37')]);_0x4c52e8[_0x0abb('0x3a')]=_[_0x0abb('0x3b')](_0x51d83e[_0x0abb('0x3a')]);_0x4c52e8[_0x0abb('0x3c')]=_[_0x0abb('0x3d')](_0x4c52e8[_0x0abb('0x39')],_0x4c52e8[_0x0abb('0x3a')]);_0x77d859['attributes']=_['intersection'](_0x4c52e8[_0x0abb('0x39')],qs[_0x0abb('0x3f')](_0x51d83e[_0x0abb('0x3a')][_0x0abb('0x3f')]));_0x77d859[_0x0abb('0x3e')]=_0x77d859[_0x0abb('0x3e')][_0x0abb('0x40')]?_0x77d859[_0x0abb('0x3e')]:_0x4c52e8['model'];if(!_0x51d83e[_0x0abb('0x3a')]['hasOwnProperty'](_0x0abb('0x42'))){_0x77d859[_0x0abb('0x23')]=qs[_0x0abb('0x23')](_0x51d83e['query']['limit']);_0x77d859[_0x0abb('0x22')]=qs['offset'](_0x51d83e[_0x0abb('0x3a')][_0x0abb('0x22')]);}_0x77d859['order']=qs[_0x0abb('0x44')](_0x51d83e[_0x0abb('0x3a')][_0x0abb('0x44')]);_0x77d859['where']=qs[_0x0abb('0x3c')](_['pick'](_0x51d83e[_0x0abb('0x3a')],_0x4c52e8[_0x0abb('0x3c')]));_0x77d859[_0x0abb('0x45')][_0x0abb('0x63')]=_0x11a1cd['id'];if(_0x51d83e['query'][_0x0abb('0x47')]){_0x77d859[_0x0abb('0x45')]=_['merge'](_0x77d859['where'],{'$or':_['map'](_0x77d859[_0x0abb('0x3e')],function(_0x472567){var _0x4b74b8={};_0x4b74b8[_0x472567]={'$like':'%'+_0x51d83e[_0x0abb('0x3a')]['filter']+'%'};return _0x4b74b8;})});}_0x77d859=_['merge']({},_0x77d859,_0x51d83e[_0x0abb('0x49')]);return db[_0x0abb('0x6a')]['count']({'where':_0x77d859[_0x0abb('0x45')]})[_0x0abb('0x2a')](function(_0x29b28a){_0x2a2eb6['count']=_0x29b28a;if(_0x51d83e[_0x0abb('0x3a')][_0x0abb('0x4a')]){_0x77d859[_0x0abb('0x4b')]=[{'all':!![]}];}return db[_0x0abb('0x6a')][_0x0abb('0x4c')](_0x77d859);})[_0x0abb('0x2a')](function(_0x1697d4){_0x2a2eb6[_0x0abb('0x64')]=_0x1697d4;return _0x2a2eb6;});}})['then'](respondWithFilteredResult(_0x10d1ba,_0x77d859))['catch'](handleError(_0x10d1ba,null));};exports[_0x0abb('0x6b')]=function(_0x3d7791,_0x2b95bc,_0x379f5d){var _0x5258ce={};var _0x489ef9={};var _0x474654;var _0x2a0172;return db['VoiceQueue'][_0x0abb('0x66')]({'where':{'id':_0x3d7791[_0x0abb('0x5a')]['id']}})[_0x0abb('0x2a')](handleEntityNotFound(_0x2b95bc,null))['then'](function(_0x47c841){if(_0x47c841){_0x474654=_0x47c841;_0x489ef9[_0x0abb('0x39')]=_[_0x0abb('0x3b')](db[_0x0abb('0x6c')][_0x0abb('0x37')]);_0x489ef9[_0x0abb('0x3a')]=_[_0x0abb('0x3b')](_0x3d7791['query']);_0x489ef9['filters']=_[_0x0abb('0x3d')](_0x489ef9[_0x0abb('0x39')],_0x489ef9[_0x0abb('0x3a')]);_0x5258ce[_0x0abb('0x3e')]=_[_0x0abb('0x3d')](_0x489ef9[_0x0abb('0x39')],qs[_0x0abb('0x3f')](_0x3d7791[_0x0abb('0x3a')][_0x0abb('0x3f')]));_0x5258ce['attributes']=_0x5258ce[_0x0abb('0x3e')][_0x0abb('0x40')]?_0x5258ce[_0x0abb('0x3e')]:_0x489ef9['model'];_0x5258ce[_0x0abb('0x43')]=qs[_0x0abb('0x44')](_0x3d7791[_0x0abb('0x3a')]['sort']);_0x5258ce[_0x0abb('0x45')]=qs[_0x0abb('0x3c')](_['pick'](_0x3d7791['query'],_0x489ef9['filters']));if(_0x3d7791[_0x0abb('0x3a')][_0x0abb('0x47')]){_0x5258ce[_0x0abb('0x45')]=_[_0x0abb('0x5f')](_0x5258ce[_0x0abb('0x45')],{'$or':_[_0x0abb('0x2d')](_0x5258ce[_0x0abb('0x3e')],function(_0x3dd602){var _0x4e4a73={};_0x4e4a73[_0x3dd602]={'$like':'%'+_0x3d7791[_0x0abb('0x3a')][_0x0abb('0x47')]+'%'};return _0x4e4a73;})});}_0x5258ce=_['merge']({},_0x5258ce,_0x3d7791['options']);return _0x474654['getTeams'](_0x5258ce);}})[_0x0abb('0x2a')](function(_0x44c1fa){if(_0x44c1fa){_0x2a0172=_0x44c1fa['length'];if(!_0x3d7791[_0x0abb('0x3a')]['hasOwnProperty'](_0x0abb('0x42'))){_0x5258ce[_0x0abb('0x23')]=qs[_0x0abb('0x23')](_0x3d7791[_0x0abb('0x3a')][_0x0abb('0x23')]);_0x5258ce['offset']=qs[_0x0abb('0x22')](_0x3d7791['query']['offset']);}return _0x474654[_0x0abb('0x6b')](_0x5258ce);}})['then'](function(_0xf69c1e){if(_0xf69c1e){return _0xf69c1e?{'count':_0x2a0172,'rows':_0xf69c1e}:null;}})[_0x0abb('0x2a')](respondWithResult(_0x2b95bc,null))[_0x0abb('0x4e')](handleError(_0x2b95bc,null));};exports['addTeams']=function(_0x5e1cf4,_0x3147e5,_0x26db94){var _0x30c2a8=_0x5e1cf4[_0x0abb('0x5e')][_0x0abb('0x6d')];var _0x3f3280=_[_0x0abb('0x2d')](_0x30c2a8,'id');return db[_0x0abb('0x6c')]['findAll']({'where':{'id':_0x3f3280},'attributes':['id'],'include':[{'model':db[_0x0abb('0x6e')],'as':_0x0abb('0x6f'),'attributes':['id','name',_0x0abb('0x70'),'voicePause',_0x0abb('0x71')],'raw':!![]}]})[_0x0abb('0x2a')](function(_0x181841){if(_0x181841){var _0x30775f=_['flatMap'](_0x181841,function(_0x87a64c){var _0x2bbc35=_0x87a64c[_0x0abb('0x51')]({'plain':!![]});_0x2bbc35[_0x0abb('0x6f')][_0x0abb('0x72')](function(_0x1b4032){_0x1b4032['penalty']=_[_0x0abb('0x30')](_0x30c2a8,{'id':_0x2bbc35['id']})[_0x0abb('0x73')];});return _0x2bbc35[_0x0abb('0x6f')];});return db[_0x0abb('0x36')][_0x0abb('0x30')]({'where':{'id':_0x5e1cf4['params']['id']}})[_0x0abb('0x2a')](function(_0x4a5e2f){return db[_0x0abb('0x74')][_0x0abb('0x75')](function(_0x3be384){return _0x4a5e2f[_0x0abb('0x76')](_0x3f3280,{'transaction':_0x3be384})[_0x0abb('0x2a')](function(){return BPromise[_0x0abb('0x77')](_0x30c2a8,function(_0x5af0c8){return db[_0x0abb('0x78')][_0x0abb('0x79')]({'TeamId':_0x5af0c8['id'],'VoiceQueueId':_0x5e1cf4[_0x0abb('0x5a')]['id'],'penalty':_0x5af0c8[_0x0abb('0x73')]},{'transaction':_0x3be384});});})['then'](function(){return BPromise[_0x0abb('0x77')](_0x30775f,function(_0x545603){return db[_0x0abb('0x7a')]['findOrCreate']({'where':{'UserId':_0x545603['id'],'VoiceQueueId':_0x5e1cf4['params']['id']},'defaults':{'penalty':_0x545603[_0x0abb('0x73')]},'transaction':_0x3be384});});})[_0x0abb('0x2a')](function(){return BPromise[_0x0abb('0x77')](_[_0x0abb('0x47')](_0x30775f,{'online':!![]}),function(_0x2f3091){return db[_0x0abb('0x7b')]['upsert']({'membername':_0x2f3091[_0x0abb('0x31')],'UserId':_0x2f3091['id'],'queue_name':_0x4a5e2f[_0x0abb('0x31')],'VoiceQueueId':_0x4a5e2f['id'],'interface':_[_0x0abb('0x7c')](_0x2f3091['interface'])?util[_0x0abb('0x7d')](_0x0abb('0x7e'),_0x2f3091[_0x0abb('0x31')]):_0x2f3091['interface'],'paused':_0x2f3091[_0x0abb('0x7f')]||![],'penalty':_0x2f3091[_0x0abb('0x73')]},{'transaction':_0x3be384});});})['then'](function(){_0x30775f[_0x0abb('0x72')](function(_0x5644a9){socket[_0x0abb('0x80')](_0x0abb('0x81'),{'UserId':_0x5644a9['id'],'VoiceQueueId':_0x4a5e2f['id']});});});});});}})[_0x0abb('0x2a')](respondWithStatusCode(_0x3147e5,null))[_0x0abb('0x4e')](handleError(_0x3147e5,null));};exports[_0x0abb('0x82')]=function(_0x585db4,_0x313c53,_0x17b22c){return db[_0x0abb('0x6c')][_0x0abb('0x4c')]({'where':{'id':_0x585db4['query'][_0x0abb('0x83')]},'attributes':['id'],'include':[{'model':db[_0x0abb('0x6e')],'as':_0x0abb('0x6f'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x313c53,null))[_0x0abb('0x2a')](function(_0x19bc20){var _0x11c6fe=_[_0x0abb('0x2d')](_0x19bc20,'id');var _0x1e8649=[];var _0x3a2d6=[];var _0x8d5344=squel[_0x0abb('0x84')]();_0x8d5344['field'](_0x0abb('0x85'))['from']('team_has_voice_queues','tq')['join']('user_has_teams','ut',_0x0abb('0x86'))[_0x0abb('0x45')](_0x0abb('0x87'),_0x585db4[_0x0abb('0x5a')]['id']);for(var _0x5edf04=0x0;_0x5edf04<_0x19bc20[_0x0abb('0x40')];_0x5edf04+=0x1){let _0x286d91=_0x19bc20[_0x5edf04];for(var _0x2aa3f1=0x0;_0x2aa3f1<_0x286d91[_0x0abb('0x6f')][_0x0abb('0x40')];_0x2aa3f1+=0x1){let _0x37d720=_0x286d91[_0x0abb('0x6f')][_0x2aa3f1];var _0x3fccac=_0x8d5344[_0x0abb('0x59')]();_0x3fccac[_0x0abb('0x45')](_0x0abb('0x88'),_0x37d720['id']);_0x3a2d6[_0x0abb('0x89')](db['sequelize']['query'](_0x3fccac[_0x0abb('0x8a')](),{'type':db['sequelize'][_0x0abb('0x8b')][_0x0abb('0x8c')]})[_0x0abb('0x2a')](function(_0x47af90){if(_0x47af90[_0x0abb('0x40')]===0x1){return _0x37d720['id'];}else{var _0x6a46dc=_[_0x0abb('0x8d')](_[_0x0abb('0x2d')](_0x47af90,_0x0abb('0x8e')),function(_0x2bc38d){return _[_0x0abb('0x8f')](_0x11c6fe,_0x2bc38d);});if(_0x6a46dc){return _0x37d720['id'];}}}));}}return BPromise[_0x0abb('0x90')](_0x3a2d6)[_0x0abb('0x2a')](function(_0x371ce7){_0x1e8649=_(_0x1e8649)[_0x0abb('0x91')](_0x371ce7)[_0x0abb('0x92')]()['value']();return db[_0x0abb('0x36')][_0x0abb('0x30')]({'where':{'id':_0x585db4[_0x0abb('0x5a')]['id']}})[_0x0abb('0x2a')](function(_0x1751e4){return db['sequelize']['transaction'](function(_0x48f185){return _0x1751e4[_0x0abb('0x82')](_0x585db4[_0x0abb('0x3a')][_0x0abb('0x83')],{'transaction':_0x48f185})['then'](function(){if(!_['isEmpty'](_0x1e8649)){return _0x1751e4[_0x0abb('0x93')](_0x1e8649,{'transaction':_0x48f185})[_0x0abb('0x2a')](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x585db4['params']['id'],'UserId':_0x1e8649},'transaction':_0x48f185});});}})[_0x0abb('0x2a')](function(){_0x1e8649[_0x0abb('0x72')](function(_0x22c043){socket[_0x0abb('0x80')]('userVoiceQueue:remove',{'UserId':_0x22c043,'VoiceQueueId':_0x1751e4['id']});});});});});});})[_0x0abb('0x2a')](respondWithStatusCode(_0x313c53,null))[_0x0abb('0x4e')](handleError(_0x313c53,null));};exports[_0x0abb('0x94')]=function(_0x1e24bb,_0x45f738,_0x3db5c5){var _0x545005,_0x330d57;return db[_0x0abb('0x36')][_0x0abb('0x30')]({'where':{'id':_0x1e24bb['params']['id']}})['then'](handleEntityNotFound(_0x45f738,null))[_0x0abb('0x2a')](function(_0x22997d){if(_0x22997d){_0x330d57=_0x22997d;return _0x22997d[_0x0abb('0x94')](_0x1e24bb[_0x0abb('0x5e')][_0x0abb('0x83')],_[_0x0abb('0x5b')](_0x1e24bb[_0x0abb('0x5e')],[_0x0abb('0x83'),'id'])||{})[_0x0abb('0x95')](function(_0x1fc5e8){for(var _0xaf7ee3=0x0;_0xaf7ee3<_0x1e24bb['body']['ids'][_0x0abb('0x40')];_0xaf7ee3+=0x1){socket[_0x0abb('0x80')](_0x0abb('0x81'),{'UserId':Number(_0x1e24bb['body'][_0x0abb('0x83')][_0xaf7ee3]),'VoiceQueueId':Number(_0x1e24bb[_0x0abb('0x5a')]['id'])});}return _0x1fc5e8;});}})[_0x0abb('0x2a')](function(_0x2a3bbc){_0x545005=_0x2a3bbc||[];if(_0x330d57){return db[_0x0abb('0x6e')][_0x0abb('0x4c')]({'where':{'id':_0x1e24bb[_0x0abb('0x5e')][_0x0abb('0x83')]},'attributes':['id','name',_0x0abb('0x70'),'voicePause',_0x0abb('0x71')],'raw':!![]});}})[_0x0abb('0x2a')](function(_0x14d4d9){if(!_[_0x0abb('0x96')](_0x14d4d9)){var _0x409af8=[];for(var _0x444a9a=0x0;_0x444a9a<_0x14d4d9[_0x0abb('0x40')];_0x444a9a++){if(_0x14d4d9[_0x444a9a][_0x0abb('0x70')]){_0x409af8['push'](db[_0x0abb('0x7b')][_0x0abb('0x79')]({'membername':_0x14d4d9[_0x444a9a][_0x0abb('0x31')],'UserId':_0x14d4d9[_0x444a9a]['id'],'queue_name':_0x330d57[_0x0abb('0x31')],'VoiceQueueId':_0x330d57['id'],'interface':_[_0x0abb('0x7c')](_0x14d4d9[_0x444a9a][_0x0abb('0x71')])?util[_0x0abb('0x7d')](_0x0abb('0x7e'),_0x14d4d9[_0x444a9a][_0x0abb('0x31')]):_0x14d4d9[_0x444a9a][_0x0abb('0x71')],'paused':_0x14d4d9[_0x444a9a][_0x0abb('0x7f')]||![],'penalty':_0x1e24bb[_0x0abb('0x5e')]['penalty']||0x0}));}}return BPromise[_0x0abb('0x90')](_0x409af8);}})[_0x0abb('0x2a')](function(){return _0x545005;})[_0x0abb('0x2a')](respondWithResult(_0x45f738,null))[_0x0abb('0x4e')](handleError(_0x45f738,null));};exports[_0x0abb('0x93')]=function(_0x3cd0aa,_0x301e1c,_0x3adaab){return db[_0x0abb('0x36')][_0x0abb('0x30')]({'where':{'id':_0x3cd0aa[_0x0abb('0x5a')]['id']}})[_0x0abb('0x2a')](handleEntityNotFound(_0x301e1c,null))[_0x0abb('0x2a')](function(_0x234bbe){if(_0x234bbe){return _0x234bbe[_0x0abb('0x93')](_0x3cd0aa['query']['ids'])[_0x0abb('0x2a')](function(){if(_[_0x0abb('0x97')](_0x3cd0aa['query']['ids'])){for(var _0x22b60e=0x0;_0x22b60e<_0x3cd0aa['query']['ids'][_0x0abb('0x40')];_0x22b60e+=0x1){socket[_0x0abb('0x80')](_0x0abb('0x98'),{'UserId':Number(_0x3cd0aa[_0x0abb('0x3a')]['ids'][_0x22b60e]),'VoiceQueueId':Number(_0x3cd0aa['params']['id'])});}}else{socket[_0x0abb('0x80')](_0x0abb('0x98'),{'UserId':Number(_0x3cd0aa[_0x0abb('0x3a')][_0x0abb('0x83')]),'VoiceQueueId':Number(_0x3cd0aa[_0x0abb('0x5a')]['id'])});}});}})[_0x0abb('0x2a')](function(_0x54b894){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x3cd0aa[_0x0abb('0x5a')]['id'],'UserId':_0x3cd0aa[_0x0abb('0x3a')][_0x0abb('0x83')]}})[_0x0abb('0x2a')](function(){return _0x54b894;});})[_0x0abb('0x2a')](respondWithStatusCode(_0x301e1c,null))[_0x0abb('0x4e')](handleError(_0x301e1c,null));};exports['getAgents']=function(_0x49cf9c,_0xf13442,_0x241df1){var _0x25d6f1={};var _0x12eac8={};var _0x4d307b;var _0x1f0177;return db['VoiceQueue'][_0x0abb('0x66')]({'where':{'id':_0x49cf9c['params']['id']}})['then'](handleEntityNotFound(_0xf13442,null))['then'](function(_0x14055f){if(_0x14055f){_0x4d307b=_0x14055f;_0x12eac8['model']=_['keys'](db[_0x0abb('0x6e')][_0x0abb('0x37')]);_0x12eac8[_0x0abb('0x3a')]=_[_0x0abb('0x3b')](_0x49cf9c['query']);_0x12eac8[_0x0abb('0x3c')]=_[_0x0abb('0x3d')](_0x12eac8[_0x0abb('0x39')],_0x12eac8[_0x0abb('0x3a')]);_0x25d6f1[_0x0abb('0x3e')]=_[_0x0abb('0x3d')](_0x12eac8[_0x0abb('0x39')],qs[_0x0abb('0x3f')](_0x49cf9c['query'][_0x0abb('0x3f')]));_0x25d6f1['attributes']=_0x25d6f1['attributes']['length']?_0x25d6f1[_0x0abb('0x3e')]:_0x12eac8[_0x0abb('0x39')];_0x25d6f1['order']=qs[_0x0abb('0x44')](_0x49cf9c['query'][_0x0abb('0x44')]);_0x25d6f1[_0x0abb('0x45')]=qs[_0x0abb('0x3c')](_['pick'](_0x49cf9c[_0x0abb('0x3a')],_0x12eac8[_0x0abb('0x3c')]));if(_0x49cf9c[_0x0abb('0x3a')][_0x0abb('0x47')]){_0x25d6f1[_0x0abb('0x45')]=_['merge'](_0x25d6f1[_0x0abb('0x45')],{'$or':_[_0x0abb('0x2d')](_0x25d6f1['attributes'],function(_0x3cc3a9){var _0x3a3d6d={};_0x3a3d6d[_0x3cc3a9]={'$like':'%'+_0x49cf9c['query'][_0x0abb('0x47')]+'%'};return _0x3a3d6d;})});}_0x25d6f1=_[_0x0abb('0x5f')]({},_0x25d6f1,_0x49cf9c[_0x0abb('0x49')]);return _0x4d307b['getAgents'](_0x25d6f1);}})[_0x0abb('0x2a')](function(_0x356a03){if(_0x356a03){_0x1f0177=_0x356a03[_0x0abb('0x40')];if(!_0x49cf9c[_0x0abb('0x3a')][_0x0abb('0x41')](_0x0abb('0x42'))){_0x25d6f1[_0x0abb('0x23')]=qs[_0x0abb('0x23')](_0x49cf9c[_0x0abb('0x3a')][_0x0abb('0x23')]);_0x25d6f1['offset']=qs['offset'](_0x49cf9c['query'][_0x0abb('0x22')]);}return _0x4d307b[_0x0abb('0x99')](_0x25d6f1);}})['then'](function(_0x13e18e){if(_0x13e18e){return _0x13e18e?{'count':_0x1f0177,'rows':_0x13e18e}:null;}})[_0x0abb('0x2a')](respondWithResult(_0xf13442,null))[_0x0abb('0x4e')](handleError(_0xf13442,null));};exports[_0x0abb('0x9a')]=function(_0x318e86,_0x120d1f,_0xd57b05){var _0x399ab3={};var _0x3c7b88={};var _0x3926e0;var _0x4a7567;return db['VoiceQueue']['findOne']({'where':{'id':_0x318e86['params']['id']}})[_0x0abb('0x2a')](handleEntityNotFound(_0x120d1f,null))[_0x0abb('0x2a')](function(_0x3544ea){if(_0x3544ea){_0x3926e0=_0x3544ea;_0x3c7b88[_0x0abb('0x39')]=_['keys'](db[_0x0abb('0x7b')][_0x0abb('0x37')]);_0x3c7b88[_0x0abb('0x3a')]=_[_0x0abb('0x3b')](_0x318e86[_0x0abb('0x3a')]);_0x3c7b88['filters']=_[_0x0abb('0x3d')](_0x3c7b88[_0x0abb('0x39')],_0x3c7b88[_0x0abb('0x3a')]);_0x399ab3[_0x0abb('0x3e')]=_[_0x0abb('0x3d')](_0x3c7b88[_0x0abb('0x39')],qs[_0x0abb('0x3f')](_0x318e86[_0x0abb('0x3a')][_0x0abb('0x3f')]));_0x399ab3[_0x0abb('0x3e')]=_0x399ab3[_0x0abb('0x3e')]['length']?_0x399ab3[_0x0abb('0x3e')]:_0x3c7b88[_0x0abb('0x39')];_0x399ab3[_0x0abb('0x43')]=qs[_0x0abb('0x44')](_0x318e86[_0x0abb('0x3a')][_0x0abb('0x44')]);_0x399ab3['where']=qs[_0x0abb('0x3c')](_[_0x0abb('0x46')](_0x318e86['query'],_0x3c7b88[_0x0abb('0x3c')]));if(_0x318e86[_0x0abb('0x3a')]['filter']){_0x399ab3[_0x0abb('0x45')]=_[_0x0abb('0x5f')](_0x399ab3['where'],{'$or':_[_0x0abb('0x2d')](_0x399ab3['attributes'],function(_0x1921f1){var _0x1e0768={};_0x1e0768[_0x1921f1]={'$like':'%'+_0x318e86[_0x0abb('0x3a')]['filter']+'%'};return _0x1e0768;})});}_0x399ab3=_[_0x0abb('0x5f')]({},_0x399ab3,_0x318e86[_0x0abb('0x49')]);return _0x3926e0['getMembers'](_0x399ab3);}})[_0x0abb('0x2a')](function(_0x341a53){if(_0x341a53){_0x4a7567=_0x341a53[_0x0abb('0x40')];if(!_0x318e86['query'][_0x0abb('0x41')](_0x0abb('0x42'))){_0x399ab3[_0x0abb('0x23')]=qs['limit'](_0x318e86[_0x0abb('0x3a')][_0x0abb('0x23')]);_0x399ab3[_0x0abb('0x22')]=qs[_0x0abb('0x22')](_0x318e86[_0x0abb('0x3a')][_0x0abb('0x22')]);}return _0x3926e0[_0x0abb('0x9a')](_0x399ab3);}})[_0x0abb('0x2a')](function(_0x17fa92){return _0x17fa92?{'count':_0x4a7567,'rows':_0x17fa92}:null;})[_0x0abb('0x2a')](respondWithResult(_0x120d1f,null))['catch'](handleError(_0x120d1f,null));};exports[_0x0abb('0x9b')]=function(_0x21b9aa,_0x14f3a0,_0x57d95a){var _0x112124={};var _0x50f276={};var _0x37a012;var _0x9fee9e;return db[_0x0abb('0x36')]['findOne']({'where':{'id':_0x21b9aa[_0x0abb('0x5a')]['id']}})['then'](handleEntityNotFound(_0x14f3a0,null))['then'](function(_0x1a715b){if(_0x1a715b){_0x37a012=_0x1a715b;_0x50f276[_0x0abb('0x39')]=_[_0x0abb('0x3b')](db['CmList'][_0x0abb('0x37')]);_0x50f276[_0x0abb('0x3a')]=_[_0x0abb('0x3b')](_0x21b9aa[_0x0abb('0x3a')]);_0x50f276[_0x0abb('0x3c')]=_[_0x0abb('0x3d')](_0x50f276['model'],_0x50f276[_0x0abb('0x3a')]);_0x112124[_0x0abb('0x3e')]=_[_0x0abb('0x3d')](_0x50f276[_0x0abb('0x39')],qs[_0x0abb('0x3f')](_0x21b9aa['query'][_0x0abb('0x3f')]));_0x112124['attributes']=_0x112124['attributes'][_0x0abb('0x40')]?_0x112124['attributes']:_0x50f276[_0x0abb('0x39')];_0x112124['order']=qs[_0x0abb('0x44')](_0x21b9aa[_0x0abb('0x3a')]['sort']);_0x112124[_0x0abb('0x45')]=qs[_0x0abb('0x3c')](_[_0x0abb('0x46')](_0x21b9aa['query'],_0x50f276[_0x0abb('0x3c')]));if(_0x21b9aa[_0x0abb('0x3a')][_0x0abb('0x47')]){_0x112124[_0x0abb('0x45')]=_[_0x0abb('0x5f')](_0x112124[_0x0abb('0x45')],{'$or':_[_0x0abb('0x2d')](_0x112124['attributes'],function(_0xc848da){var _0x2bf40d={};_0x2bf40d[_0xc848da]={'$like':'%'+_0x21b9aa['query'][_0x0abb('0x47')]+'%'};return _0x2bf40d;})});}_0x112124=_[_0x0abb('0x5f')]({},_0x112124,_0x21b9aa['options']);return _0x37a012[_0x0abb('0x9b')](_0x112124);}})[_0x0abb('0x2a')](function(_0x4074dc){if(_0x4074dc){_0x9fee9e=_0x4074dc['length'];if(!_0x21b9aa[_0x0abb('0x3a')]['hasOwnProperty']('nolimit')){_0x112124[_0x0abb('0x23')]=qs['limit'](_0x21b9aa[_0x0abb('0x3a')]['limit']);_0x112124[_0x0abb('0x22')]=qs[_0x0abb('0x22')](_0x21b9aa[_0x0abb('0x3a')][_0x0abb('0x22')]);}return _0x37a012[_0x0abb('0x9b')](_0x112124);}})['then'](function(_0x14a45e){if(_0x14a45e){return _0x14a45e?{'count':_0x9fee9e,'rows':_0x14a45e}:null;}})[_0x0abb('0x2a')](respondWithResult(_0x14f3a0,null))[_0x0abb('0x4e')](handleError(_0x14f3a0,null));};exports[_0x0abb('0x9c')]=function(_0x177e44,_0x41490e,_0x3c526e){var _0x23b353,_0x31877a;return db['VoiceQueue'][_0x0abb('0x30')]({'where':{'id':_0x177e44[_0x0abb('0x5a')]['id']}})[_0x0abb('0x2a')](handleEntityNotFound(_0x41490e,null))[_0x0abb('0x2a')](function(_0x3df097){if(_0x3df097){_0x31877a=_0x3df097;return _0x3df097[_0x0abb('0x9c')](_0x177e44[_0x0abb('0x5e')]['ids'],_[_0x0abb('0x5b')](_0x177e44[_0x0abb('0x5e')],[_0x0abb('0x83'),'id'])||{});}return null;})[_0x0abb('0x95')](function(_0xeec7ee){var _0x329b48;_0x23b353=_0xeec7ee||[];var _0x51c5c2=[];if(_0xeec7ee){for(var _0x29c999=0x0;_0x29c999<_0xeec7ee['length'];_0x29c999+=0x1){var _0x47425b=_0xeec7ee[_0x29c999][_0x0abb('0x51')]({'plain':!![]});_0x31877a[_0x0abb('0x9d')]=_0x177e44[_0x0abb('0x5e')][_0x0abb('0x9d')]?_0x177e44[_0x0abb('0x5e')][_0x0abb('0x9d')]:_0x31877a[_0x0abb('0x9d')];switch(_0x31877a['dialCheckDuplicateType']){case _0x0abb('0x9e'):_0x329b48=squel[_0x0abb('0x9f')]()[_0x0abb('0xa0')]('cm_hopper')[_0x0abb('0xa1')]([_0x0abb('0xa2'),'scheduledAt',_0x0abb('0xa3'),_0x0abb('0xa4'),_0x0abb('0x63'),_0x0abb('0x5c'),'updatedAt'],squel['select']()[_0x0abb('0xa5')](_0x0abb('0xa2'),_0x0abb('0xa2'))[_0x0abb('0xa5')]('NOW()','scheduledAt')[_0x0abb('0xa5')]('id','ContactId')['field'](_0x47425b[_0x0abb('0xa6')]['toString'](),_0x0abb('0xa4'))['field'](_0x177e44['params']['id'][_0x0abb('0x8a')](),'VoiceQueueId')['field'](_0x0abb('0xa7'),_0x0abb('0x5c'))[_0x0abb('0xa5')]('NOW()',_0x0abb('0x5d'))[_0x0abb('0xa8')](_0x0abb('0xa9'))[_0x0abb('0x45')](_0x0abb('0xaa'))[_0x0abb('0x45')]('ListId\x20=\x20?',_0x47425b['CmListId'][_0x0abb('0x8a')]())[_0x0abb('0x45')](_0x0abb('0xab'))[_0x0abb('0x45')](_0x0abb('0xac'),squel['select']()['field'](_0x0abb('0xad'))[_0x0abb('0xa8')](_0x0abb('0xae'))[_0x0abb('0x45')](_0x0abb('0x87'),_0x177e44[_0x0abb('0x5a')]['id'][_0x0abb('0x8a')]()))[_0x0abb('0x45')](_0x0abb('0xac'),squel[_0x0abb('0x84')]()[_0x0abb('0xa5')](_0x0abb('0xaf'))[_0x0abb('0xa8')](_0x0abb('0xb0'))[_0x0abb('0x45')](_0x0abb('0x87'),_0x177e44[_0x0abb('0x5a')]['id']['toString']())))[_0x0abb('0x8a')]();break;case _0x0abb('0xb1'):_0x329b48=squel[_0x0abb('0x9f')]()[_0x0abb('0xa0')](_0x0abb('0xb0'))[_0x0abb('0xa1')]([_0x0abb('0xa2'),_0x0abb('0xb2'),_0x0abb('0xa3'),_0x0abb('0xa4'),_0x0abb('0x63'),_0x0abb('0x5c'),_0x0abb('0x5d')],squel[_0x0abb('0x84')]()[_0x0abb('0xa5')]('phone',_0x0abb('0xa2'))['field'](_0x0abb('0xa7'),'scheduledAt')[_0x0abb('0xa5')]('id',_0x0abb('0xa3'))[_0x0abb('0xa5')](_0x47425b[_0x0abb('0xa6')]['toString'](),_0x0abb('0xa4'))[_0x0abb('0xa5')](_0x177e44[_0x0abb('0x5a')]['id']['toString'](),_0x0abb('0x63'))[_0x0abb('0xa5')](_0x0abb('0xa7'),_0x0abb('0x5c'))[_0x0abb('0xa5')](_0x0abb('0xa7'),_0x0abb('0x5d'))[_0x0abb('0xa8')]('cm_contacts')[_0x0abb('0x45')](_0x0abb('0xaa'))[_0x0abb('0x45')](_0x0abb('0xb3'),_0x47425b[_0x0abb('0xa6')][_0x0abb('0x8a')]())[_0x0abb('0x45')](_0x0abb('0xab'))['where'](_0x0abb('0xac'),squel[_0x0abb('0x84')]()[_0x0abb('0xa5')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')['where'](_0x0abb('0x87'),_0x177e44['params']['id'][_0x0abb('0x8a')]())))[_0x0abb('0x8a')]();break;default:_0x329b48=squel[_0x0abb('0x9f')]()[_0x0abb('0xa0')]('cm_hopper')[_0x0abb('0xa1')](['phone',_0x0abb('0xb2'),_0x0abb('0xa3'),_0x0abb('0xa4'),_0x0abb('0x63'),_0x0abb('0x5c'),_0x0abb('0x5d')],squel[_0x0abb('0x84')]()[_0x0abb('0xa5')](_0x0abb('0xa2'),_0x0abb('0xa2'))['field']('NOW()',_0x0abb('0xb2'))[_0x0abb('0xa5')]('id',_0x0abb('0xa3'))['field'](_0x47425b[_0x0abb('0xa6')][_0x0abb('0x8a')](),'ListId')[_0x0abb('0xa5')](_0x177e44[_0x0abb('0x5a')]['id'][_0x0abb('0x8a')](),'VoiceQueueId')[_0x0abb('0xa5')](_0x0abb('0xa7'),_0x0abb('0x5c'))[_0x0abb('0xa5')]('NOW()',_0x0abb('0x5d'))[_0x0abb('0xa8')](_0x0abb('0xa9'))['where'](_0x0abb('0xaa'))[_0x0abb('0x45')](_0x0abb('0xb3'),_0x47425b[_0x0abb('0xa6')][_0x0abb('0x8a')]())['where'](_0x0abb('0xab')))[_0x0abb('0x8a')]();}_0x51c5c2['push'](db[_0x0abb('0x74')][_0x0abb('0x3a')](_0x329b48));}return BPromise[_0x0abb('0x90')](_0x51c5c2);}})[_0x0abb('0x2a')](function(){return _0x23b353;})[_0x0abb('0x2a')](respondWithResult(_0x41490e,null))[_0x0abb('0x4e')](handleError(_0x41490e,null));};exports[_0x0abb('0xb4')]=function(_0xa3d327,_0x29484d,_0x550aa4){return db[_0x0abb('0x36')][_0x0abb('0x30')]({'where':{'id':_0xa3d327['params']['id']}})[_0x0abb('0x2a')](handleEntityNotFound(_0x29484d,null))[_0x0abb('0x2a')](function(_0x46660a){if(_0x46660a){return _0x46660a['removeLists'](_0xa3d327['query'][_0x0abb('0x83')]);}})[_0x0abb('0x2a')](function(_0x4d7742){if(_0x4d7742){return db[_0x0abb('0x62')][_0x0abb('0x29')]({'where':{'ListId':_0xa3d327['query'][_0x0abb('0x83')],'VoiceQueueId':_0xa3d327['params']['id']}})[_0x0abb('0x2a')](function(){return _0x4d7742;});}})[_0x0abb('0x2a')](respondWithStatusCode(_0x29484d,null))[_0x0abb('0x4e')](handleError(_0x29484d,null));};exports[_0x0abb('0xb5')]=function(_0x34565a,_0x330848,_0x18357f){var _0x21551a={};var _0x20c69e={};var _0x2b0071;var _0x492962;return db[_0x0abb('0x36')][_0x0abb('0x66')]({'where':{'id':_0x34565a[_0x0abb('0x5a')]['id']}})[_0x0abb('0x2a')](handleEntityNotFound(_0x330848,null))[_0x0abb('0x2a')](function(_0x554d29){if(_0x554d29){_0x2b0071=_0x554d29;_0x20c69e[_0x0abb('0x39')]=_[_0x0abb('0x3b')](db['CmList'][_0x0abb('0x37')]);_0x20c69e[_0x0abb('0x3a')]=_[_0x0abb('0x3b')](_0x34565a[_0x0abb('0x3a')]);_0x20c69e[_0x0abb('0x3c')]=_['intersection'](_0x20c69e[_0x0abb('0x39')],_0x20c69e['query']);_0x21551a[_0x0abb('0x3e')]=_[_0x0abb('0x3d')](_0x20c69e[_0x0abb('0x39')],qs[_0x0abb('0x3f')](_0x34565a[_0x0abb('0x3a')][_0x0abb('0x3f')]));_0x21551a[_0x0abb('0x3e')]=_0x21551a['attributes']['length']?_0x21551a[_0x0abb('0x3e')]:_0x20c69e[_0x0abb('0x39')];_0x21551a[_0x0abb('0x43')]=qs[_0x0abb('0x44')](_0x34565a[_0x0abb('0x3a')][_0x0abb('0x44')]);_0x21551a[_0x0abb('0x45')]=qs['filters'](_[_0x0abb('0x46')](_0x34565a[_0x0abb('0x3a')],_0x20c69e['filters']));if(_0x34565a['query'][_0x0abb('0x47')]){_0x21551a[_0x0abb('0x45')]=_[_0x0abb('0x5f')](_0x21551a['where'],{'$or':_[_0x0abb('0x2d')](_0x21551a[_0x0abb('0x3e')],function(_0x41edf8){var _0x73e908={};_0x73e908[_0x41edf8]={'$like':'%'+_0x34565a[_0x0abb('0x3a')]['filter']+'%'};return _0x73e908;})});}_0x21551a=_[_0x0abb('0x5f')]({},_0x21551a,_0x34565a['options']);return _0x2b0071['getBlackLists'](_0x21551a);}})[_0x0abb('0x2a')](function(_0x5acf02){if(_0x5acf02){_0x492962=_0x5acf02[_0x0abb('0x40')];if(!_0x34565a[_0x0abb('0x3a')][_0x0abb('0x41')](_0x0abb('0x42'))){_0x21551a[_0x0abb('0x23')]=qs['limit'](_0x34565a[_0x0abb('0x3a')][_0x0abb('0x23')]);_0x21551a['offset']=qs[_0x0abb('0x22')](_0x34565a[_0x0abb('0x3a')][_0x0abb('0x22')]);}return _0x2b0071[_0x0abb('0xb5')](_0x21551a);}})[_0x0abb('0x2a')](function(_0x16af98){if(_0x16af98){return _0x16af98?{'count':_0x492962,'rows':_0x16af98}:null;}})[_0x0abb('0x2a')](respondWithResult(_0x330848,null))[_0x0abb('0x4e')](handleError(_0x330848,null));};exports[_0x0abb('0xb6')]=function(_0x2fc1a9,_0x333480,_0x32c0ef){var _0x359e7d,_0x130de6;return db[_0x0abb('0x36')][_0x0abb('0x30')]({'where':{'id':_0x2fc1a9[_0x0abb('0x5a')]['id']}})[_0x0abb('0x2a')](handleEntityNotFound(_0x333480,null))[_0x0abb('0x2a')](function(_0x57b511){if(_0x57b511){_0x130de6=_0x57b511;return _0x57b511[_0x0abb('0xb6')](_0x2fc1a9[_0x0abb('0x5e')][_0x0abb('0x83')],_[_0x0abb('0x5b')](_0x2fc1a9[_0x0abb('0x5e')],[_0x0abb('0x83'),'id'])||{});}return null;})[_0x0abb('0x95')](function(_0x227955){var _0x589f45;_0x359e7d=_0x227955||[];var _0x20087a=[];if(_0x227955){for(var _0x5e5d74=0x0;_0x5e5d74<_0x227955[_0x0abb('0x40')];_0x5e5d74+=0x1){var _0xc8cab0=_0x227955[_0x5e5d74]['get']({'plain':!![]});_0x589f45=squel[_0x0abb('0x9f')]()['into'](_0x0abb('0xb7'))[_0x0abb('0xa1')]([_0x0abb('0xa2'),_0x0abb('0xa3'),'ListId',_0x0abb('0x63'),'createdAt',_0x0abb('0x5d')],squel[_0x0abb('0x84')]()[_0x0abb('0xa5')](_0x0abb('0xa2'),_0x0abb('0xa2'))['field']('id',_0x0abb('0xa3'))[_0x0abb('0xa5')](_0xc8cab0[_0x0abb('0xa6')]['toString'](),_0x0abb('0xa4'))['field'](_0x2fc1a9[_0x0abb('0x5a')]['id'][_0x0abb('0x8a')](),'VoiceQueueId')[_0x0abb('0xa5')](_0x0abb('0xa7'),_0x0abb('0x5c'))['field'](_0x0abb('0xa7'),_0x0abb('0x5d'))[_0x0abb('0xa8')](_0x0abb('0xa9'))[_0x0abb('0x45')](_0x0abb('0xaa'))[_0x0abb('0x45')](_0x0abb('0xb3'),_0xc8cab0[_0x0abb('0xa6')][_0x0abb('0x8a')]())[_0x0abb('0x45')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x20087a[_0x0abb('0x89')](db[_0x0abb('0x74')][_0x0abb('0x3a')](_0x589f45));}return BPromise[_0x0abb('0x90')](_0x20087a);}})[_0x0abb('0x2a')](function(){return _0x359e7d;})[_0x0abb('0x2a')](respondWithResult(_0x333480,null))[_0x0abb('0x4e')](handleError(_0x333480,null));};exports[_0x0abb('0xb8')]=function(_0x495287,_0x4aeb5e,_0x2892c3){return db[_0x0abb('0x36')][_0x0abb('0x30')]({'where':{'id':_0x495287[_0x0abb('0x5a')]['id']}})[_0x0abb('0x2a')](handleEntityNotFound(_0x4aeb5e,null))[_0x0abb('0x2a')](function(_0x345a26){if(_0x345a26){return _0x345a26[_0x0abb('0xb8')](_0x495287[_0x0abb('0x3a')][_0x0abb('0x83')]);}})[_0x0abb('0x2a')](function(_0x375c5a){if(_0x375c5a){return db[_0x0abb('0x6a')]['destroy']({'where':{'ListId':_0x495287[_0x0abb('0x3a')][_0x0abb('0x83')],'VoiceQueueId':_0x495287[_0x0abb('0x5a')]['id']}})[_0x0abb('0x2a')](function(){return _0x375c5a;});}})[_0x0abb('0x2a')](respondWithStatusCode(_0x4aeb5e,null))['catch'](handleError(_0x4aeb5e,null));}; \ No newline at end of file +var _0x3cbb=['getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','updatedAt','NOW()','ContactId','CmListId','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','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','destroy','get','VoiceQueues','QueueCampaigns','filter','ignore','map','value','includes','type','find','name','end','error','stack','index','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','includeAll','catch','fields','include','options','create','body','user','role','inbound','userProfileId','autoAssociation','UserProfileResource','clone','params','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','outbound','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','CmHopper','pick','findAll','rows','VoiceQueueId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','teams','User','Agents','voicePause','interface','flatMap','penalty','sequelize','transaction','addTeams','TeamVoiceQueue','findOrCreate','each','UserVoiceQueueRt','isNil','format','forEach','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','TeamId','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','omit','spread','online','push','SIP/%s','getAgents','getMembers'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x3cbb,0x198));var _0xb3cb=function(_0xb833b1,_0x1c3d3f){_0xb833b1=_0xb833b1-0x0;var _0x1ab87a=_0x3cbb[_0xb833b1];return _0x1ab87a;};'use strict';var emlformat=require(_0xb3cb('0x0'));var rimraf=require(_0xb3cb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb3cb('0x2'));var rp=require(_0xb3cb('0x3'));var moment=require(_0xb3cb('0x4'));var BPromise=require(_0xb3cb('0x5'));var Mustache=require(_0xb3cb('0x6'));var util=require(_0xb3cb('0x7'));var path=require(_0xb3cb('0x8'));var sox=require(_0xb3cb('0x9'));var csv=require(_0xb3cb('0xa'));var ejs=require(_0xb3cb('0xb'));var fs=require('fs');var fs_extra=require(_0xb3cb('0xc'));var _=require(_0xb3cb('0xd'));var squel=require(_0xb3cb('0xe'));var crypto=require(_0xb3cb('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xb3cb('0x10'));var toCsv=require(_0xb3cb('0xa'));var querystring=require(_0xb3cb('0x11'));var Papa=require(_0xb3cb('0x12'));var Redis=require(_0xb3cb('0x13'));var authService=require(_0xb3cb('0x14'));var qs=require(_0xb3cb('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb3cb('0x16'));var logger=require(_0xb3cb('0x17'))(_0xb3cb('0x18'));var utils=require(_0xb3cb('0x19'));var config=require(_0xb3cb('0x1a'));var licenseUtil=require(_0xb3cb('0x1b'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xb3cb('0x1c')](config[_0xb3cb('0x1d')],{'host':_0xb3cb('0x1e'),'port':0x18eb});var socket=require(_0xb3cb('0x1f'))(new Redis(config[_0xb3cb('0x1d')]));require(_0xb3cb('0x20'))[_0xb3cb('0x21')](socket);function respondWithStatusCode(_0x3ec8ed,_0x55a5a9){_0x55a5a9=_0x55a5a9||0xcc;return function(_0x223116){if(_0x223116){return _0x3ec8ed[_0xb3cb('0x22')](_0x55a5a9);}return _0x3ec8ed[_0xb3cb('0x23')](_0x55a5a9)['end']();};}function respondWithResult(_0xcb1cd2,_0x30ccaa){_0x30ccaa=_0x30ccaa||0xc8;return function(_0x147691){if(_0x147691){return _0xcb1cd2[_0xb3cb('0x23')](_0x30ccaa)['json'](_0x147691);}};}function respondWithFilteredResult(_0x47f75f,_0x25e720){return function(_0x48d3a0){if(_0x48d3a0){var _0x2322fc=typeof _0x25e720[_0xb3cb('0x24')]==='undefined'&&typeof _0x25e720['limit']===_0xb3cb('0x25');var _0x579b59=_0x48d3a0['count'];var _0x4e83db=_0x2322fc?0x0:_0x25e720['offset'];var _0x195e87=_0x2322fc?_0x48d3a0[_0xb3cb('0x26')]:_0x25e720[_0xb3cb('0x24')]+_0x25e720[_0xb3cb('0x27')];var _0x2d3939;if(_0x195e87>=_0x579b59){_0x195e87=_0x579b59;_0x2d3939=0xc8;}else{_0x2d3939=0xce;}_0x47f75f[_0xb3cb('0x23')](_0x2d3939);return _0x47f75f['set'](_0xb3cb('0x28'),_0x4e83db+'-'+_0x195e87+'/'+_0x579b59)[_0xb3cb('0x29')](_0x48d3a0);}return null;};}function patchUpdates(_0x18f659){return function(_0x3fbce0){try{jsonpatch[_0xb3cb('0x2a')](_0x3fbce0,_0x18f659,!![]);}catch(_0x1f6006){return BPromise[_0xb3cb('0x2b')](_0x1f6006);}return _0x3fbce0[_0xb3cb('0x2c')]();};}function saveUpdates(_0x51e29f,_0x37d082){return function(_0x36fbba){if(_0x36fbba){return _0x36fbba[_0xb3cb('0x2d')](_0x51e29f)[_0xb3cb('0x2e')](function(_0x2eb43d){return _0x2eb43d;});}return null;};}function removeEntity(_0x33c2b5,_0x2cb586){return function(_0x3e4057){if(_0x3e4057){return _0x3e4057[_0xb3cb('0x2f')]()['then'](function(){var _0x523448=_0x3e4057[_0xb3cb('0x30')]({'plain':!![]});var _0x5269d2=[{'name':_0xb3cb('0x31'),'value':'inbound','ignore':![]},{'name':_0xb3cb('0x32'),'value':'outbound','ignore':![]}];var _0x419ddc=_(_0x5269d2)[_0xb3cb('0x33')](_0xb3cb('0x34'))[_0xb3cb('0x35')](_0xb3cb('0x36'))[_0xb3cb('0x36')]();if(_[_0xb3cb('0x37')](_0x419ddc,_0x523448[_0xb3cb('0x38')])){return;}var _0x504f28=_[_0xb3cb('0x39')](_0x5269d2,['value',_0x523448['type']])[_0xb3cb('0x3a')];return db['UserProfileResource']['destroy']({'where':{'type':_0x504f28,'resourceId':_0x523448['id']}})[_0xb3cb('0x2e')](function(){return _0x3e4057;});})[_0xb3cb('0x2e')](function(){_0x33c2b5[_0xb3cb('0x23')](0xcc)[_0xb3cb('0x3b')]();});}};}function handleEntityNotFound(_0x359b2a,_0xd21405){return function(_0x15de5a){if(!_0x15de5a){_0x359b2a['sendStatus'](0x194);}return _0x15de5a;};}function handleError(_0x5071e2,_0x328544){_0x328544=_0x328544||0x1f4;return function(_0x3c6036){logger[_0xb3cb('0x3c')](_0x3c6036[_0xb3cb('0x3d')]);if(_0x3c6036[_0xb3cb('0x3a')]){delete _0x3c6036[_0xb3cb('0x3a')];}_0x5071e2[_0xb3cb('0x23')](_0x328544)['send'](_0x3c6036);};}exports[_0xb3cb('0x3e')]=function(_0x3067d8,_0x29e844){var _0x241bbd={},_0x4499ca={},_0x1b86c1={'count':0x0,'rows':[]};var _0x573f1c=_['map'](db[_0xb3cb('0x3f')][_0xb3cb('0x40')],function(_0x2bab38){return{'name':_0x2bab38[_0xb3cb('0x41')],'type':_0x2bab38[_0xb3cb('0x38')][_0xb3cb('0x42')]};});_0x4499ca[_0xb3cb('0x43')]=_[_0xb3cb('0x35')](_0x573f1c,_0xb3cb('0x3a'));_0x4499ca[_0xb3cb('0x44')]=_[_0xb3cb('0x45')](_0x3067d8[_0xb3cb('0x44')]);_0x4499ca[_0xb3cb('0x46')]=_[_0xb3cb('0x47')](_0x4499ca[_0xb3cb('0x43')],_0x4499ca['query']);_0x241bbd[_0xb3cb('0x48')]=_[_0xb3cb('0x47')](_0x4499ca[_0xb3cb('0x43')],qs['fields'](_0x3067d8[_0xb3cb('0x44')]['fields']));_0x241bbd[_0xb3cb('0x48')]=_0x241bbd[_0xb3cb('0x48')][_0xb3cb('0x49')]?_0x241bbd[_0xb3cb('0x48')]:_0x4499ca['model'];if(!_0x3067d8[_0xb3cb('0x44')][_0xb3cb('0x4a')](_0xb3cb('0x4b'))){_0x241bbd[_0xb3cb('0x27')]=qs[_0xb3cb('0x27')](_0x3067d8[_0xb3cb('0x44')]['limit']);_0x241bbd['offset']=qs[_0xb3cb('0x24')](_0x3067d8[_0xb3cb('0x44')][_0xb3cb('0x24')]);}_0x241bbd[_0xb3cb('0x4c')]=qs[_0xb3cb('0x4d')](_0x3067d8[_0xb3cb('0x44')][_0xb3cb('0x4d')]);_0x241bbd[_0xb3cb('0x4e')]=qs[_0xb3cb('0x46')](_['pick'](_0x3067d8['query'],_0x4499ca[_0xb3cb('0x46')]),_0x573f1c);if(_0x3067d8[_0xb3cb('0x44')][_0xb3cb('0x33')]){_0x241bbd[_0xb3cb('0x4e')]=_[_0xb3cb('0x4f')](_0x241bbd[_0xb3cb('0x4e')],{'$or':_[_0xb3cb('0x35')](_0x573f1c,function(_0x498991){if(_0x498991[_0xb3cb('0x38')]!=='VIRTUAL'){var _0x461b55={};_0x461b55[_0x498991[_0xb3cb('0x3a')]]={'$like':'%'+_0x3067d8[_0xb3cb('0x44')]['filter']+'%'};return _0x461b55;}})});}_0x241bbd=_['merge']({},_0x241bbd,_0x3067d8['options']);var _0x5b4281={'where':_0x241bbd[_0xb3cb('0x4e')]};return db[_0xb3cb('0x3f')]['count'](_0x5b4281)['then'](function(_0x3cb544){_0x1b86c1['count']=_0x3cb544;if(_0x3067d8[_0xb3cb('0x44')][_0xb3cb('0x50')]){_0x241bbd['include']=[{'all':!![]}];}return db[_0xb3cb('0x3f')]['findAll'](_0x241bbd);})[_0xb3cb('0x2e')](function(_0x46b1de){_0x1b86c1['rows']=_0x46b1de;return _0x1b86c1;})['then'](respondWithFilteredResult(_0x29e844,_0x241bbd))[_0xb3cb('0x51')](handleError(_0x29e844,null));};exports['show']=function(_0x39a2bb,_0x123d3d){var _0x2f59a0={'raw':![],'where':{'id':_0x39a2bb['params']['id']}},_0xa717b0={};_0xa717b0[_0xb3cb('0x43')]=_[_0xb3cb('0x45')](db['VoiceQueue'][_0xb3cb('0x40')]);_0xa717b0['query']=_[_0xb3cb('0x45')](_0x39a2bb[_0xb3cb('0x44')]);_0xa717b0['filters']=_['intersection'](_0xa717b0[_0xb3cb('0x43')],_0xa717b0[_0xb3cb('0x44')]);_0x2f59a0[_0xb3cb('0x48')]=_[_0xb3cb('0x47')](_0xa717b0[_0xb3cb('0x43')],qs[_0xb3cb('0x52')](_0x39a2bb[_0xb3cb('0x44')][_0xb3cb('0x52')]));_0x2f59a0['attributes']=_0x2f59a0[_0xb3cb('0x48')][_0xb3cb('0x49')]?_0x2f59a0['attributes']:_0xa717b0[_0xb3cb('0x43')];if(_0x39a2bb['query'][_0xb3cb('0x50')]){_0x2f59a0[_0xb3cb('0x53')]=[{'all':!![]}];}_0x2f59a0=_[_0xb3cb('0x4f')]({},_0x2f59a0,_0x39a2bb[_0xb3cb('0x54')]);return db[_0xb3cb('0x3f')][_0xb3cb('0x39')](_0x2f59a0)[_0xb3cb('0x2e')](handleEntityNotFound(_0x123d3d,null))[_0xb3cb('0x2e')](respondWithResult(_0x123d3d,null))[_0xb3cb('0x51')](handleError(_0x123d3d,null));};exports[_0xb3cb('0x55')]=function(_0x24f7da,_0x2dcb13){return db['VoiceQueue'][_0xb3cb('0x55')](_0x24f7da[_0xb3cb('0x56')],{})['then'](function(_0x1582e3){var _0x6798ac=_0x24f7da[_0xb3cb('0x57')][_0xb3cb('0x30')]({'plain':!![]});if(!_0x6798ac)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6798ac[_0xb3cb('0x58')]===_0xb3cb('0x57')){var _0xc8461d=_0x1582e3['get']({'plain':!![]});var _0x2dbe28=[{'name':_0xb3cb('0x31'),'value':_0xb3cb('0x59')},{'name':_0xb3cb('0x32'),'value':'outbound'}];var _0x3bc0e2=_[_0xb3cb('0x39')](_0x2dbe28,[_0xb3cb('0x36'),_0xc8461d['type']])[_0xb3cb('0x3a')];return db['UserProfileSection']['find']({'where':{'name':_0x3bc0e2,'userProfileId':_0x6798ac[_0xb3cb('0x5a')]},'raw':!![]})[_0xb3cb('0x2e')](function(_0x439c8d){if(_0x439c8d&&_0x439c8d[_0xb3cb('0x5b')]===0x0){return db[_0xb3cb('0x5c')][_0xb3cb('0x55')]({'name':_0xc8461d['name'],'resourceId':_0xc8461d['id'],'type':_0x439c8d[_0xb3cb('0x3a')],'sectionId':_0x439c8d['id']},{})[_0xb3cb('0x2e')](function(){return _0x1582e3;});}else{return _0x1582e3;}})[_0xb3cb('0x51')](function(_0x4ca720){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4ca720);throw _0x4ca720;});}return _0x1582e3;})[_0xb3cb('0x2e')](respondWithResult(_0x2dcb13,0xc9))['catch'](handleError(_0x2dcb13,null));};exports[_0xb3cb('0x5d')]=function(_0x54b96e,_0x5b1004){var _0x1ff87c={'where':{'id':_0x54b96e[_0xb3cb('0x5e')]['id']}},_0x350a0e={};_0x350a0e[_0xb3cb('0x43')]=_[_0xb3cb('0x45')](db['VoiceQueue'][_0xb3cb('0x40')]);_0x1ff87c['attributes']=_[_0xb3cb('0x47')](_0x350a0e[_0xb3cb('0x43')],qs[_0xb3cb('0x52')](_0x54b96e['query'][_0xb3cb('0x52')]));_0x1ff87c['attributes']=_0x1ff87c[_0xb3cb('0x48')][_0xb3cb('0x49')]?_0x1ff87c[_0xb3cb('0x48')]:_0x350a0e[_0xb3cb('0x43')];if(_0x54b96e[_0xb3cb('0x44')][_0xb3cb('0x50')]){_0x1ff87c['include']=[{'all':!![]}];}_0x1ff87c=_['merge']({},_0x1ff87c,_0x54b96e[_0xb3cb('0x54')]);return db[_0xb3cb('0x3f')][_0xb3cb('0x39')](_0x1ff87c)[_0xb3cb('0x2e')](handleEntityNotFound(_0x5b1004,null))[_0xb3cb('0x2e')](function(_0x252506){if(_0x252506){var _0x5824a4=_0x252506[_0xb3cb('0x30')]({'plain':!![]});_0x5824a4=qs['omit'](_0x5824a4,['id',_0xb3cb('0x5f'),'updatedAt']);_0x54b96e[_0xb3cb('0x56')]=_['omit'](_0x54b96e[_0xb3cb('0x56')],['id',_0xb3cb('0x5f'),'updatedAt']);return db[_0xb3cb('0x3f')]['create'](_[_0xb3cb('0x4f')](_0x5824a4,_0x54b96e[_0xb3cb('0x56')]),{'include':_0x54b96e[_0xb3cb('0x44')][_0xb3cb('0x50')]?[{'all':!![]}]:undefined})[_0xb3cb('0x2e')](function(_0x348ddf){var _0x28876e=_0x54b96e[_0xb3cb('0x57')][_0xb3cb('0x30')]({'plain':!![]});if(!_0x28876e)throw new Error(_0xb3cb('0x60'));if(_0x28876e[_0xb3cb('0x58')]===_0xb3cb('0x57')){var _0x58bf1b=_0x348ddf['get']({'plain':!![]});var _0x5ad2d1=[{'name':_0xb3cb('0x31'),'value':'inbound'},{'name':_0xb3cb('0x32'),'value':_0xb3cb('0x61')}];var _0x8733a7=_['find'](_0x5ad2d1,[_0xb3cb('0x36'),_0x58bf1b['type']])[_0xb3cb('0x3a')];return db[_0xb3cb('0x62')][_0xb3cb('0x39')]({'where':{'name':_0x8733a7,'userProfileId':_0x28876e['userProfileId']},'raw':!![]})[_0xb3cb('0x2e')](function(_0x529c6d){if(_0x529c6d&&_0x529c6d[_0xb3cb('0x5b')]===0x0){return db['UserProfileResource'][_0xb3cb('0x55')]({'name':_0x58bf1b[_0xb3cb('0x3a')],'resourceId':_0x58bf1b['id'],'type':_0x529c6d['name'],'sectionId':_0x529c6d['id']},{})[_0xb3cb('0x2e')](function(){return _0x348ddf;});}else{return _0x348ddf;}})[_0xb3cb('0x51')](function(_0x3a98e5){logger[_0xb3cb('0x3c')](_0xb3cb('0x63'),_0x3a98e5);throw _0x3a98e5;});}return _0x348ddf;});}})['then'](respondWithResult(_0x5b1004,0xc9))[_0xb3cb('0x51')](handleError(_0x5b1004,null));};exports['update']=function(_0xcf6a84,_0x244277){if(_0xcf6a84['body']['id']){delete _0xcf6a84[_0xb3cb('0x56')]['id'];}return db[_0xb3cb('0x3f')]['find']({'where':{'id':_0xcf6a84[_0xb3cb('0x5e')]['id']}})[_0xb3cb('0x2e')](handleEntityNotFound(_0x244277,null))[_0xb3cb('0x2e')](saveUpdates(_0xcf6a84['body'],null))['then'](respondWithResult(_0x244277,null))[_0xb3cb('0x51')](handleError(_0x244277,null));};exports['destroy']=function(_0x54a072,_0x4f9f13){return db[_0xb3cb('0x3f')]['find']({'where':{'id':_0x54a072['params']['id']}})['then'](handleEntityNotFound(_0x4f9f13,null))[_0xb3cb('0x2e')](removeEntity(_0x4f9f13,null))[_0xb3cb('0x51')](handleError(_0x4f9f13,null));};exports['getHoppers']=function(_0x1149de,_0x1b9bdd,_0x269fac){var _0x4d132f={'raw':![],'where':{}};var _0x25c50c={};var _0x5d7416={'count':0x0,'rows':[]};return db[_0xb3cb('0x3f')][_0xb3cb('0x64')]({'where':{'id':_0x1149de[_0xb3cb('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1b9bdd,null))[_0xb3cb('0x2e')](function(_0x1c92a3){if(_0x1c92a3){_0x25c50c['model']=_[_0xb3cb('0x45')](db[_0xb3cb('0x65')][_0xb3cb('0x40')]);_0x25c50c[_0xb3cb('0x44')]=_[_0xb3cb('0x45')](_0x1149de[_0xb3cb('0x44')]);_0x25c50c[_0xb3cb('0x46')]=_[_0xb3cb('0x47')](_0x25c50c[_0xb3cb('0x43')],_0x25c50c[_0xb3cb('0x44')]);_0x4d132f['attributes']=_[_0xb3cb('0x47')](_0x25c50c[_0xb3cb('0x43')],qs[_0xb3cb('0x52')](_0x1149de['query'][_0xb3cb('0x52')]));_0x4d132f['attributes']=_0x4d132f['attributes'][_0xb3cb('0x49')]?_0x4d132f['attributes']:_0x25c50c[_0xb3cb('0x43')];if(!_0x1149de['query']['hasOwnProperty'](_0xb3cb('0x4b'))){_0x4d132f[_0xb3cb('0x27')]=qs[_0xb3cb('0x27')](_0x1149de[_0xb3cb('0x44')][_0xb3cb('0x27')]);_0x4d132f['offset']=qs[_0xb3cb('0x24')](_0x1149de[_0xb3cb('0x44')]['offset']);}_0x4d132f[_0xb3cb('0x4c')]=qs[_0xb3cb('0x4d')](_0x1149de[_0xb3cb('0x44')][_0xb3cb('0x4d')]);_0x4d132f[_0xb3cb('0x4e')]=qs[_0xb3cb('0x46')](_[_0xb3cb('0x66')](_0x1149de[_0xb3cb('0x44')],_0x25c50c['filters']));_0x4d132f[_0xb3cb('0x4e')]['VoiceQueueId']=_0x1c92a3['id'];if(_0x1149de[_0xb3cb('0x44')][_0xb3cb('0x33')]){_0x4d132f[_0xb3cb('0x4e')]=_['merge'](_0x4d132f['where'],{'$or':_[_0xb3cb('0x35')](_0x4d132f[_0xb3cb('0x48')],function(_0x5896cb){var _0x25d281={};_0x25d281[_0x5896cb]={'$like':'%'+_0x1149de[_0xb3cb('0x44')][_0xb3cb('0x33')]+'%'};return _0x25d281;})});}_0x4d132f=_[_0xb3cb('0x4f')]({},_0x4d132f,_0x1149de[_0xb3cb('0x54')]);return db['CmHopper'][_0xb3cb('0x26')]({'where':_0x4d132f['where']})[_0xb3cb('0x2e')](function(_0x28e348){_0x5d7416['count']=_0x28e348;if(_0x1149de['query'][_0xb3cb('0x50')]){_0x4d132f[_0xb3cb('0x53')]=[{'all':!![]}];}return db[_0xb3cb('0x65')][_0xb3cb('0x67')](_0x4d132f);})['then'](function(_0x2c9eaa){_0x5d7416[_0xb3cb('0x68')]=_0x2c9eaa;return _0x5d7416;});}})[_0xb3cb('0x2e')](respondWithFilteredResult(_0x1b9bdd,_0x4d132f))['catch'](handleError(_0x1b9bdd,null));};exports['getHopperHistories']=function(_0x100ec1,_0x109c58,_0x264274){var _0x4b440e={'raw':!![],'where':{}};var _0x3b6f00={};var _0x498baf={'count':0x0,'rows':[]};return db[_0xb3cb('0x3f')][_0xb3cb('0x64')]({'where':{'id':_0x100ec1['params']['id']}})['then'](handleEntityNotFound(_0x109c58,null))[_0xb3cb('0x2e')](function(_0x1770c7){if(_0x1770c7){_0x3b6f00[_0xb3cb('0x43')]=_[_0xb3cb('0x45')](db['CmHopperHistory'][_0xb3cb('0x40')]);_0x3b6f00['query']=_[_0xb3cb('0x45')](_0x100ec1[_0xb3cb('0x44')]);_0x3b6f00[_0xb3cb('0x46')]=_[_0xb3cb('0x47')](_0x3b6f00['model'],_0x3b6f00[_0xb3cb('0x44')]);_0x4b440e[_0xb3cb('0x48')]=_[_0xb3cb('0x47')](_0x3b6f00[_0xb3cb('0x43')],qs[_0xb3cb('0x52')](_0x100ec1[_0xb3cb('0x44')]['fields']));_0x4b440e[_0xb3cb('0x48')]=_0x4b440e[_0xb3cb('0x48')][_0xb3cb('0x49')]?_0x4b440e[_0xb3cb('0x48')]:_0x3b6f00['model'];if(!_0x100ec1['query'][_0xb3cb('0x4a')](_0xb3cb('0x4b'))){_0x4b440e[_0xb3cb('0x27')]=qs['limit'](_0x100ec1['query'][_0xb3cb('0x27')]);_0x4b440e[_0xb3cb('0x24')]=qs[_0xb3cb('0x24')](_0x100ec1[_0xb3cb('0x44')][_0xb3cb('0x24')]);}_0x4b440e[_0xb3cb('0x4c')]=qs[_0xb3cb('0x4d')](_0x100ec1[_0xb3cb('0x44')][_0xb3cb('0x4d')]);_0x4b440e[_0xb3cb('0x4e')]=qs[_0xb3cb('0x46')](_[_0xb3cb('0x66')](_0x100ec1[_0xb3cb('0x44')],_0x3b6f00[_0xb3cb('0x46')]));_0x4b440e[_0xb3cb('0x4e')][_0xb3cb('0x69')]=_0x1770c7['id'];if(_0x100ec1[_0xb3cb('0x44')][_0xb3cb('0x33')]){_0x4b440e[_0xb3cb('0x4e')]=_['merge'](_0x4b440e[_0xb3cb('0x4e')],{'$or':_[_0xb3cb('0x35')](_0x4b440e[_0xb3cb('0x48')],function(_0x2d91ef){var _0x1375c5={};_0x1375c5[_0x2d91ef]={'$like':'%'+_0x100ec1[_0xb3cb('0x44')][_0xb3cb('0x33')]+'%'};return _0x1375c5;})});}_0x4b440e=_[_0xb3cb('0x4f')]({},_0x4b440e,_0x100ec1[_0xb3cb('0x54')]);return db[_0xb3cb('0x6a')][_0xb3cb('0x26')]({'where':_0x4b440e[_0xb3cb('0x4e')]})[_0xb3cb('0x2e')](function(_0x936a82){_0x498baf[_0xb3cb('0x26')]=_0x936a82;if(_0x100ec1[_0xb3cb('0x44')][_0xb3cb('0x50')]){_0x4b440e['include']=[{'all':!![]}];}return db[_0xb3cb('0x6a')][_0xb3cb('0x67')](_0x4b440e);})['then'](function(_0x1ef386){_0x498baf[_0xb3cb('0x68')]=_0x1ef386;return _0x498baf;});}})[_0xb3cb('0x2e')](respondWithFilteredResult(_0x109c58,_0x4b440e))['catch'](handleError(_0x109c58,null));};exports[_0xb3cb('0x6b')]=function(_0xf8a5c3,_0x409bd3,_0x1d7d04){var _0x3430a9={'raw':!![],'where':{}};var _0x2b0b1e={};var _0x4409bf={'count':0x0,'rows':[]};return db[_0xb3cb('0x3f')][_0xb3cb('0x64')]({'where':{'id':_0xf8a5c3[_0xb3cb('0x5e')]['id']}})['then'](handleEntityNotFound(_0x409bd3,null))[_0xb3cb('0x2e')](function(_0x4570f6){if(_0x4570f6){_0x2b0b1e[_0xb3cb('0x43')]=_[_0xb3cb('0x45')](db['CmHopperFinal'][_0xb3cb('0x40')]);_0x2b0b1e[_0xb3cb('0x44')]=_[_0xb3cb('0x45')](_0xf8a5c3[_0xb3cb('0x44')]);_0x2b0b1e[_0xb3cb('0x46')]=_['intersection'](_0x2b0b1e['model'],_0x2b0b1e[_0xb3cb('0x44')]);_0x3430a9['attributes']=_[_0xb3cb('0x47')](_0x2b0b1e[_0xb3cb('0x43')],qs[_0xb3cb('0x52')](_0xf8a5c3[_0xb3cb('0x44')][_0xb3cb('0x52')]));_0x3430a9[_0xb3cb('0x48')]=_0x3430a9['attributes']['length']?_0x3430a9['attributes']:_0x2b0b1e['model'];if(!_0xf8a5c3[_0xb3cb('0x44')][_0xb3cb('0x4a')](_0xb3cb('0x4b'))){_0x3430a9[_0xb3cb('0x27')]=qs['limit'](_0xf8a5c3[_0xb3cb('0x44')]['limit']);_0x3430a9[_0xb3cb('0x24')]=qs['offset'](_0xf8a5c3[_0xb3cb('0x44')][_0xb3cb('0x24')]);}_0x3430a9[_0xb3cb('0x4c')]=qs[_0xb3cb('0x4d')](_0xf8a5c3[_0xb3cb('0x44')][_0xb3cb('0x4d')]);_0x3430a9[_0xb3cb('0x4e')]=qs[_0xb3cb('0x46')](_[_0xb3cb('0x66')](_0xf8a5c3[_0xb3cb('0x44')],_0x2b0b1e[_0xb3cb('0x46')]));_0x3430a9[_0xb3cb('0x4e')][_0xb3cb('0x69')]=_0x4570f6['id'];if(_0xf8a5c3[_0xb3cb('0x44')]['filter']){_0x3430a9['where']=_[_0xb3cb('0x4f')](_0x3430a9['where'],{'$or':_[_0xb3cb('0x35')](_0x3430a9[_0xb3cb('0x48')],function(_0x5a086){var _0x1dc6b9={};_0x1dc6b9[_0x5a086]={'$like':'%'+_0xf8a5c3[_0xb3cb('0x44')][_0xb3cb('0x33')]+'%'};return _0x1dc6b9;})});}_0x3430a9=_[_0xb3cb('0x4f')]({},_0x3430a9,_0xf8a5c3['options']);return db[_0xb3cb('0x6c')][_0xb3cb('0x26')]({'where':_0x3430a9[_0xb3cb('0x4e')]})['then'](function(_0x3839d1){_0x4409bf[_0xb3cb('0x26')]=_0x3839d1;if(_0xf8a5c3[_0xb3cb('0x44')][_0xb3cb('0x50')]){_0x3430a9[_0xb3cb('0x53')]=[{'all':!![]}];}return db[_0xb3cb('0x6c')][_0xb3cb('0x67')](_0x3430a9);})[_0xb3cb('0x2e')](function(_0x1fb8ea){_0x4409bf[_0xb3cb('0x68')]=_0x1fb8ea;return _0x4409bf;});}})[_0xb3cb('0x2e')](respondWithFilteredResult(_0x409bd3,_0x3430a9))[_0xb3cb('0x51')](handleError(_0x409bd3,null));};exports[_0xb3cb('0x6d')]=function(_0x15d5ed,_0x653102,_0xb01d00){var _0xf8efb9={'raw':!![],'where':{}};var _0x10b162={};var _0x295018={'count':0x0,'rows':[]};return db[_0xb3cb('0x3f')][_0xb3cb('0x64')]({'where':{'id':_0x15d5ed[_0xb3cb('0x5e')]['id']}})[_0xb3cb('0x2e')](handleEntityNotFound(_0x653102,null))[_0xb3cb('0x2e')](function(_0x46d9d4){if(_0x46d9d4){_0x10b162[_0xb3cb('0x43')]=_[_0xb3cb('0x45')](db['CmHopperBlack'][_0xb3cb('0x40')]);_0x10b162[_0xb3cb('0x44')]=_['keys'](_0x15d5ed['query']);_0x10b162[_0xb3cb('0x46')]=_[_0xb3cb('0x47')](_0x10b162[_0xb3cb('0x43')],_0x10b162[_0xb3cb('0x44')]);_0xf8efb9['attributes']=_[_0xb3cb('0x47')](_0x10b162[_0xb3cb('0x43')],qs[_0xb3cb('0x52')](_0x15d5ed[_0xb3cb('0x44')][_0xb3cb('0x52')]));_0xf8efb9[_0xb3cb('0x48')]=_0xf8efb9[_0xb3cb('0x48')][_0xb3cb('0x49')]?_0xf8efb9['attributes']:_0x10b162[_0xb3cb('0x43')];if(!_0x15d5ed[_0xb3cb('0x44')][_0xb3cb('0x4a')](_0xb3cb('0x4b'))){_0xf8efb9[_0xb3cb('0x27')]=qs[_0xb3cb('0x27')](_0x15d5ed[_0xb3cb('0x44')][_0xb3cb('0x27')]);_0xf8efb9[_0xb3cb('0x24')]=qs[_0xb3cb('0x24')](_0x15d5ed['query']['offset']);}_0xf8efb9[_0xb3cb('0x4c')]=qs[_0xb3cb('0x4d')](_0x15d5ed['query'][_0xb3cb('0x4d')]);_0xf8efb9[_0xb3cb('0x4e')]=qs[_0xb3cb('0x46')](_[_0xb3cb('0x66')](_0x15d5ed[_0xb3cb('0x44')],_0x10b162['filters']));_0xf8efb9[_0xb3cb('0x4e')][_0xb3cb('0x69')]=_0x46d9d4['id'];if(_0x15d5ed[_0xb3cb('0x44')][_0xb3cb('0x33')]){_0xf8efb9[_0xb3cb('0x4e')]=_['merge'](_0xf8efb9['where'],{'$or':_[_0xb3cb('0x35')](_0xf8efb9[_0xb3cb('0x48')],function(_0x1cbe53){var _0x5a39f8={};_0x5a39f8[_0x1cbe53]={'$like':'%'+_0x15d5ed['query']['filter']+'%'};return _0x5a39f8;})});}_0xf8efb9=_['merge']({},_0xf8efb9,_0x15d5ed[_0xb3cb('0x54')]);return db['CmHopperBlack'][_0xb3cb('0x26')]({'where':_0xf8efb9[_0xb3cb('0x4e')]})[_0xb3cb('0x2e')](function(_0x22ce02){_0x295018[_0xb3cb('0x26')]=_0x22ce02;if(_0x15d5ed[_0xb3cb('0x44')]['includeAll']){_0xf8efb9[_0xb3cb('0x53')]=[{'all':!![]}];}return db[_0xb3cb('0x6e')][_0xb3cb('0x67')](_0xf8efb9);})['then'](function(_0x256c10){_0x295018['rows']=_0x256c10;return _0x295018;});}})['then'](respondWithFilteredResult(_0x653102,_0xf8efb9))['catch'](handleError(_0x653102,null));};exports[_0xb3cb('0x6f')]=function(_0x15b641,_0x37f8c4,_0xb76532){var _0x12a80b={};var _0x17f181={};var _0x45e94e;var _0x46b672;return db[_0xb3cb('0x3f')]['findOne']({'where':{'id':_0x15b641[_0xb3cb('0x5e')]['id']}})[_0xb3cb('0x2e')](handleEntityNotFound(_0x37f8c4,null))[_0xb3cb('0x2e')](function(_0x2af1be){if(_0x2af1be){_0x45e94e=_0x2af1be;_0x17f181[_0xb3cb('0x43')]=_[_0xb3cb('0x45')](db[_0xb3cb('0x70')][_0xb3cb('0x40')]);_0x17f181['query']=_['keys'](_0x15b641[_0xb3cb('0x44')]);_0x17f181[_0xb3cb('0x46')]=_[_0xb3cb('0x47')](_0x17f181['model'],_0x17f181[_0xb3cb('0x44')]);_0x12a80b[_0xb3cb('0x48')]=_['intersection'](_0x17f181['model'],qs['fields'](_0x15b641['query']['fields']));_0x12a80b[_0xb3cb('0x48')]=_0x12a80b['attributes']['length']?_0x12a80b[_0xb3cb('0x48')]:_0x17f181[_0xb3cb('0x43')];_0x12a80b[_0xb3cb('0x4c')]=qs[_0xb3cb('0x4d')](_0x15b641[_0xb3cb('0x44')][_0xb3cb('0x4d')]);_0x12a80b[_0xb3cb('0x4e')]=qs[_0xb3cb('0x46')](_[_0xb3cb('0x66')](_0x15b641[_0xb3cb('0x44')],_0x17f181[_0xb3cb('0x46')]));if(_0x15b641[_0xb3cb('0x44')][_0xb3cb('0x33')]){_0x12a80b['where']=_['merge'](_0x12a80b[_0xb3cb('0x4e')],{'$or':_[_0xb3cb('0x35')](_0x12a80b[_0xb3cb('0x48')],function(_0x4ad994){var _0x405a37={};_0x405a37[_0x4ad994]={'$like':'%'+_0x15b641[_0xb3cb('0x44')][_0xb3cb('0x33')]+'%'};return _0x405a37;})});}_0x12a80b=_[_0xb3cb('0x4f')]({},_0x12a80b,_0x15b641[_0xb3cb('0x54')]);return _0x45e94e[_0xb3cb('0x6f')](_0x12a80b);}})['then'](function(_0x1af693){if(_0x1af693){_0x46b672=_0x1af693[_0xb3cb('0x49')];if(!_0x15b641[_0xb3cb('0x44')][_0xb3cb('0x4a')](_0xb3cb('0x4b'))){_0x12a80b[_0xb3cb('0x27')]=qs[_0xb3cb('0x27')](_0x15b641['query'][_0xb3cb('0x27')]);_0x12a80b[_0xb3cb('0x24')]=qs[_0xb3cb('0x24')](_0x15b641[_0xb3cb('0x44')][_0xb3cb('0x24')]);}return _0x45e94e[_0xb3cb('0x6f')](_0x12a80b);}})[_0xb3cb('0x2e')](function(_0x7b8177){if(_0x7b8177){return _0x7b8177?{'count':_0x46b672,'rows':_0x7b8177}:null;}})[_0xb3cb('0x2e')](respondWithResult(_0x37f8c4,null))[_0xb3cb('0x51')](handleError(_0x37f8c4,null));};exports['addTeams']=function(_0x4c1a49,_0x505370,_0x52119a){var _0x51cb8c=_0x4c1a49[_0xb3cb('0x56')][_0xb3cb('0x71')];var _0x5fdf6b=_[_0xb3cb('0x35')](_0x51cb8c,'id');return db['Team']['findAll']({'where':{'id':_0x5fdf6b},'attributes':['id'],'include':[{'model':db[_0xb3cb('0x72')],'as':_0xb3cb('0x73'),'attributes':['id','name','online',_0xb3cb('0x74'),_0xb3cb('0x75')],'raw':!![]}]})[_0xb3cb('0x2e')](function(_0x404378){if(_0x404378){var _0x33de85=_[_0xb3cb('0x76')](_0x404378,function(_0x35514b){var _0x2549ac=_0x35514b['get']({'plain':!![]});_0x2549ac['Agents']['forEach'](function(_0x4012dd){_0x4012dd[_0xb3cb('0x77')]=_['find'](_0x51cb8c,{'id':_0x2549ac['id']})[_0xb3cb('0x77')];});return _0x2549ac[_0xb3cb('0x73')];});return db['VoiceQueue']['find']({'where':{'id':_0x4c1a49[_0xb3cb('0x5e')]['id']}})[_0xb3cb('0x2e')](function(_0x6d047a){return db[_0xb3cb('0x78')][_0xb3cb('0x79')](function(_0x49facc){return _0x6d047a[_0xb3cb('0x7a')](_0x5fdf6b,{'transaction':_0x49facc})[_0xb3cb('0x2e')](function(){return BPromise['each'](_0x51cb8c,function(_0x4b068b){return db[_0xb3cb('0x7b')]['upsert']({'TeamId':_0x4b068b['id'],'VoiceQueueId':_0x4c1a49[_0xb3cb('0x5e')]['id'],'penalty':_0x4b068b['penalty']},{'transaction':_0x49facc});});})[_0xb3cb('0x2e')](function(){return BPromise['each'](_0x33de85,function(_0x524efe){return db['UserVoiceQueue'][_0xb3cb('0x7c')]({'where':{'UserId':_0x524efe['id'],'VoiceQueueId':_0x4c1a49[_0xb3cb('0x5e')]['id']},'defaults':{'penalty':_0x524efe[_0xb3cb('0x77')]},'transaction':_0x49facc});});})[_0xb3cb('0x2e')](function(){return BPromise[_0xb3cb('0x7d')](_[_0xb3cb('0x33')](_0x33de85,{'online':!![]}),function(_0x4c6036){return db[_0xb3cb('0x7e')]['upsert']({'membername':_0x4c6036[_0xb3cb('0x3a')],'UserId':_0x4c6036['id'],'queue_name':_0x6d047a[_0xb3cb('0x3a')],'VoiceQueueId':_0x6d047a['id'],'interface':_[_0xb3cb('0x7f')](_0x4c6036[_0xb3cb('0x75')])?util[_0xb3cb('0x80')]('SIP/%s',_0x4c6036[_0xb3cb('0x3a')]):_0x4c6036['interface'],'paused':_0x4c6036['voicePause']||![],'penalty':_0x4c6036[_0xb3cb('0x77')]},{'transaction':_0x49facc});});})[_0xb3cb('0x2e')](function(){_0x33de85[_0xb3cb('0x81')](function(_0x300113){socket[_0xb3cb('0x82')](_0xb3cb('0x83'),{'UserId':_0x300113['id'],'VoiceQueueId':_0x6d047a['id']});});});});});}})['then'](respondWithStatusCode(_0x505370,null))[_0xb3cb('0x51')](handleError(_0x505370,null));};exports[_0xb3cb('0x84')]=function(_0x58b3ea,_0x1d62d3,_0x2d1930){return db[_0xb3cb('0x70')]['findAll']({'where':{'id':_0x58b3ea[_0xb3cb('0x44')][_0xb3cb('0x85')]},'attributes':['id'],'include':[{'model':db[_0xb3cb('0x72')],'as':_0xb3cb('0x73'),'attributes':['id'],'raw':!![]}]})[_0xb3cb('0x2e')](handleEntityNotFound(_0x1d62d3,null))['then'](function(_0x3e0e5e){var _0x4afd6a=_[_0xb3cb('0x35')](_0x3e0e5e,'id');var _0x913982=[];var _0x2ae17a=[];var _0x5cf64d=squel[_0xb3cb('0x86')]();_0x5cf64d[_0xb3cb('0x87')](_0xb3cb('0x88'))['from'](_0xb3cb('0x89'),'tq')[_0xb3cb('0x8a')](_0xb3cb('0x8b'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xb3cb('0x8c'),_0x58b3ea[_0xb3cb('0x5e')]['id']);for(var _0xab8ce1=0x0;_0xab8ce1<_0x3e0e5e[_0xb3cb('0x49')];_0xab8ce1+=0x1){let _0x8dadaa=_0x3e0e5e[_0xab8ce1];for(var _0x26e7a9=0x0;_0x26e7a9<_0x8dadaa[_0xb3cb('0x73')]['length'];_0x26e7a9+=0x1){let _0x3a03a6=_0x8dadaa['Agents'][_0x26e7a9];var _0x14117a=_0x5cf64d['clone']();_0x14117a['where'](_0xb3cb('0x8d'),_0x3a03a6['id']);_0x2ae17a['push'](db['sequelize']['query'](_0x14117a[_0xb3cb('0x8e')](),{'type':db[_0xb3cb('0x78')][_0xb3cb('0x8f')]['SELECT']})[_0xb3cb('0x2e')](function(_0x5cb194){if(_0x5cb194[_0xb3cb('0x49')]===0x1){return _0x3a03a6['id'];}else{var _0x43a9c7=_['every'](_[_0xb3cb('0x35')](_0x5cb194,_0xb3cb('0x90')),function(_0x403529){return _[_0xb3cb('0x37')](_0x4afd6a,_0x403529);});if(_0x43a9c7){return _0x3a03a6['id'];}}}));}}return BPromise[_0xb3cb('0x91')](_0x2ae17a)[_0xb3cb('0x2e')](function(_0x500701){_0x913982=_(_0x913982)[_0xb3cb('0x92')](_0x500701)[_0xb3cb('0x93')]()[_0xb3cb('0x36')]();return db[_0xb3cb('0x3f')][_0xb3cb('0x39')]({'where':{'id':_0x58b3ea[_0xb3cb('0x5e')]['id']}})[_0xb3cb('0x2e')](function(_0x9f5af7){return db[_0xb3cb('0x78')][_0xb3cb('0x79')](function(_0x292751){return _0x9f5af7['removeTeams'](_0x58b3ea[_0xb3cb('0x44')][_0xb3cb('0x85')],{'transaction':_0x292751})[_0xb3cb('0x2e')](function(){if(!_[_0xb3cb('0x94')](_0x913982)){return _0x9f5af7[_0xb3cb('0x95')](_0x913982,{'transaction':_0x292751})[_0xb3cb('0x2e')](function(){return db[_0xb3cb('0x7e')]['destroy']({'where':{'VoiceQueueId':_0x58b3ea['params']['id'],'UserId':_0x913982},'transaction':_0x292751});});}})[_0xb3cb('0x2e')](function(){_0x913982[_0xb3cb('0x81')](function(_0x1bfaed){socket[_0xb3cb('0x82')](_0xb3cb('0x96'),{'UserId':_0x1bfaed,'VoiceQueueId':_0x9f5af7['id']});});});});});});})[_0xb3cb('0x2e')](respondWithStatusCode(_0x1d62d3,null))[_0xb3cb('0x51')](handleError(_0x1d62d3,null));};exports[_0xb3cb('0x97')]=function(_0x345cfd,_0x33e712,_0x3d5a15){var _0x1e4d5f,_0x46352e;return db[_0xb3cb('0x3f')][_0xb3cb('0x39')]({'where':{'id':_0x345cfd[_0xb3cb('0x5e')]['id']}})[_0xb3cb('0x2e')](handleEntityNotFound(_0x33e712,null))[_0xb3cb('0x2e')](function(_0x2c4b6e){if(_0x2c4b6e){_0x46352e=_0x2c4b6e;return _0x2c4b6e[_0xb3cb('0x97')](_0x345cfd[_0xb3cb('0x56')][_0xb3cb('0x85')],_[_0xb3cb('0x98')](_0x345cfd[_0xb3cb('0x56')],[_0xb3cb('0x85'),'id'])||{})[_0xb3cb('0x99')](function(_0x3f6256){for(var _0x399907=0x0;_0x399907<_0x345cfd['body'][_0xb3cb('0x85')][_0xb3cb('0x49')];_0x399907+=0x1){socket[_0xb3cb('0x82')]('userVoiceQueue:save',{'UserId':Number(_0x345cfd[_0xb3cb('0x56')][_0xb3cb('0x85')][_0x399907]),'VoiceQueueId':Number(_0x345cfd[_0xb3cb('0x5e')]['id'])});}return _0x3f6256;});}})[_0xb3cb('0x2e')](function(_0x11b183){_0x1e4d5f=_0x11b183||[];if(_0x46352e){return db['User'][_0xb3cb('0x67')]({'where':{'id':_0x345cfd[_0xb3cb('0x56')][_0xb3cb('0x85')]},'attributes':['id',_0xb3cb('0x3a'),_0xb3cb('0x9a'),_0xb3cb('0x74'),'interface'],'raw':!![]});}})[_0xb3cb('0x2e')](function(_0x5f59bb){if(!_['isEmpty'](_0x5f59bb)){var _0x285e6f=[];for(var _0x150373=0x0;_0x150373<_0x5f59bb[_0xb3cb('0x49')];_0x150373++){if(_0x5f59bb[_0x150373][_0xb3cb('0x9a')]){_0x285e6f[_0xb3cb('0x9b')](db[_0xb3cb('0x7e')]['upsert']({'membername':_0x5f59bb[_0x150373][_0xb3cb('0x3a')],'UserId':_0x5f59bb[_0x150373]['id'],'queue_name':_0x46352e[_0xb3cb('0x3a')],'VoiceQueueId':_0x46352e['id'],'interface':_[_0xb3cb('0x7f')](_0x5f59bb[_0x150373][_0xb3cb('0x75')])?util[_0xb3cb('0x80')](_0xb3cb('0x9c'),_0x5f59bb[_0x150373][_0xb3cb('0x3a')]):_0x5f59bb[_0x150373][_0xb3cb('0x75')],'paused':_0x5f59bb[_0x150373][_0xb3cb('0x74')]||![],'penalty':_0x345cfd[_0xb3cb('0x56')][_0xb3cb('0x77')]||0x0}));}}return BPromise[_0xb3cb('0x91')](_0x285e6f);}})[_0xb3cb('0x2e')](function(){return _0x1e4d5f;})[_0xb3cb('0x2e')](respondWithResult(_0x33e712,null))['catch'](handleError(_0x33e712,null));};exports[_0xb3cb('0x95')]=function(_0x4a204a,_0x4c2950,_0x1cf879){return db[_0xb3cb('0x3f')][_0xb3cb('0x39')]({'where':{'id':_0x4a204a[_0xb3cb('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4c2950,null))[_0xb3cb('0x2e')](function(_0x1b997c){if(_0x1b997c){return _0x1b997c[_0xb3cb('0x95')](_0x4a204a[_0xb3cb('0x44')]['ids'])['then'](function(){if(_['isArray'](_0x4a204a['query'][_0xb3cb('0x85')])){for(var _0x4e45c7=0x0;_0x4e45c7<_0x4a204a[_0xb3cb('0x44')][_0xb3cb('0x85')]['length'];_0x4e45c7+=0x1){socket[_0xb3cb('0x82')](_0xb3cb('0x96'),{'UserId':Number(_0x4a204a[_0xb3cb('0x44')][_0xb3cb('0x85')][_0x4e45c7]),'VoiceQueueId':Number(_0x4a204a[_0xb3cb('0x5e')]['id'])});}}else{socket[_0xb3cb('0x82')](_0xb3cb('0x96'),{'UserId':Number(_0x4a204a[_0xb3cb('0x44')][_0xb3cb('0x85')]),'VoiceQueueId':Number(_0x4a204a[_0xb3cb('0x5e')]['id'])});}});}})[_0xb3cb('0x2e')](function(_0x56780a){return db[_0xb3cb('0x7e')][_0xb3cb('0x2f')]({'where':{'VoiceQueueId':_0x4a204a[_0xb3cb('0x5e')]['id'],'UserId':_0x4a204a[_0xb3cb('0x44')][_0xb3cb('0x85')]}})[_0xb3cb('0x2e')](function(){return _0x56780a;});})[_0xb3cb('0x2e')](respondWithStatusCode(_0x4c2950,null))['catch'](handleError(_0x4c2950,null));};exports[_0xb3cb('0x9d')]=function(_0x4fd9bd,_0x1bb56f,_0x14a8a6){var _0x3c7f00={};var _0x220e5e={};var _0x4d9e31;var _0x4a64c4;return db[_0xb3cb('0x3f')]['findOne']({'where':{'id':_0x4fd9bd[_0xb3cb('0x5e')]['id']}})[_0xb3cb('0x2e')](handleEntityNotFound(_0x1bb56f,null))[_0xb3cb('0x2e')](function(_0x298e51){if(_0x298e51){_0x4d9e31=_0x298e51;_0x220e5e[_0xb3cb('0x43')]=_[_0xb3cb('0x45')](db['User'][_0xb3cb('0x40')]);_0x220e5e[_0xb3cb('0x44')]=_[_0xb3cb('0x45')](_0x4fd9bd[_0xb3cb('0x44')]);_0x220e5e[_0xb3cb('0x46')]=_[_0xb3cb('0x47')](_0x220e5e[_0xb3cb('0x43')],_0x220e5e[_0xb3cb('0x44')]);_0x3c7f00[_0xb3cb('0x48')]=_['intersection'](_0x220e5e[_0xb3cb('0x43')],qs[_0xb3cb('0x52')](_0x4fd9bd[_0xb3cb('0x44')][_0xb3cb('0x52')]));_0x3c7f00[_0xb3cb('0x48')]=_0x3c7f00['attributes'][_0xb3cb('0x49')]?_0x3c7f00[_0xb3cb('0x48')]:_0x220e5e[_0xb3cb('0x43')];_0x3c7f00[_0xb3cb('0x4c')]=qs[_0xb3cb('0x4d')](_0x4fd9bd[_0xb3cb('0x44')]['sort']);_0x3c7f00[_0xb3cb('0x4e')]=qs[_0xb3cb('0x46')](_[_0xb3cb('0x66')](_0x4fd9bd[_0xb3cb('0x44')],_0x220e5e[_0xb3cb('0x46')]));if(_0x4fd9bd['query'][_0xb3cb('0x33')]){_0x3c7f00[_0xb3cb('0x4e')]=_[_0xb3cb('0x4f')](_0x3c7f00[_0xb3cb('0x4e')],{'$or':_[_0xb3cb('0x35')](_0x3c7f00[_0xb3cb('0x48')],function(_0x36b12a){var _0x1622f3={};_0x1622f3[_0x36b12a]={'$like':'%'+_0x4fd9bd[_0xb3cb('0x44')][_0xb3cb('0x33')]+'%'};return _0x1622f3;})});}_0x3c7f00=_[_0xb3cb('0x4f')]({},_0x3c7f00,_0x4fd9bd[_0xb3cb('0x54')]);return _0x4d9e31['getAgents'](_0x3c7f00);}})['then'](function(_0x743239){if(_0x743239){_0x4a64c4=_0x743239[_0xb3cb('0x49')];if(!_0x4fd9bd[_0xb3cb('0x44')][_0xb3cb('0x4a')](_0xb3cb('0x4b'))){_0x3c7f00['limit']=qs['limit'](_0x4fd9bd['query'][_0xb3cb('0x27')]);_0x3c7f00[_0xb3cb('0x24')]=qs[_0xb3cb('0x24')](_0x4fd9bd[_0xb3cb('0x44')]['offset']);}return _0x4d9e31[_0xb3cb('0x9d')](_0x3c7f00);}})['then'](function(_0x3eb2f4){if(_0x3eb2f4){return _0x3eb2f4?{'count':_0x4a64c4,'rows':_0x3eb2f4}:null;}})[_0xb3cb('0x2e')](respondWithResult(_0x1bb56f,null))[_0xb3cb('0x51')](handleError(_0x1bb56f,null));};exports[_0xb3cb('0x9e')]=function(_0x1b8f55,_0x556907,_0x4aee85){var _0x296744={};var _0x2eb61f={};var _0x487057;var _0x3108f2;return db[_0xb3cb('0x3f')][_0xb3cb('0x64')]({'where':{'id':_0x1b8f55[_0xb3cb('0x5e')]['id']}})['then'](handleEntityNotFound(_0x556907,null))[_0xb3cb('0x2e')](function(_0x5de250){if(_0x5de250){_0x487057=_0x5de250;_0x2eb61f[_0xb3cb('0x43')]=_['keys'](db[_0xb3cb('0x7e')][_0xb3cb('0x40')]);_0x2eb61f[_0xb3cb('0x44')]=_['keys'](_0x1b8f55[_0xb3cb('0x44')]);_0x2eb61f[_0xb3cb('0x46')]=_[_0xb3cb('0x47')](_0x2eb61f[_0xb3cb('0x43')],_0x2eb61f['query']);_0x296744[_0xb3cb('0x48')]=_[_0xb3cb('0x47')](_0x2eb61f['model'],qs[_0xb3cb('0x52')](_0x1b8f55[_0xb3cb('0x44')][_0xb3cb('0x52')]));_0x296744[_0xb3cb('0x48')]=_0x296744[_0xb3cb('0x48')][_0xb3cb('0x49')]?_0x296744['attributes']:_0x2eb61f[_0xb3cb('0x43')];_0x296744['order']=qs[_0xb3cb('0x4d')](_0x1b8f55['query']['sort']);_0x296744['where']=qs[_0xb3cb('0x46')](_[_0xb3cb('0x66')](_0x1b8f55[_0xb3cb('0x44')],_0x2eb61f[_0xb3cb('0x46')]));if(_0x1b8f55['query'][_0xb3cb('0x33')]){_0x296744['where']=_[_0xb3cb('0x4f')](_0x296744['where'],{'$or':_[_0xb3cb('0x35')](_0x296744[_0xb3cb('0x48')],function(_0xb54cc2){var _0x2bfe80={};_0x2bfe80[_0xb54cc2]={'$like':'%'+_0x1b8f55[_0xb3cb('0x44')]['filter']+'%'};return _0x2bfe80;})});}_0x296744=_[_0xb3cb('0x4f')]({},_0x296744,_0x1b8f55[_0xb3cb('0x54')]);return _0x487057[_0xb3cb('0x9e')](_0x296744);}})['then'](function(_0x9b6a2a){if(_0x9b6a2a){_0x3108f2=_0x9b6a2a[_0xb3cb('0x49')];if(!_0x1b8f55[_0xb3cb('0x44')][_0xb3cb('0x4a')](_0xb3cb('0x4b'))){_0x296744[_0xb3cb('0x27')]=qs[_0xb3cb('0x27')](_0x1b8f55[_0xb3cb('0x44')][_0xb3cb('0x27')]);_0x296744[_0xb3cb('0x24')]=qs[_0xb3cb('0x24')](_0x1b8f55[_0xb3cb('0x44')][_0xb3cb('0x24')]);}return _0x487057[_0xb3cb('0x9e')](_0x296744);}})[_0xb3cb('0x2e')](function(_0x262511){return _0x262511?{'count':_0x3108f2,'rows':_0x262511}:null;})[_0xb3cb('0x2e')](respondWithResult(_0x556907,null))[_0xb3cb('0x51')](handleError(_0x556907,null));};exports[_0xb3cb('0x9f')]=function(_0x133d36,_0x5d21d9,_0x2d3a6f){var _0x412600={};var _0x14465c={};var _0x13655b;var _0x1ffba4;return db[_0xb3cb('0x3f')][_0xb3cb('0x64')]({'where':{'id':_0x133d36[_0xb3cb('0x5e')]['id']}})[_0xb3cb('0x2e')](handleEntityNotFound(_0x5d21d9,null))[_0xb3cb('0x2e')](function(_0x264f17){if(_0x264f17){_0x13655b=_0x264f17;_0x14465c[_0xb3cb('0x43')]=_[_0xb3cb('0x45')](db[_0xb3cb('0xa0')][_0xb3cb('0x40')]);_0x14465c[_0xb3cb('0x44')]=_[_0xb3cb('0x45')](_0x133d36[_0xb3cb('0x44')]);_0x14465c[_0xb3cb('0x46')]=_[_0xb3cb('0x47')](_0x14465c[_0xb3cb('0x43')],_0x14465c[_0xb3cb('0x44')]);_0x412600[_0xb3cb('0x48')]=_[_0xb3cb('0x47')](_0x14465c[_0xb3cb('0x43')],qs[_0xb3cb('0x52')](_0x133d36[_0xb3cb('0x44')]['fields']));_0x412600[_0xb3cb('0x48')]=_0x412600[_0xb3cb('0x48')]['length']?_0x412600[_0xb3cb('0x48')]:_0x14465c[_0xb3cb('0x43')];_0x412600[_0xb3cb('0x4c')]=qs[_0xb3cb('0x4d')](_0x133d36[_0xb3cb('0x44')]['sort']);_0x412600[_0xb3cb('0x4e')]=qs[_0xb3cb('0x46')](_[_0xb3cb('0x66')](_0x133d36['query'],_0x14465c[_0xb3cb('0x46')]));if(_0x133d36[_0xb3cb('0x44')]['filter']){_0x412600[_0xb3cb('0x4e')]=_[_0xb3cb('0x4f')](_0x412600[_0xb3cb('0x4e')],{'$or':_[_0xb3cb('0x35')](_0x412600['attributes'],function(_0xd9542a){var _0x11bf24={};_0x11bf24[_0xd9542a]={'$like':'%'+_0x133d36[_0xb3cb('0x44')][_0xb3cb('0x33')]+'%'};return _0x11bf24;})});}_0x412600=_['merge']({},_0x412600,_0x133d36[_0xb3cb('0x54')]);return _0x13655b[_0xb3cb('0x9f')](_0x412600);}})[_0xb3cb('0x2e')](function(_0x53e62b){if(_0x53e62b){_0x1ffba4=_0x53e62b['length'];if(!_0x133d36[_0xb3cb('0x44')]['hasOwnProperty']('nolimit')){_0x412600[_0xb3cb('0x27')]=qs['limit'](_0x133d36[_0xb3cb('0x44')][_0xb3cb('0x27')]);_0x412600[_0xb3cb('0x24')]=qs[_0xb3cb('0x24')](_0x133d36[_0xb3cb('0x44')][_0xb3cb('0x24')]);}return _0x13655b['getLists'](_0x412600);}})[_0xb3cb('0x2e')](function(_0x9a0e61){if(_0x9a0e61){return _0x9a0e61?{'count':_0x1ffba4,'rows':_0x9a0e61}:null;}})['then'](respondWithResult(_0x5d21d9,null))[_0xb3cb('0x51')](handleError(_0x5d21d9,null));};exports[_0xb3cb('0xa1')]=function(_0x555c59,_0x5e4f1c,_0x50f17e){var _0x5ed3a3,_0x454660;return db['VoiceQueue'][_0xb3cb('0x39')]({'where':{'id':_0x555c59['params']['id']}})[_0xb3cb('0x2e')](handleEntityNotFound(_0x5e4f1c,null))[_0xb3cb('0x2e')](function(_0x13ca15){if(_0x13ca15){_0x454660=_0x13ca15;return _0x13ca15['addLists'](_0x555c59[_0xb3cb('0x56')][_0xb3cb('0x85')],_['omit'](_0x555c59[_0xb3cb('0x56')],[_0xb3cb('0x85'),'id'])||{});}return null;})[_0xb3cb('0x99')](function(_0xf9a2cc){var _0x35e291;_0x5ed3a3=_0xf9a2cc||[];var _0x1eaac6=[];if(_0xf9a2cc){for(var _0x47e0e8=0x0;_0x47e0e8<_0xf9a2cc['length'];_0x47e0e8+=0x1){var _0x551e8f=_0xf9a2cc[_0x47e0e8][_0xb3cb('0x30')]({'plain':!![]});_0x454660[_0xb3cb('0xa2')]=_0x555c59[_0xb3cb('0x56')][_0xb3cb('0xa2')]?_0x555c59[_0xb3cb('0x56')]['dialCheckDuplicateType']:_0x454660[_0xb3cb('0xa2')];switch(_0x454660[_0xb3cb('0xa2')]){case'always':_0x35e291=squel[_0xb3cb('0xa3')]()[_0xb3cb('0xa4')](_0xb3cb('0xa5'))[_0xb3cb('0xa6')]([_0xb3cb('0xa7'),_0xb3cb('0xa8'),'ContactId',_0xb3cb('0xa9'),_0xb3cb('0x69'),_0xb3cb('0x5f'),_0xb3cb('0xaa')],squel[_0xb3cb('0x86')]()[_0xb3cb('0x87')](_0xb3cb('0xa7'),_0xb3cb('0xa7'))[_0xb3cb('0x87')](_0xb3cb('0xab'),'scheduledAt')['field']('id',_0xb3cb('0xac'))[_0xb3cb('0x87')](_0x551e8f[_0xb3cb('0xad')][_0xb3cb('0x8e')](),'ListId')[_0xb3cb('0x87')](_0x555c59['params']['id'][_0xb3cb('0x8e')](),'VoiceQueueId')[_0xb3cb('0x87')](_0xb3cb('0xab'),'createdAt')[_0xb3cb('0x87')](_0xb3cb('0xab'),_0xb3cb('0xaa'))[_0xb3cb('0xae')](_0xb3cb('0xaf'))[_0xb3cb('0x4e')](_0xb3cb('0xb0'))[_0xb3cb('0x4e')](_0xb3cb('0xb1'),_0x551e8f[_0xb3cb('0xad')][_0xb3cb('0x8e')]())[_0xb3cb('0x4e')](_0xb3cb('0xb2'))[_0xb3cb('0x4e')](_0xb3cb('0xb3'),squel['select']()['field'](_0xb3cb('0xb4'))['from'](_0xb3cb('0xb5'))[_0xb3cb('0x4e')](_0xb3cb('0x8c'),_0x555c59[_0xb3cb('0x5e')]['id'][_0xb3cb('0x8e')]()))[_0xb3cb('0x4e')](_0xb3cb('0xb3'),squel['select']()[_0xb3cb('0x87')](_0xb3cb('0xb6'))['from']('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0x555c59['params']['id']['toString']())))['toString']();break;case _0xb3cb('0xb7'):_0x35e291=squel[_0xb3cb('0xa3')]()[_0xb3cb('0xa4')](_0xb3cb('0xa5'))[_0xb3cb('0xa6')]([_0xb3cb('0xa7'),_0xb3cb('0xa8'),'ContactId',_0xb3cb('0xa9'),_0xb3cb('0x69'),_0xb3cb('0x5f'),_0xb3cb('0xaa')],squel['select']()['field'](_0xb3cb('0xa7'),'phone')[_0xb3cb('0x87')](_0xb3cb('0xab'),'scheduledAt')[_0xb3cb('0x87')]('id',_0xb3cb('0xac'))[_0xb3cb('0x87')](_0x551e8f[_0xb3cb('0xad')]['toString'](),_0xb3cb('0xa9'))[_0xb3cb('0x87')](_0x555c59[_0xb3cb('0x5e')]['id']['toString'](),'VoiceQueueId')['field']('NOW()',_0xb3cb('0x5f'))[_0xb3cb('0x87')](_0xb3cb('0xab'),_0xb3cb('0xaa'))['from'](_0xb3cb('0xaf'))[_0xb3cb('0x4e')](_0xb3cb('0xb0'))[_0xb3cb('0x4e')](_0xb3cb('0xb1'),_0x551e8f['CmListId']['toString']())[_0xb3cb('0x4e')](_0xb3cb('0xb2'))['where'](_0xb3cb('0xb3'),squel[_0xb3cb('0x86')]()['field']('COALESCE(phone,\x27\x27)')['from'](_0xb3cb('0xa5'))[_0xb3cb('0x4e')]('VoiceQueueId\x20=\x20?',_0x555c59[_0xb3cb('0x5e')]['id'][_0xb3cb('0x8e')]())))[_0xb3cb('0x8e')]();break;default:_0x35e291=squel[_0xb3cb('0xa3')]()[_0xb3cb('0xa4')]('cm_hopper')[_0xb3cb('0xa6')]([_0xb3cb('0xa7'),_0xb3cb('0xa8'),'ContactId',_0xb3cb('0xa9'),'VoiceQueueId','createdAt','updatedAt'],squel[_0xb3cb('0x86')]()[_0xb3cb('0x87')](_0xb3cb('0xa7'),_0xb3cb('0xa7'))[_0xb3cb('0x87')](_0xb3cb('0xab'),_0xb3cb('0xa8'))[_0xb3cb('0x87')]('id',_0xb3cb('0xac'))['field'](_0x551e8f[_0xb3cb('0xad')]['toString'](),'ListId')[_0xb3cb('0x87')](_0x555c59['params']['id'][_0xb3cb('0x8e')](),_0xb3cb('0x69'))[_0xb3cb('0x87')]('NOW()',_0xb3cb('0x5f'))[_0xb3cb('0x87')](_0xb3cb('0xab'),_0xb3cb('0xaa'))[_0xb3cb('0xae')](_0xb3cb('0xaf'))[_0xb3cb('0x4e')]('deletedAt\x20IS\x20NULL')[_0xb3cb('0x4e')](_0xb3cb('0xb1'),_0x551e8f[_0xb3cb('0xad')][_0xb3cb('0x8e')]())['where'](_0xb3cb('0xb2')))[_0xb3cb('0x8e')]();}_0x1eaac6[_0xb3cb('0x9b')](db[_0xb3cb('0x78')][_0xb3cb('0x44')](_0x35e291));}return BPromise[_0xb3cb('0x91')](_0x1eaac6);}})['then'](function(){return _0x5ed3a3;})[_0xb3cb('0x2e')](respondWithResult(_0x5e4f1c,null))['catch'](handleError(_0x5e4f1c,null));};exports[_0xb3cb('0xb8')]=function(_0x335511,_0x18ad74,_0x5f1c33){return db[_0xb3cb('0x3f')][_0xb3cb('0x39')]({'where':{'id':_0x335511[_0xb3cb('0x5e')]['id']}})[_0xb3cb('0x2e')](handleEntityNotFound(_0x18ad74,null))[_0xb3cb('0x2e')](function(_0x387960){if(_0x387960){return _0x387960['removeLists'](_0x335511[_0xb3cb('0x44')][_0xb3cb('0x85')]);}})['then'](function(_0x1a12d6){if(_0x1a12d6){return db[_0xb3cb('0x65')][_0xb3cb('0x2f')]({'where':{'ListId':_0x335511[_0xb3cb('0x44')][_0xb3cb('0x85')],'VoiceQueueId':_0x335511[_0xb3cb('0x5e')]['id']}})[_0xb3cb('0x2e')](function(){return _0x1a12d6;});}})[_0xb3cb('0x2e')](respondWithStatusCode(_0x18ad74,null))[_0xb3cb('0x51')](handleError(_0x18ad74,null));};exports[_0xb3cb('0xb9')]=function(_0x41d8a0,_0x21ed56,_0x5b1456){var _0x12e7d7={};var _0x5554ea={};var _0x4517f5;var _0x1c7b2b;return db['VoiceQueue'][_0xb3cb('0x64')]({'where':{'id':_0x41d8a0[_0xb3cb('0x5e')]['id']}})[_0xb3cb('0x2e')](handleEntityNotFound(_0x21ed56,null))['then'](function(_0x2e1b87){if(_0x2e1b87){_0x4517f5=_0x2e1b87;_0x5554ea['model']=_[_0xb3cb('0x45')](db['CmList'][_0xb3cb('0x40')]);_0x5554ea[_0xb3cb('0x44')]=_['keys'](_0x41d8a0[_0xb3cb('0x44')]);_0x5554ea[_0xb3cb('0x46')]=_['intersection'](_0x5554ea['model'],_0x5554ea[_0xb3cb('0x44')]);_0x12e7d7[_0xb3cb('0x48')]=_['intersection'](_0x5554ea[_0xb3cb('0x43')],qs[_0xb3cb('0x52')](_0x41d8a0[_0xb3cb('0x44')][_0xb3cb('0x52')]));_0x12e7d7[_0xb3cb('0x48')]=_0x12e7d7[_0xb3cb('0x48')][_0xb3cb('0x49')]?_0x12e7d7[_0xb3cb('0x48')]:_0x5554ea['model'];_0x12e7d7['order']=qs['sort'](_0x41d8a0[_0xb3cb('0x44')][_0xb3cb('0x4d')]);_0x12e7d7[_0xb3cb('0x4e')]=qs[_0xb3cb('0x46')](_[_0xb3cb('0x66')](_0x41d8a0[_0xb3cb('0x44')],_0x5554ea[_0xb3cb('0x46')]));if(_0x41d8a0[_0xb3cb('0x44')][_0xb3cb('0x33')]){_0x12e7d7[_0xb3cb('0x4e')]=_[_0xb3cb('0x4f')](_0x12e7d7[_0xb3cb('0x4e')],{'$or':_['map'](_0x12e7d7['attributes'],function(_0x34da34){var _0x38d325={};_0x38d325[_0x34da34]={'$like':'%'+_0x41d8a0['query'][_0xb3cb('0x33')]+'%'};return _0x38d325;})});}_0x12e7d7=_['merge']({},_0x12e7d7,_0x41d8a0[_0xb3cb('0x54')]);return _0x4517f5[_0xb3cb('0xb9')](_0x12e7d7);}})[_0xb3cb('0x2e')](function(_0x4c500c){if(_0x4c500c){_0x1c7b2b=_0x4c500c[_0xb3cb('0x49')];if(!_0x41d8a0[_0xb3cb('0x44')][_0xb3cb('0x4a')](_0xb3cb('0x4b'))){_0x12e7d7['limit']=qs['limit'](_0x41d8a0[_0xb3cb('0x44')][_0xb3cb('0x27')]);_0x12e7d7[_0xb3cb('0x24')]=qs[_0xb3cb('0x24')](_0x41d8a0[_0xb3cb('0x44')][_0xb3cb('0x24')]);}return _0x4517f5[_0xb3cb('0xb9')](_0x12e7d7);}})[_0xb3cb('0x2e')](function(_0x2f8177){if(_0x2f8177){return _0x2f8177?{'count':_0x1c7b2b,'rows':_0x2f8177}:null;}})[_0xb3cb('0x2e')](respondWithResult(_0x21ed56,null))[_0xb3cb('0x51')](handleError(_0x21ed56,null));};exports[_0xb3cb('0xba')]=function(_0x47807f,_0x1d940f,_0x2a54fb){var _0x56915a,_0x564dc1;return db[_0xb3cb('0x3f')][_0xb3cb('0x39')]({'where':{'id':_0x47807f[_0xb3cb('0x5e')]['id']}})[_0xb3cb('0x2e')](handleEntityNotFound(_0x1d940f,null))[_0xb3cb('0x2e')](function(_0x452d21){if(_0x452d21){_0x564dc1=_0x452d21;return _0x452d21[_0xb3cb('0xba')](_0x47807f[_0xb3cb('0x56')][_0xb3cb('0x85')],_['omit'](_0x47807f[_0xb3cb('0x56')],[_0xb3cb('0x85'),'id'])||{});}return null;})[_0xb3cb('0x99')](function(_0x1b9a7f){var _0x5e808e;_0x56915a=_0x1b9a7f||[];var _0x532a73=[];if(_0x1b9a7f){for(var _0x2d66f5=0x0;_0x2d66f5<_0x1b9a7f['length'];_0x2d66f5+=0x1){var _0x762c40=_0x1b9a7f[_0x2d66f5][_0xb3cb('0x30')]({'plain':!![]});_0x5e808e=squel['insert']()[_0xb3cb('0xa4')](_0xb3cb('0xbb'))['fromQuery']([_0xb3cb('0xa7'),_0xb3cb('0xac'),_0xb3cb('0xa9'),_0xb3cb('0x69'),_0xb3cb('0x5f'),'updatedAt'],squel['select']()['field'](_0xb3cb('0xa7'),_0xb3cb('0xa7'))[_0xb3cb('0x87')]('id',_0xb3cb('0xac'))['field'](_0x762c40['CmListId']['toString'](),_0xb3cb('0xa9'))[_0xb3cb('0x87')](_0x47807f[_0xb3cb('0x5e')]['id'][_0xb3cb('0x8e')](),_0xb3cb('0x69'))[_0xb3cb('0x87')](_0xb3cb('0xab'),_0xb3cb('0x5f'))[_0xb3cb('0x87')]('NOW()','updatedAt')[_0xb3cb('0xae')](_0xb3cb('0xaf'))['where']('deletedAt\x20IS\x20NULL')[_0xb3cb('0x4e')](_0xb3cb('0xb1'),_0x762c40[_0xb3cb('0xad')]['toString']())[_0xb3cb('0x4e')](_0xb3cb('0xb2')))[_0xb3cb('0x8e')]();_0x532a73['push'](db[_0xb3cb('0x78')][_0xb3cb('0x44')](_0x5e808e));}return BPromise[_0xb3cb('0x91')](_0x532a73);}})[_0xb3cb('0x2e')](function(){return _0x56915a;})[_0xb3cb('0x2e')](respondWithResult(_0x1d940f,null))['catch'](handleError(_0x1d940f,null));};exports[_0xb3cb('0xbc')]=function(_0x3ff7b7,_0x4a07b4,_0x16bdb6){return db[_0xb3cb('0x3f')][_0xb3cb('0x39')]({'where':{'id':_0x3ff7b7['params']['id']}})[_0xb3cb('0x2e')](handleEntityNotFound(_0x4a07b4,null))[_0xb3cb('0x2e')](function(_0x5d9b81){if(_0x5d9b81){return _0x5d9b81['removeBlackLists'](_0x3ff7b7[_0xb3cb('0x44')][_0xb3cb('0x85')]);}})[_0xb3cb('0x2e')](function(_0x23754c){if(_0x23754c){return db[_0xb3cb('0x6e')]['destroy']({'where':{'ListId':_0x3ff7b7[_0xb3cb('0x44')][_0xb3cb('0x85')],'VoiceQueueId':_0x3ff7b7[_0xb3cb('0x5e')]['id']}})[_0xb3cb('0x2e')](function(){return _0x23754c;});}})[_0xb3cb('0x2e')](respondWithStatusCode(_0x4a07b4,null))['catch'](handleError(_0x4a07b4,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index fd545cf..5f20132 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 _0x15b6=['VoiceQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x15b6,0x7e));var _0x615b=function(_0x135c4d,_0x6e303e){_0x135c4d=_0x135c4d-0x0;var _0x263376=_0x15b6[_0x135c4d];return _0x263376;};'use strict';var EventEmitter=require('events');var VoiceQueue=require('../../mysqldb')['db'][_0x615b('0x0')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x615b('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x615b('0x2'),'afterDestroy':_0x615b('0x3')};function emitEvent(_0x541f11){return function(_0x726536,_0x429904,_0x392157){VoiceQueueEvents['emit'](_0x541f11+':'+_0x726536['id'],_0x726536);VoiceQueueEvents[_0x615b('0x4')](_0x541f11,_0x726536);_0x392157(null);};}for(var e in events){if(events[_0x615b('0x5')](e)){var event=events[e];VoiceQueue[_0x615b('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0xb8b0=['exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x28c939,_0x110e29){var _0x527fe9=function(_0x1df2a6){while(--_0x1df2a6){_0x28c939['push'](_0x28c939['shift']());}};_0x527fe9(++_0x110e29);}(_0xb8b0,0x123));var _0x0b8b=function(_0x16c467,_0x53d6fa){_0x16c467=_0x16c467-0x0;var _0x22db4f=_0xb8b0[_0x16c467];return _0x22db4f;};'use strict';var EventEmitter=require(_0x0b8b('0x0'));var VoiceQueue=require(_0x0b8b('0x1'))['db'][_0x0b8b('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x0b8b('0x3')](0x0);var events={'afterCreate':_0x0b8b('0x4'),'afterUpdate':_0x0b8b('0x5'),'afterDestroy':_0x0b8b('0x6')};function emitEvent(_0x49c021){return function(_0x22ca46,_0x30576a,_0x43eac5){VoiceQueueEvents[_0x0b8b('0x7')](_0x49c021+':'+_0x22ca46['id'],_0x22ca46);VoiceQueueEvents[_0x0b8b('0x7')](_0x49c021,_0x22ca46);_0x43eac5(null);};}for(var e in events){if(events[_0x0b8b('0x8')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x0b8b('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 2d93fc8..ef1274c 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 _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x21ca2a,_0x469aee){var _0x1ba7fd=function(_0x4b1d7d){while(--_0x4b1d7d){_0x21ca2a['push'](_0x21ca2a['shift']());}};_0x1ba7fd(++_0x469aee);}(_0x70e0,0x17b));var _0x070e=function(_0x4bb05f,_0x1d54f0){_0x4bb05f=_0x4bb05f-0x0;var _0x540185=_0x70e0[_0x4bb05f];return _0x540185;};'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']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x25425c,_0xfb75cf){var _0x50d5fe=function(_0x4c520a){while(--_0x4c520a){_0x25425c['push'](_0x25425c['shift']());}};_0x50d5fe(++_0xfb75cf);}(_0xedd9,0xfc));var _0x9edd=function(_0xfafd3f,_0x32cae3){_0xfafd3f=_0xfafd3f-0x0;var _0x52e0f4=_0xedd9[_0xfafd3f];return _0x52e0f4;};'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':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index ac4514b..8e0d50b 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 _0xb27d=['include','model','attributes','debug','ShowVoiceQueue','find','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','defaults','localhost','socket.io-emitter','register','request','then','info','VoiceQueue,\x20%s,\x20%s','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','limit','map'];(function(_0x57f194,_0x5a870d){var _0x18be7c=function(_0x16ed3d){while(--_0x16ed3d){_0x57f194['push'](_0x57f194['shift']());}};_0x18be7c(++_0x5a870d);}(_0xb27d,0x12e));var _0xdb27=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xb27d[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0xdb27('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdb27('0x1'));var fs=require('fs');var Redis=require(_0xdb27('0x2'));var db=require(_0xdb27('0x3'))['db'];var utils=require(_0xdb27('0x4'));var logger=require(_0xdb27('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdb27('0x6')]['http']({'port':0x232a});config['redis']=_[_0xdb27('0x7')](config['redis'],{'host':_0xdb27('0x8'),'port':0x18eb});var socket=require(_0xdb27('0x9'))(new Redis(config['redis']));require('./voiceQueue.socket')[_0xdb27('0xa')](socket);function respondWithRpcPromise(_0x4b2b61,_0x54080e,_0x53524a){return new BPromise(function(_0x38dbf6,_0x16f1cb){return client[_0xdb27('0xb')](_0x4b2b61,_0x53524a)[_0xdb27('0xc')](function(_0x50a7da){logger[_0xdb27('0xd')](_0xdb27('0xe'),_0x54080e,'request\x20sent');logger['debug'](_0xdb27('0xf'),_0x54080e,_0xdb27('0x10'),JSON[_0xdb27('0x11')](_0x50a7da));if(_0x50a7da[_0xdb27('0x12')]){if(_0x50a7da['error'][_0xdb27('0x13')]===0x1f4){logger[_0xdb27('0x12')](_0xdb27('0xe'),_0x54080e,_0x50a7da[_0xdb27('0x12')]['message']);return _0x16f1cb(_0x50a7da[_0xdb27('0x12')][_0xdb27('0x14')]);}logger[_0xdb27('0x12')](_0xdb27('0xe'),_0x54080e,_0x50a7da[_0xdb27('0x12')][_0xdb27('0x14')]);return _0x38dbf6(_0x50a7da[_0xdb27('0x12')][_0xdb27('0x14')]);}else{logger[_0xdb27('0xd')]('VoiceQueue,\x20%s,\x20%s',_0x54080e,_0xdb27('0x10'));_0x38dbf6(_0x50a7da[_0xdb27('0x15')][_0xdb27('0x14')]);}})[_0xdb27('0x16')](function(_0x229002){logger[_0xdb27('0x12')](_0xdb27('0xe'),_0x54080e,_0x229002);_0x16f1cb(_0x229002);});});}exports[_0xdb27('0x17')]=function(_0x2bf364){var _0x52357d=this;return new Promise(function(_0x456791,_0x290812){return db[_0xdb27('0x18')][_0xdb27('0x19')]({'raw':_0x2bf364[_0xdb27('0x1a')]?_0x2bf364[_0xdb27('0x1a')][_0xdb27('0x1b')]===undefined?!![]:![]:!![],'where':_0x2bf364[_0xdb27('0x1a')]?_0x2bf364[_0xdb27('0x1a')][_0xdb27('0x1c')]||null:null,'attributes':_0x2bf364[_0xdb27('0x1a')]?_0x2bf364[_0xdb27('0x1a')]['attributes']||null:null,'limit':_0x2bf364[_0xdb27('0x1a')]?_0x2bf364['options'][_0xdb27('0x1d')]||null:null,'include':_0x2bf364['options']?_0x2bf364[_0xdb27('0x1a')]['include']?_[_0xdb27('0x1e')](_0x2bf364[_0xdb27('0x1a')][_0xdb27('0x1f')],function(_0x575191){return{'model':db[_0x575191[_0xdb27('0x20')]],'as':_0x575191['as'],'attributes':_0x575191['attributes'],'include':_0x575191[_0xdb27('0x1f')]?_['map'](_0x575191['include'],function(_0x530037){return{'model':db[_0x530037[_0xdb27('0x20')]],'as':_0x530037['as'],'attributes':_0x530037[_0xdb27('0x21')],'include':_0x530037[_0xdb27('0x1f')]?_[_0xdb27('0x1e')](_0x530037[_0xdb27('0x1f')],function(_0x27eb97){return{'model':db[_0x27eb97[_0xdb27('0x20')]],'as':_0x27eb97['as'],'attributes':_0x27eb97['attributes']};}):[]};}):[]};}):[]:[]})[_0xdb27('0xc')](function(_0x4d062e){logger[_0xdb27('0xd')](_0xdb27('0x17'),_0x2bf364);logger[_0xdb27('0x22')](_0xdb27('0x17'),_0x2bf364,JSON[_0xdb27('0x11')](_0x4d062e));_0x456791(_0x4d062e);})['catch'](function(_0x7e9c66){logger['error'](_0xdb27('0x17'),_0x7e9c66['message'],_0x2bf364);_0x290812(_0x52357d[_0xdb27('0x12')](0x1f4,_0x7e9c66[_0xdb27('0x14')]));});});};exports[_0xdb27('0x23')]=function(_0xd22cd8){var _0x714528=this;return new Promise(function(_0x1530bb,_0x39c54a){return db[_0xdb27('0x18')][_0xdb27('0x24')]({'raw':_0xd22cd8[_0xdb27('0x1a')]?_0xd22cd8[_0xdb27('0x1a')][_0xdb27('0x1b')]===undefined?!![]:![]:!![],'where':_0xd22cd8[_0xdb27('0x1a')]?_0xd22cd8[_0xdb27('0x1a')]['where']||null:null,'attributes':_0xd22cd8[_0xdb27('0x1a')]?_0xd22cd8['options'][_0xdb27('0x21')]||null:null,'include':_0xd22cd8[_0xdb27('0x1a')]?_0xd22cd8[_0xdb27('0x1a')]['include']?_[_0xdb27('0x1e')](_0xd22cd8[_0xdb27('0x1a')][_0xdb27('0x1f')],function(_0x223615){return{'model':db[_0x223615[_0xdb27('0x20')]],'as':_0x223615['as'],'attributes':_0x223615[_0xdb27('0x21')],'include':_0x223615[_0xdb27('0x1f')]?_['map'](_0x223615['include'],function(_0x24a627){return{'model':db[_0x24a627[_0xdb27('0x20')]],'as':_0x24a627['as'],'attributes':_0x24a627['attributes'],'include':_0x24a627[_0xdb27('0x1f')]?_[_0xdb27('0x1e')](_0x24a627[_0xdb27('0x1f')],function(_0x3e5bfb){return{'model':db[_0x3e5bfb[_0xdb27('0x20')]],'as':_0x3e5bfb['as'],'attributes':_0x3e5bfb[_0xdb27('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c8681){logger['info'](_0xdb27('0x23'),_0xd22cd8);logger['debug']('ShowVoiceQueue',_0xd22cd8,JSON[_0xdb27('0x11')](_0x5c8681));_0x1530bb(_0x5c8681);})['catch'](function(_0x453630){logger[_0xdb27('0x12')](_0xdb27('0x23'),_0x453630[_0xdb27('0x14')],_0xd22cd8);_0x39c54a(_0x714528[_0xdb27('0x12')](0x1f4,_0x453630[_0xdb27('0x14')]));});});}; \ No newline at end of file +var _0x8112=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','GetVoiceQueue','findAll','options','raw','include','model','map','attributes','find','ShowVoiceQueue','lodash','util','bluebird'];(function(_0xe8129c,_0x2fb03c){var _0x709fc5=function(_0xb8e0c6){while(--_0xb8e0c6){_0xe8129c['push'](_0xe8129c['shift']());}};_0x709fc5(++_0x2fb03c);}(_0x8112,0x1eb));var _0x2811=function(_0x45c981,_0x2ad2d4){_0x45c981=_0x45c981-0x0;var _0x4f62c8=_0x8112[_0x45c981];return _0x4f62c8;};'use strict';var _=require(_0x2811('0x0'));var util=require(_0x2811('0x1'));var moment=require('moment');var BPromise=require(_0x2811('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2811('0x3'));var db=require(_0x2811('0x4'))['db'];var utils=require(_0x2811('0x5'));var logger=require(_0x2811('0x6'))(_0x2811('0x7'));var config=require(_0x2811('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2811('0x9')][_0x2811('0xa')]({'port':0x232a});config[_0x2811('0xb')]=_[_0x2811('0xc')](config[_0x2811('0xb')],{'host':_0x2811('0xd'),'port':0x18eb});var socket=require(_0x2811('0xe'))(new Redis(config[_0x2811('0xb')]));require('./voiceQueue.socket')[_0x2811('0xf')](socket);function respondWithRpcPromise(_0x28b2cd,_0x2f6bfd,_0x56832d){return new BPromise(function(_0x1a4b28,_0x3ff446){return client[_0x2811('0x10')](_0x28b2cd,_0x56832d)[_0x2811('0x11')](function(_0x588128){logger[_0x2811('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x2f6bfd,_0x2811('0x13'));logger[_0x2811('0x14')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x2f6bfd,_0x2811('0x13'),JSON[_0x2811('0x15')](_0x588128));if(_0x588128[_0x2811('0x16')]){if(_0x588128[_0x2811('0x16')][_0x2811('0x17')]===0x1f4){logger[_0x2811('0x16')](_0x2811('0x18'),_0x2f6bfd,_0x588128[_0x2811('0x16')][_0x2811('0x19')]);return _0x3ff446(_0x588128[_0x2811('0x16')][_0x2811('0x19')]);}logger[_0x2811('0x16')](_0x2811('0x18'),_0x2f6bfd,_0x588128[_0x2811('0x16')][_0x2811('0x19')]);return _0x1a4b28(_0x588128['error']['message']);}else{logger[_0x2811('0x12')](_0x2811('0x18'),_0x2f6bfd,_0x2811('0x13'));_0x1a4b28(_0x588128[_0x2811('0x1a')][_0x2811('0x19')]);}})[_0x2811('0x1b')](function(_0x5cede9){logger['error'](_0x2811('0x18'),_0x2f6bfd,_0x5cede9);_0x3ff446(_0x5cede9);});});}exports[_0x2811('0x1c')]=function(_0xc1ea42){var _0x57a5f8=this;return new Promise(function(_0x2425a7,_0x2e4307){return db['VoiceQueue'][_0x2811('0x1d')]({'raw':_0xc1ea42[_0x2811('0x1e')]?_0xc1ea42[_0x2811('0x1e')][_0x2811('0x1f')]===undefined?!![]:![]:!![],'where':_0xc1ea42[_0x2811('0x1e')]?_0xc1ea42[_0x2811('0x1e')]['where']||null:null,'attributes':_0xc1ea42[_0x2811('0x1e')]?_0xc1ea42[_0x2811('0x1e')]['attributes']||null:null,'limit':_0xc1ea42[_0x2811('0x1e')]?_0xc1ea42[_0x2811('0x1e')]['limit']||null:null,'include':_0xc1ea42[_0x2811('0x1e')]?_0xc1ea42[_0x2811('0x1e')][_0x2811('0x20')]?_['map'](_0xc1ea42[_0x2811('0x1e')]['include'],function(_0xdc0b49){return{'model':db[_0xdc0b49[_0x2811('0x21')]],'as':_0xdc0b49['as'],'attributes':_0xdc0b49['attributes'],'include':_0xdc0b49[_0x2811('0x20')]?_[_0x2811('0x22')](_0xdc0b49['include'],function(_0x5df29b){return{'model':db[_0x5df29b[_0x2811('0x21')]],'as':_0x5df29b['as'],'attributes':_0x5df29b['attributes'],'include':_0x5df29b[_0x2811('0x20')]?_[_0x2811('0x22')](_0x5df29b[_0x2811('0x20')],function(_0x3669e5){return{'model':db[_0x3669e5[_0x2811('0x21')]],'as':_0x3669e5['as'],'attributes':_0x3669e5[_0x2811('0x23')]};}):[]};}):[]};}):[]:[]})[_0x2811('0x11')](function(_0x343cf1){logger[_0x2811('0x12')](_0x2811('0x1c'),_0xc1ea42);logger[_0x2811('0x14')]('GetVoiceQueue',_0xc1ea42,JSON[_0x2811('0x15')](_0x343cf1));_0x2425a7(_0x343cf1);})[_0x2811('0x1b')](function(_0x37d1ee){logger[_0x2811('0x16')](_0x2811('0x1c'),_0x37d1ee['message'],_0xc1ea42);_0x2e4307(_0x57a5f8['error'](0x1f4,_0x37d1ee[_0x2811('0x19')]));});});};exports['ShowVoiceQueue']=function(_0x1dfb8d){var _0x3ac1c7=this;return new Promise(function(_0x527503,_0x42fd60){return db['VoiceQueue'][_0x2811('0x24')]({'raw':_0x1dfb8d[_0x2811('0x1e')]?_0x1dfb8d[_0x2811('0x1e')][_0x2811('0x1f')]===undefined?!![]:![]:!![],'where':_0x1dfb8d[_0x2811('0x1e')]?_0x1dfb8d[_0x2811('0x1e')]['where']||null:null,'attributes':_0x1dfb8d[_0x2811('0x1e')]?_0x1dfb8d[_0x2811('0x1e')][_0x2811('0x23')]||null:null,'include':_0x1dfb8d[_0x2811('0x1e')]?_0x1dfb8d[_0x2811('0x1e')][_0x2811('0x20')]?_[_0x2811('0x22')](_0x1dfb8d[_0x2811('0x1e')][_0x2811('0x20')],function(_0x4671dc){return{'model':db[_0x4671dc[_0x2811('0x21')]],'as':_0x4671dc['as'],'attributes':_0x4671dc[_0x2811('0x23')],'include':_0x4671dc[_0x2811('0x20')]?_[_0x2811('0x22')](_0x4671dc[_0x2811('0x20')],function(_0x481d74){return{'model':db[_0x481d74['model']],'as':_0x481d74['as'],'attributes':_0x481d74['attributes'],'include':_0x481d74['include']?_[_0x2811('0x22')](_0x481d74[_0x2811('0x20')],function(_0x3695e2){return{'model':db[_0x3695e2['model']],'as':_0x3695e2['as'],'attributes':_0x3695e2[_0x2811('0x23')]};}):[]};}):[]};}):[]:[]})[_0x2811('0x11')](function(_0x4e6b11){logger[_0x2811('0x12')](_0x2811('0x25'),_0x1dfb8d);logger['debug']('ShowVoiceQueue',_0x1dfb8d,JSON[_0x2811('0x15')](_0x4e6b11));_0x527503(_0x4e6b11);})[_0x2811('0x1b')](function(_0x15ebca){logger[_0x2811('0x16')](_0x2811('0x25'),_0x15ebca[_0x2811('0x19')],_0x1dfb8d);_0x42fd60(_0x3ac1c7[_0x2811('0x16')](0x1f4,_0x15ebca[_0x2811('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 434be33..1f7fa32 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 _0xd7d9=['removeListener','register','length','voiceQueue:','./voiceQueue.events','save','emit'];(function(_0xf19b15,_0x4f36ca){var _0x112420=function(_0x3e2889){while(--_0x3e2889){_0xf19b15['push'](_0xf19b15['shift']());}};_0x112420(++_0x4f36ca);}(_0xd7d9,0x15b));var _0x9d7d=function(_0x54e856,_0x313d5c){_0x54e856=_0x54e856-0x0;var _0x124873=_0xd7d9[_0x54e856];return _0x124873;};'use strict';var VoiceQueueEvents=require(_0x9d7d('0x0'));var events=[_0x9d7d('0x1'),'remove','update'];function createListener(_0x38a12a,_0xe8407a){return function(_0x529388){_0xe8407a[_0x9d7d('0x2')](_0x38a12a,_0x529388);};}function removeListener(_0x58e4de,_0x286293){return function(){VoiceQueueEvents[_0x9d7d('0x3')](_0x58e4de,_0x286293);};}exports[_0x9d7d('0x4')]=function(_0x1eb14b){for(var _0x1a29eb=0x0,_0x517157=events[_0x9d7d('0x5')];_0x1a29eb<_0x517157;_0x1a29eb++){var _0x3a7de3=events[_0x1a29eb];var _0x5df752=createListener(_0x9d7d('0x6')+_0x3a7de3,_0x1eb14b);VoiceQueueEvents['on'](_0x3a7de3,_0x5df752);}}; \ No newline at end of file +var _0x000d=['./voiceQueue.events','save','update','emit','removeListener','register','length','voiceQueue:'];(function(_0x102977,_0x3a99a6){var _0x15c466=function(_0x1a6a12){while(--_0x1a6a12){_0x102977['push'](_0x102977['shift']());}};_0x15c466(++_0x3a99a6);}(_0x000d,0x140));var _0xd000=function(_0x1b1888,_0x3e2fd2){_0x1b1888=_0x1b1888-0x0;var _0x42e090=_0x000d[_0x1b1888];return _0x42e090;};'use strict';var VoiceQueueEvents=require(_0xd000('0x0'));var events=[_0xd000('0x1'),'remove',_0xd000('0x2')];function createListener(_0x58bcf2,_0x3fb142){return function(_0x5dea3a){_0x3fb142[_0xd000('0x3')](_0x58bcf2,_0x5dea3a);};}function removeListener(_0x5b1e6d,_0x96dcd5){return function(){VoiceQueueEvents[_0xd000('0x4')](_0x5b1e6d,_0x96dcd5);};}exports[_0xd000('0x5')]=function(_0x4e7225){for(var _0x24f407=0x0,_0x37cdbc=events[_0xd000('0x6')];_0x24f407<_0x37cdbc;_0x24f407++){var _0x4f57ff=events[_0x24f407];var _0x38a746=createListener(_0xd000('0x7')+_0x4f57ff,_0x4e7225);VoiceQueueEvents['on'](_0x4f57ff,_0x38a746);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 51eeb9d..dbcd915 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 _0x2727=['show','post','create','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','index','isAuthenticated','/index','getVoiceQueuesReport'];(function(_0x304383,_0x566b94){var _0x56dfe4=function(_0x8f417b){while(--_0x8f417b){_0x304383['push'](_0x304383['shift']());}};_0x56dfe4(++_0x566b94);}(_0x2727,0x161));var _0x7272=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2727[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7272('0x0'));var util=require(_0x7272('0x1'));var path=require(_0x7272('0x2'));var timeout=require(_0x7272('0x3'));var express=require(_0x7272('0x4'));var router=express[_0x7272('0x5')]();var fs_extra=require(_0x7272('0x6'));var auth=require(_0x7272('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7272('0x8'));var controller=require(_0x7272('0x9'));router[_0x7272('0xa')]('/',auth['isAuthenticated'](),controller[_0x7272('0xb')]);router[_0x7272('0xa')]('/describe',auth[_0x7272('0xc')](),controller['describe']);router['get'](_0x7272('0xd'),auth['isAuthenticated'](),controller[_0x7272('0xe')]);router[_0x7272('0xa')]('/:id',auth[_0x7272('0xc')](),controller[_0x7272('0xf')]);router[_0x7272('0x10')]('/',auth[_0x7272('0xc')](),controller[_0x7272('0x11')]);router[_0x7272('0x12')]('/:id',auth[_0x7272('0xc')](),controller[_0x7272('0x13')]);router[_0x7272('0x14')](_0x7272('0x15'),auth[_0x7272('0xc')](),controller['destroy']);module[_0x7272('0x16')]=router; \ No newline at end of file +var _0x263b=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','getVoiceQueuesReport','/:id','show','post','create','update','delete','exports','multer','util','path'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x263b,0x87));var _0xb263=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x263b[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0xb263('0x0'));var util=require(_0xb263('0x1'));var path=require(_0xb263('0x2'));var timeout=require(_0xb263('0x3'));var express=require('express');var router=express[_0xb263('0x4')]();var fs_extra=require(_0xb263('0x5'));var auth=require(_0xb263('0x6'));var interaction=require(_0xb263('0x7'));var config=require(_0xb263('0x8'));var controller=require(_0xb263('0x9'));router[_0xb263('0xa')]('/',auth[_0xb263('0xb')](),controller[_0xb263('0xc')]);router[_0xb263('0xa')]('/describe',auth[_0xb263('0xb')](),controller[_0xb263('0xd')]);router[_0xb263('0xa')](_0xb263('0xe'),auth['isAuthenticated'](),controller[_0xb263('0xf')]);router[_0xb263('0xa')](_0xb263('0x10'),auth[_0xb263('0xb')](),controller[_0xb263('0x11')]);router[_0xb263('0x12')]('/',auth['isAuthenticated'](),controller[_0xb263('0x13')]);router['put'](_0xb263('0x10'),auth[_0xb263('0xb')](),controller[_0xb263('0x14')]);router[_0xb263('0x15')](_0xb263('0x10'),auth[_0xb263('0xb')](),controller['destroy']);module[_0xb263('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 1f45778..148a276 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 _0xbfb8=['INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xbfb8,0x9d));var _0x8bfb=function(_0x14c5e5,_0x193326){_0x14c5e5=_0x14c5e5-0x0;var _0x2fc3ce=_0xbfb8[_0x14c5e5];return _0x2fc3ce;};'use strict';var Sequelize=require(_0x8bfb('0x0'));var moment=require(_0x8bfb('0x1'));module[_0x8bfb('0x2')]={'type':{'type':Sequelize[_0x8bfb('0x3')]},'uniqueid':{'type':Sequelize[_0x8bfb('0x3')]},'calleridnum':{'type':Sequelize[_0x8bfb('0x3')]},'calleridname':{'type':Sequelize[_0x8bfb('0x3')]},'queue':{'type':Sequelize[_0x8bfb('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x8bfb('0x4')],'set':function(_0x3c9bb7){var _0x1c4f5c=moment(_0x3c9bb7);var _0x69e474=moment(this[_0x8bfb('0x5')](_0x8bfb('0x6')))[_0x8bfb('0x7')](_0x8bfb('0x8'));var _0x1a715d=_0x1c4f5c[_0x8bfb('0x9')](_0x69e474,_0x8bfb('0xa'));this[_0x8bfb('0xb')](_0x8bfb('0xc'),_0x3c9bb7);this['setDataValue']('holdtime',_0x1a715d||null);}},'position':{'type':Sequelize[_0x8bfb('0xd')]},'count':{'type':Sequelize[_0x8bfb('0xd')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x8bfb('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x8bfb('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x8bfb('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x8bfb('0xf')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x8bfb('0x3')]},'connectedlinename':{'type':Sequelize[_0x8bfb('0x3')]},'accountcode':{'type':Sequelize[_0x8bfb('0x3')]},'context':{'type':Sequelize[_0x8bfb('0x3')]},'exten':{'type':Sequelize[_0x8bfb('0x3')]},'priority':{'type':Sequelize[_0x8bfb('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x8bfb('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x8bfb('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x8bfb('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x8bfb('0x10')},'transferexten':{'type':Sequelize[_0x8bfb('0x3')]},'transferuniqueid':{'type':Sequelize[_0x8bfb('0x3')]},'disposition':{'type':Sequelize[_0x8bfb('0x3')]},'secondDisposition':{'type':Sequelize[_0x8bfb('0x3')]},'thirdDisposition':{'type':Sequelize[_0x8bfb('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x8bfb('0xd')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4bc9=['DATE','getDataValue','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x4bc9,0xa4));var _0x94bc=function(_0x300449,_0x34b08f){_0x300449=_0x300449-0x0;var _0x589824=_0x4bc9[_0x300449];return _0x589824;};'use strict';var Sequelize=require(_0x94bc('0x0'));var moment=require(_0x94bc('0x1'));module[_0x94bc('0x2')]={'type':{'type':Sequelize[_0x94bc('0x3')]},'uniqueid':{'type':Sequelize[_0x94bc('0x3')]},'calleridnum':{'type':Sequelize[_0x94bc('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x94bc('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x94bc('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x94bc('0x4')],'set':function(_0xe58eeb){var _0x2fd063=moment(_0xe58eeb);var _0x1797d8=moment(this[_0x94bc('0x5')]('queuecallerjoinAt'))['format'](_0x94bc('0x6'));var _0x47aeb0=_0x2fd063['diff'](_0x1797d8,_0x94bc('0x7'));this[_0x94bc('0x8')](_0x94bc('0x9'),_0xe58eeb);this[_0x94bc('0x8')]('holdtime',_0x47aeb0||null);}},'position':{'type':Sequelize[_0x94bc('0xa')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x94bc('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x94bc('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x94bc('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x94bc('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x94bc('0xc')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x94bc('0x3')]},'connectedlinenum':{'type':Sequelize[_0x94bc('0x3')]},'connectedlinename':{'type':Sequelize[_0x94bc('0x3')]},'accountcode':{'type':Sequelize[_0x94bc('0x3')]},'context':{'type':Sequelize[_0x94bc('0x3')]},'exten':{'type':Sequelize[_0x94bc('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x94bc('0xa')]},'mohtime':{'type':Sequelize[_0x94bc('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x94bc('0x3')]},'transfer':{'type':Sequelize[_0x94bc('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x94bc('0xd')},'transferexten':{'type':Sequelize[_0x94bc('0x3')]},'transferuniqueid':{'type':Sequelize[_0x94bc('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x94bc('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x94bc('0xa')],'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 0a8b9b7..d46d149 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 _0x4ccc=['status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','name','send','VoiceQueueReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','keys','create','body','destroy','describe','getVoiceQueuesReport','hasOwnProperty','includeAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./voiceQueueReport.socket','register','sendStatus'];(function(_0x3d7be4,_0x46e37d){var _0x59c962=function(_0x141645){while(--_0x141645){_0x3d7be4['push'](_0x3d7be4['shift']());}};_0x59c962(++_0x46e37d);}(_0x4ccc,0x81));var _0xc4cc=function(_0x157c79,_0x38ea3a){_0x157c79=_0x157c79-0x0;var _0x8315ff=_0x4ccc[_0x157c79];return _0x8315ff;};'use strict';var emlformat=require(_0xc4cc('0x0'));var rimraf=require(_0xc4cc('0x1'));var zipdir=require(_0xc4cc('0x2'));var jsonpatch=require(_0xc4cc('0x3'));var rp=require(_0xc4cc('0x4'));var moment=require('moment');var BPromise=require(_0xc4cc('0x5'));var Mustache=require('mustache');var util=require(_0xc4cc('0x6'));var path=require(_0xc4cc('0x7'));var sox=require(_0xc4cc('0x8'));var csv=require(_0xc4cc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc4cc('0xa'));var crypto=require(_0xc4cc('0xb'));var jsforce=require(_0xc4cc('0xc'));var deskjs=require(_0xc4cc('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc4cc('0xe'));var Papa=require(_0xc4cc('0xf'));var Redis=require(_0xc4cc('0x10'));var authService=require(_0xc4cc('0x11'));var qs=require(_0xc4cc('0x12'));var as=require(_0xc4cc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc4cc('0x14'));var utils=require(_0xc4cc('0x15'));var config=require(_0xc4cc('0x16'));var licenseUtil=require(_0xc4cc('0x17'));var db=require(_0xc4cc('0x18'))['db'];config['redis']=_['defaults'](config[_0xc4cc('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc4cc('0x19')]));require(_0xc4cc('0x1a'))[_0xc4cc('0x1b')](socket);function respondWithStatusCode(_0x9d884e,_0x52ff20){_0x52ff20=_0x52ff20||0xcc;return function(_0x334b2c){if(_0x334b2c){return _0x9d884e[_0xc4cc('0x1c')](_0x52ff20);}return _0x9d884e[_0xc4cc('0x1d')](_0x52ff20)['end']();};}function respondWithResult(_0x4ec1ad,_0x37f3e9){_0x37f3e9=_0x37f3e9||0xc8;return function(_0x3cc16e){if(_0x3cc16e){return _0x4ec1ad[_0xc4cc('0x1d')](_0x37f3e9)[_0xc4cc('0x1e')](_0x3cc16e);}};}function respondWithFilteredResult(_0x5906a4,_0x499711){return function(_0x3f62af){if(_0x3f62af){var _0x296de8=typeof _0x499711[_0xc4cc('0x1f')]===_0xc4cc('0x20')&&typeof _0x499711[_0xc4cc('0x21')]===_0xc4cc('0x20');var _0x567fe0=_0x3f62af[_0xc4cc('0x22')];var _0x54d3b9=_0x296de8?0x0:_0x499711[_0xc4cc('0x1f')];var _0x37ba8e=_0x296de8?_0x3f62af[_0xc4cc('0x22')]:_0x499711[_0xc4cc('0x1f')]+_0x499711[_0xc4cc('0x21')];var _0x5283c1;if(_0x37ba8e>=_0x567fe0){_0x37ba8e=_0x567fe0;_0x5283c1=0xc8;}else{_0x5283c1=0xce;}_0x5906a4['status'](_0x5283c1);return _0x5906a4[_0xc4cc('0x23')](_0xc4cc('0x24'),_0x54d3b9+'-'+_0x37ba8e+'/'+_0x567fe0)['json'](_0x3f62af);}return null;};}function patchUpdates(_0x4bebb5){return function(_0x54e65c){try{jsonpatch[_0xc4cc('0x25')](_0x54e65c,_0x4bebb5,!![]);}catch(_0x5cc53c){return BPromise[_0xc4cc('0x26')](_0x5cc53c);}return _0x54e65c['save']();};}function saveUpdates(_0x48308c,_0x236d09){return function(_0x543b70){if(_0x543b70){return _0x543b70[_0xc4cc('0x27')](_0x48308c)[_0xc4cc('0x28')](function(_0x256716){return _0x256716;});}return null;};}function removeEntity(_0xae4954,_0x17b011){return function(_0x5084ad){if(_0x5084ad){return _0x5084ad['destroy']()[_0xc4cc('0x28')](function(){_0xae4954[_0xc4cc('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54a706,_0x12b37a){return function(_0x311b4e){if(!_0x311b4e){_0x54a706['sendStatus'](0x194);}return _0x311b4e;};}function handleError(_0x11e87b,_0x47c2b5){_0x47c2b5=_0x47c2b5||0x1f4;return function(_0x399809){logger[_0xc4cc('0x29')](_0x399809['stack']);if(_0x399809['name']){delete _0x399809[_0xc4cc('0x2a')];}_0x11e87b['status'](_0x47c2b5)[_0xc4cc('0x2b')](_0x399809);};}exports['index']=function(_0x671849,_0x335fcd){var _0x4016f0={},_0x14fa3c={},_0xf481b4={'count':0x0,'rows':[]};var _0x17da49=_['map'](db[_0xc4cc('0x2c')][_0xc4cc('0x2d')],function(_0x35b25d){return{'name':_0x35b25d[_0xc4cc('0x2e')],'type':_0x35b25d[_0xc4cc('0x2f')][_0xc4cc('0x30')]};});_0x14fa3c[_0xc4cc('0x31')]=_[_0xc4cc('0x32')](_0x17da49,'name');_0x14fa3c[_0xc4cc('0x33')]=_['keys'](_0x671849[_0xc4cc('0x33')]);_0x14fa3c[_0xc4cc('0x34')]=_[_0xc4cc('0x35')](_0x14fa3c[_0xc4cc('0x31')],_0x14fa3c[_0xc4cc('0x33')]);_0x4016f0['attributes']=_[_0xc4cc('0x35')](_0x14fa3c[_0xc4cc('0x31')],qs['fields'](_0x671849['query'][_0xc4cc('0x36')]));_0x4016f0[_0xc4cc('0x37')]=_0x4016f0[_0xc4cc('0x37')][_0xc4cc('0x38')]?_0x4016f0[_0xc4cc('0x37')]:_0x14fa3c[_0xc4cc('0x31')];if(!_0x671849[_0xc4cc('0x33')]['hasOwnProperty'](_0xc4cc('0x39'))){_0x4016f0[_0xc4cc('0x21')]=qs[_0xc4cc('0x21')](_0x671849['query'][_0xc4cc('0x21')]);_0x4016f0[_0xc4cc('0x1f')]=qs[_0xc4cc('0x1f')](_0x671849[_0xc4cc('0x33')][_0xc4cc('0x1f')]);}_0x4016f0[_0xc4cc('0x3a')]=qs[_0xc4cc('0x3b')](_0x671849[_0xc4cc('0x33')][_0xc4cc('0x3b')]);_0x4016f0[_0xc4cc('0x3c')]=qs[_0xc4cc('0x34')](_['pick'](_0x671849[_0xc4cc('0x33')],_0x14fa3c['filters']),_0x17da49);if(_0x671849[_0xc4cc('0x33')][_0xc4cc('0x3d')]){_0x4016f0[_0xc4cc('0x3c')]=_['merge'](_0x4016f0[_0xc4cc('0x3c')],{'$or':_[_0xc4cc('0x32')](_0x17da49,function(_0x5aef0e){if(_0x5aef0e['type']!==_0xc4cc('0x3e')){var _0x44f23c={};_0x44f23c[_0x5aef0e[_0xc4cc('0x2a')]]={'$like':'%'+_0x671849[_0xc4cc('0x33')][_0xc4cc('0x3d')]+'%'};return _0x44f23c;}})});}_0x4016f0=_[_0xc4cc('0x3f')]({},_0x4016f0,_0x671849[_0xc4cc('0x40')]);var _0xbdeffb={'where':_0x4016f0[_0xc4cc('0x3c')]};return db[_0xc4cc('0x2c')][_0xc4cc('0x22')](_0xbdeffb)['then'](function(_0x3f95bf){_0xf481b4[_0xc4cc('0x22')]=_0x3f95bf;if(_0x671849[_0xc4cc('0x33')]['includeAll']){_0x4016f0[_0xc4cc('0x41')]=[{'all':!![]}];}return db[_0xc4cc('0x2c')][_0xc4cc('0x42')](_0x4016f0);})[_0xc4cc('0x28')](function(_0x1fde1a){_0xf481b4[_0xc4cc('0x43')]=_0x1fde1a;return _0xf481b4;})[_0xc4cc('0x28')](respondWithFilteredResult(_0x335fcd,_0x4016f0))[_0xc4cc('0x44')](handleError(_0x335fcd,null));};exports[_0xc4cc('0x45')]=function(_0x10b7ea,_0x5a47a2){var _0x277c78={'raw':![],'where':{'id':_0x10b7ea[_0xc4cc('0x46')]['id']}},_0x2d7742={};_0x2d7742[_0xc4cc('0x31')]=_[_0xc4cc('0x47')](db[_0xc4cc('0x2c')][_0xc4cc('0x2d')]);_0x2d7742[_0xc4cc('0x33')]=_['keys'](_0x10b7ea[_0xc4cc('0x33')]);_0x2d7742[_0xc4cc('0x34')]=_['intersection'](_0x2d7742[_0xc4cc('0x31')],_0x2d7742[_0xc4cc('0x33')]);_0x277c78['attributes']=_['intersection'](_0x2d7742[_0xc4cc('0x31')],qs['fields'](_0x10b7ea[_0xc4cc('0x33')][_0xc4cc('0x36')]));_0x277c78[_0xc4cc('0x37')]=_0x277c78[_0xc4cc('0x37')][_0xc4cc('0x38')]?_0x277c78[_0xc4cc('0x37')]:_0x2d7742[_0xc4cc('0x31')];if(_0x10b7ea[_0xc4cc('0x33')]['includeAll']){_0x277c78[_0xc4cc('0x41')]=[{'all':!![]}];}_0x277c78=_[_0xc4cc('0x3f')]({},_0x277c78,_0x10b7ea[_0xc4cc('0x40')]);return db['VoiceQueueReport']['find'](_0x277c78)['then'](handleEntityNotFound(_0x5a47a2,null))['then'](respondWithResult(_0x5a47a2,null))[_0xc4cc('0x44')](handleError(_0x5a47a2,null));};exports[_0xc4cc('0x48')]=function(_0x465f27,_0xefaaad){return db[_0xc4cc('0x2c')][_0xc4cc('0x48')](_0x465f27[_0xc4cc('0x49')],{})[_0xc4cc('0x28')](respondWithResult(_0xefaaad,0xc9))[_0xc4cc('0x44')](handleError(_0xefaaad,null));};exports[_0xc4cc('0x27')]=function(_0xe3874c,_0x31761f){if(_0xe3874c[_0xc4cc('0x49')]['id']){delete _0xe3874c[_0xc4cc('0x49')]['id'];}return db[_0xc4cc('0x2c')]['find']({'where':{'id':_0xe3874c['params']['id']}})[_0xc4cc('0x28')](handleEntityNotFound(_0x31761f,null))[_0xc4cc('0x28')](saveUpdates(_0xe3874c[_0xc4cc('0x49')],null))[_0xc4cc('0x28')](respondWithResult(_0x31761f,null))[_0xc4cc('0x44')](handleError(_0x31761f,null));};exports[_0xc4cc('0x4a')]=function(_0x18cead,_0x5155af){return db[_0xc4cc('0x2c')]['find']({'where':{'id':_0x18cead[_0xc4cc('0x46')]['id']}})[_0xc4cc('0x28')](handleEntityNotFound(_0x5155af,null))['then'](removeEntity(_0x5155af,null))[_0xc4cc('0x44')](handleError(_0x5155af,null));};exports['describe']=function(_0x311959,_0x21564e){return db['VoiceQueueReport'][_0xc4cc('0x4b')]()[_0xc4cc('0x28')](respondWithResult(_0x21564e,null))['catch'](handleError(_0x21564e,null));};exports[_0xc4cc('0x4c')]=function(_0x4b7c36,_0x3d50c5){var _0x14ba34={},_0x4eb1fe={},_0x7e4d8={'count':0x0,'rows':[]};_0x4eb1fe[_0xc4cc('0x31')]=_[_0xc4cc('0x47')](db[_0xc4cc('0x2c')]['rawAttributes']);_0x4eb1fe[_0xc4cc('0x33')]=_[_0xc4cc('0x47')](_0x4b7c36[_0xc4cc('0x33')]);_0x4eb1fe['filters']=_[_0xc4cc('0x35')](_0x4eb1fe['model'],_0x4eb1fe[_0xc4cc('0x33')]);_0x14ba34[_0xc4cc('0x37')]=_[_0xc4cc('0x35')](_0x4eb1fe[_0xc4cc('0x31')],qs[_0xc4cc('0x36')](_0x4b7c36[_0xc4cc('0x33')][_0xc4cc('0x36')]));_0x14ba34['attributes']=_0x14ba34[_0xc4cc('0x37')][_0xc4cc('0x38')]?_0x14ba34[_0xc4cc('0x37')]:_0x4eb1fe['model'];if(!_0x4b7c36[_0xc4cc('0x33')][_0xc4cc('0x4d')](_0xc4cc('0x39'))){_0x14ba34['limit']=qs[_0xc4cc('0x21')](_0x4b7c36[_0xc4cc('0x33')][_0xc4cc('0x21')]);_0x14ba34[_0xc4cc('0x1f')]=qs[_0xc4cc('0x1f')](_0x4b7c36[_0xc4cc('0x33')][_0xc4cc('0x1f')]);}_0x14ba34[_0xc4cc('0x3a')]=qs[_0xc4cc('0x3b')](_0x4b7c36[_0xc4cc('0x33')][_0xc4cc('0x3b')]);_0x14ba34['where']=qs[_0xc4cc('0x34')](_['pick'](_0x4b7c36[_0xc4cc('0x33')],_0x4eb1fe[_0xc4cc('0x34')]));if(_0x4b7c36[_0xc4cc('0x33')][_0xc4cc('0x3d')]){_0x14ba34['where']=_[_0xc4cc('0x3f')](_0x14ba34['where'],{'$or':_[_0xc4cc('0x32')](_0x14ba34[_0xc4cc('0x37')],function(_0x3a2eff){var _0x875870={};_0x875870[_0x3a2eff]={'$like':'%'+_0x4b7c36['query'][_0xc4cc('0x3d')]+'%'};return _0x875870;})});}_0x14ba34=_[_0xc4cc('0x3f')]({},_0x14ba34,_0x4b7c36['options']);var _0x324788={'where':_0x14ba34[_0xc4cc('0x3c')]};return db[_0xc4cc('0x2c')]['count'](_0x324788)[_0xc4cc('0x28')](function(_0x5668df){_0x7e4d8['count']=_0x5668df;if(_0x4b7c36['query'][_0xc4cc('0x4e')]){_0x14ba34[_0xc4cc('0x41')]=[{'all':!![]}];}return db[_0xc4cc('0x2c')][_0xc4cc('0x42')](_0x14ba34);})[_0xc4cc('0x28')](function(_0x61433d){_0x7e4d8[_0xc4cc('0x43')]=_0x61433d;return _0x7e4d8;})['then'](respondWithFilteredResult(_0x3d50c5,_0x14ba34,_0xc4cc('0x4c')))[_0xc4cc('0x44')](handleError(_0x3d50c5,null,_0xc4cc('0x4c')));}; \ No newline at end of file +var _0x3b00=['includeAll','include','findAll','catch','show','params','keys','find','create','body','describe','getVoiceQueuesReport','length','hasOwnProperty','nolimit','order','rows','eml-format','rimraf','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','VoiceQueueReport','rawAttributes','key','model','query','intersection','fields','attributes','sort','filters','pick','filter','where','merge','type','VIRTUAL','options'];(function(_0xe68140,_0x13c91a){var _0x3af9dd=function(_0x48faad){while(--_0x48faad){_0xe68140['push'](_0xe68140['shift']());}};_0x3af9dd(++_0x13c91a);}(_0x3b00,0xb9));var _0x03b0=function(_0x2be614,_0x3210a3){_0x2be614=_0x2be614-0x0;var _0x52a768=_0x3b00[_0x2be614];return _0x52a768;};'use strict';var emlformat=require(_0x03b0('0x0'));var rimraf=require(_0x03b0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x03b0('0x2'));var rp=require('request-promise');var moment=require(_0x03b0('0x3'));var BPromise=require(_0x03b0('0x4'));var Mustache=require('mustache');var util=require(_0x03b0('0x5'));var path=require('path');var sox=require(_0x03b0('0x6'));var csv=require(_0x03b0('0x7'));var ejs=require(_0x03b0('0x8'));var fs=require('fs');var fs_extra=require(_0x03b0('0x9'));var _=require(_0x03b0('0xa'));var squel=require(_0x03b0('0xb'));var crypto=require('crypto');var jsforce=require(_0x03b0('0xc'));var deskjs=require(_0x03b0('0xd'));var toCsv=require(_0x03b0('0x7'));var querystring=require('querystring');var Papa=require(_0x03b0('0xe'));var Redis=require(_0x03b0('0xf'));var authService=require(_0x03b0('0x10'));var qs=require(_0x03b0('0x11'));var as=require(_0x03b0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x03b0('0x13'))(_0x03b0('0x14'));var utils=require(_0x03b0('0x15'));var config=require(_0x03b0('0x16'));var licenseUtil=require(_0x03b0('0x17'));var db=require(_0x03b0('0x18'))['db'];config[_0x03b0('0x19')]=_['defaults'](config[_0x03b0('0x19')],{'host':_0x03b0('0x1a'),'port':0x18eb});var socket=require(_0x03b0('0x1b'))(new Redis(config['redis']));require(_0x03b0('0x1c'))[_0x03b0('0x1d')](socket);function respondWithStatusCode(_0x2814b2,_0x1a09b1){_0x1a09b1=_0x1a09b1||0xcc;return function(_0x15c3b7){if(_0x15c3b7){return _0x2814b2[_0x03b0('0x1e')](_0x1a09b1);}return _0x2814b2[_0x03b0('0x1f')](_0x1a09b1)[_0x03b0('0x20')]();};}function respondWithResult(_0x59e3e3,_0x4f0926){_0x4f0926=_0x4f0926||0xc8;return function(_0x29139a){if(_0x29139a){return _0x59e3e3[_0x03b0('0x1f')](_0x4f0926)['json'](_0x29139a);}};}function respondWithFilteredResult(_0x2a5135,_0x496d54){return function(_0x4fb2cc){if(_0x4fb2cc){var _0xe9b61d=typeof _0x496d54[_0x03b0('0x21')]==='undefined'&&typeof _0x496d54[_0x03b0('0x22')]===_0x03b0('0x23');var _0x5d6c0f=_0x4fb2cc['count'];var _0x2181cd=_0xe9b61d?0x0:_0x496d54[_0x03b0('0x21')];var _0x1024d5=_0xe9b61d?_0x4fb2cc[_0x03b0('0x24')]:_0x496d54[_0x03b0('0x21')]+_0x496d54['limit'];var _0x5215a1;if(_0x1024d5>=_0x5d6c0f){_0x1024d5=_0x5d6c0f;_0x5215a1=0xc8;}else{_0x5215a1=0xce;}_0x2a5135['status'](_0x5215a1);return _0x2a5135['set'](_0x03b0('0x25'),_0x2181cd+'-'+_0x1024d5+'/'+_0x5d6c0f)[_0x03b0('0x26')](_0x4fb2cc);}return null;};}function patchUpdates(_0x90950c){return function(_0x2b4407){try{jsonpatch[_0x03b0('0x27')](_0x2b4407,_0x90950c,!![]);}catch(_0x3fc8e5){return BPromise[_0x03b0('0x28')](_0x3fc8e5);}return _0x2b4407[_0x03b0('0x29')]();};}function saveUpdates(_0xc5639e,_0x4d55ed){return function(_0xc12906){if(_0xc12906){return _0xc12906[_0x03b0('0x2a')](_0xc5639e)[_0x03b0('0x2b')](function(_0x486232){return _0x486232;});}return null;};}function removeEntity(_0x5b1851,_0x5da586){return function(_0x55f0fb){if(_0x55f0fb){return _0x55f0fb[_0x03b0('0x2c')]()['then'](function(){_0x5b1851[_0x03b0('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48a20a,_0x407ad8){return function(_0x3cf9f1){if(!_0x3cf9f1){_0x48a20a['sendStatus'](0x194);}return _0x3cf9f1;};}function handleError(_0x598224,_0x6a26e9){_0x6a26e9=_0x6a26e9||0x1f4;return function(_0x81748f){logger[_0x03b0('0x2d')](_0x81748f['stack']);if(_0x81748f['name']){delete _0x81748f[_0x03b0('0x2e')];}_0x598224[_0x03b0('0x1f')](_0x6a26e9)[_0x03b0('0x2f')](_0x81748f);};}exports[_0x03b0('0x30')]=function(_0x1faa8b,_0x201948){var _0x524fe7={},_0x467173={},_0xd00af4={'count':0x0,'rows':[]};var _0x2875f7=_[_0x03b0('0x31')](db[_0x03b0('0x32')][_0x03b0('0x33')],function(_0x248969){return{'name':_0x248969['fieldName'],'type':_0x248969['type'][_0x03b0('0x34')]};});_0x467173[_0x03b0('0x35')]=_['map'](_0x2875f7,_0x03b0('0x2e'));_0x467173[_0x03b0('0x36')]=_['keys'](_0x1faa8b['query']);_0x467173['filters']=_['intersection'](_0x467173[_0x03b0('0x35')],_0x467173[_0x03b0('0x36')]);_0x524fe7['attributes']=_[_0x03b0('0x37')](_0x467173[_0x03b0('0x35')],qs['fields'](_0x1faa8b[_0x03b0('0x36')][_0x03b0('0x38')]));_0x524fe7['attributes']=_0x524fe7[_0x03b0('0x39')]['length']?_0x524fe7[_0x03b0('0x39')]:_0x467173[_0x03b0('0x35')];if(!_0x1faa8b['query']['hasOwnProperty']('nolimit')){_0x524fe7[_0x03b0('0x22')]=qs['limit'](_0x1faa8b[_0x03b0('0x36')][_0x03b0('0x22')]);_0x524fe7[_0x03b0('0x21')]=qs[_0x03b0('0x21')](_0x1faa8b[_0x03b0('0x36')]['offset']);}_0x524fe7['order']=qs['sort'](_0x1faa8b[_0x03b0('0x36')][_0x03b0('0x3a')]);_0x524fe7['where']=qs[_0x03b0('0x3b')](_[_0x03b0('0x3c')](_0x1faa8b['query'],_0x467173[_0x03b0('0x3b')]),_0x2875f7);if(_0x1faa8b[_0x03b0('0x36')][_0x03b0('0x3d')]){_0x524fe7[_0x03b0('0x3e')]=_[_0x03b0('0x3f')](_0x524fe7[_0x03b0('0x3e')],{'$or':_[_0x03b0('0x31')](_0x2875f7,function(_0x3d61f4){if(_0x3d61f4[_0x03b0('0x40')]!==_0x03b0('0x41')){var _0x5b26b3={};_0x5b26b3[_0x3d61f4['name']]={'$like':'%'+_0x1faa8b[_0x03b0('0x36')][_0x03b0('0x3d')]+'%'};return _0x5b26b3;}})});}_0x524fe7=_[_0x03b0('0x3f')]({},_0x524fe7,_0x1faa8b[_0x03b0('0x42')]);var _0x293d27={'where':_0x524fe7['where']};return db[_0x03b0('0x32')][_0x03b0('0x24')](_0x293d27)[_0x03b0('0x2b')](function(_0x48163c){_0xd00af4[_0x03b0('0x24')]=_0x48163c;if(_0x1faa8b[_0x03b0('0x36')][_0x03b0('0x43')]){_0x524fe7[_0x03b0('0x44')]=[{'all':!![]}];}return db[_0x03b0('0x32')][_0x03b0('0x45')](_0x524fe7);})[_0x03b0('0x2b')](function(_0x475aca){_0xd00af4['rows']=_0x475aca;return _0xd00af4;})[_0x03b0('0x2b')](respondWithFilteredResult(_0x201948,_0x524fe7))[_0x03b0('0x46')](handleError(_0x201948,null));};exports[_0x03b0('0x47')]=function(_0x3d9201,_0x47fffa){var _0x1bec82={'raw':![],'where':{'id':_0x3d9201[_0x03b0('0x48')]['id']}},_0x3d5f91={};_0x3d5f91['model']=_['keys'](db[_0x03b0('0x32')][_0x03b0('0x33')]);_0x3d5f91[_0x03b0('0x36')]=_[_0x03b0('0x49')](_0x3d9201[_0x03b0('0x36')]);_0x3d5f91[_0x03b0('0x3b')]=_[_0x03b0('0x37')](_0x3d5f91[_0x03b0('0x35')],_0x3d5f91[_0x03b0('0x36')]);_0x1bec82[_0x03b0('0x39')]=_[_0x03b0('0x37')](_0x3d5f91[_0x03b0('0x35')],qs[_0x03b0('0x38')](_0x3d9201[_0x03b0('0x36')][_0x03b0('0x38')]));_0x1bec82[_0x03b0('0x39')]=_0x1bec82[_0x03b0('0x39')]['length']?_0x1bec82['attributes']:_0x3d5f91['model'];if(_0x3d9201[_0x03b0('0x36')][_0x03b0('0x43')]){_0x1bec82['include']=[{'all':!![]}];}_0x1bec82=_[_0x03b0('0x3f')]({},_0x1bec82,_0x3d9201['options']);return db[_0x03b0('0x32')][_0x03b0('0x4a')](_0x1bec82)[_0x03b0('0x2b')](handleEntityNotFound(_0x47fffa,null))['then'](respondWithResult(_0x47fffa,null))[_0x03b0('0x46')](handleError(_0x47fffa,null));};exports[_0x03b0('0x4b')]=function(_0x2653a4,_0x2a1609){return db[_0x03b0('0x32')][_0x03b0('0x4b')](_0x2653a4[_0x03b0('0x4c')],{})[_0x03b0('0x2b')](respondWithResult(_0x2a1609,0xc9))[_0x03b0('0x46')](handleError(_0x2a1609,null));};exports[_0x03b0('0x2a')]=function(_0x144aac,_0xdc7838){if(_0x144aac[_0x03b0('0x4c')]['id']){delete _0x144aac[_0x03b0('0x4c')]['id'];}return db['VoiceQueueReport'][_0x03b0('0x4a')]({'where':{'id':_0x144aac[_0x03b0('0x48')]['id']}})['then'](handleEntityNotFound(_0xdc7838,null))['then'](saveUpdates(_0x144aac[_0x03b0('0x4c')],null))[_0x03b0('0x2b')](respondWithResult(_0xdc7838,null))['catch'](handleError(_0xdc7838,null));};exports['destroy']=function(_0x3cd400,_0x4b73ff){return db['VoiceQueueReport'][_0x03b0('0x4a')]({'where':{'id':_0x3cd400[_0x03b0('0x48')]['id']}})['then'](handleEntityNotFound(_0x4b73ff,null))[_0x03b0('0x2b')](removeEntity(_0x4b73ff,null))[_0x03b0('0x46')](handleError(_0x4b73ff,null));};exports[_0x03b0('0x4d')]=function(_0x3b7718,_0x1397bf){return db[_0x03b0('0x32')]['describe']()['then'](respondWithResult(_0x1397bf,null))[_0x03b0('0x46')](handleError(_0x1397bf,null));};exports[_0x03b0('0x4e')]=function(_0x25a368,_0x4caa66){var _0x238986={},_0x286ce0={},_0x5a7129={'count':0x0,'rows':[]};_0x286ce0['model']=_[_0x03b0('0x49')](db[_0x03b0('0x32')][_0x03b0('0x33')]);_0x286ce0[_0x03b0('0x36')]=_[_0x03b0('0x49')](_0x25a368[_0x03b0('0x36')]);_0x286ce0[_0x03b0('0x3b')]=_[_0x03b0('0x37')](_0x286ce0[_0x03b0('0x35')],_0x286ce0['query']);_0x238986['attributes']=_[_0x03b0('0x37')](_0x286ce0[_0x03b0('0x35')],qs[_0x03b0('0x38')](_0x25a368[_0x03b0('0x36')][_0x03b0('0x38')]));_0x238986[_0x03b0('0x39')]=_0x238986[_0x03b0('0x39')][_0x03b0('0x4f')]?_0x238986[_0x03b0('0x39')]:_0x286ce0[_0x03b0('0x35')];if(!_0x25a368[_0x03b0('0x36')][_0x03b0('0x50')](_0x03b0('0x51'))){_0x238986[_0x03b0('0x22')]=qs[_0x03b0('0x22')](_0x25a368[_0x03b0('0x36')][_0x03b0('0x22')]);_0x238986[_0x03b0('0x21')]=qs[_0x03b0('0x21')](_0x25a368[_0x03b0('0x36')][_0x03b0('0x21')]);}_0x238986[_0x03b0('0x52')]=qs[_0x03b0('0x3a')](_0x25a368[_0x03b0('0x36')]['sort']);_0x238986[_0x03b0('0x3e')]=qs['filters'](_['pick'](_0x25a368[_0x03b0('0x36')],_0x286ce0[_0x03b0('0x3b')]));if(_0x25a368[_0x03b0('0x36')][_0x03b0('0x3d')]){_0x238986[_0x03b0('0x3e')]=_[_0x03b0('0x3f')](_0x238986[_0x03b0('0x3e')],{'$or':_[_0x03b0('0x31')](_0x238986[_0x03b0('0x39')],function(_0x4d2bac){var _0x357875={};_0x357875[_0x4d2bac]={'$like':'%'+_0x25a368[_0x03b0('0x36')][_0x03b0('0x3d')]+'%'};return _0x357875;})});}_0x238986=_['merge']({},_0x238986,_0x25a368['options']);var _0x4c186e={'where':_0x238986[_0x03b0('0x3e')]};return db[_0x03b0('0x32')][_0x03b0('0x24')](_0x4c186e)[_0x03b0('0x2b')](function(_0xf05844){_0x5a7129[_0x03b0('0x24')]=_0xf05844;if(_0x25a368[_0x03b0('0x36')][_0x03b0('0x43')]){_0x238986['include']=[{'all':!![]}];}return db[_0x03b0('0x32')][_0x03b0('0x45')](_0x238986);})[_0x03b0('0x2b')](function(_0x50d21a){_0x5a7129[_0x03b0('0x53')]=_0x50d21a;return _0x5a7129;})[_0x03b0('0x2b')](respondWithFilteredResult(_0x4caa66,_0x238986,_0x03b0('0x4e')))[_0x03b0('0x46')](handleError(_0x4caa66,null,_0x03b0('0x4e')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 6af9092..ee1779d 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 _0xea00=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','save','update'];(function(_0x5a26f5,_0x196300){var _0x2e9ef7=function(_0x593736){while(--_0x593736){_0x5a26f5['push'](_0x5a26f5['shift']());}};_0x2e9ef7(++_0x196300);}(_0xea00,0x64));var _0x0ea0=function(_0x1ee88f,_0x28c7ab){_0x1ee88f=_0x1ee88f-0x0;var _0x4b5ce8=_0xea00[_0x1ee88f];return _0x4b5ce8;};'use strict';var EventEmitter=require(_0x0ea0('0x0'));var VoiceQueueReport=require(_0x0ea0('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0ea0('0x2'),'afterUpdate':_0x0ea0('0x3'),'afterDestroy':_0x0ea0('0x4')};function emitEvent(_0x3ef27f){return function(_0x5cfcac,_0x27d5e0,_0x2c069f){VoiceQueueReportEvents[_0x0ea0('0x5')](_0x3ef27f+':'+_0x5cfcac['id'],_0x5cfcac);VoiceQueueReportEvents['emit'](_0x3ef27f,_0x5cfcac);_0x2c069f(null);};}for(var e in events){if(events[_0x0ea0('0x6')](e)){var event=events[e];VoiceQueueReport[_0x0ea0('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0xa957=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x4de39f,_0x2e86a7){var _0x369041=function(_0x18cd6c){while(--_0x18cd6c){_0x4de39f['push'](_0x4de39f['shift']());}};_0x369041(++_0x2e86a7);}(_0xa957,0x1d6));var _0x7a95=function(_0x328419,_0x4ab653){_0x328419=_0x328419-0x0;var _0x342aa7=_0xa957[_0x328419];return _0x342aa7;};'use strict';var EventEmitter=require(_0x7a95('0x0'));var VoiceQueueReport=require(_0x7a95('0x1'))['db'][_0x7a95('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x7a95('0x3')](0x0);var events={'afterCreate':_0x7a95('0x4'),'afterUpdate':_0x7a95('0x5'),'afterDestroy':_0x7a95('0x6')};function emitEvent(_0x3e167e){return function(_0x3846cf,_0xbe96c1,_0x45b2cc){VoiceQueueReportEvents['emit'](_0x3e167e+':'+_0x3846cf['id'],_0x3846cf);VoiceQueueReportEvents[_0x7a95('0x7')](_0x3e167e,_0x3846cf);_0x45b2cc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x7a95('0x8')](e,emitEvent(event));}}module[_0x7a95('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index b713a7e..07c31a2 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 _0x17bd=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x17bd,0xbe));var _0xd17b=function(_0xcd3810,_0x526a4a){_0xcd3810=_0xcd3810-0x0;var _0x1ddfef=_0x17bd[_0xcd3810];return _0x1ddfef;};'use strict';var _=require(_0xd17b('0x0'));var util=require(_0xd17b('0x1'));var logger=require(_0xd17b('0x2'))(_0xd17b('0x3'));var moment=require(_0xd17b('0x4'));var BPromise=require(_0xd17b('0x5'));var rp=require(_0xd17b('0x6'));var fs=require('fs');var path=require(_0xd17b('0x7'));var rimraf=require('rimraf');var config=require(_0xd17b('0x8'));var attributes=require(_0xd17b('0x9'));module[_0xd17b('0xa')]=function(_0x5adc68,_0x2c6744){return _0x5adc68[_0xd17b('0xb')](_0xd17b('0xc'),attributes,{'tableName':_0xd17b('0xd'),'paranoid':![],'indexes':[{'fields':[_0xd17b('0xe')]},{'fields':[_0xd17b('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3cad=['VoiceQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceQueueReport.attributes','exports','define'];(function(_0x3d2fbb,_0x302994){var _0x3f7dff=function(_0x35bdc6){while(--_0x35bdc6){_0x3d2fbb['push'](_0x3d2fbb['shift']());}};_0x3f7dff(++_0x302994);}(_0x3cad,0xc6));var _0xd3ca=function(_0x67d15a,_0x25159f){_0x67d15a=_0x67d15a-0x0;var _0x3b7f21=_0x3cad[_0x67d15a];return _0x3b7f21;};'use strict';var _=require(_0xd3ca('0x0'));var util=require(_0xd3ca('0x1'));var logger=require(_0xd3ca('0x2'))(_0xd3ca('0x3'));var moment=require(_0xd3ca('0x4'));var BPromise=require(_0xd3ca('0x5'));var rp=require(_0xd3ca('0x6'));var fs=require('fs');var path=require(_0xd3ca('0x7'));var rimraf=require('rimraf');var config=require(_0xd3ca('0x8'));var attributes=require(_0xd3ca('0x9'));module[_0xd3ca('0xa')]=function(_0x20cbba,_0x3ff377){return _0x20cbba[_0xd3ca('0xb')](_0xd3ca('0xc'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xd3ca('0xd')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index ada6966..6429a67 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 _0x9ebf=['GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','limit','map','include','model','attributes','then','CreateVoiceQueueReport','body','raw','debug','UpdateVoiceQueueReport','update','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x9ebf,0x171));var _0xf9eb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9ebf[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf9eb('0x0'));var util=require('util');var moment=require(_0xf9eb('0x1'));var BPromise=require(_0xf9eb('0x2'));var rs=require(_0xf9eb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf9eb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf9eb('0x5'))(_0xf9eb('0x6'));var config=require(_0xf9eb('0x7'));var jayson=require(_0xf9eb('0x8'));var client=jayson[_0xf9eb('0x9')][_0xf9eb('0xa')]({'port':0x232a});config[_0xf9eb('0xb')]=_[_0xf9eb('0xc')](config[_0xf9eb('0xb')],{'host':_0xf9eb('0xd'),'port':0x18eb});var socket=require(_0xf9eb('0xe'))(new Redis(config['redis']));require(_0xf9eb('0xf'))[_0xf9eb('0x10')](socket);function respondWithRpcPromise(_0x375310,_0x2550b5,_0x1254b9){return new BPromise(function(_0x385375,_0x197b59){return client[_0xf9eb('0x11')](_0x375310,_0x1254b9)['then'](function(_0x42a317){logger[_0xf9eb('0x12')](_0xf9eb('0x13'),_0x2550b5,_0xf9eb('0x14'));logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x2550b5,_0xf9eb('0x14'),JSON[_0xf9eb('0x15')](_0x42a317));if(_0x42a317[_0xf9eb('0x16')]){if(_0x42a317[_0xf9eb('0x16')][_0xf9eb('0x17')]===0x1f4){logger[_0xf9eb('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x2550b5,_0x42a317[_0xf9eb('0x16')][_0xf9eb('0x18')]);return _0x197b59(_0x42a317[_0xf9eb('0x16')][_0xf9eb('0x18')]);}logger[_0xf9eb('0x16')](_0xf9eb('0x13'),_0x2550b5,_0x42a317[_0xf9eb('0x16')][_0xf9eb('0x18')]);return _0x385375(_0x42a317[_0xf9eb('0x16')]['message']);}else{logger[_0xf9eb('0x12')](_0xf9eb('0x13'),_0x2550b5,'request\x20sent');_0x385375(_0x42a317[_0xf9eb('0x19')][_0xf9eb('0x18')]);}})[_0xf9eb('0x1a')](function(_0x3b580f){logger[_0xf9eb('0x16')](_0xf9eb('0x13'),_0x2550b5,_0x3b580f);_0x197b59(_0x3b580f);});});}exports[_0xf9eb('0x1b')]=function(_0x473b73){var _0x8c3a39=this;return new Promise(function(_0x5d4923,_0x4ea674){return db[_0xf9eb('0x1c')][_0xf9eb('0x1d')]({'raw':_0x473b73['options']?_0x473b73['options']['raw']===undefined?!![]:![]:!![],'where':_0x473b73['options']?_0x473b73[_0xf9eb('0x1e')][_0xf9eb('0x1f')]||null:null,'attributes':_0x473b73[_0xf9eb('0x1e')]?_0x473b73[_0xf9eb('0x1e')]['attributes']||null:null,'limit':_0x473b73[_0xf9eb('0x1e')]?_0x473b73[_0xf9eb('0x1e')][_0xf9eb('0x20')]||null:null,'include':_0x473b73[_0xf9eb('0x1e')]?_0x473b73[_0xf9eb('0x1e')]['include']?_[_0xf9eb('0x21')](_0x473b73['options'][_0xf9eb('0x22')],function(_0x38aa55){return{'model':db[_0x38aa55[_0xf9eb('0x23')]],'as':_0x38aa55['as'],'attributes':_0x38aa55[_0xf9eb('0x24')],'include':_0x38aa55[_0xf9eb('0x22')]?_[_0xf9eb('0x21')](_0x38aa55['include'],function(_0x497471){return{'model':db[_0x497471['model']],'as':_0x497471['as'],'attributes':_0x497471[_0xf9eb('0x24')],'include':_0x497471['include']?_[_0xf9eb('0x21')](_0x497471[_0xf9eb('0x22')],function(_0x338153){return{'model':db[_0x338153[_0xf9eb('0x23')]],'as':_0x338153['as'],'attributes':_0x338153['attributes']};}):[]};}):[]};}):[]:[]})[_0xf9eb('0x25')](function(_0x5b3a35){logger[_0xf9eb('0x12')]('GetVoiceQueueReport',_0x473b73);logger['debug'](_0xf9eb('0x1b'),_0x473b73,JSON[_0xf9eb('0x15')](_0x5b3a35));_0x5d4923(_0x5b3a35);})[_0xf9eb('0x1a')](function(_0x161f77){logger['error'](_0xf9eb('0x1b'),_0x161f77[_0xf9eb('0x18')],_0x473b73);_0x4ea674(_0x8c3a39[_0xf9eb('0x16')](0x1f4,_0x161f77[_0xf9eb('0x18')]));});});};exports[_0xf9eb('0x26')]=function(_0x43d16b){var _0x21edf5=this;return new Promise(function(_0x3fd880,_0x304330){return db[_0xf9eb('0x1c')]['create'](_0x43d16b[_0xf9eb('0x27')],{'raw':_0x43d16b[_0xf9eb('0x1e')]?_0x43d16b[_0xf9eb('0x1e')][_0xf9eb('0x28')]===undefined?!![]:![]:!![]})[_0xf9eb('0x25')](function(_0x3193a0){logger[_0xf9eb('0x12')]('CreateVoiceQueueReport',_0x43d16b);logger[_0xf9eb('0x29')]('CreateVoiceQueueReport',_0x43d16b,JSON[_0xf9eb('0x15')](_0x3193a0));_0x3fd880(_0x3193a0);})['catch'](function(_0x366cde){logger['error'](_0xf9eb('0x26'),_0x366cde[_0xf9eb('0x18')],_0x43d16b);_0x304330(_0x21edf5[_0xf9eb('0x16')](0x1f4,_0x366cde[_0xf9eb('0x18')]));});});};exports[_0xf9eb('0x2a')]=function(_0x4e70ec){var _0x3494b0=this;return new Promise(function(_0x24f386,_0x1cafd8){return db['VoiceQueueReport'][_0xf9eb('0x2b')](_0x4e70ec[_0xf9eb('0x27')],{'raw':_0x4e70ec[_0xf9eb('0x1e')]?_0x4e70ec[_0xf9eb('0x1e')][_0xf9eb('0x28')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e70ec[_0xf9eb('0x1e')]?_0x4e70ec[_0xf9eb('0x1e')][_0xf9eb('0x1f')]||null:null,'attributes':_0x4e70ec['options']?_0x4e70ec['options']['attributes']||null:null,'limit':_0x4e70ec[_0xf9eb('0x1e')]?_0x4e70ec[_0xf9eb('0x1e')][_0xf9eb('0x20')]||null:null})[_0xf9eb('0x25')](function(_0x265022){logger[_0xf9eb('0x12')]('UpdateVoiceQueueReport',_0x4e70ec);logger['debug'](_0xf9eb('0x2a'),_0x4e70ec,JSON['stringify'](_0x265022));_0x24f386(_0x265022);})[_0xf9eb('0x1a')](function(_0x23c53a){logger[_0xf9eb('0x16')](_0xf9eb('0x2a'),_0x23c53a[_0xf9eb('0x18')],_0x4e70ec);_0x1cafd8(_0x3494b0[_0xf9eb('0x16')](0x1f4,_0x23c53a[_0xf9eb('0x18')]));});});}; \ No newline at end of file +var _0xf209=['VoiceQueueReport,\x20%s,\x20%s','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','include','model','map','CreateVoiceQueueReport','create','body','update','limit','debug','UpdateVoiceQueueReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x10507f,_0x40ab76){var _0x3e8892=function(_0x3b4ad9){while(--_0x3b4ad9){_0x10507f['push'](_0x10507f['shift']());}};_0x3e8892(++_0x40ab76);}(_0xf209,0xa2));var _0x9f20=function(_0x39c12e,_0x585534){_0x39c12e=_0x39c12e-0x0;var _0x58dbf4=_0xf209[_0x39c12e];return _0x58dbf4;};'use strict';var _=require(_0x9f20('0x0'));var util=require(_0x9f20('0x1'));var moment=require(_0x9f20('0x2'));var BPromise=require(_0x9f20('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9f20('0x4'));var db=require(_0x9f20('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9f20('0x6'))(_0x9f20('0x7'));var config=require(_0x9f20('0x8'));var jayson=require(_0x9f20('0x9'));var client=jayson[_0x9f20('0xa')][_0x9f20('0xb')]({'port':0x232a});config[_0x9f20('0xc')]=_[_0x9f20('0xd')](config[_0x9f20('0xc')],{'host':_0x9f20('0xe'),'port':0x18eb});var socket=require(_0x9f20('0xf'))(new Redis(config[_0x9f20('0xc')]));require(_0x9f20('0x10'))[_0x9f20('0x11')](socket);function respondWithRpcPromise(_0x211d8e,_0x571cf0,_0x588391){return new BPromise(function(_0x382f9c,_0x512430){return client[_0x9f20('0x12')](_0x211d8e,_0x588391)[_0x9f20('0x13')](function(_0x21ad7a){logger[_0x9f20('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x571cf0,_0x9f20('0x15'));logger['debug'](_0x9f20('0x16'),_0x571cf0,_0x9f20('0x15'),JSON[_0x9f20('0x17')](_0x21ad7a));if(_0x21ad7a['error']){if(_0x21ad7a[_0x9f20('0x18')][_0x9f20('0x19')]===0x1f4){logger['error'](_0x9f20('0x1a'),_0x571cf0,_0x21ad7a['error'][_0x9f20('0x1b')]);return _0x512430(_0x21ad7a[_0x9f20('0x18')]['message']);}logger[_0x9f20('0x18')](_0x9f20('0x1a'),_0x571cf0,_0x21ad7a[_0x9f20('0x18')][_0x9f20('0x1b')]);return _0x382f9c(_0x21ad7a['error']['message']);}else{logger[_0x9f20('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x571cf0,_0x9f20('0x15'));_0x382f9c(_0x21ad7a[_0x9f20('0x1c')][_0x9f20('0x1b')]);}})[_0x9f20('0x1d')](function(_0x3ee9a5){logger[_0x9f20('0x18')](_0x9f20('0x1a'),_0x571cf0,_0x3ee9a5);_0x512430(_0x3ee9a5);});});}exports[_0x9f20('0x1e')]=function(_0x7f8b6a){var _0x4d4122=this;return new Promise(function(_0x48947d,_0x564d21){return db[_0x9f20('0x1f')][_0x9f20('0x20')]({'raw':_0x7f8b6a[_0x9f20('0x21')]?_0x7f8b6a[_0x9f20('0x21')][_0x9f20('0x22')]===undefined?!![]:![]:!![],'where':_0x7f8b6a[_0x9f20('0x21')]?_0x7f8b6a[_0x9f20('0x21')][_0x9f20('0x23')]||null:null,'attributes':_0x7f8b6a[_0x9f20('0x21')]?_0x7f8b6a[_0x9f20('0x21')][_0x9f20('0x24')]||null:null,'limit':_0x7f8b6a['options']?_0x7f8b6a[_0x9f20('0x21')]['limit']||null:null,'include':_0x7f8b6a['options']?_0x7f8b6a[_0x9f20('0x21')][_0x9f20('0x25')]?_['map'](_0x7f8b6a['options']['include'],function(_0x180fee){return{'model':db[_0x180fee[_0x9f20('0x26')]],'as':_0x180fee['as'],'attributes':_0x180fee[_0x9f20('0x24')],'include':_0x180fee[_0x9f20('0x25')]?_[_0x9f20('0x27')](_0x180fee['include'],function(_0x413310){return{'model':db[_0x413310[_0x9f20('0x26')]],'as':_0x413310['as'],'attributes':_0x413310[_0x9f20('0x24')],'include':_0x413310['include']?_['map'](_0x413310['include'],function(_0x409469){return{'model':db[_0x409469[_0x9f20('0x26')]],'as':_0x409469['as'],'attributes':_0x409469['attributes']};}):[]};}):[]};}):[]:[]})[_0x9f20('0x13')](function(_0x25986c){logger['info']('GetVoiceQueueReport',_0x7f8b6a);logger['debug'](_0x9f20('0x1e'),_0x7f8b6a,JSON['stringify'](_0x25986c));_0x48947d(_0x25986c);})[_0x9f20('0x1d')](function(_0x584729){logger[_0x9f20('0x18')]('GetVoiceQueueReport',_0x584729[_0x9f20('0x1b')],_0x7f8b6a);_0x564d21(_0x4d4122[_0x9f20('0x18')](0x1f4,_0x584729[_0x9f20('0x1b')]));});});};exports[_0x9f20('0x28')]=function(_0x252923){var _0x1cdf64=this;return new Promise(function(_0x3d79f3,_0x49924a){return db[_0x9f20('0x1f')][_0x9f20('0x29')](_0x252923[_0x9f20('0x2a')],{'raw':_0x252923['options']?_0x252923[_0x9f20('0x21')]['raw']===undefined?!![]:![]:!![]})[_0x9f20('0x13')](function(_0x1595c2){logger[_0x9f20('0x14')]('CreateVoiceQueueReport',_0x252923);logger['debug'](_0x9f20('0x28'),_0x252923,JSON[_0x9f20('0x17')](_0x1595c2));_0x3d79f3(_0x1595c2);})['catch'](function(_0x3e4dc5){logger[_0x9f20('0x18')]('CreateVoiceQueueReport',_0x3e4dc5[_0x9f20('0x1b')],_0x252923);_0x49924a(_0x1cdf64['error'](0x1f4,_0x3e4dc5[_0x9f20('0x1b')]));});});};exports['UpdateVoiceQueueReport']=function(_0x2e9553){var _0x50e4ae=this;return new Promise(function(_0x1409db,_0x35a1cd){return db[_0x9f20('0x1f')][_0x9f20('0x2b')](_0x2e9553[_0x9f20('0x2a')],{'raw':_0x2e9553['options']?_0x2e9553[_0x9f20('0x21')][_0x9f20('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e9553['options']?_0x2e9553[_0x9f20('0x21')][_0x9f20('0x23')]||null:null,'attributes':_0x2e9553[_0x9f20('0x21')]?_0x2e9553['options']['attributes']||null:null,'limit':_0x2e9553[_0x9f20('0x21')]?_0x2e9553[_0x9f20('0x21')][_0x9f20('0x2c')]||null:null})['then'](function(_0x3b7707){logger['info']('UpdateVoiceQueueReport',_0x2e9553);logger[_0x9f20('0x2d')](_0x9f20('0x2e'),_0x2e9553,JSON[_0x9f20('0x17')](_0x3b7707));_0x1409db(_0x3b7707);})[_0x9f20('0x1d')](function(_0x43b08b){logger[_0x9f20('0x18')](_0x9f20('0x2e'),_0x43b08b[_0x9f20('0x1b')],_0x2e9553);_0x35a1cd(_0x50e4ae[_0x9f20('0x18')](0x1f4,_0x43b08b['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index c0d4bc2..6ae37d2 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 _0x31c2=['removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit'];(function(_0x18db38,_0x3a1001){var _0x185e7a=function(_0x5aca6d){while(--_0x5aca6d){_0x18db38['push'](_0x18db38['shift']());}};_0x185e7a(++_0x3a1001);}(_0x31c2,0x1e1));var _0x231c=function(_0x1d787c,_0x4c1167){_0x1d787c=_0x1d787c-0x0;var _0x59d195=_0x31c2[_0x1d787c];return _0x59d195;};'use strict';var VoiceQueueReportEvents=require(_0x231c('0x0'));var events=[_0x231c('0x1'),_0x231c('0x2'),_0x231c('0x3')];function createListener(_0x1c57c9,_0x7e36a0){return function(_0xa1faa4){_0x7e36a0[_0x231c('0x4')](_0x1c57c9,_0xa1faa4);};}function removeListener(_0x5b0b0a,_0x59f232){return function(){VoiceQueueReportEvents[_0x231c('0x5')](_0x5b0b0a,_0x59f232);};}exports[_0x231c('0x6')]=function(_0x1f3f7d){for(var _0x219c3f=0x0,_0x48bfb2=events[_0x231c('0x7')];_0x219c3f<_0x48bfb2;_0x219c3f++){var _0x49ff9e=events[_0x219c3f];var _0x439df8=createListener(_0x231c('0x8')+_0x49ff9e,_0x1f3f7d);VoiceQueueReportEvents['on'](_0x49ff9e,_0x439df8);}}; \ No newline at end of file +var _0xa1a9=['./voiceQueueReport.events','update','removeListener','length','voiceQueueReport:'];(function(_0x57514f,_0x69f624){var _0x301fb4=function(_0x25e461){while(--_0x25e461){_0x57514f['push'](_0x57514f['shift']());}};_0x301fb4(++_0x69f624);}(_0xa1a9,0x9b));var _0x9a1a=function(_0x56e2ea,_0x2d1fcb){_0x56e2ea=_0x56e2ea-0x0;var _0x3c80d3=_0xa1a9[_0x56e2ea];return _0x3c80d3;};'use strict';var VoiceQueueReportEvents=require(_0x9a1a('0x0'));var events=['save','remove',_0x9a1a('0x1')];function createListener(_0x5dbe14,_0x379cd4){return function(_0x2197b8){_0x379cd4['emit'](_0x5dbe14,_0x2197b8);};}function removeListener(_0x5cb71d,_0x54cc32){return function(){VoiceQueueReportEvents[_0x9a1a('0x2')](_0x5cb71d,_0x54cc32);};}exports['register']=function(_0x433b6e){for(var _0x412c30=0x0,_0x4d0302=events[_0x9a1a('0x3')];_0x412c30<_0x4d0302;_0x412c30++){var _0x4eb5e9=events[_0x412c30];var _0x553d08=createListener(_0x9a1a('0x4')+_0x4eb5e9,_0x433b6e);VoiceQueueReportEvents['on'](_0x4eb5e9,_0x553d08);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 0032a88..05e0303 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 _0x9102=['exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','post','create','put','update','delete','destroy'];(function(_0x17f80f,_0x15e0c7){var _0x2ddd72=function(_0xcf477d){while(--_0xcf477d){_0x17f80f['push'](_0x17f80f['shift']());}};_0x2ddd72(++_0x15e0c7);}(_0x9102,0x133));var _0x2910=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x9102[_0x1ccdf7];return _0x52a0ae;};'use strict';var multer=require('multer');var util=require(_0x2910('0x0'));var path=require('path');var timeout=require(_0x2910('0x1'));var express=require(_0x2910('0x2'));var router=express[_0x2910('0x3')]();var fs_extra=require(_0x2910('0x4'));var auth=require(_0x2910('0x5'));var interaction=require(_0x2910('0x6'));var config=require(_0x2910('0x7'));var controller=require('./voiceQueuesLog.controller');router[_0x2910('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2910('0x9'),auth[_0x2910('0xa')](),controller['show']);router[_0x2910('0xb')]('/',auth[_0x2910('0xa')](),controller[_0x2910('0xc')]);router[_0x2910('0xd')](_0x2910('0x9'),auth[_0x2910('0xa')](),controller[_0x2910('0xe')]);router[_0x2910('0xf')]('/:id',auth[_0x2910('0xa')](),controller[_0x2910('0x10')]);module[_0x2910('0x11')]=router; \ No newline at end of file +var _0x6d94=['/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','get'];(function(_0x59969a,_0x23195c){var _0x5d4b8a=function(_0x461697){while(--_0x461697){_0x59969a['push'](_0x59969a['shift']());}};_0x5d4b8a(++_0x23195c);}(_0x6d94,0x14b));var _0x46d9=function(_0xdcc1e8,_0x4ceb37){_0xdcc1e8=_0xdcc1e8-0x0;var _0x11cd20=_0x6d94[_0xdcc1e8];return _0x11cd20;};'use strict';var multer=require(_0x46d9('0x0'));var util=require(_0x46d9('0x1'));var path=require(_0x46d9('0x2'));var timeout=require(_0x46d9('0x3'));var express=require(_0x46d9('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x46d9('0x5'));var interaction=require(_0x46d9('0x6'));var config=require(_0x46d9('0x7'));var controller=require(_0x46d9('0x8'));router['get']('/',auth[_0x46d9('0x9')](),controller['index']);router[_0x46d9('0xa')](_0x46d9('0xb'),auth[_0x46d9('0x9')](),controller[_0x46d9('0xc')]);router[_0x46d9('0xd')]('/',auth[_0x46d9('0x9')](),controller[_0x46d9('0xe')]);router[_0x46d9('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x46d9('0x10')]);router[_0x46d9('0x11')]('/:id',auth[_0x46d9('0x9')](),controller['destroy']);module[_0x46d9('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index dd9dcfe..4b3bc7b 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 _0xe3ef=['exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0xf3c51c,_0x4f5db2){var _0x440d95=function(_0x1215f5){while(--_0x1215f5){_0xf3c51c['push'](_0xf3c51c['shift']());}};_0x440d95(++_0x4f5db2);}(_0xe3ef,0x1bb));var _0xfe3e=function(_0x39237f,_0x11426f){_0x39237f=_0x39237f-0x0;var _0x46ccc7=_0xe3ef[_0x39237f];return _0x46ccc7;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xfe3e('0x0'));module[_0xfe3e('0x1')]={'time':{'type':Sequelize[_0xfe3e('0x2')]},'callid':{'type':Sequelize[_0xfe3e('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xfe3e('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xfe3e('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xfe3e('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xfe3e('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xfe3e('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xfe3e('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xfe3e('0x3')],'allowNull':![],'defaultValue':moment()[_0xfe3e('0x4')](_0xfe3e('0x5'))}}; \ No newline at end of file +var _0xfa3a=['exports','STRING','DATE','format','sequelize','moment'];(function(_0x5388bb,_0x310968){var _0x46a313=function(_0x1e5b98){while(--_0x1e5b98){_0x5388bb['push'](_0x5388bb['shift']());}};_0x46a313(++_0x310968);}(_0xfa3a,0xa6));var _0xafa3=function(_0x350dc6,_0x36ab14){_0x350dc6=_0x350dc6-0x0;var _0x2e5887=_0xfa3a[_0x350dc6];return _0x2e5887;};'use strict';var Sequelize=require(_0xafa3('0x0'));var moment=require(_0xafa3('0x1'));module[_0xafa3('0x2')]={'time':{'type':Sequelize[_0xafa3('0x3')]},'callid':{'type':Sequelize[_0xafa3('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xafa3('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xafa3('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xafa3('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xafa3('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xafa3('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xafa3('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xafa3('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xafa3('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xafa3('0x4')],'allowNull':![],'defaultValue':moment()[_0xafa3('0x5')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 1b38823..9fda7bf 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 _0x4687=['attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','options','includeAll','findAll','rows','catch','params','keys','find','create','body','rimraf','zip-dir','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','offset','count','limit','apply','update','then','sendStatus','name','map','VoiceQueuesLog','rawAttributes','type','model','query','filters','intersection'];(function(_0x4cae4a,_0x25396a){var _0x5c7e62=function(_0x3ce014){while(--_0x3ce014){_0x4cae4a['push'](_0x4cae4a['shift']());}};_0x5c7e62(++_0x25396a);}(_0x4687,0x187));var _0x7468=function(_0x52d7e6,_0x152758){_0x52d7e6=_0x52d7e6-0x0;var _0x2828da=_0x4687[_0x52d7e6];return _0x2828da;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7468('0x0'));var zipdir=require(_0x7468('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7468('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x7468('0x3'));var util=require(_0x7468('0x4'));var path=require(_0x7468('0x5'));var sox=require(_0x7468('0x6'));var csv=require('to-csv');var ejs=require(_0x7468('0x7'));var fs=require('fs');var fs_extra=require(_0x7468('0x8'));var _=require(_0x7468('0x9'));var squel=require(_0x7468('0xa'));var crypto=require(_0x7468('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7468('0xc'));var querystring=require(_0x7468('0xd'));var Papa=require('papaparse');var Redis=require(_0x7468('0xe'));var authService=require(_0x7468('0xf'));var qs=require(_0x7468('0x10'));var as=require(_0x7468('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7468('0x12'));var utils=require(_0x7468('0x13'));var config=require(_0x7468('0x14'));var licenseUtil=require(_0x7468('0x15'));var db=require(_0x7468('0x16'))['db'];function respondWithStatusCode(_0x1a5b80,_0x54c57d){_0x54c57d=_0x54c57d||0xcc;return function(_0x2e0980){if(_0x2e0980){return _0x1a5b80['sendStatus'](_0x54c57d);}return _0x1a5b80['status'](_0x54c57d)[_0x7468('0x17')]();};}function respondWithResult(_0x186368,_0x41da2a){_0x41da2a=_0x41da2a||0xc8;return function(_0x50e60a){if(_0x50e60a){return _0x186368[_0x7468('0x18')](_0x41da2a)[_0x7468('0x19')](_0x50e60a);}};}function respondWithFilteredResult(_0x140c04,_0x410276){return function(_0x4d6998){if(_0x4d6998){var _0x12c81a=typeof _0x410276['offset']===_0x7468('0x1a')&&typeof _0x410276['limit']===_0x7468('0x1a');var _0x1d3f27=_0x4d6998['count'];var _0x5e88dc=_0x12c81a?0x0:_0x410276[_0x7468('0x1b')];var _0x4fccf2=_0x12c81a?_0x4d6998[_0x7468('0x1c')]:_0x410276[_0x7468('0x1b')]+_0x410276[_0x7468('0x1d')];var _0x5e63af;if(_0x4fccf2>=_0x1d3f27){_0x4fccf2=_0x1d3f27;_0x5e63af=0xc8;}else{_0x5e63af=0xce;}_0x140c04[_0x7468('0x18')](_0x5e63af);return _0x140c04['set']('Content-Range',_0x5e88dc+'-'+_0x4fccf2+'/'+_0x1d3f27)[_0x7468('0x19')](_0x4d6998);}return null;};}function patchUpdates(_0x15b8c4){return function(_0x296826){try{jsonpatch[_0x7468('0x1e')](_0x296826,_0x15b8c4,!![]);}catch(_0x342897){return BPromise['reject'](_0x342897);}return _0x296826['save']();};}function saveUpdates(_0x3a9653,_0x17ee91){return function(_0x72cb83){if(_0x72cb83){return _0x72cb83[_0x7468('0x1f')](_0x3a9653)[_0x7468('0x20')](function(_0x2266b2){return _0x2266b2;});}return null;};}function removeEntity(_0x464529,_0x51dbaa){return function(_0x349230){if(_0x349230){return _0x349230['destroy']()['then'](function(){_0x464529[_0x7468('0x18')](0xcc)[_0x7468('0x17')]();});}};}function handleEntityNotFound(_0x56a740,_0x98cd27){return function(_0xb47ad5){if(!_0xb47ad5){_0x56a740[_0x7468('0x21')](0x194);}return _0xb47ad5;};}function handleError(_0xc4ccd5,_0x1aa589){_0x1aa589=_0x1aa589||0x1f4;return function(_0x4016e8){logger['error'](_0x4016e8['stack']);if(_0x4016e8['name']){delete _0x4016e8[_0x7468('0x22')];}_0xc4ccd5[_0x7468('0x18')](_0x1aa589)['send'](_0x4016e8);};}exports['index']=function(_0x7a685f,_0x2c0e1f){var _0x340ab3={},_0xeba4e9={},_0x51dd14={'count':0x0,'rows':[]};var _0x1a973f=_[_0x7468('0x23')](db[_0x7468('0x24')][_0x7468('0x25')],function(_0x107acf){return{'name':_0x107acf['fieldName'],'type':_0x107acf[_0x7468('0x26')]['key']};});_0xeba4e9[_0x7468('0x27')]=_[_0x7468('0x23')](_0x1a973f,_0x7468('0x22'));_0xeba4e9[_0x7468('0x28')]=_['keys'](_0x7a685f['query']);_0xeba4e9[_0x7468('0x29')]=_[_0x7468('0x2a')](_0xeba4e9[_0x7468('0x27')],_0xeba4e9['query']);_0x340ab3[_0x7468('0x2b')]=_[_0x7468('0x2a')](_0xeba4e9['model'],qs[_0x7468('0x2c')](_0x7a685f[_0x7468('0x28')]['fields']));_0x340ab3[_0x7468('0x2b')]=_0x340ab3[_0x7468('0x2b')][_0x7468('0x2d')]?_0x340ab3[_0x7468('0x2b')]:_0xeba4e9['model'];if(!_0x7a685f[_0x7468('0x28')][_0x7468('0x2e')](_0x7468('0x2f'))){_0x340ab3[_0x7468('0x1d')]=qs[_0x7468('0x1d')](_0x7a685f[_0x7468('0x28')][_0x7468('0x1d')]);_0x340ab3['offset']=qs[_0x7468('0x1b')](_0x7a685f['query'][_0x7468('0x1b')]);}_0x340ab3['order']=qs['sort'](_0x7a685f['query']['sort']);_0x340ab3[_0x7468('0x30')]=qs[_0x7468('0x29')](_[_0x7468('0x31')](_0x7a685f[_0x7468('0x28')],_0xeba4e9[_0x7468('0x29')]),_0x1a973f);if(_0x7a685f[_0x7468('0x28')][_0x7468('0x32')]){_0x340ab3[_0x7468('0x30')]=_['merge'](_0x340ab3[_0x7468('0x30')],{'$or':_['map'](_0x1a973f,function(_0x35bd1a){if(_0x35bd1a[_0x7468('0x26')]!=='VIRTUAL'){var _0x5a49b7={};_0x5a49b7[_0x35bd1a[_0x7468('0x22')]]={'$like':'%'+_0x7a685f['query'][_0x7468('0x32')]+'%'};return _0x5a49b7;}})});}_0x340ab3=_[_0x7468('0x33')]({},_0x340ab3,_0x7a685f[_0x7468('0x34')]);var _0xf36d38={'where':_0x340ab3[_0x7468('0x30')]};return db['VoiceQueuesLog']['count'](_0xf36d38)[_0x7468('0x20')](function(_0x4d2ec5){_0x51dd14[_0x7468('0x1c')]=_0x4d2ec5;if(_0x7a685f[_0x7468('0x28')][_0x7468('0x35')]){_0x340ab3['include']=[{'all':!![]}];}return db[_0x7468('0x24')][_0x7468('0x36')](_0x340ab3);})[_0x7468('0x20')](function(_0x323095){_0x51dd14[_0x7468('0x37')]=_0x323095;return _0x51dd14;})[_0x7468('0x20')](respondWithFilteredResult(_0x2c0e1f,_0x340ab3))[_0x7468('0x38')](handleError(_0x2c0e1f,null));};exports['show']=function(_0x4e1e1c,_0x1ffd37){var _0x533fe4={'raw':!![],'where':{'id':_0x4e1e1c[_0x7468('0x39')]['id']}},_0x95fe77={};_0x95fe77[_0x7468('0x27')]=_[_0x7468('0x3a')](db['VoiceQueuesLog'][_0x7468('0x25')]);_0x95fe77[_0x7468('0x28')]=_['keys'](_0x4e1e1c[_0x7468('0x28')]);_0x95fe77['filters']=_[_0x7468('0x2a')](_0x95fe77[_0x7468('0x27')],_0x95fe77['query']);_0x533fe4['attributes']=_[_0x7468('0x2a')](_0x95fe77[_0x7468('0x27')],qs[_0x7468('0x2c')](_0x4e1e1c[_0x7468('0x28')][_0x7468('0x2c')]));_0x533fe4[_0x7468('0x2b')]=_0x533fe4[_0x7468('0x2b')]['length']?_0x533fe4[_0x7468('0x2b')]:_0x95fe77[_0x7468('0x27')];if(_0x4e1e1c[_0x7468('0x28')][_0x7468('0x35')]){_0x533fe4['include']=[{'all':!![]}];}_0x533fe4=_[_0x7468('0x33')]({},_0x533fe4,_0x4e1e1c[_0x7468('0x34')]);return db[_0x7468('0x24')][_0x7468('0x3b')](_0x533fe4)[_0x7468('0x20')](handleEntityNotFound(_0x1ffd37,null))[_0x7468('0x20')](respondWithResult(_0x1ffd37,null))[_0x7468('0x38')](handleError(_0x1ffd37,null));};exports[_0x7468('0x3c')]=function(_0x5d5d6c,_0x516440){return db['VoiceQueuesLog'][_0x7468('0x3c')](_0x5d5d6c[_0x7468('0x3d')],{})['then'](respondWithResult(_0x516440,0xc9))[_0x7468('0x38')](handleError(_0x516440,null));};exports[_0x7468('0x1f')]=function(_0x17b4c1,_0x504b78){if(_0x17b4c1[_0x7468('0x3d')]['id']){delete _0x17b4c1[_0x7468('0x3d')]['id'];}return db[_0x7468('0x24')][_0x7468('0x3b')]({'where':{'id':_0x17b4c1[_0x7468('0x39')]['id']}})[_0x7468('0x20')](handleEntityNotFound(_0x504b78,null))[_0x7468('0x20')](saveUpdates(_0x17b4c1[_0x7468('0x3d')],null))[_0x7468('0x20')](respondWithResult(_0x504b78,null))['catch'](handleError(_0x504b78,null));};exports['destroy']=function(_0x318c85,_0x5827db){return db['VoiceQueuesLog'][_0x7468('0x3b')]({'where':{'id':_0x318c85['params']['id']}})[_0x7468('0x20')](handleEntityNotFound(_0x5827db,null))[_0x7468('0x20')](removeEntity(_0x5827db,null))['catch'](handleError(_0x5827db,null));}; \ No newline at end of file +var _0x6cea=['intersection','fields','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','length','include','catch','create','body','destroy','find','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x6cea,0xa5));var _0xa6ce=function(_0xb6b20b,_0x12f7bc){_0xb6b20b=_0xb6b20b-0x0;var _0x4ee8ba=_0x6cea[_0xb6b20b];return _0x4ee8ba;};'use strict';var emlformat=require(_0xa6ce('0x0'));var rimraf=require(_0xa6ce('0x1'));var zipdir=require(_0xa6ce('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa6ce('0x3'));var moment=require('moment');var BPromise=require(_0xa6ce('0x4'));var Mustache=require(_0xa6ce('0x5'));var util=require('util');var path=require(_0xa6ce('0x6'));var sox=require(_0xa6ce('0x7'));var csv=require(_0xa6ce('0x8'));var ejs=require(_0xa6ce('0x9'));var fs=require('fs');var fs_extra=require(_0xa6ce('0xa'));var _=require('lodash');var squel=require(_0xa6ce('0xb'));var crypto=require('crypto');var jsforce=require(_0xa6ce('0xc'));var deskjs=require(_0xa6ce('0xd'));var toCsv=require(_0xa6ce('0x8'));var querystring=require(_0xa6ce('0xe'));var Papa=require(_0xa6ce('0xf'));var Redis=require('ioredis');var authService=require(_0xa6ce('0x10'));var qs=require(_0xa6ce('0x11'));var as=require(_0xa6ce('0x12'));var hardwareService=require(_0xa6ce('0x13'));var logger=require(_0xa6ce('0x14'))(_0xa6ce('0x15'));var utils=require(_0xa6ce('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ac51a,_0x44836e){_0x44836e=_0x44836e||0xcc;return function(_0x497c20){if(_0x497c20){return _0x1ac51a['sendStatus'](_0x44836e);}return _0x1ac51a[_0xa6ce('0x17')](_0x44836e)[_0xa6ce('0x18')]();};}function respondWithResult(_0x48099d,_0x1a728a){_0x1a728a=_0x1a728a||0xc8;return function(_0x4beecd){if(_0x4beecd){return _0x48099d['status'](_0x1a728a)['json'](_0x4beecd);}};}function respondWithFilteredResult(_0x5e35bf,_0x448a54){return function(_0x182879){if(_0x182879){var _0x2d42c8=typeof _0x448a54[_0xa6ce('0x19')]===_0xa6ce('0x1a')&&typeof _0x448a54['limit']===_0xa6ce('0x1a');var _0x14cb88=_0x182879[_0xa6ce('0x1b')];var _0x3215fe=_0x2d42c8?0x0:_0x448a54[_0xa6ce('0x19')];var _0x4841eb=_0x2d42c8?_0x182879['count']:_0x448a54['offset']+_0x448a54[_0xa6ce('0x1c')];var _0x351e91;if(_0x4841eb>=_0x14cb88){_0x4841eb=_0x14cb88;_0x351e91=0xc8;}else{_0x351e91=0xce;}_0x5e35bf[_0xa6ce('0x17')](_0x351e91);return _0x5e35bf[_0xa6ce('0x1d')](_0xa6ce('0x1e'),_0x3215fe+'-'+_0x4841eb+'/'+_0x14cb88)[_0xa6ce('0x1f')](_0x182879);}return null;};}function patchUpdates(_0x227436){return function(_0xfe9223){try{jsonpatch[_0xa6ce('0x20')](_0xfe9223,_0x227436,!![]);}catch(_0x25d209){return BPromise[_0xa6ce('0x21')](_0x25d209);}return _0xfe9223[_0xa6ce('0x22')]();};}function saveUpdates(_0x71732f,_0x482cab){return function(_0x207fb8){if(_0x207fb8){return _0x207fb8[_0xa6ce('0x23')](_0x71732f)['then'](function(_0x32bd89){return _0x32bd89;});}return null;};}function removeEntity(_0x1e9efd,_0x3ad5dc){return function(_0x480276){if(_0x480276){return _0x480276['destroy']()[_0xa6ce('0x24')](function(){_0x1e9efd[_0xa6ce('0x17')](0xcc)[_0xa6ce('0x18')]();});}};}function handleEntityNotFound(_0xf3336e,_0x182f59){return function(_0x191a87){if(!_0x191a87){_0xf3336e['sendStatus'](0x194);}return _0x191a87;};}function handleError(_0x55dc1f,_0x2c54cf){_0x2c54cf=_0x2c54cf||0x1f4;return function(_0x40c76b){logger[_0xa6ce('0x25')](_0x40c76b[_0xa6ce('0x26')]);if(_0x40c76b['name']){delete _0x40c76b[_0xa6ce('0x27')];}_0x55dc1f[_0xa6ce('0x17')](_0x2c54cf)['send'](_0x40c76b);};}exports['index']=function(_0x2f10e0,_0x2592c0){var _0x39b0f4={},_0x36178a={},_0x189fd9={'count':0x0,'rows':[]};var _0x49c0bd=_[_0xa6ce('0x28')](db[_0xa6ce('0x29')][_0xa6ce('0x2a')],function(_0x5d329a){return{'name':_0x5d329a[_0xa6ce('0x2b')],'type':_0x5d329a[_0xa6ce('0x2c')][_0xa6ce('0x2d')]};});_0x36178a[_0xa6ce('0x2e')]=_[_0xa6ce('0x28')](_0x49c0bd,_0xa6ce('0x27'));_0x36178a['query']=_[_0xa6ce('0x2f')](_0x2f10e0['query']);_0x36178a[_0xa6ce('0x30')]=_['intersection'](_0x36178a[_0xa6ce('0x2e')],_0x36178a[_0xa6ce('0x31')]);_0x39b0f4[_0xa6ce('0x32')]=_[_0xa6ce('0x33')](_0x36178a['model'],qs['fields'](_0x2f10e0['query'][_0xa6ce('0x34')]));_0x39b0f4['attributes']=_0x39b0f4[_0xa6ce('0x32')]['length']?_0x39b0f4[_0xa6ce('0x32')]:_0x36178a[_0xa6ce('0x2e')];if(!_0x2f10e0[_0xa6ce('0x31')][_0xa6ce('0x35')]('nolimit')){_0x39b0f4[_0xa6ce('0x1c')]=qs[_0xa6ce('0x1c')](_0x2f10e0[_0xa6ce('0x31')][_0xa6ce('0x1c')]);_0x39b0f4[_0xa6ce('0x19')]=qs['offset'](_0x2f10e0['query'][_0xa6ce('0x19')]);}_0x39b0f4['order']=qs[_0xa6ce('0x36')](_0x2f10e0['query']['sort']);_0x39b0f4[_0xa6ce('0x37')]=qs[_0xa6ce('0x30')](_['pick'](_0x2f10e0['query'],_0x36178a['filters']),_0x49c0bd);if(_0x2f10e0[_0xa6ce('0x31')][_0xa6ce('0x38')]){_0x39b0f4[_0xa6ce('0x37')]=_[_0xa6ce('0x39')](_0x39b0f4[_0xa6ce('0x37')],{'$or':_[_0xa6ce('0x28')](_0x49c0bd,function(_0x20acea){if(_0x20acea['type']!==_0xa6ce('0x3a')){var _0x15c196={};_0x15c196[_0x20acea[_0xa6ce('0x27')]]={'$like':'%'+_0x2f10e0['query'][_0xa6ce('0x38')]+'%'};return _0x15c196;}})});}_0x39b0f4=_[_0xa6ce('0x39')]({},_0x39b0f4,_0x2f10e0[_0xa6ce('0x3b')]);var _0x15da7e={'where':_0x39b0f4['where']};return db['VoiceQueuesLog']['count'](_0x15da7e)[_0xa6ce('0x24')](function(_0xe6d5a1){_0x189fd9[_0xa6ce('0x1b')]=_0xe6d5a1;if(_0x2f10e0[_0xa6ce('0x31')][_0xa6ce('0x3c')]){_0x39b0f4['include']=[{'all':!![]}];}return db[_0xa6ce('0x29')][_0xa6ce('0x3d')](_0x39b0f4);})[_0xa6ce('0x24')](function(_0x3c1f3d){_0x189fd9[_0xa6ce('0x3e')]=_0x3c1f3d;return _0x189fd9;})[_0xa6ce('0x24')](respondWithFilteredResult(_0x2592c0,_0x39b0f4))['catch'](handleError(_0x2592c0,null));};exports[_0xa6ce('0x3f')]=function(_0x3e99a9,_0x41a285){var _0x432197={'raw':!![],'where':{'id':_0x3e99a9[_0xa6ce('0x40')]['id']}},_0x37bf7e={};_0x37bf7e[_0xa6ce('0x2e')]=_[_0xa6ce('0x2f')](db[_0xa6ce('0x29')]['rawAttributes']);_0x37bf7e['query']=_[_0xa6ce('0x2f')](_0x3e99a9[_0xa6ce('0x31')]);_0x37bf7e[_0xa6ce('0x30')]=_[_0xa6ce('0x33')](_0x37bf7e[_0xa6ce('0x2e')],_0x37bf7e[_0xa6ce('0x31')]);_0x432197[_0xa6ce('0x32')]=_[_0xa6ce('0x33')](_0x37bf7e[_0xa6ce('0x2e')],qs[_0xa6ce('0x34')](_0x3e99a9[_0xa6ce('0x31')][_0xa6ce('0x34')]));_0x432197[_0xa6ce('0x32')]=_0x432197[_0xa6ce('0x32')][_0xa6ce('0x41')]?_0x432197[_0xa6ce('0x32')]:_0x37bf7e[_0xa6ce('0x2e')];if(_0x3e99a9['query'][_0xa6ce('0x3c')]){_0x432197[_0xa6ce('0x42')]=[{'all':!![]}];}_0x432197=_['merge']({},_0x432197,_0x3e99a9[_0xa6ce('0x3b')]);return db[_0xa6ce('0x29')]['find'](_0x432197)['then'](handleEntityNotFound(_0x41a285,null))[_0xa6ce('0x24')](respondWithResult(_0x41a285,null))[_0xa6ce('0x43')](handleError(_0x41a285,null));};exports[_0xa6ce('0x44')]=function(_0x1e4d95,_0x40ae01){return db[_0xa6ce('0x29')]['create'](_0x1e4d95['body'],{})[_0xa6ce('0x24')](respondWithResult(_0x40ae01,0xc9))[_0xa6ce('0x43')](handleError(_0x40ae01,null));};exports[_0xa6ce('0x23')]=function(_0x3799e8,_0x176b92){if(_0x3799e8[_0xa6ce('0x45')]['id']){delete _0x3799e8[_0xa6ce('0x45')]['id'];}return db[_0xa6ce('0x29')]['find']({'where':{'id':_0x3799e8[_0xa6ce('0x40')]['id']}})[_0xa6ce('0x24')](handleEntityNotFound(_0x176b92,null))['then'](saveUpdates(_0x3799e8[_0xa6ce('0x45')],null))['then'](respondWithResult(_0x176b92,null))['catch'](handleError(_0x176b92,null));};exports[_0xa6ce('0x46')]=function(_0xdb5492,_0x5a0890){return db['VoiceQueuesLog'][_0xa6ce('0x47')]({'where':{'id':_0xdb5492[_0xa6ce('0x40')]['id']}})[_0xa6ce('0x24')](handleEntityNotFound(_0x5a0890,null))[_0xa6ce('0x24')](removeEntity(_0x5a0890,null))[_0xa6ce('0x43')](handleError(_0x5a0890,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index a4b9a7f..ed089ed 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 _0x405f=['dtm','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','VoiceQueuesLog','voice_queues_log','event'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x405f,0x127));var _0xf405=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x405f[_0x1d24eb];return _0x1dc576;};'use strict';var _=require('lodash');var util=require(_0xf405('0x0'));var logger=require(_0xf405('0x1'))(_0xf405('0x2'));var moment=require(_0xf405('0x3'));var BPromise=require(_0xf405('0x4'));var rp=require(_0xf405('0x5'));var fs=require('fs');var path=require(_0xf405('0x6'));var rimraf=require(_0xf405('0x7'));var config=require(_0xf405('0x8'));var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x179442,_0x56b41f){return _0x179442[_0xf405('0x9')](_0xf405('0xa'),attributes,{'tableName':_0xf405('0xb'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0xf405('0xc'),_0xf405('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9c2f=['rimraf','../../config/environment','./voiceQueuesLog.attributes','define','voice_queues_log','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5317d1,_0x4421cf){var _0x4413b4=function(_0x3c6266){while(--_0x3c6266){_0x5317d1['push'](_0x5317d1['shift']());}};_0x4413b4(++_0x4421cf);}(_0x9c2f,0x1c8));var _0xf9c2=function(_0x1504f4,_0x2588e6){_0x1504f4=_0x1504f4-0x0;var _0x5158e6=_0x9c2f[_0x1504f4];return _0x5158e6;};'use strict';var _=require('lodash');var util=require(_0xf9c2('0x0'));var logger=require(_0xf9c2('0x1'))(_0xf9c2('0x2'));var moment=require(_0xf9c2('0x3'));var BPromise=require(_0xf9c2('0x4'));var rp=require(_0xf9c2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf9c2('0x6'));var config=require(_0xf9c2('0x7'));var attributes=require(_0xf9c2('0x8'));module['exports']=function(_0x114c9c,_0x4e5ee7){return _0x114c9c[_0xf9c2('0x9')]('VoiceQueuesLog',attributes,{'tableName':_0xf9c2('0xa'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':['event','dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 458b6dd..c69ca48 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 _0x52fc=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment'];(function(_0x5d852f,_0x2f8706){var _0x1fe8fd=function(_0x3c3adf){while(--_0x3c3adf){_0x5d852f['push'](_0x5d852f['shift']());}};_0x1fe8fd(++_0x2f8706);}(_0x52fc,0xc5));var _0xc52f=function(_0x3bca58,_0x4a85c4){_0x3bca58=_0x3bca58-0x0;var _0x29f35f=_0x52fc[_0x3bca58];return _0x29f35f;};'use strict';var _=require(_0xc52f('0x0'));var util=require(_0xc52f('0x1'));var moment=require(_0xc52f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc52f('0x3'));var db=require(_0xc52f('0x4'))['db'];var utils=require(_0xc52f('0x5'));var logger=require(_0xc52f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc52f('0x7'));var client=jayson[_0xc52f('0x8')][_0xc52f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x523425,_0x4cae04,_0x4db523){return new BPromise(function(_0x4c73c8,_0x3d2845){return client['request'](_0x523425,_0x4db523)[_0xc52f('0xa')](function(_0x52db4a){logger[_0xc52f('0xb')](_0xc52f('0xc'),_0x4cae04,'request\x20sent');logger[_0xc52f('0xd')](_0xc52f('0xe'),_0x4cae04,_0xc52f('0xf'),JSON[_0xc52f('0x10')](_0x52db4a));if(_0x52db4a['error']){if(_0x52db4a[_0xc52f('0x11')]['code']===0x1f4){logger[_0xc52f('0x11')](_0xc52f('0xc'),_0x4cae04,_0x52db4a[_0xc52f('0x11')][_0xc52f('0x12')]);return _0x3d2845(_0x52db4a[_0xc52f('0x11')][_0xc52f('0x12')]);}logger['error'](_0xc52f('0xc'),_0x4cae04,_0x52db4a[_0xc52f('0x11')][_0xc52f('0x12')]);return _0x4c73c8(_0x52db4a[_0xc52f('0x11')][_0xc52f('0x12')]);}else{logger['info'](_0xc52f('0xc'),_0x4cae04,_0xc52f('0xf'));_0x4c73c8(_0x52db4a[_0xc52f('0x13')][_0xc52f('0x12')]);}})['catch'](function(_0x2a5863){logger[_0xc52f('0x11')](_0xc52f('0xc'),_0x4cae04,_0x2a5863);_0x3d2845(_0x2a5863);});});} \ No newline at end of file +var _0x65db=['rpc','../../config/environment','client','request','then','info','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','util','randomstring','ioredis'];(function(_0xea3692,_0x32d46d){var _0x5c24ea=function(_0x42091d){while(--_0x42091d){_0xea3692['push'](_0xea3692['shift']());}};_0x5c24ea(++_0x32d46d);}(_0x65db,0xd5));var _0xb65d=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x65db[_0x3054be];return _0x3df150;};'use strict';var _=require('lodash');var util=require(_0xb65d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb65d('0x1'));var fs=require('fs');var Redis=require(_0xb65d('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb65d('0x3'));var config=require(_0xb65d('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xb65d('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x492af8,_0x4f31be,_0x35a057){return new BPromise(function(_0x3a519f,_0x5dc8e5){return client[_0xb65d('0x6')](_0x492af8,_0x35a057)[_0xb65d('0x7')](function(_0x3c3090){logger[_0xb65d('0x8')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4f31be,'request\x20sent');logger[_0xb65d('0x9')](_0xb65d('0xa'),_0x4f31be,_0xb65d('0xb'),JSON[_0xb65d('0xc')](_0x3c3090));if(_0x3c3090[_0xb65d('0xd')]){if(_0x3c3090[_0xb65d('0xd')]['code']===0x1f4){logger[_0xb65d('0xd')](_0xb65d('0xe'),_0x4f31be,_0x3c3090[_0xb65d('0xd')][_0xb65d('0xf')]);return _0x5dc8e5(_0x3c3090[_0xb65d('0xd')][_0xb65d('0xf')]);}logger[_0xb65d('0xd')](_0xb65d('0xe'),_0x4f31be,_0x3c3090[_0xb65d('0xd')][_0xb65d('0xf')]);return _0x3a519f(_0x3c3090[_0xb65d('0xd')][_0xb65d('0xf')]);}else{logger['info'](_0xb65d('0xe'),_0x4f31be,_0xb65d('0xb'));_0x3a519f(_0x3c3090[_0xb65d('0x10')][_0xb65d('0xf')]);}})[_0xb65d('0x11')](function(_0x24ad15){logger[_0xb65d('0xd')](_0xb65d('0xe'),_0x4f31be,_0x24ad15);_0x5dc8e5(_0x24ad15);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index f3b1b0b..87c2098 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 _0x3d8a=['/:id/download','download','downloads','/:id/transcribe','post','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x18ad63,_0x29c705){var _0x219813=function(_0x22fbf0){while(--_0x22fbf0){_0x18ad63['push'](_0x18ad63['shift']());}};_0x219813(++_0x29c705);}(_0x3d8a,0x142));var _0xa3d8=function(_0x14435f,_0x45ea68){_0x14435f=_0x14435f-0x0;var _0x348321=_0x3d8a[_0x14435f];return _0x348321;};'use strict';var multer=require(_0xa3d8('0x0'));var util=require(_0xa3d8('0x1'));var path=require(_0xa3d8('0x2'));var timeout=require('connect-timeout');var express=require(_0xa3d8('0x3'));var router=express[_0xa3d8('0x4')]();var fs_extra=require(_0xa3d8('0x5'));var auth=require(_0xa3d8('0x6'));var interaction=require(_0xa3d8('0x7'));var config=require(_0xa3d8('0x8'));var controller=require(_0xa3d8('0x9'));router[_0xa3d8('0xa')]('/',auth[_0xa3d8('0xb')](),controller['index']);router['get'](_0xa3d8('0xc'),auth[_0xa3d8('0xb')](),controller[_0xa3d8('0xd')]);router['get'](_0xa3d8('0xe'),auth[_0xa3d8('0xb')](),controller[_0xa3d8('0xf')]);router[_0xa3d8('0xa')](_0xa3d8('0x10'),auth[_0xa3d8('0xb')](),controller[_0xa3d8('0x11')]);router['get']('/:id/downloads',controller[_0xa3d8('0x12')]);router[_0xa3d8('0xa')](_0xa3d8('0x13'),auth[_0xa3d8('0xb')](),controller['downloadTranscribe']);router[_0xa3d8('0x14')]('/',auth[_0xa3d8('0xb')](),controller['create']);router['post'](_0xa3d8('0x13'),auth[_0xa3d8('0xb')](),controller['runTranscribe']);router[_0xa3d8('0x15')](_0xa3d8('0xe'),auth['isAuthenticated'](),controller[_0xa3d8('0x16')]);router[_0xa3d8('0x17')](_0xa3d8('0xe'),auth['isAuthenticated'](),controller[_0xa3d8('0x18')]);module[_0xa3d8('0x19')]=router; \ No newline at end of file +var _0xa15a=['show','/:id/download','download','downloads','/:id/transcribe','downloadTranscribe','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x838813,_0x448f0f){var _0x2bd32d=function(_0x57b589){while(--_0x57b589){_0x838813['push'](_0x838813['shift']());}};_0x2bd32d(++_0x448f0f);}(_0xa15a,0x142));var _0xaa15=function(_0x2d57f4,_0x27dbd7){_0x2d57f4=_0x2d57f4-0x0;var _0x18b4ba=_0xa15a[_0x2d57f4];return _0x18b4ba;};'use strict';var multer=require(_0xaa15('0x0'));var util=require(_0xaa15('0x1'));var path=require(_0xaa15('0x2'));var timeout=require(_0xaa15('0x3'));var express=require(_0xaa15('0x4'));var router=express[_0xaa15('0x5')]();var fs_extra=require(_0xaa15('0x6'));var auth=require(_0xaa15('0x7'));var interaction=require(_0xaa15('0x8'));var config=require(_0xaa15('0x9'));var controller=require(_0xaa15('0xa'));router[_0xaa15('0xb')]('/',auth[_0xaa15('0xc')](),controller['index']);router['get'](_0xaa15('0xd'),auth[_0xaa15('0xc')](),controller[_0xaa15('0xe')]);router[_0xaa15('0xb')](_0xaa15('0xf'),auth[_0xaa15('0xc')](),controller[_0xaa15('0x10')]);router[_0xaa15('0xb')](_0xaa15('0x11'),auth[_0xaa15('0xc')](),controller[_0xaa15('0x12')]);router[_0xaa15('0xb')]('/:id/downloads',controller[_0xaa15('0x13')]);router['get'](_0xaa15('0x14'),auth[_0xaa15('0xc')](),controller[_0xaa15('0x15')]);router[_0xaa15('0x16')]('/',auth['isAuthenticated'](),controller[_0xaa15('0x17')]);router[_0xaa15('0x16')](_0xaa15('0x14'),auth[_0xaa15('0xc')](),controller['runTranscribe']);router['put'](_0xaa15('0xf'),auth[_0xaa15('0xc')](),controller['update']);router[_0xaa15('0x18')](_0xaa15('0xf'),auth[_0xaa15('0xc')](),controller[_0xaa15('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index c860c9e..fbb2a65 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(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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 fdf844a..02b8f42 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 _0xe9cb=['find','create','body','params','describe','download','../../components/encryptor','uniqueid','value','existsSync','decryptFile','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','sequelize','col','token','$and','push','recording','Sequelize','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)','bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJobName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','secrets','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','data1','data2','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','end','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where','pick','filter','options','include','findAll','catch','show','includeAll','merge'];(function(_0x3e592b,_0x2cc1e7){var _0x38c9e6=function(_0x4fb318){while(--_0x4fb318){_0x3e592b['push'](_0x3e592b['shift']());}};_0x38c9e6(++_0x2cc1e7);}(_0xe9cb,0x179));var _0xbe9c=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xe9cb[_0x4dbaad];return _0x226c72;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbe9c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe9c('0x1'));var moment=require(_0xbe9c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xbe9c('0x3'));var util=require(_0xbe9c('0x4'));var path=require(_0xbe9c('0x5'));var sox=require('sox');var csv=require(_0xbe9c('0x6'));var ejs=require(_0xbe9c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbe9c('0x8'));var crypto=require(_0xbe9c('0x9'));var jsforce=require(_0xbe9c('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xbe9c('0x6'));var querystring=require('querystring');var Papa=require(_0xbe9c('0xb'));var AWS=require('aws-sdk');var uuidv4=require(_0xbe9c('0xc'));var Redis=require(_0xbe9c('0xd'));var authService=require(_0xbe9c('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbe9c('0xf'));var hardwareService=require(_0xbe9c('0x10'));var logger=require(_0xbe9c('0x11'))(_0xbe9c('0x12'));var utils=require(_0xbe9c('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43a117,_0x2a113b){_0x2a113b=_0x2a113b||0xcc;return function(_0x5d0c54){if(_0x5d0c54){return _0x43a117[_0xbe9c('0x14')](_0x2a113b);}return _0x43a117[_0xbe9c('0x15')](_0x2a113b)['end']();};}function respondWithResult(_0x198eb8,_0x1af062){_0x1af062=_0x1af062||0xc8;return function(_0x497108){if(_0x497108){return _0x198eb8[_0xbe9c('0x15')](_0x1af062)[_0xbe9c('0x16')](_0x497108);}};}function respondWithFilteredResult(_0x39a9dc,_0x142166){return function(_0x5ddcb4){if(_0x5ddcb4){var _0x40892b=typeof _0x142166[_0xbe9c('0x17')]==='undefined'&&typeof _0x142166[_0xbe9c('0x18')]===_0xbe9c('0x19');var _0x225aec=_0x5ddcb4[_0xbe9c('0x1a')];var _0x5c43ab=_0x40892b?0x0:_0x142166[_0xbe9c('0x17')];var _0x2a328a=_0x40892b?_0x5ddcb4[_0xbe9c('0x1a')]:_0x142166[_0xbe9c('0x17')]+_0x142166['limit'];var _0x37c57e;if(_0x2a328a>=_0x225aec){_0x2a328a=_0x225aec;_0x37c57e=0xc8;}else{_0x37c57e=0xce;}_0x39a9dc[_0xbe9c('0x15')](_0x37c57e);return _0x39a9dc[_0xbe9c('0x1b')](_0xbe9c('0x1c'),_0x5c43ab+'-'+_0x2a328a+'/'+_0x225aec)[_0xbe9c('0x16')](_0x5ddcb4);}return null;};}function patchUpdates(_0x4e9283){return function(_0xe45480){try{jsonpatch['apply'](_0xe45480,_0x4e9283,!![]);}catch(_0x17c185){return BPromise[_0xbe9c('0x1d')](_0x17c185);}return _0xe45480[_0xbe9c('0x1e')]();};}function saveUpdates(_0x15a651,_0x4da087){return function(_0x1446af){if(_0x1446af){return _0x1446af[_0xbe9c('0x1f')](_0x15a651)[_0xbe9c('0x20')](function(_0x9a15a9){return _0x9a15a9;});}return null;};}function removeEntity(_0x4bc95d,_0x28a0f6){return function(_0x10ef0c){if(_0x10ef0c){return _0x10ef0c['destroy']()[_0xbe9c('0x20')](function(){_0x4bc95d[_0xbe9c('0x15')](0xcc)[_0xbe9c('0x21')]();});}};}function handleEntityNotFound(_0xbd4eac,_0x355052){return function(_0x3e7ed4){if(!_0x3e7ed4){_0xbd4eac['sendStatus'](0x194);}return _0x3e7ed4;};}function handleError(_0x1ece61,_0xd570b){_0xd570b=_0xd570b||0x1f4;return function(_0x6b0b2){logger[_0xbe9c('0x22')](_0x6b0b2[_0xbe9c('0x23')]);if(_0x6b0b2['name']){delete _0x6b0b2[_0xbe9c('0x24')];}_0x1ece61[_0xbe9c('0x15')](_0xd570b)[_0xbe9c('0x25')](_0x6b0b2);};}exports[_0xbe9c('0x26')]=function(_0x3b82dd,_0x19f79f){var _0x460c03={},_0x3ae0ea={},_0x2b6944={'count':0x0,'rows':[]};var _0x3e5ad6=_[_0xbe9c('0x27')](db[_0xbe9c('0x28')][_0xbe9c('0x29')],function(_0x381c3c){return{'name':_0x381c3c[_0xbe9c('0x2a')],'type':_0x381c3c[_0xbe9c('0x2b')][_0xbe9c('0x2c')]};});_0x3ae0ea[_0xbe9c('0x2d')]=_[_0xbe9c('0x2e')](_[_0xbe9c('0x27')](_0x3e5ad6,_0xbe9c('0x24')),[_0xbe9c('0x2f')]);_0x3ae0ea[_0xbe9c('0x30')]=_[_0xbe9c('0x31')](_0x3b82dd[_0xbe9c('0x30')]);_0x3ae0ea[_0xbe9c('0x32')]=_[_0xbe9c('0x33')](_0x3ae0ea[_0xbe9c('0x2d')],_0x3ae0ea['query']);_0x460c03[_0xbe9c('0x34')]=_['intersection'](_0x3ae0ea[_0xbe9c('0x2d')],qs[_0xbe9c('0x35')](_0x3b82dd[_0xbe9c('0x30')][_0xbe9c('0x35')]));_0x460c03[_0xbe9c('0x34')]=_0x460c03[_0xbe9c('0x34')][_0xbe9c('0x36')]?_0x460c03[_0xbe9c('0x34')]:_0x3ae0ea[_0xbe9c('0x2d')];if(!_0x3b82dd[_0xbe9c('0x30')]['hasOwnProperty'](_0xbe9c('0x37'))){_0x460c03['limit']=qs['limit'](_0x3b82dd[_0xbe9c('0x30')][_0xbe9c('0x18')]);_0x460c03['offset']=qs[_0xbe9c('0x17')](_0x3b82dd[_0xbe9c('0x30')][_0xbe9c('0x17')]);}_0x460c03[_0xbe9c('0x38')]=qs['sort'](_0x3b82dd[_0xbe9c('0x30')]['sort']);_0x460c03[_0xbe9c('0x39')]=qs['filters'](_[_0xbe9c('0x3a')](_0x3b82dd[_0xbe9c('0x30')],_0x3ae0ea['filters']),_0x3e5ad6);if(_0x3b82dd[_0xbe9c('0x30')][_0xbe9c('0x3b')]){_0x460c03[_0xbe9c('0x39')]=_['merge'](_0x460c03['where'],{'$or':_[_0xbe9c('0x27')](_0x3e5ad6,function(_0x513492){if(_0x513492[_0xbe9c('0x2b')]!=='VIRTUAL'){var _0x43ace3={};_0x43ace3[_0x513492[_0xbe9c('0x24')]]={'$like':'%'+_0x3b82dd[_0xbe9c('0x30')][_0xbe9c('0x3b')]+'%'};return _0x43ace3;}})});}_0x460c03=_['merge']({},_0x460c03,_0x3b82dd[_0xbe9c('0x3c')]);var _0x7b4955={'where':_0x460c03[_0xbe9c('0x39')]};return db[_0xbe9c('0x28')][_0xbe9c('0x1a')](_0x7b4955)['then'](function(_0x580f15){_0x2b6944[_0xbe9c('0x1a')]=_0x580f15;if(_0x3b82dd[_0xbe9c('0x30')]['includeAll']){_0x460c03[_0xbe9c('0x3d')]=[{'all':!![]}];}return db[_0xbe9c('0x28')][_0xbe9c('0x3e')](_0x460c03);})[_0xbe9c('0x20')](function(_0x59d956){_0x2b6944['rows']=_0x59d956;return _0x2b6944;})[_0xbe9c('0x20')](respondWithFilteredResult(_0x19f79f,_0x460c03))[_0xbe9c('0x3f')](handleError(_0x19f79f,null));};exports[_0xbe9c('0x40')]=function(_0x56082d,_0x3fc22b){var _0xa559fd={'raw':![],'where':{'id':_0x56082d['params']['id']}},_0x36ee27={};_0x36ee27[_0xbe9c('0x2d')]=_[_0xbe9c('0x31')](db[_0xbe9c('0x28')][_0xbe9c('0x29')]);_0x36ee27['query']=_['keys'](_0x56082d['query']);_0x36ee27[_0xbe9c('0x32')]=_[_0xbe9c('0x33')](_0x36ee27[_0xbe9c('0x2d')],_0x36ee27[_0xbe9c('0x30')]);_0xa559fd[_0xbe9c('0x34')]=_['intersection'](_0x36ee27[_0xbe9c('0x2d')],qs[_0xbe9c('0x35')](_0x56082d['query'][_0xbe9c('0x35')]));_0xa559fd['attributes']=_0xa559fd[_0xbe9c('0x34')][_0xbe9c('0x36')]?_0xa559fd[_0xbe9c('0x34')]:_0x36ee27['model'];if(_0x56082d[_0xbe9c('0x30')][_0xbe9c('0x41')]){_0xa559fd[_0xbe9c('0x3d')]=[{'all':!![]}];}_0xa559fd=_[_0xbe9c('0x42')]({},_0xa559fd,_0x56082d[_0xbe9c('0x3c')]);return db[_0xbe9c('0x28')][_0xbe9c('0x43')](_0xa559fd)[_0xbe9c('0x20')](handleEntityNotFound(_0x3fc22b,null))[_0xbe9c('0x20')](respondWithResult(_0x3fc22b,null))[_0xbe9c('0x3f')](handleError(_0x3fc22b,null));};exports[_0xbe9c('0x44')]=function(_0x50d964,_0x852f5b){return db[_0xbe9c('0x28')][_0xbe9c('0x44')](_0x50d964['body'],{})[_0xbe9c('0x20')](respondWithResult(_0x852f5b,0xc9))[_0xbe9c('0x3f')](handleError(_0x852f5b,null));};exports[_0xbe9c('0x1f')]=function(_0x30662c,_0x4501eb){if(_0x30662c[_0xbe9c('0x45')]['id']){delete _0x30662c[_0xbe9c('0x45')]['id'];}return db[_0xbe9c('0x28')][_0xbe9c('0x43')]({'where':{'id':_0x30662c[_0xbe9c('0x46')]['id']}})[_0xbe9c('0x20')](handleEntityNotFound(_0x4501eb,null))[_0xbe9c('0x20')](saveUpdates(_0x30662c[_0xbe9c('0x45')],null))[_0xbe9c('0x20')](respondWithResult(_0x4501eb,null))['catch'](handleError(_0x4501eb,null));};exports[_0xbe9c('0x47')]=function(_0x2052c3,_0x4be68b){return db[_0xbe9c('0x28')][_0xbe9c('0x47')]()[_0xbe9c('0x20')](respondWithResult(_0x4be68b,null))[_0xbe9c('0x3f')](handleError(_0x4be68b,null));};exports[_0xbe9c('0x48')]=function(_0x4dc19f,_0x3afcc0,_0x5b0780){var _0x5aa70a=require(_0xbe9c('0x49'));var _0x2f6160=![];var _0x124cc6={};if(_0x4dc19f[_0xbe9c('0x30')][_0xbe9c('0x2b')]&&_0x4dc19f['query']['type']===_0xbe9c('0x4a')){_0x124cc6['uniqueid']=_0x4dc19f[_0xbe9c('0x46')]['id'];}else{_0x124cc6['id']=_0x4dc19f[_0xbe9c('0x46')]['id'];}return db[_0xbe9c('0x28')][_0xbe9c('0x43')]({'where':_0x124cc6,'attributes':['id',_0xbe9c('0x4b')],'raw':!![]})[_0xbe9c('0x20')](handleEntityNotFound(_0x3afcc0,null))[_0xbe9c('0x20')](function(_0x1be6dd){if(_0x1be6dd){var _0x2b495a=_0x1be6dd['value'];var _0x370172=util[_0xbe9c('0x2f')]('%s.cypher',_0x2b495a);if(fs[_0xbe9c('0x4c')](_0x370172)){_0x2f6160=!![];return _0x5aa70a[_0xbe9c('0x4d')](_0x370172,_0x2b495a,config['secrets']['recording'])[_0xbe9c('0x20')](function(){return _0x1be6dd;});}return _0x1be6dd;}})[_0xbe9c('0x20')](function(_0x52634f){if(_0x52634f){var _0xda6207=_0x52634f[_0xbe9c('0x4b')];if(!fs['existsSync'](_0xda6207)){throw new db['Sequelize'][(_0xbe9c('0x4e'))](_0xbe9c('0x4f'));}if(_0x52634f[_0xbe9c('0x50')]){return _0x3afcc0['download'](_0xda6207,_0x52634f[_0xbe9c('0x50')]+path[_0xbe9c('0x51')](_0xda6207),function(){if(_0x2f6160){fs[_0xbe9c('0x52')](_0xda6207);}});}else{return _0x3afcc0[_0xbe9c('0x48')](_0xda6207,function(_0x386765){if(_0x2f6160){fs[_0xbe9c('0x52')](_0xda6207);}});}}})['catch'](function(_0xc11855){if(_0xc11855[_0xbe9c('0x53')]==='VoiceRecording\x20not\x20found'){_0x3afcc0[_0xbe9c('0x15')](0x194)['send'](_0xbe9c('0x54'));}else{return handleError(_0x3afcc0,null);}});};exports['downloads']=function(_0x4fb97a,_0xd8106e,_0x5250cf){var _0x2c9cff=require(_0xbe9c('0x49'));var _0x439a3e=![];var _0x2e12af={'$and':[db['sequelize']['where'](db['sequelize']['fn']('MD5',db[_0xbe9c('0x55')][_0xbe9c('0x56')](_0xbe9c('0x4a'))),_0x4fb97a[_0xbe9c('0x30')][_0xbe9c('0x57')])]};if(_0x4fb97a[_0xbe9c('0x30')]['type']&&_0x4fb97a['query'][_0xbe9c('0x2b')]===_0xbe9c('0x4a')){_0x2e12af[_0xbe9c('0x58')][_0xbe9c('0x59')]({'uniqueid':_0x4fb97a[_0xbe9c('0x46')]['id']});}else{_0x2e12af[_0xbe9c('0x58')][_0xbe9c('0x59')]({'id':_0x4fb97a['params']['id']});}return db['VoiceRecording']['find']({'where':_0x2e12af,'attributes':['id','value'],'raw':!![]})[_0xbe9c('0x20')](handleEntityNotFound(_0xd8106e,null))['then'](function(_0x2837fd){if(_0x2837fd){var _0x556a31=util[_0xbe9c('0x2f')]('%s.cypher',_0x2837fd[_0xbe9c('0x4b')]);if(fs[_0xbe9c('0x4c')](_0x556a31)){_0x439a3e=!![];return _0x2c9cff[_0xbe9c('0x4d')](_0x556a31,_0x2837fd[_0xbe9c('0x4b')],config['secrets'][_0xbe9c('0x5a')])[_0xbe9c('0x20')](function(){return _0x2837fd;});}return _0x2837fd;}})[_0xbe9c('0x20')](function(_0x36ef36){if(_0x36ef36){if(!fs[_0xbe9c('0x4c')](_0x36ef36[_0xbe9c('0x4b')])){throw new db[(_0xbe9c('0x5b'))][(_0xbe9c('0x4e'))](_0xbe9c('0x4f'));}if(_0x36ef36[_0xbe9c('0x50')]){return _0xd8106e[_0xbe9c('0x48')](_0x36ef36[_0xbe9c('0x4b')],_0x36ef36[_0xbe9c('0x50')]+path['extname'](_0x36ef36['value']),function(){if(_0x439a3e){fs[_0xbe9c('0x52')](_0x36ef36[_0xbe9c('0x4b')]);}});}else{return _0xd8106e[_0xbe9c('0x48')](_0x36ef36['value'],function(_0x5ec95d){if(_0x439a3e){fs[_0xbe9c('0x52')](_0x36ef36['value']);}});}}})['catch'](handleError(_0xd8106e,null));};exports['destroy']=function(_0xd570bc,_0x133f53){return db['VoiceRecording'][_0xbe9c('0x43')]({'where':{'id':_0xd570bc[_0xbe9c('0x46')]['id']}})[_0xbe9c('0x20')](function(_0x162f6a){if(_[_0xbe9c('0x5c')](_0x162f6a)){throw new ReferenceError(_0xbe9c('0x5d'));}return _0x162f6a;})['then'](function(_0x4ff9dd){var _0x148012=_0x4ff9dd[_0xbe9c('0x4b')];logger[_0xbe9c('0x5e')](_0xbe9c('0x5f'),_0x148012);if(!_[_0xbe9c('0x5c')](_0x4ff9dd[_0xbe9c('0x4b')])&&fs[_0xbe9c('0x4c')](_0x148012)){logger[_0xbe9c('0x5e')](_0xbe9c('0x60')+_0x148012+_0xbe9c('0x61'));fs[_0xbe9c('0x62')](_0x148012);}_0x148012=_0x148012+_0xbe9c('0x63');if(!_[_0xbe9c('0x5c')](_0x4ff9dd[_0xbe9c('0x4b')])&&fs[_0xbe9c('0x4c')](_0x148012)){logger['info'](_0xbe9c('0x60')+_0x148012+_0xbe9c('0x61'));fs['unlinkSync'](_0x148012);}return _0x4ff9dd;})[_0xbe9c('0x20')](function(_0x1d4448){if(!_0x1d4448)throw new InternalError();return _0x1d4448['destroy']();})[_0xbe9c('0x20')](function(){_0x133f53['status'](0xcc)[_0xbe9c('0x21')]();})[_0xbe9c('0x3f')](handleError(_0x133f53,null));};function getBucketslist(_0x373e86,_0x50d963,_0x3ad6fb){return new Promise(function(_0x19dd5f,_0xc01a3e){var _0x39d8d6=new AWS['S3']({'accessKeyId':_0x50d963,'secretAccessKey':_0x373e86,'region':_0x3ad6fb});_0x39d8d6['listBuckets']({},function(_0x48ed49,_0x20cea9){if(_0x48ed49){return _0xc01a3e(_0x48ed49);}else{return _0x19dd5f(_0x20cea9);}});});}function createBucket(_0x4dc36e,_0x5b2723,_0x136f73,_0x49069b){return new Promise(function(_0x3e0d64,_0x1b3c69){var _0x2abd63=new AWS['S3']({'accessKeyId':_0x5b2723,'secretAccessKey':_0x4dc36e,'region':_0x136f73});_0x2abd63[_0xbe9c('0x64')]({'Bucket':_0x49069b},function(_0x42f5d1,_0x5024cf){if(_0x42f5d1){return _0x1b3c69(_0x42f5d1);}else{return _0x3e0d64(_0x5024cf);}});});}function uploadFile(_0x24db6a,_0x3418e1,_0x3b0e8b,_0x19960f,_0x1e6ede,_0x1f0de7){return new Promise(function(_0x54447c,_0x5f3bb7){var _0x4dbe88=new AWS['S3']({'accessKeyId':_0x3418e1,'secretAccessKey':_0x24db6a,'region':_0x3b0e8b});_0x4dbe88['upload']({'Bucket':_0x19960f,'Key':_0x1e6ede,'Body':_0x1f0de7},function(_0x4d1ef0,_0x2f2ec6){if(_0x4d1ef0){return _0x5f3bb7(_0x4d1ef0);}else{return _0x54447c(_0x2f2ec6);}});});}function startTranscribe(_0x4653a1,_0x348cd3,_0x5b4b69,_0x4c1462,_0x2b19c7,_0x571794){return new Promise(function(_0x59cf0b,_0xa7a3c6){var _0x22bb55=new AWS[(_0xbe9c('0x65'))]({'accessKeyId':_0x348cd3,'secretAccessKey':_0x4653a1,'region':_0x5b4b69});_0x22bb55[_0xbe9c('0x66')]({'TranscriptionJobName':_0x4c1462,'LanguageCode':_0x2b19c7,'Media':{'MediaFileUri':_0x571794}},function(_0x3aea1e,_0x3d8d24){if(_0x3aea1e){return _0xa7a3c6(_0x3aea1e);}else{return _0x59cf0b(_0x3d8d24);}});});}function transcribe(_0x1894d1,_0x55ff7,_0x660c25,_0x335c62,_0x3b6a60,_0x22acf1,_0x5c1635){return new Promise(function(_0x5cb930,_0x212ef1){var _0x38b534={};logger[_0xbe9c('0x5e')](util[_0xbe9c('0x2f')](_0xbe9c('0x67'),_0x1894d1,_0x3b6a60));return uploadFile(_0x55ff7,_0x660c25,_0x335c62,_0x3b6a60,path[_0xbe9c('0x68')](_0x22acf1),fs[_0xbe9c('0x69')](_0x22acf1))[_0xbe9c('0x20')](function(_0x14678d){logger[_0xbe9c('0x5e')](util[_0xbe9c('0x2f')](_0xbe9c('0x6a'),_0x1894d1,_0x3b6a60,_0x14678d['Location']));_0x38b534[_0xbe9c('0x6b')]=_0x14678d['Bucket'];_0x38b534[_0xbe9c('0x6c')]=_0x14678d[_0xbe9c('0x6d')];logger[_0xbe9c('0x5e')](util[_0xbe9c('0x2f')](_0xbe9c('0x6e'),_0x1894d1));return startTranscribe(_0x55ff7,_0x660c25,_0x335c62,uuidv4(),_0x5c1635,_0x14678d[_0xbe9c('0x6d')]);})['then'](function(_0x528c6a){logger[_0xbe9c('0x5e')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x1894d1,_0x528c6a['TranscriptionJob'][_0xbe9c('0x6f')]));_0x38b534['transcribeName']=_0x528c6a[_0xbe9c('0x70')][_0xbe9c('0x6f')];_0x38b534[_0xbe9c('0x71')]=_0x528c6a[_0xbe9c('0x70')][_0xbe9c('0x72')];return _0x5cb930(_0x38b534);})[_0xbe9c('0x3f')](function(_0x48072d){return _0x212ef1(_0x48072d);});});}exports[_0xbe9c('0x73')]=function(_0x28ced8,_0x5c0436,_0x5b741e){var _0x1d7ec2;var _0x56c869;var _0x47c71a;var _0x2dcffe=require(_0xbe9c('0x49'));return db['VoiceRecording']['findOne']({'where':{'id':_0x28ced8[_0xbe9c('0x46')]['id']}})[_0xbe9c('0x20')](function(_0x1fadb9){if(_0x1fadb9){var _0x2642ef=util[_0xbe9c('0x2f')]('%s.cypher',_0x1fadb9['value']);if(fs['existsSync'](_0x2642ef)){cypher=!![];return _0x2dcffe[_0xbe9c('0x4d')](_0x2642ef,_0x1fadb9['value'],config[_0xbe9c('0x74')][_0xbe9c('0x5a')])[_0xbe9c('0x20')](function(){return _0x1fadb9;});}return _0x1fadb9;}})[_0xbe9c('0x20')](function(_0x2fb737){if(!_0x2fb737){throw new db[(_0xbe9c('0x5b'))]['ValidationError'](_0xbe9c('0x75'));}_0x56c869=_0x2fb737;return db[_0xbe9c('0x76')][_0xbe9c('0x77')]({'where':{'id':0x1}});})[_0xbe9c('0x20')](handleEntityNotFound(_0x5c0436,null))[_0xbe9c('0x20')](function(_0x3ff224){if(_0x3ff224){_0x1d7ec2=_0x3ff224;if(!_0x1d7ec2[_0xbe9c('0x78')]||!_0x1d7ec2[_0xbe9c('0x79')]||!_0x1d7ec2[_0xbe9c('0x7a')]||!_0x1d7ec2[_0xbe9c('0x7b')]||!_0x1d7ec2[_0xbe9c('0x6b')]){throw new db[(_0xbe9c('0x5b'))][(_0xbe9c('0x4e'))](_0xbe9c('0x7c'));}if(_0x28ced8[_0xbe9c('0x45')][_0xbe9c('0x7d')]&&(!_0x1d7ec2['sentiment']||!_0x1d7ec2[_0xbe9c('0x7e')]||!_0x1d7ec2[_0xbe9c('0x7f')]||!_0x1d7ec2['language']||!_0x1d7ec2[_0xbe9c('0x6b')])){throw new db[(_0xbe9c('0x5b'))][(_0xbe9c('0x4e'))](_0xbe9c('0x80'));}return db[_0xbe9c('0x81')][_0xbe9c('0x77')]({'where':{'id':_0x1d7ec2[_0xbe9c('0x79')]}});}})[_0xbe9c('0x20')](function(_0x121484){if(!_0x121484){throw new db['Sequelize'][(_0xbe9c('0x4e'))](_0xbe9c('0x82'));}if(!_0x121484['data1']||!_0x121484['data2']){throw new db[(_0xbe9c('0x5b'))][(_0xbe9c('0x4e'))](_0xbe9c('0x83'));}_0x47c71a=_0x121484;return getBucketslist(_0x47c71a['data1'],_0x47c71a['data2'],_0x1d7ec2['transcribeRegion']);})[_0xbe9c('0x20')](function(_0x4c6423){if(_0x4c6423&&_0x4c6423[_0xbe9c('0x84')]){var _0x39224f=_[_0xbe9c('0x43')](_0x4c6423[_0xbe9c('0x84')],function(_0x56b554){return _0x56b554[_0xbe9c('0x85')]===_0x1d7ec2['bucket'];});if(!_0x39224f){logger['info'](util[_0xbe9c('0x2f')](_0xbe9c('0x86'),_0x28ced8[_0xbe9c('0x46')]['id'],_0x1d7ec2['bucket']));return createBucket(_0x47c71a[_0xbe9c('0x87')],_0x47c71a[_0xbe9c('0x88')],_0x1d7ec2[_0xbe9c('0x7a')],_0x1d7ec2[_0xbe9c('0x6b')]);}logger[_0xbe9c('0x5e')](util['format'](_0xbe9c('0x89'),_0x28ced8[_0xbe9c('0x46')]['id'],_0x1d7ec2[_0xbe9c('0x6b')]));return;}})['then'](function(_0x39db18){if(_0x56c869[_0xbe9c('0x71')]===_0xbe9c('0x8a')){return transcribe(_0x28ced8[_0xbe9c('0x46')]['id'],_0x47c71a['data1'],_0x47c71a['data2'],_0x1d7ec2['transcribeRegion'],_0x1d7ec2['bucket'],_0x56c869[_0xbe9c('0x4b')],_0x1d7ec2[_0xbe9c('0x7b')]);}else{logger['info'](util['format'](_0xbe9c('0x8b'),_0x28ced8[_0xbe9c('0x46')]['id']));return{'transcribeStatus':_0xbe9c('0x8c')};}})['then'](function(_0x217bb6){if(_0x217bb6){_0x217bb6[_0xbe9c('0x8d')]=_0x28ced8[_0xbe9c('0x45')][_0xbe9c('0x7d')];return _0x56c869[_0xbe9c('0x8e')](_0x217bb6);}})[_0xbe9c('0x20')](respondWithResult(_0x5c0436,null))['catch'](handleError(_0x5c0436,null));};function writeFile(_0x542d62,_0x4fcf55){return new Promise(function(_0x4bc307,_0x38b6de){fs[_0xbe9c('0x8f')](_0x4fcf55,_0x542d62,function(_0x3c46b8,_0x5660c4){if(_0x3c46b8){return _0x38b6de(_0x3c46b8);}else{return _0x4bc307(_0x5660c4);}});});}exports[_0xbe9c('0x90')]=function(_0x103b48,_0x4a0d37,_0x135d71){return db[_0xbe9c('0x28')][_0xbe9c('0x77')]({'where':{'id':_0x103b48[_0xbe9c('0x46')]['id']}})[_0xbe9c('0x20')](handleEntityNotFound(_0x4a0d37))[_0xbe9c('0x20')](function(_0x5a3352){if(_0x5a3352&&_0x5a3352[_0xbe9c('0x91')]){var _0x4a4b0c=_0x5a3352[_0xbe9c('0x91')];var _0x543f26=config['root']+_0xbe9c('0x92')+_0x5a3352['id']+_0xbe9c('0x93');if(fs[_0xbe9c('0x4c')](_0x543f26)){return _0x543f26;}return writeFile(_0x4a4b0c,_0x543f26)['then'](function(){return _0x543f26;});}else{throw new db[(_0xbe9c('0x5b'))]['ValidationError']('Transcript\x20not\x20available');}})[_0xbe9c('0x20')](function(_0x2e92da){return _0x4a0d37[_0xbe9c('0x48')](_0x2e92da);})['catch'](handleError(_0x4a0d37));}; \ No newline at end of file +var _0xc0e1=['root','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','VoiceRecording','include','rows','catch','show','params','keys','includeAll','find','create','body','describe','download','../../components/encryptor','uniqueid','value','format','%s.cypher','existsSync','decryptFile','recording','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','sequelize','token','push','$and','secrets','destroy','isNil','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','TranscribeService','[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','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Sequelize','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','updateAttributes','writeFile','fileText'];(function(_0x548229,_0xdae07f){var _0x247a67=function(_0x545a6e){while(--_0x545a6e){_0x548229['push'](_0x548229['shift']());}};_0x247a67(++_0xdae07f);}(_0xc0e1,0x127));var _0x1c0e=function(_0x5cb97e,_0x132a39){_0x5cb97e=_0x5cb97e-0x0;var _0x1714b4=_0xc0e1[_0x5cb97e];return _0x1714b4;};'use strict';var emlformat=require(_0x1c0e('0x0'));var rimraf=require(_0x1c0e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1c0e('0x2'));var rp=require(_0x1c0e('0x3'));var moment=require(_0x1c0e('0x4'));var BPromise=require(_0x1c0e('0x5'));var Mustache=require('mustache');var util=require(_0x1c0e('0x6'));var path=require(_0x1c0e('0x7'));var sox=require(_0x1c0e('0x8'));var csv=require(_0x1c0e('0x9'));var ejs=require(_0x1c0e('0xa'));var fs=require('fs');var fs_extra=require(_0x1c0e('0xb'));var _=require(_0x1c0e('0xc'));var squel=require('squel');var crypto=require(_0x1c0e('0xd'));var jsforce=require(_0x1c0e('0xe'));var deskjs=require(_0x1c0e('0xf'));var toCsv=require(_0x1c0e('0x9'));var querystring=require(_0x1c0e('0x10'));var Papa=require(_0x1c0e('0x11'));var AWS=require(_0x1c0e('0x12'));var uuidv4=require(_0x1c0e('0x13'));var Redis=require(_0x1c0e('0x14'));var authService=require(_0x1c0e('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x1c0e('0x16'));var hardwareService=require(_0x1c0e('0x17'));var logger=require(_0x1c0e('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x1c0e('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x1c0e('0x1a'))['db'];function respondWithStatusCode(_0x3e279f,_0x486b40){_0x486b40=_0x486b40||0xcc;return function(_0x9d7534){if(_0x9d7534){return _0x3e279f['sendStatus'](_0x486b40);}return _0x3e279f[_0x1c0e('0x1b')](_0x486b40)[_0x1c0e('0x1c')]();};}function respondWithResult(_0x44dab4,_0x25da41){_0x25da41=_0x25da41||0xc8;return function(_0x3a8216){if(_0x3a8216){return _0x44dab4[_0x1c0e('0x1b')](_0x25da41)['json'](_0x3a8216);}};}function respondWithFilteredResult(_0x405824,_0x44be28){return function(_0x5c03ac){if(_0x5c03ac){var _0x1a0379=typeof _0x44be28[_0x1c0e('0x1d')]===_0x1c0e('0x1e')&&typeof _0x44be28[_0x1c0e('0x1f')]===_0x1c0e('0x1e');var _0x50a5ff=_0x5c03ac[_0x1c0e('0x20')];var _0x11bc8a=_0x1a0379?0x0:_0x44be28[_0x1c0e('0x1d')];var _0x570175=_0x1a0379?_0x5c03ac[_0x1c0e('0x20')]:_0x44be28[_0x1c0e('0x1d')]+_0x44be28[_0x1c0e('0x1f')];var _0x54e910;if(_0x570175>=_0x50a5ff){_0x570175=_0x50a5ff;_0x54e910=0xc8;}else{_0x54e910=0xce;}_0x405824['status'](_0x54e910);return _0x405824[_0x1c0e('0x21')](_0x1c0e('0x22'),_0x11bc8a+'-'+_0x570175+'/'+_0x50a5ff)[_0x1c0e('0x23')](_0x5c03ac);}return null;};}function patchUpdates(_0x43caa6){return function(_0x9e6de7){try{jsonpatch[_0x1c0e('0x24')](_0x9e6de7,_0x43caa6,!![]);}catch(_0x44ddc5){return BPromise[_0x1c0e('0x25')](_0x44ddc5);}return _0x9e6de7[_0x1c0e('0x26')]();};}function saveUpdates(_0xed5017,_0x2d8a12){return function(_0x1491cb){if(_0x1491cb){return _0x1491cb[_0x1c0e('0x27')](_0xed5017)[_0x1c0e('0x28')](function(_0x5b9af9){return _0x5b9af9;});}return null;};}function removeEntity(_0x297bfe,_0x599510){return function(_0x59cac9){if(_0x59cac9){return _0x59cac9['destroy']()[_0x1c0e('0x28')](function(){_0x297bfe['status'](0xcc)[_0x1c0e('0x1c')]();});}};}function handleEntityNotFound(_0x18a1f9,_0x317652){return function(_0x27f677){if(!_0x27f677){_0x18a1f9[_0x1c0e('0x29')](0x194);}return _0x27f677;};}function handleError(_0x43846b,_0x50bd74){_0x50bd74=_0x50bd74||0x1f4;return function(_0x13fa92){logger['error'](_0x13fa92['stack']);if(_0x13fa92[_0x1c0e('0x2a')]){delete _0x13fa92['name'];}_0x43846b[_0x1c0e('0x1b')](_0x50bd74)[_0x1c0e('0x2b')](_0x13fa92);};}exports[_0x1c0e('0x2c')]=function(_0x278c20,_0x2475ce){var _0xc77190={},_0x10dfda={},_0x41d322={'count':0x0,'rows':[]};var _0x1b05f2=_[_0x1c0e('0x2d')](db['VoiceRecording'][_0x1c0e('0x2e')],function(_0x4997d9){return{'name':_0x4997d9[_0x1c0e('0x2f')],'type':_0x4997d9[_0x1c0e('0x30')][_0x1c0e('0x31')]};});_0x10dfda[_0x1c0e('0x32')]=_[_0x1c0e('0x33')](_['map'](_0x1b05f2,_0x1c0e('0x2a')),['format']);_0x10dfda[_0x1c0e('0x34')]=_['keys'](_0x278c20[_0x1c0e('0x34')]);_0x10dfda[_0x1c0e('0x35')]=_[_0x1c0e('0x36')](_0x10dfda[_0x1c0e('0x32')],_0x10dfda[_0x1c0e('0x34')]);_0xc77190[_0x1c0e('0x37')]=_[_0x1c0e('0x36')](_0x10dfda[_0x1c0e('0x32')],qs['fields'](_0x278c20[_0x1c0e('0x34')][_0x1c0e('0x38')]));_0xc77190[_0x1c0e('0x37')]=_0xc77190[_0x1c0e('0x37')]['length']?_0xc77190[_0x1c0e('0x37')]:_0x10dfda[_0x1c0e('0x32')];if(!_0x278c20[_0x1c0e('0x34')]['hasOwnProperty'](_0x1c0e('0x39'))){_0xc77190['limit']=qs[_0x1c0e('0x1f')](_0x278c20[_0x1c0e('0x34')]['limit']);_0xc77190[_0x1c0e('0x1d')]=qs[_0x1c0e('0x1d')](_0x278c20[_0x1c0e('0x34')][_0x1c0e('0x1d')]);}_0xc77190[_0x1c0e('0x3a')]=qs[_0x1c0e('0x3b')](_0x278c20[_0x1c0e('0x34')][_0x1c0e('0x3b')]);_0xc77190[_0x1c0e('0x3c')]=qs[_0x1c0e('0x35')](_[_0x1c0e('0x3d')](_0x278c20[_0x1c0e('0x34')],_0x10dfda['filters']),_0x1b05f2);if(_0x278c20[_0x1c0e('0x34')]['filter']){_0xc77190[_0x1c0e('0x3c')]=_[_0x1c0e('0x3e')](_0xc77190[_0x1c0e('0x3c')],{'$or':_[_0x1c0e('0x2d')](_0x1b05f2,function(_0x32d3eb){if(_0x32d3eb[_0x1c0e('0x30')]!==_0x1c0e('0x3f')){var _0x3fcafc={};_0x3fcafc[_0x32d3eb[_0x1c0e('0x2a')]]={'$like':'%'+_0x278c20[_0x1c0e('0x34')][_0x1c0e('0x40')]+'%'};return _0x3fcafc;}})});}_0xc77190=_['merge']({},_0xc77190,_0x278c20['options']);var _0x1a93e3={'where':_0xc77190[_0x1c0e('0x3c')]};return db[_0x1c0e('0x41')]['count'](_0x1a93e3)[_0x1c0e('0x28')](function(_0x1d301a){_0x41d322[_0x1c0e('0x20')]=_0x1d301a;if(_0x278c20[_0x1c0e('0x34')]['includeAll']){_0xc77190[_0x1c0e('0x42')]=[{'all':!![]}];}return db[_0x1c0e('0x41')]['findAll'](_0xc77190);})[_0x1c0e('0x28')](function(_0x12f8de){_0x41d322[_0x1c0e('0x43')]=_0x12f8de;return _0x41d322;})['then'](respondWithFilteredResult(_0x2475ce,_0xc77190))[_0x1c0e('0x44')](handleError(_0x2475ce,null));};exports[_0x1c0e('0x45')]=function(_0xf92de7,_0x4bcb87){var _0x4c04fb={'raw':![],'where':{'id':_0xf92de7[_0x1c0e('0x46')]['id']}},_0x41acc3={};_0x41acc3[_0x1c0e('0x32')]=_[_0x1c0e('0x47')](db[_0x1c0e('0x41')][_0x1c0e('0x2e')]);_0x41acc3[_0x1c0e('0x34')]=_[_0x1c0e('0x47')](_0xf92de7['query']);_0x41acc3[_0x1c0e('0x35')]=_['intersection'](_0x41acc3['model'],_0x41acc3[_0x1c0e('0x34')]);_0x4c04fb[_0x1c0e('0x37')]=_[_0x1c0e('0x36')](_0x41acc3[_0x1c0e('0x32')],qs[_0x1c0e('0x38')](_0xf92de7[_0x1c0e('0x34')][_0x1c0e('0x38')]));_0x4c04fb[_0x1c0e('0x37')]=_0x4c04fb[_0x1c0e('0x37')]['length']?_0x4c04fb[_0x1c0e('0x37')]:_0x41acc3[_0x1c0e('0x32')];if(_0xf92de7[_0x1c0e('0x34')][_0x1c0e('0x48')]){_0x4c04fb[_0x1c0e('0x42')]=[{'all':!![]}];}_0x4c04fb=_[_0x1c0e('0x3e')]({},_0x4c04fb,_0xf92de7['options']);return db['VoiceRecording'][_0x1c0e('0x49')](_0x4c04fb)[_0x1c0e('0x28')](handleEntityNotFound(_0x4bcb87,null))[_0x1c0e('0x28')](respondWithResult(_0x4bcb87,null))[_0x1c0e('0x44')](handleError(_0x4bcb87,null));};exports[_0x1c0e('0x4a')]=function(_0x4dd561,_0x586bcf){return db[_0x1c0e('0x41')]['create'](_0x4dd561[_0x1c0e('0x4b')],{})['then'](respondWithResult(_0x586bcf,0xc9))[_0x1c0e('0x44')](handleError(_0x586bcf,null));};exports[_0x1c0e('0x27')]=function(_0x52c0fe,_0x2cfe8d){if(_0x52c0fe[_0x1c0e('0x4b')]['id']){delete _0x52c0fe[_0x1c0e('0x4b')]['id'];}return db[_0x1c0e('0x41')]['find']({'where':{'id':_0x52c0fe[_0x1c0e('0x46')]['id']}})[_0x1c0e('0x28')](handleEntityNotFound(_0x2cfe8d,null))[_0x1c0e('0x28')](saveUpdates(_0x52c0fe[_0x1c0e('0x4b')],null))[_0x1c0e('0x28')](respondWithResult(_0x2cfe8d,null))[_0x1c0e('0x44')](handleError(_0x2cfe8d,null));};exports[_0x1c0e('0x4c')]=function(_0x3abacd,_0x2229cc){return db['VoiceRecording'][_0x1c0e('0x4c')]()['then'](respondWithResult(_0x2229cc,null))['catch'](handleError(_0x2229cc,null));};exports[_0x1c0e('0x4d')]=function(_0x1bad4b,_0x3eb3c5,_0x14409d){var _0x29c5ab=require(_0x1c0e('0x4e'));var _0x2784ab=![];var _0x20198c={};if(_0x1bad4b[_0x1c0e('0x34')][_0x1c0e('0x30')]&&_0x1bad4b[_0x1c0e('0x34')][_0x1c0e('0x30')]==='uniqueid'){_0x20198c[_0x1c0e('0x4f')]=_0x1bad4b[_0x1c0e('0x46')]['id'];}else{_0x20198c['id']=_0x1bad4b[_0x1c0e('0x46')]['id'];}return db[_0x1c0e('0x41')][_0x1c0e('0x49')]({'where':_0x20198c,'attributes':['id',_0x1c0e('0x50')],'raw':!![]})[_0x1c0e('0x28')](handleEntityNotFound(_0x3eb3c5,null))['then'](function(_0x21c10a){if(_0x21c10a){var _0x554654=_0x21c10a[_0x1c0e('0x50')];var _0x57d312=util[_0x1c0e('0x51')](_0x1c0e('0x52'),_0x554654);if(fs[_0x1c0e('0x53')](_0x57d312)){_0x2784ab=!![];return _0x29c5ab[_0x1c0e('0x54')](_0x57d312,_0x554654,config['secrets'][_0x1c0e('0x55')])[_0x1c0e('0x28')](function(){return _0x21c10a;});}return _0x21c10a;}})['then'](function(_0x580075){if(_0x580075){var _0x263290=_0x580075[_0x1c0e('0x50')];if(!fs[_0x1c0e('0x53')](_0x263290)){throw new db['Sequelize'][(_0x1c0e('0x56'))](_0x1c0e('0x57'));}if(_0x580075['filename']){return _0x3eb3c5[_0x1c0e('0x4d')](_0x263290,_0x580075[_0x1c0e('0x58')]+path[_0x1c0e('0x59')](_0x263290),function(){if(_0x2784ab){fs[_0x1c0e('0x5a')](_0x263290);}});}else{return _0x3eb3c5['download'](_0x263290,function(_0x4af9f6){if(_0x2784ab){fs[_0x1c0e('0x5a')](_0x263290);}});}}})['catch'](function(_0x27ad51){if(_0x27ad51[_0x1c0e('0x5b')]===_0x1c0e('0x57')){_0x3eb3c5['status'](0x194)[_0x1c0e('0x2b')](_0x1c0e('0x5c'));}else{return handleError(_0x3eb3c5,null);}});};exports['downloads']=function(_0x2bc6a9,_0xc2a84e,_0x462944){var _0x198062=require(_0x1c0e('0x4e'));var _0x1bfb15=![];var _0x495330={'$and':[db['sequelize'][_0x1c0e('0x3c')](db['sequelize']['fn']('MD5',db[_0x1c0e('0x5d')]['col'](_0x1c0e('0x4f'))),_0x2bc6a9[_0x1c0e('0x34')][_0x1c0e('0x5e')])]};if(_0x2bc6a9[_0x1c0e('0x34')][_0x1c0e('0x30')]&&_0x2bc6a9[_0x1c0e('0x34')]['type']===_0x1c0e('0x4f')){_0x495330['$and'][_0x1c0e('0x5f')]({'uniqueid':_0x2bc6a9[_0x1c0e('0x46')]['id']});}else{_0x495330[_0x1c0e('0x60')][_0x1c0e('0x5f')]({'id':_0x2bc6a9[_0x1c0e('0x46')]['id']});}return db[_0x1c0e('0x41')][_0x1c0e('0x49')]({'where':_0x495330,'attributes':['id',_0x1c0e('0x50')],'raw':!![]})[_0x1c0e('0x28')](handleEntityNotFound(_0xc2a84e,null))[_0x1c0e('0x28')](function(_0x108655){if(_0x108655){var _0x26ccf1=util[_0x1c0e('0x51')](_0x1c0e('0x52'),_0x108655[_0x1c0e('0x50')]);if(fs[_0x1c0e('0x53')](_0x26ccf1)){_0x1bfb15=!![];return _0x198062['decryptFile'](_0x26ccf1,_0x108655[_0x1c0e('0x50')],config[_0x1c0e('0x61')]['recording'])['then'](function(){return _0x108655;});}return _0x108655;}})[_0x1c0e('0x28')](function(_0x1b1777){if(_0x1b1777){if(!fs['existsSync'](_0x1b1777[_0x1c0e('0x50')])){throw new db['Sequelize'][(_0x1c0e('0x56'))](_0x1c0e('0x57'));}if(_0x1b1777[_0x1c0e('0x58')]){return _0xc2a84e[_0x1c0e('0x4d')](_0x1b1777['value'],_0x1b1777[_0x1c0e('0x58')]+path['extname'](_0x1b1777[_0x1c0e('0x50')]),function(){if(_0x1bfb15){fs[_0x1c0e('0x5a')](_0x1b1777[_0x1c0e('0x50')]);}});}else{return _0xc2a84e[_0x1c0e('0x4d')](_0x1b1777['value'],function(_0x3d4042){if(_0x1bfb15){fs['unlink'](_0x1b1777['value']);}});}}})['catch'](handleError(_0xc2a84e,null));};exports[_0x1c0e('0x62')]=function(_0x57d99f,_0x4dd23d){return db['VoiceRecording'][_0x1c0e('0x49')]({'where':{'id':_0x57d99f['params']['id']}})['then'](function(_0x3692e4){if(_[_0x1c0e('0x63')](_0x3692e4)){throw new ReferenceError('Entity\x20not\x20found');}return _0x3692e4;})[_0x1c0e('0x28')](function(_0x3f932d){var _0x2e9059=_0x3f932d[_0x1c0e('0x50')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x2e9059);if(!_['isNil'](_0x3f932d[_0x1c0e('0x50')])&&fs[_0x1c0e('0x53')](_0x2e9059)){logger[_0x1c0e('0x64')]('File:\x20\x22'+_0x2e9059+_0x1c0e('0x65'));fs[_0x1c0e('0x66')](_0x2e9059);}_0x2e9059=_0x2e9059+_0x1c0e('0x67');if(!_[_0x1c0e('0x63')](_0x3f932d[_0x1c0e('0x50')])&&fs[_0x1c0e('0x53')](_0x2e9059)){logger['info']('File:\x20\x22'+_0x2e9059+_0x1c0e('0x65'));fs[_0x1c0e('0x66')](_0x2e9059);}return _0x3f932d;})[_0x1c0e('0x28')](function(_0x297fbc){if(!_0x297fbc)throw new InternalError();return _0x297fbc['destroy']();})[_0x1c0e('0x28')](function(){_0x4dd23d[_0x1c0e('0x1b')](0xcc)[_0x1c0e('0x1c')]();})[_0x1c0e('0x44')](handleError(_0x4dd23d,null));};function getBucketslist(_0x4a92d9,_0x3a0123,_0x5703d0){return new Promise(function(_0x4d07de,_0x50b38b){var _0x45ad71=new AWS['S3']({'accessKeyId':_0x3a0123,'secretAccessKey':_0x4a92d9,'region':_0x5703d0});_0x45ad71['listBuckets']({},function(_0x185984,_0x2ad197){if(_0x185984){return _0x50b38b(_0x185984);}else{return _0x4d07de(_0x2ad197);}});});}function createBucket(_0x440933,_0x7e6948,_0x586dff,_0x1535f2){return new Promise(function(_0x1248ba,_0x189b43){var _0x77f830=new AWS['S3']({'accessKeyId':_0x7e6948,'secretAccessKey':_0x440933,'region':_0x586dff});_0x77f830['createBucket']({'Bucket':_0x1535f2},function(_0x3f2b56,_0x4af7fe){if(_0x3f2b56){return _0x189b43(_0x3f2b56);}else{return _0x1248ba(_0x4af7fe);}});});}function uploadFile(_0x2fd820,_0x5d4797,_0xf50d8c,_0x9e14fa,_0x1b7be1,_0x42577a){return new Promise(function(_0x15f16a,_0x3ab4d9){var _0x398a1a=new AWS['S3']({'accessKeyId':_0x5d4797,'secretAccessKey':_0x2fd820,'region':_0xf50d8c});_0x398a1a['upload']({'Bucket':_0x9e14fa,'Key':_0x1b7be1,'Body':_0x42577a},function(_0x254fac,_0x2eddda){if(_0x254fac){return _0x3ab4d9(_0x254fac);}else{return _0x15f16a(_0x2eddda);}});});}function startTranscribe(_0x115b78,_0x4fa78f,_0xfe1380,_0x254dcf,_0x6d2b5d,_0xf15321){return new Promise(function(_0x6db219,_0x3b8d00){var _0x2d5d0b=new AWS[(_0x1c0e('0x68'))]({'accessKeyId':_0x4fa78f,'secretAccessKey':_0x115b78,'region':_0xfe1380});_0x2d5d0b['startTranscriptionJob']({'TranscriptionJobName':_0x254dcf,'LanguageCode':_0x6d2b5d,'Media':{'MediaFileUri':_0xf15321}},function(_0x383865,_0x46a395){if(_0x383865){return _0x3b8d00(_0x383865);}else{return _0x6db219(_0x46a395);}});});}function transcribe(_0x7dcb69,_0xe34bc9,_0x23b158,_0x15c99f,_0x188d85,_0x1f0f58,_0x1ac00d){return new Promise(function(_0x28c5c7,_0x35eac8){var _0x290af4={};logger[_0x1c0e('0x64')](util['format'](_0x1c0e('0x69'),_0x7dcb69,_0x188d85));return uploadFile(_0xe34bc9,_0x23b158,_0x15c99f,_0x188d85,path[_0x1c0e('0x6a')](_0x1f0f58),fs[_0x1c0e('0x6b')](_0x1f0f58))['then'](function(_0x331ab3){logger[_0x1c0e('0x64')](util['format'](_0x1c0e('0x6c'),_0x7dcb69,_0x188d85,_0x331ab3[_0x1c0e('0x6d')]));_0x290af4[_0x1c0e('0x6e')]=_0x331ab3[_0x1c0e('0x6f')];_0x290af4[_0x1c0e('0x70')]=_0x331ab3[_0x1c0e('0x6d')];logger[_0x1c0e('0x64')](util[_0x1c0e('0x51')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x7dcb69));return startTranscribe(_0xe34bc9,_0x23b158,_0x15c99f,uuidv4(),_0x1ac00d,_0x331ab3[_0x1c0e('0x6d')]);})[_0x1c0e('0x28')](function(_0x862908){logger[_0x1c0e('0x64')](util['format'](_0x1c0e('0x71'),_0x7dcb69,_0x862908[_0x1c0e('0x72')][_0x1c0e('0x73')]));_0x290af4['transcribeName']=_0x862908[_0x1c0e('0x72')]['TranscriptionJobName'];_0x290af4[_0x1c0e('0x74')]=_0x862908[_0x1c0e('0x72')][_0x1c0e('0x75')];return _0x28c5c7(_0x290af4);})[_0x1c0e('0x44')](function(_0x4b0bc3){return _0x35eac8(_0x4b0bc3);});});}exports[_0x1c0e('0x76')]=function(_0x26bae9,_0x13b899,_0x28ff5c){var _0x26fddb;var _0x5bf062;var _0x2c07f8;var _0x46dac0=require('../../components/encryptor');return db['VoiceRecording'][_0x1c0e('0x77')]({'where':{'id':_0x26bae9[_0x1c0e('0x46')]['id']}})[_0x1c0e('0x28')](function(_0x52f292){if(_0x52f292){var _0xf7f97e=util['format'](_0x1c0e('0x52'),_0x52f292[_0x1c0e('0x50')]);if(fs[_0x1c0e('0x53')](_0xf7f97e)){cypher=!![];return _0x46dac0['decryptFile'](_0xf7f97e,_0x52f292[_0x1c0e('0x50')],config[_0x1c0e('0x61')][_0x1c0e('0x55')])[_0x1c0e('0x28')](function(){return _0x52f292;});}return _0x52f292;}})[_0x1c0e('0x28')](function(_0x4f6319){if(!_0x4f6319){throw new db[(_0x1c0e('0x78'))]['ValidationError'](_0x1c0e('0x79'));}_0x5bf062=_0x4f6319;return db[_0x1c0e('0x7a')][_0x1c0e('0x77')]({'where':{'id':0x1}});})[_0x1c0e('0x28')](handleEntityNotFound(_0x13b899,null))[_0x1c0e('0x28')](function(_0x5edd95){if(_0x5edd95){_0x26fddb=_0x5edd95;if(!_0x26fddb[_0x1c0e('0x7b')]||!_0x26fddb[_0x1c0e('0x7c')]||!_0x26fddb['transcribeRegion']||!_0x26fddb[_0x1c0e('0x7d')]||!_0x26fddb[_0x1c0e('0x6e')]){throw new db['Sequelize']['ValidationError'](_0x1c0e('0x7e'));}if(_0x26bae9[_0x1c0e('0x4b')][_0x1c0e('0x7f')]&&(!_0x26fddb['sentiment']||!_0x26fddb[_0x1c0e('0x80')]||!_0x26fddb['sentimentRegion']||!_0x26fddb[_0x1c0e('0x7d')]||!_0x26fddb[_0x1c0e('0x6e')])){throw new db[(_0x1c0e('0x78'))][(_0x1c0e('0x56'))](_0x1c0e('0x81'));}return db[_0x1c0e('0x82')][_0x1c0e('0x77')]({'where':{'id':_0x26fddb['transcribeAccountId']}});}})[_0x1c0e('0x28')](function(_0x453022){if(!_0x453022){throw new db[(_0x1c0e('0x78'))][(_0x1c0e('0x56'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x453022[_0x1c0e('0x83')]||!_0x453022[_0x1c0e('0x84')]){throw new db[(_0x1c0e('0x78'))][(_0x1c0e('0x56'))](_0x1c0e('0x85'));}_0x2c07f8=_0x453022;return getBucketslist(_0x2c07f8['data1'],_0x2c07f8[_0x1c0e('0x84')],_0x26fddb[_0x1c0e('0x86')]);})['then'](function(_0x3ac3a6){if(_0x3ac3a6&&_0x3ac3a6[_0x1c0e('0x87')]){var _0x1c3e03=_[_0x1c0e('0x49')](_0x3ac3a6[_0x1c0e('0x87')],function(_0x1dbf66){return _0x1dbf66[_0x1c0e('0x88')]===_0x26fddb['bucket'];});if(!_0x1c3e03){logger[_0x1c0e('0x64')](util[_0x1c0e('0x51')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x26bae9[_0x1c0e('0x46')]['id'],_0x26fddb[_0x1c0e('0x6e')]));return createBucket(_0x2c07f8['data1'],_0x2c07f8[_0x1c0e('0x84')],_0x26fddb[_0x1c0e('0x86')],_0x26fddb['bucket']);}logger[_0x1c0e('0x64')](util[_0x1c0e('0x51')](_0x1c0e('0x89'),_0x26bae9['params']['id'],_0x26fddb[_0x1c0e('0x6e')]));return;}})[_0x1c0e('0x28')](function(_0x59b79f){if(_0x5bf062['transcribeStatus']===_0x1c0e('0x8a')){return transcribe(_0x26bae9[_0x1c0e('0x46')]['id'],_0x2c07f8[_0x1c0e('0x83')],_0x2c07f8[_0x1c0e('0x84')],_0x26fddb[_0x1c0e('0x86')],_0x26fddb[_0x1c0e('0x6e')],_0x5bf062[_0x1c0e('0x50')],_0x26fddb[_0x1c0e('0x7d')]);}else{logger[_0x1c0e('0x64')](util[_0x1c0e('0x51')](_0x1c0e('0x8b'),_0x26bae9[_0x1c0e('0x46')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x1c0e('0x28')](function(_0x58063c){if(_0x58063c){_0x58063c['tempSentiment']=_0x26bae9[_0x1c0e('0x4b')][_0x1c0e('0x7f')];return _0x5bf062[_0x1c0e('0x8c')](_0x58063c);}})[_0x1c0e('0x28')](respondWithResult(_0x13b899,null))[_0x1c0e('0x44')](handleError(_0x13b899,null));};function writeFile(_0xe54a33,_0x4ea2e0){return new Promise(function(_0x3951ec,_0x5ead66){fs[_0x1c0e('0x8d')](_0x4ea2e0,_0xe54a33,function(_0x57e83e,_0x4fd97e){if(_0x57e83e){return _0x5ead66(_0x57e83e);}else{return _0x3951ec(_0x4fd97e);}});});}exports['downloadTranscribe']=function(_0x16bf43,_0x24477c,_0x1e1b5c){return db[_0x1c0e('0x41')][_0x1c0e('0x77')]({'where':{'id':_0x16bf43[_0x1c0e('0x46')]['id']}})['then'](handleEntityNotFound(_0x24477c))[_0x1c0e('0x28')](function(_0x234fdd){if(_0x234fdd&&_0x234fdd[_0x1c0e('0x8e')]){var _0x28c338=_0x234fdd[_0x1c0e('0x8e')];var _0x3e67a9=config[_0x1c0e('0x8f')]+_0x1c0e('0x90')+_0x234fdd['id']+_0x1c0e('0x91');if(fs[_0x1c0e('0x53')](_0x3e67a9)){return _0x3e67a9;}return writeFile(_0x28c338,_0x3e67a9)[_0x1c0e('0x28')](function(){return _0x3e67a9;});}else{throw new db[(_0x1c0e('0x78'))]['ValidationError']('Transcript\x20not\x20available');}})[_0x1c0e('0x28')](function(_0x1152e9){return _0x24477c[_0x1c0e('0x4d')](_0x1152e9);})[_0x1c0e('0x44')](handleError(_0x24477c));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 16be191..c03fb81 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 _0xcf54=['../../config/environment','./voiceRecording.attributes','exports','VoiceRecording','voice_recordings','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x14e512,_0x40b006){var _0x516a60=function(_0x321750){while(--_0x321750){_0x14e512['push'](_0x14e512['shift']());}};_0x516a60(++_0x40b006);}(_0xcf54,0x125));var _0x4cf5=function(_0xf363f0,_0x3b5eeb){_0xf363f0=_0xf363f0-0x0;var _0x55a386=_0xcf54[_0xf363f0];return _0x55a386;};'use strict';var _=require('lodash');var util=require(_0x4cf5('0x0'));var logger=require(_0x4cf5('0x1'))(_0x4cf5('0x2'));var moment=require(_0x4cf5('0x3'));var BPromise=require(_0x4cf5('0x4'));var rp=require(_0x4cf5('0x5'));var fs=require('fs');var path=require(_0x4cf5('0x6'));var rimraf=require('rimraf');var config=require(_0x4cf5('0x7'));var attributes=require(_0x4cf5('0x8'));module[_0x4cf5('0x9')]=function(_0xaf761a,_0x76b42b){return _0xaf761a['define'](_0x4cf5('0xa'),attributes,{'tableName':_0x4cf5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xca9b=['uniqueid','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./voiceRecording.attributes','define','VoiceRecording','voice_recordings'];(function(_0x2e2a10,_0x55f9f5){var _0x5ad6cd=function(_0x44c0a3){while(--_0x44c0a3){_0x2e2a10['push'](_0x2e2a10['shift']());}};_0x5ad6cd(++_0x55f9f5);}(_0xca9b,0x194));var _0xbca9=function(_0x2c8b24,_0x34ed0b){_0x2c8b24=_0x2c8b24-0x0;var _0x14bbfe=_0xca9b[_0x2c8b24];return _0x14bbfe;};'use strict';var _=require(_0xbca9('0x0'));var util=require(_0xbca9('0x1'));var logger=require(_0xbca9('0x2'))(_0xbca9('0x3'));var moment=require(_0xbca9('0x4'));var BPromise=require('bluebird');var rp=require(_0xbca9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbca9('0x6'));var config=require(_0xbca9('0x7'));var attributes=require(_0xbca9('0x8'));module['exports']=function(_0x138fcc,_0x71d0a3){return _0x138fcc[_0xbca9('0x9')](_0xbca9('0xa'),attributes,{'tableName':_0xbca9('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xbca9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 8c5e912..32c5051 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 _0x4991=['where','attributes','limit','catch','VoiceRecording','create','existsSync','value','%s.cypher','secrets','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateVoiceRecording','update','body','options','raw'];(function(_0x4e1110,_0x4a8671){var _0x1c999f=function(_0x3aba9b){while(--_0x3aba9b){_0x4e1110['push'](_0x4e1110['shift']());}};_0x1c999f(++_0x4a8671);}(_0x4991,0xf7));var _0x1499=function(_0x2ab39c,_0x21dd18){_0x2ab39c=_0x2ab39c-0x0;var _0x193afa=_0x4991[_0x2ab39c];return _0x193afa;};'use strict';var _=require(_0x1499('0x0'));var util=require('util');var moment=require(_0x1499('0x1'));var BPromise=require('bluebird');var rs=require(_0x1499('0x2'));var fs=require('fs');var Redis=require(_0x1499('0x3'));var db=require(_0x1499('0x4'))['db'];var utils=require(_0x1499('0x5'));var logger=require(_0x1499('0x6'))(_0x1499('0x7'));var config=require(_0x1499('0x8'));var jayson=require(_0x1499('0x9'));var client=jayson['client'][_0x1499('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c3bd7,_0x1c65c3,_0x33b261){return new BPromise(function(_0x133bae,_0x380e48){return client[_0x1499('0xb')](_0x1c3bd7,_0x33b261)[_0x1499('0xc')](function(_0x48d2ca){logger[_0x1499('0xd')](_0x1499('0xe'),_0x1c65c3,'request\x20sent');logger[_0x1499('0xf')](_0x1499('0x10'),_0x1c65c3,'request\x20sent',JSON[_0x1499('0x11')](_0x48d2ca));if(_0x48d2ca[_0x1499('0x12')]){if(_0x48d2ca['error']['code']===0x1f4){logger['error'](_0x1499('0xe'),_0x1c65c3,_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);return _0x380e48(_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);}logger['error']('VoiceRecording,\x20%s,\x20%s',_0x1c65c3,_0x48d2ca[_0x1499('0x12')]['message']);return _0x133bae(_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);}else{logger[_0x1499('0xd')](_0x1499('0xe'),_0x1c65c3,'request\x20sent');_0x133bae(_0x48d2ca[_0x1499('0x14')][_0x1499('0x13')]);}})['catch'](function(_0x25164c){logger[_0x1499('0x12')](_0x1499('0xe'),_0x1c65c3,_0x25164c);_0x380e48(_0x25164c);});});}exports[_0x1499('0x15')]=function(_0x1e45a9){var _0x27e533=this;return new Promise(function(_0x5b9859,_0x541477){return db['VoiceRecording'][_0x1499('0x16')](_0x1e45a9[_0x1499('0x17')],{'raw':_0x1e45a9['options']?_0x1e45a9[_0x1499('0x18')][_0x1499('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e45a9[_0x1499('0x18')]?_0x1e45a9[_0x1499('0x18')][_0x1499('0x1a')]||null:null,'attributes':_0x1e45a9[_0x1499('0x18')]?_0x1e45a9[_0x1499('0x18')][_0x1499('0x1b')]||null:null,'limit':_0x1e45a9[_0x1499('0x18')]?_0x1e45a9[_0x1499('0x18')][_0x1499('0x1c')]||null:null})[_0x1499('0xc')](function(_0x223f4c){logger[_0x1499('0xd')](_0x1499('0x15'),_0x1e45a9);logger[_0x1499('0xf')](_0x1499('0x15'),_0x1e45a9,JSON['stringify'](_0x223f4c));_0x5b9859(_0x223f4c);})[_0x1499('0x1d')](function(_0xc79f69){logger[_0x1499('0x12')](_0x1499('0x15'),_0xc79f69[_0x1499('0x13')],_0x1e45a9);_0x541477(_0x27e533[_0x1499('0x12')](0x1f4,_0xc79f69['message']));});});};exports['CreateVoiceRecording']=function(_0x12739b){var _0x3c9aca=this;return new Promise(function(_0x3b9259,_0x50f0cc){var _0x32782a=require('../../components/encryptor');var _0x3e5ed1;return db['Setting']['findOne']({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x1499('0xc')](function(_0x103efa){_0x3e5ed1=_0x103efa;return db[_0x1499('0x1e')][_0x1499('0x1f')](_0x12739b[_0x1499('0x17')]);})[_0x1499('0xc')](function(_0x3dd534){if(_0x3e5ed1['callRecordingEncryption']&&fs[_0x1499('0x20')](_0x3dd534[_0x1499('0x21')])){var _0x39995b=util['format'](_0x1499('0x22'),_0x3dd534[_0x1499('0x21')]);return _0x32782a['encryptFile'](_0x3dd534[_0x1499('0x21')],_0x39995b,config[_0x1499('0x23')]['recording'])[_0x1499('0xc')](function(){fs[_0x1499('0x24')](_0x3dd534[_0x1499('0x21')]);logger[_0x1499('0xd')](_0x1499('0x25'));return _0x3dd534;});}return _0x3dd534;})[_0x1499('0xc')](function(_0x7b4d75){logger[_0x1499('0xd')](_0x1499('0x26'),_0x12739b);logger[_0x1499('0xf')](_0x1499('0x26'),_0x12739b,JSON[_0x1499('0x11')](_0x7b4d75));_0x3b9259(_0x7b4d75);})[_0x1499('0x1d')](function(_0x3f4c1a){logger[_0x1499('0x12')](_0x1499('0x26'),_0x3f4c1a[_0x1499('0x13')],_0x12739b);_0x50f0cc(_0x3c9aca[_0x1499('0x12')](0x1f4,_0x3f4c1a[_0x1499('0x13')]));});});}; \ No newline at end of file +var _0x0598=['catch','UpdateVoiceRecording','VoiceRecording','body','options','where','limit','then','CreateVoiceRecording','../../components/encryptor','callRecordingEncryption','value','format','%s.cypher','encryptFile','secrets','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','bluebird','../../mysqldb','../../config/utils','jayson/promise','client','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x0598,0x92));var _0x8059=function(_0x2bd3f,_0x48c5a1){_0x2bd3f=_0x2bd3f-0x0;var _0x4242e7=_0x0598[_0x2bd3f];return _0x4242e7;};'use strict';var _=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var moment=require('moment');var BPromise=require(_0x8059('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8059('0x3'))['db'];var utils=require(_0x8059('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8059('0x5'));var client=jayson[_0x8059('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5996d7,_0x248273,_0x347f1b){return new BPromise(function(_0x4610d2,_0x116946){return client['request'](_0x5996d7,_0x347f1b)['then'](function(_0x89dda1){logger[_0x8059('0x7')](_0x8059('0x8'),_0x248273,_0x8059('0x9'));logger[_0x8059('0xa')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x248273,'request\x20sent',JSON[_0x8059('0xb')](_0x89dda1));if(_0x89dda1[_0x8059('0xc')]){if(_0x89dda1['error']['code']===0x1f4){logger['error'](_0x8059('0x8'),_0x248273,_0x89dda1[_0x8059('0xc')][_0x8059('0xd')]);return _0x116946(_0x89dda1[_0x8059('0xc')][_0x8059('0xd')]);}logger['error'](_0x8059('0x8'),_0x248273,_0x89dda1['error'][_0x8059('0xd')]);return _0x4610d2(_0x89dda1['error'][_0x8059('0xd')]);}else{logger[_0x8059('0x7')](_0x8059('0x8'),_0x248273,'request\x20sent');_0x4610d2(_0x89dda1['result']['message']);}})[_0x8059('0xe')](function(_0x239195){logger[_0x8059('0xc')](_0x8059('0x8'),_0x248273,_0x239195);_0x116946(_0x239195);});});}exports[_0x8059('0xf')]=function(_0x4b6d55){var _0x10ad98=this;return new Promise(function(_0x2bb670,_0x37e926){return db[_0x8059('0x10')]['update'](_0x4b6d55[_0x8059('0x11')],{'raw':_0x4b6d55['options']?_0x4b6d55[_0x8059('0x12')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b6d55[_0x8059('0x12')]?_0x4b6d55['options'][_0x8059('0x13')]||null:null,'attributes':_0x4b6d55[_0x8059('0x12')]?_0x4b6d55[_0x8059('0x12')]['attributes']||null:null,'limit':_0x4b6d55['options']?_0x4b6d55[_0x8059('0x12')][_0x8059('0x14')]||null:null})[_0x8059('0x15')](function(_0x1585a3){logger['info'](_0x8059('0xf'),_0x4b6d55);logger[_0x8059('0xa')](_0x8059('0xf'),_0x4b6d55,JSON['stringify'](_0x1585a3));_0x2bb670(_0x1585a3);})[_0x8059('0xe')](function(_0x2256b1){logger[_0x8059('0xc')](_0x8059('0xf'),_0x2256b1['message'],_0x4b6d55);_0x37e926(_0x10ad98[_0x8059('0xc')](0x1f4,_0x2256b1[_0x8059('0xd')]));});});};exports[_0x8059('0x16')]=function(_0x3e2d2b){var _0x202b30=this;return new Promise(function(_0x54b88b,_0x387350){var _0x19b95a=require(_0x8059('0x17'));var _0x4a294f;return db['Setting']['findOne']({'attributes':['id',_0x8059('0x18')],'where':{'id':0x1},'raw':!![]})[_0x8059('0x15')](function(_0xc32b1f){_0x4a294f=_0xc32b1f;return db[_0x8059('0x10')]['create'](_0x3e2d2b[_0x8059('0x11')]);})['then'](function(_0x2f887c){if(_0x4a294f[_0x8059('0x18')]&&fs['existsSync'](_0x2f887c[_0x8059('0x19')])){var _0x1aead2=util[_0x8059('0x1a')](_0x8059('0x1b'),_0x2f887c[_0x8059('0x19')]);return _0x19b95a[_0x8059('0x1c')](_0x2f887c[_0x8059('0x19')],_0x1aead2,config[_0x8059('0x1d')]['recording'])[_0x8059('0x15')](function(){fs[_0x8059('0x1e')](_0x2f887c[_0x8059('0x19')]);logger[_0x8059('0x7')](_0x8059('0x1f'));return _0x2f887c;});}return _0x2f887c;})['then'](function(_0x39f1c4){logger[_0x8059('0x7')](_0x8059('0x16'),_0x3e2d2b);logger[_0x8059('0xa')](_0x8059('0x16'),_0x3e2d2b,JSON[_0x8059('0xb')](_0x39f1c4));_0x54b88b(_0x39f1c4);})[_0x8059('0xe')](function(_0x175d57){logger[_0x8059('0xc')](_0x8059('0x16'),_0x175d57['message'],_0x3e2d2b);_0x387350(_0x202b30[_0x8059('0xc')](0x1f4,_0x175d57['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 2c82d95..e67527f 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 _0xadb9=['/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x39df21,_0x11b3f0){var _0x2137ac=function(_0x1a9754){while(--_0x1a9754){_0x39df21['push'](_0x39df21['shift']());}};_0x2137ac(++_0x11b3f0);}(_0xadb9,0x65));var _0x9adb=function(_0x9553a2,_0x5424d9){_0x9553a2=_0x9553a2-0x0;var _0x3e398c=_0xadb9[_0x9553a2];return _0x3e398c;};'use strict';var multer=require('multer');var util=require(_0x9adb('0x0'));var path=require(_0x9adb('0x1'));var timeout=require(_0x9adb('0x2'));var express=require(_0x9adb('0x3'));var router=express[_0x9adb('0x4')]();var fs_extra=require(_0x9adb('0x5'));var auth=require(_0x9adb('0x6'));var interaction=require(_0x9adb('0x7'));var config=require(_0x9adb('0x8'));var controller=require(_0x9adb('0x9'));router[_0x9adb('0xa')]('/',auth[_0x9adb('0xb')](),controller[_0x9adb('0xc')]);router['get'](_0x9adb('0xd'),auth[_0x9adb('0xb')](),controller['describe']);router['get'](_0x9adb('0xe'),auth['isAuthenticated'](),controller[_0x9adb('0xf')]);router[_0x9adb('0x10')]('/',auth[_0x9adb('0xb')](),controller[_0x9adb('0x11')]);router[_0x9adb('0x12')](_0x9adb('0xe'),auth[_0x9adb('0xb')](),controller[_0x9adb('0x13')]);router[_0x9adb('0x14')](_0x9adb('0xe'),auth[_0x9adb('0xb')](),controller[_0x9adb('0x15')]);module[_0x9adb('0x16')]=router; \ No newline at end of file +var _0xc9e2=['fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','index','get','/describe','describe','show','post','create','put','/:id','update','exports','multer','path','connect-timeout','express','Router'];(function(_0x42176a,_0x36762c){var _0x1ca3d3=function(_0x17dc76){while(--_0x17dc76){_0x42176a['push'](_0x42176a['shift']());}};_0x1ca3d3(++_0x36762c);}(_0xc9e2,0xe2));var _0x2c9e=function(_0x5af2ba,_0x56ada7){_0x5af2ba=_0x5af2ba-0x0;var _0xfb6b87=_0xc9e2[_0x5af2ba];return _0xfb6b87;};'use strict';var multer=require(_0x2c9e('0x0'));var util=require('util');var path=require(_0x2c9e('0x1'));var timeout=require(_0x2c9e('0x2'));var express=require(_0x2c9e('0x3'));var router=express[_0x2c9e('0x4')]();var fs_extra=require(_0x2c9e('0x5'));var auth=require(_0x2c9e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2c9e('0x7'));var controller=require(_0x2c9e('0x8'));router['get']('/',auth[_0x2c9e('0x9')](),controller[_0x2c9e('0xa')]);router[_0x2c9e('0xb')](_0x2c9e('0xc'),auth[_0x2c9e('0x9')](),controller[_0x2c9e('0xd')]);router[_0x2c9e('0xb')]('/:id',auth[_0x2c9e('0x9')](),controller[_0x2c9e('0xe')]);router[_0x2c9e('0xf')]('/',auth[_0x2c9e('0x9')](),controller[_0x2c9e('0x10')]);router[_0x2c9e('0x11')](_0x2c9e('0x12'),auth[_0x2c9e('0x9')](),controller[_0x2c9e('0x13')]);router['delete'](_0x2c9e('0x12'),auth[_0x2c9e('0x9')](),controller['destroy']);module[_0x2c9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 664703d..588004f 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 _0x2a39=['moment','ENUM','blind','STRING','Yes'];(function(_0x2c2fcc,_0xbda210){var _0x4b4516=function(_0xb93273){while(--_0xb93273){_0x2c2fcc['push'](_0x2c2fcc['shift']());}};_0x4b4516(++_0xbda210);}(_0x2a39,0x17c));var _0x92a3=function(_0x135c14,_0x41c790){_0x135c14=_0x135c14-0x0;var _0x19e640=_0x2a39[_0x135c14];return _0x19e640;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x92a3('0x0'));module['exports']={'type':{'type':Sequelize[_0x92a3('0x1')](_0x92a3('0x2'),'attended')},'result':{'type':Sequelize[_0x92a3('0x3')]},'transfererchannel':{'type':Sequelize[_0x92a3('0x3')]},'transferercalleridnum':{'type':Sequelize[_0x92a3('0x3')]},'transferercalleridname':{'type':Sequelize[_0x92a3('0x3')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x92a3('0x3')]},'transfereraccountcode':{'type':Sequelize[_0x92a3('0x3')]},'transferercontext':{'type':Sequelize[_0x92a3('0x3')]},'transfererexten':{'type':Sequelize[_0x92a3('0x3')]},'transfererlinkedid':{'type':Sequelize[_0x92a3('0x3')]},'transfereechannel':{'type':Sequelize[_0x92a3('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0x92a3('0x3')]},'transfereecalleridname':{'type':Sequelize[_0x92a3('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x92a3('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0x92a3('0x3')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x92a3('0x3')]},'transfereeexten':{'type':Sequelize[_0x92a3('0x3')]},'transfereelinkedid':{'type':Sequelize[_0x92a3('0x3')]},'isexternal':{'type':Sequelize[_0x92a3('0x1')](_0x92a3('0x4'),'No')},'context':{'type':Sequelize[_0x92a3('0x3')]},'extension':{'type':Sequelize[_0x92a3('0x3')]}}; \ No newline at end of file +var _0x1219=['ENUM','STRING','Yes','sequelize','moment','exports'];(function(_0x201ecb,_0x2cdec3){var _0x3e8a2e=function(_0x43a55d){while(--_0x43a55d){_0x201ecb['push'](_0x201ecb['shift']());}};_0x3e8a2e(++_0x2cdec3);}(_0x1219,0xa5));var _0x9121=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1219[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x9121('0x0'));var moment=require(_0x9121('0x1'));module[_0x9121('0x2')]={'type':{'type':Sequelize[_0x9121('0x3')]('blind','attended')},'result':{'type':Sequelize[_0x9121('0x4')]},'transfererchannel':{'type':Sequelize[_0x9121('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x9121('0x4')]},'transferercalleridname':{'type':Sequelize[_0x9121('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x9121('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x9121('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x9121('0x4')]},'transferercontext':{'type':Sequelize[_0x9121('0x4')]},'transfererexten':{'type':Sequelize[_0x9121('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x9121('0x4')]},'transfereechannel':{'type':Sequelize[_0x9121('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x9121('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x9121('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x9121('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x9121('0x4')]},'transfereeexten':{'type':Sequelize[_0x9121('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x9121('0x4')]},'isexternal':{'type':Sequelize['ENUM'](_0x9121('0x5'),'No')},'context':{'type':Sequelize[_0x9121('0x4')]},'extension':{'type':Sequelize[_0x9121('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 0a5dbd0..111d41b 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 _0x2dcb=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','limit','undefined','count','offset','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','stack','name','index','VoiceTransferReport','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','length','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x94d246,_0x376c5d){var _0x3214bc=function(_0x30efab){while(--_0x30efab){_0x94d246['push'](_0x94d246['shift']());}};_0x3214bc(++_0x376c5d);}(_0x2dcb,0x1cd));var _0xb2dc=function(_0x25e0f0,_0x4322e9){_0x25e0f0=_0x25e0f0-0x0;var _0xf98f1c=_0x2dcb[_0x25e0f0];return _0xf98f1c;};'use strict';var emlformat=require(_0xb2dc('0x0'));var rimraf=require(_0xb2dc('0x1'));var zipdir=require(_0xb2dc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb2dc('0x3'));var moment=require(_0xb2dc('0x4'));var BPromise=require(_0xb2dc('0x5'));var Mustache=require(_0xb2dc('0x6'));var util=require(_0xb2dc('0x7'));var path=require(_0xb2dc('0x8'));var sox=require(_0xb2dc('0x9'));var csv=require(_0xb2dc('0xa'));var ejs=require(_0xb2dc('0xb'));var fs=require('fs');var fs_extra=require(_0xb2dc('0xc'));var _=require(_0xb2dc('0xd'));var squel=require(_0xb2dc('0xe'));var crypto=require('crypto');var jsforce=require(_0xb2dc('0xf'));var deskjs=require(_0xb2dc('0x10'));var toCsv=require(_0xb2dc('0xa'));var querystring=require('querystring');var Papa=require(_0xb2dc('0x11'));var Redis=require(_0xb2dc('0x12'));var authService=require(_0xb2dc('0x13'));var qs=require(_0xb2dc('0x14'));var as=require(_0xb2dc('0x15'));var hardwareService=require(_0xb2dc('0x16'));var logger=require(_0xb2dc('0x17'))(_0xb2dc('0x18'));var utils=require(_0xb2dc('0x19'));var config=require(_0xb2dc('0x1a'));var licenseUtil=require(_0xb2dc('0x1b'));var db=require(_0xb2dc('0x1c'))['db'];function respondWithStatusCode(_0x2ed9b7,_0xf33ae3){_0xf33ae3=_0xf33ae3||0xcc;return function(_0x119ae2){if(_0x119ae2){return _0x2ed9b7['sendStatus'](_0xf33ae3);}return _0x2ed9b7[_0xb2dc('0x1d')](_0xf33ae3)[_0xb2dc('0x1e')]();};}function respondWithResult(_0x2a091b,_0x1b3940){_0x1b3940=_0x1b3940||0xc8;return function(_0x5e7f0a){if(_0x5e7f0a){return _0x2a091b[_0xb2dc('0x1d')](_0x1b3940)['json'](_0x5e7f0a);}};}function respondWithFilteredResult(_0x3f8dc3,_0x483e25){return function(_0x1fa4b3){if(_0x1fa4b3){var _0x1cef8d=typeof _0x483e25['offset']==='undefined'&&typeof _0x483e25[_0xb2dc('0x1f')]===_0xb2dc('0x20');var _0x26c7d8=_0x1fa4b3[_0xb2dc('0x21')];var _0x247960=_0x1cef8d?0x0:_0x483e25['offset'];var _0x2ec89a=_0x1cef8d?_0x1fa4b3[_0xb2dc('0x21')]:_0x483e25[_0xb2dc('0x22')]+_0x483e25[_0xb2dc('0x1f')];var _0x1e7759;if(_0x2ec89a>=_0x26c7d8){_0x2ec89a=_0x26c7d8;_0x1e7759=0xc8;}else{_0x1e7759=0xce;}_0x3f8dc3[_0xb2dc('0x1d')](_0x1e7759);return _0x3f8dc3['set'](_0xb2dc('0x23'),_0x247960+'-'+_0x2ec89a+'/'+_0x26c7d8)[_0xb2dc('0x24')](_0x1fa4b3);}return null;};}function patchUpdates(_0x1eb228){return function(_0x439797){try{jsonpatch[_0xb2dc('0x25')](_0x439797,_0x1eb228,!![]);}catch(_0x1b75d8){return BPromise[_0xb2dc('0x26')](_0x1b75d8);}return _0x439797[_0xb2dc('0x27')]();};}function saveUpdates(_0x20a238,_0x5bf7ca){return function(_0x2264a2){if(_0x2264a2){return _0x2264a2[_0xb2dc('0x28')](_0x20a238)['then'](function(_0x2183a1){return _0x2183a1;});}return null;};}function removeEntity(_0x391fcd,_0x21452b){return function(_0x5af6fa){if(_0x5af6fa){return _0x5af6fa[_0xb2dc('0x29')]()[_0xb2dc('0x2a')](function(){_0x391fcd[_0xb2dc('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fea2a,_0x5c298c){return function(_0x3c7c16){if(!_0x3c7c16){_0x4fea2a[_0xb2dc('0x2b')](0x194);}return _0x3c7c16;};}function handleError(_0x86af83,_0x2f0372){_0x2f0372=_0x2f0372||0x1f4;return function(_0x586ec9){logger['error'](_0x586ec9[_0xb2dc('0x2c')]);if(_0x586ec9[_0xb2dc('0x2d')]){delete _0x586ec9[_0xb2dc('0x2d')];}_0x86af83[_0xb2dc('0x1d')](_0x2f0372)['send'](_0x586ec9);};}exports[_0xb2dc('0x2e')]=function(_0x674c9a,_0x5f1be8){var _0x409f3a={},_0x522a91={},_0x97f8ff={'count':0x0,'rows':[]};var _0x461ca4=_['map'](db[_0xb2dc('0x2f')]['rawAttributes'],function(_0x55082b){return{'name':_0x55082b[_0xb2dc('0x30')],'type':_0x55082b[_0xb2dc('0x31')][_0xb2dc('0x32')]};});_0x522a91['model']=_['map'](_0x461ca4,_0xb2dc('0x2d'));_0x522a91[_0xb2dc('0x33')]=_[_0xb2dc('0x34')](_0x674c9a[_0xb2dc('0x33')]);_0x522a91[_0xb2dc('0x35')]=_[_0xb2dc('0x36')](_0x522a91[_0xb2dc('0x37')],_0x522a91['query']);_0x409f3a['attributes']=_['intersection'](_0x522a91[_0xb2dc('0x37')],qs[_0xb2dc('0x38')](_0x674c9a['query']['fields']));_0x409f3a[_0xb2dc('0x39')]=_0x409f3a[_0xb2dc('0x39')]['length']?_0x409f3a['attributes']:_0x522a91[_0xb2dc('0x37')];if(!_0x674c9a[_0xb2dc('0x33')][_0xb2dc('0x3a')](_0xb2dc('0x3b'))){_0x409f3a[_0xb2dc('0x1f')]=qs[_0xb2dc('0x1f')](_0x674c9a['query']['limit']);_0x409f3a[_0xb2dc('0x22')]=qs[_0xb2dc('0x22')](_0x674c9a[_0xb2dc('0x33')][_0xb2dc('0x22')]);}_0x409f3a[_0xb2dc('0x3c')]=qs['sort'](_0x674c9a[_0xb2dc('0x33')][_0xb2dc('0x3d')]);_0x409f3a[_0xb2dc('0x3e')]=qs[_0xb2dc('0x35')](_['pick'](_0x674c9a[_0xb2dc('0x33')],_0x522a91[_0xb2dc('0x35')]),_0x461ca4);if(_0x674c9a[_0xb2dc('0x33')][_0xb2dc('0x3f')]){_0x409f3a[_0xb2dc('0x3e')]=_['merge'](_0x409f3a[_0xb2dc('0x3e')],{'$or':_[_0xb2dc('0x40')](_0x461ca4,function(_0x57277d){if(_0x57277d[_0xb2dc('0x31')]!==_0xb2dc('0x41')){var _0x2fd7cb={};_0x2fd7cb[_0x57277d[_0xb2dc('0x2d')]]={'$like':'%'+_0x674c9a[_0xb2dc('0x33')][_0xb2dc('0x3f')]+'%'};return _0x2fd7cb;}})});}_0x409f3a=_[_0xb2dc('0x42')]({},_0x409f3a,_0x674c9a[_0xb2dc('0x43')]);var _0x3ff8bb={'where':_0x409f3a[_0xb2dc('0x3e')]};return db['VoiceTransferReport'][_0xb2dc('0x21')](_0x3ff8bb)['then'](function(_0x5d008d){_0x97f8ff[_0xb2dc('0x21')]=_0x5d008d;if(_0x674c9a['query'][_0xb2dc('0x44')]){_0x409f3a[_0xb2dc('0x45')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0xb2dc('0x46')](_0x409f3a);})[_0xb2dc('0x2a')](function(_0x54b7dc){_0x97f8ff['rows']=_0x54b7dc;return _0x97f8ff;})['then'](respondWithFilteredResult(_0x5f1be8,_0x409f3a))['catch'](handleError(_0x5f1be8,null));};exports['show']=function(_0x76cf4b,_0x51d3e1){var _0x345de4={'raw':!![],'where':{'id':_0x76cf4b['params']['id']}},_0x20e96f={};_0x20e96f[_0xb2dc('0x37')]=_[_0xb2dc('0x34')](db[_0xb2dc('0x2f')]['rawAttributes']);_0x20e96f[_0xb2dc('0x33')]=_[_0xb2dc('0x34')](_0x76cf4b[_0xb2dc('0x33')]);_0x20e96f[_0xb2dc('0x35')]=_[_0xb2dc('0x36')](_0x20e96f['model'],_0x20e96f['query']);_0x345de4[_0xb2dc('0x39')]=_[_0xb2dc('0x36')](_0x20e96f[_0xb2dc('0x37')],qs['fields'](_0x76cf4b[_0xb2dc('0x33')][_0xb2dc('0x38')]));_0x345de4[_0xb2dc('0x39')]=_0x345de4[_0xb2dc('0x39')][_0xb2dc('0x47')]?_0x345de4[_0xb2dc('0x39')]:_0x20e96f[_0xb2dc('0x37')];if(_0x76cf4b[_0xb2dc('0x33')]['includeAll']){_0x345de4[_0xb2dc('0x45')]=[{'all':!![]}];}_0x345de4=_['merge']({},_0x345de4,_0x76cf4b[_0xb2dc('0x43')]);return db[_0xb2dc('0x2f')][_0xb2dc('0x48')](_0x345de4)[_0xb2dc('0x2a')](handleEntityNotFound(_0x51d3e1,null))[_0xb2dc('0x2a')](respondWithResult(_0x51d3e1,null))[_0xb2dc('0x49')](handleError(_0x51d3e1,null));};exports[_0xb2dc('0x4a')]=function(_0x21426a,_0x517297){return db[_0xb2dc('0x2f')][_0xb2dc('0x4a')](_0x21426a[_0xb2dc('0x4b')],{})['then'](respondWithResult(_0x517297,0xc9))[_0xb2dc('0x49')](handleError(_0x517297,null));};exports[_0xb2dc('0x28')]=function(_0x51acb0,_0x4299a0){if(_0x51acb0[_0xb2dc('0x4b')]['id']){delete _0x51acb0[_0xb2dc('0x4b')]['id'];}return db[_0xb2dc('0x2f')][_0xb2dc('0x48')]({'where':{'id':_0x51acb0['params']['id']}})[_0xb2dc('0x2a')](handleEntityNotFound(_0x4299a0,null))[_0xb2dc('0x2a')](saveUpdates(_0x51acb0[_0xb2dc('0x4b')],null))[_0xb2dc('0x2a')](respondWithResult(_0x4299a0,null))['catch'](handleError(_0x4299a0,null));};exports[_0xb2dc('0x29')]=function(_0x50c1d7,_0x4ad2b){return db[_0xb2dc('0x2f')][_0xb2dc('0x48')]({'where':{'id':_0x50c1d7[_0xb2dc('0x4c')]['id']}})[_0xb2dc('0x2a')](handleEntityNotFound(_0x4ad2b,null))[_0xb2dc('0x2a')](removeEntity(_0x4ad2b,null))[_0xb2dc('0x49')](handleError(_0x4ad2b,null));};exports[_0xb2dc('0x4d')]=function(_0x41d85b,_0x48d611){return db[_0xb2dc('0x2f')][_0xb2dc('0x4d')]()[_0xb2dc('0x2a')](respondWithResult(_0x48d611,null))[_0xb2dc('0x49')](handleError(_0x48d611,null));}; \ No newline at end of file +var _0x88c1=['sendStatus','end','status','json','offset','limit','undefined','count','apply','reject','save','then','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','VoiceTransferReport','include','findAll','show','params','keys','includeAll','catch','create','body','update','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x88c1,0x111));var _0x188c=function(_0x4628da,_0x5064c8){_0x4628da=_0x4628da-0x0;var _0x42829e=_0x88c1[_0x4628da];return _0x42829e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x188c('0x0'));var zipdir=require(_0x188c('0x1'));var jsonpatch=require(_0x188c('0x2'));var rp=require(_0x188c('0x3'));var moment=require('moment');var BPromise=require(_0x188c('0x4'));var Mustache=require(_0x188c('0x5'));var util=require(_0x188c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x188c('0x7'));var ejs=require(_0x188c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x188c('0x9'));var squel=require(_0x188c('0xa'));var crypto=require('crypto');var jsforce=require(_0x188c('0xb'));var deskjs=require(_0x188c('0xc'));var toCsv=require(_0x188c('0x7'));var querystring=require('querystring');var Papa=require(_0x188c('0xd'));var Redis=require('ioredis');var authService=require(_0x188c('0xe'));var qs=require(_0x188c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x188c('0x10'));var logger=require(_0x188c('0x11'))(_0x188c('0x12'));var utils=require(_0x188c('0x13'));var config=require(_0x188c('0x14'));var licenseUtil=require(_0x188c('0x15'));var db=require(_0x188c('0x16'))['db'];function respondWithStatusCode(_0x16f8fa,_0x1fd076){_0x1fd076=_0x1fd076||0xcc;return function(_0x1143da){if(_0x1143da){return _0x16f8fa[_0x188c('0x17')](_0x1fd076);}return _0x16f8fa['status'](_0x1fd076)[_0x188c('0x18')]();};}function respondWithResult(_0x27e865,_0x2b432b){_0x2b432b=_0x2b432b||0xc8;return function(_0x20491e){if(_0x20491e){return _0x27e865[_0x188c('0x19')](_0x2b432b)[_0x188c('0x1a')](_0x20491e);}};}function respondWithFilteredResult(_0x29e493,_0x5f2c50){return function(_0x3b0fff){if(_0x3b0fff){var _0x35d400=typeof _0x5f2c50[_0x188c('0x1b')]==='undefined'&&typeof _0x5f2c50[_0x188c('0x1c')]===_0x188c('0x1d');var _0x275979=_0x3b0fff[_0x188c('0x1e')];var _0x116b8d=_0x35d400?0x0:_0x5f2c50[_0x188c('0x1b')];var _0x582aaf=_0x35d400?_0x3b0fff['count']:_0x5f2c50[_0x188c('0x1b')]+_0x5f2c50[_0x188c('0x1c')];var _0x51025e;if(_0x582aaf>=_0x275979){_0x582aaf=_0x275979;_0x51025e=0xc8;}else{_0x51025e=0xce;}_0x29e493[_0x188c('0x19')](_0x51025e);return _0x29e493['set']('Content-Range',_0x116b8d+'-'+_0x582aaf+'/'+_0x275979)[_0x188c('0x1a')](_0x3b0fff);}return null;};}function patchUpdates(_0x5aeb98){return function(_0x542fe5){try{jsonpatch[_0x188c('0x1f')](_0x542fe5,_0x5aeb98,!![]);}catch(_0x5cfb60){return BPromise[_0x188c('0x20')](_0x5cfb60);}return _0x542fe5[_0x188c('0x21')]();};}function saveUpdates(_0x236253,_0x4ecd07){return function(_0x2a5eed){if(_0x2a5eed){return _0x2a5eed['update'](_0x236253)['then'](function(_0x3db5be){return _0x3db5be;});}return null;};}function removeEntity(_0x19993c,_0x30750d){return function(_0x1d6c05){if(_0x1d6c05){return _0x1d6c05['destroy']()[_0x188c('0x22')](function(){_0x19993c[_0x188c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d20d2,_0x4c4087){return function(_0x573cdd){if(!_0x573cdd){_0x2d20d2[_0x188c('0x17')](0x194);}return _0x573cdd;};}function handleError(_0x5ea35d,_0x5385ae){_0x5385ae=_0x5385ae||0x1f4;return function(_0x16f7ea){logger[_0x188c('0x23')](_0x16f7ea[_0x188c('0x24')]);if(_0x16f7ea[_0x188c('0x25')]){delete _0x16f7ea['name'];}_0x5ea35d[_0x188c('0x19')](_0x5385ae)[_0x188c('0x26')](_0x16f7ea);};}exports[_0x188c('0x27')]=function(_0x2dccae,_0x3e4683){var _0x9a94a2={},_0x247151={},_0x1218e8={'count':0x0,'rows':[]};var _0x370714=_['map'](db['VoiceTransferReport'][_0x188c('0x28')],function(_0x19635c){return{'name':_0x19635c[_0x188c('0x29')],'type':_0x19635c['type'][_0x188c('0x2a')]};});_0x247151[_0x188c('0x2b')]=_[_0x188c('0x2c')](_0x370714,_0x188c('0x25'));_0x247151[_0x188c('0x2d')]=_['keys'](_0x2dccae[_0x188c('0x2d')]);_0x247151[_0x188c('0x2e')]=_[_0x188c('0x2f')](_0x247151[_0x188c('0x2b')],_0x247151[_0x188c('0x2d')]);_0x9a94a2[_0x188c('0x30')]=_[_0x188c('0x2f')](_0x247151[_0x188c('0x2b')],qs[_0x188c('0x31')](_0x2dccae['query'][_0x188c('0x31')]));_0x9a94a2[_0x188c('0x30')]=_0x9a94a2[_0x188c('0x30')][_0x188c('0x32')]?_0x9a94a2[_0x188c('0x30')]:_0x247151[_0x188c('0x2b')];if(!_0x2dccae[_0x188c('0x2d')][_0x188c('0x33')]('nolimit')){_0x9a94a2[_0x188c('0x1c')]=qs[_0x188c('0x1c')](_0x2dccae[_0x188c('0x2d')][_0x188c('0x1c')]);_0x9a94a2[_0x188c('0x1b')]=qs[_0x188c('0x1b')](_0x2dccae[_0x188c('0x2d')]['offset']);}_0x9a94a2[_0x188c('0x34')]=qs[_0x188c('0x35')](_0x2dccae[_0x188c('0x2d')][_0x188c('0x35')]);_0x9a94a2[_0x188c('0x36')]=qs['filters'](_[_0x188c('0x37')](_0x2dccae[_0x188c('0x2d')],_0x247151['filters']),_0x370714);if(_0x2dccae[_0x188c('0x2d')][_0x188c('0x38')]){_0x9a94a2['where']=_[_0x188c('0x39')](_0x9a94a2[_0x188c('0x36')],{'$or':_[_0x188c('0x2c')](_0x370714,function(_0x108957){if(_0x108957[_0x188c('0x3a')]!=='VIRTUAL'){var _0x55a66f={};_0x55a66f[_0x108957['name']]={'$like':'%'+_0x2dccae[_0x188c('0x2d')][_0x188c('0x38')]+'%'};return _0x55a66f;}})});}_0x9a94a2=_['merge']({},_0x9a94a2,_0x2dccae[_0x188c('0x3b')]);var _0x3a9179={'where':_0x9a94a2[_0x188c('0x36')]};return db[_0x188c('0x3c')][_0x188c('0x1e')](_0x3a9179)['then'](function(_0x1deb3f){_0x1218e8['count']=_0x1deb3f;if(_0x2dccae[_0x188c('0x2d')]['includeAll']){_0x9a94a2[_0x188c('0x3d')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x188c('0x3e')](_0x9a94a2);})[_0x188c('0x22')](function(_0x458640){_0x1218e8['rows']=_0x458640;return _0x1218e8;})['then'](respondWithFilteredResult(_0x3e4683,_0x9a94a2))['catch'](handleError(_0x3e4683,null));};exports[_0x188c('0x3f')]=function(_0xcdef55,_0x38d2e9){var _0x443377={'raw':!![],'where':{'id':_0xcdef55[_0x188c('0x40')]['id']}},_0x1516d4={};_0x1516d4['model']=_[_0x188c('0x41')](db[_0x188c('0x3c')][_0x188c('0x28')]);_0x1516d4[_0x188c('0x2d')]=_[_0x188c('0x41')](_0xcdef55[_0x188c('0x2d')]);_0x1516d4[_0x188c('0x2e')]=_[_0x188c('0x2f')](_0x1516d4[_0x188c('0x2b')],_0x1516d4['query']);_0x443377['attributes']=_[_0x188c('0x2f')](_0x1516d4[_0x188c('0x2b')],qs[_0x188c('0x31')](_0xcdef55[_0x188c('0x2d')]['fields']));_0x443377[_0x188c('0x30')]=_0x443377['attributes'][_0x188c('0x32')]?_0x443377[_0x188c('0x30')]:_0x1516d4[_0x188c('0x2b')];if(_0xcdef55['query'][_0x188c('0x42')]){_0x443377[_0x188c('0x3d')]=[{'all':!![]}];}_0x443377=_[_0x188c('0x39')]({},_0x443377,_0xcdef55[_0x188c('0x3b')]);return db[_0x188c('0x3c')]['find'](_0x443377)[_0x188c('0x22')](handleEntityNotFound(_0x38d2e9,null))['then'](respondWithResult(_0x38d2e9,null))[_0x188c('0x43')](handleError(_0x38d2e9,null));};exports[_0x188c('0x44')]=function(_0x1946fa,_0x32cfde){return db[_0x188c('0x3c')][_0x188c('0x44')](_0x1946fa[_0x188c('0x45')],{})['then'](respondWithResult(_0x32cfde,0xc9))[_0x188c('0x43')](handleError(_0x32cfde,null));};exports[_0x188c('0x46')]=function(_0x2ee923,_0x274fd1){if(_0x2ee923['body']['id']){delete _0x2ee923[_0x188c('0x45')]['id'];}return db['VoiceTransferReport'][_0x188c('0x47')]({'where':{'id':_0x2ee923[_0x188c('0x40')]['id']}})[_0x188c('0x22')](handleEntityNotFound(_0x274fd1,null))[_0x188c('0x22')](saveUpdates(_0x2ee923[_0x188c('0x45')],null))[_0x188c('0x22')](respondWithResult(_0x274fd1,null))[_0x188c('0x43')](handleError(_0x274fd1,null));};exports[_0x188c('0x48')]=function(_0x4d0e3e,_0x1d47f0){return db[_0x188c('0x3c')][_0x188c('0x47')]({'where':{'id':_0x4d0e3e['params']['id']}})['then'](handleEntityNotFound(_0x1d47f0,null))[_0x188c('0x22')](removeEntity(_0x1d47f0,null))[_0x188c('0x43')](handleError(_0x1d47f0,null));};exports[_0x188c('0x49')]=function(_0x4a01fe,_0x445c6f){return db[_0x188c('0x3c')][_0x188c('0x49')]()[_0x188c('0x22')](respondWithResult(_0x445c6f,null))[_0x188c('0x43')](handleError(_0x445c6f,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 023cf54..13ca167 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 _0xa0b1=['../../config/logger','api','request-promise','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util'];(function(_0x4c73ac,_0x46b73c){var _0x9839ee=function(_0x2076fb){while(--_0x2076fb){_0x4c73ac['push'](_0x4c73ac['shift']());}};_0x9839ee(++_0x46b73c);}(_0xa0b1,0x195));var _0x1a0b=function(_0x349077,_0x2eafb1){_0x349077=_0x349077-0x0;var _0x277000=_0xa0b1[_0x349077];return _0x277000;};'use strict';var _=require(_0x1a0b('0x0'));var util=require(_0x1a0b('0x1'));var logger=require(_0x1a0b('0x2'))(_0x1a0b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1a0b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1a0b('0x5'));var attributes=require(_0x1a0b('0x6'));module[_0x1a0b('0x7')]=function(_0x2a8f4d,_0x59e1d6){return _0x2a8f4d[_0x1a0b('0x8')](_0x1a0b('0x9'),attributes,{'tableName':_0x1a0b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2df1=['exports','report_call_transfer','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./voiceTransferReport.attributes'];(function(_0x229d7e,_0x5bc489){var _0xa78280=function(_0x59850e){while(--_0x59850e){_0x229d7e['push'](_0x229d7e['shift']());}};_0xa78280(++_0x5bc489);}(_0x2df1,0x1e2));var _0x12df=function(_0x5475af,_0x46cc50){_0x5475af=_0x5475af-0x0;var _0x384bb2=_0x2df1[_0x5475af];return _0x384bb2;};'use strict';var _=require('lodash');var util=require(_0x12df('0x0'));var logger=require(_0x12df('0x1'))('api');var moment=require(_0x12df('0x2'));var BPromise=require(_0x12df('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x12df('0x4'));var rimraf=require(_0x12df('0x5'));var config=require(_0x12df('0x6'));var attributes=require(_0x12df('0x7'));module[_0x12df('0x8')]=function(_0x39cc54,_0x529958){return _0x39cc54['define']('VoiceTransferReport',attributes,{'tableName':_0x12df('0x9'),'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 25af6df..b640b09 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 _0x26d2=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','debug','util'];(function(_0x2b8240,_0xf3b75a){var _0x2b06c6=function(_0x341433){while(--_0x341433){_0x2b8240['push'](_0x2b8240['shift']());}};_0x2b06c6(++_0xf3b75a);}(_0x26d2,0x10d));var _0x226d=function(_0x540dcb,_0x4eacb6){_0x540dcb=_0x540dcb-0x0;var _0x49353c=_0x26d2[_0x540dcb];return _0x49353c;};'use strict';var _=require('lodash');var util=require(_0x226d('0x0'));var moment=require(_0x226d('0x1'));var BPromise=require(_0x226d('0x2'));var rs=require(_0x226d('0x3'));var fs=require('fs');var Redis=require(_0x226d('0x4'));var db=require(_0x226d('0x5'))['db'];var utils=require(_0x226d('0x6'));var logger=require('../../config/logger')(_0x226d('0x7'));var config=require(_0x226d('0x8'));var jayson=require(_0x226d('0x9'));var client=jayson['client'][_0x226d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe39385,_0x4b4048,_0x528b09){return new BPromise(function(_0x3eb33f,_0x4e49b0){return client['request'](_0xe39385,_0x528b09)[_0x226d('0xb')](function(_0x2244f6){logger[_0x226d('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x4b4048,_0x226d('0xd'));logger['debug'](_0x226d('0xe'),_0x4b4048,_0x226d('0xd'),JSON[_0x226d('0xf')](_0x2244f6));if(_0x2244f6[_0x226d('0x10')]){if(_0x2244f6['error']['code']===0x1f4){logger[_0x226d('0x10')](_0x226d('0x11'),_0x4b4048,_0x2244f6[_0x226d('0x10')][_0x226d('0x12')]);return _0x4e49b0(_0x2244f6[_0x226d('0x10')]['message']);}logger[_0x226d('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x4b4048,_0x2244f6[_0x226d('0x10')][_0x226d('0x12')]);return _0x3eb33f(_0x2244f6[_0x226d('0x10')]['message']);}else{logger[_0x226d('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x4b4048,_0x226d('0xd'));_0x3eb33f(_0x2244f6[_0x226d('0x13')]['message']);}})[_0x226d('0x14')](function(_0x265178){logger['error'](_0x226d('0x11'),_0x4b4048,_0x265178);_0x4e49b0(_0x265178);});});}exports[_0x226d('0x15')]=function(_0x2c8a1a){var _0x2a09df=this;return new Promise(function(_0x512e18,_0x46337c){return db[_0x226d('0x16')][_0x226d('0x17')](_0x2c8a1a[_0x226d('0x18')],{'raw':_0x2c8a1a['options']?_0x2c8a1a[_0x226d('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x226d('0xb')](function(_0x1a0619){logger[_0x226d('0xc')](_0x226d('0x15'),_0x2c8a1a);logger[_0x226d('0x1a')](_0x226d('0x15'),_0x2c8a1a,JSON[_0x226d('0xf')](_0x1a0619));_0x512e18(_0x1a0619);})[_0x226d('0x14')](function(_0xea3de4){logger[_0x226d('0x10')]('CreateVoiceTransferReport',_0xea3de4[_0x226d('0x12')],_0x2c8a1a);_0x46337c(_0x2a09df[_0x226d('0x10')](0x1f4,_0xea3de4['message']));});});}; \ No newline at end of file +var _0xac5c=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateVoiceTransferReport','body','options','then','catch','lodash','util'];(function(_0x4d9d57,_0x3f6a67){var _0x3bd393=function(_0x2a8828){while(--_0x2a8828){_0x4d9d57['push'](_0x4d9d57['shift']());}};_0x3bd393(++_0x3f6a67);}(_0xac5c,0x178));var _0xcac5=function(_0x598174,_0x258e72){_0x598174=_0x598174-0x0;var _0x4e1fcf=_0xac5c[_0x598174];return _0x4e1fcf;};'use strict';var _=require(_0xcac5('0x0'));var util=require(_0xcac5('0x1'));var moment=require(_0xcac5('0x2'));var BPromise=require(_0xcac5('0x3'));var rs=require(_0xcac5('0x4'));var fs=require('fs');var Redis=require(_0xcac5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcac5('0x6'));var logger=require(_0xcac5('0x7'))(_0xcac5('0x8'));var config=require(_0xcac5('0x9'));var jayson=require(_0xcac5('0xa'));var client=jayson[_0xcac5('0xb')][_0xcac5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xe6affb,_0x4159c7,_0x1cc728){return new BPromise(function(_0x395f30,_0xd3d65c){return client['request'](_0xe6affb,_0x1cc728)['then'](function(_0x4e35c7){logger[_0xcac5('0xd')](_0xcac5('0xe'),_0x4159c7,_0xcac5('0xf'));logger[_0xcac5('0x10')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x4159c7,_0xcac5('0xf'),JSON[_0xcac5('0x11')](_0x4e35c7));if(_0x4e35c7[_0xcac5('0x12')]){if(_0x4e35c7[_0xcac5('0x12')][_0xcac5('0x13')]===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x4159c7,_0x4e35c7['error'][_0xcac5('0x14')]);return _0xd3d65c(_0x4e35c7[_0xcac5('0x12')][_0xcac5('0x14')]);}logger[_0xcac5('0x12')](_0xcac5('0xe'),_0x4159c7,_0x4e35c7[_0xcac5('0x12')][_0xcac5('0x14')]);return _0x395f30(_0x4e35c7[_0xcac5('0x12')][_0xcac5('0x14')]);}else{logger['info'](_0xcac5('0xe'),_0x4159c7,'request\x20sent');_0x395f30(_0x4e35c7[_0xcac5('0x15')][_0xcac5('0x14')]);}})['catch'](function(_0x1b5daf){logger[_0xcac5('0x12')](_0xcac5('0xe'),_0x4159c7,_0x1b5daf);_0xd3d65c(_0x1b5daf);});});}exports[_0xcac5('0x16')]=function(_0x59f410){var _0x40f5d3=this;return new Promise(function(_0x2f65cb,_0x2ac3ee){return db['VoiceTransferReport']['create'](_0x59f410[_0xcac5('0x17')],{'raw':_0x59f410[_0xcac5('0x18')]?_0x59f410[_0xcac5('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xcac5('0x19')](function(_0x57b156){logger[_0xcac5('0xd')](_0xcac5('0x16'),_0x59f410);logger[_0xcac5('0x10')]('CreateVoiceTransferReport',_0x59f410,JSON[_0xcac5('0x11')](_0x57b156));_0x2f65cb(_0x57b156);})[_0xcac5('0x1a')](function(_0xcf8c18){logger[_0xcac5('0x12')](_0xcac5('0x16'),_0xcf8c18[_0xcac5('0x14')],_0x59f410);_0x2ac3ee(_0x40f5d3[_0xcac5('0x12')](0x1f4,_0xcf8c18[_0xcac5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 271e8c8..7ad40b6 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 _0xdf8e=['hangup','/answer','answer','/hold','hold','/unhold','unhold','/calls','/transfer','exports','express','../../components/auth/service','./webbar.controller','post','/originate','originate','/hangup','isAuthenticated','canUpdate'];(function(_0x271e42,_0x4650af){var _0x2b0193=function(_0x2577bc){while(--_0x2577bc){_0x271e42['push'](_0x271e42['shift']());}};_0x2b0193(++_0x4650af);}(_0xdf8e,0x101));var _0xedf8=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xdf8e[_0x502c7d];return _0x30b7ed;};'use strict';var express=require(_0xedf8('0x0'));var router=express['Router']();var auth=require(_0xedf8('0x1'));var controller=require(_0xedf8('0x2'));router[_0xedf8('0x3')](_0xedf8('0x4'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xedf8('0x5')]);router[_0xedf8('0x3')](_0xedf8('0x6'),auth[_0xedf8('0x7')](),auth[_0xedf8('0x8')](),controller[_0xedf8('0x9')]);router['post'](_0xedf8('0xa'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xedf8('0xb')]);router['post'](_0xedf8('0xc'),auth['isAuthenticated'](),auth[_0xedf8('0x8')](),controller[_0xedf8('0xd')]);router[_0xedf8('0x3')](_0xedf8('0xe'),auth[_0xedf8('0x7')](),auth['canUpdate'](),controller[_0xedf8('0xf')]);router['post'](_0xedf8('0x10'),auth[_0xedf8('0x7')](),auth[_0xedf8('0x8')](),controller['calls']);router['post'](_0xedf8('0x11'),auth[_0xedf8('0x7')](),auth['canUpdate'](),controller['transfer']);module[_0xedf8('0x12')]=router; \ No newline at end of file +var _0xcaee=['/calls','calls','/transfer','transfer','express','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','canUpdate','originate','post','hangup','/answer','answer','hold','/unhold','unhold'];(function(_0x51edca,_0x18ad70){var _0x2b77ec=function(_0x55a549){while(--_0x55a549){_0x51edca['push'](_0x51edca['shift']());}};_0x2b77ec(++_0x18ad70);}(_0xcaee,0xee));var _0xecae=function(_0x2f4112,_0x4a2758){_0x2f4112=_0x2f4112-0x0;var _0x12d4a0=_0xcaee[_0x2f4112];return _0x12d4a0;};'use strict';var express=require(_0xecae('0x0'));var router=express['Router']();var auth=require(_0xecae('0x1'));var controller=require(_0xecae('0x2'));router['post'](_0xecae('0x3'),auth[_0xecae('0x4')](),auth[_0xecae('0x5')](),controller[_0xecae('0x6')]);router[_0xecae('0x7')]('/hangup',auth['isAuthenticated'](),auth[_0xecae('0x5')](),controller[_0xecae('0x8')]);router[_0xecae('0x7')](_0xecae('0x9'),auth[_0xecae('0x4')](),auth['canUpdate'](),controller[_0xecae('0xa')]);router[_0xecae('0x7')]('/hold',auth[_0xecae('0x4')](),auth[_0xecae('0x5')](),controller[_0xecae('0xb')]);router[_0xecae('0x7')](_0xecae('0xc'),auth[_0xecae('0x4')](),auth['canUpdate'](),controller[_0xecae('0xd')]);router[_0xecae('0x7')](_0xecae('0xe'),auth[_0xecae('0x4')](),auth['canUpdate'](),controller[_0xecae('0xf')]);router[_0xecae('0x7')](_0xecae('0x10'),auth[_0xecae('0x4')](),auth[_0xecae('0x5')](),controller[_0xecae('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index b8761cc..735063e 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 _0xb0b9=['User','agent','VoiceChannels','all','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate','body','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','hangup','hangup\x20fired:','validate','webbar:hangup','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','webbar:unhold','calls','calls\x20fired:','filter','webbar:conference','conference\x20executed!','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','name','status','NotFound','then','code','message','catch'];(function(_0x1aef75,_0x4a570a){var _0x6b77c0=function(_0x50db3e){while(--_0x50db3e){_0x1aef75['push'](_0x1aef75['shift']());}};_0x6b77c0(++_0x4a570a);}(_0xb0b9,0x1f3));var _0x9b0b=function(_0x3d1b69,_0x3a8098){_0x3d1b69=_0x3d1b69-0x0;var _0x2e493f=_0xb0b9[_0x3d1b69];return _0x2e493f;};'use strict';var path=require(_0x9b0b('0x0'));var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require(_0x9b0b('0x1'));var util=require(_0x9b0b('0x2'));var BPromise=require(_0x9b0b('0x3'));var jayson=require(_0x9b0b('0x4'));var amiClient=jayson[_0x9b0b('0x5')][_0x9b0b('0x6')]({'port':0x232a});var logger=require(_0x9b0b('0x7'))(_0x9b0b('0x8'));var Redis=require(_0x9b0b('0x9'));config[_0x9b0b('0xa')]=_[_0x9b0b('0xb')](config[_0x9b0b('0xa')],{'host':_0x9b0b('0xc'),'port':0x18eb});var io=require(_0x9b0b('0xd'))(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x9b0b('0xe'),'required':[!![],_0x9b0b('0xf')]},'callNumber':{'type':_0x9b0b('0x10'),'required':[!![],_0x9b0b('0x11')]},'callerId':{'type':_0x9b0b('0x10')},'callbackUrl':{'type':_0x9b0b('0x10')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x9b0b('0xf')]},'sessionId':{'type':_0x9b0b('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x9b0b('0xe'),'required':[!![],_0x9b0b('0xf')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x9b0b('0xf')]},'sessionId':{'type':'string','required':[!![],_0x9b0b('0x12')]},'transferNumber':{'type':'string','required':[!![],_0x9b0b('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0x9b0b('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x9b0b('0xe'),'required':[!![],_0x9b0b('0xf')]},'sessionId':{'type':_0x9b0b('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x9b0b('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x9b0b('0xe'),'required':[!![],_0x9b0b('0xf')]}});function emit(_0x1e92c1,_0x4665d8,_0x12f1b9){logger[_0x9b0b('0x14')](_0x1e92c1,_0x4665d8,JSON[_0x9b0b('0x15')](_0x12f1b9));io['to'](_0x1e92c1)[_0x9b0b('0x16')](_0x4665d8,_0x12f1b9);}function handleError(_0xcab079){return function(_0x264b6d){console[_0x9b0b('0x17')](_0x9b0b('0x18'),_0x264b6d,_0x264b6d instanceof RangeError);logger[_0x9b0b('0x19')](_0x264b6d['stack']);if(_0x264b6d instanceof RangeError){if(_0x264b6d[_0x9b0b('0x1a')]){delete _0x264b6d[_0x9b0b('0x1a')];}_0xcab079[_0x9b0b('0x1b')](0x194)['send'](_0x264b6d);}else{if(_0x264b6d[_0x9b0b('0x1a')]){delete _0x264b6d[_0x9b0b('0x1a')];}_0xcab079[_0x9b0b('0x1b')](0x1f4)['send'](_0x264b6d);}};}function checkError(){return function(_0x3f19ae){if(!_0x3f19ae){throw new RangeError(_0x9b0b('0x1c'));}return _0x3f19ae;};}function respondWithRpcPromise(_0x27b8e3,_0x16c8f9){return new BPromise(function(_0x4fe0a2,_0x30bfe8){var _0x408f70=amiClient;return _0x408f70['request'](_0x27b8e3,_0x16c8f9)[_0x9b0b('0x1d')](function(_0x1e7789){if(_0x1e7789[_0x9b0b('0x19')]){if(_0x1e7789[_0x9b0b('0x19')][_0x9b0b('0x1e')]===0x1f4){return _0x30bfe8(_0x1e7789[_0x9b0b('0x19')][_0x9b0b('0x1f')]);}return _0x4fe0a2(_0x1e7789[_0x9b0b('0x19')][_0x9b0b('0x1f')]);}else{_0x4fe0a2(_0x1e7789['result']);}})[_0x9b0b('0x20')](function(_0x22a136){_0x30bfe8(_0x22a136);});});}function getAgent(_0x246652){return db[_0x9b0b('0x21')]['findOne']({'where':{'id':_0x246652,'role':_0x9b0b('0x22')}})[_0x9b0b('0x1d')](checkError());}function getAgentCheckSession(_0x5c9ec3,_0x2841fc){return new BPromise(function(_0x1e25fb,_0x1a31ba){var _0x47a135=respondWithRpcPromise(_0x9b0b('0x23'));var _0xa4f392=getAgent(_0x5c9ec3);Promise[_0x9b0b('0x24')]([_0x47a135,_0xa4f392])['then'](function(_0x2575d8){var _0x32668d=_0x2575d8[0x0];var _0x21b533=_0x2575d8[0x1];var _0x22ce12=_['filter'](_0x32668d[_0x9b0b('0x25')],function(_0xfa71df){return _0xfa71df['UserId']==_0x21b533['id']&&_0xfa71df[_0x9b0b('0x26')]==_0x2841fc;});if(_0x22ce12[_0x9b0b('0x27')]==0x1){_0x1e25fb(_0x21b533);}else{_0x1a31ba(new RangeError(_0x9b0b('0x28')+_0x2841fc+_0x9b0b('0x29')));}});});}exports[_0x9b0b('0x2a')]=function(_0x26e90c,_0xfd6ce){logger[_0x9b0b('0x14')]('originate\x20fired:',_0x26e90c['body']);var _0x3fcf01=originateValidation['validate'](_0x26e90c[_0x9b0b('0x2b')]);if(_0x3fcf01['length']>0x0){return _0xfd6ce['status'](0x190)['json'](_0x3fcf01);}var _0x40e4c3=_0x26e90c[_0x9b0b('0x2b')][_0x9b0b('0x2c')];var _0x212b85=_0x26e90c[_0x9b0b('0x2b')][_0x9b0b('0x2d')];var _0x2938ff=_0x26e90c[_0x9b0b('0x2b')][_0x9b0b('0x2e')];var _0x444d20=_0x26e90c[_0x9b0b('0x2b')][_0x9b0b('0x2f')];return getAgent(_0x40e4c3)[_0x9b0b('0x1d')](function(_0x5dc1a6){logger[_0x9b0b('0x14')](_0x9b0b('0x30'),_0x5dc1a6[_0x9b0b('0x1a')]);emit(util[_0x9b0b('0x31')](_0x9b0b('0x32'),_0x5dc1a6[_0x9b0b('0x1a')]),_0x9b0b('0x33'),{'callNumber':_0x212b85,'callerId':_0x2938ff,'callbackUrl':_0x444d20});return _0xfd6ce[_0x9b0b('0x1b')](0xc8)[_0x9b0b('0x34')]({'error':![],'message':_0x9b0b('0x35')});})[_0x9b0b('0x20')](handleError(_0xfd6ce));};exports[_0x9b0b('0x36')]=function(_0x97d73a,_0x561942){logger['info'](_0x9b0b('0x37'),_0x97d73a[_0x9b0b('0x2b')]);var _0xe60dec=hangupValidation[_0x9b0b('0x38')](_0x97d73a[_0x9b0b('0x2b')]);if(_0xe60dec['length']>0x0){return _0x561942[_0x9b0b('0x1b')](0x190)[_0x9b0b('0x34')](_0xe60dec);}var _0x24cee7=_0x97d73a[_0x9b0b('0x2b')]['userId'];var _0x5ac75f=_0x97d73a[_0x9b0b('0x2b')]['sessionId'];return getAgent(_0x24cee7)[_0x9b0b('0x1d')](function(_0x316d86){logger[_0x9b0b('0x14')](_0x9b0b('0x30'),_0x316d86[_0x9b0b('0x1a')]);emit(util[_0x9b0b('0x31')](_0x9b0b('0x32'),_0x316d86[_0x9b0b('0x1a')]),_0x9b0b('0x39'),{'sessionId':_0x5ac75f});return _0x561942[_0x9b0b('0x1b')](0xc8)[_0x9b0b('0x34')]({'error':![],'message':_0x9b0b('0x3a')});})[_0x9b0b('0x20')](handleError(_0x561942));};exports[_0x9b0b('0x3b')]=function(_0xef0a28,_0x58d181){logger['info']('answer\x20fired:',_0xef0a28[_0x9b0b('0x2b')]);var _0x42d7e3=answerValidation[_0x9b0b('0x38')](_0xef0a28[_0x9b0b('0x2b')]);if(_0x42d7e3[_0x9b0b('0x27')]>0x0){return _0x58d181['status'](0x190)['json'](_0x42d7e3);}var _0x20ec55=_0xef0a28[_0x9b0b('0x2b')][_0x9b0b('0x2c')];var _0x136a33=_0xef0a28['body'][_0x9b0b('0x26')];return getAgent(_0x20ec55)[_0x9b0b('0x1d')](function(_0x177cde){logger[_0x9b0b('0x14')](_0x9b0b('0x30'),_0x177cde['name']);emit(util[_0x9b0b('0x31')](_0x9b0b('0x32'),_0x177cde[_0x9b0b('0x1a')]),_0x9b0b('0x3c'),{'sessionId':_0x136a33});return _0x58d181[_0x9b0b('0x1b')](0xc8)[_0x9b0b('0x34')]({'error':![],'message':_0x9b0b('0x3d')});})[_0x9b0b('0x20')](handleError(_0x58d181));};exports['hold']=function(_0x512ecc,_0x5bfa12){logger[_0x9b0b('0x14')](_0x9b0b('0x3e'),_0x512ecc[_0x9b0b('0x2b')]);var _0x25ed06=holdValidation[_0x9b0b('0x38')](_0x512ecc[_0x9b0b('0x2b')]);if(_0x25ed06[_0x9b0b('0x27')]>0x0){return _0x5bfa12[_0x9b0b('0x1b')](0x190)[_0x9b0b('0x34')](_0x25ed06);}var _0x1f2108=_0x512ecc[_0x9b0b('0x2b')]['userId'];var _0x3b15b3=_0x512ecc[_0x9b0b('0x2b')]['sessionId'];return getAgent(_0x1f2108)['then'](function(_0xd9410f){logger[_0x9b0b('0x14')](_0x9b0b('0x30'),_0xd9410f[_0x9b0b('0x1a')]);emit(util['format'](_0x9b0b('0x32'),_0xd9410f[_0x9b0b('0x1a')]),_0x9b0b('0x3f'),{'sessionId':_0x3b15b3});return _0x5bfa12[_0x9b0b('0x1b')](0xc8)[_0x9b0b('0x34')]({'error':![],'message':_0x9b0b('0x40')});})[_0x9b0b('0x20')](handleError(_0x5bfa12));};exports[_0x9b0b('0x41')]=function(_0x146654,_0x5d71d7){logger[_0x9b0b('0x14')]('unhold\x20fired:',_0x146654[_0x9b0b('0x2b')]);var _0x5eb636=unholdValidation['validate'](_0x146654[_0x9b0b('0x2b')]);if(_0x5eb636[_0x9b0b('0x27')]>0x0){return _0x5d71d7[_0x9b0b('0x1b')](0x190)[_0x9b0b('0x34')](_0x5eb636);}var _0x105503=_0x146654[_0x9b0b('0x2b')][_0x9b0b('0x2c')];var _0x495b3e=_0x146654['body']['sessionId'];return getAgent(_0x105503)[_0x9b0b('0x1d')](function(_0x250b06){logger[_0x9b0b('0x14')](_0x9b0b('0x30'),_0x250b06[_0x9b0b('0x1a')]);emit(util[_0x9b0b('0x31')]('user:%s',_0x250b06[_0x9b0b('0x1a')]),_0x9b0b('0x42'),{'sessionId':_0x495b3e});return _0x5d71d7['status'](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0x9b0b('0x20')](handleError(_0x5d71d7));};exports[_0x9b0b('0x43')]=function(_0x5156c1,_0x51ea1d){logger['info'](_0x9b0b('0x44'),_0x51ea1d[_0x9b0b('0x2b')]);var _0x23225c=callsValidation[_0x9b0b('0x38')](_0x5156c1[_0x9b0b('0x2b')]);if(_0x23225c[_0x9b0b('0x27')]>0x0){return _0x51ea1d[_0x9b0b('0x1b')](0x190)[_0x9b0b('0x34')](_0x23225c);}var _0x283f31=_0x5156c1[_0x9b0b('0x2b')][_0x9b0b('0x2c')];var _0x4a2fbd=respondWithRpcPromise(_0x9b0b('0x23'));var _0x21f650=getAgent(_0x283f31);return Promise['all']([_0x4a2fbd,_0x21f650])[_0x9b0b('0x1d')](function(_0x30a39d){var _0x49ca3a=_0x30a39d[0x0];var _0x2a92b9=_0x30a39d[0x1];var _0x16f879=_[_0x9b0b('0x45')](_0x49ca3a[_0x9b0b('0x25')],function(_0x45b272){return _0x45b272['UserId']==_0x2a92b9['id'];});return _0x51ea1d[_0x9b0b('0x1b')](0xc8)[_0x9b0b('0x34')]({'count':_0x16f879[_0x9b0b('0x27')],'rows':_0x16f879});})[_0x9b0b('0x20')](handleError(_0x51ea1d));};exports['conference']=function(_0x4928b1,_0x25553d){logger[_0x9b0b('0x14')]('conference\x20fired:',_0x4928b1['body']);var _0x3a599d=conferenceValidation[_0x9b0b('0x38')](_0x4928b1[_0x9b0b('0x2b')]);if(_0x3a599d[_0x9b0b('0x27')]>0x0){return _0x25553d[_0x9b0b('0x1b')](0x190)[_0x9b0b('0x34')](_0x3a599d);}var _0xc935e1=_0x4928b1[_0x9b0b('0x2b')]['userId'];return getAgent(_0xc935e1)[_0x9b0b('0x1d')](function(_0x38ff6d){logger[_0x9b0b('0x14')](_0x9b0b('0x30'),_0x38ff6d['name']);emit(util[_0x9b0b('0x31')]('user:%s',_0x38ff6d[_0x9b0b('0x1a')]),_0x9b0b('0x46'));return _0x25553d[_0x9b0b('0x1b')](0xc8)[_0x9b0b('0x34')]({'error':![],'message':_0x9b0b('0x47')});})['catch'](handleError(_0x25553d));};exports[_0x9b0b('0x48')]=function(_0x3804e6,_0x4337c3){logger[_0x9b0b('0x14')]('transfer\x20fired:',_0x3804e6[_0x9b0b('0x2b')]);var _0x259340=transferValidation[_0x9b0b('0x38')](_0x3804e6[_0x9b0b('0x2b')]);if(_0x259340[_0x9b0b('0x27')]>0x0){return _0x4337c3['status'](0x190)[_0x9b0b('0x34')](_0x259340);}var _0x667604=_0x3804e6['body'][_0x9b0b('0x2c')];var _0x246056=_0x3804e6[_0x9b0b('0x2b')][_0x9b0b('0x26')];var _0x3b69a4=_0x3804e6[_0x9b0b('0x2b')][_0x9b0b('0x49')];return getAgent(_0x667604)[_0x9b0b('0x1d')](function(_0x1c0192){logger[_0x9b0b('0x14')](_0x9b0b('0x30'),_0x1c0192[_0x9b0b('0x1a')]);emit(util[_0x9b0b('0x31')]('user:%s',_0x1c0192[_0x9b0b('0x1a')]),_0x9b0b('0x4a'),{'sessionId':_0x246056,'transferNumber':_0x3b69a4});return _0x4337c3['status'](0xc8)['json']({'error':![],'message':_0x9b0b('0x4b')});})['catch'](handleError(_0x4337c3));}; \ No newline at end of file +var _0x131e=['error','stack','name','status','send','NotFound','request','then','code','message','User','findOne','VoiceChannels','all','rows','UserId','length','\x20not\x20found!','originate','originate\x20fired:','body','validate','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','webbar:originate','originate\x20executed!','catch','user:%s','hangup\x20executed!','answer','answer\x20fired:','sessionId','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','filter','conference','conference\x20fired:','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','../../config/environment','util','bluebird','jayson/promise','client','http','webbarapi','ioredis','redis','defaults','number','userId\x20is\x20required','callNumber\x20is\x20required','string','transferNumber\x20is\x20required','info','stringify','log','handleError:'];(function(_0x25873e,_0x3771d5){var _0x348a49=function(_0x36605f){while(--_0x36605f){_0x25873e['push'](_0x25873e['shift']());}};_0x348a49(++_0x3771d5);}(_0x131e,0x1ec));var _0xe131=function(_0x847067,_0x2a2002){_0x847067=_0x847067-0x0;var _0x19c4ba=_0x131e[_0x847067];return _0x19c4ba;};'use strict';var path=require('path');var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require(_0xe131('0x0'));var util=require(_0xe131('0x1'));var BPromise=require(_0xe131('0x2'));var jayson=require(_0xe131('0x3'));var amiClient=jayson[_0xe131('0x4')][_0xe131('0x5')]({'port':0x232a});var logger=require('../../config/logger')(_0xe131('0x6'));var Redis=require(_0xe131('0x7'));config[_0xe131('0x8')]=_[_0xe131('0x9')](config[_0xe131('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xe131('0xa'),'required':[!![],_0xe131('0xb')]},'callNumber':{'type':'string','required':[!![],_0xe131('0xc')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xe131('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0xe131('0xa'),'required':[!![],_0xe131('0xb')]},'sessionId':{'type':_0xe131('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xe131('0xa'),'required':[!![],_0xe131('0xb')]},'sessionId':{'type':_0xe131('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xe131('0xd'),'required':[!![],_0xe131('0xe')]}});var holdValidation=new Schema({'userId':{'type':_0xe131('0xa'),'required':[!![],_0xe131('0xb')]},'sessionId':{'type':_0xe131('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xe131('0xa'),'required':[!![],_0xe131('0xb')]},'sessionId':{'type':_0xe131('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xe131('0xa'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0x5a6ca9,_0x4987dc,_0x2628e7){logger[_0xe131('0xf')](_0x5a6ca9,_0x4987dc,JSON[_0xe131('0x10')](_0x2628e7));io['to'](_0x5a6ca9)['emit'](_0x4987dc,_0x2628e7);}function handleError(_0x503e86){return function(_0x400f6b){console[_0xe131('0x11')](_0xe131('0x12'),_0x400f6b,_0x400f6b instanceof RangeError);logger[_0xe131('0x13')](_0x400f6b[_0xe131('0x14')]);if(_0x400f6b instanceof RangeError){if(_0x400f6b[_0xe131('0x15')]){delete _0x400f6b['name'];}_0x503e86[_0xe131('0x16')](0x194)[_0xe131('0x17')](_0x400f6b);}else{if(_0x400f6b[_0xe131('0x15')]){delete _0x400f6b[_0xe131('0x15')];}_0x503e86[_0xe131('0x16')](0x1f4)['send'](_0x400f6b);}};}function checkError(){return function(_0x4c24e5){if(!_0x4c24e5){throw new RangeError(_0xe131('0x18'));}return _0x4c24e5;};}function respondWithRpcPromise(_0x41c4e1,_0x5207c6){return new BPromise(function(_0x42df0a,_0x55b0c5){var _0x49f304=amiClient;return _0x49f304[_0xe131('0x19')](_0x41c4e1,_0x5207c6)[_0xe131('0x1a')](function(_0x473bb4){if(_0x473bb4[_0xe131('0x13')]){if(_0x473bb4[_0xe131('0x13')][_0xe131('0x1b')]===0x1f4){return _0x55b0c5(_0x473bb4[_0xe131('0x13')]['message']);}return _0x42df0a(_0x473bb4[_0xe131('0x13')][_0xe131('0x1c')]);}else{_0x42df0a(_0x473bb4['result']);}})['catch'](function(_0x330638){_0x55b0c5(_0x330638);});});}function getAgent(_0x5b2f47){return db[_0xe131('0x1d')][_0xe131('0x1e')]({'where':{'id':_0x5b2f47,'role':'agent'}})[_0xe131('0x1a')](checkError());}function getAgentCheckSession(_0x3959ac,_0x41a3e9){return new BPromise(function(_0x499ca8,_0x29243d){var _0x442279=respondWithRpcPromise(_0xe131('0x1f'));var _0x10d504=getAgent(_0x3959ac);Promise[_0xe131('0x20')]([_0x442279,_0x10d504])[_0xe131('0x1a')](function(_0x1ff557){var _0x3414f1=_0x1ff557[0x0];var _0x9f8c66=_0x1ff557[0x1];var _0x341294=_['filter'](_0x3414f1[_0xe131('0x21')],function(_0x554b62){return _0x554b62[_0xe131('0x22')]==_0x9f8c66['id']&&_0x554b62['sessionId']==_0x41a3e9;});if(_0x341294[_0xe131('0x23')]==0x1){_0x499ca8(_0x9f8c66);}else{_0x29243d(new RangeError('sessionId\x20'+_0x41a3e9+_0xe131('0x24')));}});});}exports[_0xe131('0x25')]=function(_0x306082,_0x481e50){logger['info'](_0xe131('0x26'),_0x306082[_0xe131('0x27')]);var _0x11f163=originateValidation[_0xe131('0x28')](_0x306082[_0xe131('0x27')]);if(_0x11f163[_0xe131('0x23')]>0x0){return _0x481e50[_0xe131('0x16')](0x190)[_0xe131('0x29')](_0x11f163);}var _0x5347ee=_0x306082['body'][_0xe131('0x2a')];var _0x6c7586=_0x306082[_0xe131('0x27')][_0xe131('0x2b')];var _0x2c17f6=_0x306082[_0xe131('0x27')][_0xe131('0x2c')];var _0x4d2327=_0x306082['body'][_0xe131('0x2d')];return getAgent(_0x5347ee)['then'](function(_0x26bf39){logger['info'](_0xe131('0x2e'),_0x26bf39['name']);emit(util[_0xe131('0x2f')]('user:%s',_0x26bf39[_0xe131('0x15')]),_0xe131('0x30'),{'callNumber':_0x6c7586,'callerId':_0x2c17f6,'callbackUrl':_0x4d2327});return _0x481e50[_0xe131('0x16')](0xc8)[_0xe131('0x29')]({'error':![],'message':_0xe131('0x31')});})[_0xe131('0x32')](handleError(_0x481e50));};exports['hangup']=function(_0x2ecc0c,_0x4dafaf){logger[_0xe131('0xf')]('hangup\x20fired:',_0x2ecc0c[_0xe131('0x27')]);var _0x26a679=hangupValidation[_0xe131('0x28')](_0x2ecc0c[_0xe131('0x27')]);if(_0x26a679[_0xe131('0x23')]>0x0){return _0x4dafaf[_0xe131('0x16')](0x190)[_0xe131('0x29')](_0x26a679);}var _0x5a5498=_0x2ecc0c[_0xe131('0x27')]['userId'];var _0x1103fc=_0x2ecc0c[_0xe131('0x27')]['sessionId'];return getAgent(_0x5a5498)['then'](function(_0x205fa2){logger['info']('entityFound:',_0x205fa2[_0xe131('0x15')]);emit(util['format'](_0xe131('0x33'),_0x205fa2[_0xe131('0x15')]),'webbar:hangup',{'sessionId':_0x1103fc});return _0x4dafaf[_0xe131('0x16')](0xc8)[_0xe131('0x29')]({'error':![],'message':_0xe131('0x34')});})[_0xe131('0x32')](handleError(_0x4dafaf));};exports[_0xe131('0x35')]=function(_0x4985d9,_0x512409){logger[_0xe131('0xf')](_0xe131('0x36'),_0x4985d9[_0xe131('0x27')]);var _0x58fe5c=answerValidation[_0xe131('0x28')](_0x4985d9[_0xe131('0x27')]);if(_0x58fe5c[_0xe131('0x23')]>0x0){return _0x512409['status'](0x190)[_0xe131('0x29')](_0x58fe5c);}var _0x1c9c6d=_0x4985d9[_0xe131('0x27')]['userId'];var _0x1da932=_0x4985d9[_0xe131('0x27')][_0xe131('0x37')];return getAgent(_0x1c9c6d)['then'](function(_0x1663a9){logger[_0xe131('0xf')](_0xe131('0x2e'),_0x1663a9[_0xe131('0x15')]);emit(util[_0xe131('0x2f')](_0xe131('0x33'),_0x1663a9[_0xe131('0x15')]),'webbar:answer',{'sessionId':_0x1da932});return _0x512409['status'](0xc8)[_0xe131('0x29')]({'error':![],'message':_0xe131('0x38')});})[_0xe131('0x32')](handleError(_0x512409));};exports[_0xe131('0x39')]=function(_0xb1c607,_0x402767){logger['info'](_0xe131('0x3a'),_0xb1c607[_0xe131('0x27')]);var _0x268cc6=holdValidation[_0xe131('0x28')](_0xb1c607[_0xe131('0x27')]);if(_0x268cc6[_0xe131('0x23')]>0x0){return _0x402767['status'](0x190)[_0xe131('0x29')](_0x268cc6);}var _0x1ce9b7=_0xb1c607[_0xe131('0x27')][_0xe131('0x2a')];var _0x1a9e5c=_0xb1c607[_0xe131('0x27')][_0xe131('0x37')];return getAgent(_0x1ce9b7)[_0xe131('0x1a')](function(_0x3d7ae8){logger[_0xe131('0xf')](_0xe131('0x2e'),_0x3d7ae8['name']);emit(util[_0xe131('0x2f')]('user:%s',_0x3d7ae8['name']),_0xe131('0x3b'),{'sessionId':_0x1a9e5c});return _0x402767[_0xe131('0x16')](0xc8)[_0xe131('0x29')]({'error':![],'message':_0xe131('0x3c')});})[_0xe131('0x32')](handleError(_0x402767));};exports[_0xe131('0x3d')]=function(_0xf4dbe4,_0x398c39){logger[_0xe131('0xf')](_0xe131('0x3e'),_0xf4dbe4[_0xe131('0x27')]);var _0x509992=unholdValidation['validate'](_0xf4dbe4[_0xe131('0x27')]);if(_0x509992[_0xe131('0x23')]>0x0){return _0x398c39['status'](0x190)['json'](_0x509992);}var _0x2b934b=_0xf4dbe4['body']['userId'];var _0xe0d786=_0xf4dbe4[_0xe131('0x27')][_0xe131('0x37')];return getAgent(_0x2b934b)[_0xe131('0x1a')](function(_0x3d6f45){logger[_0xe131('0xf')]('entityFound:',_0x3d6f45['name']);emit(util[_0xe131('0x2f')](_0xe131('0x33'),_0x3d6f45['name']),_0xe131('0x3f'),{'sessionId':_0xe0d786});return _0x398c39[_0xe131('0x16')](0xc8)[_0xe131('0x29')]({'error':![],'message':_0xe131('0x40')});})[_0xe131('0x32')](handleError(_0x398c39));};exports[_0xe131('0x41')]=function(_0x4a9ad6,_0x23d880){logger['info']('calls\x20fired:',_0x23d880[_0xe131('0x27')]);var _0x3ff68b=callsValidation['validate'](_0x4a9ad6['body']);if(_0x3ff68b[_0xe131('0x23')]>0x0){return _0x23d880[_0xe131('0x16')](0x190)[_0xe131('0x29')](_0x3ff68b);}var _0x51628f=_0x4a9ad6[_0xe131('0x27')][_0xe131('0x2a')];var _0x45d00d=respondWithRpcPromise(_0xe131('0x1f'));var _0x2a65fd=getAgent(_0x51628f);return Promise['all']([_0x45d00d,_0x2a65fd])[_0xe131('0x1a')](function(_0x5185dd){var _0x4347f0=_0x5185dd[0x0];var _0x45ac9c=_0x5185dd[0x1];var _0xc398e5=_[_0xe131('0x42')](_0x4347f0['rows'],function(_0x498fe0){return _0x498fe0['UserId']==_0x45ac9c['id'];});return _0x23d880[_0xe131('0x16')](0xc8)['json']({'count':_0xc398e5[_0xe131('0x23')],'rows':_0xc398e5});})[_0xe131('0x32')](handleError(_0x23d880));};exports[_0xe131('0x43')]=function(_0x160f60,_0x61ea25){logger[_0xe131('0xf')](_0xe131('0x44'),_0x160f60[_0xe131('0x27')]);var _0x1e388e=conferenceValidation[_0xe131('0x28')](_0x160f60['body']);if(_0x1e388e['length']>0x0){return _0x61ea25['status'](0x190)[_0xe131('0x29')](_0x1e388e);}var _0x41932a=_0x160f60[_0xe131('0x27')][_0xe131('0x2a')];return getAgent(_0x41932a)['then'](function(_0x11e2c9){logger[_0xe131('0xf')](_0xe131('0x2e'),_0x11e2c9[_0xe131('0x15')]);emit(util[_0xe131('0x2f')](_0xe131('0x33'),_0x11e2c9['name']),'webbar:conference');return _0x61ea25[_0xe131('0x16')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x61ea25));};exports[_0xe131('0x45')]=function(_0x4edb0f,_0x2e6f99){logger['info'](_0xe131('0x46'),_0x4edb0f[_0xe131('0x27')]);var _0x2b6cdc=transferValidation[_0xe131('0x28')](_0x4edb0f['body']);if(_0x2b6cdc[_0xe131('0x23')]>0x0){return _0x2e6f99[_0xe131('0x16')](0x190)[_0xe131('0x29')](_0x2b6cdc);}var _0x3c1fe4=_0x4edb0f[_0xe131('0x27')][_0xe131('0x2a')];var _0x497b76=_0x4edb0f[_0xe131('0x27')][_0xe131('0x37')];var _0x4f3b0d=_0x4edb0f[_0xe131('0x27')]['transferNumber'];return getAgent(_0x3c1fe4)['then'](function(_0x6794a){logger['info'](_0xe131('0x2e'),_0x6794a[_0xe131('0x15')]);emit(util[_0xe131('0x2f')]('user:%s',_0x6794a[_0xe131('0x15')]),_0xe131('0x47'),{'sessionId':_0x497b76,'transferNumber':_0x4f3b0d});return _0x2e6f99[_0xe131('0x16')](0xc8)[_0xe131('0x29')]({'error':![],'message':_0xe131('0x48')});})[_0xe131('0x32')](handleError(_0x2e6f99));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 822955e..809180c 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 _0x0295=['addDisposition','/:id/canned_answers','addAnswer','/:id/users','addAgents','/:id/applications','addApplications','/:id/notify','notify','put','/:id','update','delete','removeDispositions','removeAnswers','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','getDispositions','getAnswers','getAgents','post','create','/:id/dispositions'];(function(_0x13611e,_0x42652f){var _0x43b5b9=function(_0x28d3c1){while(--_0x28d3c1){_0x13611e['push'](_0x13611e['shift']());}};_0x43b5b9(++_0x42652f);}(_0x0295,0x1f0));var _0x5029=function(_0x5f2a50,_0x4700e0){_0x5f2a50=_0x5f2a50-0x0;var _0x7577ca=_0x0295[_0x5f2a50];return _0x7577ca;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5029('0x2'));var auth=require(_0x5029('0x3'));var interaction=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var controller=require(_0x5029('0x6'));router[_0x5029('0x7')]('/',auth[_0x5029('0x8')](),controller[_0x5029('0x9')]);router[_0x5029('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x5029('0x7')]('/:id',auth[_0x5029('0x8')](),controller['show']);router[_0x5029('0x7')]('/:id/dispositions',auth[_0x5029('0x8')](),controller[_0x5029('0xa')]);router[_0x5029('0x7')]('/:id/canned_answers',auth[_0x5029('0x8')](),controller[_0x5029('0xb')]);router[_0x5029('0x7')]('/:id/users',auth[_0x5029('0x8')](),controller[_0x5029('0xc')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0x5029('0xd')]('/',auth[_0x5029('0x8')](),controller[_0x5029('0xe')]);router[_0x5029('0xd')](_0x5029('0xf'),auth[_0x5029('0x8')](),controller[_0x5029('0x10')]);router[_0x5029('0xd')](_0x5029('0x11'),auth[_0x5029('0x8')](),controller[_0x5029('0x12')]);router[_0x5029('0xd')](_0x5029('0x13'),auth[_0x5029('0x8')](),controller[_0x5029('0x14')]);router['post'](_0x5029('0x15'),auth[_0x5029('0x8')](),controller[_0x5029('0x16')]);router[_0x5029('0xd')](_0x5029('0x17'),controller[_0x5029('0x18')]);router[_0x5029('0xd')]('/:id/send',auth[_0x5029('0x8')](),controller['send']);router[_0x5029('0x19')](_0x5029('0x1a'),auth[_0x5029('0x8')](),controller[_0x5029('0x1b')]);router['delete']('/:id',auth[_0x5029('0x8')](),controller['destroy']);router[_0x5029('0x1c')](_0x5029('0xf'),auth[_0x5029('0x8')](),controller[_0x5029('0x1d')]);router[_0x5029('0x1c')](_0x5029('0x11'),auth[_0x5029('0x8')](),controller[_0x5029('0x1e')]);router[_0x5029('0x1c')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x5029('0x1f')]=router; \ No newline at end of file +var _0x7880=['/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','addApplications','notify','put','update','delete','removeDispositions','removeAnswers','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x7880,0x1f4));var _0x0788=function(_0x4749bc,_0xd777b9){_0x4749bc=_0x4749bc-0x0;var _0x4b5918=_0x7880[_0x4749bc];return _0x4b5918;};'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['get'](_0x0788('0x10'),auth[_0x0788('0xa')](),controller[_0x0788('0x11')]);router[_0x0788('0x9')](_0x0788('0x12'),auth['isAuthenticated'](),controller[_0x0788('0x13')]);router[_0x0788('0x9')](_0x0788('0x14'),auth[_0x0788('0xa')](),controller[_0x0788('0x15')]);router[_0x0788('0x9')](_0x0788('0x16'),auth['isAuthenticated'](),controller[_0x0788('0x17')]);router[_0x0788('0x18')]('/',auth[_0x0788('0xa')](),controller[_0x0788('0x19')]);router['post'](_0x0788('0x10'),auth['isAuthenticated'](),controller[_0x0788('0x1a')]);router[_0x0788('0x18')](_0x0788('0x12'),auth[_0x0788('0xa')](),controller[_0x0788('0x1b')]);router[_0x0788('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0x0788('0x1c')]);router[_0x0788('0x18')]('/:id/applications',auth[_0x0788('0xa')](),controller[_0x0788('0x1d')]);router[_0x0788('0x18')]('/:id/notify',controller[_0x0788('0x1e')]);router[_0x0788('0x18')]('/:id/send',auth[_0x0788('0xa')](),controller['send']);router[_0x0788('0x1f')]('/:id',auth[_0x0788('0xa')](),controller[_0x0788('0x20')]);router[_0x0788('0x21')](_0x0788('0xe'),auth[_0x0788('0xa')](),controller['destroy']);router['delete'](_0x0788('0x10'),auth[_0x0788('0xa')](),controller[_0x0788('0x22')]);router[_0x0788('0x21')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x0788('0x23')]);router[_0x0788('0x21')](_0x0788('0x14'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x0788('0x24')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 87efd96..8a25a0c 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 _0x4495=['ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','randomstring','exports','STRING','name','generate'];(function(_0x3040e0,_0x2fd324){var _0x406114=function(_0x2c7b25){while(--_0x2c7b25){_0x3040e0['push'](_0x3040e0['shift']());}};_0x406114(++_0x2fd324);}(_0x4495,0xdb));var _0x5449=function(_0x357400,_0xcd1e2){_0x357400=_0x357400-0x0;var _0x86ec59=_0x4495[_0x357400];return _0x86ec59;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x5449('0x0'));module[_0x5449('0x1')]={'name':{'type':Sequelize[_0x5449('0x2')],'unique':_0x5449('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x5449('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x5449('0x2')],'defaultValue':function(){return rs[_0x5449('0x4')]();}},'phone':{'type':Sequelize[_0x5449('0x2')]},'type':{'type':Sequelize[_0x5449('0x5')](_0x5449('0x6'))},'accountSid':{'type':Sequelize[_0x5449('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x5449('0x7')],'defaultValue':function(){return _0x5449('0x8');}},'notificationSound':{'type':Sequelize[_0x5449('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x5449('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5449('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5449('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5449('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5449('0xa')],'comment':_0x5449('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x5449('0x9')],'defaultValue':![],'comment':_0x5449('0xc'),'set':function(_0x249818){if(!_0x249818){this['setDataValue'](_0x5449('0xd'),null);}this[_0x5449('0xe')](_0x5449('0xf'),_0x249818);}},'description':{'type':Sequelize[_0x5449('0x2')]}}; \ No newline at end of file +var _0xca8a=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','name','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x1306b0,_0x1e6e09){var _0x36790c=function(_0x1f3a19){while(--_0x1f3a19){_0x1306b0['push'](_0x1306b0['shift']());}};_0x36790c(++_0x1e6e09);}(_0xca8a,0xe4));var _0xaca8=function(_0x2f14bb,_0x4133a7){_0x2f14bb=_0x2f14bb-0x0;var _0x595cc9=_0xca8a[_0x2f14bb];return _0x595cc9;};'use strict';var Sequelize=require(_0xaca8('0x0'));var rs=require(_0xaca8('0x1'));module['exports']={'name':{'type':Sequelize[_0xaca8('0x2')],'unique':_0xaca8('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xaca8('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xaca8('0x2')],'defaultValue':function(){return rs[_0xaca8('0x4')]();}},'phone':{'type':Sequelize[_0xaca8('0x2')]},'type':{'type':Sequelize[_0xaca8('0x5')](_0xaca8('0x6'))},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xaca8('0x7')],'defaultValue':function(){return _0xaca8('0x8');}},'notificationSound':{'type':Sequelize[_0xaca8('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xaca8('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xaca8('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xaca8('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xaca8('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xaca8('0xa')],'comment':_0xaca8('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1d36b2){if(!_0x1d36b2){this[_0xaca8('0xc')](_0xaca8('0xd'),null);}this['setDataValue'](_0xaca8('0xe'),_0x1d36b2);}},'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 76cf609..58c6e52 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 _0xc15b=['client','http','request','info','request\x20sent','debug','stringify','error','message','WhatsappAccount,\x20%s,\x20%s','catch','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','end','stack','name','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','sort','filters','filter','where','merge','VIRTUAL','includeAll','rows','params','keys','include','options','find','body','user','role','WhatsappAccounts','UserProfileSection','autoAssociation','describe','addDisposition','WhatsappAccountId','create','getDispositions','findOne','Disposition','order','pick','removeDispositions','addAnswer','CannedAnswer','hasOwnProperty','removeAnswers','ids','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','User','transaction','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','notify','whatsapp','Applications','applications','orderBy','priority','account','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','difference','createdAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','MessageSid','isNil','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','Contacts','defaults','CmContact','contact','WhatsappInteraction','interaction','get','created','close','unmanaged','*,*,*,*','WhatsappMessage','messageId','UserId','unshift','agent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','send','\x0a','to\x20is\x20mandatory','List','dataValues','Messages','push','eml-format','rimraf','fast-json-patch','moment','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise'];(function(_0x1bd245,_0x351ead){var _0x306d36=function(_0x17e32f){while(--_0x17e32f){_0x1bd245['push'](_0x1bd245['shift']());}};_0x306d36(++_0x351ead);}(_0xc15b,0x145));var _0xbc15=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0xc15b[_0x456fb1];return _0x4083d6;};'use strict';var emlformat=require(_0xbc15('0x0'));var rimraf=require(_0xbc15('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbc15('0x2'));var rp=require('request-promise');var moment=require(_0xbc15('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbc15('0x4'));var util=require('util');var path=require(_0xbc15('0x5'));var sox=require('sox');var csv=require(_0xbc15('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbc15('0x7'));var _=require(_0xbc15('0x8'));var squel=require(_0xbc15('0x9'));var crypto=require(_0xbc15('0xa'));var jsforce=require(_0xbc15('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xbc15('0x6'));var querystring=require('querystring');var Papa=require(_0xbc15('0xc'));var Redis=require(_0xbc15('0xd'));var authService=require(_0xbc15('0xe'));var qs=require(_0xbc15('0xf'));var as=require(_0xbc15('0x10'));var hardwareService=require(_0xbc15('0x11'));var logger=require('../../config/logger')(_0xbc15('0x12'));var utils=require(_0xbc15('0x13'));var config=require(_0xbc15('0x14'));var licenseUtil=require(_0xbc15('0x15'));var db=require(_0xbc15('0x16'))['db'];config[_0xbc15('0x17')]=_['defaults'](config[_0xbc15('0x17')],{'host':_0xbc15('0x18'),'port':0x18eb});var socket=require(_0xbc15('0x19'))(new Redis(config[_0xbc15('0x17')]));require(_0xbc15('0x1a'))[_0xbc15('0x1b')](socket);var jayson=require(_0xbc15('0x1c'));var client=jayson[_0xbc15('0x1d')][_0xbc15('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x16764d,_0xd673f7,_0x3db34d,_0x2eb56e){return new BPromise(function(_0x4da542,_0x5c27b8){var _0x25b8c2=_0x2eb56e||client;return _0x25b8c2[_0xbc15('0x1f')](_0x16764d,_0x3db34d)['then'](function(_0x2456fb){logger[_0xbc15('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0xd673f7,_0xbc15('0x21'));logger[_0xbc15('0x22')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xd673f7,_0xbc15('0x21'),JSON[_0xbc15('0x23')](_0x2456fb));if(_0x2456fb[_0xbc15('0x24')]){if(_0x2456fb[_0xbc15('0x24')]['code']===0x1f4){logger[_0xbc15('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0xd673f7,_0x2456fb[_0xbc15('0x24')][_0xbc15('0x25')]);return _0x5c27b8(_0x2456fb['error'][_0xbc15('0x25')]);}logger['error'](_0xbc15('0x26'),_0xd673f7,_0x2456fb['error']['message']);return _0x4da542(_0x2456fb[_0xbc15('0x24')]['message']);}else{logger['info'](_0xbc15('0x26'),_0xd673f7,_0xbc15('0x21'));_0x4da542(_0x2456fb['result']['message']);}})[_0xbc15('0x27')](function(_0x283044){logger[_0xbc15('0x24')](_0xbc15('0x26'),_0xd673f7,_0x283044);_0x5c27b8(_0x283044);});});}function respondWithStatusCode(_0x26fe5b,_0x39d268){_0x39d268=_0x39d268||0xcc;return function(_0x3469d3){if(_0x3469d3){return _0x26fe5b['sendStatus'](_0x39d268);}return _0x26fe5b['status'](_0x39d268)['end']();};}function respondWithResult(_0x2792ee,_0x2d00a3){_0x2d00a3=_0x2d00a3||0xc8;return function(_0x46d156){if(_0x46d156){return _0x2792ee[_0xbc15('0x28')](_0x2d00a3)[_0xbc15('0x29')](_0x46d156);}};}function respondWithFilteredResult(_0xa2e726,_0x128344){return function(_0x4d7dbb){if(_0x4d7dbb){var _0xacc394=typeof _0x128344[_0xbc15('0x2a')]===_0xbc15('0x2b')&&typeof _0x128344[_0xbc15('0x2c')]===_0xbc15('0x2b');var _0x3c2594=_0x4d7dbb['count'];var _0x4f097f=_0xacc394?0x0:_0x128344['offset'];var _0x38585e=_0xacc394?_0x4d7dbb[_0xbc15('0x2d')]:_0x128344['offset']+_0x128344[_0xbc15('0x2c')];var _0x30724a;if(_0x38585e>=_0x3c2594){_0x38585e=_0x3c2594;_0x30724a=0xc8;}else{_0x30724a=0xce;}_0xa2e726[_0xbc15('0x28')](_0x30724a);return _0xa2e726[_0xbc15('0x2e')](_0xbc15('0x2f'),_0x4f097f+'-'+_0x38585e+'/'+_0x3c2594)[_0xbc15('0x29')](_0x4d7dbb);}return null;};}function patchUpdates(_0x5ef0db){return function(_0x300e4f){try{jsonpatch[_0xbc15('0x30')](_0x300e4f,_0x5ef0db,!![]);}catch(_0x3b54e6){return BPromise[_0xbc15('0x31')](_0x3b54e6);}return _0x300e4f['save']();};}function saveUpdates(_0xb2d3ad,_0x1a2aed){return function(_0x40d37a){if(_0x40d37a){return _0x40d37a['update'](_0xb2d3ad)[_0xbc15('0x32')](function(_0x2f2165){return _0x2f2165;});}return null;};}function removeEntity(_0x3b09af,_0x5d49ef){return function(_0x541a43){if(_0x541a43){return _0x541a43[_0xbc15('0x33')]()['then'](function(){var _0x4f8f0d=_0x541a43['get']({'plain':!![]});var _0x4ed6a7='WhatsappAccounts';return db['UserProfileResource'][_0xbc15('0x33')]({'where':{'type':_0x4ed6a7,'resourceId':_0x4f8f0d['id']}})['then'](function(){return _0x541a43;});})['then'](function(){_0x3b09af[_0xbc15('0x28')](0xcc)[_0xbc15('0x34')]();});}};}function handleEntityNotFound(_0x409750,_0x3a3ca6){return function(_0x53427e){if(!_0x53427e){_0x409750['sendStatus'](0x194);}return _0x53427e;};}function handleError(_0x2b5d55,_0x5deb0c){_0x5deb0c=_0x5deb0c||0x1f4;return function(_0x9bff0d){logger[_0xbc15('0x24')](_0x9bff0d[_0xbc15('0x35')]);if(_0x9bff0d[_0xbc15('0x36')]){delete _0x9bff0d['name'];}_0x2b5d55[_0xbc15('0x28')](_0x5deb0c)['send'](_0x9bff0d);};}exports[_0xbc15('0x37')]=function(_0x2ce517,_0x299da5){var _0x30325f={'include':[{'model':db[_0xbc15('0x38')],'as':_0xbc15('0x39')}]},_0x4f0511={},_0x18f429={'count':0x0,'rows':[]};var _0x21da7c=_[_0xbc15('0x3a')](db[_0xbc15('0x3b')][_0xbc15('0x3c')],function(_0x2f5a18){return{'name':_0x2f5a18[_0xbc15('0x3d')],'type':_0x2f5a18[_0xbc15('0x3e')]['key']};});_0x4f0511[_0xbc15('0x3f')]=_[_0xbc15('0x3a')](_0x21da7c,_0xbc15('0x36'));_0x4f0511[_0xbc15('0x40')]=_['keys'](_0x2ce517[_0xbc15('0x40')]);_0x4f0511['filters']=_[_0xbc15('0x41')](_0x4f0511[_0xbc15('0x3f')],_0x4f0511['query']);_0x30325f[_0xbc15('0x42')]=_[_0xbc15('0x41')](_0x4f0511[_0xbc15('0x3f')],qs[_0xbc15('0x43')](_0x2ce517[_0xbc15('0x40')][_0xbc15('0x43')]));_0x30325f['attributes']=_0x30325f[_0xbc15('0x42')][_0xbc15('0x44')]?_0x30325f['attributes']:_0x4f0511['model'];if(!_0x2ce517['query']['hasOwnProperty'](_0xbc15('0x45'))){_0x30325f['limit']=qs[_0xbc15('0x2c')](_0x2ce517[_0xbc15('0x40')][_0xbc15('0x2c')]);_0x30325f['offset']=qs[_0xbc15('0x2a')](_0x2ce517[_0xbc15('0x40')][_0xbc15('0x2a')]);}_0x30325f['order']=qs[_0xbc15('0x46')](_0x2ce517[_0xbc15('0x40')][_0xbc15('0x46')]);_0x30325f['where']=qs['filters'](_['pick'](_0x2ce517[_0xbc15('0x40')],_0x4f0511[_0xbc15('0x47')]),_0x21da7c);if(_0x2ce517['query'][_0xbc15('0x48')]){_0x30325f[_0xbc15('0x49')]=_[_0xbc15('0x4a')](_0x30325f[_0xbc15('0x49')],{'$or':_[_0xbc15('0x3a')](_0x21da7c,function(_0x2ef6db){if(_0x2ef6db[_0xbc15('0x3e')]!==_0xbc15('0x4b')){var _0x17d1d0={};_0x17d1d0[_0x2ef6db[_0xbc15('0x36')]]={'$like':'%'+_0x2ce517[_0xbc15('0x40')][_0xbc15('0x48')]+'%'};return _0x17d1d0;}})});}_0x30325f=_['merge']({},_0x30325f,_0x2ce517['options']);var _0xb09aee={'where':_0x30325f['where']};return db[_0xbc15('0x3b')]['count'](_0xb09aee)['then'](function(_0x440499){_0x18f429[_0xbc15('0x2d')]=_0x440499;if(_0x2ce517[_0xbc15('0x40')][_0xbc15('0x4c')]){_0x30325f['include']=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x30325f);})[_0xbc15('0x32')](function(_0x2c005c){_0x18f429[_0xbc15('0x4d')]=_0x2c005c;return _0x18f429;})[_0xbc15('0x32')](respondWithFilteredResult(_0x299da5,_0x30325f))[_0xbc15('0x27')](handleError(_0x299da5,null));};exports['show']=function(_0x4f28ea,_0x51d24f){var _0x1807b9={'raw':![],'where':{'id':_0x4f28ea[_0xbc15('0x4e')]['id']},'include':[{'model':db[_0xbc15('0x38')],'as':'mandatoryDispositionPause'}]},_0x485574={};_0x485574[_0xbc15('0x3f')]=_[_0xbc15('0x4f')](db[_0xbc15('0x3b')]['rawAttributes']);_0x485574[_0xbc15('0x40')]=_[_0xbc15('0x4f')](_0x4f28ea[_0xbc15('0x40')]);_0x485574[_0xbc15('0x47')]=_[_0xbc15('0x41')](_0x485574['model'],_0x485574[_0xbc15('0x40')]);_0x1807b9['attributes']=_[_0xbc15('0x41')](_0x485574[_0xbc15('0x3f')],qs[_0xbc15('0x43')](_0x4f28ea[_0xbc15('0x40')][_0xbc15('0x43')]));_0x1807b9['attributes']=_0x1807b9[_0xbc15('0x42')]['length']?_0x1807b9[_0xbc15('0x42')]:_0x485574['model'];if(_0x4f28ea[_0xbc15('0x40')]['includeAll']){_0x1807b9[_0xbc15('0x50')]=[{'all':!![]}];}_0x1807b9=_[_0xbc15('0x4a')]({},_0x1807b9,_0x4f28ea[_0xbc15('0x51')]);return db['WhatsappAccount'][_0xbc15('0x52')](_0x1807b9)[_0xbc15('0x32')](handleEntityNotFound(_0x51d24f,null))[_0xbc15('0x32')](respondWithResult(_0x51d24f,null))[_0xbc15('0x27')](handleError(_0x51d24f,null));};exports['create']=function(_0x44a0fd,_0x9065f2){return db['WhatsappAccount']['create'](_0x44a0fd[_0xbc15('0x53')],{})['then'](function(_0x86c698){var _0x2fd32e=_0x44a0fd[_0xbc15('0x54')]['get']({'plain':!![]});if(!_0x2fd32e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fd32e[_0xbc15('0x55')]===_0xbc15('0x54')){var _0x162f39=_0x86c698['get']({'plain':!![]});var _0x26dcd5=_0xbc15('0x56');return db[_0xbc15('0x57')]['find']({'where':{'name':_0x26dcd5,'userProfileId':_0x2fd32e['userProfileId']},'raw':!![]})['then'](function(_0x2f9e1a){if(_0x2f9e1a&&_0x2f9e1a[_0xbc15('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x162f39[_0xbc15('0x36')],'resourceId':_0x162f39['id'],'type':_0x2f9e1a[_0xbc15('0x36')],'sectionId':_0x2f9e1a['id']},{})['then'](function(){return _0x86c698;});}else{return _0x86c698;}})[_0xbc15('0x27')](function(_0x4fbb2d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4fbb2d);throw _0x4fbb2d;});}return _0x86c698;})[_0xbc15('0x32')](respondWithResult(_0x9065f2,0xc9))['catch'](handleError(_0x9065f2,null));};exports['update']=function(_0x3fb0e7,_0x398600){if(_0x3fb0e7[_0xbc15('0x53')]['id']){delete _0x3fb0e7['body']['id'];}return db[_0xbc15('0x3b')][_0xbc15('0x52')]({'where':{'id':_0x3fb0e7[_0xbc15('0x4e')]['id']},'include':[{'model':db[_0xbc15('0x38')],'as':_0xbc15('0x39')}]})[_0xbc15('0x32')](handleEntityNotFound(_0x398600,null))['then'](saveUpdates(_0x3fb0e7[_0xbc15('0x53')],null))[_0xbc15('0x32')](respondWithResult(_0x398600,null))[_0xbc15('0x27')](handleError(_0x398600,null));};exports[_0xbc15('0x33')]=function(_0xde5f39,_0x3c9d83){return db[_0xbc15('0x3b')]['find']({'where':{'id':_0xde5f39[_0xbc15('0x4e')]['id']}})[_0xbc15('0x32')](handleEntityNotFound(_0x3c9d83,null))['then'](removeEntity(_0x3c9d83,null))[_0xbc15('0x27')](handleError(_0x3c9d83,null));};exports[_0xbc15('0x59')]=function(_0x2b74d3,_0x46c11b){return db['WhatsappAccount'][_0xbc15('0x59')]()[_0xbc15('0x32')](respondWithResult(_0x46c11b,null))[_0xbc15('0x27')](handleError(_0x46c11b,null));};exports[_0xbc15('0x5a')]=function(_0x51cf2a,_0x11e1cd,_0x3fd2e3){if(_0x51cf2a[_0xbc15('0x53')]['id']){delete _0x51cf2a[_0xbc15('0x53')]['id'];}return db[_0xbc15('0x3b')][_0xbc15('0x52')]({'where':{'id':_0x51cf2a[_0xbc15('0x4e')]['id']}})[_0xbc15('0x32')](handleEntityNotFound(_0x11e1cd,null))['then'](function(_0x1d751b){if(_0x1d751b){_0x51cf2a[_0xbc15('0x53')][_0xbc15('0x5b')]=_0x1d751b['id'];return db['Disposition'][_0xbc15('0x5c')](_0x51cf2a['body']);}})[_0xbc15('0x32')](respondWithResult(_0x11e1cd,null))[_0xbc15('0x27')](handleError(_0x11e1cd,null));};exports[_0xbc15('0x5d')]=function(_0x481585,_0x3b0445,_0x35fbf6){var _0x2f98d1={'raw':![],'where':{}};var _0x5da47d={};var _0x3b1406={'count':0x0,'rows':[]};return db[_0xbc15('0x3b')][_0xbc15('0x5e')]({'where':{'id':_0x481585[_0xbc15('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3b0445,null))['then'](function(_0x3bb5bf){if(_0x3bb5bf){_0x5da47d['model']=_['keys'](db[_0xbc15('0x5f')]['rawAttributes']);_0x5da47d[_0xbc15('0x40')]=_['keys'](_0x481585[_0xbc15('0x40')]);_0x5da47d['filters']=_[_0xbc15('0x41')](_0x5da47d['model'],_0x5da47d[_0xbc15('0x40')]);_0x2f98d1[_0xbc15('0x42')]=_[_0xbc15('0x41')](_0x5da47d[_0xbc15('0x3f')],qs['fields'](_0x481585[_0xbc15('0x40')][_0xbc15('0x43')]));_0x2f98d1[_0xbc15('0x42')]=_0x2f98d1[_0xbc15('0x42')]['length']?_0x2f98d1[_0xbc15('0x42')]:_0x5da47d[_0xbc15('0x3f')];if(!_0x481585[_0xbc15('0x40')]['hasOwnProperty'](_0xbc15('0x45'))){_0x2f98d1[_0xbc15('0x2c')]=qs['limit'](_0x481585[_0xbc15('0x40')]['limit']);_0x2f98d1[_0xbc15('0x2a')]=qs[_0xbc15('0x2a')](_0x481585['query'][_0xbc15('0x2a')]);}_0x2f98d1[_0xbc15('0x60')]=qs[_0xbc15('0x46')](_0x481585[_0xbc15('0x40')]['sort']);_0x2f98d1[_0xbc15('0x49')]=qs['filters'](_[_0xbc15('0x61')](_0x481585[_0xbc15('0x40')],_0x5da47d['filters']));_0x2f98d1['where'][_0xbc15('0x5b')]=_0x3bb5bf['id'];if(_0x481585['query'][_0xbc15('0x48')]){_0x2f98d1[_0xbc15('0x49')]=_[_0xbc15('0x4a')](_0x2f98d1[_0xbc15('0x49')],{'$or':_[_0xbc15('0x3a')](_0x2f98d1[_0xbc15('0x42')],function(_0x29cfee){var _0x30b63c={};_0x30b63c[_0x29cfee]={'$like':'%'+_0x481585['query'][_0xbc15('0x48')]+'%'};return _0x30b63c;})});}_0x2f98d1=_[_0xbc15('0x4a')]({},_0x2f98d1,_0x481585['options']);return db[_0xbc15('0x5f')]['count']({'where':_0x2f98d1[_0xbc15('0x49')]})[_0xbc15('0x32')](function(_0x2e7778){_0x3b1406[_0xbc15('0x2d')]=_0x2e7778;if(_0x481585[_0xbc15('0x40')]['includeAll']){_0x2f98d1[_0xbc15('0x50')]=[{'all':!![]}];}return db[_0xbc15('0x5f')]['findAll'](_0x2f98d1);})[_0xbc15('0x32')](function(_0x1fffc7){_0x3b1406[_0xbc15('0x4d')]=_0x1fffc7;return _0x3b1406;});}})[_0xbc15('0x32')](respondWithFilteredResult(_0x3b0445,_0x2f98d1))['catch'](handleError(_0x3b0445,null));};exports[_0xbc15('0x62')]=function(_0x389b86,_0x1dbae1,_0x3951b5){return db[_0xbc15('0x3b')]['find']({'where':{'id':_0x389b86[_0xbc15('0x4e')]['id']}})[_0xbc15('0x32')](handleEntityNotFound(_0x1dbae1,null))['then'](function(_0x461ffb){if(_0x461ffb){return _0x461ffb[_0xbc15('0x62')](_0x389b86[_0xbc15('0x40')]['ids']);}})[_0xbc15('0x32')](respondWithStatusCode(_0x1dbae1,null))[_0xbc15('0x27')](handleError(_0x1dbae1,null));};exports[_0xbc15('0x63')]=function(_0x4757b3,_0x3e42a6,_0x2b50a6){if(_0x4757b3[_0xbc15('0x53')]['id']){delete _0x4757b3['body']['id'];}return db[_0xbc15('0x3b')][_0xbc15('0x52')]({'where':{'id':_0x4757b3[_0xbc15('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3e42a6,null))['then'](function(_0x540ac2){if(_0x540ac2){_0x4757b3[_0xbc15('0x53')][_0xbc15('0x5b')]=_0x540ac2['id'];return db[_0xbc15('0x64')][_0xbc15('0x5c')](_0x4757b3[_0xbc15('0x53')]);}})['then'](respondWithResult(_0x3e42a6,null))[_0xbc15('0x27')](handleError(_0x3e42a6,null));};exports['getAnswers']=function(_0x4c1823,_0xbf3c99,_0x32ec4f){var _0x3b235a={'raw':![],'where':{}};var _0x3ab687={};var _0x2be0f5={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xbc15('0x5e')]({'where':{'id':_0x4c1823[_0xbc15('0x4e')]['id']}})[_0xbc15('0x32')](handleEntityNotFound(_0xbf3c99,null))[_0xbc15('0x32')](function(_0x21c919){if(_0x21c919){_0x3ab687[_0xbc15('0x3f')]=_[_0xbc15('0x4f')](db[_0xbc15('0x64')][_0xbc15('0x3c')]);_0x3ab687[_0xbc15('0x40')]=_['keys'](_0x4c1823[_0xbc15('0x40')]);_0x3ab687[_0xbc15('0x47')]=_[_0xbc15('0x41')](_0x3ab687[_0xbc15('0x3f')],_0x3ab687[_0xbc15('0x40')]);_0x3b235a[_0xbc15('0x42')]=_['intersection'](_0x3ab687[_0xbc15('0x3f')],qs['fields'](_0x4c1823[_0xbc15('0x40')]['fields']));_0x3b235a[_0xbc15('0x42')]=_0x3b235a[_0xbc15('0x42')][_0xbc15('0x44')]?_0x3b235a['attributes']:_0x3ab687[_0xbc15('0x3f')];if(!_0x4c1823[_0xbc15('0x40')][_0xbc15('0x65')](_0xbc15('0x45'))){_0x3b235a[_0xbc15('0x2c')]=qs[_0xbc15('0x2c')](_0x4c1823['query']['limit']);_0x3b235a[_0xbc15('0x2a')]=qs[_0xbc15('0x2a')](_0x4c1823[_0xbc15('0x40')]['offset']);}_0x3b235a[_0xbc15('0x60')]=qs[_0xbc15('0x46')](_0x4c1823['query'][_0xbc15('0x46')]);_0x3b235a[_0xbc15('0x49')]=qs[_0xbc15('0x47')](_['pick'](_0x4c1823[_0xbc15('0x40')],_0x3ab687[_0xbc15('0x47')]));_0x3b235a[_0xbc15('0x49')][_0xbc15('0x5b')]=_0x21c919['id'];if(_0x4c1823[_0xbc15('0x40')][_0xbc15('0x48')]){_0x3b235a[_0xbc15('0x49')]=_[_0xbc15('0x4a')](_0x3b235a[_0xbc15('0x49')],{'$or':_[_0xbc15('0x3a')](_0x3b235a[_0xbc15('0x42')],function(_0x4248dd){var _0x1a6689={};_0x1a6689[_0x4248dd]={'$like':'%'+_0x4c1823[_0xbc15('0x40')]['filter']+'%'};return _0x1a6689;})});}_0x3b235a=_['merge']({},_0x3b235a,_0x4c1823[_0xbc15('0x51')]);return db[_0xbc15('0x64')][_0xbc15('0x2d')]({'where':_0x3b235a[_0xbc15('0x49')]})[_0xbc15('0x32')](function(_0x36df7d){_0x2be0f5[_0xbc15('0x2d')]=_0x36df7d;if(_0x4c1823[_0xbc15('0x40')]['includeAll']){_0x3b235a[_0xbc15('0x50')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3b235a);})[_0xbc15('0x32')](function(_0x4473a0){_0x2be0f5[_0xbc15('0x4d')]=_0x4473a0;return _0x2be0f5;});}})[_0xbc15('0x32')](respondWithFilteredResult(_0xbf3c99,_0x3b235a))[_0xbc15('0x27')](handleError(_0xbf3c99,null));};exports[_0xbc15('0x66')]=function(_0x3f9c0f,_0x597c1d,_0x3d65e4){return db[_0xbc15('0x3b')][_0xbc15('0x52')]({'where':{'id':_0x3f9c0f['params']['id']}})[_0xbc15('0x32')](handleEntityNotFound(_0x597c1d,null))[_0xbc15('0x32')](function(_0x22f2a0){if(_0x22f2a0){return _0x22f2a0[_0xbc15('0x66')](_0x3f9c0f[_0xbc15('0x40')][_0xbc15('0x67')]);}})[_0xbc15('0x32')](respondWithStatusCode(_0x597c1d,null))[_0xbc15('0x27')](handleError(_0x597c1d,null));};exports[_0xbc15('0x68')]=function(_0x3dc5fb,_0x1c16e4,_0x2b8678){return db[_0xbc15('0x3b')]['find']({'where':{'id':_0x3dc5fb['params']['id']}})['then'](handleEntityNotFound(_0x1c16e4,null))[_0xbc15('0x32')](function(_0x356909){if(_0x356909){return _0x356909[_0xbc15('0x68')](_0x3dc5fb[_0xbc15('0x53')][_0xbc15('0x67')],_[_0xbc15('0x69')](_0x3dc5fb[_0xbc15('0x53')],['ids','id'])||{})[_0xbc15('0x6a')](function(_0x3c9146){for(var _0xb2639b=0x0;_0xb2639b<_0x3dc5fb['body'][_0xbc15('0x67')][_0xbc15('0x44')];_0xb2639b+=0x1){socket[_0xbc15('0x6b')](_0xbc15('0x6c'),{'UserId':Number(_0x3dc5fb[_0xbc15('0x53')]['ids'][_0xb2639b]),'WhatsappAccountId':Number(_0x3dc5fb[_0xbc15('0x4e')]['id'])});}return _0x3c9146;});}})[_0xbc15('0x32')](respondWithResult(_0x1c16e4,null))[_0xbc15('0x27')](handleError(_0x1c16e4,null));};exports[_0xbc15('0x6d')]=function(_0x308566,_0x478ff3,_0x3fe6e7){return db[_0xbc15('0x3b')][_0xbc15('0x52')]({'where':{'id':_0x308566[_0xbc15('0x4e')]['id']}})[_0xbc15('0x32')](handleEntityNotFound(_0x478ff3,null))['then'](function(_0x5cd00c){if(_0x5cd00c){return _0x5cd00c['removeAgents'](_0x308566['query'][_0xbc15('0x67')])[_0xbc15('0x32')](function(){if(_['isArray'](_0x308566[_0xbc15('0x40')]['ids'])){for(var _0x483024=0x0;_0x483024<_0x308566[_0xbc15('0x40')][_0xbc15('0x67')][_0xbc15('0x44')];_0x483024+=0x1){socket['emit'](_0xbc15('0x6e'),{'UserId':Number(_0x308566['query']['ids'][_0x483024]),'WhatsappAccountId':Number(_0x308566[_0xbc15('0x4e')]['id'])});}}else{socket['emit'](_0xbc15('0x6e'),{'UserId':Number(_0x308566[_0xbc15('0x40')][_0xbc15('0x67')]),'WhatsappAccountId':Number(_0x308566[_0xbc15('0x4e')]['id'])});}});}})[_0xbc15('0x32')](respondWithStatusCode(_0x478ff3,null))[_0xbc15('0x27')](handleError(_0x478ff3,null));};exports[_0xbc15('0x6f')]=function(_0x1cf100,_0x5f5979,_0x55ea24){var _0xfdb95b={};var _0x1e4a09={};var _0x89c6bb;var _0x4f6a3b;return db[_0xbc15('0x3b')][_0xbc15('0x5e')]({'where':{'id':_0x1cf100[_0xbc15('0x4e')]['id']}})[_0xbc15('0x32')](handleEntityNotFound(_0x5f5979,null))['then'](function(_0x558473){if(_0x558473){_0x89c6bb=_0x558473;_0x1e4a09[_0xbc15('0x3f')]=_[_0xbc15('0x4f')](db[_0xbc15('0x70')][_0xbc15('0x3c')]);_0x1e4a09[_0xbc15('0x40')]=_[_0xbc15('0x4f')](_0x1cf100['query']);_0x1e4a09[_0xbc15('0x47')]=_[_0xbc15('0x41')](_0x1e4a09[_0xbc15('0x3f')],_0x1e4a09[_0xbc15('0x40')]);_0xfdb95b[_0xbc15('0x42')]=_['intersection'](_0x1e4a09[_0xbc15('0x3f')],qs[_0xbc15('0x43')](_0x1cf100[_0xbc15('0x40')][_0xbc15('0x43')]));_0xfdb95b['attributes']=_0xfdb95b[_0xbc15('0x42')]['length']?_0xfdb95b[_0xbc15('0x42')]:_0x1e4a09[_0xbc15('0x3f')];_0xfdb95b[_0xbc15('0x60')]=qs[_0xbc15('0x46')](_0x1cf100[_0xbc15('0x40')][_0xbc15('0x46')]);_0xfdb95b['where']=qs[_0xbc15('0x47')](_[_0xbc15('0x61')](_0x1cf100[_0xbc15('0x40')],_0x1e4a09[_0xbc15('0x47')]));if(_0x1cf100['query']['filter']){_0xfdb95b[_0xbc15('0x49')]=_[_0xbc15('0x4a')](_0xfdb95b[_0xbc15('0x49')],{'$or':_[_0xbc15('0x3a')](_0xfdb95b['attributes'],function(_0x3c654c){var _0xa5ccdd={};_0xa5ccdd[_0x3c654c]={'$like':'%'+_0x1cf100[_0xbc15('0x40')][_0xbc15('0x48')]+'%'};return _0xa5ccdd;})});}_0xfdb95b=_[_0xbc15('0x4a')]({},_0xfdb95b,_0x1cf100[_0xbc15('0x51')]);return _0x89c6bb[_0xbc15('0x6f')](_0xfdb95b);}})['then'](function(_0x56b2e6){if(_0x56b2e6){_0x4f6a3b=_0x56b2e6[_0xbc15('0x44')];if(!_0x1cf100['query']['hasOwnProperty'](_0xbc15('0x45'))){_0xfdb95b[_0xbc15('0x2c')]=qs[_0xbc15('0x2c')](_0x1cf100[_0xbc15('0x40')][_0xbc15('0x2c')]);_0xfdb95b[_0xbc15('0x2a')]=qs[_0xbc15('0x2a')](_0x1cf100[_0xbc15('0x40')][_0xbc15('0x2a')]);}return _0x89c6bb[_0xbc15('0x6f')](_0xfdb95b);}})[_0xbc15('0x32')](function(_0x1f0d82){if(_0x1f0d82){return _0x1f0d82?{'count':_0x4f6a3b,'rows':_0x1f0d82}:null;}})['then'](respondWithResult(_0x5f5979,null))[_0xbc15('0x27')](handleError(_0x5f5979,null));};exports['addApplications']=function(_0x55a0a1,_0x148341,_0x1d059b){return db[_0xbc15('0x3b')][_0xbc15('0x5e')]({'where':{'id':_0x55a0a1[_0xbc15('0x4e')]['id']}})['then'](handleEntityNotFound(_0x148341,null))['then'](function(_0xb626bf){if(_0xb626bf){return db['sequelize'][_0xbc15('0x71')](function(_0xf3354d){return db[_0xbc15('0x72')][_0xbc15('0x33')]({'where':{'WhatsappAccountId':_0x55a0a1['params']['id']},'transaction':_0xf3354d})['then'](function(_0x34bed3){var _0x579cfb=_[_0xbc15('0x3a')](_0x55a0a1[_0xbc15('0x53')],function(_0x51ea86){_0x51ea86[_0xbc15('0x5b')]=_0x55a0a1[_0xbc15('0x4e')]['id'];return _0x51ea86;});return db[_0xbc15('0x72')][_0xbc15('0x73')](_0x579cfb,{'transaction':_0xf3354d});});})[_0xbc15('0x32')](function(){return db['WhatsappApplication'][_0xbc15('0x74')]({'where':{'WhatsappAccountId':_0x55a0a1[_0xbc15('0x4e')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x148341,null))[_0xbc15('0x27')](handleError(_0x148341,null));};exports['getApplications']=function(_0x216ffd,_0x468df6,_0x1f7e5e){var _0x2c9ba7={};var _0x3e950d={};var _0x33f27b;var _0x4245e5;return db['WhatsappAccount'][_0xbc15('0x5e')]({'where':{'id':_0x216ffd['params']['id']}})[_0xbc15('0x32')](handleEntityNotFound(_0x468df6,null))[_0xbc15('0x32')](function(_0x31ad61){if(_0x31ad61){_0x33f27b=_0x31ad61;_0x3e950d[_0xbc15('0x3f')]=_[_0xbc15('0x4f')](db[_0xbc15('0x72')][_0xbc15('0x3c')]);_0x3e950d['query']=_[_0xbc15('0x4f')](_0x216ffd['query']);_0x3e950d['filters']=_[_0xbc15('0x41')](_0x3e950d[_0xbc15('0x3f')],_0x3e950d['query']);_0x2c9ba7[_0xbc15('0x42')]=_[_0xbc15('0x41')](_0x3e950d[_0xbc15('0x3f')],qs[_0xbc15('0x43')](_0x216ffd[_0xbc15('0x40')]['fields']));_0x2c9ba7[_0xbc15('0x42')]=_0x2c9ba7[_0xbc15('0x42')][_0xbc15('0x44')]?_0x2c9ba7[_0xbc15('0x42')]:_0x3e950d[_0xbc15('0x3f')];_0x2c9ba7[_0xbc15('0x60')]=qs[_0xbc15('0x46')](_0x216ffd[_0xbc15('0x40')]['sort']);_0x2c9ba7['where']=qs[_0xbc15('0x47')](_[_0xbc15('0x61')](_0x216ffd[_0xbc15('0x40')],_0x3e950d[_0xbc15('0x47')]));if(_0x216ffd[_0xbc15('0x40')][_0xbc15('0x48')]){_0x2c9ba7['where']=_[_0xbc15('0x4a')](_0x2c9ba7[_0xbc15('0x49')],{'$or':_[_0xbc15('0x3a')](_0x2c9ba7[_0xbc15('0x42')],function(_0x1b48f5){var _0x287a08={};_0x287a08[_0x1b48f5]={'$like':'%'+_0x216ffd['query'][_0xbc15('0x48')]+'%'};return _0x287a08;})});}_0x2c9ba7=_[_0xbc15('0x4a')]({},_0x2c9ba7,_0x216ffd[_0xbc15('0x51')]);return _0x33f27b[_0xbc15('0x75')](_0x2c9ba7);}})[_0xbc15('0x32')](function(_0x173239){if(_0x173239){_0x4245e5=_0x173239[_0xbc15('0x44')];if(!_0x216ffd['query'][_0xbc15('0x65')](_0xbc15('0x45'))){_0x2c9ba7[_0xbc15('0x2c')]=qs['limit'](_0x216ffd['query'][_0xbc15('0x2c')]);_0x2c9ba7[_0xbc15('0x2a')]=qs[_0xbc15('0x2a')](_0x216ffd[_0xbc15('0x40')][_0xbc15('0x2a')]);}return _0x33f27b[_0xbc15('0x75')](_0x2c9ba7);}})[_0xbc15('0x32')](function(_0x3ebf27){if(_0x3ebf27){return _0x3ebf27?{'count':_0x4245e5,'rows':_0x3ebf27}:null;}})[_0xbc15('0x32')](respondWithResult(_0x468df6,null))[_0xbc15('0x27')](handleError(_0x468df6,null));};exports[_0xbc15('0x76')]=function(_0x42fde4,_0x2d4d31,_0x466ac0){var _0x10f431={'channel':_0xbc15('0x77')};var _0x3994ba=[];var _0x21083d=[];var _0x4a4457={};return db['WhatsappAccount'][_0xbc15('0x52')]({'where':{'id':_0x42fde4[_0xbc15('0x4e')]['id']},'include':[{'model':db[_0xbc15('0x72')],'as':_0xbc15('0x78')}]})['then'](handleEntityNotFound(_0x2d4d31,null))[_0xbc15('0x32')](function(_0x206179){_0x10f431['account']=_0x206179;_0x10f431[_0xbc15('0x79')]=_[_0xbc15('0x7a')](_0x206179[_0xbc15('0x78')],[_0xbc15('0x7b')],['asc']);if(_0x10f431[_0xbc15('0x7c')]['Applications']){delete _0x10f431['account'][_0xbc15('0x78')];}return db['CmContact'][_0xbc15('0x59')]();})['then'](function(_0x355206){if(!_0x355206){throw new db[(_0xbc15('0x7d'))][(_0xbc15('0x7e'))](_0xbc15('0x7f'));}_0x3994ba=_['difference'](_[_0xbc15('0x4f')](_0x355206),['createdAt',_0xbc15('0x80')]);_0x21083d=_[_0xbc15('0x81')](_['keys'](_0x355206),[_0xbc15('0x82'),'updatedAt',_0xbc15('0x83'),_0xbc15('0x84')]);_0x10f431[_0xbc15('0x53')]={'mapKey':_0xbc15('0x85')};if(_0x10f431[_0xbc15('0x7c')]['type']&&_0x10f431[_0xbc15('0x7c')][_0xbc15('0x3e')]===_0xbc15('0x86')){_0x10f431[_0xbc15('0x53')][_0xbc15('0x87')]=_0x42fde4[_0xbc15('0x53')][_0xbc15('0x88')][_0xbc15('0x89')](_0xbc15('0x8a'),'');_0x10f431[_0xbc15('0x53')]['body']=_0x42fde4['body']['Body'];_0x10f431[_0xbc15('0x53')]['messageId']=_0x42fde4[_0xbc15('0x53')][_0xbc15('0x8b')];}if(_0x10f431[_0xbc15('0x53')]['id']){delete _0x10f431[_0xbc15('0x53')]['id'];}if(_['isNil'](_0x10f431['body'][_0xbc15('0x87')])){throw new db[(_0xbc15('0x7d'))][(_0xbc15('0x7e'))]('from\x20is\x20mandatory');}if(_[_0xbc15('0x8c')](_0x10f431[_0xbc15('0x53')][_0xbc15('0x53')])||_0x10f431[_0xbc15('0x53')][_0xbc15('0x53')]===''){throw new db[(_0xbc15('0x7d'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xbc15('0x8c')](_0x10f431[_0xbc15('0x53')][_0xbc15('0x8d')])){throw new db['Sequelize'][(_0xbc15('0x7e'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x21083d);}if(!_[_0xbc15('0x8e')](_0x21083d,_0x10f431[_0xbc15('0x53')][_0xbc15('0x8d')])){throw new db['Sequelize'][(_0xbc15('0x7e'))](_0xbc15('0x8f')+_0x21083d);}_0x4a4457[_0x10f431[_0xbc15('0x53')][_0xbc15('0x8d')]]=_0x10f431[_0xbc15('0x53')][_0xbc15('0x87')];return db[_0xbc15('0x90')][_0xbc15('0x52')]({'where':{'id':_0x10f431[_0xbc15('0x7c')][_0xbc15('0x84')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x4a4457,'limit':0x1,'order':[[_0xbc15('0x80'),_0xbc15('0x91')]]}]});})[_0xbc15('0x32')](handleEntityNotFound(_0x2d4d31,null))[_0xbc15('0x32')](function(_0x74a35f){if(_0x74a35f){_0x10f431[_0xbc15('0x92')]=_['omit'](_0x74a35f,[_0xbc15('0x93')]);if(_0x74a35f[_0xbc15('0x93')][_0xbc15('0x44')]){return _0x74a35f[_0xbc15('0x93')][0x0];}var _0x48582d=_[_0xbc15('0x94')](_0x10f431[_0xbc15('0x53')],{'firstName':_0x10f431[_0xbc15('0x53')][_0xbc15('0x87')],'ListId':_0x74a35f['id']});_0x48582d[_0x10f431[_0xbc15('0x53')][_0xbc15('0x8d')]]=_0x10f431[_0xbc15('0x53')][_0xbc15('0x87')];return db[_0xbc15('0x95')]['create'](_0x48582d,{'fields':_0x3994ba,'raw':!![]});}})['then'](handleEntityNotFound(_0x2d4d31,null))[_0xbc15('0x32')](function(_0x561339){if(_0x561339){_0x10f431[_0xbc15('0x96')]=_0x561339;var _0x321571={'ContactId':_0x561339['id'],'phone':_0x10f431['body'][_0xbc15('0x87')],'WhatsappAccountId':_0x42fde4['params']['id']};var _0x595cdd={'ContactId':_0x561339['id'],'WhatsappAccountId':_0x42fde4[_0xbc15('0x4e')]['id'],'closed':![]};return db[_0xbc15('0x97')]['find']({'where':_0x595cdd})[_0xbc15('0x32')](function(_0x57979f){if(_0x57979f){return[_0x57979f,![]];}return db[_0xbc15('0x97')][_0xbc15('0x5c')](_0x321571)[_0xbc15('0x32')](function(_0x111c73){return[_0x111c73,!![]];});});}})[_0xbc15('0x6a')](function(_0x228d3d,_0x36ac29){_0x10f431[_0xbc15('0x98')]=_0x228d3d[_0xbc15('0x99')]({'plain':!![]});_0x10f431[_0xbc15('0x98')][_0xbc15('0x9a')]=![];if(_0x36ac29){if(_0x10f431['account']['autoclose']){_0x10f431[_0xbc15('0x79')]['push']({'id':0x0,'priority':_0x10f431[_0xbc15('0x79')][_0xbc15('0x44')]+0x1,'app':_0xbc15('0x9b'),'appdata':_0xbc15('0x9c'),'interval':_0xbc15('0x9d')});}_0x10f431['interaction'][_0xbc15('0x9a')]=!![];}return db[_0xbc15('0x9e')][_0xbc15('0x5c')]({'phone':_0x10f431[_0xbc15('0x53')][_0xbc15('0x87')],'messageId':_0x10f431[_0xbc15('0x53')][_0xbc15('0x9f')],'body':_0x10f431['body'][_0xbc15('0x53')],'WhatsappAccountId':_0x42fde4[_0xbc15('0x4e')]['id'],'WhatsappInteractionId':_0x228d3d['id'],'direction':'in','ContactId':_0x228d3d['ContactId'],'AttachmentId':_0x10f431['body']['AttachmentId']});})[_0xbc15('0x32')](function(_0x1085bd){_0x10f431[_0xbc15('0x25')]=_0x1085bd;if(_0x10f431[_0xbc15('0x98')][_0xbc15('0xa0')]){return db[_0xbc15('0x70')][_0xbc15('0x52')]({'attributes':['id',_0xbc15('0x36')],'where':{'id':_0x10f431['interaction'][_0xbc15('0xa0')]}})[_0xbc15('0x32')](function(_0x5a8464){if(_0x5a8464){_0x10f431['applications'][_0xbc15('0xa1')]({'id':0x0,'priority':0x0,'app':_0xbc15('0xa2'),'appdata':_0x5a8464[_0xbc15('0x36')]+','+(_0x10f431['account']['waitForTheAssignedAgent']||0xa),'interval':_0xbc15('0x9d')});}return respondWithRpcPromise(_0xbc15('0xa3'),_0xbc15('0xa4'),_0x10f431);});}return respondWithRpcPromise(_0xbc15('0xa3'),_0xbc15('0xa4'),_0x10f431);})[_0xbc15('0x32')](function(_0x469d12){if(_0x469d12){var _0x2ffefc=0xc8;var _0x29f863=_0xbc15('0xa5');logger[_0xbc15('0x20')](_0xbc15('0xa6'),_0x29f863,_0x2ffefc,'entity\x20found');logger[_0xbc15('0x22')](_0xbc15('0xa7'),_0x29f863,_0x2ffefc,'entity\x20found',JSON['stringify'](_0x469d12));if(_0x10f431[_0xbc15('0x7c')][_0xbc15('0x3e')]==='twilio'){return _0x2d4d31[_0xbc15('0x28')](_0x2ffefc)[_0xbc15('0x2e')](_0xbc15('0xa8'),_0xbc15('0xa9'))[_0xbc15('0xaa')](_0xbc15('0xab'));}else{return _0x2d4d31[_0xbc15('0x28')](_0x2ffefc)['json'](_0x469d12);}}})['catch'](handleError(_0x2d4d31,null));};exports[_0xbc15('0xaa')]=function(_0x592cd0,_0x3f3e3d,_0x3017bb){var _0x3403de,_0x1f6803,_0x5616f4;if(_[_0xbc15('0x8c')](_0x592cd0[_0xbc15('0x53')]['body'])||_0x592cd0[_0xbc15('0x53')][_0xbc15('0x53')]===''){throw new db['Sequelize'][(_0xbc15('0x7e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xbc15('0x8c')](_0x592cd0[_0xbc15('0x53')]['to'])){throw new db[(_0xbc15('0x7d'))][(_0xbc15('0x7e'))](_0xbc15('0xac'));}_0x3403de=_0x592cd0[_0xbc15('0x53')]['to'];return db[_0xbc15('0x3b')][_0xbc15('0x52')]({'where':{'id':_0x592cd0[_0xbc15('0x4e')]['id']},'include':[{'model':db[_0xbc15('0x90')],'as':'List','include':[{'model':db[_0xbc15('0x95')],'as':'Contacts','where':{'mobile':_0x3403de},'limit':0x1,'order':[[_0xbc15('0x80'),_0xbc15('0x91')]]}]}]})['then'](handleEntityNotFound(_0x3f3e3d,null))[_0xbc15('0x32')](function(_0x4ed102){if(_0x4ed102&&_0x4ed102[_0xbc15('0xad')]){_0x1f6803=_0x4ed102[_0xbc15('0x99')]({'plain':!![]});if(_0x1f6803['List']&&_0x1f6803[_0xbc15('0xad')]['Contacts'][_0xbc15('0x44')]){return _0x1f6803[_0xbc15('0xad')][_0xbc15('0x93')][0x0];}return db[_0xbc15('0x95')][_0xbc15('0x5c')](_[_0xbc15('0x94')](_0x592cd0[_0xbc15('0x53')],{'firstName':_0x3403de,'mobile':_0x3403de,'phone':_0x3403de,'ListId':_0x1f6803['ListId']}));}})[_0xbc15('0x32')](handleEntityNotFound(_0x3f3e3d,null))[_0xbc15('0x32')](function(_0x26e665){if(_0x26e665){_0x5616f4=_0x26e665;return db['WhatsappInteraction'][_0xbc15('0x52')]({'where':{'ContactId':_0x5616f4['id'],'closed':![],'WhatsappAccountId':_0x1f6803['id']}})[_0xbc15('0x32')](function(_0x6122f2){if(_0x6122f2){return[_0x6122f2,![]];}return db['WhatsappInteraction']['create']({'UserId':_0x592cd0[_0xbc15('0x54')]['id'],'ContactId':_0x5616f4['id'],'WhatsappAccountId':_0x1f6803['id'],'phone':_0x3403de,'firstMsgDirection':'out','Messages':[_[_0xbc15('0x4a')](_0x592cd0[_0xbc15('0x53')],{'read':![],'body':_0x592cd0[_0xbc15('0x53')][_0xbc15('0x53')],'phone':_0x3403de,'WhatsappAccountId':_0x1f6803['id'],'UserId':_0x592cd0[_0xbc15('0x54')]['id'],'ContactId':_0x5616f4['id']})]},{'include':[{'model':db[_0xbc15('0x9e')],'as':'Messages'}]})['then'](function(_0x51d996){return[_0x51d996,!![]];});});}})[_0xbc15('0x6a')](function(_0x4949d8,_0x50f947){if(_0x50f947){return _0x4949d8;}return db[_0xbc15('0x9e')][_0xbc15('0x5c')](_[_0xbc15('0x4a')](_0x592cd0[_0xbc15('0x53')],{'read':![],'body':_0x592cd0[_0xbc15('0x53')][_0xbc15('0x53')],'phone':_0x3403de,'WhatsappAccountId':_0x1f6803['id'],'WhatsappInteractionId':_0x4949d8['id'],'UserId':_0x592cd0['user']['id'],'ContactId':_0x5616f4['id']}))[_0xbc15('0x32')](function(_0x47419a){_0x4949d8[_0xbc15('0xae')][_0xbc15('0xaf')]=[];_0x4949d8['dataValues'][_0xbc15('0xaf')][_0xbc15('0xb0')](_0x47419a[_0xbc15('0xae')]);return _0x4949d8;});})[_0xbc15('0x32')](respondWithResult(_0x3f3e3d,null))[_0xbc15('0x27')](handleError(_0x3f3e3d,null));}; \ No newline at end of file +var _0x8e11=['get','role','WhatsappAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','pick','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','spread','removeAgents','isArray','userWhatsappAccount:remove','emit','getAgents','addApplications','sequelize','transaction','WhatsappApplication','findAndCountAll','priority','getApplications','whatsapp','Applications','account','applications','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','from','From','replace','whatsapp:','Body','messageId','MessageSid','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','DESC','list','omit','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s','debug','entity\x20found','stringify','twilio','set','Content-Type','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','CmList','List','out','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','register','http','request','then','info','request\x20sent','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','status','undefined','limit','count','offset','Content-Range','json','apply','save','update','destroy','UserProfileResource','sendStatus','stack','name','send','index','Pause','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','WhatsappAccount','findAll','rows','show','params','rawAttributes','include','find','create','body','user'];(function(_0x43b4dc,_0x1fa993){var _0x4c5f77=function(_0x190e14){while(--_0x190e14){_0x43b4dc['push'](_0x43b4dc['shift']());}};_0x4c5f77(++_0x1fa993);}(_0x8e11,0x11d));var _0x18e1=function(_0xa0717d,_0x5e00c2){_0xa0717d=_0xa0717d-0x0;var _0x348eff=_0x8e11[_0xa0717d];return _0x348eff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x18e1('0x0'));var zipdir=require(_0x18e1('0x1'));var jsonpatch=require(_0x18e1('0x2'));var rp=require(_0x18e1('0x3'));var moment=require(_0x18e1('0x4'));var BPromise=require(_0x18e1('0x5'));var Mustache=require('mustache');var util=require(_0x18e1('0x6'));var path=require(_0x18e1('0x7'));var sox=require(_0x18e1('0x8'));var csv=require(_0x18e1('0x9'));var ejs=require(_0x18e1('0xa'));var fs=require('fs');var fs_extra=require(_0x18e1('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x18e1('0xc'));var jsforce=require(_0x18e1('0xd'));var deskjs=require(_0x18e1('0xe'));var toCsv=require(_0x18e1('0x9'));var querystring=require('querystring');var Papa=require(_0x18e1('0xf'));var Redis=require(_0x18e1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x18e1('0x11'));var as=require(_0x18e1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x18e1('0x13'))('api');var utils=require(_0x18e1('0x14'));var config=require(_0x18e1('0x15'));var licenseUtil=require(_0x18e1('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x18e1('0x17')](config[_0x18e1('0x18')],{'host':_0x18e1('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x18e1('0x18')]));require('./whatsappAccount.socket')[_0x18e1('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x18e1('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x31c0dc,_0x3c8e50,_0x47e05c,_0x4a198c){return new BPromise(function(_0x596628,_0x32c086){var _0x4c866b=_0x4a198c||client;return _0x4c866b[_0x18e1('0x1c')](_0x31c0dc,_0x47e05c)[_0x18e1('0x1d')](function(_0xbf7c93){logger[_0x18e1('0x1e')]('WhatsappAccount,\x20%s,\x20%s',_0x3c8e50,_0x18e1('0x1f'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x3c8e50,'request\x20sent',JSON['stringify'](_0xbf7c93));if(_0xbf7c93[_0x18e1('0x20')]){if(_0xbf7c93[_0x18e1('0x20')][_0x18e1('0x21')]===0x1f4){logger[_0x18e1('0x20')](_0x18e1('0x22'),_0x3c8e50,_0xbf7c93[_0x18e1('0x20')][_0x18e1('0x23')]);return _0x32c086(_0xbf7c93[_0x18e1('0x20')][_0x18e1('0x23')]);}logger[_0x18e1('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x3c8e50,_0xbf7c93['error']['message']);return _0x596628(_0xbf7c93[_0x18e1('0x20')][_0x18e1('0x23')]);}else{logger[_0x18e1('0x1e')](_0x18e1('0x22'),_0x3c8e50,'request\x20sent');_0x596628(_0xbf7c93[_0x18e1('0x24')][_0x18e1('0x23')]);}})[_0x18e1('0x25')](function(_0x3138e1){logger[_0x18e1('0x20')](_0x18e1('0x22'),_0x3c8e50,_0x3138e1);_0x32c086(_0x3138e1);});});}function respondWithStatusCode(_0x2140f5,_0x330a3b){_0x330a3b=_0x330a3b||0xcc;return function(_0x1be49a){if(_0x1be49a){return _0x2140f5['sendStatus'](_0x330a3b);}return _0x2140f5[_0x18e1('0x26')](_0x330a3b)['end']();};}function respondWithResult(_0x1efbc9,_0x451b92){_0x451b92=_0x451b92||0xc8;return function(_0x41282b){if(_0x41282b){return _0x1efbc9[_0x18e1('0x26')](_0x451b92)['json'](_0x41282b);}};}function respondWithFilteredResult(_0x3c82d7,_0x4aebd7){return function(_0x645876){if(_0x645876){var _0x253eb6=typeof _0x4aebd7['offset']===_0x18e1('0x27')&&typeof _0x4aebd7[_0x18e1('0x28')]===_0x18e1('0x27');var _0x4cf1d7=_0x645876[_0x18e1('0x29')];var _0x49e54f=_0x253eb6?0x0:_0x4aebd7[_0x18e1('0x2a')];var _0x4ee62b=_0x253eb6?_0x645876[_0x18e1('0x29')]:_0x4aebd7[_0x18e1('0x2a')]+_0x4aebd7['limit'];var _0x422970;if(_0x4ee62b>=_0x4cf1d7){_0x4ee62b=_0x4cf1d7;_0x422970=0xc8;}else{_0x422970=0xce;}_0x3c82d7[_0x18e1('0x26')](_0x422970);return _0x3c82d7['set'](_0x18e1('0x2b'),_0x49e54f+'-'+_0x4ee62b+'/'+_0x4cf1d7)[_0x18e1('0x2c')](_0x645876);}return null;};}function patchUpdates(_0x51182c){return function(_0x6c62d7){try{jsonpatch[_0x18e1('0x2d')](_0x6c62d7,_0x51182c,!![]);}catch(_0x285fad){return BPromise['reject'](_0x285fad);}return _0x6c62d7[_0x18e1('0x2e')]();};}function saveUpdates(_0x4219cd,_0x3f331e){return function(_0x34ff3a){if(_0x34ff3a){return _0x34ff3a[_0x18e1('0x2f')](_0x4219cd)['then'](function(_0x19b462){return _0x19b462;});}return null;};}function removeEntity(_0x1342e4,_0x46caac){return function(_0x29dfb0){if(_0x29dfb0){return _0x29dfb0[_0x18e1('0x30')]()[_0x18e1('0x1d')](function(){var _0x355467=_0x29dfb0['get']({'plain':!![]});var _0x913ef0='WhatsappAccounts';return db[_0x18e1('0x31')][_0x18e1('0x30')]({'where':{'type':_0x913ef0,'resourceId':_0x355467['id']}})[_0x18e1('0x1d')](function(){return _0x29dfb0;});})[_0x18e1('0x1d')](function(){_0x1342e4[_0x18e1('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4643d4,_0x3bfec8){return function(_0x5127fa){if(!_0x5127fa){_0x4643d4[_0x18e1('0x32')](0x194);}return _0x5127fa;};}function handleError(_0x2f9add,_0x3059bd){_0x3059bd=_0x3059bd||0x1f4;return function(_0x35e53c){logger[_0x18e1('0x20')](_0x35e53c[_0x18e1('0x33')]);if(_0x35e53c[_0x18e1('0x34')]){delete _0x35e53c['name'];}_0x2f9add[_0x18e1('0x26')](_0x3059bd)[_0x18e1('0x35')](_0x35e53c);};}exports[_0x18e1('0x36')]=function(_0x24cc20,_0x53d573){var _0x251901={'include':[{'model':db[_0x18e1('0x37')],'as':'mandatoryDispositionPause'}]},_0x240fef={},_0x25ac34={'count':0x0,'rows':[]};var _0xf50b71=_[_0x18e1('0x38')](db['WhatsappAccount']['rawAttributes'],function(_0x26ab56){return{'name':_0x26ab56[_0x18e1('0x39')],'type':_0x26ab56[_0x18e1('0x3a')][_0x18e1('0x3b')]};});_0x240fef[_0x18e1('0x3c')]=_[_0x18e1('0x38')](_0xf50b71,_0x18e1('0x34'));_0x240fef['query']=_[_0x18e1('0x3d')](_0x24cc20[_0x18e1('0x3e')]);_0x240fef[_0x18e1('0x3f')]=_[_0x18e1('0x40')](_0x240fef[_0x18e1('0x3c')],_0x240fef['query']);_0x251901[_0x18e1('0x41')]=_[_0x18e1('0x40')](_0x240fef[_0x18e1('0x3c')],qs[_0x18e1('0x42')](_0x24cc20[_0x18e1('0x3e')][_0x18e1('0x42')]));_0x251901[_0x18e1('0x41')]=_0x251901['attributes'][_0x18e1('0x43')]?_0x251901[_0x18e1('0x41')]:_0x240fef[_0x18e1('0x3c')];if(!_0x24cc20['query'][_0x18e1('0x44')](_0x18e1('0x45'))){_0x251901[_0x18e1('0x28')]=qs[_0x18e1('0x28')](_0x24cc20['query']['limit']);_0x251901[_0x18e1('0x2a')]=qs[_0x18e1('0x2a')](_0x24cc20[_0x18e1('0x3e')][_0x18e1('0x2a')]);}_0x251901[_0x18e1('0x46')]=qs['sort'](_0x24cc20['query'][_0x18e1('0x47')]);_0x251901['where']=qs[_0x18e1('0x3f')](_['pick'](_0x24cc20['query'],_0x240fef[_0x18e1('0x3f')]),_0xf50b71);if(_0x24cc20[_0x18e1('0x3e')][_0x18e1('0x48')]){_0x251901['where']=_[_0x18e1('0x49')](_0x251901[_0x18e1('0x4a')],{'$or':_[_0x18e1('0x38')](_0xf50b71,function(_0x3b1614){if(_0x3b1614['type']!==_0x18e1('0x4b')){var _0x10877b={};_0x10877b[_0x3b1614['name']]={'$like':'%'+_0x24cc20[_0x18e1('0x3e')][_0x18e1('0x48')]+'%'};return _0x10877b;}})});}_0x251901=_[_0x18e1('0x49')]({},_0x251901,_0x24cc20[_0x18e1('0x4c')]);var _0x93d7bb={'where':_0x251901[_0x18e1('0x4a')]};return db['WhatsappAccount']['count'](_0x93d7bb)['then'](function(_0x5128ff){_0x25ac34[_0x18e1('0x29')]=_0x5128ff;if(_0x24cc20[_0x18e1('0x3e')][_0x18e1('0x4d')]){_0x251901['include']=[{'all':!![]}];}return db[_0x18e1('0x4e')][_0x18e1('0x4f')](_0x251901);})['then'](function(_0x1900dc){_0x25ac34[_0x18e1('0x50')]=_0x1900dc;return _0x25ac34;})[_0x18e1('0x1d')](respondWithFilteredResult(_0x53d573,_0x251901))[_0x18e1('0x25')](handleError(_0x53d573,null));};exports[_0x18e1('0x51')]=function(_0x147718,_0x85ad92){var _0x286f37={'raw':![],'where':{'id':_0x147718[_0x18e1('0x52')]['id']},'include':[{'model':db[_0x18e1('0x37')],'as':'mandatoryDispositionPause'}]},_0x1be2b4={};_0x1be2b4[_0x18e1('0x3c')]=_['keys'](db['WhatsappAccount'][_0x18e1('0x53')]);_0x1be2b4[_0x18e1('0x3e')]=_[_0x18e1('0x3d')](_0x147718['query']);_0x1be2b4['filters']=_[_0x18e1('0x40')](_0x1be2b4[_0x18e1('0x3c')],_0x1be2b4['query']);_0x286f37[_0x18e1('0x41')]=_[_0x18e1('0x40')](_0x1be2b4[_0x18e1('0x3c')],qs[_0x18e1('0x42')](_0x147718[_0x18e1('0x3e')][_0x18e1('0x42')]));_0x286f37[_0x18e1('0x41')]=_0x286f37[_0x18e1('0x41')][_0x18e1('0x43')]?_0x286f37[_0x18e1('0x41')]:_0x1be2b4[_0x18e1('0x3c')];if(_0x147718[_0x18e1('0x3e')][_0x18e1('0x4d')]){_0x286f37[_0x18e1('0x54')]=[{'all':!![]}];}_0x286f37=_[_0x18e1('0x49')]({},_0x286f37,_0x147718[_0x18e1('0x4c')]);return db[_0x18e1('0x4e')][_0x18e1('0x55')](_0x286f37)[_0x18e1('0x1d')](handleEntityNotFound(_0x85ad92,null))[_0x18e1('0x1d')](respondWithResult(_0x85ad92,null))['catch'](handleError(_0x85ad92,null));};exports[_0x18e1('0x56')]=function(_0x2aa0bb,_0x2d5351){return db[_0x18e1('0x4e')][_0x18e1('0x56')](_0x2aa0bb[_0x18e1('0x57')],{})['then'](function(_0x479c52){var _0x383071=_0x2aa0bb[_0x18e1('0x58')][_0x18e1('0x59')]({'plain':!![]});if(!_0x383071)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x383071[_0x18e1('0x5a')]===_0x18e1('0x58')){var _0x437bcb=_0x479c52['get']({'plain':!![]});var _0x3eab7b=_0x18e1('0x5b');return db['UserProfileSection'][_0x18e1('0x55')]({'where':{'name':_0x3eab7b,'userProfileId':_0x383071[_0x18e1('0x5c')]},'raw':!![]})['then'](function(_0x57e4d5){if(_0x57e4d5&&_0x57e4d5[_0x18e1('0x5d')]===0x0){return db[_0x18e1('0x31')]['create']({'name':_0x437bcb[_0x18e1('0x34')],'resourceId':_0x437bcb['id'],'type':_0x57e4d5[_0x18e1('0x34')],'sectionId':_0x57e4d5['id']},{})[_0x18e1('0x1d')](function(){return _0x479c52;});}else{return _0x479c52;}})[_0x18e1('0x25')](function(_0xfead0d){logger['error'](_0x18e1('0x5e'),_0xfead0d);throw _0xfead0d;});}return _0x479c52;})[_0x18e1('0x1d')](respondWithResult(_0x2d5351,0xc9))[_0x18e1('0x25')](handleError(_0x2d5351,null));};exports['update']=function(_0x44840c,_0xcd2d40){if(_0x44840c[_0x18e1('0x57')]['id']){delete _0x44840c[_0x18e1('0x57')]['id'];}return db['WhatsappAccount'][_0x18e1('0x55')]({'where':{'id':_0x44840c[_0x18e1('0x52')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0xcd2d40,null))['then'](saveUpdates(_0x44840c[_0x18e1('0x57')],null))[_0x18e1('0x1d')](respondWithResult(_0xcd2d40,null))['catch'](handleError(_0xcd2d40,null));};exports['destroy']=function(_0x115fa1,_0x1b382f){return db['WhatsappAccount'][_0x18e1('0x55')]({'where':{'id':_0x115fa1['params']['id']}})[_0x18e1('0x1d')](handleEntityNotFound(_0x1b382f,null))[_0x18e1('0x1d')](removeEntity(_0x1b382f,null))[_0x18e1('0x25')](handleError(_0x1b382f,null));};exports[_0x18e1('0x5f')]=function(_0x57526b,_0x54322d){return db[_0x18e1('0x4e')][_0x18e1('0x5f')]()[_0x18e1('0x1d')](respondWithResult(_0x54322d,null))[_0x18e1('0x25')](handleError(_0x54322d,null));};exports[_0x18e1('0x60')]=function(_0x433b6f,_0x35c67a,_0x1a09fe){if(_0x433b6f[_0x18e1('0x57')]['id']){delete _0x433b6f[_0x18e1('0x57')]['id'];}return db[_0x18e1('0x4e')][_0x18e1('0x55')]({'where':{'id':_0x433b6f[_0x18e1('0x52')]['id']}})[_0x18e1('0x1d')](handleEntityNotFound(_0x35c67a,null))[_0x18e1('0x1d')](function(_0x36242f){if(_0x36242f){_0x433b6f['body'][_0x18e1('0x61')]=_0x36242f['id'];return db[_0x18e1('0x62')]['create'](_0x433b6f[_0x18e1('0x57')]);}})[_0x18e1('0x1d')](respondWithResult(_0x35c67a,null))['catch'](handleError(_0x35c67a,null));};exports[_0x18e1('0x63')]=function(_0x57cc9d,_0x3cda2f,_0x4662a4){var _0x4fb3b9={'raw':![],'where':{}};var _0x11e5b9={};var _0x2e940b={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x18e1('0x64')]({'where':{'id':_0x57cc9d[_0x18e1('0x52')]['id']}})['then'](handleEntityNotFound(_0x3cda2f,null))[_0x18e1('0x1d')](function(_0x14a0d5){if(_0x14a0d5){_0x11e5b9[_0x18e1('0x3c')]=_[_0x18e1('0x3d')](db['Disposition']['rawAttributes']);_0x11e5b9[_0x18e1('0x3e')]=_[_0x18e1('0x3d')](_0x57cc9d[_0x18e1('0x3e')]);_0x11e5b9[_0x18e1('0x3f')]=_['intersection'](_0x11e5b9['model'],_0x11e5b9['query']);_0x4fb3b9['attributes']=_['intersection'](_0x11e5b9[_0x18e1('0x3c')],qs['fields'](_0x57cc9d['query'][_0x18e1('0x42')]));_0x4fb3b9[_0x18e1('0x41')]=_0x4fb3b9[_0x18e1('0x41')][_0x18e1('0x43')]?_0x4fb3b9[_0x18e1('0x41')]:_0x11e5b9[_0x18e1('0x3c')];if(!_0x57cc9d[_0x18e1('0x3e')][_0x18e1('0x44')](_0x18e1('0x45'))){_0x4fb3b9[_0x18e1('0x28')]=qs[_0x18e1('0x28')](_0x57cc9d['query']['limit']);_0x4fb3b9[_0x18e1('0x2a')]=qs['offset'](_0x57cc9d[_0x18e1('0x3e')][_0x18e1('0x2a')]);}_0x4fb3b9['order']=qs[_0x18e1('0x47')](_0x57cc9d[_0x18e1('0x3e')][_0x18e1('0x47')]);_0x4fb3b9[_0x18e1('0x4a')]=qs[_0x18e1('0x3f')](_[_0x18e1('0x65')](_0x57cc9d[_0x18e1('0x3e')],_0x11e5b9[_0x18e1('0x3f')]));_0x4fb3b9[_0x18e1('0x4a')][_0x18e1('0x61')]=_0x14a0d5['id'];if(_0x57cc9d['query'][_0x18e1('0x48')]){_0x4fb3b9['where']=_[_0x18e1('0x49')](_0x4fb3b9[_0x18e1('0x4a')],{'$or':_[_0x18e1('0x38')](_0x4fb3b9[_0x18e1('0x41')],function(_0x435f3d){var _0x211727={};_0x211727[_0x435f3d]={'$like':'%'+_0x57cc9d[_0x18e1('0x3e')]['filter']+'%'};return _0x211727;})});}_0x4fb3b9=_[_0x18e1('0x49')]({},_0x4fb3b9,_0x57cc9d[_0x18e1('0x4c')]);return db['Disposition']['count']({'where':_0x4fb3b9[_0x18e1('0x4a')]})[_0x18e1('0x1d')](function(_0x451dd1){_0x2e940b['count']=_0x451dd1;if(_0x57cc9d[_0x18e1('0x3e')][_0x18e1('0x4d')]){_0x4fb3b9[_0x18e1('0x54')]=[{'all':!![]}];}return db[_0x18e1('0x62')][_0x18e1('0x4f')](_0x4fb3b9);})[_0x18e1('0x1d')](function(_0x3b85b2){_0x2e940b[_0x18e1('0x50')]=_0x3b85b2;return _0x2e940b;});}})[_0x18e1('0x1d')](respondWithFilteredResult(_0x3cda2f,_0x4fb3b9))[_0x18e1('0x25')](handleError(_0x3cda2f,null));};exports[_0x18e1('0x66')]=function(_0x560810,_0x1bea7f,_0x5d9ab6){return db[_0x18e1('0x4e')][_0x18e1('0x55')]({'where':{'id':_0x560810[_0x18e1('0x52')]['id']}})[_0x18e1('0x1d')](handleEntityNotFound(_0x1bea7f,null))[_0x18e1('0x1d')](function(_0x3b65ee){if(_0x3b65ee){return _0x3b65ee['removeDispositions'](_0x560810[_0x18e1('0x3e')]['ids']);}})[_0x18e1('0x1d')](respondWithStatusCode(_0x1bea7f,null))[_0x18e1('0x25')](handleError(_0x1bea7f,null));};exports[_0x18e1('0x67')]=function(_0xfb98c6,_0x10f296,_0x1ee18e){if(_0xfb98c6['body']['id']){delete _0xfb98c6['body']['id'];}return db[_0x18e1('0x4e')][_0x18e1('0x55')]({'where':{'id':_0xfb98c6[_0x18e1('0x52')]['id']}})[_0x18e1('0x1d')](handleEntityNotFound(_0x10f296,null))[_0x18e1('0x1d')](function(_0x478259){if(_0x478259){_0xfb98c6[_0x18e1('0x57')][_0x18e1('0x61')]=_0x478259['id'];return db[_0x18e1('0x68')][_0x18e1('0x56')](_0xfb98c6[_0x18e1('0x57')]);}})[_0x18e1('0x1d')](respondWithResult(_0x10f296,null))['catch'](handleError(_0x10f296,null));};exports[_0x18e1('0x69')]=function(_0x35391b,_0x254e7b,_0x49da82){var _0x559283={'raw':![],'where':{}};var _0x2f9178={};var _0x1898a2={'count':0x0,'rows':[]};return db[_0x18e1('0x4e')][_0x18e1('0x64')]({'where':{'id':_0x35391b[_0x18e1('0x52')]['id']}})[_0x18e1('0x1d')](handleEntityNotFound(_0x254e7b,null))[_0x18e1('0x1d')](function(_0x32e7b0){if(_0x32e7b0){_0x2f9178[_0x18e1('0x3c')]=_['keys'](db['CannedAnswer'][_0x18e1('0x53')]);_0x2f9178[_0x18e1('0x3e')]=_['keys'](_0x35391b['query']);_0x2f9178[_0x18e1('0x3f')]=_[_0x18e1('0x40')](_0x2f9178[_0x18e1('0x3c')],_0x2f9178[_0x18e1('0x3e')]);_0x559283[_0x18e1('0x41')]=_[_0x18e1('0x40')](_0x2f9178[_0x18e1('0x3c')],qs['fields'](_0x35391b[_0x18e1('0x3e')][_0x18e1('0x42')]));_0x559283['attributes']=_0x559283[_0x18e1('0x41')]['length']?_0x559283[_0x18e1('0x41')]:_0x2f9178[_0x18e1('0x3c')];if(!_0x35391b['query'][_0x18e1('0x44')](_0x18e1('0x45'))){_0x559283[_0x18e1('0x28')]=qs['limit'](_0x35391b[_0x18e1('0x3e')][_0x18e1('0x28')]);_0x559283[_0x18e1('0x2a')]=qs['offset'](_0x35391b[_0x18e1('0x3e')][_0x18e1('0x2a')]);}_0x559283[_0x18e1('0x46')]=qs[_0x18e1('0x47')](_0x35391b[_0x18e1('0x3e')][_0x18e1('0x47')]);_0x559283[_0x18e1('0x4a')]=qs[_0x18e1('0x3f')](_[_0x18e1('0x65')](_0x35391b[_0x18e1('0x3e')],_0x2f9178['filters']));_0x559283['where']['WhatsappAccountId']=_0x32e7b0['id'];if(_0x35391b[_0x18e1('0x3e')][_0x18e1('0x48')]){_0x559283['where']=_[_0x18e1('0x49')](_0x559283[_0x18e1('0x4a')],{'$or':_['map'](_0x559283[_0x18e1('0x41')],function(_0x240c00){var _0x38647b={};_0x38647b[_0x240c00]={'$like':'%'+_0x35391b[_0x18e1('0x3e')][_0x18e1('0x48')]+'%'};return _0x38647b;})});}_0x559283=_[_0x18e1('0x49')]({},_0x559283,_0x35391b[_0x18e1('0x4c')]);return db[_0x18e1('0x68')][_0x18e1('0x29')]({'where':_0x559283[_0x18e1('0x4a')]})['then'](function(_0x18362c){_0x1898a2['count']=_0x18362c;if(_0x35391b['query']['includeAll']){_0x559283['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x559283);})['then'](function(_0x19d254){_0x1898a2[_0x18e1('0x50')]=_0x19d254;return _0x1898a2;});}})['then'](respondWithFilteredResult(_0x254e7b,_0x559283))[_0x18e1('0x25')](handleError(_0x254e7b,null));};exports[_0x18e1('0x6a')]=function(_0x48bd27,_0x405130,_0x5c6e9b){return db[_0x18e1('0x4e')][_0x18e1('0x55')]({'where':{'id':_0x48bd27[_0x18e1('0x52')]['id']}})[_0x18e1('0x1d')](handleEntityNotFound(_0x405130,null))[_0x18e1('0x1d')](function(_0x46268f){if(_0x46268f){return _0x46268f['removeAnswers'](_0x48bd27[_0x18e1('0x3e')][_0x18e1('0x6b')]);}})[_0x18e1('0x1d')](respondWithStatusCode(_0x405130,null))[_0x18e1('0x25')](handleError(_0x405130,null));};exports['addAgents']=function(_0x2a8b37,_0x2e7264,_0x23350f){return db[_0x18e1('0x4e')][_0x18e1('0x55')]({'where':{'id':_0x2a8b37[_0x18e1('0x52')]['id']}})[_0x18e1('0x1d')](handleEntityNotFound(_0x2e7264,null))[_0x18e1('0x1d')](function(_0x50ac11){if(_0x50ac11){return _0x50ac11[_0x18e1('0x6c')](_0x2a8b37['body'][_0x18e1('0x6b')],_['omit'](_0x2a8b37['body'],[_0x18e1('0x6b'),'id'])||{})[_0x18e1('0x6d')](function(_0x50705d){for(var _0x1a37db=0x0;_0x1a37db<_0x2a8b37[_0x18e1('0x57')]['ids'][_0x18e1('0x43')];_0x1a37db+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':Number(_0x2a8b37[_0x18e1('0x57')][_0x18e1('0x6b')][_0x1a37db]),'WhatsappAccountId':Number(_0x2a8b37['params']['id'])});}return _0x50705d;});}})[_0x18e1('0x1d')](respondWithResult(_0x2e7264,null))['catch'](handleError(_0x2e7264,null));};exports['removeAgents']=function(_0x112f71,_0x392f7d,_0x16dbcf){return db[_0x18e1('0x4e')][_0x18e1('0x55')]({'where':{'id':_0x112f71[_0x18e1('0x52')]['id']}})['then'](handleEntityNotFound(_0x392f7d,null))[_0x18e1('0x1d')](function(_0x173ab9){if(_0x173ab9){return _0x173ab9[_0x18e1('0x6e')](_0x112f71['query'][_0x18e1('0x6b')])[_0x18e1('0x1d')](function(){if(_[_0x18e1('0x6f')](_0x112f71[_0x18e1('0x3e')][_0x18e1('0x6b')])){for(var _0x60946e=0x0;_0x60946e<_0x112f71[_0x18e1('0x3e')][_0x18e1('0x6b')][_0x18e1('0x43')];_0x60946e+=0x1){socket['emit'](_0x18e1('0x70'),{'UserId':Number(_0x112f71['query'][_0x18e1('0x6b')][_0x60946e]),'WhatsappAccountId':Number(_0x112f71[_0x18e1('0x52')]['id'])});}}else{socket[_0x18e1('0x71')](_0x18e1('0x70'),{'UserId':Number(_0x112f71[_0x18e1('0x3e')][_0x18e1('0x6b')]),'WhatsappAccountId':Number(_0x112f71[_0x18e1('0x52')]['id'])});}});}})[_0x18e1('0x1d')](respondWithStatusCode(_0x392f7d,null))['catch'](handleError(_0x392f7d,null));};exports[_0x18e1('0x72')]=function(_0x28bf60,_0x57da71,_0x2a9582){var _0x567e0d={};var _0x391887={};var _0x337ef2;var _0x12b61a;return db[_0x18e1('0x4e')][_0x18e1('0x64')]({'where':{'id':_0x28bf60[_0x18e1('0x52')]['id']}})[_0x18e1('0x1d')](handleEntityNotFound(_0x57da71,null))[_0x18e1('0x1d')](function(_0x25e2ba){if(_0x25e2ba){_0x337ef2=_0x25e2ba;_0x391887['model']=_['keys'](db['User'][_0x18e1('0x53')]);_0x391887[_0x18e1('0x3e')]=_[_0x18e1('0x3d')](_0x28bf60[_0x18e1('0x3e')]);_0x391887[_0x18e1('0x3f')]=_[_0x18e1('0x40')](_0x391887['model'],_0x391887[_0x18e1('0x3e')]);_0x567e0d[_0x18e1('0x41')]=_[_0x18e1('0x40')](_0x391887[_0x18e1('0x3c')],qs[_0x18e1('0x42')](_0x28bf60[_0x18e1('0x3e')][_0x18e1('0x42')]));_0x567e0d[_0x18e1('0x41')]=_0x567e0d['attributes'][_0x18e1('0x43')]?_0x567e0d['attributes']:_0x391887[_0x18e1('0x3c')];_0x567e0d[_0x18e1('0x46')]=qs[_0x18e1('0x47')](_0x28bf60[_0x18e1('0x3e')][_0x18e1('0x47')]);_0x567e0d[_0x18e1('0x4a')]=qs[_0x18e1('0x3f')](_[_0x18e1('0x65')](_0x28bf60[_0x18e1('0x3e')],_0x391887['filters']));if(_0x28bf60[_0x18e1('0x3e')][_0x18e1('0x48')]){_0x567e0d['where']=_[_0x18e1('0x49')](_0x567e0d[_0x18e1('0x4a')],{'$or':_['map'](_0x567e0d[_0x18e1('0x41')],function(_0x1fdfa8){var _0x570aff={};_0x570aff[_0x1fdfa8]={'$like':'%'+_0x28bf60['query']['filter']+'%'};return _0x570aff;})});}_0x567e0d=_['merge']({},_0x567e0d,_0x28bf60['options']);return _0x337ef2[_0x18e1('0x72')](_0x567e0d);}})['then'](function(_0x5752df){if(_0x5752df){_0x12b61a=_0x5752df[_0x18e1('0x43')];if(!_0x28bf60[_0x18e1('0x3e')][_0x18e1('0x44')](_0x18e1('0x45'))){_0x567e0d['limit']=qs[_0x18e1('0x28')](_0x28bf60[_0x18e1('0x3e')][_0x18e1('0x28')]);_0x567e0d[_0x18e1('0x2a')]=qs[_0x18e1('0x2a')](_0x28bf60[_0x18e1('0x3e')][_0x18e1('0x2a')]);}return _0x337ef2[_0x18e1('0x72')](_0x567e0d);}})['then'](function(_0x78a4ce){if(_0x78a4ce){return _0x78a4ce?{'count':_0x12b61a,'rows':_0x78a4ce}:null;}})[_0x18e1('0x1d')](respondWithResult(_0x57da71,null))['catch'](handleError(_0x57da71,null));};exports[_0x18e1('0x73')]=function(_0x1cfd50,_0x304075,_0x590aba){return db['WhatsappAccount'][_0x18e1('0x64')]({'where':{'id':_0x1cfd50[_0x18e1('0x52')]['id']}})[_0x18e1('0x1d')](handleEntityNotFound(_0x304075,null))[_0x18e1('0x1d')](function(_0x249a34){if(_0x249a34){return db[_0x18e1('0x74')][_0x18e1('0x75')](function(_0x573d70){return db['WhatsappApplication'][_0x18e1('0x30')]({'where':{'WhatsappAccountId':_0x1cfd50[_0x18e1('0x52')]['id']},'transaction':_0x573d70})['then'](function(_0x1cc5e5){var _0x588af1=_['map'](_0x1cfd50[_0x18e1('0x57')],function(_0x152943){_0x152943['WhatsappAccountId']=_0x1cfd50['params']['id'];return _0x152943;});return db[_0x18e1('0x76')]['bulkCreate'](_0x588af1,{'transaction':_0x573d70});});})[_0x18e1('0x1d')](function(){return db[_0x18e1('0x76')][_0x18e1('0x77')]({'where':{'WhatsappAccountId':_0x1cfd50[_0x18e1('0x52')]['id']},'order':_0x18e1('0x78')});});}})['then'](respondWithResult(_0x304075,null))[_0x18e1('0x25')](handleError(_0x304075,null));};exports[_0x18e1('0x79')]=function(_0x505d8d,_0x2cc5ae,_0x4e2bf5){var _0x592a95={};var _0x35cbb7={};var _0x396fa5;var _0x3d895f;return db[_0x18e1('0x4e')]['findOne']({'where':{'id':_0x505d8d['params']['id']}})[_0x18e1('0x1d')](handleEntityNotFound(_0x2cc5ae,null))[_0x18e1('0x1d')](function(_0xc0308d){if(_0xc0308d){_0x396fa5=_0xc0308d;_0x35cbb7[_0x18e1('0x3c')]=_[_0x18e1('0x3d')](db[_0x18e1('0x76')][_0x18e1('0x53')]);_0x35cbb7[_0x18e1('0x3e')]=_[_0x18e1('0x3d')](_0x505d8d['query']);_0x35cbb7[_0x18e1('0x3f')]=_[_0x18e1('0x40')](_0x35cbb7[_0x18e1('0x3c')],_0x35cbb7[_0x18e1('0x3e')]);_0x592a95[_0x18e1('0x41')]=_[_0x18e1('0x40')](_0x35cbb7['model'],qs['fields'](_0x505d8d[_0x18e1('0x3e')]['fields']));_0x592a95[_0x18e1('0x41')]=_0x592a95['attributes'][_0x18e1('0x43')]?_0x592a95[_0x18e1('0x41')]:_0x35cbb7[_0x18e1('0x3c')];_0x592a95['order']=qs['sort'](_0x505d8d[_0x18e1('0x3e')]['sort']);_0x592a95[_0x18e1('0x4a')]=qs[_0x18e1('0x3f')](_[_0x18e1('0x65')](_0x505d8d['query'],_0x35cbb7[_0x18e1('0x3f')]));if(_0x505d8d[_0x18e1('0x3e')][_0x18e1('0x48')]){_0x592a95['where']=_['merge'](_0x592a95[_0x18e1('0x4a')],{'$or':_[_0x18e1('0x38')](_0x592a95[_0x18e1('0x41')],function(_0x190a38){var _0x4cac56={};_0x4cac56[_0x190a38]={'$like':'%'+_0x505d8d[_0x18e1('0x3e')]['filter']+'%'};return _0x4cac56;})});}_0x592a95=_['merge']({},_0x592a95,_0x505d8d[_0x18e1('0x4c')]);return _0x396fa5[_0x18e1('0x79')](_0x592a95);}})[_0x18e1('0x1d')](function(_0x3f9200){if(_0x3f9200){_0x3d895f=_0x3f9200[_0x18e1('0x43')];if(!_0x505d8d[_0x18e1('0x3e')][_0x18e1('0x44')](_0x18e1('0x45'))){_0x592a95[_0x18e1('0x28')]=qs[_0x18e1('0x28')](_0x505d8d['query'][_0x18e1('0x28')]);_0x592a95[_0x18e1('0x2a')]=qs['offset'](_0x505d8d[_0x18e1('0x3e')]['offset']);}return _0x396fa5[_0x18e1('0x79')](_0x592a95);}})[_0x18e1('0x1d')](function(_0x5071bb){if(_0x5071bb){return _0x5071bb?{'count':_0x3d895f,'rows':_0x5071bb}:null;}})[_0x18e1('0x1d')](respondWithResult(_0x2cc5ae,null))[_0x18e1('0x25')](handleError(_0x2cc5ae,null));};exports['notify']=function(_0x594125,_0x48404b,_0x187324){var _0x4fefda={'channel':_0x18e1('0x7a')};var _0xe6d0b6=[];var _0x2615fa=[];var _0x124165={};return db[_0x18e1('0x4e')]['find']({'where':{'id':_0x594125['params']['id']},'include':[{'model':db[_0x18e1('0x76')],'as':_0x18e1('0x7b')}]})[_0x18e1('0x1d')](handleEntityNotFound(_0x48404b,null))['then'](function(_0x3b1d63){_0x4fefda[_0x18e1('0x7c')]=_0x3b1d63;_0x4fefda[_0x18e1('0x7d')]=_['orderBy'](_0x3b1d63[_0x18e1('0x7b')],[_0x18e1('0x78')],[_0x18e1('0x7e')]);if(_0x4fefda[_0x18e1('0x7c')][_0x18e1('0x7b')]){delete _0x4fefda[_0x18e1('0x7c')][_0x18e1('0x7b')];}return db[_0x18e1('0x7f')][_0x18e1('0x5f')]();})[_0x18e1('0x1d')](function(_0x3baffb){if(!_0x3baffb){throw new db[(_0x18e1('0x80'))][(_0x18e1('0x81'))](_0x18e1('0x82'));}_0xe6d0b6=_[_0x18e1('0x83')](_[_0x18e1('0x3d')](_0x3baffb),[_0x18e1('0x84'),_0x18e1('0x85')]);_0x2615fa=_[_0x18e1('0x83')](_[_0x18e1('0x3d')](_0x3baffb),[_0x18e1('0x84'),_0x18e1('0x85'),_0x18e1('0x86'),'ListId']);_0x4fefda[_0x18e1('0x57')]={'mapKey':_0x18e1('0x87')};if(_0x4fefda[_0x18e1('0x7c')]['type']&&_0x4fefda[_0x18e1('0x7c')]['type']==='twilio'){_0x4fefda['body'][_0x18e1('0x88')]=_0x594125['body'][_0x18e1('0x89')][_0x18e1('0x8a')](_0x18e1('0x8b'),'');_0x4fefda['body'][_0x18e1('0x57')]=_0x594125[_0x18e1('0x57')][_0x18e1('0x8c')];_0x4fefda[_0x18e1('0x57')][_0x18e1('0x8d')]=_0x594125['body'][_0x18e1('0x8e')];}if(_0x4fefda[_0x18e1('0x57')]['id']){delete _0x4fefda[_0x18e1('0x57')]['id'];}if(_[_0x18e1('0x8f')](_0x4fefda[_0x18e1('0x57')][_0x18e1('0x88')])){throw new db[(_0x18e1('0x80'))][(_0x18e1('0x81'))]('from\x20is\x20mandatory');}if(_[_0x18e1('0x8f')](_0x4fefda[_0x18e1('0x57')][_0x18e1('0x57')])||_0x4fefda[_0x18e1('0x57')][_0x18e1('0x57')]===''){throw new db[(_0x18e1('0x80'))][(_0x18e1('0x81'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x18e1('0x8f')](_0x4fefda['body'][_0x18e1('0x90')])){throw new db[(_0x18e1('0x80'))][(_0x18e1('0x81'))](_0x18e1('0x91')+_0x2615fa);}if(!_[_0x18e1('0x92')](_0x2615fa,_0x4fefda['body']['mapKey'])){throw new db[(_0x18e1('0x80'))]['ValidationError'](_0x18e1('0x93')+_0x2615fa);}_0x124165[_0x4fefda['body']['mapKey']]=_0x4fefda[_0x18e1('0x57')][_0x18e1('0x88')];return db['CmList'][_0x18e1('0x55')]({'where':{'id':_0x4fefda['account'][_0x18e1('0x94')]},'include':[{'model':db[_0x18e1('0x7f')],'as':'Contacts','where':_0x124165,'limit':0x1,'order':[[_0x18e1('0x85'),_0x18e1('0x95')]]}]});})[_0x18e1('0x1d')](handleEntityNotFound(_0x48404b,null))['then'](function(_0x73496){if(_0x73496){_0x4fefda[_0x18e1('0x96')]=_[_0x18e1('0x97')](_0x73496,[_0x18e1('0x98')]);if(_0x73496[_0x18e1('0x98')][_0x18e1('0x43')]){return _0x73496[_0x18e1('0x98')][0x0];}var _0x3e3ddb=_[_0x18e1('0x17')](_0x4fefda[_0x18e1('0x57')],{'firstName':_0x4fefda['body'][_0x18e1('0x88')],'ListId':_0x73496['id']});_0x3e3ddb[_0x4fefda[_0x18e1('0x57')][_0x18e1('0x90')]]=_0x4fefda['body'][_0x18e1('0x88')];return db[_0x18e1('0x7f')][_0x18e1('0x56')](_0x3e3ddb,{'fields':_0xe6d0b6,'raw':!![]});}})[_0x18e1('0x1d')](handleEntityNotFound(_0x48404b,null))[_0x18e1('0x1d')](function(_0x2bc338){if(_0x2bc338){_0x4fefda[_0x18e1('0x99')]=_0x2bc338;var _0x49d11c={'ContactId':_0x2bc338['id'],'phone':_0x4fefda[_0x18e1('0x57')][_0x18e1('0x88')],'WhatsappAccountId':_0x594125[_0x18e1('0x52')]['id']};var _0x4119b8={'ContactId':_0x2bc338['id'],'WhatsappAccountId':_0x594125[_0x18e1('0x52')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x18e1('0x55')]({'where':_0x4119b8})['then'](function(_0x1d605a){if(_0x1d605a){return[_0x1d605a,![]];}return db[_0x18e1('0x9a')][_0x18e1('0x56')](_0x49d11c)[_0x18e1('0x1d')](function(_0x17a0b9){return[_0x17a0b9,!![]];});});}})[_0x18e1('0x6d')](function(_0x2eb17e,_0x4ee03c){_0x4fefda['interaction']=_0x2eb17e[_0x18e1('0x59')]({'plain':!![]});_0x4fefda[_0x18e1('0x9b')][_0x18e1('0x9c')]=![];if(_0x4ee03c){if(_0x4fefda[_0x18e1('0x7c')][_0x18e1('0x9d')]){_0x4fefda[_0x18e1('0x7d')][_0x18e1('0x9e')]({'id':0x0,'priority':_0x4fefda[_0x18e1('0x7d')][_0x18e1('0x43')]+0x1,'app':_0x18e1('0x9f'),'appdata':_0x18e1('0xa0'),'interval':_0x18e1('0xa1')});}_0x4fefda[_0x18e1('0x9b')]['created']=!![];}return db[_0x18e1('0xa2')][_0x18e1('0x56')]({'phone':_0x4fefda[_0x18e1('0x57')]['from'],'messageId':_0x4fefda[_0x18e1('0x57')][_0x18e1('0x8d')],'body':_0x4fefda[_0x18e1('0x57')][_0x18e1('0x57')],'WhatsappAccountId':_0x594125[_0x18e1('0x52')]['id'],'WhatsappInteractionId':_0x2eb17e['id'],'direction':'in','ContactId':_0x2eb17e[_0x18e1('0xa3')],'AttachmentId':_0x4fefda[_0x18e1('0x57')][_0x18e1('0xa4')]});})[_0x18e1('0x1d')](function(_0x38369a){_0x4fefda['message']=_0x38369a;if(_0x4fefda['interaction'][_0x18e1('0xa5')]){return db['User'][_0x18e1('0x55')]({'attributes':['id',_0x18e1('0x34')],'where':{'id':_0x4fefda[_0x18e1('0x9b')][_0x18e1('0xa5')]}})[_0x18e1('0x1d')](function(_0x1d48a9){if(_0x1d48a9){_0x4fefda[_0x18e1('0x7d')][_0x18e1('0xa6')]({'id':0x0,'priority':0x0,'app':_0x18e1('0xa7'),'appdata':_0x1d48a9[_0x18e1('0x34')]+','+(_0x4fefda['account'][_0x18e1('0xa8')]||0xa),'interval':_0x18e1('0xa1')});}return respondWithRpcPromise(_0x18e1('0xa9'),_0x18e1('0xaa'),_0x4fefda);});}return respondWithRpcPromise(_0x18e1('0xa9'),'startRouting',_0x4fefda);})[_0x18e1('0x1d')](function(_0x3dd04a){if(_0x3dd04a){var _0x4c54d9=0xc8;var _0x559ca9='receiveMessage';logger[_0x18e1('0x1e')](_0x18e1('0xab'),_0x559ca9,_0x4c54d9,'entity\x20found');logger[_0x18e1('0xac')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x559ca9,_0x4c54d9,_0x18e1('0xad'),JSON[_0x18e1('0xae')](_0x3dd04a));if(_0x4fefda[_0x18e1('0x7c')][_0x18e1('0x3a')]===_0x18e1('0xaf')){return _0x48404b[_0x18e1('0x26')](_0x4c54d9)[_0x18e1('0xb0')](_0x18e1('0xb1'),_0x18e1('0xb2'))['send'](_0x18e1('0xb3'));}else{return _0x48404b[_0x18e1('0x26')](_0x4c54d9)['json'](_0x3dd04a);}}})[_0x18e1('0x25')](handleError(_0x48404b,null));};exports[_0x18e1('0x35')]=function(_0x4e7deb,_0x3b1534,_0x30abc2){var _0x41b4c7,_0x247ad4,_0x4ad2f3;if(_[_0x18e1('0x8f')](_0x4e7deb['body']['body'])||_0x4e7deb['body'][_0x18e1('0x57')]===''){throw new db['Sequelize']['ValidationError'](_0x18e1('0xb4'));}if(_[_0x18e1('0x8f')](_0x4e7deb[_0x18e1('0x57')]['to'])){throw new db[(_0x18e1('0x80'))]['ValidationError'](_0x18e1('0xb5'));}_0x41b4c7=_0x4e7deb[_0x18e1('0x57')]['to'];return db[_0x18e1('0x4e')][_0x18e1('0x55')]({'where':{'id':_0x4e7deb[_0x18e1('0x52')]['id']},'include':[{'model':db[_0x18e1('0xb6')],'as':'List','include':[{'model':db[_0x18e1('0x7f')],'as':'Contacts','where':{'mobile':_0x41b4c7},'limit':0x1,'order':[[_0x18e1('0x85'),'DESC']]}]}]})[_0x18e1('0x1d')](handleEntityNotFound(_0x3b1534,null))['then'](function(_0x40de93){if(_0x40de93&&_0x40de93[_0x18e1('0xb7')]){_0x247ad4=_0x40de93[_0x18e1('0x59')]({'plain':!![]});if(_0x247ad4['List']&&_0x247ad4[_0x18e1('0xb7')]['Contacts']['length']){return _0x247ad4[_0x18e1('0xb7')]['Contacts'][0x0];}return db[_0x18e1('0x7f')][_0x18e1('0x56')](_[_0x18e1('0x17')](_0x4e7deb[_0x18e1('0x57')],{'firstName':_0x41b4c7,'mobile':_0x41b4c7,'phone':_0x41b4c7,'ListId':_0x247ad4[_0x18e1('0x94')]}));}})[_0x18e1('0x1d')](handleEntityNotFound(_0x3b1534,null))[_0x18e1('0x1d')](function(_0x861b65){if(_0x861b65){_0x4ad2f3=_0x861b65;return db[_0x18e1('0x9a')][_0x18e1('0x55')]({'where':{'ContactId':_0x4ad2f3['id'],'closed':![],'WhatsappAccountId':_0x247ad4['id']}})[_0x18e1('0x1d')](function(_0x3d0d24){if(_0x3d0d24){return[_0x3d0d24,![]];}return db[_0x18e1('0x9a')][_0x18e1('0x56')]({'UserId':_0x4e7deb['user']['id'],'ContactId':_0x4ad2f3['id'],'WhatsappAccountId':_0x247ad4['id'],'phone':_0x41b4c7,'firstMsgDirection':_0x18e1('0xb8'),'Messages':[_['merge'](_0x4e7deb[_0x18e1('0x57')],{'read':![],'body':_0x4e7deb[_0x18e1('0x57')][_0x18e1('0x57')],'phone':_0x41b4c7,'WhatsappAccountId':_0x247ad4['id'],'UserId':_0x4e7deb[_0x18e1('0x58')]['id'],'ContactId':_0x4ad2f3['id']})]},{'include':[{'model':db[_0x18e1('0xa2')],'as':_0x18e1('0xb9')}]})[_0x18e1('0x1d')](function(_0xce035b){return[_0xce035b,!![]];});});}})[_0x18e1('0x6d')](function(_0x2005e5,_0x53bb88){if(_0x53bb88){return _0x2005e5;}return db[_0x18e1('0xa2')][_0x18e1('0x56')](_[_0x18e1('0x49')](_0x4e7deb[_0x18e1('0x57')],{'read':![],'body':_0x4e7deb[_0x18e1('0x57')][_0x18e1('0x57')],'phone':_0x41b4c7,'WhatsappAccountId':_0x247ad4['id'],'WhatsappInteractionId':_0x2005e5['id'],'UserId':_0x4e7deb[_0x18e1('0x58')]['id'],'ContactId':_0x4ad2f3['id']}))['then'](function(_0x16db21){_0x2005e5[_0x18e1('0xba')][_0x18e1('0xb9')]=[];_0x2005e5[_0x18e1('0xba')][_0x18e1('0xb9')][_0x18e1('0x9e')](_0x16db21[_0x18e1('0xba')]);return _0x2005e5;});})[_0x18e1('0x1d')](respondWithResult(_0x3b1534,null))[_0x18e1('0x25')](handleError(_0x3b1534,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index dde98d3..d6b2f6b 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 _0x9999=['WhatsappAccount','setMaxListeners','save','emit','exports','events','../../mysqldb'];(function(_0x51d129,_0x175d7d){var _0x44c377=function(_0x5ee454){while(--_0x5ee454){_0x51d129['push'](_0x51d129['shift']());}};_0x44c377(++_0x175d7d);}(_0x9999,0x178));var _0x9999=function(_0x4771b7,_0x30f53d){_0x4771b7=_0x4771b7-0x0;var _0x1fd27a=_0x9999[_0x4771b7];return _0x1fd27a;};'use strict';var EventEmitter=require(_0x9999('0x0'));var WhatsappAccount=require(_0x9999('0x1'))['db'][_0x9999('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x9999('0x3')](0x0);var events={'afterCreate':_0x9999('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1de090){return function(_0x364700,_0x2f1293,_0xced9dd){WhatsappAccountEvents[_0x9999('0x5')](_0x1de090+':'+_0x364700['id'],_0x364700);WhatsappAccountEvents[_0x9999('0x5')](_0x1de090,_0x364700);_0xced9dd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x9999('0x6')]=WhatsappAccountEvents; \ No newline at end of file +var _0x06b2=['remove','emit','hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners'];(function(_0x3faf77,_0x3a81d6){var _0x307c43=function(_0x1f4ae2){while(--_0x1f4ae2){_0x3faf77['push'](_0x3faf77['shift']());}};_0x307c43(++_0x3a81d6);}(_0x06b2,0xe4));var _0x206b=function(_0x5dd611,_0x1c959e){_0x5dd611=_0x5dd611-0x0;var _0x1ebeca=_0x06b2[_0x5dd611];return _0x1ebeca;};'use strict';var EventEmitter=require(_0x206b('0x0'));var WhatsappAccount=require(_0x206b('0x1'))['db'][_0x206b('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x206b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x206b('0x4')};function emitEvent(_0x3b08d7){return function(_0x598998,_0x4aa91f,_0x28606e){WhatsappAccountEvents[_0x206b('0x5')](_0x3b08d7+':'+_0x598998['id'],_0x598998);WhatsappAccountEvents[_0x206b('0x5')](_0x3b08d7,_0x598998);_0x28606e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x206b('0x6')](e,emitEvent(event));}}module[_0x206b('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 fd8d503..709cb02 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 _0x43e4=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api'];(function(_0x1ee62e,_0x159bb2){var _0x27c6c8=function(_0x31a5d4){while(--_0x31a5d4){_0x1ee62e['push'](_0x1ee62e['shift']());}};_0x27c6c8(++_0x159bb2);}(_0x43e4,0xb0));var _0x443e=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x43e4[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x443e('0x0'));var util=require(_0x443e('0x1'));var logger=require(_0x443e('0x2'))(_0x443e('0x3'));var moment=require(_0x443e('0x4'));var BPromise=require(_0x443e('0x5'));var rp=require(_0x443e('0x6'));var fs=require('fs');var path=require(_0x443e('0x7'));var rimraf=require(_0x443e('0x8'));var config=require(_0x443e('0x9'));var attributes=require(_0x443e('0xa'));module[_0x443e('0xb')]=function(_0xe7aae7,_0x2e32d8){return _0xe7aae7[_0x443e('0xc')](_0x443e('0xd'),attributes,{'tableName':_0x443e('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bc9=['../../config/logger','bluebird','path','rimraf','../../config/environment','whatsapp_accounts','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1bc9,0xe6));var _0x91bc=function(_0x224c45,_0x16fa17){_0x224c45=_0x224c45-0x0;var _0x31dedd=_0x1bc9[_0x224c45];return _0x31dedd;};'use strict';var _=require('lodash');var util=require(_0x91bc('0x0'));var logger=require(_0x91bc('0x1'))('api');var moment=require('moment');var BPromise=require(_0x91bc('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91bc('0x3'));var rimraf=require(_0x91bc('0x4'));var config=require(_0x91bc('0x5'));var attributes=require('./whatsappAccount.attributes');module['exports']=function(_0x2e77f2,_0x193a03){return _0x2e77f2['define']('WhatsappAccount',attributes,{'tableName':_0x91bc('0x6'),'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 0a1dea5..7f945a5 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 _0x790c=['defaults','redis','./whatsappAccount.socket','register','request','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','attributes','include','model','map','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x790c,0x106));var _0xc790=function(_0x2e73ac,_0x4217c9){_0x2e73ac=_0x2e73ac-0x0;var _0x1ea63a=_0x790c[_0x2e73ac];return _0x1ea63a;};'use strict';var _=require(_0xc790('0x0'));var util=require(_0xc790('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc790('0x2'));var db=require(_0xc790('0x3'))['db'];var utils=require(_0xc790('0x4'));var logger=require(_0xc790('0x5'))(_0xc790('0x6'));var config=require('../../config/environment');var jayson=require(_0xc790('0x7'));var client=jayson[_0xc790('0x8')][_0xc790('0x9')]({'port':0x232a});config['redis']=_[_0xc790('0xa')](config[_0xc790('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc790('0xb')]));require(_0xc790('0xc'))[_0xc790('0xd')](socket);function respondWithRpcPromise(_0x18c434,_0x27465c,_0x3150eb){return new BPromise(function(_0x390b4f,_0x317076){return client[_0xc790('0xe')](_0x18c434,_0x3150eb)['then'](function(_0x596393){logger[_0xc790('0xf')]('WhatsappAccount,\x20%s,\x20%s',_0x27465c,'request\x20sent');logger[_0xc790('0x10')](_0xc790('0x11'),_0x27465c,_0xc790('0x12'),JSON[_0xc790('0x13')](_0x596393));if(_0x596393[_0xc790('0x14')]){if(_0x596393[_0xc790('0x14')]['code']===0x1f4){logger[_0xc790('0x14')](_0xc790('0x15'),_0x27465c,_0x596393[_0xc790('0x14')]['message']);return _0x317076(_0x596393[_0xc790('0x14')][_0xc790('0x16')]);}logger['error'](_0xc790('0x15'),_0x27465c,_0x596393[_0xc790('0x14')][_0xc790('0x16')]);return _0x390b4f(_0x596393[_0xc790('0x14')]['message']);}else{logger[_0xc790('0xf')](_0xc790('0x15'),_0x27465c,_0xc790('0x12'));_0x390b4f(_0x596393[_0xc790('0x17')][_0xc790('0x16')]);}})[_0xc790('0x18')](function(_0x27a446){logger[_0xc790('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x27465c,_0x27a446);_0x317076(_0x27a446);});});}exports[_0xc790('0x19')]=function(_0x4e6e73){var _0x19a98d=this;return new Promise(function(_0x2641d1,_0x4898ff){return db[_0xc790('0x1a')][_0xc790('0x1b')]({'raw':_0x4e6e73[_0xc790('0x1c')]?_0x4e6e73[_0xc790('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4e6e73[_0xc790('0x1c')]?_0x4e6e73['options'][_0xc790('0x1d')]||null:null,'attributes':_0x4e6e73[_0xc790('0x1c')]?_0x4e6e73['options'][_0xc790('0x1e')]||null:null,'include':_0x4e6e73[_0xc790('0x1c')]?_0x4e6e73[_0xc790('0x1c')]['include']?_['map'](_0x4e6e73[_0xc790('0x1c')][_0xc790('0x1f')],function(_0x449110){return{'model':db[_0x449110[_0xc790('0x20')]],'as':_0x449110['as'],'attributes':_0x449110[_0xc790('0x1e')],'include':_0x449110[_0xc790('0x1f')]?_[_0xc790('0x21')](_0x449110[_0xc790('0x1f')],function(_0x4ea07c){return{'model':db[_0x4ea07c[_0xc790('0x20')]],'as':_0x4ea07c['as'],'attributes':_0x4ea07c[_0xc790('0x1e')],'include':_0x4ea07c['include']?_[_0xc790('0x21')](_0x4ea07c['include'],function(_0x5e090e){return{'model':db[_0x5e090e[_0xc790('0x20')]],'as':_0x5e090e['as'],'attributes':_0x5e090e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4cbbac){logger[_0xc790('0xf')](_0xc790('0x19'),_0x4e6e73);logger['debug'](_0xc790('0x19'),_0x4e6e73,JSON[_0xc790('0x13')](_0x4cbbac));_0x2641d1(_0x4cbbac);})[_0xc790('0x18')](function(_0x4c8c9f){logger[_0xc790('0x14')](_0xc790('0x19'),_0x4c8c9f[_0xc790('0x16')],_0x4e6e73);_0x4898ff(_0x19a98d['error'](0x1f4,_0x4c8c9f[_0xc790('0x16')]));});});}; \ No newline at end of file +var _0xb4f8=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','info','request\x20sent','debug','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','result','catch','options','raw','attributes','map','include','model','then','ShowWhatsappAccount','util','moment','bluebird','randomstring','ioredis'];(function(_0x55db25,_0x21f288){var _0x778834=function(_0x30c026){while(--_0x30c026){_0x55db25['push'](_0x55db25['shift']());}};_0x778834(++_0x21f288);}(_0xb4f8,0x83));var _0x8b4f=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xb4f8[_0x4b7895];return _0x264180;};'use strict';var _=require('lodash');var util=require(_0x8b4f('0x0'));var moment=require(_0x8b4f('0x1'));var BPromise=require(_0x8b4f('0x2'));var rs=require(_0x8b4f('0x3'));var fs=require('fs');var Redis=require(_0x8b4f('0x4'));var db=require(_0x8b4f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b4f('0x6'))('rpc');var config=require(_0x8b4f('0x7'));var jayson=require(_0x8b4f('0x8'));var client=jayson[_0x8b4f('0x9')][_0x8b4f('0xa')]({'port':0x232a});config[_0x8b4f('0xb')]=_['defaults'](config[_0x8b4f('0xb')],{'host':_0x8b4f('0xc'),'port':0x18eb});var socket=require(_0x8b4f('0xd'))(new Redis(config['redis']));require(_0x8b4f('0xe'))[_0x8b4f('0xf')](socket);function respondWithRpcPromise(_0x1132ce,_0x358cf2,_0x26b169){return new BPromise(function(_0x499db2,_0x328cd1){return client[_0x8b4f('0x10')](_0x1132ce,_0x26b169)['then'](function(_0xe5652d){logger[_0x8b4f('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x358cf2,_0x8b4f('0x12'));logger[_0x8b4f('0x13')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x358cf2,_0x8b4f('0x12'),JSON[_0x8b4f('0x14')](_0xe5652d));if(_0xe5652d[_0x8b4f('0x15')]){if(_0xe5652d[_0x8b4f('0x15')]['code']===0x1f4){logger[_0x8b4f('0x15')](_0x8b4f('0x16'),_0x358cf2,_0xe5652d[_0x8b4f('0x15')][_0x8b4f('0x17')]);return _0x328cd1(_0xe5652d[_0x8b4f('0x15')][_0x8b4f('0x17')]);}logger['error'](_0x8b4f('0x16'),_0x358cf2,_0xe5652d[_0x8b4f('0x15')][_0x8b4f('0x17')]);return _0x499db2(_0xe5652d[_0x8b4f('0x15')][_0x8b4f('0x17')]);}else{logger[_0x8b4f('0x11')](_0x8b4f('0x16'),_0x358cf2,'request\x20sent');_0x499db2(_0xe5652d[_0x8b4f('0x18')][_0x8b4f('0x17')]);}})[_0x8b4f('0x19')](function(_0x15a219){logger['error'](_0x8b4f('0x16'),_0x358cf2,_0x15a219);_0x328cd1(_0x15a219);});});}exports['ShowWhatsappAccount']=function(_0x39c8d4){var _0x3eb2b0=this;return new Promise(function(_0x5dda4c,_0x3bd3e1){return db['WhatsappAccount']['find']({'raw':_0x39c8d4['options']?_0x39c8d4[_0x8b4f('0x1a')][_0x8b4f('0x1b')]===undefined?!![]:![]:!![],'where':_0x39c8d4[_0x8b4f('0x1a')]?_0x39c8d4[_0x8b4f('0x1a')]['where']||null:null,'attributes':_0x39c8d4[_0x8b4f('0x1a')]?_0x39c8d4[_0x8b4f('0x1a')][_0x8b4f('0x1c')]||null:null,'include':_0x39c8d4[_0x8b4f('0x1a')]?_0x39c8d4[_0x8b4f('0x1a')]['include']?_[_0x8b4f('0x1d')](_0x39c8d4[_0x8b4f('0x1a')][_0x8b4f('0x1e')],function(_0x1ae110){return{'model':db[_0x1ae110['model']],'as':_0x1ae110['as'],'attributes':_0x1ae110[_0x8b4f('0x1c')],'include':_0x1ae110['include']?_['map'](_0x1ae110['include'],function(_0x559867){return{'model':db[_0x559867['model']],'as':_0x559867['as'],'attributes':_0x559867['attributes'],'include':_0x559867['include']?_[_0x8b4f('0x1d')](_0x559867[_0x8b4f('0x1e')],function(_0x5a1226){return{'model':db[_0x5a1226[_0x8b4f('0x1f')]],'as':_0x5a1226['as'],'attributes':_0x5a1226[_0x8b4f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8b4f('0x20')](function(_0x450824){logger[_0x8b4f('0x11')](_0x8b4f('0x21'),_0x39c8d4);logger[_0x8b4f('0x13')](_0x8b4f('0x21'),_0x39c8d4,JSON[_0x8b4f('0x14')](_0x450824));_0x5dda4c(_0x450824);})[_0x8b4f('0x19')](function(_0x2b9981){logger['error'](_0x8b4f('0x21'),_0x2b9981['message'],_0x39c8d4);_0x3bd3e1(_0x3eb2b0['error'](0x1f4,_0x2b9981[_0x8b4f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 0644135..5637193 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 _0xebd7=['save','remove','removeListener','register','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x5d741d,_0x42e0c6){var _0x5b37ef=function(_0x9e0629){while(--_0x9e0629){_0x5d741d['push'](_0x5d741d['shift']());}};_0x5b37ef(++_0x42e0c6);}(_0xebd7,0x68));var _0x7ebd=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xebd7[_0x5c351c];return _0x26f3b3;};'use strict';var WhatsappAccountEvents=require(_0x7ebd('0x0'));var events=[_0x7ebd('0x1'),_0x7ebd('0x2'),'update'];function createListener(_0x21df13,_0x1462fd){return function(_0x2f57c3){_0x1462fd['emit'](_0x21df13,_0x2f57c3);};}function removeListener(_0x43303a,_0x151b3c){return function(){WhatsappAccountEvents[_0x7ebd('0x3')](_0x43303a,_0x151b3c);};}exports[_0x7ebd('0x4')]=function(_0xfdf7ab){for(var _0x8b005b=0x0,_0x96d905=events[_0x7ebd('0x5')];_0x8b005b<_0x96d905;_0x8b005b++){var _0x191119=events[_0x8b005b];var _0x36cfe5=createListener(_0x7ebd('0x6')+_0x191119,_0xfdf7ab);WhatsappAccountEvents['on'](_0x191119,_0x36cfe5);}}; \ No newline at end of file +var _0x64a1=['removeListener','register','length','whatsappAccount:','./whatsappAccount.events','save','remove'];(function(_0x70b7da,_0x349155){var _0x1839cd=function(_0x4dd333){while(--_0x4dd333){_0x70b7da['push'](_0x70b7da['shift']());}};_0x1839cd(++_0x349155);}(_0x64a1,0x89));var _0x164a=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x64a1[_0x32f7d7];return _0x133d09;};'use strict';var WhatsappAccountEvents=require(_0x164a('0x0'));var events=[_0x164a('0x1'),_0x164a('0x2'),'update'];function createListener(_0x2fe71b,_0x1a9597){return function(_0x392382){_0x1a9597['emit'](_0x2fe71b,_0x392382);};}function removeListener(_0x1d60fc,_0x5711da){return function(){WhatsappAccountEvents[_0x164a('0x3')](_0x1d60fc,_0x5711da);};}exports[_0x164a('0x4')]=function(_0x56f99b){for(var _0x2ccaae=0x0,_0x4cde38=events[_0x164a('0x5')];_0x2ccaae<_0x4cde38;_0x2ccaae++){var _0x55cc2f=events[_0x2ccaae];var _0x3df641=createListener(_0x164a('0x6')+_0x55cc2f,_0x56f99b);WhatsappAccountEvents['on'](_0x55cc2f,_0x3df641);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 18e24d5..05245fc 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 _0xc6d3=['isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./whatsappApplication.controller','get','index','/:id','show','post','create','put'];(function(_0x34575e,_0x496bd3){var _0x569b48=function(_0x4ff4ee){while(--_0x4ff4ee){_0x34575e['push'](_0x34575e['shift']());}};_0x569b48(++_0x496bd3);}(_0xc6d3,0x7d));var _0x3c6d=function(_0x235b9d,_0x265e83){_0x235b9d=_0x235b9d-0x0;var _0x147d13=_0xc6d3[_0x235b9d];return _0x147d13;};'use strict';var multer=require(_0x3c6d('0x0'));var util=require(_0x3c6d('0x1'));var path=require(_0x3c6d('0x2'));var timeout=require(_0x3c6d('0x3'));var express=require(_0x3c6d('0x4'));var router=express['Router']();var fs_extra=require(_0x3c6d('0x5'));var auth=require(_0x3c6d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3c6d('0x7'));router[_0x3c6d('0x8')]('/',auth['isAuthenticated'](),controller[_0x3c6d('0x9')]);router[_0x3c6d('0x8')](_0x3c6d('0xa'),auth['isAuthenticated'](),controller[_0x3c6d('0xb')]);router[_0x3c6d('0xc')]('/',auth['isAuthenticated'](),controller[_0x3c6d('0xd')]);router[_0x3c6d('0xe')](_0x3c6d('0xa'),auth[_0x3c6d('0xf')](),controller[_0x3c6d('0x10')]);router[_0x3c6d('0x11')](_0x3c6d('0xa'),auth[_0x3c6d('0xf')](),controller[_0x3c6d('0x12')]);module[_0x3c6d('0x13')]=router; \ No newline at end of file +var _0xb1eb=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','update','delete','exports','multer','util'];(function(_0x36a970,_0x3c9f51){var _0x1c1708=function(_0x1e7cd5){while(--_0x1e7cd5){_0x36a970['push'](_0x36a970['shift']());}};_0x1c1708(++_0x3c9f51);}(_0xb1eb,0x1eb));var _0xbb1e=function(_0x5b1fb7,_0x2e0fb2){_0x5b1fb7=_0x5b1fb7-0x0;var _0x494b20=_0xb1eb[_0x5b1fb7];return _0x494b20;};'use strict';var multer=require(_0xbb1e('0x0'));var util=require(_0xbb1e('0x1'));var path=require(_0xbb1e('0x2'));var timeout=require(_0xbb1e('0x3'));var express=require(_0xbb1e('0x4'));var router=express['Router']();var fs_extra=require(_0xbb1e('0x5'));var auth=require(_0xbb1e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbb1e('0x7'));var controller=require('./whatsappApplication.controller');router[_0xbb1e('0x8')]('/',auth[_0xbb1e('0x9')](),controller[_0xbb1e('0xa')]);router[_0xbb1e('0x8')](_0xbb1e('0xb'),auth[_0xbb1e('0x9')](),controller[_0xbb1e('0xc')]);router[_0xbb1e('0xd')]('/',auth[_0xbb1e('0x9')](),controller['create']);router['put'](_0xbb1e('0xb'),auth[_0xbb1e('0x9')](),controller[_0xbb1e('0xe')]);router[_0xbb1e('0xf')](_0xbb1e('0xb'),auth[_0xbb1e('0x9')](),controller['destroy']);module[_0xbb1e('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index b61f10b..15f9e39 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 _0x8f29=['sequelize','exports','INTEGER','STRING','noop'];(function(_0x504295,_0x414872){var _0x5d7bca=function(_0xcefe16){while(--_0xcefe16){_0x504295['push'](_0x504295['shift']());}};_0x5d7bca(++_0x414872);}(_0x8f29,0xeb));var _0x98f2=function(_0x2d2f63,_0x4432f4){_0x2d2f63=_0x2d2f63-0x0;var _0x170c1e=_0x8f29[_0x2d2f63];return _0x170c1e;};'use strict';var Sequelize=require(_0x98f2('0x0'));module[_0x98f2('0x1')]={'priority':{'type':Sequelize[_0x98f2('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x98f2('0x3')],'allowNull':![],'defaultValue':_0x98f2('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x98f2('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x28c2=['sequelize','exports','INTEGER','noop','TEXT','STRING','*,*,*,*'];(function(_0x1e3c02,_0x5c07a2){var _0x4d26d7=function(_0x367ed9){while(--_0x367ed9){_0x1e3c02['push'](_0x1e3c02['shift']());}};_0x4d26d7(++_0x5c07a2);}(_0x28c2,0x111));var _0x228c=function(_0xefdc91,_0x4c1eec){_0xefdc91=_0xefdc91-0x0;var _0x2b4f18=_0x28c2[_0xefdc91];return _0x2b4f18;};'use strict';var Sequelize=require(_0x228c('0x0'));module[_0x228c('0x1')]={'priority':{'type':Sequelize[_0x228c('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x228c('0x3')},'appdata':{'type':Sequelize[_0x228c('0x4')]()},'description':{'type':Sequelize[_0x228c('0x5')]},'interval':{'type':Sequelize[_0x228c('0x5')],'defaultValue':_0x228c('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 001d5c5..95276e9 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 _0x3588=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','error','stack','name','index','map','WhatsappApplication','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','rows','catch','show','length','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x299be3,_0x1a37a6){var _0xa32c75=function(_0x77d511){while(--_0x77d511){_0x299be3['push'](_0x299be3['shift']());}};_0xa32c75(++_0x1a37a6);}(_0x3588,0x82));var _0x8358=function(_0x327b49,_0xc232b8){_0x327b49=_0x327b49-0x0;var _0x4e7265=_0x3588[_0x327b49];return _0x4e7265;};'use strict';var emlformat=require(_0x8358('0x0'));var rimraf=require(_0x8358('0x1'));var zipdir=require(_0x8358('0x2'));var jsonpatch=require(_0x8358('0x3'));var rp=require(_0x8358('0x4'));var moment=require(_0x8358('0x5'));var BPromise=require(_0x8358('0x6'));var Mustache=require('mustache');var util=require(_0x8358('0x7'));var path=require(_0x8358('0x8'));var sox=require(_0x8358('0x9'));var csv=require(_0x8358('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8358('0xb'));var _=require(_0x8358('0xc'));var squel=require('squel');var crypto=require(_0x8358('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8358('0xe'));var toCsv=require(_0x8358('0xa'));var querystring=require(_0x8358('0xf'));var Papa=require(_0x8358('0x10'));var Redis=require('ioredis');var authService=require(_0x8358('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8358('0x12'));var hardwareService=require(_0x8358('0x13'));var logger=require(_0x8358('0x14'))(_0x8358('0x15'));var utils=require(_0x8358('0x16'));var config=require(_0x8358('0x17'));var licenseUtil=require(_0x8358('0x18'));var db=require(_0x8358('0x19'))['db'];function respondWithStatusCode(_0x3cf276,_0x2c2aeb){_0x2c2aeb=_0x2c2aeb||0xcc;return function(_0x213d5e){if(_0x213d5e){return _0x3cf276[_0x8358('0x1a')](_0x2c2aeb);}return _0x3cf276[_0x8358('0x1b')](_0x2c2aeb)[_0x8358('0x1c')]();};}function respondWithResult(_0xda422b,_0x317ea0){_0x317ea0=_0x317ea0||0xc8;return function(_0x51d21d){if(_0x51d21d){return _0xda422b['status'](_0x317ea0)[_0x8358('0x1d')](_0x51d21d);}};}function respondWithFilteredResult(_0x4bad9c,_0x19da0b){return function(_0x4f412a){if(_0x4f412a){var _0x585969=typeof _0x19da0b['offset']===_0x8358('0x1e')&&typeof _0x19da0b[_0x8358('0x1f')]===_0x8358('0x1e');var _0x366a2b=_0x4f412a[_0x8358('0x20')];var _0x27a21d=_0x585969?0x0:_0x19da0b[_0x8358('0x21')];var _0x524bfb=_0x585969?_0x4f412a[_0x8358('0x20')]:_0x19da0b[_0x8358('0x21')]+_0x19da0b['limit'];var _0x31038d;if(_0x524bfb>=_0x366a2b){_0x524bfb=_0x366a2b;_0x31038d=0xc8;}else{_0x31038d=0xce;}_0x4bad9c[_0x8358('0x1b')](_0x31038d);return _0x4bad9c[_0x8358('0x22')](_0x8358('0x23'),_0x27a21d+'-'+_0x524bfb+'/'+_0x366a2b)['json'](_0x4f412a);}return null;};}function patchUpdates(_0x56d435){return function(_0x19e667){try{jsonpatch[_0x8358('0x24')](_0x19e667,_0x56d435,!![]);}catch(_0x45ae60){return BPromise['reject'](_0x45ae60);}return _0x19e667['save']();};}function saveUpdates(_0x1330b5,_0x528ce8){return function(_0x218537){if(_0x218537){return _0x218537[_0x8358('0x25')](_0x1330b5)[_0x8358('0x26')](function(_0x21e9ad){return _0x21e9ad;});}return null;};}function removeEntity(_0x25d82a,_0x3675c3){return function(_0x1ae76d){if(_0x1ae76d){return _0x1ae76d['destroy']()[_0x8358('0x26')](function(){_0x25d82a['status'](0xcc)[_0x8358('0x1c')]();});}};}function handleEntityNotFound(_0x5d8317,_0x248d2f){return function(_0x1beaa7){if(!_0x1beaa7){_0x5d8317[_0x8358('0x1a')](0x194);}return _0x1beaa7;};}function handleError(_0x542499,_0x153e02){_0x153e02=_0x153e02||0x1f4;return function(_0x37a172){logger[_0x8358('0x27')](_0x37a172[_0x8358('0x28')]);if(_0x37a172[_0x8358('0x29')]){delete _0x37a172[_0x8358('0x29')];}_0x542499[_0x8358('0x1b')](_0x153e02)['send'](_0x37a172);};}exports[_0x8358('0x2a')]=function(_0x3921bc,_0x334443){var _0x458eb9={},_0x460d5c={},_0x1c1987={'count':0x0,'rows':[]};var _0x79b688=_[_0x8358('0x2b')](db[_0x8358('0x2c')][_0x8358('0x2d')],function(_0x340b39){return{'name':_0x340b39[_0x8358('0x2e')],'type':_0x340b39[_0x8358('0x2f')]['key']};});_0x460d5c[_0x8358('0x30')]=_['map'](_0x79b688,'name');_0x460d5c[_0x8358('0x31')]=_[_0x8358('0x32')](_0x3921bc[_0x8358('0x31')]);_0x460d5c[_0x8358('0x33')]=_['intersection'](_0x460d5c[_0x8358('0x30')],_0x460d5c[_0x8358('0x31')]);_0x458eb9[_0x8358('0x34')]=_['intersection'](_0x460d5c[_0x8358('0x30')],qs[_0x8358('0x35')](_0x3921bc[_0x8358('0x31')][_0x8358('0x35')]));_0x458eb9['attributes']=_0x458eb9[_0x8358('0x34')]['length']?_0x458eb9[_0x8358('0x34')]:_0x460d5c[_0x8358('0x30')];if(!_0x3921bc[_0x8358('0x31')][_0x8358('0x36')](_0x8358('0x37'))){_0x458eb9[_0x8358('0x1f')]=qs[_0x8358('0x1f')](_0x3921bc[_0x8358('0x31')][_0x8358('0x1f')]);_0x458eb9[_0x8358('0x21')]=qs[_0x8358('0x21')](_0x3921bc['query']['offset']);}_0x458eb9[_0x8358('0x38')]=qs[_0x8358('0x39')](_0x3921bc[_0x8358('0x31')][_0x8358('0x39')]);_0x458eb9['where']=qs[_0x8358('0x33')](_[_0x8358('0x3a')](_0x3921bc[_0x8358('0x31')],_0x460d5c[_0x8358('0x33')]),_0x79b688);if(_0x3921bc[_0x8358('0x31')][_0x8358('0x3b')]){_0x458eb9[_0x8358('0x3c')]=_['merge'](_0x458eb9[_0x8358('0x3c')],{'$or':_[_0x8358('0x2b')](_0x79b688,function(_0x546d2e){if(_0x546d2e[_0x8358('0x2f')]!==_0x8358('0x3d')){var _0x26ef7c={};_0x26ef7c[_0x546d2e[_0x8358('0x29')]]={'$like':'%'+_0x3921bc['query'][_0x8358('0x3b')]+'%'};return _0x26ef7c;}})});}_0x458eb9=_[_0x8358('0x3e')]({},_0x458eb9,_0x3921bc[_0x8358('0x3f')]);var _0x5b047a={'where':_0x458eb9[_0x8358('0x3c')]};return db[_0x8358('0x2c')][_0x8358('0x20')](_0x5b047a)[_0x8358('0x26')](function(_0x2c2a27){_0x1c1987['count']=_0x2c2a27;if(_0x3921bc['query'][_0x8358('0x40')]){_0x458eb9['include']=[{'all':!![]}];}return db[_0x8358('0x2c')]['findAll'](_0x458eb9);})['then'](function(_0x2a0a8a){_0x1c1987[_0x8358('0x41')]=_0x2a0a8a;return _0x1c1987;})[_0x8358('0x26')](respondWithFilteredResult(_0x334443,_0x458eb9))[_0x8358('0x42')](handleError(_0x334443,null));};exports[_0x8358('0x43')]=function(_0x106778,_0x2cd23f){var _0x32334f={'raw':!![],'where':{'id':_0x106778['params']['id']}},_0x59272f={};_0x59272f['model']=_[_0x8358('0x32')](db[_0x8358('0x2c')]['rawAttributes']);_0x59272f[_0x8358('0x31')]=_[_0x8358('0x32')](_0x106778[_0x8358('0x31')]);_0x59272f[_0x8358('0x33')]=_['intersection'](_0x59272f[_0x8358('0x30')],_0x59272f['query']);_0x32334f[_0x8358('0x34')]=_['intersection'](_0x59272f[_0x8358('0x30')],qs[_0x8358('0x35')](_0x106778[_0x8358('0x31')]['fields']));_0x32334f[_0x8358('0x34')]=_0x32334f[_0x8358('0x34')][_0x8358('0x44')]?_0x32334f[_0x8358('0x34')]:_0x59272f['model'];if(_0x106778['query']['includeAll']){_0x32334f['include']=[{'all':!![]}];}_0x32334f=_[_0x8358('0x3e')]({},_0x32334f,_0x106778[_0x8358('0x3f')]);return db[_0x8358('0x2c')][_0x8358('0x45')](_0x32334f)[_0x8358('0x26')](handleEntityNotFound(_0x2cd23f,null))[_0x8358('0x26')](respondWithResult(_0x2cd23f,null))['catch'](handleError(_0x2cd23f,null));};exports[_0x8358('0x46')]=function(_0x3e906d,_0x3664cb){return db[_0x8358('0x2c')][_0x8358('0x46')](_0x3e906d[_0x8358('0x47')],{})[_0x8358('0x26')](respondWithResult(_0x3664cb,0xc9))[_0x8358('0x42')](handleError(_0x3664cb,null));};exports['update']=function(_0x467fbc,_0x2da39c){if(_0x467fbc['body']['id']){delete _0x467fbc['body']['id'];}return db[_0x8358('0x2c')]['find']({'where':{'id':_0x467fbc[_0x8358('0x48')]['id']}})[_0x8358('0x26')](handleEntityNotFound(_0x2da39c,null))[_0x8358('0x26')](saveUpdates(_0x467fbc[_0x8358('0x47')],null))[_0x8358('0x26')](respondWithResult(_0x2da39c,null))[_0x8358('0x42')](handleError(_0x2da39c,null));};exports[_0x8358('0x49')]=function(_0x134144,_0x57e15f){return db[_0x8358('0x2c')][_0x8358('0x45')]({'where':{'id':_0x134144[_0x8358('0x48')]['id']}})['then'](handleEntityNotFound(_0x57e15f,null))[_0x8358('0x26')](removeEntity(_0x57e15f,null))[_0x8358('0x42')](handleError(_0x57e15f,null));}; \ No newline at end of file +var _0x32b6=['sort','where','filter','merge','VIRTUAL','options','includeAll','rows','show','params','include','catch','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x32b6,0x1d1));var _0x632b=function(_0x3285df,_0x22518d){_0x3285df=_0x3285df-0x0;var _0x1e67f9=_0x32b6[_0x3285df];return _0x1e67f9;};'use strict';var emlformat=require(_0x632b('0x0'));var rimraf=require(_0x632b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x632b('0x2'));var rp=require(_0x632b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x632b('0x4'));var util=require(_0x632b('0x5'));var path=require(_0x632b('0x6'));var sox=require(_0x632b('0x7'));var csv=require(_0x632b('0x8'));var ejs=require(_0x632b('0x9'));var fs=require('fs');var fs_extra=require(_0x632b('0xa'));var _=require(_0x632b('0xb'));var squel=require(_0x632b('0xc'));var crypto=require(_0x632b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x632b('0xe'));var toCsv=require(_0x632b('0x8'));var querystring=require(_0x632b('0xf'));var Papa=require(_0x632b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x632b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x632b('0x12'))(_0x632b('0x13'));var utils=require(_0x632b('0x14'));var config=require(_0x632b('0x15'));var licenseUtil=require(_0x632b('0x16'));var db=require(_0x632b('0x17'))['db'];function respondWithStatusCode(_0xe81378,_0x3d8bed){_0x3d8bed=_0x3d8bed||0xcc;return function(_0x22c182){if(_0x22c182){return _0xe81378['sendStatus'](_0x3d8bed);}return _0xe81378[_0x632b('0x18')](_0x3d8bed)[_0x632b('0x19')]();};}function respondWithResult(_0x9246a6,_0x5a97da){_0x5a97da=_0x5a97da||0xc8;return function(_0x721883){if(_0x721883){return _0x9246a6[_0x632b('0x18')](_0x5a97da)[_0x632b('0x1a')](_0x721883);}};}function respondWithFilteredResult(_0x17ff9b,_0x40d410){return function(_0x21cdd3){if(_0x21cdd3){var _0x4efe39=typeof _0x40d410[_0x632b('0x1b')]==='undefined'&&typeof _0x40d410['limit']===_0x632b('0x1c');var _0x5afa1e=_0x21cdd3[_0x632b('0x1d')];var _0x3bb27f=_0x4efe39?0x0:_0x40d410[_0x632b('0x1b')];var _0x51c894=_0x4efe39?_0x21cdd3[_0x632b('0x1d')]:_0x40d410[_0x632b('0x1b')]+_0x40d410[_0x632b('0x1e')];var _0x3683e4;if(_0x51c894>=_0x5afa1e){_0x51c894=_0x5afa1e;_0x3683e4=0xc8;}else{_0x3683e4=0xce;}_0x17ff9b['status'](_0x3683e4);return _0x17ff9b[_0x632b('0x1f')](_0x632b('0x20'),_0x3bb27f+'-'+_0x51c894+'/'+_0x5afa1e)['json'](_0x21cdd3);}return null;};}function patchUpdates(_0x116f62){return function(_0x50b930){try{jsonpatch['apply'](_0x50b930,_0x116f62,!![]);}catch(_0x1b1092){return BPromise['reject'](_0x1b1092);}return _0x50b930[_0x632b('0x21')]();};}function saveUpdates(_0x1c4530,_0x2a6833){return function(_0x540bfb){if(_0x540bfb){return _0x540bfb[_0x632b('0x22')](_0x1c4530)[_0x632b('0x23')](function(_0x59d83a){return _0x59d83a;});}return null;};}function removeEntity(_0x1db8f5,_0x379dc2){return function(_0x30ffb9){if(_0x30ffb9){return _0x30ffb9[_0x632b('0x24')]()[_0x632b('0x23')](function(){_0x1db8f5[_0x632b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e7b20,_0x11fe61){return function(_0x4d3a70){if(!_0x4d3a70){_0x5e7b20[_0x632b('0x25')](0x194);}return _0x4d3a70;};}function handleError(_0x954fa0,_0x5d6855){_0x5d6855=_0x5d6855||0x1f4;return function(_0x273e89){logger[_0x632b('0x26')](_0x273e89[_0x632b('0x27')]);if(_0x273e89[_0x632b('0x28')]){delete _0x273e89[_0x632b('0x28')];}_0x954fa0[_0x632b('0x18')](_0x5d6855)[_0x632b('0x29')](_0x273e89);};}exports[_0x632b('0x2a')]=function(_0x33a625,_0x4f8410){var _0x1bb484={},_0x35348e={},_0x1819fa={'count':0x0,'rows':[]};var _0x3999aa=_[_0x632b('0x2b')](db[_0x632b('0x2c')][_0x632b('0x2d')],function(_0x417d62){return{'name':_0x417d62[_0x632b('0x2e')],'type':_0x417d62[_0x632b('0x2f')][_0x632b('0x30')]};});_0x35348e[_0x632b('0x31')]=_[_0x632b('0x2b')](_0x3999aa,_0x632b('0x28'));_0x35348e[_0x632b('0x32')]=_[_0x632b('0x33')](_0x33a625[_0x632b('0x32')]);_0x35348e[_0x632b('0x34')]=_[_0x632b('0x35')](_0x35348e[_0x632b('0x31')],_0x35348e['query']);_0x1bb484[_0x632b('0x36')]=_[_0x632b('0x35')](_0x35348e[_0x632b('0x31')],qs[_0x632b('0x37')](_0x33a625['query'][_0x632b('0x37')]));_0x1bb484['attributes']=_0x1bb484[_0x632b('0x36')][_0x632b('0x38')]?_0x1bb484['attributes']:_0x35348e[_0x632b('0x31')];if(!_0x33a625[_0x632b('0x32')][_0x632b('0x39')](_0x632b('0x3a'))){_0x1bb484[_0x632b('0x1e')]=qs[_0x632b('0x1e')](_0x33a625[_0x632b('0x32')][_0x632b('0x1e')]);_0x1bb484['offset']=qs['offset'](_0x33a625[_0x632b('0x32')][_0x632b('0x1b')]);}_0x1bb484[_0x632b('0x3b')]=qs[_0x632b('0x3c')](_0x33a625[_0x632b('0x32')][_0x632b('0x3c')]);_0x1bb484[_0x632b('0x3d')]=qs[_0x632b('0x34')](_['pick'](_0x33a625['query'],_0x35348e[_0x632b('0x34')]),_0x3999aa);if(_0x33a625['query'][_0x632b('0x3e')]){_0x1bb484[_0x632b('0x3d')]=_[_0x632b('0x3f')](_0x1bb484[_0x632b('0x3d')],{'$or':_[_0x632b('0x2b')](_0x3999aa,function(_0x38266c){if(_0x38266c[_0x632b('0x2f')]!==_0x632b('0x40')){var _0x2730c2={};_0x2730c2[_0x38266c[_0x632b('0x28')]]={'$like':'%'+_0x33a625[_0x632b('0x32')][_0x632b('0x3e')]+'%'};return _0x2730c2;}})});}_0x1bb484=_[_0x632b('0x3f')]({},_0x1bb484,_0x33a625[_0x632b('0x41')]);var _0x13beaa={'where':_0x1bb484[_0x632b('0x3d')]};return db[_0x632b('0x2c')]['count'](_0x13beaa)['then'](function(_0x58e3cc){_0x1819fa['count']=_0x58e3cc;if(_0x33a625['query'][_0x632b('0x42')]){_0x1bb484['include']=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x1bb484);})[_0x632b('0x23')](function(_0x4490d4){_0x1819fa[_0x632b('0x43')]=_0x4490d4;return _0x1819fa;})[_0x632b('0x23')](respondWithFilteredResult(_0x4f8410,_0x1bb484))['catch'](handleError(_0x4f8410,null));};exports[_0x632b('0x44')]=function(_0x238297,_0x387fce){var _0x4dbe4b={'raw':!![],'where':{'id':_0x238297[_0x632b('0x45')]['id']}},_0x15bb30={};_0x15bb30[_0x632b('0x31')]=_[_0x632b('0x33')](db[_0x632b('0x2c')][_0x632b('0x2d')]);_0x15bb30['query']=_[_0x632b('0x33')](_0x238297[_0x632b('0x32')]);_0x15bb30[_0x632b('0x34')]=_[_0x632b('0x35')](_0x15bb30['model'],_0x15bb30['query']);_0x4dbe4b[_0x632b('0x36')]=_[_0x632b('0x35')](_0x15bb30[_0x632b('0x31')],qs[_0x632b('0x37')](_0x238297[_0x632b('0x32')][_0x632b('0x37')]));_0x4dbe4b['attributes']=_0x4dbe4b[_0x632b('0x36')][_0x632b('0x38')]?_0x4dbe4b[_0x632b('0x36')]:_0x15bb30[_0x632b('0x31')];if(_0x238297[_0x632b('0x32')][_0x632b('0x42')]){_0x4dbe4b[_0x632b('0x46')]=[{'all':!![]}];}_0x4dbe4b=_[_0x632b('0x3f')]({},_0x4dbe4b,_0x238297['options']);return db[_0x632b('0x2c')]['find'](_0x4dbe4b)[_0x632b('0x23')](handleEntityNotFound(_0x387fce,null))['then'](respondWithResult(_0x387fce,null))[_0x632b('0x47')](handleError(_0x387fce,null));};exports[_0x632b('0x48')]=function(_0x16dfc7,_0x2c4561){return db[_0x632b('0x2c')]['create'](_0x16dfc7[_0x632b('0x49')],{})[_0x632b('0x23')](respondWithResult(_0x2c4561,0xc9))[_0x632b('0x47')](handleError(_0x2c4561,null));};exports['update']=function(_0x253aec,_0x16eb80){if(_0x253aec[_0x632b('0x49')]['id']){delete _0x253aec[_0x632b('0x49')]['id'];}return db[_0x632b('0x2c')]['find']({'where':{'id':_0x253aec[_0x632b('0x45')]['id']}})['then'](handleEntityNotFound(_0x16eb80,null))[_0x632b('0x23')](saveUpdates(_0x253aec[_0x632b('0x49')],null))[_0x632b('0x23')](respondWithResult(_0x16eb80,null))[_0x632b('0x47')](handleError(_0x16eb80,null));};exports[_0x632b('0x24')]=function(_0x52785a,_0x4c9b4e){return db[_0x632b('0x2c')][_0x632b('0x4a')]({'where':{'id':_0x52785a[_0x632b('0x45')]['id']}})[_0x632b('0x23')](handleEntityNotFound(_0x4c9b4e,null))[_0x632b('0x23')](removeEntity(_0x4c9b4e,null))[_0x632b('0x47')](handleError(_0x4c9b4e,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 256ff6d..da9eea3 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 _0x950a=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./whatsappApplication.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x950a,0x111));var _0xa950=function(_0x567bcb,_0x4978c1){_0x567bcb=_0x567bcb-0x0;var _0x4eebc2=_0x950a[_0x567bcb];return _0x4eebc2;};'use strict';var _=require(_0xa950('0x0'));var util=require(_0xa950('0x1'));var logger=require(_0xa950('0x2'))(_0xa950('0x3'));var moment=require('moment');var BPromise=require(_0xa950('0x4'));var rp=require(_0xa950('0x5'));var fs=require('fs');var path=require(_0xa950('0x6'));var rimraf=require(_0xa950('0x7'));var config=require('../../config/environment');var attributes=require(_0xa950('0x8'));module[_0xa950('0x9')]=function(_0x512c0e,_0x14b4ac){return _0x512c0e[_0xa950('0xa')]('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa950('0xb'),'collate':_0xa950('0xc')});}; \ No newline at end of file +var _0x48ea=['lodash','../../config/logger','api','moment','path','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x335998,_0x2bcc76){var _0xc83fff=function(_0x2b950f){while(--_0x2b950f){_0x335998['push'](_0x335998['shift']());}};_0xc83fff(++_0x2bcc76);}(_0x48ea,0x9c));var _0xa48e=function(_0x4e2567,_0x430ecc){_0x4e2567=_0x4e2567-0x0;var _0xee6932=_0x48ea[_0x4e2567];return _0xee6932;};'use strict';var _=require(_0xa48e('0x0'));var util=require('util');var logger=require(_0xa48e('0x1'))(_0xa48e('0x2'));var moment=require(_0xa48e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa48e('0x4'));var rimraf=require('rimraf');var config=require(_0xa48e('0x5'));var attributes=require(_0xa48e('0x6'));module[_0xa48e('0x7')]=function(_0x4387b5,_0x2b058d){return _0x4387b5[_0xa48e('0x8')](_0xa48e('0x9'),attributes,{'tableName':_0xa48e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa48e('0xb'),'collate':_0xa48e('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index b80ddbc..3a9fe8e 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 _0x9f62=['util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','WhatsappApplication,\x20%s,\x20%s','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch'];(function(_0x2cca62,_0x27d712){var _0x32eb88=function(_0x5509a3){while(--_0x5509a3){_0x2cca62['push'](_0x2cca62['shift']());}};_0x32eb88(++_0x27d712);}(_0x9f62,0x154));var _0x29f6=function(_0x31c105,_0x1ba933){_0x31c105=_0x31c105-0x0;var _0x2eb29f=_0x9f62[_0x31c105];return _0x2eb29f;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var moment=require('moment');var BPromise=require(_0x29f6('0x1'));var rs=require(_0x29f6('0x2'));var fs=require('fs');var Redis=require(_0x29f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x29f6('0x4'))(_0x29f6('0x5'));var config=require(_0x29f6('0x6'));var jayson=require(_0x29f6('0x7'));var client=jayson['client'][_0x29f6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x272876,_0x9a43fe,_0x2ba602){return new BPromise(function(_0x416c6c,_0x5e9945){return client['request'](_0x272876,_0x2ba602)['then'](function(_0x549f64){logger[_0x29f6('0x9')](_0x29f6('0xa'),_0x9a43fe,'request\x20sent');logger['debug'](_0x29f6('0xb'),_0x9a43fe,_0x29f6('0xc'),JSON['stringify'](_0x549f64));if(_0x549f64[_0x29f6('0xd')]){if(_0x549f64[_0x29f6('0xd')]['code']===0x1f4){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x9a43fe,_0x549f64['error'][_0x29f6('0xe')]);return _0x5e9945(_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);}logger[_0x29f6('0xd')](_0x29f6('0xa'),_0x9a43fe,_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);return _0x416c6c(_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);}else{logger[_0x29f6('0x9')](_0x29f6('0xa'),_0x9a43fe,_0x29f6('0xc'));_0x416c6c(_0x549f64[_0x29f6('0xf')][_0x29f6('0xe')]);}})[_0x29f6('0x10')](function(_0x14dd56){logger[_0x29f6('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x9a43fe,_0x14dd56);_0x5e9945(_0x14dd56);});});} \ No newline at end of file +var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','catch','util'];(function(_0x27deaf,_0x533b1f){var _0x2452e9=function(_0x2e5a42){while(--_0x2e5a42){_0x27deaf['push'](_0x27deaf['shift']());}};_0x2452e9(++_0x533b1f);}(_0xedd9,0xfc));var _0x9edd=function(_0x17be6f,_0x4dd921){_0x17be6f=_0x17be6f-0x0;var _0x2e6a6a=_0xedd9[_0x17be6f];return _0x2e6a6a;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index ffd5db0..d13b7b8 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 _0x31f0=['tracked','whatsapp','whatsappinteraction:addtags','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags'];(function(_0xba96b0,_0x36e8f8){var _0xdad969=function(_0x5226b4){while(--_0x5226b4){_0xba96b0['push'](_0xba96b0['shift']());}};_0xdad969(++_0x36e8f8);}(_0x31f0,0xb7));var _0x031f=function(_0x4e4ba2,_0x1c0b35){_0x4e4ba2=_0x4e4ba2-0x0;var _0x36c600=_0x31f0[_0x4e4ba2];return _0x36c600;};'use strict';var multer=require(_0x031f('0x0'));var util=require('util');var path=require(_0x031f('0x1'));var timeout=require('connect-timeout');var express=require(_0x031f('0x2'));var router=express[_0x031f('0x3')]();var fs_extra=require(_0x031f('0x4'));var auth=require(_0x031f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x031f('0x6'));var controller=require(_0x031f('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x031f('0x8')]('/describe',auth[_0x031f('0x9')](),controller[_0x031f('0xa')]);router[_0x031f('0x8')](_0x031f('0xb'),auth['isAuthenticated'](),controller[_0x031f('0xc')]);router[_0x031f('0x8')](_0x031f('0xd'),auth[_0x031f('0x9')](),controller[_0x031f('0xe')]);router[_0x031f('0x8')](_0x031f('0xf'),auth[_0x031f('0x9')](),controller['download']);router[_0x031f('0x10')]('/',auth[_0x031f('0x9')](),controller[_0x031f('0x11')]);router[_0x031f('0x10')](_0x031f('0xd'),auth[_0x031f('0x9')](),controller[_0x031f('0x12')]);router['post'](_0x031f('0x13'),auth[_0x031f('0x9')](),interaction[_0x031f('0x14')](_0x031f('0x15'),_0x031f('0x16')),controller['addTags']);router['put'](_0x031f('0xb'),auth[_0x031f('0x9')](),interaction[_0x031f('0x14')](_0x031f('0x15'),'whatsappinteraction:update'),controller[_0x031f('0x17')]);router[_0x031f('0x18')]('/:id',auth[_0x031f('0x9')](),interaction['tracked'](_0x031f('0x15'),_0x031f('0x19')),controller[_0x031f('0x1a')]);router[_0x031f('0x18')](_0x031f('0x13'),auth[_0x031f('0x9')](),controller[_0x031f('0x1b')]);module[_0x031f('0x1c')]=router; \ No newline at end of file +var _0xe2bc=['destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','whatsapp','whatsappinteraction:addtags','tracked','delete','whatsappinteraction:destroy'];(function(_0x5e4c9b,_0x168735){var _0x153457=function(_0x4f6550){while(--_0x4f6550){_0x5e4c9b['push'](_0x5e4c9b['shift']());}};_0x153457(++_0x168735);}(_0xe2bc,0x1a6));var _0xce2b=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0xe2bc[_0x31a371];return _0x2a5bd6;};'use strict';var multer=require(_0xce2b('0x0'));var util=require('util');var path=require(_0xce2b('0x1'));var timeout=require('connect-timeout');var express=require(_0xce2b('0x2'));var router=express[_0xce2b('0x3')]();var fs_extra=require(_0xce2b('0x4'));var auth=require(_0xce2b('0x5'));var interaction=require(_0xce2b('0x6'));var config=require('../../config/environment');var controller=require(_0xce2b('0x7'));router[_0xce2b('0x8')]('/',auth[_0xce2b('0x9')](),controller[_0xce2b('0xa')]);router[_0xce2b('0x8')]('/describe',auth[_0xce2b('0x9')](),controller[_0xce2b('0xb')]);router['get'](_0xce2b('0xc'),auth[_0xce2b('0x9')](),controller[_0xce2b('0xd')]);router[_0xce2b('0x8')](_0xce2b('0xe'),auth[_0xce2b('0x9')](),controller[_0xce2b('0xf')]);router[_0xce2b('0x8')](_0xce2b('0x10'),auth[_0xce2b('0x9')](),controller['download']);router[_0xce2b('0x11')]('/',auth['isAuthenticated'](),controller[_0xce2b('0x12')]);router[_0xce2b('0x11')](_0xce2b('0xe'),auth[_0xce2b('0x9')](),controller[_0xce2b('0x13')]);router[_0xce2b('0x11')](_0xce2b('0x14'),auth[_0xce2b('0x9')](),interaction['tracked'](_0xce2b('0x15'),_0xce2b('0x16')),controller['addTags']);router['put']('/:id',auth[_0xce2b('0x9')](),interaction[_0xce2b('0x17')](_0xce2b('0x15'),'whatsappinteraction:update'),controller['update']);router[_0xce2b('0x18')](_0xce2b('0xc'),auth[_0xce2b('0x9')](),interaction[_0xce2b('0x17')](_0xce2b('0x15'),_0xce2b('0x19')),controller[_0xce2b('0x1a')]);router[_0xce2b('0x18')](_0xce2b('0x14'),auth[_0xce2b('0x9')](),controller['removeTags']);module[_0xce2b('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 bb98c63..aed3879 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 _0xbe52=['DATE','STRING','ENUM','out','sequelize','moment','exports','BOOLEAN'];(function(_0x42c92d,_0x2a215f){var _0x1d1436=function(_0x15a515){while(--_0x15a515){_0x42c92d['push'](_0x42c92d['shift']());}};_0x1d1436(++_0x2a215f);}(_0xbe52,0x164));var _0x2be5=function(_0x32f029,_0x4f58a6){_0x32f029=_0x32f029-0x0;var _0xd8796a=_0xbe52[_0x32f029];return _0xd8796a;};'use strict';var Sequelize=require(_0x2be5('0x0'));var moment=require(_0x2be5('0x1'));module[_0x2be5('0x2')]={'closed':{'type':Sequelize[_0x2be5('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2be5('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2be5('0x5')]},'thirdDisposition':{'type':Sequelize[_0x2be5('0x5')]},'note':{'type':Sequelize[_0x2be5('0x5')]},'phone':{'type':Sequelize[_0x2be5('0x5')]},'read1stAt':{'type':Sequelize[_0x2be5('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x2be5('0x6')]('in',_0x2be5('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2be5('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x2be5('0x6')]('in',_0x2be5('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2be5('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x49df=['BOOLEAN','DATE','STRING','ENUM','out','exports'];(function(_0x532850,_0x3a100a){var _0x4ea53f=function(_0x243531){while(--_0x243531){_0x532850['push'](_0x532850['shift']());}};_0x4ea53f(++_0x3a100a);}(_0x49df,0xad));var _0xf49d=function(_0x4cb03b,_0x47d402){_0x4cb03b=_0x4cb03b-0x0;var _0x132ba4=_0x49df[_0x4cb03b];return _0x132ba4;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xf49d('0x0')]={'closed':{'type':Sequelize[_0xf49d('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf49d('0x2')]},'disposition':{'type':Sequelize[_0xf49d('0x3')]},'secondDisposition':{'type':Sequelize[_0xf49d('0x3')]},'thirdDisposition':{'type':Sequelize[_0xf49d('0x3')]},'note':{'type':Sequelize[_0xf49d('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xf49d('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xf49d('0x4')]('in',_0xf49d('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf49d('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xf49d('0x4')]('in',_0xf49d('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 3ff823c..9b78791 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 _0xb07f=['server','fullname','firstName','attachments','Attachment','Messages','createdAt','direction','WhatsappAccount','Owner','get','Account','N.A.','closed','closedAt','disposition','basename','createReadStream','System','lastName','secret','views','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','download','log','err','unlinkSync','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','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','undefined','limit','count','offset','Content-Range','apply','reject','update','then','error','name','send','Users','TagIds','Tags','push','index','fieldName','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','select','field','color','from','u.fullname','ui.WhatsappInteractionId','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','Contact','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','find','ContactId','type','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','compact','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','isEmpty','t.id\x20IN\x20?','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','agent','user','role','toString','sequelize','keyBy','merge','WhatsappInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','includeAll','include','options','catch','create','describe','addMessage','ids','omit','findOne','WhatsappMessage','format','YYYY-MM-DD\x20HH:mm:ss','setTags','spread','emit','whatsappInteractionTags:save','removeTags','files','tmp','join','root'];(function(_0x1255f0,_0x4836ec){var _0x2facbe=function(_0x106bdd){while(--_0x106bdd){_0x1255f0['push'](_0x1255f0['shift']());}};_0x2facbe(++_0x4836ec);}(_0xb07f,0x109));var _0xfb07=function(_0x569245,_0x1c56bd){_0x569245=_0x569245-0x0;var _0x1d6508=_0xb07f[_0x569245];return _0x1d6508;};'use strict';var emlformat=require(_0xfb07('0x0'));var rimraf=require(_0xfb07('0x1'));var zipdir=require(_0xfb07('0x2'));var jsonpatch=require(_0xfb07('0x3'));var rp=require(_0xfb07('0x4'));var moment=require(_0xfb07('0x5'));var BPromise=require(_0xfb07('0x6'));var Mustache=require(_0xfb07('0x7'));var util=require(_0xfb07('0x8'));var path=require(_0xfb07('0x9'));var sox=require(_0xfb07('0xa'));var csv=require('to-csv');var ejs=require(_0xfb07('0xb'));var fs=require('fs');var fs_extra=require(_0xfb07('0xc'));var _=require(_0xfb07('0xd'));var squel=require(_0xfb07('0xe'));var crypto=require(_0xfb07('0xf'));var jsforce=require(_0xfb07('0x10'));var deskjs=require(_0xfb07('0x11'));var toCsv=require(_0xfb07('0x12'));var querystring=require(_0xfb07('0x13'));var Papa=require(_0xfb07('0x14'));var Redis=require(_0xfb07('0x15'));var authService=require(_0xfb07('0x16'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require(_0xfb07('0x17'));var logger=require(_0xfb07('0x18'))('api');var utils=require(_0xfb07('0x19'));var config=require(_0xfb07('0x1a'));var licenseUtil=require(_0xfb07('0x1b'));var db=require(_0xfb07('0x1c'))['db'];config[_0xfb07('0x1d')]=_[_0xfb07('0x1e')](config[_0xfb07('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0xfb07('0x1f'))(new Redis(config[_0xfb07('0x1d')]));require(_0xfb07('0x20'))[_0xfb07('0x21')](socket);function respondWithStatusCode(_0x2423f2,_0x3c283d){_0x3c283d=_0x3c283d||0xcc;return function(_0x29cbae){if(_0x29cbae){return _0x2423f2[_0xfb07('0x22')](_0x3c283d);}return _0x2423f2[_0xfb07('0x23')](_0x3c283d)[_0xfb07('0x24')]();};}function respondWithResult(_0x3dde76,_0x1cfc43){_0x1cfc43=_0x1cfc43||0xc8;return function(_0x1e42c4){if(_0x1e42c4){return _0x3dde76[_0xfb07('0x23')](_0x1cfc43)['json'](_0x1e42c4);}};}function respondWithFilteredResult(_0x57fc39,_0x3e747e){return function(_0x44b9c4){if(_0x44b9c4){var _0x197f12=typeof _0x3e747e['offset']===_0xfb07('0x25')&&typeof _0x3e747e[_0xfb07('0x26')]==='undefined';var _0x4fc244=_0x44b9c4[_0xfb07('0x27')];var _0x4b5708=_0x197f12?0x0:_0x3e747e[_0xfb07('0x28')];var _0x2c6c44=_0x197f12?_0x44b9c4[_0xfb07('0x27')]:_0x3e747e[_0xfb07('0x28')]+_0x3e747e[_0xfb07('0x26')];var _0x23c2be;if(_0x2c6c44>=_0x4fc244){_0x2c6c44=_0x4fc244;_0x23c2be=0xc8;}else{_0x23c2be=0xce;}_0x57fc39[_0xfb07('0x23')](_0x23c2be);return _0x57fc39['set'](_0xfb07('0x29'),_0x4b5708+'-'+_0x2c6c44+'/'+_0x4fc244)['json'](_0x44b9c4);}return null;};}function patchUpdates(_0x22ed97){return function(_0x14c771){try{jsonpatch[_0xfb07('0x2a')](_0x14c771,_0x22ed97,!![]);}catch(_0x301c1a){return BPromise[_0xfb07('0x2b')](_0x301c1a);}return _0x14c771['save']();};}function saveUpdates(_0x295989,_0x451cd8){return function(_0x10835a){if(_0x10835a){return _0x10835a[_0xfb07('0x2c')](_0x295989)[_0xfb07('0x2d')](function(_0x2eb3e6){return _0x2eb3e6;});}return null;};}function removeEntity(_0x531346,_0x36d6f3){return function(_0x28f33a){if(_0x28f33a){return _0x28f33a['destroy']()[_0xfb07('0x2d')](function(){_0x531346[_0xfb07('0x23')](0xcc)[_0xfb07('0x24')]();});}};}function handleEntityNotFound(_0x149ac0,_0x46927a){return function(_0x2b0650){if(!_0x2b0650){_0x149ac0[_0xfb07('0x22')](0x194);}return _0x2b0650;};}function handleError(_0x24ff99,_0x95f1d){_0x95f1d=_0x95f1d||0x1f4;return function(_0x27668f){logger[_0xfb07('0x2e')](_0x27668f['stack']);if(_0x27668f[_0xfb07('0x2f')]){delete _0x27668f[_0xfb07('0x2f')];}_0x24ff99[_0xfb07('0x23')](_0x95f1d)[_0xfb07('0x30')](_0x27668f);};}function getInteractionUsers(_0x5dd4c9,_0x46d57e){return new BPromise(function(_0xd5290c,_0x4ce9a4){try{if(_0x46d57e[_0x5dd4c9['id']]){_0x5dd4c9[_0xfb07('0x31')]=_['map'](_0x46d57e[_0x5dd4c9['id']],function(_0x328d2e){return{'id':_0x328d2e['id'],'fullname':_0x328d2e['fullname']};});}}catch(_0x56b48c){_0x4ce9a4(_0x56b48c);}_0xd5290c(_0x5dd4c9);});}function getInteractionTags(_0x4a8d4c,_0xf33bd0){return new BPromise(function(_0x3a6e9a,_0x38943c){try{if(_0x4a8d4c[_0xfb07('0x32')]){_0x4a8d4c[_0xfb07('0x33')]=[];_0x4a8d4c[_0xfb07('0x32')]['split'](',')['forEach'](function(_0xc1a4b0){_0x4a8d4c[_0xfb07('0x33')][_0xfb07('0x34')](_0xf33bd0[_0xc1a4b0]);});}delete _0x4a8d4c[_0xfb07('0x32')];}catch(_0x5e28cd){_0x38943c(_0x5e28cd);}_0x3a6e9a(_0x4a8d4c);});}function updateWhatsappInteraction(_0x5e721f,_0x22ef8c,_0x3e0d11){return new BPromise(function(_0x4757f2,_0x1162ec){return getInteractionUsers(_0x5e721f,_0x3e0d11)[_0xfb07('0x2d')](function(_0x32c031){return getInteractionTags(_0x32c031,_0x22ef8c);})['then'](function(_0x4b285d){_0x4757f2(_0x4b285d);})['catch'](function(_0x26a2d1){_0x1162ec(_0x26a2d1);});});}exports[_0xfb07('0x35')]=function(_0x1bad87,_0xc58e65){var _0x5cb29d={},_0x4958b7={},_0x9b59fc={'count':0x0,'rows':[]};var _0x1d0132=_['map'](db['WhatsappInteraction']['rawAttributes'],function(_0x23e510){return{'name':_0x23e510[_0xfb07('0x36')],'type':_0x23e510['type']['key']};});_0x4958b7[_0xfb07('0x37')]=_[_0xfb07('0x38')](_0x1d0132,_0xfb07('0x2f'));_0x4958b7[_0xfb07('0x39')]=_[_0xfb07('0x3a')](_0x1bad87['query']);_0x4958b7[_0xfb07('0x3b')]=_[_0xfb07('0x3c')](_0x4958b7[_0xfb07('0x37')],_0x4958b7[_0xfb07('0x39')]);_0x5cb29d['attributes']=_['intersection'](_0x4958b7[_0xfb07('0x37')],qs[_0xfb07('0x3d')](_0x1bad87[_0xfb07('0x39')][_0xfb07('0x3d')]));_0x5cb29d[_0xfb07('0x3e')]=_0x5cb29d[_0xfb07('0x3e')][_0xfb07('0x3f')]?_0x5cb29d['attributes']:_0x4958b7['model'];if(!_0x1bad87[_0xfb07('0x39')][_0xfb07('0x40')]('nolimit')){_0x5cb29d['limit']=qs[_0xfb07('0x26')](_0x1bad87[_0xfb07('0x39')][_0xfb07('0x26')]);_0x5cb29d['offset']=qs['offset'](_0x1bad87[_0xfb07('0x39')][_0xfb07('0x28')]);}_0x5cb29d[_0xfb07('0x41')]=qs[_0xfb07('0x42')](_0x1bad87[_0xfb07('0x39')][_0xfb07('0x42')]);_0x5cb29d[_0xfb07('0x43')]=qs[_0xfb07('0x3b')](_[_0xfb07('0x44')](_0x1bad87['query'],_0x4958b7[_0xfb07('0x3b')]),_0x1d0132);var _0x12c588=[];var _0x3d6372=squel[_0xfb07('0x45')]()[_0xfb07('0x46')]('id')[_0xfb07('0x46')](_0xfb07('0x2f'))[_0xfb07('0x46')](_0xfb07('0x47'))[_0xfb07('0x48')]('tools_tags');var _0x5c0ed7=squel[_0xfb07('0x45')]()[_0xfb07('0x46')]('u.id')[_0xfb07('0x46')](_0xfb07('0x49'))[_0xfb07('0x46')](_0xfb07('0x4a'))[_0xfb07('0x48')]('user_has_whatsapp_interactions','ui')['left_join'](_0xfb07('0x4b'),'u',_0xfb07('0x4c'));var _0x38354c=squel[_0xfb07('0x45')]()[_0xfb07('0x48')](_0xfb07('0x4d'),'i')[_0xfb07('0x4e')](_0xfb07('0x4f'),'c',_0xfb07('0x50'))[_0xfb07('0x4e')]('users','o','o.id\x20=\x20i.UserId')['left_join'](_0xfb07('0x51'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0xfb07('0x4e')](_0xfb07('0x52'),'me',_0xfb07('0x53'))[_0xfb07('0x4e')](_0xfb07('0x54'),'it',_0xfb07('0x55'))['left_join'](_0xfb07('0x56'),'t',_0xfb07('0x57'));var _0x2d4a4d=squel[_0xfb07('0x58')]();var _0x36d2b1=[];var _0x589f50=squel[_0xfb07('0x58')]();var _0x3b85f7;if(_0x1bad87[_0xfb07('0x39')][_0xfb07('0x59')]){_0x3b85f7=as[_0xfb07('0x5a')](_0x1bad87['query'][_0xfb07('0x59')]);var _0x42ea0b=_0x3b85f7[_0xfb07('0x5b')];for(var _0x3b84a0=0x0;_0x3b84a0<_0x3b85f7[_0xfb07('0x5c')]['length'];_0x3b84a0++){var _0x210875=_0x3b85f7[_0xfb07('0x5c')][_0x3b84a0];var _0x26a7b7='i';var _0x16bd36=_['find'](_0x1d0132,[_0xfb07('0x2f'),_0x210875[_0xfb07('0x46')]]);if(!_0x16bd36){switch(_0x210875[_0xfb07('0x46')]){case _0xfb07('0x5d'):if(_0x210875[_0xfb07('0x5e')]==0x1){_0x38354c[_0xfb07('0x5f')]('`'+_0x210875[_0xfb07('0x46')]+_0xfb07('0x60'));}else{_0x38354c[_0xfb07('0x5f')]('`'+_0x210875[_0xfb07('0x46')]+'`\x20>\x200');}break;case _0xfb07('0x61'):if(_0x210875['operator']===_0xfb07('0x62')){if(_0x210875[_0xfb07('0x5e')][_0xfb07('0x63')]('\x20')[_0xfb07('0x3f')]>0x1){_0x2d4a4d[_0x42ea0b](_0xfb07('0x64'),qs[_0xfb07('0x65')](_0x210875[_0xfb07('0x5e')]),null);}else{var _0x4cc860='%'+_0x210875['value']+'%';_0x2d4a4d[_0x42ea0b]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x4cc860,_0x4cc860,_0x4cc860);}}else{_0x16bd36=_[_0xfb07('0x66')](_0x1d0132,[_0xfb07('0x2f'),_0xfb07('0x67')]);_0x210875['field']=_0xfb07('0x67');_0x45a88f=as['buildExpression'](_0x26a7b7,_0x16bd36[_0xfb07('0x68')],_0x210875);_0x2d4a4d[_0x42ea0b](_0x45a88f[_0xfb07('0x69')],_0x45a88f['value'][_0xfb07('0x6a')],_0x45a88f[_0xfb07('0x5e')][_0xfb07('0x24')]);}break;case _0xfb07('0x6b'):var _0x294dc8=_0x210875[_0xfb07('0x5e')][_0xfb07('0x63')](',')[_0xfb07('0x38')](function(_0x2bca9f){return Number(_0x2bca9f);});_0x294dc8[_0xfb07('0x6c')](function(_0x18abd2){_0x589f50['or'](_0xfb07('0x6d'),'%,'+_0x18abd2+',%');});_0x36d2b1=_[_0xfb07('0x6e')](_0x36d2b1,_0x294dc8);break;case _0xfb07('0x6f'):if(_0x210875['operator']===_0xfb07('0x62')){_0x2d4a4d[_0x42ea0b](_0xfb07('0x70'),'%'+_0x210875['value']+'%',null);}else{_0x16bd36=_['find'](_0x1d0132,[_0xfb07('0x2f'),_0xfb07('0x71')]);_0x210875[_0xfb07('0x46')]='UserId';_0x45a88f=as[_0xfb07('0x72')](_0x26a7b7,_0x16bd36['type'],_0x210875);_0x2d4a4d[_0x42ea0b](_0x45a88f['text'],_0x45a88f['value']['start'],_0x45a88f[_0xfb07('0x5e')][_0xfb07('0x24')]);}break;case _0xfb07('0x73'):_0x45a88f=as[_0xfb07('0x72')]('me',null,_0x210875);_0x2d4a4d[_0x42ea0b](_0x45a88f[_0xfb07('0x69')],_0x45a88f[_0xfb07('0x5e')][_0xfb07('0x6a')],_0x45a88f['value'][_0xfb07('0x24')]);break;}}else{var _0x45a88f=as[_0xfb07('0x72')](_0x26a7b7,_0x16bd36[_0xfb07('0x68')],_0x210875);_0x2d4a4d[_0x42ea0b](_0x45a88f[_0xfb07('0x69')],_0x45a88f[_0xfb07('0x5e')][_0xfb07('0x6a')],_0x45a88f[_0xfb07('0x5e')]['end']);}}}else{var _0xa9b810=_(_0x1bad87[_0xfb07('0x39')])[_0xfb07('0x3a')]()[_0xfb07('0x38')](function(_0x2678d2){return _['some'](_0x1d0132,['name',_0x2678d2])?_0x2678d2:undefined;})[_0xfb07('0x74')]()[_0xfb07('0x5e')]();if(!_['isEmpty'](_0xa9b810)){_0xa9b810[_0xfb07('0x6c')](function(_0x311c6d){if(_0x311c6d===_0xfb07('0x75')){_0x38354c[_0xfb07('0x43')](_0xfb07('0x76'),[][_0xfb07('0x77')](_0x1bad87[_0xfb07('0x39')][_0x311c6d]));}else if(_0x311c6d==='createdAt'){var _0x4c1238=JSON[_0xfb07('0x78')](_0x1bad87['query'][_0x311c6d])[_0xfb07('0x79')];var _0x25d543=JSON[_0xfb07('0x78')](_0x1bad87[_0xfb07('0x39')][_0x311c6d])[_0xfb07('0x7a')];_0x38354c[_0xfb07('0x43')](_0xfb07('0x7b'),_0x4c1238,_0x25d543);}else{if(_0x1bad87[_0xfb07('0x39')][_0x311c6d]===_0xfb07('0x7c')){_0x38354c['where']('i.'+_0x311c6d+_0xfb07('0x7d'));}else{_0x38354c[_0xfb07('0x43')]('i.'+_0x311c6d+_0xfb07('0x7e'),_0x1bad87[_0xfb07('0x39')][_0x311c6d]);}}});}if(_0x1bad87[_0xfb07('0x39')]['read']){if(_0x1bad87[_0xfb07('0x39')][_0xfb07('0x7f')]==0x1){_0x38354c[_0xfb07('0x5f')](_0xfb07('0x80'));}else{_0x38354c['having'](_0xfb07('0x81'));}}if(_0x1bad87['query']['tag']){_0x36d2b1=_[_0xfb07('0x82')](_0x1bad87[_0xfb07('0x39')][_0xfb07('0x83')])?_0x1bad87[_0xfb07('0x39')][_0xfb07('0x83')]:new Array(_0x1bad87[_0xfb07('0x39')]['tag']);_0x36d2b1[_0xfb07('0x6c')](function(_0x29849c){_0x589f50['or'](_0xfb07('0x6d'),'%,'+_0x29849c+',%');});}if(_0x1bad87[_0xfb07('0x39')][_0xfb07('0x84')]){var _0x1533d7=_0x1bad87[_0xfb07('0x39')][_0xfb07('0x84')][_0xfb07('0x85')]('\x5c','\x5c\x5c')[_0xfb07('0x85')](/'/g,'\x27\x27');if(qs[_0xfb07('0x86')](_0x1533d7)){_0x2d4a4d['or'](_0xfb07('0x87'),_0x1533d7+'%')['or'](_0xfb07('0x88'),_0x1533d7+'%');}else{_0x2d4a4d['or'](_0xfb07('0x89'),qs[_0xfb07('0x65')](_0x1533d7))['or'](_0xfb07('0x8a'),_0x1533d7+'%');}}}_0x38354c['where'](_0x2d4a4d);_0x38354c[_0xfb07('0x8b')](_0xfb07('0x8c'));var _0x3d5466={'type':db[_0xfb07('0x8d')][_0xfb07('0x8e')][_0xfb07('0x8f')],'raw':!![]};var _0x1ecadf=_0x38354c[_0xfb07('0x90')]();_0x1ecadf[_0xfb07('0x46')](_0xfb07('0x8c'));_0x1ecadf[_0xfb07('0x46')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x5cb29d[_0xfb07('0x41')]){_0x5cb29d[_0xfb07('0x41')][_0xfb07('0x6c')](function(_0x55ed70){var _0x18a22c=_0x55ed70[0x0]===_0xfb07('0x91')?_0x55ed70[0x0]:'i.'+_0x55ed70[0x0];_0x38354c[_0xfb07('0x41')](_0x18a22c,_0x55ed70[0x1]==='DESC'?![]:!![]);});}if(!_[_0xfb07('0x92')](_0x36d2b1)){_0x38354c[_0xfb07('0x5f')](_0x589f50);_0x1ecadf[_0xfb07('0x43')](_0xfb07('0x93'),_0x36d2b1);}BPromise['resolve']()[_0xfb07('0x2d')](function(){if(!_0x3b85f7){if(_0x1bad87[_0xfb07('0x39')][_0xfb07('0x75')])return;_0x1ecadf[_0xfb07('0x43')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x38354c[_0xfb07('0x43')](_0xfb07('0x94'));return;}if(_0x1bad87['user']['role']!==_0xfb07('0x95'))return;return _0x1bad87[_0xfb07('0x96')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x2d732d){if(_[_0xfb07('0x92')](_0x2d732d)){_0x1ecadf[_0xfb07('0x43')]('i.WhatsappAccountId\x20IS\x20NULL');_0x38354c[_0xfb07('0x43')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x1ecadf[_0xfb07('0x43')](_0xfb07('0x76'),_[_0xfb07('0x38')](_0x2d732d,'id'));_0x38354c[_0xfb07('0x43')](_0xfb07('0x76'),_[_0xfb07('0x38')](_0x2d732d,'id'));}});})['then'](function(){if(_0x1bad87['user'][_0xfb07('0x97')]===_0xfb07('0x95')&&!_0x3b85f7&&!_0x1bad87[_0xfb07('0x39')][_0xfb07('0x75')])return[];return db['sequelize'][_0xfb07('0x39')](_0x1ecadf[_0xfb07('0x98')](),_0x3d5466);})[_0xfb07('0x2d')](function(_0x1a1edf){_0x9b59fc[_0xfb07('0x27')]=_0x1a1edf[_0xfb07('0x3f')];if(_0x9b59fc['count']===0x0)return[];return db[_0xfb07('0x99')][_0xfb07('0x39')](_0x3d6372[_0xfb07('0x98')](),_0x3d5466)[_0xfb07('0x2d')](function(_0x257f9f){_0x12c588=_[_0xfb07('0x9a')](_0x257f9f,'id');_0x3d5466=_[_0xfb07('0x9b')](_0x3d5466,{'model':db[_0xfb07('0x9c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1bad87[_0xfb07('0x39')]['fields']){_0x5cb29d[_0xfb07('0x3e')][_0xfb07('0x6c')](function(_0x55665f){_0x38354c['field']('i.'+_0x55665f);});}else{_0x38354c[_0xfb07('0x46')](_0xfb07('0x9d'),'unreadMessages');_0x38354c[_0xfb07('0x46')](_0xfb07('0x9e'),_0xfb07('0x9f'));_0x38354c[_0xfb07('0x46')]('a.mandatoryDisposition',_0xfb07('0xa0'));_0x38354c[_0xfb07('0x46')](_0xfb07('0xa1'),_0xfb07('0x91'));_0x38354c[_0xfb07('0x46')]('i.*');_0x38354c[_0xfb07('0x46')]('c.firstName',_0xfb07('0xa2'));_0x38354c['field'](_0xfb07('0xa3'),_0xfb07('0xa4'));_0x38354c[_0xfb07('0x46')](_0xfb07('0xa5'),_0xfb07('0xa6'));_0x38354c[_0xfb07('0x46')](_0xfb07('0xa7'),_0xfb07('0xa8'));_0x38354c[_0xfb07('0x46')](_0xfb07('0xa9'),_0xfb07('0xaa'));_0x38354c[_0xfb07('0x46')](_0xfb07('0xab'),_0xfb07('0xac'));_0x38354c['field'](_0xfb07('0xad'),'Owner.fullname');_0x38354c[_0xfb07('0x46')](_0xfb07('0xae'),_0xfb07('0xaf'));_0x38354c[_0xfb07('0x46')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xfb07('0x32'));}if(_0x5cb29d[_0xfb07('0x26')])_0x38354c[_0xfb07('0x26')](_0x5cb29d[_0xfb07('0x26')]);if(_0x5cb29d['offset'])_0x38354c[_0xfb07('0x28')](_0x5cb29d['offset']);return db[_0xfb07('0x99')][_0xfb07('0x39')](_0x38354c[_0xfb07('0x98')](),_0x3d5466);})[_0xfb07('0x2d')](function(_0x1c0887){if(_0x1c0887[_0xfb07('0x3f')]>0x0)_0x5c0ed7[_0xfb07('0x43')](_0xfb07('0xb0'),_[_0xfb07('0x38')](_0x1c0887,'id'));return db[_0xfb07('0x99')]['query'](_0x5c0ed7[_0xfb07('0x98')](),_0x3d5466)[_0xfb07('0x2d')](function(_0x58adb9){var _0x21c478=_[_0xfb07('0xb1')](_0x58adb9,_0xfb07('0xb2'));var _0x58950e=[];_0x1c0887[_0xfb07('0x6c')](function(_0x4cf024){_0x58950e[_0xfb07('0x34')](updateWhatsappInteraction(_0x4cf024,_0x12c588,_0x21c478));});return BPromise[_0xfb07('0xb3')](_0x58950e);});});})[_0xfb07('0x2d')](function(_0x157c2c){_0x9b59fc[_0xfb07('0xb4')]=_0x157c2c;return _0x9b59fc;})[_0xfb07('0x2d')](respondWithFilteredResult(_0xc58e65,_0x5cb29d))['catch'](handleError(_0xc58e65,null));};exports[_0xfb07('0xb5')]=function(_0x805700,_0x4fdd58){var _0x1df2dd={'raw':![],'where':{'id':_0x805700[_0xfb07('0xb6')]['id']}},_0x1ca814={};_0x1ca814[_0xfb07('0x37')]=_[_0xfb07('0x3a')](db[_0xfb07('0x9c')]['rawAttributes']);_0x1ca814[_0xfb07('0x39')]=_[_0xfb07('0x3a')](_0x805700['query']);_0x1ca814[_0xfb07('0x3b')]=_[_0xfb07('0x3c')](_0x1ca814[_0xfb07('0x37')],_0x1ca814[_0xfb07('0x39')]);_0x1df2dd[_0xfb07('0x3e')]=_[_0xfb07('0x3c')](_0x1ca814[_0xfb07('0x37')],qs[_0xfb07('0x3d')](_0x805700[_0xfb07('0x39')][_0xfb07('0x3d')]));_0x1df2dd[_0xfb07('0x3e')]=_0x1df2dd[_0xfb07('0x3e')][_0xfb07('0x3f')]?_0x1df2dd[_0xfb07('0x3e')]:_0x1ca814[_0xfb07('0x37')];if(_0x805700[_0xfb07('0x39')][_0xfb07('0xb7')]){_0x1df2dd[_0xfb07('0xb8')]=[{'all':!![]}];}_0x1df2dd=_[_0xfb07('0x9b')]({},_0x1df2dd,_0x805700[_0xfb07('0xb9')]);return db[_0xfb07('0x9c')][_0xfb07('0x66')](_0x1df2dd)[_0xfb07('0x2d')](handleEntityNotFound(_0x4fdd58,null))[_0xfb07('0x2d')](respondWithResult(_0x4fdd58,null))[_0xfb07('0xba')](handleError(_0x4fdd58,null));};exports[_0xfb07('0xbb')]=function(_0x553c97,_0x3f501e){return db[_0xfb07('0x9c')][_0xfb07('0xbb')](_0x553c97[_0xfb07('0x73')],{})[_0xfb07('0x2d')](respondWithResult(_0x3f501e,0xc9))['catch'](handleError(_0x3f501e,null));};exports[_0xfb07('0x2c')]=function(_0x9f79da,_0xec7d03){if(_0x9f79da[_0xfb07('0x73')]['id']){delete _0x9f79da[_0xfb07('0x73')]['id'];}return db[_0xfb07('0x9c')][_0xfb07('0x66')]({'where':{'id':_0x9f79da[_0xfb07('0xb6')]['id']}})[_0xfb07('0x2d')](handleEntityNotFound(_0xec7d03,null))[_0xfb07('0x2d')](saveUpdates(_0x9f79da[_0xfb07('0x73')],null))[_0xfb07('0x2d')](respondWithResult(_0xec7d03,null))[_0xfb07('0xba')](handleError(_0xec7d03,null));};exports['destroy']=function(_0x3e326c,_0x19bdd3){return db[_0xfb07('0x9c')][_0xfb07('0x66')]({'where':{'id':_0x3e326c[_0xfb07('0xb6')]['id']}})[_0xfb07('0x2d')](handleEntityNotFound(_0x19bdd3,null))[_0xfb07('0x2d')](removeEntity(_0x19bdd3,null))[_0xfb07('0xba')](handleError(_0x19bdd3,null));};exports[_0xfb07('0xbc')]=function(_0x5b0103,_0x4f81b7){return db[_0xfb07('0x9c')][_0xfb07('0xbc')]()[_0xfb07('0x2d')](respondWithResult(_0x4f81b7,null))['catch'](handleError(_0x4f81b7,null));};exports['addMessage']=function(_0x136020,_0x4963f6,_0x34bf02){return db['WhatsappMessage'][_0xfb07('0x66')]({'where':{'id':_0x136020['params']['id']}})['then'](handleEntityNotFound(_0x4963f6,null))[_0xfb07('0x2d')](function(_0xc94dc8){if(_0xc94dc8){return _0xc94dc8[_0xfb07('0xbd')](_0x136020[_0xfb07('0x73')][_0xfb07('0xbe')],_[_0xfb07('0xbf')](_0x136020[_0xfb07('0x73')],[_0xfb07('0xbe'),'id'])||{});}})[_0xfb07('0x2d')](respondWithResult(_0x4963f6,null))[_0xfb07('0xba')](handleError(_0x4963f6,null));};exports['getMessages']=function(_0x16e71e,_0x2c3793,_0x466479){var _0x4b1645={'raw':![],'where':{}};var _0x175718={};var _0x18bb08={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xfb07('0xc0')]({'where':{'id':_0x16e71e[_0xfb07('0xb6')]['id']}})[_0xfb07('0x2d')](handleEntityNotFound(_0x2c3793,null))[_0xfb07('0x2d')](function(_0x4bc25f){if(_0x4bc25f){_0x175718[_0xfb07('0x37')]=_['keys'](db[_0xfb07('0xc1')]['rawAttributes']);_0x175718[_0xfb07('0x39')]=_[_0xfb07('0x3a')](_0x16e71e['query']);_0x175718['filters']=_[_0xfb07('0x3c')](_0x175718['model'],_0x175718[_0xfb07('0x39')]);_0x4b1645['attributes']=_[_0xfb07('0x3c')](_0x175718[_0xfb07('0x37')],qs[_0xfb07('0x3d')](_0x16e71e[_0xfb07('0x39')][_0xfb07('0x3d')]));_0x4b1645['attributes']=_0x4b1645['attributes'][_0xfb07('0x3f')]?_0x4b1645[_0xfb07('0x3e')]:_0x175718[_0xfb07('0x37')];if(!_0x16e71e[_0xfb07('0x39')]['hasOwnProperty']('nolimit')){_0x4b1645[_0xfb07('0x26')]=qs[_0xfb07('0x26')](_0x16e71e[_0xfb07('0x39')][_0xfb07('0x26')]);_0x4b1645['offset']=qs[_0xfb07('0x28')](_0x16e71e[_0xfb07('0x39')][_0xfb07('0x28')]);}_0x4b1645['order']=qs[_0xfb07('0x42')](_0x16e71e['query'][_0xfb07('0x42')]);_0x4b1645['where']=qs['filters'](_[_0xfb07('0x44')](_0x16e71e[_0xfb07('0x39')],_0x175718[_0xfb07('0x3b')]));_0x4b1645['where'][_0xfb07('0xb2')]=_0x4bc25f['id'];if(_0x16e71e[_0xfb07('0x39')]['filter']){_0x4b1645[_0xfb07('0x43')]=_[_0xfb07('0x9b')](_0x4b1645[_0xfb07('0x43')],{'$or':_[_0xfb07('0x38')](_0x4b1645[_0xfb07('0x3e')],function(_0x530f44){var _0x29e21e={};_0x29e21e[_0x530f44]={'$like':'%'+_0x16e71e[_0xfb07('0x39')][_0xfb07('0x84')]+'%'};return _0x29e21e;})});}if(_0x16e71e[_0xfb07('0x39')][_0xfb07('0x79')]){var _0x5cbd03=_0x16e71e[_0xfb07('0x39')][_0xfb07('0x79')]['split'](',');var _0x5da3b0={};_0x5da3b0[_0x5cbd03[0x0]]={'$gte':moment(_0x5cbd03[0x1])[_0xfb07('0xc2')](_0xfb07('0xc3'))};_0x4b1645[_0xfb07('0x43')]=_[_0xfb07('0x9b')](_0x4b1645[_0xfb07('0x43')],_0x5da3b0);}_0x4b1645=_['merge']({},_0x4b1645,_0x16e71e['options']);return db[_0xfb07('0xc1')][_0xfb07('0x27')]({'where':_0x4b1645['where']})[_0xfb07('0x2d')](function(_0x287a65){_0x18bb08[_0xfb07('0x27')]=_0x287a65;if(_0x16e71e[_0xfb07('0x39')][_0xfb07('0xb7')]){_0x4b1645[_0xfb07('0xb8')]=[{'all':!![]}];}return db[_0xfb07('0xc1')]['findAll'](_0x4b1645);})[_0xfb07('0x2d')](function(_0x4c83ba){_0x18bb08[_0xfb07('0xb4')]=_0x4c83ba;return _0x18bb08;});}})[_0xfb07('0x2d')](respondWithFilteredResult(_0x2c3793,_0x4b1645))[_0xfb07('0xba')](handleError(_0x2c3793,null));};exports['addTags']=function(_0x322317,_0x40b8b1,_0x90dad6){return db[_0xfb07('0x9c')][_0xfb07('0x66')]({'where':{'id':_0x322317[_0xfb07('0xb6')]['id']}})[_0xfb07('0x2d')](handleEntityNotFound(_0x40b8b1,null))[_0xfb07('0x2d')](function(_0x5d670c){if(_0x5d670c){return _0x5d670c[_0xfb07('0xc4')](_0x322317['body'][_0xfb07('0xbe')],_[_0xfb07('0xbf')](_0x322317['body'],[_0xfb07('0xbe'),'id'])||{})[_0xfb07('0xc5')](function(){return db[_0xfb07('0x6b')]['findAll']({'attributes':['id',_0xfb07('0x2f'),_0xfb07('0x47')],'where':{'id':_0x322317[_0xfb07('0x73')]['ids']}});})[_0xfb07('0x2d')](function(_0x380f24){socket[_0xfb07('0xc6')](_0xfb07('0xc7'),{'id':Number(_0x322317[_0xfb07('0xb6')]['id']),'tags':_0x380f24||[]});return{'id':Number(_0x322317[_0xfb07('0xb6')]['id']),'tags':_0x380f24||[]};});}})[_0xfb07('0x2d')](respondWithResult(_0x40b8b1,null))[_0xfb07('0xba')](handleError(_0x40b8b1,null));};exports[_0xfb07('0xc8')]=function(_0x303107,_0x21618a,_0x4df276){return db['WhatsappInteraction']['find']({'where':{'id':_0x303107[_0xfb07('0xb6')]['id']}})['then'](handleEntityNotFound(_0x21618a,null))[_0xfb07('0x2d')](function(_0x199849){if(_0x199849){return _0x199849['removeTags'](_0x303107['query'][_0xfb07('0xbe')]);}})['then'](respondWithStatusCode(_0x21618a,null))[_0xfb07('0xba')](handleError(_0x21618a,null));};exports['download']=function(_0x138314,_0xfcdf63){var _0x5c6412=moment()['unix']()[_0xfb07('0x98')]();var _0x105440=path['join'](config['root'],'server',_0xfb07('0xc9'),_0xfb07('0xca'));var _0x5549d5=path[_0xfb07('0xcb')](config[_0xfb07('0xcc')],_0xfb07('0xcd'),_0xfb07('0xc9'),'attachments');var _0x64b8db=path[_0xfb07('0xcb')](_0x105440,_0x5c6412);var _0x306da8=util[_0xfb07('0xc2')]('transcript-%d-%s.zip',_0x138314[_0xfb07('0xb6')]['id'],_0x5c6412);var _0x5b7a4c=path[_0xfb07('0xcb')](_0x105440,_0x306da8);var _0xbe5376=[];_0xbe5376[_0xfb07('0x34')]({'model':db[_0xfb07('0x6f')],'as':'User','attributes':['id',_0xfb07('0xce')],'raw':!![]});_0xbe5376[_0xfb07('0x34')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xfb07('0xcf'),'lastName'],'raw':!![]});if(_0x138314[_0xfb07('0x39')][_0xfb07('0xd0')]){_0xbe5376[_0xfb07('0x34')]({'model':db['Attachment'],'as':_0xfb07('0xd1'),'raw':!![]});}var _0x1b1103=[{'model':db[_0xfb07('0xc1')],'as':_0xfb07('0xd2'),'attributes':['id',_0xfb07('0x73'),_0xfb07('0xd3'),_0xfb07('0xd4'),'secret',_0xfb07('0x7f')],'include':_0xbe5376}];_0x1b1103[_0xfb07('0x34')]({'model':db[_0xfb07('0xd5')],'as':'Account','attributes':['id',_0xfb07('0x2f')]});_0x1b1103['push']({'model':db[_0xfb07('0x6f')],'as':_0xfb07('0xd6'),'attributes':['id','fullname']});return db['WhatsappInteraction'][_0xfb07('0x66')]({'where':{'id':_0x138314[_0xfb07('0xb6')]['id']},'include':_0x1b1103})[_0xfb07('0x2d')](handleEntityNotFound(_0xfcdf63,null))[_0xfb07('0x2d')](function(_0x131264){if(_0x131264){var _0x18ab05=_0x131264[_0xfb07('0xd7')]({'plain':!![]});fs['mkdirSync'](_0x64b8db);var _0x53ea6b={'channel':'Whatsapp','account':_0x18ab05[_0xfb07('0xd8')][_0xfb07('0x2f')],'agent':_0x18ab05['Owner']?_0x18ab05['Owner'][_0xfb07('0xce')]:_0xfb07('0xd9'),'createdAt':moment(_0x18ab05[_0xfb07('0xd3')])[_0xfb07('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x18ab05[_0xfb07('0xda')]?moment(_0x18ab05[_0xfb07('0xdb')])[_0xfb07('0xc2')](_0xfb07('0xc3'))['toString']():'','disposition':_0x18ab05[_0xfb07('0xdc')],'messages':_(_0x18ab05['Messages'])[_0xfb07('0x84')]({'secret':![]})[_0xfb07('0x38')](function(_0x5dc248){if(_0x5dc248[_0xfb07('0xd1')]){var _0x327aed=path['join'](_0x5549d5,_0x5dc248[_0xfb07('0xd1')][_0xfb07('0xdd')]);if(fs['existsSync'](_0x327aed)){fs[_0xfb07('0xde')](_0x327aed)['pipe'](fs['createWriteStream'](path['join'](_0x64b8db,_0x5dc248[_0xfb07('0xd1')]['basename'])));}}return{'date':moment(_0x5dc248['createdAt'])[_0xfb07('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')[_0xfb07('0x98')](),'sender':_0x5dc248[_0xfb07('0xd4')]==='out'?_0x5dc248[_0xfb07('0x6f')]?_0x5dc248[_0xfb07('0x6f')][_0xfb07('0xce')]:_0xfb07('0xdf'):_0x5dc248['Contact'][_0xfb07('0xcf')]+(_0x5dc248[_0xfb07('0x61')][_0xfb07('0xe0')]?'\x20'+_0x5dc248[_0xfb07('0x61')]['lastName']:''),'body':_0x5dc248[_0xfb07('0xd1')]?_0x5dc248[_0xfb07('0xd1')][_0xfb07('0xdd')]:_0x5dc248[_0xfb07('0x73')],'direction':_0x5dc248[_0xfb07('0xd4')]==='out'?'A':'C','secret':_0x5dc248[_0xfb07('0xe1')],'read':_0x5dc248['read'],'attachment':_0x5dc248[_0xfb07('0xd1')]};})[_0xfb07('0x5e')]()};return ejs['renderFile'](path['join'](config['root'],_0xfb07('0xcd'),_0xfb07('0xe2'),_0xfb07('0xe3')),{'interaction':_0x53ea6b})[_0xfb07('0x2d')](function(_0x522c8b){var _0x1c7e0b=path['join'](_0x64b8db,_0xfb07('0xe4')+_0x18ab05['id']+'-'+_0x5c6412+_0xfb07('0xe5'));var _0x494253={'path':_0x1c7e0b,'channel':_0xfb07('0xe6'),'interactionId':_0x18ab05['id']};return pdf['createPdfFromHTML'](_0x522c8b,_0x494253);})[_0xfb07('0x2d')](function(){return new BPromise(function(_0x38d1cb,_0x2c45a9){zipdir(_0x64b8db,{'saveTo':_0x5b7a4c},function(_0x57d4cd,_0x45c4d0){if(_0x57d4cd)return _0x2c45a9(_0x57d4cd);return _0x38d1cb(_0x45c4d0);});})[_0xfb07('0x2d')](function(){return new BPromise(function(_0x4e7f4b,_0x17ed70){rimraf(_0x64b8db,function(_0x6a436c){if(_0x6a436c)_0x17ed70(_0x6a436c);return _0x4e7f4b();});});})[_0xfb07('0x2d')](function(){return _0xfcdf63[_0xfb07('0xe7')](_0x5b7a4c,_0x306da8,function(_0x3d7afc){if(_0x3d7afc){console[_0xfb07('0xe8')](_0xfb07('0xe9'),_0x3d7afc);}else{fs[_0xfb07('0xea')](_0x5b7a4c);}});});});}else{return _0xfcdf63[_0xfb07('0x22')](0xc8);}})[_0xfb07('0xba')](handleError(_0xfcdf63,null));}; \ No newline at end of file +var _0xd1d4=['disposition','existsSync','createReadStream','pipe','createWriteStream','out','basename','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','unlinkSync','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','name','send','Users','map','TagIds','forEach','push','index','WhatsappInteraction','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','field','from','tools_tags','select','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','unreadMessages','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','value','split','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty','where','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','clone','contactName','DESC','t.id\x20IN\x20?','resolve','WhatsappAccountId','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','role','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','rows','catch','show','includeAll','include','options','create','body','params','describe','addMessage','ids','omit','getMessages','findOne','WhatsappInteractionId','merge','format','YYYY-MM-DD\x20HH:mm:ss','WhatsappMessage','findAll','addTags','setTags','removeTags','download','unix','join','server','files','tmp','root','attachments','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Owner','get','mkdirSync','Whatsapp','fullname','N.A.','closed','closedAt'];(function(_0x19d288,_0x46dae3){var _0x4fdebf=function(_0x6b4ba3){while(--_0x6b4ba3){_0x19d288['push'](_0x19d288['shift']());}};_0x4fdebf(++_0x46dae3);}(_0xd1d4,0xfb));var _0x4d1d=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0xd1d4[_0x1477ef];return _0x164acd;};'use strict';var emlformat=require(_0x4d1d('0x0'));var rimraf=require(_0x4d1d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d1d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4d1d('0x3'));var Mustache=require(_0x4d1d('0x4'));var util=require(_0x4d1d('0x5'));var path=require(_0x4d1d('0x6'));var sox=require(_0x4d1d('0x7'));var csv=require(_0x4d1d('0x8'));var ejs=require(_0x4d1d('0x9'));var fs=require('fs');var fs_extra=require(_0x4d1d('0xa'));var _=require(_0x4d1d('0xb'));var squel=require(_0x4d1d('0xc'));var crypto=require(_0x4d1d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4d1d('0x8'));var querystring=require(_0x4d1d('0xe'));var Papa=require('papaparse');var Redis=require(_0x4d1d('0xf'));var authService=require(_0x4d1d('0x10'));var qs=require(_0x4d1d('0x11'));var as=require(_0x4d1d('0x12'));var pdf=require(_0x4d1d('0x13'));var hardwareService=require(_0x4d1d('0x14'));var logger=require(_0x4d1d('0x15'))(_0x4d1d('0x16'));var utils=require(_0x4d1d('0x17'));var config=require(_0x4d1d('0x18'));var licenseUtil=require(_0x4d1d('0x19'));var db=require(_0x4d1d('0x1a'))['db'];config[_0x4d1d('0x1b')]=_['defaults'](config[_0x4d1d('0x1b')],{'host':_0x4d1d('0x1c'),'port':0x18eb});var socket=require(_0x4d1d('0x1d'))(new Redis(config[_0x4d1d('0x1b')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithStatusCode(_0x58ef11,_0x1e5897){_0x1e5897=_0x1e5897||0xcc;return function(_0x1db7a6){if(_0x1db7a6){return _0x58ef11['sendStatus'](_0x1e5897);}return _0x58ef11[_0x4d1d('0x1e')](_0x1e5897)[_0x4d1d('0x1f')]();};}function respondWithResult(_0x3c1f04,_0xe7c5da){_0xe7c5da=_0xe7c5da||0xc8;return function(_0x5d232d){if(_0x5d232d){return _0x3c1f04['status'](_0xe7c5da)['json'](_0x5d232d);}};}function respondWithFilteredResult(_0x45f981,_0x83eb5a){return function(_0x3bea29){if(_0x3bea29){var _0x38d465=typeof _0x83eb5a[_0x4d1d('0x20')]==='undefined'&&typeof _0x83eb5a[_0x4d1d('0x21')]===_0x4d1d('0x22');var _0x40250e=_0x3bea29[_0x4d1d('0x23')];var _0x10c894=_0x38d465?0x0:_0x83eb5a[_0x4d1d('0x20')];var _0x1a5dae=_0x38d465?_0x3bea29['count']:_0x83eb5a[_0x4d1d('0x20')]+_0x83eb5a['limit'];var _0x32089d;if(_0x1a5dae>=_0x40250e){_0x1a5dae=_0x40250e;_0x32089d=0xc8;}else{_0x32089d=0xce;}_0x45f981[_0x4d1d('0x1e')](_0x32089d);return _0x45f981[_0x4d1d('0x24')](_0x4d1d('0x25'),_0x10c894+'-'+_0x1a5dae+'/'+_0x40250e)[_0x4d1d('0x26')](_0x3bea29);}return null;};}function patchUpdates(_0x2e0b46){return function(_0x1a93e5){try{jsonpatch['apply'](_0x1a93e5,_0x2e0b46,!![]);}catch(_0x410916){return BPromise[_0x4d1d('0x27')](_0x410916);}return _0x1a93e5[_0x4d1d('0x28')]();};}function saveUpdates(_0x7b13a5,_0x2d060b){return function(_0x50e7b0){if(_0x50e7b0){return _0x50e7b0[_0x4d1d('0x29')](_0x7b13a5)[_0x4d1d('0x2a')](function(_0x33f17e){return _0x33f17e;});}return null;};}function removeEntity(_0x2a49a8,_0x20ac5b){return function(_0x5cf5f3){if(_0x5cf5f3){return _0x5cf5f3[_0x4d1d('0x2b')]()['then'](function(){_0x2a49a8[_0x4d1d('0x1e')](0xcc)[_0x4d1d('0x1f')]();});}};}function handleEntityNotFound(_0x3f672b,_0xc33dea){return function(_0x476ee3){if(!_0x476ee3){_0x3f672b[_0x4d1d('0x2c')](0x194);}return _0x476ee3;};}function handleError(_0x54e905,_0x666c88){_0x666c88=_0x666c88||0x1f4;return function(_0x322e0f){logger[_0x4d1d('0x2d')](_0x322e0f['stack']);if(_0x322e0f[_0x4d1d('0x2e')]){delete _0x322e0f[_0x4d1d('0x2e')];}_0x54e905['status'](_0x666c88)[_0x4d1d('0x2f')](_0x322e0f);};}function getInteractionUsers(_0x3298f4,_0x3bd19b){return new BPromise(function(_0x3400b3,_0x475773){try{if(_0x3bd19b[_0x3298f4['id']]){_0x3298f4[_0x4d1d('0x30')]=_[_0x4d1d('0x31')](_0x3bd19b[_0x3298f4['id']],function(_0x664a6e){return{'id':_0x664a6e['id'],'fullname':_0x664a6e['fullname']};});}}catch(_0x5118d1){_0x475773(_0x5118d1);}_0x3400b3(_0x3298f4);});}function getInteractionTags(_0x2276d3,_0x497472){return new BPromise(function(_0x51c501,_0x3cd88d){try{if(_0x2276d3['TagIds']){_0x2276d3['Tags']=[];_0x2276d3[_0x4d1d('0x32')]['split'](',')[_0x4d1d('0x33')](function(_0x5079e8){_0x2276d3['Tags'][_0x4d1d('0x34')](_0x497472[_0x5079e8]);});}delete _0x2276d3[_0x4d1d('0x32')];}catch(_0xfc40cc){_0x3cd88d(_0xfc40cc);}_0x51c501(_0x2276d3);});}function updateWhatsappInteraction(_0x1dbf43,_0x5b05a2,_0x4f15a7){return new BPromise(function(_0x2aa965,_0x2ef12c){return getInteractionUsers(_0x1dbf43,_0x4f15a7)[_0x4d1d('0x2a')](function(_0x10d509){return getInteractionTags(_0x10d509,_0x5b05a2);})[_0x4d1d('0x2a')](function(_0x11f638){_0x2aa965(_0x11f638);})['catch'](function(_0x9682e8){_0x2ef12c(_0x9682e8);});});}exports[_0x4d1d('0x35')]=function(_0xf306e4,_0x3332c3){var _0x15bd75={},_0x24bd80={},_0x5e3f8e={'count':0x0,'rows':[]};var _0x20c657=_[_0x4d1d('0x31')](db[_0x4d1d('0x36')][_0x4d1d('0x37')],function(_0x5579ca){return{'name':_0x5579ca[_0x4d1d('0x38')],'type':_0x5579ca[_0x4d1d('0x39')]['key']};});_0x24bd80['model']=_[_0x4d1d('0x31')](_0x20c657,_0x4d1d('0x2e'));_0x24bd80['query']=_[_0x4d1d('0x3a')](_0xf306e4[_0x4d1d('0x3b')]);_0x24bd80[_0x4d1d('0x3c')]=_[_0x4d1d('0x3d')](_0x24bd80[_0x4d1d('0x3e')],_0x24bd80[_0x4d1d('0x3b')]);_0x15bd75[_0x4d1d('0x3f')]=_[_0x4d1d('0x3d')](_0x24bd80[_0x4d1d('0x3e')],qs[_0x4d1d('0x40')](_0xf306e4[_0x4d1d('0x3b')]['fields']));_0x15bd75[_0x4d1d('0x3f')]=_0x15bd75[_0x4d1d('0x3f')][_0x4d1d('0x41')]?_0x15bd75['attributes']:_0x24bd80[_0x4d1d('0x3e')];if(!_0xf306e4[_0x4d1d('0x3b')][_0x4d1d('0x42')](_0x4d1d('0x43'))){_0x15bd75[_0x4d1d('0x21')]=qs[_0x4d1d('0x21')](_0xf306e4['query'][_0x4d1d('0x21')]);_0x15bd75[_0x4d1d('0x20')]=qs[_0x4d1d('0x20')](_0xf306e4['query']['offset']);}_0x15bd75[_0x4d1d('0x44')]=qs['sort'](_0xf306e4[_0x4d1d('0x3b')][_0x4d1d('0x45')]);_0x15bd75['where']=qs['filters'](_[_0x4d1d('0x46')](_0xf306e4[_0x4d1d('0x3b')],_0x24bd80[_0x4d1d('0x3c')]),_0x20c657);var _0x206993=[];var _0xc8e512=squel['select']()[_0x4d1d('0x47')]('id')[_0x4d1d('0x47')](_0x4d1d('0x2e'))[_0x4d1d('0x47')]('color')[_0x4d1d('0x48')](_0x4d1d('0x49'));var _0x1a153c=squel[_0x4d1d('0x4a')]()[_0x4d1d('0x47')](_0x4d1d('0x4b'))['field'](_0x4d1d('0x4c'))[_0x4d1d('0x47')](_0x4d1d('0x4d'))[_0x4d1d('0x48')](_0x4d1d('0x4e'),'ui')[_0x4d1d('0x4f')](_0x4d1d('0x50'),'u',_0x4d1d('0x51'));var _0x57a7ed=squel[_0x4d1d('0x4a')]()['from'](_0x4d1d('0x52'),'i')[_0x4d1d('0x4f')](_0x4d1d('0x53'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x4d1d('0x50'),'o',_0x4d1d('0x54'))['left_join'](_0x4d1d('0x55'),'a',_0x4d1d('0x56'))[_0x4d1d('0x4f')](_0x4d1d('0x57'),'me',_0x4d1d('0x58'))['left_join'](_0x4d1d('0x59'),'it','it.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0x4d1d('0x49'),'t',_0x4d1d('0x5a'));var _0xa218ee=squel[_0x4d1d('0x5b')]();var _0x3cd194=[];var _0xd60459=squel['expr']();var _0x2f9da0;if(_0xf306e4[_0x4d1d('0x3b')]['search']){_0x2f9da0=as[_0x4d1d('0x5c')](_0xf306e4[_0x4d1d('0x3b')][_0x4d1d('0x5d')]);var _0x1f91bc=_0x2f9da0['sqlOperator'];for(var _0x30378f=0x0;_0x30378f<_0x2f9da0[_0x4d1d('0x5e')][_0x4d1d('0x41')];_0x30378f++){var _0x12b9ce=_0x2f9da0[_0x4d1d('0x5e')][_0x30378f];var _0x61acde='i';var _0x58a58c=_['find'](_0x20c657,[_0x4d1d('0x2e'),_0x12b9ce[_0x4d1d('0x47')]]);if(!_0x58a58c){switch(_0x12b9ce[_0x4d1d('0x47')]){case _0x4d1d('0x5f'):if(_0x12b9ce['value']==0x1){_0x57a7ed['having']('`'+_0x12b9ce[_0x4d1d('0x47')]+_0x4d1d('0x60'));}else{_0x57a7ed[_0x4d1d('0x61')]('`'+_0x12b9ce[_0x4d1d('0x47')]+_0x4d1d('0x62'));}break;case _0x4d1d('0x63'):if(_0x12b9ce[_0x4d1d('0x64')]===_0x4d1d('0x65')){if(_0x12b9ce[_0x4d1d('0x66')][_0x4d1d('0x67')]('\x20')[_0x4d1d('0x41')]>0x1){_0xa218ee[_0x1f91bc]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4d1d('0x68')](_0x12b9ce[_0x4d1d('0x66')]),null);}else{var _0x2537b1='%'+_0x12b9ce[_0x4d1d('0x66')]+'%';_0xa218ee[_0x1f91bc](_0x4d1d('0x69'),_0x2537b1,_0x2537b1,_0x2537b1);}}else{_0x58a58c=_[_0x4d1d('0x6a')](_0x20c657,[_0x4d1d('0x2e'),_0x4d1d('0x6b')]);_0x12b9ce['field']=_0x4d1d('0x6b');_0x22cc82=as[_0x4d1d('0x6c')](_0x61acde,_0x58a58c['type'],_0x12b9ce);_0xa218ee[_0x1f91bc](_0x22cc82[_0x4d1d('0x6d')],_0x22cc82[_0x4d1d('0x66')][_0x4d1d('0x6e')],_0x22cc82['value'][_0x4d1d('0x1f')]);}break;case _0x4d1d('0x6f'):var _0x268ed3=_0x12b9ce[_0x4d1d('0x66')][_0x4d1d('0x67')](',')[_0x4d1d('0x31')](function(_0x55ce2f){return Number(_0x55ce2f);});_0x268ed3['forEach'](function(_0x2b049e){_0xd60459['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2b049e+',%');});_0x3cd194=_[_0x4d1d('0x70')](_0x3cd194,_0x268ed3);break;case _0x4d1d('0x71'):if(_0x12b9ce[_0x4d1d('0x64')]===_0x4d1d('0x65')){_0xa218ee[_0x1f91bc](_0x4d1d('0x72'),'%'+_0x12b9ce['value']+'%',null);}else{_0x58a58c=_[_0x4d1d('0x6a')](_0x20c657,[_0x4d1d('0x2e'),_0x4d1d('0x73')]);_0x12b9ce['field']=_0x4d1d('0x73');_0x22cc82=as[_0x4d1d('0x6c')](_0x61acde,_0x58a58c[_0x4d1d('0x39')],_0x12b9ce);_0xa218ee[_0x1f91bc](_0x22cc82[_0x4d1d('0x6d')],_0x22cc82[_0x4d1d('0x66')][_0x4d1d('0x6e')],_0x22cc82[_0x4d1d('0x66')][_0x4d1d('0x1f')]);}break;case'body':_0x22cc82=as[_0x4d1d('0x6c')]('me',null,_0x12b9ce);_0xa218ee[_0x1f91bc](_0x22cc82[_0x4d1d('0x6d')],_0x22cc82[_0x4d1d('0x66')][_0x4d1d('0x6e')],_0x22cc82[_0x4d1d('0x66')][_0x4d1d('0x1f')]);break;}}else{var _0x22cc82=as[_0x4d1d('0x6c')](_0x61acde,_0x58a58c[_0x4d1d('0x39')],_0x12b9ce);_0xa218ee[_0x1f91bc](_0x22cc82['text'],_0x22cc82['value']['start'],_0x22cc82[_0x4d1d('0x66')]['end']);}}}else{var _0x4546fc=_(_0xf306e4['query'])[_0x4d1d('0x3a')]()[_0x4d1d('0x31')](function(_0x202a6a){return _[_0x4d1d('0x74')](_0x20c657,[_0x4d1d('0x2e'),_0x202a6a])?_0x202a6a:undefined;})[_0x4d1d('0x75')]()['value']();if(!_[_0x4d1d('0x76')](_0x4546fc)){_0x4546fc[_0x4d1d('0x33')](function(_0x5ea7cb){if(_0x5ea7cb==='WhatsappAccountId'){_0x57a7ed[_0x4d1d('0x77')]('i.WhatsappAccountId\x20IN\x20?',[][_0x4d1d('0x78')](_0xf306e4[_0x4d1d('0x3b')][_0x5ea7cb]));}else if(_0x5ea7cb===_0x4d1d('0x79')){var _0x5a3c36=JSON[_0x4d1d('0x7a')](_0xf306e4[_0x4d1d('0x3b')][_0x5ea7cb])[_0x4d1d('0x7b')];var _0x130036=JSON['parse'](_0xf306e4[_0x4d1d('0x3b')][_0x5ea7cb])[_0x4d1d('0x7c')];_0x57a7ed[_0x4d1d('0x77')](_0x4d1d('0x7d'),_0x5a3c36,_0x130036);}else{if(_0xf306e4[_0x4d1d('0x3b')][_0x5ea7cb]===_0x4d1d('0x7e')){_0x57a7ed[_0x4d1d('0x77')]('i.'+_0x5ea7cb+_0x4d1d('0x7f'));}else{_0x57a7ed[_0x4d1d('0x77')]('i.'+_0x5ea7cb+_0x4d1d('0x80'),_0xf306e4[_0x4d1d('0x3b')][_0x5ea7cb]);}}});}if(_0xf306e4[_0x4d1d('0x3b')]['read']){if(_0xf306e4['query'][_0x4d1d('0x81')]==0x1){_0x57a7ed['having'](_0x4d1d('0x82'));}else{_0x57a7ed[_0x4d1d('0x61')](_0x4d1d('0x83'));}}if(_0xf306e4[_0x4d1d('0x3b')][_0x4d1d('0x84')]){_0x3cd194=_[_0x4d1d('0x85')](_0xf306e4[_0x4d1d('0x3b')]['tag'])?_0xf306e4[_0x4d1d('0x3b')][_0x4d1d('0x84')]:new Array(_0xf306e4[_0x4d1d('0x3b')]['tag']);_0x3cd194[_0x4d1d('0x33')](function(_0x1ef51f){_0xd60459['or'](_0x4d1d('0x86'),'%,'+_0x1ef51f+',%');});}if(_0xf306e4['query']['filter']){var _0x112db7=_0xf306e4['query'][_0x4d1d('0x87')][_0x4d1d('0x88')]('\x5c','\x5c\x5c')[_0x4d1d('0x88')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x112db7)){_0xa218ee['or'](_0x4d1d('0x89'),_0x112db7+'%')['or'](_0x4d1d('0x8a'),_0x112db7+'%');}else{_0xa218ee['or'](_0x4d1d('0x8b'),qs['getFullTextValue'](_0x112db7))['or'](_0x4d1d('0x8c'),_0x112db7+'%');}}}_0x57a7ed[_0x4d1d('0x77')](_0xa218ee);_0x57a7ed['group'](_0x4d1d('0x8d'));var _0x5dad19={'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};var _0x532ef3=_0x57a7ed[_0x4d1d('0x8e')]();_0x532ef3[_0x4d1d('0x47')](_0x4d1d('0x8d'));_0x532ef3[_0x4d1d('0x47')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x4d1d('0x5f'));if(_0x15bd75[_0x4d1d('0x44')]){_0x15bd75['order'][_0x4d1d('0x33')](function(_0x1c0791){var _0x52fe31=_0x1c0791[0x0]===_0x4d1d('0x8f')?_0x1c0791[0x0]:'i.'+_0x1c0791[0x0];_0x57a7ed['order'](_0x52fe31,_0x1c0791[0x1]===_0x4d1d('0x90')?![]:!![]);});}if(!_[_0x4d1d('0x76')](_0x3cd194)){_0x57a7ed[_0x4d1d('0x61')](_0xd60459);_0x532ef3[_0x4d1d('0x77')](_0x4d1d('0x91'),_0x3cd194);}BPromise[_0x4d1d('0x92')]()[_0x4d1d('0x2a')](function(){if(!_0x2f9da0){if(_0xf306e4[_0x4d1d('0x3b')][_0x4d1d('0x93')])return;_0x532ef3[_0x4d1d('0x77')](_0x4d1d('0x94'));_0x57a7ed['where'](_0x4d1d('0x94'));return;}if(_0xf306e4[_0x4d1d('0x95')]['role']!==_0x4d1d('0x96'))return;return _0xf306e4['user'][_0x4d1d('0x97')]({'attributes':['id'],'raw':!![]})['then'](function(_0x596739){if(_[_0x4d1d('0x76')](_0x596739)){_0x532ef3[_0x4d1d('0x77')](_0x4d1d('0x98'));_0x57a7ed[_0x4d1d('0x77')](_0x4d1d('0x98'));}else{_0x532ef3[_0x4d1d('0x77')]('i.WhatsappAccountId\x20IN\x20?',_[_0x4d1d('0x31')](_0x596739,'id'));_0x57a7ed['where'](_0x4d1d('0x99'),_['map'](_0x596739,'id'));}});})[_0x4d1d('0x2a')](function(){if(_0xf306e4[_0x4d1d('0x95')][_0x4d1d('0x9a')]===_0x4d1d('0x96')&&!_0x2f9da0&&!_0xf306e4[_0x4d1d('0x3b')][_0x4d1d('0x93')])return[];return db[_0x4d1d('0x9b')][_0x4d1d('0x3b')](_0x532ef3['toString'](),_0x5dad19);})[_0x4d1d('0x2a')](function(_0x493046){_0x5e3f8e[_0x4d1d('0x23')]=_0x493046['length'];if(_0x5e3f8e[_0x4d1d('0x23')]===0x0)return[];return db[_0x4d1d('0x9b')][_0x4d1d('0x3b')](_0xc8e512[_0x4d1d('0x9c')](),_0x5dad19)[_0x4d1d('0x2a')](function(_0x4ab25d){_0x206993=_[_0x4d1d('0x9d')](_0x4ab25d,'id');_0x5dad19=_['merge'](_0x5dad19,{'model':db[_0x4d1d('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xf306e4[_0x4d1d('0x3b')][_0x4d1d('0x40')]){_0x15bd75['attributes'][_0x4d1d('0x33')](function(_0x4a0c18){_0x57a7ed[_0x4d1d('0x47')]('i.'+_0x4a0c18);});}else{_0x57a7ed['field'](_0x4d1d('0x9e'),_0x4d1d('0x5f'));_0x57a7ed[_0x4d1d('0x47')](_0x4d1d('0x9f'),_0x4d1d('0xa0'));_0x57a7ed['field'](_0x4d1d('0xa1'),_0x4d1d('0xa2'));_0x57a7ed['field'](_0x4d1d('0xa3'),'contactName');_0x57a7ed[_0x4d1d('0x47')](_0x4d1d('0xa4'));_0x57a7ed[_0x4d1d('0x47')](_0x4d1d('0xa5'),_0x4d1d('0xa6'));_0x57a7ed[_0x4d1d('0x47')]('c.lastName',_0x4d1d('0xa7'));_0x57a7ed[_0x4d1d('0x47')](_0x4d1d('0xa8'),'Contact.email');_0x57a7ed[_0x4d1d('0x47')]('c.phone','Contact.phone');_0x57a7ed[_0x4d1d('0x47')](_0x4d1d('0xa9'),_0x4d1d('0xaa'));_0x57a7ed[_0x4d1d('0x47')](_0x4d1d('0xab'),_0x4d1d('0xac'));_0x57a7ed[_0x4d1d('0x47')](_0x4d1d('0xad'),_0x4d1d('0xae'));_0x57a7ed[_0x4d1d('0x47')]('o.internal',_0x4d1d('0xaf'));_0x57a7ed[_0x4d1d('0x47')](_0x4d1d('0xb0'),'TagIds');}if(_0x15bd75[_0x4d1d('0x21')])_0x57a7ed[_0x4d1d('0x21')](_0x15bd75['limit']);if(_0x15bd75['offset'])_0x57a7ed[_0x4d1d('0x20')](_0x15bd75[_0x4d1d('0x20')]);return db['sequelize']['query'](_0x57a7ed[_0x4d1d('0x9c')](),_0x5dad19);})[_0x4d1d('0x2a')](function(_0x4c4dfc){if(_0x4c4dfc[_0x4d1d('0x41')]>0x0)_0x1a153c['where'](_0x4d1d('0xb1'),_['map'](_0x4c4dfc,'id'));return db[_0x4d1d('0x9b')][_0x4d1d('0x3b')](_0x1a153c[_0x4d1d('0x9c')](),_0x5dad19)[_0x4d1d('0x2a')](function(_0x4f840c){var _0x4883c8=_['groupBy'](_0x4f840c,'WhatsappInteractionId');var _0x47656e=[];_0x4c4dfc['forEach'](function(_0x472a23){_0x47656e[_0x4d1d('0x34')](updateWhatsappInteraction(_0x472a23,_0x206993,_0x4883c8));});return BPromise['all'](_0x47656e);});});})[_0x4d1d('0x2a')](function(_0x145327){_0x5e3f8e[_0x4d1d('0xb2')]=_0x145327;return _0x5e3f8e;})[_0x4d1d('0x2a')](respondWithFilteredResult(_0x3332c3,_0x15bd75))[_0x4d1d('0xb3')](handleError(_0x3332c3,null));};exports[_0x4d1d('0xb4')]=function(_0x28b064,_0x89c52b){var _0x10d275={'raw':![],'where':{'id':_0x28b064['params']['id']}},_0x328a15={};_0x328a15[_0x4d1d('0x3e')]=_[_0x4d1d('0x3a')](db[_0x4d1d('0x36')][_0x4d1d('0x37')]);_0x328a15[_0x4d1d('0x3b')]=_[_0x4d1d('0x3a')](_0x28b064[_0x4d1d('0x3b')]);_0x328a15[_0x4d1d('0x3c')]=_[_0x4d1d('0x3d')](_0x328a15[_0x4d1d('0x3e')],_0x328a15[_0x4d1d('0x3b')]);_0x10d275[_0x4d1d('0x3f')]=_[_0x4d1d('0x3d')](_0x328a15['model'],qs[_0x4d1d('0x40')](_0x28b064[_0x4d1d('0x3b')][_0x4d1d('0x40')]));_0x10d275[_0x4d1d('0x3f')]=_0x10d275[_0x4d1d('0x3f')]['length']?_0x10d275['attributes']:_0x328a15['model'];if(_0x28b064['query'][_0x4d1d('0xb5')]){_0x10d275[_0x4d1d('0xb6')]=[{'all':!![]}];}_0x10d275=_['merge']({},_0x10d275,_0x28b064[_0x4d1d('0xb7')]);return db[_0x4d1d('0x36')][_0x4d1d('0x6a')](_0x10d275)[_0x4d1d('0x2a')](handleEntityNotFound(_0x89c52b,null))['then'](respondWithResult(_0x89c52b,null))['catch'](handleError(_0x89c52b,null));};exports[_0x4d1d('0xb8')]=function(_0x184447,_0x30b323){return db[_0x4d1d('0x36')][_0x4d1d('0xb8')](_0x184447[_0x4d1d('0xb9')],{})[_0x4d1d('0x2a')](respondWithResult(_0x30b323,0xc9))['catch'](handleError(_0x30b323,null));};exports['update']=function(_0x44292c,_0x447a25){if(_0x44292c[_0x4d1d('0xb9')]['id']){delete _0x44292c[_0x4d1d('0xb9')]['id'];}return db[_0x4d1d('0x36')]['find']({'where':{'id':_0x44292c[_0x4d1d('0xba')]['id']}})[_0x4d1d('0x2a')](handleEntityNotFound(_0x447a25,null))['then'](saveUpdates(_0x44292c[_0x4d1d('0xb9')],null))[_0x4d1d('0x2a')](respondWithResult(_0x447a25,null))['catch'](handleError(_0x447a25,null));};exports[_0x4d1d('0x2b')]=function(_0x35c563,_0x312080){return db[_0x4d1d('0x36')]['find']({'where':{'id':_0x35c563[_0x4d1d('0xba')]['id']}})['then'](handleEntityNotFound(_0x312080,null))[_0x4d1d('0x2a')](removeEntity(_0x312080,null))[_0x4d1d('0xb3')](handleError(_0x312080,null));};exports['describe']=function(_0x1a405c,_0x2e6148){return db[_0x4d1d('0x36')][_0x4d1d('0xbb')]()[_0x4d1d('0x2a')](respondWithResult(_0x2e6148,null))[_0x4d1d('0xb3')](handleError(_0x2e6148,null));};exports[_0x4d1d('0xbc')]=function(_0x35adbd,_0xa843b0,_0x5daab2){return db['WhatsappMessage']['find']({'where':{'id':_0x35adbd[_0x4d1d('0xba')]['id']}})[_0x4d1d('0x2a')](handleEntityNotFound(_0xa843b0,null))[_0x4d1d('0x2a')](function(_0x2df59e){if(_0x2df59e){return _0x2df59e[_0x4d1d('0xbc')](_0x35adbd[_0x4d1d('0xb9')][_0x4d1d('0xbd')],_[_0x4d1d('0xbe')](_0x35adbd[_0x4d1d('0xb9')],[_0x4d1d('0xbd'),'id'])||{});}})[_0x4d1d('0x2a')](respondWithResult(_0xa843b0,null))[_0x4d1d('0xb3')](handleError(_0xa843b0,null));};exports[_0x4d1d('0xbf')]=function(_0x364b23,_0xc8c458,_0x4b37eb){var _0x45f3f3={'raw':![],'where':{}};var _0x6349a0={};var _0x3abc03={'count':0x0,'rows':[]};return db[_0x4d1d('0x36')][_0x4d1d('0xc0')]({'where':{'id':_0x364b23[_0x4d1d('0xba')]['id']}})['then'](handleEntityNotFound(_0xc8c458,null))[_0x4d1d('0x2a')](function(_0x240a78){if(_0x240a78){_0x6349a0['model']=_['keys'](db['WhatsappMessage'][_0x4d1d('0x37')]);_0x6349a0[_0x4d1d('0x3b')]=_[_0x4d1d('0x3a')](_0x364b23[_0x4d1d('0x3b')]);_0x6349a0[_0x4d1d('0x3c')]=_[_0x4d1d('0x3d')](_0x6349a0[_0x4d1d('0x3e')],_0x6349a0['query']);_0x45f3f3[_0x4d1d('0x3f')]=_['intersection'](_0x6349a0[_0x4d1d('0x3e')],qs[_0x4d1d('0x40')](_0x364b23[_0x4d1d('0x3b')]['fields']));_0x45f3f3['attributes']=_0x45f3f3['attributes'][_0x4d1d('0x41')]?_0x45f3f3[_0x4d1d('0x3f')]:_0x6349a0[_0x4d1d('0x3e')];if(!_0x364b23[_0x4d1d('0x3b')][_0x4d1d('0x42')](_0x4d1d('0x43'))){_0x45f3f3[_0x4d1d('0x21')]=qs[_0x4d1d('0x21')](_0x364b23['query'][_0x4d1d('0x21')]);_0x45f3f3[_0x4d1d('0x20')]=qs[_0x4d1d('0x20')](_0x364b23[_0x4d1d('0x3b')][_0x4d1d('0x20')]);}_0x45f3f3[_0x4d1d('0x44')]=qs['sort'](_0x364b23[_0x4d1d('0x3b')][_0x4d1d('0x45')]);_0x45f3f3[_0x4d1d('0x77')]=qs['filters'](_[_0x4d1d('0x46')](_0x364b23['query'],_0x6349a0['filters']));_0x45f3f3['where'][_0x4d1d('0xc1')]=_0x240a78['id'];if(_0x364b23['query'][_0x4d1d('0x87')]){_0x45f3f3[_0x4d1d('0x77')]=_[_0x4d1d('0xc2')](_0x45f3f3[_0x4d1d('0x77')],{'$or':_['map'](_0x45f3f3['attributes'],function(_0x5cac86){var _0x41f474={};_0x41f474[_0x5cac86]={'$like':'%'+_0x364b23[_0x4d1d('0x3b')]['filter']+'%'};return _0x41f474;})});}if(_0x364b23['query']['$gte']){var _0x4f2d8f=_0x364b23[_0x4d1d('0x3b')][_0x4d1d('0x7b')][_0x4d1d('0x67')](',');var _0x567a15={};_0x567a15[_0x4f2d8f[0x0]]={'$gte':moment(_0x4f2d8f[0x1])[_0x4d1d('0xc3')](_0x4d1d('0xc4'))};_0x45f3f3[_0x4d1d('0x77')]=_[_0x4d1d('0xc2')](_0x45f3f3['where'],_0x567a15);}_0x45f3f3=_[_0x4d1d('0xc2')]({},_0x45f3f3,_0x364b23[_0x4d1d('0xb7')]);return db[_0x4d1d('0xc5')][_0x4d1d('0x23')]({'where':_0x45f3f3['where']})['then'](function(_0xc21e33){_0x3abc03[_0x4d1d('0x23')]=_0xc21e33;if(_0x364b23[_0x4d1d('0x3b')][_0x4d1d('0xb5')]){_0x45f3f3[_0x4d1d('0xb6')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x4d1d('0xc6')](_0x45f3f3);})[_0x4d1d('0x2a')](function(_0x26fac0){_0x3abc03[_0x4d1d('0xb2')]=_0x26fac0;return _0x3abc03;});}})[_0x4d1d('0x2a')](respondWithFilteredResult(_0xc8c458,_0x45f3f3))['catch'](handleError(_0xc8c458,null));};exports[_0x4d1d('0xc7')]=function(_0x74809d,_0x3b298a,_0x2a3bc8){return db[_0x4d1d('0x36')][_0x4d1d('0x6a')]({'where':{'id':_0x74809d['params']['id']}})['then'](handleEntityNotFound(_0x3b298a,null))[_0x4d1d('0x2a')](function(_0x5afa65){if(_0x5afa65){return _0x5afa65[_0x4d1d('0xc8')](_0x74809d[_0x4d1d('0xb9')][_0x4d1d('0xbd')],_[_0x4d1d('0xbe')](_0x74809d[_0x4d1d('0xb9')],[_0x4d1d('0xbd'),'id'])||{})['spread'](function(){return db[_0x4d1d('0x6f')][_0x4d1d('0xc6')]({'attributes':['id',_0x4d1d('0x2e'),'color'],'where':{'id':_0x74809d[_0x4d1d('0xb9')]['ids']}});})[_0x4d1d('0x2a')](function(_0x5b90c4){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0x74809d[_0x4d1d('0xba')]['id']),'tags':_0x5b90c4||[]});return{'id':Number(_0x74809d[_0x4d1d('0xba')]['id']),'tags':_0x5b90c4||[]};});}})[_0x4d1d('0x2a')](respondWithResult(_0x3b298a,null))[_0x4d1d('0xb3')](handleError(_0x3b298a,null));};exports[_0x4d1d('0xc9')]=function(_0xba64b1,_0xd0b9fb,_0x434ea7){return db['WhatsappInteraction']['find']({'where':{'id':_0xba64b1[_0x4d1d('0xba')]['id']}})['then'](handleEntityNotFound(_0xd0b9fb,null))['then'](function(_0x50b323){if(_0x50b323){return _0x50b323[_0x4d1d('0xc9')](_0xba64b1[_0x4d1d('0x3b')][_0x4d1d('0xbd')]);}})[_0x4d1d('0x2a')](respondWithStatusCode(_0xd0b9fb,null))[_0x4d1d('0xb3')](handleError(_0xd0b9fb,null));};exports[_0x4d1d('0xca')]=function(_0x1ef80f,_0x344d22){var _0x4d0b6e=moment()[_0x4d1d('0xcb')]()['toString']();var _0x14f0c1=path[_0x4d1d('0xcc')](config['root'],_0x4d1d('0xcd'),_0x4d1d('0xce'),_0x4d1d('0xcf'));var _0x573a3f=path[_0x4d1d('0xcc')](config[_0x4d1d('0xd0')],'server',_0x4d1d('0xce'),_0x4d1d('0xd1'));var _0x4c0ad5=path[_0x4d1d('0xcc')](_0x14f0c1,_0x4d0b6e);var _0x56fdc3=util[_0x4d1d('0xc3')]('transcript-%d-%s.zip',_0x1ef80f[_0x4d1d('0xba')]['id'],_0x4d0b6e);var _0x46c542=path[_0x4d1d('0xcc')](_0x14f0c1,_0x56fdc3);var _0x526445=[];_0x526445[_0x4d1d('0x34')]({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x526445[_0x4d1d('0x34')]({'model':db['CmContact'],'as':_0x4d1d('0x63'),'attributes':['id',_0x4d1d('0xd2'),_0x4d1d('0xd3')],'raw':!![]});if(_0x1ef80f[_0x4d1d('0x3b')][_0x4d1d('0xd1')]){_0x526445[_0x4d1d('0x34')]({'model':db['Attachment'],'as':_0x4d1d('0xd4'),'raw':!![]});}var _0x149df1=[{'model':db[_0x4d1d('0xc5')],'as':_0x4d1d('0xd5'),'attributes':['id',_0x4d1d('0xb9'),_0x4d1d('0x79'),_0x4d1d('0xd6'),_0x4d1d('0xd7'),'read'],'include':_0x526445}];_0x149df1[_0x4d1d('0x34')]({'model':db[_0x4d1d('0xd8')],'as':'Account','attributes':['id',_0x4d1d('0x2e')]});_0x149df1['push']({'model':db[_0x4d1d('0x71')],'as':_0x4d1d('0xd9'),'attributes':['id','fullname']});return db[_0x4d1d('0x36')][_0x4d1d('0x6a')]({'where':{'id':_0x1ef80f['params']['id']},'include':_0x149df1})['then'](handleEntityNotFound(_0x344d22,null))[_0x4d1d('0x2a')](function(_0x49bb26){if(_0x49bb26){var _0x85dcb5=_0x49bb26[_0x4d1d('0xda')]({'plain':!![]});fs[_0x4d1d('0xdb')](_0x4c0ad5);var _0x1b2f61={'channel':_0x4d1d('0xdc'),'account':_0x85dcb5['Account'][_0x4d1d('0x2e')],'agent':_0x85dcb5[_0x4d1d('0xd9')]?_0x85dcb5[_0x4d1d('0xd9')][_0x4d1d('0xdd')]:_0x4d1d('0xde'),'createdAt':moment(_0x85dcb5[_0x4d1d('0x79')])[_0x4d1d('0xc3')](_0x4d1d('0xc4'))[_0x4d1d('0x9c')](),'closedAt':_0x85dcb5[_0x4d1d('0xdf')]?moment(_0x85dcb5[_0x4d1d('0xe0')])['format'](_0x4d1d('0xc4'))[_0x4d1d('0x9c')]():'','disposition':_0x85dcb5[_0x4d1d('0xe1')],'messages':_(_0x85dcb5[_0x4d1d('0xd5')])[_0x4d1d('0x87')]({'secret':![]})['map'](function(_0x5a7248){if(_0x5a7248['Attachment']){var _0x6f7c6=path['join'](_0x573a3f,_0x5a7248[_0x4d1d('0xd4')]['basename']);if(fs[_0x4d1d('0xe2')](_0x6f7c6)){fs[_0x4d1d('0xe3')](_0x6f7c6)[_0x4d1d('0xe4')](fs[_0x4d1d('0xe5')](path[_0x4d1d('0xcc')](_0x4c0ad5,_0x5a7248[_0x4d1d('0xd4')]['basename'])));}}return{'date':moment(_0x5a7248['createdAt'])[_0x4d1d('0xc3')](_0x4d1d('0xc4'))[_0x4d1d('0x9c')](),'sender':_0x5a7248[_0x4d1d('0xd6')]===_0x4d1d('0xe6')?_0x5a7248[_0x4d1d('0x71')]?_0x5a7248[_0x4d1d('0x71')][_0x4d1d('0xdd')]:'System':_0x5a7248[_0x4d1d('0x63')][_0x4d1d('0xd2')]+(_0x5a7248[_0x4d1d('0x63')][_0x4d1d('0xd3')]?'\x20'+_0x5a7248[_0x4d1d('0x63')][_0x4d1d('0xd3')]:''),'body':_0x5a7248['Attachment']?_0x5a7248[_0x4d1d('0xd4')][_0x4d1d('0xe7')]:_0x5a7248[_0x4d1d('0xb9')],'direction':_0x5a7248[_0x4d1d('0xd6')]==='out'?'A':'C','secret':_0x5a7248[_0x4d1d('0xd7')],'read':_0x5a7248['read'],'attachment':_0x5a7248[_0x4d1d('0xd4')]};})[_0x4d1d('0x66')]()};return ejs[_0x4d1d('0xe8')](path[_0x4d1d('0xcc')](config[_0x4d1d('0xd0')],_0x4d1d('0xcd'),_0x4d1d('0xe9'),_0x4d1d('0xea')),{'interaction':_0x1b2f61})[_0x4d1d('0x2a')](function(_0x1770ce){var _0x51d3a5=path[_0x4d1d('0xcc')](_0x4c0ad5,_0x4d1d('0xeb')+_0x85dcb5['id']+'-'+_0x4d0b6e+_0x4d1d('0xec'));var _0x38c72a={'path':_0x51d3a5,'channel':'Whatsapp','interactionId':_0x85dcb5['id']};return pdf['createPdfFromHTML'](_0x1770ce,_0x38c72a);})[_0x4d1d('0x2a')](function(){return new BPromise(function(_0x346e1e,_0x8dca2a){zipdir(_0x4c0ad5,{'saveTo':_0x46c542},function(_0x472188,_0x310505){if(_0x472188)return _0x8dca2a(_0x472188);return _0x346e1e(_0x310505);});})[_0x4d1d('0x2a')](function(){return new BPromise(function(_0x4c3df6,_0x598328){rimraf(_0x4c0ad5,function(_0x3f8319){if(_0x3f8319)_0x598328(_0x3f8319);return _0x4c3df6();});});})[_0x4d1d('0x2a')](function(){return _0x344d22['download'](_0x46c542,_0x56fdc3,function(_0x1360c9){if(_0x1360c9){console['log']('err',_0x1360c9);}else{fs[_0x4d1d('0xed')](_0x46c542);}});});});}else{return _0x344d22[_0x4d1d('0x2c')](0xc8);}})[_0x4d1d('0xb3')](handleError(_0x344d22,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index fd4ae4d..4e9fa94 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 _0x557d=['Users','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','save','update','getUsers','then'];(function(_0x4ecd94,_0x3f01ac){var _0x33cd50=function(_0x242adb){while(--_0x242adb){_0x4ecd94['push'](_0x4ecd94['shift']());}};_0x33cd50(++_0x3f01ac);}(_0x557d,0xcb));var _0xd557=function(_0x180f9f,_0x4efded){_0x180f9f=_0x180f9f-0x0;var _0x1c1b5a=_0x557d[_0x180f9f];return _0x1c1b5a;};'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 +var _0x30fe=['setDataValue','Users','map','findAll','length','emit','catch','hook','exports','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then'];(function(_0x3b4ee1,_0x2290c9){var _0x22c913=function(_0x176483){while(--_0x176483){_0x3b4ee1['push'](_0x3b4ee1['shift']());}};_0x22c913(++_0x2290c9);}(_0x30fe,0x149));var _0xe30f=function(_0x4efe7a,_0xa51c27){_0x4efe7a=_0x4efe7a-0x0;var _0x421ffc=_0x30fe[_0x4efe7a];return _0x421ffc;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xe30f('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xe30f('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xe30f('0x1')](0x0);var events={'afterCreate':_0xe30f('0x2'),'afterUpdate':_0xe30f('0x3'),'afterDestroy':_0xe30f('0x4')};function emitEvent(_0x21059a){return function(_0x5090a2,_0x45649b,_0x1e2055){_0x5090a2[_0xe30f('0x5')]({'attributes':['id'],'raw':!![]})[_0xe30f('0x6')](function(_0x442a51){_0x5090a2[_0xe30f('0x7')](_0xe30f('0x8'),_0x442a51[_0xe30f('0x9')](function(_0x28a134){return{'id':_0x28a134['id']};}));return WhatsappMessage[_0xe30f('0xa')]({'where':{'WhatsappInteractionId':_0x5090a2['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2c5eab){_0x5090a2[_0xe30f('0x7')]('unreadMessages',_0x2c5eab[_0xe30f('0xb')]);WhatsappInteractionEvents[_0xe30f('0xc')](_0x21059a+':'+_0x5090a2['id'],_0x5090a2);WhatsappInteractionEvents[_0xe30f('0xc')](_0x21059a,_0x5090a2);_0x1e2055(null);})[_0xe30f('0xd')](_0x1e2055(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0xe30f('0xe')](e,emitEvent(event));}}module[_0xe30f('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 8b211a5..0e66b5e 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 _0x0498=['util','../../config/logger','moment','bluebird','./whatsappInteraction.attributes','changed','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x17e880,_0x223657){var _0x235bbc=function(_0x4861c5){while(--_0x4861c5){_0x17e880['push'](_0x17e880['shift']());}};_0x235bbc(++_0x223657);}(_0x0498,0x1dc));var _0x8049=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x0498[_0x173441];return _0x2423a8;};'use strict';var _=require(_0x8049('0x0'));var util=require(_0x8049('0x1'));var logger=require(_0x8049('0x2'))('api');var moment=require(_0x8049('0x3'));var BPromise=require(_0x8049('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8049('0x5'));module['exports']=function(_0x2affe8,_0x33dcb9){return _0x2affe8['define']('WhatsappInteraction',attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x21eb90,_0x5b1134,_0x49ca3d){if(_0x21eb90[_0x8049('0x6')]('closed')){_0x21eb90['closedAt']=moment()[_0x8049('0x7')](_0x8049('0x8'));}_0x49ca3d(null,_0x21eb90);}}});}; \ No newline at end of file +var _0xc0a0=['WhatsappInteraction','whatsapp_interactions','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x30af23,_0x1b9d6a){var _0x5cea96=function(_0x31be06){while(--_0x31be06){_0x30af23['push'](_0x30af23['shift']());}};_0x5cea96(++_0x1b9d6a);}(_0xc0a0,0x14f));var _0x0c0a=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xc0a0[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x0c0a('0x0'));var util=require(_0x0c0a('0x1'));var logger=require('../../config/logger')(_0x0c0a('0x2'));var moment=require('moment');var BPromise=require(_0x0c0a('0x3'));var rp=require(_0x0c0a('0x4'));var fs=require('fs');var path=require(_0x0c0a('0x5'));var rimraf=require(_0x0c0a('0x6'));var config=require(_0x0c0a('0x7'));var attributes=require('./whatsappInteraction.attributes');module[_0x0c0a('0x8')]=function(_0x442048,_0x25386f){return _0x442048[_0x0c0a('0x9')](_0x0c0a('0xa'),attributes,{'tableName':_0x0c0a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x448393,_0x680274,_0x1ac50e){if(_0x448393['changed']('closed')){_0x448393[_0x0c0a('0xc')]=moment()[_0x0c0a('0xd')](_0x0c0a('0xe'));}_0x1ac50e(null,_0x448393);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 5ea372d..1fb8d29 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 _0xad87=['where','addTags','omit','body','ids','AddTags','util','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','http','redis','defaults','localhost','register','then','info','WhatsappInteraction,\x20%s,\x20%s','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','attributes','limit','debug','AddTagsToWhatsappInteraction','find'];(function(_0x3c95a3,_0x1159f1){var _0x57b25b=function(_0x332465){while(--_0x332465){_0x3c95a3['push'](_0x3c95a3['shift']());}};_0x57b25b(++_0x1159f1);}(_0xad87,0x7b));var _0x7ad8=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xad87[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require('lodash');var util=require(_0x7ad8('0x0'));var moment=require('moment');var BPromise=require(_0x7ad8('0x1'));var rs=require(_0x7ad8('0x2'));var fs=require('fs');var Redis=require(_0x7ad8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7ad8('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7ad8('0x5'));var client=jayson[_0x7ad8('0x6')][_0x7ad8('0x7')]({'port':0x232a});config[_0x7ad8('0x8')]=_[_0x7ad8('0x9')](config[_0x7ad8('0x8')],{'host':_0x7ad8('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7ad8('0x8')]));require('./whatsappInteraction.socket')[_0x7ad8('0xb')](socket);function respondWithRpcPromise(_0x4224d2,_0x35e258,_0x4fd4a2){return new BPromise(function(_0x2bbbd7,_0x52c33a){return client['request'](_0x4224d2,_0x4fd4a2)[_0x7ad8('0xc')](function(_0x4616be){logger[_0x7ad8('0xd')](_0x7ad8('0xe'),_0x35e258,'request\x20sent');logger['debug'](_0x7ad8('0xf'),_0x35e258,_0x7ad8('0x10'),JSON[_0x7ad8('0x11')](_0x4616be));if(_0x4616be[_0x7ad8('0x12')]){if(_0x4616be[_0x7ad8('0x12')][_0x7ad8('0x13')]===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x35e258,_0x4616be[_0x7ad8('0x12')]['message']);return _0x52c33a(_0x4616be['error']['message']);}logger[_0x7ad8('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x35e258,_0x4616be[_0x7ad8('0x12')][_0x7ad8('0x14')]);return _0x2bbbd7(_0x4616be[_0x7ad8('0x12')][_0x7ad8('0x14')]);}else{logger[_0x7ad8('0xd')](_0x7ad8('0xe'),_0x35e258,_0x7ad8('0x10'));_0x2bbbd7(_0x4616be[_0x7ad8('0x15')][_0x7ad8('0x14')]);}})[_0x7ad8('0x16')](function(_0x4d6336){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x35e258,_0x4d6336);_0x52c33a(_0x4d6336);});});}exports[_0x7ad8('0x17')]=function(_0x175874){var _0x1f83dd=this;return new Promise(function(_0x1adeeb,_0x1bc207){return db[_0x7ad8('0x18')][_0x7ad8('0x19')](_0x175874['body'],{'raw':_0x175874[_0x7ad8('0x1a')]?_0x175874[_0x7ad8('0x1a')][_0x7ad8('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x175874['options']?_0x175874['options']['where']||null:null,'attributes':_0x175874[_0x7ad8('0x1a')]?_0x175874[_0x7ad8('0x1a')][_0x7ad8('0x1c')]||null:null,'limit':_0x175874[_0x7ad8('0x1a')]?_0x175874['options'][_0x7ad8('0x1d')]||null:null})[_0x7ad8('0xc')](function(_0x456795){logger['info'](_0x7ad8('0x17'),_0x175874);logger[_0x7ad8('0x1e')](_0x7ad8('0x17'),_0x175874,JSON['stringify'](_0x456795));_0x1adeeb(_0x456795);})['catch'](function(_0x53230f){logger['error'](_0x7ad8('0x17'),_0x53230f[_0x7ad8('0x14')],_0x175874);_0x1bc207(_0x1f83dd[_0x7ad8('0x12')](0x1f4,_0x53230f['message']));});});};exports[_0x7ad8('0x1f')]=function(_0x694920){return new Promise(function(_0x352734,_0x5edd51){return db[_0x7ad8('0x18')][_0x7ad8('0x20')]({'where':_0x694920[_0x7ad8('0x1a')]?_0x694920['options'][_0x7ad8('0x21')]||null:null})[_0x7ad8('0xc')](function(_0x25acb1){if(_0x25acb1){return _0x25acb1[_0x7ad8('0x22')](_0x694920['body']['ids'],_[_0x7ad8('0x23')](_0x694920[_0x7ad8('0x24')],[_0x7ad8('0x25'),'id'])||{});}})['spread'](function(_0x449da5){logger['info'](_0x7ad8('0x26'),_0x694920);logger[_0x7ad8('0x1e')]('AddTags',_0x694920,JSON[_0x7ad8('0x11')](_0x449da5));_0x352734(_0x449da5);})[_0x7ad8('0x16')](function(_0x121b3f){logger['error'](_0x7ad8('0x26'),_0x121b3f['message'],_0x694920);_0x5edd51(_this[_0x7ad8('0x12')](0x1f4,_0x121b3f[_0x7ad8('0x14')]));});});}; \ No newline at end of file +var _0x7693=['debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','catch','update','body','options','raw','where','attributes','limit','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','WhatsappInteraction','addTags','ids','AddTags','lodash','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./whatsappInteraction.socket','request','then','info','request\x20sent'];(function(_0x2bbe14,_0x5a3e62){var _0x19d01d=function(_0x49a18c){while(--_0x49a18c){_0x2bbe14['push'](_0x2bbe14['shift']());}};_0x19d01d(++_0x5a3e62);}(_0x7693,0x1b7));var _0x3769=function(_0x2b19a5,_0x189ec9){_0x2b19a5=_0x2b19a5-0x0;var _0x429e96=_0x7693[_0x2b19a5];return _0x429e96;};'use strict';var _=require(_0x3769('0x0'));var util=require(_0x3769('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3769('0x2'));var fs=require('fs');var Redis=require(_0x3769('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3769('0x4'));var logger=require('../../config/logger')(_0x3769('0x5'));var config=require(_0x3769('0x6'));var jayson=require(_0x3769('0x7'));var client=jayson[_0x3769('0x8')]['http']({'port':0x232a});config[_0x3769('0x9')]=_[_0x3769('0xa')](config['redis'],{'host':_0x3769('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3769('0x9')]));require(_0x3769('0xc'))['register'](socket);function respondWithRpcPromise(_0x1edad1,_0x1d101c,_0xa253b5){return new BPromise(function(_0x22358e,_0x18d702){return client[_0x3769('0xd')](_0x1edad1,_0xa253b5)[_0x3769('0xe')](function(_0x4e3c72){logger[_0x3769('0xf')]('WhatsappInteraction,\x20%s,\x20%s',_0x1d101c,_0x3769('0x10'));logger[_0x3769('0x11')](_0x3769('0x12'),_0x1d101c,'request\x20sent',JSON[_0x3769('0x13')](_0x4e3c72));if(_0x4e3c72[_0x3769('0x14')]){if(_0x4e3c72['error'][_0x3769('0x15')]===0x1f4){logger[_0x3769('0x14')](_0x3769('0x16'),_0x1d101c,_0x4e3c72[_0x3769('0x14')][_0x3769('0x17')]);return _0x18d702(_0x4e3c72[_0x3769('0x14')][_0x3769('0x17')]);}logger['error'](_0x3769('0x16'),_0x1d101c,_0x4e3c72[_0x3769('0x14')][_0x3769('0x17')]);return _0x22358e(_0x4e3c72[_0x3769('0x14')][_0x3769('0x17')]);}else{logger[_0x3769('0xf')](_0x3769('0x16'),_0x1d101c,_0x3769('0x10'));_0x22358e(_0x4e3c72['result'][_0x3769('0x17')]);}})[_0x3769('0x18')](function(_0x545984){logger[_0x3769('0x14')](_0x3769('0x16'),_0x1d101c,_0x545984);_0x18d702(_0x545984);});});}exports['UpdateWhatsappInteraction']=function(_0xca80bc){var _0x24228e=this;return new Promise(function(_0xefdcd6,_0x46220c){return db['WhatsappInteraction'][_0x3769('0x19')](_0xca80bc[_0x3769('0x1a')],{'raw':_0xca80bc[_0x3769('0x1b')]?_0xca80bc[_0x3769('0x1b')][_0x3769('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xca80bc[_0x3769('0x1b')]?_0xca80bc[_0x3769('0x1b')][_0x3769('0x1d')]||null:null,'attributes':_0xca80bc[_0x3769('0x1b')]?_0xca80bc[_0x3769('0x1b')][_0x3769('0x1e')]||null:null,'limit':_0xca80bc[_0x3769('0x1b')]?_0xca80bc[_0x3769('0x1b')][_0x3769('0x1f')]||null:null})[_0x3769('0xe')](function(_0x41c9ba){logger['info'](_0x3769('0x20'),_0xca80bc);logger[_0x3769('0x11')](_0x3769('0x20'),_0xca80bc,JSON['stringify'](_0x41c9ba));_0xefdcd6(_0x41c9ba);})[_0x3769('0x18')](function(_0x54aedb){logger[_0x3769('0x14')](_0x3769('0x20'),_0x54aedb['message'],_0xca80bc);_0x46220c(_0x24228e['error'](0x1f4,_0x54aedb[_0x3769('0x17')]));});});};exports[_0x3769('0x21')]=function(_0x7ab145){return new Promise(function(_0x5e2771,_0xaef70){return db[_0x3769('0x22')]['find']({'where':_0x7ab145[_0x3769('0x1b')]?_0x7ab145['options']['where']||null:null})[_0x3769('0xe')](function(_0x47d3f5){if(_0x47d3f5){return _0x47d3f5[_0x3769('0x23')](_0x7ab145['body']['ids'],_['omit'](_0x7ab145[_0x3769('0x1a')],[_0x3769('0x24'),'id'])||{});}})['spread'](function(_0x8ba3c9){logger[_0x3769('0xf')](_0x3769('0x25'),_0x7ab145);logger[_0x3769('0x11')](_0x3769('0x25'),_0x7ab145,JSON[_0x3769('0x13')](_0x8ba3c9));_0x5e2771(_0x8ba3c9);})[_0x3769('0x18')](function(_0x2e8e8f){logger[_0x3769('0x14')](_0x3769('0x25'),_0x2e8e8f[_0x3769('0x17')],_0x7ab145);_0xaef70(_this[_0x3769('0x14')](0x1f4,_0x2e8e8f[_0x3769('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index c65b88d..f51852d 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 _0x68e6=['update','emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove'];(function(_0x3cde2d,_0x58328c){var _0xe76d18=function(_0x4a464e){while(--_0x4a464e){_0x3cde2d['push'](_0x3cde2d['shift']());}};_0xe76d18(++_0x58328c);}(_0x68e6,0x15c));var _0x668e=function(_0x405221,_0x4390f5){_0x405221=_0x405221-0x0;var _0x4dfb89=_0x68e6[_0x405221];return _0x4dfb89;};'use strict';var WhatsappInteractionEvents=require(_0x668e('0x0'));var events=[_0x668e('0x1'),_0x668e('0x2'),_0x668e('0x3')];function createListener(_0x3dd57f,_0x421395){return function(_0x1b0850){_0x421395[_0x668e('0x4')](_0x3dd57f,_0x1b0850);};}function removeListener(_0x579757,_0x5b9636){return function(){WhatsappInteractionEvents[_0x668e('0x5')](_0x579757,_0x5b9636);};}exports[_0x668e('0x6')]=function(_0x99683){for(var _0x229a32=0x0,_0x51478b=events[_0x668e('0x7')];_0x229a32<_0x51478b;_0x229a32++){var _0x17a814=events[_0x229a32];var _0x4855a5=createListener(_0x668e('0x8')+_0x17a814,_0x99683);WhatsappInteractionEvents['on'](_0x17a814,_0x4855a5);}}; \ No newline at end of file +var _0x5251=['removeListener','length','whatsappInteraction:','./whatsappInteraction.events','emit'];(function(_0x18f152,_0x41585a){var _0xa10b34=function(_0x1e9798){while(--_0x1e9798){_0x18f152['push'](_0x18f152['shift']());}};_0xa10b34(++_0x41585a);}(_0x5251,0x99));var _0x1525=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5251[_0x14add3];return _0x4a174f;};'use strict';var WhatsappInteractionEvents=require(_0x1525('0x0'));var events=['save','remove','update'];function createListener(_0x34a7d7,_0x56a86e){return function(_0x3ec29f){_0x56a86e[_0x1525('0x1')](_0x34a7d7,_0x3ec29f);};}function removeListener(_0x2210fd,_0x5878fb){return function(){WhatsappInteractionEvents[_0x1525('0x2')](_0x2210fd,_0x5878fb);};}exports['register']=function(_0x4a5413){for(var _0x5e0a96=0x0,_0x2226ff=events[_0x1525('0x3')];_0x5e0a96<_0x2226ff;_0x5e0a96++){var _0x23df9b=events[_0x5e0a96];var _0x1e8cec=createListener(_0x1525('0x4')+_0x23df9b,_0x4a5413);WhatsappInteractionEvents['on'](_0x23df9b,_0x1e8cec);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index e576110..43bd9f3 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 _0x0cbd=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','index','isAuthenticated','/:id','show','post','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x5678b5,_0x1c4aa8){var _0x4c09a5=function(_0x2aa89a){while(--_0x2aa89a){_0x5678b5['push'](_0x5678b5['shift']());}};_0x4c09a5(++_0x1c4aa8);}(_0x0cbd,0xe9));var _0xd0cb=function(_0x5c470c,_0x416588){_0x5c470c=_0x5c470c-0x0;var _0x25e626=_0x0cbd[_0x5c470c];return _0x25e626;};'use strict';var multer=require(_0xd0cb('0x0'));var util=require(_0xd0cb('0x1'));var path=require(_0xd0cb('0x2'));var timeout=require(_0xd0cb('0x3'));var express=require(_0xd0cb('0x4'));var router=express[_0xd0cb('0x5')]();var fs_extra=require(_0xd0cb('0x6'));var auth=require(_0xd0cb('0x7'));var interaction=require(_0xd0cb('0x8'));var config=require(_0xd0cb('0x9'));var controller=require(_0xd0cb('0xa'));router[_0xd0cb('0xb')]('/',auth['isAuthenticated'](),controller[_0xd0cb('0xc')]);router['get']('/describe',auth[_0xd0cb('0xd')](),controller['describe']);router[_0xd0cb('0xb')](_0xd0cb('0xe'),auth[_0xd0cb('0xd')](),controller[_0xd0cb('0xf')]);router[_0xd0cb('0x10')]('/',auth[_0xd0cb('0xd')](),interaction['tracked']('whatsapp',_0xd0cb('0x11')),controller[_0xd0cb('0x12')]);router[_0xd0cb('0x10')](_0xd0cb('0x13'),controller[_0xd0cb('0x14')]);router[_0xd0cb('0x15')](_0xd0cb('0xe'),auth[_0xd0cb('0xd')](),controller[_0xd0cb('0x16')]);router[_0xd0cb('0x15')](_0xd0cb('0x17'),auth[_0xd0cb('0xd')](),controller[_0xd0cb('0x18')]);router[_0xd0cb('0x15')](_0xd0cb('0x19'),auth['isAuthenticated'](),controller[_0xd0cb('0x1a')]);router[_0xd0cb('0x1b')](_0xd0cb('0xe'),auth[_0xd0cb('0xd')](),controller[_0xd0cb('0x1c')]);module[_0xd0cb('0x1d')]=router; \ No newline at end of file +var _0x921b=['./whatsappMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','reject','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x921b,0x106));var _0xb921=function(_0x42d9ee,_0x82847c){_0x42d9ee=_0x42d9ee-0x0;var _0x5d20de=_0x921b[_0x42d9ee];return _0x5d20de;};'use strict';var multer=require(_0xb921('0x0'));var util=require(_0xb921('0x1'));var path=require('path');var timeout=require(_0xb921('0x2'));var express=require('express');var router=express[_0xb921('0x3')]();var fs_extra=require(_0xb921('0x4'));var auth=require(_0xb921('0x5'));var interaction=require(_0xb921('0x6'));var config=require(_0xb921('0x7'));var controller=require(_0xb921('0x8'));router[_0xb921('0x9')]('/',auth[_0xb921('0xa')](),controller[_0xb921('0xb')]);router[_0xb921('0x9')](_0xb921('0xc'),auth[_0xb921('0xa')](),controller['describe']);router[_0xb921('0x9')](_0xb921('0xd'),auth[_0xb921('0xa')](),controller[_0xb921('0xe')]);router[_0xb921('0xf')]('/',auth[_0xb921('0xa')](),interaction[_0xb921('0x10')](_0xb921('0x11'),_0xb921('0x12')),controller[_0xb921('0x13')]);router[_0xb921('0xf')](_0xb921('0x14'),controller[_0xb921('0x15')]);router[_0xb921('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xb921('0x17')]);router[_0xb921('0x16')](_0xb921('0x18'),auth[_0xb921('0xa')](),controller[_0xb921('0x19')]);router[_0xb921('0x16')]('/:id/reject',auth[_0xb921('0xa')](),controller[_0xb921('0x1a')]);router[_0xb921('0x1b')](_0xb921('0xd'),auth[_0xb921('0xa')](),controller[_0xb921('0x1c')]);module[_0xb921('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 33626cc..dad575d 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 _0x59b7=['medium','BOOLEAN','out','STRING','DATE','exports','TEXT'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0x59b7,0x1ef));var _0x759b=function(_0x1a1a1c,_0x1608a7){_0x1a1a1c=_0x1a1a1c-0x0;var _0x3f0f83=_0x59b7[_0x1a1a1c];return _0x3f0f83;};'use strict';var Sequelize=require('sequelize');module[_0x759b('0x0')]={'body':{'type':Sequelize[_0x759b('0x1')](_0x759b('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x759b('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x759b('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x759b('0x5')](0xbe)},'phone':{'type':Sequelize[_0x759b('0x5')]},'readAt':{'type':Sequelize[_0x759b('0x6')]},'secret':{'type':Sequelize[_0x759b('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x759b('0x1')]}}; \ No newline at end of file +var _0x2d83=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize'];(function(_0x538117,_0x16615e){var _0x576eaf=function(_0x5d33cb){while(--_0x5d33cb){_0x538117['push'](_0x538117['shift']());}};_0x576eaf(++_0x16615e);}(_0x2d83,0x1dc));var _0x32d8=function(_0x1cdac8,_0x5e237a){_0x1cdac8=_0x1cdac8-0x0;var _0x354a62=_0x2d83[_0x1cdac8];return _0x354a62;};'use strict';var Sequelize=require(_0x32d8('0x0'));module[_0x32d8('0x1')]={'body':{'type':Sequelize[_0x32d8('0x2')](_0x32d8('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x32d8('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x32d8('0x5')]('in',_0x32d8('0x6')),'defaultValue':_0x32d8('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x32d8('0x7')]},'readAt':{'type':Sequelize[_0x32d8('0x8')]},'secret':{'type':Sequelize[_0x32d8('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x32d8('0x7')]},'providerResponse':{'type':Sequelize[_0x32d8('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index ca97500..839d9af 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 _0x276d=['fieldName','model','keys','filters','intersection','query','attributes','fields','length','nolimit','limit','where','pick','filter','type','VIRTUAL','options','WhatsappMessage','include','findAll','rows','show','params','rawAttributes','includeAll','merge','create','find','body','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteraction','isNil','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','User','email','internal','agent','manual','SIP/%s','channel','event','EventManager','acceptmessage','reject','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','fullname','interface','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','jayson/promise','client','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','save','update','destroy','stack','name','send','index','map'];(function(_0x1d6d2f,_0x3e2ece){var _0xa7545e=function(_0x446c67){while(--_0x446c67){_0x1d6d2f['push'](_0x1d6d2f['shift']());}};_0xa7545e(++_0x3e2ece);}(_0x276d,0xe3));var _0xd276=function(_0x14a86e,_0x1131fc){_0x14a86e=_0x14a86e-0x0;var _0xba191a=_0x276d[_0x14a86e];return _0xba191a;};'use strict';var emlformat=require(_0xd276('0x0'));var rimraf=require(_0xd276('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd276('0x2'));var rp=require(_0xd276('0x3'));var moment=require(_0xd276('0x4'));var BPromise=require(_0xd276('0x5'));var Mustache=require(_0xd276('0x6'));var util=require(_0xd276('0x7'));var path=require('path');var sox=require(_0xd276('0x8'));var csv=require(_0xd276('0x9'));var ejs=require(_0xd276('0xa'));var fs=require('fs');var fs_extra=require(_0xd276('0xb'));var _=require(_0xd276('0xc'));var squel=require(_0xd276('0xd'));var crypto=require(_0xd276('0xe'));var jsforce=require(_0xd276('0xf'));var deskjs=require(_0xd276('0x10'));var toCsv=require(_0xd276('0x9'));var querystring=require(_0xd276('0x11'));var Papa=require(_0xd276('0x12'));var Redis=require(_0xd276('0x13'));var authService=require(_0xd276('0x14'));var qs=require(_0xd276('0x15'));var as=require(_0xd276('0x16'));var hardwareService=require(_0xd276('0x17'));var logger=require('../../config/logger')(_0xd276('0x18'));var utils=require(_0xd276('0x19'));var config=require(_0xd276('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xd276('0x1b'))['db'];config['redis']=_[_0xd276('0x1c')](config[_0xd276('0x1d')],{'host':_0xd276('0x1e'),'port':0x18eb});var socket=require(_0xd276('0x1f'))(new Redis(config[_0xd276('0x1d')]));require(_0xd276('0x20'))['register'](socket);var jayson=require(_0xd276('0x21'));var client=jayson[_0xd276('0x22')]['http']({'port':0x232c});var client9002=jayson[_0xd276('0x22')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17149b,_0x5e313f,_0x262421,_0x55ab67){return new BPromise(function(_0x58c1b4,_0x4750a8){var _0x45e372=_0x55ab67||client;return _0x45e372[_0xd276('0x23')](_0x17149b,_0x262421)[_0xd276('0x24')](function(_0x3773af){logger[_0xd276('0x25')](_0xd276('0x26'),_0x5e313f,_0xd276('0x27'));logger[_0xd276('0x28')](_0xd276('0x29'),_0x5e313f,_0xd276('0x27'),JSON[_0xd276('0x2a')](_0x3773af));if(_0x3773af[_0xd276('0x2b')]){if(_0x3773af[_0xd276('0x2b')][_0xd276('0x2c')]===0x1f4){logger['error'](_0xd276('0x26'),_0x5e313f,_0x3773af['error'][_0xd276('0x2d')]);return _0x4750a8(_0x3773af[_0xd276('0x2b')][_0xd276('0x2d')]);}logger[_0xd276('0x2b')](_0xd276('0x26'),_0x5e313f,_0x3773af[_0xd276('0x2b')][_0xd276('0x2d')]);return _0x58c1b4(_0x3773af[_0xd276('0x2b')][_0xd276('0x2d')]);}else{logger[_0xd276('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x5e313f,'request\x20sent');_0x58c1b4(_0x3773af[_0xd276('0x2e')][_0xd276('0x2d')]);}})[_0xd276('0x2f')](function(_0x57512e){logger[_0xd276('0x2b')](_0xd276('0x26'),_0x5e313f,_0x57512e);_0x4750a8(_0x57512e);});});}function respondWithStatusCode(_0x14e3a9,_0x44dd84){_0x44dd84=_0x44dd84||0xcc;return function(_0xcb542d){if(_0xcb542d){return _0x14e3a9[_0xd276('0x30')](_0x44dd84);}return _0x14e3a9[_0xd276('0x31')](_0x44dd84)[_0xd276('0x32')]();};}function respondWithResult(_0x1feace,_0x17819f){_0x17819f=_0x17819f||0xc8;return function(_0x54041e){if(_0x54041e){return _0x1feace[_0xd276('0x31')](_0x17819f)[_0xd276('0x33')](_0x54041e);}};}function respondWithFilteredResult(_0x929d9a,_0x6d9cd5){return function(_0x252acc){if(_0x252acc){var _0x58193f=typeof _0x6d9cd5[_0xd276('0x34')]===_0xd276('0x35')&&typeof _0x6d9cd5['limit']==='undefined';var _0xee5357=_0x252acc[_0xd276('0x36')];var _0x13e4cc=_0x58193f?0x0:_0x6d9cd5[_0xd276('0x34')];var _0x3d238b=_0x58193f?_0x252acc[_0xd276('0x36')]:_0x6d9cd5['offset']+_0x6d9cd5['limit'];var _0x4f2e41;if(_0x3d238b>=_0xee5357){_0x3d238b=_0xee5357;_0x4f2e41=0xc8;}else{_0x4f2e41=0xce;}_0x929d9a[_0xd276('0x31')](_0x4f2e41);return _0x929d9a['set'](_0xd276('0x37'),_0x13e4cc+'-'+_0x3d238b+'/'+_0xee5357)[_0xd276('0x33')](_0x252acc);}return null;};}function patchUpdates(_0x1204b0){return function(_0x85d5f2){try{jsonpatch[_0xd276('0x38')](_0x85d5f2,_0x1204b0,!![]);}catch(_0x1600eb){return BPromise['reject'](_0x1600eb);}return _0x85d5f2[_0xd276('0x39')]();};}function saveUpdates(_0x141aa2,_0x4752b8){return function(_0x495a9f){if(_0x495a9f){return _0x495a9f[_0xd276('0x3a')](_0x141aa2)[_0xd276('0x24')](function(_0x4aee1d){return _0x4aee1d;});}return null;};}function removeEntity(_0x42f1b5,_0x19a048){return function(_0xede458){if(_0xede458){return _0xede458[_0xd276('0x3b')]()[_0xd276('0x24')](function(){_0x42f1b5[_0xd276('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13fc4f,_0x13336d){return function(_0x5d7180){if(!_0x5d7180){_0x13fc4f[_0xd276('0x30')](0x194);}return _0x5d7180;};}function handleError(_0x2ff2e9,_0x1c840c){_0x1c840c=_0x1c840c||0x1f4;return function(_0xea2fb4){logger[_0xd276('0x2b')](_0xea2fb4[_0xd276('0x3c')]);if(_0xea2fb4[_0xd276('0x3d')]){delete _0xea2fb4[_0xd276('0x3d')];}_0x2ff2e9[_0xd276('0x31')](_0x1c840c)[_0xd276('0x3e')](_0xea2fb4);};}exports[_0xd276('0x3f')]=function(_0x22cb89,_0x123b34){var _0x5bfaf6={},_0x395afa={},_0x44d7e3={'count':0x0,'rows':[]};var _0x56b82f=_[_0xd276('0x40')](db['WhatsappMessage']['rawAttributes'],function(_0x225f85){return{'name':_0x225f85[_0xd276('0x41')],'type':_0x225f85['type']['key']};});_0x395afa[_0xd276('0x42')]=_[_0xd276('0x40')](_0x56b82f,'name');_0x395afa['query']=_[_0xd276('0x43')](_0x22cb89['query']);_0x395afa[_0xd276('0x44')]=_[_0xd276('0x45')](_0x395afa['model'],_0x395afa[_0xd276('0x46')]);_0x5bfaf6[_0xd276('0x47')]=_[_0xd276('0x45')](_0x395afa['model'],qs[_0xd276('0x48')](_0x22cb89[_0xd276('0x46')][_0xd276('0x48')]));_0x5bfaf6[_0xd276('0x47')]=_0x5bfaf6['attributes'][_0xd276('0x49')]?_0x5bfaf6[_0xd276('0x47')]:_0x395afa['model'];if(!_0x22cb89[_0xd276('0x46')]['hasOwnProperty'](_0xd276('0x4a'))){_0x5bfaf6[_0xd276('0x4b')]=qs['limit'](_0x22cb89[_0xd276('0x46')]['limit']);_0x5bfaf6[_0xd276('0x34')]=qs['offset'](_0x22cb89['query']['offset']);}_0x5bfaf6['order']=qs['sort'](_0x22cb89['query']['sort']);_0x5bfaf6[_0xd276('0x4c')]=qs[_0xd276('0x44')](_[_0xd276('0x4d')](_0x22cb89[_0xd276('0x46')],_0x395afa[_0xd276('0x44')]),_0x56b82f);if(_0x22cb89['query'][_0xd276('0x4e')]){_0x5bfaf6['where']=_['merge'](_0x5bfaf6[_0xd276('0x4c')],{'$or':_[_0xd276('0x40')](_0x56b82f,function(_0x4d3ae9){if(_0x4d3ae9[_0xd276('0x4f')]!==_0xd276('0x50')){var _0x346f86={};_0x346f86[_0x4d3ae9[_0xd276('0x3d')]]={'$like':'%'+_0x22cb89['query'][_0xd276('0x4e')]+'%'};return _0x346f86;}})});}_0x5bfaf6=_['merge']({},_0x5bfaf6,_0x22cb89[_0xd276('0x51')]);var _0x560248={'where':_0x5bfaf6[_0xd276('0x4c')]};return db[_0xd276('0x52')][_0xd276('0x36')](_0x560248)[_0xd276('0x24')](function(_0x1908ba){_0x44d7e3[_0xd276('0x36')]=_0x1908ba;if(_0x22cb89[_0xd276('0x46')]['includeAll']){_0x5bfaf6[_0xd276('0x53')]=[{'all':!![]}];}return db[_0xd276('0x52')][_0xd276('0x54')](_0x5bfaf6);})['then'](function(_0x37cc4b){_0x44d7e3[_0xd276('0x55')]=_0x37cc4b;return _0x44d7e3;})[_0xd276('0x24')](respondWithFilteredResult(_0x123b34,_0x5bfaf6))[_0xd276('0x2f')](handleError(_0x123b34,null));};exports[_0xd276('0x56')]=function(_0x23d4af,_0x2a24dc){var _0x13ae83={'raw':!![],'where':{'id':_0x23d4af[_0xd276('0x57')]['id']}},_0x23777f={};_0x23777f[_0xd276('0x42')]=_['keys'](db[_0xd276('0x52')][_0xd276('0x58')]);_0x23777f[_0xd276('0x46')]=_[_0xd276('0x43')](_0x23d4af['query']);_0x23777f[_0xd276('0x44')]=_[_0xd276('0x45')](_0x23777f['model'],_0x23777f['query']);_0x13ae83[_0xd276('0x47')]=_[_0xd276('0x45')](_0x23777f[_0xd276('0x42')],qs[_0xd276('0x48')](_0x23d4af[_0xd276('0x46')][_0xd276('0x48')]));_0x13ae83[_0xd276('0x47')]=_0x13ae83[_0xd276('0x47')][_0xd276('0x49')]?_0x13ae83['attributes']:_0x23777f['model'];if(_0x23d4af[_0xd276('0x46')][_0xd276('0x59')]){_0x13ae83[_0xd276('0x53')]=[{'all':!![]}];}_0x13ae83=_[_0xd276('0x5a')]({},_0x13ae83,_0x23d4af[_0xd276('0x51')]);return db[_0xd276('0x52')]['find'](_0x13ae83)['then'](handleEntityNotFound(_0x2a24dc,null))[_0xd276('0x24')](respondWithResult(_0x2a24dc,null))[_0xd276('0x2f')](handleError(_0x2a24dc,null));};exports['create']=function(_0xb5426c,_0x47ffed){return db['WhatsappMessage'][_0xd276('0x5b')](_0xb5426c['body'],{})[_0xd276('0x24')](respondWithResult(_0x47ffed,0xc9))['catch'](handleError(_0x47ffed,null));};exports['update']=function(_0x1391ed,_0x5dfc87){if(_0x1391ed['body']['id']){delete _0x1391ed['body']['id'];}return db[_0xd276('0x52')][_0xd276('0x5c')]({'where':{'id':_0x1391ed[_0xd276('0x57')]['id']}})[_0xd276('0x24')](handleEntityNotFound(_0x5dfc87,null))['then'](saveUpdates(_0x1391ed[_0xd276('0x5d')],null))[_0xd276('0x24')](respondWithResult(_0x5dfc87,null))[_0xd276('0x2f')](handleError(_0x5dfc87,null));};exports[_0xd276('0x3b')]=function(_0x2f8a0a,_0x5effa7){return db['WhatsappMessage']['find']({'where':{'id':_0x2f8a0a[_0xd276('0x57')]['id']}})['then'](handleEntityNotFound(_0x5effa7,null))[_0xd276('0x24')](removeEntity(_0x5effa7,null))[_0xd276('0x2f')](handleError(_0x5effa7,null));};exports['describe']=function(_0x2e07c4,_0x445bd6){return db[_0xd276('0x52')][_0xd276('0x5e')]()[_0xd276('0x24')](respondWithResult(_0x445bd6,null))[_0xd276('0x2f')](handleError(_0x445bd6,null));};var interaction_log=require(_0xd276('0x5f'))(_0xd276('0x60'));exports[_0xd276('0x61')]=function(_0x1a28da,_0x274f86,_0x3a1967){var _0x271ecf={'agent':{},'channel':_0xd276('0x62')};if(_0x1a28da[_0xd276('0x5d')]['id']){delete _0x1a28da['body']['id'];}_0x1a28da[_0xd276('0x5d')][_0xd276('0x63')]=!![];_0x1a28da[_0xd276('0x5d')][_0xd276('0x64')]=moment()[_0xd276('0x65')](_0xd276('0x66'));_0x1a28da[_0xd276('0x5d')][_0xd276('0x67')]=_0x1a28da['body']['UserId']||_0x1a28da[_0xd276('0x68')]['id'];_0x271ecf['agent']['id']=_0x1a28da[_0xd276('0x5d')]['UserId'];return db[_0xd276('0x52')]['find']({'where':{'id':_0x1a28da[_0xd276('0x57')]['id'],'UserId':null}})[_0xd276('0x24')](handleEntityNotFound(_0x274f86,null))[_0xd276('0x24')](saveUpdates(_0x1a28da['body'],null))['then'](function(_0x5b305d){if(_0x5b305d){_0x271ecf[_0xd276('0x2d')]=_0x5b305d[_0xd276('0x69')]({'plain':!![]});return db[_0xd276('0x6a')][_0xd276('0x5c')]({'where':{'id':_0x5b305d['WhatsappInteractionId']}});}return null;})[_0xd276('0x24')](handleEntityNotFound(_0x274f86,null))[_0xd276('0x24')](function(_0x10c81a){if(_0x10c81a){return _0x10c81a['update']({'UserId':_0x1a28da['body'][_0xd276('0x67')],'read1stAt':_[_0xd276('0x6b')](_0x10c81a[_0xd276('0x6c')])?moment()[_0xd276('0x65')](_0xd276('0x66')):undefined});}return null;})[_0xd276('0x24')](function(_0x2d563f){if(_0x2d563f){_0x271ecf[_0xd276('0x6d')]=_0x2d563f['get']({'plain':!![]});interaction_log[_0xd276('0x25')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1a28da['user']['id'],_0x1a28da[_0xd276('0x68')]['name'],_0x1a28da[_0xd276('0x68')][_0xd276('0x6e')],_0x271ecf['interaction']['id'],_0x1a28da['body']?JSON[_0xd276('0x2a')](_0x1a28da[_0xd276('0x5d')]):_0xd276('0x6f'));return respondWithRpcPromise(_0xd276('0x70'),_0xd276('0x71'),_0x271ecf);}return null;})[_0xd276('0x24')](function(_0x45f25f){var _0x43d9b5=_0xd276('0x72')+_0x45f25f[_0xd276('0x2d')]['ContactId'];return db[_0xd276('0x73')][_0xd276('0x46')](_0x43d9b5,{'type':db[_0xd276('0x74')][_0xd276('0x75')]['SELECT'],'raw':!![]})['then'](function(_0x3d08ec){return _0x3d08ec;});})['then'](function(_0x444577){if(_0x444577){_0x271ecf[_0xd276('0x2d')][_0xd276('0x76')]=_0x444577[0x0];if(!_0x1a28da[_0xd276('0x5d')][_0xd276('0x67')])return;return db[_0xd276('0x77')][_0xd276('0x5c')]({'where':{'id':_0x1a28da[_0xd276('0x5d')][_0xd276('0x67')],'role':'agent'},'attributes':['id',_0xd276('0x3d'),'fullname',_0xd276('0x78'),_0xd276('0x79')],'raw':!![]});}return null;})[_0xd276('0x24')](function(_0x1cf414){if(!_0x1cf414)return null;_0x271ecf[_0xd276('0x2d')][_0xd276('0x7a')]=_0x1cf414;return _0x271ecf;})[_0xd276('0x24')](function(_0x540b1a){if(_0x540b1a){if(_0x1a28da[_0xd276('0x5d')][_0xd276('0x7b')]){_0x271ecf[_0xd276('0x2d')]['interface']=util[_0xd276('0x65')](_0xd276('0x7c'),_0x1a28da[_0xd276('0x68')][_0xd276('0x3d')]);_0x271ecf[_0xd276('0x2d')][_0xd276('0x7d')]=_0x271ecf[_0xd276('0x7d')];_0x271ecf[_0xd276('0x2d')][_0xd276('0x7e')]=_0xd276('0x61');return respondWithRpcPromise(_0xd276('0x7f'),_0xd276('0x7f'),{'event':_0xd276('0x80'),'message':_0x271ecf[_0xd276('0x2d')]},client9002)[_0xd276('0x24')](function(){return _0x271ecf;});}return _0x271ecf;}return null;})['then'](respondWithResult(_0x274f86,null))[_0xd276('0x2f')](handleError(_0x274f86,null));};var interaction_log=require(_0xd276('0x5f'))('whatsapp-interactions');exports[_0xd276('0x81')]=function(_0x19e2d1,_0x3b3f39,_0x307142){var _0x1988d3={'agent':{},'channel':_0xd276('0x62')};if(_0x19e2d1[_0xd276('0x5d')]['id']){delete _0x19e2d1[_0xd276('0x5d')]['id'];}_0x19e2d1['body'][_0xd276('0x67')]=_0x19e2d1[_0xd276('0x5d')][_0xd276('0x67')]||_0x19e2d1[_0xd276('0x68')]['id'];_0x1988d3[_0xd276('0x7a')]['id']=_0x19e2d1[_0xd276('0x5d')][_0xd276('0x67')];return db[_0xd276('0x52')][_0xd276('0x5c')]({'where':{'id':_0x19e2d1[_0xd276('0x57')]['id'],'UserId':null}})[_0xd276('0x24')](handleEntityNotFound(_0x3b3f39,null))[_0xd276('0x24')](function(_0x11694d){if(_0x11694d){_0x1988d3[_0xd276('0x2d')]=_0x11694d[_0xd276('0x69')]({'plain':!![]});return db[_0xd276('0x6a')][_0xd276('0x5c')]({'where':{'id':_0x11694d[_0xd276('0x82')]}});}return null;})[_0xd276('0x24')](handleEntityNotFound(_0x3b3f39,null))[_0xd276('0x24')](function(_0x57e638){if(_0x57e638){_0x1988d3[_0xd276('0x6d')]=_0x57e638[_0xd276('0x69')]({'plain':!![]});interaction_log['info'](_0xd276('0x83'),_0x19e2d1['user']['id'],_0x19e2d1[_0xd276('0x68')]['name'],_0x19e2d1['user'][_0xd276('0x6e')],_0x1988d3[_0xd276('0x6d')]['id'],_0x19e2d1[_0xd276('0x5d')]?JSON['stringify'](_0x19e2d1[_0xd276('0x5d')]):'null');return respondWithRpcPromise(_0xd276('0x84'),_0xd276('0x85'),_0x1988d3);}return null;})[_0xd276('0x24')](function(_0x12eb0c){var _0x29e928=_0xd276('0x72')+_0x12eb0c[_0xd276('0x2d')]['ContactId'];return db[_0xd276('0x73')][_0xd276('0x46')](_0x29e928,{'type':db[_0xd276('0x74')][_0xd276('0x75')][_0xd276('0x86')],'raw':!![]})[_0xd276('0x24')](function(_0x117712){return _0x117712;});})[_0xd276('0x24')](function(_0x4ed754){if(_0x4ed754){_0x1988d3[_0xd276('0x2d')]['contact']=_0x4ed754[0x0];if(!_0x19e2d1['body'][_0xd276('0x67')])return;return db[_0xd276('0x77')][_0xd276('0x5c')]({'where':{'id':_0x19e2d1[_0xd276('0x5d')][_0xd276('0x67')],'role':_0xd276('0x7a')},'attributes':['id',_0xd276('0x3d'),_0xd276('0x87'),_0xd276('0x78'),_0xd276('0x79')],'raw':!![]});}return null;})[_0xd276('0x24')](function(_0x5275f4){if(!_0x5275f4)return null;_0x1988d3[_0xd276('0x2d')][_0xd276('0x7a')]=_0x5275f4;return _0x1988d3;})[_0xd276('0x24')](function(_0x20cbdb){if(_0x20cbdb){_0x20cbdb['message'][_0xd276('0x88')]=util[_0xd276('0x65')](_0xd276('0x7c'),_0x19e2d1['user'][_0xd276('0x3d')]);_0x20cbdb[_0xd276('0x2d')]['channel']=_0x1988d3[_0xd276('0x7d')];_0x20cbdb[_0xd276('0x2d')]['event']='reject';respondWithRpcPromise(_0xd276('0x7f'),_0xd276('0x7f'),{'event':'rejectmessage','message':_0x20cbdb[_0xd276('0x2d')]},client9002);return _0x1988d3;}return null;})[_0xd276('0x24')](respondWithResult(_0x3b3f39,null))['catch'](handleError(_0x3b3f39,null));};exports[_0xd276('0x31')]=function(_0x2f00d2,_0x29b35a,_0x4f5ce9){if(_0x2f00d2[_0xd276('0x5d')]['id']){delete _0x2f00d2[_0xd276('0x5d')]['id'];}var _0x334c0e;return db[_0xd276('0x52')][_0xd276('0x5c')]({'where':{'id':_0x2f00d2[_0xd276('0x57')]['id']}})[_0xd276('0x24')](handleEntityNotFound(_0x29b35a,null))['then'](function(_0x24dc8f){if(_0x24dc8f){_0x334c0e=_0x24dc8f;return db[_0xd276('0x89')]['find']({'where':{'id':_0x24dc8f[_0xd276('0x8a')]}});}})[_0xd276('0x24')](handleEntityNotFound(_0x29b35a,null))[_0xd276('0x24')](function(_0x4965ea){if(_0x4965ea){logger[_0xd276('0x28')](_0xd276('0x8b'),_0xd276('0x31'),_0xd276('0x8c'),_0x4965ea['type'],util[_0xd276('0x8d')](_0x2f00d2[_0xd276('0x5d')],{'showHidden':![],'depth':null}));switch(_0x4965ea['type']){case'twilio':if(_0x2f00d2[_0xd276('0x5d')]['MessageSid']&&_0x2f00d2[_0xd276('0x5d')][_0xd276('0x8e')]===_0x334c0e['messageId']&&_0x2f00d2[_0xd276('0x5d')][_0xd276('0x8f')]&&_0x2f00d2[_0xd276('0x5d')]['MessageStatus']===_0xd276('0x63')){return _0x334c0e[_0xd276('0x3a')]({'read':!![]});}else{logger['error'](_0xd276('0x90'),'status',_0xd276('0x91'),util[_0xd276('0x8d')](_0x2f00d2[_0xd276('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x334c0e;}})[_0xd276('0x24')](respondWithResult(_0x29b35a,null))[_0xd276('0x2f')](handleError(_0x29b35a,null));}; \ No newline at end of file +var _0x5228=['MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','client','http','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','reject','update','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','options','includeAll','findAll','rows','catch','show','params','WhatsappMessage','find','body','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','user','agent','get','WhatsappInteraction','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','email','internal','interface','SIP/%s','channel','event','EventManager','acceptmessage','WhatsappInteractionId','RejectMessage','rejectMessage','fullname','rejectmessage','WhatsappAccount','WhatsappAccountId','inspect','twilio'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x5228,0x10e));var _0x8522=function(_0x3723a7,_0x673192){_0x3723a7=_0x3723a7-0x0;var _0x4dcb27=_0x5228[_0x3723a7];return _0x4dcb27;};'use strict';var emlformat=require(_0x8522('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8522('0x1'));var jsonpatch=require(_0x8522('0x2'));var rp=require(_0x8522('0x3'));var moment=require(_0x8522('0x4'));var BPromise=require(_0x8522('0x5'));var Mustache=require(_0x8522('0x6'));var util=require(_0x8522('0x7'));var path=require(_0x8522('0x8'));var sox=require('sox');var csv=require(_0x8522('0x9'));var ejs=require(_0x8522('0xa'));var fs=require('fs');var fs_extra=require(_0x8522('0xb'));var _=require(_0x8522('0xc'));var squel=require(_0x8522('0xd'));var crypto=require(_0x8522('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8522('0xf'));var toCsv=require(_0x8522('0x9'));var querystring=require(_0x8522('0x10'));var Papa=require('papaparse');var Redis=require(_0x8522('0x11'));var authService=require(_0x8522('0x12'));var qs=require(_0x8522('0x13'));var as=require(_0x8522('0x14'));var hardwareService=require(_0x8522('0x15'));var logger=require(_0x8522('0x16'))(_0x8522('0x17'));var utils=require('../../config/utils');var config=require(_0x8522('0x18'));var licenseUtil=require(_0x8522('0x19'));var db=require('../../mysqldb')['db'];config[_0x8522('0x1a')]=_[_0x8522('0x1b')](config[_0x8522('0x1a')],{'host':_0x8522('0x1c'),'port':0x18eb});var socket=require(_0x8522('0x1d'))(new Redis(config[_0x8522('0x1a')]));require('./whatsappMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x8522('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x8522('0x1e')][_0x8522('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4dfd8a,_0xdadf62,_0x79a2c3,_0xaa3be0){return new BPromise(function(_0x59beb9,_0xb9ab1c){var _0x5cab38=_0xaa3be0||client;return _0x5cab38['request'](_0x4dfd8a,_0x79a2c3)[_0x8522('0x20')](function(_0x3ecbec){logger[_0x8522('0x21')](_0x8522('0x22'),_0xdadf62,_0x8522('0x23'));logger[_0x8522('0x24')](_0x8522('0x25'),_0xdadf62,_0x8522('0x23'),JSON['stringify'](_0x3ecbec));if(_0x3ecbec[_0x8522('0x26')]){if(_0x3ecbec[_0x8522('0x26')][_0x8522('0x27')]===0x1f4){logger[_0x8522('0x26')](_0x8522('0x22'),_0xdadf62,_0x3ecbec[_0x8522('0x26')][_0x8522('0x28')]);return _0xb9ab1c(_0x3ecbec['error'][_0x8522('0x28')]);}logger[_0x8522('0x26')](_0x8522('0x22'),_0xdadf62,_0x3ecbec[_0x8522('0x26')]['message']);return _0x59beb9(_0x3ecbec[_0x8522('0x26')][_0x8522('0x28')]);}else{logger[_0x8522('0x21')](_0x8522('0x22'),_0xdadf62,_0x8522('0x23'));_0x59beb9(_0x3ecbec[_0x8522('0x29')][_0x8522('0x28')]);}})['catch'](function(_0x466e73){logger[_0x8522('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0xdadf62,_0x466e73);_0xb9ab1c(_0x466e73);});});}function respondWithStatusCode(_0x1a83a1,_0x2398ae){_0x2398ae=_0x2398ae||0xcc;return function(_0x569ec8){if(_0x569ec8){return _0x1a83a1[_0x8522('0x2a')](_0x2398ae);}return _0x1a83a1[_0x8522('0x2b')](_0x2398ae)[_0x8522('0x2c')]();};}function respondWithResult(_0x5ae1d2,_0x2c726b){_0x2c726b=_0x2c726b||0xc8;return function(_0x394e44){if(_0x394e44){return _0x5ae1d2[_0x8522('0x2b')](_0x2c726b)['json'](_0x394e44);}};}function respondWithFilteredResult(_0x6c28c8,_0x4e4cee){return function(_0x2e4cd9){if(_0x2e4cd9){var _0x306728=typeof _0x4e4cee['offset']===_0x8522('0x2d')&&typeof _0x4e4cee['limit']==='undefined';var _0x304d48=_0x2e4cd9[_0x8522('0x2e')];var _0x1964b7=_0x306728?0x0:_0x4e4cee[_0x8522('0x2f')];var _0x2e8c14=_0x306728?_0x2e4cd9[_0x8522('0x2e')]:_0x4e4cee[_0x8522('0x2f')]+_0x4e4cee[_0x8522('0x30')];var _0x3419db;if(_0x2e8c14>=_0x304d48){_0x2e8c14=_0x304d48;_0x3419db=0xc8;}else{_0x3419db=0xce;}_0x6c28c8[_0x8522('0x2b')](_0x3419db);return _0x6c28c8[_0x8522('0x31')](_0x8522('0x32'),_0x1964b7+'-'+_0x2e8c14+'/'+_0x304d48)['json'](_0x2e4cd9);}return null;};}function patchUpdates(_0x5cc811){return function(_0x3ab66e){try{jsonpatch['apply'](_0x3ab66e,_0x5cc811,!![]);}catch(_0x71cb33){return BPromise[_0x8522('0x33')](_0x71cb33);}return _0x3ab66e['save']();};}function saveUpdates(_0x3f4434,_0x2ea8aa){return function(_0x14f7dd){if(_0x14f7dd){return _0x14f7dd[_0x8522('0x34')](_0x3f4434)['then'](function(_0x2a4439){return _0x2a4439;});}return null;};}function removeEntity(_0x4cc189,_0x251f1f){return function(_0x785245){if(_0x785245){return _0x785245[_0x8522('0x35')]()['then'](function(){_0x4cc189['status'](0xcc)[_0x8522('0x2c')]();});}};}function handleEntityNotFound(_0x2f865f,_0x3484a0){return function(_0x35ffff){if(!_0x35ffff){_0x2f865f[_0x8522('0x2a')](0x194);}return _0x35ffff;};}function handleError(_0x1c0411,_0x286326){_0x286326=_0x286326||0x1f4;return function(_0x12640e){logger[_0x8522('0x26')](_0x12640e['stack']);if(_0x12640e['name']){delete _0x12640e[_0x8522('0x36')];}_0x1c0411['status'](_0x286326)[_0x8522('0x37')](_0x12640e);};}exports[_0x8522('0x38')]=function(_0x21b615,_0x59511e){var _0xdefe3d={},_0x5bfc0f={},_0x3d99dd={'count':0x0,'rows':[]};var _0xdf1575=_[_0x8522('0x39')](db['WhatsappMessage'][_0x8522('0x3a')],function(_0x27e2cc){return{'name':_0x27e2cc[_0x8522('0x3b')],'type':_0x27e2cc[_0x8522('0x3c')][_0x8522('0x3d')]};});_0x5bfc0f[_0x8522('0x3e')]=_[_0x8522('0x39')](_0xdf1575,_0x8522('0x36'));_0x5bfc0f[_0x8522('0x3f')]=_[_0x8522('0x40')](_0x21b615[_0x8522('0x3f')]);_0x5bfc0f['filters']=_[_0x8522('0x41')](_0x5bfc0f['model'],_0x5bfc0f[_0x8522('0x3f')]);_0xdefe3d['attributes']=_[_0x8522('0x41')](_0x5bfc0f['model'],qs[_0x8522('0x42')](_0x21b615[_0x8522('0x3f')][_0x8522('0x42')]));_0xdefe3d[_0x8522('0x43')]=_0xdefe3d[_0x8522('0x43')][_0x8522('0x44')]?_0xdefe3d[_0x8522('0x43')]:_0x5bfc0f[_0x8522('0x3e')];if(!_0x21b615[_0x8522('0x3f')]['hasOwnProperty'](_0x8522('0x45'))){_0xdefe3d[_0x8522('0x30')]=qs['limit'](_0x21b615[_0x8522('0x3f')][_0x8522('0x30')]);_0xdefe3d[_0x8522('0x2f')]=qs[_0x8522('0x2f')](_0x21b615['query'][_0x8522('0x2f')]);}_0xdefe3d[_0x8522('0x46')]=qs[_0x8522('0x47')](_0x21b615['query'][_0x8522('0x47')]);_0xdefe3d[_0x8522('0x48')]=qs['filters'](_['pick'](_0x21b615[_0x8522('0x3f')],_0x5bfc0f[_0x8522('0x49')]),_0xdf1575);if(_0x21b615[_0x8522('0x3f')][_0x8522('0x4a')]){_0xdefe3d[_0x8522('0x48')]=_[_0x8522('0x4b')](_0xdefe3d[_0x8522('0x48')],{'$or':_['map'](_0xdf1575,function(_0x58b6cd){if(_0x58b6cd[_0x8522('0x3c')]!=='VIRTUAL'){var _0x28e09a={};_0x28e09a[_0x58b6cd[_0x8522('0x36')]]={'$like':'%'+_0x21b615[_0x8522('0x3f')]['filter']+'%'};return _0x28e09a;}})});}_0xdefe3d=_[_0x8522('0x4b')]({},_0xdefe3d,_0x21b615[_0x8522('0x4c')]);var _0x3d17fc={'where':_0xdefe3d[_0x8522('0x48')]};return db['WhatsappMessage'][_0x8522('0x2e')](_0x3d17fc)['then'](function(_0x41f29c){_0x3d99dd[_0x8522('0x2e')]=_0x41f29c;if(_0x21b615[_0x8522('0x3f')][_0x8522('0x4d')]){_0xdefe3d['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x8522('0x4e')](_0xdefe3d);})[_0x8522('0x20')](function(_0x3e60f4){_0x3d99dd[_0x8522('0x4f')]=_0x3e60f4;return _0x3d99dd;})[_0x8522('0x20')](respondWithFilteredResult(_0x59511e,_0xdefe3d))[_0x8522('0x50')](handleError(_0x59511e,null));};exports[_0x8522('0x51')]=function(_0x16fc17,_0xf12a55){var _0x5ebec4={'raw':!![],'where':{'id':_0x16fc17[_0x8522('0x52')]['id']}},_0x5eea0f={};_0x5eea0f[_0x8522('0x3e')]=_[_0x8522('0x40')](db[_0x8522('0x53')][_0x8522('0x3a')]);_0x5eea0f[_0x8522('0x3f')]=_[_0x8522('0x40')](_0x16fc17[_0x8522('0x3f')]);_0x5eea0f[_0x8522('0x49')]=_['intersection'](_0x5eea0f[_0x8522('0x3e')],_0x5eea0f['query']);_0x5ebec4[_0x8522('0x43')]=_[_0x8522('0x41')](_0x5eea0f[_0x8522('0x3e')],qs[_0x8522('0x42')](_0x16fc17['query'][_0x8522('0x42')]));_0x5ebec4[_0x8522('0x43')]=_0x5ebec4[_0x8522('0x43')][_0x8522('0x44')]?_0x5ebec4[_0x8522('0x43')]:_0x5eea0f[_0x8522('0x3e')];if(_0x16fc17[_0x8522('0x3f')][_0x8522('0x4d')]){_0x5ebec4['include']=[{'all':!![]}];}_0x5ebec4=_[_0x8522('0x4b')]({},_0x5ebec4,_0x16fc17['options']);return db[_0x8522('0x53')][_0x8522('0x54')](_0x5ebec4)[_0x8522('0x20')](handleEntityNotFound(_0xf12a55,null))['then'](respondWithResult(_0xf12a55,null))[_0x8522('0x50')](handleError(_0xf12a55,null));};exports['create']=function(_0x136979,_0x325b10){return db[_0x8522('0x53')]['create'](_0x136979[_0x8522('0x55')],{})[_0x8522('0x20')](respondWithResult(_0x325b10,0xc9))[_0x8522('0x50')](handleError(_0x325b10,null));};exports[_0x8522('0x34')]=function(_0x25b0f7,_0x398f88){if(_0x25b0f7['body']['id']){delete _0x25b0f7[_0x8522('0x55')]['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x25b0f7[_0x8522('0x52')]['id']}})[_0x8522('0x20')](handleEntityNotFound(_0x398f88,null))[_0x8522('0x20')](saveUpdates(_0x25b0f7[_0x8522('0x55')],null))['then'](respondWithResult(_0x398f88,null))[_0x8522('0x50')](handleError(_0x398f88,null));};exports['destroy']=function(_0x5aab45,_0x3379db){return db[_0x8522('0x53')][_0x8522('0x54')]({'where':{'id':_0x5aab45[_0x8522('0x52')]['id']}})[_0x8522('0x20')](handleEntityNotFound(_0x3379db,null))[_0x8522('0x20')](removeEntity(_0x3379db,null))[_0x8522('0x50')](handleError(_0x3379db,null));};exports['describe']=function(_0x5d3f45,_0x27e391){return db[_0x8522('0x53')]['describe']()[_0x8522('0x20')](respondWithResult(_0x27e391,null))[_0x8522('0x50')](handleError(_0x27e391,null));};var interaction_log=require('../../config/logger')(_0x8522('0x56'));exports[_0x8522('0x57')]=function(_0x285280,_0x80e04b,_0x41cb21){var _0x1be2bb={'agent':{},'channel':_0x8522('0x58')};if(_0x285280[_0x8522('0x55')]['id']){delete _0x285280[_0x8522('0x55')]['id'];}_0x285280['body'][_0x8522('0x59')]=!![];_0x285280[_0x8522('0x55')][_0x8522('0x5a')]=moment()[_0x8522('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x285280[_0x8522('0x55')][_0x8522('0x5c')]=_0x285280[_0x8522('0x55')][_0x8522('0x5c')]||_0x285280[_0x8522('0x5d')]['id'];_0x1be2bb[_0x8522('0x5e')]['id']=_0x285280[_0x8522('0x55')][_0x8522('0x5c')];return db['WhatsappMessage'][_0x8522('0x54')]({'where':{'id':_0x285280['params']['id'],'UserId':null}})[_0x8522('0x20')](handleEntityNotFound(_0x80e04b,null))[_0x8522('0x20')](saveUpdates(_0x285280[_0x8522('0x55')],null))[_0x8522('0x20')](function(_0x361704){if(_0x361704){_0x1be2bb[_0x8522('0x28')]=_0x361704[_0x8522('0x5f')]({'plain':!![]});return db[_0x8522('0x60')]['find']({'where':{'id':_0x361704['WhatsappInteractionId']}});}return null;})[_0x8522('0x20')](handleEntityNotFound(_0x80e04b,null))['then'](function(_0xe706bc){if(_0xe706bc){return _0xe706bc[_0x8522('0x34')]({'UserId':_0x285280[_0x8522('0x55')][_0x8522('0x5c')],'read1stAt':_['isNil'](_0xe706bc[_0x8522('0x61')])?moment()[_0x8522('0x5b')](_0x8522('0x62')):undefined});}return null;})[_0x8522('0x20')](function(_0x440a4e){if(_0x440a4e){_0x1be2bb['interaction']=_0x440a4e[_0x8522('0x5f')]({'plain':!![]});interaction_log[_0x8522('0x21')](_0x8522('0x63'),_0x285280['user']['id'],_0x285280[_0x8522('0x5d')][_0x8522('0x36')],_0x285280[_0x8522('0x5d')]['role'],_0x1be2bb[_0x8522('0x64')]['id'],_0x285280['body']?JSON[_0x8522('0x65')](_0x285280[_0x8522('0x55')]):_0x8522('0x66'));return respondWithRpcPromise(_0x8522('0x67'),_0x8522('0x68'),_0x1be2bb);}return null;})[_0x8522('0x20')](function(_0x399b69){var _0x14d3ad=_0x8522('0x69')+_0x399b69[_0x8522('0x28')][_0x8522('0x6a')];return db[_0x8522('0x6b')][_0x8522('0x3f')](_0x14d3ad,{'type':db['Sequelize'][_0x8522('0x6c')][_0x8522('0x6d')],'raw':!![]})[_0x8522('0x20')](function(_0x2dcc83){return _0x2dcc83;});})[_0x8522('0x20')](function(_0x119330){if(_0x119330){_0x1be2bb[_0x8522('0x28')][_0x8522('0x6e')]=_0x119330[0x0];if(!_0x285280[_0x8522('0x55')][_0x8522('0x5c')])return;return db[_0x8522('0x6f')]['find']({'where':{'id':_0x285280['body'][_0x8522('0x5c')],'role':_0x8522('0x5e')},'attributes':['id',_0x8522('0x36'),'fullname',_0x8522('0x70'),_0x8522('0x71')],'raw':!![]});}return null;})[_0x8522('0x20')](function(_0x155d2d){if(!_0x155d2d)return null;_0x1be2bb[_0x8522('0x28')][_0x8522('0x5e')]=_0x155d2d;return _0x1be2bb;})[_0x8522('0x20')](function(_0x42239e){if(_0x42239e){if(_0x285280[_0x8522('0x55')]['manual']){_0x1be2bb['message'][_0x8522('0x72')]=util[_0x8522('0x5b')](_0x8522('0x73'),_0x285280['user'][_0x8522('0x36')]);_0x1be2bb['message'][_0x8522('0x74')]=_0x1be2bb[_0x8522('0x74')];_0x1be2bb['message'][_0x8522('0x75')]=_0x8522('0x57');return respondWithRpcPromise(_0x8522('0x76'),_0x8522('0x76'),{'event':_0x8522('0x77'),'message':_0x1be2bb[_0x8522('0x28')]},client9002)['then'](function(){return _0x1be2bb;});}return _0x1be2bb;}return null;})[_0x8522('0x20')](respondWithResult(_0x80e04b,null))[_0x8522('0x50')](handleError(_0x80e04b,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0x8522('0x33')]=function(_0x2e2277,_0x1f61ce,_0x587eb9){var _0x405961={'agent':{},'channel':_0x8522('0x58')};if(_0x2e2277['body']['id']){delete _0x2e2277['body']['id'];}_0x2e2277[_0x8522('0x55')]['UserId']=_0x2e2277['body']['UserId']||_0x2e2277['user']['id'];_0x405961['agent']['id']=_0x2e2277[_0x8522('0x55')][_0x8522('0x5c')];return db[_0x8522('0x53')][_0x8522('0x54')]({'where':{'id':_0x2e2277['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1f61ce,null))[_0x8522('0x20')](function(_0xeb756){if(_0xeb756){_0x405961[_0x8522('0x28')]=_0xeb756[_0x8522('0x5f')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0xeb756[_0x8522('0x78')]}});}return null;})[_0x8522('0x20')](handleEntityNotFound(_0x1f61ce,null))['then'](function(_0x54b987){if(_0x54b987){_0x405961[_0x8522('0x64')]=_0x54b987[_0x8522('0x5f')]({'plain':!![]});interaction_log[_0x8522('0x21')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2e2277['user']['id'],_0x2e2277[_0x8522('0x5d')][_0x8522('0x36')],_0x2e2277['user']['role'],_0x405961[_0x8522('0x64')]['id'],_0x2e2277[_0x8522('0x55')]?JSON[_0x8522('0x65')](_0x2e2277[_0x8522('0x55')]):_0x8522('0x66'));return respondWithRpcPromise(_0x8522('0x79'),_0x8522('0x7a'),_0x405961);}return null;})[_0x8522('0x20')](function(_0x5402fe){var _0x3bc34a=_0x8522('0x69')+_0x5402fe[_0x8522('0x28')][_0x8522('0x6a')];return db[_0x8522('0x6b')]['query'](_0x3bc34a,{'type':db['Sequelize'][_0x8522('0x6c')][_0x8522('0x6d')],'raw':!![]})[_0x8522('0x20')](function(_0x5c6cc9){return _0x5c6cc9;});})[_0x8522('0x20')](function(_0x2fecb6){if(_0x2fecb6){_0x405961['message'][_0x8522('0x6e')]=_0x2fecb6[0x0];if(!_0x2e2277[_0x8522('0x55')][_0x8522('0x5c')])return;return db[_0x8522('0x6f')][_0x8522('0x54')]({'where':{'id':_0x2e2277[_0x8522('0x55')][_0x8522('0x5c')],'role':_0x8522('0x5e')},'attributes':['id',_0x8522('0x36'),_0x8522('0x7b'),_0x8522('0x70'),_0x8522('0x71')],'raw':!![]});}return null;})['then'](function(_0x424ea0){if(!_0x424ea0)return null;_0x405961[_0x8522('0x28')]['agent']=_0x424ea0;return _0x405961;})[_0x8522('0x20')](function(_0x589ddc){if(_0x589ddc){_0x589ddc[_0x8522('0x28')]['interface']=util[_0x8522('0x5b')](_0x8522('0x73'),_0x2e2277[_0x8522('0x5d')][_0x8522('0x36')]);_0x589ddc[_0x8522('0x28')]['channel']=_0x405961[_0x8522('0x74')];_0x589ddc[_0x8522('0x28')][_0x8522('0x75')]=_0x8522('0x33');respondWithRpcPromise(_0x8522('0x76'),_0x8522('0x76'),{'event':_0x8522('0x7c'),'message':_0x589ddc[_0x8522('0x28')]},client9002);return _0x405961;}return null;})['then'](respondWithResult(_0x1f61ce,null))[_0x8522('0x50')](handleError(_0x1f61ce,null));};exports[_0x8522('0x2b')]=function(_0x319ef4,_0x3772e3,_0x24b460){if(_0x319ef4[_0x8522('0x55')]['id']){delete _0x319ef4['body']['id'];}var _0x4b6e62;return db['WhatsappMessage'][_0x8522('0x54')]({'where':{'id':_0x319ef4[_0x8522('0x52')]['id']}})['then'](handleEntityNotFound(_0x3772e3,null))[_0x8522('0x20')](function(_0x490fd9){if(_0x490fd9){_0x4b6e62=_0x490fd9;return db[_0x8522('0x7d')][_0x8522('0x54')]({'where':{'id':_0x490fd9[_0x8522('0x7e')]}});}})['then'](handleEntityNotFound(_0x3772e3,null))[_0x8522('0x20')](function(_0x556c78){if(_0x556c78){logger['debug']('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x8522('0x2b'),'received\x20delivery\x20report\x20from',_0x556c78[_0x8522('0x3c')],util[_0x8522('0x7f')](_0x319ef4['body'],{'showHidden':![],'depth':null}));switch(_0x556c78[_0x8522('0x3c')]){case _0x8522('0x80'):if(_0x319ef4[_0x8522('0x55')][_0x8522('0x81')]&&_0x319ef4[_0x8522('0x55')][_0x8522('0x81')]===_0x4b6e62[_0x8522('0x82')]&&_0x319ef4['body'][_0x8522('0x83')]&&_0x319ef4[_0x8522('0x55')][_0x8522('0x83')]===_0x8522('0x59')){return _0x4b6e62['update']({'read':!![]});}else{logger[_0x8522('0x26')](_0x8522('0x84'),'status',_0x8522('0x80'),util[_0x8522('0x7f')](_0x319ef4[_0x8522('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x4b6e62;}})[_0x8522('0x20')](respondWithResult(_0x3772e3,null))['catch'](handleError(_0x3772e3,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 259339d..39e4847 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 _0x4bde=['hook','events','../../mysqldb','WhatsappMessage','save','update','remove','emit','hasOwnProperty'];(function(_0xe0dbd1,_0x324c2b){var _0x58338e=function(_0x90a4bd){while(--_0x90a4bd){_0xe0dbd1['push'](_0xe0dbd1['shift']());}};_0x58338e(++_0x324c2b);}(_0x4bde,0x1b1));var _0xe4bd=function(_0x496e9e,_0x5396df){_0x496e9e=_0x496e9e-0x0;var _0x49b0d9=_0x4bde[_0x496e9e];return _0x49b0d9;};'use strict';var EventEmitter=require(_0xe4bd('0x0'));var WhatsappMessage=require(_0xe4bd('0x1'))['db'][_0xe4bd('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe4bd('0x3'),'afterUpdate':_0xe4bd('0x4'),'afterDestroy':_0xe4bd('0x5')};function emitEvent(_0x3108bd){return function(_0x5741e5,_0x210d47,_0x1b8621){WhatsappMessageEvents[_0xe4bd('0x6')](_0x3108bd+':'+_0x5741e5['id'],_0x5741e5);WhatsappMessageEvents[_0xe4bd('0x6')](_0x3108bd,_0x5741e5);_0x1b8621(null);};}for(var e in events){if(events[_0xe4bd('0x7')](e)){var event=events[e];WhatsappMessage[_0xe4bd('0x8')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x57f8=['emit','hook','exports','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove'];(function(_0xc1f96a,_0x2424e8){var _0x401785=function(_0x5a31fc){while(--_0x5a31fc){_0xc1f96a['push'](_0xc1f96a['shift']());}};_0x401785(++_0x2424e8);}(_0x57f8,0x198));var _0x857f=function(_0x11a84d,_0x4dbd0e){_0x11a84d=_0x11a84d-0x0;var _0x1e6b48=_0x57f8[_0x11a84d];return _0x1e6b48;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x857f('0x0'))['db'][_0x857f('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x857f('0x2')](0x0);var events={'afterCreate':_0x857f('0x3'),'afterUpdate':_0x857f('0x4'),'afterDestroy':_0x857f('0x5')};function emitEvent(_0x2ff336){return function(_0x6f054b,_0x318050,_0xced48e){WhatsappMessageEvents[_0x857f('0x6')](_0x2ff336+':'+_0x6f054b['id'],_0x6f054b);WhatsappMessageEvents[_0x857f('0x6')](_0x2ff336,_0x6f054b);_0xced48e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x857f('0x7')](e,emitEvent(event));}}module[_0x857f('0x8')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 0614ce8..422c261 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 _0xc3fa=['accountSid','authToken','phone','messages','create','whatsapp:','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteractionId','then','update','createdAt','catch','error','WhatsappAccount','find','type','twilio'];(function(_0x3eaaa8,_0x449a5c){var _0x3bbd04=function(_0xa49792){while(--_0xa49792){_0x3eaaa8['push'](_0x3eaaa8['shift']());}};_0x3bbd04(++_0x449a5c);}(_0xc3fa,0x9f));var _0xac3f=function(_0x41cfd4,_0x1ed2cc){_0x41cfd4=_0x41cfd4-0x0;var _0x190f48=_0xc3fa[_0x41cfd4];return _0x190f48;};'use strict';var _=require(_0xac3f('0x0'));var util=require(_0xac3f('0x1'));var logger=require(_0xac3f('0x2'))(_0xac3f('0x3'));var moment=require('moment');var BPromise=require(_0xac3f('0x4'));var rp=require(_0xac3f('0x5'));var fs=require('fs');var path=require(_0xac3f('0x6'));var rimraf=require(_0xac3f('0x7'));var config=require('../../config/environment');var attributes=require(_0xac3f('0x8'));module[_0xac3f('0x9')]=function(_0x5b9d32,_0x201162){return _0x5b9d32[_0xac3f('0xa')]('WhatsappMessage',attributes,{'tableName':_0xac3f('0xb'),'paranoid':![],'indexes':[{'name':_0xac3f('0xc'),'fields':[_0xac3f('0xc')]},{'name':_0xac3f('0xd'),'fields':['body'],'type':_0xac3f('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x14f555,_0x58f4f8,_0xbb93ab){var _0x4039ab=_0x5b9d32[_0xac3f('0xf')];var _0x4ec740=_0x14f555[_0xac3f('0x10')]({'plain':!![]});if(_0x4ec740[_0xac3f('0x11')][_0xac3f('0x12')]()==='in'||_0x4ec740[_0xac3f('0x11')]['toLowerCase']()===_0xac3f('0x13')&&!_0x4ec740[_0xac3f('0x14')]&&!_[_0xac3f('0x15')](_0x4ec740[_0xac3f('0x16')])){_0x4039ab['WhatsappInteraction']['findOne']({'where':{'id':_0x4ec740[_0xac3f('0x17')]}})[_0xac3f('0x18')](function(_0xe1ac45){if(_0xe1ac45){_0xe1ac45[_0xac3f('0x19')]({'lastMsgAt':_0x4ec740[_0xac3f('0x1a')],'lastMsgDirection':_0x4ec740[_0xac3f('0x11')][_0xac3f('0x12')]()});}})[_0xac3f('0x1b')](function(_0x37acb8){console[_0xac3f('0x1c')](_0x37acb8);});}if(_0x4ec740[_0xac3f('0x11')]===_0xac3f('0x13')&&!_0x4ec740[_0xac3f('0x14')]){var _0x4a37a2;_0x4039ab[_0xac3f('0x1d')][_0xac3f('0x1e')]({'where':{'id':_0x4ec740['WhatsappAccountId']},'raw':!![]})[_0xac3f('0x18')](function(_0x458cc1){_0x4a37a2=_0x458cc1;if(_0x4a37a2&&_0x4a37a2[_0xac3f('0x1f')]){switch(_0x4a37a2[_0xac3f('0x1f')]){case _0xac3f('0x20'):var _0x368905=require('twilio');if(_0x4a37a2[_0xac3f('0x21')]&&_0x4a37a2[_0xac3f('0x22')]&&_0x4a37a2[_0xac3f('0x23')]){var _0x284e73=new _0x368905(_0x4a37a2[_0xac3f('0x21')],_0x4a37a2[_0xac3f('0x22')]);_0x284e73[_0xac3f('0x24')][_0xac3f('0x25')]({'body':_0x4ec740['body'],'to':_0xac3f('0x26')+_0x4ec740['phone'],'from':_0xac3f('0x26')+_0x4a37a2['phone'],'statusCallback':_0x4a37a2['remote']+_0xac3f('0x27')+_0x4ec740['id']+_0xac3f('0x28')+_0x4a37a2[_0xac3f('0x29')]})[_0xac3f('0x18')](function(_0x144c36){if(_0x144c36[_0xac3f('0x2a')]){return _0x14f555[_0xac3f('0x19')]({'messageId':_0x144c36['sid']});}})['catch'](function(_0x101c76){logger[_0xac3f('0x1c')](_0xac3f('0x2b'),_0xac3f('0x2c'),'twilio',util[_0xac3f('0x2d')](_0x101c76,{'showHidden':![],'depth':null}));});}else{logger[_0xac3f('0x1c')](_0xac3f('0x2b'),'afterCreate',_0xac3f('0x20'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})['finally'](function(){_0xbb93ab();});}else{_0xbb93ab();}}},'charset':_0xac3f('0x2e'),'collate':_0xac3f('0x2f')});}; \ No newline at end of file +var _0xca04=['WhatsappMessage,\x20%s,\x20%s,\x20%s','twilio','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','lodash','util','../../config/logger','api','moment','bluebird','rimraf','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','update','WhatsappAccount','find','WhatsappAccountId','then','type','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','token','sid','catch','error'];(function(_0x210027,_0x3a533a){var _0x46da16=function(_0x424c53){while(--_0x424c53){_0x210027['push'](_0x210027['shift']());}};_0x46da16(++_0x3a533a);}(_0xca04,0x99));var _0x4ca0=function(_0x411478,_0x57db63){_0x411478=_0x411478-0x0;var _0x5ab0d2=_0xca04[_0x411478];return _0x5ab0d2;};'use strict';var _=require(_0x4ca0('0x0'));var util=require(_0x4ca0('0x1'));var logger=require(_0x4ca0('0x2'))(_0x4ca0('0x3'));var moment=require(_0x4ca0('0x4'));var BPromise=require(_0x4ca0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ca0('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module[_0x4ca0('0x7')]=function(_0xe951c2,_0x10083f){return _0xe951c2[_0x4ca0('0x8')](_0x4ca0('0x9'),attributes,{'tableName':_0x4ca0('0xa'),'paranoid':![],'indexes':[{'name':_0x4ca0('0xb'),'fields':[_0x4ca0('0xb')]},{'name':_0x4ca0('0xc'),'fields':[_0x4ca0('0xd')],'type':_0x4ca0('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xdd4725,_0x5dd9e2,_0x3ad530){var _0x3d90a5=_0xe951c2[_0x4ca0('0xf')];var _0x2c9114=_0xdd4725[_0x4ca0('0x10')]({'plain':!![]});if(_0x2c9114[_0x4ca0('0x11')][_0x4ca0('0x12')]()==='in'||_0x2c9114['direction'][_0x4ca0('0x12')]()===_0x4ca0('0x13')&&!_0x2c9114[_0x4ca0('0x14')]&&!_['isNil'](_0x2c9114[_0x4ca0('0x15')])){_0x3d90a5[_0x4ca0('0x16')][_0x4ca0('0x17')]({'where':{'id':_0x2c9114[_0x4ca0('0x18')]}})['then'](function(_0x5439fd){if(_0x5439fd){_0x5439fd[_0x4ca0('0x19')]({'lastMsgAt':_0x2c9114['createdAt'],'lastMsgDirection':_0x2c9114[_0x4ca0('0x11')][_0x4ca0('0x12')]()});}})['catch'](function(_0x66b944){console['error'](_0x66b944);});}if(_0x2c9114[_0x4ca0('0x11')]===_0x4ca0('0x13')&&!_0x2c9114[_0x4ca0('0x14')]){var _0x9d420d;_0x3d90a5[_0x4ca0('0x1a')][_0x4ca0('0x1b')]({'where':{'id':_0x2c9114[_0x4ca0('0x1c')]},'raw':!![]})[_0x4ca0('0x1d')](function(_0x59074c){_0x9d420d=_0x59074c;if(_0x9d420d&&_0x9d420d[_0x4ca0('0x1e')]){switch(_0x9d420d[_0x4ca0('0x1e')]){case'twilio':var _0x406d25=require('twilio');if(_0x9d420d[_0x4ca0('0x1f')]&&_0x9d420d[_0x4ca0('0x20')]&&_0x9d420d[_0x4ca0('0x21')]){var _0x5c20a1=new _0x406d25(_0x9d420d['accountSid'],_0x9d420d[_0x4ca0('0x20')]);_0x5c20a1[_0x4ca0('0x22')][_0x4ca0('0x23')]({'body':_0x2c9114[_0x4ca0('0xd')],'to':_0x4ca0('0x24')+_0x2c9114['phone'],'from':_0x4ca0('0x24')+_0x9d420d[_0x4ca0('0x21')],'statusCallback':_0x9d420d[_0x4ca0('0x25')]+_0x4ca0('0x26')+_0x2c9114['id']+'/status?token='+_0x9d420d[_0x4ca0('0x27')]})[_0x4ca0('0x1d')](function(_0x59b92d){if(_0x59b92d[_0x4ca0('0x28')]){return _0xdd4725[_0x4ca0('0x19')]({'messageId':_0x59b92d[_0x4ca0('0x28')]});}})[_0x4ca0('0x29')](function(_0x129e23){logger[_0x4ca0('0x2a')](_0x4ca0('0x2b'),'afterCreate',_0x4ca0('0x2c'),util[_0x4ca0('0x2d')](_0x129e23,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x4ca0('0x2b'),_0x4ca0('0x2e'),_0x4ca0('0x2c'),_0x4ca0('0x2f'));}break;}}})[_0x4ca0('0x30')](function(){_0x3ad530();});}else{_0x3ad530();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index fdc567c..7bfc5e3 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 _0xff40=['result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappMessage.socket','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x4026d1,_0x53f826){var _0x4f978e=function(_0x1dd9f){while(--_0x1dd9f){_0x4026d1['push'](_0x4026d1['shift']());}};_0x4f978e(++_0x53f826);}(_0xff40,0x1e8));var _0x0ff4=function(_0x3d4876,_0x366386){_0x3d4876=_0x3d4876-0x0;var _0x58ca9d=_0xff40[_0x3d4876];return _0x58ca9d;};'use strict';var _=require(_0x0ff4('0x0'));var util=require(_0x0ff4('0x1'));var moment=require(_0x0ff4('0x2'));var BPromise=require(_0x0ff4('0x3'));var rs=require(_0x0ff4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0ff4('0x5'))('rpc');var config=require(_0x0ff4('0x6'));var jayson=require(_0x0ff4('0x7'));var client=jayson[_0x0ff4('0x8')][_0x0ff4('0x9')]({'port':0x232a});config[_0x0ff4('0xa')]=_[_0x0ff4('0xb')](config[_0x0ff4('0xa')],{'host':_0x0ff4('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0ff4('0xd'))['register'](socket);function respondWithRpcPromise(_0x21b21e,_0x529046,_0x518a5e){return new BPromise(function(_0x14eda1,_0x3ab849){return client[_0x0ff4('0xe')](_0x21b21e,_0x518a5e)[_0x0ff4('0xf')](function(_0x51edc9){logger['info'](_0x0ff4('0x10'),_0x529046,_0x0ff4('0x11'));logger[_0x0ff4('0x12')](_0x0ff4('0x13'),_0x529046,'request\x20sent',JSON[_0x0ff4('0x14')](_0x51edc9));if(_0x51edc9[_0x0ff4('0x15')]){if(_0x51edc9[_0x0ff4('0x15')]['code']===0x1f4){logger[_0x0ff4('0x15')](_0x0ff4('0x10'),_0x529046,_0x51edc9[_0x0ff4('0x15')][_0x0ff4('0x16')]);return _0x3ab849(_0x51edc9[_0x0ff4('0x15')][_0x0ff4('0x16')]);}logger[_0x0ff4('0x15')](_0x0ff4('0x10'),_0x529046,_0x51edc9['error'][_0x0ff4('0x16')]);return _0x14eda1(_0x51edc9[_0x0ff4('0x15')][_0x0ff4('0x16')]);}else{logger[_0x0ff4('0x17')](_0x0ff4('0x10'),_0x529046,_0x0ff4('0x11'));_0x14eda1(_0x51edc9[_0x0ff4('0x18')][_0x0ff4('0x16')]);}})[_0x0ff4('0x19')](function(_0x591f83){logger[_0x0ff4('0x15')](_0x0ff4('0x10'),_0x529046,_0x591f83);_0x3ab849(_0x591f83);});});}exports[_0x0ff4('0x1a')]=function(_0x3ea75c){var _0xae23e2=this;return new Promise(function(_0x3a1523,_0x4f6bfb){return db[_0x0ff4('0x1b')][_0x0ff4('0x1c')](_0x3ea75c[_0x0ff4('0x1d')],{'raw':_0x3ea75c[_0x0ff4('0x1e')]?_0x3ea75c[_0x0ff4('0x1e')][_0x0ff4('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x364661){logger['info'](_0x0ff4('0x1a'),_0x3ea75c);logger[_0x0ff4('0x12')](_0x0ff4('0x1a'),_0x3ea75c,JSON[_0x0ff4('0x14')](_0x364661));_0x3a1523(_0x364661);})[_0x0ff4('0x19')](function(_0x3f2281){logger[_0x0ff4('0x15')](_0x0ff4('0x1a'),_0x3f2281[_0x0ff4('0x16')],_0x3ea75c);_0x4f6bfb(_0xae23e2[_0x0ff4('0x15')](0x1f4,_0x3f2281['message']));});});}; \ No newline at end of file +var _0xccf7=['../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./whatsappMessage.socket','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateWhatsappMessage','create','body','options','debug','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xccf7,0x180));var _0x7ccf=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0xccf7[_0x40a825];return _0x273a54;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7ccf('0x0'));var BPromise=require(_0x7ccf('0x1'));var rs=require(_0x7ccf('0x2'));var fs=require('fs');var Redis=require(_0x7ccf('0x3'));var db=require(_0x7ccf('0x4'))['db'];var utils=require(_0x7ccf('0x5'));var logger=require(_0x7ccf('0x6'))(_0x7ccf('0x7'));var config=require(_0x7ccf('0x8'));var jayson=require(_0x7ccf('0x9'));var client=jayson[_0x7ccf('0xa')]['http']({'port':0x232a});config[_0x7ccf('0xb')]=_[_0x7ccf('0xc')](config[_0x7ccf('0xb')],{'host':_0x7ccf('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7ccf('0xb')]));require(_0x7ccf('0xe'))['register'](socket);function respondWithRpcPromise(_0x26b256,_0x57fddc,_0x59077e){return new BPromise(function(_0x491d26,_0x2c646){return client['request'](_0x26b256,_0x59077e)[_0x7ccf('0xf')](function(_0x1a25d5){logger[_0x7ccf('0x10')](_0x7ccf('0x11'),_0x57fddc,_0x7ccf('0x12'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x57fddc,'request\x20sent',JSON[_0x7ccf('0x13')](_0x1a25d5));if(_0x1a25d5['error']){if(_0x1a25d5[_0x7ccf('0x14')][_0x7ccf('0x15')]===0x1f4){logger[_0x7ccf('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x57fddc,_0x1a25d5[_0x7ccf('0x14')]['message']);return _0x2c646(_0x1a25d5[_0x7ccf('0x14')]['message']);}logger[_0x7ccf('0x14')](_0x7ccf('0x11'),_0x57fddc,_0x1a25d5[_0x7ccf('0x14')][_0x7ccf('0x16')]);return _0x491d26(_0x1a25d5[_0x7ccf('0x14')][_0x7ccf('0x16')]);}else{logger[_0x7ccf('0x10')](_0x7ccf('0x11'),_0x57fddc,_0x7ccf('0x12'));_0x491d26(_0x1a25d5[_0x7ccf('0x17')][_0x7ccf('0x16')]);}})[_0x7ccf('0x18')](function(_0x27982e){logger[_0x7ccf('0x14')](_0x7ccf('0x11'),_0x57fddc,_0x27982e);_0x2c646(_0x27982e);});});}exports[_0x7ccf('0x19')]=function(_0x5958aa){var _0x25cf1c=this;return new Promise(function(_0x89ed66,_0x39fd81){return db['WhatsappMessage'][_0x7ccf('0x1a')](_0x5958aa[_0x7ccf('0x1b')],{'raw':_0x5958aa[_0x7ccf('0x1c')]?_0x5958aa['options']['raw']===undefined?!![]:![]:!![]})[_0x7ccf('0xf')](function(_0x852d2d){logger['info'](_0x7ccf('0x19'),_0x5958aa);logger[_0x7ccf('0x1d')]('CreateWhatsappMessage',_0x5958aa,JSON['stringify'](_0x852d2d));_0x89ed66(_0x852d2d);})['catch'](function(_0x4da652){logger[_0x7ccf('0x14')]('CreateWhatsappMessage',_0x4da652[_0x7ccf('0x16')],_0x5958aa);_0x39fd81(_0x25cf1c['error'](0x1f4,_0x4da652[_0x7ccf('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 4f94327..0777274 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 _0x356c=['whatsappMessage:','./whatsappMessage.events','save','remove','emit','removeListener','length'];(function(_0x3a0585,_0x12062b){var _0xbdc3fc=function(_0x38fba7){while(--_0x38fba7){_0x3a0585['push'](_0x3a0585['shift']());}};_0xbdc3fc(++_0x12062b);}(_0x356c,0x12e));var _0xc356=function(_0x325c3d,_0x115497){_0x325c3d=_0x325c3d-0x0;var _0x4b29a8=_0x356c[_0x325c3d];return _0x4b29a8;};'use strict';var WhatsappMessageEvents=require(_0xc356('0x0'));var events=[_0xc356('0x1'),_0xc356('0x2'),'update'];function createListener(_0x5c00f1,_0x587857){return function(_0x4744fc){_0x587857[_0xc356('0x3')](_0x5c00f1,_0x4744fc);};}function removeListener(_0x14a085,_0x112038){return function(){WhatsappMessageEvents[_0xc356('0x4')](_0x14a085,_0x112038);};}exports['register']=function(_0x1bcc75){for(var _0xb39de2=0x0,_0x5ab4c2=events[_0xc356('0x5')];_0xb39de2<_0x5ab4c2;_0xb39de2++){var _0x5771f4=events[_0xb39de2];var _0x39c802=createListener(_0xc356('0x6')+_0x5771f4,_0x1bcc75);WhatsappMessageEvents['on'](_0x5771f4,_0x39c802);}}; \ No newline at end of file +var _0xec18=['emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save','remove','update'];(function(_0x15079a,_0xc12b1a){var _0x1daf40=function(_0x247889){while(--_0x247889){_0x15079a['push'](_0x15079a['shift']());}};_0x1daf40(++_0xc12b1a);}(_0xec18,0x12e));var _0x8ec1=function(_0x384fa7,_0x359d36){_0x384fa7=_0x384fa7-0x0;var _0x3fbd13=_0xec18[_0x384fa7];return _0x3fbd13;};'use strict';var WhatsappMessageEvents=require(_0x8ec1('0x0'));var events=[_0x8ec1('0x1'),_0x8ec1('0x2'),_0x8ec1('0x3')];function createListener(_0x3bfb2c,_0x34efbb){return function(_0x171f5b){_0x34efbb[_0x8ec1('0x4')](_0x3bfb2c,_0x171f5b);};}function removeListener(_0x24250e,_0x3e797e){return function(){WhatsappMessageEvents[_0x8ec1('0x5')](_0x24250e,_0x3e797e);};}exports[_0x8ec1('0x6')]=function(_0x14f114){for(var _0x2c984d=0x0,_0x4e7363=events[_0x8ec1('0x7')];_0x2c984d<_0x4e7363;_0x2c984d++){var _0xd3a2bd=events[_0x2c984d];var _0x362cae=createListener(_0x8ec1('0x8')+_0xd3a2bd,_0x14f114);WhatsappMessageEvents['on'](_0xd3a2bd,_0x362cae);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index ab17b39..7af4240 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 _0x5fa1=['destroy','removeAgents','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','put','update','delete'];(function(_0x5aac9e,_0xef5692){var _0x31e5ae=function(_0x511320){while(--_0x511320){_0x5aac9e['push'](_0x5aac9e['shift']());}};_0x31e5ae(++_0xef5692);}(_0x5fa1,0xd2));var _0x15fa=function(_0x382b85,_0xd06d63){_0x382b85=_0x382b85-0x0;var _0x159644=_0x5fa1[_0x382b85];return _0x159644;};'use strict';var multer=require(_0x15fa('0x0'));var util=require(_0x15fa('0x1'));var path=require('path');var timeout=require(_0x15fa('0x2'));var express=require('express');var router=express[_0x15fa('0x3')]();var fs_extra=require(_0x15fa('0x4'));var auth=require(_0x15fa('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x15fa('0x6'));router[_0x15fa('0x7')]('/',auth[_0x15fa('0x8')](),controller[_0x15fa('0x9')]);router['get'](_0x15fa('0xa'),auth[_0x15fa('0x8')](),controller[_0x15fa('0xb')]);router['get'](_0x15fa('0xc'),auth[_0x15fa('0x8')](),controller['show']);router[_0x15fa('0x7')]('/:id/members',auth['isAuthenticated'](),controller[_0x15fa('0xd')]);router[_0x15fa('0x7')](_0x15fa('0xe'),auth[_0x15fa('0x8')](),controller[_0x15fa('0xf')]);router[_0x15fa('0x7')](_0x15fa('0x10'),auth['isAuthenticated'](),controller[_0x15fa('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x15fa('0x12')]);router[_0x15fa('0x13')](_0x15fa('0xe'),auth[_0x15fa('0x8')](),controller['addTeams']);router['post'](_0x15fa('0x10'),auth[_0x15fa('0x8')](),controller[_0x15fa('0x14')]);router[_0x15fa('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x15fa('0x16')]);router[_0x15fa('0x17')](_0x15fa('0xc'),auth['isAuthenticated'](),controller[_0x15fa('0x18')]);router['delete'](_0x15fa('0xe'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x15fa('0x17')](_0x15fa('0x10'),auth[_0x15fa('0x8')](),controller[_0x15fa('0x19')]);module['exports']=router; \ No newline at end of file +var _0xc762=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','/:id','update','destroy','delete','removeAgents','exports','multer','util','path','Router'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xc762,0x9e));var _0x2c76=function(_0x5c768b,_0x5e88a6){_0x5c768b=_0x5c768b-0x0;var _0x335af8=_0xc762[_0x5c768b];return _0x335af8;};'use strict';var multer=require(_0x2c76('0x0'));var util=require(_0x2c76('0x1'));var path=require(_0x2c76('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2c76('0x3')]();var fs_extra=require(_0x2c76('0x4'));var auth=require(_0x2c76('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2c76('0x6'));var controller=require('./whatsappQueue.controller');router[_0x2c76('0x7')]('/',auth[_0x2c76('0x8')](),controller[_0x2c76('0x9')]);router[_0x2c76('0x7')](_0x2c76('0xa'),auth['isAuthenticated'](),controller[_0x2c76('0xb')]);router[_0x2c76('0x7')]('/:id',auth[_0x2c76('0x8')](),controller[_0x2c76('0xc')]);router[_0x2c76('0x7')]('/:id/members',auth[_0x2c76('0x8')](),controller[_0x2c76('0xd')]);router[_0x2c76('0x7')]('/:id/teams',auth[_0x2c76('0x8')](),controller[_0x2c76('0xe')]);router[_0x2c76('0x7')](_0x2c76('0xf'),auth[_0x2c76('0x8')](),controller[_0x2c76('0x10')]);router[_0x2c76('0x11')]('/',auth[_0x2c76('0x8')](),controller[_0x2c76('0x12')]);router[_0x2c76('0x11')]('/:id/teams',auth[_0x2c76('0x8')](),controller[_0x2c76('0x13')]);router['post'](_0x2c76('0xf'),auth[_0x2c76('0x8')](),controller[_0x2c76('0x14')]);router['put'](_0x2c76('0x15'),auth[_0x2c76('0x8')](),controller[_0x2c76('0x16')]);router['delete'](_0x2c76('0x15'),auth[_0x2c76('0x8')](),controller[_0x2c76('0x17')]);router[_0x2c76('0x18')]('/:id/teams',auth[_0x2c76('0x8')](),controller['removeTeams']);router[_0x2c76('0x18')](_0x2c76('0xf'),auth['isAuthenticated'](),controller[_0x2c76('0x19')]);module[_0x2c76('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 6593537..d94d395 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 _0xc817=['name','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x5e3f0a,_0x539b4d){var _0x2b5920=function(_0xd4e919){while(--_0xd4e919){_0x5e3f0a['push'](_0x5e3f0a['shift']());}};_0x2b5920(++_0x539b4d);}(_0xc817,0x75));var _0x7c81=function(_0x1893bd,_0xe39df5){_0x1893bd=_0x1893bd-0x0;var _0x217dcf=_0xc817[_0x1893bd];return _0x217dcf;};'use strict';var Sequelize=require(_0x7c81('0x0'));module[_0x7c81('0x1')]={'name':{'type':Sequelize[_0x7c81('0x2')],'unique':_0x7c81('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7c81('0x4')](_0x7c81('0x5'),_0x7c81('0x6'),_0x7c81('0x7'))},'description':{'type':Sequelize[_0x7c81('0x2')]}}; \ No newline at end of file +var _0xadec=['sequelize','exports','STRING','name','INTEGER','roundrobin'];(function(_0x2cc711,_0x300328){var _0x31a52e=function(_0x588378){while(--_0x588378){_0x2cc711['push'](_0x2cc711['shift']());}};_0x31a52e(++_0x300328);}(_0xadec,0x156));var _0xcade=function(_0x104486,_0x3a3c7a){_0x104486=_0x104486-0x0;var _0xf0756=_0xadec[_0x104486];return _0xf0756;};'use strict';var Sequelize=require(_0xcade('0x0'));module[_0xcade('0x1')]={'name':{'type':Sequelize[_0xcade('0x2')],'unique':_0xcade('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xcade('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall',_0xcade('0x5'))},'description':{'type':Sequelize[_0xcade('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index e8a81d9..4d0db96 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 _0x05f5=['eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','order','sort','pick','filter','merge','where','includeAll','findAll','rows','show','keys','include','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','UserWhatsappQueue','hasOwnProperty','nolimit','WhatsappQueueId','findAndCountAll','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','findOne','Team','getTeams','addTeams','ids','User','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','field','from','team_has_whatsapp_queues','WhatsappQueueId\x20=\x20?','clone','push','toString','SELECT','every','includes','union','compact','value','removeTeams','isEmpty','userWhatsappQueue:remove','addAgents','omit','spread','userWhatsappQueue:save','removeAgents','isArray','getAgents'];(function(_0x765a4a,_0x207b49){var _0x442283=function(_0xcfebe){while(--_0xcfebe){_0x765a4a['push'](_0x765a4a['shift']());}};_0x442283(++_0x207b49);}(_0x05f5,0x8c));var _0x505f=function(_0x45c981,_0x2ad2d4){_0x45c981=_0x45c981-0x0;var _0x4f62c8=_0x05f5[_0x45c981];return _0x4f62c8;};'use strict';var emlformat=require(_0x505f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x505f('0x1'));var jsonpatch=require(_0x505f('0x2'));var rp=require(_0x505f('0x3'));var moment=require(_0x505f('0x4'));var BPromise=require(_0x505f('0x5'));var Mustache=require(_0x505f('0x6'));var util=require('util');var path=require('path');var sox=require(_0x505f('0x7'));var csv=require(_0x505f('0x8'));var ejs=require(_0x505f('0x9'));var fs=require('fs');var fs_extra=require(_0x505f('0xa'));var _=require(_0x505f('0xb'));var squel=require('squel');var crypto=require(_0x505f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x505f('0xd'));var toCsv=require(_0x505f('0x8'));var querystring=require(_0x505f('0xe'));var Papa=require(_0x505f('0xf'));var Redis=require(_0x505f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x505f('0x11'));var hardwareService=require(_0x505f('0x12'));var logger=require(_0x505f('0x13'))(_0x505f('0x14'));var utils=require(_0x505f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x505f('0x16'));var db=require(_0x505f('0x17'))['db'];config[_0x505f('0x18')]=_[_0x505f('0x19')](config[_0x505f('0x18')],{'host':_0x505f('0x1a'),'port':0x18eb});var socket=require(_0x505f('0x1b'))(new Redis(config[_0x505f('0x18')]));require(_0x505f('0x1c'))[_0x505f('0x1d')](socket);function respondWithStatusCode(_0x57a773,_0x10981e){_0x10981e=_0x10981e||0xcc;return function(_0xa28a9c){if(_0xa28a9c){return _0x57a773[_0x505f('0x1e')](_0x10981e);}return _0x57a773[_0x505f('0x1f')](_0x10981e)[_0x505f('0x20')]();};}function respondWithResult(_0x457625,_0x505f23){_0x505f23=_0x505f23||0xc8;return function(_0x5ab5d3){if(_0x5ab5d3){return _0x457625['status'](_0x505f23)[_0x505f('0x21')](_0x5ab5d3);}};}function respondWithFilteredResult(_0x3285bf,_0x4858f3){return function(_0x526751){if(_0x526751){var _0x1ff06f=typeof _0x4858f3[_0x505f('0x22')]===_0x505f('0x23')&&typeof _0x4858f3[_0x505f('0x24')]===_0x505f('0x23');var _0x4dfbb8=_0x526751[_0x505f('0x25')];var _0x49d4d6=_0x1ff06f?0x0:_0x4858f3[_0x505f('0x22')];var _0x2b99ed=_0x1ff06f?_0x526751[_0x505f('0x25')]:_0x4858f3[_0x505f('0x22')]+_0x4858f3['limit'];var _0x1900df;if(_0x2b99ed>=_0x4dfbb8){_0x2b99ed=_0x4dfbb8;_0x1900df=0xc8;}else{_0x1900df=0xce;}_0x3285bf[_0x505f('0x1f')](_0x1900df);return _0x3285bf[_0x505f('0x26')](_0x505f('0x27'),_0x49d4d6+'-'+_0x2b99ed+'/'+_0x4dfbb8)['json'](_0x526751);}return null;};}function patchUpdates(_0x62c184){return function(_0x1ad525){try{jsonpatch[_0x505f('0x28')](_0x1ad525,_0x62c184,!![]);}catch(_0xc1c628){return BPromise[_0x505f('0x29')](_0xc1c628);}return _0x1ad525['save']();};}function saveUpdates(_0x586856,_0x416e84){return function(_0x480fb1){if(_0x480fb1){return _0x480fb1[_0x505f('0x2a')](_0x586856)[_0x505f('0x2b')](function(_0x44dd65){return _0x44dd65;});}return null;};}function removeEntity(_0x5a3455,_0x558858){return function(_0x32a270){if(_0x32a270){return _0x32a270[_0x505f('0x2c')]()[_0x505f('0x2b')](function(){var _0x454f21=_0x32a270[_0x505f('0x2d')]({'plain':!![]});var _0x361210='WhatsappQueues';return db['UserProfileResource'][_0x505f('0x2c')]({'where':{'type':_0x361210,'resourceId':_0x454f21['id']}})[_0x505f('0x2b')](function(){return _0x32a270;});})[_0x505f('0x2b')](function(){_0x5a3455['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa79180,_0x45b334){return function(_0x3b2862){if(!_0x3b2862){_0xa79180['sendStatus'](0x194);}return _0x3b2862;};}function handleError(_0x5b36b8,_0xb1a4c9){_0xb1a4c9=_0xb1a4c9||0x1f4;return function(_0x5259e8){logger[_0x505f('0x2e')](_0x5259e8[_0x505f('0x2f')]);if(_0x5259e8[_0x505f('0x30')]){delete _0x5259e8['name'];}_0x5b36b8[_0x505f('0x1f')](_0xb1a4c9)[_0x505f('0x31')](_0x5259e8);};}exports[_0x505f('0x32')]=function(_0x1d64a8,_0xb65d0f){var _0x1617e3={},_0x5d7bca={},_0x2a2be1={'count':0x0,'rows':[]};var _0x1e3dcd=_[_0x505f('0x33')](db[_0x505f('0x34')][_0x505f('0x35')],function(_0x1a46a9){return{'name':_0x1a46a9[_0x505f('0x36')],'type':_0x1a46a9[_0x505f('0x37')][_0x505f('0x38')]};});_0x5d7bca[_0x505f('0x39')]=_[_0x505f('0x33')](_0x1e3dcd,_0x505f('0x30'));_0x5d7bca[_0x505f('0x3a')]=_['keys'](_0x1d64a8['query']);_0x5d7bca[_0x505f('0x3b')]=_[_0x505f('0x3c')](_0x5d7bca[_0x505f('0x39')],_0x5d7bca[_0x505f('0x3a')]);_0x1617e3['attributes']=_[_0x505f('0x3c')](_0x5d7bca['model'],qs['fields'](_0x1d64a8['query'][_0x505f('0x3d')]));_0x1617e3[_0x505f('0x3e')]=_0x1617e3[_0x505f('0x3e')][_0x505f('0x3f')]?_0x1617e3[_0x505f('0x3e')]:_0x5d7bca[_0x505f('0x39')];if(!_0x1d64a8[_0x505f('0x3a')]['hasOwnProperty']('nolimit')){_0x1617e3[_0x505f('0x24')]=qs[_0x505f('0x24')](_0x1d64a8[_0x505f('0x3a')][_0x505f('0x24')]);_0x1617e3[_0x505f('0x22')]=qs[_0x505f('0x22')](_0x1d64a8[_0x505f('0x3a')][_0x505f('0x22')]);}_0x1617e3[_0x505f('0x40')]=qs[_0x505f('0x41')](_0x1d64a8[_0x505f('0x3a')]['sort']);_0x1617e3['where']=qs['filters'](_[_0x505f('0x42')](_0x1d64a8[_0x505f('0x3a')],_0x5d7bca[_0x505f('0x3b')]),_0x1e3dcd);if(_0x1d64a8[_0x505f('0x3a')][_0x505f('0x43')]){_0x1617e3['where']=_[_0x505f('0x44')](_0x1617e3[_0x505f('0x45')],{'$or':_[_0x505f('0x33')](_0x1e3dcd,function(_0x513908){if(_0x513908['type']!=='VIRTUAL'){var _0x276b16={};_0x276b16[_0x513908[_0x505f('0x30')]]={'$like':'%'+_0x1d64a8['query'][_0x505f('0x43')]+'%'};return _0x276b16;}})});}_0x1617e3=_['merge']({},_0x1617e3,_0x1d64a8['options']);var _0x270fec={'where':_0x1617e3[_0x505f('0x45')]};return db[_0x505f('0x34')][_0x505f('0x25')](_0x270fec)['then'](function(_0x4feb44){_0x2a2be1['count']=_0x4feb44;if(_0x1d64a8['query'][_0x505f('0x46')]){_0x1617e3['include']=[{'all':!![]}];}return db[_0x505f('0x34')][_0x505f('0x47')](_0x1617e3);})['then'](function(_0x1cc5b0){_0x2a2be1[_0x505f('0x48')]=_0x1cc5b0;return _0x2a2be1;})[_0x505f('0x2b')](respondWithFilteredResult(_0xb65d0f,_0x1617e3))['catch'](handleError(_0xb65d0f,null));};exports[_0x505f('0x49')]=function(_0xf9de77,_0x5e08a9){var _0x501b5e={'raw':!![],'where':{'id':_0xf9de77['params']['id']}},_0x10d741={};_0x10d741[_0x505f('0x39')]=_[_0x505f('0x4a')](db[_0x505f('0x34')]['rawAttributes']);_0x10d741[_0x505f('0x3a')]=_['keys'](_0xf9de77[_0x505f('0x3a')]);_0x10d741[_0x505f('0x3b')]=_[_0x505f('0x3c')](_0x10d741[_0x505f('0x39')],_0x10d741[_0x505f('0x3a')]);_0x501b5e[_0x505f('0x3e')]=_[_0x505f('0x3c')](_0x10d741[_0x505f('0x39')],qs[_0x505f('0x3d')](_0xf9de77[_0x505f('0x3a')]['fields']));_0x501b5e[_0x505f('0x3e')]=_0x501b5e[_0x505f('0x3e')][_0x505f('0x3f')]?_0x501b5e[_0x505f('0x3e')]:_0x10d741['model'];if(_0xf9de77[_0x505f('0x3a')][_0x505f('0x46')]){_0x501b5e[_0x505f('0x4b')]=[{'all':!![]}];}_0x501b5e=_[_0x505f('0x44')]({},_0x501b5e,_0xf9de77[_0x505f('0x4c')]);return db[_0x505f('0x34')][_0x505f('0x4d')](_0x501b5e)[_0x505f('0x2b')](handleEntityNotFound(_0x5e08a9,null))[_0x505f('0x2b')](respondWithResult(_0x5e08a9,null))[_0x505f('0x4e')](handleError(_0x5e08a9,null));};exports[_0x505f('0x4f')]=function(_0x462fc2,_0x5b53c3){return db[_0x505f('0x34')][_0x505f('0x4f')](_0x462fc2[_0x505f('0x50')],{})[_0x505f('0x2b')](function(_0x8bcf7b){var _0xa38ad7=_0x462fc2[_0x505f('0x51')][_0x505f('0x2d')]({'plain':!![]});if(!_0xa38ad7)throw new Error(_0x505f('0x52'));if(_0xa38ad7[_0x505f('0x53')]===_0x505f('0x51')){var _0x4b0ba5=_0x8bcf7b[_0x505f('0x2d')]({'plain':!![]});var _0x26de0a='WhatsappQueues';return db[_0x505f('0x54')][_0x505f('0x4d')]({'where':{'name':_0x26de0a,'userProfileId':_0xa38ad7['userProfileId']},'raw':!![]})[_0x505f('0x2b')](function(_0x1c5407){if(_0x1c5407&&_0x1c5407[_0x505f('0x55')]===0x0){return db['UserProfileResource'][_0x505f('0x4f')]({'name':_0x4b0ba5[_0x505f('0x30')],'resourceId':_0x4b0ba5['id'],'type':_0x1c5407[_0x505f('0x30')],'sectionId':_0x1c5407['id']},{})[_0x505f('0x2b')](function(){return _0x8bcf7b;});}else{return _0x8bcf7b;}})[_0x505f('0x4e')](function(_0x7cedda){logger[_0x505f('0x2e')](_0x505f('0x56'),_0x7cedda);throw _0x7cedda;});}return _0x8bcf7b;})[_0x505f('0x2b')](respondWithResult(_0x5b53c3,0xc9))['catch'](handleError(_0x5b53c3,null));};exports['update']=function(_0x5c49f5,_0x3d29fc){if(_0x5c49f5[_0x505f('0x50')]['id']){delete _0x5c49f5[_0x505f('0x50')]['id'];}return db[_0x505f('0x34')][_0x505f('0x4d')]({'where':{'id':_0x5c49f5[_0x505f('0x57')]['id']}})[_0x505f('0x2b')](handleEntityNotFound(_0x3d29fc,null))[_0x505f('0x2b')](saveUpdates(_0x5c49f5[_0x505f('0x50')],null))['then'](respondWithResult(_0x3d29fc,null))[_0x505f('0x4e')](handleError(_0x3d29fc,null));};exports['destroy']=function(_0x4414b6,_0x1cede5){return db[_0x505f('0x34')][_0x505f('0x4d')]({'where':{'id':_0x4414b6[_0x505f('0x57')]['id']}})['then'](handleEntityNotFound(_0x1cede5,null))[_0x505f('0x2b')](removeEntity(_0x1cede5,null))[_0x505f('0x4e')](handleError(_0x1cede5,null));};exports[_0x505f('0x58')]=function(_0x14fa2e,_0x4a2e5c){return db[_0x505f('0x34')][_0x505f('0x58')]()['then'](respondWithResult(_0x4a2e5c,null))[_0x505f('0x4e')](handleError(_0x4a2e5c,null));};exports['getMembers']=function(_0x2b53df,_0xf0dcb7,_0x5d14cc){var _0x429864={'raw':!![],'where':{}},_0x176fe6={},_0x1a51ae;return db[_0x505f('0x34')]['findOne']({'where':{'id':_0x2b53df[_0x505f('0x57')]['id']}})['then'](handleEntityNotFound(_0xf0dcb7,null))['then'](function(_0x24a93e){if(_0x24a93e){_0x1a51ae=_0x24a93e[_0x505f('0x2d')]({'plain':!![]});_0x176fe6[_0x505f('0x39')]=_['keys'](db[_0x505f('0x59')]['rawAttributes']);_0x176fe6['query']=_[_0x505f('0x4a')](_0x2b53df[_0x505f('0x3a')]);_0x176fe6[_0x505f('0x3b')]=_[_0x505f('0x3c')](_0x176fe6['model'],_0x176fe6[_0x505f('0x3a')]);_0x429864[_0x505f('0x3e')]=_[_0x505f('0x3c')](_0x176fe6[_0x505f('0x39')],qs[_0x505f('0x3d')](_0x2b53df['query']['fields']));_0x429864['attributes']=_0x429864[_0x505f('0x3e')][_0x505f('0x3f')]?_0x429864[_0x505f('0x3e')]:_0x176fe6[_0x505f('0x39')];if(!_0x2b53df[_0x505f('0x3a')][_0x505f('0x5a')](_0x505f('0x5b'))){_0x429864['limit']=qs[_0x505f('0x24')](_0x2b53df[_0x505f('0x3a')]['limit']);_0x429864['offset']=qs[_0x505f('0x22')](_0x2b53df[_0x505f('0x3a')][_0x505f('0x22')]);}_0x429864[_0x505f('0x40')]=qs[_0x505f('0x41')](_0x2b53df[_0x505f('0x3a')][_0x505f('0x41')]);_0x429864[_0x505f('0x45')]=qs[_0x505f('0x3b')](_[_0x505f('0x42')](_0x2b53df[_0x505f('0x3a')],_0x176fe6[_0x505f('0x3b')]));_0x429864[_0x505f('0x45')][_0x505f('0x5c')]=_0x24a93e['id'];if(_0x2b53df[_0x505f('0x3a')][_0x505f('0x43')]){_0x429864[_0x505f('0x45')]=_[_0x505f('0x44')](_0x429864[_0x505f('0x45')],{'$or':_[_0x505f('0x33')](_0x429864[_0x505f('0x3e')],function(_0x31b610){var _0x3adf19={};_0x3adf19[_0x31b610]={'$like':'%'+_0x2b53df['query']['filter']+'%'};return _0x3adf19;})});}_0x429864=_[_0x505f('0x44')]({},_0x429864,_0x2b53df[_0x505f('0x4c')]);return db[_0x505f('0x59')][_0x505f('0x47')](_0x429864);}})[_0x505f('0x2b')](function(_0x5517c1){if(_0x5517c1){return db['User'][_0x505f('0x5d')]({'where':{'id':_['map'](_0x5517c1,'UserId'),'role':_0x505f('0x5e')},'attributes':['id',_0x505f('0x30'),_0x505f('0x5f'),_0x505f('0x60'),_0x505f('0x61')]});}})[_0x505f('0x2b')](function(_0x4c1c54){if(_0x4c1c54){return{'count':_0x4c1c54[_0x505f('0x25')],'rows':_[_0x505f('0x33')](_0x4c1c54[_0x505f('0x48')],function(_0x33367b){return{'membername':_0x33367b[_0x505f('0x30')],'UserId':_0x33367b['id'],'queue_name':_0x1a51ae['name'],'WhatsappQueueId':_0x1a51ae['id'],'interface':util[_0x505f('0x62')](_0x505f('0x63'),_0x505f('0x64'),_0x33367b[_0x505f('0x30')]),'penalty':0x0,'paused':_0x33367b[_0x505f('0x5f')],'createdAt':_0x33367b['createdAt'],'updatedAt':_0x33367b['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x505f('0x2b')](respondWithFilteredResult(_0xf0dcb7,_0x429864))[_0x505f('0x4e')](handleError(_0xf0dcb7,null));};exports['getTeams']=function(_0x4b7bf8,_0x5f2d02,_0x1e8145){var _0x282910={};var _0x5277e4={};var _0x519ef7;var _0x90eed7;return db[_0x505f('0x34')][_0x505f('0x65')]({'where':{'id':_0x4b7bf8[_0x505f('0x57')]['id']}})['then'](handleEntityNotFound(_0x5f2d02,null))['then'](function(_0x1c9639){if(_0x1c9639){_0x519ef7=_0x1c9639;_0x5277e4['model']=_[_0x505f('0x4a')](db[_0x505f('0x66')]['rawAttributes']);_0x5277e4[_0x505f('0x3a')]=_[_0x505f('0x4a')](_0x4b7bf8[_0x505f('0x3a')]);_0x5277e4[_0x505f('0x3b')]=_[_0x505f('0x3c')](_0x5277e4['model'],_0x5277e4[_0x505f('0x3a')]);_0x282910[_0x505f('0x3e')]=_[_0x505f('0x3c')](_0x5277e4[_0x505f('0x39')],qs[_0x505f('0x3d')](_0x4b7bf8[_0x505f('0x3a')][_0x505f('0x3d')]));_0x282910[_0x505f('0x3e')]=_0x282910[_0x505f('0x3e')][_0x505f('0x3f')]?_0x282910[_0x505f('0x3e')]:_0x5277e4[_0x505f('0x39')];_0x282910['order']=qs['sort'](_0x4b7bf8[_0x505f('0x3a')][_0x505f('0x41')]);_0x282910['where']=qs[_0x505f('0x3b')](_[_0x505f('0x42')](_0x4b7bf8[_0x505f('0x3a')],_0x5277e4['filters']));if(_0x4b7bf8[_0x505f('0x3a')][_0x505f('0x43')]){_0x282910[_0x505f('0x45')]=_[_0x505f('0x44')](_0x282910[_0x505f('0x45')],{'$or':_[_0x505f('0x33')](_0x282910[_0x505f('0x3e')],function(_0x119d36){var _0x306ea1={};_0x306ea1[_0x119d36]={'$like':'%'+_0x4b7bf8[_0x505f('0x3a')][_0x505f('0x43')]+'%'};return _0x306ea1;})});}_0x282910=_[_0x505f('0x44')]({},_0x282910,_0x4b7bf8[_0x505f('0x4c')]);return _0x519ef7[_0x505f('0x67')](_0x282910);}})['then'](function(_0x56ecdb){if(_0x56ecdb){_0x90eed7=_0x56ecdb['length'];if(!_0x4b7bf8[_0x505f('0x3a')][_0x505f('0x5a')](_0x505f('0x5b'))){_0x282910[_0x505f('0x24')]=qs[_0x505f('0x24')](_0x4b7bf8['query'][_0x505f('0x24')]);_0x282910[_0x505f('0x22')]=qs[_0x505f('0x22')](_0x4b7bf8['query']['offset']);}return _0x519ef7['getTeams'](_0x282910);}})[_0x505f('0x2b')](function(_0x155baa){if(_0x155baa){return _0x155baa?{'count':_0x90eed7,'rows':_0x155baa}:null;}})[_0x505f('0x2b')](respondWithResult(_0x5f2d02,null))['catch'](handleError(_0x5f2d02,null));};exports[_0x505f('0x68')]=function(_0x9be1f5,_0x4c7582,_0x502ee9){var _0x27dac5=_0x9be1f5[_0x505f('0x50')][_0x505f('0x69')];return db[_0x505f('0x66')]['findAll']({'where':{'id':_0x27dac5},'attributes':['id'],'include':[{'model':db[_0x505f('0x6a')],'as':_0x505f('0x6b'),'attributes':['id',_0x505f('0x30'),_0x505f('0x6c'),_0x505f('0x6d'),_0x505f('0x6e')],'raw':!![]}]})[_0x505f('0x2b')](function(_0x19c85c){if(_0x19c85c){var _0x3ba9bc=_['flatMap'](_0x19c85c,function(_0x1c8512){var _0x4b319f=_0x1c8512['get']({'plain':!![]});return _0x4b319f[_0x505f('0x6b')];});return db[_0x505f('0x34')][_0x505f('0x4d')]({'where':{'id':_0x9be1f5[_0x505f('0x57')]['id']}})[_0x505f('0x2b')](function(_0x4d4df1){return db[_0x505f('0x6f')][_0x505f('0x70')](function(_0x5c1665){return _0x4d4df1[_0x505f('0x68')](_0x27dac5,{'transaction':_0x5c1665})[_0x505f('0x2b')](function(){return BPromise[_0x505f('0x71')](_0x3ba9bc,function(_0x44d503){return db[_0x505f('0x59')][_0x505f('0x72')]({'where':{'UserId':_0x44d503['id'],'WhatsappQueueId':_0x9be1f5['params']['id']},'transaction':_0x5c1665});});})['then'](function(){_0x3ba9bc[_0x505f('0x73')](function(_0x535eaf){socket[_0x505f('0x74')]('userWhatsappQueue:save',{'UserId':_0x535eaf['id'],'WhatsappQueueId':_0x4d4df1['id']});});});});});}})[_0x505f('0x2b')](respondWithStatusCode(_0x4c7582,null))[_0x505f('0x4e')](handleError(_0x4c7582,null));};exports['removeTeams']=function(_0x55d10c,_0x2fe8b2,_0x532d11){return db[_0x505f('0x66')][_0x505f('0x47')]({'where':{'id':_0x55d10c['query'][_0x505f('0x69')]},'attributes':['id'],'include':[{'model':db[_0x505f('0x6a')],'as':_0x505f('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x505f('0x2b')](handleEntityNotFound(_0x2fe8b2,null))[_0x505f('0x2b')](function(_0x7b0031){var _0x2bf94b=_[_0x505f('0x33')](_0x7b0031,'id');var _0x34fc98=[];var _0x267f53=[];var _0x4493ff=squel['select']();_0x4493ff[_0x505f('0x75')]('tq.TeamId')[_0x505f('0x76')](_0x505f('0x77'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x505f('0x45')](_0x505f('0x78'),_0x55d10c[_0x505f('0x57')]['id']);for(var _0x34d18c=0x0;_0x34d18c<_0x7b0031[_0x505f('0x3f')];_0x34d18c+=0x1){let _0x2d021a=_0x7b0031[_0x34d18c];for(var _0x2f119f=0x0;_0x2f119f<_0x2d021a['Agents']['length'];_0x2f119f+=0x1){let _0x3dd8c3=_0x2d021a[_0x505f('0x6b')][_0x2f119f];var _0x11d22b=_0x4493ff[_0x505f('0x79')]();_0x11d22b[_0x505f('0x45')]('ut.UserId\x20=\x20?',_0x3dd8c3['id']);_0x267f53[_0x505f('0x7a')](db[_0x505f('0x6f')][_0x505f('0x3a')](_0x11d22b[_0x505f('0x7b')](),{'type':db[_0x505f('0x6f')]['QueryTypes'][_0x505f('0x7c')]})[_0x505f('0x2b')](function(_0x4fbeea){if(_0x4fbeea[_0x505f('0x3f')]===0x1){return _0x3dd8c3['id'];}else{var _0x27dd3c=_[_0x505f('0x7d')](_['map'](_0x4fbeea,'TeamId'),function(_0x3e56f9){return _[_0x505f('0x7e')](_0x2bf94b,_0x3e56f9);});if(_0x27dd3c){return _0x3dd8c3['id'];}}}));}}return BPromise['all'](_0x267f53)[_0x505f('0x2b')](function(_0xde42f1){_0x34fc98=_(_0x34fc98)[_0x505f('0x7f')](_0xde42f1)[_0x505f('0x80')]()[_0x505f('0x81')]();return db[_0x505f('0x34')]['find']({'where':{'id':_0x55d10c['params']['id']}})[_0x505f('0x2b')](function(_0x590845){return db['sequelize'][_0x505f('0x70')](function(_0x48c255){return _0x590845[_0x505f('0x82')](_0x55d10c[_0x505f('0x3a')][_0x505f('0x69')],{'transaction':_0x48c255})[_0x505f('0x2b')](function(){if(!_[_0x505f('0x83')](_0x34fc98)){return _0x590845['removeAgents'](_0x34fc98,{'transaction':_0x48c255});}})[_0x505f('0x2b')](function(){_0x34fc98[_0x505f('0x73')](function(_0x4a8ee4){socket[_0x505f('0x74')](_0x505f('0x84'),{'UserId':_0x4a8ee4,'WhatsappQueueId':_0x590845['id']});});});});});});})[_0x505f('0x2b')](respondWithStatusCode(_0x2fe8b2,null))['catch'](handleError(_0x2fe8b2,null));};exports[_0x505f('0x85')]=function(_0x468549,_0x43e011,_0x486cf4){return db[_0x505f('0x34')][_0x505f('0x4d')]({'where':{'id':_0x468549[_0x505f('0x57')]['id']}})[_0x505f('0x2b')](handleEntityNotFound(_0x43e011,null))[_0x505f('0x2b')](function(_0x562e8e){if(_0x562e8e){return _0x562e8e[_0x505f('0x85')](_0x468549[_0x505f('0x50')][_0x505f('0x69')],_[_0x505f('0x86')](_0x468549[_0x505f('0x50')],['ids','id'])||{})[_0x505f('0x87')](function(_0x2c3721){for(var _0x44f3d8=0x0;_0x44f3d8<_0x468549[_0x505f('0x50')][_0x505f('0x69')][_0x505f('0x3f')];_0x44f3d8+=0x1){socket[_0x505f('0x74')](_0x505f('0x88'),{'UserId':Number(_0x468549[_0x505f('0x50')][_0x505f('0x69')][_0x44f3d8]),'WhatsappQueueId':Number(_0x468549[_0x505f('0x57')]['id'])});}return _0x2c3721;});}})[_0x505f('0x2b')](respondWithResult(_0x43e011,null))[_0x505f('0x4e')](handleError(_0x43e011,null));};exports[_0x505f('0x89')]=function(_0x52749b,_0x14b950,_0x2ff88e){return db[_0x505f('0x34')][_0x505f('0x4d')]({'where':{'id':_0x52749b[_0x505f('0x57')]['id']}})[_0x505f('0x2b')](handleEntityNotFound(_0x14b950,null))['then'](function(_0x1f0b8b){if(_0x1f0b8b){return _0x1f0b8b[_0x505f('0x89')](_0x52749b['query'][_0x505f('0x69')])[_0x505f('0x2b')](function(){if(_[_0x505f('0x8a')](_0x52749b[_0x505f('0x3a')][_0x505f('0x69')])){for(var _0x478457=0x0;_0x478457<_0x52749b[_0x505f('0x3a')][_0x505f('0x69')]['length'];_0x478457+=0x1){socket['emit'](_0x505f('0x84'),{'UserId':Number(_0x52749b[_0x505f('0x3a')][_0x505f('0x69')][_0x478457]),'WhatsappQueueId':Number(_0x52749b['params']['id'])});}}else{socket[_0x505f('0x74')]('userWhatsappQueue:remove',{'UserId':Number(_0x52749b[_0x505f('0x3a')]['ids']),'WhatsappQueueId':Number(_0x52749b['params']['id'])});}});}})[_0x505f('0x2b')](respondWithStatusCode(_0x14b950,null))[_0x505f('0x4e')](handleError(_0x14b950,null));};exports['getAgents']=function(_0x5e00b5,_0x3dd603,_0x2500f3){var _0x9e5c4a={};var _0x403732={};var _0x5861f7;var _0x2fa882;return db[_0x505f('0x34')][_0x505f('0x65')]({'where':{'id':_0x5e00b5[_0x505f('0x57')]['id']}})[_0x505f('0x2b')](handleEntityNotFound(_0x3dd603,null))[_0x505f('0x2b')](function(_0x521ebc){if(_0x521ebc){_0x5861f7=_0x521ebc;_0x403732[_0x505f('0x39')]=_['keys'](db['User'][_0x505f('0x35')]);_0x403732['query']=_[_0x505f('0x4a')](_0x5e00b5['query']);_0x403732['filters']=_[_0x505f('0x3c')](_0x403732['model'],_0x403732[_0x505f('0x3a')]);_0x9e5c4a[_0x505f('0x3e')]=_[_0x505f('0x3c')](_0x403732['model'],qs[_0x505f('0x3d')](_0x5e00b5[_0x505f('0x3a')][_0x505f('0x3d')]));_0x9e5c4a['attributes']=_0x9e5c4a[_0x505f('0x3e')][_0x505f('0x3f')]?_0x9e5c4a['attributes']:_0x403732[_0x505f('0x39')];_0x9e5c4a[_0x505f('0x40')]=qs[_0x505f('0x41')](_0x5e00b5[_0x505f('0x3a')]['sort']);_0x9e5c4a['where']=qs[_0x505f('0x3b')](_[_0x505f('0x42')](_0x5e00b5[_0x505f('0x3a')],_0x403732[_0x505f('0x3b')]));if(_0x5e00b5['query'][_0x505f('0x43')]){_0x9e5c4a[_0x505f('0x45')]=_[_0x505f('0x44')](_0x9e5c4a[_0x505f('0x45')],{'$or':_[_0x505f('0x33')](_0x9e5c4a['attributes'],function(_0x1bcec0){var _0x210e19={};_0x210e19[_0x1bcec0]={'$like':'%'+_0x5e00b5[_0x505f('0x3a')]['filter']+'%'};return _0x210e19;})});}_0x9e5c4a=_[_0x505f('0x44')]({},_0x9e5c4a,_0x5e00b5['options']);return _0x5861f7['getAgents'](_0x9e5c4a);}})[_0x505f('0x2b')](function(_0x5125db){if(_0x5125db){_0x2fa882=_0x5125db[_0x505f('0x3f')];if(!_0x5e00b5[_0x505f('0x3a')]['hasOwnProperty'](_0x505f('0x5b'))){_0x9e5c4a[_0x505f('0x24')]=qs[_0x505f('0x24')](_0x5e00b5[_0x505f('0x3a')][_0x505f('0x24')]);_0x9e5c4a[_0x505f('0x22')]=qs['offset'](_0x5e00b5[_0x505f('0x3a')][_0x505f('0x22')]);}return _0x5861f7[_0x505f('0x8b')](_0x9e5c4a);}})[_0x505f('0x2b')](function(_0x475b82){if(_0x475b82){return _0x475b82?{'count':_0x2fa882,'rows':_0x475b82}:null;}})[_0x505f('0x2b')](respondWithResult(_0x3dd603,null))[_0x505f('0x4e')](handleError(_0x3dd603,null));}; \ No newline at end of file +var _0x2faf=['to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','WhatsappQueues','UserProfileResource','stack','name','send','index','map','WhatsappQueue','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','include','findAll','params','includeAll','find','catch','create','body','user','get','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMembers','UserWhatsappQueue','WhatsappQueueId','findAndCountAll','UserId','agent','whatsappPause','updatedAt','%s/%s','SIP','getTeams','Team','rawAttributes','addTeams','User','online','interface','flatMap','Agents','sequelize','transaction','each','ids','select','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','forEach','emit','userWhatsappQueue:remove','addAgents','omit','userWhatsappQueue:save','removeAgents','isArray','getAgents','findOne','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util'];(function(_0x4ed267,_0x4733f2){var _0x2c00ef=function(_0x12baa9){while(--_0x12baa9){_0x4ed267['push'](_0x4ed267['shift']());}};_0x2c00ef(++_0x4733f2);}(_0x2faf,0x85));var _0xf2fa=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2faf[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xf2fa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf2fa('0x1'));var jsonpatch=require(_0xf2fa('0x2'));var rp=require(_0xf2fa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf2fa('0x4'));var util=require(_0xf2fa('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xf2fa('0x6'));var ejs=require(_0xf2fa('0x7'));var fs=require('fs');var fs_extra=require(_0xf2fa('0x8'));var _=require('lodash');var squel=require(_0xf2fa('0x9'));var crypto=require(_0xf2fa('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf2fa('0xb'));var toCsv=require(_0xf2fa('0x6'));var querystring=require(_0xf2fa('0xc'));var Papa=require(_0xf2fa('0xd'));var Redis=require(_0xf2fa('0xe'));var authService=require(_0xf2fa('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf2fa('0x10'));var hardwareService=require(_0xf2fa('0x11'));var logger=require(_0xf2fa('0x12'))(_0xf2fa('0x13'));var utils=require(_0xf2fa('0x14'));var config=require(_0xf2fa('0x15'));var licenseUtil=require(_0xf2fa('0x16'));var db=require(_0xf2fa('0x17'))['db'];config[_0xf2fa('0x18')]=_[_0xf2fa('0x19')](config[_0xf2fa('0x18')],{'host':_0xf2fa('0x1a'),'port':0x18eb});var socket=require(_0xf2fa('0x1b'))(new Redis(config[_0xf2fa('0x18')]));require(_0xf2fa('0x1c'))[_0xf2fa('0x1d')](socket);function respondWithStatusCode(_0x102c8d,_0x282f56){_0x282f56=_0x282f56||0xcc;return function(_0x1e76e1){if(_0x1e76e1){return _0x102c8d[_0xf2fa('0x1e')](_0x282f56);}return _0x102c8d[_0xf2fa('0x1f')](_0x282f56)['end']();};}function respondWithResult(_0x38c50d,_0x153622){_0x153622=_0x153622||0xc8;return function(_0x764d9d){if(_0x764d9d){return _0x38c50d[_0xf2fa('0x1f')](_0x153622)[_0xf2fa('0x20')](_0x764d9d);}};}function respondWithFilteredResult(_0x1cc881,_0x18b594){return function(_0x43a869){if(_0x43a869){var _0x1ce1ae=typeof _0x18b594[_0xf2fa('0x21')]===_0xf2fa('0x22')&&typeof _0x18b594['limit']===_0xf2fa('0x22');var _0x441e9c=_0x43a869[_0xf2fa('0x23')];var _0x92cc3a=_0x1ce1ae?0x0:_0x18b594[_0xf2fa('0x21')];var _0x55c907=_0x1ce1ae?_0x43a869[_0xf2fa('0x23')]:_0x18b594[_0xf2fa('0x21')]+_0x18b594[_0xf2fa('0x24')];var _0x88e824;if(_0x55c907>=_0x441e9c){_0x55c907=_0x441e9c;_0x88e824=0xc8;}else{_0x88e824=0xce;}_0x1cc881[_0xf2fa('0x1f')](_0x88e824);return _0x1cc881[_0xf2fa('0x25')](_0xf2fa('0x26'),_0x92cc3a+'-'+_0x55c907+'/'+_0x441e9c)['json'](_0x43a869);}return null;};}function patchUpdates(_0x2aa5f1){return function(_0x40ef1a){try{jsonpatch[_0xf2fa('0x27')](_0x40ef1a,_0x2aa5f1,!![]);}catch(_0xca19d7){return BPromise[_0xf2fa('0x28')](_0xca19d7);}return _0x40ef1a['save']();};}function saveUpdates(_0x4636ef,_0x5a5c87){return function(_0x2d888a){if(_0x2d888a){return _0x2d888a['update'](_0x4636ef)[_0xf2fa('0x29')](function(_0xa2c7ab){return _0xa2c7ab;});}return null;};}function removeEntity(_0x2d934a,_0x39d74c){return function(_0xcc07df){if(_0xcc07df){return _0xcc07df[_0xf2fa('0x2a')]()[_0xf2fa('0x29')](function(){var _0x1e43e4=_0xcc07df['get']({'plain':!![]});var _0x236d11=_0xf2fa('0x2b');return db[_0xf2fa('0x2c')]['destroy']({'where':{'type':_0x236d11,'resourceId':_0x1e43e4['id']}})[_0xf2fa('0x29')](function(){return _0xcc07df;});})[_0xf2fa('0x29')](function(){_0x2d934a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a2562,_0x19ed42){return function(_0xe34a18){if(!_0xe34a18){_0x2a2562[_0xf2fa('0x1e')](0x194);}return _0xe34a18;};}function handleError(_0xf44487,_0x403720){_0x403720=_0x403720||0x1f4;return function(_0x42b325){logger['error'](_0x42b325[_0xf2fa('0x2d')]);if(_0x42b325[_0xf2fa('0x2e')]){delete _0x42b325[_0xf2fa('0x2e')];}_0xf44487[_0xf2fa('0x1f')](_0x403720)[_0xf2fa('0x2f')](_0x42b325);};}exports[_0xf2fa('0x30')]=function(_0x4ec672,_0x27d6b8){var _0xba88f9={},_0x15f9f1={},_0x274d5f={'count':0x0,'rows':[]};var _0x3265c5=_[_0xf2fa('0x31')](db[_0xf2fa('0x32')]['rawAttributes'],function(_0x236e9f){return{'name':_0x236e9f[_0xf2fa('0x33')],'type':_0x236e9f['type'][_0xf2fa('0x34')]};});_0x15f9f1['model']=_[_0xf2fa('0x31')](_0x3265c5,_0xf2fa('0x2e'));_0x15f9f1[_0xf2fa('0x35')]=_[_0xf2fa('0x36')](_0x4ec672[_0xf2fa('0x35')]);_0x15f9f1[_0xf2fa('0x37')]=_[_0xf2fa('0x38')](_0x15f9f1['model'],_0x15f9f1[_0xf2fa('0x35')]);_0xba88f9[_0xf2fa('0x39')]=_[_0xf2fa('0x38')](_0x15f9f1[_0xf2fa('0x3a')],qs[_0xf2fa('0x3b')](_0x4ec672[_0xf2fa('0x35')][_0xf2fa('0x3b')]));_0xba88f9[_0xf2fa('0x39')]=_0xba88f9[_0xf2fa('0x39')][_0xf2fa('0x3c')]?_0xba88f9[_0xf2fa('0x39')]:_0x15f9f1['model'];if(!_0x4ec672[_0xf2fa('0x35')][_0xf2fa('0x3d')](_0xf2fa('0x3e'))){_0xba88f9[_0xf2fa('0x24')]=qs['limit'](_0x4ec672[_0xf2fa('0x35')][_0xf2fa('0x24')]);_0xba88f9[_0xf2fa('0x21')]=qs['offset'](_0x4ec672[_0xf2fa('0x35')][_0xf2fa('0x21')]);}_0xba88f9[_0xf2fa('0x3f')]=qs[_0xf2fa('0x40')](_0x4ec672[_0xf2fa('0x35')]['sort']);_0xba88f9['where']=qs[_0xf2fa('0x37')](_[_0xf2fa('0x41')](_0x4ec672[_0xf2fa('0x35')],_0x15f9f1['filters']),_0x3265c5);if(_0x4ec672[_0xf2fa('0x35')][_0xf2fa('0x42')]){_0xba88f9[_0xf2fa('0x43')]=_[_0xf2fa('0x44')](_0xba88f9['where'],{'$or':_[_0xf2fa('0x31')](_0x3265c5,function(_0x2cd6da){if(_0x2cd6da[_0xf2fa('0x45')]!=='VIRTUAL'){var _0xc626f9={};_0xc626f9[_0x2cd6da[_0xf2fa('0x2e')]]={'$like':'%'+_0x4ec672[_0xf2fa('0x35')][_0xf2fa('0x42')]+'%'};return _0xc626f9;}})});}_0xba88f9=_[_0xf2fa('0x44')]({},_0xba88f9,_0x4ec672[_0xf2fa('0x46')]);var _0x527011={'where':_0xba88f9['where']};return db[_0xf2fa('0x32')][_0xf2fa('0x23')](_0x527011)[_0xf2fa('0x29')](function(_0x182ea8){_0x274d5f[_0xf2fa('0x23')]=_0x182ea8;if(_0x4ec672[_0xf2fa('0x35')]['includeAll']){_0xba88f9[_0xf2fa('0x47')]=[{'all':!![]}];}return db[_0xf2fa('0x32')][_0xf2fa('0x48')](_0xba88f9);})['then'](function(_0x3651c0){_0x274d5f['rows']=_0x3651c0;return _0x274d5f;})[_0xf2fa('0x29')](respondWithFilteredResult(_0x27d6b8,_0xba88f9))['catch'](handleError(_0x27d6b8,null));};exports['show']=function(_0x127e6a,_0x40e325){var _0x494bbb={'raw':!![],'where':{'id':_0x127e6a[_0xf2fa('0x49')]['id']}},_0x35f977={};_0x35f977['model']=_['keys'](db['WhatsappQueue']['rawAttributes']);_0x35f977[_0xf2fa('0x35')]=_[_0xf2fa('0x36')](_0x127e6a['query']);_0x35f977[_0xf2fa('0x37')]=_[_0xf2fa('0x38')](_0x35f977['model'],_0x35f977['query']);_0x494bbb[_0xf2fa('0x39')]=_[_0xf2fa('0x38')](_0x35f977['model'],qs[_0xf2fa('0x3b')](_0x127e6a[_0xf2fa('0x35')][_0xf2fa('0x3b')]));_0x494bbb[_0xf2fa('0x39')]=_0x494bbb['attributes'][_0xf2fa('0x3c')]?_0x494bbb[_0xf2fa('0x39')]:_0x35f977[_0xf2fa('0x3a')];if(_0x127e6a[_0xf2fa('0x35')][_0xf2fa('0x4a')]){_0x494bbb[_0xf2fa('0x47')]=[{'all':!![]}];}_0x494bbb=_[_0xf2fa('0x44')]({},_0x494bbb,_0x127e6a[_0xf2fa('0x46')]);return db[_0xf2fa('0x32')][_0xf2fa('0x4b')](_0x494bbb)[_0xf2fa('0x29')](handleEntityNotFound(_0x40e325,null))[_0xf2fa('0x29')](respondWithResult(_0x40e325,null))[_0xf2fa('0x4c')](handleError(_0x40e325,null));};exports[_0xf2fa('0x4d')]=function(_0x49b337,_0x4a5eee){return db[_0xf2fa('0x32')]['create'](_0x49b337[_0xf2fa('0x4e')],{})[_0xf2fa('0x29')](function(_0x40ca27){var _0x110b40=_0x49b337[_0xf2fa('0x4f')][_0xf2fa('0x50')]({'plain':!![]});if(!_0x110b40)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x110b40[_0xf2fa('0x51')]===_0xf2fa('0x4f')){var _0x405004=_0x40ca27[_0xf2fa('0x50')]({'plain':!![]});var _0x15addb=_0xf2fa('0x2b');return db[_0xf2fa('0x52')][_0xf2fa('0x4b')]({'where':{'name':_0x15addb,'userProfileId':_0x110b40[_0xf2fa('0x53')]},'raw':!![]})[_0xf2fa('0x29')](function(_0x460f7c){if(_0x460f7c&&_0x460f7c['autoAssociation']===0x0){return db[_0xf2fa('0x2c')][_0xf2fa('0x4d')]({'name':_0x405004[_0xf2fa('0x2e')],'resourceId':_0x405004['id'],'type':_0x460f7c['name'],'sectionId':_0x460f7c['id']},{})[_0xf2fa('0x29')](function(){return _0x40ca27;});}else{return _0x40ca27;}})[_0xf2fa('0x4c')](function(_0x118257){logger[_0xf2fa('0x54')](_0xf2fa('0x55'),_0x118257);throw _0x118257;});}return _0x40ca27;})['then'](respondWithResult(_0x4a5eee,0xc9))[_0xf2fa('0x4c')](handleError(_0x4a5eee,null));};exports[_0xf2fa('0x56')]=function(_0x33b6d9,_0x526ddd){if(_0x33b6d9[_0xf2fa('0x4e')]['id']){delete _0x33b6d9[_0xf2fa('0x4e')]['id'];}return db[_0xf2fa('0x32')][_0xf2fa('0x4b')]({'where':{'id':_0x33b6d9['params']['id']}})[_0xf2fa('0x29')](handleEntityNotFound(_0x526ddd,null))[_0xf2fa('0x29')](saveUpdates(_0x33b6d9[_0xf2fa('0x4e')],null))[_0xf2fa('0x29')](respondWithResult(_0x526ddd,null))[_0xf2fa('0x4c')](handleError(_0x526ddd,null));};exports[_0xf2fa('0x2a')]=function(_0x50497d,_0x106789){return db['WhatsappQueue'][_0xf2fa('0x4b')]({'where':{'id':_0x50497d['params']['id']}})[_0xf2fa('0x29')](handleEntityNotFound(_0x106789,null))[_0xf2fa('0x29')](removeEntity(_0x106789,null))[_0xf2fa('0x4c')](handleError(_0x106789,null));};exports['describe']=function(_0x46eaa5,_0x2de54e){return db[_0xf2fa('0x32')]['describe']()[_0xf2fa('0x29')](respondWithResult(_0x2de54e,null))[_0xf2fa('0x4c')](handleError(_0x2de54e,null));};exports[_0xf2fa('0x57')]=function(_0x38aca9,_0x5bf84a,_0x1f4618){var _0x2ea837={'raw':!![],'where':{}},_0x2c5217={},_0x89698e;return db[_0xf2fa('0x32')]['findOne']({'where':{'id':_0x38aca9['params']['id']}})[_0xf2fa('0x29')](handleEntityNotFound(_0x5bf84a,null))[_0xf2fa('0x29')](function(_0x3a07db){if(_0x3a07db){_0x89698e=_0x3a07db[_0xf2fa('0x50')]({'plain':!![]});_0x2c5217[_0xf2fa('0x3a')]=_[_0xf2fa('0x36')](db[_0xf2fa('0x58')]['rawAttributes']);_0x2c5217[_0xf2fa('0x35')]=_['keys'](_0x38aca9[_0xf2fa('0x35')]);_0x2c5217['filters']=_[_0xf2fa('0x38')](_0x2c5217[_0xf2fa('0x3a')],_0x2c5217['query']);_0x2ea837[_0xf2fa('0x39')]=_[_0xf2fa('0x38')](_0x2c5217[_0xf2fa('0x3a')],qs['fields'](_0x38aca9[_0xf2fa('0x35')][_0xf2fa('0x3b')]));_0x2ea837[_0xf2fa('0x39')]=_0x2ea837[_0xf2fa('0x39')][_0xf2fa('0x3c')]?_0x2ea837['attributes']:_0x2c5217[_0xf2fa('0x3a')];if(!_0x38aca9[_0xf2fa('0x35')][_0xf2fa('0x3d')](_0xf2fa('0x3e'))){_0x2ea837[_0xf2fa('0x24')]=qs[_0xf2fa('0x24')](_0x38aca9[_0xf2fa('0x35')][_0xf2fa('0x24')]);_0x2ea837[_0xf2fa('0x21')]=qs['offset'](_0x38aca9['query'][_0xf2fa('0x21')]);}_0x2ea837[_0xf2fa('0x3f')]=qs[_0xf2fa('0x40')](_0x38aca9[_0xf2fa('0x35')][_0xf2fa('0x40')]);_0x2ea837[_0xf2fa('0x43')]=qs[_0xf2fa('0x37')](_[_0xf2fa('0x41')](_0x38aca9['query'],_0x2c5217[_0xf2fa('0x37')]));_0x2ea837['where'][_0xf2fa('0x59')]=_0x3a07db['id'];if(_0x38aca9[_0xf2fa('0x35')]['filter']){_0x2ea837[_0xf2fa('0x43')]=_['merge'](_0x2ea837['where'],{'$or':_[_0xf2fa('0x31')](_0x2ea837[_0xf2fa('0x39')],function(_0xa53405){var _0x205005={};_0x205005[_0xa53405]={'$like':'%'+_0x38aca9[_0xf2fa('0x35')]['filter']+'%'};return _0x205005;})});}_0x2ea837=_[_0xf2fa('0x44')]({},_0x2ea837,_0x38aca9[_0xf2fa('0x46')]);return db[_0xf2fa('0x58')]['findAll'](_0x2ea837);}})[_0xf2fa('0x29')](function(_0x37616b){if(_0x37616b){return db['User'][_0xf2fa('0x5a')]({'where':{'id':_[_0xf2fa('0x31')](_0x37616b,_0xf2fa('0x5b')),'role':_0xf2fa('0x5c')},'attributes':['id',_0xf2fa('0x2e'),_0xf2fa('0x5d'),_0xf2fa('0x5e'),'createdAt']});}})[_0xf2fa('0x29')](function(_0x386d80){if(_0x386d80){return{'count':_0x386d80['count'],'rows':_[_0xf2fa('0x31')](_0x386d80['rows'],function(_0x402a13){return{'membername':_0x402a13[_0xf2fa('0x2e')],'UserId':_0x402a13['id'],'queue_name':_0x89698e[_0xf2fa('0x2e')],'WhatsappQueueId':_0x89698e['id'],'interface':util['format'](_0xf2fa('0x5f'),_0xf2fa('0x60'),_0x402a13['name']),'penalty':0x0,'paused':_0x402a13[_0xf2fa('0x5d')],'createdAt':_0x402a13['createdAt'],'updatedAt':_0x402a13['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xf2fa('0x29')](respondWithFilteredResult(_0x5bf84a,_0x2ea837))[_0xf2fa('0x4c')](handleError(_0x5bf84a,null));};exports[_0xf2fa('0x61')]=function(_0x4fe4ab,_0x39003c,_0x4bc20e){var _0x14b1e5={};var _0x389db7={};var _0x5cf874;var _0x3da2fd;return db['WhatsappQueue']['findOne']({'where':{'id':_0x4fe4ab[_0xf2fa('0x49')]['id']}})[_0xf2fa('0x29')](handleEntityNotFound(_0x39003c,null))[_0xf2fa('0x29')](function(_0x138ab9){if(_0x138ab9){_0x5cf874=_0x138ab9;_0x389db7[_0xf2fa('0x3a')]=_['keys'](db[_0xf2fa('0x62')][_0xf2fa('0x63')]);_0x389db7['query']=_[_0xf2fa('0x36')](_0x4fe4ab[_0xf2fa('0x35')]);_0x389db7['filters']=_[_0xf2fa('0x38')](_0x389db7[_0xf2fa('0x3a')],_0x389db7[_0xf2fa('0x35')]);_0x14b1e5[_0xf2fa('0x39')]=_[_0xf2fa('0x38')](_0x389db7[_0xf2fa('0x3a')],qs[_0xf2fa('0x3b')](_0x4fe4ab[_0xf2fa('0x35')][_0xf2fa('0x3b')]));_0x14b1e5[_0xf2fa('0x39')]=_0x14b1e5['attributes'][_0xf2fa('0x3c')]?_0x14b1e5[_0xf2fa('0x39')]:_0x389db7[_0xf2fa('0x3a')];_0x14b1e5[_0xf2fa('0x3f')]=qs[_0xf2fa('0x40')](_0x4fe4ab['query'][_0xf2fa('0x40')]);_0x14b1e5[_0xf2fa('0x43')]=qs['filters'](_[_0xf2fa('0x41')](_0x4fe4ab['query'],_0x389db7['filters']));if(_0x4fe4ab[_0xf2fa('0x35')][_0xf2fa('0x42')]){_0x14b1e5['where']=_[_0xf2fa('0x44')](_0x14b1e5[_0xf2fa('0x43')],{'$or':_[_0xf2fa('0x31')](_0x14b1e5[_0xf2fa('0x39')],function(_0x70b70d){var _0x3cf404={};_0x3cf404[_0x70b70d]={'$like':'%'+_0x4fe4ab[_0xf2fa('0x35')]['filter']+'%'};return _0x3cf404;})});}_0x14b1e5=_[_0xf2fa('0x44')]({},_0x14b1e5,_0x4fe4ab[_0xf2fa('0x46')]);return _0x5cf874[_0xf2fa('0x61')](_0x14b1e5);}})['then'](function(_0x79d6c5){if(_0x79d6c5){_0x3da2fd=_0x79d6c5['length'];if(!_0x4fe4ab['query'][_0xf2fa('0x3d')](_0xf2fa('0x3e'))){_0x14b1e5[_0xf2fa('0x24')]=qs[_0xf2fa('0x24')](_0x4fe4ab[_0xf2fa('0x35')][_0xf2fa('0x24')]);_0x14b1e5['offset']=qs[_0xf2fa('0x21')](_0x4fe4ab[_0xf2fa('0x35')][_0xf2fa('0x21')]);}return _0x5cf874[_0xf2fa('0x61')](_0x14b1e5);}})[_0xf2fa('0x29')](function(_0x112085){if(_0x112085){return _0x112085?{'count':_0x3da2fd,'rows':_0x112085}:null;}})[_0xf2fa('0x29')](respondWithResult(_0x39003c,null))[_0xf2fa('0x4c')](handleError(_0x39003c,null));};exports[_0xf2fa('0x64')]=function(_0x21936d,_0x578f6a,_0x127282){var _0xc39fa1=_0x21936d['body']['ids'];return db['Team']['findAll']({'where':{'id':_0xc39fa1},'attributes':['id'],'include':[{'model':db[_0xf2fa('0x65')],'as':'Agents','attributes':['id',_0xf2fa('0x2e'),_0xf2fa('0x66'),'voicePause',_0xf2fa('0x67')],'raw':!![]}]})[_0xf2fa('0x29')](function(_0x53d921){if(_0x53d921){var _0x5da9ed=_[_0xf2fa('0x68')](_0x53d921,function(_0x3118ea){var _0x4cbc43=_0x3118ea[_0xf2fa('0x50')]({'plain':!![]});return _0x4cbc43[_0xf2fa('0x69')];});return db[_0xf2fa('0x32')][_0xf2fa('0x4b')]({'where':{'id':_0x21936d['params']['id']}})[_0xf2fa('0x29')](function(_0x39c93b){return db[_0xf2fa('0x6a')][_0xf2fa('0x6b')](function(_0x20df69){return _0x39c93b[_0xf2fa('0x64')](_0xc39fa1,{'transaction':_0x20df69})[_0xf2fa('0x29')](function(){return BPromise[_0xf2fa('0x6c')](_0x5da9ed,function(_0x485e01){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x485e01['id'],'WhatsappQueueId':_0x21936d['params']['id']},'transaction':_0x20df69});});})[_0xf2fa('0x29')](function(){_0x5da9ed['forEach'](function(_0x789efc){socket['emit']('userWhatsappQueue:save',{'UserId':_0x789efc['id'],'WhatsappQueueId':_0x39c93b['id']});});});});});}})[_0xf2fa('0x29')](respondWithStatusCode(_0x578f6a,null))[_0xf2fa('0x4c')](handleError(_0x578f6a,null));};exports['removeTeams']=function(_0x10bcf8,_0x5959b1,_0x4d749d){return db[_0xf2fa('0x62')][_0xf2fa('0x48')]({'where':{'id':_0x10bcf8[_0xf2fa('0x35')][_0xf2fa('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xf2fa('0x65')],'as':_0xf2fa('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5959b1,null))[_0xf2fa('0x29')](function(_0x7805f2){var _0x4e1e58=_[_0xf2fa('0x31')](_0x7805f2,'id');var _0x413a4d=[];var _0x5c3a9f=[];var _0x1c0099=squel[_0xf2fa('0x6e')]();_0x1c0099['field'](_0xf2fa('0x6f'))[_0xf2fa('0x70')](_0xf2fa('0x71'),'tq')[_0xf2fa('0x72')]('user_has_teams','ut',_0xf2fa('0x73'))[_0xf2fa('0x43')]('WhatsappQueueId\x20=\x20?',_0x10bcf8[_0xf2fa('0x49')]['id']);for(var _0x56e3d3=0x0;_0x56e3d3<_0x7805f2[_0xf2fa('0x3c')];_0x56e3d3+=0x1){let _0xfa28b4=_0x7805f2[_0x56e3d3];for(var _0x35077c=0x0;_0x35077c<_0xfa28b4['Agents'][_0xf2fa('0x3c')];_0x35077c+=0x1){let _0x2947cc=_0xfa28b4[_0xf2fa('0x69')][_0x35077c];var _0x4c8d6d=_0x1c0099['clone']();_0x4c8d6d['where'](_0xf2fa('0x74'),_0x2947cc['id']);_0x5c3a9f[_0xf2fa('0x75')](db[_0xf2fa('0x6a')][_0xf2fa('0x35')](_0x4c8d6d[_0xf2fa('0x76')](),{'type':db[_0xf2fa('0x6a')][_0xf2fa('0x77')]['SELECT']})[_0xf2fa('0x29')](function(_0x5a5deb){if(_0x5a5deb[_0xf2fa('0x3c')]===0x1){return _0x2947cc['id'];}else{var _0x1f6b5e=_[_0xf2fa('0x78')](_[_0xf2fa('0x31')](_0x5a5deb,_0xf2fa('0x79')),function(_0x3398df){return _[_0xf2fa('0x7a')](_0x4e1e58,_0x3398df);});if(_0x1f6b5e){return _0x2947cc['id'];}}}));}}return BPromise[_0xf2fa('0x7b')](_0x5c3a9f)[_0xf2fa('0x29')](function(_0x598a85){_0x413a4d=_(_0x413a4d)[_0xf2fa('0x7c')](_0x598a85)[_0xf2fa('0x7d')]()[_0xf2fa('0x7e')]();return db['WhatsappQueue'][_0xf2fa('0x4b')]({'where':{'id':_0x10bcf8[_0xf2fa('0x49')]['id']}})['then'](function(_0x16139c){return db[_0xf2fa('0x6a')][_0xf2fa('0x6b')](function(_0x198c12){return _0x16139c[_0xf2fa('0x7f')](_0x10bcf8[_0xf2fa('0x35')][_0xf2fa('0x6d')],{'transaction':_0x198c12})[_0xf2fa('0x29')](function(){if(!_[_0xf2fa('0x80')](_0x413a4d)){return _0x16139c['removeAgents'](_0x413a4d,{'transaction':_0x198c12});}})[_0xf2fa('0x29')](function(){_0x413a4d[_0xf2fa('0x81')](function(_0x534559){socket[_0xf2fa('0x82')](_0xf2fa('0x83'),{'UserId':_0x534559,'WhatsappQueueId':_0x16139c['id']});});});});});});})[_0xf2fa('0x29')](respondWithStatusCode(_0x5959b1,null))[_0xf2fa('0x4c')](handleError(_0x5959b1,null));};exports[_0xf2fa('0x84')]=function(_0x551834,_0x5f1a60,_0x130345){return db[_0xf2fa('0x32')]['find']({'where':{'id':_0x551834[_0xf2fa('0x49')]['id']}})[_0xf2fa('0x29')](handleEntityNotFound(_0x5f1a60,null))[_0xf2fa('0x29')](function(_0x1cddb4){if(_0x1cddb4){return _0x1cddb4[_0xf2fa('0x84')](_0x551834[_0xf2fa('0x4e')][_0xf2fa('0x6d')],_[_0xf2fa('0x85')](_0x551834[_0xf2fa('0x4e')],[_0xf2fa('0x6d'),'id'])||{})['spread'](function(_0xd4cc3d){for(var _0x4b8b90=0x0;_0x4b8b90<_0x551834[_0xf2fa('0x4e')]['ids'][_0xf2fa('0x3c')];_0x4b8b90+=0x1){socket[_0xf2fa('0x82')](_0xf2fa('0x86'),{'UserId':Number(_0x551834['body']['ids'][_0x4b8b90]),'WhatsappQueueId':Number(_0x551834[_0xf2fa('0x49')]['id'])});}return _0xd4cc3d;});}})['then'](respondWithResult(_0x5f1a60,null))[_0xf2fa('0x4c')](handleError(_0x5f1a60,null));};exports[_0xf2fa('0x87')]=function(_0x4a1969,_0x19fed2,_0x44ebbe){return db['WhatsappQueue']['find']({'where':{'id':_0x4a1969['params']['id']}})[_0xf2fa('0x29')](handleEntityNotFound(_0x19fed2,null))[_0xf2fa('0x29')](function(_0x223eb4){if(_0x223eb4){return _0x223eb4[_0xf2fa('0x87')](_0x4a1969[_0xf2fa('0x35')]['ids'])[_0xf2fa('0x29')](function(){if(_[_0xf2fa('0x88')](_0x4a1969[_0xf2fa('0x35')][_0xf2fa('0x6d')])){for(var _0x3f91fd=0x0;_0x3f91fd<_0x4a1969['query'][_0xf2fa('0x6d')][_0xf2fa('0x3c')];_0x3f91fd+=0x1){socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x4a1969[_0xf2fa('0x35')][_0xf2fa('0x6d')][_0x3f91fd]),'WhatsappQueueId':Number(_0x4a1969['params']['id'])});}}else{socket[_0xf2fa('0x82')](_0xf2fa('0x83'),{'UserId':Number(_0x4a1969[_0xf2fa('0x35')][_0xf2fa('0x6d')]),'WhatsappQueueId':Number(_0x4a1969['params']['id'])});}});}})[_0xf2fa('0x29')](respondWithStatusCode(_0x19fed2,null))[_0xf2fa('0x4c')](handleError(_0x19fed2,null));};exports[_0xf2fa('0x89')]=function(_0x1c1319,_0x224446,_0x25c016){var _0xf4d7e0={};var _0x57ab72={};var _0x314645;var _0x5decda;return db['WhatsappQueue'][_0xf2fa('0x8a')]({'where':{'id':_0x1c1319[_0xf2fa('0x49')]['id']}})['then'](handleEntityNotFound(_0x224446,null))[_0xf2fa('0x29')](function(_0x5bfa2a){if(_0x5bfa2a){_0x314645=_0x5bfa2a;_0x57ab72[_0xf2fa('0x3a')]=_['keys'](db[_0xf2fa('0x65')][_0xf2fa('0x63')]);_0x57ab72['query']=_[_0xf2fa('0x36')](_0x1c1319[_0xf2fa('0x35')]);_0x57ab72[_0xf2fa('0x37')]=_['intersection'](_0x57ab72['model'],_0x57ab72[_0xf2fa('0x35')]);_0xf4d7e0['attributes']=_[_0xf2fa('0x38')](_0x57ab72[_0xf2fa('0x3a')],qs[_0xf2fa('0x3b')](_0x1c1319[_0xf2fa('0x35')][_0xf2fa('0x3b')]));_0xf4d7e0['attributes']=_0xf4d7e0[_0xf2fa('0x39')][_0xf2fa('0x3c')]?_0xf4d7e0['attributes']:_0x57ab72[_0xf2fa('0x3a')];_0xf4d7e0['order']=qs['sort'](_0x1c1319[_0xf2fa('0x35')][_0xf2fa('0x40')]);_0xf4d7e0[_0xf2fa('0x43')]=qs[_0xf2fa('0x37')](_[_0xf2fa('0x41')](_0x1c1319[_0xf2fa('0x35')],_0x57ab72[_0xf2fa('0x37')]));if(_0x1c1319[_0xf2fa('0x35')][_0xf2fa('0x42')]){_0xf4d7e0['where']=_[_0xf2fa('0x44')](_0xf4d7e0[_0xf2fa('0x43')],{'$or':_[_0xf2fa('0x31')](_0xf4d7e0[_0xf2fa('0x39')],function(_0x5c9996){var _0x2d276e={};_0x2d276e[_0x5c9996]={'$like':'%'+_0x1c1319['query'][_0xf2fa('0x42')]+'%'};return _0x2d276e;})});}_0xf4d7e0=_[_0xf2fa('0x44')]({},_0xf4d7e0,_0x1c1319[_0xf2fa('0x46')]);return _0x314645[_0xf2fa('0x89')](_0xf4d7e0);}})[_0xf2fa('0x29')](function(_0x207996){if(_0x207996){_0x5decda=_0x207996[_0xf2fa('0x3c')];if(!_0x1c1319[_0xf2fa('0x35')][_0xf2fa('0x3d')]('nolimit')){_0xf4d7e0[_0xf2fa('0x24')]=qs[_0xf2fa('0x24')](_0x1c1319['query'][_0xf2fa('0x24')]);_0xf4d7e0[_0xf2fa('0x21')]=qs[_0xf2fa('0x21')](_0x1c1319[_0xf2fa('0x35')][_0xf2fa('0x21')]);}return _0x314645[_0xf2fa('0x89')](_0xf4d7e0);}})[_0xf2fa('0x29')](function(_0x513f91){if(_0x513f91){return _0x513f91?{'count':_0x5decda,'rows':_0x513f91}:null;}})[_0xf2fa('0x29')](respondWithResult(_0x224446,null))[_0xf2fa('0x4c')](handleError(_0x224446,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 0f0221c..98d0ac7 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 _0xcd69=['save','update','remove','emit','hasOwnProperty','hook','exports','setMaxListeners'];(function(_0x1f66b0,_0x42588c){var _0x389af3=function(_0x1e18dd){while(--_0x1e18dd){_0x1f66b0['push'](_0x1f66b0['shift']());}};_0x389af3(++_0x42588c);}(_0xcd69,0x127));var _0x9cd6=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xcd69[_0x2c91e9];return _0x13f0ff;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x9cd6('0x0')](0x0);var events={'afterCreate':_0x9cd6('0x1'),'afterUpdate':_0x9cd6('0x2'),'afterDestroy':_0x9cd6('0x3')};function emitEvent(_0x236200){return function(_0x15d3c0,_0x1779f0,_0x33dc4e){WhatsappQueueEvents[_0x9cd6('0x4')](_0x236200+':'+_0x15d3c0['id'],_0x15d3c0);WhatsappQueueEvents['emit'](_0x236200,_0x15d3c0);_0x33dc4e(null);};}for(var e in events){if(events[_0x9cd6('0x5')](e)){var event=events[e];WhatsappQueue[_0x9cd6('0x6')](e,emitEvent(event));}}module[_0x9cd6('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0xfd75=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners'];(function(_0x539303,_0x2a692e){var _0x5f2e4e=function(_0x40d0d2){while(--_0x40d0d2){_0x539303['push'](_0x539303['shift']());}};_0x5f2e4e(++_0x2a692e);}(_0xfd75,0xb0));var _0x5fd7=function(_0x42c958,_0x377024){_0x42c958=_0x42c958-0x0;var _0x322a53=_0xfd75[_0x42c958];return _0x322a53;};'use strict';var EventEmitter=require(_0x5fd7('0x0'));var WhatsappQueue=require(_0x5fd7('0x1'))['db'][_0x5fd7('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x5fd7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5fd7('0x4'),'afterDestroy':'remove'};function emitEvent(_0xba9481){return function(_0x5a4ae7,_0x499e78,_0x1f5306){WhatsappQueueEvents[_0x5fd7('0x5')](_0xba9481+':'+_0x5a4ae7['id'],_0x5a4ae7);WhatsappQueueEvents['emit'](_0xba9481,_0x5a4ae7);_0x1f5306(null);};}for(var e in events){if(events[_0x5fd7('0x6')](e)){var event=events[e];WhatsappQueue[_0x5fd7('0x7')](e,emitEvent(event));}}module[_0x5fd7('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 94cded1..3450d86 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 _0x1c2a=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','WhatsappQueue','whatsapp_queues','lodash'];(function(_0x199e78,_0x5796aa){var _0x25817b=function(_0x22f64e){while(--_0x22f64e){_0x199e78['push'](_0x199e78['shift']());}};_0x25817b(++_0x5796aa);}(_0x1c2a,0x19f));var _0xa1c2=function(_0x287561,_0x1812ef){_0x287561=_0x287561-0x0;var _0x551d50=_0x1c2a[_0x287561];return _0x551d50;};'use strict';var _=require(_0xa1c2('0x0'));var util=require(_0xa1c2('0x1'));var logger=require(_0xa1c2('0x2'))(_0xa1c2('0x3'));var moment=require(_0xa1c2('0x4'));var BPromise=require(_0xa1c2('0x5'));var rp=require(_0xa1c2('0x6'));var fs=require('fs');var path=require(_0xa1c2('0x7'));var rimraf=require('rimraf');var config=require(_0xa1c2('0x8'));var attributes=require('./whatsappQueue.attributes');module[_0xa1c2('0x9')]=function(_0x25ef2a,_0x41b953){return _0x25ef2a[_0xa1c2('0xa')](_0xa1c2('0xb'),attributes,{'tableName':_0xa1c2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd3a4=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','whatsapp_queues'];(function(_0x378720,_0xa711f1){var _0x47920a=function(_0xc5056){while(--_0xc5056){_0x378720['push'](_0x378720['shift']());}};_0x47920a(++_0xa711f1);}(_0xd3a4,0x15c));var _0x4d3a=function(_0x16d4c3,_0x1d78d8){_0x16d4c3=_0x16d4c3-0x0;var _0x195daa=_0xd3a4[_0x16d4c3];return _0x195daa;};'use strict';var _=require(_0x4d3a('0x0'));var util=require(_0x4d3a('0x1'));var logger=require(_0x4d3a('0x2'))(_0x4d3a('0x3'));var moment=require('moment');var BPromise=require(_0x4d3a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4d3a('0x5'));var rimraf=require(_0x4d3a('0x6'));var config=require(_0x4d3a('0x7'));var attributes=require(_0x4d3a('0x8'));module[_0x4d3a('0x9')]=function(_0x5e4a71,_0x407b3f){return _0x5e4a71[_0x4d3a('0xa')]('WhatsappQueue',attributes,{'tableName':_0x4d3a('0xb'),'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 dbaa170..3e93d26 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 _0x3aaf=['stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','options','raw','map','include','model','attributes','then','find','where','ShowWhatsappQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s'];(function(_0x2f15ee,_0x3b0aaa){var _0x35fcde=function(_0x37a659){while(--_0x37a659){_0x2f15ee['push'](_0x2f15ee['shift']());}};_0x35fcde(++_0x3b0aaa);}(_0x3aaf,0x108));var _0xf3aa=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x3aaf[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0xf3aa('0x0'));var util=require(_0xf3aa('0x1'));var moment=require(_0xf3aa('0x2'));var BPromise=require('bluebird');var rs=require(_0xf3aa('0x3'));var fs=require('fs');var Redis=require(_0xf3aa('0x4'));var db=require(_0xf3aa('0x5'))['db'];var utils=require(_0xf3aa('0x6'));var logger=require(_0xf3aa('0x7'))(_0xf3aa('0x8'));var config=require(_0xf3aa('0x9'));var jayson=require(_0xf3aa('0xa'));var client=jayson[_0xf3aa('0xb')][_0xf3aa('0xc')]({'port':0x232a});config[_0xf3aa('0xd')]=_['defaults'](config['redis'],{'host':_0xf3aa('0xe'),'port':0x18eb});var socket=require(_0xf3aa('0xf'))(new Redis(config[_0xf3aa('0xd')]));require('./whatsappQueue.socket')[_0xf3aa('0x10')](socket);function respondWithRpcPromise(_0x31f178,_0xc2819b,_0x22d96f){return new BPromise(function(_0x2db201,_0xe7afff){return client[_0xf3aa('0x11')](_0x31f178,_0x22d96f)['then'](function(_0x15b901){logger[_0xf3aa('0x12')](_0xf3aa('0x13'),_0xc2819b,_0xf3aa('0x14'));logger[_0xf3aa('0x15')](_0xf3aa('0x16'),_0xc2819b,'request\x20sent',JSON[_0xf3aa('0x17')](_0x15b901));if(_0x15b901[_0xf3aa('0x18')]){if(_0x15b901[_0xf3aa('0x18')][_0xf3aa('0x19')]===0x1f4){logger[_0xf3aa('0x18')](_0xf3aa('0x13'),_0xc2819b,_0x15b901[_0xf3aa('0x18')]['message']);return _0xe7afff(_0x15b901['error'][_0xf3aa('0x1a')]);}logger['error'](_0xf3aa('0x13'),_0xc2819b,_0x15b901[_0xf3aa('0x18')][_0xf3aa('0x1a')]);return _0x2db201(_0x15b901['error']['message']);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0xc2819b,_0xf3aa('0x14'));_0x2db201(_0x15b901[_0xf3aa('0x1b')]['message']);}})[_0xf3aa('0x1c')](function(_0x581946){logger[_0xf3aa('0x18')](_0xf3aa('0x13'),_0xc2819b,_0x581946);_0xe7afff(_0x581946);});});}exports[_0xf3aa('0x1d')]=function(_0xfb9f7c){var _0x3d951c=this;return new Promise(function(_0xc3fa4d,_0x3fa795){return db[_0xf3aa('0x1e')]['findAll']({'raw':_0xfb9f7c[_0xf3aa('0x1f')]?_0xfb9f7c[_0xf3aa('0x1f')][_0xf3aa('0x20')]===undefined?!![]:![]:!![],'where':_0xfb9f7c[_0xf3aa('0x1f')]?_0xfb9f7c[_0xf3aa('0x1f')]['where']||null:null,'attributes':_0xfb9f7c[_0xf3aa('0x1f')]?_0xfb9f7c['options']['attributes']||null:null,'limit':_0xfb9f7c[_0xf3aa('0x1f')]?_0xfb9f7c[_0xf3aa('0x1f')]['limit']||null:null,'include':_0xfb9f7c[_0xf3aa('0x1f')]?_0xfb9f7c[_0xf3aa('0x1f')]['include']?_[_0xf3aa('0x21')](_0xfb9f7c[_0xf3aa('0x1f')][_0xf3aa('0x22')],function(_0xa134c4){return{'model':db[_0xa134c4[_0xf3aa('0x23')]],'as':_0xa134c4['as'],'attributes':_0xa134c4['attributes'],'include':_0xa134c4[_0xf3aa('0x22')]?_[_0xf3aa('0x21')](_0xa134c4[_0xf3aa('0x22')],function(_0x3c87ea){return{'model':db[_0x3c87ea['model']],'as':_0x3c87ea['as'],'attributes':_0x3c87ea[_0xf3aa('0x24')],'include':_0x3c87ea[_0xf3aa('0x22')]?_['map'](_0x3c87ea[_0xf3aa('0x22')],function(_0x17910c){return{'model':db[_0x17910c[_0xf3aa('0x23')]],'as':_0x17910c['as'],'attributes':_0x17910c[_0xf3aa('0x24')]};}):[]};}):[]};}):[]:[]})[_0xf3aa('0x25')](function(_0x4e1043){logger[_0xf3aa('0x12')](_0xf3aa('0x1d'),_0xfb9f7c);logger[_0xf3aa('0x15')](_0xf3aa('0x1d'),_0xfb9f7c,JSON[_0xf3aa('0x17')](_0x4e1043));_0xc3fa4d(_0x4e1043);})[_0xf3aa('0x1c')](function(_0x417879){logger[_0xf3aa('0x18')](_0xf3aa('0x1d'),_0x417879[_0xf3aa('0x1a')],_0xfb9f7c);_0x3fa795(_0x3d951c['error'](0x1f4,_0x417879[_0xf3aa('0x1a')]));});});};exports['ShowWhatsappQueue']=function(_0x1c16ab){var _0x473128=this;return new Promise(function(_0x565161,_0x20d2ff){return db[_0xf3aa('0x1e')][_0xf3aa('0x26')]({'raw':_0x1c16ab[_0xf3aa('0x1f')]?_0x1c16ab[_0xf3aa('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x1c16ab[_0xf3aa('0x1f')]?_0x1c16ab[_0xf3aa('0x1f')][_0xf3aa('0x27')]||null:null,'attributes':_0x1c16ab[_0xf3aa('0x1f')]?_0x1c16ab[_0xf3aa('0x1f')]['attributes']||null:null,'include':_0x1c16ab[_0xf3aa('0x1f')]?_0x1c16ab[_0xf3aa('0x1f')][_0xf3aa('0x22')]?_[_0xf3aa('0x21')](_0x1c16ab['options'][_0xf3aa('0x22')],function(_0x224f77){return{'model':db[_0x224f77[_0xf3aa('0x23')]],'as':_0x224f77['as'],'attributes':_0x224f77['attributes'],'include':_0x224f77[_0xf3aa('0x22')]?_[_0xf3aa('0x21')](_0x224f77[_0xf3aa('0x22')],function(_0x38e333){return{'model':db[_0x38e333[_0xf3aa('0x23')]],'as':_0x38e333['as'],'attributes':_0x38e333[_0xf3aa('0x24')],'include':_0x38e333[_0xf3aa('0x22')]?_[_0xf3aa('0x21')](_0x38e333[_0xf3aa('0x22')],function(_0x48c3c6){return{'model':db[_0x48c3c6[_0xf3aa('0x23')]],'as':_0x48c3c6['as'],'attributes':_0x48c3c6[_0xf3aa('0x24')]};}):[]};}):[]};}):[]:[]})[_0xf3aa('0x25')](function(_0x3d5615){logger[_0xf3aa('0x12')](_0xf3aa('0x28'),_0x1c16ab);logger['debug'](_0xf3aa('0x28'),_0x1c16ab,JSON[_0xf3aa('0x17')](_0x3d5615));_0x565161(_0x3d5615);})[_0xf3aa('0x1c')](function(_0x3545ea){logger[_0xf3aa('0x18')]('ShowWhatsappQueue',_0x3545ea[_0xf3aa('0x1a')],_0x1c16ab);_0x20d2ff(_0x473128['error'](0x1f4,_0x3545ea['message']));});});}; \ No newline at end of file +var _0xfce0=['findAll','options','raw','attributes','include','map','model','then','ShowWhatsappQueue','WhatsappQueue','where','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','redis','defaults','localhost','register','request','info','WhatsappQueue,\x20%s,\x20%s','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetWhatsappQueue'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0xfce0,0x108));var _0x0fce=function(_0x2859b0,_0x7a0771){_0x2859b0=_0x2859b0-0x0;var _0x5dc854=_0xfce0[_0x2859b0];return _0x5dc854;};'use strict';var _=require(_0x0fce('0x0'));var util=require(_0x0fce('0x1'));var moment=require(_0x0fce('0x2'));var BPromise=require(_0x0fce('0x3'));var rs=require(_0x0fce('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0fce('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fce('0x6'))(_0x0fce('0x7'));var config=require('../../config/environment');var jayson=require(_0x0fce('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x0fce('0x9')]=_[_0x0fce('0xa')](config['redis'],{'host':_0x0fce('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0fce('0x9')]));require('./whatsappQueue.socket')[_0x0fce('0xc')](socket);function respondWithRpcPromise(_0x2cba98,_0x184bdb,_0x4b8548){return new BPromise(function(_0x2fe467,_0x15415a){return client[_0x0fce('0xd')](_0x2cba98,_0x4b8548)['then'](function(_0x3fe9d6){logger[_0x0fce('0xe')](_0x0fce('0xf'),_0x184bdb,'request\x20sent');logger['debug'](_0x0fce('0x10'),_0x184bdb,_0x0fce('0x11'),JSON[_0x0fce('0x12')](_0x3fe9d6));if(_0x3fe9d6[_0x0fce('0x13')]){if(_0x3fe9d6[_0x0fce('0x13')][_0x0fce('0x14')]===0x1f4){logger['error'](_0x0fce('0xf'),_0x184bdb,_0x3fe9d6[_0x0fce('0x13')][_0x0fce('0x15')]);return _0x15415a(_0x3fe9d6[_0x0fce('0x13')][_0x0fce('0x15')]);}logger['error'](_0x0fce('0xf'),_0x184bdb,_0x3fe9d6['error'][_0x0fce('0x15')]);return _0x2fe467(_0x3fe9d6[_0x0fce('0x13')][_0x0fce('0x15')]);}else{logger[_0x0fce('0xe')](_0x0fce('0xf'),_0x184bdb,_0x0fce('0x11'));_0x2fe467(_0x3fe9d6['result'][_0x0fce('0x15')]);}})[_0x0fce('0x16')](function(_0x32ce08){logger[_0x0fce('0x13')](_0x0fce('0xf'),_0x184bdb,_0x32ce08);_0x15415a(_0x32ce08);});});}exports[_0x0fce('0x17')]=function(_0x53c05f){var _0x221b10=this;return new Promise(function(_0x567fa3,_0x51d0a0){return db['WhatsappQueue'][_0x0fce('0x18')]({'raw':_0x53c05f[_0x0fce('0x19')]?_0x53c05f[_0x0fce('0x19')][_0x0fce('0x1a')]===undefined?!![]:![]:!![],'where':_0x53c05f[_0x0fce('0x19')]?_0x53c05f['options']['where']||null:null,'attributes':_0x53c05f[_0x0fce('0x19')]?_0x53c05f[_0x0fce('0x19')][_0x0fce('0x1b')]||null:null,'limit':_0x53c05f[_0x0fce('0x19')]?_0x53c05f[_0x0fce('0x19')]['limit']||null:null,'include':_0x53c05f[_0x0fce('0x19')]?_0x53c05f[_0x0fce('0x19')][_0x0fce('0x1c')]?_[_0x0fce('0x1d')](_0x53c05f[_0x0fce('0x19')][_0x0fce('0x1c')],function(_0x3116e2){return{'model':db[_0x3116e2[_0x0fce('0x1e')]],'as':_0x3116e2['as'],'attributes':_0x3116e2[_0x0fce('0x1b')],'include':_0x3116e2['include']?_[_0x0fce('0x1d')](_0x3116e2[_0x0fce('0x1c')],function(_0x530440){return{'model':db[_0x530440[_0x0fce('0x1e')]],'as':_0x530440['as'],'attributes':_0x530440[_0x0fce('0x1b')],'include':_0x530440[_0x0fce('0x1c')]?_[_0x0fce('0x1d')](_0x530440['include'],function(_0x598846){return{'model':db[_0x598846[_0x0fce('0x1e')]],'as':_0x598846['as'],'attributes':_0x598846[_0x0fce('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0fce('0x1f')](function(_0x28e610){logger['info']('GetWhatsappQueue',_0x53c05f);logger['debug']('GetWhatsappQueue',_0x53c05f,JSON['stringify'](_0x28e610));_0x567fa3(_0x28e610);})[_0x0fce('0x16')](function(_0x58f466){logger[_0x0fce('0x13')](_0x0fce('0x17'),_0x58f466['message'],_0x53c05f);_0x51d0a0(_0x221b10['error'](0x1f4,_0x58f466[_0x0fce('0x15')]));});});};exports[_0x0fce('0x20')]=function(_0x2c3735){var _0x561eb4=this;return new Promise(function(_0x4f1e78,_0x29aa7a){return db[_0x0fce('0x21')]['find']({'raw':_0x2c3735[_0x0fce('0x19')]?_0x2c3735[_0x0fce('0x19')][_0x0fce('0x1a')]===undefined?!![]:![]:!![],'where':_0x2c3735[_0x0fce('0x19')]?_0x2c3735[_0x0fce('0x19')][_0x0fce('0x22')]||null:null,'attributes':_0x2c3735[_0x0fce('0x19')]?_0x2c3735['options'][_0x0fce('0x1b')]||null:null,'include':_0x2c3735[_0x0fce('0x19')]?_0x2c3735['options']['include']?_['map'](_0x2c3735['options'][_0x0fce('0x1c')],function(_0x240dbc){return{'model':db[_0x240dbc[_0x0fce('0x1e')]],'as':_0x240dbc['as'],'attributes':_0x240dbc['attributes'],'include':_0x240dbc[_0x0fce('0x1c')]?_[_0x0fce('0x1d')](_0x240dbc[_0x0fce('0x1c')],function(_0x378192){return{'model':db[_0x378192[_0x0fce('0x1e')]],'as':_0x378192['as'],'attributes':_0x378192['attributes'],'include':_0x378192['include']?_[_0x0fce('0x1d')](_0x378192[_0x0fce('0x1c')],function(_0x53b5fc){return{'model':db[_0x53b5fc[_0x0fce('0x1e')]],'as':_0x53b5fc['as'],'attributes':_0x53b5fc['attributes']};}):[]};}):[]};}):[]:[]})[_0x0fce('0x1f')](function(_0x241c07){logger['info'](_0x0fce('0x20'),_0x2c3735);logger[_0x0fce('0x23')](_0x0fce('0x20'),_0x2c3735,JSON[_0x0fce('0x12')](_0x241c07));_0x4f1e78(_0x241c07);})[_0x0fce('0x16')](function(_0x3151b1){logger['error'](_0x0fce('0x20'),_0x3151b1[_0x0fce('0x15')],_0x2c3735);_0x29aa7a(_0x561eb4['error'](0x1f4,_0x3151b1[_0x0fce('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 641455a..485b545 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 _0x4df0=['removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save','remove'];(function(_0x20e295,_0x308599){var _0x33ffbe=function(_0x2eeb46){while(--_0x2eeb46){_0x20e295['push'](_0x20e295['shift']());}};_0x33ffbe(++_0x308599);}(_0x4df0,0x138));var _0x04df=function(_0x104e26,_0x3e60ae){_0x104e26=_0x104e26-0x0;var _0x1525ac=_0x4df0[_0x104e26];return _0x1525ac;};'use strict';var WhatsappQueueEvents=require(_0x04df('0x0'));var events=[_0x04df('0x1'),_0x04df('0x2'),'update'];function createListener(_0xb4d812,_0x5765f5){return function(_0x3a0200){_0x5765f5['emit'](_0xb4d812,_0x3a0200);};}function removeListener(_0x329ecb,_0x511969){return function(){WhatsappQueueEvents[_0x04df('0x3')](_0x329ecb,_0x511969);};}exports[_0x04df('0x4')]=function(_0xf2056c){for(var _0x12c1d0=0x0,_0xd76758=events[_0x04df('0x5')];_0x12c1d0<_0xd76758;_0x12c1d0++){var _0x31e3b7=events[_0x12c1d0];var _0x3b6bcc=createListener(_0x04df('0x6')+_0x31e3b7,_0xf2056c);WhatsappQueueEvents['on'](_0x31e3b7,_0x3b6bcc);}}; \ No newline at end of file +var _0xa222=['update','emit','removeListener','register','length','whatsappQueue:','remove'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0xa222,0x1aa));var _0x2a22=function(_0x1857d0,_0x6eade0){_0x1857d0=_0x1857d0-0x0;var _0x3e3c46=_0xa222[_0x1857d0];return _0x3e3c46;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=['save',_0x2a22('0x0'),_0x2a22('0x1')];function createListener(_0x4345e0,_0x184e15){return function(_0x1b45a3){_0x184e15[_0x2a22('0x2')](_0x4345e0,_0x1b45a3);};}function removeListener(_0x369a32,_0x515939){return function(){WhatsappQueueEvents[_0x2a22('0x3')](_0x369a32,_0x515939);};}exports[_0x2a22('0x4')]=function(_0x46405a){for(var _0x1b5059=0x0,_0xf10127=events[_0x2a22('0x5')];_0x1b5059<_0xf10127;_0x1b5059++){var _0x4a3e63=events[_0x1b5059];var _0x253797=createListener(_0x2a22('0x6')+_0x4a3e63,_0x46405a);WhatsappQueueEvents['on'](_0x4a3e63,_0x253797);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 101199a..bfd3616 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 _0x15f3=['/:id','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','get','isAuthenticated','index','show','post','create','put'];(function(_0x2317c7,_0x2ab178){var _0x3e4917=function(_0x469a34){while(--_0x469a34){_0x2317c7['push'](_0x2317c7['shift']());}};_0x3e4917(++_0x2ab178);}(_0x15f3,0x73));var _0x315f=function(_0x205bcf,_0x2ae0d6){_0x205bcf=_0x205bcf-0x0;var _0x82c88a=_0x15f3[_0x205bcf];return _0x82c88a;};'use strict';var multer=require(_0x315f('0x0'));var util=require(_0x315f('0x1'));var path=require('path');var timeout=require(_0x315f('0x2'));var express=require(_0x315f('0x3'));var router=express['Router']();var fs_extra=require(_0x315f('0x4'));var auth=require(_0x315f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappQueueReport.controller');router[_0x315f('0x6')]('/',auth[_0x315f('0x7')](),controller[_0x315f('0x8')]);router[_0x315f('0x6')]('/describe',auth[_0x315f('0x7')](),controller['describe']);router[_0x315f('0x6')]('/:id',auth[_0x315f('0x7')](),controller[_0x315f('0x9')]);router[_0x315f('0xa')]('/',auth['isAuthenticated'](),controller[_0x315f('0xb')]);router[_0x315f('0xc')](_0x315f('0xd'),auth[_0x315f('0x7')](),controller['update']);router['delete'](_0x315f('0xd'),auth[_0x315f('0x7')](),controller[_0x315f('0xe')]);module[_0x315f('0xf')]=router; \ No newline at end of file +var _0xcd34=['show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0xcd34,0x10a));var _0x4cd3=function(_0x4a945d,_0x150b72){_0x4a945d=_0x4a945d-0x0;var _0x400c6f=_0xcd34[_0x4a945d];return _0x400c6f;};'use strict';var multer=require(_0x4cd3('0x0'));var util=require(_0x4cd3('0x1'));var path=require(_0x4cd3('0x2'));var timeout=require(_0x4cd3('0x3'));var express=require('express');var router=express[_0x4cd3('0x4')]();var fs_extra=require(_0x4cd3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4cd3('0x6'));var config=require(_0x4cd3('0x7'));var controller=require(_0x4cd3('0x8'));router[_0x4cd3('0x9')]('/',auth[_0x4cd3('0xa')](),controller[_0x4cd3('0xb')]);router[_0x4cd3('0x9')]('/describe',auth[_0x4cd3('0xa')](),controller[_0x4cd3('0xc')]);router[_0x4cd3('0x9')](_0x4cd3('0xd'),auth[_0x4cd3('0xa')](),controller[_0x4cd3('0xe')]);router[_0x4cd3('0xf')]('/',auth[_0x4cd3('0xa')](),controller[_0x4cd3('0x10')]);router['put'](_0x4cd3('0xd'),auth[_0x4cd3('0xa')](),controller['update']);router[_0x4cd3('0x11')](_0x4cd3('0xd'),auth['isAuthenticated'](),controller[_0x4cd3('0x12')]);module[_0x4cd3('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index bc7879c..917707f 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(_0x1acc94,_0x53de39){var _0xcde46b=function(_0x51652b){while(--_0x51652b){_0x1acc94['push'](_0x1acc94['shift']());}};_0xcde46b(++_0x53de39);}(_0x7a54,0x106));var _0x47a5=function(_0x1ab7c1,_0x545378){_0x1ab7c1=_0x1ab7c1-0x0;var _0x3352d9=_0x7a54[_0x1ab7c1];return _0x3352d9;};'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(_0x41852e,_0x332ae5){var _0x1f6ef2=function(_0x5ace04){while(--_0x5ace04){_0x41852e['push'](_0x41852e['shift']());}};_0x1f6ef2(++_0x332ae5);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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 b619d42..3db6cea 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 _0xf45e=['Content-Range','json','apply','reject','save','destroy','then','sendStatus','stack','index','map','rawAttributes','type','key','model','name','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','WhatsappQueueReport','includeAll','include','findAll','rows','show','params','keys','length','merge','find','create','body','update','catch','eml-format','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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set'];(function(_0x189307,_0x4791d5){var _0x87afe9=function(_0x37c315){while(--_0x37c315){_0x189307['push'](_0x189307['shift']());}};_0x87afe9(++_0x4791d5);}(_0xf45e,0x115));var _0xef45=function(_0x13d18b,_0x58777b){_0x13d18b=_0x13d18b-0x0;var _0x597a36=_0xf45e[_0x13d18b];return _0x597a36;};'use strict';var emlformat=require(_0xef45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef45('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef45('0x2'));var moment=require(_0xef45('0x3'));var BPromise=require(_0xef45('0x4'));var Mustache=require(_0xef45('0x5'));var util=require(_0xef45('0x6'));var path=require(_0xef45('0x7'));var sox=require(_0xef45('0x8'));var csv=require(_0xef45('0x9'));var ejs=require(_0xef45('0xa'));var fs=require('fs');var fs_extra=require(_0xef45('0xb'));var _=require(_0xef45('0xc'));var squel=require(_0xef45('0xd'));var crypto=require(_0xef45('0xe'));var jsforce=require(_0xef45('0xf'));var deskjs=require(_0xef45('0x10'));var toCsv=require(_0xef45('0x9'));var querystring=require(_0xef45('0x11'));var Papa=require(_0xef45('0x12'));var Redis=require(_0xef45('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xef45('0x14'));var as=require(_0xef45('0x15'));var hardwareService=require(_0xef45('0x16'));var logger=require(_0xef45('0x17'))(_0xef45('0x18'));var utils=require(_0xef45('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xef45('0x1a'));var db=require(_0xef45('0x1b'))['db'];function respondWithStatusCode(_0x30babb,_0x433be9){_0x433be9=_0x433be9||0xcc;return function(_0x476739){if(_0x476739){return _0x30babb['sendStatus'](_0x433be9);}return _0x30babb['status'](_0x433be9)[_0xef45('0x1c')]();};}function respondWithResult(_0x47fd96,_0x2ae89a){_0x2ae89a=_0x2ae89a||0xc8;return function(_0xb0fc43){if(_0xb0fc43){return _0x47fd96[_0xef45('0x1d')](_0x2ae89a)['json'](_0xb0fc43);}};}function respondWithFilteredResult(_0x5b3136,_0x29c0c4){return function(_0x5530e6){if(_0x5530e6){var _0x11cd3a=typeof _0x29c0c4[_0xef45('0x1e')]===_0xef45('0x1f')&&typeof _0x29c0c4[_0xef45('0x20')]==='undefined';var _0x560b2f=_0x5530e6[_0xef45('0x21')];var _0x219778=_0x11cd3a?0x0:_0x29c0c4[_0xef45('0x1e')];var _0x258785=_0x11cd3a?_0x5530e6['count']:_0x29c0c4['offset']+_0x29c0c4[_0xef45('0x20')];var _0x20ef26;if(_0x258785>=_0x560b2f){_0x258785=_0x560b2f;_0x20ef26=0xc8;}else{_0x20ef26=0xce;}_0x5b3136[_0xef45('0x1d')](_0x20ef26);return _0x5b3136[_0xef45('0x22')](_0xef45('0x23'),_0x219778+'-'+_0x258785+'/'+_0x560b2f)[_0xef45('0x24')](_0x5530e6);}return null;};}function patchUpdates(_0x375cbd){return function(_0x4a6217){try{jsonpatch[_0xef45('0x25')](_0x4a6217,_0x375cbd,!![]);}catch(_0x3e2a47){return BPromise[_0xef45('0x26')](_0x3e2a47);}return _0x4a6217[_0xef45('0x27')]();};}function saveUpdates(_0x27322f,_0x5205bf){return function(_0x40abc8){if(_0x40abc8){return _0x40abc8['update'](_0x27322f)['then'](function(_0x7707a1){return _0x7707a1;});}return null;};}function removeEntity(_0x2b41d8,_0xbb859b){return function(_0x7817d0){if(_0x7817d0){return _0x7817d0[_0xef45('0x28')]()[_0xef45('0x29')](function(){_0x2b41d8[_0xef45('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x208b35,_0x5f0593){return function(_0x38b470){if(!_0x38b470){_0x208b35[_0xef45('0x2a')](0x194);}return _0x38b470;};}function handleError(_0x578f03,_0x46e423){_0x46e423=_0x46e423||0x1f4;return function(_0x2c356d){logger['error'](_0x2c356d[_0xef45('0x2b')]);if(_0x2c356d['name']){delete _0x2c356d['name'];}_0x578f03['status'](_0x46e423)['send'](_0x2c356d);};}exports[_0xef45('0x2c')]=function(_0x2f72ef,_0x217e8d){var _0x15ad38={},_0x5782d0={},_0x18f304={'count':0x0,'rows':[]};var _0x4f028c=_[_0xef45('0x2d')](db['WhatsappQueueReport'][_0xef45('0x2e')],function(_0x5bfd2d){return{'name':_0x5bfd2d['fieldName'],'type':_0x5bfd2d[_0xef45('0x2f')][_0xef45('0x30')]};});_0x5782d0[_0xef45('0x31')]=_[_0xef45('0x2d')](_0x4f028c,_0xef45('0x32'));_0x5782d0['query']=_['keys'](_0x2f72ef['query']);_0x5782d0[_0xef45('0x33')]=_[_0xef45('0x34')](_0x5782d0[_0xef45('0x31')],_0x5782d0[_0xef45('0x35')]);_0x15ad38[_0xef45('0x36')]=_[_0xef45('0x34')](_0x5782d0[_0xef45('0x31')],qs['fields'](_0x2f72ef['query'][_0xef45('0x37')]));_0x15ad38['attributes']=_0x15ad38[_0xef45('0x36')]['length']?_0x15ad38[_0xef45('0x36')]:_0x5782d0[_0xef45('0x31')];if(!_0x2f72ef[_0xef45('0x35')][_0xef45('0x38')](_0xef45('0x39'))){_0x15ad38['limit']=qs[_0xef45('0x20')](_0x2f72ef[_0xef45('0x35')][_0xef45('0x20')]);_0x15ad38['offset']=qs['offset'](_0x2f72ef[_0xef45('0x35')][_0xef45('0x1e')]);}_0x15ad38['order']=qs[_0xef45('0x3a')](_0x2f72ef['query']['sort']);_0x15ad38[_0xef45('0x3b')]=qs[_0xef45('0x33')](_[_0xef45('0x3c')](_0x2f72ef['query'],_0x5782d0[_0xef45('0x33')]),_0x4f028c);if(_0x2f72ef[_0xef45('0x35')][_0xef45('0x3d')]){_0x15ad38[_0xef45('0x3b')]=_['merge'](_0x15ad38['where'],{'$or':_[_0xef45('0x2d')](_0x4f028c,function(_0x474be1){if(_0x474be1[_0xef45('0x2f')]!==_0xef45('0x3e')){var _0x269a11={};_0x269a11[_0x474be1[_0xef45('0x32')]]={'$like':'%'+_0x2f72ef[_0xef45('0x35')][_0xef45('0x3d')]+'%'};return _0x269a11;}})});}_0x15ad38=_['merge']({},_0x15ad38,_0x2f72ef['options']);var _0x13f8b2={'where':_0x15ad38[_0xef45('0x3b')]};return db[_0xef45('0x3f')][_0xef45('0x21')](_0x13f8b2)[_0xef45('0x29')](function(_0x3bcada){_0x18f304[_0xef45('0x21')]=_0x3bcada;if(_0x2f72ef[_0xef45('0x35')][_0xef45('0x40')]){_0x15ad38[_0xef45('0x41')]=[{'all':!![]}];}return db[_0xef45('0x3f')][_0xef45('0x42')](_0x15ad38);})[_0xef45('0x29')](function(_0xd7d217){_0x18f304[_0xef45('0x43')]=_0xd7d217;return _0x18f304;})[_0xef45('0x29')](respondWithFilteredResult(_0x217e8d,_0x15ad38))['catch'](handleError(_0x217e8d,null));};exports[_0xef45('0x44')]=function(_0x5bdfad,_0x1b9d45){var _0x82c123={'raw':!![],'where':{'id':_0x5bdfad[_0xef45('0x45')]['id']}},_0x54ccb8={};_0x54ccb8['model']=_[_0xef45('0x46')](db['WhatsappQueueReport'][_0xef45('0x2e')]);_0x54ccb8[_0xef45('0x35')]=_[_0xef45('0x46')](_0x5bdfad[_0xef45('0x35')]);_0x54ccb8[_0xef45('0x33')]=_[_0xef45('0x34')](_0x54ccb8[_0xef45('0x31')],_0x54ccb8['query']);_0x82c123[_0xef45('0x36')]=_[_0xef45('0x34')](_0x54ccb8[_0xef45('0x31')],qs[_0xef45('0x37')](_0x5bdfad[_0xef45('0x35')][_0xef45('0x37')]));_0x82c123[_0xef45('0x36')]=_0x82c123[_0xef45('0x36')][_0xef45('0x47')]?_0x82c123[_0xef45('0x36')]:_0x54ccb8[_0xef45('0x31')];if(_0x5bdfad[_0xef45('0x35')][_0xef45('0x40')]){_0x82c123[_0xef45('0x41')]=[{'all':!![]}];}_0x82c123=_[_0xef45('0x48')]({},_0x82c123,_0x5bdfad['options']);return db[_0xef45('0x3f')][_0xef45('0x49')](_0x82c123)[_0xef45('0x29')](handleEntityNotFound(_0x1b9d45,null))['then'](respondWithResult(_0x1b9d45,null))['catch'](handleError(_0x1b9d45,null));};exports['create']=function(_0x29aeab,_0x18143c){return db[_0xef45('0x3f')][_0xef45('0x4a')](_0x29aeab[_0xef45('0x4b')],{})[_0xef45('0x29')](respondWithResult(_0x18143c,0xc9))['catch'](handleError(_0x18143c,null));};exports[_0xef45('0x4c')]=function(_0x463796,_0x2b2419){if(_0x463796['body']['id']){delete _0x463796['body']['id'];}return db[_0xef45('0x3f')][_0xef45('0x49')]({'where':{'id':_0x463796['params']['id']}})[_0xef45('0x29')](handleEntityNotFound(_0x2b2419,null))[_0xef45('0x29')](saveUpdates(_0x463796[_0xef45('0x4b')],null))[_0xef45('0x29')](respondWithResult(_0x2b2419,null))[_0xef45('0x4d')](handleError(_0x2b2419,null));};exports[_0xef45('0x28')]=function(_0x23581f,_0xfa5fdd){return db[_0xef45('0x3f')][_0xef45('0x49')]({'where':{'id':_0x23581f[_0xef45('0x45')]['id']}})[_0xef45('0x29')](handleEntityNotFound(_0xfa5fdd,null))[_0xef45('0x29')](removeEntity(_0xfa5fdd,null))[_0xef45('0x4d')](handleError(_0xfa5fdd,null));};exports['describe']=function(_0x22b75e,_0x24aceb){return db[_0xef45('0x3f')]['describe']()[_0xef45('0x29')](respondWithResult(_0x24aceb,null))[_0xef45('0x4d')](handleError(_0x24aceb,null));}; \ No newline at end of file +var _0x02ce=['then','destroy','error','name','index','map','WhatsappQueueReport','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','findAll','rows','catch','show','keys','includeAll','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','limit','status','Content-Range','apply','reject','save','update'];(function(_0x9973d9,_0x8a1e84){var _0x1af0fa=function(_0x3a88c1){while(--_0x3a88c1){_0x9973d9['push'](_0x9973d9['shift']());}};_0x1af0fa(++_0x8a1e84);}(_0x02ce,0x1ac));var _0xe02c=function(_0x3217f0,_0x115b9f){_0x3217f0=_0x3217f0-0x0;var _0x5ae3d1=_0x02ce[_0x3217f0];return _0x5ae3d1;};'use strict';var emlformat=require(_0xe02c('0x0'));var rimraf=require(_0xe02c('0x1'));var zipdir=require(_0xe02c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe02c('0x3'));var moment=require('moment');var BPromise=require(_0xe02c('0x4'));var Mustache=require(_0xe02c('0x5'));var util=require(_0xe02c('0x6'));var path=require(_0xe02c('0x7'));var sox=require(_0xe02c('0x8'));var csv=require(_0xe02c('0x9'));var ejs=require(_0xe02c('0xa'));var fs=require('fs');var fs_extra=require(_0xe02c('0xb'));var _=require(_0xe02c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe02c('0xd'));var deskjs=require(_0xe02c('0xe'));var toCsv=require(_0xe02c('0x9'));var querystring=require(_0xe02c('0xf'));var Papa=require(_0xe02c('0x10'));var Redis=require(_0xe02c('0x11'));var authService=require(_0xe02c('0x12'));var qs=require(_0xe02c('0x13'));var as=require(_0xe02c('0x14'));var hardwareService=require(_0xe02c('0x15'));var logger=require(_0xe02c('0x16'))(_0xe02c('0x17'));var utils=require(_0xe02c('0x18'));var config=require(_0xe02c('0x19'));var licenseUtil=require(_0xe02c('0x1a'));var db=require(_0xe02c('0x1b'))['db'];function respondWithStatusCode(_0x23d886,_0x32fc45){_0x32fc45=_0x32fc45||0xcc;return function(_0x5d6d13){if(_0x5d6d13){return _0x23d886[_0xe02c('0x1c')](_0x32fc45);}return _0x23d886['status'](_0x32fc45)['end']();};}function respondWithResult(_0x3f4e28,_0x56405a){_0x56405a=_0x56405a||0xc8;return function(_0x221910){if(_0x221910){return _0x3f4e28['status'](_0x56405a)[_0xe02c('0x1d')](_0x221910);}};}function respondWithFilteredResult(_0x4e9c6d,_0x256311){return function(_0x366893){if(_0x366893){var _0x59f2f6=typeof _0x256311[_0xe02c('0x1e')]===_0xe02c('0x1f')&&typeof _0x256311['limit']===_0xe02c('0x1f');var _0x20f492=_0x366893['count'];var _0x52917f=_0x59f2f6?0x0:_0x256311[_0xe02c('0x1e')];var _0x49604a=_0x59f2f6?_0x366893[_0xe02c('0x20')]:_0x256311[_0xe02c('0x1e')]+_0x256311[_0xe02c('0x21')];var _0x36fed0;if(_0x49604a>=_0x20f492){_0x49604a=_0x20f492;_0x36fed0=0xc8;}else{_0x36fed0=0xce;}_0x4e9c6d[_0xe02c('0x22')](_0x36fed0);return _0x4e9c6d['set'](_0xe02c('0x23'),_0x52917f+'-'+_0x49604a+'/'+_0x20f492)['json'](_0x366893);}return null;};}function patchUpdates(_0x4ea9b5){return function(_0x393621){try{jsonpatch[_0xe02c('0x24')](_0x393621,_0x4ea9b5,!![]);}catch(_0x480b9a){return BPromise[_0xe02c('0x25')](_0x480b9a);}return _0x393621[_0xe02c('0x26')]();};}function saveUpdates(_0x4ce5ee,_0x38dce2){return function(_0x45fd82){if(_0x45fd82){return _0x45fd82[_0xe02c('0x27')](_0x4ce5ee)[_0xe02c('0x28')](function(_0x2d44c8){return _0x2d44c8;});}return null;};}function removeEntity(_0x557142,_0x3e80e3){return function(_0xf41d4c){if(_0xf41d4c){return _0xf41d4c[_0xe02c('0x29')]()[_0xe02c('0x28')](function(){_0x557142[_0xe02c('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0xefd882,_0x4411d8){return function(_0x3592ca){if(!_0x3592ca){_0xefd882[_0xe02c('0x1c')](0x194);}return _0x3592ca;};}function handleError(_0x16dfa3,_0x303d24){_0x303d24=_0x303d24||0x1f4;return function(_0x43dc78){logger[_0xe02c('0x2a')](_0x43dc78['stack']);if(_0x43dc78[_0xe02c('0x2b')]){delete _0x43dc78[_0xe02c('0x2b')];}_0x16dfa3[_0xe02c('0x22')](_0x303d24)['send'](_0x43dc78);};}exports[_0xe02c('0x2c')]=function(_0x2d1d98,_0x445421){var _0x287f7e={},_0x1e7eab={},_0x35a309={'count':0x0,'rows':[]};var _0x22a285=_[_0xe02c('0x2d')](db[_0xe02c('0x2e')][_0xe02c('0x2f')],function(_0x17d5b3){return{'name':_0x17d5b3['fieldName'],'type':_0x17d5b3[_0xe02c('0x30')][_0xe02c('0x31')]};});_0x1e7eab[_0xe02c('0x32')]=_[_0xe02c('0x2d')](_0x22a285,_0xe02c('0x2b'));_0x1e7eab[_0xe02c('0x33')]=_['keys'](_0x2d1d98[_0xe02c('0x33')]);_0x1e7eab[_0xe02c('0x34')]=_['intersection'](_0x1e7eab[_0xe02c('0x32')],_0x1e7eab[_0xe02c('0x33')]);_0x287f7e[_0xe02c('0x35')]=_[_0xe02c('0x36')](_0x1e7eab[_0xe02c('0x32')],qs['fields'](_0x2d1d98['query'][_0xe02c('0x37')]));_0x287f7e[_0xe02c('0x35')]=_0x287f7e['attributes'][_0xe02c('0x38')]?_0x287f7e['attributes']:_0x1e7eab[_0xe02c('0x32')];if(!_0x2d1d98[_0xe02c('0x33')][_0xe02c('0x39')](_0xe02c('0x3a'))){_0x287f7e[_0xe02c('0x21')]=qs['limit'](_0x2d1d98[_0xe02c('0x33')]['limit']);_0x287f7e[_0xe02c('0x1e')]=qs[_0xe02c('0x1e')](_0x2d1d98[_0xe02c('0x33')][_0xe02c('0x1e')]);}_0x287f7e[_0xe02c('0x3b')]=qs[_0xe02c('0x3c')](_0x2d1d98['query'][_0xe02c('0x3c')]);_0x287f7e[_0xe02c('0x3d')]=qs['filters'](_[_0xe02c('0x3e')](_0x2d1d98[_0xe02c('0x33')],_0x1e7eab['filters']),_0x22a285);if(_0x2d1d98[_0xe02c('0x33')]['filter']){_0x287f7e[_0xe02c('0x3d')]=_[_0xe02c('0x3f')](_0x287f7e['where'],{'$or':_[_0xe02c('0x2d')](_0x22a285,function(_0x1eeddb){if(_0x1eeddb[_0xe02c('0x30')]!==_0xe02c('0x40')){var _0x3c4a65={};_0x3c4a65[_0x1eeddb[_0xe02c('0x2b')]]={'$like':'%'+_0x2d1d98['query'][_0xe02c('0x41')]+'%'};return _0x3c4a65;}})});}_0x287f7e=_['merge']({},_0x287f7e,_0x2d1d98['options']);var _0x3db057={'where':_0x287f7e[_0xe02c('0x3d')]};return db[_0xe02c('0x2e')][_0xe02c('0x20')](_0x3db057)['then'](function(_0x37e4fe){_0x35a309[_0xe02c('0x20')]=_0x37e4fe;if(_0x2d1d98[_0xe02c('0x33')]['includeAll']){_0x287f7e['include']=[{'all':!![]}];}return db[_0xe02c('0x2e')][_0xe02c('0x42')](_0x287f7e);})[_0xe02c('0x28')](function(_0x2313d2){_0x35a309[_0xe02c('0x43')]=_0x2313d2;return _0x35a309;})[_0xe02c('0x28')](respondWithFilteredResult(_0x445421,_0x287f7e))[_0xe02c('0x44')](handleError(_0x445421,null));};exports[_0xe02c('0x45')]=function(_0x21d66e,_0x53d123){var _0xc7e935={'raw':!![],'where':{'id':_0x21d66e['params']['id']}},_0x5ef4a1={};_0x5ef4a1[_0xe02c('0x32')]=_[_0xe02c('0x46')](db[_0xe02c('0x2e')][_0xe02c('0x2f')]);_0x5ef4a1[_0xe02c('0x33')]=_[_0xe02c('0x46')](_0x21d66e[_0xe02c('0x33')]);_0x5ef4a1[_0xe02c('0x34')]=_['intersection'](_0x5ef4a1['model'],_0x5ef4a1[_0xe02c('0x33')]);_0xc7e935[_0xe02c('0x35')]=_[_0xe02c('0x36')](_0x5ef4a1['model'],qs[_0xe02c('0x37')](_0x21d66e[_0xe02c('0x33')][_0xe02c('0x37')]));_0xc7e935[_0xe02c('0x35')]=_0xc7e935[_0xe02c('0x35')][_0xe02c('0x38')]?_0xc7e935[_0xe02c('0x35')]:_0x5ef4a1[_0xe02c('0x32')];if(_0x21d66e[_0xe02c('0x33')][_0xe02c('0x47')]){_0xc7e935['include']=[{'all':!![]}];}_0xc7e935=_[_0xe02c('0x3f')]({},_0xc7e935,_0x21d66e[_0xe02c('0x48')]);return db[_0xe02c('0x2e')][_0xe02c('0x49')](_0xc7e935)[_0xe02c('0x28')](handleEntityNotFound(_0x53d123,null))[_0xe02c('0x28')](respondWithResult(_0x53d123,null))[_0xe02c('0x44')](handleError(_0x53d123,null));};exports[_0xe02c('0x4a')]=function(_0x30dc90,_0x1176c9){return db[_0xe02c('0x2e')][_0xe02c('0x4a')](_0x30dc90[_0xe02c('0x4b')],{})['then'](respondWithResult(_0x1176c9,0xc9))[_0xe02c('0x44')](handleError(_0x1176c9,null));};exports['update']=function(_0x15b05c,_0x324911){if(_0x15b05c[_0xe02c('0x4b')]['id']){delete _0x15b05c[_0xe02c('0x4b')]['id'];}return db[_0xe02c('0x2e')][_0xe02c('0x49')]({'where':{'id':_0x15b05c[_0xe02c('0x4c')]['id']}})[_0xe02c('0x28')](handleEntityNotFound(_0x324911,null))[_0xe02c('0x28')](saveUpdates(_0x15b05c[_0xe02c('0x4b')],null))['then'](respondWithResult(_0x324911,null))[_0xe02c('0x44')](handleError(_0x324911,null));};exports[_0xe02c('0x29')]=function(_0xeb4214,_0x536cf7){return db[_0xe02c('0x2e')]['find']({'where':{'id':_0xeb4214[_0xe02c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x536cf7,null))['then'](removeEntity(_0x536cf7,null))['catch'](handleError(_0x536cf7,null));};exports['describe']=function(_0x51d540,_0x5740df){return db[_0xe02c('0x2e')][_0xe02c('0x4d')]()[_0xe02c('0x28')](respondWithResult(_0x5740df,null))[_0xe02c('0x44')](handleError(_0x5740df,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 23fbde0..fddf824 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 _0x7c37=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash'];(function(_0x573325,_0x2f2fa5){var _0x1987bb=function(_0x2dfffa){while(--_0x2dfffa){_0x573325['push'](_0x573325['shift']());}};_0x1987bb(++_0x2f2fa5);}(_0x7c37,0xe9));var _0x77c3=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x7c37[_0x32b542];return _0x554d54;};'use strict';var _=require(_0x77c3('0x0'));var util=require('util');var logger=require(_0x77c3('0x1'))('api');var moment=require(_0x77c3('0x2'));var BPromise=require(_0x77c3('0x3'));var rp=require(_0x77c3('0x4'));var fs=require('fs');var path=require(_0x77c3('0x5'));var rimraf=require(_0x77c3('0x6'));var config=require(_0x77c3('0x7'));var attributes=require('./whatsappQueueReport.attributes');module[_0x77c3('0x8')]=function(_0x3204c3,_0x386b23){return _0x3204c3[_0x77c3('0x9')](_0x77c3('0xa'),attributes,{'tableName':_0x77c3('0xb'),'paranoid':![],'indexes':[{'name':_0x77c3('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd567=['request-promise','path','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xd567,0x1b6));var _0x7d56=function(_0x28e7ce,_0x365b2c){_0x28e7ce=_0x28e7ce-0x0;var _0x17cc45=_0xd567[_0x28e7ce];return _0x17cc45;};'use strict';var _=require(_0x7d56('0x0'));var util=require(_0x7d56('0x1'));var logger=require(_0x7d56('0x2'))(_0x7d56('0x3'));var moment=require(_0x7d56('0x4'));var BPromise=require(_0x7d56('0x5'));var rp=require(_0x7d56('0x6'));var fs=require('fs');var path=require(_0x7d56('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x4186d6,_0x18c9d5){return _0x4186d6[_0x7d56('0x8')](_0x7d56('0x9'),attributes,{'tableName':_0x7d56('0xa'),'paranoid':![],'indexes':[{'name':_0x7d56('0xb'),'fields':[_0x7d56('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 045223d..87f1f4f 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 _0x87cf=['info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','WhatsappQueueReport','create','options','raw','then','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','body','where','limit','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x114281,_0x23c3f2){var _0x866964=function(_0x43c0f3){while(--_0x43c0f3){_0x114281['push'](_0x114281['shift']());}};_0x866964(++_0x23c3f2);}(_0x87cf,0x175));var _0xf87c=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x87cf[_0x5d6456];return _0x4d66c1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf87c('0x0'));var BPromise=require(_0xf87c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf87c('0x2'));var db=require(_0xf87c('0x3'))['db'];var utils=require(_0xf87c('0x4'));var logger=require(_0xf87c('0x5'))(_0xf87c('0x6'));var config=require('../../config/environment');var jayson=require(_0xf87c('0x7'));var client=jayson[_0xf87c('0x8')][_0xf87c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1038b3,_0x3bf3cf,_0x5e07ff){return new BPromise(function(_0x3e423d,_0x6017cb){return client[_0xf87c('0xa')](_0x1038b3,_0x5e07ff)['then'](function(_0x5db8a3){logger[_0xf87c('0xb')](_0xf87c('0xc'),_0x3bf3cf,_0xf87c('0xd'));logger[_0xf87c('0xe')](_0xf87c('0xf'),_0x3bf3cf,'request\x20sent',JSON[_0xf87c('0x10')](_0x5db8a3));if(_0x5db8a3[_0xf87c('0x11')]){if(_0x5db8a3[_0xf87c('0x11')][_0xf87c('0x12')]===0x1f4){logger[_0xf87c('0x11')](_0xf87c('0xc'),_0x3bf3cf,_0x5db8a3[_0xf87c('0x11')][_0xf87c('0x13')]);return _0x6017cb(_0x5db8a3[_0xf87c('0x11')][_0xf87c('0x13')]);}logger[_0xf87c('0x11')](_0xf87c('0xc'),_0x3bf3cf,_0x5db8a3[_0xf87c('0x11')][_0xf87c('0x13')]);return _0x3e423d(_0x5db8a3['error'][_0xf87c('0x13')]);}else{logger[_0xf87c('0xb')](_0xf87c('0xc'),_0x3bf3cf,_0xf87c('0xd'));_0x3e423d(_0x5db8a3['result'][_0xf87c('0x13')]);}})[_0xf87c('0x14')](function(_0x40724b){logger[_0xf87c('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3bf3cf,_0x40724b);_0x6017cb(_0x40724b);});});}exports['CreateWhatsappQueueReport']=function(_0x31362b){var _0x471f31=this;return new Promise(function(_0x3fe6db,_0x1c1d6a){return db[_0xf87c('0x15')][_0xf87c('0x16')](_0x31362b['body'],{'raw':_0x31362b[_0xf87c('0x17')]?_0x31362b[_0xf87c('0x17')][_0xf87c('0x18')]===undefined?!![]:![]:!![]})[_0xf87c('0x19')](function(_0x522a45){logger[_0xf87c('0xb')](_0xf87c('0x1a'),_0x31362b);logger[_0xf87c('0xe')](_0xf87c('0x1a'),_0x31362b,JSON[_0xf87c('0x10')](_0x522a45));_0x3fe6db(_0x522a45);})['catch'](function(_0x187a28){logger[_0xf87c('0x11')]('CreateWhatsappQueueReport',_0x187a28[_0xf87c('0x13')],_0x31362b);_0x1c1d6a(_0x471f31['error'](0x1f4,_0x187a28['message']));});});};exports[_0xf87c('0x1b')]=function(_0xef2f99){var _0x437667=this;return new Promise(function(_0xec4a98,_0x48df96){return db[_0xf87c('0x15')][_0xf87c('0x1c')](_0xef2f99[_0xf87c('0x1d')],{'raw':_0xef2f99['options']?_0xef2f99['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xef2f99[_0xf87c('0x17')]?_0xef2f99[_0xf87c('0x17')][_0xf87c('0x1e')]||null:null,'attributes':_0xef2f99[_0xf87c('0x17')]?_0xef2f99[_0xf87c('0x17')]['attributes']||null:null,'limit':_0xef2f99[_0xf87c('0x17')]?_0xef2f99[_0xf87c('0x17')][_0xf87c('0x1f')]||null:null})[_0xf87c('0x19')](function(_0x29cae3){logger[_0xf87c('0xb')]('UpdateWhatsappQueueReport',_0xef2f99);logger[_0xf87c('0xe')](_0xf87c('0x1b'),_0xef2f99,JSON[_0xf87c('0x10')](_0x29cae3));_0xec4a98(_0x29cae3);})[_0xf87c('0x14')](function(_0x5efccb){logger[_0xf87c('0x11')](_0xf87c('0x1b'),_0x5efccb[_0xf87c('0x13')],_0xef2f99);_0x48df96(_0x437667['error'](0x1f4,_0x5efccb[_0xf87c('0x13')]));});});}; \ No newline at end of file +var _0x8846=['WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','raw','stringify','update','body','where','attributes','limit','UpdateWhatsappQueueReport','util','moment','bluebird','randomstring','../../config/utils','jayson/promise','client','request','then','info'];(function(_0x3a0df1,_0x528918){var _0x4e9295=function(_0x2ccdd1){while(--_0x2ccdd1){_0x3a0df1['push'](_0x3a0df1['shift']());}};_0x4e9295(++_0x528918);}(_0x8846,0x19a));var _0x6884=function(_0x15f87e,_0x1d12ea){_0x15f87e=_0x15f87e-0x0;var _0x7b4bf=_0x8846[_0x15f87e];return _0x7b4bf;};'use strict';var _=require('lodash');var util=require(_0x6884('0x0'));var moment=require(_0x6884('0x1'));var BPromise=require(_0x6884('0x2'));var rs=require(_0x6884('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6884('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6884('0x5'));var client=jayson[_0x6884('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a912d,_0x49485d,_0x8f3b9){return new BPromise(function(_0x3e6e60,_0x12e889){return client[_0x6884('0x7')](_0x4a912d,_0x8f3b9)[_0x6884('0x8')](function(_0x1dbdd0){logger[_0x6884('0x9')](_0x6884('0xa'),_0x49485d,'request\x20sent');logger[_0x6884('0xb')](_0x6884('0xc'),_0x49485d,'request\x20sent',JSON['stringify'](_0x1dbdd0));if(_0x1dbdd0[_0x6884('0xd')]){if(_0x1dbdd0[_0x6884('0xd')]['code']===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x49485d,_0x1dbdd0[_0x6884('0xd')][_0x6884('0xe')]);return _0x12e889(_0x1dbdd0[_0x6884('0xd')]['message']);}logger[_0x6884('0xd')](_0x6884('0xa'),_0x49485d,_0x1dbdd0['error'][_0x6884('0xe')]);return _0x3e6e60(_0x1dbdd0[_0x6884('0xd')][_0x6884('0xe')]);}else{logger[_0x6884('0x9')]('WhatsappQueueReport,\x20%s,\x20%s',_0x49485d,_0x6884('0xf'));_0x3e6e60(_0x1dbdd0[_0x6884('0x10')][_0x6884('0xe')]);}})[_0x6884('0x11')](function(_0x572c59){logger[_0x6884('0xd')](_0x6884('0xa'),_0x49485d,_0x572c59);_0x12e889(_0x572c59);});});}exports[_0x6884('0x12')]=function(_0x4334c0){var _0x431fad=this;return new Promise(function(_0xb416f9,_0x32d049){return db[_0x6884('0x13')][_0x6884('0x14')](_0x4334c0['body'],{'raw':_0x4334c0['options']?_0x4334c0[_0x6884('0x15')][_0x6884('0x16')]===undefined?!![]:![]:!![]})[_0x6884('0x8')](function(_0x5c544f){logger[_0x6884('0x9')]('CreateWhatsappQueueReport',_0x4334c0);logger[_0x6884('0xb')](_0x6884('0x12'),_0x4334c0,JSON[_0x6884('0x17')](_0x5c544f));_0xb416f9(_0x5c544f);})['catch'](function(_0x5115b4){logger[_0x6884('0xd')]('CreateWhatsappQueueReport',_0x5115b4['message'],_0x4334c0);_0x32d049(_0x431fad['error'](0x1f4,_0x5115b4[_0x6884('0xe')]));});});};exports['UpdateWhatsappQueueReport']=function(_0xbab846){var _0x248ad8=this;return new Promise(function(_0x250a1c,_0x2cb9fb){return db['WhatsappQueueReport'][_0x6884('0x18')](_0xbab846[_0x6884('0x19')],{'raw':_0xbab846[_0x6884('0x15')]?_0xbab846[_0x6884('0x15')][_0x6884('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbab846[_0x6884('0x15')]?_0xbab846[_0x6884('0x15')][_0x6884('0x1a')]||null:null,'attributes':_0xbab846[_0x6884('0x15')]?_0xbab846[_0x6884('0x15')][_0x6884('0x1b')]||null:null,'limit':_0xbab846[_0x6884('0x15')]?_0xbab846[_0x6884('0x15')][_0x6884('0x1c')]||null:null})[_0x6884('0x8')](function(_0x3226d1){logger[_0x6884('0x9')]('UpdateWhatsappQueueReport',_0xbab846);logger[_0x6884('0xb')]('UpdateWhatsappQueueReport',_0xbab846,JSON['stringify'](_0x3226d1));_0x250a1c(_0x3226d1);})[_0x6884('0x11')](function(_0x2e5c48){logger[_0x6884('0xd')](_0x6884('0x1d'),_0x2e5c48[_0x6884('0xe')],_0xbab846);_0x2cb9fb(_0x248ad8[_0x6884('0xd')](0x1f4,_0x2e5c48[_0x6884('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 64139d9..4b0ec79 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 _0x5fd8=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','multer'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0x5fd8,0xf6));var _0x85fd=function(_0x1bea5b,_0x13f0ad){_0x1bea5b=_0x1bea5b-0x0;var _0xe31717=_0x5fd8[_0x1bea5b];return _0xe31717;};'use strict';var multer=require(_0x85fd('0x0'));var util=require(_0x85fd('0x1'));var path=require(_0x85fd('0x2'));var timeout=require('connect-timeout');var express=require(_0x85fd('0x3'));var router=express['Router']();var fs_extra=require(_0x85fd('0x4'));var auth=require(_0x85fd('0x5'));var interaction=require(_0x85fd('0x6'));var config=require(_0x85fd('0x7'));var controller=require(_0x85fd('0x8'));router[_0x85fd('0x9')]('/',auth[_0x85fd('0xa')](),controller[_0x85fd('0xb')]);router['get']('/describe',auth[_0x85fd('0xa')](),controller['describe']);router[_0x85fd('0x9')](_0x85fd('0xc'),auth[_0x85fd('0xa')](),controller[_0x85fd('0xd')]);router['post']('/',auth[_0x85fd('0xa')](),controller[_0x85fd('0xe')]);router['put'](_0x85fd('0xc'),auth[_0x85fd('0xa')](),controller[_0x85fd('0xf')]);router[_0x85fd('0x10')]('/:id',auth[_0x85fd('0xa')](),controller[_0x85fd('0x11')]);module[_0x85fd('0x12')]=router; \ No newline at end of file +var _0x73ed=['../../config/environment','get','isAuthenticated','index','describe','/:id','post','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x203d64,_0x1ec79c){var _0x462ab3=function(_0x55ee6e){while(--_0x55ee6e){_0x203d64['push'](_0x203d64['shift']());}};_0x462ab3(++_0x1ec79c);}(_0x73ed,0x89));var _0xd73e=function(_0x233c3e,_0x260c20){_0x233c3e=_0x233c3e-0x0;var _0x37f1c3=_0x73ed[_0x233c3e];return _0x37f1c3;};'use strict';var multer=require(_0xd73e('0x0'));var util=require(_0xd73e('0x1'));var path=require(_0xd73e('0x2'));var timeout=require('connect-timeout');var express=require(_0xd73e('0x3'));var router=express[_0xd73e('0x4')]();var fs_extra=require(_0xd73e('0x5'));var auth=require(_0xd73e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd73e('0x7'));var controller=require('./whatsappTransferReport.controller');router[_0xd73e('0x8')]('/',auth[_0xd73e('0x9')](),controller[_0xd73e('0xa')]);router[_0xd73e('0x8')]('/describe',auth[_0xd73e('0x9')](),controller[_0xd73e('0xb')]);router['get'](_0xd73e('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xd73e('0xd')]('/',auth[_0xd73e('0x9')](),controller['create']);router['put'](_0xd73e('0xc'),auth[_0xd73e('0x9')](),controller[_0xd73e('0xe')]);router[_0xd73e('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xd73e('0x10')]);module[_0xd73e('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index ea283c6..4cb318f 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 _0x3aa2=['sequelize','exports','ENUM','queue','DATE'];(function(_0x28bbe4,_0x925216){var _0x1ff6fd=function(_0xea064){while(--_0xea064){_0x28bbe4['push'](_0x28bbe4['shift']());}};_0x1ff6fd(++_0x925216);}(_0x3aa2,0x13b));var _0x23aa=function(_0x37e342,_0x160c8f){_0x37e342=_0x37e342-0x0;var _0x1768f9=_0x3aa2[_0x37e342];return _0x1768f9;};'use strict';var Sequelize=require(_0x23aa('0x0'));module[_0x23aa('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x23aa('0x2')]('account','agent',_0x23aa('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x23aa('0x4')]}}; \ No newline at end of file +var _0x2cae=['account','agent','DATE','sequelize','exports'];(function(_0x1559a5,_0x41924e){var _0x17a783=function(_0x152c63){while(--_0x152c63){_0x1559a5['push'](_0x1559a5['shift']());}};_0x17a783(++_0x41924e);}(_0x2cae,0x16b));var _0xe2ca=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x2cae[_0x22f8ab];return _0x2a70e5;};'use strict';var Sequelize=require(_0xe2ca('0x0'));module[_0xe2ca('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe2ca('0x2'),_0xe2ca('0x3'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xe2ca('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index d513e8f..fc7e825 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 _0x08e2=['rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','WhatsappTransferReport','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','rows','catch','params','options','find','create','body','eml-format'];(function(_0x1f5da5,_0x1d02a7){var _0x5f3eba=function(_0x5143d3){while(--_0x5143d3){_0x1f5da5['push'](_0x1f5da5['shift']());}};_0x5f3eba(++_0x1d02a7);}(_0x08e2,0xe0));var _0x208e=function(_0x3c4ae9,_0xed360a){_0x3c4ae9=_0x3c4ae9-0x0;var _0x3230f5=_0x08e2[_0x3c4ae9];return _0x3230f5;};'use strict';var emlformat=require(_0x208e('0x0'));var rimraf=require(_0x208e('0x1'));var zipdir=require(_0x208e('0x2'));var jsonpatch=require(_0x208e('0x3'));var rp=require(_0x208e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x208e('0x5'));var util=require(_0x208e('0x6'));var path=require(_0x208e('0x7'));var sox=require(_0x208e('0x8'));var csv=require(_0x208e('0x9'));var ejs=require(_0x208e('0xa'));var fs=require('fs');var fs_extra=require(_0x208e('0xb'));var _=require(_0x208e('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x208e('0xd'));var deskjs=require(_0x208e('0xe'));var toCsv=require(_0x208e('0x9'));var querystring=require(_0x208e('0xf'));var Papa=require(_0x208e('0x10'));var Redis=require('ioredis');var authService=require(_0x208e('0x11'));var qs=require(_0x208e('0x12'));var as=require(_0x208e('0x13'));var hardwareService=require(_0x208e('0x14'));var logger=require(_0x208e('0x15'))(_0x208e('0x16'));var utils=require(_0x208e('0x17'));var config=require(_0x208e('0x18'));var licenseUtil=require(_0x208e('0x19'));var db=require(_0x208e('0x1a'))['db'];function respondWithStatusCode(_0x1fdf03,_0xc131b1){_0xc131b1=_0xc131b1||0xcc;return function(_0x46afc8){if(_0x46afc8){return _0x1fdf03[_0x208e('0x1b')](_0xc131b1);}return _0x1fdf03[_0x208e('0x1c')](_0xc131b1)[_0x208e('0x1d')]();};}function respondWithResult(_0x228052,_0xc25b69){_0xc25b69=_0xc25b69||0xc8;return function(_0x86dcd5){if(_0x86dcd5){return _0x228052[_0x208e('0x1c')](_0xc25b69)[_0x208e('0x1e')](_0x86dcd5);}};}function respondWithFilteredResult(_0x395a3c,_0x391fb2){return function(_0x4f2d98){if(_0x4f2d98){var _0x48fa20=typeof _0x391fb2[_0x208e('0x1f')]===_0x208e('0x20')&&typeof _0x391fb2[_0x208e('0x21')]===_0x208e('0x20');var _0x1dca9f=_0x4f2d98[_0x208e('0x22')];var _0x5641cc=_0x48fa20?0x0:_0x391fb2[_0x208e('0x1f')];var _0x1b247d=_0x48fa20?_0x4f2d98[_0x208e('0x22')]:_0x391fb2[_0x208e('0x1f')]+_0x391fb2[_0x208e('0x21')];var _0x4be8a5;if(_0x1b247d>=_0x1dca9f){_0x1b247d=_0x1dca9f;_0x4be8a5=0xc8;}else{_0x4be8a5=0xce;}_0x395a3c[_0x208e('0x1c')](_0x4be8a5);return _0x395a3c[_0x208e('0x23')](_0x208e('0x24'),_0x5641cc+'-'+_0x1b247d+'/'+_0x1dca9f)['json'](_0x4f2d98);}return null;};}function patchUpdates(_0x25347f){return function(_0x73c180){try{jsonpatch[_0x208e('0x25')](_0x73c180,_0x25347f,!![]);}catch(_0xc4fab5){return BPromise[_0x208e('0x26')](_0xc4fab5);}return _0x73c180[_0x208e('0x27')]();};}function saveUpdates(_0x275a19,_0x14b509){return function(_0x4e0d69){if(_0x4e0d69){return _0x4e0d69[_0x208e('0x28')](_0x275a19)[_0x208e('0x29')](function(_0x18bc35){return _0x18bc35;});}return null;};}function removeEntity(_0x331d43,_0x1777de){return function(_0x13742f){if(_0x13742f){return _0x13742f['destroy']()[_0x208e('0x29')](function(){_0x331d43[_0x208e('0x1c')](0xcc)[_0x208e('0x1d')]();});}};}function handleEntityNotFound(_0x2cc8b9,_0x5ec5eb){return function(_0x896c4e){if(!_0x896c4e){_0x2cc8b9[_0x208e('0x1b')](0x194);}return _0x896c4e;};}function handleError(_0xcc7d6a,_0xb43d1f){_0xb43d1f=_0xb43d1f||0x1f4;return function(_0x569179){logger[_0x208e('0x2a')](_0x569179[_0x208e('0x2b')]);if(_0x569179[_0x208e('0x2c')]){delete _0x569179[_0x208e('0x2c')];}_0xcc7d6a[_0x208e('0x1c')](_0xb43d1f)[_0x208e('0x2d')](_0x569179);};}exports['index']=function(_0x4600d0,_0x457f73){var _0x1aefba={},_0x34e91c={},_0x39f45b={'count':0x0,'rows':[]};var _0x1f2ae5=_['map'](db[_0x208e('0x2e')][_0x208e('0x2f')],function(_0x44da62){return{'name':_0x44da62[_0x208e('0x30')],'type':_0x44da62['type'][_0x208e('0x31')]};});_0x34e91c[_0x208e('0x32')]=_[_0x208e('0x33')](_0x1f2ae5,'name');_0x34e91c['query']=_['keys'](_0x4600d0[_0x208e('0x34')]);_0x34e91c[_0x208e('0x35')]=_[_0x208e('0x36')](_0x34e91c[_0x208e('0x32')],_0x34e91c['query']);_0x1aefba[_0x208e('0x37')]=_[_0x208e('0x36')](_0x34e91c[_0x208e('0x32')],qs['fields'](_0x4600d0['query'][_0x208e('0x38')]));_0x1aefba[_0x208e('0x37')]=_0x1aefba[_0x208e('0x37')][_0x208e('0x39')]?_0x1aefba[_0x208e('0x37')]:_0x34e91c[_0x208e('0x32')];if(!_0x4600d0[_0x208e('0x34')][_0x208e('0x3a')]('nolimit')){_0x1aefba[_0x208e('0x21')]=qs['limit'](_0x4600d0[_0x208e('0x34')][_0x208e('0x21')]);_0x1aefba[_0x208e('0x1f')]=qs[_0x208e('0x1f')](_0x4600d0[_0x208e('0x34')][_0x208e('0x1f')]);}_0x1aefba['order']=qs[_0x208e('0x3b')](_0x4600d0['query'][_0x208e('0x3b')]);_0x1aefba['where']=qs[_0x208e('0x35')](_[_0x208e('0x3c')](_0x4600d0['query'],_0x34e91c['filters']),_0x1f2ae5);if(_0x4600d0[_0x208e('0x34')][_0x208e('0x3d')]){_0x1aefba[_0x208e('0x3e')]=_[_0x208e('0x3f')](_0x1aefba[_0x208e('0x3e')],{'$or':_['map'](_0x1f2ae5,function(_0x2e9beb){if(_0x2e9beb[_0x208e('0x40')]!==_0x208e('0x41')){var _0xa5a430={};_0xa5a430[_0x2e9beb[_0x208e('0x2c')]]={'$like':'%'+_0x4600d0[_0x208e('0x34')][_0x208e('0x3d')]+'%'};return _0xa5a430;}})});}_0x1aefba=_['merge']({},_0x1aefba,_0x4600d0['options']);var _0x8e5020={'where':_0x1aefba[_0x208e('0x3e')]};return db[_0x208e('0x2e')][_0x208e('0x22')](_0x8e5020)[_0x208e('0x29')](function(_0x346d4f){_0x39f45b['count']=_0x346d4f;if(_0x4600d0[_0x208e('0x34')][_0x208e('0x42')]){_0x1aefba[_0x208e('0x43')]=[{'all':!![]}];}return db[_0x208e('0x2e')]['findAll'](_0x1aefba);})[_0x208e('0x29')](function(_0x4d327f){_0x39f45b[_0x208e('0x44')]=_0x4d327f;return _0x39f45b;})['then'](respondWithFilteredResult(_0x457f73,_0x1aefba))[_0x208e('0x45')](handleError(_0x457f73,null));};exports['show']=function(_0x4d5c9f,_0x5cb1fb){var _0x479b55={'raw':!![],'where':{'id':_0x4d5c9f[_0x208e('0x46')]['id']}},_0x2b82d3={};_0x2b82d3[_0x208e('0x32')]=_['keys'](db[_0x208e('0x2e')][_0x208e('0x2f')]);_0x2b82d3[_0x208e('0x34')]=_['keys'](_0x4d5c9f[_0x208e('0x34')]);_0x2b82d3[_0x208e('0x35')]=_[_0x208e('0x36')](_0x2b82d3['model'],_0x2b82d3[_0x208e('0x34')]);_0x479b55[_0x208e('0x37')]=_[_0x208e('0x36')](_0x2b82d3[_0x208e('0x32')],qs['fields'](_0x4d5c9f[_0x208e('0x34')][_0x208e('0x38')]));_0x479b55[_0x208e('0x37')]=_0x479b55[_0x208e('0x37')][_0x208e('0x39')]?_0x479b55['attributes']:_0x2b82d3['model'];if(_0x4d5c9f[_0x208e('0x34')]['includeAll']){_0x479b55[_0x208e('0x43')]=[{'all':!![]}];}_0x479b55=_[_0x208e('0x3f')]({},_0x479b55,_0x4d5c9f[_0x208e('0x47')]);return db[_0x208e('0x2e')][_0x208e('0x48')](_0x479b55)[_0x208e('0x29')](handleEntityNotFound(_0x5cb1fb,null))['then'](respondWithResult(_0x5cb1fb,null))['catch'](handleError(_0x5cb1fb,null));};exports['create']=function(_0x1dbf5a,_0x409abc){return db[_0x208e('0x2e')][_0x208e('0x49')](_0x1dbf5a[_0x208e('0x4a')],{})[_0x208e('0x29')](respondWithResult(_0x409abc,0xc9))['catch'](handleError(_0x409abc,null));};exports[_0x208e('0x28')]=function(_0x551d94,_0x4a1fff){if(_0x551d94[_0x208e('0x4a')]['id']){delete _0x551d94['body']['id'];}return db['WhatsappTransferReport'][_0x208e('0x48')]({'where':{'id':_0x551d94[_0x208e('0x46')]['id']}})[_0x208e('0x29')](handleEntityNotFound(_0x4a1fff,null))[_0x208e('0x29')](saveUpdates(_0x551d94[_0x208e('0x4a')],null))['then'](respondWithResult(_0x4a1fff,null))[_0x208e('0x45')](handleError(_0x4a1fff,null));};exports['destroy']=function(_0x53b342,_0x3cd855){return db[_0x208e('0x2e')]['find']({'where':{'id':_0x53b342[_0x208e('0x46')]['id']}})[_0x208e('0x29')](handleEntityNotFound(_0x3cd855,null))[_0x208e('0x29')](removeEntity(_0x3cd855,null))[_0x208e('0x45')](handleError(_0x3cd855,null));};exports['describe']=function(_0x4f1ef0,_0x2c35db){return db[_0x208e('0x2e')]['describe']()['then'](respondWithResult(_0x2c35db,null))[_0x208e('0x45')](handleError(_0x2c35db,null));}; \ No newline at end of file +var _0x66e5=['fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','then','destroy','end','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappTransferReport','includeAll','include','findAll','catch','show','params','keys','length','create','update','body','find','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x244231,_0x3a11f3){var _0x22e73a=function(_0x353c62){while(--_0x353c62){_0x244231['push'](_0x244231['shift']());}};_0x22e73a(++_0x3a11f3);}(_0x66e5,0x1a1));var _0x566e=function(_0xf02353,_0x5d599b){_0xf02353=_0xf02353-0x0;var _0x59f7df=_0x66e5[_0xf02353];return _0x59f7df;};'use strict';var emlformat=require(_0x566e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x566e('0x1'));var rp=require('request-promise');var moment=require(_0x566e('0x2'));var BPromise=require(_0x566e('0x3'));var Mustache=require(_0x566e('0x4'));var util=require(_0x566e('0x5'));var path=require(_0x566e('0x6'));var sox=require('sox');var csv=require(_0x566e('0x7'));var ejs=require(_0x566e('0x8'));var fs=require('fs');var fs_extra=require(_0x566e('0x9'));var _=require(_0x566e('0xa'));var squel=require('squel');var crypto=require(_0x566e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x566e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x566e('0xd'));var Papa=require(_0x566e('0xe'));var Redis=require(_0x566e('0xf'));var authService=require(_0x566e('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x566e('0x11'));var logger=require(_0x566e('0x12'))(_0x566e('0x13'));var utils=require(_0x566e('0x14'));var config=require(_0x566e('0x15'));var licenseUtil=require(_0x566e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c0ef8,_0x4e2f16){_0x4e2f16=_0x4e2f16||0xcc;return function(_0x5de6b6){if(_0x5de6b6){return _0x5c0ef8[_0x566e('0x17')](_0x4e2f16);}return _0x5c0ef8[_0x566e('0x18')](_0x4e2f16)['end']();};}function respondWithResult(_0x442069,_0xc3c237){_0xc3c237=_0xc3c237||0xc8;return function(_0x4f05db){if(_0x4f05db){return _0x442069[_0x566e('0x18')](_0xc3c237)[_0x566e('0x19')](_0x4f05db);}};}function respondWithFilteredResult(_0x58bd4d,_0x2c14f0){return function(_0xb7653e){if(_0xb7653e){var _0x5d373a=typeof _0x2c14f0[_0x566e('0x1a')]==='undefined'&&typeof _0x2c14f0[_0x566e('0x1b')]===_0x566e('0x1c');var _0x41bf1d=_0xb7653e[_0x566e('0x1d')];var _0x162b51=_0x5d373a?0x0:_0x2c14f0[_0x566e('0x1a')];var _0x326017=_0x5d373a?_0xb7653e['count']:_0x2c14f0[_0x566e('0x1a')]+_0x2c14f0[_0x566e('0x1b')];var _0x3a114a;if(_0x326017>=_0x41bf1d){_0x326017=_0x41bf1d;_0x3a114a=0xc8;}else{_0x3a114a=0xce;}_0x58bd4d[_0x566e('0x18')](_0x3a114a);return _0x58bd4d[_0x566e('0x1e')]('Content-Range',_0x162b51+'-'+_0x326017+'/'+_0x41bf1d)[_0x566e('0x19')](_0xb7653e);}return null;};}function patchUpdates(_0x52e5a0){return function(_0x2da3d8){try{jsonpatch['apply'](_0x2da3d8,_0x52e5a0,!![]);}catch(_0x3010f8){return BPromise['reject'](_0x3010f8);}return _0x2da3d8['save']();};}function saveUpdates(_0x51946d,_0x462279){return function(_0x500ca4){if(_0x500ca4){return _0x500ca4['update'](_0x51946d)[_0x566e('0x1f')](function(_0x307360){return _0x307360;});}return null;};}function removeEntity(_0x208a3c,_0x33e243){return function(_0x29a187){if(_0x29a187){return _0x29a187[_0x566e('0x20')]()[_0x566e('0x1f')](function(){_0x208a3c[_0x566e('0x18')](0xcc)[_0x566e('0x21')]();});}};}function handleEntityNotFound(_0x46365a,_0xdae9e1){return function(_0x4ed6e8){if(!_0x4ed6e8){_0x46365a[_0x566e('0x17')](0x194);}return _0x4ed6e8;};}function handleError(_0x12379c,_0x86e6e7){_0x86e6e7=_0x86e6e7||0x1f4;return function(_0x174d30){logger['error'](_0x174d30['stack']);if(_0x174d30[_0x566e('0x22')]){delete _0x174d30[_0x566e('0x22')];}_0x12379c['status'](_0x86e6e7)[_0x566e('0x23')](_0x174d30);};}exports[_0x566e('0x24')]=function(_0x443465,_0xa86122){var _0x1bd117={},_0x5154a1={},_0x96717f={'count':0x0,'rows':[]};var _0x4c229a=_['map'](db['WhatsappTransferReport'][_0x566e('0x25')],function(_0xb0027a){return{'name':_0xb0027a[_0x566e('0x26')],'type':_0xb0027a[_0x566e('0x27')][_0x566e('0x28')]};});_0x5154a1[_0x566e('0x29')]=_[_0x566e('0x2a')](_0x4c229a,_0x566e('0x22'));_0x5154a1[_0x566e('0x2b')]=_['keys'](_0x443465[_0x566e('0x2b')]);_0x5154a1[_0x566e('0x2c')]=_[_0x566e('0x2d')](_0x5154a1[_0x566e('0x29')],_0x5154a1[_0x566e('0x2b')]);_0x1bd117[_0x566e('0x2e')]=_['intersection'](_0x5154a1[_0x566e('0x29')],qs[_0x566e('0x2f')](_0x443465[_0x566e('0x2b')][_0x566e('0x2f')]));_0x1bd117['attributes']=_0x1bd117[_0x566e('0x2e')]['length']?_0x1bd117[_0x566e('0x2e')]:_0x5154a1[_0x566e('0x29')];if(!_0x443465[_0x566e('0x2b')]['hasOwnProperty'](_0x566e('0x30'))){_0x1bd117['limit']=qs[_0x566e('0x1b')](_0x443465[_0x566e('0x2b')][_0x566e('0x1b')]);_0x1bd117[_0x566e('0x1a')]=qs[_0x566e('0x1a')](_0x443465[_0x566e('0x2b')][_0x566e('0x1a')]);}_0x1bd117[_0x566e('0x31')]=qs[_0x566e('0x32')](_0x443465[_0x566e('0x2b')]['sort']);_0x1bd117[_0x566e('0x33')]=qs['filters'](_[_0x566e('0x34')](_0x443465[_0x566e('0x2b')],_0x5154a1[_0x566e('0x2c')]),_0x4c229a);if(_0x443465[_0x566e('0x2b')][_0x566e('0x35')]){_0x1bd117[_0x566e('0x33')]=_[_0x566e('0x36')](_0x1bd117[_0x566e('0x33')],{'$or':_[_0x566e('0x2a')](_0x4c229a,function(_0x1b3abb){if(_0x1b3abb[_0x566e('0x27')]!==_0x566e('0x37')){var _0x394518={};_0x394518[_0x1b3abb[_0x566e('0x22')]]={'$like':'%'+_0x443465[_0x566e('0x2b')][_0x566e('0x35')]+'%'};return _0x394518;}})});}_0x1bd117=_[_0x566e('0x36')]({},_0x1bd117,_0x443465[_0x566e('0x38')]);var _0x282ac2={'where':_0x1bd117[_0x566e('0x33')]};return db[_0x566e('0x39')][_0x566e('0x1d')](_0x282ac2)[_0x566e('0x1f')](function(_0x4f6491){_0x96717f[_0x566e('0x1d')]=_0x4f6491;if(_0x443465['query'][_0x566e('0x3a')]){_0x1bd117[_0x566e('0x3b')]=[{'all':!![]}];}return db[_0x566e('0x39')][_0x566e('0x3c')](_0x1bd117);})[_0x566e('0x1f')](function(_0x2cdacc){_0x96717f['rows']=_0x2cdacc;return _0x96717f;})['then'](respondWithFilteredResult(_0xa86122,_0x1bd117))[_0x566e('0x3d')](handleError(_0xa86122,null));};exports[_0x566e('0x3e')]=function(_0x6d03d0,_0x31b904){var _0x86ee97={'raw':!![],'where':{'id':_0x6d03d0[_0x566e('0x3f')]['id']}},_0x213a42={};_0x213a42['model']=_[_0x566e('0x40')](db[_0x566e('0x39')]['rawAttributes']);_0x213a42['query']=_['keys'](_0x6d03d0[_0x566e('0x2b')]);_0x213a42[_0x566e('0x2c')]=_[_0x566e('0x2d')](_0x213a42[_0x566e('0x29')],_0x213a42[_0x566e('0x2b')]);_0x86ee97[_0x566e('0x2e')]=_[_0x566e('0x2d')](_0x213a42[_0x566e('0x29')],qs[_0x566e('0x2f')](_0x6d03d0[_0x566e('0x2b')][_0x566e('0x2f')]));_0x86ee97[_0x566e('0x2e')]=_0x86ee97[_0x566e('0x2e')][_0x566e('0x41')]?_0x86ee97['attributes']:_0x213a42[_0x566e('0x29')];if(_0x6d03d0[_0x566e('0x2b')][_0x566e('0x3a')]){_0x86ee97[_0x566e('0x3b')]=[{'all':!![]}];}_0x86ee97=_[_0x566e('0x36')]({},_0x86ee97,_0x6d03d0[_0x566e('0x38')]);return db[_0x566e('0x39')]['find'](_0x86ee97)[_0x566e('0x1f')](handleEntityNotFound(_0x31b904,null))[_0x566e('0x1f')](respondWithResult(_0x31b904,null))[_0x566e('0x3d')](handleError(_0x31b904,null));};exports[_0x566e('0x42')]=function(_0x5ba5f0,_0x3d6b0e){return db[_0x566e('0x39')]['create'](_0x5ba5f0['body'],{})['then'](respondWithResult(_0x3d6b0e,0xc9))[_0x566e('0x3d')](handleError(_0x3d6b0e,null));};exports[_0x566e('0x43')]=function(_0x2aaf46,_0x3e02c2){if(_0x2aaf46['body']['id']){delete _0x2aaf46[_0x566e('0x44')]['id'];}return db[_0x566e('0x39')]['find']({'where':{'id':_0x2aaf46['params']['id']}})[_0x566e('0x1f')](handleEntityNotFound(_0x3e02c2,null))[_0x566e('0x1f')](saveUpdates(_0x2aaf46[_0x566e('0x44')],null))[_0x566e('0x1f')](respondWithResult(_0x3e02c2,null))[_0x566e('0x3d')](handleError(_0x3e02c2,null));};exports[_0x566e('0x20')]=function(_0xe7565b,_0x20aadb){return db['WhatsappTransferReport'][_0x566e('0x45')]({'where':{'id':_0xe7565b['params']['id']}})[_0x566e('0x1f')](handleEntityNotFound(_0x20aadb,null))[_0x566e('0x1f')](removeEntity(_0x20aadb,null))[_0x566e('0x3d')](handleError(_0x20aadb,null));};exports[_0x566e('0x46')]=function(_0x3d1216,_0x8cecc5){return db['WhatsappTransferReport'][_0x566e('0x46')]()['then'](respondWithResult(_0x8cecc5,null))[_0x566e('0x3d')](handleError(_0x8cecc5,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index ae4fe5b..be9f7ec 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 _0xf2d9=['api','moment','request-promise','path','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xf2d9,0x1c7));var _0x9f2d=function(_0x3005ce,_0x551f91){_0x3005ce=_0x3005ce-0x0;var _0x141beb=_0xf2d9[_0x3005ce];return _0x141beb;};'use strict';var _=require(_0x9f2d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9f2d('0x1'));var moment=require(_0x9f2d('0x2'));var BPromise=require('bluebird');var rp=require(_0x9f2d('0x3'));var fs=require('fs');var path=require(_0x9f2d('0x4'));var rimraf=require('rimraf');var config=require(_0x9f2d('0x5'));var attributes=require(_0x9f2d('0x6'));module[_0x9f2d('0x7')]=function(_0x2b175e,_0x5b4433){return _0x2b175e[_0x9f2d('0x8')](_0x9f2d('0x9'),attributes,{'tableName':_0x9f2d('0xa'),'paranoid':![],'indexes':[{'name':_0x9f2d('0xb'),'fields':[_0x9f2d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x29a1=['rimraf','../../config/environment','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','moment','request-promise','path'];(function(_0x134448,_0x591d7b){var _0x2d52a1=function(_0x56b840){while(--_0x56b840){_0x134448['push'](_0x134448['shift']());}};_0x2d52a1(++_0x591d7b);}(_0x29a1,0xe2));var _0x129a=function(_0x43ff8c,_0x51976f){_0x43ff8c=_0x43ff8c-0x0;var _0x4de11c=_0x29a1[_0x43ff8c];return _0x4de11c;};'use strict';var _=require(_0x129a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x129a('0x1'));var BPromise=require('bluebird');var rp=require(_0x129a('0x2'));var fs=require('fs');var path=require(_0x129a('0x3'));var rimraf=require(_0x129a('0x4'));var config=require(_0x129a('0x5'));var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x956e5c,_0x1e986b){return _0x956e5c[_0x129a('0x6')](_0x129a('0x7'),attributes,{'tableName':_0x129a('0x8'),'paranoid':![],'indexes':[{'name':_0x129a('0x9'),'fields':[_0x129a('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 92c05c0..34b2e6b 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 _0xdedc=['WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0xdedc,0x178));var _0xcded=function(_0x5c9844,_0x14354f){_0x5c9844=_0x5c9844-0x0;var _0x3663b8=_0xdedc[_0x5c9844];return _0x3663b8;};'use strict';var _=require('lodash');var util=require(_0xcded('0x0'));var moment=require(_0xcded('0x1'));var BPromise=require(_0xcded('0x2'));var rs=require(_0xcded('0x3'));var fs=require('fs');var Redis=require(_0xcded('0x4'));var db=require(_0xcded('0x5'))['db'];var utils=require(_0xcded('0x6'));var logger=require(_0xcded('0x7'))(_0xcded('0x8'));var config=require(_0xcded('0x9'));var jayson=require(_0xcded('0xa'));var client=jayson[_0xcded('0xb')][_0xcded('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ac8e6,_0xaf9b06,_0x1d0749){return new BPromise(function(_0x52faf5,_0x23d3f5){return client['request'](_0x4ac8e6,_0x1d0749)[_0xcded('0xd')](function(_0xcb3150){logger[_0xcded('0xe')](_0xcded('0xf'),_0xaf9b06,_0xcded('0x10'));logger['debug'](_0xcded('0x11'),_0xaf9b06,_0xcded('0x10'),JSON[_0xcded('0x12')](_0xcb3150));if(_0xcb3150[_0xcded('0x13')]){if(_0xcb3150[_0xcded('0x13')]['code']===0x1f4){logger[_0xcded('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0xaf9b06,_0xcb3150[_0xcded('0x13')][_0xcded('0x14')]);return _0x23d3f5(_0xcb3150[_0xcded('0x13')][_0xcded('0x14')]);}logger['error'](_0xcded('0xf'),_0xaf9b06,_0xcb3150[_0xcded('0x13')]['message']);return _0x52faf5(_0xcb3150['error'][_0xcded('0x14')]);}else{logger[_0xcded('0xe')](_0xcded('0xf'),_0xaf9b06,_0xcded('0x10'));_0x52faf5(_0xcb3150[_0xcded('0x15')][_0xcded('0x14')]);}})[_0xcded('0x16')](function(_0x4c49f1){logger[_0xcded('0x13')](_0xcded('0xf'),_0xaf9b06,_0x4c49f1);_0x23d3f5(_0x4c49f1);});});} \ No newline at end of file +var _0x26f1=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','info','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','WhatsappTransferReport,\x20%s,\x20%s','error','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x26f1,0xb4));var _0x126f=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x26f1[_0x273c39];return _0x46d6b5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x126f('0x0'));var BPromise=require('bluebird');var rs=require(_0x126f('0x1'));var fs=require('fs');var Redis=require(_0x126f('0x2'));var db=require(_0x126f('0x3'))['db'];var utils=require(_0x126f('0x4'));var logger=require(_0x126f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x126f('0x6'));var client=jayson[_0x126f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x314bfa,_0x265511,_0x38646e){return new BPromise(function(_0x3e6c12,_0x4d820c){return client[_0x126f('0x8')](_0x314bfa,_0x38646e)['then'](function(_0x1a6d08){logger[_0x126f('0x9')]('WhatsappTransferReport,\x20%s,\x20%s',_0x265511,_0x126f('0xa'));logger[_0x126f('0xb')](_0x126f('0xc'),_0x265511,_0x126f('0xa'),JSON[_0x126f('0xd')](_0x1a6d08));if(_0x1a6d08['error']){if(_0x1a6d08['error'][_0x126f('0xe')]===0x1f4){logger['error'](_0x126f('0xf'),_0x265511,_0x1a6d08[_0x126f('0x10')][_0x126f('0x11')]);return _0x4d820c(_0x1a6d08[_0x126f('0x10')][_0x126f('0x11')]);}logger['error'](_0x126f('0xf'),_0x265511,_0x1a6d08[_0x126f('0x10')][_0x126f('0x11')]);return _0x3e6c12(_0x1a6d08['error'][_0x126f('0x11')]);}else{logger['info'](_0x126f('0xf'),_0x265511,_0x126f('0xa'));_0x3e6c12(_0x1a6d08['result']['message']);}})['catch'](function(_0x3d92c8){logger[_0x126f('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x265511,_0x3d92c8);_0x4d820c(_0x3d92c8);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 304624b..a4714c1 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6cf1=['./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','then','listen','info','start','map','name','Offline\x20apps:','status','online','join','None','./config/seedDB','./config/license','default','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/pm2'];(function(_0x11f818,_0x30eac0){var _0x4bdb2f=function(_0x5b9ddd){while(--_0x5b9ddd){_0x11f818['push'](_0x11f818['shift']());}};_0x4bdb2f(++_0x30eac0);}(_0x6cf1,0x111));var _0x16cf=function(_0x1176e9,_0x2bc354){_0x1176e9=_0x1176e9-0x0;var _0x4a3e50=_0x6cf1[_0x1176e9];return _0x4a3e50;};'use strict';var _=require(_0x16cf('0x0'));var mysqldb=require('./mysqldb');var rpc=require('./rpc');var config=require('./config/environment');var logger=require('./config/logger')('app');var pm2=require(_0x16cf('0x1'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x16cf('0x2'));var chat=require(_0x16cf('0x3'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x16cf('0x4'));function main(){return mysqldb['db'][_0x16cf('0x5')][_0x16cf('0x6')]()[_0x16cf('0x7')](function(){return rpc[_0x16cf('0x8')]();})[_0x16cf('0x7')](function(_0x2b1e89){logger[_0x16cf('0x9')](_0x2b1e89);return chat[_0x16cf('0xa')]();})[_0x16cf('0x7')](function(){return whatsapp[_0x16cf('0xa')]();})['then'](function(){return schedule[_0x16cf('0xa')]();})[_0x16cf('0x7')](function(){return transcribe[_0x16cf('0xa')]();})[_0x16cf('0x7')](function(_0x2aa6f8){logger[_0x16cf('0x9')](_0x2aa6f8);return pm2['start'](pm2Config);})['then'](function(_0x4af601){logger['info']('Online\x20apps:',_[_0x16cf('0xb')](_['filter'](_0x4af601,{'status':'online'}),_0x16cf('0xc'))['join']());logger[_0x16cf('0x9')](_0x16cf('0xd'),_[_0x16cf('0xb')](_['filter'](_0x4af601,function(_0x2a2a95){return _0x2a2a95[_0x16cf('0xe')]!==_0x16cf('0xf');}),_0x16cf('0xc'))[_0x16cf('0x10')]()||_0x16cf('0x11'));config['seedDB']&&require(_0x16cf('0x12'))['default']();require(_0x16cf('0x13'))[_0x16cf('0x14')]();})[_0x16cf('0x15')](function(_0x1bab99){logger[_0x16cf('0x16')](_0x16cf('0x17'),_0x1bab99);process[_0x16cf('0x18')](0x1);});}main(); \ No newline at end of file +var _0xf393=['seedDB','./config/seedDB','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./rpc','./config/environment','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','info','start','then','Online\x20apps:','map','name','join','Offline\x20apps:','filter','status','online','None'];(function(_0x6f279d,_0x44eb44){var _0x55dd18=function(_0x3dcf4c){while(--_0x3dcf4c){_0x6f279d['push'](_0x6f279d['shift']());}};_0x55dd18(++_0x44eb44);}(_0xf393,0x189));var _0x3f39=function(_0x268f68,_0x5e8daf){_0x268f68=_0x268f68-0x0;var _0x4d76c8=_0xf393[_0x268f68];return _0x4d76c8;};'use strict';var _=require(_0x3f39('0x0'));var mysqldb=require(_0x3f39('0x1'));var rpc=require(_0x3f39('0x2'));var config=require(_0x3f39('0x3'));var logger=require('./config/logger')(_0x3f39('0x4'));var pm2=require(_0x3f39('0x5'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x3f39('0x6'));var chat=require(_0x3f39('0x7'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x3f39('0x8'));function main(){return mysqldb['db'][_0x3f39('0x9')][_0x3f39('0xa')]()['then'](function(){return rpc['listen']();})['then'](function(_0x3fa07f){logger[_0x3f39('0xb')](_0x3fa07f);return chat[_0x3f39('0xc')]();})[_0x3f39('0xd')](function(){return whatsapp[_0x3f39('0xc')]();})[_0x3f39('0xd')](function(){return schedule[_0x3f39('0xc')]();})[_0x3f39('0xd')](function(){return transcribe[_0x3f39('0xc')]();})[_0x3f39('0xd')](function(_0x5c6798){logger[_0x3f39('0xb')](_0x5c6798);return pm2[_0x3f39('0xc')](pm2Config);})[_0x3f39('0xd')](function(_0x1745ef){logger[_0x3f39('0xb')](_0x3f39('0xe'),_[_0x3f39('0xf')](_['filter'](_0x1745ef,{'status':'online'}),_0x3f39('0x10'))[_0x3f39('0x11')]());logger[_0x3f39('0xb')](_0x3f39('0x12'),_[_0x3f39('0xf')](_[_0x3f39('0x13')](_0x1745ef,function(_0x1df8bb){return _0x1df8bb[_0x3f39('0x14')]!==_0x3f39('0x15');}),_0x3f39('0x10'))[_0x3f39('0x11')]()||_0x3f39('0x16'));config[_0x3f39('0x17')]&&require(_0x3f39('0x18'))['default']();require('./config/license')['default']();})['catch'](function(_0x1898a1){logger['error'](_0x3f39('0x19'),_0x1898a1);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 4a9d5ff..ad912b0 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 _0x233a=['query','apikey','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','add','minutes','catch','Unknown\x20authorization\x20format','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','split','join','promisify','sign','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','secrets','session','name','internal','email','userpic','permissions','voicePause','chatPause','mailPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','isAuthenticated','use','user','ChatInteraction','findOne','params','disposition','status','unmanaged','json','Unmanaged.','Forbidden.','headers','authorization','startsWith','Basic','User','find','then','authenticate','Wrong\x20credentials.','Bearer'];(function(_0x563ee7,_0x1abd07){var _0x3f38c2=function(_0x2ac48c){while(--_0x2ac48c){_0x563ee7['push'](_0x563ee7['shift']());}};_0x3f38c2(++_0x1abd07);}(_0x233a,0x137));var _0xa233=function(_0x4a7427,_0x56c965){_0x4a7427=_0x4a7427-0x0;var _0x286638=_0x233a[_0x4a7427];return _0x286638;};'use strict';var db=require(_0xa233('0x0'))['db'];var config=require(_0xa233('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require(_0xa233('0x2'));var _=require(_0xa233('0x3'));var jwt=require(_0xa233('0x4'));var expressJwt=require(_0xa233('0x5'));var compose=require(_0xa233('0x6'));var basicAuth=require(_0xa233('0x7'));var crypto=require('crypto');var BPromise=require(_0xa233('0x8'));var util=require(_0xa233('0x9'));var moment=require(_0xa233('0xa'));var validateJwt=expressJwt({'secret':config[_0xa233('0xb')][_0xa233('0xc')]});var userAttributes=['id','role','fullname',_0xa233('0xd'),_0xa233('0xe'),_0xa233('0xf'),_0xa233('0x10'),_0xa233('0x11'),'md5secret',_0xa233('0x12'),_0xa233('0x13'),_0xa233('0x14'),_0xa233('0x15'),'smsPause',_0xa233('0x16'),_0xa233('0x17'),_0xa233('0x18'),_0xa233('0x19'),_0xa233('0x1a'),_0xa233('0x1b'),_0xa233('0x1c'),'passwordResetAt',_0xa233('0x1d'),_0xa233('0x1e'),_0xa233('0x1f'),_0xa233('0x20'),'phoneBarEnableRecording','phoneBarEnableDtmfTone',_0xa233('0x21'),_0xa233('0x22'),'phoneBarPrefixRequired',_0xa233('0x23'),_0xa233('0x24'),_0xa233('0x25'),_0xa233('0x26'),_0xa233('0x27'),'privacyEnabled',_0xa233('0x28'),_0xa233('0x29'),_0xa233('0x2a'),_0xa233('0x2b'),_0xa233('0x2c')];exports['isChatInteractionAuthorized']=function(){return this[_0xa233('0x2d')](!![])[_0xa233('0x2e')](function(_0x5ded34,_0x377814,_0x4a3538){if(_0x5ded34[_0xa233('0x2f')]){_0x4a3538();}else{return db[_0xa233('0x30')][_0xa233('0x31')]({'where':{'id':_0x5ded34[_0xa233('0x32')]['id']},'attributes':['id','closed',_0xa233('0x33')],'raw':!![]})['then'](function(_0x5f85d){if(_0x5f85d&&_0x5f85d['closed']){return _0x377814[_0xa233('0x34')](_0x5f85d[_0xa233('0x33')]===_0xa233('0x35')?0x195:0x193)[_0xa233('0x36')]({'message':_0x5f85d[_0xa233('0x33')]===_0xa233('0x35')?_0xa233('0x37'):_0xa233('0x38')});}else{_0x4a3538();}})['catch'](function(_0x2bd171){_0x4a3538(_0x2bd171);});}});};exports['isAuthenticated']=function isAuthenticated(_0x540c24){return compose()[_0xa233('0x2e')](function(_0x1b2fab,_0x16d6f0,_0x56cc7e){var _0x1c6b37;if(_0x1b2fab[_0xa233('0x39')][_0xa233('0x3a')]){if(_[_0xa233('0x3b')](_0x1b2fab[_0xa233('0x39')]['authorization'],_0xa233('0x3c'))){var _0x5409a7=basicAuth(_0x1b2fab);db[_0xa233('0x3d')][_0xa233('0x3e')]({'where':{'name':_0x5409a7['name']}})[_0xa233('0x3f')](function(_0x119609){if(!_0x119609||!_0x119609[_0xa233('0x40')](_0x5409a7['pass'])){return _0x16d6f0['status'](0x191)[_0xa233('0x36')]({'message':_0xa233('0x41')});}_0x1b2fab[_0xa233('0x2f')]={'id':_0x119609['id']};_0x56cc7e();})['catch'](function(_0x87556b){_0x56cc7e(_0x87556b);});}else if(_[_0xa233('0x3b')](_0x1b2fab[_0xa233('0x39')][_0xa233('0x3a')],_0xa233('0x42'))){validateJwt(_0x1b2fab,_0x16d6f0,_0x56cc7e);}else{if(_0x540c24){_0x56cc7e();}else{return _0x16d6f0[_0xa233('0x34')](0x193)[_0xa233('0x36')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x1b2fab[_0xa233('0x43')][_0xa233('0x44')]){try{var _0x1ab0be={'audience':hardwareConf[_0xa233('0x45')](),'issuer':hardwareConf[_0xa233('0x45')]()};verifyJwt(_0x1b2fab['query'][_0xa233('0x44')],_0x1ab0be)[_0xa233('0x3f')](function(_0x20f8cb){return db[_0xa233('0x3d')]['find']({'where':{'id':_0x20f8cb[_0xa233('0x46')]}})[_0xa233('0x3f')](function(_0x29c741){_0x1c6b37=_0x29c741;return db[_0xa233('0x47')][_0xa233('0x31')]({'where':{'id':0x1},'attributes':[_0xa233('0x48'),_0xa233('0x49')],'raw':!![]});})[_0xa233('0x3f')](function(_0x246ca9){if(!_0x1c6b37||!_[_0xa233('0x4a')](_0x1c6b37[_0xa233('0x4b')],_0x20f8cb[_0xa233('0x4c')])){return _0x16d6f0[_0xa233('0x34')](0x191)['json']({'message':_0xa233('0x4d')});}if(_0x1c6b37[_0xa233('0x4e')]){return _0x16d6f0[_0xa233('0x34')](0x191)[_0xa233('0x36')]({'message':_0xa233('0x4f')});}if(_0x1c6b37['blocked']){if(_0x246ca9[_0xa233('0x49')]>0x0){if(moment(_0x1c6b37['blockedAt'])[_0xa233('0x50')](_0x246ca9[_0xa233('0x49')],_0xa233('0x51'))>moment()){return _0x16d6f0[_0xa233('0x34')](0x191)['json']({'message':_0xa233('0x4f')});}}else{return _0x16d6f0[_0xa233('0x34')](0x191)[_0xa233('0x36')]({'message':_0xa233('0x4f')});}}_0x1b2fab[_0xa233('0x2f')]={'id':_0x1c6b37['id']};_0x56cc7e();});})[_0xa233('0x52')](function(){return _0x16d6f0[_0xa233('0x34')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x20b7ba){_0x56cc7e(_0x20b7ba);}}else if(_0x540c24){_0x56cc7e();}else{return _0x16d6f0['status'](0x193)[_0xa233('0x36')]({'message':_0xa233('0x53')});}})['use'](function(_0x5d831f,_0x1243bf,_0x58933f){if(_0x5d831f[_0xa233('0x2f')]){db[_0xa233('0x3d')][_0xa233('0x3e')]({'where':{'id':_0x5d831f[_0xa233('0x2f')]['id']},'attributes':userAttributes})['then'](function(_0x5bbbe3){if(!_0x5bbbe3){return _0x1243bf[_0xa233('0x34')](0x194)[_0xa233('0x36')]({'message':'User\x20not\x20found.'});}_0x5d831f['user']=_0x5bbbe3;_0x58933f();})['catch'](function(_0x4061a9){_0x58933f(_0x4061a9);});}else if(_0x540c24){_0x58933f();}else{return _0x1243bf['status'](0x194)[_0xa233('0x36')]({'message':_0xa233('0x54')});}});};exports[_0xa233('0x55')]=function canUpdate(){return compose()['use'](function(_0x397ccb,_0x56235f,_0x1d67af){return licenseUtil[_0xa233('0x56')]()[_0xa233('0x3f')](function(_0x15de2c){if(_0x15de2c[_0xa233('0x57')]){_0x1d67af();}else{return _0x56235f[_0xa233('0x34')](0x193)[_0xa233('0x36')]({'message':_0xa233('0x58')});}})[_0xa233('0x52')](function(_0x28e27e){_0x1d67af(_0x28e27e);});});};exports[_0xa233('0x59')]=function(_0xffa058,_0x2b9618,_0x287605){_0xffa058[_0xa233('0x59')]=!![];return _0x287605();};exports[_0xa233('0x5a')]=function signToken(_0x4b4147){return signJwt(_0x4b4147);};exports[_0xa233('0x5b')]=function(_0xdd81e1,_0x3a6f2e){if(!_0xdd81e1[_0xa233('0x2f')]){return _0x3a6f2e[_0xa233('0x34')](0x194)[_0xa233('0x36')]({'message':_0xa233('0x5c')});}var _0x4fd344={'payload':{'id':_0xdd81e1['user']['id'],'role':_0xdd81e1[_0xa233('0x2f')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x4fd344)['then'](function(_0x161a32){_0x3a6f2e[_0xa233('0x5d')](_0xa233('0x5e'),_0x161a32);_0x3a6f2e[_0xa233('0x5f')](_0xa233('0x60'));})[_0xa233('0x52')](function(_0x31203f){return _0x3a6f2e['status'](0x1f4)[_0xa233('0x61')](_0x31203f);});};exports[_0xa233('0x62')]=function(_0x46ef99){if(_[_0xa233('0x63')](_0x46ef99[_0xa233('0x4b')])||_[_0xa233('0x63')](_0x46ef99[_0xa233('0x64')])){return null;}else{return createJwt(_0x46ef99);}};exports[_0xa233('0x65')]=function(_0xfea848){_0xfea848[_0xa233('0x4b')]=generateNonce();_0xfea848[_0xa233('0x64')]=generateIssuedAt();return createJwt(_0xfea848);};exports[_0xa233('0x66')]=function(_0xfdf209,_0x3a3489){var _0x51b5ba=_0xfdf209[_0xa233('0x43')][_0xa233('0x44')];if(_0x51b5ba){var _0x2ad39e={'nonce':_0x3a3489[_0xa233('0x4b')],'iat':_0x3a3489['apiKeyIat'],'audience':hardwareConf[_0xa233('0x45')](),'issuer':hardwareConf[_0xa233('0x45')]()};return verifyJwt(_0x51b5ba,_0x2ad39e)['then'](function(){return generateApiKey(_0x3a3489);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xa233('0x67')]=function(_0x331176){var _0x39ece1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x39ece1[_0xa233('0x68')](_0x331176))throw new db[(_0xa233('0x69'))]['ValidationError'](_0xa233('0x6a'));return;};exports[_0xa233('0x6b')]=function(_0x35a370,_0x307324,_0x508020){var _0x968e44=encryptor[_0xa233('0x6c')](_0x307324)['split'](',');for(var _0x174a86=0x0;_0x174a86<_0x508020;_0x174a86++){if(!_0x968e44[_0x174a86])break;if(_0x35a370['toLowerCase']()===_0x968e44[_0x174a86]['toLowerCase']()){var _0x4ace24=util[_0xa233('0x6d')](_0xa233('0x6e'),_0x508020);if(_0x508020===0x1){_0x4ace24='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db['Sequelize'][(_0xa233('0x6f'))](_0x4ace24);}}return;};exports[_0xa233('0x70')]=function(_0x3a42f8,_0x5b2a43){var _0x53b75f=_0x5b2a43?encryptor['decryptString'](_0x5b2a43)[_0xa233('0x71')](','):[];if(_0x53b75f['length']===0x5){_0x53b75f['splice'](-0x1,0x1);}_0x53b75f['unshift'](_0x3a42f8);return encryptor['encryptString'](_0x53b75f[_0xa233('0x72')](','));};function signJwt(_0x237112){var _0x45c1d6=BPromise[_0xa233('0x73')](jwt[_0xa233('0x74')],{'context':jwt});var _0x368c17=_0x237112['secret']||config[_0xa233('0xb')][_0xa233('0xc')];return new BPromise(function(_0x4568e8,_0x1740b3){_0x45c1d6(_0x237112[_0xa233('0x75')],_0x368c17,_0x237112[_0xa233('0x76')])[_0xa233('0x3f')](function(_0x50ece1){_0x4568e8(_0x50ece1);})[_0xa233('0x52')](function(_0xb0fda9){_0x1740b3(_0xb0fda9);});});}function verifyJwt(_0x50ca55,_0x331a44,_0x4a5414){var _0x47c760=BPromise[_0xa233('0x73')](jwt[_0xa233('0x77')],{'context':jwt});var _0xc13a8b=_0x4a5414||config[_0xa233('0xb')][_0xa233('0xc')];return new BPromise(function(_0x196fd1,_0x23afed){_0x47c760(_0x50ca55,_0xc13a8b,_0x331a44)['then'](function(_0x346fa2){_0x196fd1(_0x346fa2);})[_0xa233('0x52')](function(_0x28fd51){_0x23afed(_0x28fd51);});});}function generateNonce(){return crypto[_0xa233('0x78')](0x10)[_0xa233('0x79')](_0xa233('0x7a'));}function generateIssuedAt(){return Math[_0xa233('0x7b')](Date[_0xa233('0x7c')]()/0x3e8)[_0xa233('0x79')]();}function createJwt(_0x5aa82a){var _0x4cd7ca={'payload':{'iat':_0x5aa82a[_0xa233('0x64')],'nonce':_0x5aa82a['apiKeyNonce']},'options':{'algorithm':_0xa233('0x7d'),'subject':_0x5aa82a['id']['toString'](),'issuer':hardwareConf[_0xa233('0x45')](),'audience':hardwareConf[_0xa233('0x45')]()}};return signJwt(_0x4cd7ca)[_0xa233('0x3f')](function(_0x20c3d0){return{'iat':_0x5aa82a['apiKeyIat'],'nonce':_0x5aa82a[_0xa233('0x4b')],'token':_0x20c3d0};});} \ No newline at end of file +var _0x5a17=['headers','Bearer','Unknown\x20authorization\x20format','query','getUuid','apikey','User','find','sub','Setting','blockDuration','isEqual','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','Invalid\x20API\x20access\x20key','User\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','send','isNil','apiKeyNonce','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','sign','secrets','payload','verify','toString','hex','floor','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','crypto','bluebird','util','moment','session','role','fullname','name','internal','email','userpic','permissions','md5secret','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarDnd','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','settingsEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','findOne','params','then','closed','status','disposition','unmanaged','json','Forbidden.','catch','authorization','Basic','authenticate','pass','Wrong\x20credentials.','user','startsWith'];(function(_0x4bacb6,_0x2b299d){var _0x58c029=function(_0x2faaf5){while(--_0x2faaf5){_0x4bacb6['push'](_0x4bacb6['shift']());}};_0x58c029(++_0x2b299d);}(_0x5a17,0xb9));var _0x75a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a17[_0x3dd15e];return _0x231fd0;};'use strict';var db=require(_0x75a1('0x0'))['db'];var config=require(_0x75a1('0x1'));var hardwareConf=require(_0x75a1('0x2'));var licenseUtil=require(_0x75a1('0x3'));var encryptor=require(_0x75a1('0x4'));var _=require(_0x75a1('0x5'));var jwt=require(_0x75a1('0x6'));var expressJwt=require(_0x75a1('0x7'));var compose=require(_0x75a1('0x8'));var basicAuth=require('basic-auth');var crypto=require(_0x75a1('0x9'));var BPromise=require(_0x75a1('0xa'));var util=require(_0x75a1('0xb'));var moment=require(_0x75a1('0xc'));var validateJwt=expressJwt({'secret':config['secrets'][_0x75a1('0xd')]});var userAttributes=['id',_0x75a1('0xe'),_0x75a1('0xf'),_0x75a1('0x10'),_0x75a1('0x11'),_0x75a1('0x12'),_0x75a1('0x13'),_0x75a1('0x14'),_0x75a1('0x15'),'voicePause',_0x75a1('0x16'),_0x75a1('0x17'),_0x75a1('0x18'),_0x75a1('0x19'),_0x75a1('0x1a'),_0x75a1('0x1b'),_0x75a1('0x1c'),'lastLoginAt',_0x75a1('0x1d'),_0x75a1('0x1e'),_0x75a1('0x1f'),_0x75a1('0x20'),_0x75a1('0x21'),'phoneBarAutoAnswer','phoneBarAutoAnswerDelay',_0x75a1('0x22'),'phoneBarEnableRecording','phoneBarEnableDtmfTone',_0x75a1('0x23'),_0x75a1('0x24'),_0x75a1('0x25'),_0x75a1('0x26'),_0x75a1('0x27'),_0x75a1('0x28'),'interface',_0x75a1('0x29'),'privacyEnabled',_0x75a1('0x2a'),_0x75a1('0x2b'),'downloadVoiceRecordings',_0x75a1('0x2c'),_0x75a1('0x2d')];exports[_0x75a1('0x2e')]=function(){return this[_0x75a1('0x2f')](!![])[_0x75a1('0x30')](function(_0x493d8f,_0x4ebd96,_0xf49a4a){if(_0x493d8f['user']){_0xf49a4a();}else{return db[_0x75a1('0x31')][_0x75a1('0x32')]({'where':{'id':_0x493d8f[_0x75a1('0x33')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})[_0x75a1('0x34')](function(_0x1c0c1d){if(_0x1c0c1d&&_0x1c0c1d[_0x75a1('0x35')]){return _0x4ebd96[_0x75a1('0x36')](_0x1c0c1d[_0x75a1('0x37')]===_0x75a1('0x38')?0x195:0x193)[_0x75a1('0x39')]({'message':_0x1c0c1d[_0x75a1('0x37')]===_0x75a1('0x38')?'Unmanaged.':_0x75a1('0x3a')});}else{_0xf49a4a();}})[_0x75a1('0x3b')](function(_0x3778d9){_0xf49a4a(_0x3778d9);});}});};exports[_0x75a1('0x2f')]=function isAuthenticated(_0x460c6d){return compose()[_0x75a1('0x30')](function(_0x5c0fbf,_0x5a5aac,_0x35ef92){var _0x29bc08;if(_0x5c0fbf['headers'][_0x75a1('0x3c')]){if(_['startsWith'](_0x5c0fbf['headers'][_0x75a1('0x3c')],_0x75a1('0x3d'))){var _0x49743d=basicAuth(_0x5c0fbf);db['User']['find']({'where':{'name':_0x49743d[_0x75a1('0x10')]}})[_0x75a1('0x34')](function(_0x19e4ce){if(!_0x19e4ce||!_0x19e4ce[_0x75a1('0x3e')](_0x49743d[_0x75a1('0x3f')])){return _0x5a5aac[_0x75a1('0x36')](0x191)[_0x75a1('0x39')]({'message':_0x75a1('0x40')});}_0x5c0fbf[_0x75a1('0x41')]={'id':_0x19e4ce['id']};_0x35ef92();})[_0x75a1('0x3b')](function(_0x25ec31){_0x35ef92(_0x25ec31);});}else if(_[_0x75a1('0x42')](_0x5c0fbf[_0x75a1('0x43')][_0x75a1('0x3c')],_0x75a1('0x44'))){validateJwt(_0x5c0fbf,_0x5a5aac,_0x35ef92);}else{if(_0x460c6d){_0x35ef92();}else{return _0x5a5aac[_0x75a1('0x36')](0x193)[_0x75a1('0x39')]({'message':_0x75a1('0x45')});}}}else if(_0x5c0fbf[_0x75a1('0x46')]['apikey']){try{var _0x2dcfe2={'audience':hardwareConf[_0x75a1('0x47')](),'issuer':hardwareConf[_0x75a1('0x47')]()};verifyJwt(_0x5c0fbf['query'][_0x75a1('0x48')],_0x2dcfe2)[_0x75a1('0x34')](function(_0xa66d7c){return db[_0x75a1('0x49')][_0x75a1('0x4a')]({'where':{'id':_0xa66d7c[_0x75a1('0x4b')]}})[_0x75a1('0x34')](function(_0x5f54d7){_0x29bc08=_0x5f54d7;return db[_0x75a1('0x4c')][_0x75a1('0x32')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x75a1('0x4d')],'raw':!![]});})[_0x75a1('0x34')](function(_0x7a878c){if(!_0x29bc08||!_[_0x75a1('0x4e')](_0x29bc08['apiKeyNonce'],_0xa66d7c['nonce'])){return _0x5a5aac[_0x75a1('0x36')](0x191)[_0x75a1('0x39')]({'message':_0x75a1('0x4f')});}if(_0x29bc08[_0x75a1('0x50')]){return _0x5a5aac['status'](0x191)[_0x75a1('0x39')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x29bc08[_0x75a1('0x51')]){if(_0x7a878c['blockDuration']>0x0){if(moment(_0x29bc08[_0x75a1('0x52')])['add'](_0x7a878c[_0x75a1('0x4d')],'minutes')>moment()){return _0x5a5aac[_0x75a1('0x36')](0x191)['json']({'message':_0x75a1('0x53')});}}else{return _0x5a5aac[_0x75a1('0x36')](0x191)[_0x75a1('0x39')]({'message':_0x75a1('0x53')});}}_0x5c0fbf[_0x75a1('0x41')]={'id':_0x29bc08['id']};_0x35ef92();});})[_0x75a1('0x3b')](function(){return _0x5a5aac['status'](0x191)[_0x75a1('0x39')]({'message':_0x75a1('0x53')});});}catch(_0x52cc95){_0x35ef92(_0x52cc95);}}else if(_0x460c6d){_0x35ef92();}else{return _0x5a5aac['status'](0x193)[_0x75a1('0x39')]({'message':'Unknown\x20authorization\x20format'});}})['use'](function(_0xc6e7b1,_0x4656c8,_0x147ee6){if(_0xc6e7b1[_0x75a1('0x41')]){db[_0x75a1('0x49')][_0x75a1('0x4a')]({'where':{'id':_0xc6e7b1['user']['id']},'attributes':userAttributes})[_0x75a1('0x34')](function(_0x29d4cc){if(!_0x29d4cc){return _0x4656c8[_0x75a1('0x36')](0x194)[_0x75a1('0x39')]({'message':_0x75a1('0x54')});}_0xc6e7b1[_0x75a1('0x41')]=_0x29d4cc;_0x147ee6();})[_0x75a1('0x3b')](function(_0x89ff79){_0x147ee6(_0x89ff79);});}else if(_0x460c6d){_0x147ee6();}else{return _0x4656c8[_0x75a1('0x36')](0x194)[_0x75a1('0x39')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x75a1('0x55')]=function canUpdate(){return compose()[_0x75a1('0x30')](function(_0x372e33,_0x11abb9,_0x4ff7af){return licenseUtil[_0x75a1('0x56')]()[_0x75a1('0x34')](function(_0x12819c){if(_0x12819c[_0x75a1('0x57')]){_0x4ff7af();}else{return _0x11abb9[_0x75a1('0x36')](0x193)[_0x75a1('0x39')]({'message':_0x75a1('0x58')});}})[_0x75a1('0x3b')](function(_0x2e7af6){_0x4ff7af(_0x2e7af6);});});};exports[_0x75a1('0x59')]=function(_0x304901,_0x5695d2,_0x530295){_0x304901[_0x75a1('0x59')]=!![];return _0x530295();};exports[_0x75a1('0x5a')]=function signToken(_0x4ef3e9){return signJwt(_0x4ef3e9);};exports[_0x75a1('0x5b')]=function(_0x21fd45,_0x1c3443){if(!_0x21fd45[_0x75a1('0x41')]){return _0x1c3443[_0x75a1('0x36')](0x194)[_0x75a1('0x39')]({'message':_0x75a1('0x5c')});}var _0x5cbda5={'payload':{'id':_0x21fd45['user']['id'],'role':_0x21fd45[_0x75a1('0x41')][_0x75a1('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5cbda5)[_0x75a1('0x34')](function(_0x10fab8){_0x1c3443['cookie'](_0x75a1('0x5d'),_0x10fab8);_0x1c3443[_0x75a1('0x5e')]('/dashboards/general');})[_0x75a1('0x3b')](function(_0x573ac8){return _0x1c3443[_0x75a1('0x36')](0x1f4)[_0x75a1('0x5f')](_0x573ac8);});};exports['retrieveApiKey']=function(_0x205935){if(_[_0x75a1('0x60')](_0x205935[_0x75a1('0x61')])||_[_0x75a1('0x60')](_0x205935['apiKeyIat'])){return null;}else{return createJwt(_0x205935);}};exports[_0x75a1('0x62')]=function(_0x7d3e13){_0x7d3e13['apiKeyNonce']=generateNonce();_0x7d3e13[_0x75a1('0x63')]=generateIssuedAt();return createJwt(_0x7d3e13);};exports[_0x75a1('0x64')]=function(_0x3612a9,_0x5333fd){var _0x22fdda=_0x3612a9['query'][_0x75a1('0x48')];if(_0x22fdda){var _0x6b4303={'nonce':_0x5333fd[_0x75a1('0x61')],'iat':_0x5333fd[_0x75a1('0x63')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x75a1('0x47')]()};return verifyJwt(_0x22fdda,_0x6b4303)[_0x75a1('0x34')](function(){return generateApiKey(_0x5333fd);});}else{throw{'message':_0x75a1('0x65')};}};exports['validatePasswordPattern']=function(_0x2877bb){var _0x1377cb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1377cb[_0x75a1('0x66')](_0x2877bb))throw new db[(_0x75a1('0x67'))][(_0x75a1('0x68'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x75a1('0x69')]=function(_0x3f4fe4,_0x4a07d9,_0x2e826a){var _0x5bece7=encryptor[_0x75a1('0x6a')](_0x4a07d9)[_0x75a1('0x6b')](',');for(var _0x28f9dd=0x0;_0x28f9dd<_0x2e826a;_0x28f9dd++){if(!_0x5bece7[_0x28f9dd])break;if(_0x3f4fe4[_0x75a1('0x6c')]()===_0x5bece7[_0x28f9dd][_0x75a1('0x6c')]()){var _0x3a6802=util[_0x75a1('0x6d')](_0x75a1('0x6e'),_0x2e826a);if(_0x2e826a===0x1){_0x3a6802=_0x75a1('0x6f');}throw new db['Sequelize'][(_0x75a1('0x68'))](_0x3a6802);}}return;};exports[_0x75a1('0x70')]=function(_0x209228,_0x1f9cc4){var _0x50aa3f=_0x1f9cc4?encryptor[_0x75a1('0x6a')](_0x1f9cc4)[_0x75a1('0x6b')](','):[];if(_0x50aa3f[_0x75a1('0x71')]===0x5){_0x50aa3f[_0x75a1('0x72')](-0x1,0x1);}_0x50aa3f[_0x75a1('0x73')](_0x209228);return encryptor[_0x75a1('0x74')](_0x50aa3f[_0x75a1('0x75')](','));};function signJwt(_0x1dd128){var _0x35ef04=BPromise[_0x75a1('0x76')](jwt[_0x75a1('0x77')],{'context':jwt});var _0x491e55=_0x1dd128['secret']||config[_0x75a1('0x78')][_0x75a1('0xd')];return new BPromise(function(_0x42f1fb,_0x32efcd){_0x35ef04(_0x1dd128[_0x75a1('0x79')],_0x491e55,_0x1dd128['options'])[_0x75a1('0x34')](function(_0x34a966){_0x42f1fb(_0x34a966);})[_0x75a1('0x3b')](function(_0x4b773a){_0x32efcd(_0x4b773a);});});}function verifyJwt(_0x33e21e,_0x37c844,_0xc3adc8){var _0x2d5e4d=BPromise[_0x75a1('0x76')](jwt[_0x75a1('0x7a')],{'context':jwt});var _0x22850f=_0xc3adc8||config['secrets'][_0x75a1('0xd')];return new BPromise(function(_0x30ad70,_0x28234e){_0x2d5e4d(_0x33e21e,_0x22850f,_0x37c844)[_0x75a1('0x34')](function(_0x5534c8){_0x30ad70(_0x5534c8);})['catch'](function(_0x53da00){_0x28234e(_0x53da00);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x75a1('0x7b')](_0x75a1('0x7c'));}function generateIssuedAt(){return Math[_0x75a1('0x7d')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x1612c7){var _0x1af57b={'payload':{'iat':_0x1612c7[_0x75a1('0x63')],'nonce':_0x1612c7[_0x75a1('0x61')]},'options':{'algorithm':'HS512','subject':_0x1612c7['id']['toString'](),'issuer':hardwareConf[_0x75a1('0x47')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x1af57b)['then'](function(_0x4a7019){return{'iat':_0x1612c7['apiKeyIat'],'nonce':_0x1612c7[_0x75a1('0x61')],'token':_0x4a7019};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 1152d7e..d19b64f 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 _0x092a=['algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','encryptFile','createReadStream','createCipher','data','update','binary','write','end','final','createWriteStream','createDecipher','close','unlink','encryptString','secret','utf8','base64','decryptString','bluebird','lodash','app','session','aes-256-ctr','aes192','encrypt'];(function(_0x25dbdf,_0x1f4776){var _0x238e6e=function(_0x94ab3e){while(--_0x94ab3e){_0x25dbdf['push'](_0x25dbdf['shift']());}};_0x238e6e(++_0x1f4776);}(_0x092a,0x8f));var _0xa092=function(_0x4a9771,_0x52429b){_0x4a9771=_0x4a9771-0x0;var _0x52e0ed=_0x092a[_0x4a9771];return _0x52e0ed;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xa092('0x0'));var _=require(_0xa092('0x1'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0xa092('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0xa092('0x3')],'algorithm':_0xa092('0x4')};const fileOptions={'algorithm':_0xa092('0x5')};if(config[_0xa092('0x6')]&&config[_0xa092('0x6')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0xa092('0x6')][_0xa092('0x7')]);if(isSupported){fileOptions[_0xa092('0x7')]=config[_0xa092('0x6')][_0xa092('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xa092('0x8')](',\x20');logger['error'](config['encrypt'][_0xa092('0x7')],_0xa092('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x5348c1){return AES_SUPPORTED_RX[_0xa092('0xa')](_0x5348c1);}function getSupportedCiphers(){return crypto['getCiphers']()[_0xa092('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x56bddd){return getSupportedCiphers()['indexOf'](_0x56bddd)>-0x1;}function combineOptions(_0x1f8b08){var _0x5876e0={};for(var _0x3b4317 in fileOptions){if(fileOptions['hasOwnProperty'](_0x3b4317)){_0x5876e0[_0x3b4317]=fileOptions[_0x3b4317];}}if(_0x1f8b08){for(var _0x3837cf in _0x1f8b08){if(_0x1f8b08['hasOwnProperty'](_0x3837cf)){_0x5876e0[_0x3837cf]=_0x1f8b08[_0x3837cf];}}}return _0x5876e0;}exports[_0xa092('0xc')]=function(_0x43b649,_0x1ae1ce,_0x21977d,_0x307796){return new BPromise(function(_0x5eb8b8,_0x482512){_0x307796=combineOptions(_0x307796);var _0x8978a0=new Buffer(_0x21977d);var _0x50d734=fs[_0xa092('0xd')](_0x43b649);var _0x3242d5=fs['createWriteStream'](_0x1ae1ce);var _0x102863=crypto[_0xa092('0xe')](_0x307796[_0xa092('0x7')],_0x8978a0);_0x50d734['on'](_0xa092('0xf'),function(_0xc95b0c){var _0x4317d2=new Buffer(_0x102863[_0xa092('0x10')](_0xc95b0c),_0xa092('0x11'));_0x3242d5[_0xa092('0x12')](_0x4317d2);});_0x50d734['on'](_0xa092('0x13'),function(){try{var _0x132a48=new Buffer(_0x102863[_0xa092('0x14')](_0xa092('0x11')),_0xa092('0x11'));_0x3242d5[_0xa092('0x12')](_0x132a48);_0x3242d5[_0xa092('0x13')]();_0x3242d5['on']('close',function(){return _0x5eb8b8(_0x1ae1ce);});}catch(_0x2de9fa){fs['unlink'](_0x1ae1ce);return _0x482512(_0x2de9fa);}});});};exports['decryptFile']=function(_0x56c1ad,_0x340af7,_0x194a55,_0x597327){return new BPromise(function(_0x193520,_0x595400){_0x597327=combineOptions(_0x597327);var _0x1cd10b=new Buffer(_0x194a55);var _0x29c997=fs['createReadStream'](_0x56c1ad);var _0x1396ae=fs[_0xa092('0x15')](_0x340af7);var _0x3c995f=crypto[_0xa092('0x16')](_0x597327[_0xa092('0x7')],_0x1cd10b);_0x29c997['on']('data',function(_0x3da9fd){var _0x217940=new Buffer(_0x3c995f['update'](_0x3da9fd),'binary');_0x1396ae['write'](_0x217940);});_0x29c997['on'](_0xa092('0x13'),function(){try{var _0x41aea2=new Buffer(_0x3c995f[_0xa092('0x14')](_0xa092('0x11')),_0xa092('0x11'));_0x1396ae[_0xa092('0x12')](_0x41aea2);_0x1396ae[_0xa092('0x13')]();_0x1396ae['on'](_0xa092('0x17'),function(){return _0x193520(_0x340af7);});}catch(_0x37aaed){fs[_0xa092('0x18')](_0x340af7);return _0x595400(_0x37aaed);}});});};exports[_0xa092('0x19')]=function(_0x498cc0,_0x4b97bc,_0x104371){var _0x42a144=_0x104371||stringOptions[_0xa092('0x7')];var _0x2b648b=_0x4b97bc||stringOptions[_0xa092('0x1a')];var _0x83f796=crypto[_0xa092('0xe')](_0x42a144,_0x2b648b);var _0xd433a8=_0x83f796[_0xa092('0x10')](_0x498cc0,_0xa092('0x1b'),'base64');_0xd433a8+=_0x83f796[_0xa092('0x14')](_0xa092('0x1c'));return _0xd433a8;};exports[_0xa092('0x1d')]=function(_0x47c204,_0x76a573,_0x1679f3){var _0x1d5349=_0x1679f3||stringOptions['algorithm'];var _0x52ca6f=_0x76a573||stringOptions[_0xa092('0x1a')];var _0x4250d=crypto[_0xa092('0x16')](_0x1d5349,_0x52ca6f);var _0x2171e2=_0x4250d[_0xa092('0x10')](_0x47c204,_0xa092('0x1c'),_0xa092('0x1b'));_0x2171e2+=_0x4250d[_0xa092('0x14')](_0xa092('0x1b'));return _0x2171e2;}; \ No newline at end of file +var _0xe79a=['secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','hasOwnProperty','createReadStream','createWriteStream','createCipher','write','final','binary','end','close','decryptFile','createDecipher','update','encryptString','secret','utf8','base64','decryptString','crypto','lodash','../../config/environment','../../config/logger','app'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe79a,0xd4));var _0xae79=function(_0x147078,_0x4e509c){_0x147078=_0x147078-0x0;var _0x2d2f5c=_0xe79a[_0x147078];return _0x2d2f5c;};'use strict';var crypto=require(_0xae79('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0xae79('0x1'));var config=require(_0xae79('0x2'));var logger=require(_0xae79('0x3'))(_0xae79('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xae79('0x5')][_0xae79('0x6')],'algorithm':_0xae79('0x7')};const fileOptions={'algorithm':_0xae79('0x8')};if(config[_0xae79('0x9')]&&config[_0xae79('0x9')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0xae79('0x9')][_0xae79('0xa')]);if(isSupported){fileOptions[_0xae79('0xa')]=config[_0xae79('0x9')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0xae79('0xb')](',\x20');logger['error'](config['encrypt'][_0xae79('0xa')],_0xae79('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x4c3ec9){return AES_SUPPORTED_RX['test'](_0x4c3ec9);}function getSupportedCiphers(){return crypto[_0xae79('0xd')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x48d718){return getSupportedCiphers()['indexOf'](_0x48d718)>-0x1;}function combineOptions(_0x2adfe0){var _0x2485b6={};for(var _0x1aba0b in fileOptions){if(fileOptions[_0xae79('0xe')](_0x1aba0b)){_0x2485b6[_0x1aba0b]=fileOptions[_0x1aba0b];}}if(_0x2adfe0){for(var _0x14b6c3 in _0x2adfe0){if(_0x2adfe0[_0xae79('0xe')](_0x14b6c3)){_0x2485b6[_0x14b6c3]=_0x2adfe0[_0x14b6c3];}}}return _0x2485b6;}exports['encryptFile']=function(_0x3d6b21,_0x12b3a7,_0x23dc65,_0x146514){return new BPromise(function(_0x3c2495,_0x15d159){_0x146514=combineOptions(_0x146514);var _0x10ac68=new Buffer(_0x23dc65);var _0x448dff=fs[_0xae79('0xf')](_0x3d6b21);var _0x440565=fs[_0xae79('0x10')](_0x12b3a7);var _0x4d7a60=crypto[_0xae79('0x11')](_0x146514[_0xae79('0xa')],_0x10ac68);_0x448dff['on']('data',function(_0x3f0fc9){var _0x19dcdf=new Buffer(_0x4d7a60['update'](_0x3f0fc9),'binary');_0x440565[_0xae79('0x12')](_0x19dcdf);});_0x448dff['on']('end',function(){try{var _0x1ac52d=new Buffer(_0x4d7a60[_0xae79('0x13')](_0xae79('0x14')),_0xae79('0x14'));_0x440565['write'](_0x1ac52d);_0x440565[_0xae79('0x15')]();_0x440565['on'](_0xae79('0x16'),function(){return _0x3c2495(_0x12b3a7);});}catch(_0x5a0610){fs['unlink'](_0x12b3a7);return _0x15d159(_0x5a0610);}});});};exports[_0xae79('0x17')]=function(_0x4e59eb,_0x50310e,_0x466f8b,_0x48c99f){return new BPromise(function(_0x249b7f,_0x7ba546){_0x48c99f=combineOptions(_0x48c99f);var _0x59618a=new Buffer(_0x466f8b);var _0x370a84=fs['createReadStream'](_0x4e59eb);var _0x5df27b=fs[_0xae79('0x10')](_0x50310e);var _0x15fb45=crypto[_0xae79('0x18')](_0x48c99f['algorithm'],_0x59618a);_0x370a84['on']('data',function(_0x2f4a36){var _0x7972d5=new Buffer(_0x15fb45[_0xae79('0x19')](_0x2f4a36),'binary');_0x5df27b[_0xae79('0x12')](_0x7972d5);});_0x370a84['on'](_0xae79('0x15'),function(){try{var _0x31a0b2=new Buffer(_0x15fb45['final'](_0xae79('0x14')),_0xae79('0x14'));_0x5df27b['write'](_0x31a0b2);_0x5df27b[_0xae79('0x15')]();_0x5df27b['on']('close',function(){return _0x249b7f(_0x50310e);});}catch(_0x1466de){fs['unlink'](_0x50310e);return _0x7ba546(_0x1466de);}});});};exports[_0xae79('0x1a')]=function(_0x4e7e2a,_0x5b7123,_0x115293){var _0x5ba7cc=_0x115293||stringOptions[_0xae79('0xa')];var _0x2073a9=_0x5b7123||stringOptions[_0xae79('0x1b')];var _0x378ba8=crypto[_0xae79('0x11')](_0x5ba7cc,_0x2073a9);var _0x5378d9=_0x378ba8[_0xae79('0x19')](_0x4e7e2a,_0xae79('0x1c'),_0xae79('0x1d'));_0x5378d9+=_0x378ba8['final'](_0xae79('0x1d'));return _0x5378d9;};exports[_0xae79('0x1e')]=function(_0x347440,_0x2871c4,_0x3a9082){var _0x1c73f9=_0x3a9082||stringOptions[_0xae79('0xa')];var _0x3a81db=_0x2871c4||stringOptions[_0xae79('0x1b')];var _0x24d102=crypto['createDecipher'](_0x1c73f9,_0x3a81db);var _0x203304=_0x24d102[_0xae79('0x19')](_0x347440,_0xae79('0x1d'),'utf8');_0x203304+=_0x24d102[_0xae79('0x13')]('utf8');return _0x203304;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 4503b8e..d6208e3 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 _0x9aea=['../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','CSV','find','split','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','length','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','push','dirname','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','lodash','bluebird','zip-dir'];(function(_0x495f24,_0x3119c1){var _0x9949e9=function(_0x5ddd10){while(--_0x5ddd10){_0x495f24['push'](_0x495f24['shift']());}};_0x9949e9(++_0x3119c1);}(_0x9aea,0xdd));var _0xa9ae=function(_0x17cb54,_0x49c42d){_0x17cb54=_0x17cb54-0x0;var _0x584cdf=_0x9aea[_0x17cb54];return _0x584cdf;};'use strict';var util=require(_0xa9ae('0x0'));var path=require('path');var _=require(_0xa9ae('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xa9ae('0x2'));var zipdir=require(_0xa9ae('0x3'));var rimraf=require('rimraf');var db=require(_0xa9ae('0x4'))['db'];var dbH=require(_0xa9ae('0x4'))[_0xa9ae('0x5')];var logger=require(_0xa9ae('0x6'))(_0xa9ae('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xa9ae('0x8')][0x3];var PATH=process[_0xa9ae('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1e57c4,_0x53e52c){var _0x1f2e4b={'status':_0x1e57c4};var _0x3917f0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x53e52c){_0x1f2e4b[_0xa9ae('0x9')]=_0x53e52c;}return db[_0xa9ae('0xa')][_0xa9ae('0xb')](_0x1f2e4b,_0x3917f0);}function main(){var _0x2d1188=0x1388;var _0x1816c2;logger[_0xa9ae('0xc')](util[_0xa9ae('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xa9ae('0xe')));return db['Setting'][_0xa9ae('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa9ae('0x10'),_0xa9ae('0x11')]})[_0xa9ae('0x12')](function(_0x35f861){if(_0x35f861){_0x1816c2=_0x35f861;_0x2d1188=_0x1816c2[_0xa9ae('0x11')]||0x1388;}})[_0xa9ae('0x12')](function(){return dbH[_0xa9ae('0x13')]['query'](util[_0xa9ae('0xd')](_0xa9ae('0x14'),QUERY),{'type':dbH[_0xa9ae('0x13')][_0xa9ae('0x15')]['SELECT']});})[_0xa9ae('0x12')](function(_0x1ec742){if(!_0x1ec742[0x0][_0xa9ae('0x16')]){return analyticExtractedReport(_0xa9ae('0x17'));}var _0x77b0a4=[];var _0xddb095=0x0;var _0x524bb2=!![];if(_0x1ec742&&_0x1ec742[_0xa9ae('0x18')]){var _0x42a98c=_0x1ec742[0x0][_0xa9ae('0x16')]%(_0xddb095+_0x2d1188);if(_0x1816c2['split']){for(;_0x524bb2;_0xddb095+=_0x2d1188,_0x42a98c=_0x1ec742[0x0]['num']%(_0xddb095+_0x2d1188)){if(_0x42a98c==0x0||_0x42a98c==_0x1ec742[0x0][_0xa9ae('0x16')]){_0x524bb2=![];}_0x77b0a4['push'](dbH['sequelize'][_0xa9ae('0x19')](util[_0xa9ae('0xd')](_0xa9ae('0x1a'),QUERY,_0x2d1188,_0xddb095),{'type':dbH[_0xa9ae('0x13')]['QueryTypes'][_0xa9ae('0x1b')]}));}}else{_0x77b0a4[_0xa9ae('0x1c')](dbH[_0xa9ae('0x13')][_0xa9ae('0x19')](QUERY,{'type':dbH[_0xa9ae('0x13')][_0xa9ae('0x15')][_0xa9ae('0x1b')]}));}}var _0x5a062d=path[_0xa9ae('0x1d')](PATH);var _0x4ca9a9=path['basename'](PATH,'.csv');var _0x478bb7=_0x1816c2[_0xa9ae('0x10')]&&_0x77b0a4['length']>0x1;var _0x13fb05=[];if(!fs['existsSync'](path[_0xa9ae('0x1e')](_0x5a062d,_0x4ca9a9))&&_0x478bb7){fs[_0xa9ae('0x1f')](path[_0xa9ae('0x1e')](_0x5a062d,_0x4ca9a9));}return BPromise[_0xa9ae('0x20')](_0x77b0a4,function(_0x12b061){_0x13fb05[_0xa9ae('0x1c')](_0x12b061);})[_0xa9ae('0x12')](function(){for(var _0x5e82f1=0x0;_0x5e82f1<_0x13fb05[_0xa9ae('0x18')];_0x5e82f1+=0x1){var _0x3873aa;var _0x2aac9e=_0x13fb05[_0x5e82f1];if(_0x478bb7){_0x3873aa=path[_0xa9ae('0x1e')](_0x5a062d,_0x4ca9a9,util[_0xa9ae('0xd')](_0xa9ae('0x21'),_0x4ca9a9,_0x5e82f1,_0xa9ae('0x22')));}else{_0x3873aa=path['join'](_0x5a062d,util['format'](_0xa9ae('0x23'),_0x4ca9a9,_0xa9ae('0x22')));}fs[_0xa9ae('0x24')](_0x3873aa,csv(_0x2aac9e));}})[_0xa9ae('0x12')](function(){if(_0x478bb7){zipdir(path[_0xa9ae('0x1e')](_0x5a062d,_0x4ca9a9),{'saveTo':path['join'](_0x5a062d,util['format'](_0xa9ae('0x23'),_0x4ca9a9,_0xa9ae('0x25')))},function(_0x372ec7,_0x3a48b7){});rimraf(path[_0xa9ae('0x1e')](_0x5a062d,_0x4ca9a9),function(){});}})[_0xa9ae('0x12')](function(){logger['info'](util['format'](_0xa9ae('0x26'),EXTRACTED_REPORT_ID,_0xa9ae('0xe')));return analyticExtractedReport(_0xa9ae('0x27'),_0x478bb7?util[_0xa9ae('0xd')](_0xa9ae('0x23'),_0x4ca9a9,_0x478bb7?_0xa9ae('0x25'):_0xa9ae('0x22')):null);});})[_0xa9ae('0x28')](function(_0x5c4f79){logger[_0xa9ae('0xc')](util['format'](_0xa9ae('0x29'),EXTRACTED_REPORT_ID,_0xa9ae('0xe')),util[_0xa9ae('0x2a')](_0x5c4f79,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xa9ae('0x2b')](function(){process[_0xa9ae('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x5eb1=['savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','length','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','existsSync','join','mkdirSync','each','%s.%s','csv','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5eb1,0x7c));var _0x15eb=function(_0x181dfe,_0xf84557){_0x181dfe=_0x181dfe-0x0;var _0x40c38f=_0x5eb1[_0x181dfe];return _0x40c38f;};'use strict';var util=require('util');var path=require(_0x15eb('0x0'));var _=require(_0x15eb('0x1'));var csv=require(_0x15eb('0x2'));var fs=require('fs');var BPromise=require(_0x15eb('0x3'));var zipdir=require(_0x15eb('0x4'));var rimraf=require(_0x15eb('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0x15eb('0x6'))[_0x15eb('0x7')];var logger=require(_0x15eb('0x8'))(_0x15eb('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x15eb('0xa')][0x3];var PATH=process[_0x15eb('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x594f54,_0xe4d8ce){var _0x160879={'status':_0x594f54};var _0x730b12={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xe4d8ce){_0x160879[_0x15eb('0xb')]=_0xe4d8ce;}return db[_0x15eb('0xc')][_0x15eb('0xd')](_0x160879,_0x730b12);}function main(){var _0x412db6=0x1388;var _0x1481ae;logger[_0x15eb('0xe')](util[_0x15eb('0xf')](_0x15eb('0x10'),EXTRACTED_REPORT_ID,_0x15eb('0x11')));return db[_0x15eb('0x12')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x15eb('0x13'),'splitSizeCsv']})['then'](function(_0x498a0c){if(_0x498a0c){_0x1481ae=_0x498a0c;_0x412db6=_0x1481ae[_0x15eb('0x14')]||0x1388;}})[_0x15eb('0x15')](function(){return dbH[_0x15eb('0x16')][_0x15eb('0x17')](util['format'](_0x15eb('0x18'),QUERY),{'type':dbH[_0x15eb('0x16')][_0x15eb('0x19')][_0x15eb('0x1a')]});})['then'](function(_0x48aed7){if(!_0x48aed7[0x0]['num']){return analyticExtractedReport('Empty');}var _0x1188e0=[];var _0x52223c=0x0;var _0x53efa1=!![];if(_0x48aed7&&_0x48aed7[_0x15eb('0x1b')]){var _0x5b9a6b=_0x48aed7[0x0][_0x15eb('0x1c')]%(_0x52223c+_0x412db6);if(_0x1481ae['split']){for(;_0x53efa1;_0x52223c+=_0x412db6,_0x5b9a6b=_0x48aed7[0x0][_0x15eb('0x1c')]%(_0x52223c+_0x412db6)){if(_0x5b9a6b==0x0||_0x5b9a6b==_0x48aed7[0x0]['num']){_0x53efa1=![];}_0x1188e0[_0x15eb('0x1d')](dbH[_0x15eb('0x16')]['query'](util[_0x15eb('0xf')](_0x15eb('0x1e'),QUERY,_0x412db6,_0x52223c),{'type':dbH['sequelize'][_0x15eb('0x19')][_0x15eb('0x1a')]}));}}else{_0x1188e0[_0x15eb('0x1d')](dbH[_0x15eb('0x16')][_0x15eb('0x17')](QUERY,{'type':dbH[_0x15eb('0x16')]['QueryTypes'][_0x15eb('0x1a')]}));}}var _0x4e4d75=path[_0x15eb('0x1f')](PATH);var _0x49915b=path[_0x15eb('0x20')](PATH,'.csv');var _0x27449b=_0x1481ae[_0x15eb('0x13')]&&_0x1188e0[_0x15eb('0x1b')]>0x1;var _0x9b0a52=[];if(!fs[_0x15eb('0x21')](path[_0x15eb('0x22')](_0x4e4d75,_0x49915b))&&_0x27449b){fs[_0x15eb('0x23')](path[_0x15eb('0x22')](_0x4e4d75,_0x49915b));}return BPromise[_0x15eb('0x24')](_0x1188e0,function(_0x17c2ef){_0x9b0a52['push'](_0x17c2ef);})[_0x15eb('0x15')](function(){for(var _0x419cf8=0x0;_0x419cf8<_0x9b0a52[_0x15eb('0x1b')];_0x419cf8+=0x1){var _0x3f655b;var _0x1fcb1a=_0x9b0a52[_0x419cf8];if(_0x27449b){_0x3f655b=path[_0x15eb('0x22')](_0x4e4d75,_0x49915b,util[_0x15eb('0xf')]('%s%d.%s',_0x49915b,_0x419cf8,'csv'));}else{_0x3f655b=path[_0x15eb('0x22')](_0x4e4d75,util[_0x15eb('0xf')](_0x15eb('0x25'),_0x49915b,_0x15eb('0x26')));}fs['writeFileSync'](_0x3f655b,csv(_0x1fcb1a));}})[_0x15eb('0x15')](function(){if(_0x27449b){zipdir(path['join'](_0x4e4d75,_0x49915b),{'saveTo':path[_0x15eb('0x22')](_0x4e4d75,util['format'](_0x15eb('0x25'),_0x49915b,_0x15eb('0x27')))},function(_0x413861,_0x153d86){});rimraf(path[_0x15eb('0x22')](_0x4e4d75,_0x49915b),function(){});}})[_0x15eb('0x15')](function(){logger['info'](util[_0x15eb('0xf')](_0x15eb('0x28'),EXTRACTED_REPORT_ID,_0x15eb('0x11')));return analyticExtractedReport('Completed',_0x27449b?util['format'](_0x15eb('0x25'),_0x49915b,_0x27449b?_0x15eb('0x27'):'csv'):null);});})['catch'](function(_0x4fdcfb){logger[_0x15eb('0xe')](util['format'](_0x15eb('0x29'),EXTRACTED_REPORT_ID,_0x15eb('0x11')),util['inspect'](_0x4fdcfb,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x15eb('0x2a'));})[_0x15eb('0x2b')](function(){process[_0x15eb('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 5b3dd70..1cb3fed 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 _0xe11d=['all','flatten','%s%d.%s','pdf','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','Failed','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','pipe','createWriteStream','finish','end','createPdfFromHTML','lodash','path','moment','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','length','auto','push','chunk','keys','forEach','format','name','startDate','endDate','header','pageBreak','before','margin','landscape','footer','Arial','black','right','num','basename','join','%s.%s','find','split','splitSizePdf','then','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','mkdirSync'];(function(_0x3b42ba,_0x7fa12e){var _0x247c40=function(_0x102e22){while(--_0x102e22){_0x3b42ba['push'](_0x3b42ba['shift']());}};_0x247c40(++_0x7fa12e);}(_0xe11d,0x71));var _0xde11=function(_0x5645d0,_0x553088){_0x5645d0=_0x5645d0-0x0;var _0x5935a2=_0xe11d[_0x5645d0];return _0x5935a2;};'use strict';var _=require(_0xde11('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xde11('0x1'));var moment=require(_0xde11('0x2'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0xde11('0x3'));var zipdir=require(_0xde11('0x4'));var rimraf=require(_0xde11('0x5'));var JSDOM=require(_0xde11('0x6'))[_0xde11('0x7')];var window=new JSDOM('')[_0xde11('0x8')];var db=require('../../mysqldb')['db'];var dbH=require(_0xde11('0x9'))[_0xde11('0xa')];var logger=require(_0xde11('0xb'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xde11('0xc')][0x2]);var QUERY=process[_0xde11('0xc')][0x3];var PATH=process[_0xde11('0xc')][0x4];var NAME=process['argv'][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4d1c64,_0x4fbede){var _0x2b6f82={'status':_0x4d1c64};var _0x56e652={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4fbede){_0x2b6f82[_0xde11('0xd')]=_0x4fbede;}return db[_0xde11('0xe')][_0xde11('0xf')](_0x2b6f82,_0x56e652);}function getHeaders(_0xd2e017){return _[_0xde11('0x10')](_0xd2e017,function(_0x3ae2e5){return{'text':_0x3ae2e5,'style':_0xde11('0x11')};});}function getRows(_0x1037e1,_0x574553){return _[_0xde11('0x10')](_0x574553,function(_0x2afe64){return _(_0x2afe64)[_0xde11('0x12')](_0x1037e1)[_0xde11('0x10')](function(_0x3e9e6e){return _0x3e9e6e?_[_0xde11('0x13')](_0x3e9e6e):'';})['value']();});}function createTable(_0x4fa85e,_0x104636){var _0x51f3d9={'widths':_['fill'](Array(_0x4fa85e[_0xde11('0x14')]),0x91),'heights':function(_0x587762){return _0x587762===0x0?_0xde11('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x36c7b3=getHeaders(_0x4fa85e);_0x51f3d9['body'][_0xde11('0x16')](_0x36c7b3);var _0x109c10=getRows(_0x4fa85e,_0x104636);_0x51f3d9['body']=_0x51f3d9['body']['concat'](_0x109c10);return _0x51f3d9;}function createTables(_0x436bd4){var _0x470d9c=[];var _0x409b61=_[_0xde11('0x17')](Object[_0xde11('0x18')](_0x436bd4[0x0]),0x5);_0x409b61[_0xde11('0x19')](function(_0x1b7f6a){_0x470d9c[_0xde11('0x16')](createTable(_0x1b7f6a,_0x436bd4));});return _0x470d9c;}function getPDFDocDefinition(_0x5432f8){var _0xcd0371=util[_0xde11('0x1a')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0xde11('0x1b')],moment(EXTRACTED_REPORT[_0xde11('0x1c')])[_0xde11('0x1a')](FORMAT),moment(EXTRACTED_REPORT[_0xde11('0x1d')])['format'](FORMAT));var _0xdec8d1=[];for(var _0x4a6eb2=0x0;_0x4a6eb2<_0x5432f8['length'];_0x4a6eb2++){var _0x50fae8=[];if(_0x4a6eb2===0x0){_0x50fae8[_0xde11('0x16')]({'text':_0xcd0371,'style':_0xde11('0x1e')});}var _0x53017a={'table':_0x5432f8[_0x4a6eb2]};if(_0x4a6eb2>0x0){_0x53017a[_0xde11('0x1f')]=_0xde11('0x20');_0x53017a[_0xde11('0x21')]=[0x0,0x46,0x0,0x0];}_0x50fae8[_0xde11('0x16')](_0x53017a);_0xdec8d1['push'](_0x50fae8);}return{'pageSize':'A4','pageOrientation':_0xde11('0x22'),'content':_0xdec8d1,'footer':function(_0x5216b3,_0x185c5a){return{'text':_0x5216b3[_0xde11('0x13')]()+'\x20/\x20'+_0x185c5a,'style':_0xde11('0x23')};},'defaultStyle':{'font':_0xde11('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xde11('0x25')},'footer':{'alignment':_0xde11('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1dc19f){var _0x2b0475=0x1388;var _0x271670;if(!_0x1dc19f[0x0][_0xde11('0x27')]){return analyticExtractedReport('Empty');}var _0x431db2=[];var _0x3f3c3d=0x0;var _0x17fded=!![];var _0x5c8cb1=path['dirname'](PATH);var _0xe104d0=path[_0xde11('0x28')](PATH,'.pdf');var _0x1435bc=path[_0xde11('0x29')](_0x5c8cb1,util[_0xde11('0x1a')](_0xde11('0x2a'),_0xe104d0,'pdf'));var _0x45396c=![];return db['Setting'][_0xde11('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xde11('0x2c'),_0xde11('0x2d')]})[_0xde11('0x2e')](function(_0x27f0e){if(_0x27f0e){_0x271670=_0x27f0e;_0x2b0475=_0x271670[_0xde11('0x2d')]||0x3e8;}})[_0xde11('0x2e')](function(){if(_0x1dc19f&&_0x1dc19f['length']){var _0x3c5321=_0x1dc19f[0x0][_0xde11('0x27')]%(_0x3f3c3d+_0x2b0475);if(_0x271670[_0xde11('0x2c')]){for(;_0x17fded;_0x3f3c3d+=_0x2b0475,_0x3c5321=_0x1dc19f[0x0][_0xde11('0x27')]%(_0x3f3c3d+_0x2b0475)){if(_0x3c5321==0x0||_0x3c5321==_0x1dc19f[0x0][_0xde11('0x27')]){_0x17fded=![];}_0x431db2['push'](dbH[_0xde11('0x2f')][_0xde11('0x30')](util[_0xde11('0x1a')](_0xde11('0x31'),QUERY,_0x2b0475,_0x3f3c3d),{'type':dbH[_0xde11('0x2f')][_0xde11('0x32')][_0xde11('0x33')]}));}}else{_0x431db2['push'](dbH[_0xde11('0x2f')][_0xde11('0x30')](QUERY,{'type':dbH[_0xde11('0x2f')][_0xde11('0x32')][_0xde11('0x33')]}));}}_0x45396c=_0x271670[_0xde11('0x2c')]&&_0x431db2[_0xde11('0x14')]>0x1;if(!fs['existsSync'](path['join'](_0x5c8cb1,_0xe104d0))&&_0x45396c){fs[_0xde11('0x34')](path[_0xde11('0x29')](_0x5c8cb1,_0xe104d0));}return Promise[_0xde11('0x35')](_0x431db2);})[_0xde11('0x2e')](function(_0x265878){return createTables(_[_0xde11('0x36')](_0x265878));})[_0xde11('0x2e')](function(_0x21f726){var _0x244728=getPDFDocDefinition(_0x21f726);var _0x50db4e=getPDFPrinter();var _0x47d623=_0x50db4e['createPdfKitDocument'](_0x244728);if(_0x45396c)_0x1435bc=path[_0xde11('0x29')](_0x5c8cb1,_0xe104d0,util[_0xde11('0x1a')](_0xde11('0x37'),_0xe104d0,index,_0xde11('0x38')));return writePDFDocument(_0x47d623,_0x1435bc);})[_0xde11('0x2e')](function(){if(!_0x45396c)return;zipdir(path['join'](_0x5c8cb1,_0xe104d0),{'saveTo':path[_0xde11('0x29')](_0x5c8cb1,util[_0xde11('0x1a')](_0xde11('0x2a'),_0xe104d0,_0xde11('0x39')))},function(_0xea4c31){if(_0xea4c31)throw _0xea4c31;return;});})['then'](function(){if(!_0x45396c)return;rimraf(path[_0xde11('0x29')](_0x5c8cb1,_0xe104d0),function(){});})[_0xde11('0x2e')](function(){logger[_0xde11('0x3a')](util['format'](_0xde11('0x3b'),EXTRACTED_REPORT_ID,_0xde11('0x3c')));return analyticExtractedReport(_0xde11('0x3d'),_0x45396c?util['format'](_0xde11('0x2a'),_0xe104d0,_0x45396c?'zip':_0xde11('0x38')):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xde11('0x3a')](util[_0xde11('0x1a')](_0xde11('0x3e'),EXTRACTED_REPORT_ID,'PDF'));return db[_0xde11('0xe')][_0xde11('0x3f')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xde11('0x2e')](function(_0x20fa52){EXTRACTED_REPORT=_0x20fa52;return dbH['sequelize']['query'](util[_0xde11('0x1a')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xde11('0x2f')][_0xde11('0x32')]['SELECT']});})[_0xde11('0x2e')](extractReport)[_0xde11('0x40')](function(_0x5709d1){logger['info'](util[_0xde11('0x1a')](_0xde11('0x41'),EXTRACTED_REPORT_ID,_0xde11('0x42')),util['inspect'](_0x5709d1,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xde11('0x43'));})[_0xde11('0x44')](function(){process[_0xde11('0x45')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x1bcf35=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0xde11('0x46'),'italics':__dirname+_0xde11('0x47'),'bolditalics':__dirname+_0xde11('0x48')}});return _0x1bcf35;}function getPDFDocDefinitionFromHTML(_0x4bb7e1,_0x29d117){var _0x31f2eb=util[_0xde11('0x1a')](_0xde11('0x49'),_0x29d117['channel'],_0x29d117[_0xde11('0x4a')]);var _0x699662=moment()[_0xde11('0x1a')](_0xde11('0x4b'))['toString']();var _0x423515=htmlToPdfmake(_0x4bb7e1,{'window':window,'tableAutoSize':!![]});return{'content':[_0x423515],'defaultStyle':{'font':_0xde11('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xde11('0x4c'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xde11('0x4c'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xde11('0x4c')}},'header':function(){return[{'text':_0xde11('0x4d'),'style':'header'}];},'footer':function(_0x9c4f96,_0x5636e7){return[{'text':util[_0xde11('0x1a')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x31f2eb,_0x9c4f96,_0x5636e7,_0x699662),'style':'footer'}];}};}function writePDFDocument(_0x13465c,_0x3ae90d){return new Promise(function(_0x4edd59,_0x11dde0){var _0x301a70=_0x13465c[_0xde11('0x4e')](fs[_0xde11('0x4f')](_0x3ae90d));_0x301a70['on'](_0xde11('0x50'),function(){_0x4edd59(_0xde11('0x50'));});_0x301a70['on']('error',function(_0x47672c){_0x11dde0(_0x47672c);});_0x13465c[_0xde11('0x51')]();});}exports[_0xde11('0x52')]=function(_0x3915fd,_0x56d926){var _0x45e7af=getPDFPrinter();var _0x296775=getPDFDocDefinitionFromHTML(_0x3915fd,_0x56d926);var _0x1b472e=_0x45e7af['createPdfKitDocument'](_0x296775);return writePDFDocument(_0x1b472e,_0x56d926[_0xde11('0x1')])['catch'](function(_0x153020){throw _0x153020;});}; \ No newline at end of file +var _0x93c0=['push','body','concat','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','dirname','.pdf','%s.%s','pdf','Setting','find','split','splitSizePdf','then','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','all','flatten','createPdfKitDocument','%s%d.%s','zip','info','CSV','Completed','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','toString','center','Interaction\x20Transcript','pipe','createWriteStream','finish','end','createPdfFromHTML','catch','lodash','util','path','moment','pdfmake/src/printer','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','value','fill','length','auto'];(function(_0xfceb75,_0x597684){var _0x4890dd=function(_0x118763){while(--_0x118763){_0xfceb75['push'](_0xfceb75['shift']());}};_0x4890dd(++_0x597684);}(_0x93c0,0x1b6));var _0x093c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x93c0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x093c('0x0'));var fs=require('fs');var util=require(_0x093c('0x1'));var path=require(_0x093c('0x2'));var moment=require(_0x093c('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x093c('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x093c('0x5'));var JSDOM=require(_0x093c('0x6'))[_0x093c('0x7')];var window=new JSDOM('')[_0x093c('0x8')];var db=require(_0x093c('0x9'))['db'];var dbH=require('../../mysqldb')[_0x093c('0xa')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x093c('0xb')][0x4];var NAME=process[_0x093c('0xb')][0x5];var FORMAT=_0x093c('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x825469,_0x326351){var _0x5728eb={'status':_0x825469};var _0x782122={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x326351){_0x5728eb[_0x093c('0xd')]=_0x326351;}return db[_0x093c('0xe')][_0x093c('0xf')](_0x5728eb,_0x782122);}function getHeaders(_0x4c98e3){return _[_0x093c('0x10')](_0x4c98e3,function(_0x41ad71){return{'text':_0x41ad71,'style':_0x093c('0x11')};});}function getRows(_0x5e9380,_0x32a1f7){return _[_0x093c('0x10')](_0x32a1f7,function(_0x320c58){return _(_0x320c58)['pick'](_0x5e9380)['map'](function(_0x1e8152){return _0x1e8152?_['toString'](_0x1e8152):'';})[_0x093c('0x12')]();});}function createTable(_0x38998b,_0x3d94e5){var _0x1297c1={'widths':_[_0x093c('0x13')](Array(_0x38998b[_0x093c('0x14')]),0x91),'heights':function(_0x374ab0){return _0x374ab0===0x0?_0x093c('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x3e3c30=getHeaders(_0x38998b);_0x1297c1['body'][_0x093c('0x16')](_0x3e3c30);var _0x17379b=getRows(_0x38998b,_0x3d94e5);_0x1297c1[_0x093c('0x17')]=_0x1297c1[_0x093c('0x17')][_0x093c('0x18')](_0x17379b);return _0x1297c1;}function createTables(_0x2505a2){var _0x598342=[];var _0x34b1fe=_['chunk'](Object[_0x093c('0x19')](_0x2505a2[0x0]),0x5);_0x34b1fe[_0x093c('0x1a')](function(_0x5e638e){_0x598342[_0x093c('0x16')](createTable(_0x5e638e,_0x2505a2));});return _0x598342;}function getPDFDocDefinition(_0x376f15){var _0x3c33c0=util[_0x093c('0x1b')](_0x093c('0x1c'),NAME,EXTRACTED_REPORT[_0x093c('0x1d')],moment(EXTRACTED_REPORT[_0x093c('0x1e')])[_0x093c('0x1b')](FORMAT),moment(EXTRACTED_REPORT[_0x093c('0x1f')])[_0x093c('0x1b')](FORMAT));var _0x11a676=[];for(var _0x2100f8=0x0;_0x2100f8<_0x376f15['length'];_0x2100f8++){var _0x3d5c10=[];if(_0x2100f8===0x0){_0x3d5c10[_0x093c('0x16')]({'text':_0x3c33c0,'style':_0x093c('0x20')});}var _0x5873f3={'table':_0x376f15[_0x2100f8]};if(_0x2100f8>0x0){_0x5873f3[_0x093c('0x21')]=_0x093c('0x22');_0x5873f3[_0x093c('0x23')]=[0x0,0x46,0x0,0x0];}_0x3d5c10[_0x093c('0x16')](_0x5873f3);_0x11a676[_0x093c('0x16')](_0x3d5c10);}return{'pageSize':'A4','pageOrientation':_0x093c('0x24'),'content':_0x11a676,'footer':function(_0x1ba984,_0x106ccd){return{'text':_0x1ba984['toString']()+_0x093c('0x25')+_0x106ccd,'style':_0x093c('0x26')};},'defaultStyle':{'font':_0x093c('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x093c('0x28')},'footer':{'alignment':_0x093c('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x196f3c){var _0x140703=0x1388;var _0x37176a;if(!_0x196f3c[0x0][_0x093c('0x2a')]){return analyticExtractedReport(_0x093c('0x2b'));}var _0x28fb41=[];var _0x17d877=0x0;var _0x299559=!![];var _0x49b2e3=path[_0x093c('0x2c')](PATH);var _0x307a29=path['basename'](PATH,_0x093c('0x2d'));var _0x9c2046=path['join'](_0x49b2e3,util[_0x093c('0x1b')](_0x093c('0x2e'),_0x307a29,_0x093c('0x2f')));var _0x25db75=![];return db[_0x093c('0x30')][_0x093c('0x31')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x093c('0x32'),_0x093c('0x33')]})[_0x093c('0x34')](function(_0x3a37ce){if(_0x3a37ce){_0x37176a=_0x3a37ce;_0x140703=_0x37176a[_0x093c('0x33')]||0x3e8;}})[_0x093c('0x34')](function(){if(_0x196f3c&&_0x196f3c['length']){var _0xa61cea=_0x196f3c[0x0][_0x093c('0x2a')]%(_0x17d877+_0x140703);if(_0x37176a['split']){for(;_0x299559;_0x17d877+=_0x140703,_0xa61cea=_0x196f3c[0x0][_0x093c('0x2a')]%(_0x17d877+_0x140703)){if(_0xa61cea==0x0||_0xa61cea==_0x196f3c[0x0][_0x093c('0x2a')]){_0x299559=![];}_0x28fb41[_0x093c('0x16')](dbH[_0x093c('0x35')][_0x093c('0x36')](util[_0x093c('0x1b')](_0x093c('0x37'),QUERY,_0x140703,_0x17d877),{'type':dbH[_0x093c('0x35')][_0x093c('0x38')][_0x093c('0x39')]}));}}else{_0x28fb41['push'](dbH[_0x093c('0x35')][_0x093c('0x36')](QUERY,{'type':dbH[_0x093c('0x35')][_0x093c('0x38')][_0x093c('0x39')]}));}}_0x25db75=_0x37176a[_0x093c('0x32')]&&_0x28fb41[_0x093c('0x14')]>0x1;if(!fs[_0x093c('0x3a')](path['join'](_0x49b2e3,_0x307a29))&&_0x25db75){fs['mkdirSync'](path[_0x093c('0x3b')](_0x49b2e3,_0x307a29));}return Promise[_0x093c('0x3c')](_0x28fb41);})[_0x093c('0x34')](function(_0x2817d5){return createTables(_[_0x093c('0x3d')](_0x2817d5));})[_0x093c('0x34')](function(_0x46a695){var _0x5e032d=getPDFDocDefinition(_0x46a695);var _0x295c59=getPDFPrinter();var _0x1a40a2=_0x295c59[_0x093c('0x3e')](_0x5e032d);if(_0x25db75)_0x9c2046=path[_0x093c('0x3b')](_0x49b2e3,_0x307a29,util['format'](_0x093c('0x3f'),_0x307a29,index,'pdf'));return writePDFDocument(_0x1a40a2,_0x9c2046);})[_0x093c('0x34')](function(){if(!_0x25db75)return;zipdir(path[_0x093c('0x3b')](_0x49b2e3,_0x307a29),{'saveTo':path['join'](_0x49b2e3,util[_0x093c('0x1b')](_0x093c('0x2e'),_0x307a29,_0x093c('0x40')))},function(_0x6157c8){if(_0x6157c8)throw _0x6157c8;return;});})[_0x093c('0x34')](function(){if(!_0x25db75)return;rimraf(path[_0x093c('0x3b')](_0x49b2e3,_0x307a29),function(){});})[_0x093c('0x34')](function(){logger[_0x093c('0x41')](util[_0x093c('0x1b')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x093c('0x42')));return analyticExtractedReport(_0x093c('0x43'),_0x25db75?util[_0x093c('0x1b')](_0x093c('0x2e'),_0x307a29,_0x25db75?_0x093c('0x40'):_0x093c('0x2f')):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x093c('0x1b')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'));return db[_0x093c('0xe')][_0x093c('0x44')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1a6b67){EXTRACTED_REPORT=_0x1a6b67;return dbH[_0x093c('0x35')][_0x093c('0x36')](util['format'](_0x093c('0x45'),QUERY),{'type':dbH[_0x093c('0x35')][_0x093c('0x38')]['SELECT']});})[_0x093c('0x34')](extractReport)['catch'](function(_0x2f1d59){logger[_0x093c('0x41')](util['format'](_0x093c('0x46'),EXTRACTED_REPORT_ID,_0x093c('0x47')),util[_0x093c('0x48')](_0x2f1d59,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x093c('0x49'));})[_0x093c('0x4a')](function(){process[_0x093c('0x4b')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x34bed0=new PdfPrinter({'Arial':{'normal':__dirname+_0x093c('0x4c'),'bold':__dirname+_0x093c('0x4d'),'italics':__dirname+_0x093c('0x4e'),'bolditalics':__dirname+_0x093c('0x4f')}});return _0x34bed0;}function getPDFDocDefinitionFromHTML(_0x8b61b4,_0x2c0011){var _0x2d8dba=util['format'](_0x093c('0x50'),_0x2c0011[_0x093c('0x51')],_0x2c0011['interactionId']);var _0x1c9b73=moment()[_0x093c('0x1b')](_0x093c('0x52'))[_0x093c('0x53')]();var _0x35a8d1=htmlToPdfmake(_0x8b61b4,{'window':window,'tableAutoSize':!![]});return{'content':[_0x35a8d1],'defaultStyle':{'font':_0x093c('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x093c('0x54'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x093c('0x54'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x093c('0x54')}},'header':function(){return[{'text':_0x093c('0x55'),'style':_0x093c('0x20')}];},'footer':function(_0xace0a7,_0x95c8dc){return[{'text':util[_0x093c('0x1b')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x2d8dba,_0xace0a7,_0x95c8dc,_0x1c9b73),'style':_0x093c('0x26')}];}};}function writePDFDocument(_0x1fb30e,_0x23b7c8){return new Promise(function(_0x19b318,_0x58b14b){var _0x6ed0b2=_0x1fb30e[_0x093c('0x56')](fs[_0x093c('0x57')](_0x23b7c8));_0x6ed0b2['on'](_0x093c('0x58'),function(){_0x19b318(_0x093c('0x58'));});_0x6ed0b2['on']('error',function(_0x48085a){_0x58b14b(_0x48085a);});_0x1fb30e[_0x093c('0x59')]();});}exports[_0x093c('0x5a')]=function(_0xa89d5,_0x5d9348){var _0x126e55=getPDFPrinter();var _0x12502a=getPDFDocDefinitionFromHTML(_0xa89d5,_0x5d9348);var _0x4cd0c7=_0x126e55[_0x093c('0x3e')](_0x12502a);return writePDFDocument(_0x4cd0c7,_0x5d9348[_0x093c('0x2')])[_0x093c('0x5b')](function(_0x15a258){throw _0x15a258;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 9ecbf46..d8b4aad 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 _0x405c=['dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','mkdirSync','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip','info','catch','inspect','Failed','util','path','json2xls','bluebird','zip-dir','rimraf','../../mysqldb'];(function(_0x5999ba,_0x97b26a){var _0x2140b5=function(_0x23b3fb){while(--_0x23b3fb){_0x5999ba['push'](_0x5999ba['shift']());}};_0x2140b5(++_0x97b26a);}(_0x405c,0x171));var _0xc405=function(_0xf4bf19,_0x4b7d39){_0xf4bf19=_0xf4bf19-0x0;var _0x3d2ddf=_0x405c[_0xf4bf19];return _0x3d2ddf;};'use strict';var util=require(_0xc405('0x0'));var path=require(_0xc405('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0xc405('0x2'));var BPromise=require(_0xc405('0x3'));var zipdir=require(_0xc405('0x4'));var rimraf=require(_0xc405('0x5'));var db=require(_0xc405('0x6'))['db'];var dbH=require(_0xc405('0x6'))[_0xc405('0x7')];var logger=require(_0xc405('0x8'))(_0xc405('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xc405('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xc405('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xcbf878,_0x4333e5){var _0x2ccbdd={'status':_0xcbf878};var _0x3e0115={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4333e5){_0x2ccbdd[_0xc405('0xb')]=_0x4333e5;}return db[_0xc405('0xc')][_0xc405('0xd')](_0x2ccbdd,_0x3e0115);}function main(){var _0x4521af=0x1388;var _0x142e69;logger['info'](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xc405('0xe')));return db[_0xc405('0xf')][_0xc405('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc405('0x11'),_0xc405('0x12')]})[_0xc405('0x13')](function(_0x172f86){if(_0x172f86){_0x142e69=_0x172f86;_0x4521af=_0x142e69[_0xc405('0x12')]||0x1388;}})['then'](function(){return dbH[_0xc405('0x14')][_0xc405('0x15')](util[_0xc405('0x16')](_0xc405('0x17'),QUERY),{'type':dbH['sequelize'][_0xc405('0x18')][_0xc405('0x19')]});})['then'](function(_0x51f3f1){if(!_0x51f3f1[0x0]['num']){return analyticExtractedReport(_0xc405('0x1a'));}var _0x3db92e=[];var _0x1c794e=0x0;var _0x415695=!![];if(_0x142e69[_0xc405('0x11')]){if(_0x51f3f1&&_0x51f3f1[_0xc405('0x1b')]){var _0x1e21af=_0x51f3f1[0x0][_0xc405('0x1c')]%(_0x1c794e+_0x4521af);for(;_0x415695;_0x1c794e+=_0x4521af,_0x1e21af=_0x51f3f1[0x0][_0xc405('0x1c')]%(_0x1c794e+_0x4521af)){if(_0x1e21af==0x0||_0x1e21af==_0x51f3f1[0x0]['num']){_0x415695=![];}_0x3db92e[_0xc405('0x1d')](dbH['sequelize'][_0xc405('0x15')](util['format'](_0xc405('0x1e'),QUERY,_0x4521af,_0x1c794e),{'type':dbH[_0xc405('0x14')]['QueryTypes'][_0xc405('0x19')]}));}}}else{_0x3db92e['push'](dbH[_0xc405('0x14')][_0xc405('0x15')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xc405('0x19')]}));}var _0x4999c0=path[_0xc405('0x1f')](PATH);var _0x184ecf=path[_0xc405('0x20')](PATH,_0xc405('0x21'));var _0x3f336e=_0x142e69[_0xc405('0x11')]&&_0x3db92e[_0xc405('0x1b')]>0x1;var _0x24415d=[];if(!fs[_0xc405('0x22')](path[_0xc405('0x23')](_0x4999c0,_0x184ecf))&&_0x3f336e){fs[_0xc405('0x24')](path[_0xc405('0x23')](_0x4999c0,_0x184ecf));}return BPromise['each'](_0x3db92e,function(_0x34af27){_0x24415d['push'](_0x34af27);})[_0xc405('0x13')](function(){for(var _0x43720a=0x0;_0x43720a<_0x24415d['length'];_0x43720a+=0x1){var _0x3fae41;var _0x24f7e5=_0x24415d[_0x43720a];if(_0x3f336e){_0x3fae41=path[_0xc405('0x23')](_0x4999c0,_0x184ecf,util[_0xc405('0x16')](_0xc405('0x25'),_0x184ecf,_0x43720a,'xlsx'));}else{_0x3fae41=path[_0xc405('0x23')](_0x4999c0,util[_0xc405('0x16')](_0xc405('0x26'),_0x184ecf,_0xc405('0x27')));}fs[_0xc405('0x28')](_0x3fae41,json2xls(_0x24f7e5),_0xc405('0x29'));}})[_0xc405('0x13')](function(){if(_0x3f336e){zipdir(path['join'](_0x4999c0,_0x184ecf),{'saveTo':path['join'](_0x4999c0,util['format'](_0xc405('0x26'),_0x184ecf,_0xc405('0x2a')))},function(_0x369b63,_0x3f0407){});rimraf(path[_0xc405('0x23')](_0x4999c0,_0x184ecf),function(){});}})[_0xc405('0x13')](function(){logger[_0xc405('0x2b')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xc405('0xe')));return analyticExtractedReport('Completed',_0x3f336e?util[_0xc405('0x16')](_0xc405('0x26'),_0x184ecf,_0x3f336e?'zip':_0xc405('0x27')):null);});})[_0xc405('0x2c')](function(_0x3f8efa){logger[_0xc405('0x2b')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xc405('0xe')),util[_0xc405('0x2d')](_0x3f8efa,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc405('0x2e'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x6d81=['sequelize','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','length','query','QueryTypes','push','basename','existsSync','join','%s%d.%s','xlsx','%s.%s','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','exit','path','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','splitSizeXlsx','then'];(function(_0x1e93bc,_0x8464e){var _0x22b0a9=function(_0x11e583){while(--_0x11e583){_0x1e93bc['push'](_0x1e93bc['shift']());}};_0x22b0a9(++_0x8464e);}(_0x6d81,0x188));var _0x16d8=function(_0x445e6e,_0xb06aca){_0x445e6e=_0x445e6e-0x0;var _0x3d7222=_0x6d81[_0x445e6e];return _0x3d7222;};'use strict';var util=require('util');var path=require(_0x16d8('0x0'));var _=require(_0x16d8('0x1'));var fs=require('fs');var json2xls=require(_0x16d8('0x2'));var BPromise=require(_0x16d8('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x16d8('0x4'));var db=require(_0x16d8('0x5'))['db'];var dbH=require('../../mysqldb')[_0x16d8('0x6')];var logger=require(_0x16d8('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x16d8('0x8')][0x2]);var QUERY=process[_0x16d8('0x8')][0x3];var PATH=process[_0x16d8('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3a4ed1,_0xe6af9a){var _0x51ad94={'status':_0x3a4ed1};var _0x2a2b7a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xe6af9a){_0x51ad94[_0x16d8('0x9')]=_0xe6af9a;}return db['AnalyticExtractedReport'][_0x16d8('0xa')](_0x51ad94,_0x2a2b7a);}function main(){var _0x3ae550=0x1388;var _0x306de6;logger[_0x16d8('0xb')](util['format'](_0x16d8('0xc'),EXTRACTED_REPORT_ID,_0x16d8('0xd')));return db[_0x16d8('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x16d8('0xf'),_0x16d8('0x10')]})[_0x16d8('0x11')](function(_0x2d71d7){if(_0x2d71d7){_0x306de6=_0x2d71d7;_0x3ae550=_0x306de6['splitSizeXlsx']||0x1388;}})[_0x16d8('0x11')](function(){return dbH[_0x16d8('0x12')]['query'](util[_0x16d8('0x13')](_0x16d8('0x14'),QUERY),{'type':dbH[_0x16d8('0x12')]['QueryTypes'][_0x16d8('0x15')]});})[_0x16d8('0x11')](function(_0x77d65a){if(!_0x77d65a[0x0][_0x16d8('0x16')]){return analyticExtractedReport(_0x16d8('0x17'));}var _0x5df8f6=[];var _0x2c15ec=0x0;var _0x21e281=!![];if(_0x306de6['split']){if(_0x77d65a&&_0x77d65a[_0x16d8('0x18')]){var _0x10f11e=_0x77d65a[0x0][_0x16d8('0x16')]%(_0x2c15ec+_0x3ae550);for(;_0x21e281;_0x2c15ec+=_0x3ae550,_0x10f11e=_0x77d65a[0x0][_0x16d8('0x16')]%(_0x2c15ec+_0x3ae550)){if(_0x10f11e==0x0||_0x10f11e==_0x77d65a[0x0][_0x16d8('0x16')]){_0x21e281=![];}_0x5df8f6['push'](dbH[_0x16d8('0x12')][_0x16d8('0x19')](util[_0x16d8('0x13')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3ae550,_0x2c15ec),{'type':dbH[_0x16d8('0x12')][_0x16d8('0x1a')][_0x16d8('0x15')]}));}}}else{_0x5df8f6[_0x16d8('0x1b')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x16d8('0x12')][_0x16d8('0x1a')][_0x16d8('0x15')]}));}var _0x1cef8e=path['dirname'](PATH);var _0x17dfa8=path[_0x16d8('0x1c')](PATH,'.xlsx');var _0x14d788=_0x306de6['split']&&_0x5df8f6[_0x16d8('0x18')]>0x1;var _0x153159=[];if(!fs[_0x16d8('0x1d')](path['join'](_0x1cef8e,_0x17dfa8))&&_0x14d788){fs['mkdirSync'](path[_0x16d8('0x1e')](_0x1cef8e,_0x17dfa8));}return BPromise['each'](_0x5df8f6,function(_0x47ffb5){_0x153159['push'](_0x47ffb5);})[_0x16d8('0x11')](function(){for(var _0x53e00a=0x0;_0x53e00a<_0x153159[_0x16d8('0x18')];_0x53e00a+=0x1){var _0x437f0b;var _0x2c1745=_0x153159[_0x53e00a];if(_0x14d788){_0x437f0b=path['join'](_0x1cef8e,_0x17dfa8,util[_0x16d8('0x13')](_0x16d8('0x1f'),_0x17dfa8,_0x53e00a,_0x16d8('0x20')));}else{_0x437f0b=path[_0x16d8('0x1e')](_0x1cef8e,util['format'](_0x16d8('0x21'),_0x17dfa8,_0x16d8('0x20')));}fs[_0x16d8('0x22')](_0x437f0b,json2xls(_0x2c1745),'binary');}})[_0x16d8('0x11')](function(){if(_0x14d788){zipdir(path[_0x16d8('0x1e')](_0x1cef8e,_0x17dfa8),{'saveTo':path[_0x16d8('0x1e')](_0x1cef8e,util[_0x16d8('0x13')](_0x16d8('0x21'),_0x17dfa8,'zip'))},function(_0x4b8072,_0x2a87da){});rimraf(path[_0x16d8('0x1e')](_0x1cef8e,_0x17dfa8),function(){});}})[_0x16d8('0x11')](function(){logger[_0x16d8('0xb')](util[_0x16d8('0x13')](_0x16d8('0x23'),EXTRACTED_REPORT_ID,_0x16d8('0xd')));return analyticExtractedReport(_0x16d8('0x24'),_0x14d788?util[_0x16d8('0x13')](_0x16d8('0x21'),_0x17dfa8,_0x14d788?_0x16d8('0x25'):_0x16d8('0x20')):null);});})[_0x16d8('0x26')](function(_0x8b3826){logger['info'](util[_0x16d8('0x13')](_0x16d8('0x27'),EXTRACTED_REPORT_ID,_0x16d8('0xd')),util['inspect'](_0x8b3826,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0x16d8('0x28')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 4fbead7..1edf27a 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 _0x705e=['format','CDR(type)=%s','context','VoiceExtensionId','inbound','outbound','CDR(destination)=','extension','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','tag','CDR(tag)=','length','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','splice',',${EXTEN},','last','Hangup','concat','destroy','bulkCreate','error','util','Interval','findAll','intervals','models','IntervalId','then','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','find','push','type','Set'];(function(_0x52a6e3,_0x4a73b4){var _0x8910d0=function(_0x57e5ef){while(--_0x57e5ef){_0x52a6e3['push'](_0x52a6e3['shift']());}};_0x8910d0(++_0x4a73b4);}(_0x705e,0x13d));var _0xe705=function(_0x195662,_0x30db00){_0x195662=_0x195662-0x0;var _0x3ef225=_0x705e[_0x195662];return _0x3ef225;};'use strict';var _=require('lodash');var util=require(_0xe705('0x0'));function rewrite(_0x2e8ba6,_0x97f30c){var _0x7bf904=this;return _0x2e8ba6['models'][_0xe705('0x1')][_0xe705('0x2')]({'raw':!![]})['then'](function(_0x30640e){_0x7bf904[_0xe705('0x3')]=_0x30640e;return _0x2e8ba6[_0xe705('0x4')]['VoiceExtension'][_0xe705('0x2')]({'where':{'IntervalId':_0x97f30c[_0xe705('0x5')]},'raw':!![]});})[_0xe705('0x6')](function(_0x3502a9){return _0x2e8ba6[_0xe705('0x4')][_0xe705('0x7')][_0xe705('0x2')]({'where':{'exten':{'$in':_[_0xe705('0x8')](_[_0xe705('0x9')](_0x3502a9,_0xe705('0xa')))}},'order':[{'raw':_0xe705('0xb')}],'raw':!![]});})[_0xe705('0x6')](function(_0x484031){var _0x1f9196=_['filter'](_0x484031,{'priority':'1'});var _0x1fe358=_[_0xe705('0xc')](_0x484031,{'isApp':0x1});var _0x4bd1f2=_[_0xe705('0xd')](_0x1fe358,_0xe705('0xa'));var _0x256816=[_0xe705('0xe'),_0xe705('0xf')];var _0x4f8b3a=[];var _0x25db5a=[];for(var _0x4c28d5 in _0x4bd1f2){if(_0x4bd1f2[_0xe705('0x10')](_0x4c28d5)){_0x7bf904[_0xe705('0x11')]=0x2;_0x7bf904[_0xe705('0x12')]=[];_0x7bf904['extension']=_[_0xe705('0x13')](_0x1f9196,{'exten':_0x4bd1f2[_0x4c28d5][0x0]['exten']});_0x7bf904[_0xe705('0x12')][_0xe705('0x14')]({'type':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x15')],'app':_0xe705('0x16'),'appdata':util[_0xe705('0x17')](_0xe705('0x18'),_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x15')]),'context':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x19')],'exten':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0xa')],'priority':_0x7bf904[_0xe705('0x11')]++,'VoiceExtensionId':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x1a')]});if(_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x15')]===_0xe705('0x1b')){_0x7bf904[_0xe705('0x12')][_0xe705('0x14')]({'type':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x15')],'app':_0xe705('0x16'),'appdata':'CDR(routeid)='+_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x1a')],'context':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x19')],'exten':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0xa')],'priority':_0x7bf904[_0xe705('0x11')]++,'VoiceExtensionId':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x1a')]});}else if(_0x4bd1f2[_0x4c28d5][0x0]['type']===_0xe705('0x1c')){if(_0x7bf904['extension']){_0x7bf904[_0xe705('0x12')][_0xe705('0x14')]({'type':_0x4bd1f2[_0x4c28d5][0x0]['type'],'app':_0xe705('0x16'),'appdata':_0xe705('0x1d')+(_0x7bf904[_0xe705('0x1e')][_0xe705('0x1f')]?_0xe705('0x20')+_0x7bf904[_0xe705('0x1e')][_0xe705('0x1f')]+'}':_0xe705('0x21')),'context':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x19')],'exten':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0xa')],'priority':_0x7bf904[_0xe705('0x11')]++,'VoiceExtensionId':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x1a')]});}_0x7bf904[_0xe705('0x12')]['push']({'type':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x15')],'app':'Set','appdata':_0xe705('0x22')+_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x1a')],'context':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x19')],'exten':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0xa')],'priority':_0x7bf904['priority']++,'VoiceExtensionId':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x1a')]});var _0x1a74c8=_0x7bf904[_0xe705('0x11')]++;_0x7bf904['extensions'][_0xe705('0x14')]({'type':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x15')],'app':'ExecIf','appdata':_0xe705('0x23')+(_0x1a74c8+0x2)+'):Goto('+(_0x1a74c8+0x1)+')','context':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x19')],'exten':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0xa')],'priority':_0x1a74c8,'VoiceExtensionId':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x1a')]});if(_0x7bf904['extension']){_0x7bf904[_0xe705('0x12')][_0xe705('0x14')]({'type':_0x4bd1f2[_0x4c28d5][0x0]['type'],'app':_0xe705('0x16'),'appdata':_0x7bf904[_0xe705('0x1e')][_0xe705('0x1f')]?'CDR(prefix)=${EXTEN:0:'+_0x7bf904[_0xe705('0x1e')]['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x19')],'exten':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0xa')],'priority':_0x7bf904['priority']++,'VoiceExtensionId':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x1a')]});}_0x7bf904[_0xe705('0x12')]['push']({'type':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x15')],'app':'Set','appdata':_0xe705('0x24')+_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x1a')],'context':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x19')],'exten':_0x4bd1f2[_0x4c28d5][0x0]['exten'],'priority':_0x7bf904[_0xe705('0x11')]++,'VoiceExtensionId':_0x4bd1f2[_0x4c28d5][0x0]['VoiceExtensionId']});if(_0x7bf904['extension']&&_0x7bf904['extension'][_0xe705('0x10')](_0xe705('0x25'))&&_0x7bf904[_0xe705('0x1e')][_0xe705('0x25')]!==_0xe705('0x26')){_0x7bf904['extensions'][_0xe705('0x14')]({'type':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x15')],'app':_0xe705('0x16'),'appdata':_0xe705('0x27'),'context':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x19')],'exten':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0xa')],'priority':_0x7bf904['priority']++,'VoiceExtensionId':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x1a')]});_0x7bf904[_0xe705('0x12')][_0xe705('0x14')]({'type':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x15')],'app':_0xe705('0x16'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x7bf904['extension'][_0xe705('0x25')]||_0xe705('0x28'),'context':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x19')],'exten':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0xa')],'priority':_0x7bf904[_0xe705('0x11')]++,'VoiceExtensionId':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x1a')]});}}_0x7bf904[_0xe705('0x12')][_0xe705('0x14')]({'type':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x15')],'app':_0xe705('0x16'),'appdata':_0xe705('0x29'),'context':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x19')],'exten':_0x4bd1f2[_0x4c28d5][0x0]['exten'],'priority':_0x7bf904[_0xe705('0x11')]++,'VoiceExtensionId':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x1a')]});_0x7bf904[_0xe705('0x12')][_0xe705('0x14')]({'type':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x15')],'app':'Set','appdata':_0xe705('0x2a'),'context':_0x4bd1f2[_0x4c28d5][0x0]['context'],'exten':_0x4bd1f2[_0x4c28d5][0x0]['exten'],'priority':_0x7bf904[_0xe705('0x11')]++,'VoiceExtensionId':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x1a')]});_0x7bf904[_0xe705('0x12')][_0xe705('0x14')]({'type':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x15')],'app':_0xe705('0x16'),'appdata':_0xe705('0x2b'),'context':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x19')],'exten':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0xa')],'priority':_0x7bf904['priority']++,'VoiceExtensionId':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x1a')]});for(var _0x5011d4=0x0,_0x108e5e=0x0;_0x5011d4<_0x4bd1f2[_0x4c28d5]['length'];_0x5011d4+=0x1,_0x108e5e=0x0){var _0x97cc4a=_0x4bd1f2[_0x4c28d5][_0x5011d4];if(_0x97cc4a[_0xe705('0x15')]){_0x97cc4a['type']=_0x97cc4a['type'][_0xe705('0x2c')]();}var _0x55bb02=[];var _0x2793f2=[];delete _0x97cc4a['id'];delete _0x97cc4a[_0xe705('0x2d')];delete _0x97cc4a[_0xe705('0x2e')];var _0x5e69fc=_0x97cc4a[_0xe705('0x2f')]!=='*,*,*,*'?[_0x97cc4a['interval']]:_0x97cc4a['IntervalId']?_[_0xe705('0x9')](_[_0xe705('0xc')](_0x7bf904[_0xe705('0x3')],{'IntervalId':_0x97cc4a[_0xe705('0x5')]}),_0xe705('0x2f')):[];if(_0x97cc4a[_0xe705('0x10')]('tag')){if(_0x97cc4a[_0xe705('0x30')]&&_0x97cc4a[_0xe705('0x30')]!=='--'){_0x55bb02[_0xe705('0x14')]({'type':_0x97cc4a['type'],'app':'Set','appdata':_0xe705('0x31')+_0x97cc4a[_0xe705('0x30')],'context':_0x97cc4a[_0xe705('0x19')],'exten':_0x97cc4a[_0xe705('0xa')],'priority':_0x5e69fc[_0xe705('0x32')]+_0x7bf904['priority']+_0x108e5e++,'VoiceExtensionId':_0x97cc4a[_0xe705('0x1a')]});}}if(_0x97cc4a[_0xe705('0x15')]===_0xe705('0x1c')&&_0x97cc4a[_0xe705('0x10')]('callerID')){if(_0x97cc4a[_0xe705('0x33')]){_0x55bb02[_0xe705('0x14')]({'type':_0x97cc4a[_0xe705('0x15')],'app':_0xe705('0x34'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x97cc4a[_0xe705('0x33')]+')','context':_0x97cc4a[_0xe705('0x19')],'exten':_0x97cc4a[_0xe705('0xa')],'priority':_0x5e69fc[_0xe705('0x32')]+_0x7bf904[_0xe705('0x11')]+_0x108e5e++,'VoiceExtensionId':_0x97cc4a[_0xe705('0x1a')]});}else{_0x55bb02[_0xe705('0x14')]({'type':_0x97cc4a[_0xe705('0x15')],'app':'ExecIf','appdata':_0xe705('0x35'),'context':_0x97cc4a[_0xe705('0x19')],'exten':_0x97cc4a['exten'],'priority':_0x5e69fc[_0xe705('0x32')]+_0x7bf904['priority']+_0x108e5e++,'VoiceExtensionId':_0x97cc4a[_0xe705('0x1a')]});}}if(_0x97cc4a[_0xe705('0x10')](_0xe705('0x36'))){if(_0x256816[_0xe705('0x37')](_0x97cc4a['app'][_0xe705('0x2c')]())>=0x0&&_0x97cc4a[_0xe705('0x38')]!==_0xe705('0x39')){if(_0x97cc4a['answer']){_0x55bb02[_0xe705('0x14')]({'type':_0x97cc4a[_0xe705('0x15')],'app':'ExecIf','appdata':_0xe705('0x3a'),'context':_0x97cc4a[_0xe705('0x19')],'exten':_0x97cc4a[_0xe705('0xa')],'priority':_0x5e69fc['length']+_0x7bf904[_0xe705('0x11')]+_0x108e5e++,'VoiceExtensionId':_0x97cc4a[_0xe705('0x1a')]});_0x55bb02[_0xe705('0x14')]({'type':_0x97cc4a[_0xe705('0x15')],'app':_0xe705('0x16'),'appdata':_0xe705('0x3b'),'context':_0x97cc4a['context'],'exten':_0x97cc4a[_0xe705('0xa')],'priority':_0x5e69fc['length']+_0x7bf904[_0xe705('0x11')]+_0x108e5e++,'VoiceExtensionId':_0x97cc4a['VoiceExtensionId']});}else{_0x55bb02['push']({'type':_0x97cc4a[_0xe705('0x15')],'app':_0xe705('0x34'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x97cc4a[_0xe705('0x19')],'exten':_0x97cc4a[_0xe705('0xa')],'priority':_0x5e69fc[_0xe705('0x32')]+_0x7bf904[_0xe705('0x11')]+_0x108e5e++,'VoiceExtensionId':_0x97cc4a[_0xe705('0x1a')]});_0x55bb02[_0xe705('0x14')]({'type':_0x97cc4a['type'],'app':_0xe705('0x16'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x97cc4a['context'],'exten':_0x97cc4a[_0xe705('0xa')],'priority':_0x5e69fc['length']+_0x7bf904[_0xe705('0x11')]+_0x108e5e++,'VoiceExtensionId':_0x97cc4a[_0xe705('0x1a')]});}}}for(var _0x353707=0x0;_0x353707<_0x5e69fc['length'];_0x353707+=0x1){var _0x4afb54=_0x7bf904['priority']+_0x5e69fc[_0xe705('0x32')];var _0x4f34c5=_0x353707===_0x5e69fc[_0xe705('0x32')]-0x1?_0x7bf904[_0xe705('0x11')]+_0x55bb02['length']+_0x2793f2['length']+0x2:_0x7bf904[_0xe705('0x11')]+_0x353707+0x1;_0x55bb02[_0xe705('0x3c')](_0x353707,0x0,{'type':_0x97cc4a[_0xe705('0x15')],'app':'GotoIfTime','appdata':_0x5e69fc[_0x353707]+'?'+_0x97cc4a['context']+_0xe705('0x3d')+_0x4afb54+':'+_0x97cc4a['context']+_0xe705('0x3d')+_0x4f34c5,'exten':_0x97cc4a[_0xe705('0xa')],'context':_0x97cc4a[_0xe705('0x19')],'priority':_0x7bf904[_0xe705('0x11')]+_0x353707,'VoiceExtensionId':_0x4bd1f2[_0x4c28d5][0x0]['VoiceExtensionId']});}_0x97cc4a['priority']=_0x55bb02[_0xe705('0x32')]?_[_0xe705('0x3e')](_0x55bb02)[_0xe705('0x11')]+0x1:_0x7bf904[_0xe705('0x11')];_0x7bf904[_0xe705('0x11')]=(_0x2793f2[_0xe705('0x32')]?_[_0xe705('0x3e')](_0x2793f2)['priority']:_0x97cc4a[_0xe705('0x11')])+0x1;_0x7bf904[_0xe705('0x12')]=_['concat'](_0x7bf904['extensions'],_0x55bb02,[_0x97cc4a],_0x2793f2);}_0x7bf904[_0xe705('0x12')][_0xe705('0x14')]({'type':_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x15')],'app':_0xe705('0x3f'),'exten':_0x4bd1f2[_0x4c28d5][0x0]['exten'],'context':_0x4bd1f2[_0x4c28d5][0x0]['context'],'priority':_0x7bf904[_0xe705('0x11')],'VoiceExtensionId':_0x4bd1f2[_0x4c28d5][0x0]['VoiceExtensionId']});_0x4f8b3a[_0xe705('0x14')](_0x4bd1f2[_0x4c28d5][0x0][_0xe705('0x1a')]);_0x25db5a=_[_0xe705('0x40')](_0x25db5a,_0x7bf904[_0xe705('0x12')]);}}return _0x2e8ba6['transaction'](function(_0x3697b8){return _0x2e8ba6[_0xe705('0x4')][_0xe705('0x7')][_0xe705('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x4f8b3a}},'transaction':_0x3697b8})['then'](function(_0x29b6e6){return _0x2e8ba6['models'][_0xe705('0x7')][_0xe705('0x42')](_['sortBy'](_0x25db5a,_0xe705('0x11')),{'transaction':_0x3697b8});});});})['catch'](function(_0x525ccd){console[_0xe705('0x43')](_0x525ccd);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x875c=['destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','intervals','VoiceExtension','IntervalId','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','hasOwnProperty','priority','extensions','find','push','type','Set','format','VoiceExtensionId','inbound','CDR(routeid)=','context','outbound','extension','${EXTEN:','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','recordingFormat','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','length','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction'];(function(_0x2b87c9,_0x59671a){var _0x328684=function(_0xbeabd4){while(--_0xbeabd4){_0x2b87c9['push'](_0x2b87c9['shift']());}};_0x328684(++_0x59671a);}(_0x875c,0x12e));var _0xc875=function(_0x5e9079,_0x9f5971){_0x5e9079=_0x5e9079-0x0;var _0x2ca1a1=_0x875c[_0x5e9079];return _0x2ca1a1;};'use strict';var _=require(_0xc875('0x0'));var util=require(_0xc875('0x1'));function rewrite(_0x52ef53,_0x4c1e17){var _0x10df5b=this;return _0x52ef53[_0xc875('0x2')][_0xc875('0x3')][_0xc875('0x4')]({'raw':!![]})['then'](function(_0x458c32){_0x10df5b[_0xc875('0x5')]=_0x458c32;return _0x52ef53['models'][_0xc875('0x6')][_0xc875('0x4')]({'where':{'IntervalId':_0x4c1e17[_0xc875('0x7')]},'raw':!![]});})[_0xc875('0x8')](function(_0xa363bf){return _0x52ef53[_0xc875('0x2')][_0xc875('0x6')][_0xc875('0x4')]({'where':{'exten':{'$in':_[_0xc875('0x9')](_[_0xc875('0xa')](_0xa363bf,_0xc875('0xb')))}},'order':[{'raw':_0xc875('0xc')}],'raw':!![]});})[_0xc875('0x8')](function(_0x3e5400){var _0x3894a2=_['filter'](_0x3e5400,{'priority':'1'});var _0x25dabc=_[_0xc875('0xd')](_0x3e5400,{'isApp':0x1});var _0x314230=_[_0xc875('0xe')](_0x25dabc,_0xc875('0xb'));var _0x4413be=['queue','playback'];var _0x15010=[];var _0x41828f=[];for(var _0x33d55e in _0x314230){if(_0x314230[_0xc875('0xf')](_0x33d55e)){_0x10df5b[_0xc875('0x10')]=0x2;_0x10df5b[_0xc875('0x11')]=[];_0x10df5b['extension']=_[_0xc875('0x12')](_0x3894a2,{'exten':_0x314230[_0x33d55e][0x0]['exten']});_0x10df5b[_0xc875('0x11')][_0xc875('0x13')]({'type':_0x314230[_0x33d55e][0x0][_0xc875('0x14')],'app':_0xc875('0x15'),'appdata':util[_0xc875('0x16')]('CDR(type)=%s',_0x314230[_0x33d55e][0x0][_0xc875('0x14')]),'context':_0x314230[_0x33d55e][0x0]['context'],'exten':_0x314230[_0x33d55e][0x0][_0xc875('0xb')],'priority':_0x10df5b['priority']++,'VoiceExtensionId':_0x314230[_0x33d55e][0x0][_0xc875('0x17')]});if(_0x314230[_0x33d55e][0x0][_0xc875('0x14')]===_0xc875('0x18')){_0x10df5b[_0xc875('0x11')]['push']({'type':_0x314230[_0x33d55e][0x0][_0xc875('0x14')],'app':_0xc875('0x15'),'appdata':_0xc875('0x19')+_0x314230[_0x33d55e][0x0][_0xc875('0x17')],'context':_0x314230[_0x33d55e][0x0][_0xc875('0x1a')],'exten':_0x314230[_0x33d55e][0x0][_0xc875('0xb')],'priority':_0x10df5b[_0xc875('0x10')]++,'VoiceExtensionId':_0x314230[_0x33d55e][0x0]['VoiceExtensionId']});}else if(_0x314230[_0x33d55e][0x0]['type']===_0xc875('0x1b')){if(_0x10df5b[_0xc875('0x1c')]){_0x10df5b['extensions'][_0xc875('0x13')]({'type':_0x314230[_0x33d55e][0x0][_0xc875('0x14')],'app':_0xc875('0x15'),'appdata':'CDR(destination)='+(_0x10df5b['extension']['cutdigits']?_0xc875('0x1d')+_0x10df5b[_0xc875('0x1c')][_0xc875('0x1e')]+'}':_0xc875('0x1f')),'context':_0x314230[_0x33d55e][0x0]['context'],'exten':_0x314230[_0x33d55e][0x0][_0xc875('0xb')],'priority':_0x10df5b[_0xc875('0x10')]++,'VoiceExtensionId':_0x314230[_0x33d55e][0x0][_0xc875('0x17')]});}_0x10df5b['extensions'][_0xc875('0x13')]({'type':_0x314230[_0x33d55e][0x0]['type'],'app':_0xc875('0x15'),'appdata':'CDR(routeid)='+_0x314230[_0x33d55e][0x0]['VoiceExtensionId'],'context':_0x314230[_0x33d55e][0x0][_0xc875('0x1a')],'exten':_0x314230[_0x33d55e][0x0][_0xc875('0xb')],'priority':_0x10df5b['priority']++,'VoiceExtensionId':_0x314230[_0x33d55e][0x0][_0xc875('0x17')]});var _0x31abfa=_0x10df5b[_0xc875('0x10')]++;_0x10df5b[_0xc875('0x11')]['push']({'type':_0x314230[_0x33d55e][0x0][_0xc875('0x14')],'app':'ExecIf','appdata':_0xc875('0x20')+(_0x31abfa+0x2)+'):Goto('+(_0x31abfa+0x1)+')','context':_0x314230[_0x33d55e][0x0][_0xc875('0x1a')],'exten':_0x314230[_0x33d55e][0x0][_0xc875('0xb')],'priority':_0x31abfa,'VoiceExtensionId':_0x314230[_0x33d55e][0x0]['VoiceExtensionId']});if(_0x10df5b[_0xc875('0x1c')]){_0x10df5b[_0xc875('0x11')][_0xc875('0x13')]({'type':_0x314230[_0x33d55e][0x0][_0xc875('0x14')],'app':'Set','appdata':_0x10df5b[_0xc875('0x1c')]['cutdigits']?_0xc875('0x21')+_0x10df5b['extension'][_0xc875('0x1e')]+'}':'CDR(prefix)=noprefix','context':_0x314230[_0x33d55e][0x0][_0xc875('0x1a')],'exten':_0x314230[_0x33d55e][0x0][_0xc875('0xb')],'priority':_0x10df5b[_0xc875('0x10')]++,'VoiceExtensionId':_0x314230[_0x33d55e][0x0]['VoiceExtensionId']});}_0x10df5b[_0xc875('0x11')][_0xc875('0x13')]({'type':_0x314230[_0x33d55e][0x0][_0xc875('0x14')],'app':_0xc875('0x15'),'appdata':_0xc875('0x22')+_0x314230[_0x33d55e][0x0][_0xc875('0x17')],'context':_0x314230[_0x33d55e][0x0][_0xc875('0x1a')],'exten':_0x314230[_0x33d55e][0x0]['exten'],'priority':_0x10df5b['priority']++,'VoiceExtensionId':_0x314230[_0x33d55e][0x0]['VoiceExtensionId']});if(_0x10df5b['extension']&&_0x10df5b[_0xc875('0x1c')][_0xc875('0xf')]('recordingFormat')&&_0x10df5b[_0xc875('0x1c')]['recordingFormat']!==_0xc875('0x23')){_0x10df5b[_0xc875('0x11')][_0xc875('0x13')]({'type':_0x314230[_0x33d55e][0x0][_0xc875('0x14')],'app':_0xc875('0x15'),'appdata':_0xc875('0x24'),'context':_0x314230[_0x33d55e][0x0][_0xc875('0x1a')],'exten':_0x314230[_0x33d55e][0x0][_0xc875('0xb')],'priority':_0x10df5b[_0xc875('0x10')]++,'VoiceExtensionId':_0x314230[_0x33d55e][0x0]['VoiceExtensionId']});_0x10df5b[_0xc875('0x11')]['push']({'type':_0x314230[_0x33d55e][0x0][_0xc875('0x14')],'app':'Set','appdata':_0xc875('0x25')+_0x10df5b[_0xc875('0x1c')][_0xc875('0x26')]||_0xc875('0x27'),'context':_0x314230[_0x33d55e][0x0][_0xc875('0x1a')],'exten':_0x314230[_0x33d55e][0x0][_0xc875('0xb')],'priority':_0x10df5b['priority']++,'VoiceExtensionId':_0x314230[_0x33d55e][0x0][_0xc875('0x17')]});}}_0x10df5b[_0xc875('0x11')]['push']({'type':_0x314230[_0x33d55e][0x0][_0xc875('0x14')],'app':_0xc875('0x15'),'appdata':_0xc875('0x28'),'context':_0x314230[_0x33d55e][0x0][_0xc875('0x1a')],'exten':_0x314230[_0x33d55e][0x0][_0xc875('0xb')],'priority':_0x10df5b[_0xc875('0x10')]++,'VoiceExtensionId':_0x314230[_0x33d55e][0x0][_0xc875('0x17')]});_0x10df5b[_0xc875('0x11')]['push']({'type':_0x314230[_0x33d55e][0x0]['type'],'app':_0xc875('0x15'),'appdata':_0xc875('0x29'),'context':_0x314230[_0x33d55e][0x0][_0xc875('0x1a')],'exten':_0x314230[_0x33d55e][0x0][_0xc875('0xb')],'priority':_0x10df5b[_0xc875('0x10')]++,'VoiceExtensionId':_0x314230[_0x33d55e][0x0][_0xc875('0x17')]});_0x10df5b[_0xc875('0x11')][_0xc875('0x13')]({'type':_0x314230[_0x33d55e][0x0][_0xc875('0x14')],'app':_0xc875('0x15'),'appdata':_0xc875('0x2a'),'context':_0x314230[_0x33d55e][0x0][_0xc875('0x1a')],'exten':_0x314230[_0x33d55e][0x0][_0xc875('0xb')],'priority':_0x10df5b[_0xc875('0x10')]++,'VoiceExtensionId':_0x314230[_0x33d55e][0x0][_0xc875('0x17')]});for(var _0x120808=0x0,_0x255062=0x0;_0x120808<_0x314230[_0x33d55e]['length'];_0x120808+=0x1,_0x255062=0x0){var _0x1a701c=_0x314230[_0x33d55e][_0x120808];if(_0x1a701c[_0xc875('0x14')]){_0x1a701c[_0xc875('0x14')]=_0x1a701c['type'][_0xc875('0x2b')]();}var _0x4ad323=[];var _0x1f09a3=[];delete _0x1a701c['id'];delete _0x1a701c[_0xc875('0x2c')];delete _0x1a701c[_0xc875('0x2d')];var _0x407db0=_0x1a701c[_0xc875('0x2e')]!==_0xc875('0x2f')?[_0x1a701c[_0xc875('0x2e')]]:_0x1a701c['IntervalId']?_[_0xc875('0xa')](_[_0xc875('0xd')](_0x10df5b['intervals'],{'IntervalId':_0x1a701c[_0xc875('0x7')]}),'interval'):[];if(_0x1a701c[_0xc875('0xf')](_0xc875('0x30'))){if(_0x1a701c[_0xc875('0x30')]&&_0x1a701c['tag']!=='--'){_0x4ad323[_0xc875('0x13')]({'type':_0x1a701c[_0xc875('0x14')],'app':'Set','appdata':_0xc875('0x31')+_0x1a701c[_0xc875('0x30')],'context':_0x1a701c[_0xc875('0x1a')],'exten':_0x1a701c[_0xc875('0xb')],'priority':_0x407db0[_0xc875('0x32')]+_0x10df5b[_0xc875('0x10')]+_0x255062++,'VoiceExtensionId':_0x1a701c[_0xc875('0x17')]});}}if(_0x1a701c['type']===_0xc875('0x1b')&&_0x1a701c[_0xc875('0xf')](_0xc875('0x33'))){if(_0x1a701c[_0xc875('0x33')]){_0x4ad323['push']({'type':_0x1a701c[_0xc875('0x14')],'app':_0xc875('0x34'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x1a701c['callerID']+')','context':_0x1a701c[_0xc875('0x1a')],'exten':_0x1a701c['exten'],'priority':_0x407db0[_0xc875('0x32')]+_0x10df5b[_0xc875('0x10')]+_0x255062++,'VoiceExtensionId':_0x1a701c[_0xc875('0x17')]});}else{_0x4ad323['push']({'type':_0x1a701c[_0xc875('0x14')],'app':_0xc875('0x34'),'appdata':_0xc875('0x35'),'context':_0x1a701c[_0xc875('0x1a')],'exten':_0x1a701c[_0xc875('0xb')],'priority':_0x407db0[_0xc875('0x32')]+_0x10df5b[_0xc875('0x10')]+_0x255062++,'VoiceExtensionId':_0x1a701c[_0xc875('0x17')]});}}if(_0x1a701c[_0xc875('0xf')]('answer')){if(_0x4413be[_0xc875('0x36')](_0x1a701c[_0xc875('0x37')][_0xc875('0x2b')]())>=0x0&&_0x1a701c['appType']!==_0xc875('0x38')){if(_0x1a701c[_0xc875('0x39')]){_0x4ad323[_0xc875('0x13')]({'type':_0x1a701c['type'],'app':_0xc875('0x34'),'appdata':_0xc875('0x3a'),'context':_0x1a701c[_0xc875('0x1a')],'exten':_0x1a701c['exten'],'priority':_0x407db0['length']+_0x10df5b[_0xc875('0x10')]+_0x255062++,'VoiceExtensionId':_0x1a701c[_0xc875('0x17')]});_0x4ad323[_0xc875('0x13')]({'type':_0x1a701c[_0xc875('0x14')],'app':_0xc875('0x15'),'appdata':_0xc875('0x3b'),'context':_0x1a701c[_0xc875('0x1a')],'exten':_0x1a701c['exten'],'priority':_0x407db0['length']+_0x10df5b[_0xc875('0x10')]+_0x255062++,'VoiceExtensionId':_0x1a701c[_0xc875('0x17')]});}else{_0x4ad323[_0xc875('0x13')]({'type':_0x1a701c[_0xc875('0x14')],'app':_0xc875('0x34'),'appdata':_0xc875('0x3c'),'context':_0x1a701c[_0xc875('0x1a')],'exten':_0x1a701c[_0xc875('0xb')],'priority':_0x407db0[_0xc875('0x32')]+_0x10df5b[_0xc875('0x10')]+_0x255062++,'VoiceExtensionId':_0x1a701c[_0xc875('0x17')]});_0x4ad323[_0xc875('0x13')]({'type':_0x1a701c[_0xc875('0x14')],'app':'Set','appdata':_0xc875('0x3d'),'context':_0x1a701c[_0xc875('0x1a')],'exten':_0x1a701c[_0xc875('0xb')],'priority':_0x407db0[_0xc875('0x32')]+_0x10df5b[_0xc875('0x10')]+_0x255062++,'VoiceExtensionId':_0x1a701c[_0xc875('0x17')]});}}}for(var _0xb798e=0x0;_0xb798e<_0x407db0['length'];_0xb798e+=0x1){var _0x454537=_0x10df5b[_0xc875('0x10')]+_0x407db0['length'];var _0x3892ba=_0xb798e===_0x407db0[_0xc875('0x32')]-0x1?_0x10df5b['priority']+_0x4ad323[_0xc875('0x32')]+_0x1f09a3[_0xc875('0x32')]+0x2:_0x10df5b['priority']+_0xb798e+0x1;_0x4ad323['splice'](_0xb798e,0x0,{'type':_0x1a701c[_0xc875('0x14')],'app':_0xc875('0x3e'),'appdata':_0x407db0[_0xb798e]+'?'+_0x1a701c[_0xc875('0x1a')]+_0xc875('0x3f')+_0x454537+':'+_0x1a701c[_0xc875('0x1a')]+',${EXTEN},'+_0x3892ba,'exten':_0x1a701c[_0xc875('0xb')],'context':_0x1a701c[_0xc875('0x1a')],'priority':_0x10df5b[_0xc875('0x10')]+_0xb798e,'VoiceExtensionId':_0x314230[_0x33d55e][0x0]['VoiceExtensionId']});}_0x1a701c[_0xc875('0x10')]=_0x4ad323[_0xc875('0x32')]?_[_0xc875('0x40')](_0x4ad323)[_0xc875('0x10')]+0x1:_0x10df5b[_0xc875('0x10')];_0x10df5b[_0xc875('0x10')]=(_0x1f09a3[_0xc875('0x32')]?_[_0xc875('0x40')](_0x1f09a3)[_0xc875('0x10')]:_0x1a701c[_0xc875('0x10')])+0x1;_0x10df5b[_0xc875('0x11')]=_[_0xc875('0x41')](_0x10df5b['extensions'],_0x4ad323,[_0x1a701c],_0x1f09a3);}_0x10df5b[_0xc875('0x11')][_0xc875('0x13')]({'type':_0x314230[_0x33d55e][0x0][_0xc875('0x14')],'app':_0xc875('0x42'),'exten':_0x314230[_0x33d55e][0x0][_0xc875('0xb')],'context':_0x314230[_0x33d55e][0x0][_0xc875('0x1a')],'priority':_0x10df5b[_0xc875('0x10')],'VoiceExtensionId':_0x314230[_0x33d55e][0x0][_0xc875('0x17')]});_0x15010[_0xc875('0x13')](_0x314230[_0x33d55e][0x0][_0xc875('0x17')]);_0x41828f=_['concat'](_0x41828f,_0x10df5b[_0xc875('0x11')]);}}return _0x52ef53[_0xc875('0x43')](function(_0x55287e){return _0x52ef53[_0xc875('0x2')][_0xc875('0x6')][_0xc875('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x15010}},'transaction':_0x55287e})[_0xc875('0x8')](function(_0x4c40b4){return _0x52ef53[_0xc875('0x2')][_0xc875('0x6')][_0xc875('0x45')](_[_0xc875('0x46')](_0x41828f,_0xc875('0x10')),{'transaction':_0x55287e});});});})[_0xc875('0x47')](function(_0x2f38ee){console[_0xc875('0x48')](_0x2f38ee);});}exports[_0xc875('0x49')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 757863a..cccb355 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 _0x4965=['map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','duplicate','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','insert','id\x20IN\x20?','str','calleridnum','cm_hopper_final','\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','get','always','sequelize','query','VoiceQueueId','all','BlackLists','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','papaparse','ioredis','../../../config/environment','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','contact','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length'];(function(_0x562a5e,_0x5d0e43){var _0x18fa46=function(_0x27a1fa){while(--_0x27a1fa){_0x562a5e['push'](_0x562a5e['shift']());}};_0x18fa46(++_0x5d0e43);}(_0x4965,0x122));var _0x5496=function(_0x29d932,_0x97f2a7){_0x29d932=_0x29d932-0x0;var _0x5cd611=_0x4965[_0x29d932];return _0x5cd611;};'use strict';var BPromise=require(_0x5496('0x0'));var util=require(_0x5496('0x1'));var _=require(_0x5496('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x5496('0x3'));var Redis=require(_0x5496('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x5496('0x5'));var logger=require('../../../config/logger')(_0x5496('0x6'));config['redis']=_['defaults'](config[_0x5496('0x7')],{'host':_0x5496('0x8'),'port':0x18eb});var socket=require(_0x5496('0x9'))(new Redis(config['redis']));require(_0x5496('0xa'))['register'](socket);try{if(!process['argv'][0x2]||process[_0x5496('0xb')][0x2]==='undefined'||process[_0x5496('0xb')][0x2]===_0x5496('0xc')){throw new Error(_0x5496('0xd'));}var FILEPATH=process[_0x5496('0xb')][0x2];if(!process[_0x5496('0xb')][0x3]||process[_0x5496('0xb')][0x3]===_0x5496('0xe')||process[_0x5496('0xb')][0x3]==='null'||!process['argv'][0x4]||process[_0x5496('0xb')][0x4]===_0x5496('0xe')||process[_0x5496('0xb')][0x4]===_0x5496('0xc')){throw new Error(_0x5496('0xf'));}var FIELDS=_[_0x5496('0x10')](process[_0x5496('0xb')][0x3][_0x5496('0x11')](','),process['argv'][0x4]['split'](','));if(!process['argv'][0x5]||process['argv'][0x5]==='undefined'||process['argv'][0x5]===_0x5496('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x5496('0xb')][0x5];var COMPANYID=process[_0x5496('0xb')][0x6]&&process[_0x5496('0xb')][0x6]!==_0x5496('0xe')&&process[_0x5496('0xb')][0x6]!==_0x5496('0xc')?process[_0x5496('0xb')][0x6]:null;var DUPLICATES=process[_0x5496('0xb')][0x7]&&process[_0x5496('0xb')][0x7]!==_0x5496('0xe')&&process[_0x5496('0xb')][0x7]!==_0x5496('0xc')?process['argv'][0x7]:null;if(!process['argv'][0x8]||process[_0x5496('0xb')][0x8]===_0x5496('0xe')||process[_0x5496('0xb')][0x8]===_0x5496('0xc')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x5496('0xb')][0x8];}catch(_0x465d82){logger['error'](_0x465d82);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(_0x13114e,_0xcaac36,_0x309c1d,_0x56ab4e){var _0x256825={'message':_0xcaac36};_0x256825[_0x13114e]=!![];if(_0x309c1d){_0x256825[_0x5496('0x12')]=_0x309c1d;}if(_0x56ab4e){_0x256825['index']=_0x56ab4e;}return _0x256825;}function isEmail(_0x307d6b){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))*$/[_0x5496('0x13')](_0x307d6b);}function checkRow(_0x589ff8,_0x309438,_0x3b4193){return new BPromise(function(_0x3489a0,_0x58c3f7){if(_[_0x5496('0x14')](_0x589ff8)){return _0x58c3f7(handleCheckRowError(_0x5496('0x15'),_0x5496('0x16'),null,_0x3b4193));}if(_0x589ff8[_0x5496('0x17')]&&_0x589ff8[_0x5496('0x17')][_0x5496('0x18')]){var _0x248ce7=_[_0x5496('0x19')](_0x589ff8[_0x5496('0x17')],_0x5496('0x1a'))['join'](';');return _0x58c3f7(handleCheckRowError(_0x5496('0x15'),_0x248ce7,null,_0x3b4193));}var _0x238f61={};for(var _0x457384 in FIELDS){if(FIELDS[_0x5496('0x1b')](_0x457384)&&FIELDS[_0x457384]){_0x238f61[_0x457384]=_0x589ff8[_0x5496('0x1c')][0x0][FIELDS[_0x457384]]||_0x589ff8[_0x5496('0x1c')][0x0]['\ufeff'+FIELDS[_0x457384]];}}if(!_0x238f61[_0x5496('0x1d')]){return _0x58c3f7(handleCheckRowError(_0x5496('0x15'),_0x5496('0x1e'),null,_0x3b4193));}if(!_0x238f61[_0x5496('0x1f')]){return _0x58c3f7(handleCheckRowError('error',_0x5496('0x20'),null,_0x3b4193));}if(_0x238f61[_0x5496('0x21')]){var _0x565908=moment(_0x238f61['birthDate'],_0x5496('0x22'));if(!_0x565908['isValid']()){return _0x58c3f7(handleCheckRowError('error',_0x5496('0x23'),null,_0x3b4193));}}if(_0x238f61[_0x5496('0x24')]){if(!isEmail(_0x238f61[_0x5496('0x24')])){return _0x58c3f7(handleCheckRowError(_0x5496('0x15'),'email\x20format\x20is\x20not\x20valid!',null,_0x3b4193));}}_0x238f61[_0x5496('0x25')]=LISTID;_0x238f61[_0x5496('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x5496('0x18')]&&_0x309438){var _0x39aa00={};for(var _0x393937=0x0,_0x16b742=DUPLICATES['length'];_0x393937<_0x16b742;_0x393937+=0x1){_0x39aa00[DUPLICATES[_0x393937]]=_0x238f61[DUPLICATES[_0x393937]];}var _0x1fc7fe=_['find'](_0x309438,_0x39aa00);if(_0x1fc7fe){return _0x58c3f7(handleCheckRowError(_0x5496('0x27'),'Duplicate\x20Contact',_0x1fc7fe,_0x3b4193));}}return db[_0x5496('0x28')][_0x5496('0x29')](_0x238f61,{'raw':!![],'hooks':![],'fields':_[_0x5496('0x2a')](_0x238f61)})[_0x5496('0x2b')](function(_0x4bd53d){if(DUPLICATES&&DUPLICATES['length']&&_0x309438){_0x309438[_0x5496('0x2c')](_[_0x5496('0x2d')](_0x238f61,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4bd53d['id'];return _0x3489a0();})[_0x5496('0x2e')](function(_0x26c241){return _0x58c3f7(handleCheckRowError(_0x5496('0x15'),_0x5496('0x2f')+(_0x26c241[_0x5496('0x1a')]||JSON[_0x5496('0x30')](_0x26c241)),null,_0x3b4193));});});}function checkHopper(){function _0x25bd0f(){return function(_0x1845de){logger['error']('cmContact','checkHopper',util[_0x5496('0x31')](_0x1845de,{'showHidden':![],'depth':null}));};}var _0x7e3ae3=function(_0x2a3940,_0x11d33b){var _0x2c550b=squel['insert']()[_0x5496('0x32')](_0x5496('0x33'))[_0x5496('0x34')]([_0x5496('0x1f'),_0x5496('0x35'),_0x5496('0x36'),_0x5496('0x25'),_0x11d33b,_0x5496('0x37'),_0x5496('0x38')],squel[_0x5496('0x39')]()[_0x5496('0x3a')](_0x5496('0x1f'),'phone')[_0x5496('0x3a')](_0x5496('0x3b'),_0x5496('0x35'))[_0x5496('0x3a')]('id','ContactId')[_0x5496('0x3a')](LISTID['toString'](),_0x5496('0x25'))[_0x5496('0x3a')](_0x2a3940['id'][_0x5496('0x3c')](),_0x11d33b)[_0x5496('0x3a')](_0x5496('0x3b'),_0x5496('0x37'))[_0x5496('0x3a')]('NOW()',_0x5496('0x38'))[_0x5496('0x3d')](_0x5496('0x3e'))['where'](_0x5496('0x3f'))[_0x5496('0x40')](_0x5496('0x41'),LISTID['toString']())[_0x5496('0x40')](_0x5496('0x42'))[_0x5496('0x40')](_0x5496('0x43'),squel[_0x5496('0x39')]()[_0x5496('0x3a')](_0x5496('0x1f'))[_0x5496('0x3d')]('cm_hopper')['where'](_0x11d33b+'\x20=\x20?',_0x2a3940['id']['toString']())))[_0x5496('0x3c')]();return _0x2c550b;};var _0xac46d3=function(_0x52c517,_0x3c6d21){var _0x5c8e3b=squel[_0x5496('0x44')]()[_0x5496('0x32')](_0x5496('0x33'))['fromQuery'](['phone',_0x5496('0x35'),'ContactId',_0x5496('0x25'),_0x3c6d21,_0x5496('0x37'),_0x5496('0x38')],squel[_0x5496('0x39')]()[_0x5496('0x3a')]('phone',_0x5496('0x1f'))[_0x5496('0x3a')](_0x5496('0x3b'),_0x5496('0x35'))[_0x5496('0x3a')]('id',_0x5496('0x36'))[_0x5496('0x3a')](LISTID[_0x5496('0x3c')](),'ListId')['field'](_0x52c517['id'][_0x5496('0x3c')](),_0x3c6d21)[_0x5496('0x3a')](_0x5496('0x3b'),_0x5496('0x37'))[_0x5496('0x3a')](_0x5496('0x3b'),_0x5496('0x38'))['from'](_0x5496('0x3e'))[_0x5496('0x40')](_0x5496('0x3f'))['where'](_0x5496('0x41'),LISTID[_0x5496('0x3c')]())[_0x5496('0x40')](_0x5496('0x45'),squel[_0x5496('0x46')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL')[_0x5496('0x40')](_0x5496('0x43'),squel[_0x5496('0x39')]()[_0x5496('0x3a')](_0x5496('0x47'))[_0x5496('0x3d')](_0x5496('0x48'))[_0x5496('0x40')](_0x3c6d21+_0x5496('0x49'),_0x52c517['id']['toString']()))[_0x5496('0x40')](_0x5496('0x43'),squel[_0x5496('0x39')]()[_0x5496('0x3a')](_0x5496('0x1f'))[_0x5496('0x3d')](_0x5496('0x33'))[_0x5496('0x40')](_0x3c6d21+_0x5496('0x49'),_0x52c517['id'][_0x5496('0x3c')]())))[_0x5496('0x3c')]();return _0x5c8e3b;};function _0x4a4996(_0x5a508d,_0x78f658){var _0xea6bfd=squel[_0x5496('0x44')]()[_0x5496('0x32')](_0x5496('0x33'))['fromQuery']([_0x5496('0x1f'),_0x5496('0x35'),_0x5496('0x36'),_0x5496('0x25'),_0x78f658,_0x5496('0x37'),_0x5496('0x38')],squel[_0x5496('0x39')]()[_0x5496('0x3a')](_0x5496('0x1f'),'phone')['field'](_0x5496('0x3b'),'scheduledAt')['field']('id','ContactId')['field'](LISTID[_0x5496('0x3c')](),_0x5496('0x25'))[_0x5496('0x3a')](_0x5a508d['id'][_0x5496('0x3c')](),_0x78f658)['field'](_0x5496('0x3b'),_0x5496('0x37'))[_0x5496('0x3a')](_0x5496('0x3b'),_0x5496('0x38'))['from'](_0x5496('0x3e'))[_0x5496('0x40')](_0x5496('0x3f'))[_0x5496('0x40')](_0x5496('0x41'),LISTID[_0x5496('0x3c')]())[_0x5496('0x40')](_0x5496('0x45'),squel[_0x5496('0x46')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x5496('0x3c')]();return _0xea6bfd;}function _0x37991b(_0x1af0ef,_0x445b23){var _0x7df949=squel[_0x5496('0x44')]()[_0x5496('0x32')](_0x5496('0x4a'))['fromQuery']([_0x5496('0x1f'),_0x5496('0x36'),_0x5496('0x25'),_0x445b23,_0x5496('0x37'),_0x5496('0x38')],squel[_0x5496('0x39')]()[_0x5496('0x3a')](_0x5496('0x1f'),_0x5496('0x1f'))[_0x5496('0x3a')]('id','ContactId')[_0x5496('0x3a')](LISTID[_0x5496('0x3c')](),_0x5496('0x25'))[_0x5496('0x3a')](_0x1af0ef['id'][_0x5496('0x3c')](),_0x445b23)[_0x5496('0x3a')](_0x5496('0x3b'),'createdAt')[_0x5496('0x3a')](_0x5496('0x3b'),_0x5496('0x38'))[_0x5496('0x3d')](_0x5496('0x3e'))[_0x5496('0x40')](_0x5496('0x3f'))[_0x5496('0x40')](_0x5496('0x41'),LISTID[_0x5496('0x3c')]())[_0x5496('0x40')]('id\x20IN\x20?',squel[_0x5496('0x46')](hopperContacts))['where'](_0x5496('0x42')))[_0x5496('0x3c')]();return _0x7df949;}return db[_0x5496('0x4b')][_0x5496('0x4c')]({'where':{'type':_0x5496('0x4d')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x5496('0x4e')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x456cd0){var _0x38cbde=[];if(_0x456cd0){var _0xc2f665;for(var _0x391434=0x0,_0x508ae1;_0x391434<_0x456cd0['length'];_0x391434+=0x1){_0x508ae1=_0x456cd0[_0x391434][_0x5496('0x4f')]({'plain':!![]});switch(_0x508ae1['dialCheckDuplicateType']){case _0x5496('0x50'):_0x38cbde[_0x5496('0x2c')](db[_0x5496('0x51')]['query'](_0xac46d3(_0x508ae1,'VoiceQueueId'))[_0x5496('0x2b')](function(){})[_0x5496('0x2e')](_0x25bd0f()));break;case'onlyIfOpen':_0x38cbde['push'](db[_0x5496('0x51')][_0x5496('0x52')](_0x7e3ae3(_0x508ae1,_0x5496('0x53')))['then'](function(){})['catch'](_0x25bd0f()));break;default:_0x38cbde[_0x5496('0x2c')](db[_0x5496('0x51')][_0x5496('0x52')](_0x4a4996(_0x508ae1,_0x5496('0x53')))[_0x5496('0x2b')](function(){})[_0x5496('0x2e')](_0x25bd0f()));}}}return _0x38cbde;})[_0x5496('0x54')]()[_0x5496('0x2b')](function(){return db[_0x5496('0x4b')][_0x5496('0x4c')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x5496('0x4e')],'as':_0x5496('0x55'),'where':{'id':LISTID}}]})[_0x5496('0x2b')](function(_0x3e812a){var _0xc21a2f=[];if(_0x3e812a){var _0x3de6b5;for(var _0x39e3c6=0x0,_0x1d71ce;_0x39e3c6<_0x3e812a[_0x5496('0x18')];_0x39e3c6+=0x1){_0x1d71ce=_0x3e812a[_0x39e3c6][_0x5496('0x4f')]({'plain':!![]});_0xc21a2f['push'](db[_0x5496('0x51')][_0x5496('0x52')](_0x37991b(_0x1d71ce,'VoiceQueueId'))[_0x5496('0x2b')](function(){})[_0x5496('0x2e')](_0x25bd0f()));}}return _0xc21a2f;})[_0x5496('0x54')]();})[_0x5496('0x2b')](function(){return db['Campaign'][_0x5496('0x4c')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x5496('0x4e')],'as':'Lists','where':{'id':LISTID}}]})[_0x5496('0x2b')](function(_0x2e2d6a){var _0x35df0a=[];if(_0x2e2d6a){for(var _0x135c0c=0x0,_0x282184;_0x135c0c<_0x2e2d6a[_0x5496('0x18')];_0x135c0c+=0x1){_0x282184=_0x2e2d6a[_0x135c0c]['get']({'plain':!![]});switch(_0x282184['dialCheckDuplicateType']){case _0x5496('0x50'):_0x35df0a[_0x5496('0x2c')](db[_0x5496('0x51')][_0x5496('0x52')](_0xac46d3(_0x282184,_0x5496('0x56')))[_0x5496('0x2b')](function(){})[_0x5496('0x2e')](_0x25bd0f()));break;case _0x5496('0x57'):_0x35df0a[_0x5496('0x2c')](db[_0x5496('0x51')][_0x5496('0x52')](_0x7e3ae3(_0x282184,_0x5496('0x56')))['then'](function(){})['catch'](_0x25bd0f()));break;default:_0x35df0a['push'](db['sequelize'][_0x5496('0x52')](_0x4a4996(_0x282184,_0x5496('0x56')))[_0x5496('0x2b')](function(){})[_0x5496('0x2e')](_0x25bd0f()));}}}return _0x35df0a;})[_0x5496('0x54')]();})[_0x5496('0x2b')](function(){return db['Campaign'][_0x5496('0x4c')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x5496('0x55'),'where':{'id':LISTID}}]})['then'](function(_0x2a5c65){var _0x180ff1=[];if(_0x2a5c65){for(var _0x495511=0x0,_0x1a0110;_0x495511<_0x2a5c65[_0x5496('0x18')];_0x495511+=0x1){_0x1a0110=_0x2a5c65[_0x495511]['get']({'plain':!![]});_0x180ff1[_0x5496('0x2c')](db['sequelize'][_0x5496('0x52')](_0x37991b(_0x1a0110,_0x5496('0x56')))[_0x5496('0x2b')](function(){})[_0x5496('0x2e')](_0x25bd0f()));}}return _0x180ff1;})[_0x5496('0x54')]();})[_0x5496('0x2e')](function(_0x1e6542){logger[_0x5496('0x15')](_0x5496('0x58'),'generalCheckHopper',_0x1e6542['message']);});}var processPromises=function(_0x24071a){return BPromise[_0x5496('0x54')](promises)[_0x5496('0x2b')](function(_0x69ae88){})[_0x5496('0x2e')](function(_0x25ffd7){logger[_0x5496('0x15')](_0x5496('0x59'),JSON[_0x5496('0x30')](_0x25ffd7));})[_0x5496('0x5a')](function(){socket[_0x5496('0x5b')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x24071a){return _0x24071a['resume']();}});};var endCsv=function(){return BPromise[_0x5496('0x5c')]()[_0x5496('0x2b')](function(){if(hopperContacts){return checkHopper();}})[_0x5496('0x2b')](function(){socket[_0x5496('0x5b')](_0x5496('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x5496('0x5e')](FILEPATH);}catch(_0x5ac172){logger[_0x5496('0x15')](_0x5496('0x5f'),JSON['stringify'](_0x5ac172));}finally{process[_0x5496('0x60')](0x0);}});};process['on'](_0x5496('0x61'),function(){logger[_0x5496('0x62')](_0x5496('0x63'));endCsv();});function main(){return BPromise[_0x5496('0x5c')]()[_0x5496('0x2b')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x5496('0x28')][_0x5496('0x4c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x5496('0x2b')](function(_0x5355b3){var _0xb80477=fs[_0x5496('0x64')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x5496('0x65')](_0xb80477,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2d7ab8,_0x137e01){total+=0x1;var _0x57a8df=total;promises[_0x5496('0x2c')](checkRow(_0x2d7ab8,_0x5355b3,_0x57a8df)[_0x5496('0x2b')](function(){success+=0x1;})[_0x5496('0x2e')](function(_0x5cae46){if(_0x5cae46[_0x5496('0x15')]){errors+=0x1;delete _0x5cae46[_0x5496('0x15')];}else if(_0x5cae46['duplicate']){duplicates+=0x1;delete _0x5cae46[_0x5496('0x27')];}rows[_0x5496('0x2c')](_0x5cae46);}));if(total%0xc8===0x0){_0x137e01[_0x5496('0x66')]();return processPromises(_0x137e01);}},'complete':function(){return processPromises()['then'](function(){logger[_0x5496('0x62')](_0x5496('0x67'));endCsv();});},'error':function(_0x4dc8e7,_0x564fd1){logger[_0x5496('0x62')]('CSV\x20parse\x20error',JSON[_0x5496('0x30')](_0x4dc8e7));endCsv();}});})[_0x5496('0x2e')](function(_0x1a07dd){logger[_0x5496('0x15')](_0x5496('0x68'),JSON['stringify'](_0x1a07dd));});}main(); \ No newline at end of file +var _0x21a6=['null','Missing\x20binding\x20parameters!','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','map','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','inspect','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','field','toString','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','select','\x20=\x20?','into','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','insert','cm_hopper_black','findAll','dialCheckDuplicateType','CmList','get','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','VoiceQueue','outbound','Lists','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','emit','resume','resolve','contact:csv_','unlinkSync','exit','CSV\x20import\x20process\x20stopped!','parse','pause','info','CSV\x20parse\x20error','util','lodash','squel','ioredis','../../../mysqldb','../../../config/environment','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x21a6,0x13c));var _0x621a=function(_0xe896bf,_0x4f8e5e){_0xe896bf=_0xe896bf-0x0;var _0x4c7a8a=_0x21a6[_0xe896bf];return _0x4c7a8a;};'use strict';var BPromise=require('bluebird');var util=require(_0x621a('0x0'));var _=require(_0x621a('0x1'));var fs=require('fs');var squel=require(_0x621a('0x2'));var Papa=require('papaparse');var Redis=require(_0x621a('0x3'));var db=require(_0x621a('0x4'))['db'];var config=require(_0x621a('0x5'));var logger=require('../../../config/logger')(_0x621a('0x6'));config[_0x621a('0x7')]=_['defaults'](config[_0x621a('0x7')],{'host':_0x621a('0x8'),'port':0x18eb});var socket=require(_0x621a('0x9'))(new Redis(config['redis']));require(_0x621a('0xa'))[_0x621a('0xb')](socket);try{if(!process[_0x621a('0xc')][0x2]||process[_0x621a('0xc')][0x2]==='undefined'||process[_0x621a('0xc')][0x2]==='null'){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x621a('0xc')][0x2];if(!process[_0x621a('0xc')][0x3]||process[_0x621a('0xc')][0x3]==='undefined'||process[_0x621a('0xc')][0x3]==='null'||!process[_0x621a('0xc')][0x4]||process[_0x621a('0xc')][0x4]===_0x621a('0xd')||process[_0x621a('0xc')][0x4]===_0x621a('0xe')){throw new Error(_0x621a('0xf'));}var FIELDS=_[_0x621a('0x10')](process[_0x621a('0xc')][0x3]['split'](','),process[_0x621a('0xc')][0x4][_0x621a('0x11')](','));if(!process[_0x621a('0xc')][0x5]||process[_0x621a('0xc')][0x5]===_0x621a('0xd')||process['argv'][0x5]===_0x621a('0xe')){throw new Error(_0x621a('0x12'));}var LISTID=process[_0x621a('0xc')][0x5];var COMPANYID=process[_0x621a('0xc')][0x6]&&process[_0x621a('0xc')][0x6]!==_0x621a('0xd')&&process[_0x621a('0xc')][0x6]!==_0x621a('0xe')?process[_0x621a('0xc')][0x6]:null;var DUPLICATES=process[_0x621a('0xc')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x621a('0xc')][0x7]!==_0x621a('0xe')?process['argv'][0x7]:null;if(!process[_0x621a('0xc')][0x8]||process[_0x621a('0xc')][0x8]===_0x621a('0xd')||process['argv'][0x8]===_0x621a('0xe')){throw new Error(_0x621a('0x13'));}var SOCKET_TIMESTAMP=process[_0x621a('0xc')][0x8];}catch(_0x4a5d22){logger[_0x621a('0x14')](_0x4a5d22);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(_0x2842fe,_0x35512f,_0xcd6708,_0x303f2d){var _0x19d6bc={'message':_0x35512f};_0x19d6bc[_0x2842fe]=!![];if(_0xcd6708){_0x19d6bc[_0x621a('0x15')]=_0xcd6708;}if(_0x303f2d){_0x19d6bc['index']=_0x303f2d;}return _0x19d6bc;}function isEmail(_0x147a64){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))*$/[_0x621a('0x16')](_0x147a64);}function checkRow(_0x5400d5,_0x574fe2,_0x1f0514){return new BPromise(function(_0x309d21,_0x2a7868){if(_[_0x621a('0x17')](_0x5400d5)){return _0x2a7868(handleCheckRowError(_0x621a('0x14'),_0x621a('0x18'),null,_0x1f0514));}if(_0x5400d5['errors']&&_0x5400d5[_0x621a('0x19')][_0x621a('0x1a')]){var _0x495c2c=_[_0x621a('0x1b')](_0x5400d5['errors'],'message')[_0x621a('0x1c')](';');return _0x2a7868(handleCheckRowError(_0x621a('0x14'),_0x495c2c,null,_0x1f0514));}var _0x44bed2={};for(var _0xb10232 in FIELDS){if(FIELDS[_0x621a('0x1d')](_0xb10232)&&FIELDS[_0xb10232]){_0x44bed2[_0xb10232]=_0x5400d5[_0x621a('0x1e')][0x0][FIELDS[_0xb10232]]||_0x5400d5['data'][0x0]['\ufeff'+FIELDS[_0xb10232]];}}if(!_0x44bed2[_0x621a('0x1f')]){return _0x2a7868(handleCheckRowError('error',_0x621a('0x20'),null,_0x1f0514));}if(!_0x44bed2[_0x621a('0x21')]){return _0x2a7868(handleCheckRowError('error',_0x621a('0x22'),null,_0x1f0514));}if(_0x44bed2[_0x621a('0x23')]){var _0x373e6a=moment(_0x44bed2['birthDate'],'YYYY-MM-DD');if(!_0x373e6a[_0x621a('0x24')]()){return _0x2a7868(handleCheckRowError(_0x621a('0x14'),_0x621a('0x25'),null,_0x1f0514));}}if(_0x44bed2[_0x621a('0x26')]){if(!isEmail(_0x44bed2[_0x621a('0x26')])){return _0x2a7868(handleCheckRowError(_0x621a('0x14'),_0x621a('0x27'),null,_0x1f0514));}}_0x44bed2[_0x621a('0x28')]=LISTID;_0x44bed2['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x574fe2){var _0x19f703={};for(var _0x1ee183=0x0,_0x4d046c=DUPLICATES[_0x621a('0x1a')];_0x1ee183<_0x4d046c;_0x1ee183+=0x1){_0x19f703[DUPLICATES[_0x1ee183]]=_0x44bed2[DUPLICATES[_0x1ee183]];}var _0x3b7909=_[_0x621a('0x29')](_0x574fe2,_0x19f703);if(_0x3b7909){return _0x2a7868(handleCheckRowError(_0x621a('0x2a'),_0x621a('0x2b'),_0x3b7909,_0x1f0514));}}return db[_0x621a('0x2c')][_0x621a('0x2d')](_0x44bed2,{'raw':!![],'hooks':![],'fields':_[_0x621a('0x2e')](_0x44bed2)})[_0x621a('0x2f')](function(_0x4c363b){if(DUPLICATES&&DUPLICATES[_0x621a('0x1a')]&&_0x574fe2){_0x574fe2[_0x621a('0x30')](_[_0x621a('0x31')](_0x44bed2,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4c363b['id'];return _0x309d21();})[_0x621a('0x32')](function(_0x2f66e3){return _0x2a7868(handleCheckRowError('error',_0x621a('0x33')+(_0x2f66e3[_0x621a('0x34')]||JSON[_0x621a('0x35')](_0x2f66e3)),null,_0x1f0514));});});}function checkHopper(){function _0x297584(){return function(_0x10cd58){logger[_0x621a('0x14')](_0x621a('0x36'),_0x621a('0x37'),util[_0x621a('0x38')](_0x10cd58,{'showHidden':![],'depth':null}));};}var _0x2610fc=function(_0x23824c,_0x116e99){var _0x1e8313=squel['insert']()['into'](_0x621a('0x39'))[_0x621a('0x3a')]([_0x621a('0x21'),_0x621a('0x3b'),_0x621a('0x3c'),_0x621a('0x28'),_0x116e99,_0x621a('0x3d'),_0x621a('0x3e')],squel['select']()[_0x621a('0x3f')](_0x621a('0x21'),_0x621a('0x21'))[_0x621a('0x3f')]('NOW()',_0x621a('0x3b'))[_0x621a('0x3f')]('id',_0x621a('0x3c'))[_0x621a('0x3f')](LISTID[_0x621a('0x40')](),_0x621a('0x28'))[_0x621a('0x3f')](_0x23824c['id'][_0x621a('0x40')](),_0x116e99)[_0x621a('0x3f')](_0x621a('0x41'),_0x621a('0x3d'))[_0x621a('0x3f')]('NOW()',_0x621a('0x3e'))[_0x621a('0x42')](_0x621a('0x43'))[_0x621a('0x44')](_0x621a('0x45'))[_0x621a('0x44')](_0x621a('0x46'),LISTID[_0x621a('0x40')]())[_0x621a('0x44')](_0x621a('0x47'))[_0x621a('0x44')]('phone\x20NOT\x20IN\x20(?)',squel[_0x621a('0x48')]()['field'](_0x621a('0x21'))[_0x621a('0x42')](_0x621a('0x39'))[_0x621a('0x44')](_0x116e99+_0x621a('0x49'),_0x23824c['id'][_0x621a('0x40')]())))[_0x621a('0x40')]();return _0x1e8313;};var _0x31811d=function(_0x377041,_0x2f4138){var _0x482c2a=squel['insert']()[_0x621a('0x4a')](_0x621a('0x39'))[_0x621a('0x3a')](['phone','scheduledAt',_0x621a('0x3c'),_0x621a('0x28'),_0x2f4138,_0x621a('0x3d'),'updatedAt'],squel[_0x621a('0x48')]()['field'](_0x621a('0x21'),_0x621a('0x21'))['field']('NOW()',_0x621a('0x3b'))[_0x621a('0x3f')]('id',_0x621a('0x3c'))[_0x621a('0x3f')](LISTID['toString'](),_0x621a('0x28'))[_0x621a('0x3f')](_0x377041['id'][_0x621a('0x40')](),_0x2f4138)['field'](_0x621a('0x41'),'createdAt')[_0x621a('0x3f')]('NOW()',_0x621a('0x3e'))[_0x621a('0x42')]('cm_contacts')[_0x621a('0x44')](_0x621a('0x45'))[_0x621a('0x44')]('ListId\x20=\x20?',LISTID[_0x621a('0x40')]())['where'](_0x621a('0x4b'),squel[_0x621a('0x4c')](hopperContacts))[_0x621a('0x44')]('phone\x20IS\x20NOT\x20NULL')[_0x621a('0x44')](_0x621a('0x4d'),squel['select']()[_0x621a('0x3f')](_0x621a('0x4e'))[_0x621a('0x42')](_0x621a('0x4f'))[_0x621a('0x44')](_0x2f4138+_0x621a('0x49'),_0x377041['id'][_0x621a('0x40')]()))['where'](_0x621a('0x4d'),squel[_0x621a('0x48')]()['field']('phone')[_0x621a('0x42')](_0x621a('0x39'))[_0x621a('0x44')](_0x2f4138+_0x621a('0x49'),_0x377041['id'][_0x621a('0x40')]())))[_0x621a('0x40')]();return _0x482c2a;};function _0x15d4bd(_0x2282b3,_0x5b8eaa){var _0x31d589=squel['insert']()[_0x621a('0x4a')](_0x621a('0x39'))[_0x621a('0x3a')]([_0x621a('0x21'),'scheduledAt',_0x621a('0x3c'),_0x621a('0x28'),_0x5b8eaa,_0x621a('0x3d'),'updatedAt'],squel[_0x621a('0x48')]()[_0x621a('0x3f')](_0x621a('0x21'),'phone')[_0x621a('0x3f')](_0x621a('0x41'),_0x621a('0x3b'))[_0x621a('0x3f')]('id',_0x621a('0x3c'))[_0x621a('0x3f')](LISTID['toString'](),_0x621a('0x28'))[_0x621a('0x3f')](_0x2282b3['id'][_0x621a('0x40')](),_0x5b8eaa)[_0x621a('0x3f')](_0x621a('0x41'),_0x621a('0x3d'))[_0x621a('0x3f')]('NOW()',_0x621a('0x3e'))[_0x621a('0x42')](_0x621a('0x43'))['where'](_0x621a('0x45'))['where'](_0x621a('0x46'),LISTID[_0x621a('0x40')]())[_0x621a('0x44')](_0x621a('0x4b'),squel[_0x621a('0x4c')](hopperContacts))[_0x621a('0x44')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x31d589;}function _0x13ab02(_0x4e1622,_0x2f18be){var _0x28a059=squel[_0x621a('0x50')]()[_0x621a('0x4a')](_0x621a('0x51'))[_0x621a('0x3a')]([_0x621a('0x21'),_0x621a('0x3c'),_0x621a('0x28'),_0x2f18be,_0x621a('0x3d'),_0x621a('0x3e')],squel['select']()[_0x621a('0x3f')](_0x621a('0x21'),_0x621a('0x21'))[_0x621a('0x3f')]('id',_0x621a('0x3c'))[_0x621a('0x3f')](LISTID[_0x621a('0x40')](),_0x621a('0x28'))['field'](_0x4e1622['id'][_0x621a('0x40')](),_0x2f18be)[_0x621a('0x3f')](_0x621a('0x41'),_0x621a('0x3d'))[_0x621a('0x3f')](_0x621a('0x41'),_0x621a('0x3e'))[_0x621a('0x42')](_0x621a('0x43'))[_0x621a('0x44')](_0x621a('0x45'))[_0x621a('0x44')](_0x621a('0x46'),LISTID['toString']())[_0x621a('0x44')](_0x621a('0x4b'),squel[_0x621a('0x4c')](hopperContacts))[_0x621a('0x44')](_0x621a('0x47')))[_0x621a('0x40')]();return _0x28a059;}return db['VoiceQueue'][_0x621a('0x52')]({'where':{'type':'outbound'},'attributes':['id',_0x621a('0x53')],'include':[{'model':db[_0x621a('0x54')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x578a93){var _0x26f32c=[];if(_0x578a93){var _0x2c02c5;for(var _0x1c56cc=0x0,_0x11fe3a;_0x1c56cc<_0x578a93[_0x621a('0x1a')];_0x1c56cc+=0x1){_0x11fe3a=_0x578a93[_0x1c56cc][_0x621a('0x55')]({'plain':!![]});switch(_0x11fe3a[_0x621a('0x53')]){case _0x621a('0x56'):_0x26f32c['push'](db[_0x621a('0x57')][_0x621a('0x58')](_0x31811d(_0x11fe3a,_0x621a('0x59')))['then'](function(){})[_0x621a('0x32')](_0x297584()));break;case _0x621a('0x5a'):_0x26f32c[_0x621a('0x30')](db['sequelize'][_0x621a('0x58')](_0x2610fc(_0x11fe3a,_0x621a('0x59')))[_0x621a('0x2f')](function(){})[_0x621a('0x32')](_0x297584()));break;default:_0x26f32c[_0x621a('0x30')](db[_0x621a('0x57')][_0x621a('0x58')](_0x15d4bd(_0x11fe3a,_0x621a('0x59')))[_0x621a('0x2f')](function(){})['catch'](_0x297584()));}}}return _0x26f32c;})[_0x621a('0x5b')]()[_0x621a('0x2f')](function(){return db[_0x621a('0x5c')][_0x621a('0x52')]({'where':{'type':_0x621a('0x5d')},'attributes':['id'],'include':[{'model':db[_0x621a('0x54')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x621a('0x2f')](function(_0x58446d){var _0x57bda4=[];if(_0x58446d){var _0x115a10;for(var _0x837e6f=0x0,_0x3c74b7;_0x837e6f<_0x58446d['length'];_0x837e6f+=0x1){_0x3c74b7=_0x58446d[_0x837e6f]['get']({'plain':!![]});_0x57bda4[_0x621a('0x30')](db[_0x621a('0x57')][_0x621a('0x58')](_0x13ab02(_0x3c74b7,_0x621a('0x59')))[_0x621a('0x2f')](function(){})[_0x621a('0x32')](_0x297584()));}}return _0x57bda4;})[_0x621a('0x5b')]();})[_0x621a('0x2f')](function(){return db['Campaign'][_0x621a('0x52')]({'attributes':['id',_0x621a('0x53')],'include':[{'model':db[_0x621a('0x54')],'as':_0x621a('0x5e'),'where':{'id':LISTID}}]})['then'](function(_0x1f7146){var _0x1009ab=[];if(_0x1f7146){for(var _0x5559f9=0x0,_0x39e609;_0x5559f9<_0x1f7146[_0x621a('0x1a')];_0x5559f9+=0x1){_0x39e609=_0x1f7146[_0x5559f9][_0x621a('0x55')]({'plain':!![]});switch(_0x39e609[_0x621a('0x53')]){case _0x621a('0x56'):_0x1009ab[_0x621a('0x30')](db['sequelize'][_0x621a('0x58')](_0x31811d(_0x39e609,_0x621a('0x5f')))[_0x621a('0x2f')](function(){})['catch'](_0x297584()));break;case _0x621a('0x5a'):_0x1009ab[_0x621a('0x30')](db[_0x621a('0x57')]['query'](_0x2610fc(_0x39e609,_0x621a('0x5f')))[_0x621a('0x2f')](function(){})[_0x621a('0x32')](_0x297584()));break;default:_0x1009ab[_0x621a('0x30')](db[_0x621a('0x57')][_0x621a('0x58')](_0x15d4bd(_0x39e609,_0x621a('0x5f')))[_0x621a('0x2f')](function(){})[_0x621a('0x32')](_0x297584()));}}}return _0x1009ab;})[_0x621a('0x5b')]();})[_0x621a('0x2f')](function(){return db['Campaign']['findAll']({'attributes':['id'],'include':[{'model':db[_0x621a('0x54')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x621a('0x2f')](function(_0x40d7e3){var _0x5d7f97=[];if(_0x40d7e3){for(var _0x4e31cc=0x0,_0xed4c16;_0x4e31cc<_0x40d7e3[_0x621a('0x1a')];_0x4e31cc+=0x1){_0xed4c16=_0x40d7e3[_0x4e31cc][_0x621a('0x55')]({'plain':!![]});_0x5d7f97['push'](db[_0x621a('0x57')][_0x621a('0x58')](_0x13ab02(_0xed4c16,_0x621a('0x5f')))[_0x621a('0x2f')](function(){})['catch'](_0x297584()));}}return _0x5d7f97;})['all']();})[_0x621a('0x32')](function(_0x21afc3){logger[_0x621a('0x14')](_0x621a('0x60'),_0x621a('0x61'),_0x21afc3[_0x621a('0x34')]);});}var processPromises=function(_0x40f0f4){return BPromise[_0x621a('0x5b')](promises)[_0x621a('0x2f')](function(_0x3255c5){})[_0x621a('0x32')](function(_0x49b441){logger[_0x621a('0x14')]('Error\x20processing\x20rows\x20block:',JSON['stringify'](_0x49b441));})[_0x621a('0x62')](function(){socket[_0x621a('0x63')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x40f0f4){return _0x40f0f4[_0x621a('0x64')]();}});};var endCsv=function(){return BPromise[_0x621a('0x65')]()[_0x621a('0x2f')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x621a('0x63')](_0x621a('0x66')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x621a('0x67')](FILEPATH);}catch(_0x547532){logger[_0x621a('0x14')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x621a('0x35')](_0x547532));}finally{process[_0x621a('0x68')](0x0);}});};process['on']('SIGINT',function(){logger['info'](_0x621a('0x69'));endCsv();});function main(){return BPromise[_0x621a('0x65')]()[_0x621a('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x621a('0x11')](',');return db[_0x621a('0x2c')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x4cc521){var _0x54f0c1=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x621a('0x6a')](_0x54f0c1,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1d69da,_0x19d0f6){total+=0x1;var _0x17dbb2=total;promises[_0x621a('0x30')](checkRow(_0x1d69da,_0x4cc521,_0x17dbb2)[_0x621a('0x2f')](function(){success+=0x1;})[_0x621a('0x32')](function(_0x294901){if(_0x294901[_0x621a('0x14')]){errors+=0x1;delete _0x294901[_0x621a('0x14')];}else if(_0x294901[_0x621a('0x2a')]){duplicates+=0x1;delete _0x294901[_0x621a('0x2a')];}rows[_0x621a('0x30')](_0x294901);}));if(total%0xc8===0x0){_0x19d0f6[_0x621a('0x6b')]();return processPromises(_0x19d0f6);}},'complete':function(){return processPromises()[_0x621a('0x2f')](function(){logger[_0x621a('0x6c')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x537815,_0x4f0252){logger['info'](_0x621a('0x6d'),JSON[_0x621a('0x35')](_0x537815));endCsv();}});})[_0x621a('0x32')](function(_0x14d4e8){logger[_0x621a('0x14')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x621a('0x35')](_0x14d4e8));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index a92a331..d96d4a5 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 _0x725a=['then','affectedRows','contact:import:','unlink','complete','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','into','cm_hopper','fromQuery','scheduledat','ListId','createdAt','updatedAt','UserId','recallme','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','insert','cm_hopper_black','ContactId','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','error','message','exit','errors','code','sequelize','query','spread','push','catch','main','send','start','binding','root','parse','createReadStream','data','length','rows','trim','replace','isValid','priority','isNaN','isNumber','includes','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','firstName','SystemRow','appendFileSync','emit','Abort\x20parser','abort','step','duplicates','CREATE\x20TABLE\x20','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x725a,0x119));var _0xa725=function(_0x38ff2b,_0x3a0316){_0x38ff2b=_0x38ff2b-0x0;var _0x341f5e=_0x725a[_0x38ff2b];return _0x341f5e;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xa725('0x0'));var Papa=require(_0xa725('0x1'));var util=require(_0xa725('0x2'));var BPromise=require(_0xa725('0x3'));var moment=require(_0xa725('0x4'));var squel=require(_0xa725('0x5'));var Redis=require(_0xa725('0x6'));var db=require(_0xa725('0x7'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xa725('0x8'));config[_0xa725('0x9')]=_[_0xa725('0xa')](config[_0xa725('0x9')],{'host':_0xa725('0xb'),'port':0x18eb});var socket=require(_0xa725('0xc'))(new Redis(config[_0xa725('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xa725('0xd')](_0xa725('0xe'));function isEmail(_0x3dad30){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))*$/[_0xa725('0xf')](_0x3dad30);}function selectNotIn(_0x369cde,_0x32abda,_0x262877,_0x63c9f6,_0x4885ad){return squel['select']()[_0xa725('0x10')](_0xa725('0x11'))[_0xa725('0x12')](_0x63c9f6)[_0xa725('0x13')](_0x32abda,null,_0x32abda+_0xa725('0x14')+_0x63c9f6+'.'+_0x262877)['where'](_0x63c9f6+'.'+_0x262877+'\x20=\x20'+_0x369cde+'.'+_0x262877)[_0xa725('0x15')](_0x32abda+_0xa725('0x16')+_0x4885ad[_0xa725('0x13')]()+')');}function insertCmHopper(_0x360549,_0x2fc1de,_0x30ba91,_0x263ce5,_0xf53f8a){var _0x3eacd1=[_0xa725('0x17'),'cm_contacts.scheduledat',_0xa725('0x18'),_0xa725('0x19'),_0x2fc1de+'.'+_0x263ce5,_0xa725('0x1a'),_0xa725('0x1b'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0xf53f8a+'\x22'];return squel['insert']()[_0xa725('0x1c')](_0xa725('0x1d'))[_0xa725('0x1e')]([_0xa725('0x11'),_0xa725('0x1f'),'ContactId',_0xa725('0x20'),_0x263ce5,_0xa725('0x21'),_0xa725('0x22'),'priority',_0xa725('0x23'),_0xa725('0x24')],squel[_0xa725('0x25')]()[_0xa725('0x26')](_0x3eacd1)[_0xa725('0x12')](_0x2fc1de)[_0xa725('0x13')](_0xa725('0x27'),null,_0xa725('0x28')+_0x2fc1de+'.CmListId')['join'](_0x30ba91,null,_0x30ba91+_0xa725('0x14')+_0x2fc1de+'.'+_0x263ce5)['where'](_0x2fc1de+'.CmListId\x20=\x20?',_0x360549)[_0xa725('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xa725('0x15')](_0xa725('0x29'),selectNotIn(_0x2fc1de,_0x30ba91,_0x263ce5,'cm_hopper',[_0xa725('0x2a'),_0xa725('0x2b')]))[_0xa725('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2fc1de,_0x30ba91,_0x263ce5,'cm_hopper',['\x22always\x22'])))[_0xa725('0x2c')]();}function insertCmHopperBlack(_0x411feb,_0x1239d1,_0x5a7174,_0x3fbdd6){var _0x3fda21=[_0xa725('0x17'),_0xa725('0x18'),'cm_contacts.ListId',_0x1239d1+'.'+_0x3fbdd6,_0xa725('0x1a'),_0xa725('0x1b')];return squel[_0xa725('0x2d')]()[_0xa725('0x1c')](_0xa725('0x2e'))[_0xa725('0x1e')](['phone',_0xa725('0x2f'),_0xa725('0x20'),_0x3fbdd6,_0xa725('0x21'),_0xa725('0x22')],squel['select']()[_0xa725('0x26')](_0x3fda21)['from'](_0x1239d1)['join'](_0xa725('0x27'),null,'cm_contacts.ListId\x20=\x20'+_0x1239d1+_0xa725('0x30'))[_0xa725('0x13')](_0x5a7174,null,_0x5a7174+_0xa725('0x14')+_0x1239d1+'.'+_0x3fbdd6)[_0xa725('0x15')](_0x1239d1+_0xa725('0x31'),_0x411feb)['where'](_0xa725('0x32'),NOW)['where'](_0xa725('0x29'),squel['select']()[_0xa725('0x10')]('phone')['from'](_0xa725('0x2e'))[_0xa725('0x15')]('ListId\x20=\x20?',_0x411feb)[_0xa725('0x15')](_0x3fbdd6+_0xa725('0x33'),_0x1239d1+'.'+_0x3fbdd6)))['toString']();}function insertCmContact(_0x1d0c60,_0x3d9992,_0xe2a802,_0x1a766d){var _0x1f51d6=_[_0xa725('0x34')](_[_0xa725('0x35')](_0x1a766d),[_0xa725('0x20'),_0xa725('0x36'),'createdAt','updatedAt']);return squel['insert']()[_0xa725('0x1c')](_0xa725('0x27'))[_0xa725('0x1e')](_0x1f51d6,squel[_0xa725('0x25')]()['fields'](_0x1f51d6)['from'](_0x3d9992)[_0xa725('0x15')]('('+_0xe2a802[_0xa725('0x13')](',')+_0xa725('0x37'),squel[_0xa725('0x25')]()[_0xa725('0x26')](_0xe2a802)['from'](_0xa725('0x27'))[_0xa725('0x15')](_0xa725('0x38'),_0x1d0c60)[_0xa725('0x15')](_0xa725('0x39')))['where'](_0xa725('0x3a'),squel[_0xa725('0x25')]()['field'](_0xa725('0x3b'),_0xa725('0x3c'))['from'](_0x3d9992)[_0xa725('0x3d')](_0xe2a802[_0xa725('0x13')](','))))['toString']();}function handleStop(){logger[_0xa725('0x3e')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x565f57){logger[_0xa725('0x3f')](_0x565f57[_0xa725('0x40')]);process[_0xa725('0x41')](0x1);}function handleError(_0x57c997,_0xf1ada4){stats[_0xa725('0x42')]['push']({'name':_0xf1ada4[_0xa725('0x43')],'message':_0xf1ada4[_0xa725('0x40')],'row':_0x57c997});}function handleQuery(_0x581856){logger[_0xa725('0x3e')](_0x581856);return db[_0xa725('0x44')][_0xa725('0x45')](_0x581856)[_0xa725('0x46')](function(_0xcf4896){results[_0xa725('0x47')](_0xcf4896);})[_0xa725('0x48')](function(_0x449958){logger[_0xa725('0x3f')](_0x449958[_0xa725('0x40')]);});}function main(_0x2b6c6c,_0x114bc8,_0x28bdd1,_0x39b565){logger[_0xa725('0x3e')](_0xa725('0x49'),_0x2b6c6c,JSON['stringify'](_0x114bc8));process[_0xa725('0x4a')](_0xa725('0x4b'));var _0x42956d=_0x114bc8[_0xa725('0x4c')];var _0x3d6a4b=_0x114bc8['socket_timestamp'];var _0x1223e8=path[_0xa725('0x13')](config[_0xa725('0x4d')],'server/files/tmp',_0x3d6a4b+'.csv');var _0x4585a6=_[_0xa725('0x35')](_0x42956d)[_0xa725('0x13')]();logger[_0xa725('0x3e')]('header',_0x4585a6);fs['writeFileSync'](_0x1223e8,_0x4585a6+'\x0a');Papa[_0xa725('0x4e')](fs[_0xa725('0x4f')](_0x2b6c6c),{'header':!![],'skipEmptyLines':!![],'step':function(_0x54467e,_0x3315d1){try{for(var _0x2f54c9=0x0,_0x526bd2=[];_0x2f54c9<_0x54467e[_0xa725('0x50')][_0xa725('0x51')];_0x2f54c9++){stats[_0xa725('0x52')]+=0x1;if(_0x54467e['errors'][_0x2f54c9]){handleError(_0x54467e[_0xa725('0x50')][_0x2f54c9],_0x54467e[_0xa725('0x42')][_0x2f54c9]);}else{var _0x2b6962=[];for(var _0x39fddd in _0x42956d){if(_0x42956d['hasOwnProperty'](_0x39fddd)){if(_0x54467e[_0xa725('0x50')][_0x2f54c9][_0x42956d[_0x39fddd]]){var _0x49ab2a=_[_0xa725('0x53')](_0x54467e[_0xa725('0x50')][_0x2f54c9][_0x42956d[_0x39fddd]][_0xa725('0x54')](/"/g,'\x27'));switch(_0x39fddd){case _0xa725('0x1f'):var _0x546145=moment(_0x49ab2a,_0xa725('0xe'),!![]);if(_0x546145[_0xa725('0x55')]()){_0x526bd2[_0xa725('0x47')]('\x22'+_0x49ab2a+'\x22');}else{_0x2b6962['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xa725('0x56'):var _0xa911f7=parseInt(_0x49ab2a);_0x49ab2a=_[_0xa725('0x57')](_0xa911f7)||_0xa911f7<0x0||_0xa911f7>0x4?_0x39b565?0x3:0x2:_0xa911f7;_0x526bd2['push']('\x22'+_0x49ab2a+'\x22');break;case _0xa725('0x23'):var _0x45e841=parseInt(_0x49ab2a);if(_[_0xa725('0x58')](_0x45e841)&&_[_0xa725('0x59')](_0x28bdd1,_0x45e841)){_0x526bd2[_0xa725('0x47')]('\x22'+_0x45e841+'\x22');}else{_0x2b6962[_0xa725('0x47')](_0xa725('0x5a'));}break;case'email':if(isEmail(_0x49ab2a)){_0x526bd2[_0xa725('0x47')]('\x22'+_0x49ab2a+'\x22');}else{_0x2b6962[_0xa725('0x47')](_0xa725('0x5b'));}break;case _0xa725('0x5c'):var _0x144daf=moment(_0x49ab2a,'YYYY-MM-DD',!![]);if(_0x144daf[_0xa725('0x55')]()){_0x526bd2['push']('\x22'+_0x49ab2a+'\x22');}else{_0x2b6962[_0xa725('0x47')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x526bd2[_0xa725('0x47')]('\x22'+_0x49ab2a+'\x22');}}else{switch(_0x39fddd){case _0xa725('0x5d'):case _0xa725('0x11'):_0x2b6962[_0xa725('0x47')](_0x39fddd+'\x20not\x20specified');break;default:_0x526bd2[_0xa725('0x47')]('\x22\x22');}}}}if(_0x2b6962[_0xa725('0x51')]){handleError(_0x54467e[_0xa725('0x50')][_0x2f54c9],{'code':_0xa725('0x5e'),'message':_0x2b6962[_0xa725('0x13')]()});}else{fs[_0xa725('0x5f')](_0x1223e8,_0x526bd2[_0xa725('0x13')]()+'\x0a');}_0x526bd2=[];}if(!(stats[_0xa725('0x52')]%0xc8)){socket[_0xa725('0x60')]('contact:import:'+_0x3d6a4b,stats);stats[_0xa725('0x42')]=[];}}if(stopped){logger[_0xa725('0x3e')](_0xa725('0x61'));_0x3315d1[_0xa725('0x62')]();}}catch(_0x5710b9){handleError(_0x54467e[_0xa725('0x50')][_0x2f54c9],{'code':'SystemError','message':_0x5710b9['message']});logger[_0xa725('0x3f')](_0xa725('0x63'),_0x5710b9[_0xa725('0x40')]);}},'complete':function(){try{var _0x4c11e0=[];var _0x1732fb=_0xa725('0x27');if(_0x114bc8[_0xa725('0x64')]&&_0x114bc8[_0xa725('0x64')]['length']){_0x1732fb='cm_contacts_'+_0x3d6a4b;_0x4c11e0[_0xa725('0x47')](_0xa725('0x65')+_0x1732fb+'\x20LIKE\x20cm_contacts;');}var _0x41914f=util['format'](_0xa725('0x66'),_0x1223e8,_0x1732fb,_0x4585a6,_0x114bc8[_0xa725('0x20')],_0x114bc8['CompanyId']||null,NOW,NOW);if(_[_0xa725('0x67')](_0x42956d[_0xa725('0x1f')])){_0x41914f+=_0xa725('0x68');}_0x4c11e0[_0xa725('0x47')](_0x41914f);if(_0x114bc8['duplicates']&&_0x114bc8['duplicates'][_0xa725('0x51')]){_0x4c11e0[_0xa725('0x47')](insertCmContact(_0x114bc8[_0xa725('0x20')],_0x1732fb,_0x114bc8[_0xa725('0x64')],_0x42956d));_0x4c11e0[_0xa725('0x47')](_0xa725('0x69')+_0x1732fb+';');}_0x4c11e0[_0xa725('0x47')](insertCmHopper(_0x114bc8[_0xa725('0x20')],_0xa725('0x6a'),_0xa725('0x6b'),_0xa725('0x6c'),_0x39b565));_0x4c11e0['push'](insertCmHopperBlack(_0x114bc8[_0xa725('0x20')],_0xa725('0x6d'),'voice_queues','VoiceQueueId'));_0x4c11e0[_0xa725('0x47')](insertCmHopper(_0x114bc8[_0xa725('0x20')],_0xa725('0x6e'),_0xa725('0x6f'),_0xa725('0x70'),_0x39b565));_0x4c11e0[_0xa725('0x47')](insertCmHopperBlack(_0x114bc8[_0xa725('0x20')],_0xa725('0x71'),_0xa725('0x6f'),_0xa725('0x70')));BPromise[_0xa725('0x72')](_0x4c11e0,handleQuery)[_0xa725('0x73')](function(_0x8881f3){stats['finish']=!![];stats[_0xa725('0x74')]=_0x114bc8['duplicates']&&_0x114bc8['duplicates'][_0xa725('0x51')]?results[0x2]['affectedRows']:results[0x0][_0xa725('0x74')];socket[_0xa725('0x60')](_0xa725('0x75')+_0x3d6a4b,stats);fs[_0xa725('0x76')](_0x2b6c6c);fs['unlink'](_0x1223e8);process[_0xa725('0x41')](0x0);})[_0xa725('0x48')](function(_0x329698){logger[_0xa725('0x3f')](_0x329698[_0xa725('0x40')]);process[_0xa725('0x41')](0x1);});}catch(_0x3881e9){logger[_0xa725('0x3f')](_0xa725('0x77'),_0x3881e9['message']);process[_0xa725('0x41')](0x1);}},'error':function(_0x122ddd,_0x586466,_0x328f78,_0x24b8d2){throw new Error(_0x24b8d2);}});}function validate(){if(process['argv']&&process[_0xa725('0x78')][_0xa725('0x51')]<0x4){throw new Error(_0xa725('0x79'));}var _0x288b81=path[_0xa725('0x13')](config['root'],_0xa725('0x7a'),process[_0xa725('0x78')][0x2]);if(!fs[_0xa725('0x7b')](_0x288b81)){throw new Error(_0xa725('0x7c'));}var _0x4eae56={};try{_0x4eae56=JSON['parse'](process['argv'][0x3]);if(!_0x4eae56[_0xa725('0x4c')]){throw new Error(_0xa725('0x7d'));}if(!_0x4eae56[_0xa725('0x4c')][_0xa725('0x11')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x4eae56[_0xa725('0x4c')][_0xa725('0x5d')]){throw new Error('firstName\x20is\x20mandatory');}var _0x5d10a7=0x0;if(_0x4eae56[_0xa725('0x4c')][_0xa725('0x23')]){_0x5d10a7=0x1;}if(!_0x4eae56['ListId']){throw new Error(_0xa725('0x7e'));}}catch(_0x2740db){throw new Error(_0xa725('0x7f'));}var _0xd48503=[];try{_0xd48503=_[_0xa725('0x80')](JSON[_0xa725('0x4e')](process[_0xa725('0x78')][0x4]),'id');}catch(_0x3a4c54){logger['info'](_0xa725('0x81'));}main(_0x288b81,_0x4eae56,_0xd48503,_0x5d10a7);}validate();process['on'](_0xa725('0x82'),handleStop);process['on'](_0xa725('0x83'),handleUncaughtException); \ No newline at end of file +var _0xe099=['dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','length','SystemRow','appendFileSync','emit','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CompanyId','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues','VoiceQueueId','campaigns_has_cm_lists','campaigns','campaigns_has_cm_blacklists','CampaignId','then','finish','affectedRows','contact:import:','unlink','complete','argv','arguments\x20\x20\x20','root','existsSync','binding\x20doesn\x27t\x20exists','binding','firstName\x20is\x20mandatory','UserId','map','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','moment','ioredis','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','phone','scheduledat','ContactId','ListId','createdAt','fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.createdAt','cm_hopper_black','fromQuery','updatedAt','cm_contacts.ListId\x20=\x20','ListId\x20=\x20?','\x20=\x20?','toString','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','field','MIN(id)','min_id','group','Received\x20SIGINT','error','message','exit','errors','code','sequelize','query','spread','push','catch','info','main','stringify','send','start','server/files/tmp','.csv','header','writeFileSync','parse','createReadStream','data','rows','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','includes','email','email\x20wrong\x20format'];(function(_0x4e6afe,_0x1b4f03){var _0x7f6cc3=function(_0x363ee4){while(--_0x363ee4){_0x4e6afe['push'](_0x4e6afe['shift']());}};_0x7f6cc3(++_0x1b4f03);}(_0xe099,0x1c3));var _0x9e09=function(_0x58bcf9,_0x3fdddf){_0x58bcf9=_0x58bcf9-0x0;var _0x39209b=_0xe099[_0x58bcf9];return _0x39209b;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x9e09('0x0'));var Papa=require(_0x9e09('0x1'));var util=require(_0x9e09('0x2'));var BPromise=require(_0x9e09('0x3'));var moment=require(_0x9e09('0x4'));var squel=require('squel');var Redis=require(_0x9e09('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x9e09('0x6'));var logger=require(_0x9e09('0x7'))(_0x9e09('0x8'));config[_0x9e09('0x9')]=_[_0x9e09('0xa')](config[_0x9e09('0x9')],{'host':_0x9e09('0xb'),'port':0x18eb});var socket=require(_0x9e09('0xc'))(new Redis(config[_0x9e09('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x9e09('0xd')](_0x9e09('0xe'));function isEmail(_0xa3cbe7){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'](_0xa3cbe7);}function selectNotIn(_0x1ef0dc,_0x3414bb,_0x5da3c6,_0x3410c6,_0x1d6c66){return squel[_0x9e09('0xf')]()['field']('phone')[_0x9e09('0x10')](_0x3410c6)[_0x9e09('0x11')](_0x3414bb,null,_0x3414bb+_0x9e09('0x12')+_0x3410c6+'.'+_0x5da3c6)[_0x9e09('0x13')](_0x3410c6+'.'+_0x5da3c6+'\x20=\x20'+_0x1ef0dc+'.'+_0x5da3c6)[_0x9e09('0x13')](_0x3414bb+_0x9e09('0x14')+_0x1d6c66[_0x9e09('0x11')]()+')');}function insertCmHopper(_0x4b5585,_0x14dbda,_0x2bf705,_0x353caf,_0xb211b2){var _0x21e4f2=[_0x9e09('0x15'),'cm_contacts.scheduledat',_0x9e09('0x16'),_0x9e09('0x17'),_0x14dbda+'.'+_0x353caf,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x9e09('0x18'),_0x9e09('0x19'),'\x22'+_0xb211b2+'\x22'];return squel[_0x9e09('0x1a')]()[_0x9e09('0x1b')](_0x9e09('0x1c'))['fromQuery']([_0x9e09('0x1d'),_0x9e09('0x1e'),_0x9e09('0x1f'),_0x9e09('0x20'),_0x353caf,_0x9e09('0x21'),'updatedAt','priority','UserId','recallme'],squel[_0x9e09('0xf')]()[_0x9e09('0x22')](_0x21e4f2)[_0x9e09('0x10')](_0x14dbda)[_0x9e09('0x11')](_0x9e09('0x23'),null,'cm_contacts.ListId\x20=\x20'+_0x14dbda+_0x9e09('0x24'))[_0x9e09('0x11')](_0x2bf705,null,_0x2bf705+_0x9e09('0x12')+_0x14dbda+'.'+_0x353caf)['where'](_0x14dbda+_0x9e09('0x25'),_0x4b5585)['where'](_0x9e09('0x26'),NOW)['where'](_0x9e09('0x27'),selectNotIn(_0x14dbda,_0x2bf705,_0x353caf,'cm_hopper',[_0x9e09('0x28'),_0x9e09('0x29')]))[_0x9e09('0x13')](_0x9e09('0x27'),selectNotIn(_0x14dbda,_0x2bf705,_0x353caf,'cm_hopper',[_0x9e09('0x28')])))['toString']();}function insertCmHopperBlack(_0x29d02e,_0x2c30ba,_0x46cf78,_0x211ed2){var _0x3fd13d=['cm_contacts.phone',_0x9e09('0x16'),_0x9e09('0x17'),_0x2c30ba+'.'+_0x211ed2,_0x9e09('0x2a'),'cm_contacts.updatedAt'];return squel[_0x9e09('0x1a')]()['into'](_0x9e09('0x2b'))[_0x9e09('0x2c')](['phone',_0x9e09('0x1f'),_0x9e09('0x20'),_0x211ed2,_0x9e09('0x21'),_0x9e09('0x2d')],squel[_0x9e09('0xf')]()[_0x9e09('0x22')](_0x3fd13d)[_0x9e09('0x10')](_0x2c30ba)[_0x9e09('0x11')](_0x9e09('0x23'),null,_0x9e09('0x2e')+_0x2c30ba+_0x9e09('0x24'))[_0x9e09('0x11')](_0x46cf78,null,_0x46cf78+_0x9e09('0x12')+_0x2c30ba+'.'+_0x211ed2)[_0x9e09('0x13')](_0x2c30ba+_0x9e09('0x25'),_0x29d02e)[_0x9e09('0x13')](_0x9e09('0x26'),NOW)[_0x9e09('0x13')](_0x9e09('0x27'),squel[_0x9e09('0xf')]()['field'](_0x9e09('0x1d'))[_0x9e09('0x10')](_0x9e09('0x2b'))['where'](_0x9e09('0x2f'),_0x29d02e)[_0x9e09('0x13')](_0x211ed2+_0x9e09('0x30'),_0x2c30ba+'.'+_0x211ed2)))[_0x9e09('0x31')]();}function insertCmContact(_0x4d4ff1,_0x39ce8e,_0x32035d,_0x311758){var _0x6c15ef=_['concat'](_[_0x9e09('0x32')](_0x311758),[_0x9e09('0x20'),'CompanyId',_0x9e09('0x21'),_0x9e09('0x2d')]);return squel['insert']()[_0x9e09('0x1b')](_0x9e09('0x23'))['fromQuery'](_0x6c15ef,squel[_0x9e09('0xf')]()['fields'](_0x6c15ef)[_0x9e09('0x10')](_0x39ce8e)[_0x9e09('0x13')]('('+_0x32035d[_0x9e09('0x11')](',')+_0x9e09('0x33'),squel[_0x9e09('0xf')]()[_0x9e09('0x22')](_0x32035d)[_0x9e09('0x10')](_0x9e09('0x23'))[_0x9e09('0x13')]('ListId\x20=\x20?',_0x4d4ff1)['where'](_0x9e09('0x34')))[_0x9e09('0x13')](_0x9e09('0x35'),squel['select']()[_0x9e09('0x36')](_0x9e09('0x37'),_0x9e09('0x38'))[_0x9e09('0x10')](_0x39ce8e)[_0x9e09('0x39')](_0x32035d[_0x9e09('0x11')](','))))[_0x9e09('0x31')]();}function handleStop(){logger['info'](_0x9e09('0x3a'));stopped=!![];}function handleUncaughtException(_0x432f4f){logger[_0x9e09('0x3b')](_0x432f4f[_0x9e09('0x3c')]);process[_0x9e09('0x3d')](0x1);}function handleError(_0x1d4bc3,_0x2cc867){stats[_0x9e09('0x3e')]['push']({'name':_0x2cc867[_0x9e09('0x3f')],'message':_0x2cc867[_0x9e09('0x3c')],'row':_0x1d4bc3});}function handleQuery(_0x5933c2){logger['info'](_0x5933c2);return db[_0x9e09('0x40')][_0x9e09('0x41')](_0x5933c2)[_0x9e09('0x42')](function(_0x1f55a2){results[_0x9e09('0x43')](_0x1f55a2);})[_0x9e09('0x44')](function(_0x408e29){logger[_0x9e09('0x3b')](_0x408e29[_0x9e09('0x3c')]);});}function main(_0x3d314d,_0x388ffc,_0x49301b,_0x715e86){logger[_0x9e09('0x45')](_0x9e09('0x46'),_0x3d314d,JSON[_0x9e09('0x47')](_0x388ffc));process[_0x9e09('0x48')](_0x9e09('0x49'));var _0x20bdb9=_0x388ffc['binding'];var _0x4e9d07=_0x388ffc['socket_timestamp'];var _0x475660=path[_0x9e09('0x11')](config['root'],_0x9e09('0x4a'),_0x4e9d07+_0x9e09('0x4b'));var _0x872952=_['keys'](_0x20bdb9)[_0x9e09('0x11')]();logger[_0x9e09('0x45')](_0x9e09('0x4c'),_0x872952);fs[_0x9e09('0x4d')](_0x475660,_0x872952+'\x0a');Papa[_0x9e09('0x4e')](fs[_0x9e09('0x4f')](_0x3d314d),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2be66c,_0x761e8a){try{for(var _0x2402d4=0x0,_0x1db9ec=[];_0x2402d4<_0x2be66c[_0x9e09('0x50')]['length'];_0x2402d4++){stats[_0x9e09('0x51')]+=0x1;if(_0x2be66c[_0x9e09('0x3e')][_0x2402d4]){handleError(_0x2be66c[_0x9e09('0x50')][_0x2402d4],_0x2be66c['errors'][_0x2402d4]);}else{var _0x24ee79=[];for(var _0x55beba in _0x20bdb9){if(_0x20bdb9[_0x9e09('0x52')](_0x55beba)){if(_0x2be66c[_0x9e09('0x50')][_0x2402d4][_0x20bdb9[_0x55beba]]){var _0xee0c47=_[_0x9e09('0x53')](_0x2be66c['data'][_0x2402d4][_0x20bdb9[_0x55beba]][_0x9e09('0x54')](/"/g,'\x27'));switch(_0x55beba){case _0x9e09('0x1e'):var _0x4daf9c=moment(_0xee0c47,_0x9e09('0xe'),!![]);if(_0x4daf9c[_0x9e09('0x55')]()){_0x1db9ec[_0x9e09('0x43')]('\x22'+_0xee0c47+'\x22');}else{_0x24ee79['push'](_0x9e09('0x56'));}break;case _0x9e09('0x57'):var _0x4e5567=parseInt(_0xee0c47);_0xee0c47=_[_0x9e09('0x58')](_0x4e5567)||_0x4e5567<0x0||_0x4e5567>0x4?_0x715e86?0x3:0x2:_0x4e5567;_0x1db9ec[_0x9e09('0x43')]('\x22'+_0xee0c47+'\x22');break;case'UserId':var _0x28412a=parseInt(_0xee0c47);if(_[_0x9e09('0x59')](_0x28412a)&&_[_0x9e09('0x5a')](_0x49301b,_0x28412a)){_0x1db9ec['push']('\x22'+_0x28412a+'\x22');}else{_0x24ee79[_0x9e09('0x43')]('agent\x20not\x20exists');}break;case _0x9e09('0x5b'):if(isEmail(_0xee0c47)){_0x1db9ec['push']('\x22'+_0xee0c47+'\x22');}else{_0x24ee79[_0x9e09('0x43')](_0x9e09('0x5c'));}break;case _0x9e09('0x5d'):var _0x2e036d=moment(_0xee0c47,_0x9e09('0x5e'),!![]);if(_0x2e036d[_0x9e09('0x55')]()){_0x1db9ec[_0x9e09('0x43')]('\x22'+_0xee0c47+'\x22');}else{_0x24ee79['push'](_0x9e09('0x5f'));}break;default:_0x1db9ec[_0x9e09('0x43')]('\x22'+_0xee0c47+'\x22');}}else{switch(_0x55beba){case _0x9e09('0x60'):case _0x9e09('0x1d'):_0x24ee79['push'](_0x55beba+'\x20not\x20specified');break;default:_0x1db9ec[_0x9e09('0x43')]('\x22\x22');}}}}if(_0x24ee79[_0x9e09('0x61')]){handleError(_0x2be66c[_0x9e09('0x50')][_0x2402d4],{'code':_0x9e09('0x62'),'message':_0x24ee79[_0x9e09('0x11')]()});}else{fs[_0x9e09('0x63')](_0x475660,_0x1db9ec[_0x9e09('0x11')]()+'\x0a');}_0x1db9ec=[];}if(!(stats[_0x9e09('0x51')]%0xc8)){socket[_0x9e09('0x64')]('contact:import:'+_0x4e9d07,stats);stats[_0x9e09('0x3e')]=[];}}if(stopped){logger[_0x9e09('0x45')](_0x9e09('0x65'));_0x761e8a[_0x9e09('0x66')]();}}catch(_0x4cea0c){handleError(_0x2be66c[_0x9e09('0x50')][_0x2402d4],{'code':_0x9e09('0x67'),'message':_0x4cea0c['message']});logger[_0x9e09('0x3b')](_0x9e09('0x68'),_0x4cea0c[_0x9e09('0x3c')]);}},'complete':function(){try{var _0x418e4c=[];var _0x424bb9=_0x9e09('0x23');if(_0x388ffc['duplicates']&&_0x388ffc[_0x9e09('0x69')][_0x9e09('0x61')]){_0x424bb9=_0x9e09('0x6a')+_0x4e9d07;_0x418e4c[_0x9e09('0x43')](_0x9e09('0x6b')+_0x424bb9+_0x9e09('0x6c'));}var _0x258452=util[_0x9e09('0xd')]('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',_0x475660,_0x424bb9,_0x872952,_0x388ffc[_0x9e09('0x20')],_0x388ffc[_0x9e09('0x6d')]||null,NOW,NOW);if(_[_0x9e09('0x6e')](_0x20bdb9[_0x9e09('0x1e')])){_0x258452+=_0x9e09('0x6f');}_0x418e4c[_0x9e09('0x43')](_0x258452);if(_0x388ffc[_0x9e09('0x69')]&&_0x388ffc[_0x9e09('0x69')][_0x9e09('0x61')]){_0x418e4c[_0x9e09('0x43')](insertCmContact(_0x388ffc[_0x9e09('0x20')],_0x424bb9,_0x388ffc[_0x9e09('0x69')],_0x20bdb9));_0x418e4c[_0x9e09('0x43')](_0x9e09('0x70')+_0x424bb9+';');}_0x418e4c['push'](insertCmHopper(_0x388ffc[_0x9e09('0x20')],'voice_queues_has_cm_lists',_0x9e09('0x71'),_0x9e09('0x72'),_0x715e86));_0x418e4c[_0x9e09('0x43')](insertCmHopperBlack(_0x388ffc[_0x9e09('0x20')],'voice_queues_has_cm_blacklists',_0x9e09('0x71'),_0x9e09('0x72')));_0x418e4c[_0x9e09('0x43')](insertCmHopper(_0x388ffc[_0x9e09('0x20')],_0x9e09('0x73'),_0x9e09('0x74'),'CampaignId',_0x715e86));_0x418e4c['push'](insertCmHopperBlack(_0x388ffc['ListId'],_0x9e09('0x75'),'campaigns',_0x9e09('0x76')));BPromise['each'](_0x418e4c,handleQuery)[_0x9e09('0x77')](function(_0x3bb6d4){stats[_0x9e09('0x78')]=!![];stats[_0x9e09('0x79')]=_0x388ffc[_0x9e09('0x69')]&&_0x388ffc['duplicates'][_0x9e09('0x61')]?results[0x2][_0x9e09('0x79')]:results[0x0]['affectedRows'];socket[_0x9e09('0x64')](_0x9e09('0x7a')+_0x4e9d07,stats);fs['unlink'](_0x3d314d);fs[_0x9e09('0x7b')](_0x475660);process[_0x9e09('0x3d')](0x0);})[_0x9e09('0x44')](function(_0x59dfdf){logger[_0x9e09('0x3b')](_0x59dfdf[_0x9e09('0x3c')]);process['exit'](0x1);});}catch(_0x14b3e5){logger[_0x9e09('0x3b')](_0x9e09('0x7c'),_0x14b3e5[_0x9e09('0x3c')]);process[_0x9e09('0x3d')](0x1);}},'error':function(_0x30b994,_0x191352,_0x1ead2e,_0x529c9e){throw new Error(_0x529c9e);}});}function validate(){if(process[_0x9e09('0x7d')]&&process[_0x9e09('0x7d')]['length']<0x4){throw new Error(_0x9e09('0x7e'));}var _0x778f76=path[_0x9e09('0x11')](config[_0x9e09('0x7f')],'server/files/tmp',process[_0x9e09('0x7d')][0x2]);if(!fs[_0x9e09('0x80')](_0x778f76)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x38a897={};try{_0x38a897=JSON['parse'](process['argv'][0x3]);if(!_0x38a897['binding']){throw new Error(_0x9e09('0x81'));}if(!_0x38a897[_0x9e09('0x82')][_0x9e09('0x1d')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x38a897[_0x9e09('0x82')][_0x9e09('0x60')]){throw new Error(_0x9e09('0x83'));}var _0x15b735=0x0;if(_0x38a897[_0x9e09('0x82')][_0x9e09('0x84')]){_0x15b735=0x1;}if(!_0x38a897['ListId']){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x22f7c){throw new Error('body\x20id\x20mandatory');}var _0x235493=[];try{_0x235493=_[_0x9e09('0x85')](JSON[_0x9e09('0x4e')](process[_0x9e09('0x7d')][0x4]),'id');}catch(_0x3e464f){logger['info']('No\x20agent\x20available');}main(_0x778f76,_0x38a897,_0x235493,_0x15b735);}validate();process['on'](_0x9e09('0x86'),handleStop);process['on'](_0x9e09('0x87'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 26c02d7..c90f5d0 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb8b9=['Billable\x20Time','getSubjects','[xCALLY\x20Ticket]','voice','toLowerCase','inbound','push','variable','outbound','string','Outbound\x20Call','destcalleridnum','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridname','Call\x20To','destexten','Queue','queue','UniqueId','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','Called\x20Number','Member\x20Name','membername','starttime','Answer\x20Time','answertime','Complete\x20Time','Duration','duration'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xb8b9,0x196));var _0x9b8b=function(_0x51b829,_0x3fb0b5){_0x51b829=_0x51b829-0x0;var _0x408760=_0xb8b9[_0x51b829];return _0x408760;};'use strict';exports[_0x9b8b('0x0')]=function(_0x245ee8,_0x53c037){var _0x33dd7b=[{'type':'string','content':_0x9b8b('0x1'),'variableName':null}];switch(_0x245ee8['toLowerCase']()){case _0x9b8b('0x2'):switch(_0x53c037[_0x9b8b('0x3')]()){case _0x9b8b('0x4'):_0x33dd7b[_0x9b8b('0x5')]({'type':_0x9b8b('0x6'),'content':'','variableName':'queue'});_0x33dd7b['push']({'type':_0x9b8b('0x6'),'content':'','variableName':'calleridnum'});break;case _0x9b8b('0x7'):_0x33dd7b['push']({'type':_0x9b8b('0x8'),'content':_0x9b8b('0x9'),'variableName':null});_0x33dd7b[_0x9b8b('0x5')]({'type':_0x9b8b('0x6'),'content':'','variableName':_0x9b8b('0xa')});break;}}return _0x33dd7b;};exports['getDescriptions']=function(_0x3e4102,_0x26a23c){var _0x4b6fcd=[];switch(_0x3e4102[_0x9b8b('0x3')]()){case'voice':switch(_0x26a23c[_0x9b8b('0x3')]()){case _0x9b8b('0x4'):_0x4b6fcd=[{'type':_0x9b8b('0x8'),'content':_0x9b8b('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0x9b8b('0xc'),'content':'','key':_0x9b8b('0xd'),'keyType':_0x9b8b('0x6'),'variableName':'calleridnum'},{'type':_0x9b8b('0xc'),'content':'','key':'Caller\x20Name','keyType':'variable','variableName':_0x9b8b('0xe')},{'type':'keyValue','content':'','key':_0x9b8b('0xf'),'keyType':'variable','variableName':_0x9b8b('0x10')},{'type':_0x9b8b('0xc'),'content':'','key':_0x9b8b('0x11'),'keyType':'variable','variableName':_0x9b8b('0x12')},{'type':_0x9b8b('0xc'),'content':'','key':_0x9b8b('0x13'),'keyType':_0x9b8b('0x6'),'variableName':'uniqueid'},{'type':_0x9b8b('0xc'),'content':'','key':_0x9b8b('0x14'),'keyType':_0x9b8b('0x6'),'variableName':_0x9b8b('0x15')},{'type':_0x9b8b('0x8'),'content':_0x9b8b('0x16'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x9b8b('0x17'),'keyType':_0x9b8b('0x6'),'variableName':_0x9b8b('0x18')},{'type':'keyValue','content':'','key':_0x9b8b('0x19'),'keyType':_0x9b8b('0x6'),'variableName':_0x9b8b('0xa')},{'type':_0x9b8b('0x8'),'content':_0x9b8b('0x1a'),'key':null,'keyType':null,'variableName':null},{'type':_0x9b8b('0xc'),'content':'','key':_0x9b8b('0x1b'),'keyType':_0x9b8b('0x6'),'variableName':'agentcalledAt'},{'type':_0x9b8b('0xc'),'content':'','key':_0x9b8b('0x1c'),'keyType':_0x9b8b('0x6'),'variableName':_0x9b8b('0x1d')},{'type':_0x9b8b('0xc'),'content':'','key':_0x9b8b('0x1e'),'keyType':_0x9b8b('0x6'),'variableName':_0x9b8b('0x1f')},{'type':'keyValue','content':'','key':_0x9b8b('0x20'),'keyType':'variable','variableName':_0x9b8b('0x21')},{'type':'keyValue','content':'','key':_0x9b8b('0x22'),'keyType':_0x9b8b('0x6'),'variableName':'talktime'}];break;case'outbound':_0x4b6fcd=[{'type':'string','content':_0x9b8b('0xb'),'variableName':null},{'type':'keyValue','content':'','key':_0x9b8b('0x23'),'keyType':_0x9b8b('0x6'),'keyContent':'','variableName':_0x9b8b('0xa')},{'type':_0x9b8b('0xc'),'content':'','key':_0x9b8b('0x24'),'keyType':'variable','keyContent':'','variableName':_0x9b8b('0x25')},{'type':_0x9b8b('0xc'),'content':'','key':'UniqueId','keyType':_0x9b8b('0x6'),'keyContent':'','variableName':'uniqueid'},{'type':_0x9b8b('0xc'),'content':'','key':_0x9b8b('0x14'),'keyType':_0x9b8b('0x6'),'keyContent':'','variableName':_0x9b8b('0x26')},{'type':_0x9b8b('0x8'),'content':_0x9b8b('0x1a')},{'type':_0x9b8b('0xc'),'content':'','key':_0x9b8b('0x27'),'keyType':_0x9b8b('0x6'),'keyContent':'','variableName':_0x9b8b('0x28')},{'type':_0x9b8b('0xc'),'content':'','key':_0x9b8b('0x29'),'keyType':_0x9b8b('0x6'),'keyContent':'','variableName':'endtime'},{'type':_0x9b8b('0xc'),'content':'','key':_0x9b8b('0x2a'),'keyType':'variable','keyContent':'','variableName':_0x9b8b('0x2b')},{'type':_0x9b8b('0xc'),'content':'','key':_0x9b8b('0x2c'),'keyType':'variable','keyContent':'','variableName':'billableseconds'}];break;}}return _0x4b6fcd;}; \ No newline at end of file +var _0x582a=['agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','voice','push','queue','variable','calleridnum','outbound','Outbound\x20Call','destcalleridnum','toLowerCase','***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','Call\x20To','destexten','UniqueId','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete'];(function(_0x50c68a,_0x51dfce){var _0x4cd7ca=function(_0x17c95b){while(--_0x17c95b){_0x50c68a['push'](_0x50c68a['shift']());}};_0x4cd7ca(++_0x51dfce);}(_0x582a,0xf7));var _0xa582=function(_0x2b6c91,_0x34c301){_0x2b6c91=_0x2b6c91-0x0;var _0x5a7c40=_0x582a[_0x2b6c91];return _0x5a7c40;};'use strict';exports[_0xa582('0x0')]=function(_0x584f8c,_0x44d241){var _0x1480db=[{'type':_0xa582('0x1'),'content':_0xa582('0x2'),'variableName':null}];switch(_0x584f8c['toLowerCase']()){case _0xa582('0x3'):switch(_0x44d241['toLowerCase']()){case'inbound':_0x1480db[_0xa582('0x4')]({'type':'variable','content':'','variableName':_0xa582('0x5')});_0x1480db[_0xa582('0x4')]({'type':_0xa582('0x6'),'content':'','variableName':_0xa582('0x7')});break;case _0xa582('0x8'):_0x1480db[_0xa582('0x4')]({'type':_0xa582('0x1'),'content':_0xa582('0x9'),'variableName':null});_0x1480db[_0xa582('0x4')]({'type':_0xa582('0x6'),'content':'','variableName':_0xa582('0xa')});break;}}return _0x1480db;};exports['getDescriptions']=function(_0x4d1e35,_0x414186){var _0x555a8c=[];switch(_0x4d1e35[_0xa582('0xb')]()){case'voice':switch(_0x414186[_0xa582('0xb')]()){case'inbound':_0x555a8c=[{'type':_0xa582('0x1'),'content':_0xa582('0xc'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xa582('0xd'),'keyType':_0xa582('0x6'),'variableName':_0xa582('0x7')},{'type':_0xa582('0xe'),'content':'','key':'Caller\x20Name','keyType':'variable','variableName':'calleridname'},{'type':_0xa582('0xe'),'content':'','key':_0xa582('0xf'),'keyType':'variable','variableName':_0xa582('0x10')},{'type':'keyValue','content':'','key':'Queue','keyType':_0xa582('0x6'),'variableName':_0xa582('0x5')},{'type':_0xa582('0xe'),'content':'','key':_0xa582('0x11'),'keyType':_0xa582('0x6'),'variableName':'uniqueid'},{'type':'keyValue','content':'','key':_0xa582('0x12'),'keyType':_0xa582('0x6'),'variableName':_0xa582('0x13')},{'type':'string','content':_0xa582('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0xa582('0xe'),'content':'','key':_0xa582('0x15'),'keyType':'variable','variableName':_0xa582('0x16')},{'type':_0xa582('0xe'),'content':'','key':_0xa582('0x17'),'keyType':'variable','variableName':_0xa582('0xa')},{'type':'string','content':_0xa582('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0xa582('0xe'),'content':'','key':_0xa582('0x19'),'keyType':'variable','variableName':_0xa582('0x13')},{'type':_0xa582('0xe'),'content':'','key':_0xa582('0x1a'),'keyType':_0xa582('0x6'),'variableName':_0xa582('0x1b')},{'type':'keyValue','content':'','key':_0xa582('0x1c'),'keyType':'variable','variableName':_0xa582('0x1d')},{'type':_0xa582('0xe'),'content':'','key':_0xa582('0x1e'),'keyType':'variable','variableName':_0xa582('0x1f')},{'type':_0xa582('0xe'),'content':'','key':_0xa582('0x20'),'keyType':_0xa582('0x6'),'variableName':_0xa582('0x21')}];break;case'outbound':_0x555a8c=[{'type':'string','content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0xa582('0xe'),'content':'','key':_0xa582('0x22'),'keyType':_0xa582('0x6'),'keyContent':'','variableName':_0xa582('0xa')},{'type':_0xa582('0xe'),'content':'','key':_0xa582('0x23'),'keyType':_0xa582('0x6'),'keyContent':'','variableName':_0xa582('0x24')},{'type':_0xa582('0xe'),'content':'','key':_0xa582('0x11'),'keyType':_0xa582('0x6'),'keyContent':'','variableName':'uniqueid'},{'type':_0xa582('0xe'),'content':'','key':'Date','keyType':_0xa582('0x6'),'keyContent':'','variableName':_0xa582('0x25')},{'type':_0xa582('0x1'),'content':_0xa582('0x18')},{'type':_0xa582('0xe'),'content':'','key':_0xa582('0x26'),'keyType':_0xa582('0x6'),'keyContent':'','variableName':_0xa582('0x27')},{'type':_0xa582('0xe'),'content':'','key':_0xa582('0x28'),'keyType':_0xa582('0x6'),'keyContent':'','variableName':_0xa582('0x29')},{'type':_0xa582('0xe'),'content':'','key':_0xa582('0x2a'),'keyType':'variable','keyContent':'','variableName':_0xa582('0x2b')},{'type':'keyValue','content':'','key':_0xa582('0x2c'),'keyType':_0xa582('0x6'),'keyContent':'','variableName':_0xa582('0x2d')}];break;}}return _0x555a8c;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 15a03e1..c50babe 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf67e=['whatsapp-interactions','InteractionId','upperFirst','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','null','Interaction','findOne','then','update','error','tracked','user','query','clone','body','omit','html','fax','mobile','../../mysqldb','../../config/logger','openchannel-interactions','sms-interactions'];(function(_0x4810bc,_0x515142){var _0x2c82c9=function(_0x3039fe){while(--_0x3039fe){_0x4810bc['push'](_0x4810bc['shift']());}};_0x2c82c9(++_0x515142);}(_0xf67e,0xb2));var _0xef67=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xf67e[_0x3d42d8];return _0x27fc41;};'use strict';var _=require('lodash');var db=require(_0xef67('0x0'))['db'];var loggers={'openchannel':require(_0xef67('0x1'))(_0xef67('0x2')),'mail':require(_0xef67('0x1'))('mail-interactions'),'fax':require('../../config/logger')('fax-interactions'),'sms':require(_0xef67('0x1'))(_0xef67('0x3')),'chat':require('../../config/logger')('chat-interactions'),'whatsapp':require(_0xef67('0x1'))(_0xef67('0x4'))};function getInteractionId(_0x57a5f5,_0x3089c9,_0x3bef74){if(_0x57a5f5&&_0x57a5f5[_['upperFirst'](_0x3bef74)+_0xef67('0x5')]){return _0x57a5f5[_[_0xef67('0x6')](_0x3bef74)+'InteractionId'];}else if(_0x57a5f5&&_0x57a5f5['id']){return _0x57a5f5['id'];}else if(_0x3089c9&&_0x3089c9['id']){return _0x3089c9['id'];}else{return'unknown';}}function log(_0xf2a7fd,_0x353992,_0x4d4516,_0x23d23c,_0x3cd082,_0x2f898f){loggers[_0x3cd082['toLowerCase']()][_0xf2a7fd](_0xef67('0x7'),_0x2f898f[_0xef67('0x8')](),_0x353992?_0x353992['id']:null,_0x353992?_0x353992[_0xef67('0x9')]:null,_0x353992?_0x353992['role']:null,getInteractionId(_0x4d4516,_0x23d23c,_0x3cd082),_0x4d4516?JSON[_0xef67('0xa')](_0x4d4516):_0xef67('0xb'));}function updateUser(_0x2f4707,_0x32aeb8,_0xcfc3c,_0x124e5e,_0x368bdd){db[_[_0xef67('0x6')](_0x124e5e)+_0xef67('0xc')][_0xef67('0xd')]({'where':{'id':getInteractionId(_0x32aeb8,_0xcfc3c,_0x124e5e)}})[_0xef67('0xe')](function(_0x1d85ad){if(_0x1d85ad){return _0x1d85ad[_0xef67('0xf')]({'UserId':_0x2f4707?_0x2f4707['id']:null});}})[_0xef67('0xe')](function(_0x16a682){if(_0x16a682){log('info',_0x2f4707,_0x32aeb8,_0xcfc3c,_0x124e5e,_0x368bdd);}})['catch'](function(){log(_0xef67('0x10'),_0x2f4707,_0x32aeb8,_0xcfc3c,_0x124e5e,_0x368bdd);});}exports[_0xef67('0x11')]=function(_0x1b1e8d,_0x18b7ba){return function(_0x4649da,_0x2857ee,_0x2f6a43){var _0x133951=_0x4649da[_0xef67('0x12')];var _0x2f24ab={};var _0x10bb20=_0x4649da[_0xef67('0x13')];if(_0x2f24ab){_0x2f24ab=_[_0xef67('0x14')](_0x4649da[_0xef67('0x15')]);_0x2f24ab=_[_0xef67('0x16')](_0x2f24ab,[_0xef67('0x15'),_0xef67('0x17'),'phone',_0xef67('0x18'),_0xef67('0x19')]);}updateUser(_0x133951,_0x2f24ab,_0x10bb20,_0x1b1e8d,_0x18b7ba);_0x2f6a43(null);};}; \ No newline at end of file +var _0xee93=['upperFirst','InteractionId','unknown','toUpperCase','name','stringify','findOne','info','catch','error','user','body','html','phone','lodash','../../mysqldb','openchannel-interactions','../../config/logger','mail-interactions','sms-interactions','chat-interactions'];(function(_0x6cf618,_0x359752){var _0x268365=function(_0x26ea5c){while(--_0x26ea5c){_0x6cf618['push'](_0x6cf618['shift']());}};_0x268365(++_0x359752);}(_0xee93,0x77));var _0x3ee9=function(_0x2742a5,_0x3706fc){_0x2742a5=_0x2742a5-0x0;var _0x144658=_0xee93[_0x2742a5];return _0x144658;};'use strict';var _=require(_0x3ee9('0x0'));var db=require(_0x3ee9('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x3ee9('0x2')),'mail':require(_0x3ee9('0x3'))(_0x3ee9('0x4')),'fax':require('../../config/logger')('fax-interactions'),'sms':require('../../config/logger')(_0x3ee9('0x5')),'chat':require(_0x3ee9('0x3'))(_0x3ee9('0x6')),'whatsapp':require(_0x3ee9('0x3'))('whatsapp-interactions')};function getInteractionId(_0x32bac6,_0x50764a,_0x5732de){if(_0x32bac6&&_0x32bac6[_[_0x3ee9('0x7')](_0x5732de)+_0x3ee9('0x8')]){return _0x32bac6[_[_0x3ee9('0x7')](_0x5732de)+'InteractionId'];}else if(_0x32bac6&&_0x32bac6['id']){return _0x32bac6['id'];}else if(_0x50764a&&_0x50764a['id']){return _0x50764a['id'];}else{return _0x3ee9('0x9');}}function log(_0x1e2359,_0x4a96f5,_0x1f9bbb,_0x1f7464,_0x581d2f,_0x5021de){loggers[_0x581d2f['toLowerCase']()][_0x1e2359]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5021de[_0x3ee9('0xa')](),_0x4a96f5?_0x4a96f5['id']:null,_0x4a96f5?_0x4a96f5[_0x3ee9('0xb')]:null,_0x4a96f5?_0x4a96f5['role']:null,getInteractionId(_0x1f9bbb,_0x1f7464,_0x581d2f),_0x1f9bbb?JSON[_0x3ee9('0xc')](_0x1f9bbb):'null');}function updateUser(_0x2ac2fd,_0x12ef23,_0x51eb1e,_0x4e8b15,_0x47ddb5){db[_['upperFirst'](_0x4e8b15)+'Interaction'][_0x3ee9('0xd')]({'where':{'id':getInteractionId(_0x12ef23,_0x51eb1e,_0x4e8b15)}})['then'](function(_0x51fdf6){if(_0x51fdf6){return _0x51fdf6['update']({'UserId':_0x2ac2fd?_0x2ac2fd['id']:null});}})['then'](function(_0x5707e2){if(_0x5707e2){log(_0x3ee9('0xe'),_0x2ac2fd,_0x12ef23,_0x51eb1e,_0x4e8b15,_0x47ddb5);}})[_0x3ee9('0xf')](function(){log(_0x3ee9('0x10'),_0x2ac2fd,_0x12ef23,_0x51eb1e,_0x4e8b15,_0x47ddb5);});}exports['tracked']=function(_0x3e314f,_0x4a62c3){return function(_0x4d714a,_0x17c7b2,_0x572358){var _0x4ebef8=_0x4d714a[_0x3ee9('0x11')];var _0x108df5={};var _0x3ced7c=_0x4d714a['query'];if(_0x108df5){_0x108df5=_['clone'](_0x4d714a[_0x3ee9('0x12')]);_0x108df5=_['omit'](_0x108df5,[_0x3ee9('0x12'),_0x3ee9('0x13'),_0x3ee9('0x14'),'fax','mobile']);}updateUser(_0x4ebef8,_0x108df5,_0x3ced7c,_0x3e314f,_0x4a62c3);_0x572358(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 9c83b13..5be7503 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 _0x2a1d=['then','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','final','utf8','parse','hasOwnProperty','use','findOne'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x2a1d,0xd4));var _0xd2a1=function(_0x2bdf07,_0x175421){_0x2bdf07=_0x2bdf07-0x0;var _0x20b8fb=_0x2a1d[_0x2bdf07];return _0x20b8fb;};'use strict';var crypto=require(_0xd2a1('0x0'));var util=require(_0xd2a1('0x1'));var compose=require(_0xd2a1('0x2'));var db=require(_0xd2a1('0x3'))['db'];var config=require(_0xd2a1('0x4'));function getValueFromLicense(_0x5445c7,_0x432e98){if(_0x5445c7&&_0x432e98){if(_0x432e98[_0xd2a1('0x5')]&&_0x432e98['license']){var _0x14d3e8=_0x432e98[_0xd2a1('0x5')];var _0x124d0c=_0x432e98[_0xd2a1('0x6')];var _0x2d5011=_0x14d3e8[_0xd2a1('0x7')]('-')[0x4];var _0x31c03b=_0x14d3e8[_0xd2a1('0x7')]('-')[0x0];var _0x5c5239=crypto[_0xd2a1('0x8')](_0xd2a1('0x9'),util[_0xd2a1('0xa')](_0xd2a1('0xb'),_0x2d5011,_0x14d3e8,_0x31c03b));var _0x48eb60=_0x5c5239[_0xd2a1('0xc')](_0x124d0c,_0xd2a1('0xd'),'utf8');_0x48eb60+=_0x5c5239[_0xd2a1('0xe')](_0xd2a1('0xf'));var _0x56c39b=JSON[_0xd2a1('0x10')](_0x48eb60);return _0x56c39b[_0xd2a1('0x11')](_0x5445c7)?_0x56c39b[_0x5445c7]:null;}}return null;}function isLimit(_0x1ab9ed,_0x44a7f8,_0x4be16c,_0x558f01){var _0x132fcc=_0x44a7f8;return compose()[_0xd2a1('0x12')](function(_0x43fc35,_0xeb24b7,_0x5e54e6){return db['License'][_0xd2a1('0x13')]({'where':{'id':0x1},'raw':!![]})[_0xd2a1('0x14')](function(_0x4e4c45){var _0x3cb2d6=getValueFromLicense(_0x1ab9ed,_0x4e4c45);return _0x3cb2d6?_0x3cb2d6:_0x132fcc;})[_0xd2a1('0x14')](function(_0x1b82a9){_0x132fcc=_0x1b82a9;return _0x4be16c[_0xd2a1('0x15')](_0x558f01);})[_0xd2a1('0x14')](function(_0x33f8a4){if(_0x33f8a4>=_0x132fcc){return _0xeb24b7['status'](0x193)[_0xd2a1('0x16')]({'message':util[_0xd2a1('0xa')](_0xd2a1('0x17'),_0x1ab9ed)});}_0x5e54e6();})[_0xd2a1('0x18')](function(_0x5c19b1){_0x5e54e6(_0x5c19b1);});});}function isUserLimit(){return isLimit(_0xd2a1('0x19'),0x1,db['User'],{'where':{'$or':[{'role':_0xd2a1('0x1a')},{'role':_0xd2a1('0x1b')}]}});}exports[_0xd2a1('0x1c')]=isUserLimit; \ No newline at end of file +var _0xa55d=['%s:%s:%s','update','base64','utf8','parse','hasOwnProperty','findOne','then','count','status','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','user','../../mysqldb','../../config/environment','data1','license','split','aes-256-ctr'];(function(_0x4b9803,_0x177fcb){var _0x18e58e=function(_0x3e91df){while(--_0x3e91df){_0x4b9803['push'](_0x4b9803['shift']());}};_0x18e58e(++_0x177fcb);}(_0xa55d,0xc9));var _0xda55=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa55d[_0x501510];return _0x1e6ee5;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require('composable-middleware');var db=require(_0xda55('0x0'))['db'];var config=require(_0xda55('0x1'));function getValueFromLicense(_0x1fab41,_0x25b7d9){if(_0x1fab41&&_0x25b7d9){if(_0x25b7d9[_0xda55('0x2')]&&_0x25b7d9['license']){var _0x3ef585=_0x25b7d9[_0xda55('0x2')];var _0x220331=_0x25b7d9[_0xda55('0x3')];var _0x44132c=_0x3ef585[_0xda55('0x4')]('-')[0x4];var _0x2a7ad4=_0x3ef585[_0xda55('0x4')]('-')[0x0];var _0x2a8721=crypto['createDecipher'](_0xda55('0x5'),util['format'](_0xda55('0x6'),_0x44132c,_0x3ef585,_0x2a7ad4));var _0x193eb5=_0x2a8721[_0xda55('0x7')](_0x220331,_0xda55('0x8'),'utf8');_0x193eb5+=_0x2a8721['final'](_0xda55('0x9'));var _0x1daaa7=JSON[_0xda55('0xa')](_0x193eb5);return _0x1daaa7[_0xda55('0xb')](_0x1fab41)?_0x1daaa7[_0x1fab41]:null;}}return null;}function isLimit(_0x1dabc5,_0x545573,_0x21c42e,_0x35e02d){var _0x30f452=_0x545573;return compose()['use'](function(_0x869bbc,_0x3fefff,_0xf060ba){return db['License'][_0xda55('0xc')]({'where':{'id':0x1},'raw':!![]})[_0xda55('0xd')](function(_0x5da643){var _0x23f649=getValueFromLicense(_0x1dabc5,_0x5da643);return _0x23f649?_0x23f649:_0x30f452;})[_0xda55('0xd')](function(_0x16db28){_0x30f452=_0x16db28;return _0x21c42e[_0xda55('0xe')](_0x35e02d);})[_0xda55('0xd')](function(_0x2c50b6){if(_0x2c50b6>=_0x30f452){return _0x3fefff[_0xda55('0xf')](0x193)[_0xda55('0x10')]({'message':util[_0xda55('0x11')](_0xda55('0x12'),_0x1dabc5)});}_0xf060ba();})[_0xda55('0x13')](function(_0x3d8fdc){_0xf060ba(_0x3d8fdc);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xda55('0x14')],{'where':{'$or':[{'role':_0xda55('0x15')},{'role':_0xda55('0x16')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 4f30752..49bb536 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 _0x9e3a=['start','$endsWith','utcOffset','minutes','seconds','lodash','moment','parseSearch','startsWith','[$or]','and','replace','[$and]','split','length','slice','shift','match','forEach','indexOf','map','conditions','buildExpression','DATE','$eq','operator','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','$ne','$notIn','\x20OR\x20','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$startsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','$between','BETWEEN\x20?\x20AND\x20?'];(function(_0xa9ca8f,_0x9b109e){var _0x1ca345=function(_0xc23936){while(--_0xc23936){_0xa9ca8f['push'](_0xa9ca8f['shift']());}};_0x1ca345(++_0x9b109e);}(_0x9e3a,0x73));var _0xa9e3=function(_0x3e9542,_0x4de22f){_0x3e9542=_0x3e9542-0x0;var _0xc73c99=_0x9e3a[_0x3e9542];return _0xc73c99;};'use strict';var _=require(_0xa9e3('0x0'));var moment=require(_0xa9e3('0x1'));exports[_0xa9e3('0x2')]=function(_0xef661e){var _0x5d6efe={'conditions':[]};_0x5d6efe['sqlOperator']=_[_0xa9e3('0x3')](_0xef661e,_0xa9e3('0x4'))?'or':_0xa9e3('0x5');var _0x5350b9=_0xef661e[_0xa9e3('0x6')](_0xa9e3('0x7'),'')[_0xa9e3('0x6')](_0xa9e3('0x4'),'')[_0xa9e3('0x8')]('||');for(var _0x55107a=0x0;_0x55107a<_0x5350b9[_0xa9e3('0x9')];_0x55107a++){var _0x51cec4=_0x5350b9[_0x55107a][_0xa9e3('0x8')](':=');var _0x508c8b=_0x51cec4[0x0];var _0x3da030=_0x51cec4[_0xa9e3('0xa')](0x1);_0x3da030['forEach'](function(_0x39bd0b){var _0x40a5c1=_0x39bd0b[_0xa9e3('0x8')]('[')[_0xa9e3('0xb')]();var _0x202a0d=_0x39bd0b[_0xa9e3('0xc')](/\[(.*?)\]/g);_0x202a0d[_0xa9e3('0xd')](function(_0x5cd75d){var _0x50cb9a=_0x5cd75d[_0xa9e3('0x8')]('[')['filter'](function(_0x20bdc0){return _0x20bdc0[_0xa9e3('0xe')](']')>-0x1;})[_0xa9e3('0xf')](function(_0x2c393d){return _0x2c393d[_0xa9e3('0x8')](']')[0x0];})[0x0];_0x5d6efe[_0xa9e3('0x10')]['push']({'field':_0x508c8b,'operator':_0x40a5c1,'value':_0x50cb9a});});});}return _0x5d6efe;};exports[_0xa9e3('0x11')]=function(_0x173bf4,_0x2cdcfb,_0x3ab116){var _0x13154e={};if(_0x2cdcfb===_0xa9e3('0x12')){if(_0x3ab116['operator']===_0xa9e3('0x13')){_0x3ab116[_0xa9e3('0x14')]='$between';_0x3ab116[_0xa9e3('0x15')]+=','+_0x3ab116[_0xa9e3('0x15')];}else if(_[_0xa9e3('0x16')]([_0xa9e3('0x17'),_0xa9e3('0x18')],_0x3ab116[_0xa9e3('0x14')])){_0x3ab116[_0xa9e3('0x15')]=moment(_0x3ab116[_0xa9e3('0x15')])[_0xa9e3('0x19')](0x1,_0xa9e3('0x1a'))[_0xa9e3('0x1b')](_0xa9e3('0x1c'));}}if(_0x3ab116[_0xa9e3('0x1d')]){_0x2cdcfb=_0x3ab116[_0xa9e3('0x1d')];_0x13154e[_0xa9e3('0x1e')]=_0xa9e3('0x1f')+_0x173bf4+'.'+_0x3ab116[_0xa9e3('0x20')]+'\x20AS\x20'+_0x3ab116['castTo']+')\x20'+parseOperator(_0x3ab116[_0xa9e3('0x14')]);}else{_0x13154e[_0xa9e3('0x1e')]=_0x173bf4+'.'+_0x3ab116[_0xa9e3('0x20')]+'\x20'+parseOperator(_0x3ab116[_0xa9e3('0x14')]);}if(_[_0xa9e3('0x16')]([_0xa9e3('0x21'),_0xa9e3('0x22')],_0x3ab116[_0xa9e3('0x14')]))_0x13154e[_0xa9e3('0x1e')]='('+_0x13154e[_0xa9e3('0x1e')]+_0xa9e3('0x23')+_0x173bf4+'.'+_0x3ab116[_0xa9e3('0x20')]+'\x20IS\x20NULL)';_0x13154e[_0xa9e3('0x15')]=parseValue(_0x2cdcfb,_0x3ab116[_0xa9e3('0x14')],_0x3ab116['value']);return _0x13154e;};function parseOperator(_0x4c2388){var _0x4d8466;switch(_0x4c2388){case _0xa9e3('0x24'):_0x4d8466=_0xa9e3('0x25');break;case'$notIn':_0x4d8466=_0xa9e3('0x26');break;case'$eq':_0x4d8466=_0xa9e3('0x27');break;case _0xa9e3('0x21'):_0x4d8466=_0xa9e3('0x28');break;case'$substring':case _0xa9e3('0x29'):case'$endsWith':_0x4d8466=_0xa9e3('0x2a');break;case _0xa9e3('0x2b'):_0x4d8466=_0xa9e3('0x2c');break;case _0xa9e3('0x17'):_0x4d8466=_0xa9e3('0x2d');break;case _0xa9e3('0x18'):_0x4d8466=_0xa9e3('0x2e');break;case _0xa9e3('0x2f'):_0x4d8466='>=\x20?';break;case _0xa9e3('0x30'):_0x4d8466=_0xa9e3('0x31');break;}return _0x4d8466;}function parseValue(_0x37ab45,_0x19bf1a,_0x1823a1){var _0x5f2e80={'start':undefined,'end':undefined};switch(_0x19bf1a){case'$in':case _0xa9e3('0x22'):_0x5f2e80['start']=_0x1823a1[_0xa9e3('0x8')](',');break;case'$substring':_0x5f2e80[_0xa9e3('0x32')]='%'+_0x1823a1+'%';break;case _0xa9e3('0x29'):_0x5f2e80[_0xa9e3('0x32')]=_0x1823a1+'%';break;case _0xa9e3('0x33'):_0x5f2e80[_0xa9e3('0x32')]='%'+_0x1823a1;break;case _0xa9e3('0x30'):var _0xd47358=_0x1823a1[_0xa9e3('0x8')](',');var _0x1823a1=_0xd47358[_0xa9e3('0xb')]();var _0x54b9aa=_0xd47358['pop']();if(_0x37ab45===_0xa9e3('0x12')){_0x1823a1=moment(_0x1823a1)[_0xa9e3('0x34')](0x0,!![])[_0xa9e3('0x1b')]();_0x54b9aa=moment(_0x54b9aa)[_0xa9e3('0x34')](0x0,!![])[_0xa9e3('0x19')](0x17,'hours')[_0xa9e3('0x19')](0x3b,_0xa9e3('0x35'))[_0xa9e3('0x19')](0x3b,_0xa9e3('0x36'))[_0xa9e3('0x1b')]();}_0x5f2e80={'start':_0x1823a1,'end':_0x54b9aa};break;default:_0x5f2e80[_0xa9e3('0x32')]=_0x1823a1;break;}return _0x5f2e80;} \ No newline at end of file +var _0x0df6=['and','replace','[$and]','split','length','forEach','shift','filter','indexOf','buildExpression','operator','$between','value','includes','$lte','days','format','YYYY-MM-DD','castTo','CAST(','field','$ne','$notIn','text','\x20OR\x20','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','$eq','=\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','DATE','utcOffset','add','hours','minutes','seconds','lodash','moment','startsWith','[$or]'];(function(_0x485f6c,_0x5f354e){var _0x2800ff=function(_0xdaee4d){while(--_0xdaee4d){_0x485f6c['push'](_0x485f6c['shift']());}};_0x2800ff(++_0x5f354e);}(_0x0df6,0x134));var _0x60df=function(_0x1753e0,_0x411e0f){_0x1753e0=_0x1753e0-0x0;var _0x55a963=_0x0df6[_0x1753e0];return _0x55a963;};'use strict';var _=require(_0x60df('0x0'));var moment=require(_0x60df('0x1'));exports['parseSearch']=function(_0x416b7d){var _0x168863={'conditions':[]};_0x168863['sqlOperator']=_[_0x60df('0x2')](_0x416b7d,_0x60df('0x3'))?'or':_0x60df('0x4');var _0x232c12=_0x416b7d[_0x60df('0x5')](_0x60df('0x6'),'')[_0x60df('0x5')](_0x60df('0x3'),'')[_0x60df('0x7')]('||');for(var _0x8d2003=0x0;_0x8d2003<_0x232c12[_0x60df('0x8')];_0x8d2003++){var _0x34c98a=_0x232c12[_0x8d2003]['split'](':=');var _0x1b4f94=_0x34c98a[0x0];var _0x46e16c=_0x34c98a['slice'](0x1);_0x46e16c[_0x60df('0x9')](function(_0x4068b9){var _0x1eab4f=_0x4068b9[_0x60df('0x7')]('[')[_0x60df('0xa')]();var _0x4bf0b6=_0x4068b9['match'](/\[(.*?)\]/g);_0x4bf0b6['forEach'](function(_0x1b823e){var _0x4b2f50=_0x1b823e[_0x60df('0x7')]('[')[_0x60df('0xb')](function(_0x17e335){return _0x17e335[_0x60df('0xc')](']')>-0x1;})['map'](function(_0x48edd3){return _0x48edd3[_0x60df('0x7')](']')[0x0];})[0x0];_0x168863['conditions']['push']({'field':_0x1b4f94,'operator':_0x1eab4f,'value':_0x4b2f50});});});}return _0x168863;};exports[_0x60df('0xd')]=function(_0x5bf1ab,_0x4a9056,_0x140f4e){var _0x3e0a51={};if(_0x4a9056==='DATE'){if(_0x140f4e[_0x60df('0xe')]==='$eq'){_0x140f4e[_0x60df('0xe')]=_0x60df('0xf');_0x140f4e[_0x60df('0x10')]+=','+_0x140f4e[_0x60df('0x10')];}else if(_[_0x60df('0x11')](['$gt',_0x60df('0x12')],_0x140f4e[_0x60df('0xe')])){_0x140f4e[_0x60df('0x10')]=moment(_0x140f4e[_0x60df('0x10')])['add'](0x1,_0x60df('0x13'))[_0x60df('0x14')](_0x60df('0x15'));}}if(_0x140f4e[_0x60df('0x16')]){_0x4a9056=_0x140f4e['castTo'];_0x3e0a51['text']=_0x60df('0x17')+_0x5bf1ab+'.'+_0x140f4e[_0x60df('0x18')]+'\x20AS\x20'+_0x140f4e[_0x60df('0x16')]+')\x20'+parseOperator(_0x140f4e[_0x60df('0xe')]);}else{_0x3e0a51['text']=_0x5bf1ab+'.'+_0x140f4e[_0x60df('0x18')]+'\x20'+parseOperator(_0x140f4e[_0x60df('0xe')]);}if(_[_0x60df('0x11')]([_0x60df('0x19'),_0x60df('0x1a')],_0x140f4e[_0x60df('0xe')]))_0x3e0a51[_0x60df('0x1b')]='('+_0x3e0a51[_0x60df('0x1b')]+_0x60df('0x1c')+_0x5bf1ab+'.'+_0x140f4e[_0x60df('0x18')]+_0x60df('0x1d');_0x3e0a51[_0x60df('0x10')]=parseValue(_0x4a9056,_0x140f4e[_0x60df('0xe')],_0x140f4e['value']);return _0x3e0a51;};function parseOperator(_0x19d8e5){var _0x58e02b;switch(_0x19d8e5){case _0x60df('0x1e'):_0x58e02b='IN\x20?';break;case _0x60df('0x1a'):_0x58e02b=_0x60df('0x1f');break;case _0x60df('0x20'):_0x58e02b=_0x60df('0x21');break;case'$ne':_0x58e02b='<>\x20?';break;case _0x60df('0x22'):case _0x60df('0x23'):case _0x60df('0x24'):_0x58e02b=_0x60df('0x25');break;case _0x60df('0x26'):_0x58e02b=_0x60df('0x27');break;case'$gt':_0x58e02b=_0x60df('0x28');break;case'$lte':_0x58e02b=_0x60df('0x29');break;case'$gte':_0x58e02b=_0x60df('0x2a');break;case _0x60df('0xf'):_0x58e02b=_0x60df('0x2b');break;}return _0x58e02b;}function parseValue(_0x3f7654,_0x55e8a7,_0x42b4ea){var _0x4dd36e={'start':undefined,'end':undefined};switch(_0x55e8a7){case'$in':case _0x60df('0x1a'):_0x4dd36e['start']=_0x42b4ea[_0x60df('0x7')](',');break;case _0x60df('0x22'):_0x4dd36e[_0x60df('0x2c')]='%'+_0x42b4ea+'%';break;case _0x60df('0x23'):_0x4dd36e[_0x60df('0x2c')]=_0x42b4ea+'%';break;case _0x60df('0x24'):_0x4dd36e['start']='%'+_0x42b4ea;break;case _0x60df('0xf'):var _0x5d4938=_0x42b4ea['split'](',');var _0x42b4ea=_0x5d4938[_0x60df('0xa')]();var _0x296049=_0x5d4938[_0x60df('0x2d')]();if(_0x3f7654===_0x60df('0x2e')){_0x42b4ea=moment(_0x42b4ea)[_0x60df('0x2f')](0x0,!![])[_0x60df('0x14')]();_0x296049=moment(_0x296049)[_0x60df('0x2f')](0x0,!![])[_0x60df('0x30')](0x17,_0x60df('0x31'))[_0x60df('0x30')](0x3b,_0x60df('0x32'))[_0x60df('0x30')](0x3b,_0x60df('0x33'))[_0x60df('0x14')]();}_0x4dd36e={'start':_0x42b4ea,'end':_0x296049};break;default:_0x4dd36e[_0x60df('0x2c')]=_0x42b4ea;break;}return _0x4dd36e;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 3b51087..55280f8 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 _0xd17d=['^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','includes','join','getOptions','query','$id','model','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','map','lower','options','lodash','parse','keys','split','filters','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','name','uniqueid','isArray','limit','offset','sort','indexOf','priority','col','unsigned','substr','DESC','cast','omit','length','isString','isNumeric','match'];(function(_0x6a3dee,_0x43c2a4){var _0x28b6bf=function(_0x3e98dd){while(--_0x3e98dd){_0x6a3dee['push'](_0x6a3dee['shift']());}};_0x28b6bf(++_0x43c2a4);}(_0xd17d,0x1e0));var _0xdd17=function(_0xddbe2,_0x45f95f){_0xddbe2=_0xddbe2-0x0;var _0x450ac5=_0xd17d[_0xddbe2];return _0x450ac5;};'use strict';var _=require(_0xdd17('0x0'));var sequelize=require('sequelize');var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x5397a5){var _0x88f4a0=['ne'];try{var _0x348899=JSON['parse'](_0x5397a5);var _0x2d9367=Object['keys'](_0x348899)[0x0];return _0x88f4a0['includes'](_0x2d9367);}catch(_0x3bcabc){return![];}}function getOperatorValue(_0x40cba4){var _0x105bea=JSON[_0xdd17('0x1')](_0x40cba4);var _0x582bd3=Object[_0xdd17('0x2')](_0x105bea)[0x0];var _0x3e26f1=_0x105bea[_0x582bd3];return{['$'+_0x582bd3]:_0x3e26f1};}exports['fields']=function(_0x586b30){var _0x689be=null;if(_0x586b30){_0x689be=_0x586b30[_0xdd17('0x3')](',');}return _0x689be;};exports[_0xdd17('0x4')]=function(_0x4edeed,_0x515443){var _0x29e4ed={};if(!_['isEmpty'](_0x4edeed)){_[_0xdd17('0x5')](_0x4edeed,function(_0x5ec6ad,_0x215778){try{if(_0x515443){var _0x53aeec=_[_0xdd17('0x6')](_0x515443,{'name':_0x215778})||{};if(hasSequelizeOperator(_0x5ec6ad)){_0x29e4ed[_0x215778]=getOperatorValue(_0x5ec6ad);}else if(_0x53aeec[_0xdd17('0x7')]===_0xdd17('0x8')&&_[_0xdd17('0x9')](_0x5ec6ad)){var _0x4b248f=JSON[_0xdd17('0x1')](_0x5ec6ad);var _0x148e5f={'$gte':moment(moment(_0x4b248f[_0xdd17('0xa')])[_0xdd17('0xb')](_0xdd17('0xc')))[_0xdd17('0xd')]()['format'](),'$lte':moment(moment(_0x4b248f[_0xdd17('0xe')])[_0xdd17('0xb')](_0xdd17('0xc')))[_0xdd17('0xd')]()['subtract'](0x1,'s')[_0xdd17('0xb')]()};_0x29e4ed[_0x215778]=_0x148e5f;}else if(_0x53aeec[_0xdd17('0xf')]===_0xdd17('0x10')){_0x29e4ed[_0x215778]=_0x5ec6ad;}else{_0x29e4ed[_0x215778]=_[_0xdd17('0x11')](_0x5ec6ad)?_0x5ec6ad:JSON[_0xdd17('0x1')](_0x5ec6ad);}}else{_0x29e4ed[_0x215778]=_[_0xdd17('0x11')](_0x5ec6ad)?_0x5ec6ad:JSON['parse'](_0x5ec6ad);}}catch(_0x4b0a0a){_0x29e4ed[_0x215778]=_0x5ec6ad['split'](',');}});}return _0x29e4ed;};exports[_0xdd17('0x12')]=function(_0x358574){_0x358574=parseInt(_0x358574,0xa);if(!_0x358574||_0x358574<0x0){_0x358574=LIMIT_VALUE;}return _0x358574;};exports[_0xdd17('0x13')]=function(_0x1ff4e4){_0x1ff4e4=parseInt(_0x1ff4e4,0xa);if(!_0x1ff4e4||_0x1ff4e4<0x0){_0x1ff4e4=0x0;}return _0x1ff4e4;};exports[_0xdd17('0x14')]=function(_0x1bd3fa){var _0x4c5bb5,_0x34172c=null;if(_0x1bd3fa){_0x4c5bb5=_0x1bd3fa[_0xdd17('0x3')](',');_0x34172c=_['map'](_0x4c5bb5,function(_0x1ce4f0){if(_0x1ce4f0[_0xdd17('0x15')]('-')===0x0){return[_0x1ce4f0===_0xdd17('0x16')?sequelize['cast'](sequelize[_0xdd17('0x17')](_0xdd17('0x16')),_0xdd17('0x18')):_0x1ce4f0[_0xdd17('0x19')](0x1),_0xdd17('0x1a')];}else{return[_0x1ce4f0===_0xdd17('0x16')?sequelize[_0xdd17('0x1b')](sequelize[_0xdd17('0x17')](_0xdd17('0x16')),'unsigned'):_0x1ce4f0,'ASC'];}});}return _0x34172c;};exports[_0xdd17('0x1c')]=function(_0x2382a0,_0x49db9d){if(_['isEmpty'](_0x2382a0)){return _0x2382a0;}if(_['isArray'](_0x2382a0)){for(var _0x1f035b=0x0;_0x1f035b<_0x2382a0[_0xdd17('0x1d')];_0x1f035b+=0x1){_0x2382a0[_0x1f035b]=this[_0xdd17('0x1c')](_0x2382a0[_0x1f035b],_0x49db9d);}return _0x2382a0;}if(!_['isObject'](_0x2382a0)){return _0x2382a0;}if(_[_0xdd17('0x1e')](_0x49db9d)){_0x49db9d=[_0x49db9d];}if(!_['isArray'](_0x49db9d)){return _0x2382a0;}for(var _0x587db9=0x0;_0x587db9<_0x49db9d[_0xdd17('0x1d')];_0x587db9+=0x1){_['unset'](_0x2382a0,_0x49db9d[_0x587db9]);}for(var _0x76bce3 in _0x2382a0){if(_0x2382a0['hasOwnProperty'](_0x76bce3)){_0x2382a0[_0x76bce3]=this[_0xdd17('0x1c')](_0x2382a0[_0x76bce3],_0x49db9d);}}return _0x2382a0;};exports[_0xdd17('0x1f')]=function(_0x3caf44){return _0x3caf44[_0xdd17('0x20')](RegExp(_0xdd17('0x21')))?!![]:![];};exports[_0xdd17('0x22')]=function(_0x254fba){return _0x254fba[_0xdd17('0x20')](/^\S+@\S+$/)?!![]:![];};exports[_0xdd17('0x23')]=function(_0x51e18d){var _0x512add=[];_0x51e18d['split'](/[ ,]+/)[_0xdd17('0x24')](function(_0x1e6ce1){_0x1e6ce1=_0x1e6ce1[_0xdd17('0x25')](/([^:]")"+/g,'$1');_0x1e6ce1='+'+_0x1e6ce1+'*';if(_0x1e6ce1[_0xdd17('0x26')]('@'))_0x1e6ce1='\x22'+_0x1e6ce1+'\x22';_0x512add['push'](_0x1e6ce1);});return _0x512add[_0xdd17('0x27')]('\x20');};exports[_0xdd17('0x28')]=function(_0x39d9f0,_0x226e0b,_0x145e81){var _0x586a62={},_0x41540b={};if(_0x226e0b[_0xdd17('0x29')][_0xdd17('0x2a')]){_0x226e0b['query']['id']=_0x226e0b['query'][_0xdd17('0x2a')];delete _0x226e0b[_0xdd17('0x29')][_0xdd17('0x2a')];}_0x586a62[_0xdd17('0x2b')]=_['map'](_0x39d9f0,_0xdd17('0xf'));_0x586a62[_0xdd17('0x29')]=_[_0xdd17('0x2')](_0x226e0b[_0xdd17('0x29')]);_0x586a62[_0xdd17('0x4')]=_[_0xdd17('0x2c')](_0x586a62[_0xdd17('0x2b')],_0x586a62['query']);_0x41540b[_0xdd17('0x2d')]=_[_0xdd17('0x2c')](_0x586a62[_0xdd17('0x2b')],this[_0xdd17('0x2e')](_0x226e0b['query'][_0xdd17('0x2e')]));_0x41540b[_0xdd17('0x2d')]=_0x41540b[_0xdd17('0x2d')][_0xdd17('0x1d')]?_0x41540b[_0xdd17('0x2d')]:_0x586a62[_0xdd17('0x2b')];if(!_0x226e0b['query'][_0xdd17('0x2f')](_0xdd17('0x30'))){_0x41540b['limit']=this[_0xdd17('0x12')](_0x226e0b[_0xdd17('0x29')]['limit']);_0x41540b['offset']=this[_0xdd17('0x13')](_0x226e0b[_0xdd17('0x29')][_0xdd17('0x13')]);}_0x41540b[_0xdd17('0x31')]=this[_0xdd17('0x14')](_0x226e0b['query'][_0xdd17('0x14')]);_0x41540b[_0xdd17('0x32')]=this[_0xdd17('0x4')](_[_0xdd17('0x33')](_0x226e0b['query'],_0x586a62['filters']),_0x39d9f0);if(_0x226e0b[_0xdd17('0x29')][_0xdd17('0x34')]){_0x41540b['where']=_[_0xdd17('0x35')](_0x41540b[_0xdd17('0x32')],{'$or':_[_0xdd17('0x36')](_0x39d9f0,function(_0x3f6840){if(_0x3f6840[_0xdd17('0x7')]!=='VIRTUAL'){if(_0x145e81){return sequelize['where'](sequelize['fn'](_0xdd17('0x37'),sequelize['col'](_0x3f6840[_0xdd17('0xf')])),{'$like':sequelize['fn'](_0xdd17('0x37'),'%'+_0x226e0b[_0xdd17('0x29')][_0xdd17('0x34')]+'%')});}else{var _0x135e8a={};_0x135e8a[_0x3f6840[_0xdd17('0xf')]]={'$like':'%'+_0x226e0b[_0xdd17('0x29')][_0xdd17('0x34')]+'%'};return _0x135e8a;}}})});}_0x41540b=_['merge']({},_0x41540b,_0x226e0b[_0xdd17('0x38')]);return _0x41540b;}; \ No newline at end of file +var _0x4105=['isNumeric','match','^[+]?[0-9]*$','getFullTextValue','replace','includes','push','getOptions','query','$id','model','attributes','intersection','nolimit','order','filter','where','merge','VIRTUAL','lower','options','lodash','moment','parse','keys','fields','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','format','YYYY-MM-DD','$lte','utc','subtract','name','uniqueid','isArray','limit','offset','sort','map','priority','cast','unsigned','substr','col','ASC','omit','length','isObject','isString','unset','hasOwnProperty'];(function(_0x12ea10,_0x26117c){var _0x20589e=function(_0x2400da){while(--_0x2400da){_0x12ea10['push'](_0x12ea10['shift']());}};_0x20589e(++_0x26117c);}(_0x4105,0xc3));var _0x5410=function(_0x2ef41c,_0x2e5086){_0x2ef41c=_0x2ef41c-0x0;var _0x1998b8=_0x4105[_0x2ef41c];return _0x1998b8;};'use strict';var _=require(_0x5410('0x0'));var sequelize=require('sequelize');var moment=require(_0x5410('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x5efb30){var _0x5c17a1=['ne'];try{var _0x42ef0b=JSON[_0x5410('0x2')](_0x5efb30);var _0x14fcff=Object[_0x5410('0x3')](_0x42ef0b)[0x0];return _0x5c17a1['includes'](_0x14fcff);}catch(_0x4f5f03){return![];}}function getOperatorValue(_0x16cb94){var _0x337950=JSON[_0x5410('0x2')](_0x16cb94);var _0x39c44b=Object[_0x5410('0x3')](_0x337950)[0x0];var _0x516569=_0x337950[_0x39c44b];return{['$'+_0x39c44b]:_0x516569};}exports[_0x5410('0x4')]=function(_0x59cdc9){var _0x3bd208=null;if(_0x59cdc9){_0x3bd208=_0x59cdc9[_0x5410('0x5')](',');}return _0x3bd208;};exports[_0x5410('0x6')]=function(_0x5c5b89,_0x29337e){var _0x22c956={};if(!_[_0x5410('0x7')](_0x5c5b89)){_[_0x5410('0x8')](_0x5c5b89,function(_0x5e6f66,_0x1ea350){try{if(_0x29337e){var _0x54b140=_[_0x5410('0x9')](_0x29337e,{'name':_0x1ea350})||{};if(hasSequelizeOperator(_0x5e6f66)){_0x22c956[_0x1ea350]=getOperatorValue(_0x5e6f66);}else if(_0x54b140[_0x5410('0xa')]===_0x5410('0xb')&&_[_0x5410('0xc')](_0x5e6f66)){var _0x2925b8=JSON[_0x5410('0x2')](_0x5e6f66);var _0x43d599={'$gte':moment(moment(_0x2925b8['$gte'])[_0x5410('0xd')](_0x5410('0xe')))['utc']()[_0x5410('0xd')](),'$lte':moment(moment(_0x2925b8[_0x5410('0xf')])[_0x5410('0xd')](_0x5410('0xe')))[_0x5410('0x10')]()[_0x5410('0x11')](0x1,'s')[_0x5410('0xd')]()};_0x22c956[_0x1ea350]=_0x43d599;}else if(_0x54b140[_0x5410('0x12')]===_0x5410('0x13')){_0x22c956[_0x1ea350]=_0x5e6f66;}else{_0x22c956[_0x1ea350]=_[_0x5410('0x14')](_0x5e6f66)?_0x5e6f66:JSON['parse'](_0x5e6f66);}}else{_0x22c956[_0x1ea350]=_['isArray'](_0x5e6f66)?_0x5e6f66:JSON[_0x5410('0x2')](_0x5e6f66);}}catch(_0x462bfb){_0x22c956[_0x1ea350]=_0x5e6f66['split'](',');}});}return _0x22c956;};exports[_0x5410('0x15')]=function(_0x5bcbd0){_0x5bcbd0=parseInt(_0x5bcbd0,0xa);if(!_0x5bcbd0||_0x5bcbd0<0x0){_0x5bcbd0=LIMIT_VALUE;}return _0x5bcbd0;};exports[_0x5410('0x16')]=function(_0x116135){_0x116135=parseInt(_0x116135,0xa);if(!_0x116135||_0x116135<0x0){_0x116135=0x0;}return _0x116135;};exports[_0x5410('0x17')]=function(_0x4e11e0){var _0x478bea,_0x4097f1=null;if(_0x4e11e0){_0x478bea=_0x4e11e0[_0x5410('0x5')](',');_0x4097f1=_[_0x5410('0x18')](_0x478bea,function(_0x14f8bd){if(_0x14f8bd['indexOf']('-')===0x0){return[_0x14f8bd===_0x5410('0x19')?sequelize[_0x5410('0x1a')](sequelize['col'](_0x5410('0x19')),_0x5410('0x1b')):_0x14f8bd[_0x5410('0x1c')](0x1),'DESC'];}else{return[_0x14f8bd==='priority'?sequelize['cast'](sequelize[_0x5410('0x1d')](_0x5410('0x19')),'unsigned'):_0x14f8bd,_0x5410('0x1e')];}});}return _0x4097f1;};exports[_0x5410('0x1f')]=function(_0x367ce8,_0x145562){if(_[_0x5410('0x7')](_0x367ce8)){return _0x367ce8;}if(_[_0x5410('0x14')](_0x367ce8)){for(var _0xcfe712=0x0;_0xcfe712<_0x367ce8[_0x5410('0x20')];_0xcfe712+=0x1){_0x367ce8[_0xcfe712]=this['omit'](_0x367ce8[_0xcfe712],_0x145562);}return _0x367ce8;}if(!_[_0x5410('0x21')](_0x367ce8)){return _0x367ce8;}if(_[_0x5410('0x22')](_0x145562)){_0x145562=[_0x145562];}if(!_[_0x5410('0x14')](_0x145562)){return _0x367ce8;}for(var _0x374658=0x0;_0x374658<_0x145562[_0x5410('0x20')];_0x374658+=0x1){_[_0x5410('0x23')](_0x367ce8,_0x145562[_0x374658]);}for(var _0x286dca in _0x367ce8){if(_0x367ce8[_0x5410('0x24')](_0x286dca)){_0x367ce8[_0x286dca]=this['omit'](_0x367ce8[_0x286dca],_0x145562);}}return _0x367ce8;};exports[_0x5410('0x25')]=function(_0x465568){return _0x465568[_0x5410('0x26')](RegExp(_0x5410('0x27')))?!![]:![];};exports['isEmail']=function(_0xfb34e6){return _0xfb34e6['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x5410('0x28')]=function(_0x442b4f){var _0x438c52=[];_0x442b4f[_0x5410('0x5')](/[ ,]+/)['forEach'](function(_0x5120c4){_0x5120c4=_0x5120c4[_0x5410('0x29')](/([^:]")"+/g,'$1');_0x5120c4='+'+_0x5120c4+'*';if(_0x5120c4[_0x5410('0x2a')]('@'))_0x5120c4='\x22'+_0x5120c4+'\x22';_0x438c52[_0x5410('0x2b')](_0x5120c4);});return _0x438c52['join']('\x20');};exports[_0x5410('0x2c')]=function(_0x204ed7,_0x4bc1c7,_0x3ca20e){var _0x3bdfa5={},_0x3b1e8c={};if(_0x4bc1c7['query']['$id']){_0x4bc1c7[_0x5410('0x2d')]['id']=_0x4bc1c7['query'][_0x5410('0x2e')];delete _0x4bc1c7[_0x5410('0x2d')][_0x5410('0x2e')];}_0x3bdfa5[_0x5410('0x2f')]=_['map'](_0x204ed7,_0x5410('0x12'));_0x3bdfa5[_0x5410('0x2d')]=_[_0x5410('0x3')](_0x4bc1c7['query']);_0x3bdfa5['filters']=_['intersection'](_0x3bdfa5[_0x5410('0x2f')],_0x3bdfa5['query']);_0x3b1e8c[_0x5410('0x30')]=_[_0x5410('0x31')](_0x3bdfa5['model'],this[_0x5410('0x4')](_0x4bc1c7[_0x5410('0x2d')][_0x5410('0x4')]));_0x3b1e8c['attributes']=_0x3b1e8c['attributes'][_0x5410('0x20')]?_0x3b1e8c[_0x5410('0x30')]:_0x3bdfa5['model'];if(!_0x4bc1c7[_0x5410('0x2d')][_0x5410('0x24')](_0x5410('0x32'))){_0x3b1e8c['limit']=this[_0x5410('0x15')](_0x4bc1c7['query'][_0x5410('0x15')]);_0x3b1e8c[_0x5410('0x16')]=this['offset'](_0x4bc1c7[_0x5410('0x2d')]['offset']);}_0x3b1e8c[_0x5410('0x33')]=this[_0x5410('0x17')](_0x4bc1c7[_0x5410('0x2d')][_0x5410('0x17')]);_0x3b1e8c['where']=this[_0x5410('0x6')](_['pick'](_0x4bc1c7[_0x5410('0x2d')],_0x3bdfa5['filters']),_0x204ed7);if(_0x4bc1c7[_0x5410('0x2d')][_0x5410('0x34')]){_0x3b1e8c[_0x5410('0x35')]=_[_0x5410('0x36')](_0x3b1e8c[_0x5410('0x35')],{'$or':_[_0x5410('0x18')](_0x204ed7,function(_0x150c45){if(_0x150c45[_0x5410('0xa')]!==_0x5410('0x37')){if(_0x3ca20e){return sequelize['where'](sequelize['fn'](_0x5410('0x38'),sequelize[_0x5410('0x1d')](_0x150c45[_0x5410('0x12')])),{'$like':sequelize['fn'](_0x5410('0x38'),'%'+_0x4bc1c7[_0x5410('0x2d')][_0x5410('0x34')]+'%')});}else{var _0x2afab9={};_0x2afab9[_0x150c45[_0x5410('0x12')]]={'$like':'%'+_0x4bc1c7[_0x5410('0x2d')][_0x5410('0x34')]+'%'};return _0x2afab9;}}})});}_0x3b1e8c=_[_0x5410('0x36')]({},_0x3b1e8c,_0x4bc1c7[_0x5410('0x39')]);return _0x3b1e8c;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index cd2786f..2ca37e5 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc850=['set','appPath','join','public','development','test','root','client','use','toISOString','split','static','views','engine','ejs','renderFile','html','urlencoded','50mb','json','initialize','express','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','path','passport','cors','./environment','../mysqldb','default','get','env'];(function(_0x1204dc,_0x47e019){var _0x726b81=function(_0x4dfc9b){while(--_0x4dfc9b){_0x1204dc['push'](_0x1204dc['shift']());}};_0x726b81(++_0x47e019);}(_0xc850,0x10a));var _0x0c85=function(_0x7aeee4,_0x4c888c){_0x7aeee4=_0x7aeee4-0x0;var _0xcebaeb=_0xc850[_0x7aeee4];return _0xcebaeb;};'use strict';var express=require(_0x0c85('0x0'));var favicon=require(_0x0c85('0x1'));var bodyParser=require(_0x0c85('0x2'));var methodOverride=require(_0x0c85('0x3'));var cookieParser=require(_0x0c85('0x4'));var errorHandler=require(_0x0c85('0x5'));var path=require(_0x0c85('0x6'));var passport=require(_0x0c85('0x7'));var cors=require(_0x0c85('0x8'));var moment=require('moment');var config=require(_0x0c85('0x9'));var db=require(_0x0c85('0xa'))['db'];exports[_0x0c85('0xb')]=function(_0x15c8e6){var _0x362cd4=_0x15c8e6[_0x0c85('0xc')](_0x0c85('0xd'));if(_0x362cd4==='production'){_0x15c8e6[_0x0c85('0xe')](_0x0c85('0xf'),path[_0x0c85('0x10')](config['root'],_0x0c85('0x11')));}if(_0x362cd4===_0x0c85('0x12')||_0x362cd4===_0x0c85('0x13')){_0x15c8e6[_0x0c85('0xe')](_0x0c85('0xf'),path[_0x0c85('0x10')](config[_0x0c85('0x14')],_0x0c85('0x15')));_0x15c8e6[_0x0c85('0x16')](errorHandler());}_0x15c8e6['set']('json\x20replacer',function(_0x3476bb,_0x5c41af){if(this[_0x3476bb]instanceof Date){_0x5c41af=this[_0x3476bb][_0x0c85('0x17')]()[_0x0c85('0x18')]('.')[0x0]+'Z';}return _0x5c41af;});_0x15c8e6[_0x0c85('0x16')](express[_0x0c85('0x19')](_0x15c8e6['get'](_0x0c85('0xf'))));_0x15c8e6['set'](_0x0c85('0x1a'),config['root']+'/server/views');_0x15c8e6[_0x0c85('0x1b')]('html',require(_0x0c85('0x1c'))[_0x0c85('0x1d')]);_0x15c8e6[_0x0c85('0xe')]('view\x20engine',_0x0c85('0x1e'));_0x15c8e6[_0x0c85('0x16')](bodyParser[_0x0c85('0x1f')]({'limit':_0x0c85('0x20'),'extended':!![]}));_0x15c8e6[_0x0c85('0x16')](bodyParser[_0x0c85('0x21')]({'limit':_0x0c85('0x20')}));_0x15c8e6[_0x0c85('0x16')](cors());_0x15c8e6[_0x0c85('0x16')](methodOverride());_0x15c8e6[_0x0c85('0x16')](cookieParser());_0x15c8e6[_0x0c85('0x16')](passport[_0x0c85('0x22')]());}; \ No newline at end of file +var _0xf21f=['html','ejs','renderFile','view\x20engine','50mb','json','initialize','express','serve-favicon','body-parser','errorhandler','path','cors','./environment','../mysqldb','get','env','production','set','join','public','development','test','appPath','client','split','use','static','views','root','/server/views','engine'];(function(_0x422a67,_0x42ae28){var _0x2df932=function(_0xfe1cb2){while(--_0xfe1cb2){_0x422a67['push'](_0x422a67['shift']());}};_0x2df932(++_0x42ae28);}(_0xf21f,0x147));var _0xff21=function(_0x573836,_0x599996){_0x573836=_0x573836-0x0;var _0x3d9709=_0xf21f[_0x573836];return _0x3d9709;};'use strict';var express=require(_0xff21('0x0'));var favicon=require(_0xff21('0x1'));var bodyParser=require(_0xff21('0x2'));var methodOverride=require('method-override');var cookieParser=require('cookie-parser');var errorHandler=require(_0xff21('0x3'));var path=require(_0xff21('0x4'));var passport=require('passport');var cors=require(_0xff21('0x5'));var moment=require('moment');var config=require(_0xff21('0x6'));var db=require(_0xff21('0x7'))['db'];exports['default']=function(_0x4ec1ea){var _0x245c0d=_0x4ec1ea[_0xff21('0x8')](_0xff21('0x9'));if(_0x245c0d===_0xff21('0xa')){_0x4ec1ea[_0xff21('0xb')]('appPath',path[_0xff21('0xc')](config['root'],_0xff21('0xd')));}if(_0x245c0d===_0xff21('0xe')||_0x245c0d===_0xff21('0xf')){_0x4ec1ea['set'](_0xff21('0x10'),path['join'](config['root'],_0xff21('0x11')));_0x4ec1ea['use'](errorHandler());}_0x4ec1ea['set']('json\x20replacer',function(_0xab8fb8,_0x2d99fb){if(this[_0xab8fb8]instanceof Date){_0x2d99fb=this[_0xab8fb8]['toISOString']()[_0xff21('0x12')]('.')[0x0]+'Z';}return _0x2d99fb;});_0x4ec1ea[_0xff21('0x13')](express[_0xff21('0x14')](_0x4ec1ea[_0xff21('0x8')](_0xff21('0x10'))));_0x4ec1ea[_0xff21('0xb')](_0xff21('0x15'),config[_0xff21('0x16')]+_0xff21('0x17'));_0x4ec1ea[_0xff21('0x18')](_0xff21('0x19'),require(_0xff21('0x1a'))[_0xff21('0x1b')]);_0x4ec1ea['set'](_0xff21('0x1c'),'html');_0x4ec1ea[_0xff21('0x13')](bodyParser['urlencoded']({'limit':_0xff21('0x1d'),'extended':!![]}));_0x4ec1ea['use'](bodyParser[_0xff21('0x1e')]({'limit':_0xff21('0x1d')}));_0x4ec1ea['use'](cors());_0x4ec1ea[_0xff21('0x13')](methodOverride());_0x4ec1ea[_0xff21('0x13')](cookieParser());_0x4ec1ea[_0xff21('0x13')](passport[_0xff21('0x1f')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index a95d9bd..5b483f1 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 _0xa69a=['ipAddress','createHash','substring','lodash','crypto','bimedia-machine-uuid','child_process','../environment','orderBy','keys','filter','family','internal','concat','head','mac','address','127.0.0.1','map','join','md5','update','digest','hex','getUuid','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress'];(function(_0x30a956,_0x11222e){var _0x2ac17d=function(_0x3be1d2){while(--_0x3be1d2){_0x30a956['push'](_0x30a956['shift']());}};_0x2ac17d(++_0x11222e);}(_0xa69a,0x12c));var _0xaa69=function(_0x59e773,_0x140b7a){_0x59e773=_0x59e773-0x0;var _0x32dd67=_0xa69a[_0x59e773];return _0x32dd67;};'use strict';var _=require(_0xaa69('0x0'));var os=require('os');var crypto=require(_0xaa69('0x1'));var machine=require(_0xaa69('0x2'));var exec=require(_0xaa69('0x3'))['execSync'];var config=require(_0xaa69('0x4'));function getInterfaces(){var _0x438b60=[];var _0x199e35=os['networkInterfaces']();var _0x3da018=_[_0xaa69('0x5')](_[_0xaa69('0x6')](_0x199e35));for(var _0x4e6c25=0x0;_0x4e6c25<_0x3da018['length'];_0x4e6c25++){var _0x1c3849=_0x199e35[_0x3da018[_0x4e6c25]][_0xaa69('0x7')](function(_0x4c5052){return _0x4c5052[_0xaa69('0x8')]==='IPv4'&&_0x4c5052[_0xaa69('0x9')]===![];});_0x438b60=_0x438b60[_0xaa69('0xa')](_0x1c3849);}return _0x438b60;}function getFirstInterface(){var _0x19cf47=_[_0xaa69('0xb')](getInterfaces());return{'macAddress':_0x19cf47&&_0x19cf47[_0xaa69('0xc')]?_0x19cf47[_0xaa69('0xc')]:'00:00:00:00:00:00','ipAddress':_0x19cf47&&_0x19cf47[_0xaa69('0xd')]?_0x19cf47['address']:_0xaa69('0xe')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x283b4c=_[_0xaa69('0x5')](os['cpus']()[_0xaa69('0xf')](function(_0x42324b){return _0x42324b['model'];}))[_0xaa69('0x10')](':');return crypto['createHash'](_0xaa69('0x11'))[_0xaa69('0x12')](_0x283b4c)[_0xaa69('0x13')](_0xaa69('0x14'));}exports[_0xaa69('0x15')]=function(){var _0x2b4cb=os[_0xaa69('0x16')]();var _0x4a0a93=/[0-9a-f-]{36}/;if(config[_0xaa69('0x17')]&&_0x4a0a93['test'](config[_0xaa69('0x17')])){return config[_0xaa69('0x17')];}else if(_0x2b4cb===_0xaa69('0x18')){return exec(_0xaa69('0x19'),{'encoding':_0xaa69('0x1a')})[_0xaa69('0x1b')]('\x0d\x0a','');}else{var _0x146535=getFirstInterface();var _0x3c2cfe=getCPUhash();var _0x362ad4=_0x3c2cfe+'|'+os[_0xaa69('0x1c')]()+'|'+_0x146535[_0xaa69('0x1d')]+'|'+_0x146535[_0xaa69('0x1e')];var _0x242a30=crypto[_0xaa69('0x1f')](_0xaa69('0x11'))[_0xaa69('0x12')](_0x362ad4)[_0xaa69('0x13')](_0xaa69('0x14'));return _0x242a30[_0xaa69('0x20')](0x0,0x8)+'-'+_0x242a30['substring'](0x8,0xc)+'-'+_0x242a30[_0xaa69('0x20')](0xc,0x10)+'-'+_0x242a30['substring'](0x10,0x14)+'-'+_0x242a30['substring'](0x14);}}; \ No newline at end of file +var _0x8ea5=['join','md5','update','digest','hex','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','substring','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','family','internal','concat','head','mac','address','getFirstInterface','cpus','map','model'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8ea5,0x88));var _0x58ea=function(_0x10c50b,_0x5edebd){_0x10c50b=_0x10c50b-0x0;var _0x4c186a=_0x8ea5[_0x10c50b];return _0x4c186a;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x58ea('0x0'));var machine=require(_0x58ea('0x1'));var exec=require(_0x58ea('0x2'))[_0x58ea('0x3')];var config=require(_0x58ea('0x4'));function getInterfaces(){var _0x3d4ab0=[];var _0x1651a6=os[_0x58ea('0x5')]();var _0x595c17=_[_0x58ea('0x6')](_[_0x58ea('0x7')](_0x1651a6));for(var _0x480b81=0x0;_0x480b81<_0x595c17[_0x58ea('0x8')];_0x480b81++){var _0x276903=_0x1651a6[_0x595c17[_0x480b81]]['filter'](function(_0x536ec9){return _0x536ec9[_0x58ea('0x9')]==='IPv4'&&_0x536ec9[_0x58ea('0xa')]===![];});_0x3d4ab0=_0x3d4ab0[_0x58ea('0xb')](_0x276903);}return _0x3d4ab0;}function getFirstInterface(){var _0x21bfaa=_[_0x58ea('0xc')](getInterfaces());return{'macAddress':_0x21bfaa&&_0x21bfaa[_0x58ea('0xd')]?_0x21bfaa[_0x58ea('0xd')]:'00:00:00:00:00:00','ipAddress':_0x21bfaa&&_0x21bfaa['address']?_0x21bfaa[_0x58ea('0xe')]:'127.0.0.1'};}exports[_0x58ea('0xf')]=getFirstInterface;function getCPUhash(){var _0x3db6b3=_[_0x58ea('0x6')](os[_0x58ea('0x10')]()[_0x58ea('0x11')](function(_0x16859a){return _0x16859a[_0x58ea('0x12')];}))[_0x58ea('0x13')](':');return crypto['createHash'](_0x58ea('0x14'))[_0x58ea('0x15')](_0x3db6b3)[_0x58ea('0x16')](_0x58ea('0x17'));}exports['getUuid']=function(){var _0x2bf96d=os['platform']();var _0x5716e5=/[0-9a-f-]{36}/;if(config[_0x58ea('0x18')]&&_0x5716e5[_0x58ea('0x19')](config[_0x58ea('0x18')])){return config[_0x58ea('0x18')];}else if(_0x2bf96d==='win32'){return exec(_0x58ea('0x1a'),{'encoding':_0x58ea('0x1b')})['replace']('\x0d\x0a','');}else{var _0x4417c1=getFirstInterface();var _0x3b8dee=getCPUhash();var _0x2aa086=_0x3b8dee+'|'+os[_0x58ea('0x1c')]()+'|'+_0x4417c1[_0x58ea('0x1d')]+'|'+_0x4417c1['ipAddress'];var _0x86452=crypto['createHash'](_0x58ea('0x14'))[_0x58ea('0x15')](_0x2aa086)[_0x58ea('0x16')](_0x58ea('0x17'));return _0x86452[_0x58ea('0x1e')](0x0,0x8)+'-'+_0x86452['substring'](0x8,0xc)+'-'+_0x86452[_0x58ea('0x1e')](0xc,0x10)+'-'+_0x86452[_0x58ea('0x1e')](0x10,0x14)+'-'+_0x86452[_0x58ea('0x1e')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index b073354..7b651fc 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 _0xde46=['%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','decryptString','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','catch','error','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','license','https://www.xcallymotion.com','format','exports','GET','get','data1','then','active','data2','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','info'];(function(_0x30610a,_0x42156d){var _0x394352=function(_0xadd469){while(--_0xadd469){_0x30610a['push'](_0x30610a['shift']());}};_0x394352(++_0x42156d);}(_0xde46,0x162));var _0x6de4=function(_0xf7c389,_0x57c14e){_0xf7c389=_0xf7c389-0x0;var _0x157e71=_0xde46[_0xf7c389];return _0x157e71;};'use strict';var util=require(_0x6de4('0x0'));var moment=require(_0x6de4('0x1'));var rp=require(_0x6de4('0x2'));var BPromise=require(_0x6de4('0x3'));var pkginfo=require(_0x6de4('0x4'))(module,_0x6de4('0x5'));var db=require(_0x6de4('0x6'))['db'];var encryptor=require(_0x6de4('0x7'));var hardware=require(_0x6de4('0x8'));var logger=require('../logger')(_0x6de4('0x9'));var HOST=_0x6de4('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x16867e){return new BPromise(function(_0xa5108b,_0x4e10fe){var _0x4f5272=util[_0x6de4('0xb')]('%s/api/servers/%s/check?version=%s',HOST,_0x16867e,module[_0x6de4('0xc')][_0x6de4('0x5')]);if(oldToken){_0x4f5272=util[_0x6de4('0xb')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x16867e,module[_0x6de4('0xc')][_0x6de4('0x5')],oldToken);}var _0x3265f9={'uri':_0x4f5272,'method':_0x6de4('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x3265f9)['then'](function(_0x5b647d){_0xa5108b(_0x5b647d);})['catch'](function(_0x1c3f47){_0x4e10fe(_0x1c3f47);});});}function manageLicense(_0x496ba2,_0x2b24ac){var _0x452695=_0x2b24ac[_0x6de4('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x452695['data1']!==_0x496ba2&&!_0x452695['data2']){oldToken=_0x452695[_0x6de4('0xf')];}httpRequest(_0x496ba2)[_0x6de4('0x10')](function(_0x5e8cb8){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5e8cb8[_0x6de4('0x11')]){isOldTokenSent=![];if(!_0x452695[_0x6de4('0x9')]&&_0x452695[_0x6de4('0x9')]!=_0x5e8cb8[_0x6de4('0x9')]||_0x452695[_0x6de4('0x9')]&&_0x452695[_0x6de4('0x12')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x452695['license']&&!_0x452695[_0x6de4('0x12')]&&_0x452695['license']!=_0x5e8cb8[_0x6de4('0x9')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x452695[_0x6de4('0x9')]&&!_0x452695[_0x6de4('0x12')]&&_0x452695[_0x6de4('0x9')]==_0x5e8cb8[_0x6de4('0x9')]){return _0x2b24ac;}return _0x2b24ac[_0x6de4('0x13')]({'data1':_0x496ba2,'data2':null,'license':_0x5e8cb8[_0x6de4('0x9')]});}else{if(_0x5e8cb8[_0x6de4('0x9')]||_0x452695[_0x6de4('0x9')]){if(!_0x452695['data2']){if(_0x452695[_0x6de4('0xf')]==_0x496ba2){GRAY_PERIOD_REASON=_0x6de4('0x14');logger['info'](_0x6de4('0x15'));}else{GRAY_PERIOD_REASON=_0x6de4('0x16');logger[_0x6de4('0x17')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x452695[_0x6de4('0xf')],_0x496ba2);}logger[_0x6de4('0x17')](_0x6de4('0x18'),GRAY_PERIOD_REASON[_0x6de4('0x19')](),moment()[_0x6de4('0xb')](_0x6de4('0x1a')));return _0x2b24ac[_0x6de4('0x13')]({'data2':encryptor[_0x6de4('0x1b')](moment()[_0x6de4('0xb')](_0x6de4('0x1a')))});}else{if(moment()['diff'](encryptor[_0x6de4('0x1c')](_0x452695[_0x6de4('0x12')]),_0x6de4('0x1d'))>DAYS){logger[_0x6de4('0x17')](_0x6de4('0x1e'),moment()[_0x6de4('0xb')](_0x6de4('0x1a')));isOldTokenSent=![];return _0x2b24ac[_0x6de4('0x13')]({'data1':_0x496ba2,'data2':null,'license':null});}}}else{if(_0x452695[_0x6de4('0xf')]!=_0x496ba2){logger['info'](_0x6de4('0x1f'),_0x452695[_0x6de4('0xf')],_0x496ba2);return _0x2b24ac[_0x6de4('0x13')]({'data1':_0x496ba2,'data2':null,'license':null});}}}return _0x2b24ac;})[_0x6de4('0x10')](function(_0x20935d){_0x2b24ac=_0x20935d;})[_0x6de4('0x20')](function(_0x1bab20){logger[_0x6de4('0x21')](_0x1bab20['message']);})[_0x6de4('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0x6de4('0x23')](),_0x2b24ac);},TIME);});}function defaultLicense(){var _0x24d08f=hardware['getUuid']();if(_0x24d08f){return db[_0x6de4('0x24')][_0x6de4('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x24d08f}})[_0x6de4('0x26')](function(_0x1fedef,_0x1c980b){logger[_0x6de4('0x17')](_0x6de4('0x27'),_0x24d08f);manageLicense(_0x24d08f,_0x1fedef);})['catch'](function(_0x3015c9){logger[_0x6de4('0x21')](_0x3015c9[_0x6de4('0x28')]);});}}exports[_0x6de4('0x29')]=defaultLicense; \ No newline at end of file +var _0x9a14=['license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','get','data1','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a14,0xdd));var _0x49a1=function(_0x551802,_0x39e2af){_0x551802=_0x551802-0x0;var _0x37387f=_0x9a14[_0x551802];return _0x37387f;};'use strict';var util=require(_0x49a1('0x0'));var moment=require('moment');var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require(_0x49a1('0x1'))(module,_0x49a1('0x2'));var db=require(_0x49a1('0x3'))['db'];var encryptor=require(_0x49a1('0x4'));var hardware=require(_0x49a1('0x5'));var logger=require(_0x49a1('0x6'))(_0x49a1('0x7'));var HOST=_0x49a1('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x2557ab){return new BPromise(function(_0x5d2337,_0x2c414a){var _0x568491=util[_0x49a1('0x9')](_0x49a1('0xa'),HOST,_0x2557ab,module[_0x49a1('0xb')]['version']);if(oldToken){_0x568491=util['format'](_0x49a1('0xc'),HOST,_0x2557ab,module[_0x49a1('0xb')][_0x49a1('0x2')],oldToken);}var _0x417e03={'uri':_0x568491,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x417e03)[_0x49a1('0xd')](function(_0x24d7e4){_0x5d2337(_0x24d7e4);})[_0x49a1('0xe')](function(_0x1ebcd6){_0x2c414a(_0x1ebcd6);});});}function manageLicense(_0x46810a,_0x3437d3){var _0x21738b=_0x3437d3[_0x49a1('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x21738b[_0x49a1('0x10')]!==_0x46810a&&!_0x21738b['data2']){oldToken=_0x21738b[_0x49a1('0x10')];}httpRequest(_0x46810a)[_0x49a1('0xd')](function(_0x1d8cb3){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1d8cb3[_0x49a1('0x11')]){isOldTokenSent=![];if(!_0x21738b['license']&&_0x21738b[_0x49a1('0x7')]!=_0x1d8cb3[_0x49a1('0x7')]||_0x21738b['license']&&_0x21738b[_0x49a1('0x12')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x21738b[_0x49a1('0x7')]&&!_0x21738b[_0x49a1('0x12')]&&_0x21738b[_0x49a1('0x7')]!=_0x1d8cb3['license']){logger[_0x49a1('0x13')](_0x49a1('0x14'));}if(_0x21738b['license']&&!_0x21738b[_0x49a1('0x12')]&&_0x21738b[_0x49a1('0x7')]==_0x1d8cb3['license']){return _0x3437d3;}return _0x3437d3[_0x49a1('0x15')]({'data1':_0x46810a,'data2':null,'license':_0x1d8cb3[_0x49a1('0x7')]});}else{if(_0x1d8cb3[_0x49a1('0x7')]||_0x21738b[_0x49a1('0x7')]){if(!_0x21738b[_0x49a1('0x12')]){if(_0x21738b[_0x49a1('0x10')]==_0x46810a){GRAY_PERIOD_REASON='Disabled';logger[_0x49a1('0x13')](_0x49a1('0x16'));}else{GRAY_PERIOD_REASON=_0x49a1('0x17');logger[_0x49a1('0x13')](_0x49a1('0x18'),_0x21738b['data1'],_0x46810a);}logger[_0x49a1('0x13')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x49a1('0x19')](),moment()['format'](_0x49a1('0x1a')));return _0x3437d3[_0x49a1('0x15')]({'data2':encryptor[_0x49a1('0x1b')](moment()[_0x49a1('0x9')](_0x49a1('0x1a')))});}else{if(moment()[_0x49a1('0x1c')](encryptor[_0x49a1('0x1d')](_0x21738b[_0x49a1('0x12')]),_0x49a1('0x1e'))>DAYS){logger[_0x49a1('0x13')](_0x49a1('0x1f'),moment()[_0x49a1('0x9')](_0x49a1('0x1a')));isOldTokenSent=![];return _0x3437d3['update']({'data1':_0x46810a,'data2':null,'license':null});}}}else{if(_0x21738b['data1']!=_0x46810a){logger['info'](_0x49a1('0x18'),_0x21738b[_0x49a1('0x10')],_0x46810a);return _0x3437d3[_0x49a1('0x15')]({'data1':_0x46810a,'data2':null,'license':null});}}}return _0x3437d3;})[_0x49a1('0xd')](function(_0x202915){_0x3437d3=_0x202915;})[_0x49a1('0xe')](function(_0x5d7e49){logger[_0x49a1('0x20')](_0x5d7e49['message']);})['finally'](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x3437d3);},TIME);});}function defaultLicense(){var _0x342dc2=hardware[_0x49a1('0x21')]();if(_0x342dc2){return db[_0x49a1('0x22')][_0x49a1('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x342dc2}})[_0x49a1('0x24')](function(_0x5191c7,_0x357752){logger[_0x49a1('0x13')](_0x49a1('0x25'),_0x342dc2);manageLicense(_0x342dc2,_0x5191c7);})[_0x49a1('0xe')](function(_0x19dd15){logger[_0x49a1('0x20')](_0x19dd15['message']);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 932102e..b9c1fa0 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 _0x498f=['COUNT','col','count','admin','user','users','telephones','forEach','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','then','catch','uuid','data1','data2','split','decryptString','format','%s:%s:%s','parse','demo','gray','deadline','add','days','machineUuid','disabled','message','User','role','sequelize'];(function(_0x37566c,_0xa72355){var _0x1f4366=function(_0xfb6d88){while(--_0xfb6d88){_0x37566c['push'](_0x37566c['shift']());}};_0x1f4366(++_0xa72355);}(_0x498f,0x1a3));var _0xf498=function(_0x1253dc,_0x32cc5d){_0x1253dc=_0x1253dc-0x0;var _0x320055=_0x498f[_0x1253dc];return _0x320055;};'use strict';var util=require(_0xf498('0x0'));var _=require(_0xf498('0x1'));var moment=require(_0xf498('0x2'));var BPromise=require('bluebird');var hardware=require(_0xf498('0x3'));var encryptor=require('../../components/encryptor');var db=require(_0xf498('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xf498('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xf498('0x6'),'machineUuid':hardware[_0xf498('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xf498('0x8'),'machineUuid':hardware[_0xf498('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3c0276){return new BPromise(function(_0x13af2a,_0x23eac9){return db[_0xf498('0x9')]['find'](_['defaults'](_0x3c0276,{'raw':!![],'where':{'id':0x1}}))[_0xf498('0xa')](function(_0x2d3553){return checkLicense(_0x2d3553,null);})[_0xf498('0xa')](function(_0x58371c){_0x13af2a(_0x58371c);return;})[_0xf498('0xb')](function(_0x307023){_0x23eac9(_0x307023);});});}function checkLicense(_0x556621,_0x55c7ff){if(!_0x556621){demoLicense[_0xf498('0xc')]=_0x556621[_0xf498('0xd')];return demoLicense;}try{var _0x1630f5=_0x55c7ff||_0x556621['license'];if(_['isEmpty'](_0x1630f5)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x44d6e4=_0x556621[_0xf498('0xd')];var _0x5879b9=_0x556621[_0xf498('0xe')];var _0x3805cc=_0x44d6e4[_0xf498('0xf')]('-')[0x4];var _0x110887=_0x44d6e4['split']('-')[0x0];var _0x59a021=encryptor[_0xf498('0x10')](_0x1630f5,util[_0xf498('0x11')](_0xf498('0x12'),_0x3805cc,_0x44d6e4,_0x110887));var _0x884c32=JSON[_0xf498('0x13')](_0x59a021);_0x884c32[_0xf498('0x14')]=![];_0x884c32['uuid']=_0x44d6e4;_0x884c32['machineUuid']=hardware[_0xf498('0x7')]();if(_0x5879b9){var _0x2b32c7=encryptor['decryptString'](_0x5879b9);_0x884c32[_0xf498('0x15')]=_0x2b32c7;_0x884c32[_0xf498('0x16')]=moment(_0x2b32c7)[_0xf498('0x17')](0x7,_0xf498('0x18'))[_0xf498('0x11')]();_0x884c32['grayReason']=_0x884c32[_0xf498('0xc')]!=_0x884c32[_0xf498('0x19')]?'changed':_0xf498('0x1a');}return _0x884c32;}catch(_0xdb5855){breakingLicense[_0xf498('0xc')]=_0x556621[_0xf498('0xd')];breakingLicense[_0xf498('0x1b')]=_0xdb5855[_0xf498('0x1b')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xcc23a,_0x32fb78){getLicense()['then'](function(_0x248d85){return db[_0xf498('0x1c')]['findAll']({'attributes':[_0xf498('0x1d'),[db[_0xf498('0x1e')]['fn'](_0xf498('0x1f'),db['sequelize'][_0xf498('0x20')](_0xf498('0x1d'))),_0xf498('0x21')]],'group':'role','where':{'role':{'$or':[_0xf498('0x22'),_0xf498('0x23'),'telephone']}},'raw':!![]})[_0xf498('0xa')](function(_0x5b88c0){var _0x244594={'user':_0x248d85[_0xf498('0x24')]||0x0,'telephone':_0x248d85[_0xf498('0x25')]||0x0};_0x5b88c0[_0xf498('0x26')](function(_0x3265b8){var _0x204182=_0x3265b8[_0xf498('0x1d')]==='admin'?'user':_0x3265b8[_0xf498('0x1d')];_0x244594[_0x204182]-=_0x3265b8['count'];if(_0x244594[_0x204182]<0x0)_0x244594[_0x204182]=0x0;});_0xcc23a(_0x244594);return;});})[_0xf498('0xb')](function(_0x31d17d){_0x32fb78(_0x31d17d);});});}function checkUserLimits(_0x17db38){return new BPromise(function(_0x37c3c6,_0xa72569){getLimits()[_0xf498('0xa')](function(_0x68c10f){var _0x3f4149=_[_0xf498('0x27')](_[_0xf498('0x28')](_0x17db38,'role'),[_0xf498('0x22'),_0xf498('0x23'),_0xf498('0x29')]);var _0x208eb6=(_0x3f4149[_0xf498('0x22')]||0x0)+(_0x3f4149[_0xf498('0x23')]||0x0);var _0x82bef8=_0x3f4149[_0xf498('0x29')]||0x0;if(_0x208eb6>_0x68c10f['user'])return _0xa72569(_0xf498('0x2a'));if(_0x82bef8>_0x68c10f[_0xf498('0x29')])return _0xa72569(_0xf498('0x2b'));return _0x37c3c6();})['catch'](function(_0x5c5dab){_0xa72569(_0x5c5dab);});});}module[_0xf498('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x8ee1=['format','parse','machineUuid','getUuid','gray','deadline','add','days','uuid','changed','disabled','message','User','role','col','count','admin','user','users','telephones','pick','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','License','find','then','catch','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','decryptString'];(function(_0x3b50f3,_0x38a154){var _0x2eb4a5=function(_0x380077){while(--_0x380077){_0x3b50f3['push'](_0x3b50f3['shift']());}};_0x2eb4a5(++_0x38a154);}(_0x8ee1,0x1bd));var _0x18ee=function(_0x51674a,_0x77ccff){_0x51674a=_0x51674a-0x0;var _0x13fca6=_0x8ee1[_0x51674a];return _0x13fca6;};'use strict';var util=require(_0x18ee('0x0'));var _=require('lodash');var moment=require('moment');var BPromise=require(_0x18ee('0x1'));var hardware=require(_0x18ee('0x2'));var encryptor=require(_0x18ee('0x3'));var db=require(_0x18ee('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x18ee('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x186f73){return new BPromise(function(_0xec0771,_0x17acc5){return db[_0x18ee('0x6')][_0x18ee('0x7')](_['defaults'](_0x186f73,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0xc88e78){return checkLicense(_0xc88e78,null);})[_0x18ee('0x8')](function(_0x121803){_0xec0771(_0x121803);return;})[_0x18ee('0x9')](function(_0x2d7853){_0x17acc5(_0x2d7853);});});}function checkLicense(_0x5984c4,_0x53e125){if(!_0x5984c4){demoLicense['uuid']=_0x5984c4['data1'];return demoLicense;}try{var _0xe15026=_0x53e125||_0x5984c4[_0x18ee('0xa')];if(_[_0x18ee('0xb')](_0xe15026)){throw new Error(_0x18ee('0xc'));}var _0x54a31d=_0x5984c4[_0x18ee('0xd')];var _0x44a073=_0x5984c4[_0x18ee('0xe')];var _0x58b010=_0x54a31d[_0x18ee('0xf')]('-')[0x4];var _0x513fac=_0x54a31d['split']('-')[0x0];var _0x593277=encryptor[_0x18ee('0x10')](_0xe15026,util[_0x18ee('0x11')]('%s:%s:%s',_0x58b010,_0x54a31d,_0x513fac));var _0x1abd7a=JSON[_0x18ee('0x12')](_0x593277);_0x1abd7a['demo']=![];_0x1abd7a['uuid']=_0x54a31d;_0x1abd7a[_0x18ee('0x13')]=hardware[_0x18ee('0x14')]();if(_0x44a073){var _0x224f3c=encryptor[_0x18ee('0x10')](_0x44a073);_0x1abd7a[_0x18ee('0x15')]=_0x224f3c;_0x1abd7a[_0x18ee('0x16')]=moment(_0x224f3c)[_0x18ee('0x17')](0x7,_0x18ee('0x18'))[_0x18ee('0x11')]();_0x1abd7a['grayReason']=_0x1abd7a[_0x18ee('0x19')]!=_0x1abd7a[_0x18ee('0x13')]?_0x18ee('0x1a'):_0x18ee('0x1b');}return _0x1abd7a;}catch(_0x38f3b9){breakingLicense[_0x18ee('0x19')]=_0x5984c4[_0x18ee('0xd')];breakingLicense[_0x18ee('0x1c')]=_0x38f3b9['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4715a9,_0xddfd11){getLicense()[_0x18ee('0x8')](function(_0x46028f){return db[_0x18ee('0x1d')]['findAll']({'attributes':[_0x18ee('0x1e'),[db['sequelize']['fn']('COUNT',db['sequelize'][_0x18ee('0x1f')](_0x18ee('0x1e'))),_0x18ee('0x20')]],'group':_0x18ee('0x1e'),'where':{'role':{'$or':[_0x18ee('0x21'),_0x18ee('0x22'),'telephone']}},'raw':!![]})[_0x18ee('0x8')](function(_0x1e66d0){var _0x4bcbd8={'user':_0x46028f[_0x18ee('0x23')]||0x0,'telephone':_0x46028f[_0x18ee('0x24')]||0x0};_0x1e66d0['forEach'](function(_0x59c301){var _0x4c602b=_0x59c301['role']==='admin'?_0x18ee('0x22'):_0x59c301[_0x18ee('0x1e')];_0x4bcbd8[_0x4c602b]-=_0x59c301[_0x18ee('0x20')];if(_0x4bcbd8[_0x4c602b]<0x0)_0x4bcbd8[_0x4c602b]=0x0;});_0x4715a9(_0x4bcbd8);return;});})['catch'](function(_0x3a26f6){_0xddfd11(_0x3a26f6);});});}function checkUserLimits(_0x1edaab){return new BPromise(function(_0x2b4299,_0x49d626){getLimits()[_0x18ee('0x8')](function(_0x5385d1){var _0x46fdf0=_[_0x18ee('0x25')](_['countBy'](_0x1edaab,_0x18ee('0x1e')),[_0x18ee('0x21'),_0x18ee('0x22'),_0x18ee('0x26')]);var _0x496951=(_0x46fdf0[_0x18ee('0x21')]||0x0)+(_0x46fdf0[_0x18ee('0x22')]||0x0);var _0xd6a2cc=_0x46fdf0[_0x18ee('0x26')]||0x0;if(_0x496951>_0x5385d1['user'])return _0x49d626(_0x18ee('0x27'));if(_0xd6a2cc>_0x5385d1[_0x18ee('0x26')])return _0x49d626(_0x18ee('0x28'));return _0x2b4299();})[_0x18ee('0x9')](function(_0x5bea6e){_0x49d626(_0x5bea6e);});});}module[_0x18ee('0x29')]={'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 ec82150..1e8d1db 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 _0x236c=['secret','exports','myappanuglar-secret','app-id'];(function(_0x1c34e7,_0x33f9a8){var _0x378cb1=function(_0x10b5e3){while(--_0x10b5e3){_0x1c34e7['push'](_0x1c34e7['shift']());}};_0x378cb1(++_0x33f9a8);}(_0x236c,0x155));var _0xc236=function(_0x1aa802,_0x1d5d82){_0x1aa802=_0x1aa802-0x0;var _0x26bd36=_0x236c[_0x1aa802];return _0x26bd36;};'use strict';module[_0xc236('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xc236('0x1'),'GOOGLE_ID':_0xc236('0x2'),'GOOGLE_SECRET':_0xc236('0x3'),'DEBUG':''}; \ No newline at end of file +var _0xe2cf=['app-id','http://localhost:9000'];(function(_0x104a84,_0x285970){var _0x4973ff=function(_0x5064e7){while(--_0x5064e7){_0x104a84['push'](_0x104a84['shift']());}};_0x4973ff(++_0x285970);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x2af504,_0x46a924){_0x2af504=_0x2af504-0x0;var _0x2abb2e=_0xe2cf[_0x2af504];return _0x2abb2e;};'use strict';module['exports']={'DOMAIN':_0xfe2c('0x0'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xfe2c('0x1'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 92b09d1..0d51f17 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0aa4=['exports','transports','File','%s-%s','error','info','Console','debugLevel','moment','join','/var','log','xcally','%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase'];(function(_0x79b47f,_0x21b7da){var _0x5ab625=function(_0x10888f){while(--_0x10888f){_0x79b47f['push'](_0x79b47f['shift']());}};_0x5ab625(++_0x21b7da);}(_0x0aa4,0x13c));var _0x40aa=function(_0x472cfc,_0x4ec9f3){_0x472cfc=_0x472cfc-0x0;var _0x3ba7cb=_0x0aa4[_0x472cfc];return _0x3ba7cb;};'use strict';var moment=require(_0x40aa('0x0'));var winston=require('winston');var util=require('util');var path=require('path');var debugLevel='INFO';function filename(_0x4232f9,_0x2d22b8){return path[_0x40aa('0x1')](_0x40aa('0x2'),_0x40aa('0x3'),_0x40aa('0x4'),util['format'](_0x40aa('0x5'),_0x4232f9,_0x2d22b8));}function formatter(_0x554996,_0x10b4a3){_0x10b4a3[_0x40aa('0x6')]=_0x10b4a3[_0x40aa('0x6')][_0x40aa('0x7')](/@@{/g,'{{{')[_0x40aa('0x7')](/}@@/g,_0x40aa('0x8'))[_0x40aa('0x7')](/@{/g,'{{')[_0x40aa('0x7')](/}@/g,'}}');return util['format'](_0x40aa('0x9'),moment()[_0x40aa('0xa')](_0x40aa('0xb')),_0x10b4a3[_0x40aa('0xc')][_0x40aa('0xd')](),_0x554996,_0x10b4a3[_0x40aa('0x6')]);}module[_0x40aa('0xe')]=function(_0x528f1c){return new winston['Logger']({'transports':[new winston[(_0x40aa('0xf'))][(_0x40aa('0x10'))]({'name':util['format'](_0x40aa('0x11'),_0x528f1c,'error'),'filename':filename(_0x528f1c,_0x40aa('0x12')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3ad0a7){return formatter(_0x528f1c,_0x3ad0a7);}}),new winston[(_0x40aa('0xf'))][(_0x40aa('0x10'))]({'name':util[_0x40aa('0xa')](_0x40aa('0x11'),_0x528f1c,'info'),'filename':filename(_0x528f1c,_0x40aa('0x13')),'level':_0x40aa('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3a4cc5){return formatter(_0x528f1c,_0x3a4cc5);}}),new winston[(_0x40aa('0xf'))][(_0x40aa('0x14'))]({'level':process['env'][_0x40aa('0x15')]||debugLevel,'json':![],'formatter':function(_0x2f1171){return formatter(_0x528f1c,_0x2f1171);}})]});}; \ No newline at end of file +var _0x47f3=['env','debugLevel','moment','winston','INFO','join','log','xcally','format','%s-%s.log','message','replace','{{{','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','transports','File','error','info'];(function(_0x45b275,_0x19500a){var _0x3f5781=function(_0x2d4bc5){while(--_0x2d4bc5){_0x45b275['push'](_0x45b275['shift']());}};_0x3f5781(++_0x19500a);}(_0x47f3,0x13d));var _0x347f=function(_0x5986bc,_0x54e5f7){_0x5986bc=_0x5986bc-0x0;var _0x48d058=_0x47f3[_0x5986bc];return _0x48d058;};'use strict';var moment=require(_0x347f('0x0'));var winston=require(_0x347f('0x1'));var util=require('util');var path=require('path');var debugLevel=_0x347f('0x2');function filename(_0x58222c,_0x266b2d){return path[_0x347f('0x3')]('/var',_0x347f('0x4'),_0x347f('0x5'),util[_0x347f('0x6')](_0x347f('0x7'),_0x58222c,_0x266b2d));}function formatter(_0x1e56c0,_0x119a89){_0x119a89[_0x347f('0x8')]=_0x119a89[_0x347f('0x8')][_0x347f('0x9')](/@@{/g,_0x347f('0xa'))['replace'](/}@@/g,'}}}')[_0x347f('0x9')](/@{/g,'{{')[_0x347f('0x9')](/}@/g,'}}');return util[_0x347f('0x6')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x347f('0x6')](_0x347f('0xb')),_0x119a89[_0x347f('0xc')][_0x347f('0xd')](),_0x1e56c0,_0x119a89[_0x347f('0x8')]);}module[_0x347f('0xe')]=function(_0x3bcabb){return new winston['Logger']({'transports':[new winston[(_0x347f('0xf'))][(_0x347f('0x10'))]({'name':util['format']('%s-%s',_0x3bcabb,_0x347f('0x11')),'filename':filename(_0x3bcabb,'error'),'level':_0x347f('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5b5e09){return formatter(_0x3bcabb,_0x5b5e09);}}),new winston[(_0x347f('0xf'))]['File']({'name':util[_0x347f('0x6')]('%s-%s',_0x3bcabb,'info'),'filename':filename(_0x3bcabb,_0x347f('0x12')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x29baaf){return formatter(_0x3bcabb,_0x29baaf);}}),new winston[(_0x347f('0xf'))]['Console']({'level':process[_0x347f('0x13')][_0x347f('0x14')]||debugLevel,'json':![],'formatter':function(_0x4d4861){return formatter(_0x3bcabb,_0x4d4861);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index b7c6831..9bc3a06 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 _0x8e07=['email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi'];(function(_0x3baeee,_0x470398){var _0x40920b=function(_0x2cb336){while(--_0x2cb336){_0x3baeee['push'](_0x3baeee['shift']());}};_0x40920b(++_0x470398);}(_0x8e07,0xcb));var _0x78e0=function(_0x21e2e8,_0x580b5c){_0x21e2e8=_0x21e2e8-0x0;var _0xfe58e1=_0x8e07[_0x21e2e8];return _0xfe58e1;};'use strict';var path=require(_0x78e0('0x0'));var os=require('os');var config={'apps':[{'name':_0x78e0('0x1'),'script':path[_0x78e0('0x2')](__dirname,_0x78e0('0x3'))},{'name':_0x78e0('0x4'),'script':path[_0x78e0('0x2')](__dirname,_0x78e0('0x5'))},{'name':_0x78e0('0x6'),'script':path[_0x78e0('0x2')](__dirname,'../../services/agi/index.js')},{'name':_0x78e0('0x7'),'script':path['join'](__dirname,_0x78e0('0x8'))},{'name':_0x78e0('0x9'),'script':path[_0x78e0('0x2')](__dirname,_0x78e0('0xa'))},{'name':_0x78e0('0xb'),'script':path[_0x78e0('0x2')](__dirname,_0x78e0('0xc'))}]};module[_0x78e0('0xd')]=config; \ No newline at end of file +var _0xee4e=['express','join','../../services/express/index.js','ami','email','../../services/email/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js','exports','path'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xee4e,0x1ac));var _0xeee4=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xee4e[_0x376b45];return _0x2341b3;};'use strict';var path=require(_0xeee4('0x0'));var os=require('os');var config={'apps':[{'name':_0xeee4('0x1'),'script':path[_0xeee4('0x2')](__dirname,_0xeee4('0x3'))},{'name':_0xeee4('0x4'),'script':path[_0xeee4('0x2')](__dirname,'../../services/ami/index.js')},{'name':'agi','script':path['join'](__dirname,'../../services/agi/index.js')},{'name':_0xeee4('0x5'),'script':path['join'](__dirname,_0xeee4('0x6'))},{'name':_0xeee4('0x7'),'script':path['join'](__dirname,_0xeee4('0x8'))},{'name':'xdr','script':path[_0xeee4('0x2')](__dirname,_0xeee4('0x9'))}]};module[_0xeee4('0xa')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index fbedd51..32c84eb 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 _0xd11f=['disconnect','stop','restart','list','describe','delete','dump','bluebird','./config','connected','start','then'];(function(_0x20e2c3,_0x5be903){var _0x4d2377=function(_0xd4fbcf){while(--_0xd4fbcf){_0x20e2c3['push'](_0x20e2c3['shift']());}};_0x4d2377(++_0x5be903);}(_0xd11f,0x73));var _0xfd11=function(_0x41cfd4,_0x1ed2cc){_0x41cfd4=_0x41cfd4-0x0;var _0x190f48=_0xd11f[_0x41cfd4];return _0x190f48;};'use strict';var pm2=require('pm2');var BPromise=require(_0xfd11('0x0'));var config=require(_0xfd11('0x1'));function connect(){return new BPromise(function(_0x5d3433,_0x42c121){return pm2['connect'](function(_0x1c8393){if(_0x1c8393){return _0x42c121(_0x1c8393);}return _0x5d3433(_0xfd11('0x2'));});});};exports[_0xfd11('0x3')]=function(_0x4fa0dd){return connect()[_0xfd11('0x4')](function(){return new BPromise(function(_0x292b6f,_0x4700ba){return pm2[_0xfd11('0x3')](_0x4fa0dd,function(_0x2f5ac5,_0x526076){if(_0x2f5ac5){return _0x4700ba(_0x2f5ac5);}pm2[_0xfd11('0x5')]();return _0x292b6f(_0x526076);});});});};exports[_0xfd11('0x6')]=function(_0x4c22e2){return connect()['then'](function(){return new BPromise(function(_0xc832f9,_0x777505){return pm2['stop'](_0x4c22e2,function(_0x176eac,_0x35b6b0){if(_0x176eac){return _0x777505(_0x176eac);}pm2[_0xfd11('0x5')]();return _0xc832f9(_0x35b6b0);});});});};exports[_0xfd11('0x7')]=function(_0x343e2b){return connect()['then'](function(){return new BPromise(function(_0x42da92,_0xe696d9){return pm2[_0xfd11('0x7')](_0x343e2b,function(_0x2ae713,_0x1e4286){if(_0x2ae713){return _0xe696d9(_0x2ae713);}pm2['disconnect']();return _0x42da92(_0x1e4286);});});});};exports['list']=function(){return connect()['then'](function(){return new BPromise(function(_0x3113c4,_0xa90d39){return pm2[_0xfd11('0x8')](function(_0x4df384,_0x16ff54){if(_0x4df384){return _0xa90d39(_0x4df384);}pm2['disconnect']();return _0x3113c4(_0x16ff54);});});});};exports['describe']=function(_0x109630){return connect()[_0xfd11('0x4')](function(){return new BPromise(function(_0x1335cc,_0x12d893){return pm2[_0xfd11('0x9')](_0x109630,function(_0x1b9fac,_0x5a131d){if(_0x1b9fac){return _0x12d893(_0x1b9fac);}pm2[_0xfd11('0x5')]();return _0x1335cc(_0x5a131d);});});});};exports['delete']=function(_0x464904){return connect()[_0xfd11('0x4')](function(){return new BPromise(function(_0x5490cd,_0x55974d){return pm2[_0xfd11('0xa')](_0x464904,function(_0x479410,_0x21dc0a){if(_0x479410){return _0x55974d(_0x479410);}pm2[_0xfd11('0x5')]();return _0x5490cd(_0x21dc0a);});});});};exports[_0xfd11('0xb')]=function(){return connect()[_0xfd11('0x4')](function(){return new BPromise(function(_0x4e8413,_0xc34be5){return pm2[_0xfd11('0xb')](function(_0x7dc16a){if(_0x7dc16a){return _0xc34be5(_0x7dc16a);}return _0x4e8413('saved');});});});}; \ No newline at end of file +var _0x4d0d=['pm2','bluebird','./config','connected','start','then','stop','disconnect','restart','list','describe','delete','dump'];(function(_0x39ac73,_0x3194c8){var _0x49ea65=function(_0x2ebb20){while(--_0x2ebb20){_0x39ac73['push'](_0x39ac73['shift']());}};_0x49ea65(++_0x3194c8);}(_0x4d0d,0xd0));var _0xd4d0=function(_0x142c59,_0x42acaf){_0x142c59=_0x142c59-0x0;var _0x32d3a0=_0x4d0d[_0x142c59];return _0x32d3a0;};'use strict';var pm2=require(_0xd4d0('0x0'));var BPromise=require(_0xd4d0('0x1'));var config=require(_0xd4d0('0x2'));function connect(){return new BPromise(function(_0x54d176,_0x5575e7){return pm2['connect'](function(_0x292fcb){if(_0x292fcb){return _0x5575e7(_0x292fcb);}return _0x54d176(_0xd4d0('0x3'));});});};exports[_0xd4d0('0x4')]=function(_0x4ef7a6){return connect()[_0xd4d0('0x5')](function(){return new BPromise(function(_0x38e626,_0xbf2ea4){return pm2[_0xd4d0('0x4')](_0x4ef7a6,function(_0x3a11ad,_0x4124b4){if(_0x3a11ad){return _0xbf2ea4(_0x3a11ad);}pm2['disconnect']();return _0x38e626(_0x4124b4);});});});};exports[_0xd4d0('0x6')]=function(_0x3c996e){return connect()['then'](function(){return new BPromise(function(_0x146211,_0x2b56fd){return pm2[_0xd4d0('0x6')](_0x3c996e,function(_0x43b3aa,_0x84c01f){if(_0x43b3aa){return _0x2b56fd(_0x43b3aa);}pm2[_0xd4d0('0x7')]();return _0x146211(_0x84c01f);});});});};exports['restart']=function(_0x2e978e){return connect()['then'](function(){return new BPromise(function(_0x523a71,_0x141d97){return pm2[_0xd4d0('0x8')](_0x2e978e,function(_0x10638c,_0x2ddb4f){if(_0x10638c){return _0x141d97(_0x10638c);}pm2[_0xd4d0('0x7')]();return _0x523a71(_0x2ddb4f);});});});};exports[_0xd4d0('0x9')]=function(){return connect()[_0xd4d0('0x5')](function(){return new BPromise(function(_0x4ea630,_0x5efbc5){return pm2['list'](function(_0x32367f,_0x47959b){if(_0x32367f){return _0x5efbc5(_0x32367f);}pm2[_0xd4d0('0x7')]();return _0x4ea630(_0x47959b);});});});};exports['describe']=function(_0x511339){return connect()['then'](function(){return new BPromise(function(_0x1fe0a2,_0x28cef8){return pm2[_0xd4d0('0xa')](_0x511339,function(_0x4e7040,_0x29664f){if(_0x4e7040){return _0x28cef8(_0x4e7040);}pm2['disconnect']();return _0x1fe0a2(_0x29664f);});});});};exports[_0xd4d0('0xb')]=function(_0x112d94){return connect()[_0xd4d0('0x5')](function(){return new BPromise(function(_0x14aa36,_0x52d3b2){return pm2[_0xd4d0('0xb')](_0x112d94,function(_0x5447a2,_0x4594b2){if(_0x5447a2){return _0x52d3b2(_0x5447a2);}pm2['disconnect']();return _0x14aa36(_0x4594b2);});});});};exports[_0xd4d0('0xc')]=function(){return connect()[_0xd4d0('0x5')](function(){return new BPromise(function(_0x3ea371,_0x84e307){return pm2[_0xd4d0('0xc')](function(_0x3aa79b){if(_0x3aa79b){return _0x84e307(_0x3aa79b);}return _0x3ea371('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 97abe15..cb74177 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 _0x4ece=['emit','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../config/environment','../logger','redis','defaults','localhost','Setting','find','chatTimeout','then','findAll','lastMsgAt','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','timeout','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:'];(function(_0x4d8cdf,_0x598a82){var _0x1c2026=function(_0x1460ec){while(--_0x1460ec){_0x4d8cdf['push'](_0x4d8cdf['shift']());}};_0x1c2026(++_0x598a82);}(_0x4ece,0xc8));var _0xe4ec=function(_0x3d3896,_0x3aa0b4){_0x3d3896=_0x3d3896-0x0;var _0x1f7db6=_0x4ece[_0x3d3896];return _0x1f7db6;};'use strict';var _=require(_0xe4ec('0x0'));var moment=require(_0xe4ec('0x1'));var Redis=require(_0xe4ec('0x2'));var util=require(_0xe4ec('0x3'));var config=require(_0xe4ec('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0xe4ec('0x5'))('schedule');config[_0xe4ec('0x6')]=_[_0xe4ec('0x7')](config['redis'],{'host':_0xe4ec('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe4ec('0x6')]));function closeInteractions(){var _0x3ae727=0x0;var _0x29c80c=[];return db[_0xe4ec('0x9')][_0xe4ec('0xa')]({'raw':!![],'attributes':['id',_0xe4ec('0xb')],'where':{'id':0x1}})[_0xe4ec('0xc')](function(_0x1b360a){_0x3ae727=_0x1b360a[_0xe4ec('0xb')];if(_0x3ae727){return db['ChatInteraction'][_0xe4ec('0xd')]({'raw':!![],'attributes':['id',_0xe4ec('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x1b360a[_0xe4ec('0xb')],'minutes')}}});}else{return[];}})[_0xe4ec('0xc')](function(_0x22be02){if(_0x22be02&&_0x22be02[_0xe4ec('0xf')]){_0x29c80c=_['map'](_0x22be02||[],'id');logger[_0xe4ec('0x10')](_0xe4ec('0x11'),_0x29c80c[_0xe4ec('0x12')]());return db[_0xe4ec('0x13')][_0xe4ec('0x14')]({'closeReason':'system','disposition':_0xe4ec('0x15'),'closed':!![],'closedAt':moment()['format'](_0xe4ec('0x16'))},{'where':{'id':_0x29c80c}});}})[_0xe4ec('0xc')](function(){if(_0x29c80c&&_0x29c80c['length']){logger['info'](_0xe4ec('0x17'),_0x29c80c[_0xe4ec('0x12')]());for(var _0x4ef04d=0x0;_0x4ef04d<_0x29c80c[_0xe4ec('0xf')];_0x4ef04d++){io[_0xe4ec('0x18')]('chatInteraction:update',{'id':_0x29c80c[_0x4ef04d],'closed':!![]});}}})['catch'](function(_0x5d855d){logger[_0xe4ec('0x19')](_0xe4ec('0x1a'),_0x5d855d?util[_0xe4ec('0x1b')](_0x5d855d,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x725f=['timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','moment','ioredis','util','../../mysqldb','schedule','defaults','redis','localhost','socket.io-emitter','Setting','chatTimeout','findAll','lastMsgAt','subtract','minutes','then','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','system'];(function(_0x37f32e,_0x216a0a){var _0x4c651d=function(_0x31f90b){while(--_0x31f90b){_0x37f32e['push'](_0x37f32e['shift']());}};_0x4c651d(++_0x216a0a);}(_0x725f,0x1e6));var _0xf725=function(_0x471e4c,_0x1400ce){_0x471e4c=_0x471e4c-0x0;var _0x1b8136=_0x725f[_0x471e4c];return _0x1b8136;};'use strict';var _=require('lodash');var moment=require(_0xf725('0x0'));var Redis=require(_0xf725('0x1'));var util=require(_0xf725('0x2'));var config=require('../../config/environment');var db=require(_0xf725('0x3'))['db'];var logger=require('../logger')(_0xf725('0x4'));config['redis']=_[_0xf725('0x5')](config[_0xf725('0x6')],{'host':_0xf725('0x7'),'port':0x18eb});var io=require(_0xf725('0x8'))(new Redis(config[_0xf725('0x6')]));function closeInteractions(){var _0x4b4902=0x0;var _0x315c54=[];return db[_0xf725('0x9')]['find']({'raw':!![],'attributes':['id',_0xf725('0xa')],'where':{'id':0x1}})['then'](function(_0x447820){_0x4b4902=_0x447820[_0xf725('0xa')];if(_0x4b4902){return db['ChatInteraction'][_0xf725('0xb')]({'raw':!![],'attributes':['id',_0xf725('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xf725('0xd')](_0x447820['chatTimeout'],_0xf725('0xe'))}}});}else{return[];}})[_0xf725('0xf')](function(_0x22479b){if(_0x22479b&&_0x22479b[_0xf725('0x10')]){_0x315c54=_[_0xf725('0x11')](_0x22479b||[],'id');logger[_0xf725('0x12')](_0xf725('0x13'),_0x315c54[_0xf725('0x14')]());return db[_0xf725('0x15')][_0xf725('0x16')]({'closeReason':_0xf725('0x17'),'disposition':_0xf725('0x18'),'closed':!![],'closedAt':moment()[_0xf725('0x19')](_0xf725('0x1a'))},{'where':{'id':_0x315c54}});}})[_0xf725('0xf')](function(){if(_0x315c54&&_0x315c54[_0xf725('0x10')]){logger[_0xf725('0x12')](_0xf725('0x1b'),_0x315c54[_0xf725('0x14')]());for(var _0x1a2b6d=0x0;_0x1a2b6d<_0x315c54[_0xf725('0x10')];_0x1a2b6d++){io[_0xf725('0x1c')](_0xf725('0x1d'),{'id':_0x315c54[_0x1a2b6d],'closed':!![]});}}})[_0xf725('0x1e')](function(_0x23b615){logger[_0xf725('0x1f')](_0xf725('0x20'),_0x23b615?util['inspect'](_0x23b615,{'showHidden':![],'depth':null}):'');});}exports[_0xf725('0x21')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index de5f755..71b7bd4 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 _0x012a=['map','toString','difference','length','exists','stop','delete\x20cron','my\x20id','resolve','run\x20job','cron','active','isBetween','endAt','add','start','add\x20cron','stop\x20cron','startAt','update','run','util','path','moment','cron-job-manager','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','../../files/reports','savename','extname','join','existsSync','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','stringify','catch','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs'];(function(_0x535087,_0x177a81){var _0x4b2abd=function(_0x51136c){while(--_0x51136c){_0x535087['push'](_0x535087['shift']());}};_0x4b2abd(++_0x177a81);}(_0x012a,0x11a));var _0xa012=function(_0x17d2b9,_0x1a25a4){_0x17d2b9=_0x17d2b9-0x0;var _0x5d89db=_0x012a[_0x17d2b9];return _0x5d89db;};'use strict';var fs=require('fs');var util=require(_0xa012('0x0'));var path=require(_0xa012('0x1'));var _=require('lodash');var moment=require(_0xa012('0x2'));var CronJobManager=require(_0xa012('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0xa012('0x4'));var logger=require(_0xa012('0x5'))(_0xa012('0x6'));var db=require(_0xa012('0x7'))['db'];var analyticCustomReportController=require(_0xa012('0x8'));var analyticDefaultReportController=require(_0xa012('0x9'));var client=jayson['client']['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xf07581,_0x4fa0c4){return function(){logger[_0xa012('0xa')](_0xa012('0xb'),_0xf07581[_0xa012('0xc')]);var _0x15d53c=!![];var _0x298687={'tls':{'rejectUnauthorized':![]}};if(_0xf07581[_0xa012('0xd')][_0xa012('0xe')][_0xa012('0xf')]){_0x298687[_0xa012('0xf')]=_0xf07581[_0xa012('0xd')]['Smtp'][_0xa012('0xf')];}else{_0x298687[_0xa012('0x10')]=_0xf07581['MailAccount'][_0xa012('0xe')][_0xa012('0x10')];_0x298687['port']=_0xf07581[_0xa012('0xd')][_0xa012('0xe')][_0xa012('0x11')];_0x298687[_0xa012('0x12')]=_0xf07581['MailAccount']['Smtp'][_0xa012('0x12')];}if(_0xf07581[_0xa012('0xd')][_0xa012('0xe')][_0xa012('0x13')]){_0x298687[_0xa012('0x14')]={'user':_0xf07581[_0xa012('0xd')]['Smtp'][_0xa012('0x15')],'pass':_0xf07581[_0xa012('0xd')][_0xa012('0xe')][_0xa012('0x16')]};}var _0xd3418c={'account':_0x298687,'message':{'from':util[_0xa012('0x17')]('\x22%s\x22\x20<%s>',_0xf07581[_0xa012('0xd')][_0xa012('0x18')],_0xf07581[_0xa012('0xd')][_0xa012('0xc')]||_0xf07581[_0xa012('0xd')]['Smtp']['user']),'to':_0xf07581['email'],'cc':_0xf07581['cc'],'bcc':_0xf07581[_0xa012('0x19')],'subject':util[_0xa012('0x17')](_0xa012('0x1a'),_0x4fa0c4['name'],_0xf07581['subtractNumber'],_0xf07581[_0xa012('0x1b')])}};var _0x5a8e24=path['join'](__dirname,_0xa012('0x1c'));var _0x9d54e0=_0x4fa0c4['savename'];var _0x4c7a06=util['format']('%s.%s',path['basename'](_0x4fa0c4[_0xa012('0x1d')],path[_0xa012('0x1e')](_0x4fa0c4[_0xa012('0x1d')])),'zip');var _0x514e4e=path[_0xa012('0x1f')](_0x5a8e24,_0x9d54e0);var _0x48b890=path['join'](_0x5a8e24,_0x4c7a06);if(fs[_0xa012('0x20')](_0x514e4e)){_0x4fa0c4[_0xa012('0x21')]=_0xa012('0x22');_0xd3418c[_0xa012('0x23')]['attachments']=[{'filename':_0x9d54e0,'path':_0x514e4e}];_0xd3418c['message'][_0xa012('0x24')]=util[_0xa012('0x17')](_0xa012('0x25'),JSON['stringify'](_0x4fa0c4,null,0x2));}else if(fs[_0xa012('0x20')](_0x48b890)){_0x4fa0c4[_0xa012('0x21')]=_0xa012('0x22');_0xd3418c[_0xa012('0x23')][_0xa012('0x26')]=[{'filename':_0x4c7a06,'path':_0x48b890}];}else{_0xd3418c['message'][_0xa012('0x24')]=_0xa012('0x27');if(!_0xf07581['sendIfEmpty']){_0x15d53c=![];logger[_0xa012('0xa')](_0xa012('0x28'));}}if(_0x15d53c){return client[_0xa012('0x29')](_0xa012('0x2a'),_0xd3418c)[_0xa012('0x2b')](function(_0x55ef16){if(_0x55ef16['error']){return logger[_0xa012('0x2c')](_0xa012('0x2d'),JSON[_0xa012('0x2e')](_0x55ef16));}return logger['info']('email\x20sent');})[_0xa012('0x2f')](function(_0x47a056){return logger[_0xa012('0x2c')](_0xa012('0x2d'),JSON[_0xa012('0x2e')](_0x47a056));});}};}function handleError(){return function(_0x24d0f9){return logger['error'](JSON[_0xa012('0x2e')](_0x24d0f9));};}function handleResult(_0x3c4441){return function(_0xad08e2){logger[_0xa012('0xa')]('data',JSON[_0xa012('0x2e')](_0xad08e2));if(_0x3c4441['MailAccount']&&_0x3c4441[_0xa012('0xd')]['Smtp']&&!_['isNil'](_0x3c4441[_0xa012('0xc')])){setTimeout(handleSendEmail(_0x3c4441,_0xad08e2),0x3c*0x3e8);}};}function handleJob(_0x1dc99d){return function(){try{if(_[_0xa012('0x30')](_0x1dc99d[_0xa012('0x31')])){return logger[_0xa012('0xa')](_0xa012('0x32'));}if(_['isNil'](_0x1dc99d['subtractUnit'])){return logger[_0xa012('0xa')](_0xa012('0x33'));}var _0x44d984={'startDate':moment()[_0xa012('0x34')](_0x1dc99d[_0xa012('0x31')],_0x1dc99d[_0xa012('0x1b')])[_0xa012('0x17')](_0xa012('0x35')),'endDate':moment()[_0xa012('0x17')](_0xa012('0x35')),'type':_0xa012('0x36'),'output':_0x1dc99d[_0xa012('0x37')],'name':_0x1dc99d['name']};if(!_[_0xa012('0x30')](_0x1dc99d[_0xa012('0x38')])){logger[_0xa012('0xa')](_0xa012('0x39'),_0x1dc99d['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x1dc99d[_0xa012('0x38')]},_0x44d984)[_0xa012('0x2b')](handleResult(_0x1dc99d))[_0xa012('0x2f')](handleError());}if(!_[_0xa012('0x30')](_0x1dc99d[_0xa012('0x3a')])){logger[_0xa012('0xa')](_0xa012('0x3b'),_0x1dc99d[_0xa012('0x3a')]);return analyticCustomReportController['runReport']({'id':_0x1dc99d['CustomReportId']},_0x44d984)[_0xa012('0x2b')](handleResult(_0x1dc99d))['catch'](handleError());}}catch(_0x4cda77){logger[_0xa012('0x2c')](JSON[_0xa012('0x2e')](_0x4cda77));}return logger['info'](_0xa012('0x3c'));};}function getJobs(_0x2f17d2){var _0x31c3a3={};if(_0x2f17d2){_0x31c3a3['id']=_0x2f17d2;}return db[_0xa012('0x3d')][_0xa012('0x3e')]({'where':_0x31c3a3,'include':[{'model':db[_0xa012('0xd')],'attributes':['id',_0xa012('0x18'),'email'],'include':[{'model':db[_0xa012('0x3f')],'as':_0xa012('0xe')}]}]})[_0xa012('0x2b')](function(_0x3fdcd3){var _0x272897=_[_0xa012('0x40')](manager[_0xa012('0x41')]);var _0x41ffe4=_[_0xa012('0x42')](_0x3fdcd3,function(_0x1d089a){return _0x1d089a['id'][_0xa012('0x43')]();});var _0x22a4c3=_['keyBy'](_0x3fdcd3,function(_0x1b37a7){return _0x1b37a7['id']['toString']();});var _0x237b62=_0x2f17d2?_0x41ffe4:_[_0xa012('0x44')](_0x41ffe4,_0x272897);var _0x1fbeeb=_['intersection'](_0x41ffe4,_0x272897);var _0x2ff38b=_[_0xa012('0x44')](_0x272897,_0x41ffe4);var _0x15b125;var _0x2c04f4;for(_0x15b125=0x0;_0x15b125<_0x2ff38b[_0xa012('0x45')]&&!_0x2f17d2;_0x15b125+=0x1){_0x2c04f4=_0x2ff38b[_0x15b125]['toString']();if(manager[_0xa012('0x46')](_0x2c04f4)){manager[_0xa012('0x47')](_0x2c04f4);manager['deleteJob'](_0x2c04f4);logger[_0xa012('0xa')](_0xa012('0x48'),_0x2c04f4);}}logger[_0xa012('0xa')]('toRun',JSON[_0xa012('0x2e')](_0x237b62));for(_0x15b125=0x0;_0x15b125<_0x237b62[_0xa012('0x45')];_0x15b125+=0x1){_0x2c04f4=_0x237b62[_0x15b125][_0xa012('0x43')]();logger[_0xa012('0xa')]('index',_0x2c04f4);if(_0x2f17d2){logger[_0xa012('0xa')](_0xa012('0x49'),_0x2f17d2);logger[_0xa012('0xa')](JSON['stringify'](_0x22a4c3[_0x2c04f4]));BPromise[_0xa012('0x4a')]()[_0xa012('0x2b')](handleJob(_0x22a4c3[_0x2c04f4]));logger[_0xa012('0xa')](_0xa012('0x4b'),_0x22a4c3[_0x2c04f4]['name'],_0x22a4c3[_0x2c04f4]['cron']);}else if(_0x22a4c3[_0x2c04f4][_0xa012('0x4c')]&&_0x22a4c3[_0x2c04f4][_0xa012('0x4d')]&&moment()[_0xa012('0x4e')](_0x22a4c3[_0x2c04f4]['startAt'],_0x22a4c3[_0x2c04f4][_0xa012('0x4f')])){manager[_0xa012('0x50')](_0x2c04f4,_0x22a4c3[_0x2c04f4]['cron'],handleJob(_0x22a4c3[_0x2c04f4]));manager[_0xa012('0x51')](_0x2c04f4);logger[_0xa012('0xa')](_0xa012('0x52'),_0x22a4c3[_0x2c04f4][_0xa012('0x18')],_0x22a4c3[_0x2c04f4][_0xa012('0x4c')]);}else if(manager['exists'](_0x2c04f4)){manager[_0xa012('0x47')](_0x2c04f4);manager['deleteJob'](_0x2c04f4);logger[_0xa012('0xa')](_0xa012('0x53'),_0x22a4c3[_0x2c04f4][_0xa012('0x18')],_0x22a4c3[_0x2c04f4][_0xa012('0x4c')]);}}for(_0x15b125=0x0,_0x2c04f4;_0x15b125<_0x1fbeeb[_0xa012('0x45')]&&!_0x2f17d2;_0x15b125+=0x1){_0x2c04f4=_0x1fbeeb[_0x15b125][_0xa012('0x43')]();if(manager[_0xa012('0x46')](_0x2c04f4)){if(_0x22a4c3[_0x2c04f4]['cron']&&_0x22a4c3[_0x2c04f4][_0xa012('0x4d')]&&moment()['isBetween'](_0x22a4c3[_0x2c04f4][_0xa012('0x54')],_0x22a4c3[_0x2c04f4][_0xa012('0x4f')])){manager[_0xa012('0x55')](_0x2c04f4,_0x22a4c3[_0x2c04f4]['cron'],handleJob(_0x22a4c3[_0x2c04f4]));logger['info']('update\x20cron',_0x22a4c3[_0x2c04f4]['name'],_0x22a4c3[_0x2c04f4][_0xa012('0x4c')]);}else{manager[_0xa012('0x47')](_0x2c04f4);manager['deleteJob'](_0x2c04f4);logger['info'](_0xa012('0x53'),_0x22a4c3[_0x2c04f4][_0xa012('0x18')],_0x22a4c3[_0x2c04f4][_0xa012('0x4c')]);}}}})[_0xa012('0x2f')](function(_0x4021d7){logger[_0xa012('0x2c')](JSON[_0xa012('0x2e')](_0x4021d7));});}exports[_0xa012('0x56')]=function(_0x317e77){return getJobs(_0x317e77);};exports[_0xa012('0x51')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x6df4=['join','existsSync','status','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','message','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','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','catch','exec\x20custom\x20report\x20id:%s','CustomReportId','Schedule','findAll','MailServerOut','keys','jobs','toString','keyBy','difference','length','stop','delete\x20cron','index','my\x20id','run\x20job','cron','active','isBetween','add','add\x20cron','deleteJob','stop\x20cron','exists','update','update\x20cron','run','start','util','path','jayson/promise','schedule','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','../../files/reports','%s.%s','basename','savename','extname','zip'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6df4,0x190));var _0x46df=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x6df4[_0x40a825];return _0x273a54;};'use strict';var fs=require('fs');var util=require(_0x46df('0x0'));var path=require(_0x46df('0x1'));var _=require('lodash');var moment=require('moment');var CronJobManager=require('cron-job-manager');var jayson=require(_0x46df('0x2'));var BPromise=require('bluebird');var logger=require('../logger')(_0x46df('0x3'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x46df('0x4'));var client=jayson['client'][_0x46df('0x5')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x463729,_0x3a37b5){return function(){logger[_0x46df('0x6')](_0x46df('0x7'),_0x463729[_0x46df('0x8')]);var _0xd3ca3d=!![];var _0x1c06d1={'tls':{'rejectUnauthorized':![]}};if(_0x463729[_0x46df('0x9')][_0x46df('0xa')]['service']){_0x1c06d1['service']=_0x463729[_0x46df('0x9')][_0x46df('0xa')][_0x46df('0xb')];}else{_0x1c06d1[_0x46df('0xc')]=_0x463729[_0x46df('0x9')][_0x46df('0xa')]['host'];_0x1c06d1[_0x46df('0xd')]=_0x463729['MailAccount']['Smtp']['port'];_0x1c06d1['secure']=_0x463729[_0x46df('0x9')][_0x46df('0xa')][_0x46df('0xe')];}if(_0x463729[_0x46df('0x9')][_0x46df('0xa')][_0x46df('0xf')]){_0x1c06d1[_0x46df('0x10')]={'user':_0x463729['MailAccount'][_0x46df('0xa')][_0x46df('0x11')],'pass':_0x463729['MailAccount'][_0x46df('0xa')][_0x46df('0x12')]};}var _0x3de7b1={'account':_0x1c06d1,'message':{'from':util[_0x46df('0x13')](_0x46df('0x14'),_0x463729['MailAccount'][_0x46df('0x15')],_0x463729['MailAccount'][_0x46df('0x8')]||_0x463729[_0x46df('0x9')][_0x46df('0xa')]['user']),'to':_0x463729['email'],'cc':_0x463729['cc'],'bcc':_0x463729[_0x46df('0x16')],'subject':util[_0x46df('0x13')](_0x46df('0x17'),_0x3a37b5['name'],_0x463729['subtractNumber'],_0x463729['subtractUnit'])}};var _0x53f273=path['join'](__dirname,_0x46df('0x18'));var _0x14c4ff=_0x3a37b5['savename'];var _0x28a44e=util[_0x46df('0x13')](_0x46df('0x19'),path[_0x46df('0x1a')](_0x3a37b5[_0x46df('0x1b')],path[_0x46df('0x1c')](_0x3a37b5[_0x46df('0x1b')])),_0x46df('0x1d'));var _0x1f9ed8=path[_0x46df('0x1e')](_0x53f273,_0x14c4ff);var _0x27de0b=path[_0x46df('0x1e')](_0x53f273,_0x28a44e);if(fs[_0x46df('0x1f')](_0x1f9ed8)){_0x3a37b5[_0x46df('0x20')]='Sent';_0x3de7b1['message'][_0x46df('0x21')]=[{'filename':_0x14c4ff,'path':_0x1f9ed8}];_0x3de7b1['message']['text']=util[_0x46df('0x13')](_0x46df('0x22'),JSON[_0x46df('0x23')](_0x3a37b5,null,0x2));}else if(fs[_0x46df('0x1f')](_0x27de0b)){_0x3a37b5[_0x46df('0x20')]='Sent';_0x3de7b1[_0x46df('0x24')]['attachments']=[{'filename':_0x28a44e,'path':_0x27de0b}];}else{_0x3de7b1[_0x46df('0x24')][_0x46df('0x25')]=_0x46df('0x26');if(!_0x463729[_0x46df('0x27')]){_0xd3ca3d=![];logger[_0x46df('0x6')](_0x46df('0x28'));}}if(_0xd3ca3d){return client[_0x46df('0x29')](_0x46df('0x2a'),_0x3de7b1)[_0x46df('0x2b')](function(_0x10712e){if(_0x10712e['error']){return logger[_0x46df('0x2c')](_0x46df('0x2d'),JSON[_0x46df('0x23')](_0x10712e));}return logger[_0x46df('0x6')](_0x46df('0x2e'));})['catch'](function(_0x5f50ff){return logger[_0x46df('0x2c')](_0x46df('0x2d'),JSON[_0x46df('0x23')](_0x5f50ff));});}};}function handleError(){return function(_0x532684){return logger['error'](JSON['stringify'](_0x532684));};}function handleResult(_0x3b3763){return function(_0x30192d){logger['info']('data',JSON['stringify'](_0x30192d));if(_0x3b3763['MailAccount']&&_0x3b3763[_0x46df('0x9')][_0x46df('0xa')]&&!_[_0x46df('0x2f')](_0x3b3763[_0x46df('0x8')])){setTimeout(handleSendEmail(_0x3b3763,_0x30192d),0x3c*0x3e8);}};}function handleJob(_0x8ea7d4){return function(){try{if(_[_0x46df('0x2f')](_0x8ea7d4[_0x46df('0x30')])){return logger[_0x46df('0x6')](_0x46df('0x31'));}if(_[_0x46df('0x2f')](_0x8ea7d4['subtractUnit'])){return logger[_0x46df('0x6')](_0x46df('0x32'));}var _0x51f46e={'startDate':moment()[_0x46df('0x33')](_0x8ea7d4['subtractNumber'],_0x8ea7d4['subtractUnit'])['format'](_0x46df('0x34')),'endDate':moment()[_0x46df('0x13')](_0x46df('0x34')),'type':_0x46df('0x35'),'output':_0x8ea7d4['output'],'name':_0x8ea7d4[_0x46df('0x15')]};if(!_['isNil'](_0x8ea7d4['DefaultReportId'])){logger[_0x46df('0x6')](_0x46df('0x36'),_0x8ea7d4[_0x46df('0x37')]);return analyticDefaultReportController[_0x46df('0x38')]({'id':_0x8ea7d4[_0x46df('0x37')]},_0x51f46e)[_0x46df('0x2b')](handleResult(_0x8ea7d4))[_0x46df('0x39')](handleError());}if(!_['isNil'](_0x8ea7d4['CustomReportId'])){logger['info'](_0x46df('0x3a'),_0x8ea7d4[_0x46df('0x3b')]);return analyticCustomReportController[_0x46df('0x38')]({'id':_0x8ea7d4[_0x46df('0x3b')]},_0x51f46e)[_0x46df('0x2b')](handleResult(_0x8ea7d4))['catch'](handleError());}}catch(_0x320013){logger['error'](JSON['stringify'](_0x320013));}return logger[_0x46df('0x6')]('no\x20report\x20id');};}function getJobs(_0x3498a2){var _0x44a618={};if(_0x3498a2){_0x44a618['id']=_0x3498a2;}return db[_0x46df('0x3c')][_0x46df('0x3d')]({'where':_0x44a618,'include':[{'model':db[_0x46df('0x9')],'attributes':['id',_0x46df('0x15'),'email'],'include':[{'model':db[_0x46df('0x3e')],'as':_0x46df('0xa')}]}]})[_0x46df('0x2b')](function(_0x4c83e0){var _0x1b47f1=_[_0x46df('0x3f')](manager[_0x46df('0x40')]);var _0xca84bf=_['map'](_0x4c83e0,function(_0x4432e2){return _0x4432e2['id'][_0x46df('0x41')]();});var _0x326bf9=_[_0x46df('0x42')](_0x4c83e0,function(_0x1855f7){return _0x1855f7['id'][_0x46df('0x41')]();});var _0x71f2d2=_0x3498a2?_0xca84bf:_['difference'](_0xca84bf,_0x1b47f1);var _0x5b96e1=_['intersection'](_0xca84bf,_0x1b47f1);var _0x33e05c=_[_0x46df('0x43')](_0x1b47f1,_0xca84bf);var _0x5b9497;var _0x6b4542;for(_0x5b9497=0x0;_0x5b9497<_0x33e05c[_0x46df('0x44')]&&!_0x3498a2;_0x5b9497+=0x1){_0x6b4542=_0x33e05c[_0x5b9497]['toString']();if(manager['exists'](_0x6b4542)){manager[_0x46df('0x45')](_0x6b4542);manager['deleteJob'](_0x6b4542);logger['info'](_0x46df('0x46'),_0x6b4542);}}logger[_0x46df('0x6')]('toRun',JSON['stringify'](_0x71f2d2));for(_0x5b9497=0x0;_0x5b9497<_0x71f2d2[_0x46df('0x44')];_0x5b9497+=0x1){_0x6b4542=_0x71f2d2[_0x5b9497]['toString']();logger['info'](_0x46df('0x47'),_0x6b4542);if(_0x3498a2){logger[_0x46df('0x6')](_0x46df('0x48'),_0x3498a2);logger[_0x46df('0x6')](JSON['stringify'](_0x326bf9[_0x6b4542]));BPromise['resolve']()['then'](handleJob(_0x326bf9[_0x6b4542]));logger['info'](_0x46df('0x49'),_0x326bf9[_0x6b4542][_0x46df('0x15')],_0x326bf9[_0x6b4542][_0x46df('0x4a')]);}else if(_0x326bf9[_0x6b4542][_0x46df('0x4a')]&&_0x326bf9[_0x6b4542][_0x46df('0x4b')]&&moment()[_0x46df('0x4c')](_0x326bf9[_0x6b4542]['startAt'],_0x326bf9[_0x6b4542]['endAt'])){manager[_0x46df('0x4d')](_0x6b4542,_0x326bf9[_0x6b4542][_0x46df('0x4a')],handleJob(_0x326bf9[_0x6b4542]));manager['start'](_0x6b4542);logger['info'](_0x46df('0x4e'),_0x326bf9[_0x6b4542][_0x46df('0x15')],_0x326bf9[_0x6b4542][_0x46df('0x4a')]);}else if(manager['exists'](_0x6b4542)){manager[_0x46df('0x45')](_0x6b4542);manager[_0x46df('0x4f')](_0x6b4542);logger['info'](_0x46df('0x50'),_0x326bf9[_0x6b4542][_0x46df('0x15')],_0x326bf9[_0x6b4542][_0x46df('0x4a')]);}}for(_0x5b9497=0x0,_0x6b4542;_0x5b9497<_0x5b96e1[_0x46df('0x44')]&&!_0x3498a2;_0x5b9497+=0x1){_0x6b4542=_0x5b96e1[_0x5b9497][_0x46df('0x41')]();if(manager[_0x46df('0x51')](_0x6b4542)){if(_0x326bf9[_0x6b4542][_0x46df('0x4a')]&&_0x326bf9[_0x6b4542][_0x46df('0x4b')]&&moment()['isBetween'](_0x326bf9[_0x6b4542]['startAt'],_0x326bf9[_0x6b4542]['endAt'])){manager[_0x46df('0x52')](_0x6b4542,_0x326bf9[_0x6b4542][_0x46df('0x4a')],handleJob(_0x326bf9[_0x6b4542]));logger[_0x46df('0x6')](_0x46df('0x53'),_0x326bf9[_0x6b4542][_0x46df('0x15')],_0x326bf9[_0x6b4542][_0x46df('0x4a')]);}else{manager[_0x46df('0x45')](_0x6b4542);manager[_0x46df('0x4f')](_0x6b4542);logger[_0x46df('0x6')](_0x46df('0x50'),_0x326bf9[_0x6b4542][_0x46df('0x15')],_0x326bf9[_0x6b4542]['cron']);}}}})[_0x46df('0x39')](function(_0x348ce7){logger[_0x46df('0x2c')](JSON[_0x46df('0x23')](_0x348ce7));});}exports[_0x46df('0x54')]=function(_0x232b9e){return getJobs(_0x232b9e);};exports[_0x46df('0x55')]=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 b1f1aac..d613410 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 _0x236c=['substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','transcribeName','then','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','language','bucket','ValidationError','Transcript\x20not\x20available','CloudProvider','sentimentAccountId','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','sentimentRegion','update','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Sentiment\x20Analysis\x20not\x20configured','findOne','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','push','all','catch','inspect','lodash','request-promise','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','detectSentiment'];(function(_0x2beb5d,_0x38d01b){var _0x3555a3=function(_0xecae16){while(--_0xecae16){_0x2beb5d['push'](_0x2beb5d['shift']());}};_0x3555a3(++_0x38d01b);}(_0x236c,0x155));var _0xc236=function(_0x401848,_0x3e47c2){_0x401848=_0x401848-0x0;var _0x25c3ec=_0x236c[_0x401848];return _0x25c3ec;};var _=require(_0xc236('0x0'));var AWS=require('aws-sdk');var rp=require(_0xc236('0x1'));var util=require(_0xc236('0x2'));var BPromise=require(_0xc236('0x3'));var db=require(_0xc236('0x4'))['db'];var logger=require(_0xc236('0x5'))('transcribe');function getTranscriptionJob(_0x3adce9,_0x36e87d,_0x33bc57,_0xd582f6){return new Promise(function(_0x23d3cc,_0x461c3a){var _0x5abd65=new AWS[(_0xc236('0x6'))]({'accessKeyId':_0x36e87d,'secretAccessKey':_0x3adce9,'region':_0x33bc57});_0x5abd65[_0xc236('0x7')]({'TranscriptionJobName':_0xd582f6},function(_0x51a13b,_0x5bc6a2){if(_0x51a13b){return _0x461c3a(_0x51a13b);}else{return _0x23d3cc(_0x5bc6a2);}});});}function sentiment(_0x5cdee5,_0xbb4620,_0x4b8dc6,_0x30a28d,_0x381ed1){return new Promise(function(_0x18f33b,_0x2f8b72){var _0xaf651b=new AWS['Comprehend']({'accessKeyId':_0xbb4620,'secretAccessKey':_0x5cdee5,'region':_0x4b8dc6});_0xaf651b[_0xc236('0x8')]({'Text':_0x30a28d,'LanguageCode':_0x381ed1[_0xc236('0x9')](0x0,0x2)},function(_0x58acb0,_0xcfe854){if(_0x58acb0){return _0x2f8b72(_0x58acb0);}else{return _0x18f33b(_0xcfe854);}});});}function checkTranscribeJob(_0x1bc39f,_0x5ee3a5,_0x5b9638){var _0x5bce83;return new BPromise(function(_0x599d36,_0x6db6b9){logger[_0xc236('0xa')](util[_0xc236('0xb')](_0xc236('0xc'),_0x1bc39f['id'],_0x1bc39f['transcribeName']));return getTranscriptionJob(_0x5b9638[_0xc236('0xd')],_0x5b9638['data2'],_0x5ee3a5['transcribeRegion'],_0x1bc39f[_0xc236('0xe')])[_0xc236('0xf')](function(_0x443a46){logger[_0xc236('0xa')](util[_0xc236('0xb')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x1bc39f['id'],_0x1bc39f['transcribeName'],_0x443a46['TranscriptionJob'][_0xc236('0x10')]));if(!_0x1bc39f[_0xc236('0x11')]){switch(_0x443a46[_0xc236('0x12')]['TranscriptionJobStatus']){case _0xc236('0x13'):var _0x506974={'transcribeStatus':_0x443a46['TranscriptionJob'][_0xc236('0x10')],'fileUri':_0x443a46[_0xc236('0x12')][_0xc236('0x14')][_0xc236('0x15')]};logger[_0xc236('0xa')](util[_0xc236('0xb')](_0xc236('0x16'),_0x1bc39f['id']));return rp({'uri':_0x443a46[_0xc236('0x12')][_0xc236('0x14')][_0xc236('0x15')],'json':!![]})[_0xc236('0xf')](function(_0x4a9006){logger[_0xc236('0xa')](util[_0xc236('0xb')](_0xc236('0x17'),_0x1bc39f['id']));if(_0x4a9006&&_0x4a9006[_0xc236('0x18')]&&_0x4a9006[_0xc236('0x18')][_0xc236('0x19')]&&_0x4a9006[_0xc236('0x18')][_0xc236('0x19')][_0xc236('0x1a')]){_0x506974[_0xc236('0x11')]='';for(var _0x17cb3b=0x0;_0x17cb3b<_0x4a9006['results'][_0xc236('0x19')][_0xc236('0x1a')];_0x17cb3b++){_0x506974[_0xc236('0x11')]+=_0x4a9006[_0xc236('0x18')]['transcripts'][_0x17cb3b][_0xc236('0x1b')]+'';}}return _0x1bc39f['update'](_0x506974);})['then'](function(){logger[_0xc236('0xa')](util['format'](_0xc236('0x1c'),_0x1bc39f['id']));if(!_0x1bc39f['tempSentiment']){throw new db[(_0xc236('0x1d'))]['ValidationError'](_0xc236('0x1e'));}if(!_0x5ee3a5[_0xc236('0x1f')]||!_0x5ee3a5['sentimentAccountId']||!_0x5ee3a5['sentimentRegion']||!_0x5ee3a5[_0xc236('0x20')]||!_0x5ee3a5[_0xc236('0x21')]){throw new db[(_0xc236('0x1d'))][(_0xc236('0x22'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x506974['fileText']){throw new Error(_0xc236('0x23'));}if(_0x5ee3a5['sentimentAccountId']===_0x5b9638['id']){return _0x5b9638;}else{return db[_0xc236('0x24')]['findOne']({'where':{'id':_settings[_0xc236('0x25')]}});}})[_0xc236('0xf')](function(_0x57c99e){if(!_0x57c99e){throw new db['Sequelize'][(_0xc236('0x22'))](_0xc236('0x26'));}if(!_0x57c99e[_0xc236('0xd')]||!_0x57c99e[_0xc236('0x27')]){throw new db[(_0xc236('0x1d'))][(_0xc236('0x22'))](_0xc236('0x28'));}_0x5bce83=_0x57c99e;logger[_0xc236('0xa')](util[_0xc236('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x1bc39f['id']));return sentiment(_0x5bce83['data1'],_0x5bce83['data2'],_0x5ee3a5[_0xc236('0x29')],_0x506974[_0xc236('0x11')],_0x5ee3a5[_0xc236('0x20')]);})[_0xc236('0xf')](function(_0x2e117c){logger[_0xc236('0xa')](util[_0xc236('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x1bc39f['id']));return _0x1bc39f[_0xc236('0x2a')]({'sentiment':_0x2e117c[_0xc236('0x2b')],'sPositive':_0x2e117c[_0xc236('0x2c')]['Positive'],'sNegative':_0x2e117c[_0xc236('0x2c')][_0xc236('0x2d')],'sMixed':_0x2e117c[_0xc236('0x2c')][_0xc236('0x2e')],'sNeutral':_0x2e117c['SentimentScore'][_0xc236('0x2f')]});})[_0xc236('0xf')](function(){logger[_0xc236('0xa')](util[_0xc236('0xb')](_0xc236('0x1c'),_0x1bc39f['id']));_0x599d36();});case _0xc236('0x30'):return _0x1bc39f[_0xc236('0x2a')]({'transcribeStatus':_0xc236('0x30'),'failureReason':_0x443a46[_0xc236('0x12')][_0xc236('0x31')]})[_0xc236('0xf')](function(){logger[_0xc236('0xa')](util[_0xc236('0xb')](_0xc236('0x1c'),_0x1bc39f['id']));_0x599d36();});default:logger[_0xc236('0xa')](util[_0xc236('0xb')](_0xc236('0x32'),_0x1bc39f['id']));break;}}else{return BPromise['resolve']()['then'](function(){if(!_0x1bc39f['tempSentiment']){throw new db['Sequelize'][(_0xc236('0x22'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x5ee3a5[_0xc236('0x1f')]||!_0x5ee3a5[_0xc236('0x25')]||!_0x5ee3a5[_0xc236('0x29')]||!_0x5ee3a5[_0xc236('0x20')]||!_0x5ee3a5[_0xc236('0x21')]){throw new db[(_0xc236('0x1d'))][(_0xc236('0x22'))](_0xc236('0x33'));}if(!_0x1bc39f[_0xc236('0x11')]){throw new Error(_0xc236('0x23'));}if(_0x5ee3a5[_0xc236('0x25')]===_0x5b9638['id']){return _0x5b9638;}else{return db[_0xc236('0x24')][_0xc236('0x34')]({'where':{'id':_settings[_0xc236('0x25')]}});}})[_0xc236('0xf')](function(_0x594ffc){if(!_0x594ffc){throw new db[(_0xc236('0x1d'))][(_0xc236('0x22'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x594ffc[_0xc236('0xd')]||!_0x594ffc['data2']){throw new db[(_0xc236('0x1d'))]['ValidationError'](_0xc236('0x28'));}_0x5bce83=_0x594ffc;logger[_0xc236('0xa')](util[_0xc236('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x1bc39f['id']));return sentiment(_0x5bce83[_0xc236('0xd')],_0x5bce83[_0xc236('0x27')],_0x5ee3a5[_0xc236('0x29')],_0x1bc39f['fileText'],_0x5ee3a5[_0xc236('0x20')]);})[_0xc236('0xf')](function(_0x317431){logger[_0xc236('0xa')](util[_0xc236('0xb')](_0xc236('0x35'),_0x1bc39f['id']));return _0x1bc39f['update']({'sentiment':_0x317431[_0xc236('0x2b')],'sPositive':_0x317431['SentimentScore'][_0xc236('0x36')],'sNegative':_0x317431[_0xc236('0x2c')][_0xc236('0x2d')],'sMixed':_0x317431[_0xc236('0x2c')][_0xc236('0x2e')],'sNeutral':_0x317431[_0xc236('0x2c')][_0xc236('0x2f')],'transcribeStatus':'COMPLETED'});})[_0xc236('0xf')](function(){logger['info'](util[_0xc236('0xb')](_0xc236('0x1c'),_0x1bc39f['id']));_0x599d36();});}})['catch'](function(_0x12bfe2){if(_0x12bfe2){if(!_0x12bfe2[_0xc236('0x37')]||_0x12bfe2[_0xc236('0x37')]!==_0xc236('0x38')){logger[_0xc236('0x39')](util[_0xc236('0xb')](_0xc236('0x3a'),_0x1bc39f['id']),util['inspect'](_0x12bfe2,{'showHidden':![],'depth':null}));}}_0x599d36();});});}function checkTranscribe(){var _0x50dd50;var _0xcc0461;var _0x2afed2;return db['VoiceRecording'][_0xc236('0x3b')]({'where':{'transcribeStatus':_0xc236('0x3c')}})[_0xc236('0xf')](function(_0x7c856f){if(!_0x7c856f||!_0x7c856f[_0xc236('0x1a')]){throw new db[(_0xc236('0x1d'))][(_0xc236('0x22'))](_0xc236('0x3d'));}_0x50dd50=_0x7c856f;return db[_0xc236('0x3e')]['findOne']({'where':{'id':0x1}});})[_0xc236('0xf')](function(_0x307663){if(!_0x307663){throw new db[(_0xc236('0x1d'))][(_0xc236('0x22'))](_0xc236('0x3f'));}_0xcc0461=_0x307663;if(!_0xcc0461[_0xc236('0x40')]||!_0xcc0461[_0xc236('0x41')]||!_0xcc0461['transcribeRegion']||!_0xcc0461[_0xc236('0x20')]||!_0xcc0461[_0xc236('0x21')]){throw new db[(_0xc236('0x1d'))][(_0xc236('0x22'))]('Transcribe\x20not\x20configured');}return db[_0xc236('0x24')][_0xc236('0x34')]({'where':{'id':_0xcc0461[_0xc236('0x41')]}});})[_0xc236('0xf')](function(_0x9d81c8){if(!_0x9d81c8){throw new db['Sequelize'][(_0xc236('0x22'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x9d81c8[_0xc236('0xd')]||!_0x9d81c8[_0xc236('0x27')]){throw new db[(_0xc236('0x1d'))][(_0xc236('0x22'))](_0xc236('0x28'));}_0x2afed2=_0x9d81c8;var _0x49ad63=[];_0x50dd50['forEach'](function(_0x3bee67){_0x49ad63[_0xc236('0x42')](checkTranscribeJob(_0x3bee67,_0xcc0461,_0x2afed2));});return BPromise[_0xc236('0x43')](_0x49ad63);})[_0xc236('0x44')](function(_0x3c4256){if(_0x3c4256){if(!_0x3c4256[_0xc236('0x37')]||_0x3c4256[_0xc236('0x37')]!==_0xc236('0x38')){logger[_0xc236('0x39')](util[_0xc236('0x45')](_0x3c4256,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x8efc=['transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Mixed','Neutral','FAILED','FailureReason','resolve','tempSentiment','sentiment','Sentiment','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','bucket','transcribeAccountId','push','all','inspect','aws-sdk','request-promise','util','bluebird','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length'];(function(_0x231362,_0x1b3085){var _0x523090=function(_0x9973df){while(--_0x9973df){_0x231362['push'](_0x231362['shift']());}};_0x523090(++_0x1b3085);}(_0x8efc,0xb3));var _0xc8ef=function(_0x277fa3,_0x3b2dde){_0x277fa3=_0x277fa3-0x0;var _0x2e4520=_0x8efc[_0x277fa3];return _0x2e4520;};var _=require('lodash');var AWS=require(_0xc8ef('0x0'));var rp=require(_0xc8ef('0x1'));var util=require(_0xc8ef('0x2'));var BPromise=require(_0xc8ef('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xc8ef('0x4'))(_0xc8ef('0x5'));function getTranscriptionJob(_0x33b9c9,_0x50d1f6,_0x2910b5,_0x3c6189){return new Promise(function(_0x1cd466,_0x13b433){var _0x576ff9=new AWS[(_0xc8ef('0x6'))]({'accessKeyId':_0x50d1f6,'secretAccessKey':_0x33b9c9,'region':_0x2910b5});_0x576ff9[_0xc8ef('0x7')]({'TranscriptionJobName':_0x3c6189},function(_0x1c8931,_0x489778){if(_0x1c8931){return _0x13b433(_0x1c8931);}else{return _0x1cd466(_0x489778);}});});}function sentiment(_0x11f3ba,_0x443ee3,_0x1a9a5f,_0xcc3c21,_0x56cfb1){return new Promise(function(_0x315d93,_0x574588){var _0x45dbd3=new AWS[(_0xc8ef('0x8'))]({'accessKeyId':_0x443ee3,'secretAccessKey':_0x11f3ba,'region':_0x1a9a5f});_0x45dbd3[_0xc8ef('0x9')]({'Text':_0xcc3c21,'LanguageCode':_0x56cfb1[_0xc8ef('0xa')](0x0,0x2)},function(_0xa76b59,_0x44d7da){if(_0xa76b59){return _0x574588(_0xa76b59);}else{return _0x315d93(_0x44d7da);}});});}function checkTranscribeJob(_0x18213f,_0x1c6744,_0xb90ed0){var _0x15669b;return new BPromise(function(_0x3e7c04,_0x1207d8){logger[_0xc8ef('0xb')](util[_0xc8ef('0xc')](_0xc8ef('0xd'),_0x18213f['id'],_0x18213f[_0xc8ef('0xe')]));return getTranscriptionJob(_0xb90ed0[_0xc8ef('0xf')],_0xb90ed0[_0xc8ef('0x10')],_0x1c6744[_0xc8ef('0x11')],_0x18213f[_0xc8ef('0xe')])[_0xc8ef('0x12')](function(_0x45eb4b){logger['info'](util[_0xc8ef('0xc')](_0xc8ef('0x13'),_0x18213f['id'],_0x18213f[_0xc8ef('0xe')],_0x45eb4b[_0xc8ef('0x14')][_0xc8ef('0x15')]));if(!_0x18213f[_0xc8ef('0x16')]){switch(_0x45eb4b[_0xc8ef('0x14')][_0xc8ef('0x15')]){case _0xc8ef('0x17'):var _0x3591c={'transcribeStatus':_0x45eb4b['TranscriptionJob'][_0xc8ef('0x15')],'fileUri':_0x45eb4b['TranscriptionJob'][_0xc8ef('0x18')]['TranscriptFileUri']};logger[_0xc8ef('0xb')](util['format'](_0xc8ef('0x19'),_0x18213f['id']));return rp({'uri':_0x45eb4b[_0xc8ef('0x14')][_0xc8ef('0x18')][_0xc8ef('0x1a')],'json':!![]})[_0xc8ef('0x12')](function(_0x4c57e3){logger[_0xc8ef('0xb')](util[_0xc8ef('0xc')](_0xc8ef('0x1b'),_0x18213f['id']));if(_0x4c57e3&&_0x4c57e3['results']&&_0x4c57e3[_0xc8ef('0x1c')]['transcripts']&&_0x4c57e3['results']['transcripts']['length']){_0x3591c[_0xc8ef('0x16')]='';for(var _0x128556=0x0;_0x128556<_0x4c57e3[_0xc8ef('0x1c')][_0xc8ef('0x1d')][_0xc8ef('0x1e')];_0x128556++){_0x3591c[_0xc8ef('0x16')]+=_0x4c57e3[_0xc8ef('0x1c')][_0xc8ef('0x1d')][_0x128556][_0xc8ef('0x1f')]+'';}}return _0x18213f[_0xc8ef('0x20')](_0x3591c);})[_0xc8ef('0x12')](function(){logger[_0xc8ef('0xb')](util[_0xc8ef('0xc')](_0xc8ef('0x21'),_0x18213f['id']));if(!_0x18213f['tempSentiment']){throw new db[(_0xc8ef('0x22'))][(_0xc8ef('0x23'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x1c6744['sentiment']||!_0x1c6744[_0xc8ef('0x24')]||!_0x1c6744['sentimentRegion']||!_0x1c6744[_0xc8ef('0x25')]||!_0x1c6744['bucket']){throw new db[(_0xc8ef('0x22'))]['ValidationError'](_0xc8ef('0x26'));}if(!_0x3591c[_0xc8ef('0x16')]){throw new Error('Transcript\x20not\x20available');}if(_0x1c6744['sentimentAccountId']===_0xb90ed0['id']){return _0xb90ed0;}else{return db[_0xc8ef('0x27')][_0xc8ef('0x28')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xc8ef('0x12')](function(_0x3bde31){if(!_0x3bde31){throw new db[(_0xc8ef('0x22'))][(_0xc8ef('0x23'))](_0xc8ef('0x29'));}if(!_0x3bde31[_0xc8ef('0xf')]||!_0x3bde31[_0xc8ef('0x10')]){throw new db[(_0xc8ef('0x22'))][(_0xc8ef('0x23'))](_0xc8ef('0x2a'));}_0x15669b=_0x3bde31;logger[_0xc8ef('0xb')](util[_0xc8ef('0xc')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x18213f['id']));return sentiment(_0x15669b[_0xc8ef('0xf')],_0x15669b[_0xc8ef('0x10')],_0x1c6744[_0xc8ef('0x2b')],_0x3591c[_0xc8ef('0x16')],_0x1c6744['language']);})[_0xc8ef('0x12')](function(_0x1890de){logger['info'](util[_0xc8ef('0xc')](_0xc8ef('0x2c'),_0x18213f['id']));return _0x18213f['update']({'sentiment':_0x1890de['Sentiment'],'sPositive':_0x1890de[_0xc8ef('0x2d')][_0xc8ef('0x2e')],'sNegative':_0x1890de[_0xc8ef('0x2d')]['Negative'],'sMixed':_0x1890de['SentimentScore'][_0xc8ef('0x2f')],'sNeutral':_0x1890de[_0xc8ef('0x2d')][_0xc8ef('0x30')]});})[_0xc8ef('0x12')](function(){logger[_0xc8ef('0xb')](util['format'](_0xc8ef('0x21'),_0x18213f['id']));_0x3e7c04();});case _0xc8ef('0x31'):return _0x18213f[_0xc8ef('0x20')]({'transcribeStatus':_0xc8ef('0x31'),'failureReason':_0x45eb4b[_0xc8ef('0x14')][_0xc8ef('0x32')]})['then'](function(){logger[_0xc8ef('0xb')](util[_0xc8ef('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x18213f['id']));_0x3e7c04();});default:logger['info'](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x18213f['id']));break;}}else{return BPromise[_0xc8ef('0x33')]()['then'](function(){if(!_0x18213f[_0xc8ef('0x34')]){throw new db[(_0xc8ef('0x22'))][(_0xc8ef('0x23'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x1c6744[_0xc8ef('0x35')]||!_0x1c6744[_0xc8ef('0x24')]||!_0x1c6744[_0xc8ef('0x2b')]||!_0x1c6744[_0xc8ef('0x25')]||!_0x1c6744['bucket']){throw new db[(_0xc8ef('0x22'))][(_0xc8ef('0x23'))](_0xc8ef('0x26'));}if(!_0x18213f[_0xc8ef('0x16')]){throw new Error('Transcript\x20not\x20available');}if(_0x1c6744['sentimentAccountId']===_0xb90ed0['id']){return _0xb90ed0;}else{return db[_0xc8ef('0x27')][_0xc8ef('0x28')]({'where':{'id':_settings[_0xc8ef('0x24')]}});}})[_0xc8ef('0x12')](function(_0x351109){if(!_0x351109){throw new db['Sequelize']['ValidationError'](_0xc8ef('0x29'));}if(!_0x351109['data1']||!_0x351109[_0xc8ef('0x10')]){throw new db[(_0xc8ef('0x22'))][(_0xc8ef('0x23'))]('Cloud\x20Provider\x20not\x20configured');}_0x15669b=_0x351109;logger[_0xc8ef('0xb')](util[_0xc8ef('0xc')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x18213f['id']));return sentiment(_0x15669b[_0xc8ef('0xf')],_0x15669b['data2'],_0x1c6744[_0xc8ef('0x2b')],_0x18213f[_0xc8ef('0x16')],_0x1c6744[_0xc8ef('0x25')]);})['then'](function(_0x5b1ef1){logger['info'](util[_0xc8ef('0xc')](_0xc8ef('0x2c'),_0x18213f['id']));return _0x18213f[_0xc8ef('0x20')]({'sentiment':_0x5b1ef1[_0xc8ef('0x36')],'sPositive':_0x5b1ef1[_0xc8ef('0x2d')][_0xc8ef('0x2e')],'sNegative':_0x5b1ef1[_0xc8ef('0x2d')]['Negative'],'sMixed':_0x5b1ef1['SentimentScore'][_0xc8ef('0x2f')],'sNeutral':_0x5b1ef1[_0xc8ef('0x2d')][_0xc8ef('0x30')],'transcribeStatus':_0xc8ef('0x17')});})[_0xc8ef('0x12')](function(){logger['info'](util[_0xc8ef('0xc')](_0xc8ef('0x21'),_0x18213f['id']));_0x3e7c04();});}})[_0xc8ef('0x37')](function(_0xc932df){if(_0xc932df){if(!_0xc932df['name']||_0xc932df[_0xc8ef('0x38')]!==_0xc8ef('0x39')){logger[_0xc8ef('0x3a')](util['format'](_0xc8ef('0x3b'),_0x18213f['id']),util['inspect'](_0xc932df,{'showHidden':![],'depth':null}));}}_0x3e7c04();});});}function checkTranscribe(){var _0x7e5c5a;var _0x52eac7;var _0x3dbb7a;return db[_0xc8ef('0x3c')][_0xc8ef('0x3d')]({'where':{'transcribeStatus':_0xc8ef('0x3e')}})[_0xc8ef('0x12')](function(_0x3e0398){if(!_0x3e0398||!_0x3e0398[_0xc8ef('0x1e')]){throw new db[(_0xc8ef('0x22'))]['ValidationError'](_0xc8ef('0x3f'));}_0x7e5c5a=_0x3e0398;return db[_0xc8ef('0x40')]['findOne']({'where':{'id':0x1}});})['then'](function(_0xe997a){if(!_0xe997a){throw new db['Sequelize'][(_0xc8ef('0x23'))]('Settings\x20not\x20available');}_0x52eac7=_0xe997a;if(!_0x52eac7[_0xc8ef('0x5')]||!_0x52eac7['transcribeAccountId']||!_0x52eac7[_0xc8ef('0x11')]||!_0x52eac7[_0xc8ef('0x25')]||!_0x52eac7[_0xc8ef('0x41')]){throw new db[(_0xc8ef('0x22'))][(_0xc8ef('0x23'))]('Transcribe\x20not\x20configured');}return db[_0xc8ef('0x27')][_0xc8ef('0x28')]({'where':{'id':_0x52eac7[_0xc8ef('0x42')]}});})[_0xc8ef('0x12')](function(_0x1b460a){if(!_0x1b460a){throw new db[(_0xc8ef('0x22'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x1b460a[_0xc8ef('0xf')]||!_0x1b460a[_0xc8ef('0x10')]){throw new db['Sequelize']['ValidationError'](_0xc8ef('0x2a'));}_0x3dbb7a=_0x1b460a;var _0x1cfab1=[];_0x7e5c5a['forEach'](function(_0x479742){_0x1cfab1[_0xc8ef('0x43')](checkTranscribeJob(_0x479742,_0x52eac7,_0x3dbb7a));});return BPromise[_0xc8ef('0x44')](_0x1cfab1);})[_0xc8ef('0x37')](function(_0xb58103){if(_0xb58103){if(!_0xb58103[_0xc8ef('0x38')]||_0xb58103['name']!==_0xc8ef('0x39')){logger[_0xc8ef('0x3a')](util[_0xc8ef('0x45')](_0xb58103,{'showHidden':![],'depth':null}));}}});}exports['start']=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 6d384b7..6945d67 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 _0xd9aa=['../../mysqldb','../logger','schedule','socket.io-emitter','redis','WhatsappInteraction','lastMsgAt','hours','then','length','map','info','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment'];(function(_0x1209d3,_0x3be586){var _0x4cc79e=function(_0x136814){while(--_0x136814){_0x1209d3['push'](_0x1209d3['shift']());}};_0x4cc79e(++_0x3be586);}(_0xd9aa,0x91));var _0xad9a=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xd9aa[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0xad9a('0x0'));var moment=require(_0xad9a('0x1'));var Redis=require(_0xad9a('0x2'));var util=require(_0xad9a('0x3'));var config=require(_0xad9a('0x4'));var db=require(_0xad9a('0x5'))['db'];var logger=require(_0xad9a('0x6'))(_0xad9a('0x7'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xad9a('0x8'))(new Redis(config[_0xad9a('0x9')]));function closeInteractions(){var _0x14c554=[];return db[_0xad9a('0xa')]['findAll']({'raw':!![],'attributes':['id',_0xad9a('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xad9a('0xc'))}}})[_0xad9a('0xd')](function(_0x2d3cd1){if(_0x2d3cd1&&_0x2d3cd1[_0xad9a('0xe')]){_0x14c554=_[_0xad9a('0xf')](_0x2d3cd1||[],'id');logger[_0xad9a('0x10')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x14c554[_0xad9a('0x11')]());return db[_0xad9a('0xa')][_0xad9a('0x12')]({'closeReason':_0xad9a('0x13'),'disposition':_0xad9a('0x14'),'closed':!![],'closedAt':moment()[_0xad9a('0x15')](_0xad9a('0x16'))},{'where':{'id':_0x14c554}});}})[_0xad9a('0xd')](function(){if(_0x14c554&&_0x14c554[_0xad9a('0xe')]){logger['info'](_0xad9a('0x17'),_0x14c554['join']());for(var _0xcb74ad=0x0;_0xcb74ad<_0x14c554[_0xad9a('0xe')];_0xcb74ad++){io[_0xad9a('0x18')](_0xad9a('0x19'),{'id':_0x14c554[_0xcb74ad],'closed':!![]});}}})[_0xad9a('0x1a')](function(_0x40aa5c){logger['error'](_0xad9a('0x1b'),_0x40aa5c?util[_0xad9a('0x1c')](_0x40aa5c,{'showHidden':![],'depth':null}):'');});}exports[_0xad9a('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xf1d7=['emit','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../../mysqldb','../logger','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:'];(function(_0x48205e,_0x47606c){var _0x4b3981=function(_0x1759c0){while(--_0x1759c0){_0x48205e['push'](_0x48205e['shift']());}};_0x4b3981(++_0x47606c);}(_0xf1d7,0x17e));var _0x7f1d=function(_0x65348d,_0x24f251){_0x65348d=_0x65348d-0x0;var _0x472a48=_0xf1d7[_0x65348d];return _0x472a48;};'use strict';var _=require(_0x7f1d('0x0'));var moment=require(_0x7f1d('0x1'));var Redis=require(_0x7f1d('0x2'));var util=require('util');var config=require('../../config/environment');var db=require(_0x7f1d('0x3'))['db'];var logger=require(_0x7f1d('0x4'))('schedule');config[_0x7f1d('0x5')]=_['defaults'](config['redis'],{'host':_0x7f1d('0x6'),'port':0x18eb});var io=require(_0x7f1d('0x7'))(new Redis(config[_0x7f1d('0x5')]));function closeInteractions(){var _0x51177a=[];return db[_0x7f1d('0x8')][_0x7f1d('0x9')]({'raw':!![],'attributes':['id',_0x7f1d('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x7f1d('0xb')](0x18,_0x7f1d('0xc'))}}})['then'](function(_0x168bb4){if(_0x168bb4&&_0x168bb4[_0x7f1d('0xd')]){_0x51177a=_[_0x7f1d('0xe')](_0x168bb4||[],'id');logger[_0x7f1d('0xf')](_0x7f1d('0x10'),_0x51177a[_0x7f1d('0x11')]());return db[_0x7f1d('0x8')][_0x7f1d('0x12')]({'closeReason':_0x7f1d('0x13'),'disposition':_0x7f1d('0x14'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x51177a}});}})[_0x7f1d('0x15')](function(){if(_0x51177a&&_0x51177a[_0x7f1d('0xd')]){logger[_0x7f1d('0xf')](_0x7f1d('0x16'),_0x51177a[_0x7f1d('0x11')]());for(var _0x5e923b=0x0;_0x5e923b<_0x51177a[_0x7f1d('0xd')];_0x5e923b++){io[_0x7f1d('0x17')]('whatsappInteraction:update',{'id':_0x51177a[_0x5e923b],'closed':!![]});}}})['catch'](function(_0x18326b){logger['error'](_0x7f1d('0x18'),_0x18326b?util[_0x7f1d('0x19')](_0x18326b,{'showHidden':![],'depth':null}):'');});}exports[_0x7f1d('0x1a')]=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 4347ced..5d41a58 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b08=['@xcally.com','push','now','CmContact','destroy','then','log','finished\x20populating','contacts1','CmHopper','bulkCreate','hopper1','contacts2','hopper2','util','../mysqldb','Innocenzo','innocenzo.biondo'];(function(_0x2b41cd,_0x2b4d13){var _0x4d021b=function(_0x3b969e){while(--_0x3b969e){_0x2b41cd['push'](_0x2b41cd['shift']());}};_0x4d021b(++_0x2b4d13);}(_0x1b08,0x1be));var _0x81b0=function(_0x1ab313,_0x12bccc){_0x1ab313=_0x1ab313-0x0;var _0x2d73f4=_0x1b08[_0x1ab313];return _0x2d73f4;};'use strict';var util=require(_0x81b0('0x0'));var db=require(_0x81b0('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x81b0('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x81b0('0x3')+i+_0x81b0('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x81b0('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x81b0('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x81b0('0x6')](),'updatedAt':Date[_0x81b0('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x81b0('0x5')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x81b0('0x3')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x81b0('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x81b0('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x81b0('0x6')](),'updatedAt':Date[_0x81b0('0x6')]()});}db[_0x81b0('0x7')][_0x81b0('0x8')]({'where':{}})[_0x81b0('0x9')](function(){return db[_0x81b0('0x7')]['bulkCreate'](contacts);})[_0x81b0('0x9')](function(){console[_0x81b0('0xa')](_0x81b0('0xb'),_0x81b0('0xc'));return db[_0x81b0('0xd')][_0x81b0('0x8')]({'where':{}});})[_0x81b0('0x9')](function(){return db[_0x81b0('0xd')][_0x81b0('0xe')](hopper);})['then'](function(){console['log'](_0x81b0('0xb'),_0x81b0('0xf'));return db['CmContact'][_0x81b0('0xe')](contacts2);})[_0x81b0('0x9')](function(){console[_0x81b0('0xa')]('finished\x20populating',_0x81b0('0x10'));return db[_0x81b0('0xd')][_0x81b0('0xe')](hopper2);})['then'](function(){console['log'](_0x81b0('0xb'),_0x81b0('0x11'));})['catch'](function(_0xa3ffd2){console['log'](_0xa3ffd2);}); \ No newline at end of file +var _0x109d=['Innocenzo','innocenzo.biondo','now','Biondo','CmContact','destroy','bulkCreate','finished\x20populating','contacts1','CmHopper','then','log','contacts2','hopper2','catch','util','../mysqldb','push'];(function(_0x3060e3,_0x14f2c6){var _0x497d2c=function(_0x2a274a){while(--_0x2a274a){_0x3060e3['push'](_0x3060e3['shift']());}};_0x497d2c(++_0x14f2c6);}(_0x109d,0xf9));var _0xd109=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x109d[_0x502c7d];return _0x30b7ed;};'use strict';var util=require(_0xd109('0x0'));var db=require(_0xd109('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xd109('0x2')]({'id':i,'firstName':_0xd109('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xd109('0x4')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xd109('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xd109('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xd109('0x5')](),'updatedAt':Date[_0xd109('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xd109('0x2')]({'id':i,'firstName':_0xd109('0x3')+i,'lastName':_0xd109('0x6')+i,'phone':0xf879fb460+i,'email':_0xd109('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xd109('0x5')](),'updatedAt':Date['now']()});}db[_0xd109('0x7')][_0xd109('0x8')]({'where':{}})['then'](function(){return db[_0xd109('0x7')][_0xd109('0x9')](contacts);})['then'](function(){console['log'](_0xd109('0xa'),_0xd109('0xb'));return db[_0xd109('0xc')]['destroy']({'where':{}});})['then'](function(){return db[_0xd109('0xc')][_0xd109('0x9')](hopper);})[_0xd109('0xd')](function(){console[_0xd109('0xe')](_0xd109('0xa'),'hopper1');return db[_0xd109('0x7')][_0xd109('0x9')](contacts2);})[_0xd109('0xd')](function(){console[_0xd109('0xe')]('finished\x20populating',_0xd109('0xf'));return db[_0xd109('0xc')][_0xd109('0x9')](hopper2);})[_0xd109('0xd')](function(){console[_0xd109('0xe')](_0xd109('0xa'),_0xd109('0x10'));})[_0xd109('0x11')](function(_0x411641){console[_0xd109('0xe')](_0x411641);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 45f9253..0d9a127 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f60=['udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','%s%s','User','then','log','add\x20user','../mysqldb','push','format','agent','%s%s@xcally.com','password','friend'];(function(_0x34f162,_0x531a92){var _0x12c054=function(_0xbdb7df){while(--_0xbdb7df){_0x34f162['push'](_0x34f162['shift']());}};_0x12c054(++_0x531a92);}(_0x1f60,0x1c5));var _0x01f6=function(_0x14f02f,_0x48c4d0){_0x14f02f=_0x14f02f-0x0;var _0x12cd9c=_0x1f60[_0x14f02f];return _0x12cd9c;};'use strict';var util=require('util');var db=require(_0x01f6('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x01f6('0x1')]({'name':util[_0x01f6('0x2')]('%s%s',_0x01f6('0x3'),i),'fullname':util[_0x01f6('0x2')]('%s%s',_0x01f6('0x3'),i),'email':util['format'](_0x01f6('0x4'),'agent',i),'role':'agent','password':_0x01f6('0x5'),'internal':0xfa0+i,'type':_0x01f6('0x6'),'transport':[_0x01f6('0x7'),'ws',_0x01f6('0x8')],'disallow':[_0x01f6('0x9')],'allow':[_0x01f6('0xa')],'defaultuser':util['format']('%s%s',_0x01f6('0x3'),i),'encryption':_0x01f6('0xb'),'avpf':_0x01f6('0xb'),'force_avp':_0x01f6('0xb'),'icesupport':_0x01f6('0xb'),'dtlsenable':_0x01f6('0xb'),'dtlsverify':'no','dtlscertfile':_0x01f6('0xc'),'dtlsprivatekey':_0x01f6('0xd'),'dtlssetup':'actpass','callerid':util[_0x01f6('0x2')](_0x01f6('0xe'),util[_0x01f6('0x2')](_0x01f6('0xf'),'agent',i),0xfa0+i)});}db[_0x01f6('0x10')]['bulkCreate'](users)[_0x01f6('0x11')](function(){console[_0x01f6('0x12')](_0x01f6('0x13'));})['catch'](function(_0xa49625){console[_0x01f6('0x12')](_0xa49625);}); \ No newline at end of file +var _0xf1e7=['ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','bulkCreate','then','add\x20user','catch','log','../mysqldb','format','%s%s','agent','password','friend','udp','wss','all'];(function(_0x23c46f,_0xb8c6f9){var _0x35ec91=function(_0x4d1d5f){while(--_0x4d1d5f){_0x23c46f['push'](_0x23c46f['shift']());}};_0x35ec91(++_0xb8c6f9);}(_0xf1e7,0x137));var _0x7f1e=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xf1e7[_0x5f309e];return _0x487b5e;};'use strict';var util=require('util');var db=require(_0x7f1e('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x7f1e('0x1')](_0x7f1e('0x2'),_0x7f1e('0x3'),i),'fullname':util[_0x7f1e('0x1')]('%s%s',_0x7f1e('0x3'),i),'email':util[_0x7f1e('0x1')]('%s%s@xcally.com',_0x7f1e('0x3'),i),'role':_0x7f1e('0x3'),'password':_0x7f1e('0x4'),'internal':0xfa0+i,'type':_0x7f1e('0x5'),'transport':[_0x7f1e('0x6'),'ws',_0x7f1e('0x7')],'disallow':[_0x7f1e('0x8')],'allow':[_0x7f1e('0x9')],'defaultuser':util[_0x7f1e('0x1')](_0x7f1e('0x2'),'agent',i),'encryption':_0x7f1e('0xa'),'avpf':_0x7f1e('0xa'),'force_avp':_0x7f1e('0xa'),'icesupport':'yes','dtlsenable':_0x7f1e('0xa'),'dtlsverify':'no','dtlscertfile':_0x7f1e('0xb'),'dtlsprivatekey':_0x7f1e('0xc'),'dtlssetup':'actpass','callerid':util[_0x7f1e('0x1')](_0x7f1e('0xd'),util['format'](_0x7f1e('0x2'),_0x7f1e('0x3'),i),0xfa0+i)});}db[_0x7f1e('0xe')][_0x7f1e('0xf')](users)[_0x7f1e('0x10')](function(){console['log'](_0x7f1e('0x11'));})[_0x7f1e('0x12')](function(_0x13d118){console[_0x7f1e('0x13')](_0x13d118);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 3303a8b..eebf427 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafcb=['MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','resourceId','where','Campaign','format','%s:queue:%s','Agents','length','user:%s','query','handshake','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','hasOwnProperty','push','FaxQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','user','voice:outbound','userProfileId','VoiceQueue','ChatQueue','SmsQueues','OpenchannelQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','voice','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','map','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeWhatsappInteractions','catch','join','default','connection','setMaxListeners','address','request','remotePort','connectedAt','log','SocketIO\x20','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','User','role','agent','telephone','type','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues'];(function(_0x97bf23,_0x459503){var _0x219296=function(_0x47c944){while(--_0x47c944){_0x97bf23['push'](_0x97bf23['shift']());}};_0x219296(++_0x459503);}(_0xafcb,0xb6));var _0xbafc=function(_0x65f0de,_0x2d7dc4){_0x65f0de=_0x65f0de-0x0;var _0x2afdb3=_0xafcb[_0x65f0de];return _0x2afdb3;};'use strict';var _=require(_0xbafc('0x0'));var util=require(_0xbafc('0x1'));var BPromise=require(_0xbafc('0x2'));var db=require(_0xbafc('0x3'))['db'];var config=require(_0xbafc('0x4'));var queryQueues={'attributes':['id',_0xbafc('0x5')],'include':[{'as':'Agents','model':db[_0xbafc('0x6')],'attributes':['id',_0xbafc('0x5'),_0xbafc('0x7')],'raw':!![],'where':{'role':_0xbafc('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0xbafc('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0xbafc('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0xbafc('0x5')],'where':{'role':_0xbafc('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xbafc('0xa')],'where':{'type':_0xbafc('0xb')}};function getAssociatedResources(_0x46a9d5,_0x4900a7,_0x47ecdf){return db['UserProfileSection'][_0xbafc('0xc')]({'where':{'name':_0x46a9d5,'userProfileId':_0x4900a7},'raw':!![]})[_0xbafc('0xd')](function(_0xbd68ed){if(_0xbd68ed){if(_0xbd68ed[_0xbafc('0xe')]){switch(_0x46a9d5){case _0xbafc('0xf'):case _0xbafc('0x10'):case _0xbafc('0x11'):case'SmsQueues':case _0xbafc('0x12'):case _0xbafc('0x13'):case _0xbafc('0x14'):return db[_0x47ecdf][_0xbafc('0x15')](queryQueues);case _0xbafc('0x16'):return db[_0x47ecdf]['findAll'](queryTelephones);case _0xbafc('0x17'):return db[_0x47ecdf]['findAll'](queryTrunks);case _0xbafc('0x18'):return db[_0x47ecdf]['findAll'](queryCampaigns);}}else{return db['UserProfileResource']['findAll']({'attributes':[_0xbafc('0x19')],'where':{'sectionId':_0xbd68ed['id']},'raw':!![]})[_0xbafc('0xd')](function(_0x4fdc0b){if(_0x4fdc0b){var _0x2a0e99={'where':{'id':_['map'](_0x4fdc0b,_0xbafc('0x19'))},'raw':!![]};switch(_0x47ecdf){case'User':_0x2a0e99[_0xbafc('0x1a')]['role']=_0xbafc('0x9');break;case _0xbafc('0x1b'):_0x2a0e99['where'][_0xbafc('0xa')]='ivr';break;}return db[_0x47ecdf][_0xbafc('0x15')](_0x2a0e99);}else{return[];}});}}else{return[];}})[_0xbafc('0xd')](function(_0x79e09){return _0x79e09;});}function joinOrLeaveQueues(_0xdad822,_0x11d1ec,_0x39a715,_0x230914){_0xdad822[_0x11d1ec](util[_0xbafc('0x1c')](_0xbafc('0x1d'),_0x39a715,_0x230914[_0xbafc('0x5')]));if(_0x230914[_0xbafc('0x1e')]){for(var _0x1e5371=0x0;_0x1e5371<_0x230914[_0xbafc('0x1e')][_0xbafc('0x1f')];_0x1e5371+=0x1){_0xdad822[_0x11d1ec](util['format'](_0xbafc('0x20'),_0x230914['Agents'][_0x1e5371][_0xbafc('0x5')]));}}}function joinOrLeave(_0x4d825c,_0xfcb308,_0x3f0dca){var _0x5cec82;if(_0x4d825c['handshake'][_0xbafc('0x21')]['id']){db[_0xbafc('0x6')]['find']({'attributes':['id',_0xbafc('0x5'),_0xbafc('0x7'),'userProfileId'],'where':{'id':_0x4d825c[_0xbafc('0x22')]['query']['id']},'include':[{'model':db[_0xbafc('0x23')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xbafc('0x24')],'as':_0xbafc('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xbafc('0x26')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xbafc('0x27')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xbafc('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xbafc('0x29')],'as':_0xbafc('0x2a'),'attributes':['id'],'raw':!![]}]})[_0xbafc('0xd')](function(_0x29ccea){if(_0x29ccea){_0x5cec82=_0x29ccea;_0x4d825c[_0xfcb308](util['format'](_0xbafc('0x20'),_0x29ccea[_0xbafc('0x5')]));var _0x871e69=[];switch(_0x29ccea[_0xbafc('0x7')]){case _0xbafc('0x2b'):_0x4d825c[_0xfcb308](_0xbafc('0x2c'));_0x4d825c[_0xfcb308]('voice:outbound');if(queryQueues[_0xbafc('0x2d')]('include')){delete queryQueues['include'];}_0x871e69[_0xbafc('0x2e')](db['VoiceQueue']['findAll'](queryQueues));_0x871e69[_0xbafc('0x2e')](db['ChatQueue'][_0xbafc('0x15')](queryQueues));_0x871e69['push'](db[_0xbafc('0x2f')][_0xbafc('0x15')](queryQueues));_0x871e69[_0xbafc('0x2e')](db[_0xbafc('0x30')][_0xbafc('0x15')](queryQueues));_0x871e69['push'](db[_0xbafc('0x31')][_0xbafc('0x15')](queryQueues));_0x871e69[_0xbafc('0x2e')](db['OpenchannelQueue'][_0xbafc('0x15')](queryQueues));_0x871e69[_0xbafc('0x2e')](db[_0xbafc('0x32')]['findAll'](queryQueues));_0x871e69[_0xbafc('0x2e')](db[_0xbafc('0x6')][_0xbafc('0x15')](queryTelephones));_0x871e69[_0xbafc('0x2e')](db[_0xbafc('0x33')][_0xbafc('0x15')](queryTrunks));_0x871e69[_0xbafc('0x2e')](db[_0xbafc('0x1b')][_0xbafc('0x15')](queryCampaigns));_0x871e69[_0xbafc('0x2e')](db[_0xbafc('0x6')][_0xbafc('0x15')](queryAgents));break;case _0xbafc('0x34'):_0x4d825c[_0xfcb308]('voice:inbound');_0x4d825c[_0xfcb308](_0xbafc('0x35'));_0x871e69[_0xbafc('0x2e')](getAssociatedResources('VoiceQueues',_0x29ccea[_0xbafc('0x36')],_0xbafc('0x37')));_0x871e69['push'](getAssociatedResources(_0xbafc('0x10'),_0x29ccea[_0xbafc('0x36')],_0xbafc('0x38')));_0x871e69['push'](getAssociatedResources(_0xbafc('0x11'),_0x29ccea[_0xbafc('0x36')],_0xbafc('0x2f')));_0x871e69[_0xbafc('0x2e')](getAssociatedResources(_0xbafc('0x39'),_0x29ccea[_0xbafc('0x36')],_0xbafc('0x30')));_0x871e69[_0xbafc('0x2e')](getAssociatedResources(_0xbafc('0x12'),_0x29ccea[_0xbafc('0x36')],'MailQueue'));_0x871e69[_0xbafc('0x2e')](getAssociatedResources(_0xbafc('0x13'),_0x29ccea[_0xbafc('0x36')],_0xbafc('0x3a')));_0x871e69[_0xbafc('0x2e')](getAssociatedResources('WhatsappQueues',_0x29ccea[_0xbafc('0x36')],'WhatsappQueue'));_0x871e69[_0xbafc('0x2e')](getAssociatedResources(_0xbafc('0x16'),_0x29ccea[_0xbafc('0x36')],_0xbafc('0x6')));_0x871e69[_0xbafc('0x2e')](getAssociatedResources(_0xbafc('0x17'),_0x29ccea[_0xbafc('0x36')],_0xbafc('0x33')));_0x871e69[_0xbafc('0x2e')](getAssociatedResources(_0xbafc('0x18'),_0x29ccea[_0xbafc('0x36')],_0xbafc('0x1b')));_0x871e69[_0xbafc('0x2e')](db['User'][_0xbafc('0x15')](queryAgents));break;case'agent':_0x4d825c[_0xfcb308](_0xbafc('0x2c'));_0x4d825c[_0xfcb308](_0xbafc('0x35'));_0x871e69[_0xbafc('0x2e')](_0x29ccea[_0xbafc('0x3b')]({'attributes':['id','name']}));_0x871e69['push'](_0x29ccea[_0xbafc('0x3c')]({'attributes':['id',_0xbafc('0x5')]}));_0x871e69['push'](_0x29ccea[_0xbafc('0x3d')]({'attributes':['id',_0xbafc('0x5')]}));_0x871e69['push'](_0x29ccea[_0xbafc('0x3e')]({'attributes':['id',_0xbafc('0x5')]}));_0x871e69[_0xbafc('0x2e')](_0x29ccea[_0xbafc('0x3f')]({'attributes':['id',_0xbafc('0x5')]}));_0x871e69[_0xbafc('0x2e')](_0x29ccea['getOpenchannelQueues']({'attributes':['id',_0xbafc('0x5')]}));_0x871e69['push'](_0x29ccea[_0xbafc('0x40')]({'attributes':['id','name']}));break;}return BPromise[_0xbafc('0x41')](_0x871e69);}})[_0xbafc('0xd')](function(_0x44686f){if(_0x44686f&&_0x44686f[_0xbafc('0x1f')]){for(var _0x5402e7=0x0;_0x5402e7<_0x44686f[_0xbafc('0x1f')];_0x5402e7+=0x1){for(var _0x14d85f=0x0;_0x14d85f<_0x44686f[_0x5402e7]['length'];_0x14d85f+=0x1){switch(_0x5402e7){case 0x0:joinOrLeaveQueues(_0x4d825c,_0xfcb308,_0xbafc('0x42'),_0x44686f[_0x5402e7][_0x14d85f]);break;case 0x1:joinOrLeaveQueues(_0x4d825c,_0xfcb308,'chat',_0x44686f[_0x5402e7][_0x14d85f]);break;case 0x2:joinOrLeaveQueues(_0x4d825c,_0xfcb308,_0xbafc('0x43'),_0x44686f[_0x5402e7][_0x14d85f]);break;case 0x3:joinOrLeaveQueues(_0x4d825c,_0xfcb308,_0xbafc('0x44'),_0x44686f[_0x5402e7][_0x14d85f]);break;case 0x4:joinOrLeaveQueues(_0x4d825c,_0xfcb308,_0xbafc('0x45'),_0x44686f[_0x5402e7][_0x14d85f]);break;case 0x5:joinOrLeaveQueues(_0x4d825c,_0xfcb308,'openchannel',_0x44686f[_0x5402e7][_0x14d85f]);break;case 0x6:joinOrLeaveQueues(_0x4d825c,_0xfcb308,_0xbafc('0x46'),_0x44686f[_0x5402e7][_0x14d85f]);break;case 0x7:if(_0x5cec82[_0xbafc('0x7')]!==_0xbafc('0x8'))_0x4d825c[_0xfcb308](util[_0xbafc('0x1c')](_0xbafc('0x47'),_0x44686f[_0x5402e7][_0x14d85f]['name']));break;case 0x8:if(_0x5cec82['role']!=='agent')_0x4d825c[_0xfcb308](util['format'](_0xbafc('0x48'),_0x44686f[_0x5402e7][_0x14d85f][_0xbafc('0x5')]));break;case 0x9:if(_0x5cec82[_0xbafc('0x7')]!=='agent')_0x4d825c[_0xfcb308](util[_0xbafc('0x1c')]('campaign:%s:%s',_0x44686f[_0x5402e7][_0x14d85f]['type'],_0x44686f[_0x5402e7][_0x14d85f][_0xbafc('0x5')]));break;case 0xa:_0x4d825c[_0xfcb308](util[_0xbafc('0x1c')](_0xbafc('0x20'),_0x44686f[_0x5402e7][_0x14d85f][_0xbafc('0x5')]));break;}}}}})[_0xbafc('0xd')](function(){if(_0xfcb308===_0xbafc('0x49')){var _0x4f6c02=_['map'](_0x5cec82['ChatInteractions'],'id');return _0x5cec82[_0xbafc('0x4a')](_0x4f6c02)[_0xbafc('0xd')](function(){for(var _0x4c4cfa=0x0;_0x4c4cfa<_0x4f6c02[_0xbafc('0x1f')];_0x4c4cfa+=0x1){_0x3f0dca[_0xbafc('0x4b')](_0xbafc('0x4c'),{'ChatInteractionId':Number(_0x4f6c02[_0x4c4cfa]),'UserId':Number(_0x5cec82['id'])});}});}})[_0xbafc('0xd')](function(){if(_0xfcb308==='leave'){var _0x41d332=_[_0xbafc('0x4d')](_0x5cec82[_0xbafc('0x25')],'id');return _0x5cec82[_0xbafc('0x4e')](_0x41d332)[_0xbafc('0xd')](function(){for(var _0x413212=0x0;_0x413212<_0x41d332[_0xbafc('0x1f')];_0x413212+=0x1){_0x3f0dca[_0xbafc('0x4b')](_0xbafc('0x4f'),{'MailInteractionId':Number(_0x41d332[_0x413212]),'UserId':Number(_0x5cec82['id'])});}});}})['then'](function(){if(_0xfcb308===_0xbafc('0x49')){var _0x4b0443=_[_0xbafc('0x4d')](_0x5cec82[_0xbafc('0x50')],'id');return _0x5cec82[_0xbafc('0x51')](_0x4b0443)[_0xbafc('0xd')](function(){for(var _0x3ea533=0x0;_0x3ea533<_0x4b0443[_0xbafc('0x1f')];_0x3ea533+=0x1){_0x3f0dca['emit'](_0xbafc('0x52'),{'FaxInteractionId':Number(_0x4b0443[_0x3ea533]),'UserId':Number(_0x5cec82['id'])});}});}})[_0xbafc('0xd')](function(){if(_0xfcb308==='leave'){var _0x51f92a=_['map'](_0x5cec82[_0xbafc('0x53')],'id');return _0x5cec82[_0xbafc('0x54')](_0x51f92a)['then'](function(){for(var _0xeaae37=0x0;_0xeaae37<_0x51f92a[_0xbafc('0x1f')];_0xeaae37+=0x1){_0x3f0dca[_0xbafc('0x4b')](_0xbafc('0x55'),{'SmsInteractionId':Number(_0x51f92a[_0xeaae37]),'UserId':Number(_0x5cec82['id'])});}});}})['then'](function(){if(_0xfcb308==='leave'){var _0x367881=_[_0xbafc('0x4d')](_0x5cec82[_0xbafc('0x28')],'id');return _0x5cec82['removeOpenchannelInteractions'](_0x367881)[_0xbafc('0xd')](function(){for(var _0x4e08b5=0x0;_0x4e08b5<_0x367881[_0xbafc('0x1f')];_0x4e08b5+=0x1){_0x3f0dca[_0xbafc('0x4b')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x367881[_0x4e08b5]),'UserId':Number(_0x5cec82['id'])});}});}})[_0xbafc('0xd')](function(){if(_0xfcb308===_0xbafc('0x49')){var _0x1cf861=_[_0xbafc('0x4d')](_0x5cec82[_0xbafc('0x2a')],'id');return _0x5cec82[_0xbafc('0x56')](_0x1cf861)[_0xbafc('0xd')](function(){for(var _0x515409=0x0;_0x515409<_0x1cf861[_0xbafc('0x1f')];_0x515409+=0x1){_0x3f0dca[_0xbafc('0x4b')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x1cf861[_0x515409]),'UserId':Number(_0x5cec82['id'])});}});}})[_0xbafc('0x57')](function(_0x2dd89f){_0x4d825c['log'](_0x2dd89f);});}}function onDisconnect(_0x5c94ce,_0x5edf49){joinOrLeave(_0x5c94ce,_0xbafc('0x49'),_0x5edf49);}function onConnect(_0xb8cc2){joinOrLeave(_0xb8cc2,_0xbafc('0x58'));}exports[_0xbafc('0x59')]=function(_0x36c591){_0x36c591['on'](_0xbafc('0x5a'),function(_0x5d8150){_0x5d8150[_0xbafc('0x5b')](0x0);_0x5d8150[_0xbafc('0x5c')]=_0x5d8150[_0xbafc('0x5d')][_0xbafc('0x5a')]['remoteAddress']+':'+_0x5d8150['request'][_0xbafc('0x5a')][_0xbafc('0x5e')];_0x5d8150[_0xbafc('0x5f')]=new Date();_0x5d8150['log']=function(_0x1a6212){console[_0xbafc('0x60')](_0xbafc('0x61')+_0x5d8150['nsp'][_0xbafc('0x5')]+'['+_0x5d8150[_0xbafc('0x5c')]+']',_0x1a6212);};_0x5d8150['on']('disconnect',function(){onDisconnect(_0x5d8150,_0x36c591);_0x5d8150[_0xbafc('0x60')](_0xbafc('0x62'));});onConnect(_0x5d8150);_0x5d8150[_0xbafc('0x60')](_0xbafc('0x63'));});}; \ No newline at end of file +var _0x9b2c=['FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','%s:queue:%s','format','handshake','query','User','find','userProfileId','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','MailQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Telephones','Trunk','voice:inbound','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','length','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','address','remoteAddress','request','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','util','bluebird','./environment','Agents','name','role','agent','telephone','type','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues'];(function(_0x57d294,_0x1d1e6c){var _0x42f235=function(_0x3df8e4){while(--_0x3df8e4){_0x57d294['push'](_0x57d294['shift']());}};_0x42f235(++_0x1d1e6c);}(_0x9b2c,0x189));var _0xc9b2=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x9b2c[_0x1cfa0d];return _0xe33279;};'use strict';var _=require('lodash');var util=require(_0xc9b2('0x0'));var BPromise=require(_0xc9b2('0x1'));var db=require('../mysqldb')['db'];var config=require(_0xc9b2('0x2'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xc9b2('0x3'),'model':db['User'],'attributes':['id',_0xc9b2('0x4'),_0xc9b2('0x5')],'raw':!![],'where':{'role':_0xc9b2('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xc9b2('0x4')],'where':{'role':_0xc9b2('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xc9b2('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xc9b2('0x4')],'where':{'role':_0xc9b2('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xc9b2('0x4'),_0xc9b2('0x8')],'where':{'type':_0xc9b2('0x9')}};function getAssociatedResources(_0x485792,_0x1a9ae7,_0x49b2fb){return db['UserProfileSection'][_0xc9b2('0xa')]({'where':{'name':_0x485792,'userProfileId':_0x1a9ae7},'raw':!![]})[_0xc9b2('0xb')](function(_0x137e38){if(_0x137e38){if(_0x137e38[_0xc9b2('0xc')]){switch(_0x485792){case _0xc9b2('0xd'):case _0xc9b2('0xe'):case _0xc9b2('0xf'):case _0xc9b2('0x10'):case _0xc9b2('0x11'):case _0xc9b2('0x12'):case _0xc9b2('0x13'):return db[_0x49b2fb][_0xc9b2('0x14')](queryQueues);case'Telephones':return db[_0x49b2fb][_0xc9b2('0x14')](queryTelephones);case _0xc9b2('0x15'):return db[_0x49b2fb][_0xc9b2('0x14')](queryTrunks);case _0xc9b2('0x16'):return db[_0x49b2fb]['findAll'](queryCampaigns);}}else{return db[_0xc9b2('0x17')][_0xc9b2('0x14')]({'attributes':[_0xc9b2('0x18')],'where':{'sectionId':_0x137e38['id']},'raw':!![]})[_0xc9b2('0xb')](function(_0xe8c3d8){if(_0xe8c3d8){var _0xc37dd={'where':{'id':_[_0xc9b2('0x19')](_0xe8c3d8,_0xc9b2('0x18'))},'raw':!![]};switch(_0x49b2fb){case'User':_0xc37dd[_0xc9b2('0x1a')][_0xc9b2('0x5')]=_0xc9b2('0x7');break;case _0xc9b2('0x1b'):_0xc37dd['where'][_0xc9b2('0x8')]=_0xc9b2('0x9');break;}return db[_0x49b2fb][_0xc9b2('0x14')](_0xc37dd);}else{return[];}});}}else{return[];}})[_0xc9b2('0xb')](function(_0x15c6ed){return _0x15c6ed;});}function joinOrLeaveQueues(_0x43fb7a,_0x1484db,_0x50352c,_0x474970){_0x43fb7a[_0x1484db](util['format'](_0xc9b2('0x1c'),_0x50352c,_0x474970[_0xc9b2('0x4')]));if(_0x474970['Agents']){for(var _0x18237a=0x0;_0x18237a<_0x474970[_0xc9b2('0x3')]['length'];_0x18237a+=0x1){_0x43fb7a[_0x1484db](util[_0xc9b2('0x1d')]('user:%s',_0x474970[_0xc9b2('0x3')][_0x18237a][_0xc9b2('0x4')]));}}}function joinOrLeave(_0x8836e4,_0x13006d,_0x20875a){var _0x16e0e6;if(_0x8836e4[_0xc9b2('0x1e')][_0xc9b2('0x1f')]['id']){db[_0xc9b2('0x20')][_0xc9b2('0x21')]({'attributes':['id','name',_0xc9b2('0x5'),_0xc9b2('0x22')],'where':{'id':_0x8836e4[_0xc9b2('0x1e')][_0xc9b2('0x1f')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0xc9b2('0x23'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xc9b2('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xc9b2('0x25')],'as':_0xc9b2('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xc9b2('0x27')],'as':_0xc9b2('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xc9b2('0x29')],'as':_0xc9b2('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0xc9b2('0x2b')],'as':_0xc9b2('0x2c'),'attributes':['id'],'raw':!![]}]})[_0xc9b2('0xb')](function(_0x16936f){if(_0x16936f){_0x16e0e6=_0x16936f;_0x8836e4[_0x13006d](util[_0xc9b2('0x1d')](_0xc9b2('0x2d'),_0x16936f[_0xc9b2('0x4')]));var _0x115fe9=[];switch(_0x16936f[_0xc9b2('0x5')]){case'admin':_0x8836e4[_0x13006d]('voice:inbound');_0x8836e4[_0x13006d](_0xc9b2('0x2e'));if(queryQueues[_0xc9b2('0x2f')](_0xc9b2('0x30'))){delete queryQueues['include'];}_0x115fe9[_0xc9b2('0x31')](db['VoiceQueue'][_0xc9b2('0x14')](queryQueues));_0x115fe9[_0xc9b2('0x31')](db[_0xc9b2('0x32')][_0xc9b2('0x14')](queryQueues));_0x115fe9[_0xc9b2('0x31')](db[_0xc9b2('0x33')][_0xc9b2('0x14')](queryQueues));_0x115fe9[_0xc9b2('0x31')](db['SmsQueue'][_0xc9b2('0x14')](queryQueues));_0x115fe9[_0xc9b2('0x31')](db[_0xc9b2('0x34')][_0xc9b2('0x14')](queryQueues));_0x115fe9['push'](db['OpenchannelQueue'][_0xc9b2('0x14')](queryQueues));_0x115fe9[_0xc9b2('0x31')](db['WhatsappQueue']['findAll'](queryQueues));_0x115fe9[_0xc9b2('0x31')](db['User'][_0xc9b2('0x14')](queryTelephones));_0x115fe9[_0xc9b2('0x31')](db['Trunk'][_0xc9b2('0x14')](queryTrunks));_0x115fe9[_0xc9b2('0x31')](db[_0xc9b2('0x1b')]['findAll'](queryCampaigns));_0x115fe9[_0xc9b2('0x31')](db[_0xc9b2('0x20')][_0xc9b2('0x14')](queryAgents));break;case'user':_0x8836e4[_0x13006d]('voice:inbound');_0x8836e4[_0x13006d](_0xc9b2('0x2e'));_0x115fe9['push'](getAssociatedResources(_0xc9b2('0xd'),_0x16936f[_0xc9b2('0x22')],'VoiceQueue'));_0x115fe9[_0xc9b2('0x31')](getAssociatedResources(_0xc9b2('0xe'),_0x16936f[_0xc9b2('0x22')],'ChatQueue'));_0x115fe9[_0xc9b2('0x31')](getAssociatedResources(_0xc9b2('0xf'),_0x16936f[_0xc9b2('0x22')],_0xc9b2('0x33')));_0x115fe9[_0xc9b2('0x31')](getAssociatedResources('SmsQueues',_0x16936f[_0xc9b2('0x22')],_0xc9b2('0x35')));_0x115fe9[_0xc9b2('0x31')](getAssociatedResources(_0xc9b2('0x11'),_0x16936f[_0xc9b2('0x22')],_0xc9b2('0x34')));_0x115fe9[_0xc9b2('0x31')](getAssociatedResources(_0xc9b2('0x12'),_0x16936f[_0xc9b2('0x22')],_0xc9b2('0x36')));_0x115fe9[_0xc9b2('0x31')](getAssociatedResources(_0xc9b2('0x13'),_0x16936f[_0xc9b2('0x22')],_0xc9b2('0x37')));_0x115fe9['push'](getAssociatedResources(_0xc9b2('0x38'),_0x16936f[_0xc9b2('0x22')],_0xc9b2('0x20')));_0x115fe9[_0xc9b2('0x31')](getAssociatedResources('Trunks',_0x16936f[_0xc9b2('0x22')],_0xc9b2('0x39')));_0x115fe9['push'](getAssociatedResources(_0xc9b2('0x16'),_0x16936f[_0xc9b2('0x22')],'Campaign'));_0x115fe9[_0xc9b2('0x31')](db['User']['findAll'](queryAgents));break;case _0xc9b2('0x6'):_0x8836e4[_0x13006d](_0xc9b2('0x3a'));_0x8836e4[_0x13006d](_0xc9b2('0x2e'));_0x115fe9[_0xc9b2('0x31')](_0x16936f[_0xc9b2('0x3b')]({'attributes':['id',_0xc9b2('0x4')]}));_0x115fe9[_0xc9b2('0x31')](_0x16936f[_0xc9b2('0x3c')]({'attributes':['id',_0xc9b2('0x4')]}));_0x115fe9['push'](_0x16936f[_0xc9b2('0x3d')]({'attributes':['id',_0xc9b2('0x4')]}));_0x115fe9[_0xc9b2('0x31')](_0x16936f[_0xc9b2('0x3e')]({'attributes':['id',_0xc9b2('0x4')]}));_0x115fe9[_0xc9b2('0x31')](_0x16936f[_0xc9b2('0x3f')]({'attributes':['id','name']}));_0x115fe9[_0xc9b2('0x31')](_0x16936f['getOpenchannelQueues']({'attributes':['id',_0xc9b2('0x4')]}));_0x115fe9[_0xc9b2('0x31')](_0x16936f['getWhatsappQueues']({'attributes':['id',_0xc9b2('0x4')]}));break;}return BPromise['all'](_0x115fe9);}})[_0xc9b2('0xb')](function(_0x39f942){if(_0x39f942&&_0x39f942['length']){for(var _0xf9e8f1=0x0;_0xf9e8f1<_0x39f942['length'];_0xf9e8f1+=0x1){for(var _0x432296=0x0;_0x432296<_0x39f942[_0xf9e8f1][_0xc9b2('0x40')];_0x432296+=0x1){switch(_0xf9e8f1){case 0x0:joinOrLeaveQueues(_0x8836e4,_0x13006d,'voice',_0x39f942[_0xf9e8f1][_0x432296]);break;case 0x1:joinOrLeaveQueues(_0x8836e4,_0x13006d,_0xc9b2('0x41'),_0x39f942[_0xf9e8f1][_0x432296]);break;case 0x2:joinOrLeaveQueues(_0x8836e4,_0x13006d,_0xc9b2('0x42'),_0x39f942[_0xf9e8f1][_0x432296]);break;case 0x3:joinOrLeaveQueues(_0x8836e4,_0x13006d,_0xc9b2('0x43'),_0x39f942[_0xf9e8f1][_0x432296]);break;case 0x4:joinOrLeaveQueues(_0x8836e4,_0x13006d,_0xc9b2('0x44'),_0x39f942[_0xf9e8f1][_0x432296]);break;case 0x5:joinOrLeaveQueues(_0x8836e4,_0x13006d,_0xc9b2('0x45'),_0x39f942[_0xf9e8f1][_0x432296]);break;case 0x6:joinOrLeaveQueues(_0x8836e4,_0x13006d,_0xc9b2('0x46'),_0x39f942[_0xf9e8f1][_0x432296]);break;case 0x7:if(_0x16e0e6[_0xc9b2('0x5')]!=='agent')_0x8836e4[_0x13006d](util['format'](_0xc9b2('0x47'),_0x39f942[_0xf9e8f1][_0x432296][_0xc9b2('0x4')]));break;case 0x8:if(_0x16e0e6['role']!==_0xc9b2('0x6'))_0x8836e4[_0x13006d](util[_0xc9b2('0x1d')](_0xc9b2('0x48'),_0x39f942[_0xf9e8f1][_0x432296][_0xc9b2('0x4')]));break;case 0x9:if(_0x16e0e6['role']!==_0xc9b2('0x6'))_0x8836e4[_0x13006d](util[_0xc9b2('0x1d')](_0xc9b2('0x49'),_0x39f942[_0xf9e8f1][_0x432296][_0xc9b2('0x8')],_0x39f942[_0xf9e8f1][_0x432296]['name']));break;case 0xa:_0x8836e4[_0x13006d](util['format'](_0xc9b2('0x2d'),_0x39f942[_0xf9e8f1][_0x432296][_0xc9b2('0x4')]));break;}}}}})[_0xc9b2('0xb')](function(){if(_0x13006d==='leave'){var _0x27533d=_[_0xc9b2('0x19')](_0x16e0e6[_0xc9b2('0x23')],'id');return _0x16e0e6[_0xc9b2('0x4a')](_0x27533d)[_0xc9b2('0xb')](function(){for(var _0x3ed9e2=0x0;_0x3ed9e2<_0x27533d['length'];_0x3ed9e2+=0x1){_0x20875a[_0xc9b2('0x4b')](_0xc9b2('0x4c'),{'ChatInteractionId':Number(_0x27533d[_0x3ed9e2]),'UserId':Number(_0x16e0e6['id'])});}});}})[_0xc9b2('0xb')](function(){if(_0x13006d===_0xc9b2('0x4d')){var _0x96d7b2=_['map'](_0x16e0e6[_0xc9b2('0x24')],'id');return _0x16e0e6[_0xc9b2('0x4e')](_0x96d7b2)[_0xc9b2('0xb')](function(){for(var _0x58d391=0x0;_0x58d391<_0x96d7b2[_0xc9b2('0x40')];_0x58d391+=0x1){_0x20875a[_0xc9b2('0x4b')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x96d7b2[_0x58d391]),'UserId':Number(_0x16e0e6['id'])});}});}})[_0xc9b2('0xb')](function(){if(_0x13006d===_0xc9b2('0x4d')){var _0x59f8b1=_[_0xc9b2('0x19')](_0x16e0e6[_0xc9b2('0x26')],'id');return _0x16e0e6[_0xc9b2('0x4f')](_0x59f8b1)['then'](function(){for(var _0x25721a=0x0;_0x25721a<_0x59f8b1[_0xc9b2('0x40')];_0x25721a+=0x1){_0x20875a[_0xc9b2('0x4b')](_0xc9b2('0x50'),{'FaxInteractionId':Number(_0x59f8b1[_0x25721a]),'UserId':Number(_0x16e0e6['id'])});}});}})[_0xc9b2('0xb')](function(){if(_0x13006d==='leave'){var _0x379890=_[_0xc9b2('0x19')](_0x16e0e6[_0xc9b2('0x28')],'id');return _0x16e0e6[_0xc9b2('0x51')](_0x379890)[_0xc9b2('0xb')](function(){for(var _0x3c51fb=0x0;_0x3c51fb<_0x379890[_0xc9b2('0x40')];_0x3c51fb+=0x1){_0x20875a['emit'](_0xc9b2('0x52'),{'SmsInteractionId':Number(_0x379890[_0x3c51fb]),'UserId':Number(_0x16e0e6['id'])});}});}})[_0xc9b2('0xb')](function(){if(_0x13006d===_0xc9b2('0x4d')){var _0x326b4d=_[_0xc9b2('0x19')](_0x16e0e6[_0xc9b2('0x2a')],'id');return _0x16e0e6[_0xc9b2('0x53')](_0x326b4d)[_0xc9b2('0xb')](function(){for(var _0x5eb945=0x0;_0x5eb945<_0x326b4d[_0xc9b2('0x40')];_0x5eb945+=0x1){_0x20875a[_0xc9b2('0x4b')](_0xc9b2('0x54'),{'OpenchannelInteractionId':Number(_0x326b4d[_0x5eb945]),'UserId':Number(_0x16e0e6['id'])});}});}})['then'](function(){if(_0x13006d===_0xc9b2('0x4d')){var _0x423b58=_['map'](_0x16e0e6[_0xc9b2('0x2c')],'id');return _0x16e0e6[_0xc9b2('0x55')](_0x423b58)[_0xc9b2('0xb')](function(){for(var _0x5a0bf7=0x0;_0x5a0bf7<_0x423b58[_0xc9b2('0x40')];_0x5a0bf7+=0x1){_0x20875a[_0xc9b2('0x4b')](_0xc9b2('0x56'),{'WhatsappInteractionId':Number(_0x423b58[_0x5a0bf7]),'UserId':Number(_0x16e0e6['id'])});}});}})[_0xc9b2('0x57')](function(_0x4a4e32){_0x8836e4[_0xc9b2('0x58')](_0x4a4e32);});}}function onDisconnect(_0x28e07,_0x4f6195){joinOrLeave(_0x28e07,_0xc9b2('0x4d'),_0x4f6195);}function onConnect(_0x2dd7d9){joinOrLeave(_0x2dd7d9,_0xc9b2('0x59'));}exports[_0xc9b2('0x5a')]=function(_0x26444b){_0x26444b['on'](_0xc9b2('0x5b'),function(_0x51268b){_0x51268b['setMaxListeners'](0x0);_0x51268b[_0xc9b2('0x5c')]=_0x51268b['request'][_0xc9b2('0x5b')][_0xc9b2('0x5d')]+':'+_0x51268b[_0xc9b2('0x5e')]['connection'][_0xc9b2('0x5f')];_0x51268b[_0xc9b2('0x60')]=new Date();_0x51268b[_0xc9b2('0x58')]=function(_0x58f991){console['log'](_0xc9b2('0x61')+_0x51268b[_0xc9b2('0x62')][_0xc9b2('0x4')]+'['+_0x51268b[_0xc9b2('0x5c')]+']',_0x58f991);};_0x51268b['on'](_0xc9b2('0x63'),function(){onDisconnect(_0x51268b,_0x26444b);_0x51268b[_0xc9b2('0x58')](_0xc9b2('0x64'));});onConnect(_0x51268b);_0x51268b['log'](_0xc9b2('0x65'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 7167352..62c1cea 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 _0x6b86=['agent','outgoingmessage','contact','changed','closed','fullname','format','SIP/%s','length','hasOwnProperty','model','hook','callback','toLowerCase','util','../../mysqldb','../logger','triggers','lodash','client','http','Chat','afterCreate','newinteraction','ChatInteraction','afterUpdate','closedinteraction','Sms','SmsInteraction','SmsMessage','newmessage','WhatsappInteraction','Whatsapp','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','then','info','Trigger,\x20%s','EventManager','error','code','catch','get','event','direction','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','query','Sequelize','QueryTypes','SELECT','User','find','UserId','name','internal','interface','channel'];(function(_0x296144,_0x26bbbf){var _0x5329b1=function(_0x5d321b){while(--_0x5d321b){_0x296144['push'](_0x296144['shift']());}};_0x5329b1(++_0x26bbbf);}(_0x6b86,0x158));var _0x66b8=function(_0x2a48e9,_0x30e145){_0x2a48e9=_0x2a48e9-0x0;var _0x585705=_0x6b86[_0x2a48e9];return _0x585705;};'use strict';var util=require(_0x66b8('0x0'));var db=require(_0x66b8('0x1'))['db'];var jayson=require('jayson/promise');var logger=require(_0x66b8('0x2'))(_0x66b8('0x3'));var _=require(_0x66b8('0x4'));var client=jayson[_0x66b8('0x5')][_0x66b8('0x6')]({'port':0x232a});var triggers=[{'channel':_0x66b8('0x7'),'model':'ChatInteraction','event':_0x66b8('0x8'),'condition':_0x66b8('0x9'),'callback':afterCreate},{'channel':_0x66b8('0x7'),'model':_0x66b8('0xa'),'event':_0x66b8('0xb'),'condition':_0x66b8('0xc'),'callback':afterUpdate},{'channel':_0x66b8('0x7'),'model':'ChatMessage','event':_0x66b8('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x66b8('0xd'),'model':_0x66b8('0xe'),'event':'afterCreate','condition':_0x66b8('0x9'),'callback':afterCreate},{'channel':'Sms','model':'SmsInteraction','event':_0x66b8('0xb'),'condition':_0x66b8('0xc'),'callback':afterUpdate},{'channel':_0x66b8('0xd'),'model':_0x66b8('0xf'),'event':_0x66b8('0x8'),'condition':_0x66b8('0x10'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x66b8('0x11'),'event':_0x66b8('0x8'),'condition':_0x66b8('0x9'),'callback':afterCreate},{'channel':_0x66b8('0x12'),'model':_0x66b8('0x11'),'event':'afterUpdate','condition':_0x66b8('0xc'),'callback':afterUpdate},{'channel':'Whatsapp','model':'WhatsappMessage','event':_0x66b8('0x8'),'condition':_0x66b8('0x10'),'callback':afterCreateMessage},{'channel':_0x66b8('0x13'),'model':_0x66b8('0x14'),'event':_0x66b8('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x66b8('0x13'),'model':_0x66b8('0x14'),'event':'afterUpdate','condition':_0x66b8('0xc'),'callback':afterUpdate},{'channel':_0x66b8('0x13'),'model':_0x66b8('0x15'),'event':_0x66b8('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x66b8('0x16'),'model':_0x66b8('0x17'),'event':_0x66b8('0x8'),'condition':_0x66b8('0x9'),'callback':afterCreate},{'channel':'Mail','model':_0x66b8('0x17'),'event':_0x66b8('0xb'),'condition':_0x66b8('0xc'),'callback':afterUpdate},{'channel':_0x66b8('0x16'),'model':'MailMessage','event':_0x66b8('0x8'),'condition':_0x66b8('0x10'),'callback':afterCreateMessage},{'channel':_0x66b8('0x18'),'model':_0x66b8('0x19'),'event':_0x66b8('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':'Openchannel','model':_0x66b8('0x19'),'event':_0x66b8('0xb'),'condition':_0x66b8('0xc'),'callback':afterUpdate},{'channel':_0x66b8('0x18'),'model':_0x66b8('0x1a'),'event':_0x66b8('0x8'),'condition':_0x66b8('0x10'),'callback':afterCreateMessage}];function request(_0x590060){return client[_0x66b8('0x1b')]('EventManager',_0x590060)[_0x66b8('0x1c')](function(_0x306a80){logger[_0x66b8('0x1d')](_0x66b8('0x1e'),_0x66b8('0x1f'),_0x306a80);if(_0x306a80[_0x66b8('0x20')]){if(_0x306a80[_0x66b8('0x20')][_0x66b8('0x21')]===0x1f4){logger[_0x66b8('0x20')](_0x66b8('0x1e'),'EventManager',_0x306a80['error']);}}})[_0x66b8('0x22')](function(_0x5d42de){logger[_0x66b8('0x20')](_0x66b8('0x1e'),_0x66b8('0x1f'),_0x5d42de);});}function afterCreateMessage(_0x15138b,_0x1cf44d){return function(_0x4a1b64,_0x58dd14){_0x4a1b64=_0x4a1b64[_0x66b8('0x23')]({'plain':!![]});_0x4a1b64['channel']=_0x15138b;_0x4a1b64[_0x66b8('0x24')]=_0x4a1b64[_0x66b8('0x25')];var _0x429318=_0x66b8('0x26')+_0x4a1b64[_0x66b8('0x27')];return db[_0x66b8('0x28')][_0x66b8('0x29')](_0x429318,{'type':db[_0x66b8('0x2a')][_0x66b8('0x2b')][_0x66b8('0x2c')],'raw':!![]})[_0x66b8('0x1c')](function(_0x12f0f8){return _0x12f0f8;})[_0x66b8('0x1c')](function(_0x5abd6e){if(_0x5abd6e){_0x4a1b64['contact']=_0x5abd6e[0x0];}if(_0x4a1b64['UserId']){return db[_0x66b8('0x2d')][_0x66b8('0x2e')]({'where':{'id':_0x4a1b64[_0x66b8('0x2f')]},'attributes':['id',_0x66b8('0x30'),'fullname','email',_0x66b8('0x31')],'raw':!![]})[_0x66b8('0x1c')](function(_0x342a7e){_0x4a1b64[_0x66b8('0x32')]=util['format']('SIP/%s',_0x342a7e[_0x66b8('0x30')]);_0x4a1b64[_0x66b8('0x33')]=_0x15138b;_0x4a1b64[_0x66b8('0x34')]=_0x342a7e;return request({'event':'incomingmessage','message':_0x4a1b64});})[_0x66b8('0x22')](function(_0x45c5c0){console[_0x66b8('0x20')](_0x45c5c0);});}else{return request({'event':_0x66b8('0x35'),'message':_0x4a1b64});}});};}function afterCreate(_0x5550b3,_0x4657af){return function(_0x12eecf,_0x5795eb){_0x12eecf=_0x12eecf[_0x66b8('0x23')]({'plain':!![]});_0x12eecf[_0x66b8('0x33')]=_0x5550b3;_0x12eecf[_0x66b8('0x24')]='opened';var _0x5ae13f=_0x66b8('0x26')+_0x12eecf[_0x66b8('0x27')];return db[_0x66b8('0x28')][_0x66b8('0x29')](_0x5ae13f,{'type':db[_0x66b8('0x2a')]['QueryTypes'][_0x66b8('0x2c')],'raw':!![]})['then'](function(_0x58fdf8){return _0x58fdf8;})['then'](function(_0x2afd42){if(_0x2afd42){_0x12eecf[_0x66b8('0x36')]=_0x2afd42[0x0];}return request({'event':_0x4657af,'message':_0x12eecf});});};}function afterUpdate(_0x27b4f5,_0x3d488d){return function(_0x1e7f72,_0x4d4e58){if(_0x1e7f72[_0x66b8('0x37')](_0x66b8('0x38'))&&_0x1e7f72[_0x66b8('0x38')]){_0x1e7f72=_0x1e7f72[_0x66b8('0x23')]({'plain':!![]});_0x1e7f72[_0x66b8('0x33')]=_0x27b4f5;_0x1e7f72['event']=_0x66b8('0x38');var _0x3cd0a0=_0x66b8('0x26')+_0x1e7f72['ContactId'];return db[_0x66b8('0x28')]['query'](_0x3cd0a0,{'type':db[_0x66b8('0x2a')]['QueryTypes'][_0x66b8('0x2c')],'raw':!![]})[_0x66b8('0x1c')](function(_0x515083){return _0x515083;})[_0x66b8('0x1c')](function(_0x421933){if(_0x421933){_0x1e7f72[_0x66b8('0x36')]=_0x421933[0x0];}if(_0x1e7f72[_0x66b8('0x2f')]){return db[_0x66b8('0x2d')]['find']({'where':{'id':_0x1e7f72['UserId']},'attributes':['id',_0x66b8('0x30'),_0x66b8('0x39'),'email',_0x66b8('0x31')],'raw':!![]})[_0x66b8('0x1c')](function(_0x226305){_0x1e7f72[_0x66b8('0x32')]=util[_0x66b8('0x3a')](_0x66b8('0x3b'),_0x226305[_0x66b8('0x30')]);_0x1e7f72[_0x66b8('0x34')]=_0x226305;return request({'event':_0x3d488d,'message':_0x1e7f72});})[_0x66b8('0x22')](function(_0x26a720){console['error'](_0x26a720);});}else{return request({'event':_0x3d488d,'message':_0x1e7f72});}});}};}exports['default']=function(){for(var _0x55add5=0x0;_0x55add5=_0x3ed90b[_0x1e90('0x14')]){throw Error(_0x1e90('0x15'));}_0x4c9155(_0xcc0378);})[_0x1e90('0x16')](function(_0x297e74){_0x507e56(_0x297e74);});});}; \ No newline at end of file +var _0xcfe4=['then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','../mysqldb','voice','mail','chat','fax','whatsapp','openchannel','getChannels','toLowerCase','clearBlockUser','isUndefined','updateAttributes','getLicense','role','agent','count'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xcfe4,0x115));var _0x4cfe=function(_0x16d733,_0x5c7c95){_0x16d733=_0x16d733-0x0;var _0x5a63fa=_0xcfe4[_0x16d733];return _0x5a63fa;};'use strict';var _=require(_0x4cfe('0x0'));var BPromise=require('bluebird');var db=require(_0x4cfe('0x1'))['db'];var util=require('./license/util');var channels=[_0x4cfe('0x2'),_0x4cfe('0x3'),_0x4cfe('0x4'),_0x4cfe('0x5'),'sms',_0x4cfe('0x6'),_0x4cfe('0x7')];exports[_0x4cfe('0x8')]=function(){return channels;};exports['isValidChannel']=function(_0x4a4fc7){_0x4a4fc7=_0x4a4fc7[_0x4cfe('0x9')]();return _['includes'](channels,_0x4a4fc7);};exports[_0x4cfe('0xa')]=function(_0x36e0af,_0x4d4ed5,_0x51ec15,_0x477be3){var _0x3f284f={'loginAttempts':_0x4d4ed5,'blocked':_0x51ec15};if(!_[_0x4cfe('0xb')](_0x477be3)){_0x3f284f['blockedAt']=_0x477be3;}return _0x36e0af[_0x4cfe('0xc')](_0x3f284f);};exports[_0x4cfe('0xd')]=function(_0x4d7803){return new BPromise(function(_0x537515,_0x28d1cb){var _0x1899df=0x0;if(_0x4d7803[_0x4cfe('0xe')]!==_0x4cfe('0xf')){_0x537515(_0x4d7803);}db['User'][_0x4cfe('0x10')]({'where':{'role':_0x4cfe('0xf'),'online':!![],'id':{'$ne':_0x4d7803['id']}}})[_0x4cfe('0x11')](function(_0x4aaed0){_0x1899df=_0x4aaed0;return util[_0x4cfe('0xd')]();})[_0x4cfe('0x11')](function(_0x64a6da){if(_0x64a6da&&_0x64a6da['agents']&&_0x1899df>=_0x64a6da[_0x4cfe('0x12')]){throw Error(_0x4cfe('0x13'));}_0x537515(_0x4d7803);})[_0x4cfe('0x14')](function(_0x56d965){_0x28d1cb(_0x56d965);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index afbd0fa..b42331c 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9158=['exports','404','render','status','json','send'];(function(_0x519f99,_0x519778){var _0x3e7436=function(_0x14027d){while(--_0x14027d){_0x519f99['push'](_0x519f99['shift']());}};_0x3e7436(++_0x519778);}(_0x9158,0x16e));var _0x8915=function(_0x24cb11,_0xd5faf7){_0x24cb11=_0x24cb11-0x0;var _0x2a1bc0=_0x9158[_0x24cb11];return _0x2a1bc0;};'use strict';module[_0x8915('0x0')][0x194]=function pageNotFound(_0xf9865c,_0x3c4f04){var _0x4b7c5a=_0x8915('0x1');var _0x4e61b0=0x194;var _0x38d764={'status':_0x4e61b0};_0x3c4f04['status'](_0x38d764['status']);_0x3c4f04[_0x8915('0x2')](_0x4b7c5a,{},function(_0x41d3aa,_0x219506){if(_0x41d3aa){return _0x3c4f04[_0x8915('0x3')](_0x38d764[_0x8915('0x3')])[_0x8915('0x4')](_0x38d764);}_0x3c4f04[_0x8915('0x5')](_0x219506);});}; \ No newline at end of file +var _0x1707=['404','status','render','json','send','exports'];(function(_0x5198b8,_0x14b727){var _0x3784d4=function(_0x55b7ea){while(--_0x55b7ea){_0x5198b8['push'](_0x5198b8['shift']());}};_0x3784d4(++_0x14b727);}(_0x1707,0x1df));var _0x7170=function(_0x4537bf,_0x3d5c2a){_0x4537bf=_0x4537bf-0x0;var _0x10cb4a=_0x1707[_0x4537bf];return _0x10cb4a;};'use strict';module[_0x7170('0x0')][0x194]=function pageNotFound(_0x50b5e7,_0x4db1df){var _0x527d00=_0x7170('0x1');var _0x10ac7c=0x194;var _0x5ae048={'status':_0x10ac7c};_0x4db1df[_0x7170('0x2')](_0x5ae048[_0x7170('0x2')]);_0x4db1df[_0x7170('0x3')](_0x527d00,{},function(_0x3829bb,_0xcc6e16){if(_0x3829bb){return _0x4db1df[_0x7170('0x2')](_0x5ae048[_0x7170('0x2')])[_0x7170('0x4')](_0x5ae048);}_0x4db1df[_0x7170('0x5')](_0xcc6e16);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 5a2976f..53617f4 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9789=['WhatsappAccounts','user_has_whatsapp_accounts','user_has_square_projects','Sounds','moh_has_sounds','UserVoiceQueueRt','Hoppers','VoiceQueueId','HopperFinals','HopperHistories','Trunk','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','Teams','Messages','mailboxuser','mailbox','VoiceCallReport','uniqueid','AgentReports','ContactId','MailAccountId','hasOne','MailServerIn','Imap','Dispositions','Answers','Interactions','Applications','List','ListId','TemplateId','Pause','team_has_mail_queues','MailInteractionId','Account','Contact','Owner','Tag','Tags','mail_interaction_has_tags','ThroughTags','Users','Attachments','ChatWebsiteId','restrict','TagId','Items','FaxAccountId','Exntensions','FaxInteractionId','Interaction','AttachmentId','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','UserSmsQueue','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','ProactiveActions','ChatApplication','OpenchannelQueueReport','Agent','Queue','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','JscriptySessions','CompanyId','cm_contact_has_tags','CampaignId','OwnerId','All','Actions','ParentId','Intervals','Extensions','MailApplications','ChatApplications','FaxApplications','SmsApplications','fax_interaction_has_tags','whatsapp_interaction_has_tags','AllConditions','TriggerAllId','AnyCondition','TriggerId','Fields','CustomReportId','MetricId','Configurations','AccountId','Subjects','Descriptions','Subject','SubjectId','Description','DescriptionId','FieldId','Variable','VariableId','SugarcrmField','Field','int_desk_configuration_has_tags','ZendeskConfiguration','int_zendesk_configuration_has_tags','ServicenowField','Dynamics365Account','FreshsalesConfiguration','FromId','ToId','SessionId','SmsQueueReport','ProjectId','SquareProject','team_has_whatsapp_queues','HopperBlacks','SquareProjectId','campaigns_has_cm_blacklists','FromAccount','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ToChatQueueId','ToChatWebsiteId','ToUserId','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','voice_queues_has_cm_lists','UserProfileSection','UserProfileSections','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','lodash','jstz','determine','sequelize','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','sequelizeHistory','motion2','utf8_general_ci','database','password','username','options','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','Automation','../api/automation/automation.model','CannedAnswer','Disposition','Condition','../api/condition/condition.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/sound/sound.model','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.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','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','CmHopperHistory','HopperHistory','ReportAgentPreview','OpenchannelInteraction','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','SenderId','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','FaxInteraction','user_has_fax_interactions','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueues','ChatQueue','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','UserWhatsappQueue','VoicePrefix','VoicePrefixes','user_has_voice_prefixes','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts'];(function(_0x2d0fd4,_0x2ca149){var _0x26ff35=function(_0x86859f){while(--_0x86859f){_0x2d0fd4['push'](_0x2d0fd4['shift']());}};_0x26ff35(++_0x2ca149);}(_0x9789,0xa4));var _0x9978=function(_0x33cc14,_0x1eb42b){_0x33cc14=_0x33cc14-0x0;var _0x1763ab=_0x9789[_0x33cc14];return _0x1763ab;};'use strict';var config=require(_0x9978('0x0'));var Sequelize=require('sequelize');var _=require(_0x9978('0x1'));var jstz=require(_0x9978('0x2'));var timezone=jstz[_0x9978('0x3')]();config[_0x9978('0x4')]=_['defaultsDeep'](config['sequelize'],{'database':'motion2','username':_0x9978('0x5'),'password':_0x9978('0x6'),'options':{'host':_0x9978('0x7'),'port':0xcea,'dialect':_0x9978('0x8'),'dialectOptions':{'charset':_0x9978('0x9')},'logging':![],'timezone':timezone[_0x9978('0xa')](),'define':{'charset':_0x9978('0xb'),'collate':'utf8_general_ci'}}});config[_0x9978('0xc')]=_['defaultsDeep'](config[_0x9978('0xc')],{'database':_0x9978('0xd'),'username':_0x9978('0x5'),'password':_0x9978('0x6'),'options':{'host':_0x9978('0x7'),'port':0xcea,'dialect':_0x9978('0x8'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x9978('0xa')](),'define':{'charset':'utf8','collate':_0x9978('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9978('0x4')][_0x9978('0xf')],config[_0x9978('0x4')]['username'],config[_0x9978('0x4')][_0x9978('0x10')],config[_0x9978('0x4')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory']['database'],config[_0x9978('0xc')][_0x9978('0x11')],config[_0x9978('0xc')][_0x9978('0x10')],config['sequelizeHistory'][_0x9978('0x12')])};db[_0x9978('0x13')]=db[_0x9978('0x4')][_0x9978('0x14')]('../api/user/user.model');db[_0x9978('0x15')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x16'));db[_0x9978('0x17')]=db[_0x9978('0x4')]['import'](_0x9978('0x18'));db[_0x9978('0x19')]=db[_0x9978('0x4')]['import'](_0x9978('0x1a'));db[_0x9978('0x1b')]=db[_0x9978('0x4')]['import'](_0x9978('0x1c'));db[_0x9978('0x1d')]=db[_0x9978('0x4')][_0x9978('0x14')]('../api/voiceQueue/voiceQueue.model');db[_0x9978('0x1e')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x1f'));db[_0x9978('0x20')]=db['sequelize']['import'](_0x9978('0x21'));db[_0x9978('0x22')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x23'));db[_0x9978('0x24')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x25'));db['VoiceCallReport']=db[_0x9978('0x4')][_0x9978('0x14')]('../api/voiceCallReport/voiceCallReport.model');db[_0x9978('0x26')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x27'));db[_0x9978('0x28')]=db[_0x9978('0x4')][_0x9978('0x14')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x9978('0x29')]=db[_0x9978('0x4')]['import']('../api/voiceQueueReport/voiceQueueReport.model');db[_0x9978('0x2a')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x2b'));db['Trunk']=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x2c'));db[_0x9978('0x2d')]=db['sequelize'][_0x9978('0x14')](_0x9978('0x2e'));db['UserVoiceQueueRt']=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x2f'));db[_0x9978('0x30')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x31'));db[_0x9978('0x32')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x33'));db[_0x9978('0x34')]=db[_0x9978('0x4')][_0x9978('0x14')]('../api/userMailQueue/userMailQueue.model');db[_0x9978('0x35')]=db[_0x9978('0x4')][_0x9978('0x14')]('../api/userFaxQueue/userFaxQueue.model');db['UserSmsQueue']=db[_0x9978('0x4')]['import']('../api/userSmsQueue/userSmsQueue.model');db['UserOpenchannelQueue']=db['sequelize'][_0x9978('0x14')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db['UserWhatsappQueue']=db['sequelize'][_0x9978('0x14')](_0x9978('0x36'));db['MailServerIn']=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x37'));db[_0x9978('0x38')]=db['sequelize']['import'](_0x9978('0x39'));db['MailAccount']=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x3a'));db[_0x9978('0x3b')]=db['sequelize'][_0x9978('0x14')](_0x9978('0x3c'));db[_0x9978('0x3d')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x3e'));db[_0x9978('0x3f')]=db['sequelize']['import'](_0x9978('0x40'));db[_0x9978('0x41')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x42'));db[_0x9978('0x43')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x44'));db[_0x9978('0x45')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x46'));db[_0x9978('0x47')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x48'));db[_0x9978('0x49')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x4a'));db[_0x9978('0x4b')]=db[_0x9978('0x4')]['import'](_0x9978('0x4c'));db[_0x9978('0x4d')]=db['sequelize'][_0x9978('0x14')](_0x9978('0x4e'));db['FaxInteraction']=db[_0x9978('0x4')]['import']('../api/faxInteraction/faxInteraction.model');db[_0x9978('0x4f')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x50'));db[_0x9978('0x51')]=db[_0x9978('0x4')]['import'](_0x9978('0x52'));db[_0x9978('0x53')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x54'));db[_0x9978('0x55')]=db['sequelize'][_0x9978('0x14')](_0x9978('0x56'));db['SmsApplication']=db[_0x9978('0x4')][_0x9978('0x14')]('../api/smsApplication/smsApplication.model');db['SmsInteraction']=db['sequelize'][_0x9978('0x14')](_0x9978('0x57'));db[_0x9978('0x58')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x59'));db[_0x9978('0x5a')]=db['sequelize']['import'](_0x9978('0x5b'));db[_0x9978('0x5c')]=db[_0x9978('0x4')][_0x9978('0x14')]('../api/openchannelAccount/openchannelAccount.model');db['OpenchannelApplication']=db['sequelize'][_0x9978('0x14')]('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x5d'));db[_0x9978('0x5e')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x5f'));db[_0x9978('0x60')]=db['sequelize'][_0x9978('0x14')](_0x9978('0x61'));db['ChatWebsite']=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x62'));db['OpenchannelQueueReport']=db[_0x9978('0x4')][_0x9978('0x14')]('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x63'));db['ChatInteraction']=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x64'));db[_0x9978('0x65')]=db['sequelize'][_0x9978('0x14')]('../api/chatMessage/chatMessage.model');db[_0x9978('0x66')]=db['sequelize'][_0x9978('0x14')](_0x9978('0x67'));db['ChatQueue']=db['sequelize'][_0x9978('0x14')]('../api/chatQueue/chatQueue.model');db[_0x9978('0x68')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x69'));db[_0x9978('0x6a')]=db['sequelize'][_0x9978('0x14')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x9978('0x6b')]=db[_0x9978('0x4')]['import'](_0x9978('0x6c'));db[_0x9978('0x6d')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x6e'));db[_0x9978('0x6f')]=db[_0x9978('0x4')][_0x9978('0x14')]('../api/cmHopper/cmHopper.model');db[_0x9978('0x70')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x71'));db[_0x9978('0x72')]=db[_0x9978('0x4')]['import'](_0x9978('0x73'));db['CmHopperHistory']=db[_0x9978('0x4')][_0x9978('0x14')]('../api/cmHopperHistory/cmHopperHistory.model');db['ReportAgentPreview']=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x74'));db[_0x9978('0x75')]=db['sequelize'][_0x9978('0x14')]('../api/cmCustomField/cmCustomField.model');db[_0x9978('0x76')]=db[_0x9978('0x4')][_0x9978('0x14')]('../api/action/action.model');db[_0x9978('0x77')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x78'));db[_0x9978('0x79')]=db[_0x9978('0x4')]['import']('../api/cannedAnswer/cannedAnswer.model');db[_0x9978('0x7a')]=db[_0x9978('0x4')][_0x9978('0x14')]('../api/disposition/disposition.model');db[_0x9978('0x7b')]=db[_0x9978('0x4')]['import'](_0x9978('0x7c'));db['Interval']=db[_0x9978('0x4')][_0x9978('0x14')]('../api/interval/interval.model');db['Pause']=db['sequelize'][_0x9978('0x14')]('../api/pause/pause.model');db[_0x9978('0x7d')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x7e'));db[_0x9978('0x7f')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x80'));db[_0x9978('0x81')]=db[_0x9978('0x4')][_0x9978('0x14')]('../api/schedule/schedule.model');db[_0x9978('0x82')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x83'));db['Tag']=db['sequelize'][_0x9978('0x14')](_0x9978('0x84'));db[_0x9978('0x85')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x86'));db[_0x9978('0x87')]=db[_0x9978('0x4')]['import']('../api/trigger/trigger.model');db['Variable']=db[_0x9978('0x4')]['import'](_0x9978('0x88'));db[_0x9978('0x89')]=db['sequelize'][_0x9978('0x14')](_0x9978('0x8a'));db[_0x9978('0x8b')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x8c'));db[_0x9978('0x8d')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x8e'));db[_0x9978('0x8f')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x90'));db[_0x9978('0x91')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x92'));db[_0x9978('0x93')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x94'));db[_0x9978('0x95')]=db['sequelize'][_0x9978('0x14')](_0x9978('0x96'));db[_0x9978('0x97')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x98'));db[_0x9978('0x99')]=db['sequelize']['import'](_0x9978('0x9a'));db[_0x9978('0x9b')]=db['sequelize'][_0x9978('0x14')](_0x9978('0x9c'));db[_0x9978('0x9d')]=db[_0x9978('0x4')][_0x9978('0x14')]('../api/intSalesforceField/intSalesforceField.model');db[_0x9978('0x9e')]=db['sequelize']['import']('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x9978('0x9f')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0xa0'));db['SugarcrmField']=db['sequelize'][_0x9978('0x14')](_0x9978('0xa1'));db[_0x9978('0xa2')]=db[_0x9978('0x4')][_0x9978('0x14')]('../api/intDeskAccount/intDeskAccount.model');db[_0x9978('0xa3')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0xa4'));db[_0x9978('0xa5')]=db[_0x9978('0x4')]['import'](_0x9978('0xa6'));db[_0x9978('0xa7')]=db['sequelize'][_0x9978('0x14')](_0x9978('0xa8'));db[_0x9978('0xa9')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0xaa'));db[_0x9978('0xab')]=db['sequelize'][_0x9978('0x14')](_0x9978('0xac'));db[_0x9978('0xad')]=db[_0x9978('0x4')]['import'](_0x9978('0xae'));db['ZendeskConfiguration']=db[_0x9978('0x4')]['import'](_0x9978('0xaf'));db[_0x9978('0xb0')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0xb1'));db[_0x9978('0xb2')]=db['sequelize']['import'](_0x9978('0xb3'));db[_0x9978('0xb4')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0xb5'));db[_0x9978('0xb6')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0xb7'));db[_0x9978('0xb8')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0xb9'));db[_0x9978('0xba')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0xbb'));db[_0x9978('0xbc')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0xbd'));db[_0x9978('0xbe')]=db[_0x9978('0x4')]['import'](_0x9978('0xbf'));db[_0x9978('0xc0')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0xc1'));db['ServicenowField']=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0xc2'));db['Dynamics365Account']=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0xc3'));db[_0x9978('0xc4')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0xc5'));db[_0x9978('0xc6')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0xc7'));db[_0x9978('0xc8')]=db[_0x9978('0x4')][_0x9978('0x14')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db['FreshsalesConfiguration']=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0xc9'));db[_0x9978('0xca')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0xcb'));db[_0x9978('0x89')]=db[_0x9978('0x4')][_0x9978('0x14')]('../api/integration/integration.model');db[_0x9978('0xcc')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0xcd'));db[_0x9978('0xce')]=db['sequelize'][_0x9978('0x14')](_0x9978('0xcf'));db[_0x9978('0xd0')]=db[_0x9978('0x4')]['import'](_0x9978('0xd1'));db[_0x9978('0xd2')]=db['sequelize'][_0x9978('0x14')](_0x9978('0xd3'));db[_0x9978('0xd4')]=db[_0x9978('0x4')]['import'](_0x9978('0xd5'));db[_0x9978('0xd6')]=db[_0x9978('0x4')][_0x9978('0x14')]('../api/jscriptySessionReport/jscriptySessionReport.model');db['SmsQueueReport']=db['sequelize']['import'](_0x9978('0xd7'));db[_0x9978('0xd8')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0xd9'));db[_0x9978('0xda')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0xdb'));db[_0x9978('0xdc')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0xdd'));db[_0x9978('0xde')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0xdf'));db[_0x9978('0xe0')]=db[_0x9978('0x4')][_0x9978('0x14')]('../api/squareOdbc/squareOdbc.model');db['SquareProject']=db['sequelize'][_0x9978('0x14')](_0x9978('0xe1'));db[_0x9978('0xe2')]=db['sequelize']['import'](_0x9978('0xe3'));db[_0x9978('0xe4')]=db['sequelize']['import'](_0x9978('0xe5'));db[_0x9978('0xe6')]=db[_0x9978('0x4')][_0x9978('0x14')]('../api/team/team.model');db['License']=db['sequelize']['import'](_0x9978('0xe7'));db[_0x9978('0xe8')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0xe9'));db[_0x9978('0xea')]=db['sequelize'][_0x9978('0x14')](_0x9978('0xeb'));db[_0x9978('0xec')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0xed'));db[_0x9978('0xee')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0xef'));db[_0x9978('0xf0')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0xf1'));db[_0x9978('0xf2')]=db[_0x9978('0x4')]['import'](_0x9978('0xf3'));db[_0x9978('0xf4')]=db['sequelize'][_0x9978('0x14')](_0x9978('0xf5'));db[_0x9978('0xf6')]=db[_0x9978('0x4')][_0x9978('0x14')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x9978('0xf7')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0xf8'));db[_0x9978('0xf9')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0xfa'));db['VoicePrefix']=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0xfb'));db[_0x9978('0xfc')]=db[_0x9978('0x4')]['import'](_0x9978('0xfd'));db['UserProfileSection']=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0xfe'));db[_0x9978('0xff')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x100'));db[_0x9978('0x101')]=db[_0x9978('0x4')]['import'](_0x9978('0x102'));db[_0x9978('0x103')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x104'));db[_0x9978('0x105')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x106'));db[_0x9978('0x107')]=db['sequelize'][_0x9978('0x14')](_0x9978('0x108'));db['WhatsappMessage']=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x109'));db[_0x9978('0x10a')]=db[_0x9978('0x4')]['import'](_0x9978('0x10b'));db[_0x9978('0x10c')]=db['sequelize'][_0x9978('0x14')](_0x9978('0x10d'));db[_0x9978('0x10e')]=db[_0x9978('0x4')]['import']('../api/whatsappQueue/whatsappQueue.model');db['CloudProvider']=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x10f'));db[_0x9978('0x110')]=db[_0x9978('0x4')][_0x9978('0x14')](_0x9978('0x111'));db[_0x9978('0x13')]['hasOne'](db[_0x9978('0x22')],{'as':'VoiceMail','onDelete':_0x9978('0x112'),'foreignKey':_0x9978('0x113')});db[_0x9978('0x13')][_0x9978('0x114')](db[_0x9978('0x1e')],{'as':_0x9978('0x115'),'foreignKey':'UserId'});db[_0x9978('0x13')][_0x9978('0x114')](db['UserVoiceQueueRt'],{'as':_0x9978('0x116'),'foreignKey':_0x9978('0x113')});db[_0x9978('0x13')]['hasMany'](db['VoiceExtension'],{'as':'Extensions','onDelete':_0x9978('0x112'),'hooks':!![]});db[_0x9978('0x13')][_0x9978('0x114')](db[_0x9978('0x72')],{'as':'HopperFinals','foreignKey':_0x9978('0x113')});db[_0x9978('0x13')][_0x9978('0x114')](db[_0x9978('0x117')],{'as':_0x9978('0x118'),'foreignKey':_0x9978('0x113')});db[_0x9978('0x13')][_0x9978('0x114')](db[_0x9978('0x119')],{'as':_0x9978('0x119'),'foreignKey':_0x9978('0x113')});db[_0x9978('0x13')]['hasMany'](db[_0x9978('0x11a')],{'as':_0x9978('0x11b'),'foreignKey':_0x9978('0x113')});db['User'][_0x9978('0x114')](db[_0x9978('0x11c')],{'as':_0x9978('0x11d'),'foreignKey':_0x9978('0x113')});db['User']['hasMany'](db[_0x9978('0x11e')],{'as':_0x9978('0x11f'),'foreignKey':_0x9978('0x113')});db['User'][_0x9978('0x114')](db['FaxInteraction'],{'as':_0x9978('0x120'),'foreignKey':_0x9978('0x113')});db[_0x9978('0x13')][_0x9978('0x114')](db['MailInteraction'],{'as':_0x9978('0x121'),'foreignKey':_0x9978('0x113')});db[_0x9978('0x13')][_0x9978('0x114')](db[_0x9978('0x107')],{'as':_0x9978('0x122'),'foreignKey':_0x9978('0x113')});db['User'][_0x9978('0x114')](db[_0x9978('0x101')],{'as':'UserNotifications','foreignKey':_0x9978('0x123')});db[_0x9978('0x13')][_0x9978('0x124')](db['UserProfile'],{'as':'UserProfile','foreignKey':_0x9978('0x125')});db[_0x9978('0x13')][_0x9978('0x126')](db[_0x9978('0x68')],{'as':_0x9978('0x127'),'through':_0x9978('0x128')});db[_0x9978('0x13')][_0x9978('0x126')](db[_0x9978('0x6d')],{'as':_0x9978('0x129'),'through':_0x9978('0x12a')});db['User'][_0x9978('0x126')](db[_0x9978('0xf9')],{'as':_0x9978('0x12b'),'through':_0x9978('0x12c')});db['User'][_0x9978('0x126')](db['Team'],{'through':_0x9978('0x12d')});db[_0x9978('0x13')]['belongsToMany'](db[_0x9978('0x3f')],{'as':'MailInteractions','through':_0x9978('0x12e')});db['User'][_0x9978('0x126')](db[_0x9978('0x11c')],{'as':_0x9978('0x11d'),'through':_0x9978('0x12f')});db['User'][_0x9978('0x126')](db[_0x9978('0x130')],{'as':_0x9978('0x120'),'through':_0x9978('0x131')});db[_0x9978('0x13')][_0x9978('0x126')](db[_0x9978('0x11e')],{'as':'SmsInteractions','through':_0x9978('0x132')});db[_0x9978('0x13')][_0x9978('0x126')](db[_0x9978('0x11a')],{'as':_0x9978('0x11b'),'through':'user_has_openchannel_interactions'});db[_0x9978('0x13')][_0x9978('0x126')](db[_0x9978('0x107')],{'as':_0x9978('0x122'),'through':_0x9978('0x133')});db[_0x9978('0x13')][_0x9978('0x126')](db['VoiceQueue'],{'as':_0x9978('0x134'),'through':_0x9978('0x30'),'required':![]});db[_0x9978('0x13')][_0x9978('0x126')](db[_0x9978('0x3b')],{'as':_0x9978('0x135'),'through':_0x9978('0x34'),'required':![]});db[_0x9978('0x13')][_0x9978('0x126')](db[_0x9978('0x136')],{'as':_0x9978('0x137'),'through':_0x9978('0x32'),'required':![],'hooks':!![]});db[_0x9978('0x13')][_0x9978('0x126')](db[_0x9978('0x51')],{'as':_0x9978('0x138'),'through':_0x9978('0x35'),'required':![]});db[_0x9978('0x13')][_0x9978('0x126')](db[_0x9978('0x5a')],{'as':_0x9978('0x139'),'through':'UserSmsQueue','required':![]});db[_0x9978('0x13')][_0x9978('0x126')](db[_0x9978('0x60')],{'as':_0x9978('0x13a'),'through':_0x9978('0x13b'),'required':![]});db['User'][_0x9978('0x126')](db['WhatsappQueue'],{'as':_0x9978('0x13c'),'through':_0x9978('0x13d'),'required':![]});db[_0x9978('0x13')]['belongsToMany'](db['CmList'],{'through':_0x9978('0x12c')});db[_0x9978('0x13')][_0x9978('0x126')](db[_0x9978('0x13e')],{'as':_0x9978('0x13f'),'through':_0x9978('0x140'),'required':![]});db['User'][_0x9978('0x126')](db[_0x9978('0x141')],{'as':_0x9978('0x142'),'through':_0x9978('0x143')});db[_0x9978('0x13')][_0x9978('0x126')](db['FaxAccount'],{'as':_0x9978('0x144'),'through':_0x9978('0x145')});db[_0x9978('0x13')][_0x9978('0x126')](db[_0x9978('0x146')],{'as':_0x9978('0x147'),'through':_0x9978('0x148')});db[_0x9978('0x13')]['belongsToMany'](db[_0x9978('0x5c')],{'as':_0x9978('0x149'),'through':_0x9978('0x14a')});db[_0x9978('0x13')][_0x9978('0x126')](db[_0x9978('0x55')],{'as':_0x9978('0x14b'),'through':_0x9978('0x14c')});db[_0x9978('0x13')][_0x9978('0x126')](db[_0x9978('0x103')],{'as':_0x9978('0x14d'),'through':_0x9978('0x14e')});db[_0x9978('0x13')]['belongsToMany'](db['SquareProject'],{'as':'SquareProjects','through':_0x9978('0x14f')});db[_0x9978('0x15')][_0x9978('0x114')](db[_0x9978('0x19')],{'as':'SpiedAgents','onDelete':_0x9978('0x112'),'foreignKey':'ChanSpyId'});db['VoiceContext']['hasMany'](db[_0x9978('0x19')],{'onDelete':'cascade'});db[_0x9978('0x19')][_0x9978('0x114')](db[_0x9978('0x19')],{'as':'Applications','onDelete':_0x9978('0x112')});db[_0x9978('0x1b')][_0x9978('0x126')](db['Sound'],{'as':_0x9978('0x150'),'through':_0x9978('0x151')});db['VoiceQueue'][_0x9978('0x114')](db[_0x9978('0x152')],{'as':'Members','foreignKey':'VoiceQueueId'});db[_0x9978('0x1d')][_0x9978('0x114')](db[_0x9978('0x6f')],{'as':_0x9978('0x153'),'foreignKey':_0x9978('0x154')});db[_0x9978('0x1d')][_0x9978('0x114')](db[_0x9978('0x72')],{'as':_0x9978('0x155'),'foreignKey':_0x9978('0x154')});db[_0x9978('0x1d')]['hasMany'](db[_0x9978('0x117')],{'as':_0x9978('0x156'),'foreignKey':'VoiceQueueId'});db[_0x9978('0x1d')]['hasMany'](db[_0x9978('0x119')],{'as':_0x9978('0x119'),'foreignKey':_0x9978('0x154')});db['VoiceQueue']['hasMany'](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0x9978('0x154')});db['VoiceQueue'][_0x9978('0x114')](db[_0x9978('0xd6')],{'as':'JscriptySessions','foreignKey':_0x9978('0x154')});db[_0x9978('0x1d')][_0x9978('0x124')](db['Trunk'],{'as':_0x9978('0x157'),'foreignKey':_0x9978('0x158')});db[_0x9978('0x1d')][_0x9978('0x124')](db[_0x9978('0x157')],{'as':_0x9978('0x159'),'foreignKey':_0x9978('0x15a')});db[_0x9978('0x1d')][_0x9978('0x124')](db[_0x9978('0x15b')],{'as':_0x9978('0x15b'),'foreignKey':_0x9978('0x15c')});db[_0x9978('0x1d')][_0x9978('0x124')](db['Pause'],{'as':_0x9978('0x15d'),'foreignKey':_0x9978('0x15e')});db['VoiceQueue']['belongsToMany'](db[_0x9978('0xf9')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db[_0x9978('0x1d')][_0x9978('0x126')](db[_0x9978('0x13')],{'as':_0x9978('0x15f'),'through':'UserVoiceQueue'});db['VoiceQueue'][_0x9978('0x126')](db['Team'],{'as':_0x9978('0x160'),'through':_0x9978('0x110')});db[_0x9978('0x1d')][_0x9978('0x126')](db[_0x9978('0xf9')],{'as':'BlackLists','through':'voice_queues_has_cm_blacklists'});db[_0x9978('0x1e')][_0x9978('0x124')](db[_0x9978('0x13')],{'as':_0x9978('0x13'),'foreignKey':_0x9978('0x113')});db['ScreenRecording']['belongsTo'](db[_0x9978('0x13')],{'as':_0x9978('0x13'),'foreignKey':'UserId'});db[_0x9978('0x22')]['hasMany'](db[_0x9978('0x24')],{'as':_0x9978('0x161'),'onDelete':'cascade','foreignKey':_0x9978('0x162'),'sourceKey':'mailbox'});db['VoiceMailMessage'][_0x9978('0x124')](db[_0x9978('0x22')],{'foreignKey':_0x9978('0x162'),'targetKey':_0x9978('0x163')});db[_0x9978('0x164')][_0x9978('0x114')](db['VoiceQueueReport'],{'as':'QueueCalls','foreignKey':_0x9978('0x165'),'constraints':![]});db[_0x9978('0x164')][_0x9978('0x114')](db[_0x9978('0x28')],{'as':_0x9978('0x166'),'foreignKey':_0x9978('0x165'),'constraints':![]});db['VoiceCallReport'][_0x9978('0x124')](db['User'],{'as':_0x9978('0x13'),'foreignKey':'UserId'});db[_0x9978('0x164')][_0x9978('0x124')](db[_0x9978('0x6d')],{'as':'Contact','foreignKey':_0x9978('0x167')});db['MailServerIn'][_0x9978('0x124')](db[_0x9978('0x146')],{'as':_0x9978('0x146'),'foreignKey':_0x9978('0x168')});db[_0x9978('0x38')][_0x9978('0x124')](db[_0x9978('0x146')],{'as':_0x9978('0x146'),'foreignKey':_0x9978('0x168')});db[_0x9978('0x146')][_0x9978('0x169')](db[_0x9978('0x16a')],{'as':_0x9978('0x16b'),'onDelete':_0x9978('0x112')});db[_0x9978('0x146')][_0x9978('0x169')](db[_0x9978('0x38')],{'as':'Smtp','onDelete':_0x9978('0x112')});db[_0x9978('0x146')]['hasMany'](db['Disposition'],{'as':_0x9978('0x16c'),'foreignKey':_0x9978('0x168'),'onDelete':_0x9978('0x112')});db[_0x9978('0x146')][_0x9978('0x114')](db['CannedAnswer'],{'as':_0x9978('0x16d'),'foreignKey':_0x9978('0x168')});db[_0x9978('0x146')][_0x9978('0x114')](db[_0x9978('0x41')],{'as':_0x9978('0x161'),'foreignKey':_0x9978('0x168')});db[_0x9978('0x146')][_0x9978('0x114')](db[_0x9978('0x3f')],{'as':_0x9978('0x16e')});db[_0x9978('0x146')]['hasMany'](db[_0x9978('0x43')],{'as':_0x9978('0x16f')});db['MailAccount'][_0x9978('0x124')](db['CmList'],{'as':_0x9978('0x170'),'foreignKey':_0x9978('0x171')});db['MailAccount'][_0x9978('0x124')](db['Template'],{'as':_0x9978('0x85'),'foreignKey':_0x9978('0x172')});db['MailAccount']['belongsTo'](db[_0x9978('0x173')],{'as':_0x9978('0x15d'),'foreignKey':_0x9978('0x15e')});db[_0x9978('0x146')]['belongsToMany'](db[_0x9978('0x13')],{'as':'Agents','through':'user_has_mail_accounts'});db[_0x9978('0x3b')][_0x9978('0x126')](db[_0x9978('0x13')],{'as':_0x9978('0x15f'),'through':_0x9978('0x34')});db[_0x9978('0x3b')]['belongsToMany'](db[_0x9978('0xe6')],{'through':_0x9978('0x174'),'as':_0x9978('0x160')});db[_0x9978('0x3f')][_0x9978('0x114')](db[_0x9978('0x41')],{'as':_0x9978('0x161'),'onDelete':_0x9978('0x112'),'foreignKey':_0x9978('0x175')});db[_0x9978('0x3f')][_0x9978('0x124')](db['MailAccount'],{'as':_0x9978('0x176'),'foreignKey':_0x9978('0x168')});db['MailInteraction']['belongsTo'](db[_0x9978('0x6d')],{'as':_0x9978('0x177'),'foreignKey':_0x9978('0x167')});db[_0x9978('0x3f')][_0x9978('0x124')](db[_0x9978('0x13')],{'as':_0x9978('0x178'),'foreignKey':_0x9978('0x113')});db[_0x9978('0x3f')][_0x9978('0x126')](db[_0x9978('0x179')],{'through':'mail_interaction_has_tags','as':_0x9978('0x17a')});db['MailInteraction'][_0x9978('0x126')](db['Tag'],{'through':_0x9978('0x17b'),'as':_0x9978('0x17c')});db['MailInteraction'][_0x9978('0x126')](db[_0x9978('0x13')],{'as':_0x9978('0x17d'),'through':_0x9978('0x12e'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x9978('0x114')](db[_0x9978('0xec')],{'as':_0x9978('0x17e'),'onDelete':'cascade'});db['MailMessage'][_0x9978('0x124')](db[_0x9978('0x13')],{'as':_0x9978('0x13')});db[_0x9978('0x41')][_0x9978('0x124')](db['CmContact'],{'onDelete':_0x9978('0x112'),'as':_0x9978('0x177')});db[_0x9978('0x41')][_0x9978('0x124')](db[_0x9978('0x3f')],{'as':'Interaction','foreignKey':_0x9978('0x175')});db[_0x9978('0x41')]['belongsTo'](db[_0x9978('0x146')],{'as':_0x9978('0x176'),'foreignKey':_0x9978('0x168')});db['MailMessage'][_0x9978('0x124')](db[_0x9978('0x141')],{'as':_0x9978('0x141'),'foreignKey':_0x9978('0x17f')});db[_0x9978('0x41')]['belongsTo'](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0x9978('0x43')][_0x9978('0x124')](db[_0x9978('0x13')],{'onDelete':_0x9978('0x180')});db[_0x9978('0x43')][_0x9978('0x124')](db[_0x9978('0x3b')],{'onDelete':_0x9978('0x180')});db[_0x9978('0x43')][_0x9978('0x124')](db[_0x9978('0x146')],{'onDelete':_0x9978('0x180')});db[_0x9978('0x43')][_0x9978('0x124')](db[_0x9978('0x15b')],{'onDelete':_0x9978('0x180'),'foreignKey':_0x9978('0x15c')});db[_0x9978('0x43')][_0x9978('0x124')](db[_0x9978('0x179')],{'onDelete':_0x9978('0x180'),'foreignKey':_0x9978('0x181')});db['MailQueueReport'][_0x9978('0x124')](db[_0x9978('0x146')],{});db[_0x9978('0x45')]['belongsTo'](db[_0x9978('0xf9')],{'as':_0x9978('0x170'),'foreignKey':_0x9978('0x171')});db[_0x9978('0x45')][_0x9978('0x124')](db[_0x9978('0x6d')],{'as':'Contact','foreignKey':_0x9978('0x167')});db[_0x9978('0x45')]['belongsTo'](db[_0x9978('0x3f')],{});db[_0x9978('0x45')][_0x9978('0x124')](db['MailMessage'],{});db[_0x9978('0x45')][_0x9978('0x124')](db[_0x9978('0x13')],{});db[_0x9978('0x45')][_0x9978('0x124')](db['MailQueue'],{});db['Dashboard'][_0x9978('0x114')](db[_0x9978('0x49')],{'as':_0x9978('0x182'),'onDelete':_0x9978('0x112')});db['FaxAccount'][_0x9978('0x114')](db[_0x9978('0x7a')],{'as':_0x9978('0x16c'),'foreignKey':_0x9978('0x183'),'onDelete':'cascade'});db[_0x9978('0x4b')][_0x9978('0x114')](db[_0x9978('0x79')],{'as':_0x9978('0x16d'),'foreignKey':_0x9978('0x183')});db[_0x9978('0x4b')]['hasMany'](db[_0x9978('0x130')],{'as':'Interactions'});db[_0x9978('0x4b')][_0x9978('0x114')](db[_0x9978('0x4d')],{'as':'Applications'});db[_0x9978('0x4b')]['hasMany'](db['VoiceExtension'],{'as':_0x9978('0x184'),'onDelete':_0x9978('0x112')});db['FaxAccount'][_0x9978('0x114')](db[_0x9978('0x4f')],{'as':_0x9978('0x161')});db[_0x9978('0x4b')][_0x9978('0x124')](db['Trunk'],{'as':_0x9978('0x157')});db[_0x9978('0x4b')]['belongsTo'](db[_0x9978('0xf9')],{'as':'List','foreignKey':_0x9978('0x171')});db['FaxAccount'][_0x9978('0x124')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x9978('0x15e')});db[_0x9978('0x4b')][_0x9978('0x126')](db[_0x9978('0x13')],{'as':'Agents','through':_0x9978('0x145')});db[_0x9978('0x4d')]['belongsTo'](db['User'],{'onDelete':_0x9978('0x180')});db[_0x9978('0x4d')][_0x9978('0x124')](db[_0x9978('0x51')],{'onDelete':_0x9978('0x180')});db[_0x9978('0x4d')][_0x9978('0x124')](db[_0x9978('0x4b')],{'onDelete':_0x9978('0x180')});db[_0x9978('0x4d')][_0x9978('0x124')](db['Tag'],{'onDelete':_0x9978('0x180'),'foreignKey':'TagId'});db[_0x9978('0x130')]['hasMany'](db[_0x9978('0x4f')],{'as':_0x9978('0x161'),'onDelete':_0x9978('0x112'),'foreignKey':_0x9978('0x185')});db['FaxInteraction'][_0x9978('0x124')](db[_0x9978('0x4b')],{'as':'Account','foreignKey':_0x9978('0x183')});db[_0x9978('0x130')][_0x9978('0x124')](db[_0x9978('0x6d')],{'as':_0x9978('0x177'),'foreignKey':'ContactId'});db[_0x9978('0x130')][_0x9978('0x124')](db[_0x9978('0x13')],{'as':_0x9978('0x178'),'foreignKey':_0x9978('0x113')});db[_0x9978('0x130')]['belongsToMany'](db['Tag'],{'through':'fax_interaction_has_tags','as':'Tags'});db[_0x9978('0x130')][_0x9978('0x126')](db[_0x9978('0x179')],{'through':'fax_interaction_has_tags','as':_0x9978('0x17c')});db[_0x9978('0x130')][_0x9978('0x126')](db[_0x9978('0x13')],{'as':_0x9978('0x17d'),'through':'user_has_fax_interactions','foreignKey':_0x9978('0x185')});db['FaxMessage'][_0x9978('0x124')](db[_0x9978('0x13')],{'onDelete':_0x9978('0x112'),'as':_0x9978('0x13')});db[_0x9978('0x4f')][_0x9978('0x124')](db[_0x9978('0x130')],{'as':_0x9978('0x186'),'foreignKey':'FaxInteractionId'});db[_0x9978('0x4f')]['belongsTo'](db['CmContact'],{'onDelete':_0x9978('0x112'),'as':_0x9978('0x177')});db[_0x9978('0x4f')][_0x9978('0x124')](db['Attachment'],{'as':'Attachment','foreignKey':_0x9978('0x187')});db[_0x9978('0x4f')][_0x9978('0x124')](db['FaxAccount'],{'as':_0x9978('0x176'),'foreignKey':'FaxAccountId'});db[_0x9978('0x51')][_0x9978('0x126')](db['User'],{'as':_0x9978('0x15f'),'through':_0x9978('0x35')});db['FaxQueue'][_0x9978('0x126')](db[_0x9978('0xe6')],{'through':'team_has_fax_queues','as':'Teams'});db['FaxQueueReport']['belongsTo'](db[_0x9978('0x4b')],{});db[_0x9978('0x53')][_0x9978('0x124')](db[_0x9978('0xf9')],{'as':_0x9978('0x170'),'foreignKey':_0x9978('0x171')});db[_0x9978('0x53')][_0x9978('0x124')](db[_0x9978('0x6d')],{'as':'Contact','foreignKey':'ContactId'});db[_0x9978('0x53')][_0x9978('0x124')](db[_0x9978('0x130')],{});db[_0x9978('0x53')][_0x9978('0x124')](db[_0x9978('0x4f')],{});db[_0x9978('0x53')][_0x9978('0x124')](db[_0x9978('0x13')],{});db[_0x9978('0x53')][_0x9978('0x124')](db[_0x9978('0x51')],{});db[_0x9978('0x55')][_0x9978('0x114')](db[_0x9978('0x7a')],{'as':_0x9978('0x16c'),'foreignKey':_0x9978('0x188'),'onDelete':_0x9978('0x112')});db['SmsAccount'][_0x9978('0x114')](db[_0x9978('0x79')],{'as':_0x9978('0x16d'),'foreignKey':_0x9978('0x188')});db[_0x9978('0x55')]['hasMany'](db[_0x9978('0x58')],{'as':_0x9978('0x161'),'foreignKey':'SmsAccountId'});db[_0x9978('0x55')][_0x9978('0x114')](db['SmsInteraction'],{'as':_0x9978('0x16e')});db[_0x9978('0x55')][_0x9978('0x114')](db['SmsApplication'],{'as':_0x9978('0x16f')});db[_0x9978('0x55')]['belongsTo'](db[_0x9978('0xf9')],{'as':_0x9978('0x170'),'foreignKey':_0x9978('0x171')});db[_0x9978('0x55')][_0x9978('0x124')](db[_0x9978('0x173')],{'as':_0x9978('0x15d'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x9978('0x55')]['belongsToMany'](db[_0x9978('0x13')],{'as':_0x9978('0x15f'),'through':'user_has_sms_accounts'});db[_0x9978('0x189')][_0x9978('0x124')](db['User'],{'onDelete':_0x9978('0x180')});db[_0x9978('0x189')][_0x9978('0x124')](db['SmsQueue'],{'onDelete':'restrict'});db['SmsApplication']['belongsTo'](db[_0x9978('0x55')],{'onDelete':_0x9978('0x180')});db[_0x9978('0x189')][_0x9978('0x124')](db[_0x9978('0x15b')],{'onDelete':_0x9978('0x180'),'foreignKey':_0x9978('0x15c')});db[_0x9978('0x189')][_0x9978('0x124')](db[_0x9978('0x179')],{'onDelete':_0x9978('0x180'),'foreignKey':_0x9978('0x181')});db[_0x9978('0x11e')][_0x9978('0x114')](db[_0x9978('0x58')],{'as':_0x9978('0x161'),'onDelete':_0x9978('0x112'),'foreignKey':_0x9978('0x18a')});db['SmsInteraction'][_0x9978('0x124')](db['SmsAccount'],{'as':_0x9978('0x176'),'foreignKey':_0x9978('0x188')});db[_0x9978('0x11e')][_0x9978('0x124')](db[_0x9978('0x6d')],{'as':_0x9978('0x177'),'foreignKey':_0x9978('0x167')});db[_0x9978('0x11e')]['belongsTo'](db[_0x9978('0x13')],{'as':_0x9978('0x178'),'foreignKey':_0x9978('0x113')});db[_0x9978('0x11e')][_0x9978('0x126')](db[_0x9978('0x179')],{'through':'sms_interaction_has_tags','as':_0x9978('0x17a')});db['SmsInteraction']['belongsToMany'](db[_0x9978('0x179')],{'through':_0x9978('0x18b'),'as':_0x9978('0x17c')});db['SmsInteraction'][_0x9978('0x126')](db[_0x9978('0x13')],{'as':_0x9978('0x17d'),'through':_0x9978('0x132'),'foreignKey':'SmsInteractionId'});db['SmsMessage']['belongsTo'](db[_0x9978('0x13')],{'as':_0x9978('0x13')});db[_0x9978('0x58')]['belongsTo'](db[_0x9978('0x6d')],{'onDelete':_0x9978('0x112'),'as':_0x9978('0x177')});db[_0x9978('0x58')][_0x9978('0x124')](db['SmsInteraction'],{'onDelete':_0x9978('0x112'),'as':_0x9978('0x186'),'foreignKey':_0x9978('0x18a')});db[_0x9978('0x58')][_0x9978('0x124')](db['SmsAccount'],{'as':_0x9978('0x176'),'foreignKey':_0x9978('0x188')});db[_0x9978('0x5a')][_0x9978('0x126')](db[_0x9978('0x13')],{'as':_0x9978('0x15f'),'through':_0x9978('0x18c'),'foreignKey':_0x9978('0x18d')});db[_0x9978('0x5a')][_0x9978('0x126')](db[_0x9978('0xe6')],{'through':_0x9978('0x18e'),'as':_0x9978('0x160')});db[_0x9978('0x5c')]['hasMany'](db[_0x9978('0x7a')],{'as':_0x9978('0x16c'),'foreignKey':_0x9978('0x18f'),'onDelete':_0x9978('0x112')});db[_0x9978('0x5c')][_0x9978('0x114')](db[_0x9978('0x79')],{'as':'Answers','foreignKey':_0x9978('0x18f')});db[_0x9978('0x5c')][_0x9978('0x114')](db[_0x9978('0x11a')],{'as':'Interactions','foreignKey':_0x9978('0x18f')});db['OpenchannelAccount']['hasMany'](db['OpenchannelMessage'],{'as':_0x9978('0x161'),'foreignKey':_0x9978('0x18f')});db[_0x9978('0x5c')]['hasMany'](db[_0x9978('0x190')],{'as':_0x9978('0x16f'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x9978('0x124')](db[_0x9978('0xf9')],{'as':_0x9978('0x170'),'foreignKey':_0x9978('0x171')});db[_0x9978('0x5c')]['belongsTo'](db[_0x9978('0x173')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x9978('0x5c')]['belongsToMany'](db['User'],{'as':_0x9978('0x15f'),'through':_0x9978('0x14a')});db[_0x9978('0x190')][_0x9978('0x124')](db['User'],{'onDelete':'restrict'});db[_0x9978('0x190')][_0x9978('0x124')](db[_0x9978('0x60')],{'onDelete':_0x9978('0x180'),'foreignKey':_0x9978('0x191')});db['OpenchannelApplication']['belongsTo'](db[_0x9978('0x5c')],{'onDelete':_0x9978('0x180'),'foreignKey':_0x9978('0x18f')});db[_0x9978('0x190')]['belongsTo'](db[_0x9978('0x15b')],{'onDelete':'restrict','foreignKey':_0x9978('0x15c')});db[_0x9978('0x190')][_0x9978('0x124')](db[_0x9978('0x179')],{'onDelete':_0x9978('0x180'),'foreignKey':_0x9978('0x181')});db[_0x9978('0x11a')][_0x9978('0x114')](db['OpenchannelMessage'],{'as':_0x9978('0x161'),'onDelete':_0x9978('0x112'),'foreignKey':_0x9978('0x192')});db[_0x9978('0x11a')][_0x9978('0x124')](db[_0x9978('0x5c')],{'as':_0x9978('0x176'),'foreignKey':_0x9978('0x18f')});db[_0x9978('0x11a')][_0x9978('0x124')](db['CmContact'],{'as':_0x9978('0x177'),'foreignKey':_0x9978('0x167')});db[_0x9978('0x11a')][_0x9978('0x124')](db['User'],{'as':'Owner','foreignKey':_0x9978('0x113')});db[_0x9978('0x11a')][_0x9978('0x126')](db[_0x9978('0x179')],{'through':_0x9978('0x193'),'as':'Tags'});db['OpenchannelInteraction'][_0x9978('0x126')](db[_0x9978('0x179')],{'through':'openchannel_interaction_has_tags','as':_0x9978('0x17c')});db[_0x9978('0x11a')][_0x9978('0x126')](db[_0x9978('0x13')],{'as':'Users','through':_0x9978('0x194'),'foreignKey':_0x9978('0x192')});db[_0x9978('0x5e')]['belongsTo'](db[_0x9978('0x13')],{'onDelete':_0x9978('0x112'),'as':_0x9978('0x13')});db[_0x9978('0x5e')][_0x9978('0x124')](db['CmContact'],{'onDelete':_0x9978('0x112'),'as':'Contact'});db['OpenchannelMessage']['belongsTo'](db['OpenchannelInteraction'],{'onDelete':'cascade','as':'Interaction','foreignKey':'OpenchannelInteractionId'});db[_0x9978('0x5e')][_0x9978('0x124')](db[_0x9978('0xec')],{'as':'Attachment','foreignKey':_0x9978('0x187')});db['OpenchannelMessage'][_0x9978('0x124')](db[_0x9978('0x5c')],{'as':'Account','foreignKey':_0x9978('0x18f')});db[_0x9978('0x60')][_0x9978('0x126')](db['User'],{'as':'Agents','through':_0x9978('0x13b'),'foreignKey':_0x9978('0x191')});db[_0x9978('0x60')][_0x9978('0x126')](db[_0x9978('0xe6')],{'through':_0x9978('0x195'),'as':'Teams'});db[_0x9978('0x141')][_0x9978('0x114')](db[_0x9978('0x7a')],{'as':_0x9978('0x16c'),'foreignKey':_0x9978('0x17f'),'onDelete':'cascade'});db[_0x9978('0x141')][_0x9978('0x114')](db[_0x9978('0x79')],{'as':_0x9978('0x16d'),'foreignKey':_0x9978('0x17f')});db[_0x9978('0x141')][_0x9978('0x114')](db['ChatProactiveAction'],{'as':_0x9978('0x196')});db[_0x9978('0x141')][_0x9978('0x114')](db[_0x9978('0x11c')],{'as':_0x9978('0x16e')});db[_0x9978('0x141')][_0x9978('0x114')](db[_0x9978('0x197')],{'as':_0x9978('0x16f')});db['ChatWebsite'][_0x9978('0x114')](db[_0x9978('0x65')],{'as':_0x9978('0x161')});db[_0x9978('0x141')]['belongsTo'](db['CmList'],{'as':_0x9978('0x170'),'foreignKey':'ListId'});db[_0x9978('0x141')][_0x9978('0x124')](db[_0x9978('0x15b')],{'as':'Interval','foreignKey':'IntervalId'});db[_0x9978('0x141')][_0x9978('0x124')](db[_0x9978('0x146')],{'as':_0x9978('0x146'),'foreignKey':'MailAccountId'});db[_0x9978('0x141')]['belongsTo'](db[_0x9978('0x173')],{'as':_0x9978('0x15d'),'foreignKey':_0x9978('0x15e')});db[_0x9978('0x141')][_0x9978('0x126')](db[_0x9978('0x13')],{'as':_0x9978('0x15f'),'through':_0x9978('0x143')});db['OpenchannelQueueReport'][_0x9978('0x124')](db[_0x9978('0x5c')],{});db[_0x9978('0x198')][_0x9978('0x124')](db[_0x9978('0xf9')],{'as':'List','foreignKey':'ListId'});db[_0x9978('0x198')][_0x9978('0x124')](db['CmContact'],{'as':_0x9978('0x177'),'foreignKey':_0x9978('0x167')});db[_0x9978('0x198')]['belongsTo'](db[_0x9978('0x11a')],{});db[_0x9978('0x198')][_0x9978('0x124')](db[_0x9978('0x5e')],{});db[_0x9978('0x198')]['belongsTo'](db['User'],{});db[_0x9978('0x198')]['belongsTo'](db['OpenchannelQueue'],{});db[_0x9978('0x197')][_0x9978('0x124')](db[_0x9978('0x13')],{'as':_0x9978('0x199'),'foreignKey':_0x9978('0x113'),'onDelete':'restrict'});db[_0x9978('0x197')][_0x9978('0x124')](db[_0x9978('0x136')],{'as':_0x9978('0x19a'),'foreignKey':'ChatQueueId','onDelete':_0x9978('0x180')});db[_0x9978('0x197')]['belongsTo'](db[_0x9978('0x141')],{'as':_0x9978('0x19b'),'foreignKey':_0x9978('0x17f'),'onDelete':_0x9978('0x180')});db[_0x9978('0x197')][_0x9978('0x124')](db[_0x9978('0x179')],{'onDelete':'restrict','foreignKey':_0x9978('0x181')});db[_0x9978('0x11c')][_0x9978('0x114')](db[_0x9978('0x65')],{'as':_0x9978('0x161'),'onDelete':_0x9978('0x112'),'foreignKey':_0x9978('0x19c')});db['ChatInteraction'][_0x9978('0x124')](db[_0x9978('0x141')],{'as':'Account','foreignKey':_0x9978('0x17f')});db[_0x9978('0x11c')][_0x9978('0x124')](db['CmContact'],{'as':_0x9978('0x177'),'foreignKey':_0x9978('0x167')});db['ChatInteraction']['belongsTo'](db['User'],{'as':_0x9978('0x178'),'foreignKey':_0x9978('0x113')});db[_0x9978('0x11c')][_0x9978('0x126')](db['Tag'],{'through':_0x9978('0x19d'),'as':_0x9978('0x17a')});db['ChatInteraction'][_0x9978('0x126')](db[_0x9978('0x179')],{'through':_0x9978('0x19d'),'as':_0x9978('0x17c')});db['ChatInteraction'][_0x9978('0x126')](db['User'],{'as':_0x9978('0x17d'),'through':_0x9978('0x12f'),'foreignKey':_0x9978('0x19c')});db[_0x9978('0x65')][_0x9978('0x124')](db[_0x9978('0x13')],{'onDelete':'cascade','as':_0x9978('0x13')});db[_0x9978('0x65')][_0x9978('0x124')](db['CmContact'],{'onDelete':'cascade','as':_0x9978('0x177'),'foreignKey':_0x9978('0x167')});db[_0x9978('0x65')]['belongsTo'](db['ChatInteraction'],{'onDelete':'cascade','as':_0x9978('0x186'),'foreignKey':'ChatInteractionId'});db[_0x9978('0x65')][_0x9978('0x124')](db[_0x9978('0xec')],{'as':_0x9978('0xec'),'foreignKey':_0x9978('0x187')});db[_0x9978('0x65')][_0x9978('0x124')](db[_0x9978('0x141')],{'as':_0x9978('0x176'),'foreignKey':_0x9978('0x17f')});db[_0x9978('0x66')][_0x9978('0x114')](db[_0x9978('0xec')],{'as':_0x9978('0x17e'),'foreignKey':_0x9978('0x19e'),'onDelete':_0x9978('0x112'),'hooks':!![]});db[_0x9978('0x66')][_0x9978('0x124')](db[_0x9978('0x6d')],{'onDelete':_0x9978('0x112'),'as':_0x9978('0x177'),'foreignKey':_0x9978('0x167')});db['ChatOfflineMessage'][_0x9978('0x124')](db[_0x9978('0x141')],{'as':_0x9978('0x176'),'foreignKey':'ChatWebsiteId'});db[_0x9978('0x136')][_0x9978('0x126')](db[_0x9978('0x13')],{'as':_0x9978('0x15f'),'through':'UserChatQueue','hooks':!![]});db['ChatQueue'][_0x9978('0x126')](db['Team'],{'through':_0x9978('0x19f'),'as':'Teams'});db[_0x9978('0x68')][_0x9978('0x114')](db[_0x9978('0xd0')],{'as':_0x9978('0x161'),'foreignKey':_0x9978('0x1a0'),'onDelete':_0x9978('0x112')});db[_0x9978('0x68')][_0x9978('0x126')](db['User'],{'as':'Members','through':_0x9978('0x128')});db[_0x9978('0x6a')][_0x9978('0x124')](db['ChatWebsite'],{'as':_0x9978('0x19b'),'foreignKey':_0x9978('0x17f')});db[_0x9978('0x6b')][_0x9978('0x114')](db['CmContact'],{'as':_0x9978('0x129'),'foreignKey':'CompanyId'});db[_0x9978('0x6d')][_0x9978('0x114')](db[_0x9978('0x6f')],{'as':_0x9978('0x153'),'foreignKey':_0x9978('0x167')});db[_0x9978('0x6d')][_0x9978('0x114')](db[_0x9978('0x72')],{'as':_0x9978('0x155'),'foreignKey':_0x9978('0x167')});db[_0x9978('0x6d')][_0x9978('0x114')](db['CmHopperHistory'],{'as':_0x9978('0x156'),'foreignKey':_0x9978('0x167')});db[_0x9978('0x6d')][_0x9978('0x114')](db[_0x9978('0x119')],{'as':_0x9978('0x119'),'foreignKey':_0x9978('0x167')});db[_0x9978('0x6d')][_0x9978('0x114')](db[_0x9978('0xd6')],{'as':_0x9978('0x1a1'),'foreignKey':_0x9978('0x167')});db['CmContact'][_0x9978('0x114')](db[_0x9978('0x11a')],{'as':_0x9978('0x11b'),'foreignKey':_0x9978('0x167'),'onDelete':_0x9978('0x180')});db[_0x9978('0x6d')][_0x9978('0x114')](db[_0x9978('0x11c')],{'as':_0x9978('0x11d'),'foreignKey':_0x9978('0x167'),'onDelete':_0x9978('0x180')});db[_0x9978('0x6d')][_0x9978('0x114')](db[_0x9978('0x11e')],{'as':_0x9978('0x11f'),'foreignKey':'ContactId','onDelete':_0x9978('0x180')});db[_0x9978('0x6d')][_0x9978('0x114')](db[_0x9978('0x130')],{'as':'FaxInteractions','foreignKey':'ContactId','onDelete':_0x9978('0x180')});db['CmContact'][_0x9978('0x114')](db[_0x9978('0x3f')],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':_0x9978('0x180')});db[_0x9978('0x6d')]['belongsTo'](db['CmCompany'],{'as':'Company','foreignKey':_0x9978('0x1a2')});db[_0x9978('0x6d')][_0x9978('0x124')](db['CmList'],{'as':'List','foreignKey':'ListId','onDelete':_0x9978('0x112')});db[_0x9978('0x6d')][_0x9978('0x126')](db[_0x9978('0x13')],{'as':_0x9978('0x17d'),'through':_0x9978('0x12a')});db[_0x9978('0x6d')]['belongsToMany'](db[_0x9978('0x179')],{'as':_0x9978('0x17a'),'through':_0x9978('0x1a3')});db[_0x9978('0x6d')]['belongsToMany'](db['Tag'],{'through':'cm_contact_has_tags','as':'ThroughTags'});db[_0x9978('0x6f')][_0x9978('0x124')](db['CmContact'],{'as':_0x9978('0x177'),'foreignKey':_0x9978('0x167'),'onDelete':_0x9978('0x112')});db[_0x9978('0x6f')][_0x9978('0x124')](db['CmList'],{'as':_0x9978('0x170'),'foreignKey':'ListId','onDelete':_0x9978('0x112')});db[_0x9978('0x6f')][_0x9978('0x124')](db[_0x9978('0x13')],{'as':_0x9978('0x199'),'foreignKey':_0x9978('0x113')});db['CmHopper'][_0x9978('0x124')](db[_0x9978('0x1d')],{'as':'Queue','foreignKey':_0x9978('0x154'),'onDelete':'cascade'});db[_0x9978('0x6f')]['belongsTo'](db[_0x9978('0xe8')],{'as':_0x9978('0xe8'),'foreignKey':_0x9978('0x1a4'),'onDelete':_0x9978('0x112')});db['CmHopper'][_0x9978('0x124')](db['User'],{'as':'Owner','foreignKey':_0x9978('0x1a5')});db['CmHopperBlack'][_0x9978('0x124')](db[_0x9978('0x6d')],{'as':_0x9978('0x177'),'foreignKey':_0x9978('0x167'),'onDelete':_0x9978('0x112')});db[_0x9978('0x70')][_0x9978('0x124')](db['CmList'],{'as':_0x9978('0x170'),'foreignKey':_0x9978('0x171'),'onDelete':'cascade'});db['CmHopperBlack'][_0x9978('0x124')](db[_0x9978('0x1d')],{'as':_0x9978('0x19a'),'foreignKey':_0x9978('0x154'),'onDelete':_0x9978('0x112')});db[_0x9978('0x70')]['belongsTo'](db[_0x9978('0xe8')],{'as':_0x9978('0xe8'),'foreignKey':_0x9978('0x1a4'),'onDelete':_0x9978('0x112')});db[_0x9978('0x77')][_0x9978('0x114')](db[_0x9978('0x7b')],{'as':{'plural':_0x9978('0x1a6'),'singular':'OneAll'},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db['Automation'][_0x9978('0x114')](db[_0x9978('0x7b')],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0x9978('0x112'),'hooks':!![]});db[_0x9978('0x77')][_0x9978('0x114')](db[_0x9978('0x76')],{'as':_0x9978('0x1a7'),'foreignKey':'AutomationId','onDelete':_0x9978('0x112'),'hooks':!![]});db[_0x9978('0x7a')][_0x9978('0x114')](db[_0x9978('0x7a')],{'as':_0x9978('0x16c'),'foreignKey':_0x9978('0x1a8'),'onDelete':'cascade'});db['Interval'][_0x9978('0x114')](db[_0x9978('0x15b')],{'as':_0x9978('0x1a9'),'foreignKey':_0x9978('0x15c'),'onDelete':_0x9978('0x112'),'hooks':!![],'required':![]});db[_0x9978('0x15b')][_0x9978('0x114')](db['VoiceExtension'],{'as':_0x9978('0x1aa'),'foreignKey':_0x9978('0x15c'),'onDelete':'restrict'});db[_0x9978('0x15b')]['hasMany'](db['MailApplication'],{'as':_0x9978('0x1ab'),'foreignKey':_0x9978('0x15c')});db[_0x9978('0x15b')][_0x9978('0x114')](db[_0x9978('0x197')],{'as':_0x9978('0x1ac'),'foreignKey':_0x9978('0x15c')});db[_0x9978('0x15b')][_0x9978('0x114')](db['FaxApplication'],{'as':_0x9978('0x1ad'),'foreignKey':_0x9978('0x15c')});db[_0x9978('0x15b')][_0x9978('0x114')](db[_0x9978('0x189')],{'as':_0x9978('0x1ae'),'foreignKey':_0x9978('0x15c')});db[_0x9978('0x81')]['belongsTo'](db[_0x9978('0x146')],{});db['Schedule'][_0x9978('0x124')](db[_0x9978('0x8f')],{'foreignKey':'DefaultReportId'});db[_0x9978('0x81')][_0x9978('0x124')](db[_0x9978('0x8d')],{'foreignKey':'CustomReportId'});db[_0x9978('0x82')]['belongsToMany'](db['VoiceMusicOnHold'],{'as':'Mohs','through':_0x9978('0x151'),'onDelete':_0x9978('0x180')});db['Tag'][_0x9978('0x126')](db[_0x9978('0x6d')],{'through':_0x9978('0x1a3')});db['Tag']['belongsToMany'](db['ChatInteraction'],{'through':_0x9978('0x19d')});db[_0x9978('0x179')]['belongsToMany'](db[_0x9978('0x3f')],{'through':_0x9978('0x17b')});db[_0x9978('0x179')]['belongsToMany'](db[_0x9978('0x11e')],{'through':_0x9978('0x18b')});db[_0x9978('0x179')][_0x9978('0x126')](db[_0x9978('0x130')],{'through':_0x9978('0x1af')});db[_0x9978('0x179')]['belongsToMany'](db['OpenchannelInteraction'],{'through':_0x9978('0x193')});db[_0x9978('0x179')]['belongsToMany'](db[_0x9978('0x107')],{'through':_0x9978('0x1b0')});db['Trigger']['hasMany'](db[_0x9978('0x7b')],{'as':{'plural':_0x9978('0x1b1'),'singular':'AllCondition'},'foreignKey':_0x9978('0x1b2'),'onDelete':_0x9978('0x112'),'hooks':!![]});db[_0x9978('0x87')][_0x9978('0x114')](db[_0x9978('0x7b')],{'as':{'plural':'AnyConditions','singular':_0x9978('0x1b3')},'foreignKey':'TriggerAnyId','onDelete':_0x9978('0x112'),'hooks':!![]});db[_0x9978('0x87')][_0x9978('0x114')](db[_0x9978('0x76')],{'as':'Actions','foreignKey':_0x9978('0x1b4'),'onDelete':'cascade','hooks':!![]});db[_0x9978('0x8d')]['hasMany'](db[_0x9978('0x95')],{'as':_0x9978('0x1b5'),'onDelete':'cascade','foreignKey':_0x9978('0x1b6'),'hooks':!![]});db['AnalyticDefaultReport'][_0x9978('0x114')](db['AnalyticFieldReport'],{'as':_0x9978('0x1b5'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x9978('0x93')][_0x9978('0x114')](db[_0x9978('0x95')],{'as':_0x9978('0x1b5'),'onDelete':_0x9978('0x112'),'foreignKey':_0x9978('0x1b7')});db[_0x9978('0x95')]['belongsTo'](db['AnalyticMetric'],{'foreignKey':_0x9978('0x1b7')});db[_0x9978('0x99')][_0x9978('0x114')](db[_0x9978('0x9b')],{'as':_0x9978('0x1b8'),'onDelete':_0x9978('0x112'),'foreignKey':_0x9978('0x1b9')});db[_0x9978('0x9b')][_0x9978('0x114')](db[_0x9978('0x9d')],{'as':_0x9978('0x1ba'),'onDelete':_0x9978('0x112'),'foreignKey':'SubjectId'});db['SalesforceConfiguration']['hasMany'](db[_0x9978('0x9d')],{'as':_0x9978('0x1bb'),'onDelete':_0x9978('0x112'),'foreignKey':'DescriptionId'});db[_0x9978('0x9b')][_0x9978('0x114')](db[_0x9978('0x9d')],{'as':_0x9978('0x1b5'),'onDelete':_0x9978('0x112'),'foreignKey':'FieldId'});db[_0x9978('0x9b')]['belongsTo'](db[_0x9978('0x99')],{'as':'Account','foreignKey':_0x9978('0x1b9')});db[_0x9978('0x9d')][_0x9978('0x114')](db['SalesforceField'],{'as':_0x9978('0x1bc'),'foreignKey':_0x9978('0x1bd')});db['SalesforceField']['hasMany'](db[_0x9978('0x9d')],{'as':_0x9978('0x1be'),'foreignKey':_0x9978('0x1bf')});db[_0x9978('0x9d')][_0x9978('0x114')](db['SalesforceField'],{'as':'Field','foreignKey':_0x9978('0x1c0')});db[_0x9978('0x9d')][_0x9978('0x124')](db[_0x9978('0x1c1')],{'as':_0x9978('0x1c1'),'foreignKey':_0x9978('0x1c2')});db['SugarcrmAccount']['hasMany'](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':_0x9978('0x112'),'foreignKey':_0x9978('0x1b9')});db['SugarcrmConfiguration']['hasMany'](db[_0x9978('0x1c3')],{'as':'Subjects','onDelete':_0x9978('0x112'),'foreignKey':'SubjectId'});db[_0x9978('0x9f')][_0x9978('0x114')](db[_0x9978('0x1c3')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x9978('0x9f')]['hasMany'](db[_0x9978('0x1c3')],{'as':'Fields','onDelete':_0x9978('0x112'),'foreignKey':_0x9978('0x1c0')});db[_0x9978('0x9f')][_0x9978('0x124')](db[_0x9978('0x9e')],{'as':'Account','foreignKey':'AccountId'});db[_0x9978('0x1c3')]['hasMany'](db[_0x9978('0x1c3')],{'as':_0x9978('0x1bc'),'foreignKey':_0x9978('0x1bd')});db[_0x9978('0x1c3')][_0x9978('0x114')](db['SugarcrmField'],{'as':_0x9978('0x1be'),'foreignKey':_0x9978('0x1bf')});db[_0x9978('0x1c3')][_0x9978('0x114')](db[_0x9978('0x1c3')],{'as':_0x9978('0x1c4'),'foreignKey':'FieldId'});db['SugarcrmField']['belongsTo'](db[_0x9978('0x1c1')],{'as':_0x9978('0x1c1'),'foreignKey':_0x9978('0x1c2')});db[_0x9978('0xa2')][_0x9978('0x114')](db[_0x9978('0xa3')],{'as':'Configurations','onDelete':_0x9978('0x112'),'foreignKey':_0x9978('0x1b9')});db[_0x9978('0xa3')][_0x9978('0x114')](db[_0x9978('0xa5')],{'as':_0x9978('0x1ba'),'onDelete':'cascade','foreignKey':'SubjectId'});db['DeskConfiguration'][_0x9978('0x114')](db[_0x9978('0xa5')],{'as':_0x9978('0x1bb'),'onDelete':'cascade','foreignKey':_0x9978('0x1bf')});db['DeskConfiguration'][_0x9978('0x114')](db[_0x9978('0xa5')],{'as':_0x9978('0x1b5'),'onDelete':_0x9978('0x112'),'foreignKey':_0x9978('0x1c0')});db['DeskConfiguration']['belongsTo'](db[_0x9978('0xa2')],{'as':'Account','foreignKey':_0x9978('0x1b9')});db[_0x9978('0xa3')][_0x9978('0x126')](db['Tag'],{'through':_0x9978('0x1c5')});db[_0x9978('0xa5')]['hasMany'](db[_0x9978('0xa5')],{'as':_0x9978('0x1bc'),'foreignKey':_0x9978('0x1bd')});db[_0x9978('0xa5')][_0x9978('0x114')](db['DeskField'],{'as':_0x9978('0x1be'),'foreignKey':_0x9978('0x1bf')});db[_0x9978('0xa5')][_0x9978('0x114')](db[_0x9978('0xa5')],{'as':_0x9978('0x1c4'),'foreignKey':'FieldId'});db[_0x9978('0xa5')][_0x9978('0x124')](db[_0x9978('0x1c1')],{'as':_0x9978('0x1c1'),'foreignKey':_0x9978('0x1c2')});db[_0x9978('0xa7')]['hasMany'](db[_0x9978('0xa9')],{'as':_0x9978('0x1b8'),'onDelete':'cascade','foreignKey':_0x9978('0x1b9')});db[_0x9978('0xa9')][_0x9978('0x114')](db[_0x9978('0xab')],{'as':_0x9978('0x1ba'),'onDelete':'cascade','foreignKey':_0x9978('0x1bd')});db[_0x9978('0xa9')][_0x9978('0x114')](db[_0x9978('0xab')],{'as':'Descriptions','onDelete':_0x9978('0x112'),'foreignKey':_0x9978('0x1bf')});db[_0x9978('0xa9')]['hasMany'](db[_0x9978('0xab')],{'as':_0x9978('0x1b5'),'onDelete':_0x9978('0x112'),'foreignKey':_0x9978('0x1c0')});db[_0x9978('0xa9')][_0x9978('0x124')](db[_0x9978('0xa7')],{'as':_0x9978('0x176'),'foreignKey':_0x9978('0x1b9')});db['ZohoField'][_0x9978('0x114')](db[_0x9978('0xab')],{'as':_0x9978('0x1bc'),'foreignKey':'SubjectId'});db[_0x9978('0xab')]['hasMany'](db['ZohoField'],{'as':'Description','foreignKey':_0x9978('0x1bf')});db['ZohoField'][_0x9978('0x114')](db[_0x9978('0xab')],{'as':_0x9978('0x1c4'),'foreignKey':_0x9978('0x1c0')});db[_0x9978('0xab')][_0x9978('0x124')](db[_0x9978('0x1c1')],{'as':_0x9978('0x1c1'),'foreignKey':_0x9978('0x1c2')});db['ZendeskAccount'][_0x9978('0x114')](db[_0x9978('0x1c6')],{'as':_0x9978('0x1b8'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x9978('0x1c6')][_0x9978('0x114')](db[_0x9978('0xb0')],{'as':_0x9978('0x1ba'),'foreignKey':_0x9978('0x1bd')});db['ZendeskConfiguration']['hasMany'](db['ZendeskField'],{'as':_0x9978('0x1bb'),'foreignKey':_0x9978('0x1bf')});db['ZendeskConfiguration']['hasMany'](db[_0x9978('0xb0')],{'as':_0x9978('0x1b5'),'foreignKey':_0x9978('0x1c0')});db['ZendeskConfiguration']['belongsTo'](db[_0x9978('0xad')],{'as':_0x9978('0x176'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x9978('0x126')](db[_0x9978('0x179')],{'through':_0x9978('0x1c7')});db[_0x9978('0xb0')][_0x9978('0x114')](db[_0x9978('0xb0')],{'as':_0x9978('0x1bc'),'foreignKey':'SubjectId'});db['ZendeskField']['hasMany'](db['ZendeskField'],{'as':_0x9978('0x1be'),'foreignKey':_0x9978('0x1bf')});db['ZendeskField'][_0x9978('0x114')](db[_0x9978('0xb0')],{'as':_0x9978('0x1c4'),'foreignKey':_0x9978('0x1c0')});db[_0x9978('0xb0')]['belongsTo'](db[_0x9978('0x1c1')],{'as':_0x9978('0x1c1'),'foreignKey':_0x9978('0x1c2')});db[_0x9978('0xb2')]['hasMany'](db[_0x9978('0xb4')],{'as':_0x9978('0x1b8'),'onDelete':_0x9978('0x112'),'foreignKey':_0x9978('0x1b9')});db['FreshdeskConfiguration'][_0x9978('0x114')](db[_0x9978('0xb6')],{'as':_0x9978('0x1ba'),'onDelete':_0x9978('0x112'),'foreignKey':_0x9978('0x1bd')});db[_0x9978('0xb4')][_0x9978('0x114')](db[_0x9978('0xb6')],{'as':_0x9978('0x1bb'),'onDelete':'cascade','foreignKey':_0x9978('0x1bf')});db[_0x9978('0xb4')][_0x9978('0x114')](db[_0x9978('0xb6')],{'as':_0x9978('0x1b5'),'onDelete':_0x9978('0x112'),'foreignKey':_0x9978('0x1c0')});db[_0x9978('0xb4')][_0x9978('0x124')](db[_0x9978('0xb2')],{'as':_0x9978('0x176'),'foreignKey':'AccountId'});db[_0x9978('0xb4')][_0x9978('0x126')](db[_0x9978('0x179')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x9978('0xb6')][_0x9978('0x114')](db['FreshdeskField'],{'as':'Subject','foreignKey':_0x9978('0x1bd')});db[_0x9978('0xb6')][_0x9978('0x114')](db['FreshdeskField'],{'as':_0x9978('0x1be'),'foreignKey':_0x9978('0x1bf')});db[_0x9978('0xb6')][_0x9978('0x114')](db['FreshdeskField'],{'as':_0x9978('0x1c4'),'foreignKey':'FieldId'});db['FreshdeskField'][_0x9978('0x124')](db[_0x9978('0x1c1')],{'as':_0x9978('0x1c1'),'foreignKey':_0x9978('0x1c2')});db['VtigerAccount']['hasMany'](db['VtigerConfiguration'],{'as':'Configurations','onDelete':_0x9978('0x112'),'foreignKey':_0x9978('0x1b9')});db[_0x9978('0xba')][_0x9978('0x114')](db[_0x9978('0xbc')],{'as':_0x9978('0x1ba'),'foreignKey':_0x9978('0x1bd')});db[_0x9978('0xba')][_0x9978('0x114')](db[_0x9978('0xbc')],{'as':_0x9978('0x1bb'),'foreignKey':_0x9978('0x1bf')});db[_0x9978('0xba')][_0x9978('0x114')](db[_0x9978('0xbc')],{'as':_0x9978('0x1b5'),'foreignKey':_0x9978('0x1c0')});db[_0x9978('0xba')][_0x9978('0x124')](db[_0x9978('0xb8')],{'as':_0x9978('0x176'),'foreignKey':_0x9978('0x1b9')});db['VtigerField']['hasMany'](db[_0x9978('0xbc')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x9978('0xbc')][_0x9978('0x114')](db[_0x9978('0xbc')],{'as':_0x9978('0x1be'),'foreignKey':'DescriptionId'});db[_0x9978('0xbc')]['hasMany'](db[_0x9978('0xbc')],{'as':_0x9978('0x1c4'),'foreignKey':_0x9978('0x1c0')});db[_0x9978('0xbc')]['belongsTo'](db[_0x9978('0x1c1')],{'as':_0x9978('0x1c1'),'foreignKey':_0x9978('0x1c2')});db[_0x9978('0xbe')][_0x9978('0x114')](db[_0x9978('0xc0')],{'as':'Configurations','onDelete':_0x9978('0x112'),'foreignKey':'AccountId'});db[_0x9978('0xc0')]['hasMany'](db[_0x9978('0x1c8')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x9978('0xc0')]['hasMany'](db[_0x9978('0x1c8')],{'as':_0x9978('0x1bb'),'foreignKey':_0x9978('0x1bf')});db['ServicenowConfiguration'][_0x9978('0x114')](db['ServicenowField'],{'as':_0x9978('0x1b5'),'foreignKey':_0x9978('0x1c0')});db['ServicenowConfiguration'][_0x9978('0x124')](db[_0x9978('0xbe')],{'as':_0x9978('0x176'),'foreignKey':_0x9978('0x1b9')});db[_0x9978('0x1c8')][_0x9978('0x114')](db['ServicenowField'],{'as':_0x9978('0x1bc'),'foreignKey':_0x9978('0x1bd')});db[_0x9978('0x1c8')]['hasMany'](db[_0x9978('0x1c8')],{'as':_0x9978('0x1be'),'foreignKey':_0x9978('0x1bf')});db[_0x9978('0x1c8')][_0x9978('0x114')](db['ServicenowField'],{'as':_0x9978('0x1c4'),'foreignKey':_0x9978('0x1c0')});db[_0x9978('0x1c8')][_0x9978('0x124')](db[_0x9978('0x1c1')],{'as':_0x9978('0x1c1'),'foreignKey':'VariableId'});db[_0x9978('0x1c9')][_0x9978('0x114')](db[_0x9978('0xc4')],{'as':_0x9978('0x1b8'),'onDelete':_0x9978('0x112'),'foreignKey':_0x9978('0x1b9')});db['Dynamics365Configuration'][_0x9978('0x114')](db[_0x9978('0xc6')],{'as':_0x9978('0x1ba'),'onDelete':_0x9978('0x112'),'foreignKey':'SubjectId'});db[_0x9978('0xc4')]['hasMany'](db[_0x9978('0xc6')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x9978('0x1bf')});db[_0x9978('0xc4')][_0x9978('0x114')](db['Dynamics365Field'],{'as':_0x9978('0x1b5'),'onDelete':_0x9978('0x112'),'foreignKey':_0x9978('0x1c0')});db['Dynamics365Configuration']['belongsTo'](db[_0x9978('0x1c9')],{'as':'Account','foreignKey':_0x9978('0x1b9')});db['Dynamics365Field'][_0x9978('0x114')](db[_0x9978('0xc6')],{'as':_0x9978('0x1bc'),'foreignKey':_0x9978('0x1bd')});db['Dynamics365Field'][_0x9978('0x114')](db[_0x9978('0xc6')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x9978('0xc6')]['hasMany'](db[_0x9978('0xc6')],{'as':_0x9978('0x1c4'),'foreignKey':_0x9978('0x1c0')});db[_0x9978('0xc6')][_0x9978('0x124')](db[_0x9978('0x1c1')],{'as':_0x9978('0x1c1'),'foreignKey':_0x9978('0x1c2')});db[_0x9978('0xc8')][_0x9978('0x114')](db[_0x9978('0x1ca')],{'as':_0x9978('0x1b8'),'onDelete':'cascade','foreignKey':_0x9978('0x1b9')});db[_0x9978('0x1ca')][_0x9978('0x114')](db['FreshsalesField'],{'as':_0x9978('0x1ba'),'foreignKey':_0x9978('0x1bd')});db[_0x9978('0x1ca')][_0x9978('0x114')](db[_0x9978('0xca')],{'as':_0x9978('0x1bb'),'foreignKey':_0x9978('0x1bf')});db[_0x9978('0x1ca')][_0x9978('0x114')](db[_0x9978('0xca')],{'as':_0x9978('0x1b5'),'foreignKey':_0x9978('0x1c0')});db[_0x9978('0x1ca')][_0x9978('0x124')](db['FreshsalesAccount'],{'as':_0x9978('0x176'),'foreignKey':_0x9978('0x1b9')});db[_0x9978('0xca')][_0x9978('0x114')](db[_0x9978('0xca')],{'as':_0x9978('0x1bc'),'foreignKey':_0x9978('0x1bd')});db[_0x9978('0xca')][_0x9978('0x114')](db[_0x9978('0xca')],{'as':_0x9978('0x1be'),'foreignKey':_0x9978('0x1bf')});db['FreshsalesField'][_0x9978('0x114')](db['FreshsalesField'],{'as':_0x9978('0x1c4'),'foreignKey':_0x9978('0x1c0')});db[_0x9978('0xca')][_0x9978('0x124')](db['Variable'],{'as':_0x9978('0x1c1'),'foreignKey':'VariableId'});db[_0x9978('0xce')]['belongsTo'](db[_0x9978('0x141')],{});db[_0x9978('0xce')][_0x9978('0x124')](db[_0x9978('0xf9')],{'as':_0x9978('0x170'),'foreignKey':_0x9978('0x171')});db[_0x9978('0xce')]['belongsTo'](db[_0x9978('0x6d')],{'as':_0x9978('0x177'),'foreignKey':_0x9978('0x167')});db['ChatQueueReport'][_0x9978('0x124')](db['ChatInteraction'],{});db[_0x9978('0xce')][_0x9978('0x124')](db[_0x9978('0x65')],{});db[_0x9978('0xce')]['belongsTo'](db[_0x9978('0x13')],{});db[_0x9978('0xce')][_0x9978('0x124')](db['ChatQueue'],{});db['ChatInternalMessage'][_0x9978('0x124')](db[_0x9978('0x13')],{'onDelete':_0x9978('0x112'),'foreignKey':_0x9978('0x1cb')});db[_0x9978('0xd0')][_0x9978('0x124')](db[_0x9978('0x13')],{'onDelete':_0x9978('0x112'),'foreignKey':_0x9978('0x1cc')});db['JscriptySessionReport'][_0x9978('0x114')](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x9978('0xd6')]['hasMany'](db[_0x9978('0xd2')],{'foreignKey':_0x9978('0x1cd'),'onDelete':_0x9978('0x112')});db['SmsQueueReport'][_0x9978('0x124')](db[_0x9978('0x55')],{});db[_0x9978('0x1ce')]['belongsTo'](db[_0x9978('0xf9')],{'as':_0x9978('0x170'),'foreignKey':_0x9978('0x171')});db[_0x9978('0x1ce')][_0x9978('0x124')](db[_0x9978('0x6d')],{'as':_0x9978('0x177'),'foreignKey':'ContactId'});db[_0x9978('0x1ce')][_0x9978('0x124')](db[_0x9978('0x11e')],{});db['SmsQueueReport'][_0x9978('0x124')](db[_0x9978('0x58')],{});db[_0x9978('0x1ce')]['belongsTo'](db[_0x9978('0x13')],{});db[_0x9978('0x1ce')][_0x9978('0x124')](db[_0x9978('0x5a')],{});db[_0x9978('0xdc')]['hasMany'](db[_0x9978('0xd6')],{'foreignKey':_0x9978('0x1cf')});db[_0x9978('0xdc')][_0x9978('0x114')](db[_0x9978('0xd4')],{'foreignKey':'ProjectId'});db[_0x9978('0xdc')][_0x9978('0x114')](db[_0x9978('0xd2')],{'foreignKey':'ProjectId'});db[_0x9978('0x1d0')][_0x9978('0x126')](db[_0x9978('0x13')],{'as':_0x9978('0x17d'),'through':'user_has_square_projects'});db[_0x9978('0xe6')][_0x9978('0x126')](db['User'],{'as':_0x9978('0x15f'),'through':_0x9978('0x12d')});db[_0x9978('0xe6')][_0x9978('0x126')](db[_0x9978('0x1d')],{'through':_0x9978('0x110'),'as':'VoiceQueues'});db[_0x9978('0xe6')][_0x9978('0x126')](db['MailQueue'],{'through':_0x9978('0x174'),'as':'MailQueues'});db[_0x9978('0xe6')]['belongsToMany'](db['ChatQueue'],{'through':_0x9978('0x19f'),'as':_0x9978('0x137')});db[_0x9978('0xe6')]['belongsToMany'](db[_0x9978('0x51')],{'through':'team_has_fax_queues','as':'FaxQueues'});db['Team'][_0x9978('0x126')](db[_0x9978('0x5a')],{'through':_0x9978('0x18e'),'as':_0x9978('0x139')});db[_0x9978('0xe6')][_0x9978('0x126')](db[_0x9978('0x60')],{'through':'team_has_openchannel_queues','as':_0x9978('0x13a')});db['Team'][_0x9978('0x126')](db[_0x9978('0x10e')],{'through':_0x9978('0x1d1'),'as':_0x9978('0x13c')});db['Campaign'][_0x9978('0x114')](db['CmHopper'],{'as':_0x9978('0x153'),'foreignKey':_0x9978('0x1a4')});db['Campaign'][_0x9978('0x114')](db[_0x9978('0x72')],{'as':'HopperFinals','foreignKey':_0x9978('0x1a4')});db[_0x9978('0xe8')][_0x9978('0x114')](db[_0x9978('0x117')],{'as':_0x9978('0x156'),'foreignKey':_0x9978('0x1a4')});db['Campaign'][_0x9978('0x114')](db[_0x9978('0x70')],{'as':_0x9978('0x1d2'),'foreignKey':_0x9978('0x1a4')});db[_0x9978('0xe8')][_0x9978('0x124')](db[_0x9978('0x157')],{'as':_0x9978('0x157'),'foreignKey':_0x9978('0x158')});db[_0x9978('0xe8')][_0x9978('0x124')](db[_0x9978('0x157')],{'as':_0x9978('0x159'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x9978('0x124')](db['Interval'],{'as':_0x9978('0x15b'),'foreignKey':'IntervalId'});db['Campaign'][_0x9978('0x124')](db[_0x9978('0x1d0')],{'as':_0x9978('0x1d0'),'foreignKey':_0x9978('0x1d3')});db[_0x9978('0xe8')][_0x9978('0x126')](db[_0x9978('0xf9')],{'as':_0x9978('0x12b'),'through':'campaigns_has_cm_lists'});db[_0x9978('0xe8')][_0x9978('0x126')](db[_0x9978('0xf9')],{'as':'BlackLists','through':_0x9978('0x1d4')});db[_0x9978('0xec')][_0x9978('0x124')](db[_0x9978('0x66')],{'as':_0x9978('0x66'),'foreignKey':_0x9978('0x19e')});db[_0x9978('0xf0')][_0x9978('0x124')](db[_0x9978('0x41')],{});db[_0x9978('0xf0')]['belongsTo'](db['MailInteraction'],{});db[_0x9978('0xf0')][_0x9978('0x124')](db['MailAccount'],{'foreignKey':'FromMailAccountId','as':_0x9978('0x1d5')});db[_0x9978('0xf0')][_0x9978('0x124')](db[_0x9978('0x13')],{'foreignKey':_0x9978('0x1d6'),'as':_0x9978('0x1d7')});db[_0x9978('0xf0')][_0x9978('0x124')](db['User'],{'foreignKey':'ToUserId','as':_0x9978('0x1d8')});db[_0x9978('0xf0')][_0x9978('0x124')](db[_0x9978('0x3b')],{'foreignKey':_0x9978('0x1d9'),'as':_0x9978('0x1da')});db[_0x9978('0xf0')][_0x9978('0x124')](db[_0x9978('0x146')],{'foreignKey':_0x9978('0x1db'),'as':_0x9978('0x1dc')});db['ChatTransferReport'][_0x9978('0x124')](db[_0x9978('0x65')],{});db[_0x9978('0xf2')][_0x9978('0x124')](db[_0x9978('0x11c')],{});db[_0x9978('0xf2')][_0x9978('0x124')](db[_0x9978('0x141')],{'foreignKey':'FromChatWebsiteId','as':_0x9978('0x1d5')});db['ChatTransferReport']['belongsTo'](db[_0x9978('0x13')],{'foreignKey':'FromUserId','as':_0x9978('0x1d7')});db[_0x9978('0xf2')][_0x9978('0x124')](db[_0x9978('0x13')],{'foreignKey':'ToUserId','as':_0x9978('0x1d8')});db[_0x9978('0xf2')]['belongsTo'](db[_0x9978('0x136')],{'foreignKey':_0x9978('0x1dd'),'as':_0x9978('0x1da')});db[_0x9978('0xf2')][_0x9978('0x124')](db[_0x9978('0x141')],{'foreignKey':_0x9978('0x1de'),'as':_0x9978('0x1dc')});db[_0x9978('0xf4')][_0x9978('0x124')](db[_0x9978('0x4f')],{});db[_0x9978('0xf4')][_0x9978('0x124')](db[_0x9978('0x130')],{});db[_0x9978('0xf4')][_0x9978('0x124')](db['FaxAccount'],{'foreignKey':'FromFaxAccountId','as':_0x9978('0x1d5')});db['FaxTransferReport'][_0x9978('0x124')](db['User'],{'foreignKey':_0x9978('0x1d6'),'as':'FromAgent'});db[_0x9978('0xf4')]['belongsTo'](db['User'],{'foreignKey':_0x9978('0x1df'),'as':_0x9978('0x1d8')});db[_0x9978('0xf4')][_0x9978('0x124')](db[_0x9978('0x51')],{'foreignKey':'ToFaxQueueId','as':_0x9978('0x1da')});db[_0x9978('0xf4')][_0x9978('0x124')](db['FaxAccount'],{'foreignKey':'ToFaxAccountId','as':_0x9978('0x1dc')});db['OpenchannelTransferReport'][_0x9978('0x124')](db[_0x9978('0x5e')],{});db[_0x9978('0xf6')][_0x9978('0x124')](db[_0x9978('0x11a')],{});db[_0x9978('0xf6')][_0x9978('0x124')](db['OpenchannelAccount'],{'foreignKey':_0x9978('0x1e0'),'as':_0x9978('0x1d5')});db['OpenchannelTransferReport'][_0x9978('0x124')](db[_0x9978('0x13')],{'foreignKey':_0x9978('0x1d6'),'as':'FromAgent'});db[_0x9978('0xf6')][_0x9978('0x124')](db[_0x9978('0x13')],{'foreignKey':_0x9978('0x1df'),'as':'ToAgent'});db[_0x9978('0xf6')][_0x9978('0x124')](db[_0x9978('0x60')],{'foreignKey':'ToOpenchannelQueueId','as':_0x9978('0x1da')});db[_0x9978('0xf6')][_0x9978('0x124')](db[_0x9978('0x5c')],{'foreignKey':_0x9978('0x1e1'),'as':_0x9978('0x1dc')});db[_0x9978('0xf7')]['belongsTo'](db[_0x9978('0x58')],{});db[_0x9978('0xf7')][_0x9978('0x124')](db[_0x9978('0x11e')],{});db[_0x9978('0xf7')][_0x9978('0x124')](db['SmsAccount'],{'foreignKey':_0x9978('0x1e2'),'as':'FromAccount'});db['SmsTransferReport']['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x9978('0xf7')][_0x9978('0x124')](db['User'],{'foreignKey':_0x9978('0x1df'),'as':_0x9978('0x1d8')});db['SmsTransferReport'][_0x9978('0x124')](db[_0x9978('0x5a')],{'foreignKey':_0x9978('0x1e3'),'as':_0x9978('0x1da')});db[_0x9978('0xf7')][_0x9978('0x124')](db['SmsAccount'],{'foreignKey':_0x9978('0x1e4'),'as':'ToAccount'});db[_0x9978('0xf9')]['hasMany'](db[_0x9978('0x7a')],{'as':_0x9978('0x16c'),'foreignKey':_0x9978('0x171'),'onDelete':'cascade'});db[_0x9978('0xf9')]['hasMany'](db['CmCustomField'],{'as':_0x9978('0x1e5'),'foreignKey':'ListId'});db[_0x9978('0xf9')]['hasMany'](db[_0x9978('0x6d')],{'as':_0x9978('0x129'),'onDelete':'cascade','foreignKey':_0x9978('0x171')});db[_0x9978('0xf9')][_0x9978('0x114')](db[_0x9978('0x72')],{'as':_0x9978('0x155'),'foreignKey':_0x9978('0x171')});db[_0x9978('0xf9')][_0x9978('0x114')](db['CmHopperHistory'],{'as':_0x9978('0x118'),'foreignKey':_0x9978('0x171')});db[_0x9978('0xf9')]['hasMany'](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'ListId'});db[_0x9978('0xf9')][_0x9978('0x126')](db[_0x9978('0x1d')],{'as':'Queues','through':_0x9978('0x1e6')});db[_0x9978('0xf9')][_0x9978('0x126')](db[_0x9978('0x13')],{'as':_0x9978('0x15f'),'through':_0x9978('0x12c')});db[_0x9978('0x13e')][_0x9978('0x114')](db['VoiceExtension'],{'as':_0x9978('0x1aa'),'onDelete':_0x9978('0x112')});db[_0x9978('0x13e')][_0x9978('0x126')](db['User'],{'as':_0x9978('0x15f'),'through':_0x9978('0x140')});db[_0x9978('0xfc')]['hasMany'](db[_0x9978('0x13')],{'as':_0x9978('0x17d'),'foreignKey':_0x9978('0x125')});db[_0x9978('0xfc')]['hasMany'](db[_0x9978('0x1e7')],{'as':_0x9978('0x1e8'),'foreignKey':_0x9978('0x125'),'onDelete':_0x9978('0x112')});db[_0x9978('0x1e7')]['hasMany'](db[_0x9978('0xff')],{'as':'Resources','foreignKey':_0x9978('0x1e9'),'onDelete':_0x9978('0x112')});db[_0x9978('0x103')][_0x9978('0x114')](db[_0x9978('0x7a')],{'as':'Dispositions','foreignKey':_0x9978('0x1ea'),'onDelete':_0x9978('0x112')});db[_0x9978('0x103')]['hasMany'](db[_0x9978('0x79')],{'as':'Answers','foreignKey':_0x9978('0x1ea')});db[_0x9978('0x103')][_0x9978('0x114')](db[_0x9978('0x1eb')],{'as':_0x9978('0x161'),'foreignKey':_0x9978('0x1ea')});db['WhatsappAccount'][_0x9978('0x114')](db['WhatsappInteraction'],{'as':_0x9978('0x16e')});db[_0x9978('0x103')][_0x9978('0x114')](db[_0x9978('0x105')],{'as':_0x9978('0x16f')});db['WhatsappAccount'][_0x9978('0x124')](db['CmList'],{'as':_0x9978('0x170'),'foreignKey':_0x9978('0x171')});db[_0x9978('0x103')]['belongsTo'](db[_0x9978('0x173')],{'as':_0x9978('0x15d'),'foreignKey':_0x9978('0x15e')});db[_0x9978('0x103')][_0x9978('0x126')](db[_0x9978('0x13')],{'as':_0x9978('0x15f'),'through':_0x9978('0x14e')});db[_0x9978('0x105')][_0x9978('0x124')](db[_0x9978('0x13')],{'onDelete':_0x9978('0x180')});db[_0x9978('0x105')][_0x9978('0x124')](db[_0x9978('0x10e')],{'onDelete':_0x9978('0x180')});db[_0x9978('0x105')][_0x9978('0x124')](db[_0x9978('0x103')],{'onDelete':_0x9978('0x180')});db[_0x9978('0x105')]['belongsTo'](db[_0x9978('0x15b')],{'onDelete':_0x9978('0x180'),'foreignKey':_0x9978('0x15c')});db[_0x9978('0x105')][_0x9978('0x124')](db['Tag'],{'onDelete':_0x9978('0x180'),'foreignKey':_0x9978('0x181')});db[_0x9978('0x107')]['hasMany'](db[_0x9978('0x1eb')],{'as':_0x9978('0x161'),'onDelete':'cascade','foreignKey':'WhatsappInteractionId'});db['WhatsappInteraction']['belongsTo'](db['WhatsappAccount'],{'as':'Account','foreignKey':_0x9978('0x1ea')});db[_0x9978('0x107')][_0x9978('0x124')](db[_0x9978('0x6d')],{'as':_0x9978('0x177'),'foreignKey':'ContactId'});db[_0x9978('0x107')][_0x9978('0x124')](db['User'],{'as':_0x9978('0x178'),'foreignKey':_0x9978('0x113')});db[_0x9978('0x107')]['belongsToMany'](db[_0x9978('0x179')],{'through':_0x9978('0x1b0'),'as':_0x9978('0x17a')});db[_0x9978('0x107')][_0x9978('0x126')](db[_0x9978('0x179')],{'through':_0x9978('0x1b0'),'as':'ThroughTags'});db[_0x9978('0x107')]['belongsToMany'](db[_0x9978('0x13')],{'as':_0x9978('0x17d'),'through':_0x9978('0x133'),'foreignKey':_0x9978('0x1ec')});db[_0x9978('0x1eb')]['belongsTo'](db[_0x9978('0x13')],{'as':_0x9978('0x13')});db[_0x9978('0x1eb')][_0x9978('0x124')](db[_0x9978('0x6d')],{'onDelete':_0x9978('0x112'),'as':_0x9978('0x177')});db[_0x9978('0x1eb')][_0x9978('0x124')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x9978('0x186'),'foreignKey':_0x9978('0x1ec')});db[_0x9978('0x1eb')][_0x9978('0x124')](db[_0x9978('0x103')],{'as':_0x9978('0x176'),'foreignKey':_0x9978('0x1ea')});db[_0x9978('0x10a')][_0x9978('0x124')](db[_0x9978('0x103')],{});db[_0x9978('0x10a')][_0x9978('0x124')](db['CmList'],{'as':_0x9978('0x170'),'foreignKey':_0x9978('0x171')});db['WhatsappQueueReport']['belongsTo'](db[_0x9978('0x6d')],{'as':_0x9978('0x177'),'foreignKey':_0x9978('0x167')});db[_0x9978('0x10a')][_0x9978('0x124')](db[_0x9978('0x107')],{});db['WhatsappQueueReport'][_0x9978('0x124')](db[_0x9978('0x10e')],{});db[_0x9978('0x10a')]['belongsTo'](db[_0x9978('0x1eb')],{});db[_0x9978('0x10a')][_0x9978('0x124')](db[_0x9978('0x13')],{});db[_0x9978('0x10c')][_0x9978('0x124')](db['WhatsappMessage'],{});db[_0x9978('0x10c')][_0x9978('0x124')](db[_0x9978('0x107')],{});db[_0x9978('0x10c')]['belongsTo'](db[_0x9978('0x103')],{'foreignKey':_0x9978('0x1ed'),'as':_0x9978('0x1d5')});db[_0x9978('0x10c')][_0x9978('0x124')](db[_0x9978('0x103')],{'foreignKey':'ToWhatsappAccountId','as':'ToAccount'});db[_0x9978('0x10c')][_0x9978('0x124')](db[_0x9978('0x10e')],{'foreignKey':_0x9978('0x1ee'),'as':_0x9978('0x1da')});db[_0x9978('0x10c')][_0x9978('0x124')](db[_0x9978('0x13')],{'foreignKey':_0x9978('0x1d6'),'as':_0x9978('0x1d7')});db[_0x9978('0x10c')][_0x9978('0x124')](db[_0x9978('0x13')],{'foreignKey':_0x9978('0x1df'),'as':'ToAgent'});db['WhatsappQueue'][_0x9978('0x126')](db[_0x9978('0x13')],{'as':_0x9978('0x15f'),'through':_0x9978('0x13d'),'foreignKey':_0x9978('0x1ef')});db[_0x9978('0x10e')][_0x9978('0x126')](db['Team'],{'through':_0x9978('0x1d1'),'as':_0x9978('0x160')});module[_0x9978('0x1f0')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x59cc=['MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','Members','Hoppers','VoiceQueueId','HopperFinals','HopperHistories','HopperBlacks','JscriptySessionReport','JscriptySessions','TrunkBackup','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','Agents','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','hasOne','Smtp','Disposition','Answers','ListId','Template','TemplateId','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','user_has_mail_interactions','Attachments','ChatOfflineMessageId','restrict','TagId','List','DashboardItem','Items','FaxAccount','Dispositions','FaxAccountId','FaxInteractionId','fax_interaction_has_tags','user_has_fax_interactions','AttachmentId','Teams','SmsAccountId','Interactions','mandatoryDispositionPauseId','SmsInteractionId','sms_interaction_has_tags','SmsMessage','Interaction','team_has_sms_queues','OpenchannelAccount','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','Users','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','OpenchannelQueueReport','Agent','Queue','Website','ChatInteractionId','chat_interaction_has_tags','ChatQueue','team_has_chat_queues','ChatGroupId','Contacts','Company','CompanyId','cm_contact_has_tags','Campaign','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','FaxApplications','SmsApplications','Mohs','whatsapp_interaction_has_tags','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerId','Fields','CustomReportId','SalesforceAccount','Configurations','AccountId','SalesforceField','Subjects','Descriptions','DescriptionId','FieldId','Subject','SubjectId','Description','Field','Variable','VariableId','SugarcrmConfiguration','int_desk_configuration_has_tags','ZohoConfiguration','ZendeskField','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskField','VtigerAccount','Dynamics365Configuration','Dynamics365Field','FreshsalesAccount','JscriptyAnswerReport','ProjectId','VoiceQueues','team_has_mail_queues','team_has_fax_queues','SmsQueues','OpenchannelQueues','WhatsappQueue','team_has_whatsapp_queues','TrunkId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','ToSmsQueueId','ToSmsAccountId','CmCustomField','Queues','voice_queues_has_cm_lists','VoicePrefix','user_has_voice_prefixes','Resources','sectionId','WhatsappInteractionId','WhatsappAccountId','user_has_whatsapp_interactions','WhatsappQueueReport','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','motion2','xcall','name','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','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/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsQueue/smsQueue.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','../api/license/license.model','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperHistory','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','chat_group_has_users','CmContact','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_chat_interactions','user_has_sms_interactions','user_has_openchannel_interactions','ChatQueues','FaxQueues','SmsQueue','UserSmsQueue','VoicePrefixes','ChatWebsite','user_has_chat_websites','FaxAccounts','user_has_fax_accounts'];(function(_0x3a540c,_0xaf805a){var _0x473b27=function(_0x42510b){while(--_0x42510b){_0x3a540c['push'](_0x3a540c['shift']());}};_0x473b27(++_0xaf805a);}(_0x59cc,0xc7));var _0xc59c=function(_0x21cc0b,_0x1613b4){_0x21cc0b=_0x21cc0b-0x0;var _0xb9b4e4=_0x59cc[_0x21cc0b];return _0xb9b4e4;};'use strict';var config=require(_0xc59c('0x0'));var Sequelize=require(_0xc59c('0x1'));var _=require(_0xc59c('0x2'));var jstz=require(_0xc59c('0x3'));var timezone=jstz[_0xc59c('0x4')]();config['sequelize']=_[_0xc59c('0x5')](config['sequelize'],{'database':'motion2','username':'xcall','password':_0xc59c('0x6'),'options':{'host':_0xc59c('0x7'),'port':0xcea,'dialect':_0xc59c('0x8'),'dialectOptions':{'charset':_0xc59c('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xc59c('0xa'),'collate':_0xc59c('0xb')}}});config[_0xc59c('0xc')]=_['defaultsDeep'](config[_0xc59c('0xc')],{'database':_0xc59c('0xd'),'username':_0xc59c('0xe'),'password':_0xc59c('0x6'),'options':{'host':_0xc59c('0x7'),'port':0xcea,'dialect':_0xc59c('0x8'),'dialectOptions':{'charset':_0xc59c('0x9')},'logging':![],'timezone':timezone[_0xc59c('0xf')](),'define':{'charset':_0xc59c('0xa'),'collate':_0xc59c('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xc59c('0x1')][_0xc59c('0x10')],config[_0xc59c('0x1')][_0xc59c('0x11')],config[_0xc59c('0x1')][_0xc59c('0x12')],config[_0xc59c('0x1')][_0xc59c('0x13')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xc59c('0xc')][_0xc59c('0x10')],config[_0xc59c('0xc')]['username'],config[_0xc59c('0xc')][_0xc59c('0x12')],config[_0xc59c('0xc')][_0xc59c('0x13')])};db[_0xc59c('0x14')]=db['sequelize'][_0xc59c('0x15')](_0xc59c('0x16'));db[_0xc59c('0x17')]=db[_0xc59c('0x1')][_0xc59c('0x15')]('../api/voiceChanSpy/voiceChanSpy.model');db['VoiceContext']=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x18'));db[_0xc59c('0x19')]=db[_0xc59c('0x1')][_0xc59c('0x15')]('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db[_0xc59c('0x1')][_0xc59c('0x15')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0xc59c('0x1a')]=db['sequelize'][_0xc59c('0x15')](_0xc59c('0x1b'));db[_0xc59c('0x1c')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x1d'));db[_0xc59c('0x1e')]=db['sequelize'][_0xc59c('0x15')](_0xc59c('0x1f'));db[_0xc59c('0x20')]=db['sequelize'][_0xc59c('0x15')]('../api/voiceMail/voiceMail.model');db[_0xc59c('0x21')]=db[_0xc59c('0x1')][_0xc59c('0x15')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xc59c('0x22')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x23'));db['VoiceDialReport']=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x24'));db[_0xc59c('0x25')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x26'));db[_0xc59c('0x27')]=db['sequelize'][_0xc59c('0x15')]('../api/voiceQueueReport/voiceQueueReport.model');db['MemberReport']=db['sequelize'][_0xc59c('0x15')](_0xc59c('0x28'));db[_0xc59c('0x29')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x2a'));db[_0xc59c('0x2b')]=db[_0xc59c('0x1')]['import'](_0xc59c('0x2c'));db[_0xc59c('0x2d')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x2e'));db[_0xc59c('0x2f')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x30'));db[_0xc59c('0x31')]=db[_0xc59c('0x1')]['import'](_0xc59c('0x32'));db[_0xc59c('0x33')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x34'));db[_0xc59c('0x35')]=db['sequelize'][_0xc59c('0x15')](_0xc59c('0x36'));db['UserSmsQueue']=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x37'));db[_0xc59c('0x38')]=db['sequelize'][_0xc59c('0x15')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xc59c('0x39')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x3a'));db[_0xc59c('0x3b')]=db['sequelize'][_0xc59c('0x15')](_0xc59c('0x3c'));db[_0xc59c('0x3d')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x3e'));db['MailAccount']=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x3f'));db[_0xc59c('0x40')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x41'));db[_0xc59c('0x42')]=db['sequelize'][_0xc59c('0x15')](_0xc59c('0x43'));db[_0xc59c('0x44')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x45'));db[_0xc59c('0x46')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x47'));db[_0xc59c('0x48')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x49'));db[_0xc59c('0x4a')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x4b'));db[_0xc59c('0x4c')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x4d'));db['DashboardItem']=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x4e'));db['FaxAccount']=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x4f'));db[_0xc59c('0x50')]=db[_0xc59c('0x1')]['import'](_0xc59c('0x51'));db[_0xc59c('0x52')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x53'));db[_0xc59c('0x54')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x55'));db[_0xc59c('0x56')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x57'));db[_0xc59c('0x58')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x59'));db[_0xc59c('0x5a')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x5b'));db[_0xc59c('0x5c')]=db['sequelize'][_0xc59c('0x15')](_0xc59c('0x5d'));db[_0xc59c('0x5e')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x5f'));db['SmsMessage']=db[_0xc59c('0x1')][_0xc59c('0x15')]('../api/smsMessage/smsMessage.model');db['SmsQueue']=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x60'));db['OpenchannelAccount']=db[_0xc59c('0x1')][_0xc59c('0x15')]('../api/openchannelAccount/openchannelAccount.model');db[_0xc59c('0x61')]=db[_0xc59c('0x1')]['import'](_0xc59c('0x62'));db['OpenchannelInteraction']=db[_0xc59c('0x1')][_0xc59c('0x15')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0xc59c('0x63')]=db[_0xc59c('0x1')]['import'](_0xc59c('0x64'));db[_0xc59c('0x65')]=db[_0xc59c('0x1')]['import'](_0xc59c('0x66'));db['ChatWebsite']=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x67'));db['OpenchannelQueueReport']=db['sequelize'][_0xc59c('0x15')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xc59c('0x68')]=db['sequelize'][_0xc59c('0x15')](_0xc59c('0x69'));db[_0xc59c('0x6a')]=db['sequelize']['import'](_0xc59c('0x6b'));db[_0xc59c('0x6c')]=db['sequelize'][_0xc59c('0x15')](_0xc59c('0x6d'));db[_0xc59c('0x6e')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x6f'));db['ChatQueue']=db[_0xc59c('0x1')]['import'](_0xc59c('0x70'));db[_0xc59c('0x71')]=db['sequelize'][_0xc59c('0x15')](_0xc59c('0x72'));db[_0xc59c('0x73')]=db[_0xc59c('0x1')]['import'](_0xc59c('0x74'));db[_0xc59c('0x75')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x76'));db['CmContact']=db['sequelize'][_0xc59c('0x15')](_0xc59c('0x77'));db[_0xc59c('0x78')]=db['sequelize'][_0xc59c('0x15')](_0xc59c('0x79'));db[_0xc59c('0x7a')]=db[_0xc59c('0x1')][_0xc59c('0x15')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0xc59c('0x7b')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x7c'));db[_0xc59c('0x7d')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x7e'));db[_0xc59c('0x7f')]=db['sequelize']['import']('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db[_0xc59c('0x1')]['import']('../api/cmCustomField/cmCustomField.model');db[_0xc59c('0x80')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x81'));db[_0xc59c('0x82')]=db['sequelize'][_0xc59c('0x15')](_0xc59c('0x83'));db[_0xc59c('0x84')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x85'));db['Disposition']=db[_0xc59c('0x1')]['import'](_0xc59c('0x86'));db[_0xc59c('0x87')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x88'));db[_0xc59c('0x89')]=db[_0xc59c('0x1')]['import'](_0xc59c('0x8a'));db['Pause']=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x8b'));db[_0xc59c('0x8c')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x8d'));db[_0xc59c('0x8e')]=db['sequelize'][_0xc59c('0x15')](_0xc59c('0x8f'));db[_0xc59c('0x90')]=db[_0xc59c('0x1')]['import'](_0xc59c('0x91'));db['Sound']=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x92'));db[_0xc59c('0x93')]=db['sequelize'][_0xc59c('0x15')](_0xc59c('0x94'));db['Template']=db[_0xc59c('0x1')]['import']('../api/template/template.model');db[_0xc59c('0x95')]=db[_0xc59c('0x1')]['import'](_0xc59c('0x96'));db['Variable']=db[_0xc59c('0x1')]['import'](_0xc59c('0x97'));db['Integration']=db[_0xc59c('0x1')][_0xc59c('0x15')]('../api/integration/integration.model');db[_0xc59c('0x98')]=db[_0xc59c('0x1')][_0xc59c('0x15')]('../api/integrationReport/integrationReport.model');db[_0xc59c('0x99')]=db[_0xc59c('0x1')]['import'](_0xc59c('0x9a'));db[_0xc59c('0x9b')]=db['sequelize'][_0xc59c('0x15')](_0xc59c('0x9c'));db[_0xc59c('0x9d')]=db[_0xc59c('0x1')][_0xc59c('0x15')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xc59c('0x9e')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x9f'));db[_0xc59c('0xa0')]=db[_0xc59c('0x1')][_0xc59c('0x15')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xa1'));db['SalesforceAccount']=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xa2'));db[_0xc59c('0xa3')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xa4'));db['SalesforceField']=db[_0xc59c('0x1')][_0xc59c('0x15')]('../api/intSalesforceField/intSalesforceField.model');db[_0xc59c('0xa5')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xa6'));db['SugarcrmConfiguration']=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xa7'));db[_0xc59c('0xa8')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xa9'));db[_0xc59c('0xaa')]=db[_0xc59c('0x1')]['import'](_0xc59c('0xab'));db[_0xc59c('0xac')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xad'));db[_0xc59c('0xae')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xaf'));db[_0xc59c('0xb0')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xb1'));db['ZohoConfiguration']=db['sequelize'][_0xc59c('0x15')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0xc59c('0xb2')]=db[_0xc59c('0x1')]['import'](_0xc59c('0xb3'));db['ZendeskAccount']=db['sequelize'][_0xc59c('0x15')](_0xc59c('0xb4'));db[_0xc59c('0xb5')]=db[_0xc59c('0x1')][_0xc59c('0x15')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db['sequelize'][_0xc59c('0x15')](_0xc59c('0xb6'));db['FreshdeskAccount']=db[_0xc59c('0x1')]['import'](_0xc59c('0xb7'));db[_0xc59c('0xb8')]=db['sequelize']['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db['FreshdeskField']=db[_0xc59c('0x1')][_0xc59c('0x15')]('../api/intFreshdeskField/intFreshdeskField.model');db['VtigerAccount']=db[_0xc59c('0x1')]['import']('../api/intVtigerAccount/intVtigerAccount.model');db[_0xc59c('0xb9')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xba'));db[_0xc59c('0xbb')]=db['sequelize'][_0xc59c('0x15')](_0xc59c('0xbc'));db[_0xc59c('0xbd')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xbe'));db[_0xc59c('0xbf')]=db['sequelize']['import'](_0xc59c('0xc0'));db[_0xc59c('0xc1')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xc2'));db[_0xc59c('0xc3')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xc4'));db['Dynamics365Configuration']=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xc5'));db['Dynamics365Field']=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xc6'));db['FreshsalesAccount']=db[_0xc59c('0x1')]['import'](_0xc59c('0xc7'));db[_0xc59c('0xc8')]=db[_0xc59c('0x1')]['import'](_0xc59c('0xc9'));db[_0xc59c('0xca')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xcb'));db[_0xc59c('0xcc')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xcd'));db[_0xc59c('0xce')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xcf'));db[_0xc59c('0xd0')]=db['sequelize'][_0xc59c('0x15')](_0xc59c('0xd1'));db[_0xc59c('0xd2')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xd3'));db['JscriptyAnswerReport']=db['sequelize'][_0xc59c('0x15')](_0xc59c('0xd4'));db[_0xc59c('0xd5')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xd6'));db['JscriptySessionReport']=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xd7'));db[_0xc59c('0xd8')]=db[_0xc59c('0x1')]['import']('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xd9'));db[_0xc59c('0xda')]=db['sequelize']['import'](_0xc59c('0xdb'));db[_0xc59c('0xdc')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xdd'));db[_0xc59c('0xde')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xdf'));db[_0xc59c('0xe0')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xe1'));db[_0xc59c('0xe2')]=db[_0xc59c('0x1')][_0xc59c('0x15')]('../api/squareProject/squareProject.model');db[_0xc59c('0xe3')]=db[_0xc59c('0x1')]['import'](_0xc59c('0xe4'));db[_0xc59c('0xe5')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xe6'));db['Team']=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xe7'));db['License']=db[_0xc59c('0x1')]['import'](_0xc59c('0xe8'));db['Campaign']=db[_0xc59c('0x1')][_0xc59c('0x15')]('../api/campaign/campaign.model');db['Migration']=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xe9'));db[_0xc59c('0xea')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xeb'));db['Plugin']=db['sequelize'][_0xc59c('0x15')](_0xc59c('0xec'));db[_0xc59c('0xed')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xee'));db[_0xc59c('0xef')]=db['sequelize']['import'](_0xc59c('0xf0'));db[_0xc59c('0xf1')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xf2'));db['OpenchannelTransferReport']=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xf3'));db['SmsTransferReport']=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xf4'));db[_0xc59c('0xf5')]=db['sequelize'][_0xc59c('0x15')]('../api/cmList/cmList.model');db['VoicePrefix']=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xf6'));db[_0xc59c('0xf7')]=db[_0xc59c('0x1')]['import'](_0xc59c('0xf8'));db[_0xc59c('0xf9')]=db['sequelize'][_0xc59c('0x15')](_0xc59c('0xfa'));db[_0xc59c('0xfb')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xfc'));db['UserNotification']=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xfd'));db[_0xc59c('0xfe')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0xff'));db[_0xc59c('0x100')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x101'));db[_0xc59c('0x102')]=db['sequelize'][_0xc59c('0x15')](_0xc59c('0x103'));db[_0xc59c('0x104')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x105'));db['WhatsappQueueReport']=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x106'));db[_0xc59c('0x107')]=db[_0xc59c('0x1')]['import'](_0xc59c('0x108'));db['WhatsappQueue']=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x109'));db[_0xc59c('0x10a')]=db[_0xc59c('0x1')][_0xc59c('0x15')](_0xc59c('0x10b'));db[_0xc59c('0x10c')]=db[_0xc59c('0x1')]['import'](_0xc59c('0x10d'));db[_0xc59c('0x14')]['hasOne'](db[_0xc59c('0x20')],{'as':'VoiceMail','onDelete':_0xc59c('0x10e'),'foreignKey':_0xc59c('0x10f')});db[_0xc59c('0x14')][_0xc59c('0x110')](db[_0xc59c('0x1c')],{'as':_0xc59c('0x111'),'foreignKey':_0xc59c('0x10f')});db['User'][_0xc59c('0x110')](db['UserVoiceQueueRt'],{'as':_0xc59c('0x112'),'foreignKey':_0xc59c('0x10f')});db[_0xc59c('0x14')][_0xc59c('0x110')](db[_0xc59c('0x19')],{'as':_0xc59c('0x113'),'onDelete':_0xc59c('0x10e'),'hooks':!![]});db[_0xc59c('0x14')][_0xc59c('0x110')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xc59c('0x10f')});db['User'][_0xc59c('0x110')](db[_0xc59c('0x7d')],{'as':_0xc59c('0x114'),'foreignKey':_0xc59c('0x10f')});db[_0xc59c('0x14')][_0xc59c('0x110')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xc59c('0x10f')});db[_0xc59c('0x14')][_0xc59c('0x110')](db[_0xc59c('0x115')],{'as':_0xc59c('0x116'),'foreignKey':'UserId'});db[_0xc59c('0x14')][_0xc59c('0x110')](db[_0xc59c('0x6a')],{'as':_0xc59c('0x117'),'foreignKey':_0xc59c('0x10f')});db['User'][_0xc59c('0x110')](db[_0xc59c('0x5e')],{'as':_0xc59c('0x118'),'foreignKey':_0xc59c('0x10f')});db['User'][_0xc59c('0x110')](db['FaxInteraction'],{'as':_0xc59c('0x119'),'foreignKey':_0xc59c('0x10f')});db[_0xc59c('0x14')][_0xc59c('0x110')](db[_0xc59c('0x44')],{'as':_0xc59c('0x11a'),'foreignKey':_0xc59c('0x10f')});db['User'][_0xc59c('0x110')](db[_0xc59c('0x102')],{'as':_0xc59c('0x11b'),'foreignKey':_0xc59c('0x10f')});db[_0xc59c('0x14')][_0xc59c('0x110')](db['UserNotification'],{'as':_0xc59c('0x11c'),'foreignKey':_0xc59c('0x11d')});db[_0xc59c('0x14')][_0xc59c('0x11e')](db[_0xc59c('0xf7')],{'as':'UserProfile','foreignKey':_0xc59c('0x11f')});db['User'][_0xc59c('0x120')](db[_0xc59c('0x71')],{'as':'Groups','through':_0xc59c('0x121')});db[_0xc59c('0x14')]['belongsToMany'](db[_0xc59c('0x122')],{'as':'Contacts','through':_0xc59c('0x123')});db['User'][_0xc59c('0x120')](db['CmList'],{'as':_0xc59c('0x124'),'through':_0xc59c('0x125')});db[_0xc59c('0x14')][_0xc59c('0x120')](db[_0xc59c('0x126')],{'through':_0xc59c('0x127')});db[_0xc59c('0x14')][_0xc59c('0x120')](db[_0xc59c('0x44')],{'as':'MailInteractions','through':'user_has_mail_interactions'});db[_0xc59c('0x14')][_0xc59c('0x120')](db[_0xc59c('0x6a')],{'as':_0xc59c('0x117'),'through':_0xc59c('0x128')});db[_0xc59c('0x14')]['belongsToMany'](db['FaxInteraction'],{'as':_0xc59c('0x119'),'through':'user_has_fax_interactions'});db[_0xc59c('0x14')]['belongsToMany'](db[_0xc59c('0x5e')],{'as':_0xc59c('0x118'),'through':_0xc59c('0x129')});db['User'][_0xc59c('0x120')](db['OpenchannelInteraction'],{'as':_0xc59c('0x116'),'through':_0xc59c('0x12a')});db['User'][_0xc59c('0x120')](db[_0xc59c('0x102')],{'as':_0xc59c('0x11b'),'through':'user_has_whatsapp_interactions'});db[_0xc59c('0x14')]['belongsToMany'](db[_0xc59c('0x1a')],{'as':'VoiceQueues','through':_0xc59c('0x2f'),'required':![]});db[_0xc59c('0x14')][_0xc59c('0x120')](db[_0xc59c('0x40')],{'as':'MailQueues','through':_0xc59c('0x33'),'required':![]});db['User']['belongsToMany'](db['ChatQueue'],{'as':_0xc59c('0x12b'),'through':_0xc59c('0x31'),'required':![],'hooks':!![]});db[_0xc59c('0x14')][_0xc59c('0x120')](db[_0xc59c('0x56')],{'as':_0xc59c('0x12c'),'through':'UserFaxQueue','required':![]});db[_0xc59c('0x14')]['belongsToMany'](db[_0xc59c('0x12d')],{'as':'SmsQueues','through':_0xc59c('0x12e'),'required':![]});db[_0xc59c('0x14')]['belongsToMany'](db[_0xc59c('0x65')],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db[_0xc59c('0x14')]['belongsToMany'](db['WhatsappQueue'],{'as':'WhatsappQueues','through':_0xc59c('0x39'),'required':![]});db['User'][_0xc59c('0x120')](db[_0xc59c('0xf5')],{'through':_0xc59c('0x125')});db['User'][_0xc59c('0x120')](db['VoicePrefix'],{'as':_0xc59c('0x12f'),'through':'user_has_voice_prefixes','required':![]});db[_0xc59c('0x14')]['belongsToMany'](db[_0xc59c('0x130')],{'as':'ChatWebsites','through':_0xc59c('0x131')});db[_0xc59c('0x14')][_0xc59c('0x120')](db['FaxAccount'],{'as':_0xc59c('0x132'),'through':_0xc59c('0x133')});db[_0xc59c('0x14')]['belongsToMany'](db[_0xc59c('0x134')],{'as':_0xc59c('0x135'),'through':_0xc59c('0x136')});db['User'][_0xc59c('0x120')](db['OpenchannelAccount'],{'as':_0xc59c('0x137'),'through':'user_has_openchannel_accounts'});db['User'][_0xc59c('0x120')](db[_0xc59c('0x5a')],{'as':_0xc59c('0x138'),'through':_0xc59c('0x139')});db[_0xc59c('0x14')]['belongsToMany'](db[_0xc59c('0xfe')],{'as':_0xc59c('0x13a'),'through':_0xc59c('0x13b')});db['User'][_0xc59c('0x120')](db[_0xc59c('0xe2')],{'as':'SquareProjects','through':_0xc59c('0x13c')});db[_0xc59c('0x17')]['hasMany'](db['VoiceExtension'],{'as':_0xc59c('0x13d'),'onDelete':_0xc59c('0x10e'),'foreignKey':_0xc59c('0x13e')});db['VoiceContext'][_0xc59c('0x110')](db['VoiceExtension'],{'onDelete':_0xc59c('0x10e')});db[_0xc59c('0x19')][_0xc59c('0x110')](db[_0xc59c('0x19')],{'as':_0xc59c('0x13f'),'onDelete':_0xc59c('0x10e')});db[_0xc59c('0x140')][_0xc59c('0x120')](db['Sound'],{'as':_0xc59c('0x141'),'through':_0xc59c('0x142')});db['VoiceQueue']['hasMany'](db[_0xc59c('0x2d')],{'as':_0xc59c('0x143'),'foreignKey':'VoiceQueueId'});db[_0xc59c('0x1a')][_0xc59c('0x110')](db[_0xc59c('0x78')],{'as':_0xc59c('0x144'),'foreignKey':_0xc59c('0x145')});db[_0xc59c('0x1a')]['hasMany'](db['CmHopperFinal'],{'as':_0xc59c('0x146'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xc59c('0x110')](db[_0xc59c('0x7d')],{'as':_0xc59c('0x147'),'foreignKey':_0xc59c('0x145')});db['VoiceQueue']['hasMany'](db[_0xc59c('0x7f')],{'as':_0xc59c('0x7f'),'foreignKey':_0xc59c('0x145')});db[_0xc59c('0x1a')][_0xc59c('0x110')](db[_0xc59c('0x7a')],{'as':_0xc59c('0x148'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xc59c('0x110')](db[_0xc59c('0x149')],{'as':_0xc59c('0x14a'),'foreignKey':'VoiceQueueId'});db[_0xc59c('0x1a')][_0xc59c('0x11e')](db[_0xc59c('0x29')],{'as':_0xc59c('0x29'),'foreignKey':'TrunkId'});db[_0xc59c('0x1a')]['belongsTo'](db[_0xc59c('0x29')],{'as':_0xc59c('0x14b'),'foreignKey':_0xc59c('0x14c')});db[_0xc59c('0x1a')][_0xc59c('0x11e')](db['Interval'],{'as':_0xc59c('0x89'),'foreignKey':_0xc59c('0x14d')});db[_0xc59c('0x1a')][_0xc59c('0x11e')](db[_0xc59c('0x14e')],{'as':_0xc59c('0x14f'),'foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue'][_0xc59c('0x120')](db[_0xc59c('0xf5')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db[_0xc59c('0x1a')][_0xc59c('0x120')](db['User'],{'as':_0xc59c('0x150'),'through':_0xc59c('0x2f')});db[_0xc59c('0x1a')]['belongsToMany'](db['Team'],{'as':'Teams','through':_0xc59c('0x10c')});db[_0xc59c('0x1a')][_0xc59c('0x120')](db['CmList'],{'as':'BlackLists','through':_0xc59c('0x151')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0xc59c('0x14'),'foreignKey':_0xc59c('0x10f')});db[_0xc59c('0x1e')][_0xc59c('0x11e')](db[_0xc59c('0x14')],{'as':'User','foreignKey':'UserId'});db['VoiceMail']['hasMany'](db[_0xc59c('0x21')],{'as':_0xc59c('0x152'),'onDelete':_0xc59c('0x10e'),'foreignKey':_0xc59c('0x153'),'sourceKey':_0xc59c('0x154')});db[_0xc59c('0x21')][_0xc59c('0x11e')](db[_0xc59c('0x20')],{'foreignKey':_0xc59c('0x153'),'targetKey':_0xc59c('0x154')});db['VoiceCallReport']['hasMany'](db[_0xc59c('0x27')],{'as':_0xc59c('0x155'),'foreignKey':_0xc59c('0x156'),'constraints':![]});db[_0xc59c('0x22')][_0xc59c('0x110')](db[_0xc59c('0x25')],{'as':_0xc59c('0x157'),'foreignKey':_0xc59c('0x156'),'constraints':![]});db['VoiceCallReport'][_0xc59c('0x11e')](db[_0xc59c('0x14')],{'as':_0xc59c('0x14'),'foreignKey':_0xc59c('0x10f')});db[_0xc59c('0x22')][_0xc59c('0x11e')](db['CmContact'],{'as':_0xc59c('0x158'),'foreignKey':_0xc59c('0x159')});db[_0xc59c('0x3b')][_0xc59c('0x11e')](db[_0xc59c('0x134')],{'as':'MailAccount','foreignKey':_0xc59c('0x15a')});db['MailServerOut']['belongsTo'](db['MailAccount'],{'as':_0xc59c('0x134'),'foreignKey':_0xc59c('0x15a')});db[_0xc59c('0x134')][_0xc59c('0x15b')](db[_0xc59c('0x3b')],{'as':'Imap','onDelete':_0xc59c('0x10e')});db['MailAccount'][_0xc59c('0x15b')](db['MailServerOut'],{'as':_0xc59c('0x15c'),'onDelete':_0xc59c('0x10e')});db['MailAccount'][_0xc59c('0x110')](db[_0xc59c('0x15d')],{'as':'Dispositions','foreignKey':'MailAccountId','onDelete':_0xc59c('0x10e')});db[_0xc59c('0x134')]['hasMany'](db[_0xc59c('0x84')],{'as':_0xc59c('0x15e'),'foreignKey':_0xc59c('0x15a')});db[_0xc59c('0x134')][_0xc59c('0x110')](db[_0xc59c('0x46')],{'as':_0xc59c('0x152'),'foreignKey':_0xc59c('0x15a')});db[_0xc59c('0x134')][_0xc59c('0x110')](db[_0xc59c('0x44')],{'as':'Interactions'});db[_0xc59c('0x134')][_0xc59c('0x110')](db[_0xc59c('0x48')],{'as':_0xc59c('0x13f')});db[_0xc59c('0x134')][_0xc59c('0x11e')](db[_0xc59c('0xf5')],{'as':'List','foreignKey':_0xc59c('0x15f')});db[_0xc59c('0x134')][_0xc59c('0x11e')](db['Template'],{'as':_0xc59c('0x160'),'foreignKey':_0xc59c('0x161')});db[_0xc59c('0x134')][_0xc59c('0x11e')](db[_0xc59c('0x14e')],{'as':_0xc59c('0x14f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xc59c('0x134')][_0xc59c('0x120')](db['User'],{'as':_0xc59c('0x150'),'through':_0xc59c('0x136')});db[_0xc59c('0x40')][_0xc59c('0x120')](db[_0xc59c('0x14')],{'as':_0xc59c('0x150'),'through':_0xc59c('0x33')});db[_0xc59c('0x40')][_0xc59c('0x120')](db[_0xc59c('0x126')],{'through':'team_has_mail_queues','as':'Teams'});db[_0xc59c('0x44')][_0xc59c('0x110')](db[_0xc59c('0x46')],{'as':_0xc59c('0x152'),'onDelete':_0xc59c('0x10e'),'foreignKey':_0xc59c('0x162')});db['MailInteraction']['belongsTo'](db['MailAccount'],{'as':_0xc59c('0x163'),'foreignKey':_0xc59c('0x15a')});db['MailInteraction'][_0xc59c('0x11e')](db['CmContact'],{'as':_0xc59c('0x158'),'foreignKey':'ContactId'});db['MailInteraction']['belongsTo'](db[_0xc59c('0x14')],{'as':_0xc59c('0x164'),'foreignKey':'UserId'});db[_0xc59c('0x44')][_0xc59c('0x120')](db[_0xc59c('0x93')],{'through':_0xc59c('0x165'),'as':_0xc59c('0x166')});db[_0xc59c('0x44')][_0xc59c('0x120')](db[_0xc59c('0x93')],{'through':_0xc59c('0x165'),'as':_0xc59c('0x167')});db[_0xc59c('0x44')][_0xc59c('0x120')](db['User'],{'as':'Users','through':_0xc59c('0x168'),'foreignKey':_0xc59c('0x162')});db[_0xc59c('0x46')]['hasMany'](db[_0xc59c('0xea')],{'as':_0xc59c('0x169'),'onDelete':_0xc59c('0x10e')});db[_0xc59c('0x46')][_0xc59c('0x11e')](db['User'],{'as':'User'});db['MailMessage'][_0xc59c('0x11e')](db[_0xc59c('0x122')],{'onDelete':_0xc59c('0x10e'),'as':_0xc59c('0x158')});db[_0xc59c('0x46')]['belongsTo'](db[_0xc59c('0x44')],{'as':'Interaction','foreignKey':_0xc59c('0x162')});db[_0xc59c('0x46')]['belongsTo'](db[_0xc59c('0x134')],{'as':_0xc59c('0x163'),'foreignKey':_0xc59c('0x15a')});db[_0xc59c('0x46')][_0xc59c('0x11e')](db[_0xc59c('0x130')],{'as':_0xc59c('0x130'),'foreignKey':'ChatWebsiteId'});db[_0xc59c('0x46')][_0xc59c('0x11e')](db['ChatOfflineMessage'],{'as':_0xc59c('0x6e'),'foreignKey':_0xc59c('0x16a')});db['MailApplication'][_0xc59c('0x11e')](db[_0xc59c('0x14')],{'onDelete':_0xc59c('0x16b')});db[_0xc59c('0x48')][_0xc59c('0x11e')](db['MailQueue'],{'onDelete':_0xc59c('0x16b')});db[_0xc59c('0x48')]['belongsTo'](db[_0xc59c('0x134')],{'onDelete':_0xc59c('0x16b')});db[_0xc59c('0x48')]['belongsTo'](db[_0xc59c('0x89')],{'onDelete':_0xc59c('0x16b'),'foreignKey':_0xc59c('0x14d')});db[_0xc59c('0x48')]['belongsTo'](db[_0xc59c('0x93')],{'onDelete':_0xc59c('0x16b'),'foreignKey':_0xc59c('0x16c')});db[_0xc59c('0x4a')][_0xc59c('0x11e')](db[_0xc59c('0x134')],{});db[_0xc59c('0x4a')][_0xc59c('0x11e')](db['CmList'],{'as':_0xc59c('0x16d'),'foreignKey':_0xc59c('0x15f')});db[_0xc59c('0x4a')][_0xc59c('0x11e')](db['CmContact'],{'as':'Contact','foreignKey':_0xc59c('0x159')});db['MailQueueReport']['belongsTo'](db[_0xc59c('0x44')],{});db[_0xc59c('0x4a')]['belongsTo'](db[_0xc59c('0x46')],{});db[_0xc59c('0x4a')]['belongsTo'](db[_0xc59c('0x14')],{});db[_0xc59c('0x4a')][_0xc59c('0x11e')](db[_0xc59c('0x40')],{});db[_0xc59c('0x4c')][_0xc59c('0x110')](db[_0xc59c('0x16e')],{'as':_0xc59c('0x16f'),'onDelete':'cascade'});db[_0xc59c('0x170')]['hasMany'](db[_0xc59c('0x15d')],{'as':_0xc59c('0x171'),'foreignKey':_0xc59c('0x172'),'onDelete':_0xc59c('0x10e')});db[_0xc59c('0x170')][_0xc59c('0x110')](db['CannedAnswer'],{'as':_0xc59c('0x15e'),'foreignKey':_0xc59c('0x172')});db[_0xc59c('0x170')][_0xc59c('0x110')](db[_0xc59c('0x52')],{'as':'Interactions'});db[_0xc59c('0x170')][_0xc59c('0x110')](db['FaxApplication'],{'as':_0xc59c('0x13f')});db['FaxAccount'][_0xc59c('0x110')](db['VoiceExtension'],{'as':'Exntensions','onDelete':'cascade'});db[_0xc59c('0x170')][_0xc59c('0x110')](db['FaxMessage'],{'as':_0xc59c('0x152')});db['FaxAccount'][_0xc59c('0x11e')](db[_0xc59c('0x29')],{'as':_0xc59c('0x29')});db['FaxAccount'][_0xc59c('0x11e')](db['CmList'],{'as':'List','foreignKey':_0xc59c('0x15f')});db['FaxAccount'][_0xc59c('0x11e')](db['Pause'],{'as':_0xc59c('0x14f'),'foreignKey':'mandatoryDispositionPauseId'});db['FaxAccount'][_0xc59c('0x120')](db[_0xc59c('0x14')],{'as':_0xc59c('0x150'),'through':_0xc59c('0x133')});db[_0xc59c('0x50')][_0xc59c('0x11e')](db['User'],{'onDelete':_0xc59c('0x16b')});db[_0xc59c('0x50')][_0xc59c('0x11e')](db[_0xc59c('0x56')],{'onDelete':_0xc59c('0x16b')});db[_0xc59c('0x50')][_0xc59c('0x11e')](db[_0xc59c('0x170')],{'onDelete':'restrict'});db[_0xc59c('0x50')][_0xc59c('0x11e')](db[_0xc59c('0x93')],{'onDelete':'restrict','foreignKey':_0xc59c('0x16c')});db[_0xc59c('0x52')]['hasMany'](db[_0xc59c('0x54')],{'as':_0xc59c('0x152'),'onDelete':_0xc59c('0x10e'),'foreignKey':_0xc59c('0x173')});db[_0xc59c('0x52')][_0xc59c('0x11e')](db[_0xc59c('0x170')],{'as':'Account','foreignKey':_0xc59c('0x172')});db[_0xc59c('0x52')][_0xc59c('0x11e')](db[_0xc59c('0x122')],{'as':_0xc59c('0x158'),'foreignKey':_0xc59c('0x159')});db[_0xc59c('0x52')][_0xc59c('0x11e')](db[_0xc59c('0x14')],{'as':_0xc59c('0x164'),'foreignKey':_0xc59c('0x10f')});db[_0xc59c('0x52')][_0xc59c('0x120')](db[_0xc59c('0x93')],{'through':_0xc59c('0x174'),'as':'Tags'});db[_0xc59c('0x52')]['belongsToMany'](db[_0xc59c('0x93')],{'through':_0xc59c('0x174'),'as':_0xc59c('0x167')});db['FaxInteraction'][_0xc59c('0x120')](db[_0xc59c('0x14')],{'as':'Users','through':_0xc59c('0x175'),'foreignKey':'FaxInteractionId'});db[_0xc59c('0x54')][_0xc59c('0x11e')](db[_0xc59c('0x14')],{'onDelete':_0xc59c('0x10e'),'as':_0xc59c('0x14')});db['FaxMessage']['belongsTo'](db['FaxInteraction'],{'as':'Interaction','foreignKey':_0xc59c('0x173')});db[_0xc59c('0x54')][_0xc59c('0x11e')](db[_0xc59c('0x122')],{'onDelete':'cascade','as':_0xc59c('0x158')});db['FaxMessage'][_0xc59c('0x11e')](db['Attachment'],{'as':'Attachment','foreignKey':_0xc59c('0x176')});db[_0xc59c('0x54')][_0xc59c('0x11e')](db[_0xc59c('0x170')],{'as':_0xc59c('0x163'),'foreignKey':_0xc59c('0x172')});db[_0xc59c('0x56')]['belongsToMany'](db['User'],{'as':'Agents','through':_0xc59c('0x35')});db[_0xc59c('0x56')]['belongsToMany'](db['Team'],{'through':'team_has_fax_queues','as':_0xc59c('0x177')});db[_0xc59c('0x58')][_0xc59c('0x11e')](db['FaxAccount'],{});db[_0xc59c('0x58')][_0xc59c('0x11e')](db[_0xc59c('0xf5')],{'as':'List','foreignKey':'ListId'});db[_0xc59c('0x58')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xc59c('0x159')});db[_0xc59c('0x58')][_0xc59c('0x11e')](db['FaxInteraction'],{});db[_0xc59c('0x58')]['belongsTo'](db['FaxMessage'],{});db[_0xc59c('0x58')]['belongsTo'](db[_0xc59c('0x14')],{});db[_0xc59c('0x58')][_0xc59c('0x11e')](db[_0xc59c('0x56')],{});db['SmsAccount'][_0xc59c('0x110')](db[_0xc59c('0x15d')],{'as':_0xc59c('0x171'),'foreignKey':_0xc59c('0x178'),'onDelete':_0xc59c('0x10e')});db['SmsAccount'][_0xc59c('0x110')](db['CannedAnswer'],{'as':_0xc59c('0x15e'),'foreignKey':_0xc59c('0x178')});db[_0xc59c('0x5a')][_0xc59c('0x110')](db['SmsMessage'],{'as':_0xc59c('0x152'),'foreignKey':_0xc59c('0x178')});db[_0xc59c('0x5a')]['hasMany'](db[_0xc59c('0x5e')],{'as':_0xc59c('0x179')});db[_0xc59c('0x5a')][_0xc59c('0x110')](db[_0xc59c('0x5c')],{'as':'Applications'});db['SmsAccount'][_0xc59c('0x11e')](db[_0xc59c('0xf5')],{'as':_0xc59c('0x16d'),'foreignKey':_0xc59c('0x15f')});db[_0xc59c('0x5a')][_0xc59c('0x11e')](db[_0xc59c('0x14e')],{'as':_0xc59c('0x14f'),'foreignKey':_0xc59c('0x17a')});db[_0xc59c('0x5a')][_0xc59c('0x120')](db['User'],{'as':'Agents','through':_0xc59c('0x139')});db['SmsApplication'][_0xc59c('0x11e')](db[_0xc59c('0x14')],{'onDelete':_0xc59c('0x16b')});db[_0xc59c('0x5c')][_0xc59c('0x11e')](db['SmsQueue'],{'onDelete':'restrict'});db[_0xc59c('0x5c')][_0xc59c('0x11e')](db['SmsAccount'],{'onDelete':_0xc59c('0x16b')});db[_0xc59c('0x5c')][_0xc59c('0x11e')](db[_0xc59c('0x89')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0xc59c('0x5c')]['belongsTo'](db[_0xc59c('0x93')],{'onDelete':_0xc59c('0x16b'),'foreignKey':_0xc59c('0x16c')});db['SmsInteraction'][_0xc59c('0x110')](db['SmsMessage'],{'as':_0xc59c('0x152'),'onDelete':_0xc59c('0x10e'),'foreignKey':_0xc59c('0x17b')});db[_0xc59c('0x5e')]['belongsTo'](db[_0xc59c('0x5a')],{'as':'Account','foreignKey':_0xc59c('0x178')});db[_0xc59c('0x5e')][_0xc59c('0x11e')](db[_0xc59c('0x122')],{'as':_0xc59c('0x158'),'foreignKey':_0xc59c('0x159')});db['SmsInteraction'][_0xc59c('0x11e')](db[_0xc59c('0x14')],{'as':_0xc59c('0x164'),'foreignKey':_0xc59c('0x10f')});db[_0xc59c('0x5e')]['belongsToMany'](db['Tag'],{'through':_0xc59c('0x17c'),'as':_0xc59c('0x166')});db['SmsInteraction'][_0xc59c('0x120')](db[_0xc59c('0x93')],{'through':'sms_interaction_has_tags','as':'ThroughTags'});db['SmsInteraction']['belongsToMany'](db[_0xc59c('0x14')],{'as':'Users','through':_0xc59c('0x129'),'foreignKey':_0xc59c('0x17b')});db[_0xc59c('0x17d')][_0xc59c('0x11e')](db[_0xc59c('0x14')],{'as':_0xc59c('0x14')});db['SmsMessage']['belongsTo'](db[_0xc59c('0x122')],{'onDelete':'cascade','as':_0xc59c('0x158')});db[_0xc59c('0x17d')]['belongsTo'](db[_0xc59c('0x5e')],{'onDelete':_0xc59c('0x10e'),'as':_0xc59c('0x17e'),'foreignKey':_0xc59c('0x17b')});db[_0xc59c('0x17d')]['belongsTo'](db[_0xc59c('0x5a')],{'as':_0xc59c('0x163'),'foreignKey':_0xc59c('0x178')});db[_0xc59c('0x12d')]['belongsToMany'](db['User'],{'as':_0xc59c('0x150'),'through':_0xc59c('0x12e'),'foreignKey':'SmsQueueId'});db[_0xc59c('0x12d')]['belongsToMany'](db[_0xc59c('0x126')],{'through':_0xc59c('0x17f'),'as':_0xc59c('0x177')});db[_0xc59c('0x180')][_0xc59c('0x110')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xc59c('0x181'),'onDelete':_0xc59c('0x10e')});db[_0xc59c('0x180')]['hasMany'](db['CannedAnswer'],{'as':_0xc59c('0x15e'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xc59c('0x110')](db['OpenchannelInteraction'],{'as':_0xc59c('0x179'),'foreignKey':_0xc59c('0x181')});db[_0xc59c('0x180')][_0xc59c('0x110')](db[_0xc59c('0x63')],{'as':_0xc59c('0x152'),'foreignKey':_0xc59c('0x181')});db['OpenchannelAccount'][_0xc59c('0x110')](db[_0xc59c('0x61')],{'as':_0xc59c('0x13f'),'foreignKey':_0xc59c('0x181')});db['OpenchannelAccount'][_0xc59c('0x11e')](db[_0xc59c('0xf5')],{'as':_0xc59c('0x16d'),'foreignKey':_0xc59c('0x15f')});db[_0xc59c('0x180')][_0xc59c('0x11e')](db[_0xc59c('0x14e')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xc59c('0x180')][_0xc59c('0x120')](db['User'],{'as':_0xc59c('0x150'),'through':_0xc59c('0x182')});db[_0xc59c('0x61')][_0xc59c('0x11e')](db[_0xc59c('0x14')],{'onDelete':_0xc59c('0x16b')});db[_0xc59c('0x61')][_0xc59c('0x11e')](db[_0xc59c('0x65')],{'onDelete':'restrict','foreignKey':_0xc59c('0x183')});db['OpenchannelApplication'][_0xc59c('0x11e')](db[_0xc59c('0x180')],{'onDelete':'restrict','foreignKey':_0xc59c('0x181')});db[_0xc59c('0x61')][_0xc59c('0x11e')](db[_0xc59c('0x89')],{'onDelete':_0xc59c('0x16b'),'foreignKey':'IntervalId'});db[_0xc59c('0x61')][_0xc59c('0x11e')](db[_0xc59c('0x93')],{'onDelete':_0xc59c('0x16b'),'foreignKey':_0xc59c('0x16c')});db['OpenchannelInteraction'][_0xc59c('0x110')](db['OpenchannelMessage'],{'as':_0xc59c('0x152'),'onDelete':'cascade','foreignKey':_0xc59c('0x184')});db[_0xc59c('0x115')][_0xc59c('0x11e')](db[_0xc59c('0x180')],{'as':_0xc59c('0x163'),'foreignKey':_0xc59c('0x181')});db[_0xc59c('0x115')][_0xc59c('0x11e')](db[_0xc59c('0x122')],{'as':_0xc59c('0x158'),'foreignKey':_0xc59c('0x159')});db['OpenchannelInteraction'][_0xc59c('0x11e')](db[_0xc59c('0x14')],{'as':_0xc59c('0x164'),'foreignKey':_0xc59c('0x10f')});db[_0xc59c('0x115')][_0xc59c('0x120')](db['Tag'],{'through':_0xc59c('0x185'),'as':_0xc59c('0x166')});db[_0xc59c('0x115')][_0xc59c('0x120')](db[_0xc59c('0x93')],{'through':'openchannel_interaction_has_tags','as':_0xc59c('0x167')});db[_0xc59c('0x115')][_0xc59c('0x120')](db[_0xc59c('0x14')],{'as':_0xc59c('0x186'),'through':_0xc59c('0x12a'),'foreignKey':_0xc59c('0x184')});db[_0xc59c('0x63')][_0xc59c('0x11e')](db[_0xc59c('0x14')],{'onDelete':_0xc59c('0x10e'),'as':'User'});db[_0xc59c('0x63')]['belongsTo'](db[_0xc59c('0x122')],{'onDelete':_0xc59c('0x10e'),'as':_0xc59c('0x158')});db['OpenchannelMessage'][_0xc59c('0x11e')](db[_0xc59c('0x115')],{'onDelete':_0xc59c('0x10e'),'as':_0xc59c('0x17e'),'foreignKey':_0xc59c('0x184')});db[_0xc59c('0x63')]['belongsTo'](db[_0xc59c('0xea')],{'as':_0xc59c('0xea'),'foreignKey':_0xc59c('0x176')});db[_0xc59c('0x63')][_0xc59c('0x11e')](db[_0xc59c('0x180')],{'as':_0xc59c('0x163'),'foreignKey':'OpenchannelAccountId'});db[_0xc59c('0x65')][_0xc59c('0x120')](db[_0xc59c('0x14')],{'as':_0xc59c('0x150'),'through':_0xc59c('0x38'),'foreignKey':'OpenchannelQueueId'});db[_0xc59c('0x65')][_0xc59c('0x120')](db[_0xc59c('0x126')],{'through':_0xc59c('0x187'),'as':_0xc59c('0x177')});db[_0xc59c('0x130')][_0xc59c('0x110')](db[_0xc59c('0x15d')],{'as':_0xc59c('0x171'),'foreignKey':'ChatWebsiteId','onDelete':_0xc59c('0x10e')});db['ChatWebsite'][_0xc59c('0x110')](db[_0xc59c('0x84')],{'as':_0xc59c('0x15e'),'foreignKey':_0xc59c('0x188')});db[_0xc59c('0x130')][_0xc59c('0x110')](db[_0xc59c('0x73')],{'as':_0xc59c('0x189')});db[_0xc59c('0x130')][_0xc59c('0x110')](db[_0xc59c('0x6a')],{'as':_0xc59c('0x179')});db[_0xc59c('0x130')][_0xc59c('0x110')](db[_0xc59c('0x68')],{'as':'Applications'});db['ChatWebsite'][_0xc59c('0x110')](db[_0xc59c('0x6c')],{'as':_0xc59c('0x152')});db[_0xc59c('0x130')][_0xc59c('0x11e')](db[_0xc59c('0xf5')],{'as':_0xc59c('0x16d'),'foreignKey':_0xc59c('0x15f')});db['ChatWebsite'][_0xc59c('0x11e')](db[_0xc59c('0x89')],{'as':_0xc59c('0x89'),'foreignKey':_0xc59c('0x14d')});db['ChatWebsite'][_0xc59c('0x11e')](db[_0xc59c('0x134')],{'as':_0xc59c('0x134'),'foreignKey':_0xc59c('0x15a')});db[_0xc59c('0x130')][_0xc59c('0x11e')](db[_0xc59c('0x14e')],{'as':_0xc59c('0x14f'),'foreignKey':_0xc59c('0x17a')});db[_0xc59c('0x130')]['belongsToMany'](db['User'],{'as':'Agents','through':'user_has_chat_websites'});db[_0xc59c('0x18a')][_0xc59c('0x11e')](db[_0xc59c('0x180')],{});db[_0xc59c('0x18a')][_0xc59c('0x11e')](db[_0xc59c('0xf5')],{'as':_0xc59c('0x16d'),'foreignKey':_0xc59c('0x15f')});db[_0xc59c('0x18a')][_0xc59c('0x11e')](db[_0xc59c('0x122')],{'as':_0xc59c('0x158'),'foreignKey':'ContactId'});db[_0xc59c('0x18a')][_0xc59c('0x11e')](db[_0xc59c('0x115')],{});db[_0xc59c('0x18a')][_0xc59c('0x11e')](db[_0xc59c('0x63')],{});db[_0xc59c('0x18a')][_0xc59c('0x11e')](db[_0xc59c('0x14')],{});db[_0xc59c('0x18a')][_0xc59c('0x11e')](db['OpenchannelQueue'],{});db[_0xc59c('0x68')][_0xc59c('0x11e')](db[_0xc59c('0x14')],{'as':_0xc59c('0x18b'),'foreignKey':'UserId','onDelete':_0xc59c('0x16b')});db['ChatApplication'][_0xc59c('0x11e')](db['ChatQueue'],{'as':_0xc59c('0x18c'),'foreignKey':'ChatQueueId','onDelete':_0xc59c('0x16b')});db[_0xc59c('0x68')][_0xc59c('0x11e')](db[_0xc59c('0x130')],{'as':_0xc59c('0x18d'),'foreignKey':_0xc59c('0x188'),'onDelete':_0xc59c('0x16b')});db['ChatApplication'][_0xc59c('0x11e')](db[_0xc59c('0x93')],{'onDelete':'restrict','foreignKey':'TagId'});db['ChatInteraction'][_0xc59c('0x110')](db[_0xc59c('0x6c')],{'as':_0xc59c('0x152'),'onDelete':_0xc59c('0x10e'),'foreignKey':_0xc59c('0x18e')});db[_0xc59c('0x6a')]['belongsTo'](db[_0xc59c('0x130')],{'as':_0xc59c('0x163'),'foreignKey':'ChatWebsiteId'});db['ChatInteraction']['belongsTo'](db[_0xc59c('0x122')],{'as':'Contact','foreignKey':_0xc59c('0x159')});db['ChatInteraction'][_0xc59c('0x11e')](db['User'],{'as':_0xc59c('0x164'),'foreignKey':'UserId'});db[_0xc59c('0x6a')][_0xc59c('0x120')](db['Tag'],{'through':_0xc59c('0x18f'),'as':_0xc59c('0x166')});db[_0xc59c('0x6a')][_0xc59c('0x120')](db[_0xc59c('0x93')],{'through':'chat_interaction_has_tags','as':_0xc59c('0x167')});db['ChatInteraction'][_0xc59c('0x120')](db[_0xc59c('0x14')],{'as':_0xc59c('0x186'),'through':_0xc59c('0x128'),'foreignKey':_0xc59c('0x18e')});db['ChatMessage'][_0xc59c('0x11e')](db[_0xc59c('0x14')],{'onDelete':_0xc59c('0x10e'),'as':_0xc59c('0x14')});db[_0xc59c('0x6c')][_0xc59c('0x11e')](db[_0xc59c('0x122')],{'onDelete':'cascade','as':_0xc59c('0x158'),'foreignKey':_0xc59c('0x159')});db[_0xc59c('0x6c')][_0xc59c('0x11e')](db['ChatInteraction'],{'onDelete':_0xc59c('0x10e'),'as':_0xc59c('0x17e'),'foreignKey':_0xc59c('0x18e')});db[_0xc59c('0x6c')][_0xc59c('0x11e')](db[_0xc59c('0xea')],{'as':_0xc59c('0xea'),'foreignKey':'AttachmentId'});db['ChatMessage'][_0xc59c('0x11e')](db[_0xc59c('0x130')],{'as':_0xc59c('0x163'),'foreignKey':_0xc59c('0x188')});db[_0xc59c('0x6e')]['hasMany'](db[_0xc59c('0xea')],{'as':_0xc59c('0x169'),'foreignKey':'ChatOfflineMessageId','onDelete':'cascade','hooks':!![]});db[_0xc59c('0x6e')][_0xc59c('0x11e')](db[_0xc59c('0x122')],{'onDelete':'cascade','as':_0xc59c('0x158'),'foreignKey':_0xc59c('0x159')});db[_0xc59c('0x6e')][_0xc59c('0x11e')](db['ChatWebsite'],{'as':_0xc59c('0x163'),'foreignKey':_0xc59c('0x188')});db[_0xc59c('0x190')]['belongsToMany'](db['User'],{'as':_0xc59c('0x150'),'through':_0xc59c('0x31'),'hooks':!![]});db[_0xc59c('0x190')][_0xc59c('0x120')](db[_0xc59c('0x126')],{'through':_0xc59c('0x191'),'as':'Teams'});db[_0xc59c('0x71')]['hasMany'](db[_0xc59c('0xd2')],{'as':'Messages','foreignKey':_0xc59c('0x192'),'onDelete':_0xc59c('0x10e')});db[_0xc59c('0x71')][_0xc59c('0x120')](db[_0xc59c('0x14')],{'as':_0xc59c('0x143'),'through':_0xc59c('0x121')});db[_0xc59c('0x73')][_0xc59c('0x11e')](db['ChatWebsite'],{'as':'Website','foreignKey':_0xc59c('0x188')});db[_0xc59c('0x75')][_0xc59c('0x110')](db['CmContact'],{'as':_0xc59c('0x193'),'foreignKey':'CompanyId'});db[_0xc59c('0x122')][_0xc59c('0x110')](db[_0xc59c('0x78')],{'as':_0xc59c('0x144'),'foreignKey':_0xc59c('0x159')});db[_0xc59c('0x122')][_0xc59c('0x110')](db[_0xc59c('0x7b')],{'as':_0xc59c('0x146'),'foreignKey':_0xc59c('0x159')});db['CmContact'][_0xc59c('0x110')](db[_0xc59c('0x7d')],{'as':'HopperHistories','foreignKey':_0xc59c('0x159')});db[_0xc59c('0x122')][_0xc59c('0x110')](db[_0xc59c('0x7f')],{'as':_0xc59c('0x7f'),'foreignKey':'ContactId'});db[_0xc59c('0x122')]['hasMany'](db[_0xc59c('0x149')],{'as':_0xc59c('0x14a'),'foreignKey':_0xc59c('0x159')});db[_0xc59c('0x122')][_0xc59c('0x110')](db[_0xc59c('0x115')],{'as':_0xc59c('0x116'),'foreignKey':_0xc59c('0x159'),'onDelete':'restrict'});db[_0xc59c('0x122')][_0xc59c('0x110')](db[_0xc59c('0x6a')],{'as':_0xc59c('0x117'),'foreignKey':_0xc59c('0x159'),'onDelete':_0xc59c('0x16b')});db[_0xc59c('0x122')][_0xc59c('0x110')](db[_0xc59c('0x5e')],{'as':'SmsInteractions','foreignKey':'ContactId','onDelete':_0xc59c('0x16b')});db[_0xc59c('0x122')][_0xc59c('0x110')](db[_0xc59c('0x52')],{'as':_0xc59c('0x119'),'foreignKey':_0xc59c('0x159'),'onDelete':_0xc59c('0x16b')});db[_0xc59c('0x122')]['hasMany'](db[_0xc59c('0x44')],{'as':_0xc59c('0x11a'),'foreignKey':_0xc59c('0x159'),'onDelete':_0xc59c('0x16b')});db[_0xc59c('0x122')]['belongsTo'](db[_0xc59c('0x75')],{'as':_0xc59c('0x194'),'foreignKey':_0xc59c('0x195')});db[_0xc59c('0x122')][_0xc59c('0x11e')](db[_0xc59c('0xf5')],{'as':'List','foreignKey':_0xc59c('0x15f'),'onDelete':_0xc59c('0x10e')});db[_0xc59c('0x122')][_0xc59c('0x120')](db[_0xc59c('0x14')],{'as':_0xc59c('0x186'),'through':_0xc59c('0x123')});db[_0xc59c('0x122')][_0xc59c('0x120')](db[_0xc59c('0x93')],{'as':'Tags','through':_0xc59c('0x196')});db[_0xc59c('0x122')][_0xc59c('0x120')](db[_0xc59c('0x93')],{'through':_0xc59c('0x196'),'as':_0xc59c('0x167')});db[_0xc59c('0x78')][_0xc59c('0x11e')](db[_0xc59c('0x122')],{'as':_0xc59c('0x158'),'foreignKey':_0xc59c('0x159'),'onDelete':_0xc59c('0x10e')});db[_0xc59c('0x78')]['belongsTo'](db[_0xc59c('0xf5')],{'as':'List','foreignKey':_0xc59c('0x15f'),'onDelete':_0xc59c('0x10e')});db[_0xc59c('0x78')][_0xc59c('0x11e')](db[_0xc59c('0x14')],{'as':_0xc59c('0x18b'),'foreignKey':_0xc59c('0x10f')});db[_0xc59c('0x78')][_0xc59c('0x11e')](db[_0xc59c('0x1a')],{'as':_0xc59c('0x18c'),'foreignKey':_0xc59c('0x145'),'onDelete':_0xc59c('0x10e')});db[_0xc59c('0x78')][_0xc59c('0x11e')](db[_0xc59c('0x197')],{'as':_0xc59c('0x197'),'foreignKey':_0xc59c('0x198'),'onDelete':_0xc59c('0x10e')});db[_0xc59c('0x78')]['belongsTo'](db[_0xc59c('0x14')],{'as':_0xc59c('0x164'),'foreignKey':_0xc59c('0x199')});db[_0xc59c('0x7a')][_0xc59c('0x11e')](db[_0xc59c('0x122')],{'as':_0xc59c('0x158'),'foreignKey':_0xc59c('0x159'),'onDelete':'cascade'});db['CmHopperBlack'][_0xc59c('0x11e')](db[_0xc59c('0xf5')],{'as':'List','foreignKey':_0xc59c('0x15f'),'onDelete':_0xc59c('0x10e')});db[_0xc59c('0x7a')]['belongsTo'](db[_0xc59c('0x1a')],{'as':_0xc59c('0x18c'),'foreignKey':_0xc59c('0x145'),'onDelete':_0xc59c('0x10e')});db[_0xc59c('0x7a')][_0xc59c('0x11e')](db['Campaign'],{'as':_0xc59c('0x197'),'foreignKey':_0xc59c('0x198'),'onDelete':_0xc59c('0x10e')});db[_0xc59c('0x82')][_0xc59c('0x110')](db[_0xc59c('0x87')],{'as':{'plural':_0xc59c('0x19a'),'singular':_0xc59c('0x19b')},'foreignKey':_0xc59c('0x19c'),'onDelete':'cascade','hooks':!![]});db[_0xc59c('0x82')][_0xc59c('0x110')](db[_0xc59c('0x87')],{'as':{'plural':_0xc59c('0x19d'),'singular':_0xc59c('0x19e')},'foreignKey':_0xc59c('0x19f'),'onDelete':_0xc59c('0x10e'),'hooks':!![]});db[_0xc59c('0x82')][_0xc59c('0x110')](db['Action'],{'as':_0xc59c('0x1a0'),'foreignKey':_0xc59c('0x1a1'),'onDelete':_0xc59c('0x10e'),'hooks':!![]});db['Disposition'][_0xc59c('0x110')](db['Disposition'],{'as':_0xc59c('0x171'),'foreignKey':_0xc59c('0x1a2'),'onDelete':'cascade'});db['Interval'][_0xc59c('0x110')](db['Interval'],{'as':_0xc59c('0x1a3'),'foreignKey':_0xc59c('0x14d'),'onDelete':_0xc59c('0x10e'),'hooks':!![],'required':![]});db[_0xc59c('0x89')][_0xc59c('0x110')](db[_0xc59c('0x19')],{'as':'Extensions','foreignKey':_0xc59c('0x14d'),'onDelete':_0xc59c('0x16b')});db[_0xc59c('0x89')][_0xc59c('0x110')](db[_0xc59c('0x48')],{'as':_0xc59c('0x1a4'),'foreignKey':_0xc59c('0x14d')});db[_0xc59c('0x89')]['hasMany'](db['ChatApplication'],{'as':'ChatApplications','foreignKey':_0xc59c('0x14d')});db[_0xc59c('0x89')][_0xc59c('0x110')](db[_0xc59c('0x50')],{'as':_0xc59c('0x1a5'),'foreignKey':'IntervalId'});db['Interval'][_0xc59c('0x110')](db[_0xc59c('0x5c')],{'as':_0xc59c('0x1a6'),'foreignKey':_0xc59c('0x14d')});db[_0xc59c('0x90')][_0xc59c('0x11e')](db[_0xc59c('0x134')],{});db[_0xc59c('0x90')][_0xc59c('0x11e')](db[_0xc59c('0x9b')],{'foreignKey':'DefaultReportId'});db['Schedule'][_0xc59c('0x11e')](db[_0xc59c('0x99')],{'foreignKey':'CustomReportId'});db['Sound']['belongsToMany'](db[_0xc59c('0x140')],{'as':_0xc59c('0x1a7'),'through':'moh_has_sounds','onDelete':_0xc59c('0x16b')});db[_0xc59c('0x93')]['belongsToMany'](db[_0xc59c('0x122')],{'through':'cm_contact_has_tags'});db[_0xc59c('0x93')][_0xc59c('0x120')](db[_0xc59c('0x6a')],{'through':'chat_interaction_has_tags'});db[_0xc59c('0x93')]['belongsToMany'](db[_0xc59c('0x44')],{'through':_0xc59c('0x165')});db[_0xc59c('0x93')][_0xc59c('0x120')](db[_0xc59c('0x5e')],{'through':_0xc59c('0x17c')});db[_0xc59c('0x93')][_0xc59c('0x120')](db[_0xc59c('0x52')],{'through':_0xc59c('0x174')});db[_0xc59c('0x93')][_0xc59c('0x120')](db['OpenchannelInteraction'],{'through':'openchannel_interaction_has_tags'});db['Tag']['belongsToMany'](db[_0xc59c('0x102')],{'through':_0xc59c('0x1a8')});db['Trigger'][_0xc59c('0x110')](db[_0xc59c('0x87')],{'as':{'plural':'AllConditions','singular':_0xc59c('0x1a9')},'foreignKey':_0xc59c('0x1aa'),'onDelete':_0xc59c('0x10e'),'hooks':!![]});db[_0xc59c('0x95')][_0xc59c('0x110')](db[_0xc59c('0x87')],{'as':{'plural':_0xc59c('0x1ab'),'singular':_0xc59c('0x1ac')},'foreignKey':'TriggerAnyId','onDelete':'cascade','hooks':!![]});db['Trigger']['hasMany'](db['Action'],{'as':_0xc59c('0x1a0'),'foreignKey':_0xc59c('0x1ad'),'onDelete':_0xc59c('0x10e'),'hooks':!![]});db[_0xc59c('0x99')][_0xc59c('0x110')](db[_0xc59c('0xa0')],{'as':_0xc59c('0x1ae'),'onDelete':_0xc59c('0x10e'),'foreignKey':_0xc59c('0x1af'),'hooks':!![]});db[_0xc59c('0x9b')][_0xc59c('0x110')](db[_0xc59c('0xa0')],{'as':'Fields','onDelete':_0xc59c('0x10e'),'foreignKey':'DefaultReportId'});db[_0xc59c('0x9e')][_0xc59c('0x110')](db['AnalyticFieldReport'],{'as':_0xc59c('0x1ae'),'onDelete':_0xc59c('0x10e'),'foreignKey':'MetricId'});db[_0xc59c('0xa0')]['belongsTo'](db[_0xc59c('0x9e')],{'foreignKey':'MetricId'});db[_0xc59c('0x1b0')]['hasMany'](db[_0xc59c('0xa3')],{'as':_0xc59c('0x1b1'),'onDelete':_0xc59c('0x10e'),'foreignKey':_0xc59c('0x1b2')});db[_0xc59c('0xa3')]['hasMany'](db[_0xc59c('0x1b3')],{'as':_0xc59c('0x1b4'),'onDelete':_0xc59c('0x10e'),'foreignKey':'SubjectId'});db['SalesforceConfiguration'][_0xc59c('0x110')](db[_0xc59c('0x1b3')],{'as':_0xc59c('0x1b5'),'onDelete':_0xc59c('0x10e'),'foreignKey':_0xc59c('0x1b6')});db[_0xc59c('0xa3')][_0xc59c('0x110')](db[_0xc59c('0x1b3')],{'as':_0xc59c('0x1ae'),'onDelete':_0xc59c('0x10e'),'foreignKey':_0xc59c('0x1b7')});db[_0xc59c('0xa3')][_0xc59c('0x11e')](db[_0xc59c('0x1b0')],{'as':_0xc59c('0x163'),'foreignKey':_0xc59c('0x1b2')});db['SalesforceField']['hasMany'](db[_0xc59c('0x1b3')],{'as':_0xc59c('0x1b8'),'foreignKey':_0xc59c('0x1b9')});db[_0xc59c('0x1b3')][_0xc59c('0x110')](db['SalesforceField'],{'as':_0xc59c('0x1ba'),'foreignKey':_0xc59c('0x1b6')});db['SalesforceField']['hasMany'](db[_0xc59c('0x1b3')],{'as':_0xc59c('0x1bb'),'foreignKey':_0xc59c('0x1b7')});db[_0xc59c('0x1b3')][_0xc59c('0x11e')](db['Variable'],{'as':_0xc59c('0x1bc'),'foreignKey':_0xc59c('0x1bd')});db[_0xc59c('0xa5')][_0xc59c('0x110')](db['SugarcrmConfiguration'],{'as':_0xc59c('0x1b1'),'onDelete':'cascade','foreignKey':_0xc59c('0x1b2')});db['SugarcrmConfiguration'][_0xc59c('0x110')](db[_0xc59c('0xa8')],{'as':_0xc59c('0x1b4'),'onDelete':_0xc59c('0x10e'),'foreignKey':'SubjectId'});db[_0xc59c('0x1be')][_0xc59c('0x110')](db['SugarcrmField'],{'as':'Descriptions','onDelete':_0xc59c('0x10e'),'foreignKey':_0xc59c('0x1b6')});db[_0xc59c('0x1be')][_0xc59c('0x110')](db['SugarcrmField'],{'as':_0xc59c('0x1ae'),'onDelete':_0xc59c('0x10e'),'foreignKey':_0xc59c('0x1b7')});db[_0xc59c('0x1be')]['belongsTo'](db['SugarcrmAccount'],{'as':_0xc59c('0x163'),'foreignKey':_0xc59c('0x1b2')});db[_0xc59c('0xa8')][_0xc59c('0x110')](db[_0xc59c('0xa8')],{'as':_0xc59c('0x1b8'),'foreignKey':_0xc59c('0x1b9')});db[_0xc59c('0xa8')][_0xc59c('0x110')](db[_0xc59c('0xa8')],{'as':_0xc59c('0x1ba'),'foreignKey':_0xc59c('0x1b6')});db[_0xc59c('0xa8')]['hasMany'](db[_0xc59c('0xa8')],{'as':'Field','foreignKey':_0xc59c('0x1b7')});db[_0xc59c('0xa8')][_0xc59c('0x11e')](db['Variable'],{'as':_0xc59c('0x1bc'),'foreignKey':_0xc59c('0x1bd')});db[_0xc59c('0xaa')][_0xc59c('0x110')](db[_0xc59c('0xac')],{'as':_0xc59c('0x1b1'),'onDelete':_0xc59c('0x10e'),'foreignKey':'AccountId'});db[_0xc59c('0xac')][_0xc59c('0x110')](db['DeskField'],{'as':'Subjects','onDelete':_0xc59c('0x10e'),'foreignKey':_0xc59c('0x1b9')});db['DeskConfiguration'][_0xc59c('0x110')](db[_0xc59c('0xae')],{'as':_0xc59c('0x1b5'),'onDelete':'cascade','foreignKey':_0xc59c('0x1b6')});db[_0xc59c('0xac')]['hasMany'](db[_0xc59c('0xae')],{'as':_0xc59c('0x1ae'),'onDelete':_0xc59c('0x10e'),'foreignKey':_0xc59c('0x1b7')});db[_0xc59c('0xac')][_0xc59c('0x11e')](db['DeskAccount'],{'as':_0xc59c('0x163'),'foreignKey':'AccountId'});db[_0xc59c('0xac')][_0xc59c('0x120')](db[_0xc59c('0x93')],{'through':_0xc59c('0x1bf')});db['DeskField'][_0xc59c('0x110')](db['DeskField'],{'as':_0xc59c('0x1b8'),'foreignKey':_0xc59c('0x1b9')});db['DeskField'][_0xc59c('0x110')](db['DeskField'],{'as':_0xc59c('0x1ba'),'foreignKey':'DescriptionId'});db[_0xc59c('0xae')][_0xc59c('0x110')](db['DeskField'],{'as':_0xc59c('0x1bb'),'foreignKey':_0xc59c('0x1b7')});db[_0xc59c('0xae')][_0xc59c('0x11e')](db['Variable'],{'as':_0xc59c('0x1bc'),'foreignKey':_0xc59c('0x1bd')});db[_0xc59c('0xb0')][_0xc59c('0x110')](db['ZohoConfiguration'],{'as':_0xc59c('0x1b1'),'onDelete':_0xc59c('0x10e'),'foreignKey':_0xc59c('0x1b2')});db[_0xc59c('0x1c0')][_0xc59c('0x110')](db[_0xc59c('0xb2')],{'as':_0xc59c('0x1b4'),'onDelete':'cascade','foreignKey':'SubjectId'});db['ZohoConfiguration']['hasMany'](db[_0xc59c('0xb2')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xc59c('0x1b6')});db['ZohoConfiguration'][_0xc59c('0x110')](db[_0xc59c('0xb2')],{'as':_0xc59c('0x1ae'),'onDelete':_0xc59c('0x10e'),'foreignKey':'FieldId'});db[_0xc59c('0x1c0')][_0xc59c('0x11e')](db[_0xc59c('0xb0')],{'as':_0xc59c('0x163'),'foreignKey':_0xc59c('0x1b2')});db[_0xc59c('0xb2')][_0xc59c('0x110')](db['ZohoField'],{'as':_0xc59c('0x1b8'),'foreignKey':_0xc59c('0x1b9')});db[_0xc59c('0xb2')]['hasMany'](db[_0xc59c('0xb2')],{'as':_0xc59c('0x1ba'),'foreignKey':'DescriptionId'});db[_0xc59c('0xb2')]['hasMany'](db[_0xc59c('0xb2')],{'as':_0xc59c('0x1bb'),'foreignKey':_0xc59c('0x1b7')});db[_0xc59c('0xb2')]['belongsTo'](db[_0xc59c('0x1bc')],{'as':_0xc59c('0x1bc'),'foreignKey':'VariableId'});db['ZendeskAccount'][_0xc59c('0x110')](db[_0xc59c('0xb5')],{'as':_0xc59c('0x1b1'),'onDelete':_0xc59c('0x10e'),'foreignKey':'AccountId'});db[_0xc59c('0xb5')][_0xc59c('0x110')](db[_0xc59c('0x1c1')],{'as':_0xc59c('0x1b4'),'foreignKey':_0xc59c('0x1b9')});db['ZendeskConfiguration'][_0xc59c('0x110')](db[_0xc59c('0x1c1')],{'as':_0xc59c('0x1b5'),'foreignKey':'DescriptionId'});db[_0xc59c('0xb5')][_0xc59c('0x110')](db['ZendeskField'],{'as':_0xc59c('0x1ae'),'foreignKey':_0xc59c('0x1b7')});db[_0xc59c('0xb5')][_0xc59c('0x11e')](db[_0xc59c('0x1c2')],{'as':_0xc59c('0x163'),'foreignKey':_0xc59c('0x1b2')});db['ZendeskConfiguration'][_0xc59c('0x120')](db[_0xc59c('0x93')],{'through':_0xc59c('0x1c3')});db[_0xc59c('0x1c1')][_0xc59c('0x110')](db[_0xc59c('0x1c1')],{'as':_0xc59c('0x1b8'),'foreignKey':'SubjectId'});db[_0xc59c('0x1c1')][_0xc59c('0x110')](db[_0xc59c('0x1c1')],{'as':_0xc59c('0x1ba'),'foreignKey':_0xc59c('0x1b6')});db['ZendeskField'][_0xc59c('0x110')](db[_0xc59c('0x1c1')],{'as':_0xc59c('0x1bb'),'foreignKey':_0xc59c('0x1b7')});db[_0xc59c('0x1c1')][_0xc59c('0x11e')](db['Variable'],{'as':_0xc59c('0x1bc'),'foreignKey':_0xc59c('0x1bd')});db[_0xc59c('0x1c4')][_0xc59c('0x110')](db[_0xc59c('0xb8')],{'as':_0xc59c('0x1b1'),'onDelete':_0xc59c('0x10e'),'foreignKey':_0xc59c('0x1b2')});db[_0xc59c('0xb8')][_0xc59c('0x110')](db[_0xc59c('0x1c5')],{'as':_0xc59c('0x1b4'),'onDelete':_0xc59c('0x10e'),'foreignKey':'SubjectId'});db[_0xc59c('0xb8')][_0xc59c('0x110')](db['FreshdeskField'],{'as':_0xc59c('0x1b5'),'onDelete':'cascade','foreignKey':_0xc59c('0x1b6')});db['FreshdeskConfiguration']['hasMany'](db[_0xc59c('0x1c5')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xc59c('0x1b7')});db[_0xc59c('0xb8')][_0xc59c('0x11e')](db[_0xc59c('0x1c4')],{'as':'Account','foreignKey':'AccountId'});db[_0xc59c('0xb8')][_0xc59c('0x120')](db[_0xc59c('0x93')],{'through':'int_freshdesk_configuration_has_tags'});db[_0xc59c('0x1c5')][_0xc59c('0x110')](db['FreshdeskField'],{'as':'Subject','foreignKey':_0xc59c('0x1b9')});db[_0xc59c('0x1c5')][_0xc59c('0x110')](db[_0xc59c('0x1c5')],{'as':_0xc59c('0x1ba'),'foreignKey':_0xc59c('0x1b6')});db[_0xc59c('0x1c5')][_0xc59c('0x110')](db['FreshdeskField'],{'as':_0xc59c('0x1bb'),'foreignKey':_0xc59c('0x1b7')});db[_0xc59c('0x1c5')][_0xc59c('0x11e')](db[_0xc59c('0x1bc')],{'as':_0xc59c('0x1bc'),'foreignKey':_0xc59c('0x1bd')});db[_0xc59c('0x1c6')][_0xc59c('0x110')](db[_0xc59c('0xb9')],{'as':_0xc59c('0x1b1'),'onDelete':_0xc59c('0x10e'),'foreignKey':_0xc59c('0x1b2')});db[_0xc59c('0xb9')]['hasMany'](db['VtigerField'],{'as':_0xc59c('0x1b4'),'foreignKey':_0xc59c('0x1b9')});db[_0xc59c('0xb9')][_0xc59c('0x110')](db[_0xc59c('0xbb')],{'as':'Descriptions','foreignKey':_0xc59c('0x1b6')});db[_0xc59c('0xb9')][_0xc59c('0x110')](db[_0xc59c('0xbb')],{'as':_0xc59c('0x1ae'),'foreignKey':_0xc59c('0x1b7')});db[_0xc59c('0xb9')][_0xc59c('0x11e')](db[_0xc59c('0x1c6')],{'as':_0xc59c('0x163'),'foreignKey':_0xc59c('0x1b2')});db['VtigerField'][_0xc59c('0x110')](db['VtigerField'],{'as':_0xc59c('0x1b8'),'foreignKey':_0xc59c('0x1b9')});db[_0xc59c('0xbb')][_0xc59c('0x110')](db[_0xc59c('0xbb')],{'as':_0xc59c('0x1ba'),'foreignKey':'DescriptionId'});db[_0xc59c('0xbb')]['hasMany'](db['VtigerField'],{'as':'Field','foreignKey':'FieldId'});db[_0xc59c('0xbb')][_0xc59c('0x11e')](db[_0xc59c('0x1bc')],{'as':_0xc59c('0x1bc'),'foreignKey':_0xc59c('0x1bd')});db[_0xc59c('0xbd')]['hasMany'](db[_0xc59c('0xbf')],{'as':_0xc59c('0x1b1'),'onDelete':'cascade','foreignKey':_0xc59c('0x1b2')});db['ServicenowConfiguration']['hasMany'](db[_0xc59c('0xc1')],{'as':_0xc59c('0x1b4'),'foreignKey':_0xc59c('0x1b9')});db[_0xc59c('0xbf')]['hasMany'](db[_0xc59c('0xc1')],{'as':'Descriptions','foreignKey':_0xc59c('0x1b6')});db[_0xc59c('0xbf')][_0xc59c('0x110')](db[_0xc59c('0xc1')],{'as':_0xc59c('0x1ae'),'foreignKey':_0xc59c('0x1b7')});db['ServicenowConfiguration'][_0xc59c('0x11e')](db[_0xc59c('0xbd')],{'as':'Account','foreignKey':_0xc59c('0x1b2')});db[_0xc59c('0xc1')][_0xc59c('0x110')](db['ServicenowField'],{'as':_0xc59c('0x1b8'),'foreignKey':_0xc59c('0x1b9')});db['ServicenowField'][_0xc59c('0x110')](db[_0xc59c('0xc1')],{'as':_0xc59c('0x1ba'),'foreignKey':_0xc59c('0x1b6')});db[_0xc59c('0xc1')][_0xc59c('0x110')](db[_0xc59c('0xc1')],{'as':_0xc59c('0x1bb'),'foreignKey':_0xc59c('0x1b7')});db['ServicenowField'][_0xc59c('0x11e')](db[_0xc59c('0x1bc')],{'as':'Variable','foreignKey':_0xc59c('0x1bd')});db[_0xc59c('0xc3')][_0xc59c('0x110')](db['Dynamics365Configuration'],{'as':_0xc59c('0x1b1'),'onDelete':_0xc59c('0x10e'),'foreignKey':_0xc59c('0x1b2')});db[_0xc59c('0x1c7')]['hasMany'](db[_0xc59c('0x1c8')],{'as':_0xc59c('0x1b4'),'onDelete':_0xc59c('0x10e'),'foreignKey':'SubjectId'});db[_0xc59c('0x1c7')][_0xc59c('0x110')](db[_0xc59c('0x1c8')],{'as':'Descriptions','onDelete':_0xc59c('0x10e'),'foreignKey':_0xc59c('0x1b6')});db['Dynamics365Configuration'][_0xc59c('0x110')](db[_0xc59c('0x1c8')],{'as':_0xc59c('0x1ae'),'onDelete':_0xc59c('0x10e'),'foreignKey':_0xc59c('0x1b7')});db[_0xc59c('0x1c7')][_0xc59c('0x11e')](db[_0xc59c('0xc3')],{'as':_0xc59c('0x163'),'foreignKey':'AccountId'});db[_0xc59c('0x1c8')]['hasMany'](db[_0xc59c('0x1c8')],{'as':'Subject','foreignKey':_0xc59c('0x1b9')});db['Dynamics365Field'][_0xc59c('0x110')](db[_0xc59c('0x1c8')],{'as':_0xc59c('0x1ba'),'foreignKey':'DescriptionId'});db[_0xc59c('0x1c8')][_0xc59c('0x110')](db['Dynamics365Field'],{'as':_0xc59c('0x1bb'),'foreignKey':'FieldId'});db['Dynamics365Field']['belongsTo'](db[_0xc59c('0x1bc')],{'as':_0xc59c('0x1bc'),'foreignKey':_0xc59c('0x1bd')});db[_0xc59c('0x1c9')]['hasMany'](db[_0xc59c('0xc8')],{'as':_0xc59c('0x1b1'),'onDelete':_0xc59c('0x10e'),'foreignKey':_0xc59c('0x1b2')});db[_0xc59c('0xc8')][_0xc59c('0x110')](db[_0xc59c('0xca')],{'as':_0xc59c('0x1b4'),'foreignKey':'SubjectId'});db[_0xc59c('0xc8')]['hasMany'](db[_0xc59c('0xca')],{'as':_0xc59c('0x1b5'),'foreignKey':_0xc59c('0x1b6')});db['FreshsalesConfiguration']['hasMany'](db['FreshsalesField'],{'as':_0xc59c('0x1ae'),'foreignKey':'FieldId'});db['FreshsalesConfiguration'][_0xc59c('0x11e')](db[_0xc59c('0x1c9')],{'as':'Account','foreignKey':_0xc59c('0x1b2')});db[_0xc59c('0xca')]['hasMany'](db[_0xc59c('0xca')],{'as':_0xc59c('0x1b8'),'foreignKey':_0xc59c('0x1b9')});db[_0xc59c('0xca')]['hasMany'](db[_0xc59c('0xca')],{'as':'Description','foreignKey':_0xc59c('0x1b6')});db[_0xc59c('0xca')][_0xc59c('0x110')](db[_0xc59c('0xca')],{'as':'Field','foreignKey':_0xc59c('0x1b7')});db[_0xc59c('0xca')]['belongsTo'](db[_0xc59c('0x1bc')],{'as':_0xc59c('0x1bc'),'foreignKey':_0xc59c('0x1bd')});db['ChatQueueReport']['belongsTo'](db['ChatWebsite'],{});db[_0xc59c('0xd0')][_0xc59c('0x11e')](db['CmList'],{'as':'List','foreignKey':_0xc59c('0x15f')});db['ChatQueueReport'][_0xc59c('0x11e')](db[_0xc59c('0x122')],{'as':'Contact','foreignKey':_0xc59c('0x159')});db['ChatQueueReport'][_0xc59c('0x11e')](db[_0xc59c('0x6a')],{});db['ChatQueueReport'][_0xc59c('0x11e')](db[_0xc59c('0x6c')],{});db[_0xc59c('0xd0')][_0xc59c('0x11e')](db['User'],{});db[_0xc59c('0xd0')][_0xc59c('0x11e')](db[_0xc59c('0x190')],{});db[_0xc59c('0xd2')][_0xc59c('0x11e')](db['User'],{'onDelete':_0xc59c('0x10e'),'foreignKey':'FromId'});db[_0xc59c('0xd2')][_0xc59c('0x11e')](db[_0xc59c('0x14')],{'onDelete':_0xc59c('0x10e'),'foreignKey':'ToId'});db[_0xc59c('0x149')]['hasMany'](db[_0xc59c('0xd5')],{'foreignKey':'SessionId','onDelete':_0xc59c('0x10e')});db[_0xc59c('0x149')]['hasMany'](db[_0xc59c('0x1ca')],{'foreignKey':'SessionId','onDelete':_0xc59c('0x10e')});db['SmsQueueReport'][_0xc59c('0x11e')](db[_0xc59c('0x5a')],{});db['SmsQueueReport'][_0xc59c('0x11e')](db['CmList'],{'as':_0xc59c('0x16d'),'foreignKey':_0xc59c('0x15f')});db[_0xc59c('0xd8')][_0xc59c('0x11e')](db[_0xc59c('0x122')],{'as':_0xc59c('0x158'),'foreignKey':_0xc59c('0x159')});db[_0xc59c('0xd8')][_0xc59c('0x11e')](db[_0xc59c('0x5e')],{});db[_0xc59c('0xd8')]['belongsTo'](db[_0xc59c('0x17d')],{});db[_0xc59c('0xd8')][_0xc59c('0x11e')](db[_0xc59c('0x14')],{});db['SmsQueueReport'][_0xc59c('0x11e')](db[_0xc59c('0x12d')],{});db[_0xc59c('0xdc')]['hasMany'](db[_0xc59c('0x149')],{'foreignKey':_0xc59c('0x1cb')});db[_0xc59c('0xdc')][_0xc59c('0x110')](db[_0xc59c('0xd5')],{'foreignKey':_0xc59c('0x1cb')});db[_0xc59c('0xdc')][_0xc59c('0x110')](db['JscriptyAnswerReport'],{'foreignKey':_0xc59c('0x1cb')});db[_0xc59c('0xe2')][_0xc59c('0x120')](db['User'],{'as':_0xc59c('0x186'),'through':_0xc59c('0x13c')});db['Team']['belongsToMany'](db[_0xc59c('0x14')],{'as':'Agents','through':_0xc59c('0x127')});db[_0xc59c('0x126')]['belongsToMany'](db[_0xc59c('0x1a')],{'through':'TeamVoiceQueue','as':_0xc59c('0x1cc')});db[_0xc59c('0x126')][_0xc59c('0x120')](db[_0xc59c('0x40')],{'through':_0xc59c('0x1cd'),'as':'MailQueues'});db['Team'][_0xc59c('0x120')](db[_0xc59c('0x190')],{'through':_0xc59c('0x191'),'as':'ChatQueues'});db[_0xc59c('0x126')][_0xc59c('0x120')](db[_0xc59c('0x56')],{'through':_0xc59c('0x1ce'),'as':_0xc59c('0x12c')});db[_0xc59c('0x126')][_0xc59c('0x120')](db[_0xc59c('0x12d')],{'through':_0xc59c('0x17f'),'as':_0xc59c('0x1cf')});db[_0xc59c('0x126')]['belongsToMany'](db[_0xc59c('0x65')],{'through':_0xc59c('0x187'),'as':_0xc59c('0x1d0')});db[_0xc59c('0x126')][_0xc59c('0x120')](db[_0xc59c('0x1d1')],{'through':_0xc59c('0x1d2'),'as':'WhatsappQueues'});db[_0xc59c('0x197')][_0xc59c('0x110')](db[_0xc59c('0x78')],{'as':'Hoppers','foreignKey':'CampaignId'});db[_0xc59c('0x197')][_0xc59c('0x110')](db[_0xc59c('0x7b')],{'as':_0xc59c('0x146'),'foreignKey':'CampaignId'});db[_0xc59c('0x197')]['hasMany'](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0xc59c('0x198')});db[_0xc59c('0x197')][_0xc59c('0x110')](db[_0xc59c('0x7a')],{'as':_0xc59c('0x148'),'foreignKey':_0xc59c('0x198')});db[_0xc59c('0x197')][_0xc59c('0x11e')](db[_0xc59c('0x29')],{'as':_0xc59c('0x29'),'foreignKey':_0xc59c('0x1d3')});db[_0xc59c('0x197')][_0xc59c('0x11e')](db[_0xc59c('0x29')],{'as':'TrunkBackup','foreignKey':_0xc59c('0x14c')});db[_0xc59c('0x197')]['belongsTo'](db[_0xc59c('0x89')],{'as':_0xc59c('0x89'),'foreignKey':_0xc59c('0x14d')});db['Campaign'][_0xc59c('0x11e')](db[_0xc59c('0xe2')],{'as':_0xc59c('0xe2'),'foreignKey':_0xc59c('0x1d4')});db[_0xc59c('0x197')][_0xc59c('0x120')](db['CmList'],{'as':_0xc59c('0x124'),'through':_0xc59c('0x1d5')});db[_0xc59c('0x197')][_0xc59c('0x120')](db[_0xc59c('0xf5')],{'as':'BlackLists','through':_0xc59c('0x1d6')});db[_0xc59c('0xea')][_0xc59c('0x11e')](db['ChatOfflineMessage'],{'as':_0xc59c('0x6e'),'foreignKey':_0xc59c('0x16a')});db[_0xc59c('0xed')][_0xc59c('0x11e')](db['MailMessage'],{});db[_0xc59c('0xed')][_0xc59c('0x11e')](db['MailInteraction'],{});db['MailTransferReport']['belongsTo'](db[_0xc59c('0x134')],{'foreignKey':_0xc59c('0x1d7'),'as':_0xc59c('0x1d8')});db['MailTransferReport'][_0xc59c('0x11e')](db[_0xc59c('0x14')],{'foreignKey':_0xc59c('0x1d9'),'as':_0xc59c('0x1da')});db[_0xc59c('0xed')][_0xc59c('0x11e')](db[_0xc59c('0x14')],{'foreignKey':_0xc59c('0x1db'),'as':_0xc59c('0x1dc')});db['MailTransferReport']['belongsTo'](db[_0xc59c('0x40')],{'foreignKey':_0xc59c('0x1dd'),'as':_0xc59c('0x1de')});db[_0xc59c('0xed')][_0xc59c('0x11e')](db[_0xc59c('0x134')],{'foreignKey':_0xc59c('0x1df'),'as':_0xc59c('0x1e0')});db[_0xc59c('0xef')][_0xc59c('0x11e')](db[_0xc59c('0x6c')],{});db[_0xc59c('0xef')][_0xc59c('0x11e')](db[_0xc59c('0x6a')],{});db[_0xc59c('0xef')][_0xc59c('0x11e')](db[_0xc59c('0x130')],{'foreignKey':_0xc59c('0x1e1'),'as':_0xc59c('0x1d8')});db[_0xc59c('0xef')][_0xc59c('0x11e')](db[_0xc59c('0x14')],{'foreignKey':_0xc59c('0x1d9'),'as':_0xc59c('0x1da')});db[_0xc59c('0xef')][_0xc59c('0x11e')](db[_0xc59c('0x14')],{'foreignKey':_0xc59c('0x1db'),'as':_0xc59c('0x1dc')});db['ChatTransferReport'][_0xc59c('0x11e')](db[_0xc59c('0x190')],{'foreignKey':_0xc59c('0x1e2'),'as':_0xc59c('0x1de')});db[_0xc59c('0xef')]['belongsTo'](db[_0xc59c('0x130')],{'foreignKey':_0xc59c('0x1e3'),'as':_0xc59c('0x1e0')});db['FaxTransferReport'][_0xc59c('0x11e')](db[_0xc59c('0x54')],{});db[_0xc59c('0xf1')][_0xc59c('0x11e')](db['FaxInteraction'],{});db[_0xc59c('0xf1')][_0xc59c('0x11e')](db[_0xc59c('0x170')],{'foreignKey':_0xc59c('0x1e4'),'as':'FromAccount'});db[_0xc59c('0xf1')][_0xc59c('0x11e')](db[_0xc59c('0x14')],{'foreignKey':_0xc59c('0x1d9'),'as':_0xc59c('0x1da')});db[_0xc59c('0xf1')][_0xc59c('0x11e')](db['User'],{'foreignKey':_0xc59c('0x1db'),'as':'ToAgent'});db[_0xc59c('0xf1')][_0xc59c('0x11e')](db[_0xc59c('0x56')],{'foreignKey':'ToFaxQueueId','as':'ToQueue'});db['FaxTransferReport'][_0xc59c('0x11e')](db[_0xc59c('0x170')],{'foreignKey':'ToFaxAccountId','as':_0xc59c('0x1e0')});db['OpenchannelTransferReport'][_0xc59c('0x11e')](db[_0xc59c('0x63')],{});db[_0xc59c('0x1e5')]['belongsTo'](db[_0xc59c('0x115')],{});db[_0xc59c('0x1e5')]['belongsTo'](db[_0xc59c('0x180')],{'foreignKey':_0xc59c('0x1e6'),'as':_0xc59c('0x1d8')});db[_0xc59c('0x1e5')][_0xc59c('0x11e')](db[_0xc59c('0x14')],{'foreignKey':_0xc59c('0x1d9'),'as':_0xc59c('0x1da')});db[_0xc59c('0x1e5')][_0xc59c('0x11e')](db[_0xc59c('0x14')],{'foreignKey':_0xc59c('0x1db'),'as':_0xc59c('0x1dc')});db[_0xc59c('0x1e5')][_0xc59c('0x11e')](db[_0xc59c('0x65')],{'foreignKey':_0xc59c('0x1e7'),'as':_0xc59c('0x1de')});db['OpenchannelTransferReport'][_0xc59c('0x11e')](db[_0xc59c('0x180')],{'foreignKey':_0xc59c('0x1e8'),'as':'ToAccount'});db[_0xc59c('0x1e9')]['belongsTo'](db[_0xc59c('0x17d')],{});db[_0xc59c('0x1e9')][_0xc59c('0x11e')](db[_0xc59c('0x5e')],{});db['SmsTransferReport'][_0xc59c('0x11e')](db[_0xc59c('0x5a')],{'foreignKey':'FromSmsAccountId','as':_0xc59c('0x1d8')});db['SmsTransferReport']['belongsTo'](db[_0xc59c('0x14')],{'foreignKey':_0xc59c('0x1d9'),'as':_0xc59c('0x1da')});db[_0xc59c('0x1e9')][_0xc59c('0x11e')](db[_0xc59c('0x14')],{'foreignKey':_0xc59c('0x1db'),'as':_0xc59c('0x1dc')});db[_0xc59c('0x1e9')]['belongsTo'](db[_0xc59c('0x12d')],{'foreignKey':_0xc59c('0x1ea'),'as':'ToQueue'});db['SmsTransferReport'][_0xc59c('0x11e')](db[_0xc59c('0x5a')],{'foreignKey':_0xc59c('0x1eb'),'as':_0xc59c('0x1e0')});db[_0xc59c('0xf5')]['hasMany'](db[_0xc59c('0x15d')],{'as':_0xc59c('0x171'),'foreignKey':_0xc59c('0x15f'),'onDelete':'cascade'});db[_0xc59c('0xf5')][_0xc59c('0x110')](db[_0xc59c('0x1ec')],{'as':'CustomFields','foreignKey':'ListId'});db[_0xc59c('0xf5')][_0xc59c('0x110')](db['CmContact'],{'as':'Contacts','onDelete':_0xc59c('0x10e'),'foreignKey':_0xc59c('0x15f')});db[_0xc59c('0xf5')]['hasMany'](db['CmHopperFinal'],{'as':_0xc59c('0x146'),'foreignKey':_0xc59c('0x15f')});db['CmList'][_0xc59c('0x110')](db['CmHopperHistory'],{'as':_0xc59c('0x114'),'foreignKey':_0xc59c('0x15f')});db[_0xc59c('0xf5')][_0xc59c('0x110')](db[_0xc59c('0x7f')],{'as':_0xc59c('0x7f'),'foreignKey':'ListId'});db[_0xc59c('0xf5')][_0xc59c('0x120')](db[_0xc59c('0x1a')],{'as':_0xc59c('0x1ed'),'through':_0xc59c('0x1ee')});db['CmList'][_0xc59c('0x120')](db[_0xc59c('0x14')],{'as':_0xc59c('0x150'),'through':'cm_user_has_lists'});db[_0xc59c('0x1ef')][_0xc59c('0x110')](db[_0xc59c('0x19')],{'as':'Extensions','onDelete':_0xc59c('0x10e')});db[_0xc59c('0x1ef')][_0xc59c('0x120')](db['User'],{'as':_0xc59c('0x150'),'through':_0xc59c('0x1f0')});db[_0xc59c('0xf7')][_0xc59c('0x110')](db[_0xc59c('0x14')],{'as':_0xc59c('0x186'),'foreignKey':_0xc59c('0x11f')});db[_0xc59c('0xf7')][_0xc59c('0x110')](db[_0xc59c('0xf9')],{'as':'UserProfileSections','foreignKey':_0xc59c('0x11f'),'onDelete':_0xc59c('0x10e')});db['UserProfileSection'][_0xc59c('0x110')](db['UserProfileResource'],{'as':_0xc59c('0x1f1'),'foreignKey':_0xc59c('0x1f2'),'onDelete':_0xc59c('0x10e')});db[_0xc59c('0xfe')]['hasMany'](db[_0xc59c('0x15d')],{'as':_0xc59c('0x171'),'foreignKey':'WhatsappAccountId','onDelete':_0xc59c('0x10e')});db['WhatsappAccount'][_0xc59c('0x110')](db[_0xc59c('0x84')],{'as':'Answers','foreignKey':'WhatsappAccountId'});db[_0xc59c('0xfe')][_0xc59c('0x110')](db['WhatsappMessage'],{'as':_0xc59c('0x152'),'foreignKey':'WhatsappAccountId'});db[_0xc59c('0xfe')][_0xc59c('0x110')](db['WhatsappInteraction'],{'as':_0xc59c('0x179')});db['WhatsappAccount'][_0xc59c('0x110')](db[_0xc59c('0x100')],{'as':'Applications'});db['WhatsappAccount'][_0xc59c('0x11e')](db['CmList'],{'as':'List','foreignKey':_0xc59c('0x15f')});db[_0xc59c('0xfe')][_0xc59c('0x11e')](db[_0xc59c('0x14e')],{'as':_0xc59c('0x14f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xc59c('0xfe')][_0xc59c('0x120')](db[_0xc59c('0x14')],{'as':_0xc59c('0x150'),'through':_0xc59c('0x13b')});db[_0xc59c('0x100')][_0xc59c('0x11e')](db['User'],{'onDelete':'restrict'});db[_0xc59c('0x100')]['belongsTo'](db[_0xc59c('0x1d1')],{'onDelete':_0xc59c('0x16b')});db['WhatsappApplication']['belongsTo'](db[_0xc59c('0xfe')],{'onDelete':_0xc59c('0x16b')});db[_0xc59c('0x100')][_0xc59c('0x11e')](db[_0xc59c('0x89')],{'onDelete':'restrict','foreignKey':_0xc59c('0x14d')});db[_0xc59c('0x100')][_0xc59c('0x11e')](db[_0xc59c('0x93')],{'onDelete':_0xc59c('0x16b'),'foreignKey':_0xc59c('0x16c')});db[_0xc59c('0x102')][_0xc59c('0x110')](db[_0xc59c('0x104')],{'as':'Messages','onDelete':_0xc59c('0x10e'),'foreignKey':_0xc59c('0x1f3')});db['WhatsappInteraction']['belongsTo'](db['WhatsappAccount'],{'as':'Account','foreignKey':_0xc59c('0x1f4')});db['WhatsappInteraction'][_0xc59c('0x11e')](db[_0xc59c('0x122')],{'as':'Contact','foreignKey':_0xc59c('0x159')});db['WhatsappInteraction'][_0xc59c('0x11e')](db[_0xc59c('0x14')],{'as':_0xc59c('0x164'),'foreignKey':_0xc59c('0x10f')});db[_0xc59c('0x102')]['belongsToMany'](db[_0xc59c('0x93')],{'through':_0xc59c('0x1a8'),'as':'Tags'});db[_0xc59c('0x102')][_0xc59c('0x120')](db['Tag'],{'through':_0xc59c('0x1a8'),'as':_0xc59c('0x167')});db[_0xc59c('0x102')]['belongsToMany'](db[_0xc59c('0x14')],{'as':_0xc59c('0x186'),'through':_0xc59c('0x1f5'),'foreignKey':_0xc59c('0x1f3')});db[_0xc59c('0x104')][_0xc59c('0x11e')](db['User'],{'as':'User'});db[_0xc59c('0x104')][_0xc59c('0x11e')](db['CmContact'],{'onDelete':_0xc59c('0x10e'),'as':_0xc59c('0x158')});db[_0xc59c('0x104')]['belongsTo'](db['WhatsappInteraction'],{'onDelete':'cascade','as':'Interaction','foreignKey':'WhatsappInteractionId'});db[_0xc59c('0x104')][_0xc59c('0x11e')](db['WhatsappAccount'],{'as':_0xc59c('0x163'),'foreignKey':_0xc59c('0x1f4')});db['WhatsappQueueReport'][_0xc59c('0x11e')](db['WhatsappAccount'],{});db['WhatsappQueueReport']['belongsTo'](db[_0xc59c('0xf5')],{'as':_0xc59c('0x16d'),'foreignKey':_0xc59c('0x15f')});db[_0xc59c('0x1f6')][_0xc59c('0x11e')](db[_0xc59c('0x122')],{'as':_0xc59c('0x158'),'foreignKey':_0xc59c('0x159')});db[_0xc59c('0x1f6')][_0xc59c('0x11e')](db[_0xc59c('0x102')],{});db[_0xc59c('0x1f6')][_0xc59c('0x11e')](db['WhatsappQueue'],{});db[_0xc59c('0x1f6')][_0xc59c('0x11e')](db['WhatsappMessage'],{});db[_0xc59c('0x1f6')][_0xc59c('0x11e')](db[_0xc59c('0x14')],{});db[_0xc59c('0x107')]['belongsTo'](db['WhatsappMessage'],{});db[_0xc59c('0x107')][_0xc59c('0x11e')](db[_0xc59c('0x102')],{});db['WhatsappTransferReport'][_0xc59c('0x11e')](db['WhatsappAccount'],{'foreignKey':_0xc59c('0x1f7'),'as':'FromAccount'});db[_0xc59c('0x107')][_0xc59c('0x11e')](db[_0xc59c('0xfe')],{'foreignKey':'ToWhatsappAccountId','as':_0xc59c('0x1e0')});db[_0xc59c('0x107')][_0xc59c('0x11e')](db[_0xc59c('0x1d1')],{'foreignKey':_0xc59c('0x1f8'),'as':_0xc59c('0x1de')});db['WhatsappTransferReport']['belongsTo'](db[_0xc59c('0x14')],{'foreignKey':_0xc59c('0x1d9'),'as':_0xc59c('0x1da')});db[_0xc59c('0x107')][_0xc59c('0x11e')](db['User'],{'foreignKey':_0xc59c('0x1db'),'as':_0xc59c('0x1dc')});db[_0xc59c('0x1d1')][_0xc59c('0x120')](db['User'],{'as':_0xc59c('0x150'),'through':_0xc59c('0x39'),'foreignKey':_0xc59c('0x1f9')});db[_0xc59c('0x1d1')]['belongsToMany'](db[_0xc59c('0x126')],{'through':_0xc59c('0x1d2'),'as':'Teams'});module[_0xc59c('0x1fa')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 551c323..1ad3887 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54a1=['/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','./api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/realtime','/api/auth/local','/api/auth/google','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','/api/webbar','./api/webbar','root','static','join','/www','/demo','/snippet','snippet','3.0.0','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','username','password','newPassword','apiKey','firstName','street','mobile','fax','email','clientSecret','code','accessKey','tenantId','token','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','privateKey','accesskeyid','secretaccesskey','key','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','replace','lodash','express','express-winston','util','./config/environment','./config/logger','api','auth','default','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','user','name','role','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)','format','method','device','other','agent_name','test','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/dashboards','./api/dashboard','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/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/openchannel/reports/queue','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','/api/templates','/api/triggers','./api/trigger','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/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/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration'];(function(_0x2b1551,_0x1776fe){var _0x2fc2a1=function(_0x5d43c8){while(--_0x5d43c8){_0x2b1551['push'](_0x2b1551['shift']());}};_0x2fc2a1(++_0x1776fe);}(_0x54a1,0x1c9));var _0x154a=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x54a1[_0x2112d4];return _0x434972;};'use strict';var _=require(_0x154a('0x0'));var path=require('path');var express=require(_0x154a('0x1'));var ewinston=require(_0x154a('0x2'));var util=require(_0x154a('0x3'));var errors=require('./errors');var config=require(_0x154a('0x4'));var logger=require(_0x154a('0x5'))(_0x154a('0x6'));var authLogger=require(_0x154a('0x5'))(_0x154a('0x7'));exports[_0x154a('0x8')]=function(_0x56ea78){_0x56ea78['use'](ewinston[_0x154a('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x1910bc,_0xde67f8){var _0x97808b=_0x154a('0xa');if(!_[_0x154a('0xb')](_0x1910bc[_0x154a('0xc')])){_0x97808b+=_0x154a('0xd');var _0xc09a1e=_0x1910bc[_0x154a('0xc')];maskSensitiveData(_0xc09a1e);}return util['format'](_0x97808b,_0x1910bc['method'],_0x1910bc[_0x154a('0xe')]['x-forwarded-for']?_0x1910bc['headers'][_0x154a('0xf')]:_0x1910bc[_0x154a('0x10')][_0x154a('0x11')]||_0x1910bc['ip'],_0x1910bc[_0x154a('0x12')],_0xde67f8[_0x154a('0x13')],_0xde67f8['responseTime'],_0x1910bc[_0x154a('0x14')]?_0x1910bc[_0x154a('0x14')]['id']:null,_0x1910bc[_0x154a('0x14')]?_0x1910bc[_0x154a('0x14')][_0x154a('0x15')]:null,_0x1910bc[_0x154a('0x14')]?_0x1910bc[_0x154a('0x14')][_0x154a('0x16')]:null,_0xc09a1e?util[_0x154a('0x17')](_0xc09a1e,![],null):'');}}));_0x56ea78[_0x154a('0x18')](ewinston[_0x154a('0x9')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x1c667b,_0x2bcc54){var _0xfa1f22=_0x154a('0x19');if(_0x1c667b[_0x154a('0xc')]&&_0x1c667b[_0x154a('0xc')]['device']&&_0x1c667b['body'][_0x154a('0x1a')]){_0xfa1f22=_0x154a('0x1b');}return util[_0x154a('0x1c')](_0xfa1f22,_0x1c667b[_0x154a('0x1d')],_0x1c667b[_0x154a('0xe')][_0x154a('0xf')]?_0x1c667b['headers']['x-forwarded-for']:_0x1c667b[_0x154a('0x10')][_0x154a('0x11')]||_0x1c667b['ip'],_0x1c667b[_0x154a('0x12')],_0x2bcc54[_0x154a('0x13')],_0x2bcc54['responseTime'],_0x1c667b[_0x154a('0x14')]?_0x1c667b[_0x154a('0x14')]['id']:null,_0x1c667b[_0x154a('0x14')]?_0x1c667b['user'][_0x154a('0x15')]:null,_0x1c667b[_0x154a('0x14')]?_0x1c667b['user'][_0x154a('0x16')]:null,_0x1c667b[_0x154a('0xc')]&&_0x1c667b[_0x154a('0xc')]['device']?_0x1c667b[_0x154a('0xc')][_0x154a('0x1e')]:_0x154a('0x1f'),_0x1c667b[_0x154a('0xc')]&&_0x1c667b[_0x154a('0xc')][_0x154a('0x1a')]?_0x1c667b['body'][_0x154a('0x1a')]:'',_0x1c667b['body']&&_0x1c667b[_0x154a('0xc')][_0x154a('0x20')]?_0x1c667b[_0x154a('0xc')][_0x154a('0x20')]:'');},'ignoreRoute':function(_0x8fc779){var _0x56ede0=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x56ede0[_0x154a('0x21')](_0x8fc779[_0x154a('0x12')]);}}));_0x56ea78[_0x154a('0x18')]('/api/users',require(_0x154a('0x22')));_0x56ea78[_0x154a('0x18')](_0x154a('0x23'),require(_0x154a('0x24')));_0x56ea78['use'](_0x154a('0x25'),require(_0x154a('0x26')));_0x56ea78[_0x154a('0x18')](_0x154a('0x27'),require('./api/voiceExtension'));_0x56ea78[_0x154a('0x18')](_0x154a('0x28'),require(_0x154a('0x29')));_0x56ea78[_0x154a('0x18')](_0x154a('0x2a'),require(_0x154a('0x2b')));_0x56ea78[_0x154a('0x18')]('/api/voice/recordings',require('./api/voiceRecording'));_0x56ea78[_0x154a('0x18')]('/api/screen/recordings',require('./api/screenRecording'));_0x56ea78['use']('/api/voice/mails',require(_0x154a('0x2c')));_0x56ea78[_0x154a('0x18')](_0x154a('0x2d'),require('./api/voiceMailMessage'));_0x56ea78[_0x154a('0x18')](_0x154a('0x2e'),require('./api/voiceCallReport'));_0x56ea78[_0x154a('0x18')](_0x154a('0x2f'),require(_0x154a('0x30')));_0x56ea78[_0x154a('0x18')](_0x154a('0x31'),require('./api/voiceAgentReport'));_0x56ea78['use'](_0x154a('0x32'),require(_0x154a('0x33')));_0x56ea78[_0x154a('0x18')]('/api/members/reports',require('./api/memberReport'));_0x56ea78['use'](_0x154a('0x34'),require(_0x154a('0x35')));_0x56ea78[_0x154a('0x18')](_0x154a('0x36'),require(_0x154a('0x37')));_0x56ea78[_0x154a('0x18')](_0x154a('0x38'),require('./api/mailServerOut'));_0x56ea78[_0x154a('0x18')](_0x154a('0x39'),require(_0x154a('0x3a')));_0x56ea78['use'](_0x154a('0x3b'),require(_0x154a('0x3c')));_0x56ea78['use'](_0x154a('0x3d'),require(_0x154a('0x3e')));_0x56ea78[_0x154a('0x18')](_0x154a('0x3f'),require(_0x154a('0x40')));_0x56ea78[_0x154a('0x18')](_0x154a('0x41'),require(_0x154a('0x42')));_0x56ea78[_0x154a('0x18')](_0x154a('0x43'),require(_0x154a('0x44')));_0x56ea78[_0x154a('0x18')]('/api/mail/reports/queue',require('./api/mailQueueReport'));_0x56ea78[_0x154a('0x18')](_0x154a('0x45'),require(_0x154a('0x46')));_0x56ea78[_0x154a('0x18')]('/api/dashboards/items',require('./api/dashboardItem'));_0x56ea78[_0x154a('0x18')](_0x154a('0x47'),require(_0x154a('0x48')));_0x56ea78[_0x154a('0x18')](_0x154a('0x49'),require('./api/faxApplication'));_0x56ea78[_0x154a('0x18')](_0x154a('0x4a'),require(_0x154a('0x4b')));_0x56ea78[_0x154a('0x18')](_0x154a('0x4c'),require(_0x154a('0x4d')));_0x56ea78['use'](_0x154a('0x4e'),require(_0x154a('0x4f')));_0x56ea78[_0x154a('0x18')](_0x154a('0x50'),require(_0x154a('0x51')));_0x56ea78[_0x154a('0x18')](_0x154a('0x52'),require(_0x154a('0x53')));_0x56ea78[_0x154a('0x18')](_0x154a('0x54'),require(_0x154a('0x55')));_0x56ea78['use'](_0x154a('0x56'),require(_0x154a('0x57')));_0x56ea78[_0x154a('0x18')](_0x154a('0x58'),require(_0x154a('0x59')));_0x56ea78['use'](_0x154a('0x5a'),require(_0x154a('0x5b')));_0x56ea78[_0x154a('0x18')](_0x154a('0x5c'),require(_0x154a('0x5d')));_0x56ea78[_0x154a('0x18')](_0x154a('0x5e'),require(_0x154a('0x5f')));_0x56ea78['use'](_0x154a('0x60'),require(_0x154a('0x61')));_0x56ea78[_0x154a('0x18')](_0x154a('0x62'),require(_0x154a('0x63')));_0x56ea78[_0x154a('0x18')](_0x154a('0x64'),require(_0x154a('0x65')));_0x56ea78[_0x154a('0x18')](_0x154a('0x66'),require('./api/chatWebsite'));_0x56ea78[_0x154a('0x18')](_0x154a('0x67'),require('./api/openchannelQueueReport'));_0x56ea78['use']('/api/chat/applications',require(_0x154a('0x68')));_0x56ea78['use'](_0x154a('0x69'),require(_0x154a('0x6a')));_0x56ea78[_0x154a('0x18')]('/api/chat/messages',require(_0x154a('0x6b')));_0x56ea78[_0x154a('0x18')](_0x154a('0x6c'),require(_0x154a('0x6d')));_0x56ea78[_0x154a('0x18')](_0x154a('0x6e'),require(_0x154a('0x6f')));_0x56ea78['use'](_0x154a('0x70'),require('./api/chatGroup'));_0x56ea78[_0x154a('0x18')](_0x154a('0x71'),require('./api/chatProactiveAction'));_0x56ea78[_0x154a('0x18')](_0x154a('0x72'),require(_0x154a('0x73')));_0x56ea78[_0x154a('0x18')](_0x154a('0x74'),require(_0x154a('0x75')));_0x56ea78['use'](_0x154a('0x76'),require(_0x154a('0x77')));_0x56ea78[_0x154a('0x18')](_0x154a('0x78'),require('./api/cmHopperBlack'));_0x56ea78['use']('/api/cm/hopper_final',require(_0x154a('0x79')));_0x56ea78[_0x154a('0x18')](_0x154a('0x7a'),require('./api/cmHopperHistory'));_0x56ea78[_0x154a('0x18')]('/api/cm/custom_fields',require(_0x154a('0x7b')));_0x56ea78[_0x154a('0x18')](_0x154a('0x7c'),require(_0x154a('0x7d')));_0x56ea78[_0x154a('0x18')](_0x154a('0x7e'),require(_0x154a('0x7f')));_0x56ea78[_0x154a('0x18')](_0x154a('0x80'),require('./api/cannedAnswer'));_0x56ea78[_0x154a('0x18')](_0x154a('0x81'),require(_0x154a('0x82')));_0x56ea78['use'](_0x154a('0x83'),require(_0x154a('0x84')));_0x56ea78[_0x154a('0x18')]('/api/intervals',require(_0x154a('0x85')));_0x56ea78['use'](_0x154a('0x86'),require(_0x154a('0x87')));_0x56ea78[_0x154a('0x18')](_0x154a('0x88'),require('./api/cdr'));_0x56ea78['use']('/api/voiceQueuesLog',require(_0x154a('0x89')));_0x56ea78[_0x154a('0x18')]('/api/schedules',require(_0x154a('0x8a')));_0x56ea78[_0x154a('0x18')](_0x154a('0x8b'),require(_0x154a('0x8c')));_0x56ea78[_0x154a('0x18')](_0x154a('0x8d'),require('./api/tag'));_0x56ea78[_0x154a('0x18')](_0x154a('0x8e'),require('./api/template'));_0x56ea78[_0x154a('0x18')](_0x154a('0x8f'),require(_0x154a('0x90')));_0x56ea78['use']('/api/variables',require(_0x154a('0x91')));_0x56ea78[_0x154a('0x18')](_0x154a('0x92'),require('./api/integration'));_0x56ea78[_0x154a('0x18')](_0x154a('0x93'),require(_0x154a('0x94')));_0x56ea78[_0x154a('0x18')](_0x154a('0x95'),require(_0x154a('0x96')));_0x56ea78[_0x154a('0x18')]('/api/analytics/default_reports',require('./api/analyticDefaultReport'));_0x56ea78['use'](_0x154a('0x97'),require(_0x154a('0x98')));_0x56ea78['use'](_0x154a('0x99'),require('./api/analyticMetric'));_0x56ea78[_0x154a('0x18')](_0x154a('0x9a'),require(_0x154a('0x9b')));_0x56ea78['use'](_0x154a('0x9c'),require(_0x154a('0x9d')));_0x56ea78['use'](_0x154a('0x9e'),require(_0x154a('0x9f')));_0x56ea78[_0x154a('0x18')](_0x154a('0xa0'),require(_0x154a('0xa1')));_0x56ea78['use']('/api/integrations/salesforce/fields',require(_0x154a('0xa2')));_0x56ea78[_0x154a('0x18')](_0x154a('0xa3'),require('./api/intSugarcrmAccount'));_0x56ea78['use']('/api/integrations/sugarcrm/configurations',require(_0x154a('0xa4')));_0x56ea78[_0x154a('0x18')](_0x154a('0xa5'),require('./api/intSugarcrmField'));_0x56ea78['use'](_0x154a('0xa6'),require('./api/intDeskAccount'));_0x56ea78['use']('/api/integrations/desk/configurations',require(_0x154a('0xa7')));_0x56ea78[_0x154a('0x18')]('/api/integrations/desk/fields',require(_0x154a('0xa8')));_0x56ea78[_0x154a('0x18')](_0x154a('0xa9'),require(_0x154a('0xaa')));_0x56ea78[_0x154a('0x18')](_0x154a('0xab'),require(_0x154a('0xac')));_0x56ea78['use']('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x56ea78[_0x154a('0x18')](_0x154a('0xad'),require(_0x154a('0xae')));_0x56ea78[_0x154a('0x18')](_0x154a('0xaf'),require(_0x154a('0xb0')));_0x56ea78['use']('/api/integrations/zendesk/fields',require(_0x154a('0xb1')));_0x56ea78['use'](_0x154a('0xb2'),require(_0x154a('0xb3')));_0x56ea78[_0x154a('0x18')](_0x154a('0xb4'),require(_0x154a('0xb5')));_0x56ea78[_0x154a('0x18')](_0x154a('0xb6'),require(_0x154a('0xb7')));_0x56ea78[_0x154a('0x18')](_0x154a('0xb8'),require('./api/intVtigerAccount'));_0x56ea78['use'](_0x154a('0xb9'),require(_0x154a('0xba')));_0x56ea78['use'](_0x154a('0xbb'),require(_0x154a('0xbc')));_0x56ea78[_0x154a('0x18')](_0x154a('0xbd'),require(_0x154a('0xbe')));_0x56ea78['use'](_0x154a('0xbf'),require(_0x154a('0xc0')));_0x56ea78[_0x154a('0x18')](_0x154a('0xc1'),require('./api/intServicenowField'));_0x56ea78['use'](_0x154a('0xc2'),require(_0x154a('0xc3')));_0x56ea78['use'](_0x154a('0xc4'),require(_0x154a('0xc5')));_0x56ea78['use']('/api/integrations/dynamics365/fields',require(_0x154a('0xc6')));_0x56ea78['use'](_0x154a('0xc7'),require(_0x154a('0xc8')));_0x56ea78[_0x154a('0x18')](_0x154a('0xc9'),require(_0x154a('0xca')));_0x56ea78[_0x154a('0x18')](_0x154a('0xcb'),require(_0x154a('0xcc')));_0x56ea78['use'](_0x154a('0xcd'),require(_0x154a('0xce')));_0x56ea78[_0x154a('0x18')](_0x154a('0xcf'),require(_0x154a('0xd0')));_0x56ea78['use'](_0x154a('0xd1'),require(_0x154a('0xd2')));_0x56ea78['use'](_0x154a('0xd3'),require(_0x154a('0xd4')));_0x56ea78[_0x154a('0x18')](_0x154a('0xd5'),require(_0x154a('0xd6')));_0x56ea78[_0x154a('0x18')](_0x154a('0xd7'),require(_0x154a('0xd8')));_0x56ea78[_0x154a('0x18')]('/api/sms/reports/queue',require('./api/smsQueueReport'));_0x56ea78[_0x154a('0x18')]('/api/square/reports',require(_0x154a('0xd9')));_0x56ea78[_0x154a('0x18')]('/api/square/details/reports',require(_0x154a('0xda')));_0x56ea78[_0x154a('0x18')](_0x154a('0xdb'),require(_0x154a('0xdc')));_0x56ea78[_0x154a('0x18')](_0x154a('0xdd'),require(_0x154a('0xde')));_0x56ea78['use'](_0x154a('0xdf'),require(_0x154a('0xe0')));_0x56ea78['use'](_0x154a('0xe1'),require('./api/squareProject'));_0x56ea78['use'](_0x154a('0xe2'),require(_0x154a('0xe3')));_0x56ea78[_0x154a('0x18')](_0x154a('0xe4'),require(_0x154a('0xe5')));_0x56ea78[_0x154a('0x18')]('/api/teams',require(_0x154a('0xe6')));_0x56ea78['use']('/api/license',require(_0x154a('0xe7')));_0x56ea78[_0x154a('0x18')]('/api/campaigns',require(_0x154a('0xe8')));_0x56ea78[_0x154a('0x18')](_0x154a('0xe9'),require(_0x154a('0xea')));_0x56ea78[_0x154a('0x18')](_0x154a('0xeb'),require(_0x154a('0xec')));_0x56ea78['use'](_0x154a('0xed'),require(_0x154a('0xee')));_0x56ea78[_0x154a('0x18')](_0x154a('0xef'),require(_0x154a('0xf0')));_0x56ea78[_0x154a('0x18')](_0x154a('0xf1'),require(_0x154a('0xf2')));_0x56ea78['use'](_0x154a('0xf3'),require(_0x154a('0xf4')));_0x56ea78['use']('/api/openchannel/reports/transfer',require(_0x154a('0xf5')));_0x56ea78[_0x154a('0x18')](_0x154a('0xf6'),require(_0x154a('0xf7')));_0x56ea78[_0x154a('0x18')]('/api/cm/lists',require(_0x154a('0xf8')));_0x56ea78['use']('/api/voice/prefixes',require(_0x154a('0xf9')));_0x56ea78[_0x154a('0x18')](_0x154a('0xfa'),require(_0x154a('0xfb')));_0x56ea78[_0x154a('0x18')](_0x154a('0xfc'),require('./api/userProfileSection'));_0x56ea78[_0x154a('0x18')](_0x154a('0xfd'),require('./api/userProfileResource'));_0x56ea78[_0x154a('0x18')]('/api/userNotifications',require(_0x154a('0xfe')));_0x56ea78[_0x154a('0x18')](_0x154a('0xff'),require('./api/whatsappAccount'));_0x56ea78[_0x154a('0x18')](_0x154a('0x100'),require(_0x154a('0x101')));_0x56ea78[_0x154a('0x18')](_0x154a('0x102'),require(_0x154a('0x103')));_0x56ea78[_0x154a('0x18')](_0x154a('0x104'),require(_0x154a('0x105')));_0x56ea78[_0x154a('0x18')](_0x154a('0x106'),require(_0x154a('0x107')));_0x56ea78['use'](_0x154a('0x108'),require(_0x154a('0x109')));_0x56ea78[_0x154a('0x18')](_0x154a('0x10a'),require(_0x154a('0x10b')));_0x56ea78['use']('/api/cloudProviders',require(_0x154a('0x10c')));_0x56ea78[_0x154a('0x18')](_0x154a('0x10d'),require('./api/realtime'));_0x56ea78['use'](_0x154a('0x10e'),require('./api/authLocal'));_0x56ea78[_0x154a('0x18')](_0x154a('0x10f'),require('./api/authGoogle'));_0x56ea78['use'](_0x154a('0x110'),require('./api/jira'));_0x56ea78['use'](_0x154a('0x111'),require(_0x154a('0x112')));_0x56ea78[_0x154a('0x18')](_0x154a('0x113'),require(_0x154a('0x114')));_0x56ea78[_0x154a('0x18')](_0x154a('0x115'),require('./api/system'));_0x56ea78[_0x154a('0x18')]('/api/pm2',require('./api/pm2'));_0x56ea78['use'](_0x154a('0x116'),require(_0x154a('0x117')));_0x56ea78[_0x154a('0x18')]('/apidoc',express['static'](path['join'](config[_0x154a('0x118')],'/apidoc')));_0x56ea78[_0x154a('0x18')]('/www',express[_0x154a('0x119')](path[_0x154a('0x11a')](config[_0x154a('0x118')],_0x154a('0x11b'))));_0x56ea78[_0x154a('0x18')](_0x154a('0x11c'),express[_0x154a('0x119')](path[_0x154a('0x11a')](config[_0x154a('0x118')],'/demo')));_0x56ea78[_0x154a('0x18')](_0x154a('0x11d'),express[_0x154a('0x119')](path[_0x154a('0x11a')](config['root'],_0x154a('0x11e'),_0x154a('0x11f'))));_0x56ea78[_0x154a('0x18')]('/plugins',express[_0x154a('0x119')](path[_0x154a('0x11a')](config[_0x154a('0x118')],'/server/files/plugins')));_0x56ea78[_0x154a('0x120')](_0x154a('0x121'))[_0x154a('0x122')](errors[0x194]);_0x56ea78[_0x154a('0x120')]('/*')['get'](function(_0x5e61e5,_0x362cdc){_0x362cdc[_0x154a('0x123')](path[_0x154a('0x124')](_0x56ea78['get'](_0x154a('0x125'))+_0x154a('0x126')));});};var sensitiveFields=[_0x154a('0x127'),_0x154a('0x128'),_0x154a('0x129'),_0x154a('0x12a'),_0x154a('0x12b'),'lastName',_0x154a('0x12c'),'phone',_0x154a('0x12d'),_0x154a('0x12e'),_0x154a('0x12f'),'clientId',_0x154a('0x130'),'securityToken',_0x154a('0x131'),_0x154a('0x132'),_0x154a('0x133'),_0x154a('0x134'),'channelSecret','accessToken',_0x154a('0x135'),_0x154a('0x136'),_0x154a('0x137'),_0x154a('0x138'),_0x154a('0x139'),_0x154a('0x13a'),_0x154a('0x13b'),_0x154a('0x13c'),'vidaooApiKey','clientEmail',_0x154a('0x13d'),_0x154a('0x13e'),_0x154a('0x13f'),_0x154a('0x140'),_0x154a('0x14'),'pass','accountSid','localstationid',_0x154a('0x141'),_0x154a('0x142'),_0x154a('0x143'),_0x154a('0x144')];function maskSensitiveData(_0x340200){var _0x465cfe=/(?!^)[\s\S](?!$)/g;if(!_[_0x154a('0x145')](_0x340200))return;for(var _0x542a86 in _0x340200){if(_[_0x154a('0x146')](_0x340200[_0x542a86])){for(var _0x57ed18=0x0;_0x57ed18<_0x340200[_0x542a86][_0x154a('0x147')];_0x57ed18++){maskSensitiveData(_0x340200[_0x542a86][_0x57ed18]);}}else if(_[_0x154a('0x145')](_0x340200[_0x542a86])){maskSensitiveData(_0x340200[_0x542a86]);}else if(_[_0x154a('0x148')](_0x340200[_0x542a86])){_0x340200[_0x542a86]=_0x340200[_0x542a86][_0x154a('0x149')](/{{{/g,'@@{')[_0x154a('0x149')](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0x154a('0x149')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x542a86)){_0x340200[_0x542a86]=_0x340200[_0x542a86][_0x154a('0x149')](_0x465cfe,'*');}}}} \ No newline at end of file +var _0x4273=['/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatInteraction','/api/chat/offline_messages','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperHistory','/api/automations','./api/automation','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','./api/sound','/api/tags','./api/tag','/api/templates','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/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/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','./api/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/smsQueueReport','/api/square/reports','./api/squareReport','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/interactions','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/authLocal','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','/api/webbar','./api/webbar','/apidoc','join','root','/www','/demo','static','/snippet','snippet','3.0.0','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','username','password','newPassword','apiKey','lastName','street','mobile','fax','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','exten','clientEmail','accesskeyid','secretaccesskey','pass','localstationid','secret','registry','isPlainObject','isArray','replace','@@{','}@@','includes','lodash','path','express-winston','util','./errors','./config/environment','./config/logger','auth','default','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','body','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','name','user','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','method','role','agent_name','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','./api/trunk','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/queues','./api/smsQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4273,0xf2));var _0x3427=function(_0x153ad9,_0x2e36e1){_0x153ad9=_0x153ad9-0x0;var _0x163760=_0x4273[_0x153ad9];return _0x163760;};'use strict';var _=require(_0x3427('0x0'));var path=require(_0x3427('0x1'));var express=require('express');var ewinston=require(_0x3427('0x2'));var util=require(_0x3427('0x3'));var errors=require(_0x3427('0x4'));var config=require(_0x3427('0x5'));var logger=require(_0x3427('0x6'))('api');var authLogger=require(_0x3427('0x6'))(_0x3427('0x7'));exports[_0x3427('0x8')]=function(_0x5e3fea){_0x5e3fea['use'](ewinston[_0x3427('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x5bc392,_0x82dd47){var _0x107af8=_0x3427('0xa');if(!_[_0x3427('0xb')](_0x5bc392['body'])){_0x107af8+=_0x3427('0xc');var _0x33e330=_0x5bc392[_0x3427('0xd')];maskSensitiveData(_0x33e330);}return util['format'](_0x107af8,_0x5bc392['method'],_0x5bc392[_0x3427('0xe')][_0x3427('0xf')]?_0x5bc392[_0x3427('0xe')][_0x3427('0xf')]:_0x5bc392[_0x3427('0x10')][_0x3427('0x11')]||_0x5bc392['ip'],_0x5bc392[_0x3427('0x12')],_0x82dd47[_0x3427('0x13')],_0x82dd47['responseTime'],_0x5bc392['user']?_0x5bc392['user']['id']:null,_0x5bc392['user']?_0x5bc392['user'][_0x3427('0x14')]:null,_0x5bc392[_0x3427('0x15')]?_0x5bc392['user']['role']:null,_0x33e330?util[_0x3427('0x16')](_0x33e330,![],null):'');}}));_0x5e3fea[_0x3427('0x17')](ewinston[_0x3427('0x9')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x16ef28,_0x22cbce){var _0x44c299=_0x3427('0x18');if(_0x16ef28[_0x3427('0xd')]&&_0x16ef28[_0x3427('0xd')][_0x3427('0x19')]&&_0x16ef28[_0x3427('0xd')][_0x3427('0x1a')]){_0x44c299=_0x3427('0x1b');}return util[_0x3427('0x1c')](_0x44c299,_0x16ef28[_0x3427('0x1d')],_0x16ef28['headers'][_0x3427('0xf')]?_0x16ef28['headers']['x-forwarded-for']:_0x16ef28[_0x3427('0x10')]['remoteAddress']||_0x16ef28['ip'],_0x16ef28['url'],_0x22cbce[_0x3427('0x13')],_0x22cbce['responseTime'],_0x16ef28[_0x3427('0x15')]?_0x16ef28[_0x3427('0x15')]['id']:null,_0x16ef28[_0x3427('0x15')]?_0x16ef28[_0x3427('0x15')][_0x3427('0x14')]:null,_0x16ef28['user']?_0x16ef28[_0x3427('0x15')][_0x3427('0x1e')]:null,_0x16ef28[_0x3427('0xd')]&&_0x16ef28[_0x3427('0xd')]['device']?_0x16ef28['body']['device']:'other',_0x16ef28[_0x3427('0xd')]&&_0x16ef28[_0x3427('0xd')][_0x3427('0x1a')]?_0x16ef28[_0x3427('0xd')][_0x3427('0x1a')]:'',_0x16ef28[_0x3427('0xd')]&&_0x16ef28[_0x3427('0xd')][_0x3427('0x1f')]?_0x16ef28[_0x3427('0xd')]['agent_name']:'');},'ignoreRoute':function(_0x4e9678){var _0x388cda=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x388cda['test'](_0x4e9678[_0x3427('0x12')]);}}));_0x5e3fea[_0x3427('0x17')]('/api/users',require('./api/user'));_0x5e3fea[_0x3427('0x17')]('/api/voice/chanspy',require('./api/voiceChanSpy'));_0x5e3fea['use'](_0x3427('0x20'),require(_0x3427('0x21')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x22'),require(_0x3427('0x23')));_0x5e3fea[_0x3427('0x17')]('/api/voice/mohs',require(_0x3427('0x24')));_0x5e3fea['use'](_0x3427('0x25'),require(_0x3427('0x26')));_0x5e3fea[_0x3427('0x17')]('/api/voice/recordings',require(_0x3427('0x27')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x28'),require(_0x3427('0x29')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x2a'),require(_0x3427('0x2b')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x2c'),require(_0x3427('0x2d')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x2e'),require(_0x3427('0x2f')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x30'),require(_0x3427('0x31')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x32'),require(_0x3427('0x33')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x34'),require(_0x3427('0x35')));_0x5e3fea[_0x3427('0x17')]('/api/members/reports',require(_0x3427('0x36')));_0x5e3fea[_0x3427('0x17')]('/api/trunks',require(_0x3427('0x37')));_0x5e3fea[_0x3427('0x17')]('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0x5e3fea[_0x3427('0x17')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x5e3fea[_0x3427('0x17')](_0x3427('0x38'),require('./api/mailAccount'));_0x5e3fea[_0x3427('0x17')](_0x3427('0x39'),require(_0x3427('0x3a')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x3b'),require('./api/mailSubstatus'));_0x5e3fea[_0x3427('0x17')](_0x3427('0x3c'),require('./api/mailInteraction'));_0x5e3fea['use']('/api/mail/messages',require(_0x3427('0x3d')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x3e'),require(_0x3427('0x3f')));_0x5e3fea['use'](_0x3427('0x40'),require(_0x3427('0x41')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x42'),require(_0x3427('0x43')));_0x5e3fea[_0x3427('0x17')]('/api/dashboards/items',require(_0x3427('0x44')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x45'),require(_0x3427('0x46')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x47'),require('./api/faxApplication'));_0x5e3fea['use']('/api/fax/interactions',require(_0x3427('0x48')));_0x5e3fea[_0x3427('0x17')]('/api/fax/messages',require(_0x3427('0x49')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x4a'),require(_0x3427('0x4b')));_0x5e3fea[_0x3427('0x17')]('/api/fax/reports/queue',require(_0x3427('0x4c')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x4d'),require(_0x3427('0x4e')));_0x5e3fea['use'](_0x3427('0x4f'),require(_0x3427('0x50')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x51'),require('./api/smsInteraction'));_0x5e3fea[_0x3427('0x17')]('/api/sms/messages',require('./api/smsMessage'));_0x5e3fea[_0x3427('0x17')](_0x3427('0x52'),require(_0x3427('0x53')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x54'),require(_0x3427('0x55')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x56'),require(_0x3427('0x57')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x58'),require('./api/openchannelInteraction'));_0x5e3fea[_0x3427('0x17')](_0x3427('0x59'),require('./api/openchannelMessage'));_0x5e3fea['use'](_0x3427('0x5a'),require(_0x3427('0x5b')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x5c'),require(_0x3427('0x5d')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x5e'),require(_0x3427('0x5f')));_0x5e3fea[_0x3427('0x17')]('/api/chat/applications',require('./api/chatApplication'));_0x5e3fea[_0x3427('0x17')]('/api/chat/interactions',require(_0x3427('0x60')));_0x5e3fea['use']('/api/chat/messages',require('./api/chatMessage'));_0x5e3fea['use'](_0x3427('0x61'),require('./api/chatOfflineMessage'));_0x5e3fea['use']('/api/chat/queues',require(_0x3427('0x62')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x63'),require(_0x3427('0x64')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x65'),require(_0x3427('0x66')));_0x5e3fea[_0x3427('0x17')]('/api/cm/companies',require(_0x3427('0x67')));_0x5e3fea['use'](_0x3427('0x68'),require(_0x3427('0x69')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x6a'),require(_0x3427('0x6b')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x6c'),require(_0x3427('0x6d')));_0x5e3fea['use'](_0x3427('0x6e'),require('./api/cmHopperFinal'));_0x5e3fea[_0x3427('0x17')]('/api/cm/hopper_history',require(_0x3427('0x6f')));_0x5e3fea[_0x3427('0x17')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0x5e3fea[_0x3427('0x17')]('/api/actions',require('./api/action'));_0x5e3fea[_0x3427('0x17')](_0x3427('0x70'),require(_0x3427('0x71')));_0x5e3fea[_0x3427('0x17')]('/api/canned_answers',require('./api/cannedAnswer'));_0x5e3fea[_0x3427('0x17')](_0x3427('0x72'),require(_0x3427('0x73')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x74'),require(_0x3427('0x75')));_0x5e3fea['use'](_0x3427('0x76'),require(_0x3427('0x77')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x78'),require(_0x3427('0x79')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x7a'),require('./api/cdr'));_0x5e3fea['use'](_0x3427('0x7b'),require(_0x3427('0x7c')));_0x5e3fea[_0x3427('0x17')]('/api/schedules',require(_0x3427('0x7d')));_0x5e3fea['use']('/api/sounds',require(_0x3427('0x7e')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x7f'),require(_0x3427('0x80')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x81'),require('./api/template'));_0x5e3fea['use'](_0x3427('0x82'),require(_0x3427('0x83')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x84'),require(_0x3427('0x85')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x86'),require(_0x3427('0x87')));_0x5e3fea['use'](_0x3427('0x88'),require(_0x3427('0x89')));_0x5e3fea['use']('/api/analytics/custom_reports',require(_0x3427('0x8a')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x8b'),require(_0x3427('0x8c')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x8d'),require(_0x3427('0x8e')));_0x5e3fea['use'](_0x3427('0x8f'),require(_0x3427('0x90')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x91'),require(_0x3427('0x92')));_0x5e3fea[_0x3427('0x17')]('/api/analytics/tree_reports',require(_0x3427('0x93')));_0x5e3fea['use'](_0x3427('0x94'),require(_0x3427('0x95')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x96'),require(_0x3427('0x97')));_0x5e3fea[_0x3427('0x17')]('/api/integrations/salesforce/fields',require(_0x3427('0x98')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x99'),require(_0x3427('0x9a')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x9b'),require(_0x3427('0x9c')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x9d'),require(_0x3427('0x9e')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x9f'),require('./api/intDeskAccount'));_0x5e3fea[_0x3427('0x17')](_0x3427('0xa0'),require('./api/intDeskConfiguration'));_0x5e3fea[_0x3427('0x17')]('/api/integrations/desk/fields',require(_0x3427('0xa1')));_0x5e3fea['use']('/api/integrations/zoho/accounts',require(_0x3427('0xa2')));_0x5e3fea[_0x3427('0x17')](_0x3427('0xa3'),require('./api/intZohoConfiguration'));_0x5e3fea['use'](_0x3427('0xa4'),require(_0x3427('0xa5')));_0x5e3fea[_0x3427('0x17')](_0x3427('0xa6'),require(_0x3427('0xa7')));_0x5e3fea[_0x3427('0x17')](_0x3427('0xa8'),require('./api/intZendeskConfiguration'));_0x5e3fea[_0x3427('0x17')](_0x3427('0xa9'),require(_0x3427('0xaa')));_0x5e3fea['use'](_0x3427('0xab'),require(_0x3427('0xac')));_0x5e3fea[_0x3427('0x17')](_0x3427('0xad'),require(_0x3427('0xae')));_0x5e3fea[_0x3427('0x17')](_0x3427('0xaf'),require(_0x3427('0xb0')));_0x5e3fea[_0x3427('0x17')](_0x3427('0xb1'),require(_0x3427('0xb2')));_0x5e3fea[_0x3427('0x17')](_0x3427('0xb3'),require(_0x3427('0xb4')));_0x5e3fea[_0x3427('0x17')](_0x3427('0xb5'),require(_0x3427('0xb6')));_0x5e3fea[_0x3427('0x17')](_0x3427('0xb7'),require(_0x3427('0xb8')));_0x5e3fea[_0x3427('0x17')]('/api/integrations/servicenow/configurations',require(_0x3427('0xb9')));_0x5e3fea[_0x3427('0x17')](_0x3427('0xba'),require(_0x3427('0xbb')));_0x5e3fea[_0x3427('0x17')](_0x3427('0xbc'),require(_0x3427('0xbd')));_0x5e3fea[_0x3427('0x17')](_0x3427('0xbe'),require(_0x3427('0xbf')));_0x5e3fea[_0x3427('0x17')](_0x3427('0xc0'),require(_0x3427('0xc1')));_0x5e3fea['use'](_0x3427('0xc2'),require(_0x3427('0xc3')));_0x5e3fea['use'](_0x3427('0xc4'),require(_0x3427('0xc5')));_0x5e3fea[_0x3427('0x17')]('/api/integrations/freshsales/fields',require(_0x3427('0xc6')));_0x5e3fea[_0x3427('0x17')]('/api/networks',require(_0x3427('0xc7')));_0x5e3fea[_0x3427('0x17')](_0x3427('0xc8'),require(_0x3427('0xc9')));_0x5e3fea['use'](_0x3427('0xca'),require(_0x3427('0xcb')));_0x5e3fea['use'](_0x3427('0xcc'),require(_0x3427('0xcd')));_0x5e3fea[_0x3427('0x17')](_0x3427('0xce'),require(_0x3427('0xcf')));_0x5e3fea[_0x3427('0x17')](_0x3427('0xd0'),require(_0x3427('0xd1')));_0x5e3fea[_0x3427('0x17')](_0x3427('0xd2'),require(_0x3427('0xd3')));_0x5e3fea[_0x3427('0x17')](_0x3427('0xd4'),require(_0x3427('0xd5')));_0x5e3fea['use']('/api/square/details/reports',require('./api/squareReportDetail'));_0x5e3fea[_0x3427('0x17')](_0x3427('0xd6'),require(_0x3427('0xd7')));_0x5e3fea[_0x3427('0x17')](_0x3427('0xd8'),require(_0x3427('0xd9')));_0x5e3fea[_0x3427('0x17')](_0x3427('0xda'),require(_0x3427('0xdb')));_0x5e3fea[_0x3427('0x17')](_0x3427('0xdc'),require('./api/squareProject'));_0x5e3fea['use'](_0x3427('0xdd'),require(_0x3427('0xde')));_0x5e3fea[_0x3427('0x17')](_0x3427('0xdf'),require(_0x3427('0xe0')));_0x5e3fea['use'](_0x3427('0xe1'),require(_0x3427('0xe2')));_0x5e3fea[_0x3427('0x17')](_0x3427('0xe3'),require(_0x3427('0xe4')));_0x5e3fea[_0x3427('0x17')](_0x3427('0xe5'),require('./api/campaign'));_0x5e3fea[_0x3427('0x17')](_0x3427('0xe6'),require(_0x3427('0xe7')));_0x5e3fea[_0x3427('0x17')](_0x3427('0xe8'),require(_0x3427('0xe9')));_0x5e3fea['use'](_0x3427('0xea'),require('./api/plugin'));_0x5e3fea['use'](_0x3427('0xeb'),require(_0x3427('0xec')));_0x5e3fea[_0x3427('0x17')]('/api/chat/reports/transfer',require(_0x3427('0xed')));_0x5e3fea['use']('/api/fax/reports/transfer',require(_0x3427('0xee')));_0x5e3fea['use'](_0x3427('0xef'),require(_0x3427('0xf0')));_0x5e3fea[_0x3427('0x17')]('/api/sms/reports/transfer',require(_0x3427('0xf1')));_0x5e3fea[_0x3427('0x17')](_0x3427('0xf2'),require('./api/cmList'));_0x5e3fea[_0x3427('0x17')](_0x3427('0xf3'),require(_0x3427('0xf4')));_0x5e3fea[_0x3427('0x17')](_0x3427('0xf5'),require(_0x3427('0xf6')));_0x5e3fea[_0x3427('0x17')]('/api/userProfile/sections',require(_0x3427('0xf7')));_0x5e3fea[_0x3427('0x17')](_0x3427('0xf8'),require(_0x3427('0xf9')));_0x5e3fea['use'](_0x3427('0xfa'),require(_0x3427('0xfb')));_0x5e3fea[_0x3427('0x17')]('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0x5e3fea[_0x3427('0x17')]('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x5e3fea[_0x3427('0x17')](_0x3427('0xfc'),require('./api/whatsappInteraction'));_0x5e3fea[_0x3427('0x17')]('/api/whatsapp/messages',require(_0x3427('0xfd')));_0x5e3fea[_0x3427('0x17')](_0x3427('0xfe'),require(_0x3427('0xff')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x100'),require(_0x3427('0x101')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x102'),require(_0x3427('0x103')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x104'),require(_0x3427('0x105')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x106'),require(_0x3427('0x107')));_0x5e3fea['use']('/api/auth/local',require(_0x3427('0x108')));_0x5e3fea[_0x3427('0x17')]('/api/auth/google',require(_0x3427('0x109')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x10a'),require(_0x3427('0x10b')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x10c'),require(_0x3427('0x10d')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x10e'),require(_0x3427('0x10f')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x110'),require(_0x3427('0x111')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x112'),require('./api/pm2'));_0x5e3fea['use'](_0x3427('0x113'),require(_0x3427('0x114')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x115'),express['static'](path[_0x3427('0x116')](config[_0x3427('0x117')],'/apidoc')));_0x5e3fea[_0x3427('0x17')](_0x3427('0x118'),express['static'](path[_0x3427('0x116')](config[_0x3427('0x117')],_0x3427('0x118'))));_0x5e3fea[_0x3427('0x17')](_0x3427('0x119'),express[_0x3427('0x11a')](path[_0x3427('0x116')](config[_0x3427('0x117')],_0x3427('0x119'))));_0x5e3fea[_0x3427('0x17')](_0x3427('0x11b'),express['static'](path[_0x3427('0x116')](config['root'],_0x3427('0x11c'),_0x3427('0x11d'))));_0x5e3fea[_0x3427('0x17')]('/plugins',express[_0x3427('0x11a')](path[_0x3427('0x116')](config['root'],_0x3427('0x11e'))));_0x5e3fea[_0x3427('0x11f')](_0x3427('0x120'))[_0x3427('0x121')](errors[0x194]);_0x5e3fea[_0x3427('0x11f')]('/*')[_0x3427('0x121')](function(_0x3e0af3,_0x3b4560){_0x3b4560['sendFile'](path[_0x3427('0x122')](_0x5e3fea[_0x3427('0x121')](_0x3427('0x123'))+'/index.html'));});};var sensitiveFields=[_0x3427('0x124'),_0x3427('0x125'),_0x3427('0x126'),_0x3427('0x127'),'firstName',_0x3427('0x128'),_0x3427('0x129'),'phone',_0x3427('0x12a'),_0x3427('0x12b'),'email',_0x3427('0x12c'),_0x3427('0x12d'),_0x3427('0x12e'),_0x3427('0x12f'),_0x3427('0x130'),_0x3427('0x131'),'token',_0x3427('0x132'),_0x3427('0x133'),_0x3427('0x134'),_0x3427('0x135'),_0x3427('0x136'),'consumerSecret','membername',_0x3427('0x137'),'calleridnum',_0x3427('0x138'),'vidaooApiKey',_0x3427('0x139'),'privateKey',_0x3427('0x13a'),_0x3427('0x13b'),'key',_0x3427('0x15'),_0x3427('0x13c'),'accountSid',_0x3427('0x13d'),'dsn',_0x3427('0x13e'),_0x3427('0x13f'),'oldPassword'];function maskSensitiveData(_0x1754a4){var _0x1f36c2=/(?!^)[\s\S](?!$)/g;if(!_[_0x3427('0x140')](_0x1754a4))return;for(var _0x416358 in _0x1754a4){if(_[_0x3427('0x141')](_0x1754a4[_0x416358])){for(var _0x5c22c2=0x0;_0x5c22c2<_0x1754a4[_0x416358]['length'];_0x5c22c2++){maskSensitiveData(_0x1754a4[_0x416358][_0x5c22c2]);}}else if(_['isPlainObject'](_0x1754a4[_0x416358])){maskSensitiveData(_0x1754a4[_0x416358]);}else if(_['isString'](_0x1754a4[_0x416358])){_0x1754a4[_0x416358]=_0x1754a4[_0x416358][_0x3427('0x142')](/{{{/g,_0x3427('0x143'))[_0x3427('0x142')](/}}}/g,_0x3427('0x144'))[_0x3427('0x142')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x3427('0x145')](sensitiveFields,_0x416358)){_0x1754a4[_0x416358]=_0x1754a4[_0x416358][_0x3427('0x142')](_0x1f36c2,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 1a5d0be..c9799ed 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6e4e=['log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','lodash','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost'];(function(_0x3837ca,_0x55a94b){var _0x556db8=function(_0x4b183f){while(--_0x4b183f){_0x3837ca['push'](_0x3837ca['shift']());}};_0x556db8(++_0x55a94b);}(_0x6e4e,0xca));var _0xe6e4=function(_0x46cc29,_0x473f8e){_0x46cc29=_0x46cc29-0x0;var _0x5ea06f=_0x6e4e[_0x46cc29];return _0x5ea06f;};'use strict';var jayson=require(_0xe6e4('0x0'));var BPromise=require('bluebird');var _=require(_0xe6e4('0x1'));var config=require('../config/environment');exports[_0xe6e4('0x2')]=function(){return new BPromise(function(_0x15969e,_0x2d3fe2){var _0x112781={};_0x112781=_[_0xe6e4('0x3')](_0x112781,require('../api/user/user.rpc'));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x4')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require('../api/voiceQueue/voiceQueue.rpc'));_0x112781=_[_0xe6e4('0x3')](_0x112781,require('../api/voiceRecording/voiceRecording.rpc'));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x5')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x112781=_['merge'](_0x112781,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x6')));_0x112781=_['merge'](_0x112781,require('../api/memberReport/memberReport.rpc'));_0x112781=_['merge'](_0x112781,require(_0xe6e4('0x7')));_0x112781=_['merge'](_0x112781,require(_0xe6e4('0x8')));_0x112781=_['merge'](_0x112781,require(_0xe6e4('0x9')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0xa')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0xb')));_0x112781=_['merge'](_0x112781,require(_0xe6e4('0xc')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0xd')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0xe')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0xf')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x10')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x11')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require('../api/faxApplication/faxApplication.rpc'));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x12')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x13')));_0x112781=_['merge'](_0x112781,require(_0xe6e4('0x14')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x15')));_0x112781=_['merge'](_0x112781,require(_0xe6e4('0x16')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x17')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x18')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x19')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x1a')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x1b')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x1c')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x1d')));_0x112781=_['merge'](_0x112781,require(_0xe6e4('0x1e')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x1f')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x20')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x21')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x22')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x23')));_0x112781=_['merge'](_0x112781,require(_0xe6e4('0x24')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x25')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x26')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require('../api/interval/interval.rpc'));_0x112781=_[_0xe6e4('0x3')](_0x112781,require('../api/pause/pause.rpc'));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x27')));_0x112781=_['merge'](_0x112781,require(_0xe6e4('0x28')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x29')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x2a')));_0x112781=_['merge'](_0x112781,require(_0xe6e4('0x2b')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x2c')));_0x112781=_['merge'](_0x112781,require(_0xe6e4('0x2d')));_0x112781=_['merge'](_0x112781,require(_0xe6e4('0x2e')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x112781=_['merge'](_0x112781,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x112781=_['merge'](_0x112781,require(_0xe6e4('0x2f')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x30')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x31')));_0x112781=_['merge'](_0x112781,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x112781=_[_0xe6e4('0x3')](_0x112781,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x112781=_[_0xe6e4('0x3')](_0x112781,require('../api/squareReport/squareReport.rpc'));_0x112781=_[_0xe6e4('0x3')](_0x112781,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x32')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x33')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require('../api/squareProject/squareProject.rpc'));_0x112781=_['merge'](_0x112781,require(_0xe6e4('0x34')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x35')));_0x112781=_['merge'](_0x112781,require(_0xe6e4('0x36')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x37')));_0x112781=_[_0xe6e4('0x3')](_0x112781,require('../api/plugin/plugin.rpc'));_0x112781=_[_0xe6e4('0x3')](_0x112781,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x112781=_[_0xe6e4('0x3')](_0x112781,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x112781=_[_0xe6e4('0x3')](_0x112781,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x112781=_[_0xe6e4('0x3')](_0x112781,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x112781=_[_0xe6e4('0x3')](_0x112781,require(_0xe6e4('0x38')));var _0x111499=jayson[_0xe6e4('0x39')](_0x112781)[_0xe6e4('0x3a')]();var _0x3d8725=config[_0xe6e4('0x3b')][_0xe6e4('0x3c')]||config[_0xe6e4('0x3c')]+0x1;var _0x5c7aee=config[_0xe6e4('0x3b')]['ip']||_0xe6e4('0x3d');_0x111499['on']('error',function(_0xbc9125){return _0x2d3fe2(_0xbc9125);});_0x111499[_0xe6e4('0x2')](_0x3d8725,_0x5c7aee,function(){console[_0xe6e4('0x3e')](_0xe6e4('0x3f'),_0x5c7aee,_0x3d8725);require(_0xe6e4('0x40'))['default']();return _0x15969e(_0xe6e4('0x41')+_0x5c7aee+':'+_0x3d8725);});});}; \ No newline at end of file +var _0x9d8b=['../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.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','port','localhost','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9d8b,0x1dc));var _0xb9d8=function(_0x3240ff,_0x3b9c3d){_0x3240ff=_0x3240ff-0x0;var _0x514858=_0x9d8b[_0x3240ff];return _0x514858;};'use strict';var jayson=require(_0xb9d8('0x0'));var BPromise=require('bluebird');var _=require('lodash');var config=require(_0xb9d8('0x1'));exports[_0xb9d8('0x2')]=function(){return new BPromise(function(_0x1307cf,_0x4fbc85){var _0x1e0828={};_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x4')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x5')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x6')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x7')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x8')));_0x1e0828=_['merge'](_0x1e0828,require(_0xb9d8('0x9')));_0x1e0828=_['merge'](_0x1e0828,require(_0xb9d8('0xa')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0xb')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require('../api/memberReport/memberReport.rpc'));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0xc')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0xd')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0xe')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0xf')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x10')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x11')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x12')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x13')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x14')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x15')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x16')));_0x1e0828=_['merge'](_0x1e0828,require('../api/faxApplication/faxApplication.rpc'));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x17')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require('../api/faxMessage/faxMessage.rpc'));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x18')));_0x1e0828=_['merge'](_0x1e0828,require(_0xb9d8('0x19')));_0x1e0828=_['merge'](_0x1e0828,require('../api/smsAccount/smsAccount.rpc'));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x1a')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x1b')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x1c')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x1d')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x1e')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x1f')));_0x1e0828=_['merge'](_0x1e0828,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x20')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x21')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require('../api/chatMessage/chatMessage.rpc'));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x22')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x23')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x24')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x25')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x26')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x27')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x28')));_0x1e0828=_['merge'](_0x1e0828,require(_0xb9d8('0x29')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x2a')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require('../api/sound/sound.rpc'));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require('../api/template/template.rpc'));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x2b')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x2c')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x2d')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x2e')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x2f')));_0x1e0828=_['merge'](_0x1e0828,require(_0xb9d8('0x30')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x31')));_0x1e0828=_['merge'](_0x1e0828,require(_0xb9d8('0x32')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x33')));_0x1e0828=_['merge'](_0x1e0828,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x34')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x35')));_0x1e0828=_['merge'](_0x1e0828,require(_0xb9d8('0x36')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x37')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require('../api/squareProject/squareProject.rpc'));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x38')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require('../api/squareMessage/squareMessage.rpc'));_0x1e0828=_['merge'](_0x1e0828,require(_0xb9d8('0x39')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x3a')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x3b')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x3c')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x3d')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x3e')));_0x1e0828=_['merge'](_0x1e0828,require(_0xb9d8('0x3f')));_0x1e0828=_[_0xb9d8('0x3')](_0x1e0828,require(_0xb9d8('0x40')));var _0x22dada=jayson['server'](_0x1e0828)['http']();var _0x3b8bb7=config['rpc']['port']||config[_0xb9d8('0x41')]+0x1;var _0x13ff97=config['rpc']['ip']||_0xb9d8('0x42');_0x22dada['on']('error',function(_0x4e7aa4){return _0x4fbc85(_0x4e7aa4);});_0x22dada['listen'](_0x3b8bb7,_0x13ff97,function(){console['log'](_0xb9d8('0x43'),_0x13ff97,_0x3b8bb7);require(_0xb9d8('0x44'))[_0xb9d8('0x45')]();return _0x1307cf(_0xb9d8('0x46')+_0x13ff97+':'+_0x3b8bb7);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 2c785fd..42bb34f 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 _0x2dd8=['SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','hangup','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','setExtension','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','label','exports','util','lodash','events','EventEmitter','./reply','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','replace','result=','indexOf','substr','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','inherits','prototype','sendRequest','command','sync','answer','ANSWER','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s'];(function(_0x2dfe85,_0x147f2d){var _0x10b8c2=function(_0x4d7baf){while(--_0x4d7baf){_0x2dfe85['push'](_0x2dfe85['shift']());}};_0x10b8c2(++_0x147f2d);}(_0x2dd8,0xbe));var _0x82dd=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2dd8[_0x19e35c];return _0x3e1fe8;};'use strict';var util=require(_0x82dd('0x0'));var _=require(_0x82dd('0x1'));var EventEmitter=require(_0x82dd('0x2'))[_0x82dd('0x3')];var AGIReply=require(_0x82dd('0x4'));var AGIError=require('./error');function AGIChannel(_0x18046a){var _0x15ef6b=this,_0xe785a=new AGIReply(),_0x150a0e=![],_0x20c2a7={};EventEmitter['call'](_0x15ef6b);_0x18046a[_0x82dd('0x5')](_0x82dd('0x6'));_0x18046a[_0x82dd('0x7')](0x8*0x3c*0x3c*0x3e8);_0xe785a['setEncoding'](_0x82dd('0x6'));_0xe785a['on'](_0x82dd('0x8'),function(_0x5db48c){for(var _0x3f5d9b in _0x5db48c){_0x15ef6b[_0x3f5d9b]=_0x5db48c[_0x3f5d9b];}_0x15ef6b[_0x82dd('0x9')](_0x82dd('0xa'));});_0xe785a['on'](_0x82dd('0xb'),function(_0x5b766b){if(_0x5b766b[_0x82dd('0xc')]()=='hangup'){_0x15ef6b[_0x82dd('0x9')]('hangup');return;}if(_0x5b766b[_0x82dd('0xd')](0x0,0xb)==_0x82dd('0xe')){_0x150a0e=!![];}if(_0x150a0e){_0x20c2a7['rx']+=_0x5b766b+'\x0a';if(_0x5b766b[_0x82dd('0xf')](_0x82dd('0x10'))!=-0x1){_0x150a0e=![];}}else{_0x20c2a7['rx']=_0x5b766b;}if(_0x150a0e){return;}if(typeof _0x20c2a7['cb']==_0x82dd('0x11')){var _0x11fe40=_0x20c2a7['rx'][_0x82dd('0xd')](0x0,0x3),_0x34a2cd=null,_0x56c2d4=null;_0x11fe40=parseInt(_0x11fe40);if(isNaN(_0x11fe40)){_0x20c2a7['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x11fe40!=0xc8){_0x20c2a7['cb'](null,{'code':_0x11fe40,'result':-0x1,'extra':'KO'});return;}_0x34a2cd=_0x20c2a7['rx'][_0x82dd('0xd')](0x4)[_0x82dd('0x12')](_0x82dd('0x13'),'');if(_0x34a2cd[_0x82dd('0x14')]('\x20')!=-0x1){_0x34a2cd=_0x34a2cd[_0x82dd('0x15')](0x0,_0x34a2cd[_0x82dd('0x14')]('\x20'));}if(_[_0x82dd('0x16')](_0x34a2cd,'-1')){_0x34a2cd=parseInt(_0x34a2cd);}_0x56c2d4=_0x20c2a7['rx'][_0x82dd('0x17')]('\x20');if(_0x56c2d4[_0x82dd('0x18')]==0x3){_0x56c2d4=_0x56c2d4[0x2]['substring'](0x1,_0x56c2d4[0x2][_0x82dd('0x18')]-0x1);}else if(_0x56c2d4['length']>0x3){var _0x2c7d1b=/\((.+)\)/;var _0x2be3e1=_0x20c2a7['rx']['match'](_0x2c7d1b);if(_0x2be3e1){_0x56c2d4=_0x2be3e1[0x1];}else{_0x56c2d4=null;}}else{_0x56c2d4=null;}_0x20c2a7['cb'](null,{'code':_0x11fe40,'result':_0x34a2cd,'extra':_0x56c2d4});}});_0x18046a['on'](_0x82dd('0x19'),function(_0x48579b){_0x15ef6b[_0x82dd('0x9')](_0x82dd('0x19'),new AGIError(_0x82dd('0x1a'),_0x48579b[_0x82dd('0x1b')]));});_0x18046a['on']('close',function(){_0x15ef6b[_0x82dd('0x9')]('close',new AGIError(_0x82dd('0x1c')));});_0x18046a['on'](_0x82dd('0x1d'),function(){_0x15ef6b[_0x82dd('0x9')](_0x82dd('0x1d'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x18046a[_0x82dd('0x1e')]();});_0x18046a[_0x82dd('0x1f')](_0xe785a);this['command']=function(_0x48df49,_0x5bff91){var _0x48df49=_0x48df49||'',_0x5bff91=typeof _0x5bff91==_0x82dd('0x11')?_0x5bff91:new Function();_0x20c2a7={'tx':_0x48df49,'rx':'','cb':_0x5bff91};_0x18046a['write'](_0x48df49+'\x0a');},this['close']=function(){_0x18046a[_0x82dd('0x1e')]();};}util[_0x82dd('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x82dd('0x21')][_0x82dd('0x22')]=function(_0x555b88){return this[_0x82dd('0x23')][_0x82dd('0x24')](this,_0x555b88);};AGIChannel[_0x82dd('0x21')][_0x82dd('0x25')]=function(){return this[_0x82dd('0x22')](_0x82dd('0x26'));};AGIChannel[_0x82dd('0x21')]['getData']=function(_0x5a9ede,_0x14b54c,_0x2f1f90){_0x5a9ede=_0x5a9ede===undefined?_0x82dd('0x27'):_0x5a9ede;_0x14b54c=_0x14b54c===undefined?'5':_0x14b54c;_0x2f1f90=_0x2f1f90===undefined?'1':_0x2f1f90;return this['sendRequest'](util['format'](_0x82dd('0x28'),_0x5a9ede,_0x14b54c*0x3e8,_0x2f1f90));};AGIChannel[_0x82dd('0x21')][_0x82dd('0x29')]=function(_0x4b4bfd){_0x4b4bfd=_0x4b4bfd||_0x82dd('0x2a');return this[_0x82dd('0x22')](util[_0x82dd('0x2b')](_0x82dd('0x2c'),_0x4b4bfd));};AGIChannel[_0x82dd('0x21')][_0x82dd('0x2d')]=function(_0x329aa6,_0x520c97){if(_[_0x82dd('0x2e')](_0x520c97)){return this['sendRequest'](util[_0x82dd('0x2b')](_0x82dd('0x2f'),_0x329aa6,_0x520c97[_0x82dd('0x30')](',')));}return this['sendRequest'](util['format'](_0x82dd('0x2f'),_0x329aa6,_0x520c97));};AGIChannel[_0x82dd('0x21')]['setContext']=function(_0x3da3f1){return this['sendRequest'](util[_0x82dd('0x2b')](_0x82dd('0x31'),_0x3da3f1));};AGIChannel['prototype']['setExtension']=function(_0x100070){return this[_0x82dd('0x22')](util[_0x82dd('0x2b')](_0x82dd('0x32'),_0x100070));};AGIChannel[_0x82dd('0x21')][_0x82dd('0x33')]=function(_0x436295){return this['sendRequest'](util[_0x82dd('0x2b')](_0x82dd('0x34'),_0x436295));};AGIChannel[_0x82dd('0x21')][_0x82dd('0x35')]=function(){return this[_0x82dd('0x22')]('HANGUP');};AGIChannel['prototype'][_0x82dd('0x36')]=function(_0x1e8cf1,_0x26a866){var _0x35087b=_['isBoolean'](_0x26a866)||_[_0x82dd('0x37')](_0x26a866)?_0x26a866[_0x82dd('0x38')]():_0x26a866;return this[_0x82dd('0x22')](util[_0x82dd('0x2b')](_0x82dd('0x39'),_0x1e8cf1,_0x35087b?_0x35087b[_0x82dd('0x38')]()[_0x82dd('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x82dd('0x3a')]=function(_0x4a84b4,_0x45be41){return this[_0x82dd('0x22')](util[_0x82dd('0x2b')](_0x82dd('0x3b'),_0x4a84b4,_0x45be41));};AGIChannel[_0x82dd('0x21')][_0x82dd('0x3c')]=function(_0x39b252,_0x4e1541){return this[_0x82dd('0x22')](util[_0x82dd('0x2b')](_0x82dd('0x3d'),_0x39b252,_0x4e1541));};AGIChannel['prototype'][_0x82dd('0x3e')]=function(_0x46b384,_0x241b31){return this['sendRequest'](util['format'](_0x82dd('0x3f'),_0x46b384,_0x241b31));};AGIChannel['prototype'][_0x82dd('0x40')]=function(_0x44aa19,_0x1eee39,_0x3729b8){_0x1eee39=_0x1eee39||this[_0x82dd('0x41')];_0x3729b8=_0x3729b8||0x1;this[_0x82dd('0x42')](_0x44aa19);this[_0x82dd('0x43')](_0x1eee39);this[_0x82dd('0x33')](_0x3729b8);return this[_0x82dd('0x29')](util[_0x82dd('0x2b')](_0x82dd('0x44'),_0x44aa19,_0x1eee39,_0x3729b8));};AGIChannel['prototype']['getVariable']=function(_0x383205){return this[_0x82dd('0x22')](util[_0x82dd('0x2b')](_0x82dd('0x45'),_0x383205));};AGIChannel[_0x82dd('0x21')][_0x82dd('0x46')]=function(_0x123f41,_0x39b3dc,_0x5c1bca,_0x479072,_0x436902,_0x2f6a15){_0x39b3dc=_0x39b3dc||'wav';_0x5c1bca=_0x5c1bca||'';_0x479072=_0x479072===undefined?-0x1:_0x479072==='-1'?-0x1:_0x479072*0x3e8;_0x436902=_0x436902===undefined?'':'s='+_0x436902;_0x2f6a15=_0x2f6a15?_0x82dd('0x47'):'';return this[_0x82dd('0x22')](util[_0x82dd('0x2b')](_0x82dd('0x48'),_0x123f41,_0x39b3dc,_0x5c1bca,_0x479072,_0x2f6a15,_0x436902));};AGIChannel[_0x82dd('0x21')][_0x82dd('0x49')]=function(_0x4d345e,_0xa24a2a){_0xa24a2a=_0xa24a2a||'';return this[_0x82dd('0x22')](util['format'](_0x82dd('0x4a'),_0x4d345e,_0xa24a2a));};AGIChannel[_0x82dd('0x21')][_0x82dd('0x4b')]=function(_0x893466){return this[_0x82dd('0x2d')](_0x82dd('0x4c'),_0x893466);};AGIChannel[_0x82dd('0x21')][_0x82dd('0x4d')]=function(_0x56533f){return this[_0x82dd('0x2d')]('WAIT',_0x56533f);};AGIChannel[_0x82dd('0x21')][_0x82dd('0x19')]=function(_0x9bd93d,_0x415769){this[_0x82dd('0x29')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x9bd93d['id'],_0x9bd93d[_0x82dd('0x4e')],_0x415769));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x82dd('0x4f')]=AGIChannel; \ No newline at end of file +var _0xceca=['E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sendRequest','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','HANGUP','isBoolean','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','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','label','util','events','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','emit','line','toLowerCase','hangup','substring','520-Invalid','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','length','match','error','E_AGI_SOCKET_ERROR','code','close'];(function(_0x164066,_0x1f1d40){var _0xa816f0=function(_0x17b29e){while(--_0x17b29e){_0x164066['push'](_0x164066['shift']());}};_0xa816f0(++_0x1f1d40);}(_0xceca,0xfd));var _0xacec=function(_0x398470,_0x594e95){_0x398470=_0x398470-0x0;var _0x5f1436=_0xceca[_0x398470];return _0x5f1436;};'use strict';var util=require(_0xacec('0x0'));var _=require('lodash');var EventEmitter=require(_0xacec('0x1'))[_0xacec('0x2')];var AGIReply=require(_0xacec('0x3'));var AGIError=require(_0xacec('0x4'));function AGIChannel(_0x12a47a){var _0x30d0f8=this,_0x5716b6=new AGIReply(),_0x5c05a0=![],_0xc31768={};EventEmitter[_0xacec('0x5')](_0x30d0f8);_0x12a47a[_0xacec('0x6')]('utf8');_0x12a47a['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x5716b6['setEncoding'](_0xacec('0x7'));_0x5716b6['on'](_0xacec('0x8'),function(_0x159d88){for(var _0xe310c0 in _0x159d88){_0x30d0f8[_0xe310c0]=_0x159d88[_0xe310c0];}_0x30d0f8[_0xacec('0x9')]('ready');});_0x5716b6['on'](_0xacec('0xa'),function(_0xa9324a){if(_0xa9324a[_0xacec('0xb')]()==_0xacec('0xc')){_0x30d0f8['emit'](_0xacec('0xc'));return;}if(_0xa9324a[_0xacec('0xd')](0x0,0xb)==_0xacec('0xe')){_0x5c05a0=!![];}if(_0x5c05a0){_0xc31768['rx']+=_0xa9324a+'\x0a';if(_0xa9324a['search'](_0xacec('0xf'))!=-0x1){_0x5c05a0=![];}}else{_0xc31768['rx']=_0xa9324a;}if(_0x5c05a0){return;}if(typeof _0xc31768['cb']==_0xacec('0x10')){var _0x16ffd9=_0xc31768['rx'][_0xacec('0xd')](0x0,0x3),_0x20bb47=null,_0x19091a=null;_0x16ffd9=parseInt(_0x16ffd9);if(isNaN(_0x16ffd9)){_0xc31768['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xacec('0x11')});return;}if(_0x16ffd9!=0xc8){_0xc31768['cb'](null,{'code':_0x16ffd9,'result':-0x1,'extra':'KO'});return;}_0x20bb47=_0xc31768['rx'][_0xacec('0xd')](0x4)[_0xacec('0x12')](_0xacec('0x13'),'');if(_0x20bb47[_0xacec('0x14')]('\x20')!=-0x1){_0x20bb47=_0x20bb47['substr'](0x0,_0x20bb47[_0xacec('0x14')]('\x20'));}if(_['startsWith'](_0x20bb47,'-1')){_0x20bb47=parseInt(_0x20bb47);}_0x19091a=_0xc31768['rx']['split']('\x20');if(_0x19091a[_0xacec('0x15')]==0x3){_0x19091a=_0x19091a[0x2][_0xacec('0xd')](0x1,_0x19091a[0x2][_0xacec('0x15')]-0x1);}else if(_0x19091a['length']>0x3){var _0x34247e=/\((.+)\)/;var _0x1e40b4=_0xc31768['rx'][_0xacec('0x16')](_0x34247e);if(_0x1e40b4){_0x19091a=_0x1e40b4[0x1];}else{_0x19091a=null;}}else{_0x19091a=null;}_0xc31768['cb'](null,{'code':_0x16ffd9,'result':_0x20bb47,'extra':_0x19091a});}});_0x12a47a['on'](_0xacec('0x17'),function(_0x16cb67){_0x30d0f8[_0xacec('0x9')]('error',new AGIError(_0xacec('0x18'),_0x16cb67[_0xacec('0x19')]));});_0x12a47a['on']('close',function(){_0x30d0f8[_0xacec('0x9')](_0xacec('0x1a'),new AGIError(_0xacec('0x1b')));});_0x12a47a['on'](_0xacec('0x1c'),function(){_0x30d0f8[_0xacec('0x9')](_0xacec('0x1c'),new AGIError(_0xacec('0x1d')));_0x12a47a[_0xacec('0x1e')]();});_0x12a47a[_0xacec('0x1f')](_0x5716b6);this[_0xacec('0x20')]=function(_0x197050,_0x46607f){var _0x197050=_0x197050||'',_0x46607f=typeof _0x46607f=='function'?_0x46607f:new Function();_0xc31768={'tx':_0x197050,'rx':'','cb':_0x46607f};_0x12a47a[_0xacec('0x21')](_0x197050+'\x0a');},this['close']=function(){_0x12a47a['destroy']();};}util[_0xacec('0x22')](AGIChannel,EventEmitter);AGIChannel[_0xacec('0x23')][_0xacec('0x24')]=function(_0x5b720a){return this['command']['sync'](this,_0x5b720a);};AGIChannel[_0xacec('0x23')][_0xacec('0x25')]=function(){return this['sendRequest'](_0xacec('0x26'));};AGIChannel[_0xacec('0x23')][_0xacec('0x27')]=function(_0x3575f5,_0x5cf65d,_0x2ff92f){_0x3575f5=_0x3575f5===undefined?_0xacec('0x28'):_0x3575f5;_0x5cf65d=_0x5cf65d===undefined?'5':_0x5cf65d;_0x2ff92f=_0x2ff92f===undefined?'1':_0x2ff92f;return this['sendRequest'](util[_0xacec('0x29')](_0xacec('0x2a'),_0x3575f5,_0x5cf65d*0x3e8,_0x2ff92f));};AGIChannel[_0xacec('0x23')][_0xacec('0x2b')]=function(_0x48055a){_0x48055a=_0x48055a||'NO\x20MESSAGE';return this[_0xacec('0x24')](util['format'](_0xacec('0x2c'),_0x48055a));};AGIChannel[_0xacec('0x23')][_0xacec('0x2d')]=function(_0x44777,_0x845f31){if(_['isArray'](_0x845f31)){return this['sendRequest'](util['format'](_0xacec('0x2e'),_0x44777,_0x845f31[_0xacec('0x2f')](',')));}return this[_0xacec('0x24')](util['format'](_0xacec('0x2e'),_0x44777,_0x845f31));};AGIChannel[_0xacec('0x23')][_0xacec('0x30')]=function(_0x5b1862){return this[_0xacec('0x24')](util['format'](_0xacec('0x31'),_0x5b1862));};AGIChannel[_0xacec('0x23')]['setExtension']=function(_0x526f8f){return this[_0xacec('0x24')](util[_0xacec('0x29')](_0xacec('0x32'),_0x526f8f));};AGIChannel[_0xacec('0x23')][_0xacec('0x33')]=function(_0x26572b){return this['sendRequest'](util['format']('SET\x20PRIORITY\x20%s',_0x26572b));};AGIChannel['prototype']['hangup']=function(){return this[_0xacec('0x24')](_0xacec('0x34'));};AGIChannel[_0xacec('0x23')]['setVariable']=function(_0x52c6c0,_0x471a3a){var _0x4b1781=_[_0xacec('0x35')](_0x471a3a)||_['isNumber'](_0x471a3a)?_0x471a3a['toString']():_0x471a3a;return this['sendRequest'](util[_0xacec('0x29')](_0xacec('0x36'),_0x52c6c0,_0x4b1781?_0x4b1781['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xacec('0x23')]['sayNumber']=function(_0x31fe93,_0x40e92e){return this[_0xacec('0x24')](util[_0xacec('0x29')](_0xacec('0x37'),_0x31fe93,_0x40e92e));};AGIChannel[_0xacec('0x23')][_0xacec('0x38')]=function(_0x42c6bf,_0x387cf2){return this[_0xacec('0x24')](util[_0xacec('0x29')](_0xacec('0x39'),_0x42c6bf,_0x387cf2));};AGIChannel[_0xacec('0x23')]['sayPhonetic']=function(_0x1d3cda,_0x48419d){return this[_0xacec('0x24')](util['format'](_0xacec('0x3a'),_0x1d3cda,_0x48419d));};AGIChannel['prototype']['continueAt']=function(_0x586317,_0x25ad23,_0x407b00){_0x25ad23=_0x25ad23||this[_0xacec('0x3b')];_0x407b00=_0x407b00||0x1;this[_0xacec('0x30')](_0x586317);this['setExtension'](_0x25ad23);this[_0xacec('0x33')](_0x407b00);return this[_0xacec('0x2b')](util['format'](_0xacec('0x3c'),_0x586317,_0x25ad23,_0x407b00));};AGIChannel['prototype'][_0xacec('0x3d')]=function(_0x40cbbe){return this['sendRequest'](util[_0xacec('0x29')](_0xacec('0x3e'),_0x40cbbe));};AGIChannel[_0xacec('0x23')]['recordFile']=function(_0x4cbdde,_0x24d877,_0x220716,_0x542f80,_0x14c96f,_0xd2aa4a){_0x24d877=_0x24d877||'wav';_0x220716=_0x220716||'';_0x542f80=_0x542f80===undefined?-0x1:_0x542f80==='-1'?-0x1:_0x542f80*0x3e8;_0x14c96f=_0x14c96f===undefined?'':'s='+_0x14c96f;_0xd2aa4a=_0xd2aa4a?_0xacec('0x3f'):'';return this['sendRequest'](util[_0xacec('0x29')](_0xacec('0x40'),_0x4cbdde,_0x24d877,_0x220716,_0x542f80,_0xd2aa4a,_0x14c96f));};AGIChannel[_0xacec('0x23')][_0xacec('0x41')]=function(_0x12ebc1,_0x3d3c74){_0x3d3c74=_0x3d3c74||'';return this[_0xacec('0x24')](util[_0xacec('0x29')](_0xacec('0x42'),_0x12ebc1,_0x3d3c74));};AGIChannel['prototype'][_0xacec('0x43')]=function(_0x130d32){return this[_0xacec('0x2d')](_0xacec('0x44'),_0x130d32);};AGIChannel[_0xacec('0x23')]['wait']=function(_0x39ce95){return this[_0xacec('0x2d')]('WAIT',_0x39ce95);};AGIChannel[_0xacec('0x23')][_0xacec('0x17')]=function(_0x322224,_0x47d3d3){this[_0xacec('0x2b')](util[_0xacec('0x29')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x322224['id'],_0x322224[_0xacec('0x45')],_0x47d3d3));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index d553710..0480627 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 _0xed72=['[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','message','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.'];(function(_0x337f5a,_0x1ac9ec){var _0x2cceb1=function(_0x1dd278){while(--_0x1dd278){_0x337f5a['push'](_0x337f5a['shift']());}};_0x2cceb1(++_0x1ac9ec);}(_0xed72,0x80));var _0x2ed7=function(_0x48e6f1,_0x1bd3e8){_0x48e6f1=_0x48e6f1-0x0;var _0x154ae1=_0xed72[_0x48e6f1];return _0x154ae1;};'use strict';var util=require(_0x2ed7('0x0'));var error={'E_AGI_UNDEFINED':_0x2ed7('0x1'),'E_AGI_ARGUMENT_PORT':_0x2ed7('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x2ed7('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x2ed7('0x4'),'E_AGI_SOCKET_ERROR':_0x2ed7('0x5'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x2ed7('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x2ed7('0x7')};function AGIError(_0x32713b){var _0x32713b=_0x32713b||null,_0x5834ac=_0x5834ac||[],_0x378c6f=0x1,_0x2653ec='';if(!error[_0x32713b]){_0x32713b='E_AGI_UNDEFINED';}_0x5834ac[_0x2ed7('0x8')](error[_0x32713b]);while(arguments[_0x378c6f]){_0x5834ac[_0x2ed7('0x8')](arguments[_0x378c6f]);_0x378c6f++;}_0x2653ec=util[_0x2ed7('0x9')]['apply'](util,_0x5834ac);this[_0x2ed7('0xa')]=_0x2653ec;this['name']=_0x32713b;}module[_0x2ed7('0xb')]=AGIError; \ No newline at end of file +var _0xf2a8=['Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format','apply','message','name','util','Undefined\x20error.'];(function(_0x3bd5ee,_0x4699fd){var _0x20b1ef=function(_0x28e091){while(--_0x28e091){_0x3bd5ee['push'](_0x3bd5ee['shift']());}};_0x20b1ef(++_0x4699fd);}(_0xf2a8,0xfd));var _0x8f2a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf2a8[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x8f2a('0x0'));var error={'E_AGI_UNDEFINED':_0x8f2a('0x1'),'E_AGI_ARGUMENT_PORT':_0x8f2a('0x2'),'E_AGI_SERVER_ERROR':_0x8f2a('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x8f2a('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x8f2a('0x5'),'E_AGI_SOCKET_ERROR':_0x8f2a('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x8f2a('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x8f2a('0x8'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x3b1a15){var _0x3b1a15=_0x3b1a15||null,_0x189dc1=_0x189dc1||[],_0x567407=0x1,_0x4228fe='';if(!error[_0x3b1a15]){_0x3b1a15=_0x8f2a('0x9');}_0x189dc1[_0x8f2a('0xa')](error[_0x3b1a15]);while(arguments[_0x567407]){_0x189dc1['push'](arguments[_0x567407]);_0x567407++;}_0x4228fe=util[_0x8f2a('0xb')][_0x8f2a('0xc')](util,_0x189dc1);this[_0x8f2a('0xd')]=_0x4228fe;this[_0x8f2a('0xe')]=_0x3b1a15;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index cb6725a..7ff0f0c 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 _0x0e1d=['default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getsecretdigits','edges','numberOfEdges','prototype','addVertex','vertices','addEdge','size','relations','traverseBFS','no\x20vertex\x20found','info','stop\x20traverse','no\x20edge/s\x20available','condition','split','length','vswitch','target','default','agicommand','invalid'];(function(_0x218972,_0x1f9794){var _0x1bb1a8=function(_0x3fb962){while(--_0x3fb962){_0x218972['push'](_0x218972['shift']());}};_0x1bb1a8(++_0x1f9794);}(_0x0e1d,0x1d6));var _0xd0e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0e1d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd0e1('0x0'));var logger=require(_0xd0e1('0x1'))(_0xd0e1('0x2'));var verticesWithRetry=[_0xd0e1('0x3'),'getdigits',_0xd0e1('0x4')];var Graph=function(){this['vertices']={};this[_0xd0e1('0x5')]={};this[_0xd0e1('0x6')]=0x0;};Graph[_0xd0e1('0x7')][_0xd0e1('0x8')]=function(_0x270960){this[_0xd0e1('0x9')][_0x270960['id']]=_0x270960;this[_0xd0e1('0x5')][_0x270960['id']]=[];};Graph[_0xd0e1('0x7')][_0xd0e1('0xa')]=function(_0x1c28de,_0x1aa3b2,_0x4672b1){this[_0xd0e1('0x5')][_0x1c28de]['push']({'target':_0x1aa3b2,'condition':_0x4672b1});this[_0xd0e1('0x6')]+=0x1;};Graph[_0xd0e1('0x7')]['size']=function(){return _[_0xd0e1('0xb')](this[_0xd0e1('0x9')]);};Graph['prototype'][_0xd0e1('0xc')]=function(){return this[_0xd0e1('0x6')];};Graph[_0xd0e1('0x7')]['getVertex']=function(_0x51279c){return this[_0xd0e1('0x9')][_0x51279c];};Graph[_0xd0e1('0x7')][_0xd0e1('0xd')]=function(_0x5d7676,_0x21498c){if(!this[_0xd0e1('0x9')][_0x5d7676]){return logger['info'](_0xd0e1('0xe'));}var _0x5ad4e0=_0x21498c(this[_0xd0e1('0x9')][_0x5d7676]);if(!_0x5ad4e0){return logger[_0xd0e1('0xf')](_0xd0e1('0x10'));}if(this[_0xd0e1('0x5')][_0x5d7676]['length']===0x0){return logger['info'](_0xd0e1('0x11'));}for(var _0xcef027=0x0,_0x242a48=[],_0x14cf19=![];_0xcef027\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','uniqueid','evtHangup','mxGraphModel','root','agicommand','hasOwnProperty','maxRetry','retry','addVertex','mxCell','length','source','target','addEdge','value','getSquareProject','then','catch','createSquareReport','indexOf','agi_','inspect','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','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','omit','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','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','isUndefined','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','listening','xml2json','lodash','moment','../../config/logger','agi','../../config/license/util','./mailRpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','format','[%s]\x20%s','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x3aa935,_0x13c716){var _0x214540=function(_0x3cf66d){while(--_0x3cf66d){_0x3aa935['push'](_0x3aa935['shift']());}};_0x214540(++_0x13c716);}(_0x4699,0x1b9));var _0x9469=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4699[_0x3dd15e];return _0x231fd0;};'use strict';var parser=require(_0x9469('0x0'));var _=require(_0x9469('0x1'));var syncho=require('syncho');var util=require('util');var moment=require(_0x9469('0x2'));var config=require('../../config/environment');var logger=require(_0x9469('0x3'))(_0x9469('0x4'));var utilLicense=require(_0x9469('0x5'));var rpc=require('./rpc');var mailRpc=require(_0x9469('0x6'));var Graph=require(_0x9469('0x7'));var Vertices=require(_0x9469('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x9469('0x4')]=_[_0x9469('0x9')](config[_0x9469('0x4')],{'ip':_0x9469('0xa'),'port':0x11dd});function connectionHandler(_0x22a680){process[_0x9469('0xb')](function(){syncho(function(){try{setChannelVariables(_0x22a680);agiHandler(_0x22a680);}catch(_0x1b7140){logger[_0x9469('0xc')](_0x1b7140[_0x9469('0xd')]);}});});}function listeningHandler(){console[_0x9469('0xe')](_0x9469('0xf'),config[_0x9469('0x4')][_0x9469('0x10')]);logger['info'](util['format'](_0x9469('0x11'),config[_0x9469('0x4')]['ip'],config[_0x9469('0x4')][_0x9469('0x10')]));}function errorHandler(_0x40f30){if(_0x40f30&&_0x40f30[_0x9469('0x12')]&&_0x40f30[_0x9469('0x13')]){logger[_0x9469('0xc')](util[_0x9469('0x14')](_0x9469('0x15'),_0x40f30[_0x9469('0x12')],_0x40f30['message']));}else{logger[_0x9469('0xc')](util[_0x9469('0x14')]('[ERROR]\x20%s',_0x40f30['stack']));}}function closeHandler(){logger[_0x9469('0x16')](util[_0x9469('0x14')](_0x9469('0x17'),this[_0x9469('0x18')],this[_0x9469('0x19')],this[_0x9469('0x1a')],this[_0x9469('0x1b')],this['uniqueid']));try{createSquareReport(this);}catch(_0x4f0139){logger[_0x9469('0xc')](_0x4f0139[_0x9469('0xd')]);}}function timeoutHandler(){logger[_0x9469('0x16')](util[_0x9469('0x14')](_0x9469('0x1c'),this[_0x9469('0x18')],this[_0x9469('0x19')],this[_0x9469('0x1a')],this[_0x9469('0x1b')],this['uniqueid']));}function hangupHandler(){logger[_0x9469('0x16')](util[_0x9469('0x14')](_0x9469('0x1d'),this[_0x9469('0x18')],this[_0x9469('0x19')],this[_0x9469('0x1a')],this[_0x9469('0x1b')],this[_0x9469('0x1e')]));this[_0x9469('0x1f')]=!![];}function getRoot(_0x1a6a7c){return parser['toJson'](_0x1a6a7c,{'object':!![]})[_0x9469('0x20')][_0x9469('0x21')];}function addVertex(_0x3a32d2,_0x5bf1b5,_0x58e1a6){_0x5bf1b5[_0x9469('0x22')]=_0x58e1a6;if(_0x5bf1b5[_0x9469('0x23')]('retry')){_0x5bf1b5[_0x9469('0x24')]=parseInt(_0x5bf1b5[_0x9469('0x25')],0xa);}_0x3a32d2[_0x9469('0x26')](_['omit'](_0x5bf1b5,_0x9469('0x27')));}function initGraph(_0x3cb5d5,_0x43e2b8){var _0x501a60=new Graph();for(var _0xb09d1c in _0x3cb5d5){if(_0x3cb5d5[_0x9469('0x23')](_0xb09d1c)){if(_['isArray'](_0x3cb5d5[_0xb09d1c])){for(var _0x261951=0x0;_0x261951<_0x3cb5d5[_0xb09d1c]['length'];_0x261951+=0x1){addVertex(_0x501a60,_0x3cb5d5[_0xb09d1c][_0x261951],_0xb09d1c);}}else{addVertex(_0x501a60,_0x3cb5d5[_0xb09d1c],_0xb09d1c);}}}for(var _0xcd46aa=0x0;_0xcd46aa<_0x43e2b8[_0x9469('0x28')];_0xcd46aa+=0x1){if(_0x43e2b8[_0xcd46aa][_0x9469('0x29')]&&_0x43e2b8[_0xcd46aa][_0x9469('0x2a')]){_0x501a60[_0x9469('0x2b')](_0x43e2b8[_0xcd46aa][_0x9469('0x29')],_0x43e2b8[_0xcd46aa][_0x9469('0x2a')],_0x43e2b8[_0xcd46aa][_0x9469('0x2c')]);}}return _0x501a60;}function getSquareProject(_0x2bca23,_0x36333f){rpc[_0x9469('0x2d')](_0x2bca23)[_0x9469('0x2e')](function(_0x3d3ff2){_0x36333f(null,_0x3d3ff2);})[_0x9469('0x2f')](function(_0x8dc160){_0x36333f(null,_0x8dc160);});}function createSquareReport(_0x34a365,_0x36d94e){rpc[_0x9469('0x30')](_0x34a365)[_0x9469('0x2e')](function(_0xa4af2b){if(_0x36d94e){_0x36d94e(null,_0xa4af2b);}})[_0x9469('0x2f')](function(_0x18f524){if(_0x36d94e){_0x36d94e(null,_0x18f524);}});}function setChannelVariables(_0x480a75){for(var _0x5087b4 in _0x480a75){if(_0x480a75['hasOwnProperty'](_0x5087b4)){if(_0x5087b4[_0x9469('0x31')](_0x9469('0x32'))===0x0){_0x480a75[_0x5087b4['substring'](0x4)]=_0x480a75[_0x5087b4];delete _0x480a75[_0x5087b4];}}}}function getLogFromObject(_0x223db1){return util[_0x9469('0x33')](_0x223db1,{'showHidden':![],'depth':null});}function agiHandler(_0x1097ab){var _0x231e54,_0x14e6a0,_0x30eccc,_0x3e9220,_0x3050a4;logger[_0x9469('0x34')](_0x9469('0x35'),JSON[_0x9469('0x36')](_0x1097ab,null,0x2));logger[_0x9469('0x16')](util[_0x9469('0x14')](_0x9469('0x37'),_0x1097ab[_0x9469('0x18')],_0x1097ab['calleridname'],_0x1097ab[_0x9469('0x1a')],_0x1097ab[_0x9469('0x1b')],_0x1097ab['uniqueid']));_0x1097ab['on'](_0x9469('0xc'),errorHandler);_0x1097ab['on'](_0x9469('0x38'),closeHandler);_0x1097ab['on'](_0x9469('0x39'),timeoutHandler);_0x1097ab['evtHangup']=![];_0x1097ab['on'](_0x9469('0x3a'),hangupHandler);var _0xb43e80=getSquareProject[_0x9469('0x3b')](null,_0x1097ab['arg_1']);if(_0xb43e80){if(_0xb43e80['production']){_0x231e54=getRoot(_0xb43e80[_0x9469('0x3c')]);if(_0x231e54&&_0x231e54[_0x9469('0x3d')]){logger[_0x9469('0x34')](_0x9469('0x21'),JSON[_0x9469('0x36')](_0x231e54,null,0x2));_0x1097ab[_0x9469('0x3e')]=moment()[_0x9469('0x14')](_0x9469('0x3f'));_0x14e6a0=initGraph(_[_0x9469('0x40')](_0x231e54,'mxCell'),_0x231e54[_0x9469('0x27')]);_0x30eccc=new Vertices(_0x1097ab,rpc,mailRpc);logger[_0x9469('0x16')](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1097ab[_0x9469('0x18')],_0x1097ab[_0x9469('0x19')],_0x1097ab[_0x9469('0x1a')],_0x1097ab[_0x9469('0x1b')],_0x1097ab['uniqueid']));_0x14e6a0[_0x9469('0x41')](_0x231e54[_0x9469('0x3d')]['id'],function(_0x58a9a6){try{_0x58a9a6=_0x30eccc[_0x9469('0x42')](_0x58a9a6);logger[_0x9469('0x34')](_0x9469('0x43'),JSON[_0x9469('0x36')](_0x58a9a6,null,0x2));if(_0x58a9a6[_0x9469('0x22')]===_0x9469('0x44')){logger[_0x9469('0x16')](_0x9469('0x45'));_0x1097ab['context']=_0x58a9a6[_0x9469('0x46')]||_0x1097ab[_0x9469('0x46')];_0x1097ab['extension']=_0x58a9a6[_0x9469('0x47')];_0x1097ab[_0x9469('0x48')]=_0x58a9a6[_0x9469('0x48')]?_0x58a9a6['priority']-0x1:0x1;return null;}else if(_0x58a9a6&&_0x30eccc[_0x58a9a6[_0x9469('0x22')]]){_0x3050a4=_0x30eccc[_0x58a9a6['agicommand']](_0x58a9a6);logger[_0x9469('0x16')](_0x9469('0x49'),JSON[_0x9469('0x36')](_0x3050a4,null,0x2));if(_0x3050a4&&_0x3050a4[_0x9469('0x4a')]===AGI_CODE_SUCCESS&&_0x3050a4[_0x9469('0x4b')]!==AGI_RESULT_ERROR&&!_0x1097ab[_0x9469('0x1f')]){logger['debug'](_0x9469('0x49'),getLogFromObject(_0x3050a4));return _['isUndefined'](_0x3050a4[_0x9469('0x4b')])?null:_0x3050a4[_0x9469('0x4b')][_0x9469('0x4c')]();}else{logger[_0x9469('0xc')](_0x9469('0x49'),getLogFromObject(_0x3050a4));return null;}}else{logger[_0x9469('0xc')](_0x9469('0x4d'));return null;}}catch(_0x340ad0){logger['error'](_0x340ad0[_0x9469('0xd')]);return null;}});if(_0x231e54[_0x9469('0x4e')]){logger[_0x9469('0x16')](util[_0x9469('0x14')](_0x9469('0x4f'),_0x1097ab[_0x9469('0x18')],_0x1097ab['calleridname'],_0x1097ab[_0x9469('0x1a')],_0x1097ab[_0x9469('0x1b')],_0x1097ab['uniqueid']));_0x14e6a0[_0x9469('0x41')](_0x231e54[_0x9469('0x4e')]['id'],function(_0x4625fa){try{_0x4625fa=_0x30eccc[_0x9469('0x42')](_0x4625fa);logger[_0x9469('0x34')](_0x9469('0x43'),JSON['stringify'](_0x4625fa,null,0x2));if(_0x4625fa&&_0x30eccc[_0x4625fa[_0x9469('0x22')]]){_0x3050a4=_0x30eccc[_0x4625fa[_0x9469('0x22')]](_0x4625fa);if(_0x3050a4){logger[_0x9469('0x34')](_0x9469('0x49'),getLogFromObject(_0x3050a4));return _[_0x9469('0x50')](_0x3050a4[_0x9469('0x4b')])?null:_0x3050a4['result']['toString']();}else{logger[_0x9469('0xc')](_0x9469('0x49'),getLogFromObject(_0x3050a4));return null;}}else{logger[_0x9469('0xc')](_0x9469('0x4d'));return null;}}catch(_0xc36189){logger['error'](_0xc36189[_0x9469('0xd')]);return null;}});}logger['info'](util[_0x9469('0x14')](_0x9469('0x51'),_0x1097ab[_0x9469('0x18')],_0x1097ab[_0x9469('0x19')],_0x1097ab[_0x9469('0x1a')],_0x1097ab[_0x9469('0x1b')],_0x1097ab[_0x9469('0x1e')]));logger[_0x9469('0x16')](util[_0x9469('0x14')](_0x9469('0x52'),_0x1097ab['context'],_0x1097ab[_0x9469('0x47')],parseInt(_0x1097ab[_0x9469('0x48')],0xa)+0x1));_0x1097ab[_0x9469('0x53')](_0x1097ab[_0x9469('0x46')],_0x1097ab[_0x9469('0x47')],parseInt(_0x1097ab[_0x9469('0x48')],0xa)+0x1);_0x1097ab['close']();}}else{logger[_0x9469('0xc')](util[_0x9469('0x14')](_0x9469('0x54'),_0x1097ab[_0x9469('0x18')]));_0x1097ab[_0x9469('0x53')](_0x1097ab['context'],_0x1097ab[_0x9469('0x47')],parseInt(_0x1097ab[_0x9469('0x48')],0xa)+0x1);_0x1097ab['close']();}}else{logger[_0x9469('0xc')](util[_0x9469('0x14')](_0x9469('0x55'),_0x1097ab[_0x9469('0x18')]));_0x1097ab[_0x9469('0x53')](_0x1097ab[_0x9469('0x46')],_0x1097ab[_0x9469('0x47')],parseInt(_0x1097ab[_0x9469('0x48')],0xa)+0x1);_0x1097ab[_0x9469('0x38')]();}}function main(){var _0x52fad9;return utilLicense[_0x9469('0x56')]()[_0x9469('0x2e')](function(_0x668845){if(_0x668845){if(_0x668845[_0x9469('0x57')]){if(_0x668845[_0x9469('0x58')]&&_0x668845[_0x9469('0x58')]>0x0){logger[_0x9469('0x16')](util[_0x9469('0x14')]('[LICENSE]\x20CHANNELS:\x20%s',_0x668845[_0x9469('0x58')]));_0x52fad9=_0x668845[_0x9469('0x58')];}else{logger[_0x9469('0x16')](_0x9469('0x59'));}}else{logger['info'](_0x9469('0x5a'));_0x52fad9=-0x1;}}})[_0x9469('0x2f')](function(_0x2f2731){logger[_0x9469('0xc')](_0x9469('0x5b'),_0x2f2731[_0x9469('0xd')]);})[_0x9469('0x4e')](function(){var _0x56481d=require('./server')(config[_0x9469('0x4')]['port'],config[_0x9469('0x4')]['ip'],_0x52fad9);_0x56481d['on'](_0x9469('0xc'),errorHandler);_0x56481d['on'](_0x9469('0x5c'),listeningHandler);_0x56481d['on']('connection',connectionHandler);_0x56481d['on'](_0x9469('0x38'),closeHandler);});}main(); \ No newline at end of file +var _0xcc1d=['catch','indexOf','agi_','substring','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','sync','start','joinAt','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','isUndefined','toString','response','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server','listening','connection','xml2json','util','moment','../../config/environment','agi','./rpc','./mailRpc','defaults','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','uniqueid','info','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','evtHangup','toJson','mxGraphModel','root','agicommand','addVertex','omit','mxCell','hasOwnProperty','isArray','length','source','target','addEdge','value','getSquareProject','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc1d,0x132));var _0xdcc1=function(_0x32c649,_0x4401e0){_0x32c649=_0x32c649-0x0;var _0x440a0a=_0xcc1d[_0x32c649];return _0x440a0a;};'use strict';var parser=require(_0xdcc1('0x0'));var _=require('lodash');var syncho=require('syncho');var util=require(_0xdcc1('0x1'));var moment=require(_0xdcc1('0x2'));var config=require(_0xdcc1('0x3'));var logger=require('../../config/logger')(_0xdcc1('0x4'));var utilLicense=require('../../config/license/util');var rpc=require(_0xdcc1('0x5'));var mailRpc=require(_0xdcc1('0x6'));var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xdcc1('0x4')]=_[_0xdcc1('0x7')](config['agi'],{'ip':_0xdcc1('0x8'),'port':0x11dd});function connectionHandler(_0x3f55a){process[_0xdcc1('0x9')](function(){syncho(function(){try{setChannelVariables(_0x3f55a);agiHandler(_0x3f55a);}catch(_0x238d3b){logger[_0xdcc1('0xa')](_0x238d3b[_0xdcc1('0xb')]);}});});}function listeningHandler(){console[_0xdcc1('0xc')](_0xdcc1('0xd'),config['agi'][_0xdcc1('0xe')]);logger['info'](util[_0xdcc1('0xf')](_0xdcc1('0x10'),config[_0xdcc1('0x4')]['ip'],config['agi'][_0xdcc1('0xe')]));}function errorHandler(_0x53cb6a){if(_0x53cb6a&&_0x53cb6a[_0xdcc1('0x11')]&&_0x53cb6a[_0xdcc1('0x12')]){logger['error'](util[_0xdcc1('0xf')](_0xdcc1('0x13'),_0x53cb6a[_0xdcc1('0x11')],_0x53cb6a[_0xdcc1('0x12')]));}else{logger[_0xdcc1('0xa')](util['format'](_0xdcc1('0x14'),_0x53cb6a[_0xdcc1('0xb')]));}}function closeHandler(){logger['info'](util['format'](_0xdcc1('0x15'),this['arg_1'],this[_0xdcc1('0x16')],this[_0xdcc1('0x17')],this[_0xdcc1('0x18')],this[_0xdcc1('0x19')]));try{createSquareReport(this);}catch(_0x389418){logger[_0xdcc1('0xa')](_0x389418[_0xdcc1('0xb')]);}}function timeoutHandler(){logger[_0xdcc1('0x1a')](util[_0xdcc1('0xf')](_0xdcc1('0x1b'),this[_0xdcc1('0x1c')],this[_0xdcc1('0x16')],this[_0xdcc1('0x17')],this['dnid'],this[_0xdcc1('0x19')]));}function hangupHandler(){logger[_0xdcc1('0x1a')](util[_0xdcc1('0xf')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xdcc1('0x1c')],this[_0xdcc1('0x16')],this[_0xdcc1('0x17')],this['dnid'],this[_0xdcc1('0x19')]));this[_0xdcc1('0x1d')]=!![];}function getRoot(_0x3c5ad3){return parser[_0xdcc1('0x1e')](_0x3c5ad3,{'object':!![]})[_0xdcc1('0x1f')][_0xdcc1('0x20')];}function addVertex(_0x3954f5,_0x5075ae,_0x11642a){_0x5075ae[_0xdcc1('0x21')]=_0x11642a;if(_0x5075ae['hasOwnProperty']('retry')){_0x5075ae['maxRetry']=parseInt(_0x5075ae['retry'],0xa);}_0x3954f5[_0xdcc1('0x22')](_[_0xdcc1('0x23')](_0x5075ae,_0xdcc1('0x24')));}function initGraph(_0x33374d,_0x223669){var _0x32e7e4=new Graph();for(var _0x4f1587 in _0x33374d){if(_0x33374d[_0xdcc1('0x25')](_0x4f1587)){if(_[_0xdcc1('0x26')](_0x33374d[_0x4f1587])){for(var _0x14d5a8=0x0;_0x14d5a8<_0x33374d[_0x4f1587][_0xdcc1('0x27')];_0x14d5a8+=0x1){addVertex(_0x32e7e4,_0x33374d[_0x4f1587][_0x14d5a8],_0x4f1587);}}else{addVertex(_0x32e7e4,_0x33374d[_0x4f1587],_0x4f1587);}}}for(var _0x5d1837=0x0;_0x5d1837<_0x223669[_0xdcc1('0x27')];_0x5d1837+=0x1){if(_0x223669[_0x5d1837][_0xdcc1('0x28')]&&_0x223669[_0x5d1837][_0xdcc1('0x29')]){_0x32e7e4[_0xdcc1('0x2a')](_0x223669[_0x5d1837][_0xdcc1('0x28')],_0x223669[_0x5d1837][_0xdcc1('0x29')],_0x223669[_0x5d1837][_0xdcc1('0x2b')]);}}return _0x32e7e4;}function getSquareProject(_0x5006c7,_0x148e10){rpc[_0xdcc1('0x2c')](_0x5006c7)[_0xdcc1('0x2d')](function(_0x513c42){_0x148e10(null,_0x513c42);})[_0xdcc1('0x2e')](function(_0x203b18){_0x148e10(null,_0x203b18);});}function createSquareReport(_0x38ff02,_0x37d181){rpc['createSquareReport'](_0x38ff02)['then'](function(_0x104068){if(_0x37d181){_0x37d181(null,_0x104068);}})[_0xdcc1('0x2e')](function(_0x32d420){if(_0x37d181){_0x37d181(null,_0x32d420);}});}function setChannelVariables(_0x17a10d){for(var _0x1b48d0 in _0x17a10d){if(_0x17a10d[_0xdcc1('0x25')](_0x1b48d0)){if(_0x1b48d0[_0xdcc1('0x2f')](_0xdcc1('0x30'))===0x0){_0x17a10d[_0x1b48d0[_0xdcc1('0x31')](0x4)]=_0x17a10d[_0x1b48d0];delete _0x17a10d[_0x1b48d0];}}}}function getLogFromObject(_0x5b19bf){return util[_0xdcc1('0x32')](_0x5b19bf,{'showHidden':![],'depth':null});}function agiHandler(_0x31ec2c){var _0x5ead04,_0xbd14e3,_0x1cbc6a,_0x47f362,_0x2fee7b;logger[_0xdcc1('0x33')](_0xdcc1('0x34'),JSON[_0xdcc1('0x35')](_0x31ec2c,null,0x2));logger[_0xdcc1('0x1a')](util[_0xdcc1('0xf')](_0xdcc1('0x36'),_0x31ec2c['arg_1'],_0x31ec2c[_0xdcc1('0x16')],_0x31ec2c['callerid'],_0x31ec2c[_0xdcc1('0x18')],_0x31ec2c[_0xdcc1('0x19')]));_0x31ec2c['on'](_0xdcc1('0xa'),errorHandler);_0x31ec2c['on'](_0xdcc1('0x37'),closeHandler);_0x31ec2c['on']('timeout',timeoutHandler);_0x31ec2c['evtHangup']=![];_0x31ec2c['on'](_0xdcc1('0x38'),hangupHandler);var _0x252f4d=getSquareProject[_0xdcc1('0x39')](null,_0x31ec2c[_0xdcc1('0x1c')]);if(_0x252f4d){if(_0x252f4d['production']){_0x5ead04=getRoot(_0x252f4d['production']);if(_0x5ead04&&_0x5ead04[_0xdcc1('0x3a')]){logger[_0xdcc1('0x33')](_0xdcc1('0x20'),JSON[_0xdcc1('0x35')](_0x5ead04,null,0x2));_0x31ec2c[_0xdcc1('0x3b')]=moment()[_0xdcc1('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0xbd14e3=initGraph(_['omit'](_0x5ead04,_0xdcc1('0x24')),_0x5ead04[_0xdcc1('0x24')]);_0x1cbc6a=new Vertices(_0x31ec2c,rpc,mailRpc);logger['info'](util[_0xdcc1('0xf')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x31ec2c[_0xdcc1('0x1c')],_0x31ec2c[_0xdcc1('0x16')],_0x31ec2c['callerid'],_0x31ec2c[_0xdcc1('0x18')],_0x31ec2c[_0xdcc1('0x19')]));_0xbd14e3['traverseBFS'](_0x5ead04[_0xdcc1('0x3a')]['id'],function(_0x1d3dee){try{_0x1d3dee=_0x1cbc6a[_0xdcc1('0x3c')](_0x1d3dee);logger['debug'](_0xdcc1('0x3d'),JSON[_0xdcc1('0x35')](_0x1d3dee,null,0x2));if(_0x1d3dee[_0xdcc1('0x21')]===_0xdcc1('0x3e')){logger[_0xdcc1('0x1a')](_0xdcc1('0x3f'));_0x31ec2c[_0xdcc1('0x40')]=_0x1d3dee[_0xdcc1('0x40')]||_0x31ec2c[_0xdcc1('0x40')];_0x31ec2c[_0xdcc1('0x41')]=_0x1d3dee['extension'];_0x31ec2c[_0xdcc1('0x42')]=_0x1d3dee[_0xdcc1('0x42')]?_0x1d3dee[_0xdcc1('0x42')]-0x1:0x1;return null;}else if(_0x1d3dee&&_0x1cbc6a[_0x1d3dee[_0xdcc1('0x21')]]){_0x2fee7b=_0x1cbc6a[_0x1d3dee[_0xdcc1('0x21')]](_0x1d3dee);logger['info']('response',JSON[_0xdcc1('0x35')](_0x2fee7b,null,0x2));if(_0x2fee7b&&_0x2fee7b[_0xdcc1('0x43')]===AGI_CODE_SUCCESS&&_0x2fee7b[_0xdcc1('0x44')]!==AGI_RESULT_ERROR&&!_0x31ec2c[_0xdcc1('0x1d')]){logger[_0xdcc1('0x33')]('response',getLogFromObject(_0x2fee7b));return _[_0xdcc1('0x45')](_0x2fee7b[_0xdcc1('0x44')])?null:_0x2fee7b[_0xdcc1('0x44')][_0xdcc1('0x46')]();}else{logger['error'](_0xdcc1('0x47'),getLogFromObject(_0x2fee7b));return null;}}else{logger[_0xdcc1('0xa')](_0xdcc1('0x48'));return null;}}catch(_0x5a6ac5){logger['error'](_0x5a6ac5[_0xdcc1('0xb')]);return null;}});if(_0x5ead04[_0xdcc1('0x49')]){logger[_0xdcc1('0x1a')](util[_0xdcc1('0xf')](_0xdcc1('0x4a'),_0x31ec2c[_0xdcc1('0x1c')],_0x31ec2c['calleridname'],_0x31ec2c[_0xdcc1('0x17')],_0x31ec2c[_0xdcc1('0x18')],_0x31ec2c[_0xdcc1('0x19')]));_0xbd14e3[_0xdcc1('0x4b')](_0x5ead04['finally']['id'],function(_0x1836da){try{_0x1836da=_0x1cbc6a[_0xdcc1('0x3c')](_0x1836da);logger[_0xdcc1('0x33')](_0xdcc1('0x3d'),JSON[_0xdcc1('0x35')](_0x1836da,null,0x2));if(_0x1836da&&_0x1cbc6a[_0x1836da[_0xdcc1('0x21')]]){_0x2fee7b=_0x1cbc6a[_0x1836da[_0xdcc1('0x21')]](_0x1836da);if(_0x2fee7b){logger[_0xdcc1('0x33')]('response',getLogFromObject(_0x2fee7b));return _[_0xdcc1('0x45')](_0x2fee7b['result'])?null:_0x2fee7b[_0xdcc1('0x44')][_0xdcc1('0x46')]();}else{logger['error']('response',getLogFromObject(_0x2fee7b));return null;}}else{logger[_0xdcc1('0xa')]('agicommand\x20not\x20found');return null;}}catch(_0x373146){logger[_0xdcc1('0xa')](_0x373146['stack']);return null;}});}logger[_0xdcc1('0x1a')](util[_0xdcc1('0xf')](_0xdcc1('0x4c'),_0x31ec2c[_0xdcc1('0x1c')],_0x31ec2c['calleridname'],_0x31ec2c[_0xdcc1('0x17')],_0x31ec2c[_0xdcc1('0x18')],_0x31ec2c[_0xdcc1('0x19')]));logger[_0xdcc1('0x1a')](util[_0xdcc1('0xf')](_0xdcc1('0x4d'),_0x31ec2c[_0xdcc1('0x40')],_0x31ec2c[_0xdcc1('0x41')],parseInt(_0x31ec2c[_0xdcc1('0x42')],0xa)+0x1));_0x31ec2c[_0xdcc1('0x4e')](_0x31ec2c[_0xdcc1('0x40')],_0x31ec2c[_0xdcc1('0x41')],parseInt(_0x31ec2c[_0xdcc1('0x42')],0xa)+0x1);_0x31ec2c[_0xdcc1('0x37')]();}}else{logger[_0xdcc1('0xa')](util[_0xdcc1('0xf')](_0xdcc1('0x4f'),_0x31ec2c['arg_1']));_0x31ec2c[_0xdcc1('0x4e')](_0x31ec2c[_0xdcc1('0x40')],_0x31ec2c['extension'],parseInt(_0x31ec2c['priority'],0xa)+0x1);_0x31ec2c['close']();}}else{logger[_0xdcc1('0xa')](util[_0xdcc1('0xf')]('Project\x20%s\x20not\x20found',_0x31ec2c['arg_1']));_0x31ec2c[_0xdcc1('0x4e')](_0x31ec2c[_0xdcc1('0x40')],_0x31ec2c[_0xdcc1('0x41')],parseInt(_0x31ec2c[_0xdcc1('0x42')],0xa)+0x1);_0x31ec2c['close']();}}function main(){var _0x335b3c;return utilLicense[_0xdcc1('0x50')]()[_0xdcc1('0x2d')](function(_0xd8426){if(_0xd8426){if(_0xd8426['voice']){if(_0xd8426[_0xdcc1('0x51')]&&_0xd8426['callysquare']>0x0){logger['info'](util[_0xdcc1('0xf')](_0xdcc1('0x52'),_0xd8426['callysquare']));_0x335b3c=_0xd8426[_0xdcc1('0x51')];}else{logger['info'](_0xdcc1('0x53'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x335b3c=-0x1;}}})[_0xdcc1('0x2e')](function(_0x4d6800){logger[_0xdcc1('0xa')](_0xdcc1('0x54'),_0x4d6800[_0xdcc1('0xb')]);})['finally'](function(){var _0x78224e=require(_0xdcc1('0x55'))(config['agi'][_0xdcc1('0xe')],config[_0xdcc1('0x4')]['ip'],_0x335b3c);_0x78224e['on'](_0xdcc1('0xa'),errorHandler);_0x78224e['on'](_0xdcc1('0x56'),listeningHandler);_0x78224e['on'](_0xdcc1('0x57'),connectionHandler);_0x78224e['on'](_0xdcc1('0x37'),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 958c654..fe01a3c 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 _0x8551=['jayson/promise','client','request','then','error','message','result','catch','sendMailMessage','SendMail','bluebird'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x8551,0x13e));var _0x1855=function(_0x590861,_0x42c7f3){_0x590861=_0x590861-0x0;var _0x1d0a80=_0x8551[_0x590861];return _0x1d0a80;};'use strict';var BPromise=require(_0x1855('0x0'));var jayson=require(_0x1855('0x1'));var client=jayson[_0x1855('0x2')]['http']({'port':0x232b});function request(_0x2bcbef,_0x5b1ac2){return new BPromise(function(_0x27df25,_0x500bb9){return client[_0x1855('0x3')](_0x2bcbef,_0x5b1ac2)[_0x1855('0x4')](function(_0x347d7e){if(_0x347d7e[_0x1855('0x5')]){return _0x500bb9(_0x347d7e[_0x1855('0x5')][_0x1855('0x6')]);}else{return _0x27df25(_0x347d7e[_0x1855('0x7')]);}})[_0x1855('0x8')](function(_0x30ae59){return _0x500bb9(_0x30ae59);});});}exports[_0x1855('0x9')]=function(_0x3eace7,_0x56574a){return request(_0x1855('0xa'),{'account':_0x3eace7,'message':_0x56574a});}; \ No newline at end of file +var _0xa697=['catch','sendMailMessage','SendMail','jayson/promise','client','http','then','message','result'];(function(_0x26a20e,_0x397ab0){var _0x454043=function(_0x433a72){while(--_0x433a72){_0x26a20e['push'](_0x26a20e['shift']());}};_0x454043(++_0x397ab0);}(_0xa697,0x162));var _0x7a69=function(_0x47d02e,_0x33211b){_0x47d02e=_0x47d02e-0x0;var _0x2edb9a=_0xa697[_0x47d02e];return _0x2edb9a;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x7a69('0x0'));var client=jayson[_0x7a69('0x1')][_0x7a69('0x2')]({'port':0x232b});function request(_0x1a137c,_0x158212){return new BPromise(function(_0x3d7aa4,_0x1df614){return client['request'](_0x1a137c,_0x158212)[_0x7a69('0x3')](function(_0x358688){if(_0x358688['error']){return _0x1df614(_0x358688['error'][_0x7a69('0x4')]);}else{return _0x3d7aa4(_0x358688[_0x7a69('0x5')]);}})[_0x7a69('0x6')](function(_0x431e65){return _0x1df614(_0x431e65);});});}exports[_0x7a69('0x7')]=function(_0x475451,_0x46450c){return request(_0x7a69('0x8'),{'account':_0x475451,'message':_0x46450c});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index c1ace97..f57c791 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 _0xc052=['emit','headers','line','exports','util','stream','call','prototype','\x0d\x0a\x0d\x0a','_localBuffer','toString','_inBody','indexOf','substring','length','split','trim','slice'];(function(_0x4e2bc6,_0x5e2401){var _0x59357a=function(_0x437f8c){while(--_0x437f8c){_0x4e2bc6['push'](_0x4e2bc6['shift']());}};_0x59357a(++_0x5e2401);}(_0xc052,0x70));var _0x2c05=function(_0x1f3b76,_0x17ba2a){_0x1f3b76=_0x1f3b76-0x0;var _0x4dc555=_0xc052[_0x1f3b76];return _0x4dc555;};'use strict';var util=require(_0x2c05('0x0'));var Transform=require(_0x2c05('0x1'))['Transform'];function AGIReply(_0x16b3dd){Transform[_0x2c05('0x2')](this,_0x16b3dd);this['_localBuffer']='';this['_inBody']=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x2c05('0x3')]['_transform']=function(_0x2a501b,_0x1d7672,_0x41a498){var _0x3921a0='\x0a',_0x2dd7c9=['\x0a\x0a',_0x2c05('0x4')],_0x344b44=-0x1,_0x13d267=-0x1,_0x177fba='',_0x1a023c=0x0,_0x2582e1='',_0x3d6e01='';this[_0x2c05('0x5')]+=_0x2a501b[_0x2c05('0x6')]();_0x2582e1=this[_0x2c05('0x5')];if(!this[_0x2c05('0x7')]){_0x1a023c=0x0;while(_0x2dd7c9[_0x1a023c]){while((_0x13d267=_0x2582e1[_0x2c05('0x8')](_0x2dd7c9[_0x1a023c]))!=-0x1){_0x177fba=_0x2dd7c9[_0x1a023c];_0x3d6e01=_0x2582e1[_0x2c05('0x9')](0x0,_0x13d267);_0x2582e1=_0x2582e1[_0x2c05('0x9')](_0x13d267+_0x177fba[_0x2c05('0xa')]);var _0x4d3394=_0x3d6e01[_0x2c05('0xb')](_0x3921a0),_0xe6edae=0x0,_0x2d8eb0={},_0x45e7af='',_0x3238fb='',_0x50767e=-0x1;while(_0x4d3394[_0xe6edae]){_0x50767e=_0x4d3394[_0xe6edae]['indexOf'](':');if(_0x50767e!=-0x1){_0x45e7af=_0x4d3394[_0xe6edae]['slice'](0x0,_0x50767e)[_0x2c05('0xc')]();_0x3238fb=_0x4d3394[_0xe6edae][_0x2c05('0xd')](_0x50767e+0x1)['trim']();if(_0x45e7af[_0x2c05('0xa')]>0x0){_0x2d8eb0[_0x45e7af]=_0x3238fb;}}else{}_0xe6edae++;}this[_0x2c05('0xe')](_0x2c05('0xf'),_0x2d8eb0);this[_0x2c05('0x7')]=!![];}_0x1a023c++;}this[_0x2c05('0x5')]=_0x2582e1;}else{while((_0x344b44=_0x2582e1[_0x2c05('0x8')](_0x3921a0))!=-0x1){_0x3d6e01=_0x2582e1[_0x2c05('0x9')](0x0,_0x344b44);this[_0x2c05('0xe')](_0x2c05('0x10'),_0x3d6e01);_0x2582e1=_0x2582e1['substring'](_0x344b44+_0x3921a0[_0x2c05('0xa')]);}this[_0x2c05('0x5')]=_0x2582e1;}_0x41a498();};module[_0x2c05('0x11')]=AGIReply; \ No newline at end of file +var _0x5884=['util','stream','call','_inBody','inherits','prototype','_transform','_localBuffer','indexOf','substring','length','split','slice','trim','headers','emit','line','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5884,0x144));var _0x4588=function(_0x4a9e89,_0x7529fc){_0x4a9e89=_0x4a9e89-0x0;var _0x24007d=_0x5884[_0x4a9e89];return _0x24007d;};'use strict';var util=require(_0x4588('0x0'));var Transform=require(_0x4588('0x1'))['Transform'];function AGIReply(_0x51c268){Transform[_0x4588('0x2')](this,_0x51c268);this['_localBuffer']='';this[_0x4588('0x3')]=![];}util[_0x4588('0x4')](AGIReply,Transform);AGIReply[_0x4588('0x5')][_0x4588('0x6')]=function(_0x4a8bec,_0x16a4ee,_0x4d0829){var _0x50b183='\x0a',_0x2c7457=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0xac0b6=-0x1,_0x4487a5=-0x1,_0x315c59='',_0x34de9c=0x0,_0x14ce57='',_0x38d233='';this[_0x4588('0x7')]+=_0x4a8bec['toString']();_0x14ce57=this['_localBuffer'];if(!this[_0x4588('0x3')]){_0x34de9c=0x0;while(_0x2c7457[_0x34de9c]){while((_0x4487a5=_0x14ce57[_0x4588('0x8')](_0x2c7457[_0x34de9c]))!=-0x1){_0x315c59=_0x2c7457[_0x34de9c];_0x38d233=_0x14ce57[_0x4588('0x9')](0x0,_0x4487a5);_0x14ce57=_0x14ce57[_0x4588('0x9')](_0x4487a5+_0x315c59[_0x4588('0xa')]);var _0x4eb3b=_0x38d233[_0x4588('0xb')](_0x50b183),_0x44516e=0x0,_0x3a12d4={},_0x356099='',_0x452bf6='',_0x306001=-0x1;while(_0x4eb3b[_0x44516e]){_0x306001=_0x4eb3b[_0x44516e][_0x4588('0x8')](':');if(_0x306001!=-0x1){_0x356099=_0x4eb3b[_0x44516e]['slice'](0x0,_0x306001)['trim']();_0x452bf6=_0x4eb3b[_0x44516e][_0x4588('0xc')](_0x306001+0x1)[_0x4588('0xd')]();if(_0x356099[_0x4588('0xa')]>0x0){_0x3a12d4[_0x356099]=_0x452bf6;}}else{}_0x44516e++;}this['emit'](_0x4588('0xe'),_0x3a12d4);this['_inBody']=!![];}_0x34de9c++;}this[_0x4588('0x7')]=_0x14ce57;}else{while((_0xac0b6=_0x14ce57['indexOf'](_0x50b183))!=-0x1){_0x38d233=_0x14ce57[_0x4588('0x9')](0x0,_0xac0b6);this[_0x4588('0xf')](_0x4588('0x10'),_0x38d233);_0x14ce57=_0x14ce57[_0x4588('0x9')](_0xac0b6+_0x50b183[_0x4588('0xa')]);}this[_0x4588('0x7')]=_0x14ce57;}_0x4d0829();};module[_0x4588('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 64a2a3e..099c442 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 _0xb5a2=['production','getMailAccountById','MailServerOut','Smtp','name','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','ShowTrunk','getSoundById','save_name','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','bluebird','moment','lodash','jayson/promise','http','request','error','message','result','catch','ShowSquareProject'];(function(_0x293e67,_0x2038a0){var _0x433a81=function(_0x265a09){while(--_0x265a09){_0x293e67['push'](_0x293e67['shift']());}};_0x433a81(++_0x2038a0);}(_0xb5a2,0x1bd));var _0x2b5a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb5a2[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x2b5a('0x0'));var moment=require(_0x2b5a('0x1'));var _=require(_0x2b5a('0x2'));var util=require('util');var jayson=require(_0x2b5a('0x3'));var client=jayson['client'][_0x2b5a('0x4')]({'port':0x2329});function request(_0x81a646,_0x33267c){return new BPromise(function(_0x2288e7,_0x185e35){return client[_0x2b5a('0x5')](_0x81a646,_0x33267c)['then'](function(_0x2b5417){if(_0x2b5417[_0x2b5a('0x6')]){return _0x185e35(_0x2b5417[_0x2b5a('0x6')][_0x2b5a('0x7')]);}else{return _0x2288e7(_0x2b5417[_0x2b5a('0x8')]);}})[_0x2b5a('0x9')](function(_0x9c3297){return _0x185e35(_0x9c3297);});});}exports['getSquareProject']=function(_0x7f285a){return request(_0x2b5a('0xa'),{'options':{'raw':![],'where':{'name':_0x7f285a},'attributes':[_0x2b5a('0xb')]}});};exports[_0x2b5a('0xc')]=function(_0x25a436){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x25a436},'include':[{'model':_0x2b5a('0xd'),'as':_0x2b5a('0xe')}],'attributes':['id',_0x2b5a('0xf'),'email']}});};exports[_0x2b5a('0x10')]=function(_0x3e8069){return request(_0x2b5a('0xa'),{'options':{'where':{'id':_0x3e8069},'attributes':['name']}});};exports[_0x2b5a('0x11')]=function(_0x184e8f){return request(_0x2b5a('0x12'),{'options':{'where':{'id':_0x184e8f},'attributes':[_0x2b5a('0xf')]}});};exports[_0x2b5a('0x13')]=function(_0x5bd1bc){return request(_0x2b5a('0x14'),{'options':{'where':{'id':_0x5bd1bc},'attributes':[_0x2b5a('0xf')]}});};exports[_0x2b5a('0x15')]=function(_0x28522b){return request(_0x2b5a('0x16'),{'options':{'where':{'id':_0x28522b},'attributes':[_0x2b5a('0x17')]}});};exports[_0x2b5a('0x18')]=function(_0x2ce037){return request(_0x2b5a('0x19'),{'options':{'where':{'id':_0x2ce037},'attributes':[_0x2b5a('0xf')]}});};exports['getTrunkById']=function(_0x21e350){return request(_0x2b5a('0x1a'),{'options':{'where':{'id':_0x21e350},'attributes':[_0x2b5a('0xf')]}});};exports[_0x2b5a('0x1b')]=function(_0x200164){return request('ShowSound',{'options':{'where':{'id':_0x200164},'attributes':[_0x2b5a('0x1c')]}});};exports['getIntervalById']=function(_0x255f62){return request(_0x2b5a('0x1d'),{'options':{'raw':![],'where':{'id':_0x255f62},'include':[{'model':'Interval','as':_0x2b5a('0x1e')}]}});};exports[_0x2b5a('0x1f')]=function(_0x5a061f){return request(_0x2b5a('0x20'),{'options':{'where':{'id':_0x5a061f},'attributes':['id',_0x2b5a('0xf')]}});};exports[_0x2b5a('0x21')]=function(_0x128dd2){return request('CreateSmsMessage',{'body':_0x128dd2});};exports[_0x2b5a('0x22')]=function(_0x222559){return request('CreateSquareDetailsReport',{'body':_0x222559});};exports['createSquareReport']=function(_0x4360e9){return request(_0x2b5a('0x23'),{'body':_[_0x2b5a('0x24')](_0x4360e9,{'project_name':_0x4360e9[_0x2b5a('0x25')],'prev_project_name':_0x4360e9[_0x2b5a('0x26')]||'','is_subproject':_0x4360e9['arg_2']?!![]:![],'leaveAt':moment()[_0x2b5a('0x27')](_0x2b5a('0x28'))})});};exports[_0x2b5a('0x29')]=function(_0x44148d){return request(_0x2b5a('0x2a'),{'body':_0x44148d});};exports[_0x2b5a('0x2b')]=function(_0x48d102){return request(_0x2b5a('0x2c'),{'body':_0x48d102});};exports[_0x2b5a('0x2d')]=function(_0x7568b7){return request(_0x2b5a('0x2e'),{'options':{'raw':![],'where':{'phone':_0x7568b7[_0x2b5a('0x2f')],'ListId':_0x7568b7[_0x2b5a('0x30')]}}})['then'](function(_0x2342d0){if(_0x2342d0){return _0x2342d0;}return request(_0x2b5a('0x31'),{'body':_0x7568b7});});};exports[_0x2b5a('0x32')]=function(_0x10d7b4){return request('ShowPause',{'options':{'where':{'id':_0x10d7b4},'attributes':['name']}});};exports[_0x2b5a('0x33')]=function(_0x58e725,_0x5b2ec8){return request(_0x2b5a('0x34'),{'body':{'interface':_0x5b2ec8},'options':{'where':_0x58e725}});};exports[_0x2b5a('0x35')]=function(_0x4b475d,_0x24c160,_0x356a87){return request(_0x2b5a('0x36'),{'body':{'type':_0x24c160,'uniqueid':_0x356a87},'options':{'where':_0x4b475d}});};exports[_0x2b5a('0x37')]=function(_0x42b8bd){return request('UnpauseUser',{'body':{},'options':{'where':_0x42b8bd}});};exports[_0x2b5a('0x38')]=function(_0xe27d0e){return request('LogoutUser',{'body':{},'options':{'where':_0xe27d0e}});}; \ No newline at end of file +var _0xf31e=['getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareReport','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage','ShowCmHopper','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','util','jayson/promise','http','request','then','error','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','dsn'];(function(_0x57dbce,_0x2a4604){var _0x2ab396=function(_0x321f80){while(--_0x321f80){_0x57dbce['push'](_0x57dbce['shift']());}};_0x2ab396(++_0x2a4604);}(_0xf31e,0x16f));var _0xef31=function(_0x1cccb6,_0x5703d2){_0x1cccb6=_0x1cccb6-0x0;var _0x220cc7=_0xf31e[_0x1cccb6];return _0x220cc7;};'use strict';var BPromise=require(_0xef31('0x0'));var moment=require(_0xef31('0x1'));var _=require('lodash');var util=require(_0xef31('0x2'));var jayson=require(_0xef31('0x3'));var client=jayson['client'][_0xef31('0x4')]({'port':0x2329});function request(_0x1f52db,_0x2ffe1e){return new BPromise(function(_0x10c7c7,_0x4c187f){return client[_0xef31('0x5')](_0x1f52db,_0x2ffe1e)[_0xef31('0x6')](function(_0x14d63a){if(_0x14d63a['error']){return _0x4c187f(_0x14d63a[_0xef31('0x7')]['message']);}else{return _0x10c7c7(_0x14d63a[_0xef31('0x8')]);}})[_0xef31('0x9')](function(_0x3dab14){return _0x4c187f(_0x3dab14);});});}exports[_0xef31('0xa')]=function(_0x47092b){return request(_0xef31('0xb'),{'options':{'raw':![],'where':{'name':_0x47092b},'attributes':[_0xef31('0xc')]}});};exports[_0xef31('0xd')]=function(_0x1c2686){return request(_0xef31('0xe'),{'options':{'raw':![],'where':{'id':_0x1c2686},'include':[{'model':_0xef31('0xf'),'as':'Smtp'}],'attributes':['id',_0xef31('0x10'),_0xef31('0x11')]}});};exports[_0xef31('0x12')]=function(_0x1c72cd){return request(_0xef31('0xb'),{'options':{'where':{'id':_0x1c72cd},'attributes':[_0xef31('0x10')]}});};exports[_0xef31('0x13')]=function(_0x8b6b69){return request(_0xef31('0x14'),{'options':{'where':{'id':_0x8b6b69},'attributes':[_0xef31('0x10')]}});};exports[_0xef31('0x15')]=function(_0x5ba8d2){return request(_0xef31('0x16'),{'options':{'where':{'id':_0x5ba8d2},'attributes':[_0xef31('0x10')]}});};exports[_0xef31('0x17')]=function(_0x272e9d){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x272e9d},'attributes':[_0xef31('0x18')]}});};exports[_0xef31('0x19')]=function(_0x3c44c3){return request(_0xef31('0x1a'),{'options':{'where':{'id':_0x3c44c3},'attributes':[_0xef31('0x10')]}});};exports[_0xef31('0x1b')]=function(_0x2c1058){return request(_0xef31('0x1c'),{'options':{'where':{'id':_0x2c1058},'attributes':[_0xef31('0x10')]}});};exports[_0xef31('0x1d')]=function(_0x576ccb){return request(_0xef31('0x1e'),{'options':{'where':{'id':_0x576ccb},'attributes':[_0xef31('0x1f')]}});};exports['getIntervalById']=function(_0x181952){return request(_0xef31('0x20'),{'options':{'raw':![],'where':{'id':_0x181952},'include':[{'model':_0xef31('0x21'),'as':_0xef31('0x22')}]}});};exports[_0xef31('0x23')]=function(_0x2b4461){return request(_0xef31('0x24'),{'options':{'where':{'id':_0x2b4461},'attributes':['id','name']}});};exports[_0xef31('0x25')]=function(_0x54aeb8){return request('CreateSmsMessage',{'body':_0x54aeb8});};exports[_0xef31('0x26')]=function(_0x5a9387){return request('CreateSquareDetailsReport',{'body':_0x5a9387});};exports['createSquareReport']=function(_0x18c759){return request(_0xef31('0x27'),{'body':_['merge'](_0x18c759,{'project_name':_0x18c759['arg_1'],'prev_project_name':_0x18c759[_0xef31('0x28')]||'','is_subproject':_0x18c759['arg_2']?!![]:![],'leaveAt':moment()['format'](_0xef31('0x29'))})});};exports[_0xef31('0x2a')]=function(_0x1c6eeb){return request(_0xef31('0x2b'),{'body':_0x1c6eeb});};exports['createSquareMessage']=function(_0x4b958d){return request(_0xef31('0x2c'),{'body':_0x4b958d});};exports['createCmContact']=function(_0x532b78){return request(_0xef31('0x2d'),{'options':{'raw':![],'where':{'phone':_0x532b78['phone'],'ListId':_0x532b78['ListId']}}})['then'](function(_0xe24c31){if(_0xe24c31){return _0xe24c31;}return request('CreateCmContact',{'body':_0x532b78});});};exports[_0xef31('0x2e')]=function(_0x487c93){return request(_0xef31('0x2f'),{'options':{'where':{'id':_0x487c93},'attributes':[_0xef31('0x10')]}});};exports[_0xef31('0x30')]=function(_0x4a93ee,_0x3fbaba){return request(_0xef31('0x31'),{'body':{'interface':_0x3fbaba},'options':{'where':_0x4a93ee}});};exports[_0xef31('0x32')]=function(_0x4ceeb8,_0x415be7,_0x5c8197){return request(_0xef31('0x33'),{'body':{'type':_0x415be7,'uniqueid':_0x5c8197},'options':{'where':_0x4ceeb8}});};exports[_0xef31('0x34')]=function(_0x43a9fa){return request(_0xef31('0x35'),{'body':{},'options':{'where':_0x43a9fa}});};exports[_0xef31('0x36')]=function(_0x214369){return request(_0xef31('0x37'),{'body':{},'options':{'where':_0x214369}});}; \ 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 264e1d9..07816a9 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 _0xc0a4=['exports','./lex'];(function(_0x46efd7,_0x43f84d){var _0x5637e4=function(_0x54e078){while(--_0x54e078){_0x46efd7['push'](_0x46efd7['shift']());}};_0x5637e4(++_0x43f84d);}(_0xc0a4,0x147));var _0x4c0a=function(_0x5781e1,_0x13a9d4){_0x5781e1=_0x5781e1-0x0;var _0x349f2e=_0xc0a4[_0x5781e1];return _0x349f2e;};var polly=require('./polly');var lex=require(_0x4c0a('0x0'));module[_0x4c0a('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x04e7=['exports','./polly','./lex'];(function(_0x1b7d3e,_0xa4cadf){var _0xe9147f=function(_0x4a5dad){while(--_0x4a5dad){_0x1b7d3e['push'](_0x1b7d3e['shift']());}};_0xe9147f(++_0xa4cadf);}(_0x04e7,0x121));var _0x704e=function(_0x4e4519,_0x392ae){_0x4e4519=_0x4e4519-0x0;var _0x340044=_0x04e7[_0x4e4519];return _0x340044;};var polly=require(_0x704e('0x0'));var lex=require(_0x704e('0x1'));module[_0x704e('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 677e287..b2752cb 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 _0x9348=['exports','./lib/api'];(function(_0x15e286,_0x405fdc){var _0x4d419c=function(_0x2e595b){while(--_0x2e595b){_0x15e286['push'](_0x15e286['shift']());}};_0x4d419c(++_0x405fdc);}(_0x9348,0x10d));var _0x8934=function(_0x453ab0,_0x5a8271){_0x453ab0=_0x453ab0-0x0;var _0x315b43=_0x9348[_0x453ab0];return _0x315b43;};'use strict';var lex=require(_0x8934('0x0'));module[_0x8934('0x1')]=function(_0x472223,_0x135b2c,_0x46a231,_0x4a2577,_0x34d032,_0x35da0b){return lex(_0x472223,_0x135b2c,_0x46a231,_0x4a2577,_0x34d032,_0x35da0b);}; \ No newline at end of file +var _0x2750=['./lib/api'];(function(_0x24cc72,_0x4dc73a){var _0xd49f1e=function(_0x39f581){while(--_0x39f581){_0x24cc72['push'](_0x24cc72['shift']());}};_0xd49f1e(++_0x4dc73a);}(_0x2750,0x13b));var _0x0275=function(_0x2da614,_0x3e0643){_0x2da614=_0x2da614-0x0;var _0xdebb83=_0x2750[_0x2da614];return _0xdebb83;};'use strict';var lex=require(_0x0275('0x0'));module['exports']=function(_0xf4568,_0xf2ae71,_0x372744,_0x429a37,_0x101b26,_0x41ec06){return lex(_0xf4568,_0xf2ae71,_0x372744,_0x429a37,_0x101b26,_0x41ec06);}; \ 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 a099752..7ece3ff 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(_0xc8cc3d,_0x1e557c){var _0x142a7c=function(_0x258bae){while(--_0x258bae){_0xc8cc3d['push'](_0xc8cc3d['shift']());}};_0x142a7c(++_0x1e557c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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(_0x1d3b2b,_0xb5f1d8){var _0xc8839f=function(_0x22f036){while(--_0x22f036){_0x1d3b2b['push'](_0x1d3b2b['shift']());}};_0xc8839f(++_0xb5f1d8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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 d157c44..679648a 100644 --- a/server/services/agi/scripts/aws/polly/index.js +++ b/server/services/agi/scripts/aws/polly/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd2cb=['./lib/api'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0xd2cb,0xd7));var _0xbd2c=function(_0x298c7b,_0xa15467){_0x298c7b=_0x298c7b-0x0;var _0x4d9584=_0xd2cb[_0x298c7b];return _0x4d9584;};'use strict';var polly=require(_0xbd2c('0x0'));module['exports']=function(_0x4be648,_0x47ecbd,_0x2d4206,_0x674e9,_0x46b81e,_0x3a91d6,_0x43b64b){return polly(_0x4be648,_0x47ecbd,_0x2d4206,_0x674e9,_0x46b81e,_0x3a91d6,_0x43b64b);}; \ No newline at end of file +var _0xa2f2=['./lib/api','exports'];(function(_0x571c00,_0x3ae028){var _0x2887df=function(_0x5ebe70){while(--_0x5ebe70){_0x571c00['push'](_0x571c00['shift']());}};_0x2887df(++_0x3ae028);}(_0xa2f2,0x1a8));var _0x2a2f=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa2f2[_0x2f5ac5];return _0x37c9a8;};'use strict';var polly=require(_0x2a2f('0x0'));module[_0x2a2f('0x1')]=function(_0xd53f9b,_0x2457a7,_0x1ae79a,_0x259940,_0x38e530,_0x2f1a96,_0x256aea){return polly(_0xd53f9b,_0x2457a7,_0x1ae79a,_0x259940,_0x38e530,_0x2f1a96,_0x256aea);}; \ 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 9ec4dfb..2d774d6 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 _0x334f=['aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','bluebird','randomstring'];(function(_0xf12d84,_0x15cc7c){var _0x210154=function(_0x57df16){while(--_0x57df16){_0xf12d84['push'](_0xf12d84['shift']());}};_0x210154(++_0x15cc7c);}(_0x334f,0x106));var _0xf334=function(_0x514547,_0x6f64cb){_0x514547=_0x514547-0x0;var _0x3e9878=_0x334f[_0x514547];return _0x3e9878;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xf334('0x0'));var rs=require(_0xf334('0x1'));var AWS=require(_0xf334('0x2'));function pollyResult(_0x59f699,_0x4c2109,_0x313af8){return new BPromise(function(_0x11220a,_0x26acc6){_0x59f699[_0xf334('0x3')](_0x4c2109,function(_0x241d31,_0x49f0e8){if(_0x241d31){_0x26acc6(_0x241d31);}else if(_0x49f0e8){if(_0x49f0e8[_0xf334('0x4')]instanceof Buffer){fs[_0xf334('0x5')](_0x313af8,_0x49f0e8[_0xf334('0x4')],function(_0x44f780){if(_0x44f780){_0x26acc6(_0x44f780);}else{_0x11220a();}});}else{_0x26acc6(new Error(_0xf334('0x6')));}}else{_0x26acc6(new Error(_0xf334('0x7')));}});});}module[_0xf334('0x8')]=function(_0x4f4d0c,_0x955bba,_0x3aec50,_0x5280be,_0x4df5c8,_0x39adf0,_0x10ffc6){var _0x4ab9f1=new AWS[(_0xf334('0x9'))]({'accessKeyId':_0x4f4d0c,'secretAccessKey':_0x955bba,'region':_0x3aec50});var _0x36485b={'Text':_0x4df5c8,'TextType':_0x39adf0||_0xf334('0xa'),'OutputFormat':_0xf334('0xb'),'VoiceId':_0x5280be};return pollyResult(_0x4ab9f1,_0x36485b,_0x10ffc6);}; \ No newline at end of file +var _0x288f=['bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path'];(function(_0x38db3a,_0x244702){var _0x2ead95=function(_0x558eab){while(--_0x558eab){_0x38db3a['push'](_0x38db3a['shift']());}};_0x2ead95(++_0x244702);}(_0x288f,0x19f));var _0xf288=function(_0xad57ee,_0x2823a6){_0xad57ee=_0xad57ee-0x0;var _0x3eaea9=_0x288f[_0xad57ee];return _0x3eaea9;};'use strict';var fs=require('fs');var path=require(_0xf288('0x0'));var BPromise=require(_0xf288('0x1'));var rs=require(_0xf288('0x2'));var AWS=require(_0xf288('0x3'));function pollyResult(_0x6ce67c,_0x19fcc5,_0x1df5b0){return new BPromise(function(_0x53bd7d,_0x54a9d0){_0x6ce67c[_0xf288('0x4')](_0x19fcc5,function(_0x598bdd,_0x1b6fbf){if(_0x598bdd){_0x54a9d0(_0x598bdd);}else if(_0x1b6fbf){if(_0x1b6fbf[_0xf288('0x5')]instanceof Buffer){fs[_0xf288('0x6')](_0x1df5b0,_0x1b6fbf[_0xf288('0x5')],function(_0x2be416){if(_0x2be416){_0x54a9d0(_0x2be416);}else{_0x53bd7d();}});}else{_0x54a9d0(new Error(_0xf288('0x7')));}}else{_0x54a9d0(new Error(_0xf288('0x8')));}});});}module[_0xf288('0x9')]=function(_0xb2c40e,_0x23200e,_0x3fd8d6,_0x5ad409,_0x47ca1e,_0x113072,_0x2532d8){var _0xc0d9e0=new AWS[(_0xf288('0xa'))]({'accessKeyId':_0xb2c40e,'secretAccessKey':_0x23200e,'region':_0x3fd8d6});var _0x2daca3={'Text':_0x47ca1e,'TextType':_0x113072||_0xf288('0xb'),'OutputFormat':_0xf288('0xc'),'VoiceId':_0x5ad409};return pollyResult(_0xc0d9e0,_0x2daca3,_0x2532d8);}; \ 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 bd11236..88b2fa5 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 _0xc356=['./lib/api','exports'];(function(_0x490dee,_0xd37e93){var _0x571ef3=function(_0x42b7c7){while(--_0x42b7c7){_0x490dee['push'](_0x490dee['shift']());}};_0x571ef3(++_0xd37e93);}(_0xc356,0xea));var _0x6c35=function(_0x20fb02,_0x96c029){_0x20fb02=_0x20fb02-0x0;var _0x24a33e=_0xc356[_0x20fb02];return _0x24a33e;};'use strict';var asr=require(_0x6c35('0x0'));module[_0x6c35('0x1')]=function(_0x13c8b8,_0x4f9142,_0x3ccd61,_0xcb60b0){return asr(_0x13c8b8,_0x4f9142,_0x3ccd61);}; \ No newline at end of file +var _0xdb73=['./lib/api','exports'];(function(_0xfb9ff9,_0x2e768f){var _0xa1fda=function(_0x17fb1e){while(--_0x17fb1e){_0xfb9ff9['push'](_0xfb9ff9['shift']());}};_0xa1fda(++_0x2e768f);}(_0xdb73,0x122));var _0x3db7=function(_0x5dc922,_0x5bcfc5){_0x5dc922=_0x5dc922-0x0;var _0x20e540=_0xdb73[_0x5dc922];return _0x20e540;};'use strict';var asr=require(_0x3db7('0x0'));module[_0x3db7('0x1')]=function(_0x20f669,_0x199785,_0x191c98,_0x58fe23){return asr(_0x20f669,_0x199785,_0x191c98);}; \ 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 8aeec34..0e41457 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 _0x9b87=['/v1/speech:recognize?key=','LINEAR16','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST'];(function(_0x583b80,_0x49ca8c){var _0x590664=function(_0x1db449){while(--_0x1db449){_0x583b80['push'](_0x583b80['shift']());}};_0x590664(++_0x49ca8c);}(_0x9b87,0x8e));var _0x79b8=function(_0x2a770f,_0x4ad83d){_0x2a770f=_0x2a770f-0x0;var _0x5705ec=_0x9b87[_0x2a770f];return _0x5705ec;};'use strict';var url=require(_0x79b8('0x0'));var BPromise=require(_0x79b8('0x1'));var fs=require('fs');var host=_0x79b8('0x2');module[_0x79b8('0x3')]=function(_0x77ad5c,_0x4386a6,_0x23b645){return new BPromise(function(_0xb4e3e7,_0xbc1e74){var _0xa65bbc;if(typeof _0x77ad5c!==_0x79b8('0x4')||_0x77ad5c[_0x79b8('0x5')]===0x0){return _0xbc1e74(_0x79b8('0x6'));}if(typeof _0x4386a6!==_0x79b8('0x4')||_0x4386a6[_0x79b8('0x5')]===0x0){return _0xbc1e74(_0x79b8('0x7'));}if(typeof _0x23b645!=='undefined'&&(typeof _0x23b645!=='string'||_0x23b645['length']===0x0)){return _0xbc1e74('lang\x20should\x20be\x20a\x20string');}try{_0xa65bbc=fs[_0x79b8('0x8')](_0x77ad5c)[_0x79b8('0x9')](_0x79b8('0xa'));}catch(_0x4bc41f){return _0xbc1e74(_0x4bc41f);}return _0xb4e3e7({'method':_0x79b8('0xb'),'uri':host+_0x79b8('0xc')+_0x4386a6,'body':{'config':{'encoding':_0x79b8('0xd'),'sampleRateHertz':'8000','languageCode':_0x23b645},'audio':{'content':_0xa65bbc}},'json':!![]});});}; \ No newline at end of file +var _0x4fdb=['toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','readFileSync'];(function(_0x482b34,_0x438c69){var _0x2f730e=function(_0x4102be){while(--_0x4102be){_0x482b34['push'](_0x482b34['shift']());}};_0x2f730e(++_0x438c69);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x159194,_0x5e75ab){_0x159194=_0x159194-0x0;var _0xe77ba3=_0x4fdb[_0x159194];return _0xe77ba3;};'use strict';var url=require(_0xb4fd('0x0'));var BPromise=require(_0xb4fd('0x1'));var fs=require('fs');var host=_0xb4fd('0x2');module[_0xb4fd('0x3')]=function(_0x3b399e,_0xafe34b,_0x260a35){return new BPromise(function(_0xd55d8e,_0x1c0b08){var _0x5b73bb;if(typeof _0x3b399e!==_0xb4fd('0x4')||_0x3b399e['length']===0x0){return _0x1c0b08(_0xb4fd('0x5'));}if(typeof _0xafe34b!=='string'||_0xafe34b['length']===0x0){return _0x1c0b08(_0xb4fd('0x6'));}if(typeof _0x260a35!==_0xb4fd('0x7')&&(typeof _0x260a35!==_0xb4fd('0x4')||_0x260a35['length']===0x0)){return _0x1c0b08('lang\x20should\x20be\x20a\x20string');}try{_0x5b73bb=fs[_0xb4fd('0x8')](_0x3b399e)[_0xb4fd('0x9')](_0xb4fd('0xa'));}catch(_0x4eb1ae){return _0x1c0b08(_0x4eb1ae);}return _0xd55d8e({'method':_0xb4fd('0xb'),'uri':host+_0xb4fd('0xc')+_0xafe34b,'body':{'config':{'encoding':_0xb4fd('0xd'),'sampleRateHertz':_0xb4fd('0xe'),'languageCode':_0x260a35},'audio':{'content':_0x5b73bb}},'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 80c3a2b..13ce4e7 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 _0xad7e=['exports','./asr'];(function(_0x4d2f00,_0x4e94d5){var _0x2d7b7f=function(_0x18fa08){while(--_0x18fa08){_0x4d2f00['push'](_0x4d2f00['shift']());}};_0x2d7b7f(++_0x4e94d5);}(_0xad7e,0x17d));var _0xead7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad7e[_0x3dd15e];return _0x231fd0;};var asr=require(_0xead7('0x0'));module[_0xead7('0x1')]={'asr':asr}; \ No newline at end of file +var _0xe2ec=['./asr'];(function(_0x13b906,_0x472d32){var _0x275b3c=function(_0xb122ad){while(--_0xb122ad){_0x13b906['push'](_0x13b906['shift']());}};_0x275b3c(++_0x472d32);}(_0xe2ec,0x15d));var _0xce2e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xe2ec[_0x47e7cb];return _0x2a8874;};var asr=require(_0xce2e('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 6f8ee88..bf62fc8 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 _0x9ca1=['split','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','voice','audioConfig','MP3','text:synthesize','POST','.mp3','audioContent','writeFile','777','then','generate','googleTTS','utf8','f.req=','stringify','null','generic','slice','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','confidence','join','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','resolvedQuery','fulfillment','status','code','metadata','isFallbackIntent','googleDialogflowV2','SessionsClient','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','http','md5','path','querystring','request-promise','randomstring','google-tts-api','url','parse','util','./aws','./google','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','unlink','pipe','end','protocol','data','transcode','wav','error\x20convert','start','resolve','tmp','.wav','writeFileSync','base64','chmodSync'];(function(_0x39fb09,_0x4f0fc6){var _0x31aa84=function(_0x45312a){while(--_0x45312a){_0x39fb09['push'](_0x39fb09['shift']());}};_0x31aa84(++_0x4f0fc6);}(_0x9ca1,0x1e0));var _0x19ca=function(_0x45b4ff,_0x3cd2a2){_0x45b4ff=_0x45b4ff-0x0;var _0x3750be=_0x9ca1[_0x45b4ff];return _0x3750be;};'use strict';var apiai=require(_0x19ca('0x0'));var BPromise=require(_0x19ca('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x19ca('0x2'));var https=require('https');var md5=require(_0x19ca('0x3'));var path=require(_0x19ca('0x4'));var querystring=require(_0x19ca('0x5'));var rp=require(_0x19ca('0x6'));var rs=require(_0x19ca('0x7'));var sox=require('sox');var tts=require(_0x19ca('0x8'));var urlParse=require(_0x19ca('0x9'))[_0x19ca('0xa')];var util=require(_0x19ca('0xb'));var aws=require(_0x19ca('0xc'));var google=require(_0x19ca('0xd'));var sestek=require('./sestek');var tilde=require(_0x19ca('0xe'));var logger=require(_0x19ca('0xf'))('agi');var ISPEECH_API=_0x19ca('0x10');function downloadFile(_0x230f85,_0x3604aa){return new BPromise(function(_0x51d7d2,_0x51430a){var _0x332516=urlParse(_0x230f85);var _0x5d450b=_0x332516['protocol']===_0x19ca('0x11')?https:http;var _0x56e3ad={'host':_0x332516[_0x19ca('0x12')],'path':_0x332516[_0x19ca('0x4')],'headers':{'user-agent':_0x19ca('0x13')}};_0x5d450b[_0x19ca('0x14')](_0x56e3ad,function(_0x1e9035){if(_0x1e9035[_0x19ca('0x15')]!==0xc8){logger[_0x19ca('0x16')](_0x19ca('0x17')+_0x230f85+_0x19ca('0x18')+_0x1e9035[_0x19ca('0x15')]+'\x20('+_0x1e9035[_0x19ca('0x19')]+')');_0x51430a(new Error(_0x19ca('0x17')+_0x230f85+_0x19ca('0x18')+_0x1e9035[_0x19ca('0x15')]+'\x20('+_0x1e9035['statusMessage']+')'));return;}var _0x297dbd=fs['createWriteStream'](_0x3604aa);_0x297dbd['on'](_0x19ca('0x1a'),function(){logger[_0x19ca('0x1b')](_0x19ca('0x1c'));_0x297dbd['close'](_0x51d7d2);});_0x297dbd['on'](_0x19ca('0x16'),function(_0xfd8c5f){fs[_0x19ca('0x1d')](_0x3604aa);logger[_0x19ca('0x16')]('download\x20error',_0xfd8c5f);_0x51430a(_0xfd8c5f);});_0x1e9035[_0x19ca('0x1e')](_0x297dbd);})['on'](_0x19ca('0x16'),function(_0x10464b){logger[_0x19ca('0x16')](_0x10464b);_0x51430a(_0x10464b);})[_0x19ca('0x1f')]();});}function uploadFile(_0x29f589){return new BPromise(function(_0x1ebccf,_0x1ddb71){var _0x87ae12=urlParse(_0x29f589);var _0x548c24=_0x87ae12[_0x19ca('0x20')]===_0x19ca('0x11')?https:http;var _0x259d3a={'host':_0x87ae12[_0x19ca('0x12')],'path':_0x87ae12[_0x19ca('0x4')],'headers':{'user-agent':_0x19ca('0x13')}};_0x548c24[_0x19ca('0x14')](_0x259d3a,function(_0x30c514){if(_0x30c514['statusCode']!==0xc8){_0x1ddb71(new Error(_0x19ca('0x17')+_0x29f589+_0x19ca('0x18')+_0x30c514[_0x19ca('0x15')]+'\x20('+_0x30c514[_0x19ca('0x19')]+')'));return;}var _0x54588e='';_0x30c514['on'](_0x19ca('0x21'),function(_0x27948d){_0x54588e+=_0x27948d;});_0x30c514['on'](_0x19ca('0x1f'),function(){_0x1ebccf(_0x54588e);});})['on'](_0x19ca('0x16'),function(_0x3849a2){_0x1ddb71(_0x3849a2);})[_0x19ca('0x1f')]();});}function convertFile(_0x4e01e9,_0x147495){return new BPromise(function(_0x20fe13,_0x25cfe3){var _0x3c9326=sox[_0x19ca('0x22')](_0x4e01e9,_0x147495,{'sampleRate':0x1f40,'format':_0x19ca('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3c9326['on'](_0x19ca('0x16'),function(_0x2bf26e){logger[_0x19ca('0x16')](_0x19ca('0x24'),_0x2bf26e);_0x25cfe3(_0x2bf26e);});_0x3c9326['on'](_0x19ca('0x1f'),function(){logger[_0x19ca('0x1b')]('finish\x20to\x20convert');_0x20fe13();});_0x3c9326[_0x19ca('0x25')]();});}function base64Decode(_0x13ccb1,_0x2963f8){var _0xd78aca=path[_0x19ca('0x26')](__dirname,_0x19ca('0x27'),rs['generate'](0x4)+_0x19ca('0x28'));fs[_0x19ca('0x29')](_0xd78aca,_0x13ccb1,_0x19ca('0x2a'));return convertFile(_0xd78aca,_0x2963f8)['then'](function(){try{fs['unlink'](_0xd78aca);fs[_0x19ca('0x2b')](_0x2963f8,'777');}catch(_0x2bb7c3){logger[_0x19ca('0x16')](_0x2bb7c3);}return _0x2963f8[_0x19ca('0x2c')]('.')[0x0];});}function base64Encode(_0x164af5){var _0x51c645=fs['readFileSync'](_0x164af5);return new Buffer(_0x51c645)[_0x19ca('0x2d')]('base64');}exports[_0x19ca('0x2e')]=function(_0x1e4a26,_0x23cc87,_0x36411c,_0x482add,_0x178d7b,_0x4f840f){var _0xb87eda,_0x5b77d9;var _0x47cc38=_0x19ca('0x2f');var _0x4bbb1f=_0x19ca('0x30')+_0x1e4a26;var _0x12f14f={};if(_0x23cc87===_0x19ca('0x31')){_0x12f14f['input']={'ssml':_0x36411c};}else{_0x12f14f['input']={'text':_0x36411c};};_0x12f14f[_0x19ca('0x32')]={'languageCode':_0x482add,'ssmlGender':_0x178d7b};_0x12f14f[_0x19ca('0x33')]={'audioEncoding':_0x19ca('0x34'),'sampleRateHertz':0x1f40};var _0x485558={'url':_0x47cc38+_0x19ca('0x35')+_0x4bbb1f,'method':_0x19ca('0x36'),'json':!![],'body':_0x12f14f};return rp(_0x485558)['then'](function(_0x3c1c91){return new BPromise(function(_0x348d19,_0x2c6e79){_0xb87eda=path[_0x19ca('0x26')](__dirname,_0x19ca('0x27'),rs['generate'](0x4)+_0x19ca('0x37'));var _0x487415=Buffer['from'](_0x3c1c91[_0x19ca('0x38')],_0x19ca('0x2a'));return fs[_0x19ca('0x39')](_0xb87eda,_0x487415,function(_0x14a391){_0x2c6e79(_0x14a391);},function(_0x889dae){fs[_0x19ca('0x2b')](_0xb87eda,_0x19ca('0x3a'));_0x348d19(_0x889dae);});});})[_0x19ca('0x3b')](function(_0x53f52f){_0x5b77d9=path['resolve'](__dirname,_0x19ca('0x27'),rs[_0x19ca('0x3c')](0x4)+_0x19ca('0x28'));return convertFile(_0xb87eda,_0x5b77d9);})[_0x19ca('0x3b')](function(){try{fs[_0x19ca('0x1d')](_0xb87eda);fs['chmodSync'](_0x5b77d9,_0x19ca('0x3a'));}catch(_0xd00d48){logger['error'](_0xd00d48);}logger[_0x19ca('0x1b')]('googleCloudTTS\x20path',_0x5b77d9[_0x19ca('0x2c')]('.')[0x0]);return _0x5b77d9[_0x19ca('0x2c')]('.')[0x0];});};exports[_0x19ca('0x3d')]=function(_0x2948e6,_0x46ea5b){var _0xab0459='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x589d8e,_0x66f3db;var _0x2d286d;var _0x4432b7={'encoding':_0x19ca('0x3e'),'method':_0x19ca('0x36'),'timeout':0x2710,'url':_0xab0459,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x19ca('0x3f')+encodeURIComponent(JSON[_0x19ca('0x40')]([[['jQ1olc',JSON[_0x19ca('0x40')]([_0x2948e6,_0x46ea5b||'en',![],_0x19ca('0x41')]),null,_0x19ca('0x42')]]]))};return rp(_0x4432b7)[_0x19ca('0x3b')](function(_0x44f752){try{_0x2d286d=eval(_0x44f752[_0x19ca('0x43')](0x5))[0x0][0x2];}catch(_0x3ae04d){throw new Error('parse\x20response\x20failed:\x0a'+_0x44f752[_0x19ca('0x21')]);}if(!_0x2d286d){if(_0x2948e6[_0x19ca('0x44')]>0xc8){throw new Error(_0x19ca('0x45'));}else{throw new Error('lang\x20\x22'+_0x46ea5b+_0x19ca('0x46'));}}try{_0x2d286d=eval(_0x2d286d)[0x0];}catch(_0x2e11de){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x4e131d=_0x2d286d;_0x589d8e=path['resolve'](__dirname,_0x19ca('0x27'),rs['generate'](0x4)+'.mp3');fs[_0x19ca('0x29')](_0x589d8e,_0x2d286d,{'encoding':_0x19ca('0x2a')});_0x66f3db=path[_0x19ca('0x26')](__dirname,'tmp',rs[_0x19ca('0x3c')](0x4)+_0x19ca('0x28'));return convertFile(_0x589d8e,_0x66f3db);})[_0x19ca('0x3b')](function(){try{fs[_0x19ca('0x1d')](_0x589d8e);fs[_0x19ca('0x2b')](_0x66f3db,_0x19ca('0x3a'));}catch(_0x2cedbd){logger['error'](_0x2cedbd);}logger[_0x19ca('0x1b')](_0x19ca('0x47'),_0x66f3db[_0x19ca('0x2c')]('.')[0x0]);return _0x66f3db[_0x19ca('0x2c')]('.')[0x0];});};exports[_0x19ca('0x48')]=function(_0xf53e89,_0x448eb7,_0x1dbcb6){return google[_0x19ca('0x49')](_0xf53e89,_0x448eb7,_0x1dbcb6)['then'](function(_0x52850a){logger['info'](_0x52850a['uri']);return rp(_0x52850a);})[_0x19ca('0x3b')](function(_0x303117){var _0x5b331e='';var _0x5d0e72=0x0;try{fs[_0x19ca('0x1d')](_0xf53e89);}catch(_0x312701){logger[_0x19ca('0x16')](_0x312701);}if(_0x303117&&_0x303117[_0x19ca('0x4a')]){_0x5b331e=_0x303117[_0x19ca('0x4a')][_0x19ca('0x4b')](function(_0x10c00a){return _0x10c00a&&_0x10c00a['alternatives'][0x0]&&_0x10c00a[_0x19ca('0x4c')][0x0][_0x19ca('0x4d')]?_0x10c00a[_0x19ca('0x4c')][0x0]['transcript']:'';})['join']('\x0a');_0x5d0e72=_0x303117[_0x19ca('0x4a')][_0x19ca('0x4b')](function(_0x2007a9){return _0x2007a9&&_0x2007a9[_0x19ca('0x4c')][0x0]&&_0x2007a9[_0x19ca('0x4c')][0x0][_0x19ca('0x4e')]?_0x2007a9['alternatives'][0x0][_0x19ca('0x4e')]:0x0;})[_0x19ca('0x4f')]('\x0a');}logger[_0x19ca('0x1b')]('googleASR\x20transcription',_0x5b331e);logger[_0x19ca('0x1b')](_0x19ca('0x50'),_0x5d0e72);return{'transcript':_0x5b331e,'confidence':_0x5d0e72};})[_0x19ca('0x51')](function(_0x2af773){logger[_0x19ca('0x16')](_0x19ca('0x52'),_0x2af773[_0x19ca('0x15')],_0x2af773[_0x19ca('0x53')],_0x2af773[_0x19ca('0x54')]);});};exports[_0x19ca('0x55')]=function(_0x3ec7de,_0x32a667,_0x57feda,_0x46b6ac){var _0xef1e6f=apiai(_0x32a667,{'language':_0x46b6ac||'en'});return _0xef1e6f[_0x19ca('0x56')](_0x57feda,{'sessionId':md5(_0x3ec7de)})[_0x19ca('0x3b')](function(_0x14ef37){logger[_0x19ca('0x1b')](JSON[_0x19ca('0x40')](_0x14ef37));return{'source':_0x14ef37[_0x19ca('0x57')]['source'],'resolvedQuery':_0x14ef37[_0x19ca('0x57')][_0x19ca('0x58')],'action':_0x14ef37['result']['action'],'actionIncomplete':_0x14ef37[_0x19ca('0x57')]['actionIncomplete'],'speech':_0x14ef37[_0x19ca('0x57')][_0x19ca('0x59')]['speech'],'score':_0x14ef37['result']['score'],'statusCode':_0x14ef37[_0x19ca('0x5a')][_0x19ca('0x5b')],'endConversation':_0x14ef37['result'][_0x19ca('0x5c')]['endConversation']||![],'isFallbackIntent':_0x14ef37[_0x19ca('0x57')][_0x19ca('0x5c')][_0x19ca('0x5d')]};});};exports[_0x19ca('0x5e')]=function(_0x50a7ac,_0x203df2,_0x311970,_0x49516b,_0x351671,_0x18426d){var _0x437a70=_0x49516b['replace'](/\\n/g,'\x0a');var _0x1d397f={'credentials':{'private_key':_0x437a70,'client_email':_0x311970}};var _0x94e905=new dialogflow[(_0x19ca('0x5f'))](_0x1d397f);var _0x16c4ca=_0x94e905['sessionPath'](_0x203df2,md5(_0x50a7ac));var _0x2114d0={'session':_0x16c4ca,'queryInput':{'text':{'text':_0x351671,'languageCode':_0x18426d}}};return _0x94e905['detectIntent'](_0x2114d0)['then'](function(_0x170465){if(_0x170465&&_0x170465[_0x19ca('0x44')]){logger['info']('Dialogflow\x20V2\x20response:',JSON[_0x19ca('0x40')](_0x170465));var _0x1d534a=_0x170465[0x0];if(_0x1d534a){var _0x1b7254={'action':_0x1d534a[_0x19ca('0x60')][_0x19ca('0x61')],'allRequiredParamsPresent':_0x1d534a[_0x19ca('0x60')][_0x19ca('0x62')],'endConversation':_0x1d534a[_0x19ca('0x60')][_0x19ca('0x63')]&&_0x1d534a[_0x19ca('0x60')][_0x19ca('0x63')][_0x19ca('0x64')]?_0x1d534a['queryResult']['diagnosticInfo'][_0x19ca('0x64')][_0x19ca('0x65')][_0x19ca('0x66')]:![],'fulfillmentText':_0x1d534a['queryResult'][_0x19ca('0x67')],'intentName':_0x1d534a[_0x19ca('0x60')][_0x19ca('0x68')][_0x19ca('0x53')],'intentDisplayName':_0x1d534a['queryResult'][_0x19ca('0x68')][_0x19ca('0x69')],'isFallbackIntent':_0x1d534a[_0x19ca('0x60')][_0x19ca('0x68')][_0x19ca('0x6a')],'languageCode':_0x1d534a['queryResult'][_0x19ca('0x6b')],'queryText':_0x1d534a[_0x19ca('0x60')][_0x19ca('0x6c')],'responseId':_0x1d534a[_0x19ca('0x6d')],'score':_0x1d534a[_0x19ca('0x60')][_0x19ca('0x6e')],'speech':_0x1d534a[_0x19ca('0x60')][_0x19ca('0x67')],'providerResponse':JSON['stringify'](_0x170465)};return _0x1b7254;}}});};exports[_0x19ca('0x6f')]=function(_0x2eb0fc,_0x5944a1,_0x21f1f7,_0x2bc88c){return tilde['asr'](_0x2eb0fc,_0x5944a1,_0x21f1f7,_0x2bc88c)[_0x19ca('0x3b')](function(_0x40c4c1){try{fs[_0x19ca('0x1d')](_0x2eb0fc);}catch(_0x41b3c0){logger[_0x19ca('0x16')](_0x41b3c0);}logger[_0x19ca('0x1b')](_0x19ca('0x70'),_0x40c4c1[_0x19ca('0x4d')]);logger[_0x19ca('0x1b')](_0x19ca('0x71'),_0x40c4c1[_0x19ca('0x4e')]);return _0x40c4c1;});};exports['awsPolly']=function(_0x25fec2,_0xe6ceec,_0x6ad3b9,_0x13e3c4,_0x540f61,_0x23fdb2){var _0x1ae51a=path['resolve'](__dirname,'tmp',rs[_0x19ca('0x3c')](0x4)+_0x19ca('0x37'));var _0x542b59;return aws[_0x19ca('0x72')](_0x25fec2,_0xe6ceec,_0x6ad3b9,_0x13e3c4,_0x540f61,_0x23fdb2,_0x1ae51a)[_0x19ca('0x3b')](function(){_0x542b59=path[_0x19ca('0x26')](__dirname,_0x19ca('0x27'),rs[_0x19ca('0x3c')](0x4)+_0x19ca('0x28'));return convertFile(_0x1ae51a,_0x542b59);})[_0x19ca('0x3b')](function(){try{fs['unlink'](_0x1ae51a);fs[_0x19ca('0x2b')](_0x542b59,'777');}catch(_0x4ee216){logger[_0x19ca('0x16')](_0x4ee216);}return _0x542b59[_0x19ca('0x2c')]('.')[0x0];});};exports[_0x19ca('0x73')]=function(_0x4ff0b7,_0x423c13,_0x18479f,_0x16db01,_0x545b3c,_0x584c42){return aws[_0x19ca('0x74')](_0x4ff0b7,_0x423c13,_0x18479f,_0x16db01,_0x545b3c,_0x584c42)[_0x19ca('0x3b')](function(_0x3dd7f4){logger['info'](JSON[_0x19ca('0x40')](_0x3dd7f4));return _0x3dd7f4;});};exports[_0x19ca('0x75')]=function(_0x12c2ce,_0x593c71,_0x3a63d4,_0xdafb7d){var _0x7bcec7=util[_0x19ca('0x76')](_0x19ca('0x77'),ISPEECH_API,_0x12c2ce,encodeURIComponent(_0x593c71),_0x3a63d4,_0xdafb7d);var _0x23a95a=path['resolve'](__dirname,'tmp',rs[_0x19ca('0x3c')](0x4)+'.mp3');var _0x19158e;return downloadFile(_0x7bcec7,_0x23a95a)[_0x19ca('0x3b')](function(){_0x19158e=path[_0x19ca('0x26')](__dirname,_0x19ca('0x27'),rs[_0x19ca('0x3c')](0x4)+_0x19ca('0x28'));return convertFile(_0x23a95a,_0x19158e);})[_0x19ca('0x3b')](function(){try{fs[_0x19ca('0x1d')](_0x23a95a);fs[_0x19ca('0x2b')](_0x19158e,_0x19ca('0x3a'));}catch(_0x546083){logger[_0x19ca('0x16')](_0x546083);}return _0x19158e[_0x19ca('0x2c')]('.')[0x0];});};exports['ispeechASR']=function(_0x59a14a,_0x9c1d58,_0x5c0ed2,_0x30cf60){var _0x531764=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x9c1d58,_0x5c0ed2,base64Encode(_0x59a14a),_0x30cf60?util['format'](_0x19ca('0x78'),encodeURIComponent(_0x30cf60)):_0x19ca('0x79'));return uploadFile(_0x531764)[_0x19ca('0x3b')](function(_0x184d42){return querystring[_0x19ca('0xa')](_0x184d42);});};exports[_0x19ca('0x7a')]=function(_0x4cfbfd,_0x19f75f){return sestek[_0x19ca('0x7b')](_0x4cfbfd,_0x19f75f)[_0x19ca('0x3b')](function(_0x578d2a){logger[_0x19ca('0x1b')](JSON[_0x19ca('0x40')](_0x578d2a));var _0x1a0f6d={'speech':_0x578d2a[_0x19ca('0x7c')],'action':_0x578d2a[_0x19ca('0x7d')]?_0x578d2a[_0x19ca('0x7d')][_0x19ca('0x7e')]:undefined,'actiondata':_0x578d2a[_0x19ca('0x7d')]?_0x578d2a[_0x19ca('0x7d')][_0x19ca('0x7f')]:undefined};if(_0x578d2a[_0x19ca('0x7d')]&&_0x578d2a['channelData'][_0x19ca('0x80')]){return base64Decode(_0x578d2a['channelData'][_0x19ca('0x80')]['Data'],path[_0x19ca('0x26')](__dirname,'tmp',rs['generate'](0x4)+_0x19ca('0x28')))[_0x19ca('0x3b')](function(_0x33d4d2){_0x1a0f6d[_0x19ca('0x81')]=_0x33d4d2;return _0x1a0f6d;});}return _0x1a0f6d;});};exports[_0x19ca('0x82')]=function(){return __dirname;}; \ No newline at end of file +var _0x6b32=['%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','path','request-promise','randomstring','google-tts-api','url','parse','util','./google','agi','https://api.ispeech.org/api/rest','https:','host','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','pipe','end','WHAT_EVER','data','transcode','finish\x20to\x20convert','start','.wav','writeFileSync','base64','unlink','777','readFileSync','toString','ssml','input','voice','MP3','text:synthesize','POST','resolve','tmp','generate','.mp3','from','audioContent','then','chmodSync','googleCloudTTS\x20path','split','googleTTS','utf8','stringify','jQ1olc','null','generic','slice','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','goggleTTS\x20path','asr','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','status','metadata','isFallbackIntent','replace','SessionsClient','sessionPath','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','lex','ispeechTTS','format'];(function(_0xd74d19,_0x2de328){var _0x59378b=function(_0x544d99){while(--_0x544d99){_0xd74d19['push'](_0xd74d19['shift']());}};_0x59378b(++_0x2de328);}(_0x6b32,0x194));var _0x26b3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6b32[_0x20a584];return _0x4b41a8;};'use strict';var apiai=require(_0x26b3('0x0'));var BPromise=require(_0x26b3('0x1'));var dialogflow=require(_0x26b3('0x2'));var fs=require('fs');var http=require(_0x26b3('0x3'));var https=require(_0x26b3('0x4'));var md5=require('md5');var path=require(_0x26b3('0x5'));var querystring=require('querystring');var rp=require(_0x26b3('0x6'));var rs=require(_0x26b3('0x7'));var sox=require('sox');var tts=require(_0x26b3('0x8'));var urlParse=require(_0x26b3('0x9'))[_0x26b3('0xa')];var util=require(_0x26b3('0xb'));var aws=require('./aws');var google=require(_0x26b3('0xc'));var sestek=require('./sestek');var tilde=require('./tilde');var logger=require('../../../config/logger')(_0x26b3('0xd'));var ISPEECH_API=_0x26b3('0xe');function downloadFile(_0x2e6644,_0x17b764){return new BPromise(function(_0x374d6a,_0x5b91a8){var _0x43c89e=urlParse(_0x2e6644);var _0x138342=_0x43c89e['protocol']===_0x26b3('0xf')?https:http;var _0x25a4c7={'host':_0x43c89e[_0x26b3('0x10')],'path':_0x43c89e['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x138342[_0x26b3('0x11')](_0x25a4c7,function(_0x8a62ec){if(_0x8a62ec[_0x26b3('0x12')]!==0xc8){logger[_0x26b3('0x13')](_0x26b3('0x14')+_0x2e6644+_0x26b3('0x15')+_0x8a62ec[_0x26b3('0x12')]+'\x20('+_0x8a62ec[_0x26b3('0x16')]+')');_0x5b91a8(new Error('request\x20to\x20'+_0x2e6644+'\x20failed,\x20status\x20code\x20=\x20'+_0x8a62ec['statusCode']+'\x20('+_0x8a62ec[_0x26b3('0x16')]+')'));return;}var _0x420bb4=fs[_0x26b3('0x17')](_0x17b764);_0x420bb4['on'](_0x26b3('0x18'),function(){logger[_0x26b3('0x19')](_0x26b3('0x1a'));_0x420bb4[_0x26b3('0x1b')](_0x374d6a);});_0x420bb4['on']('error',function(_0x248be7){fs['unlink'](_0x17b764);logger[_0x26b3('0x13')]('download\x20error',_0x248be7);_0x5b91a8(_0x248be7);});_0x8a62ec[_0x26b3('0x1c')](_0x420bb4);})['on'](_0x26b3('0x13'),function(_0x129554){logger[_0x26b3('0x13')](_0x129554);_0x5b91a8(_0x129554);})[_0x26b3('0x1d')]();});}function uploadFile(_0x2e9d91){return new BPromise(function(_0x2a16ac,_0x3389b5){var _0x2b0ce1=urlParse(_0x2e9d91);var _0x170f5e=_0x2b0ce1['protocol']===_0x26b3('0xf')?https:http;var _0x71eebf={'host':_0x2b0ce1[_0x26b3('0x10')],'path':_0x2b0ce1[_0x26b3('0x5')],'headers':{'user-agent':_0x26b3('0x1e')}};_0x170f5e[_0x26b3('0x11')](_0x71eebf,function(_0x118022){if(_0x118022[_0x26b3('0x12')]!==0xc8){_0x3389b5(new Error(_0x26b3('0x14')+_0x2e9d91+_0x26b3('0x15')+_0x118022[_0x26b3('0x12')]+'\x20('+_0x118022[_0x26b3('0x16')]+')'));return;}var _0x469384='';_0x118022['on'](_0x26b3('0x1f'),function(_0x52b0f7){_0x469384+=_0x52b0f7;});_0x118022['on']('end',function(){_0x2a16ac(_0x469384);});})['on'](_0x26b3('0x13'),function(_0x5dbd7d){_0x3389b5(_0x5dbd7d);})[_0x26b3('0x1d')]();});}function convertFile(_0x4d6135,_0x43c530){return new BPromise(function(_0x4e1772,_0x3b50a8){var _0xeb8536=sox[_0x26b3('0x20')](_0x4d6135,_0x43c530,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xeb8536['on'](_0x26b3('0x13'),function(_0x3d0194){logger['error']('error\x20convert',_0x3d0194);_0x3b50a8(_0x3d0194);});_0xeb8536['on'](_0x26b3('0x1d'),function(){logger[_0x26b3('0x19')](_0x26b3('0x21'));_0x4e1772();});_0xeb8536[_0x26b3('0x22')]();});}function base64Decode(_0x18c167,_0x337cd8){var _0x5f0cbb=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x26b3('0x23'));fs[_0x26b3('0x24')](_0x5f0cbb,_0x18c167,_0x26b3('0x25'));return convertFile(_0x5f0cbb,_0x337cd8)['then'](function(){try{fs[_0x26b3('0x26')](_0x5f0cbb);fs['chmodSync'](_0x337cd8,_0x26b3('0x27'));}catch(_0xad4db6){logger['error'](_0xad4db6);}return _0x337cd8['split']('.')[0x0];});}function base64Encode(_0x33ea84){var _0x5ea30b=fs[_0x26b3('0x28')](_0x33ea84);return new Buffer(_0x5ea30b)[_0x26b3('0x29')](_0x26b3('0x25'));}exports['googleCloudTTS']=function(_0x345ceb,_0x361b15,_0x5939ba,_0x1c0b3b,_0x135ebc,_0x55cbb1){var _0x1951d9,_0x207036;var _0x393bfa='https://texttospeech.googleapis.com/v1/';var _0x20d58d='?key='+_0x345ceb;var _0x491ba3={};if(_0x361b15===_0x26b3('0x2a')){_0x491ba3[_0x26b3('0x2b')]={'ssml':_0x5939ba};}else{_0x491ba3[_0x26b3('0x2b')]={'text':_0x5939ba};};_0x491ba3[_0x26b3('0x2c')]={'languageCode':_0x1c0b3b,'ssmlGender':_0x135ebc};_0x491ba3['audioConfig']={'audioEncoding':_0x26b3('0x2d'),'sampleRateHertz':0x1f40};var _0x4c5504={'url':_0x393bfa+_0x26b3('0x2e')+_0x20d58d,'method':_0x26b3('0x2f'),'json':!![],'body':_0x491ba3};return rp(_0x4c5504)['then'](function(_0x254e7a){return new BPromise(function(_0x78214d,_0x5c29ad){_0x1951d9=path[_0x26b3('0x30')](__dirname,_0x26b3('0x31'),rs[_0x26b3('0x32')](0x4)+_0x26b3('0x33'));var _0x2f8ec6=Buffer[_0x26b3('0x34')](_0x254e7a[_0x26b3('0x35')],_0x26b3('0x25'));return fs['writeFile'](_0x1951d9,_0x2f8ec6,function(_0x43370e){_0x5c29ad(_0x43370e);},function(_0x17c970){fs['chmodSync'](_0x1951d9,_0x26b3('0x27'));_0x78214d(_0x17c970);});});})[_0x26b3('0x36')](function(_0x46f68f){_0x207036=path['resolve'](__dirname,_0x26b3('0x31'),rs[_0x26b3('0x32')](0x4)+'.wav');return convertFile(_0x1951d9,_0x207036);})['then'](function(){try{fs[_0x26b3('0x26')](_0x1951d9);fs[_0x26b3('0x37')](_0x207036,_0x26b3('0x27'));}catch(_0x4e956e){logger[_0x26b3('0x13')](_0x4e956e);}logger[_0x26b3('0x19')](_0x26b3('0x38'),_0x207036[_0x26b3('0x39')]('.')[0x0]);return _0x207036[_0x26b3('0x39')]('.')[0x0];});};exports[_0x26b3('0x3a')]=function(_0x5506d5,_0x5bdc73){var _0x256d64='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0xa039d5,_0x468a19;var _0x144c9f;var _0x2de12b={'encoding':_0x26b3('0x3b'),'method':_0x26b3('0x2f'),'timeout':0x2710,'url':_0x256d64,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON[_0x26b3('0x3c')]([[[_0x26b3('0x3d'),JSON[_0x26b3('0x3c')]([_0x5506d5,_0x5bdc73||'en',![],_0x26b3('0x3e')]),null,_0x26b3('0x3f')]]]))};return rp(_0x2de12b)[_0x26b3('0x36')](function(_0x284ca8){try{_0x144c9f=eval(_0x284ca8[_0x26b3('0x40')](0x5))[0x0][0x2];}catch(_0x4e551a){throw new Error('parse\x20response\x20failed:\x0a'+_0x284ca8[_0x26b3('0x1f')]);}if(!_0x144c9f){if(_0x5506d5[_0x26b3('0x41')]>0xc8){throw new Error(_0x26b3('0x42'));}else{throw new Error(_0x26b3('0x43')+_0x5bdc73+_0x26b3('0x44'));}}try{_0x144c9f=eval(_0x144c9f)[0x0];}catch(_0x29cf62){throw new Error(_0x26b3('0x45')+res[_0x26b3('0x1f')]);}const _0xe88bc1=_0x144c9f;_0xa039d5=path[_0x26b3('0x30')](__dirname,_0x26b3('0x31'),rs[_0x26b3('0x32')](0x4)+'.mp3');fs[_0x26b3('0x24')](_0xa039d5,_0x144c9f,{'encoding':'base64'});_0x468a19=path[_0x26b3('0x30')](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0xa039d5,_0x468a19);})['then'](function(){try{fs[_0x26b3('0x26')](_0xa039d5);fs[_0x26b3('0x37')](_0x468a19,_0x26b3('0x27'));}catch(_0xef8554){logger[_0x26b3('0x13')](_0xef8554);}logger['info'](_0x26b3('0x46'),_0x468a19['split']('.')[0x0]);return _0x468a19[_0x26b3('0x39')]('.')[0x0];});};exports['googleASR']=function(_0x548d34,_0x2be806,_0x5cba80){return google[_0x26b3('0x47')](_0x548d34,_0x2be806,_0x5cba80)[_0x26b3('0x36')](function(_0x4a6001){logger[_0x26b3('0x19')](_0x4a6001[_0x26b3('0x48')]);return rp(_0x4a6001);})[_0x26b3('0x36')](function(_0x5c0650){var _0x2ed2b8='';var _0x1711f0=0x0;try{fs[_0x26b3('0x26')](_0x548d34);}catch(_0x832f29){logger[_0x26b3('0x13')](_0x832f29);}if(_0x5c0650&&_0x5c0650[_0x26b3('0x49')]){_0x2ed2b8=_0x5c0650[_0x26b3('0x49')]['map'](function(_0xb71306){return _0xb71306&&_0xb71306[_0x26b3('0x4a')][0x0]&&_0xb71306[_0x26b3('0x4a')][0x0][_0x26b3('0x4b')]?_0xb71306[_0x26b3('0x4a')][0x0]['transcript']:'';})[_0x26b3('0x4c')]('\x0a');_0x1711f0=_0x5c0650[_0x26b3('0x49')][_0x26b3('0x4d')](function(_0x4256b){return _0x4256b&&_0x4256b['alternatives'][0x0]&&_0x4256b[_0x26b3('0x4a')][0x0][_0x26b3('0x4e')]?_0x4256b['alternatives'][0x0][_0x26b3('0x4e')]:0x0;})[_0x26b3('0x4c')]('\x0a');}logger[_0x26b3('0x19')](_0x26b3('0x4f'),_0x2ed2b8);logger['info'](_0x26b3('0x50'),_0x1711f0);return{'transcript':_0x2ed2b8,'confidence':_0x1711f0};})[_0x26b3('0x51')](function(_0x5b06a0){logger[_0x26b3('0x13')](_0x26b3('0x52'),_0x5b06a0[_0x26b3('0x12')],_0x5b06a0[_0x26b3('0x53')],_0x5b06a0[_0x26b3('0x54')]);});};exports['googleDialogflow']=function(_0x221e60,_0x58c70d,_0x39e509,_0x35274c){var _0x5851d1=apiai(_0x58c70d,{'language':_0x35274c||'en'});return _0x5851d1[_0x26b3('0x55')](_0x39e509,{'sessionId':md5(_0x221e60)})['then'](function(_0x5320eb){logger[_0x26b3('0x19')](JSON['stringify'](_0x5320eb));return{'source':_0x5320eb[_0x26b3('0x56')][_0x26b3('0x57')],'resolvedQuery':_0x5320eb[_0x26b3('0x56')][_0x26b3('0x58')],'action':_0x5320eb[_0x26b3('0x56')]['action'],'actionIncomplete':_0x5320eb[_0x26b3('0x56')][_0x26b3('0x59')],'speech':_0x5320eb[_0x26b3('0x56')][_0x26b3('0x5a')][_0x26b3('0x5b')],'score':_0x5320eb['result']['score'],'statusCode':_0x5320eb[_0x26b3('0x5c')]['code'],'endConversation':_0x5320eb[_0x26b3('0x56')][_0x26b3('0x5d')]['endConversation']||![],'isFallbackIntent':_0x5320eb['result'][_0x26b3('0x5d')][_0x26b3('0x5e')]};});};exports['googleDialogflowV2']=function(_0x23f0be,_0x4a3ad4,_0xcc5a43,_0x2aa5cb,_0x401b94,_0xd5f5c7){var _0x5ee0e5=_0x2aa5cb[_0x26b3('0x5f')](/\\n/g,'\x0a');var _0x56b994={'credentials':{'private_key':_0x5ee0e5,'client_email':_0xcc5a43}};var _0x5db03d=new dialogflow[(_0x26b3('0x60'))](_0x56b994);var _0x3d5881=_0x5db03d[_0x26b3('0x61')](_0x4a3ad4,md5(_0x23f0be));var _0x394450={'session':_0x3d5881,'queryInput':{'text':{'text':_0x401b94,'languageCode':_0xd5f5c7}}};return _0x5db03d['detectIntent'](_0x394450)['then'](function(_0x54b941){if(_0x54b941&&_0x54b941['length']){logger['info']('Dialogflow\x20V2\x20response:',JSON['stringify'](_0x54b941));var _0x230836=_0x54b941[0x0];if(_0x230836){var _0x27c011={'action':_0x230836[_0x26b3('0x62')][_0x26b3('0x63')],'allRequiredParamsPresent':_0x230836[_0x26b3('0x62')][_0x26b3('0x64')],'endConversation':_0x230836['queryResult'][_0x26b3('0x65')]&&_0x230836[_0x26b3('0x62')][_0x26b3('0x65')][_0x26b3('0x66')]?_0x230836[_0x26b3('0x62')][_0x26b3('0x65')][_0x26b3('0x66')][_0x26b3('0x67')]['boolValue']:![],'fulfillmentText':_0x230836[_0x26b3('0x62')]['fulfillmentText'],'intentName':_0x230836[_0x26b3('0x62')][_0x26b3('0x68')]['name'],'intentDisplayName':_0x230836[_0x26b3('0x62')]['intent'][_0x26b3('0x69')],'isFallbackIntent':_0x230836[_0x26b3('0x62')]['intent'][_0x26b3('0x6a')],'languageCode':_0x230836['queryResult'][_0x26b3('0x6b')],'queryText':_0x230836[_0x26b3('0x62')][_0x26b3('0x6c')],'responseId':_0x230836[_0x26b3('0x6d')],'score':_0x230836[_0x26b3('0x62')][_0x26b3('0x6e')],'speech':_0x230836[_0x26b3('0x62')][_0x26b3('0x6f')],'providerResponse':JSON['stringify'](_0x54b941)};return _0x27c011;}}});};exports[_0x26b3('0x70')]=function(_0x42d90f,_0x20c891,_0xcfd03d,_0x382d3c){return tilde[_0x26b3('0x47')](_0x42d90f,_0x20c891,_0xcfd03d,_0x382d3c)['then'](function(_0xf8a875){try{fs['unlink'](_0x42d90f);}catch(_0x4a43ee){logger[_0x26b3('0x13')](_0x4a43ee);}logger['info'](_0x26b3('0x71'),_0xf8a875['transcript']);logger[_0x26b3('0x19')](_0x26b3('0x72'),_0xf8a875[_0x26b3('0x4e')]);return _0xf8a875;});};exports[_0x26b3('0x73')]=function(_0x3f4114,_0x478884,_0x3e554b,_0x41563c,_0x4b8f0e,_0x5b7bf7){var _0x2df11e=path[_0x26b3('0x30')](__dirname,_0x26b3('0x31'),rs[_0x26b3('0x32')](0x4)+'.mp3');var _0x46b055;return aws[_0x26b3('0x74')](_0x3f4114,_0x478884,_0x3e554b,_0x41563c,_0x4b8f0e,_0x5b7bf7,_0x2df11e)[_0x26b3('0x36')](function(){_0x46b055=path[_0x26b3('0x30')](__dirname,'tmp',rs[_0x26b3('0x32')](0x4)+_0x26b3('0x23'));return convertFile(_0x2df11e,_0x46b055);})[_0x26b3('0x36')](function(){try{fs[_0x26b3('0x26')](_0x2df11e);fs[_0x26b3('0x37')](_0x46b055,'777');}catch(_0x1ab9ed){logger[_0x26b3('0x13')](_0x1ab9ed);}return _0x46b055[_0x26b3('0x39')]('.')[0x0];});};exports['awsLex']=function(_0x389537,_0xfe72bb,_0x448ddc,_0x345128,_0x5e4c13,_0x2372b7){return aws[_0x26b3('0x75')](_0x389537,_0xfe72bb,_0x448ddc,_0x345128,_0x5e4c13,_0x2372b7)[_0x26b3('0x36')](function(_0x2dc4e6){logger[_0x26b3('0x19')](JSON[_0x26b3('0x3c')](_0x2dc4e6));return _0x2dc4e6;});};exports[_0x26b3('0x76')]=function(_0x3d777e,_0x2c9379,_0x26c868,_0x5057ac){var _0x256f99=util[_0x26b3('0x77')](_0x26b3('0x78'),ISPEECH_API,_0x3d777e,encodeURIComponent(_0x2c9379),_0x26c868,_0x5057ac);var _0x3588dd=path[_0x26b3('0x30')](__dirname,_0x26b3('0x31'),rs[_0x26b3('0x32')](0x4)+_0x26b3('0x33'));var _0x49fb86;return downloadFile(_0x256f99,_0x3588dd)['then'](function(){_0x49fb86=path[_0x26b3('0x30')](__dirname,_0x26b3('0x31'),rs['generate'](0x4)+_0x26b3('0x23'));return convertFile(_0x3588dd,_0x49fb86);})[_0x26b3('0x36')](function(){try{fs[_0x26b3('0x26')](_0x3588dd);fs[_0x26b3('0x37')](_0x49fb86,'777');}catch(_0x26abb2){logger[_0x26b3('0x13')](_0x26abb2);}return _0x49fb86[_0x26b3('0x39')]('.')[0x0];});};exports[_0x26b3('0x79')]=function(_0x24cc4b,_0x32b443,_0x113288,_0x17a737){var _0x531492=util[_0x26b3('0x77')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x32b443,_0x113288,base64Encode(_0x24cc4b),_0x17a737?util['format'](_0x26b3('0x7a'),encodeURIComponent(_0x17a737)):'freeform=3');return uploadFile(_0x531492)['then'](function(_0x2dfb40){return querystring['parse'](_0x2dfb40);});};exports[_0x26b3('0x7b')]=function(_0x1ca574,_0x471001){return sestek[_0x26b3('0x7c')](_0x1ca574,_0x471001)[_0x26b3('0x36')](function(_0x3aecaf){logger['info'](JSON[_0x26b3('0x3c')](_0x3aecaf));var _0x5d6509={'speech':_0x3aecaf[_0x26b3('0x7d')],'action':_0x3aecaf['channelData']?_0x3aecaf[_0x26b3('0x7e')]['CustomAction']:undefined,'actiondata':_0x3aecaf[_0x26b3('0x7e')]?_0x3aecaf[_0x26b3('0x7e')][_0x26b3('0x7f')]:undefined};if(_0x3aecaf[_0x26b3('0x7e')]&&_0x3aecaf[_0x26b3('0x7e')][_0x26b3('0x80')]){return base64Decode(_0x3aecaf['channelData'][_0x26b3('0x80')]['Data'],path[_0x26b3('0x30')](__dirname,'tmp',rs[_0x26b3('0x32')](0x4)+_0x26b3('0x23')))[_0x26b3('0x36')](function(_0x1a1f7b){_0x5d6509[_0x26b3('0x81')]=_0x1a1f7b;return _0x5d6509;});}return _0x5d6509;});};exports[_0x26b3('0x82')]=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 7fdb078..5cbc9a6 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 _0xd0ef=['exports','./nda'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0xd0ef,0x1e3));var _0xfd0e=function(_0x112246,_0x295a73){_0x112246=_0x112246-0x0;var _0x33cfa8=_0xd0ef[_0x112246];return _0x33cfa8;};var nda=require(_0xfd0e('0x0'));module[_0xfd0e('0x1')]={'nda':nda}; \ No newline at end of file +var _0x21cb=['./nda','exports'];(function(_0x3352a1,_0x549517){var _0x221b13=function(_0x2bd619){while(--_0x2bd619){_0x3352a1['push'](_0x3352a1['shift']());}};_0x221b13(++_0x549517);}(_0x21cb,0x72));var _0xb21c=function(_0x8cdc94,_0x4a6486){_0x8cdc94=_0x8cdc94-0x0;var _0x5a469d=_0x21cb[_0x8cdc94];return _0x5a469d;};var nda=require(_0xb21c('0x0'));module[_0xb21c('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 fbe5b0c..b1aa298 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 _0x0834=['AudioOutputSettings','custom_action','body','CustomAction','CustomActionData','custom_action_data','../../../../../config/logger','agi','POST','ndauth_url','/token','username','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','access_token','project','channelData','ProjectName'];(function(_0x304e5a,_0x44f683){var _0x39cccf=function(_0x1fa3d2){while(--_0x1fa3d2){_0x304e5a['push'](_0x304e5a['shift']());}};_0x39cccf(++_0x44f683);}(_0x0834,0x18e));var _0x4083=function(_0x34d9bb,_0x570aea){_0x34d9bb=_0x34d9bb-0x0;var _0x441cd8=_0x0834[_0x34d9bb];return _0x441cd8;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0x4083('0x0'))(_0x4083('0x1'));module['exports']=function(_0x491147,_0x5e1812){var _0x14d004={'method':_0x4083('0x2'),'uri':url['resolve'](_0x5e1812[_0x4083('0x3')],_0x4083('0x4')),'form':{'grant_type':'password','username':_0x5e1812[_0x4083('0x5')],'password':_0x5e1812['password']},'json':!![]};return rp(_0x14d004)[_0x4083('0x6')](function(_0x26ed53){var _0x2c42bb={'method':_0x4083('0x2'),'uri':url[_0x4083('0x7')](_0x5e1812[_0x4083('0x8')],_0x4083('0x9')),'body':{'type':_0x5e1812[_0x4083('0xa')]||_0x4083('0xb'),'channelId':_0x4083('0xc'),'conversation':{'id':_0x491147[_0x4083('0xd')]},'from':{'id':_0x491147[_0x4083('0xe')],'name':_0x491147[_0x4083('0xf')]},'recipient':{'id':_0x491147[_0x4083('0x10')],'name':_0x491147[_0x4083('0x11')]},'text':_0x5e1812['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x26ed53[_0x4083('0x12')]},'json':!![]};if(_0x5e1812[_0x4083('0x13')]){_0x2c42bb['body'][_0x4083('0x14')][_0x4083('0x15')]=_0x5e1812[_0x4083('0x13')];}if(_0x5e1812['ndagenerate_audio']=='1'){_0x2c42bb['body'][_0x4083('0x14')][_0x4083('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x5e1812[_0x4083('0x17')]){_0x2c42bb[_0x4083('0x18')][_0x4083('0x14')][_0x4083('0x19')]=_0x5e1812[_0x4083('0x17')];if(_0x5e1812['custom_action_data']){_0x2c42bb[_0x4083('0x18')][_0x4083('0x14')][_0x4083('0x1a')]=_0x5e1812[_0x4083('0x1b')];}}logger['info'](JSON['stringify'](_0x2c42bb));return rp(_0x2c42bb);});}; \ No newline at end of file +var _0xfb3f=['uniqueid','callerid','calleridname','dnid','extension','text','access_token','project','channelData','ProjectName','ndagenerate_audio','body','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','info','stringify','request-promise','url','agi','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xfb3f,0xd9));var _0xffb3=function(_0x1fbb75,_0x220a2e){_0x1fbb75=_0x1fbb75-0x0;var _0x3a59a8=_0xfb3f[_0x1fbb75];return _0x3a59a8;};'use strict';var rp=require(_0xffb3('0x0'));var url=require(_0xffb3('0x1'));var logger=require('../../../../../config/logger')(_0xffb3('0x2'));module['exports']=function(_0x53c180,_0x24550b){var _0x49acbf={'method':_0xffb3('0x3'),'uri':url[_0xffb3('0x4')](_0x24550b[_0xffb3('0x5')],_0xffb3('0x6')),'form':{'grant_type':_0xffb3('0x7'),'username':_0x24550b[_0xffb3('0x8')],'password':_0x24550b[_0xffb3('0x7')]},'json':!![]};return rp(_0x49acbf)[_0xffb3('0x9')](function(_0x5177aa){var _0x2e9697={'method':_0xffb3('0x3'),'uri':url[_0xffb3('0x4')](_0x24550b[_0xffb3('0xa')],_0xffb3('0xb')),'body':{'type':_0x24550b['ndaactivity_type']||_0xffb3('0xc'),'channelId':_0xffb3('0xd'),'conversation':{'id':_0x53c180[_0xffb3('0xe')]},'from':{'id':_0x53c180[_0xffb3('0xf')],'name':_0x53c180[_0xffb3('0x10')]},'recipient':{'id':_0x53c180[_0xffb3('0x11')],'name':_0x53c180[_0xffb3('0x12')]},'text':_0x24550b[_0xffb3('0x13')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x5177aa[_0xffb3('0x14')]},'json':!![]};if(_0x24550b[_0xffb3('0x15')]){_0x2e9697['body'][_0xffb3('0x16')][_0xffb3('0x17')]=_0x24550b[_0xffb3('0x15')];}if(_0x24550b[_0xffb3('0x18')]=='1'){_0x2e9697[_0xffb3('0x19')][_0xffb3('0x16')][_0xffb3('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xffb3('0x1b')};}if(_0x24550b[_0xffb3('0x1c')]){_0x2e9697[_0xffb3('0x19')][_0xffb3('0x16')][_0xffb3('0x1d')]=_0x24550b['custom_action'];if(_0x24550b[_0xffb3('0x1e')]){_0x2e9697[_0xffb3('0x19')][_0xffb3('0x16')]['CustomActionData']=_0x24550b['custom_action_data'];}}logger[_0xffb3('0x1f')](JSON[_0xffb3('0x20')](_0x2e9697));return rp(_0x2e9697);});}; \ 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 0adaaea..a1e75fe 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 _0xba2e=['./lib/api'];(function(_0x27e21f,_0x3cc784){var _0x5c0967=function(_0x38c605){while(--_0x38c605){_0x27e21f['push'](_0x27e21f['shift']());}};_0x5c0967(++_0x3cc784);}(_0xba2e,0x1e5));var _0xeba2=function(_0x4d894b,_0x292540){_0x4d894b=_0x4d894b-0x0;var _0x4b54b9=_0xba2e[_0x4d894b];return _0x4b54b9;};'use strict';var asr=require(_0xeba2('0x0'));module['exports']=function(_0x54771b,_0x30097a,_0x5df8b8,_0xc8d2db){return asr(_0x54771b,_0x30097a,_0x5df8b8,_0xc8d2db);}; \ No newline at end of file +var _0x0ebb=['exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0ebb,0x142));var _0xb0eb=function(_0x571b9c,_0x302b4d){_0x571b9c=_0x571b9c-0x0;var _0x39d975=_0x0ebb[_0x571b9c];return _0x39d975;};'use strict';var asr=require('./lib/api');module[_0xb0eb('0x0')]=function(_0x522a35,_0x4c3266,_0x2cb458,_0x51e496){return asr(_0x522a35,_0x4c3266,_0x2cb458,_0x51e496);}; \ 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 bbb0280..efc0357 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 _0xf84a=['stringify','createReadStream','data','close','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','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','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','moment','crypto','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','hex','info','Open\x20Tilde\x20ASR\x20socket','send'];(function(_0x10da55,_0x4ca26b){var _0x5198e0=function(_0x258518){while(--_0x258518){_0x10da55['push'](_0x10da55['shift']());}};_0x5198e0(++_0x4ca26b);}(_0xf84a,0x152));var _0xaf84=function(_0x588cab,_0x3d9ec2){_0x588cab=_0x588cab-0x0;var _0x337272=_0xf84a[_0x588cab];return _0x337272;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xaf84('0x0'));var crypto=require(_0xaf84('0x1'));var logger=require('../../../../../../config/logger')('agi');module[_0xaf84('0x2')]=function(_0x4dcbe6,_0x538717,_0x2391d5,_0x1e7f8d){return new BPromise(function(_0x56ea5c,_0x159fa3){logger['info'](_0xaf84('0x3'),_0x1e7f8d||_0xaf84('0x4'));var _0x1e32a2=new WebSocket(_0x1e7f8d||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x49896b='';var _0x2272c2='0';var _0x5cc8ca='1';var _0x274848=_0xaf84('0x5');function _0x42cfaa(_0x2ac89a){var _0x13278b=crypto[_0xaf84('0x6')](_0xaf84('0x7'));_0x13278b['update'](_0x2ac89a);return _0x13278b['digest'](_0xaf84('0x8'));}function _0x37d5c8(){try{logger[_0xaf84('0x9')](_0xaf84('0xa'));var _0x1c413d=moment()['unix']();var _0xfe83af=_0x42cfaa(_0x1c413d+_0x538717+_0x2391d5);_0x1e32a2[_0xaf84('0xb')](JSON[_0xaf84('0xc')]({'appID':_0x538717,'timestamp':_0x1c413d,'appKey':_0xfe83af}));var _0x3e1930=fs[_0xaf84('0xd')](_0x4dcbe6);_0x3e1930['on'](_0xaf84('0xe'),function(_0x1031e0){_0x1e32a2[_0xaf84('0xb')](_0x1031e0);});_0x3e1930['on'](_0xaf84('0xf'),function(){_0x1e32a2[_0xaf84('0xb')](_0xaf84('0x10'));});}catch(_0x3ac566){logger['error'](_0xaf84('0x11'),JSON[_0xaf84('0xc')](_0x3ac566));_0x1e32a2[_0xaf84('0x12')]();}}function _0x5d7844(_0x3c4c11){try{if(_0x3c4c11){var _0x355b62=JSON[_0xaf84('0x13')](_0x3c4c11);switch(_0x355b62[_0xaf84('0x14')]){case 0x0:if(_0x355b62[_0xaf84('0x15')]){if(_0x355b62[_0xaf84('0x15')]['final']){logger['info'](_0xaf84('0x16'),JSON[_0xaf84('0xc')](_0x355b62[_0xaf84('0x15')][_0xaf84('0x17')]));_0x49896b=_0x355b62[_0xaf84('0x15')][_0xaf84('0x17')][0x0][_0xaf84('0x18')];_0x2272c2=_0x355b62[_0xaf84('0x15')][_0xaf84('0x17')][0x0]['likelihood'];_0x5cc8ca='0';_0x274848='Success.';_0x1e32a2[_0xaf84('0x12')]();}}break;case 0x1:logger[_0xaf84('0x9')](_0xaf84('0x5'));_0x5cc8ca='1';_0x274848=_0xaf84('0x5');break;case 0x2:logger[_0xaf84('0x9')](_0xaf84('0x19'));_0x5cc8ca='2';_0x274848='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0xaf84('0x9')](_0xaf84('0x1a'));_0x5cc8ca='9';_0x274848='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info'](_0xaf84('0x1b'));_0x5cc8ca='10';_0x274848=_0xaf84('0x1b');break;case 0xb:logger[_0xaf84('0x9')](_0xaf84('0x1c'));_0x5cc8ca='11';_0x274848=_0xaf84('0x1c');}}}catch(_0x465d48){logger[_0xaf84('0x1d')]('Tilde\x20ASR\x20parse\x20error',JSON[_0xaf84('0xc')](_0x465d48));_0x1e32a2[_0xaf84('0x12')]();}}function _0x2f4e9c(){logger[_0xaf84('0x9')](_0xaf84('0x1e'));_0x56ea5c({'transcript':_0x49896b,'confidence':_0x2272c2,'status':_0x5cc8ca,'status_message':_0x274848});}function _0x4dfaf0(_0x37458a){logger['error'](_0xaf84('0x1f'));if(!_[_0xaf84('0x20')](_0x37458a)){logger[_0xaf84('0x1d')](_['isObject'](_0x37458a)?JSON['stringify'](_0x37458a):_0x37458a);}}_0x1e32a2['on'](_0xaf84('0x21'),_0x37d5c8);_0x1e32a2['on'](_0xaf84('0x22'),_0x5d7844);_0x1e32a2['on'](_0xaf84('0xf'),_0x2f4e9c);_0x1e32a2['on'](_0xaf84('0x1d'),_0x4dfaf0);});}; \ No newline at end of file +var _0xc974=['likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','message','bluebird','lodash','crypto','../../../../../../config/logger','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','close','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','stringify','hypotheses','transcript'];(function(_0x59fb1c,_0x4711b1){var _0x2049e9=function(_0x740e1f){while(--_0x740e1f){_0x59fb1c['push'](_0x59fb1c['shift']());}};_0x2049e9(++_0x4711b1);}(_0xc974,0x160));var _0x4c97=function(_0x409c4a,_0x4eeec7){_0x409c4a=_0x409c4a-0x0;var _0x527b30=_0xc974[_0x409c4a];return _0x527b30;};'use strict';var BPromise=require(_0x4c97('0x0'));var _=require(_0x4c97('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x4c97('0x2'));var logger=require(_0x4c97('0x3'))(_0x4c97('0x4'));module['exports']=function(_0x4c123a,_0x5f0971,_0x390a58,_0x3605fe){return new BPromise(function(_0x1fad6a,_0x547197){logger[_0x4c97('0x5')](_0x4c97('0x6'),_0x3605fe||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x3cd90e=new WebSocket(_0x3605fe||_0x4c97('0x7'),{'perMessageDeflate':![]});var _0x133f27='';var _0x4d7fca='0';var _0x4d558='1';var _0x7a77cc='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x377b91(_0x418686){var _0x772c39=crypto[_0x4c97('0x8')](_0x4c97('0x9'));_0x772c39[_0x4c97('0xa')](_0x418686);return _0x772c39['digest']('hex');}function _0x2a69ab(){try{logger['info'](_0x4c97('0xb'));var _0x2d1137=moment()[_0x4c97('0xc')]();var _0xf8bb7d=_0x377b91(_0x2d1137+_0x5f0971+_0x390a58);_0x3cd90e[_0x4c97('0xd')](JSON['stringify']({'appID':_0x5f0971,'timestamp':_0x2d1137,'appKey':_0xf8bb7d}));var _0x50f78c=fs[_0x4c97('0xe')](_0x4c123a);_0x50f78c['on'](_0x4c97('0xf'),function(_0x400ab1){_0x3cd90e[_0x4c97('0xd')](_0x400ab1);});_0x50f78c['on'](_0x4c97('0x10'),function(){_0x3cd90e[_0x4c97('0xd')]('EOS');});}catch(_0x59175f){logger[_0x4c97('0x11')](_0x4c97('0x12'),JSON['stringify'](_0x59175f));_0x3cd90e[_0x4c97('0x13')]();}}function _0x5b3f68(_0x17eac2){try{if(_0x17eac2){var _0x18725e=JSON[_0x4c97('0x14')](_0x17eac2);switch(_0x18725e[_0x4c97('0x15')]){case 0x0:if(_0x18725e[_0x4c97('0x16')]){if(_0x18725e[_0x4c97('0x16')][_0x4c97('0x17')]){logger[_0x4c97('0x5')](_0x4c97('0x18'),JSON[_0x4c97('0x19')](_0x18725e[_0x4c97('0x16')][_0x4c97('0x1a')]));_0x133f27=_0x18725e[_0x4c97('0x16')][_0x4c97('0x1a')][0x0][_0x4c97('0x1b')];_0x4d7fca=_0x18725e[_0x4c97('0x16')][_0x4c97('0x1a')][0x0][_0x4c97('0x1c')];_0x4d558='0';_0x7a77cc=_0x4c97('0x1d');_0x3cd90e['terminate']();}}break;case 0x1:logger[_0x4c97('0x5')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x4d558='1';_0x7a77cc='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x4c97('0x5')](_0x4c97('0x1e'));_0x4d558='2';_0x7a77cc=_0x4c97('0x1e');break;case 0x9:logger[_0x4c97('0x5')](_0x4c97('0x1f'));_0x4d558='9';_0x7a77cc=_0x4c97('0x1f');break;case 0xa:logger[_0x4c97('0x5')](_0x4c97('0x20'));_0x4d558='10';_0x7a77cc='Authentication\x20failed.';break;case 0xb:logger[_0x4c97('0x5')](_0x4c97('0x21'));_0x4d558='11';_0x7a77cc=_0x4c97('0x21');}}}catch(_0x2a015a){logger[_0x4c97('0x11')](_0x4c97('0x22'),JSON[_0x4c97('0x19')](_0x2a015a));_0x3cd90e[_0x4c97('0x13')]();}}function _0x1b5a04(){logger['info'](_0x4c97('0x23'));_0x1fad6a({'transcript':_0x133f27,'confidence':_0x4d7fca,'status':_0x4d558,'status_message':_0x7a77cc});}function _0x522f85(_0x5058c6){logger[_0x4c97('0x11')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x4c97('0x24')](_0x5058c6)){logger[_0x4c97('0x11')](_['isObject'](_0x5058c6)?JSON[_0x4c97('0x19')](_0x5058c6):_0x5058c6);}}_0x3cd90e['on']('open',_0x2a69ab);_0x3cd90e['on'](_0x4c97('0x25'),_0x5b3f68);_0x3cd90e['on']('close',_0x1b5a04);_0x3cd90e['on'](_0x4c97('0x11'),_0x522f85);});}; \ 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 058daea..84e9e49 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 _0xf67c=['./asr'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0xf67c,0xcf));var _0xcf67=function(_0x170e37,_0x142768){_0x170e37=_0x170e37-0x0;var _0x927529=_0xf67c[_0x170e37];return _0x927529;};var asr=require(_0xcf67('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x01de=['./asr','exports'];(function(_0x1a458a,_0x4b141d){var _0x39a3dd=function(_0x342476){while(--_0x342476){_0x1a458a['push'](_0x1a458a['shift']());}};_0x39a3dd(++_0x4b141d);}(_0x01de,0x158));var _0xe01d=function(_0x3159b8,_0x46e0c0){_0x3159b8=_0x3159b8-0x0;var _0x3896fe=_0x01de[_0x3159b8];return _0x3896fe;};var asr=require(_0xe01d('0x0'));module[_0xe01d('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 60bc6c2..e198abf 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 _0x4863=['error','E_AGI_ARGUMENT_PORT','listen','listening','connection','getConnections','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','E_AGI_SERVER_ERROR','close','inherits','exports','net','events','EventEmitter','./error','./channel','127.0.0.1','emit'];(function(_0x56f747,_0x39ccca){var _0x4b90f1=function(_0x21082c){while(--_0x21082c){_0x56f747['push'](_0x56f747['shift']());}};_0x4b90f1(++_0x39ccca);}(_0x4863,0x77));var _0x3486=function(_0x5546a5,_0x372e99){_0x5546a5=_0x5546a5-0x0;var _0x5e4a94=_0x4863[_0x5546a5];return _0x5e4a94;};'use strict';var util=require('util');var net=require(_0x3486('0x0'));var EventEmitter=require(_0x3486('0x1'))[_0x3486('0x2')];var AGIError=require(_0x3486('0x3'));var AGIChannel=require(_0x3486('0x4'));var AGIServer=function(_0x4edaf6,_0x3f778d,_0x10e1ee){var _0xf99aab=this,_0x4edaf6=_0x4edaf6||0x11dd,_0x3f778d=_0x3f778d||_0x3486('0x5'),_0x142d14=null,_0x3c4363=0x0;EventEmitter['call'](_0xf99aab);function _0x3c6d2b(){if(!_0x4edaf6){_0xf99aab[_0x3486('0x6')](_0x3486('0x7'),new AGIError(_0x3486('0x8')));return![];}_0x142d14=net['createServer']();_0x142d14[_0x3486('0x9')](_0x4edaf6,_0x3f778d);_0x142d14['on'](_0x3486('0xa'),function(){_0xf99aab[_0x3486('0x6')](_0x3486('0xa'));});_0x142d14['on'](_0x3486('0xb'),function(_0xd22e58){_0x142d14[_0x3486('0xc')](function(_0x5e5355,_0x276252){if(_0x5e5355){_0xf99aab['emit'](_0x3486('0x7'),new AGIError('E_AGI_SERVER_ERROR',_0x5e5355));}else if(_0x10e1ee&&_0x10e1ee<0x0){_0xf99aab[_0x3486('0x6')]('error',new AGIError(_0x3486('0xd')));_0xd22e58[_0x3486('0xe')]();}else if(_0x10e1ee&&_0x10e1ee>0x0&&_0x10e1ee<_0x276252){_0x3c4363+=0x1;_0xf99aab[_0x3486('0x6')](_0x3486('0x7'),new AGIError(_0x3486('0xf'),_0x3c4363));_0xd22e58[_0x3486('0xe')]();}else{var _0x163a63=new AGIChannel(_0xd22e58);_0x163a63['on'](_0x3486('0x10'),function(){_0xf99aab['emit']('connection',_0x163a63);});}});});_0x142d14['on'](_0x3486('0x7'),function(_0x369fd2){_0xf99aab[_0x3486('0x6')](_0x3486('0x7'),new AGIError(_0x3486('0x11'),_0x369fd2['code']));});_0x142d14['on'](_0x3486('0x12'),function(){_0xf99aab[_0x3486('0x6')](_0x3486('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process['nextTick'](function(){_0x3c6d2b();});};util[_0x3486('0x13')](AGIServer,EventEmitter);module[_0x3486('0x14')]=function(_0x30e9cf,_0x462aa0,_0x117aa7){return new AGIServer(_0x30e9cf,_0x462aa0,_0x117aa7);}; \ No newline at end of file +var _0x91e2=['error','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','net','events','EventEmitter','./error','127.0.0.1','emit','createServer','listening','connection','getConnections','E_AGI_SERVER_ERROR'];(function(_0x43625f,_0x4ab491){var _0x2988d1=function(_0x5059bf){while(--_0x5059bf){_0x43625f['push'](_0x43625f['shift']());}};_0x2988d1(++_0x4ab491);}(_0x91e2,0x181));var _0x291e=function(_0x4369ec,_0x959b0e){_0x4369ec=_0x4369ec-0x0;var _0x1369bb=_0x91e2[_0x4369ec];return _0x1369bb;};'use strict';var util=require('util');var net=require(_0x291e('0x0'));var EventEmitter=require(_0x291e('0x1'))[_0x291e('0x2')];var AGIError=require(_0x291e('0x3'));var AGIChannel=require('./channel');var AGIServer=function(_0x2982cf,_0x415ad5,_0x2da65b){var _0x21add6=this,_0x2982cf=_0x2982cf||0x11dd,_0x415ad5=_0x415ad5||_0x291e('0x4'),_0x42cb84=null,_0x3cf66d=0x0;EventEmitter['call'](_0x21add6);function _0x5014b3(){if(!_0x2982cf){_0x21add6[_0x291e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x42cb84=net[_0x291e('0x6')]();_0x42cb84['listen'](_0x2982cf,_0x415ad5);_0x42cb84['on'](_0x291e('0x7'),function(){_0x21add6[_0x291e('0x5')]('listening');});_0x42cb84['on'](_0x291e('0x8'),function(_0x5c24fa){_0x42cb84[_0x291e('0x9')](function(_0x4cff70,_0x1f0774){if(_0x4cff70){_0x21add6[_0x291e('0x5')]('error',new AGIError(_0x291e('0xa'),_0x4cff70));}else if(_0x2da65b&&_0x2da65b<0x0){_0x21add6[_0x291e('0x5')](_0x291e('0xb'),new AGIError(_0x291e('0xc')));_0x5c24fa[_0x291e('0xd')]();}else if(_0x2da65b&&_0x2da65b>0x0&&_0x2da65b<_0x1f0774){_0x3cf66d+=0x1;_0x21add6[_0x291e('0x5')](_0x291e('0xb'),new AGIError(_0x291e('0xe'),_0x3cf66d));_0x5c24fa[_0x291e('0xd')]();}else{var _0x3af573=new AGIChannel(_0x5c24fa);_0x3af573['on'](_0x291e('0xf'),function(){_0x21add6['emit'](_0x291e('0x8'),_0x3af573);});}});});_0x42cb84['on'](_0x291e('0xb'),function(_0x53459a){_0x21add6[_0x291e('0x5')](_0x291e('0xb'),new AGIError('E_AGI_SERVER_ERROR',_0x53459a[_0x291e('0x10')]));});_0x42cb84['on'](_0x291e('0x11'),function(){_0x21add6['emit'](_0x291e('0x11'),new AGIError(_0x291e('0x12')));});}process[_0x291e('0x13')](function(){_0x5014b3();});};util[_0x291e('0x14')](AGIServer,EventEmitter);module[_0x291e('0x15')]=function(_0x169783,_0x2c8832,_0x1f91c8){return new AGIServer(_0x169783,_0x2c8832,_0x1f91c8);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 02211bb..8f2a5aa 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 _0xc9de=['500\x20-\x20Internal\x20Server\x20Error','options','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','awsLex','aws_lex_region','aws_bot_name','googleASR','tildeASR','clear','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','recursiveNodeIndex','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getVariable','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','mrcpsynth','noop','no\x20text\x20configured','MRCPSynth','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','RECOG_INSTANCE()','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','no\x20database\x20selected','odbc_id','query','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Trying\x20Dialogflow:\x20%s','googleDialogflow','hasOwnProperty','out','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','bot','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','awspolly','aws_secret_access_key','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','%s/recordings/%s','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','wav','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','gotoif','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','maxRetry','digit','pause','getPause','success','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','record','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','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','sayPhonetic','sendMail','account_id','Smtp','no\x20mail\x20account\x20found','email','subject','service','host','port','secure','authentication','auth','template_id','Trying\x20SendMail\x20with\x20account\x20%s','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','exports','path','util','lodash','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getsecretdigits','mailRpc','prototype','rpc','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','getMailAccount','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','channel','arg_1','callerid','createSquareRecording','calleridname','context','priority','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','format','%s/%s@from-sip/n','exec','trim','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','includes','POST','PUT','toUpperCase','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message'];(function(_0x1a27df,_0x11891c){var _0x194543=function(_0x5431c2){while(--_0x5431c2){_0x1a27df['push'](_0x1a27df['shift']());}};_0x194543(++_0x11891c);}(_0xc9de,0x140));var _0xec9d=function(_0x6d6650,_0x37087d){_0x6d6650=_0x6d6650-0x0;var _0x3033d4=_0xc9de[_0x6d6650];return _0x3033d4;};'use strict';var fs=require('fs');var path=require(_0xec9d('0x0'));var util=require(_0xec9d('0x1'));var _=require(_0xec9d('0x2'));var sh=require('shelljs');var odbc=require(_0xec9d('0x3'))();var rs=require(_0xec9d('0x4'));var moment=require(_0xec9d('0x5'));var Mustache=require(_0xec9d('0x6'));var rp=require(_0xec9d('0x7'));var logger=require(_0xec9d('0x8'))(_0xec9d('0x9'));var config=require(_0xec9d('0xa'));var scripts=require('./scripts');var FILES_PATH=_0xec9d('0xb');var recursiveMapAttributes=[_0xec9d('0xc'),_0xec9d('0xd')];var verticesWithRetry=[_0xec9d('0xe'),'getdigits',_0xec9d('0xf')];var AGIVertices=function(_0x552d43,_0x923b58,_0x56f2be){this['channel']=_0x552d43;this['rpc']=_0x923b58;this[_0xec9d('0x10')]=_0x56f2be;};AGIVertices[_0xec9d('0x11')]['getVariable']=function(_0x42abe5,_0x255cf7){this[_0xec9d('0x12')]['getVariableById'](_0x42abe5)[_0xec9d('0x13')](function(_0x45c7ef){_0x255cf7(null,_0x45c7ef?_0x45c7ef[_0xec9d('0x14')]:![]);})['catch'](function(_0x326385){_0x255cf7(_0x326385);});};AGIVertices['prototype'][_0xec9d('0x15')]=function(_0x41b5c7,_0x58c370){this[_0xec9d('0x12')][_0xec9d('0x16')](_0x41b5c7)[_0xec9d('0x13')](function(_0x117b77){_0x58c370(null,_0x117b77?_0x117b77[_0xec9d('0x14')]:![]);})[_0xec9d('0x17')](function(_0x53e74e){_0x58c370(_0x53e74e);});};AGIVertices[_0xec9d('0x11')][_0xec9d('0x18')]=function(_0x162d32,_0x5f5949){this[_0xec9d('0x12')][_0xec9d('0x19')](_0x162d32)[_0xec9d('0x13')](function(_0xc5b105){_0x5f5949(null,_0xc5b105?_0xc5b105[_0xec9d('0x14')]:![]);})['catch'](function(_0x5ddc51){_0x5f5949(_0x5ddc51);});};AGIVertices[_0xec9d('0x11')][_0xec9d('0x1a')]=function(_0x40e0a8,_0x33a967){this['rpc'][_0xec9d('0x1b')](_0x40e0a8)['then'](function(_0x463cbc){_0x33a967(null,_0x463cbc?_0x463cbc[_0xec9d('0x1c')]:![]);})[_0xec9d('0x17')](function(_0x1125fa){_0x33a967(_0x1125fa);});};AGIVertices['prototype'][_0xec9d('0x1d')]=function(_0x126e4e,_0x51ee86){this[_0xec9d('0x12')][_0xec9d('0x1e')](_0x126e4e)['then'](function(_0x24d3f2){_0x51ee86(null,_0x24d3f2?_0x24d3f2[_0xec9d('0x14')]:![]);})[_0xec9d('0x17')](function(_0x3f54d6){_0x51ee86(_0x3f54d6);});};AGIVertices['prototype'][_0xec9d('0x1f')]=function(_0x3a35a3,_0xf59b4){this['rpc'][_0xec9d('0x20')](_0x3a35a3)['then'](function(_0x5ccfea){_0xf59b4(null,_0x5ccfea?_0x5ccfea[_0xec9d('0x14')]:![]);})[_0xec9d('0x17')](function(_0x9aa176){_0xf59b4(_0x9aa176);});};AGIVertices[_0xec9d('0x11')][_0xec9d('0x21')]=function(_0x4f2374,_0x38c218){var _0x5c4e9d=this;this[_0xec9d('0x12')][_0xec9d('0x22')](_0x4f2374)[_0xec9d('0x13')](function(_0x3bfc0c){_0x38c218(null,_0x3bfc0c?_0x5c4e9d[_0xec9d('0x23')](_0x3bfc0c['save_name']):![]);})[_0xec9d('0x17')](function(_0x322576){_0x38c218(_0x322576);});};AGIVertices['prototype'][_0xec9d('0x24')]=function(_0x4d6d03,_0x777595){this[_0xec9d('0x12')]['getMailAccountById'](_0x4d6d03)['then'](function(_0x58307a){_0x777595(null,_0x58307a?_0x58307a:![]);})[_0xec9d('0x17')](function(_0xc44fc4){_0x777595(_0xc44fc4);});};AGIVertices[_0xec9d('0x11')]['sendMailMessage']=function(_0x4418de,_0x1cb20a,_0x768098){this[_0xec9d('0x10')][_0xec9d('0x25')](_0x4418de,_0x1cb20a)[_0xec9d('0x13')](function(){_0x768098(null);})[_0xec9d('0x17')](function(_0x32a9b1){_0x768098(_0x32a9b1);});};AGIVertices[_0xec9d('0x11')][_0xec9d('0x26')]=function(_0x47b6ef,_0x728515){this[_0xec9d('0x12')][_0xec9d('0x27')](_0x47b6ef)[_0xec9d('0x13')](function(_0x384bc0){if(_0x384bc0){if(_0x384bc0[_0xec9d('0x28')]){_0x728515(null,[_0x384bc0[_0xec9d('0x29')]]);}else{_0x728515(null,_['map'](_0x384bc0['Intervals'],_0xec9d('0x29')));}}else{_0x728515(null,![]);}})[_0xec9d('0x17')](function(_0x1f30c7){_0x728515(_0x1f30c7);});};AGIVertices['prototype'][_0xec9d('0x23')]=function(_0x283e3d){return util['format'](_0xec9d('0x2a'),FILES_PATH,_0x283e3d);};AGIVertices['prototype'][_0xec9d('0x2b')]=function(_0x20f873,_0x121cf5,_0x2d7ce9){odbc[_0xec9d('0x2c')](_0x20f873,function(_0xaf92b8){if(_0xaf92b8){logger[_0xec9d('0x2d')](_0xec9d('0x2e'),_0xaf92b8);_0x2d7ce9(_0xaf92b8);}else{logger[_0xec9d('0x2f')](_0xec9d('0x30'));odbc['query'](_0x121cf5,function(_0x6e257a,_0x5c6c59){if(_0x6e257a){logger[_0xec9d('0x2f')](_0xec9d('0x31'),_0x121cf5);_0x2d7ce9(_0x6e257a);}else{logger['info'](_0xec9d('0x32'),_0x121cf5);odbc[_0xec9d('0x33')](function(_0x4a81bb){if(_0x4a81bb){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x4a81bb);}_0x2d7ce9(null,_0x5c6c59);});}});}});};AGIVertices['prototype'][_0xec9d('0x34')]=function(_0xe890e1,_0x3189e3){this[_0xec9d('0x12')]['getSmsAccountById'](_0xe890e1)[_0xec9d('0x13')](function(_0xb0c737){_0x3189e3(null,_0xb0c737?_0xb0c737:![]);})[_0xec9d('0x17')](function(_0xf0d3f3){_0x3189e3(_0xf0d3f3);});};AGIVertices[_0xec9d('0x11')][_0xec9d('0x35')]=function(_0x17de61,_0x5cf7bc){this[_0xec9d('0x12')][_0xec9d('0x35')](_0x17de61)[_0xec9d('0x13')](function(_0x13549b){_0x5cf7bc(null,_0x13549b);})['catch'](function(_0x367dd2){_0x5cf7bc(_0x367dd2);});};AGIVertices[_0xec9d('0x11')][_0xec9d('0x36')]=function(_0x476a71,_0x155e6e,_0x41277b){this[_0xec9d('0x12')][_0xec9d('0x36')]({'uniqueid':this['channel'][_0xec9d('0x37')],'node':_0x476a71[_0xec9d('0x38')],'application':_0x476a71[_0xec9d('0x39')],'data':_0x155e6e||null,'project_name':this[_0xec9d('0x3a')][_0xec9d('0x3b')],'callerid':this[_0xec9d('0x3a')][_0xec9d('0x3c')]})[_0xec9d('0x13')](function(_0x4652c5){if(_0x41277b){_0x41277b(null,_0x4652c5);}})['catch'](function(_0x457d07){if(_0x41277b){_0x41277b(_0x457d07);}});};AGIVertices[_0xec9d('0x11')][_0xec9d('0x3d')]=function(_0x1d9e49,_0x22184e,_0x6ca6dc,_0x12c9dd){this[_0xec9d('0x12')][_0xec9d('0x3d')]({'uniqueid':this[_0xec9d('0x3a')][_0xec9d('0x37')],'callerid':this[_0xec9d('0x3a')]['callerid'],'calleridname':this[_0xec9d('0x3a')][_0xec9d('0x3e')],'context':this[_0xec9d('0x3a')][_0xec9d('0x3f')],'extension':this['channel']['extension'],'priority':this[_0xec9d('0x3a')][_0xec9d('0x40')],'accountcode':this['channel'][_0xec9d('0x41')],'dnid':this[_0xec9d('0x3a')][_0xec9d('0x42')],'projectName':this[_0xec9d('0x3a')][_0xec9d('0x3b')],'saveName':_0x22184e,'filename':_0x1d9e49['file']||_0x22184e,'savePath':_0x6ca6dc})[_0xec9d('0x13')](function(_0xcfbbe9){_0x12c9dd(null,_0xcfbbe9);})[_0xec9d('0x17')](function(_0x5fbe21){_0x12c9dd(_0x5fbe21);});};AGIVertices[_0xec9d('0x11')][_0xec9d('0x43')]=function(_0x6c6fb7,_0x4e6c46,_0x1fccd3,_0x27f2dd,_0x4fe01e){this[_0xec9d('0x12')]['createSquareMessage']({'uniqueid':this[_0xec9d('0x3a')][_0xec9d('0x37')],'body':_0x6c6fb7,'direction':_0x4e6c46,'providerName':_0x1fccd3,'providerResponse':_0x27f2dd})[_0xec9d('0x13')](function(_0x28245e){if(_0x4fe01e){_0x4fe01e(null,_0x28245e);}})[_0xec9d('0x17')](function(_0x50b249){if(_0x4fe01e){_0x4fe01e(_0x50b249);}});};AGIVertices[_0xec9d('0x11')]['createCmContact']=function(_0x28c56f,_0x2cb698){this[_0xec9d('0x12')][_0xec9d('0x44')]({'firstName':_[_0xec9d('0x45')](_0x28c56f[_0xec9d('0x14')])||_[_0xec9d('0x46')](_0x28c56f[_0xec9d('0x14')])?_0xec9d('0x47')+Math['random']():_0x28c56f[_0xec9d('0x14')],'lastName':_[_0xec9d('0x45')](_0x28c56f[_0xec9d('0x48')])||_[_0xec9d('0x46')](_0x28c56f[_0xec9d('0x48')])?null:_0x28c56f[_0xec9d('0x48')],'phone':_0x28c56f[_0xec9d('0x49')],'ListId':_0x28c56f[_0xec9d('0x4a')],'scheduledat':_0x28c56f['scheduledAt'],'callbackUniqueid':this[_0xec9d('0x3a')][_0xec9d('0x37')],'tags':_0xec9d('0x4b'),'description':_0xec9d('0x4c')+_0x28c56f[_0xec9d('0x4d')][_0xec9d('0x4e')](),'priority':_0x28c56f[_0xec9d('0x4f')]})[_0xec9d('0x13')](function(_0x24c3ef){_0x2cb698(null,_0x24c3ef);})['catch'](function(_0x593661){_0x2cb698(_0x593661);});};AGIVertices[_0xec9d('0x11')]['getPause']=function(_0x470071,_0x48a029){this[_0xec9d('0x12')][_0xec9d('0x50')](_0x470071)[_0xec9d('0x13')](function(_0x2a90d4){_0x48a029(null,_0x2a90d4?_0x2a90d4[_0xec9d('0x14')]:![]);})[_0xec9d('0x17')](function(_0x812ec4){_0x48a029(_0x812ec4);});};AGIVertices[_0xec9d('0x11')][_0xec9d('0x51')]=function(_0x365594,_0x62de7a,_0xbd079f){var _0x2b60b6={'role':_0xec9d('0x52')};_0x2b60b6[_0x365594]=this[_0xec9d('0x3a')][_0xec9d('0x3c')];this['rpc'][_0xec9d('0x51')](_0x2b60b6,_0x62de7a,this[_0xec9d('0x3a')]['uniqueid'])['then'](function(_0x2a58de){_0xbd079f(null,_[_0xec9d('0x46')](_0x2a58de)?![]:!![]);})[_0xec9d('0x17')](function(_0x4d6dfb){logger[_0xec9d('0x2d')](_0x4d6dfb);_0xbd079f(null,![]);});};AGIVertices['prototype'][_0xec9d('0x53')]=function(_0x39925a,_0x26235d){var _0x1b46cb={'role':_0xec9d('0x52')};_0x1b46cb[_0x39925a]=this[_0xec9d('0x3a')]['callerid'];this[_0xec9d('0x12')][_0xec9d('0x53')](_0x1b46cb)[_0xec9d('0x13')](function(_0x5532e9){_0x26235d(null,_[_0xec9d('0x46')](_0x5532e9)?![]:!![]);})[_0xec9d('0x17')](function(_0x4596cb){logger[_0xec9d('0x2d')](_0x4596cb);_0x26235d(null,![]);});};AGIVertices[_0xec9d('0x11')][_0xec9d('0x54')]=function(_0x7ac1,_0x3f6d26){var _0x47f3cd={'role':_0xec9d('0x52')};_0x47f3cd[_0x7ac1]=this[_0xec9d('0x3a')][_0xec9d('0x3c')];this[_0xec9d('0x12')][_0xec9d('0x54')](_0x47f3cd)[_0xec9d('0x13')](function(_0x129b12){_0x3f6d26(null,_[_0xec9d('0x46')](_0x129b12)?![]:!![]);})[_0xec9d('0x17')](function(_0x2091ce){logger[_0xec9d('0x2d')](_0x2091ce);_0x3f6d26(null,![]);});};AGIVertices[_0xec9d('0x11')][_0xec9d('0x55')]=function(_0x4d4cb2,_0xa6f7d9){var _0x157894={'role':_0xec9d('0x52')};_0x157894[_0x4d4cb2]=this[_0xec9d('0x3a')]['callerid'];var _0x44df7b=_0x4d4cb2!='internal'?util[_0xec9d('0x56')](_0xec9d('0x57'),'LOCAL',this[_0xec9d('0x3a')]['callerid']):undefined;this[_0xec9d('0x12')][_0xec9d('0x55')](_0x157894,_0x44df7b)[_0xec9d('0x13')](function(_0x1ac948){_0xa6f7d9(null,_[_0xec9d('0x46')](_0x1ac948)?![]:!![]);})['catch'](function(_0x2c551c){logger['error'](_0x2c551c);_0xa6f7d9(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x1e5068,_0xf27573){sh[_0xec9d('0x58')](_[_0xec9d('0x59')](_0x1e5068),function(_0x1a15c8,_0x7ff6cb){var _0x4bee25=_0x7ff6cb[_0xec9d('0x5a')](/(\r\n|\n|\r)/gm,'');_0xf27573(null,_0x4bee25);});};AGIVertices[_0xec9d('0x11')]['googleCloudTTS']=function(_0x6ee416,_0x53c3d7){scripts[_0xec9d('0x5b')](_0x6ee416[_0xec9d('0x5c')],_0x6ee416['google_cloud_tts_text_type']||_0xec9d('0x5d'),_0x6ee416[_0xec9d('0x5d')],_0x6ee416[_0xec9d('0x5e')]||_0xec9d('0x5f'),_0x6ee416[_0xec9d('0x60')]||'MALE',_0x6ee416[_0xec9d('0x61')]||_0xec9d('0x62'))[_0xec9d('0x13')](function(_0xed8eb2){_0x53c3d7(null,_0xed8eb2);})['catch'](function(_0x45fcfd){_0x53c3d7(_0x45fcfd);});};AGIVertices['prototype'][_0xec9d('0x63')]=function(_0x6a557e,_0x5073a0){scripts['googleTTS'](_0x6a557e[_0xec9d('0x5d')],_0x6a557e[_0xec9d('0x64')]||'en',0x1)[_0xec9d('0x13')](function(_0x2e5ea7){_0x5073a0(null,_0x2e5ea7);})['catch'](function(_0x48ed7b){_0x5073a0(_0x48ed7b);});};AGIVertices['prototype'][_0xec9d('0x65')]=function(_0x37d423,_0x31ecf0){var _0x46cb4a={'uri':_0x37d423[_0xec9d('0x66')],'method':_0x37d423[_0xec9d('0x67')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x37d423[_0xec9d('0x68')])==='number'&&parseInt(_0x37d423[_0xec9d('0x68')])>=0x1?parseInt(_0x37d423[_0xec9d('0x68')])*0x3e8:0x5*0x3e8};if(_[_0xec9d('0x69')]([_0xec9d('0x6a'),_0xec9d('0x6b')],_0x46cb4a[_0xec9d('0x67')][_0xec9d('0x6c')]())){try{_0x46cb4a['body']=_0x37d423['rawBody']?JSON['parse'](_0x37d423[_0xec9d('0xd')]):{};}catch(_0x5eab7a){logger[_0xec9d('0x2d')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x5eab7a);}}try{_0x46cb4a[_0xec9d('0x6d')]=_0x37d423[_0xec9d('0xc')]?JSON[_0xec9d('0x6e')](_0x37d423[_0xec9d('0xc')]):{};}catch(_0x44b30d){logger[_0xec9d('0x2d')](_0xec9d('0x6f'),_0x44b30d);}if(_0x37d423[_0xec9d('0x70')]){try{var _0x564138=require(_0x37d423[_0xec9d('0x70')])[_0xec9d('0x71')](this,_0x46cb4a);_0x46cb4a[_0xec9d('0x72')]=Mustache[_0xec9d('0x73')](_0x37d423[_0xec9d('0x66')],_0x564138,{},['$$','$$']);if(_0x46cb4a[_0xec9d('0x6d')]){_0x46cb4a[_0xec9d('0x6d')]=JSON['parse'](Mustache[_0xec9d('0x73')](JSON[_0xec9d('0x74')](_0x46cb4a[_0xec9d('0x6d')]),_0x564138,{},['$$','$$']));}if(_0x46cb4a[_0xec9d('0x75')]){_0x46cb4a['body']=JSON[_0xec9d('0x6e')](Mustache[_0xec9d('0x73')](JSON['stringify'](_0x46cb4a[_0xec9d('0x75')]),_0x564138,{},['$$','$$']));}}catch(_0x1082b5){logger[_0xec9d('0x2d')](_0xec9d('0x76'),_0x1082b5);}}rp(_0x46cb4a)[_0xec9d('0x13')](function(_0x36979e){var _0x126aa0={'statusCode':_0x36979e[_0xec9d('0x77')]||0xc8,'statusMessage':_0x36979e[_0xec9d('0x78')]||'OK','headers':_0x36979e[_0xec9d('0x6d')]||{},'body':_0x36979e[_0xec9d('0x75')]||{}};_0x31ecf0(null,_0x126aa0);})[_0xec9d('0x17')](function(_0x5bc67a){var _0x286785={'statusCode':_0x5bc67a['statusCode']||0x1f4,'statusMessage':_0x5bc67a[_0xec9d('0x79')]||_0xec9d('0x7a'),'headers':_0x5bc67a[_0xec9d('0x7b')]['headers']||{},'body':_0x5bc67a[_0xec9d('0x7b')]['body']||{}};_0x31ecf0(null,_0x286785);});};AGIVertices[_0xec9d('0x11')]['googleDialogflow']=function(_0x48ecb9,_0x14a0b1){scripts['googleDialogflow'](this['channel'][_0xec9d('0x37')],_0x48ecb9[_0xec9d('0x7c')],_0x48ecb9[_0xec9d('0x5d')],_0x48ecb9[_0xec9d('0x7d')]||'en')[_0xec9d('0x13')](function(_0x30d2a5){_0x14a0b1(null,_0x30d2a5);})['catch'](function(_0x2d750d){_0x14a0b1(_0x2d750d);});};AGIVertices[_0xec9d('0x11')]['googleDialogflowV2']=function(_0x1129b4,_0x391fea){scripts[_0xec9d('0x7e')](this[_0xec9d('0x3a')][_0xec9d('0x37')],_0x1129b4[_0xec9d('0x7f')],_0x1129b4[_0xec9d('0x80')],_0x1129b4['private_key'],_0x1129b4[_0xec9d('0x5d')],_0x1129b4[_0xec9d('0x81')]||'en')[_0xec9d('0x13')](function(_0x178802){_0x391fea(null,_0x178802);})[_0xec9d('0x17')](function(_0x5a68ef){_0x391fea(_0x5a68ef);});};AGIVertices['prototype'][_0xec9d('0x82')]=function(_0x54ab92,_0x5cf082){scripts[_0xec9d('0x82')](this[_0xec9d('0x3a')],_0x54ab92)[_0xec9d('0x13')](function(_0x2e03b3){_0x5cf082(null,_0x2e03b3);})[_0xec9d('0x17')](function(_0x1f5b0d){_0x5cf082(_0x1f5b0d);});};AGIVertices['prototype'][_0xec9d('0x83')]=function(_0x4082d7,_0x2d90dd){scripts['ispeechTTS'](_0x4082d7[_0xec9d('0x7c')],_0x4082d7[_0xec9d('0x5d')],_0x4082d7[_0xec9d('0x84')]||'en-US',_0x4082d7[_0xec9d('0x85')])[_0xec9d('0x13')](function(_0x597dc5){_0x2d90dd(null,_0x597dc5);})[_0xec9d('0x17')](function(_0x31cdb8){_0x2d90dd(_0x31cdb8);});};AGIVertices[_0xec9d('0x11')][_0xec9d('0x86')]=function(_0x452fba,_0x5e975f,_0x395135){scripts[_0xec9d('0x86')](_0x5e975f,_0x452fba[_0xec9d('0x7c')],_0x452fba[_0xec9d('0x87')]||_0xec9d('0x5f'),this[_0xec9d('0x88')](_0x452fba[_0xec9d('0x89')])?_0x452fba[_0xec9d('0x89')]:undefined)[_0xec9d('0x13')](function(_0xecefa2){_0x395135(null,_0xecefa2);})['catch'](function(_0x50edec){_0x395135(_0x50edec);});};AGIVertices[_0xec9d('0x11')][_0xec9d('0x8a')]=function(_0x5c3c4e,_0xf69a2a){scripts[_0xec9d('0x8a')](_0x5c3c4e[_0xec9d('0x8b')],_0x5c3c4e['aws_secret_access_key'],_0x5c3c4e[_0xec9d('0x8c')],_0x5c3c4e[_0xec9d('0x8d')]||_0xec9d('0x8e'),_0x5c3c4e[_0xec9d('0x5d')],_0x5c3c4e['aws_text_type']||_0xec9d('0x5d'))[_0xec9d('0x13')](function(_0x56ac67){_0xf69a2a(null,_0x56ac67);})[_0xec9d('0x17')](function(_0xdc7bff){_0xf69a2a(_0xdc7bff);});};AGIVertices[_0xec9d('0x11')][_0xec9d('0x8f')]=function(_0x1801fa,_0x5cf07e){scripts[_0xec9d('0x8f')](this[_0xec9d('0x3a')][_0xec9d('0x37')],_0x1801fa[_0xec9d('0x8b')],_0x1801fa['aws_secret_access_key'],_0x1801fa[_0xec9d('0x90')],_0x1801fa[_0xec9d('0x5d')],_0x1801fa[_0xec9d('0x91')])['then'](function(_0x3ee0af){_0x5cf07e(null,_0x3ee0af);})[_0xec9d('0x17')](function(_0x2144ea){_0x5cf07e(_0x2144ea);});};AGIVertices[_0xec9d('0x11')][_0xec9d('0x92')]=function(_0x56c174,_0x25c869,_0x4e4885){scripts[_0xec9d('0x92')](_0x25c869,_0x56c174[_0xec9d('0x7c')],_0x56c174['google_asr_language']||'en-US')[_0xec9d('0x13')](function(_0x2702c7){_0x4e4885(null,_0x2702c7);})['catch'](function(_0x2e0081){_0x4e4885(_0x2e0081);});};AGIVertices[_0xec9d('0x11')][_0xec9d('0x93')]=function(_0x5a376e,_0x2e546b,_0x20aa07){scripts[_0xec9d('0x93')](_0x2e546b,_0x5a376e['appid'],_0x5a376e['appsecret'],_0x5a376e[_0xec9d('0x72')])['then'](function(_0x3d40d0){_0x20aa07(null,_0x3d40d0);})['catch'](function(_0x5e765c){_0x20aa07(_0x5e765c);});};AGIVertices[_0xec9d('0x11')][_0xec9d('0x94')]=function(_0x3db399){var _0x471cea=_[_0xec9d('0x69')](verticesWithRetry,_0x3db399[_0xec9d('0x39')])?_0x3db399:_['clone'](_0x3db399);for(var _0x2ef0aa in _0x471cea){if(_0x471cea['hasOwnProperty'](_0x2ef0aa)){if(_0x471cea[_0x2ef0aa]&&_[_0xec9d('0x95')](_0x471cea[_0x2ef0aa])){if(_['includes'](recursiveMapAttributes,_0x2ef0aa)){_0x471cea[_0x2ef0aa]=this[_0xec9d('0x96')](_0x471cea[_0x2ef0aa]);}else{_0x471cea[_0x2ef0aa]=this[_0xec9d('0x97')](_0x471cea[_0x2ef0aa]);}}}}return _0x471cea;};AGIVertices[_0xec9d('0x11')]['recursiveNodeIndex']=function(_0x49462f){for(var _0x50f1e0 in _0x49462f){if(_0x49462f['hasOwnProperty'](_0x50f1e0)){if(_[_0xec9d('0x98')](_0x49462f[_0x50f1e0])){this[_0xec9d('0x99')](_0x49462f[_0x50f1e0]);}else if(_[_0xec9d('0x9a')](_0x49462f[_0x50f1e0])){for(var _0x4b18cf=0x0;_0x4b18cf<_0x49462f[_0x50f1e0][_0xec9d('0x9b')];_0x4b18cf++){this[_0xec9d('0x99')](_0x49462f[_0x50f1e0][_0x4b18cf]);}}else if(_[_0xec9d('0x95')](_0x49462f[_0x50f1e0])){_0x49462f[_0x50f1e0]=this[_0xec9d('0x97')](_0x49462f[_0x50f1e0]);}}}};AGIVertices['prototype'][_0xec9d('0x9c')]=function(_0x1a29ae,_0xc6dd29){for(var _0x327a91 in _0x1a29ae){if(_0x1a29ae['hasOwnProperty'](_0x327a91)){if(_[_0xec9d('0x98')](_0x1a29ae[_0x327a91])){if(!_[_0xec9d('0x45')](_0x1a29ae[_0x327a91])){this['saveRestApiResult'](_0x1a29ae[_0x327a91],util['format']('%s.%s',_0xc6dd29,_0x327a91));}}else if(_['isArray'](_0x1a29ae[_0x327a91])){for(var _0x5ce5df=0x0;_0x5ce5df<_0x1a29ae[_0x327a91][_0xec9d('0x9b')];_0x5ce5df++){this[_0xec9d('0x9c')](_0x1a29ae[_0x327a91][_0x5ce5df],util[_0xec9d('0x56')](_0xec9d('0x9d'),_0xc6dd29,_0x327a91+'['+_0x5ce5df+']'));}}else{if(!_[_0xec9d('0x46')](_0x1a29ae[_0x327a91])){this[_0xec9d('0x3a')][_0xec9d('0x9e')](util[_0xec9d('0x56')](_0xec9d('0x9d'),_0xc6dd29,_0x327a91),_0x1a29ae[_0x327a91]);}}}}};AGIVertices[_0xec9d('0x11')][_0xec9d('0x96')]=function(_0x44a757){try{var _0xebcfa9=JSON[_0xec9d('0x6e')](_0x44a757);this[_0xec9d('0x99')](_0xebcfa9);return JSON['stringify'](_0xebcfa9);}catch(_0x589721){return this[_0xec9d('0x97')](_0x44a757);}};AGIVertices[_0xec9d('0x11')][_0xec9d('0x97')]=function(_0x5a1f62){var _0x2d2e46=_0x5a1f62['split']('{');for(var _0x258a81=0x1;_0x258a81<_0x2d2e46['length'];_0x258a81+=0x1){var _0xe9fec8=_0x2d2e46[_0x258a81][_0xec9d('0x9f')]('}');if(_0xe9fec8[_0xec9d('0x9b')]>0x1){_0x5a1f62=_0x5a1f62[_0xec9d('0xa0')]('{'+_0xe9fec8[0x0]+'}',this[_0xec9d('0x3a')][_0xec9d('0xa1')](_0xe9fec8[0x0])[_0xec9d('0xa2')]||_0xe9fec8[0x0]);}}if(_0x2d2e46[_0xec9d('0x9b')]===0x1){return _0x5a1f62[_0xec9d('0x4e')]();}return this[_0xec9d('0x97')](_0x5a1f62);};AGIVertices[_0xec9d('0x11')][_0xec9d('0xa3')]=function(_0x144b5e,_0x4ef172){var _0x2da65e=this['channel'][_0xec9d('0xa1')](_0x144b5e);if(_0x2da65e[_0xec9d('0xa4')]===-0x1){return _0x2da65e;}logger[_0xec9d('0x2f')](util[_0xec9d('0x56')](_0xec9d('0xa5'),_0x4ef172,_0x2da65e[_0xec9d('0xa2')]));return this['channel'][_0xec9d('0x9e')](_0x4ef172,_0x2da65e[_0xec9d('0xa2')]);};AGIVertices[_0xec9d('0x11')][_0xec9d('0x88')]=function(_0x2c6e2f){return _0x2c6e2f&&_0x2c6e2f!=='0'&&_0x2c6e2f!=='-1'&&_0x2c6e2f!=='';};AGIVertices[_0xec9d('0x11')]['maxRetry']=function(_0x34c2df){this['createSquareDetailsReport'][_0xec9d('0x71')](this,_0x34c2df,'-');_0x34c2df['retry']=_0x34c2df['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xec9d('0x11')][_0xec9d('0xa6')]=function(_0x39bbdb){logger['info'](util['format']('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x39bbdb[_0xec9d('0x38')]));if(!this[_0xec9d('0x88')](_0x39bbdb[_0xec9d('0x5d')])){return this[_0xec9d('0x3a')][_0xec9d('0xa7')](_0xec9d('0xa8'));}var _0x1dc67c='\x22'+_0x39bbdb[_0xec9d('0x5d')]+'\x22';if(this[_0xec9d('0x88')](_0x39bbdb[_0xec9d('0x7b')])){_0x1dc67c+=','+_0x39bbdb[_0xec9d('0x7b')];}var _0x486172=this[_0xec9d('0x3a')][_0xec9d('0x58')](_0xec9d('0xa9'),_0x1dc67c);if(_0x486172['result']===-0x1){return _0x486172;}return this[_0xec9d('0x3a')]['noop'](util[_0xec9d('0x56')]('Executed\x20command\x20MRCPSynth\x20%s',_0x1dc67c));};AGIVertices['prototype'][_0xec9d('0xaa')]=function(_0x5074f7){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')](_0xec9d('0xab'),_0x5074f7[_0xec9d('0x38')]));if(!this[_0xec9d('0x88')](_0x5074f7['grammar'])){return this[_0xec9d('0x3a')][_0xec9d('0xa7')]('no\x20grammar\x20configured');}var _0x3db046=_0x5074f7[_0xec9d('0xac')];if(this[_0xec9d('0x88')](_0x5074f7[_0xec9d('0x7b')])){_0x3db046+=','+_0x5074f7[_0xec9d('0x7b')];}var _0x2ec5a5=this[_0xec9d('0x3a')][_0xec9d('0x58')](_0xec9d('0xad'),_0x3db046);if(_0x2ec5a5[_0xec9d('0xa4')]===-0x1){return _0x2ec5a5;}var _0x19d53f=this[_0xec9d('0xa3')](_0xec9d('0xae'),'MRCP_RECOG_CONFIDENCE');if(_0x19d53f[_0xec9d('0xa4')]===-0x1){return _0x19d53f;}var _0x3bbb88=this[_0xec9d('0xa3')](_0xec9d('0xaf'),'MRCP_RECOG_TRANSCRIPT');if(_0x3bbb88['result']===-0x1){return _0x3bbb88;}var _0x1b4243=this[_0xec9d('0xa3')](_0xec9d('0xb0'),'MRCP_RECOG_INSTANCE');if(_0x1b4243['result']===-0x1){return _0x1b4243;}return this[_0xec9d('0x3a')]['noop'](util[_0xec9d('0x56')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3db046));};AGIVertices['prototype'][_0xec9d('0x9')]=function(_0x564fb4){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')](_0xec9d('0xb1'),_0x564fb4['label']));return this['channel'][_0xec9d('0x9')]([_0x564fb4[_0xec9d('0xb2')],_0x564fb4[_0xec9d('0xb3')]]);};AGIVertices[_0xec9d('0x11')][_0xec9d('0xb4')]=function(_0x1c7bd5){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x1c7bd5[_0xec9d('0x38')]));if(this[_0xec9d('0x88')](_0x1c7bd5[_0xec9d('0x68')])){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')](_0xec9d('0xb5'),_0x1c7bd5[_0xec9d('0x68')]));var _0x472fed=this[_0xec9d('0x3a')][_0xec9d('0xb6')](_0x1c7bd5[_0xec9d('0x68')]);if(_0x472fed[_0xec9d('0xa4')]===-0x1){return _0x472fed;}}return this[_0xec9d('0x3a')][_0xec9d('0xb4')]();};AGIVertices['prototype'][_0xec9d('0x4b')]=function(_0xc4ace6){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')](_0xec9d('0xb7'),_0xc4ace6[_0xec9d('0x38')]));if(!this[_0xec9d('0x88')](_0xc4ace6[_0xec9d('0x4a')])){return this[_0xec9d('0x3a')][_0xec9d('0x2d')](_0xc4ace6,_0xec9d('0xb8'));}_0xc4ace6[_0xec9d('0x4d')]=moment();if(this[_0xec9d('0x88')](_0xc4ace6['delay'])){_0xc4ace6[_0xec9d('0x4d')]=moment()['add'](_0xc4ace6[_0xec9d('0xb9')],_0xec9d('0xba'));}if(!this[_0xec9d('0x88')](_0xc4ace6['callback_priority'])){_0xc4ace6['callback_priority']=0x2;}this[_0xec9d('0x44')]['sync'](this,_0xc4ace6);return this[_0xec9d('0x3a')][_0xec9d('0xa7')](util['format'](_0xec9d('0xbb'),_0xc4ace6[_0xec9d('0x49')],_0xc4ace6[_0xec9d('0x4a')],_0xc4ace6[_0xec9d('0x4d')]));};AGIVertices[_0xec9d('0x11')]['custom_app']=function(_0x22162c){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')](_0xec9d('0xbc'),_0x22162c[_0xec9d('0x38')]));var _0x1e4eff=this[_0xec9d('0x3a')]['exec'](_0x22162c[_0xec9d('0xbd')],_0x22162c[_0xec9d('0x7b')]);if(_0x1e4eff[_0xec9d('0xa4')]===-0x1){return _0x1e4eff;}return this['channel'][_0xec9d('0xa7')](util[_0xec9d('0x56')]('Executed\x20command\x20%s\x20%s',_0x22162c[_0xec9d('0xbd')],_0x22162c[_0xec9d('0x7b')]));};AGIVertices[_0xec9d('0x11')][_0xec9d('0xbe')]=function(_0x3dc4bf){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')](_0xec9d('0xbf'),_0x3dc4bf[_0xec9d('0x38')]));if(!this[_0xec9d('0x88')](_0x3dc4bf[_0xec9d('0x5d')])){return this[_0xec9d('0x3a')][_0xec9d('0xa7')](_0xec9d('0xa8'));}var _0x5c0f64='\x22'+_0x3dc4bf[_0xec9d('0x5d')]+'\x22';if(this['isConfigured'](_0x3dc4bf['options'])){_0x5c0f64+=','+_0x3dc4bf[_0xec9d('0x7b')];}var _0x5e6568=this[_0xec9d('0x3a')][_0xec9d('0x58')](_0xec9d('0xa9'),_0x5c0f64);if(_0x5e6568[_0xec9d('0xa4')]===-0x1){return _0x5e6568;}return this[_0xec9d('0x3a')][_0xec9d('0xa7')](util[_0xec9d('0x56')](_0xec9d('0xc0'),_0x5c0f64));};AGIVertices['prototype'][_0xec9d('0xc1')]=function(_0xfabc5b){logger['info'](util[_0xec9d('0x56')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0xfabc5b[_0xec9d('0x38')]));if(!this['isConfigured'](_0xfabc5b[_0xec9d('0x5d')])){return this[_0xec9d('0x3a')][_0xec9d('0xa7')](_0xec9d('0xa8'));}var _0x175f59='\x22'+_0xfabc5b['text']+'\x22';if(this['isConfigured'](_0xfabc5b[_0xec9d('0x7b')])){_0x175f59+=','+_0xfabc5b[_0xec9d('0x7b')];}var _0x448540=this[_0xec9d('0x3a')][_0xec9d('0x58')](_0xec9d('0xa9'),_0x175f59);if(_0x448540[_0xec9d('0xa4')]===-0x1){return _0x448540;}return this[_0xec9d('0x3a')]['noop'](util[_0xec9d('0x56')](_0xec9d('0xc0'),_0x175f59));};AGIVertices[_0xec9d('0x11')]['lumenvoxasr']=function(_0x4a6ef9){logger[_0xec9d('0x2f')](util['format'](_0xec9d('0xc2'),_0x4a6ef9['label']));if(!this[_0xec9d('0x88')](_0x4a6ef9[_0xec9d('0xac')])){return this['channel']['noop'](_0xec9d('0xc3'));}var _0x417e4a=_0x4a6ef9['grammar'];if(this[_0xec9d('0x88')](_0x4a6ef9[_0xec9d('0x7b')])){_0x417e4a+=','+_0x4a6ef9[_0xec9d('0x7b')];}var _0x9edc3c=this[_0xec9d('0x3a')]['exec']('MRCPRecog',_0x417e4a);if(_0x9edc3c[_0xec9d('0xa4')]===-0x1){return _0x9edc3c;}var _0x33a564=this[_0xec9d('0xa3')](_0xec9d('0xae'),_0xec9d('0xc4'));if(_0x33a564['result']===-0x1){return _0x33a564;}var _0x50d86e=this[_0xec9d('0xa3')](_0xec9d('0xaf'),_0xec9d('0xc5'));if(_0x50d86e[_0xec9d('0xa4')]===-0x1){return _0x50d86e;}var _0x21efe7=this[_0xec9d('0xa3')](_0xec9d('0xb0'),'LUMENVOX_ASR_INSTANCE');if(_0x21efe7[_0xec9d('0xa4')]===-0x1){return _0x21efe7;}return this[_0xec9d('0x3a')][_0xec9d('0xa7')](util[_0xec9d('0x56')](_0xec9d('0xc6'),_0x417e4a));};AGIVertices['prototype']['sestekasr']=function(_0x55504){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')](_0xec9d('0xc7'),_0x55504[_0xec9d('0x38')]));if(!this[_0xec9d('0x88')](_0x55504[_0xec9d('0xac')])){return this[_0xec9d('0x3a')]['noop'](_0xec9d('0xc3'));}var _0x3172a1=_0x55504[_0xec9d('0xac')];if(this['isConfigured'](_0x55504[_0xec9d('0x7b')])){_0x3172a1+=','+_0x55504[_0xec9d('0x7b')];}var _0xe21b42=this[_0xec9d('0x3a')][_0xec9d('0x58')](_0xec9d('0xad'),_0x3172a1);if(_0xe21b42[_0xec9d('0xa4')]===-0x1){return _0xe21b42;}var _0x1f4aa9=this[_0xec9d('0xa3')](_0xec9d('0xae'),_0xec9d('0xc8'));if(_0x1f4aa9[_0xec9d('0xa4')]===-0x1){return _0x1f4aa9;}var _0x517db1=this[_0xec9d('0xa3')](_0xec9d('0xaf'),'SESTEK_ASR_TRANSCRIPT');if(_0x517db1[_0xec9d('0xa4')]===-0x1){return _0x517db1;}var _0x3634dc=this[_0xec9d('0xa3')](_0xec9d('0xb0'),_0xec9d('0xc9'));if(_0x3634dc[_0xec9d('0xa4')]===-0x1){return _0x3634dc;}return this['channel']['noop'](util[_0xec9d('0x56')](_0xec9d('0xc6'),_0x3172a1));};AGIVertices[_0xec9d('0x11')][_0xec9d('0xca')]=function(_0x46c54e){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x46c54e[_0xec9d('0x38')]));if(!this[_0xec9d('0x88')](_0x46c54e['odbc_id'])){return this[_0xec9d('0x3a')][_0xec9d('0x2d')](_0x46c54e,_0xec9d('0xcb'));}var _0x47ebaf=this[_0xec9d('0x1a')][_0xec9d('0x71')](this,_0x46c54e[_0xec9d('0xcc')]);if(!_0x47ebaf){return this[_0xec9d('0x3a')][_0xec9d('0x2d')](_0x46c54e,'no\x20odbc\x20database\x20found');}if(!this[_0xec9d('0x88')](_0x46c54e[_0xec9d('0xcd')])){return this['channel'][_0xec9d('0x2d')](_0x46c54e,_0xec9d('0xce'));}var _0x1e9a87=_0x46c54e[_0xec9d('0xcd')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xec9d('0x3a')]['noop'](util[_0xec9d('0x56')](_0xec9d('0xcf'),_0x1e9a87));var _0x171203=this[_0xec9d('0x2b')][_0xec9d('0x71')](this,_0x47ebaf,_0x1e9a87);this['createSquareDetailsReport'][_0xec9d('0x71')](this,_0x46c54e,_0x1e9a87);if(!this[_0xec9d('0x88')](_0x46c54e[_0xec9d('0xd0')])){return this['channel']['noop'](_0xec9d('0xd1'));}var _0x405893=this[_0xec9d('0xa1')]['sync'](this,_0x46c54e[_0xec9d('0xd0')]);if(!_0x405893){return this[_0xec9d('0x3a')]['error'](_0x46c54e,_0xec9d('0xd2'));}var _0x39fe2d=this;_0x171203[_0xec9d('0xd3')](function(_0x29dfc0,_0x2e42d2){Object[_0xec9d('0xd4')](_0x29dfc0)[_0xec9d('0xd3')](function(_0x57220e){_0x39fe2d[_0xec9d('0x3a')][_0xec9d('0x9e')](util[_0xec9d('0x56')]('%s[%s][%s]',_0x405893,_0x2e42d2,_0x57220e),_0x29dfc0[_0x57220e]);});});this[_0xec9d('0x3a')]['setVariable'](util[_0xec9d('0x56')]('%s_ROWS_COUNT',_0x405893),_0x171203[_0xec9d('0x9b')]);return this[_0xec9d('0x3a')][_0xec9d('0xa7')](util[_0xec9d('0x56')](_0xec9d('0xd5'),_0x405893));};AGIVertices['prototype'][_0xec9d('0xd6')]=function(_0x27174a){logger[_0xec9d('0xd7')](util[_0xec9d('0x56')](_0xec9d('0xd8'),_0x27174a[_0xec9d('0x38')]));if(!this[_0xec9d('0x88')](_0x27174a[_0xec9d('0xd9')])){return this[_0xec9d('0x3a')][_0xec9d('0x2d')](_0x27174a,_0xec9d('0xda'));}var _0x35ef1e=this['getUser']['sync'](this,_0x27174a[_0xec9d('0xd9')]);if(!_0x35ef1e){return this['channel']['error'](_0x27174a,'no\x20user\x20found');}var _0x41df75=this[_0xec9d('0x3a')][_0xec9d('0x58')](_0xec9d('0xdb'),[util[_0xec9d('0x56')](_0xec9d('0xdc'),_0x35ef1e),_0x27174a[_0xec9d('0x68')],_0x27174a[_0xec9d('0xdd')],_0x27174a[_0xec9d('0x66')]]);if(_0x41df75[_0xec9d('0xa4')]===-0x1){return _0x41df75;}return this[_0xec9d('0x3a')][_0xec9d('0xa7')](util[_0xec9d('0x56')](_0xec9d('0xde'),'DIAL'));};AGIVertices[_0xec9d('0x11')]['dialogflow']=function(_0x21209d){logger['info'](util[_0xec9d('0x56')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x21209d[_0xec9d('0x38')]));if(!this['isConfigured'](_0x21209d[_0xec9d('0x7c')])){return this['channel']['noop']('no\x20key\x20configured');}if(!this[_0xec9d('0x88')](_0x21209d[_0xec9d('0x5d')])){return this[_0xec9d('0x3a')][_0xec9d('0xa7')](_0xec9d('0xa8'));}this[_0xec9d('0x3a')]['bot']=!![];this[_0xec9d('0x36')](_0x21209d);this['createSquareMessage'](_0x21209d[_0xec9d('0x5d')],'in','','');this[_0xec9d('0x3a')][_0xec9d('0xa7')](util['format'](_0xec9d('0xdf'),_0x21209d[_0xec9d('0x5d')]));var _0x12a0eb=this[_0xec9d('0xe0')]['sync'](this,_0x21209d);if(_0x12a0eb){for(var _0x5d94f3 in _0x12a0eb){if(_0x12a0eb[_0xec9d('0xe1')](_0x5d94f3)){this['channel']['setVariable'](util[_0xec9d('0x56')]('DIALOGFLOW_%s',_0x5d94f3[_0xec9d('0x6c')]()),_0x12a0eb[_0x5d94f3]);}}this[_0xec9d('0x43')](_0x12a0eb['speech'],_0xec9d('0xe2'),'dialogflow','');return this['channel']['noop'](util[_0xec9d('0x56')](_0xec9d('0xe3'),_0x12a0eb[_0xec9d('0xe4')]));}return this[_0xec9d('0x3a')][_0xec9d('0x2d')](_0x21209d,_0xec9d('0xe5'));};AGIVertices[_0xec9d('0x11')][_0xec9d('0xe6')]=function(_0x1acb44){logger[_0xec9d('0x2f')](util['format'](_0xec9d('0xe7'),_0x1acb44[_0xec9d('0x38')]));if(!this[_0xec9d('0x88')](_0x1acb44['dialogflowV2_project_id'])){return this[_0xec9d('0x3a')][_0xec9d('0xa7')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0x1acb44[_0xec9d('0x80')])){return this[_0xec9d('0x3a')][_0xec9d('0xa7')](_0xec9d('0xe8'));}if(!this[_0xec9d('0x88')](_0x1acb44[_0xec9d('0xe9')])){return this[_0xec9d('0x3a')]['noop'](_0xec9d('0xea'));}if(!this[_0xec9d('0x88')](_0x1acb44[_0xec9d('0x81')])){return this[_0xec9d('0x3a')]['noop']('no\x20anguage\x20configured');}if(!this[_0xec9d('0x88')](_0x1acb44['text'])){return this[_0xec9d('0x3a')][_0xec9d('0xa7')](_0xec9d('0xa8'));}this[_0xec9d('0x3a')][_0xec9d('0xeb')]=!![];this[_0xec9d('0x36')](_0x1acb44);this[_0xec9d('0x43')](_0x1acb44[_0xec9d('0x5d')],'in','','');this['channel']['noop'](util['format'](_0xec9d('0xec'),_0x1acb44['text']));var _0x1ba621=this[_0xec9d('0x7e')]['sync'](this,_0x1acb44);if(_0x1ba621){for(var _0x41fe12 in _0x1ba621){if(_0x1ba621['hasOwnProperty'](_0x41fe12)){if(_0x41fe12!==_0xec9d('0xed')){this['channel'][_0xec9d('0x9e')](util[_0xec9d('0x56')]('DIALOGFLOW_%s',_0x41fe12[_0xec9d('0x6c')]()),_0x1ba621[_0x41fe12]);}}}this[_0xec9d('0x43')](_0x1ba621[_0xec9d('0xe4')],_0xec9d('0xe2'),_0xec9d('0xe6'),_0x1ba621[_0xec9d('0xed')]);return this['channel']['noop'](util[_0xec9d('0x56')](_0xec9d('0xee'),_0x1ba621['speech']));}return this[_0xec9d('0x3a')][_0xec9d('0x2d')](_0x1acb44,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xec9d('0x11')][_0xec9d('0xef')]=function(_0x22bf6c){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')](_0xec9d('0xf0'),_0x22bf6c['label']));if(!this[_0xec9d('0x88')](_0x22bf6c['ndauth_url'])){return this[_0xec9d('0x3a')]['noop'](_0xec9d('0xf1'));}if(!this['isConfigured'](_0x22bf6c[_0xec9d('0xf2')])){return this['channel']['noop'](_0xec9d('0xf3'));}if(!this[_0xec9d('0x88')](_0x22bf6c['password'])){return this[_0xec9d('0x3a')][_0xec9d('0xa7')](_0xec9d('0xf4'));}if(!this[_0xec9d('0x88')](_0x22bf6c[_0xec9d('0xf5')])){return this[_0xec9d('0x3a')][_0xec9d('0xa7')](_0xec9d('0xa8'));}this[_0xec9d('0x3a')][_0xec9d('0xeb')]=!![];this[_0xec9d('0x36')](_0x22bf6c);this[_0xec9d('0x43')](_0x22bf6c[_0xec9d('0x5d')],'in','','');this[_0xec9d('0x3a')][_0xec9d('0xa7')](util[_0xec9d('0x56')](_0xec9d('0xf6'),_0x22bf6c[_0xec9d('0x5d')]));var _0x37af82=this[_0xec9d('0x82')][_0xec9d('0x71')](this,_0x22bf6c);if(_0x37af82){for(var _0x196531 in _0x37af82){if(_0x37af82[_0xec9d('0xe1')](_0x196531)){this[_0xec9d('0x3a')][_0xec9d('0x9e')](util['format'](_0xec9d('0xf7'),_0x196531[_0xec9d('0x6c')]()),_0x37af82[_0x196531]);}}this[_0xec9d('0x43')](_0x37af82[_0xec9d('0xe4')],_0xec9d('0xe2'),_0xec9d('0xef'),'');if(_0x37af82[_0xec9d('0xf8')]){this[_0xec9d('0x3a')][_0xec9d('0xa7')](util[_0xec9d('0x56')](_0xec9d('0xf9'),_0x37af82[_0xec9d('0xf8')]));var _0x1e4c67=this[_0xec9d('0x3a')][_0xec9d('0xfa')](_0x37af82[_0xec9d('0xf8')]);try{fs[_0xec9d('0xfb')](_0x37af82[_0xec9d('0xf8')]+_0xec9d('0xfc'));}catch(_0x34a8df){logger[_0xec9d('0x2d')](_0x34a8df);}return _0x1e4c67;}else{return this['channel'][_0xec9d('0xa7')](util[_0xec9d('0x56')](_0xec9d('0xfd'),_0x37af82['speech']));}}return this['channel'][_0xec9d('0x2d')](_0x22bf6c,_0xec9d('0xfe'));};AGIVertices['prototype'][_0xec9d('0xff')]=function(_0x5f4356){logger[_0xec9d('0x2f')](util['format'](_0xec9d('0x100'),_0x5f4356[_0xec9d('0x38')]));return this[_0xec9d('0x3a')]['noop'](_0xec9d('0xff'));};AGIVertices[_0xec9d('0x11')]['ext_dial']=function(_0x415450){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x415450[_0xec9d('0x38')]));var _0x3c2c07='';if(_0x415450[_0xec9d('0x101')]){if(!this[_0xec9d('0x88')](_0x415450[_0xec9d('0x101')])){return this[_0xec9d('0x3a')]['error'](_0x415450,_0xec9d('0x102'));}else{var _0x47906a=parseInt(_0x415450[_0xec9d('0x101')],0xa);if(isNaN(_0x47906a)){_0x3c2c07=_0x415450[_0xec9d('0x101')];}else{_0x3c2c07=this[_0xec9d('0x1f')][_0xec9d('0x71')](this,_0x415450['trunk_id']);if(!_0x3c2c07){return this[_0xec9d('0x3a')][_0xec9d('0x2d')](_0x415450,'no\x20trunk\x20found');}}}}else if(_0x415450['trunk_name']){_0x3c2c07=_0x415450[_0xec9d('0x103')];}else{return this[_0xec9d('0x3a')]['error'](_0x415450,_0xec9d('0x102'));}var _0x16b1cc=this['channel'][_0xec9d('0x58')](_0xec9d('0xdb'),[util[_0xec9d('0x56')](_0xec9d('0x104'),_0x3c2c07,_0x415450[_0xec9d('0x49')]),_0x415450[_0xec9d('0x68')],_0x415450[_0xec9d('0xdd')],_0x415450[_0xec9d('0x66')]]);if(_0x16b1cc[_0xec9d('0xa4')]===-0x1){return _0x16b1cc;}return this[_0xec9d('0x3a')]['noop'](util['format']('Executed\x20command\x20%s',_0xec9d('0xdb')));};AGIVertices[_0xec9d('0x11')][_0xec9d('0x105')]=function(_0x57643b){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x57643b[_0xec9d('0x38')]));return this[_0xec9d('0x3a')][_0xec9d('0xa7')](_0xec9d('0x105'));};AGIVertices['prototype']['getdigits']=function(_0x365630){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')](_0xec9d('0x106'),_0x365630[_0xec9d('0x38')]));if(_0x365630[_0xec9d('0x107')]===0x0){return this['maxRetry'](_0x365630);}_0x365630[_0xec9d('0x107')]-=0x1;if(!this[_0xec9d('0x88')](_0x365630[_0xec9d('0x108')])){return this[_0xec9d('0x3a')][_0xec9d('0x2d')](_0x365630,_0xec9d('0x109'));}var _0x55f09c=this[_0xec9d('0x21')][_0xec9d('0x71')](this,_0x365630[_0xec9d('0x108')]);if(!_0x55f09c){return this[_0xec9d('0x3a')][_0xec9d('0x2d')](_0x365630,_0xec9d('0x10a'));}if(!this[_0xec9d('0x88')](_0x365630[_0xec9d('0xd0')])){return this['channel'][_0xec9d('0x2d')](_0xec9d('0xd1'));}var _0x1b4da6=this['channel'][_0xec9d('0x10b')](_0x55f09c,_0x365630[_0xec9d('0x10c')],_0x365630[_0xec9d('0x10d')]);var _0x2ba703=_0x1b4da6[_0xec9d('0xa4')]?_0x1b4da6[_0xec9d('0xa4')][_0xec9d('0x4e')]():'';logger[_0xec9d('0x2f')](_0xec9d('0x10e'),JSON[_0xec9d('0x74')](_0x1b4da6));if(_0x1b4da6['result']===-0x1){this[_0xec9d('0x36')][_0xec9d('0x71')](this,_0x365630,_0x2ba703);return _0x1b4da6;}else if(_0x1b4da6[_0xec9d('0xa2')]===_0xec9d('0x68')){_0x1b4da6[_0xec9d('0xa4')]=_0x2ba703['length']>=parseInt(_0x365630['mindigit'])?'x':'i';}else{_0x1b4da6[_0xec9d('0xa4')]=_0x2ba703[_0xec9d('0x9b')]>=parseInt(_0x365630[_0xec9d('0x10f')])&&_0x2ba703[_0xec9d('0x9b')]<=parseInt(_0x365630['maxdigit'])?'x':'i';}var _0x4b5a0f=this[_0xec9d('0xa1')][_0xec9d('0x71')](this,_0x365630[_0xec9d('0xd0')]);if(!_0x4b5a0f){return this[_0xec9d('0x3a')][_0xec9d('0x2d')](_0x365630,'no\x20variable\x20found');}this[_0xec9d('0x3a')][_0xec9d('0x9e')](_0x4b5a0f,_0x2ba703);if(this['isConfigured'](_0x365630[_0xec9d('0x110')])){var _0x1e6db8=parseInt(_0x365630[_0xec9d('0x110')],0xa);var _0x56f933=rs[_0xec9d('0x111')]({'charset':'*','length':_0x1e6db8});var _0x373d29=_0x2ba703[_0xec9d('0x9b')];if(_0x373d29>0x0){if(_0x373d29>_0x1e6db8){this[_0xec9d('0x36')][_0xec9d('0x71')](this,_0x365630,_0x365630['hiddendigitspos']===_0xec9d('0x112')?_0x56f933+_0x2ba703[_0xec9d('0x113')](_0x1e6db8):_0x2ba703['substr'](0x0,_0x373d29-_0x1e6db8)+_0x56f933);}else{this[_0xec9d('0x36')][_0xec9d('0x71')](this,_0x365630,rs[_0xec9d('0x111')]({'charset':'*','length':_0x373d29}));}}else{this[_0xec9d('0x36')][_0xec9d('0x71')](this,_0x365630,'');}}else{this[_0xec9d('0x36')][_0xec9d('0x71')](this,_0x365630,_0x2ba703);}return _0x1b4da6;};AGIVertices[_0xec9d('0x11')][_0xec9d('0xf')]=function(_0x561480){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')](_0xec9d('0x114'),_0x561480[_0xec9d('0x38')]));return this['getdigits'](_0x561480);};AGIVertices[_0xec9d('0x11')][_0xec9d('0x115')]=function(_0x1fa311){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')](_0xec9d('0x116'),_0x1fa311[_0xec9d('0x38')]));this['createSquareDetailsReport']['sync'](this,_0x1fa311,_0x1fa311['goalname']);return this['channel'][_0xec9d('0xa7')](util[_0xec9d('0x56')]('GOAL\x20%s',_0x1fa311['goalname']));};AGIVertices['prototype'][_0xec9d('0x117')]=function(_0x3c94a0){logger[_0xec9d('0x2f')](util['format']('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x3c94a0[_0xec9d('0x38')]));if(!this[_0xec9d('0x88')](_0x3c94a0['aws_access_key_id'])||!this[_0xec9d('0x88')](_0x3c94a0[_0xec9d('0x118')])){return this[_0xec9d('0x3a')]['noop'](_0xec9d('0x119'));}if(!this['isConfigured'](_0x3c94a0[_0xec9d('0x5d')])){return this[_0xec9d('0x3a')]['noop'](_0xec9d('0xa8'));}this[_0xec9d('0x3a')][_0xec9d('0xa7')](util['format'](_0xec9d('0x11a'),_0x3c94a0[_0xec9d('0x5d')]));var _0x201e11=this[_0xec9d('0x8a')]['sync'](this,_0x3c94a0);if(_0x201e11){this[_0xec9d('0x3a')][_0xec9d('0xa7')](util[_0xec9d('0x56')](_0xec9d('0x11b'),_0x201e11));var _0x321142=this[_0xec9d('0x3a')][_0xec9d('0xfa')](_0x201e11);try{fs[_0xec9d('0xfb')](_0x201e11+_0xec9d('0xfc'));}catch(_0x774b10){logger['error'](_0x774b10);}return _0x321142;}return this[_0xec9d('0x3a')][_0xec9d('0x2d')](_0x3c94a0,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0xec9d('0x11')][_0xec9d('0x11c')]=function(_0xda95cc){logger[_0xec9d('0x2f')](util['format'](_0xec9d('0x11d'),_0xda95cc[_0xec9d('0x38')]));if(!this[_0xec9d('0x88')](_0xda95cc['aws_access_key_id'])||!this['isConfigured'](_0xda95cc[_0xec9d('0x118')])){return this[_0xec9d('0x3a')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0xec9d('0x88')](_0xda95cc['aws_bot_name'])){return this[_0xec9d('0x3a')][_0xec9d('0xa7')](_0xec9d('0x11e'));}if(!this[_0xec9d('0x88')](_0xda95cc[_0xec9d('0x5d')])){return this['channel'][_0xec9d('0xa7')](_0xec9d('0xa8'));}this[_0xec9d('0x3a')][_0xec9d('0xeb')]=!![];this[_0xec9d('0x36')](_0xda95cc);this['createSquareMessage'](_0xda95cc[_0xec9d('0x5d')],'in','','');this[_0xec9d('0x3a')][_0xec9d('0xa7')](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0xda95cc[_0xec9d('0x5d')]));var _0x19e02e=this[_0xec9d('0x8f')][_0xec9d('0x71')](this,_0xda95cc);if(_0x19e02e){for(var _0xb865ea in _0x19e02e){if(_0x19e02e[_0xec9d('0xe1')](_0xb865ea)&&_[_0xec9d('0x95')](_0x19e02e[_0xb865ea])){this[_0xec9d('0x3a')][_0xec9d('0x9e')](util[_0xec9d('0x56')](_0xec9d('0x11f'),_0xb865ea[_0xec9d('0x6c')]()),_0x19e02e[_0xb865ea]);}}if(_[_0xec9d('0x46')](_0x19e02e[_0xec9d('0x79')])){return this['channel'][_0xec9d('0xa7')](_0xec9d('0x120'));}else{this[_0xec9d('0x43')](_0x19e02e[_0xec9d('0x79')],_0xec9d('0xe2'),_0xec9d('0x121'),'');return this[_0xec9d('0x3a')][_0xec9d('0xa7')](util[_0xec9d('0x56')]('Amazon\x20Lex\x20Result\x20%s',_0x19e02e['message']));}}return this[_0xec9d('0x3a')][_0xec9d('0x2d')](_0xda95cc,_0xec9d('0x122'));};AGIVertices[_0xec9d('0x11')]['googleasr']=function(_0x22f8b4){logger['info'](util['format'](_0xec9d('0x123'),_0x22f8b4[_0xec9d('0x38')],_0x22f8b4[_0xec9d('0x68')]));if(!this[_0xec9d('0x88')](_0x22f8b4['key'])){return this[_0xec9d('0x3a')][_0xec9d('0xa7')](_0xec9d('0x124'));}var _0x694ba3='wav';var _0x1aeeb7=util['format'](_0xec9d('0x125'),FILES_PATH,rs[_0xec9d('0x111')](0x4));var _0x1f2736=util['format']('%s.%s',_0x1aeeb7,_0x694ba3);var _0x424e40=!![];if(_0x22f8b4[_0xec9d('0x126')]===_0xec9d('0x127')){_0x424e40=![];}var _0x26f25a=this[_0xec9d('0x3a')][_0xec9d('0x128')](_0x1aeeb7,_0x694ba3,_0x22f8b4['intKey'],_0x22f8b4['timeout'],undefined,_0x424e40);if(_0x26f25a[_0xec9d('0xa4')]!==-0x1){this[_0xec9d('0x3a')][_0xec9d('0xa7')](util[_0xec9d('0x56')](_0xec9d('0x129'),_0x1f2736));var _0x34a62d=this['googleASR'][_0xec9d('0x71')](this,_0x22f8b4,_0x1f2736);if(_0x34a62d){for(var _0x1b4397 in _0x34a62d){if(_0x34a62d[_0xec9d('0xe1')](_0x1b4397)){this['channel']['setVariable'](util['format'](_0xec9d('0x12a'),_0x1b4397['toUpperCase']()),_0x34a62d[_0x1b4397]);}}return this[_0xec9d('0x3a')]['noop'](util['format'](_0xec9d('0x12b'),JSON['stringify'](_0x34a62d)));}}return _0x26f25a;};AGIVertices[_0xec9d('0x11')][_0xec9d('0x12c')]=function(_0x280c52){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')](_0xec9d('0x12d'),_0x280c52[_0xec9d('0x38')]));if(!this['isConfigured'](_0x280c52['appid'])){return this[_0xec9d('0x3a')]['noop'](_0xec9d('0x12e'));}if(!this[_0xec9d('0x88')](_0x280c52[_0xec9d('0x12f')])){return this[_0xec9d('0x3a')][_0xec9d('0xa7')](_0xec9d('0x130'));}var _0x564733=_0xec9d('0x131');var _0x574cff=util[_0xec9d('0x56')](_0xec9d('0x125'),FILES_PATH,rs[_0xec9d('0x111')](0x4));var _0x4bc9ca=util[_0xec9d('0x56')]('%s.%s',_0x574cff,_0x564733);var _0x515797=!![];if(_0x280c52[_0xec9d('0x126')]===_0xec9d('0x127')){_0x515797=![];}var _0x5accdd=this['channel'][_0xec9d('0x128')](_0x574cff,_0x564733,_0x280c52[_0xec9d('0x132')],_0x280c52[_0xec9d('0x68')],undefined,_0x515797);if(_0x5accdd['result']!==-0x1){this[_0xec9d('0x3a')][_0xec9d('0xa7')](util[_0xec9d('0x56')](_0xec9d('0x133'),_0x4bc9ca));var _0x22b0f4=this['tildeASR']['sync'](this,_0x280c52,_0x4bc9ca);if(_0x22b0f4){for(var _0x53fa44 in _0x22b0f4){if(_0x22b0f4['hasOwnProperty'](_0x53fa44)){this[_0xec9d('0x3a')][_0xec9d('0x9e')](util['format'](_0xec9d('0x134'),_0x53fa44[_0xec9d('0x6c')]()),_0x22b0f4[_0x53fa44]);}}return this[_0xec9d('0x3a')][_0xec9d('0xa7')](util[_0xec9d('0x56')](_0xec9d('0x135'),JSON[_0xec9d('0x74')](_0x22b0f4)));}}return _0x5accdd;};AGIVertices[_0xec9d('0x11')][_0xec9d('0x136')]=function(_0x1bcbba){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')](_0xec9d('0x137'),_0x1bcbba[_0xec9d('0x38')]));return this['channel'][_0xec9d('0x138')](_0x1bcbba['context'],_0x1bcbba[_0xec9d('0x139')],_0x1bcbba[_0xec9d('0x40')]);};AGIVertices['prototype'][_0xec9d('0x13a')]=function(_0x2ca12c){logger[_0xec9d('0x2f')](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x2ca12c['label']));if(!this['isConfigured'](_0x2ca12c[_0xec9d('0x13b')])){return this[_0xec9d('0x3a')][_0xec9d('0x2d')](_0x2ca12c,_0xec9d('0x13c'));}try{var _0x1e384c=eval(_0x2ca12c['condition'])?_0xec9d('0x13d'):_0xec9d('0x13e');this['channel'][_0xec9d('0xa7')](util['format'](_0xec9d('0x13f'),_0x2ca12c['condition'],_0x1e384c));return{'code':0xc8,'result':_0x1e384c};}catch(_0x1ffd01){return{'code':0xc8,'result':'false'};}};AGIVertices['prototype'][_0xec9d('0x140')]=function(_0x50fd29){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')](_0xec9d('0x141'),_0x50fd29[_0xec9d('0x38')]));if(!this['isConfigured'](_0x50fd29[_0xec9d('0x142')])){return this[_0xec9d('0x3a')][_0xec9d('0x2d')](_0x50fd29,_0xec9d('0x143'));}var _0x249570=this['getIntervals'][_0xec9d('0x71')](this,_0x50fd29[_0xec9d('0x142')]);if(!_0x249570){return this['channel'][_0xec9d('0x2d')](_0x50fd29,_0xec9d('0x144'));}for(var _0x3ead12=0x0;_0x3ead12<_0x249570[_0xec9d('0x9b')];_0x3ead12+=0x1){var _0x27094b=this[_0xec9d('0x3a')][_0xec9d('0xa1')](util[_0xec9d('0x56')](_0xec9d('0x145'),_0x249570[_0x3ead12]));if(_0x27094b['result']===-0x1){return _0x27094b;}logger['info'](util[_0xec9d('0x56')]('IFTIME\x20%s\x20%s',_0x249570[_0x3ead12],_0x27094b['extra']));if(_0x27094b[_0xec9d('0xa2')]==='true'){logger['info'](util[_0xec9d('0x56')](_0xec9d('0x146'),_0x249570[_0x3ead12],'true'));this[_0xec9d('0x3a')][_0xec9d('0xa7')](util['format']('IFTIME\x20%s\x20%s',_0x249570[_0x3ead12],_0xec9d('0x13d')));return{'code':0xc8,'result':_0xec9d('0x13d')};}else{logger['info'](util[_0xec9d('0x56')](_0xec9d('0x146'),_0x249570[_0x3ead12],_0xec9d('0x13e')));this[_0xec9d('0x3a')][_0xec9d('0xa7')](util[_0xec9d('0x56')](_0xec9d('0x146'),_0x249570[_0x3ead12],'false'));}}return{'code':0xc8,'result':_0xec9d('0x13e')};};AGIVertices['prototype'][_0xec9d('0x147')]=function(_0x54946d){logger['info'](util[_0xec9d('0x56')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x54946d['label']));return this[_0xec9d('0x3a')][_0xec9d('0x147')]();};AGIVertices[_0xec9d('0x11')][_0xec9d('0x148')]=function(_0x3a6c74){logger[_0xec9d('0x2f')](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x3a6c74['label']));if(!this[_0xec9d('0x88')](_0x3a6c74[_0xec9d('0x7c')])){return this[_0xec9d('0x3a')][_0xec9d('0xa7')](_0xec9d('0x124'));}var _0x497623='wav';var _0x57ed2f=util[_0xec9d('0x56')](_0xec9d('0x125'),FILES_PATH,rs[_0xec9d('0x111')](0x4));var _0x48b1ec=util[_0xec9d('0x56')]('%s.%s',_0x57ed2f,_0x497623);var _0x326b29=!![];if(_0x3a6c74[_0xec9d('0x126')]===_0xec9d('0x127')){_0x326b29=![];}var _0x54ce4d=this['channel']['recordFile'](_0x57ed2f,_0x497623,_0x3a6c74['intKey'],_0x3a6c74[_0xec9d('0x68')],undefined,_0x326b29);if(_0x54ce4d[_0xec9d('0xa4')]!==-0x1){this[_0xec9d('0x3a')]['noop'](util[_0xec9d('0x56')](_0xec9d('0x149'),_0x48b1ec));var _0x56cd71=this[_0xec9d('0x86')][_0xec9d('0x71')](this,_0x3a6c74,_0x48b1ec);if(_0x56cd71){for(var _0x7fe54 in _0x56cd71){if(_0x56cd71[_0xec9d('0xe1')](_0x7fe54)){this['channel']['setVariable'](util[_0xec9d('0x56')](_0xec9d('0x14a'),_0x7fe54[_0xec9d('0x6c')]()),_0x56cd71[_0x7fe54]);}}return this[_0xec9d('0x3a')][_0xec9d('0xa7')](util[_0xec9d('0x56')](_0xec9d('0x14b'),JSON[_0xec9d('0x74')](_0x56cd71)));}}return _0x54ce4d;};AGIVertices[_0xec9d('0x11')][_0xec9d('0x14c')]=function(_0x5aacb6){logger[_0xec9d('0x2f')](util['format'](_0xec9d('0x14d'),_0x5aacb6[_0xec9d('0x38')]));if(!this[_0xec9d('0x88')](_0x5aacb6[_0xec9d('0x7c')])){return this['channel'][_0xec9d('0xa7')](_0xec9d('0x124'));}if(!this[_0xec9d('0x88')](_0x5aacb6[_0xec9d('0x5d')])){return this[_0xec9d('0x3a')][_0xec9d('0xa7')](_0xec9d('0xa8'));}this[_0xec9d('0x3a')][_0xec9d('0xa7')](util[_0xec9d('0x56')](_0xec9d('0x14e'),_0x5aacb6[_0xec9d('0x5d')]));var _0x1dc5a0=this[_0xec9d('0x83')][_0xec9d('0x71')](this,_0x5aacb6);if(_0x1dc5a0){this[_0xec9d('0x3a')][_0xec9d('0xa7')](util['format'](_0xec9d('0x149'),_0x1dc5a0));var _0x38ea1e=this[_0xec9d('0x3a')][_0xec9d('0xfa')](_0x1dc5a0,_0x5aacb6['intKey']);try{fs['unlink'](_0x1dc5a0+_0xec9d('0xfc'));}catch(_0x350411){logger[_0xec9d('0x2d')](_0x350411);}return _0x38ea1e;}return this[_0xec9d('0x3a')][_0xec9d('0x2d')](_0x5aacb6,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xec9d('0x11')][_0xec9d('0x14f')]=function(_0x456a11){logger['info'](util[_0xec9d('0x56')](_0xec9d('0x150'),_0x456a11['label']));if(!this['isConfigured'](_0x456a11['findBy'])){return this[_0xec9d('0x3a')]['error'](_0x456a11,_0xec9d('0x151'));}logger[_0xec9d('0x2f')](util[_0xec9d('0x56')](_0xec9d('0x152'),this[_0xec9d('0x3a')]['callerid'],_0x456a11[_0xec9d('0x153')]));var _0x137b81=this[_0xec9d('0x55')][_0xec9d('0x71')](this,_0x456a11[_0xec9d('0x153')]);if(_0x137b81){logger['info'](util[_0xec9d('0x56')](_0xec9d('0x154'),this[_0xec9d('0x3a')][_0xec9d('0x3c')],_0x456a11[_0xec9d('0x153')]));this[_0xec9d('0x3a')][_0xec9d('0xa7')](util[_0xec9d('0x56')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xec9d('0x3a')]['callerid'],_0x456a11[_0xec9d('0x153')]));return{'code':0xc8,'result':'success'};}else{logger[_0xec9d('0x2f')](util['format'](_0xec9d('0x155'),this[_0xec9d('0x3a')][_0xec9d('0x3c')],_0x456a11[_0xec9d('0x153')]));this[_0xec9d('0x3a')][_0xec9d('0xa7')](util['format'](_0xec9d('0x155'),this[_0xec9d('0x3a')]['callerid'],_0x456a11[_0xec9d('0x153')]));return{'code':0xc8,'result':_0xec9d('0x156')};}};AGIVertices['prototype'][_0xec9d('0x157')]=function(_0x227a96){logger[_0xec9d('0x2f')](util['format']('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x227a96[_0xec9d('0x38')]));if(!this['isConfigured'](_0x227a96[_0xec9d('0x153')])){return this[_0xec9d('0x3a')][_0xec9d('0x2d')](_0x227a96,_0xec9d('0x151'));}logger[_0xec9d('0x2f')](util[_0xec9d('0x56')](_0xec9d('0x152'),this['channel'][_0xec9d('0x3c')],_0x227a96[_0xec9d('0x153')]));var _0x19b2c7=this[_0xec9d('0x54')][_0xec9d('0x71')](this,_0x227a96[_0xec9d('0x153')]);if(_0x19b2c7){logger[_0xec9d('0x2f')](util['format'](_0xec9d('0x154'),this[_0xec9d('0x3a')][_0xec9d('0x3c')],_0x227a96[_0xec9d('0x153')]));this['channel'][_0xec9d('0xa7')](util[_0xec9d('0x56')](_0xec9d('0x154'),this[_0xec9d('0x3a')][_0xec9d('0x3c')],_0x227a96[_0xec9d('0x153')]));return{'code':0xc8,'result':'success'};}else{logger[_0xec9d('0x2f')](util[_0xec9d('0x56')](_0xec9d('0x155'),this[_0xec9d('0x3a')][_0xec9d('0x3c')],_0x227a96['findBy']));this[_0xec9d('0x3a')][_0xec9d('0xa7')](util[_0xec9d('0x56')](_0xec9d('0x155'),this[_0xec9d('0x3a')]['callerid'],_0x227a96['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xec9d('0x11')]['math']=function(_0x16dc7c){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')](_0xec9d('0x158'),_0x16dc7c[_0xec9d('0x38')]));if(!this[_0xec9d('0x88')](_0x16dc7c[_0xec9d('0x159')])){return this[_0xec9d('0x3a')][_0xec9d('0x2d')](_0x16dc7c,_0xec9d('0x15a'));}this[_0xec9d('0x3a')][_0xec9d('0xa7')](util[_0xec9d('0x56')](_0xec9d('0x15b'),_0x16dc7c[_0xec9d('0x159')]));var _0x1c0cd8=eval(_0x16dc7c['operation']);if(!this['isConfigured'](_0x16dc7c[_0xec9d('0xd0')])){return this[_0xec9d('0x3a')][_0xec9d('0xa7')](_0xec9d('0xd1'));}var _0x50c069=this[_0xec9d('0xa1')]['sync'](this,_0x16dc7c[_0xec9d('0xd0')]);if(!_0x50c069){return this['channel']['error'](_0x16dc7c,_0xec9d('0xd2'));}if(_[_0xec9d('0x9a')](_0x1c0cd8)){var _0x3b3475=this;_0x1c0cd8[_0xec9d('0xd3')](function(_0x251684,_0x445ea7){_0x3b3475['channel'][_0xec9d('0x9e')](util[_0xec9d('0x56')](_0xec9d('0x15c'),_0x50c069,_0x445ea7),_0x251684);});return this['channel']['noop'](util[_0xec9d('0x56')]('variable\x20%s[key]\x20set',_0x50c069));}else{return this[_0xec9d('0x3a')][_0xec9d('0x9e')](_0x50c069,_0x1c0cd8);}};AGIVertices[_0xec9d('0x11')][_0xec9d('0xe')]=function(_0x49b126){logger['info'](util[_0xec9d('0x56')](_0xec9d('0x15d'),_0x49b126[_0xec9d('0x38')]));if(_0x49b126[_0xec9d('0x107')]===0x0){return this[_0xec9d('0x15e')](_0x49b126);}_0x49b126[_0xec9d('0x107')]-=0x1;if(!this[_0xec9d('0x88')](_0x49b126[_0xec9d('0x108')])){return this[_0xec9d('0x3a')]['error'](_0x49b126,_0xec9d('0x109'));}var _0x55c574=this['getSound'][_0xec9d('0x71')](this,_0x49b126[_0xec9d('0x108')]);if(!_0x55c574){return this[_0xec9d('0x3a')][_0xec9d('0x2d')](_0x49b126,'no\x20file\x20audio\x20found');}var _0x17b3a5=this[_0xec9d('0x3a')]['getData'](_0x55c574,_0x49b126[_0xec9d('0x10c')],_0x49b126[_0xec9d('0x15f')]);var _0x338f5f=_0x17b3a5[_0xec9d('0xa4')];if(_0x17b3a5['result']===-0x1){this[_0xec9d('0x36')][_0xec9d('0x71')](this,_0x49b126,'-1');return _0x17b3a5;}else if(_0x17b3a5[_0xec9d('0xa2')]===_0xec9d('0x68')){_0x17b3a5[_0xec9d('0xa4')]=_0x17b3a5[_0xec9d('0xa4')][_0xec9d('0x9b')]>0x0?_0x17b3a5[_0xec9d('0xa4')]:'t';}else if(_[_0xec9d('0x45')](_0x17b3a5['result'])){_0x17b3a5[_0xec9d('0xa4')]='#';_0x338f5f='#';}if(!this[_0xec9d('0x88')](_0x49b126[_0xec9d('0xd0')])){this[_0xec9d('0x3a')][_0xec9d('0xa7')](_0xec9d('0xd1'));}else{var _0x81b686=this[_0xec9d('0xa1')]['sync'](this,_0x49b126[_0xec9d('0xd0')]);if(!_0x81b686){return this[_0xec9d('0x3a')][_0xec9d('0x2d')](_0x49b126,'no\x20variable\x20found');}this[_0xec9d('0x3a')][_0xec9d('0x9e')](_0x81b686,_0x338f5f);}this[_0xec9d('0x36')][_0xec9d('0x71')](this,_0x49b126,_0x338f5f);return _0x17b3a5;};AGIVertices[_0xec9d('0x11')][_0xec9d('0xa7')]=function(_0x6eb022){logger[_0xec9d('0x2f')](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x6eb022['label']));return this[_0xec9d('0x3a')][_0xec9d('0xa7')](_0x6eb022['output']||_0x6eb022[_0xec9d('0x38')]);};AGIVertices[_0xec9d('0x11')][_0xec9d('0x160')]=function(_0x30b308){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x30b308[_0xec9d('0x38')]));if(!this['isConfigured'](_0x30b308[_0xec9d('0x153')])){return this['channel'][_0xec9d('0x2d')](_0x30b308,'no\x20find\x20by\x20configured');}logger['info'](util[_0xec9d('0x56')](_0xec9d('0x152'),this[_0xec9d('0x3a')][_0xec9d('0x3c')],_0x30b308[_0xec9d('0x153')]));var _0x560240=this[_0xec9d('0x161')][_0xec9d('0x71')](this,_0x30b308['pause_id']);var _0x50f356=this[_0xec9d('0x51')][_0xec9d('0x71')](this,_0x30b308['findBy'],_0x560240);if(_0x50f356){logger['info'](util[_0xec9d('0x56')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xec9d('0x3a')][_0xec9d('0x3c')],_0x30b308[_0xec9d('0x153')]));this[_0xec9d('0x3a')][_0xec9d('0xa7')](util[_0xec9d('0x56')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xec9d('0x3a')][_0xec9d('0x3c')],_0x30b308['findBy']));return{'code':0xc8,'result':_0xec9d('0x162')};}else{logger[_0xec9d('0x2f')](util[_0xec9d('0x56')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xec9d('0x3a')]['callerid'],_0x30b308[_0xec9d('0x153')]));this[_0xec9d('0x3a')][_0xec9d('0xa7')](util[_0xec9d('0x56')](_0xec9d('0x154'),this[_0xec9d('0x3a')]['callerid'],_0x30b308[_0xec9d('0x153')]));return{'code':0xc8,'result':_0xec9d('0x156')};}};AGIVertices[_0xec9d('0x11')]['playback']=function(_0x48ffe){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')](_0xec9d('0x163'),_0x48ffe[_0xec9d('0x38')]));if(!this['isConfigured'](_0x48ffe[_0xec9d('0x108')])){return this[_0xec9d('0x3a')][_0xec9d('0x2d')](_0x48ffe,_0xec9d('0x109'));}var _0x4829fa=this[_0xec9d('0x21')][_0xec9d('0x71')](this,_0x48ffe[_0xec9d('0x108')]);if(!_0x4829fa){return this['channel'][_0xec9d('0x2d')](_0x48ffe,_0xec9d('0x10a'));}var _0x237821=this['channel']['exec'](_0xec9d('0x164'),[_0x4829fa,_0x48ffe[_0xec9d('0xdd')]]);if(_0x237821[_0xec9d('0xa4')]===-0x1){return _0x237821;}return this['channel'][_0xec9d('0xa7')](util[_0xec9d('0x56')](_0xec9d('0x165'),_0xec9d('0x164'),_0x4829fa));};AGIVertices[_0xec9d('0x11')][_0xec9d('0x166')]=function(_0x1f7ca6){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')](_0xec9d('0x167'),_0x1f7ca6[_0xec9d('0x38')]));if(!this['isConfigured'](_0x1f7ca6[_0xec9d('0x168')])){return this['channel'][_0xec9d('0x2d')](_0x1f7ca6,_0xec9d('0x169'));}var _0x1f941d='';var _0x433df1=parseInt(_0x1f7ca6[_0xec9d('0x168')],0xa);if(isNaN(_0x433df1)){_0x1f941d=_0x1f7ca6['queue_id'];}else{_0x1f941d=this[_0xec9d('0x15')][_0xec9d('0x71')](this,_0x1f7ca6[_0xec9d('0x168')]);if(!_0x1f941d){return this[_0xec9d('0x3a')]['error'](_0x1f7ca6,_0xec9d('0x16a'));}}var _0x171298='';if(this['isConfigured'](_0x1f7ca6[_0xec9d('0x108')])){var _0x2e8db7=this[_0xec9d('0x21')][_0xec9d('0x71')](this,_0x1f7ca6['file_id']);if(_0x2e8db7){_0x171298=_0x2e8db7;}}this[_0xec9d('0x36')]['sync'](this,_0x1f7ca6,_0x1f941d);if(_0x1f7ca6[_0xec9d('0xdd')]['indexOf']('x')<0x0){_0x1f7ca6[_0xec9d('0xdd')]+='x';}if(_0x1f7ca6[_0xec9d('0xdd')][_0xec9d('0x16b')]('X')<0x0){_0x1f7ca6[_0xec9d('0xdd')]+='X';}this['channel']['setVariable']('XMCS-QUEUE',_0x1f941d?_0x1f941d[_0xec9d('0x16c')]():'');var _0x2a1b76=this[_0xec9d('0x3a')][_0xec9d('0x58')](_0xec9d('0x16d'),[_0x1f941d,_0x1f7ca6[_0xec9d('0xdd')],_0x1f7ca6[_0xec9d('0x66')],_0x171298,_0x1f7ca6['timeout'],_0x1f7ca6[_0xec9d('0x9')],_0x1f7ca6[_0xec9d('0x16e')],_0x1f7ca6['gosub'],'',_0x1f7ca6['position']]);if(_0x2a1b76[_0xec9d('0xa4')]===-0x1){return _0x2a1b76;}return this[_0xec9d('0x3a')][_0xec9d('0xa7')](util['format']('Executed\x20command\x20%s\x20%s',_0xec9d('0x16d'),_0x1f941d));};AGIVertices[_0xec9d('0x11')][_0xec9d('0x16f')]=function(_0x1fd66e){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x1fd66e[_0xec9d('0x38')]));var _0x5554b7=_0x1fd66e[_0xec9d('0x170')]||_0xec9d('0x131');var _0xb0ef10=util[_0xec9d('0x56')](_0xec9d('0x171'),this['channel'][_0xec9d('0x37')],rs[_0xec9d('0x111')](0x5));var _0x4b633c=util['format']('%s/recordings/%s.%s',FILES_PATH,_0xb0ef10,_0x5554b7);var _0x4d77f6=util[_0xec9d('0x56')](_0xec9d('0x125'),FILES_PATH,_0xb0ef10);this[_0xec9d('0x3d')][_0xec9d('0x71')](this,_0x1fd66e,_0xb0ef10,_0x4b633c);this[_0xec9d('0x3a')][_0xec9d('0x9e')](_0xec9d('0x172'),_0xb0ef10);logger[_0xec9d('0x2f')](_0xec9d('0x173'),_0x4d77f6,_0x5554b7,_0x1fd66e[_0xec9d('0x174')],_0x1fd66e[_0xec9d('0x68')]);return this['channel'][_0xec9d('0x128')](_0x4d77f6,_0x5554b7,_0x1fd66e[_0xec9d('0x174')],_0x1fd66e['timeout'],undefined,!![]);};AGIVertices[_0xec9d('0x11')][_0xec9d('0x175')]=function(_0x4fa3d7){logger[_0xec9d('0x2f')](util['format'](_0xec9d('0x176'),_0x4fa3d7[_0xec9d('0x38')]));if(!this[_0xec9d('0x88')](_0x4fa3d7[_0xec9d('0x66')])){return this[_0xec9d('0x3a')]['noop'](_0xec9d('0x177'));}var _0x4ac436=this[_0xec9d('0x65')][_0xec9d('0x71')](this,_0x4fa3d7);logger[_0xec9d('0x2f')](util[_0xec9d('0x56')]('Response:',util[_0xec9d('0x178')](_0x4ac436,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x4fa3d7[_0xec9d('0xd0')])){return this['channel'][_0xec9d('0xa7')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x3e9d54=this[_0xec9d('0xa1')][_0xec9d('0x71')](this,_0x4fa3d7[_0xec9d('0xd0')]);if(!_0x3e9d54){return this['channel']['error'](_0x4fa3d7,_0xec9d('0xd2'));}this[_0xec9d('0x3a')][_0xec9d('0x9e')](util['format']('%s_STATUS_CODE',_0x3e9d54),_0x4ac436['statusCode']?_0x4ac436[_0xec9d('0x77')]:_0xec9d('0x179'));this[_0xec9d('0x3a')][_0xec9d('0x9e')](util[_0xec9d('0x56')](_0xec9d('0x17a'),_0x3e9d54),_0x4ac436[_0xec9d('0x78')]?_0x4ac436['statusMessage']:'OK');if(_0x4ac436[_0xec9d('0x75')]){try{this[_0xec9d('0x9c')](_0x4ac436[_0xec9d('0x75')],_0x3e9d54);}catch(_0x2e17cf){logger['error'](util['format'](_0xec9d('0x17b'),_0x3e9d54));}}return this[_0xec9d('0x3a')][_0xec9d('0xa7')](util[_0xec9d('0x56')]('variable\x20%s\x20set',_0x3e9d54));};AGIVertices['prototype'][_0xec9d('0x17c')]=function(_0x19a448){logger['info'](util[_0xec9d('0x56')](_0xec9d('0x17d'),_0x19a448[_0xec9d('0x38')]));return this[_0xec9d('0x3a')][_0xec9d('0x17e')](_0x19a448[_0xec9d('0x17f')][_0xec9d('0x5a')](/\s+/g,''),_0x19a448[_0xec9d('0x174')]);};AGIVertices[_0xec9d('0x11')][_0xec9d('0x180')]=function(_0x5364bc){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')](_0xec9d('0x181'),_0x5364bc['label']));return this[_0xec9d('0x3a')][_0xec9d('0x182')](_0x5364bc['number'][_0xec9d('0x5a')](/\s+/g,''),_0x5364bc[_0xec9d('0x174')]);};AGIVertices['prototype'][_0xec9d('0x183')]=function(_0x4e791c){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x4e791c[_0xec9d('0x38')]));return this[_0xec9d('0x3a')][_0xec9d('0x184')](_0x4e791c[_0xec9d('0x5d')],_0x4e791c['escape_digits']);};AGIVertices[_0xec9d('0x11')][_0xec9d('0x185')]=function(_0x21cc57){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x21cc57[_0xec9d('0x38')]));if(!this['isConfigured'](_0x21cc57[_0xec9d('0x186')])){return this[_0xec9d('0x3a')][_0xec9d('0xa7')]('no\x20mail\x20account\x20configured');}var _0x51ad3f=this[_0xec9d('0x24')][_0xec9d('0x71')](this,_0x21cc57[_0xec9d('0x186')]);if(!_0x51ad3f||!_0x51ad3f[_0xec9d('0x187')]){return this[_0xec9d('0x3a')][_0xec9d('0x2d')](_0x21cc57,_0xec9d('0x188'));}var _0x5da034={'from':util['format']('\x22%s\x22\x20<%s>',_0x51ad3f[_0xec9d('0x14')],_0x51ad3f[_0xec9d('0x189')]||_0x51ad3f['Smtp']['user']),'to':_0x21cc57['to']||'','cc':_0x21cc57['cc']||'','bcc':_0x21cc57['bcc']||'','subject':_0x21cc57[_0xec9d('0x18a')],'html':_0x21cc57[_0xec9d('0x5d')],'text':_0x21cc57[_0xec9d('0x5d')]};var _0x23611a={'tls':{'rejectUnauthorized':![]}};if(_0x51ad3f[_0xec9d('0x187')][_0xec9d('0x18b')]){_0x23611a[_0xec9d('0x18b')]=_0x51ad3f[_0xec9d('0x187')]['service'];}else{_0x23611a[_0xec9d('0x18c')]=_0x51ad3f[_0xec9d('0x187')][_0xec9d('0x18c')];_0x23611a[_0xec9d('0x18d')]=_0x51ad3f['Smtp']['port'];_0x23611a[_0xec9d('0x18e')]=_0x51ad3f['Smtp']['secure'];}if(_0x51ad3f[_0xec9d('0x187')][_0xec9d('0x18f')]){_0x23611a[_0xec9d('0x190')]={'user':_0x51ad3f['Smtp']['user'],'pass':_0x51ad3f[_0xec9d('0x187')]['pass']};}if(this[_0xec9d('0x88')](_0x21cc57[_0xec9d('0x191')])){}logger[_0xec9d('0xd7')]('sendMail\x20message',JSON[_0xec9d('0x74')](_0x5da034));this['createSquareDetailsReport'][_0xec9d('0x71')](this,_0x21cc57,_0x21cc57[_0xec9d('0x186')]);this[_0xec9d('0x3a')][_0xec9d('0xa7')](util[_0xec9d('0x56')](_0xec9d('0x192'),_0x51ad3f['name']));this[_0xec9d('0x25')][_0xec9d('0x71')](this,_0x23611a,_0x5da034);return this[_0xec9d('0x3a')][_0xec9d('0xa7')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xec9d('0x11')]['sendFax']=function(_0x3ab4bc){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x3ab4bc[_0xec9d('0x38')]));return this['channel'][_0xec9d('0xa7')](_0xec9d('0x193'));};AGIVertices[_0xec9d('0x11')][_0xec9d('0x194')]=function(_0x3be9e5){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x3be9e5[_0xec9d('0x38')]));if(!this[_0xec9d('0x88')](_0x3be9e5[_0xec9d('0x195')])){return this['channel'][_0xec9d('0xa7')]('no\x20sms\x20account\x20configured');}var _0x40c170=this['getSmsAccount'][_0xec9d('0x71')](this,_0x3be9e5[_0xec9d('0x195')]);if(!_0x40c170){return this[_0xec9d('0x3a')][_0xec9d('0x2d')](_0x3be9e5,_0xec9d('0x196'));}var _0x4d5f73={'body':_0x3be9e5[_0xec9d('0x197')],'phone':_0x3be9e5['to']||'','SmsAccountId':_0x40c170['id']};logger[_0xec9d('0xd7')](_0xec9d('0x198'),JSON[_0xec9d('0x74')](_0x4d5f73));this[_0xec9d('0x36')][_0xec9d('0x71')](this,_0x3be9e5,_0x3be9e5[_0xec9d('0x195')]);this[_0xec9d('0x3a')][_0xec9d('0xa7')](util[_0xec9d('0x56')](_0xec9d('0x199'),_0x40c170[_0xec9d('0x14')]));this[_0xec9d('0x35')][_0xec9d('0x71')](this,_0x4d5f73);return this[_0xec9d('0x3a')][_0xec9d('0xa7')](_0xec9d('0x19a'));};AGIVertices['prototype'][_0xec9d('0x19b')]=function(_0x27b327){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')](_0xec9d('0x19c'),_0x27b327[_0xec9d('0x38')]));if(!this[_0xec9d('0x88')](_0x27b327[_0xec9d('0xd0')])){return this[_0xec9d('0x3a')][_0xec9d('0x2d')](_0x27b327,'no\x20variable\x20selected');}var _0x52958a=this[_0xec9d('0xa1')]['sync'](this,_0x27b327[_0xec9d('0xd0')]);if(!_0x52958a){return this['channel'][_0xec9d('0x2d')](_0x27b327,_0xec9d('0xd2'));}return this[_0xec9d('0x3a')][_0xec9d('0x9e')](_0x52958a,_0x27b327['variable_value']);};AGIVertices[_0xec9d('0x11')][_0xec9d('0x19d')]=function(_0x317c59){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')](_0xec9d('0x19e'),_0x317c59['label']));this[_0xec9d('0x3a')][_0xec9d('0xa7')](_0xec9d('0x19f'));if(_0x317c59[_0xec9d('0xb4')]==='yes'){this['channel'][_0xec9d('0xa7')](_0xec9d('0x1a0'));return this[_0xec9d('0x3a')][_0xec9d('0xb4')]();}return this['channel'][_0xec9d('0xa7')]('Skipped\x20Answer');};AGIVertices['prototype'][_0xec9d('0x1a1')]=function(_0xf1e1cb){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')](_0xec9d('0x1a2'),_0xf1e1cb['label']));if(!this[_0xec9d('0x88')](_0xf1e1cb[_0xec9d('0x1a3')])){return this[_0xec9d('0x3a')][_0xec9d('0x2d')](_0xf1e1cb,'no\x20subproject\x20selected');}var _0x1dbc3a=this[_0xec9d('0x18')][_0xec9d('0x71')](this,_0xf1e1cb[_0xec9d('0x1a3')]);if(!this[_0xec9d('0x88')](_0x1dbc3a)){return this[_0xec9d('0x3a')][_0xec9d('0x2d')](_0xf1e1cb,util[_0xec9d('0x56')](_0xec9d('0x1a4'),_0xf1e1cb[_0xec9d('0x1a3')]));}if(_0x1dbc3a===this['channel']['arg_1']){return this[_0xec9d('0x3a')][_0xec9d('0x2d')](_0xf1e1cb,_0xec9d('0x1a5'));}this[_0xec9d('0x36')][_0xec9d('0x71')](this,_0xf1e1cb,_0x1dbc3a);var _0x7a0026=this['channel']['exec'](_0xec9d('0x1a6'),util[_0xec9d('0x56')](_0xec9d('0x1a7'),config[_0xec9d('0x9')][_0xec9d('0x18c')]||'127.0.0.1',_0x1dbc3a,this[_0xec9d('0x3a')][_0xec9d('0x3b')]));if(_0x7a0026[_0xec9d('0xa4')]===-0x1){return _0x7a0026;}return this['channel']['noop'](util[_0xec9d('0x56')](_0xec9d('0x165'),'AGI',_0x1dbc3a));};AGIVertices['prototype']['system']=function(_0x3bbd5a){logger['info'](util[_0xec9d('0x56')](_0xec9d('0x1a8'),_0x3bbd5a[_0xec9d('0x38')]));var _0x2e5ce4=this[_0xec9d('0x1a9')][_0xec9d('0x71')](this,_0x3bbd5a[_0xec9d('0xb2')]);this['createSquareDetailsReport'][_0xec9d('0x71')](this,_0x3bbd5a,_0x3bbd5a[_0xec9d('0xb2')]);if(this[_0xec9d('0x88')](_0x3bbd5a[_0xec9d('0xd0')])){var _0x14dfca=this['getVariable'][_0xec9d('0x71')](this,_0x3bbd5a[_0xec9d('0xd0')]);if(_0x14dfca){this[_0xec9d('0x3a')]['setVariable'](_0x14dfca,_0x2e5ce4);return this[_0xec9d('0x3a')][_0xec9d('0xa7')](util[_0xec9d('0x56')](_0xec9d('0x1aa'),_0x3bbd5a[_0xec9d('0xb2')],_0x14dfca));}}return this['channel'][_0xec9d('0xa7')](util['format'](_0xec9d('0x1ab'),_0x3bbd5a[_0xec9d('0xb2')]));};AGIVertices[_0xec9d('0x11')][_0xec9d('0x1ac')]=function(_0x17641f){logger['info'](util[_0xec9d('0x56')](_0xec9d('0x1ad'),_0x17641f[_0xec9d('0x38')]));_0x17641f[_0xec9d('0x5d')]=_0x17641f['text'][_0xec9d('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xec9d('0x88')](_0x17641f['apiKey'])){return this[_0xec9d('0x3a')][_0xec9d('0xa7')](_0xec9d('0x1ae'));}if(!this[_0xec9d('0x88')](_0x17641f[_0xec9d('0x5d')])){return this['channel'][_0xec9d('0xa7')](_0xec9d('0xa8'));}this['channel']['noop'](util[_0xec9d('0x56')](_0xec9d('0x1af'),_0x17641f['text']));var _0x1d5670=this[_0xec9d('0x5b')][_0xec9d('0x71')](this,_0x17641f);if(_0x1d5670){this[_0xec9d('0x3a')][_0xec9d('0xa7')](util[_0xec9d('0x56')](_0xec9d('0x1b0'),_0x1d5670));var _0x1cc910=this['channel'][_0xec9d('0xfa')](_0x1d5670);try{fs[_0xec9d('0xfb')](_0x1d5670+_0xec9d('0xfc'));}catch(_0x56746a){logger[_0xec9d('0x2d')](_0x56746a);}return _0x1cc910;}return this['channel'][_0xec9d('0x2d')](_0x17641f,_0xec9d('0x1b1'));};AGIVertices[_0xec9d('0x11')]['tts']=function(_0x250fc3){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x250fc3[_0xec9d('0x38')]));_0x250fc3[_0xec9d('0x5d')]=_0x250fc3[_0xec9d('0x5d')][_0xec9d('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x250fc3['text'])){return this[_0xec9d('0x3a')][_0xec9d('0xa7')](_0xec9d('0xa8'));}this[_0xec9d('0x3a')]['noop'](util[_0xec9d('0x56')](_0xec9d('0x1b2'),_0x250fc3['text']));var _0x3dc8cb=this[_0xec9d('0x63')][_0xec9d('0x71')](this,_0x250fc3);if(_0x3dc8cb){this[_0xec9d('0x3a')]['noop'](util['format'](_0xec9d('0x1b3'),_0x3dc8cb));var _0x1e52ab=this[_0xec9d('0x3a')][_0xec9d('0xfa')](_0x3dc8cb);try{fs[_0xec9d('0xfb')](_0x3dc8cb+_0xec9d('0xfc'));}catch(_0x2039a9){logger[_0xec9d('0x2d')](_0x2039a9);}return _0x1e52ab;}return this['channel'][_0xec9d('0x2d')](_0x250fc3,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xec9d('0x11')]['unpause']=function(_0x288ce3){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')](_0xec9d('0x1b4'),_0x288ce3[_0xec9d('0x38')]));if(!this[_0xec9d('0x88')](_0x288ce3['findBy'])){return this[_0xec9d('0x3a')][_0xec9d('0x2d')](_0x288ce3,_0xec9d('0x151'));}logger['info'](util[_0xec9d('0x56')](_0xec9d('0x152'),this['channel'][_0xec9d('0x3c')],_0x288ce3['findBy']));var _0x163f43=this[_0xec9d('0x53')][_0xec9d('0x71')](this,_0x288ce3[_0xec9d('0x153')]);if(_0x163f43){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')](_0xec9d('0x154'),this[_0xec9d('0x3a')][_0xec9d('0x3c')],_0x288ce3[_0xec9d('0x153')]));this[_0xec9d('0x3a')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xec9d('0x3a')]['callerid'],_0x288ce3[_0xec9d('0x153')]));return{'code':0xc8,'result':_0xec9d('0x162')};}else{logger[_0xec9d('0x2f')](util[_0xec9d('0x56')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xec9d('0x3a')][_0xec9d('0x3c')],_0x288ce3[_0xec9d('0x153')]));this[_0xec9d('0x3a')][_0xec9d('0xa7')](util[_0xec9d('0x56')](_0xec9d('0x155'),this[_0xec9d('0x3a')][_0xec9d('0x3c')],_0x288ce3['findBy']));return{'code':0xc8,'result':_0xec9d('0x156')};}};AGIVertices[_0xec9d('0x11')][_0xec9d('0x1b5')]=function(_0x4f4cbe){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')](_0xec9d('0x1b6'),_0x4f4cbe[_0xec9d('0x38')]));var _0x43b06e=this[_0xec9d('0x3a')][_0xec9d('0x58')](_0xec9d('0x1b7'),[_0x4f4cbe[_0xec9d('0x1b8')],_0x4f4cbe[_0xec9d('0x7b')]]);if(_0x43b06e[_0xec9d('0xa4')]===-0x1){return _0x43b06e;}return this['channel']['noop'](util[_0xec9d('0x56')](_0xec9d('0x165'),_0xec9d('0x1b7'),_0x4f4cbe['mailbox']));};AGIVertices[_0xec9d('0x11')]['vswitch']=function(_0x3f533e){logger[_0xec9d('0x2f')](util[_0xec9d('0x56')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x3f533e[_0xec9d('0x38')]));if(!this[_0xec9d('0x88')](_0x3f533e['variable_id'])){return this['channel'][_0xec9d('0x2d')](_0x3f533e,'no\x20variable\x20selected');}var _0x5174ad=this[_0xec9d('0xa1')][_0xec9d('0x71')](this,_0x3f533e[_0xec9d('0xd0')]);if(!_0x5174ad){return this[_0xec9d('0x3a')][_0xec9d('0x2d')](_0x3f533e,_0xec9d('0xd2'));}var _0x2d19cb=this[_0xec9d('0x3a')]['getVariable'](_0x5174ad);return{'code':0xc8,'result':_0x2d19cb[_0xec9d('0xa2')]?_0x2d19cb[_0xec9d('0xa2')]:'-'};};String[_0xec9d('0x11')]['replaceAll']=function(_0x271497,_0x1310b9){return this[_0xec9d('0x9f')](_0x271497)['join'](_0x1310b9);};module[_0xec9d('0x1b9')]=AGIVertices; \ No newline at end of file +var _0x1c64=['no\x20grammar\x20configured','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','getUser','no\x20user\x20found','DIAL','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','hiddendigitsnum','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','%s/recordings/%s','generate','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','continueAt','context','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','true','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeechASR','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','streamFile','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','subject','service','host','port','secure','authentication','auth','user','template_id','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','getSmsAccount','sms_account_id','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','vswitch','join','util','shelljs','odbc','randomstring','moment','mustache','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','rpc','mailRpc','getVariableById','then','name','catch','prototype','getVoiceQueue','getVoiceQueueById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','IntervalId','interval','map','Intervals','%s/sounds/converted/%s','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','channel','arg_1','callerid','createSquareRecording','priority','dnid','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agentUnpause','agent','agentLogout','internal','format','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','trim','googleCloudTTS','text','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','timeout','includes','POST','PUT','method','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','sync','uri','render','url','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeech_tts_language','speed','key','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','awsLex','aws_lex_region','aws_bot_name','google_asr_language','tildeASR','appid','appsecret','clear','clone','isString','replaceObjectAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','length','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getVariable','extra','getAndSetVariable','result','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar'];(function(_0x56a106,_0xdd347c){var _0xb202d9=function(_0x3022d5){while(--_0x3022d5){_0x56a106['push'](_0x56a106['shift']());}};_0xb202d9(++_0xdd347c);}(_0x1c64,0x11d));var _0x41c6=function(_0x5908b7,_0x5db689){_0x5908b7=_0x5908b7-0x0;var _0x260809=_0x1c64[_0x5908b7];return _0x260809;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x41c6('0x0'));var _=require('lodash');var sh=require(_0x41c6('0x1'));var odbc=require(_0x41c6('0x2'))();var rs=require(_0x41c6('0x3'));var moment=require(_0x41c6('0x4'));var Mustache=require(_0x41c6('0x5'));var rp=require('request-promise');var logger=require(_0x41c6('0x6'))(_0x41c6('0x7'));var config=require(_0x41c6('0x8'));var scripts=require(_0x41c6('0x9'));var FILES_PATH=_0x41c6('0xa');var recursiveMapAttributes=[_0x41c6('0xb'),_0x41c6('0xc')];var verticesWithRetry=[_0x41c6('0xd'),_0x41c6('0xe'),_0x41c6('0xf')];var AGIVertices=function(_0xf91198,_0x4244bd,_0xf8f335){this['channel']=_0xf91198;this[_0x41c6('0x10')]=_0x4244bd;this[_0x41c6('0x11')]=_0xf8f335;};AGIVertices['prototype']['getVariable']=function(_0x2d1044,_0x1bd954){this[_0x41c6('0x10')][_0x41c6('0x12')](_0x2d1044)[_0x41c6('0x13')](function(_0x1d1c78){_0x1bd954(null,_0x1d1c78?_0x1d1c78[_0x41c6('0x14')]:![]);})[_0x41c6('0x15')](function(_0x106904){_0x1bd954(_0x106904);});};AGIVertices[_0x41c6('0x16')][_0x41c6('0x17')]=function(_0x17b0b3,_0x2df32a){this[_0x41c6('0x10')][_0x41c6('0x18')](_0x17b0b3)[_0x41c6('0x13')](function(_0x201ff4){_0x2df32a(null,_0x201ff4?_0x201ff4[_0x41c6('0x14')]:![]);})[_0x41c6('0x15')](function(_0xd34d94){_0x2df32a(_0xd34d94);});};AGIVertices[_0x41c6('0x16')]['getSquareProject']=function(_0x2db159,_0x2d8ab3){this[_0x41c6('0x10')]['getSquareProjectById'](_0x2db159)[_0x41c6('0x13')](function(_0xb997d4){_0x2d8ab3(null,_0xb997d4?_0xb997d4['name']:![]);})[_0x41c6('0x15')](function(_0x18310d){_0x2d8ab3(_0x18310d);});};AGIVertices[_0x41c6('0x16')][_0x41c6('0x19')]=function(_0x4a5a2c,_0x2a94f9){this['rpc'][_0x41c6('0x1a')](_0x4a5a2c)[_0x41c6('0x13')](function(_0x30fa33){_0x2a94f9(null,_0x30fa33?_0x30fa33[_0x41c6('0x1b')]:![]);})[_0x41c6('0x15')](function(_0x5b5055){_0x2a94f9(_0x5b5055);});};AGIVertices[_0x41c6('0x16')]['getUser']=function(_0x4ee65a,_0x49ec66){this['rpc'][_0x41c6('0x1c')](_0x4ee65a)[_0x41c6('0x13')](function(_0x2f9eb5){_0x49ec66(null,_0x2f9eb5?_0x2f9eb5[_0x41c6('0x14')]:![]);})[_0x41c6('0x15')](function(_0x4b880c){_0x49ec66(_0x4b880c);});};AGIVertices[_0x41c6('0x16')][_0x41c6('0x1d')]=function(_0x48d5a8,_0x4197e3){this['rpc'][_0x41c6('0x1e')](_0x48d5a8)[_0x41c6('0x13')](function(_0x38d26c){_0x4197e3(null,_0x38d26c?_0x38d26c['name']:![]);})[_0x41c6('0x15')](function(_0x1b89ce){_0x4197e3(_0x1b89ce);});};AGIVertices[_0x41c6('0x16')][_0x41c6('0x1f')]=function(_0x1a8af4,_0x32c133){var _0x536c87=this;this[_0x41c6('0x10')][_0x41c6('0x20')](_0x1a8af4)[_0x41c6('0x13')](function(_0x1521e7){_0x32c133(null,_0x1521e7?_0x536c87[_0x41c6('0x21')](_0x1521e7[_0x41c6('0x22')]):![]);})[_0x41c6('0x15')](function(_0x513ded){_0x32c133(_0x513ded);});};AGIVertices[_0x41c6('0x16')]['getMailAccount']=function(_0x2fc80e,_0x447fd){this[_0x41c6('0x10')][_0x41c6('0x23')](_0x2fc80e)[_0x41c6('0x13')](function(_0x43555d){_0x447fd(null,_0x43555d?_0x43555d:![]);})[_0x41c6('0x15')](function(_0x202640){_0x447fd(_0x202640);});};AGIVertices[_0x41c6('0x16')][_0x41c6('0x24')]=function(_0x43ee1a,_0x539e4c,_0x213945){this[_0x41c6('0x11')][_0x41c6('0x24')](_0x43ee1a,_0x539e4c)[_0x41c6('0x13')](function(){_0x213945(null);})[_0x41c6('0x15')](function(_0x557a6f){_0x213945(_0x557a6f);});};AGIVertices['prototype'][_0x41c6('0x25')]=function(_0x17ecf6,_0x2d1ff0){this[_0x41c6('0x10')]['getIntervalById'](_0x17ecf6)[_0x41c6('0x13')](function(_0x4af16b){if(_0x4af16b){if(_0x4af16b[_0x41c6('0x26')]){_0x2d1ff0(null,[_0x4af16b[_0x41c6('0x27')]]);}else{_0x2d1ff0(null,_[_0x41c6('0x28')](_0x4af16b[_0x41c6('0x29')],'interval'));}}else{_0x2d1ff0(null,![]);}})[_0x41c6('0x15')](function(_0x3e5e41){_0x2d1ff0(_0x3e5e41);});};AGIVertices[_0x41c6('0x16')][_0x41c6('0x21')]=function(_0x1b758e){return util['format'](_0x41c6('0x2a'),FILES_PATH,_0x1b758e);};AGIVertices['prototype']['getQueryOdbc']=function(_0x570135,_0x4cb90e,_0x5935ae){odbc[_0x41c6('0x2b')](_0x570135,function(_0x173a56){if(_0x173a56){logger['error'](_0x41c6('0x2c'),_0x173a56);_0x5935ae(_0x173a56);}else{logger[_0x41c6('0x2d')](_0x41c6('0x2e'));odbc[_0x41c6('0x2f')](_0x4cb90e,function(_0x3386ae,_0x539537){if(_0x3386ae){logger[_0x41c6('0x2d')]('Error\x20executing\x20query\x20%s',_0x4cb90e);_0x5935ae(_0x3386ae);}else{logger[_0x41c6('0x2d')](_0x41c6('0x30'),_0x4cb90e);odbc[_0x41c6('0x31')](function(_0x41a96c){if(_0x41a96c){logger[_0x41c6('0x32')](_0x41c6('0x33'),_0x41a96c);}_0x5935ae(null,_0x539537);});}});}});};AGIVertices[_0x41c6('0x16')]['getSmsAccount']=function(_0x18cb2d,_0x16193b){this[_0x41c6('0x10')][_0x41c6('0x34')](_0x18cb2d)[_0x41c6('0x13')](function(_0x18bc61){_0x16193b(null,_0x18bc61?_0x18bc61:![]);})[_0x41c6('0x15')](function(_0x4ed46d){_0x16193b(_0x4ed46d);});};AGIVertices['prototype'][_0x41c6('0x35')]=function(_0x3fe298,_0x493841){this[_0x41c6('0x10')][_0x41c6('0x35')](_0x3fe298)[_0x41c6('0x13')](function(_0x1bda68){_0x493841(null,_0x1bda68);})[_0x41c6('0x15')](function(_0xb3a365){_0x493841(_0xb3a365);});};AGIVertices[_0x41c6('0x16')]['createSquareDetailsReport']=function(_0xaea4f1,_0x2d4d96,_0x3cd2a8){this[_0x41c6('0x10')][_0x41c6('0x36')]({'uniqueid':this['channel'][_0x41c6('0x37')],'node':_0xaea4f1[_0x41c6('0x38')],'application':_0xaea4f1[_0x41c6('0x39')],'data':_0x2d4d96||null,'project_name':this[_0x41c6('0x3a')][_0x41c6('0x3b')],'callerid':this[_0x41c6('0x3a')][_0x41c6('0x3c')]})[_0x41c6('0x13')](function(_0x3a73d7){if(_0x3cd2a8){_0x3cd2a8(null,_0x3a73d7);}})[_0x41c6('0x15')](function(_0x407947){if(_0x3cd2a8){_0x3cd2a8(_0x407947);}});};AGIVertices[_0x41c6('0x16')][_0x41c6('0x3d')]=function(_0x250fd9,_0x59755d,_0x5b79bd,_0x35e88f){this[_0x41c6('0x10')][_0x41c6('0x3d')]({'uniqueid':this[_0x41c6('0x3a')]['uniqueid'],'callerid':this['channel'][_0x41c6('0x3c')],'calleridname':this[_0x41c6('0x3a')]['calleridname'],'context':this[_0x41c6('0x3a')]['context'],'extension':this[_0x41c6('0x3a')]['extension'],'priority':this['channel'][_0x41c6('0x3e')],'accountcode':this[_0x41c6('0x3a')]['accountcode'],'dnid':this[_0x41c6('0x3a')][_0x41c6('0x3f')],'projectName':this[_0x41c6('0x3a')][_0x41c6('0x3b')],'saveName':_0x59755d,'filename':_0x250fd9['file']||_0x59755d,'savePath':_0x5b79bd})[_0x41c6('0x13')](function(_0x3644ef){_0x35e88f(null,_0x3644ef);})[_0x41c6('0x15')](function(_0x2f733d){_0x35e88f(_0x2f733d);});};AGIVertices[_0x41c6('0x16')][_0x41c6('0x40')]=function(_0x437ced,_0x1c82bf,_0x10366f,_0x4adac2,_0x556c28){this[_0x41c6('0x10')]['createSquareMessage']({'uniqueid':this[_0x41c6('0x3a')][_0x41c6('0x37')],'body':_0x437ced,'direction':_0x1c82bf,'providerName':_0x10366f,'providerResponse':_0x4adac2})[_0x41c6('0x13')](function(_0x1e20b0){if(_0x556c28){_0x556c28(null,_0x1e20b0);}})['catch'](function(_0x144fbd){if(_0x556c28){_0x556c28(_0x144fbd);}});};AGIVertices['prototype']['createCmContact']=function(_0xc2dfea,_0x34e0a2){this[_0x41c6('0x10')][_0x41c6('0x41')]({'firstName':_['isEmpty'](_0xc2dfea['name'])||_[_0x41c6('0x42')](_0xc2dfea['name'])?_0x41c6('0x43')+Math[_0x41c6('0x44')]():_0xc2dfea['name'],'lastName':_[_0x41c6('0x45')](_0xc2dfea[_0x41c6('0x46')])||_['isNil'](_0xc2dfea[_0x41c6('0x46')])?null:_0xc2dfea[_0x41c6('0x46')],'phone':_0xc2dfea[_0x41c6('0x47')],'ListId':_0xc2dfea[_0x41c6('0x48')],'scheduledat':_0xc2dfea[_0x41c6('0x49')],'callbackUniqueid':this[_0x41c6('0x3a')]['uniqueid'],'tags':'callback','description':_0x41c6('0x4a')+_0xc2dfea['scheduledAt'][_0x41c6('0x4b')](),'priority':_0xc2dfea[_0x41c6('0x4c')]})[_0x41c6('0x13')](function(_0x1fe79b){_0x34e0a2(null,_0x1fe79b);})[_0x41c6('0x15')](function(_0x2c3a5b){_0x34e0a2(_0x2c3a5b);});};AGIVertices[_0x41c6('0x16')][_0x41c6('0x4d')]=function(_0x1733b3,_0x210a96){this['rpc'][_0x41c6('0x4e')](_0x1733b3)['then'](function(_0x5a862c){_0x210a96(null,_0x5a862c?_0x5a862c[_0x41c6('0x14')]:![]);})[_0x41c6('0x15')](function(_0x5dfc4a){_0x210a96(_0x5dfc4a);});};AGIVertices[_0x41c6('0x16')][_0x41c6('0x4f')]=function(_0x21cd2a,_0x4fe6be,_0x382da6){var _0x2d9035={'role':'agent'};_0x2d9035[_0x21cd2a]=this['channel'][_0x41c6('0x3c')];this[_0x41c6('0x10')][_0x41c6('0x4f')](_0x2d9035,_0x4fe6be,this['channel'][_0x41c6('0x37')])[_0x41c6('0x13')](function(_0x22983b){_0x382da6(null,_[_0x41c6('0x42')](_0x22983b)?![]:!![]);})[_0x41c6('0x15')](function(_0xb89703){logger[_0x41c6('0x32')](_0xb89703);_0x382da6(null,![]);});};AGIVertices[_0x41c6('0x16')][_0x41c6('0x50')]=function(_0x573db7,_0x28925f){var _0x40307e={'role':_0x41c6('0x51')};_0x40307e[_0x573db7]=this[_0x41c6('0x3a')][_0x41c6('0x3c')];this[_0x41c6('0x10')][_0x41c6('0x50')](_0x40307e)[_0x41c6('0x13')](function(_0x24a7b2){_0x28925f(null,_[_0x41c6('0x42')](_0x24a7b2)?![]:!![]);})[_0x41c6('0x15')](function(_0x24406d){logger[_0x41c6('0x32')](_0x24406d);_0x28925f(null,![]);});};AGIVertices[_0x41c6('0x16')][_0x41c6('0x52')]=function(_0x5ec842,_0x2801a7){var _0x2de095={'role':'agent'};_0x2de095[_0x5ec842]=this[_0x41c6('0x3a')][_0x41c6('0x3c')];this[_0x41c6('0x10')]['agentLogout'](_0x2de095)['then'](function(_0x3dbd88){_0x2801a7(null,_[_0x41c6('0x42')](_0x3dbd88)?![]:!![]);})['catch'](function(_0x5281ed){logger[_0x41c6('0x32')](_0x5281ed);_0x2801a7(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x4bedfc,_0x368700){var _0x3eaefb={'role':_0x41c6('0x51')};_0x3eaefb[_0x4bedfc]=this[_0x41c6('0x3a')]['callerid'];var _0x2fe0fe=_0x4bedfc!=_0x41c6('0x53')?util[_0x41c6('0x54')](_0x41c6('0x55'),_0x41c6('0x56'),this[_0x41c6('0x3a')]['callerid']):undefined;this[_0x41c6('0x10')][_0x41c6('0x57')](_0x3eaefb,_0x2fe0fe)[_0x41c6('0x13')](function(_0x5a537c){_0x368700(null,_[_0x41c6('0x42')](_0x5a537c)?![]:!![]);})[_0x41c6('0x15')](function(_0x51f4a9){logger[_0x41c6('0x32')](_0x51f4a9);_0x368700(null,![]);});};AGIVertices[_0x41c6('0x16')][_0x41c6('0x58')]=function(_0x1b6b41,_0x23cfb3){sh[_0x41c6('0x59')](_[_0x41c6('0x5a')](_0x1b6b41),function(_0x1cb4fb,_0x40b807){var _0x13a88f=_0x40b807['replace'](/(\r\n|\n|\r)/gm,'');_0x23cfb3(null,_0x13a88f);});};AGIVertices[_0x41c6('0x16')][_0x41c6('0x5b')]=function(_0x44abc1,_0x6b747){scripts[_0x41c6('0x5b')](_0x44abc1['apiKey'],_0x44abc1['google_cloud_tts_text_type']||_0x41c6('0x5c'),_0x44abc1[_0x41c6('0x5c')],_0x44abc1['languageCode']||_0x41c6('0x5d'),_0x44abc1[_0x41c6('0x5e')]||_0x41c6('0x5f'),_0x44abc1[_0x41c6('0x60')]||_0x41c6('0x61'))[_0x41c6('0x13')](function(_0x4e77f4){_0x6b747(null,_0x4e77f4);})[_0x41c6('0x15')](function(_0x2a1245){_0x6b747(_0x2a1245);});};AGIVertices[_0x41c6('0x16')][_0x41c6('0x62')]=function(_0x164531,_0x5da171){scripts['googleTTS'](_0x164531['text'],_0x164531[_0x41c6('0x63')]||'en',0x1)[_0x41c6('0x13')](function(_0x250642){_0x5da171(null,_0x250642);})[_0x41c6('0x15')](function(_0x3ed7a7){_0x5da171(_0x3ed7a7);});};AGIVertices[_0x41c6('0x16')][_0x41c6('0x64')]=function(_0x2ee0e0,_0x3764bb){var _0x3b2a95={'uri':_0x2ee0e0['url'],'method':_0x2ee0e0['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2ee0e0[_0x41c6('0x65')])==='number'&&parseInt(_0x2ee0e0[_0x41c6('0x65')])>=0x1?parseInt(_0x2ee0e0[_0x41c6('0x65')])*0x3e8:0x5*0x3e8};if(_[_0x41c6('0x66')]([_0x41c6('0x67'),_0x41c6('0x68')],_0x3b2a95[_0x41c6('0x69')][_0x41c6('0x6a')]())){try{_0x3b2a95['body']=_0x2ee0e0[_0x41c6('0xc')]?JSON[_0x41c6('0x6b')](_0x2ee0e0['rawBody']):{};}catch(_0x198ada){logger['error'](_0x41c6('0x6c'),_0x198ada);}}try{_0x3b2a95[_0x41c6('0x6d')]=_0x2ee0e0[_0x41c6('0xb')]?JSON[_0x41c6('0x6b')](_0x2ee0e0['rawHeaders']):{};}catch(_0x80df9){logger[_0x41c6('0x32')](_0x41c6('0x6e'),_0x80df9);}if(_0x2ee0e0['computedVariables']){try{var _0x13794e=require(_0x2ee0e0['computedVariables'])[_0x41c6('0x6f')](this,_0x3b2a95);_0x3b2a95[_0x41c6('0x70')]=Mustache[_0x41c6('0x71')](_0x2ee0e0[_0x41c6('0x72')],_0x13794e,{},['$$','$$']);if(_0x3b2a95['headers']){_0x3b2a95[_0x41c6('0x6d')]=JSON[_0x41c6('0x6b')](Mustache[_0x41c6('0x71')](JSON[_0x41c6('0x73')](_0x3b2a95[_0x41c6('0x6d')]),_0x13794e,{},['$$','$$']));}if(_0x3b2a95['body']){_0x3b2a95[_0x41c6('0x74')]=JSON[_0x41c6('0x6b')](Mustache['render'](JSON[_0x41c6('0x73')](_0x3b2a95[_0x41c6('0x74')]),_0x13794e,{},['$$','$$']));}}catch(_0x51dffe){logger[_0x41c6('0x32')](_0x41c6('0x75'),_0x51dffe);}}rp(_0x3b2a95)[_0x41c6('0x13')](function(_0x10e3f1){var _0x3cfb68={'statusCode':_0x10e3f1[_0x41c6('0x76')]||0xc8,'statusMessage':_0x10e3f1[_0x41c6('0x77')]||'OK','headers':_0x10e3f1[_0x41c6('0x6d')]||{},'body':_0x10e3f1[_0x41c6('0x74')]||{}};_0x3764bb(null,_0x3cfb68);})['catch'](function(_0x581c65){var _0x2ccf49={'statusCode':_0x581c65[_0x41c6('0x76')]||0x1f4,'statusMessage':_0x581c65[_0x41c6('0x78')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x581c65[_0x41c6('0x79')]['headers']||{},'body':_0x581c65[_0x41c6('0x79')][_0x41c6('0x74')]||{}};_0x3764bb(null,_0x2ccf49);});};AGIVertices[_0x41c6('0x16')][_0x41c6('0x7a')]=function(_0x32a749,_0x11264f){scripts['googleDialogflow'](this[_0x41c6('0x3a')][_0x41c6('0x37')],_0x32a749['key'],_0x32a749[_0x41c6('0x5c')],_0x32a749[_0x41c6('0x7b')]||'en')[_0x41c6('0x13')](function(_0x1952a4){_0x11264f(null,_0x1952a4);})[_0x41c6('0x15')](function(_0x3b4b94){_0x11264f(_0x3b4b94);});};AGIVertices[_0x41c6('0x16')][_0x41c6('0x7c')]=function(_0x11db0b,_0xf58e89){scripts[_0x41c6('0x7c')](this['channel'][_0x41c6('0x37')],_0x11db0b[_0x41c6('0x7d')],_0x11db0b[_0x41c6('0x7e')],_0x11db0b[_0x41c6('0x7f')],_0x11db0b[_0x41c6('0x5c')],_0x11db0b[_0x41c6('0x80')]||'en')[_0x41c6('0x13')](function(_0x1e6a7c){_0xf58e89(null,_0x1e6a7c);})[_0x41c6('0x15')](function(_0x114ed6){_0xf58e89(_0x114ed6);});};AGIVertices[_0x41c6('0x16')]['sestekNDA']=function(_0x21be84,_0x481523){scripts[_0x41c6('0x81')](this[_0x41c6('0x3a')],_0x21be84)['then'](function(_0x48479d){_0x481523(null,_0x48479d);})[_0x41c6('0x15')](function(_0x4c23ef){_0x481523(_0x4c23ef);});};AGIVertices['prototype']['ispeechTTS']=function(_0x46ca27,_0x5ab93a){scripts['ispeechTTS'](_0x46ca27['key'],_0x46ca27['text'],_0x46ca27[_0x41c6('0x82')]||_0x41c6('0x5d'),_0x46ca27[_0x41c6('0x83')])[_0x41c6('0x13')](function(_0x341d88){_0x5ab93a(null,_0x341d88);})[_0x41c6('0x15')](function(_0x132a04){_0x5ab93a(_0x132a04);});};AGIVertices['prototype']['ispeechASR']=function(_0x28cdfc,_0x3e323f,_0x4a4833){scripts['ispeechASR'](_0x3e323f,_0x28cdfc[_0x41c6('0x84')],_0x28cdfc[_0x41c6('0x85')]||'en-US',this[_0x41c6('0x86')](_0x28cdfc[_0x41c6('0x87')])?_0x28cdfc[_0x41c6('0x87')]:undefined)[_0x41c6('0x13')](function(_0x3e2f0c){_0x4a4833(null,_0x3e2f0c);})[_0x41c6('0x15')](function(_0x1e2402){_0x4a4833(_0x1e2402);});};AGIVertices['prototype'][_0x41c6('0x88')]=function(_0x5b2e5e,_0x264f7c){scripts[_0x41c6('0x88')](_0x5b2e5e[_0x41c6('0x89')],_0x5b2e5e[_0x41c6('0x8a')],_0x5b2e5e[_0x41c6('0x8b')],_0x5b2e5e['aws_polly_voice']||_0x41c6('0x8c'),_0x5b2e5e['text'],_0x5b2e5e['aws_text_type']||_0x41c6('0x5c'))['then'](function(_0x3e90ef){_0x264f7c(null,_0x3e90ef);})[_0x41c6('0x15')](function(_0x5bf4dc){_0x264f7c(_0x5bf4dc);});};AGIVertices['prototype'][_0x41c6('0x8d')]=function(_0x2e889b,_0x598532){scripts[_0x41c6('0x8d')](this[_0x41c6('0x3a')][_0x41c6('0x37')],_0x2e889b['aws_access_key_id'],_0x2e889b['aws_secret_access_key'],_0x2e889b[_0x41c6('0x8e')],_0x2e889b[_0x41c6('0x5c')],_0x2e889b[_0x41c6('0x8f')])[_0x41c6('0x13')](function(_0x574a69){_0x598532(null,_0x574a69);})[_0x41c6('0x15')](function(_0x468086){_0x598532(_0x468086);});};AGIVertices[_0x41c6('0x16')]['googleASR']=function(_0x367028,_0xe2ab98,_0x1f910a){scripts['googleASR'](_0xe2ab98,_0x367028[_0x41c6('0x84')],_0x367028[_0x41c6('0x90')]||_0x41c6('0x5d'))['then'](function(_0x21c6d5){_0x1f910a(null,_0x21c6d5);})['catch'](function(_0x477a09){_0x1f910a(_0x477a09);});};AGIVertices['prototype']['tildeASR']=function(_0xcbca93,_0x562c5e,_0x311ab5){scripts[_0x41c6('0x91')](_0x562c5e,_0xcbca93[_0x41c6('0x92')],_0xcbca93[_0x41c6('0x93')],_0xcbca93[_0x41c6('0x70')])[_0x41c6('0x13')](function(_0x305b57){_0x311ab5(null,_0x305b57);})[_0x41c6('0x15')](function(_0x372cf0){_0x311ab5(_0x372cf0);});};AGIVertices[_0x41c6('0x16')][_0x41c6('0x94')]=function(_0x421784){var _0x79b7bc=_['includes'](verticesWithRetry,_0x421784[_0x41c6('0x39')])?_0x421784:_[_0x41c6('0x95')](_0x421784);for(var _0xb8421 in _0x79b7bc){if(_0x79b7bc['hasOwnProperty'](_0xb8421)){if(_0x79b7bc[_0xb8421]&&_[_0x41c6('0x96')](_0x79b7bc[_0xb8421])){if(_[_0x41c6('0x66')](recursiveMapAttributes,_0xb8421)){_0x79b7bc[_0xb8421]=this[_0x41c6('0x97')](_0x79b7bc[_0xb8421]);}else{_0x79b7bc[_0xb8421]=this['replaceAllVariables'](_0x79b7bc[_0xb8421]);}}}}return _0x79b7bc;};AGIVertices[_0x41c6('0x16')][_0x41c6('0x98')]=function(_0x51fbb4){for(var _0x5216f9 in _0x51fbb4){if(_0x51fbb4[_0x41c6('0x99')](_0x5216f9)){if(_[_0x41c6('0x9a')](_0x51fbb4[_0x5216f9])){this['recursiveNodeIndex'](_0x51fbb4[_0x5216f9]);}else if(_[_0x41c6('0x9b')](_0x51fbb4[_0x5216f9])){for(var _0x22f91f=0x0;_0x22f91f<_0x51fbb4[_0x5216f9][_0x41c6('0x9c')];_0x22f91f++){this[_0x41c6('0x98')](_0x51fbb4[_0x5216f9][_0x22f91f]);}}else if(_[_0x41c6('0x96')](_0x51fbb4[_0x5216f9])){_0x51fbb4[_0x5216f9]=this[_0x41c6('0x9d')](_0x51fbb4[_0x5216f9]);}}}};AGIVertices['prototype'][_0x41c6('0x9e')]=function(_0x985d8b,_0x23e12f){for(var _0x43b6ec in _0x985d8b){if(_0x985d8b[_0x41c6('0x99')](_0x43b6ec)){if(_['isPlainObject'](_0x985d8b[_0x43b6ec])){if(!_['isEmpty'](_0x985d8b[_0x43b6ec])){this['saveRestApiResult'](_0x985d8b[_0x43b6ec],util[_0x41c6('0x54')](_0x41c6('0x9f'),_0x23e12f,_0x43b6ec));}}else if(_[_0x41c6('0x9b')](_0x985d8b[_0x43b6ec])){for(var _0x35d0a1=0x0;_0x35d0a1<_0x985d8b[_0x43b6ec][_0x41c6('0x9c')];_0x35d0a1++){this[_0x41c6('0x9e')](_0x985d8b[_0x43b6ec][_0x35d0a1],util[_0x41c6('0x54')](_0x41c6('0x9f'),_0x23e12f,_0x43b6ec+'['+_0x35d0a1+']'));}}else{if(!_[_0x41c6('0x42')](_0x985d8b[_0x43b6ec])){this[_0x41c6('0x3a')][_0x41c6('0xa0')](util[_0x41c6('0x54')]('%s.%s',_0x23e12f,_0x43b6ec),_0x985d8b[_0x43b6ec]);}}}}};AGIVertices['prototype']['replaceObjectAllVariables']=function(_0x546c38){try{var _0x24f06b=JSON['parse'](_0x546c38);this[_0x41c6('0x98')](_0x24f06b);return JSON[_0x41c6('0x73')](_0x24f06b);}catch(_0x3c894b){return this['replaceAllVariables'](_0x546c38);}};AGIVertices[_0x41c6('0x16')][_0x41c6('0x9d')]=function(_0x3f7a16){var _0x339e4c=_0x3f7a16[_0x41c6('0xa1')]('{');for(var _0x1449e3=0x1;_0x1449e3<_0x339e4c[_0x41c6('0x9c')];_0x1449e3+=0x1){var _0xf7e6ad=_0x339e4c[_0x1449e3][_0x41c6('0xa1')]('}');if(_0xf7e6ad[_0x41c6('0x9c')]>0x1){_0x3f7a16=_0x3f7a16[_0x41c6('0xa2')]('{'+_0xf7e6ad[0x0]+'}',this[_0x41c6('0x3a')][_0x41c6('0xa3')](_0xf7e6ad[0x0])[_0x41c6('0xa4')]||_0xf7e6ad[0x0]);}}if(_0x339e4c['length']===0x1){return _0x3f7a16[_0x41c6('0x4b')]();}return this[_0x41c6('0x9d')](_0x3f7a16);};AGIVertices['prototype'][_0x41c6('0xa5')]=function(_0x3e6d64,_0x2f98fb){var _0x5c8283=this['channel'][_0x41c6('0xa3')](_0x3e6d64);if(_0x5c8283[_0x41c6('0xa6')]===-0x1){return _0x5c8283;}logger[_0x41c6('0x2d')](util[_0x41c6('0x54')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x2f98fb,_0x5c8283[_0x41c6('0xa4')]));return this['channel'][_0x41c6('0xa0')](_0x2f98fb,_0x5c8283[_0x41c6('0xa4')]);};AGIVertices[_0x41c6('0x16')][_0x41c6('0x86')]=function(_0x497ee9){return _0x497ee9&&_0x497ee9!=='0'&&_0x497ee9!=='-1'&&_0x497ee9!=='';};AGIVertices[_0x41c6('0x16')][_0x41c6('0xa7')]=function(_0x621932){this[_0x41c6('0x36')][_0x41c6('0x6f')](this,_0x621932,'-');_0x621932['retry']=_0x621932[_0x41c6('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x41c6('0xa8')]=function(_0x339b9e){logger[_0x41c6('0x2d')](util[_0x41c6('0x54')](_0x41c6('0xa9'),_0x339b9e[_0x41c6('0x38')]));if(!this[_0x41c6('0x86')](_0x339b9e['text'])){return this['channel']['noop'](_0x41c6('0xaa'));}var _0x2a2ddf='\x22'+_0x339b9e['text']+'\x22';if(this[_0x41c6('0x86')](_0x339b9e[_0x41c6('0x79')])){_0x2a2ddf+=','+_0x339b9e[_0x41c6('0x79')];}var _0x33c687=this[_0x41c6('0x3a')][_0x41c6('0x59')](_0x41c6('0xab'),_0x2a2ddf);if(_0x33c687[_0x41c6('0xa6')]===-0x1){return _0x33c687;}return this[_0x41c6('0x3a')][_0x41c6('0xac')](util[_0x41c6('0x54')](_0x41c6('0xad'),_0x2a2ddf));};AGIVertices[_0x41c6('0x16')][_0x41c6('0xae')]=function(_0x431323){logger[_0x41c6('0x2d')](util[_0x41c6('0x54')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x431323['label']));if(!this['isConfigured'](_0x431323[_0x41c6('0xaf')])){return this[_0x41c6('0x3a')][_0x41c6('0xac')](_0x41c6('0xb0'));}var _0x20f8b0=_0x431323[_0x41c6('0xaf')];if(this[_0x41c6('0x86')](_0x431323[_0x41c6('0x79')])){_0x20f8b0+=','+_0x431323[_0x41c6('0x79')];}var _0x3f66c7=this[_0x41c6('0x3a')][_0x41c6('0x59')](_0x41c6('0xb1'),_0x20f8b0);if(_0x3f66c7[_0x41c6('0xa6')]===-0x1){return _0x3f66c7;}var _0x323368=this[_0x41c6('0xa5')]('RECOG_CONFIDENCE()',_0x41c6('0xb2'));if(_0x323368['result']===-0x1){return _0x323368;}var _0xcfeac5=this[_0x41c6('0xa5')](_0x41c6('0xb3'),_0x41c6('0xb4'));if(_0xcfeac5['result']===-0x1){return _0xcfeac5;}var _0x5b75f1=this[_0x41c6('0xa5')](_0x41c6('0xb5'),_0x41c6('0xb6'));if(_0x5b75f1['result']===-0x1){return _0x5b75f1;}return this[_0x41c6('0x3a')][_0x41c6('0xac')](util[_0x41c6('0x54')](_0x41c6('0xb7'),_0x20f8b0));};AGIVertices[_0x41c6('0x16')][_0x41c6('0x7')]=function(_0x56e131){logger['info'](util[_0x41c6('0x54')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x56e131[_0x41c6('0x38')]));return this[_0x41c6('0x3a')][_0x41c6('0x7')]([_0x56e131[_0x41c6('0xb8')],_0x56e131['args']]);};AGIVertices[_0x41c6('0x16')][_0x41c6('0xb9')]=function(_0x45cfd2){logger[_0x41c6('0x2d')](util[_0x41c6('0x54')](_0x41c6('0xba'),_0x45cfd2[_0x41c6('0x38')]));if(this[_0x41c6('0x86')](_0x45cfd2[_0x41c6('0x65')])){logger['info'](util['format'](_0x41c6('0xbb'),_0x45cfd2['timeout']));var _0x5ce7fd=this[_0x41c6('0x3a')][_0x41c6('0xbc')](_0x45cfd2[_0x41c6('0x65')]);if(_0x5ce7fd[_0x41c6('0xa6')]===-0x1){return _0x5ce7fd;}}return this[_0x41c6('0x3a')][_0x41c6('0xb9')]();};AGIVertices[_0x41c6('0x16')]['callback']=function(_0x4b0188){logger[_0x41c6('0x2d')](util[_0x41c6('0x54')](_0x41c6('0xbd'),_0x4b0188['label']));if(!this[_0x41c6('0x86')](_0x4b0188['list_id'])){return this[_0x41c6('0x3a')][_0x41c6('0x32')](_0x4b0188,'no\x20list\x20selected');}_0x4b0188[_0x41c6('0x49')]=moment();if(this[_0x41c6('0x86')](_0x4b0188[_0x41c6('0xbe')])){_0x4b0188['scheduledAt']=moment()['add'](_0x4b0188['delay'],_0x41c6('0xbf'));}if(!this[_0x41c6('0x86')](_0x4b0188['callback_priority'])){_0x4b0188[_0x41c6('0x4c')]=0x2;}this[_0x41c6('0x41')][_0x41c6('0x6f')](this,_0x4b0188);return this[_0x41c6('0x3a')][_0x41c6('0xac')](util['format'](_0x41c6('0xc0'),_0x4b0188[_0x41c6('0x47')],_0x4b0188[_0x41c6('0x48')],_0x4b0188['scheduledAt']));};AGIVertices[_0x41c6('0x16')]['custom_app']=function(_0x2a9844){logger[_0x41c6('0x2d')](util['format'](_0x41c6('0xc1'),_0x2a9844['label']));var _0x36c764=this[_0x41c6('0x3a')][_0x41c6('0x59')](_0x2a9844[_0x41c6('0xc2')],_0x2a9844[_0x41c6('0x79')]);if(_0x36c764[_0x41c6('0xa6')]===-0x1){return _0x36c764;}return this[_0x41c6('0x3a')][_0x41c6('0xac')](util[_0x41c6('0x54')](_0x41c6('0xc3'),_0x2a9844[_0x41c6('0xc2')],_0x2a9844[_0x41c6('0x79')]));};AGIVertices[_0x41c6('0x16')][_0x41c6('0xc4')]=function(_0x1a6ed4){logger[_0x41c6('0x2d')](util[_0x41c6('0x54')](_0x41c6('0xc5'),_0x1a6ed4['label']));if(!this[_0x41c6('0x86')](_0x1a6ed4['text'])){return this['channel'][_0x41c6('0xac')](_0x41c6('0xaa'));}var _0x3c761e='\x22'+_0x1a6ed4[_0x41c6('0x5c')]+'\x22';if(this[_0x41c6('0x86')](_0x1a6ed4[_0x41c6('0x79')])){_0x3c761e+=','+_0x1a6ed4[_0x41c6('0x79')];}var _0x57a530=this[_0x41c6('0x3a')][_0x41c6('0x59')]('MRCPSynth',_0x3c761e);if(_0x57a530[_0x41c6('0xa6')]===-0x1){return _0x57a530;}return this[_0x41c6('0x3a')][_0x41c6('0xac')](util[_0x41c6('0x54')](_0x41c6('0xad'),_0x3c761e));};AGIVertices[_0x41c6('0x16')][_0x41c6('0xc6')]=function(_0x5cba4c){logger['info'](util['format'](_0x41c6('0xc7'),_0x5cba4c[_0x41c6('0x38')]));if(!this[_0x41c6('0x86')](_0x5cba4c['text'])){return this['channel'][_0x41c6('0xac')](_0x41c6('0xaa'));}var _0x1e8167='\x22'+_0x5cba4c['text']+'\x22';if(this[_0x41c6('0x86')](_0x5cba4c[_0x41c6('0x79')])){_0x1e8167+=','+_0x5cba4c[_0x41c6('0x79')];}var _0x519a5d=this[_0x41c6('0x3a')][_0x41c6('0x59')](_0x41c6('0xab'),_0x1e8167);if(_0x519a5d[_0x41c6('0xa6')]===-0x1){return _0x519a5d;}return this[_0x41c6('0x3a')][_0x41c6('0xac')](util['format'](_0x41c6('0xad'),_0x1e8167));};AGIVertices['prototype'][_0x41c6('0xc8')]=function(_0x4d39d5){logger[_0x41c6('0x2d')](util['format'](_0x41c6('0xc9'),_0x4d39d5['label']));if(!this[_0x41c6('0x86')](_0x4d39d5['grammar'])){return this['channel'][_0x41c6('0xac')]('no\x20grammar\x20configured');}var _0x675257=_0x4d39d5[_0x41c6('0xaf')];if(this[_0x41c6('0x86')](_0x4d39d5[_0x41c6('0x79')])){_0x675257+=','+_0x4d39d5['options'];}var _0x47ea75=this[_0x41c6('0x3a')][_0x41c6('0x59')](_0x41c6('0xb1'),_0x675257);if(_0x47ea75['result']===-0x1){return _0x47ea75;}var _0x146b50=this[_0x41c6('0xa5')](_0x41c6('0xca'),_0x41c6('0xcb'));if(_0x146b50[_0x41c6('0xa6')]===-0x1){return _0x146b50;}var _0xbb226a=this['getAndSetVariable']('RECOG_INPUT()',_0x41c6('0xcc'));if(_0xbb226a[_0x41c6('0xa6')]===-0x1){return _0xbb226a;}var _0x1f4f15=this['getAndSetVariable'](_0x41c6('0xb5'),_0x41c6('0xcd'));if(_0x1f4f15['result']===-0x1){return _0x1f4f15;}return this[_0x41c6('0x3a')][_0x41c6('0xac')](util['format'](_0x41c6('0xb7'),_0x675257));};AGIVertices[_0x41c6('0x16')]['sestekasr']=function(_0x596509){logger[_0x41c6('0x2d')](util['format']('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x596509[_0x41c6('0x38')]));if(!this[_0x41c6('0x86')](_0x596509[_0x41c6('0xaf')])){return this[_0x41c6('0x3a')][_0x41c6('0xac')](_0x41c6('0xb0'));}var _0x1febaf=_0x596509[_0x41c6('0xaf')];if(this[_0x41c6('0x86')](_0x596509[_0x41c6('0x79')])){_0x1febaf+=','+_0x596509['options'];}var _0x5477b8=this[_0x41c6('0x3a')][_0x41c6('0x59')](_0x41c6('0xb1'),_0x1febaf);if(_0x5477b8['result']===-0x1){return _0x5477b8;}var _0x5deb5b=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x41c6('0xce'));if(_0x5deb5b['result']===-0x1){return _0x5deb5b;}var _0x47d1ee=this[_0x41c6('0xa5')]('RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT');if(_0x47d1ee[_0x41c6('0xa6')]===-0x1){return _0x47d1ee;}var _0xbae013=this[_0x41c6('0xa5')](_0x41c6('0xb5'),_0x41c6('0xcf'));if(_0xbae013[_0x41c6('0xa6')]===-0x1){return _0xbae013;}return this[_0x41c6('0x3a')][_0x41c6('0xac')](util['format'](_0x41c6('0xb7'),_0x1febaf));};AGIVertices['prototype']['database']=function(_0x827cd7){logger[_0x41c6('0x2d')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x827cd7[_0x41c6('0x38')]));if(!this[_0x41c6('0x86')](_0x827cd7[_0x41c6('0xd0')])){return this[_0x41c6('0x3a')][_0x41c6('0x32')](_0x827cd7,_0x41c6('0xd1'));}var _0x4df051=this['getSquareOdbc'][_0x41c6('0x6f')](this,_0x827cd7[_0x41c6('0xd0')]);if(!_0x4df051){return this[_0x41c6('0x3a')]['error'](_0x827cd7,_0x41c6('0xd2'));}if(!this[_0x41c6('0x86')](_0x827cd7[_0x41c6('0x2f')])){return this[_0x41c6('0x3a')]['error'](_0x827cd7,_0x41c6('0xd3'));}var _0x1adb50=_0x827cd7[_0x41c6('0x2f')][_0x41c6('0xd4')](/(\r\n|\n|\r)/gm,'\x20');this[_0x41c6('0x3a')]['noop'](util['format']('query:\x20%s',_0x1adb50));var _0x1e81c9=this['getQueryOdbc'][_0x41c6('0x6f')](this,_0x4df051,_0x1adb50);this[_0x41c6('0x36')]['sync'](this,_0x827cd7,_0x1adb50);if(!this[_0x41c6('0x86')](_0x827cd7[_0x41c6('0xd5')])){return this['channel'][_0x41c6('0xac')](_0x41c6('0xd6'));}var _0x1c4f31=this['getVariable'][_0x41c6('0x6f')](this,_0x827cd7[_0x41c6('0xd5')]);if(!_0x1c4f31){return this[_0x41c6('0x3a')]['error'](_0x827cd7,_0x41c6('0xd7'));}var _0x5af9cc=this;_0x1e81c9[_0x41c6('0xd8')](function(_0x31b9dc,_0x26ec20){Object[_0x41c6('0xd9')](_0x31b9dc)[_0x41c6('0xd8')](function(_0x272d87){_0x5af9cc[_0x41c6('0x3a')][_0x41c6('0xa0')](util[_0x41c6('0x54')](_0x41c6('0xda'),_0x1c4f31,_0x26ec20,_0x272d87),_0x31b9dc[_0x272d87]);});});this['channel'][_0x41c6('0xa0')](util[_0x41c6('0x54')](_0x41c6('0xdb'),_0x1c4f31),_0x1e81c9[_0x41c6('0x9c')]);return this[_0x41c6('0x3a')][_0x41c6('0xac')](util[_0x41c6('0x54')](_0x41c6('0xdc'),_0x1c4f31));};AGIVertices['prototype']['dial']=function(_0x147eeb){logger[_0x41c6('0xdd')](util[_0x41c6('0x54')](_0x41c6('0xde'),_0x147eeb[_0x41c6('0x38')]));if(!this[_0x41c6('0x86')](_0x147eeb[_0x41c6('0xdf')])){return this['channel'][_0x41c6('0x32')](_0x147eeb,'no\x20user\x20selected');}var _0x183340=this[_0x41c6('0xe0')][_0x41c6('0x6f')](this,_0x147eeb[_0x41c6('0xdf')]);if(!_0x183340){return this[_0x41c6('0x3a')][_0x41c6('0x32')](_0x147eeb,_0x41c6('0xe1'));}var _0x190617=this[_0x41c6('0x3a')][_0x41c6('0x59')](_0x41c6('0xe2'),[util[_0x41c6('0x54')]('SIP/%s',_0x183340),_0x147eeb[_0x41c6('0x65')],_0x147eeb[_0x41c6('0xe3')],_0x147eeb[_0x41c6('0x72')]]);if(_0x190617['result']===-0x1){return _0x190617;}return this[_0x41c6('0x3a')][_0x41c6('0xac')](util['format']('Executed\x20command\x20%s',_0x41c6('0xe2')));};AGIVertices[_0x41c6('0x16')][_0x41c6('0xe4')]=function(_0x134ded){logger[_0x41c6('0x2d')](util[_0x41c6('0x54')](_0x41c6('0xe5'),_0x134ded[_0x41c6('0x38')]));if(!this[_0x41c6('0x86')](_0x134ded['key'])){return this[_0x41c6('0x3a')][_0x41c6('0xac')](_0x41c6('0xe6'));}if(!this[_0x41c6('0x86')](_0x134ded[_0x41c6('0x5c')])){return this[_0x41c6('0x3a')][_0x41c6('0xac')]('no\x20text\x20configured');}this[_0x41c6('0x3a')][_0x41c6('0xe7')]=!![];this['createSquareDetailsReport'](_0x134ded);this[_0x41c6('0x40')](_0x134ded[_0x41c6('0x5c')],'in','','');this[_0x41c6('0x3a')][_0x41c6('0xac')](util[_0x41c6('0x54')](_0x41c6('0xe8'),_0x134ded[_0x41c6('0x5c')]));var _0x4bc92c=this[_0x41c6('0x7a')]['sync'](this,_0x134ded);if(_0x4bc92c){for(var _0x37a4e5 in _0x4bc92c){if(_0x4bc92c[_0x41c6('0x99')](_0x37a4e5)){this['channel'][_0x41c6('0xa0')](util[_0x41c6('0x54')](_0x41c6('0xe9'),_0x37a4e5[_0x41c6('0x6a')]()),_0x4bc92c[_0x37a4e5]);}}this[_0x41c6('0x40')](_0x4bc92c[_0x41c6('0xea')],_0x41c6('0xeb'),_0x41c6('0xe4'),'');return this[_0x41c6('0x3a')][_0x41c6('0xac')](util[_0x41c6('0x54')]('Dialogflow\x20Result\x20%s',_0x4bc92c['speech']));}return this[_0x41c6('0x3a')][_0x41c6('0x32')](_0x134ded,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype'][_0x41c6('0xec')]=function(_0x51f9cf){logger[_0x41c6('0x2d')](util[_0x41c6('0x54')](_0x41c6('0xed'),_0x51f9cf['label']));if(!this[_0x41c6('0x86')](_0x51f9cf[_0x41c6('0x7d')])){return this['channel'][_0x41c6('0xac')]('no\x20project_id\x20configured');}if(!this[_0x41c6('0x86')](_0x51f9cf[_0x41c6('0x7e')])){return this['channel'][_0x41c6('0xac')](_0x41c6('0xee'));}if(!this[_0x41c6('0x86')](_0x51f9cf[_0x41c6('0x7f')])){return this[_0x41c6('0x3a')][_0x41c6('0xac')](_0x41c6('0xef'));}if(!this[_0x41c6('0x86')](_0x51f9cf[_0x41c6('0x80')])){return this['channel']['noop']('no\x20anguage\x20configured');}if(!this[_0x41c6('0x86')](_0x51f9cf[_0x41c6('0x5c')])){return this[_0x41c6('0x3a')][_0x41c6('0xac')](_0x41c6('0xaa'));}this[_0x41c6('0x3a')][_0x41c6('0xe7')]=!![];this[_0x41c6('0x36')](_0x51f9cf);this[_0x41c6('0x40')](_0x51f9cf['text'],'in','','');this['channel'][_0x41c6('0xac')](util[_0x41c6('0x54')](_0x41c6('0xf0'),_0x51f9cf['text']));var _0x5bf865=this[_0x41c6('0x7c')][_0x41c6('0x6f')](this,_0x51f9cf);if(_0x5bf865){for(var _0x4cd3fb in _0x5bf865){if(_0x5bf865['hasOwnProperty'](_0x4cd3fb)){if(_0x4cd3fb!==_0x41c6('0xf1')){this[_0x41c6('0x3a')][_0x41c6('0xa0')](util['format'](_0x41c6('0xe9'),_0x4cd3fb[_0x41c6('0x6a')]()),_0x5bf865[_0x4cd3fb]);}}}this[_0x41c6('0x40')](_0x5bf865[_0x41c6('0xea')],_0x41c6('0xeb'),_0x41c6('0xec'),_0x5bf865[_0x41c6('0xf1')]);return this[_0x41c6('0x3a')][_0x41c6('0xac')](util[_0x41c6('0x54')](_0x41c6('0xf2'),_0x5bf865[_0x41c6('0xea')]));}return this[_0x41c6('0x3a')][_0x41c6('0x32')](_0x51f9cf,_0x41c6('0xf3'));};AGIVertices[_0x41c6('0x16')][_0x41c6('0xf4')]=function(_0x5ca2e5){logger['info'](util[_0x41c6('0x54')](_0x41c6('0xf5'),_0x5ca2e5[_0x41c6('0x38')]));if(!this[_0x41c6('0x86')](_0x5ca2e5[_0x41c6('0xf6')])){return this[_0x41c6('0x3a')][_0x41c6('0xac')](_0x41c6('0xf7'));}if(!this[_0x41c6('0x86')](_0x5ca2e5[_0x41c6('0xf8')])){return this['channel'][_0x41c6('0xac')](_0x41c6('0xf9'));}if(!this[_0x41c6('0x86')](_0x5ca2e5['password'])){return this['channel'][_0x41c6('0xac')](_0x41c6('0xfa'));}if(!this['isConfigured'](_0x5ca2e5[_0x41c6('0xfb')])){return this[_0x41c6('0x3a')][_0x41c6('0xac')](_0x41c6('0xaa'));}this['channel']['bot']=!![];this[_0x41c6('0x36')](_0x5ca2e5);this[_0x41c6('0x40')](_0x5ca2e5[_0x41c6('0x5c')],'in','','');this[_0x41c6('0x3a')][_0x41c6('0xac')](util['format'](_0x41c6('0xfc'),_0x5ca2e5[_0x41c6('0x5c')]));var _0x12a874=this[_0x41c6('0x81')][_0x41c6('0x6f')](this,_0x5ca2e5);if(_0x12a874){for(var _0x30c236 in _0x12a874){if(_0x12a874[_0x41c6('0x99')](_0x30c236)){this[_0x41c6('0x3a')][_0x41c6('0xa0')](util[_0x41c6('0x54')](_0x41c6('0xfd'),_0x30c236[_0x41c6('0x6a')]()),_0x12a874[_0x30c236]);}}this['createSquareMessage'](_0x12a874[_0x41c6('0xea')],_0x41c6('0xeb'),_0x41c6('0xf4'),'');if(_0x12a874[_0x41c6('0xfe')]){this[_0x41c6('0x3a')][_0x41c6('0xac')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x12a874['audiofile']));var _0xe8d3f7=this[_0x41c6('0x3a')]['streamFile'](_0x12a874['audiofile']);try{fs[_0x41c6('0xff')](_0x12a874['audiofile']+_0x41c6('0x100'));}catch(_0x3a19f8){logger['error'](_0x3a19f8);}return _0xe8d3f7;}else{return this[_0x41c6('0x3a')]['noop'](util['format'](_0x41c6('0x101'),_0x12a874['speech']));}}return this[_0x41c6('0x3a')][_0x41c6('0x32')](_0x5ca2e5,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype'][_0x41c6('0x102')]=function(_0x153136){logger['info'](util['format'](_0x41c6('0x103'),_0x153136['label']));return this['channel'][_0x41c6('0xac')]('end');};AGIVertices['prototype']['ext_dial']=function(_0x427799){logger['info'](util[_0x41c6('0x54')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x427799[_0x41c6('0x38')]));var _0x10e11e='';if(_0x427799['trunk_id']){if(!this[_0x41c6('0x86')](_0x427799[_0x41c6('0x104')])){return this[_0x41c6('0x3a')]['error'](_0x427799,_0x41c6('0x105'));}else{var _0x580087=parseInt(_0x427799[_0x41c6('0x104')],0xa);if(isNaN(_0x580087)){_0x10e11e=_0x427799[_0x41c6('0x104')];}else{_0x10e11e=this['getTrunk'][_0x41c6('0x6f')](this,_0x427799[_0x41c6('0x104')]);if(!_0x10e11e){return this['channel'][_0x41c6('0x32')](_0x427799,'no\x20trunk\x20found');}}}}else if(_0x427799[_0x41c6('0x106')]){_0x10e11e=_0x427799['trunk_name'];}else{return this[_0x41c6('0x3a')][_0x41c6('0x32')](_0x427799,'no\x20trunk\x20selected');}var _0x422e93=this[_0x41c6('0x3a')][_0x41c6('0x59')](_0x41c6('0xe2'),[util[_0x41c6('0x54')](_0x41c6('0x107'),_0x10e11e,_0x427799[_0x41c6('0x47')]),_0x427799[_0x41c6('0x65')],_0x427799[_0x41c6('0xe3')],_0x427799[_0x41c6('0x72')]]);if(_0x422e93[_0x41c6('0xa6')]===-0x1){return _0x422e93;}return this['channel'][_0x41c6('0xac')](util['format']('Executed\x20command\x20%s',_0x41c6('0xe2')));};AGIVertices[_0x41c6('0x16')][_0x41c6('0x108')]=function(_0x2c7caa){logger[_0x41c6('0x2d')](util[_0x41c6('0x54')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x2c7caa['label']));return this[_0x41c6('0x3a')][_0x41c6('0xac')]('finally');};AGIVertices[_0x41c6('0x16')][_0x41c6('0xe')]=function(_0x3fb36e){logger['info'](util[_0x41c6('0x54')](_0x41c6('0x109'),_0x3fb36e['label']));if(_0x3fb36e[_0x41c6('0x10a')]===0x0){return this['maxRetry'](_0x3fb36e);}_0x3fb36e[_0x41c6('0x10a')]-=0x1;if(!this[_0x41c6('0x86')](_0x3fb36e[_0x41c6('0x10b')])){return this['channel']['error'](_0x3fb36e,_0x41c6('0x10c'));}var _0x4602e8=this[_0x41c6('0x1f')]['sync'](this,_0x3fb36e[_0x41c6('0x10b')]);if(!_0x4602e8){return this[_0x41c6('0x3a')][_0x41c6('0x32')](_0x3fb36e,_0x41c6('0x10d'));}if(!this[_0x41c6('0x86')](_0x3fb36e[_0x41c6('0xd5')])){return this[_0x41c6('0x3a')][_0x41c6('0x32')](_0x41c6('0xd6'));}var _0x55ab3b=this[_0x41c6('0x3a')][_0x41c6('0x10e')](_0x4602e8,_0x3fb36e[_0x41c6('0x10f')],_0x3fb36e[_0x41c6('0x110')]);var _0x3339c6=_0x55ab3b[_0x41c6('0xa6')]?_0x55ab3b[_0x41c6('0xa6')][_0x41c6('0x4b')]():'';logger[_0x41c6('0x2d')](_0x41c6('0x111'),JSON[_0x41c6('0x73')](_0x55ab3b));if(_0x55ab3b[_0x41c6('0xa6')]===-0x1){this[_0x41c6('0x36')][_0x41c6('0x6f')](this,_0x3fb36e,_0x3339c6);return _0x55ab3b;}else if(_0x55ab3b[_0x41c6('0xa4')]==='timeout'){_0x55ab3b['result']=_0x3339c6[_0x41c6('0x9c')]>=parseInt(_0x3fb36e['mindigit'])?'x':'i';}else{_0x55ab3b[_0x41c6('0xa6')]=_0x3339c6[_0x41c6('0x9c')]>=parseInt(_0x3fb36e['mindigit'])&&_0x3339c6[_0x41c6('0x9c')]<=parseInt(_0x3fb36e[_0x41c6('0x110')])?'x':'i';}var _0x155e10=this['getVariable'][_0x41c6('0x6f')](this,_0x3fb36e[_0x41c6('0xd5')]);if(!_0x155e10){return this[_0x41c6('0x3a')][_0x41c6('0x32')](_0x3fb36e,_0x41c6('0xd7'));}this['channel'][_0x41c6('0xa0')](_0x155e10,_0x3339c6);if(this[_0x41c6('0x86')](_0x3fb36e[_0x41c6('0x112')])){var _0x22c35e=parseInt(_0x3fb36e['hiddendigitsnum'],0xa);var _0x5a59b6=rs['generate']({'charset':'*','length':_0x22c35e});var _0xa83711=_0x3339c6[_0x41c6('0x9c')];if(_0xa83711>0x0){if(_0xa83711>_0x22c35e){this[_0x41c6('0x36')][_0x41c6('0x6f')](this,_0x3fb36e,_0x3fb36e[_0x41c6('0x113')]===_0x41c6('0x114')?_0x5a59b6+_0x3339c6['substr'](_0x22c35e):_0x3339c6[_0x41c6('0x115')](0x0,_0xa83711-_0x22c35e)+_0x5a59b6);}else{this[_0x41c6('0x36')][_0x41c6('0x6f')](this,_0x3fb36e,rs['generate']({'charset':'*','length':_0xa83711}));}}else{this[_0x41c6('0x36')][_0x41c6('0x6f')](this,_0x3fb36e,'');}}else{this[_0x41c6('0x36')][_0x41c6('0x6f')](this,_0x3fb36e,_0x3339c6);}return _0x55ab3b;};AGIVertices['prototype'][_0x41c6('0xf')]=function(_0x51e407){logger[_0x41c6('0x2d')](util['format'](_0x41c6('0x116'),_0x51e407[_0x41c6('0x38')]));return this[_0x41c6('0xe')](_0x51e407);};AGIVertices['prototype'][_0x41c6('0x117')]=function(_0x5ccec9){logger[_0x41c6('0x2d')](util[_0x41c6('0x54')](_0x41c6('0x118'),_0x5ccec9[_0x41c6('0x38')]));this['createSquareDetailsReport'][_0x41c6('0x6f')](this,_0x5ccec9,_0x5ccec9[_0x41c6('0x119')]);return this[_0x41c6('0x3a')]['noop'](util[_0x41c6('0x54')](_0x41c6('0x11a'),_0x5ccec9[_0x41c6('0x119')]));};AGIVertices[_0x41c6('0x16')]['awspolly']=function(_0x28d0e6){logger[_0x41c6('0x2d')](util['format'](_0x41c6('0x11b'),_0x28d0e6[_0x41c6('0x38')]));if(!this[_0x41c6('0x86')](_0x28d0e6[_0x41c6('0x89')])||!this[_0x41c6('0x86')](_0x28d0e6[_0x41c6('0x8a')])){return this[_0x41c6('0x3a')]['noop'](_0x41c6('0x11c'));}if(!this[_0x41c6('0x86')](_0x28d0e6[_0x41c6('0x5c')])){return this[_0x41c6('0x3a')][_0x41c6('0xac')](_0x41c6('0xaa'));}this[_0x41c6('0x3a')][_0x41c6('0xac')](util[_0x41c6('0x54')](_0x41c6('0x11d'),_0x28d0e6['text']));var _0x540bbb=this[_0x41c6('0x88')][_0x41c6('0x6f')](this,_0x28d0e6);if(_0x540bbb){this[_0x41c6('0x3a')]['noop'](util[_0x41c6('0x54')](_0x41c6('0x11e'),_0x540bbb));var _0x3d94a6=this[_0x41c6('0x3a')]['streamFile'](_0x540bbb);try{fs[_0x41c6('0xff')](_0x540bbb+_0x41c6('0x100'));}catch(_0x8cc1a5){logger[_0x41c6('0x32')](_0x8cc1a5);}return _0x3d94a6;}return this['channel']['error'](_0x28d0e6,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x41c6('0x16')][_0x41c6('0x11f')]=function(_0x2daef3){logger[_0x41c6('0x2d')](util['format'](_0x41c6('0x120'),_0x2daef3['label']));if(!this[_0x41c6('0x86')](_0x2daef3['aws_access_key_id'])||!this['isConfigured'](_0x2daef3[_0x41c6('0x8a')])){return this[_0x41c6('0x3a')]['noop'](_0x41c6('0x11c'));}if(!this[_0x41c6('0x86')](_0x2daef3['aws_bot_name'])){return this['channel'][_0x41c6('0xac')](_0x41c6('0x121'));}if(!this[_0x41c6('0x86')](_0x2daef3[_0x41c6('0x5c')])){return this[_0x41c6('0x3a')]['noop']('no\x20text\x20configured');}this[_0x41c6('0x3a')]['bot']=!![];this[_0x41c6('0x36')](_0x2daef3);this[_0x41c6('0x40')](_0x2daef3[_0x41c6('0x5c')],'in','','');this['channel'][_0x41c6('0xac')](util['format'](_0x41c6('0x122'),_0x2daef3[_0x41c6('0x5c')]));var _0x510b83=this['awsLex'][_0x41c6('0x6f')](this,_0x2daef3);if(_0x510b83){for(var _0x4d3a59 in _0x510b83){if(_0x510b83[_0x41c6('0x99')](_0x4d3a59)&&_[_0x41c6('0x96')](_0x510b83[_0x4d3a59])){this[_0x41c6('0x3a')][_0x41c6('0xa0')](util['format'](_0x41c6('0x123'),_0x4d3a59[_0x41c6('0x6a')]()),_0x510b83[_0x4d3a59]);}}if(_[_0x41c6('0x42')](_0x510b83[_0x41c6('0x78')])){return this[_0x41c6('0x3a')][_0x41c6('0xac')](_0x41c6('0x124'));}else{this['createSquareMessage'](_0x510b83['message'],'out',_0x41c6('0x125'),'');return this[_0x41c6('0x3a')]['noop'](util['format'](_0x41c6('0x126'),_0x510b83[_0x41c6('0x78')]));}}return this[_0x41c6('0x3a')][_0x41c6('0x32')](_0x2daef3,_0x41c6('0x127'));};AGIVertices['prototype'][_0x41c6('0x128')]=function(_0x2d3f25){logger['info'](util[_0x41c6('0x54')](_0x41c6('0x129'),_0x2d3f25[_0x41c6('0x38')],_0x2d3f25[_0x41c6('0x65')]));if(!this[_0x41c6('0x86')](_0x2d3f25[_0x41c6('0x84')])){return this[_0x41c6('0x3a')]['noop']('no\x20key\x20configured');}var _0x49d8bc=_0x41c6('0x12a');var _0x2daa36=util[_0x41c6('0x54')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x10c819=util['format'](_0x41c6('0x9f'),_0x2daa36,_0x49d8bc);var _0x13b646=!![];if(_0x2d3f25[_0x41c6('0x12b')]===_0x41c6('0x12c')){_0x13b646=![];}var _0x2467f2=this['channel'][_0x41c6('0x12d')](_0x2daa36,_0x49d8bc,_0x2d3f25[_0x41c6('0x12e')],_0x2d3f25['timeout'],undefined,_0x13b646);if(_0x2467f2['result']!==-0x1){this[_0x41c6('0x3a')][_0x41c6('0xac')](util[_0x41c6('0x54')](_0x41c6('0x12f'),_0x10c819));var _0x4f493c=this['googleASR']['sync'](this,_0x2d3f25,_0x10c819);if(_0x4f493c){for(var _0x2004ae in _0x4f493c){if(_0x4f493c[_0x41c6('0x99')](_0x2004ae)){this[_0x41c6('0x3a')][_0x41c6('0xa0')](util[_0x41c6('0x54')](_0x41c6('0x130'),_0x2004ae[_0x41c6('0x6a')]()),_0x4f493c[_0x2004ae]);}}return this[_0x41c6('0x3a')][_0x41c6('0xac')](util[_0x41c6('0x54')](_0x41c6('0x131'),JSON[_0x41c6('0x73')](_0x4f493c)));}}return _0x2467f2;};AGIVertices[_0x41c6('0x16')]['tildeasr']=function(_0x320be4){logger[_0x41c6('0x2d')](util[_0x41c6('0x54')](_0x41c6('0x132'),_0x320be4[_0x41c6('0x38')]));if(!this[_0x41c6('0x86')](_0x320be4['appid'])){return this['channel']['noop']('no\x20appid\x20configured');}if(!this[_0x41c6('0x86')](_0x320be4[_0x41c6('0x93')])){return this[_0x41c6('0x3a')][_0x41c6('0xac')]('no\x20appsecret\x20configured');}var _0x37ca61='wav';var _0x3a1a8e=util[_0x41c6('0x54')](_0x41c6('0x133'),FILES_PATH,rs[_0x41c6('0x134')](0x4));var _0x2922c8=util['format'](_0x41c6('0x9f'),_0x3a1a8e,_0x37ca61);var _0x290e74=!![];if(_0x320be4[_0x41c6('0x12b')]==='NOBEEP'){_0x290e74=![];}var _0x2d8dcf=this[_0x41c6('0x3a')][_0x41c6('0x12d')](_0x3a1a8e,_0x37ca61,_0x320be4[_0x41c6('0x12e')],_0x320be4[_0x41c6('0x65')],undefined,_0x290e74);if(_0x2d8dcf['result']!==-0x1){this[_0x41c6('0x3a')][_0x41c6('0xac')](util[_0x41c6('0x54')](_0x41c6('0x135'),_0x2922c8));var _0x4e8fc9=this[_0x41c6('0x91')][_0x41c6('0x6f')](this,_0x320be4,_0x2922c8);if(_0x4e8fc9){for(var _0x201be4 in _0x4e8fc9){if(_0x4e8fc9[_0x41c6('0x99')](_0x201be4)){this['channel'][_0x41c6('0xa0')](util[_0x41c6('0x54')](_0x41c6('0x136'),_0x201be4[_0x41c6('0x6a')]()),_0x4e8fc9[_0x201be4]);}}return this[_0x41c6('0x3a')][_0x41c6('0xac')](util[_0x41c6('0x54')](_0x41c6('0x137'),JSON[_0x41c6('0x73')](_0x4e8fc9)));}}return _0x2d8dcf;};AGIVertices['prototype']['gotoc']=function(_0x121d7b){logger[_0x41c6('0x2d')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x121d7b['label']));return this[_0x41c6('0x3a')][_0x41c6('0x138')](_0x121d7b[_0x41c6('0x139')],_0x121d7b[_0x41c6('0x13a')],_0x121d7b[_0x41c6('0x3e')]);};AGIVertices['prototype'][_0x41c6('0x13b')]=function(_0x57f6b3){logger[_0x41c6('0x2d')](util['format'](_0x41c6('0x13c'),_0x57f6b3[_0x41c6('0x38')]));if(!this['isConfigured'](_0x57f6b3[_0x41c6('0x13d')])){return this[_0x41c6('0x3a')][_0x41c6('0x32')](_0x57f6b3,_0x41c6('0x13e'));}try{var _0x4e37e3=eval(_0x57f6b3['condition'])?'true':_0x41c6('0x13f');this[_0x41c6('0x3a')][_0x41c6('0xac')](util[_0x41c6('0x54')](_0x41c6('0x140'),_0x57f6b3[_0x41c6('0x13d')],_0x4e37e3));return{'code':0xc8,'result':_0x4e37e3};}catch(_0x48d960){return{'code':0xc8,'result':_0x41c6('0x13f')};}};AGIVertices[_0x41c6('0x16')][_0x41c6('0x141')]=function(_0x5cd669){logger[_0x41c6('0x2d')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x5cd669['label']));if(!this[_0x41c6('0x86')](_0x5cd669[_0x41c6('0x142')])){return this[_0x41c6('0x3a')][_0x41c6('0x32')](_0x5cd669,_0x41c6('0x143'));}var _0xd8ed16=this[_0x41c6('0x25')][_0x41c6('0x6f')](this,_0x5cd669[_0x41c6('0x142')]);if(!_0xd8ed16){return this['channel'][_0x41c6('0x32')](_0x5cd669,_0x41c6('0x144'));}for(var _0x3d8254=0x0;_0x3d8254<_0xd8ed16[_0x41c6('0x9c')];_0x3d8254+=0x1){var _0x481239=this['channel'][_0x41c6('0xa3')](util[_0x41c6('0x54')]('IFTIME(%s?true:false)',_0xd8ed16[_0x3d8254]));if(_0x481239['result']===-0x1){return _0x481239;}logger['info'](util[_0x41c6('0x54')](_0x41c6('0x145'),_0xd8ed16[_0x3d8254],_0x481239[_0x41c6('0xa4')]));if(_0x481239[_0x41c6('0xa4')]===_0x41c6('0x146')){logger['info'](util['format'](_0x41c6('0x145'),_0xd8ed16[_0x3d8254],_0x41c6('0x146')));this[_0x41c6('0x3a')][_0x41c6('0xac')](util[_0x41c6('0x54')]('IFTIME\x20%s\x20%s',_0xd8ed16[_0x3d8254],_0x41c6('0x146')));return{'code':0xc8,'result':_0x41c6('0x146')};}else{logger[_0x41c6('0x2d')](util[_0x41c6('0x54')]('IFTIME\x20%s\x20%s',_0xd8ed16[_0x3d8254],_0x41c6('0x13f')));this[_0x41c6('0x3a')][_0x41c6('0xac')](util[_0x41c6('0x54')](_0x41c6('0x145'),_0xd8ed16[_0x3d8254],_0x41c6('0x13f')));}}return{'code':0xc8,'result':_0x41c6('0x13f')};};AGIVertices['prototype']['hangup']=function(_0x380937){logger[_0x41c6('0x2d')](util[_0x41c6('0x54')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x380937[_0x41c6('0x38')]));return this[_0x41c6('0x3a')][_0x41c6('0x147')]();};AGIVertices[_0x41c6('0x16')][_0x41c6('0x148')]=function(_0x52c6cb){logger[_0x41c6('0x2d')](util[_0x41c6('0x54')](_0x41c6('0x149'),_0x52c6cb[_0x41c6('0x38')]));if(!this[_0x41c6('0x86')](_0x52c6cb[_0x41c6('0x84')])){return this[_0x41c6('0x3a')]['noop'](_0x41c6('0xe6'));}var _0x4f1ac3=_0x41c6('0x12a');var _0x235a32=util[_0x41c6('0x54')]('%s/recordings/%s',FILES_PATH,rs[_0x41c6('0x134')](0x4));var _0x364296=util[_0x41c6('0x54')](_0x41c6('0x9f'),_0x235a32,_0x4f1ac3);var _0x33b4fb=!![];if(_0x52c6cb[_0x41c6('0x12b')]==='NOBEEP'){_0x33b4fb=![];}var _0xe8034e=this[_0x41c6('0x3a')]['recordFile'](_0x235a32,_0x4f1ac3,_0x52c6cb[_0x41c6('0x12e')],_0x52c6cb[_0x41c6('0x65')],undefined,_0x33b4fb);if(_0xe8034e[_0x41c6('0xa6')]!==-0x1){this[_0x41c6('0x3a')]['noop'](util['format']('ispeech\x20%s\x20file\x20created',_0x364296));var _0x3bb6ce=this[_0x41c6('0x14a')][_0x41c6('0x6f')](this,_0x52c6cb,_0x364296);if(_0x3bb6ce){for(var _0x2e3aa2 in _0x3bb6ce){if(_0x3bb6ce['hasOwnProperty'](_0x2e3aa2)){this[_0x41c6('0x3a')][_0x41c6('0xa0')](util[_0x41c6('0x54')](_0x41c6('0x14b'),_0x2e3aa2[_0x41c6('0x6a')]()),_0x3bb6ce[_0x2e3aa2]);}}return this['channel'][_0x41c6('0xac')](util[_0x41c6('0x54')](_0x41c6('0x14c'),JSON[_0x41c6('0x73')](_0x3bb6ce)));}}return _0xe8034e;};AGIVertices[_0x41c6('0x16')][_0x41c6('0x14d')]=function(_0x964a5e){logger[_0x41c6('0x2d')](util[_0x41c6('0x54')](_0x41c6('0x14e'),_0x964a5e[_0x41c6('0x38')]));if(!this['isConfigured'](_0x964a5e['key'])){return this[_0x41c6('0x3a')][_0x41c6('0xac')](_0x41c6('0xe6'));}if(!this[_0x41c6('0x86')](_0x964a5e[_0x41c6('0x5c')])){return this['channel'][_0x41c6('0xac')](_0x41c6('0xaa'));}this['channel'][_0x41c6('0xac')](util['format'](_0x41c6('0x14f'),_0x964a5e[_0x41c6('0x5c')]));var _0x14eb12=this['ispeechTTS']['sync'](this,_0x964a5e);if(_0x14eb12){this['channel'][_0x41c6('0xac')](util[_0x41c6('0x54')](_0x41c6('0x150'),_0x14eb12));var _0x1122ae=this[_0x41c6('0x3a')][_0x41c6('0x151')](_0x14eb12,_0x964a5e['intKey']);try{fs[_0x41c6('0xff')](_0x14eb12+_0x41c6('0x100'));}catch(_0xf362f5){logger[_0x41c6('0x32')](_0xf362f5);}return _0x1122ae;}return this[_0x41c6('0x3a')][_0x41c6('0x32')](_0x964a5e,_0x41c6('0x152'));};AGIVertices[_0x41c6('0x16')]['login']=function(_0x4f6d57){logger[_0x41c6('0x2d')](util['format'](_0x41c6('0x153'),_0x4f6d57[_0x41c6('0x38')]));if(!this[_0x41c6('0x86')](_0x4f6d57['findBy'])){return this[_0x41c6('0x3a')]['error'](_0x4f6d57,_0x41c6('0x154'));}logger[_0x41c6('0x2d')](util['format'](_0x41c6('0x155'),this[_0x41c6('0x3a')][_0x41c6('0x3c')],_0x4f6d57['findBy']));var _0x335a3e=this['agentLogin']['sync'](this,_0x4f6d57[_0x41c6('0x156')]);if(_0x335a3e){logger['info'](util[_0x41c6('0x54')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x41c6('0x3a')]['callerid'],_0x4f6d57[_0x41c6('0x156')]));this[_0x41c6('0x3a')][_0x41c6('0xac')](util[_0x41c6('0x54')](_0x41c6('0x157'),this['channel'][_0x41c6('0x3c')],_0x4f6d57[_0x41c6('0x156')]));return{'code':0xc8,'result':_0x41c6('0x158')};}else{logger[_0x41c6('0x2d')](util[_0x41c6('0x54')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x41c6('0x3a')][_0x41c6('0x3c')],_0x4f6d57['findBy']));this[_0x41c6('0x3a')]['noop'](util[_0x41c6('0x54')](_0x41c6('0x159'),this['channel'][_0x41c6('0x3c')],_0x4f6d57[_0x41c6('0x156')]));return{'code':0xc8,'result':_0x41c6('0x15a')};}};AGIVertices[_0x41c6('0x16')][_0x41c6('0x15b')]=function(_0x3e9291){logger[_0x41c6('0x2d')](util[_0x41c6('0x54')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x3e9291['label']));if(!this['isConfigured'](_0x3e9291['findBy'])){return this[_0x41c6('0x3a')]['error'](_0x3e9291,_0x41c6('0x154'));}logger[_0x41c6('0x2d')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x41c6('0x3a')]['callerid'],_0x3e9291[_0x41c6('0x156')]));var _0x238f30=this[_0x41c6('0x52')]['sync'](this,_0x3e9291[_0x41c6('0x156')]);if(_0x238f30){logger[_0x41c6('0x2d')](util[_0x41c6('0x54')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x41c6('0x3c')],_0x3e9291[_0x41c6('0x156')]));this['channel'][_0x41c6('0xac')](util[_0x41c6('0x54')](_0x41c6('0x157'),this[_0x41c6('0x3a')][_0x41c6('0x3c')],_0x3e9291[_0x41c6('0x156')]));return{'code':0xc8,'result':_0x41c6('0x158')};}else{logger[_0x41c6('0x2d')](util[_0x41c6('0x54')](_0x41c6('0x159'),this['channel'][_0x41c6('0x3c')],_0x3e9291[_0x41c6('0x156')]));this['channel'][_0x41c6('0xac')](util[_0x41c6('0x54')](_0x41c6('0x159'),this[_0x41c6('0x3a')][_0x41c6('0x3c')],_0x3e9291[_0x41c6('0x156')]));return{'code':0xc8,'result':_0x41c6('0x15a')};}};AGIVertices[_0x41c6('0x16')][_0x41c6('0x15c')]=function(_0x35d09d){logger['info'](util[_0x41c6('0x54')](_0x41c6('0x15d'),_0x35d09d[_0x41c6('0x38')]));if(!this[_0x41c6('0x86')](_0x35d09d['operation'])){return this[_0x41c6('0x3a')][_0x41c6('0x32')](_0x35d09d,_0x41c6('0x15e'));}this['channel']['noop'](util[_0x41c6('0x54')](_0x41c6('0x15f'),_0x35d09d[_0x41c6('0x160')]));var _0x5b29f0=eval(_0x35d09d[_0x41c6('0x160')]);if(!this[_0x41c6('0x86')](_0x35d09d[_0x41c6('0xd5')])){return this[_0x41c6('0x3a')][_0x41c6('0xac')](_0x41c6('0xd6'));}var _0x21e791=this['getVariable']['sync'](this,_0x35d09d[_0x41c6('0xd5')]);if(!_0x21e791){return this['channel'][_0x41c6('0x32')](_0x35d09d,_0x41c6('0xd7'));}if(_['isArray'](_0x5b29f0)){var _0x301ae9=this;_0x5b29f0[_0x41c6('0xd8')](function(_0x4f85b7,_0x3e2293){_0x301ae9[_0x41c6('0x3a')][_0x41c6('0xa0')](util['format']('%s[%s]',_0x21e791,_0x3e2293),_0x4f85b7);});return this['channel'][_0x41c6('0xac')](util[_0x41c6('0x54')](_0x41c6('0x161'),_0x21e791));}else{return this[_0x41c6('0x3a')][_0x41c6('0xa0')](_0x21e791,_0x5b29f0);}};AGIVertices[_0x41c6('0x16')][_0x41c6('0xd')]=function(_0xb72b03){logger[_0x41c6('0x2d')](util[_0x41c6('0x54')](_0x41c6('0x162'),_0xb72b03[_0x41c6('0x38')]));if(_0xb72b03[_0x41c6('0x10a')]===0x0){return this[_0x41c6('0xa7')](_0xb72b03);}_0xb72b03['retry']-=0x1;if(!this[_0x41c6('0x86')](_0xb72b03['file_id'])){return this[_0x41c6('0x3a')]['error'](_0xb72b03,_0x41c6('0x10c'));}var _0x2028fd=this[_0x41c6('0x1f')]['sync'](this,_0xb72b03[_0x41c6('0x10b')]);if(!_0x2028fd){return this['channel'][_0x41c6('0x32')](_0xb72b03,_0x41c6('0x10d'));}var _0x5c1b0a=this[_0x41c6('0x3a')][_0x41c6('0x10e')](_0x2028fd,_0xb72b03['response'],_0xb72b03['digit']);var _0x5de5d8=_0x5c1b0a['result'];if(_0x5c1b0a[_0x41c6('0xa6')]===-0x1){this[_0x41c6('0x36')]['sync'](this,_0xb72b03,'-1');return _0x5c1b0a;}else if(_0x5c1b0a[_0x41c6('0xa4')]===_0x41c6('0x65')){_0x5c1b0a[_0x41c6('0xa6')]=_0x5c1b0a['result']['length']>0x0?_0x5c1b0a[_0x41c6('0xa6')]:'t';}else if(_[_0x41c6('0x45')](_0x5c1b0a[_0x41c6('0xa6')])){_0x5c1b0a[_0x41c6('0xa6')]='#';_0x5de5d8='#';}if(!this[_0x41c6('0x86')](_0xb72b03[_0x41c6('0xd5')])){this[_0x41c6('0x3a')][_0x41c6('0xac')](_0x41c6('0xd6'));}else{var _0x57fe51=this[_0x41c6('0xa3')]['sync'](this,_0xb72b03[_0x41c6('0xd5')]);if(!_0x57fe51){return this[_0x41c6('0x3a')][_0x41c6('0x32')](_0xb72b03,_0x41c6('0xd7'));}this[_0x41c6('0x3a')][_0x41c6('0xa0')](_0x57fe51,_0x5de5d8);}this[_0x41c6('0x36')]['sync'](this,_0xb72b03,_0x5de5d8);return _0x5c1b0a;};AGIVertices[_0x41c6('0x16')]['noop']=function(_0xf79ced){logger[_0x41c6('0x2d')](util[_0x41c6('0x54')](_0x41c6('0x163'),_0xf79ced['label']));return this[_0x41c6('0x3a')][_0x41c6('0xac')](_0xf79ced[_0x41c6('0x164')]||_0xf79ced[_0x41c6('0x38')]);};AGIVertices[_0x41c6('0x16')][_0x41c6('0x165')]=function(_0x34b1b8){logger[_0x41c6('0x2d')](util[_0x41c6('0x54')](_0x41c6('0x166'),_0x34b1b8[_0x41c6('0x38')]));if(!this[_0x41c6('0x86')](_0x34b1b8['findBy'])){return this[_0x41c6('0x3a')][_0x41c6('0x32')](_0x34b1b8,'no\x20find\x20by\x20configured');}logger['info'](util[_0x41c6('0x54')](_0x41c6('0x155'),this[_0x41c6('0x3a')][_0x41c6('0x3c')],_0x34b1b8[_0x41c6('0x156')]));var _0x33be33=this[_0x41c6('0x4d')][_0x41c6('0x6f')](this,_0x34b1b8['pause_id']);var _0x113ff1=this[_0x41c6('0x4f')]['sync'](this,_0x34b1b8[_0x41c6('0x156')],_0x33be33);if(_0x113ff1){logger[_0x41c6('0x2d')](util[_0x41c6('0x54')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x41c6('0x3c')],_0x34b1b8['findBy']));this[_0x41c6('0x3a')]['noop'](util[_0x41c6('0x54')](_0x41c6('0x157'),this['channel']['callerid'],_0x34b1b8['findBy']));return{'code':0xc8,'result':_0x41c6('0x158')};}else{logger['info'](util['format'](_0x41c6('0x159'),this[_0x41c6('0x3a')][_0x41c6('0x3c')],_0x34b1b8['findBy']));this['channel']['noop'](util[_0x41c6('0x54')](_0x41c6('0x157'),this[_0x41c6('0x3a')][_0x41c6('0x3c')],_0x34b1b8['findBy']));return{'code':0xc8,'result':_0x41c6('0x15a')};}};AGIVertices[_0x41c6('0x16')][_0x41c6('0x167')]=function(_0xea9cbf){logger[_0x41c6('0x2d')](util[_0x41c6('0x54')](_0x41c6('0x168'),_0xea9cbf[_0x41c6('0x38')]));if(!this['isConfigured'](_0xea9cbf[_0x41c6('0x10b')])){return this['channel'][_0x41c6('0x32')](_0xea9cbf,_0x41c6('0x10c'));}var _0xa8a12a=this['getSound']['sync'](this,_0xea9cbf[_0x41c6('0x10b')]);if(!_0xa8a12a){return this[_0x41c6('0x3a')][_0x41c6('0x32')](_0xea9cbf,'no\x20file\x20audio\x20found');}var _0x1c76bf=this[_0x41c6('0x3a')][_0x41c6('0x59')]('PLAYBACK',[_0xa8a12a,_0xea9cbf['opts']]);if(_0x1c76bf[_0x41c6('0xa6')]===-0x1){return _0x1c76bf;}return this[_0x41c6('0x3a')]['noop'](util['format'](_0x41c6('0xc3'),'PLAYBACK',_0xa8a12a));};AGIVertices[_0x41c6('0x16')][_0x41c6('0x169')]=function(_0x3ef339){logger[_0x41c6('0x2d')](util[_0x41c6('0x54')](_0x41c6('0x16a'),_0x3ef339['label']));if(!this['isConfigured'](_0x3ef339[_0x41c6('0x16b')])){return this['channel'][_0x41c6('0x32')](_0x3ef339,_0x41c6('0x16c'));}var _0x65a24b='';var _0x507be4=parseInt(_0x3ef339[_0x41c6('0x16b')],0xa);if(isNaN(_0x507be4)){_0x65a24b=_0x3ef339[_0x41c6('0x16b')];}else{_0x65a24b=this[_0x41c6('0x17')][_0x41c6('0x6f')](this,_0x3ef339['queue_id']);if(!_0x65a24b){return this[_0x41c6('0x3a')][_0x41c6('0x32')](_0x3ef339,_0x41c6('0x16d'));}}var _0x3e29f8='';if(this['isConfigured'](_0x3ef339[_0x41c6('0x10b')])){var _0x527c00=this[_0x41c6('0x1f')][_0x41c6('0x6f')](this,_0x3ef339[_0x41c6('0x10b')]);if(_0x527c00){_0x3e29f8=_0x527c00;}}this['createSquareDetailsReport']['sync'](this,_0x3ef339,_0x65a24b);if(_0x3ef339[_0x41c6('0xe3')][_0x41c6('0x16e')]('x')<0x0){_0x3ef339[_0x41c6('0xe3')]+='x';}if(_0x3ef339['opts'][_0x41c6('0x16e')]('X')<0x0){_0x3ef339[_0x41c6('0xe3')]+='X';}this[_0x41c6('0x3a')][_0x41c6('0xa0')](_0x41c6('0x16f'),_0x65a24b?_0x65a24b[_0x41c6('0x170')]():'');var _0x17a96e=this['channel']['exec']('QUEUE',[_0x65a24b,_0x3ef339['opts'],_0x3ef339[_0x41c6('0x72')],_0x3e29f8,_0x3ef339[_0x41c6('0x65')],_0x3ef339[_0x41c6('0x7')],_0x3ef339['macro'],_0x3ef339['gosub'],'',_0x3ef339[_0x41c6('0x171')]]);if(_0x17a96e[_0x41c6('0xa6')]===-0x1){return _0x17a96e;}return this[_0x41c6('0x3a')][_0x41c6('0xac')](util[_0x41c6('0x54')]('Executed\x20command\x20%s\x20%s',_0x41c6('0x172'),_0x65a24b));};AGIVertices[_0x41c6('0x16')][_0x41c6('0x173')]=function(_0x9d589b){logger[_0x41c6('0x2d')](util[_0x41c6('0x54')](_0x41c6('0x174'),_0x9d589b[_0x41c6('0x38')]));var _0x1597e8=_0x9d589b[_0x41c6('0x175')]||'wav';var _0x1ed11b=util[_0x41c6('0x54')](_0x41c6('0x176'),this[_0x41c6('0x3a')][_0x41c6('0x37')],rs['generate'](0x5));var _0x5e5b7f=util[_0x41c6('0x54')]('%s/recordings/%s.%s',FILES_PATH,_0x1ed11b,_0x1597e8);var _0x19ccd5=util[_0x41c6('0x54')]('%s/recordings/%s',FILES_PATH,_0x1ed11b);this[_0x41c6('0x3d')]['sync'](this,_0x9d589b,_0x1ed11b,_0x5e5b7f);this[_0x41c6('0x3a')][_0x41c6('0xa0')](_0x41c6('0x177'),_0x1ed11b);logger[_0x41c6('0x2d')](_0x41c6('0x178'),_0x19ccd5,_0x1597e8,_0x9d589b['escape_digits'],_0x9d589b['timeout']);return this[_0x41c6('0x3a')][_0x41c6('0x12d')](_0x19ccd5,_0x1597e8,_0x9d589b[_0x41c6('0x179')],_0x9d589b[_0x41c6('0x65')],undefined,!![]);};AGIVertices[_0x41c6('0x16')][_0x41c6('0x17a')]=function(_0x46d03f){logger['info'](util[_0x41c6('0x54')](_0x41c6('0x17b'),_0x46d03f[_0x41c6('0x38')]));if(!this[_0x41c6('0x86')](_0x46d03f[_0x41c6('0x72')])){return this[_0x41c6('0x3a')][_0x41c6('0xac')](_0x41c6('0x17c'));}var _0x2474c7=this[_0x41c6('0x64')][_0x41c6('0x6f')](this,_0x46d03f);logger[_0x41c6('0x2d')](util['format']('Response:',util[_0x41c6('0x17d')](_0x2474c7,{'showHidden':![],'depth':null})));if(!this[_0x41c6('0x86')](_0x46d03f[_0x41c6('0xd5')])){return this[_0x41c6('0x3a')][_0x41c6('0xac')](_0x41c6('0x17e'));}var _0x1a838c=this[_0x41c6('0xa3')][_0x41c6('0x6f')](this,_0x46d03f['variable_id']);if(!_0x1a838c){return this['channel'][_0x41c6('0x32')](_0x46d03f,_0x41c6('0xd7'));}this[_0x41c6('0x3a')][_0x41c6('0xa0')](util[_0x41c6('0x54')](_0x41c6('0x17f'),_0x1a838c),_0x2474c7['statusCode']?_0x2474c7[_0x41c6('0x76')]:'200');this['channel']['setVariable'](util['format'](_0x41c6('0x180'),_0x1a838c),_0x2474c7[_0x41c6('0x77')]?_0x2474c7[_0x41c6('0x77')]:'OK');if(_0x2474c7['body']){try{this['saveRestApiResult'](_0x2474c7[_0x41c6('0x74')],_0x1a838c);}catch(_0x406177){logger[_0x41c6('0x32')](util[_0x41c6('0x54')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x1a838c));}}return this[_0x41c6('0x3a')]['noop'](util['format'](_0x41c6('0xdc'),_0x1a838c));};AGIVertices[_0x41c6('0x16')][_0x41c6('0x181')]=function(_0x1f6d91){logger[_0x41c6('0x2d')](util[_0x41c6('0x54')](_0x41c6('0x182'),_0x1f6d91[_0x41c6('0x38')]));return this[_0x41c6('0x3a')][_0x41c6('0x183')](_0x1f6d91['digits']['replace'](/\s+/g,''),_0x1f6d91['escape_digits']);};AGIVertices[_0x41c6('0x16')][_0x41c6('0x184')]=function(_0x3567f9){logger[_0x41c6('0x2d')](util[_0x41c6('0x54')](_0x41c6('0x185'),_0x3567f9[_0x41c6('0x38')]));return this[_0x41c6('0x3a')]['sayNumber'](_0x3567f9['number'][_0x41c6('0xd4')](/\s+/g,''),_0x3567f9[_0x41c6('0x179')]);};AGIVertices[_0x41c6('0x16')][_0x41c6('0x186')]=function(_0x394d6e){logger['info'](util[_0x41c6('0x54')](_0x41c6('0x187'),_0x394d6e['label']));return this['channel'][_0x41c6('0x188')](_0x394d6e['text'],_0x394d6e[_0x41c6('0x179')]);};AGIVertices[_0x41c6('0x16')]['sendMail']=function(_0x4e6b30){logger['info'](util[_0x41c6('0x54')](_0x41c6('0x189'),_0x4e6b30[_0x41c6('0x38')]));if(!this[_0x41c6('0x86')](_0x4e6b30[_0x41c6('0x18a')])){return this[_0x41c6('0x3a')][_0x41c6('0xac')](_0x41c6('0x18b'));}var _0x7a8fa8=this[_0x41c6('0x18c')][_0x41c6('0x6f')](this,_0x4e6b30[_0x41c6('0x18a')]);if(!_0x7a8fa8||!_0x7a8fa8[_0x41c6('0x18d')]){return this['channel'][_0x41c6('0x32')](_0x4e6b30,_0x41c6('0x18e'));}var _0x2c91e5={'from':util[_0x41c6('0x54')](_0x41c6('0x18f'),_0x7a8fa8[_0x41c6('0x14')],_0x7a8fa8[_0x41c6('0x190')]||_0x7a8fa8[_0x41c6('0x18d')]['user']),'to':_0x4e6b30['to']||'','cc':_0x4e6b30['cc']||'','bcc':_0x4e6b30['bcc']||'','subject':_0x4e6b30[_0x41c6('0x191')],'html':_0x4e6b30[_0x41c6('0x5c')],'text':_0x4e6b30[_0x41c6('0x5c')]};var _0x1f1a36={'tls':{'rejectUnauthorized':![]}};if(_0x7a8fa8[_0x41c6('0x18d')][_0x41c6('0x192')]){_0x1f1a36[_0x41c6('0x192')]=_0x7a8fa8[_0x41c6('0x18d')][_0x41c6('0x192')];}else{_0x1f1a36['host']=_0x7a8fa8[_0x41c6('0x18d')][_0x41c6('0x193')];_0x1f1a36['port']=_0x7a8fa8[_0x41c6('0x18d')][_0x41c6('0x194')];_0x1f1a36['secure']=_0x7a8fa8[_0x41c6('0x18d')][_0x41c6('0x195')];}if(_0x7a8fa8[_0x41c6('0x18d')][_0x41c6('0x196')]){_0x1f1a36[_0x41c6('0x197')]={'user':_0x7a8fa8['Smtp'][_0x41c6('0x198')],'pass':_0x7a8fa8[_0x41c6('0x18d')]['pass']};}if(this['isConfigured'](_0x4e6b30[_0x41c6('0x199')])){}logger[_0x41c6('0xdd')](_0x41c6('0x19a'),JSON['stringify'](_0x2c91e5));this[_0x41c6('0x36')]['sync'](this,_0x4e6b30,_0x4e6b30[_0x41c6('0x18a')]);this[_0x41c6('0x3a')][_0x41c6('0xac')](util[_0x41c6('0x54')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x7a8fa8[_0x41c6('0x14')]));this['sendMailMessage']['sync'](this,_0x1f1a36,_0x2c91e5);return this[_0x41c6('0x3a')][_0x41c6('0xac')](_0x41c6('0x19b'));};AGIVertices['prototype'][_0x41c6('0x19c')]=function(_0x2f5e77){logger[_0x41c6('0x2d')](util[_0x41c6('0x54')](_0x41c6('0x19d'),_0x2f5e77[_0x41c6('0x38')]));return this['channel'][_0x41c6('0xac')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x41c6('0x16')][_0x41c6('0x19e')]=function(_0x54627b){logger[_0x41c6('0x2d')](util[_0x41c6('0x54')](_0x41c6('0x19f'),_0x54627b[_0x41c6('0x38')]));if(!this['isConfigured'](_0x54627b['sms_account_id'])){return this[_0x41c6('0x3a')]['noop'](_0x41c6('0x1a0'));}var _0x5e23c2=this[_0x41c6('0x1a1')][_0x41c6('0x6f')](this,_0x54627b[_0x41c6('0x1a2')]);if(!_0x5e23c2){return this[_0x41c6('0x3a')][_0x41c6('0x32')](_0x54627b,'no\x20sms\x20account\x20found');}var _0x13184a={'body':_0x54627b[_0x41c6('0x1a3')],'phone':_0x54627b['to']||'','SmsAccountId':_0x5e23c2['id']};logger['debug'](_0x41c6('0x1a4'),JSON[_0x41c6('0x73')](_0x13184a));this['createSquareDetailsReport'][_0x41c6('0x6f')](this,_0x54627b,_0x54627b[_0x41c6('0x1a2')]);this[_0x41c6('0x3a')][_0x41c6('0xac')](util[_0x41c6('0x54')](_0x41c6('0x1a5'),_0x5e23c2['name']));this['createSmsMessage'][_0x41c6('0x6f')](this,_0x13184a);return this[_0x41c6('0x3a')][_0x41c6('0xac')](_0x41c6('0x1a6'));};AGIVertices[_0x41c6('0x16')][_0x41c6('0x1a7')]=function(_0x2742bf){logger[_0x41c6('0x2d')](util[_0x41c6('0x54')](_0x41c6('0x1a8'),_0x2742bf[_0x41c6('0x38')]));if(!this['isConfigured'](_0x2742bf[_0x41c6('0xd5')])){return this['channel']['error'](_0x2742bf,_0x41c6('0x1a9'));}var _0xdbe1a0=this['getVariable']['sync'](this,_0x2742bf[_0x41c6('0xd5')]);if(!_0xdbe1a0){return this[_0x41c6('0x3a')]['error'](_0x2742bf,_0x41c6('0xd7'));}return this[_0x41c6('0x3a')][_0x41c6('0xa0')](_0xdbe1a0,_0x2742bf[_0x41c6('0x1aa')]);};AGIVertices[_0x41c6('0x16')][_0x41c6('0x1ab')]=function(_0x3ff8cf){logger['info'](util[_0x41c6('0x54')](_0x41c6('0x1ac'),_0x3ff8cf[_0x41c6('0x38')]));this['channel'][_0x41c6('0xac')](_0x41c6('0x1ad'));if(_0x3ff8cf[_0x41c6('0xb9')]==='yes'){this[_0x41c6('0x3a')][_0x41c6('0xac')](_0x41c6('0x1ae'));return this[_0x41c6('0x3a')][_0x41c6('0xb9')]();}return this[_0x41c6('0x3a')][_0x41c6('0xac')]('Skipped\x20Answer');};AGIVertices[_0x41c6('0x16')][_0x41c6('0x1af')]=function(_0x5cf6c4){logger['info'](util[_0x41c6('0x54')](_0x41c6('0x1b0'),_0x5cf6c4[_0x41c6('0x38')]));if(!this[_0x41c6('0x86')](_0x5cf6c4[_0x41c6('0x1b1')])){return this['channel'][_0x41c6('0x32')](_0x5cf6c4,_0x41c6('0x1b2'));}var _0x2a3dce=this[_0x41c6('0x1b3')][_0x41c6('0x6f')](this,_0x5cf6c4[_0x41c6('0x1b1')]);if(!this[_0x41c6('0x86')](_0x2a3dce)){return this[_0x41c6('0x3a')][_0x41c6('0x32')](_0x5cf6c4,util['format'](_0x41c6('0x1b4'),_0x5cf6c4[_0x41c6('0x1b1')]));}if(_0x2a3dce===this[_0x41c6('0x3a')][_0x41c6('0x3b')]){return this['channel'][_0x41c6('0x32')](_0x5cf6c4,_0x41c6('0x1b5'));}this[_0x41c6('0x36')]['sync'](this,_0x5cf6c4,_0x2a3dce);var _0x8d04cd=this['channel'][_0x41c6('0x59')](_0x41c6('0x1b6'),util[_0x41c6('0x54')](_0x41c6('0x1b7'),config['agi']['host']||_0x41c6('0x1b8'),_0x2a3dce,this['channel'][_0x41c6('0x3b')]));if(_0x8d04cd[_0x41c6('0xa6')]===-0x1){return _0x8d04cd;}return this['channel'][_0x41c6('0xac')](util[_0x41c6('0x54')](_0x41c6('0xc3'),'AGI',_0x2a3dce));};AGIVertices[_0x41c6('0x16')][_0x41c6('0x1b9')]=function(_0x5542d9){logger[_0x41c6('0x2d')](util[_0x41c6('0x54')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x5542d9[_0x41c6('0x38')]));var _0x1cd7f9=this['shellCommand'][_0x41c6('0x6f')](this,_0x5542d9[_0x41c6('0xb8')]);this[_0x41c6('0x36')]['sync'](this,_0x5542d9,_0x5542d9[_0x41c6('0xb8')]);if(this[_0x41c6('0x86')](_0x5542d9['variable_id'])){var _0x424740=this[_0x41c6('0xa3')]['sync'](this,_0x5542d9[_0x41c6('0xd5')]);if(_0x424740){this[_0x41c6('0x3a')]['setVariable'](_0x424740,_0x1cd7f9);return this[_0x41c6('0x3a')]['noop'](util['format'](_0x41c6('0x1ba'),_0x5542d9[_0x41c6('0xb8')],_0x424740));}}return this[_0x41c6('0x3a')][_0x41c6('0xac')](util[_0x41c6('0x54')](_0x41c6('0x1bb'),_0x5542d9['command']));};AGIVertices[_0x41c6('0x16')][_0x41c6('0x1bc')]=function(_0x3e8166){logger[_0x41c6('0x2d')](util['format'](_0x41c6('0x1bd'),_0x3e8166[_0x41c6('0x38')]));_0x3e8166[_0x41c6('0x5c')]=_0x3e8166[_0x41c6('0x5c')][_0x41c6('0xd4')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x41c6('0x86')](_0x3e8166[_0x41c6('0x1be')])){return this['channel'][_0x41c6('0xac')](_0x41c6('0x1bf'));}if(!this['isConfigured'](_0x3e8166[_0x41c6('0x5c')])){return this[_0x41c6('0x3a')][_0x41c6('0xac')](_0x41c6('0xaa'));}this[_0x41c6('0x3a')]['noop'](util[_0x41c6('0x54')](_0x41c6('0x1c0'),_0x3e8166[_0x41c6('0x5c')]));var _0x122630=this['googleCloudTTS']['sync'](this,_0x3e8166);if(_0x122630){this[_0x41c6('0x3a')][_0x41c6('0xac')](util[_0x41c6('0x54')](_0x41c6('0x1c1'),_0x122630));var _0x4f729a=this[_0x41c6('0x3a')]['streamFile'](_0x122630);try{fs['unlink'](_0x122630+_0x41c6('0x100'));}catch(_0xd2c3ca){logger[_0x41c6('0x32')](_0xd2c3ca);}return _0x4f729a;}return this['channel'][_0x41c6('0x32')](_0x3e8166,_0x41c6('0x1c2'));};AGIVertices[_0x41c6('0x16')][_0x41c6('0x1c3')]=function(_0x3bd491){logger['info'](util['format'](_0x41c6('0x1c4'),_0x3bd491[_0x41c6('0x38')]));_0x3bd491[_0x41c6('0x5c')]=_0x3bd491[_0x41c6('0x5c')][_0x41c6('0xd4')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x41c6('0x86')](_0x3bd491[_0x41c6('0x5c')])){return this[_0x41c6('0x3a')][_0x41c6('0xac')](_0x41c6('0xaa'));}this['channel']['noop'](util[_0x41c6('0x54')](_0x41c6('0x1c5'),_0x3bd491[_0x41c6('0x5c')]));var _0x17d24f=this[_0x41c6('0x62')][_0x41c6('0x6f')](this,_0x3bd491);if(_0x17d24f){this[_0x41c6('0x3a')]['noop'](util[_0x41c6('0x54')](_0x41c6('0x1c6'),_0x17d24f));var _0x5d09ff=this[_0x41c6('0x3a')][_0x41c6('0x151')](_0x17d24f);try{fs[_0x41c6('0xff')](_0x17d24f+_0x41c6('0x100'));}catch(_0x1fa4b3){logger[_0x41c6('0x32')](_0x1fa4b3);}return _0x5d09ff;}return this[_0x41c6('0x3a')][_0x41c6('0x32')](_0x3bd491,_0x41c6('0x1c7'));};AGIVertices[_0x41c6('0x16')]['unpause']=function(_0x43a812){logger[_0x41c6('0x2d')](util[_0x41c6('0x54')](_0x41c6('0x1c8'),_0x43a812[_0x41c6('0x38')]));if(!this[_0x41c6('0x86')](_0x43a812['findBy'])){return this['channel'][_0x41c6('0x32')](_0x43a812,_0x41c6('0x154'));}logger[_0x41c6('0x2d')](util[_0x41c6('0x54')](_0x41c6('0x155'),this[_0x41c6('0x3a')][_0x41c6('0x3c')],_0x43a812[_0x41c6('0x156')]));var _0x848409=this[_0x41c6('0x50')][_0x41c6('0x6f')](this,_0x43a812['findBy']);if(_0x848409){logger[_0x41c6('0x2d')](util[_0x41c6('0x54')](_0x41c6('0x157'),this[_0x41c6('0x3a')][_0x41c6('0x3c')],_0x43a812[_0x41c6('0x156')]));this[_0x41c6('0x3a')][_0x41c6('0xac')](util[_0x41c6('0x54')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x41c6('0x3c')],_0x43a812[_0x41c6('0x156')]));return{'code':0xc8,'result':_0x41c6('0x158')};}else{logger['info'](util[_0x41c6('0x54')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x41c6('0x3c')],_0x43a812[_0x41c6('0x156')]));this[_0x41c6('0x3a')]['noop'](util[_0x41c6('0x54')](_0x41c6('0x159'),this[_0x41c6('0x3a')]['callerid'],_0x43a812[_0x41c6('0x156')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x41c6('0x16')]['voicemail']=function(_0x3b859f){logger['info'](util[_0x41c6('0x54')](_0x41c6('0x1c9'),_0x3b859f['label']));var _0x442514=this[_0x41c6('0x3a')][_0x41c6('0x59')](_0x41c6('0x1ca'),[_0x3b859f['mailbox'],_0x3b859f[_0x41c6('0x79')]]);if(_0x442514[_0x41c6('0xa6')]===-0x1){return _0x442514;}return this[_0x41c6('0x3a')][_0x41c6('0xac')](util[_0x41c6('0x54')](_0x41c6('0xc3'),_0x41c6('0x1ca'),_0x3b859f['mailbox']));};AGIVertices[_0x41c6('0x16')][_0x41c6('0x1cb')]=function(_0x44a7c0){logger[_0x41c6('0x2d')](util[_0x41c6('0x54')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x44a7c0[_0x41c6('0x38')]));if(!this['isConfigured'](_0x44a7c0[_0x41c6('0xd5')])){return this[_0x41c6('0x3a')][_0x41c6('0x32')](_0x44a7c0,_0x41c6('0x1a9'));}var _0x271c96=this[_0x41c6('0xa3')][_0x41c6('0x6f')](this,_0x44a7c0[_0x41c6('0xd5')]);if(!_0x271c96){return this['channel']['error'](_0x44a7c0,_0x41c6('0xd7'));}var _0xf3ed8e=this[_0x41c6('0x3a')][_0x41c6('0xa3')](_0x271c96);return{'code':0xc8,'result':_0xf3ed8e[_0x41c6('0xa4')]?_0xf3ed8e[_0x41c6('0xa4')]:'-'};};String[_0x41c6('0x16')]['replaceAll']=function(_0x3d75fe,_0x481849){return this[_0x41c6('0xa1')](_0x3d75fe)[_0x41c6('0x1cc')](_0x481849);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index eb10d9d..dee789d 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 _0xc807=['[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','info','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','format','uniqueid','updateAcw','lastPauseAt','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','error','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','message','destlinkedid','[ACW][syncAgentConnect]\x20%s','isUndefined','attended','linkedid','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]'];(function(_0x72a33d,_0x5691da){var _0x2621d5=function(_0x95b7c6){while(--_0x95b7c6){_0x72a33d['push'](_0x72a33d['shift']());}};_0x2621d5(++_0x5691da);}(_0xc807,0x65));var _0x7c80=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xc807[_0x3054be];return _0x3df150;};'use strict';var util=require(_0x7c80('0x0'));var _=require(_0x7c80('0x1'));var moment=require(_0x7c80('0x2'));var ami=require('../ami');var logger=require('../../../config/logger')(_0x7c80('0x3'));var RpcUser=require(_0x7c80('0x4'));var RpcVoiceAgentReport=require(_0x7c80('0x5'));function Acw(_0x50e6a4){this[_0x7c80('0x6')]=_0x50e6a4[_0x7c80('0x6')];this[_0x7c80('0x7')]=_0x50e6a4[_0x7c80('0x7')];this['timers']=_0x50e6a4[_0x7c80('0x8')];this[_0x7c80('0x9')]={};ami['on'](_0x7c80('0xa'),this[_0x7c80('0xb')][_0x7c80('0xc')](this));ami['on'](_0x7c80('0xd'),this[_0x7c80('0xe')]['bind'](this));ami['on'](_0x7c80('0xf'),this[_0x7c80('0x10')][_0x7c80('0xc')](this));ami['on'](_0x7c80('0x11'),this[_0x7c80('0x12')][_0x7c80('0xc')](this));ami['on'](_0x7c80('0x13'),this[_0x7c80('0x14')][_0x7c80('0xc')](this));ami['on'](_0x7c80('0x15'),this[_0x7c80('0x16')][_0x7c80('0xc')](this));ami['on'](_0x7c80('0x17'),this[_0x7c80('0x18')][_0x7c80('0xc')](this));}function getDiff(_0x339178){var _0x17406b=moment()[_0x7c80('0x19')](0x0);var _0x2e9b9d=moment(_0x339178)[_0x7c80('0x19')](0x0);return _0x17406b[_0x7c80('0x1a')](_0x2e9b9d,_0x7c80('0x1b'));}Acw[_0x7c80('0x1c')][_0x7c80('0x1d')]=function(_0x586a31){try{var _0x43bf53=this;var _0x11014b=this[_0x7c80('0x9')][_0x586a31][_0x7c80('0x1e')];var _0xeed71c=this['channels'][_0x586a31][_0x7c80('0x1f')];var _0x51d07e=this[_0x7c80('0x6')][_0xeed71c];var _0x90121e=![];var _0x5c0611=_0x7c80('0x20');if(_0x51d07e[_0x7c80('0x21')]){if(_0x51d07e[_0x7c80('0x22')][_0x7c80('0x23')]){_0x90121e=!![];_0x5c0611=_0x51d07e[_0x7c80('0x22')][_0x7c80('0x23')];}}ami['Action']({'action':_0x7c80('0x24'),'interface':_0x11014b,'paused':!![],'reason':_0x5c0611})[_0x7c80('0x25')](function(_0x39268a){if(_0x43bf53[_0x7c80('0x7')][_0x11014b]){return RpcUser[_0x7c80('0x26')](_0x43bf53[_0x7c80('0x7')][_0x11014b]['id'])[_0x7c80('0x25')](function(_0x18e842){if(_0x18e842&&!_0x18e842['voicePause']){logger[_0x7c80('0x27')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x586a31,_0x11014b,_0xeed71c);var _0x6bae36=_0x43bf53[_0x7c80('0x9')][_0x586a31]['attended']&&_0x43bf53[_0x7c80('0x9')][_0x586a31]['destlinkedid']?_0x43bf53['channels'][_0x586a31]['destlinkedid']:_0x586a31;return RpcUser[_0x7c80('0x28')](_0x43bf53[_0x7c80('0x7')][_0x11014b],_0x5c0611,_0x6bae36)[_0x7c80('0x25')](function(_0x938734){if(!_0x90121e){_0x43bf53[_0x7c80('0x8')][_0x11014b]={};logger[_0x7c80('0x27')](_0x7c80('0x29'),_0x586a31,_0x43bf53[_0x7c80('0x6')][_0xeed71c][_0x7c80('0x2a')],_0x11014b,_0xeed71c);_0x43bf53[_0x7c80('0x8')][_0x11014b][_0x7c80('0x2b')]=setTimeout(_0x43bf53[_0x7c80('0x2c')][_0x7c80('0xc')](_0x43bf53,_0x11014b),_0x43bf53[_0x7c80('0x6')][_0xeed71c][_0x7c80('0x2a')]*0x3e8);_0x43bf53[_0x7c80('0x8')][_0x11014b]['lastPauseAt']=moment()[_0x7c80('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');_0x43bf53[_0x7c80('0x8')][_0x11014b][_0x7c80('0x2e')]=_0x586a31;_0x43bf53['timers'][_0x11014b][_0x7c80('0x1f')]=_0xeed71c;_0x43bf53[_0x7c80('0x8')][_0x11014b][_0x7c80('0x2f')]=function(){var _0x2f7d2d=getDiff(_0x43bf53[_0x7c80('0x8')][_0x11014b][_0x7c80('0x30')]);clearTimeout(_0x43bf53[_0x7c80('0x8')][_0x11014b]['timer']);_0x43bf53[_0x7c80('0x8')][_0x11014b][_0x7c80('0x2b')]=![];RpcVoiceAgentReport[_0x7c80('0x31')]({'acwtime':_0x2f7d2d},_0x43bf53[_0x7c80('0x8')][_0x11014b][_0x7c80('0x2e')],_0x11014b)['then'](function(_0x70edaa){logger[_0x7c80('0x27')](_0x7c80('0x32'),_0x586a31,_0x2f7d2d,_0x70edaa);})[_0x7c80('0x33')](function(_0x57e4d6){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x586a31,_0x57e4d6);});delete _0x43bf53[_0x7c80('0x8')][_0x11014b];};}});}else{logger[_0x7c80('0x27')](_0x7c80('0x34'),_0x586a31,_0x11014b,_0xeed71c);}});}})[_0x7c80('0x33')](function(_0xd00d95){logger['error'](_0x7c80('0x29'),_0x586a31,_0x43bf53[_0x7c80('0x6')][_0xeed71c]['acwTimeout'],_0x11014b,_0xeed71c);})[_0x7c80('0x35')](function(){delete _0x43bf53['channels'][_0x586a31];});}catch(_0x234cd5){logger[_0x7c80('0x36')](_0x7c80('0x37'),_0x234cd5['message']);}};Acw['prototype'][_0x7c80('0x2c')]=function(_0x36e1e6){try{var _0x4bed89=this;if(_0x4bed89[_0x7c80('0x8')][_0x36e1e6]){_0x4bed89['timers'][_0x36e1e6][_0x7c80('0x2b')]=![];var _0x3bca0e=_0x4bed89[_0x7c80('0x8')][_0x36e1e6][_0x7c80('0x2e')];var _0x1a7571=_0x4bed89[_0x7c80('0x8')][_0x36e1e6]['queue'];var _0x4bc97f=_0x4bed89['voiceQueues'][_0x1a7571]['acwTimeout'];logger['info'](_0x7c80('0x38'),_0x3bca0e,_0x36e1e6);RpcUser['saveUnpause'](this[_0x7c80('0x7')][_0x36e1e6]);RpcVoiceAgentReport[_0x7c80('0x31')]({'acwtime':_0x4bc97f,'agentacw':!![]},_0x3bca0e,_0x36e1e6)[_0x7c80('0x25')](function(_0x5e7953){logger[_0x7c80('0x27')]('[%s][UPDATE][ACWTIME:%s]',_0x3bca0e,_0x4bc97f,_0x5e7953);})[_0x7c80('0x33')](function(_0x48241c){logger[_0x7c80('0x36')](_0x7c80('0x39'),_0x3bca0e,_0x48241c);});}else{logger['error'](_0x7c80('0x3a'),_0x36e1e6);if(_0x4bed89[_0x7c80('0x8')]){logger[_0x7c80('0x27')](_0x7c80('0x3b'),JSON[_0x7c80('0x3c')](_0x4bed89[_0x7c80('0x8')]));}}}catch(_0x46368d){logger[_0x7c80('0x36')]('[ACW][STOP]\x20%s',_0x46368d[_0x7c80('0x3d')]);}};Acw[_0x7c80('0x1c')]['syncAgentConnect']=function(_0x1db0cf){try{if(this[_0x7c80('0x6')][_0x1db0cf[_0x7c80('0x1f')]]&&(this[_0x7c80('0x6')][_0x1db0cf[_0x7c80('0x1f')]]['acw']||this[_0x7c80('0x6')][_0x1db0cf['queue']][_0x7c80('0x21')])){if(this[_0x7c80('0x7')][_0x1db0cf[_0x7c80('0x1e')]]){this[_0x7c80('0x9')][_0x1db0cf[_0x7c80('0x2e')]]={'queue':_0x1db0cf['queue'],'interface':_0x1db0cf[_0x7c80('0x1e')],'destlinkedid':_0x1db0cf[_0x7c80('0x3e')]};}}}catch(_0x4427cb){logger[_0x7c80('0x36')](_0x7c80('0x3f'),_0x4427cb[_0x7c80('0x3d')]);}};Acw[_0x7c80('0x1c')][_0x7c80('0x18')]=function(_0xb7ba83){try{if(this[_0x7c80('0x6')][_0xb7ba83['queue']]&&(this['voiceQueues'][_0xb7ba83[_0x7c80('0x1f')]][_0x7c80('0x3')]||this[_0x7c80('0x6')][_0xb7ba83[_0x7c80('0x1f')]][_0x7c80('0x21')])){if(this['agents'][_0xb7ba83['interface']]){this[_0x7c80('0x9')][_0xb7ba83['uniqueid']]={'queue':_0xb7ba83[_0x7c80('0x1f')],'interface':_0xb7ba83[_0x7c80('0x1e')]};}}}catch(_0x26cf5c){logger[_0x7c80('0x36')]('[ACW][syncAgentConnectPreview]\x20%s',_0x26cf5c['message']);}};Acw[_0x7c80('0x1c')][_0x7c80('0xe')]=function(_0x2b0277){try{if(this[_0x7c80('0x9')][_0x2b0277[_0x7c80('0x2e')]]&&_[_0x7c80('0x40')](this[_0x7c80('0x9')][_0x2b0277[_0x7c80('0x2e')]][_0x7c80('0x41')])){logger[_0x7c80('0x27')]('[%s][HANGUP:UNIQUEID]',_0x2b0277[_0x7c80('0x2e')]);this[_0x7c80('0x1d')](_0x2b0277['uniqueid']);}else if(this[_0x7c80('0x9')][_0x2b0277[_0x7c80('0x42')]]&&_[_0x7c80('0x40')](this['channels'][_0x2b0277[_0x7c80('0x42')]][_0x7c80('0x41')])){logger[_0x7c80('0x27')]('[%s][HANGUP:LINKEDID]',_0x2b0277[_0x7c80('0x42')]);this[_0x7c80('0x1d')](_0x2b0277[_0x7c80('0x42')]);}}catch(_0x20beb0){logger[_0x7c80('0x36')]('[ACW][syncHangupRequest]\x20%s',_0x20beb0['message']);}};Acw[_0x7c80('0x1c')][_0x7c80('0x10')]=function(_0x420185){try{if(this[_0x7c80('0x9')][_0x420185[_0x7c80('0x2e')]]&&this[_0x7c80('0x9')][_0x420185[_0x7c80('0x2e')]]['attended']){logger['info'](_0x7c80('0x43'),_0x420185['uniqueid']);this[_0x7c80('0x1d')](_0x420185[_0x7c80('0x2e')]);}else if(this[_0x7c80('0x9')][_0x420185[_0x7c80('0x42')]]&&this[_0x7c80('0x9')][_0x420185[_0x7c80('0x42')]][_0x7c80('0x41')]){logger[_0x7c80('0x27')](_0x7c80('0x44'),_0x420185[_0x7c80('0x42')]);this[_0x7c80('0x1d')](_0x420185[_0x7c80('0x42')]);}}catch(_0x574a02){logger[_0x7c80('0x36')](_0x7c80('0x45'),_0x574a02[_0x7c80('0x3d')]);}};Acw[_0x7c80('0x1c')][_0x7c80('0x14')]=function(_0x197d6c){try{if(!_[_0x7c80('0x46')](this['channels'][_0x197d6c[_0x7c80('0x47')]])){this[_0x7c80('0x1d')](_0x197d6c[_0x7c80('0x47')]);if(this[_0x7c80('0x9')][_0x197d6c[_0x7c80('0x48')]]){this['channels'][_0x197d6c[_0x7c80('0x48')]][_0x7c80('0x41')]=!![];this['channels'][_0x197d6c['transfertargetuniqueid']]=this[_0x7c80('0x9')][_0x197d6c[_0x7c80('0x48')]];delete this['channels'][_0x197d6c[_0x7c80('0x48')]];}}else if(!_[_0x7c80('0x46')](this['channels'][_0x197d6c[_0x7c80('0x49')]])){this[_0x7c80('0x1d')](_0x197d6c[_0x7c80('0x49')]);if(this[_0x7c80('0x9')][_0x197d6c[_0x7c80('0x4a')]]){this[_0x7c80('0x9')][_0x197d6c[_0x7c80('0x4a')]][_0x7c80('0x41')]=!![];this['channels'][_0x197d6c['transfereeuniqueid']]=this[_0x7c80('0x9')][_0x197d6c[_0x7c80('0x4a')]];delete this[_0x7c80('0x9')][_0x197d6c[_0x7c80('0x4a')]];}}}catch(_0x101d73){logger[_0x7c80('0x36')](_0x7c80('0x4b'),_0x101d73[_0x7c80('0x3d')]);}};Acw[_0x7c80('0x1c')][_0x7c80('0x16')]=function(_0xb68e72){try{if(this[_0x7c80('0x9')][_0xb68e72['transfereruniqueid']]){logger[_0x7c80('0x27')](_0x7c80('0x4c'),JSON['stringify'](_0xb68e72[_0x7c80('0x4d')]));this['startAcw'](_0xb68e72['transfereruniqueid']);}else if(this[_0x7c80('0x9')][_0xb68e72[_0x7c80('0x4e')]]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x7c80('0x3c')](_0xb68e72[_0x7c80('0x4e')]));this[_0x7c80('0x1d')](_0xb68e72[_0x7c80('0x4e')]);}}catch(_0x917939){logger['error'](_0x7c80('0x4f'),_0x917939[_0x7c80('0x3d')]);}};Acw[_0x7c80('0x1c')][_0x7c80('0x12')]=function(_0x3be1b7){try{if(this['voiceQueues'][_0x3be1b7[_0x7c80('0x1f')]]&&this[_0x7c80('0x6')][_0x3be1b7[_0x7c80('0x1f')]][_0x7c80('0x50')]==='all'){if(this[_0x7c80('0x7')][_0x3be1b7['interface']]){logger[_0x7c80('0x27')](_0x7c80('0x51'),_0x3be1b7[_0x7c80('0x2e')],_0x3be1b7['interface'],_0x3be1b7[_0x7c80('0x1f')]);return RpcUser['savePause'](this[_0x7c80('0x7')][_0x3be1b7[_0x7c80('0x1e')]],_0x7c80('0x52'),_0x3be1b7[_0x7c80('0x2e')]);}}}catch(_0x40f24a){logger[_0x7c80('0x36')](_0x7c80('0x53'),_0x40f24a[_0x7c80('0x3d')]);}};module[_0x7c80('0x54')]=Acw; \ No newline at end of file +var _0x6a12=['[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','acw','[ACW][syncAgentConnectPreview]\x20%s','prototype','syncHangupRequest','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','transfertargetuniqueid','secondtransfereruniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','hanguprequest','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','YYYY-MM-DD\x20HH:mm:ss','updateAcw','lastPauseAt','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally'];(function(_0x1ee6a2,_0x5efc6a){var _0x1936e=function(_0xa60272){while(--_0xa60272){_0x1ee6a2['push'](_0x1ee6a2['shift']());}};_0x1936e(++_0x5efc6a);}(_0x6a12,0xcc));var _0x26a1=function(_0x4dbf55,_0x350391){_0x4dbf55=_0x4dbf55-0x0;var _0x2d3f92=_0x6a12[_0x4dbf55];return _0x2d3f92;};'use strict';var util=require(_0x26a1('0x0'));var _=require(_0x26a1('0x1'));var moment=require(_0x26a1('0x2'));var ami=require('../ami');var logger=require(_0x26a1('0x3'))('acw');var RpcUser=require(_0x26a1('0x4'));var RpcVoiceAgentReport=require(_0x26a1('0x5'));function Acw(_0x347504){this[_0x26a1('0x6')]=_0x347504[_0x26a1('0x6')];this[_0x26a1('0x7')]=_0x347504[_0x26a1('0x7')];this[_0x26a1('0x8')]=_0x347504[_0x26a1('0x8')];this[_0x26a1('0x9')]={};ami['on']('agentconnect',this['syncAgentConnect']['bind'](this));ami['on'](_0x26a1('0xa'),this['syncHangupRequest'][_0x26a1('0xb')](this));ami['on'](_0x26a1('0xc'),this[_0x26a1('0xd')][_0x26a1('0xb')](this));ami['on'](_0x26a1('0xe'),this[_0x26a1('0xf')][_0x26a1('0xb')](this));ami['on']('attendedtransfer',this[_0x26a1('0x10')][_0x26a1('0xb')](this));ami['on']('blindtransfer',this[_0x26a1('0x11')][_0x26a1('0xb')](this));ami['on'](_0x26a1('0x12'),this['syncAgentConnectPreview'][_0x26a1('0xb')](this));}function getDiff(_0x570ae7){var _0x4a4504=moment()[_0x26a1('0x13')](0x0);var _0x30f8e4=moment(_0x570ae7)['milliseconds'](0x0);return _0x4a4504[_0x26a1('0x14')](_0x30f8e4,_0x26a1('0x15'));}Acw['prototype'][_0x26a1('0x16')]=function(_0x180343){try{var _0x4ed5e9=this;var _0x32bcca=this[_0x26a1('0x9')][_0x180343][_0x26a1('0x17')];var _0x3d4163=this[_0x26a1('0x9')][_0x180343][_0x26a1('0x18')];var _0x12890f=this[_0x26a1('0x6')][_0x3d4163];var _0x5d8f63=![];var _0x486525=_0x26a1('0x19');if(_0x12890f[_0x26a1('0x1a')]){if(_0x12890f[_0x26a1('0x1b')][_0x26a1('0x1c')]){_0x5d8f63=!![];_0x486525=_0x12890f[_0x26a1('0x1b')][_0x26a1('0x1c')];}}ami[_0x26a1('0x1d')]({'action':_0x26a1('0x1e'),'interface':_0x32bcca,'paused':!![],'reason':_0x486525})[_0x26a1('0x1f')](function(_0x5d008b){if(_0x4ed5e9[_0x26a1('0x7')][_0x32bcca]){return RpcUser['getAgent'](_0x4ed5e9[_0x26a1('0x7')][_0x32bcca]['id'])[_0x26a1('0x1f')](function(_0xfcf036){if(_0xfcf036&&!_0xfcf036[_0x26a1('0x20')]){logger[_0x26a1('0x21')](_0x26a1('0x22'),_0x180343,_0x32bcca,_0x3d4163);var _0x529f48=_0x4ed5e9[_0x26a1('0x9')][_0x180343][_0x26a1('0x23')]&&_0x4ed5e9[_0x26a1('0x9')][_0x180343]['destlinkedid']?_0x4ed5e9[_0x26a1('0x9')][_0x180343][_0x26a1('0x24')]:_0x180343;return RpcUser[_0x26a1('0x25')](_0x4ed5e9[_0x26a1('0x7')][_0x32bcca],_0x486525,_0x529f48)[_0x26a1('0x1f')](function(_0x117247){if(!_0x5d8f63){_0x4ed5e9[_0x26a1('0x8')][_0x32bcca]={};logger[_0x26a1('0x21')](_0x26a1('0x26'),_0x180343,_0x4ed5e9[_0x26a1('0x6')][_0x3d4163][_0x26a1('0x27')],_0x32bcca,_0x3d4163);_0x4ed5e9[_0x26a1('0x8')][_0x32bcca][_0x26a1('0x28')]=setTimeout(_0x4ed5e9['stopAcw'][_0x26a1('0xb')](_0x4ed5e9,_0x32bcca),_0x4ed5e9[_0x26a1('0x6')][_0x3d4163][_0x26a1('0x27')]*0x3e8);_0x4ed5e9[_0x26a1('0x8')][_0x32bcca]['lastPauseAt']=moment()['format'](_0x26a1('0x29'));_0x4ed5e9[_0x26a1('0x8')][_0x32bcca]['uniqueid']=_0x180343;_0x4ed5e9[_0x26a1('0x8')][_0x32bcca][_0x26a1('0x18')]=_0x3d4163;_0x4ed5e9[_0x26a1('0x8')][_0x32bcca][_0x26a1('0x2a')]=function(){var _0x5c6751=getDiff(_0x4ed5e9[_0x26a1('0x8')][_0x32bcca][_0x26a1('0x2b')]);clearTimeout(_0x4ed5e9[_0x26a1('0x8')][_0x32bcca][_0x26a1('0x28')]);_0x4ed5e9[_0x26a1('0x8')][_0x32bcca][_0x26a1('0x28')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x5c6751},_0x4ed5e9[_0x26a1('0x8')][_0x32bcca][_0x26a1('0x2c')],_0x32bcca)[_0x26a1('0x1f')](function(_0x39dac0){logger[_0x26a1('0x21')](_0x26a1('0x2d'),_0x180343,_0x5c6751,_0x39dac0);})[_0x26a1('0x2e')](function(_0x2a6a04){logger[_0x26a1('0x2f')](_0x26a1('0x30'),_0x180343,_0x2a6a04);});delete _0x4ed5e9[_0x26a1('0x8')][_0x32bcca];};}});}else{logger['info'](_0x26a1('0x31'),_0x180343,_0x32bcca,_0x3d4163);}});}})[_0x26a1('0x2e')](function(_0x7b2b7d){logger[_0x26a1('0x2f')](_0x26a1('0x26'),_0x180343,_0x4ed5e9[_0x26a1('0x6')][_0x3d4163][_0x26a1('0x27')],_0x32bcca,_0x3d4163);})[_0x26a1('0x32')](function(){delete _0x4ed5e9[_0x26a1('0x9')][_0x180343];});}catch(_0x39cc85){logger['error']('[ACW][START]\x20%s',_0x39cc85['message']);}};Acw['prototype']['stopAcw']=function(_0x357b85){try{var _0x4f52af=this;if(_0x4f52af[_0x26a1('0x8')][_0x357b85]){_0x4f52af[_0x26a1('0x8')][_0x357b85][_0x26a1('0x28')]=![];var _0x3a6136=_0x4f52af[_0x26a1('0x8')][_0x357b85][_0x26a1('0x2c')];var _0x1de1e0=_0x4f52af[_0x26a1('0x8')][_0x357b85][_0x26a1('0x18')];var _0x5eae97=_0x4f52af[_0x26a1('0x6')][_0x1de1e0][_0x26a1('0x27')];logger[_0x26a1('0x21')](_0x26a1('0x33'),_0x3a6136,_0x357b85);RpcUser[_0x26a1('0x34')](this[_0x26a1('0x7')][_0x357b85]);RpcVoiceAgentReport[_0x26a1('0x35')]({'acwtime':_0x5eae97,'agentacw':!![]},_0x3a6136,_0x357b85)[_0x26a1('0x1f')](function(_0x4f36df){logger[_0x26a1('0x21')](_0x26a1('0x2d'),_0x3a6136,_0x5eae97,_0x4f36df);})[_0x26a1('0x2e')](function(_0x523fd1){logger[_0x26a1('0x2f')](_0x26a1('0x30'),_0x3a6136,_0x523fd1);});}else{logger[_0x26a1('0x2f')](_0x26a1('0x36'),_0x357b85);if(_0x4f52af['timers']){logger[_0x26a1('0x21')](_0x26a1('0x37'),JSON[_0x26a1('0x38')](_0x4f52af[_0x26a1('0x8')]));}}}catch(_0x268d19){logger[_0x26a1('0x2f')](_0x26a1('0x39'),_0x268d19[_0x26a1('0x3a')]);}};Acw['prototype']['syncAgentConnect']=function(_0x1b0348){try{if(this[_0x26a1('0x6')][_0x1b0348[_0x26a1('0x18')]]&&(this['voiceQueues'][_0x1b0348[_0x26a1('0x18')]]['acw']||this[_0x26a1('0x6')][_0x1b0348['queue']][_0x26a1('0x1a')])){if(this['agents'][_0x1b0348[_0x26a1('0x17')]]){this[_0x26a1('0x9')][_0x1b0348[_0x26a1('0x2c')]]={'queue':_0x1b0348[_0x26a1('0x18')],'interface':_0x1b0348[_0x26a1('0x17')],'destlinkedid':_0x1b0348[_0x26a1('0x24')]};}}}catch(_0x16850b){logger['error'](_0x26a1('0x3b'),_0x16850b[_0x26a1('0x3a')]);}};Acw['prototype'][_0x26a1('0x3c')]=function(_0x454a85){try{if(this[_0x26a1('0x6')][_0x454a85[_0x26a1('0x18')]]&&(this[_0x26a1('0x6')][_0x454a85[_0x26a1('0x18')]][_0x26a1('0x3d')]||this['voiceQueues'][_0x454a85['queue']]['mandatoryDisposition'])){if(this[_0x26a1('0x7')][_0x454a85[_0x26a1('0x17')]]){this[_0x26a1('0x9')][_0x454a85['uniqueid']]={'queue':_0x454a85[_0x26a1('0x18')],'interface':_0x454a85[_0x26a1('0x17')]};}}}catch(_0xca271d){logger['error'](_0x26a1('0x3e'),_0xca271d[_0x26a1('0x3a')]);}};Acw[_0x26a1('0x3f')][_0x26a1('0x40')]=function(_0x2fbc1f){try{if(this[_0x26a1('0x9')][_0x2fbc1f['uniqueid']]&&_['isUndefined'](this[_0x26a1('0x9')][_0x2fbc1f['uniqueid']][_0x26a1('0x23')])){logger[_0x26a1('0x21')](_0x26a1('0x41'),_0x2fbc1f[_0x26a1('0x2c')]);this[_0x26a1('0x16')](_0x2fbc1f[_0x26a1('0x2c')]);}else if(this[_0x26a1('0x9')][_0x2fbc1f[_0x26a1('0x42')]]&&_[_0x26a1('0x43')](this[_0x26a1('0x9')][_0x2fbc1f['linkedid']][_0x26a1('0x23')])){logger[_0x26a1('0x21')]('[%s][HANGUP:LINKEDID]',_0x2fbc1f[_0x26a1('0x42')]);this[_0x26a1('0x16')](_0x2fbc1f['linkedid']);}}catch(_0xdc576f){logger[_0x26a1('0x2f')](_0x26a1('0x44'),_0xdc576f[_0x26a1('0x3a')]);}};Acw['prototype'][_0x26a1('0xd')]=function(_0x2f0914){try{if(this[_0x26a1('0x9')][_0x2f0914['uniqueid']]&&this[_0x26a1('0x9')][_0x2f0914[_0x26a1('0x2c')]][_0x26a1('0x23')]){logger[_0x26a1('0x21')](_0x26a1('0x45'),_0x2f0914[_0x26a1('0x2c')]);this[_0x26a1('0x16')](_0x2f0914['uniqueid']);}else if(this[_0x26a1('0x9')][_0x2f0914[_0x26a1('0x42')]]&&this[_0x26a1('0x9')][_0x2f0914['linkedid']]['attended']){logger[_0x26a1('0x21')](_0x26a1('0x46'),_0x2f0914[_0x26a1('0x42')]);this['startAcw'](_0x2f0914[_0x26a1('0x42')]);}}catch(_0x1a2d69){logger['error'](_0x26a1('0x47'),_0x1a2d69[_0x26a1('0x3a')]);}};Acw[_0x26a1('0x3f')]['syncAttendedTransfer']=function(_0x213e3e){try{if(!_[_0x26a1('0x48')](this[_0x26a1('0x9')][_0x213e3e[_0x26a1('0x49')]])){this[_0x26a1('0x16')](_0x213e3e[_0x26a1('0x49')]);if(this[_0x26a1('0x9')][_0x213e3e['secondtransfereruniqueid']]){this[_0x26a1('0x9')][_0x213e3e['secondtransfereruniqueid']][_0x26a1('0x23')]=!![];this[_0x26a1('0x9')][_0x213e3e[_0x26a1('0x4a')]]=this['channels'][_0x213e3e[_0x26a1('0x4b')]];delete this[_0x26a1('0x9')][_0x213e3e['secondtransfereruniqueid']];}}else if(!_[_0x26a1('0x48')](this[_0x26a1('0x9')][_0x213e3e[_0x26a1('0x4a')]])){this[_0x26a1('0x16')](_0x213e3e[_0x26a1('0x4a')]);if(this['channels'][_0x213e3e[_0x26a1('0x4c')]]){this[_0x26a1('0x9')][_0x213e3e[_0x26a1('0x4c')]][_0x26a1('0x23')]=!![];this[_0x26a1('0x9')][_0x213e3e['transfereeuniqueid']]=this[_0x26a1('0x9')][_0x213e3e[_0x26a1('0x4c')]];delete this[_0x26a1('0x9')][_0x213e3e[_0x26a1('0x4c')]];}}}catch(_0x72fdc9){logger[_0x26a1('0x2f')]('[ACW][syncAttendedTransfer]\x20%s',_0x72fdc9['message']);}};Acw[_0x26a1('0x3f')][_0x26a1('0x11')]=function(_0x2967c1){try{if(this['channels'][_0x2967c1[_0x26a1('0x4d')]]){logger[_0x26a1('0x21')](_0x26a1('0x4e'),JSON['stringify'](_0x2967c1[_0x26a1('0x4d')]));this['startAcw'](_0x2967c1[_0x26a1('0x4d')]);}else if(this[_0x26a1('0x9')][_0x2967c1[_0x26a1('0x4f')]]){logger[_0x26a1('0x21')](_0x26a1('0x50'),JSON[_0x26a1('0x38')](_0x2967c1[_0x26a1('0x4f')]));this[_0x26a1('0x16')](_0x2967c1[_0x26a1('0x4f')]);}}catch(_0x48f5b2){logger[_0x26a1('0x2f')](_0x26a1('0x51'),_0x48f5b2['message']);}};Acw[_0x26a1('0x3f')][_0x26a1('0xf')]=function(_0x13c641){try{if(this['voiceQueues'][_0x13c641[_0x26a1('0x18')]]&&this[_0x26a1('0x6')][_0x13c641[_0x26a1('0x18')]][_0x26a1('0x52')]==='all'){if(this[_0x26a1('0x7')][_0x13c641['interface']]){logger[_0x26a1('0x21')](_0x26a1('0x53'),_0x13c641[_0x26a1('0x2c')],_0x13c641[_0x26a1('0x17')],_0x13c641[_0x26a1('0x18')]);return RpcUser[_0x26a1('0x25')](this[_0x26a1('0x7')][_0x13c641[_0x26a1('0x17')]],'Auto-Pause',_0x13c641[_0x26a1('0x2c')]);}}}catch(_0x3b370b){logger[_0x26a1('0x2f')](_0x26a1('0x54'),_0x3b370b['message']);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 5bf04f0..ee42d4d 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 _0xeda8=['password','keepConnected','promisify','action','error','format','port','inspect','actionSipShowRegistry','Action','sipshowregistry','actionDeviceStateList','devicestatelist','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','log','exports','asterisk-manager','moment','util','lodash','../../config/logger','ami','../../config/environment','asterisk','username'];(function(_0xc6971f,_0x53138a){var _0x28ca53=function(_0xa0f0b4){while(--_0xa0f0b4){_0xc6971f['push'](_0xc6971f['shift']());}};_0x28ca53(++_0x53138a);}(_0xeda8,0x1e5));var _0x8eda=function(_0x12da9c,_0x428e85){_0x12da9c=_0x12da9c-0x0;var _0x56b9b7=_0xeda8[_0x12da9c];return _0x56b9b7;};'use strict';var Manager=require(_0x8eda('0x0'));var BPromise=require('bluebird');var moment=require(_0x8eda('0x1'));var util=require(_0x8eda('0x2'));var _=require(_0x8eda('0x3'));var logger=require(_0x8eda('0x4'))(_0x8eda('0x5'));var config=require(_0x8eda('0x6'));var ami=new Manager(config[_0x8eda('0x7')]['port'],config['asterisk']['ip'],config[_0x8eda('0x7')][_0x8eda('0x8')],config[_0x8eda('0x7')][_0x8eda('0x9')],!![]);ami[_0x8eda('0xa')]();ami['Action']=BPromise[_0x8eda('0xb')](ami[_0x8eda('0xc')]);function error(_0x16211b){logger[_0x8eda('0xd')](util[_0x8eda('0xe')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x8eda('0x7')]['username'],config['asterisk']['ip'],config['asterisk'][_0x8eda('0xf')],util[_0x8eda('0x10')](_0x16211b,![],null)));}function close(){logger['error'](util[_0x8eda('0xe')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x8eda('0x7')][_0x8eda('0x8')],config[_0x8eda('0x7')]['ip'],config[_0x8eda('0x7')][_0x8eda('0xf')]));}ami[_0x8eda('0x11')]=function(){return function(){return ami[_0x8eda('0x12')]({'action':_0x8eda('0x13')});};};ami[_0x8eda('0x14')]=function(){return function(){return ami[_0x8eda('0x12')]({'action':_0x8eda('0x15')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x8eda('0x12')]({'action':_0x8eda('0x16')});};};ami[_0x8eda('0x17')]=function(){return function(){return ami['Action']({'action':_0x8eda('0x18')});};};ami[_0x8eda('0x19')]=function(){return function(){return ami[_0x8eda('0x12')]({'action':_0x8eda('0x1a')});};};function connect(_0x26ea73){logger[_0x8eda('0x1b')](util[_0x8eda('0xe')](_0x8eda('0x1c'),config[_0x8eda('0x7')][_0x8eda('0x8')],config[_0x8eda('0x7')]['ip'],config['asterisk'][_0x8eda('0xf')]));ami[_0x8eda('0x1d')](_0x8eda('0xd'),error);ami[_0x8eda('0x1d')](_0x8eda('0x1e'),close);}ami['on'](_0x8eda('0x1f'),connect);ami['on']('shutdown',function(_0x110521){logger[_0x8eda('0x1b')](util[_0x8eda('0xe')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x8eda('0x7')][_0x8eda('0x8')],config[_0x8eda('0x7')]['ip'],config[_0x8eda('0x7')][_0x8eda('0xf')],util[_0x8eda('0x10')](_0x110521,![],null)));});ami['on'](_0x8eda('0x20'),function(_0x19070f){logger[_0x8eda('0x1b')](util[_0x8eda('0xe')](_0x8eda('0x21'),config[_0x8eda('0x7')][_0x8eda('0x8')],config[_0x8eda('0x7')]['ip'],config[_0x8eda('0x7')][_0x8eda('0xf')]));return BPromise[_0x8eda('0x22')]()['then'](ami[_0x8eda('0x11')]())[_0x8eda('0x23')](ami[_0x8eda('0x14')]())['then'](ami['actionSipPeerStatus']())[_0x8eda('0x23')](ami[_0x8eda('0x17')]())['then'](ami[_0x8eda('0x19')]())['catch'](function(_0xee4c29){console[_0x8eda('0x24')](_0xee4c29);});});ami[_0x8eda('0x1d')](_0x8eda('0xd'),error);ami['once'](_0x8eda('0x1e'),close);module[_0x8eda('0x25')]=ami; \ No newline at end of file +var _0x578e=['actionSipShowRegistry','actionQueueSummary','log','exports','asterisk-manager','bluebird','moment','util','lodash','../../config/logger','ami','asterisk','username','password','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','fullybooted','resolve','then'];(function(_0x57643b,_0x215ab4){var _0x402345=function(_0x242242){while(--_0x242242){_0x57643b['push'](_0x57643b['shift']());}};_0x402345(++_0x215ab4);}(_0x578e,0x1b1));var _0xe578=function(_0x1db9d2,_0x48b09b){_0x1db9d2=_0x1db9d2-0x0;var _0x38c2ae=_0x578e[_0x1db9d2];return _0x38c2ae;};'use strict';var Manager=require(_0xe578('0x0'));var BPromise=require(_0xe578('0x1'));var moment=require(_0xe578('0x2'));var util=require(_0xe578('0x3'));var _=require(_0xe578('0x4'));var logger=require(_0xe578('0x5'))(_0xe578('0x6'));var config=require('../../config/environment');var ami=new Manager(config[_0xe578('0x7')]['port'],config[_0xe578('0x7')]['ip'],config[_0xe578('0x7')][_0xe578('0x8')],config[_0xe578('0x7')][_0xe578('0x9')],!![]);ami['keepConnected']();ami[_0xe578('0xa')]=BPromise[_0xe578('0xb')](ami[_0xe578('0xc')]);function error(_0x409d41){logger[_0xe578('0xd')](util[_0xe578('0xe')](_0xe578('0xf'),config[_0xe578('0x7')][_0xe578('0x8')],config[_0xe578('0x7')]['ip'],config[_0xe578('0x7')][_0xe578('0x10')],util[_0xe578('0x11')](_0x409d41,![],null)));}function close(){logger[_0xe578('0xd')](util[_0xe578('0xe')](_0xe578('0x12'),config[_0xe578('0x7')][_0xe578('0x8')],config[_0xe578('0x7')]['ip'],config[_0xe578('0x7')]['port']));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xe578('0xa')]({'action':_0xe578('0x13')});};};ami[_0xe578('0x14')]=function(){return function(){return ami[_0xe578('0xa')]({'action':_0xe578('0x15')});};};ami[_0xe578('0x16')]=function(){return function(){return ami[_0xe578('0xa')]({'action':_0xe578('0x17')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0xe578('0x18')});};};ami[_0xe578('0x19')]=function(){return function(){return ami[_0xe578('0xa')]({'action':'coreshowchannels'});};};function connect(_0x316ca8){logger[_0xe578('0x1a')](util['format'](_0xe578('0x1b'),config[_0xe578('0x7')][_0xe578('0x8')],config['asterisk']['ip'],config[_0xe578('0x7')][_0xe578('0x10')]));ami[_0xe578('0x1c')](_0xe578('0xd'),error);ami['once'](_0xe578('0x1d'),close);}ami['on'](_0xe578('0x1e'),connect);ami['on'](_0xe578('0x1f'),function(_0x4b92f2){logger['info'](util[_0xe578('0xe')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xe578('0x7')][_0xe578('0x8')],config[_0xe578('0x7')]['ip'],config[_0xe578('0x7')][_0xe578('0x10')],util[_0xe578('0x11')](_0x4b92f2,![],null)));});ami['on'](_0xe578('0x20'),function(_0x4c0b4f){logger[_0xe578('0x1a')](util[_0xe578('0xe')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk'][_0xe578('0x8')],config[_0xe578('0x7')]['ip'],config[_0xe578('0x7')][_0xe578('0x10')]));return BPromise[_0xe578('0x21')]()[_0xe578('0x22')](ami[_0xe578('0x23')]())[_0xe578('0x22')](ami[_0xe578('0x14')]())[_0xe578('0x22')](ami[_0xe578('0x16')]())[_0xe578('0x22')](ami[_0xe578('0x24')]())[_0xe578('0x22')](ami[_0xe578('0x19')]())['catch'](function(_0x432603){console[_0xe578('0x25')](_0x432603);});});ami[_0xe578('0x1c')](_0xe578('0xd'),error);ami[_0xe578('0x1c')](_0xe578('0x1d'),close);module[_0xe578('0x26')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 63b83c4..81265be 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 _0x9bde=['message','result','catch','exports','bluebird','ami','http','Request','request','debug','rpc','memberReport','error'];(function(_0x2755fb,_0x5970f1){var _0x293f12=function(_0x4c629d){while(--_0x4c629d){_0x2755fb['push'](_0x2755fb['shift']());}};_0x293f12(++_0x5970f1);}(_0x9bde,0xe1));var _0xe9bd=function(_0x7d154e,_0x3b1624){_0x7d154e=_0x7d154e-0x0;var _0x5c7254=_0x9bde[_0x7d154e];return _0x5c7254;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var client=jayson['client'][_0xe9bd('0x2')]({'port':0x2329});client[_0xe9bd('0x3')]=function(_0x131f6a,_0x1c1b34){return new BPromise(function(_0x10822d,_0x1a4d14){return client[_0xe9bd('0x4')](_0x131f6a,_0x1c1b34)['then'](function(_0x4763e9){logger[_0xe9bd('0x5')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x1c1b34,_0x4763e9);if(_0x4763e9[_0xe9bd('0x8')]){logger[_0xe9bd('0x8')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x4763e9[_0xe9bd('0x8')][_0xe9bd('0x9')],_0x1c1b34);return _0x1a4d14(_0x4763e9['error']['message']);}else{return _0x10822d(_0x4763e9[_0xe9bd('0xa')]);}})[_0xe9bd('0xb')](function(_0x2601ac){logger['error'](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x2601ac,_0x1c1b34);return _0x1a4d14(_0x2601ac);});});};module[_0xe9bd('0xc')]=client; \ No newline at end of file +var _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xb7e7,0x121));var _0x7b7e=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xb7e7[_0xc4001c];return _0x49f7bc;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('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 9c885f9..6b29968 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 _0xfe1e=['dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','exports','util','lodash','moment','isNil','string','uniqueid','name','Contact','phone','firstName','number','queue','active','type'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xfe1e,0x134));var _0xefe1=function(_0x7cec12,_0x51af0b){_0x7cec12=_0x7cec12-0x0;var _0x2c3dbd=_0xfe1e[_0x7cec12];return _0x2c3dbd;};'use strict';var util=require(_0xefe1('0x0'));var _=require(_0xefe1('0x1'));var moment=require(_0xefe1('0x2'));function checkNameSurname(_0x11974c,_0x4bbd5,_0xb98587){var _0x3c8fdb='';if(!_[_0xefe1('0x3')](_0x4bbd5)&&_0xefe1('0x4')===typeof _0x4bbd5){_0x3c8fdb+=_0x4bbd5;}if(!_['isNil'](_0xb98587)&&_0xefe1('0x4')===typeof _0xb98587){_0x3c8fdb+='\x20'+_0xb98587;}if(_0x3c8fdb!==''){return _0x3c8fdb;}return _0x11974c;}function Action(_0x39ff99,_0xb18339,_0x4441e2){this['voiceQueue']=_0x39ff99;this[_0xefe1('0x5')]=_0x4441e2||undefined;this[_0xefe1('0x6')]=checkNameSurname(_0xb18339[_0xefe1('0x7')][_0xefe1('0x8')],_0xb18339[_0xefe1('0x7')][_0xefe1('0x9')],_0xb18339[_0xefe1('0x7')]['lastName']);this[_0xefe1('0xa')]=_0xb18339[_0xefe1('0x7')][_0xefe1('0x8')];this[_0xefe1('0xb')]=_0x39ff99['name'];this[_0xefe1('0xc')]=_0xb18339[_0xefe1('0xc')]||![];this['type']=_0x39ff99[_0xefe1('0xd')];this[_0xefe1('0xe')]=_0x39ff99[_0xefe1('0xe')]||0x3;this[_0xefe1('0xf')]=_0xb18339['scheduledat'];this[_0xefe1('0x10')]=_0xb18339[_0xefe1('0x10')];this[_0xefe1('0x11')]=_0xb18339[_0xefe1('0x11')];this[_0xefe1('0x12')]=_0xb18339[_0xefe1('0x12')];this[_0xefe1('0x13')]=_0xb18339[_0xefe1('0x13')];this['countdropretry']=_0xb18339[_0xefe1('0x14')];this['countabandonedretry']=_0xb18339[_0xefe1('0x15')];this['countmachineretry']=_0xb18339[_0xefe1('0x16')];this['countagentrejectretry']=_0xb18339[_0xefe1('0x17')];this['ContactId']=_0xb18339[_0xefe1('0x18')];this['ListId']=_0xb18339[_0xefe1('0x19')];this[_0xefe1('0x1a')]=_0xb18339[_0xefe1('0x1a')];this[_0xefe1('0x1b')]=_0xb18339[_0xefe1('0x1b')];this[_0xefe1('0x1c')]=_0xb18339[_0xefe1('0x1c')];this[_0xefe1('0x1d')]=_0xb18339['id'];this[_0xefe1('0x1e')]=_0xb18339['Contact']['firstName']||'';this[_0xefe1('0x1f')]=moment()[_0xefe1('0x20')](_0xefe1('0x21'));this[_0xefe1('0x22')]=_0xb18339[_0xefe1('0x22')];this[_0xefe1('0x23')]=_0xb18339[_0xefe1('0x23')];this['callbackat']=_0xb18339[_0xefe1('0x24')];this[_0xefe1('0x25')]=_0xb18339['recallme'];this['originatecalleridnum']='';this[_0xefe1('0x26')]='';}Action[_0xefe1('0x27')][_0xefe1('0x28')]=function(){return util[_0xefe1('0x20')](_0xefe1('0x29'),this[_0xefe1('0x6')],this[_0xefe1('0x2a')][_0xefe1('0x2b')]>0x0?this[_0xefe1('0xa')][_0xefe1('0x2c')](this[_0xefe1('0x2a')][_0xefe1('0x2b')]):this[_0xefe1('0xa')]);};Action[_0xefe1('0x27')]['getQueue']=function(){return this[_0xefe1('0xb')];};module[_0xefe1('0x2d')]=Action; \ No newline at end of file +var _0x8d74=['voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','substring','number','getQueue','exports','util','lodash','moment','isNil','string'];(function(_0x140e6d,_0x3000a2){var _0x4e5cb2=function(_0x4d20ee){while(--_0x4d20ee){_0x140e6d['push'](_0x140e6d['shift']());}};_0x4e5cb2(++_0x3000a2);}(_0x8d74,0x121));var _0x48d7=function(_0x2fbe2e,_0x44dc35){_0x2fbe2e=_0x2fbe2e-0x0;var _0x56f599=_0x8d74[_0x2fbe2e];return _0x56f599;};'use strict';var util=require(_0x48d7('0x0'));var _=require(_0x48d7('0x1'));var moment=require(_0x48d7('0x2'));function checkNameSurname(_0x25a364,_0x7e06eb,_0x1c7b39){var _0x3a6aaa='';if(!_[_0x48d7('0x3')](_0x7e06eb)&&_0x48d7('0x4')===typeof _0x7e06eb){_0x3a6aaa+=_0x7e06eb;}if(!_[_0x48d7('0x3')](_0x1c7b39)&&_0x48d7('0x4')===typeof _0x1c7b39){_0x3a6aaa+='\x20'+_0x1c7b39;}if(_0x3a6aaa!==''){return _0x3a6aaa;}return _0x25a364;}function Action(_0x1f957f,_0x19e784,_0x94fcc0){this[_0x48d7('0x5')]=_0x1f957f;this[_0x48d7('0x6')]=_0x94fcc0||undefined;this[_0x48d7('0x7')]=checkNameSurname(_0x19e784[_0x48d7('0x8')][_0x48d7('0x9')],_0x19e784['Contact'][_0x48d7('0xa')],_0x19e784[_0x48d7('0x8')][_0x48d7('0xb')]);this['number']=_0x19e784['Contact']['phone'];this[_0x48d7('0xc')]=_0x1f957f[_0x48d7('0x7')];this[_0x48d7('0xd')]=_0x19e784['active']||![];this[_0x48d7('0xe')]=_0x1f957f[_0x48d7('0xe')];this['dialQueueTimeout']=_0x1f957f[_0x48d7('0xf')]||0x3;this[_0x48d7('0x10')]=_0x19e784[_0x48d7('0x10')];this[_0x48d7('0x11')]=_0x19e784[_0x48d7('0x11')];this[_0x48d7('0x12')]=_0x19e784[_0x48d7('0x12')];this[_0x48d7('0x13')]=_0x19e784[_0x48d7('0x13')];this[_0x48d7('0x14')]=_0x19e784[_0x48d7('0x14')];this[_0x48d7('0x15')]=_0x19e784[_0x48d7('0x15')];this['countabandonedretry']=_0x19e784[_0x48d7('0x16')];this['countmachineretry']=_0x19e784[_0x48d7('0x17')];this[_0x48d7('0x18')]=_0x19e784['countagentrejectretry'];this['ContactId']=_0x19e784[_0x48d7('0x19')];this['ListId']=_0x19e784[_0x48d7('0x1a')];this[_0x48d7('0x1b')]=_0x19e784[_0x48d7('0x1b')];this[_0x48d7('0x1c')]=_0x19e784['VoiceQueueId'];this['CampaignId']=_0x19e784[_0x48d7('0x1d')];this[_0x48d7('0x1e')]=_0x19e784['id'];this[_0x48d7('0x1f')]=_0x19e784[_0x48d7('0x8')][_0x48d7('0xa')]||'';this[_0x48d7('0x20')]=moment()['format'](_0x48d7('0x21'));this[_0x48d7('0x22')]=_0x19e784[_0x48d7('0x22')];this[_0x48d7('0x23')]=_0x19e784['callbackuniqueid'];this[_0x48d7('0x24')]=_0x19e784[_0x48d7('0x24')];this[_0x48d7('0x25')]=_0x19e784['recallme'];this[_0x48d7('0x26')]='';this[_0x48d7('0x27')]='';}Action[_0x48d7('0x28')][_0x48d7('0x29')]=function(){return util[_0x48d7('0x2a')](_0x48d7('0x2b'),this[_0x48d7('0x7')],this[_0x48d7('0x5')][_0x48d7('0x2c')]>0x0?this['number'][_0x48d7('0x2d')](this[_0x48d7('0x5')][_0x48d7('0x2c')]):this[_0x48d7('0x2e')]);};Action[_0x48d7('0x28')][_0x48d7('0x2f')]=function(){return this[_0x48d7('0xc')];};module[_0x48d7('0x30')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 9983c1a..41b44c8 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 _0x8076=['originatecalleridname','util','lodash','moment','milliseconds','diff','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8076,0x181));var _0x6807=function(_0x176009,_0x2b5166){_0x176009=_0x176009-0x0;var _0x59dccb=_0x8076[_0x176009];return _0x59dccb;};'use strict';var util=require(_0x6807('0x0'));var _=require(_0x6807('0x1'));var moment=require(_0x6807('0x2'));function getSeconds(_0x132d3d,_0x4c1fc6){var _0x4b262b=moment(_0x132d3d)[_0x6807('0x3')](0x0);var _0x1b8ca2=moment(_0x4c1fc6)[_0x6807('0x3')](0x0);return _0x4b262b[_0x6807('0x4')](_0x1b8ca2,'seconds');}function AgentComplete(_0x1cbf59,_0x2e4c34){this[_0x6807('0x5')]=0x4;this['statedesc']=_0x6807('0x6');this[_0x6807('0x7')]=_0x1cbf59[_0x6807('0x7')];this[_0x6807('0x8')]=_0x1cbf59[_0x6807('0x8')];this[_0x6807('0x9')]=_0x1cbf59['type']===_0x6807('0xa')?_0x6807('0xb'):_0x1cbf59[_0x6807('0x8')];this[_0x6807('0xc')]=_0x1cbf59['countbusyretry'];this[_0x6807('0xd')]=_0x1cbf59[_0x6807('0xd')];this[_0x6807('0xe')]=_0x1cbf59[_0x6807('0xe')];this[_0x6807('0xf')]=_0x1cbf59[_0x6807('0xc')]+_0x1cbf59['countcongestionretry']+_0x1cbf59[_0x6807('0xe')]+_0x1cbf59[_0x6807('0x10')]+_0x1cbf59[_0x6807('0x11')]+_0x1cbf59[_0x6807('0x12')]+_0x1cbf59[_0x6807('0x13')]+_0x1cbf59[_0x6807('0x14')];this[_0x6807('0x10')]=_0x1cbf59[_0x6807('0x10')];this[_0x6807('0x11')]=_0x1cbf59[_0x6807('0x11')];this[_0x6807('0x12')]=_0x1cbf59['countabandonedretry'];this[_0x6807('0x13')]=_0x1cbf59[_0x6807('0x13')];this[_0x6807('0x14')]=_0x1cbf59[_0x6807('0x14')];this[_0x6807('0x15')]=_0x2e4c34[_0x6807('0x15')];this[_0x6807('0x16')]=_0x1cbf59[_0x6807('0x17')];this[_0x6807('0x18')]=_0x1cbf59[_0x6807('0x19')];this[_0x6807('0x1a')]=_0x1cbf59['starttime'];this[_0x6807('0x1b')]=_0x1cbf59[_0x6807('0x1b')];this[_0x6807('0x1c')]=_0x1cbf59[_0x6807('0x1c')];this[_0x6807('0x1d')]=moment()[_0x6807('0x1e')](_0x6807('0x1f'));this[_0x6807('0x20')]=getSeconds(_0x1cbf59[_0x6807('0x1b')],_0x1cbf59[_0x6807('0x1a')]);this[_0x6807('0x21')]=getSeconds(_0x1cbf59[_0x6807('0x1c')],_0x1cbf59['responsetime']);this[_0x6807('0x22')]=getSeconds(this[_0x6807('0x1d')],_0x1cbf59[_0x6807('0x1c')]);this['queue']=_0x2e4c34[_0x6807('0xb')];this[_0x6807('0x23')]=_0x2e4c34[_0x6807('0x23')];this[_0x6807('0x24')]=_0x2e4c34[_0x6807('0x24')];this[_0x6807('0x25')]=_0x1cbf59[_0x6807('0x25')];this[_0x6807('0x26')]=_0x1cbf59['callbackuniqueid'];this[_0x6807('0x27')]=_0x1cbf59[_0x6807('0x27')];this[_0x6807('0x28')]=_0x1cbf59['recallme'];this[_0x6807('0x29')]=_0x1cbf59[_0x6807('0x29')];this[_0x6807('0x2a')]=_0x1cbf59[_0x6807('0x2a')];this[_0x6807('0x2b')]=_0x1cbf59['UserId'];this[_0x6807('0x2c')]=_0x1cbf59[_0x6807('0x2c')];this[_0x6807('0x2d')]=_0x1cbf59[_0x6807('0x2d')];this['originatecalleridnum']=_0x1cbf59[_0x6807('0x2e')]||'';this['originatecalleridname']=_0x1cbf59[_0x6807('0x2f')]||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0x10fe=['holdtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x230284,_0x1e5b98){var _0x379935=function(_0x17872a){while(--_0x17872a){_0x230284['push'](_0x230284['shift']());}};_0x379935(++_0x1e5b98);}(_0x10fe,0x159));var _0xe10f=function(_0x542f6a,_0x39e2fc){_0x542f6a=_0x542f6a-0x0;var _0xecdab5=_0x10fe[_0x542f6a];return _0xecdab5;};'use strict';var util=require(_0xe10f('0x0'));var _=require(_0xe10f('0x1'));var moment=require(_0xe10f('0x2'));function getSeconds(_0x5e506b,_0x2588b5){var _0xad2f19=moment(_0x5e506b)[_0xe10f('0x3')](0x0);var _0x317aaa=moment(_0x2588b5)['milliseconds'](0x0);return _0xad2f19[_0xe10f('0x4')](_0x317aaa,_0xe10f('0x5'));}function AgentComplete(_0x21a376,_0x53a3da){this[_0xe10f('0x6')]=0x4;this[_0xe10f('0x7')]=_0xe10f('0x8');this['scheduledat']=_0x21a376[_0xe10f('0x9')];this[_0xe10f('0xa')]=_0x21a376[_0xe10f('0xa')];this[_0xe10f('0xb')]=_0x21a376[_0xe10f('0xa')]===_0xe10f('0xc')?'queue':_0x21a376[_0xe10f('0xa')];this['countbusyretry']=_0x21a376[_0xe10f('0xd')];this['countcongestionretry']=_0x21a376[_0xe10f('0xe')];this[_0xe10f('0xf')]=_0x21a376[_0xe10f('0xf')];this['countglobal']=_0x21a376[_0xe10f('0xd')]+_0x21a376['countcongestionretry']+_0x21a376[_0xe10f('0xf')]+_0x21a376[_0xe10f('0x10')]+_0x21a376[_0xe10f('0x11')]+_0x21a376['countabandonedretry']+_0x21a376['countmachineretry']+_0x21a376[_0xe10f('0x12')];this[_0xe10f('0x10')]=_0x21a376[_0xe10f('0x10')];this[_0xe10f('0x11')]=_0x21a376['countdropretry'];this[_0xe10f('0x13')]=_0x21a376[_0xe10f('0x13')];this[_0xe10f('0x14')]=_0x21a376[_0xe10f('0x14')];this['countagentrejectretry']=_0x21a376[_0xe10f('0x12')];this['uniqueid']=_0x53a3da[_0xe10f('0x15')];this[_0xe10f('0x16')]=_0x21a376[_0xe10f('0x17')];this[_0xe10f('0x18')]=_0x21a376['number'];this[_0xe10f('0x19')]=_0x21a376['starttime'];this[_0xe10f('0x1a')]=_0x21a376['responsetime'];this['answertime']=_0x21a376[_0xe10f('0x1b')];this[_0xe10f('0x1c')]=moment()[_0xe10f('0x1d')](_0xe10f('0x1e'));this['ringtime']=getSeconds(_0x21a376['responsetime'],_0x21a376[_0xe10f('0x19')]);this[_0xe10f('0x1f')]=getSeconds(_0x21a376['answertime'],_0x21a376['responsetime']);this['talktime']=getSeconds(this['endtime'],_0x21a376[_0xe10f('0x1b')]);this['queue']=_0x53a3da[_0xe10f('0x20')];this[_0xe10f('0x21')]=_0x53a3da['membername'];this[_0xe10f('0x22')]=_0x53a3da[_0xe10f('0x22')];this[_0xe10f('0x23')]=_0x21a376[_0xe10f('0x23')];this[_0xe10f('0x24')]=_0x21a376[_0xe10f('0x24')];this[_0xe10f('0x25')]=_0x21a376[_0xe10f('0x25')];this[_0xe10f('0x26')]=_0x21a376[_0xe10f('0x26')];this[_0xe10f('0x27')]=_0x21a376[_0xe10f('0x27')];this['ListId']=_0x21a376[_0xe10f('0x28')];this[_0xe10f('0x29')]=_0x21a376[_0xe10f('0x29')];this['VoiceQueueId']=_0x21a376[_0xe10f('0x2a')];this[_0xe10f('0x2b')]=_0x21a376[_0xe10f('0x2b')];this[_0xe10f('0x2c')]=_0x21a376[_0xe10f('0x2c')]||'';this[_0xe10f('0x2d')]=_0x21a376[_0xe10f('0x2d')]||'';}module[_0xe10f('0x2e')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index fd4ace2..30aa953 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 _0x2caf=['campaigntype','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','milliseconds','diff','seconds','uniqueid','scheduledat'];(function(_0x293c0d,_0x34b459){var _0x24e22e=function(_0x6eb8c6){while(--_0x6eb8c6){_0x293c0d['push'](_0x293c0d['shift']());}};_0x24e22e(++_0x34b459);}(_0x2caf,0x6a));var _0xf2ca=function(_0x293870,_0x3b4d2d){_0x293870=_0x293870-0x0;var _0x2e6a4d=_0x2caf[_0x293870];return _0x2e6a4d;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function getSeconds(_0x22932c,_0x53a64f){var _0x3b2612=moment(_0x22932c)[_0xf2ca('0x0')](0x0);var _0x43b96c=moment(_0x53a64f)[_0xf2ca('0x0')](0x0);return _0x3b2612[_0xf2ca('0x1')](_0x43b96c,_0xf2ca('0x2'));}function Final(_0x1a56cd){this['uniqueid']=_0x1a56cd[_0xf2ca('0x3')];this[_0xf2ca('0x4')]=_0x1a56cd[_0xf2ca('0x4')];this['type']=_0x1a56cd['type'];this[_0xf2ca('0x5')]=_0x1a56cd[_0xf2ca('0x6')]===_0xf2ca('0x7')?_0xf2ca('0x8'):_0x1a56cd[_0xf2ca('0x6')];this['countbusyretry']=_0x1a56cd[_0xf2ca('0x9')];this[_0xf2ca('0xa')]=_0x1a56cd[_0xf2ca('0xa')];this[_0xf2ca('0xb')]=_0x1a56cd[_0xf2ca('0xb')];this[_0xf2ca('0xc')]=_0x1a56cd['countbusyretry']+_0x1a56cd[_0xf2ca('0xa')]+_0x1a56cd[_0xf2ca('0xb')]+_0x1a56cd['countnosuchnumberretry']+_0x1a56cd[_0xf2ca('0xd')]+_0x1a56cd[_0xf2ca('0xe')]+_0x1a56cd['countmachineretry']+_0x1a56cd['countagentrejectretry'];this[_0xf2ca('0xf')]=_0x1a56cd['countnosuchnumberretry'];this[_0xf2ca('0xd')]=_0x1a56cd[_0xf2ca('0xd')];this[_0xf2ca('0xe')]=_0x1a56cd[_0xf2ca('0xe')];this[_0xf2ca('0x10')]=_0x1a56cd[_0xf2ca('0x10')];this[_0xf2ca('0x11')]=_0x1a56cd['countagentrejectretry'];this[_0xf2ca('0x8')]=_0x1a56cd['queue'];this[_0xf2ca('0x12')]=_0x1a56cd['calleridname'];this[_0xf2ca('0x13')]=_0x1a56cd[_0xf2ca('0x13')];this['starttime']=_0x1a56cd[_0xf2ca('0x14')];this[_0xf2ca('0x15')]=_0x1a56cd[_0xf2ca('0x15')];this[_0xf2ca('0x16')]=_0x1a56cd[_0xf2ca('0x15')];this[_0xf2ca('0x17')]=_0x1a56cd[_0xf2ca('0x17')]||0x0;this[_0xf2ca('0x18')]=_0x1a56cd[_0xf2ca('0x18')]||0x0;this[_0xf2ca('0x19')]=_0x1a56cd[_0xf2ca('0x19')]||0x0;this['callback']=_0x1a56cd[_0xf2ca('0x1a')];this[_0xf2ca('0x1b')]=_0x1a56cd[_0xf2ca('0x1b')];this[_0xf2ca('0x1c')]=_0x1a56cd[_0xf2ca('0x1c')];this[_0xf2ca('0x1d')]=_0x1a56cd[_0xf2ca('0x1d')];this[_0xf2ca('0x1e')]=_0x1a56cd['ContactId'];this[_0xf2ca('0x1f')]=_0x1a56cd[_0xf2ca('0x1f')];this['UserId']=_0x1a56cd[_0xf2ca('0x20')];this[_0xf2ca('0x21')]=_0x1a56cd[_0xf2ca('0x21')];this['CampaignId']=_0x1a56cd['CampaignId'];this[_0xf2ca('0x22')]=_0x1a56cd[_0xf2ca('0x22')]||'';this[_0xf2ca('0x23')]=_0x1a56cd[_0xf2ca('0x23')]||'';}module[_0xf2ca('0x24')]=Final; \ No newline at end of file +var _0x2123=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x2123,0x190));var _0x3212=function(_0x86eb44,_0x1960f3){_0x86eb44=_0x86eb44-0x0;var _0x1f070b=_0x2123[_0x86eb44];return _0x1f070b;};'use strict';var util=require(_0x3212('0x0'));var _=require(_0x3212('0x1'));var moment=require(_0x3212('0x2'));function getSeconds(_0x3424c2,_0x7158b8){var _0x2ff863=moment(_0x3424c2)[_0x3212('0x3')](0x0);var _0x2e951f=moment(_0x7158b8)[_0x3212('0x3')](0x0);return _0x2ff863[_0x3212('0x4')](_0x2e951f,_0x3212('0x5'));}function Final(_0x265328){this['uniqueid']=_0x265328[_0x3212('0x6')];this[_0x3212('0x7')]=_0x265328[_0x3212('0x7')];this['type']=_0x265328[_0x3212('0x8')];this['campaigntype']=_0x265328[_0x3212('0x8')]===_0x3212('0x9')?_0x3212('0xa'):_0x265328[_0x3212('0x8')];this['countbusyretry']=_0x265328['countbusyretry'];this[_0x3212('0xb')]=_0x265328[_0x3212('0xb')];this[_0x3212('0xc')]=_0x265328[_0x3212('0xc')];this[_0x3212('0xd')]=_0x265328[_0x3212('0xe')]+_0x265328[_0x3212('0xb')]+_0x265328[_0x3212('0xc')]+_0x265328[_0x3212('0xf')]+_0x265328[_0x3212('0x10')]+_0x265328[_0x3212('0x11')]+_0x265328[_0x3212('0x12')]+_0x265328[_0x3212('0x13')];this[_0x3212('0xf')]=_0x265328[_0x3212('0xf')];this[_0x3212('0x10')]=_0x265328[_0x3212('0x10')];this[_0x3212('0x11')]=_0x265328[_0x3212('0x11')];this[_0x3212('0x12')]=_0x265328[_0x3212('0x12')];this[_0x3212('0x13')]=_0x265328['countagentrejectretry'];this[_0x3212('0xa')]=_0x265328[_0x3212('0xa')];this[_0x3212('0x14')]=_0x265328[_0x3212('0x14')];this[_0x3212('0x15')]=_0x265328[_0x3212('0x15')];this[_0x3212('0x16')]=_0x265328['starttime'];this['responsetime']=_0x265328[_0x3212('0x17')];this['endtime']=_0x265328[_0x3212('0x17')];this[_0x3212('0x18')]=_0x265328[_0x3212('0x18')]||0x0;this[_0x3212('0x19')]=_0x265328[_0x3212('0x19')]||0x0;this['talktime']=_0x265328[_0x3212('0x1a')]||0x0;this[_0x3212('0x1b')]=_0x265328['callback'];this[_0x3212('0x1c')]=_0x265328[_0x3212('0x1c')];this[_0x3212('0x1d')]=_0x265328['callbackat'];this['recallme']=_0x265328[_0x3212('0x1e')];this[_0x3212('0x1f')]=_0x265328[_0x3212('0x1f')];this[_0x3212('0x20')]=_0x265328[_0x3212('0x20')];this[_0x3212('0x21')]=_0x265328['UserId'];this['VoiceQueueId']=_0x265328[_0x3212('0x22')];this['CampaignId']=_0x265328[_0x3212('0x23')];this[_0x3212('0x24')]=_0x265328[_0x3212('0x24')]||'';this['originatecalleridname']=_0x265328[_0x3212('0x25')]||'';}module[_0x3212('0x26')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 14a6623..200ccca 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 _0xfa41=['countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','util','lodash','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry'];(function(_0x4782ba,_0x2d1cfa){var _0x443f1d=function(_0x3b42bf){while(--_0x3b42bf){_0x4782ba['push'](_0x4782ba['shift']());}};_0x443f1d(++_0x2d1cfa);}(_0xfa41,0x100));var _0x1fa4=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xfa41[_0xae7c2f];return _0x5d7001;};'use strict';var util=require(_0x1fa4('0x0'));var _=require(_0x1fa4('0x1'));var moment=require('moment');function getSeconds(_0x290c86,_0x5d25d8){var _0x2c947d=moment(_0x290c86)[_0x1fa4('0x2')](0x0);var _0x43d82f=moment(_0x5d25d8)[_0x1fa4('0x2')](0x0);return _0x2c947d[_0x1fa4('0x3')](_0x43d82f,_0x1fa4('0x4'));}function Hangup(_0x43cff2,_0x552423){this[_0x1fa4('0x5')]=0x4;this[_0x1fa4('0x6')]=_0x1fa4('0x7');this[_0x1fa4('0x8')]=_0x43cff2[_0x1fa4('0x8')];this[_0x1fa4('0x9')]=_0x43cff2[_0x1fa4('0x9')];this[_0x1fa4('0xa')]=_0x43cff2[_0x1fa4('0x9')]==='outbound'?_0x1fa4('0xb'):_0x43cff2[_0x1fa4('0x9')];this[_0x1fa4('0xc')]=_0x43cff2['countbusyretry'];this[_0x1fa4('0xd')]=_0x43cff2[_0x1fa4('0xd')];this['countnoanswerretry']=_0x43cff2[_0x1fa4('0xe')];this[_0x1fa4('0xf')]=_0x43cff2[_0x1fa4('0xc')]+_0x43cff2[_0x1fa4('0xd')]+_0x43cff2['countnoanswerretry']+_0x43cff2[_0x1fa4('0x10')]+_0x43cff2[_0x1fa4('0x11')]+_0x43cff2['countabandonedretry']+_0x43cff2[_0x1fa4('0x12')]+_0x43cff2[_0x1fa4('0x13')];this[_0x1fa4('0x10')]=_0x43cff2[_0x1fa4('0x10')];this['countdropretry']=_0x43cff2[_0x1fa4('0x11')];this['countabandonedretry']=_0x43cff2[_0x1fa4('0x14')];this[_0x1fa4('0x12')]=_0x43cff2['countmachineretry'];this[_0x1fa4('0x13')]=_0x43cff2[_0x1fa4('0x13')];this['uniqueid']=_0x552423[_0x1fa4('0x15')];this[_0x1fa4('0x16')]=_0x43cff2[_0x1fa4('0x17')];this[_0x1fa4('0x18')]=_0x43cff2[_0x1fa4('0x19')];this[_0x1fa4('0x1a')]=_0x43cff2[_0x1fa4('0x1a')];this[_0x1fa4('0x1b')]=_0x43cff2[_0x1fa4('0x1b')];this[_0x1fa4('0x1c')]=moment()['format'](_0x1fa4('0x1d'));this[_0x1fa4('0x1e')]=getSeconds(_0x43cff2[_0x1fa4('0x1b')],_0x43cff2[_0x1fa4('0x1a')]);this[_0x1fa4('0x1f')]=0x0;this[_0x1fa4('0x20')]=getSeconds(this['endtime'],_0x43cff2[_0x1fa4('0x1b')]);this[_0x1fa4('0xb')]=_0x43cff2['queue'];this[_0x1fa4('0x21')]=_0x1fa4('0x22');this[_0x1fa4('0x23')]=_0x552423[_0x1fa4('0x24')];this['callback']=_0x43cff2[_0x1fa4('0x25')];this[_0x1fa4('0x26')]=_0x43cff2[_0x1fa4('0x26')];this[_0x1fa4('0x27')]=_0x43cff2['callbackat'];this[_0x1fa4('0x28')]=_0x43cff2[_0x1fa4('0x28')];this['ContactId']=_0x43cff2[_0x1fa4('0x29')];this[_0x1fa4('0x2a')]=_0x43cff2['ListId'];this[_0x1fa4('0x2b')]=_0x43cff2[_0x1fa4('0x2b')];this['VoiceQueueId']=_0x43cff2['VoiceQueueId'];this[_0x1fa4('0x2c')]=_0x43cff2[_0x1fa4('0x2c')];}module['exports']=Hangup; \ No newline at end of file +var _0x734e=['CampaignId','exports','lodash','moment','milliseconds','diff','seconds','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','name','calleridnum','number','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','responsetime','holdtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x734e,0x13d));var _0xe734=function(_0x1cd51f,_0x297954){_0x1cd51f=_0x1cd51f-0x0;var _0x54208a=_0x734e[_0x1cd51f];return _0x54208a;};'use strict';var util=require('util');var _=require(_0xe734('0x0'));var moment=require(_0xe734('0x1'));function getSeconds(_0x3ac791,_0x23f613){var _0x2201df=moment(_0x3ac791)[_0xe734('0x2')](0x0);var _0x4ee4e8=moment(_0x23f613)[_0xe734('0x2')](0x0);return _0x2201df[_0xe734('0x3')](_0x4ee4e8,_0xe734('0x4'));}function Hangup(_0x2737eb,_0x875b53){this['state']=0x4;this['statedesc']=_0xe734('0x5');this[_0xe734('0x6')]=_0x2737eb[_0xe734('0x6')];this[_0xe734('0x7')]=_0x2737eb[_0xe734('0x7')];this[_0xe734('0x8')]=_0x2737eb[_0xe734('0x7')]===_0xe734('0x9')?_0xe734('0xa'):_0x2737eb[_0xe734('0x7')];this[_0xe734('0xb')]=_0x2737eb['countbusyretry'];this[_0xe734('0xc')]=_0x2737eb[_0xe734('0xc')];this[_0xe734('0xd')]=_0x2737eb['countnoanswerretry'];this[_0xe734('0xe')]=_0x2737eb[_0xe734('0xb')]+_0x2737eb['countcongestionretry']+_0x2737eb[_0xe734('0xd')]+_0x2737eb[_0xe734('0xf')]+_0x2737eb['countdropretry']+_0x2737eb[_0xe734('0x10')]+_0x2737eb[_0xe734('0x11')]+_0x2737eb[_0xe734('0x12')];this[_0xe734('0xf')]=_0x2737eb[_0xe734('0xf')];this['countdropretry']=_0x2737eb[_0xe734('0x13')];this[_0xe734('0x10')]=_0x2737eb[_0xe734('0x10')];this[_0xe734('0x11')]=_0x2737eb['countmachineretry'];this[_0xe734('0x12')]=_0x2737eb[_0xe734('0x12')];this[_0xe734('0x14')]=_0x875b53[_0xe734('0x14')];this['calleridname']=_0x2737eb[_0xe734('0x15')];this[_0xe734('0x16')]=_0x2737eb[_0xe734('0x17')];this[_0xe734('0x18')]=_0x2737eb[_0xe734('0x18')];this['responsetime']=_0x2737eb['responsetime'];this[_0xe734('0x19')]=moment()[_0xe734('0x1a')](_0xe734('0x1b'));this[_0xe734('0x1c')]=getSeconds(_0x2737eb[_0xe734('0x1d')],_0x2737eb['starttime']);this[_0xe734('0x1e')]=0x0;this['talktime']=getSeconds(this['endtime'],_0x2737eb[_0xe734('0x1d')]);this['queue']=_0x2737eb[_0xe734('0xa')];this[_0xe734('0x1f')]=_0xe734('0x20');this[_0xe734('0x21')]=_0x875b53[_0xe734('0x22')];this[_0xe734('0x23')]=_0x2737eb[_0xe734('0x23')];this[_0xe734('0x24')]=_0x2737eb[_0xe734('0x24')];this[_0xe734('0x25')]=_0x2737eb[_0xe734('0x25')];this[_0xe734('0x26')]=_0x2737eb['recallme'];this[_0xe734('0x27')]=_0x2737eb[_0xe734('0x27')];this[_0xe734('0x28')]=_0x2737eb['ListId'];this[_0xe734('0x29')]=_0x2737eb['UserId'];this['VoiceQueueId']=_0x2737eb[_0xe734('0x2a')];this[_0xe734('0x2b')]=_0x2737eb[_0xe734('0x2b')];}module[_0xe734('0x2c')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 95550d8..af7bdd2 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 _0xc8ce=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','calleridname','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x4126a1,_0x32682a){var _0x1e893b=function(_0x419446){while(--_0x419446){_0x4126a1['push'](_0x4126a1['shift']());}};_0x1e893b(++_0x32682a);}(_0xc8ce,0x176));var _0xec8c=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xc8ce[_0x257642];return _0x3d813b;};'use strict';var util=require(_0xec8c('0x0'));var _=require('lodash');var moment=require(_0xec8c('0x1'));function getSeconds(_0x1b9390,_0x4b48b6){var _0x11e917=moment(_0x1b9390)[_0xec8c('0x2')](0x0);var _0x27e309=moment(_0x4b48b6)['milliseconds'](0x0);return _0x11e917[_0xec8c('0x3')](_0x27e309,_0xec8c('0x4'));}function History(_0x2c0db0){this[_0xec8c('0x5')]=_0x2c0db0['uniqueid'];this['scheduledat']=_0x2c0db0[_0xec8c('0x6')]||undefined;this[_0xec8c('0x7')]=_0x2c0db0[_0xec8c('0x7')];this[_0xec8c('0x8')]=_0x2c0db0[_0xec8c('0x7')]===_0xec8c('0x9')?_0xec8c('0xa'):_0x2c0db0[_0xec8c('0x7')];this[_0xec8c('0xb')]=_0x2c0db0[_0xec8c('0xb')];this[_0xec8c('0xc')]=_0x2c0db0[_0xec8c('0xc')];this[_0xec8c('0xd')]=_0x2c0db0[_0xec8c('0xd')];this[_0xec8c('0xe')]=_0x2c0db0[_0xec8c('0xb')]+_0x2c0db0['countcongestionretry']+_0x2c0db0[_0xec8c('0xd')]+_0x2c0db0['countnosuchnumberretry']+_0x2c0db0['countdropretry']+_0x2c0db0[_0xec8c('0xf')]+_0x2c0db0[_0xec8c('0x10')]+_0x2c0db0[_0xec8c('0x11')];this[_0xec8c('0x12')]=_0x2c0db0['countnosuchnumberretry'];this[_0xec8c('0x13')]=_0x2c0db0[_0xec8c('0x13')];this[_0xec8c('0xf')]=_0x2c0db0[_0xec8c('0xf')];this['countmachineretry']=_0x2c0db0['countmachineretry'];this[_0xec8c('0x11')]=_0x2c0db0[_0xec8c('0x11')];this[_0xec8c('0xa')]=_0x2c0db0[_0xec8c('0xa')];this[_0xec8c('0x14')]=_0x2c0db0['name'];this[_0xec8c('0x15')]=_0x2c0db0[_0xec8c('0x16')];this[_0xec8c('0x17')]=_0x2c0db0['starttime'];this[_0xec8c('0x18')]=_0x2c0db0['responsetime'];this[_0xec8c('0x19')]=_0x2c0db0[_0xec8c('0x18')];this[_0xec8c('0x1a')]=getSeconds(_0x2c0db0['responsetime'],_0x2c0db0[_0xec8c('0x17')]);this[_0xec8c('0x1b')]=0x0;this[_0xec8c('0x1c')]=0x0;this[_0xec8c('0x1d')]=_0x2c0db0[_0xec8c('0x1d')];this[_0xec8c('0x1e')]=_0x2c0db0[_0xec8c('0x1e')];this['callbackat']=_0x2c0db0[_0xec8c('0x1f')];this[_0xec8c('0x20')]=_0x2c0db0[_0xec8c('0x20')];this[_0xec8c('0x21')]=_0x2c0db0[_0xec8c('0x21')];this[_0xec8c('0x22')]=_0x2c0db0[_0xec8c('0x22')];this[_0xec8c('0x23')]=_0x2c0db0[_0xec8c('0x23')];this[_0xec8c('0x24')]=_0x2c0db0['VoiceQueueId'];this[_0xec8c('0x25')]=_0x2c0db0[_0xec8c('0x25')];this[_0xec8c('0x26')]=_0x2c0db0[_0xec8c('0x26')]||'';this['originatecalleridname']=_0x2c0db0[_0xec8c('0x27')]||'';}module[_0xec8c('0x28')]=History; \ No newline at end of file +var _0x7e5b=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridnum','number','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat'];(function(_0x313927,_0x2b3a6d){var _0x545b28=function(_0x1be96e){while(--_0x1be96e){_0x313927['push'](_0x313927['shift']());}};_0x545b28(++_0x2b3a6d);}(_0x7e5b,0xed));var _0xb7e5=function(_0x1f3003,_0x1f3f09){_0x1f3003=_0x1f3003-0x0;var _0x1e06a6=_0x7e5b[_0x1f3003];return _0x1e06a6;};'use strict';var util=require(_0xb7e5('0x0'));var _=require(_0xb7e5('0x1'));var moment=require(_0xb7e5('0x2'));function getSeconds(_0x446d49,_0x58450c){var _0x421ad1=moment(_0x446d49)[_0xb7e5('0x3')](0x0);var _0x259175=moment(_0x58450c)['milliseconds'](0x0);return _0x421ad1['diff'](_0x259175,_0xb7e5('0x4'));}function History(_0x2ebbad){this[_0xb7e5('0x5')]=_0x2ebbad[_0xb7e5('0x5')];this[_0xb7e5('0x6')]=_0x2ebbad[_0xb7e5('0x6')]||undefined;this['type']=_0x2ebbad['type'];this['campaigntype']=_0x2ebbad[_0xb7e5('0x7')]===_0xb7e5('0x8')?_0xb7e5('0x9'):_0x2ebbad[_0xb7e5('0x7')];this[_0xb7e5('0xa')]=_0x2ebbad['countbusyretry'];this[_0xb7e5('0xb')]=_0x2ebbad['countcongestionretry'];this['countnoanswerretry']=_0x2ebbad[_0xb7e5('0xc')];this[_0xb7e5('0xd')]=_0x2ebbad[_0xb7e5('0xa')]+_0x2ebbad[_0xb7e5('0xb')]+_0x2ebbad['countnoanswerretry']+_0x2ebbad[_0xb7e5('0xe')]+_0x2ebbad[_0xb7e5('0xf')]+_0x2ebbad[_0xb7e5('0x10')]+_0x2ebbad['countmachineretry']+_0x2ebbad[_0xb7e5('0x11')];this['countnosuchnumberretry']=_0x2ebbad['countnosuchnumberretry'];this[_0xb7e5('0xf')]=_0x2ebbad[_0xb7e5('0xf')];this['countabandonedretry']=_0x2ebbad[_0xb7e5('0x10')];this['countmachineretry']=_0x2ebbad[_0xb7e5('0x12')];this[_0xb7e5('0x11')]=_0x2ebbad[_0xb7e5('0x11')];this[_0xb7e5('0x9')]=_0x2ebbad['queue'];this['calleridname']=_0x2ebbad['name'];this[_0xb7e5('0x13')]=_0x2ebbad[_0xb7e5('0x14')];this[_0xb7e5('0x15')]=_0x2ebbad['starttime'];this[_0xb7e5('0x16')]=_0x2ebbad['responsetime'];this[_0xb7e5('0x17')]=_0x2ebbad[_0xb7e5('0x16')];this['ringtime']=getSeconds(_0x2ebbad[_0xb7e5('0x16')],_0x2ebbad[_0xb7e5('0x15')]);this[_0xb7e5('0x18')]=0x0;this[_0xb7e5('0x19')]=0x0;this[_0xb7e5('0x1a')]=_0x2ebbad[_0xb7e5('0x1a')];this[_0xb7e5('0x1b')]=_0x2ebbad[_0xb7e5('0x1b')];this[_0xb7e5('0x1c')]=_0x2ebbad['callbackat'];this[_0xb7e5('0x1d')]=_0x2ebbad[_0xb7e5('0x1d')];this[_0xb7e5('0x1e')]=_0x2ebbad[_0xb7e5('0x1e')];this[_0xb7e5('0x1f')]=_0x2ebbad[_0xb7e5('0x1f')];this[_0xb7e5('0x20')]=_0x2ebbad[_0xb7e5('0x20')];this[_0xb7e5('0x21')]=_0x2ebbad[_0xb7e5('0x21')];this[_0xb7e5('0x22')]=_0x2ebbad['CampaignId'];this[_0xb7e5('0x23')]=_0x2ebbad['originatecalleridnum']||'';this[_0xb7e5('0x24')]=_0x2ebbad[_0xb7e5('0x24')]||'';}module[_0xb7e5('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 8f343b2..208edb1 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 _0x5ebe=['NoAnswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','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','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','recalculate\x20predictive\x20at','startMethodPredictive',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','Unknown\x20Predictive','[getDataPredictive]','outboundQueuePauses','[CatchErlangB]','predictiveIntervalPauses','busyFactor','check\x20failure','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','Queue:\x20','actionOriginate','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','Contact.phone','[getContactCampaign2]','dialLimitQueue','not_inuse','[countReScheduled]\x20','ACTIVE','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','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','Ts\x20=\x20','[abandonmentRate]','p\x20=\x20','interval\x20=\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/logger','dialer','booked','predictive','predictiveCalls','defaults','localhost','socket.io-emitter','redis','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./agentComplete','./queueCallerAbandon','./hangup','127.0.0.1','rrmemory','roundrobin','enqueue','tail','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startProgressive','queueBooked','queueBookedRR','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','loopClearZombieChannels','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','[ifTime][Action]','Error','milliseconds','diff','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','talking','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','originated','erlangCalls','erlangBusyFactor','startPredictive','Trunk','active','callerid','stringify','format','voice:queue:%s','campaign:ivr:%s','campaign:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','isUndefined','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','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','erlangAbandonmentRate','---------------------------','merge','seconds','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','stack','undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','sendMessageOneNotActive','is\x20disactive','state','statedesc','starttime','prototype','clearZombieChannels','[uniqueid]','[actions]','isNil','Action','channel','No\x20such\x20channel','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','resolve','countReScheduled','catch','checkIsBlackList','[checkIsBlackList]\x20','then','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','VoiceQueueId','CampaignId','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','status','unmonitored','uniqueid','variable','exten','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','dialAMDActive','value','MACHINE','membername','countmachineretry','countcongestionretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','Machine','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','reason19\x20machine....','reason\x2019\x20machine....','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','Unknow','reason','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialDropMaxRetry','queueCallerAbandonCreateState','dialDropRetryFrequency','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[syncAgentComplete][createHistory][11]','actionid','locked','stateinterface','push','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','finally','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','loopCampaigns','checkIsTrunkReachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','length','iftime\x20%s,%s','content','indexOf','true','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','checkDialMethod','progressive','handlePower','dialPowerLevel','launchHandleIvr','checkIfTimeIntervals','dialTimezone','syncCampaigns','dialGlobalInterval','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialCutDigit','trim','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','[rescheduleContact][Drop]','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5ebe,0x69));var _0xe5eb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5ebe[_0x20a584];return _0x4b41a8;};'use strict';var util=require('util');var _=require(_0xe5eb('0x0'));var BPromise=require(_0xe5eb('0x1'));var uuid=require(_0xe5eb('0x2'));var moment=require(_0xe5eb('0x3'));var rr=require('rr');var md5=require(_0xe5eb('0x4'));var Redis=require(_0xe5eb('0x5'));var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require(_0xe5eb('0x6'))(_0xe5eb('0x7'));var loggerBooked=require(_0xe5eb('0x6'))(_0xe5eb('0x8'));var loggerPredictive=require(_0xe5eb('0x6'))(_0xe5eb('0x9'));var loggerPredictiveCalls=require(_0xe5eb('0x6'))(_0xe5eb('0xa'));var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require('../ami');config['redis']=_[_0xe5eb('0xb')](config['redis'],{'host':_0xe5eb('0xc'),'port':0x18eb});var io=require(_0xe5eb('0xd'))(new Redis(config[_0xe5eb('0xe')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0xe5eb('0xf'));var cmHopperBlack=require(_0xe5eb('0x10'));var voiceQueueRt=require(_0xe5eb('0x11'));var Action=require(_0xe5eb('0x12'));var History=require(_0xe5eb('0x13'));var Final=require('./final');var AgentComplete=require(_0xe5eb('0x14'));var QueueCallerAbandon=require(_0xe5eb('0x15'));var Hangup=require(_0xe5eb('0x16'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0xe5eb('0x17');var strategy={'rrmemory':_0xe5eb('0x18'),'roundrobin':_0xe5eb('0x19')};var Sequence=function(){};Sequence['prototype'][_0xe5eb('0x1a')]=function(_0x346772){this['tail']=this[_0xe5eb('0x1b')]?this['tail']['finally'](_0x346772):_0x346772();};function Dialer(_0x4e0ce1,_0x386733){this[_0xe5eb('0x1c')]=new Sequence();this['preview']=_0x386733;this[_0xe5eb('0x1d')]=_0x4e0ce1['voiceQueues'];this[_0xe5eb('0x1e')]=_0x4e0ce1[_0xe5eb('0x1e')];this[_0xe5eb('0x1f')]=_0x4e0ce1[_0xe5eb('0x1f')];this['trunks']=_0x4e0ce1[_0xe5eb('0x20')];this[_0xe5eb('0x21')]=config[_0xe5eb('0x21')]||0x2;this[_0xe5eb('0x22')]={};this[_0xe5eb('0x23')]={};this[_0xe5eb('0x24')]={};this[_0xe5eb('0x25')]={};this['optionPredictive']={};this['startPredictive']={};this[_0xe5eb('0x26')]={};this['ivrOriginated']={};this[_0xe5eb('0x27')]={};this[_0xe5eb('0x28')]={};ami['on']('agentconnect',this[_0xe5eb('0x29')][_0xe5eb('0x2a')](this));ami['on'](_0xe5eb('0x2b'),this['syncQueueCallerAbandon'][_0xe5eb('0x2a')](this));ami['on'](_0xe5eb('0x2c'),this[_0xe5eb('0x2d')]['bind'](this));ami['on'](_0xe5eb('0x2e'),this[_0xe5eb('0x2f')]['bind'](this));ami['on'](_0xe5eb('0x30'),this[_0xe5eb('0x31')][_0xe5eb('0x2a')](this));ami['on']('hangup',this[_0xe5eb('0x32')][_0xe5eb('0x2a')](this));ami['on'](_0xe5eb('0x33'),this[_0xe5eb('0x34')][_0xe5eb('0x2a')](this));ami['on']('varset',this[_0xe5eb('0x35')][_0xe5eb('0x2a')](this));ami['on'](_0xe5eb('0x36'),this[_0xe5eb('0x37')]['bind'](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete'][_0xe5eb('0x2a')](this));this['loopCampaigns']();this[_0xe5eb('0x38')]();}function isNotNull(_0x225010){return _0x225010!==null&&!_['isUndefined'](_0x225010);}function checkIsLoggedIn(_0x11ad03,_0x2b844d){return function(){if(_0x2b844d<=0x0){_0x11ad03[_0xe5eb('0x39')]='AGENTS_NOT_LOGGED';throw _0x11ad03[_0xe5eb('0x3a')]+_0xe5eb('0x3b');}};}function isActive(_0x398938){return _0x398938;}function checkIsActive(_0x4ff4d8,_0x204615){return function(){if(!isActive(_0x204615)){_0x4ff4d8[_0xe5eb('0x39')]=_0xe5eb('0x3c');throw _0x4ff4d8[_0xe5eb('0x3a')]+_0xe5eb('0x3d');}};}function checkInterval(_0x5db472){return function(){if(!isNotNull(_0x5db472['Interval'])){_0x5db472['message']=_0xe5eb('0x3e');throw _0x5db472[_0xe5eb('0x3a')]+_0xe5eb('0x3f');}if(!isNotNull(_0x5db472[_0xe5eb('0x40')][_0xe5eb('0x41')])){_0x5db472[_0xe5eb('0x39')]=_0xe5eb('0x3e');throw _0x5db472['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0x5db472['Interval'][_0xe5eb('0x41')]))){_0x5db472['message']=_0xe5eb('0x3e');throw _0x5db472[_0xe5eb('0x3a')]+_0xe5eb('0x3f');}};}function msgResponse(_0x5e2111,_0x2b8f59,_0xd88b68){return{'action':_0x5e2111,'response':_0x2b8f59,'message':_0xd88b68,'stack':_0xd88b68};}function myreject(_0x36ef22){return function(_0x50eb30){return _0x36ef22(msgResponse(_0xe5eb('0x42'),_0xe5eb('0x43'),JSON['stringify'](_0x50eb30)));};}function getSeconds(_0x4e9113,_0x5e87c7){var _0x312881=moment(_0x4e9113)['milliseconds'](0x0);var _0x36c153=moment(_0x5e87c7)[_0xe5eb('0x44')](0x0);return _0x312881[_0xe5eb('0x45')](_0x36c153,'seconds');}function emit(_0x102a09,_0xf68ecc,_0x5ec7cb){io['to'](_0x102a09)[_0xe5eb('0x46')](_0xf68ecc,_0x5ec7cb);}function emitVoiceQueueSummary(_0x159a61){if(_0x159a61[_0xe5eb('0x47')]===_0xe5eb('0x48')){var _0x5d2bbe={'id':_0x159a61['id'],'name':_0x159a61[_0xe5eb('0x3a')],'strategy':_0x159a61[_0xe5eb('0x49')],'answered':_0x159a61[_0xe5eb('0x4a')],'available':_0x159a61[_0xe5eb('0x4b')],'loggedIn':_0x159a61[_0xe5eb('0x4c')],'pTalking':_0x159a61[_0xe5eb('0x4d')],'sumBillable':_0x159a61[_0xe5eb('0x4e')],'sumDuration':_0x159a61[_0xe5eb('0x4f')],'sumHoldTime':_0x159a61['sumHoldTime']||0x0,'talking':_0x159a61[_0xe5eb('0x50')],'total':_0x159a61['total'],'type':_0x159a61[_0xe5eb('0x47')],'unmanaged':_0x159a61[_0xe5eb('0x51')],'abandoned':_0x159a61[_0xe5eb('0x52')],'waiting':_0x159a61[_0xe5eb('0x53')],'loggedInDb':_0x159a61[_0xe5eb('0x54')],'dialActive':_0x159a61[_0xe5eb('0x55')],'dialMethod':_0x159a61[_0xe5eb('0x56')],'dialOriginateCallerIdName':_0x159a61[_0xe5eb('0x57')],'dialOriginateCallerIdNumber':_0x159a61['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x159a61[_0xe5eb('0x58')],'dialPrefix':_0x159a61[_0xe5eb('0x59')],'outboundAnswerAgiCallsDay':_0x159a61[_0xe5eb('0x5a')],'outboundAnswerCallsDay':_0x159a61[_0xe5eb('0x5b')],'outboundBlacklistCallsDay':_0x159a61['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x159a61[_0xe5eb('0x5c')],'outboundCongestionCallsDay':_0x159a61[_0xe5eb('0x5d')],'outboundDropCallsDayACS':_0x159a61[_0xe5eb('0x5e')],'outboundDropCallsDayCallersExit':_0x159a61[_0xe5eb('0x5f')],'outboundDropCallsDayTimeout':_0x159a61[_0xe5eb('0x60')],'outboundNoAnswerCallsDay':_0x159a61['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x159a61[_0xe5eb('0x61')],'outboundOriginateFailureCallsDay':_0x159a61[_0xe5eb('0x62')],'outboundReCallsDay':_0x159a61[_0xe5eb('0x63')],'outboundRejectCallsDay':_0x159a61[_0xe5eb('0x64')],'outboundUnknownCallsDay':_0x159a61[_0xe5eb('0x65')],'predictiveIntervalAnsweredCalls':_0x159a61[_0xe5eb('0x66')],'predictiveIntervalAvgHoldtime':_0x159a61[_0xe5eb('0x67')],'predictiveIntervalAvgTalktime':_0x159a61[_0xe5eb('0x68')],'predictiveIntervalDroppedCallsCallersExit':_0x159a61[_0xe5eb('0x69')],'predictiveIntervalDroppedCallsTimeout':_0x159a61[_0xe5eb('0x6a')],'predictiveIntervalErlangCalls':_0x159a61[_0xe5eb('0x6b')],'predictiveIntervalErlangCallsDroppedCalls':_0x159a61[_0xe5eb('0x6c')],'predictiveIntervalHitRate':_0x159a61[_0xe5eb('0x6d')],'predictiveIntervalMultiplicativeFactor':_0x159a61[_0xe5eb('0x6e')],'predictiveIntervalPauses':_0x159a61['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x159a61['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x159a61[_0xe5eb('0x6f')],'message':_0x159a61[_0xe5eb('0x39')],'originated':_0x159a61[_0xe5eb('0x70')],'erlangCalls':_0x159a61[_0xe5eb('0x71')],'erlangCallToSecond':_0x159a61['erlangCallToSecond'],'erlangAbandonmentRate':_0x159a61['erlangAbandonmentRate'],'erlangBusyFactor':_0x159a61[_0xe5eb('0x72')],'startPredictive':_0x159a61[_0xe5eb('0x73')],'startProgressive':_0x159a61['startProgressive']};if(_0x159a61[_0xe5eb('0x74')]){_0x5d2bbe[_0xe5eb('0x74')]={'id':_0x159a61[_0xe5eb('0x74')]['id'],'name':_0x159a61[_0xe5eb('0x74')][_0xe5eb('0x3a')],'active':_0x159a61['Trunk'][_0xe5eb('0x75')],'callerid':_0x159a61['Trunk'][_0xe5eb('0x76')]};}if(_0x159a61[_0xe5eb('0x40')]){_0x5d2bbe['Interval']={'id':_0x159a61['Interval']['id'],'name':_0x159a61[_0xe5eb('0x40')][_0xe5eb('0x3a')]};}var _0x32ee6e=md5(JSON[_0xe5eb('0x77')](_0x5d2bbe));if(_0x159a61[_0xe5eb('0x4')]!==_0x32ee6e){_0x159a61[_0xe5eb('0x4')]=_0x32ee6e;emit(util[_0xe5eb('0x78')](_0xe5eb('0x79'),_0x5d2bbe['name']),'voice_queue:save',_0x5d2bbe);}}}function emitCampaignSummary(_0x202048){if(_0x202048[_0xe5eb('0x47')]==='ivr'){emit(util[_0xe5eb('0x78')](_0xe5eb('0x7a'),_0x202048['name']),_0xe5eb('0x7b'),_0x202048);}}function checkGetDataPredictive(_0x135639){if(isNotNull(_0x135639)&&!_[_0xe5eb('0x7c')](_0x135639)){loggerPredictive[_0xe5eb('0x7d')](_0xe5eb('0x7e'));loggerPredictive[_0xe5eb('0x7d')](_0xe5eb('0x7f'),_0x135639[_0xe5eb('0x6f')]);loggerPredictive[_0xe5eb('0x7d')](_0xe5eb('0x80'),_0x135639[_0xe5eb('0x66')]);loggerPredictive['info'](_0xe5eb('0x81'),_0x135639[_0xe5eb('0x6a')]);loggerPredictive[_0xe5eb('0x7d')](_0xe5eb('0x82'),_0x135639[_0xe5eb('0x69')]);loggerPredictive[_0xe5eb('0x7d')](_0xe5eb('0x83'),_0x135639[_0xe5eb('0x67')]);loggerPredictive[_0xe5eb('0x7d')](_0xe5eb('0x84'),_0x135639[_0xe5eb('0x68')]);loggerPredictive[_0xe5eb('0x7d')]('---------------------------');if(_0x135639[_0xe5eb('0x6f')]>0x0){if(!_['isUndefined'](_0x135639['predictiveIntervalAvgTalktime'])&&_0x135639[_0xe5eb('0x68')]>0x0){return!![];}loggerPredictive[_0xe5eb('0x7d')](_0xe5eb('0x85'));if(!_[_0xe5eb('0x86')](_0x135639[_0xe5eb('0x67')])&&_0x135639['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0xe5eb('0x7d')](_0xe5eb('0x87'));}else{loggerPredictive[_0xe5eb('0x7d')](_0xe5eb('0x88'));}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x143b28){return function(_0x2befb8){loggerPredictive[_0xe5eb('0x7d')](_0xe5eb('0x89'));loggerPredictive[_0xe5eb('0x7d')](_0xe5eb('0x8a'),_0x2befb8['erlangCalls']);loggerPredictive[_0xe5eb('0x7d')](_0xe5eb('0x8b'),_0x2befb8[_0xe5eb('0x8c')]);loggerPredictive['info'](_0xe5eb('0x8d'),_0x2befb8['erlangAbandonmentRate']);loggerPredictive[_0xe5eb('0x7d')](_0xe5eb('0x8e'),_0x2befb8[_0xe5eb('0x72')]);loggerPredictive['info'](_0xe5eb('0x8d'),_0x2befb8[_0xe5eb('0x8f')]);loggerPredictive[_0xe5eb('0x7d')](_0xe5eb('0x90'));_[_0xe5eb('0x91')](_0x143b28,_0x2befb8);};}function getDiff(_0x317944){var _0x150641=moment()[_0xe5eb('0x44')](0x0);var _0x37f3dc=moment(_0x317944)[_0xe5eb('0x44')](0x0);return _0x150641[_0xe5eb('0x45')](_0x37f3dc,_0xe5eb('0x92'));}function ifInterval(_0x2fb8dc,_0x3ded3b){if(_['isUndefined'](_0x3ded3b)){return![];}return getDiff(_0x3ded3b)<_0x2fb8dc*0x3c;}function freeVariablesPredictive(_0x52dd77){if(isNotNull(_0x52dd77)){if(!_[_0xe5eb('0x86')](_0x52dd77[_0xe5eb('0x26')])){_0x52dd77[_0xe5eb('0x26')]=undefined;loggerPredictive[_0xe5eb('0x7d')](_0x52dd77[_0xe5eb('0x3a')],_0xe5eb('0x93'));}if(!_[_0xe5eb('0x86')](_0x52dd77[_0xe5eb('0x73')])){_0x52dd77[_0xe5eb('0x73')]=undefined;loggerPredictive[_0xe5eb('0x7d')](_0x52dd77[_0xe5eb('0x3a')],_0xe5eb('0x94'));}if(!_[_0xe5eb('0x86')](_0x52dd77[_0xe5eb('0x95')])){clearInterval(_0x52dd77['handlePredictive']);_0x52dd77[_0xe5eb('0x95')]=undefined;loggerPredictive[_0xe5eb('0x7d')](_0x52dd77[_0xe5eb('0x3a')],_0xe5eb('0x96'));}}}function erlangb(_0x4737aa,_0x510515){if(_0x510515===0x0){return 0x0;}var _0x1e776d=0x1;for(var _0x38363=0x1;_0x38363<=_0x510515;_0x38363+=0x1){_0x1e776d=0x1+_0x1e776d*_0x38363/_0x4737aa;}return 0x1/_0x1e776d;}function isVoiceQueueOutbound(_0x347871){return _0x347871===_0xe5eb('0x48');}function isNotPreview(_0x5d33a9){return _0x5d33a9!==_0xe5eb('0x97');}function isCampaignIvr(_0x1bc5df){return _0x1bc5df===_0xe5eb('0x98');}function getCallerId(_0x91dc57,_0x2979d0,_0x365b68){if(!_[_0xe5eb('0x86')](_0x365b68)&&typeof _0x365b68==='string'&&!_[_0xe5eb('0x7c')](_0x365b68)){if(!_[_0xe5eb('0x86')](_0x2979d0)&&typeof _0x2979d0===_0xe5eb('0x99')&&!_[_0xe5eb('0x7c')](_0x2979d0)){return util[_0xe5eb('0x78')]('\x22%s\x22\x20<%s>',_0x2979d0,_0x365b68);}return util['format'](_0xe5eb('0x9a'),_0x365b68,_0x365b68);}if(!_[_0xe5eb('0x86')](_0x91dc57)&&typeof _0x91dc57===_0xe5eb('0x99')&&!_[_0xe5eb('0x7c')](_0x91dc57)){return _0x91dc57;}return _0xe5eb('0x9b');}function loggerCatchQueueSummary(_0x4d07e3,_0x1f62e7){return function(_0x3ce106){freeVariablesPredictive(_0x1f62e7);emitVoiceQueueSummary(_0x1f62e7);emitCampaignSummary(_0x1f62e7);loggerSyncQueueSummary['error'](_0x4d07e3,util[_0xe5eb('0x9c')](_0x3ce106,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x38a4d2,_0x4ee967){return function(_0x403bd8){loggerPredictive['error'](_0x4ee967['name'],_0x38a4d2);loggerPredictive[_0xe5eb('0x9d')](_0x403bd8[_0xe5eb('0x9e')]);freeVariablesPredictive(_0x4ee967);};}function loggerCatch(_0x391881){return function(_0x1803e3){logger['error'](_0x391881,util[_0xe5eb('0x9c')](_0x1803e3,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x51ff8c){return _0x51ff8c&&!_[_0xe5eb('0x86')](_0x51ff8c)&&_0x51ff8c['length']>0x0;}function decremetOriginate(_0x3ee7e5){if(!_[_0xe5eb('0x86')](_0x3ee7e5)&&_0x3ee7e5!==null){if(typeof _0x3ee7e5[_0xe5eb('0x70')]!==_0xe5eb('0x9f')){if(_0x3ee7e5[_0xe5eb('0x70')]>0x0){_0x3ee7e5[_0xe5eb('0x70')]-=0x1;}else{logger['error']('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger['error']('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x2dc2b1,_0x1ec224,_0x4201a7){if(_0x1ec224>_0x4201a7){for(var _0x5789d3=0x0;_0x5789d3<_0x1ec224-_0x4201a7;_0x5789d3+=0x1){decremetOriginate(_0x2dc2b1);}}}function loggerGetContactDialer(_0x24a2f9,_0x1743a0,_0x4f9534){return function(_0x27d07e){checkContactLowerLimitOriginate(_0x1743a0,_0x4f9534,0x0);logger[_0xe5eb('0x9d')](_0x24a2f9,util[_0xe5eb('0x9c')](_0x27d07e,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x29a47a){return function(_0xc14de2){if(isNotNull(_0xc14de2)&&isNotNull(_0xc14de2[0x0])){if(_0xc14de2[0x0][_0xe5eb('0xa0')]>0x0){_0x29a47a[_0xe5eb('0x39')]=_0xe5eb('0xa1');logger[_0xe5eb('0x7d')](_0xe5eb('0xa2')+_0x29a47a[_0xe5eb('0x3a')],_0xc14de2[0x0]['contactsRescheduled'],_0xe5eb('0xa3'));}else{_0x29a47a[_0xe5eb('0x39')]=_0xe5eb('0xa4');logger['info'](_0xe5eb('0xa5')+_0x29a47a['name']);}}};}function notSendMessagesQueue(_0x4770ad){if(_0x4770ad['sendMessageOneNotActive']){freeVariablesPredictive(_0x4770ad);if(_0x4770ad[_0xe5eb('0x70')]===0x0&&_0x4770ad['talking']===0x0&&_0x4770ad[_0xe5eb('0x53')]===0x0&&(_0x4770ad[_0xe5eb('0x4d')]||0x0)===0x0){_0x4770ad['sendMessageOneNotActive']=![];_0x4770ad['available']=0x0;_0x4770ad[_0xe5eb('0x39')]='NOT_ACTIVE';loggerSyncQueueSummary[_0xe5eb('0x9d')](_0xe5eb('0xa6'),_0x4770ad['name'],_0xe5eb('0xa7'));}else{_0x4770ad['message']=_0xe5eb('0xa8');loggerSyncQueueSummary[_0xe5eb('0x9d')](_0xe5eb('0xa6'),_0x4770ad['name'],'is\x20disactive');}emitVoiceQueueSummary(_0x4770ad);}}function notSendMessagesCampaign(_0x56695d){if(_0x56695d[_0xe5eb('0xa9')]){if(_0x56695d[_0xe5eb('0x70')]===0x0){_0x56695d[_0xe5eb('0xa9')]=![];_0x56695d[_0xe5eb('0x39')]=_0xe5eb('0x3c');loggerSyncQueueSummary[_0xe5eb('0x9d')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x56695d[_0xe5eb('0x3a')],_0xe5eb('0xa7'));}else{_0x56695d[_0xe5eb('0x39')]=_0xe5eb('0xa8');loggerSyncQueueSummary[_0xe5eb('0x9d')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x56695d[_0xe5eb('0x3a')],_0xe5eb('0xaa'));}emitCampaignSummary(_0x56695d);}}function createObjHistory(_0x1f03b9,_0x418c4f,_0x689739,_0x1fdd5c,_0x54ad85){_0x1f03b9[_0xe5eb('0x39')]=_0x689739;var _0x4e8f5c=new Action(_0x1f03b9,_0x418c4f);var _0x477a11=new History(_0x4e8f5c);_0x477a11[_0xe5eb('0xab')]=_0x1fdd5c;_0x477a11[_0xe5eb('0xac')]=_0x54ad85;_0x477a11['endtime']=_0x4e8f5c[_0xe5eb('0xad')];return _0x477a11;}Dialer[_0xe5eb('0xae')][_0xe5eb('0x38')]=function(){var _0xad490a=this;setInterval(function(){_0xad490a[_0xe5eb('0xaf')](_0xad490a['uniqueId'],_0xe5eb('0xb0'));_0xad490a['clearZombieChannels'](_0xad490a[_0xe5eb('0x23')],_0xe5eb('0xb1'));},0x32c8);};Dialer[_0xe5eb('0xae')][_0xe5eb('0xaf')]=function(_0x2195d8,_0x14e459){var _0x5a29c5=this;for(var _0x59d76f in _0x2195d8){if(typeof _0x2195d8[_0x59d76f]!==_0xe5eb('0x9f')){this[_0xe5eb('0x1c')][_0xe5eb('0x1a')](function(){if(!_[_0xe5eb('0xb2')](_0x2195d8[_0x59d76f])){return ami[_0xe5eb('0xb3')]({'action':'status','channel':_0x2195d8[_0x59d76f][_0xe5eb('0xb4')]})['catch'](function(_0x2e337b){if(_0x2e337b[_0xe5eb('0x39')]===_0xe5eb('0xb5')){setTimeout(function(){if(_0x2195d8[_0x59d76f]&&_0x2195d8[_0x59d76f]['type']!==_0xe5eb('0x98')){_0x5a29c5['updateOriginated'](_0x5a29c5[_0xe5eb('0x1d')][_0x2195d8[_0x59d76f][_0xe5eb('0xb6')]]);logger[_0xe5eb('0x9d')](_0xe5eb('0xb7'),_0x14e459,_0x59d76f,_0x2195d8[_0x59d76f][_0xe5eb('0xb6')]);delete _0x2195d8[_0x59d76f];}if(_0x2195d8[_0x59d76f]&&_0x2195d8[_0x59d76f][_0xe5eb('0x47')]===_0xe5eb('0x98')){_0x5a29c5[_0xe5eb('0xb8')](_0x5a29c5[_0xe5eb('0x1e')][_0x2195d8[_0x59d76f][_0xe5eb('0xb6')]]);logger[_0xe5eb('0x9d')](_0xe5eb('0xb9'),_0x14e459,_0x59d76f,_0x2195d8[_0x59d76f]['queue']);delete _0x2195d8[_0x59d76f];}},0x2328);}});}});}}};Dialer[_0xe5eb('0xae')]['countReScheduled']=function(_0x5be8ee){return BPromise[_0xe5eb('0xba')]()['then'](cmHopper[_0xe5eb('0xbb')](_0x5be8ee))[_0xe5eb('0xbc')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0xe5eb('0xae')][_0xe5eb('0xbd')]=function(_0xf0d6b5){return BPromise[_0xe5eb('0xba')]()['then'](cmHopperBlack[_0xe5eb('0xbd')](_0xf0d6b5))[_0xe5eb('0xbc')](loggerCatch(_0xe5eb('0xbe')));};Dialer[_0xe5eb('0xae')]['checkIsBlackListIvr']=function(_0x1db388){return BPromise[_0xe5eb('0xba')]()[_0xe5eb('0xbf')](cmHopperBlack['checkIsBlackListIvr'](_0x1db388))['catch'](loggerCatch(_0xe5eb('0xc0')));};Dialer['prototype'][_0xe5eb('0xc1')]=function(_0x42d3e3){return BPromise[_0xe5eb('0xba')]()[_0xe5eb('0xbf')](cmHopperHistory[_0xe5eb('0xc2')](_0x42d3e3))[_0xe5eb('0xbc')](loggerCatch(_0xe5eb('0xc3')));};Dialer[_0xe5eb('0xae')][_0xe5eb('0xc4')]=function(_0x17a362){return BPromise[_0xe5eb('0xba')]()[_0xe5eb('0xbf')](cmHopper[_0xe5eb('0xc4')](_0x17a362))[_0xe5eb('0xbc')](loggerCatch(_0xe5eb('0xc5')));};Dialer[_0xe5eb('0xae')][_0xe5eb('0xc6')]=function(_0x3f4671,_0x48e6aa,_0x4202de){return BPromise['resolve']()[_0xe5eb('0xbf')](cmHopper[_0xe5eb('0xc6')](_0x3f4671,_0x48e6aa,_0x4202de))[_0xe5eb('0xbc')](loggerCatch(_0xe5eb('0xc7')));};Dialer[_0xe5eb('0xae')][_0xe5eb('0xc8')]=function(_0x1a7b43,_0x47ff09,_0x532a76,_0x5edc71,_0x47321a){return BPromise[_0xe5eb('0xba')]()[_0xe5eb('0xbf')](cmHopper[_0xe5eb('0xc8')](_0x1a7b43,_0x47ff09,_0x532a76,_0x5edc71))[_0xe5eb('0xbc')](function(_0x3ef116){_0x47321a[_0xe5eb('0xc9')]-=_0x532a76;_0x47321a[_0xe5eb('0xc9')]=_0x47321a['temp']>0x0?_0x47321a[_0xe5eb('0xc9')]:0x0;loggerCatch(_0xe5eb('0xca'))(_0x3ef116);});};Dialer[_0xe5eb('0xae')][_0xe5eb('0xcb')]=function(_0x236003,_0xd6bc7a,_0x5df5cd,_0x3d4ba5){return BPromise['resolve']()['then'](cmHopper[_0xe5eb('0xcb')](_0x236003,_0xd6bc7a,_0x5df5cd))[_0xe5eb('0xbc')](function(_0x2a066c){_0x3d4ba5[_0xe5eb('0xc9')]-=_0xd6bc7a;_0x3d4ba5['temp']=_0x3d4ba5['temp']>0x0?_0x3d4ba5[_0xe5eb('0xc9')]:0x0;loggerCatch(_0xe5eb('0xcc'))(_0x2a066c);});};Dialer[_0xe5eb('0xae')][_0xe5eb('0xcd')]=function(_0x45ffef){return BPromise['resolve']()[_0xe5eb('0xbf')](voiceQueueRt[_0xe5eb('0xcd')](_0x45ffef))['catch'](loggerCatch(_0xe5eb('0xce')));};Dialer[_0xe5eb('0xae')][_0xe5eb('0xcf')]=function(_0x29050f){return BPromise[_0xe5eb('0xba')]()[_0xe5eb('0xbf')](cmHopper['moveContactManagedDialer'](_0x29050f))[_0xe5eb('0xbc')](loggerCatch(_0xe5eb('0xd0')));};Dialer[_0xe5eb('0xae')][_0xe5eb('0xd1')]=function(_0x394d03){return BPromise[_0xe5eb('0xba')]()[_0xe5eb('0xbf')](cmHopperHistory['createHistory'](_0x394d03))[_0xe5eb('0xbc')](loggerCatch(_0xe5eb('0xd2')));};Dialer[_0xe5eb('0xae')][_0xe5eb('0xb8')]=function(_0x2d8d0c){if(!_[_0xe5eb('0x86')](_0x2d8d0c)&&_0x2d8d0c!==null){if(typeof _0x2d8d0c[_0xe5eb('0x70')]!==_0xe5eb('0x9f')){if(_0x2d8d0c[_0xe5eb('0x70')]>0x0){_0x2d8d0c[_0xe5eb('0x70')]-=0x1;}else{logger[_0xe5eb('0x9d')](_0xe5eb('0xd3'));}}}else{logger[_0xe5eb('0x9d')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xe5eb('0xae')][_0xe5eb('0xd4')]=function(_0x5c9274,_0x5d8e2c){var _0xff1e59=this;return function(_0x20cba3){_0xff1e59[_0xe5eb('0xb8')](_0x5d8e2c);logger[_0xe5eb('0x9d')](_0x5c9274,util[_0xe5eb('0x9c')](_0x20cba3,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0xe5eb('0xd5')]=function(_0x4969a2,_0x138eab,_0x1d9b50){var _0x5e5539={'state':0x19,'statedesc':_0xe5eb('0xd6')};this[_0xe5eb('0xb8')](_0x138eab);this[_0xe5eb('0xd7')](_[_0xe5eb('0x91')](_0x5e5539,_[_0xe5eb('0xd8')](_0x1d9b50,[_0xe5eb('0xd9'),_0xe5eb('0xda'),'UserId',_0xe5eb('0xdb'),_0xe5eb('0xdc')])),'[emptyContact][createHistory]','[emptyContact]');logger['error'](_0x4969a2);};Dialer[_0xe5eb('0xae')][_0xe5eb('0xdd')]=function(_0x4d0cf0){return _0x4d0cf0===_0xe5eb('0xde');};Dialer[_0xe5eb('0xae')][_0xe5eb('0xdf')]=function(_0x41402c){return!_[_0xe5eb('0x86')](_0x41402c)&&_0x41402c&&!_[_0xe5eb('0x86')](_0x41402c['name'])&&!_[_0xe5eb('0x86')](_0x41402c[_0xe5eb('0x75')])&&_0x41402c[_0xe5eb('0x75')]&&(this['trunks'][util[_0xe5eb('0x78')](_0xe5eb('0xe0'),_0x41402c[_0xe5eb('0x3a')])]['status']===_0xe5eb('0xe1')||this[_0xe5eb('0x20')][util[_0xe5eb('0x78')](_0xe5eb('0xe0'),_0x41402c['name'])][_0xe5eb('0xe2')]===_0xe5eb('0xe3'));};Dialer[_0xe5eb('0xae')]['saveInDb']=function(_0x4d4831,_0xc4ece6,_0xb72dc8){this[_0xe5eb('0xd1')](_0x4d4831)[_0xe5eb('0xbc')](loggerCatch(_0xc4ece6));this[_0xe5eb('0xcf')](_0x4d4831)[_0xe5eb('0xbc')](loggerCatch(_0xb72dc8));};Dialer['prototype'][_0xe5eb('0x35')]=function(_0x2d80af){var _0x226388=this['uniqueId'][_0x2d80af[_0xe5eb('0xe4')]];var _0x5b2431;if(!_[_0xe5eb('0xb2')](_0x2d80af)&&!_['isNil'](_0x2d80af[_0xe5eb('0xe5')])&&!_['isNil'](_0x2d80af[_0xe5eb('0xe5')]['amdstatus'])&&_0x2d80af[_0xe5eb('0xe6')]==='xcally-motion-dialer'&&_0x226388){if(_0x226388['type']!==_0xe5eb('0x98')&&this[_0xe5eb('0x1d')][_0x226388[_0xe5eb('0xb6')]]['dialAMDActive']&&_0x2d80af['value']==='HANGUP'){delete this[_0xe5eb('0x25')][_0x2d80af[_0xe5eb('0xe4')]];this['updateOriginated'](this['voiceQueues'][_0x226388[_0xe5eb('0xb6')]]);this[_0xe5eb('0x1d')][_0x226388[_0xe5eb('0xb6')]][_0xe5eb('0x5b')]+=0x1;this[_0xe5eb('0x1d')][_0x226388[_0xe5eb('0xb6')]][_0xe5eb('0x5a')]+=0x1;_0x5b2431=new Hangup(_0x226388,_0x2d80af);_0x5b2431[_0xe5eb('0xab')]=0x12;_0x5b2431['statedesc']='HangupInAMD';_0x5b2431['membername']=_0xe5eb('0xe7');ami[_0xe5eb('0x46')](_0xe5eb('0xe8'),ut[_0xe5eb('0xe9')](_0x5b2431,_0xe5eb('0xea')));this['saveInDb'](_0x5b2431,_0xe5eb('0xeb'),'[syncHangupInAMD]');}if(_0x226388[_0xe5eb('0x47')]!==_0xe5eb('0x98')&&this[_0xe5eb('0x1d')][_0x226388[_0xe5eb('0xb6')]][_0xe5eb('0xec')]&&_0x2d80af[_0xe5eb('0xed')]===_0xe5eb('0xee')){var _0x5ebd4e=this;return new BPromise(function(_0x2e9201,_0x5b3912){delete _0x5ebd4e[_0xe5eb('0x25')][_0x2d80af[_0xe5eb('0xe4')]];_0x5ebd4e[_0xe5eb('0xb8')](_0x5ebd4e[_0xe5eb('0x1d')][_0x226388[_0xe5eb('0xb6')]]);_0x5ebd4e['voiceQueues'][_0x226388[_0xe5eb('0xb6')]][_0xe5eb('0x5b')]+=0x1;_0x5ebd4e['voiceQueues'][_0x226388[_0xe5eb('0xb6')]][_0xe5eb('0x5a')]+=0x1;var _0x47ab27=_0x5ebd4e['voiceQueues'][_0x226388[_0xe5eb('0xb6')]];var _0x50fefa=new Hangup(_0x226388,_0x2d80af);_0x50fefa[_0xe5eb('0xab')]=0x13;_0x50fefa[_0xe5eb('0xac')]='Machine';_0x50fefa[_0xe5eb('0xef')]=_0xe5eb('0xe7');_0x50fefa[_0xe5eb('0xf0')]+=0x1;_0x50fefa['countglobal']+=0x1;_0x50fefa[_0xe5eb('0xea')]=!![];ami['emit']('custom:amd',ut[_0xe5eb('0xe9')](_0x50fefa,'amd'));_0x5ebd4e[_0xe5eb('0xd1')](_0x50fefa)[_0xe5eb('0xbc')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x50fefa['countbusyretry']+_0x50fefa[_0xe5eb('0xf1')]+_0x50fefa['countnoanswerretry']+_0x50fefa['countnosuchnumberretry']+_0x50fefa['countdropretry']+_0x50fefa[_0xe5eb('0xf2')]+_0x50fefa[_0xe5eb('0xf0')]+_0x50fefa[_0xe5eb('0xf3')]>=_0x47ab27[_0xe5eb('0xf4')]){_0x5ebd4e[_0xe5eb('0xf5')](_0x50fefa,_0x2e9201,_0x5b3912,'reason19\x20machine....');}else{if(_0x50fefa[_0xe5eb('0xf0')]>=_0x47ab27[_0xe5eb('0xf6')]){_0x5ebd4e[_0xe5eb('0xf7')](_0x50fefa,_0x2e9201,_0x5b3912,'reason\x2019\x20machine....');}else{_0x5ebd4e['rescheduleContact']({'active':![],'countmachineretry':_0x50fefa[_0xe5eb('0xf0')],'scheduledat':moment()[_0xe5eb('0xf8')](_0x47ab27[_0xe5eb('0xf9')],_0xe5eb('0xfa'))['format'](_0xe5eb('0xfb')),'ContactId':_0x50fefa[_0xe5eb('0xd9')],'ListId':_0x50fefa[_0xe5eb('0xda')],'VoiceQueueId':_0x50fefa[_0xe5eb('0xdb')]||undefined,'CampaignId':_0x50fefa[_0xe5eb('0xdc')]||undefined})['catch'](loggerCatch(_0xe5eb('0xfc')));_0x2e9201({'reschedule':0x1});}}});}if(_0x226388[_0xe5eb('0x47')]===_0xe5eb('0x98')&&this[_0xe5eb('0x1e')][_0x226388['queue']][_0xe5eb('0xec')]&&_0x2d80af['value']==='HANGUP'){delete this[_0xe5eb('0x25')][_0x2d80af['uniqueid']];this['updateOriginated'](this[_0xe5eb('0x1e')][_0x226388[_0xe5eb('0xb6')]]);_0x5b2431=new Hangup(_0x226388,_0x2d80af);_0x5b2431[_0xe5eb('0xab')]=0x12;_0x5b2431[_0xe5eb('0xac')]='HangupInAMD';_0x5b2431[_0xe5eb('0xef')]='AMD';ami[_0xe5eb('0x46')](_0xe5eb('0xe8'),ut[_0xe5eb('0xe9')](_0x5b2431,_0xe5eb('0xea')));this[_0xe5eb('0xd7')](_0x5b2431,'[syncHangupInAMDIvr][createHistory]',_0xe5eb('0xfd'));}if(_0x226388[_0xe5eb('0x47')]==='ivr'&&this[_0xe5eb('0x1e')][_0x226388[_0xe5eb('0xb6')]][_0xe5eb('0xec')]&&_0x2d80af[_0xe5eb('0xed')]==='MACHINE'){var _0x5ebd4e=this;return new BPromise(function(_0x5a06d1,_0x5af159){delete _0x5ebd4e[_0xe5eb('0x25')][_0x2d80af[_0xe5eb('0xe4')]];_0x5ebd4e[_0xe5eb('0xb8')](_0x5ebd4e[_0xe5eb('0x1e')][_0x226388[_0xe5eb('0xb6')]]);_0x5ebd4e[_0xe5eb('0x1e')][_0x226388[_0xe5eb('0xb6')]]['outboundAnswerCallsDay']+=0x1;_0x5ebd4e[_0xe5eb('0x1e')][_0x226388['queue']][_0xe5eb('0x5a')]+=0x1;var _0x1a9cb3=_0x5ebd4e['campaigns'][_0x226388[_0xe5eb('0xb6')]];var _0x44d438=new Hangup(_0x226388,_0x2d80af);_0x44d438[_0xe5eb('0xab')]=0x13;_0x44d438['statedesc']=_0xe5eb('0xfe');_0x44d438['membername']='AMD';_0x44d438['countmachineretry']+=0x1;_0x44d438[_0xe5eb('0xff')]+=0x1;_0x44d438[_0xe5eb('0xea')]=!![];ami[_0xe5eb('0x46')](_0xe5eb('0xe8'),ut[_0xe5eb('0xe9')](_0x44d438,'amd'));_0x5ebd4e[_0xe5eb('0xd1')](_0x44d438)[_0xe5eb('0xbc')](loggerCatch(_0xe5eb('0x100')));if(_0x44d438[_0xe5eb('0x101')]+_0x44d438[_0xe5eb('0xf1')]+_0x44d438[_0xe5eb('0x102')]+_0x44d438[_0xe5eb('0x103')]+_0x44d438[_0xe5eb('0x104')]+_0x44d438[_0xe5eb('0xf2')]+_0x44d438['countmachineretry']+_0x44d438[_0xe5eb('0xf3')]>=_0x1a9cb3[_0xe5eb('0xf4')]){_0x5ebd4e['stateGlobal'](_0x44d438,_0x5a06d1,_0x5af159,_0xe5eb('0x105'));}else{if(_0x44d438[_0xe5eb('0xf0')]>=_0x1a9cb3[_0xe5eb('0xf6')]){_0x5ebd4e[_0xe5eb('0xf7')](_0x44d438,_0x5a06d1,_0x5af159,_0xe5eb('0x106'));}else{_0x5ebd4e[_0xe5eb('0xc4')]({'active':![],'countmachineretry':_0x44d438['countmachineretry'],'scheduledat':moment()[_0xe5eb('0xf8')](_0x1a9cb3['dialMachineRetryFrequency'],_0xe5eb('0xfa'))['format'](_0xe5eb('0xfb')),'ContactId':_0x44d438['ContactId'],'ListId':_0x44d438[_0xe5eb('0xda')],'VoiceQueueId':_0x44d438['VoiceQueueId']||undefined,'CampaignId':_0x44d438[_0xe5eb('0xdc')]||undefined})[_0xe5eb('0xbc')](loggerCatch('[rescheduleContact][Machine]'));_0x5a06d1({'reschedule':0x1});}}});}}};Dialer[_0xe5eb('0xae')][_0xe5eb('0x32')]=function(_0x31733a){var _0x3ae767=this[_0xe5eb('0x25')][_0x31733a[_0xe5eb('0xe4')]];var _0x3366cc=this;var _0x391f9e;if(_0x3ae767&&_0x3ae767[_0xe5eb('0x47')]==='ivr'){delete this[_0xe5eb('0x25')][_0x31733a[_0xe5eb('0xe4')]];this[_0xe5eb('0xb8')](this[_0xe5eb('0x1e')][_0x3ae767[_0xe5eb('0xb6')]]);this['campaigns'][_0x3ae767[_0xe5eb('0xb6')]]['ivrAnswerCallsDay']+=0x1;_0x391f9e=new Hangup(_0x3ae767,_0x31733a);this[_0xe5eb('0xd1')](_0x391f9e)[_0xe5eb('0xbc')](loggerCatch(_0xe5eb('0x107')));this['moveContactManagedDialer'](_0x391f9e)[_0xe5eb('0xbc')](loggerCatch(_0xe5eb('0x108')));}if(_0x3ae767&&_0x3ae767['type']!=='ivr'&&isNotNull(this['voiceQueues'][_0x3ae767[_0xe5eb('0xb6')]][_0xe5eb('0x109')])){delete this[_0xe5eb('0x25')][_0x31733a[_0xe5eb('0xe4')]];this[_0xe5eb('0xb8')](this[_0xe5eb('0x1d')][_0x3ae767[_0xe5eb('0xb6')]]);this[_0xe5eb('0x1d')][_0x3ae767[_0xe5eb('0xb6')]][_0xe5eb('0x5b')]+=0x1;this[_0xe5eb('0x1d')][_0x3ae767[_0xe5eb('0xb6')]][_0xe5eb('0x5a')]+=0x1;_0x391f9e=new Hangup(_0x3ae767,_0x31733a);_0x391f9e[_0xe5eb('0xab')]=0x10;_0x391f9e[_0xe5eb('0xac')]=_0xe5eb('0x10a');_0x391f9e[_0xe5eb('0xef')]=_0xe5eb('0x10b');this[_0xe5eb('0xd1')](_0x391f9e)[_0xe5eb('0xbc')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xe5eb('0xcf')](_0x391f9e)[_0xe5eb('0xbc')](loggerCatch(_0xe5eb('0x108')));}if(_0x3ae767&&_0x3ae767['type']!=='ivr'&&!isNotNull(this['voiceQueues'][_0x3ae767[_0xe5eb('0xb6')]]['dialQueueProject'])){delete this[_0xe5eb('0x25')][_0x31733a[_0xe5eb('0xe4')]];this[_0xe5eb('0xb8')](this[_0xe5eb('0x1d')][_0x3ae767['queue']]);this[_0xe5eb('0x1d')][_0x3ae767[_0xe5eb('0xb6')]][_0xe5eb('0x65')]+=0x1;_0x391f9e=new Hangup(_0x3ae767,_0x31733a);_0x391f9e[_0xe5eb('0xab')]=0xc;_0x391f9e['statedesc']=_0x31733a['cause-txt'];_0x391f9e[_0xe5eb('0xef')]=_0xe5eb('0x10c');this[_0xe5eb('0xd1')](_0x391f9e)[_0xe5eb('0xbc')](loggerCatch(_0xe5eb('0x107')));this['moveContactManagedDialer'](_0x391f9e)[_0xe5eb('0xbc')](loggerCatch(_0xe5eb('0x108')));}};Dialer[_0xe5eb('0xae')][_0xe5eb('0x2f')]=function(_0x8a8f2d){var _0x3f6951=this['uniqueId'][_0x8a8f2d[_0xe5eb('0xe4')]];var _0x2effe5=this;if(this[_0xe5eb('0x1d')][_0x8a8f2d[_0xe5eb('0xb6')]]){if(_0x3f6951&&_0x3f6951[_0xe5eb('0x47')]!==_0xe5eb('0x98')){delete this['uniqueId'][_0x8a8f2d[_0xe5eb('0xe4')]];this['voiceQueues'][_0x8a8f2d[_0xe5eb('0xb6')]][_0xe5eb('0x5b')]+=0x1;var _0x46a3d4=new AgentComplete(_0x3f6951,_0x8a8f2d);if(_0x8a8f2d[_0xe5eb('0x10d')]==='agent'){_0x46a3d4[_0xe5eb('0x10e')]=this[_0xe5eb('0x1d')][_0x8a8f2d[_0xe5eb('0xb6')]][_0xe5eb('0x10f')]&&this[_0xe5eb('0x1d')][_0x8a8f2d[_0xe5eb('0xb6')]]['dialAgiAfterHangupAgent']?moment()[_0xe5eb('0x78')](_0xe5eb('0xfb')):undefined;}this['createHistory'](_0x46a3d4)[_0xe5eb('0xbc')](loggerCatch(_0xe5eb('0x110')));this['moveContactManagedDialer'](_0x46a3d4)[_0xe5eb('0xbc')](loggerCatch(_0xe5eb('0x111')));}}};Dialer[_0xe5eb('0xae')]['syncAgentConnect']=function(_0x26f9a2){if(this[_0xe5eb('0x1d')][_0x26f9a2['queue']]){if(this[_0xe5eb('0x25')][_0x26f9a2['uniqueid']]&&this['uniqueId'][_0x26f9a2[_0xe5eb('0xe4')]]['type']!==_0xe5eb('0x98')){this[_0xe5eb('0xb8')](this['voiceQueues'][_0x26f9a2[_0xe5eb('0xb6')]]);this['uniqueId'][_0x26f9a2['uniqueid']][_0xe5eb('0x112')]=moment()[_0xe5eb('0x78')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xe5eb('0xae')]['queueCallerAbandonCreateState']=function(_0x253a21){this[_0xe5eb('0xd1')](_0x253a21)['catch'](loggerCatch(_0xe5eb('0x110')));this[_0xe5eb('0xcf')](_0x253a21)['catch'](loggerCatch(_0xe5eb('0x113')));};Dialer['prototype']['syncQueueCallerAbandon']=function(_0x1374a6){var _0x5bdff8=this[_0xe5eb('0x25')][_0x1374a6[_0xe5eb('0xe4')]];var _0x1a5c24=this;if(this[_0xe5eb('0x1d')][_0x1374a6['queue']]){if(_0x5bdff8&&_0x5bdff8[_0xe5eb('0x47')]!=='ivr'){delete this['uniqueId'][_0x1374a6[_0xe5eb('0xe4')]];this[_0xe5eb('0xb8')](this[_0xe5eb('0x1d')][_0x1374a6[_0xe5eb('0xb6')]]);_0x5bdff8[_0xe5eb('0x114')]=moment()[_0xe5eb('0x78')](_0xe5eb('0xfb'));var _0x5558cf=new QueueCallerAbandon(_0x5bdff8,_0x1374a6);if(getSeconds(_0x5bdff8[_0xe5eb('0x114')],_0x5bdff8[_0xe5eb('0x115')])>=_0x5bdff8[_0xe5eb('0x116')]){this[_0xe5eb('0x1d')][_0x1374a6[_0xe5eb('0xb6')]][_0xe5eb('0x6a')]+=0x1;this[_0xe5eb('0x1d')][_0x1374a6[_0xe5eb('0xb6')]][_0xe5eb('0x60')]+=0x1;this[_0xe5eb('0x1d')][_0x1374a6[_0xe5eb('0xb6')]][_0xe5eb('0x6c')]+=0x1;_0x5558cf['state']=0xa;_0x5558cf['statedesc']=_0xe5eb('0x117');_0x5558cf[_0xe5eb('0x118')]=_0xe5eb('0x119');_0x5558cf[_0xe5eb('0x10e')]=this[_0xe5eb('0x1d')][_0x1374a6[_0xe5eb('0xb6')]][_0xe5eb('0x10f')]?moment()[_0xe5eb('0x78')](_0xe5eb('0xfb')):undefined;_0x5558cf[_0xe5eb('0x104')]+=0x1;_0x5558cf[_0xe5eb('0xff')]+=0x1;if(_0x5558cf[_0xe5eb('0x104')]>=this[_0xe5eb('0x1d')][_0x1374a6['queue']][_0xe5eb('0x11a')]){this[_0xe5eb('0x11b')](_0x5558cf);}else{this[_0xe5eb('0xc4')]({'active':![],'countdropretry':_0x5558cf[_0xe5eb('0x104')],'scheduledat':moment()[_0xe5eb('0xf8')](this[_0xe5eb('0x1d')][_0x1374a6['queue']][_0xe5eb('0x11c')],_0xe5eb('0xfa'))[_0xe5eb('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5bdff8[_0xe5eb('0xd9')],'ListId':_0x5bdff8['ListId'],'VoiceQueueId':_0x5bdff8[_0xe5eb('0xdb')]||undefined,'CampaignId':_0x5bdff8['CampaignId']||undefined})[_0xe5eb('0xbc')](loggerCatch('[rescheduleContact][Drop]'));var _0x44e9b3=new History(_0x5558cf);_0x44e9b3[_0xe5eb('0xab')]=0xa;_0x44e9b3[_0xe5eb('0xac')]=_0xe5eb('0x117');_0x44e9b3['starttime']=moment()[_0xe5eb('0x78')](_0xe5eb('0xfb'));_0x44e9b3[_0xe5eb('0x11d')]=_0x44e9b3[_0xe5eb('0xad')];_0x44e9b3[_0xe5eb('0x11e')]=_0x5558cf[_0xe5eb('0x11e')];_0x44e9b3[_0xe5eb('0x11f')]=_0x5558cf['calleridnum'];this['createHistory'](_0x44e9b3)['catch'](loggerCatch(_0xe5eb('0x120')));}}else{this['voiceQueues'][_0x1374a6[_0xe5eb('0xb6')]][_0xe5eb('0x69')]+=0x1;this[_0xe5eb('0x1d')][_0x1374a6[_0xe5eb('0xb6')]][_0xe5eb('0x5f')]+=0x1;_0x5558cf[_0xe5eb('0xab')]=0xb;_0x5558cf[_0xe5eb('0xac')]=_0xe5eb('0x121');_0x5558cf[_0xe5eb('0x118')]='CALLEREXIT';_0x5558cf[_0xe5eb('0xf2')]+=0x1;_0x5558cf['countglobal']+=0x1;if(_0x5558cf[_0xe5eb('0xf2')]>=this[_0xe5eb('0x1d')][_0x1374a6[_0xe5eb('0xb6')]][_0xe5eb('0x122')]){this[_0xe5eb('0x11b')](_0x5558cf);}else{this[_0xe5eb('0xc4')]({'active':![],'countabandonedretry':_0x5558cf[_0xe5eb('0xf2')],'scheduledat':moment()[_0xe5eb('0xf8')](this[_0xe5eb('0x1d')][_0x1374a6[_0xe5eb('0xb6')]][_0xe5eb('0x123')],_0xe5eb('0xfa'))[_0xe5eb('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5bdff8[_0xe5eb('0xd9')],'ListId':_0x5bdff8[_0xe5eb('0xda')],'VoiceQueueId':_0x5bdff8[_0xe5eb('0xdb')]||undefined,'CampaignId':_0x5bdff8[_0xe5eb('0xdc')]||undefined})[_0xe5eb('0xbc')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x44e9b3=new History(_0x5558cf);_0x44e9b3[_0xe5eb('0xab')]=0xb;_0x44e9b3['statedesc']=_0xe5eb('0x121');_0x44e9b3['starttime']=moment()[_0xe5eb('0x78')](_0xe5eb('0xfb'));_0x44e9b3[_0xe5eb('0x11d')]=_0x44e9b3['starttime'];_0x44e9b3[_0xe5eb('0x11e')]=_0x5558cf[_0xe5eb('0x11e')];_0x44e9b3[_0xe5eb('0x11f')]=_0x5558cf[_0xe5eb('0x11f')];this[_0xe5eb('0xd1')](_0x44e9b3)[_0xe5eb('0xbc')](loggerCatch(_0xe5eb('0x124')));}}}}};Dialer['prototype']['syncNewExten']=function(_0x808b65){if(this[_0xe5eb('0x23')][_0x808b65['uniqueid']]){this[_0xe5eb('0x23')][_0x808b65['uniqueid']]['channel']=_0x808b65[_0xe5eb('0xb4')];}if(this['uniqueId'][_0x808b65['uniqueid']]){this[_0xe5eb('0x25')][_0x808b65['uniqueid']][_0xe5eb('0xb4')]=_0x808b65[_0xe5eb('0xb4')];}};Dialer[_0xe5eb('0xae')][_0xe5eb('0x37')]=function(_0x2d0b6e){if(strategy[this['voiceQueues'][this[_0xe5eb('0x23')][_0x2d0b6e[_0xe5eb('0x125')]][_0xe5eb('0xb6')]][_0xe5eb('0x49')]]===_0xe5eb('0x19')){if(this[_0xe5eb('0x23')][_0x2d0b6e[_0xe5eb('0x125')]]&&_[_0xe5eb('0xb2')](this[_0xe5eb('0x23')][_0x2d0b6e['actionid']][_0xe5eb('0x126')])&&_0x2d0b6e[_0xe5eb('0xe2')]==='1'&&_0x2d0b6e['paused']==='0'){if(this[_0xe5eb('0x1f')][_0x2d0b6e[_0xe5eb('0x127')]]){if(!this[_0xe5eb('0x1f')][_0x2d0b6e[_0xe5eb('0x127')]]['locked']){this[_0xe5eb('0x1f')][_0x2d0b6e['stateinterface']][_0xe5eb('0x126')]=!![];this[_0xe5eb('0x23')][_0x2d0b6e[_0xe5eb('0x125')]][_0xe5eb('0x126')]=!![];this[_0xe5eb('0x23')][_0x2d0b6e[_0xe5eb('0x125')]]['stateinterface']=_0x2d0b6e[_0xe5eb('0x127')];}}}}else if((strategy[this['voiceQueues'][this[_0xe5eb('0x23')][_0x2d0b6e[_0xe5eb('0x125')]][_0xe5eb('0xb6')]][_0xe5eb('0x49')]]||_0xe5eb('0x18'))===_0xe5eb('0x18')){if(this[_0xe5eb('0x23')][_0x2d0b6e[_0xe5eb('0x125')]]){if(this[_0xe5eb('0x1f')][_0x2d0b6e['stateinterface']]){this[_0xe5eb('0x23')][_0x2d0b6e['actionid']][_0xe5eb('0x127')]=_0x2d0b6e[_0xe5eb('0x127')];if(_['isNil'](this['queueBooked'][this[_0xe5eb('0x23')][_0x2d0b6e[_0xe5eb('0x125')]][_0xe5eb('0xb6')]])){this[_0xe5eb('0x27')][this[_0xe5eb('0x23')][_0x2d0b6e[_0xe5eb('0x125')]][_0xe5eb('0xb6')]]=[];}this[_0xe5eb('0x27')][this[_0xe5eb('0x23')][_0x2d0b6e['actionid']][_0xe5eb('0xb6')]][_0xe5eb('0x128')](_[_0xe5eb('0x91')](_[_0xe5eb('0xd8')](this[_0xe5eb('0x23')][_0x2d0b6e['actionid']],[_0xe5eb('0x129'),'stateinterface']),{'status':_0x2d0b6e['status'],'paused':_0x2d0b6e[_0xe5eb('0x12a')]}));}}}};function unlockQueueStatus(_0x38f841,_0x395121){setTimeout(function(){if(_[_0xe5eb('0x86')](_0x38f841[_0xe5eb('0x12b')])){loggerBooked[_0xe5eb('0x9d')](_0xe5eb('0x12c'),_0x395121);}_0x38f841['queueStatusComplete']=!![];loggerBooked[_0xe5eb('0x7d')]('[booked][unlockQueueStatus]',_0x395121,JSON['stringify'](_[_0xe5eb('0xd8')](_0x38f841,[_0xe5eb('0x3a'),'queueStatusComplete'])));},0x1f3);}Dialer[_0xe5eb('0xae')][_0xe5eb('0x12d')]=function(_0xf430a8){var _0x2b5384=this;var _0x1dab2d=_0x2b5384['voiceQueues'][_0x2b5384[_0xe5eb('0x23')][_0xf430a8[_0xe5eb('0x125')]][_0xe5eb('0xb6')]];if(strategy[this[_0xe5eb('0x1d')][this['actions'][_0xf430a8[_0xe5eb('0x125')]][_0xe5eb('0xb6')]][_0xe5eb('0x49')]]==='roundrobin'){if(this['actions'][_0xf430a8[_0xe5eb('0x125')]]&&this['actions'][_0xf430a8['actionid']][_0xe5eb('0x127')]){this[_0xe5eb('0x97')][_0xe5eb('0x12e')](this[_0xe5eb('0x23')][_0xf430a8[_0xe5eb('0x125')]][_0xe5eb('0x129')],this[_0xe5eb('0x23')][_0xf430a8[_0xe5eb('0x125')]][_0xe5eb('0x127')])[_0xe5eb('0xbc')](function(_0x1ae425){logger[_0xe5eb('0x9d')](_0xe5eb('0x12f'),util['inspect'](_0x1ae425,{'showHidden':![],'depth':null}));})[_0xe5eb('0x130')](function(){_0x2b5384['updateOriginated'](_0x2b5384[_0xe5eb('0x1d')][_0x2b5384[_0xe5eb('0x23')][_0xf430a8['actionid']][_0xe5eb('0xb6')]]);_0x2b5384[_0xe5eb('0x1f')][_0x2b5384['actions'][_0xf430a8[_0xe5eb('0x125')]]['stateinterface']]['locked']=![];delete _0x2b5384[_0xe5eb('0x23')][_0xf430a8['actionid']];unlockQueueStatus(_0x1dab2d);});}else{this[_0xe5eb('0xb8')](this[_0xe5eb('0x1d')][this[_0xe5eb('0x23')][_0xf430a8['actionid']][_0xe5eb('0xb6')]]);this[_0xe5eb('0xc4')]({'active':![],'ContactId':this['actions'][_0xf430a8[_0xe5eb('0x125')]][_0xe5eb('0xd9')],'ListId':this[_0xe5eb('0x23')][_0xf430a8['actionid']][_0xe5eb('0xda')],'VoiceQueueId':this['actions'][_0xf430a8[_0xe5eb('0x125')]]['VoiceQueueId']||undefined,'CampaignId':this[_0xe5eb('0x23')][_0xf430a8[_0xe5eb('0x125')]][_0xe5eb('0xdc')]||undefined})[_0xe5eb('0xbc')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xe5eb('0x23')][_0xf430a8[_0xe5eb('0x125')]];unlockQueueStatus(_0x1dab2d);}}else if((strategy[this['voiceQueues'][this['actions'][_0xf430a8[_0xe5eb('0x125')]]['queue']][_0xe5eb('0x49')]]||_0xe5eb('0x18'))==='rrmemory'){var _0xdd41d;if(this[_0xe5eb('0x23')][_0xf430a8[_0xe5eb('0x125')]]&&!_['isEmpty'](this['queueBooked'][this['actions'][_0xf430a8[_0xe5eb('0x125')]][_0xe5eb('0xb6')]])){if(this[_0xe5eb('0x28')][_0x2b5384[_0xe5eb('0x23')][_0xf430a8[_0xe5eb('0x125')]][_0xe5eb('0xb6')]]){this['queueBookedRR'][_0x2b5384[_0xe5eb('0x23')][_0xf430a8[_0xe5eb('0x125')]][_0xe5eb('0xb6')]]=this['queueBookedRR'][this[_0xe5eb('0x23')][_0xf430a8[_0xe5eb('0x125')]][_0xe5eb('0xb6')]]?this[_0xe5eb('0x28')][this[_0xe5eb('0x23')][_0xf430a8['actionid']][_0xe5eb('0xb6')]]:this[_0xe5eb('0x27')][this[_0xe5eb('0x23')][_0xf430a8['actionid']][_0xe5eb('0xb6')]]?this[_0xe5eb('0x27')][this[_0xe5eb('0x23')][_0xf430a8[_0xe5eb('0x125')]][_0xe5eb('0xb6')]][_0xe5eb('0x131')]||0x0:0x0;}this['queueBooked'][this[_0xe5eb('0x23')][_0xf430a8['actionid']][_0xe5eb('0xb6')]][_0xe5eb('0x131')]=this['queueBookedRR'][this[_0xe5eb('0x23')][_0xf430a8[_0xe5eb('0x125')]][_0xe5eb('0xb6')]];for(var _0x268ef2=0x0;_0x268ef2=0x0;})['catch'](myreject(_0x450f0c)));}}else{_0x3f358b['push'](ami['Action']({'action':'command','command':util[_0xe5eb('0x78')](_0xe5eb('0x148'),_0x4a4b2e,!_[_0xe5eb('0x86')](config['timezones'][_0x1d9186])?_0x1d9186:'')})[_0xe5eb('0xbf')](function(_0xa4ac70){return _0xa4ac70[_0xe5eb('0x149')][_0xe5eb('0x14a')](_0xe5eb('0x14b'))>=0x0;})[_0xe5eb('0xbc')](myreject(_0x450f0c)));}BPromise[_0xe5eb('0x14c')](_0x3f358b)['then'](function(_0x18536f){var _0x46785c=_['some'](_0x18536f);if(_0x46785c){return _0x3db2d8(_0x46785c);}else{_0x3f637e[_0xe5eb('0x39')]=_0x37c911?_0xe5eb('0x14d'):_0xe5eb('0x14e');return _0x450f0c(msgResponse(_0xe5eb('0x14f'),_0xe5eb('0x13f'),_0xe5eb('0x150')+_0x37c911+'\x20'+_0x36fc9e+_0xe5eb('0x151')+util['inspect'](_0x4a4b2e,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x1d9186));}})[_0xe5eb('0xbc')](function(_0x5af83b){return _0x450f0c(msgResponse('ifTime','Failure',JSON['stringify'](_0x5af83b)));});});};Dialer[_0xe5eb('0xae')][_0xe5eb('0x152')]=function(_0x694090){var _0x34580c=this;return function(){switch(_0x694090[_0xe5eb('0x56')]){case _0xe5eb('0x153'):freeVariablesPredictive(_0x694090);_0x34580c[_0xe5eb('0x154')](_0x694090,0x1);break;case'power':freeVariablesPredictive(_0x694090);_0x34580c[_0xe5eb('0x154')](_0x694090,_0x694090[_0xe5eb('0x155')]);break;case'predictive':_0x34580c[_0xe5eb('0x9')](_0x694090);break;case'booked':freeVariablesPredictive(_0x694090);_0x34580c[_0xe5eb('0x154')](_0x694090,0x1);break;default:freeVariablesPredictive(_0x694090);logger[_0xe5eb('0x9d')]('Queue',_0x694090[_0xe5eb('0x3a')],'method\x20not\x20recognized');}};};Dialer[_0xe5eb('0xae')][_0xe5eb('0x156')]=function(_0xedae45){var _0x2750f9=this;return function(){_0x2750f9['handleIvr'](_0xedae45);};};Dialer[_0xe5eb('0xae')][_0xe5eb('0x31')]=function(_0xf16f94){var _0x565623=this;if(isNotPreview(_0xf16f94[_0xe5eb('0x56')])){if(isVoiceQueueOutbound(_0xf16f94[_0xe5eb('0x47')])&&isActive(_0xf16f94[_0xe5eb('0x55')])){_0xf16f94[_0xe5eb('0xa9')]=!![];BPromise[_0xe5eb('0xba')]()[_0xe5eb('0xbf')](checkIsLoggedIn(_0xf16f94,_0xf16f94[_0xe5eb('0x4c')]))['then'](checkIsActive(_0xf16f94,_0xf16f94[_0xe5eb('0x55')]))[_0xe5eb('0xbf')](checkInterval(_0xf16f94))['then'](_0x565623[_0xe5eb('0x13c')](_0xf16f94))['then'](_0x565623[_0xe5eb('0x13d')](_0xf16f94['dialGlobalInterval'],_0xf16f94['dialTimezone'],_0xf16f94[_0xe5eb('0x3a')],_0xf16f94))[_0xe5eb('0xbf')](_0x565623[_0xe5eb('0x157')](_0xf16f94[_0xe5eb('0x40')],_0xf16f94[_0xe5eb('0x158')],_0xf16f94[_0xe5eb('0x3a')],_0xf16f94))[_0xe5eb('0xbf')](_0x565623['checkDialMethod'](_0xf16f94))[_0xe5eb('0xbc')](loggerCatchQueueSummary('[syncQueueSummary]',_0xf16f94));}else{notSendMessagesQueue(_0xf16f94);}}else{freeVariablesPredictive(_0xf16f94);}};Dialer[_0xe5eb('0xae')][_0xe5eb('0x159')]=function(){var _0x177343=this;var _0x27808b;for(var _0x5a5a8d in this[_0xe5eb('0x1e')]){if(typeof this[_0xe5eb('0x1e')][_0x5a5a8d]!==_0xe5eb('0x9f')){_0x27808b=this['campaigns'][_0x5a5a8d];if(isCampaignIvr(_0x27808b[_0xe5eb('0x47')])&&isActive(_0x27808b[_0xe5eb('0x75')])){_0x27808b[_0xe5eb('0xa9')]=!![];BPromise[_0xe5eb('0xba')]()[_0xe5eb('0xbf')](checkIsActive(_0x27808b,_0x27808b[_0xe5eb('0x75')]))['then'](checkInterval(_0x27808b))[_0xe5eb('0xbf')](_0x177343[_0xe5eb('0x13c')](_0x27808b))['then'](_0x177343[_0xe5eb('0x13d')](_0x27808b[_0xe5eb('0x15a')],_0x27808b[_0xe5eb('0x158')],_0x27808b[_0xe5eb('0x3a')],_0x27808b))[_0xe5eb('0xbf')](_0x177343[_0xe5eb('0x157')](_0x27808b['Interval'],_0x27808b['dialTimezone'],_0x27808b[_0xe5eb('0x3a')],_0x27808b))[_0xe5eb('0xbf')](_0x177343[_0xe5eb('0x156')](_0x27808b))[_0xe5eb('0xbc')](loggerCatchQueueSummary(_0xe5eb('0x15b'),_0x27808b));}else{notSendMessagesCampaign(_0x27808b);}}}};function getCallerIdRandom(_0x4e2d75,_0x5d8d0b){var _0x83ce8f;var _0x51fbdc;var _0x111500;if(_0x5d8d0b<=0x0){_0x5d8d0b=0x1;}_0x83ce8f=new RegExp(_0xe5eb('0x15c')+_0x5d8d0b+'}$');_0x51fbdc=Math[_0xe5eb('0x15d')](0xa,_0x5d8d0b-0x1);_0x111500=Math[_0xe5eb('0x15d')](0xa,_0x5d8d0b)-0x1;return util[_0xe5eb('0x78')]('%s',_[_0xe5eb('0x15e')](_0x4e2d75,_0x83ce8f,_[_0xe5eb('0x15f')](_0x51fbdc,_0x111500)));}function extractCalleridName(_0x1bdef6){var _0x303e72=_0x1bdef6[_0xe5eb('0x160')](/"(.*?)"/);return _0x303e72?_0x303e72[0x1]:_0x1bdef6;}function extractCalleridNumber(_0x3222c5){var _0x426667=_0x3222c5[_0xe5eb('0x160')](/<(.*?)>/);return _0x426667?_0x426667[0x1]:_0x3222c5;}Dialer['prototype']['actionOriginate']=function(_0x100855,_0x1b46c9){var _0x2855ac=this;var _0x1f50ef=uuid['v4']();this['actions'][_0x1f50ef]=new Action(_0x100855,_0x1b46c9,_0x1f50ef);return new BPromise(function(_0x10bc5a,_0x2b1631){if(_[_0xe5eb('0x86')](_0x100855)&&typeof _0x100855!==_0xe5eb('0x161')){return _0x2b1631(msgResponse('originate',_0xe5eb('0x13f'),_0xe5eb('0x162')));}if(_['isUndefined'](_0x1b46c9[_0xe5eb('0x163')]['phone'])||_0x1b46c9[_0xe5eb('0x163')][_0xe5eb('0x164')]===null){return _0x2b1631(msgResponse(_0xe5eb('0x165'),'Failure',_0xe5eb('0x166')));}var _0x3cb6af={'XMD-CALLERID':_0x2855ac[_0xe5eb('0x23')][_0x1f50ef][_0xe5eb('0x167')](),'XMD-AGI':_0x100855['dialQueueProject']?util['format'](_0xe5eb('0x168'),ipAgi,_0x100855['dialQueueProject']):_0xe5eb('0x169'),'XMD-AGIAFTER':_0x100855[_0xe5eb('0x10f')]?util[_0xe5eb('0x78')](_0xe5eb('0x168'),ipAgi,_0x100855[_0xe5eb('0x10f')]):_0xe5eb('0x169'),'XMD-QUEUE':_0x100855['type']===_0xe5eb('0x48')?util[_0xe5eb('0x78')](_0xe5eb('0x16a'),_0x100855[_0xe5eb('0x3a')],_0x100855[_0xe5eb('0x16b')]||'',_0x100855['dialAgiAfterHangupAgent']?'c':'',_0x100855['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x1b46c9[_0xe5eb('0xd9')],'XMD-CDRTYPE':_0xe5eb('0x7'),'CALLERID(all)':_0x2855ac['actions'][_0x1f50ef][_0xe5eb('0x167')](),'XMD-AMD':_0x100855[_0xe5eb('0xec')]?'ACTIVE':'NONE','XMD-DESTINATION':_0xe5eb('0x16c')};if(_0x100855[_0xe5eb('0xec')]){_0x3cb6af[_0xe5eb('0x16d')]=_0x100855[_0xe5eb('0x16e')]||0x9c4;_0x3cb6af['XMD-AMDGREETING']=_0x100855[_0xe5eb('0x16f')]||0x5dc;_0x3cb6af[_0xe5eb('0x170')]=_0x100855[_0xe5eb('0x171')]||0x320;_0x3cb6af[_0xe5eb('0x172')]=_0x100855[_0xe5eb('0x173')]||0x1388;_0x3cb6af[_0xe5eb('0x174')]=_0x100855[_0xe5eb('0x175')]||0x64;_0x3cb6af[_0xe5eb('0x176')]=_0x100855['dialAMDBetweenWordsSilence']||0x32;_0x3cb6af['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x100855[_0xe5eb('0x177')]||0x3;_0x3cb6af[_0xe5eb('0x178')]=_0x100855[_0xe5eb('0x179')]||0x100;_0x3cb6af[_0xe5eb('0x17a')]=_0x100855[_0xe5eb('0x17b')]||0x1388;}if(_0x100855['type']===_0xe5eb('0x48')){_0x3cb6af[_0xe5eb('0x17c')]=_0x1b46c9['VoiceQueueId'];}else{_0x3cb6af[_0xe5eb('0x17d')]=_0x1b46c9['CampaignId'];}for(var _0x507d68 in _0x1b46c9[_0xe5eb('0x163')]){if(typeof _0x1b46c9[_0xe5eb('0x163')][_0x507d68]!==_0xe5eb('0x9f')){if(isNotNull(_0x1b46c9[_0xe5eb('0x163')][_0x507d68])&&_0x507d68!=='id'&&_0x507d68!==_0xe5eb('0x17e')&&_0x507d68!==_0xe5eb('0x17f')&&_0x507d68!==_0xe5eb('0x180')){_0x3cb6af[util[_0xe5eb('0x78')]('%s%s',_0xe5eb('0x181'),_[_0xe5eb('0x182')](_0x507d68))]=_0x1b46c9['Contact'][_0x507d68];}}}var _0x43b67d=_0x2855ac[_0xe5eb('0xdf')](_0x100855['Trunk'])?getCallerId(_0x100855['Trunk'][_0xe5eb('0x76')],_0x100855[_0xe5eb('0x57')],_0x100855[_0xe5eb('0x183')]>0x0?getCallerIdRandom(_0x100855['dialOriginateCallerIdNumber'],_0x100855['dialRandomLastDigitCallerIdNumber']):_0x100855[_0xe5eb('0x184')]):getCallerId(_[_0xe5eb('0xb2')](_0x100855[_0xe5eb('0x185')])?_0x100855[_0xe5eb('0x74')]['callerid']:_0x100855[_0xe5eb('0x185')][_0xe5eb('0x76')],_0x100855[_0xe5eb('0x57')],_0x100855[_0xe5eb('0x183')]>0x0?getCallerIdRandom(_0x100855['dialOriginateCallerIdNumber'],_0x100855['dialRandomLastDigitCallerIdNumber']):_0x100855[_0xe5eb('0x184')]);if(_0x43b67d){_0x3cb6af[_0xe5eb('0x186')]=_0x2855ac[_0xe5eb('0x23')][_0x1f50ef][_0xe5eb('0x187')]=extractCalleridName(_0x43b67d);_0x3cb6af[_0xe5eb('0x188')]=_0x2855ac[_0xe5eb('0x23')][_0x1f50ef][_0xe5eb('0x189')]=extractCalleridNumber(_0x43b67d);}return ami[_0xe5eb('0xb3')]({'actionid':_0x1f50ef,'action':'originate','channel':_0x2855ac[_0xe5eb('0xdf')](_0x100855[_0xe5eb('0x74')])?util['format'](_0xe5eb('0x18a'),_0x100855[_0xe5eb('0x74')][_0xe5eb('0x3a')],isNotNull(_0x100855[_0xe5eb('0x59')])?_0x100855[_0xe5eb('0x59')]['trim']()||'':'',_0x100855['dialCutDigit']>0x0?_0x1b46c9[_0xe5eb('0x163')][_0xe5eb('0x164')]['substring'](_0x100855[_0xe5eb('0x18b')]):_0x1b46c9[_0xe5eb('0x163')][_0xe5eb('0x164')]):util[_0xe5eb('0x78')]('SIP/%s/%s%s',_[_0xe5eb('0xb2')](_0x100855[_0xe5eb('0x185')])?_0x100855[_0xe5eb('0x74')]['name']:_0x100855[_0xe5eb('0x185')][_0xe5eb('0x3a')],isNotNull(_0x100855[_0xe5eb('0x59')])?_0x100855[_0xe5eb('0x59')][_0xe5eb('0x18c')]()||'':'',_0x100855[_0xe5eb('0x18b')]>0x0?_0x1b46c9[_0xe5eb('0x163')]['phone'][_0xe5eb('0x18d')](_0x100855[_0xe5eb('0x18b')]):_0x1b46c9['Contact'][_0xe5eb('0x164')]),'callerid':_0x43b67d,'Exten':_0xe5eb('0x16c'),'Context':_0xe5eb('0x18e'),'Priority':'1','variable':_0x3cb6af,'timeout':(_0x100855[_0xe5eb('0x58')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1f50ef})[_0xe5eb('0xbf')](function(_0x5282a5){return _0x10bc5a(_0x5282a5);})[_0xe5eb('0xbc')](function(_0x1cd65c){_0x100855['outboundOriginateFailureCallsDay']+=0x1;var _0x2ce28e=new History(_0x2855ac[_0xe5eb('0x23')][_0x1f50ef]);logger[_0xe5eb('0x9d')](util[_0xe5eb('0x78')](_0xe5eb('0x18f'),JSON[_0xe5eb('0x77')](_0x1cd65c)));_0x2ce28e[_0xe5eb('0xab')]=0xe;_0x2ce28e[_0xe5eb('0xac')]=_0xe5eb('0x190');_0x2ce28e['starttime']=moment()[_0xe5eb('0x78')](_0xe5eb('0xfb'));_0x2ce28e[_0xe5eb('0x11d')]=_0x2ce28e['starttime'];_0x2855ac[_0xe5eb('0xd1')](_0x2ce28e)[_0xe5eb('0xbc')](loggerCatch(_0xe5eb('0x191')));_0x2855ac[_0xe5eb('0xcf')](_0x2ce28e)['catch'](loggerCatch(_0xe5eb('0x191')))['finally'](function(){delete _0x2855ac[_0xe5eb('0x23')][_0x1f50ef];return _0x2b1631(msgResponse(_0xe5eb('0x165'),'Error',_0xe5eb('0x192')));});});});};Dialer['prototype'][_0xe5eb('0x2d')]=function(_0x5ba69b){var _0x1d4259=this[_0xe5eb('0x23')][_0x5ba69b['actionid']];if(_0x1d4259){delete this['actions'][_0x5ba69b[_0xe5eb('0x125')]];_0x1d4259[_0xe5eb('0x115')]=moment()[_0xe5eb('0x78')](_0xe5eb('0xfb'));var _0x1ccf91=_0x1d4259[_0xe5eb('0x47')]===_0xe5eb('0x98')?this[_0xe5eb('0x1e')][_0x1d4259[_0xe5eb('0xb6')]]:this[_0xe5eb('0x1d')][_0x1d4259[_0xe5eb('0x193')]()];if(!this[_0xe5eb('0xdd')](_0x5ba69b[_0xe5eb('0x194')])){this[_0xe5eb('0xb8')](_0x1ccf91);return this[_0xe5eb('0x195')](_0x1d4259,_0x1ccf91,_0x5ba69b)['catch'](loggerCatch('[callProgressDetecting]\x20'));}this[_0xe5eb('0x25')][_0x5ba69b['uniqueid']]=_0x1d4259;}};Dialer[_0xe5eb('0xae')][_0xe5eb('0x196')]=function(_0x378b85,_0x3a2f00,_0xb8da5){var _0x1e8000=new History(_0x3a2f00);if(_0x1e8000[_0xe5eb('0x101')]+_0x1e8000[_0xe5eb('0xf1')]+_0x1e8000[_0xe5eb('0x102')]+_0x1e8000[_0xe5eb('0x103')]+_0x1e8000[_0xe5eb('0x104')]+_0x1e8000[_0xe5eb('0xf2')]+_0x1e8000[_0xe5eb('0xf0')]+_0x1e8000[_0xe5eb('0xf3')]>=_0xb8da5['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x378b85){case 0x3:if(_0x1e8000[_0xe5eb('0x102')]>=_0xb8da5[_0xe5eb('0x197')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x1e8000[_0xe5eb('0x102')]+=0x1,'scheduledat':moment()[_0xe5eb('0xf8')](_0xb8da5[_0xe5eb('0x198')],_0xe5eb('0xfa'))[_0xe5eb('0x78')](_0xe5eb('0xfb')),'ContactId':_0x1e8000['ContactId'],'ListId':_0x1e8000[_0xe5eb('0xda')],'VoiceQueueId':_0x1e8000['VoiceQueueId']||undefined,'CampaignId':_0x1e8000[_0xe5eb('0xdc')]||undefined})[_0xe5eb('0xbc')](loggerCatch(_0xe5eb('0x199')));break;case 0x5:if(_0x1e8000[_0xe5eb('0x101')]>=_0xb8da5[_0xe5eb('0x19a')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x1e8000[_0xe5eb('0x101')]+=0x1,'scheduledat':moment()['add'](_0xb8da5['dialBusyRetryFrequency'],_0xe5eb('0xfa'))['format'](_0xe5eb('0xfb')),'ContactId':_0x1e8000[_0xe5eb('0xd9')],'ListId':_0x1e8000[_0xe5eb('0xda')],'VoiceQueueId':_0x1e8000[_0xe5eb('0xdb')]||undefined,'CampaignId':_0x1e8000[_0xe5eb('0xdc')]||undefined})[_0xe5eb('0xbc')](loggerCatch(_0xe5eb('0x19b')));break;case 0x8:if(_0x1e8000['countcongestionretry']>=_0xb8da5[_0xe5eb('0x19c')]-0x1){return!![];}this[_0xe5eb('0xc4')]({'active':![],'countcongestionretry':_0x1e8000[_0xe5eb('0xf1')]+=0x1,'scheduledat':moment()[_0xe5eb('0xf8')](_0xb8da5[_0xe5eb('0x19d')],_0xe5eb('0xfa'))[_0xe5eb('0x78')](_0xe5eb('0xfb')),'ContactId':_0x1e8000[_0xe5eb('0xd9')],'ListId':_0x1e8000['ListId'],'VoiceQueueId':_0x1e8000[_0xe5eb('0xdb')]||undefined,'CampaignId':_0x1e8000[_0xe5eb('0xdc')]||undefined})['catch'](loggerCatch(_0xe5eb('0x19e')));break;case 0x0:if(_0x1e8000['countnosuchnumberretry']>=_0xb8da5['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x1e8000[_0xe5eb('0x103')]+=0x1,'scheduledat':moment()['add'](_0xb8da5['dialNoSuchNumberRetryFrequency'],_0xe5eb('0xfa'))[_0xe5eb('0x78')](_0xe5eb('0xfb')),'ContactId':_0x1e8000[_0xe5eb('0xd9')],'ListId':_0x1e8000[_0xe5eb('0xda')],'VoiceQueueId':_0x1e8000[_0xe5eb('0xdb')]||undefined,'CampaignId':_0x1e8000['CampaignId']||undefined})[_0xe5eb('0xbc')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x1e8000[_0xe5eb('0x104')]>=_0xb8da5[_0xe5eb('0x11a')]-0x1){return!![];}this[_0xe5eb('0xc4')]({'active':![],'countdropretry':_0x1e8000[_0xe5eb('0x104')]+=0x1,'scheduledat':moment()['add'](_0xb8da5[_0xe5eb('0x11c')],_0xe5eb('0xfa'))[_0xe5eb('0x78')](_0xe5eb('0xfb')),'ContactId':_0x1e8000[_0xe5eb('0xd9')],'ListId':_0x1e8000[_0xe5eb('0xda')],'VoiceQueueId':_0x1e8000['VoiceQueueId']||undefined,'CampaignId':_0x1e8000[_0xe5eb('0xdc')]||undefined})[_0xe5eb('0xbc')](loggerCatch(_0xe5eb('0x19f')));break;case 0xb:if(_0x1e8000['countabandonedretry']>=_0xb8da5[_0xe5eb('0x122')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x1e8000[_0xe5eb('0xf2')]+=0x1,'scheduledat':moment()[_0xe5eb('0xf8')](_0xb8da5[_0xe5eb('0x123')],_0xe5eb('0xfa'))['format'](_0xe5eb('0xfb')),'ContactId':_0x1e8000[_0xe5eb('0xd9')],'ListId':_0x1e8000[_0xe5eb('0xda')],'VoiceQueueId':_0x1e8000[_0xe5eb('0xdb')]||undefined,'CampaignId':_0x1e8000['CampaignId']||undefined})[_0xe5eb('0xbc')](loggerCatch(_0xe5eb('0x1a0')));break;case 0x13:if(_0x1e8000[_0xe5eb('0xf0')]>=_0xb8da5[_0xe5eb('0xf6')]-0x1){return!![];}this[_0xe5eb('0xc4')]({'active':![],'countmachineretry':_0x1e8000[_0xe5eb('0xf0')]+=0x1,'scheduledat':moment()[_0xe5eb('0xf8')](_0xb8da5[_0xe5eb('0xf9')],_0xe5eb('0xfa'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1e8000['ContactId'],'ListId':_0x1e8000[_0xe5eb('0xda')],'VoiceQueueId':_0x1e8000[_0xe5eb('0xdb')]||undefined,'CampaignId':_0x1e8000[_0xe5eb('0xdc')]||undefined})[_0xe5eb('0xbc')](loggerCatch(_0xe5eb('0xfc')));break;case 0x14:if(_0x1e8000[_0xe5eb('0xf3')]>=_0xb8da5[_0xe5eb('0x1a1')]-0x1){return!![];}this[_0xe5eb('0xc4')]({'active':![],'countagentrejectretry':_0x1e8000['countagentrejectretry']+=0x1,'scheduledat':moment()[_0xe5eb('0xf8')](_0xb8da5[_0xe5eb('0x1a2')],_0xe5eb('0xfa'))[_0xe5eb('0x78')](_0xe5eb('0xfb')),'ContactId':_0x1e8000['ContactId'],'ListId':_0x1e8000[_0xe5eb('0xda')],'VoiceQueueId':_0x1e8000[_0xe5eb('0xdb')]||undefined,'CampaignId':_0x1e8000[_0xe5eb('0xdc')]||undefined})['catch'](loggerCatch(_0xe5eb('0x1a3')));break;default:return!![];}};Dialer[_0xe5eb('0xae')]['callProgressDetecting']=function(_0x502be6,_0x40fb99,_0x5768ca){var _0x2ff8a2=this;var _0x127a7d=new History(_0x502be6);return new BPromise(function(_0xf86086,_0x439473){if(_['isUndefined'](_0x40fb99)&&typeof _0x40fb99!==_0xe5eb('0x161')){return _0x439473(msgResponse(_0xe5eb('0x1a4'),'Failure',_0xe5eb('0x1a5')));}if(_[_0xe5eb('0x86')](_0x5768ca)&&typeof _0x5768ca!=='object'){return _0x439473(msgResponse(_0xe5eb('0x1a4'),'Failure',_0xe5eb('0x1a6')));}switch(_0x5768ca[_0xe5eb('0x10d')]){case'0':_0x40fb99['outboundNoSuchCallsDay']+=0x1;_0x127a7d[_0xe5eb('0xab')]=0x0;_0x127a7d[_0xe5eb('0xac')]=_0xe5eb('0x1a7');_0x127a7d[_0xe5eb('0x103')]+=0x1;_0x127a7d[_0xe5eb('0xff')]+=0x1;ami['emit'](_0xe5eb('0x1a8'),ut[_0xe5eb('0xe9')](_0x502be6,'nosuchnumber'));_0x2ff8a2[_0xe5eb('0xd1')](_0x127a7d)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x2ff8a2[_0xe5eb('0x196')](0x0,_0x502be6,_0x40fb99)){if(_0x127a7d['countnosuchnumberretry']>=_0x40fb99[_0xe5eb('0x1a9')]){_0x2ff8a2['createStateFinal'](_0x127a7d,_0xf86086,_0x439473,_0xe5eb('0x1aa'));}else{_0x2ff8a2['stateGlobal'](_0x127a7d,_0xf86086,_0x439473,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x40fb99['outboundNoAnswerCallsDay']+=0x1;_0x127a7d[_0xe5eb('0xab')]=0x3;_0x127a7d[_0xe5eb('0xac')]=_0xe5eb('0x1ab');_0x127a7d[_0xe5eb('0x102')]+=0x1;_0x127a7d['countglobal']+=0x1;ami['emit']('custom:agentnoanswer',ut[_0xe5eb('0xe9')](_0x502be6,_0xe5eb('0x1ac')));_0x2ff8a2[_0xe5eb('0xd1')](_0x127a7d)[_0xe5eb('0xbc')](loggerCatch(_0xe5eb('0x1ad')));if(_0x2ff8a2['checkRetriveMax'](0x3,_0x502be6,_0x40fb99)){if(_0x127a7d[_0xe5eb('0x102')]>=_0x40fb99['dialNoAnswerMaxRetry']){_0x2ff8a2[_0xe5eb('0xf7')](_0x127a7d,_0xf86086,_0x439473,'reason\x203\x20ringing\x20no\x20answer');}else{_0x2ff8a2[_0xe5eb('0xf5')](_0x127a7d,_0xf86086,_0x439473,_0xe5eb('0x1ae'));}}break;case'5':_0x40fb99[_0xe5eb('0x5c')]+=0x1;_0x127a7d[_0xe5eb('0xab')]=0x5;_0x127a7d[_0xe5eb('0xac')]='Busy';_0x127a7d[_0xe5eb('0x101')]+=0x1;_0x127a7d[_0xe5eb('0xff')]+=0x1;ami[_0xe5eb('0x46')]('custom:agentbusy',ut[_0xe5eb('0xe9')](_0x502be6,'busy'));_0x2ff8a2['createHistory'](_0x127a7d)['catch'](loggerCatch(_0xe5eb('0x1af')));if(_0x2ff8a2[_0xe5eb('0x196')](0x5,_0x502be6,_0x40fb99)){if(_0x127a7d[_0xe5eb('0x101')]>=_0x40fb99[_0xe5eb('0x19a')]){_0x2ff8a2[_0xe5eb('0xf7')](_0x127a7d,_0xf86086,_0x439473,_0xe5eb('0x1b0'));}else{_0x2ff8a2['stateGlobal'](_0x127a7d,_0xf86086,_0x439473,_0xe5eb('0x1b0'));}}break;case'8':_0x40fb99['outboundCongestionCallsDay']+=0x1;_0x127a7d[_0xe5eb('0xab')]=0x8;_0x127a7d[_0xe5eb('0xac')]=_0xe5eb('0x1b1');_0x127a7d['countcongestionretry']+=0x1;_0x127a7d[_0xe5eb('0xff')]+=0x1;ami[_0xe5eb('0x46')]('custom:agentcongestion',ut[_0xe5eb('0xe9')](_0x502be6,'congestion'));_0x2ff8a2[_0xe5eb('0xd1')](_0x127a7d)[_0xe5eb('0xbc')](loggerCatch(_0xe5eb('0x1b2')));if(_0x2ff8a2[_0xe5eb('0x196')](0x8,_0x502be6,_0x40fb99)){if(_0x127a7d[_0xe5eb('0xf1')]>=_0x40fb99[_0xe5eb('0x19c')]){_0x2ff8a2[_0xe5eb('0xf7')](_0x127a7d,_0xf86086,_0x439473,'reason\x208\x20congestion');}else{_0x2ff8a2[_0xe5eb('0xf5')](_0x127a7d,_0xf86086,_0x439473,_0xe5eb('0x1b3'));}}break;case'11':_0x40fb99[_0xe5eb('0x1b4')]+=0x1;_0x127a7d[_0xe5eb('0xab')]=0xb;_0x127a7d[_0xe5eb('0xac')]=_0xe5eb('0x121');_0x127a7d[_0xe5eb('0xf2')]+=0x1;_0x127a7d[_0xe5eb('0xff')]+=0x1;_0x2ff8a2[_0xe5eb('0xd1')](_0x127a7d)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x2ff8a2[_0xe5eb('0x196')](0xb,_0x502be6,_0x40fb99)){if(_0x127a7d[_0xe5eb('0xf2')]>=_0x40fb99['dialAbandonedMaxRetry']){_0x2ff8a2[_0xe5eb('0xf7')](_0x127a7d,_0xf86086,_0x439473,'reason\x2011\x20abandoned');}else{_0x2ff8a2['stateGlobal'](_0x127a7d,_0xf86086,_0x439473,_0xe5eb('0x1b5'));}}break;case'20':_0x40fb99[_0xe5eb('0x64')]+=0x1;_0x127a7d[_0xe5eb('0xab')]=0x14;_0x127a7d[_0xe5eb('0xac')]='AgentReject';_0x127a7d[_0xe5eb('0xf3')]+=0x1;_0x127a7d[_0xe5eb('0xff')]+=0x1;ami['emit'](_0xe5eb('0x1b6'),ut[_0xe5eb('0xe9')](_0x502be6,_0xe5eb('0x1b7')));_0x2ff8a2[_0xe5eb('0xd1')](_0x127a7d)[_0xe5eb('0xbc')](loggerCatch(_0xe5eb('0x1b8')));if(_0x2ff8a2[_0xe5eb('0x196')](0x14,_0x502be6,_0x40fb99)){if(_0x127a7d[_0xe5eb('0xf3')]>=_0x40fb99[_0xe5eb('0x1a1')]){_0x2ff8a2[_0xe5eb('0xf7')](_0x127a7d,_0xf86086,_0x439473,_0xe5eb('0x1b9'));}else{_0x2ff8a2[_0xe5eb('0xf5')](_0x127a7d,_0xf86086,_0x439473,_0xe5eb('0x1b9'));}}break;default:_0x40fb99[_0xe5eb('0x65')]+=0x1;_0x127a7d[_0xe5eb('0xab')]=0xc;_0x127a7d[_0xe5eb('0xac')]=_0x5768ca[_0xe5eb('0x10d')];_0x2ff8a2[_0xe5eb('0xd1')](_0x127a7d)[_0xe5eb('0xbc')](loggerCatch(_0xe5eb('0x1ba')));if(_0x2ff8a2[_0xe5eb('0x196')](_0x5768ca[_0xe5eb('0x10d')],_0x502be6,_0x40fb99)){if(_0x127a7d[_0xe5eb('0x101')]+_0x127a7d[_0xe5eb('0xf1')]+_0x127a7d[_0xe5eb('0x102')]+_0x127a7d[_0xe5eb('0x103')]+_0x127a7d[_0xe5eb('0x104')]+_0x127a7d[_0xe5eb('0xf2')]+_0x127a7d[_0xe5eb('0xf0')]+_0x127a7d[_0xe5eb('0xf3')]>=_0x40fb99[_0xe5eb('0xf4')]){_0x2ff8a2[_0xe5eb('0xf5')](_0x127a7d,_0xf86086,_0x439473,_0x5768ca[_0xe5eb('0x10d')]);}else{_0x2ff8a2[_0xe5eb('0xf7')](_0x127a7d,_0xf86086,_0x439473,_0x5768ca[_0xe5eb('0x10d')]);}}}});};Dialer['prototype'][_0xe5eb('0xf5')]=function(_0x3fa652,_0x4586da,_0x56fffd,_0xf589f){var _0x239f4d=new Final(_0x3fa652);_0x239f4d[_0xe5eb('0xab')]=0xf;_0x239f4d['statedesc']=_0xe5eb('0x1bb');this[_0xe5eb('0xf7')](_0x239f4d,_0x4586da,_0x56fffd,_0xf589f);};Dialer['prototype']['createStateFinal']=function(_0x4ad271,_0x33511f,_0x4807b3,_0x3df0ca){this[_0xe5eb('0xcf')](_0x4ad271)['then'](function(){return _0x33511f(msgResponse(_0xe5eb('0x1a4'),_0xe5eb('0xde'),_0x3df0ca));})['catch'](function(){return _0x4807b3(msgResponse(_0xe5eb('0x1bc'),_0xe5eb('0x13f'),_0xe5eb('0x1bd')));});};Dialer[_0xe5eb('0xae')][_0xe5eb('0x9')]=function(_0x561e20){var _0x56f352=_0x561e20['dialPredictiveOptimizationPercentage']/0x64;var _0x56d73a=_0x561e20[_0xe5eb('0x60')]/(_0x561e20[_0xe5eb('0x60')]+_0x561e20[_0xe5eb('0x5b')]);var _0x24278d=Math[_0xe5eb('0x1be')](_0x561e20[_0xe5eb('0x1bf')]*(_0x561e20[_0xe5eb('0x1c0')]/0x64));var _0x4f45ad=Math['round'](_0x561e20[_0xe5eb('0x1bf')]*(_0x561e20[_0xe5eb('0x1c1')]/0x64));var _0x41e55=_0x561e20[_0xe5eb('0x4b')]+_0x561e20[_0xe5eb('0x50')];var _0x574f38=Math[_0xe5eb('0x1c2')](_0x561e20['erlangCalls']*_0x561e20[_0xe5eb('0x8f')]*_0x561e20[_0xe5eb('0x6d')]*_0x561e20[_0xe5eb('0x6e')]);if(_[_0xe5eb('0x86')](_0x561e20[_0xe5eb('0x26')])){if(!_[_0xe5eb('0x86')](_0x561e20['startPredictive'])){_0x561e20[_0xe5eb('0x73')]=undefined;loggerPredictive[_0xe5eb('0x9d')](_0xe5eb('0x1c3'),_0xe5eb('0x1c4'));}if(!_[_0xe5eb('0x86')](_0x561e20[_0xe5eb('0x95')])){loggerPredictive[_0xe5eb('0x9d')](_0xe5eb('0x1c3'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x561e20[_0xe5eb('0x95')]);_0x561e20[_0xe5eb('0x95')]=undefined;}_0x561e20[_0xe5eb('0x26')]=moment()[_0xe5eb('0x78')](_0xe5eb('0xfb'));loggerPredictive[_0xe5eb('0x7d')](_0x561e20[_0xe5eb('0x3a')],_0xe5eb('0x1c5'),_0x561e20[_0xe5eb('0x26')]);this[_0xe5eb('0x154')](_0x561e20,0x1);}else if(ifInterval(_0x561e20[_0xe5eb('0x1c6')],_0x561e20['startProgressive'])){this[_0xe5eb('0x154')](_0x561e20,0x1);loggerPredictiveCalls[_0xe5eb('0x7d')](_0xe5eb('0x1c7'),_0x561e20[_0xe5eb('0x26')],_0x561e20['name']);_0x561e20[_0xe5eb('0x71')]=0x0;_0x561e20['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x56f352<_0x56d73a&&_0x561e20['dialPredictiveOptimization']===_0xe5eb('0x1c8')){freeVariablesPredictive(_0x561e20);loggerPredictive[_0xe5eb('0x7d')](_0xe5eb('0x1c9'),_0xe5eb('0x1ca'),_0x56d73a,_0xe5eb('0x26'),_0x561e20[_0xe5eb('0x3a')]);}else if(_0x574f38<_0x561e20['predictiveIntervalErlangCallsDroppedCalls']&&_0x561e20[_0xe5eb('0x1cb')]==='dropRate'){freeVariablesPredictive(_0x561e20);loggerPredictive[_0xe5eb('0x7d')](_0xe5eb('0x1cc'),_0xe5eb('0x1cd'),_0x574f38,_0xe5eb('0x1ce'),_0x561e20[_0xe5eb('0x6c')],_0xe5eb('0x26'),_0x561e20['name']);}else if(!ifInterval(_0x561e20[_0xe5eb('0x1c6')],_0x561e20['startProgressive'])&&_[_0xe5eb('0x86')](_0x561e20[_0xe5eb('0x73')])&&!_[_0xe5eb('0x86')](_0x561e20['startProgressive'])){_0x561e20[_0xe5eb('0x73')]=moment()[_0xe5eb('0x78')](_0xe5eb('0xfb'));loggerPredictive[_0xe5eb('0x7d')](_0x561e20[_0xe5eb('0x3a')],_0xe5eb('0x1cf'),_0x561e20['startPredictive']);this['averageHandleTime'](_0x561e20['dialPredictiveInterval'])[_0xe5eb('0xbf')](this[_0xe5eb('0x1d0')](_0x561e20))[_0xe5eb('0xbf')](mergeDataErlangB(_0x561e20))['then'](this['startMethodPredictive'](_0x561e20))[_0xe5eb('0xbc')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x561e20));}else if(!ifInterval(_0x561e20[_0xe5eb('0x1c6')],_0x561e20[_0xe5eb('0x73')])){_0x561e20[_0xe5eb('0x6c')]=0x0;_0x561e20['startPredictive']=moment()['format'](_0xe5eb('0xfb'));loggerPredictive[_0xe5eb('0x7d')](_0x561e20[_0xe5eb('0x3a')],_0xe5eb('0x1d1'),_0x561e20[_0xe5eb('0x73')]);clearInterval(_0x561e20[_0xe5eb('0x95')]);_0x561e20['handlePredictive']=undefined;this[_0xe5eb('0xc1')](_0x561e20[_0xe5eb('0x1c6')])[_0xe5eb('0xbf')](this[_0xe5eb('0x1d0')](_0x561e20))[_0xe5eb('0xbf')](mergeDataErlangB(_0x561e20))['then'](this[_0xe5eb('0x1d2')](_0x561e20))[_0xe5eb('0xbc')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x561e20));}else if(_0x561e20[_0xe5eb('0x1bf')]&&_0x41e55<_0x561e20[_0xe5eb('0x1bf')]-_0x4f45ad){freeVariablesPredictive(_0x561e20);loggerPredictive[_0xe5eb('0x7d')](_0x561e20[_0xe5eb('0x3a')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x41e55,_0xe5eb('0x1d3'),_0x561e20['predictiveIntervalAvailable'],'-',_0x4f45ad,'=',_0x561e20[_0xe5eb('0x1bf')]-_0x4f45ad,')');}else if(_0x561e20[_0xe5eb('0x1bf')]&&_0x41e55>_0x561e20['predictiveIntervalAvailable']+_0x24278d){freeVariablesPredictive(_0x561e20);loggerPredictive[_0xe5eb('0x7d')](_0x561e20[_0xe5eb('0x3a')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x41e55,_0xe5eb('0x1d4'),_0x561e20['predictiveIntervalAvailable'],'+',_0x24278d,'=',_0x561e20['predictiveIntervalAvailable']+_0x24278d,')');}};Dialer[_0xe5eb('0xae')][_0xe5eb('0x1d0')]=function(_0xfbdfd9){var _0x330f02=this;return function(_0x8b4ee5){return new BPromise(function(_0x236488,_0x42ab85){_['merge'](_0xfbdfd9,_0x8b4ee5[0x0]);if(checkGetDataPredictive(_0x8b4ee5[0x0])){var _0x3d0dd1=_0xfbdfd9[_0xe5eb('0x1bf')]=_0xfbdfd9[_0xe5eb('0x50')]+_0xfbdfd9[_0xe5eb('0x4b')];var _0x3b3b18=_0xfbdfd9['dialPredictiveInterval']*0x3c;var _0x124fbf=_0x8b4ee5[0x0][_0xe5eb('0x68')]+_0x8b4ee5[0x0][_0xe5eb('0x67')];var _0x4c97c4=(_0x8b4ee5[0x0]['predictiveIntervalAnsweredCalls']+_0x8b4ee5[0x0][_0xe5eb('0x6a')]+_0x8b4ee5[0x0][_0xe5eb('0x69')])/_0x8b4ee5[0x0][_0xe5eb('0x6f')];_0xfbdfd9[_0xe5eb('0x6d')]=_0x4c97c4>0x0?_0x4c97c4:0x1;switch(_0xfbdfd9[_0xe5eb('0x1cb')]){case'dropRate':var _0x19970a=_0xfbdfd9[_0xe5eb('0x1d5')]/0x64;return _0x330f02[_0xe5eb('0x1d6')](_0x3d0dd1,_0x3b3b18,_0x124fbf,_0x4c97c4,_0x19970a)[_0xe5eb('0xbf')](function(_0x421fee){return _0x236488(_0x421fee);});case _0xe5eb('0x1d7'):var _0x36830e=_0xfbdfd9[_0xe5eb('0x1d5')]/0x64;return _0x330f02['busyFactor'](_0x3d0dd1,_0x3b3b18,_0x124fbf,_0x4c97c4,_0x36830e)[_0xe5eb('0xbf')](function(_0x19c870){return _0x236488(_0x19c870);});default:return _0x42ab85(msgResponse('[getDataPredictive]',_0xe5eb('0x13f'),_0xe5eb('0x1d8')));}}else{return _0x42ab85(msgResponse(_0xe5eb('0x1d9'),_0xe5eb('0x13f'),'check\x20failure'));}});};};Dialer[_0xe5eb('0xae')]['getDataPredictiveOld']=function(_0x5c05ea){var _0xb03fb2=this;return function(_0xd013fe){return new BPromise(function(_0x4307d5,_0x59fea6){_[_0xe5eb('0x91')](_0x5c05ea,_0xd013fe[0x0]);if(checkGetDataPredictive(_0xd013fe[0x0])){loggerPredictive[_0xe5eb('0x7d')](JSON[_0xe5eb('0x77')](_0xd013fe[0x0]));if(_0x5c05ea[_0xe5eb('0x1cb')]===_0xe5eb('0x1c8')){return _0xb03fb2[_0xe5eb('0xcd')](_0x5c05ea['id'])[_0xe5eb('0xbf')](function(_0x44a430){var _0x3d9f9e=_0x5c05ea['loggedIn']-_0x44a430[0x0][_0xe5eb('0x1da')];var _0x5329f0=_0x5c05ea[_0xe5eb('0x1c6')]*0x3c;var _0x4629bc=_0xd013fe[0x0][_0xe5eb('0x68')]+_0xd013fe[0x0][_0xe5eb('0x67')];var _0x189711=(_0xd013fe[0x0]['predictiveIntervalAnsweredCalls']+_0xd013fe[0x0][_0xe5eb('0x6a')]+_0xd013fe[0x0][_0xe5eb('0x69')])/_0xd013fe[0x0]['predictiveIntervalTotalCalls'];var _0x4e6caa=_0x5c05ea[_0xe5eb('0x1d5')]/0x64;_0x5c05ea['predictiveIntervalPauses']=_0x44a430[0x0][_0xe5eb('0x1da')]||0x0;_0x5c05ea['predictiveIntervalHitRate']=_0x189711>0x0?_0x189711:0x1;return _0xb03fb2[_0xe5eb('0x1d6')](_0x3d9f9e,_0x5329f0,_0x4629bc,_0x189711,_0x4e6caa);})['then'](function(_0x3433d2){return _0x4307d5(_0x3433d2);})['catch'](function(_0x46f528){return _0x59fea6(msgResponse(_0xe5eb('0x1db'),_0xe5eb('0x13f'),JSON[_0xe5eb('0x77')](_0x46f528)));});}if(_0x5c05ea[_0xe5eb('0x1cb')]===_0xe5eb('0x1d7')){return _0xb03fb2[_0xe5eb('0xcd')](_0x5c05ea['id'])['then'](function(_0x31f379){var _0x34761d=_0x5c05ea['loggedIn']-_0x31f379[0x0][_0xe5eb('0x1da')];var _0x2dd4e6=_0x5c05ea['dialPredictiveInterval']*0x3c;var _0x9795bb=_0xd013fe[0x0][_0xe5eb('0x68')]+_0xd013fe[0x0][_0xe5eb('0x67')];var _0x2955c0=(_0xd013fe[0x0]['predictiveIntervalAnsweredCalls']+_0xd013fe[0x0][_0xe5eb('0x6a')]+_0xd013fe[0x0][_0xe5eb('0x69')])/_0xd013fe[0x0][_0xe5eb('0x6f')];var _0x278321=_0x5c05ea[_0xe5eb('0x1d5')]/0x64;_0x5c05ea[_0xe5eb('0x1dc')]=_0x31f379[0x0][_0xe5eb('0x1da')]||0x0;_0x5c05ea[_0xe5eb('0x6d')]=_0x2955c0>0x0?_0x2955c0:0x1;return _0xb03fb2[_0xe5eb('0x1dd')](_0x34761d,_0x2dd4e6,_0x9795bb,_0x2955c0,_0x278321);})[_0xe5eb('0xbf')](function(_0x7d1ff5){return _0x4307d5(_0x7d1ff5);})['catch'](function(_0x51e5d8){return _0x59fea6(msgResponse(_0xe5eb('0x1db'),_0xe5eb('0x13f'),JSON[_0xe5eb('0x77')](_0x51e5d8)));});}}else{return _0x59fea6(msgResponse(_0xe5eb('0x1d9'),_0xe5eb('0x13f'),_0xe5eb('0x1de')));}});};};Dialer['prototype'][_0xe5eb('0x1d2')]=function(_0xc74dfe){var _0x43b684=this;return function(){var _0x20a55a=0x0;var _0x4c09d5=Math[_0xe5eb('0x1c2')](_0xc74dfe[_0xe5eb('0x8c')]*0x3e8);if(_0x4c09d5>0x0){_0x4c09d5=_0x4c09d5<0x64?0x64:_0x4c09d5;loggerPredictive['info'](_0xc74dfe[_0xe5eb('0x3a')],_0xe5eb('0x1df'),_0x4c09d5,_0xe5eb('0x44'));_0xc74dfe[_0xe5eb('0x95')]=setInterval(function(){_0x43b684[_0xe5eb('0x95')](_0xc74dfe);loggerPredictiveCalls[_0xe5eb('0x7d')](_0xe5eb('0x1e0'),_0x20a55a+=0x1);},_0x4c09d5);}else{loggerPredictive[_0xe5eb('0x7d')](_0xc74dfe[_0xe5eb('0x3a')],_0xe5eb('0x1e1'));}};};Dialer[_0xe5eb('0xae')][_0xe5eb('0x1e2')]=function(_0x47dc03,_0x27eaa6){var _0x4fa604=this;return function(_0x2b8128){if(_[_0xe5eb('0x7c')](_0x2b8128)){if(_[_0xe5eb('0xb2')](_0x27eaa6[_0xe5eb('0x1e3')])||!_0x27eaa6['recallme']){if(_0x47dc03['dialMethod']==='booked'){_0x47dc03['queueStatusComplete']=_[_0xe5eb('0x86')](_0x47dc03[_0xe5eb('0x12b')])?!![]:_0x47dc03[_0xe5eb('0x12b')];var _0xd6f6ff=uuid['v4']();_0x4fa604[_0xe5eb('0x23')][_0xd6f6ff]=new Action(_0x47dc03,_0x27eaa6,_0xd6f6ff);loggerBooked[_0xe5eb('0x7d')](_0xe5eb('0x1e4'),_0xd6f6ff,_0xe5eb('0x1e5'),JSON[_0xe5eb('0x77')](_0x47dc03[_0xe5eb('0x12b')]),'Queue:\x20',_0x47dc03[_0xe5eb('0x3a')]);if(_0x47dc03[_0xe5eb('0x12b')]){_0x47dc03[_0xe5eb('0x12b')]=![];_0x4fa604['queueBooked'][_0x4fa604[_0xe5eb('0x23')][_0xd6f6ff]['queue']]=[];ami['Action']({'actionid':_0xd6f6ff,'action':_0xe5eb('0x1e6'),'queue':_0x47dc03[_0xe5eb('0x3a')]})[_0xe5eb('0xbc')](function(){_0x4fa604[_0xe5eb('0xb8')](_0x47dc03);_0x4fa604[_0xe5eb('0xc4')]({'active':![],'ContactId':_0x4fa604['actions'][_0xd6f6ff][_0xe5eb('0xd9')],'ListId':_0x4fa604[_0xe5eb('0x23')][_0xd6f6ff][_0xe5eb('0xda')],'VoiceQueueId':_0x4fa604[_0xe5eb('0x23')][_0xd6f6ff][_0xe5eb('0xdb')]||undefined,'CampaignId':_0x4fa604[_0xe5eb('0x23')][_0xd6f6ff][_0xe5eb('0xdc')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x4fa604[_0xe5eb('0x23')][_0xd6f6ff];});}else{loggerBooked[_0xe5eb('0x7d')]('[booked][checkContactBlack][else]',JSON[_0xe5eb('0x77')](_0x47dc03['queueStatusComplete']),_0xe5eb('0x1e7'),_0x47dc03['name']);_0x4fa604[_0xe5eb('0xb8')](_0x47dc03);_0x4fa604[_0xe5eb('0xc4')]({'active':![],'ContactId':_0x4fa604[_0xe5eb('0x23')][_0xd6f6ff]['ContactId'],'ListId':_0x4fa604[_0xe5eb('0x23')][_0xd6f6ff][_0xe5eb('0xda')],'VoiceQueueId':_0x4fa604['actions'][_0xd6f6ff][_0xe5eb('0xdb')]||undefined,'CampaignId':_0x4fa604[_0xe5eb('0x23')][_0xd6f6ff]['CampaignId']||undefined})[_0xe5eb('0xbc')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x4fa604[_0xe5eb('0x23')][_0xd6f6ff];}}else{return _0x4fa604[_0xe5eb('0x1e8')](_0x47dc03,_0x27eaa6);}}else{if(getDiff(_0x27eaa6[_0xe5eb('0x1e9')])<_0x47dc03[_0xe5eb('0x1ea')]*0x3c){if(_0x27eaa6[_0xe5eb('0x1eb')]&&!_0x27eaa6[_0xe5eb('0x1eb')][_0xe5eb('0x1ec')]){_0x4fa604[_0xe5eb('0x97')]['run'](_0x27eaa6['id'])[_0xe5eb('0x130')](function(){_0x4fa604[_0xe5eb('0xb8')](_0x47dc03);});}else{_0x4fa604[_0xe5eb('0xc6')]({'active':![]},_0x27eaa6['id'],0x1)[_0xe5eb('0x130')](function(){_0x4fa604[_0xe5eb('0xb8')](_0x47dc03);});}}else{_0x47dc03[_0xe5eb('0x63')]+=0x1;_0x4fa604[_0xe5eb('0xb8')](_0x47dc03);if(_0x47dc03[_0xe5eb('0x1ed')]){_0x4fa604[_0xe5eb('0xc4')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x27eaa6[_0xe5eb('0xd9')],'ListId':_0x27eaa6[_0xe5eb('0xda')],'VoiceQueueId':_0x27eaa6[_0xe5eb('0xdb')]||undefined,'CampaignId':_0x27eaa6[_0xe5eb('0xdc')]||undefined})[_0xe5eb('0xbc')](loggerCatch(_0xe5eb('0x1ee')));_0x4fa604[_0xe5eb('0xd1')](createObjHistory(_0x47dc03,_0x27eaa6,_0xe5eb('0x1ef'),0x17,_0xe5eb('0x1f0')))[_0xe5eb('0xbc')](loggerCatch(_0xe5eb('0x1f1')));}else{_0x4fa604[_0xe5eb('0xd7')](createObjHistory(_0x47dc03,_0x27eaa6,'RECALLFAILEDTIMEOUT',0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]',_0xe5eb('0x1f2'));}}}}else{_0x47dc03[_0xe5eb('0x1f3')]+=0x1;_0x4fa604[_0xe5eb('0xd7')](createObjHistory(_0x47dc03,_0x27eaa6,_0xe5eb('0x1f4'),0xd,_0xe5eb('0x1f5')),_0xe5eb('0x1f6'),_0xe5eb('0x1f7'));throw _0xe5eb('0x1f8');}};};Dialer[_0xe5eb('0xae')]['handleIvr']=function(_0xab0511){var _0x4b8eac=this;var _0x395750=_0xab0511[_0xe5eb('0x1f9')]-_0xab0511['originated']-_0xab0511['temp'];emitCampaignSummary(_0xab0511);if(_0x395750>0x0){if(_0x395750>this[_0xe5eb('0x21')]){_0x395750=this['maxNumberOriginate'];}_0xab0511[_0xe5eb('0xc9')]+=_0x395750;this['getContactDialerIvr'](_0xab0511['id'],_0x395750,_0xab0511[_0xe5eb('0x1fa')],_0xab0511)[_0xe5eb('0xbf')](function(_0x44c066){_0xab0511[_0xe5eb('0xc9')]-=_0x395750;_0xab0511['temp']=_0xab0511['temp']>0x0?_0xab0511[_0xe5eb('0xc9')]:0x0;if(!checkContactEmpty(_0x44c066)){_0xab0511[_0xe5eb('0x39')]=_0xe5eb('0xa4');logger[_0xe5eb('0x7d')]('[getContactCampaign2][Empty]'+_0xab0511[_0xe5eb('0x3a')]);}else{_0xab0511[_0xe5eb('0x70')]+=_0x44c066[_0xe5eb('0x147')];_0xab0511['message']=_0xe5eb('0x1fb');for(var _0x241ffb=0x0;_0x241ffb<_0x44c066['length'];_0x241ffb+=0x1){_0xab0511[_0xe5eb('0x1fc')]+=0x1;if(_[_0xe5eb('0xb2')](_0x44c066[_0x241ffb])||_[_0xe5eb('0xb2')](_0x44c066[_0x241ffb][_0xe5eb('0x163')])||_['isNil'](_0x44c066[_0x241ffb][_0xe5eb('0x163')][_0xe5eb('0x164')])){_0x4b8eac[_0xe5eb('0xd5')](_0xe5eb('0x1fd'),_0xab0511,_0x44c066[_0x241ffb]);}else{_0x4b8eac[_0xe5eb('0x1fe')](_['pick'](_0x44c066[_0x241ffb],[_0xe5eb('0xdc'),_0xe5eb('0x1ff')]))[_0xe5eb('0xbf')](_0x4b8eac[_0xe5eb('0x1e2')](_0xab0511,_0x44c066[_0x241ffb]))[_0xe5eb('0xbc')](_0x4b8eac['loggerHandler']('[actionOriginateIvr]\x20',_0xab0511));}}}})['catch'](loggerGetContactDialer(_0xe5eb('0x200'),_0xab0511,_0x395750));}};Dialer[_0xe5eb('0xae')][_0xe5eb('0x154')]=function(_0x57e186,_0x4de5b8){var _0x493512=this;var _0x2a6bc7=[];var _0x5d5fff=_0x4de5b8>=0x1?_0x4de5b8:0x1;if(_0x57e186[_0xe5eb('0x56')]===_0xe5eb('0x8')){_0x5d5fff=0x1;}var _0x2b72f5=Math[_0xe5eb('0x1c2')](_0x57e186[_0xe5eb('0x4b')]*_0x5d5fff)-_0x57e186[_0xe5eb('0x70')]-_0x57e186[_0xe5eb('0xc9')];emitVoiceQueueSummary(_0x57e186);if(_0x57e186[_0xe5eb('0x201')]>0x0){var _0x355c81=_0x57e186[_0xe5eb('0x201')]-_0x57e186[_0xe5eb('0x70')]-_0x57e186['talking']-_0x57e186[_0xe5eb('0xc9')]-_0x57e186[_0xe5eb('0x4d')];if(_0x2b72f5>_0x355c81){_0x2b72f5=_0x355c81;}}if(_0x2b72f5>0x0){if(_0x57e186[_0xe5eb('0x56')]==='booked'){_0x2b72f5=0x1;}if(_0x2b72f5>this[_0xe5eb('0x21')]){_0x2b72f5=this['maxNumberOriginate'];}_0x57e186[_0xe5eb('0xc9')]+=_0x2b72f5;for(var _0x3887af in this[_0xe5eb('0x1f')]){if(typeof this[_0xe5eb('0x1f')][_0x3887af]!==_0xe5eb('0x9f')){if(this[_0xe5eb('0x1f')][_0x3887af][_0xe5eb('0xab')]===_0xe5eb('0x202')&&this['agents'][_0x3887af][_0xe5eb('0xe2')]==='reachable'){_0x2a6bc7[_0xe5eb('0x128')](this[_0xe5eb('0x1f')][_0x3887af]['id']);}}}this[_0xe5eb('0xc8')](_0x57e186['id'],_0x2a6bc7,_0x2b72f5,_0x57e186[_0xe5eb('0x1fa')],_0x57e186)[_0xe5eb('0xbf')](function(_0xb95c2e){_0x57e186['temp']-=_0x2b72f5;_0x57e186[_0xe5eb('0xc9')]=_0x57e186['temp']>0x0?_0x57e186[_0xe5eb('0xc9')]:0x0;if(!checkContactEmpty(_0xb95c2e)){_0x493512[_0xe5eb('0xbb')](_0x57e186)[_0xe5eb('0xbf')](sendMessageReschedule(_0x57e186))[_0xe5eb('0xbc')](loggerCatch(_0xe5eb('0x203')));}else{_0x57e186[_0xe5eb('0x70')]+=_0xb95c2e[_0xe5eb('0x147')];_0x57e186['message']=_0x57e186[_0xe5eb('0x56')]===_0xe5eb('0x8')?_0xe5eb('0x204'):_0xe5eb('0x1fb');for(var _0x181c23=0x0;_0x181c23<_0xb95c2e[_0xe5eb('0x147')];_0x181c23+=0x1){if(_[_0xe5eb('0xb2')](_0xb95c2e[_0x181c23])||_[_0xe5eb('0xb2')](_0xb95c2e[_0x181c23][_0xe5eb('0x163')])||_[_0xe5eb('0xb2')](_0xb95c2e[_0x181c23][_0xe5eb('0x163')][_0xe5eb('0x164')])){_0x493512['emptyContact'](_0xe5eb('0x1fd'),_0x57e186,_0xb95c2e[_0x181c23]);}else{_0x493512[_0xe5eb('0xbd')](_['pick'](_0xb95c2e[_0x181c23],['VoiceQueueId',_0xe5eb('0x1ff')]))[_0xe5eb('0xbf')](_0x493512['checkContactBlack'](_0x57e186,_0xb95c2e[_0x181c23]))['catch'](_0x493512['loggerHandler'](_0xe5eb('0x1fd'),_0x57e186));}}}})[_0xe5eb('0xbc')](loggerGetContactDialer(_0xe5eb('0x205'),_0x57e186,_0x2b72f5));}};Dialer[_0xe5eb('0xae')][_0xe5eb('0x95')]=function(_0x140c35){if(_0x140c35[_0xe5eb('0x201')]>0x0){var _0x15d0c1=_0x140c35[_0xe5eb('0x201')]-_0x140c35[_0xe5eb('0x70')]-_0x140c35['talking'];if(_0x15d0c1>0x0){this['tryOriginatePredictive'](_0x140c35);}else{loggerPredictiveCalls[_0xe5eb('0x7d')](_0xe5eb('0x206'));}}else{this['tryOriginatePredictive'](_0x140c35);}};Dialer[_0xe5eb('0xae')][_0xe5eb('0x207')]=function(_0x55ce55){var _0x49c329=this;var _0x33056e=[];_0x55ce55[_0xe5eb('0x70')]+=0x1;for(var _0x1b7394 in this[_0xe5eb('0x1f')]){if(typeof this[_0xe5eb('0x1f')][_0x1b7394]!==_0xe5eb('0x9f')){if(this['agents'][_0x1b7394][_0xe5eb('0xab')]===_0xe5eb('0x202')&&this['agents'][_0x1b7394][_0xe5eb('0xe2')]===_0xe5eb('0xe1')){_0x33056e[_0xe5eb('0x128')](this['agents'][_0x1b7394]['id']);}}}this[_0xe5eb('0xc8')](_0x55ce55['id'],_0x33056e,0x1,_0x55ce55[_0xe5eb('0x1fa')],_0x55ce55)[_0xe5eb('0xbf')](function(_0x25aed0){if(!checkContactEmpty(_0x25aed0)){checkContactLowerLimitOriginate(_0x55ce55,0x1,0x0);_0x49c329[_0xe5eb('0xbb')](_0x55ce55)['then'](sendMessageReschedule(_0x55ce55))[_0xe5eb('0xbc')](loggerCatch(_0xe5eb('0x203')));}else{_0x55ce55['message']=_0xe5eb('0x1fb');if(_[_0xe5eb('0xb2')](_0x25aed0[0x0])||_[_0xe5eb('0xb2')](_0x25aed0[0x0][_0xe5eb('0x163')])||_[_0xe5eb('0xb2')](_0x25aed0[0x0][_0xe5eb('0x163')][_0xe5eb('0x164')])){_0x49c329[_0xe5eb('0xd5')](_0xe5eb('0x1fd'),_0x55ce55,_0x25aed0[0x0]);}else{_0x49c329[_0xe5eb('0xbd')](_[_0xe5eb('0xd8')](_0x25aed0[0x0],[_0xe5eb('0xdb'),_0xe5eb('0x1ff')]))[_0xe5eb('0xbf')](_0x49c329[_0xe5eb('0x1e2')](_0x55ce55,_0x25aed0[0x0]))['catch'](_0x49c329[_0xe5eb('0xd4')](_0xe5eb('0x208'),_0x55ce55));}}})['catch'](loggerGetContactDialer(_0xe5eb('0x209'),_0x55ce55,0x1));emitVoiceQueueSummary(_0x55ce55);};Dialer['prototype'][_0xe5eb('0x1d6')]=function(_0x14303b,_0x5ac605,_0x2bf500,_0x2e779e,_0x4af7c4,_0x5d98fd){loggerPredictive[_0xe5eb('0x7d')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xe5eb('0x7d')]('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',_0x14303b);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5ac605);loggerPredictive[_0xe5eb('0x7d')](_0xe5eb('0x20a'),_0x2bf500);loggerPredictive[_0xe5eb('0x7d')]('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',_0x2e779e);loggerPredictive[_0xe5eb('0x7d')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4af7c4);loggerPredictive[_0xe5eb('0x7d')](_0xe5eb('0x90'));return new BPromise(function(_0x15631f,_0x461204){if(_0x14303b<=0x0||isNaN(_0x14303b)){return _0x461204(msgResponse('[abandonmentRate]',_0xe5eb('0x43'),'m\x20=\x20'+_0x14303b));}if(_0x2bf500<=0x0||isNaN(_0x2bf500)){return _0x461204(msgResponse('[abandonmentRate]',_0xe5eb('0x43'),_0xe5eb('0x20b')+_0x2bf500));}if(_0x2e779e<=0x0||isNaN(_0x2e779e)){return _0x461204(msgResponse(_0xe5eb('0x20c'),'Error',_0xe5eb('0x20d')+_0x2e779e));}if(_0x5ac605<=0x0||isNaN(_0x5ac605)){return _0x461204(msgResponse(_0xe5eb('0x20c'),_0xe5eb('0x43'),_0xe5eb('0x20e')+_0x5ac605));}if(_0x4af7c4<=0x0||isNaN(_0x4af7c4)){return _0x461204(msgResponse(_0xe5eb('0x20c'),_0xe5eb('0x43'),'Amax\x20=\x20'+_0x4af7c4));}_0x5d98fd=_0x5d98fd||0x0;var _0x5e06eb=0x1/_0x2bf500;var _0x56c111=0x0;var _0x1bf3d1=0x0;var _0x27e6dd=0x0;var _0x400c0e=0x0;for(var _0x5f749b=0x0;_0x27e6dd<_0x4af7c4;_0x5f749b+=0x1){_0x1bf3d1=_0x5f749b/_0x5ac605;_0x56c111=(_0x2e779e*_0x1bf3d1+_0x5d98fd)/_0x5e06eb;_0x27e6dd=erlangb(_0x56c111,_0x14303b);_0x400c0e=_0x56c111/_0x14303b*(0x1-erlangb(_0x56c111,_0x14303b));}return _0x15631f({'erlangCalls':_0x5f749b,'erlangCallToSecond':_0x5ac605/_0x5f749b,'erlangAbandonmentRate':_0x27e6dd,'erlangBusyFactor':_0x400c0e});});};Dialer[_0xe5eb('0xae')]['busyFactor']=function(_0x419d52,_0x4313e2,_0x34c2b3,_0x52d4a8,_0x249eb1,_0x4710fa){loggerPredictive[_0xe5eb('0x7d')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xe5eb('0x7d')]('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',_0x419d52);loggerPredictive['info'](_0xe5eb('0x20f'),_0x4313e2);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',_0x34c2b3);loggerPredictive[_0xe5eb('0x7d')](_0xe5eb('0x210'),_0x52d4a8);loggerPredictive['info'](_0xe5eb('0x211'),_0x249eb1);loggerPredictive['info'](_0xe5eb('0x90'));return new BPromise(function(_0x441e1e,_0x3d6de9){if(_0x419d52<=0x0||isNaN(_0x419d52)){return _0x3d6de9(msgResponse(_0xe5eb('0x212'),_0xe5eb('0x43'),_0xe5eb('0x213')+_0x419d52));}if(_0x34c2b3<=0x0||isNaN(_0x34c2b3)){return _0x3d6de9(msgResponse(_0xe5eb('0x212'),_0xe5eb('0x43'),'Ts\x20=\x20'+_0x34c2b3));}if(_0x52d4a8<=0x0||isNaN(_0x52d4a8)){return _0x3d6de9(msgResponse('[busyFactor]',_0xe5eb('0x43'),_0xe5eb('0x20d')+_0x52d4a8));}if(_0x4313e2<=0x0||isNaN(_0x4313e2)){return _0x3d6de9(msgResponse('[busyFactor]',_0xe5eb('0x43'),_0xe5eb('0x20e')+_0x4313e2));}if(_0x249eb1<=0x0||isNaN(_0x249eb1)){return _0x3d6de9(msgResponse('[busyFactor]',_0xe5eb('0x43'),'Umin\x20=\x20'+_0x249eb1));}_0x4710fa=_0x4710fa||0x0;var _0x503368=0x1/_0x34c2b3;var _0x2bc372=0x0;var _0x5ea7df=0x0;var _0x40c40f=0x0;var _0x88cd2c=0x0;for(var _0x20f0fc=0x0;_0x88cd2c<_0x249eb1;_0x20f0fc+=0x1){_0x5ea7df=_0x20f0fc/_0x4313e2;_0x2bc372=(_0x52d4a8*_0x5ea7df+_0x4710fa)/_0x503368;_0x40c40f=erlangb(_0x2bc372,_0x419d52);_0x88cd2c=_0x2bc372/_0x419d52*(0x1-erlangb(_0x2bc372,_0x419d52));}return _0x441e1e({'erlangCalls':_0x20f0fc,'erlangCallToSecond':_0x4313e2/_0x20f0fc,'erlangAbandonmentRate':_0x40c40f,'erlangBusyFactor':_0x88cd2c});});};module['exports']=Dialer; \ No newline at end of file +var _0xbec5=['unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','true','content','indexOf','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','dialMethod','progressive','handlePower','power','booked','Queue','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','[syncCampaigns]','replace','random','match','object','voiceQueue\x20is\x20undefine','phone','Contact','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','getCaller','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','tags','createdAt','updatedAt','%s%s','XMD-','callerid','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdName','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialCutDigit','substring','trim','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','[originate][error]','originate','originate\x20action\x20Error','syncOriginateResponse','responsetime','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','Congestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','agentreject','reason\x2020\x20agentreject','Success','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','floor','predictiveIntervalHitRate','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','abandonmentRate','[CatchErlangB]','outboundQueuePauses','busyFactor','check\x20failure','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','scheduledat','dialRecallMeTimeout','voicePause','dialRecallInQueue','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','loggerHandler','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','reachable','Contact.phone','tryOriginatePredictive','[handlePredictive][limitChannel]','[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','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\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]','m\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','moment','md5','ioredis','../preview/util/util','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','../ami','redis','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./final','./agentComplete','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','agents','trunks','maxNumberOriginate','channels','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','agentconnect','bind','queuecallerabandon','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','newexten','syncNewExten','syncVarSet','syncQueueMember','loopCampaigns','loopClearZombieChannels','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','INTERVAL_IS_NULL','Interval','Intervals','\x20INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','stringify','diff','seconds','emit','type','outbound','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','Trunk','active','format','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','milliseconds','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','sendMessageOneNotActive','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','statedesc','endtime','starttime','clearZombieChannels','uniqueId','[uniqueid]','actions','[actions]','Action','channel','catch','updateOriginated','[Dialer][checkChannel]','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','[countReScheduled]\x20','then','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','[emptyContact]','isSuccess','isTrunkReachable','SIP/%s','status','unmonitored','uniqueid','isNil','variable','amdstatus','exten','dialAMDActive','value','HangupInAMD','membername','AMD','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','Machine','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','minutes','YYYY-MM-DD\x20HH:mm:ss','CampaignId','campaigns','HANGUP','custom:amd','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','countabandonedretry','countagentrejectretry','dialMachineRetryFrequency','[rescheduleContact][Machine]','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','outboundUnknownCallsDay','cause-txt','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','dialDropMaxRetry','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','actionid','strategy','paused','stateinterface','locked','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr'];(function(_0x5a9259,_0x4ee26a){var _0x1e3c42=function(_0xae50a3){while(--_0xae50a3){_0x5a9259['push'](_0x5a9259['shift']());}};_0x1e3c42(++_0x4ee26a);}(_0xbec5,0xe5));var _0x5bec=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0xbec5[_0x39e283];return _0x7de89f;};'use strict';var util=require(_0x5bec('0x0'));var _=require(_0x5bec('0x1'));var BPromise=require('bluebird');var uuid=require(_0x5bec('0x2'));var moment=require(_0x5bec('0x3'));var rr=require('rr');var md5=require(_0x5bec('0x4'));var Redis=require(_0x5bec('0x5'));var ut=require(_0x5bec('0x6'));var config=require('../../../config/environment/');var logger=require(_0x5bec('0x7'))(_0x5bec('0x8'));var loggerBooked=require(_0x5bec('0x7'))('booked');var loggerPredictive=require(_0x5bec('0x7'))(_0x5bec('0x9'));var loggerPredictiveCalls=require(_0x5bec('0x7'))(_0x5bec('0xa'));var loggerSyncQueueSummary=require(_0x5bec('0x7'))(_0x5bec('0xb'));var ami=require(_0x5bec('0xc'));config[_0x5bec('0xd')]=_['defaults'](config[_0x5bec('0xd')],{'host':'localhost','port':0x18eb});var io=require(_0x5bec('0xe'))(new Redis(config[_0x5bec('0xd')]));var cmHopper=require(_0x5bec('0xf'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x5bec('0x10'));var voiceQueueRt=require(_0x5bec('0x11'));var Action=require(_0x5bec('0x12'));var History=require('./history');var Final=require(_0x5bec('0x13'));var AgentComplete=require(_0x5bec('0x14'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x5bec('0x15'));var ipAgi=process[_0x5bec('0x16')][_0x5bec('0x17')]||_0x5bec('0x18');var strategy={'rrmemory':_0x5bec('0x19'),'roundrobin':_0x5bec('0x1a')};var Sequence=function(){};Sequence[_0x5bec('0x1b')][_0x5bec('0x1c')]=function(_0x259588){this[_0x5bec('0x1d')]=this[_0x5bec('0x1d')]?this[_0x5bec('0x1d')][_0x5bec('0x1e')](_0x259588):_0x259588();};function Dialer(_0x506639,_0x4ab821){this[_0x5bec('0x1f')]=new Sequence();this[_0x5bec('0x20')]=_0x4ab821;this[_0x5bec('0x21')]=_0x506639[_0x5bec('0x21')];this['campaigns']=_0x506639['campaigns'];this[_0x5bec('0x22')]=_0x506639[_0x5bec('0x22')];this['trunks']=_0x506639[_0x5bec('0x23')];this[_0x5bec('0x24')]=config[_0x5bec('0x24')]||0x2;this[_0x5bec('0x25')]={};this['actions']={};this[_0x5bec('0x26')]={};this['uniqueId']={};this[_0x5bec('0x27')]={};this[_0x5bec('0x28')]={};this[_0x5bec('0x29')]={};this[_0x5bec('0x2a')]={};this[_0x5bec('0x2b')]={};this['queueBookedRR']={};ami['on'](_0x5bec('0x2c'),this['syncAgentConnect'][_0x5bec('0x2d')](this));ami['on'](_0x5bec('0x2e'),this['syncQueueCallerAbandon'][_0x5bec('0x2d')](this));ami['on'](_0x5bec('0x2f'),this['syncOriginateResponse'][_0x5bec('0x2d')](this));ami['on'](_0x5bec('0x30'),this[_0x5bec('0x31')][_0x5bec('0x2d')](this));ami['on'](_0x5bec('0x32'),this[_0x5bec('0xb')][_0x5bec('0x2d')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on'](_0x5bec('0x33'),this[_0x5bec('0x34')][_0x5bec('0x2d')](this));ami['on']('varset',this[_0x5bec('0x35')][_0x5bec('0x2d')](this));ami['on']('queuemember',this[_0x5bec('0x36')][_0x5bec('0x2d')](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete'][_0x5bec('0x2d')](this));this[_0x5bec('0x37')]();this[_0x5bec('0x38')]();}function isNotNull(_0x2c7a7b){return _0x2c7a7b!==null&&!_[_0x5bec('0x39')](_0x2c7a7b);}function checkIsLoggedIn(_0x3f224c,_0x5d6621){return function(){if(_0x5d6621<=0x0){_0x3f224c[_0x5bec('0x3a')]='AGENTS_NOT_LOGGED';throw _0x3f224c[_0x5bec('0x3b')]+_0x5bec('0x3c');}};}function isActive(_0x3034c9){return _0x3034c9;}function checkIsActive(_0x110bd4,_0x5128c0){return function(){if(!isActive(_0x5128c0)){_0x110bd4[_0x5bec('0x3a')]=_0x5bec('0x3d');throw _0x110bd4[_0x5bec('0x3b')]+'\x20NOT\x20Active';}};}function checkInterval(_0xf6ae6b){return function(){if(!isNotNull(_0xf6ae6b['Interval'])){_0xf6ae6b[_0x5bec('0x3a')]=_0x5bec('0x3e');throw _0xf6ae6b[_0x5bec('0x3b')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0xf6ae6b[_0x5bec('0x3f')][_0x5bec('0x40')])){_0xf6ae6b['message']=_0x5bec('0x3e');throw _0xf6ae6b[_0x5bec('0x3b')]+_0x5bec('0x41');}if(!isNotNull(_[_0x5bec('0x42')](_0xf6ae6b[_0x5bec('0x3f')]['Intervals']))){_0xf6ae6b[_0x5bec('0x3a')]='INTERVAL_IS_NULL';throw _0xf6ae6b[_0x5bec('0x3b')]+_0x5bec('0x41');}};}function msgResponse(_0x182b86,_0x7598ab,_0x2e421e){return{'action':_0x182b86,'response':_0x7598ab,'message':_0x2e421e,'stack':_0x2e421e};}function myreject(_0x1923fc){return function(_0x49c8ef){return _0x1923fc(msgResponse(_0x5bec('0x43'),_0x5bec('0x44'),JSON[_0x5bec('0x45')](_0x49c8ef)));};}function getSeconds(_0x5de683,_0x40db29){var _0x355707=moment(_0x5de683)['milliseconds'](0x0);var _0xdb0430=moment(_0x40db29)['milliseconds'](0x0);return _0x355707[_0x5bec('0x46')](_0xdb0430,_0x5bec('0x47'));}function emit(_0x402e5d,_0x49cdfa,_0xd7b727){io['to'](_0x402e5d)[_0x5bec('0x48')](_0x49cdfa,_0xd7b727);}function emitVoiceQueueSummary(_0x43d4e9){if(_0x43d4e9[_0x5bec('0x49')]===_0x5bec('0x4a')){var _0x1be7a7={'id':_0x43d4e9['id'],'name':_0x43d4e9[_0x5bec('0x3b')],'strategy':_0x43d4e9['strategy'],'answered':_0x43d4e9[_0x5bec('0x4b')],'available':_0x43d4e9[_0x5bec('0x4c')],'loggedIn':_0x43d4e9[_0x5bec('0x4d')],'pTalking':_0x43d4e9[_0x5bec('0x4e')],'sumBillable':_0x43d4e9['sumBillable'],'sumDuration':_0x43d4e9[_0x5bec('0x4f')],'sumHoldTime':_0x43d4e9[_0x5bec('0x50')]||0x0,'talking':_0x43d4e9[_0x5bec('0x51')],'total':_0x43d4e9['total'],'type':_0x43d4e9['type'],'unmanaged':_0x43d4e9[_0x5bec('0x52')],'abandoned':_0x43d4e9[_0x5bec('0x53')],'waiting':_0x43d4e9[_0x5bec('0x54')],'loggedInDb':_0x43d4e9[_0x5bec('0x55')],'dialActive':_0x43d4e9[_0x5bec('0x56')],'dialMethod':_0x43d4e9['dialMethod'],'dialOriginateCallerIdName':_0x43d4e9['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x43d4e9[_0x5bec('0x57')],'dialOriginateTimeout':_0x43d4e9['dialOriginateTimeout'],'dialPrefix':_0x43d4e9[_0x5bec('0x58')],'outboundAnswerAgiCallsDay':_0x43d4e9[_0x5bec('0x59')],'outboundAnswerCallsDay':_0x43d4e9[_0x5bec('0x5a')],'outboundBlacklistCallsDay':_0x43d4e9['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x43d4e9[_0x5bec('0x5b')],'outboundCongestionCallsDay':_0x43d4e9[_0x5bec('0x5c')],'outboundDropCallsDayACS':_0x43d4e9['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x43d4e9[_0x5bec('0x5d')],'outboundDropCallsDayTimeout':_0x43d4e9[_0x5bec('0x5e')],'outboundNoAnswerCallsDay':_0x43d4e9[_0x5bec('0x5f')],'outboundNoSuchCallsDay':_0x43d4e9[_0x5bec('0x60')],'outboundOriginateFailureCallsDay':_0x43d4e9[_0x5bec('0x61')],'outboundReCallsDay':_0x43d4e9[_0x5bec('0x62')],'outboundRejectCallsDay':_0x43d4e9[_0x5bec('0x63')],'outboundUnknownCallsDay':_0x43d4e9['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x43d4e9['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x43d4e9[_0x5bec('0x64')],'predictiveIntervalAvgTalktime':_0x43d4e9['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x43d4e9['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x43d4e9[_0x5bec('0x65')],'predictiveIntervalErlangCalls':_0x43d4e9['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x43d4e9['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x43d4e9['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x43d4e9[_0x5bec('0x66')],'predictiveIntervalPauses':_0x43d4e9[_0x5bec('0x67')],'predictiveIntervalAvailable':_0x43d4e9[_0x5bec('0x68')],'predictiveIntervalTotalCalls':_0x43d4e9[_0x5bec('0x69')],'message':_0x43d4e9['message'],'originated':_0x43d4e9[_0x5bec('0x6a')],'erlangCalls':_0x43d4e9[_0x5bec('0x6b')],'erlangCallToSecond':_0x43d4e9[_0x5bec('0x6c')],'erlangAbandonmentRate':_0x43d4e9[_0x5bec('0x6d')],'erlangBusyFactor':_0x43d4e9['erlangBusyFactor'],'startPredictive':_0x43d4e9[_0x5bec('0x28')],'startProgressive':_0x43d4e9[_0x5bec('0x29')]};if(_0x43d4e9[_0x5bec('0x6e')]){_0x1be7a7['Trunk']={'id':_0x43d4e9[_0x5bec('0x6e')]['id'],'name':_0x43d4e9['Trunk'][_0x5bec('0x3b')],'active':_0x43d4e9[_0x5bec('0x6e')][_0x5bec('0x6f')],'callerid':_0x43d4e9[_0x5bec('0x6e')]['callerid']};}if(_0x43d4e9[_0x5bec('0x3f')]){_0x1be7a7[_0x5bec('0x3f')]={'id':_0x43d4e9[_0x5bec('0x3f')]['id'],'name':_0x43d4e9[_0x5bec('0x3f')][_0x5bec('0x3b')]};}var _0x123758=md5(JSON[_0x5bec('0x45')](_0x1be7a7));if(_0x43d4e9['md5']!==_0x123758){_0x43d4e9[_0x5bec('0x4')]=_0x123758;emit(util[_0x5bec('0x70')]('voice:queue:%s',_0x1be7a7[_0x5bec('0x3b')]),_0x5bec('0x71'),_0x1be7a7);}}}function emitCampaignSummary(_0x34ee24){if(_0x34ee24[_0x5bec('0x49')]===_0x5bec('0x72')){emit(util[_0x5bec('0x70')](_0x5bec('0x73'),_0x34ee24['name']),_0x5bec('0x74'),_0x34ee24);}}function checkGetDataPredictive(_0x579cd2){if(isNotNull(_0x579cd2)&&!_[_0x5bec('0x42')](_0x579cd2)){loggerPredictive[_0x5bec('0x75')](_0x5bec('0x76'));loggerPredictive[_0x5bec('0x75')](_0x5bec('0x77'),_0x579cd2[_0x5bec('0x69')]);loggerPredictive[_0x5bec('0x75')](_0x5bec('0x78'),_0x579cd2[_0x5bec('0x79')]);loggerPredictive[_0x5bec('0x75')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x579cd2[_0x5bec('0x65')]);loggerPredictive['info']('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x579cd2[_0x5bec('0x7a')]);loggerPredictive['info']('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x579cd2[_0x5bec('0x64')]);loggerPredictive[_0x5bec('0x75')](_0x5bec('0x7b'),_0x579cd2['predictiveIntervalAvgTalktime']);loggerPredictive[_0x5bec('0x75')](_0x5bec('0x7c'));if(_0x579cd2[_0x5bec('0x69')]>0x0){if(!_[_0x5bec('0x39')](_0x579cd2['predictiveIntervalAvgTalktime'])&&_0x579cd2[_0x5bec('0x7d')]>0x0){return!![];}loggerPredictive[_0x5bec('0x75')](_0x5bec('0x7e'));if(!_[_0x5bec('0x39')](_0x579cd2[_0x5bec('0x64')])&&_0x579cd2[_0x5bec('0x64')]>0x0){return!![];}loggerPredictive[_0x5bec('0x75')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info'](_0x5bec('0x7f'));}}else{loggerPredictive['info'](_0x5bec('0x80'));}return![];}function mergeDataErlangB(_0x7ad053){return function(_0x4bba85){loggerPredictive[_0x5bec('0x75')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x5bec('0x75')](_0x5bec('0x81'),_0x4bba85[_0x5bec('0x6b')]);loggerPredictive[_0x5bec('0x75')](_0x5bec('0x82'),_0x4bba85[_0x5bec('0x6c')]);loggerPredictive[_0x5bec('0x75')](_0x5bec('0x83'),_0x4bba85[_0x5bec('0x6d')]);loggerPredictive[_0x5bec('0x75')](_0x5bec('0x84'),_0x4bba85[_0x5bec('0x85')]);loggerPredictive[_0x5bec('0x75')](_0x5bec('0x83'),_0x4bba85['erlangAbandonmentRate']);loggerPredictive[_0x5bec('0x75')](_0x5bec('0x7c'));_[_0x5bec('0x86')](_0x7ad053,_0x4bba85);};}function getDiff(_0x56a539){var _0x3801e3=moment()[_0x5bec('0x87')](0x0);var _0xfc5d80=moment(_0x56a539)[_0x5bec('0x87')](0x0);return _0x3801e3[_0x5bec('0x46')](_0xfc5d80,'seconds');}function ifInterval(_0x3e3108,_0x11b30c){if(_[_0x5bec('0x39')](_0x11b30c)){return![];}return getDiff(_0x11b30c)<_0x3e3108*0x3c;}function freeVariablesPredictive(_0x2abc02){if(isNotNull(_0x2abc02)){if(!_['isUndefined'](_0x2abc02[_0x5bec('0x29')])){_0x2abc02['startProgressive']=undefined;loggerPredictive[_0x5bec('0x75')](_0x2abc02[_0x5bec('0x3b')],_0x5bec('0x88'));}if(!_[_0x5bec('0x39')](_0x2abc02['startPredictive'])){_0x2abc02[_0x5bec('0x28')]=undefined;loggerPredictive[_0x5bec('0x75')](_0x2abc02[_0x5bec('0x3b')],_0x5bec('0x89'));}if(!_[_0x5bec('0x39')](_0x2abc02[_0x5bec('0x8a')])){clearInterval(_0x2abc02[_0x5bec('0x8a')]);_0x2abc02[_0x5bec('0x8a')]=undefined;loggerPredictive[_0x5bec('0x75')](_0x2abc02[_0x5bec('0x3b')],_0x5bec('0x8b'));}}}function erlangb(_0x42d4e4,_0x65a9e2){if(_0x65a9e2===0x0){return 0x0;}var _0x5d3092=0x1;for(var _0x1e98ee=0x1;_0x1e98ee<=_0x65a9e2;_0x1e98ee+=0x1){_0x5d3092=0x1+_0x5d3092*_0x1e98ee/_0x42d4e4;}return 0x1/_0x5d3092;}function isVoiceQueueOutbound(_0x490d4b){return _0x490d4b===_0x5bec('0x4a');}function isNotPreview(_0x27c160){return _0x27c160!=='preview';}function isCampaignIvr(_0xa7a394){return _0xa7a394==='ivr';}function getCallerId(_0x1a5cb0,_0x1061d3,_0x540e96){if(!_['isUndefined'](_0x540e96)&&typeof _0x540e96===_0x5bec('0x8c')&&!_[_0x5bec('0x42')](_0x540e96)){if(!_[_0x5bec('0x39')](_0x1061d3)&&typeof _0x1061d3===_0x5bec('0x8c')&&!_[_0x5bec('0x42')](_0x1061d3)){return util['format'](_0x5bec('0x8d'),_0x1061d3,_0x540e96);}return util[_0x5bec('0x70')]('\x22%s\x22\x20<%s>',_0x540e96,_0x540e96);}if(!_[_0x5bec('0x39')](_0x1a5cb0)&&typeof _0x1a5cb0===_0x5bec('0x8c')&&!_[_0x5bec('0x42')](_0x1a5cb0)){return _0x1a5cb0;}return _0x5bec('0x8e');}function loggerCatchQueueSummary(_0x572dc5,_0x681503){return function(_0x5e4aae){freeVariablesPredictive(_0x681503);emitVoiceQueueSummary(_0x681503);emitCampaignSummary(_0x681503);loggerSyncQueueSummary[_0x5bec('0x8f')](_0x572dc5,util[_0x5bec('0x90')](_0x5e4aae,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x3ede1d,_0x34e172){return function(_0x31b2c6){loggerPredictive[_0x5bec('0x8f')](_0x34e172[_0x5bec('0x3b')],_0x3ede1d);loggerPredictive[_0x5bec('0x8f')](_0x31b2c6[_0x5bec('0x91')]);freeVariablesPredictive(_0x34e172);};}function loggerCatch(_0x4483a0){return function(_0x36d6f6){logger['error'](_0x4483a0,util['inspect'](_0x36d6f6,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x3c305e){return _0x3c305e&&!_[_0x5bec('0x39')](_0x3c305e)&&_0x3c305e[_0x5bec('0x92')]>0x0;}function decremetOriginate(_0x41bf69){if(!_[_0x5bec('0x39')](_0x41bf69)&&_0x41bf69!==null){if(typeof _0x41bf69[_0x5bec('0x6a')]!==_0x5bec('0x93')){if(_0x41bf69['originated']>0x0){_0x41bf69['originated']-=0x1;}else{logger[_0x5bec('0x8f')](_0x5bec('0x94'));}}}else{logger[_0x5bec('0x8f')](_0x5bec('0x95'));}}function checkContactLowerLimitOriginate(_0x215f9b,_0x2c3baf,_0x17cd00){if(_0x2c3baf>_0x17cd00){for(var _0x31f45b=0x0;_0x31f45b<_0x2c3baf-_0x17cd00;_0x31f45b+=0x1){decremetOriginate(_0x215f9b);}}}function loggerGetContactDialer(_0x132c57,_0x29b7ae,_0x10550a){return function(_0x14b071){checkContactLowerLimitOriginate(_0x29b7ae,_0x10550a,0x0);logger[_0x5bec('0x8f')](_0x132c57,util[_0x5bec('0x90')](_0x14b071,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x282c3b){return function(_0x40a6f3){if(isNotNull(_0x40a6f3)&&isNotNull(_0x40a6f3[0x0])){if(_0x40a6f3[0x0][_0x5bec('0x96')]>0x0){_0x282c3b[_0x5bec('0x3a')]=_0x5bec('0x97');logger[_0x5bec('0x75')]('[getContactDialer2][ReScheduled]'+_0x282c3b[_0x5bec('0x3b')],_0x40a6f3[0x0]['contactsRescheduled'],'contacts');}else{_0x282c3b[_0x5bec('0x3a')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x5bec('0x75')]('[getContactDialer2][Empty]'+_0x282c3b['name']);}}};}function notSendMessagesQueue(_0x2e849b){if(_0x2e849b[_0x5bec('0x98')]){freeVariablesPredictive(_0x2e849b);if(_0x2e849b['originated']===0x0&&_0x2e849b[_0x5bec('0x51')]===0x0&&_0x2e849b[_0x5bec('0x54')]===0x0&&(_0x2e849b[_0x5bec('0x4e')]||0x0)===0x0){_0x2e849b[_0x5bec('0x98')]=![];_0x2e849b[_0x5bec('0x4c')]=0x0;_0x2e849b[_0x5bec('0x3a')]=_0x5bec('0x3d');loggerSyncQueueSummary[_0x5bec('0x8f')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x2e849b['name'],_0x5bec('0x99'));}else{_0x2e849b[_0x5bec('0x3a')]=_0x5bec('0x9a');loggerSyncQueueSummary[_0x5bec('0x8f')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x2e849b[_0x5bec('0x3b')],'is\x20disactive');}emitVoiceQueueSummary(_0x2e849b);}}function notSendMessagesCampaign(_0x44ceec){if(_0x44ceec[_0x5bec('0x98')]){if(_0x44ceec[_0x5bec('0x6a')]===0x0){_0x44ceec[_0x5bec('0x98')]=![];_0x44ceec[_0x5bec('0x3a')]=_0x5bec('0x3d');loggerSyncQueueSummary[_0x5bec('0x8f')](_0x5bec('0x9b'),_0x44ceec['name'],_0x5bec('0x99'));}else{_0x44ceec[_0x5bec('0x3a')]=_0x5bec('0x9a');loggerSyncQueueSummary[_0x5bec('0x8f')](_0x5bec('0x9b'),_0x44ceec['name'],_0x5bec('0x9c'));}emitCampaignSummary(_0x44ceec);}}function createObjHistory(_0x3d5e9d,_0x5c124d,_0x195c12,_0x56fa9d,_0xd93c70){_0x3d5e9d[_0x5bec('0x3a')]=_0x195c12;var _0x4646a3=new Action(_0x3d5e9d,_0x5c124d);var _0x313e1c=new History(_0x4646a3);_0x313e1c[_0x5bec('0x9d')]=_0x56fa9d;_0x313e1c[_0x5bec('0x9e')]=_0xd93c70;_0x313e1c[_0x5bec('0x9f')]=_0x4646a3[_0x5bec('0xa0')];return _0x313e1c;}Dialer[_0x5bec('0x1b')][_0x5bec('0x38')]=function(){var _0x1c44f5=this;setInterval(function(){_0x1c44f5[_0x5bec('0xa1')](_0x1c44f5[_0x5bec('0xa2')],_0x5bec('0xa3'));_0x1c44f5[_0x5bec('0xa1')](_0x1c44f5[_0x5bec('0xa4')],_0x5bec('0xa5'));},0x32c8);};Dialer[_0x5bec('0x1b')]['clearZombieChannels']=function(_0x1aa391,_0x4d178b){var _0x3c8ab9=this;for(var _0xfcef92 in _0x1aa391){if(typeof _0x1aa391[_0xfcef92]!=='undefined'){this['sequence'][_0x5bec('0x1c')](function(){if(!_['isNil'](_0x1aa391[_0xfcef92])){return ami[_0x5bec('0xa6')]({'action':'status','channel':_0x1aa391[_0xfcef92][_0x5bec('0xa7')]})[_0x5bec('0xa8')](function(_0x5c26b9){if(_0x5c26b9[_0x5bec('0x3a')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x1aa391[_0xfcef92]&&_0x1aa391[_0xfcef92][_0x5bec('0x49')]!=='ivr'){_0x3c8ab9[_0x5bec('0xa9')](_0x3c8ab9[_0x5bec('0x21')][_0x1aa391[_0xfcef92]['queue']]);logger[_0x5bec('0x8f')](_0x5bec('0xaa'),_0x4d178b,_0xfcef92,_0x1aa391[_0xfcef92][_0x5bec('0xab')]);delete _0x1aa391[_0xfcef92];}if(_0x1aa391[_0xfcef92]&&_0x1aa391[_0xfcef92][_0x5bec('0x49')]===_0x5bec('0x72')){_0x3c8ab9[_0x5bec('0xa9')](_0x3c8ab9['campaigns'][_0x1aa391[_0xfcef92][_0x5bec('0xab')]]);logger['error'](_0x5bec('0xac'),_0x4d178b,_0xfcef92,_0x1aa391[_0xfcef92]['queue']);delete _0x1aa391[_0xfcef92];}},0x2328);}});}});}}};Dialer['prototype'][_0x5bec('0xad')]=function(_0xf82ec2){return BPromise[_0x5bec('0xae')]()['then'](cmHopper[_0x5bec('0xad')](_0xf82ec2))[_0x5bec('0xa8')](loggerCatch(_0x5bec('0xaf')));};Dialer[_0x5bec('0x1b')]['checkIsBlackList']=function(_0x2c7ffa){return BPromise[_0x5bec('0xae')]()[_0x5bec('0xb0')](cmHopperBlack[_0x5bec('0xb1')](_0x2c7ffa))['catch'](loggerCatch(_0x5bec('0xb2')));};Dialer[_0x5bec('0x1b')][_0x5bec('0xb3')]=function(_0x268680){return BPromise[_0x5bec('0xae')]()[_0x5bec('0xb0')](cmHopperBlack[_0x5bec('0xb3')](_0x268680))[_0x5bec('0xa8')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x5bec('0x1b')][_0x5bec('0xb4')]=function(_0x38815d){return BPromise[_0x5bec('0xae')]()[_0x5bec('0xb0')](cmHopperHistory['avgHandleTime'](_0x38815d))[_0x5bec('0xa8')](loggerCatch(_0x5bec('0xb5')));};Dialer['prototype'][_0x5bec('0xb6')]=function(_0x528102){return BPromise[_0x5bec('0xae')]()[_0x5bec('0xb0')](cmHopper[_0x5bec('0xb6')](_0x528102))[_0x5bec('0xa8')](loggerCatch(_0x5bec('0xb7')));};Dialer['prototype'][_0x5bec('0xb8')]=function(_0x2db4fe,_0x3cee19,_0x98b146){return BPromise[_0x5bec('0xae')]()[_0x5bec('0xb0')](cmHopper[_0x5bec('0xb8')](_0x2db4fe,_0x3cee19,_0x98b146))[_0x5bec('0xa8')](loggerCatch(_0x5bec('0xb9')));};Dialer['prototype'][_0x5bec('0xba')]=function(_0x160d40,_0x187416,_0x52b869,_0x56af8f,_0x1b7573){return BPromise[_0x5bec('0xae')]()['then'](cmHopper[_0x5bec('0xba')](_0x160d40,_0x187416,_0x52b869,_0x56af8f))['catch'](function(_0x862da3){_0x1b7573['temp']-=_0x52b869;_0x1b7573[_0x5bec('0xbb')]=_0x1b7573['temp']>0x0?_0x1b7573[_0x5bec('0xbb')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x862da3);});};Dialer[_0x5bec('0x1b')]['getContactDialerIvr']=function(_0x209f2d,_0x271067,_0x4c149f,_0x2b8227){return BPromise[_0x5bec('0xae')]()['then'](cmHopper[_0x5bec('0xbc')](_0x209f2d,_0x271067,_0x4c149f))[_0x5bec('0xa8')](function(_0x384aea){_0x2b8227[_0x5bec('0xbb')]-=_0x271067;_0x2b8227[_0x5bec('0xbb')]=_0x2b8227[_0x5bec('0xbb')]>0x0?_0x2b8227[_0x5bec('0xbb')]:0x0;loggerCatch(_0x5bec('0xbd'))(_0x384aea);});};Dialer[_0x5bec('0x1b')]['getVoiceQueueRtPauses']=function(_0x4e46ed){return BPromise['resolve']()['then'](voiceQueueRt[_0x5bec('0xbe')](_0x4e46ed))['catch'](loggerCatch(_0x5bec('0xbf')));};Dialer['prototype'][_0x5bec('0xc0')]=function(_0x36faae){return BPromise[_0x5bec('0xae')]()['then'](cmHopper[_0x5bec('0xc0')](_0x36faae))['catch'](loggerCatch(_0x5bec('0xc1')));};Dialer[_0x5bec('0x1b')][_0x5bec('0xc2')]=function(_0x4082c2){return BPromise[_0x5bec('0xae')]()[_0x5bec('0xb0')](cmHopperHistory[_0x5bec('0xc2')](_0x4082c2))['catch'](loggerCatch(_0x5bec('0xc3')));};Dialer[_0x5bec('0x1b')][_0x5bec('0xa9')]=function(_0xadaafb){if(!_['isUndefined'](_0xadaafb)&&_0xadaafb!==null){if(typeof _0xadaafb[_0x5bec('0x6a')]!==_0x5bec('0x93')){if(_0xadaafb[_0x5bec('0x6a')]>0x0){_0xadaafb[_0x5bec('0x6a')]-=0x1;}else{logger[_0x5bec('0x8f')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer['prototype']['loggerHandler']=function(_0xd8e688,_0x4c9a52){var _0x3cbca3=this;return function(_0x1e7eec){_0x3cbca3['updateOriginated'](_0x4c9a52);logger[_0x5bec('0x8f')](_0xd8e688,util[_0x5bec('0x90')](_0x1e7eec,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x5bec('0xc4')]=function(_0x34931a,_0x4568fd,_0x1fe43c){var _0xc7c50a={'state':0x19,'statedesc':_0x5bec('0xc5')};this[_0x5bec('0xa9')](_0x4568fd);this[_0x5bec('0xc6')](_['merge'](_0xc7c50a,_[_0x5bec('0xc7')](_0x1fe43c,[_0x5bec('0xc8'),_0x5bec('0xc9'),_0x5bec('0xca'),_0x5bec('0xcb'),'CampaignId'])),'[emptyContact][createHistory]',_0x5bec('0xcc'));logger[_0x5bec('0x8f')](_0x34931a);};Dialer[_0x5bec('0x1b')][_0x5bec('0xcd')]=function(_0x3f40b8){return _0x3f40b8==='Success';};Dialer[_0x5bec('0x1b')][_0x5bec('0xce')]=function(_0x502346){return!_[_0x5bec('0x39')](_0x502346)&&_0x502346&&!_[_0x5bec('0x39')](_0x502346['name'])&&!_[_0x5bec('0x39')](_0x502346[_0x5bec('0x6f')])&&_0x502346[_0x5bec('0x6f')]&&(this[_0x5bec('0x23')][util[_0x5bec('0x70')]('SIP/%s',_0x502346['name'])]['status']==='reachable'||this[_0x5bec('0x23')][util[_0x5bec('0x70')](_0x5bec('0xcf'),_0x502346[_0x5bec('0x3b')])][_0x5bec('0xd0')]===_0x5bec('0xd1'));};Dialer['prototype']['saveInDb']=function(_0x3da745,_0x8d8363,_0x4b4142){this['createHistory'](_0x3da745)[_0x5bec('0xa8')](loggerCatch(_0x8d8363));this[_0x5bec('0xc0')](_0x3da745)['catch'](loggerCatch(_0x4b4142));};Dialer[_0x5bec('0x1b')][_0x5bec('0x35')]=function(_0x17214f){var _0xa8d9c3=this[_0x5bec('0xa2')][_0x17214f[_0x5bec('0xd2')]];var _0x113d2d;if(!_['isNil'](_0x17214f)&&!_[_0x5bec('0xd3')](_0x17214f['variable'])&&!_['isNil'](_0x17214f[_0x5bec('0xd4')][_0x5bec('0xd5')])&&_0x17214f[_0x5bec('0xd6')]==='xcally-motion-dialer'&&_0xa8d9c3){if(_0xa8d9c3['type']!==_0x5bec('0x72')&&this[_0x5bec('0x21')][_0xa8d9c3[_0x5bec('0xab')]][_0x5bec('0xd7')]&&_0x17214f[_0x5bec('0xd8')]==='HANGUP'){delete this[_0x5bec('0xa2')][_0x17214f[_0x5bec('0xd2')]];this[_0x5bec('0xa9')](this['voiceQueues'][_0xa8d9c3[_0x5bec('0xab')]]);this[_0x5bec('0x21')][_0xa8d9c3['queue']][_0x5bec('0x5a')]+=0x1;this[_0x5bec('0x21')][_0xa8d9c3[_0x5bec('0xab')]][_0x5bec('0x59')]+=0x1;_0x113d2d=new Hangup(_0xa8d9c3,_0x17214f);_0x113d2d[_0x5bec('0x9d')]=0x12;_0x113d2d[_0x5bec('0x9e')]=_0x5bec('0xd9');_0x113d2d[_0x5bec('0xda')]=_0x5bec('0xdb');ami[_0x5bec('0x48')]('custom:amd',ut[_0x5bec('0xdc')](_0x113d2d,_0x5bec('0xdd')));this[_0x5bec('0xc6')](_0x113d2d,_0x5bec('0xde'),_0x5bec('0xdf'));}if(_0xa8d9c3['type']!==_0x5bec('0x72')&&this[_0x5bec('0x21')][_0xa8d9c3['queue']][_0x5bec('0xd7')]&&_0x17214f[_0x5bec('0xd8')]==='MACHINE'){var _0xd008ba=this;return new BPromise(function(_0x45e155,_0x2b6322){delete _0xd008ba['uniqueId'][_0x17214f[_0x5bec('0xd2')]];_0xd008ba[_0x5bec('0xa9')](_0xd008ba[_0x5bec('0x21')][_0xa8d9c3[_0x5bec('0xab')]]);_0xd008ba['voiceQueues'][_0xa8d9c3[_0x5bec('0xab')]][_0x5bec('0x5a')]+=0x1;_0xd008ba[_0x5bec('0x21')][_0xa8d9c3[_0x5bec('0xab')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x44bf6d=_0xd008ba[_0x5bec('0x21')][_0xa8d9c3[_0x5bec('0xab')]];var _0x352c13=new Hangup(_0xa8d9c3,_0x17214f);_0x352c13[_0x5bec('0x9d')]=0x13;_0x352c13[_0x5bec('0x9e')]=_0x5bec('0xe0');_0x352c13[_0x5bec('0xda')]=_0x5bec('0xdb');_0x352c13[_0x5bec('0xe1')]+=0x1;_0x352c13[_0x5bec('0xe2')]+=0x1;_0x352c13[_0x5bec('0xdd')]=!![];ami[_0x5bec('0x48')]('custom:amd',ut['buildObj'](_0x352c13,_0x5bec('0xdd')));_0xd008ba['createHistory'](_0x352c13)['catch'](loggerCatch(_0x5bec('0xe3')));if(_0x352c13[_0x5bec('0xe4')]+_0x352c13[_0x5bec('0xe5')]+_0x352c13[_0x5bec('0xe6')]+_0x352c13[_0x5bec('0xe7')]+_0x352c13[_0x5bec('0xe8')]+_0x352c13['countabandonedretry']+_0x352c13[_0x5bec('0xe1')]+_0x352c13['countagentrejectretry']>=_0x44bf6d[_0x5bec('0xe9')]){_0xd008ba[_0x5bec('0xea')](_0x352c13,_0x45e155,_0x2b6322,_0x5bec('0xeb'));}else{if(_0x352c13['countmachineretry']>=_0x44bf6d[_0x5bec('0xec')]){_0xd008ba[_0x5bec('0xed')](_0x352c13,_0x45e155,_0x2b6322,_0x5bec('0xee'));}else{_0xd008ba['rescheduleContact']({'active':![],'countmachineretry':_0x352c13[_0x5bec('0xe1')],'scheduledat':moment()[_0x5bec('0xef')](_0x44bf6d['dialMachineRetryFrequency'],_0x5bec('0xf0'))['format'](_0x5bec('0xf1')),'ContactId':_0x352c13[_0x5bec('0xc8')],'ListId':_0x352c13['ListId'],'VoiceQueueId':_0x352c13[_0x5bec('0xcb')]||undefined,'CampaignId':_0x352c13[_0x5bec('0xf2')]||undefined})[_0x5bec('0xa8')](loggerCatch('[rescheduleContact][Machine]'));_0x45e155({'reschedule':0x1});}}});}if(_0xa8d9c3[_0x5bec('0x49')]===_0x5bec('0x72')&&this[_0x5bec('0xf3')][_0xa8d9c3[_0x5bec('0xab')]][_0x5bec('0xd7')]&&_0x17214f[_0x5bec('0xd8')]===_0x5bec('0xf4')){delete this[_0x5bec('0xa2')][_0x17214f[_0x5bec('0xd2')]];this[_0x5bec('0xa9')](this[_0x5bec('0xf3')][_0xa8d9c3['queue']]);_0x113d2d=new Hangup(_0xa8d9c3,_0x17214f);_0x113d2d['state']=0x12;_0x113d2d[_0x5bec('0x9e')]=_0x5bec('0xd9');_0x113d2d['membername']='AMD';ami[_0x5bec('0x48')](_0x5bec('0xf5'),ut[_0x5bec('0xdc')](_0x113d2d,_0x5bec('0xdd')));this[_0x5bec('0xc6')](_0x113d2d,_0x5bec('0xf6'),_0x5bec('0xf7'));}if(_0xa8d9c3['type']===_0x5bec('0x72')&&this['campaigns'][_0xa8d9c3[_0x5bec('0xab')]][_0x5bec('0xd7')]&&_0x17214f[_0x5bec('0xd8')]===_0x5bec('0xf8')){var _0xd008ba=this;return new BPromise(function(_0x3d89df,_0x3889a7){delete _0xd008ba['uniqueId'][_0x17214f[_0x5bec('0xd2')]];_0xd008ba['updateOriginated'](_0xd008ba[_0x5bec('0xf3')][_0xa8d9c3[_0x5bec('0xab')]]);_0xd008ba['campaigns'][_0xa8d9c3['queue']]['outboundAnswerCallsDay']+=0x1;_0xd008ba[_0x5bec('0xf3')][_0xa8d9c3['queue']][_0x5bec('0x59')]+=0x1;var _0x1c6d9c=_0xd008ba[_0x5bec('0xf3')][_0xa8d9c3[_0x5bec('0xab')]];var _0x5e70f7=new Hangup(_0xa8d9c3,_0x17214f);_0x5e70f7[_0x5bec('0x9d')]=0x13;_0x5e70f7[_0x5bec('0x9e')]='Machine';_0x5e70f7[_0x5bec('0xda')]=_0x5bec('0xdb');_0x5e70f7['countmachineretry']+=0x1;_0x5e70f7['countglobal']+=0x1;_0x5e70f7[_0x5bec('0xdd')]=!![];ami[_0x5bec('0x48')](_0x5bec('0xf5'),ut['buildObj'](_0x5e70f7,_0x5bec('0xdd')));_0xd008ba['createHistory'](_0x5e70f7)[_0x5bec('0xa8')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x5e70f7[_0x5bec('0xe4')]+_0x5e70f7['countcongestionretry']+_0x5e70f7['countnoanswerretry']+_0x5e70f7[_0x5bec('0xe7')]+_0x5e70f7['countdropretry']+_0x5e70f7[_0x5bec('0xf9')]+_0x5e70f7['countmachineretry']+_0x5e70f7[_0x5bec('0xfa')]>=_0x1c6d9c[_0x5bec('0xe9')]){_0xd008ba[_0x5bec('0xea')](_0x5e70f7,_0x3d89df,_0x3889a7,_0x5bec('0xeb'));}else{if(_0x5e70f7[_0x5bec('0xe1')]>=_0x1c6d9c[_0x5bec('0xec')]){_0xd008ba['createStateFinal'](_0x5e70f7,_0x3d89df,_0x3889a7,_0x5bec('0xee'));}else{_0xd008ba['rescheduleContact']({'active':![],'countmachineretry':_0x5e70f7[_0x5bec('0xe1')],'scheduledat':moment()[_0x5bec('0xef')](_0x1c6d9c[_0x5bec('0xfb')],_0x5bec('0xf0'))[_0x5bec('0x70')](_0x5bec('0xf1')),'ContactId':_0x5e70f7[_0x5bec('0xc8')],'ListId':_0x5e70f7[_0x5bec('0xc9')],'VoiceQueueId':_0x5e70f7[_0x5bec('0xcb')]||undefined,'CampaignId':_0x5e70f7[_0x5bec('0xf2')]||undefined})[_0x5bec('0xa8')](loggerCatch(_0x5bec('0xfc')));_0x3d89df({'reschedule':0x1});}}});}}};Dialer[_0x5bec('0x1b')][_0x5bec('0xfd')]=function(_0x1ed888){var _0x3ee1e6=this[_0x5bec('0xa2')][_0x1ed888[_0x5bec('0xd2')]];var _0x32b146=this;var _0x36c5ba;if(_0x3ee1e6&&_0x3ee1e6[_0x5bec('0x49')]==='ivr'){delete this[_0x5bec('0xa2')][_0x1ed888['uniqueid']];this[_0x5bec('0xa9')](this[_0x5bec('0xf3')][_0x3ee1e6[_0x5bec('0xab')]]);this['campaigns'][_0x3ee1e6['queue']][_0x5bec('0xfe')]+=0x1;_0x36c5ba=new Hangup(_0x3ee1e6,_0x1ed888);this['createHistory'](_0x36c5ba)[_0x5bec('0xa8')](loggerCatch(_0x5bec('0xff')));this['moveContactManagedDialer'](_0x36c5ba)[_0x5bec('0xa8')](loggerCatch('[syncHangupIvr]'));}if(_0x3ee1e6&&_0x3ee1e6[_0x5bec('0x49')]!==_0x5bec('0x72')&&isNotNull(this['voiceQueues'][_0x3ee1e6[_0x5bec('0xab')]]['dialQueueProject'])){delete this[_0x5bec('0xa2')][_0x1ed888['uniqueid']];this[_0x5bec('0xa9')](this[_0x5bec('0x21')][_0x3ee1e6[_0x5bec('0xab')]]);this[_0x5bec('0x21')][_0x3ee1e6[_0x5bec('0xab')]]['outboundAnswerCallsDay']+=0x1;this[_0x5bec('0x21')][_0x3ee1e6[_0x5bec('0xab')]][_0x5bec('0x59')]+=0x1;_0x36c5ba=new Hangup(_0x3ee1e6,_0x1ed888);_0x36c5ba['state']=0x10;_0x36c5ba[_0x5bec('0x9e')]='AnswerAGI';_0x36c5ba[_0x5bec('0xda')]='AGI';this[_0x5bec('0xc2')](_0x36c5ba)[_0x5bec('0xa8')](loggerCatch(_0x5bec('0xff')));this['moveContactManagedDialer'](_0x36c5ba)['catch'](loggerCatch(_0x5bec('0x100')));}if(_0x3ee1e6&&_0x3ee1e6[_0x5bec('0x49')]!==_0x5bec('0x72')&&!isNotNull(this['voiceQueues'][_0x3ee1e6['queue']][_0x5bec('0x101')])){delete this[_0x5bec('0xa2')][_0x1ed888['uniqueid']];this[_0x5bec('0xa9')](this[_0x5bec('0x21')][_0x3ee1e6[_0x5bec('0xab')]]);this[_0x5bec('0x21')][_0x3ee1e6['queue']][_0x5bec('0x102')]+=0x1;_0x36c5ba=new Hangup(_0x3ee1e6,_0x1ed888);_0x36c5ba['state']=0xc;_0x36c5ba['statedesc']=_0x1ed888[_0x5bec('0x103')];_0x36c5ba[_0x5bec('0xda')]='Unknow';this[_0x5bec('0xc2')](_0x36c5ba)[_0x5bec('0xa8')](loggerCatch(_0x5bec('0xff')));this['moveContactManagedDialer'](_0x36c5ba)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x5bec('0x1b')][_0x5bec('0x31')]=function(_0x41b127){var _0x2839ad=this['uniqueId'][_0x41b127[_0x5bec('0xd2')]];var _0x5d8a40=this;if(this[_0x5bec('0x21')][_0x41b127[_0x5bec('0xab')]]){if(_0x2839ad&&_0x2839ad[_0x5bec('0x49')]!==_0x5bec('0x72')){delete this['uniqueId'][_0x41b127[_0x5bec('0xd2')]];this[_0x5bec('0x21')][_0x41b127[_0x5bec('0xab')]]['outboundAnswerCallsDay']+=0x1;var _0x2ab5f3=new AgentComplete(_0x2839ad,_0x41b127);if(_0x41b127[_0x5bec('0x104')]===_0x5bec('0x105')){_0x2ab5f3[_0x5bec('0x106')]=this[_0x5bec('0x21')][_0x41b127[_0x5bec('0xab')]][_0x5bec('0x107')]&&this[_0x5bec('0x21')][_0x41b127[_0x5bec('0xab')]][_0x5bec('0x108')]?moment()[_0x5bec('0x70')](_0x5bec('0xf1')):undefined;}this['createHistory'](_0x2ab5f3)[_0x5bec('0xa8')](loggerCatch(_0x5bec('0x109')));this[_0x5bec('0xc0')](_0x2ab5f3)[_0x5bec('0xa8')](loggerCatch(_0x5bec('0x10a')));}}};Dialer[_0x5bec('0x1b')][_0x5bec('0x10b')]=function(_0x40a94d){if(this[_0x5bec('0x21')][_0x40a94d['queue']]){if(this[_0x5bec('0xa2')][_0x40a94d[_0x5bec('0xd2')]]&&this[_0x5bec('0xa2')][_0x40a94d['uniqueid']]['type']!==_0x5bec('0x72')){this[_0x5bec('0xa9')](this['voiceQueues'][_0x40a94d[_0x5bec('0xab')]]);this[_0x5bec('0xa2')][_0x40a94d[_0x5bec('0xd2')]][_0x5bec('0x10c')]=moment()[_0x5bec('0x70')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x5bec('0x1b')][_0x5bec('0x10d')]=function(_0x435f1f){this['createHistory'](_0x435f1f)[_0x5bec('0xa8')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x5bec('0xc0')](_0x435f1f)[_0x5bec('0xa8')](loggerCatch(_0x5bec('0x10e')));};Dialer[_0x5bec('0x1b')]['syncQueueCallerAbandon']=function(_0x4e6f3e){var _0xa30c49=this[_0x5bec('0xa2')][_0x4e6f3e[_0x5bec('0xd2')]];var _0x41bb0c=this;if(this[_0x5bec('0x21')][_0x4e6f3e['queue']]){if(_0xa30c49&&_0xa30c49[_0x5bec('0x49')]!==_0x5bec('0x72')){delete this[_0x5bec('0xa2')][_0x4e6f3e[_0x5bec('0xd2')]];this['updateOriginated'](this[_0x5bec('0x21')][_0x4e6f3e[_0x5bec('0xab')]]);_0xa30c49[_0x5bec('0x10f')]=moment()[_0x5bec('0x70')](_0x5bec('0xf1'));var _0x3f02bb=new QueueCallerAbandon(_0xa30c49,_0x4e6f3e);if(getSeconds(_0xa30c49[_0x5bec('0x10f')],_0xa30c49['responsetime'])>=_0xa30c49[_0x5bec('0x110')]){this['voiceQueues'][_0x4e6f3e['queue']][_0x5bec('0x65')]+=0x1;this[_0x5bec('0x21')][_0x4e6f3e[_0x5bec('0xab')]][_0x5bec('0x5e')]+=0x1;this[_0x5bec('0x21')][_0x4e6f3e[_0x5bec('0xab')]][_0x5bec('0x111')]+=0x1;_0x3f02bb[_0x5bec('0x9d')]=0xa;_0x3f02bb['statedesc']=_0x5bec('0x112');_0x3f02bb[_0x5bec('0x113')]='TIMEOUT';_0x3f02bb[_0x5bec('0x106')]=this['voiceQueues'][_0x4e6f3e[_0x5bec('0xab')]][_0x5bec('0x107')]?moment()[_0x5bec('0x70')](_0x5bec('0xf1')):undefined;_0x3f02bb[_0x5bec('0xe8')]+=0x1;_0x3f02bb['countglobal']+=0x1;if(_0x3f02bb[_0x5bec('0xe8')]>=this[_0x5bec('0x21')][_0x4e6f3e[_0x5bec('0xab')]][_0x5bec('0x114')]){this[_0x5bec('0x10d')](_0x3f02bb);}else{this[_0x5bec('0xb6')]({'active':![],'countdropretry':_0x3f02bb[_0x5bec('0xe8')],'scheduledat':moment()[_0x5bec('0xef')](this['voiceQueues'][_0x4e6f3e[_0x5bec('0xab')]]['dialDropRetryFrequency'],_0x5bec('0xf0'))[_0x5bec('0x70')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xa30c49['ContactId'],'ListId':_0xa30c49[_0x5bec('0xc9')],'VoiceQueueId':_0xa30c49[_0x5bec('0xcb')]||undefined,'CampaignId':_0xa30c49[_0x5bec('0xf2')]||undefined})['catch'](loggerCatch(_0x5bec('0x115')));var _0x5221a8=new History(_0x3f02bb);_0x5221a8[_0x5bec('0x9d')]=0xa;_0x5221a8[_0x5bec('0x9e')]=_0x5bec('0x112');_0x5221a8[_0x5bec('0xa0')]=moment()['format'](_0x5bec('0xf1'));_0x5221a8[_0x5bec('0x9f')]=_0x5221a8[_0x5bec('0xa0')];_0x5221a8[_0x5bec('0x116')]=_0x3f02bb['calleridname'];_0x5221a8[_0x5bec('0x117')]=_0x3f02bb[_0x5bec('0x117')];this[_0x5bec('0xc2')](_0x5221a8)[_0x5bec('0xa8')](loggerCatch(_0x5bec('0x118')));}}else{this['voiceQueues'][_0x4e6f3e[_0x5bec('0xab')]][_0x5bec('0x7a')]+=0x1;this['voiceQueues'][_0x4e6f3e[_0x5bec('0xab')]]['outboundDropCallsDayCallersExit']+=0x1;_0x3f02bb[_0x5bec('0x9d')]=0xb;_0x3f02bb[_0x5bec('0x9e')]=_0x5bec('0x119');_0x3f02bb[_0x5bec('0x113')]=_0x5bec('0x11a');_0x3f02bb[_0x5bec('0xf9')]+=0x1;_0x3f02bb[_0x5bec('0xe2')]+=0x1;if(_0x3f02bb[_0x5bec('0xf9')]>=this[_0x5bec('0x21')][_0x4e6f3e[_0x5bec('0xab')]][_0x5bec('0x11b')]){this[_0x5bec('0x10d')](_0x3f02bb);}else{this[_0x5bec('0xb6')]({'active':![],'countabandonedretry':_0x3f02bb[_0x5bec('0xf9')],'scheduledat':moment()[_0x5bec('0xef')](this[_0x5bec('0x21')][_0x4e6f3e[_0x5bec('0xab')]][_0x5bec('0x11c')],'minutes')[_0x5bec('0x70')](_0x5bec('0xf1')),'ContactId':_0xa30c49['ContactId'],'ListId':_0xa30c49['ListId'],'VoiceQueueId':_0xa30c49[_0x5bec('0xcb')]||undefined,'CampaignId':_0xa30c49[_0x5bec('0xf2')]||undefined})[_0x5bec('0xa8')](loggerCatch(_0x5bec('0x11d')));var _0x5221a8=new History(_0x3f02bb);_0x5221a8[_0x5bec('0x9d')]=0xb;_0x5221a8[_0x5bec('0x9e')]='Abandoned';_0x5221a8[_0x5bec('0xa0')]=moment()[_0x5bec('0x70')](_0x5bec('0xf1'));_0x5221a8[_0x5bec('0x9f')]=_0x5221a8[_0x5bec('0xa0')];_0x5221a8[_0x5bec('0x116')]=_0x3f02bb[_0x5bec('0x116')];_0x5221a8['calleridnum']=_0x3f02bb['calleridnum'];this[_0x5bec('0xc2')](_0x5221a8)[_0x5bec('0xa8')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0x5bec('0x1b')][_0x5bec('0x34')]=function(_0x568a42){if(this[_0x5bec('0xa4')][_0x568a42[_0x5bec('0xd2')]]){this[_0x5bec('0xa4')][_0x568a42['uniqueid']]['channel']=_0x568a42['channel'];}if(this[_0x5bec('0xa2')][_0x568a42[_0x5bec('0xd2')]]){this['uniqueId'][_0x568a42[_0x5bec('0xd2')]]['channel']=_0x568a42[_0x5bec('0xa7')];}};Dialer[_0x5bec('0x1b')][_0x5bec('0x36')]=function(_0x27fb59){if(strategy[this['voiceQueues'][this[_0x5bec('0xa4')][_0x27fb59[_0x5bec('0x11e')]][_0x5bec('0xab')]][_0x5bec('0x11f')]]===_0x5bec('0x1a')){if(this['actions'][_0x27fb59[_0x5bec('0x11e')]]&&_['isNil'](this[_0x5bec('0xa4')][_0x27fb59[_0x5bec('0x11e')]]['locked'])&&_0x27fb59[_0x5bec('0xd0')]==='1'&&_0x27fb59[_0x5bec('0x120')]==='0'){if(this[_0x5bec('0x22')][_0x27fb59['stateinterface']]){if(!this[_0x5bec('0x22')][_0x27fb59[_0x5bec('0x121')]]['locked']){this[_0x5bec('0x22')][_0x27fb59[_0x5bec('0x121')]][_0x5bec('0x122')]=!![];this[_0x5bec('0xa4')][_0x27fb59['actionid']][_0x5bec('0x122')]=!![];this[_0x5bec('0xa4')][_0x27fb59[_0x5bec('0x11e')]][_0x5bec('0x121')]=_0x27fb59['stateinterface'];}}}}else if((strategy[this[_0x5bec('0x21')][this['actions'][_0x27fb59[_0x5bec('0x11e')]][_0x5bec('0xab')]]['strategy']]||_0x5bec('0x19'))===_0x5bec('0x19')){if(this[_0x5bec('0xa4')][_0x27fb59['actionid']]){if(this[_0x5bec('0x22')][_0x27fb59['stateinterface']]){this[_0x5bec('0xa4')][_0x27fb59[_0x5bec('0x11e')]]['stateinterface']=_0x27fb59[_0x5bec('0x121')];if(_[_0x5bec('0xd3')](this[_0x5bec('0x2b')][this[_0x5bec('0xa4')][_0x27fb59['actionid']][_0x5bec('0xab')]])){this[_0x5bec('0x2b')][this[_0x5bec('0xa4')][_0x27fb59[_0x5bec('0x11e')]][_0x5bec('0xab')]]=[];}this[_0x5bec('0x2b')][this['actions'][_0x27fb59[_0x5bec('0x11e')]][_0x5bec('0xab')]][_0x5bec('0x123')](_[_0x5bec('0x86')](_[_0x5bec('0xc7')](this[_0x5bec('0xa4')][_0x27fb59['actionid']],[_0x5bec('0x124'),_0x5bec('0x121')]),{'status':_0x27fb59['status'],'paused':_0x27fb59[_0x5bec('0x120')]}));}}}};function unlockQueueStatus(_0x5caeb7,_0x5e6281){setTimeout(function(){if(_[_0x5bec('0x39')](_0x5caeb7[_0x5bec('0x125')])){loggerBooked['error'](_0x5bec('0x126'),_0x5e6281);}_0x5caeb7['queueStatusComplete']=!![];loggerBooked[_0x5bec('0x75')](_0x5bec('0x127'),_0x5e6281,JSON[_0x5bec('0x45')](_[_0x5bec('0xc7')](_0x5caeb7,['name',_0x5bec('0x125')])));},0x1f3);}Dialer['prototype'][_0x5bec('0x128')]=function(_0x38fa44){var _0x5e632f=this;var _0x19d3cc=_0x5e632f[_0x5bec('0x21')][_0x5e632f['actions'][_0x38fa44[_0x5bec('0x11e')]][_0x5bec('0xab')]];if(strategy[this['voiceQueues'][this['actions'][_0x38fa44[_0x5bec('0x11e')]][_0x5bec('0xab')]][_0x5bec('0x11f')]]===_0x5bec('0x1a')){if(this['actions'][_0x38fa44[_0x5bec('0x11e')]]&&this[_0x5bec('0xa4')][_0x38fa44[_0x5bec('0x11e')]][_0x5bec('0x121')]){this[_0x5bec('0x20')][_0x5bec('0x129')](this[_0x5bec('0xa4')][_0x38fa44[_0x5bec('0x11e')]][_0x5bec('0x124')],this[_0x5bec('0xa4')][_0x38fa44[_0x5bec('0x11e')]][_0x5bec('0x121')])[_0x5bec('0xa8')](function(_0x52a7fd){logger[_0x5bec('0x8f')](_0x5bec('0x12a'),util[_0x5bec('0x90')](_0x52a7fd,{'showHidden':![],'depth':null}));})['finally'](function(){_0x5e632f['updateOriginated'](_0x5e632f['voiceQueues'][_0x5e632f[_0x5bec('0xa4')][_0x38fa44[_0x5bec('0x11e')]]['queue']]);_0x5e632f['agents'][_0x5e632f[_0x5bec('0xa4')][_0x38fa44[_0x5bec('0x11e')]]['stateinterface']][_0x5bec('0x122')]=![];delete _0x5e632f[_0x5bec('0xa4')][_0x38fa44['actionid']];unlockQueueStatus(_0x19d3cc);});}else{this[_0x5bec('0xa9')](this[_0x5bec('0x21')][this['actions'][_0x38fa44['actionid']][_0x5bec('0xab')]]);this[_0x5bec('0xb6')]({'active':![],'ContactId':this[_0x5bec('0xa4')][_0x38fa44[_0x5bec('0x11e')]][_0x5bec('0xc8')],'ListId':this[_0x5bec('0xa4')][_0x38fa44[_0x5bec('0x11e')]][_0x5bec('0xc9')],'VoiceQueueId':this[_0x5bec('0xa4')][_0x38fa44[_0x5bec('0x11e')]][_0x5bec('0xcb')]||undefined,'CampaignId':this[_0x5bec('0xa4')][_0x38fa44[_0x5bec('0x11e')]]['CampaignId']||undefined})['catch'](loggerCatch(_0x5bec('0x12b')));delete this['actions'][_0x38fa44['actionid']];unlockQueueStatus(_0x19d3cc);}}else if((strategy[this[_0x5bec('0x21')][this[_0x5bec('0xa4')][_0x38fa44[_0x5bec('0x11e')]]['queue']][_0x5bec('0x11f')]]||_0x5bec('0x19'))===_0x5bec('0x19')){var _0x2d73fb;if(this['actions'][_0x38fa44[_0x5bec('0x11e')]]&&!_[_0x5bec('0x42')](this[_0x5bec('0x2b')][this[_0x5bec('0xa4')][_0x38fa44[_0x5bec('0x11e')]][_0x5bec('0xab')]])){if(this['queueBookedRR'][_0x5e632f['actions'][_0x38fa44[_0x5bec('0x11e')]][_0x5bec('0xab')]]){this[_0x5bec('0x12c')][_0x5e632f[_0x5bec('0xa4')][_0x38fa44[_0x5bec('0x11e')]][_0x5bec('0xab')]]=this[_0x5bec('0x12c')][this[_0x5bec('0xa4')][_0x38fa44[_0x5bec('0x11e')]]['queue']]?this[_0x5bec('0x12c')][this[_0x5bec('0xa4')][_0x38fa44[_0x5bec('0x11e')]][_0x5bec('0xab')]]:this[_0x5bec('0x2b')][this[_0x5bec('0xa4')][_0x38fa44[_0x5bec('0x11e')]][_0x5bec('0xab')]]?this[_0x5bec('0x2b')][this['actions'][_0x38fa44[_0x5bec('0x11e')]][_0x5bec('0xab')]][_0x5bec('0x12d')]||0x0:0x0;}this[_0x5bec('0x2b')][this[_0x5bec('0xa4')][_0x38fa44[_0x5bec('0x11e')]][_0x5bec('0xab')]][_0x5bec('0x12d')]=this['queueBookedRR'][this['actions'][_0x38fa44['actionid']][_0x5bec('0xab')]];for(var _0x44306d=0x0;_0x44306d=0x0;})['catch'](myreject(_0x3bcd32)));}}else{_0x402bcf[_0x5bec('0x123')](ami['Action']({'action':_0x5bec('0x144'),'command':util[_0x5bec('0x70')](_0x5bec('0x145'),_0x11ea81,!_['isUndefined'](config['timezones'][_0x1bcfd3])?_0x1bcfd3:'')})['then'](function(_0x30bbf7){return _0x30bbf7[_0x5bec('0x148')][_0x5bec('0x149')](_0x5bec('0x147'))>=0x0;})[_0x5bec('0xa8')](myreject(_0x3bcd32)));}BPromise['all'](_0x402bcf)[_0x5bec('0xb0')](function(_0x47262c){var _0x215bbd=_['some'](_0x47262c);if(_0x215bbd){return _0xe98363(_0x215bbd);}else{_0x47dbd0['message']=_0x5a0a86?_0x5bec('0x14a'):_0x5bec('0x14b');return _0x3bcd32(msgResponse(_0x5bec('0x14c'),_0x5bec('0x13d'),_0x5bec('0x14d')+_0x5a0a86+'\x20'+_0x5a9874+_0x5bec('0x14e')+util[_0x5bec('0x90')](_0x11ea81,{'showHidden':![],'depth':null})+_0x5bec('0x14f')+_0x1bcfd3));}})[_0x5bec('0xa8')](function(_0x2ba43e){return _0x3bcd32(msgResponse('ifTime',_0x5bec('0x13d'),JSON[_0x5bec('0x45')](_0x2ba43e)));});});};Dialer[_0x5bec('0x1b')][_0x5bec('0x150')]=function(_0xd31995){var _0x2b3181=this;return function(){switch(_0xd31995[_0x5bec('0x151')]){case _0x5bec('0x152'):freeVariablesPredictive(_0xd31995);_0x2b3181[_0x5bec('0x153')](_0xd31995,0x1);break;case _0x5bec('0x154'):freeVariablesPredictive(_0xd31995);_0x2b3181[_0x5bec('0x153')](_0xd31995,_0xd31995['dialPowerLevel']);break;case _0x5bec('0x9'):_0x2b3181['predictive'](_0xd31995);break;case _0x5bec('0x155'):freeVariablesPredictive(_0xd31995);_0x2b3181['handlePower'](_0xd31995,0x1);break;default:freeVariablesPredictive(_0xd31995);logger[_0x5bec('0x8f')](_0x5bec('0x156'),_0xd31995[_0x5bec('0x3b')],'method\x20not\x20recognized');}};};Dialer[_0x5bec('0x1b')][_0x5bec('0x157')]=function(_0x3281d5){var _0x30125d=this;return function(){_0x30125d[_0x5bec('0x158')](_0x3281d5);};};Dialer['prototype'][_0x5bec('0xb')]=function(_0x40d8e7){var _0x52cda2=this;if(isNotPreview(_0x40d8e7[_0x5bec('0x151')])){if(isVoiceQueueOutbound(_0x40d8e7[_0x5bec('0x49')])&&isActive(_0x40d8e7['dialActive'])){_0x40d8e7[_0x5bec('0x98')]=!![];BPromise[_0x5bec('0xae')]()[_0x5bec('0xb0')](checkIsLoggedIn(_0x40d8e7,_0x40d8e7[_0x5bec('0x4d')]))['then'](checkIsActive(_0x40d8e7,_0x40d8e7[_0x5bec('0x56')]))['then'](checkInterval(_0x40d8e7))[_0x5bec('0xb0')](_0x52cda2['checkIsTrunkReachable'](_0x40d8e7))[_0x5bec('0xb0')](_0x52cda2[_0x5bec('0x13b')](_0x40d8e7[_0x5bec('0x159')],_0x40d8e7[_0x5bec('0x15a')],_0x40d8e7[_0x5bec('0x3b')],_0x40d8e7))['then'](_0x52cda2['checkIfTimeIntervals'](_0x40d8e7[_0x5bec('0x3f')],_0x40d8e7[_0x5bec('0x15a')],_0x40d8e7['name'],_0x40d8e7))[_0x5bec('0xb0')](_0x52cda2[_0x5bec('0x150')](_0x40d8e7))[_0x5bec('0xa8')](loggerCatchQueueSummary(_0x5bec('0x15b'),_0x40d8e7));}else{notSendMessagesQueue(_0x40d8e7);}}else{freeVariablesPredictive(_0x40d8e7);}};Dialer[_0x5bec('0x1b')][_0x5bec('0x136')]=function(){var _0x3dd7ab=this;var _0x1da1e6;for(var _0x140748 in this[_0x5bec('0xf3')]){if(typeof this[_0x5bec('0xf3')][_0x140748]!==_0x5bec('0x93')){_0x1da1e6=this['campaigns'][_0x140748];if(isCampaignIvr(_0x1da1e6[_0x5bec('0x49')])&&isActive(_0x1da1e6['active'])){_0x1da1e6['sendMessageOneNotActive']=!![];BPromise['resolve']()[_0x5bec('0xb0')](checkIsActive(_0x1da1e6,_0x1da1e6[_0x5bec('0x6f')]))[_0x5bec('0xb0')](checkInterval(_0x1da1e6))[_0x5bec('0xb0')](_0x3dd7ab['checkIsTrunkReachable'](_0x1da1e6))[_0x5bec('0xb0')](_0x3dd7ab[_0x5bec('0x13b')](_0x1da1e6[_0x5bec('0x159')],_0x1da1e6[_0x5bec('0x15a')],_0x1da1e6[_0x5bec('0x3b')],_0x1da1e6))[_0x5bec('0xb0')](_0x3dd7ab['checkIfTimeIntervals'](_0x1da1e6['Interval'],_0x1da1e6[_0x5bec('0x15a')],_0x1da1e6[_0x5bec('0x3b')],_0x1da1e6))[_0x5bec('0xb0')](_0x3dd7ab[_0x5bec('0x157')](_0x1da1e6))[_0x5bec('0xa8')](loggerCatchQueueSummary(_0x5bec('0x15c'),_0x1da1e6));}else{notSendMessagesCampaign(_0x1da1e6);}}}};function getCallerIdRandom(_0x3feee3,_0x486f98){var _0x28b63f;var _0xaefcd0;var _0xacf9dc;if(_0x486f98<=0x0){_0x486f98=0x1;}_0x28b63f=new RegExp('\x5cw{0,'+_0x486f98+'}$');_0xaefcd0=Math['pow'](0xa,_0x486f98-0x1);_0xacf9dc=Math['pow'](0xa,_0x486f98)-0x1;return util[_0x5bec('0x70')]('%s',_[_0x5bec('0x15d')](_0x3feee3,_0x28b63f,_[_0x5bec('0x15e')](_0xaefcd0,_0xacf9dc)));}function extractCalleridName(_0x4d7923){var _0x3e529c=_0x4d7923[_0x5bec('0x15f')](/"(.*?)"/);return _0x3e529c?_0x3e529c[0x1]:_0x4d7923;}function extractCalleridNumber(_0x27085f){var _0x323057=_0x27085f[_0x5bec('0x15f')](/<(.*?)>/);return _0x323057?_0x323057[0x1]:_0x27085f;}Dialer['prototype']['actionOriginate']=function(_0x244733,_0x179bfc){var _0x73f273=this;var _0x86dd64=uuid['v4']();this[_0x5bec('0xa4')][_0x86dd64]=new Action(_0x244733,_0x179bfc,_0x86dd64);return new BPromise(function(_0x1d34a5,_0x44480d){if(_[_0x5bec('0x39')](_0x244733)&&typeof _0x244733!==_0x5bec('0x160')){return _0x44480d(msgResponse('originate',_0x5bec('0x13d'),_0x5bec('0x161')));}if(_['isUndefined'](_0x179bfc['Contact'][_0x5bec('0x162')])||_0x179bfc[_0x5bec('0x163')][_0x5bec('0x162')]===null){return _0x44480d(msgResponse('originate',_0x5bec('0x13d'),_0x5bec('0x164')));}var _0x128778={'XMD-CALLERID':_0x73f273[_0x5bec('0xa4')][_0x86dd64]['getCaller'](),'XMD-AGI':_0x244733[_0x5bec('0x101')]?util['format'](_0x5bec('0x165'),ipAgi,_0x244733['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x244733[_0x5bec('0x107')]?util[_0x5bec('0x70')]('\x22agi://%s/square,%s\x22',ipAgi,_0x244733[_0x5bec('0x107')]):_0x5bec('0x166'),'XMD-QUEUE':_0x244733[_0x5bec('0x49')]===_0x5bec('0x4a')?util[_0x5bec('0x70')](_0x5bec('0x167'),_0x244733['name'],_0x244733[_0x5bec('0x168')]||'',_0x244733['dialAgiAfterHangupAgent']?'c':'',_0x244733[_0x5bec('0x110')]||0x3):_0x5bec('0x166'),'XMD-CONTACTID':_0x179bfc['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x73f273[_0x5bec('0xa4')][_0x86dd64][_0x5bec('0x169')](),'XMD-AMD':_0x244733[_0x5bec('0xd7')]?_0x5bec('0x16a'):_0x5bec('0x166'),'XMD-DESTINATION':_0x5bec('0x16b')};if(_0x244733[_0x5bec('0xd7')]){_0x128778[_0x5bec('0x16c')]=_0x244733[_0x5bec('0x16d')]||0x9c4;_0x128778['XMD-AMDGREETING']=_0x244733[_0x5bec('0x16e')]||0x5dc;_0x128778[_0x5bec('0x16f')]=_0x244733[_0x5bec('0x170')]||0x320;_0x128778[_0x5bec('0x171')]=_0x244733['dialAMDTotalAnalysisTime']||0x1388;_0x128778[_0x5bec('0x172')]=_0x244733[_0x5bec('0x173')]||0x64;_0x128778['XMD-AMDBETWEENWORDSSILENCE']=_0x244733['dialAMDBetweenWordsSilence']||0x32;_0x128778['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x244733[_0x5bec('0x174')]||0x3;_0x128778[_0x5bec('0x175')]=_0x244733[_0x5bec('0x176')]||0x100;_0x128778[_0x5bec('0x177')]=_0x244733['dialAMDMaximumWordLength']||0x1388;}if(_0x244733[_0x5bec('0x49')]===_0x5bec('0x4a')){_0x128778[_0x5bec('0x178')]=_0x179bfc['VoiceQueueId'];}else{_0x128778['XMD-CAMPAIGNID']=_0x179bfc[_0x5bec('0xf2')];}for(var _0x2342fd in _0x179bfc['Contact']){if(typeof _0x179bfc[_0x5bec('0x163')][_0x2342fd]!==_0x5bec('0x93')){if(isNotNull(_0x179bfc[_0x5bec('0x163')][_0x2342fd])&&_0x2342fd!=='id'&&_0x2342fd!==_0x5bec('0x179')&&_0x2342fd!==_0x5bec('0x17a')&&_0x2342fd!==_0x5bec('0x17b')){_0x128778[util[_0x5bec('0x70')](_0x5bec('0x17c'),_0x5bec('0x17d'),_['toUpper'](_0x2342fd))]=_0x179bfc[_0x5bec('0x163')][_0x2342fd];}}}var _0x2c7d0a=_0x73f273[_0x5bec('0xce')](_0x244733[_0x5bec('0x6e')])?getCallerId(_0x244733[_0x5bec('0x6e')][_0x5bec('0x17e')],_0x244733['dialOriginateCallerIdName'],_0x244733[_0x5bec('0x17f')]>0x0?getCallerIdRandom(_0x244733[_0x5bec('0x57')],_0x244733[_0x5bec('0x17f')]):_0x244733['dialOriginateCallerIdNumber']):getCallerId(_[_0x5bec('0xd3')](_0x244733[_0x5bec('0x138')])?_0x244733[_0x5bec('0x6e')][_0x5bec('0x17e')]:_0x244733['TrunkBackup']['callerid'],_0x244733[_0x5bec('0x180')],_0x244733[_0x5bec('0x17f')]>0x0?getCallerIdRandom(_0x244733[_0x5bec('0x57')],_0x244733[_0x5bec('0x17f')]):_0x244733['dialOriginateCallerIdNumber']);if(_0x2c7d0a){_0x128778[_0x5bec('0x181')]=_0x73f273[_0x5bec('0xa4')][_0x86dd64][_0x5bec('0x182')]=extractCalleridName(_0x2c7d0a);_0x128778[_0x5bec('0x183')]=_0x73f273[_0x5bec('0xa4')][_0x86dd64]['originatecalleridnum']=extractCalleridNumber(_0x2c7d0a);}return ami[_0x5bec('0xa6')]({'actionid':_0x86dd64,'action':'originate','channel':_0x73f273['isTrunkReachable'](_0x244733[_0x5bec('0x6e')])?util[_0x5bec('0x70')](_0x5bec('0x184'),_0x244733['Trunk']['name'],isNotNull(_0x244733[_0x5bec('0x58')])?_0x244733['dialPrefix']['trim']()||'':'',_0x244733[_0x5bec('0x185')]>0x0?_0x179bfc[_0x5bec('0x163')][_0x5bec('0x162')][_0x5bec('0x186')](_0x244733[_0x5bec('0x185')]):_0x179bfc[_0x5bec('0x163')][_0x5bec('0x162')]):util[_0x5bec('0x70')](_0x5bec('0x184'),_['isNil'](_0x244733[_0x5bec('0x138')])?_0x244733[_0x5bec('0x6e')][_0x5bec('0x3b')]:_0x244733[_0x5bec('0x138')][_0x5bec('0x3b')],isNotNull(_0x244733[_0x5bec('0x58')])?_0x244733['dialPrefix'][_0x5bec('0x187')]()||'':'',_0x244733['dialCutDigit']>0x0?_0x179bfc[_0x5bec('0x163')][_0x5bec('0x162')][_0x5bec('0x186')](_0x244733[_0x5bec('0x185')]):_0x179bfc['Contact'][_0x5bec('0x162')]),'callerid':_0x2c7d0a,'Exten':_0x5bec('0x16b'),'Context':'from-sip','Priority':'1','variable':_0x128778,'timeout':(_0x244733[_0x5bec('0x188')]||0x1e)*0x3e8,'async':!![],'channelid':_0x86dd64})[_0x5bec('0xb0')](function(_0x1ccbb4){return _0x1d34a5(_0x1ccbb4);})[_0x5bec('0xa8')](function(_0x4200cb){_0x244733[_0x5bec('0x61')]+=0x1;var _0x5e43d1=new History(_0x73f273['actions'][_0x86dd64]);logger[_0x5bec('0x8f')](util[_0x5bec('0x70')](_0x5bec('0x189'),JSON['stringify'](_0x4200cb)));_0x5e43d1[_0x5bec('0x9d')]=0xe;_0x5e43d1['statedesc']=_0x5bec('0x18a');_0x5e43d1[_0x5bec('0xa0')]=moment()[_0x5bec('0x70')](_0x5bec('0xf1'));_0x5e43d1[_0x5bec('0x9f')]=_0x5e43d1[_0x5bec('0xa0')];_0x73f273[_0x5bec('0xc2')](_0x5e43d1)[_0x5bec('0xa8')](loggerCatch(_0x5bec('0x18b')));_0x73f273[_0x5bec('0xc0')](_0x5e43d1)[_0x5bec('0xa8')](loggerCatch(_0x5bec('0x18b')))[_0x5bec('0x1e')](function(){delete _0x73f273[_0x5bec('0xa4')][_0x86dd64];return _0x44480d(msgResponse(_0x5bec('0x18c'),'Error',_0x5bec('0x18d')));});});});};Dialer[_0x5bec('0x1b')][_0x5bec('0x18e')]=function(_0x31ee25){var _0x364569=this[_0x5bec('0xa4')][_0x31ee25['actionid']];if(_0x364569){delete this[_0x5bec('0xa4')][_0x31ee25[_0x5bec('0x11e')]];_0x364569[_0x5bec('0x18f')]=moment()[_0x5bec('0x70')](_0x5bec('0xf1'));var _0x365b78=_0x364569[_0x5bec('0x49')]==='ivr'?this[_0x5bec('0xf3')][_0x364569[_0x5bec('0xab')]]:this['voiceQueues'][_0x364569['getQueue']()];if(!this[_0x5bec('0xcd')](_0x31ee25[_0x5bec('0x190')])){this[_0x5bec('0xa9')](_0x365b78);return this[_0x5bec('0x191')](_0x364569,_0x365b78,_0x31ee25)[_0x5bec('0xa8')](loggerCatch(_0x5bec('0x192')));}this[_0x5bec('0xa2')][_0x31ee25['uniqueid']]=_0x364569;}};Dialer[_0x5bec('0x1b')][_0x5bec('0x193')]=function(_0x51d625,_0xf4debc,_0xd23c8){var _0x17ed5f=new History(_0xf4debc);if(_0x17ed5f[_0x5bec('0xe4')]+_0x17ed5f['countcongestionretry']+_0x17ed5f[_0x5bec('0xe6')]+_0x17ed5f['countnosuchnumberretry']+_0x17ed5f[_0x5bec('0xe8')]+_0x17ed5f[_0x5bec('0xf9')]+_0x17ed5f[_0x5bec('0xe1')]+_0x17ed5f[_0x5bec('0xfa')]>=_0xd23c8[_0x5bec('0xe9')]-0x1){return!![];}switch(_0x51d625){case 0x3:if(_0x17ed5f[_0x5bec('0xe6')]>=_0xd23c8[_0x5bec('0x194')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x17ed5f[_0x5bec('0xe6')]+=0x1,'scheduledat':moment()[_0x5bec('0xef')](_0xd23c8[_0x5bec('0x195')],_0x5bec('0xf0'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x17ed5f[_0x5bec('0xc8')],'ListId':_0x17ed5f[_0x5bec('0xc9')],'VoiceQueueId':_0x17ed5f[_0x5bec('0xcb')]||undefined,'CampaignId':_0x17ed5f[_0x5bec('0xf2')]||undefined})[_0x5bec('0xa8')](loggerCatch(_0x5bec('0x196')));break;case 0x5:if(_0x17ed5f[_0x5bec('0xe4')]>=_0xd23c8['dialBusyMaxRetry']-0x1){return!![];}this[_0x5bec('0xb6')]({'active':![],'countbusyretry':_0x17ed5f[_0x5bec('0xe4')]+=0x1,'scheduledat':moment()['add'](_0xd23c8[_0x5bec('0x197')],'minutes')[_0x5bec('0x70')](_0x5bec('0xf1')),'ContactId':_0x17ed5f[_0x5bec('0xc8')],'ListId':_0x17ed5f[_0x5bec('0xc9')],'VoiceQueueId':_0x17ed5f[_0x5bec('0xcb')]||undefined,'CampaignId':_0x17ed5f['CampaignId']||undefined})[_0x5bec('0xa8')](loggerCatch(_0x5bec('0x198')));break;case 0x8:if(_0x17ed5f[_0x5bec('0xe5')]>=_0xd23c8[_0x5bec('0x199')]-0x1){return!![];}this[_0x5bec('0xb6')]({'active':![],'countcongestionretry':_0x17ed5f[_0x5bec('0xe5')]+=0x1,'scheduledat':moment()[_0x5bec('0xef')](_0xd23c8[_0x5bec('0x19a')],_0x5bec('0xf0'))[_0x5bec('0x70')](_0x5bec('0xf1')),'ContactId':_0x17ed5f['ContactId'],'ListId':_0x17ed5f['ListId'],'VoiceQueueId':_0x17ed5f['VoiceQueueId']||undefined,'CampaignId':_0x17ed5f['CampaignId']||undefined})[_0x5bec('0xa8')](loggerCatch(_0x5bec('0x19b')));break;case 0x0:if(_0x17ed5f['countnosuchnumberretry']>=_0xd23c8[_0x5bec('0x19c')]-0x1){return!![];}else{this[_0x5bec('0xb6')]({'active':![],'countnosuchnumberretry':_0x17ed5f[_0x5bec('0xe7')]+=0x1,'scheduledat':moment()['add'](_0xd23c8[_0x5bec('0x19d')],_0x5bec('0xf0'))[_0x5bec('0x70')](_0x5bec('0xf1')),'ContactId':_0x17ed5f['ContactId'],'ListId':_0x17ed5f['ListId'],'VoiceQueueId':_0x17ed5f[_0x5bec('0xcb')]||undefined,'CampaignId':_0x17ed5f[_0x5bec('0xf2')]||undefined})[_0x5bec('0xa8')](loggerCatch(_0x5bec('0x19e')));}break;case 0xa:if(_0x17ed5f[_0x5bec('0xe8')]>=_0xd23c8[_0x5bec('0x114')]-0x1){return!![];}this[_0x5bec('0xb6')]({'active':![],'countdropretry':_0x17ed5f[_0x5bec('0xe8')]+=0x1,'scheduledat':moment()[_0x5bec('0xef')](_0xd23c8['dialDropRetryFrequency'],_0x5bec('0xf0'))[_0x5bec('0x70')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x17ed5f[_0x5bec('0xc8')],'ListId':_0x17ed5f[_0x5bec('0xc9')],'VoiceQueueId':_0x17ed5f['VoiceQueueId']||undefined,'CampaignId':_0x17ed5f[_0x5bec('0xf2')]||undefined})[_0x5bec('0xa8')](loggerCatch(_0x5bec('0x115')));break;case 0xb:if(_0x17ed5f['countabandonedretry']>=_0xd23c8[_0x5bec('0x11b')]-0x1){return!![];}this[_0x5bec('0xb6')]({'active':![],'countabandonedretry':_0x17ed5f[_0x5bec('0xf9')]+=0x1,'scheduledat':moment()[_0x5bec('0xef')](_0xd23c8[_0x5bec('0x11c')],_0x5bec('0xf0'))[_0x5bec('0x70')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x17ed5f['ContactId'],'ListId':_0x17ed5f[_0x5bec('0xc9')],'VoiceQueueId':_0x17ed5f[_0x5bec('0xcb')]||undefined,'CampaignId':_0x17ed5f['CampaignId']||undefined})[_0x5bec('0xa8')](loggerCatch(_0x5bec('0x11d')));break;case 0x13:if(_0x17ed5f[_0x5bec('0xe1')]>=_0xd23c8[_0x5bec('0xec')]-0x1){return!![];}this[_0x5bec('0xb6')]({'active':![],'countmachineretry':_0x17ed5f[_0x5bec('0xe1')]+=0x1,'scheduledat':moment()[_0x5bec('0xef')](_0xd23c8[_0x5bec('0xfb')],_0x5bec('0xf0'))[_0x5bec('0x70')](_0x5bec('0xf1')),'ContactId':_0x17ed5f[_0x5bec('0xc8')],'ListId':_0x17ed5f[_0x5bec('0xc9')],'VoiceQueueId':_0x17ed5f[_0x5bec('0xcb')]||undefined,'CampaignId':_0x17ed5f['CampaignId']||undefined})[_0x5bec('0xa8')](loggerCatch(_0x5bec('0xfc')));break;case 0x14:if(_0x17ed5f[_0x5bec('0xfa')]>=_0xd23c8[_0x5bec('0x19f')]-0x1){return!![];}this[_0x5bec('0xb6')]({'active':![],'countagentrejectretry':_0x17ed5f['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x5bec('0xef')](_0xd23c8[_0x5bec('0x1a0')],_0x5bec('0xf0'))[_0x5bec('0x70')](_0x5bec('0xf1')),'ContactId':_0x17ed5f[_0x5bec('0xc8')],'ListId':_0x17ed5f[_0x5bec('0xc9')],'VoiceQueueId':_0x17ed5f[_0x5bec('0xcb')]||undefined,'CampaignId':_0x17ed5f['CampaignId']||undefined})[_0x5bec('0xa8')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x5bec('0x1b')]['callProgressDetecting']=function(_0x560e1a,_0x35e7bc,_0x476ae9){var _0x55bfda=this;var _0xef2d8d=new History(_0x560e1a);return new BPromise(function(_0x2c9ab3,_0x5b2a52){if(_[_0x5bec('0x39')](_0x35e7bc)&&typeof _0x35e7bc!==_0x5bec('0x160')){return _0x5b2a52(msgResponse(_0x5bec('0x1a1'),_0x5bec('0x13d'),'entity\x20is\x20undefine'));}if(_[_0x5bec('0x39')](_0x476ae9)&&typeof _0x476ae9!==_0x5bec('0x160')){return _0x5b2a52(msgResponse(_0x5bec('0x1a1'),_0x5bec('0x13d'),_0x5bec('0x1a2')));}switch(_0x476ae9['reason']){case'0':_0x35e7bc[_0x5bec('0x60')]+=0x1;_0xef2d8d['state']=0x0;_0xef2d8d[_0x5bec('0x9e')]=_0x5bec('0x1a3');_0xef2d8d['countnosuchnumberretry']+=0x1;_0xef2d8d['countglobal']+=0x1;ami['emit'](_0x5bec('0x1a4'),ut['buildObj'](_0x560e1a,_0x5bec('0x1a5')));_0x55bfda[_0x5bec('0xc2')](_0xef2d8d)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x55bfda[_0x5bec('0x193')](0x0,_0x560e1a,_0x35e7bc)){if(_0xef2d8d[_0x5bec('0xe7')]>=_0x35e7bc[_0x5bec('0x19c')]){_0x55bfda[_0x5bec('0xed')](_0xef2d8d,_0x2c9ab3,_0x5b2a52,'reason\x200\x20no\x20such\x20number....');}else{_0x55bfda[_0x5bec('0xea')](_0xef2d8d,_0x2c9ab3,_0x5b2a52,_0x5bec('0x1a6'));}}break;case'3':_0x35e7bc[_0x5bec('0x5f')]+=0x1;_0xef2d8d[_0x5bec('0x9d')]=0x3;_0xef2d8d[_0x5bec('0x9e')]=_0x5bec('0x1a7');_0xef2d8d[_0x5bec('0xe6')]+=0x1;_0xef2d8d[_0x5bec('0xe2')]+=0x1;ami[_0x5bec('0x48')]('custom:agentnoanswer',ut[_0x5bec('0xdc')](_0x560e1a,_0x5bec('0x1a8')));_0x55bfda['createHistory'](_0xef2d8d)['catch'](loggerCatch(_0x5bec('0x1a9')));if(_0x55bfda[_0x5bec('0x193')](0x3,_0x560e1a,_0x35e7bc)){if(_0xef2d8d[_0x5bec('0xe6')]>=_0x35e7bc[_0x5bec('0x194')]){_0x55bfda[_0x5bec('0xed')](_0xef2d8d,_0x2c9ab3,_0x5b2a52,_0x5bec('0x1aa'));}else{_0x55bfda[_0x5bec('0xea')](_0xef2d8d,_0x2c9ab3,_0x5b2a52,_0x5bec('0x1aa'));}}break;case'5':_0x35e7bc[_0x5bec('0x5b')]+=0x1;_0xef2d8d[_0x5bec('0x9d')]=0x5;_0xef2d8d[_0x5bec('0x9e')]=_0x5bec('0x1ab');_0xef2d8d[_0x5bec('0xe4')]+=0x1;_0xef2d8d[_0x5bec('0xe2')]+=0x1;ami[_0x5bec('0x48')](_0x5bec('0x1ac'),ut[_0x5bec('0xdc')](_0x560e1a,'busy'));_0x55bfda[_0x5bec('0xc2')](_0xef2d8d)[_0x5bec('0xa8')](loggerCatch(_0x5bec('0x1ad')));if(_0x55bfda[_0x5bec('0x193')](0x5,_0x560e1a,_0x35e7bc)){if(_0xef2d8d['countbusyretry']>=_0x35e7bc[_0x5bec('0x1ae')]){_0x55bfda[_0x5bec('0xed')](_0xef2d8d,_0x2c9ab3,_0x5b2a52,_0x5bec('0x1af'));}else{_0x55bfda[_0x5bec('0xea')](_0xef2d8d,_0x2c9ab3,_0x5b2a52,_0x5bec('0x1af'));}}break;case'8':_0x35e7bc['outboundCongestionCallsDay']+=0x1;_0xef2d8d[_0x5bec('0x9d')]=0x8;_0xef2d8d[_0x5bec('0x9e')]=_0x5bec('0x1b0');_0xef2d8d[_0x5bec('0xe5')]+=0x1;_0xef2d8d[_0x5bec('0xe2')]+=0x1;ami[_0x5bec('0x48')]('custom:agentcongestion',ut[_0x5bec('0xdc')](_0x560e1a,_0x5bec('0x1b1')));_0x55bfda[_0x5bec('0xc2')](_0xef2d8d)[_0x5bec('0xa8')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x55bfda[_0x5bec('0x193')](0x8,_0x560e1a,_0x35e7bc)){if(_0xef2d8d[_0x5bec('0xe5')]>=_0x35e7bc[_0x5bec('0x199')]){_0x55bfda['createStateFinal'](_0xef2d8d,_0x2c9ab3,_0x5b2a52,_0x5bec('0x1b2'));}else{_0x55bfda[_0x5bec('0xea')](_0xef2d8d,_0x2c9ab3,_0x5b2a52,'reason\x208\x20congestion');}}break;case'11':_0x35e7bc[_0x5bec('0x1b3')]+=0x1;_0xef2d8d[_0x5bec('0x9d')]=0xb;_0xef2d8d[_0x5bec('0x9e')]=_0x5bec('0x119');_0xef2d8d['countabandonedretry']+=0x1;_0xef2d8d['countglobal']+=0x1;_0x55bfda['createHistory'](_0xef2d8d)[_0x5bec('0xa8')](loggerCatch(_0x5bec('0x1b4')));if(_0x55bfda[_0x5bec('0x193')](0xb,_0x560e1a,_0x35e7bc)){if(_0xef2d8d['countabandonedretry']>=_0x35e7bc['dialAbandonedMaxRetry']){_0x55bfda[_0x5bec('0xed')](_0xef2d8d,_0x2c9ab3,_0x5b2a52,_0x5bec('0x1b5'));}else{_0x55bfda['stateGlobal'](_0xef2d8d,_0x2c9ab3,_0x5b2a52,_0x5bec('0x1b5'));}}break;case'20':_0x35e7bc[_0x5bec('0x63')]+=0x1;_0xef2d8d[_0x5bec('0x9d')]=0x14;_0xef2d8d[_0x5bec('0x9e')]='AgentReject';_0xef2d8d[_0x5bec('0xfa')]+=0x1;_0xef2d8d['countglobal']+=0x1;ami[_0x5bec('0x48')]('custom:agentreject',ut['buildObj'](_0x560e1a,_0x5bec('0x1b6')));_0x55bfda[_0x5bec('0xc2')](_0xef2d8d)['catch'](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x55bfda['checkRetriveMax'](0x14,_0x560e1a,_0x35e7bc)){if(_0xef2d8d['countagentrejectretry']>=_0x35e7bc['dialAgentRejectMaxRetry']){_0x55bfda[_0x5bec('0xed')](_0xef2d8d,_0x2c9ab3,_0x5b2a52,_0x5bec('0x1b7'));}else{_0x55bfda[_0x5bec('0xea')](_0xef2d8d,_0x2c9ab3,_0x5b2a52,_0x5bec('0x1b7'));}}break;default:_0x35e7bc['outboundUnknownCallsDay']+=0x1;_0xef2d8d[_0x5bec('0x9d')]=0xc;_0xef2d8d['statedesc']=_0x476ae9[_0x5bec('0x104')];_0x55bfda[_0x5bec('0xc2')](_0xef2d8d)[_0x5bec('0xa8')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x55bfda['checkRetriveMax'](_0x476ae9[_0x5bec('0x104')],_0x560e1a,_0x35e7bc)){if(_0xef2d8d[_0x5bec('0xe4')]+_0xef2d8d[_0x5bec('0xe5')]+_0xef2d8d['countnoanswerretry']+_0xef2d8d[_0x5bec('0xe7')]+_0xef2d8d[_0x5bec('0xe8')]+_0xef2d8d[_0x5bec('0xf9')]+_0xef2d8d[_0x5bec('0xe1')]+_0xef2d8d[_0x5bec('0xfa')]>=_0x35e7bc[_0x5bec('0xe9')]){_0x55bfda[_0x5bec('0xea')](_0xef2d8d,_0x2c9ab3,_0x5b2a52,_0x476ae9[_0x5bec('0x104')]);}else{_0x55bfda['createStateFinal'](_0xef2d8d,_0x2c9ab3,_0x5b2a52,_0x476ae9[_0x5bec('0x104')]);}}}});};Dialer[_0x5bec('0x1b')][_0x5bec('0xea')]=function(_0x1d955c,_0x3421fa,_0x5847f5,_0x11d2af){var _0x10796f=new Final(_0x1d955c);_0x10796f[_0x5bec('0x9d')]=0xf;_0x10796f[_0x5bec('0x9e')]='Global';this['createStateFinal'](_0x10796f,_0x3421fa,_0x5847f5,_0x11d2af);};Dialer[_0x5bec('0x1b')][_0x5bec('0xed')]=function(_0x29e66e,_0x1fab21,_0x526705,_0x21f7a6){this[_0x5bec('0xc0')](_0x29e66e)['then'](function(){return _0x1fab21(msgResponse(_0x5bec('0x1a1'),_0x5bec('0x1b8'),_0x21f7a6));})[_0x5bec('0xa8')](function(){return _0x526705(msgResponse('[moveContactManagedDialer][0]','Failure',_0x5bec('0x1b9')));});};Dialer[_0x5bec('0x1b')]['predictive']=function(_0x277f5b){var _0x30fe46=_0x277f5b[_0x5bec('0x1ba')]/0x64;var _0x1cec75=_0x277f5b[_0x5bec('0x5e')]/(_0x277f5b[_0x5bec('0x5e')]+_0x277f5b[_0x5bec('0x5a')]);var _0x1c09ed=Math[_0x5bec('0x1bb')](_0x277f5b[_0x5bec('0x68')]*(_0x277f5b[_0x5bec('0x1bc')]/0x64));var _0x2bf530=Math[_0x5bec('0x1bb')](_0x277f5b['predictiveIntervalAvailable']*(_0x277f5b['predictiveIntervalMinThreshold']/0x64));var _0x263c4b=_0x277f5b[_0x5bec('0x4c')]+_0x277f5b[_0x5bec('0x51')];var _0x192d39=Math[_0x5bec('0x1bd')](_0x277f5b[_0x5bec('0x6b')]*_0x277f5b['erlangAbandonmentRate']*_0x277f5b[_0x5bec('0x1be')]*_0x277f5b[_0x5bec('0x66')]);if(_[_0x5bec('0x39')](_0x277f5b[_0x5bec('0x29')])){if(!_['isUndefined'](_0x277f5b[_0x5bec('0x28')])){_0x277f5b[_0x5bec('0x28')]=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0x5bec('0x1bf'));}if(!_[_0x5bec('0x39')](_0x277f5b[_0x5bec('0x8a')])){loggerPredictive['error'](_0x5bec('0x1c0'),_0x5bec('0x1c1'));clearInterval(_0x277f5b[_0x5bec('0x8a')]);_0x277f5b[_0x5bec('0x8a')]=undefined;}_0x277f5b[_0x5bec('0x29')]=moment()['format'](_0x5bec('0xf1'));loggerPredictive['info'](_0x277f5b[_0x5bec('0x3b')],_0x5bec('0x1c2'),_0x277f5b[_0x5bec('0x29')]);this['handlePower'](_0x277f5b,0x1);}else if(ifInterval(_0x277f5b[_0x5bec('0x1c3')],_0x277f5b[_0x5bec('0x29')])){this[_0x5bec('0x153')](_0x277f5b,0x1);loggerPredictiveCalls[_0x5bec('0x75')]('[startMethodPredictive][StartProgressive][Loop]',_0x277f5b[_0x5bec('0x29')],_0x277f5b[_0x5bec('0x3b')]);_0x277f5b[_0x5bec('0x6b')]=0x0;_0x277f5b[_0x5bec('0x111')]=0x0;}else if(_0x30fe46<_0x1cec75&&_0x277f5b[_0x5bec('0x1c4')]===_0x5bec('0x1c5')){freeVariablesPredictive(_0x277f5b);loggerPredictive['info'](_0x5bec('0x1c6'),_0x5bec('0x1c7'),_0x1cec75,_0x5bec('0x29'),_0x277f5b[_0x5bec('0x3b')]);}else if(_0x192d39<_0x277f5b[_0x5bec('0x111')]&&_0x277f5b[_0x5bec('0x1c4')]===_0x5bec('0x1c5')){freeVariablesPredictive(_0x277f5b);loggerPredictive[_0x5bec('0x75')](_0x5bec('0x1c8'),_0x5bec('0x1c9'),_0x192d39,_0x5bec('0x1ca'),_0x277f5b[_0x5bec('0x111')],_0x5bec('0x29'),_0x277f5b[_0x5bec('0x3b')]);}else if(!ifInterval(_0x277f5b[_0x5bec('0x1c3')],_0x277f5b['startProgressive'])&&_[_0x5bec('0x39')](_0x277f5b['startPredictive'])&&!_[_0x5bec('0x39')](_0x277f5b[_0x5bec('0x29')])){_0x277f5b['startPredictive']=moment()[_0x5bec('0x70')](_0x5bec('0xf1'));loggerPredictive[_0x5bec('0x75')](_0x277f5b[_0x5bec('0x3b')],_0x5bec('0x1cb'),_0x277f5b['startPredictive']);this[_0x5bec('0xb4')](_0x277f5b[_0x5bec('0x1c3')])[_0x5bec('0xb0')](this[_0x5bec('0x1cc')](_0x277f5b))[_0x5bec('0xb0')](mergeDataErlangB(_0x277f5b))[_0x5bec('0xb0')](this[_0x5bec('0x1cd')](_0x277f5b))[_0x5bec('0xa8')](loggerCatchPredictive(_0x5bec('0x1ce'),_0x277f5b));}else if(!ifInterval(_0x277f5b[_0x5bec('0x1c3')],_0x277f5b[_0x5bec('0x28')])){_0x277f5b[_0x5bec('0x111')]=0x0;_0x277f5b[_0x5bec('0x28')]=moment()[_0x5bec('0x70')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x5bec('0x75')](_0x277f5b['name'],_0x5bec('0x1cf'),_0x277f5b[_0x5bec('0x28')]);clearInterval(_0x277f5b[_0x5bec('0x8a')]);_0x277f5b[_0x5bec('0x8a')]=undefined;this[_0x5bec('0xb4')](_0x277f5b[_0x5bec('0x1c3')])[_0x5bec('0xb0')](this[_0x5bec('0x1cc')](_0x277f5b))['then'](mergeDataErlangB(_0x277f5b))[_0x5bec('0xb0')](this[_0x5bec('0x1cd')](_0x277f5b))[_0x5bec('0xa8')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x277f5b));}else if(_0x277f5b['predictiveIntervalAvailable']&&_0x263c4b<_0x277f5b['predictiveIntervalAvailable']-_0x2bf530){freeVariablesPredictive(_0x277f5b);loggerPredictive[_0x5bec('0x75')](_0x277f5b[_0x5bec('0x3b')],_0x5bec('0x1d0'),_0x263c4b,_0x5bec('0x1d1'),_0x277f5b['predictiveIntervalAvailable'],'-',_0x2bf530,'=',_0x277f5b['predictiveIntervalAvailable']-_0x2bf530,')');}else if(_0x277f5b[_0x5bec('0x68')]&&_0x263c4b>_0x277f5b[_0x5bec('0x68')]+_0x1c09ed){freeVariablesPredictive(_0x277f5b);loggerPredictive['info'](_0x277f5b[_0x5bec('0x3b')],_0x5bec('0x1d0'),_0x263c4b,')\x20are\x20more\x20than\x20threshold\x20(',_0x277f5b[_0x5bec('0x68')],'+',_0x1c09ed,'=',_0x277f5b[_0x5bec('0x68')]+_0x1c09ed,')');}};Dialer[_0x5bec('0x1b')][_0x5bec('0x1cc')]=function(_0x3b7ccd){var _0x4f23a6=this;return function(_0x10e12c){return new BPromise(function(_0x1a2e85,_0x540cad){_[_0x5bec('0x86')](_0x3b7ccd,_0x10e12c[0x0]);if(checkGetDataPredictive(_0x10e12c[0x0])){var _0x150484=_0x3b7ccd[_0x5bec('0x68')]=_0x3b7ccd['talking']+_0x3b7ccd[_0x5bec('0x4c')];var _0x47133c=_0x3b7ccd[_0x5bec('0x1c3')]*0x3c;var _0x1a422d=_0x10e12c[0x0][_0x5bec('0x7d')]+_0x10e12c[0x0][_0x5bec('0x64')];var _0x44d261=(_0x10e12c[0x0]['predictiveIntervalAnsweredCalls']+_0x10e12c[0x0][_0x5bec('0x65')]+_0x10e12c[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x10e12c[0x0][_0x5bec('0x69')];_0x3b7ccd['predictiveIntervalHitRate']=_0x44d261>0x0?_0x44d261:0x1;switch(_0x3b7ccd[_0x5bec('0x1c4')]){case _0x5bec('0x1c5'):var _0x55d14d=_0x3b7ccd['dialPredictiveOptimizationPercentage']/0x64;return _0x4f23a6['abandonmentRate'](_0x150484,_0x47133c,_0x1a422d,_0x44d261,_0x55d14d)['then'](function(_0x677d7f){return _0x1a2e85(_0x677d7f);});case _0x5bec('0x1d2'):var _0x2cc447=_0x3b7ccd['dialPredictiveOptimizationPercentage']/0x64;return _0x4f23a6['busyFactor'](_0x150484,_0x47133c,_0x1a422d,_0x44d261,_0x2cc447)['then'](function(_0x29fef7){return _0x1a2e85(_0x29fef7);});default:return _0x540cad(msgResponse(_0x5bec('0x1d3'),_0x5bec('0x13d'),_0x5bec('0x1d4')));}}else{return _0x540cad(msgResponse(_0x5bec('0x1d3'),_0x5bec('0x13d'),'check\x20failure'));}});};};Dialer['prototype'][_0x5bec('0x1d5')]=function(_0x1326f7){var _0xef8b54=this;return function(_0x6aa51c){return new BPromise(function(_0x219d15,_0x495a92){_['merge'](_0x1326f7,_0x6aa51c[0x0]);if(checkGetDataPredictive(_0x6aa51c[0x0])){loggerPredictive['info'](JSON[_0x5bec('0x45')](_0x6aa51c[0x0]));if(_0x1326f7[_0x5bec('0x1c4')]===_0x5bec('0x1c5')){return _0xef8b54[_0x5bec('0xbe')](_0x1326f7['id'])['then'](function(_0x439461){var _0x4fec9e=_0x1326f7['loggedIn']-_0x439461[0x0]['outboundQueuePauses'];var _0x591b1f=_0x1326f7[_0x5bec('0x1c3')]*0x3c;var _0x287ade=_0x6aa51c[0x0]['predictiveIntervalAvgTalktime']+_0x6aa51c[0x0][_0x5bec('0x64')];var _0x58fcd3=(_0x6aa51c[0x0][_0x5bec('0x79')]+_0x6aa51c[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x6aa51c[0x0][_0x5bec('0x7a')])/_0x6aa51c[0x0][_0x5bec('0x69')];var _0x50a5ed=_0x1326f7[_0x5bec('0x1ba')]/0x64;_0x1326f7['predictiveIntervalPauses']=_0x439461[0x0]['outboundQueuePauses']||0x0;_0x1326f7['predictiveIntervalHitRate']=_0x58fcd3>0x0?_0x58fcd3:0x1;return _0xef8b54[_0x5bec('0x1d6')](_0x4fec9e,_0x591b1f,_0x287ade,_0x58fcd3,_0x50a5ed);})[_0x5bec('0xb0')](function(_0x1800db){return _0x219d15(_0x1800db);})[_0x5bec('0xa8')](function(_0x1acabe){return _0x495a92(msgResponse(_0x5bec('0x1d7'),_0x5bec('0x13d'),JSON[_0x5bec('0x45')](_0x1acabe)));});}if(_0x1326f7[_0x5bec('0x1c4')]==='agentBusyFactor'){return _0xef8b54[_0x5bec('0xbe')](_0x1326f7['id'])[_0x5bec('0xb0')](function(_0x555279){var _0x149e84=_0x1326f7[_0x5bec('0x4d')]-_0x555279[0x0][_0x5bec('0x1d8')];var _0x1b5889=_0x1326f7[_0x5bec('0x1c3')]*0x3c;var _0x3b27c0=_0x6aa51c[0x0]['predictiveIntervalAvgTalktime']+_0x6aa51c[0x0][_0x5bec('0x64')];var _0x67f9b9=(_0x6aa51c[0x0][_0x5bec('0x79')]+_0x6aa51c[0x0][_0x5bec('0x65')]+_0x6aa51c[0x0][_0x5bec('0x7a')])/_0x6aa51c[0x0][_0x5bec('0x69')];var _0x20c73a=_0x1326f7[_0x5bec('0x1ba')]/0x64;_0x1326f7[_0x5bec('0x67')]=_0x555279[0x0][_0x5bec('0x1d8')]||0x0;_0x1326f7[_0x5bec('0x1be')]=_0x67f9b9>0x0?_0x67f9b9:0x1;return _0xef8b54[_0x5bec('0x1d9')](_0x149e84,_0x1b5889,_0x3b27c0,_0x67f9b9,_0x20c73a);})[_0x5bec('0xb0')](function(_0x287a9d){return _0x219d15(_0x287a9d);})['catch'](function(_0x43b31e){return _0x495a92(msgResponse(_0x5bec('0x1d7'),'Failure',JSON[_0x5bec('0x45')](_0x43b31e)));});}}else{return _0x495a92(msgResponse(_0x5bec('0x1d3'),'Failure',_0x5bec('0x1da')));}});};};Dialer[_0x5bec('0x1b')][_0x5bec('0x1cd')]=function(_0x3cb589){var _0x596a2b=this;return function(){var _0xb0bd99=0x0;var _0x207604=Math[_0x5bec('0x1bd')](_0x3cb589[_0x5bec('0x6c')]*0x3e8);if(_0x207604>0x0){_0x207604=_0x207604<0x64?0x64:_0x207604;loggerPredictive[_0x5bec('0x75')](_0x3cb589['name'],_0x5bec('0x1db'),_0x207604,_0x5bec('0x87'));_0x3cb589[_0x5bec('0x8a')]=setInterval(function(){_0x596a2b['handlePredictive'](_0x3cb589);loggerPredictiveCalls['info'](_0x5bec('0x1dc'),_0xb0bd99+=0x1);},_0x207604);}else{loggerPredictive[_0x5bec('0x75')](_0x3cb589[_0x5bec('0x3b')],_0x5bec('0x1dd'));}};};Dialer[_0x5bec('0x1b')][_0x5bec('0x1de')]=function(_0x3cdb72,_0x4b6990){var _0x5167fa=this;return function(_0x8df993){if(_[_0x5bec('0x42')](_0x8df993)){if(_[_0x5bec('0xd3')](_0x4b6990['UserId'])||!_0x4b6990[_0x5bec('0x1df')]){if(_0x3cdb72[_0x5bec('0x151')]===_0x5bec('0x155')){_0x3cdb72['queueStatusComplete']=_[_0x5bec('0x39')](_0x3cdb72[_0x5bec('0x125')])?!![]:_0x3cdb72['queueStatusComplete'];var _0x25ded3=uuid['v4']();_0x5167fa[_0x5bec('0xa4')][_0x25ded3]=new Action(_0x3cdb72,_0x4b6990,_0x25ded3);loggerBooked['info'](_0x5bec('0x1e0'),_0x25ded3,_0x5bec('0x1e1'),JSON[_0x5bec('0x45')](_0x3cdb72[_0x5bec('0x125')]),_0x5bec('0x1e2'),_0x3cdb72['name']);if(_0x3cdb72['queueStatusComplete']){_0x3cdb72['queueStatusComplete']=![];_0x5167fa['queueBooked'][_0x5167fa[_0x5bec('0xa4')][_0x25ded3][_0x5bec('0xab')]]=[];ami[_0x5bec('0xa6')]({'actionid':_0x25ded3,'action':_0x5bec('0x1e3'),'queue':_0x3cdb72[_0x5bec('0x3b')]})[_0x5bec('0xa8')](function(){_0x5167fa[_0x5bec('0xa9')](_0x3cdb72);_0x5167fa[_0x5bec('0xb6')]({'active':![],'ContactId':_0x5167fa[_0x5bec('0xa4')][_0x25ded3][_0x5bec('0xc8')],'ListId':_0x5167fa['actions'][_0x25ded3][_0x5bec('0xc9')],'VoiceQueueId':_0x5167fa['actions'][_0x25ded3][_0x5bec('0xcb')]||undefined,'CampaignId':_0x5167fa[_0x5bec('0xa4')][_0x25ded3][_0x5bec('0xf2')]||undefined})[_0x5bec('0xa8')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x5167fa[_0x5bec('0xa4')][_0x25ded3];});}else{loggerBooked['info'](_0x5bec('0x1e4'),JSON[_0x5bec('0x45')](_0x3cdb72[_0x5bec('0x125')]),_0x5bec('0x1e2'),_0x3cdb72[_0x5bec('0x3b')]);_0x5167fa['updateOriginated'](_0x3cdb72);_0x5167fa['rescheduleContact']({'active':![],'ContactId':_0x5167fa['actions'][_0x25ded3][_0x5bec('0xc8')],'ListId':_0x5167fa[_0x5bec('0xa4')][_0x25ded3][_0x5bec('0xc9')],'VoiceQueueId':_0x5167fa[_0x5bec('0xa4')][_0x25ded3][_0x5bec('0xcb')]||undefined,'CampaignId':_0x5167fa[_0x5bec('0xa4')][_0x25ded3][_0x5bec('0xf2')]||undefined})['catch'](loggerCatch(_0x5bec('0x1e5')));delete _0x5167fa[_0x5bec('0xa4')][_0x25ded3];}}else{return _0x5167fa[_0x5bec('0x1e6')](_0x3cdb72,_0x4b6990);}}else{if(getDiff(_0x4b6990[_0x5bec('0x1e7')])<_0x3cdb72[_0x5bec('0x1e8')]*0x3c){if(_0x4b6990['Agent']&&!_0x4b6990['Agent'][_0x5bec('0x1e9')]){_0x5167fa[_0x5bec('0x20')][_0x5bec('0x129')](_0x4b6990['id'])['finally'](function(){_0x5167fa['updateOriginated'](_0x3cdb72);});}else{_0x5167fa['unlockContact']({'active':![]},_0x4b6990['id'],0x1)['finally'](function(){_0x5167fa[_0x5bec('0xa9')](_0x3cdb72);});}}else{_0x3cdb72[_0x5bec('0x62')]+=0x1;_0x5167fa[_0x5bec('0xa9')](_0x3cdb72);if(_0x3cdb72[_0x5bec('0x1ea')]){_0x5167fa[_0x5bec('0xb6')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4b6990[_0x5bec('0xc8')],'ListId':_0x4b6990['ListId'],'VoiceQueueId':_0x4b6990[_0x5bec('0xcb')]||undefined,'CampaignId':_0x4b6990['CampaignId']||undefined})[_0x5bec('0xa8')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x5167fa['createHistory'](createObjHistory(_0x3cdb72,_0x4b6990,'RECALLINQUEUE',0x17,_0x5bec('0x1eb')))[_0x5bec('0xa8')](loggerCatch(_0x5bec('0x1ec')));}else{_0x5167fa[_0x5bec('0xc6')](createObjHistory(_0x3cdb72,_0x4b6990,'RECALLFAILEDTIMEOUT',0x16,_0x5bec('0x1ed')),'[Originate][HistoryRecallClose][historyCatch]',_0x5bec('0x1ee'));}}}}else{_0x3cdb72[_0x5bec('0x1ef')]+=0x1;_0x5167fa['saveInDb'](createObjHistory(_0x3cdb72,_0x4b6990,_0x5bec('0x1f0'),0xd,'Blacklist'),_0x5bec('0x1f1'),'[Originate][MoveBlacklist]');throw _0x5bec('0x1f2');}};};Dialer[_0x5bec('0x1b')][_0x5bec('0x158')]=function(_0x28efa6){var _0x8a57bc=this;var _0x2e8a65=_0x28efa6[_0x5bec('0x1f3')]-_0x28efa6[_0x5bec('0x6a')]-_0x28efa6[_0x5bec('0xbb')];emitCampaignSummary(_0x28efa6);if(_0x2e8a65>0x0){if(_0x2e8a65>this[_0x5bec('0x24')]){_0x2e8a65=this[_0x5bec('0x24')];}_0x28efa6[_0x5bec('0xbb')]+=_0x2e8a65;this[_0x5bec('0xbc')](_0x28efa6['id'],_0x2e8a65,_0x28efa6[_0x5bec('0x1f4')],_0x28efa6)['then'](function(_0x3c062b){_0x28efa6[_0x5bec('0xbb')]-=_0x2e8a65;_0x28efa6[_0x5bec('0xbb')]=_0x28efa6[_0x5bec('0xbb')]>0x0?_0x28efa6['temp']:0x0;if(!checkContactEmpty(_0x3c062b)){_0x28efa6[_0x5bec('0x3a')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x5bec('0x75')](_0x5bec('0x1f5')+_0x28efa6[_0x5bec('0x3b')]);}else{_0x28efa6[_0x5bec('0x6a')]+=_0x3c062b[_0x5bec('0x92')];_0x28efa6['message']=_0x5bec('0x1f6');for(var _0x5a4a21=0x0;_0x5a4a21<_0x3c062b['length'];_0x5a4a21+=0x1){_0x28efa6[_0x5bec('0x1f7')]+=0x1;if(_['isNil'](_0x3c062b[_0x5a4a21])||_[_0x5bec('0xd3')](_0x3c062b[_0x5a4a21]['Contact'])||_[_0x5bec('0xd3')](_0x3c062b[_0x5a4a21]['Contact']['phone'])){_0x8a57bc['emptyContact'](_0x5bec('0x1f8'),_0x28efa6,_0x3c062b[_0x5a4a21]);}else{_0x8a57bc['checkIsBlackListIvr'](_['pick'](_0x3c062b[_0x5a4a21],[_0x5bec('0xf2'),'Contact.phone']))[_0x5bec('0xb0')](_0x8a57bc[_0x5bec('0x1de')](_0x28efa6,_0x3c062b[_0x5a4a21]))['catch'](_0x8a57bc[_0x5bec('0x1f9')](_0x5bec('0x1fa'),_0x28efa6));}}}})[_0x5bec('0xa8')](loggerGetContactDialer('[getContactCampaign2]',_0x28efa6,_0x2e8a65));}};Dialer[_0x5bec('0x1b')][_0x5bec('0x153')]=function(_0x4b7e38,_0x3ca674){var _0x266f70=this;var _0x27eeab=[];var _0xa8547=_0x3ca674>=0x1?_0x3ca674:0x1;if(_0x4b7e38[_0x5bec('0x151')]===_0x5bec('0x155')){_0xa8547=0x1;}var _0x315ab6=Math['floor'](_0x4b7e38[_0x5bec('0x4c')]*_0xa8547)-_0x4b7e38[_0x5bec('0x6a')]-_0x4b7e38[_0x5bec('0xbb')];emitVoiceQueueSummary(_0x4b7e38);if(_0x4b7e38[_0x5bec('0x1fb')]>0x0){var _0x427e95=_0x4b7e38[_0x5bec('0x1fb')]-_0x4b7e38['originated']-_0x4b7e38['talking']-_0x4b7e38[_0x5bec('0xbb')]-_0x4b7e38['pTalking'];if(_0x315ab6>_0x427e95){_0x315ab6=_0x427e95;}}if(_0x315ab6>0x0){if(_0x4b7e38[_0x5bec('0x151')]===_0x5bec('0x155')){_0x315ab6=0x1;}if(_0x315ab6>this[_0x5bec('0x24')]){_0x315ab6=this[_0x5bec('0x24')];}_0x4b7e38['temp']+=_0x315ab6;for(var _0x48abf4 in this[_0x5bec('0x22')]){if(typeof this['agents'][_0x48abf4]!==_0x5bec('0x93')){if(this[_0x5bec('0x22')][_0x48abf4][_0x5bec('0x9d')]===_0x5bec('0x1fc')&&this[_0x5bec('0x22')][_0x48abf4][_0x5bec('0xd0')]===_0x5bec('0x1fd')){_0x27eeab[_0x5bec('0x123')](this['agents'][_0x48abf4]['id']);}}}this[_0x5bec('0xba')](_0x4b7e38['id'],_0x27eeab,_0x315ab6,_0x4b7e38[_0x5bec('0x1f4')],_0x4b7e38)[_0x5bec('0xb0')](function(_0x81f8b2){_0x4b7e38['temp']-=_0x315ab6;_0x4b7e38[_0x5bec('0xbb')]=_0x4b7e38['temp']>0x0?_0x4b7e38[_0x5bec('0xbb')]:0x0;if(!checkContactEmpty(_0x81f8b2)){_0x266f70['countReScheduled'](_0x4b7e38)['then'](sendMessageReschedule(_0x4b7e38))[_0x5bec('0xa8')](loggerCatch(_0x5bec('0xaf')));}else{_0x4b7e38['originated']+=_0x81f8b2[_0x5bec('0x92')];_0x4b7e38[_0x5bec('0x3a')]=_0x4b7e38[_0x5bec('0x151')]===_0x5bec('0x155')?_0x5bec('0x16a'):_0x5bec('0x1f6');for(var _0xa04e62=0x0;_0xa04e62<_0x81f8b2[_0x5bec('0x92')];_0xa04e62+=0x1){if(_['isNil'](_0x81f8b2[_0xa04e62])||_[_0x5bec('0xd3')](_0x81f8b2[_0xa04e62][_0x5bec('0x163')])||_[_0x5bec('0xd3')](_0x81f8b2[_0xa04e62][_0x5bec('0x163')][_0x5bec('0x162')])){_0x266f70[_0x5bec('0xc4')](_0x5bec('0x1f8'),_0x4b7e38,_0x81f8b2[_0xa04e62]);}else{_0x266f70[_0x5bec('0xb1')](_['pick'](_0x81f8b2[_0xa04e62],[_0x5bec('0xcb'),_0x5bec('0x1fe')]))[_0x5bec('0xb0')](_0x266f70[_0x5bec('0x1de')](_0x4b7e38,_0x81f8b2[_0xa04e62]))[_0x5bec('0xa8')](_0x266f70[_0x5bec('0x1f9')]('[actionOriginate]\x20',_0x4b7e38));}}}})[_0x5bec('0xa8')](loggerGetContactDialer('[getContactDialer2]',_0x4b7e38,_0x315ab6));}};Dialer['prototype'][_0x5bec('0x8a')]=function(_0x41d849){if(_0x41d849['dialLimitQueue']>0x0){var _0x2941ad=_0x41d849[_0x5bec('0x1fb')]-_0x41d849[_0x5bec('0x6a')]-_0x41d849[_0x5bec('0x51')];if(_0x2941ad>0x0){this[_0x5bec('0x1ff')](_0x41d849);}else{loggerPredictiveCalls[_0x5bec('0x75')](_0x5bec('0x200'));}}else{this[_0x5bec('0x1ff')](_0x41d849);}};Dialer['prototype'][_0x5bec('0x1ff')]=function(_0x57219a){var _0xa529d0=this;var _0x5cf78e=[];_0x57219a[_0x5bec('0x6a')]+=0x1;for(var _0x2b6120 in this[_0x5bec('0x22')]){if(typeof this['agents'][_0x2b6120]!==_0x5bec('0x93')){if(this['agents'][_0x2b6120][_0x5bec('0x9d')]==='not_inuse'&&this[_0x5bec('0x22')][_0x2b6120]['status']===_0x5bec('0x1fd')){_0x5cf78e[_0x5bec('0x123')](this[_0x5bec('0x22')][_0x2b6120]['id']);}}}this[_0x5bec('0xba')](_0x57219a['id'],_0x5cf78e,0x1,_0x57219a[_0x5bec('0x1f4')],_0x57219a)[_0x5bec('0xb0')](function(_0x25e200){if(!checkContactEmpty(_0x25e200)){checkContactLowerLimitOriginate(_0x57219a,0x1,0x0);_0xa529d0[_0x5bec('0xad')](_0x57219a)['then'](sendMessageReschedule(_0x57219a))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x57219a['message']='RUNNING';if(_[_0x5bec('0xd3')](_0x25e200[0x0])||_[_0x5bec('0xd3')](_0x25e200[0x0][_0x5bec('0x163')])||_[_0x5bec('0xd3')](_0x25e200[0x0][_0x5bec('0x163')][_0x5bec('0x162')])){_0xa529d0[_0x5bec('0xc4')](_0x5bec('0x1f8'),_0x57219a,_0x25e200[0x0]);}else{_0xa529d0[_0x5bec('0xb1')](_[_0x5bec('0xc7')](_0x25e200[0x0],[_0x5bec('0xcb'),_0x5bec('0x1fe')]))[_0x5bec('0xb0')](_0xa529d0[_0x5bec('0x1de')](_0x57219a,_0x25e200[0x0]))[_0x5bec('0xa8')](_0xa529d0['loggerHandler'](_0x5bec('0x201'),_0x57219a));}}})['catch'](loggerGetContactDialer(_0x5bec('0x202'),_0x57219a,0x1));emitVoiceQueueSummary(_0x57219a);};Dialer['prototype']['abandonmentRate']=function(_0x54358e,_0x420607,_0x3c11c0,_0x45acf3,_0x37f6fc,_0x34ca0d){loggerPredictive[_0x5bec('0x75')](_0x5bec('0x203'));loggerPredictive[_0x5bec('0x75')](_0x5bec('0x204'),_0x54358e);loggerPredictive[_0x5bec('0x75')](_0x5bec('0x205'),_0x420607);loggerPredictive[_0x5bec('0x75')](_0x5bec('0x206'),_0x3c11c0);loggerPredictive[_0x5bec('0x75')](_0x5bec('0x207'),_0x45acf3);loggerPredictive[_0x5bec('0x75')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x37f6fc);loggerPredictive['info'](_0x5bec('0x7c'));return new BPromise(function(_0x4d054d,_0x44e2fd){if(_0x54358e<=0x0||isNaN(_0x54358e)){return _0x44e2fd(msgResponse(_0x5bec('0x208'),'Error','m\x20=\x20'+_0x54358e));}if(_0x3c11c0<=0x0||isNaN(_0x3c11c0)){return _0x44e2fd(msgResponse(_0x5bec('0x208'),'Error',_0x5bec('0x209')+_0x3c11c0));}if(_0x45acf3<=0x0||isNaN(_0x45acf3)){return _0x44e2fd(msgResponse(_0x5bec('0x208'),_0x5bec('0x44'),_0x5bec('0x20a')+_0x45acf3));}if(_0x420607<=0x0||isNaN(_0x420607)){return _0x44e2fd(msgResponse(_0x5bec('0x208'),_0x5bec('0x44'),_0x5bec('0x20b')+_0x420607));}if(_0x37f6fc<=0x0||isNaN(_0x37f6fc)){return _0x44e2fd(msgResponse(_0x5bec('0x208'),'Error',_0x5bec('0x20c')+_0x37f6fc));}_0x34ca0d=_0x34ca0d||0x0;var _0xe37c48=0x1/_0x3c11c0;var _0x26f7df=0x0;var _0x4b91b8=0x0;var _0x50a527=0x0;var _0x287c61=0x0;for(var _0x45b5a4=0x0;_0x50a527<_0x37f6fc;_0x45b5a4+=0x1){_0x4b91b8=_0x45b5a4/_0x420607;_0x26f7df=(_0x45acf3*_0x4b91b8+_0x34ca0d)/_0xe37c48;_0x50a527=erlangb(_0x26f7df,_0x54358e);_0x287c61=_0x26f7df/_0x54358e*(0x1-erlangb(_0x26f7df,_0x54358e));}return _0x4d054d({'erlangCalls':_0x45b5a4,'erlangCallToSecond':_0x420607/_0x45b5a4,'erlangAbandonmentRate':_0x50a527,'erlangBusyFactor':_0x287c61});});};Dialer[_0x5bec('0x1b')][_0x5bec('0x1d9')]=function(_0x36d8bd,_0x1a652d,_0x2d19c2,_0x4942a0,_0x2a6194,_0x527e20){loggerPredictive[_0x5bec('0x75')](_0x5bec('0x20d'));loggerPredictive[_0x5bec('0x75')](_0x5bec('0x204'),_0x36d8bd);loggerPredictive[_0x5bec('0x75')](_0x5bec('0x205'),_0x1a652d);loggerPredictive[_0x5bec('0x75')](_0x5bec('0x206'),_0x2d19c2);loggerPredictive[_0x5bec('0x75')](_0x5bec('0x207'),_0x4942a0);loggerPredictive['info'](_0x5bec('0x20e'),_0x2a6194);loggerPredictive[_0x5bec('0x75')](_0x5bec('0x7c'));return new BPromise(function(_0x1fcc94,_0x5f5218){if(_0x36d8bd<=0x0||isNaN(_0x36d8bd)){return _0x5f5218(msgResponse(_0x5bec('0x20f'),_0x5bec('0x44'),_0x5bec('0x210')+_0x36d8bd));}if(_0x2d19c2<=0x0||isNaN(_0x2d19c2)){return _0x5f5218(msgResponse(_0x5bec('0x20f'),_0x5bec('0x44'),_0x5bec('0x209')+_0x2d19c2));}if(_0x4942a0<=0x0||isNaN(_0x4942a0)){return _0x5f5218(msgResponse(_0x5bec('0x20f'),_0x5bec('0x44'),'p\x20=\x20'+_0x4942a0));}if(_0x1a652d<=0x0||isNaN(_0x1a652d)){return _0x5f5218(msgResponse(_0x5bec('0x20f'),_0x5bec('0x44'),'interval\x20=\x20'+_0x1a652d));}if(_0x2a6194<=0x0||isNaN(_0x2a6194)){return _0x5f5218(msgResponse(_0x5bec('0x20f'),'Error',_0x5bec('0x211')+_0x2a6194));}_0x527e20=_0x527e20||0x0;var _0x11fe93=0x1/_0x2d19c2;var _0x53f333=0x0;var _0x517daa=0x0;var _0x216c03=0x0;var _0x1e7d60=0x0;for(var _0x711204=0x0;_0x1e7d60<_0x2a6194;_0x711204+=0x1){_0x517daa=_0x711204/_0x1a652d;_0x53f333=(_0x4942a0*_0x517daa+_0x527e20)/_0x11fe93;_0x216c03=erlangb(_0x53f333,_0x36d8bd);_0x1e7d60=_0x53f333/_0x36d8bd*(0x1-erlangb(_0x53f333,_0x36d8bd));}return _0x1fcc94({'erlangCalls':_0x711204,'erlangCallToSecond':_0x1a652d/_0x711204,'erlangAbandonmentRate':_0x216c03,'erlangBusyFactor':_0x1e7d60});});};module[_0x5bec('0x212')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 1ba25a7..fc53db4 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 _0xa4f1=['ringtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','endtime'];(function(_0x264370,_0x108e6f){var _0x594271=function(_0xff7632){while(--_0xff7632){_0x264370['push'](_0x264370['shift']());}};_0x594271(++_0x108e6f);}(_0xa4f1,0xe2));var _0x1a4f=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xa4f1[_0x122096];return _0x3d1966;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x1a4f('0x0'));function getSeconds(_0x10f010,_0x56c57f){var _0x3c101b=moment(_0x10f010)['milliseconds'](0x0);var _0x439ad6=moment(_0x56c57f)[_0x1a4f('0x1')](0x0);return _0x3c101b[_0x1a4f('0x2')](_0x439ad6,_0x1a4f('0x3'));}function QueueCallerAbandon(_0x13fe86,_0x294300){this[_0x1a4f('0x4')]=_0x13fe86[_0x1a4f('0x4')];this[_0x1a4f('0x5')]=_0x13fe86[_0x1a4f('0x5')];this[_0x1a4f('0x6')]=_0x13fe86[_0x1a4f('0x5')]===_0x1a4f('0x7')?_0x1a4f('0x8'):_0x13fe86[_0x1a4f('0x5')];this[_0x1a4f('0x9')]=_0x13fe86['countbusyretry'];this[_0x1a4f('0xa')]=_0x13fe86[_0x1a4f('0xa')];this[_0x1a4f('0xb')]=_0x13fe86[_0x1a4f('0xb')];this[_0x1a4f('0xc')]=_0x13fe86['countbusyretry']+_0x13fe86[_0x1a4f('0xa')]+_0x13fe86['countnoanswerretry']+_0x13fe86[_0x1a4f('0xd')]+_0x13fe86[_0x1a4f('0xe')]+_0x13fe86[_0x1a4f('0xf')]+_0x13fe86[_0x1a4f('0x10')]+_0x13fe86['countagentrejectretry'];this[_0x1a4f('0xd')]=_0x13fe86['countnosuchnumberretry'];this['countdropretry']=_0x13fe86[_0x1a4f('0xe')];this[_0x1a4f('0xf')]=_0x13fe86['countabandonedretry'];this[_0x1a4f('0x10')]=_0x13fe86[_0x1a4f('0x10')];this['countagentrejectretry']=_0x13fe86[_0x1a4f('0x11')];this['uniqueid']=_0x294300[_0x1a4f('0x12')];this[_0x1a4f('0x13')]=_0x13fe86['name'];this[_0x1a4f('0x14')]=_0x13fe86[_0x1a4f('0x15')];this[_0x1a4f('0x16')]=_0x13fe86[_0x1a4f('0x16')];this[_0x1a4f('0x17')]=_0x13fe86[_0x1a4f('0x17')];this['droptime']=_0x13fe86[_0x1a4f('0x18')];this[_0x1a4f('0x19')]=this[_0x1a4f('0x18')];this[_0x1a4f('0x1a')]=getSeconds(_0x13fe86['responsetime'],_0x13fe86[_0x1a4f('0x16')]);this['holdtime']=getSeconds(this['droptime'],_0x13fe86[_0x1a4f('0x17')]);this['talktime']=0x0;this[_0x1a4f('0x8')]=_0x294300['queue'];this[_0x1a4f('0x1b')]=_0x294300[_0x1a4f('0x1c')];this[_0x1a4f('0x1d')]=_0x294300[_0x1a4f('0x1d')];this[_0x1a4f('0x1e')]=_0x13fe86[_0x1a4f('0x1e')];this[_0x1a4f('0x1f')]=_0x13fe86['callbackuniqueid'];this[_0x1a4f('0x20')]=_0x13fe86['callbackat'];this[_0x1a4f('0x21')]=_0x13fe86[_0x1a4f('0x21')];this['ContactId']=_0x13fe86[_0x1a4f('0x22')];this[_0x1a4f('0x23')]=_0x13fe86[_0x1a4f('0x23')];this[_0x1a4f('0x24')]=_0x13fe86[_0x1a4f('0x24')];this['VoiceQueueId']=_0x13fe86[_0x1a4f('0x25')];this['CampaignId']=_0x13fe86[_0x1a4f('0x26')];this[_0x1a4f('0x27')]=_0x13fe86[_0x1a4f('0x27')]||'';this[_0x1a4f('0x28')]=_0x13fe86[_0x1a4f('0x28')]||'';}module[_0x1a4f('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0xc125=['countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','calleridnum','starttime','responsetime','droptime','endtime','ringtime','talktime','queue','membername','connectedlinename','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x1129d2,_0x3123ec){var _0x1b063f=function(_0x1c0025){while(--_0x1c0025){_0x1129d2['push'](_0x1129d2['shift']());}};_0x1b063f(++_0x3123ec);}(_0xc125,0x93));var _0x5c12=function(_0x34570c,_0x5ab8da){_0x34570c=_0x34570c-0x0;var _0x14bfa4=_0xc125[_0x34570c];return _0x14bfa4;};'use strict';var util=require(_0x5c12('0x0'));var _=require(_0x5c12('0x1'));var moment=require('moment');function getSeconds(_0xa6e807,_0x69252c){var _0x25413f=moment(_0xa6e807)[_0x5c12('0x2')](0x0);var _0x33b155=moment(_0x69252c)[_0x5c12('0x2')](0x0);return _0x25413f[_0x5c12('0x3')](_0x33b155,_0x5c12('0x4'));}function QueueCallerAbandon(_0x1f159b,_0x3deab2){this[_0x5c12('0x5')]=_0x1f159b[_0x5c12('0x5')];this[_0x5c12('0x6')]=_0x1f159b['type'];this[_0x5c12('0x7')]=_0x1f159b[_0x5c12('0x6')]===_0x5c12('0x8')?'queue':_0x1f159b['type'];this[_0x5c12('0x9')]=_0x1f159b[_0x5c12('0x9')];this['countcongestionretry']=_0x1f159b[_0x5c12('0xa')];this[_0x5c12('0xb')]=_0x1f159b[_0x5c12('0xb')];this[_0x5c12('0xc')]=_0x1f159b[_0x5c12('0x9')]+_0x1f159b['countcongestionretry']+_0x1f159b[_0x5c12('0xb')]+_0x1f159b['countnosuchnumberretry']+_0x1f159b['countdropretry']+_0x1f159b['countabandonedretry']+_0x1f159b[_0x5c12('0xd')]+_0x1f159b[_0x5c12('0xe')];this['countnosuchnumberretry']=_0x1f159b[_0x5c12('0xf')];this['countdropretry']=_0x1f159b['countdropretry'];this['countabandonedretry']=_0x1f159b['countabandonedretry'];this[_0x5c12('0xd')]=_0x1f159b['countmachineretry'];this[_0x5c12('0xe')]=_0x1f159b['countagentrejectretry'];this[_0x5c12('0x10')]=_0x3deab2[_0x5c12('0x10')];this[_0x5c12('0x11')]=_0x1f159b['name'];this[_0x5c12('0x12')]=_0x1f159b['number'];this[_0x5c12('0x13')]=_0x1f159b[_0x5c12('0x13')];this[_0x5c12('0x14')]=_0x1f159b[_0x5c12('0x14')];this['droptime']=_0x1f159b[_0x5c12('0x15')];this[_0x5c12('0x16')]=this[_0x5c12('0x15')];this[_0x5c12('0x17')]=getSeconds(_0x1f159b[_0x5c12('0x14')],_0x1f159b[_0x5c12('0x13')]);this['holdtime']=getSeconds(this[_0x5c12('0x15')],_0x1f159b['responsetime']);this[_0x5c12('0x18')]=0x0;this[_0x5c12('0x19')]=_0x3deab2[_0x5c12('0x19')];this[_0x5c12('0x1a')]=_0x3deab2[_0x5c12('0x1b')];this[_0x5c12('0x1c')]=_0x3deab2[_0x5c12('0x1c')];this[_0x5c12('0x1d')]=_0x1f159b[_0x5c12('0x1d')];this['callbackuniqueid']=_0x1f159b['callbackuniqueid'];this[_0x5c12('0x1e')]=_0x1f159b['callbackat'];this[_0x5c12('0x1f')]=_0x1f159b['recallme'];this[_0x5c12('0x20')]=_0x1f159b[_0x5c12('0x20')];this[_0x5c12('0x21')]=_0x1f159b['ListId'];this[_0x5c12('0x22')]=_0x1f159b[_0x5c12('0x22')];this[_0x5c12('0x23')]=_0x1f159b[_0x5c12('0x23')];this[_0x5c12('0x24')]=_0x1f159b[_0x5c12('0x24')];this[_0x5c12('0x25')]=_0x1f159b['originatecalleridnum']||'';this['originatecalleridname']=_0x1f159b[_0x5c12('0x26')]||'';}module[_0x5c12('0x27')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index ddd41a2..8ab4cee 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(_0x1ff1da,_0x3eb6cd){var _0x4d0b2f=function(_0x3783ce){while(--_0x3783ce){_0x1ff1da['push'](_0x1ff1da['shift']());}};_0x4d0b2f(++_0x3eb6cd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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(_0x31abd6,_0x5e0b94){var _0x3fdaee=function(_0x209bab){while(--_0x209bab){_0x31abd6['push'](_0x31abd6['shift']());}};_0x3fdaee(++_0x5e0b94);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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 f156c71..acfb1bb 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 _0xb6c9=['hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','syncVarSet','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','then','notify','fax','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','AttachmentId','update','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','catch','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','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','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','variablesAction','addVariables','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Is\x20Valid','exports','util','lodash','bluebird','moment','path','tiff2pdf','../../../config/logger','../ami','./channel','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','bind','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncHangup','originateresponse','prototype','syncNewchannel','context','from-voip-provider'];(function(_0x147dfb,_0x237577){var _0x43496f=function(_0x4db189){while(--_0x4db189){_0x147dfb['push'](_0x147dfb['shift']());}};_0x43496f(++_0x237577);}(_0xb6c9,0x1be));var _0x9b6c=function(_0x414e73,_0x57569f){_0x414e73=_0x414e73-0x0;var _0x5c3cba=_0xb6c9[_0x414e73];return _0x5c3cba;};'use strict';var util=require(_0x9b6c('0x0'));var _=require(_0x9b6c('0x1'));var BPromise=require(_0x9b6c('0x2'));var uuid=require('uuid');var moment=require(_0x9b6c('0x3'));var path=require(_0x9b6c('0x4'));var tiff2pdf=require(_0x9b6c('0x5'));var gs=require('./util/gs');var logger=require(_0x9b6c('0x6'))('fax');var ami=require(_0x9b6c('0x7'));var rpcDb=require('./rpcDb');var Channel=require(_0x9b6c('0x8'));var ut=require('./util/util');var Action=require(_0x9b6c('0x9'));var faxAccount=require(_0x9b6c('0xa'));var attachment=require(_0x9b6c('0xb'));var faxMessage=require(_0x9b6c('0xc'));function Fax(_0x4559d4){this['channels']={};this[_0x9b6c('0xd')]=_0x4559d4[_0x9b6c('0xd')];this['trunks']=_0x4559d4[_0x9b6c('0xe')];this[_0x9b6c('0xf')]={};ami['on'](_0x9b6c('0x10'),this['syncNewchannel'][_0x9b6c('0x11')](this));ami['on']('varset',this['syncVarSet'][_0x9b6c('0x11')](this));ami['on']('newstate',this[_0x9b6c('0x12')][_0x9b6c('0x11')](this));ami['on'](_0x9b6c('0x13'),this[_0x9b6c('0x14')][_0x9b6c('0x11')](this));ami['on'](_0x9b6c('0x15'),this[_0x9b6c('0x16')]['bind'](this));ami['on'](_0x9b6c('0x17'),this['syncReceiveFax'][_0x9b6c('0x11')](this));ami['on']('hangup',this[_0x9b6c('0x18')][_0x9b6c('0x11')](this));ami['on'](_0x9b6c('0x19'),this['syncOriginateResponse']['bind'](this));}Fax[_0x9b6c('0x1a')][_0x9b6c('0x1b')]=function(_0x129793){if(_0x129793[_0x9b6c('0x1c')]===_0x9b6c('0x1d')){for(var _0x1648cd in this[_0x9b6c('0xd')]){if(this[_0x9b6c('0xd')][_0x9b6c('0x1e')](_0x1648cd)){if(_0x129793[_0x9b6c('0x1f')]===this['faxAccounts'][_0x1648cd][_0x9b6c('0x20')]){this[_0x9b6c('0x21')][_0x129793[_0x9b6c('0x22')]]={};this[_0x9b6c('0x21')][_0x129793['uniqueid']][_0x9b6c('0x23')]=_0x129793[_0x9b6c('0x23')];this[_0x9b6c('0x21')][_0x129793[_0x9b6c('0x22')]]['id']=this[_0x9b6c('0xd')][_0x1648cd]['id'];this['channels'][_0x129793[_0x9b6c('0x22')]][_0x9b6c('0x24')]=this[_0x9b6c('0xd')][_0x1648cd][_0x9b6c('0x24')];logger[_0x9b6c('0x25')](_0x129793[_0x9b6c('0x22')],_0x9b6c('0x26'));}}}}if(this[_0x9b6c('0xf')][_0x129793[_0x9b6c('0x22')]]){this[_0x9b6c('0x21')][_0x129793[_0x9b6c('0x22')]]={};this[_0x9b6c('0x21')][_0x129793[_0x9b6c('0x22')]][_0x9b6c('0x23')]=_0x129793[_0x9b6c('0x23')];logger['info'](_0x129793['uniqueid'],_0x9b6c('0x26'));}};Fax[_0x9b6c('0x1a')][_0x9b6c('0x27')]=function(_0x4dcb72){if(this[_0x9b6c('0x21')][_0x4dcb72['uniqueid']]){for(var _0x536772 in _0x4dcb72[_0x9b6c('0x28')]){if(_0x4dcb72[_0x9b6c('0x28')][_0x9b6c('0x1e')](_0x536772)){this[_0x9b6c('0x21')][_0x4dcb72['uniqueid']][_0x536772]=_0x4dcb72[_0x9b6c('0x29')];}}}};Fax[_0x9b6c('0x1a')][_0x9b6c('0x12')]=function(_0x45caad){if(this[_0x9b6c('0x21')][_0x45caad[_0x9b6c('0x22')]]){this[_0x9b6c('0x21')][_0x45caad[_0x9b6c('0x22')]][_0x9b6c('0x2a')]=_0x45caad[_0x9b6c('0x2a')];this['channels'][_0x45caad[_0x9b6c('0x22')]][_0x9b6c('0x2b')]=_0x45caad['channelstatedesc'];}};Fax[_0x9b6c('0x1a')][_0x9b6c('0x14')]=function(_0x12af8d){if(this[_0x9b6c('0x21')][_0x12af8d[_0x9b6c('0x22')]]){for(var _0x66ee18 in _0x12af8d[_0x9b6c('0x28')]){if(_0x12af8d[_0x9b6c('0x28')]['hasOwnProperty'](_0x66ee18)){this[_0x9b6c('0x21')][_0x12af8d[_0x9b6c('0x22')]][_0x66ee18]=_0x12af8d[_0x9b6c('0x29')];}}}};Fax['prototype']['syncFaxStatus']=function(_0xfb33e2){if(this[_0x9b6c('0x21')][_0xfb33e2[_0x9b6c('0x22')]]){this[_0x9b6c('0x21')][_0xfb33e2[_0x9b6c('0x22')]][_0x9b6c('0x2c')]=_0xfb33e2[_0x9b6c('0x2c')];this[_0x9b6c('0x21')][_0xfb33e2[_0x9b6c('0x22')]][_0x9b6c('0x2d')]=_0xfb33e2[_0x9b6c('0x2d')];this[_0x9b6c('0x21')][_0xfb33e2['uniqueid']][_0x9b6c('0x20')]=_0xfb33e2[_0x9b6c('0x20')];this['channels'][_0xfb33e2[_0x9b6c('0x22')]][_0x9b6c('0x2e')]=_0xfb33e2[_0x9b6c('0x2e')];logger[_0x9b6c('0x25')](_0xfb33e2[_0x9b6c('0x22')],_0x9b6c('0x2f'));}};Fax[_0x9b6c('0x1a')][_0x9b6c('0x30')]=function(_0x398945){var _0x32d38e=this;if(this[_0x9b6c('0x21')][_0x398945[_0x9b6c('0x22')]]){var _0x3f119d=this['channels'][_0x398945[_0x9b6c('0x22')]]['id'];this[_0x9b6c('0x21')][_0x398945[_0x9b6c('0x22')]][_0x9b6c('0x31')]=_0x398945[_0x9b6c('0x31')];this[_0x9b6c('0x21')][_0x398945['uniqueid']][_0x9b6c('0x32')]=_0x398945[_0x9b6c('0x32')];this['channels'][_0x398945[_0x9b6c('0x22')]][_0x9b6c('0x20')]=_0x398945[_0x9b6c('0x20')];this['channels'][_0x398945[_0x9b6c('0x22')]][_0x9b6c('0x33')]=_0x398945[_0x9b6c('0x33')];this['channels'][_0x398945[_0x9b6c('0x22')]][_0x9b6c('0x34')]=_0x398945['transferrate'];this[_0x9b6c('0x21')][_0x398945[_0x9b6c('0x22')]][_0x9b6c('0x2e')]=_0x398945[_0x9b6c('0x2e')];this['channels'][_0x398945['uniqueid']][_0x9b6c('0x35')]=_0x398945[_0x9b6c('0x35')];if(this[_0x9b6c('0x21')][_0x398945[_0x9b6c('0x22')]][_0x9b6c('0x32')]>0x0){tiff2pdf(_0x398945[_0x9b6c('0x2e')],_0x9b6c('0x36'),function(_0xd382b5){logger[_0x9b6c('0x25')](_0x398945[_0x9b6c('0x22')],'\x20result\x20conversion\x20file\x20',_0xd382b5[_0x9b6c('0x37')]);attachment[_0x9b6c('0x38')]({'name':path['parse'](_0x398945['filename'])[_0x9b6c('0x24')],'basename':path[_0x9b6c('0x39')](_0x398945[_0x9b6c('0x2e')])[_0x9b6c('0x24')]+_0x9b6c('0x3a'),'type':_0x9b6c('0x3b')})[_0x9b6c('0x3c')](function(_0x2284c5){faxAccount[_0x9b6c('0x3d')](_0x3f119d,{'from':_0x398945[_0x9b6c('0x35')],'mapKey':_0x9b6c('0x3e'),'body':path[_0x9b6c('0x39')](_0x398945['filename'])['name']+_0x9b6c('0x3a'),'AttachmentId':_0x2284c5['id']})['catch'](function(_0x849655){logger[_0x9b6c('0x3f')](_0x398945[_0x9b6c('0x22')],_0x9b6c('0x40'),JSON[_0x9b6c('0x41')](_0x849655));});})['catch'](function(_0x28f2af){logger['error'](_0x398945['uniqueid'],_0x9b6c('0x42'),JSON[_0x9b6c('0x41')](_0x28f2af));});});}logger[_0x9b6c('0x25')](_0x398945[_0x9b6c('0x22')],_0x9b6c('0x42'));}};Fax['prototype'][_0x9b6c('0x43')]=function(_0x27151c){if(this['actions'][_0x27151c['uniqueid']]){_[_0x9b6c('0x44')](this[_0x9b6c('0x21')][_0x27151c[_0x9b6c('0x22')]],_[_0x9b6c('0x45')](_0x27151c,[_0x9b6c('0x46'),'reason']));}};function updateStatus(_0x162cf5){if(_0x162cf5[_0x9b6c('0x47')]){faxMessage[_0x9b6c('0x48')](_0x162cf5['AttachmentId'],{'failMessage':_0x9b6c('0x49')})[_0x9b6c('0x3c')](function(_0x3073f0){ut['logger'](_0x9b6c('0x4a'),_0x3073f0);})['catch'](function(_0x100c2c){ut[_0x9b6c('0x4b')](_0x9b6c('0x4c'),_0x100c2c);});}else{ut[_0x9b6c('0x4b')](_0x9b6c('0x4d'));}}Fax[_0x9b6c('0x1a')]['updateStatus']=function(_0xa52887,_0x31e908,_0x5ef8ed){var _0x25b222=this;var _0x1840d4={};if(_0x31e908){_0x1840d4={'read':_0x31e908};}else{_0x1840d4={'failMessage':_0x5ef8ed};}if(this[_0x9b6c('0xf')][_0xa52887][_0x9b6c('0x47')]){faxMessage[_0x9b6c('0x48')](this[_0x9b6c('0xf')][_0xa52887][_0x9b6c('0x47')],_0x1840d4)[_0x9b6c('0x3c')](function(_0xa75e43){ut[_0x9b6c('0x4b')](_0x9b6c('0x4e'),_0xa75e43);})[_0x9b6c('0x4f')](function(_0x424109){ut['logger'](_0x9b6c('0x50'),_0x424109);})[_0x9b6c('0x51')](function(){delete _0x25b222['channels'][_0xa52887];delete _0x25b222[_0x9b6c('0xf')][_0xa52887];});}else{ut[_0x9b6c('0x4b')]('[Fax][Message][NoUpdate2]');delete this[_0x9b6c('0x21')][_0xa52887];delete this[_0x9b6c('0xf')][_0xa52887];}};Fax[_0x9b6c('0x1a')]['syncHangup']=function(_0x273ea1){var _0x49efe4=this;if(this['channels'][_0x273ea1[_0x9b6c('0x22')]]){if(this[_0x9b6c('0xf')][_0x273ea1[_0x9b6c('0x22')]]){this[_0x9b6c('0x21')][_0x273ea1[_0x9b6c('0x22')]]['id']=this[_0x9b6c('0xf')][_0x273ea1['uniqueid']]['id'];this[_0x9b6c('0x21')][_0x273ea1[_0x9b6c('0x22')]][_0x9b6c('0x24')]=this[_0x9b6c('0xf')][_0x273ea1[_0x9b6c('0x22')]][_0x9b6c('0x24')];}logger['info'](_0x273ea1[_0x9b6c('0x22')],this[_0x9b6c('0xf')][_0x273ea1[_0x9b6c('0x22')]]?_0x9b6c('0x52'):_0x9b6c('0x53'),JSON[_0x9b6c('0x41')](this[_0x9b6c('0x21')][_0x273ea1['uniqueid']]));if(this[_0x9b6c('0xf')][_0x273ea1[_0x9b6c('0x22')]]){if(this[_0x9b6c('0x21')][_0x273ea1['uniqueid']][_0x9b6c('0x54')]>0x0&&this[_0x9b6c('0x21')][_0x273ea1[_0x9b6c('0x22')]][_0x9b6c('0x15')]===_0x9b6c('0x55')){this[_0x9b6c('0x56')](_0x273ea1['uniqueid'],!![]);}else{this['updateStatus'](_0x273ea1[_0x9b6c('0x22')],![],this[_0x9b6c('0x21')][_0x273ea1['uniqueid']][_0x9b6c('0x57')]?_0x9b6c('0x58')+this[_0x9b6c('0x21')][_0x273ea1['uniqueid']]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax['prototype'][_0x9b6c('0x59')]=function(_0x21bebb){var _0x839a59=this;return new BPromise(function(_0x1fa2cb,_0x5af499){_0x839a59[_0x9b6c('0x5a')](_0x21bebb,_0x839a59['faxAccounts'][_0x21bebb[_0x9b6c('0x5b')]])[_0x9b6c('0x3c')](function(_0x48b663){ut[_0x9b6c('0x4b')](_0x9b6c('0x5c'),_0x48b663);_0x1fa2cb(ut[_0x9b6c('0x37')](_0x9b6c('0x5d')));})[_0x9b6c('0x4f')](function(_0xc88807){ut['logger'](_0x9b6c('0x5e'),_0xc88807);updateStatus(_0x21bebb);_0x5af499(ut[_0x9b6c('0x37')](_0x9b6c('0x5f')));});});};Fax[_0x9b6c('0x1a')][_0x9b6c('0x60')]=function(_0x3599de){var _0x2a7931=this;return new BPromise(function(_0x4e8396,_0x2bf819){var _0x22ce27=_0x2a7931[_0x9b6c('0x61')](_0x2a7931['faxAccounts'][_0x3599de[_0x9b6c('0x5b')]][_0x9b6c('0x62')],_0x3599de);if(_0x22ce27[_0x9b6c('0x63')]){_0x4e8396(ut['message']('Trunk\x20Reachable'));}else{_0x2bf819(ut['message'](_0x22ce27[_0x9b6c('0x37')]));}});};function originate(_0x271598,_0x4929bf,_0x25b549){return new BPromise(function(_0x2dfc6c,_0x46e38e){if(_0x25b549){var _0xe2dc2f=util[_0x9b6c('0x64')](_0x9b6c('0x65'),path[_0x9b6c('0x39')](_0x271598[_0x9b6c('0x4')])[_0x9b6c('0x24')],_0x271598[_0x9b6c('0x4')]);gs['execute'](_0xe2dc2f)[_0x9b6c('0x3c')](function(){_0x271598[_0x9b6c('0x4')]=util[_0x9b6c('0x64')](_0x9b6c('0x66'),path['parse'](_0x271598[_0x9b6c('0x4')])[_0x9b6c('0x67')],path[_0x9b6c('0x39')](_0x271598[_0x9b6c('0x4')])[_0x9b6c('0x24')]);_0x4929bf['XMF-PATH']=_0x271598[_0x9b6c('0x4')];ut[_0x9b6c('0x4b')](_0x9b6c('0x68'),'');ami['Action'](ut[_0x9b6c('0x69')](_0x271598,_0x4929bf))[_0x9b6c('0x3c')](function(_0x223df3){_0x2dfc6c(_0x223df3);})[_0x9b6c('0x4f')](function(_0x58ba06){_0x46e38e(_0x58ba06);});})[_0x9b6c('0x4f')](function(_0x76e92a){_0x46e38e(_0x76e92a);});}else{ami['Action'](ut[_0x9b6c('0x69')](_0x271598,_0x4929bf))[_0x9b6c('0x3c')](function(_0x491448){_0x2dfc6c(_0x491448);})[_0x9b6c('0x4f')](function(_0xc714bf){_0x46e38e(_0xc714bf);});}});}Fax['prototype'][_0x9b6c('0x5a')]=function(_0xec1677,_0x4507d3){var _0x19a121=this;return new BPromise(function(_0x1ef543,_0x7e17b5){var _0x3b9152=uuid['v4']();var _0x2c2210=ut[_0x9b6c('0x6a')](_0xec1677,_0x4507d3);_0x19a121[_0x9b6c('0xf')][_0x3b9152]=new Action(_0x3b9152,_0x4507d3,_0xec1677);var _0x3328cb=_0x19a121[_0x9b6c('0xf')][_0x3b9152];if(path[_0x9b6c('0x39')](_0xec1677[_0x9b6c('0x4')])['ext']==='.pdf'){originate(_0x3328cb,_0x2c2210,!![])['then'](function(_0x2abc74){_0x1ef543(_0x2abc74);})[_0x9b6c('0x4f')](function(_0x42f40d){_0x7e17b5(_0x42f40d);});}else{originate(_0x3328cb,_0x2c2210,![])[_0x9b6c('0x3c')](function(_0x12ddc6){_0x1ef543(_0x12ddc6);})[_0x9b6c('0x4f')](function(_0x11a5c3){_0x7e17b5(_0x11a5c3);});}});};Fax[_0x9b6c('0x1a')]['isTrunkReachable']=function(_0x4feb90){return!_[_0x9b6c('0x6b')](_0x4feb90)&&!_[_0x9b6c('0x6b')](_0x4feb90[_0x9b6c('0x24')])&&!_[_0x9b6c('0x6b')](_0x4feb90[_0x9b6c('0x6c')])&&_0x4feb90[_0x9b6c('0x6c')]&&!_[_0x9b6c('0x6b')](this[_0x9b6c('0xe')][util['format']('SIP/%s',_0x4feb90[_0x9b6c('0x24')])])&&!_[_0x9b6c('0x6b')](this[_0x9b6c('0xe')][util[_0x9b6c('0x64')](_0x9b6c('0x6d'),_0x4feb90[_0x9b6c('0x24')])][_0x9b6c('0x2d')])&&(this[_0x9b6c('0xe')][util[_0x9b6c('0x64')](_0x9b6c('0x6d'),_0x4feb90[_0x9b6c('0x24')])]['status']===_0x9b6c('0x6e')||this[_0x9b6c('0xe')][util[_0x9b6c('0x64')](_0x9b6c('0x6d'),_0x4feb90[_0x9b6c('0x24')])][_0x9b6c('0x2d')]===_0x9b6c('0x6f'));};Fax[_0x9b6c('0x1a')]['checkTrunk']=function(_0x35a597,_0x559370){if(!this[_0x9b6c('0x70')](_0x35a597)){ut[_0x9b6c('0x4b')](_0x9b6c('0x71'),_[_0x9b6c('0x6b')](_0x35a597)?'':_0x35a597['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x9b6c('0x72')};}if(_[_0x9b6c('0x6b')](_0x559370['fax'])){ut[_0x9b6c('0x4b')](_0x9b6c('0x73'),JSON[_0x9b6c('0x41')](_0x559370));return{'isValid':![],'message':_0x9b6c('0x74')};}if(_[_0x9b6c('0x6b')](_0x559370[_0x9b6c('0x4')])){ut[_0x9b6c('0x4b')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x9b6c('0x41')](_0x559370));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x9b6c('0x75')};};module[_0x9b6c('0x76')]=Fax; \ No newline at end of file +var _0x9818=['notify','parse','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','merge','pick','response','reason','update','AttachmentId','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkAfterSend','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncHangup','originateresponse','from-voip-provider','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','syncVarSet','variable','value','channelstate','channelstatedesc','hasOwnProperty','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','.pdf','application/pdf','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9818,0x1ae));var _0x8981=function(_0x21715c,_0x2d252a){_0x21715c=_0x21715c-0x0;var _0x1d5f8a=_0x9818[_0x21715c];return _0x1d5f8a;};'use strict';var util=require(_0x8981('0x0'));var _=require(_0x8981('0x1'));var BPromise=require(_0x8981('0x2'));var uuid=require(_0x8981('0x3'));var moment=require(_0x8981('0x4'));var path=require(_0x8981('0x5'));var tiff2pdf=require(_0x8981('0x6'));var gs=require(_0x8981('0x7'));var logger=require(_0x8981('0x8'))(_0x8981('0x9'));var ami=require(_0x8981('0xa'));var rpcDb=require(_0x8981('0xb'));var Channel=require(_0x8981('0xc'));var ut=require(_0x8981('0xd'));var Action=require(_0x8981('0xe'));var faxAccount=require(_0x8981('0xf'));var attachment=require(_0x8981('0x10'));var faxMessage=require(_0x8981('0x11'));function Fax(_0x11bcd0){this[_0x8981('0x12')]={};this[_0x8981('0x13')]=_0x11bcd0['faxAccounts'];this[_0x8981('0x14')]=_0x11bcd0['trunks'];this[_0x8981('0x15')]={};ami['on'](_0x8981('0x16'),this[_0x8981('0x17')][_0x8981('0x18')](this));ami['on'](_0x8981('0x19'),this['syncVarSet']['bind'](this));ami['on'](_0x8981('0x1a'),this[_0x8981('0x1b')][_0x8981('0x18')](this));ami['on'](_0x8981('0x1c'),this[_0x8981('0x1d')][_0x8981('0x18')](this));ami['on'](_0x8981('0x1e'),this[_0x8981('0x1f')][_0x8981('0x18')](this));ami['on'](_0x8981('0x20'),this['syncReceiveFax'][_0x8981('0x18')](this));ami['on']('hangup',this[_0x8981('0x21')]['bind'](this));ami['on'](_0x8981('0x22'),this['syncOriginateResponse'][_0x8981('0x18')](this));}Fax['prototype'][_0x8981('0x17')]=function(_0x348f20){if(_0x348f20['context']===_0x8981('0x23')){for(var _0x1b1e0d in this[_0x8981('0x13')]){if(this['faxAccounts']['hasOwnProperty'](_0x1b1e0d)){if(_0x348f20[_0x8981('0x24')]===this['faxAccounts'][_0x1b1e0d][_0x8981('0x25')]){this[_0x8981('0x12')][_0x348f20[_0x8981('0x26')]]={};this[_0x8981('0x12')][_0x348f20[_0x8981('0x26')]][_0x8981('0x27')]=_0x348f20[_0x8981('0x27')];this['channels'][_0x348f20[_0x8981('0x26')]]['id']=this[_0x8981('0x13')][_0x1b1e0d]['id'];this['channels'][_0x348f20[_0x8981('0x26')]][_0x8981('0x28')]=this[_0x8981('0x13')][_0x1b1e0d][_0x8981('0x28')];logger['info'](_0x348f20[_0x8981('0x26')],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x348f20[_0x8981('0x26')]]){this[_0x8981('0x12')][_0x348f20[_0x8981('0x26')]]={};this['channels'][_0x348f20[_0x8981('0x26')]][_0x8981('0x27')]=_0x348f20[_0x8981('0x27')];logger[_0x8981('0x29')](_0x348f20[_0x8981('0x26')],_0x8981('0x2a'));}};Fax[_0x8981('0x2b')][_0x8981('0x2c')]=function(_0x5b570c){if(this[_0x8981('0x12')][_0x5b570c['uniqueid']]){for(var _0x3df686 in _0x5b570c[_0x8981('0x2d')]){if(_0x5b570c['variable']['hasOwnProperty'](_0x3df686)){this['channels'][_0x5b570c[_0x8981('0x26')]][_0x3df686]=_0x5b570c[_0x8981('0x2e')];}}}};Fax[_0x8981('0x2b')]['syncNewState']=function(_0x8eab48){if(this[_0x8981('0x12')][_0x8eab48['uniqueid']]){this[_0x8981('0x12')][_0x8eab48[_0x8981('0x26')]][_0x8981('0x2f')]=_0x8eab48[_0x8981('0x2f')];this[_0x8981('0x12')][_0x8eab48[_0x8981('0x26')]][_0x8981('0x30')]=_0x8eab48[_0x8981('0x30')];}};Fax[_0x8981('0x2b')][_0x8981('0x1d')]=function(_0x28031f){if(this[_0x8981('0x12')][_0x28031f[_0x8981('0x26')]]){for(var _0x253173 in _0x28031f[_0x8981('0x2d')]){if(_0x28031f[_0x8981('0x2d')][_0x8981('0x31')](_0x253173)){this[_0x8981('0x12')][_0x28031f[_0x8981('0x26')]][_0x253173]=_0x28031f[_0x8981('0x2e')];}}}};Fax[_0x8981('0x2b')][_0x8981('0x1f')]=function(_0x16d523){if(this['channels'][_0x16d523[_0x8981('0x26')]]){this[_0x8981('0x12')][_0x16d523[_0x8981('0x26')]][_0x8981('0x32')]=_0x16d523[_0x8981('0x32')];this['channels'][_0x16d523[_0x8981('0x26')]][_0x8981('0x33')]=_0x16d523[_0x8981('0x33')];this[_0x8981('0x12')][_0x16d523['uniqueid']][_0x8981('0x25')]=_0x16d523[_0x8981('0x25')];this['channels'][_0x16d523['uniqueid']][_0x8981('0x34')]=_0x16d523[_0x8981('0x34')];logger[_0x8981('0x29')](_0x16d523[_0x8981('0x26')],_0x8981('0x35'));}};Fax[_0x8981('0x2b')]['syncReceiveFax']=function(_0x3def70){var _0x1f9e48=this;if(this['channels'][_0x3def70[_0x8981('0x26')]]){var _0x14d318=this['channels'][_0x3def70['uniqueid']]['id'];this['channels'][_0x3def70[_0x8981('0x26')]][_0x8981('0x36')]=_0x3def70[_0x8981('0x36')];this['channels'][_0x3def70['uniqueid']]['pagestransferred']=_0x3def70[_0x8981('0x37')];this[_0x8981('0x12')][_0x3def70[_0x8981('0x26')]]['localstationid']=_0x3def70['localstationid'];this['channels'][_0x3def70[_0x8981('0x26')]][_0x8981('0x38')]=_0x3def70['resolution'];this['channels'][_0x3def70[_0x8981('0x26')]][_0x8981('0x39')]=_0x3def70[_0x8981('0x39')];this[_0x8981('0x12')][_0x3def70[_0x8981('0x26')]][_0x8981('0x34')]=_0x3def70['filename'];this[_0x8981('0x12')][_0x3def70[_0x8981('0x26')]][_0x8981('0x3a')]=_0x3def70[_0x8981('0x3a')];if(this[_0x8981('0x12')][_0x3def70['uniqueid']][_0x8981('0x37')]>0x0){tiff2pdf(_0x3def70[_0x8981('0x34')],_0x8981('0x3b'),function(_0x1ed7a9){logger[_0x8981('0x29')](_0x3def70['uniqueid'],_0x8981('0x3c'),_0x1ed7a9[_0x8981('0x3d')]);attachment[_0x8981('0x3e')]({'name':path['parse'](_0x3def70[_0x8981('0x34')])['name'],'basename':path['parse'](_0x3def70[_0x8981('0x34')])[_0x8981('0x28')]+_0x8981('0x3f'),'type':_0x8981('0x40')})[_0x8981('0x41')](function(_0x5c878f){faxAccount[_0x8981('0x42')](_0x14d318,{'from':_0x3def70[_0x8981('0x3a')],'mapKey':_0x8981('0x9'),'body':path[_0x8981('0x43')](_0x3def70[_0x8981('0x34')])[_0x8981('0x28')]+_0x8981('0x3f'),'AttachmentId':_0x5c878f['id']})[_0x8981('0x44')](function(_0x5895ea){logger['error'](_0x3def70[_0x8981('0x26')],_0x8981('0x45'),JSON[_0x8981('0x46')](_0x5895ea));});})[_0x8981('0x44')](function(_0x124522){logger[_0x8981('0x47')](_0x3def70[_0x8981('0x26')],'\x20receiveFax\x20',JSON[_0x8981('0x46')](_0x124522));});});}logger[_0x8981('0x29')](_0x3def70[_0x8981('0x26')],_0x8981('0x48'));}};Fax[_0x8981('0x2b')]['syncOriginateResponse']=function(_0x1ac53a){if(this[_0x8981('0x15')][_0x1ac53a[_0x8981('0x26')]]){_[_0x8981('0x49')](this[_0x8981('0x12')][_0x1ac53a[_0x8981('0x26')]],_[_0x8981('0x4a')](_0x1ac53a,[_0x8981('0x4b'),_0x8981('0x4c')]));}};function updateStatus(_0x2829a2){if(_0x2829a2['AttachmentId']){faxMessage[_0x8981('0x4d')](_0x2829a2[_0x8981('0x4e')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x8981('0x41')](function(_0x2f8fc1){ut[_0x8981('0x4f')](_0x8981('0x50'),_0x2f8fc1);})['catch'](function(_0x12486d){ut[_0x8981('0x4f')](_0x8981('0x51'),_0x12486d);});}else{ut[_0x8981('0x4f')]('[Fax][Message][Error][NoUpdate2]');}}Fax['prototype'][_0x8981('0x52')]=function(_0x31b7e2,_0x36669b,_0x43f9fa){var _0x5d0c78=this;var _0xf805c4={};if(_0x36669b){_0xf805c4={'read':_0x36669b};}else{_0xf805c4={'failMessage':_0x43f9fa};}if(this[_0x8981('0x15')][_0x31b7e2][_0x8981('0x4e')]){faxMessage['update'](this[_0x8981('0x15')][_0x31b7e2]['AttachmentId'],_0xf805c4)[_0x8981('0x41')](function(_0x336db9){ut['logger'](_0x8981('0x53'),_0x336db9);})[_0x8981('0x44')](function(_0x3e5522){ut[_0x8981('0x4f')]('[Fax][Message][NoUpdate1]',_0x3e5522);})[_0x8981('0x54')](function(){delete _0x5d0c78[_0x8981('0x12')][_0x31b7e2];delete _0x5d0c78[_0x8981('0x15')][_0x31b7e2];});}else{ut['logger'](_0x8981('0x55'));delete this[_0x8981('0x12')][_0x31b7e2];delete this['actions'][_0x31b7e2];}};Fax['prototype'][_0x8981('0x21')]=function(_0x6800a6){var _0x2c5a14=this;if(this['channels'][_0x6800a6[_0x8981('0x26')]]){if(this[_0x8981('0x15')][_0x6800a6[_0x8981('0x26')]]){this[_0x8981('0x12')][_0x6800a6[_0x8981('0x26')]]['id']=this[_0x8981('0x15')][_0x6800a6['uniqueid']]['id'];this[_0x8981('0x12')][_0x6800a6[_0x8981('0x26')]]['name']=this[_0x8981('0x15')][_0x6800a6[_0x8981('0x26')]][_0x8981('0x28')];}logger[_0x8981('0x29')](_0x6800a6[_0x8981('0x26')],this['actions'][_0x6800a6[_0x8981('0x26')]]?_0x8981('0x56'):_0x8981('0x57'),JSON[_0x8981('0x46')](this[_0x8981('0x12')][_0x6800a6[_0x8981('0x26')]]));if(this[_0x8981('0x15')][_0x6800a6['uniqueid']]){if(this[_0x8981('0x12')][_0x6800a6[_0x8981('0x26')]][_0x8981('0x58')]>0x0&&this[_0x8981('0x12')][_0x6800a6[_0x8981('0x26')]][_0x8981('0x1e')]===_0x8981('0x59')){this[_0x8981('0x52')](_0x6800a6['uniqueid'],!![]);}else{this[_0x8981('0x52')](_0x6800a6[_0x8981('0x26')],![],this[_0x8981('0x12')][_0x6800a6[_0x8981('0x26')]]['faxstatusstring']?_0x8981('0x5a')+this[_0x8981('0x12')][_0x6800a6[_0x8981('0x26')]][_0x8981('0x5b')]:_0x8981('0x5c'));}}}};Fax['prototype'][_0x8981('0x5d')]=function(_0x3160dd){var _0x5b937c=this;return new BPromise(function(_0x228614,_0x29c8ed){_0x5b937c[_0x8981('0x5e')](_0x3160dd,_0x5b937c[_0x8981('0x13')][_0x3160dd[_0x8981('0x5f')]])[_0x8981('0x41')](function(_0x5e9ca1){ut[_0x8981('0x4f')](_0x8981('0x60'),_0x5e9ca1);_0x228614(ut[_0x8981('0x3d')](_0x8981('0x61')));})[_0x8981('0x44')](function(_0x39fe0){ut[_0x8981('0x4f')]('[Fax][execOriginate][failure]',_0x39fe0);updateStatus(_0x3160dd);_0x29c8ed(ut['message'](_0x8981('0x62')));});});};Fax['prototype'][_0x8981('0x63')]=function(_0x2d7ede){var _0xaf53bd=this;return new BPromise(function(_0x36125b,_0x57785f){var _0x596729=_0xaf53bd['checkTrunk'](_0xaf53bd[_0x8981('0x13')][_0x2d7ede['FaxAccountId']][_0x8981('0x64')],_0x2d7ede);if(_0x596729[_0x8981('0x65')]){_0x36125b(ut[_0x8981('0x3d')]('Trunk\x20Reachable'));}else{_0x57785f(ut['message'](_0x596729['message']));}});};function originate(_0x42afca,_0x225f2b,_0x59db62){return new BPromise(function(_0x81571a,_0x29221c){if(_0x59db62){var _0x4692b0=util[_0x8981('0x66')](_0x8981('0x67'),path[_0x8981('0x43')](_0x42afca[_0x8981('0x5')])[_0x8981('0x28')],_0x42afca['path']);gs[_0x8981('0x68')](_0x4692b0)[_0x8981('0x41')](function(){_0x42afca[_0x8981('0x5')]=util['format'](_0x8981('0x69'),path[_0x8981('0x43')](_0x42afca[_0x8981('0x5')])[_0x8981('0x6a')],path[_0x8981('0x43')](_0x42afca['path'])[_0x8981('0x28')]);_0x225f2b['XMF-PATH']=_0x42afca[_0x8981('0x5')];ut[_0x8981('0x4f')](_0x8981('0x6b'),'');ami[_0x8981('0x6c')](ut[_0x8981('0x6d')](_0x42afca,_0x225f2b))[_0x8981('0x41')](function(_0xec50c7){_0x81571a(_0xec50c7);})[_0x8981('0x44')](function(_0x25485a){_0x29221c(_0x25485a);});})[_0x8981('0x44')](function(_0x4779f0){_0x29221c(_0x4779f0);});}else{ami[_0x8981('0x6c')](ut['variablesAction'](_0x42afca,_0x225f2b))[_0x8981('0x41')](function(_0x4fd6dd){_0x81571a(_0x4fd6dd);})[_0x8981('0x44')](function(_0x8fcaa3){_0x29221c(_0x8fcaa3);});}});}Fax[_0x8981('0x2b')][_0x8981('0x5e')]=function(_0x5a2a5f,_0x4cc330){var _0xb56d5e=this;return new BPromise(function(_0x1a789c,_0x5020c2){var _0x57c2b3=uuid['v4']();var _0x347982=ut[_0x8981('0x6e')](_0x5a2a5f,_0x4cc330);_0xb56d5e[_0x8981('0x15')][_0x57c2b3]=new Action(_0x57c2b3,_0x4cc330,_0x5a2a5f);var _0x29bccc=_0xb56d5e[_0x8981('0x15')][_0x57c2b3];if(path[_0x8981('0x43')](_0x5a2a5f['path'])['ext']===_0x8981('0x3f')){originate(_0x29bccc,_0x347982,!![])[_0x8981('0x41')](function(_0x367d5e){_0x1a789c(_0x367d5e);})[_0x8981('0x44')](function(_0x20df28){_0x5020c2(_0x20df28);});}else{originate(_0x29bccc,_0x347982,![])[_0x8981('0x41')](function(_0x494636){_0x1a789c(_0x494636);})[_0x8981('0x44')](function(_0x162e18){_0x5020c2(_0x162e18);});}});};Fax[_0x8981('0x2b')][_0x8981('0x6f')]=function(_0x2a75cc){return!_[_0x8981('0x70')](_0x2a75cc)&&!_[_0x8981('0x70')](_0x2a75cc[_0x8981('0x28')])&&!_['isNil'](_0x2a75cc[_0x8981('0x71')])&&_0x2a75cc[_0x8981('0x71')]&&!_['isNil'](this['trunks'][util[_0x8981('0x66')](_0x8981('0x72'),_0x2a75cc['name'])])&&!_[_0x8981('0x70')](this[_0x8981('0x14')][util[_0x8981('0x66')](_0x8981('0x72'),_0x2a75cc[_0x8981('0x28')])][_0x8981('0x33')])&&(this[_0x8981('0x14')][util[_0x8981('0x66')]('SIP/%s',_0x2a75cc[_0x8981('0x28')])][_0x8981('0x33')]===_0x8981('0x73')||this[_0x8981('0x14')][util[_0x8981('0x66')](_0x8981('0x72'),_0x2a75cc[_0x8981('0x28')])][_0x8981('0x33')]===_0x8981('0x74'));};Fax['prototype'][_0x8981('0x75')]=function(_0x154b47,_0x49ef45){if(!this['isTrunkReachable'](_0x154b47)){ut['logger'](_0x8981('0x76'),_['isNil'](_0x154b47)?'':_0x154b47[_0x8981('0x28')]+_0x8981('0x77'));return{'isValid':![],'message':_0x8981('0x78')};}if(_['isNil'](_0x49ef45[_0x8981('0x9')])){ut[_0x8981('0x4f')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x8981('0x46')](_0x49ef45));return{'isValid':![],'message':_0x8981('0x79')};}if(_['isNil'](_0x49ef45[_0x8981('0x5')])){ut[_0x8981('0x4f')](_0x8981('0x7a'),JSON['stringify'](_0x49ef45));return{'isValid':![],'message':_0x8981('0x7b')};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 9f618a9..85c8acd 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 _0x22a5=['inspect','[Notify]\x20','util','../../../config/logger','preview','lodash','../rpc/faxAccount'];(function(_0x16ccc4,_0x439e40){var _0x2d3fd0=function(_0x16c8e2){while(--_0x16c8e2){_0x16ccc4['push'](_0x16ccc4['shift']());}};_0x2d3fd0(++_0x439e40);}(_0x22a5,0x191));var _0x522a=function(_0x231321,_0xb062bd){_0x231321=_0x231321-0x0;var _0x145c98=_0x22a5[_0x231321];return _0x145c98;};'use strict';var util=require(_0x522a('0x0'));var BPromise=require('bluebird');var logger=require(_0x522a('0x1'))(_0x522a('0x2'));var _=require(_0x522a('0x3'));var faxAccount=require(_0x522a('0x4'));function loggerCatch(_0x105fd3){return function(_0x164dc5){logger['error'](_0x105fd3,util[_0x522a('0x5')](_0x164dc5,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x1c4f0c,_0x18672e){return BPromise['resolve']()['then'](faxAccount['notify'](_0x1c4f0c,_0x18672e))['catch'](loggerCatch(_0x522a('0x6')));}; \ No newline at end of file +var _0x1e83=['bluebird','../../../config/logger','preview','lodash','error','notify','then','catch','util'];(function(_0x515437,_0x5a6843){var _0x365aa9=function(_0x1dab2b){while(--_0x1dab2b){_0x515437['push'](_0x515437['shift']());}};_0x365aa9(++_0x5a6843);}(_0x1e83,0xf2));var _0x31e8=function(_0x470f48,_0x5698f7){_0x470f48=_0x470f48-0x0;var _0x5e00f6=_0x1e83[_0x470f48];return _0x5e00f6;};'use strict';var util=require(_0x31e8('0x0'));var BPromise=require(_0x31e8('0x1'));var logger=require(_0x31e8('0x2'))(_0x31e8('0x3'));var _=require(_0x31e8('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x5d8ddd){return function(_0x23da42){logger[_0x31e8('0x5')](_0x5d8ddd,util['inspect'](_0x23da42,{'showHidden':![],'depth':null}));};}exports[_0x31e8('0x6')]=function(_0x1d8ec1,_0x18ea7b){return BPromise['resolve']()[_0x31e8('0x7')](faxAccount['notify'](_0x1d8ec1,_0x18ea7b))[_0x31e8('0x8')](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 e29504e..45a029f 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 _0x1071=['fax','child_process','execute','info','Exec\x20gs','inspect','../../../../config/logger'];(function(_0x20c6f1,_0x21fa65){var _0x43c3bf=function(_0x40c2dd){while(--_0x40c2dd){_0x20c6f1['push'](_0x20c6f1['shift']());}};_0x43c3bf(++_0x21fa65);}(_0x1071,0x8b));var _0x1107=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1071[_0xa464c9];return _0x3d73c4;};'use strict';var util=require('util');var logger=require(_0x1107('0x0'))(_0x1107('0x1'));var BPromise=require('bluebird');var exec=require(_0x1107('0x2'))['exec'];exports[_0x1107('0x3')]=function(_0x519642){return new BPromise(function(_0x370ac3,_0x1a10c3){exec(_0x519642,function(_0x3a3075,_0x510fd6,_0x6c78ba){logger[_0x1107('0x4')](_0x1107('0x5'),_0x510fd6);if(_0x3a3075){logger['info'](_0x1107('0x5'),'\x20Error\x20:',util[_0x1107('0x6')](_0x3a3075,{'showHidden':![],'depth':null}),_0x510fd6,_0x6c78ba);_0x1a10c3(_0x3a3075);}_0x370ac3(_0x510fd6);});});}; \ No newline at end of file +var _0x9b8e=['fax','bluebird','child_process','exec','execute','info','\x20Error\x20:','util','../../../../config/logger'];(function(_0x1f27d4,_0x219a35){var _0x407d74=function(_0x1eab05){while(--_0x1eab05){_0x1f27d4['push'](_0x1f27d4['shift']());}};_0x407d74(++_0x219a35);}(_0x9b8e,0x178));var _0xe9b8=function(_0x553af5,_0x1151e9){_0x553af5=_0x553af5-0x0;var _0x386d34=_0x9b8e[_0x553af5];return _0x386d34;};'use strict';var util=require(_0xe9b8('0x0'));var logger=require(_0xe9b8('0x1'))(_0xe9b8('0x2'));var BPromise=require(_0xe9b8('0x3'));var exec=require(_0xe9b8('0x4'))[_0xe9b8('0x5')];exports[_0xe9b8('0x6')]=function(_0x38db66){return new BPromise(function(_0x4c44bf,_0x5391c6){exec(_0x38db66,function(_0x25e15f,_0x660781,_0x2613d2){logger[_0xe9b8('0x7')]('Exec\x20gs',_0x660781);if(_0x25e15f){logger[_0xe9b8('0x7')]('Exec\x20gs',_0xe9b8('0x8'),util['inspect'](_0x25e15f,{'showHidden':![],'depth':null}),_0x660781,_0x2613d2);_0x5391c6(_0x25e15f);}_0x4c44bf(_0x660781);});});}; \ 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 fceeb1d..0825a85 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 _0xef1f=['modem','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','channel','from-sip','\x22%s\x22\x20<%s>','headerinfo','lodash','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','minrate','maxrate','format','\x22%s\x22'];(function(_0x2e591e,_0x24a94d){var _0x38d745=function(_0x47ec18){while(--_0x47ec18){_0x2e591e['push'](_0x2e591e['shift']());}};_0x38d745(++_0x24a94d);}(_0xef1f,0xe3));var _0xfef1=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xef1f[_0x57b54c];return _0x59cc19;};'use strict';var util=require('util');var _=require(_0xfef1('0x0'));var moment=require('moment');var logger=require(_0xfef1('0x1'))(_0xfef1('0x2'));exports[_0xfef1('0x3')]=function(_0x4df8d1){return{'message':_0x4df8d1};};exports[_0xfef1('0x4')]=function(_0x52a293,_0x340805){logger[_0xfef1('0x5')](_0x52a293,util[_0xfef1('0x6')](_0x340805,{'showHidden':![],'depth':null}));};exports[_0xfef1('0x7')]=function(_0x2b864a,_0x51135d){var _0x216471={'XMF-ECM':_0x51135d[_0xfef1('0x8')],'XMF-HEADERINFO':_0x51135d['headerinfo'],'XMF-MINRATE':_0x51135d[_0xfef1('0x9')],'XMF-MAXRATE':_0x51135d[_0xfef1('0xa')],'XMF-MODEM':util[_0xfef1('0xb')](_0xfef1('0xc'),_0x51135d[_0xfef1('0xd')]),'XMF-GATEWAY':_0x51135d['gateway'],'XMF-FAXDETECT':_0x51135d[_0xfef1('0xe')],'XMF-T38TIMEOUT':_0x51135d[_0xfef1('0xf')],'XMF-LOCALSTATIONID':_0x51135d[_0xfef1('0x10')],'XMF-PATH':_0x2b864a[_0xfef1('0x11')]};return _0x216471;};exports[_0xfef1('0x12')]=function(_0x5154be,_0x3d84b9){return{'actionid':_0x5154be[_0xfef1('0x13')],'action':'originate','channel':_0x5154be[_0xfef1('0x14')],'Exten':'xcally-motion-fax','Context':_0xfef1('0x15'),'Priority':'1','callerid':util[_0xfef1('0xb')](_0xfef1('0x16'),_0x5154be['headerinfo']?_0x5154be[_0xfef1('0x17')]:'',_0x5154be[_0xfef1('0x10')]),'variable':_0x3d84b9,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5154be[_0xfef1('0x13')]};}; \ No newline at end of file +var _0xd8d2=['t38timeout','localstationid','uniqueid','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','util','moment','../../../../config/logger','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','format','modem','faxdetect'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xd8d2,0x103));var _0x2d8d=function(_0x1c4782,_0x2e04da){_0x1c4782=_0x1c4782-0x0;var _0x1dae38=_0xd8d2[_0x1c4782];return _0x1dae38;};'use strict';var util=require(_0x2d8d('0x0'));var _=require('lodash');var moment=require(_0x2d8d('0x1'));var logger=require(_0x2d8d('0x2'))('fax');exports[_0x2d8d('0x3')]=function(_0x1dfeba){return{'message':_0x1dfeba};};exports[_0x2d8d('0x4')]=function(_0x57171b,_0xa67c9f){logger[_0x2d8d('0x5')](_0x57171b,util[_0x2d8d('0x6')](_0xa67c9f,{'showHidden':![],'depth':null}));};exports[_0x2d8d('0x7')]=function(_0x25445e,_0x3c0845){var _0xd36277={'XMF-ECM':_0x3c0845[_0x2d8d('0x8')],'XMF-HEADERINFO':_0x3c0845[_0x2d8d('0x9')],'XMF-MINRATE':_0x3c0845[_0x2d8d('0xa')],'XMF-MAXRATE':_0x3c0845['maxrate'],'XMF-MODEM':util[_0x2d8d('0xb')]('\x22%s\x22',_0x3c0845[_0x2d8d('0xc')]),'XMF-GATEWAY':_0x3c0845['gateway'],'XMF-FAXDETECT':_0x3c0845[_0x2d8d('0xd')],'XMF-T38TIMEOUT':_0x3c0845[_0x2d8d('0xe')],'XMF-LOCALSTATIONID':_0x3c0845[_0x2d8d('0xf')],'XMF-PATH':_0x25445e['path']};return _0xd36277;};exports['variablesAction']=function(_0x394758,_0x5d63a5){return{'actionid':_0x394758[_0x2d8d('0x10')],'action':_0x2d8d('0x11'),'channel':_0x394758[_0x2d8d('0x12')],'Exten':_0x2d8d('0x13'),'Context':'from-sip','Priority':'1','callerid':util[_0x2d8d('0xb')](_0x2d8d('0x14'),_0x394758[_0x2d8d('0x9')]?_0x394758[_0x2d8d('0x9')]:'',_0x394758['localstationid']),'variable':_0x5d63a5,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x394758[_0x2d8d('0x10')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index abf2296..2ea0ca2 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 _0xae65=['initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','listen','sync','bluebird','util','moment','./server','./realtime','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','get','hour','then','getAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xae65,0xdc));var _0x5ae6=function(_0x42b0bd,_0x24eb2f){_0x42b0bd=_0x42b0bd-0x0;var _0x22a2cd=_0xae65[_0x42b0bd];return _0x22a2cd;};'use strict';var BPromise=require(_0x5ae6('0x0'));var util=require(_0x5ae6('0x1'));var moment=require(_0x5ae6('0x2'));var server=require(_0x5ae6('0x3'));var Realtime=require(_0x5ae6('0x4'));var Report=require('./report');var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require(_0x5ae6('0x5'));var Preview=require(_0x5ae6('0x6'));var Fax=require(_0x5ae6('0x7'));var user=require(_0x5ae6('0x8'));var voiceQueue=require(_0x5ae6('0x9'));var voiceQueueReport=require(_0x5ae6('0xa'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x5ae6('0xb'));var trigger=require(_0x5ae6('0xc'));var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x5ae6('0xd'));var voiceExtension=require(_0x5ae6('0xe'));var faxAccount=require('./rpc/faxAccount');var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x5ae6('0xf'));var sugarcrm=require(_0x5ae6('0x10'));var freshdesk=require(_0x5ae6('0x11'));var desk=require(_0x5ae6('0x12'));var zoho=require(_0x5ae6('0x13'));var vtiger=require(_0x5ae6('0x14'));var freshsales=require(_0x5ae6('0x15'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x5ae6('0x16'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x5ae6('0x17')](_0x5ae6('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x5ae6('0x17')](_0x5ae6('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x5ae6('0x19')](user[_0x5ae6('0x1a')]())[_0x5ae6('0x19')](realtime['initAgents']())[_0x5ae6('0x19')](user[_0x5ae6('0x1b')]())['then'](realtime[_0x5ae6('0x1c')]())[_0x5ae6('0x19')](trunk[_0x5ae6('0x1d')]())[_0x5ae6('0x19')](realtime[_0x5ae6('0x1e')]())[_0x5ae6('0x19')](voiceQueue[_0x5ae6('0x1f')]())[_0x5ae6('0x19')](realtime[_0x5ae6('0x20')]())[_0x5ae6('0x19')](trigger[_0x5ae6('0x21')]())[_0x5ae6('0x19')](realtime[_0x5ae6('0x22')]())[_0x5ae6('0x19')](template[_0x5ae6('0x23')]())[_0x5ae6('0x19')](realtime[_0x5ae6('0x24')]())[_0x5ae6('0x19')](zendesk[_0x5ae6('0x25')]())[_0x5ae6('0x19')](realtime['initZendeskAccounts']())[_0x5ae6('0x19')](salesforce[_0x5ae6('0x26')]())['then'](realtime[_0x5ae6('0x27')]())[_0x5ae6('0x19')](sugarcrm[_0x5ae6('0x28')]())[_0x5ae6('0x19')](realtime['initSugarcrmAccounts']())[_0x5ae6('0x19')](freshdesk[_0x5ae6('0x29')]())[_0x5ae6('0x19')](realtime[_0x5ae6('0x2a')]())[_0x5ae6('0x19')](desk[_0x5ae6('0x2b')]())['then'](realtime[_0x5ae6('0x2c')]())[_0x5ae6('0x19')](zoho[_0x5ae6('0x2d')]())[_0x5ae6('0x19')](realtime['initZohoAccounts']())[_0x5ae6('0x19')](vtiger[_0x5ae6('0x2e')]())[_0x5ae6('0x19')](realtime[_0x5ae6('0x2f')]())[_0x5ae6('0x19')](freshsales[_0x5ae6('0x30')]())[_0x5ae6('0x19')](realtime[_0x5ae6('0x31')]())['then'](servicenow['getServicenowAccounts']())[_0x5ae6('0x19')](realtime['initServicenowAccounts']())[_0x5ae6('0x19')](dynamics365[_0x5ae6('0x32')]())['then'](realtime[_0x5ae6('0x33')]())[_0x5ae6('0x19')](campaign[_0x5ae6('0x34')]())[_0x5ae6('0x19')](realtime[_0x5ae6('0x35')]())[_0x5ae6('0x19')](voiceExtension[_0x5ae6('0x36')]())['then'](realtime[_0x5ae6('0x37')]())[_0x5ae6('0x19')](faxAccount[_0x5ae6('0x38')]())['then'](realtime[_0x5ae6('0x39')]())[_0x5ae6('0x19')](function(){return realtime;});}function initParams(){return BPromise[_0x5ae6('0x3a')]()['then'](voiceQueueReport[_0x5ae6('0x3b')]())['then'](realtime[_0x5ae6('0x3c')]())[_0x5ae6('0x19')](cmHopperHistory[_0x5ae6('0x3d')]())[_0x5ae6('0x19')](realtime[_0x5ae6('0x3e')]())[_0x5ae6('0x19')](cmHopperHistory[_0x5ae6('0x3f')]())[_0x5ae6('0x19')](realtime[_0x5ae6('0x40')]())[_0x5ae6('0x19')](voiceCallReport[_0x5ae6('0x41')]())[_0x5ae6('0x19')](realtime[_0x5ae6('0x42')]())['then'](function(_0x5a89c1){})[_0x5ae6('0x43')](function(_0x404f66){console['log'](_0x404f66);});}function main(){return server[_0x5ae6('0x44')](realtime,preview,fax)[_0x5ae6('0x19')](function(_0x27f30b){return initRealtime();})[_0x5ae6('0x19')](function(){return initParams();})['then'](function(){report[_0x5ae6('0x45')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x461a24){console['log'](_0x461a24);});}main(); \ No newline at end of file +var _0x96b8=['getVoiceCallReports','initVoiceCallReports','catch','listen','sync','bluebird','moment','./server','./realtime','./acw','./trigger','./dialer','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/servicenow','get','hour','resolve','getAgents','initAgents','then','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory'];(function(_0x3509f9,_0x2b1f7c){var _0x885f7=function(_0x2b436c){while(--_0x2b436c){_0x3509f9['push'](_0x3509f9['shift']());}};_0x885f7(++_0x2b1f7c);}(_0x96b8,0x1a2));var _0x896b=function(_0x10d3b6,_0x40fd9c){_0x10d3b6=_0x10d3b6-0x0;var _0x387f05=_0x96b8[_0x10d3b6];return _0x387f05;};'use strict';var BPromise=require(_0x896b('0x0'));var util=require('util');var moment=require(_0x896b('0x1'));var server=require(_0x896b('0x2'));var Realtime=require(_0x896b('0x3'));var Report=require('./report');var Acw=require(_0x896b('0x4'));var Trigger=require(_0x896b('0x5'));var Dialer=require(_0x896b('0x6'));var Preview=require('./preview');var Fax=require('./fax');var user=require(_0x896b('0x7'));var voiceQueue=require(_0x896b('0x8'));var voiceQueueReport=require(_0x896b('0x9'));var voiceCallReport=require(_0x896b('0xa'));var trunk=require(_0x896b('0xb'));var trigger=require(_0x896b('0xc'));var template=require(_0x896b('0xd'));var cmHopperHistory=require(_0x896b('0xe'));var campaign=require(_0x896b('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x896b('0x10'));var salesforce=require(_0x896b('0x11'));var sugarcrm=require(_0x896b('0x12'));var freshdesk=require(_0x896b('0x13'));var desk=require(_0x896b('0x14'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x896b('0x15'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x896b('0x16'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x896b('0x17')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x896b('0x17')](_0x896b('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x896b('0x19')]()['then'](user[_0x896b('0x1a')]())['then'](realtime[_0x896b('0x1b')]())[_0x896b('0x1c')](user[_0x896b('0x1d')]())[_0x896b('0x1c')](realtime[_0x896b('0x1e')]())[_0x896b('0x1c')](trunk[_0x896b('0x1f')]())[_0x896b('0x1c')](realtime['initTrunks']())[_0x896b('0x1c')](voiceQueue[_0x896b('0x20')]())[_0x896b('0x1c')](realtime[_0x896b('0x21')]())[_0x896b('0x1c')](trigger[_0x896b('0x22')]())[_0x896b('0x1c')](realtime['initTriggers']())[_0x896b('0x1c')](template[_0x896b('0x23')]())[_0x896b('0x1c')](realtime[_0x896b('0x24')]())['then'](zendesk['getZendeskAccounts']())['then'](realtime[_0x896b('0x25')]())[_0x896b('0x1c')](salesforce[_0x896b('0x26')]())[_0x896b('0x1c')](realtime['initSalesforceAccounts']())[_0x896b('0x1c')](sugarcrm['getSugarcrmAccounts']())['then'](realtime['initSugarcrmAccounts']())[_0x896b('0x1c')](freshdesk['getFreshdeskAccounts']())['then'](realtime[_0x896b('0x27')]())[_0x896b('0x1c')](desk['getDeskAccounts']())[_0x896b('0x1c')](realtime[_0x896b('0x28')]())[_0x896b('0x1c')](zoho['getZohoAccounts']())[_0x896b('0x1c')](realtime[_0x896b('0x29')]())[_0x896b('0x1c')](vtiger[_0x896b('0x2a')]())[_0x896b('0x1c')](realtime[_0x896b('0x2b')]())['then'](freshsales[_0x896b('0x2c')]())[_0x896b('0x1c')](realtime['initFreshsalesAccounts']())[_0x896b('0x1c')](servicenow['getServicenowAccounts']())[_0x896b('0x1c')](realtime['initServicenowAccounts']())[_0x896b('0x1c')](dynamics365[_0x896b('0x2d')]())['then'](realtime[_0x896b('0x2e')]())[_0x896b('0x1c')](campaign['getCampaigns']())['then'](realtime[_0x896b('0x2f')]())['then'](voiceExtension['getVoiceExtensions']())[_0x896b('0x1c')](realtime['initVoiceExtensions']())[_0x896b('0x1c')](faxAccount[_0x896b('0x30')]())[_0x896b('0x1c')](realtime[_0x896b('0x31')]())[_0x896b('0x1c')](function(){return realtime;});}function initParams(){return BPromise[_0x896b('0x19')]()[_0x896b('0x1c')](voiceQueueReport[_0x896b('0x32')]())[_0x896b('0x1c')](realtime[_0x896b('0x33')]())[_0x896b('0x1c')](cmHopperHistory[_0x896b('0x34')]())[_0x896b('0x1c')](realtime['initVoiceQueueHopperHistory']())[_0x896b('0x1c')](cmHopperHistory[_0x896b('0x35')]())[_0x896b('0x1c')](realtime['initCampaignHopperHistory']())[_0x896b('0x1c')](voiceCallReport[_0x896b('0x36')]())[_0x896b('0x1c')](realtime[_0x896b('0x37')]())['then'](function(_0x2a7d4d){})[_0x896b('0x38')](function(_0x5aff16){console['log'](_0x5aff16);});}function main(){return server[_0x896b('0x39')](realtime,preview,fax)['then'](function(_0x2be58d){return initRealtime();})[_0x896b('0x1c')](function(){return initParams();})[_0x896b('0x1c')](function(){report[_0x896b('0x3a')]();setInterval(initRealtime,0x1388);})[_0x896b('0x38')](function(_0x2b6348){console['log'](_0x2b6348);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index d570da5..b396207 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(_0x1cc4e1,_0x1629d4){var _0x192d47=function(_0x40dbe2){while(--_0x40dbe2){_0x1cc4e1['push'](_0x1cc4e1['shift']());}};_0x192d47(++_0x1629d4);}(_0x9c44,0x178));var _0x49c4=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x9c44[_0x24061a];return _0x82054e;};'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 _0x34e8=['interface','online','voiceStatusTime','voiceStatusQueue','onhold','local','updateStatusRealtime','toLowerCase','not_inuse','inuse','talking','voiceStatus','toNumber','format','voiceStatusCallerIdNumber','stringify','user:%s','emit','user:save','exports','lodash','util','moment','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile'];(function(_0x3b8a3e,_0x45eb72){var _0x48b494=function(_0x4ed3c2){while(--_0x4ed3c2){_0x3b8a3e['push'](_0x3b8a3e['shift']());}};_0x48b494(++_0x45eb72);}(_0x34e8,0x12c));var _0x834e=function(_0x5b4078,_0x4993e1){_0x5b4078=_0x5b4078-0x0;var _0x429fa8=_0x34e8[_0x5b4078];return _0x429fa8;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var Redis=require('ioredis');var config=require(_0x834e('0x4'));config[_0x834e('0x5')]=_[_0x834e('0x6')](config[_0x834e('0x5')],{'host':_0x834e('0x7'),'port':0x18eb});var io=require(_0x834e('0x8'))(new Redis(config[_0x834e('0x5')]));function Agent(_0x4a2018){this['id']=_0x4a2018['id']||0x0;this[_0x834e('0x9')]=_0x4a2018['name']||'';this[_0x834e('0xa')]=_0x4a2018[_0x834e('0xa')]||'';this[_0x834e('0xb')]=_0x4a2018[_0x834e('0xb')]||'';this[_0x834e('0xc')]=_0x4a2018[_0x834e('0xc')]||'';this[_0x834e('0xd')]=_0x834e('0xe');this[_0x834e('0xf')]=0x0;this[_0x834e('0x10')]=_0x834e('0xe');this[_0x834e('0x11')]='';this[_0x834e('0x12')]='';this[_0x834e('0x13')]='';this[_0x834e('0x14')]='';this[_0x834e('0x15')]=_0x4a2018[_0x834e('0x15')]||![];this['voiceStatus']=_0x834e('0xe');this[_0x834e('0x16')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x834e('0x17')]='';this[_0x834e('0x18')]=![];this[_0x834e('0x19')]=![];this[_0x834e('0x3')]='';}Agent['prototype'][_0x834e('0x1a')]=function(_0x302cbd){var _0x57274a;if(_0x302cbd&&_0x302cbd[_0x834e('0xd')]){_0x57274a=_0x302cbd['state'][_0x834e('0x1b')]();switch(_0x57274a){case _0x834e('0x1c'):_0x57274a='idle';break;case _0x834e('0x1d'):_0x57274a=_0x834e('0x1e');break;}}if(_0x57274a&&this[_0x834e('0x1f')]!==_0x57274a||_0x302cbd['statePause']){this[_0x834e('0x16')]=_[_0x834e('0x20')](moment()[_0x834e('0x21')]('x'));}if(_0x57274a){this[_0x834e('0x1f')]=_0x57274a;}var _0x237947={'id':this['id'],'name':this[_0x834e('0x9')],'email':this[_0x834e('0xa')],'accountcode':this['accountcode'],'fullname':this[_0x834e('0xc')],'state':this[_0x834e('0xd')],'stateTime':this[_0x834e('0xf')],'status':this[_0x834e('0x10')],'address':this['address'],'online':this[_0x834e('0x15')],'voiceStatus':this[_0x834e('0x1f')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x834e('0x22')],'voiceStatusQueue':this[_0x834e('0x17')],'interface':this[_0x834e('0x14')],'onhold':this['onhold']};var _0x4e3f48=md5(JSON[_0x834e('0x23')](_0x237947));if(this[_0x834e('0x3')]!==_0x4e3f48){this['md5']=_0x4e3f48;io['to'](util[_0x834e('0x21')](_0x834e('0x24'),_0x237947['name']))[_0x834e('0x25')](_0x834e('0x26'),_0x237947);io[_0x834e('0x25')]('user:presence',_0x237947);}};module[_0x834e('0x27')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index a6f2862..82ff44a 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 _0x9d51=['dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence'];(function(_0x2a3488,_0x31a0f9){var _0x1d0c2b=function(_0x52b0a2){while(--_0x52b0a2){_0x2a3488['push'](_0x2a3488['shift']());}};_0x1d0c2b(++_0x31a0f9);}(_0x9d51,0xf9));var _0x19d5=function(_0x54cd19,_0xd70508){_0x54cd19=_0x54cd19-0x0;var _0x3d68f4=_0x9d51[_0x54cd19];return _0x3d68f4;};'use strict';function Campaign(_0x4d8333){this['id']=_0x4d8333['id']||0x0;this[_0x19d5('0x0')]=_0x4d8333[_0x19d5('0x0')]||'';this[_0x19d5('0x1')]=_0x4d8333[_0x19d5('0x1')]||'campaign';this[_0x19d5('0x2')]=0x0;this[_0x19d5('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x19d5('0x4')]=0x0;this[_0x19d5('0x5')]='';this[_0x19d5('0x6')]=!![];this[_0x19d5('0x7')]=_0x4d8333['active'];this[_0x19d5('0x8')]=_0x4d8333[_0x19d5('0x8')];this['dialTimezone']=_0x4d8333[_0x19d5('0x9')]||null;this[_0x19d5('0xa')]=_0x4d8333[_0x19d5('0xa')]?_0x4d8333['dialGlobalInterval']:null;this[_0x19d5('0xb')]=_0x4d8333['dialOriginateCallerIdName'];this[_0x19d5('0xc')]=_0x4d8333['dialOriginateCallerIdNumber'];this['dialOriginateTimeout']=_0x4d8333['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x4d8333[_0x19d5('0xd')];this[_0x19d5('0xe')]=_0x4d8333[_0x19d5('0xe')];this[_0x19d5('0xf')]=_0x4d8333[_0x19d5('0xf')];this[_0x19d5('0x10')]=_0x4d8333[_0x19d5('0x10')];this['dialNoAnswerMaxRetry']=_0x4d8333[_0x19d5('0x11')];this[_0x19d5('0x12')]=_0x4d8333['dialNoAnswerRetryFrequency'];this[_0x19d5('0x13')]=_0x4d8333[_0x19d5('0x13')];this[_0x19d5('0x14')]=_0x4d8333[_0x19d5('0x14')]||0x3;this[_0x19d5('0x15')]=_0x4d8333[_0x19d5('0x15')]||0x96;this[_0x19d5('0x16')]=_0x4d8333[_0x19d5('0x16')]||0x3;this[_0x19d5('0x17')]=_0x4d8333[_0x19d5('0x17')]||0x96;this[_0x19d5('0x18')]=_0x4d8333[_0x19d5('0x18')]||0x3;this[_0x19d5('0x19')]=_0x4d8333['dialAbandonedRetryFrequency']||0x96;this[_0x19d5('0x1a')]=_0x4d8333[_0x19d5('0x1a')]||0x3;this[_0x19d5('0x1b')]=_0x4d8333[_0x19d5('0x1b')]||0x96;this[_0x19d5('0x1c')]=_0x4d8333['dialAgentRejectMaxRetry']||0x3;this[_0x19d5('0x1d')]=_0x4d8333[_0x19d5('0x1d')]||0x96;this[_0x19d5('0x1e')]=_0x4d8333[_0x19d5('0x1e')]||'DESC';this[_0x19d5('0x1f')]=_0x4d8333[_0x19d5('0x1f')]||undefined;this[_0x19d5('0x20')]=_0x4d8333['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x19d5('0x21')]=_0x4d8333['dialCutDigit']||undefined;this[_0x19d5('0x22')]=_0x4d8333[_0x19d5('0x22')]?_0x4d8333['TrunkBackup']:undefined;this[_0x19d5('0x23')]=_0x4d8333[_0x19d5('0x23')]?_0x4d8333['Trunk']:undefined;this['Interval']=_0x4d8333[_0x19d5('0x24')]?_0x4d8333[_0x19d5('0x24')]:undefined;this['SquareProject']=_0x4d8333[_0x19d5('0x25')]?_0x4d8333[_0x19d5('0x25')]:undefined;this['dialQueueProject']=_0x4d8333[_0x19d5('0x25')]?_0x4d8333[_0x19d5('0x25')][_0x19d5('0x0')]:undefined;this[_0x19d5('0x26')]=_0x4d8333[_0x19d5('0x26')]||![];this[_0x19d5('0x27')]=_0x4d8333[_0x19d5('0x27')];this[_0x19d5('0x28')]=_0x4d8333['dialAMDGreeting'];this[_0x19d5('0x29')]=_0x4d8333[_0x19d5('0x29')];this[_0x19d5('0x2a')]=_0x4d8333['dialAMDTotalAnalysisTime'];this[_0x19d5('0x2b')]=_0x4d8333[_0x19d5('0x2b')];this['dialAMDBetweenWordsSilence']=_0x4d8333[_0x19d5('0x2c')];this[_0x19d5('0x2d')]=_0x4d8333[_0x19d5('0x2d')];this[_0x19d5('0x2e')]=_0x4d8333[_0x19d5('0x2e')];this['dialAMDMaximumWordLength']=_0x4d8333[_0x19d5('0x2f')];}module[_0x19d5('0x30')]=Campaign; \ No newline at end of file +var _0x7071=['dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrTotalCallsDays','message','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','dialPrefix','dialRandomLastDigitCallerIdNumber','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength'];(function(_0x2d982d,_0x121028){var _0x4f36b0=function(_0x11f3a9){while(--_0x11f3a9){_0x2d982d['push'](_0x2d982d['shift']());}};_0x4f36b0(++_0x121028);}(_0x7071,0x125));var _0x1707=function(_0x333305,_0x383917){_0x333305=_0x333305-0x0;var _0x144c1d=_0x7071[_0x333305];return _0x144c1d;};'use strict';function Campaign(_0x45796f){this['id']=_0x45796f['id']||0x0;this[_0x1707('0x0')]=_0x45796f[_0x1707('0x0')]||'';this['type']=_0x45796f[_0x1707('0x1')]||_0x1707('0x2');this[_0x1707('0x3')]=0x0;this[_0x1707('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x1707('0x5')]=0x0;this[_0x1707('0x6')]='';this[_0x1707('0x7')]=!![];this[_0x1707('0x8')]=_0x45796f[_0x1707('0x8')];this[_0x1707('0x9')]=_0x45796f[_0x1707('0x9')];this[_0x1707('0xa')]=_0x45796f[_0x1707('0xa')]||null;this['dialGlobalInterval']=_0x45796f[_0x1707('0xb')]?_0x45796f[_0x1707('0xb')]:null;this[_0x1707('0xc')]=_0x45796f[_0x1707('0xc')];this[_0x1707('0xd')]=_0x45796f[_0x1707('0xd')];this[_0x1707('0xe')]=_0x45796f['dialOriginateTimeout']||0x1e;this[_0x1707('0xf')]=_0x45796f[_0x1707('0xf')];this[_0x1707('0x10')]=_0x45796f['dialCongestionRetryFrequency'];this[_0x1707('0x11')]=_0x45796f['dialBusyMaxRetry'];this[_0x1707('0x12')]=_0x45796f[_0x1707('0x12')];this['dialNoAnswerMaxRetry']=_0x45796f[_0x1707('0x13')];this[_0x1707('0x14')]=_0x45796f[_0x1707('0x14')];this['dialGlobalMaxRetry']=_0x45796f['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0x45796f[_0x1707('0x15')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x45796f[_0x1707('0x16')]||0x96;this[_0x1707('0x17')]=_0x45796f[_0x1707('0x17')]||0x3;this[_0x1707('0x18')]=_0x45796f[_0x1707('0x18')]||0x96;this[_0x1707('0x19')]=_0x45796f['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x45796f[_0x1707('0x1a')]||0x96;this[_0x1707('0x1b')]=_0x45796f[_0x1707('0x1b')]||0x3;this[_0x1707('0x1c')]=_0x45796f[_0x1707('0x1c')]||0x96;this[_0x1707('0x1d')]=_0x45796f['dialAgentRejectMaxRetry']||0x3;this[_0x1707('0x1e')]=_0x45796f[_0x1707('0x1e')]||0x96;this['dialOrderByScheduledAt']=_0x45796f[_0x1707('0x1f')]||'DESC';this[_0x1707('0x20')]=_0x45796f['dialPrefix']||undefined;this[_0x1707('0x21')]=_0x45796f[_0x1707('0x21')]||undefined;this['dialCutDigit']=_0x45796f['dialCutDigit']||undefined;this['TrunkBackup']=_0x45796f[_0x1707('0x22')]?_0x45796f['TrunkBackup']:undefined;this['Trunk']=_0x45796f[_0x1707('0x23')]?_0x45796f[_0x1707('0x23')]:undefined;this[_0x1707('0x24')]=_0x45796f[_0x1707('0x24')]?_0x45796f[_0x1707('0x24')]:undefined;this[_0x1707('0x25')]=_0x45796f[_0x1707('0x25')]?_0x45796f[_0x1707('0x25')]:undefined;this['dialQueueProject']=_0x45796f['SquareProject']?_0x45796f[_0x1707('0x25')][_0x1707('0x0')]:undefined;this[_0x1707('0x26')]=_0x45796f[_0x1707('0x26')]||![];this[_0x1707('0x27')]=_0x45796f[_0x1707('0x27')];this['dialAMDGreeting']=_0x45796f[_0x1707('0x28')];this[_0x1707('0x29')]=_0x45796f[_0x1707('0x29')];this['dialAMDTotalAnalysisTime']=_0x45796f['dialAMDTotalAnalysisTime'];this[_0x1707('0x2a')]=_0x45796f[_0x1707('0x2a')];this['dialAMDBetweenWordsSilence']=_0x45796f[_0x1707('0x2b')];this[_0x1707('0x2c')]=_0x45796f[_0x1707('0x2c')];this[_0x1707('0x2d')]=_0x45796f[_0x1707('0x2d')];this['dialAMDMaximumWordLength']=_0x45796f[_0x1707('0x2e')];}module[_0x1707('0x2f')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 28301e8..ac852a2 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 _0x414f=['monitor','monitorFilename','queue','transferconnectedlinenum','transferType','mohtime','exports','starttime','destinationchannel','calleridnum','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answertime','unmanaged','abandoned','lastapplication','billableseconds','holdtime','type','tag','disposition'];(function(_0x3d8244,_0x4159ff){var _0x30a786=function(_0x8b84ff){while(--_0x8b84ff){_0x3d8244['push'](_0x3d8244['shift']());}};_0x30a786(++_0x4159ff);}(_0x414f,0x13f));var _0xf414=function(_0x3cb465,_0x36d920){_0x3cb465=_0x3cb465-0x0;var _0x4e197b=_0x414f[_0x3cb465];return _0x4e197b;};'use strict';function Channel(){this[_0xf414('0x0')]=null;this['channel']='';this[_0xf414('0x1')]='';this[_0xf414('0x2')]=0x0;this['calleridname']='';this[_0xf414('0x3')]=undefined;this[_0xf414('0x4')]=undefined;this[_0xf414('0x5')]=0x0;this[_0xf414('0x6')]='';this[_0xf414('0x7')]=0x0;this[_0xf414('0x8')]=0x0;this[_0xf414('0x9')]=0x0;this['answered']=![];this[_0xf414('0xa')]=null;this['endtime']=null;this[_0xf414('0xb')]=![];this[_0xf414('0xc')]=![];this[_0xf414('0xd')]='';this['lastdata']='';this['duration']=0x0;this[_0xf414('0xe')]=0x0;this[_0xf414('0xf')]=0x0;this[_0xf414('0x10')]=null;this[_0xf414('0x11')]=null;this[_0xf414('0x12')]=null;this[_0xf414('0x13')]=![];this[_0xf414('0x14')]=null;this[_0xf414('0x15')]=null;this['monitors']=[];this['transfercalleridnum']=undefined;this[_0xf414('0x16')]=undefined;this[_0xf414('0x17')]=undefined;this[_0xf414('0x18')]=0x0;}module[_0xf414('0x19')]=Channel; \ No newline at end of file +var _0x2fe5=['accountcode','context','linkedid','exten','answertime','endtime','unmanaged','abandoned','lastapplication','duration','billableseconds','holdtime','disposition','monitor','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','starttime','channel','calleridname','connectedlinenum','connectedlinename'];(function(_0x32e00b,_0x3ca6df){var _0x50bb50=function(_0x1c4557){while(--_0x1c4557){_0x32e00b['push'](_0x32e00b['shift']());}};_0x50bb50(++_0x3ca6df);}(_0x2fe5,0x14b));var _0x52fe=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2fe5[_0x122ef9];return _0x42fba0;};'use strict';function Channel(){this[_0x52fe('0x0')]=null;this[_0x52fe('0x1')]='';this['destinationchannel']='';this['calleridnum']=0x0;this[_0x52fe('0x2')]='';this[_0x52fe('0x3')]=undefined;this[_0x52fe('0x4')]=undefined;this[_0x52fe('0x5')]=0x0;this[_0x52fe('0x6')]='';this['uniqueid']=0x0;this[_0x52fe('0x7')]=0x0;this[_0x52fe('0x8')]=0x0;this['answered']=![];this[_0x52fe('0x9')]=null;this[_0x52fe('0xa')]=null;this[_0x52fe('0xb')]=![];this[_0x52fe('0xc')]=![];this[_0x52fe('0xd')]='';this['lastdata']='';this[_0x52fe('0xe')]=0x0;this[_0x52fe('0xf')]=0x0;this[_0x52fe('0x10')]=0x0;this['type']=null;this['tag']=null;this[_0x52fe('0x11')]=null;this[_0x52fe('0x12')]=![];this['monitorFilename']=null;this[_0x52fe('0x13')]=null;this[_0x52fe('0x14')]=[];this[_0x52fe('0x15')]=undefined;this[_0x52fe('0x16')]=undefined;this['transferType']=undefined;this[_0x52fe('0x17')]=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 5b504b5..967ca84 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 _0xe60d=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations'];(function(_0x3d24f4,_0x5f3c2b){var _0x4d5d9f=function(_0x693e5f){while(--_0x693e5f){_0x3d24f4['push'](_0x3d24f4['shift']());}};_0x4d5d9f(++_0x5f3c2b);}(_0xe60d,0x1a4));var _0xde60=function(_0x56021f,_0x2dee44){_0x56021f=_0x56021f-0x0;var _0x5c200d=_0xe60d[_0x56021f];return _0x5c200d;};'use strict';function DeskAccount(_0x4d9b24){this['id']=_0x4d9b24['id']||0x0;this[_0xde60('0x0')]=_0x4d9b24[_0xde60('0x0')]||'';this[_0xde60('0x1')]=_0x4d9b24[_0xde60('0x1')]||'';this[_0xde60('0x2')]=_0x4d9b24[_0xde60('0x2')]||'';this[_0xde60('0x3')]=_0x4d9b24[_0xde60('0x3')]||'';this['password']=_0x4d9b24[_0xde60('0x4')]||'';this[_0xde60('0x5')]=_0x4d9b24[_0xde60('0x5')]||'';this[_0xde60('0x6')]=_0x4d9b24[_0xde60('0x6')]||'';this[_0xde60('0x7')]=_0x4d9b24[_0xde60('0x7')]||'';this[_0xde60('0x8')]=_0x4d9b24[_0xde60('0x8')]||'';this[_0xde60('0x9')]=_0x4d9b24['type']||'';this[_0xde60('0xa')]=_0x4d9b24[_0xde60('0xa')]||'';this[_0xde60('0xb')]=_0x4d9b24[_0xde60('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0xef02=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name'];(function(_0x3331a8,_0x4b106e){var _0x3ca8b5=function(_0x204ee2){while(--_0x204ee2){_0x3331a8['push'](_0x3331a8['shift']());}};_0x3ca8b5(++_0x4b106e);}(_0xef02,0x107));var _0x2ef0=function(_0x44e00a,_0x248bbc){_0x44e00a=_0x44e00a-0x0;var _0x2bdfba=_0xef02[_0x44e00a];return _0x2bdfba;};'use strict';function DeskAccount(_0x4ee01f){this['id']=_0x4ee01f['id']||0x0;this[_0x2ef0('0x0')]=_0x4ee01f[_0x2ef0('0x0')]||'';this['username']=_0x4ee01f['username']||'';this['remoteUri']=_0x4ee01f[_0x2ef0('0x1')]||'';this[_0x2ef0('0x2')]=_0x4ee01f[_0x2ef0('0x2')]||'';this[_0x2ef0('0x3')]=_0x4ee01f[_0x2ef0('0x3')]||'';this[_0x2ef0('0x4')]=_0x4ee01f[_0x2ef0('0x4')]||'';this[_0x2ef0('0x5')]=_0x4ee01f['consumerSecret']||'';this['token']=_0x4ee01f[_0x2ef0('0x6')]||'';this[_0x2ef0('0x7')]=_0x4ee01f[_0x2ef0('0x7')]||'';this[_0x2ef0('0x8')]=_0x4ee01f[_0x2ef0('0x8')]||'';this['serverUrl']=_0x4ee01f[_0x2ef0('0x9')]||'';this[_0x2ef0('0xa')]=_0x4ee01f['Configurations']||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index dfbb811..7a7736b 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 _0x2dae=['clientId','clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId'];(function(_0x20e4a7,_0x44787f){var _0x5108e3=function(_0x24cb05){while(--_0x24cb05){_0x20e4a7['push'](_0x20e4a7['shift']());}};_0x5108e3(++_0x44787f);}(_0x2dae,0xc3));var _0xe2da=function(_0x1ae4a9,_0x4c0ed9){_0x1ae4a9=_0x1ae4a9-0x0;var _0x54d0b0=_0x2dae[_0x1ae4a9];return _0x54d0b0;};'use strict';function Dynamics365Account(_0x463a36){this['id']=_0x463a36['id']||0x0;this['name']=_0x463a36[_0xe2da('0x0')]||'';this[_0xe2da('0x1')]=_0x463a36[_0xe2da('0x1')]||'';this[_0xe2da('0x2')]=_0x463a36[_0xe2da('0x2')]||'';this['remoteUri']=_0x463a36[_0xe2da('0x3')]||'';this[_0xe2da('0x4')]=_0x463a36[_0xe2da('0x4')]||'';this[_0xe2da('0x5')]=_0x463a36['clientId']||'';this[_0xe2da('0x6')]=_0x463a36[_0xe2da('0x6')]||{};this[_0xe2da('0x7')]=_0x463a36[_0xe2da('0x7')]||'';this[_0xe2da('0x8')]=_0x463a36[_0xe2da('0x8')]||{};}module[_0xe2da('0x9')]=Dynamics365Account; \ No newline at end of file +var _0xb58b=['remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name','username','password'];(function(_0x163c77,_0xa83831){var _0x4fd32e=function(_0xf572fb){while(--_0xf572fb){_0x163c77['push'](_0x163c77['shift']());}};_0x4fd32e(++_0xa83831);}(_0xb58b,0x1f1));var _0xbb58=function(_0x1f0c96,_0x34079d){_0x1f0c96=_0x1f0c96-0x0;var _0x2c866b=_0xb58b[_0x1f0c96];return _0x2c866b;};'use strict';function Dynamics365Account(_0x250573){this['id']=_0x250573['id']||0x0;this[_0xbb58('0x0')]=_0x250573[_0xbb58('0x0')]||'';this[_0xbb58('0x1')]=_0x250573['username']||'';this[_0xbb58('0x2')]=_0x250573[_0xbb58('0x2')]||'';this['remoteUri']=_0x250573[_0xbb58('0x3')]||'';this['tenantId']=_0x250573[_0xbb58('0x4')]||'';this[_0xbb58('0x5')]=_0x250573[_0xbb58('0x5')]||'';this['clientSecret']=_0x250573[_0xbb58('0x6')]||{};this[_0xbb58('0x7')]=_0x250573[_0xbb58('0x7')]||'';this[_0xbb58('0x8')]=_0x250573[_0xbb58('0x8')]||{};}module[_0xbb58('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index ee387d6..a992d43 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 _0xb505=['headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','SIP','Trunk','ListId','key','exports','name','description','ecm'];(function(_0x37195c,_0x22c7e2){var _0x36d3b3=function(_0x38b41f){while(--_0x38b41f){_0x37195c['push'](_0x37195c['shift']());}};_0x36d3b3(++_0x22c7e2);}(_0xb505,0x140));var _0x5b50=function(_0x478779,_0x3a6d8c){_0x478779=_0x478779-0x0;var _0x3fa166=_0xb505[_0x478779];return _0x3fa166;};'use strict';function FaxAccount(_0x5a3773){this['id']=_0x5a3773['id']||0x0;this[_0x5b50('0x0')]=_0x5a3773[_0x5b50('0x0')]||'';this[_0x5b50('0x1')]=_0x5a3773['description'];this['ecm']=_0x5a3773[_0x5b50('0x2')];this['headerinfo']=_0x5a3773[_0x5b50('0x3')];this[_0x5b50('0x4')]=_0x5a3773[_0x5b50('0x4')];this[_0x5b50('0x5')]=_0x5a3773[_0x5b50('0x5')]||0x960;this[_0x5b50('0x6')]=_0x5a3773[_0x5b50('0x6')]||0x3840;this[_0x5b50('0x7')]=_0x5a3773[_0x5b50('0x7')]||_0x5b50('0x8');this[_0x5b50('0x9')]=_0x5a3773[_0x5b50('0x9')]||'no';this['faxdetect']=_0x5a3773[_0x5b50('0xa')]||'no';this[_0x5b50('0xb')]=_0x5a3773['t38timeout']||0x1388;this['tech']=_0x5a3773['tech']||_0x5b50('0xc');this['Trunk']=_0x5a3773[_0x5b50('0xd')]?_0x5a3773[_0x5b50('0xd')]:undefined;this['ListId']=_0x5a3773[_0x5b50('0xe')];this[_0x5b50('0xf')]=_0x5a3773[_0x5b50('0xf')];}module[_0x5b50('0x10')]=FaxAccount; \ No newline at end of file +var _0x508c=['v17,v27,v29','gateway','faxdetect','t38timeout','SIP','Trunk','ListId','key','exports','name','description','ecm','localstationid','minrate','maxrate','modem'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x508c,0xd9));var _0xc508=function(_0x2bb067,_0x30dcb9){_0x2bb067=_0x2bb067-0x0;var _0x65d9a3=_0x508c[_0x2bb067];return _0x65d9a3;};'use strict';function FaxAccount(_0x3661e1){this['id']=_0x3661e1['id']||0x0;this[_0xc508('0x0')]=_0x3661e1[_0xc508('0x0')]||'';this['description']=_0x3661e1[_0xc508('0x1')];this[_0xc508('0x2')]=_0x3661e1['ecm'];this['headerinfo']=_0x3661e1['headerinfo'];this[_0xc508('0x3')]=_0x3661e1[_0xc508('0x3')];this[_0xc508('0x4')]=_0x3661e1[_0xc508('0x4')]||0x960;this['maxrate']=_0x3661e1[_0xc508('0x5')]||0x3840;this[_0xc508('0x6')]=_0x3661e1[_0xc508('0x6')]||_0xc508('0x7');this[_0xc508('0x8')]=_0x3661e1['gateway']||'no';this[_0xc508('0x9')]=_0x3661e1[_0xc508('0x9')]||'no';this[_0xc508('0xa')]=_0x3661e1[_0xc508('0xa')]||0x1388;this['tech']=_0x3661e1['tech']||_0xc508('0xb');this[_0xc508('0xc')]=_0x3661e1[_0xc508('0xc')]?_0x3661e1['Trunk']:undefined;this['ListId']=_0x3661e1[_0xc508('0xd')];this[_0xc508('0xe')]=_0x3661e1[_0xc508('0xe')];}module[_0xc508('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index ec2a099..75842b1 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 _0x7826=['username','token','remoteUri','serverUrl','Configurations','name'];(function(_0x54f056,_0x10ac46){var _0x195e5f=function(_0x32efc7){while(--_0x32efc7){_0x54f056['push'](_0x54f056['shift']());}};_0x195e5f(++_0x10ac46);}(_0x7826,0xa1));var _0x6782=function(_0x3ee771,_0x2b8251){_0x3ee771=_0x3ee771-0x0;var _0x1e99fa=_0x7826[_0x3ee771];return _0x1e99fa;};'use strict';function FreshdeskAccount(_0x5b895f){this['id']=_0x5b895f['id']||0x0;this[_0x6782('0x0')]=_0x5b895f['name']||'';this[_0x6782('0x1')]=_0x5b895f[_0x6782('0x1')]||'';this['apiKey']=_0x5b895f[_0x6782('0x2')]||'';this[_0x6782('0x3')]=_0x5b895f[_0x6782('0x3')]||'';this['serverUrl']=_0x5b895f[_0x6782('0x4')]||'';this[_0x6782('0x5')]=_0x5b895f['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0xf87a=['Configurations','name','username','token','serverUrl'];(function(_0x389ab3,_0x2f07cf){var _0x395edb=function(_0x5006a2){while(--_0x5006a2){_0x389ab3['push'](_0x389ab3['shift']());}};_0x395edb(++_0x2f07cf);}(_0xf87a,0x11e));var _0xaf87=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xf87a[_0x17d9e3];return _0x14192d;};'use strict';function FreshdeskAccount(_0x54090f){this['id']=_0x54090f['id']||0x0;this[_0xaf87('0x0')]=_0x54090f[_0xaf87('0x0')]||'';this[_0xaf87('0x1')]=_0x54090f[_0xaf87('0x1')]||'';this['apiKey']=_0x54090f[_0xaf87('0x2')]||'';this['remoteUri']=_0x54090f['remoteUri']||'';this[_0xaf87('0x3')]=_0x54090f[_0xaf87('0x3')]||'';this[_0xaf87('0x4')]=_0x54090f['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 6fa2087..f173250 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 _0x2428=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x573255,_0x4d84fd){var _0x3d5253=function(_0x226ebc){while(--_0x226ebc){_0x573255['push'](_0x573255['shift']());}};_0x3d5253(++_0x4d84fd);}(_0x2428,0xd3));var _0x8242=function(_0x139672,_0x2bcfbc){_0x139672=_0x139672-0x0;var _0x55b248=_0x2428[_0x139672];return _0x55b248;};'use strict';function FreshsalesAccount(_0x4630f5){this['id']=_0x4630f5['id']||0x0;this[_0x8242('0x0')]=_0x4630f5[_0x8242('0x0')]||'';this[_0x8242('0x1')]=_0x4630f5[_0x8242('0x1')]||'';this[_0x8242('0x2')]=_0x4630f5[_0x8242('0x3')]||'';this[_0x8242('0x4')]=_0x4630f5[_0x8242('0x4')]||'';this[_0x8242('0x5')]=_0x4630f5[_0x8242('0x5')]||'';this[_0x8242('0x6')]=_0x4630f5['Configurations']||{};}module[_0x8242('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x56e7=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x56e7,0x7b));var _0x756e=function(_0x5e961f,_0x410eac){_0x5e961f=_0x5e961f-0x0;var _0x157371=_0x56e7[_0x5e961f];return _0x157371;};'use strict';function FreshsalesAccount(_0x4ec485){this['id']=_0x4ec485['id']||0x0;this[_0x756e('0x0')]=_0x4ec485[_0x756e('0x0')]||'';this['username']=_0x4ec485[_0x756e('0x1')]||'';this[_0x756e('0x2')]=_0x4ec485[_0x756e('0x3')]||'';this[_0x756e('0x4')]=_0x4ec485[_0x756e('0x4')]||'';this[_0x756e('0x5')]=_0x4ec485[_0x756e('0x5')]||'';this['Configurations']=_0x4ec485[_0x756e('0x6')]||{};}module[_0x756e('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 237b190..071c1c0 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 _0x8661=['queue','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','accountcode','context','exten','assigned','lastAssignedTo','mohtime','variables','type','inbound','uniqueid','calleridnum','calleridname'];(function(_0x49c4db,_0x2b1d7e){var _0x3bbef2=function(_0x320376){while(--_0x320376){_0x49c4db['push'](_0x49c4db['shift']());}};_0x3bbef2(++_0x2b1d7e);}(_0x8661,0x95));var _0x1866=function(_0x57c690,_0x23646e){_0x57c690=_0x57c690-0x0;var _0x5ca66f=_0x8661[_0x57c690];return _0x5ca66f;};'use strict';function QueueReport(){this[_0x1866('0x0')]=_0x1866('0x1');this[_0x1866('0x2')]='';this[_0x1866('0x3')]='';this[_0x1866('0x4')]='';this[_0x1866('0x5')]='';this[_0x1866('0x6')]=null;this[_0x1866('0x7')]=null;this['position']=0x1;this[_0x1866('0x8')]=0x1;this['queuecallerabandon']=![];this[_0x1866('0x9')]=null;this['queuecallercomplete']=![];this[_0x1866('0xa')]=null;this[_0x1866('0xb')]=![];this[_0x1866('0xc')]=null;this[_0x1866('0xd')]=0x1;this['channel']='';this[_0x1866('0xe')]='';this['connectedlinename']='';this[_0x1866('0xf')]='';this[_0x1866('0x10')]='';this[_0x1866('0x11')]='';this['priority']='';this['holdtime']=0x0;this[_0x1866('0x12')]=![];this[_0x1866('0x13')]='';this[_0x1866('0x14')]=0x0;this[_0x1866('0x15')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x1362=['variables','exports','type','inbound','uniqueid','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','context','priority','holdtime','assigned','lastAssignedTo'];(function(_0x4afac5,_0x1ab4ed){var _0x2404b3=function(_0x5c700b){while(--_0x5c700b){_0x4afac5['push'](_0x4afac5['shift']());}};_0x2404b3(++_0x1ab4ed);}(_0x1362,0xba));var _0x2136=function(_0xff4d32,_0x355c76){_0xff4d32=_0xff4d32-0x0;var _0x3ee3fd=_0x1362[_0xff4d32];return _0x3ee3fd;};'use strict';function QueueReport(){this[_0x2136('0x0')]=_0x2136('0x1');this[_0x2136('0x2')]='';this['calleridnum']='';this[_0x2136('0x3')]='';this[_0x2136('0x4')]='';this[_0x2136('0x5')]=null;this['queuecallerleaveAt']=null;this[_0x2136('0x6')]=0x1;this[_0x2136('0x7')]=0x1;this[_0x2136('0x8')]=![];this['queuecallerabandonAt']=null;this[_0x2136('0x9')]=![];this[_0x2136('0xa')]=null;this['queuecallerexit']=![];this[_0x2136('0xb')]=null;this[_0x2136('0xc')]=0x1;this[_0x2136('0xd')]='';this[_0x2136('0xe')]='';this[_0x2136('0xf')]='';this['accountcode']='';this[_0x2136('0x10')]='';this['exten']='';this[_0x2136('0x11')]='';this[_0x2136('0x12')]=0x0;this[_0x2136('0x13')]=![];this[_0x2136('0x14')]='';this['mohtime']=0x0;this[_0x2136('0x15')]={};}module[_0x2136('0x16')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 09808c2..6c3aa4a 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 _0xad5f=['integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0x1a9e4f,_0x3ed37f){var _0x5dfa04=function(_0x17bd79){while(--_0x17bd79){_0x1a9e4f['push'](_0x1a9e4f['shift']());}};_0x5dfa04(++_0x3ed37f);}(_0xad5f,0x1a8));var _0xfad5=function(_0x350c87,_0x2b44ef){_0x350c87=_0x350c87-0x0;var _0x163800=_0xad5f[_0x350c87];return _0x163800;};'use strict';function SalesforceAccount(_0x16c71c){this['id']=_0x16c71c['id']||0x0;this[_0xfad5('0x0')]=_0x16c71c[_0xfad5('0x0')]||'';this[_0xfad5('0x1')]=_0x16c71c[_0xfad5('0x1')]||'';this[_0xfad5('0x2')]=_0x16c71c['remoteUri']||'';this[_0xfad5('0x3')]=_0x16c71c[_0xfad5('0x3')]||'';this[_0xfad5('0x4')]=_0x16c71c[_0xfad5('0x4')]||'';this[_0xfad5('0x5')]=_0x16c71c[_0xfad5('0x5')]||'';this[_0xfad5('0x6')]=_0x16c71c['securityToken']||'';this[_0xfad5('0x7')]=_0x16c71c[_0xfad5('0x7')]||_0xfad5('0x8');this[_0xfad5('0x9')]=_0x16c71c['serverUrl']||'';this[_0xfad5('0xa')]=_0x16c71c[_0xfad5('0xa')]||{};}module[_0xfad5('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x74e0=['remoteUri','password','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username'];(function(_0xaca787,_0x41e990){var _0x57d1aa=function(_0xcefb17){while(--_0xcefb17){_0xaca787['push'](_0xaca787['shift']());}};_0x57d1aa(++_0x41e990);}(_0x74e0,0x15e));var _0x074e=function(_0x3cae6c,_0x3d74ba){_0x3cae6c=_0x3cae6c-0x0;var _0x3b7421=_0x74e0[_0x3cae6c];return _0x3b7421;};'use strict';function SalesforceAccount(_0x1e02e2){this['id']=_0x1e02e2['id']||0x0;this[_0x074e('0x0')]=_0x1e02e2['name']||'';this[_0x074e('0x1')]=_0x1e02e2['username']||'';this[_0x074e('0x2')]=_0x1e02e2[_0x074e('0x2')]||'';this[_0x074e('0x3')]=_0x1e02e2[_0x074e('0x3')]||'';this['clientId']=_0x1e02e2['clientId']||'';this['clientSecret']=_0x1e02e2[_0x074e('0x4')]||'';this[_0x074e('0x5')]=_0x1e02e2[_0x074e('0x5')]||'';this[_0x074e('0x6')]=_0x1e02e2[_0x074e('0x6')]||_0x074e('0x7');this[_0x074e('0x8')]=_0x1e02e2['serverUrl']||'';this['Configurations']=_0x1e02e2[_0x074e('0x9')]||{};}module[_0x074e('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index a976cf2..7ab8d23 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 _0xf377=['username','password','remoteUri','serverUrl','Configurations','name'];(function(_0x1db78c,_0x37ea25){var _0x1e7df4=function(_0x3d60b7){while(--_0x3d60b7){_0x1db78c['push'](_0x1db78c['shift']());}};_0x1e7df4(++_0x37ea25);}(_0xf377,0x10d));var _0x7f37=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xf377[_0x55f8b4];return _0x2475f9;};'use strict';function ServicenowAccount(_0x51085f){this['id']=_0x51085f['id']||0x0;this[_0x7f37('0x0')]=_0x51085f[_0x7f37('0x0')]||'';this[_0x7f37('0x1')]=_0x51085f['username']||'';this[_0x7f37('0x2')]=_0x51085f[_0x7f37('0x2')]||'';this[_0x7f37('0x3')]=_0x51085f[_0x7f37('0x3')]||'';this[_0x7f37('0x4')]=_0x51085f['serverUrl']||'';this['Configurations']=_0x51085f[_0x7f37('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xfd5c=['password','remoteUri','serverUrl','name','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfd5c,0xdf));var _0xcfd5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd5c[_0x3dd15e];return _0x231fd0;};'use strict';function ServicenowAccount(_0x46050f){this['id']=_0x46050f['id']||0x0;this['name']=_0x46050f[_0xcfd5('0x0')]||'';this[_0xcfd5('0x1')]=_0x46050f['username']||'';this[_0xcfd5('0x2')]=_0x46050f[_0xcfd5('0x2')]||'';this[_0xcfd5('0x3')]=_0x46050f[_0xcfd5('0x3')]||'';this[_0xcfd5('0x4')]=_0x46050f['serverUrl']||'';this['Configurations']=_0x46050f['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 8225f27..93cd880 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 _0x37de=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x3f003c,_0x276a93){var _0x17ff25=function(_0x593558){while(--_0x593558){_0x3f003c['push'](_0x3f003c['shift']());}};_0x17ff25(++_0x276a93);}(_0x37de,0x10f));var _0xe37d=function(_0x517fc3,_0x384d51){_0x517fc3=_0x517fc3-0x0;var _0xc4a05c=_0x37de[_0x517fc3];return _0xc4a05c;};'use strict';function SugarcrmAccount(_0x413e01){this['id']=_0x413e01['id']||0x0;this[_0xe37d('0x0')]=_0x413e01[_0xe37d('0x0')]||'';this['username']=_0x413e01[_0xe37d('0x1')]||'';this[_0xe37d('0x2')]=_0x413e01['password']||'';this[_0xe37d('0x3')]=_0x413e01['remoteUri']||'';this[_0xe37d('0x4')]=_0x413e01[_0xe37d('0x4')]||'';this[_0xe37d('0x5')]=_0x413e01[_0xe37d('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x81c3=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x1c7bcd,_0x478875){var _0x554320=function(_0x1acb8d){while(--_0x1acb8d){_0x1c7bcd['push'](_0x1c7bcd['shift']());}};_0x554320(++_0x478875);}(_0x81c3,0xd2));var _0x381c=function(_0x5ca96d,_0x3456e0){_0x5ca96d=_0x5ca96d-0x0;var _0x19c941=_0x81c3[_0x5ca96d];return _0x19c941;};'use strict';function SugarcrmAccount(_0x4cd7b0){this['id']=_0x4cd7b0['id']||0x0;this[_0x381c('0x0')]=_0x4cd7b0[_0x381c('0x0')]||'';this['username']=_0x4cd7b0[_0x381c('0x1')]||'';this[_0x381c('0x2')]=_0x4cd7b0['password']||'';this['remoteUri']=_0x4cd7b0[_0x381c('0x3')]||'';this[_0x381c('0x4')]=_0x4cd7b0['serverUrl']||'';this[_0x381c('0x5')]=_0x4cd7b0[_0x381c('0x5')]||{};}module[_0x381c('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 4fa4131..bd21d0d 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 _0x5a1c=['accountcode','unknown','stateTime','status','exports','name'];(function(_0x1b4cc3,_0x268075){var _0x40f002=function(_0x102e4d){while(--_0x102e4d){_0x1b4cc3['push'](_0x1b4cc3['shift']());}};_0x40f002(++_0x268075);}(_0x5a1c,0x1b5));var _0xc5a1=function(_0x51216,_0x157254){_0x51216=_0x51216-0x0;var _0x3d7040=_0x5a1c[_0x51216];return _0x3d7040;};'use strict';function Telephone(_0x44ce43){this['id']=_0x44ce43['id']||0x0;this[_0xc5a1('0x0')]=_0x44ce43['name']||'';this['accountcode']=_0x44ce43[_0xc5a1('0x1')]||'';this['state']=_0xc5a1('0x2');this[_0xc5a1('0x3')]=0x0;this[_0xc5a1('0x4')]=_0xc5a1('0x2');this['address']='';}module[_0xc5a1('0x5')]=Telephone; \ No newline at end of file +var _0x83e1=['accountcode','state','status','unknown','name'];(function(_0xd704ff,_0xa009f1){var _0x4484b9=function(_0x1282c1){while(--_0x1282c1){_0xd704ff['push'](_0xd704ff['shift']());}};_0x4484b9(++_0xa009f1);}(_0x83e1,0x1ad));var _0x183e=function(_0x35a6f8,_0x2a19d0){_0x35a6f8=_0x35a6f8-0x0;var _0x11d2da=_0x83e1[_0x35a6f8];return _0x11d2da;};'use strict';function Telephone(_0x4d037e){this['id']=_0x4d037e['id']||0x0;this[_0x183e('0x0')]=_0x4d037e['name']||'';this[_0x183e('0x1')]=_0x4d037e['accountcode']||'';this[_0x183e('0x2')]='unknown';this['stateTime']=0x0;this[_0x183e('0x3')]=_0x183e('0x4');this['address']='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 4612db2..b06ac05 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x17bde5,_0xb02b5a){var _0x309971=function(_0x5c745f){while(--_0x5c745f){_0x17bde5['push'](_0x17bde5['shift']());}};_0x309971(++_0xb02b5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x57a648,_0x177b1c){var _0x412913=function(_0x52c49e){while(--_0x52c49e){_0x57a648['push'](_0x57a648['shift']());}};_0x412913(++_0x177b1c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 86b042e..bc484e5 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 _0xb10b=['AllConditions','AnyConditions','Actions','exports','name','channel','status'];(function(_0xdc0e2d,_0x14dcae){var _0x19f7d0=function(_0x4e74ea){while(--_0x4e74ea){_0xdc0e2d['push'](_0xdc0e2d['shift']());}};_0x19f7d0(++_0x14dcae);}(_0xb10b,0x12a));var _0xbb10=function(_0xd206ce,_0x3031d2){_0xd206ce=_0xd206ce-0x0;var _0x5b3ec6=_0xb10b[_0xd206ce];return _0x5b3ec6;};'use strict';function Trigger(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'voice';this[_0xbb10('0x2')]=_0x13ce8d[_0xbb10('0x2')]||![];this[_0xbb10('0x3')]=_0x13ce8d[_0xbb10('0x3')]||[];this[_0xbb10('0x4')]=_0x13ce8d[_0xbb10('0x4')]||[];this['Actions']=_0x13ce8d[_0xbb10('0x5')]||[];}module[_0xbb10('0x6')]=Trigger; \ No newline at end of file +var _0x9ffd=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x334f4e,_0x4a4184){var _0x8a956f=function(_0x1844fd){while(--_0x1844fd){_0x334f4e['push'](_0x334f4e['shift']());}};_0x8a956f(++_0x4a4184);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x1c70e6,_0x45a51b){_0x1c70e6=_0x1c70e6-0x0;var _0x18a528=_0x9ffd[_0x1c70e6];return _0x18a528;};'use strict';function Trigger(_0x4c26a1){this['id']=_0x4c26a1['id']||0x0;this[_0xd9ff('0x0')]=_0x4c26a1[_0xd9ff('0x0')]||'';this['channel']=_0x4c26a1[_0xd9ff('0x1')]||_0xd9ff('0x2');this[_0xd9ff('0x3')]=_0x4c26a1[_0xd9ff('0x3')]||![];this['AllConditions']=_0x4c26a1[_0xd9ff('0x4')]||[];this[_0xd9ff('0x5')]=_0x4c26a1['AnyConditions']||[];this[_0xd9ff('0x6')]=_0x4c26a1[_0xd9ff('0x6')]||[];}module[_0xd9ff('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 74fd72a..73332ce 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 _0x20ef=['exports','active','name','state','stateTime','status','unknown','registry','indexOf','host','port','domain','domainport','refresh','registrationtime','address','defaultuser'];(function(_0x43ce3a,_0x589561){var _0x246e6d=function(_0x42a46f){while(--_0x42a46f){_0x43ce3a['push'](_0x43ce3a['shift']());}};_0x246e6d(++_0x589561);}(_0x20ef,0x133));var _0xf20e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20ef[_0x3dd15e];return _0x231fd0;};'use strict';function Trunk(_0x45827e){this['id']=_0x45827e['id']||0x0;this[_0xf20e('0x0')]=_0x45827e[_0xf20e('0x0')]||![];this[_0xf20e('0x1')]=_0x45827e[_0xf20e('0x1')]||'';this[_0xf20e('0x2')]='unknown';this[_0xf20e('0x3')]=0x0;this[_0xf20e('0x4')]=_0xf20e('0x5');this['registry']=_0x45827e[_0xf20e('0x6')]&&_0x45827e['registry'][_0xf20e('0x7')](':')?_0x45827e[_0xf20e('0x6')]['split'](':')[0x0]:'';this[_0xf20e('0x8')]='';this[_0xf20e('0x9')]='';this[_0xf20e('0xa')]='';this[_0xf20e('0xb')]='';this[_0xf20e('0xc')]='';this['stateRegistry']=_0xf20e('0x5');this[_0xf20e('0xd')]='';this[_0xf20e('0xe')]='';this[_0xf20e('0xf')]=_0x45827e[_0xf20e('0xf')]||'';}module[_0xf20e('0x10')]=Trunk; \ No newline at end of file +var _0xf733=['indexOf','split','host','port','domain','domainport','refresh','stateRegistry','defaultuser','exports','active','state','unknown','registry'];(function(_0x305c31,_0x466b17){var _0x17f39f=function(_0x53ae03){while(--_0x53ae03){_0x305c31['push'](_0x305c31['shift']());}};_0x17f39f(++_0x466b17);}(_0xf733,0x1d8));var _0x3f73=function(_0x5ab602,_0x5bb797){_0x5ab602=_0x5ab602-0x0;var _0x3b7a08=_0xf733[_0x5ab602];return _0x3b7a08;};'use strict';function Trunk(_0x70a2cd){this['id']=_0x70a2cd['id']||0x0;this['active']=_0x70a2cd[_0x3f73('0x0')]||![];this['name']=_0x70a2cd['name']||'';this[_0x3f73('0x1')]=_0x3f73('0x2');this['stateTime']=0x0;this['status']='unknown';this['registry']=_0x70a2cd[_0x3f73('0x3')]&&_0x70a2cd[_0x3f73('0x3')][_0x3f73('0x4')](':')?_0x70a2cd[_0x3f73('0x3')][_0x3f73('0x5')](':')[0x0]:'';this[_0x3f73('0x6')]='';this[_0x3f73('0x7')]='';this[_0x3f73('0x8')]='';this[_0x3f73('0x9')]='';this[_0x3f73('0xa')]='';this[_0x3f73('0xb')]=_0x3f73('0x2');this['registrationtime']='';this['address']='';this[_0x3f73('0xc')]=_0x70a2cd[_0x3f73('0xc')]||'';}module[_0x3f73('0xd')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index dc185e6..e764fd1 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 _0x49df=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x6e4ae7,_0x52094a){var _0x2e5f0e=function(_0x45e4b8){while(--_0x45e4b8){_0x6e4ae7['push'](_0x6e4ae7['shift']());}};_0x2e5f0e(++_0x52094a);}(_0x49df,0x18f));var _0xf49d=function(_0xe3c731,_0x347775){_0xe3c731=_0xe3c731-0x0;var _0x5693ee=_0x49df[_0xe3c731];return _0x5693ee;};'use strict';function voiceExtension(_0x99053b){this['id']=_0x99053b['id']||0x0;this[_0xf49d('0x0')]=_0x99053b[_0xf49d('0x0')]||'';this[_0xf49d('0x1')]=_0x99053b[_0xf49d('0x1')]||_0xf49d('0x2');this[_0xf49d('0x3')]=_0x99053b['mandatoryDisposition']||![];}module[_0xf49d('0x4')]=voiceExtension; \ No newline at end of file +var _0x7347=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x3a3a08,_0x58c9d8){var _0x4963a3=function(_0x3b2466){while(--_0x3b2466){_0x3a3a08['push'](_0x3a3a08['shift']());}};_0x4963a3(++_0x58c9d8);}(_0x7347,0x75));var _0x7734=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x7347[_0x2c7618];return _0x5ce3f0;};'use strict';function voiceExtension(_0x3e8baa){this['id']=_0x3e8baa['id']||0x0;this[_0x7734('0x0')]=_0x3e8baa[_0x7734('0x0')]||'';this['recordingFormat']=_0x3e8baa[_0x7734('0x1')]||_0x7734('0x2');this[_0x7734('0x3')]=_0x3e8baa[_0x7734('0x3')]||![];}module[_0x7734('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 7ad76c4..134289e 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 _0x696e=['exports','unknown','inuse','busy','unavailable','ringing','wav','wav49','rrmemory','name','monitor_format','type','inbound','waiting','talking','answered','sumDuration','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause'];(function(_0x21347a,_0x1ce3da){var _0xe2eb23=function(_0x1a02f9){while(--_0x1a02f9){_0x21347a['push'](_0x21347a['shift']());}};_0xe2eb23(++_0x1ce3da);}(_0x696e,0x1d1));var _0xe696=function(_0x1007e6,_0x21e57a){_0x1007e6=_0x1007e6-0x0;var _0x4406da=_0x696e[_0x1007e6];return _0x4406da;};'use strict';var statusDesc=[_0xe696('0x0'),'not_inuse',_0xe696('0x1'),_0xe696('0x2'),'invalid',_0xe696('0x3'),_0xe696('0x4'),'ringinuse','onhold'];var monitorFormat={'wav':_0xe696('0x5'),'wav49':_0xe696('0x6'),'gsm':'gsm'};var strategy={'rrmemory':_0xe696('0x7'),'roundrobin':'roundrobin'};function VoiceQueue(_0x23a678){this['id']=_0x23a678['id']||0x0;this[_0xe696('0x8')]=_0x23a678[_0xe696('0x8')]||'';this[_0xe696('0x9')]=_0x23a678[_0xe696('0x9')]||'';this['type']=_0x23a678[_0xe696('0xa')]||_0xe696('0xb');this[_0xe696('0xc')]=0x0;this[_0xe696('0xd')]=0x0;this['total']=0x0;this[_0xe696('0xe')]=0x0;this[_0xe696('0xf')]=0x0;this['sumHoldTime']=0x0;this[_0xe696('0x10')]=0x0;this[_0xe696('0x11')]=0x0;this[_0xe696('0x12')]=0x0;this[_0xe696('0x13')]=0x0;this[_0xe696('0x14')]=0x0;this['acw']=_0x23a678[_0xe696('0x15')]||![];this['acwTimeout']=_0x23a678[_0xe696('0x16')]||0xa;this['autopause']=_0x23a678[_0xe696('0x17')]||'no';this[_0xe696('0x18')]=!![];this[_0xe696('0x19')]='';this['originated']=0x0;this[_0xe696('0x1a')]=0x0;this[_0xe696('0x1b')]=_0x23a678[_0xe696('0x1b')]||null;this[_0xe696('0x1c')]=_0x23a678[_0xe696('0x1c')]?_0x23a678['dialGlobalInterval']:null;this[_0xe696('0x1d')]=_0x23a678[_0xe696('0x1d')];this[_0xe696('0x1e')]=_0x23a678[_0xe696('0x1e')]||'progressive';this[_0xe696('0x1f')]=_0x23a678[_0xe696('0x1f')]||0x0;this['dialLimitQueue']=_0x23a678[_0xe696('0x20')]||0x0;this[_0xe696('0x21')]=_0x23a678['dialPowerLevel']||0x1;this[_0xe696('0x22')]=_0x23a678[_0xe696('0x22')]||_0xe696('0x23');this[_0xe696('0x24')]=_0x23a678[_0xe696('0x24')]||0.03;this['dialPredictiveInterval']=_0x23a678[_0xe696('0x25')]||0x258;this[_0xe696('0x26')]=_0x23a678[_0xe696('0x26')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x23a678[_0xe696('0x27')]||_0xe696('0x28');this[_0xe696('0x29')]=_0x23a678[_0xe696('0x29')]||0x1e;this[_0xe696('0x2a')]=_0x23a678[_0xe696('0x2a')]||'tTxX';this[_0xe696('0x2b')]=_0x23a678[_0xe696('0x2b')]||0x3;this[_0xe696('0x2c')]=_0x23a678[_0xe696('0x2c')]||undefined;this[_0xe696('0x2d')]=_0x23a678[_0xe696('0x2d')]||0x3;this[_0xe696('0x2e')]=_0x23a678['dialCongestionRetryFrequency']||0x96;this['dialBusyMaxRetry']=_0x23a678['dialBusyMaxRetry']||0x3;this['dialBusyRetryFrequency']=_0x23a678[_0xe696('0x2f')]||0x96;this[_0xe696('0x30')]=_0x23a678['dialNoAnswerMaxRetry']||0x3;this['dialNoAnswerRetryFrequency']=_0x23a678['dialNoAnswerRetryFrequency']||0x96;this[_0xe696('0x31')]=_0x23a678['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x23a678[_0xe696('0x32')]||0x96;this[_0xe696('0x33')]=_0x23a678[_0xe696('0x33')]||0x3;this[_0xe696('0x34')]=_0x23a678[_0xe696('0x34')]||0x96;this[_0xe696('0x35')]=_0x23a678[_0xe696('0x35')]||0x3;this[_0xe696('0x36')]=_0x23a678[_0xe696('0x36')]||0x96;this[_0xe696('0x37')]=_0x23a678[_0xe696('0x37')]||0x3;this['dialMachineRetryFrequency']=_0x23a678['dialMachineRetryFrequency']||0x96;this[_0xe696('0x38')]=_0x23a678[_0xe696('0x38')]||0x3;this[_0xe696('0x39')]=_0x23a678['dialAgentRejectRetryFrequency']||0x96;this[_0xe696('0x3a')]=_0x23a678[_0xe696('0x3a')]||0x4;this['Trunk']=_0x23a678[_0xe696('0x3b')]?_0x23a678[_0xe696('0x3b')]:undefined;this['TrunkBackup']=_0x23a678[_0xe696('0x3c')]?_0x23a678[_0xe696('0x3c')]:undefined;this[_0xe696('0x3d')]=_0x23a678[_0xe696('0x3d')]||undefined;this[_0xe696('0x3e')]=_0x23a678[_0xe696('0x3e')]?_0x23a678[_0xe696('0x3e')]:undefined;this[_0xe696('0x3f')]=_0x23a678[_0xe696('0x3f')]||_0xe696('0x40');this['dialRandomLastDigitCallerIdNumber']=_0x23a678['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x23a678[_0xe696('0x41')]||undefined;this[_0xe696('0x42')]=strategy[_0x23a678[_0xe696('0x42')]]||_0xe696('0x7');this[_0xe696('0x43')]=!![];this[_0xe696('0x44')]=_0x23a678['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x23a678[_0xe696('0x45')];this[_0xe696('0x46')]=_0x23a678[_0xe696('0x46')];this[_0xe696('0x47')]=_0x23a678[_0xe696('0x47')];this[_0xe696('0x48')]=_0x23a678[_0xe696('0x48')];this[_0xe696('0x49')]=_0x23a678['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x23a678[_0xe696('0x4a')];this[_0xe696('0x4b')]=_0x23a678[_0xe696('0x4b')];this[_0xe696('0x4c')]=_0x23a678['dialAMDSilenceThreshold'];this[_0xe696('0x4d')]=_0x23a678[_0xe696('0x4d')];this[_0xe696('0x4e')]=0x0;this[_0xe696('0x4f')]=0x0;this['timeout']=_0x23a678[_0xe696('0x50')];this[_0xe696('0x51')]=0x0;this[_0xe696('0x52')]=0x0;this[_0xe696('0x53')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xe696('0x54')]=0x0;this[_0xe696('0x55')]=0x0;this[_0xe696('0x56')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xe696('0x57')]=0x0;this[_0xe696('0x58')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xe696('0x59')]=0x0;this[_0xe696('0x5a')]=0x0;this[_0xe696('0x5b')]=0x0;this[_0xe696('0x5c')]=undefined;this[_0xe696('0x5d')]=undefined;this[_0xe696('0x5e')]=undefined;this[_0xe696('0x5f')]=1.05;this[_0xe696('0x60')]=0x0;this[_0xe696('0x61')]=0x0;this[_0xe696('0x62')]=0x0;this[_0xe696('0x63')]=0x0;this[_0xe696('0x64')]=0x0;this[_0xe696('0x65')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xe696('0x66')]=0x0;this['predictiveIntervalMaxThreshold']=_0x23a678[_0xe696('0x67')]||0x14;this[_0xe696('0x68')]=_0x23a678['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xe696('0x69')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xe696('0x6a')]=0x0;this[_0xe696('0x6b')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0xe696('0x6c')]=0x0;this[_0xe696('0x6d')]=_0x23a678['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x23a678['dialRecallInQueue']||![];this[_0xe696('0x6e')]=_0x23a678[_0xe696('0x6e')]||undefined;this['dialAgiAfterHangupClient']=_0x23a678[_0xe696('0x6f')]||![];this[_0xe696('0x70')]=_0x23a678[_0xe696('0x70')]||![];this['monitor_format']=monitorFormat[_0x23a678[_0xe696('0x9')]]?monitorFormat[_0x23a678[_0xe696('0x9')]]:undefined;this[_0xe696('0x71')]=_0x23a678[_0xe696('0x71')]||![];this[_0xe696('0x72')]=_0x23a678[_0xe696('0x72')]?_0x23a678['mandatoryDispositionPause']:undefined;}module[_0xe696('0x73')]=VoiceQueue; \ No newline at end of file +var _0xb0fe=['acw','acwTimeout','autopause','sendMessageOneNotActive','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','exports','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','wav','wav49','gsm','roundrobin','name','monitor_format','type','inbound','waiting','answered','sumDuration','sumHoldTime','unmanaged','loggedIn','available'];(function(_0x176e76,_0x410a54){var _0x317f7e=function(_0x48e049){while(--_0x48e049){_0x176e76['push'](_0x176e76['shift']());}};_0x317f7e(++_0x410a54);}(_0xb0fe,0xd2));var _0xeb0f=function(_0x577077,_0x52f056){_0x577077=_0x577077-0x0;var _0x370769=_0xb0fe[_0x577077];return _0x370769;};'use strict';var statusDesc=['unknown',_0xeb0f('0x0'),_0xeb0f('0x1'),_0xeb0f('0x2'),_0xeb0f('0x3'),_0xeb0f('0x4'),_0xeb0f('0x5'),_0xeb0f('0x6'),'onhold'];var monitorFormat={'wav':_0xeb0f('0x7'),'wav49':_0xeb0f('0x8'),'gsm':_0xeb0f('0x9')};var strategy={'rrmemory':'rrmemory','roundrobin':_0xeb0f('0xa')};function VoiceQueue(_0x3a19cb){this['id']=_0x3a19cb['id']||0x0;this[_0xeb0f('0xb')]=_0x3a19cb[_0xeb0f('0xb')]||'';this[_0xeb0f('0xc')]=_0x3a19cb[_0xeb0f('0xc')]||'';this[_0xeb0f('0xd')]=_0x3a19cb[_0xeb0f('0xd')]||_0xeb0f('0xe');this[_0xeb0f('0xf')]=0x0;this['talking']=0x0;this['total']=0x0;this[_0xeb0f('0x10')]=0x0;this[_0xeb0f('0x11')]=0x0;this[_0xeb0f('0x12')]=0x0;this['sumBillable']=0x0;this[_0xeb0f('0x13')]=0x0;this['abandoned']=0x0;this[_0xeb0f('0x14')]=0x0;this[_0xeb0f('0x15')]=0x0;this[_0xeb0f('0x16')]=_0x3a19cb[_0xeb0f('0x16')]||![];this[_0xeb0f('0x17')]=_0x3a19cb['acwTimeout']||0xa;this[_0xeb0f('0x18')]=_0x3a19cb[_0xeb0f('0x18')]||'no';this[_0xeb0f('0x19')]=!![];this[_0xeb0f('0x1a')]='';this['originated']=0x0;this[_0xeb0f('0x1b')]=0x0;this['dialTimezone']=_0x3a19cb[_0xeb0f('0x1c')]||null;this[_0xeb0f('0x1d')]=_0x3a19cb['dialGlobalInterval']?_0x3a19cb[_0xeb0f('0x1d')]:null;this[_0xeb0f('0x1e')]=_0x3a19cb[_0xeb0f('0x1e')];this['dialMethod']=_0x3a19cb[_0xeb0f('0x1f')]||'progressive';this['dialLimitChannel']=_0x3a19cb[_0xeb0f('0x20')]||0x0;this['dialLimitQueue']=_0x3a19cb[_0xeb0f('0x21')]||0x0;this['dialPowerLevel']=_0x3a19cb[_0xeb0f('0x22')]||0x1;this[_0xeb0f('0x23')]=_0x3a19cb[_0xeb0f('0x23')]||_0xeb0f('0x24');this[_0xeb0f('0x25')]=_0x3a19cb[_0xeb0f('0x25')]||0.03;this['dialPredictiveInterval']=_0x3a19cb[_0xeb0f('0x26')]||0x258;this[_0xeb0f('0x27')]=_0x3a19cb[_0xeb0f('0x27')]||_0xeb0f('0x28');this['dialOriginateCallerIdNumber']=_0x3a19cb['dialOriginateCallerIdNumber']||_0xeb0f('0x28');this['dialOriginateTimeout']=_0x3a19cb[_0xeb0f('0x29')]||0x1e;this[_0xeb0f('0x2a')]=_0x3a19cb[_0xeb0f('0x2a')]||'tTxX';this[_0xeb0f('0x2b')]=_0x3a19cb[_0xeb0f('0x2b')]||0x3;this['dialQueueProject']=_0x3a19cb[_0xeb0f('0x2c')]||undefined;this['dialCongestionMaxRetry']=_0x3a19cb[_0xeb0f('0x2d')]||0x3;this[_0xeb0f('0x2e')]=_0x3a19cb['dialCongestionRetryFrequency']||0x96;this[_0xeb0f('0x2f')]=_0x3a19cb['dialBusyMaxRetry']||0x3;this[_0xeb0f('0x30')]=_0x3a19cb[_0xeb0f('0x30')]||0x96;this[_0xeb0f('0x31')]=_0x3a19cb[_0xeb0f('0x31')]||0x3;this['dialNoAnswerRetryFrequency']=_0x3a19cb[_0xeb0f('0x32')]||0x96;this[_0xeb0f('0x33')]=_0x3a19cb[_0xeb0f('0x33')]||0x3;this[_0xeb0f('0x34')]=_0x3a19cb[_0xeb0f('0x34')]||0x96;this[_0xeb0f('0x35')]=_0x3a19cb[_0xeb0f('0x35')]||0x3;this[_0xeb0f('0x36')]=_0x3a19cb[_0xeb0f('0x36')]||0x96;this[_0xeb0f('0x37')]=_0x3a19cb[_0xeb0f('0x37')]||0x3;this[_0xeb0f('0x38')]=_0x3a19cb[_0xeb0f('0x38')]||0x96;this[_0xeb0f('0x39')]=_0x3a19cb[_0xeb0f('0x39')]||0x3;this[_0xeb0f('0x3a')]=_0x3a19cb[_0xeb0f('0x3a')]||0x96;this['dialAgentRejectMaxRetry']=_0x3a19cb['dialAgentRejectMaxRetry']||0x3;this[_0xeb0f('0x3b')]=_0x3a19cb[_0xeb0f('0x3b')]||0x96;this[_0xeb0f('0x3c')]=_0x3a19cb['dialGlobalMaxRetry']||0x4;this[_0xeb0f('0x3d')]=_0x3a19cb['Trunk']?_0x3a19cb[_0xeb0f('0x3d')]:undefined;this[_0xeb0f('0x3e')]=_0x3a19cb[_0xeb0f('0x3e')]?_0x3a19cb[_0xeb0f('0x3e')]:undefined;this[_0xeb0f('0x3f')]=_0x3a19cb[_0xeb0f('0x3f')]||undefined;this[_0xeb0f('0x40')]=_0x3a19cb[_0xeb0f('0x40')]?_0x3a19cb[_0xeb0f('0x40')]:undefined;this[_0xeb0f('0x41')]=_0x3a19cb[_0xeb0f('0x41')]||_0xeb0f('0x42');this[_0xeb0f('0x43')]=_0x3a19cb['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xeb0f('0x44')]=_0x3a19cb['dialCutDigit']||undefined;this[_0xeb0f('0x45')]=strategy[_0x3a19cb[_0xeb0f('0x45')]]||_0xeb0f('0x46');this['queueStatusComplete']=!![];this[_0xeb0f('0x47')]=_0x3a19cb[_0xeb0f('0x47')]||![];this[_0xeb0f('0x48')]=_0x3a19cb[_0xeb0f('0x48')];this[_0xeb0f('0x49')]=_0x3a19cb[_0xeb0f('0x49')];this[_0xeb0f('0x4a')]=_0x3a19cb[_0xeb0f('0x4a')];this[_0xeb0f('0x4b')]=_0x3a19cb[_0xeb0f('0x4b')];this['dialAMDMinWordLength']=_0x3a19cb[_0xeb0f('0x4c')];this[_0xeb0f('0x4d')]=_0x3a19cb[_0xeb0f('0x4d')];this[_0xeb0f('0x4e')]=_0x3a19cb[_0xeb0f('0x4e')];this[_0xeb0f('0x4f')]=_0x3a19cb[_0xeb0f('0x4f')];this[_0xeb0f('0x50')]=_0x3a19cb['dialAMDMaximumWordLength'];this[_0xeb0f('0x51')]=0x0;this['pTalking']=0x0;this[_0xeb0f('0x52')]=_0x3a19cb[_0xeb0f('0x52')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xeb0f('0x53')]=0x0;this[_0xeb0f('0x54')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xeb0f('0x55')]=0x0;this[_0xeb0f('0x56')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xeb0f('0x57')]=0x0;this[_0xeb0f('0x58')]=0x0;this[_0xeb0f('0x59')]=0x0;this[_0xeb0f('0x5a')]=0x0;this[_0xeb0f('0x5b')]=0x0;this['outboundAbandonedDay']=0x0;this[_0xeb0f('0x5c')]=undefined;this[_0xeb0f('0x5d')]=undefined;this[_0xeb0f('0x5e')]=undefined;this[_0xeb0f('0x5f')]=1.05;this[_0xeb0f('0x60')]=0x0;this[_0xeb0f('0x61')]=0x0;this[_0xeb0f('0x62')]=0x0;this[_0xeb0f('0x63')]=0x0;this[_0xeb0f('0x64')]=0x0;this[_0xeb0f('0x65')]=0x0;this[_0xeb0f('0x66')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xeb0f('0x67')]=_0x3a19cb[_0xeb0f('0x68')]||0x14;this['predictiveIntervalMinThreshold']=_0x3a19cb[_0xeb0f('0x68')]||0xa;this[_0xeb0f('0x69')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this[_0xeb0f('0x6a')]=0x0;this[_0xeb0f('0x6b')]=0x0;this[_0xeb0f('0x6c')]=0x0;this[_0xeb0f('0x6d')]=_0x3a19cb[_0xeb0f('0x6d')]||0x1e;this[_0xeb0f('0x6e')]=_0x3a19cb[_0xeb0f('0x6e')]||![];this['dialQueueProject2']=_0x3a19cb[_0xeb0f('0x6f')]||undefined;this[_0xeb0f('0x70')]=_0x3a19cb[_0xeb0f('0x70')]||![];this[_0xeb0f('0x71')]=_0x3a19cb[_0xeb0f('0x71')]||![];this[_0xeb0f('0xc')]=monitorFormat[_0x3a19cb[_0xeb0f('0xc')]]?monitorFormat[_0x3a19cb[_0xeb0f('0xc')]]:undefined;this['mandatoryDisposition']=_0x3a19cb['mandatoryDisposition']||![];this[_0xeb0f('0x72')]=_0x3a19cb[_0xeb0f('0x72')]?_0x3a19cb['mandatoryDispositionPause']:undefined;}module[_0xeb0f('0x73')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 08112f8..50f3b0f 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 _0x6816=['exports','name','username','accessKey','remoteUri','Configurations'];(function(_0x475eac,_0x2fa495){var _0x4ad158=function(_0x2d7c4c){while(--_0x2d7c4c){_0x475eac['push'](_0x475eac['shift']());}};_0x4ad158(++_0x2fa495);}(_0x6816,0x97));var _0x6681=function(_0x3bd13d,_0x15d859){_0x3bd13d=_0x3bd13d-0x0;var _0x32b33f=_0x6816[_0x3bd13d];return _0x32b33f;};'use strict';function VtigerAccount(_0x40fc11){this['id']=_0x40fc11['id']||0x0;this[_0x6681('0x0')]=_0x40fc11[_0x6681('0x0')]||'';this[_0x6681('0x1')]=_0x40fc11[_0x6681('0x1')]||'';this[_0x6681('0x2')]=_0x40fc11[_0x6681('0x2')]||'';this['remoteUri']=_0x40fc11[_0x6681('0x3')]||'';this['serverUrl']=_0x40fc11['serverUrl']||'';this['Configurations']=_0x40fc11[_0x6681('0x4')]||{};}module[_0x6681('0x5')]=VtigerAccount; \ No newline at end of file +var _0x1efa=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0xfb045c,_0x56fc4a){var _0x40954b=function(_0x14371d){while(--_0x14371d){_0xfb045c['push'](_0xfb045c['shift']());}};_0x40954b(++_0x56fc4a);}(_0x1efa,0x15d));var _0xa1ef=function(_0x9c6a6f,_0x2c7179){_0x9c6a6f=_0x9c6a6f-0x0;var _0x1a1524=_0x1efa[_0x9c6a6f];return _0x1a1524;};'use strict';function VtigerAccount(_0x174b2d){this['id']=_0x174b2d['id']||0x0;this[_0xa1ef('0x0')]=_0x174b2d[_0xa1ef('0x0')]||'';this['username']=_0x174b2d[_0xa1ef('0x1')]||'';this[_0xa1ef('0x2')]=_0x174b2d[_0xa1ef('0x2')]||'';this[_0xa1ef('0x3')]=_0x174b2d[_0xa1ef('0x3')]||'';this['serverUrl']=_0x174b2d[_0xa1ef('0x4')]||'';this[_0xa1ef('0x5')]=_0x174b2d[_0xa1ef('0x5')]||{};}module[_0xa1ef('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 38e8e94..a783740 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 _0xaf14=['username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x207c43,_0xee63e1){var _0xbbcf33=function(_0x2dd3f3){while(--_0x2dd3f3){_0x207c43['push'](_0x207c43['shift']());}};_0xbbcf33(++_0xee63e1);}(_0xaf14,0x99));var _0x4af1=function(_0x13ac22,_0x4b4a36){_0x13ac22=_0x13ac22-0x0;var _0x2248af=_0xaf14[_0x13ac22];return _0x2248af;};'use strict';function ZendeskAccount(_0x251805){this['id']=_0x251805['id']||0x0;this[_0x4af1('0x0')]=_0x251805[_0x4af1('0x0')]||'';this[_0x4af1('0x1')]=_0x251805['username']||'';this[_0x4af1('0x2')]=_0x251805[_0x4af1('0x2')]||'';this[_0x4af1('0x3')]=_0x251805[_0x4af1('0x3')]||'';this[_0x4af1('0x4')]=_0x251805[_0x4af1('0x4')]||'';this[_0x4af1('0x5')]=_0x251805[_0x4af1('0x5')]||'';this[_0x4af1('0x6')]=_0x251805[_0x4af1('0x6')]||_0x4af1('0x7');this[_0x4af1('0x8')]=_0x251805[_0x4af1('0x8')]||'';this[_0x4af1('0x9')]=_0x251805[_0x4af1('0x9')]||{};}module[_0x4af1('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x08b7=['remoteUri','authType','type','integrationTab','serverUrl','Configurations','name','username','password','token'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x08b7,0x178));var _0x708b=function(_0x35e564,_0x550613){_0x35e564=_0x35e564-0x0;var _0xf4d06d=_0x08b7[_0x35e564];return _0xf4d06d;};'use strict';function ZendeskAccount(_0x5f2ba6){this['id']=_0x5f2ba6['id']||0x0;this[_0x708b('0x0')]=_0x5f2ba6[_0x708b('0x0')]||'';this[_0x708b('0x1')]=_0x5f2ba6[_0x708b('0x1')]||'';this[_0x708b('0x2')]=_0x5f2ba6[_0x708b('0x2')]||'';this[_0x708b('0x3')]=_0x5f2ba6['token']||'';this[_0x708b('0x4')]=_0x5f2ba6[_0x708b('0x4')]||'';this['authType']=_0x5f2ba6[_0x708b('0x5')]||'';this[_0x708b('0x6')]=_0x5f2ba6['type']||_0x708b('0x7');this[_0x708b('0x8')]=_0x5f2ba6[_0x708b('0x8')]||'';this[_0x708b('0x9')]=_0x5f2ba6[_0x708b('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 5d52f50..2f9feac 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 _0x0b5c=['Configurations','exports','name','host','serverUrl','code','refreshToken'];(function(_0x4c8da9,_0x3b8d97){var _0x1c6c92=function(_0xb9b9c4){while(--_0xb9b9c4){_0x4c8da9['push'](_0x4c8da9['shift']());}};_0x1c6c92(++_0x3b8d97);}(_0x0b5c,0xc6));var _0xc0b5=function(_0x17c1e9,_0x1c5e8a){_0x17c1e9=_0x17c1e9-0x0;var _0x26f699=_0x0b5c[_0x17c1e9];return _0x26f699;};'use strict';function ZohoAccount(_0x5d4c67){this['id']=_0x5d4c67['id']||0x0;this[_0xc0b5('0x0')]=_0x5d4c67[_0xc0b5('0x0')]||'';this['description']=_0x5d4c67['description']||'';this[_0xc0b5('0x1')]=_0x5d4c67[_0xc0b5('0x1')]||'';this['zone']=_0x5d4c67['zone']||'';this['clientId']=_0x5d4c67['clientId']||'';this['clientSecret']=_0x5d4c67['clientSecret']||'';this[_0xc0b5('0x2')]=_0x5d4c67[_0xc0b5('0x2')]||'';this[_0xc0b5('0x3')]=_0x5d4c67[_0xc0b5('0x3')]||'';this[_0xc0b5('0x4')]=_0x5d4c67[_0xc0b5('0x4')]||'';this[_0xc0b5('0x5')]=_0x5d4c67[_0xc0b5('0x5')]||{};}module[_0xc0b5('0x6')]=ZohoAccount; \ No newline at end of file +var _0xde90=['description','host','zone','clientId','serverUrl','code','refreshToken','Configurations','exports','name'];(function(_0x313426,_0x486f9d){var _0x54a0d9=function(_0x4f340a){while(--_0x4f340a){_0x313426['push'](_0x313426['shift']());}};_0x54a0d9(++_0x486f9d);}(_0xde90,0x15d));var _0x0de9=function(_0x667c6a,_0x2155cd){_0x667c6a=_0x667c6a-0x0;var _0x36396a=_0xde90[_0x667c6a];return _0x36396a;};'use strict';function ZohoAccount(_0x5581d2){this['id']=_0x5581d2['id']||0x0;this[_0x0de9('0x0')]=_0x5581d2[_0x0de9('0x0')]||'';this[_0x0de9('0x1')]=_0x5581d2[_0x0de9('0x1')]||'';this[_0x0de9('0x2')]=_0x5581d2[_0x0de9('0x2')]||'';this[_0x0de9('0x3')]=_0x5581d2[_0x0de9('0x3')]||'';this[_0x0de9('0x4')]=_0x5581d2['clientId']||'';this['clientSecret']=_0x5581d2['clientSecret']||'';this[_0x0de9('0x5')]=_0x5581d2[_0x0de9('0x5')]||'';this['code']=_0x5581d2[_0x0de9('0x6')]||'';this[_0x0de9('0x7')]=_0x5581d2[_0x0de9('0x7')]||'';this[_0x0de9('0x8')]=_0x5581d2[_0x0de9('0x8')]||{};}module[_0x0de9('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 13fb03d..e21d41c 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 _0x850a=['type','campaigntype','dialAnswer','membername','isNil','Agent','channelAgent','SIP/%s','calleridname','Contact','firstName','lastName','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','getCaller','format','number','util','lodash','moment','string','uniqueid','idContact','queue','name'];(function(_0x45b62d,_0x30833a){var _0x28a68f=function(_0x5d7d58){while(--_0x5d7d58){_0x45b62d['push'](_0x45b62d['shift']());}};_0x28a68f(++_0x30833a);}(_0x850a,0x148));var _0xa850=function(_0x2cbec0,_0x262fef){_0x2cbec0=_0x2cbec0-0x0;var _0x3d4101=_0x850a[_0x2cbec0];return _0x3d4101;};'use strict';var util=require(_0xa850('0x0'));var _=require(_0xa850('0x1'));var moment=require(_0xa850('0x2'));function checkNameSurname(_0x99c385,_0x481107,_0x29a79a){var _0x72e695='';if(!_['isNil'](_0x481107)&&_0xa850('0x3')===typeof _0x481107){_0x72e695+=_0x481107;}if(!_['isNil'](_0x29a79a)&&'string'===typeof _0x29a79a){_0x72e695+='\x20'+_0x29a79a;}if(_0x72e695!==''){return _0x72e695;}return _0x99c385;}function Action(_0x4740e0,_0x5eea58,_0x48241f,_0x117388,_0x34b4db){this[_0xa850('0x4')]=_0x48241f||undefined;this[_0xa850('0x5')]=_0x4740e0['id'];this[_0xa850('0x6')]=_0x5eea58[_0xa850('0x7')];this[_0xa850('0x8')]=_0x5eea58['type'];this[_0xa850('0x9')]='queue';this[_0xa850('0xa')]=![];this[_0xa850('0xb')]=_[_0xa850('0xc')](_0x4740e0[_0xa850('0xd')])?undefined:_0x4740e0[_0xa850('0xd')][_0xa850('0x7')];this[_0xa850('0xe')]=this[_0xa850('0xb')]?util['format'](_0xa850('0xf'),this['membername']):_0x117388||undefined;this[_0xa850('0x10')]=checkNameSurname(_0x4740e0['Contact']['phone'],_0x4740e0[_0xa850('0x11')][_0xa850('0x12')],_0x4740e0['Contact'][_0xa850('0x13')]);this['active']=_0x4740e0['active']||![];this[_0xa850('0x14')]=_0x4740e0[_0xa850('0x11')]['phone'];this[_0xa850('0x15')]=_0x4740e0[_0xa850('0x15')];this['countbusyretry']=_0x4740e0[_0xa850('0x16')]||0x0;this[_0xa850('0x17')]=_0x4740e0[_0xa850('0x17')]||0x0;this['countnoanswerretry']=_0x4740e0[_0xa850('0x18')]||0x0;this['countglobal']=(_0x4740e0[_0xa850('0x16')]||0x0)+(_0x4740e0[_0xa850('0x17')]||0x0)+(_0x4740e0['countnoanswerretry']||0x0)+(_0x4740e0['countnosuchnumberretry']||0x0)+(_0x4740e0[_0xa850('0x19')]||0x0)+(_0x4740e0[_0xa850('0x1a')]||0x0)+(_0x4740e0['countmachineretry']||0x0)+(_0x4740e0[_0xa850('0x1b')]||0x0);this[_0xa850('0x1c')]=_0x4740e0[_0xa850('0x1c')]||0x0;this['countdropretry']=_0x4740e0['countdropretry']||0x0;this[_0xa850('0x1a')]=_0x4740e0['countabandonedretry']||0x0;this[_0xa850('0x1d')]=_0x4740e0[_0xa850('0x1d')]||0x0;this[_0xa850('0x1b')]=_0x4740e0['countagentrejectretry']||0x0;this[_0xa850('0x1e')]=_0x4740e0['callback'];this['callbackuniqueid']=_0x4740e0[_0xa850('0x1f')];this['callbackat']=_0x4740e0[_0xa850('0x20')];this[_0xa850('0x21')]=_0x4740e0[_0xa850('0x21')];this[_0xa850('0x22')]=_0x4740e0[_0xa850('0x22')];this[_0xa850('0x23')]=_0x4740e0[_0xa850('0x23')];this[_0xa850('0x24')]=_['isNil'](_0x4740e0[_0xa850('0xd')])?_0x4740e0[_0xa850('0x24')]:_0x4740e0[_0xa850('0xd')]['id'];this[_0xa850('0x25')]=_0x4740e0['VoiceQueueId'];this['originatecalleridnum']='';this[_0xa850('0x26')]='';}Action['prototype'][_0xa850('0x27')]=function(){return util[_0xa850('0x28')]('\x22%s\x22\x20<%s>',this[_0xa850('0x10')],this[_0xa850('0x29')]);};module['exports']=Action; \ No newline at end of file +var _0x1440=['VoiceQueueId','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','moment','isNil','string','idContact','name','type','queue','dialAnswer','channelAgent','membername','format','SIP/%s','calleridname','phone','Contact','lastName','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','Agent'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x1440,0x87));var _0x0144=function(_0x1c2ed9,_0x1da882){_0x1c2ed9=_0x1c2ed9-0x0;var _0x3a595b=_0x1440[_0x1c2ed9];return _0x3a595b;};'use strict';var util=require(_0x0144('0x0'));var _=require(_0x0144('0x1'));var moment=require(_0x0144('0x2'));function checkNameSurname(_0xc4a3c,_0x1cab6b,_0x363969){var _0x23143f='';if(!_[_0x0144('0x3')](_0x1cab6b)&&_0x0144('0x4')===typeof _0x1cab6b){_0x23143f+=_0x1cab6b;}if(!_[_0x0144('0x3')](_0x363969)&&_0x0144('0x4')===typeof _0x363969){_0x23143f+='\x20'+_0x363969;}if(_0x23143f!==''){return _0x23143f;}return _0xc4a3c;}function Action(_0x557d46,_0x4935ca,_0x6d5ccc,_0x24fe25,_0x765f3b){this['uniqueid']=_0x6d5ccc||undefined;this[_0x0144('0x5')]=_0x557d46['id'];this['queue']=_0x4935ca[_0x0144('0x6')];this[_0x0144('0x7')]=_0x4935ca[_0x0144('0x7')];this['campaigntype']=_0x0144('0x8');this[_0x0144('0x9')]=![];this['membername']=_[_0x0144('0x3')](_0x557d46['Agent'])?undefined:_0x557d46['Agent'][_0x0144('0x6')];this[_0x0144('0xa')]=this[_0x0144('0xb')]?util[_0x0144('0xc')](_0x0144('0xd'),this['membername']):_0x24fe25||undefined;this[_0x0144('0xe')]=checkNameSurname(_0x557d46['Contact'][_0x0144('0xf')],_0x557d46[_0x0144('0x10')]['firstName'],_0x557d46[_0x0144('0x10')][_0x0144('0x11')]);this['active']=_0x557d46['active']||![];this[_0x0144('0x12')]=_0x557d46[_0x0144('0x10')][_0x0144('0xf')];this[_0x0144('0x13')]=_0x557d46[_0x0144('0x13')];this[_0x0144('0x14')]=_0x557d46[_0x0144('0x14')]||0x0;this[_0x0144('0x15')]=_0x557d46['countcongestionretry']||0x0;this[_0x0144('0x16')]=_0x557d46[_0x0144('0x16')]||0x0;this[_0x0144('0x17')]=(_0x557d46[_0x0144('0x14')]||0x0)+(_0x557d46[_0x0144('0x15')]||0x0)+(_0x557d46['countnoanswerretry']||0x0)+(_0x557d46['countnosuchnumberretry']||0x0)+(_0x557d46[_0x0144('0x18')]||0x0)+(_0x557d46[_0x0144('0x19')]||0x0)+(_0x557d46[_0x0144('0x1a')]||0x0)+(_0x557d46['countagentrejectretry']||0x0);this[_0x0144('0x1b')]=_0x557d46[_0x0144('0x1b')]||0x0;this[_0x0144('0x18')]=_0x557d46[_0x0144('0x18')]||0x0;this[_0x0144('0x19')]=_0x557d46[_0x0144('0x19')]||0x0;this[_0x0144('0x1a')]=_0x557d46['countmachineretry']||0x0;this[_0x0144('0x1c')]=_0x557d46[_0x0144('0x1c')]||0x0;this[_0x0144('0x1d')]=_0x557d46[_0x0144('0x1d')];this['callbackuniqueid']=_0x557d46[_0x0144('0x1e')];this[_0x0144('0x1f')]=_0x557d46[_0x0144('0x1f')];this[_0x0144('0x20')]=_0x557d46[_0x0144('0x20')];this[_0x0144('0x21')]=_0x557d46[_0x0144('0x21')];this['ListId']=_0x557d46[_0x0144('0x22')];this[_0x0144('0x23')]=_[_0x0144('0x3')](_0x557d46[_0x0144('0x24')])?_0x557d46['UserId']:_0x557d46['Agent']['id'];this[_0x0144('0x25')]=_0x557d46[_0x0144('0x25')];this[_0x0144('0x26')]='';this['originatecalleridname']='';}Action[_0x0144('0x27')][_0x0144('0x28')]=function(){return util[_0x0144('0xc')](_0x0144('0x29'),this['calleridname'],this['number']);};module[_0x0144('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 fa3a512..95053d7 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 _0xed53=['keys','variable','value','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','campaignsPreview','voiceQueues','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','available','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','logger','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','setMessage','recallMe','sequence','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','UserId','VoiceQueueId','ListId','status','channel','catch','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','size','clearZombieChannel','getContactRecallMe','agentReadyId','then','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','callProgressDetectingCustomer','countnosuchnumberretry','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','complete','[16]','countglobal','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','\x20Queue','countbusyretry','Busy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','dialBusyRetryFrequency','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','isUndefined','object','reason','[callProgressDetectingAgent][logNoSuch]','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','trunks','SIP/%s','unmonitored','pick','unlock','unlockContact','execRun','getContactPreview','recallme','isValid','checkIsBlackList','Contact.phone','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','execCall','trim','dialCutDigit','substring','SIP/%s/%s%s','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridNumber','addVariables','merge','starttime','Action','variablesAction','destconnectedlinenum','user:%s','accountcode','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','isFailure','custom:agentringnoanswer','rejected','callProgressDetectingAgent','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','destlinkedid','addVariable','variables','filterKey'];(function(_0x1745bc,_0x2ff2f2){var _0x56e8fc=function(_0xa948cc){while(--_0xa948cc){_0x1745bc['push'](_0x1745bc['shift']());}};_0x56e8fc(++_0x2ff2f2);}(_0xed53,0x165));var _0x3ed5=function(_0x475598,_0x1eedab){_0x475598=_0x475598-0x0;var _0x1ee464=_0xed53[_0x475598];return _0x1ee464;};'use strict';var util=require(_0x3ed5('0x0'));var _=require(_0x3ed5('0x1'));var BPromise=require(_0x3ed5('0x2'));var uuid=require(_0x3ed5('0x3'));var moment=require(_0x3ed5('0x4'));var md5=require(_0x3ed5('0x5'));var Redis=require(_0x3ed5('0x6'));var config=require('../../../config/environment');var logger=require(_0x3ed5('0x7'))(_0x3ed5('0x8'));var loggerAction=require(_0x3ed5('0x7'))(_0x3ed5('0x9'));var ami=require(_0x3ed5('0xa'));var rpcDb=require(_0x3ed5('0xb'));var Action=require(_0x3ed5('0xc'));var ut=require(_0x3ed5('0xd'));config[_0x3ed5('0xe')]=_[_0x3ed5('0xf')](config['redis'],{'host':_0x3ed5('0x10'),'port':0x18eb});var io=require(_0x3ed5('0x11'))(new Redis(config[_0x3ed5('0xe')]));var Sequence=function(){};Sequence[_0x3ed5('0x12')][_0x3ed5('0x13')]=function(_0x2f2ec5){this[_0x3ed5('0x14')]=this[_0x3ed5('0x14')]?this[_0x3ed5('0x14')][_0x3ed5('0x15')](_0x2f2ec5):_0x2f2ec5();};function Preview(_0x270dfa){this['sequence']=new Sequence();this[_0x3ed5('0x16')]=_0x270dfa[_0x3ed5('0x17')];this['trunks']=_0x270dfa['trunks'];this[_0x3ed5('0x18')]={};this['agents']=_0x270dfa[_0x3ed5('0x19')];this[_0x3ed5('0x1a')]=0x0;ami['on'](_0x3ed5('0x1b'),this[_0x3ed5('0x1c')][_0x3ed5('0x1d')](this));ami['on'](_0x3ed5('0x1e'),this[_0x3ed5('0x1f')][_0x3ed5('0x1d')](this));ami['on'](_0x3ed5('0x20'),this[_0x3ed5('0x21')][_0x3ed5('0x1d')](this));ami['on']('dialend',this[_0x3ed5('0x22')][_0x3ed5('0x1d')](this));ami['on'](_0x3ed5('0x23'),this[_0x3ed5('0x24')]['bind'](this));ami['on'](_0x3ed5('0x25'),this[_0x3ed5('0x26')][_0x3ed5('0x1d')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x3ed5('0x1d')](this));ami['on']('blindtransfer',this[_0x3ed5('0x27')]['bind'](this));this[_0x3ed5('0x28')](this[_0x3ed5('0x16')]);}function emit(_0x52c447,_0x19bf74,_0xe94a56){io['to'](_0x52c447)[_0x3ed5('0x29')](_0x19bf74,_0xe94a56);}function emitCampaignPreview(_0x2606ed){if(_0x2606ed[_0x3ed5('0x2a')]===_0x3ed5('0x2b')){var _0x38cd41={'id':_0x2606ed['id'],'name':_0x2606ed[_0x3ed5('0x2c')],'strategy':_0x2606ed[_0x3ed5('0x2d')],'answered':_0x2606ed[_0x3ed5('0x2e')],'available':_0x2606ed['available'],'loggedIn':_0x2606ed[_0x3ed5('0x2f')],'pTalking':_0x2606ed[_0x3ed5('0x30')],'sumBillable':_0x2606ed[_0x3ed5('0x31')],'sumDuration':_0x2606ed[_0x3ed5('0x32')],'sumHoldTime':_0x2606ed[_0x3ed5('0x33')]||0x0,'talking':_0x2606ed['talking'],'total':_0x2606ed[_0x3ed5('0x34')],'type':_0x2606ed[_0x3ed5('0x2a')],'unmanaged':_0x2606ed[_0x3ed5('0x35')],'abandoned':_0x2606ed[_0x3ed5('0x36')],'waiting':_0x2606ed[_0x3ed5('0x37')],'loggedInDb':_0x2606ed[_0x3ed5('0x38')],'dialActive':_0x2606ed[_0x3ed5('0x39')],'dialMethod':_0x2606ed[_0x3ed5('0x3a')],'dialOriginateCallerIdName':_0x2606ed[_0x3ed5('0x3b')],'dialOriginateCallerIdNumber':_0x2606ed[_0x3ed5('0x3c')],'dialOriginateTimeout':_0x2606ed[_0x3ed5('0x3d')],'dialPrefix':_0x2606ed[_0x3ed5('0x3e')],'outboundAnswerAgiCallsDay':_0x2606ed[_0x3ed5('0x3f')],'outboundAnswerCallsDay':_0x2606ed[_0x3ed5('0x40')],'outboundBlacklistCallsDay':_0x2606ed[_0x3ed5('0x41')],'outboundBusyCallsDay':_0x2606ed[_0x3ed5('0x42')],'outboundCongestionCallsDay':_0x2606ed['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x2606ed['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x2606ed['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x2606ed['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x2606ed[_0x3ed5('0x43')],'outboundNoSuchCallsDay':_0x2606ed[_0x3ed5('0x44')],'outboundOriginateFailureCallsDay':_0x2606ed['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x2606ed[_0x3ed5('0x45')],'outboundRejectCallsDay':_0x2606ed['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x2606ed['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x2606ed['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x2606ed[_0x3ed5('0x46')],'predictiveIntervalAvgHoldtime':_0x2606ed[_0x3ed5('0x47')],'predictiveIntervalAvgTalktime':_0x2606ed[_0x3ed5('0x48')],'predictiveIntervalDroppedCallsCallersExit':_0x2606ed[_0x3ed5('0x49')],'predictiveIntervalDroppedCallsTimeout':_0x2606ed[_0x3ed5('0x4a')],'predictiveIntervalErlangCalls':_0x2606ed[_0x3ed5('0x4b')],'predictiveIntervalErlangCallsDroppedCalls':_0x2606ed[_0x3ed5('0x4c')],'predictiveIntervalHitRate':_0x2606ed[_0x3ed5('0x4d')],'predictiveIntervalMultiplicativeFactor':_0x2606ed[_0x3ed5('0x4e')],'predictiveIntervalPauses':_0x2606ed[_0x3ed5('0x4f')],'predictiveIntervalAvailable':_0x2606ed['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x2606ed[_0x3ed5('0x50')],'message':_0x2606ed[_0x3ed5('0x51')],'originated':_0x2606ed[_0x3ed5('0x52')],'erlangCalls':_0x2606ed[_0x3ed5('0x53')],'erlangCallToSecond':_0x2606ed['erlangCallToSecond'],'erlangAbandonmentRate':_0x2606ed[_0x3ed5('0x54')],'erlangBusyFactor':_0x2606ed[_0x3ed5('0x55')],'startPredictive':_0x2606ed[_0x3ed5('0x56')],'startProgressive':_0x2606ed['startProgressive']};if(_0x2606ed[_0x3ed5('0x57')]){_0x38cd41[_0x3ed5('0x57')]={'id':_0x2606ed['Trunk']['id'],'name':_0x2606ed['Trunk']['name'],'active':_0x2606ed['Trunk'][_0x3ed5('0x58')],'callerid':_0x2606ed[_0x3ed5('0x57')]['callerid']};}if(_0x2606ed[_0x3ed5('0x59')]){_0x38cd41[_0x3ed5('0x59')]={'id':_0x2606ed[_0x3ed5('0x59')]['id'],'name':_0x2606ed[_0x3ed5('0x59')][_0x3ed5('0x2c')]};}var _0x19b02d=md5(JSON[_0x3ed5('0x5a')](_0x38cd41));if(_0x2606ed[_0x3ed5('0x5')]!==_0x19b02d){_0x2606ed[_0x3ed5('0x5')]=_0x19b02d;emit(util[_0x3ed5('0x5b')](_0x3ed5('0x5c'),_0x38cd41[_0x3ed5('0x2c')]),_0x3ed5('0x5d'),_0x38cd41);}}}function emitVoiceQueueChannelRemove(_0x39bbf0){logger[_0x3ed5('0x5e')](_0x3ed5('0x5f'),JSON['stringify'](_0x39bbf0));emit(util[_0x3ed5('0x5b')](_0x3ed5('0x5c'),_0x39bbf0[_0x3ed5('0x2c')]),_0x3ed5('0x60'),_0x39bbf0);io['emit'](_0x3ed5('0x61'),_0x39bbf0);}function notSendMessagesQueue(_0x2c4d35){if(_0x2c4d35[_0x3ed5('0x62')]){if(_0x2c4d35[_0x3ed5('0x52')]===0x0&&_0x2c4d35['pTalking']===0x0){_0x2c4d35['sendMessageOneNotActive']=![];_0x2c4d35[_0x3ed5('0x63')]=0x0;_0x2c4d35[_0x3ed5('0x64')]=0x0;_0x2c4d35[_0x3ed5('0x51')]=_0x3ed5('0x65');ut['logger'](_0x3ed5('0x66'),_0x2c4d35[_0x3ed5('0x2c')]+'\x20is\x20not\x20active');}else{_0x2c4d35[_0x3ed5('0x51')]=_0x3ed5('0x67');ut[_0x3ed5('0x68')](_0x3ed5('0x66'),_0x2c4d35[_0x3ed5('0x2c')]+_0x3ed5('0x69'));}emitCampaignPreview(_0x2c4d35);}}Preview[_0x3ed5('0x12')][_0x3ed5('0x28')]=function(){var _0x18db3d=this;setInterval(function(){_0x18db3d[_0x3ed5('0x6a')]();},0x7cf);};Preview[_0x3ed5('0x12')][_0x3ed5('0x6a')]=function(){var _0x40167b=this['campaignsPreview'];this[_0x3ed5('0x1a')]+=0x1;for(var _0x1abbc8 in _0x40167b){if(_0x40167b[_0x3ed5('0x6b')](_0x1abbc8)&&(_0x40167b[_0x1abbc8][_0x3ed5('0x3a')]===_0x3ed5('0x8')||_0x40167b[_0x1abbc8][_0x3ed5('0x3a')]===_0x3ed5('0x6c'))&&_0x40167b[_0x1abbc8][_0x3ed5('0x2a')]===_0x3ed5('0x2b')){if(this[_0x3ed5('0x1a')]>0x7){this[_0x3ed5('0x1a')]=0x0;this['clearZombieChannels']();}}if(_0x40167b['hasOwnProperty'](_0x1abbc8)&&_0x40167b[_0x1abbc8][_0x3ed5('0x3a')]===_0x3ed5('0x8')&&_0x40167b[_0x1abbc8][_0x3ed5('0x2a')]===_0x3ed5('0x2b')){if(_0x40167b[_0x1abbc8][_0x3ed5('0x39')]){this[_0x3ed5('0x6d')](_0x40167b[_0x1abbc8]);this[_0x3ed5('0x6e')](_0x40167b[_0x1abbc8]);}else{notSendMessagesQueue(_0x40167b[_0x1abbc8]);}}}};Preview[_0x3ed5('0x12')]['clearZombieChannel']=function(_0x47863a){var _0x7dbefe=this;this[_0x3ed5('0x6f')][_0x3ed5('0x13')](function(){if(!_[_0x3ed5('0x70')](_0x7dbefe['actions'][_0x47863a])){loggerAction['info'](_0x3ed5('0x71'),_0x47863a,_0x3ed5('0x72'),_0x7dbefe[_0x3ed5('0x18')][_0x47863a][_0x3ed5('0x73')],_0x3ed5('0x74'),JSON[_0x3ed5('0x5a')](_0x7dbefe['campaignsPreview'][_0x7dbefe['actions'][_0x47863a][_0x3ed5('0x73')]][_0x3ed5('0x52')]),_0x3ed5('0x75'),JSON[_0x3ed5('0x5a')](_0x7dbefe[_0x3ed5('0x16')][_0x7dbefe['actions'][_0x47863a][_0x3ed5('0x73')]][_0x3ed5('0x30')]),JSON[_0x3ed5('0x5a')](_0x7dbefe[_0x3ed5('0x18')][_0x47863a][_0x3ed5('0x76')]),JSON[_0x3ed5('0x5a')](_['pick'](_0x7dbefe['actions'][_0x47863a],[_0x3ed5('0x77'),_0x3ed5('0x78'),_0x3ed5('0x79'),_0x3ed5('0x7a')])));return ami['Action']({'action':_0x3ed5('0x7b'),'channel':_0x7dbefe['actions'][_0x47863a][_0x3ed5('0x7c')]})[_0x3ed5('0x7d')](function(_0x3a762e){if(_0x3a762e[_0x3ed5('0x51')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x7dbefe['actions'][_0x47863a]){ut[_0x3ed5('0x7e')](_0x7dbefe['campaignsPreview'][_0x7dbefe['actions'][_0x47863a]['queue']],_0x3ed5('0x7f'));if(_0x7dbefe[_0x3ed5('0x18')][_0x47863a][_0x3ed5('0x76')]===!![]){ut[_0x3ed5('0x80')](_0x7dbefe[_0x3ed5('0x16')][_0x7dbefe['actions'][_0x47863a]['queue']],_0x3ed5('0x7f'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x47863a,_0x7dbefe[_0x3ed5('0x18')][_0x47863a][_0x3ed5('0x73')]);}ut[_0x3ed5('0x81')]('[Dialer][checkChannel][Preview]'+_0x47863a,_0x7dbefe[_0x3ed5('0x18')][_0x47863a][_0x3ed5('0x73')]);delete _0x7dbefe[_0x3ed5('0x18')][_0x47863a];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0x29f4de=this;loggerAction[_0x3ed5('0x5e')]('[action]',_[_0x3ed5('0x82')](this['actions']));for(var _0x5f46d4 in this[_0x3ed5('0x18')]){if(_0x29f4de['actions'][_0x3ed5('0x6b')](_0x5f46d4)){_0x29f4de[_0x3ed5('0x83')](_0x5f46d4);}}};Preview[_0x3ed5('0x12')][_0x3ed5('0x6e')]=function(_0x36ca9f){var _0x6e9ef4=this;rpcDb[_0x3ed5('0x84')](_0x36ca9f['id'],ut[_0x3ed5('0x85')](this[_0x3ed5('0x19')]))[_0x3ed5('0x86')](function(_0x51ef3c){if(!_[_0x3ed5('0x70')](_0x51ef3c)){for(var _0xe3ea35=0x0;_0xe3ea35<_0x51ef3c['length'];_0xe3ea35+=0x1){if(ut[_0x3ed5('0x87')](_0x51ef3c[_0xe3ea35][_0x3ed5('0x88')])<_0x36ca9f[_0x3ed5('0x89')]*0x3c){if(_0x51ef3c[_0xe3ea35][_0x3ed5('0x8a')]&&!_0x51ef3c[_0xe3ea35]['Agent'][_0x3ed5('0x8b')]){_0x6e9ef4[_0x3ed5('0x8c')](_0x51ef3c[_0xe3ea35]['id'])[_0x3ed5('0x86')](ut[_0x3ed5('0x8d')](_0x3ed5('0x8e')))[_0x3ed5('0x7d')](ut[_0x3ed5('0x8d')](_0x3ed5('0x8e')));}else{rpcDb[_0x3ed5('0x8f')](_0x51ef3c[_0xe3ea35]['id']);}}else{var _0x25e73c=new Action(_0x51ef3c[_0xe3ea35],_0x36ca9f);_0x25e73c['starttime']=moment()[_0x3ed5('0x5b')](_0x3ed5('0x90'));_0x36ca9f[_0x3ed5('0x45')]+=0x1;ut[_0x3ed5('0x91')](_0x25e73c,0x17,_0x3ed5('0x92'));if(_0x36ca9f[_0x3ed5('0x93')]){rpcDb[_0x3ed5('0x94')](ut[_0x3ed5('0x95')](_0x51ef3c[_0xe3ea35]));rpcDb['createCustomerHistory'](_0x25e73c,_0x3ed5('0x96'));}else{ut[_0x3ed5('0x91')](_0x25e73c,0x16,_0x3ed5('0x97'));rpcDb[_0x3ed5('0x98')](_0x25e73c,_0x3ed5('0x99'));rpcDb[_0x3ed5('0x9a')](_0x25e73c,_0x3ed5('0x99'));}}}}})[_0x3ed5('0x7d')](ut[_0x3ed5('0x8d')]('[getContactRecallMe]'));};Preview[_0x3ed5('0x12')][_0x3ed5('0x6d')]=function(_0x1d2c6b){_0x1d2c6b[_0x3ed5('0x62')]=!![];if(ut[_0x3ed5('0x9b')](_0x1d2c6b[_0x3ed5('0x2f')])){_0x1d2c6b[_0x3ed5('0x51')]=_0x3ed5('0x9c');}else if(!ut[_0x3ed5('0x9d')](_0x1d2c6b['dialActive'])){_0x1d2c6b[_0x3ed5('0x51')]='NOT_ACTIVE';}else if(!this[_0x3ed5('0x9e')](_0x1d2c6b[_0x3ed5('0x57')])){if(!this[_0x3ed5('0x9e')](_0x1d2c6b['TrunkBackup'])){_0x1d2c6b[_0x3ed5('0x51')]=_0x3ed5('0x9f');}else{_0x1d2c6b['message']='ACTIVE';}}else{_0x1d2c6b[_0x3ed5('0x51')]='ACTIVE';}emitCampaignPreview(_0x1d2c6b);};Preview['prototype'][_0x3ed5('0xa0')]=function(_0x9708a7,_0x18082d,_0x19c051){var _0x5286ba=this;var _0x794a6d=this['actions'][_0x18082d];var _0x1f5c23=this[_0x3ed5('0x16')][_0x794a6d[_0x3ed5('0x73')]];var _0x3368b8;if(_0x1f5c23){switch(_0x19c051){case'1':_0x1f5c23[_0x3ed5('0x44')]+=0x1;_0x794a6d[_0x3ed5('0xa1')]+=0x1;_0x794a6d['countglobal']=ut[_0x3ed5('0xa2')](_0x794a6d);ut[_0x3ed5('0x91')](_0x794a6d,0x0,_0x3ed5('0xa3'));ami['emit'](_0x3ed5('0xa4'),ut[_0x3ed5('0xa5')](_0x794a6d,_0x3ed5('0xa6')));rpcDb[_0x3ed5('0x98')](_0x794a6d,_0x3ed5('0xa7'));if(ut[_0x3ed5('0xa2')](_0x794a6d)>=_0x1f5c23[_0x3ed5('0xa8')]){_0x3368b8=ut[_0x3ed5('0xa9')](_0x794a6d,0xf,_0x3ed5('0xaa'));rpcDb[_0x3ed5('0x9a')](_0x3368b8,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x794a6d[_0x3ed5('0xa1')]>=_0x1f5c23[_0x3ed5('0xab')]){rpcDb[_0x3ed5('0x9a')](_0x794a6d,_0x3ed5('0xac'));}else{rpcDb['rescheduleContact'](ut[_0x3ed5('0xad')](_0x794a6d,_0x3ed5('0xa1'),_0x1f5c23[_0x3ed5('0xae')]),_0x794a6d[_0x3ed5('0xaf')],_0x794a6d[_0x3ed5('0xb0')]);}}delete this[_0x3ed5('0x18')][_0x9708a7[_0x3ed5('0xb1')]];break;case _0x3ed5('0xb2'):var _0x527bc2=moment()[_0x3ed5('0x5b')](_0x3ed5('0x90'));_0x794a6d[_0x3ed5('0xb3')]=_0x527bc2;_0x794a6d[_0x3ed5('0xb4')]=_0x527bc2;_0x794a6d['dialAnswer']=!![];_0x1f5c23[_0x3ed5('0x30')]+=0x1;logger[_0x3ed5('0x5e')](_0x3ed5('0xb5'),_0x794a6d[_0x3ed5('0xb6')],'\x20Queue',_0x1f5c23[_0x3ed5('0x2c')],'pTalking:\x20',_0x1f5c23[_0x3ed5('0x30')]);ami[_0x3ed5('0x29')](_0x3ed5('0xb7'),ut['buildObj'](_0x794a6d,_0x3ed5('0xb8'),this[_0x3ed5('0x16')][_0x794a6d[_0x3ed5('0x73')]]));if(_0x1f5c23[_0x3ed5('0xb9')]){ami[_0x3ed5('0x29')](_0x3ed5('0xba'),ut[_0x3ed5('0xbb')](_0x794a6d));}break;case'16':ami[_0x3ed5('0x29')]('custom:agentcomplete',ut[_0x3ed5('0xa5')](_0x794a6d,_0x3ed5('0xbc'),this[_0x3ed5('0x16')][_0x794a6d[_0x3ed5('0x73')]]));emitVoiceQueueChannelRemove(ut[_0x3ed5('0xa5')](_0x794a6d,_0x3ed5('0xbc')));_0x1f5c23[_0x3ed5('0x40')]+=0x1;_0x1f5c23[_0x3ed5('0x34')]+=0x1;_0x1f5c23['answered']+=0x1;ut[_0x3ed5('0x80')](_0x1f5c23,_0x3ed5('0xbd'));_0x794a6d[_0x3ed5('0xbe')]=ut[_0x3ed5('0xa2')](_0x794a6d);ut['logCustomer'](_0x794a6d,0x4,'Answer');rpcDb['createCustomerHistory'](_0x794a6d,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x3ed5('0x9a')](_0x794a6d,_0x3ed5('0xbf'));rpcDb[_0x3ed5('0xc0')](_0x794a6d);_0x1f5c23[_0x3ed5('0x32')]+=_0x794a6d['talktime'];_0x1f5c23[_0x3ed5('0x31')]+=_0x794a6d[_0x3ed5('0xc1')];logger[_0x3ed5('0x5e')]('[syncHangup][talking][decrement]',_0x794a6d['uniqueid'],_0x3ed5('0xc2'),_0x1f5c23[_0x3ed5('0x2c')],'pTalking:\x20',_0x1f5c23['pTalking']);delete this[_0x3ed5('0x18')][_0x9708a7[_0x3ed5('0xb1')]];break;case'BUSY':_0x1f5c23[_0x3ed5('0x42')]+=0x1;_0x794a6d[_0x3ed5('0xc3')]+=0x1;_0x794a6d['countglobal']=ut['totalGlobal'](_0x794a6d);ut[_0x3ed5('0x91')](_0x794a6d,0x5,_0x3ed5('0xc4'));ami[_0x3ed5('0x29')]('custom:agentbusy',ut[_0x3ed5('0xa5')](_0x794a6d,_0x3ed5('0xc5')));rpcDb['createCustomerHistory'](_0x794a6d,_0x3ed5('0xc6'));if(ut[_0x3ed5('0xa2')](_0x794a6d)>=_0x1f5c23[_0x3ed5('0xa8')]){_0x3368b8=ut[_0x3ed5('0xa9')](_0x794a6d,0xf,_0x3ed5('0xaa'));rpcDb['createCustomerFinal'](_0x3368b8,_0x3ed5('0xc7'));}else{if(_0x794a6d[_0x3ed5('0xc3')]>=_0x1f5c23[_0x3ed5('0xc8')]){rpcDb[_0x3ed5('0x9a')](_0x794a6d,_0x3ed5('0xc6'));}else{rpcDb[_0x3ed5('0xc9')](ut[_0x3ed5('0xad')](_0x794a6d,_0x3ed5('0xc3'),_0x1f5c23['dialBusyRetryFrequency']),_0x794a6d[_0x3ed5('0xaf')],_0x794a6d['activeContact']);}}break;case'NOANSWER':_0x1f5c23['outboundNoAnswerCallsDay']+=0x1;_0x794a6d['countnoanswerretry']+=0x1;_0x794a6d['countglobal']=ut[_0x3ed5('0xa2')](_0x794a6d);ut[_0x3ed5('0x91')](_0x794a6d,0x3,_0x3ed5('0xca'));ami['emit'](_0x3ed5('0xcb'),ut['buildObj'](_0x794a6d,'noanswer'));rpcDb[_0x3ed5('0x98')](_0x794a6d,_0x3ed5('0xcc'));if(ut[_0x3ed5('0xa2')](_0x794a6d)>=_0x1f5c23[_0x3ed5('0xa8')]){_0x3368b8=ut['cloneAction'](_0x794a6d,0xf,_0x3ed5('0xaa'));rpcDb[_0x3ed5('0x9a')](_0x3368b8,_0x3ed5('0xcd'));}else{if(_0x794a6d[_0x3ed5('0xce')]>=_0x1f5c23['dialNoAnswerMaxRetry']){rpcDb[_0x3ed5('0x9a')](_0x794a6d,_0x3ed5('0xcc'));}else{rpcDb['rescheduleContact'](ut[_0x3ed5('0xad')](_0x794a6d,'countnoanswerretry',_0x1f5c23['dialNoAnswerRetryFrequency']),_0x794a6d[_0x3ed5('0xaf')],_0x794a6d[_0x3ed5('0xb0')]);}}break;case'CONGESTION':_0x1f5c23[_0x3ed5('0xcf')]+=0x1;_0x794a6d[_0x3ed5('0xd0')]+=0x1;_0x794a6d['countglobal']=ut[_0x3ed5('0xa2')](_0x794a6d);ut[_0x3ed5('0x91')](_0x794a6d,0x8,_0x3ed5('0xd1'));ami[_0x3ed5('0x29')](_0x3ed5('0xd2'),ut['buildObj'](_0x794a6d,_0x3ed5('0xd3')));rpcDb[_0x3ed5('0x98')](_0x794a6d,_0x3ed5('0xd4'));if(ut[_0x3ed5('0xa2')](_0x794a6d)>=_0x1f5c23['dialGlobalMaxRetry']){_0x3368b8=ut[_0x3ed5('0xa9')](_0x794a6d,0xf,_0x3ed5('0xaa'));rpcDb[_0x3ed5('0x9a')](_0x3368b8,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x794a6d[_0x3ed5('0xd0')]>=_0x1f5c23[_0x3ed5('0xd5')]){rpcDb['createCustomerFinal'](_0x794a6d,_0x3ed5('0xd4'));}else{rpcDb[_0x3ed5('0xc9')](ut[_0x3ed5('0xad')](_0x794a6d,_0x3ed5('0xd0'),_0x1f5c23[_0x3ed5('0xd6')]),_0x794a6d[_0x3ed5('0xaf')],_0x794a6d['activeContact']);}}break;case'CANCEL':_0x1f5c23[_0x3ed5('0xd7')]+=0x1;_0x794a6d['countagentrejectretry']+=0x1;_0x794a6d[_0x3ed5('0xbe')]=ut[_0x3ed5('0xa2')](_0x794a6d);ut['logCustomer'](_0x794a6d,0x14,_0x3ed5('0xd8'));ami[_0x3ed5('0x29')](_0x3ed5('0xd9'),ut[_0x3ed5('0xa5')](_0x794a6d,_0x3ed5('0xda')));rpcDb[_0x3ed5('0x98')](_0x794a6d,_0x3ed5('0xdb'));if(ut[_0x3ed5('0xa2')](_0x794a6d)>=_0x1f5c23[_0x3ed5('0xa8')]){_0x3368b8=ut[_0x3ed5('0xa9')](_0x794a6d,0x14,_0x3ed5('0xd8'));rpcDb['createCustomerFinal'](_0x3368b8,_0x3ed5('0xdc'));}else{if(_0x794a6d[_0x3ed5('0xdd')]>=_0x1f5c23[_0x3ed5('0xde')]){rpcDb[_0x3ed5('0x9a')](_0x794a6d,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x3ed5('0xc9')](ut[_0x3ed5('0xad')](_0x794a6d,_0x3ed5('0xdd'),_0x1f5c23[_0x3ed5('0xdf')]),_0x794a6d[_0x3ed5('0xaf')],_0x794a6d[_0x3ed5('0xb0')]);}}break;case _0x3ed5('0xe0'):_0x1f5c23[_0x3ed5('0xe1')]+=0x1;_0x794a6d[_0x3ed5('0xe2')]+=0x1;_0x794a6d['countglobal']=ut[_0x3ed5('0xa2')](_0x794a6d);ut[_0x3ed5('0x91')](_0x794a6d,0xb,_0x3ed5('0xe3'));rpcDb[_0x3ed5('0x98')](_0x794a6d,_0x3ed5('0xe4'));if(ut[_0x3ed5('0xa2')](_0x794a6d)>=_0x1f5c23['dialGlobalMaxRetry']){_0x3368b8=ut['cloneAction'](_0x794a6d,0xf,_0x3ed5('0xaa'));rpcDb[_0x3ed5('0x9a')](_0x3368b8,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x794a6d[_0x3ed5('0xe5')]>=_0x1f5c23[_0x3ed5('0xe6')]){rpcDb[_0x3ed5('0x9a')](_0x794a6d,_0x3ed5('0xe4'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x794a6d,_0x3ed5('0xe2'),_0x1f5c23[_0x3ed5('0xe7')]),_0x794a6d[_0x3ed5('0xaf')],_0x794a6d[_0x3ed5('0xb0')]);}}break;case'18':_0x1f5c23['outboundUnknownCallsDay']+=0x1;_0x794a6d[_0x3ed5('0xe8')]+=0x1;_0x794a6d[_0x3ed5('0xbe')]=ut[_0x3ed5('0xa2')](_0x794a6d);ut['logCustomer'](_0x794a6d,0x12,_0x9708a7[_0x3ed5('0xe9')]||_0x9708a7[_0x3ed5('0xea')]);ami[_0x3ed5('0x29')](_0x3ed5('0xeb'),ut[_0x3ed5('0xa5')](_0x794a6d,_0x3ed5('0xec')));rpcDb[_0x3ed5('0x98')](_0x794a6d,_0x3ed5('0xed'));if(ut[_0x3ed5('0xa2')](_0x794a6d)>=_0x1f5c23[_0x3ed5('0xa8')]){_0x3368b8=ut[_0x3ed5('0xa9')](_0x794a6d,0xf,_0x3ed5('0xaa'));rpcDb[_0x3ed5('0x9a')](_0x3368b8,_0x3ed5('0xed'));}else{rpcDb[_0x3ed5('0x9a')](_0x794a6d,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0x3ed5('0x18')][_0x9708a7[_0x3ed5('0xb1')]];break;case'19':_0x1f5c23[_0x3ed5('0xee')]+=0x1;_0x794a6d['countglobal']=ut['totalGlobal'](_0x794a6d);ut[_0x3ed5('0x91')](_0x794a6d,0x13,_0x9708a7[_0x3ed5('0xe9')]||_0x9708a7[_0x3ed5('0xea')]);ami[_0x3ed5('0x29')](_0x3ed5('0xeb'),ut[_0x3ed5('0xa5')](_0x794a6d,_0x3ed5('0xec')));rpcDb[_0x3ed5('0x98')](_0x794a6d,_0x3ed5('0xef'));if(ut[_0x3ed5('0xa2')](_0x794a6d)>=_0x1f5c23[_0x3ed5('0xa8')]){_0x3368b8=ut[_0x3ed5('0xa9')](_0x794a6d,0xf,_0x3ed5('0xaa'));rpcDb[_0x3ed5('0x9a')](_0x3368b8,_0x3ed5('0xef'));}else{rpcDb[_0x3ed5('0x9a')](_0x794a6d,_0x3ed5('0xef'));}delete this[_0x3ed5('0x18')][_0x9708a7[_0x3ed5('0xb1')]];break;default:if(_0x794a6d[_0x3ed5('0x76')]){ut[_0x3ed5('0x80')](_0x1f5c23,_0x3ed5('0xf0'));ut[_0x3ed5('0x81')](_0x3ed5('0xf1')+_0x1f5c23[_0x3ed5('0x2c')],_0x9708a7);}_0x1f5c23[_0x3ed5('0xee')]+=0x1;_0x794a6d[_0x3ed5('0xbe')]=ut[_0x3ed5('0xa2')](_0x794a6d);ut['logCustomer'](_0x794a6d,0xc,_0x9708a7['cause-txt']||_0x9708a7[_0x3ed5('0xea')]);rpcDb['createCustomerHistory'](_0x794a6d,'[callProgressDetectingCustomer][logUnknown]');if(ut['totalGlobal'](_0x794a6d)>=_0x1f5c23[_0x3ed5('0xa8')]){_0x3368b8=ut[_0x3ed5('0xa9')](_0x794a6d,0xf,'Global');rpcDb[_0x3ed5('0x9a')](_0x3368b8,_0x3ed5('0xf2'));}else{rpcDb[_0x3ed5('0x9a')](_0x794a6d,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x3ed5('0x18')][_0x9708a7['linkedid']];}if(!(_0x794a6d[_0x3ed5('0x76')]&&_0x19c051==='16')){ut['updateOriginated'](_0x1f5c23,_0x3ed5('0xf3'));logger[_0x3ed5('0x5e')](_0x3ed5('0xf4'),_0x794a6d['uniqueid'],_0x3ed5('0xc2'),_0x1f5c23[_0x3ed5('0x2c')],_0x3ed5('0x74'),_0x1f5c23[_0x3ed5('0x52')]);}if(_0x19c051!=='ANSWER'){delete this[_0x3ed5('0x18')][_0x9708a7[_0x3ed5('0xb1')]];delete this[_0x3ed5('0x18')][_0x9708a7['destlinkedid']];}}};Preview[_0x3ed5('0x12')]['callProgressDetectingAgent']=function(_0x26504d,_0x34fc40,_0x33f020){if(_[_0x3ed5('0xf5')](_0x34fc40)&&_0x3ed5('0xf6')!==typeof _0x34fc40){return;}if(_[_0x3ed5('0xf5')](_0x33f020)&&_0x3ed5('0xf6')!==typeof _0x33f020){return;}switch(_0x33f020[_0x3ed5('0xf7')]){case'0':ut['logAgent'](_0x26504d,0x0,_0x3ed5('0xa3'));rpcDb['createAgentHistory'](_0x26504d,_0x3ed5('0xf8'));break;case'3':ut[_0x3ed5('0xf9')](_0x26504d,0x3,_0x3ed5('0xca'));rpcDb[_0x3ed5('0xfa')](_0x26504d,_0x3ed5('0xfb'));break;case'5':ut[_0x3ed5('0xf9')](_0x26504d,0x5,'Busy');rpcDb[_0x3ed5('0xfa')](_0x26504d,_0x3ed5('0xfc'));break;case'8':ut['logAgent'](_0x26504d,0x8,_0x3ed5('0xd1'));rpcDb[_0x3ed5('0xfa')](_0x26504d,_0x3ed5('0xfd'));break;case'22':ut[_0x3ed5('0xf9')](_0x26504d,0x16,_0x3ed5('0xfe'));rpcDb[_0x3ed5('0xfa')](_0x26504d,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x3ed5('0xf9')](_0x26504d,0xc,_0x33f020[_0x3ed5('0xf7')]);rpcDb[_0x3ed5('0xfa')](_0x26504d,_0x3ed5('0xfd'));}ut[_0x3ed5('0x7e')](_0x34fc40,'[callProgressDetectingAgent]');logger[_0x3ed5('0x5e')]('[originated][decrement][callProgressDetectingAgent]',_0x26504d[_0x3ed5('0xb6')],_0x3ed5('0xc2'),_0x34fc40['name'],'originated:\x20',_0x34fc40[_0x3ed5('0x52')]);delete this[_0x3ed5('0x18')][_0x26504d[_0x3ed5('0xb6')]];};Preview['prototype'][_0x3ed5('0xff')]=function(_0x1c1bf5,_0x539706,_0x3588b5,_0x465bde,_0x3f5c27){var _0xdf9570=this;return new BPromise(function(_0x38d76d,_0x508af4){if(_[_0x3ed5('0x70')](_0x539706)||_[_0x3ed5('0x70')](_0x539706[_0x3ed5('0x100')])||_[_0x3ed5('0x70')](_0x539706[_0x3ed5('0x100')][_0x3ed5('0x101')])||_[_0x3ed5('0x70')](_0x539706[_0x3ed5('0x79')])){_0x508af4(ut[_0x3ed5('0x51')](_0x3ed5('0x102'),_0x465bde,_0x3f5c27));return;}var _0x33c5f5=uuid['v4']();var _0x24c768=_0xdf9570[_0x3ed5('0x16')][_0x539706[_0x3ed5('0x72')][_0x3ed5('0x2c')]];var _0x13cfd8=_0x3588b5?_0xdf9570[_0x3ed5('0x19')][_0x3588b5]['id']:undefined;_0xdf9570[_0x3ed5('0x18')][_0x33c5f5]=new Action(_0x539706,_0x24c768,_0x33c5f5,_0x3588b5,_0x13cfd8);var _0x3b4d5e=_0xdf9570['actions'][_0x33c5f5];_0x3b4d5e[_0x3ed5('0xaf')]=_0x465bde;_0x3b4d5e['activeContact']=_0x3f5c27;_0x3b4d5e[_0x3ed5('0x103')]=_0x3588b5;if(_[_0x3ed5('0x104')](_0x1c1bf5)){_0xdf9570['execCall'](_0x3b4d5e,_0x24c768,_0x539706,_0x3588b5)['then'](function(_0x55044f){logger[_0x3ed5('0x5e')](_0x3ed5('0x105'),_0x3ed5('0x106')+_0x3b4d5e['queue']+_0x3ed5('0x107')+_0x3b4d5e[_0x3ed5('0x108')],JSON[_0x3ed5('0x5a')](_0x55044f));ami['emit'](_0x3ed5('0x109'),ut[_0x3ed5('0xa5')](_0x3b4d5e,_0x3ed5('0x10a'),_0xdf9570[_0x3ed5('0x16')][_0x3b4d5e[_0x3ed5('0x73')]]));_0x38d76d(ut[_0x3ed5('0x51')](_0x3ed5('0x10b')));})[_0x3ed5('0x7d')](function(_0x267b8a){ut[_0x3ed5('0x68')](_0x3ed5('0x10c'),_0x267b8a);_0x508af4(ut[_0x3ed5('0x51')](_0x3ed5('0x10d'),_0x465bde,_0x3f5c27));});}else{_0x24c768['outboundBlacklistCallsDay']+=0x1;ut[_0x3ed5('0x10e')](_0x3b4d5e);rpcDb[_0x3ed5('0x10f')](_0x3b4d5e,_0x3ed5('0x110'));delete _0xdf9570[_0x3ed5('0x18')][_0x33c5f5];_0x508af4(ut[_0x3ed5('0x51')](_0x3ed5('0x111'),_0x465bde,_0x3f5c27));}});};Preview[_0x3ed5('0x12')][_0x3ed5('0x9e')]=function(_0x8e0a8a){return!_[_0x3ed5('0x70')](_0x8e0a8a)&&!_[_0x3ed5('0x70')](_0x8e0a8a[_0x3ed5('0x2c')])&&!_['isNil'](_0x8e0a8a['active'])&&_0x8e0a8a[_0x3ed5('0x58')]&&!_[_0x3ed5('0x70')](this[_0x3ed5('0x112')][util[_0x3ed5('0x5b')](_0x3ed5('0x113'),_0x8e0a8a['name'])])&&!_['isNil'](this[_0x3ed5('0x112')][util[_0x3ed5('0x5b')](_0x3ed5('0x113'),_0x8e0a8a['name'])]['status'])&&(this['trunks'][util[_0x3ed5('0x5b')](_0x3ed5('0x113'),_0x8e0a8a[_0x3ed5('0x2c')])][_0x3ed5('0x7b')]==='reachable'||this[_0x3ed5('0x112')][util[_0x3ed5('0x5b')](_0x3ed5('0x113'),_0x8e0a8a[_0x3ed5('0x2c')])]['status']===_0x3ed5('0x114'));};Preview[_0x3ed5('0x12')][_0x3ed5('0x8c')]=function(_0x25966,_0x233c2e){var _0x25e69a=this;return new BPromise(function(_0x35c929,_0x3be1e8){_0x25e69a['execRun'](_0x25966,_0x233c2e)[_0x3ed5('0x86')](function(_0xed0471){_0x35c929(_[_0x3ed5('0x115')](_0xed0471,['message']));})['catch'](function(_0x35a21b){if(_0x35a21b[_0x3ed5('0x116')]){rpcDb[_0x3ed5('0x117')](_0x25966);}if(_0x35a21b['active']){rpcDb[_0x3ed5('0x8f')](_0x25966);}_0x3be1e8(_[_0x3ed5('0x115')](_0x35a21b,[_0x3ed5('0x51')]));});});};Preview[_0x3ed5('0x12')][_0x3ed5('0x118')]=function(_0x9b11e7,_0x574265){var _0x7b0bea=this;return new BPromise(function(_0x45cc83,_0x5b6823){var _0x130e1f,_0x1bac81;rpcDb[_0x3ed5('0x119')](_0x9b11e7)[_0x3ed5('0x86')](function(_0x5dfd42){if(!_[_0x3ed5('0x70')](_0x5dfd42[0x0])){_0x1bac81=_0x5dfd42[0x0]['recallme']?![]:!![];_0x130e1f=_0x5dfd42[0x0][_0x3ed5('0x11a')]?!![]:![];_0x130e1f=_0x574265?!![]:_0x130e1f;}var _0x4c6f99=_0x7b0bea['validateContact'](_0x5dfd42);if(_0x4c6f99[_0x3ed5('0x11b')]){rpcDb[_0x3ed5('0x11c')](_[_0x3ed5('0x115')](_0x5dfd42[0x0],[_0x3ed5('0x79'),_0x3ed5('0x11d')]))[_0x3ed5('0x86')](function(_0x366e95){_0x7b0bea[_0x3ed5('0xff')](_0x366e95,_0x5dfd42[0x0],_0x574265,_0x1bac81,_0x130e1f)['then'](function(_0x3c710a){_0x45cc83(_0x3c710a);})['catch'](function(_0x212393){_0x5b6823(_0x212393);});})[_0x3ed5('0x7d')](function(_0x6eb446){ut[_0x3ed5('0x68')]('[Preview][checkIsBlackList]',_0x6eb446);_0x5b6823(ut['message']('Call\x20unsuccessful',_0x1bac81,_0x130e1f));});}else{_0x5b6823(ut[_0x3ed5('0x51')](_0x4c6f99[_0x3ed5('0x51')],_0x1bac81,_0x130e1f));}})[_0x3ed5('0x7d')](function(_0x20dd51){ut[_0x3ed5('0x68')](_0x3ed5('0x11e'),_0x20dd51);_0x5b6823(ut[_0x3ed5('0x51')](_0x3ed5('0x11f'),![],!![]));});});};Preview[_0x3ed5('0x12')]['validateContact']=function(_0x2e0ffd){if(_[_0x3ed5('0x70')](_0x2e0ffd)||_[_0x3ed5('0x104')](_0x2e0ffd)||!_[_0x3ed5('0x70')](_0x2e0ffd[0x0]['Agent'])&&_['isNil'](_0x2e0ffd[0x0][_0x3ed5('0x8a')][_0x3ed5('0x2c')])){ut['logger'](_0x3ed5('0x120'),_0x2e0ffd);return{'isValid':![],'message':_0x3ed5('0x121')};}var _0x3bf6e6=this[_0x3ed5('0x16')][_0x2e0ffd[0x0][_0x3ed5('0x72')][_0x3ed5('0x2c')]];_0x3bf6e6[_0x3ed5('0x51')]='ACTIVE';if(_['isNil'](_0x3bf6e6)){ut[_0x3ed5('0x68')](_0x3ed5('0x122'),_0x3bf6e6);return{'isValid':![],'message':_0x3ed5('0x123')};}if(!this[_0x3ed5('0x9e')](_0x3bf6e6['Trunk'])){ut[_0x3ed5('0x68')](_0x3ed5('0x124'),_0x3ed5('0x125')+_0x3bf6e6['name']+'\x20Trunk\x20is\x20not\x20active');if(!this['isTrunkReachable'](_0x3bf6e6[_0x3ed5('0x126')])){ut[_0x3ed5('0x68')](_0x3ed5('0x124'),_0x3bf6e6[_0x3ed5('0x2c')]+_0x3ed5('0x127'));return{'isValid':![],'message':_0x3ed5('0x128')};}}if(!ut[_0x3ed5('0x9d')](_0x3bf6e6[_0x3ed5('0x39')])){ut[_0x3ed5('0x68')](_0x3ed5('0x129'),_0x3bf6e6['name']+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x3bf6e6[_0x3ed5('0x2c')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview['prototype'][_0x3ed5('0x12a')]=function(_0x189f56,_0xeff8e,_0xbef721,_0x1e6426){var _0x75b0bf=this;return new BPromise(function(_0x2e765c,_0x3f6f56){var _0x371b06=_0x189f56[_0x3ed5('0xb6')];var _0x28319b=_0x75b0bf['isTrunkReachable'](_0xeff8e[_0x3ed5('0x57')])?util['format']('SIP/%s/%s%s',_0xeff8e[_0x3ed5('0x57')]['name'],_['isNil'](_0xeff8e[_0x3ed5('0x3e')])?'':_0xeff8e[_0x3ed5('0x3e')][_0x3ed5('0x12b')]()||'',_0xeff8e[_0x3ed5('0x12c')]>0x0?_0xbef721[_0x3ed5('0x100')][_0x3ed5('0x101')][_0x3ed5('0x12d')](_0xeff8e[_0x3ed5('0x12c')]):_0xbef721[_0x3ed5('0x100')][_0x3ed5('0x101')]):util['format'](_0x3ed5('0x12e'),_[_0x3ed5('0x70')](_0xeff8e[_0x3ed5('0x126')])?_0xeff8e[_0x3ed5('0x57')][_0x3ed5('0x2c')]:_0xeff8e[_0x3ed5('0x126')][_0x3ed5('0x2c')],_[_0x3ed5('0x70')](_0xeff8e[_0x3ed5('0x3e')])?'':_0xeff8e['dialPrefix'][_0x3ed5('0x12b')]()||'',_0xeff8e[_0x3ed5('0x12c')]>0x0?_0xbef721['Contact'][_0x3ed5('0x101')][_0x3ed5('0x12d')](_0xeff8e[_0x3ed5('0x12c')]):_0xbef721[_0x3ed5('0x100')][_0x3ed5('0x101')]);var _0x23110b=_0x75b0bf[_0x3ed5('0x9e')](_0xeff8e[_0x3ed5('0x57')])?ut[_0x3ed5('0x12f')](_0xeff8e[_0x3ed5('0x57')][_0x3ed5('0x130')],_0xeff8e[_0x3ed5('0x3b')],_0xeff8e[_0x3ed5('0x131')]>0x0?ut['getCallerIdRandom'](_0xeff8e[_0x3ed5('0x3c')],_0xeff8e[_0x3ed5('0x131')]):_0xeff8e['dialOriginateCallerIdNumber']):ut['getCallerId'](_['isNil'](_0xeff8e[_0x3ed5('0x126')])?_0xeff8e['Trunk'][_0x3ed5('0x130')]:_0xeff8e[_0x3ed5('0x126')][_0x3ed5('0x130')],_0xeff8e['dialOriginateCallerIdName'],_0xeff8e[_0x3ed5('0x131')]>0x0?ut[_0x3ed5('0x132')](_0xeff8e[_0x3ed5('0x3c')],_0xeff8e['dialRandomLastDigitCallerIdNumber']):_0xeff8e[_0x3ed5('0x3c')]);if(_0x23110b){_0x189f56[_0x3ed5('0x133')]=ut['extractCalleridName'](_0x23110b);_0x189f56['originatecalleridnum']=ut[_0x3ed5('0x134')](_0x23110b);}var _0x46d70d=ut[_0x3ed5('0x135')](_0xeff8e,_0xbef721,_0x28319b,_0x23110b,_0x371b06,_0x189f56);_[_0x3ed5('0x136')](_0x189f56,ut['toLowerVariables'](_0x46d70d));_0x189f56[_0x3ed5('0x137')]=moment()[_0x3ed5('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x3ed5('0x138')](ut[_0x3ed5('0x139')](_0x189f56,_0xeff8e,_0x46d70d,_0x189f56[_0x3ed5('0xb0')],_0x1e6426))[_0x3ed5('0x86')](function(_0x144719){var _0x51984e=_0x189f56['channelAgent'];if(!_[_0x3ed5('0x70')](_0x51984e)){if(!_[_0x3ed5('0x70')](_0x75b0bf[_0x3ed5('0x19')][_0x51984e])){_0x75b0bf[_0x3ed5('0x19')][_0x51984e][_0x3ed5('0x13a')]=_0x189f56['calleridnum'];emit(util[_0x3ed5('0x5b')](_0x3ed5('0x13b'),_0x75b0bf['agents'][_0x51984e][_0x3ed5('0x2c')]),'user:agentconnect',{'destaccountcode':_0x75b0bf['agents'][_0x51984e][_0x3ed5('0x13c')],'destconnectedlinenum':_0x189f56['calleridnum']});}}_0xeff8e[_0x3ed5('0x52')]+=0x1;logger[_0x3ed5('0x5e')](_0x3ed5('0x13d'),_0x371b06,_0x3ed5('0xc2'),_0xeff8e[_0x3ed5('0x2c')],_0x3ed5('0x74'),_0xeff8e[_0x3ed5('0x52')]);_0x2e765c(_0x144719);})[_0x3ed5('0x7d')](function(_0x4726af){ut[_0x3ed5('0xf9')](_0x189f56,0xe,_0x3ed5('0x13e'));rpcDb['createAgentHistory'](_0x189f56,_0x3ed5('0x13f'));_0x3f6f56(_0x4726af);});});};Preview[_0x3ed5('0x12')][_0x3ed5('0x24')]=function(_0xe0fa6b){if(this[_0x3ed5('0x18')][_0xe0fa6b[_0x3ed5('0xb1')]]){this['actions'][_0xe0fa6b[_0x3ed5('0xb1')]][_0x3ed5('0x7c')]=_0xe0fa6b[_0x3ed5('0x7c')];}};Preview['prototype'][_0x3ed5('0x1c')]=function(_0x563acd){var _0x593731=this;var _0x3299ed=this[_0x3ed5('0x18')][_0x563acd[_0x3ed5('0x140')]];if(_0x3299ed){if(_0x3299ed[_0x3ed5('0x103')]&&this['agents'][_0x3299ed['lookAgent']]){ut[_0x3ed5('0x141')](_0x3299ed,this[_0x3ed5('0x19')][_0x3299ed[_0x3ed5('0x103')]][_0x3ed5('0x2c')],this[_0x3ed5('0x19')][_0x3299ed[_0x3ed5('0x103')]]['id']);}var _0x1c3cda=_[_0x3ed5('0x142')](_0x3299ed);_0x1c3cda['responsetime']=moment()[_0x3ed5('0x5b')](_0x3ed5('0x90'));var _0x1df1bd=_0x593731[_0x3ed5('0x16')][_0x3299ed['queue']];if(ut[_0x3ed5('0x143')](_0x563acd['response'])){if(_0x3299ed[_0x3ed5('0xaf')]){rpcDb[_0x3ed5('0x117')](_0x3299ed[_0x3ed5('0x108')]);}if(_0x3299ed[_0x3ed5('0xb0')]){rpcDb[_0x3ed5('0x8f')](_0x3299ed['idContact']);}ami[_0x3ed5('0x29')](_0x3ed5('0x144'),ut[_0x3ed5('0xa5')](_0x3299ed,_0x3ed5('0x145'),this[_0x3ed5('0x16')][_0x3299ed[_0x3ed5('0x73')]]));this[_0x3ed5('0x146')](_0x1c3cda,_0x1df1bd,_0x563acd);}else{_0x3299ed['starttime']=moment()['format'](_0x3ed5('0x90'));ut[_0x3ed5('0xf9')](_0x1c3cda,0x4,_0x3ed5('0x147'));rpcDb[_0x3ed5('0xfa')](_0x1c3cda,_0x3ed5('0x148'));}}};Preview['prototype'][_0x3ed5('0x1f')]=function(_0x534d2e){var _0x5d896e=this;var _0x83398d=this['actions'][_0x534d2e[_0x3ed5('0xb1')]];var _0x7798a0;if(_0x83398d){_0x7798a0=this['campaignsPreview'][_0x83398d[_0x3ed5('0x73')]];logger[_0x3ed5('0x5e')]('[syncHangup][talking]',_0x534d2e['linkedid'],_0x3ed5('0xc2'),_0x7798a0[_0x3ed5('0x2c')],'pTalking:\x20',_0x7798a0['pTalking']);}if(this[_0x3ed5('0x18')][_0x534d2e[_0x3ed5('0xb1')]]&&_0x534d2e[_0x3ed5('0xb1')]!==_0x534d2e[_0x3ed5('0xb6')]){if(_0x534d2e[_0x3ed5('0x149')]==='16'&&this[_0x3ed5('0x18')][_0x534d2e[_0x3ed5('0xb1')]]['dialAnswer']){this[_0x3ed5('0xa0')](_0x534d2e,_0x534d2e['linkedid'],_0x534d2e[_0x3ed5('0x149')]);}else if(this[_0x3ed5('0x18')][_0x534d2e[_0x3ed5('0xb1')]][_0x3ed5('0x76')]){logger[_0x3ed5('0x5e')](_0x3ed5('0x14a'),_0x534d2e[_0x3ed5('0xb1')],_0x534d2e[_0x3ed5('0x149')],_0x3ed5('0xc2'),_0x7798a0['name'],_0x3ed5('0x75'),_0x7798a0[_0x3ed5('0x30')]);this[_0x3ed5('0xa0')](_0x534d2e,_0x534d2e[_0x3ed5('0xb1')],_0x534d2e[_0x3ed5('0x149')]);}}else if(_0x83398d&&_['isNil'](_0x83398d[_0x3ed5('0x14b')])&&_0x7798a0[_0x3ed5('0x14c')]&&_0x534d2e['linkedid']===_0x534d2e[_0x3ed5('0xb6')]&&_[_0x3ed5('0x70')](_0x534d2e['reason'])&&_0x534d2e['cause']==='16'&&_0x534d2e[_0x3ed5('0x14d')]==='6'&&_[_0x3ed5('0xf5')](_0x83398d[_0x3ed5('0x14e')])){if(_0x83398d[_0x3ed5('0xaf')]){rpcDb[_0x3ed5('0x117')](_0x83398d[_0x3ed5('0x108')]);}if(_0x83398d['activeContact']){rpcDb[_0x3ed5('0x8f')](_0x83398d[_0x3ed5('0x108')]);}_0x534d2e['reason']='22';this[_0x3ed5('0x146')](_0x83398d,_0x7798a0,_0x534d2e);}else if(_0x83398d&&_0x83398d[_0x3ed5('0x14e')]){if(_0x534d2e['cause']==='16'&&this[_0x3ed5('0x18')][_0x534d2e[_0x3ed5('0xb1')]][_0x3ed5('0x76')]){logger[_0x3ed5('0x5e')]('[syncHangup][talking][transfer]',_0x534d2e[_0x3ed5('0xb1')],_0x534d2e['cause'],_0x3ed5('0xc2'),_0x7798a0[_0x3ed5('0x2c')],_0x3ed5('0x75'),_0x7798a0[_0x3ed5('0x30')]);this[_0x3ed5('0xa0')](_0x534d2e,_0x534d2e[_0x3ed5('0xb1')],_0x534d2e['cause']);}else if(this['actions'][_0x534d2e[_0x3ed5('0xb1')]]['dialAnswer']){logger[_0x3ed5('0x5e')](_0x3ed5('0x14a'),_0x534d2e['linkedid'],_0x534d2e[_0x3ed5('0x149')],_0x3ed5('0xc2'),_0x7798a0[_0x3ed5('0x2c')],_0x3ed5('0x75'),_0x7798a0['pTalking']);this[_0x3ed5('0xa0')](_0x534d2e,_0x534d2e[_0x3ed5('0xb1')],_0x534d2e['cause']);}}};Preview['prototype'][_0x3ed5('0x22')]=function(_0x8762c){if(this[_0x3ed5('0x18')][_0x8762c[_0x3ed5('0x14f')]]&&_0x8762c[_0x3ed5('0x14f')]!==_0x8762c['destuniqueid']){this['callProgressDetectingCustomer'](_0x8762c,_0x8762c[_0x3ed5('0x14f')],_0x8762c['dialstatus']);}};Preview[_0x3ed5('0x12')][_0x3ed5('0x21')]=function(_0x1d3ce0){if(this['actions'][_0x1d3ce0[_0x3ed5('0xb1')]]&&_0x1d3ce0[_0x3ed5('0xb1')]!==_0x1d3ce0[_0x3ed5('0xb6')]&&!this[_0x3ed5('0x18')][_0x1d3ce0['linkedid']][_0x3ed5('0x76')]){if(_0x1d3ce0[_0x3ed5('0x149')]==='1'){this[_0x3ed5('0xa0')](_0x1d3ce0,_0x1d3ce0[_0x3ed5('0xb1')],_0x1d3ce0['cause']);}}};Preview[_0x3ed5('0x12')][_0x3ed5('0x150')]=function(_0x17504d,_0x27b122,_0x172c6a){if(this[_0x3ed5('0x18')][_0x17504d]){if(_[_0x3ed5('0x70')](this[_0x3ed5('0x18')][_0x17504d]['variables'])){this['actions'][_0x17504d]['variables']={};}this[_0x3ed5('0x18')][_0x17504d][_0x3ed5('0x151')][_0x27b122]=_0x172c6a;}};Preview[_0x3ed5('0x12')][_0x3ed5('0x26')]=function(_0x2667b8){try{if(!_['isNil'](_0x2667b8)){if(ut[_0x3ed5('0x152')](_[_0x3ed5('0x153')](_0x2667b8['variable'])[0x0])){this[_0x3ed5('0x150')](_0x2667b8[_0x3ed5('0xb6')],_['keys'](_0x2667b8[_0x3ed5('0x154')])[0x0],_0x2667b8[_0x3ed5('0x155')]);}}}catch(_0x5cbc54){logger['error'](_0x3ed5('0x156'),util[_0x3ed5('0x157')](_0x5cbc54,{'showHidden':![],'depth':null}));}};Preview[_0x3ed5('0x12')][_0x3ed5('0x158')]=function(_0x51b721){if(_0x51b721){if(this[_0x3ed5('0x18')][_0x51b721[_0x3ed5('0x159')]]){this[_0x3ed5('0x18')][_0x51b721[_0x3ed5('0x159')]][_0x3ed5('0x14e')]=!![];}}};Preview[_0x3ed5('0x12')][_0x3ed5('0x27')]=function(_0x2ebec7){if(_0x2ebec7){if(this[_0x3ed5('0x18')][_0x2ebec7[_0x3ed5('0x15a')]]){this[_0x3ed5('0x18')][_0x2ebec7[_0x3ed5('0x15a')]]['transfer']=!![];}}};module[_0x3ed5('0x15b')]=Preview; \ No newline at end of file +var _0xa5ff=['countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countmachineretry','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','dialstatus','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','disableContact','execRun','recallme','validateContact','checkIsBlackList','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','Agent','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','Contact','substring','phone','callerid','dialRandomLastDigitCallerIdNumber','getCallerId','getCallerIdRandom','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','variablesAction','channelAgent','destconnectedlinenum','calleridnum','user:agentconnect','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','channel','actionid','logLookAgent','clone','responsetime','isFailure','response','unlockContact','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','reason','transfer','[syncHangup][talking][transfer]','destuniqueid','variables','filterKey','keys','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./action','redis','defaults','localhost','socket.io-emitter','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','answered','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','sendMessageOneNotActive','available','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','logger','prototype','syncCampaigns','hasOwnProperty','clearZombieChannels','setMessage','clearZombieChannel','isNil','Queue','queue','originated','pTalking:\x20','dialAnswer','pick','contactId','VoiceQueueId','ListId','Action','catch','No\x20such\x20channel','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','recallMe','getContactRecallMe','then','length','getDiff','scheduledat','dialRecallMeTimeout','voicePause','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','[getContactRecallMe]','AGENTS_NOT_LOGGED','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','rescheduleContact','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','sumBillable','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','scheduledAt','dialBusyRetryFrequency','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED'];(function(_0x267d8d,_0xe90f65){var _0x11a98f=function(_0x5703c9){while(--_0x5703c9){_0x267d8d['push'](_0x267d8d['shift']());}};_0x11a98f(++_0xe90f65);}(_0xa5ff,0x1d1));var _0xfa5f=function(_0x65f90,_0x10b401){_0x65f90=_0x65f90-0x0;var _0x8a5833=_0xa5ff[_0x65f90];return _0x8a5833;};'use strict';var util=require(_0xfa5f('0x0'));var _=require(_0xfa5f('0x1'));var BPromise=require(_0xfa5f('0x2'));var uuid=require(_0xfa5f('0x3'));var moment=require(_0xfa5f('0x4'));var md5=require(_0xfa5f('0x5'));var Redis=require(_0xfa5f('0x6'));var config=require(_0xfa5f('0x7'));var logger=require(_0xfa5f('0x8'))(_0xfa5f('0x9'));var loggerAction=require('../../../config/logger')(_0xfa5f('0xa'));var ami=require(_0xfa5f('0xb'));var rpcDb=require('./rpcDb');var Action=require(_0xfa5f('0xc'));var ut=require('./util/util');config[_0xfa5f('0xd')]=_[_0xfa5f('0xe')](config[_0xfa5f('0xd')],{'host':_0xfa5f('0xf'),'port':0x18eb});var io=require(_0xfa5f('0x10'))(new Redis(config[_0xfa5f('0xd')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x4f2ae7){this[_0xfa5f('0x11')]=this[_0xfa5f('0x11')]?this[_0xfa5f('0x11')][_0xfa5f('0x12')](_0x4f2ae7):_0x4f2ae7();};function Preview(_0x6ef235){this[_0xfa5f('0x13')]=new Sequence();this[_0xfa5f('0x14')]=_0x6ef235[_0xfa5f('0x15')];this[_0xfa5f('0x16')]=_0x6ef235[_0xfa5f('0x16')];this[_0xfa5f('0x17')]={};this[_0xfa5f('0x18')]=_0x6ef235['agents'];this[_0xfa5f('0x19')]=0x0;ami['on'](_0xfa5f('0x1a'),this[_0xfa5f('0x1b')][_0xfa5f('0x1c')](this));ami['on'](_0xfa5f('0x1d'),this[_0xfa5f('0x1e')]['bind'](this));ami['on'](_0xfa5f('0x1f'),this[_0xfa5f('0x20')]['bind'](this));ami['on'](_0xfa5f('0x21'),this[_0xfa5f('0x22')][_0xfa5f('0x1c')](this));ami['on'](_0xfa5f('0x23'),this[_0xfa5f('0x24')]['bind'](this));ami['on'](_0xfa5f('0x25'),this[_0xfa5f('0x26')][_0xfa5f('0x1c')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on']('blindtransfer',this[_0xfa5f('0x27')][_0xfa5f('0x1c')](this));this[_0xfa5f('0x28')](this[_0xfa5f('0x14')]);}function emit(_0x12390f,_0x40372f,_0x4b1058){io['to'](_0x12390f)[_0xfa5f('0x29')](_0x40372f,_0x4b1058);}function emitCampaignPreview(_0x5ce540){if(_0x5ce540[_0xfa5f('0x2a')]===_0xfa5f('0x2b')){var _0x3ba6e6={'id':_0x5ce540['id'],'name':_0x5ce540[_0xfa5f('0x2c')],'strategy':_0x5ce540['strategy'],'answered':_0x5ce540[_0xfa5f('0x2d')],'available':_0x5ce540['available'],'loggedIn':_0x5ce540[_0xfa5f('0x2e')],'pTalking':_0x5ce540[_0xfa5f('0x2f')],'sumBillable':_0x5ce540['sumBillable'],'sumDuration':_0x5ce540[_0xfa5f('0x30')],'sumHoldTime':_0x5ce540[_0xfa5f('0x31')]||0x0,'talking':_0x5ce540[_0xfa5f('0x32')],'total':_0x5ce540[_0xfa5f('0x33')],'type':_0x5ce540[_0xfa5f('0x2a')],'unmanaged':_0x5ce540[_0xfa5f('0x34')],'abandoned':_0x5ce540[_0xfa5f('0x35')],'waiting':_0x5ce540[_0xfa5f('0x36')],'loggedInDb':_0x5ce540['loggedInDb'],'dialActive':_0x5ce540[_0xfa5f('0x37')],'dialMethod':_0x5ce540[_0xfa5f('0x38')],'dialOriginateCallerIdName':_0x5ce540[_0xfa5f('0x39')],'dialOriginateCallerIdNumber':_0x5ce540[_0xfa5f('0x3a')],'dialOriginateTimeout':_0x5ce540['dialOriginateTimeout'],'dialPrefix':_0x5ce540[_0xfa5f('0x3b')],'outboundAnswerAgiCallsDay':_0x5ce540[_0xfa5f('0x3c')],'outboundAnswerCallsDay':_0x5ce540[_0xfa5f('0x3d')],'outboundBlacklistCallsDay':_0x5ce540[_0xfa5f('0x3e')],'outboundBusyCallsDay':_0x5ce540[_0xfa5f('0x3f')],'outboundCongestionCallsDay':_0x5ce540[_0xfa5f('0x40')],'outboundDropCallsDayACS':_0x5ce540['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x5ce540[_0xfa5f('0x41')],'outboundDropCallsDayTimeout':_0x5ce540['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x5ce540['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x5ce540[_0xfa5f('0x42')],'outboundOriginateFailureCallsDay':_0x5ce540[_0xfa5f('0x43')],'outboundReCallsDay':_0x5ce540[_0xfa5f('0x44')],'outboundRejectCallsDay':_0x5ce540[_0xfa5f('0x45')],'outboundUnknownCallsDay':_0x5ce540[_0xfa5f('0x46')],'outboundAbandonedCallsDay':_0x5ce540[_0xfa5f('0x47')],'predictiveIntervalAnsweredCalls':_0x5ce540['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x5ce540[_0xfa5f('0x48')],'predictiveIntervalAvgTalktime':_0x5ce540[_0xfa5f('0x49')],'predictiveIntervalDroppedCallsCallersExit':_0x5ce540[_0xfa5f('0x4a')],'predictiveIntervalDroppedCallsTimeout':_0x5ce540[_0xfa5f('0x4b')],'predictiveIntervalErlangCalls':_0x5ce540[_0xfa5f('0x4c')],'predictiveIntervalErlangCallsDroppedCalls':_0x5ce540[_0xfa5f('0x4d')],'predictiveIntervalHitRate':_0x5ce540[_0xfa5f('0x4e')],'predictiveIntervalMultiplicativeFactor':_0x5ce540[_0xfa5f('0x4f')],'predictiveIntervalPauses':_0x5ce540[_0xfa5f('0x50')],'predictiveIntervalAvailable':_0x5ce540['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x5ce540[_0xfa5f('0x51')],'message':_0x5ce540[_0xfa5f('0x52')],'originated':_0x5ce540['originated'],'erlangCalls':_0x5ce540['erlangCalls'],'erlangCallToSecond':_0x5ce540[_0xfa5f('0x53')],'erlangAbandonmentRate':_0x5ce540[_0xfa5f('0x54')],'erlangBusyFactor':_0x5ce540[_0xfa5f('0x55')],'startPredictive':_0x5ce540[_0xfa5f('0x56')],'startProgressive':_0x5ce540[_0xfa5f('0x57')]};if(_0x5ce540[_0xfa5f('0x58')]){_0x3ba6e6[_0xfa5f('0x58')]={'id':_0x5ce540[_0xfa5f('0x58')]['id'],'name':_0x5ce540[_0xfa5f('0x58')]['name'],'active':_0x5ce540[_0xfa5f('0x58')][_0xfa5f('0x59')],'callerid':_0x5ce540[_0xfa5f('0x58')]['callerid']};}if(_0x5ce540['Interval']){_0x3ba6e6[_0xfa5f('0x5a')]={'id':_0x5ce540[_0xfa5f('0x5a')]['id'],'name':_0x5ce540[_0xfa5f('0x5a')][_0xfa5f('0x2c')]};}var _0x3b3efb=md5(JSON[_0xfa5f('0x5b')](_0x3ba6e6));if(_0x5ce540[_0xfa5f('0x5')]!==_0x3b3efb){_0x5ce540[_0xfa5f('0x5')]=_0x3b3efb;emit(util[_0xfa5f('0x5c')](_0xfa5f('0x5d'),_0x3ba6e6[_0xfa5f('0x2c')]),_0xfa5f('0x5e'),_0x3ba6e6);}}}function emitVoiceQueueChannelRemove(_0x463997){logger[_0xfa5f('0x5f')](_0xfa5f('0x60'),JSON[_0xfa5f('0x5b')](_0x463997));emit(util['format'](_0xfa5f('0x5d'),_0x463997[_0xfa5f('0x2c')]),_0xfa5f('0x61'),_0x463997);io[_0xfa5f('0x29')]('voice_queue_presence:remove',_0x463997);}function notSendMessagesQueue(_0x56ef52){if(_0x56ef52[_0xfa5f('0x62')]){if(_0x56ef52['originated']===0x0&&_0x56ef52[_0xfa5f('0x2f')]===0x0){_0x56ef52['sendMessageOneNotActive']=![];_0x56ef52[_0xfa5f('0x63')]=0x0;_0x56ef52[_0xfa5f('0x64')]=0x0;_0x56ef52[_0xfa5f('0x52')]=_0xfa5f('0x65');ut['logger'](_0xfa5f('0x66'),_0x56ef52['name']+_0xfa5f('0x67'));}else{_0x56ef52[_0xfa5f('0x52')]=_0xfa5f('0x68');ut[_0xfa5f('0x69')](_0xfa5f('0x66'),_0x56ef52[_0xfa5f('0x2c')]+'\x20is\x20disactive');}emitCampaignPreview(_0x56ef52);}}Preview[_0xfa5f('0x6a')][_0xfa5f('0x28')]=function(){var _0x4bfa1d=this;setInterval(function(){_0x4bfa1d[_0xfa5f('0x6b')]();},0x7cf);};Preview[_0xfa5f('0x6a')][_0xfa5f('0x6b')]=function(){var _0x5e121a=this['campaignsPreview'];this[_0xfa5f('0x19')]+=0x1;for(var _0x151143 in _0x5e121a){if(_0x5e121a[_0xfa5f('0x6c')](_0x151143)&&(_0x5e121a[_0x151143][_0xfa5f('0x38')]===_0xfa5f('0x9')||_0x5e121a[_0x151143]['dialMethod']==='booked')&&_0x5e121a[_0x151143][_0xfa5f('0x2a')]===_0xfa5f('0x2b')){if(this['clockClearZombieChannels']>0x7){this[_0xfa5f('0x19')]=0x0;this[_0xfa5f('0x6d')]();}}if(_0x5e121a[_0xfa5f('0x6c')](_0x151143)&&_0x5e121a[_0x151143][_0xfa5f('0x38')]===_0xfa5f('0x9')&&_0x5e121a[_0x151143]['type']===_0xfa5f('0x2b')){if(_0x5e121a[_0x151143][_0xfa5f('0x37')]){this[_0xfa5f('0x6e')](_0x5e121a[_0x151143]);this['recallMe'](_0x5e121a[_0x151143]);}else{notSendMessagesQueue(_0x5e121a[_0x151143]);}}}};Preview[_0xfa5f('0x6a')][_0xfa5f('0x6f')]=function(_0x45e809){var _0x29bb9e=this;this[_0xfa5f('0x13')]['enqueue'](function(){if(!_[_0xfa5f('0x70')](_0x29bb9e[_0xfa5f('0x17')][_0x45e809])){loggerAction['info']('[clearZombieChannels][talking]',_0x45e809,_0xfa5f('0x71'),_0x29bb9e[_0xfa5f('0x17')][_0x45e809][_0xfa5f('0x72')],'originated:\x20',JSON[_0xfa5f('0x5b')](_0x29bb9e['campaignsPreview'][_0x29bb9e[_0xfa5f('0x17')][_0x45e809]['queue']][_0xfa5f('0x73')]),_0xfa5f('0x74'),JSON[_0xfa5f('0x5b')](_0x29bb9e['campaignsPreview'][_0x29bb9e['actions'][_0x45e809][_0xfa5f('0x72')]][_0xfa5f('0x2f')]),JSON[_0xfa5f('0x5b')](_0x29bb9e['actions'][_0x45e809][_0xfa5f('0x75')]),JSON[_0xfa5f('0x5b')](_[_0xfa5f('0x76')](_0x29bb9e[_0xfa5f('0x17')][_0x45e809],[_0xfa5f('0x77'),'UserId',_0xfa5f('0x78'),_0xfa5f('0x79')])));return ami[_0xfa5f('0x7a')]({'action':'status','channel':_0x29bb9e[_0xfa5f('0x17')][_0x45e809]['channel']})[_0xfa5f('0x7b')](function(_0x12a383){if(_0x12a383[_0xfa5f('0x52')]===_0xfa5f('0x7c')){setTimeout(function(){if(_0x29bb9e[_0xfa5f('0x17')][_0x45e809]){ut['updateOriginated'](_0x29bb9e['campaignsPreview'][_0x29bb9e[_0xfa5f('0x17')][_0x45e809]['queue']],'[clearZombieChannel]');if(_0x29bb9e[_0xfa5f('0x17')][_0x45e809][_0xfa5f('0x75')]===!![]){ut[_0xfa5f('0x7d')](_0x29bb9e[_0xfa5f('0x14')][_0x29bb9e['actions'][_0x45e809][_0xfa5f('0x72')]],_0xfa5f('0x7e'));ut[_0xfa5f('0x7f')](_0xfa5f('0x80')+_0x45e809,_0x29bb9e[_0xfa5f('0x17')][_0x45e809][_0xfa5f('0x72')]);}ut['loggerError'](_0xfa5f('0x81')+_0x45e809,_0x29bb9e[_0xfa5f('0x17')][_0x45e809]['queue']);delete _0x29bb9e['actions'][_0x45e809];}},0x2328);}});}});};Preview[_0xfa5f('0x6a')][_0xfa5f('0x6d')]=function(){var _0x53c37d=this;loggerAction[_0xfa5f('0x5f')](_0xfa5f('0x82'),_[_0xfa5f('0x83')](this[_0xfa5f('0x17')]));for(var _0x2ed7af in this[_0xfa5f('0x17')]){if(_0x53c37d[_0xfa5f('0x17')][_0xfa5f('0x6c')](_0x2ed7af)){_0x53c37d[_0xfa5f('0x6f')](_0x2ed7af);}}};Preview[_0xfa5f('0x6a')][_0xfa5f('0x84')]=function(_0x5ed0c9){var _0x108f07=this;rpcDb[_0xfa5f('0x85')](_0x5ed0c9['id'],ut['agentReadyId'](this[_0xfa5f('0x18')]))[_0xfa5f('0x86')](function(_0x253f32){if(!_[_0xfa5f('0x70')](_0x253f32)){for(var _0x549955=0x0;_0x549955<_0x253f32[_0xfa5f('0x87')];_0x549955+=0x1){if(ut[_0xfa5f('0x88')](_0x253f32[_0x549955][_0xfa5f('0x89')])<_0x5ed0c9[_0xfa5f('0x8a')]*0x3c){if(_0x253f32[_0x549955]['Agent']&&!_0x253f32[_0x549955]['Agent'][_0xfa5f('0x8b')]){_0x108f07[_0xfa5f('0x8c')](_0x253f32[_0x549955]['id'])['then'](ut[_0xfa5f('0x8d')]('[RecallMe]'))['catch'](ut[_0xfa5f('0x8d')](_0xfa5f('0x8e')));}else{rpcDb['disableContact'](_0x253f32[_0x549955]['id']);}}else{var _0x521dc2=new Action(_0x253f32[_0x549955],_0x5ed0c9);_0x521dc2[_0xfa5f('0x8f')]=moment()['format'](_0xfa5f('0x90'));_0x5ed0c9[_0xfa5f('0x44')]+=0x1;ut[_0xfa5f('0x91')](_0x521dc2,0x17,_0xfa5f('0x92'));if(_0x5ed0c9[_0xfa5f('0x93')]){rpcDb['rescheduleContactInQueue'](ut[_0xfa5f('0x94')](_0x253f32[_0x549955]));rpcDb[_0xfa5f('0x95')](_0x521dc2,_0xfa5f('0x96'));}else{ut[_0xfa5f('0x91')](_0x521dc2,0x16,_0xfa5f('0x97'));rpcDb[_0xfa5f('0x95')](_0x521dc2,'[HistoryRecallClose]');rpcDb[_0xfa5f('0x98')](_0x521dc2,'[HistoryRecallClose]');}}}}})[_0xfa5f('0x7b')](ut[_0xfa5f('0x8d')](_0xfa5f('0x99')));};Preview[_0xfa5f('0x6a')][_0xfa5f('0x6e')]=function(_0x3e717b){_0x3e717b[_0xfa5f('0x62')]=!![];if(ut['IsNotLoggedIn'](_0x3e717b['loggedIn'])){_0x3e717b['message']=_0xfa5f('0x9a');}else if(!ut['isActive'](_0x3e717b[_0xfa5f('0x37')])){_0x3e717b['message']=_0xfa5f('0x65');}else if(!this[_0xfa5f('0x9b')](_0x3e717b['Trunk'])){if(!this['isTrunkReachable'](_0x3e717b['TrunkBackup'])){_0x3e717b['message']=_0xfa5f('0x9c');}else{_0x3e717b[_0xfa5f('0x52')]=_0xfa5f('0x9d');}}else{_0x3e717b['message']=_0xfa5f('0x9d');}emitCampaignPreview(_0x3e717b);};Preview[_0xfa5f('0x6a')][_0xfa5f('0x9e')]=function(_0x398709,_0x391f92,_0x1213fe){var _0x1b6039=this;var _0x3d4c16=this[_0xfa5f('0x17')][_0x391f92];var _0x2e4a04=this['campaignsPreview'][_0x3d4c16[_0xfa5f('0x72')]];var _0x36f51c;if(_0x2e4a04){switch(_0x1213fe){case'1':_0x2e4a04['outboundNoSuchCallsDay']+=0x1;_0x3d4c16['countnosuchnumberretry']+=0x1;_0x3d4c16[_0xfa5f('0x9f')]=ut[_0xfa5f('0xa0')](_0x3d4c16);ut['logCustomer'](_0x3d4c16,0x0,_0xfa5f('0xa1'));ami[_0xfa5f('0x29')](_0xfa5f('0xa2'),ut[_0xfa5f('0xa3')](_0x3d4c16,_0xfa5f('0xa4')));rpcDb[_0xfa5f('0x95')](_0x3d4c16,_0xfa5f('0xa5'));if(ut[_0xfa5f('0xa0')](_0x3d4c16)>=_0x2e4a04[_0xfa5f('0xa6')]){_0x36f51c=ut[_0xfa5f('0xa7')](_0x3d4c16,0xf,_0xfa5f('0xa8'));rpcDb[_0xfa5f('0x98')](_0x36f51c,_0xfa5f('0xa9'));}else{if(_0x3d4c16[_0xfa5f('0xaa')]>=_0x2e4a04['dialNoSuchNumberMaxRetry']){rpcDb[_0xfa5f('0x98')](_0x3d4c16,_0xfa5f('0xa9'));}else{rpcDb[_0xfa5f('0xab')](ut['scheduledAt'](_0x3d4c16,'countnosuchnumberretry',_0x2e4a04[_0xfa5f('0xac')]),_0x3d4c16[_0xfa5f('0xad')],_0x3d4c16[_0xfa5f('0xae')]);}}delete this[_0xfa5f('0x17')][_0x398709[_0xfa5f('0xaf')]];break;case _0xfa5f('0xb0'):var _0x225e61=moment()[_0xfa5f('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x3d4c16['responsetime']=_0x225e61;_0x3d4c16[_0xfa5f('0xb1')]=_0x225e61;_0x3d4c16[_0xfa5f('0x75')]=!![];_0x2e4a04[_0xfa5f('0x2f')]+=0x1;logger[_0xfa5f('0x5f')](_0xfa5f('0xb2'),_0x3d4c16[_0xfa5f('0xb3')],_0xfa5f('0xb4'),_0x2e4a04['name'],_0xfa5f('0x74'),_0x2e4a04['pTalking']);ami[_0xfa5f('0x29')](_0xfa5f('0xb5'),ut[_0xfa5f('0xa3')](_0x3d4c16,_0xfa5f('0xb6'),this[_0xfa5f('0x14')][_0x3d4c16[_0xfa5f('0x72')]]));if(_0x2e4a04[_0xfa5f('0xb7')]){ami[_0xfa5f('0x29')](_0xfa5f('0xb8'),ut[_0xfa5f('0xb9')](_0x3d4c16));}break;case'16':ami[_0xfa5f('0x29')]('custom:agentcomplete',ut['buildObj'](_0x3d4c16,_0xfa5f('0xba'),this[_0xfa5f('0x14')][_0x3d4c16[_0xfa5f('0x72')]]));emitVoiceQueueChannelRemove(ut[_0xfa5f('0xa3')](_0x3d4c16,_0xfa5f('0xba')));_0x2e4a04['outboundAnswerCallsDay']+=0x1;_0x2e4a04[_0xfa5f('0x33')]+=0x1;_0x2e4a04['answered']+=0x1;ut[_0xfa5f('0x7d')](_0x2e4a04,_0xfa5f('0xbb'));_0x3d4c16[_0xfa5f('0x9f')]=ut['totalGlobal'](_0x3d4c16);ut[_0xfa5f('0x91')](_0x3d4c16,0x4,_0xfa5f('0xbc'));rpcDb[_0xfa5f('0x95')](_0x3d4c16,_0xfa5f('0xbd'));rpcDb[_0xfa5f('0x98')](_0x3d4c16,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xfa5f('0xbe')](_0x3d4c16);_0x2e4a04[_0xfa5f('0x30')]+=_0x3d4c16[_0xfa5f('0xbf')];_0x2e4a04[_0xfa5f('0xc0')]+=_0x3d4c16[_0xfa5f('0xbf')];logger[_0xfa5f('0x5f')](_0xfa5f('0xc1'),_0x3d4c16['uniqueid'],_0xfa5f('0xb4'),_0x2e4a04['name'],'pTalking:\x20',_0x2e4a04[_0xfa5f('0x2f')]);delete this[_0xfa5f('0x17')][_0x398709['linkedid']];break;case _0xfa5f('0xc2'):_0x2e4a04[_0xfa5f('0x3f')]+=0x1;_0x3d4c16[_0xfa5f('0xc3')]+=0x1;_0x3d4c16[_0xfa5f('0x9f')]=ut[_0xfa5f('0xa0')](_0x3d4c16);ut[_0xfa5f('0x91')](_0x3d4c16,0x5,_0xfa5f('0xc4'));ami['emit'](_0xfa5f('0xc5'),ut[_0xfa5f('0xa3')](_0x3d4c16,_0xfa5f('0xc6')));rpcDb[_0xfa5f('0x95')](_0x3d4c16,_0xfa5f('0xc7'));if(ut[_0xfa5f('0xa0')](_0x3d4c16)>=_0x2e4a04[_0xfa5f('0xa6')]){_0x36f51c=ut['cloneAction'](_0x3d4c16,0xf,_0xfa5f('0xa8'));rpcDb[_0xfa5f('0x98')](_0x36f51c,_0xfa5f('0xc8'));}else{if(_0x3d4c16[_0xfa5f('0xc3')]>=_0x2e4a04['dialBusyMaxRetry']){rpcDb[_0xfa5f('0x98')](_0x3d4c16,_0xfa5f('0xc7'));}else{rpcDb[_0xfa5f('0xab')](ut[_0xfa5f('0xc9')](_0x3d4c16,_0xfa5f('0xc3'),_0x2e4a04[_0xfa5f('0xca')]),_0x3d4c16[_0xfa5f('0xad')],_0x3d4c16[_0xfa5f('0xae')]);}}break;case _0xfa5f('0xcb'):_0x2e4a04[_0xfa5f('0xcc')]+=0x1;_0x3d4c16[_0xfa5f('0xcd')]+=0x1;_0x3d4c16[_0xfa5f('0x9f')]=ut[_0xfa5f('0xa0')](_0x3d4c16);ut[_0xfa5f('0x91')](_0x3d4c16,0x3,_0xfa5f('0xce'));ami[_0xfa5f('0x29')](_0xfa5f('0xcf'),ut['buildObj'](_0x3d4c16,_0xfa5f('0xd0')));rpcDb[_0xfa5f('0x95')](_0x3d4c16,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0xfa5f('0xa0')](_0x3d4c16)>=_0x2e4a04[_0xfa5f('0xa6')]){_0x36f51c=ut['cloneAction'](_0x3d4c16,0xf,_0xfa5f('0xa8'));rpcDb[_0xfa5f('0x98')](_0x36f51c,_0xfa5f('0xd1'));}else{if(_0x3d4c16[_0xfa5f('0xcd')]>=_0x2e4a04[_0xfa5f('0xd2')]){rpcDb[_0xfa5f('0x98')](_0x3d4c16,_0xfa5f('0xd3'));}else{rpcDb[_0xfa5f('0xab')](ut['scheduledAt'](_0x3d4c16,_0xfa5f('0xcd'),_0x2e4a04['dialNoAnswerRetryFrequency']),_0x3d4c16[_0xfa5f('0xad')],_0x3d4c16[_0xfa5f('0xae')]);}}break;case _0xfa5f('0xd4'):_0x2e4a04[_0xfa5f('0x40')]+=0x1;_0x3d4c16[_0xfa5f('0xd5')]+=0x1;_0x3d4c16[_0xfa5f('0x9f')]=ut[_0xfa5f('0xa0')](_0x3d4c16);ut[_0xfa5f('0x91')](_0x3d4c16,0x8,_0xfa5f('0xd6'));ami[_0xfa5f('0x29')](_0xfa5f('0xd7'),ut[_0xfa5f('0xa3')](_0x3d4c16,_0xfa5f('0xd8')));rpcDb[_0xfa5f('0x95')](_0x3d4c16,_0xfa5f('0xd9'));if(ut[_0xfa5f('0xa0')](_0x3d4c16)>=_0x2e4a04[_0xfa5f('0xa6')]){_0x36f51c=ut['cloneAction'](_0x3d4c16,0xf,'Global');rpcDb['createCustomerFinal'](_0x36f51c,_0xfa5f('0xda'));}else{if(_0x3d4c16[_0xfa5f('0xd5')]>=_0x2e4a04[_0xfa5f('0xdb')]){rpcDb[_0xfa5f('0x98')](_0x3d4c16,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0xfa5f('0xab')](ut[_0xfa5f('0xc9')](_0x3d4c16,_0xfa5f('0xd5'),_0x2e4a04[_0xfa5f('0xca')]),_0x3d4c16[_0xfa5f('0xad')],_0x3d4c16[_0xfa5f('0xae')]);}}break;case _0xfa5f('0xdc'):_0x2e4a04[_0xfa5f('0x45')]+=0x1;_0x3d4c16[_0xfa5f('0xdd')]+=0x1;_0x3d4c16[_0xfa5f('0x9f')]=ut['totalGlobal'](_0x3d4c16);ut['logCustomer'](_0x3d4c16,0x14,_0xfa5f('0xde'));ami[_0xfa5f('0x29')](_0xfa5f('0xdf'),ut[_0xfa5f('0xa3')](_0x3d4c16,_0xfa5f('0xe0')));rpcDb[_0xfa5f('0x95')](_0x3d4c16,_0xfa5f('0xe1'));if(ut['totalGlobal'](_0x3d4c16)>=_0x2e4a04[_0xfa5f('0xa6')]){_0x36f51c=ut[_0xfa5f('0xa7')](_0x3d4c16,0x14,_0xfa5f('0xde'));rpcDb[_0xfa5f('0x98')](_0x36f51c,_0xfa5f('0xe2'));}else{if(_0x3d4c16[_0xfa5f('0xdd')]>=_0x2e4a04['dialAgentRejectMaxRetry']){rpcDb[_0xfa5f('0x98')](_0x3d4c16,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xfa5f('0xab')](ut[_0xfa5f('0xc9')](_0x3d4c16,_0xfa5f('0xdd'),_0x2e4a04[_0xfa5f('0xe3')]),_0x3d4c16['unlockAgent'],_0x3d4c16[_0xfa5f('0xae')]);}}break;case _0xfa5f('0xe4'):_0x2e4a04[_0xfa5f('0x47')]+=0x1;_0x3d4c16[_0xfa5f('0xe5')]+=0x1;_0x3d4c16[_0xfa5f('0x9f')]=ut[_0xfa5f('0xa0')](_0x3d4c16);ut['logCustomer'](_0x3d4c16,0xb,_0xfa5f('0xe6'));rpcDb[_0xfa5f('0x95')](_0x3d4c16,_0xfa5f('0xe7'));if(ut[_0xfa5f('0xa0')](_0x3d4c16)>=_0x2e4a04[_0xfa5f('0xa6')]){_0x36f51c=ut[_0xfa5f('0xa7')](_0x3d4c16,0xf,_0xfa5f('0xa8'));rpcDb[_0xfa5f('0x98')](_0x36f51c,_0xfa5f('0xe7'));}else{if(_0x3d4c16[_0xfa5f('0xe8')]>=_0x2e4a04[_0xfa5f('0xe9')]){rpcDb[_0xfa5f('0x98')](_0x3d4c16,_0xfa5f('0xe7'));}else{rpcDb[_0xfa5f('0xab')](ut[_0xfa5f('0xc9')](_0x3d4c16,_0xfa5f('0xe5'),_0x2e4a04['dialAbandonedRetryFrequency']),_0x3d4c16['unlockAgent'],_0x3d4c16[_0xfa5f('0xae')]);}}break;case'18':_0x2e4a04[_0xfa5f('0x46')]+=0x1;_0x3d4c16[_0xfa5f('0xea')]+=0x1;_0x3d4c16[_0xfa5f('0x9f')]=ut[_0xfa5f('0xa0')](_0x3d4c16);ut[_0xfa5f('0x91')](_0x3d4c16,0x12,_0x398709['cause-txt']||_0x398709['dialstatus']);ami[_0xfa5f('0x29')](_0xfa5f('0xeb'),ut[_0xfa5f('0xa3')](_0x3d4c16,_0xfa5f('0xec')));rpcDb[_0xfa5f('0x95')](_0x3d4c16,'[callProgressDetectingCustomer][hangupInAMD]');if(ut[_0xfa5f('0xa0')](_0x3d4c16)>=_0x2e4a04[_0xfa5f('0xa6')]){_0x36f51c=ut[_0xfa5f('0xa7')](_0x3d4c16,0xf,_0xfa5f('0xa8'));rpcDb['createCustomerFinal'](_0x36f51c,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0xfa5f('0x98')](_0x3d4c16,_0xfa5f('0xed'));}delete this[_0xfa5f('0x17')][_0x398709[_0xfa5f('0xaf')]];break;case'19':_0x2e4a04[_0xfa5f('0x46')]+=0x1;_0x3d4c16[_0xfa5f('0x9f')]=ut['totalGlobal'](_0x3d4c16);ut[_0xfa5f('0x91')](_0x3d4c16,0x13,_0x398709[_0xfa5f('0xee')]||_0x398709[_0xfa5f('0xef')]);ami['emit'](_0xfa5f('0xeb'),ut[_0xfa5f('0xa3')](_0x3d4c16,_0xfa5f('0xec')));rpcDb[_0xfa5f('0x95')](_0x3d4c16,_0xfa5f('0xf0'));if(ut['totalGlobal'](_0x3d4c16)>=_0x2e4a04['dialGlobalMaxRetry']){_0x36f51c=ut['cloneAction'](_0x3d4c16,0xf,'Global');rpcDb[_0xfa5f('0x98')](_0x36f51c,_0xfa5f('0xf0'));}else{rpcDb[_0xfa5f('0x98')](_0x3d4c16,_0xfa5f('0xf0'));}delete this['actions'][_0x398709[_0xfa5f('0xaf')]];break;default:if(_0x3d4c16[_0xfa5f('0x75')]){ut[_0xfa5f('0x7d')](_0x2e4a04,'[default]');ut[_0xfa5f('0x7f')](_0xfa5f('0xf1')+_0x2e4a04[_0xfa5f('0x2c')],_0x398709);}_0x2e4a04[_0xfa5f('0x46')]+=0x1;_0x3d4c16[_0xfa5f('0x9f')]=ut[_0xfa5f('0xa0')](_0x3d4c16);ut[_0xfa5f('0x91')](_0x3d4c16,0xc,_0x398709[_0xfa5f('0xee')]||_0x398709[_0xfa5f('0xef')]);rpcDb['createCustomerHistory'](_0x3d4c16,_0xfa5f('0xf2'));if(ut[_0xfa5f('0xa0')](_0x3d4c16)>=_0x2e4a04[_0xfa5f('0xa6')]){_0x36f51c=ut[_0xfa5f('0xa7')](_0x3d4c16,0xf,_0xfa5f('0xa8'));rpcDb[_0xfa5f('0x98')](_0x36f51c,_0xfa5f('0xf3'));}else{rpcDb['createCustomerFinal'](_0x3d4c16,_0xfa5f('0xf3'));}delete this[_0xfa5f('0x17')][_0x398709[_0xfa5f('0xaf')]];}if(!(_0x3d4c16['dialAnswer']&&_0x1213fe==='16')){ut[_0xfa5f('0xf4')](_0x2e4a04,_0xfa5f('0xf5'));logger['info'](_0xfa5f('0xf6'),_0x3d4c16[_0xfa5f('0xb3')],'\x20Queue',_0x2e4a04[_0xfa5f('0x2c')],_0xfa5f('0xf7'),_0x2e4a04[_0xfa5f('0x73')]);}if(_0x1213fe!==_0xfa5f('0xb0')){delete this[_0xfa5f('0x17')][_0x398709[_0xfa5f('0xaf')]];delete this[_0xfa5f('0x17')][_0x398709[_0xfa5f('0xf8')]];}}};Preview[_0xfa5f('0x6a')]['callProgressDetectingAgent']=function(_0x87040a,_0x5485f1,_0x4a817d){if(_[_0xfa5f('0xf9')](_0x5485f1)&&_0xfa5f('0xfa')!==typeof _0x5485f1){return;}if(_['isUndefined'](_0x4a817d)&&_0xfa5f('0xfa')!==typeof _0x4a817d){return;}switch(_0x4a817d['reason']){case'0':ut[_0xfa5f('0xfb')](_0x87040a,0x0,'NoSuchNumber');rpcDb[_0xfa5f('0xfc')](_0x87040a,_0xfa5f('0xfd'));break;case'3':ut[_0xfa5f('0xfb')](_0x87040a,0x3,_0xfa5f('0xce'));rpcDb['createAgentHistory'](_0x87040a,_0xfa5f('0xfe'));break;case'5':ut[_0xfa5f('0xfb')](_0x87040a,0x5,_0xfa5f('0xc4'));rpcDb['createAgentHistory'](_0x87040a,_0xfa5f('0xff'));break;case'8':ut[_0xfa5f('0xfb')](_0x87040a,0x8,_0xfa5f('0xd6'));rpcDb[_0xfa5f('0xfc')](_0x87040a,_0xfa5f('0x100'));break;case'22':ut[_0xfa5f('0xfb')](_0x87040a,0x16,_0xfa5f('0x101'));rpcDb[_0xfa5f('0xfc')](_0x87040a,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xfa5f('0xfb')](_0x87040a,0xc,_0x4a817d['reason']);rpcDb[_0xfa5f('0xfc')](_0x87040a,_0xfa5f('0x100'));}ut['updateOriginated'](_0x5485f1,_0xfa5f('0x102'));logger[_0xfa5f('0x5f')](_0xfa5f('0x103'),_0x87040a[_0xfa5f('0xb3')],_0xfa5f('0xb4'),_0x5485f1[_0xfa5f('0x2c')],_0xfa5f('0xf7'),_0x5485f1[_0xfa5f('0x73')]);delete this['actions'][_0x87040a['uniqueid']];};Preview[_0xfa5f('0x6a')]['checkInBlack']=function(_0xdf4bb8,_0x4e36e4,_0x5eaaa5,_0x4d1900,_0x50b01d){var _0x3b1eaf=this;return new BPromise(function(_0x540c62,_0x14bac5){if(_['isNil'](_0x4e36e4)||_[_0xfa5f('0x70')](_0x4e36e4['Contact'])||_[_0xfa5f('0x70')](_0x4e36e4['Contact']['phone'])||_[_0xfa5f('0x70')](_0x4e36e4[_0xfa5f('0x78')])){_0x14bac5(ut['message'](_0xfa5f('0x104'),_0x4d1900,_0x50b01d));return;}var _0x242c16=uuid['v4']();var _0x14eb1e=_0x3b1eaf['campaignsPreview'][_0x4e36e4['Queue'][_0xfa5f('0x2c')]];var _0x58b910=_0x5eaaa5?_0x3b1eaf[_0xfa5f('0x18')][_0x5eaaa5]['id']:undefined;_0x3b1eaf[_0xfa5f('0x17')][_0x242c16]=new Action(_0x4e36e4,_0x14eb1e,_0x242c16,_0x5eaaa5,_0x58b910);var _0x336439=_0x3b1eaf[_0xfa5f('0x17')][_0x242c16];_0x336439[_0xfa5f('0xad')]=_0x4d1900;_0x336439['activeContact']=_0x50b01d;_0x336439[_0xfa5f('0x105')]=_0x5eaaa5;if(_[_0xfa5f('0x106')](_0xdf4bb8)){_0x3b1eaf[_0xfa5f('0x107')](_0x336439,_0x14eb1e,_0x4e36e4,_0x5eaaa5)['then'](function(_0x248918){logger[_0xfa5f('0x5f')](_0xfa5f('0x108'),_0xfa5f('0x109')+_0x336439[_0xfa5f('0x72')]+_0xfa5f('0x10a')+_0x336439[_0xfa5f('0x10b')],JSON['stringify'](_0x248918));ami[_0xfa5f('0x29')](_0xfa5f('0x10c'),ut[_0xfa5f('0xa3')](_0x336439,_0xfa5f('0x10d'),_0x3b1eaf[_0xfa5f('0x14')][_0x336439[_0xfa5f('0x72')]]));_0x540c62(ut[_0xfa5f('0x52')](_0xfa5f('0x10e')));})[_0xfa5f('0x7b')](function(_0x802329){ut[_0xfa5f('0x69')](_0xfa5f('0x10f'),_0x802329);_0x14bac5(ut[_0xfa5f('0x52')]('Call\x20failed',_0x4d1900,_0x50b01d));});}else{_0x14eb1e[_0xfa5f('0x3e')]+=0x1;ut[_0xfa5f('0x110')](_0x336439);rpcDb['createHistory'](_0x336439,_0xfa5f('0x111'));delete _0x3b1eaf['actions'][_0x242c16];_0x14bac5(ut[_0xfa5f('0x52')](_0xfa5f('0x112'),_0x4d1900,_0x50b01d));}});};Preview[_0xfa5f('0x6a')][_0xfa5f('0x9b')]=function(_0x480483){return!_[_0xfa5f('0x70')](_0x480483)&&!_[_0xfa5f('0x70')](_0x480483[_0xfa5f('0x2c')])&&!_['isNil'](_0x480483[_0xfa5f('0x59')])&&_0x480483[_0xfa5f('0x59')]&&!_[_0xfa5f('0x70')](this[_0xfa5f('0x16')][util[_0xfa5f('0x5c')](_0xfa5f('0x113'),_0x480483[_0xfa5f('0x2c')])])&&!_[_0xfa5f('0x70')](this['trunks'][util[_0xfa5f('0x5c')](_0xfa5f('0x113'),_0x480483[_0xfa5f('0x2c')])]['status'])&&(this[_0xfa5f('0x16')][util[_0xfa5f('0x5c')](_0xfa5f('0x113'),_0x480483[_0xfa5f('0x2c')])]['status']===_0xfa5f('0x114')||this[_0xfa5f('0x16')][util[_0xfa5f('0x5c')](_0xfa5f('0x113'),_0x480483['name'])]['status']===_0xfa5f('0x115'));};Preview[_0xfa5f('0x6a')]['run']=function(_0x8d0064,_0x209702){var _0x4fab11=this;return new BPromise(function(_0x460d54,_0x21f3de){_0x4fab11['execRun'](_0x8d0064,_0x209702)['then'](function(_0x3d1eef){_0x460d54(_['pick'](_0x3d1eef,['message']));})[_0xfa5f('0x7b')](function(_0x484073){if(_0x484073['unlock']){rpcDb['unlockContact'](_0x8d0064);}if(_0x484073[_0xfa5f('0x59')]){rpcDb[_0xfa5f('0x116')](_0x8d0064);}_0x21f3de(_[_0xfa5f('0x76')](_0x484073,['message']));});});};Preview['prototype'][_0xfa5f('0x117')]=function(_0x247ad9,_0x1fc697){var _0xe2733=this;return new BPromise(function(_0x48bc40,_0x2894ed){var _0x39cc8b,_0x3fd257;rpcDb['getContactPreview'](_0x247ad9)[_0xfa5f('0x86')](function(_0x132197){if(!_['isNil'](_0x132197[0x0])){_0x3fd257=_0x132197[0x0][_0xfa5f('0x118')]?![]:!![];_0x39cc8b=_0x132197[0x0]['recallme']?!![]:![];_0x39cc8b=_0x1fc697?!![]:_0x39cc8b;}var _0x5d63c4=_0xe2733[_0xfa5f('0x119')](_0x132197);if(_0x5d63c4['isValid']){rpcDb[_0xfa5f('0x11a')](_[_0xfa5f('0x76')](_0x132197[0x0],['VoiceQueueId','Contact.phone']))[_0xfa5f('0x86')](function(_0x3ffee1){_0xe2733[_0xfa5f('0x11b')](_0x3ffee1,_0x132197[0x0],_0x1fc697,_0x3fd257,_0x39cc8b)['then'](function(_0x18d081){_0x48bc40(_0x18d081);})[_0xfa5f('0x7b')](function(_0x25ab20){_0x2894ed(_0x25ab20);});})[_0xfa5f('0x7b')](function(_0x482f7d){ut[_0xfa5f('0x69')](_0xfa5f('0x11c'),_0x482f7d);_0x2894ed(ut[_0xfa5f('0x52')](_0xfa5f('0x11d'),_0x3fd257,_0x39cc8b));});}else{_0x2894ed(ut[_0xfa5f('0x52')](_0x5d63c4[_0xfa5f('0x52')],_0x3fd257,_0x39cc8b));}})[_0xfa5f('0x7b')](function(_0x16923b){ut['logger'](_0xfa5f('0x11e'),_0x16923b);_0x2894ed(ut['message'](_0xfa5f('0x11d'),![],!![]));});});};Preview[_0xfa5f('0x6a')][_0xfa5f('0x119')]=function(_0xf1dd0b){if(_[_0xfa5f('0x70')](_0xf1dd0b)||_[_0xfa5f('0x106')](_0xf1dd0b)||!_[_0xfa5f('0x70')](_0xf1dd0b[0x0][_0xfa5f('0x11f')])&&_[_0xfa5f('0x70')](_0xf1dd0b[0x0][_0xfa5f('0x11f')]['name'])){ut[_0xfa5f('0x69')](_0xfa5f('0x120'),_0xf1dd0b);return{'isValid':![],'message':_0xfa5f('0x121')};}var _0x39ca93=this[_0xfa5f('0x14')][_0xf1dd0b[0x0][_0xfa5f('0x71')][_0xfa5f('0x2c')]];_0x39ca93[_0xfa5f('0x52')]=_0xfa5f('0x9d');if(_[_0xfa5f('0x70')](_0x39ca93)){ut[_0xfa5f('0x69')](_0xfa5f('0x122'),_0x39ca93);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xfa5f('0x9b')](_0x39ca93['Trunk'])){ut[_0xfa5f('0x69')](_0xfa5f('0x123'),_0xfa5f('0x124')+_0x39ca93[_0xfa5f('0x2c')]+'\x20Trunk\x20is\x20not\x20active');if(!this['isTrunkReachable'](_0x39ca93[_0xfa5f('0x125')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0x39ca93[_0xfa5f('0x2c')]+_0xfa5f('0x126'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut['isActive'](_0x39ca93[_0xfa5f('0x37')])){ut[_0xfa5f('0x69')](_0xfa5f('0x127'),_0x39ca93[_0xfa5f('0x2c')]+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x39ca93['name']+_0xfa5f('0x128')};}return{'isValid':!![],'message':_0xfa5f('0x129')};};Preview[_0xfa5f('0x6a')]['execCall']=function(_0x19d128,_0x420d35,_0x3d1757,_0x275793){var _0x39605a=this;return new BPromise(function(_0x523149,_0x4737f4){var _0x21cc81=_0x19d128[_0xfa5f('0xb3')];var _0x2876a2=_0x39605a[_0xfa5f('0x9b')](_0x420d35[_0xfa5f('0x58')])?util[_0xfa5f('0x5c')](_0xfa5f('0x12a'),_0x420d35[_0xfa5f('0x58')][_0xfa5f('0x2c')],_[_0xfa5f('0x70')](_0x420d35[_0xfa5f('0x3b')])?'':_0x420d35['dialPrefix'][_0xfa5f('0x12b')]()||'',_0x420d35[_0xfa5f('0x12c')]>0x0?_0x3d1757[_0xfa5f('0x12d')]['phone'][_0xfa5f('0x12e')](_0x420d35['dialCutDigit']):_0x3d1757[_0xfa5f('0x12d')]['phone']):util[_0xfa5f('0x5c')](_0xfa5f('0x12a'),_[_0xfa5f('0x70')](_0x420d35[_0xfa5f('0x125')])?_0x420d35['Trunk']['name']:_0x420d35[_0xfa5f('0x125')][_0xfa5f('0x2c')],_[_0xfa5f('0x70')](_0x420d35[_0xfa5f('0x3b')])?'':_0x420d35[_0xfa5f('0x3b')][_0xfa5f('0x12b')]()||'',_0x420d35['dialCutDigit']>0x0?_0x3d1757['Contact'][_0xfa5f('0x12f')][_0xfa5f('0x12e')](_0x420d35['dialCutDigit']):_0x3d1757['Contact']['phone']);var _0x4b1297=_0x39605a[_0xfa5f('0x9b')](_0x420d35[_0xfa5f('0x58')])?ut['getCallerId'](_0x420d35['Trunk'][_0xfa5f('0x130')],_0x420d35[_0xfa5f('0x39')],_0x420d35[_0xfa5f('0x131')]>0x0?ut['getCallerIdRandom'](_0x420d35[_0xfa5f('0x3a')],_0x420d35[_0xfa5f('0x131')]):_0x420d35[_0xfa5f('0x3a')]):ut[_0xfa5f('0x132')](_[_0xfa5f('0x70')](_0x420d35['TrunkBackup'])?_0x420d35[_0xfa5f('0x58')][_0xfa5f('0x130')]:_0x420d35['TrunkBackup'][_0xfa5f('0x130')],_0x420d35[_0xfa5f('0x39')],_0x420d35[_0xfa5f('0x131')]>0x0?ut[_0xfa5f('0x133')](_0x420d35[_0xfa5f('0x3a')],_0x420d35[_0xfa5f('0x131')]):_0x420d35[_0xfa5f('0x3a')]);if(_0x4b1297){_0x19d128['originatecalleridname']=ut[_0xfa5f('0x134')](_0x4b1297);_0x19d128[_0xfa5f('0x135')]=ut[_0xfa5f('0x136')](_0x4b1297);}var _0x34a249=ut[_0xfa5f('0x137')](_0x420d35,_0x3d1757,_0x2876a2,_0x4b1297,_0x21cc81,_0x19d128);_['merge'](_0x19d128,ut['toLowerVariables'](_0x34a249));_0x19d128[_0xfa5f('0x8f')]=moment()[_0xfa5f('0x5c')](_0xfa5f('0x90'));ami[_0xfa5f('0x7a')](ut[_0xfa5f('0x138')](_0x19d128,_0x420d35,_0x34a249,_0x19d128[_0xfa5f('0xae')],_0x275793))[_0xfa5f('0x86')](function(_0xc28899){var _0x3a6617=_0x19d128[_0xfa5f('0x139')];if(!_[_0xfa5f('0x70')](_0x3a6617)){if(!_[_0xfa5f('0x70')](_0x39605a[_0xfa5f('0x18')][_0x3a6617])){_0x39605a[_0xfa5f('0x18')][_0x3a6617][_0xfa5f('0x13a')]=_0x19d128[_0xfa5f('0x13b')];emit(util['format']('user:%s',_0x39605a[_0xfa5f('0x18')][_0x3a6617][_0xfa5f('0x2c')]),_0xfa5f('0x13c'),{'destaccountcode':_0x39605a[_0xfa5f('0x18')][_0x3a6617]['accountcode'],'destconnectedlinenum':_0x19d128[_0xfa5f('0x13b')]});}}_0x420d35[_0xfa5f('0x73')]+=0x1;logger[_0xfa5f('0x5f')](_0xfa5f('0x13d'),_0x21cc81,'\x20Queue',_0x420d35[_0xfa5f('0x2c')],_0xfa5f('0xf7'),_0x420d35[_0xfa5f('0x73')]);_0x523149(_0xc28899);})[_0xfa5f('0x7b')](function(_0x6b9395){ut['logAgent'](_0x19d128,0xe,_0xfa5f('0x13e'));rpcDb[_0xfa5f('0xfc')](_0x19d128,_0xfa5f('0x13f'));_0x4737f4(_0x6b9395);});});};Preview[_0xfa5f('0x6a')][_0xfa5f('0x24')]=function(_0x39fb5b){if(this[_0xfa5f('0x17')][_0x39fb5b['linkedid']]){this[_0xfa5f('0x17')][_0x39fb5b['linkedid']][_0xfa5f('0x140')]=_0x39fb5b['channel'];}};Preview[_0xfa5f('0x6a')][_0xfa5f('0x1b')]=function(_0x341c94){var _0x5815b6=this;var _0x502626=this[_0xfa5f('0x17')][_0x341c94[_0xfa5f('0x141')]];if(_0x502626){if(_0x502626['lookAgent']&&this[_0xfa5f('0x18')][_0x502626['lookAgent']]){ut[_0xfa5f('0x142')](_0x502626,this[_0xfa5f('0x18')][_0x502626[_0xfa5f('0x105')]][_0xfa5f('0x2c')],this['agents'][_0x502626[_0xfa5f('0x105')]]['id']);}var _0x3130e1=_[_0xfa5f('0x143')](_0x502626);_0x3130e1[_0xfa5f('0x144')]=moment()[_0xfa5f('0x5c')](_0xfa5f('0x90'));var _0x18ff0d=_0x5815b6[_0xfa5f('0x14')][_0x502626[_0xfa5f('0x72')]];if(ut[_0xfa5f('0x145')](_0x341c94[_0xfa5f('0x146')])){if(_0x502626[_0xfa5f('0xad')]){rpcDb[_0xfa5f('0x147')](_0x502626[_0xfa5f('0x10b')]);}if(_0x502626['activeContact']){rpcDb[_0xfa5f('0x116')](_0x502626[_0xfa5f('0x10b')]);}ami[_0xfa5f('0x29')]('custom:agentringnoanswer',ut[_0xfa5f('0xa3')](_0x502626,_0xfa5f('0x148'),this['campaignsPreview'][_0x502626['queue']]));this['callProgressDetectingAgent'](_0x3130e1,_0x18ff0d,_0x341c94);}else{_0x502626['starttime']=moment()['format'](_0xfa5f('0x90'));ut['logAgent'](_0x3130e1,0x4,_0xfa5f('0xbc'));rpcDb[_0xfa5f('0xfc')](_0x3130e1,_0xfa5f('0x149'));}}};Preview['prototype'][_0xfa5f('0x1e')]=function(_0x4f9dd0){var _0x34bc75=this;var _0x3d3659=this[_0xfa5f('0x17')][_0x4f9dd0[_0xfa5f('0xaf')]];var _0x51d061;if(_0x3d3659){_0x51d061=this[_0xfa5f('0x14')][_0x3d3659[_0xfa5f('0x72')]];logger[_0xfa5f('0x5f')](_0xfa5f('0x14a'),_0x4f9dd0[_0xfa5f('0xaf')],'\x20Queue',_0x51d061[_0xfa5f('0x2c')],_0xfa5f('0x74'),_0x51d061[_0xfa5f('0x2f')]);}if(this[_0xfa5f('0x17')][_0x4f9dd0[_0xfa5f('0xaf')]]&&_0x4f9dd0[_0xfa5f('0xaf')]!==_0x4f9dd0[_0xfa5f('0xb3')]){if(_0x4f9dd0['cause']==='16'&&this[_0xfa5f('0x17')][_0x4f9dd0['linkedid']][_0xfa5f('0x75')]){this[_0xfa5f('0x9e')](_0x4f9dd0,_0x4f9dd0[_0xfa5f('0xaf')],_0x4f9dd0[_0xfa5f('0x14b')]);}else if(this[_0xfa5f('0x17')][_0x4f9dd0['linkedid']][_0xfa5f('0x75')]){logger[_0xfa5f('0x5f')](_0xfa5f('0x14c'),_0x4f9dd0[_0xfa5f('0xaf')],_0x4f9dd0[_0xfa5f('0x14b')],_0xfa5f('0xb4'),_0x51d061[_0xfa5f('0x2c')],_0xfa5f('0x74'),_0x51d061[_0xfa5f('0x2f')]);this[_0xfa5f('0x9e')](_0x4f9dd0,_0x4f9dd0[_0xfa5f('0xaf')],_0x4f9dd0[_0xfa5f('0x14b')]);}}else if(_0x3d3659&&_['isNil'](_0x3d3659[_0xfa5f('0x14d')])&&_0x51d061[_0xfa5f('0x14e')]&&_0x4f9dd0[_0xfa5f('0xaf')]===_0x4f9dd0[_0xfa5f('0xb3')]&&_[_0xfa5f('0x70')](_0x4f9dd0[_0xfa5f('0x14f')])&&_0x4f9dd0[_0xfa5f('0x14b')]==='16'&&_0x4f9dd0['channelstate']==='6'&&_[_0xfa5f('0xf9')](_0x3d3659[_0xfa5f('0x150')])){if(_0x3d3659[_0xfa5f('0xad')]){rpcDb[_0xfa5f('0x147')](_0x3d3659[_0xfa5f('0x10b')]);}if(_0x3d3659['activeContact']){rpcDb[_0xfa5f('0x116')](_0x3d3659['idContact']);}_0x4f9dd0[_0xfa5f('0x14f')]='22';this['callProgressDetectingAgent'](_0x3d3659,_0x51d061,_0x4f9dd0);}else if(_0x3d3659&&_0x3d3659[_0xfa5f('0x150')]){if(_0x4f9dd0[_0xfa5f('0x14b')]==='16'&&this[_0xfa5f('0x17')][_0x4f9dd0[_0xfa5f('0xaf')]][_0xfa5f('0x75')]){logger[_0xfa5f('0x5f')](_0xfa5f('0x151'),_0x4f9dd0[_0xfa5f('0xaf')],_0x4f9dd0['cause'],_0xfa5f('0xb4'),_0x51d061[_0xfa5f('0x2c')],_0xfa5f('0x74'),_0x51d061[_0xfa5f('0x2f')]);this[_0xfa5f('0x9e')](_0x4f9dd0,_0x4f9dd0[_0xfa5f('0xaf')],_0x4f9dd0[_0xfa5f('0x14b')]);}else if(this[_0xfa5f('0x17')][_0x4f9dd0[_0xfa5f('0xaf')]]['dialAnswer']){logger['info']('[syncHangup][talking][cause]',_0x4f9dd0[_0xfa5f('0xaf')],_0x4f9dd0[_0xfa5f('0x14b')],_0xfa5f('0xb4'),_0x51d061['name'],_0xfa5f('0x74'),_0x51d061[_0xfa5f('0x2f')]);this[_0xfa5f('0x9e')](_0x4f9dd0,_0x4f9dd0[_0xfa5f('0xaf')],_0x4f9dd0['cause']);}}};Preview[_0xfa5f('0x6a')][_0xfa5f('0x22')]=function(_0x88a8ba){if(this[_0xfa5f('0x17')][_0x88a8ba['destlinkedid']]&&_0x88a8ba[_0xfa5f('0xf8')]!==_0x88a8ba[_0xfa5f('0x152')]){this[_0xfa5f('0x9e')](_0x88a8ba,_0x88a8ba[_0xfa5f('0xf8')],_0x88a8ba[_0xfa5f('0xef')]);}};Preview['prototype'][_0xfa5f('0x20')]=function(_0x274529){if(this['actions'][_0x274529[_0xfa5f('0xaf')]]&&_0x274529[_0xfa5f('0xaf')]!==_0x274529['uniqueid']&&!this[_0xfa5f('0x17')][_0x274529[_0xfa5f('0xaf')]][_0xfa5f('0x75')]){if(_0x274529[_0xfa5f('0x14b')]==='1'){this['callProgressDetectingCustomer'](_0x274529,_0x274529[_0xfa5f('0xaf')],_0x274529[_0xfa5f('0x14b')]);}}};Preview[_0xfa5f('0x6a')]['addVariable']=function(_0x4658f4,_0xc7dd6,_0x1b8be4){if(this[_0xfa5f('0x17')][_0x4658f4]){if(_['isNil'](this[_0xfa5f('0x17')][_0x4658f4][_0xfa5f('0x153')])){this[_0xfa5f('0x17')][_0x4658f4][_0xfa5f('0x153')]={};}this[_0xfa5f('0x17')][_0x4658f4][_0xfa5f('0x153')][_0xc7dd6]=_0x1b8be4;}};Preview['prototype'][_0xfa5f('0x26')]=function(_0x2cc810){try{if(!_[_0xfa5f('0x70')](_0x2cc810)){if(ut[_0xfa5f('0x154')](_['keys'](_0x2cc810['variable'])[0x0])){this['addVariable'](_0x2cc810[_0xfa5f('0xb3')],_[_0xfa5f('0x155')](_0x2cc810['variable'])[0x0],_0x2cc810['value']);}}}catch(_0x209388){logger[_0xfa5f('0x156')](_0xfa5f('0x157'),util['inspect'](_0x209388,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x1619a3){if(_0x1619a3){if(this[_0xfa5f('0x17')][_0x1619a3['transfertargetlinkedid']]){this['actions'][_0x1619a3[_0xfa5f('0x158')]]['transfer']=!![];}}};Preview['prototype'][_0xfa5f('0x27')]=function(_0x70ea70){if(_0x70ea70){if(this[_0xfa5f('0x17')][_0x70ea70[_0xfa5f('0x159')]]){this['actions'][_0x70ea70['transfererlinkedid']]['transfer']=!![];}}};module[_0xfa5f('0x15a')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 4c3bc00..7c68fc4 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 _0xad8a=['context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','membername'];(function(_0x56a0f2,_0x3ca569){var _0x2b8341=function(_0xc19de6){while(--_0xc19de6){_0x56a0f2['push'](_0x56a0f2['shift']());}};_0x2b8341(++_0x3ca569);}(_0xad8a,0xc8));var _0xaad8=function(_0x1e41cc,_0x29cfa9){_0x1e41cc=_0x1e41cc-0x0;var _0x530402=_0xad8a[_0x1e41cc];return _0x530402;};'use strict';var util=require(_0xaad8('0x0'));var BPromise=require(_0xaad8('0x1'));var logger=require('../../../config/logger')(_0xaad8('0x2'));var _=require('lodash');var cmHopper=require(_0xaad8('0x3'));var cmHopperFinal=require(_0xaad8('0x4'));var cmHopperHistory=require(_0xaad8('0x5'));var cmHopperBlack=require(_0xaad8('0x6'));var voiceQueueRt=require(_0xaad8('0x7'));var agentReportPreview=require(_0xaad8('0x8'));var voiceQueueReport=require(_0xaad8('0x9'));function loggerCatch(_0x14401d){return function(_0x703ded){logger[_0xaad8('0xa')](_0x14401d,util[_0xaad8('0xb')](_0x703ded,{'showHidden':![],'depth':null}));};}function create(_0x557f65){return BPromise[_0xaad8('0xc')]()[_0xaad8('0xd')](cmHopperHistory[_0xaad8('0xe')](_0x557f65))[_0xaad8('0xf')](loggerCatch(_0xaad8('0x10')));}function createAgent(_0x8a25c9){return BPromise[_0xaad8('0xc')]()[_0xaad8('0xd')](agentReportPreview[_0xaad8('0xe')](_0x8a25c9))[_0xaad8('0xf')](loggerCatch(_0xaad8('0x10')));}function moveContact(_0x47a2c2){return BPromise[_0xaad8('0xc')]()[_0xaad8('0xd')](cmHopper[_0xaad8('0x11')](_0x47a2c2,!![]))[_0xaad8('0xf')](loggerCatch(_0xaad8('0x12')));}exports['checkIsBlackList']=function(_0x4aea6b){return BPromise[_0xaad8('0xc')]()['then'](cmHopperBlack[_0xaad8('0x13')](_0x4aea6b))[_0xaad8('0xf')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0xaad8('0x14')]=function(_0x94ae3d){return BPromise[_0xaad8('0xc')]()['then'](cmHopper[_0xaad8('0x14')](_0x94ae3d))[_0xaad8('0xf')](loggerCatch(_0xaad8('0x15')));};exports[_0xaad8('0xe')]=function(_0x29d233,_0xde7f0f){create(_0x29d233)['catch'](loggerCatch(_0xde7f0f));moveContact(_0x29d233)[_0xaad8('0xf')](loggerCatch(_0xde7f0f));};exports[_0xaad8('0x16')]=function(_0x17d947,_0x36975b){createAgent(_0x17d947)[_0xaad8('0xf')](loggerCatch(_0x36975b));};exports[_0xaad8('0x17')]=function(_0x5504af,_0x323a5a){create(_0x5504af)[_0xaad8('0xf')](loggerCatch(_0x323a5a));};exports[_0xaad8('0x18')]=function(_0x57c550,_0x4ebef1){moveContact(_0x57c550)[_0xaad8('0xf')](loggerCatch(_0x4ebef1));};exports[_0xaad8('0x19')]=function(_0x578669,_0xa69988,_0x548a67){if(_0xa69988){_0x578669[_0xaad8('0x1a')]=null;}if(_0x548a67){_0x578669[_0xaad8('0x1b')]=![];}return BPromise[_0xaad8('0xc')]()[_0xaad8('0xd')](cmHopper['rescheduleContact'](_0x578669))['catch'](loggerCatch(_0xaad8('0x1c')));};exports[_0xaad8('0x1d')]=function(_0x226a86){return BPromise[_0xaad8('0xc')]()['then'](cmHopper[_0xaad8('0x1d')](_0x226a86))[_0xaad8('0xf')](loggerCatch(_0xaad8('0x1e')));};exports['unlockContact']=function(_0x1382ed){return BPromise[_0xaad8('0xc')]()[_0xaad8('0xd')](cmHopper[_0xaad8('0x1f')]({'UserId':null},_0x1382ed,0x1))[_0xaad8('0xf')](loggerCatch(_0xaad8('0x20')));};exports[_0xaad8('0x21')]=function(_0x2f06d2){return BPromise[_0xaad8('0xc')]()[_0xaad8('0xd')](cmHopper['unlockContact']({'active':![]},_0x2f06d2,0x1))[_0xaad8('0xf')](loggerCatch(_0xaad8('0x22')));};exports[_0xaad8('0x23')]=function(_0x41371f){var _0x298a75={};_0x298a75[_0xaad8('0x24')]=_0x41371f[_0xaad8('0x24')];_0x298a75[_0xaad8('0x25')]=_0x41371f[_0xaad8('0x25')];_0x298a75[_0xaad8('0x26')]=_0x41371f[_0xaad8('0x26')];_0x298a75[_0xaad8('0x27')]=_0x41371f[_0xaad8('0x27')];_0x298a75[_0xaad8('0x28')]=_0x41371f[_0xaad8('0x28')];_0x298a75[_0xaad8('0x29')]=_0x41371f[_0xaad8('0x2a')];_0x298a75[_0xaad8('0x2b')]=_0x41371f[_0xaad8('0x2a')];_0x298a75[_0xaad8('0x2c')]=0x1;_0x298a75[_0xaad8('0x2d')]=_0x41371f[_0xaad8('0x2e')];_0x298a75['connectedlinename']=_0x41371f[_0xaad8('0x2f')];_0x298a75[_0xaad8('0x30')]=_0xaad8('0x31');_0x298a75[_0xaad8('0x32')]=_0xaad8('0x33');_0x298a75[_0xaad8('0x34')]=0x0;_0x298a75[_0xaad8('0x35')]=0x1;_0x298a75[_0xaad8('0x36')]=_0x41371f['membername'];_0x298a75[_0xaad8('0x37')]=_0xaad8('0x38');return BPromise[_0xaad8('0xc')]()[_0xaad8('0xd')](voiceQueueReport['create'](_0x298a75))[_0xaad8('0xf')](loggerCatch(_0xaad8('0x39')));};exports[_0xaad8('0x3a')]=function(_0x58f084,_0xec534d){return BPromise[_0xaad8('0xc')]()['then'](cmHopper[_0xaad8('0x3a')](_0x58f084,_0xec534d))[_0xaad8('0xf')](loggerCatch(_0xaad8('0x3b')));};exports[_0xaad8('0x3c')]=function(_0x3a938f){return BPromise[_0xaad8('0xc')]()[_0xaad8('0xd')](cmHopper[_0xaad8('0x19')](_0x3a938f,!![],!![]))[_0xaad8('0xf')](loggerCatch(_0xaad8('0x3d')));}; \ No newline at end of file +var _0xa1ba=['[rescheduleContact]\x20','countReScheduled','unlockContact','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','queuecallercomplete','endtime','context','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','queuecallerexitreason','getContactRecallMe','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','rescheduleContact','UserId','active'];(function(_0x4605bd,_0x5e7593){var _0xdb1464=function(_0x4ba004){while(--_0x4ba004){_0x4605bd['push'](_0x4605bd['shift']());}};_0xdb1464(++_0x5e7593);}(_0xa1ba,0x13b));var _0xaa1b=function(_0x3fb4c2,_0x2b473d){_0x3fb4c2=_0x3fb4c2-0x0;var _0x26dbdc=_0xa1ba[_0x3fb4c2];return _0x26dbdc;};'use strict';var util=require(_0xaa1b('0x0'));var BPromise=require(_0xaa1b('0x1'));var logger=require(_0xaa1b('0x2'))(_0xaa1b('0x3'));var _=require(_0xaa1b('0x4'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xaa1b('0x5'));var cmHopperHistory=require(_0xaa1b('0x6'));var cmHopperBlack=require(_0xaa1b('0x7'));var voiceQueueRt=require(_0xaa1b('0x8'));var agentReportPreview=require(_0xaa1b('0x9'));var voiceQueueReport=require(_0xaa1b('0xa'));function loggerCatch(_0x26f2bf){return function(_0x173c62){logger[_0xaa1b('0xb')](_0x26f2bf,util[_0xaa1b('0xc')](_0x173c62,{'showHidden':![],'depth':null}));};}function create(_0x441204){return BPromise[_0xaa1b('0xd')]()[_0xaa1b('0xe')](cmHopperHistory[_0xaa1b('0xf')](_0x441204))[_0xaa1b('0x10')](loggerCatch(_0xaa1b('0x11')));}function createAgent(_0x3dcbc2){return BPromise[_0xaa1b('0xd')]()[_0xaa1b('0xe')](agentReportPreview[_0xaa1b('0xf')](_0x3dcbc2))[_0xaa1b('0x10')](loggerCatch(_0xaa1b('0x11')));}function moveContact(_0x1e3839){return BPromise[_0xaa1b('0xd')]()['then'](cmHopper[_0xaa1b('0x12')](_0x1e3839,!![]))['catch'](loggerCatch(_0xaa1b('0x13')));}exports[_0xaa1b('0x14')]=function(_0x5b02ac){return BPromise[_0xaa1b('0xd')]()[_0xaa1b('0xe')](cmHopperBlack[_0xaa1b('0x14')](_0x5b02ac))[_0xaa1b('0x10')](loggerCatch(_0xaa1b('0x15')));};exports[_0xaa1b('0x16')]=function(_0x40e720){return BPromise[_0xaa1b('0xd')]()[_0xaa1b('0xe')](cmHopper['getContactPreview'](_0x40e720))[_0xaa1b('0x10')](loggerCatch(_0xaa1b('0x17')));};exports['createHistory']=function(_0x394070,_0x3628f3){create(_0x394070)[_0xaa1b('0x10')](loggerCatch(_0x3628f3));moveContact(_0x394070)['catch'](loggerCatch(_0x3628f3));};exports[_0xaa1b('0x18')]=function(_0x1496ba,_0x53cd27){createAgent(_0x1496ba)[_0xaa1b('0x10')](loggerCatch(_0x53cd27));};exports['createCustomerHistory']=function(_0x201073,_0xdb66cd){create(_0x201073)[_0xaa1b('0x10')](loggerCatch(_0xdb66cd));};exports['createCustomerFinal']=function(_0x1a8158,_0x4f701){moveContact(_0x1a8158)['catch'](loggerCatch(_0x4f701));};exports[_0xaa1b('0x19')]=function(_0x2f46f8,_0x138f15,_0x399dfe){if(_0x138f15){_0x2f46f8[_0xaa1b('0x1a')]=null;}if(_0x399dfe){_0x2f46f8[_0xaa1b('0x1b')]=![];}return BPromise['resolve']()['then'](cmHopper[_0xaa1b('0x19')](_0x2f46f8))[_0xaa1b('0x10')](loggerCatch(_0xaa1b('0x1c')));};exports[_0xaa1b('0x1d')]=function(_0xac6444){return BPromise[_0xaa1b('0xd')]()[_0xaa1b('0xe')](cmHopper[_0xaa1b('0x1d')](_0xac6444))[_0xaa1b('0x10')](loggerCatch('[countReScheduled]\x20'));};exports[_0xaa1b('0x1e')]=function(_0x108e25){return BPromise['resolve']()['then'](cmHopper[_0xaa1b('0x1e')]({'UserId':null},_0x108e25,0x1))[_0xaa1b('0x10')](loggerCatch('[unlockContact]\x20'));};exports[_0xaa1b('0x1f')]=function(_0x4f5b96){return BPromise[_0xaa1b('0xd')]()[_0xaa1b('0xe')](cmHopper['unlockContact']({'active':![]},_0x4f5b96,0x1))[_0xaa1b('0x10')](loggerCatch(_0xaa1b('0x20')));};exports['crateCustomerReportQueue']=function(_0x572761){var _0x3e6c1e={};_0x3e6c1e['type']=_0x572761[_0xaa1b('0x21')];_0x3e6c1e['uniqueid']=_0x572761[_0xaa1b('0x22')];_0x3e6c1e[_0xaa1b('0x23')]=_0x572761['calleridnum'];_0x3e6c1e[_0xaa1b('0x24')]=_0x572761[_0xaa1b('0x24')];_0x3e6c1e['queue']=_0x572761[_0xaa1b('0x25')];_0x3e6c1e['queuecallerjoinAt']=_0x572761['answertime'];_0x3e6c1e[_0xaa1b('0x26')]=_0x572761['answertime'];_0x3e6c1e[_0xaa1b('0x27')]=0x1;_0x3e6c1e['queuecallercompleteAt']=_0x572761[_0xaa1b('0x28')];_0x3e6c1e['connectedlinename']=_0x572761['membername'];_0x3e6c1e[_0xaa1b('0x29')]='from-sip';_0x3e6c1e['exten']=_0xaa1b('0x2a');_0x3e6c1e[_0xaa1b('0x2b')]=0x0;_0x3e6c1e[_0xaa1b('0x2c')]=0x1;_0x3e6c1e[_0xaa1b('0x2d')]=_0x572761[_0xaa1b('0x2e')];_0x3e6c1e[_0xaa1b('0x2f')]='COMPLETED';return BPromise[_0xaa1b('0xd')]()[_0xaa1b('0xe')](voiceQueueReport['create'](_0x3e6c1e))[_0xaa1b('0x10')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0xaa1b('0x30')]=function(_0x10d5a9,_0x563ba6){return BPromise[_0xaa1b('0xd')]()['then'](cmHopper[_0xaa1b('0x30')](_0x10d5a9,_0x563ba6))[_0xaa1b('0x10')](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x1d9fb9){return BPromise[_0xaa1b('0xd')]()[_0xaa1b('0xe')](cmHopper[_0xaa1b('0x19')](_0x1d9fb9,!![],!![]))[_0xaa1b('0x10')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index cc3eb3d..634bb4a 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 _0x22d3=['timeout','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','active','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','buildObj','interface','mandatoryDisposition','buildAcw','queue','agentReadyId','not_inuse','status','reachable','push','getDiff','createBody','CampaignId','idContact','type','dialAnswer','scheduledat','countbusyretry','callback','recallme','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','lodash','moment','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger2','info','message','getCallerId','isUndefined','isEmpty','format','string','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','\x22%s\x22\x20<%s>','calleridname','calleridnum','ContactId','VoiceQueueId','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','%s%s','XMD-','toUpper','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','starttime','responsetime','logAgent','statedesc','ringtime','logLookAgent','membername','UserId','logCustomer','endtime','talktime','answertime','isFailure','Failure','uniqueid','channelAgent','from-sip'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x22d3,0xc2));var _0x322d=function(_0x55c00d,_0x520cb6){_0x55c00d=_0x55c00d-0x0;var _0x254a8f=_0x22d3[_0x55c00d];return _0x254a8f;};'use strict';var util=require('util');var _=require(_0x322d('0x0'));var moment=require(_0x322d('0x1'));var logger=require('../../../../config/logger')('preview');var ipAgi=process[_0x322d('0x2')][_0x322d('0x3')]||_0x322d('0x4');function getSeconds(_0x452490,_0x2263cb){var _0x13201b=moment(_0x452490)[_0x322d('0x5')](0x0);var _0x1794b7=moment(_0x2263cb)['milliseconds'](0x0);return _0x13201b[_0x322d('0x6')](_0x1794b7,_0x322d('0x7'));}exports[_0x322d('0x8')]=function(_0x5aa7c3){return function(_0x2f18de){logger[_0x322d('0x9')](_0x5aa7c3,util['inspect'](_0x2f18de,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x40115a,_0x17f0f6){logger['info'](_0x40115a,util[_0x322d('0xa')](_0x17f0f6,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x393b8c,_0x3265e3){logger[_0x322d('0x9')](_0x393b8c,util[_0x322d('0xa')](_0x3265e3,{'showHidden':![],'depth':null}));};exports[_0x322d('0xb')]=function(_0x3e7b53){return function(_0x1f1ca8){logger[_0x322d('0xc')](_0x3e7b53,util[_0x322d('0xa')](_0x1f1ca8,{'showHidden':![],'depth':null}));};};exports[_0x322d('0xd')]=function(_0x32b830,_0x1cf70d,_0x439fd8){return{'message':_0x32b830,'unlock':_0x1cf70d,'active':_0x439fd8};};exports[_0x322d('0xe')]=function(_0x126ca5,_0x36dc0d,_0x5aed1a){if(!_[_0x322d('0xf')](_0x5aed1a)&&'string'===typeof _0x5aed1a&&!_[_0x322d('0x10')](_0x5aed1a)){if(!_[_0x322d('0xf')](_0x36dc0d)&&'string'===typeof _0x36dc0d&&!_[_0x322d('0x10')](_0x36dc0d)){return util[_0x322d('0x11')]('\x22%s\x22\x20<%s>',_0x36dc0d,_0x5aed1a);}return util[_0x322d('0x11')]('\x22%s\x22\x20<%s>',_0x5aed1a,_0x5aed1a);}if(!_['isUndefined'](_0x126ca5)&&_0x322d('0x12')===typeof _0x126ca5&&!_['isEmpty'](_0x126ca5)){return _0x126ca5;}return _0x322d('0x13');};exports[_0x322d('0x14')]=function(_0x241d18){if(_[_0x322d('0x15')](_0x241d18)){return![];}return _0x241d18;};exports[_0x322d('0x16')]=function(_0x3a77f8,_0x457642,_0x1c0202,_0x4394eb,_0x2ca67b,_0x11b405){var _0xdba3cc={'XMD-QUEUE':_0x457642[_0x322d('0x17')]?_0x457642['Queue'][_0x322d('0x18')]:'','XMD-CALLERID':_0x4394eb,'XMD-CALLERID-PREVIEW':_0x11b405?util[_0x322d('0x11')](_0x322d('0x19'),_0x11b405[_0x322d('0x1a')],_0x11b405[_0x322d('0x1b')]):_0x4394eb,'XMD-DIALID':_0x2ca67b,'XMD-CONTACTID':_0x457642[_0x322d('0x1c')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x4394eb,'XMD-VOICEQUEUEID':_0x457642[_0x322d('0x1d')],'XMD-DIALCHANNEL':_0x1c0202,'XMD-DIALTIMEOUT':_0x3a77f8['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x322d('0x11')]('\x22rtTxX%s%s\x22',_0x3a77f8[_0x322d('0x1e')]?'g':'',_[_0x322d('0x10')](_0x3a77f8[_0x322d('0x1f')])?'':_0x322d('0x20')),'XMD-DIALURL':_0x3a77f8['dialPreviewUrl']||'','XMD-AGI':_0x3a77f8[_0x322d('0x21')]?util[_0x322d('0x11')](_0x322d('0x22'),ipAgi,_0x3a77f8[_0x322d('0x21')]):'NONE','XMD-AGIAFTER':_0x3a77f8[_0x322d('0x1e')]?util[_0x322d('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3a77f8['dialQueueProject2']):_0x322d('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x11b405?_0x11b405[_0x322d('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x11b405?_0x11b405[_0x322d('0x25')]:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_['isEmpty'](_0x3a77f8[_0x322d('0x1f')])){_0xdba3cc[util[_0x322d('0x11')]('%s',_0x322d('0x26'))]=_0x3a77f8[_0x322d('0x1f')];_0xdba3cc[util[_0x322d('0x11')]('%s',_0x322d('0x27'))]=_0x2ca67b;}if(_0x457642&&_0x457642['Contact']){for(var _0x6b516f in _0x457642[_0x322d('0x28')]){if(_0x457642[_0x322d('0x28')][_0x322d('0x29')](_0x6b516f)){if(!_[_0x322d('0x15')](_0x457642['Contact'][_0x6b516f])&&_0x6b516f!=='id'&&_0x6b516f!==_0x322d('0x2a')&&_0x6b516f!=='createdAt'&&_0x6b516f!=='updatedAt'){_0xdba3cc[util[_0x322d('0x11')](_0x322d('0x2b'),_0x322d('0x2c'),_[_0x322d('0x2d')](_0x6b516f))]=_0x457642[_0x322d('0x28')][_0x6b516f];}}}}return _0xdba3cc;};exports['toLowerVariables']=function(_0x548eaa){var _0x9cb772={};for(var _0x48e8d5 in _0x548eaa){if(_0x548eaa['hasOwnProperty'](_0x48e8d5)){_0x9cb772[util[_0x322d('0x11')]('%s',_['toLower'](_0x48e8d5))]=_0x548eaa[_0x48e8d5];}}return{'variables':_0x9cb772};};exports[_0x322d('0x2e')]=function(_0x490361,_0x3331c0){if(!_[_0x322d('0x15')](_0x490361)){if(_0x490361['hasOwnProperty'](_0x322d('0x2f'))){if(_0x490361[_0x322d('0x2f')]>0x0){_0x490361[_0x322d('0x2f')]-=0x1;}else{logger[_0x322d('0x9')](_0x322d('0x30'),_0x3331c0);}}}else{logger[_0x322d('0x9')](_0x322d('0x31'),_0x3331c0);}};exports[_0x322d('0x32')]=function(_0x51874f){var _0x5ccc01=moment()[_0x322d('0x11')](_0x322d('0x33'));_0x51874f[_0x322d('0x34')]=0xd;_0x51874f['statedesc']='Blacklist';_0x51874f[_0x322d('0x35')]=_0x5ccc01;_0x51874f[_0x322d('0x36')]=_0x5ccc01;_0x51874f['endtime']=_0x5ccc01;};exports[_0x322d('0x37')]=function(_0x21fba2,_0x11b25c,_0x504522){var _0x38c2f7=moment()[_0x322d('0x11')](_0x322d('0x33'));_0x21fba2['state']=_0x11b25c;_0x21fba2[_0x322d('0x38')]=_0x504522;_0x21fba2[_0x322d('0x36')]=_0x38c2f7;_0x21fba2[_0x322d('0x39')]=getSeconds(_0x21fba2[_0x322d('0x36')],_0x21fba2[_0x322d('0x35')]);};exports[_0x322d('0x3a')]=function(_0x6d5721,_0x5c55e6,_0x35640c){_0x6d5721[_0x322d('0x3b')]=_0x5c55e6;_0x6d5721[_0x322d('0x3c')]=_0x35640c;};exports[_0x322d('0x3d')]=function(_0xe54eae,_0x3219cb,_0x5d5440){var _0x4a39f3=moment()[_0x322d('0x11')](_0x322d('0x33'));_0xe54eae[_0x322d('0x34')]=_0x3219cb;_0xe54eae[_0x322d('0x38')]=_0x5d5440;_0xe54eae[_0x322d('0x36')]=_0xe54eae['responsetime']?_0xe54eae[_0x322d('0x36')]:_0x4a39f3;_0xe54eae[_0x322d('0x3e')]=_0xe54eae[_0x322d('0x3e')]?_0xe54eae[_0x322d('0x3e')]:_0x4a39f3;_0xe54eae[_0x322d('0x39')]=getSeconds(_0xe54eae[_0x322d('0x36')]||0x0,_0xe54eae[_0x322d('0x35')]||0x0);_0xe54eae[_0x322d('0x3f')]=_0xe54eae[_0x322d('0x40')]?getSeconds(_0xe54eae[_0x322d('0x3e')],_0xe54eae[_0x322d('0x40')]):0x0;};exports[_0x322d('0x41')]=function(_0x3e45bd){return _0x3e45bd===_0x322d('0x42');};exports['variablesAction']=function(_0x2dcee7,_0x5ae8a3,_0x38c4df,_0xcb432f,_0x5b363e){var _0x156136=_0xcb432f?'RECALL':_0x2dcee7[_0x322d('0x1a')];_0x156136=_0x5b363e?'BOOKED':_0x156136;return{'actionid':_0x2dcee7[_0x322d('0x43')],'action':'originate','channel':_0x2dcee7[_0x322d('0x44')],'callerid':util[_0x322d('0x11')](_0x322d('0x19'),_0x156136,_0x2dcee7[_0x322d('0x1b')]),'Exten':'xcally-motion-preview','Context':_0x322d('0x45'),'Priority':'1','variable':_0x38c4df,'timeout':(_0x5ae8a3[_0x322d('0x46')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2dcee7[_0x322d('0x43')]};};exports['totalGlobal']=function(_0x3cecde){return _0x3cecde['countbusyretry']+_0x3cecde[_0x322d('0x47')]+_0x3cecde[_0x322d('0x48')]+_0x3cecde[_0x322d('0x49')]+_0x3cecde[_0x322d('0x4a')];};exports[_0x322d('0x4b')]=function(_0x22fd53){var _0x40d6bd=_[_0x322d('0x4c')](_0x22fd53);_0x40d6bd['state']=0xf;_0x40d6bd[_0x322d('0x38')]=_0x322d('0x4d');return _0x40d6bd;};exports['scheduledAt']=function(_0x4d75b4,_0x3b17bd,_0x1d5b74){var _0x478f53={};_0x478f53[_0x3b17bd]=_0x4d75b4[_0x3b17bd];_0x478f53[_0x322d('0x4e')]=![];_0x478f53['scheduledat']=moment()['add'](_0x1d5b74,'minutes')['format'](_0x322d('0x33'));_0x478f53[_0x322d('0x1c')]=_0x4d75b4['ContactId'];_0x478f53[_0x322d('0x4f')]=_0x4d75b4[_0x322d('0x4f')];_0x478f53[_0x322d('0x1d')]=_0x4d75b4[_0x322d('0x1d')]||undefined;return _0x478f53;};exports[_0x322d('0x50')]=function(_0x1cd2ee,_0x24c1ec){if(!_[_0x322d('0x15')](_0x1cd2ee)){if(_0x1cd2ee[_0x322d('0x51')]>0x0){_0x1cd2ee[_0x322d('0x51')]-=0x1;}else{logger[_0x322d('0x9')](_0x24c1ec,_0x322d('0x52'));}}else{logger[_0x322d('0x9')](_0x24c1ec,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x430088){if(_0x430088<=0x0){return!![];}return![];};exports[_0x322d('0x53')]=function(_0x23b674,_0x36d8c1,_0x13b8d7){_0x23b674['lastevent']=_0x36d8c1;_0x23b674[_0x322d('0x18')]=_0x23b674['queue'];_0x23b674[_0x322d('0x54')]=_0x23b674['channelAgent'];if(_0x13b8d7){_0x23b674[_0x322d('0x55')]=_0x13b8d7[_0x322d('0x55')];}return _0x23b674;};exports[_0x322d('0x56')]=function(_0x44d8fd){var _0x4efe77={};_0x4efe77[_0x322d('0x57')]=_0x44d8fd[_0x322d('0x57')];_0x4efe77[_0x322d('0x54')]=_0x44d8fd['channelAgent'];_0x4efe77['uniqueid']=_0x44d8fd['uniqueid'];return _0x4efe77;};exports[_0x322d('0x58')]=function(_0x54b2f4){var _0x3d6619=[];for(var _0x320a23 in _0x54b2f4){if(_0x54b2f4['hasOwnProperty'](_0x320a23)){if(!_[_0x322d('0x15')](_0x54b2f4[_0x320a23])&&_0x54b2f4[_0x320a23][_0x322d('0x34')]===_0x322d('0x59')&&_0x54b2f4[_0x320a23][_0x322d('0x5a')]===_0x322d('0x5b')){_0x3d6619[_0x322d('0x5c')](_0x54b2f4[_0x320a23]['id']);}}}return _0x3d6619;};exports[_0x322d('0x5d')]=function(_0x1ccefd){var _0xe495ce=moment()['milliseconds'](0x0);var _0x574254=moment(_0x1ccefd)[_0x322d('0x5')](0x0);return _0xe495ce[_0x322d('0x6')](_0x574254,_0x322d('0x7'));};exports[_0x322d('0x5e')]=function(_0x19e343){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x19e343[_0x322d('0x1c')],'ListId':_0x19e343[_0x322d('0x4f')],'VoiceQueueId':_0x19e343[_0x322d('0x1d')]||undefined,'CampaignId':_0x19e343[_0x322d('0x5f')]||undefined};};exports['filterKey']=function(_0x345cfc){if(_0x345cfc===_0x322d('0x43')||_0x345cfc===_0x322d('0x60')||_0x345cfc===_0x322d('0x57')||_0x345cfc===_0x322d('0x61')||_0x345cfc==='campaigntype'||_0x345cfc===_0x322d('0x62')||_0x345cfc==='membername'||_0x345cfc==='channelAgent'||_0x345cfc===_0x322d('0x1a')||_0x345cfc===_0x322d('0x4e')||_0x345cfc===_0x322d('0x1b')||_0x345cfc===_0x322d('0x63')||_0x345cfc===_0x322d('0x64')||_0x345cfc===_0x322d('0x47')||_0x345cfc===_0x322d('0x48')||_0x345cfc==='countglobal'||_0x345cfc===_0x322d('0x65')||_0x345cfc==='callbackuniqueid'||_0x345cfc==='callbackat'||_0x345cfc===_0x322d('0x66')||_0x345cfc===_0x322d('0x1c')||_0x345cfc===_0x322d('0x4f')||_0x345cfc===_0x322d('0x3c')||_0x345cfc===_0x322d('0x1d')||_0x345cfc==='sipcallid'||_0x345cfc===_0x322d('0x67')||_0x345cfc==='xmd-queue'||_0x345cfc===_0x322d('0x68')||_0x345cfc===_0x322d('0x69')||_0x345cfc===_0x322d('0x6a')||_0x345cfc===_0x322d('0x6b')||_0x345cfc===_0x322d('0x6c')||_0x345cfc==='xmd-dialid'||_0x345cfc===_0x322d('0x6d')||_0x345cfc===_0x322d('0x6e')||_0x345cfc===_0x322d('0x6f')||_0x345cfc===_0x322d('0x70')||_0x345cfc===_0x322d('0x71')||_0x345cfc===_0x322d('0x72')||_0x345cfc===_0x322d('0x73')||_0x345cfc==='rtpaudioqosbridged'||_0x345cfc===_0x322d('0x74')||_0x345cfc===_0x322d('0x75')||_0x345cfc===_0x322d('0x76')||_0x345cfc==='rtpaudioqoslossbridged'||_0x345cfc==='rtpaudioqosrtt'||_0x345cfc===_0x322d('0x77')||_0x345cfc===_0x322d('0x73')||_0x345cfc==='rtpaudioqosbridged'||_0x345cfc===_0x322d('0x74')||_0x345cfc===_0x322d('0x75')||_0x345cfc===_0x322d('0x76')||_0x345cfc===_0x322d('0x78')||_0x345cfc===_0x322d('0x79')||_0x345cfc===_0x322d('0x77')||_0x345cfc===_0x322d('0x7a')||_0x345cfc===_0x322d('0x7b')||_0x345cfc===_0x322d('0x34')||_0x345cfc==='statedesc'){return![];}return!![];};exports[_0x322d('0x7c')]=function(_0x939353,_0x420e90){var _0x45419a,_0x1fdcd5,_0x4d92d7;if(_0x420e90<=0x0){_0x420e90=0x1;}_0x45419a=new RegExp(_0x322d('0x7d')+_0x420e90+'}$');_0x1fdcd5=Math[_0x322d('0x7e')](0xa,_0x420e90-0x1);_0x4d92d7=Math[_0x322d('0x7e')](0xa,_0x420e90)-0x1;return util['format']('%s',_[_0x322d('0x7f')](_0x939353,_0x45419a,_[_0x322d('0x80')](_0x1fdcd5,_0x4d92d7)));};exports[_0x322d('0x81')]=function(_0x2b8c1c){var _0x2d572e=_0x2b8c1c[_0x322d('0x82')](/"(.*?)"/);return _0x2d572e?_0x2d572e[0x1]:_0x2b8c1c;};exports[_0x322d('0x83')]=function(_0x2a0dc8){var _0x4423f9=_0x2a0dc8[_0x322d('0x82')](/<(.*?)>/);return _0x4423f9?_0x4423f9[0x1]:_0x2a0dc8;}; \ No newline at end of file +var _0xdafa=['addVariables','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','membername','UserId','answertime','RECALL','calleridname','BOOKED','uniqueid','originate','channelAgent','xcally-motion-preview','timeout','countbusyretry','countcongestionretry','statedesc','Global','scheduledAt','scheduledat','add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','mandatoryDisposition','buildAcw','agentReadyId','reachable','push','getDiff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','active','countnoanswerretry','callback','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','logger','inspect','logger2','info','message','string','isUndefined','isEmpty','format','\x22%s\x22\x20<%s>','isNil'];(function(_0x516927,_0xb4aad0){var _0x30749b=function(_0x2ca6cc){while(--_0x2ca6cc){_0x516927['push'](_0x516927['shift']());}};_0x30749b(++_0xb4aad0);}(_0xdafa,0x72));var _0xadaf=function(_0x538505,_0x3010e4){_0x538505=_0x538505-0x0;var _0x46c0a9=_0xdafa[_0x538505];return _0x46c0a9;};'use strict';var util=require(_0xadaf('0x0'));var _=require(_0xadaf('0x1'));var moment=require(_0xadaf('0x2'));var logger=require(_0xadaf('0x3'))(_0xadaf('0x4'));var ipAgi=process[_0xadaf('0x5')][_0xadaf('0x6')]||_0xadaf('0x7');function getSeconds(_0xbdf719,_0x429eb7){var _0x31a448=moment(_0xbdf719)[_0xadaf('0x8')](0x0);var _0x18c23f=moment(_0x429eb7)[_0xadaf('0x8')](0x0);return _0x31a448[_0xadaf('0x9')](_0x18c23f,_0xadaf('0xa'));}exports[_0xadaf('0xb')]=function(_0x2315fa){return function(_0x578637){logger[_0xadaf('0xc')](_0x2315fa,util['inspect'](_0x578637,{'showHidden':![],'depth':null}));};};exports[_0xadaf('0xd')]=function(_0x3dbfb7,_0x1fee44){logger['info'](_0x3dbfb7,util[_0xadaf('0xe')](_0x1fee44,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x352a9b,_0x31ff8e){logger[_0xadaf('0xc')](_0x352a9b,util[_0xadaf('0xe')](_0x31ff8e,{'showHidden':![],'depth':null}));};exports[_0xadaf('0xf')]=function(_0x175ce0){return function(_0x11d21f){logger[_0xadaf('0x10')](_0x175ce0,util[_0xadaf('0xe')](_0x11d21f,{'showHidden':![],'depth':null}));};};exports[_0xadaf('0x11')]=function(_0x3ddf0e,_0x273396,_0x6a6082){return{'message':_0x3ddf0e,'unlock':_0x273396,'active':_0x6a6082};};exports['getCallerId']=function(_0x223d92,_0x2a576d,_0x6c2faa){if(!_['isUndefined'](_0x6c2faa)&&_0xadaf('0x12')===typeof _0x6c2faa&&!_['isEmpty'](_0x6c2faa)){if(!_[_0xadaf('0x13')](_0x2a576d)&&_0xadaf('0x12')===typeof _0x2a576d&&!_[_0xadaf('0x14')](_0x2a576d)){return util[_0xadaf('0x15')](_0xadaf('0x16'),_0x2a576d,_0x6c2faa);}return util[_0xadaf('0x15')](_0xadaf('0x16'),_0x6c2faa,_0x6c2faa);}if(!_[_0xadaf('0x13')](_0x223d92)&&'string'===typeof _0x223d92&&!_[_0xadaf('0x14')](_0x223d92)){return _0x223d92;}return'\x22\x22\x20<>';};exports['isActive']=function(_0x15c638){if(_[_0xadaf('0x17')](_0x15c638)){return![];}return _0x15c638;};exports[_0xadaf('0x18')]=function(_0x5d6695,_0x634f01,_0x5a6c94,_0x4305b2,_0x535db5,_0x214f6a){var _0x1152eb={'XMD-QUEUE':_0x634f01[_0xadaf('0x19')]?_0x634f01[_0xadaf('0x19')][_0xadaf('0x1a')]:'','XMD-CALLERID':_0x4305b2,'XMD-CALLERID-PREVIEW':_0x214f6a?util[_0xadaf('0x15')](_0xadaf('0x16'),_0x214f6a['calleridname'],_0x214f6a[_0xadaf('0x1b')]):_0x4305b2,'XMD-DIALID':_0x535db5,'XMD-CONTACTID':_0x634f01[_0xadaf('0x1c')],'XMD-CDRTYPE':_0xadaf('0x1d'),'CALLERID(all)':_0x4305b2,'XMD-VOICEQUEUEID':_0x634f01[_0xadaf('0x1e')],'XMD-DIALCHANNEL':_0x5a6c94,'XMD-DIALTIMEOUT':_0x5d6695[_0xadaf('0x1f')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0xadaf('0x20'),_0x5d6695[_0xadaf('0x21')]?'g':'',_['isEmpty'](_0x5d6695[_0xadaf('0x22')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x5d6695[_0xadaf('0x23')]||'','XMD-AGI':_0x5d6695[_0xadaf('0x24')]?util[_0xadaf('0x15')](_0xadaf('0x25'),ipAgi,_0x5d6695[_0xadaf('0x24')]):_0xadaf('0x26'),'XMD-AGIAFTER':_0x5d6695['dialQueueProject2']?util['format'](_0xadaf('0x25'),ipAgi,_0x5d6695[_0xadaf('0x21')]):_0xadaf('0x26'),'XMD-ORIGINATECALLERIDNUM':_0x214f6a?_0x214f6a[_0xadaf('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x214f6a?_0x214f6a[_0xadaf('0x28')]:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_['isEmpty'](_0x5d6695[_0xadaf('0x22')])){_0x1152eb[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x5d6695['monitor_format'];_0x1152eb[util[_0xadaf('0x15')]('%s',_0xadaf('0x29'))]=_0x535db5;}if(_0x634f01&&_0x634f01[_0xadaf('0x2a')]){for(var _0x15ce35 in _0x634f01[_0xadaf('0x2a')]){if(_0x634f01[_0xadaf('0x2a')][_0xadaf('0x2b')](_0x15ce35)){if(!_[_0xadaf('0x17')](_0x634f01[_0xadaf('0x2a')][_0x15ce35])&&_0x15ce35!=='id'&&_0x15ce35!==_0xadaf('0x2c')&&_0x15ce35!==_0xadaf('0x2d')&&_0x15ce35!==_0xadaf('0x2e')){_0x1152eb[util['format'](_0xadaf('0x2f'),_0xadaf('0x30'),_[_0xadaf('0x31')](_0x15ce35))]=_0x634f01[_0xadaf('0x2a')][_0x15ce35];}}}}return _0x1152eb;};exports[_0xadaf('0x32')]=function(_0x9b9acf){var _0x51afd7={};for(var _0x213009 in _0x9b9acf){if(_0x9b9acf[_0xadaf('0x2b')](_0x213009)){_0x51afd7[util[_0xadaf('0x15')]('%s',_['toLower'](_0x213009))]=_0x9b9acf[_0x213009];}}return{'variables':_0x51afd7};};exports[_0xadaf('0x33')]=function(_0xb388f4,_0x1011a1){if(!_['isNil'](_0xb388f4)){if(_0xb388f4[_0xadaf('0x2b')](_0xadaf('0x34'))){if(_0xb388f4[_0xadaf('0x34')]>0x0){_0xb388f4['originated']-=0x1;}else{logger['error'](_0xadaf('0x35'),_0x1011a1);}}}else{logger[_0xadaf('0xc')](_0xadaf('0x36'),_0x1011a1);}};exports[_0xadaf('0x37')]=function(_0xc4b334){var _0x10cbdc=moment()[_0xadaf('0x15')](_0xadaf('0x38'));_0xc4b334[_0xadaf('0x39')]=0xd;_0xc4b334['statedesc']='Blacklist';_0xc4b334[_0xadaf('0x3a')]=_0x10cbdc;_0xc4b334[_0xadaf('0x3b')]=_0x10cbdc;_0xc4b334[_0xadaf('0x3c')]=_0x10cbdc;};exports[_0xadaf('0x3d')]=function(_0x6df129,_0x1b8cf9,_0x46a4a9){var _0x51313c=moment()[_0xadaf('0x15')](_0xadaf('0x38'));_0x6df129[_0xadaf('0x39')]=_0x1b8cf9;_0x6df129['statedesc']=_0x46a4a9;_0x6df129[_0xadaf('0x3b')]=_0x51313c;_0x6df129[_0xadaf('0x3e')]=getSeconds(_0x6df129[_0xadaf('0x3b')],_0x6df129[_0xadaf('0x3a')]);};exports[_0xadaf('0x3f')]=function(_0x215f4b,_0xdb8449,_0xea0d83){_0x215f4b[_0xadaf('0x40')]=_0xdb8449;_0x215f4b[_0xadaf('0x41')]=_0xea0d83;};exports['logCustomer']=function(_0x3b92b1,_0x2c6d54,_0x2bf354){var _0x574e37=moment()[_0xadaf('0x15')](_0xadaf('0x38'));_0x3b92b1[_0xadaf('0x39')]=_0x2c6d54;_0x3b92b1['statedesc']=_0x2bf354;_0x3b92b1[_0xadaf('0x3b')]=_0x3b92b1[_0xadaf('0x3b')]?_0x3b92b1['responsetime']:_0x574e37;_0x3b92b1[_0xadaf('0x3c')]=_0x3b92b1[_0xadaf('0x3c')]?_0x3b92b1[_0xadaf('0x3c')]:_0x574e37;_0x3b92b1[_0xadaf('0x3e')]=getSeconds(_0x3b92b1[_0xadaf('0x3b')]||0x0,_0x3b92b1[_0xadaf('0x3a')]||0x0);_0x3b92b1['talktime']=_0x3b92b1[_0xadaf('0x42')]?getSeconds(_0x3b92b1[_0xadaf('0x3c')],_0x3b92b1[_0xadaf('0x42')]):0x0;};exports['isFailure']=function(_0x1d11ea){return _0x1d11ea==='Failure';};exports['variablesAction']=function(_0x2e517e,_0x5c9453,_0x4de256,_0x1681eb,_0x544e9d){var _0x400a55=_0x1681eb?_0xadaf('0x43'):_0x2e517e[_0xadaf('0x44')];_0x400a55=_0x544e9d?_0xadaf('0x45'):_0x400a55;return{'actionid':_0x2e517e[_0xadaf('0x46')],'action':_0xadaf('0x47'),'channel':_0x2e517e[_0xadaf('0x48')],'callerid':util[_0xadaf('0x15')](_0xadaf('0x16'),_0x400a55,_0x2e517e[_0xadaf('0x1b')]),'Exten':_0xadaf('0x49'),'Context':'from-sip','Priority':'1','variable':_0x4de256,'timeout':(_0x5c9453[_0xadaf('0x4a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2e517e[_0xadaf('0x46')]};};exports['totalGlobal']=function(_0xd1729b){return _0xd1729b[_0xadaf('0x4b')]+_0xd1729b[_0xadaf('0x4c')]+_0xd1729b['countnoanswerretry']+_0xd1729b['countagentrejectretry']+_0xd1729b['countnosuchnumberretry'];};exports['cloneAction']=function(_0x4d1c68){var _0xe6828a=_['clone'](_0x4d1c68);_0xe6828a['state']=0xf;_0xe6828a[_0xadaf('0x4d')]=_0xadaf('0x4e');return _0xe6828a;};exports[_0xadaf('0x4f')]=function(_0x4e0e7a,_0x19ff4e,_0x20c453){var _0x1a08c8={};_0x1a08c8[_0x19ff4e]=_0x4e0e7a[_0x19ff4e];_0x1a08c8['active']=![];_0x1a08c8[_0xadaf('0x50')]=moment()[_0xadaf('0x51')](_0x20c453,'minutes')[_0xadaf('0x15')](_0xadaf('0x38'));_0x1a08c8[_0xadaf('0x1c')]=_0x4e0e7a[_0xadaf('0x1c')];_0x1a08c8['ListId']=_0x4e0e7a[_0xadaf('0x52')];_0x1a08c8[_0xadaf('0x1e')]=_0x4e0e7a['VoiceQueueId']||undefined;return _0x1a08c8;};exports[_0xadaf('0x53')]=function(_0x287f6d,_0x27c66d){if(!_[_0xadaf('0x17')](_0x287f6d)){if(_0x287f6d[_0xadaf('0x54')]>0x0){_0x287f6d[_0xadaf('0x54')]-=0x1;}else{logger[_0xadaf('0xc')](_0x27c66d,_0xadaf('0x55'));}}else{logger[_0xadaf('0xc')](_0x27c66d,_0xadaf('0x56'));}};exports[_0xadaf('0x57')]=function(_0x3aec68){if(_0x3aec68<=0x0){return!![];}return![];};exports[_0xadaf('0x58')]=function(_0x5eebe1,_0x6ad0d5,_0x311c79){_0x5eebe1[_0xadaf('0x59')]=_0x6ad0d5;_0x5eebe1['name']=_0x5eebe1[_0xadaf('0x5a')];_0x5eebe1[_0xadaf('0x5b')]=_0x5eebe1[_0xadaf('0x48')];if(_0x311c79){_0x5eebe1[_0xadaf('0x5c')]=_0x311c79[_0xadaf('0x5c')];}return _0x5eebe1;};exports[_0xadaf('0x5d')]=function(_0x4331b0){var _0x492a44={};_0x492a44[_0xadaf('0x5a')]=_0x4331b0[_0xadaf('0x5a')];_0x492a44[_0xadaf('0x5b')]=_0x4331b0[_0xadaf('0x48')];_0x492a44[_0xadaf('0x46')]=_0x4331b0['uniqueid'];return _0x492a44;};exports[_0xadaf('0x5e')]=function(_0x58c58b){var _0x1c1bb3=[];for(var _0x26bdb1 in _0x58c58b){if(_0x58c58b[_0xadaf('0x2b')](_0x26bdb1)){if(!_[_0xadaf('0x17')](_0x58c58b[_0x26bdb1])&&_0x58c58b[_0x26bdb1][_0xadaf('0x39')]==='not_inuse'&&_0x58c58b[_0x26bdb1]['status']===_0xadaf('0x5f')){_0x1c1bb3[_0xadaf('0x60')](_0x58c58b[_0x26bdb1]['id']);}}}return _0x1c1bb3;};exports[_0xadaf('0x61')]=function(_0x5ac2b5){var _0x31ade9=moment()['milliseconds'](0x0);var _0x411333=moment(_0x5ac2b5)['milliseconds'](0x0);return _0x31ade9['diff'](_0x411333,_0xadaf('0xa'));};exports[_0xadaf('0x62')]=function(_0x1308be){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1308be[_0xadaf('0x1c')],'ListId':_0x1308be[_0xadaf('0x52')],'VoiceQueueId':_0x1308be[_0xadaf('0x1e')]||undefined,'CampaignId':_0x1308be[_0xadaf('0x63')]||undefined};};exports[_0xadaf('0x64')]=function(_0x65e487){if(_0x65e487===_0xadaf('0x46')||_0x65e487===_0xadaf('0x65')||_0x65e487===_0xadaf('0x5a')||_0x65e487===_0xadaf('0x66')||_0x65e487===_0xadaf('0x67')||_0x65e487===_0xadaf('0x68')||_0x65e487==='membername'||_0x65e487===_0xadaf('0x48')||_0x65e487===_0xadaf('0x44')||_0x65e487===_0xadaf('0x69')||_0x65e487==='calleridnum'||_0x65e487===_0xadaf('0x50')||_0x65e487===_0xadaf('0x4b')||_0x65e487===_0xadaf('0x4c')||_0x65e487===_0xadaf('0x6a')||_0x65e487==='countglobal'||_0x65e487===_0xadaf('0x6b')||_0x65e487==='callbackuniqueid'||_0x65e487==='callbackat'||_0x65e487===_0xadaf('0x6c')||_0x65e487===_0xadaf('0x1c')||_0x65e487===_0xadaf('0x52')||_0x65e487===_0xadaf('0x41')||_0x65e487===_0xadaf('0x1e')||_0x65e487===_0xadaf('0x6d')||_0x65e487===_0xadaf('0x6e')||_0x65e487===_0xadaf('0x6f')||_0x65e487===_0xadaf('0x70')||_0x65e487===_0xadaf('0x71')||_0x65e487===_0xadaf('0x72')||_0x65e487===_0xadaf('0x73')||_0x65e487===_0xadaf('0x74')||_0x65e487==='xmd-dialid'||_0x65e487===_0xadaf('0x75')||_0x65e487===_0xadaf('0x76')||_0x65e487==='xmd-cdrtype'||_0x65e487===_0xadaf('0x77')||_0x65e487===_0xadaf('0x78')||_0x65e487===_0xadaf('0x79')||_0x65e487===_0xadaf('0x7a')||_0x65e487===_0xadaf('0x7b')||_0x65e487===_0xadaf('0x7c')||_0x65e487===_0xadaf('0x7d')||_0x65e487===_0xadaf('0x7e')||_0x65e487===_0xadaf('0x7f')||_0x65e487===_0xadaf('0x80')||_0x65e487===_0xadaf('0x81')||_0x65e487===_0xadaf('0x7a')||_0x65e487===_0xadaf('0x7b')||_0x65e487===_0xadaf('0x7c')||_0x65e487===_0xadaf('0x7d')||_0x65e487===_0xadaf('0x7e')||_0x65e487==='rtpaudioqoslossbridged'||_0x65e487===_0xadaf('0x80')||_0x65e487===_0xadaf('0x81')||_0x65e487===_0xadaf('0x82')||_0x65e487===_0xadaf('0x83')||_0x65e487===_0xadaf('0x39')||_0x65e487===_0xadaf('0x4d')){return![];}return!![];};exports[_0xadaf('0x84')]=function(_0x54911a,_0x180b24){var _0x3e75fc,_0x90f693,_0x1495c8;if(_0x180b24<=0x0){_0x180b24=0x1;}_0x3e75fc=new RegExp(_0xadaf('0x85')+_0x180b24+'}$');_0x90f693=Math[_0xadaf('0x86')](0xa,_0x180b24-0x1);_0x1495c8=Math[_0xadaf('0x86')](0xa,_0x180b24)-0x1;return util[_0xadaf('0x15')]('%s',_['replace'](_0x54911a,_0x3e75fc,_[_0xadaf('0x87')](_0x90f693,_0x1495c8)));};exports[_0xadaf('0x88')]=function(_0x240069){var _0xa619a1=_0x240069[_0xadaf('0x89')](/"(.*?)"/);return _0xa619a1?_0xa619a1[0x1]:_0x240069;};exports['extractCalleridNumber']=function(_0x50a7be){var _0x16aa72=_0x50a7be[_0xadaf('0x89')](/<(.*?)>/);return _0x16aa72?_0x16aa72[0x1]:_0x50a7be;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 2c6475c..6a8f983 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 _0xd599=['queueadd','string','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect'];(function(_0x79975,_0x241aa1){var _0x2e4481=function(_0x5eb390){while(--_0x5eb390){_0x79975['push'](_0x79975['shift']());}};_0x2e4481(++_0x241aa1);}(_0xd599,0xc6));var _0x9d59=function(_0x34a1f3,_0x518c98){_0x34a1f3=_0x34a1f3-0x0;var _0x537ac4=_0xd599[_0x34a1f3];return _0x537ac4;};'use strict';exports[_0x9d59('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x9d59('0x1'),'required':!![]},'membername':{'type':_0x9d59('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x9d59('0x2'),'required':![]}};exports[_0x9d59('0x3')]={'queue':{'type':_0x9d59('0x1'),'required':!![]},'interface':{'type':_0x9d59('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':'string','required':!![]},'paused':{'type':_0x9d59('0x2')},'reason':{'type':_0x9d59('0x1'),'required':![]}};exports[_0x9d59('0x4')]={'module':{'type':_0x9d59('0x1'),'required':![]}};exports[_0x9d59('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x9d59('0x6')]={'uniqueid':{'type':_0x9d59('0x1'),'required':!![]},'filename':{'type':_0x9d59('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x9d59('0x1')}};exports[_0x9d59('0x7')]={'uniqueid':{'type':_0x9d59('0x1'),'required':!![]}};exports[_0x9d59('0x8')]={'uniqueid':{'type':_0x9d59('0x1'),'required':!![]},'exten':{'type':_0x9d59('0x1'),'required':!![]},'context':{'type':_0x9d59('0x1')}}; \ No newline at end of file +var _0xa3d8=['queueremove','queuepause','boolean','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string','number'];(function(_0x25b439,_0xb20872){var _0xbf2210=function(_0x518b01){while(--_0x518b01){_0x25b439['push'](_0x25b439['shift']());}};_0xbf2210(++_0xb20872);}(_0xa3d8,0x1f1));var _0x8a3d=function(_0x443b9e,_0x23e7ab){_0x443b9e=_0x443b9e-0x0;var _0xd39d56=_0xa3d8[_0x443b9e];return _0xd39d56;};'use strict';exports[_0x8a3d('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x8a3d('0x1'),'required':!![]},'membername':{'type':_0x8a3d('0x1'),'required':!![]},'penalty':{'type':_0x8a3d('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x8a3d('0x3')]={'queue':{'type':_0x8a3d('0x1'),'required':!![]},'interface':{'type':_0x8a3d('0x1'),'required':!![]}};exports[_0x8a3d('0x4')]={'interface':{'type':_0x8a3d('0x1'),'required':!![]},'paused':{'type':_0x8a3d('0x5')},'reason':{'type':_0x8a3d('0x1'),'required':![]}};exports[_0x8a3d('0x6')]={'module':{'type':_0x8a3d('0x1'),'required':![]}};exports[_0x8a3d('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x8a3d('0x8')]={'uniqueid':{'type':_0x8a3d('0x1'),'required':!![]},'filename':{'type':_0x8a3d('0x1')},'format':{'type':_0x8a3d('0x1')},'mixmonitorid':{'type':_0x8a3d('0x1')}};exports[_0x8a3d('0x9')]={'uniqueid':{'type':_0x8a3d('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x8a3d('0x1'),'required':!![]},'exten':{'type':_0x8a3d('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 5f3fd41..229fff7 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 _0xe03e=['../model/faxAccount','agents','telephones','trunks','triggers','campaigns','voiceExtensions','channels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','isNil','interface','format','SIP/%s','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','mergeFromDatabase','prototype','initAgents','length','name','isUndefined','initTelephones','initTrunks','initVoiceQueues','voiceQueues','initTriggers','templates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','uniqueid','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','exports','bluebird','util','lodash','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount'];(function(_0x521458,_0xf9ff33){var _0x3f2f16=function(_0x441a76){while(--_0x441a76){_0x521458['push'](_0x521458['shift']());}};_0x3f2f16(++_0xf9ff33);}(_0xe03e,0x19d));var _0xee03=function(_0x42676b,_0x5ff2f2){_0x42676b=_0x42676b-0x0;var _0xc4889=_0xe03e[_0x42676b];return _0xc4889;};'use strict';var BPromise=require(_0xee03('0x0'));var util=require(_0xee03('0x1'));var _=require(_0xee03('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Telephone=require(_0xee03('0x3'));var Trunk=require(_0xee03('0x4'));var VoiceQueue=require(_0xee03('0x5'));var Trigger=require('../model/trigger');var Template=require(_0xee03('0x6'));var Campaign=require(_0xee03('0x7'));var VoiceExtension=require(_0xee03('0x8'));var ZendeskAccount=require(_0xee03('0x9'));var SalesforceAccount=require(_0xee03('0xa'));var FreshdeskAccount=require(_0xee03('0xb'));var SugarcrmAccount=require(_0xee03('0xc'));var ZohoAccount=require(_0xee03('0xd'));var DeskAccount=require(_0xee03('0xe'));var VtigerAccount=require(_0xee03('0xf'));var ServicenowAccount=require(_0xee03('0x10'));var Dynamics365Account=require(_0xee03('0x11'));var FreshsalesAccount=require(_0xee03('0x12'));var FaxAccount=require(_0xee03('0x13'));var Realtime=function(){this[_0xee03('0x14')]={};this[_0xee03('0x15')]={};this[_0xee03('0x16')]={};this['voiceQueues']={};this[_0xee03('0x17')]={};this[_0xee03('0x18')]={};this['templates']={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xee03('0x19')]={};this[_0xee03('0x1a')]={};this['queueChannels']={};this['outboundChannels']={};this[_0xee03('0x1b')]={};this[_0xee03('0x1c')]={};this[_0xee03('0x1d')]={};this[_0xee03('0x1e')]={};this[_0xee03('0x1f')]={};this[_0xee03('0x20')]={};this[_0xee03('0x21')]={};this[_0xee03('0x22')]={};this[_0xee03('0x23')]={};this[_0xee03('0x24')]={};this[_0xee03('0x25')]={};this[_0xee03('0x26')]={};this[_0xee03('0x27')]={};};function freeIsNotKey(_0x48bbfd,_0x19e177,_0x3bd63f){var _0x4d48ac=_['mapKeys'](_0x48bbfd,function(_0x291490,_0x4b3277){return _0x291490[_0x3bd63f];});for(var _0x1ff78a in _0x19e177){if(_0x19e177[_0xee03('0x28')](_0x1ff78a)){if(!_0x4d48ac[_0x1ff78a]){delete _0x19e177[_0x1ff78a];}}}}function freeIsNotKeySip(_0x4ec287,_0xb83701){var _0x512309=_[_0xee03('0x29')](_0x4ec287,function(_0x53706a,_0x5e6758){return util['format']('SIP/%s',_0x53706a['name']);});for(var _0x5ad571 in _0xb83701){if(_0xb83701[_0xee03('0x28')](_0x5ad571)){if(!_0x512309[_0x5ad571]){delete _0xb83701[_0x5ad571];}}}}function freeIsNotKeyAgent(_0x141e4f,_0x1dd5fd){var _0x32ced4=_[_0xee03('0x29')](_0x141e4f,function(_0x5614d1,_0x528700){var _0x422fcd=_[_0xee03('0x2a')](_0x5614d1[_0xee03('0x2b')])?util[_0xee03('0x2c')](_0xee03('0x2d'),_0x5614d1['name']):_0x5614d1[_0xee03('0x2b')];return _0x422fcd;});for(var _0x3a0868 in _0x1dd5fd){if(_0x1dd5fd[_0xee03('0x28')](_0x3a0868)){if(!_0x32ced4[_0x3a0868]){delete _0x1dd5fd[_0x3a0868];}}}}function clearVoiceCallReports(_0x415ee0){_0x415ee0['total']=0x0;_0x415ee0[_0xee03('0x2e')]=0x0;_0x415ee0[_0xee03('0x2f')]=0x0;_0x415ee0[_0xee03('0x30')]=0x0;_0x415ee0[_0xee03('0x31')]=0x0;}function clearCampaigns(_0x4fedcf){if(!_[_0xee03('0x32')](_0x4fedcf)){for(var _0x57bb61 in _0x4fedcf){if(_0x4fedcf[_0xee03('0x28')](_0x57bb61)){_0x4fedcf[_0x57bb61][_0xee03('0x33')]=0x0;_0x4fedcf[_0x57bb61][_0xee03('0x34')]=0x0;}}}}function clearVoiceQueues(_0x2bc523){if(!_['isEmpty'](_0x2bc523)){for(var _0x29507a in _0x2bc523){if(_0x2bc523[_0xee03('0x28')](_0x29507a)){_0x2bc523[_0x29507a][_0xee03('0x35')]=0x0;_0x2bc523[_0x29507a][_0xee03('0x2e')]=0x0;_0x2bc523[_0x29507a][_0xee03('0x36')]=0x0;_0x2bc523[_0x29507a][_0xee03('0x37')]=0x0;_0x2bc523[_0x29507a]['sumHoldTime']=0x0;_0x2bc523[_0x29507a][_0xee03('0x30')]=0x0;_0x2bc523[_0x29507a][_0xee03('0x31')]=0x0;_0x2bc523[_0x29507a][_0xee03('0x38')]=0x0;_0x2bc523[_0x29507a]['outboundNoAnswerCallsDay']=0x0;_0x2bc523[_0x29507a][_0xee03('0x39')]=0x0;_0x2bc523[_0x29507a]['outboundCongestionCallsDay']=0x0;_0x2bc523[_0x29507a][_0xee03('0x3a')]=0x0;_0x2bc523[_0x29507a][_0xee03('0x3b')]=0x0;_0x2bc523[_0x29507a]['outboundDropCallsDayTimeout']=0x0;_0x2bc523[_0x29507a][_0xee03('0x3c')]=0x0;_0x2bc523[_0x29507a]['outboundBlacklistCallsDay']=0x0;_0x2bc523[_0x29507a][_0xee03('0x3d')]=0x0;_0x2bc523[_0x29507a][_0xee03('0x3e')]=0x0;_0x2bc523[_0x29507a]['outboundReCallsDay']=0x0;_0x2bc523[_0x29507a][_0xee03('0x38')]=0x0;_0x2bc523[_0x29507a]['outboundAnswerCallsDay']=0x0;_0x2bc523[_0x29507a]['queueStatusComplete']=!![];}}}}Realtime['prototype'][_0xee03('0x3f')]=function(_0x5b7f43,_0x35e775){for(var _0x1a323f in _0x35e775){if(_0x5b7f43['hasOwnProperty'](_0x1a323f)){_0x5b7f43[_0x1a323f]=_0x35e775[_0x1a323f];}}};Realtime[_0xee03('0x40')][_0xee03('0x41')]=function(){var _0x1007fc=this;return function(_0x3b9403){if(_0x3b9403){freeIsNotKeyAgent(_0x3b9403,_0x1007fc['agents']);for(var _0x59b0e8=0x0,_0x18c54a={},_0x5614a8={};_0x59b0e8<_0x3b9403[_0xee03('0x42')];_0x59b0e8+=0x1){_0x18c54a=_0x3b9403[_0x59b0e8];var _0x327c1c=_[_0xee03('0x2a')](_0x18c54a['interface'])?util[_0xee03('0x2c')](_0xee03('0x2d'),_0x18c54a[_0xee03('0x43')]):_0x18c54a[_0xee03('0x2b')];if(_[_0xee03('0x44')](_0x1007fc[_0xee03('0x14')][_0x327c1c])){_0x1007fc[_0xee03('0x14')][_0x327c1c]=new Agent(_0x18c54a);}else{_0x1007fc[_0xee03('0x3f')](_0x1007fc[_0xee03('0x14')][_0x327c1c],_0x18c54a);}}}return _0x1007fc[_0xee03('0x14')];};};Realtime[_0xee03('0x40')][_0xee03('0x45')]=function(){var _0x1998c2=this;return function(_0xeeb5d0){if(_0xeeb5d0){freeIsNotKeySip(_0xeeb5d0,_0x1998c2['telephones']);for(var _0x2fd52d=0x0,_0x2df74d={},_0x36f306={};_0x2fd52d<_0xeeb5d0['length'];_0x2fd52d+=0x1){_0x2df74d=_0xeeb5d0[_0x2fd52d];if(_['isUndefined'](_0x1998c2['telephones'][util[_0xee03('0x2c')]('SIP/%s',_0x2df74d[_0xee03('0x43')])])){_0x1998c2[_0xee03('0x15')][util[_0xee03('0x2c')](_0xee03('0x2d'),_0x2df74d[_0xee03('0x43')])]=new Telephone(_0x2df74d);}else{_0x1998c2[_0xee03('0x3f')](_0x1998c2['telephones'][util[_0xee03('0x2c')](_0xee03('0x2d'),_0x2df74d[_0xee03('0x43')])],_0x2df74d);}}}return _0x1998c2[_0xee03('0x15')];};};Realtime[_0xee03('0x40')][_0xee03('0x46')]=function(){var _0x30d4ff=this;return function(_0x1a5ced){if(_0x1a5ced){freeIsNotKeySip(_0x1a5ced,_0x30d4ff[_0xee03('0x16')]);for(var _0x5c1a63=0x0,_0x269f35={},_0x5eb8a6={};_0x5c1a63<_0x1a5ced[_0xee03('0x42')];_0x5c1a63+=0x1){_0x269f35=_0x1a5ced[_0x5c1a63];if(_[_0xee03('0x44')](_0x30d4ff[_0xee03('0x16')][util[_0xee03('0x2c')](_0xee03('0x2d'),_0x269f35['name'])])){_0x30d4ff[_0xee03('0x16')][util[_0xee03('0x2c')](_0xee03('0x2d'),_0x269f35['name'])]=new Trunk(_0x269f35);}else{_0x30d4ff[_0xee03('0x3f')](_0x30d4ff[_0xee03('0x16')][util[_0xee03('0x2c')](_0xee03('0x2d'),_0x269f35[_0xee03('0x43')])],_0x269f35);}}}return _0x30d4ff[_0xee03('0x16')];};};Realtime[_0xee03('0x40')][_0xee03('0x47')]=function(){var _0x227862=this;return function(_0x5cbe17){if(_0x5cbe17){freeIsNotKey(_0x5cbe17,_0x227862[_0xee03('0x48')],_0xee03('0x43'));for(var _0xfb247c=0x0,_0x24c739={},_0x8169bf={};_0xfb247c<_0x5cbe17[_0xee03('0x42')];_0xfb247c+=0x1){_0x24c739=_0x5cbe17[_0xfb247c];if(_[_0xee03('0x44')](_0x227862[_0xee03('0x48')][_0x24c739[_0xee03('0x43')]])){_0x227862[_0xee03('0x48')][_0x24c739[_0xee03('0x43')]]=new VoiceQueue(_0x24c739);}else{_0x227862[_0xee03('0x3f')](_0x227862[_0xee03('0x48')][_0x24c739[_0xee03('0x43')]],_0x24c739);}}}return _0x227862['voiceQueues'];};};Realtime['prototype'][_0xee03('0x49')]=function(){var _0x4d4599=this;return function(_0x536724){if(_0x536724){freeIsNotKey(_0x536724,_0x4d4599['triggers'],'id');for(var _0x2b93b1=0x0,_0x152847={},_0x344d94={};_0x2b93b1<_0x536724['length'];_0x2b93b1+=0x1){_0x152847=_0x536724[_0x2b93b1];if(_['isUndefined'](_0x4d4599[_0xee03('0x17')][_0x152847['id']])){_0x4d4599[_0xee03('0x17')][_0x152847['id']]=new Trigger(_0x152847);}else{_0x4d4599[_0xee03('0x3f')](_0x4d4599[_0xee03('0x17')][_0x152847['id']],_0x152847);}}}return _0x4d4599[_0xee03('0x17')];};};Realtime[_0xee03('0x40')]['initTemplates']=function(){var _0x882f2=this;return function(_0x4ff66e){if(_0x4ff66e){freeIsNotKey(_0x4ff66e,_0x882f2[_0xee03('0x4a')],'id');for(var _0x34f9c5=0x0,_0x35a50e={},_0x2fcc2e={};_0x34f9c5<_0x4ff66e[_0xee03('0x42')];_0x34f9c5+=0x1){_0x35a50e=_0x4ff66e[_0x34f9c5];if(_[_0xee03('0x44')](_0x882f2[_0xee03('0x4a')][_0x35a50e['id']])){_0x882f2[_0xee03('0x4a')][_0x35a50e['id']]=new Template(_0x35a50e);}else{_0x882f2[_0xee03('0x3f')](_0x882f2[_0xee03('0x4a')][_0x35a50e['id']],_0x35a50e);}}}return _0x882f2['templates'];};};Realtime['prototype'][_0xee03('0x4b')]=function(){var _0x3fa237=this;return function(_0x2ee887){if(_0x2ee887){freeIsNotKey(_0x2ee887,_0x3fa237[_0xee03('0x1d')],'id');for(var _0x1d4fe4=0x0,_0xea7979={},_0x3ac407={};_0x1d4fe4<_0x2ee887[_0xee03('0x42')];_0x1d4fe4+=0x1){_0xea7979=_0x2ee887[_0x1d4fe4];if(_[_0xee03('0x44')](_0x3fa237[_0xee03('0x1d')][_0xea7979['id']])){_0x3fa237[_0xee03('0x1d')][_0xea7979['id']]=new ZendeskAccount(_0xea7979);}else{_0x3fa237[_0xee03('0x3f')](_0x3fa237['zendeskAccounts'][_0xea7979['id']],_0xea7979);}}}return _0x3fa237['zendeskAccounts'];};};Realtime[_0xee03('0x40')][_0xee03('0x4c')]=function(){var _0x2207b2=this;return function(_0xfd1a66){if(_0xfd1a66){freeIsNotKey(_0xfd1a66,_0x2207b2['salesforceAccounts'],'id');for(var _0x47e46b=0x0,_0x2e7878={},_0x1b2a86={};_0x47e46b<_0xfd1a66[_0xee03('0x42')];_0x47e46b+=0x1){_0x2e7878=_0xfd1a66[_0x47e46b];if(_[_0xee03('0x44')](_0x2207b2[_0xee03('0x1e')][_0x2e7878['id']])){_0x2207b2['salesforceAccounts'][_0x2e7878['id']]=new SalesforceAccount(_0x2e7878);}else{_0x2207b2[_0xee03('0x3f')](_0x2207b2['salesforceAccounts'][_0x2e7878['id']],_0x2e7878);}}}return _0x2207b2[_0xee03('0x1e')];};};Realtime['prototype'][_0xee03('0x4d')]=function(){var _0x2d4739=this;return function(_0x59c537){if(_0x59c537){freeIsNotKey(_0x59c537,_0x2d4739[_0xee03('0x20')],'id');for(var _0x41081b=0x0,_0x9831d1={},_0x389d0c={};_0x41081b<_0x59c537['length'];_0x41081b+=0x1){_0x9831d1=_0x59c537[_0x41081b];if(_[_0xee03('0x44')](_0x2d4739[_0xee03('0x20')][_0x9831d1['id']])){_0x2d4739[_0xee03('0x20')][_0x9831d1['id']]=new FreshdeskAccount(_0x9831d1);}else{_0x2d4739[_0xee03('0x3f')](_0x2d4739[_0xee03('0x20')][_0x9831d1['id']],_0x9831d1);}}}return _0x2d4739[_0xee03('0x20')];};};Realtime[_0xee03('0x40')][_0xee03('0x4e')]=function(){var _0x40c183=this;return function(_0x147535){if(_0x147535){freeIsNotKey(_0x147535,_0x40c183[_0xee03('0x21')],'id');for(var _0x3c9f99=0x0,_0x5d6ed9={},_0x216ad7={};_0x3c9f99<_0x147535[_0xee03('0x42')];_0x3c9f99+=0x1){_0x5d6ed9=_0x147535[_0x3c9f99];if(_[_0xee03('0x44')](_0x40c183[_0xee03('0x21')][_0x5d6ed9['id']])){_0x40c183[_0xee03('0x21')][_0x5d6ed9['id']]=new ZohoAccount(_0x5d6ed9);}else{_0x40c183[_0xee03('0x3f')](_0x40c183['zohoAccounts'][_0x5d6ed9['id']],_0x5d6ed9);}}}return _0x40c183[_0xee03('0x21')];};};Realtime['prototype']['initDeskAccounts']=function(){var _0x20c8d2=this;return function(_0x19ae65){if(_0x19ae65){freeIsNotKey(_0x19ae65,_0x20c8d2[_0xee03('0x22')],'id');for(var _0x2dc10f=0x0,_0x339a9c={},_0x1cf5f9={};_0x2dc10f<_0x19ae65[_0xee03('0x42')];_0x2dc10f+=0x1){_0x339a9c=_0x19ae65[_0x2dc10f];if(_[_0xee03('0x44')](_0x20c8d2['deskAccounts'][_0x339a9c['id']])){_0x20c8d2[_0xee03('0x22')][_0x339a9c['id']]=new DeskAccount(_0x339a9c);}else{_0x20c8d2[_0xee03('0x3f')](_0x20c8d2[_0xee03('0x22')][_0x339a9c['id']],_0x339a9c);}}}return _0x20c8d2[_0xee03('0x22')];};};Realtime[_0xee03('0x40')][_0xee03('0x4f')]=function(){var _0x4e8b6a=this;return function(_0x42d808){if(_0x42d808){freeIsNotKey(_0x42d808,_0x4e8b6a[_0xee03('0x1f')],'id');for(var _0x21d5ad=0x0,_0x5edd4f={},_0x4662e9={};_0x21d5ad<_0x42d808[_0xee03('0x42')];_0x21d5ad+=0x1){_0x5edd4f=_0x42d808[_0x21d5ad];if(_['isUndefined'](_0x4e8b6a[_0xee03('0x1f')][_0x5edd4f['id']])){_0x4e8b6a[_0xee03('0x1f')][_0x5edd4f['id']]=new SugarcrmAccount(_0x5edd4f);}else{_0x4e8b6a[_0xee03('0x3f')](_0x4e8b6a[_0xee03('0x1f')][_0x5edd4f['id']],_0x5edd4f);}}}return _0x4e8b6a[_0xee03('0x1f')];};};Realtime[_0xee03('0x40')][_0xee03('0x50')]=function(){var _0x131c01=this;return function(_0x41868a){if(_0x41868a){freeIsNotKey(_0x41868a,_0x131c01[_0xee03('0x23')],'id');for(var _0xb0e230=0x0,_0x10f607={},_0x381390={};_0xb0e230<_0x41868a[_0xee03('0x42')];_0xb0e230+=0x1){_0x10f607=_0x41868a[_0xb0e230];if(_[_0xee03('0x44')](_0x131c01[_0xee03('0x23')][_0x10f607['id']])){_0x131c01['vtigerAccounts'][_0x10f607['id']]=new VtigerAccount(_0x10f607);}else{_0x131c01[_0xee03('0x3f')](_0x131c01[_0xee03('0x23')][_0x10f607['id']],_0x10f607);}}}return _0x131c01[_0xee03('0x23')];};};Realtime[_0xee03('0x40')][_0xee03('0x51')]=function(){var _0x43bfc9=this;return function(_0x141195){if(_0x141195){freeIsNotKey(_0x141195,_0x43bfc9[_0xee03('0x24')],'id');for(var _0x56d495=0x0,_0x4309e5={},_0x59ecd7={};_0x56d495<_0x141195[_0xee03('0x42')];_0x56d495+=0x1){_0x4309e5=_0x141195[_0x56d495];if(_['isUndefined'](_0x43bfc9['servicenowAccounts'][_0x4309e5['id']])){_0x43bfc9[_0xee03('0x24')][_0x4309e5['id']]=new ServicenowAccount(_0x4309e5);}else{_0x43bfc9['mergeFromDatabase'](_0x43bfc9[_0xee03('0x24')][_0x4309e5['id']],_0x4309e5);}}}return _0x43bfc9[_0xee03('0x24')];};};Realtime[_0xee03('0x40')][_0xee03('0x52')]=function(){var _0x50babf=this;return function(_0x27cbaf){if(_0x27cbaf){freeIsNotKey(_0x27cbaf,_0x50babf[_0xee03('0x25')],'id');for(var _0x202dba=0x0,_0x3065ac={},_0x16b726={};_0x202dba<_0x27cbaf['length'];_0x202dba+=0x1){_0x3065ac=_0x27cbaf[_0x202dba];if(_[_0xee03('0x44')](_0x50babf[_0xee03('0x25')][_0x3065ac['id']])){_0x50babf['dynamics365Accounts'][_0x3065ac['id']]=new Dynamics365Account(_0x3065ac);}else{_0x50babf[_0xee03('0x3f')](_0x50babf[_0xee03('0x25')][_0x3065ac['id']],_0x3065ac);}}}return _0x50babf['dynamics365Accounts'];};};Realtime['prototype']['initFreshsalesAccounts']=function(){var _0x185253=this;return function(_0x49fc31){if(_0x49fc31){freeIsNotKey(_0x49fc31,_0x185253[_0xee03('0x26')],'id');for(var _0x22af12=0x0,_0xa74c1={},_0x32fb79={};_0x22af12<_0x49fc31['length'];_0x22af12+=0x1){_0xa74c1=_0x49fc31[_0x22af12];if(_['isUndefined'](_0x185253[_0xee03('0x26')][_0xa74c1['id']])){_0x185253[_0xee03('0x26')][_0xa74c1['id']]=new FreshsalesAccount(_0xa74c1);}else{_0x185253['mergeFromDatabase'](_0x185253[_0xee03('0x26')][_0xa74c1['id']],_0xa74c1);}}}return _0x185253[_0xee03('0x26')];};};Realtime['prototype'][_0xee03('0x53')]=function(){var _0x1f2a13=this;return function(_0x23980c){for(var _0x650272=0x0;_0x650272<_0x23980c[_0xee03('0x42')];_0x650272+=0x1){_[_0xee03('0x54')](_0x1f2a13[_0xee03('0x48')][_0x23980c[_0x650272][_0xee03('0x43')]],_0x23980c[_0x650272]);}return _0x1f2a13[_0xee03('0x48')];};};Realtime['prototype'][_0xee03('0x55')]=function(){var _0x5452f8=this;return function(_0x2049a7){clearVoiceQueues(_0x5452f8[_0xee03('0x48')]);if(_0x2049a7){_0x2049a7=_['groupBy'](_0x2049a7,_0xee03('0x56'));for(var _0xf5facb in _0x2049a7){if(_0x2049a7['hasOwnProperty'](_0xf5facb)){var _0x5e3163={};for(var _0x3d363b=0x0;_0x3d363b<_0x2049a7[_0xf5facb][_0xee03('0x42')];_0x3d363b+=0x1){var _0x2d52e2=_0x2049a7[_0xf5facb][_0x3d363b]['queue'];if(_0x5452f8[_0xee03('0x48')][_0x2d52e2]){if(_0x2049a7[_0xf5facb][_0x3d363b][_0xee03('0x57')]){_0x5452f8[_0xee03('0x48')][_0x2d52e2][_0xee03('0x36')]+=0x1;}if(_0x2049a7[_0xf5facb][_0x3d363b][_0xee03('0x58')]){_0x5452f8[_0xee03('0x48')][_0x2d52e2][_0xee03('0x37')]+=0x1;}_0x5452f8[_0xee03('0x48')][_0x2d52e2][_0xee03('0x2f')]+=moment(_0x2049a7[_0xf5facb][_0x3d363b][_0xee03('0x59')])[_0xee03('0x5a')](moment(_0x2049a7[_0xf5facb][_0x3d363b][_0xee03('0x5b')]),_0xee03('0x5c'))||0x0;if(_0x3d363b===_0x2049a7[_0xf5facb][_0xee03('0x42')]-0x1){_0x5452f8['voiceQueues'][_0x2d52e2][_0xee03('0x30')]+=moment(_0x2049a7[_0xf5facb][_0x3d363b][_0xee03('0x5d')]||_0x2049a7[_0xf5facb][_0x3d363b]['queuecallerabandonAt']||_0x2049a7[_0xf5facb][_0x3d363b][_0xee03('0x5e')])['diff'](moment(_0x2049a7[_0xf5facb][_0x3d363b][_0xee03('0x5b')]),_0xee03('0x5c'))||0x0;_0x5452f8[_0xee03('0x48')][_0x2d52e2][_0xee03('0x35')]+=0x1;if(_0x2049a7[_0xf5facb][_0x3d363b][_0xee03('0x5f')]){_0x5452f8[_0xee03('0x48')][_0x2d52e2]['answered']+=0x1;_0x5452f8[_0xee03('0x48')][_0x2d52e2][_0xee03('0x31')]+=moment(_0x2049a7[_0xf5facb][_0x3d363b][_0xee03('0x5d')])[_0xee03('0x5a')](moment(_0x2049a7[_0xf5facb][_0x3d363b][_0xee03('0x59')]),_0xee03('0x5c'))||0x0;}}else{_0x5452f8[_0xee03('0x48')][_0x2d52e2][_0xee03('0x30')]+=_0x5452f8[_0xee03('0x48')][_0x2d52e2][_0xee03('0x2f')]||0x0;}}}}}}return _0x5452f8[_0xee03('0x48')];};};Realtime['prototype'][_0xee03('0x60')]=function(){var _0x28b0d7=this;return function(_0x559500){clearVoiceCallReports(_0x28b0d7[_0xee03('0x61')]);if(_0x559500){for(var _0x2df19d=0x0;_0x2df19d<_0x559500[_0xee03('0x42')];_0x2df19d+=0x1){_0x28b0d7['outbound'][_0xee03('0x35')]+=0x1;_0x28b0d7['outbound'][_0xee03('0x30')]+=_0x559500[_0x2df19d][_0xee03('0x62')];if(_0x559500[_0x2df19d][_0xee03('0x63')]===_0xee03('0x64')){_0x28b0d7[_0xee03('0x61')][_0xee03('0x2e')]+=0x1;_0x28b0d7[_0xee03('0x61')][_0xee03('0x2f')]+=_0x559500[_0x2df19d][_0xee03('0x62')]-_0x559500[_0x2df19d][_0xee03('0x65')]||0x0;_0x28b0d7['outbound'][_0xee03('0x31')]+=_0x559500[_0x2df19d][_0xee03('0x65')];}}}return _0x28b0d7['outbound'];};};Realtime['prototype'][_0xee03('0x66')]=function(){var _0x49150b=this;return function(_0x5f4a0e){if(_0x5f4a0e){freeIsNotKey(_0x5f4a0e,_0x49150b[_0xee03('0x18')],_0xee03('0x43'));for(var _0x32a5f1=0x0,_0x15083a={};_0x32a5f1<_0x5f4a0e[_0xee03('0x42')];_0x32a5f1+=0x1){_0x15083a=_0x5f4a0e[_0x32a5f1];if(_[_0xee03('0x44')](_0x49150b['campaigns'][_0x15083a[_0xee03('0x43')]])){_0x49150b[_0xee03('0x18')][_0x15083a['name']]=new Campaign(_0x15083a);}else{_0x49150b['mergeFromDatabase'](_0x49150b['campaigns'][_0x15083a[_0xee03('0x43')]],_0x15083a);_0x49150b[_0xee03('0x18')][_0x15083a[_0xee03('0x43')]][_0xee03('0x67')]=_0x15083a[_0xee03('0x68')]?_0x15083a[_0xee03('0x68')][_0xee03('0x43')]:undefined;}}}return _0x49150b[_0xee03('0x18')];};};Realtime['prototype'][_0xee03('0x69')]=function(){var _0x6b55d1=this;return function(_0x216cc9){if(_0x216cc9){freeIsNotKey(_0x216cc9,_0x6b55d1['voiceExtensions'],'id');for(var _0x3bdc2c=0x0,_0x580339={};_0x3bdc2c<_0x216cc9['length'];_0x3bdc2c+=0x1){_0x580339=_0x216cc9[_0x3bdc2c];if(_[_0xee03('0x44')](_0x6b55d1[_0xee03('0x19')][_0x580339['id']])){_0x6b55d1[_0xee03('0x19')][_0x580339['id']]=new VoiceExtension(_0x580339);}else{_0x6b55d1[_0xee03('0x3f')](_0x6b55d1[_0xee03('0x19')][_0x580339['id']],_0x580339);}}}return _0x6b55d1[_0xee03('0x19')];};};Realtime[_0xee03('0x40')][_0xee03('0x6a')]=function(){var _0x4e0bf1=this;return function(_0x581c50){clearCampaigns(_0x4e0bf1['campaigns']);for(var _0x2c8e8f=0x0;_0x2c8e8f<_0x581c50[_0xee03('0x42')];_0x2c8e8f+=0x1){_['merge'](_0x4e0bf1[_0xee03('0x18')][_0x581c50[_0x2c8e8f][_0xee03('0x43')]],_0x581c50[_0x2c8e8f]);}return _0x4e0bf1[_0xee03('0x18')];};};Realtime[_0xee03('0x40')]['initFaxAccounts']=function(){var _0x4605cf=this;return function(_0x428b5f){if(_0x428b5f){freeIsNotKey(_0x428b5f,_0x4605cf[_0xee03('0x27')],'id');for(var _0x51137c=0x0,_0x20009f={},_0x2cc9d1={};_0x51137c<_0x428b5f[_0xee03('0x42')];_0x51137c+=0x1){_0x20009f=_0x428b5f[_0x51137c];if(_[_0xee03('0x44')](_0x4605cf['faxAccounts'][_0x20009f['id']])){_0x4605cf[_0xee03('0x27')][_0x20009f['id']]=new FaxAccount(_0x20009f);}else{_0x4605cf[_0xee03('0x3f')](_0x4605cf[_0xee03('0x27')][_0x20009f['id']],_0x20009f);}}}return _0x4605cf[_0xee03('0x27')];};};module[_0xee03('0x6b')]=Realtime; \ No newline at end of file +var _0xf1f8=['sumHoldTime','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','length','isUndefined','mergeFromDatabase','initTelephones','telephones','initTrunks','initVoiceQueues','initTriggers','triggers','initTemplates','initZendeskAccounts','initZohoAccounts','zohoAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','answered','sumBillable','duration','disposition','ANSWERED','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','trunks','voiceQueues','campaigns','templates','outbound','channels','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','isNil','format','SIP/%s','name','total'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf1f8,0x10f));var _0x8f1f=function(_0x268f61,_0x407d84){_0x268f61=_0x268f61-0x0;var _0x3c85d9=_0xf1f8[_0x268f61];return _0x3c85d9;};'use strict';var BPromise=require(_0x8f1f('0x0'));var util=require(_0x8f1f('0x1'));var _=require(_0x8f1f('0x2'));var moment=require(_0x8f1f('0x3'));var Agent=require(_0x8f1f('0x4'));var Telephone=require('../model/telephone');var Trunk=require(_0x8f1f('0x5'));var VoiceQueue=require(_0x8f1f('0x6'));var Trigger=require(_0x8f1f('0x7'));var Template=require(_0x8f1f('0x8'));var Campaign=require(_0x8f1f('0x9'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x8f1f('0xa'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x8f1f('0xb'));var SugarcrmAccount=require(_0x8f1f('0xc'));var ZohoAccount=require(_0x8f1f('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x8f1f('0xe'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x8f1f('0xf'));var FreshsalesAccount=require(_0x8f1f('0x10'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x8f1f('0x11')]={};this['telephones']={};this[_0x8f1f('0x12')]={};this[_0x8f1f('0x13')]={};this['triggers']={};this[_0x8f1f('0x14')]={};this[_0x8f1f('0x15')]={};this[_0x8f1f('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x8f1f('0x17')]={};this[_0x8f1f('0x18')]={};this[_0x8f1f('0x19')]={};this[_0x8f1f('0x1a')]={};this['settings']={};this[_0x8f1f('0x1b')]={};this[_0x8f1f('0x1c')]={};this[_0x8f1f('0x1d')]={};this[_0x8f1f('0x1e')]={};this['zohoAccounts']={};this[_0x8f1f('0x1f')]={};this[_0x8f1f('0x20')]={};this[_0x8f1f('0x21')]={};this[_0x8f1f('0x22')]={};this[_0x8f1f('0x23')]={};this[_0x8f1f('0x24')]={};};function freeIsNotKey(_0x3b704a,_0x37f4b9,_0x5621e0){var _0x25c7f1=_[_0x8f1f('0x25')](_0x3b704a,function(_0x1d1e79,_0x1faedc){return _0x1d1e79[_0x5621e0];});for(var _0x4d25b9 in _0x37f4b9){if(_0x37f4b9[_0x8f1f('0x26')](_0x4d25b9)){if(!_0x25c7f1[_0x4d25b9]){delete _0x37f4b9[_0x4d25b9];}}}}function freeIsNotKeySip(_0x3490f7,_0x11eaea){var _0x2aa737=_['mapKeys'](_0x3490f7,function(_0xbe2fdd,_0x44d46a){return util['format']('SIP/%s',_0xbe2fdd['name']);});for(var _0x394705 in _0x11eaea){if(_0x11eaea[_0x8f1f('0x26')](_0x394705)){if(!_0x2aa737[_0x394705]){delete _0x11eaea[_0x394705];}}}}function freeIsNotKeyAgent(_0x290ffd,_0x52f8ce){var _0x4426ba=_[_0x8f1f('0x25')](_0x290ffd,function(_0x330fbf,_0x7dd128){var _0x2cd503=_[_0x8f1f('0x27')](_0x330fbf['interface'])?util[_0x8f1f('0x28')](_0x8f1f('0x29'),_0x330fbf[_0x8f1f('0x2a')]):_0x330fbf['interface'];return _0x2cd503;});for(var _0x4b4e34 in _0x52f8ce){if(_0x52f8ce['hasOwnProperty'](_0x4b4e34)){if(!_0x4426ba[_0x4b4e34]){delete _0x52f8ce[_0x4b4e34];}}}}function clearVoiceCallReports(_0x5cd802){_0x5cd802[_0x8f1f('0x2b')]=0x0;_0x5cd802['answered']=0x0;_0x5cd802[_0x8f1f('0x2c')]=0x0;_0x5cd802[_0x8f1f('0x2d')]=0x0;_0x5cd802['sumBillable']=0x0;}function clearCampaigns(_0x2ab1f6){if(!_[_0x8f1f('0x2e')](_0x2ab1f6)){for(var _0x5a0251 in _0x2ab1f6){if(_0x2ab1f6['hasOwnProperty'](_0x5a0251)){_0x2ab1f6[_0x5a0251][_0x8f1f('0x2f')]=0x0;_0x2ab1f6[_0x5a0251][_0x8f1f('0x30')]=0x0;}}}}function clearVoiceQueues(_0x19c666){if(!_[_0x8f1f('0x2e')](_0x19c666)){for(var _0x11f76f in _0x19c666){if(_0x19c666['hasOwnProperty'](_0x11f76f)){_0x19c666[_0x11f76f][_0x8f1f('0x2b')]=0x0;_0x19c666[_0x11f76f]['answered']=0x0;_0x19c666[_0x11f76f][_0x8f1f('0x31')]=0x0;_0x19c666[_0x11f76f][_0x8f1f('0x32')]=0x0;_0x19c666[_0x11f76f][_0x8f1f('0x2c')]=0x0;_0x19c666[_0x11f76f][_0x8f1f('0x2d')]=0x0;_0x19c666[_0x11f76f]['sumBillable']=0x0;_0x19c666[_0x11f76f]['outboundAnswerAgiCallsDay']=0x0;_0x19c666[_0x11f76f]['outboundNoAnswerCallsDay']=0x0;_0x19c666[_0x11f76f][_0x8f1f('0x33')]=0x0;_0x19c666[_0x11f76f]['outboundCongestionCallsDay']=0x0;_0x19c666[_0x11f76f][_0x8f1f('0x34')]=0x0;_0x19c666[_0x11f76f][_0x8f1f('0x35')]=0x0;_0x19c666[_0x11f76f][_0x8f1f('0x36')]=0x0;_0x19c666[_0x11f76f][_0x8f1f('0x37')]=0x0;_0x19c666[_0x11f76f]['outboundBlacklistCallsDay']=0x0;_0x19c666[_0x11f76f][_0x8f1f('0x38')]=0x0;_0x19c666[_0x11f76f]['outboundRejectCallsDay']=0x0;_0x19c666[_0x11f76f][_0x8f1f('0x39')]=0x0;_0x19c666[_0x11f76f][_0x8f1f('0x3a')]=0x0;_0x19c666[_0x11f76f][_0x8f1f('0x3b')]=0x0;_0x19c666[_0x11f76f][_0x8f1f('0x3c')]=!![];}}}}Realtime[_0x8f1f('0x3d')]['mergeFromDatabase']=function(_0x29f25a,_0x2a0321){for(var _0x32c34b in _0x2a0321){if(_0x29f25a[_0x8f1f('0x26')](_0x32c34b)){_0x29f25a[_0x32c34b]=_0x2a0321[_0x32c34b];}}};Realtime['prototype'][_0x8f1f('0x3e')]=function(){var _0x473aba=this;return function(_0x2483a1){if(_0x2483a1){freeIsNotKeyAgent(_0x2483a1,_0x473aba['agents']);for(var _0x4ec303=0x0,_0xabad5f={},_0x29eb68={};_0x4ec303<_0x2483a1[_0x8f1f('0x3f')];_0x4ec303+=0x1){_0xabad5f=_0x2483a1[_0x4ec303];var _0x41ade3=_[_0x8f1f('0x27')](_0xabad5f['interface'])?util['format'](_0x8f1f('0x29'),_0xabad5f[_0x8f1f('0x2a')]):_0xabad5f['interface'];if(_[_0x8f1f('0x40')](_0x473aba[_0x8f1f('0x11')][_0x41ade3])){_0x473aba[_0x8f1f('0x11')][_0x41ade3]=new Agent(_0xabad5f);}else{_0x473aba[_0x8f1f('0x41')](_0x473aba['agents'][_0x41ade3],_0xabad5f);}}}return _0x473aba['agents'];};};Realtime[_0x8f1f('0x3d')][_0x8f1f('0x42')]=function(){var _0x2cb2c3=this;return function(_0x4087f5){if(_0x4087f5){freeIsNotKeySip(_0x4087f5,_0x2cb2c3[_0x8f1f('0x43')]);for(var _0x10b3a8=0x0,_0x500c9e={},_0x639bdd={};_0x10b3a8<_0x4087f5[_0x8f1f('0x3f')];_0x10b3a8+=0x1){_0x500c9e=_0x4087f5[_0x10b3a8];if(_['isUndefined'](_0x2cb2c3['telephones'][util[_0x8f1f('0x28')](_0x8f1f('0x29'),_0x500c9e['name'])])){_0x2cb2c3['telephones'][util[_0x8f1f('0x28')](_0x8f1f('0x29'),_0x500c9e[_0x8f1f('0x2a')])]=new Telephone(_0x500c9e);}else{_0x2cb2c3[_0x8f1f('0x41')](_0x2cb2c3[_0x8f1f('0x43')][util['format'](_0x8f1f('0x29'),_0x500c9e[_0x8f1f('0x2a')])],_0x500c9e);}}}return _0x2cb2c3[_0x8f1f('0x43')];};};Realtime['prototype'][_0x8f1f('0x44')]=function(){var _0x43fac7=this;return function(_0x46f84f){if(_0x46f84f){freeIsNotKeySip(_0x46f84f,_0x43fac7[_0x8f1f('0x12')]);for(var _0x4d35e7=0x0,_0x5d51d1={},_0x2352d5={};_0x4d35e7<_0x46f84f[_0x8f1f('0x3f')];_0x4d35e7+=0x1){_0x5d51d1=_0x46f84f[_0x4d35e7];if(_[_0x8f1f('0x40')](_0x43fac7[_0x8f1f('0x12')][util[_0x8f1f('0x28')](_0x8f1f('0x29'),_0x5d51d1[_0x8f1f('0x2a')])])){_0x43fac7['trunks'][util[_0x8f1f('0x28')]('SIP/%s',_0x5d51d1[_0x8f1f('0x2a')])]=new Trunk(_0x5d51d1);}else{_0x43fac7[_0x8f1f('0x41')](_0x43fac7[_0x8f1f('0x12')][util[_0x8f1f('0x28')](_0x8f1f('0x29'),_0x5d51d1[_0x8f1f('0x2a')])],_0x5d51d1);}}}return _0x43fac7[_0x8f1f('0x12')];};};Realtime[_0x8f1f('0x3d')][_0x8f1f('0x45')]=function(){var _0x1cc2ec=this;return function(_0x598b1f){if(_0x598b1f){freeIsNotKey(_0x598b1f,_0x1cc2ec['voiceQueues'],_0x8f1f('0x2a'));for(var _0x2d58a7=0x0,_0x5200e4={},_0x5115d2={};_0x2d58a7<_0x598b1f[_0x8f1f('0x3f')];_0x2d58a7+=0x1){_0x5200e4=_0x598b1f[_0x2d58a7];if(_['isUndefined'](_0x1cc2ec[_0x8f1f('0x13')][_0x5200e4['name']])){_0x1cc2ec[_0x8f1f('0x13')][_0x5200e4[_0x8f1f('0x2a')]]=new VoiceQueue(_0x5200e4);}else{_0x1cc2ec[_0x8f1f('0x41')](_0x1cc2ec[_0x8f1f('0x13')][_0x5200e4[_0x8f1f('0x2a')]],_0x5200e4);}}}return _0x1cc2ec[_0x8f1f('0x13')];};};Realtime['prototype'][_0x8f1f('0x46')]=function(){var _0x450aea=this;return function(_0x4b2218){if(_0x4b2218){freeIsNotKey(_0x4b2218,_0x450aea['triggers'],'id');for(var _0x2a5264=0x0,_0x59062f={},_0x5099af={};_0x2a5264<_0x4b2218[_0x8f1f('0x3f')];_0x2a5264+=0x1){_0x59062f=_0x4b2218[_0x2a5264];if(_['isUndefined'](_0x450aea['triggers'][_0x59062f['id']])){_0x450aea[_0x8f1f('0x47')][_0x59062f['id']]=new Trigger(_0x59062f);}else{_0x450aea['mergeFromDatabase'](_0x450aea[_0x8f1f('0x47')][_0x59062f['id']],_0x59062f);}}}return _0x450aea['triggers'];};};Realtime[_0x8f1f('0x3d')][_0x8f1f('0x48')]=function(){var _0x439f4c=this;return function(_0x2f5704){if(_0x2f5704){freeIsNotKey(_0x2f5704,_0x439f4c[_0x8f1f('0x15')],'id');for(var _0x4a37b5=0x0,_0x49c4a3={},_0x543b0c={};_0x4a37b5<_0x2f5704['length'];_0x4a37b5+=0x1){_0x49c4a3=_0x2f5704[_0x4a37b5];if(_['isUndefined'](_0x439f4c[_0x8f1f('0x15')][_0x49c4a3['id']])){_0x439f4c['templates'][_0x49c4a3['id']]=new Template(_0x49c4a3);}else{_0x439f4c[_0x8f1f('0x41')](_0x439f4c[_0x8f1f('0x15')][_0x49c4a3['id']],_0x49c4a3);}}}return _0x439f4c[_0x8f1f('0x15')];};};Realtime[_0x8f1f('0x3d')][_0x8f1f('0x49')]=function(){var _0x221134=this;return function(_0x392c48){if(_0x392c48){freeIsNotKey(_0x392c48,_0x221134[_0x8f1f('0x1b')],'id');for(var _0x234847=0x0,_0x2dcf66={},_0x499a17={};_0x234847<_0x392c48[_0x8f1f('0x3f')];_0x234847+=0x1){_0x2dcf66=_0x392c48[_0x234847];if(_[_0x8f1f('0x40')](_0x221134[_0x8f1f('0x1b')][_0x2dcf66['id']])){_0x221134[_0x8f1f('0x1b')][_0x2dcf66['id']]=new ZendeskAccount(_0x2dcf66);}else{_0x221134[_0x8f1f('0x41')](_0x221134['zendeskAccounts'][_0x2dcf66['id']],_0x2dcf66);}}}return _0x221134['zendeskAccounts'];};};Realtime[_0x8f1f('0x3d')]['initSalesforceAccounts']=function(){var _0x87aca4=this;return function(_0x4e555e){if(_0x4e555e){freeIsNotKey(_0x4e555e,_0x87aca4['salesforceAccounts'],'id');for(var _0x224416=0x0,_0x2f295e={},_0x4f08ef={};_0x224416<_0x4e555e['length'];_0x224416+=0x1){_0x2f295e=_0x4e555e[_0x224416];if(_[_0x8f1f('0x40')](_0x87aca4['salesforceAccounts'][_0x2f295e['id']])){_0x87aca4[_0x8f1f('0x1c')][_0x2f295e['id']]=new SalesforceAccount(_0x2f295e);}else{_0x87aca4['mergeFromDatabase'](_0x87aca4[_0x8f1f('0x1c')][_0x2f295e['id']],_0x2f295e);}}}return _0x87aca4[_0x8f1f('0x1c')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x5a4a37=this;return function(_0x1653be){if(_0x1653be){freeIsNotKey(_0x1653be,_0x5a4a37[_0x8f1f('0x1e')],'id');for(var _0x48697d=0x0,_0x3992bc={},_0x13a15e={};_0x48697d<_0x1653be['length'];_0x48697d+=0x1){_0x3992bc=_0x1653be[_0x48697d];if(_['isUndefined'](_0x5a4a37[_0x8f1f('0x1e')][_0x3992bc['id']])){_0x5a4a37[_0x8f1f('0x1e')][_0x3992bc['id']]=new FreshdeskAccount(_0x3992bc);}else{_0x5a4a37[_0x8f1f('0x41')](_0x5a4a37[_0x8f1f('0x1e')][_0x3992bc['id']],_0x3992bc);}}}return _0x5a4a37['freshdeskAccounts'];};};Realtime[_0x8f1f('0x3d')][_0x8f1f('0x4a')]=function(){var _0x52f4ad=this;return function(_0x2f72d3){if(_0x2f72d3){freeIsNotKey(_0x2f72d3,_0x52f4ad[_0x8f1f('0x4b')],'id');for(var _0x2e543b=0x0,_0x4d924b={},_0x223eba={};_0x2e543b<_0x2f72d3['length'];_0x2e543b+=0x1){_0x4d924b=_0x2f72d3[_0x2e543b];if(_[_0x8f1f('0x40')](_0x52f4ad[_0x8f1f('0x4b')][_0x4d924b['id']])){_0x52f4ad[_0x8f1f('0x4b')][_0x4d924b['id']]=new ZohoAccount(_0x4d924b);}else{_0x52f4ad[_0x8f1f('0x41')](_0x52f4ad[_0x8f1f('0x4b')][_0x4d924b['id']],_0x4d924b);}}}return _0x52f4ad[_0x8f1f('0x4b')];};};Realtime['prototype']['initDeskAccounts']=function(){var _0x10ffc3=this;return function(_0x2c0b1e){if(_0x2c0b1e){freeIsNotKey(_0x2c0b1e,_0x10ffc3['deskAccounts'],'id');for(var _0xe75fab=0x0,_0x17c77a={},_0x449692={};_0xe75fab<_0x2c0b1e[_0x8f1f('0x3f')];_0xe75fab+=0x1){_0x17c77a=_0x2c0b1e[_0xe75fab];if(_['isUndefined'](_0x10ffc3[_0x8f1f('0x1f')][_0x17c77a['id']])){_0x10ffc3[_0x8f1f('0x1f')][_0x17c77a['id']]=new DeskAccount(_0x17c77a);}else{_0x10ffc3['mergeFromDatabase'](_0x10ffc3[_0x8f1f('0x1f')][_0x17c77a['id']],_0x17c77a);}}}return _0x10ffc3[_0x8f1f('0x1f')];};};Realtime[_0x8f1f('0x3d')][_0x8f1f('0x4c')]=function(){var _0x5a6f49=this;return function(_0x61b0f6){if(_0x61b0f6){freeIsNotKey(_0x61b0f6,_0x5a6f49['sugarcrmAccounts'],'id');for(var _0x4366d6=0x0,_0x4dcef4={},_0x493f35={};_0x4366d6<_0x61b0f6[_0x8f1f('0x3f')];_0x4366d6+=0x1){_0x4dcef4=_0x61b0f6[_0x4366d6];if(_['isUndefined'](_0x5a6f49[_0x8f1f('0x1d')][_0x4dcef4['id']])){_0x5a6f49['sugarcrmAccounts'][_0x4dcef4['id']]=new SugarcrmAccount(_0x4dcef4);}else{_0x5a6f49[_0x8f1f('0x41')](_0x5a6f49['sugarcrmAccounts'][_0x4dcef4['id']],_0x4dcef4);}}}return _0x5a6f49[_0x8f1f('0x1d')];};};Realtime['prototype'][_0x8f1f('0x4d')]=function(){var _0x2e548e=this;return function(_0x5abc29){if(_0x5abc29){freeIsNotKey(_0x5abc29,_0x2e548e[_0x8f1f('0x20')],'id');for(var _0x49d5d3=0x0,_0x3c05e3={},_0x18743c={};_0x49d5d3<_0x5abc29[_0x8f1f('0x3f')];_0x49d5d3+=0x1){_0x3c05e3=_0x5abc29[_0x49d5d3];if(_[_0x8f1f('0x40')](_0x2e548e[_0x8f1f('0x20')][_0x3c05e3['id']])){_0x2e548e[_0x8f1f('0x20')][_0x3c05e3['id']]=new VtigerAccount(_0x3c05e3);}else{_0x2e548e['mergeFromDatabase'](_0x2e548e[_0x8f1f('0x20')][_0x3c05e3['id']],_0x3c05e3);}}}return _0x2e548e['vtigerAccounts'];};};Realtime[_0x8f1f('0x3d')][_0x8f1f('0x4e')]=function(){var _0x32280f=this;return function(_0x2c162c){if(_0x2c162c){freeIsNotKey(_0x2c162c,_0x32280f['servicenowAccounts'],'id');for(var _0x2d5328=0x0,_0x5583cd={},_0x4a0882={};_0x2d5328<_0x2c162c[_0x8f1f('0x3f')];_0x2d5328+=0x1){_0x5583cd=_0x2c162c[_0x2d5328];if(_['isUndefined'](_0x32280f[_0x8f1f('0x21')][_0x5583cd['id']])){_0x32280f[_0x8f1f('0x21')][_0x5583cd['id']]=new ServicenowAccount(_0x5583cd);}else{_0x32280f[_0x8f1f('0x41')](_0x32280f[_0x8f1f('0x21')][_0x5583cd['id']],_0x5583cd);}}}return _0x32280f[_0x8f1f('0x21')];};};Realtime[_0x8f1f('0x3d')][_0x8f1f('0x4f')]=function(){var _0x58d3d3=this;return function(_0x529170){if(_0x529170){freeIsNotKey(_0x529170,_0x58d3d3[_0x8f1f('0x22')],'id');for(var _0x4029bc=0x0,_0x17cdca={},_0x4fbe24={};_0x4029bc<_0x529170[_0x8f1f('0x3f')];_0x4029bc+=0x1){_0x17cdca=_0x529170[_0x4029bc];if(_[_0x8f1f('0x40')](_0x58d3d3[_0x8f1f('0x22')][_0x17cdca['id']])){_0x58d3d3[_0x8f1f('0x22')][_0x17cdca['id']]=new Dynamics365Account(_0x17cdca);}else{_0x58d3d3[_0x8f1f('0x41')](_0x58d3d3[_0x8f1f('0x22')][_0x17cdca['id']],_0x17cdca);}}}return _0x58d3d3[_0x8f1f('0x22')];};};Realtime[_0x8f1f('0x3d')][_0x8f1f('0x50')]=function(){var _0x2c4744=this;return function(_0x16926d){if(_0x16926d){freeIsNotKey(_0x16926d,_0x2c4744[_0x8f1f('0x23')],'id');for(var _0x41202a=0x0,_0x4226a5={},_0x2d9a5e={};_0x41202a<_0x16926d[_0x8f1f('0x3f')];_0x41202a+=0x1){_0x4226a5=_0x16926d[_0x41202a];if(_[_0x8f1f('0x40')](_0x2c4744[_0x8f1f('0x23')][_0x4226a5['id']])){_0x2c4744['freshsalesAccounts'][_0x4226a5['id']]=new FreshsalesAccount(_0x4226a5);}else{_0x2c4744[_0x8f1f('0x41')](_0x2c4744[_0x8f1f('0x23')][_0x4226a5['id']],_0x4226a5);}}}return _0x2c4744[_0x8f1f('0x23')];};};Realtime[_0x8f1f('0x3d')]['initVoiceQueueHopperHistory']=function(){var _0x5cf7ab=this;return function(_0x368cad){for(var _0x5c1975=0x0;_0x5c1975<_0x368cad[_0x8f1f('0x3f')];_0x5c1975+=0x1){_['merge'](_0x5cf7ab[_0x8f1f('0x13')][_0x368cad[_0x5c1975][_0x8f1f('0x2a')]],_0x368cad[_0x5c1975]);}return _0x5cf7ab[_0x8f1f('0x13')];};};Realtime[_0x8f1f('0x3d')]['initVoiceQueueReports']=function(){var _0x3579ea=this;return function(_0x1efd9a){clearVoiceQueues(_0x3579ea[_0x8f1f('0x13')]);if(_0x1efd9a){_0x1efd9a=_[_0x8f1f('0x51')](_0x1efd9a,_0x8f1f('0x52'));for(var _0x471a29 in _0x1efd9a){if(_0x1efd9a['hasOwnProperty'](_0x471a29)){var _0x455e4f={};for(var _0x24f726=0x0;_0x24f726<_0x1efd9a[_0x471a29][_0x8f1f('0x3f')];_0x24f726+=0x1){var _0x3805c1=_0x1efd9a[_0x471a29][_0x24f726][_0x8f1f('0x53')];if(_0x3579ea['voiceQueues'][_0x3805c1]){if(_0x1efd9a[_0x471a29][_0x24f726][_0x8f1f('0x54')]){_0x3579ea[_0x8f1f('0x13')][_0x3805c1][_0x8f1f('0x31')]+=0x1;}if(_0x1efd9a[_0x471a29][_0x24f726][_0x8f1f('0x55')]){_0x3579ea['voiceQueues'][_0x3805c1][_0x8f1f('0x32')]+=0x1;}_0x3579ea[_0x8f1f('0x13')][_0x3805c1][_0x8f1f('0x2c')]+=moment(_0x1efd9a[_0x471a29][_0x24f726][_0x8f1f('0x56')])[_0x8f1f('0x57')](moment(_0x1efd9a[_0x471a29][_0x24f726]['queuecallerjoinAt']),_0x8f1f('0x58'))||0x0;if(_0x24f726===_0x1efd9a[_0x471a29]['length']-0x1){_0x3579ea[_0x8f1f('0x13')][_0x3805c1][_0x8f1f('0x2d')]+=moment(_0x1efd9a[_0x471a29][_0x24f726][_0x8f1f('0x59')]||_0x1efd9a[_0x471a29][_0x24f726][_0x8f1f('0x5a')]||_0x1efd9a[_0x471a29][_0x24f726]['queuecallerexitAt'])['diff'](moment(_0x1efd9a[_0x471a29][_0x24f726]['queuecallerjoinAt']),_0x8f1f('0x58'))||0x0;_0x3579ea[_0x8f1f('0x13')][_0x3805c1]['total']+=0x1;if(_0x1efd9a[_0x471a29][_0x24f726]['queuecallercomplete']){_0x3579ea[_0x8f1f('0x13')][_0x3805c1][_0x8f1f('0x5b')]+=0x1;_0x3579ea[_0x8f1f('0x13')][_0x3805c1][_0x8f1f('0x5c')]+=moment(_0x1efd9a[_0x471a29][_0x24f726]['queuecallercompleteAt'])[_0x8f1f('0x57')](moment(_0x1efd9a[_0x471a29][_0x24f726][_0x8f1f('0x56')]),_0x8f1f('0x58'))||0x0;}}else{_0x3579ea[_0x8f1f('0x13')][_0x3805c1][_0x8f1f('0x2d')]+=_0x3579ea[_0x8f1f('0x13')][_0x3805c1][_0x8f1f('0x2c')]||0x0;}}}}}}return _0x3579ea[_0x8f1f('0x13')];};};Realtime[_0x8f1f('0x3d')]['initVoiceCallReports']=function(){var _0x2a4679=this;return function(_0x3971da){clearVoiceCallReports(_0x2a4679[_0x8f1f('0x16')]);if(_0x3971da){for(var _0x384fd9=0x0;_0x384fd9<_0x3971da[_0x8f1f('0x3f')];_0x384fd9+=0x1){_0x2a4679[_0x8f1f('0x16')][_0x8f1f('0x2b')]+=0x1;_0x2a4679[_0x8f1f('0x16')][_0x8f1f('0x2d')]+=_0x3971da[_0x384fd9][_0x8f1f('0x5d')];if(_0x3971da[_0x384fd9][_0x8f1f('0x5e')]===_0x8f1f('0x5f')){_0x2a4679['outbound'][_0x8f1f('0x5b')]+=0x1;_0x2a4679[_0x8f1f('0x16')][_0x8f1f('0x2c')]+=_0x3971da[_0x384fd9][_0x8f1f('0x5d')]-_0x3971da[_0x384fd9]['billableseconds']||0x0;_0x2a4679[_0x8f1f('0x16')][_0x8f1f('0x5c')]+=_0x3971da[_0x384fd9][_0x8f1f('0x60')];}}}return _0x2a4679['outbound'];};};Realtime['prototype']['initCampaigns']=function(){var _0x1aa68d=this;return function(_0x6feb6b){if(_0x6feb6b){freeIsNotKey(_0x6feb6b,_0x1aa68d['campaigns'],_0x8f1f('0x2a'));for(var _0x597270=0x0,_0x5723f4={};_0x597270<_0x6feb6b[_0x8f1f('0x3f')];_0x597270+=0x1){_0x5723f4=_0x6feb6b[_0x597270];if(_[_0x8f1f('0x40')](_0x1aa68d['campaigns'][_0x5723f4['name']])){_0x1aa68d[_0x8f1f('0x14')][_0x5723f4[_0x8f1f('0x2a')]]=new Campaign(_0x5723f4);}else{_0x1aa68d[_0x8f1f('0x41')](_0x1aa68d['campaigns'][_0x5723f4['name']],_0x5723f4);_0x1aa68d[_0x8f1f('0x14')][_0x5723f4[_0x8f1f('0x2a')]][_0x8f1f('0x61')]=_0x5723f4[_0x8f1f('0x62')]?_0x5723f4[_0x8f1f('0x62')][_0x8f1f('0x2a')]:undefined;}}}return _0x1aa68d[_0x8f1f('0x14')];};};Realtime[_0x8f1f('0x3d')][_0x8f1f('0x63')]=function(){var _0x43a694=this;return function(_0x38ca64){if(_0x38ca64){freeIsNotKey(_0x38ca64,_0x43a694[_0x8f1f('0x64')],'id');for(var _0x36870e=0x0,_0x4b1fed={};_0x36870e<_0x38ca64[_0x8f1f('0x3f')];_0x36870e+=0x1){_0x4b1fed=_0x38ca64[_0x36870e];if(_[_0x8f1f('0x40')](_0x43a694[_0x8f1f('0x64')][_0x4b1fed['id']])){_0x43a694[_0x8f1f('0x64')][_0x4b1fed['id']]=new VoiceExtension(_0x4b1fed);}else{_0x43a694['mergeFromDatabase'](_0x43a694[_0x8f1f('0x64')][_0x4b1fed['id']],_0x4b1fed);}}}return _0x43a694[_0x8f1f('0x64')];};};Realtime[_0x8f1f('0x3d')][_0x8f1f('0x65')]=function(){var _0x1dcd8a=this;return function(_0xf557c4){clearCampaigns(_0x1dcd8a['campaigns']);for(var _0x24ff2e=0x0;_0x24ff2e<_0xf557c4['length'];_0x24ff2e+=0x1){_[_0x8f1f('0x66')](_0x1dcd8a[_0x8f1f('0x14')][_0xf557c4[_0x24ff2e]['name']],_0xf557c4[_0x24ff2e]);}return _0x1dcd8a['campaigns'];};};Realtime[_0x8f1f('0x3d')][_0x8f1f('0x67')]=function(){var _0x3783cc=this;return function(_0x7556dd){if(_0x7556dd){freeIsNotKey(_0x7556dd,_0x3783cc[_0x8f1f('0x24')],'id');for(var _0x4d1bfc=0x0,_0x4d9f9e={},_0x2e3174={};_0x4d1bfc<_0x7556dd[_0x8f1f('0x3f')];_0x4d1bfc+=0x1){_0x4d9f9e=_0x7556dd[_0x4d1bfc];if(_['isUndefined'](_0x3783cc[_0x8f1f('0x24')][_0x4d9f9e['id']])){_0x3783cc['faxAccounts'][_0x4d9f9e['id']]=new FaxAccount(_0x4d9f9e);}else{_0x3783cc['mergeFromDatabase'](_0x3783cc[_0x8f1f('0x24')][_0x4d9f9e['id']],_0x4d9f9e);}}}return _0x3783cc[_0x8f1f('0x24')];};};module[_0x8f1f('0x68')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 59de623..5497a30 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 _0xe187=['attendedTransfer','findAgent','find','accountcode','isNil','name','format','prototype','length','connectedlinenum','assigned','lastAssignedTo','interface','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','create','match','destination','exten','dialer','lastapplication','queue','lastdata','context','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','channel','calleridnum','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','monitor','monitors','monitorFilename','createdAt','connectedlinename','membername','isArray','forEach','startsWith','Local','indexOf','phone','substring','exports','lodash','moment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer'];(function(_0x268c18,_0x5445de){var _0x590eb4=function(_0x4a89c5){while(--_0x4a89c5){_0x268c18['push'](_0x268c18['shift']());}};_0x590eb4(++_0x5445de);}(_0xe187,0x126));var _0x7e18=function(_0x1fda58,_0x1a691d){_0x1fda58=_0x1fda58-0x0;var _0x3dce0e=_0xe187[_0x1fda58];return _0x3dce0e;};'use strict';var _=require(_0x7e18('0x0'));var moment=require(_0x7e18('0x1'));var util=require('util');var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0x7e18('0x2'));var RpcVoiceCallReport=require(_0x7e18('0x3'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x7e18('0x4'));var RpcVoiceQueueReport=require(_0x7e18('0x5'));var RpcVoiceRecording=require(_0x7e18('0x6'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x7e18('0x7'));var VoiceCallReport=require(_0x7e18('0x8'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x7e18('0x9'));var UserReport=require(_0x7e18('0xa'));function Report(_0x21bfde){this[_0x7e18('0xb')]=_0x21bfde;this[_0x7e18('0xc')]=_0x21bfde[_0x7e18('0xc')];this[_0x7e18('0xd')]=_0x21bfde[_0x7e18('0xd')];}Report['prototype'][_0x7e18('0xe')]=function(_0x4941b7){var _0x348264=new VoiceQueueReport(this[_0x7e18('0xb')]);var _0x460c18=new VoiceAgentReport(this[_0x7e18('0xb')]);var _0x20e558=new VoiceDialReport(this[_0x7e18('0xb')]);var _0x203c80=new VoiceCallReport(this['realtime']);var _0x219177=new UserReport(this[_0x7e18('0xb')]);if(config['xdr']&&config[_0x7e18('0xf')][_0x7e18('0x10')]){ami['on'](_0x7e18('0x11'),this[_0x7e18('0x12')]['bind'](this));ami['on']('custom:voiceCallReport',this[_0x7e18('0x13')][_0x7e18('0x14')](this));ami['on'](_0x7e18('0x15'),this[_0x7e18('0x16')]['bind'](this));ami['on']('custom:voiceDialReport',this[_0x7e18('0x17')]['bind'](this));ami['on'](_0x7e18('0x18'),this[_0x7e18('0x19')][_0x7e18('0x14')](this));ami['on']('attendedtransfer',this[_0x7e18('0x1a')][_0x7e18('0x14')](this));}};Report['prototype'][_0x7e18('0x1b')]=function(_0x5873cd){var _0x403814;_0x403814=_[_0x7e18('0x1c')](this[_0x7e18('0xc')],function(_0x4f122f){return _0x4f122f[_0x7e18('0x1d')]==_0x5873cd||_0x4f122f['name']==_0x5873cd;});if(_[_0x7e18('0x1e')](_0x403814)){var _0xc3c092=_[_0x7e18('0x1c')](this[_0x7e18('0xd')],function(_0x14d875){return _0x14d875[_0x7e18('0x1d')]==_0x5873cd||_0x14d875[_0x7e18('0x1f')]==_0x5873cd;});if(_0xc3c092){_0x403814=_[_0x7e18('0x1c')](this[_0x7e18('0xc')],function(_0x463466){return _0x463466['interface']==util[_0x7e18('0x20')]('SIP/%s',_0xc3c092[_0x7e18('0x1f')]);});}}return _0x403814;};Report[_0x7e18('0x21')]['voiceQueueReport']=function(_0x2a7d01){for(var _0x1e0c67=0x0;_0x1e0c67<_0x2a7d01[_0x7e18('0x22')];_0x1e0c67+=0x1){var _0x2c5abb=this[_0x7e18('0x1b')](_0x2a7d01[_0x1e0c67][_0x7e18('0x23')]);if(_0x2c5abb){_0x2a7d01[_0x1e0c67][_0x7e18('0x1d')]=_0x2c5abb[_0x7e18('0x1d')];_0x2a7d01[_0x1e0c67][_0x7e18('0x24')]=!![];_0x2a7d01[_0x1e0c67][_0x7e18('0x25')]=_0x2c5abb[_0x7e18('0x1f')];_0x2a7d01[_0x1e0c67]['interface']=_[_0x7e18('0x1e')](_0x2c5abb['interface'])?util[_0x7e18('0x20')]('SIP/%s',_0x2c5abb[_0x7e18('0x1f')]):_0x2c5abb[_0x7e18('0x26')];if(_0x2a7d01[_0x1e0c67][_0x7e18('0x27')]){_0x2a7d01[_0x1e0c67][_0x7e18('0x28')]=moment()[_0x7e18('0x20')](_0x7e18('0x29'));}if(_0x2a7d01[_0x1e0c67]['queuecallerexit']){_0x2a7d01[_0x1e0c67]['queuecallerexitAt']=moment()['format'](_0x7e18('0x29'));}RpcMemberReport['voiceQueueReport'](_0x2a7d01[_0x1e0c67]);}RpcVoiceQueueReport[_0x7e18('0x2a')](_0x2a7d01[_0x1e0c67]);}};function extractCalleridNumber(_0x3d0400){var _0x42d9c0=_0x3d0400[_0x7e18('0x2b')](/<(.*?)>/);return _0x42d9c0?_0x42d9c0[0x1]:_0x3d0400;}Report['prototype'][_0x7e18('0x13')]=function(_0xe8ed45){_0xe8ed45[_0x7e18('0x2c')]=_0xe8ed45[_0x7e18('0x2c')]||_0xe8ed45[_0x7e18('0x2d')];if(_0xe8ed45['type']==_0x7e18('0x2e')){_0xe8ed45[_0x7e18('0x2f')]=_0x7e18('0x30');_0xe8ed45[_0x7e18('0x31')]=_0xe8ed45[_0x7e18('0x30')];if(_0xe8ed45[_0x7e18('0x32')]=='from-voip-provider'){_0xe8ed45['accountcode']='';_0xe8ed45[_0x7e18('0x2c')]=extractCalleridNumber(_0xe8ed45[_0x7e18('0x33')]);}else if(_0xe8ed45['context']==_0x7e18('0x34')){if(_0xe8ed45[_0x7e18('0x2c')]==_0x7e18('0x35')){_0xe8ed45[_0x7e18('0x2c')]=extractCalleridNumber(_0xe8ed45[_0x7e18('0x36')]);_0xe8ed45['calleridnum']=_0xe8ed45[_0x7e18('0x37')];_0xe8ed45[_0x7e18('0x38')]=[_0xe8ed45['channel'],_0xe8ed45[_0x7e18('0x39')]=_0xe8ed45['destinationchannel']][0x0];_0xe8ed45[_0x7e18('0x33')]=_0xe8ed45[_0x7e18('0x36')];}else{_0xe8ed45[_0x7e18('0x2c')]=_0xe8ed45[_0x7e18('0x3a')];_0xe8ed45[_0x7e18('0x3a')]=_0xe8ed45['originatecalleridnum'];if(_0xe8ed45['disposition']==_0x7e18('0x3b')){_0xe8ed45[_0x7e18('0x1d')]=_0xe8ed45['connectedlinenum'];}else{_0xe8ed45[_0x7e18('0x1d')]='';}}}}else{_0xe8ed45[_0x7e18('0x33')]=util[_0x7e18('0x20')](_0x7e18('0x3c'),_0xe8ed45[_0x7e18('0x3d')],_0xe8ed45['calleridnum']);}if(RpcVoiceTransferReport[_0x7e18('0x3e')][_0xe8ed45[_0x7e18('0x3f')]]){var _0x14c924=RpcVoiceTransferReport[_0x7e18('0x3e')][_0xe8ed45['linkedid']];_0x14c924[_0x7e18('0x40')]=_0xe8ed45[_0x7e18('0x41')];RpcVoiceTransferReport[_0x7e18('0x19')](_0x14c924);delete RpcVoiceTransferReport[_0x7e18('0x3e')][_0xe8ed45[_0x7e18('0x3f')]];}RpcVoiceCallReport[_0x7e18('0x2a')](_0xe8ed45);if(_0xe8ed45[_0x7e18('0x42')]){for(var _0x371524=0x0;_0x371524<_0xe8ed45[_0x7e18('0x43')][_0x7e18('0x22')];_0x371524+=0x1){_0xe8ed45[_0x7e18('0x44')]=_0xe8ed45[_0x7e18('0x43')][_0x371524]['filename'];_0xe8ed45['createdAt']=_0xe8ed45['monitors'][_0x371524][_0x7e18('0x45')];if(_0xe8ed45['exten']=='xcally-motion-preview'){_0xe8ed45['calleridnum']=_0xe8ed45[_0x7e18('0x23')];_0xe8ed45[_0x7e18('0x3d')]=_0xe8ed45[_0x7e18('0x46')];_0xe8ed45['connectedlinenum']=_0xe8ed45['accountcode'];_0xe8ed45[_0x7e18('0x46')]=_0xe8ed45[_0x7e18('0x47')];_0xe8ed45[_0x7e18('0x2d')]=_0xe8ed45[_0x7e18('0x37')];}else if(_0xe8ed45[_0x7e18('0x2d')]=='xcally-motion-dialer'){_0xe8ed45[_0x7e18('0x3a')]=_0xe8ed45[_0x7e18('0x2c')];_0xe8ed45[_0x7e18('0x2d')]=_0xe8ed45[_0x7e18('0x37')];}RpcVoiceRecording[_0x7e18('0x2a')](_0xe8ed45);}}};Report[_0x7e18('0x21')][_0x7e18('0x16')]=function(_0x1a7da2){if(_[_0x7e18('0x48')](_0x1a7da2)){_0x1a7da2[_0x7e18('0x49')](function(_0x57ba36){RpcVoiceAgentReport[_0x7e18('0x2a')](_0x57ba36);});}else{RpcVoiceAgentReport[_0x7e18('0x2a')](_0x1a7da2);}};Report[_0x7e18('0x21')][_0x7e18('0x17')]=function(_0x26166e){RpcVoiceDialReport[_0x7e18('0x2a')](_0x26166e);var _0x393a21;var _0x4ba8f5;var _0x56ad19=_0x26166e[_0x7e18('0x39')];if(_[_0x7e18('0x4a')](_0x56ad19,_0x7e18('0x4b'))){_0x4ba8f5=_0x56ad19['substring'](_0x56ad19[_0x7e18('0x4c')]('/')+0x1,_0x56ad19[_0x7e18('0x4c')]('@'));_0x393a21=_[_0x7e18('0x1c')](this[_0x7e18('0xc')],function(_0x39aabf){return _0x39aabf['mobile']==_0x4ba8f5||_0x39aabf[_0x7e18('0x4d')]==_0x4ba8f5||_0x39aabf[_0x7e18('0x1d')]==_0x4ba8f5;});}else{_0x4ba8f5=_0x56ad19[_0x7e18('0x4e')](_0x56ad19['indexOf']('/')+0x1,_0x56ad19['lastIndexOf']('-'));_0x393a21=this['findAgent'](_0x4ba8f5);}if(_0x393a21){_0x26166e[_0x7e18('0x26')]=_[_0x7e18('0x1e')](_0x393a21[_0x7e18('0x26')])?util[_0x7e18('0x20')]('SIP/%s',_0x393a21[_0x7e18('0x1f')]):_0x393a21[_0x7e18('0x26')];_0x26166e[_0x7e18('0x47')]=_0x393a21[_0x7e18('0x1f')];_0x26166e[_0x7e18('0x1d')]=_0x393a21['accountcode'];RpcMemberReport[_0x7e18('0x17')](_0x26166e);}};Report[_0x7e18('0x21')][_0x7e18('0x19')]=function(_0x413ef4){RpcVoiceTransferReport[_0x7e18('0x3e')][_0x413ef4['transfererlinkedid']]=_0x413ef4;};Report[_0x7e18('0x21')][_0x7e18('0x1a')]=function(_0x2efd4c){RpcVoiceTransferReport[_0x7e18('0x1a')](_0x2efd4c);};module[_0x7e18('0x4f')]=Report; \ No newline at end of file +var _0xe919=['custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','find','accountcode','interface','SIP/%s','name','length','findAgent','connectedlinenum','assigned','lastAssignedTo','isNil','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','format','create','match','destination','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','disposition','ANSWERED','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','monitor','monitors','monitorFilename','createdAt','exten','connectedlinename','xcally-motion-dialer','isArray','forEach','Local','substring','indexOf','mobile','phone','lastIndexOf','membername','blindTransfer','attendedTransfer','exports','moment','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','voiceQueueReport','bind'];(function(_0x10ed38,_0x434529){var _0x20d8c1=function(_0x40511d){while(--_0x40511d){_0x10ed38['push'](_0x10ed38['shift']());}};_0x20d8c1(++_0x434529);}(_0xe919,0x153));var _0x9e91=function(_0x1b76e6,_0x598520){_0x1b76e6=_0x1b76e6-0x0;var _0x333b53=_0xe919[_0x1b76e6];return _0x333b53;};'use strict';var _=require('lodash');var moment=require(_0x9e91('0x0'));var util=require('util');var config=require(_0x9e91('0x1'));var ami=require(_0x9e91('0x2'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x9e91('0x3'));var RpcVoiceDialReport=require(_0x9e91('0x4'));var RpcMemberReport=require(_0x9e91('0x5'));var RpcVoiceQueueReport=require(_0x9e91('0x6'));var RpcVoiceRecording=require(_0x9e91('0x7'));var RpcVoiceTransferReport=require(_0x9e91('0x8'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x9e91('0x9'));var VoiceDialReport=require(_0x9e91('0xa'));var UserReport=require(_0x9e91('0xb'));function Report(_0x7b107d){this[_0x9e91('0xc')]=_0x7b107d;this[_0x9e91('0xd')]=_0x7b107d[_0x9e91('0xd')];this[_0x9e91('0xe')]=_0x7b107d[_0x9e91('0xe')];}Report[_0x9e91('0xf')][_0x9e91('0x10')]=function(_0x55c785){var _0x3cb32d=new VoiceQueueReport(this[_0x9e91('0xc')]);var _0x3e256a=new VoiceAgentReport(this[_0x9e91('0xc')]);var _0x2af598=new VoiceDialReport(this[_0x9e91('0xc')]);var _0x3e4127=new VoiceCallReport(this[_0x9e91('0xc')]);var _0x33a3eb=new UserReport(this[_0x9e91('0xc')]);if(config['xdr']&&config[_0x9e91('0x11')][_0x9e91('0x12')]){ami['on']('custom:voiceQueueReport',this[_0x9e91('0x13')][_0x9e91('0x14')](this));ami['on'](_0x9e91('0x15'),this[_0x9e91('0x16')][_0x9e91('0x14')](this));ami['on'](_0x9e91('0x17'),this[_0x9e91('0x18')][_0x9e91('0x14')](this));ami['on'](_0x9e91('0x19'),this[_0x9e91('0x1a')][_0x9e91('0x14')](this));ami['on'](_0x9e91('0x1b'),this['blindTransfer'][_0x9e91('0x14')](this));ami['on'](_0x9e91('0x1c'),this['attendedTransfer'][_0x9e91('0x14')](this));}};Report[_0x9e91('0xf')]['findAgent']=function(_0x4072aa){var _0x48d752;_0x48d752=_[_0x9e91('0x1d')](this['agents'],function(_0x3e3faf){return _0x3e3faf[_0x9e91('0x1e')]==_0x4072aa||_0x3e3faf['name']==_0x4072aa;});if(_['isNil'](_0x48d752)){var _0x3ab5b1=_[_0x9e91('0x1d')](this[_0x9e91('0xe')],function(_0xd17e1){return _0xd17e1[_0x9e91('0x1e')]==_0x4072aa||_0xd17e1['name']==_0x4072aa;});if(_0x3ab5b1){_0x48d752=_[_0x9e91('0x1d')](this[_0x9e91('0xd')],function(_0xf3e974){return _0xf3e974[_0x9e91('0x1f')]==util['format'](_0x9e91('0x20'),_0x3ab5b1[_0x9e91('0x21')]);});}}return _0x48d752;};Report[_0x9e91('0xf')][_0x9e91('0x13')]=function(_0x53e6e1){for(var _0x364aa1=0x0;_0x364aa1<_0x53e6e1[_0x9e91('0x22')];_0x364aa1+=0x1){var _0x5e9038=this[_0x9e91('0x23')](_0x53e6e1[_0x364aa1][_0x9e91('0x24')]);if(_0x5e9038){_0x53e6e1[_0x364aa1][_0x9e91('0x1e')]=_0x5e9038[_0x9e91('0x1e')];_0x53e6e1[_0x364aa1][_0x9e91('0x25')]=!![];_0x53e6e1[_0x364aa1][_0x9e91('0x26')]=_0x5e9038[_0x9e91('0x21')];_0x53e6e1[_0x364aa1]['interface']=_[_0x9e91('0x27')](_0x5e9038[_0x9e91('0x1f')])?util['format'](_0x9e91('0x20'),_0x5e9038[_0x9e91('0x21')]):_0x5e9038[_0x9e91('0x1f')];if(_0x53e6e1[_0x364aa1][_0x9e91('0x28')]){_0x53e6e1[_0x364aa1][_0x9e91('0x29')]=moment()['format'](_0x9e91('0x2a'));}if(_0x53e6e1[_0x364aa1][_0x9e91('0x2b')]){_0x53e6e1[_0x364aa1][_0x9e91('0x2c')]=moment()[_0x9e91('0x2d')](_0x9e91('0x2a'));}RpcMemberReport[_0x9e91('0x13')](_0x53e6e1[_0x364aa1]);}RpcVoiceQueueReport[_0x9e91('0x2e')](_0x53e6e1[_0x364aa1]);}};function extractCalleridNumber(_0x3647c1){var _0x1c45e0=_0x3647c1[_0x9e91('0x2f')](/<(.*?)>/);return _0x1c45e0?_0x1c45e0[0x1]:_0x3647c1;}Report[_0x9e91('0xf')][_0x9e91('0x16')]=function(_0x4e10b3){_0x4e10b3['destination']=_0x4e10b3[_0x9e91('0x30')]||_0x4e10b3['exten'];if(_0x4e10b3[_0x9e91('0x31')]==_0x9e91('0x32')){_0x4e10b3[_0x9e91('0x33')]=_0x9e91('0x34');_0x4e10b3[_0x9e91('0x35')]=_0x4e10b3['queue'];if(_0x4e10b3[_0x9e91('0x36')]==_0x9e91('0x37')){_0x4e10b3['accountcode']='';_0x4e10b3[_0x9e91('0x30')]=extractCalleridNumber(_0x4e10b3[_0x9e91('0x38')]);}else if(_0x4e10b3['context']==_0x9e91('0x39')){if(_0x4e10b3[_0x9e91('0x30')]==_0x9e91('0x3a')){_0x4e10b3[_0x9e91('0x30')]=extractCalleridNumber(_0x4e10b3[_0x9e91('0x3b')]);_0x4e10b3[_0x9e91('0x3c')]=_0x4e10b3[_0x9e91('0x3d')];_0x4e10b3[_0x9e91('0x3e')]=[_0x4e10b3['channel'],_0x4e10b3[_0x9e91('0x3f')]=_0x4e10b3[_0x9e91('0x3e')]][0x0];_0x4e10b3[_0x9e91('0x38')]=_0x4e10b3[_0x9e91('0x3b')];}else{_0x4e10b3[_0x9e91('0x30')]=_0x4e10b3[_0x9e91('0x3c')];_0x4e10b3[_0x9e91('0x3c')]=_0x4e10b3[_0x9e91('0x3d')];if(_0x4e10b3[_0x9e91('0x40')]==_0x9e91('0x41')){_0x4e10b3[_0x9e91('0x1e')]=_0x4e10b3[_0x9e91('0x24')];}else{_0x4e10b3['accountcode']='';}}}}else{_0x4e10b3[_0x9e91('0x38')]=util[_0x9e91('0x2d')]('\x22%s\x22\x20<%s>',_0x4e10b3[_0x9e91('0x42')],_0x4e10b3[_0x9e91('0x3c')]);}if(RpcVoiceTransferReport[_0x9e91('0x43')][_0x4e10b3[_0x9e91('0x44')]]){var _0x7c976f=RpcVoiceTransferReport['transfers'][_0x4e10b3[_0x9e91('0x44')]];_0x7c976f[_0x9e91('0x45')]=_0x4e10b3[_0x9e91('0x46')];RpcVoiceTransferReport['blindTransfer'](_0x7c976f);delete RpcVoiceTransferReport[_0x9e91('0x43')][_0x4e10b3['linkedid']];}RpcVoiceCallReport[_0x9e91('0x2e')](_0x4e10b3);if(_0x4e10b3[_0x9e91('0x47')]){for(var _0x56b112=0x0;_0x56b112<_0x4e10b3[_0x9e91('0x48')][_0x9e91('0x22')];_0x56b112+=0x1){_0x4e10b3[_0x9e91('0x49')]=_0x4e10b3[_0x9e91('0x48')][_0x56b112]['filename'];_0x4e10b3[_0x9e91('0x4a')]=_0x4e10b3['monitors'][_0x56b112][_0x9e91('0x4a')];if(_0x4e10b3[_0x9e91('0x4b')]==_0x9e91('0x3a')){_0x4e10b3[_0x9e91('0x3c')]=_0x4e10b3[_0x9e91('0x24')];_0x4e10b3[_0x9e91('0x42')]=_0x4e10b3[_0x9e91('0x4c')];_0x4e10b3[_0x9e91('0x24')]=_0x4e10b3[_0x9e91('0x1e')];_0x4e10b3[_0x9e91('0x4c')]=_0x4e10b3['membername'];_0x4e10b3['exten']=_0x4e10b3[_0x9e91('0x3d')];}else if(_0x4e10b3[_0x9e91('0x4b')]==_0x9e91('0x4d')){_0x4e10b3['calleridnum']=_0x4e10b3[_0x9e91('0x30')];_0x4e10b3[_0x9e91('0x4b')]=_0x4e10b3[_0x9e91('0x3d')];}RpcVoiceRecording[_0x9e91('0x2e')](_0x4e10b3);}}};Report['prototype'][_0x9e91('0x18')]=function(_0x57f5d5){if(_[_0x9e91('0x4e')](_0x57f5d5)){_0x57f5d5[_0x9e91('0x4f')](function(_0x54a4e7){RpcVoiceAgentReport[_0x9e91('0x2e')](_0x54a4e7);});}else{RpcVoiceAgentReport[_0x9e91('0x2e')](_0x57f5d5);}};Report[_0x9e91('0xf')]['voiceDialReport']=function(_0x22a0a9){RpcVoiceDialReport[_0x9e91('0x2e')](_0x22a0a9);var _0x296214;var _0x14d2d8;var _0x4d5bb8=_0x22a0a9[_0x9e91('0x3f')];if(_['startsWith'](_0x4d5bb8,_0x9e91('0x50'))){_0x14d2d8=_0x4d5bb8[_0x9e91('0x51')](_0x4d5bb8[_0x9e91('0x52')]('/')+0x1,_0x4d5bb8[_0x9e91('0x52')]('@'));_0x296214=_['find'](this['agents'],function(_0x211113){return _0x211113[_0x9e91('0x53')]==_0x14d2d8||_0x211113[_0x9e91('0x54')]==_0x14d2d8||_0x211113['accountcode']==_0x14d2d8;});}else{_0x14d2d8=_0x4d5bb8[_0x9e91('0x51')](_0x4d5bb8[_0x9e91('0x52')]('/')+0x1,_0x4d5bb8[_0x9e91('0x55')]('-'));_0x296214=this[_0x9e91('0x23')](_0x14d2d8);}if(_0x296214){_0x22a0a9[_0x9e91('0x1f')]=_['isNil'](_0x296214[_0x9e91('0x1f')])?util[_0x9e91('0x2d')](_0x9e91('0x20'),_0x296214[_0x9e91('0x21')]):_0x296214['interface'];_0x22a0a9[_0x9e91('0x56')]=_0x296214[_0x9e91('0x21')];_0x22a0a9[_0x9e91('0x1e')]=_0x296214[_0x9e91('0x1e')];RpcMemberReport[_0x9e91('0x1a')](_0x22a0a9);}};Report[_0x9e91('0xf')][_0x9e91('0x57')]=function(_0x40f5b5){RpcVoiceTransferReport[_0x9e91('0x43')][_0x40f5b5['transfererlinkedid']]=_0x40f5b5;};Report['prototype'][_0x9e91('0x58')]=function(_0x49cb0a){RpcVoiceTransferReport[_0x9e91('0x58')](_0x49cb0a);};module[_0x9e91('0x59')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 6bad09d..f9ae6c4 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a37=['omit','event','actionid','format','trunk:%s','name','trunk:save','isNotNull','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','device','toLowerCase','inuse','local','stateTime','toNumber','updateStatusRealtime','telephones','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','find','phone','accountcode','syncPeerStatus','address','peer','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]','exports','moment','ioredis','bluebird','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','agents','registryentry','syncRegistry','registry','bind','devicestatechange','syncDeviceState','peerstatus','resolve','then','actionSipShowRegistry','catch','error','inspect','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','prototype','isUndefined','emit','info','username','debug','trunks','stateRegistry','state'];(function(_0x329fd2,_0x201f4d){var _0x55d7c1=function(_0x32e5f9){while(--_0x32e5f9){_0x329fd2['push'](_0x329fd2['shift']());}};_0x55d7c1(++_0x201f4d);}(_0x4a37,0xb1));var _0x74a3=function(_0x8a7585,_0x287a7f){_0x8a7585=_0x8a7585-0x0;var _0x1648a7=_0x4a37[_0x8a7585];return _0x1648a7;};'use strict';var _=require('lodash');var moment=require(_0x74a3('0x0'));var util=require('util');var Redis=require(_0x74a3('0x1'));var BPromise=require(_0x74a3('0x2'));var config=require(_0x74a3('0x3'));var logger=require('../../../config/logger')(_0x74a3('0x4'));var ami=require(_0x74a3('0x5'));config[_0x74a3('0x6')]=_[_0x74a3('0x7')](config['redis'],{'host':_0x74a3('0x8'),'port':0x18eb});var io=require(_0x74a3('0x9'))(new Redis(config[_0x74a3('0x6')]));function UserReport(_0x3bdc34){this['trunks']=_0x3bdc34['trunks'];this['agents']=_0x3bdc34[_0x74a3('0xa')];this['telephones']=_0x3bdc34['telephones'];ami['on'](_0x74a3('0xb'),this[_0x74a3('0xc')]['bind'](this));ami['on'](_0x74a3('0xd'),this[_0x74a3('0xc')][_0x74a3('0xe')](this));ami['on'](_0x74a3('0xf'),this[_0x74a3('0x10')][_0x74a3('0xe')](this));ami['on'](_0x74a3('0x11'),this['syncPeerStatus']['bind'](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0x74a3('0x12')]()[_0x74a3('0x13')](ami[_0x74a3('0x14')]())[_0x74a3('0x15')](function(_0x3791d7){logger[_0x74a3('0x16')]('[userReport][sipshowregistry]',util[_0x74a3('0x17')](_0x3791d7,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x74a3('0x12')]()[_0x74a3('0x13')](ami[_0x74a3('0x18')]())[_0x74a3('0x15')](function(_0x4f1738){logger['error'](_0x74a3('0x19'),util[_0x74a3('0x17')](_0x4f1738,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x74a3('0x12')]()[_0x74a3('0x13')](ami[_0x74a3('0x1a')]())[_0x74a3('0x15')](function(_0xe0ee56){logger[_0x74a3('0x16')]('[userReport][sippeerstatus]',util[_0x74a3('0x17')](_0xe0ee56,{'showHidden':![],'depth':null}));});}UserReport[_0x74a3('0x1b')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x74a3('0x12')]()[_0x74a3('0x13')](showSipRegistrations())[_0x74a3('0x13')](listDeviceStates())[_0x74a3('0x13')](showPeersStatus());},0x32c8);};UserReport[_0x74a3('0x1b')]['isNotNull']=function(_0x1cea0d){return _0x1cea0d!==null&&!_[_0x74a3('0x1c')](_0x1cea0d);};UserReport[_0x74a3('0x1b')][_0x74a3('0x1d')]=function(_0x4d17b6,_0x424e3b,_0x224f93){io['to'](_0x4d17b6)[_0x74a3('0x1d')](_0x424e3b,_0x224f93);};UserReport[_0x74a3('0x1b')][_0x74a3('0xc')]=function(_0x2b95e4){try{if(this['isNotNull'](_0x2b95e4)){logger[_0x74a3('0x1e')]('[userReport][registry]\x20registry:%s\x20state:%s',_0x2b95e4[_0x74a3('0x1f')],_0x2b95e4['state']);logger[_0x74a3('0x20')]('[userReport][registry]',util[_0x74a3('0x17')](_0x2b95e4,{'showHidden':![],'depth':null}));var _0x3a7c15=_['find'](this[_0x74a3('0x21')],{'defaultuser':_0x2b95e4[_0x74a3('0x1f')]});if(_0x3a7c15){_0x2b95e4[_0x74a3('0x22')]=_0x2b95e4[_0x74a3('0x23')];_['merge'](_0x3a7c15,_[_0x74a3('0x24')](_0x2b95e4,[_0x74a3('0x25'),_0x74a3('0x26'),'username',_0x74a3('0x23')]));logger[_0x74a3('0x20')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0x74a3('0x17')](_0x3a7c15,{'showHidden':![],'depth':null}));this['emit'](util[_0x74a3('0x27')](_0x74a3('0x28'),_0x3a7c15[_0x74a3('0x29')]),_0x74a3('0x2a'),_0x3a7c15);}}}catch(_0x380f56){logger[_0x74a3('0x16')]('[userReport][registry]',util[_0x74a3('0x17')](_0x380f56,{'showHidden':![],'depth':null}));}};UserReport[_0x74a3('0x1b')][_0x74a3('0x10')]=function(_0x4133ea){try{if(this[_0x74a3('0x2b')](_0x4133ea)){logger[_0x74a3('0x1e')](_0x74a3('0x2c'),_0x4133ea['device'],_0x4133ea[_0x74a3('0x23')]);logger['debug'](_0x74a3('0x2d'),util[_0x74a3('0x17')](_0x4133ea,{'showHidden':![],'depth':null}));if(this[_0x74a3('0xa')][_0x4133ea[_0x74a3('0x2e')]]){if(!this[_0x74a3('0xa')][_0x4133ea[_0x74a3('0x2e')]]['local']||_0x4133ea['state'][_0x74a3('0x2f')]()==_0x74a3('0x30')){this['agents'][_0x4133ea[_0x74a3('0x2e')]][_0x74a3('0x31')]=![];if(this['agents'][_0x4133ea[_0x74a3('0x2e')]][_0x74a3('0x23')]!==_0x4133ea[_0x74a3('0x23')][_0x74a3('0x2f')]()){this[_0x74a3('0xa')][_0x4133ea['device']][_0x74a3('0x32')]=_[_0x74a3('0x33')](moment()[_0x74a3('0x27')]('x'));}this[_0x74a3('0xa')][_0x4133ea[_0x74a3('0x2e')]][_0x74a3('0x23')]=_0x4133ea[_0x74a3('0x23')][_0x74a3('0x2f')]();this[_0x74a3('0xa')][_0x4133ea[_0x74a3('0x2e')]][_0x74a3('0x34')](_0x4133ea);}}else if(this[_0x74a3('0x35')][_0x4133ea[_0x74a3('0x2e')]]){if(this[_0x74a3('0x35')][_0x4133ea[_0x74a3('0x2e')]]['state']!==_0x4133ea[_0x74a3('0x23')]['toLowerCase']()){this[_0x74a3('0x35')][_0x4133ea[_0x74a3('0x2e')]][_0x74a3('0x32')]=_[_0x74a3('0x33')](moment()[_0x74a3('0x27')]('x'));}this[_0x74a3('0x35')][_0x4133ea[_0x74a3('0x2e')]][_0x74a3('0x23')]=_0x4133ea[_0x74a3('0x23')]['toLowerCase']();logger[_0x74a3('0x20')](_0x74a3('0x36'),util[_0x74a3('0x17')](this[_0x74a3('0x35')][_0x4133ea[_0x74a3('0x2e')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x74a3('0x27')]('telephone:%s',this[_0x74a3('0x35')][_0x4133ea[_0x74a3('0x2e')]][_0x74a3('0x29')]),_0x74a3('0x37'),this['telephones'][_0x4133ea['device']]);}else if(this[_0x74a3('0x21')][_0x4133ea[_0x74a3('0x2e')]]){if(this[_0x74a3('0x21')][_0x4133ea['device']]['state']!==_0x4133ea['state'][_0x74a3('0x2f')]()){this[_0x74a3('0x21')][_0x4133ea['device']]['stateTime']=_[_0x74a3('0x33')](moment()[_0x74a3('0x27')]('x'));}this[_0x74a3('0x21')][_0x4133ea[_0x74a3('0x2e')]][_0x74a3('0x23')]=_0x4133ea[_0x74a3('0x23')][_0x74a3('0x2f')]();logger[_0x74a3('0x20')](_0x74a3('0x38'),util[_0x74a3('0x17')](this[_0x74a3('0x21')][_0x4133ea[_0x74a3('0x2e')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x74a3('0x27')](_0x74a3('0x28'),this['trunks'][_0x4133ea[_0x74a3('0x2e')]][_0x74a3('0x29')]),_0x74a3('0x2a'),this[_0x74a3('0x21')][_0x4133ea[_0x74a3('0x2e')]]);}else if(_[_0x74a3('0x39')](_0x4133ea[_0x74a3('0x2e')],_0x74a3('0x3a'))){var _0x3213d2=_0x4133ea['device'];var _0x3210da=_0x3213d2[_0x74a3('0x3b')](_0x3213d2[_0x74a3('0x3c')]('/')+0x1,_0x3213d2[_0x74a3('0x3c')]('@'));var _0x4b62e3=_[_0x74a3('0x3d')](this[_0x74a3('0xa')],function(_0x3f30b1){return _0x3f30b1['mobile']==_0x3210da||_0x3f30b1[_0x74a3('0x3e')]==_0x3210da||_0x3f30b1[_0x74a3('0x3f')]==_0x3210da;});if(_0x4b62e3){if(_0x4b62e3[_0x74a3('0x23')]!==_0x4133ea[_0x74a3('0x23')][_0x74a3('0x2f')]()){_0x4b62e3[_0x74a3('0x32')]=_[_0x74a3('0x33')](moment()[_0x74a3('0x27')]('x'));}_0x4b62e3['state']=_0x4133ea[_0x74a3('0x23')][_0x74a3('0x2f')]();_0x4b62e3[_0x74a3('0x31')]=!![];_0x4b62e3[_0x74a3('0x34')](_0x4133ea);}}}}catch(_0x4c5578){logger[_0x74a3('0x16')](_0x74a3('0x2d'),util[_0x74a3('0x17')](_0x4c5578,{'showHidden':![],'depth':null}));}};UserReport[_0x74a3('0x1b')][_0x74a3('0x40')]=function(_0x3bde4d){try{if(this[_0x74a3('0x2b')](_0x3bde4d)&&this[_0x74a3('0x2b')](_0x3bde4d[_0x74a3('0x11')])){logger[_0x74a3('0x1e')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x3bde4d['peer'],_0x3bde4d[_0x74a3('0x41')],_0x3bde4d['peerstatus']);logger[_0x74a3('0x20')]('[userReport][peerstatus]',util[_0x74a3('0x17')](_0x3bde4d,{'showHidden':![],'depth':null}));if(this[_0x74a3('0xa')][_0x3bde4d[_0x74a3('0x42')]]){if(!this[_0x74a3('0xa')][_0x3bde4d['peer']]['local']||_0x3bde4d[_0x74a3('0x11')][_0x74a3('0x2f')]()=='registered'){this[_0x74a3('0xa')][_0x3bde4d[_0x74a3('0x42')]][_0x74a3('0x31')]=![];this['agents'][_0x3bde4d['peer']][_0x74a3('0x43')]=_0x3bde4d['peerstatus']['toLowerCase']();this[_0x74a3('0xa')][_0x3bde4d['peer']][_0x74a3('0x41')]=_0x3bde4d[_0x74a3('0x41')];this[_0x74a3('0xa')][_0x3bde4d[_0x74a3('0x42')]][_0x74a3('0x34')](_0x3bde4d);}}else if(this[_0x74a3('0x35')][_0x3bde4d[_0x74a3('0x42')]]){this['telephones'][_0x3bde4d[_0x74a3('0x42')]]['status']=_0x3bde4d[_0x74a3('0x11')]['toLowerCase']();this[_0x74a3('0x35')][_0x3bde4d[_0x74a3('0x42')]]['address']=_0x3bde4d['address'];logger[_0x74a3('0x20')](_0x74a3('0x44'),util[_0x74a3('0x17')](this[_0x74a3('0x35')][_0x3bde4d[_0x74a3('0x42')]],{'showHidden':![],'depth':null}));this[_0x74a3('0x1d')](util['format']('telephone:%s',this[_0x74a3('0x35')][_0x3bde4d[_0x74a3('0x42')]][_0x74a3('0x29')]),'telephone:save',this[_0x74a3('0x35')][_0x3bde4d[_0x74a3('0x42')]]);}else if(this['trunks'][_0x3bde4d[_0x74a3('0x42')]]){this[_0x74a3('0x21')][_0x3bde4d[_0x74a3('0x42')]][_0x74a3('0x43')]=_0x3bde4d['peerstatus']['toLowerCase']();this[_0x74a3('0x21')][_0x3bde4d[_0x74a3('0x42')]]['address']=_0x3bde4d['address'];logger['debug']('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0x74a3('0x17')](this['trunks'][_0x3bde4d[_0x74a3('0x42')]],{'showHidden':![],'depth':null}));this[_0x74a3('0x1d')](util[_0x74a3('0x27')](_0x74a3('0x28'),this[_0x74a3('0x21')][_0x3bde4d[_0x74a3('0x42')]][_0x74a3('0x29')]),'trunk:save',this['trunks'][_0x3bde4d[_0x74a3('0x42')]]);}}}catch(_0x477ea3){logger[_0x74a3('0x16')](_0x74a3('0x45'),util['inspect'](_0x477ea3,{'showHidden':![],'depth':null}));}};module[_0x74a3('0x46')]=UserReport; \ No newline at end of file +var _0x226f=['actionSipPeerStatus','prototype','syncRealtimeShow','emit','isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','inuse','local','toLowerCase','stateTime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','toNumber','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','mobile','phone','accountcode','updateStatusRealtime','[userReport][devicestatechange]','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','status','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','redis','localhost','socket.io-emitter','trunks','agents','telephones','syncRegistry','registry','bind','syncDeviceState','syncPeerStatus','resolve','actionSipShowRegistry','catch','[userReport][sipshowregistry]','error','[userReport][devicestatelist]','inspect','then'];(function(_0xaefc69,_0xc58096){var _0x198b99=function(_0x5269fa){while(--_0x5269fa){_0xaefc69['push'](_0xaefc69['shift']());}};_0x198b99(++_0xc58096);}(_0x226f,0x161));var _0xf226=function(_0x506a07,_0x29a85c){_0x506a07=_0x506a07-0x0;var _0x494c65=_0x226f[_0x506a07];return _0x494c65;};'use strict';var _=require(_0xf226('0x0'));var moment=require(_0xf226('0x1'));var util=require(_0xf226('0x2'));var Redis=require(_0xf226('0x3'));var BPromise=require(_0xf226('0x4'));var config=require(_0xf226('0x5'));var logger=require(_0xf226('0x6'))(_0xf226('0x7'));var ami=require('../ami');config[_0xf226('0x8')]=_['defaults'](config[_0xf226('0x8')],{'host':_0xf226('0x9'),'port':0x18eb});var io=require(_0xf226('0xa'))(new Redis(config[_0xf226('0x8')]));function UserReport(_0x47e08a){this[_0xf226('0xb')]=_0x47e08a[_0xf226('0xb')];this[_0xf226('0xc')]=_0x47e08a[_0xf226('0xc')];this[_0xf226('0xd')]=_0x47e08a[_0xf226('0xd')];ami['on']('registryentry',this[_0xf226('0xe')]['bind'](this));ami['on'](_0xf226('0xf'),this[_0xf226('0xe')][_0xf226('0x10')](this));ami['on']('devicestatechange',this[_0xf226('0x11')][_0xf226('0x10')](this));ami['on']('peerstatus',this[_0xf226('0x12')][_0xf226('0x10')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0xf226('0x13')]()['then'](ami[_0xf226('0x14')]())[_0xf226('0x15')](function(_0x8c7353){logger['error'](_0xf226('0x16'),util['inspect'](_0x8c7353,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xf226('0x13')]()['then'](ami['actionDeviceStateList']())['catch'](function(_0x2a9415){logger[_0xf226('0x17')](_0xf226('0x18'),util[_0xf226('0x19')](_0x2a9415,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xf226('0x13')]()[_0xf226('0x1a')](ami[_0xf226('0x1b')]())[_0xf226('0x15')](function(_0x996976){logger['error']('[userReport][sippeerstatus]',util[_0xf226('0x19')](_0x996976,{'showHidden':![],'depth':null}));});}UserReport[_0xf226('0x1c')][_0xf226('0x1d')]=function(){setInterval(function(){BPromise['resolve']()[_0xf226('0x1a')](showSipRegistrations())[_0xf226('0x1a')](listDeviceStates())[_0xf226('0x1a')](showPeersStatus());},0x32c8);};UserReport[_0xf226('0x1c')]['isNotNull']=function(_0x412dfe){return _0x412dfe!==null&&!_['isUndefined'](_0x412dfe);};UserReport[_0xf226('0x1c')][_0xf226('0x1e')]=function(_0x181b14,_0x32657b,_0x4685b6){io['to'](_0x181b14)[_0xf226('0x1e')](_0x32657b,_0x4685b6);};UserReport['prototype'][_0xf226('0xe')]=function(_0x119c61){try{if(this[_0xf226('0x1f')](_0x119c61)){logger[_0xf226('0x20')](_0xf226('0x21'),_0x119c61[_0xf226('0x22')],_0x119c61[_0xf226('0x23')]);logger[_0xf226('0x24')](_0xf226('0x25'),util[_0xf226('0x19')](_0x119c61,{'showHidden':![],'depth':null}));var _0x3d7a01=_[_0xf226('0x26')](this[_0xf226('0xb')],{'defaultuser':_0x119c61[_0xf226('0x22')]});if(_0x3d7a01){_0x119c61['stateRegistry']=_0x119c61[_0xf226('0x23')];_[_0xf226('0x27')](_0x3d7a01,_[_0xf226('0x28')](_0x119c61,[_0xf226('0x29'),_0xf226('0x2a'),'username','state']));logger[_0xf226('0x24')](_0xf226('0x2b'),util[_0xf226('0x19')](_0x3d7a01,{'showHidden':![],'depth':null}));this[_0xf226('0x1e')](util[_0xf226('0x2c')](_0xf226('0x2d'),_0x3d7a01[_0xf226('0x2e')]),_0xf226('0x2f'),_0x3d7a01);}}}catch(_0x4c47b7){logger[_0xf226('0x17')](_0xf226('0x25'),util[_0xf226('0x19')](_0x4c47b7,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncDeviceState']=function(_0x4387de){try{if(this[_0xf226('0x1f')](_0x4387de)){logger[_0xf226('0x20')](_0xf226('0x30'),_0x4387de[_0xf226('0x31')],_0x4387de[_0xf226('0x23')]);logger[_0xf226('0x24')]('[userReport][devicestatechange]',util[_0xf226('0x19')](_0x4387de,{'showHidden':![],'depth':null}));if(this[_0xf226('0xc')][_0x4387de[_0xf226('0x31')]]){if(!this['agents'][_0x4387de['device']]['local']||_0x4387de[_0xf226('0x23')]['toLowerCase']()==_0xf226('0x32')){this[_0xf226('0xc')][_0x4387de[_0xf226('0x31')]][_0xf226('0x33')]=![];if(this[_0xf226('0xc')][_0x4387de['device']][_0xf226('0x23')]!==_0x4387de[_0xf226('0x23')][_0xf226('0x34')]()){this['agents'][_0x4387de[_0xf226('0x31')]][_0xf226('0x35')]=_['toNumber'](moment()[_0xf226('0x2c')]('x'));}this[_0xf226('0xc')][_0x4387de[_0xf226('0x31')]][_0xf226('0x23')]=_0x4387de[_0xf226('0x23')]['toLowerCase']();this[_0xf226('0xc')][_0x4387de[_0xf226('0x31')]]['updateStatusRealtime'](_0x4387de);}}else if(this['telephones'][_0x4387de[_0xf226('0x31')]]){if(this[_0xf226('0xd')][_0x4387de[_0xf226('0x31')]]['state']!==_0x4387de[_0xf226('0x23')][_0xf226('0x34')]()){this[_0xf226('0xd')][_0x4387de[_0xf226('0x31')]]['stateTime']=_['toNumber'](moment()['format']('x'));}this['telephones'][_0x4387de['device']]['state']=_0x4387de[_0xf226('0x23')][_0xf226('0x34')]();logger[_0xf226('0x24')](_0xf226('0x36'),util[_0xf226('0x19')](this[_0xf226('0xd')][_0x4387de[_0xf226('0x31')]],{'showHidden':![],'depth':null}));this[_0xf226('0x1e')](util[_0xf226('0x2c')](_0xf226('0x37'),this[_0xf226('0xd')][_0x4387de['device']][_0xf226('0x2e')]),_0xf226('0x38'),this['telephones'][_0x4387de[_0xf226('0x31')]]);}else if(this[_0xf226('0xb')][_0x4387de[_0xf226('0x31')]]){if(this[_0xf226('0xb')][_0x4387de[_0xf226('0x31')]][_0xf226('0x23')]!==_0x4387de['state'][_0xf226('0x34')]()){this[_0xf226('0xb')][_0x4387de[_0xf226('0x31')]]['stateTime']=_[_0xf226('0x39')](moment()[_0xf226('0x2c')]('x'));}this[_0xf226('0xb')][_0x4387de['device']]['state']=_0x4387de['state'][_0xf226('0x34')]();logger['debug'](_0xf226('0x3a'),util[_0xf226('0x19')](this['trunks'][_0x4387de[_0xf226('0x31')]],{'showHidden':![],'depth':null}));this[_0xf226('0x1e')](util['format'](_0xf226('0x2d'),this['trunks'][_0x4387de[_0xf226('0x31')]][_0xf226('0x2e')]),'trunk:save',this[_0xf226('0xb')][_0x4387de[_0xf226('0x31')]]);}else if(_[_0xf226('0x3b')](_0x4387de[_0xf226('0x31')],_0xf226('0x3c'))){var _0x4c88d4=_0x4387de['device'];var _0xcfef4c=_0x4c88d4[_0xf226('0x3d')](_0x4c88d4[_0xf226('0x3e')]('/')+0x1,_0x4c88d4[_0xf226('0x3e')]('@'));var _0x49edd5=_['find'](this[_0xf226('0xc')],function(_0x5021ba){return _0x5021ba[_0xf226('0x3f')]==_0xcfef4c||_0x5021ba[_0xf226('0x40')]==_0xcfef4c||_0x5021ba[_0xf226('0x41')]==_0xcfef4c;});if(_0x49edd5){if(_0x49edd5[_0xf226('0x23')]!==_0x4387de['state']['toLowerCase']()){_0x49edd5[_0xf226('0x35')]=_[_0xf226('0x39')](moment()[_0xf226('0x2c')]('x'));}_0x49edd5['state']=_0x4387de[_0xf226('0x23')][_0xf226('0x34')]();_0x49edd5[_0xf226('0x33')]=!![];_0x49edd5[_0xf226('0x42')](_0x4387de);}}}}catch(_0x497dfd){logger[_0xf226('0x17')](_0xf226('0x43'),util[_0xf226('0x19')](_0x497dfd,{'showHidden':![],'depth':null}));}};UserReport[_0xf226('0x1c')]['syncPeerStatus']=function(_0x1b7983){try{if(this[_0xf226('0x1f')](_0x1b7983)&&this[_0xf226('0x1f')](_0x1b7983[_0xf226('0x44')])){logger[_0xf226('0x20')](_0xf226('0x45'),_0x1b7983[_0xf226('0x46')],_0x1b7983[_0xf226('0x47')],_0x1b7983[_0xf226('0x44')]);logger[_0xf226('0x24')](_0xf226('0x48'),util[_0xf226('0x19')](_0x1b7983,{'showHidden':![],'depth':null}));if(this[_0xf226('0xc')][_0x1b7983['peer']]){if(!this[_0xf226('0xc')][_0x1b7983[_0xf226('0x46')]][_0xf226('0x33')]||_0x1b7983[_0xf226('0x44')][_0xf226('0x34')]()=='registered'){this[_0xf226('0xc')][_0x1b7983[_0xf226('0x46')]][_0xf226('0x33')]=![];this[_0xf226('0xc')][_0x1b7983[_0xf226('0x46')]][_0xf226('0x49')]=_0x1b7983[_0xf226('0x44')][_0xf226('0x34')]();this['agents'][_0x1b7983[_0xf226('0x46')]][_0xf226('0x47')]=_0x1b7983[_0xf226('0x47')];this['agents'][_0x1b7983[_0xf226('0x46')]][_0xf226('0x42')](_0x1b7983);}}else if(this[_0xf226('0xd')][_0x1b7983[_0xf226('0x46')]]){this[_0xf226('0xd')][_0x1b7983[_0xf226('0x46')]][_0xf226('0x49')]=_0x1b7983[_0xf226('0x44')][_0xf226('0x34')]();this[_0xf226('0xd')][_0x1b7983[_0xf226('0x46')]][_0xf226('0x47')]=_0x1b7983['address'];logger[_0xf226('0x24')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0xf226('0x19')](this[_0xf226('0xd')][_0x1b7983[_0xf226('0x46')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xf226('0x2c')]('telephone:%s',this['telephones'][_0x1b7983[_0xf226('0x46')]]['name']),_0xf226('0x38'),this[_0xf226('0xd')][_0x1b7983[_0xf226('0x46')]]);}else if(this[_0xf226('0xb')][_0x1b7983['peer']]){this[_0xf226('0xb')][_0x1b7983[_0xf226('0x46')]][_0xf226('0x49')]=_0x1b7983[_0xf226('0x44')][_0xf226('0x34')]();this['trunks'][_0x1b7983[_0xf226('0x46')]]['address']=_0x1b7983['address'];logger[_0xf226('0x24')](_0xf226('0x4a'),util['inspect'](this['trunks'][_0x1b7983[_0xf226('0x46')]],{'showHidden':![],'depth':null}));this[_0xf226('0x1e')](util['format']('trunk:%s',this['trunks'][_0x1b7983[_0xf226('0x46')]][_0xf226('0x2e')]),_0xf226('0x2f'),this[_0xf226('0xb')][_0x1b7983[_0xf226('0x46')]]);}}}catch(_0x2ae232){logger[_0xf226('0x17')]('[userReport][peerstatus]',util[_0xf226('0x19')](_0x2ae232,{'showHidden':![],'depth':null}));}};module[_0xf226('0x4b')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 640f5fe..d0416d8 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','voiceChannels','routealias','interface','pick','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answered_elsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','error','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','../../../config/logger','../ami'];(function(_0x13463c,_0x5f094e){var _0x5626ea=function(_0x31a427){while(--_0x31a427){_0x13463c['push'](_0x13463c['shift']());}};_0x5626ea(++_0x5f094e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]]};}_[_0x0a9e('0x2c')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);logger['debug'](_0x0a9e('0x32'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')]('user:%s',_0x155cce[_0x0a9e('0x21')]),'user:called',this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);}}catch(_0x3f3d41){logger['error'](_0x0a9e('0x34'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3f3d41,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncAgentConnect']=function(_0x54135e){try{if(this[_0x0a9e('0x1e')](_0x54135e)){if(this['channels'][_0x54135e[_0x0a9e('0x26')]]){logger[_0x0a9e('0x23')](_0x0a9e('0x35'),_0x54135e[_0x0a9e('0x26')],util['inspect'](_0x54135e,{'showHidden':![],'depth':null}));for(var _0x31916f in this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]]){if(this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x31916f)){if(_0x54135e[_0x0a9e('0x22')]===_0x31916f){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x54135e[_0x0a9e('0x26')],_0x54135e[_0x0a9e('0x21')],_0x54135e['destuniqueid']);this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x37')]=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x38')]=_0x54135e['connectedlinename'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x39')]=_0x54135e['connectedlinenum'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3a')]=_0x54135e[_0x0a9e('0x3a')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3b')]=_0x54135e[_0x0a9e('0x3b')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3c')]=_0x54135e[_0x0a9e('0x3c')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3d')]='connect';if(this['voiceChannels'][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]]){var _0x315881=this[_0x0a9e('0x3e')][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]][_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3f')]=_0x315881;_0x54135e['routealias']=_0x315881;}_[_0x0a9e('0x2c')](this[_0x0a9e('0xa')][_0x54135e[_0x0a9e('0x40')]],_[_0x0a9e('0x41')](_0x54135e,[_0x0a9e('0x28'),_0x0a9e('0x42'),_0x0a9e('0x3f')]));logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x43'),this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')](_0x0a9e('0x44'),_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x54135e[_0x0a9e('0x21')]),_0x0a9e('0x46'),this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x54135e[_0x0a9e('0x22')]]);}else if(!this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']&&!this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x47'),_0x54135e[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x21')],_0x31916f);this['channels'][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x48')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['answeredelsewheredestinationuniqueid']=_0x54135e[_0x0a9e('0x22')];this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['answeredelsewheremembername']=_0x54135e[_0x0a9e('0x21')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['lastevent']=_0x0a9e('0x49');this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['reason']=_0x0a9e('0x49');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentansweredelsewhere',this['channels'][_0x54135e['uniqueid']][_0x31916f]);}}}}}}catch(_0x2da03c){logger['error'](_0x0a9e('0x4a'),_0x54135e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2da03c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x4b')]=function(_0x272738){try{if(this[_0x0a9e('0x1e')](_0x272738)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x272738[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x272738,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']]){logger[_0x0a9e('0x20')](_0x0a9e('0x4c'),_0x272738['uniqueid'],_0x272738[_0x0a9e('0x21')],_0x272738['destuniqueid']);this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738['destuniqueid']]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738[_0x0a9e('0x22')]][_0x0a9e('0x48')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']][_0x0a9e('0x3d')]='rejected';this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]['reason']=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4e'),_0x272738[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x4f'),this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]);}}}catch(_0x4d4a35){logger[_0x0a9e('0x50')](_0x0a9e('0x51'),_0x272738[_0x0a9e('0x26')],util['inspect'](_0x4d4a35,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncQueueCallerAbandon']=function(_0x5211e3){try{if(this[_0x0a9e('0x1e')](_0x5211e3)){logger[_0x0a9e('0x23')](_0x0a9e('0x52'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x5211e3,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){for(var _0x54a37d in this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x54a37d)&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x54'),_0x5211e3[_0x0a9e('0x26')],this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x21')],_0x54a37d);this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]=!![];this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x48')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x3d')]=_0x0a9e('0x55');this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x56')]=_0x0a9e('0x55');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x5211e3['uniqueid']][_0x54a37d],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentqueuecallerabandon',this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]);}}}}}catch(_0x4c46c1){logger[_0x0a9e('0x50')](_0x0a9e('0x57'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c46c1,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x13')]=function(_0x2e9552){try{if(this[_0x0a9e('0x1e')](_0x2e9552)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2e9552,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){for(var _0x4abc8f in this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x4abc8f)){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x37')]&&!this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x58'),_0x2e9552[_0x0a9e('0x26')],this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x21')],_0x4abc8f);this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x59')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]['lastevent']=_0x0a9e('0x5a');this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x56')]=_0x2e9552['reason']==_0x0a9e('0x5b')?_0x0a9e('0x5c'):_0x2e9552[_0x0a9e('0x56')];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5d')]=_0x2e9552[_0x0a9e('0x5d')];if(this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]&&this[_0x0a9e('0x9')][_0x2e9552[_0x0a9e('0x28')]][_0x0a9e('0x5e')]){this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5f')]=this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]['acwTimeout'];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x60')]=!![];}this[_0x0a9e('0xa')][_0x2e9552['interface']]=_['omit'](this[_0x0a9e('0xa')][_0x2e9552[_0x0a9e('0x40')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')](_0x0a9e('0x61'),_0x2e9552['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcomplete',this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);logger[_0x0a9e('0x23')](_0x0a9e('0x62'),_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f],{'showHidden':![],'depth':null}));this['emit'](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x2e9552[_0x0a9e('0x21')]),_0x0a9e('0x63'),this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);}}}}}}catch(_0x32f761){logger[_0x0a9e('0x50')]('[%s][voiceAgentReport][agentcomplete]',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x32f761,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x255e49){try{if(this[_0x0a9e('0x1e')](_0x255e49)){logger[_0x0a9e('0x23')](_0x0a9e('0x64'),_0x255e49['uniqueid'],util[_0x0a9e('0x25')](_0x255e49,{'showHidden':![],'depth':null}));this[_0x0a9e('0x65')](_0x255e49['uniqueid'],_[_0x0a9e('0x66')](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(this['channels'][_0x255e49[_0x0a9e('0x26')]]){for(var _0x52ec10 in this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x52ec10)){logger[_0x0a9e('0x20')](_0x0a9e('0x69'),_0x255e49[_0x0a9e('0x26')],_0x52ec10,_['keys'](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')])){this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]=this[_0x0a9e('0xb')][_0x255e49['uniqueid']];}}}}}catch(_0xc81b64){logger[_0x0a9e('0x50')](_0x0a9e('0x6a'),_0x255e49[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xc81b64,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x65')]=function(_0x1756c7,_0x5ce99d,_0x23b447){var _0x5e725e=[_0x0a9e('0x6b'),_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x6e'),'rtpaudioqosloss',_0x0a9e('0x6f'),'rtpaudioqosrtt',_0x0a9e('0x70'),_0x0a9e('0x71'),'sipuri',_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),'memberdynamic','memberinterface',_0x0a9e('0x75'),_0x0a9e('0x21'),_0x0a9e('0x76'),_0x0a9e('0x77')];if(!_[_0x0a9e('0x78')](_0x5ce99d)&&!_[_0x0a9e('0x79')](_0x5e725e,_0x5ce99d)){if(_[_0x0a9e('0x1f')](this[_0x0a9e('0xb')][_0x1756c7])){this[_0x0a9e('0xb')][_0x1756c7]={};}this['variables'][_0x1756c7][_0x5ce99d]=_0x23b447;}};VoiceAgentReport[_0x0a9e('0x1c')]['syncHangup']=function(_0x287324){try{if(this[_0x0a9e('0x1e')](_0x287324)){logger[_0x0a9e('0x23')](_0x0a9e('0x7a'),_0x287324[_0x0a9e('0x26')],util['inspect'](_0x287324,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){for(var _0x2791c5 in this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){if(this['channels'][_0x287324['uniqueid']][_0x0a9e('0x36')](_0x2791c5)){if(this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x56')]==_0x0a9e('0x5b')&&this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x287324[_0x0a9e('0x26')],_0x2791c5);this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5]['agentcompleteAt']=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger['debug'](_0x0a9e('0x7b'),_0x287324[_0x0a9e('0x26')],util['inspect'](_[_0x0a9e('0x7c')](this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x7d'),_['values'](this['channels'][_0x287324[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]];}if(this[_0x0a9e('0xb')][_0x287324[_0x0a9e('0x26')]]){delete this['variables'][_0x287324[_0x0a9e('0x26')]];}}}catch(_0xadce3d){logger['error'](_0x0a9e('0x7e'),_0x287324[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xadce3d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x7f')]=function(_0x23b39e){try{if(this[_0x0a9e('0x1e')](_0x23b39e)){logger[_0x0a9e('0x23')](_0x0a9e('0x80'),_0x23b39e[_0x0a9e('0x26')],util['inspect'](_0x23b39e,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){for(var _0x2ada60 in this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){if(this['channels'][_0x23b39e['transfereeuniqueid']][_0x0a9e('0x36')](_0x2ada60)){if(_0x23b39e[_0x0a9e('0x82')]===_0x2ada60){logger[_0x0a9e('0x20')](_0x0a9e('0x83'),_0x23b39e[_0x0a9e('0x26')],this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x21')],_0x2ada60);var _0x3450ae=moment();this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x23b39e['transfereeuniqueid']][_0x2ada60][_0x0a9e('0x59')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['lastevent']=_0x0a9e('0x5a');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x5d')]=_0x3450ae[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x37')],_0x0a9e('0x85'));}}}}if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x86')]]){var _0x248368=this['channels'][_0x23b39e['secondtransfereruniqueid']];this[_0x0a9e('0x8')][_0x23b39e['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]];this['channels'][_0x23b39e[_0x0a9e('0x81')]]=_0x248368;}}}catch(_0xe2b083){logger[_0x0a9e('0x50')](_0x0a9e('0x87'),_0x23b39e['uniqueid'],util[_0x0a9e('0x25')](_0xe2b083,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1b')]=function(_0x34a791){try{if(this['isNotNull'](_0x34a791)){logger[_0x0a9e('0x23')](_0x0a9e('0x88'),_0x34a791[_0x0a9e('0x26')],util['inspect'](_0x34a791,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]]){for(var _0x17b29d in this['channels'][_0x34a791[_0x0a9e('0x81')]]){if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x0a9e('0x36')](_0x17b29d)){if(_0x34a791[_0x0a9e('0x89')]===_0x17b29d){logger['info'](_0x0a9e('0x8a'),_0x34a791[_0x0a9e('0x26')],this['channels'][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x21')],_0x17b29d);var _0x1f6f1c=moment();this['channels'][_0x34a791['transfereeuniqueid']][_0x17b29d]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d]['agentcompleteAt']=_0x1f6f1c;this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x3d')]='complete';this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x5d')]=_0x1f6f1c[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x34a791['transfereeuniqueid']][_0x17b29d][_0x0a9e('0x37')],'seconds');}}}}}}catch(_0x138cf5){logger[_0x0a9e('0x50')](_0x0a9e('0x8b'),_0x34a791[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x138cf5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStart']=function(_0x1a0314){var _0x33da81='';try{if(this[_0x0a9e('0x1e')](_0x1a0314)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1a0314,{'showHidden':![],'depth':null}));if(_0x1a0314[_0x0a9e('0x8c')]){_0x33da81=_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0x33da81]){logger[_0x0a9e('0x20')](_0x0a9e('0x8f'),_0x1a0314['uniqueid'],_0x33da81);this[_0x0a9e('0xa')][_0x33da81][_0x0a9e('0x90')]=!![];}}}}catch(_0x2ff265){logger[_0x0a9e('0x50')](_0x0a9e('0x91'),_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2ff265,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStop']=function(_0x3b581c){var _0xd2391='';try{if(this[_0x0a9e('0x1e')](_0x3b581c)){logger['debug'](_0x0a9e('0x92'),_0x3b581c[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3b581c,{'showHidden':![],'depth':null}));if(_0x3b581c[_0x0a9e('0x8c')]){_0xd2391=_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0xd2391]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x3b581c[_0x0a9e('0x26')],_0xd2391);this[_0x0a9e('0xa')][_0xd2391][_0x0a9e('0x90')]=![];}}}}catch(_0x3db98f){logger[_0x0a9e('0x50')](_0x0a9e('0x93'),_0x3b581c['uniqueid'],util[_0x0a9e('0x25')](_0x3db98f,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0xa9e0=['redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','voiceChannels','routealias','interface','pick','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answered_elsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','error','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','../../../config/logger','../ami'];(function(_0x4761e4,_0x2b7519){var _0x2b1694=function(_0x5899cd){while(--_0x5899cd){_0x4761e4['push'](_0x4761e4['shift']());}};_0x2b1694(++_0x2b7519);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]]};}_[_0x0a9e('0x2c')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);logger['debug'](_0x0a9e('0x32'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')]('user:%s',_0x155cce[_0x0a9e('0x21')]),'user:called',this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);}}catch(_0x3f3d41){logger['error'](_0x0a9e('0x34'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3f3d41,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncAgentConnect']=function(_0x54135e){try{if(this[_0x0a9e('0x1e')](_0x54135e)){if(this['channels'][_0x54135e[_0x0a9e('0x26')]]){logger[_0x0a9e('0x23')](_0x0a9e('0x35'),_0x54135e[_0x0a9e('0x26')],util['inspect'](_0x54135e,{'showHidden':![],'depth':null}));for(var _0x31916f in this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]]){if(this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x31916f)){if(_0x54135e[_0x0a9e('0x22')]===_0x31916f){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x54135e[_0x0a9e('0x26')],_0x54135e[_0x0a9e('0x21')],_0x54135e['destuniqueid']);this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x37')]=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x38')]=_0x54135e['connectedlinename'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x39')]=_0x54135e['connectedlinenum'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3a')]=_0x54135e[_0x0a9e('0x3a')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3b')]=_0x54135e[_0x0a9e('0x3b')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3c')]=_0x54135e[_0x0a9e('0x3c')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3d')]='connect';if(this['voiceChannels'][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]]){var _0x315881=this[_0x0a9e('0x3e')][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]][_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3f')]=_0x315881;_0x54135e['routealias']=_0x315881;}_[_0x0a9e('0x2c')](this[_0x0a9e('0xa')][_0x54135e[_0x0a9e('0x40')]],_[_0x0a9e('0x41')](_0x54135e,[_0x0a9e('0x28'),_0x0a9e('0x42'),_0x0a9e('0x3f')]));logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x43'),this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')](_0x0a9e('0x44'),_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x54135e[_0x0a9e('0x21')]),_0x0a9e('0x46'),this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x54135e[_0x0a9e('0x22')]]);}else if(!this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']&&!this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x47'),_0x54135e[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x21')],_0x31916f);this['channels'][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x48')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['answeredelsewheredestinationuniqueid']=_0x54135e[_0x0a9e('0x22')];this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['answeredelsewheremembername']=_0x54135e[_0x0a9e('0x21')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['lastevent']=_0x0a9e('0x49');this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['reason']=_0x0a9e('0x49');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentansweredelsewhere',this['channels'][_0x54135e['uniqueid']][_0x31916f]);}}}}}}catch(_0x2da03c){logger['error'](_0x0a9e('0x4a'),_0x54135e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2da03c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x4b')]=function(_0x272738){try{if(this[_0x0a9e('0x1e')](_0x272738)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x272738[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x272738,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']]){logger[_0x0a9e('0x20')](_0x0a9e('0x4c'),_0x272738['uniqueid'],_0x272738[_0x0a9e('0x21')],_0x272738['destuniqueid']);this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738['destuniqueid']]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738[_0x0a9e('0x22')]][_0x0a9e('0x48')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']][_0x0a9e('0x3d')]='rejected';this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]['reason']=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4e'),_0x272738[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x4f'),this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]);}}}catch(_0x4d4a35){logger[_0x0a9e('0x50')](_0x0a9e('0x51'),_0x272738[_0x0a9e('0x26')],util['inspect'](_0x4d4a35,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncQueueCallerAbandon']=function(_0x5211e3){try{if(this[_0x0a9e('0x1e')](_0x5211e3)){logger[_0x0a9e('0x23')](_0x0a9e('0x52'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x5211e3,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){for(var _0x54a37d in this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x54a37d)&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x54'),_0x5211e3[_0x0a9e('0x26')],this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x21')],_0x54a37d);this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]=!![];this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x48')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x3d')]=_0x0a9e('0x55');this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x56')]=_0x0a9e('0x55');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x5211e3['uniqueid']][_0x54a37d],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentqueuecallerabandon',this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]);}}}}}catch(_0x4c46c1){logger[_0x0a9e('0x50')](_0x0a9e('0x57'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c46c1,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x13')]=function(_0x2e9552){try{if(this[_0x0a9e('0x1e')](_0x2e9552)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2e9552,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){for(var _0x4abc8f in this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x4abc8f)){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x37')]&&!this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x58'),_0x2e9552[_0x0a9e('0x26')],this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x21')],_0x4abc8f);this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x59')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]['lastevent']=_0x0a9e('0x5a');this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x56')]=_0x2e9552['reason']==_0x0a9e('0x5b')?_0x0a9e('0x5c'):_0x2e9552[_0x0a9e('0x56')];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5d')]=_0x2e9552[_0x0a9e('0x5d')];if(this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]&&this[_0x0a9e('0x9')][_0x2e9552[_0x0a9e('0x28')]][_0x0a9e('0x5e')]){this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5f')]=this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]['acwTimeout'];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x60')]=!![];}this[_0x0a9e('0xa')][_0x2e9552['interface']]=_['omit'](this[_0x0a9e('0xa')][_0x2e9552[_0x0a9e('0x40')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')](_0x0a9e('0x61'),_0x2e9552['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcomplete',this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);logger[_0x0a9e('0x23')](_0x0a9e('0x62'),_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f],{'showHidden':![],'depth':null}));this['emit'](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x2e9552[_0x0a9e('0x21')]),_0x0a9e('0x63'),this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);}}}}}}catch(_0x32f761){logger[_0x0a9e('0x50')]('[%s][voiceAgentReport][agentcomplete]',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x32f761,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x255e49){try{if(this[_0x0a9e('0x1e')](_0x255e49)){logger[_0x0a9e('0x23')](_0x0a9e('0x64'),_0x255e49['uniqueid'],util[_0x0a9e('0x25')](_0x255e49,{'showHidden':![],'depth':null}));this[_0x0a9e('0x65')](_0x255e49['uniqueid'],_[_0x0a9e('0x66')](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(this['channels'][_0x255e49[_0x0a9e('0x26')]]){for(var _0x52ec10 in this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x52ec10)){logger[_0x0a9e('0x20')](_0x0a9e('0x69'),_0x255e49[_0x0a9e('0x26')],_0x52ec10,_['keys'](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')])){this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]=this[_0x0a9e('0xb')][_0x255e49['uniqueid']];}}}}}catch(_0xc81b64){logger[_0x0a9e('0x50')](_0x0a9e('0x6a'),_0x255e49[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xc81b64,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x65')]=function(_0x1756c7,_0x5ce99d,_0x23b447){var _0x5e725e=[_0x0a9e('0x6b'),_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x6e'),'rtpaudioqosloss',_0x0a9e('0x6f'),'rtpaudioqosrtt',_0x0a9e('0x70'),_0x0a9e('0x71'),'sipuri',_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),'memberdynamic','memberinterface',_0x0a9e('0x75'),_0x0a9e('0x21'),_0x0a9e('0x76'),_0x0a9e('0x77')];if(!_[_0x0a9e('0x78')](_0x5ce99d)&&!_[_0x0a9e('0x79')](_0x5e725e,_0x5ce99d)){if(_[_0x0a9e('0x1f')](this[_0x0a9e('0xb')][_0x1756c7])){this[_0x0a9e('0xb')][_0x1756c7]={};}this['variables'][_0x1756c7][_0x5ce99d]=_0x23b447;}};VoiceAgentReport[_0x0a9e('0x1c')]['syncHangup']=function(_0x287324){try{if(this[_0x0a9e('0x1e')](_0x287324)){logger[_0x0a9e('0x23')](_0x0a9e('0x7a'),_0x287324[_0x0a9e('0x26')],util['inspect'](_0x287324,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){for(var _0x2791c5 in this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){if(this['channels'][_0x287324['uniqueid']][_0x0a9e('0x36')](_0x2791c5)){if(this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x56')]==_0x0a9e('0x5b')&&this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x287324[_0x0a9e('0x26')],_0x2791c5);this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5]['agentcompleteAt']=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger['debug'](_0x0a9e('0x7b'),_0x287324[_0x0a9e('0x26')],util['inspect'](_[_0x0a9e('0x7c')](this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x7d'),_['values'](this['channels'][_0x287324[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]];}if(this[_0x0a9e('0xb')][_0x287324[_0x0a9e('0x26')]]){delete this['variables'][_0x287324[_0x0a9e('0x26')]];}}}catch(_0xadce3d){logger['error'](_0x0a9e('0x7e'),_0x287324[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xadce3d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x7f')]=function(_0x23b39e){try{if(this[_0x0a9e('0x1e')](_0x23b39e)){logger[_0x0a9e('0x23')](_0x0a9e('0x80'),_0x23b39e[_0x0a9e('0x26')],util['inspect'](_0x23b39e,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){for(var _0x2ada60 in this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){if(this['channels'][_0x23b39e['transfereeuniqueid']][_0x0a9e('0x36')](_0x2ada60)){if(_0x23b39e[_0x0a9e('0x82')]===_0x2ada60){logger[_0x0a9e('0x20')](_0x0a9e('0x83'),_0x23b39e[_0x0a9e('0x26')],this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x21')],_0x2ada60);var _0x3450ae=moment();this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x23b39e['transfereeuniqueid']][_0x2ada60][_0x0a9e('0x59')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['lastevent']=_0x0a9e('0x5a');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x5d')]=_0x3450ae[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x37')],_0x0a9e('0x85'));}}}}if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x86')]]){var _0x248368=this['channels'][_0x23b39e['secondtransfereruniqueid']];this[_0x0a9e('0x8')][_0x23b39e['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]];this['channels'][_0x23b39e[_0x0a9e('0x81')]]=_0x248368;}}}catch(_0xe2b083){logger[_0x0a9e('0x50')](_0x0a9e('0x87'),_0x23b39e['uniqueid'],util[_0x0a9e('0x25')](_0xe2b083,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1b')]=function(_0x34a791){try{if(this['isNotNull'](_0x34a791)){logger[_0x0a9e('0x23')](_0x0a9e('0x88'),_0x34a791[_0x0a9e('0x26')],util['inspect'](_0x34a791,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]]){for(var _0x17b29d in this['channels'][_0x34a791[_0x0a9e('0x81')]]){if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x0a9e('0x36')](_0x17b29d)){if(_0x34a791[_0x0a9e('0x89')]===_0x17b29d){logger['info'](_0x0a9e('0x8a'),_0x34a791[_0x0a9e('0x26')],this['channels'][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x21')],_0x17b29d);var _0x1f6f1c=moment();this['channels'][_0x34a791['transfereeuniqueid']][_0x17b29d]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d]['agentcompleteAt']=_0x1f6f1c;this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x3d')]='complete';this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x5d')]=_0x1f6f1c[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x34a791['transfereeuniqueid']][_0x17b29d][_0x0a9e('0x37')],'seconds');}}}}}}catch(_0x138cf5){logger[_0x0a9e('0x50')](_0x0a9e('0x8b'),_0x34a791[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x138cf5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStart']=function(_0x1a0314){var _0x33da81='';try{if(this[_0x0a9e('0x1e')](_0x1a0314)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1a0314,{'showHidden':![],'depth':null}));if(_0x1a0314[_0x0a9e('0x8c')]){_0x33da81=_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0x33da81]){logger[_0x0a9e('0x20')](_0x0a9e('0x8f'),_0x1a0314['uniqueid'],_0x33da81);this[_0x0a9e('0xa')][_0x33da81][_0x0a9e('0x90')]=!![];}}}}catch(_0x2ff265){logger[_0x0a9e('0x50')](_0x0a9e('0x91'),_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2ff265,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStop']=function(_0x3b581c){var _0xd2391='';try{if(this[_0x0a9e('0x1e')](_0x3b581c)){logger['debug'](_0x0a9e('0x92'),_0x3b581c[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3b581c,{'showHidden':![],'depth':null}));if(_0x3b581c[_0x0a9e('0x8c')]){_0xd2391=_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0xd2391]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x3b581c[_0x0a9e('0x26')],_0xd2391);this[_0x0a9e('0xa')][_0xd2391][_0x0a9e('0x90')]=![];}}}}catch(_0x3db98f){logger[_0x0a9e('0x50')](_0x0a9e('0x93'),_0x3b581c['uniqueid'],util[_0x0a9e('0x25')](_0x3db98f,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index e65e888..b175dfd 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcbf1=['bluebird','lodash','moment','util','path','../../../config/environment','ami','../ami','../model/channel','../rpc/setting','unknown','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','localhost','socket.io-emitter','channels','agents','blindTransfers','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','info','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','merge','context','from-sip','split','exten','xcally-motion-preview','channel','connectedlinenum','format','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','linkedid','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','pick','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','user:%s','toLowerCase','applicationdata','appdata','startsWith','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','application','duration','seconds','keys','includes','lastdata','cdr(','match','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','connectedlinename','destinationchannel','membername','name','UserId','routealias','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','replace','.wav49','.WAV','isNil','rec','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','value','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','[%s][voiceCallReport][varset]','syncHangup','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','billableseconds','omit','transferType','isEmpty','monitors','getSettings','then','stopRecordingOnTransfer','resolve','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','origtransferercalleridnum','secondtransfereruniqueid','transfereeuniqueid','transfertargetuniqueid','transfercalleridnum','transferconnectedlinenum','origtransfereruniqueid','origtransfererlinkedid','some','outbound','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfererchannel','transfereruniqueid','BLIND','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]'];(function(_0xc98c07,_0x18ddb6){var _0x199a2a=function(_0xd35e9e){while(--_0xd35e9e){_0xc98c07['push'](_0xc98c07['shift']());}};_0x199a2a(++_0x18ddb6);}(_0xcbf1,0xc9));var _0x1cbf=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xcbf1[_0x2641f9];return _0x585741;};'use strict';var BPromise=require(_0x1cbf('0x0'));var _=require(_0x1cbf('0x1'));var moment=require(_0x1cbf('0x2'));var util=require(_0x1cbf('0x3'));var path=require(_0x1cbf('0x4'));var Redis=require('ioredis');var config=require(_0x1cbf('0x5'));var logger=require('../../../config/logger')(_0x1cbf('0x6'));var ami=require(_0x1cbf('0x7'));var Channel=require(_0x1cbf('0x8'));var RpcSetting=require(_0x1cbf('0x9'));var statusDesc=[_0x1cbf('0xa'),'not_inuse',_0x1cbf('0xb'),_0x1cbf('0xc'),_0x1cbf('0xd'),_0x1cbf('0xe'),_0x1cbf('0xf'),_0x1cbf('0x10'),_0x1cbf('0x11')];var applications=[_0x1cbf('0x12'),_0x1cbf('0x13'),_0x1cbf('0x14'),_0x1cbf('0x15'),_0x1cbf('0x16'),_0x1cbf('0x17')];var dispositions=[_0x1cbf('0x18'),'FAILED',_0x1cbf('0x19'),_0x1cbf('0x18'),_0x1cbf('0x18'),_0x1cbf('0x18'),_0x1cbf('0x1a'),_0x1cbf('0x1b'),_0x1cbf('0x19'),_0x1cbf('0x19'),'FAILED'];var actions={};config[_0x1cbf('0x1c')]=_['defaults'](config['redis'],{'host':_0x1cbf('0x1d'),'port':0x18eb});var io=require(_0x1cbf('0x1e'))(new Redis(config[_0x1cbf('0x1c')]));function VoiceCallReport(_0x3cc757){this[_0x1cbf('0x1f')]=_0x3cc757[_0x1cbf('0x1f')];this[_0x1cbf('0x20')]=_0x3cc757[_0x1cbf('0x20')];this[_0x1cbf('0x21')]={};ami['on']('coreshowchannel',this[_0x1cbf('0x22')][_0x1cbf('0x23')](this));ami['on'](_0x1cbf('0x24'),this[_0x1cbf('0x22')][_0x1cbf('0x23')](this));ami['on'](_0x1cbf('0x25'),this[_0x1cbf('0x26')]['bind'](this));ami['on'](_0x1cbf('0x27'),this[_0x1cbf('0x28')]['bind'](this));ami['on'](_0x1cbf('0x29'),this[_0x1cbf('0x2a')]['bind'](this));ami['on'](_0x1cbf('0x2b'),this['syncHangup'][_0x1cbf('0x23')](this));ami['on'](_0x1cbf('0x2c'),this[_0x1cbf('0x2d')]['bind'](this));ami['on'](_0x1cbf('0x2e'),this[_0x1cbf('0x2f')][_0x1cbf('0x23')](this));ami['on'](_0x1cbf('0x30'),this[_0x1cbf('0x31')]['bind'](this));ami['on']('musiconholdstart',this[_0x1cbf('0x32')][_0x1cbf('0x23')](this));ami['on'](_0x1cbf('0x33'),this[_0x1cbf('0x34')][_0x1cbf('0x23')](this));try{logger['info'](_0x1cbf('0x35'));ami['actionCoreShowChannels']();}catch(_0x56d6e2){logger[_0x1cbf('0x36')](_0x1cbf('0x37'),util[_0x1cbf('0x38')](_0x56d6e2,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x1cbf('0x39')][_0x1cbf('0x3a')]=function(_0x4fbf43){return _0x4fbf43!==null&&!_[_0x1cbf('0x3b')](_0x4fbf43);};VoiceCallReport[_0x1cbf('0x39')]['emit']=function(_0x2ef218,_0x45eec8,_0x1bfdeb){io['to'](_0x2ef218)[_0x1cbf('0x3c')](_0x45eec8,_0x1bfdeb);};VoiceCallReport[_0x1cbf('0x39')][_0x1cbf('0x2d')]=function(_0x4a9068){try{if(this[_0x1cbf('0x3a')](_0x4a9068)){logger[_0x1cbf('0x3d')](_0x1cbf('0x3e'),_0x4a9068[_0x1cbf('0x3f')],_0x4a9068[_0x1cbf('0x40')],_0x4a9068[_0x1cbf('0x41')]);logger[_0x1cbf('0x42')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x4a9068['uniqueid'],util['inspect'](_0x4a9068,{'showHidden':![],'depth':null}));if(_0x4a9068[_0x1cbf('0x3f')]===_0x4a9068['linkedid']){if(!_[_0x1cbf('0x3b')](this[_0x1cbf('0x1f')][_0x4a9068[_0x1cbf('0x3f')]])){_[_0x1cbf('0x43')](this[_0x1cbf('0x1f')][_0x4a9068[_0x1cbf('0x3f')]],_['pick'](_0x4a9068,_['keys'](this['channels'][_0x4a9068[_0x1cbf('0x3f')]])));}}if(_0x4a9068[_0x1cbf('0x44')]===_0x1cbf('0x45')){if(this[_0x1cbf('0x20')][_0x4a9068['channel'][_0x1cbf('0x46')]('-')[0x0]]){if(_0x4a9068[_0x1cbf('0x47')]==_0x1cbf('0x48')){this[_0x1cbf('0x20')][_0x4a9068[_0x1cbf('0x49')][_0x1cbf('0x46')]('-')[0x0]]['destconnectedlinenum']=_0x4a9068[_0x1cbf('0x4a')];this[_0x1cbf('0x3c')](util[_0x1cbf('0x4b')]('user:%s',this[_0x1cbf('0x20')][_0x4a9068[_0x1cbf('0x49')][_0x1cbf('0x46')]('-')[0x0]]['name']),_0x1cbf('0x4c'),{'destaccountcode':this[_0x1cbf('0x20')][_0x4a9068[_0x1cbf('0x49')][_0x1cbf('0x46')]('-')[0x0]][_0x1cbf('0x4d')],'destconnectedlinenum':_0x4a9068[_0x1cbf('0x4a')]});}}}}}catch(_0x3204de){logger[_0x1cbf('0x36')](_0x1cbf('0x4e'),_0x4a9068[_0x1cbf('0x3f')],util[_0x1cbf('0x38')](_0x3204de,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1cbf('0x39')]['syncNewChannel']=function(_0x25b2c6){try{if(this[_0x1cbf('0x3a')](_0x25b2c6)){logger[_0x1cbf('0x42')](_0x1cbf('0x4f'),_0x25b2c6[_0x1cbf('0x3f')],util[_0x1cbf('0x38')](_0x25b2c6,{'showHidden':![],'depth':null}));if(_0x25b2c6['uniqueid']===_0x25b2c6[_0x1cbf('0x50')]&&_0x25b2c6['channel']!=_0x1cbf('0x51')){if(_['isUndefined'](this['channels'][_0x25b2c6[_0x1cbf('0x3f')]])){logger[_0x1cbf('0x3d')](_0x1cbf('0x52'),_0x25b2c6['uniqueid'],_0x25b2c6['context'],_0x25b2c6[_0x1cbf('0x47')]);this[_0x1cbf('0x1f')][_0x25b2c6['uniqueid']]=new Channel();this[_0x1cbf('0x1f')][_0x25b2c6[_0x1cbf('0x3f')]][_0x1cbf('0x53')]=moment()[_0x1cbf('0x4b')](_0x1cbf('0x54'));this['channels'][_0x25b2c6[_0x1cbf('0x3f')]][_0x1cbf('0x55')]=dispositions[_[_0x1cbf('0x56')](_0x25b2c6[_0x1cbf('0x57')])];_[_0x1cbf('0x43')](this[_0x1cbf('0x1f')][_0x25b2c6['uniqueid']],_[_0x1cbf('0x58')](_0x25b2c6,_['keys'](this[_0x1cbf('0x1f')][_0x25b2c6[_0x1cbf('0x3f')]])));if(_0x25b2c6[_0x1cbf('0x44')]==='from-sip'){if(this[_0x1cbf('0x20')][_0x25b2c6[_0x1cbf('0x49')][_0x1cbf('0x46')]('-')[0x0]]){if(_[_0x1cbf('0x3b')](this[_0x1cbf('0x20')][_0x25b2c6['channel'][_0x1cbf('0x46')]('-')[0x0]]['destconnectedlinenum'])){this['agents'][_0x25b2c6[_0x1cbf('0x49')][_0x1cbf('0x46')]('-')[0x0]]['destconnectedlinenum']=_0x25b2c6['exten'];logger[_0x1cbf('0x42')](_0x1cbf('0x59'),_0x25b2c6[_0x1cbf('0x3f')],util[_0x1cbf('0x38')]({'destaccountcode':this[_0x1cbf('0x20')][_0x25b2c6[_0x1cbf('0x49')][_0x1cbf('0x46')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x25b2c6[_0x1cbf('0x47')]},{'showHidden':![],'depth':null}));this[_0x1cbf('0x3c')](util[_0x1cbf('0x4b')](_0x1cbf('0x5a'),this[_0x1cbf('0x20')][_0x25b2c6[_0x1cbf('0x49')][_0x1cbf('0x46')]('-')[0x0]]['name']),_0x1cbf('0x4c'),{'destaccountcode':this['agents'][_0x25b2c6[_0x1cbf('0x49')][_0x1cbf('0x46')]('-')[0x0]][_0x1cbf('0x4d')],'destconnectedlinenum':_0x25b2c6['exten']});}}}}}}}catch(_0x1269a6){logger[_0x1cbf('0x36')]('[%s][voiceCallReport][newchannel]',_0x25b2c6['uniqueid'],util[_0x1cbf('0x38')](_0x1269a6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1cbf('0x39')][_0x1cbf('0x22')]=function(_0x303c4e){try{if(this['isNotNull'](_0x303c4e)){logger['debug']('[%s][voiceCallReport][newexten]\x20event:',_0x303c4e[_0x1cbf('0x3f')],util[_0x1cbf('0x38')](_0x303c4e,{'showHidden':![],'depth':null}));if(_0x303c4e[_0x1cbf('0x3f')]===_0x303c4e[_0x1cbf('0x50')]&&_0x303c4e['exten']!='h'&&_0x303c4e[_0x1cbf('0x49')]!=_0x1cbf('0x51')){_0x303c4e['application']=_0x303c4e['application'][_0x1cbf('0x5b')]();_0x303c4e[_0x1cbf('0x5c')]=_0x303c4e[_0x1cbf('0x5d')]&&_0x303c4e[_0x1cbf('0x5d')][_0x1cbf('0x5e')](_0x1cbf('0x5f'))?_0x303c4e[_0x1cbf('0x5d')]:(_0x303c4e[_0x1cbf('0x5d')]||_0x303c4e['applicationdata'])['toLowerCase']();logger[_0x1cbf('0x3d')](_0x1cbf('0x60'),_0x303c4e[_0x1cbf('0x3f')],_0x303c4e[_0x1cbf('0x61')],_0x303c4e[_0x1cbf('0x5c')]);if(_[_0x1cbf('0x3b')](this[_0x1cbf('0x1f')][_0x303c4e[_0x1cbf('0x3f')]])){this['channels'][_0x303c4e[_0x1cbf('0x3f')]]=new Channel();this['channels'][_0x303c4e[_0x1cbf('0x3f')]][_0x1cbf('0x53')]=_0x303c4e[_0x1cbf('0x62')]?moment()['subtract'](moment['duration'](_0x303c4e[_0x1cbf('0x62')])[_0x1cbf('0x63')](),'seconds')[_0x1cbf('0x4b')](_0x1cbf('0x54')):moment()[_0x1cbf('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x303c4e[_0x1cbf('0x3f')]][_0x1cbf('0x55')]=_0x1cbf('0x18');}_[_0x1cbf('0x43')](this[_0x1cbf('0x1f')][_0x303c4e['uniqueid']],_[_0x1cbf('0x58')](_0x303c4e,_[_0x1cbf('0x64')](this['channels'][_0x303c4e[_0x1cbf('0x3f')]])));if(_[_0x1cbf('0x65')](applications,_0x303c4e[_0x1cbf('0x61')])){this['channels'][_0x303c4e[_0x1cbf('0x3f')]]['lastapplication']=_0x303c4e[_0x1cbf('0x61')];this[_0x1cbf('0x1f')][_0x303c4e[_0x1cbf('0x3f')]][_0x1cbf('0x66')]=_0x303c4e['applicationdata'];if(_0x303c4e[_0x1cbf('0x61')]==='set'&&_['startsWith'](_0x303c4e[_0x1cbf('0x5c')][_0x1cbf('0x5b')](),_0x1cbf('0x67'))){var _0x3433fd=_0x303c4e['applicationdata']['split']('=');var _0x1aa5df=_0x3433fd[0x0]['toLowerCase']()[_0x1cbf('0x68')](/cdr\((.*)\)/);if(_0x1aa5df){this['channels'][_0x303c4e[_0x1cbf('0x3f')]][_0x1aa5df[0x1]]=_0x3433fd[0x1];}}else if(_0x303c4e[_0x1cbf('0x61')]===_0x1cbf('0x13')){this[_0x1cbf('0x1f')][_0x303c4e[_0x1cbf('0x3f')]][_0x1cbf('0x13')]=_0x303c4e[_0x1cbf('0x5c')][_0x1cbf('0x46')](',')[0x0];}}}}}catch(_0x36441a){logger[_0x1cbf('0x36')]('[%s][voiceCallReport][newexten]',_0x303c4e[_0x1cbf('0x3f')],util[_0x1cbf('0x38')](_0x36441a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1cbf('0x39')][_0x1cbf('0x28')]=function(_0x5336be){try{if(this[_0x1cbf('0x3a')](_0x5336be)){logger['info']('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x5336be['uniqueid'],_0x5336be['linkedid'],_0x5336be[_0x1cbf('0x40')],_0x5336be[_0x1cbf('0x41')]);logger['debug'](_0x1cbf('0x69'),_0x5336be[_0x1cbf('0x3f')],util['inspect'](_0x5336be,{'showHidden':![],'depth':null}));if(_0x5336be['uniqueid']!==_0x5336be[_0x1cbf('0x50')]){if(this['channels'][_0x5336be[_0x1cbf('0x50')]]){if(_0x5336be[_0x1cbf('0x57')]==='6'){if(!this[_0x1cbf('0x1f')][_0x5336be['linkedid']][_0x1cbf('0x6a')]){var _0x49a75a=moment();this[_0x1cbf('0x1f')][_0x5336be[_0x1cbf('0x50')]][_0x1cbf('0x6a')]=!![];this[_0x1cbf('0x1f')][_0x5336be['linkedid']][_0x1cbf('0x6b')]=_0x49a75a[_0x1cbf('0x4b')](_0x1cbf('0x54'));if(this['channels'][_0x5336be[_0x1cbf('0x50')]]['starttime']){this[_0x1cbf('0x1f')][_0x5336be[_0x1cbf('0x50')]][_0x1cbf('0x6c')]=_0x49a75a[_0x1cbf('0x6d')](this[_0x1cbf('0x1f')][_0x5336be[_0x1cbf('0x50')]][_0x1cbf('0x53')],'seconds');}}this[_0x1cbf('0x1f')][_0x5336be[_0x1cbf('0x50')]]['linkedid']=_0x5336be[_0x1cbf('0x3f')];if(_0x5336be[_0x1cbf('0x41')]!==_0x1cbf('0x48')){this[_0x1cbf('0x1f')][_0x5336be[_0x1cbf('0x50')]][_0x1cbf('0x4a')]=_0x5336be['calleridnum'];}this['channels'][_0x5336be[_0x1cbf('0x50')]][_0x1cbf('0x6e')]=_0x5336be[_0x1cbf('0x40')];this['channels'][_0x5336be[_0x1cbf('0x50')]][_0x1cbf('0x6f')]=_0x5336be[_0x1cbf('0x49')];this['channels'][_0x5336be['linkedid']][_0x1cbf('0x55')]=dispositions[_[_0x1cbf('0x56')](_0x5336be[_0x1cbf('0x57')])];if(this[_0x1cbf('0x20')][_0x5336be['channel'][_0x1cbf('0x46')]('-')[0x0]]){this[_0x1cbf('0x1f')][_0x5336be[_0x1cbf('0x50')]]['UserId']=this[_0x1cbf('0x20')][_0x5336be[_0x1cbf('0x49')][_0x1cbf('0x46')]('-')[0x0]]['id'];this[_0x1cbf('0x1f')][_0x5336be[_0x1cbf('0x50')]][_0x1cbf('0x70')]=this['agents'][_0x5336be['channel'][_0x1cbf('0x46')]('-')[0x0]][_0x1cbf('0x71')];}}}}else{if(this['channels'][_0x5336be[_0x1cbf('0x3f')]]){if(_0x5336be[_0x1cbf('0x57')]==='6'){if(this[_0x1cbf('0x20')][_0x5336be['channel'][_0x1cbf('0x46')]('-')[0x0]]){this[_0x1cbf('0x1f')][_0x5336be[_0x1cbf('0x3f')]][_0x1cbf('0x72')]=this[_0x1cbf('0x20')][_0x5336be[_0x1cbf('0x49')]['split']('-')[0x0]]['id'];this['channels'][_0x5336be[_0x1cbf('0x3f')]][_0x1cbf('0x70')]=this['agents'][_0x5336be[_0x1cbf('0x49')]['split']('-')[0x0]][_0x1cbf('0x71')];}}}}if(_0x5336be['channelstate']==='6'&&_0x5336be[_0x1cbf('0x44')]===_0x1cbf('0x45')){if(this['agents'][_0x5336be[_0x1cbf('0x49')][_0x1cbf('0x46')]('-')[0x0]]){this[_0x1cbf('0x20')][_0x5336be[_0x1cbf('0x49')]['split']('-')[0x0]]['destconnectedlinenum']=_0x5336be[_0x1cbf('0x47')];var _0x4ce287;if(this['channels'][_0x5336be[_0x1cbf('0x3f')]])_0x4ce287=this[_0x1cbf('0x1f')][_0x5336be[_0x1cbf('0x3f')]][_0x1cbf('0x73')];else if(this[_0x1cbf('0x1f')][_0x5336be[_0x1cbf('0x50')]])_0x4ce287=this[_0x1cbf('0x1f')][_0x5336be['linkedid']]['routealias'];logger[_0x1cbf('0x42')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x5336be['uniqueid'],util[_0x1cbf('0x38')]({'destaccountcode':this[_0x1cbf('0x20')][_0x5336be[_0x1cbf('0x49')][_0x1cbf('0x46')]('-')[0x0]][_0x1cbf('0x4d')],'destconnectedlinenum':_0x5336be[_0x1cbf('0x47')],'routealias':_0x4ce287},{'showHidden':![],'depth':null}));this[_0x1cbf('0x3c')](util[_0x1cbf('0x4b')](_0x1cbf('0x5a'),this[_0x1cbf('0x20')][_0x5336be[_0x1cbf('0x49')]['split']('-')[0x0]]['name']),_0x1cbf('0x4c'),{'destaccountcode':this[_0x1cbf('0x20')][_0x5336be[_0x1cbf('0x49')][_0x1cbf('0x46')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x5336be[_0x1cbf('0x47')],'routealias':_0x4ce287});}}}}catch(_0x5c89ce){logger[_0x1cbf('0x36')](_0x1cbf('0x74'),_0x5336be['uniqueid'],util[_0x1cbf('0x38')](_0x5c89ce,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x1cbf('0x75')]=function(_0x4f5f8d,_0x453ef4){try{if(this['channels'][_0x4f5f8d]){logger[_0x1cbf('0x3d')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x4f5f8d,_0x453ef4);this[_0x1cbf('0x1f')][_0x4f5f8d]['monitor']=!![];if(_['endsWith'](_0x453ef4,'.wav49')){_0x453ef4=_0x453ef4[_0x1cbf('0x76')](_0x1cbf('0x77'),_0x1cbf('0x78'));}this[_0x1cbf('0x1f')][_0x4f5f8d]['monitorFilename']=_0x453ef4;var _0x5b0d52=_['find'](this['channels'][_0x4f5f8d]['monitors'],{'filename':_0x453ef4});if(_[_0x1cbf('0x79')](_0x5b0d52)){this[_0x1cbf('0x1f')][_0x4f5f8d]['monitors']['push']({'filename':_0x453ef4,'createdAt':moment()[_0x1cbf('0x4b')](_0x1cbf('0x54')),'mixmonitorid':'','status':_0x1cbf('0x7a')});}}}catch(_0x167c73){logger[_0x1cbf('0x36')]('[%s][voiceCallReport][mixMonitorFilename]',_0x4f5f8d,util[_0x1cbf('0x38')](_0x167c73,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1cbf('0x39')][_0x1cbf('0x2a')]=function(_0x2ce609){try{if(this[_0x1cbf('0x3a')](_0x2ce609)){logger[_0x1cbf('0x42')](_0x1cbf('0x7b'),_0x2ce609[_0x1cbf('0x3f')],util[_0x1cbf('0x38')](_0x2ce609,{'showHidden':![],'depth':null}));if(this[_0x1cbf('0x1f')][_0x2ce609['uniqueid']]&&_0x2ce609[_0x1cbf('0x49')]!=_0x1cbf('0x51')){if(this[_0x1cbf('0x3a')](_0x2ce609[_0x1cbf('0x7c')])){if(this[_0x1cbf('0x3a')](_0x2ce609['variable'][_0x1cbf('0x7d')])){logger[_0x1cbf('0x3d')](_0x1cbf('0x7e'),_0x2ce609[_0x1cbf('0x3f')],_0x2ce609['value']);this[_0x1cbf('0x75')](_0x2ce609[_0x1cbf('0x3f')],_0x2ce609['value']);}else if(this[_0x1cbf('0x3a')](_0x2ce609[_0x1cbf('0x7c')][_0x1cbf('0x7f')])){logger[_0x1cbf('0x3d')](_0x1cbf('0x80'),_0x2ce609[_0x1cbf('0x3f')],_0x2ce609['value']);this[_0x1cbf('0x1f')][_0x2ce609[_0x1cbf('0x3f')]][_0x1cbf('0x41')]=_0x2ce609['value'];}else if(this['isNotNull'](_0x2ce609[_0x1cbf('0x7c')][_0x1cbf('0x81')])){logger[_0x1cbf('0x3d')](_0x1cbf('0x82'),_0x2ce609[_0x1cbf('0x3f')],_0x2ce609[_0x1cbf('0x83')]);this[_0x1cbf('0x1f')][_0x2ce609[_0x1cbf('0x3f')]]['callerid']=_0x2ce609[_0x1cbf('0x83')];}else if(this[_0x1cbf('0x3a')](_0x2ce609['variable']['xmd-cdrtype'])){logger[_0x1cbf('0x3d')](_0x1cbf('0x84'),_0x2ce609[_0x1cbf('0x3f')],_0x2ce609[_0x1cbf('0x83')]);this[_0x1cbf('0x1f')][_0x2ce609[_0x1cbf('0x3f')]][_0x1cbf('0x85')]=_0x2ce609[_0x1cbf('0x83')];}else if(this['isNotNull'](_0x2ce609[_0x1cbf('0x7c')][_0x1cbf('0x86')])){logger[_0x1cbf('0x3d')](_0x1cbf('0x87'),_0x2ce609['uniqueid'],_0x2ce609['value'][_0x1cbf('0x46')](',')[0x0]);this[_0x1cbf('0x1f')][_0x2ce609[_0x1cbf('0x3f')]][_0x1cbf('0x13')]=_0x2ce609[_0x1cbf('0x83')]['split'](',')[0x0];}else if(this[_0x1cbf('0x3a')](_0x2ce609[_0x1cbf('0x7c')][_0x1cbf('0x88')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x2ce609['uniqueid'],_0x2ce609[_0x1cbf('0x83')]);this[_0x1cbf('0x1f')][_0x2ce609[_0x1cbf('0x3f')]][_0x1cbf('0x89')]=_0x2ce609[_0x1cbf('0x83')];}else if(this[_0x1cbf('0x3a')](_0x2ce609[_0x1cbf('0x7c')][_0x1cbf('0x8a')])){logger[_0x1cbf('0x3d')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x2ce609[_0x1cbf('0x3f')],_0x2ce609[_0x1cbf('0x83')]);this['channels'][_0x2ce609['uniqueid']][_0x1cbf('0x8b')]=_0x2ce609[_0x1cbf('0x83')];}else if(this[_0x1cbf('0x3a')](_0x2ce609['variable']['xmd-callerid-preview'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x2ce609['uniqueid'],_0x2ce609[_0x1cbf('0x83')]);this[_0x1cbf('0x1f')][_0x2ce609[_0x1cbf('0x3f')]]['calleridpreview']=_0x2ce609['value'];}else if(this['isNotNull'](_0x2ce609[_0x1cbf('0x7c')][_0x1cbf('0x8c')])){logger[_0x1cbf('0x3d')](_0x1cbf('0x8d'),_0x2ce609[_0x1cbf('0x3f')],_0x2ce609['value']);this['channels'][_0x2ce609['uniqueid']][_0x1cbf('0x13')]=_0x2ce609['value'];}else if(this[_0x1cbf('0x3a')](_0x2ce609['variable'][_0x1cbf('0x8e')])){logger[_0x1cbf('0x3d')](_0x1cbf('0x8f'),_0x2ce609[_0x1cbf('0x3f')],_0x2ce609['value']);this[_0x1cbf('0x1f')][_0x2ce609[_0x1cbf('0x3f')]][_0x1cbf('0x90')]=_0x2ce609[_0x1cbf('0x83')];}}}else if(this[_0x1cbf('0x3a')](_0x2ce609[_0x1cbf('0x7c')]['mixmonitor_filename'])){if(_0x2ce609['value']){var _0x1f5388=path[_0x1cbf('0x91')](_0x2ce609[_0x1cbf('0x83')])[_0x1cbf('0x71')];logger[_0x1cbf('0x3d')](_0x1cbf('0x7e'),_0x1f5388,_0x2ce609['value']);this['syncMixMonitorFilename'](_0x1f5388,_0x2ce609[_0x1cbf('0x83')]);}}else if(this[_0x1cbf('0x1f')][_0x2ce609[_0x1cbf('0x50')]]){if(this['isNotNull'](_0x2ce609[_0x1cbf('0x7c')])){if(this[_0x1cbf('0x3a')](_0x2ce609[_0x1cbf('0x7c')][_0x1cbf('0x8e')])){logger[_0x1cbf('0x3d')](_0x1cbf('0x8f'),_0x2ce609[_0x1cbf('0x50')],_0x2ce609[_0x1cbf('0x83')]);this['channels'][_0x2ce609[_0x1cbf('0x50')]]['sipcalllinkedid']=_0x2ce609[_0x1cbf('0x83')];}}}}}catch(_0xa0f92c){logger[_0x1cbf('0x36')](_0x1cbf('0x92'),_0x2ce609['uniqueid'],util[_0x1cbf('0x38')](_0xa0f92c,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x1cbf('0x93')]=function(_0x12f52b){try{if(this[_0x1cbf('0x3a')](_0x12f52b)){logger[_0x1cbf('0x42')](_0x1cbf('0x94'),_0x12f52b['uniqueid'],util[_0x1cbf('0x38')](_0x12f52b,{'showHidden':![],'depth':null}));if(this['channels'][_0x12f52b[_0x1cbf('0x3f')]]){logger[_0x1cbf('0x3d')](_0x1cbf('0x95'),_0x12f52b['uniqueid'],_0x12f52b[_0x1cbf('0x96')]);var _0xa32d95=moment();this[_0x1cbf('0x1f')][_0x12f52b[_0x1cbf('0x3f')]]['endtime']=_0xa32d95[_0x1cbf('0x4b')](_0x1cbf('0x54'));this[_0x1cbf('0x1f')][_0x12f52b['uniqueid']][_0x1cbf('0x62')]=_0xa32d95[_0x1cbf('0x6d')](this[_0x1cbf('0x1f')][_0x12f52b['uniqueid']]['starttime'],'seconds');if(this[_0x1cbf('0x1f')][_0x12f52b[_0x1cbf('0x3f')]][_0x1cbf('0x6a')]){this[_0x1cbf('0x1f')][_0x12f52b[_0x1cbf('0x3f')]]['billableseconds']=_0xa32d95[_0x1cbf('0x6d')](this['channels'][_0x12f52b[_0x1cbf('0x3f')]]['answertime'],_0x1cbf('0x63'));this[_0x1cbf('0x1f')][_0x12f52b[_0x1cbf('0x3f')]]['holdtime']=this[_0x1cbf('0x1f')][_0x12f52b[_0x1cbf('0x3f')]][_0x1cbf('0x62')]-this[_0x1cbf('0x1f')][_0x12f52b[_0x1cbf('0x3f')]][_0x1cbf('0x97')];}if(_0x12f52b['context']===_0x1cbf('0x45')){if(this['agents'][_0x12f52b[_0x1cbf('0x49')][_0x1cbf('0x46')]('-')[0x0]]){this[_0x1cbf('0x20')][_0x12f52b[_0x1cbf('0x49')][_0x1cbf('0x46')]('-')[0x0]]=_[_0x1cbf('0x98')](this[_0x1cbf('0x20')][_0x12f52b[_0x1cbf('0x49')][_0x1cbf('0x46')]('-')[0x0]],['destconnectedlinenum']);logger[_0x1cbf('0x42')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x12f52b['uniqueid'],util[_0x1cbf('0x38')]({'id':this[_0x1cbf('0x20')][_0x12f52b[_0x1cbf('0x49')]['split']('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x12f52b['channel'][_0x1cbf('0x46')]('-')[0x0]][_0x1cbf('0x4d')]},{'showHidden':![],'depth':null}));this[_0x1cbf('0x3c')](util['format'](_0x1cbf('0x5a'),this[_0x1cbf('0x20')][_0x12f52b['channel'][_0x1cbf('0x46')]('-')[0x0]]['name']),'user:agentcomplete',{'id':this[_0x1cbf('0x20')][_0x12f52b[_0x1cbf('0x49')][_0x1cbf('0x46')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x12f52b['channel'][_0x1cbf('0x46')]('-')[0x0]][_0x1cbf('0x4d')]});}}var _0x5e4bd1=this;Promise['resolve']()['then'](function(){var _0x2e3fa6=_0x5e4bd1['channels'][_0x12f52b[_0x1cbf('0x3f')]];if(typeof _0x2e3fa6[_0x1cbf('0x99')]==='undefined')return;if(_[_0x1cbf('0x9a')](_0x2e3fa6[_0x1cbf('0x9b')]))return;return RpcSetting[_0x1cbf('0x9c')]()[_0x1cbf('0x9d')](function(_0x562e5d){if(!_0x562e5d[_0x1cbf('0x9e')])return;return Promise[_0x1cbf('0x9f')]()[_0x1cbf('0x9d')](function(){return ami[_0x1cbf('0xa0')]({'action':_0x1cbf('0xa1'),'channel':_0x2e3fa6[_0x1cbf('0x49')]})[_0x1cbf('0xa2')](function(){});})[_0x1cbf('0x9d')](function(){return ami[_0x1cbf('0xa0')]({'action':_0x1cbf('0xa1'),'channel':_0x2e3fa6['destinationchannel']})['catch'](function(){})[_0x1cbf('0xa3')](function(){var _0x1333b8=_0x5e4bd1[_0x1cbf('0x20')][_0x2e3fa6[_0x1cbf('0x6f')][_0x1cbf('0x46')]('-')[0x0]];if(!_0x1333b8)return;io['emit'](_0x1cbf('0xa4'),{'agentId':_0x1333b8['id'],'uniqueid':_0x2e3fa6[_0x1cbf('0x3f')]});});});});})[_0x1cbf('0x9d')](function(){if(_0x12f52b[_0x1cbf('0xa5')]===_0x1cbf('0xa6')){_0x5e4bd1[_0x1cbf('0x21')][_0x12f52b['uniqueid']]=_0x5e4bd1[_0x1cbf('0x1f')][_0x12f52b['uniqueid']];}else{if(_0x5e4bd1[_0x1cbf('0x1f')][_0x12f52b[_0x1cbf('0x3f')]][_0x1cbf('0x85')]==='outbound'&&_0x5e4bd1[_0x1cbf('0x21')][_0x12f52b['uniqueid']]){_0x5e4bd1[_0x1cbf('0x1f')][_0x12f52b[_0x1cbf('0x3f')]][_0x1cbf('0x3f')]=[_0x5e4bd1[_0x1cbf('0x1f')][_0x12f52b[_0x1cbf('0x3f')]][_0x1cbf('0x50')],_0x5e4bd1['channels'][_0x12f52b[_0x1cbf('0x3f')]][_0x1cbf('0x50')]=_0x5e4bd1['channels'][_0x12f52b[_0x1cbf('0x3f')]][_0x1cbf('0x3f')]][0x0];delete _0x5e4bd1[_0x1cbf('0x21')][_0x12f52b[_0x1cbf('0x3f')]];}}logger[_0x1cbf('0x42')](_0x1cbf('0xa7'),_0x12f52b[_0x1cbf('0x3f')],util['inspect'](_0x5e4bd1['channels'][_0x12f52b[_0x1cbf('0x3f')]],{'showHidden':![],'depth':null}));ami['emit'](_0x1cbf('0xa8'),_0x5e4bd1[_0x1cbf('0x1f')][_0x12f52b[_0x1cbf('0x3f')]]);delete _0x5e4bd1['channels'][_0x12f52b['uniqueid']];});}}}catch(_0x9dc211){logger[_0x1cbf('0x36')](_0x1cbf('0xa9'),_0x12f52b[_0x1cbf('0x3f')],util['inspect'](_0x9dc211,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1cbf('0x39')]['syncAttendedTransfer']=function(_0x5bbd00){try{if(this[_0x1cbf('0x3a')](_0x5bbd00)){logger[_0x1cbf('0x3d')](_0x1cbf('0xaa'),_0x5bbd00[_0x1cbf('0x3f')],_0x5bbd00['origtransferercalleridnum'],_0x5bbd00[_0x1cbf('0xab')]);logger[_0x1cbf('0x42')]('[%s][voiceCallReport][attendedtransfer]\x20event:',_0x5bbd00[_0x1cbf('0x3f')],util[_0x1cbf('0x38')](_0x5bbd00,{'showHidden':![],'depth':null}));if(this['channels'][_0x5bbd00['transfereeuniqueid']]){this[_0x1cbf('0x1f')][_0x5bbd00['transfereeuniqueid']]['transfercalleridnum']=_0x5bbd00[_0x1cbf('0xac')];this[_0x1cbf('0x1f')][_0x5bbd00['transfereeuniqueid']]['transferconnectedlinenum']=_0x5bbd00[_0x1cbf('0xab')];if(this['channels'][_0x5bbd00['secondtransfereruniqueid']]){var _0x27f6f5=this[_0x1cbf('0x1f')][_0x5bbd00[_0x1cbf('0xad')]];this[_0x1cbf('0x1f')][_0x5bbd00[_0x1cbf('0xad')]]=this[_0x1cbf('0x1f')][_0x5bbd00[_0x1cbf('0xae')]];this['channels'][_0x5bbd00[_0x1cbf('0xae')]]=_0x27f6f5;}}else if(this['channels'][_0x5bbd00[_0x1cbf('0xaf')]]){this[_0x1cbf('0x1f')][_0x5bbd00[_0x1cbf('0xaf')]][_0x1cbf('0xb0')]=_0x5bbd00[_0x1cbf('0xac')];this['channels'][_0x5bbd00[_0x1cbf('0xaf')]][_0x1cbf('0xb1')]=_0x5bbd00[_0x1cbf('0xab')];if(this[_0x1cbf('0x1f')][_0x5bbd00[_0x1cbf('0xb2')]]){var _0x27f6f5=this[_0x1cbf('0x1f')][_0x5bbd00[_0x1cbf('0xb2')]];this[_0x1cbf('0x1f')][_0x5bbd00[_0x1cbf('0xb2')]]=this['channels'][_0x5bbd00[_0x1cbf('0xaf')]];this[_0x1cbf('0x1f')][_0x5bbd00['transfertargetuniqueid']]=_0x27f6f5;}}if((this[_0x1cbf('0x1f')][_0x5bbd00['origtransfereruniqueid']]||this[_0x1cbf('0x1f')][_0x5bbd00[_0x1cbf('0xb3')]])&&this['channels'][_0x5bbd00['secondtransfereruniqueid']]){var _0x265764=_[_0x1cbf('0xb4')]([this['channels'][_0x5bbd00['origtransfereruniqueid']],this[_0x1cbf('0x1f')][_0x5bbd00[_0x1cbf('0xb3')]],this['channels'][_0x5bbd00[_0x1cbf('0xad')]]],function(_0x2bcc36){return _0x2bcc36&&_0x2bcc36[_0x1cbf('0x85')]===_0x1cbf('0xb5')&&_0x2bcc36[_0x1cbf('0xb6')];});if(_0x265764){if(this[_0x1cbf('0x1f')][_0x5bbd00[_0x1cbf('0xb2')]])this[_0x1cbf('0x1f')][_0x5bbd00[_0x1cbf('0xb2')]][_0x1cbf('0x99')]=_0x1cbf('0xb7');if(this[_0x1cbf('0x1f')][_0x5bbd00['origtransfererlinkedid']])this[_0x1cbf('0x1f')][_0x5bbd00[_0x1cbf('0xb3')]]['transferType']='ATTENDED';this[_0x1cbf('0x1f')][_0x5bbd00[_0x1cbf('0xad')]][_0x1cbf('0x99')]=_0x1cbf('0xb7');}}}}catch(_0x2a0f7a){logger[_0x1cbf('0x36')](_0x1cbf('0xb8'),_0x5bbd00[_0x1cbf('0x3f')],util[_0x1cbf('0x38')](_0x2a0f7a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1cbf('0x39')][_0x1cbf('0x31')]=function(_0x4afb3a){try{if(this[_0x1cbf('0x3a')](_0x4afb3a)){logger[_0x1cbf('0x3d')](_0x1cbf('0xb9'),_0x4afb3a[_0x1cbf('0x3f')],_0x4afb3a[_0x1cbf('0xba')],_0x4afb3a[_0x1cbf('0xbb')]);logger[_0x1cbf('0x42')](_0x1cbf('0xbc'),_0x4afb3a['uniqueid'],util[_0x1cbf('0x38')](_0x4afb3a,{'showHidden':![],'depth':null}));if(this[_0x1cbf('0x1f')][_0x4afb3a[_0x1cbf('0xae')]]){this[_0x1cbf('0x1f')][_0x4afb3a[_0x1cbf('0xae')]][_0x1cbf('0xb0')]=_0x4afb3a[_0x1cbf('0xba')];this[_0x1cbf('0x1f')][_0x4afb3a[_0x1cbf('0xae')]][_0x1cbf('0xb1')]=_0x4afb3a[_0x1cbf('0xbb')];this['channels'][_0x4afb3a[_0x1cbf('0xae')]][_0x1cbf('0x99')]='BLIND';this[_0x1cbf('0x93')]({'event':_0x1cbf('0xa6'),'uniqueid':_0x4afb3a[_0x1cbf('0xae')],'context':_0x4afb3a[_0x1cbf('0x44')],'channel':_0x4afb3a[_0x1cbf('0xbd')]});}else{this[_0x1cbf('0x1f')][_0x4afb3a[_0x1cbf('0xbe')]][_0x1cbf('0x99')]=_0x1cbf('0xbf');}}}catch(_0x2ca686){logger['error'](_0x1cbf('0xc0'),_0x4afb3a[_0x1cbf('0x3f')],util['inspect'](_0x2ca686,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1cbf('0x39')][_0x1cbf('0x32')]=function(_0x32ff9d){try{if(this['isNotNull'](_0x32ff9d)){logger['debug'](_0x1cbf('0xc1'),_0x32ff9d[_0x1cbf('0x3f')],util['inspect'](_0x32ff9d,{'showHidden':![],'depth':null}));if(this['channels'][_0x32ff9d[_0x1cbf('0x3f')]]){if(!_['isNil'](this[_0x1cbf('0x1f')][_0x32ff9d[_0x1cbf('0x3f')]][_0x1cbf('0x6b')])){this['channels'][_0x32ff9d[_0x1cbf('0x3f')]][_0x1cbf('0xc2')]=moment()[_0x1cbf('0x4b')](_0x1cbf('0x54'));logger[_0x1cbf('0x3d')](_0x1cbf('0xc3'),_0x32ff9d[_0x1cbf('0x3f')],this[_0x1cbf('0x1f')][_0x32ff9d[_0x1cbf('0x3f')]][_0x1cbf('0xc2')]);}}}}catch(_0x8774a0){logger[_0x1cbf('0x36')](_0x1cbf('0xc4'),_0x32ff9d[_0x1cbf('0x3f')],util[_0x1cbf('0x38')](_0x8774a0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1cbf('0x39')][_0x1cbf('0x34')]=function(_0x332a3d){try{if(this[_0x1cbf('0x3a')](_0x332a3d)){logger[_0x1cbf('0x42')]('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x332a3d['uniqueid'],util[_0x1cbf('0x38')](_0x332a3d,{'showHidden':![],'depth':null}));if(this[_0x1cbf('0x1f')][_0x332a3d['uniqueid']]){if(!_['isNil'](this[_0x1cbf('0x1f')][_0x332a3d[_0x1cbf('0x3f')]][_0x1cbf('0xc2')])){this[_0x1cbf('0x1f')][_0x332a3d['uniqueid']][_0x1cbf('0xc5')]+=moment()[_0x1cbf('0xc6')](0x0)[_0x1cbf('0x6d')](this[_0x1cbf('0x1f')][_0x332a3d[_0x1cbf('0x3f')]][_0x1cbf('0xc2')],_0x1cbf('0x63'));logger[_0x1cbf('0x3d')](_0x1cbf('0xc7'),_0x332a3d[_0x1cbf('0x3f')],this['channels'][_0x332a3d[_0x1cbf('0x3f')]][_0x1cbf('0xc5')]);delete this['channels'][_0x332a3d[_0x1cbf('0x3f')]][_0x1cbf('0xc2')];}}}}catch(_0x4adff4){logger[_0x1cbf('0x36')](_0x1cbf('0xc8'),_0x332a3d['uniqueid'],util['inspect'](_0x4adff4,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file +var _0x5781=['exten','starttime','format','toNumber','user:%s','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','startsWith','CDR(routeAlias)','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','disposition','includes','lastdata','cdr(','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','linkedid','[%s][voiceCallReport][newstate]\x20event:','channelstate','answered','answertime','diff','calleridnum','xcally-motion-preview','destinationchannel','UserId','membername','from-sip','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','endsWith','.wav49','replace','.WAV','monitorFilename','monitors','isNil','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','syncHangup','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','then','transferType','isEmpty','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','blindTransfers','type','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','some','origtransfererlinkedid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','BlindTransfer','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','not_inuse','busy','unavailable','ringing','set','queue','agi','dial','playback','NO\x20ANSWER','FAILED','ANSWERED','defaults','redis','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newchannel','syncNewChannel','syncNewState','hangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','prototype','emit','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','debug','[%s][voiceCallReport][newcallerid]\x20event:','isUndefined','merge','pick','keys','context','split','channel','destconnectedlinenum','connectedlinenum','name','user:agentconnect','accountcode','inspect','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed'];(function(_0xe27f36,_0x1c0455){var _0x35a77e=function(_0x279038){while(--_0x279038){_0xe27f36['push'](_0xe27f36['shift']());}};_0x35a77e(++_0x1c0455);}(_0x5781,0x14a));var _0x1578=function(_0xf7cb1c,_0x3ce6a4){_0xf7cb1c=_0xf7cb1c-0x0;var _0x1773f0=_0x5781[_0xf7cb1c];return _0x1773f0;};'use strict';var BPromise=require(_0x1578('0x0'));var _=require(_0x1578('0x1'));var moment=require(_0x1578('0x2'));var util=require(_0x1578('0x3'));var path=require('path');var Redis=require(_0x1578('0x4'));var config=require(_0x1578('0x5'));var logger=require(_0x1578('0x6'))(_0x1578('0x7'));var ami=require(_0x1578('0x8'));var Channel=require(_0x1578('0x9'));var RpcSetting=require(_0x1578('0xa'));var statusDesc=['unknown',_0x1578('0xb'),'inuse',_0x1578('0xc'),'invalid',_0x1578('0xd'),_0x1578('0xe'),'ringinuse','onhold'];var applications=[_0x1578('0xf'),_0x1578('0x10'),_0x1578('0x11'),_0x1578('0x12'),_0x1578('0x13'),'voicemail'];var dispositions=[_0x1578('0x14'),'FAILED',_0x1578('0x15'),_0x1578('0x14'),'NO\x20ANSWER','NO\x20ANSWER',_0x1578('0x16'),'BUSY',_0x1578('0x15'),_0x1578('0x15'),_0x1578('0x15')];var actions={};config['redis']=_[_0x1578('0x17')](config[_0x1578('0x18')],{'host':_0x1578('0x19'),'port':0x18eb});var io=require(_0x1578('0x1a'))(new Redis(config[_0x1578('0x18')]));function VoiceCallReport(_0x578b4b){this[_0x1578('0x1b')]=_0x578b4b[_0x1578('0x1b')];this[_0x1578('0x1c')]=_0x578b4b[_0x1578('0x1c')];this['blindTransfers']={};ami['on'](_0x1578('0x1d'),this[_0x1578('0x1e')][_0x1578('0x1f')](this));ami['on']('newexten',this['syncNewExten'][_0x1578('0x1f')](this));ami['on'](_0x1578('0x20'),this[_0x1578('0x21')][_0x1578('0x1f')](this));ami['on']('newstate',this[_0x1578('0x22')][_0x1578('0x1f')](this));ami['on']('varset',this['syncVarSet'][_0x1578('0x1f')](this));ami['on'](_0x1578('0x23'),this['syncHangup'][_0x1578('0x1f')](this));ami['on'](_0x1578('0x24'),this[_0x1578('0x25')][_0x1578('0x1f')](this));ami['on'](_0x1578('0x26'),this[_0x1578('0x27')][_0x1578('0x1f')](this));ami['on'](_0x1578('0x28'),this[_0x1578('0x29')]['bind'](this));ami['on'](_0x1578('0x2a'),this[_0x1578('0x2b')]['bind'](this));ami['on'](_0x1578('0x2c'),this['syncMusicOnHoldStop'][_0x1578('0x1f')](this));try{logger[_0x1578('0x2d')](_0x1578('0x2e'));ami[_0x1578('0x2f')]();}catch(_0xa0d7a6){logger[_0x1578('0x30')]('[voiceCallReport][coreshowchannels]',util['inspect'](_0xa0d7a6,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x1578('0x31')]['isNotNull']=function(_0x32c763){return _0x32c763!==null&&!_['isUndefined'](_0x32c763);};VoiceCallReport[_0x1578('0x31')][_0x1578('0x32')]=function(_0x5c0bba,_0x48518a,_0x3c131f){io['to'](_0x5c0bba)[_0x1578('0x32')](_0x48518a,_0x3c131f);};VoiceCallReport[_0x1578('0x31')][_0x1578('0x25')]=function(_0x16f427){try{if(this[_0x1578('0x33')](_0x16f427)){logger[_0x1578('0x2d')](_0x1578('0x34'),_0x16f427[_0x1578('0x35')],_0x16f427[_0x1578('0x36')],_0x16f427['calleridnum']);logger[_0x1578('0x37')](_0x1578('0x38'),_0x16f427[_0x1578('0x35')],util['inspect'](_0x16f427,{'showHidden':![],'depth':null}));if(_0x16f427['uniqueid']===_0x16f427['linkedid']){if(!_[_0x1578('0x39')](this['channels'][_0x16f427[_0x1578('0x35')]])){_[_0x1578('0x3a')](this[_0x1578('0x1b')][_0x16f427[_0x1578('0x35')]],_[_0x1578('0x3b')](_0x16f427,_[_0x1578('0x3c')](this[_0x1578('0x1b')][_0x16f427['uniqueid']])));}}if(_0x16f427[_0x1578('0x3d')]==='from-sip'){if(this[_0x1578('0x1c')][_0x16f427['channel'][_0x1578('0x3e')]('-')[0x0]]){if(_0x16f427['exten']=='xcally-motion-preview'){this[_0x1578('0x1c')][_0x16f427[_0x1578('0x3f')]['split']('-')[0x0]][_0x1578('0x40')]=_0x16f427[_0x1578('0x41')];this['emit'](util['format']('user:%s',this[_0x1578('0x1c')][_0x16f427[_0x1578('0x3f')]['split']('-')[0x0]][_0x1578('0x42')]),_0x1578('0x43'),{'destaccountcode':this[_0x1578('0x1c')][_0x16f427[_0x1578('0x3f')]['split']('-')[0x0]][_0x1578('0x44')],'destconnectedlinenum':_0x16f427['connectedlinenum']});}}}}}catch(_0x36cce1){logger[_0x1578('0x30')]('[%s][voiceCallReport][newcallerid]',_0x16f427[_0x1578('0x35')],util[_0x1578('0x45')](_0x36cce1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1578('0x31')]['syncNewChannel']=function(_0x1b5427){try{if(this[_0x1578('0x33')](_0x1b5427)){logger[_0x1578('0x37')](_0x1578('0x46'),_0x1b5427['uniqueid'],util[_0x1578('0x45')](_0x1b5427,{'showHidden':![],'depth':null}));if(_0x1b5427[_0x1578('0x35')]===_0x1b5427['linkedid']&&_0x1b5427['channel']!=_0x1578('0x47')){if(_['isUndefined'](this[_0x1578('0x1b')][_0x1b5427[_0x1578('0x35')]])){logger[_0x1578('0x2d')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x1b5427[_0x1578('0x35')],_0x1b5427[_0x1578('0x3d')],_0x1b5427[_0x1578('0x48')]);this[_0x1578('0x1b')][_0x1b5427[_0x1578('0x35')]]=new Channel();this[_0x1578('0x1b')][_0x1b5427['uniqueid']][_0x1578('0x49')]=moment()[_0x1578('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x1578('0x1b')][_0x1b5427['uniqueid']]['disposition']=dispositions[_[_0x1578('0x4b')](_0x1b5427['channelstate'])];_[_0x1578('0x3a')](this[_0x1578('0x1b')][_0x1b5427[_0x1578('0x35')]],_[_0x1578('0x3b')](_0x1b5427,_[_0x1578('0x3c')](this[_0x1578('0x1b')][_0x1b5427[_0x1578('0x35')]])));if(_0x1b5427['context']==='from-sip'){if(this[_0x1578('0x1c')][_0x1b5427['channel'][_0x1578('0x3e')]('-')[0x0]]){if(_[_0x1578('0x39')](this[_0x1578('0x1c')][_0x1b5427[_0x1578('0x3f')][_0x1578('0x3e')]('-')[0x0]][_0x1578('0x40')])){this[_0x1578('0x1c')][_0x1b5427['channel']['split']('-')[0x0]][_0x1578('0x40')]=_0x1b5427[_0x1578('0x48')];logger[_0x1578('0x37')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x1b5427['uniqueid'],util[_0x1578('0x45')]({'destaccountcode':this['agents'][_0x1b5427[_0x1578('0x3f')][_0x1578('0x3e')]('-')[0x0]][_0x1578('0x44')],'destconnectedlinenum':_0x1b5427[_0x1578('0x48')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x1578('0x4a')](_0x1578('0x4c'),this[_0x1578('0x1c')][_0x1b5427[_0x1578('0x3f')]['split']('-')[0x0]][_0x1578('0x42')]),'user:agentconnect',{'destaccountcode':this[_0x1578('0x1c')][_0x1b5427[_0x1578('0x3f')][_0x1578('0x3e')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x1b5427[_0x1578('0x48')]});}}}}}}}catch(_0x2942ea){logger[_0x1578('0x30')]('[%s][voiceCallReport][newchannel]',_0x1b5427[_0x1578('0x35')],util[_0x1578('0x45')](_0x2942ea,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x1578('0x1e')]=function(_0x20bf86){try{if(this[_0x1578('0x33')](_0x20bf86)){logger[_0x1578('0x37')](_0x1578('0x4d'),_0x20bf86[_0x1578('0x35')],util[_0x1578('0x45')](_0x20bf86,{'showHidden':![],'depth':null}));if(_0x20bf86['uniqueid']===_0x20bf86['linkedid']&&_0x20bf86[_0x1578('0x48')]!='h'&&_0x20bf86['channel']!=_0x1578('0x47')){_0x20bf86[_0x1578('0x4e')]=_0x20bf86['application'][_0x1578('0x4f')]();_0x20bf86[_0x1578('0x50')]=_0x20bf86[_0x1578('0x51')]&&_0x20bf86['appdata'][_0x1578('0x52')](_0x1578('0x53'))?_0x20bf86[_0x1578('0x51')]:(_0x20bf86['appdata']||_0x20bf86[_0x1578('0x50')])[_0x1578('0x4f')]();logger[_0x1578('0x2d')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x20bf86[_0x1578('0x35')],_0x20bf86[_0x1578('0x4e')],_0x20bf86[_0x1578('0x50')]);if(_[_0x1578('0x39')](this[_0x1578('0x1b')][_0x20bf86[_0x1578('0x35')]])){this[_0x1578('0x1b')][_0x20bf86[_0x1578('0x35')]]=new Channel();this[_0x1578('0x1b')][_0x20bf86['uniqueid']][_0x1578('0x49')]=_0x20bf86[_0x1578('0x54')]?moment()[_0x1578('0x55')](moment['duration'](_0x20bf86['duration'])[_0x1578('0x56')](),_0x1578('0x56'))[_0x1578('0x4a')]('YYYY-MM-DD\x20HH:mm:ss'):moment()['format'](_0x1578('0x57'));this[_0x1578('0x1b')][_0x20bf86[_0x1578('0x35')]][_0x1578('0x58')]='NO\x20ANSWER';}_[_0x1578('0x3a')](this['channels'][_0x20bf86[_0x1578('0x35')]],_[_0x1578('0x3b')](_0x20bf86,_[_0x1578('0x3c')](this[_0x1578('0x1b')][_0x20bf86['uniqueid']])));if(_[_0x1578('0x59')](applications,_0x20bf86[_0x1578('0x4e')])){this['channels'][_0x20bf86[_0x1578('0x35')]]['lastapplication']=_0x20bf86[_0x1578('0x4e')];this[_0x1578('0x1b')][_0x20bf86[_0x1578('0x35')]][_0x1578('0x5a')]=_0x20bf86[_0x1578('0x50')];if(_0x20bf86[_0x1578('0x4e')]===_0x1578('0xf')&&_[_0x1578('0x52')](_0x20bf86[_0x1578('0x50')][_0x1578('0x4f')](),_0x1578('0x5b'))){var _0x1ba37e=_0x20bf86[_0x1578('0x50')]['split']('=');var _0x2ee26a=_0x1ba37e[0x0][_0x1578('0x4f')]()[_0x1578('0x5c')](/cdr\((.*)\)/);if(_0x2ee26a){this[_0x1578('0x1b')][_0x20bf86[_0x1578('0x35')]][_0x2ee26a[0x1]]=_0x1ba37e[0x1];}}else if(_0x20bf86['application']===_0x1578('0x10')){this['channels'][_0x20bf86[_0x1578('0x35')]][_0x1578('0x10')]=_0x20bf86[_0x1578('0x50')][_0x1578('0x3e')](',')[0x0];}}}}}catch(_0x5ecaa6){logger[_0x1578('0x30')](_0x1578('0x5d'),_0x20bf86['uniqueid'],util['inspect'](_0x5ecaa6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1578('0x31')][_0x1578('0x22')]=function(_0x4ebb77){try{if(this[_0x1578('0x33')](_0x4ebb77)){logger[_0x1578('0x2d')](_0x1578('0x5e'),_0x4ebb77['uniqueid'],_0x4ebb77[_0x1578('0x5f')],_0x4ebb77[_0x1578('0x36')],_0x4ebb77['calleridnum']);logger[_0x1578('0x37')](_0x1578('0x60'),_0x4ebb77[_0x1578('0x35')],util['inspect'](_0x4ebb77,{'showHidden':![],'depth':null}));if(_0x4ebb77[_0x1578('0x35')]!==_0x4ebb77['linkedid']){if(this[_0x1578('0x1b')][_0x4ebb77[_0x1578('0x5f')]]){if(_0x4ebb77[_0x1578('0x61')]==='6'){if(!this['channels'][_0x4ebb77['linkedid']][_0x1578('0x62')]){var _0x54d4a3=moment();this[_0x1578('0x1b')][_0x4ebb77[_0x1578('0x5f')]][_0x1578('0x62')]=!![];this[_0x1578('0x1b')][_0x4ebb77['linkedid']][_0x1578('0x63')]=_0x54d4a3['format'](_0x1578('0x57'));if(this[_0x1578('0x1b')][_0x4ebb77[_0x1578('0x5f')]][_0x1578('0x49')]){this[_0x1578('0x1b')][_0x4ebb77[_0x1578('0x5f')]]['holdtime']=_0x54d4a3[_0x1578('0x64')](this[_0x1578('0x1b')][_0x4ebb77[_0x1578('0x5f')]][_0x1578('0x49')],_0x1578('0x56'));}}this[_0x1578('0x1b')][_0x4ebb77[_0x1578('0x5f')]]['linkedid']=_0x4ebb77[_0x1578('0x35')];if(_0x4ebb77[_0x1578('0x65')]!==_0x1578('0x66')){this['channels'][_0x4ebb77[_0x1578('0x5f')]]['connectedlinenum']=_0x4ebb77['calleridnum'];}this['channels'][_0x4ebb77[_0x1578('0x5f')]]['connectedlinename']=_0x4ebb77[_0x1578('0x36')];this[_0x1578('0x1b')][_0x4ebb77[_0x1578('0x5f')]][_0x1578('0x67')]=_0x4ebb77[_0x1578('0x3f')];this[_0x1578('0x1b')][_0x4ebb77[_0x1578('0x5f')]][_0x1578('0x58')]=dispositions[_[_0x1578('0x4b')](_0x4ebb77[_0x1578('0x61')])];if(this[_0x1578('0x1c')][_0x4ebb77['channel']['split']('-')[0x0]]){this[_0x1578('0x1b')][_0x4ebb77['linkedid']]['UserId']=this[_0x1578('0x1c')][_0x4ebb77[_0x1578('0x3f')][_0x1578('0x3e')]('-')[0x0]]['id'];this['channels'][_0x4ebb77['linkedid']]['membername']=this['agents'][_0x4ebb77[_0x1578('0x3f')][_0x1578('0x3e')]('-')[0x0]]['name'];}}}}else{if(this[_0x1578('0x1b')][_0x4ebb77[_0x1578('0x35')]]){if(_0x4ebb77[_0x1578('0x61')]==='6'){if(this[_0x1578('0x1c')][_0x4ebb77[_0x1578('0x3f')][_0x1578('0x3e')]('-')[0x0]]){this[_0x1578('0x1b')][_0x4ebb77[_0x1578('0x35')]][_0x1578('0x68')]=this[_0x1578('0x1c')][_0x4ebb77['channel']['split']('-')[0x0]]['id'];this[_0x1578('0x1b')][_0x4ebb77[_0x1578('0x35')]][_0x1578('0x69')]=this[_0x1578('0x1c')][_0x4ebb77[_0x1578('0x3f')]['split']('-')[0x0]][_0x1578('0x42')];}}}}if(_0x4ebb77[_0x1578('0x61')]==='6'&&_0x4ebb77[_0x1578('0x3d')]===_0x1578('0x6a')){if(this[_0x1578('0x1c')][_0x4ebb77[_0x1578('0x3f')]['split']('-')[0x0]]){this[_0x1578('0x1c')][_0x4ebb77[_0x1578('0x3f')][_0x1578('0x3e')]('-')[0x0]][_0x1578('0x40')]=_0x4ebb77[_0x1578('0x48')];var _0x4b80d8;if(this[_0x1578('0x1b')][_0x4ebb77[_0x1578('0x35')]])_0x4b80d8=this[_0x1578('0x1b')][_0x4ebb77[_0x1578('0x35')]][_0x1578('0x6b')];else if(this['channels'][_0x4ebb77[_0x1578('0x5f')]])_0x4b80d8=this[_0x1578('0x1b')][_0x4ebb77['linkedid']]['routealias'];logger[_0x1578('0x37')](_0x1578('0x6c'),_0x4ebb77[_0x1578('0x35')],util[_0x1578('0x45')]({'destaccountcode':this[_0x1578('0x1c')][_0x4ebb77['channel']['split']('-')[0x0]][_0x1578('0x44')],'destconnectedlinenum':_0x4ebb77[_0x1578('0x48')],'routealias':_0x4b80d8},{'showHidden':![],'depth':null}));this[_0x1578('0x32')](util[_0x1578('0x4a')]('user:%s',this['agents'][_0x4ebb77[_0x1578('0x3f')]['split']('-')[0x0]][_0x1578('0x42')]),_0x1578('0x43'),{'destaccountcode':this[_0x1578('0x1c')][_0x4ebb77[_0x1578('0x3f')][_0x1578('0x3e')]('-')[0x0]][_0x1578('0x44')],'destconnectedlinenum':_0x4ebb77[_0x1578('0x48')],'routealias':_0x4b80d8});}}}}catch(_0x13f6d2){logger[_0x1578('0x30')](_0x1578('0x6d'),_0x4ebb77['uniqueid'],util['inspect'](_0x13f6d2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1578('0x31')][_0x1578('0x6e')]=function(_0x4d462d,_0xf59879){try{if(this[_0x1578('0x1b')][_0x4d462d]){logger[_0x1578('0x2d')](_0x1578('0x6f'),_0x4d462d,_0xf59879);this[_0x1578('0x1b')][_0x4d462d]['monitor']=!![];if(_[_0x1578('0x70')](_0xf59879,_0x1578('0x71'))){_0xf59879=_0xf59879[_0x1578('0x72')]('.wav49',_0x1578('0x73'));}this['channels'][_0x4d462d][_0x1578('0x74')]=_0xf59879;var _0x33b499=_['find'](this[_0x1578('0x1b')][_0x4d462d][_0x1578('0x75')],{'filename':_0xf59879});if(_[_0x1578('0x76')](_0x33b499)){this[_0x1578('0x1b')][_0x4d462d][_0x1578('0x75')]['push']({'filename':_0xf59879,'createdAt':moment()[_0x1578('0x4a')](_0x1578('0x57')),'mixmonitorid':'','status':'rec'});}}}catch(_0x451688){logger['error'](_0x1578('0x77'),_0x4d462d,util[_0x1578('0x45')](_0x451688,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1578('0x31')]['syncVarSet']=function(_0x19cf99){try{if(this[_0x1578('0x33')](_0x19cf99)){logger[_0x1578('0x37')](_0x1578('0x78'),_0x19cf99['uniqueid'],util[_0x1578('0x45')](_0x19cf99,{'showHidden':![],'depth':null}));if(this[_0x1578('0x1b')][_0x19cf99['uniqueid']]&&_0x19cf99['channel']!=_0x1578('0x47')){if(this[_0x1578('0x33')](_0x19cf99[_0x1578('0x79')])){if(this['isNotNull'](_0x19cf99[_0x1578('0x79')][_0x1578('0x7a')])){logger[_0x1578('0x2d')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x19cf99[_0x1578('0x35')],_0x19cf99[_0x1578('0x7b')]);this['syncMixMonitorFilename'](_0x19cf99['uniqueid'],_0x19cf99[_0x1578('0x7b')]);}else if(this[_0x1578('0x33')](_0x19cf99[_0x1578('0x79')][_0x1578('0x7c')])){logger[_0x1578('0x2d')](_0x1578('0x7d'),_0x19cf99[_0x1578('0x35')],_0x19cf99[_0x1578('0x7b')]);this[_0x1578('0x1b')][_0x19cf99[_0x1578('0x35')]][_0x1578('0x65')]=_0x19cf99['value'];}else if(this[_0x1578('0x33')](_0x19cf99[_0x1578('0x79')][_0x1578('0x7e')])){logger[_0x1578('0x2d')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x19cf99[_0x1578('0x35')],_0x19cf99[_0x1578('0x7b')]);this[_0x1578('0x1b')][_0x19cf99[_0x1578('0x35')]][_0x1578('0x7f')]=_0x19cf99['value'];}else if(this['isNotNull'](_0x19cf99[_0x1578('0x79')]['xmd-cdrtype'])){logger[_0x1578('0x2d')](_0x1578('0x80'),_0x19cf99['uniqueid'],_0x19cf99[_0x1578('0x7b')]);this[_0x1578('0x1b')][_0x19cf99[_0x1578('0x35')]]['type']=_0x19cf99[_0x1578('0x7b')];}else if(this['isNotNull'](_0x19cf99[_0x1578('0x79')][_0x1578('0x81')])){logger['info'](_0x1578('0x82'),_0x19cf99[_0x1578('0x35')],_0x19cf99[_0x1578('0x7b')][_0x1578('0x3e')](',')[0x0]);this[_0x1578('0x1b')][_0x19cf99[_0x1578('0x35')]][_0x1578('0x10')]=_0x19cf99[_0x1578('0x7b')][_0x1578('0x3e')](',')[0x0];}else if(this[_0x1578('0x33')](_0x19cf99[_0x1578('0x79')]['xmd-originatecalleridnum'])){logger['info'](_0x1578('0x83'),_0x19cf99['uniqueid'],_0x19cf99[_0x1578('0x7b')]);this[_0x1578('0x1b')][_0x19cf99['uniqueid']][_0x1578('0x84')]=_0x19cf99[_0x1578('0x7b')];}else if(this['isNotNull'](_0x19cf99[_0x1578('0x79')][_0x1578('0x85')])){logger['info'](_0x1578('0x86'),_0x19cf99[_0x1578('0x35')],_0x19cf99[_0x1578('0x7b')]);this[_0x1578('0x1b')][_0x19cf99[_0x1578('0x35')]][_0x1578('0x87')]=_0x19cf99[_0x1578('0x7b')];}else if(this[_0x1578('0x33')](_0x19cf99['variable'][_0x1578('0x88')])){logger[_0x1578('0x2d')](_0x1578('0x89'),_0x19cf99['uniqueid'],_0x19cf99['value']);this['channels'][_0x19cf99[_0x1578('0x35')]][_0x1578('0x8a')]=_0x19cf99[_0x1578('0x7b')];}else if(this[_0x1578('0x33')](_0x19cf99[_0x1578('0x79')][_0x1578('0x8b')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x19cf99['uniqueid'],_0x19cf99[_0x1578('0x7b')]);this['channels'][_0x19cf99[_0x1578('0x35')]][_0x1578('0x10')]=_0x19cf99[_0x1578('0x7b')];}else if(this[_0x1578('0x33')](_0x19cf99[_0x1578('0x79')]['sipcallid'])){logger[_0x1578('0x2d')](_0x1578('0x8c'),_0x19cf99[_0x1578('0x35')],_0x19cf99[_0x1578('0x7b')]);this[_0x1578('0x1b')][_0x19cf99[_0x1578('0x35')]][_0x1578('0x8d')]=_0x19cf99[_0x1578('0x7b')];}}}else if(this['isNotNull'](_0x19cf99['variable'][_0x1578('0x7a')])){if(_0x19cf99[_0x1578('0x7b')]){var _0x44c232=path[_0x1578('0x8e')](_0x19cf99['value'])[_0x1578('0x42')];logger[_0x1578('0x2d')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x44c232,_0x19cf99[_0x1578('0x7b')]);this[_0x1578('0x6e')](_0x44c232,_0x19cf99[_0x1578('0x7b')]);}}else if(this[_0x1578('0x1b')][_0x19cf99['linkedid']]){if(this[_0x1578('0x33')](_0x19cf99[_0x1578('0x79')])){if(this[_0x1578('0x33')](_0x19cf99['variable']['sipcallid'])){logger[_0x1578('0x2d')](_0x1578('0x8c'),_0x19cf99[_0x1578('0x5f')],_0x19cf99[_0x1578('0x7b')]);this['channels'][_0x19cf99['linkedid']][_0x1578('0x8f')]=_0x19cf99[_0x1578('0x7b')];}}}}}catch(_0x195d46){logger[_0x1578('0x30')]('[%s][voiceCallReport][varset]',_0x19cf99[_0x1578('0x35')],util[_0x1578('0x45')](_0x195d46,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1578('0x31')][_0x1578('0x90')]=function(_0x23381d){try{if(this['isNotNull'](_0x23381d)){logger[_0x1578('0x37')](_0x1578('0x91'),_0x23381d[_0x1578('0x35')],util['inspect'](_0x23381d,{'showHidden':![],'depth':null}));if(this[_0x1578('0x1b')][_0x23381d[_0x1578('0x35')]]){logger['info'](_0x1578('0x92'),_0x23381d[_0x1578('0x35')],_0x23381d[_0x1578('0x93')]);var _0x545046=moment();this[_0x1578('0x1b')][_0x23381d[_0x1578('0x35')]][_0x1578('0x94')]=_0x545046[_0x1578('0x4a')](_0x1578('0x57'));this[_0x1578('0x1b')][_0x23381d[_0x1578('0x35')]][_0x1578('0x54')]=_0x545046[_0x1578('0x64')](this[_0x1578('0x1b')][_0x23381d[_0x1578('0x35')]][_0x1578('0x49')],_0x1578('0x56'));if(this[_0x1578('0x1b')][_0x23381d[_0x1578('0x35')]][_0x1578('0x62')]){this['channels'][_0x23381d[_0x1578('0x35')]][_0x1578('0x95')]=_0x545046[_0x1578('0x64')](this['channels'][_0x23381d[_0x1578('0x35')]]['answertime'],_0x1578('0x56'));this[_0x1578('0x1b')][_0x23381d['uniqueid']]['holdtime']=this[_0x1578('0x1b')][_0x23381d[_0x1578('0x35')]][_0x1578('0x54')]-this[_0x1578('0x1b')][_0x23381d['uniqueid']][_0x1578('0x95')];}if(_0x23381d[_0x1578('0x3d')]===_0x1578('0x6a')){if(this[_0x1578('0x1c')][_0x23381d[_0x1578('0x3f')][_0x1578('0x3e')]('-')[0x0]]){this[_0x1578('0x1c')][_0x23381d[_0x1578('0x3f')]['split']('-')[0x0]]=_[_0x1578('0x96')](this[_0x1578('0x1c')][_0x23381d[_0x1578('0x3f')][_0x1578('0x3e')]('-')[0x0]],[_0x1578('0x40')]);logger[_0x1578('0x37')](_0x1578('0x97'),_0x23381d[_0x1578('0x35')],util['inspect']({'id':this[_0x1578('0x1c')][_0x23381d[_0x1578('0x3f')][_0x1578('0x3e')]('-')[0x0]]['id'],'destaccountcode':this[_0x1578('0x1c')][_0x23381d['channel'][_0x1578('0x3e')]('-')[0x0]][_0x1578('0x44')]},{'showHidden':![],'depth':null}));this['emit'](util['format']('user:%s',this[_0x1578('0x1c')][_0x23381d[_0x1578('0x3f')]['split']('-')[0x0]][_0x1578('0x42')]),_0x1578('0x98'),{'id':this[_0x1578('0x1c')][_0x23381d[_0x1578('0x3f')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x1578('0x1c')][_0x23381d[_0x1578('0x3f')]['split']('-')[0x0]][_0x1578('0x44')]});}}var _0x66d2f=this;Promise[_0x1578('0x99')]()[_0x1578('0x9a')](function(){var _0x1967f6=_0x66d2f[_0x1578('0x1b')][_0x23381d[_0x1578('0x35')]];if(typeof _0x1967f6[_0x1578('0x9b')]==='undefined')return;if(_[_0x1578('0x9c')](_0x1967f6[_0x1578('0x75')]))return;return RpcSetting['getSettings']()['then'](function(_0x511c54){if(!_0x511c54[_0x1578('0x9d')])return;return Promise['resolve']()[_0x1578('0x9a')](function(){return ami[_0x1578('0x9e')]({'action':_0x1578('0x9f'),'channel':_0x1967f6[_0x1578('0x3f')]})[_0x1578('0xa0')](function(){});})[_0x1578('0x9a')](function(){return ami[_0x1578('0x9e')]({'action':_0x1578('0x9f'),'channel':_0x1967f6[_0x1578('0x67')]})[_0x1578('0xa0')](function(){})[_0x1578('0xa1')](function(){var _0x597bd9=_0x66d2f[_0x1578('0x1c')][_0x1967f6[_0x1578('0x67')][_0x1578('0x3e')]('-')[0x0]];if(!_0x597bd9)return;io[_0x1578('0x32')](_0x1578('0xa2'),{'agentId':_0x597bd9['id'],'uniqueid':_0x1967f6[_0x1578('0x35')]});});});});})[_0x1578('0x9a')](function(){if(_0x23381d[_0x1578('0xa3')]==='BlindTransfer'){_0x66d2f[_0x1578('0xa4')][_0x23381d[_0x1578('0x35')]]=_0x66d2f[_0x1578('0x1b')][_0x23381d['uniqueid']];}else{if(_0x66d2f[_0x1578('0x1b')][_0x23381d[_0x1578('0x35')]][_0x1578('0xa5')]===_0x1578('0xa6')&&_0x66d2f[_0x1578('0xa4')][_0x23381d[_0x1578('0x35')]]){_0x66d2f[_0x1578('0x1b')][_0x23381d['uniqueid']]['uniqueid']=[_0x66d2f[_0x1578('0x1b')][_0x23381d[_0x1578('0x35')]][_0x1578('0x5f')],_0x66d2f[_0x1578('0x1b')][_0x23381d[_0x1578('0x35')]]['linkedid']=_0x66d2f[_0x1578('0x1b')][_0x23381d[_0x1578('0x35')]]['uniqueid']][0x0];delete _0x66d2f['blindTransfers'][_0x23381d[_0x1578('0x35')]];}}logger[_0x1578('0x37')](_0x1578('0xa7'),_0x23381d[_0x1578('0x35')],util[_0x1578('0x45')](_0x66d2f[_0x1578('0x1b')][_0x23381d[_0x1578('0x35')]],{'showHidden':![],'depth':null}));ami['emit'](_0x1578('0xa8'),_0x66d2f['channels'][_0x23381d['uniqueid']]);delete _0x66d2f['channels'][_0x23381d[_0x1578('0x35')]];});}}}catch(_0x50c3c0){logger[_0x1578('0x30')](_0x1578('0xa9'),_0x23381d[_0x1578('0x35')],util[_0x1578('0x45')](_0x50c3c0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1578('0x31')]['syncAttendedTransfer']=function(_0x5a64a1){try{if(this['isNotNull'](_0x5a64a1)){logger[_0x1578('0x2d')](_0x1578('0xaa'),_0x5a64a1['uniqueid'],_0x5a64a1[_0x1578('0xab')],_0x5a64a1[_0x1578('0xac')]);logger[_0x1578('0x37')](_0x1578('0xad'),_0x5a64a1[_0x1578('0x35')],util['inspect'](_0x5a64a1,{'showHidden':![],'depth':null}));if(this['channels'][_0x5a64a1[_0x1578('0xae')]]){this['channels'][_0x5a64a1[_0x1578('0xae')]][_0x1578('0xaf')]=_0x5a64a1[_0x1578('0xab')];this[_0x1578('0x1b')][_0x5a64a1[_0x1578('0xae')]]['transferconnectedlinenum']=_0x5a64a1[_0x1578('0xac')];if(this[_0x1578('0x1b')][_0x5a64a1[_0x1578('0xb0')]]){var _0x198a55=this[_0x1578('0x1b')][_0x5a64a1[_0x1578('0xb0')]];this[_0x1578('0x1b')][_0x5a64a1[_0x1578('0xb0')]]=this[_0x1578('0x1b')][_0x5a64a1[_0x1578('0xae')]];this[_0x1578('0x1b')][_0x5a64a1[_0x1578('0xae')]]=_0x198a55;}}else if(this['channels'][_0x5a64a1[_0x1578('0xb1')]]){this[_0x1578('0x1b')][_0x5a64a1[_0x1578('0xb1')]][_0x1578('0xaf')]=_0x5a64a1[_0x1578('0xab')];this[_0x1578('0x1b')][_0x5a64a1[_0x1578('0xb1')]][_0x1578('0xb2')]=_0x5a64a1[_0x1578('0xac')];if(this['channels'][_0x5a64a1[_0x1578('0xb3')]]){var _0x198a55=this[_0x1578('0x1b')][_0x5a64a1[_0x1578('0xb3')]];this[_0x1578('0x1b')][_0x5a64a1[_0x1578('0xb3')]]=this[_0x1578('0x1b')][_0x5a64a1[_0x1578('0xb1')]];this['channels'][_0x5a64a1['transfertargetuniqueid']]=_0x198a55;}}if((this[_0x1578('0x1b')][_0x5a64a1[_0x1578('0xb3')]]||this[_0x1578('0x1b')][_0x5a64a1['origtransfererlinkedid']])&&this[_0x1578('0x1b')][_0x5a64a1[_0x1578('0xb0')]]){var _0x128e7d=_[_0x1578('0xb4')]([this['channels'][_0x5a64a1[_0x1578('0xb3')]],this[_0x1578('0x1b')][_0x5a64a1['origtransfererlinkedid']],this[_0x1578('0x1b')][_0x5a64a1[_0x1578('0xb0')]]],function(_0x1cbef3){return _0x1cbef3&&_0x1cbef3[_0x1578('0xa5')]==='outbound'&&_0x1cbef3['routeid'];});if(_0x128e7d){if(this[_0x1578('0x1b')][_0x5a64a1[_0x1578('0xb3')]])this[_0x1578('0x1b')][_0x5a64a1[_0x1578('0xb3')]][_0x1578('0x9b')]='ATTENDED';if(this[_0x1578('0x1b')][_0x5a64a1[_0x1578('0xb5')]])this[_0x1578('0x1b')][_0x5a64a1[_0x1578('0xb5')]][_0x1578('0x9b')]=_0x1578('0xb6');this[_0x1578('0x1b')][_0x5a64a1[_0x1578('0xb0')]]['transferType']=_0x1578('0xb6');}}}}catch(_0x1bdc8c){logger['error'](_0x1578('0xb7'),_0x5a64a1[_0x1578('0x35')],util[_0x1578('0x45')](_0x1bdc8c,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x1578('0x29')]=function(_0x51f8c7){try{if(this[_0x1578('0x33')](_0x51f8c7)){logger[_0x1578('0x2d')](_0x1578('0xb8'),_0x51f8c7['uniqueid'],_0x51f8c7[_0x1578('0xb9')],_0x51f8c7[_0x1578('0xba')]);logger['debug'](_0x1578('0xbb'),_0x51f8c7[_0x1578('0x35')],util[_0x1578('0x45')](_0x51f8c7,{'showHidden':![],'depth':null}));if(this['channels'][_0x51f8c7[_0x1578('0xae')]]){this[_0x1578('0x1b')][_0x51f8c7[_0x1578('0xae')]]['transfercalleridnum']=_0x51f8c7[_0x1578('0xb9')];this[_0x1578('0x1b')][_0x51f8c7[_0x1578('0xae')]][_0x1578('0xb2')]=_0x51f8c7[_0x1578('0xba')];this['channels'][_0x51f8c7[_0x1578('0xae')]][_0x1578('0x9b')]=_0x1578('0xbc');this['syncHangup']({'event':_0x1578('0xbd'),'uniqueid':_0x51f8c7[_0x1578('0xae')],'context':_0x51f8c7[_0x1578('0x3d')],'channel':_0x51f8c7['transfererchannel']});}else{this[_0x1578('0x1b')][_0x51f8c7[_0x1578('0xbe')]][_0x1578('0x9b')]='BLIND';}}}catch(_0x406ae3){logger[_0x1578('0x30')](_0x1578('0xbf'),_0x51f8c7[_0x1578('0x35')],util[_0x1578('0x45')](_0x406ae3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1578('0x31')]['syncMusicOnHoldStart']=function(_0x39bba0){try{if(this[_0x1578('0x33')](_0x39bba0)){logger[_0x1578('0x37')](_0x1578('0xc0'),_0x39bba0[_0x1578('0x35')],util[_0x1578('0x45')](_0x39bba0,{'showHidden':![],'depth':null}));if(this[_0x1578('0x1b')][_0x39bba0[_0x1578('0x35')]]){if(!_[_0x1578('0x76')](this[_0x1578('0x1b')][_0x39bba0[_0x1578('0x35')]][_0x1578('0x63')])){this[_0x1578('0x1b')][_0x39bba0[_0x1578('0x35')]][_0x1578('0xc1')]=moment()['format'](_0x1578('0x57'));logger[_0x1578('0x2d')](_0x1578('0xc2'),_0x39bba0['uniqueid'],this['channels'][_0x39bba0[_0x1578('0x35')]][_0x1578('0xc1')]);}}}}catch(_0x3c2522){logger[_0x1578('0x30')]('[%s][voiceCallReport][musiconholdstart]',_0x39bba0[_0x1578('0x35')],util['inspect'](_0x3c2522,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1578('0x31')][_0x1578('0xc3')]=function(_0x54c669){try{if(this[_0x1578('0x33')](_0x54c669)){logger[_0x1578('0x37')](_0x1578('0xc4'),_0x54c669[_0x1578('0x35')],util['inspect'](_0x54c669,{'showHidden':![],'depth':null}));if(this['channels'][_0x54c669[_0x1578('0x35')]]){if(!_[_0x1578('0x76')](this[_0x1578('0x1b')][_0x54c669[_0x1578('0x35')]][_0x1578('0xc1')])){this[_0x1578('0x1b')][_0x54c669['uniqueid']][_0x1578('0xc5')]+=moment()['milliseconds'](0x0)['diff'](this[_0x1578('0x1b')][_0x54c669[_0x1578('0x35')]]['mohstarttime'],_0x1578('0x56'));logger[_0x1578('0x2d')](_0x1578('0xc6'),_0x54c669[_0x1578('0x35')],this['channels'][_0x54c669[_0x1578('0x35')]][_0x1578('0xc5')]);delete this[_0x1578('0x1b')][_0x54c669[_0x1578('0x35')]][_0x1578('0xc1')];}}}}catch(_0x4b6655){logger['error'](_0x1578('0xc7'),_0x54c669['uniqueid'],util[_0x1578('0x45')](_0x4b6655,{'showHidden':![],'depth':null}));}};module[_0x1578('0xc8')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 127e80e..8d5ff2b 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81c4=['outbound','applications','variables','bind','dialend','syncDialEnd','varset','syncVarSet','newexten','syncNewExten','syncHangup','prototype','syncDialBegin','isNotNull','uniqueid','inspect','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','info','membername','interface','debug','merge','emit','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','error','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','keys','variable','outboundrouteid','isUndefined','value','[%s][voiceDialReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','seconds','total','answered','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','toLowerCase','set','applicationdata','appdata','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','application','split','match','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','channels','outboundChannels'];(function(_0x42885c,_0x307cc2){var _0x292742=function(_0x213b9e){while(--_0x213b9e){_0x42885c['push'](_0x42885c['shift']());}};_0x292742(++_0x307cc2);}(_0x81c4,0x6b));var _0x481c=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x81c4[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x481c('0x0'));var moment=require(_0x481c('0x1'));var util=require('util');var Redis=require(_0x481c('0x2'));var config=require(_0x481c('0x3'));var logger=require(_0x481c('0x4'))('ami');var ami=require(_0x481c('0x5'));config[_0x481c('0x6')]=_[_0x481c('0x7')](config[_0x481c('0x6')],{'host':_0x481c('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceDialReport(_0x24aac5){this[_0x481c('0x9')]=_0x24aac5[_0x481c('0xa')];this[_0x481c('0xb')]=_0x24aac5[_0x481c('0xb')];this[_0x481c('0xc')]={};this[_0x481c('0xd')]={};ami['on']('dialbegin',this['syncDialBegin'][_0x481c('0xe')](this));ami['on'](_0x481c('0xf'),this[_0x481c('0x10')][_0x481c('0xe')](this));ami['on'](_0x481c('0x11'),this[_0x481c('0x12')][_0x481c('0xe')](this));ami['on'](_0x481c('0x13'),this[_0x481c('0x14')][_0x481c('0xe')](this));ami['on']('hangup',this[_0x481c('0x15')][_0x481c('0xe')](this));}VoiceDialReport[_0x481c('0x16')]['isNotNull']=function(_0x5aa249){return _0x5aa249!==null&&!_['isUndefined'](_0x5aa249);};VoiceDialReport[_0x481c('0x16')]['emit']=function(_0x1dd511,_0x152f80,_0x2cf661){io['to'](_0x1dd511)['emit'](_0x152f80,_0x2cf661);};VoiceDialReport[_0x481c('0x16')][_0x481c('0x17')]=function(_0x28f543){try{if(this[_0x481c('0x18')](_0x28f543)){logger['debug']('[%s][voiceDialReport][dialbegin]\x20event:',_0x28f543[_0x481c('0x19')],util[_0x481c('0x1a')](_0x28f543,{'showHidden':![],'depth':null}));if(this['channels'][_0x28f543['uniqueid']]){_['merge'](this[_0x481c('0x9')][_0x28f543['uniqueid']],{'starttime':moment()[_0x481c('0x1b')](_0x481c('0x1c')),'lastevent':_0x481c('0x1d'),'interface':_0x28f543[_0x481c('0x1e')][_0x481c('0x1f')](0x0,_0x28f543[_0x481c('0x1e')]['lastIndexOf']('-')),'membername':_0x28f543[_0x481c('0x1e')]['substring'](_0x28f543[_0x481c('0x1e')][_0x481c('0x20')]('/')+0x1,_0x28f543[_0x481c('0x1e')][_0x481c('0x20')]('-'))},_[_0x481c('0x21')](_0x28f543,[_0x481c('0x22'),'privilege']));logger[_0x481c('0x23')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x28f543[_0x481c('0x19')],this[_0x481c('0x9')][_0x28f543[_0x481c('0x19')]][_0x481c('0x24')],this['channels'][_0x28f543['uniqueid']][_0x481c('0x25')]);logger[_0x481c('0x26')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x28f543[_0x481c('0x19')],util[_0x481c('0x1a')](this['channels'][_0x28f543[_0x481c('0x19')]],{'showHidden':![],'depth':null}));if(this[_0x481c('0xc')][_0x28f543[_0x481c('0x19')]])_[_0x481c('0x27')](this[_0x481c('0x9')][_0x28f543[_0x481c('0x19')]],this[_0x481c('0xc')][_0x28f543[_0x481c('0x19')]]);this[_0x481c('0x28')]('voice:outbound',_0x481c('0x29'),this[_0x481c('0x9')][_0x28f543[_0x481c('0x19')]]);logger['debug'](_0x481c('0x2a'),_0x28f543[_0x481c('0x19')],util['inspect'](this[_0x481c('0x9')][_0x28f543[_0x481c('0x19')]],{'showHidden':![],'depth':null}));ami[_0x481c('0x28')]('custom:dialbegin',this[_0x481c('0x9')][_0x28f543['uniqueid']]);}}}catch(_0x541aa5){logger['error']('[%s][voiceDialReport][dialbegin]',_0x28f543['uniqueid'],util[_0x481c('0x1a')](_0x541aa5,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x481c('0x16')][_0x481c('0x10')]=function(_0x3f3956){try{if(this[_0x481c('0x18')](_0x3f3956)){logger[_0x481c('0x26')]('[%s][voiceDialReport][dialend]\x20event:',_0x3f3956[_0x481c('0x19')],util[_0x481c('0x1a')](_0x3f3956,{'showHidden':![],'depth':null}));if(this['channels'][_0x3f3956[_0x481c('0x19')]]){this[_0x481c('0x9')][_0x3f3956['uniqueid']][_0x481c('0x2b')]=_0x3f3956[_0x481c('0x2b')];if(_0x3f3956[_0x481c('0x2b')]===_0x481c('0x2c')){this[_0x481c('0x9')][_0x3f3956[_0x481c('0x19')]][_0x481c('0x2d')]=_0x3f3956[_0x481c('0x2d')];this[_0x481c('0x9')][_0x3f3956[_0x481c('0x19')]][_0x481c('0x2e')]=_0x3f3956['connectedlinename'];this['channels'][_0x3f3956['uniqueid']][_0x481c('0x2f')]=moment()[_0x481c('0x1b')](_0x481c('0x1c'));this[_0x481c('0x9')][_0x3f3956[_0x481c('0x19')]][_0x481c('0x30')]=_0x481c('0x31');logger[_0x481c('0x23')](_0x481c('0x32'),_0x3f3956[_0x481c('0x19')],_0x3f3956[_0x481c('0x1e')]['substring'](_0x3f3956[_0x481c('0x1e')]['lastIndexOf']('/')+0x1,_0x3f3956[_0x481c('0x1e')][_0x481c('0x20')]('-')));logger['debug'](_0x481c('0x33'),_0x3f3956[_0x481c('0x19')],util['inspect'](this[_0x481c('0x9')][_0x3f3956['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x481c('0x28')]('custom:dialconnect',this[_0x481c('0x9')][_0x3f3956[_0x481c('0x19')]]);}logger[_0x481c('0x26')](_0x481c('0x34'),_0x3f3956[_0x481c('0x19')],util['inspect'](this[_0x481c('0x9')][_0x3f3956[_0x481c('0x19')]],{'showHidden':![],'depth':null}));this['emit'](_0x481c('0x35'),_0x481c('0x29'),this['channels'][_0x3f3956[_0x481c('0x19')]]);}}}catch(_0x1375ab){logger[_0x481c('0x36')](_0x481c('0x37'),_0x3f3956[_0x481c('0x19')],util[_0x481c('0x1a')](_0x1375ab,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x481c('0x16')][_0x481c('0x12')]=function(_0x5ecd1e){try{if(this[_0x481c('0x18')](_0x5ecd1e)){logger['debug'](_0x481c('0x38'),_0x5ecd1e[_0x481c('0x19')],util[_0x481c('0x1a')](_0x5ecd1e,{'showHidden':![],'depth':null}));this['addVariable'](_0x5ecd1e[_0x481c('0x19')],_[_0x481c('0x39')](_0x5ecd1e['variable'])[0x0],_0x5ecd1e['value']);if(this[_0x481c('0x18')](_0x5ecd1e[_0x481c('0x3a')])&&this[_0x481c('0x18')](_0x5ecd1e[_0x481c('0x3a')][_0x481c('0x3b')])){if(_[_0x481c('0x3c')](this[_0x481c('0x9')][_0x5ecd1e[_0x481c('0x19')]])){this[_0x481c('0x9')][_0x5ecd1e['uniqueid']]={'routeId':_0x5ecd1e[_0x481c('0x3d')],'variables':this['variables'][_0x5ecd1e[_0x481c('0x19')]]};logger[_0x481c('0x23')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x5ecd1e[_0x481c('0x19')],_0x5ecd1e[_0x481c('0x3a')][_0x481c('0x3b')],_[_0x481c('0x39')](_0x5ecd1e[_0x481c('0x3a')])[0x0],_0x5ecd1e['value']);logger[_0x481c('0x26')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x5ecd1e['uniqueid'],util['inspect'](this[_0x481c('0x9')][_0x5ecd1e['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0x481c('0x35'),_0x481c('0x29'),this[_0x481c('0x9')][_0x5ecd1e['uniqueid']]);}}}}catch(_0x4cd9c2){logger[_0x481c('0x36')](_0x481c('0x3e'),_0x5ecd1e[_0x481c('0x19')],util[_0x481c('0x1a')](_0x4cd9c2,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x481c('0x16')][_0x481c('0x3f')]=function(_0x2100a9,_0x5b7140,_0x3e8d1c){var _0x41500b=[_0x481c('0x40'),_0x481c('0x41'),_0x481c('0x42'),_0x481c('0x43'),_0x481c('0x44'),'rtpaudioqoslossbridged',_0x481c('0x45'),_0x481c('0x46'),'sipcallid',_0x481c('0x47'),_0x481c('0x48'),_0x481c('0x49'),_0x481c('0x4a'),'memberdynamic',_0x481c('0x4b'),_0x481c('0x4c'),_0x481c('0x24'),'memberpenalty',_0x481c('0x4d')];if(!_[_0x481c('0x4e')](_0x5b7140)&&!_[_0x481c('0x4f')](_0x41500b,_0x5b7140)){if(_[_0x481c('0x3c')](this[_0x481c('0xd')][_0x2100a9])){this[_0x481c('0xd')][_0x2100a9]={};}this[_0x481c('0xd')][_0x2100a9][_0x5b7140]=_0x3e8d1c;}};VoiceDialReport[_0x481c('0x16')][_0x481c('0x15')]=function(_0x3fb500){try{if(this['isNotNull'](_0x3fb500)){logger[_0x481c('0x26')](_0x481c('0x50'),_0x3fb500[_0x481c('0x19')],util[_0x481c('0x1a')](_0x3fb500,{'showHidden':![],'depth':null}));if(this[_0x481c('0x9')][_0x3fb500[_0x481c('0x19')]]){logger['info'](_0x481c('0x51'),_0x3fb500[_0x481c('0x19')],_0x3fb500[_0x481c('0x52')]);this[_0x481c('0x9')][_0x3fb500['uniqueid']][_0x481c('0x53')]=moment()['format'](_0x481c('0x1c'));this[_0x481c('0x9')][_0x3fb500['uniqueid']][_0x481c('0x54')]=moment(this[_0x481c('0x9')][_0x3fb500['uniqueid']][_0x481c('0x53')])[_0x481c('0x55')](this[_0x481c('0x9')][_0x3fb500['uniqueid']][_0x481c('0x56')],_0x481c('0x57'));this['channels'][_0x3fb500[_0x481c('0x19')]]['lastevent']='complete';this['outbound'][_0x481c('0x58')]+=0x1;if(this['channels'][_0x3fb500['uniqueid']][_0x481c('0x2f')]){this[_0x481c('0xb')][_0x481c('0x59')]+=0x1;this[_0x481c('0x9')][_0x3fb500[_0x481c('0x19')]][_0x481c('0x5a')]=moment(this['channels'][_0x3fb500[_0x481c('0x19')]][_0x481c('0x2f')])[_0x481c('0x55')](this[_0x481c('0x9')][_0x3fb500[_0x481c('0x19')]][_0x481c('0x56')],'seconds');this[_0x481c('0x9')][_0x3fb500[_0x481c('0x19')]][_0x481c('0x5b')]=moment(this['channels'][_0x3fb500['uniqueid']][_0x481c('0x53')])[_0x481c('0x55')](this[_0x481c('0x9')][_0x3fb500[_0x481c('0x19')]][_0x481c('0x2f')],'seconds');this[_0x481c('0xb')][_0x481c('0x5c')]+=this[_0x481c('0x9')][_0x3fb500[_0x481c('0x19')]][_0x481c('0x5a')]||0x0;this[_0x481c('0xb')][_0x481c('0x5d')]+=this['channels'][_0x3fb500[_0x481c('0x19')]][_0x481c('0x5b')];}this[_0x481c('0xb')][_0x481c('0x5e')]+=this[_0x481c('0x9')][_0x3fb500['uniqueid']]['duration'];logger[_0x481c('0x26')](_0x481c('0x5f'),_0x3fb500[_0x481c('0x19')],util[_0x481c('0x1a')](this[_0x481c('0x9')][_0x3fb500['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x481c('0x60'),this['channels'][_0x3fb500[_0x481c('0x19')]]);logger[_0x481c('0x26')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x3fb500[_0x481c('0x19')],util[_0x481c('0x1a')](this[_0x481c('0x9')][_0x3fb500[_0x481c('0x19')]],{'showHidden':![],'depth':null}));ami[_0x481c('0x28')](_0x481c('0x61'),this['channels'][_0x3fb500[_0x481c('0x19')]]);logger[_0x481c('0x26')](_0x481c('0x62'),_0x3fb500[_0x481c('0x19')],util['inspect'](this[_0x481c('0x9')][_0x3fb500[_0x481c('0x19')]],{'showHidden':![],'depth':null}));this['emit'](_0x481c('0x35'),_0x481c('0x63'),this['outbound']);logger['info'](_0x481c('0x64'),JSON[_0x481c('0x65')](this[_0x481c('0x9')][_0x3fb500[_0x481c('0x19')]]));logger[_0x481c('0x26')](_0x481c('0x66'),_0x3fb500[_0x481c('0x19')],util[_0x481c('0x1a')](this[_0x481c('0x9')][_0x3fb500['uniqueid']],{'showHidden':![],'depth':null}));this[_0x481c('0x28')]('voice:outbound',_0x481c('0x67'),this[_0x481c('0x9')][_0x3fb500['uniqueid']]);delete this[_0x481c('0x9')][_0x3fb500[_0x481c('0x19')]];}else if(this[_0x481c('0x9')][_0x3fb500[_0x481c('0x68')]]){this[_0x481c('0x9')][_0x3fb500[_0x481c('0x68')]][_0x481c('0x19')]=this[_0x481c('0x9')][_0x3fb500[_0x481c('0x68')]][_0x481c('0x69')];}if(this[_0x481c('0xd')][_0x3fb500[_0x481c('0x19')]]){delete this[_0x481c('0xd')][_0x3fb500[_0x481c('0x19')]];}}}catch(_0x35519d){logger['error'](_0x481c('0x6a'),_0x3fb500[_0x481c('0x19')],util[_0x481c('0x1a')](_0x35519d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x481c('0x16')][_0x481c('0x14')]=function(_0x2d3055){try{if(this['isNotNull'](_0x2d3055)){logger[_0x481c('0x26')](_0x481c('0x6b'),_0x2d3055[_0x481c('0x19')],util[_0x481c('0x1a')](_0x2d3055,{'showHidden':![],'depth':null}));if(_0x2d3055['application'][_0x481c('0x6c')]()===_0x481c('0x6d')){_0x2d3055[_0x481c('0x6e')]=(_0x2d3055[_0x481c('0x6f')]||_0x2d3055[_0x481c('0x6e')])['toLowerCase']();if(_['startsWith'](_0x2d3055[_0x481c('0x6e')],_0x481c('0x70'))){if(_[_0x481c('0x3c')](this['applications'][_0x2d3055['uniqueid']]))this[_0x481c('0xc')][_0x2d3055[_0x481c('0x19')]]={};logger['info'](_0x481c('0x71'),_0x2d3055['uniqueid'],_0x2d3055[_0x481c('0x72')],_0x2d3055[_0x481c('0x6e')]);var _0x25e850=_0x2d3055[_0x481c('0x6e')][_0x481c('0x73')]('=');var _0x2a2514=_0x25e850[0x0][_0x481c('0x74')](/cdr\((.*)\)/);if(_0x2a2514)this[_0x481c('0xc')][_0x2d3055[_0x481c('0x19')]][_0x2a2514[0x1]]=_0x25e850[0x1];}}}}catch(_0xa120b7){logger[_0x481c('0x36')]('[%s][voiceDialReport][newexten]',_0x2d3055[_0x481c('0x19')],util[_0x481c('0x1a')](_0xa120b7,{'showHidden':![],'depth':null}));}};module[_0x481c('0x75')]=VoiceDialReport; \ No newline at end of file +var _0x0012=['outbound','applications','dialbegin','syncDialBegin','bind','syncDialEnd','varset','syncVarSet','newexten','syncNewExten','hangup','syncHangup','isNotNull','isUndefined','prototype','emit','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','omit','info','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','error','[%s][voiceDialReport][dialbegin]','dialstatus','connectedlinenum','connectedlinename','answertime','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','addVariable','keys','variable','value','outboundrouteid','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','bridgepeer','membercalls','memberdynamic','memberpenalty','includes','variables','[%s][voiceDialReport][hangup]\x20event:','cause-txt','duration','endtime','diff','starttime','seconds','lastevent','complete','answered','billableseconds','sumHoldTime','holdtime','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','set','applicationdata','appdata','toLowerCase','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','match','exports','lodash','moment','ioredis','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','channels'];(function(_0x5c3179,_0x5272f2){var _0x525863=function(_0x17afbc){while(--_0x17afbc){_0x5c3179['push'](_0x5c3179['shift']());}};_0x525863(++_0x5272f2);}(_0x0012,0x1f4));var _0x2001=function(_0x536e31,_0x8101da){_0x536e31=_0x536e31-0x0;var _0x2b23bb=_0x0012[_0x536e31];return _0x2b23bb;};'use strict';var _=require(_0x2001('0x0'));var moment=require(_0x2001('0x1'));var util=require('util');var Redis=require(_0x2001('0x2'));var config=require('../../../config/environment');var logger=require(_0x2001('0x3'))(_0x2001('0x4'));var ami=require('../ami');config[_0x2001('0x5')]=_[_0x2001('0x6')](config[_0x2001('0x5')],{'host':_0x2001('0x7'),'port':0x18eb});var io=require(_0x2001('0x8'))(new Redis(config['redis']));function VoiceDialReport(_0x3a3b56){this[_0x2001('0x9')]=_0x3a3b56['outboundChannels'];this[_0x2001('0xa')]=_0x3a3b56[_0x2001('0xa')];this[_0x2001('0xb')]={};this['variables']={};ami['on'](_0x2001('0xc'),this[_0x2001('0xd')][_0x2001('0xe')](this));ami['on']('dialend',this[_0x2001('0xf')][_0x2001('0xe')](this));ami['on'](_0x2001('0x10'),this[_0x2001('0x11')][_0x2001('0xe')](this));ami['on'](_0x2001('0x12'),this[_0x2001('0x13')]['bind'](this));ami['on'](_0x2001('0x14'),this[_0x2001('0x15')][_0x2001('0xe')](this));}VoiceDialReport['prototype'][_0x2001('0x16')]=function(_0x3f72d0){return _0x3f72d0!==null&&!_[_0x2001('0x17')](_0x3f72d0);};VoiceDialReport[_0x2001('0x18')][_0x2001('0x19')]=function(_0x182ab5,_0x5637eb,_0xad73b6){io['to'](_0x182ab5)[_0x2001('0x19')](_0x5637eb,_0xad73b6);};VoiceDialReport['prototype']['syncDialBegin']=function(_0x394c8c){try{if(this['isNotNull'](_0x394c8c)){logger['debug'](_0x2001('0x1a'),_0x394c8c[_0x2001('0x1b')],util[_0x2001('0x1c')](_0x394c8c,{'showHidden':![],'depth':null}));if(this['channels'][_0x394c8c[_0x2001('0x1b')]]){_[_0x2001('0x1d')](this[_0x2001('0x9')][_0x394c8c[_0x2001('0x1b')]],{'starttime':moment()[_0x2001('0x1e')](_0x2001('0x1f')),'lastevent':'called','interface':_0x394c8c[_0x2001('0x20')][_0x2001('0x21')](0x0,_0x394c8c[_0x2001('0x20')][_0x2001('0x22')]('-')),'membername':_0x394c8c[_0x2001('0x20')]['substring'](_0x394c8c[_0x2001('0x20')]['lastIndexOf']('/')+0x1,_0x394c8c[_0x2001('0x20')]['lastIndexOf']('-'))},_[_0x2001('0x23')](_0x394c8c,['event','privilege']));logger[_0x2001('0x24')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x394c8c['uniqueid'],this[_0x2001('0x9')][_0x394c8c[_0x2001('0x1b')]][_0x2001('0x25')],this['channels'][_0x394c8c['uniqueid']][_0x2001('0x26')]);logger['debug'](_0x2001('0x27'),_0x394c8c[_0x2001('0x1b')],util[_0x2001('0x1c')](this[_0x2001('0x9')][_0x394c8c[_0x2001('0x1b')]],{'showHidden':![],'depth':null}));if(this[_0x2001('0xb')][_0x394c8c['uniqueid']])_[_0x2001('0x1d')](this[_0x2001('0x9')][_0x394c8c[_0x2001('0x1b')]],this['applications'][_0x394c8c[_0x2001('0x1b')]]);this['emit']('voice:outbound',_0x2001('0x28'),this[_0x2001('0x9')][_0x394c8c[_0x2001('0x1b')]]);logger[_0x2001('0x29')](_0x2001('0x2a'),_0x394c8c[_0x2001('0x1b')],util[_0x2001('0x1c')](this[_0x2001('0x9')][_0x394c8c[_0x2001('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x2001('0x19')]('custom:dialbegin',this[_0x2001('0x9')][_0x394c8c[_0x2001('0x1b')]]);}}}catch(_0x26cf40){logger[_0x2001('0x2b')](_0x2001('0x2c'),_0x394c8c[_0x2001('0x1b')],util['inspect'](_0x26cf40,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x2001('0x18')][_0x2001('0xf')]=function(_0x3583aa){try{if(this[_0x2001('0x16')](_0x3583aa)){logger[_0x2001('0x29')]('[%s][voiceDialReport][dialend]\x20event:',_0x3583aa[_0x2001('0x1b')],util['inspect'](_0x3583aa,{'showHidden':![],'depth':null}));if(this['channels'][_0x3583aa[_0x2001('0x1b')]]){this['channels'][_0x3583aa[_0x2001('0x1b')]]['dialstatus']=_0x3583aa['dialstatus'];if(_0x3583aa[_0x2001('0x2d')]==='ANSWER'){this[_0x2001('0x9')][_0x3583aa[_0x2001('0x1b')]]['connectedlinenum']=_0x3583aa[_0x2001('0x2e')];this[_0x2001('0x9')][_0x3583aa[_0x2001('0x1b')]][_0x2001('0x2f')]=_0x3583aa[_0x2001('0x2f')];this[_0x2001('0x9')][_0x3583aa['uniqueid']][_0x2001('0x30')]=moment()['format'](_0x2001('0x1f'));this['channels'][_0x3583aa[_0x2001('0x1b')]]['lastevent']='connect';logger[_0x2001('0x24')](_0x2001('0x31'),_0x3583aa[_0x2001('0x1b')],_0x3583aa[_0x2001('0x20')][_0x2001('0x21')](_0x3583aa[_0x2001('0x20')][_0x2001('0x22')]('/')+0x1,_0x3583aa['channel'][_0x2001('0x22')]('-')));logger[_0x2001('0x29')](_0x2001('0x32'),_0x3583aa[_0x2001('0x1b')],util[_0x2001('0x1c')](this['channels'][_0x3583aa['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x2001('0x19')](_0x2001('0x33'),this[_0x2001('0x9')][_0x3583aa[_0x2001('0x1b')]]);}logger[_0x2001('0x29')](_0x2001('0x34'),_0x3583aa[_0x2001('0x1b')],util[_0x2001('0x1c')](this['channels'][_0x3583aa['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0x2001('0x35'),_0x2001('0x28'),this[_0x2001('0x9')][_0x3583aa[_0x2001('0x1b')]]);}}}catch(_0x5c407b){logger[_0x2001('0x2b')]('[%s][voiceDialReport][dialend]',_0x3583aa[_0x2001('0x1b')],util[_0x2001('0x1c')](_0x5c407b,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x2001('0x11')]=function(_0x3207ac){try{if(this['isNotNull'](_0x3207ac)){logger[_0x2001('0x29')]('[%s][voiceDialReport][varset]\x20event:',_0x3207ac['uniqueid'],util[_0x2001('0x1c')](_0x3207ac,{'showHidden':![],'depth':null}));this[_0x2001('0x36')](_0x3207ac[_0x2001('0x1b')],_[_0x2001('0x37')](_0x3207ac[_0x2001('0x38')])[0x0],_0x3207ac[_0x2001('0x39')]);if(this['isNotNull'](_0x3207ac[_0x2001('0x38')])&&this[_0x2001('0x16')](_0x3207ac[_0x2001('0x38')][_0x2001('0x3a')])){if(_[_0x2001('0x17')](this['channels'][_0x3207ac['uniqueid']])){this['channels'][_0x3207ac['uniqueid']]={'routeId':_0x3207ac[_0x2001('0x39')],'variables':this['variables'][_0x3207ac[_0x2001('0x1b')]]};logger[_0x2001('0x24')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x3207ac['uniqueid'],_0x3207ac[_0x2001('0x38')][_0x2001('0x3a')],_[_0x2001('0x37')](_0x3207ac[_0x2001('0x38')])[0x0],_0x3207ac[_0x2001('0x39')]);logger[_0x2001('0x29')](_0x2001('0x3b'),_0x3207ac[_0x2001('0x1b')],util['inspect'](this['channels'][_0x3207ac[_0x2001('0x1b')]],{'showHidden':![],'depth':null}));this[_0x2001('0x19')](_0x2001('0x35'),_0x2001('0x28'),this[_0x2001('0x9')][_0x3207ac[_0x2001('0x1b')]]);}}}}catch(_0x374c96){logger[_0x2001('0x2b')]('[%s][voiceDialReport][varset]',_0x3207ac[_0x2001('0x1b')],util[_0x2001('0x1c')](_0x374c96,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x2001('0x18')][_0x2001('0x36')]=function(_0x2b7b90,_0x4003a8,_0x2d3ecf){var _0x1737e0=[_0x2001('0x3c'),'rtpaudioqosbridged',_0x2001('0x3d'),_0x2001('0x3e'),_0x2001('0x3f'),'rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri',_0x2001('0x40'),'bridgepvtcallid',_0x2001('0x41'),_0x2001('0x42'),'memberinterface','memberlastcall',_0x2001('0x25'),_0x2001('0x43'),'memberrealtime'];if(!_['isNil'](_0x4003a8)&&!_[_0x2001('0x44')](_0x1737e0,_0x4003a8)){if(_[_0x2001('0x17')](this[_0x2001('0x45')][_0x2b7b90])){this[_0x2001('0x45')][_0x2b7b90]={};}this['variables'][_0x2b7b90][_0x4003a8]=_0x2d3ecf;}};VoiceDialReport[_0x2001('0x18')][_0x2001('0x15')]=function(_0x533cd5){try{if(this[_0x2001('0x16')](_0x533cd5)){logger['debug'](_0x2001('0x46'),_0x533cd5[_0x2001('0x1b')],util[_0x2001('0x1c')](_0x533cd5,{'showHidden':![],'depth':null}));if(this[_0x2001('0x9')][_0x533cd5['uniqueid']]){logger[_0x2001('0x24')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x533cd5[_0x2001('0x1b')],_0x533cd5[_0x2001('0x47')]);this['channels'][_0x533cd5['uniqueid']]['endtime']=moment()[_0x2001('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x2001('0x9')][_0x533cd5[_0x2001('0x1b')]][_0x2001('0x48')]=moment(this[_0x2001('0x9')][_0x533cd5['uniqueid']][_0x2001('0x49')])[_0x2001('0x4a')](this[_0x2001('0x9')][_0x533cd5['uniqueid']][_0x2001('0x4b')],_0x2001('0x4c'));this[_0x2001('0x9')][_0x533cd5[_0x2001('0x1b')]][_0x2001('0x4d')]=_0x2001('0x4e');this[_0x2001('0xa')]['total']+=0x1;if(this['channels'][_0x533cd5[_0x2001('0x1b')]][_0x2001('0x30')]){this[_0x2001('0xa')][_0x2001('0x4f')]+=0x1;this[_0x2001('0x9')][_0x533cd5[_0x2001('0x1b')]]['holdtime']=moment(this[_0x2001('0x9')][_0x533cd5[_0x2001('0x1b')]][_0x2001('0x30')])[_0x2001('0x4a')](this[_0x2001('0x9')][_0x533cd5[_0x2001('0x1b')]][_0x2001('0x4b')],_0x2001('0x4c'));this['channels'][_0x533cd5[_0x2001('0x1b')]][_0x2001('0x50')]=moment(this[_0x2001('0x9')][_0x533cd5[_0x2001('0x1b')]][_0x2001('0x49')])[_0x2001('0x4a')](this[_0x2001('0x9')][_0x533cd5['uniqueid']][_0x2001('0x30')],_0x2001('0x4c'));this['outbound'][_0x2001('0x51')]+=this[_0x2001('0x9')][_0x533cd5[_0x2001('0x1b')]][_0x2001('0x52')]||0x0;this['outbound']['sumBillable']+=this['channels'][_0x533cd5[_0x2001('0x1b')]][_0x2001('0x50')];}this['outbound']['sumDuration']+=this[_0x2001('0x9')][_0x533cd5[_0x2001('0x1b')]][_0x2001('0x48')];logger[_0x2001('0x29')](_0x2001('0x53'),_0x533cd5[_0x2001('0x1b')],util[_0x2001('0x1c')](this[_0x2001('0x9')][_0x533cd5[_0x2001('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x2001('0x19')](_0x2001('0x54'),this[_0x2001('0x9')][_0x533cd5[_0x2001('0x1b')]]);logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x533cd5[_0x2001('0x1b')],util[_0x2001('0x1c')](this[_0x2001('0x9')][_0x533cd5['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x2001('0x19')](_0x2001('0x55'),this['channels'][_0x533cd5[_0x2001('0x1b')]]);logger[_0x2001('0x29')](_0x2001('0x56'),_0x533cd5[_0x2001('0x1b')],util[_0x2001('0x1c')](this[_0x2001('0x9')][_0x533cd5[_0x2001('0x1b')]],{'showHidden':![],'depth':null}));this['emit'](_0x2001('0x35'),_0x2001('0x57'),this['outbound']);logger[_0x2001('0x24')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON['stringify'](this[_0x2001('0x9')][_0x533cd5[_0x2001('0x1b')]]));logger[_0x2001('0x29')](_0x2001('0x58'),_0x533cd5[_0x2001('0x1b')],util[_0x2001('0x1c')](this[_0x2001('0x9')][_0x533cd5[_0x2001('0x1b')]],{'showHidden':![],'depth':null}));this[_0x2001('0x19')](_0x2001('0x35'),_0x2001('0x59'),this['channels'][_0x533cd5['uniqueid']]);delete this['channels'][_0x533cd5[_0x2001('0x1b')]];}else if(this['channels'][_0x533cd5[_0x2001('0x5a')]]){this[_0x2001('0x9')][_0x533cd5[_0x2001('0x5a')]][_0x2001('0x1b')]=this['channels'][_0x533cd5['linkedid']][_0x2001('0x5b')];}if(this['variables'][_0x533cd5[_0x2001('0x1b')]]){delete this[_0x2001('0x45')][_0x533cd5[_0x2001('0x1b')]];}}}catch(_0x1bdbe6){logger[_0x2001('0x2b')](_0x2001('0x5c'),_0x533cd5[_0x2001('0x1b')],util[_0x2001('0x1c')](_0x1bdbe6,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x2001('0x18')]['syncNewExten']=function(_0x58d5e9){try{if(this['isNotNull'](_0x58d5e9)){logger[_0x2001('0x29')](_0x2001('0x5d'),_0x58d5e9[_0x2001('0x1b')],util[_0x2001('0x1c')](_0x58d5e9,{'showHidden':![],'depth':null}));if(_0x58d5e9['application']['toLowerCase']()===_0x2001('0x5e')){_0x58d5e9[_0x2001('0x5f')]=(_0x58d5e9[_0x2001('0x60')]||_0x58d5e9[_0x2001('0x5f')])[_0x2001('0x61')]();if(_['startsWith'](_0x58d5e9['applicationdata'],_0x2001('0x62'))){if(_[_0x2001('0x17')](this[_0x2001('0xb')][_0x58d5e9['uniqueid']]))this[_0x2001('0xb')][_0x58d5e9[_0x2001('0x1b')]]={};logger[_0x2001('0x24')](_0x2001('0x63'),_0x58d5e9[_0x2001('0x1b')],_0x58d5e9['application'],_0x58d5e9[_0x2001('0x5f')]);var _0x490265=_0x58d5e9[_0x2001('0x5f')]['split']('=');var _0x26da82=_0x490265[0x0][_0x2001('0x64')](/cdr\((.*)\)/);if(_0x26da82)this[_0x2001('0xb')][_0x58d5e9['uniqueid']][_0x26da82[0x1]]=_0x490265[0x1];}}}}catch(_0x19b5fc){logger[_0x2001('0x2b')]('[%s][voiceDialReport][newexten]',_0x58d5e9[_0x2001('0x1b')],util[_0x2001('0x1c')](_0x19b5fc,{'showHidden':![],'depth':null}));}};module[_0x2001('0x65')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 54d6a55..3cfb6fc 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1b9=['keys','[%s][voiceQueueReport][queuecallerjoin]','[%s][voiceQueueReport][queuecallerabandon]','holdtime','originalposition','queuecallerabandon','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitreason','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','last','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','queuecallerleave','[%s][voiceQueueReport][agentconnect]','queuecallercomplete','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','membername','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','linkedid','add','seconds','transfertype','FORWARD','transferexten','destexten','transferuniqueid','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','addVariable','variable','queuestatus','value','CONTINUE','TIMEOUT','lastevent','timeout','custom:timeout','queueposition','EXITWITHKEY','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','includes','[%s][voiceQueueReport][hangup]','length','sumHoldTime','diff','sumDuration','milliseconds','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][blindtransfer]','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','set','appdata','applicationdata','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','match','[%s][voiceQueueReport][newexten]','exports','lodash','util','md5','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','enqueue','tail','sequence','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','syncQueueCallerAbandon','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','newexten','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','clearZombieChannels','switch','isNil','Action','status','channel','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','prototype','[FullyBooted]\x20clear\x20realtime','clearQueueReport','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][','uniqueid','format','voice:queue:%s','name','voice_queue_channel:save','voice_queue_presence:save','emitVoiceQueueChannelRemove',']\x20sending\x20voice_queue_channel:remove\x20event:','voice_queue_channel:remove','voice_queue_presence:remove','type','inbound','strategy','answered','available','loggedIn','sumBillable','total','unmanaged','abandoned','Trunk','active','Interval','stringify',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','isUndefined','loopQueueShow','queues','catch','[voiceQueueReport][queues]','then','[voiceQueueReport][queuesummary]','queue','[voiceQueueReport][queuesummary]\x20event:','info','[voiceQueueReport][queuesummary]\x20name:%s','countBy','callers','toNumber','loggedin','emitVoiceQueueSummary','custom:queuesummary','[voiceQueueReport][queuesummarycomplete]\x20event:','queuecallerjoinAt','position','count','routealias','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick'];(function(_0x40753c,_0x14d296){var _0x50b54c=function(_0x3ac623){while(--_0x3ac623){_0x40753c['push'](_0x40753c['shift']());}};_0x50b54c(++_0x14d296);}(_0xa1b9,0x71));var _0x9a1b=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa1b9[_0x2160a9];return _0xa88cf7;};'use strict';var _=require(_0x9a1b('0x0'));var moment=require('moment');var util=require(_0x9a1b('0x1'));var md5=require(_0x9a1b('0x2'));var Redis=require(_0x9a1b('0x3'));var config=require(_0x9a1b('0x4'));var logger=require(_0x9a1b('0x5'))(_0x9a1b('0x6'));var ami=require(_0x9a1b('0x7'));var QueueReport=require('../model/queueReport');config[_0x9a1b('0x8')]=_[_0x9a1b('0x9')](config[_0x9a1b('0x8')],{'host':_0x9a1b('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9a1b('0x8')]));var Sequence=function(){};Sequence['prototype'][_0x9a1b('0xb')]=function(_0x4387ac){this[_0x9a1b('0xc')]=this[_0x9a1b('0xc')]?this[_0x9a1b('0xc')]['finally'](_0x4387ac):_0x4387ac();};function VoiceQueueReport(_0x787b9b){this[_0x9a1b('0xd')]=new Sequence();this[_0x9a1b('0xe')]={};this[_0x9a1b('0xf')]=_0x787b9b[_0x9a1b('0xf')];this[_0x9a1b('0x10')]=_0x787b9b[_0x9a1b('0x11')];this['voiceQueues']=_0x787b9b[_0x9a1b('0x12')];this[_0x9a1b('0x13')]=!![];this[_0x9a1b('0x14')]=_0x787b9b['campaigns'];this[_0x9a1b('0x15')]={};ami['on'](_0x9a1b('0x16'),this[_0x9a1b('0x17')][_0x9a1b('0x18')](this));ami['on'](_0x9a1b('0x19'),this[_0x9a1b('0x1a')][_0x9a1b('0x18')](this));ami['on'](_0x9a1b('0x1b'),this[_0x9a1b('0x1c')][_0x9a1b('0x18')](this));ami['on']('queuecallerabandon',this[_0x9a1b('0x1d')][_0x9a1b('0x18')](this));ami['on']('queuecallerleave',this[_0x9a1b('0x1e')][_0x9a1b('0x18')](this));ami['on'](_0x9a1b('0x1f'),this[_0x9a1b('0x20')][_0x9a1b('0x18')](this));ami['on'](_0x9a1b('0x21'),this[_0x9a1b('0x22')]['bind'](this));ami['on'](_0x9a1b('0x23'),this[_0x9a1b('0x24')][_0x9a1b('0x18')](this));ami['on'](_0x9a1b('0x25'),this[_0x9a1b('0x26')]['bind'](this));ami['on'](_0x9a1b('0x27'),this[_0x9a1b('0x28')][_0x9a1b('0x18')](this));ami['on'](_0x9a1b('0x29'),this['syncNewExten'][_0x9a1b('0x18')](this));ami['on'](_0x9a1b('0x2a'),this[_0x9a1b('0x2b')][_0x9a1b('0x18')](this));ami['on'](_0x9a1b('0x2c'),this[_0x9a1b('0x2d')][_0x9a1b('0x18')](this));ami['on'](_0x9a1b('0x2e'),this[_0x9a1b('0x2f')][_0x9a1b('0x18')](this));ami['on'](_0x9a1b('0x30'),this[_0x9a1b('0x31')][_0x9a1b('0x18')](this));this[_0x9a1b('0x32')]();this['loopQueueShow']();}function clearChannels(_0x5cf12d){if(!_[_0x9a1b('0x33')](_0x5cf12d)){for(var _0x52fce9 in _0x5cf12d){if(_0x5cf12d[_0x9a1b('0x34')](_0x52fce9)){delete _0x5cf12d[_0x52fce9];}}}}function clearCampaigns(_0x4a461e){if(!_['isEmpty'](_0x4a461e)){for(var _0x48e736 in _0x4a461e){if(_0x4a461e[_0x9a1b('0x34')](_0x48e736)){_0x4a461e[_0x48e736]['originated']=0x0;}}}}function clearVoiceQueues(_0x2bd6b3){if(!_[_0x9a1b('0x33')](_0x2bd6b3)){for(var _0x4983f6 in _0x2bd6b3){if(_0x2bd6b3[_0x9a1b('0x34')](_0x4983f6)){_0x2bd6b3[_0x4983f6][_0x9a1b('0x35')]=0x0;_0x2bd6b3[_0x4983f6][_0x9a1b('0x36')]=0x0;_0x2bd6b3[_0x4983f6][_0x9a1b('0x37')]=0x0;_0x2bd6b3[_0x4983f6][_0x9a1b('0x38')]=0x0;_0x2bd6b3[_0x4983f6][_0x9a1b('0x39')]=!![];}}}}function clearAgentBooked(_0x2d9ca8){if(!_['isEmpty'](_0x2d9ca8)){for(var _0x5735a4 in _0x2d9ca8){if(_0x2d9ca8[_0x9a1b('0x34')](_0x5735a4)){_0x2d9ca8[_0x5735a4][_0x9a1b('0x3a')]=!![];}}}}VoiceQueueReport['prototype'][_0x9a1b('0x3b')]=function(){var _0x43c2e7=this;for(var _0x4028f0 in this[_0x9a1b('0x10')]){if(this[_0x9a1b('0x10')][_0x9a1b('0x34')](_0x4028f0)&&!this[_0x9a1b('0x10')][_0x4028f0][_0x9a1b('0x3c')]){this[_0x9a1b('0xd')]['enqueue'](function(){if(!_[_0x9a1b('0x3d')](_0x43c2e7['channels'][_0x4028f0])){return ami[_0x9a1b('0x3e')]({'action':_0x9a1b('0x3f'),'channel':_0x43c2e7[_0x9a1b('0x10')][_0x4028f0][_0x9a1b('0x40')]})['catch'](function(_0xfc101c){if(_0xfc101c[_0x9a1b('0x41')]===_0x9a1b('0x42')){setTimeout(function(){if(_0x43c2e7[_0x9a1b('0x10')][_0x4028f0]){delete _0x43c2e7[_0x9a1b('0x10')][_0x4028f0];logger[_0x9a1b('0x43')](_0x9a1b('0x44'),_0x4028f0,util[_0x9a1b('0x45')](_0xfc101c,{'showHidden':![],'depth':null}));}if(_0x43c2e7[_0x9a1b('0xe')][_0x4028f0]){delete _0x43c2e7['queueReports'][_0x4028f0];logger[_0x9a1b('0x43')](_0x9a1b('0x46'),_0x4028f0,util[_0x9a1b('0x45')](_0xfc101c,{'showHidden':![],'depth':null}));}if(_0x43c2e7[_0x9a1b('0x15')][_0x4028f0]){delete _0x43c2e7[_0x9a1b('0x15')][_0x4028f0];logger[_0x9a1b('0x43')](_0x9a1b('0x47'),_0x4028f0,util['inspect'](_0xfc101c,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x9a1b('0x48')][_0x9a1b('0x28')]=function(){logger[_0x9a1b('0x43')](_0x9a1b('0x49'));clearChannels(this[_0x9a1b('0x10')]);this[_0x9a1b('0x4a')](this[_0x9a1b('0xe')]);clearAgentBooked(this[_0x9a1b('0xf')]);clearVoiceQueues(this[_0x9a1b('0x12')]);clearCampaigns(this['campaigns']);};VoiceQueueReport[_0x9a1b('0x48')][_0x9a1b('0x4a')]=function(_0x527449){var _0x1420be=this;if(!_[_0x9a1b('0x33')](_0x527449)){for(var _0x4ea8e3 in _0x527449){if(_0x527449['hasOwnProperty'](_0x4ea8e3)){_0x1420be['emitVoiceQueueChannelRemove'](_0x527449[_0x4ea8e3],_0x9a1b('0x4b'));delete _0x527449[_0x4ea8e3];}}}};VoiceQueueReport[_0x9a1b('0x48')][_0x9a1b('0x4c')]=function(_0x3f6a4e,_0x36528e,_0x4cdffd){io['to'](_0x3f6a4e)[_0x9a1b('0x4c')](_0x36528e,_0x4cdffd);};VoiceQueueReport[_0x9a1b('0x48')][_0x9a1b('0x4d')]=function(_0x383003,_0x383fae){logger[_0x9a1b('0x4e')](_0x9a1b('0x4f')+_0x383fae+']\x20sending\x20voice_queue_channel:save\x20event:',_0x383003[_0x9a1b('0x50')],util[_0x9a1b('0x45')](_0x383003,{'showHidden':![],'depth':null}));this['emit'](util[_0x9a1b('0x51')](_0x9a1b('0x52'),_0x383003[_0x9a1b('0x53')]),_0x9a1b('0x54'),_0x383003);io['emit'](_0x9a1b('0x55'),_0x383003);};VoiceQueueReport[_0x9a1b('0x48')][_0x9a1b('0x56')]=function(_0x3ddcf6,_0x1863d8){logger[_0x9a1b('0x4e')]('[%s][voiceQueueReport]['+_0x1863d8+_0x9a1b('0x57'),_0x3ddcf6[_0x9a1b('0x50')],util[_0x9a1b('0x45')](_0x3ddcf6,{'showHidden':![],'depth':null}));this['emit'](util[_0x9a1b('0x51')](_0x9a1b('0x52'),_0x3ddcf6[_0x9a1b('0x53')]),_0x9a1b('0x58'),_0x3ddcf6);io[_0x9a1b('0x4c')](_0x9a1b('0x59'),_0x3ddcf6);};VoiceQueueReport[_0x9a1b('0x48')]['emitVoiceQueueSummary']=function(_0x3e0fed,_0x2ae100){if(_0x3e0fed[_0x9a1b('0x5a')]===_0x9a1b('0x5b')){var _0x4f067b={'id':_0x3e0fed['id'],'name':_0x3e0fed[_0x9a1b('0x53')],'strategy':_0x3e0fed[_0x9a1b('0x5c')],'answered':_0x3e0fed[_0x9a1b('0x5d')],'available':_0x3e0fed[_0x9a1b('0x5e')],'loggedIn':_0x3e0fed[_0x9a1b('0x5f')],'pTalking':_0x3e0fed[_0x9a1b('0x37')],'sumBillable':_0x3e0fed[_0x9a1b('0x60')],'sumDuration':_0x3e0fed['sumDuration'],'sumHoldTime':_0x3e0fed['sumHoldTime']||0x0,'talking':_0x3e0fed[_0x9a1b('0x36')],'total':_0x3e0fed[_0x9a1b('0x61')],'type':_0x3e0fed['type'],'unmanaged':_0x3e0fed[_0x9a1b('0x62')],'abandoned':_0x3e0fed[_0x9a1b('0x63')],'waiting':_0x3e0fed[_0x9a1b('0x38')]};if(_0x3e0fed['Trunk']){_0x4f067b['Trunk']={'id':_0x3e0fed['Trunk']['id'],'name':_0x3e0fed[_0x9a1b('0x64')][_0x9a1b('0x53')],'active':_0x3e0fed['Trunk'][_0x9a1b('0x65')],'callerid':_0x3e0fed[_0x9a1b('0x64')]['callerid']};}if(_0x3e0fed['Interval']){_0x4f067b[_0x9a1b('0x66')]={'id':_0x3e0fed[_0x9a1b('0x66')]['id'],'name':_0x3e0fed['Interval'][_0x9a1b('0x53')]};}var _0x258bae=md5(JSON[_0x9a1b('0x67')](_0x4f067b));if(_0x3e0fed[_0x9a1b('0x2')]!==_0x258bae){_0x3e0fed['md5']=_0x258bae;logger['debug']('[voiceQueueReport]['+_0x2ae100+_0x9a1b('0x68'),util[_0x9a1b('0x45')](_0x4f067b,{'showHidden':![],'depth':null}));this[_0x9a1b('0x4c')](util[_0x9a1b('0x51')](_0x9a1b('0x52'),_0x4f067b[_0x9a1b('0x53')]),_0x9a1b('0x69'),_0x4f067b);}}};VoiceQueueReport[_0x9a1b('0x48')][_0x9a1b('0x6a')]=function(_0x6c627f){return _0x6c627f!==null&&!_[_0x9a1b('0x6b')](_0x6c627f);};VoiceQueueReport[_0x9a1b('0x48')][_0x9a1b('0x6c')]=function(){var _0x2bc22a=this;setInterval(function(){_0x2bc22a['clearZombieChannels']();ami['Action']({'action':_0x9a1b('0x6d')})[_0x9a1b('0x6e')](function(_0x25bf42){logger[_0x9a1b('0x43')](_0x9a1b('0x6f'),util[_0x9a1b('0x45')](_0x25bf42,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x9a1b('0x48')][_0x9a1b('0x32')]=function(){var _0x37d4fa=this;setInterval(function(){if(_0x37d4fa['flagQueueSummary']){return ami[_0x9a1b('0x3e')]({'action':_0x9a1b('0x16')})[_0x9a1b('0x70')](function(_0x4718dc){_0x37d4fa['flagQueueSummary']=![];})[_0x9a1b('0x6e')](function(_0x3e240b){logger['error'](_0x9a1b('0x71'),util['inspect'](_0x3e240b,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype'][_0x9a1b('0x17')]=function(_0x160f22){try{if(this[_0x9a1b('0x6a')](_0x160f22)&&this['isNotNull'](_0x160f22[_0x9a1b('0x72')])){logger[_0x9a1b('0x4e')](_0x9a1b('0x73'),util[_0x9a1b('0x45')](_0x160f22,{'showHidden':![],'depth':null}));if(this[_0x9a1b('0x12')][_0x160f22[_0x9a1b('0x72')]]){logger[_0x9a1b('0x74')](_0x9a1b('0x75'),_0x160f22[_0x9a1b('0x72')]);var _0x3f2894=_[_0x9a1b('0x76')](this[_0x9a1b('0x10')],_0x9a1b('0x72'))[_0x160f22[_0x9a1b('0x72')]]||0x0;var _0x12edea=_0x3f2894-_0x160f22[_0x9a1b('0x77')];if(this[_0x9a1b('0x12')][_0x160f22[_0x9a1b('0x72')]][_0x9a1b('0x38')]!==_[_0x9a1b('0x78')](_0x160f22[_0x9a1b('0x77')])||this[_0x9a1b('0x12')][_0x160f22[_0x9a1b('0x72')]]['loggedIn']!==_[_0x9a1b('0x78')](_0x160f22[_0x9a1b('0x79')])||this['voiceQueues'][_0x160f22[_0x9a1b('0x72')]][_0x9a1b('0x5e')]!==_[_0x9a1b('0x78')](_0x160f22[_0x9a1b('0x5e')])||this['voiceQueues'][_0x160f22[_0x9a1b('0x72')]][_0x9a1b('0x36')]!==_0x12edea){this['voiceQueues'][_0x160f22[_0x9a1b('0x72')]][_0x9a1b('0x38')]=_['toNumber'](_0x160f22[_0x9a1b('0x77')]);this[_0x9a1b('0x12')][_0x160f22['queue']][_0x9a1b('0x5f')]=_['toNumber'](_0x160f22[_0x9a1b('0x79')]);this[_0x9a1b('0x12')][_0x160f22[_0x9a1b('0x72')]][_0x9a1b('0x5e')]=_['toNumber'](_0x160f22[_0x9a1b('0x5e')]);this[_0x9a1b('0x12')][_0x160f22[_0x9a1b('0x72')]][_0x9a1b('0x36')]=_0x12edea>0x0?_0x12edea:0x0;this['voiceQueues'][_0x160f22[_0x9a1b('0x72')]][_0x9a1b('0x36')]=this[_0x9a1b('0x12')][_0x160f22['queue']][_0x9a1b('0x36')]>_['toNumber'](_0x160f22['loggedin'])?_['toNumber'](_0x160f22[_0x9a1b('0x79')]):this['voiceQueues'][_0x160f22[_0x9a1b('0x72')]][_0x9a1b('0x36')];this[_0x9a1b('0x7a')](this[_0x9a1b('0x12')][_0x160f22['queue']],_0x9a1b('0x16'));}logger[_0x9a1b('0x4e')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0x9a1b('0x45')](this[_0x9a1b('0x12')][_0x160f22[_0x9a1b('0x72')]],{'showHidden':![],'depth':null}));ami['emit'](_0x9a1b('0x7b'),this[_0x9a1b('0x12')][_0x160f22[_0x9a1b('0x72')]]);}}}catch(_0xd6386e){logger[_0x9a1b('0x43')](_0x9a1b('0x71'),util[_0x9a1b('0x45')](_0xd6386e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0xf88235){logger[_0x9a1b('0x4e')](_0x9a1b('0x7c'),util[_0x9a1b('0x45')](_0xf88235,{'showHidden':![],'depth':null}));this[_0x9a1b('0x13')]=!![];};VoiceQueueReport[_0x9a1b('0x48')][_0x9a1b('0x1c')]=function(_0x3ad586){try{if(this[_0x9a1b('0x6a')](_0x3ad586)){logger[_0x9a1b('0x4e')]('[%s][voiceQueueReport][queuecallerjoin]',_0x3ad586[_0x9a1b('0x50')],util[_0x9a1b('0x45')](_0x3ad586,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['queueReports'][_0x3ad586[_0x9a1b('0x50')]]))this[_0x9a1b('0xe')][_0x3ad586['uniqueid']]=[];if(_['isUndefined'](this[_0x9a1b('0x10')][_0x3ad586[_0x9a1b('0x50')]]))this[_0x9a1b('0x10')][_0x3ad586[_0x9a1b('0x50')]]={};var _0x1c51c8=new QueueReport();_0x1c51c8[_0x9a1b('0x53')]=_0x3ad586[_0x9a1b('0x72')];_0x1c51c8[_0x9a1b('0x5a')]=this[_0x9a1b('0x12')][_0x1c51c8[_0x9a1b('0x53')]]&&this[_0x9a1b('0x12')][_0x1c51c8[_0x9a1b('0x53')]][_0x9a1b('0x5a')]?this[_0x9a1b('0x12')][_0x1c51c8[_0x9a1b('0x53')]][_0x9a1b('0x5a')]||_0x9a1b('0x5b'):_0x9a1b('0x5b');_0x1c51c8[_0x9a1b('0x72')]=_0x3ad586[_0x9a1b('0x72')];_0x1c51c8[_0x9a1b('0x7d')]=moment()[_0x9a1b('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x1c51c8[_0x9a1b('0x7e')]=_0x3ad586['position'];_0x1c51c8[_0x9a1b('0x7f')]=_0x3ad586['count'];_0x1c51c8[_0x9a1b('0x50')]=_0x3ad586[_0x9a1b('0x50')];_0x1c51c8[_0x9a1b('0x80')]=this[_0x9a1b('0x10')][_0x3ad586['uniqueid']][_0x9a1b('0x80')];logger['info'](_0x9a1b('0x81'),_0x1c51c8['name'],_0x1c51c8['type']);_['merge'](_0x1c51c8,_[_0x9a1b('0x82')](_0x3ad586,_[_0x9a1b('0x83')](_0x1c51c8)));this[_0x9a1b('0xe')][_0x3ad586[_0x9a1b('0x50')]]['push'](_0x1c51c8);this[_0x9a1b('0x10')][_0x3ad586['uniqueid']]=_0x1c51c8;this['emitVoiceQueueChannelSave'](_0x1c51c8,'queuecallerjoin');}}catch(_0x3c9b44){logger[_0x9a1b('0x43')](_0x9a1b('0x84'),_0x3ad586[_0x9a1b('0x50')],util[_0x9a1b('0x45')](_0x3c9b44,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9a1b('0x48')][_0x9a1b('0x1d')]=function(_0x2b79eb){try{if(this[_0x9a1b('0x6a')](_0x2b79eb)){logger['debug'](_0x9a1b('0x85'),_0x2b79eb[_0x9a1b('0x50')],util[_0x9a1b('0x45')](_0x2b79eb,{'showHidden':![],'depth':null}));if(this[_0x9a1b('0xe')][_0x2b79eb[_0x9a1b('0x50')]]){var _0x1b6591=_['last'](this[_0x9a1b('0xe')][_0x2b79eb[_0x9a1b('0x50')]]);_0x1b6591['queuecallercomplete']=![];_0x1b6591['queuecallercompleteAt']=null;_0x1b6591[_0x9a1b('0x86')]=_0x2b79eb[_0x9a1b('0x86')];_0x1b6591[_0x9a1b('0x87')]=_0x2b79eb[_0x9a1b('0x87')];_0x1b6591[_0x9a1b('0x88')]=!![];_0x1b6591[_0x9a1b('0x89')]=moment()[_0x9a1b('0x51')](_0x9a1b('0x8a'));_0x1b6591[_0x9a1b('0x8b')]='ABANDONED';_0x1b6591[_0x9a1b('0x8c')]=null;logger[_0x9a1b('0x74')](_0x9a1b('0x8d'),_0x1b6591[_0x9a1b('0x53')],_0x1b6591[_0x9a1b('0x5a')]);this[_0x9a1b('0x10')][_0x2b79eb[_0x9a1b('0x50')]]=_0x1b6591;this[_0x9a1b('0x56')](_0x1b6591,'queuecallerabandon');}}}catch(_0x359922){logger[_0x9a1b('0x43')](_0x9a1b('0x85'),_0x2b79eb['uniqueid'],util[_0x9a1b('0x45')](_0x359922,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9a1b('0x48')][_0x9a1b('0x1e')]=function(_0x474014){try{if(this[_0x9a1b('0x6a')](_0x474014)){logger[_0x9a1b('0x4e')](_0x9a1b('0x8e'),_0x474014[_0x9a1b('0x50')],util[_0x9a1b('0x45')](_0x474014,{'showHidden':![],'depth':null}));if(this[_0x9a1b('0xe')][_0x474014['uniqueid']]){var _0xe48949=_[_0x9a1b('0x8f')](this['queueReports'][_0x474014['uniqueid']]);_0xe48949[_0x9a1b('0x90')]=moment()[_0x9a1b('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0xe48949['connectedlinenum']=_0x474014[_0x9a1b('0x91')];_0xe48949['connectedlinename']=_0x474014[_0x9a1b('0x92')];logger[_0x9a1b('0x74')](_0x9a1b('0x93'),_0xe48949[_0x9a1b('0x53')],_0xe48949[_0x9a1b('0x5a')],_0x474014['connectedlinenum'],_0x474014[_0x9a1b('0x92')]);this['channels'][_0x474014['uniqueid']]=_0xe48949;this[_0x9a1b('0x4d')](_0xe48949,_0x9a1b('0x94'));}}}catch(_0xcab7d4){logger[_0x9a1b('0x43')]('[%s][voiceQueueReport][queuecallerleave]',_0x474014[_0x9a1b('0x50')],util[_0x9a1b('0x45')](_0xcab7d4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9a1b('0x48')][_0x9a1b('0x22')]=function(_0x57108a){try{if(this['isNotNull'](_0x57108a)){logger['debug'](_0x9a1b('0x95'),_0x57108a[_0x9a1b('0x50')],util[_0x9a1b('0x45')](_0x57108a,{'showHidden':![],'depth':null}));if(this[_0x9a1b('0xe')][_0x57108a[_0x9a1b('0x50')]]){var _0x2adfd6=_[_0x9a1b('0x8f')](this[_0x9a1b('0xe')][_0x57108a[_0x9a1b('0x50')]]);_0x2adfd6[_0x9a1b('0x96')]=!![];_0x2adfd6[_0x9a1b('0x8b')]=_0x9a1b('0x97');logger[_0x9a1b('0x74')](_0x9a1b('0x98'),_0x2adfd6[_0x9a1b('0x53')],_0x2adfd6[_0x9a1b('0x5a')]);}}}catch(_0x471c01){logger[_0x9a1b('0x43')]('[%s][voiceQueueReport][agentconnect]',_0x57108a[_0x9a1b('0x50')],util[_0x9a1b('0x45')](_0x471c01,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9a1b('0x48')][_0x9a1b('0x20')]=function(_0x152f34){try{if(this['isNotNull'](_0x152f34)){logger['debug'](_0x9a1b('0x99'),_0x152f34[_0x9a1b('0x50')],util['inspect'](_0x152f34,{'showHidden':![],'depth':null}));if(this[_0x9a1b('0xe')][_0x152f34[_0x9a1b('0x50')]]){var _0x200ede=_['last'](this[_0x9a1b('0xe')][_0x152f34[_0x9a1b('0x50')]]);_0x200ede[_0x9a1b('0x88')]=![];_0x200ede[_0x9a1b('0x89')]=null;_0x200ede['assigned']=!![];_0x200ede[_0x9a1b('0x8c')]=_0x152f34[_0x9a1b('0x9a')];_0x200ede[_0x9a1b('0x86')]=_0x152f34['holdtime'];_0x200ede[_0x9a1b('0x96')]=!![];_0x200ede[_0x9a1b('0x9b')]=![];_0x200ede[_0x9a1b('0x9c')]=null;if(!_0x200ede[_0x9a1b('0x9d')]){if(_0x152f34[_0x9a1b('0x9e')]=='transfer'){_0x200ede[_0x9a1b('0x8b')]=_0x9a1b('0x9f');logger[_0x9a1b('0x74')](_0x9a1b('0xa0'),_0x200ede['name'],_0x200ede[_0x9a1b('0x5a')]);}else{if(_[_0x9a1b('0xa1')](_0x152f34[_0x9a1b('0x40')][_0x9a1b('0xa2')](),'local/')){if(this[_0x9a1b('0xe')][_0x152f34[_0x9a1b('0xa3')]]){var _0x69ad7e=_[_0x9a1b('0x8f')](this[_0x9a1b('0xe')][_0x152f34[_0x9a1b('0xa3')]]);_0x69ad7e['queuecallercomplete']=![];_0x69ad7e[_0x9a1b('0x9b')]=!![];_0x69ad7e[_0x9a1b('0x9c')]=moment(_0x200ede['queuecallerjoinAt'])[_0x9a1b('0xa4')](_0x152f34[_0x9a1b('0x86')],_0x9a1b('0xa5'))[_0x9a1b('0x51')](_0x9a1b('0x8a'));_0x69ad7e[_0x9a1b('0x8b')]='FORWARDTRANSFER';_0x69ad7e[_0x9a1b('0x9d')]=!![];_0x69ad7e[_0x9a1b('0xa6')]=_0x9a1b('0xa7');_0x69ad7e[_0x9a1b('0xa8')]=_0x152f34[_0x9a1b('0xa9')];_0x69ad7e[_0x9a1b('0xaa')]=_0x152f34['uniqueid'];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x69ad7e[_0x9a1b('0x53')],_0x69ad7e[_0x9a1b('0x5a')]);var _0x4caa6e=this[_0x9a1b('0xe')][_0x152f34['linkedid']];this[_0x9a1b('0xe')][_0x152f34[_0x9a1b('0xa3')]]=this[_0x9a1b('0xe')][_0x152f34[_0x9a1b('0x50')]];this[_0x9a1b('0xe')][_0x152f34[_0x9a1b('0x50')]]=_0x4caa6e;}}else{_0x200ede['queuecallerexitreason']=_0x9a1b('0xab')+_0x152f34[_0x9a1b('0x9e')][_0x9a1b('0xac')]();logger['info'](_0x9a1b('0xad'),_0x200ede['name'],_0x200ede[_0x9a1b('0x5a')],_0x200ede[_0x9a1b('0x8b')]);}}}this[_0x9a1b('0x10')][_0x152f34[_0x9a1b('0x50')]]=_0x200ede;this[_0x9a1b('0x56')](_0x200ede,'agentcomplete');}}}catch(_0xc58ff8){logger['error'](_0x9a1b('0x99'),_0x152f34[_0x9a1b('0x50')],util[_0x9a1b('0x45')](_0xc58ff8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9a1b('0x48')][_0x9a1b('0x24')]=function(_0x1c39ed){try{if(this[_0x9a1b('0x6a')](_0x1c39ed)){logger[_0x9a1b('0x4e')](_0x9a1b('0xae'),_0x1c39ed[_0x9a1b('0x50')],util[_0x9a1b('0x45')](_0x1c39ed,{'showHidden':![],'depth':null}));this[_0x9a1b('0xaf')](_0x1c39ed[_0x9a1b('0x50')],_[_0x9a1b('0x83')](_0x1c39ed['variable'])[0x0],_0x1c39ed['value']);if(this[_0x9a1b('0xe')][_0x1c39ed[_0x9a1b('0x50')]]){var _0x23c133=_[_0x9a1b('0x8f')](this[_0x9a1b('0xe')][_0x1c39ed[_0x9a1b('0x50')]]);if(_0x23c133){if(this[_0x9a1b('0x6a')](_0x1c39ed[_0x9a1b('0xb0')])&&this['isNotNull'](_0x1c39ed[_0x9a1b('0xb0')][_0x9a1b('0xb1')])){switch(_0x1c39ed[_0x9a1b('0xb2')]){case _0x9a1b('0xb3'):_0x23c133['queuecallerexit']=![];_0x23c133[_0x9a1b('0x9c')]=null;break;case _0x9a1b('0xb4'):_0x23c133[_0x9a1b('0xb5')]=_0x9a1b('0xb6');_0x23c133[_0x9a1b('0x9b')]=!![];_0x23c133[_0x9a1b('0x9c')]=moment()[_0x9a1b('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x23c133[_0x9a1b('0x90')]=moment()[_0x9a1b('0x51')](_0x9a1b('0x8a'));logger[_0x9a1b('0x4e')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x1c39ed[_0x9a1b('0x50')],util[_0x9a1b('0x45')](_0x23c133,{'showHidden':![],'depth':null}));ami[_0x9a1b('0x4c')](_0x9a1b('0xb7'),_0x23c133);break;default:_0x23c133[_0x9a1b('0x9b')]=!![];_0x23c133[_0x9a1b('0x9c')]=moment()[_0x9a1b('0x51')](_0x9a1b('0x8a'));_0x23c133['queuecallerleaveAt']=moment()[_0x9a1b('0x51')](_0x9a1b('0x8a'));}_0x23c133[_0x9a1b('0x88')]=![];_0x23c133[_0x9a1b('0x89')]=null;_0x23c133[_0x9a1b('0x8b')]=_0x1c39ed['value'];this[_0x9a1b('0x10')][_0x1c39ed[_0x9a1b('0x50')]]=_0x23c133;this[_0x9a1b('0x56')](_0x23c133,'varset');}else if(this['isNotNull'](_0x1c39ed[_0x9a1b('0xb0')])&&this['isNotNull'](_0x1c39ed[_0x9a1b('0xb0')][_0x9a1b('0xb8')])){if(!_0x23c133[_0x9a1b('0x88')]){_0x23c133['queuecallerexit']=!![];_0x23c133['queuecallerexitAt']=moment()[_0x9a1b('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x23c133[_0x9a1b('0x8b')]=_0x9a1b('0xb9');_0x23c133['queuecallerleaveAt']=moment()[_0x9a1b('0x51')](_0x9a1b('0x8a'));this['channels'][_0x1c39ed[_0x9a1b('0x50')]]=_0x23c133;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x1c39ed[_0x9a1b('0x50')],_0x23c133[_0x9a1b('0x53')],_0x23c133[_0x9a1b('0x5a')],_[_0x9a1b('0x83')](_0x1c39ed[_0x9a1b('0xb0')])[0x0],_0x1c39ed['value']);_0x23c133['variables']=this[_0x9a1b('0x15')][_0x1c39ed[_0x9a1b('0x50')]];}}}}catch(_0x71e75){logger[_0x9a1b('0x43')](_0x9a1b('0xae'),_0x1c39ed[_0x9a1b('0x50')],util[_0x9a1b('0x45')](_0x71e75,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9a1b('0xaf')]=function(_0x2517b5,_0x48a6d5,_0x5b769a){var _0x5240df=['rtpaudioqos',_0x9a1b('0xba'),_0x9a1b('0xbb'),_0x9a1b('0xbc'),'rtpaudioqosloss',_0x9a1b('0xbd'),_0x9a1b('0xbe'),_0x9a1b('0xbf'),_0x9a1b('0xc0'),'sipuri',_0x9a1b('0xc1'),'bridgepvtcallid',_0x9a1b('0xc2'),_0x9a1b('0xc3'),_0x9a1b('0xc4'),'memberlastcall',_0x9a1b('0x9a'),_0x9a1b('0xc5'),_0x9a1b('0xc6')];if(!_[_0x9a1b('0x3d')](_0x48a6d5)&&!_[_0x9a1b('0xc7')](_0x5240df,_0x48a6d5)){if(_['isUndefined'](this[_0x9a1b('0x15')][_0x2517b5])){this[_0x9a1b('0x15')][_0x2517b5]={};}this[_0x9a1b('0x15')][_0x2517b5][_0x48a6d5]=_0x5b769a;}};VoiceQueueReport['prototype'][_0x9a1b('0x26')]=function(_0x459118){try{if(this[_0x9a1b('0x6a')](_0x459118)){logger[_0x9a1b('0x4e')](_0x9a1b('0xc8'),_0x459118['uniqueid'],util[_0x9a1b('0x45')](_0x459118,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x459118['uniqueid']]){for(var _0x5595d8=0x0,_0x6ef9a1={};_0x5595d80x0?_0x194b1d:0x0;this['voiceQueues'][_0x59c1d6['queue']][_0x60b9('0x5a')]=this[_0x60b9('0x15')][_0x59c1d6[_0x60b9('0x69')]]['talking']>_[_0x60b9('0x6d')](_0x59c1d6[_0x60b9('0x6f')])?_['toNumber'](_0x59c1d6[_0x60b9('0x6f')]):this[_0x60b9('0x15')][_0x59c1d6[_0x60b9('0x69')]][_0x60b9('0x5a')];this[_0x60b9('0x53')](this[_0x60b9('0x15')][_0x59c1d6[_0x60b9('0x69')]],'queuesummary');}logger[_0x60b9('0x49')](_0x60b9('0x71'),util['inspect'](this['voiceQueues'][_0x59c1d6[_0x60b9('0x69')]],{'showHidden':![],'depth':null}));ami['emit'](_0x60b9('0x72'),this['voiceQueues'][_0x59c1d6[_0x60b9('0x69')]]);}}}catch(_0x5954cc){logger['error'](_0x60b9('0x67'),util[_0x60b9('0x41')](_0x5954cc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x60b9('0xc')][_0x60b9('0x1d')]=function(_0x25a96e){logger[_0x60b9('0x49')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x60b9('0x41')](_0x25a96e,{'showHidden':![],'depth':null}));this[_0x60b9('0x16')]=!![];};VoiceQueueReport[_0x60b9('0xc')][_0x60b9('0x1e')]=function(_0xb425e1){try{if(this[_0x60b9('0x63')](_0xb425e1)){logger[_0x60b9('0x49')](_0x60b9('0x73'),_0xb425e1[_0x60b9('0x4b')],util['inspect'](_0xb425e1,{'showHidden':![],'depth':null}));if(_[_0x60b9('0x74')](this[_0x60b9('0x11')][_0xb425e1[_0x60b9('0x4b')]]))this['queueReports'][_0xb425e1['uniqueid']]=[];if(_[_0x60b9('0x74')](this[_0x60b9('0x13')][_0xb425e1['uniqueid']]))this['channels'][_0xb425e1[_0x60b9('0x4b')]]={};var _0x48e35d=new QueueReport();_0x48e35d[_0x60b9('0x4d')]=_0xb425e1['queue'];_0x48e35d[_0x60b9('0x54')]=this[_0x60b9('0x15')][_0x48e35d[_0x60b9('0x4d')]]&&this[_0x60b9('0x15')][_0x48e35d[_0x60b9('0x4d')]][_0x60b9('0x54')]?this[_0x60b9('0x15')][_0x48e35d[_0x60b9('0x4d')]]['type']||'inbound':_0x60b9('0x55');_0x48e35d[_0x60b9('0x69')]=_0xb425e1['queue'];_0x48e35d[_0x60b9('0x75')]=moment()['format'](_0x60b9('0x76'));_0x48e35d['position']=_0xb425e1[_0x60b9('0x77')];_0x48e35d[_0x60b9('0x78')]=_0xb425e1[_0x60b9('0x78')];_0x48e35d[_0x60b9('0x4b')]=_0xb425e1[_0x60b9('0x4b')];_0x48e35d[_0x60b9('0x79')]=this[_0x60b9('0x13')][_0xb425e1[_0x60b9('0x4b')]][_0x60b9('0x79')];logger[_0x60b9('0x6a')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x48e35d[_0x60b9('0x4d')],_0x48e35d[_0x60b9('0x54')]);_[_0x60b9('0x7a')](_0x48e35d,_['pick'](_0xb425e1,_[_0x60b9('0x7b')](_0x48e35d)));this[_0x60b9('0x11')][_0xb425e1['uniqueid']][_0x60b9('0x7c')](_0x48e35d);this[_0x60b9('0x13')][_0xb425e1['uniqueid']]=_0x48e35d;this['emitVoiceQueueChannelSave'](_0x48e35d,_0x60b9('0x7d'));}}catch(_0x247d56){logger[_0x60b9('0x3f')](_0x60b9('0x73'),_0xb425e1[_0x60b9('0x4b')],util[_0x60b9('0x41')](_0x247d56,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x60b9('0x20')]=function(_0x36c5d8){try{if(this[_0x60b9('0x63')](_0x36c5d8)){logger[_0x60b9('0x49')](_0x60b9('0x7e'),_0x36c5d8[_0x60b9('0x4b')],util[_0x60b9('0x41')](_0x36c5d8,{'showHidden':![],'depth':null}));if(this[_0x60b9('0x11')][_0x36c5d8[_0x60b9('0x4b')]]){var _0xa0a384=_['last'](this[_0x60b9('0x11')][_0x36c5d8['uniqueid']]);_0xa0a384[_0x60b9('0x7f')]=![];_0xa0a384[_0x60b9('0x80')]=null;_0xa0a384['holdtime']=_0x36c5d8[_0x60b9('0x81')];_0xa0a384[_0x60b9('0x82')]=_0x36c5d8['originalposition'];_0xa0a384[_0x60b9('0x1f')]=!![];_0xa0a384['queuecallerabandonAt']=moment()[_0x60b9('0x51')](_0x60b9('0x76'));_0xa0a384[_0x60b9('0x83')]=_0x60b9('0x84');_0xa0a384[_0x60b9('0x85')]=null;logger['info'](_0x60b9('0x86'),_0xa0a384['name'],_0xa0a384['type']);this[_0x60b9('0x13')][_0x36c5d8[_0x60b9('0x4b')]]=_0xa0a384;this[_0x60b9('0x45')](_0xa0a384,'queuecallerabandon');}}}catch(_0x1ec2f1){logger['error'](_0x60b9('0x7e'),_0x36c5d8[_0x60b9('0x4b')],util[_0x60b9('0x41')](_0x1ec2f1,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x60b9('0x21')]=function(_0x24691c){try{if(this[_0x60b9('0x63')](_0x24691c)){logger[_0x60b9('0x49')](_0x60b9('0x87'),_0x24691c[_0x60b9('0x4b')],util['inspect'](_0x24691c,{'showHidden':![],'depth':null}));if(this[_0x60b9('0x11')][_0x24691c['uniqueid']]){var _0x132f4f=_[_0x60b9('0x88')](this[_0x60b9('0x11')][_0x24691c[_0x60b9('0x4b')]]);_0x132f4f[_0x60b9('0x89')]=moment()[_0x60b9('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x132f4f[_0x60b9('0x8a')]=_0x24691c['connectedlinenum'];_0x132f4f['connectedlinename']=_0x24691c[_0x60b9('0x8b')];logger[_0x60b9('0x6a')](_0x60b9('0x8c'),_0x132f4f['name'],_0x132f4f[_0x60b9('0x54')],_0x24691c[_0x60b9('0x8a')],_0x24691c[_0x60b9('0x8b')]);this[_0x60b9('0x13')][_0x24691c[_0x60b9('0x4b')]]=_0x132f4f;this[_0x60b9('0x48')](_0x132f4f,_0x60b9('0x8d'));}}}catch(_0x2ad8c9){logger[_0x60b9('0x3f')](_0x60b9('0x87'),_0x24691c[_0x60b9('0x4b')],util[_0x60b9('0x41')](_0x2ad8c9,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x60b9('0x24')]=function(_0x37ac7e){try{if(this[_0x60b9('0x63')](_0x37ac7e)){logger[_0x60b9('0x49')](_0x60b9('0x8e'),_0x37ac7e[_0x60b9('0x4b')],util['inspect'](_0x37ac7e,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x37ac7e['uniqueid']]){var _0x5f294e=_[_0x60b9('0x88')](this[_0x60b9('0x11')][_0x37ac7e[_0x60b9('0x4b')]]);_0x5f294e[_0x60b9('0x7f')]=!![];_0x5f294e[_0x60b9('0x83')]='COMPLETEDBYAGENT';logger[_0x60b9('0x6a')](_0x60b9('0x8f'),_0x5f294e[_0x60b9('0x4d')],_0x5f294e['type']);}}}catch(_0x1f584e){logger[_0x60b9('0x3f')](_0x60b9('0x8e'),_0x37ac7e[_0x60b9('0x4b')],util['inspect'](_0x1f584e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x60b9('0x23')]=function(_0x446398){try{if(this[_0x60b9('0x63')](_0x446398)){logger[_0x60b9('0x49')](_0x60b9('0x90'),_0x446398[_0x60b9('0x4b')],util[_0x60b9('0x41')](_0x446398,{'showHidden':![],'depth':null}));if(this[_0x60b9('0x11')][_0x446398['uniqueid']]){var _0x5ba673=_[_0x60b9('0x88')](this['queueReports'][_0x446398['uniqueid']]);_0x5ba673[_0x60b9('0x1f')]=![];_0x5ba673['queuecallerabandonAt']=null;_0x5ba673[_0x60b9('0x91')]=!![];_0x5ba673[_0x60b9('0x85')]=_0x446398['membername'];_0x5ba673[_0x60b9('0x81')]=_0x446398[_0x60b9('0x81')];_0x5ba673[_0x60b9('0x7f')]=!![];_0x5ba673[_0x60b9('0x92')]=![];_0x5ba673['queuecallerexitAt']=null;if(!_0x5ba673[_0x60b9('0x93')]){if(_0x446398['reason']==_0x60b9('0x93')){_0x5ba673[_0x60b9('0x83')]=_0x60b9('0x94');logger[_0x60b9('0x6a')](_0x60b9('0x95'),_0x5ba673[_0x60b9('0x4d')],_0x5ba673[_0x60b9('0x54')]);}else{if(_[_0x60b9('0x96')](_0x446398['channel']['toLowerCase'](),'local/')){if(this[_0x60b9('0x11')][_0x446398[_0x60b9('0x97')]]){var _0x5c782a=_['last'](this[_0x60b9('0x11')][_0x446398[_0x60b9('0x97')]]);_0x5c782a[_0x60b9('0x7f')]=![];_0x5c782a[_0x60b9('0x92')]=!![];_0x5c782a[_0x60b9('0x98')]=moment(_0x5ba673[_0x60b9('0x75')])['add'](_0x446398[_0x60b9('0x81')],'seconds')[_0x60b9('0x51')](_0x60b9('0x76'));_0x5c782a[_0x60b9('0x83')]=_0x60b9('0x99');_0x5c782a[_0x60b9('0x93')]=!![];_0x5c782a[_0x60b9('0x9a')]='FORWARD';_0x5c782a[_0x60b9('0x9b')]=_0x446398[_0x60b9('0x9c')];_0x5c782a[_0x60b9('0x9d')]=_0x446398[_0x60b9('0x4b')];logger[_0x60b9('0x6a')](_0x60b9('0x9e'),_0x5c782a[_0x60b9('0x4d')],_0x5c782a[_0x60b9('0x54')]);var _0x4d1b14=this[_0x60b9('0x11')][_0x446398[_0x60b9('0x97')]];this[_0x60b9('0x11')][_0x446398[_0x60b9('0x97')]]=this[_0x60b9('0x11')][_0x446398[_0x60b9('0x4b')]];this[_0x60b9('0x11')][_0x446398[_0x60b9('0x4b')]]=_0x4d1b14;}}else{_0x5ba673[_0x60b9('0x83')]=_0x60b9('0x9f')+_0x446398['reason'][_0x60b9('0xa0')]();logger['info'](_0x60b9('0xa1'),_0x5ba673[_0x60b9('0x4d')],_0x5ba673['type'],_0x5ba673[_0x60b9('0x83')]);}}}this[_0x60b9('0x13')][_0x446398[_0x60b9('0x4b')]]=_0x5ba673;this[_0x60b9('0x45')](_0x5ba673,_0x60b9('0x22'));}}}catch(_0x215795){logger[_0x60b9('0x3f')]('[%s][voiceQueueReport][agentcomplete]',_0x446398[_0x60b9('0x4b')],util[_0x60b9('0x41')](_0x215795,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x60b9('0xc')][_0x60b9('0x26')]=function(_0x5a7c19){try{if(this[_0x60b9('0x63')](_0x5a7c19)){logger[_0x60b9('0x49')]('[%s][voiceQueueReport][varset]',_0x5a7c19[_0x60b9('0x4b')],util[_0x60b9('0x41')](_0x5a7c19,{'showHidden':![],'depth':null}));this['addVariable'](_0x5a7c19[_0x60b9('0x4b')],_[_0x60b9('0x7b')](_0x5a7c19[_0x60b9('0xa2')])[0x0],_0x5a7c19['value']);if(this[_0x60b9('0x11')][_0x5a7c19['uniqueid']]){var _0x21b283=_[_0x60b9('0x88')](this[_0x60b9('0x11')][_0x5a7c19[_0x60b9('0x4b')]]);if(_0x21b283){if(this[_0x60b9('0x63')](_0x5a7c19['variable'])&&this[_0x60b9('0x63')](_0x5a7c19[_0x60b9('0xa2')][_0x60b9('0xa3')])){switch(_0x5a7c19['value']){case'CONTINUE':_0x21b283['queuecallerexit']=![];_0x21b283[_0x60b9('0x98')]=null;break;case'TIMEOUT':_0x21b283[_0x60b9('0xa4')]=_0x60b9('0xa5');_0x21b283[_0x60b9('0x92')]=!![];_0x21b283[_0x60b9('0x98')]=moment()[_0x60b9('0x51')](_0x60b9('0x76'));_0x21b283['queuecallerleaveAt']=moment()[_0x60b9('0x51')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x60b9('0x49')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x5a7c19[_0x60b9('0x4b')],util[_0x60b9('0x41')](_0x21b283,{'showHidden':![],'depth':null}));ami[_0x60b9('0x47')](_0x60b9('0xa6'),_0x21b283);break;default:_0x21b283[_0x60b9('0x92')]=!![];_0x21b283['queuecallerexitAt']=moment()[_0x60b9('0x51')](_0x60b9('0x76'));_0x21b283[_0x60b9('0x89')]=moment()[_0x60b9('0x51')]('YYYY-MM-DD\x20HH:mm:ss');}_0x21b283[_0x60b9('0x1f')]=![];_0x21b283['queuecallerabandonAt']=null;_0x21b283[_0x60b9('0x83')]=_0x5a7c19[_0x60b9('0xa7')];this[_0x60b9('0x13')][_0x5a7c19[_0x60b9('0x4b')]]=_0x21b283;this[_0x60b9('0x45')](_0x21b283,'varset');}else if(this[_0x60b9('0x63')](_0x5a7c19[_0x60b9('0xa2')])&&this[_0x60b9('0x63')](_0x5a7c19[_0x60b9('0xa2')][_0x60b9('0xa8')])){if(!_0x21b283['queuecallerabandon']){_0x21b283[_0x60b9('0x92')]=!![];_0x21b283['queuecallerexitAt']=moment()[_0x60b9('0x51')](_0x60b9('0x76'));_0x21b283['queuecallerexitreason']=_0x60b9('0xa9');_0x21b283[_0x60b9('0x89')]=moment()[_0x60b9('0x51')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x60b9('0x13')][_0x5a7c19[_0x60b9('0x4b')]]=_0x21b283;}}logger[_0x60b9('0x6a')](_0x60b9('0xaa'),_0x5a7c19[_0x60b9('0x4b')],_0x21b283[_0x60b9('0x4d')],_0x21b283[_0x60b9('0x54')],_[_0x60b9('0x7b')](_0x5a7c19[_0x60b9('0xa2')])[0x0],_0x5a7c19[_0x60b9('0xa7')]);_0x21b283[_0x60b9('0x18')]=this[_0x60b9('0x18')][_0x5a7c19['uniqueid']];}}}}catch(_0x120dc7){logger[_0x60b9('0x3f')](_0x60b9('0xab'),_0x5a7c19['uniqueid'],util[_0x60b9('0x41')](_0x120dc7,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x60b9('0xac')]=function(_0x3c1c5c,_0x3c36ee,_0x1d2af2){var _0x66f6a7=[_0x60b9('0xad'),_0x60b9('0xae'),'rtpaudioqosjitter',_0x60b9('0xaf'),_0x60b9('0xb0'),_0x60b9('0xb1'),_0x60b9('0xb2'),_0x60b9('0xb3'),_0x60b9('0xb4'),_0x60b9('0xb5'),_0x60b9('0xb6'),_0x60b9('0xb7'),_0x60b9('0xb8'),'memberdynamic',_0x60b9('0xb9'),_0x60b9('0xba'),'membername','memberpenalty','memberrealtime'];if(!_[_0x60b9('0x3a')](_0x3c36ee)&&!_[_0x60b9('0xbb')](_0x66f6a7,_0x3c36ee)){if(_[_0x60b9('0x74')](this[_0x60b9('0x18')][_0x3c1c5c])){this['variables'][_0x3c1c5c]={};}this[_0x60b9('0x18')][_0x3c1c5c][_0x3c36ee]=_0x1d2af2;}};VoiceQueueReport['prototype'][_0x60b9('0x28')]=function(_0x5ae5c8){try{if(this[_0x60b9('0x63')](_0x5ae5c8)){logger[_0x60b9('0x49')](_0x60b9('0xbc'),_0x5ae5c8['uniqueid'],util['inspect'](_0x5ae5c8,{'showHidden':![],'depth':null}));if(this[_0x60b9('0x11')][_0x5ae5c8['uniqueid']]){for(var _0x48d8cb=0x0,_0x50453c={};_0x48d8cb=0x0?moment(_0x2776b3[_0x08d6('0x16')])[_0x08d6('0xb')](_0x2776b3[_0x08d6('0x15')],_0x08d6('0xc')):null,'data1':'outbound','data2':_0x2776b3[_0x08d6('0xf')],'data3':_0x2776b3['exten'],'data4':_0x2776b3[_0x08d6('0x17')]||null,'role':_0x08d6('0x18'),'internal':_0x2776b3[_0x08d6('0xf')]?_[_0x08d6('0x10')](_0x2776b3['accountcode']):undefined,'uniqueid':_0x2776b3['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0xde12=['diff','seconds','calleridnum','exten','agent','accountcode','toNumber','uniqueid','starttime','endtime','outbound','dialstring','moment','lodash','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','SIP/%s','TALKING','queuecallerleaveAt'];(function(_0x55f6a9,_0x29b8c6){var _0x2ca2d0=function(_0x1d9852){while(--_0x1d9852){_0x55f6a9['push'](_0x55f6a9['shift']());}};_0x2ca2d0(++_0x29b8c6);}(_0xde12,0x135));var _0x2de1=function(_0x56a559,_0x3081de){_0x56a559=_0x56a559-0x0;var _0x142c11=_0xde12[_0x56a559];return _0x142c11;};'use strict';var moment=require(_0x2de1('0x0'));var _=require(_0x2de1('0x1'));var util=require('util');var client=require(_0x2de1('0x2'));exports[_0x2de1('0x3')]=function(_0x178bf0){var _0x58273f=_0x178bf0[_0x2de1('0x4')]||_0x178bf0[_0x2de1('0x5')];return client[_0x2de1('0x6')](_0x2de1('0x7'),{'body':{'channel':_0x2de1('0x8'),'membername':_0x178bf0[_0x2de1('0x9')],'interface':_[_0x2de1('0xa')](_0x178bf0[_0x2de1('0xb')])?util['format'](_0x2de1('0xc'),_0x178bf0[_0x2de1('0x9')]):_0x178bf0[_0x2de1('0xb')],'type':_0x2de1('0xd'),'enterAt':_0x178bf0[_0x2de1('0xe')],'exitAt':_0x58273f,'duration':moment(_0x58273f)[_0x2de1('0xf')](_0x178bf0['queuecallerleaveAt'],_0x2de1('0x10')),'data1':'inbound','data2':_0x178bf0[_0x2de1('0x11')],'data3':_0x178bf0[_0x2de1('0x12')],'data4':null,'data5':_0x178bf0['queue'],'role':_0x2de1('0x13'),'internal':_0x178bf0[_0x2de1('0x14')]?_[_0x2de1('0x15')](_0x178bf0[_0x2de1('0x14')]):undefined,'uniqueid':_0x178bf0[_0x2de1('0x16')]},'log':_0x2de1('0x7')});};exports['voiceDialReport']=function(_0x9e5aca){return client[_0x2de1('0x6')](_0x2de1('0x7'),{'body':{'channel':_0x2de1('0x8'),'membername':_0x9e5aca['membername'],'interface':_0x9e5aca['interface'],'type':_0x2de1('0xd'),'enterAt':_0x9e5aca[_0x2de1('0x17')],'exitAt':_0x9e5aca[_0x2de1('0x18')],'duration':moment(_0x9e5aca[_0x2de1('0x18')])[_0x2de1('0xf')](_0x9e5aca[_0x2de1('0x17')],_0x2de1('0x10'))>=0x0?moment(_0x9e5aca[_0x2de1('0x18')])[_0x2de1('0xf')](_0x9e5aca[_0x2de1('0x17')],_0x2de1('0x10')):null,'data1':_0x2de1('0x19'),'data2':_0x9e5aca[_0x2de1('0x14')],'data3':_0x9e5aca[_0x2de1('0x12')],'data4':_0x9e5aca[_0x2de1('0x1a')]||null,'role':_0x2de1('0x13'),'internal':_0x9e5aca[_0x2de1('0x14')]?_[_0x2de1('0x15')](_0x9e5aca[_0x2de1('0x14')]):undefined,'uniqueid':_0x9e5aca[_0x2de1('0x16')]},'log':_0x2de1('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 2f9f3b7..29e4446 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 _0x88b5=['GetSettings','../client','getSettings','Request','stopRecordingOnTransfer'];(function(_0x5ba178,_0x25748d){var _0x98a27e=function(_0x4d485b){while(--_0x4d485b){_0x5ba178['push'](_0x5ba178['shift']());}};_0x98a27e(++_0x25748d);}(_0x88b5,0x10f));var _0x588b=function(_0x4e431a,_0x522d73){_0x4e431a=_0x4e431a-0x0;var _0x285ddf=_0x88b5[_0x4e431a];return _0x285ddf;};'use strict';var client=require(_0x588b('0x0'));exports[_0x588b('0x1')]=function(){return client[_0x588b('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x588b('0x3')]},'log':_0x588b('0x4')});}; \ No newline at end of file +var _0x180f=['getSettings','ShowSetting','stopRecordingOnTransfer','../client'];(function(_0x2bab6c,_0x16de9f){var _0x5db1b9=function(_0x1318d1){while(--_0x1318d1){_0x2bab6c['push'](_0x2bab6c['shift']());}};_0x5db1b9(++_0x16de9f);}(_0x180f,0xf3));var _0xf180=function(_0x413b4d,_0xa3459c){_0x413b4d=_0x413b4d-0x0;var _0x8b810a=_0x180f[_0x413b4d];return _0x8b810a;};'use strict';var client=require(_0xf180('0x0'));exports[_0xf180('0x1')]=function(){return client['Request'](_0xf180('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xf180('0x3')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index b97acb3..bae3abb 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 _0xe6da=['Request','GetTemplate','name','html','getTemplates'];(function(_0x1e343b,_0x304d05){var _0x4de775=function(_0x101958){while(--_0x101958){_0x1e343b['push'](_0x1e343b['shift']());}};_0x4de775(++_0x304d05);}(_0xe6da,0x1ee));var _0xae6d=function(_0x2b89ed,_0x162f53){_0x2b89ed=_0x2b89ed-0x0;var _0xb39052=_0xe6da[_0x2b89ed];return _0xb39052;};'use strict';var client=require('../client');exports[_0xae6d('0x0')]=function(_0x172ca2){return function(_0x3976d2){return client[_0xae6d('0x1')](_0xae6d('0x2'),{'options':{'raw':!![],'attributes':['id',_0xae6d('0x3'),_0xae6d('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x2f74=['../client','getTemplates','Request','GetTemplate','html'];(function(_0x2d2b51,_0x50e5b6){var _0x2af037=function(_0x5b9267){while(--_0x5b9267){_0x2d2b51['push'](_0x2d2b51['shift']());}};_0x2af037(++_0x50e5b6);}(_0x2f74,0xf0));var _0x42f7=function(_0x5bf2a6,_0x96d3b8){_0x5bf2a6=_0x5bf2a6-0x0;var _0x284505=_0x2f74[_0x5bf2a6];return _0x284505;};'use strict';var client=require(_0x42f7('0x0'));exports[_0x42f7('0x1')]=function(_0x29de28){return function(_0x13ca54){return client[_0x42f7('0x2')](_0x42f7('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0x42f7('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 1e044b5..689457c 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 _0xaa4d=['status','Condition','AllConditions','operator','value','AnyConditions','field','Action','Actions','data1','data2','data3','data5','data7','../client','getTriggers','Request','GetTrigger','channel'];(function(_0x327a80,_0xff6da3){var _0x1ff3b0=function(_0x22813e){while(--_0x22813e){_0x327a80['push'](_0x327a80['shift']());}};_0x1ff3b0(++_0xff6da3);}(_0xaa4d,0x151));var _0xdaa4=function(_0x45862f,_0xf5f0a6){_0x45862f=_0x45862f-0x0;var _0x35b20b=_0xaa4d[_0x45862f];return _0x35b20b;};'use strict';var client=require(_0xdaa4('0x0'));exports[_0xdaa4('0x1')]=function(_0x1d8c5b){return function(_0x4bca13){return client[_0xdaa4('0x2')](_0xdaa4('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xdaa4('0x4'),_0xdaa4('0x5')],'include':[{'model':_0xdaa4('0x6'),'as':_0xdaa4('0x7'),'attributes':['id','field',_0xdaa4('0x8'),_0xdaa4('0x9')]},{'model':_0xdaa4('0x6'),'as':_0xdaa4('0xa'),'attributes':['id',_0xdaa4('0xb'),_0xdaa4('0x8'),_0xdaa4('0x9')]},{'model':_0xdaa4('0xc'),'as':_0xdaa4('0xd'),'attributes':['id','action',_0xdaa4('0xe'),_0xdaa4('0xf'),_0xdaa4('0x10'),'data4',_0xdaa4('0x11'),'data6',_0xdaa4('0x12')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x7742=['Request','GetTrigger','channel','status','Condition','AllConditions','field','operator','value','Action','Actions','action','data1','data2','data3','data4','data5','data6','../client','getTriggers'];(function(_0x152a07,_0x419545){var _0x5ec0b0=function(_0x336228){while(--_0x336228){_0x152a07['push'](_0x152a07['shift']());}};_0x5ec0b0(++_0x419545);}(_0x7742,0x1b6));var _0x2774=function(_0x9150d8,_0x4042e8){_0x9150d8=_0x9150d8-0x0;var _0x571d79=_0x7742[_0x9150d8];return _0x571d79;};'use strict';var client=require(_0x2774('0x0'));exports[_0x2774('0x1')]=function(_0x8224c4){return function(_0x487dc1){return client[_0x2774('0x2')](_0x2774('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x2774('0x4'),_0x2774('0x5')],'include':[{'model':_0x2774('0x6'),'as':_0x2774('0x7'),'attributes':['id',_0x2774('0x8'),_0x2774('0x9'),'value']},{'model':_0x2774('0x6'),'as':'AnyConditions','attributes':['id',_0x2774('0x8'),_0x2774('0x9'),_0x2774('0xa')]},{'model':_0x2774('0xb'),'as':_0x2774('0xc'),'attributes':['id',_0x2774('0xd'),_0x2774('0xe'),_0x2774('0xf'),_0x2774('0x10'),_0x2774('0x11'),_0x2774('0x12'),_0x2774('0x13'),'data7']}]},'log':_0x2774('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index d587deb..971ea4e 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 _0xb43b=['Request','GetTrunk','name','registry','defaultuser','../client'];(function(_0x55deec,_0x130e1f){var _0x2a071a=function(_0x292388){while(--_0x292388){_0x55deec['push'](_0x55deec['shift']());}};_0x2a071a(++_0x130e1f);}(_0xb43b,0xbf));var _0xbb43=function(_0x579c45,_0x23aae2){_0x579c45=_0x579c45-0x0;var _0x3d86d8=_0xb43b[_0x579c45];return _0x3d86d8;};'use strict';var client=require(_0xbb43('0x0'));exports['getTrunks']=function(_0x1b9ba2){return function(_0x21ce6c){return client[_0xbb43('0x1')](_0xbb43('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xbb43('0x3'),_0xbb43('0x4'),_0xbb43('0x5')]},'log':_0xbb43('0x2')});};}; \ No newline at end of file +var _0xaf73=['name','registry','../client','getTrunks','GetTrunk'];(function(_0x1f96bf,_0x2d3391){var _0x167865=function(_0x5c24ff){while(--_0x5c24ff){_0x1f96bf['push'](_0x1f96bf['shift']());}};_0x167865(++_0x2d3391);}(_0xaf73,0x1ec));var _0x3af7=function(_0x4148a7,_0x3d3a4f){_0x4148a7=_0x4148a7-0x0;var _0x324acf=_0xaf73[_0x4148a7];return _0x324acf;};'use strict';var client=require(_0x3af7('0x0'));exports[_0x3af7('0x1')]=function(_0x13f77f){return function(_0x12f66d){return client['Request'](_0x3af7('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x3af7('0x3'),_0x3af7('0x4'),'defaultuser']},'log':_0x3af7('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 1e603d6..e88f23e 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 _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x4122af,_0x30c542){var _0x5b550e=function(_0x2dedf8){while(--_0x2dedf8){_0x4122af['push'](_0x4122af['shift']());}};_0x5b550e(++_0x30c542);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});}; \ No newline at end of file +var _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 018b90f..e5aec46 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 _0xb97c=['Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xb97c,0x77));var _0xcb97=function(_0x306f19,_0x237f05){_0x306f19=_0x306f19-0x0;var _0x2ce7b1=_0xb97c[_0x306f19];return _0x2ce7b1;};'use strict';var client=require(_0xcb97('0x0'));exports['create']=function(_0x41fde2){return client[_0xcb97('0x1')]('CreateVoiceAgentReport',{'body':_0x41fde2,'log':_0xcb97('0x2')});};exports['update']=function(_0x2365f6,_0x35ca5e,_0x235520){return client[_0xcb97('0x1')](_0xcb97('0x3'),{'body':_0x2365f6,'options':{'where':{'uniqueid':_0x35ca5e,'interface':_0x235520,'agentcomplete':!![]}},'log':_0xcb97('0x3')});}; \ No newline at end of file +var _0x6daf=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create'];(function(_0x28bad3,_0x58f2e4){var _0x3bac1c=function(_0x28e41d){while(--_0x28e41d){_0x28bad3['push'](_0x28bad3['shift']());}};_0x3bac1c(++_0x58f2e4);}(_0x6daf,0x12a));var _0xf6da=function(_0x15ad69,_0x3ba49c){_0x15ad69=_0x15ad69-0x0;var _0x5589c0=_0x6daf[_0x15ad69];return _0x5589c0;};'use strict';var client=require(_0xf6da('0x0'));exports[_0xf6da('0x1')]=function(_0x4fa60d){return client[_0xf6da('0x2')](_0xf6da('0x3'),{'body':_0x4fa60d,'log':_0xf6da('0x3')});};exports[_0xf6da('0x4')]=function(_0x5eb485,_0x43e5dc,_0x283aa1){return client[_0xf6da('0x2')](_0xf6da('0x5'),{'body':_0x5eb485,'options':{'where':{'uniqueid':_0x43e5dc,'interface':_0x283aa1,'agentcomplete':!![]}},'log':_0xf6da('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 1ebc755..f040c57 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 _0xf572=['create','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','Request','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client'];(function(_0x2e9779,_0x27ad40){var _0x4eea00=function(_0xc51134){while(--_0xc51134){_0x2e9779['push'](_0x2e9779['shift']());}};_0x4eea00(++_0x27ad40);}(_0xf572,0x1d7));var _0x2f57=function(_0x177f63,_0x86eac3){_0x177f63=_0x177f63-0x0;var _0x456d27=_0xf572[_0x177f63];return _0x456d27;};'use strict';var moment=require(_0x2f57('0x0'));var util=require(_0x2f57('0x1'));var _=require(_0x2f57('0x2'));var client=require(_0x2f57('0x3'));exports[_0x2f57('0x4')]=function(_0x2297ff){return client['Request'](_0x2f57('0x5'),{'body':_[_0x2f57('0x6')](_0x2297ff,{'source':_0x2297ff[_0x2f57('0x7')],'destinationcontext':_0x2297ff[_0x2f57('0x8')],'callerid':_0x2297ff[_0x2f57('0x9')],'amaflags':_0x2f57('0xa')}),'log':_0x2f57('0x5')});};exports[_0x2f57('0xb')]=function(){return function(){return client[_0x2f57('0xc')](_0x2f57('0xd'),{'options':{'where':{'type':[_0x2f57('0xe')],'createdAt':{'$between':[moment()[_0x2f57('0xf')](_0x2f57('0x10'))[_0x2f57('0x11')](_0x2f57('0x12')),moment()[_0x2f57('0x13')]('day')[_0x2f57('0x11')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x2f57('0x14'),_0x2f57('0x15'),_0x2f57('0x16'),_0x2f57('0x17')]},'log':_0x2f57('0x18')});};}; \ No newline at end of file +var _0xda43=['day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','billableseconds','GetVoiceCallReports','moment','util','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','callerid','DOCUMENTATION','getVoiceCallReports','outbound','startOf'];(function(_0x5e2cf9,_0x3adb53){var _0x3c4158=function(_0x36edb1){while(--_0x36edb1){_0x5e2cf9['push'](_0x5e2cf9['shift']());}};_0x3c4158(++_0x3adb53);}(_0xda43,0x197));var _0x3da4=function(_0x5e5c74,_0x1c0d09){_0x5e5c74=_0x5e5c74-0x0;var _0x5d2127=_0xda43[_0x5e5c74];return _0x5d2127;};'use strict';var moment=require(_0x3da4('0x0'));var util=require(_0x3da4('0x1'));var _=require('lodash');var client=require(_0x3da4('0x2'));exports[_0x3da4('0x3')]=function(_0x47b756){return client[_0x3da4('0x4')](_0x3da4('0x5'),{'body':_[_0x3da4('0x6')](_0x47b756,{'source':_0x47b756[_0x3da4('0x7')],'destinationcontext':_0x47b756['context'],'callerid':_0x47b756[_0x3da4('0x8')],'amaflags':_0x3da4('0x9')}),'log':'CreateVoiceCallReport'});};exports[_0x3da4('0xa')]=function(){return function(){return client[_0x3da4('0x4')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x3da4('0xb')],'createdAt':{'$between':[moment()[_0x3da4('0xc')](_0x3da4('0xd'))[_0x3da4('0xe')](_0x3da4('0xf')),moment()[_0x3da4('0x10')](_0x3da4('0xd'))['format'](_0x3da4('0xf'))]}},'attributes':[_0x3da4('0x11'),_0x3da4('0x12'),'duration',_0x3da4('0x13')]},'log':_0x3da4('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index c9accfa..3aee5b5 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 _0x3234=['create','Request','CreateVoiceDialReport','../client'];(function(_0x13a9de,_0x247d3d){var _0x210229=function(_0x2cfe64){while(--_0x2cfe64){_0x13a9de['push'](_0x13a9de['shift']());}};_0x210229(++_0x247d3d);}(_0x3234,0x157));var _0x4323=function(_0x2dac3e,_0x3ffb48){_0x2dac3e=_0x2dac3e-0x0;var _0x1da1a7=_0x3234[_0x2dac3e];return _0x1da1a7;};'use strict';var client=require(_0x4323('0x0'));exports[_0x4323('0x1')]=function(_0x261f55){return client[_0x4323('0x2')](_0x4323('0x3'),{'body':_0x261f55,'log':_0x4323('0x3')});}; \ No newline at end of file +var _0xf11f=['CreateVoiceDialReport','create'];(function(_0x3eb378,_0x6700c5){var _0x1f5eca=function(_0xe06eab){while(--_0xe06eab){_0x3eb378['push'](_0x3eb378['shift']());}};_0x1f5eca(++_0x6700c5);}(_0xf11f,0xd1));var _0xff11=function(_0x57fa33,_0x2b8222){_0x57fa33=_0x57fa33-0x0;var _0x12e724=_0xf11f[_0x57fa33];return _0x12e724;};'use strict';var client=require('../client');exports[_0xff11('0x0')]=function(_0x20487c){return client['Request']('CreateVoiceDialReport',{'body':_0x20487c,'log':_0xff11('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 4d78eb4..7d8685e 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 _0xa9e0=['getVoiceExtensions','Request','recordingFormat','../client'];(function(_0x34637d,_0x29a649){var _0x4a7166=function(_0x577a78){while(--_0x577a78){_0x34637d['push'](_0x34637d['shift']());}};_0x4a7166(++_0x29a649);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten',_0x0a9e('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x3140=['getVoiceExtensions','Request','GetVoiceExtension','../client'];(function(_0x4fdae2,_0x16ec59){var _0x527e8d=function(_0x1dc77a){while(--_0x1dc77a){_0x4fdae2['push'](_0x4fdae2['shift']());}};_0x527e8d(++_0x16ec59);}(_0x3140,0xaf));var _0x0314=function(_0x5eaa6a,_0x41d4f9){_0x5eaa6a=_0x5eaa6a-0x0;var _0x332a98=_0x3140[_0x5eaa6a];return _0x332a98;};'use strict';var client=require(_0x0314('0x0'));exports[_0x0314('0x1')]=function(){return function(){return client[_0x0314('0x2')](_0x0314('0x3'),{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x0314('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 93fcf77..32036cd 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 _0x2ada=['GetVoiceQueue','name','acw','acwTimeout','autopause','type','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval','Intervals','interval','getVoiceQueues','Request'];(function(_0x3e3590,_0x16e735){var _0x776f0d=function(_0x26805b){while(--_0x26805b){_0x3e3590['push'](_0x3e3590['shift']());}};_0x776f0d(++_0x16e735);}(_0x2ada,0x16c));var _0xa2ad=function(_0x44b0de,_0x213afa){_0x44b0de=_0x44b0de-0x0;var _0x21da2a=_0x2ada[_0x44b0de];return _0x21da2a;};'use strict';var client=require('../client');exports[_0xa2ad('0x0')]=function(){return function(){return client[_0xa2ad('0x1')](_0xa2ad('0x2'),{'options':{'raw':![],'attributes':['id',_0xa2ad('0x3'),_0xa2ad('0x4'),_0xa2ad('0x5'),_0xa2ad('0x6'),'monitor_format',_0xa2ad('0x7'),'dialActive',_0xa2ad('0x8'),_0xa2ad('0x9'),_0xa2ad('0xa'),'dialPowerLevel',_0xa2ad('0xb'),_0xa2ad('0xc'),_0xa2ad('0xd'),_0xa2ad('0xe'),_0xa2ad('0xf'),_0xa2ad('0x10'),_0xa2ad('0x11'),_0xa2ad('0x12'),'dialQueueProject',_0xa2ad('0x13'),_0xa2ad('0x14'),_0xa2ad('0x15'),'dialBusyRetryFrequency',_0xa2ad('0x16'),_0xa2ad('0x17'),_0xa2ad('0x18'),_0xa2ad('0x19'),_0xa2ad('0x1a'),_0xa2ad('0x1b'),_0xa2ad('0x1c'),_0xa2ad('0x1d'),_0xa2ad('0x1e'),_0xa2ad('0x1f'),_0xa2ad('0x20'),_0xa2ad('0x21'),'dialAMDMinWordLength','dialAMDBetweenWordsSilence',_0xa2ad('0x22'),_0xa2ad('0x23'),'dialAMDMaximumWordLength','timeout','dialRecallMeTimeout',_0xa2ad('0x24'),'dialOrderByScheduledAt',_0xa2ad('0x25'),_0xa2ad('0x26'),_0xa2ad('0x27'),_0xa2ad('0x28'),_0xa2ad('0x29'),_0xa2ad('0x2a'),_0xa2ad('0x2b'),_0xa2ad('0x2c'),'dialNoSuchNumberRetryFrequency','dialDropMaxRetry',_0xa2ad('0x2d'),_0xa2ad('0x2e'),'dialAbandonedRetryFrequency',_0xa2ad('0x2f'),_0xa2ad('0x30'),'dialAgentRejectMaxRetry',_0xa2ad('0x31'),_0xa2ad('0x32'),_0xa2ad('0x33'),_0xa2ad('0x34')],'include':[{'model':_0xa2ad('0x35'),'as':'Trunk','attributes':['id',_0xa2ad('0x3'),_0xa2ad('0x36'),_0xa2ad('0x37')]},{'model':_0xa2ad('0x38'),'as':_0xa2ad('0x39'),'attributes':['id',_0xa2ad('0x3')]},{'model':'Trunk','as':'TrunkBackup','attributes':['id','name',_0xa2ad('0x36'),_0xa2ad('0x37')]},{'model':_0xa2ad('0x3a'),'as':_0xa2ad('0x3a'),'attributes':['id','name'],'include':[{'model':_0xa2ad('0x3a'),'as':_0xa2ad('0x3b'),'attributes':['id',_0xa2ad('0x3'),_0xa2ad('0x3c')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x6e43=['dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','callerid','active','Pause','Trunk','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acwTimeout','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6e43,0x14d));var _0x36e4=function(_0x189524,_0x4aba71){_0x189524=_0x189524-0x0;var _0xfd209d=_0x6e43[_0x189524];return _0xfd209d;};'use strict';var client=require(_0x36e4('0x0'));exports[_0x36e4('0x1')]=function(){return function(){return client[_0x36e4('0x2')](_0x36e4('0x3'),{'options':{'raw':![],'attributes':['id',_0x36e4('0x4'),'acw',_0x36e4('0x5'),_0x36e4('0x6'),_0x36e4('0x7'),_0x36e4('0x8'),'dialActive',_0x36e4('0x9'),_0x36e4('0xa'),_0x36e4('0xb'),_0x36e4('0xc'),_0x36e4('0xd'),_0x36e4('0xe'),_0x36e4('0xf'),_0x36e4('0x10'),_0x36e4('0x11'),'dialOriginateTimeout',_0x36e4('0x12'),_0x36e4('0x13'),'dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency',_0x36e4('0x14'),_0x36e4('0x15'),_0x36e4('0x16'),'dialNoAnswerRetryFrequency',_0x36e4('0x17'),_0x36e4('0x18'),'dialGlobalInterval','dialPrefix',_0x36e4('0x19'),_0x36e4('0x1a'),_0x36e4('0x1b'),'dialAMDGreeting',_0x36e4('0x1c'),_0x36e4('0x1d'),_0x36e4('0x1e'),_0x36e4('0x1f'),_0x36e4('0x20'),_0x36e4('0x21'),_0x36e4('0x22'),_0x36e4('0x23'),_0x36e4('0x24'),_0x36e4('0x25'),_0x36e4('0x26'),_0x36e4('0x27'),_0x36e4('0x28'),_0x36e4('0x29'),_0x36e4('0x7'),_0x36e4('0x2a'),_0x36e4('0x2b'),_0x36e4('0x2c'),_0x36e4('0x2d'),'dialNoSuchNumberRetryFrequency',_0x36e4('0x2e'),_0x36e4('0x2f'),_0x36e4('0x30'),_0x36e4('0x31'),_0x36e4('0x32'),_0x36e4('0x33'),_0x36e4('0x34'),_0x36e4('0x35'),'mandatoryDisposition',_0x36e4('0x36'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0x36e4('0x4'),_0x36e4('0x37'),_0x36e4('0x38')]},{'model':_0x36e4('0x39'),'as':'mandatoryDispositionPause','attributes':['id',_0x36e4('0x4')]},{'model':_0x36e4('0x3a'),'as':_0x36e4('0x3b'),'attributes':['id','name',_0x36e4('0x37'),_0x36e4('0x38')]},{'model':_0x36e4('0x3c'),'as':_0x36e4('0x3c'),'attributes':['id','name'],'include':[{'model':'Interval','as':_0x36e4('0x3d'),'attributes':['id',_0x36e4('0x4'),_0x36e4('0x3e')]}]}]},'log':_0x36e4('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 16627da..50f0ff3 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(_0x4983e4,_0x4305c2){var _0xc02957=function(_0x2e56ae){while(--_0x2e56ae){_0x4983e4['push'](_0x4983e4['shift']());}};_0xc02957(++_0x4305c2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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(_0x1e29bc,_0x41137d){var _0x5f1e3c=function(_0x4c9bac){while(--_0x4c9bac){_0x1e29bc['push'](_0x1e29bc['shift']());}};_0x5f1e3c(++_0x41137d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 99fa074..81243d3 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 _0x2d27=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','../client','Request'];(function(_0x1b2825,_0x1bb466){var _0x1a5b38=function(_0x19d00b){while(--_0x19d00b){_0x1b2825['push'](_0x1b2825['shift']());}};_0x1a5b38(++_0x1bb466);}(_0x2d27,0x162));var _0x72d2=function(_0x378752,_0x158b32){_0x378752=_0x378752-0x0;var _0xd5a262=_0x2d27[_0x378752];return _0xd5a262;};'use strict';var client=require(_0x72d2('0x0'));exports['getVoiceQueueRtPauses']=function(_0x2ffcbc){return function(){return client[_0x72d2('0x1')](_0x72d2('0x2'),{'options':{'where':{'VoiceQueueId':_0x2ffcbc,'paused':!![]},'raw':!![]},'log':_0x72d2('0x3')});};}; \ No newline at end of file +var _0x5e97=['../client','getVoiceQueueRtPauses'];(function(_0x526786,_0x105cbf){var _0x3a512d=function(_0x4efa05){while(--_0x4efa05){_0x526786['push'](_0x526786['shift']());}};_0x3a512d(++_0x105cbf);}(_0x5e97,0x160));var _0x75e9=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x5e97[_0x3bf83f];return _0x22c4a9;};'use strict';var client=require(_0x75e9('0x0'));exports['getVoiceQueueRtPauses']=function(_0x5f2da4){return function(){return client['Request']('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x5f2da4,'paused':!![]},'raw':!![]},'log':_0x75e9('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 6bfefe8..fa5842d 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(_0x5c452d,_0x63c5ee){var _0x3754f8=function(_0x33b6d4){while(--_0x33b6d4){_0x5c452d['push'](_0x5c452d['shift']());}};_0x3754f8(++_0x63c5ee);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x3380c7,_0x513df0){var _0x4a0da2=function(_0x36f493){while(--_0x36f493){_0x3380c7['push'](_0x3380c7['shift']());}};_0x4a0da2(++_0x513df0);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index a15b7b1..dc9a4d8 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 _0xa55b=['Request','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','secondtransfererexten','origtransfererlinkedid','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','transfers','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xa55b,0x158));var _0xba55=function(_0x5932a6,_0x5e890f){_0x5932a6=_0x5932a6-0x0;var _0x1eae0f=_0xa55b[_0x5932a6];return _0x1eae0f;};'use strict';var client=require('../client');exports[_0xba55('0x0')]={};exports['blindTransfer']=function(_0x11d4cb){return client['Request'](_0xba55('0x1'),{'body':{'result':_0x11d4cb[_0xba55('0x2')],'transfererchannel':_0x11d4cb[_0xba55('0x3')],'transferercalleridnum':_0x11d4cb[_0xba55('0x4')],'transferercalleridname':_0x11d4cb[_0xba55('0x5')],'transfererconnectedlinenum':_0x11d4cb[_0xba55('0x6')],'transfererconnectedlinename':_0x11d4cb['transfererconnectedlinename'],'transfereraccountcode':_0x11d4cb[_0xba55('0x7')],'transferercontext':_0x11d4cb[_0xba55('0x8')],'transfererexten':_0x11d4cb[_0xba55('0x9')],'transfererlinkedid':_0x11d4cb[_0xba55('0xa')],'transfereechannel':_0x11d4cb[_0xba55('0xb')],'transfereecalleridnum':_0x11d4cb[_0xba55('0xc')],'transfereecalleridname':_0x11d4cb[_0xba55('0xd')],'transfereeconnectedlinenum':_0x11d4cb[_0xba55('0xe')],'transfereeconnectedlinename':_0x11d4cb[_0xba55('0xf')],'transfereeaccountcode':_0x11d4cb[_0xba55('0x10')],'transfereecontext':_0x11d4cb[_0xba55('0x11')],'transfereeexten':_0x11d4cb[_0xba55('0x12')],'transfereelinkedid':_0x11d4cb[_0xba55('0x13')],'isexternal':_0x11d4cb[_0xba55('0x14')],'context':_0x11d4cb[_0xba55('0x15')],'extension':_0x11d4cb[_0xba55('0x16')],'type':_0xba55('0x17')},'log':'CreateVoiceTransferReport'});};exports[_0xba55('0x18')]=function(_0x976cf0){return client[_0xba55('0x19')](_0xba55('0x1'),{'body':{'result':_0x976cf0['result'],'transfererchannel':_0x976cf0[_0xba55('0x1a')],'transferercalleridnum':_0x976cf0[_0xba55('0x1b')],'transferercalleridname':_0x976cf0[_0xba55('0x1c')],'transfererconnectedlinenum':_0x976cf0['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x976cf0[_0xba55('0x1d')],'transfereraccountcode':_0x976cf0['origtransfereraccountcode'],'transferercontext':_0x976cf0['secondtransferercontext'],'transfererexten':_0x976cf0[_0xba55('0x1e')],'transfererlinkedid':_0x976cf0[_0xba55('0x1f')],'transfereechannel':_0x976cf0['transfertargetchannel'],'transfereecalleridnum':_0x976cf0['transfertargetcalleridnum'],'transfereecalleridname':_0x976cf0['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x976cf0[_0xba55('0x20')],'transfereeconnectedlinename':_0x976cf0[_0xba55('0x21')],'transfereeaccountcode':_0x976cf0[_0xba55('0x22')],'transfereecontext':_0x976cf0[_0xba55('0x23')],'transfereeexten':_0x976cf0[_0xba55('0x24')],'transfereelinkedid':_0x976cf0[_0xba55('0x25')],'isexternal':_0x976cf0[_0xba55('0x14')],'context':_0x976cf0[_0xba55('0x26')],'extension':_0x976cf0[_0xba55('0x27')],'type':_0xba55('0x28')},'log':_0xba55('0x1')});}; \ No newline at end of file +var _0x54c6=['transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext','attended'];(function(_0x174ac2,_0xa91d82){var _0x28ca76=function(_0xba7291){while(--_0xba7291){_0x174ac2['push'](_0x174ac2['shift']());}};_0x28ca76(++_0xa91d82);}(_0x54c6,0x7b));var _0x654c=function(_0x602f33,_0x26af94){_0x602f33=_0x602f33-0x0;var _0x3520b4=_0x54c6[_0x602f33];return _0x3520b4;};'use strict';var client=require('../client');exports[_0x654c('0x0')]={};exports[_0x654c('0x1')]=function(_0x5206b1){return client[_0x654c('0x2')](_0x654c('0x3'),{'body':{'result':_0x5206b1[_0x654c('0x4')],'transfererchannel':_0x5206b1[_0x654c('0x5')],'transferercalleridnum':_0x5206b1[_0x654c('0x6')],'transferercalleridname':_0x5206b1['transferercalleridname'],'transfererconnectedlinenum':_0x5206b1[_0x654c('0x7')],'transfererconnectedlinename':_0x5206b1['transfererconnectedlinename'],'transfereraccountcode':_0x5206b1[_0x654c('0x8')],'transferercontext':_0x5206b1[_0x654c('0x9')],'transfererexten':_0x5206b1[_0x654c('0xa')],'transfererlinkedid':_0x5206b1[_0x654c('0xb')],'transfereechannel':_0x5206b1[_0x654c('0xc')],'transfereecalleridnum':_0x5206b1[_0x654c('0xd')],'transfereecalleridname':_0x5206b1[_0x654c('0xe')],'transfereeconnectedlinenum':_0x5206b1[_0x654c('0xf')],'transfereeconnectedlinename':_0x5206b1[_0x654c('0x10')],'transfereeaccountcode':_0x5206b1[_0x654c('0x11')],'transfereecontext':_0x5206b1[_0x654c('0x12')],'transfereeexten':_0x5206b1[_0x654c('0x13')],'transfereelinkedid':_0x5206b1[_0x654c('0x14')],'isexternal':_0x5206b1[_0x654c('0x15')],'context':_0x5206b1[_0x654c('0x16')],'extension':_0x5206b1['extension'],'type':'blind'},'log':_0x654c('0x3')});};exports['attendedTransfer']=function(_0x34e9de){return client['Request'](_0x654c('0x3'),{'body':{'result':_0x34e9de[_0x654c('0x4')],'transfererchannel':_0x34e9de[_0x654c('0x17')],'transferercalleridnum':_0x34e9de[_0x654c('0x18')],'transferercalleridname':_0x34e9de[_0x654c('0x19')],'transfererconnectedlinenum':_0x34e9de[_0x654c('0x1a')],'transfererconnectedlinename':_0x34e9de[_0x654c('0x1b')],'transfereraccountcode':_0x34e9de[_0x654c('0x1c')],'transferercontext':_0x34e9de[_0x654c('0x1d')],'transfererexten':_0x34e9de[_0x654c('0x1e')],'transfererlinkedid':_0x34e9de['origtransfererlinkedid'],'transfereechannel':_0x34e9de[_0x654c('0x1f')],'transfereecalleridnum':_0x34e9de[_0x654c('0x20')],'transfereecalleridname':_0x34e9de[_0x654c('0x21')],'transfereeconnectedlinenum':_0x34e9de[_0x654c('0x22')],'transfereeconnectedlinename':_0x34e9de[_0x654c('0x23')],'transfereeaccountcode':_0x34e9de[_0x654c('0x24')],'transfereecontext':_0x34e9de[_0x654c('0x25')],'transfereeexten':_0x34e9de[_0x654c('0x26')],'transfereelinkedid':_0x34e9de['transfertargetlinkedid'],'isexternal':_0x34e9de[_0x654c('0x15')],'context':_0x34e9de[_0x654c('0x27')],'extension':_0x34e9de['origtransfererexten'],'type':_0x654c('0x28')},'log':_0x654c('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index fe03a97..e273808 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 _0x964b=['AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','validate','bluebird','moment','../ami','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','QueuePause','isConnected','error','asterisk','username','join','module','action','Reload','Action','then','message','catch','ami\x20disconnected','pick','Command','content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','talking','total','type','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','omit','undefined','values','channels','voicechannel','find','uniqueid','channel','format','%s.%s','filename','wav','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','context','telephones','trunks','outboundChannels','campaigns','run','Event\x20name\x20mandatory','emit','custom:','event','faxAccounts','send','http','log'];(function(_0x23929e,_0x1f468c){var _0x2f9a6e=function(_0x390e26){while(--_0x390e26){_0x23929e['push'](_0x23929e['shift']());}};_0x2f9a6e(++_0x1f468c);}(_0x964b,0x112));var _0xb964=function(_0x541423,_0x365b30){_0x541423=_0x541423-0x0;var _0x159750=_0x964b[_0x541423];return _0x159750;};'use strict';var _=require(_0xb964('0x0'));var util=require(_0xb964('0x1'));var jayson=require('jayson/promise');var schema=require(_0xb964('0x2'));var BPromise=require(_0xb964('0x3'));var moment=require(_0xb964('0x4'));var config=require('../../../config/environment');var properties=require('../properties');var ami=require(_0xb964('0x5'));exports['listen']=function(_0x4760b2,_0x249313,_0xba9f19){return new BPromise(function(_0x11a0c1,_0x204c7d){var _0xde47d5={'QueuePause':function(_0x3fe401){return new Promise(function(_0x53b463,_0x58e49e){var _0x3a3006=util['format']('%s/%s',_0xb964('0x6'),_0x3fe401[_0xb964('0x7')]);if(_0x4760b2[_0xb964('0x8')]&&_0x4760b2[_0xb964('0x8')][_0x3a3006]&&_0x4760b2[_0xb964('0x8')][_0x3a3006][_0xb964('0x9')]){_0x4760b2['timers'][_0x3a3006][_0xb964('0xa')]();}if(_0x4760b2[_0xb964('0xb')][_0x3a3006]){_0x4760b2[_0xb964('0xb')][_0x3a3006][_0xb964('0xc')]({'statePause':_0x3fe401['pause']?!![]:![]});}_0x53b463({'code':0xc8,'message':_0xb964('0xd')});});},'Reload':function(_0x4ddf60){var _0x556533=this;return new Promise(function(_0x3ce73e,_0x256e02){if(ami[_0xb964('0xe')]()==![]){return _0x256e02(_0x556533[_0xb964('0xf')](0x1f4,[config[_0xb964('0x10')]['ip'],config[_0xb964('0x10')][_0xb964('0x11')],'ami\x20disconnected'][_0xb964('0x12')]('\x20')));}_0x4ddf60=_['pick'](_0x4ddf60,_['keys'](properties[_0xb964('0x13')]));_0x4ddf60[_0xb964('0x14')]=_0xb964('0x15');return ami[_0xb964('0x16')](_0x4ddf60)[_0xb964('0x17')](function(_0x43309f){_0x3ce73e({'code':0xc8,'message':_0x43309f[_0xb964('0x18')]});})[_0xb964('0x19')](function(_0x2bd9d5){_0x256e02(_0x556533['error'](0x1f5,_0x2bd9d5['message']));});});},'Command':function(_0x49a066){var _0x2f5068=this;return new Promise(function(_0x42e78e,_0x209075){if(ami[_0xb964('0xe')]()==![]){return _0x209075(_0x2f5068[_0xb964('0xf')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0xb964('0x1a')][_0xb964('0x12')]('\x20')));}_0x49a066=_[_0xb964('0x1b')](_0x49a066,'command');_0x49a066[_0xb964('0x14')]=_0xb964('0x1c');return ami[_0xb964('0x16')](_0x49a066)['then'](function(_0x486d66){_0x42e78e({'code':0xc8,'message':_0x486d66[_0xb964('0x1d')]});})['catch'](function(_0x14dece){_0x209075(_0x2f5068[_0xb964('0xf')](0x1f5,_0x14dece[_0xb964('0x18')]));});});},'VoiceQueues':function(_0x446e1b){return new Promise(function(_0x51257e,_0x1cecce){var _0x1d9dcd=[];for(var _0x2801dd in _0x4760b2[_0xb964('0x1e')]){if(_0x4760b2[_0xb964('0x1e')][_0xb964('0x1f')](_0x2801dd)){var _0x13d94d=_0x4760b2[_0xb964('0x1e')][_0x2801dd];var _0x142f76={'id':_0x13d94d['id'],'name':_0x13d94d['name'],'strategy':_0x13d94d[_0xb964('0x20')],'answered':_0x13d94d[_0xb964('0x21')],'available':_0x13d94d[_0xb964('0x22')],'loggedIn':_0x13d94d[_0xb964('0x23')],'pTalking':_0x13d94d[_0xb964('0x24')],'sumBillable':_0x13d94d[_0xb964('0x25')],'sumDuration':_0x13d94d[_0xb964('0x26')],'sumHoldTime':_0x13d94d['sumHoldTime']||0x0,'talking':_0x13d94d[_0xb964('0x27')],'total':_0x13d94d[_0xb964('0x28')],'type':_0x13d94d[_0xb964('0x29')],'unmanaged':_0x13d94d['unmanaged'],'abandoned':_0x13d94d[_0xb964('0x2a')],'waiting':_0x13d94d[_0xb964('0x2b')],'loggedInDb':_0x13d94d[_0xb964('0x2c')]};if(_0x13d94d[_0xb964('0x29')]===_0xb964('0x2d')){_0x142f76[_0xb964('0x2e')]=_0x13d94d['dialActive'];_0x142f76['dialMethod']=_0x13d94d[_0xb964('0x2f')];_0x142f76[_0xb964('0x30')]=_0x13d94d[_0xb964('0x30')];_0x142f76[_0xb964('0x31')]=_0x13d94d['dialOriginateCallerIdNumber'];_0x142f76[_0xb964('0x32')]=_0x13d94d['dialOriginateTimeout'];_0x142f76[_0xb964('0x33')]=_0x13d94d[_0xb964('0x33')];_0x142f76['temp']=_0x13d94d['temp'];_0x142f76[_0xb964('0x34')]=_0x13d94d[_0xb964('0x34')];_0x142f76[_0xb964('0x35')]=_0x13d94d[_0xb964('0x35')];_0x142f76[_0xb964('0x36')]=_0x13d94d[_0xb964('0x36')];_0x142f76['outboundBusyCallsDay']=_0x13d94d['outboundBusyCallsDay'];_0x142f76['outboundCongestionCallsDay']=_0x13d94d[_0xb964('0x37')];_0x142f76[_0xb964('0x38')]=_0x13d94d[_0xb964('0x38')];_0x142f76[_0xb964('0x39')]=_0x13d94d[_0xb964('0x39')];_0x142f76[_0xb964('0x3a')]=_0x13d94d['outboundDropCallsDayTimeout'];_0x142f76['outboundNoAnswerCallsDay']=_0x13d94d[_0xb964('0x3b')];_0x142f76[_0xb964('0x3c')]=_0x13d94d[_0xb964('0x3c')];_0x142f76[_0xb964('0x3d')]=_0x13d94d[_0xb964('0x3d')];_0x142f76['outboundReCallsDay']=_0x13d94d[_0xb964('0x3e')];_0x142f76[_0xb964('0x3f')]=_0x13d94d[_0xb964('0x3f')];_0x142f76[_0xb964('0x40')]=_0x13d94d[_0xb964('0x40')];_0x142f76[_0xb964('0x41')]=_0x13d94d[_0xb964('0x41')];_0x142f76['predictiveIntervalAvgHoldtime']=_0x13d94d[_0xb964('0x42')];_0x142f76['predictiveIntervalAvgTalktime']=_0x13d94d[_0xb964('0x43')];_0x142f76['predictiveIntervalDroppedCallsCallersExit']=_0x13d94d[_0xb964('0x44')];_0x142f76[_0xb964('0x45')]=_0x13d94d['predictiveIntervalDroppedCallsTimeout'];_0x142f76['predictiveIntervalErlangCalls']=_0x13d94d[_0xb964('0x46')];_0x142f76[_0xb964('0x47')]=_0x13d94d[_0xb964('0x47')];_0x142f76[_0xb964('0x48')]=_0x13d94d[_0xb964('0x48')];_0x142f76['predictiveIntervalMultiplicativeFactor']=_0x13d94d[_0xb964('0x49')];_0x142f76[_0xb964('0x4a')]=_0x13d94d[_0xb964('0x4a')];_0x142f76['predictiveIntervalAvailable']=_0x13d94d[_0xb964('0x4b')];_0x142f76[_0xb964('0x4c')]=_0x13d94d[_0xb964('0x4c')];_0x142f76[_0xb964('0x18')]=_0x13d94d[_0xb964('0x18')];_0x142f76['originated']=_0x13d94d[_0xb964('0x4d')];_0x142f76[_0xb964('0x4e')]=_0x13d94d['erlangCalls'];_0x142f76[_0xb964('0x4f')]=_0x13d94d[_0xb964('0x4f')];_0x142f76[_0xb964('0x50')]=_0x13d94d[_0xb964('0x50')];_0x142f76['erlangBusyFactor']=_0x13d94d['erlangBusyFactor'];_0x142f76[_0xb964('0x51')]=_0x13d94d[_0xb964('0x51')];_0x142f76[_0xb964('0x52')]=_0x13d94d[_0xb964('0x52')];}if(_0x13d94d[_0xb964('0x53')]){_0x142f76[_0xb964('0x53')]={'id':_0x13d94d[_0xb964('0x53')]['id'],'name':_0x13d94d[_0xb964('0x53')]['name'],'active':_0x13d94d[_0xb964('0x53')]['active'],'callerid':_0x13d94d[_0xb964('0x53')][_0xb964('0x54')]};}if(_0x13d94d[_0xb964('0x55')]){_0x142f76['Interval']={'id':_0x13d94d[_0xb964('0x55')]['id'],'name':_0x13d94d[_0xb964('0x55')][_0xb964('0x7')]};}_0x1d9dcd[_0xb964('0x56')](_0x142f76);}}_0x51257e({'count':_0x1d9dcd[_0xb964('0x57')],'rows':_0x1d9dcd});});},'UpdateVoiceQueue':function(_0x3d6df5){return new Promise(function(_0x43c3b0,_0x30bbe9){var _0x1b1709=_['find'](_0x4760b2['voiceQueues'],{'id':parseInt(_0x3d6df5['id'])});var _0x4cbdca=_[_0xb964('0x58')](_0x3d6df5,['id']);if(_0x1b1709){for(var _0xe4e024 in _0x4cbdca){if(typeof _0x4cbdca[_0xe4e024]!=='undefined'&&typeof _0x1b1709[_0xe4e024]!==_0xb964('0x59')){_0x1b1709[_0xe4e024]=_0x4cbdca[_0xe4e024];}}_0x43c3b0(_0x1b1709);}else{_0x30bbe9();}});},'VoiceChannels':function(_0x2b9ec9){return new Promise(function(_0x516228,_0x58f7d1){var _0x343942=_[_0xb964('0x5a')](_0x4760b2[_0xb964('0x5b')]);_0x516228({'count':_0x343942[_0xb964('0x57')],'rows':_0x343942});});},'VoiceChannelMixMonitor':function(_0x4f1129){var _0x3bacfc=this;return new Promise(function(_0x52fbe7,_0x2cbbed){if(ami[_0xb964('0xe')]()==![]){return _0x2cbbed(_0x3bacfc[_0xb964('0xf')](0x1f4,[config[_0xb964('0x10')]['ip'],config[_0xb964('0x10')][_0xb964('0x11')],_0xb964('0x1a')][_0xb964('0x12')]('\x20')));}var _0x591a20=schema(properties[_0xb964('0x5c')])[_0xb964('0x2')](_0x4f1129);if(_0x591a20[_0xb964('0x57')]>0x0){return _0x2cbbed(_0x3bacfc[_0xb964('0xf')](0x1f4,_['map'](_0x591a20,_0xb964('0x18'))[_0xb964('0x12')](',\x20')));}var _0x1759bc=_[_0xb964('0x5d')](_0x4760b2[_0xb964('0x5b')],{'uniqueid':_0x4f1129[_0xb964('0x5e')]});if(_0x1759bc&&_0x1759bc[_0xb964('0x5f')]){var _0x27e73b=util[_0xb964('0x60')](_0xb964('0x61'),_0x4f1129[_0xb964('0x62')]||_0x4f1129[_0xb964('0x5e')],_0x4f1129[_0xb964('0x60')]||_0xb964('0x63'));return ami[_0xb964('0x16')]({'action':'MixMonitor','channel':_0x1759bc[_0xb964('0x5f')],'file':_0x27e73b,'options':'ai(mixmonitorid)'})[_0xb964('0x17')](function(_0x42b5ed){var _0x2344cb=_[_0xb964('0x5d')](_0x1759bc['monitors'],{'filename':_0xb964('0x64')+_0x27e73b[_0xb964('0x65')]()});if(_[_0xb964('0x66')](_0x2344cb)){_0x1759bc[_0xb964('0x67')][_0xb964('0x56')]({'filename':'/var/spool/asterisk/monitor/'+_0x27e73b['toLowerCase'](),'createdAt':moment()[_0xb964('0x60')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x42b5ed[_0xb964('0x68')],'status':_0xb964('0x69')});}else{_0x2344cb['mixmonitorid']=_0x42b5ed[_0xb964('0x68')];_0x2344cb[_0xb964('0x6a')]='rec';}_0x52fbe7({'code':0xc8,'message':[_0x4f1129[_0xb964('0x5e')],_0xb964('0x6b'),_0x42b5ed['mixmonitorid']][_0xb964('0x12')]('\x20'),'mixmonitorid':_0x42b5ed['mixmonitorid']});})[_0xb964('0x19')](function(_0x214430){_0x2cbbed(_0x3bacfc[_0xb964('0xf')](0x1f5,[_0x4f1129[_0xb964('0x5e')],_0x214430[_0xb964('0x18')][_0xb964('0x65')]()][_0xb964('0x12')]('\x20')));});}else{return _0x2cbbed(_0x3bacfc['error'](0x1f5,_0xb964('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0x56276c){var _0x3f3b42=this;return new Promise(function(_0x584934,_0x21c239){if(ami[_0xb964('0xe')]()==![]){return _0x21c239(_0x3f3b42[_0xb964('0xf')](0x1f4,[config[_0xb964('0x10')]['ip'],config[_0xb964('0x10')][_0xb964('0x11')],'ami\x20disconnected'][_0xb964('0x12')]('\x20')));}var _0xd527bb=schema(properties['voicechannel'])[_0xb964('0x2')](_0x56276c);if(_0xd527bb[_0xb964('0x57')]>0x0){return _0x21c239(_0x3f3b42['error'](0x1f4,_[_0xb964('0x6d')](_0xd527bb,_0xb964('0x18'))[_0xb964('0x12')](',\x20')));}var _0x5f0877=_[_0xb964('0x5d')](_0x4760b2[_0xb964('0x5b')],{'uniqueid':_0x56276c[_0xb964('0x5e')]});if(_0x5f0877){return BPromise[_0xb964('0x6e')]()[_0xb964('0x17')](function(){if(_0x5f0877[_0xb964('0x5f')]){return ami[_0xb964('0x16')]({'action':_0xb964('0x6f'),'channel':_0x5f0877[_0xb964('0x5f')],'mixmonitorid':_0x56276c['mixmonitorid']})[_0xb964('0x19')](function(_0x5214d8){});}})['then'](function(){if(_0x5f0877[_0xb964('0x70')]){return ami['Action']({'action':_0xb964('0x6f'),'channel':_0x5f0877[_0xb964('0x70')],'mixmonitorid':_0x56276c[_0xb964('0x68')]})['catch'](function(_0x157805){});}})[_0xb964('0x17')](function(_0x59b558){var _0xfbdc9=_[_0xb964('0x5d')](_0x5f0877[_0xb964('0x67')],{'mixmonitorid':_0x56276c['mixmonitorid']});if(_0xfbdc9){_0xfbdc9[_0xb964('0x6a')]='stop';}})[_0xb964('0x17')](function(){var _0x4c59ef=util[_0xb964('0x60')](_0xb964('0x61'),_0x56276c[_0xb964('0x62')]||_0x56276c[_0xb964('0x5e')],_0x56276c['format']||_0xb964('0x63'));var _0x55698f=_[_0xb964('0x5d')](_0x5f0877[_0xb964('0x67')],{'filename':_0xb964('0x64')+_0x4c59ef[_0xb964('0x65')]()});if(_0x55698f){_0x55698f['status']=_0xb964('0x71');}})[_0xb964('0x17')](function(){_0x584934({'code':0xc8,'message':[_0x56276c[_0xb964('0x5e')],_0xb964('0x72')][_0xb964('0x12')]('\x20')});})[_0xb964('0x19')](function(_0xcd064b){_0x21c239(_0x3f3b42[_0xb964('0xf')](0x1f5,[_0x56276c[_0xb964('0x5e')],_0xcd064b[_0xb964('0x18')]['toLowerCase']()][_0xb964('0x12')]('\x20')));});}else{return _0x21c239(_0x3f3b42[_0xb964('0xf')](0x1f5,_0xb964('0x6c')));}});},'VoiceQueuesChannels':function(_0x31589a){return new Promise(function(_0x289901,_0x4580a2){var _0x3e837e=_[_0xb964('0x5a')](_0x4760b2[_0xb964('0x73')]);_0x289901({'count':_0x3e837e[_0xb964('0x57')],'rows':_0x3e837e});});},'VoiceQueuesChannel':function(_0x14ae72){var _0x4c754e=this;return new Promise(function(_0x5e9151,_0x1aada6){var _0x444121=schema(properties[_0xb964('0x74')])['validate'](_0x14ae72);if(_0x444121[_0xb964('0x57')]>0x0){return _0x1aada6(_0x4c754e['error'](0x1f4,_[_0xb964('0x6d')](_0x444121,'message')[_0xb964('0x12')](',\x20')));}var _0x206fc8=_[_0xb964('0x5d')](_0x4760b2[_0xb964('0x73')],{'uniqueid':_0x14ae72[_0xb964('0x5e')]});if(_0x206fc8){_0x5e9151(_0x206fc8);}else{return _0x1aada6(_0x4c754e['error'](0x1f5,_0xb964('0x6c')));}});},'VoiceQueuesChannelHangup':function(_0x4a2ebf){var _0x4e8dae=this;return new Promise(function(_0x2803dc,_0x5a9d2b){if(ami[_0xb964('0xe')]()==![]){return _0x5a9d2b(_0x4e8dae['error'](0x1f4,[config[_0xb964('0x10')]['ip'],config[_0xb964('0x10')][_0xb964('0x11')],_0xb964('0x1a')]['join']('\x20')));}var _0x3d95e9=schema(properties[_0xb964('0x75')])[_0xb964('0x2')](_0x4a2ebf);if(_0x3d95e9[_0xb964('0x57')]>0x0){return _0x5a9d2b(_0x4e8dae['error'](0x1f4,_[_0xb964('0x6d')](_0x3d95e9,_0xb964('0x18'))['join'](',\x20')));}var _0x2f7d9e=_[_0xb964('0x5d')](_0x4760b2['queueChannels'],{'uniqueid':_0x4a2ebf['uniqueid']});if(_0x2f7d9e&&_0x2f7d9e[_0xb964('0x5f')]){return ami[_0xb964('0x16')]({'action':'Hangup','channel':_0x2f7d9e[_0xb964('0x5f')]})[_0xb964('0x17')](function(_0x26ce8f){_0x2803dc({'code':0xc8,'message':[_0x4a2ebf[_0xb964('0x5e')],_0x26ce8f['message'][_0xb964('0x65')]()][_0xb964('0x12')]('\x20')});})[_0xb964('0x19')](function(_0x45b6d8){_0x5a9d2b(_0x4e8dae[_0xb964('0xf')](0x1f5,[_0x4a2ebf['uniqueid'],_0x45b6d8['message'][_0xb964('0x65')]()][_0xb964('0x12')]('\x20')));});}else{return _0x5a9d2b(_0x4e8dae[_0xb964('0xf')](0x1f5,_0xb964('0x6c')));}});},'VoiceQueuesChannelRedirect':function(_0x1c8e7b){var _0x3d3584=this;return new Promise(function(_0x55ef89,_0x2d88e2){if(ami[_0xb964('0xe')]()==![]){return _0x2d88e2(_0x3d3584[_0xb964('0xf')](0x1f4,[config[_0xb964('0x10')]['ip'],config['asterisk']['username'],_0xb964('0x1a')][_0xb964('0x12')]('\x20')));}var _0x12266b=schema(properties[_0xb964('0x76')])[_0xb964('0x2')](_0x1c8e7b);if(_0x12266b['length']>0x0){return _0x2d88e2(_0x3d3584[_0xb964('0xf')](0x1f4,_[_0xb964('0x6d')](_0x12266b,_0xb964('0x18'))[_0xb964('0x12')](',\x20')));}var _0x377539=_[_0xb964('0x5d')](_0x4760b2[_0xb964('0x73')],{'uniqueid':_0x1c8e7b[_0xb964('0x5e')]});if(_0x377539&&_0x377539[_0xb964('0x5f')]){return ami['Action']({'action':_0xb964('0x77'),'channel':_0x377539[_0xb964('0x5f')],'exten':_0x1c8e7b['exten'],'context':_0x1c8e7b['context']||_0x377539[_0xb964('0x78')],'priority':0x1})[_0xb964('0x17')](function(_0x4348f7){_0x55ef89({'code':0xc8,'message':[_0x1c8e7b[_0xb964('0x5e')],_0x4348f7[_0xb964('0x18')][_0xb964('0x65')]()]['join']('\x20')});})['catch'](function(_0x37a420){_0x2d88e2(_0x3d3584[_0xb964('0xf')](0x1f5,[_0x1c8e7b['uniqueid'],_0x37a420[_0xb964('0x18')][_0xb964('0x65')]()]['join']('\x20')));});}else{return _0x2d88e2(_0x3d3584[_0xb964('0xf')](0x1f5,_0xb964('0x6c')));}});},'Agents':function(_0x36c47d){return new Promise(function(_0x3298ad,_0x1868a5){var _0x228b25=_[_0xb964('0x5a')](_0x4760b2[_0xb964('0xb')]);_0x3298ad({'count':_0x228b25[_0xb964('0x57')],'rows':_0x228b25});});},'Telephones':function(_0x367eb8){return new Promise(function(_0x49707f,_0x541323){var _0x20c4f9=_[_0xb964('0x5a')](_0x4760b2[_0xb964('0x79')]);_0x49707f({'count':_0x20c4f9['length'],'rows':_0x20c4f9});});},'Trunks':function(_0x4a76f7){return new Promise(function(_0x4d1b94,_0x1e0889){var _0x2ba9e5=_[_0xb964('0x5a')](_0x4760b2[_0xb964('0x7a')]);_0x4d1b94({'count':_0x2ba9e5[_0xb964('0x57')],'rows':_0x2ba9e5});});},'OutboundChannels':function(_0x3bc89e){return new Promise(function(_0x4a46e0,_0x2c636c){var _0x4dbe07=_[_0xb964('0x5a')](_0x4760b2[_0xb964('0x7b')]);_0x4a46e0({'count':_0x4dbe07['length'],'rows':_0x4dbe07});});},'Outbound':function(_0xa63621){return new Promise(function(_0x466f12,_0x3ace12){_0x466f12(_0x4760b2[_0xb964('0x2d')]);});},'Campaigns':function(_0x28ab60){return new Promise(function(_0x53c7d0,_0x1dada2){var _0x15f7a8=_[_0xb964('0x5a')](_0x4760b2[_0xb964('0x7c')]);_0x53c7d0({'count':_0x15f7a8[_0xb964('0x57')],'rows':_0x15f7a8});});},'VoiceQueuesPreview':function(_0x1e336a){var _0x407ff7=this;return new Promise(function(_0x5f2b05,_0x12d7c0){_0x249313[_0xb964('0x7d')](_0x1e336a['id'])[_0xb964('0x17')](function(_0x26a401){_0x5f2b05({'code':0xc8,'message':_0x26a401[_0xb964('0x18')]});})[_0xb964('0x19')](function(_0x307b35){_0x12d7c0(_0x407ff7[_0xb964('0xf')](0x1f4,_0x307b35['message']));});});},'EventManager':function(_0x5419d3){var _0xeed18c=this;return new Promise(function(_0x1ea23a,_0x5b3c1d){if(!_0x5419d3['event']){return _0x5b3c1d(_0xeed18c[_0xb964('0xf')](0x1f4,_0xb964('0x7e')));}ami[_0xb964('0x7f')](_0xb964('0x80')+_0x5419d3[_0xb964('0x81')],_0x5419d3[_0xb964('0x18')]);_0x1ea23a({'code':0xc8,'message':_0x5419d3});});},'FaxAccounts':function(_0x208c09){return new Promise(function(_0x13816f,_0x34007a){var _0x4ab081=_[_0xb964('0x5a')](_0x4760b2[_0xb964('0x82')]);_0x13816f({'count':_0x4ab081[_0xb964('0x57')],'rows':_0x4ab081});});},'SendFax':function(_0x360036){var _0x2e7ad8=this;return new Promise(function(_0x20026a,_0x501ba9){_0xba9f19[_0xb964('0x83')](_0x360036)[_0xb964('0x17')](function(_0x403c84){_0x20026a({'code':0xc8,'message':_0x403c84[_0xb964('0x18')]});})['catch'](function(_0x9b630a){_0x501ba9(_0x2e7ad8[_0xb964('0xf')](0x1f4,_0x9b630a[_0xb964('0x18')]));});});},'CheckAfterSend':function(_0x534578){var _0xfcfaba=this;return new Promise(function(_0x2321f4,_0x4bc8ed){_0xba9f19['checkAfterSend'](_0x534578)[_0xb964('0x17')](function(_0x221010){_0x2321f4({'code':0xc8,'message':_0x221010[_0xb964('0x18')]});})[_0xb964('0x19')](function(_0x354c3){_0x4bc8ed(_0xfcfaba['error'](0x1f4,_0x354c3['message']));});});}};var _0x22bbb1=jayson['server'](_0xde47d5)[_0xb964('0x84')]();_0x22bbb1['on'](_0xb964('0xf'),function(_0x2ec697){return _0x204c7d(_0x2ec697);});_0x22bbb1['listen'](0x232a,'127.0.0.1',function(){console[_0xb964('0x85')](_0xb964('0x86'),0x232a);return _0x11a0c1(_0xb964('0x87')+0x232a);});});}; \ No newline at end of file +var _0x9505=['omit','undefined','values','channels','voicechannel','map','find','filename','uniqueid','wav','Action','MixMonitor','ai(mixmonitorid)','monitors','toLowerCase','isNil','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','channel','destinationchannel','StopMixMonitor','stop','%s.%s','StopMixMonitor\x20Success','queueChannels','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','context','telephones','trunks','campaigns','run','event','emit','custom:','faxAccounts','send','checkAfterSend','server','listen','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','validate','bluebird','moment','../../../config/environment','../properties','format','%s/%s','SIP','name','timers','timer','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','message','catch','command','Command','then','content','voiceQueues','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length'];(function(_0x2f3b86,_0x1fffad){var _0x9741a0=function(_0x654b64){while(--_0x654b64){_0x2f3b86['push'](_0x2f3b86['shift']());}};_0x9741a0(++_0x1fffad);}(_0x9505,0x1e5));var _0x5950=function(_0x2ae20a,_0x634591){_0x2ae20a=_0x2ae20a-0x0;var _0x3c864d=_0x9505[_0x2ae20a];return _0x3c864d;};'use strict';var _=require(_0x5950('0x0'));var util=require(_0x5950('0x1'));var jayson=require('jayson/promise');var schema=require(_0x5950('0x2'));var BPromise=require(_0x5950('0x3'));var moment=require(_0x5950('0x4'));var config=require(_0x5950('0x5'));var properties=require(_0x5950('0x6'));var ami=require('../ami');exports['listen']=function(_0x2494fc,_0x43f5b6,_0x3ac153){return new BPromise(function(_0x3a5973,_0x4aa518){var _0x4b9478={'QueuePause':function(_0x425d17){return new Promise(function(_0x362f04,_0x3986aa){var _0x16f0e9=util[_0x5950('0x7')](_0x5950('0x8'),_0x5950('0x9'),_0x425d17[_0x5950('0xa')]);if(_0x2494fc[_0x5950('0xb')]&&_0x2494fc['timers'][_0x16f0e9]&&_0x2494fc[_0x5950('0xb')][_0x16f0e9][_0x5950('0xc')]){_0x2494fc['timers'][_0x16f0e9]['updateAcw']();}if(_0x2494fc[_0x5950('0xd')][_0x16f0e9]){_0x2494fc[_0x5950('0xd')][_0x16f0e9][_0x5950('0xe')]({'statePause':_0x425d17[_0x5950('0xf')]?!![]:![]});}_0x362f04({'code':0xc8,'message':_0x5950('0x10')});});},'Reload':function(_0x2bf7ae){var _0x17c263=this;return new Promise(function(_0x38d757,_0x409092){if(ami[_0x5950('0x11')]()==![]){return _0x409092(_0x17c263[_0x5950('0x12')](0x1f4,[config[_0x5950('0x13')]['ip'],config[_0x5950('0x13')][_0x5950('0x14')],_0x5950('0x15')][_0x5950('0x16')]('\x20')));}_0x2bf7ae=_[_0x5950('0x17')](_0x2bf7ae,_[_0x5950('0x18')](properties[_0x5950('0x19')]));_0x2bf7ae[_0x5950('0x1a')]=_0x5950('0x1b');return ami['Action'](_0x2bf7ae)['then'](function(_0x30e759){_0x38d757({'code':0xc8,'message':_0x30e759[_0x5950('0x1c')]});})[_0x5950('0x1d')](function(_0x5a9530){_0x409092(_0x17c263[_0x5950('0x12')](0x1f5,_0x5a9530['message']));});});},'Command':function(_0x49bb78){var _0x119f1f=this;return new Promise(function(_0x2ada72,_0x1ad343){if(ami['isConnected']()==![]){return _0x1ad343(_0x119f1f[_0x5950('0x12')](0x1f4,[config[_0x5950('0x13')]['ip'],config['asterisk']['username'],'ami\x20disconnected']['join']('\x20')));}_0x49bb78=_[_0x5950('0x17')](_0x49bb78,_0x5950('0x1e'));_0x49bb78[_0x5950('0x1a')]=_0x5950('0x1f');return ami['Action'](_0x49bb78)[_0x5950('0x20')](function(_0x3c58f4){_0x2ada72({'code':0xc8,'message':_0x3c58f4[_0x5950('0x21')]});})[_0x5950('0x1d')](function(_0x4757fd){_0x1ad343(_0x119f1f[_0x5950('0x12')](0x1f5,_0x4757fd[_0x5950('0x1c')]));});});},'VoiceQueues':function(_0x4b64a2){return new Promise(function(_0x4d9317,_0x1b2265){var _0x32c197=[];for(var _0x545354 in _0x2494fc[_0x5950('0x22')]){if(_0x2494fc[_0x5950('0x22')]['hasOwnProperty'](_0x545354)){var _0x4a7b22=_0x2494fc['voiceQueues'][_0x545354];var _0x20679e={'id':_0x4a7b22['id'],'name':_0x4a7b22[_0x5950('0xa')],'strategy':_0x4a7b22[_0x5950('0x23')],'answered':_0x4a7b22[_0x5950('0x24')],'available':_0x4a7b22[_0x5950('0x25')],'loggedIn':_0x4a7b22[_0x5950('0x26')],'pTalking':_0x4a7b22[_0x5950('0x27')],'sumBillable':_0x4a7b22[_0x5950('0x28')],'sumDuration':_0x4a7b22[_0x5950('0x29')],'sumHoldTime':_0x4a7b22[_0x5950('0x2a')]||0x0,'talking':_0x4a7b22[_0x5950('0x2b')],'total':_0x4a7b22[_0x5950('0x2c')],'type':_0x4a7b22[_0x5950('0x2d')],'unmanaged':_0x4a7b22[_0x5950('0x2e')],'abandoned':_0x4a7b22[_0x5950('0x2f')],'waiting':_0x4a7b22[_0x5950('0x30')],'loggedInDb':_0x4a7b22[_0x5950('0x31')]};if(_0x4a7b22[_0x5950('0x2d')]===_0x5950('0x32')){_0x20679e[_0x5950('0x33')]=_0x4a7b22[_0x5950('0x33')];_0x20679e[_0x5950('0x34')]=_0x4a7b22[_0x5950('0x34')];_0x20679e[_0x5950('0x35')]=_0x4a7b22[_0x5950('0x35')];_0x20679e[_0x5950('0x36')]=_0x4a7b22[_0x5950('0x36')];_0x20679e[_0x5950('0x37')]=_0x4a7b22['dialOriginateTimeout'];_0x20679e[_0x5950('0x38')]=_0x4a7b22[_0x5950('0x38')];_0x20679e[_0x5950('0x39')]=_0x4a7b22[_0x5950('0x39')];_0x20679e[_0x5950('0x3a')]=_0x4a7b22['outboundAnswerAgiCallsDay'];_0x20679e['outboundAnswerCallsDay']=_0x4a7b22[_0x5950('0x3b')];_0x20679e[_0x5950('0x3c')]=_0x4a7b22['outboundBlacklistCallsDay'];_0x20679e[_0x5950('0x3d')]=_0x4a7b22['outboundBusyCallsDay'];_0x20679e[_0x5950('0x3e')]=_0x4a7b22[_0x5950('0x3e')];_0x20679e[_0x5950('0x3f')]=_0x4a7b22['outboundDropCallsDayACS'];_0x20679e[_0x5950('0x40')]=_0x4a7b22['outboundDropCallsDayCallersExit'];_0x20679e[_0x5950('0x41')]=_0x4a7b22[_0x5950('0x41')];_0x20679e[_0x5950('0x42')]=_0x4a7b22[_0x5950('0x42')];_0x20679e['outboundNoSuchCallsDay']=_0x4a7b22[_0x5950('0x43')];_0x20679e[_0x5950('0x44')]=_0x4a7b22[_0x5950('0x44')];_0x20679e['outboundReCallsDay']=_0x4a7b22[_0x5950('0x45')];_0x20679e[_0x5950('0x46')]=_0x4a7b22['outboundRejectCallsDay'];_0x20679e['outboundUnknownCallsDay']=_0x4a7b22['outboundUnknownCallsDay'];_0x20679e[_0x5950('0x47')]=_0x4a7b22[_0x5950('0x47')];_0x20679e[_0x5950('0x48')]=_0x4a7b22[_0x5950('0x48')];_0x20679e[_0x5950('0x49')]=_0x4a7b22['predictiveIntervalAvgTalktime'];_0x20679e['predictiveIntervalDroppedCallsCallersExit']=_0x4a7b22['predictiveIntervalDroppedCallsCallersExit'];_0x20679e['predictiveIntervalDroppedCallsTimeout']=_0x4a7b22[_0x5950('0x4a')];_0x20679e[_0x5950('0x4b')]=_0x4a7b22[_0x5950('0x4b')];_0x20679e[_0x5950('0x4c')]=_0x4a7b22['predictiveIntervalErlangCallsDroppedCalls'];_0x20679e[_0x5950('0x4d')]=_0x4a7b22[_0x5950('0x4d')];_0x20679e['predictiveIntervalMultiplicativeFactor']=_0x4a7b22[_0x5950('0x4e')];_0x20679e[_0x5950('0x4f')]=_0x4a7b22[_0x5950('0x4f')];_0x20679e[_0x5950('0x50')]=_0x4a7b22[_0x5950('0x50')];_0x20679e[_0x5950('0x51')]=_0x4a7b22[_0x5950('0x51')];_0x20679e['message']=_0x4a7b22[_0x5950('0x1c')];_0x20679e['originated']=_0x4a7b22[_0x5950('0x52')];_0x20679e[_0x5950('0x53')]=_0x4a7b22['erlangCalls'];_0x20679e[_0x5950('0x54')]=_0x4a7b22[_0x5950('0x54')];_0x20679e[_0x5950('0x55')]=_0x4a7b22[_0x5950('0x55')];_0x20679e['erlangBusyFactor']=_0x4a7b22[_0x5950('0x56')];_0x20679e[_0x5950('0x57')]=_0x4a7b22[_0x5950('0x57')];_0x20679e[_0x5950('0x58')]=_0x4a7b22['startProgressive'];}if(_0x4a7b22[_0x5950('0x59')]){_0x20679e[_0x5950('0x59')]={'id':_0x4a7b22[_0x5950('0x59')]['id'],'name':_0x4a7b22['Trunk'][_0x5950('0xa')],'active':_0x4a7b22['Trunk'][_0x5950('0x5a')],'callerid':_0x4a7b22[_0x5950('0x59')][_0x5950('0x5b')]};}if(_0x4a7b22[_0x5950('0x5c')]){_0x20679e[_0x5950('0x5c')]={'id':_0x4a7b22[_0x5950('0x5c')]['id'],'name':_0x4a7b22[_0x5950('0x5c')]['name']};}_0x32c197[_0x5950('0x5d')](_0x20679e);}}_0x4d9317({'count':_0x32c197[_0x5950('0x5e')],'rows':_0x32c197});});},'UpdateVoiceQueue':function(_0x3a96d1){return new Promise(function(_0x1bdcec,_0x32375){var _0x52ba16=_['find'](_0x2494fc[_0x5950('0x22')],{'id':parseInt(_0x3a96d1['id'])});var _0x44189e=_[_0x5950('0x5f')](_0x3a96d1,['id']);if(_0x52ba16){for(var _0x4e560f in _0x44189e){if(typeof _0x44189e[_0x4e560f]!==_0x5950('0x60')&&typeof _0x52ba16[_0x4e560f]!==_0x5950('0x60')){_0x52ba16[_0x4e560f]=_0x44189e[_0x4e560f];}}_0x1bdcec(_0x52ba16);}else{_0x32375();}});},'VoiceChannels':function(_0x228b26){return new Promise(function(_0x4eae97,_0x554158){var _0x49f202=_[_0x5950('0x61')](_0x2494fc[_0x5950('0x62')]);_0x4eae97({'count':_0x49f202[_0x5950('0x5e')],'rows':_0x49f202});});},'VoiceChannelMixMonitor':function(_0x396cad){var _0x2f3371=this;return new Promise(function(_0x287470,_0x441ad5){if(ami[_0x5950('0x11')]()==![]){return _0x441ad5(_0x2f3371[_0x5950('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x5950('0x13')][_0x5950('0x14')],_0x5950('0x15')][_0x5950('0x16')]('\x20')));}var _0x1cbe8d=schema(properties[_0x5950('0x63')])[_0x5950('0x2')](_0x396cad);if(_0x1cbe8d[_0x5950('0x5e')]>0x0){return _0x441ad5(_0x2f3371[_0x5950('0x12')](0x1f4,_[_0x5950('0x64')](_0x1cbe8d,'message')[_0x5950('0x16')](',\x20')));}var _0x168829=_[_0x5950('0x65')](_0x2494fc[_0x5950('0x62')],{'uniqueid':_0x396cad['uniqueid']});if(_0x168829&&_0x168829['channel']){var _0x3b36a9=util[_0x5950('0x7')]('%s.%s',_0x396cad[_0x5950('0x66')]||_0x396cad[_0x5950('0x67')],_0x396cad[_0x5950('0x7')]||_0x5950('0x68'));return ami[_0x5950('0x69')]({'action':_0x5950('0x6a'),'channel':_0x168829['channel'],'file':_0x3b36a9,'options':_0x5950('0x6b')})[_0x5950('0x20')](function(_0x4c6906){var _0x791ee9=_[_0x5950('0x65')](_0x168829[_0x5950('0x6c')],{'filename':'/var/spool/asterisk/monitor/'+_0x3b36a9[_0x5950('0x6d')]()});if(_[_0x5950('0x6e')](_0x791ee9)){_0x168829[_0x5950('0x6c')][_0x5950('0x5d')]({'filename':_0x5950('0x6f')+_0x3b36a9[_0x5950('0x6d')](),'createdAt':moment()[_0x5950('0x7')](_0x5950('0x70')),'mixmonitorid':_0x4c6906[_0x5950('0x71')],'status':'rec'});}else{_0x791ee9[_0x5950('0x71')]=_0x4c6906[_0x5950('0x71')];_0x791ee9[_0x5950('0x72')]=_0x5950('0x73');}_0x287470({'code':0xc8,'message':[_0x396cad[_0x5950('0x67')],_0x5950('0x74'),_0x4c6906[_0x5950('0x71')]]['join']('\x20'),'mixmonitorid':_0x4c6906[_0x5950('0x71')]});})['catch'](function(_0x3e417a){_0x441ad5(_0x2f3371['error'](0x1f5,[_0x396cad[_0x5950('0x67')],_0x3e417a[_0x5950('0x1c')]['toLowerCase']()][_0x5950('0x16')]('\x20')));});}else{return _0x441ad5(_0x2f3371['error'](0x1f5,_0x5950('0x75')));}});},'VoiceChannelStopMixMonitor':function(_0x4ebd64){var _0x50a3a8=this;return new Promise(function(_0x5c743b,_0x34fc6e){if(ami[_0x5950('0x11')]()==![]){return _0x34fc6e(_0x50a3a8[_0x5950('0x12')](0x1f4,[config[_0x5950('0x13')]['ip'],config[_0x5950('0x13')][_0x5950('0x14')],_0x5950('0x15')][_0x5950('0x16')]('\x20')));}var _0x5bb971=schema(properties['voicechannel'])[_0x5950('0x2')](_0x4ebd64);if(_0x5bb971['length']>0x0){return _0x34fc6e(_0x50a3a8[_0x5950('0x12')](0x1f4,_[_0x5950('0x64')](_0x5bb971,_0x5950('0x1c'))[_0x5950('0x16')](',\x20')));}var _0x76b97=_['find'](_0x2494fc[_0x5950('0x62')],{'uniqueid':_0x4ebd64[_0x5950('0x67')]});if(_0x76b97){return BPromise[_0x5950('0x76')]()['then'](function(){if(_0x76b97['channel']){return ami[_0x5950('0x69')]({'action':'StopMixMonitor','channel':_0x76b97[_0x5950('0x77')],'mixmonitorid':_0x4ebd64[_0x5950('0x71')]})['catch'](function(_0x459df6){});}})[_0x5950('0x20')](function(){if(_0x76b97[_0x5950('0x78')]){return ami[_0x5950('0x69')]({'action':_0x5950('0x79'),'channel':_0x76b97[_0x5950('0x78')],'mixmonitorid':_0x4ebd64['mixmonitorid']})[_0x5950('0x1d')](function(_0xd9dd45){});}})[_0x5950('0x20')](function(_0x4cddfb){var _0x5129f7=_[_0x5950('0x65')](_0x76b97[_0x5950('0x6c')],{'mixmonitorid':_0x4ebd64[_0x5950('0x71')]});if(_0x5129f7){_0x5129f7[_0x5950('0x72')]=_0x5950('0x7a');}})[_0x5950('0x20')](function(){var _0x5dc25e=util[_0x5950('0x7')](_0x5950('0x7b'),_0x4ebd64[_0x5950('0x66')]||_0x4ebd64[_0x5950('0x67')],_0x4ebd64['format']||_0x5950('0x68'));var _0x4aa2ab=_['find'](_0x76b97[_0x5950('0x6c')],{'filename':'/var/spool/asterisk/monitor/'+_0x5dc25e[_0x5950('0x6d')]()});if(_0x4aa2ab){_0x4aa2ab['status']=_0x5950('0x7a');}})[_0x5950('0x20')](function(){_0x5c743b({'code':0xc8,'message':[_0x4ebd64['uniqueid'],_0x5950('0x7c')][_0x5950('0x16')]('\x20')});})[_0x5950('0x1d')](function(_0x5738b5){_0x34fc6e(_0x50a3a8[_0x5950('0x12')](0x1f5,[_0x4ebd64[_0x5950('0x67')],_0x5738b5[_0x5950('0x1c')][_0x5950('0x6d')]()][_0x5950('0x16')]('\x20')));});}else{return _0x34fc6e(_0x50a3a8[_0x5950('0x12')](0x1f5,_0x5950('0x75')));}});},'VoiceQueuesChannels':function(_0x192dbc){return new Promise(function(_0x58ba24,_0x4217e9){var _0x21529d=_[_0x5950('0x61')](_0x2494fc[_0x5950('0x7d')]);_0x58ba24({'count':_0x21529d['length'],'rows':_0x21529d});});},'VoiceQueuesChannel':function(_0x29bd2e){var _0x3d2c59=this;return new Promise(function(_0xf3f0b0,_0x1539a7){var _0x5a7f13=schema(properties['voicequeuechannel'])[_0x5950('0x2')](_0x29bd2e);if(_0x5a7f13['length']>0x0){return _0x1539a7(_0x3d2c59[_0x5950('0x12')](0x1f4,_[_0x5950('0x64')](_0x5a7f13,_0x5950('0x1c'))[_0x5950('0x16')](',\x20')));}var _0x3a19e1=_['find'](_0x2494fc[_0x5950('0x7d')],{'uniqueid':_0x29bd2e[_0x5950('0x67')]});if(_0x3a19e1){_0xf3f0b0(_0x3a19e1);}else{return _0x1539a7(_0x3d2c59['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x183096){var _0xbc06ac=this;return new Promise(function(_0x3bdfb3,_0x46a2f8){if(ami[_0x5950('0x11')]()==![]){return _0x46a2f8(_0xbc06ac['error'](0x1f4,[config[_0x5950('0x13')]['ip'],config[_0x5950('0x13')][_0x5950('0x14')],_0x5950('0x15')][_0x5950('0x16')]('\x20')));}var _0x58556f=schema(properties[_0x5950('0x7e')])[_0x5950('0x2')](_0x183096);if(_0x58556f['length']>0x0){return _0x46a2f8(_0xbc06ac['error'](0x1f4,_[_0x5950('0x64')](_0x58556f,_0x5950('0x1c'))[_0x5950('0x16')](',\x20')));}var _0x3ad101=_[_0x5950('0x65')](_0x2494fc['queueChannels'],{'uniqueid':_0x183096['uniqueid']});if(_0x3ad101&&_0x3ad101[_0x5950('0x77')]){return ami[_0x5950('0x69')]({'action':'Hangup','channel':_0x3ad101[_0x5950('0x77')]})[_0x5950('0x20')](function(_0x1c067d){_0x3bdfb3({'code':0xc8,'message':[_0x183096[_0x5950('0x67')],_0x1c067d[_0x5950('0x1c')]['toLowerCase']()][_0x5950('0x16')]('\x20')});})['catch'](function(_0x58c58d){_0x46a2f8(_0xbc06ac[_0x5950('0x12')](0x1f5,[_0x183096[_0x5950('0x67')],_0x58c58d[_0x5950('0x1c')]['toLowerCase']()][_0x5950('0x16')]('\x20')));});}else{return _0x46a2f8(_0xbc06ac[_0x5950('0x12')](0x1f5,_0x5950('0x75')));}});},'VoiceQueuesChannelRedirect':function(_0x595575){var _0x4fdaa7=this;return new Promise(function(_0x39df9a,_0x3406cf){if(ami[_0x5950('0x11')]()==![]){return _0x3406cf(_0x4fdaa7[_0x5950('0x12')](0x1f4,[config[_0x5950('0x13')]['ip'],config[_0x5950('0x13')][_0x5950('0x14')],'ami\x20disconnected'][_0x5950('0x16')]('\x20')));}var _0x5e14ca=schema(properties[_0x5950('0x7f')])[_0x5950('0x2')](_0x595575);if(_0x5e14ca[_0x5950('0x5e')]>0x0){return _0x3406cf(_0x4fdaa7[_0x5950('0x12')](0x1f4,_[_0x5950('0x64')](_0x5e14ca,_0x5950('0x1c'))[_0x5950('0x16')](',\x20')));}var _0x56282a=_['find'](_0x2494fc[_0x5950('0x7d')],{'uniqueid':_0x595575[_0x5950('0x67')]});if(_0x56282a&&_0x56282a[_0x5950('0x77')]){return ami['Action']({'action':_0x5950('0x80'),'channel':_0x56282a[_0x5950('0x77')],'exten':_0x595575['exten'],'context':_0x595575['context']||_0x56282a[_0x5950('0x81')],'priority':0x1})[_0x5950('0x20')](function(_0x4349d8){_0x39df9a({'code':0xc8,'message':[_0x595575[_0x5950('0x67')],_0x4349d8[_0x5950('0x1c')]['toLowerCase']()]['join']('\x20')});})[_0x5950('0x1d')](function(_0x5373f8){_0x3406cf(_0x4fdaa7[_0x5950('0x12')](0x1f5,[_0x595575['uniqueid'],_0x5373f8['message'][_0x5950('0x6d')]()]['join']('\x20')));});}else{return _0x3406cf(_0x4fdaa7[_0x5950('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x178d62){return new Promise(function(_0x57d6f1,_0x450805){var _0x3e55be=_[_0x5950('0x61')](_0x2494fc[_0x5950('0xd')]);_0x57d6f1({'count':_0x3e55be['length'],'rows':_0x3e55be});});},'Telephones':function(_0x2b4f2a){return new Promise(function(_0x214a33,_0x5ea984){var _0x1f4618=_['values'](_0x2494fc[_0x5950('0x82')]);_0x214a33({'count':_0x1f4618[_0x5950('0x5e')],'rows':_0x1f4618});});},'Trunks':function(_0x564ba2){return new Promise(function(_0x42b91b,_0x5e1806){var _0x5e89c8=_['values'](_0x2494fc[_0x5950('0x83')]);_0x42b91b({'count':_0x5e89c8[_0x5950('0x5e')],'rows':_0x5e89c8});});},'OutboundChannels':function(_0x185710){return new Promise(function(_0x9e555d,_0x274c9b){var _0x468274=_['values'](_0x2494fc['outboundChannels']);_0x9e555d({'count':_0x468274[_0x5950('0x5e')],'rows':_0x468274});});},'Outbound':function(_0x510ee3){return new Promise(function(_0x42702d,_0x5f1076){_0x42702d(_0x2494fc[_0x5950('0x32')]);});},'Campaigns':function(_0x38aa1e){return new Promise(function(_0x1c8c14,_0x5a07b9){var _0x409f30=_[_0x5950('0x61')](_0x2494fc[_0x5950('0x84')]);_0x1c8c14({'count':_0x409f30['length'],'rows':_0x409f30});});},'VoiceQueuesPreview':function(_0xedcf92){var _0x5021ef=this;return new Promise(function(_0x2bc976,_0x466fe3){_0x43f5b6[_0x5950('0x85')](_0xedcf92['id'])[_0x5950('0x20')](function(_0x5cfa95){_0x2bc976({'code':0xc8,'message':_0x5cfa95['message']});})[_0x5950('0x1d')](function(_0x27f433){_0x466fe3(_0x5021ef[_0x5950('0x12')](0x1f4,_0x27f433[_0x5950('0x1c')]));});});},'EventManager':function(_0x1ac4b0){var _0x2fa930=this;return new Promise(function(_0x4fe998,_0x5e80a7){if(!_0x1ac4b0[_0x5950('0x86')]){return _0x5e80a7(_0x2fa930[_0x5950('0x12')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x5950('0x87')](_0x5950('0x88')+_0x1ac4b0[_0x5950('0x86')],_0x1ac4b0[_0x5950('0x1c')]);_0x4fe998({'code':0xc8,'message':_0x1ac4b0});});},'FaxAccounts':function(_0xc5de0d){return new Promise(function(_0x1015a0,_0x2ac5c4){var _0x15ff36=_['values'](_0x2494fc[_0x5950('0x89')]);_0x1015a0({'count':_0x15ff36[_0x5950('0x5e')],'rows':_0x15ff36});});},'SendFax':function(_0x5ec0a8){var _0x5e9af3=this;return new Promise(function(_0x24f8c4,_0x4cf0ff){_0x3ac153[_0x5950('0x8a')](_0x5ec0a8)[_0x5950('0x20')](function(_0xf628f8){_0x24f8c4({'code':0xc8,'message':_0xf628f8[_0x5950('0x1c')]});})['catch'](function(_0x1e1552){_0x4cf0ff(_0x5e9af3[_0x5950('0x12')](0x1f4,_0x1e1552['message']));});});},'CheckAfterSend':function(_0x2c78be){var _0x2f5583=this;return new Promise(function(_0x47d316,_0x55a5e4){_0x3ac153[_0x5950('0x8b')](_0x2c78be)[_0x5950('0x20')](function(_0x2ad6d1){_0x47d316({'code':0xc8,'message':_0x2ad6d1[_0x5950('0x1c')]});})['catch'](function(_0x6af976){_0x55a5e4(_0x2f5583['error'](0x1f4,_0x6af976[_0x5950('0x1c')]));});});}};var _0x4e5874=jayson[_0x5950('0x8c')](_0x4b9478)['http']();_0x4e5874['on'](_0x5950('0x12'),function(_0x396a74){return _0x4aa518(_0x396a74);});_0x4e5874[_0x5950('0x8d')](0x232a,_0x5950('0x8e'),function(){console[_0x5950('0x8f')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3a5973(_0x5950('0x90')+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 239253d..e90780d 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 _0x6e6c=['defaults','localhost','info','[CM][%s][%s]','stringify','emit','data1','data2','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','fax','createdAt','scheduledAt','updatedAt','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','destcalleridname','','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','Unknown','push','format','user:%s','action','merge','lodash','ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact'];(function(_0x39a2d6,_0x477459){var _0x23af66=function(_0x2eb95e){while(--_0x2eb95e){_0x39a2d6['push'](_0x39a2d6['shift']());}};_0x23af66(++_0x477459);}(_0x6e6c,0xce));var _0xc6e6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6e6c[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xc6e6('0x0'));var BPromise=require('bluebird');var Redis=require(_0xc6e6('0x1'));var util=require(_0xc6e6('0x2'));var config=require('../../../../config/environment');var logger=require(_0xc6e6('0x3'))(_0xc6e6('0x4'));var cmContactRpc=require(_0xc6e6('0x5'));config['redis']=_[_0xc6e6('0x6')](config['redis'],{'host':_0xc6e6('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0xdc1dce,_0x5866e7,_0x3dc6cf,_0x13d36d,_0x3d7658){logger[_0xc6e6('0x8')](_0xc6e6('0x9'),_0xdc1dce,_0x5866e7['id'],_0x3dc6cf,_0x13d36d,JSON[_0xc6e6('0xa')](_0x3d7658));io['to'](_0x3dc6cf)[_0xc6e6('0xb')](_0x13d36d,_0x3d7658);}exports['exec']=function(_0x455dd6,_0x44278d,_0x3b1185,_0x5e6223){var _0x5626cc,_0x5b90e9;var _0x159174={};var _0x4a2dc5=Number(_0x3b1185[_0xc6e6('0xc')]);var _0x5896b1=_0x3b1185[_0xc6e6('0xd')]?Boolean(Number(_0x3b1185[_0xc6e6('0xd')])):![];var _0x42ef63;if(_0x5e6223[_0xc6e6('0xe')]){_0x159174['id']=_0x5e6223['xmd-contactid'];}if(!_0x159174['id']){_0x159174[_0xc6e6('0xf')]=_0x4a2dc5;_0x42ef63=_0x3b1185[_0xc6e6('0x10')]&&_0x3b1185[_0xc6e6('0x10')]!=='0'?_0x3b1185[_0xc6e6('0x10')][_0xc6e6('0x11')](','):[_0xc6e6('0x12')];_0x159174[_0xc6e6('0x13')]=_[_0xc6e6('0x14')](_0x42ef63,function(_0x6137ce){var _0x5e79d7={};_0x5e79d7[_0x6137ce]=_0x5e6223[_0xc6e6('0x15')]?_0x5e6223[_0xc6e6('0x16')]:_0x5e6223[_0xc6e6('0x17')];return _0x5e79d7;});}var _0x2d78bc=['id',_0xc6e6('0x18'),_0xc6e6('0x19'),_0xc6e6('0x12'),'mobile',_0xc6e6('0x1a'),_0xc6e6('0xf'),_0xc6e6('0x1b'),_0xc6e6('0x1c'),_0xc6e6('0x1d')];var _0x3a7005=_['union'](_0x2d78bc,_0x42ef63);BPromise[_0xc6e6('0x1e')]()[_0xc6e6('0x1f')](cmContactRpc['getContacts']({'attributes':_0x3a7005,'where':_0x159174}))[_0xc6e6('0x1f')](function(_0x344ac5){_0x5b90e9=_0x344ac5;if(!_[_0xc6e6('0x20')](_0x5b90e9)){if(_0x5b90e9[_0xc6e6('0x21')]===0x1){_0x5626cc=_0x5b90e9[0x0];logger['info'](_0xc6e6('0x22'),_0x5e6223[_0xc6e6('0x23')],_0x44278d['id'],_0x5626cc['id']);}else{logger[_0xc6e6('0x8')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x5e6223['uniqueid'],_0x44278d['id'],_[_0xc6e6('0x14')](_0x5b90e9,'id')[_0xc6e6('0x24')](','));}return;}else{logger[_0xc6e6('0x8')](_0xc6e6('0x25'),_0x5e6223[_0xc6e6('0x23')],_0x44278d['id']);var _0x104837={'ListId':_0x4a2dc5};var _0x152cdf=_0x3b1185[_0xc6e6('0x26')]&&_0x3b1185['data4']!=='0'?_0x3b1185['data4']:'phone';if(_0x5896b1){logger[_0xc6e6('0x8')](_0xc6e6('0x27'),_0x5e6223['uniqueid'],_0x44278d['id']);_0x104837[_0x152cdf]=_[_0xc6e6('0x28')](_0x5e6223[_0xc6e6('0x15')])?_0x5e6223['calleridnum']:_0x5e6223[_0xc6e6('0x16')];if(_[_0xc6e6('0x28')](_0x5e6223[_0xc6e6('0x15')])){_0x104837[_0xc6e6('0x18')]=_0x5e6223[_0xc6e6('0x29')]&&_0x5e6223[_0xc6e6('0x29')]!==''?_0x5e6223[_0xc6e6('0x29')]:'Unknown';}else{_0x104837[_0xc6e6('0x18')]=_0x5e6223[_0xc6e6('0x2a')]&&_0x5e6223['destcalleridname']!==_0xc6e6('0x2b')?_0x5e6223['destcalleridname']:'Unknown';}return BPromise[_0xc6e6('0x1e')]()[_0xc6e6('0x1f')](cmContactRpc[_0xc6e6('0x2c')](_0x104837))[_0xc6e6('0x1f')](function(_0x2e411a){_0x5626cc=_0x2e411a;_0x5b90e9['push'](_0x2e411a);if(_0x5626cc){logger['info'](_0xc6e6('0x2d'),_0x5e6223[_0xc6e6('0x23')],_0x44278d['id'],_0x5626cc['id']);}return;});}else{logger[_0xc6e6('0x8')](_0xc6e6('0x2e'),_0x5e6223['uniqueid'],_0x44278d['id']);_0x104837[_0x152cdf]=_[_0xc6e6('0x28')](_0x5e6223['routeId'])?_0x5e6223[_0xc6e6('0x17')]:_0x5e6223[_0xc6e6('0x16')];if(_[_0xc6e6('0x28')](_0x5e6223['routeId'])){_0x104837['firstName']=_0x5e6223[_0xc6e6('0x29')]&&_0x5e6223[_0xc6e6('0x29')]!==_0xc6e6('0x2b')?_0x5e6223[_0xc6e6('0x29')]:'Unknown';}else{_0x104837['firstName']=_0x5e6223[_0xc6e6('0x2a')]&&_0x5e6223[_0xc6e6('0x2a')]!==_0xc6e6('0x2b')?_0x5e6223[_0xc6e6('0x2a')]:_0xc6e6('0x2f');}_0x5626cc=_0x104837;_0x5b90e9[_0xc6e6('0x30')](_0x104837);return;}}})[_0xc6e6('0x1f')](function(){if(_0x455dd6){emit(_0x5e6223['uniqueid'],_0x44278d,util[_0xc6e6('0x31')](_0xc6e6('0x32'),_0x455dd6['name']),util['format']('trigger:%s',_0x3b1185[_0xc6e6('0x33')]['toLowerCase']()),{'evt':_[_0xc6e6('0x34')](_0x5e6223,{'autoCreate':_0x5896b1}),'contact':_0x5626cc===undefined?{}:_0x5626cc,'contacts':_0x5b90e9[_0xc6e6('0x21')]===0x0?undefined:_0x5b90e9});}});}; \ No newline at end of file +var _0x81da=['data4','isNil','calleridname','','Unknown','firstName','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','name','format','action','toLowerCase','merge','lodash','bluebird','util','../../../../config/environment','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data1','data2','xmd-contactid','ListId','data3','split','map','routeId','destcalleridnum','calleridnum','lastName','mobile','createdAt','scheduledAt','updatedAt','union','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found'];(function(_0x31e13b,_0x2515f7){var _0x76bd9d=function(_0x1ae827){while(--_0x1ae827){_0x31e13b['push'](_0x31e13b['shift']());}};_0x76bd9d(++_0x2515f7);}(_0x81da,0xe3));var _0xa81d=function(_0x33ebc7,_0x227653){_0x33ebc7=_0x33ebc7-0x0;var _0x543aa1=_0x81da[_0x33ebc7];return _0x543aa1;};'use strict';var _=require(_0xa81d('0x0'));var BPromise=require(_0xa81d('0x1'));var Redis=require('ioredis');var util=require(_0xa81d('0x2'));var config=require(_0xa81d('0x3'));var logger=require('../../../../config/logger')(_0xa81d('0x4'));var cmContactRpc=require(_0xa81d('0x5'));config[_0xa81d('0x6')]=_[_0xa81d('0x7')](config[_0xa81d('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xa81d('0x8'))(new Redis(config[_0xa81d('0x6')]));function emit(_0x34b675,_0x40a245,_0x5d5ad5,_0x50f152,_0x24a23b){logger[_0xa81d('0x9')](_0xa81d('0xa'),_0x34b675,_0x40a245['id'],_0x5d5ad5,_0x50f152,JSON['stringify'](_0x24a23b));io['to'](_0x5d5ad5)[_0xa81d('0xb')](_0x50f152,_0x24a23b);}exports[_0xa81d('0xc')]=function(_0x45d1f1,_0x131193,_0x4bfe98,_0x2f1345){var _0x556d60,_0x2f57a3;var _0x39112b={};var _0x333f56=Number(_0x4bfe98[_0xa81d('0xd')]);var _0xedb190=_0x4bfe98['data2']?Boolean(Number(_0x4bfe98[_0xa81d('0xe')])):![];var _0x39f131;if(_0x2f1345[_0xa81d('0xf')]){_0x39112b['id']=_0x2f1345[_0xa81d('0xf')];}if(!_0x39112b['id']){_0x39112b[_0xa81d('0x10')]=_0x333f56;_0x39f131=_0x4bfe98[_0xa81d('0x11')]&&_0x4bfe98[_0xa81d('0x11')]!=='0'?_0x4bfe98['data3'][_0xa81d('0x12')](','):['phone'];_0x39112b['$or']=_[_0xa81d('0x13')](_0x39f131,function(_0x4654ec){var _0x3c1ec8={};_0x3c1ec8[_0x4654ec]=_0x2f1345[_0xa81d('0x14')]?_0x2f1345[_0xa81d('0x15')]:_0x2f1345[_0xa81d('0x16')];return _0x3c1ec8;});}var _0x5af4b9=['id','firstName',_0xa81d('0x17'),'phone',_0xa81d('0x18'),'fax',_0xa81d('0x10'),_0xa81d('0x19'),_0xa81d('0x1a'),_0xa81d('0x1b')];var _0x3f578c=_[_0xa81d('0x1c')](_0x5af4b9,_0x39f131);BPromise['resolve']()[_0xa81d('0x1d')](cmContactRpc[_0xa81d('0x1e')]({'attributes':_0x3f578c,'where':_0x39112b}))['then'](function(_0xd2f368){_0x2f57a3=_0xd2f368;if(!_[_0xa81d('0x1f')](_0x2f57a3)){if(_0x2f57a3[_0xa81d('0x20')]===0x1){_0x556d60=_0x2f57a3[0x0];logger[_0xa81d('0x9')](_0xa81d('0x21'),_0x2f1345['uniqueid'],_0x131193['id'],_0x556d60['id']);}else{logger[_0xa81d('0x9')](_0xa81d('0x22'),_0x2f1345[_0xa81d('0x23')],_0x131193['id'],_[_0xa81d('0x13')](_0x2f57a3,'id')[_0xa81d('0x24')](','));}return;}else{logger['info'](_0xa81d('0x25'),_0x2f1345[_0xa81d('0x23')],_0x131193['id']);var _0x35e983={'ListId':_0x333f56};var _0x8050d=_0x4bfe98[_0xa81d('0x26')]&&_0x4bfe98[_0xa81d('0x26')]!=='0'?_0x4bfe98[_0xa81d('0x26')]:'phone';if(_0xedb190){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x2f1345['uniqueid'],_0x131193['id']);_0x35e983[_0x8050d]=_[_0xa81d('0x27')](_0x2f1345[_0xa81d('0x14')])?_0x2f1345[_0xa81d('0x16')]:_0x2f1345['destcalleridnum'];if(_['isNil'](_0x2f1345[_0xa81d('0x14')])){_0x35e983['firstName']=_0x2f1345[_0xa81d('0x28')]&&_0x2f1345['calleridname']!==_0xa81d('0x29')?_0x2f1345[_0xa81d('0x28')]:_0xa81d('0x2a');}else{_0x35e983[_0xa81d('0x2b')]=_0x2f1345[_0xa81d('0x2c')]&&_0x2f1345[_0xa81d('0x2c')]!==_0xa81d('0x29')?_0x2f1345[_0xa81d('0x2c')]:_0xa81d('0x2a');}return BPromise['resolve']()['then'](cmContactRpc[_0xa81d('0x2d')](_0x35e983))[_0xa81d('0x1d')](function(_0x3eabfb){_0x556d60=_0x3eabfb;_0x2f57a3[_0xa81d('0x2e')](_0x3eabfb);if(_0x556d60){logger[_0xa81d('0x9')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x2f1345[_0xa81d('0x23')],_0x131193['id'],_0x556d60['id']);}return;});}else{logger[_0xa81d('0x9')](_0xa81d('0x2f'),_0x2f1345[_0xa81d('0x23')],_0x131193['id']);_0x35e983[_0x8050d]=_[_0xa81d('0x27')](_0x2f1345['routeId'])?_0x2f1345[_0xa81d('0x16')]:_0x2f1345[_0xa81d('0x15')];if(_[_0xa81d('0x27')](_0x2f1345[_0xa81d('0x14')])){_0x35e983['firstName']=_0x2f1345[_0xa81d('0x28')]&&_0x2f1345[_0xa81d('0x28')]!==_0xa81d('0x29')?_0x2f1345['calleridname']:_0xa81d('0x2a');}else{_0x35e983[_0xa81d('0x2b')]=_0x2f1345[_0xa81d('0x2c')]&&_0x2f1345[_0xa81d('0x2c')]!==_0xa81d('0x29')?_0x2f1345['destcalleridname']:_0xa81d('0x2a');}_0x556d60=_0x35e983;_0x2f57a3['push'](_0x35e983);return;}}})[_0xa81d('0x1d')](function(){if(_0x45d1f1){emit(_0x2f1345[_0xa81d('0x23')],_0x131193,util['format']('user:%s',_0x45d1f1[_0xa81d('0x30')]),util[_0xa81d('0x31')]('trigger:%s',_0x4bfe98[_0xa81d('0x32')][_0xa81d('0x33')]()),{'evt':_[_0xa81d('0x34')](_0x2f1345,{'autoCreate':_0xedb190}),'contact':_0x556d60===undefined?{}:_0x556d60,'contacts':_0x2f57a3[_0xa81d('0x20')]===0x0?undefined:_0x2f57a3});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 7438b4a..29577f9 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 _0x1f2e=['lodash','url','mustache','ioredis','./urlforward','./integration','./script','../ami','redis','socket.io-emitter','popup','winapp','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','clone','checkTriggers','interface','triggers','status','checkTrigger','merge','variables','Actions','length','action','toLowerCase','contactmanager','motionbar','browser','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','uriLocation','windowWidth','data5','800','windowHeight','data6','600','winApplication','winArguments','format','user:%s','name','trigger:%s:%s','data1','trigger:%s','exec','accounts','queue','routeId','script','parse','query','AllConditions','every','checkConditions','channel','AnyConditions','field','account','chat','ChatWebsiteId','operator','upperFirst','value','AccountId','interaction','message','event','agent','membername','lastevent','exports','util'];(function(_0x1a195f,_0x5858de){var _0x293d71=function(_0xe287dc){while(--_0xe287dc){_0x1a195f['push'](_0x1a195f['shift']());}};_0x293d71(++_0x5858de);}(_0x1f2e,0x1cb));var _0xe1f2=function(_0x2a239f,_0x22e3bd){_0x2a239f=_0x2a239f-0x0;var _0x39c13e=_0x1f2e[_0x2a239f];return _0x39c13e;};'use strict';var util=require(_0xe1f2('0x0'));var _=require(_0xe1f2('0x1'));var url=require(_0xe1f2('0x2'));var Mustache=require(_0xe1f2('0x3'));var Redis=require(_0xe1f2('0x4'));var urlforward=require(_0xe1f2('0x5'));var integration=require(_0xe1f2('0x6'));var cmContact=require('./cmContact');var script=require(_0xe1f2('0x7'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('trigger');var ami=require(_0xe1f2('0x8'));config[_0xe1f2('0x9')]=_['defaults'](config[_0xe1f2('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xe1f2('0xa'))(new Redis(config['redis']));var operators={'equals':function(_0x4f7335,_0xbcba7a){return _0x4f7335==_0xbcba7a;},'not_equals':function(_0x23628b,_0x59bcbf){return _0x23628b!=_0x59bcbf;}};var barAndWebActions=[_0xe1f2('0xb'),'url',_0xe1f2('0xc')];function Trigger(_0x3ce4ef){this['triggers']=_0x3ce4ef['triggers'];this[_0xe1f2('0xd')]=_0x3ce4ef['agents'];this[_0xe1f2('0xe')]=_0x3ce4ef[_0xe1f2('0xe')];this[_0xe1f2('0xf')]=_0x3ce4ef['templates'];this[_0xe1f2('0x10')]=_0x3ce4ef[_0xe1f2('0x10')];this[_0xe1f2('0x11')]=_0x3ce4ef[_0xe1f2('0x11')];this[_0xe1f2('0x12')]=_0x3ce4ef[_0xe1f2('0x12')];this[_0xe1f2('0x13')]=_0x3ce4ef[_0xe1f2('0x13')];this[_0xe1f2('0x14')]=_0x3ce4ef[_0xe1f2('0x14')];this[_0xe1f2('0x15')]=_0x3ce4ef['zohoAccounts'];this[_0xe1f2('0x16')]=_0x3ce4ef[_0xe1f2('0x16')];this['vtigerAccounts']=_0x3ce4ef[_0xe1f2('0x17')];this[_0xe1f2('0x18')]=_0x3ce4ef[_0xe1f2('0x18')];this[_0xe1f2('0x19')]=_0x3ce4ef[_0xe1f2('0x19')];this[_0xe1f2('0x1a')]=_0x3ce4ef[_0xe1f2('0x1a')];this['accounts']={'zendesk':this[_0xe1f2('0x11')],'salesforce':this['salesforceAccounts'],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0xe1f2('0x14')],'zoho':this[_0xe1f2('0x15')],'desk':this['deskAccounts'],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0xe1f2('0x19')],'freshsales':this[_0xe1f2('0x1a')],'servicenow':this[_0xe1f2('0x18')]};ami['on'](_0xe1f2('0x1b'),this[_0xe1f2('0x1c')][_0xe1f2('0x1d')](this));ami['on']('custom:agentconnect',this[_0xe1f2('0x1c')][_0xe1f2('0x1d')](this));ami['on'](_0xe1f2('0x1e'),this[_0xe1f2('0x1c')][_0xe1f2('0x1d')](this));ami['on'](_0xe1f2('0x1f'),this[_0xe1f2('0x1c')][_0xe1f2('0x1d')](this));ami['on'](_0xe1f2('0x20'),this[_0xe1f2('0x1c')]['bind'](this));ami['on'](_0xe1f2('0x21'),this[_0xe1f2('0x1c')][_0xe1f2('0x1d')](this));ami['on'](_0xe1f2('0x22'),this[_0xe1f2('0x1c')][_0xe1f2('0x1d')](this));ami['on'](_0xe1f2('0x23'),this[_0xe1f2('0x1c')][_0xe1f2('0x1d')](this));ami['on']('custom:agentreject',this[_0xe1f2('0x1c')][_0xe1f2('0x1d')](this));ami['on']('custom:amd',this[_0xe1f2('0x1c')]['bind'](this));ami['on'](_0xe1f2('0x24'),this[_0xe1f2('0x1c')]['bind'](this));ami['on'](_0xe1f2('0x25'),this[_0xe1f2('0x1c')][_0xe1f2('0x1d')](this));ami['on'](_0xe1f2('0x26'),this[_0xe1f2('0x27')][_0xe1f2('0x1d')](this));ami['on'](_0xe1f2('0x28'),this[_0xe1f2('0x27')][_0xe1f2('0x1d')](this));ami['on'](_0xe1f2('0x29'),this[_0xe1f2('0x27')][_0xe1f2('0x1d')](this));ami['on']('custom:newinteraction',this[_0xe1f2('0x1c')]['bind'](this));ami['on']('custom:closedinteraction',this[_0xe1f2('0x1c')][_0xe1f2('0x1d')](this));ami['on'](_0xe1f2('0x2a'),this[_0xe1f2('0x1c')][_0xe1f2('0x1d')](this));ami['on'](_0xe1f2('0x2b'),this['syncCustomEvent'][_0xe1f2('0x1d')](this));ami['on'](_0xe1f2('0x2c'),this[_0xe1f2('0x1c')][_0xe1f2('0x1d')](this));ami['on'](_0xe1f2('0x2d'),this[_0xe1f2('0x1c')]['bind'](this));}Trigger[_0xe1f2('0x2e')][_0xe1f2('0x2f')]=function(_0x3d3db9,_0x47d10d,_0x408979){logger[_0xe1f2('0x30')](_0x3d3db9,_0x47d10d,JSON['stringify'](_0x408979));io['to'](_0x3d3db9)[_0xe1f2('0x2f')](_0x47d10d,_0x408979);};Trigger[_0xe1f2('0x2e')][_0xe1f2('0x1c')]=function(_0x388cdb){var _0x5b66eb=_[_0xe1f2('0x31')](_0x388cdb);this[_0xe1f2('0x32')](_0x5b66eb);};Trigger['prototype'][_0xe1f2('0x27')]=function(_0x2a7bc4){if(this[_0xe1f2('0xd')][_0x2a7bc4[_0xe1f2('0x33')]]){this[_0xe1f2('0x1c')](_0x2a7bc4);}};Trigger['prototype'][_0xe1f2('0x32')]=function(_0x370db9){var _0x43aefb;for(var _0x5d2114 in this[_0xe1f2('0x34')]){if(this[_0xe1f2('0x34')]['hasOwnProperty'](_0x5d2114)){if(this[_0xe1f2('0x34')][_0x5d2114][_0xe1f2('0x35')]){_0x43aefb=this[_0xe1f2('0x36')](this[_0xe1f2('0x34')][_0x5d2114],_0x370db9);if(_0x43aefb){_[_0xe1f2('0x37')](_0x370db9,_0x370db9[_0xe1f2('0x38')]);for(var _0x1f1e5a=0x0,_0x4db2a7,_0x45cf3c,_0x335f25;_0x1f1e5a0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file +var _0x9957=['Motion','CTI','concat','Tags','/api/v2/users/%d','Descriptions','%s/customers/%d/cases','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','Desk\x20account\x20type\x20not\x20recognized','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','integrationTab','newTab','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','The\x20Ticket\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','desk','defaults','redis','localhost','socket.io-emitter','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','remoteUri','then','total_entries','find','_embedded','entries','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','[HTTP]','stringify','GET','password','authType','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','includes','string','picklist','type','nameField','customField','content','idField','custom_fields','variable','variableName','customVariable','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x4ca5de,_0x3417e9){var _0x805bb=function(_0x1c6b74){while(--_0x1c6b74){_0x4ca5de['push'](_0x4ca5de['shift']());}};_0x805bb(++_0x3417e9);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var rp=require(_0x7995('0x1'));var md5=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));config['redis']=_[_0x7995('0x8')](config[_0x7995('0x9')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x9')]));function emit(_0x326741,_0x4996ca,_0x465276){io['to'](_0x326741)[_0x7995('0xc')](_0x4996ca,_0x465276);}var headers={'Content-Type':'application/json','Accept':_0x7995('0xd')};function getUser(_0x3116fb,_0x18c8a3){if(intUtil[_0x7995('0xe')](_0x18c8a3)===!![]){logger[_0x7995('0xf')](_0x7995('0x10'),_0x18c8a3);return request({'uri':util[_0x7995('0x11')]('%s/users',_0x3116fb[_0x7995('0x12')])})[_0x7995('0x13')](function(_0x581f22){if(_0x581f22[_0x7995('0x14')]){return _[_0x7995('0x15')](_0x581f22[_0x7995('0x16')][_0x7995('0x17')],{'email':_0x18c8a3});}})[_0x7995('0x13')](function(_0x23999f){if(_0x23999f){logger[_0x7995('0xf')]('Agent\x20found!');return _0x23999f;}else{logger['info'](_0x7995('0x18'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb[_0x7995('0x12')])});}});}else{logger[_0x7995('0xf')](_0x7995('0x1a'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb['remoteUri'])});}}function request(_0x2eeacc){logger['debug'](_0x7995('0x1b'),JSON[_0x7995('0x1c')](_0x2eeacc));return rp(_[_0x7995('0x8')](_0x2eeacc,{'method':_0x7995('0x1d'),'headers':headers,'json':!![]}));}function getAuth(_0x1e1415){var _0x37a7d4;if(_0x1e1415['authType']==='basic'){_0x37a7d4=util[_0x7995('0x11')]('%s:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x1e')]);}else if(_0x1e1415[_0x7995('0x1f')]==='token'){_0x37a7d4=util[_0x7995('0x11')]('%s/token:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x20')]);}return util[_0x7995('0x11')](_0x7995('0x21'),new Buffer(_0x37a7d4)[_0x7995('0x22')](_0x7995('0x23')));}function getEndUser(_0x1c278a,_0x5d40ae,_0x32a09a){logger[_0x7995('0xf')](_0x7995('0x24'),_0x32a09a);return request({'uri':util[_0x7995('0x11')](_0x7995('0x25'),_0x1c278a[_0x7995('0x12')]),'qs':{'phone':_0x32a09a}})[_0x7995('0x13')](function(_0x472195){if(_0x472195['total_entries']){logger[_0x7995('0xf')](_0x7995('0x26'));return _0x472195[_0x7995('0x16')][_0x7995('0x17')][0x0];}else{logger[_0x7995('0xf')](_0x7995('0x27'));return request({'uri':util['format'](_0x7995('0x28'),_0x1c278a['remoteUri']),'method':_0x7995('0x29'),'body':{'first_name':_0x5d40ae,'title':_0x5d40ae,'phone_numbers':[{'type':_0x7995('0x2a'),'value':_0x32a09a}]}});}});}function getTags(_0xf16cc2,_0x132a42){var _0x11c1eb=[];if(_0xf16cc2&&_0xf16cc2['length']>0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ 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 2cc71c6..5543d95 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 _0xeda8=['toUpperCase',']\x20Agent\x20found\x20','userId','systemuserid','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','outbound','calleridnum','POST','contacts','/systemusers(','headers','odata-entityid','lastIndexOf','toLowerCase','destcalleridnum','GET','replace','%2b','value','telephone1','enduserId','contactid',']\x20Enduser\x20created!','picklist','type','customField','idField','indexOf','substring','content','ticketType','incident','incidents','assign','Subjects','getString','Descriptions','Fields','phonecall','phonecalls','callDirection','queue','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','format','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','userEmail',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','redis','defaults','localhost','clientId','remoteUri','username','password','clientSecret','then','access_token','catch',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','validateEmail','email','length','internalemailaddress'];(function(_0x276ca0,_0x137101){var _0x4f52bc=function(_0x487c75){while(--_0x487c75){_0x276ca0['push'](_0x276ca0['shift']());}};_0x4f52bc(++_0x137101);}(_0xeda8,0x1d6));var _0x8eda=function(_0x3ec938,_0x47eeaa){_0x3ec938=_0x3ec938-0x0;var _0x3ae0ce=_0xeda8[_0x3ec938];return _0x3ae0ce;};'use strict';var _=require(_0x8eda('0x0'));var BPromise=require(_0x8eda('0x1'));var rp=require(_0x8eda('0x2'));var util=require(_0x8eda('0x3'));var intUtil=require(_0x8eda('0x4'));var md5=require(_0x8eda('0x5'));var Redis=require(_0x8eda('0x6'));var logger=require(_0x8eda('0x7'))(_0x8eda('0x8'));var config=require('../../../../config/environment');config[_0x8eda('0x9')]=_[_0x8eda('0xa')](config[_0x8eda('0x9')],{'host':_0x8eda('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8eda('0x9')]));function getAuthToken(_0x9097b3,_0x59f4f3,_0x3946ae){var _0x4781f2={'method':'POST','uri':_0x59f4f3,'form':{'client_id':_0x9097b3[_0x8eda('0xc')],'resource':_0x9097b3[_0x8eda('0xd')],'username':_0x9097b3[_0x8eda('0xe')],'password':_0x9097b3[_0x8eda('0xf')],'grant_type':_0x8eda('0xf'),'client_secret':_0x9097b3[_0x8eda('0x10')]},'json':!![]};return rp(_0x4781f2)[_0x8eda('0x11')](function(_0x2a51f4){return _0x2a51f4[_0x8eda('0x12')];})[_0x8eda('0x13')](function(_0x3b4cf6){logger['error']('['+[_0x3946ae['toUpperCase']()]+_0x8eda('0x14'));return _0x3b4cf6[_0x8eda('0x15')];});}function getUser(_0xd3d95b,_0x1164fd,_0x45e0a3,_0xcee2,_0x53674b,_0x58a958){return new BPromise(function(_0x3ff499,_0x41923f){return getAuthToken(_0x1164fd,_0xcee2,_0x58a958)[_0x8eda('0x11')](function(_0x4ce2c5){var _0x2a7c34={'method':'GET','uri':_0x53674b+_0x8eda('0x16'),'headers':{'Authorization':_0x8eda('0x17')+_0x4ce2c5,'OData-Version':_0x8eda('0x18')},'json':!![]};return rp(_0x2a7c34);})[_0x8eda('0x11')](function(_0x327f49){var _0x73142d=_0x327f49['value'];var _0x3346bd=![];var _0x18c33d=null;if(!_[_0x8eda('0x19')](_0x45e0a3)){if(intUtil[_0x8eda('0x1a')](_0x45e0a3[_0x8eda('0x1b')])){_0xd3d95b['userEmail']=_0x45e0a3[_0x8eda('0x1b')];for(_0x18c33d=0x0;_0x18c33d<_0x73142d[_0x8eda('0x1c')];_0x18c33d++){if(_0x73142d[_0x18c33d][_0x8eda('0x1d')]===_0x45e0a3['email']&&!_0x73142d[_0x18c33d]['isdisabled']){_0x3346bd=!![];logger['info']('['+[_0x58a958[_0x8eda('0x1e')]()]+_0x8eda('0x1f')+_0x73142d[_0x18c33d]['systemuserid']+'!');_0xd3d95b[_0x8eda('0x20')]=_0x73142d[_0x18c33d][_0x8eda('0x21')];}}}}if(!_0x3346bd){logger[_0x8eda('0x22')]('['+[_0x58a958[_0x8eda('0x1e')]()]+_0x8eda('0x23'));_0xd3d95b['userEmail']=_0x1164fd[_0x8eda('0xe')];for(_0x18c33d=0x0;_0x18c33d<_0x73142d[_0x8eda('0x1c')];_0x18c33d++){if(_0x73142d[_0x18c33d][_0x8eda('0x1d')]===_0x1164fd['username']){_0xd3d95b[_0x8eda('0x20')]=_0x73142d[_0x18c33d][_0x8eda('0x21')];}}}_0x3ff499(_0xd3d95b);})[_0x8eda('0x13')](function(_0x40fbc2){_0x41923f(_0x40fbc2[_0x8eda('0x15')]);});});}function createEndUser(_0x33570f,_0x60b870,_0x341922,_0x5586fb,_0x3c0af1,_0x4bb2c7){return new BPromise(function(_0x32cb11,_0x2d9ba1){return getAuthToken(_0x60b870,_0x341922,_0x4bb2c7)[_0x8eda('0x11')](function(_0xff9e14){var _0x1e045b=_0x4bb2c7['toLowerCase']()===_0x8eda('0x24')?_0x3c0af1['destcalleridnum']:_0x3c0af1[_0x8eda('0x25')];var _0x18fac0={'method':_0x8eda('0x26'),'uri':_0x5586fb+_0x8eda('0x27'),'body':{'telephone1':_0x1e045b,'fullname':_0x1e045b,'firstname':_0x1e045b,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x8eda('0x28')+_0x33570f[_0x8eda('0x20')]+')'},'headers':{'Authorization':'Bearer\x20'+_0xff9e14,'OData-Version':_0x8eda('0x18')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x18fac0);})[_0x8eda('0x11')](function(_0x5e2857){var _0x4753d0=_0x5e2857[_0x8eda('0x29')][_0x8eda('0x2a')];var _0x30466f=_0x4753d0['substring'](_0x4753d0[_0x8eda('0x2b')]('(')+0x1,_0x4753d0[_0x8eda('0x2b')](')'));_0x33570f['enduserId']=_0x30466f;_0x32cb11(_0x33570f);})['catch'](function(_0x105d25){_0x2d9ba1(_0x105d25[_0x8eda('0x15')]);});});}function getEndUser(_0x486213,_0x568278,_0x104100,_0x54430b,_0x39046f,_0x2c0e1d){return new BPromise(function(_0x4a098b,_0x2933a2){var _0x5df9c8=_0x2c0e1d[_0x8eda('0x2c')]()===_0x8eda('0x24')?_0x39046f[_0x8eda('0x2d')]:_0x39046f[_0x8eda('0x25')];return getAuthToken(_0x568278,_0x104100,_0x2c0e1d)['then'](function(_0x442801){var _0x5e0181={'method':_0x8eda('0x2e'),'uri':_0x54430b+'contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27'+_0x5df9c8[_0x8eda('0x2f')]('+',_0x8eda('0x30'))+'\x27','headers':{'Authorization':_0x8eda('0x17')+_0x442801,'If-None-Match':null,'OData-Version':_0x8eda('0x18')},'json':!![]};return rp(_0x5e0181);})[_0x8eda('0x11')](function(_0x412f32){var _0x4f815c=null;if(_0x412f32){var _0x418b45=_0x412f32[_0x8eda('0x31')];var _0x445c90=![];for(_0x4f815c=0x0;_0x4f815c<_0x418b45['length'];_0x4f815c++){if(_0x418b45[_0x4f815c][_0x8eda('0x32')]===_0x5df9c8){_0x445c90=!![];_0x486213[_0x8eda('0x33')]=_0x418b45[_0x4f815c][_0x8eda('0x34')];}}if(_0x445c90){_0x4a098b(_0x486213);}else{return createEndUser(_0x486213,_0x568278,_0x104100,_0x54430b,_0x39046f,_0x2c0e1d)[_0x8eda('0x11')](function(_0x1b40cb){logger['info']('['+[_0x2c0e1d['toUpperCase']()]+_0x8eda('0x35'),_0x1b40cb['enduserId']);_0x4a098b(_0x1b40cb);});}}else{return createEndUser(_0x486213,_0x568278,_0x104100,_0x54430b,_0x39046f,_0x2c0e1d)[_0x8eda('0x11')](function(_0x3f93ba){logger[_0x8eda('0x22')]('['+[_0x2c0e1d[_0x8eda('0x1e')]()]+']\x20Enduser\x20Created!',_0x3f93ba[_0x8eda('0x33')]);_0x4a098b(_0x3f93ba);});}});});}function getCustomFields(_0x1b9b7e,_0xe9f094,_0xf5713a){var _0x521b17={};if(_0x1b9b7e[_0x8eda('0x1c')]>0x0){_['forEach'](_0x1b9b7e,function(_0x24993d){if(_['includes'](['string',_0x8eda('0x36')],_0x24993d[_0x8eda('0x37')])&&_0x24993d['nameField']&&!_0x24993d[_0x8eda('0x38')]){var _0x3041fd=_0x24993d[_0x8eda('0x39')][_0x8eda('0x2c')]();var _0x470bbb=_0x3041fd['substring'](0x0,_0x3041fd[_0x8eda('0x3a')]('_'));var _0x4ee7c1=_0x3041fd[_0x8eda('0x3b')](_0x3041fd[_0x8eda('0x3a')]('_')+0x1);if(_0x470bbb===_0xf5713a){_0x521b17[_0x4ee7c1]=_0x24993d[_0x8eda('0x3c')];}}});}return _0x521b17;}function getTicket(_0x5b11d2,_0x22383a,_0x8b96c1,_0xdd486f,_0x4f82cb,_0x37e541,_0x21259f){return new BPromise(function(_0x5454a0,_0x1b8d71){var _0x20262f;return getAuthToken(_0x22383a,_0x8b96c1,_0x21259f)[_0x8eda('0x11')](function(_0x47ff79){if(_0x37e541[_0x8eda('0x3d')]===_0x8eda('0x3e')){_0x20262f={'method':_0x8eda('0x26'),'uri':_0xdd486f+_0x8eda('0x3f'),'body':Object[_0x8eda('0x40')]({},{'title':intUtil['getString'](_0x37e541[_0x8eda('0x41')],_0x4f82cb,'\x20'),'description':intUtil[_0x8eda('0x42')](_0x37e541[_0x8eda('0x43')],_0x4f82cb,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x5b11d2[_0x8eda('0x33')]+')','ownerid@odata.bind':'/systemusers('+_0x5b11d2[_0x8eda('0x20')]+')','caseorigincode':'1'},getCustomFields(_0x37e541[_0x8eda('0x44')],_0x4f82cb,_0x37e541[_0x8eda('0x3d')])),'headers':{'Authorization':'Bearer\x20'+_0x47ff79,'OData-Version':_0x8eda('0x18')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x37e541[_0x8eda('0x3d')]===_0x8eda('0x45')){_0x20262f={'method':_0x8eda('0x26'),'uri':_0xdd486f+_0x8eda('0x46'),'body':Object['assign']({},{'subject':intUtil[_0x8eda('0x42')](_0x37e541['Subjects'],_0x4f82cb,'\x20'),'phonenumber':String(_0x4f82cb[_0x8eda('0x25')]),'description':intUtil[_0x8eda('0x42')](_0x37e541[_0x8eda('0x43')],_0x4f82cb,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x5b11d2[_0x8eda('0x33')]+')','ownerid@odata.bind':_0x8eda('0x28')+_0x5b11d2[_0x8eda('0x20')]+')','directioncode':_0x5b11d2[_0x8eda('0x47')]===_0x8eda('0x48')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x8eda('0x28')+_0x5b11d2['userId']+')','participationtypemask':_0x5b11d2[_0x8eda('0x47')]===_0x8eda('0x48')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x5b11d2[_0x8eda('0x33')]+')','participationtypemask':_0x5b11d2[_0x8eda('0x47')]==='queue'?0x1:0x2}]},getCustomFields(_0x37e541[_0x8eda('0x44')],_0x4f82cb,_0x37e541[_0x8eda('0x3d')])),'headers':{'Authorization':_0x8eda('0x17')+_0x47ff79,'OData-Version':_0x8eda('0x18')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x20262f);})[_0x8eda('0x11')](function(_0x3737d9){var _0x37b553=_0x3737d9['headers'][_0x8eda('0x2a')];var _0x4c287b=_0x37b553['substring'](_0x37b553['lastIndexOf']('(')+0x1,_0x37b553['lastIndexOf'](')'));_0x5b11d2[_0x8eda('0x49')]=_0x4c287b;_0x5454a0(_0x5b11d2);})[_0x8eda('0x13')](function(_0x31fd2f){_0x1b8d71(_0x31fd2f[_0x8eda('0x15')]);});});}function emit(_0x472918,_0x1ead04,_0x1f86c6,_0x4898b5){var _0x285fc2={'uri':util['format'](_0x8eda('0x4a'),_0x472918,_0x1f86c6,_0x4898b5)};io['to'](util['format'](_0x8eda('0x4b'),_0x1ead04))[_0x8eda('0x4c')](_0x8eda('0x4d'),_0x285fc2);}exports['cs']=function(_0x1b9428,_0x19a31a,_0x11b330,_0x1f03a7,_0x47034c,_0x4caa0c,_0x3c7beb,_0x29a698){var _0x2266ff={};_0x4caa0c['remoteUri']=intUtil[_0x8eda('0x4e')](_0x4caa0c[_0x8eda('0xd')]);_0x4caa0c['serverUrl']=intUtil[_0x8eda('0x4e')](_0x4caa0c[_0x8eda('0x4f')]);_0x2266ff[_0x8eda('0x47')]=_0x29a698==='queue'||_0x29a698==='unmanaged'?_0x8eda('0x48'):_0x8eda('0x24');var _0x32bd73=util[_0x8eda('0x50')](_0x8eda('0x51'),_0x4caa0c[_0x8eda('0xd')]);var _0x3e5ac9=util['format'](_0x8eda('0x52'),_0x4caa0c['tenantId']);var _0x2211a9=util[_0x8eda('0x50')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4caa0c[_0x8eda('0x4f')],_0x19a31a['uniqueid'],md5(_0x19a31a[_0x8eda('0x53')]));if(_0x47034c&&_0x47034c['monitor_format']){logger['info'](_0x8eda('0x54'),'Recording\x20is\x20enabled!');_0x19a31a[_0x8eda('0x55')]=_0x2211a9;}else if(_0x3c7beb&&_0x3c7beb[_0x8eda('0x56')]&&_0x3c7beb[_0x8eda('0x56')]!==_0x8eda('0x57')){logger[_0x8eda('0x22')](_0x8eda('0x58'),_0x8eda('0x59'));_0x19a31a[_0x8eda('0x55')]=_0x2211a9;}else{_0x19a31a['recordingURL']='';}return getUser(_0x2266ff,_0x4caa0c,_0x1f03a7,_0x3e5ac9,_0x32bd73,_0x29a698)[_0x8eda('0x11')](function(_0x3b2696){logger['info']('['+_0x29a698[_0x8eda('0x1e')]()+']\x20The\x20User\x20ID\x20is:',_0x3b2696[_0x8eda('0x20')]);logger['info']('['+_0x29a698[_0x8eda('0x1e')]()+']\x20The\x20User\x20email\x20is:',_0x3b2696[_0x8eda('0x5a')]);return getEndUser(_0x3b2696,_0x4caa0c,_0x3e5ac9,_0x32bd73,_0x19a31a,_0x29a698);})[_0x8eda('0x11')](function(_0x102279){logger[_0x8eda('0x22')]('['+_0x29a698[_0x8eda('0x1e')]()+_0x8eda('0x5b'),_0x102279[_0x8eda('0x33')]);logger['info']('['+_0x29a698['toUpperCase']()+_0x8eda('0x5c'),_0x19a31a[_0x8eda('0x25')]);return getTicket(_0x102279,_0x4caa0c,_0x3e5ac9,_0x32bd73,_0x19a31a,_0x11b330,_0x29a698);})[_0x8eda('0x11')](function(_0x59aeb2){logger[_0x8eda('0x22')](util[_0x8eda('0x50')]('['+_0x29a698[_0x8eda('0x1e')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x11b330[_0x8eda('0x3d')],_0x59aeb2['ticketId']));logger[_0x8eda('0x22')](util[_0x8eda('0x50')]('['+_0x29a698[_0x8eda('0x1e')]()+_0x8eda('0x5d'),_0x29a698));if(_0x29a698!==_0x8eda('0x5e')){logger['info']('['+_0x29a698[_0x8eda('0x1e')]()+']',_0x8eda('0x5f'));emit(_0x4caa0c[_0x8eda('0xd')],_0x1f03a7[_0x8eda('0x60')],_0x11b330[_0x8eda('0x3d')],_0x59aeb2[_0x8eda('0x49')]);}})[_0x8eda('0x13')](function(_0x264033){logger[_0x8eda('0x61')]('['+_0x29a698[_0x8eda('0x1e')]()+_0x8eda('0x62'),util[_0x8eda('0x63')](_0x264033,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x4738=[']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','localhost','POST','clientId','remoteUri','username','password','clientSecret','then','catch','error','toUpperCase','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','length','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','internalemailaddress','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','userId','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','%2b','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','picklist','type','nameField','customField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','phonecall','phonecalls','queue','callDirection','ticketId','format','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4738,0x1e0));var _0x8473=function(_0x2a657c,_0x139c34){_0x2a657c=_0x2a657c-0x0;var _0x43b748=_0x4738[_0x2a657c];return _0x43b748;};'use strict';var _=require('lodash');var BPromise=require(_0x8473('0x0'));var rp=require(_0x8473('0x1'));var util=require(_0x8473('0x2'));var intUtil=require('./util');var md5=require(_0x8473('0x3'));var Redis=require(_0x8473('0x4'));var logger=require(_0x8473('0x5'))('dynamics365');var config=require(_0x8473('0x6'));config['redis']=_['defaults'](config[_0x8473('0x7')],{'host':_0x8473('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8473('0x7')]));function getAuthToken(_0x447811,_0xfbebe4,_0x38a4cd){var _0x233852={'method':_0x8473('0x9'),'uri':_0xfbebe4,'form':{'client_id':_0x447811[_0x8473('0xa')],'resource':_0x447811[_0x8473('0xb')],'username':_0x447811[_0x8473('0xc')],'password':_0x447811[_0x8473('0xd')],'grant_type':_0x8473('0xd'),'client_secret':_0x447811[_0x8473('0xe')]},'json':!![]};return rp(_0x233852)[_0x8473('0xf')](function(_0x380d8f){return _0x380d8f['access_token'];})[_0x8473('0x10')](function(_0x5b5f07){logger[_0x8473('0x11')]('['+[_0x38a4cd[_0x8473('0x12')]()]+']\x20Wrong\x20credentials!');return _0x5b5f07[_0x8473('0x13')];});}function getUser(_0x1ca425,_0x59821b,_0xd7dce7,_0x2bed5c,_0x13a28c,_0x3655c9){return new BPromise(function(_0x330666,_0x127ff8){return getAuthToken(_0x59821b,_0x2bed5c,_0x3655c9)[_0x8473('0xf')](function(_0x3c06bd){var _0x556fcb={'method':_0x8473('0x14'),'uri':_0x13a28c+_0x8473('0x15'),'headers':{'Authorization':_0x8473('0x16')+_0x3c06bd,'OData-Version':_0x8473('0x17')},'json':!![]};return rp(_0x556fcb);})['then'](function(_0x1b26a7){var _0xd921ab=_0x1b26a7[_0x8473('0x18')];var _0x5351c1=![];var _0x4e22c6=null;if(!_[_0x8473('0x19')](_0xd7dce7)){if(intUtil[_0x8473('0x1a')](_0xd7dce7[_0x8473('0x1b')])){_0x1ca425['userEmail']=_0xd7dce7[_0x8473('0x1b')];for(_0x4e22c6=0x0;_0x4e22c6<_0xd921ab[_0x8473('0x1c')];_0x4e22c6++){if(_0xd921ab[_0x4e22c6]['internalemailaddress']===_0xd7dce7[_0x8473('0x1b')]&&!_0xd921ab[_0x4e22c6]['isdisabled']){_0x5351c1=!![];logger[_0x8473('0x1d')]('['+[_0x3655c9[_0x8473('0x12')]()]+_0x8473('0x1e')+_0xd921ab[_0x4e22c6][_0x8473('0x1f')]+'!');_0x1ca425['userId']=_0xd921ab[_0x4e22c6][_0x8473('0x1f')];}}}}if(!_0x5351c1){logger[_0x8473('0x1d')]('['+[_0x3655c9['toUpperCase']()]+_0x8473('0x20'));_0x1ca425[_0x8473('0x21')]=_0x59821b[_0x8473('0xc')];for(_0x4e22c6=0x0;_0x4e22c6<_0xd921ab['length'];_0x4e22c6++){if(_0xd921ab[_0x4e22c6][_0x8473('0x22')]===_0x59821b[_0x8473('0xc')]){_0x1ca425['userId']=_0xd921ab[_0x4e22c6]['systemuserid'];}}}_0x330666(_0x1ca425);})[_0x8473('0x10')](function(_0x2732e1){_0x127ff8(_0x2732e1[_0x8473('0x13')]);});});}function createEndUser(_0x3a9437,_0x3be8a5,_0x1918ef,_0xced07,_0x22f6d5,_0x4b9471){return new BPromise(function(_0x1f103f,_0x2433e5){return getAuthToken(_0x3be8a5,_0x1918ef,_0x4b9471)[_0x8473('0xf')](function(_0x4eeafa){var _0x2508f2=_0x4b9471[_0x8473('0x23')]()===_0x8473('0x24')?_0x22f6d5[_0x8473('0x25')]:_0x22f6d5[_0x8473('0x26')];var _0x55c03f={'method':_0x8473('0x9'),'uri':_0xced07+_0x8473('0x27'),'body':{'telephone1':_0x2508f2,'fullname':_0x2508f2,'firstname':_0x2508f2,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x8473('0x28')+_0x3a9437[_0x8473('0x29')]+')'},'headers':{'Authorization':_0x8473('0x16')+_0x4eeafa,'OData-Version':_0x8473('0x17')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x55c03f);})[_0x8473('0xf')](function(_0x266e94){var _0x319412=_0x266e94[_0x8473('0x2a')][_0x8473('0x2b')];var _0x2ed00c=_0x319412[_0x8473('0x2c')](_0x319412[_0x8473('0x2d')]('(')+0x1,_0x319412[_0x8473('0x2d')](')'));_0x3a9437[_0x8473('0x2e')]=_0x2ed00c;_0x1f103f(_0x3a9437);})['catch'](function(_0x5cd2b5){_0x2433e5(_0x5cd2b5['message']);});});}function getEndUser(_0x48640b,_0x51af63,_0x2afb73,_0x21db55,_0x13bd71,_0x325733){return new BPromise(function(_0xc7db38,_0x307ed5){var _0x6ee93=_0x325733['toLowerCase']()==='outbound'?_0x13bd71['destcalleridnum']:_0x13bd71['calleridnum'];return getAuthToken(_0x51af63,_0x2afb73,_0x325733)[_0x8473('0xf')](function(_0x4c8e48){var _0x429703={'method':_0x8473('0x14'),'uri':_0x21db55+_0x8473('0x2f')+_0x6ee93['replace']('+',_0x8473('0x30'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x4c8e48,'If-None-Match':null,'OData-Version':_0x8473('0x17')},'json':!![]};return rp(_0x429703);})[_0x8473('0xf')](function(_0x4260dd){var _0x5542ac=null;if(_0x4260dd){var _0x31ae27=_0x4260dd['value'];var _0x7fe0c3=![];for(_0x5542ac=0x0;_0x5542ac<_0x31ae27[_0x8473('0x1c')];_0x5542ac++){if(_0x31ae27[_0x5542ac]['telephone1']===_0x6ee93){_0x7fe0c3=!![];_0x48640b['enduserId']=_0x31ae27[_0x5542ac][_0x8473('0x31')];}}if(_0x7fe0c3){_0xc7db38(_0x48640b);}else{return createEndUser(_0x48640b,_0x51af63,_0x2afb73,_0x21db55,_0x13bd71,_0x325733)[_0x8473('0xf')](function(_0x307065){logger[_0x8473('0x1d')]('['+[_0x325733[_0x8473('0x12')]()]+_0x8473('0x32'),_0x307065[_0x8473('0x2e')]);_0xc7db38(_0x307065);});}}else{return createEndUser(_0x48640b,_0x51af63,_0x2afb73,_0x21db55,_0x13bd71,_0x325733)[_0x8473('0xf')](function(_0x4c020e){logger[_0x8473('0x1d')]('['+[_0x325733[_0x8473('0x12')]()]+_0x8473('0x33'),_0x4c020e[_0x8473('0x2e')]);_0xc7db38(_0x4c020e);});}});});}function getCustomFields(_0x4ce2e3,_0x28c50d,_0x3bdbb0){var _0x335f27={};if(_0x4ce2e3[_0x8473('0x1c')]>0x0){_[_0x8473('0x34')](_0x4ce2e3,function(_0x252f78){if(_[_0x8473('0x35')]([_0x8473('0x36'),_0x8473('0x37')],_0x252f78[_0x8473('0x38')])&&_0x252f78[_0x8473('0x39')]&&!_0x252f78[_0x8473('0x3a')]){var _0x2be4ef=_0x252f78['idField'][_0x8473('0x23')]();var _0xb8e340=_0x2be4ef[_0x8473('0x2c')](0x0,_0x2be4ef[_0x8473('0x3b')]('_'));var _0x42ee06=_0x2be4ef[_0x8473('0x2c')](_0x2be4ef[_0x8473('0x3b')]('_')+0x1);if(_0xb8e340===_0x3bdbb0){_0x335f27[_0x42ee06]=_0x252f78[_0x8473('0x3c')];}}});}return _0x335f27;}function getTicket(_0x5ea77e,_0x3336f2,_0x298c02,_0x1964a9,_0x16da9e,_0x316e4f,_0x173a77){return new BPromise(function(_0x2e42e1,_0x359b4e){var _0x259cb6;return getAuthToken(_0x3336f2,_0x298c02,_0x173a77)[_0x8473('0xf')](function(_0x40e404){if(_0x316e4f[_0x8473('0x3d')]===_0x8473('0x3e')){_0x259cb6={'method':'POST','uri':_0x1964a9+_0x8473('0x3f'),'body':Object[_0x8473('0x40')]({},{'title':intUtil[_0x8473('0x41')](_0x316e4f[_0x8473('0x42')],_0x16da9e,'\x20'),'description':intUtil[_0x8473('0x41')](_0x316e4f[_0x8473('0x43')],_0x16da9e,'\x0a'),'customerid_contact@odata.bind':_0x8473('0x44')+_0x5ea77e['enduserId']+')','ownerid@odata.bind':_0x8473('0x28')+_0x5ea77e[_0x8473('0x29')]+')','caseorigincode':'1'},getCustomFields(_0x316e4f['Fields'],_0x16da9e,_0x316e4f[_0x8473('0x3d')])),'headers':{'Authorization':_0x8473('0x16')+_0x40e404,'OData-Version':_0x8473('0x17')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x316e4f[_0x8473('0x3d')]===_0x8473('0x45')){_0x259cb6={'method':'POST','uri':_0x1964a9+_0x8473('0x46'),'body':Object[_0x8473('0x40')]({},{'subject':intUtil[_0x8473('0x41')](_0x316e4f[_0x8473('0x42')],_0x16da9e,'\x20'),'phonenumber':String(_0x16da9e[_0x8473('0x26')]),'description':intUtil[_0x8473('0x41')](_0x316e4f[_0x8473('0x43')],_0x16da9e,'\x0a'),'regardingobjectid_contact@odata.bind':_0x8473('0x44')+_0x5ea77e['enduserId']+')','ownerid@odata.bind':'/systemusers('+_0x5ea77e[_0x8473('0x29')]+')','directioncode':_0x5ea77e['callDirection']===_0x8473('0x47')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x8473('0x28')+_0x5ea77e[_0x8473('0x29')]+')','participationtypemask':_0x5ea77e[_0x8473('0x48')]===_0x8473('0x47')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x5ea77e[_0x8473('0x2e')]+')','participationtypemask':_0x5ea77e[_0x8473('0x48')]===_0x8473('0x47')?0x1:0x2}]},getCustomFields(_0x316e4f['Fields'],_0x16da9e,_0x316e4f[_0x8473('0x3d')])),'headers':{'Authorization':_0x8473('0x16')+_0x40e404,'OData-Version':_0x8473('0x17')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x259cb6);})[_0x8473('0xf')](function(_0x1817b3){var _0x5bf5ad=_0x1817b3[_0x8473('0x2a')][_0x8473('0x2b')];var _0x4ef460=_0x5bf5ad[_0x8473('0x2c')](_0x5bf5ad[_0x8473('0x2d')]('(')+0x1,_0x5bf5ad[_0x8473('0x2d')](')'));_0x5ea77e[_0x8473('0x49')]=_0x4ef460;_0x2e42e1(_0x5ea77e);})[_0x8473('0x10')](function(_0x440424){_0x359b4e(_0x440424[_0x8473('0x13')]);});});}function emit(_0x3a372b,_0x10f150,_0x36f7ad,_0x4ec4d6){var _0x3d1439={'uri':util[_0x8473('0x4a')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x3a372b,_0x36f7ad,_0x4ec4d6)};io['to'](util['format']('user:%s',_0x10f150))[_0x8473('0x4b')](_0x8473('0x4c'),_0x3d1439);}exports['cs']=function(_0xa9ada8,_0x1fcd8a,_0x403531,_0x48a114,_0x138338,_0x2677be,_0x58477f,_0x29e682){var _0x1c6065={};_0x2677be[_0x8473('0xb')]=intUtil[_0x8473('0x4d')](_0x2677be[_0x8473('0xb')]);_0x2677be[_0x8473('0x4e')]=intUtil[_0x8473('0x4d')](_0x2677be['serverUrl']);_0x1c6065[_0x8473('0x48')]=_0x29e682===_0x8473('0x47')||_0x29e682===_0x8473('0x4f')?'queue':_0x8473('0x24');var _0x3d639b=util[_0x8473('0x4a')]('%s/api/data/v9.0/',_0x2677be['remoteUri']);var _0x4b49a5=util[_0x8473('0x4a')](_0x8473('0x50'),_0x2677be[_0x8473('0x51')]);var _0x42e89d=util[_0x8473('0x4a')](_0x8473('0x52'),_0x2677be[_0x8473('0x4e')],_0x1fcd8a[_0x8473('0x53')],md5(_0x1fcd8a[_0x8473('0x53')]));if(_0x138338&&_0x138338['monitor_format']){logger['info'](_0x8473('0x54'),_0x8473('0x55'));_0x1fcd8a['recordingURL']=_0x42e89d;}else if(_0x58477f&&_0x58477f[_0x8473('0x56')]&&_0x58477f[_0x8473('0x56')]!==_0x8473('0x57')){logger[_0x8473('0x1d')](_0x8473('0x58'),_0x8473('0x55'));_0x1fcd8a['recordingURL']=_0x42e89d;}else{_0x1fcd8a[_0x8473('0x59')]='';}return getUser(_0x1c6065,_0x2677be,_0x48a114,_0x4b49a5,_0x3d639b,_0x29e682)['then'](function(_0x1c41eb){logger[_0x8473('0x1d')]('['+_0x29e682[_0x8473('0x12')]()+_0x8473('0x5a'),_0x1c41eb['userId']);logger[_0x8473('0x1d')]('['+_0x29e682[_0x8473('0x12')]()+']\x20The\x20User\x20email\x20is:',_0x1c41eb['userEmail']);return getEndUser(_0x1c41eb,_0x2677be,_0x4b49a5,_0x3d639b,_0x1fcd8a,_0x29e682);})[_0x8473('0xf')](function(_0x32fe68){logger[_0x8473('0x1d')]('['+_0x29e682[_0x8473('0x12')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x32fe68[_0x8473('0x2e')]);logger[_0x8473('0x1d')]('['+_0x29e682[_0x8473('0x12')]()+_0x8473('0x5b'),_0x1fcd8a[_0x8473('0x26')]);return getTicket(_0x32fe68,_0x2677be,_0x4b49a5,_0x3d639b,_0x1fcd8a,_0x403531,_0x29e682);})['then'](function(_0x416718){logger[_0x8473('0x1d')](util[_0x8473('0x4a')]('['+_0x29e682[_0x8473('0x12')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x403531[_0x8473('0x3d')],_0x416718[_0x8473('0x49')]));logger['info'](util[_0x8473('0x4a')]('['+_0x29e682[_0x8473('0x12')]()+']\x20Call\x20direction:\x20%s',_0x29e682));if(_0x29e682!==_0x8473('0x4f')){logger[_0x8473('0x1d')]('['+_0x29e682['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x2677be[_0x8473('0xb')],_0x48a114[_0x8473('0x5c')],_0x403531[_0x8473('0x3d')],_0x416718[_0x8473('0x49')]);}})[_0x8473('0x10')](function(_0x4c8bdc){logger[_0x8473('0x11')]('['+_0x29e682[_0x8473('0x12')]()+_0x8473('0x5d'),util[_0x8473('0x5e')](_0x4c8bdc,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index 500a997..f8f71d2 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 _0x9c6e=['stringify','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Tags','name','Fields','mapValues','custom_fields','value','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','POST','Enduser\x20created.','Basic\x20%s','toString','base64','debug','[HTTP]','defaults','GET','map','includes','string','type','nameField','customField','toLowerCase','content','picklist','push','idField','variable','variableName','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','destcalleridname','destcalleridnum','unmanaged','lastevent','toUpperCase','The\x20Ticket\x20ID\x20is:'];(function(_0x117ac5,_0x169d26){var _0x2fdc47=function(_0x2ca0b){while(--_0x2ca0b){_0x117ac5['push'](_0x117ac5['shift']());}};_0x2fdc47(++_0x169d26);}(_0x9c6e,0x1d7));var _0xe9c6=function(_0x4473be,_0x529ba7){_0x4473be=_0x4473be-0x0;var _0x4a2ede=_0x9c6e[_0x4473be];return _0x4a2ede;};'use strict';var _=require(_0xe9c6('0x0'));var rp=require('request-promise');var md5=require(_0xe9c6('0x1'));var util=require(_0xe9c6('0x2'));var Redis=require(_0xe9c6('0x3'));var intUtil=require(_0xe9c6('0x4'));var config=require(_0xe9c6('0x5'));var logger=require(_0xe9c6('0x6'))(_0xe9c6('0x7'));config[_0xe9c6('0x8')]=_['defaults'](config['redis'],{'host':_0xe9c6('0x9'),'port':0x18eb});var io=require(_0xe9c6('0xa'))(new Redis(config[_0xe9c6('0x8')]));var headers={'Content-Type':_0xe9c6('0xb'),'Accept':_0xe9c6('0xb')};function emit(_0x34bf89,_0x369378,_0x1a3eab){io['to'](_0x34bf89)[_0xe9c6('0xc')](_0x369378,_0x1a3eab);}function getTicket(_0x5f5d7e,_0x580c0b,_0x356165,_0x56ff18,_0x205857){logger[_0xe9c6('0xd')]('Creating\x20new\x20ticket...');var _0x5d9a14=_[_0xe9c6('0xe')]({'responder_id':_0x580c0b['id'],'requester_id':_0x356165['id'],'name':util[_0xe9c6('0xf')](_0xe9c6('0x10'),_0x205857[_0xe9c6('0x11')]),'phone':_0x205857[_0xe9c6('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xe9c6('0x13')](_0x56ff18[_0xe9c6('0x14')],_0x205857,'\x20'),'description':intUtil[_0xe9c6('0x13')](_0x56ff18['Descriptions'],_0x205857,'
'),'tags':getTags(_0x56ff18[_0xe9c6('0x15')],_0xe9c6('0x16'))},getCustomFields(_0x56ff18[_0xe9c6('0x17')],_0x205857));_0x5d9a14['custom_fields']=_[_0xe9c6('0x18')](_['keyBy'](_0x5d9a14[_0xe9c6('0x19')],'id'),_0xe9c6('0x1a'));return request({'uri':util[_0xe9c6('0xf')](_0xe9c6('0x1b'),_0x5f5d7e[_0xe9c6('0x1c')]),'method':'POST','body':_0x5d9a14})[_0xe9c6('0x1d')](function(_0x550ebb){logger[_0xe9c6('0xd')](_0xe9c6('0x1e'));return _0x550ebb;});}function getUser(_0x5d7aa7,_0x1b35f2){if(intUtil[_0xe9c6('0x1f')](_0x1b35f2)){return request({'uri':util[_0xe9c6('0xf')](_0xe9c6('0x20'),_0x5d7aa7['remoteUri']),'qs':{'email':_0x1b35f2}})[_0xe9c6('0x1d')](function(_0x8046f1){if(_0x8046f1[_0xe9c6('0x21')]){logger['info'](_0xe9c6('0x22'));return _[_0xe9c6('0x23')](_0x8046f1,function(_0x310eb8){return _0x310eb8[_0xe9c6('0x24')][_0xe9c6('0x25')]===_0x1b35f2;});}else{logger[_0xe9c6('0xd')](_0xe9c6('0x26'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x5d7aa7[_0xe9c6('0x1c')])})[_0xe9c6('0x1d')](function(_0x4faa9f){logger[_0xe9c6('0xd')]('Admin\x20account\x20selected.');return _0x4faa9f;});}});}else{logger['info'](_0xe9c6('0x27'));return request({'uri':util[_0xe9c6('0xf')](_0xe9c6('0x28'),_0x5d7aa7[_0xe9c6('0x1c')])})['then'](function(_0x57f3b7){logger[_0xe9c6('0xd')]('Admin\x20account\x20selected.');return _0x57f3b7;});}}function getEndUser(_0x5bea08,_0x416863,_0x18e4ce){logger[_0xe9c6('0xd')](_0xe9c6('0x29'),_0x18e4ce);return request({'uri':util[_0xe9c6('0xf')](_0xe9c6('0x2a'),_0x5bea08[_0xe9c6('0x1c')]),'qs':{'phone':_0x18e4ce}})[_0xe9c6('0x1d')](function(_0x539a0b){if(_0x539a0b[_0xe9c6('0x21')]){logger[_0xe9c6('0xd')](_0xe9c6('0x2b'));return _[_0xe9c6('0x23')](_0x539a0b,{'phone':_0x18e4ce});}else{logger[_0xe9c6('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0xe9c6('0x2a'),_0x5bea08[_0xe9c6('0x1c')]),'method':_0xe9c6('0x2c'),'body':{'name':_0x416863,'phone':_0x18e4ce}})[_0xe9c6('0x1d')](function(_0x22e1d9){logger[_0xe9c6('0xd')](_0xe9c6('0x2d'));return _0x22e1d9;});}});}function getAuth(_0x1cba81){return util['format'](_0xe9c6('0x2e'),new Buffer(_0x1cba81['apiKey']+':X')[_0xe9c6('0x2f')](_0xe9c6('0x30')));}function request(_0x77d768){logger[_0xe9c6('0x31')](_0xe9c6('0x32'),JSON['stringify'](_0x77d768));return rp(_[_0xe9c6('0x33')](_0x77d768,{'method':_0xe9c6('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x599b92,_0x5002b7){var _0x55bb13=[];if(_0x599b92&&_0x599b92['length']>0x0){_0x55bb13=_[_0xe9c6('0x35')](_0x599b92,_0x5002b7);}return _0x55bb13;}function getCustomFields(_0x696925,_0x2f83a6){var _0x2fcb53=[];var _0x3a8142={'custom_fields':[]};if(_0x696925[_0xe9c6('0x21')]>0x0){_['forEach'](_0x696925,function(_0x2c79ff){if(_[_0xe9c6('0x36')]([_0xe9c6('0x37'),'picklist'],_0x2c79ff[_0xe9c6('0x38')])&&_0x2c79ff[_0xe9c6('0x39')]&&!_0x2c79ff[_0xe9c6('0x3a')]){_0x3a8142[_0x2c79ff['nameField'][_0xe9c6('0x3b')]()]=_0x2c79ff[_0xe9c6('0x3c')]['toString']();}else if(_['includes']([_0xe9c6('0x37'),_0xe9c6('0x3d')],_0x2c79ff[_0xe9c6('0x38')])&&_0x2c79ff['idField']&&_0x2c79ff[_0xe9c6('0x3a')]){_0x3a8142[_0xe9c6('0x19')][_0xe9c6('0x3e')]({'id':_0x2c79ff[_0xe9c6('0x3f')],'value':_0x2c79ff[_0xe9c6('0x3c')][_0xe9c6('0x2f')]()});}else if(_0x2c79ff[_0xe9c6('0x38')]===_0xe9c6('0x40')&&_0x2c79ff[_0xe9c6('0x41')]&&_0x2c79ff[_0xe9c6('0x3f')]&&_0x2c79ff[_0xe9c6('0x3a')]){_0x2f83a6[_0x2c79ff[_0xe9c6('0x41')]]&&_0x3a8142[_0xe9c6('0x19')][_0xe9c6('0x3e')]({'id':_0x2c79ff[_0xe9c6('0x3f')],'value':_0x2f83a6[_0x2c79ff[_0xe9c6('0x41')]][_0xe9c6('0x2f')]()});}else if(_0x2c79ff['type']==='customVariable'&&_0x2c79ff[_0xe9c6('0x42')]&&_0x2c79ff[_0xe9c6('0x42')][_0xe9c6('0x16')]&&_0x2c79ff[_0xe9c6('0x3f')]&&_0x2c79ff[_0xe9c6('0x3a')]){_0x2f83a6[_0x2c79ff[_0xe9c6('0x42')][_0xe9c6('0x16')]['toLowerCase']()]&&_0x3a8142[_0xe9c6('0x19')][_0xe9c6('0x3e')]({'id':_0x2c79ff[_0xe9c6('0x3f')],'value':_0x2f83a6[_0x2c79ff[_0xe9c6('0x42')][_0xe9c6('0x16')][_0xe9c6('0x3b')]()][_0xe9c6('0x2f')]()});}});}return _0x3a8142;}exports['queue']=function(_0x2c1f7e,_0x3cac3b,_0x11405a,_0x14be2b,_0xc44993,_0x5a88af){var _0x56d871,_0x63863f;_0x5a88af[_0xe9c6('0x1c')]=intUtil[_0xe9c6('0x43')](_0x5a88af['remoteUri']);_0x5a88af[_0xe9c6('0x44')]=intUtil['stripTrailingSlash'](_0x5a88af[_0xe9c6('0x44')]);if(_0xc44993&&_0xc44993[_0xe9c6('0x45')]){logger[_0xe9c6('0xd')](_0xe9c6('0x46'),_0xe9c6('0x47'));_0x3cac3b[_0xe9c6('0x48')]=util[_0xe9c6('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5a88af[_0xe9c6('0x44')],_0x3cac3b[_0xe9c6('0x49')],md5(_0x3cac3b['uniqueid']));}else{_0x3cac3b['recordingURL']='';}headers['Authorization']=getAuth(_0x5a88af);return getUser(_0x5a88af,_0x14be2b[_0xe9c6('0x25')])['then'](function(_0x2f78e1){_0x56d871=_0x2f78e1;logger[_0xe9c6('0xd')](_0xe9c6('0x4a'),_0x56d871['id']);return getEndUser(_0x5a88af,_0x3cac3b[_0xe9c6('0x11')],_0x3cac3b['calleridnum']);})[_0xe9c6('0x1d')](function(_0x4778dc){_0x63863f=_0x4778dc;logger[_0xe9c6('0xd')](_0xe9c6('0x4b'),_0x63863f['id']);return getTicket(_0x5a88af,_0x56d871,_0x63863f,_0x11405a,_0x3cac3b);})[_0xe9c6('0x1d')](function(_0x4732e0){if(_0x4732e0&&_0x4732e0['id']){logger[_0xe9c6('0xd')](_0xe9c6('0x1e'));logger[_0xe9c6('0xd')]('The\x20Ticket\x20ID\x20is:',_0x4732e0['id']);logger[_0xe9c6('0xd')](_0xe9c6('0x46'),_0xe9c6('0x4c'));emit(util[_0xe9c6('0xf')](_0xe9c6('0x4d'),_0x14be2b[_0xe9c6('0x16')]),_0xe9c6('0x4e'),{'uri':util[_0xe9c6('0xf')](_0xe9c6('0x4f'),_0x5a88af[_0xe9c6('0x1c')],_0x4732e0['id'])});}})[_0xe9c6('0x50')](function(_0x91d27e){logger[_0xe9c6('0x51')](_0xe9c6('0x46'),JSON['stringify'](_0x91d27e));});};exports[_0xe9c6('0x52')]=function(_0x5c9c99,_0x487636,_0xce2507,_0x2e8e8d,_0x610f58,_0x3721cf,_0x2a1a44){var _0x2b15e5,_0x5ecc20;_0x3721cf['remoteUri']=intUtil[_0xe9c6('0x43')](_0x3721cf[_0xe9c6('0x1c')]);_0x3721cf[_0xe9c6('0x44')]=intUtil[_0xe9c6('0x43')](_0x3721cf['serverUrl']);if(_0x2a1a44&&_0x2a1a44['recordingFormat']&&_0x2a1a44[_0xe9c6('0x53')]!=='none'){logger[_0xe9c6('0xd')](_0xe9c6('0x54'),_0xe9c6('0x47'));_0x487636[_0xe9c6('0x48')]=util['format'](_0xe9c6('0x55'),_0x3721cf[_0xe9c6('0x44')],_0x487636[_0xe9c6('0x49')],md5(_0x487636[_0xe9c6('0x49')]));}headers[_0xe9c6('0x56')]=getAuth(_0x3721cf);return getUser(_0x3721cf,_0x2e8e8d[_0xe9c6('0x25')])[_0xe9c6('0x1d')](function(_0x51466d){_0x2b15e5=_0x51466d;logger[_0xe9c6('0xd')](_0xe9c6('0x4a'),_0x2b15e5['id']);return getEndUser(_0x3721cf,_0x487636[_0xe9c6('0x57')],_0x487636[_0xe9c6('0x58')]);})[_0xe9c6('0x1d')](function(_0x133f29){_0x5ecc20=_0x133f29;logger[_0xe9c6('0xd')]('The\x20Enduser\x20ID\x20is:',_0x5ecc20['id']);return getTicket(_0x3721cf,_0x2b15e5,_0x5ecc20,_0xce2507,_0x487636);})['then'](function(_0x5f2f5c){if(_0x5f2f5c&&_0x5f2f5c['id']){logger['info'](_0xe9c6('0x1e'));logger[_0xe9c6('0xd')]('The\x20Ticket\x20ID\x20is:',_0x5f2f5c['id']);logger[_0xe9c6('0xd')](_0xe9c6('0x54'),_0xe9c6('0x4c'));emit(util[_0xe9c6('0xf')](_0xe9c6('0x4d'),_0x2e8e8d[_0xe9c6('0x16')]),_0xe9c6('0x4e'),{'uri':util[_0xe9c6('0xf')]('%s/helpdesk/tickets/%d',_0x3721cf[_0xe9c6('0x1c')],_0x5f2f5c['id'])});}})[_0xe9c6('0x50')](function(_0x498e3b){logger[_0xe9c6('0x51')]('[OUTBOUND]',JSON['stringify'](_0x498e3b));});};exports[_0xe9c6('0x59')]=function(_0x8e48ce,_0x2b5494,_0x1b2221,_0x4f585f,_0x3785f2,_0x496675){var _0xc1051b,_0x20f22c;_0x496675[_0xe9c6('0x1c')]=intUtil['stripTrailingSlash'](_0x496675[_0xe9c6('0x1c')]);_0x496675[_0xe9c6('0x44')]=intUtil['stripTrailingSlash'](_0x496675[_0xe9c6('0x44')]);if(_0x3785f2&&_0x3785f2[_0xe9c6('0x45')]){logger[_0xe9c6('0xd')]('['+_0x2b5494[_0xe9c6('0x5a')][_0xe9c6('0x5b')]()+']','Recording\x20is\x20enabled!');_0x2b5494[_0xe9c6('0x48')]=util[_0xe9c6('0xf')](_0xe9c6('0x55'),_0x496675[_0xe9c6('0x44')],_0x2b5494[_0xe9c6('0x49')],md5(_0x2b5494[_0xe9c6('0x49')]));}else{_0x2b5494['recordingURL']='';}headers[_0xe9c6('0x56')]=getAuth(_0x496675);return getUser(_0x496675,'')['then'](function(_0x43f2ef){_0xc1051b=_0x43f2ef;logger[_0xe9c6('0xd')](_0xe9c6('0x4a'),_0xc1051b['id']);return getEndUser(_0x496675,_0x2b5494['calleridname'],_0x2b5494[_0xe9c6('0x12')]);})[_0xe9c6('0x1d')](function(_0x3fb52a){_0x20f22c=_0x3fb52a;logger[_0xe9c6('0xd')](_0xe9c6('0x4b'),_0x20f22c['id']);return getTicket(_0x496675,_0xc1051b,_0x20f22c,_0x1b2221,_0x2b5494);})[_0xe9c6('0x1d')](function(_0x47324f){if(_0x47324f){logger['info'](_0xe9c6('0x1e'));logger[_0xe9c6('0xd')](_0xe9c6('0x5c'),_0x47324f['id']);}})[_0xe9c6('0x50')](function(_0x479250){logger['error']('['+_0x2b5494['lastevent']['toUpperCase']()+']',JSON[_0xe9c6('0x5d')](_0x479250));});}; \ No newline at end of file +var _0xd48f=['Recording\x20is\x20enabled!','destcalleridnum','[OUTBOUND]','user:%s','unmanaged','monitor_format','toUpperCase','md5','util','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','name','Fields','custom_fields','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','find','contact','email','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','[HTTP]','stringify','map','forEach','includes','string','type','customField','nameField','toLowerCase','content','push','idField','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none'];(function(_0x310504,_0x26ad95){var _0x5b36d0=function(_0x253f28){while(--_0x253f28){_0x310504['push'](_0x310504['shift']());}};_0x5b36d0(++_0x26ad95);}(_0xd48f,0x10c));var _0xfd48=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0xd48f[_0x2261ce];return _0x524640;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xfd48('0x0'));var util=require(_0xfd48('0x1'));var Redis=require('ioredis');var intUtil=require(_0xfd48('0x2'));var config=require(_0xfd48('0x3'));var logger=require('../../../../config/logger')('freshdesk');config[_0xfd48('0x4')]=_[_0xfd48('0x5')](config['redis'],{'host':_0xfd48('0x6'),'port':0x18eb});var io=require(_0xfd48('0x7'))(new Redis(config[_0xfd48('0x4')]));var headers={'Content-Type':_0xfd48('0x8'),'Accept':_0xfd48('0x8')};function emit(_0x4c0bad,_0x45d102,_0x316c50){io['to'](_0x4c0bad)[_0xfd48('0x9')](_0x45d102,_0x316c50);}function getTicket(_0x40394c,_0x20a401,_0x321c08,_0x26cf13,_0x121dde){logger[_0xfd48('0xa')](_0xfd48('0xb'));var _0x4ff503=_[_0xfd48('0xc')]({'responder_id':_0x20a401['id'],'requester_id':_0x321c08['id'],'name':util[_0xfd48('0xd')](_0xfd48('0xe'),_0x121dde[_0xfd48('0xf')]),'phone':_0x121dde[_0xfd48('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xfd48('0x11')](_0x26cf13['Subjects'],_0x121dde,'\x20'),'description':intUtil['getString'](_0x26cf13[_0xfd48('0x12')],_0x121dde,'
'),'tags':getTags(_0x26cf13['Tags'],_0xfd48('0x13'))},getCustomFields(_0x26cf13[_0xfd48('0x14')],_0x121dde));_0x4ff503[_0xfd48('0x15')]=_['mapValues'](_[_0xfd48('0x16')](_0x4ff503[_0xfd48('0x15')],'id'),_0xfd48('0x17'));return request({'uri':util[_0xfd48('0xd')](_0xfd48('0x18'),_0x40394c[_0xfd48('0x19')]),'method':_0xfd48('0x1a'),'body':_0x4ff503})[_0xfd48('0x1b')](function(_0x4ae1bb){logger[_0xfd48('0xa')](_0xfd48('0x1c'));return _0x4ae1bb;});}function getUser(_0x2c8b83,_0x374bdb){if(intUtil[_0xfd48('0x1d')](_0x374bdb)){return request({'uri':util[_0xfd48('0xd')](_0xfd48('0x1e'),_0x2c8b83[_0xfd48('0x19')]),'qs':{'email':_0x374bdb}})['then'](function(_0x4e2cef){if(_0x4e2cef[_0xfd48('0x1f')]){logger[_0xfd48('0xa')]('Agent\x20found!');return _[_0xfd48('0x20')](_0x4e2cef,function(_0x1fc85e){return _0x1fc85e[_0xfd48('0x21')][_0xfd48('0x22')]===_0x374bdb;});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xfd48('0xd')](_0xfd48('0x23'),_0x2c8b83[_0xfd48('0x19')])})['then'](function(_0x33cf7d){logger[_0xfd48('0xa')]('Admin\x20account\x20selected.');return _0x33cf7d;});}});}else{logger[_0xfd48('0xa')](_0xfd48('0x24'));return request({'uri':util['format'](_0xfd48('0x23'),_0x2c8b83[_0xfd48('0x19')])})[_0xfd48('0x1b')](function(_0x1bbe33){logger[_0xfd48('0xa')]('Admin\x20account\x20selected.');return _0x1bbe33;});}}function getEndUser(_0xa92f0e,_0x4c9ad4,_0x6ef507){logger[_0xfd48('0xa')](_0xfd48('0x25'),_0x6ef507);return request({'uri':util[_0xfd48('0xd')](_0xfd48('0x26'),_0xa92f0e[_0xfd48('0x19')]),'qs':{'phone':_0x6ef507}})[_0xfd48('0x1b')](function(_0x5080af){if(_0x5080af['length']){logger[_0xfd48('0xa')]('Enduser\x20found!');return _[_0xfd48('0x20')](_0x5080af,{'phone':_0x6ef507});}else{logger[_0xfd48('0xa')](_0xfd48('0x27'));return request({'uri':util[_0xfd48('0xd')](_0xfd48('0x26'),_0xa92f0e[_0xfd48('0x19')]),'method':_0xfd48('0x1a'),'body':{'name':_0x4c9ad4,'phone':_0x6ef507}})[_0xfd48('0x1b')](function(_0x19ae12){logger['info'](_0xfd48('0x28'));return _0x19ae12;});}});}function getAuth(_0x24af02){return util[_0xfd48('0xd')](_0xfd48('0x29'),new Buffer(_0x24af02[_0xfd48('0x2a')]+':X')[_0xfd48('0x2b')](_0xfd48('0x2c')));}function request(_0x2fdaae){logger['debug'](_0xfd48('0x2d'),JSON[_0xfd48('0x2e')](_0x2fdaae));return rp(_[_0xfd48('0x5')](_0x2fdaae,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5059c8,_0x229fe6){var _0x3207fd=[];if(_0x5059c8&&_0x5059c8[_0xfd48('0x1f')]>0x0){_0x3207fd=_[_0xfd48('0x2f')](_0x5059c8,_0x229fe6);}return _0x3207fd;}function getCustomFields(_0xe70c96,_0x3c4829){var _0xf149a4=[];var _0x10865f={'custom_fields':[]};if(_0xe70c96['length']>0x0){_[_0xfd48('0x30')](_0xe70c96,function(_0xd0cf63){if(_[_0xfd48('0x31')]([_0xfd48('0x32'),'picklist'],_0xd0cf63[_0xfd48('0x33')])&&_0xd0cf63['nameField']&&!_0xd0cf63[_0xfd48('0x34')]){_0x10865f[_0xd0cf63[_0xfd48('0x35')][_0xfd48('0x36')]()]=_0xd0cf63[_0xfd48('0x37')][_0xfd48('0x2b')]();}else if(_[_0xfd48('0x31')]([_0xfd48('0x32'),'picklist'],_0xd0cf63['type'])&&_0xd0cf63['idField']&&_0xd0cf63[_0xfd48('0x34')]){_0x10865f[_0xfd48('0x15')][_0xfd48('0x38')]({'id':_0xd0cf63[_0xfd48('0x39')],'value':_0xd0cf63[_0xfd48('0x37')][_0xfd48('0x2b')]()});}else if(_0xd0cf63[_0xfd48('0x33')]===_0xfd48('0x3a')&&_0xd0cf63['variableName']&&_0xd0cf63[_0xfd48('0x39')]&&_0xd0cf63['customField']){_0x3c4829[_0xd0cf63[_0xfd48('0x3b')]]&&_0x10865f[_0xfd48('0x15')][_0xfd48('0x38')]({'id':_0xd0cf63['idField'],'value':_0x3c4829[_0xd0cf63[_0xfd48('0x3b')]][_0xfd48('0x2b')]()});}else if(_0xd0cf63[_0xfd48('0x33')]===_0xfd48('0x3c')&&_0xd0cf63[_0xfd48('0x3d')]&&_0xd0cf63[_0xfd48('0x3d')][_0xfd48('0x13')]&&_0xd0cf63['idField']&&_0xd0cf63[_0xfd48('0x34')]){_0x3c4829[_0xd0cf63[_0xfd48('0x3d')]['name']['toLowerCase']()]&&_0x10865f[_0xfd48('0x15')][_0xfd48('0x38')]({'id':_0xd0cf63[_0xfd48('0x39')],'value':_0x3c4829[_0xd0cf63[_0xfd48('0x3d')][_0xfd48('0x13')][_0xfd48('0x36')]()]['toString']()});}});}return _0x10865f;}exports[_0xfd48('0x3e')]=function(_0x4d3fb3,_0x3548dc,_0x1d426b,_0x3031f4,_0x2bc2a6,_0x104885){var _0x4989d3,_0x5621f9;_0x104885[_0xfd48('0x19')]=intUtil['stripTrailingSlash'](_0x104885[_0xfd48('0x19')]);_0x104885['serverUrl']=intUtil[_0xfd48('0x3f')](_0x104885[_0xfd48('0x40')]);if(_0x2bc2a6&&_0x2bc2a6['monitor_format']){logger[_0xfd48('0xa')](_0xfd48('0x41'),'Recording\x20is\x20enabled!');_0x3548dc[_0xfd48('0x42')]=util[_0xfd48('0xd')](_0xfd48('0x43'),_0x104885[_0xfd48('0x40')],_0x3548dc[_0xfd48('0x44')],md5(_0x3548dc[_0xfd48('0x44')]));}else{_0x3548dc['recordingURL']='';}headers[_0xfd48('0x45')]=getAuth(_0x104885);return getUser(_0x104885,_0x3031f4['email'])[_0xfd48('0x1b')](function(_0x1695c2){_0x4989d3=_0x1695c2;logger[_0xfd48('0xa')](_0xfd48('0x46'),_0x4989d3['id']);return getEndUser(_0x104885,_0x3548dc[_0xfd48('0xf')],_0x3548dc['calleridnum']);})['then'](function(_0x21b64b){_0x5621f9=_0x21b64b;logger['info'](_0xfd48('0x47'),_0x5621f9['id']);return getTicket(_0x104885,_0x4989d3,_0x5621f9,_0x1d426b,_0x3548dc);})[_0xfd48('0x1b')](function(_0x5d3166){if(_0x5d3166&&_0x5d3166['id']){logger[_0xfd48('0xa')](_0xfd48('0x1c'));logger[_0xfd48('0xa')](_0xfd48('0x48'),_0x5d3166['id']);logger[_0xfd48('0xa')](_0xfd48('0x41'),_0xfd48('0x49'));emit(util[_0xfd48('0xd')]('user:%s',_0x3031f4[_0xfd48('0x13')]),_0xfd48('0x4a'),{'uri':util['format'](_0xfd48('0x4b'),_0x104885['remoteUri'],_0x5d3166['id'])});}})[_0xfd48('0x4c')](function(_0x101f35){logger[_0xfd48('0x4d')](_0xfd48('0x41'),JSON['stringify'](_0x101f35));});};exports['outbound']=function(_0xc4eae,_0x240a3e,_0x127714,_0x12ca30,_0x25ce10,_0x41b976,_0x30ff70){var _0x5d745a,_0x357aaa;_0x41b976['remoteUri']=intUtil[_0xfd48('0x3f')](_0x41b976['remoteUri']);_0x41b976[_0xfd48('0x40')]=intUtil[_0xfd48('0x3f')](_0x41b976[_0xfd48('0x40')]);if(_0x30ff70&&_0x30ff70[_0xfd48('0x4e')]&&_0x30ff70[_0xfd48('0x4e')]!==_0xfd48('0x4f')){logger[_0xfd48('0xa')]('[OUTBOUND]',_0xfd48('0x50'));_0x240a3e[_0xfd48('0x42')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x41b976['serverUrl'],_0x240a3e['uniqueid'],md5(_0x240a3e[_0xfd48('0x44')]));}headers[_0xfd48('0x45')]=getAuth(_0x41b976);return getUser(_0x41b976,_0x12ca30[_0xfd48('0x22')])['then'](function(_0x1870a7){_0x5d745a=_0x1870a7;logger['info'](_0xfd48('0x46'),_0x5d745a['id']);return getEndUser(_0x41b976,_0x240a3e['destcalleridname'],_0x240a3e[_0xfd48('0x51')]);})[_0xfd48('0x1b')](function(_0x4872dd){_0x357aaa=_0x4872dd;logger['info'](_0xfd48('0x47'),_0x357aaa['id']);return getTicket(_0x41b976,_0x5d745a,_0x357aaa,_0x127714,_0x240a3e);})['then'](function(_0x29acdc){if(_0x29acdc&&_0x29acdc['id']){logger[_0xfd48('0xa')](_0xfd48('0x1c'));logger[_0xfd48('0xa')](_0xfd48('0x48'),_0x29acdc['id']);logger['info'](_0xfd48('0x52'),_0xfd48('0x49'));emit(util['format'](_0xfd48('0x53'),_0x12ca30['name']),_0xfd48('0x4a'),{'uri':util[_0xfd48('0xd')]('%s/helpdesk/tickets/%d',_0x41b976[_0xfd48('0x19')],_0x29acdc['id'])});}})[_0xfd48('0x4c')](function(_0x39a06a){logger[_0xfd48('0x4d')](_0xfd48('0x52'),JSON['stringify'](_0x39a06a));});};exports[_0xfd48('0x54')]=function(_0x104c9f,_0x4cc292,_0x5f5711,_0x52dcaf,_0x549dca,_0xc1c014){var _0xc4aacc,_0x2c8f70;_0xc1c014[_0xfd48('0x19')]=intUtil['stripTrailingSlash'](_0xc1c014['remoteUri']);_0xc1c014['serverUrl']=intUtil[_0xfd48('0x3f')](_0xc1c014[_0xfd48('0x40')]);if(_0x549dca&&_0x549dca[_0xfd48('0x55')]){logger[_0xfd48('0xa')]('['+_0x4cc292['lastevent'][_0xfd48('0x56')]()+']',_0xfd48('0x50'));_0x4cc292[_0xfd48('0x42')]=util[_0xfd48('0xd')](_0xfd48('0x43'),_0xc1c014['serverUrl'],_0x4cc292['uniqueid'],md5(_0x4cc292[_0xfd48('0x44')]));}else{_0x4cc292[_0xfd48('0x42')]='';}headers[_0xfd48('0x45')]=getAuth(_0xc1c014);return getUser(_0xc1c014,'')[_0xfd48('0x1b')](function(_0x1bbbf1){_0xc4aacc=_0x1bbbf1;logger[_0xfd48('0xa')](_0xfd48('0x46'),_0xc4aacc['id']);return getEndUser(_0xc1c014,_0x4cc292[_0xfd48('0xf')],_0x4cc292[_0xfd48('0x10')]);})['then'](function(_0x524db1){_0x2c8f70=_0x524db1;logger['info'](_0xfd48('0x47'),_0x2c8f70['id']);return getTicket(_0xc1c014,_0xc4aacc,_0x2c8f70,_0x5f5711,_0x4cc292);})[_0xfd48('0x1b')](function(_0x5151fc){if(_0x5151fc){logger[_0xfd48('0xa')]('Ticket\x20created!');logger[_0xfd48('0xa')](_0xfd48('0x48'),_0x5151fc['id']);}})[_0xfd48('0x4c')](function(_0xace69d){logger[_0xfd48('0x4d')]('['+_0x4cc292['lastevent'][_0xfd48('0x56')]()+']',JSON[_0xfd48('0x2e')](_0xace69d));});}; \ 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 6864b64..7052346 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 _0xecbf=['contact','message','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','task','Task\x20created:','ticketId','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','moment','bluebird','ioredis','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','GET','headers','info','Getting\x20admin\x20information','then','length','email','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','Getting\x20user\x20list','users','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','contactNumber','mobile_number','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0xecbf,0x18b));var _0xfecb=function(_0x3e8f28,_0x37aab6){_0x3e8f28=_0x3e8f28-0x0;var _0x112c27=_0xecbf[_0x3e8f28];return _0x112c27;};'use strict';var _=require(_0xfecb('0x0'));var rp=require(_0xfecb('0x1'));var md5=require('md5');var util=require(_0xfecb('0x2'));var moment=require(_0xfecb('0x3'));var Promise=require(_0xfecb('0x4'));var Redis=require(_0xfecb('0x5'));var intUtil=require('./util');var config=require(_0xfecb('0x6'));var logger=require(_0xfecb('0x7'))(_0xfecb('0x8'));config['redis']=_['defaults'](config[_0xfecb('0x9')],{'host':_0xfecb('0xa'),'port':0x18eb});var io=require(_0xfecb('0xb'))(new Redis(config[_0xfecb('0x9')]));function getAdminId(_0x4d3551,_0x461fc6,_0x44b80f,_0x250376){return new Promise(function(_0x1af53e,_0x475e34){var _0x1c2252=![];var _0x1e5260={'method':_0xfecb('0xc'),'uri':_0x250376+'/api/selector/owners','json':!![]};_0x1e5260[_0xfecb('0xd')]=_0x44b80f;logger[_0xfecb('0xe')](_0xfecb('0xf'));return rp(_0x1e5260)[_0xfecb('0x10')](function(_0x5173e0){if(_0x5173e0){var _0x38e63b=_0x5173e0['users'];var _0xf8dcb3=null;for(_0xf8dcb3=0x0;_0xf8dcb3<_0x38e63b[_0xfecb('0x11')];_0xf8dcb3++){if(_0x38e63b[_0xf8dcb3][_0xfecb('0x12')]===_0x4d3551[_0xfecb('0x13')]){_0x4d3551['adminId']=_0x38e63b[_0xf8dcb3]['id'];_0x1c2252=!![];}}if(_0x1c2252){logger[_0xfecb('0xe')](_0xfecb('0x14'),_0x4d3551[_0xfecb('0x15')]);_0x1af53e(_0x4d3551);}else{_0x475e34({'statusCode':0x194,'message':_0xfecb('0x16')});}}else{_0x475e34({'statusCode':0x194,'message':_0xfecb('0x16')});}})[_0xfecb('0x17')](function(_0x3c1abe){logger[_0xfecb('0x18')]('['+[_0x461fc6[_0xfecb('0x19')]()]+']',_0x3c1abe['message']);_0x475e34(_0x3c1abe);});});}function getUser(_0x375aa5,_0x3deae9,_0x1b77fd){return function(_0x42eb1d){return new Promise(function(_0x7685f8,_0x542e30){var _0x13b974={'method':_0xfecb('0xc'),'uri':_0x1b77fd+'/api/selector/owners','json':!![]};_0x13b974[_0xfecb('0xd')]=_0x3deae9;logger[_0xfecb('0xe')](_0xfecb('0x1a'));return rp(_0x13b974)[_0xfecb('0x10')](function(_0x3f1c09){if(_0x3f1c09){var _0x30d98=_0x3f1c09[_0xfecb('0x1b')];var _0x281ba4=![];var _0x3d4e7e=null;if(_0x42eb1d[_0xfecb('0x1c')]!==null){logger[_0xfecb('0xe')](_0xfecb('0x1d'),_0x42eb1d['agentEmail']);_0x42eb1d[_0xfecb('0x1e')]=_0x42eb1d[_0xfecb('0x1c')];for(_0x3d4e7e=0x0;_0x3d4e7e<_0x30d98['length'];_0x3d4e7e++){if(_0x30d98[_0x3d4e7e][_0xfecb('0x12')]===_0x42eb1d[_0xfecb('0x1c')]){_0x281ba4=!![];_0x42eb1d[_0xfecb('0x1f')]=_0x30d98[_0x3d4e7e]['id'];logger[_0xfecb('0xe')](_0xfecb('0x20'),_0x42eb1d['userId']);}}}if(!_0x281ba4){logger[_0xfecb('0xe')](_0xfecb('0x21'));_0x42eb1d[_0xfecb('0x1e')]=_0x42eb1d[_0xfecb('0x13')];_0x42eb1d['userId']=_0x42eb1d[_0xfecb('0x15')];_0x281ba4=!![];}if(_0x281ba4){_0x7685f8(_0x42eb1d);}else{_0x542e30({'statusCode':0x194,'message':_0xfecb('0x16')});}}else{_0x542e30({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xfecb('0x17')](function(_0x5a8d1a){logger['error']('['+[_0x375aa5[_0xfecb('0x19')]()]+']',_0x5a8d1a['message']);_0x542e30(_0x5a8d1a);});});};}function searchContact(_0x23a618,_0x3dd522,_0x538451,_0x33b9d5){return new Promise(function(_0x5d4331,_0x81a33c){var _0x59f447={'method':'GET','headers':_0x3dd522,'uri':_0x23a618+_0xfecb('0x22')+_0x33b9d5+_0xfecb('0x23')+_0x538451+_0xfecb('0x24'),'json':!![]};rp(_0x59f447)[_0xfecb('0x10')](function(_0x1dbd02){var _0x318caa=_[_0xfecb('0x25')](_0x1dbd02[_0xfecb('0x26')][_0xfecb('0x26')],[_0x538451,_0x33b9d5]);_0x5d4331(_0x318caa);})[_0xfecb('0x17')](function(_0x521987){_0x81a33c(_0x521987);});});}function getEndUser(_0x5a8a3e,_0x447b4f,_0x475bea){return function(_0x353146){return new Promise(function(_0x3f1418,_0x370487){logger[_0xfecb('0xe')](util[_0xfecb('0x27')]('Searching\x20contact\x20with\x20phone\x20%s',_0x353146[_0xfecb('0x28')]));searchContact(_0x475bea,_0x447b4f,_0xfecb('0x29'),_0x353146['contactNumber'])['then'](function(_0x222802){if(_0x222802){_0x353146[_0xfecb('0x2a')]=_0x222802['id'];logger[_0xfecb('0xe')]('Contact\x20found\x20mobile_number:',_0x353146[_0xfecb('0x2a')]);return _0x3f1418(_0x353146);}searchContact(_0x475bea,_0x447b4f,_0xfecb('0x2b'),_0x353146[_0xfecb('0x28')])['then'](function(_0x157ac5){if(_0x157ac5){_0x353146['endUserId']=_0x157ac5['id'];logger[_0xfecb('0xe')](_0xfecb('0x2c'),_0x353146[_0xfecb('0x2a')]);return _0x3f1418(_0x353146);}createEndUser(_0x353146,_0x5a8a3e,_0x447b4f,_0x475bea)[_0xfecb('0x10')](function(_0x37a8de){logger[_0xfecb('0xe')](_0xfecb('0x2d'),_0x37a8de[_0xfecb('0x2a')]);return _0x3f1418(_0x37a8de);});});})['catch'](function(_0x1b99d2){_0x370487(_0x1b99d2);});});};}function createEndUser(_0x1f021c,_0x15fb55,_0x44815e,_0x2231f7){return new Promise(function(_0x3f8871,_0x5c5144){var _0x34a6de=moment();var _0x504863={'method':_0xfecb('0x2e'),'uri':_0x2231f7+_0xfecb('0x2f'),'body':{'contact':{'last_name':_0x1f021c[_0xfecb('0x28')],'work_number':_0x1f021c['contactNumber'],'mobile_number':_0x1f021c[_0xfecb('0x28')],'owner_id':_0x1f021c['userId'],'created_at':_0x34a6de[_0xfecb('0x27')](_0xfecb('0x30'))}},'json':!![]};_0x504863[_0xfecb('0xd')]=_0x44815e;logger[_0xfecb('0xe')](_0xfecb('0x31'));return rp(_0x504863)[_0xfecb('0x10')](function(_0xad5927){_0x1f021c[_0xfecb('0x2a')]=_0xad5927[_0xfecb('0x32')]['id'];_0x3f8871(_0x1f021c);})[_0xfecb('0x17')](function(_0x1b17af){logger[_0xfecb('0x18')]('['+[_0x15fb55[_0xfecb('0x19')]()]+']',_0x1b17af[_0xfecb('0x33')]);_0x5c5144(_0x1b17af[_0xfecb('0x33')]);});});}function getTicket(_0x1601b4,_0x16f400,_0x44a7b7,_0x206ad5,_0x1a24bb){return function(_0xa9c985){logger[_0xfecb('0xe')](_0xfecb('0x34'));return new Promise(function(_0x449621,_0x277169){var _0x110038=moment();var _0x1c0ba8={'method':_0xfecb('0x2e'),'uri':_0x44a7b7+_0xfecb('0x35'),'body':{'title':intUtil[_0xfecb('0x36')](_0x206ad5[_0xfecb('0x37')],_0x1a24bb,'\x20'),'description':intUtil[_0xfecb('0x36')](_0x206ad5[_0xfecb('0x38')],_0x1a24bb,'\x0a'),'owner_id':_0xa9c985[_0xfecb('0x1f')],'creater_id':_0xa9c985[_0xfecb('0x15')],'targetable_id':_0xa9c985[_0xfecb('0x2a')],'targetable_type':_0xfecb('0x39'),'created_at':_0x110038[_0xfecb('0x27')](_0xfecb('0x30')),'due_date':_0x110038['add'](0x1e,'m')[_0xfecb('0x27')](_0xfecb('0x30'))},'json':!![]};_0x1c0ba8[_0xfecb('0xd')]=_0x16f400;return rp(_0x1c0ba8)['then'](function(_0x435e01){_0xa9c985['ticketId']=_0x435e01[_0xfecb('0x3a')]['id'];logger[_0xfecb('0xe')](_0xfecb('0x3b'),_0xa9c985[_0xfecb('0x3c')]);_0x449621(_0xa9c985);})[_0xfecb('0x17')](function(_0x33a40a){logger[_0xfecb('0x18')]('['+[_0x1601b4['toUpperCase']()]+']',_0x33a40a[_0xfecb('0x33')]);_0x277169(_0x33a40a[_0xfecb('0x33')]);});});};}function emit(_0x24d4f9,_0x406829,_0x4992c8){var _0x19a1cd={'uri':_0x24d4f9+_0xfecb('0x3d')+_0x4992c8};io['to'](util[_0xfecb('0x27')](_0xfecb('0x3e'),_0x406829))[_0xfecb('0x3f')](_0xfecb('0x40'),_0x19a1cd);}exports['cs']=function(_0x263552,_0x3f46db,_0x3b8b0c,_0x5c8bdd,_0x161363,_0x41424c,_0x2e8e8b,_0x28b5fd){var _0x416577={};var _0x523d1e={'Authorization':_0xfecb('0x41')+_0x41424c[_0xfecb('0x42')]};_0x41424c[_0xfecb('0x43')]=intUtil[_0xfecb('0x44')](_0x41424c['remoteUri']);_0x41424c[_0xfecb('0x45')]=intUtil[_0xfecb('0x44')](_0x41424c['serverUrl']);var _0x8d3af3=_0x41424c[_0xfecb('0x43')];_0x416577[_0xfecb('0x13')]=_0x41424c[_0xfecb('0x46')];_0x416577['contactNumber']=_0x28b5fd[_0xfecb('0x47')]()===_0xfecb('0x48')?_0x3f46db['destcalleridnum']:_0x3f46db[_0xfecb('0x49')];_0x416577[_0xfecb('0x4a')]=_0x28b5fd==='queue'||_0x28b5fd==='unmanaged'?_0xfecb('0x4b'):_0xfecb('0x48');if(_0x5c8bdd){_0x416577[_0xfecb('0x1c')]=_0x5c8bdd[_0xfecb('0x12')];}var _0x40deeb=util[_0xfecb('0x27')](_0xfecb('0x4c'),_0x41424c[_0xfecb('0x45')],_0x3f46db[_0xfecb('0x4d')],md5(_0x3f46db[_0xfecb('0x4d')]));if(_0x161363&&_0x161363[_0xfecb('0x4e')]){logger[_0xfecb('0xe')]('[QUEUE]',_0xfecb('0x4f'));_0x3f46db[_0xfecb('0x50')]=_0x40deeb;}else if(_0x2e8e8b&&_0x2e8e8b['recordingFormat']&&_0x2e8e8b[_0xfecb('0x51')]!==_0xfecb('0x52')){logger['info'](_0xfecb('0x53'),'Recording\x20is\x20enabled!');_0x3f46db[_0xfecb('0x50')]=_0x40deeb;}else{_0x3f46db['recordingURL']='';}return getAdminId(_0x416577,_0x28b5fd,_0x523d1e,_0x8d3af3)[_0xfecb('0x10')](getUser(_0x28b5fd,_0x523d1e,_0x8d3af3))[_0xfecb('0x10')](getEndUser(_0x28b5fd,_0x523d1e,_0x8d3af3))[_0xfecb('0x10')](getTicket(_0x28b5fd,_0x523d1e,_0x8d3af3,_0x3b8b0c,_0x3f46db))[_0xfecb('0x10')](function(_0x1e7bea){logger[_0xfecb('0xe')](util[_0xfecb('0x27')](_0xfecb('0x54'),_0x1e7bea['ticketId']));if(_0x28b5fd!=='unmanaged'){logger[_0xfecb('0xe')]('['+[_0x28b5fd[_0xfecb('0x19')]()]+']',_0xfecb('0x55'));emit(_0x8d3af3,_0x5c8bdd[_0xfecb('0x56')],_0x1e7bea[_0xfecb('0x2a')]);}})[_0xfecb('0x17')](function(_0x2f52dc){logger['error']('['+[_0x28b5fd[_0xfecb('0x19')]()]+_0xfecb('0x57'),util[_0xfecb('0x58')](_0x2f52dc,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x542b=['serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','GET','headers','info','Getting\x20admin\x20information','then','users','length','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','/api/selector/owners','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','Admin\x20selected','userEmail','adminEmail','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','format','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x542b,0x6c));var _0xb542=function(_0x4b91c4,_0x23f35f){_0x4b91c4=_0x4b91c4-0x0;var _0x25cb80=_0x542b[_0x4b91c4];return _0x25cb80;};'use strict';var _=require(_0xb542('0x0'));var rp=require(_0xb542('0x1'));var md5=require(_0xb542('0x2'));var util=require(_0xb542('0x3'));var moment=require(_0xb542('0x4'));var Promise=require(_0xb542('0x5'));var Redis=require(_0xb542('0x6'));var intUtil=require(_0xb542('0x7'));var config=require(_0xb542('0x8'));var logger=require(_0xb542('0x9'))(_0xb542('0xa'));config[_0xb542('0xb')]=_[_0xb542('0xc')](config[_0xb542('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminId(_0x3f7738,_0x2ca0f0,_0x44735d,_0x304268){return new Promise(function(_0x50486a,_0x4b44aa){var _0x497716=![];var _0x40f3b4={'method':_0xb542('0xd'),'uri':_0x304268+'/api/selector/owners','json':!![]};_0x40f3b4[_0xb542('0xe')]=_0x44735d;logger[_0xb542('0xf')](_0xb542('0x10'));return rp(_0x40f3b4)[_0xb542('0x11')](function(_0x5e31d5){if(_0x5e31d5){var _0x310e3a=_0x5e31d5[_0xb542('0x12')];var _0x71ba85=null;for(_0x71ba85=0x0;_0x71ba85<_0x310e3a[_0xb542('0x13')];_0x71ba85++){if(_0x310e3a[_0x71ba85][_0xb542('0x14')]===_0x3f7738['adminEmail']){_0x3f7738[_0xb542('0x15')]=_0x310e3a[_0x71ba85]['id'];_0x497716=!![];}}if(_0x497716){logger[_0xb542('0xf')](_0xb542('0x16'),_0x3f7738[_0xb542('0x15')]);_0x50486a(_0x3f7738);}else{_0x4b44aa({'statusCode':0x194,'message':_0xb542('0x17')});}}else{_0x4b44aa({'statusCode':0x194,'message':_0xb542('0x17')});}})[_0xb542('0x18')](function(_0x2585d9){logger[_0xb542('0x19')]('['+[_0x2ca0f0[_0xb542('0x1a')]()]+']',_0x2585d9[_0xb542('0x1b')]);_0x4b44aa(_0x2585d9);});});}function getUser(_0x29be7b,_0xc7dce1,_0x466671){return function(_0x266d9d){return new Promise(function(_0x514999,_0x264e7e){var _0x45882c={'method':_0xb542('0xd'),'uri':_0x466671+_0xb542('0x1c'),'json':!![]};_0x45882c[_0xb542('0xe')]=_0xc7dce1;logger['info'](_0xb542('0x1d'));return rp(_0x45882c)['then'](function(_0x3950ea){if(_0x3950ea){var _0x1bb0a5=_0x3950ea['users'];var _0x3e7b37=![];var _0x21cb35=null;if(_0x266d9d[_0xb542('0x1e')]!==null){logger[_0xb542('0xf')](_0xb542('0x1f'),_0x266d9d[_0xb542('0x1e')]);_0x266d9d['userEmail']=_0x266d9d[_0xb542('0x1e')];for(_0x21cb35=0x0;_0x21cb35<_0x1bb0a5[_0xb542('0x13')];_0x21cb35++){if(_0x1bb0a5[_0x21cb35][_0xb542('0x14')]===_0x266d9d['agentEmail']){_0x3e7b37=!![];_0x266d9d[_0xb542('0x20')]=_0x1bb0a5[_0x21cb35]['id'];logger[_0xb542('0xf')](_0xb542('0x21'),_0x266d9d['userId']);}}}if(!_0x3e7b37){logger['info'](_0xb542('0x22'));_0x266d9d[_0xb542('0x23')]=_0x266d9d[_0xb542('0x24')];_0x266d9d[_0xb542('0x20')]=_0x266d9d['adminId'];_0x3e7b37=!![];}if(_0x3e7b37){_0x514999(_0x266d9d);}else{_0x264e7e({'statusCode':0x194,'message':_0xb542('0x17')});}}else{_0x264e7e({'statusCode':0x194,'message':_0xb542('0x17')});}})[_0xb542('0x18')](function(_0x1b98c7){logger[_0xb542('0x19')]('['+[_0x29be7b['toUpperCase']()]+']',_0x1b98c7[_0xb542('0x1b')]);_0x264e7e(_0x1b98c7);});});};}function searchContact(_0x4a285d,_0x383f75,_0x5cd037,_0x40df77){return new Promise(function(_0x1f24da,_0x195d86){var _0x44d78c={'method':_0xb542('0xd'),'headers':_0x383f75,'uri':_0x4a285d+'/api/lookup?q='+_0x40df77+'&f='+_0x5cd037+'&entities=contact','json':!![]};rp(_0x44d78c)[_0xb542('0x11')](function(_0x1648c5){var _0xb8ab8f=_[_0xb542('0x25')](_0x1648c5[_0xb542('0x26')][_0xb542('0x26')],[_0x5cd037,_0x40df77]);_0x1f24da(_0xb8ab8f);})[_0xb542('0x18')](function(_0x42c93a){_0x195d86(_0x42c93a);});});}function getEndUser(_0x3c99e7,_0x5e240d,_0x3bba75){return function(_0x121f26){return new Promise(function(_0x4fd27a,_0x53947c){logger['info'](util['format'](_0xb542('0x27'),_0x121f26[_0xb542('0x28')]));searchContact(_0x3bba75,_0x5e240d,_0xb542('0x29'),_0x121f26['contactNumber'])[_0xb542('0x11')](function(_0x112e11){if(_0x112e11){_0x121f26[_0xb542('0x2a')]=_0x112e11['id'];logger[_0xb542('0xf')](_0xb542('0x2b'),_0x121f26['endUserId']);return _0x4fd27a(_0x121f26);}searchContact(_0x3bba75,_0x5e240d,_0xb542('0x2c'),_0x121f26[_0xb542('0x28')])[_0xb542('0x11')](function(_0xd0771b){if(_0xd0771b){_0x121f26[_0xb542('0x2a')]=_0xd0771b['id'];logger['info'](_0xb542('0x2d'),_0x121f26[_0xb542('0x2a')]);return _0x4fd27a(_0x121f26);}createEndUser(_0x121f26,_0x3c99e7,_0x5e240d,_0x3bba75)[_0xb542('0x11')](function(_0x6799d6){logger['info'](_0xb542('0x2e'),_0x6799d6[_0xb542('0x2a')]);return _0x4fd27a(_0x6799d6);});});})['catch'](function(_0x1340cd){_0x53947c(_0x1340cd);});});};}function createEndUser(_0x11a4ca,_0xd5347c,_0x654fc3,_0x4a2d19){return new Promise(function(_0x5e22cd,_0x247326){var _0x5f0cb8=moment();var _0x5d860b={'method':_0xb542('0x2f'),'uri':_0x4a2d19+'/api/contacts','body':{'contact':{'last_name':_0x11a4ca[_0xb542('0x28')],'work_number':_0x11a4ca['contactNumber'],'mobile_number':_0x11a4ca[_0xb542('0x28')],'owner_id':_0x11a4ca[_0xb542('0x20')],'created_at':_0x5f0cb8[_0xb542('0x30')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x5d860b[_0xb542('0xe')]=_0x654fc3;logger[_0xb542('0xf')](_0xb542('0x31'));return rp(_0x5d860b)['then'](function(_0x2846a2){_0x11a4ca['endUserId']=_0x2846a2['contact']['id'];_0x5e22cd(_0x11a4ca);})[_0xb542('0x18')](function(_0x5e04c3){logger[_0xb542('0x19')]('['+[_0xd5347c['toUpperCase']()]+']',_0x5e04c3[_0xb542('0x1b')]);_0x247326(_0x5e04c3[_0xb542('0x1b')]);});});}function getTicket(_0x531528,_0x11cbb4,_0x53be06,_0x4a0a04,_0x15968e){return function(_0x2c0e7c){logger[_0xb542('0xf')](_0xb542('0x32'));return new Promise(function(_0x582faf,_0x277933){var _0x571180=moment();var _0xf32a1={'method':_0xb542('0x2f'),'uri':_0x53be06+_0xb542('0x33'),'body':{'title':intUtil[_0xb542('0x34')](_0x4a0a04[_0xb542('0x35')],_0x15968e,'\x20'),'description':intUtil[_0xb542('0x34')](_0x4a0a04['Descriptions'],_0x15968e,'\x0a'),'owner_id':_0x2c0e7c[_0xb542('0x20')],'creater_id':_0x2c0e7c[_0xb542('0x15')],'targetable_id':_0x2c0e7c['endUserId'],'targetable_type':'Contact','created_at':_0x571180[_0xb542('0x30')](_0xb542('0x36')),'due_date':_0x571180[_0xb542('0x37')](0x1e,'m')[_0xb542('0x30')](_0xb542('0x36'))},'json':!![]};_0xf32a1[_0xb542('0xe')]=_0x11cbb4;return rp(_0xf32a1)[_0xb542('0x11')](function(_0x5a546c){_0x2c0e7c[_0xb542('0x38')]=_0x5a546c[_0xb542('0x39')]['id'];logger[_0xb542('0xf')](_0xb542('0x3a'),_0x2c0e7c[_0xb542('0x38')]);_0x582faf(_0x2c0e7c);})[_0xb542('0x18')](function(_0x52f010){logger[_0xb542('0x19')]('['+[_0x531528[_0xb542('0x1a')]()]+']',_0x52f010[_0xb542('0x1b')]);_0x277933(_0x52f010[_0xb542('0x1b')]);});});};}function emit(_0x3ff7ae,_0x48d97a,_0x508314){var _0x2c961e={'uri':_0x3ff7ae+_0xb542('0x3b')+_0x508314};io['to'](util[_0xb542('0x30')](_0xb542('0x3c'),_0x48d97a))[_0xb542('0x3d')](_0xb542('0x3e'),_0x2c961e);}exports['cs']=function(_0xb1028f,_0x1d2ae8,_0x26a3db,_0x336fd9,_0x287264,_0x2dfa14,_0x9a2175,_0x1b1ab1){var _0x2b5507={};var _0x1efa0e={'Authorization':_0xb542('0x3f')+_0x2dfa14['apiKey']};_0x2dfa14[_0xb542('0x40')]=intUtil[_0xb542('0x41')](_0x2dfa14[_0xb542('0x40')]);_0x2dfa14[_0xb542('0x42')]=intUtil[_0xb542('0x41')](_0x2dfa14[_0xb542('0x42')]);var _0x350133=_0x2dfa14['remoteUri'];_0x2b5507[_0xb542('0x24')]=_0x2dfa14['username'];_0x2b5507[_0xb542('0x28')]=_0x1b1ab1[_0xb542('0x43')]()===_0xb542('0x44')?_0x1d2ae8[_0xb542('0x45')]:_0x1d2ae8[_0xb542('0x46')];_0x2b5507[_0xb542('0x47')]=_0x1b1ab1==='queue'||_0x1b1ab1==='unmanaged'?_0xb542('0x48'):_0xb542('0x44');if(_0x336fd9){_0x2b5507[_0xb542('0x1e')]=_0x336fd9[_0xb542('0x14')];}var _0x460d89=util['format'](_0xb542('0x49'),_0x2dfa14[_0xb542('0x42')],_0x1d2ae8['uniqueid'],md5(_0x1d2ae8[_0xb542('0x4a')]));if(_0x287264&&_0x287264[_0xb542('0x4b')]){logger[_0xb542('0xf')](_0xb542('0x4c'),_0xb542('0x4d'));_0x1d2ae8['recordingURL']=_0x460d89;}else if(_0x9a2175&&_0x9a2175[_0xb542('0x4e')]&&_0x9a2175[_0xb542('0x4e')]!==_0xb542('0x4f')){logger[_0xb542('0xf')](_0xb542('0x50'),_0xb542('0x4d'));_0x1d2ae8[_0xb542('0x51')]=_0x460d89;}else{_0x1d2ae8['recordingURL']='';}return getAdminId(_0x2b5507,_0x1b1ab1,_0x1efa0e,_0x350133)['then'](getUser(_0x1b1ab1,_0x1efa0e,_0x350133))[_0xb542('0x11')](getEndUser(_0x1b1ab1,_0x1efa0e,_0x350133))['then'](getTicket(_0x1b1ab1,_0x1efa0e,_0x350133,_0x26a3db,_0x1d2ae8))['then'](function(_0x33eaa0){logger[_0xb542('0xf')](util['format'](_0xb542('0x52'),_0x33eaa0[_0xb542('0x38')]));if(_0x1b1ab1!=='unmanaged'){logger[_0xb542('0xf')]('['+[_0x1b1ab1[_0xb542('0x1a')]()]+']',_0xb542('0x53'));emit(_0x350133,_0x336fd9[_0xb542('0x54')],_0x33eaa0[_0xb542('0x2a')]);}})[_0xb542('0x18')](function(_0x452900){logger[_0xb542('0x19')]('['+[_0x1b1ab1[_0xb542('0x1a')]()]+_0xb542('0x55'),util[_0xb542('0x56')](_0x452900,{'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 7cf9cdb..0c43ea2 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 _0x2515=['desk','dynamics365','servicenow','exec','includes','data1','toLowerCase','data2','Configurations','data3','queue','outbound','log','unmanaged','zendesk','sugarcrm','zoho','vtiger','freshsales','unknown\x20integration','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util','./salesforce','./freshdesk','./zoho','./vtiger','./dynamics365','./freshsales','salesforce','freshdesk'];(function(_0x4f32bf,_0x2e0128){var _0x552f63=function(_0x41888c){while(--_0x41888c){_0x4f32bf['push'](_0x4f32bf['shift']());}};_0x552f63(++_0x2e0128);}(_0x2515,0x1ca));var _0x5251=function(_0x20a74e,_0x26c09d){_0x20a74e=_0x20a74e-0x0;var _0x513e0f=_0x2515[_0x20a74e];return _0x513e0f;};'use strict';var _=require(_0x5251('0x0'));var util=require(_0x5251('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x5251('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x5251('0x3'));var zoho=require(_0x5251('0x4'));var desk=require('./desk');var vtiger=require(_0x5251('0x5'));var servicenow=require('./servicenow');var dynamics365=require(_0x5251('0x6'));var freshsales=require(_0x5251('0x7'));var integrations=['zendesk',_0x5251('0x8'),'sugarcrm',_0x5251('0x9'),'zoho',_0x5251('0xa'),'vtiger',_0x5251('0xb'),'freshsales',_0x5251('0xc')];exports[_0x5251('0xd')]=function(_0x436013,_0x10314d,_0x86f88d,_0x385d3a,_0xb66d,_0x547eb6){if(_0x86f88d){if(_[_0x5251('0xe')](integrations,_0x436013[_0x5251('0xf')]['toLowerCase']())){try{var _0x12a3f1=null;var _0x1d40aa='';var _0x3efec8=_0x86f88d[_0x436013[_0x5251('0xf')][_0x5251('0x10')]()];if(_0x3efec8){var _0x2ff1e3=_0x3efec8[_0x436013[_0x5251('0x11')]];if(_0x2ff1e3){var _0x1eb8f8=_['find'](_0x2ff1e3[_0x5251('0x12')],{'id':parseInt(_0x436013[_0x5251('0x13')],0xa)});if(_0x1eb8f8){if(_0x385d3a){if(_0xb66d&&_0x10314d['queue']){_0x1d40aa=_0x5251('0x14');}else if(_0x10314d['routeId']){_0x1d40aa=_0x5251('0x15');}else{console[_0x5251('0x16')]('EVENT\x20UNKNOWN',_0x10314d);}}else{_0x1d40aa=_0x5251('0x17');}switch(_0x436013[_0x5251('0xf')][_0x5251('0x10')]()){case _0x5251('0x18'):zendesk[_0x1d40aa](_0x436013,_0x10314d,_0x1eb8f8,_0x385d3a,_0xb66d,_0x2ff1e3,_0x547eb6);break;case _0x5251('0x8'):salesforce[_0x1d40aa](_0x436013,_0x10314d,_0x1eb8f8,_0x385d3a,_0xb66d,_0x2ff1e3,_0x547eb6);break;case _0x5251('0x19'):sugarcrm[_0x1d40aa](_0x436013,_0x10314d,_0x1eb8f8,_0x385d3a,_0xb66d,_0x2ff1e3,_0x547eb6);break;case'freshdesk':freshdesk[_0x1d40aa](_0x436013,_0x10314d,_0x1eb8f8,_0x385d3a,_0xb66d,_0x2ff1e3,_0x547eb6);break;case _0x5251('0x1a'):zoho[_0x1d40aa](_0x436013,_0x10314d,_0x1eb8f8,_0x385d3a,_0xb66d,_0x2ff1e3,_0x547eb6);break;case _0x5251('0xa'):desk[_0x1d40aa](_0x436013,_0x10314d,_0x1eb8f8,_0x385d3a,_0xb66d,_0x2ff1e3,_0x547eb6);break;case _0x5251('0x1b'):vtiger[_0x1d40aa](_0x436013,_0x10314d,_0x1eb8f8,_0x385d3a,_0xb66d,_0x2ff1e3,_0x547eb6);break;case _0x5251('0x1c'):freshsales['cs'](_0x436013,_0x10314d,_0x1eb8f8,_0x385d3a,_0xb66d,_0x2ff1e3,_0x547eb6,_0x1d40aa);break;case _0x5251('0xc'):servicenow['cs'](_0x436013,_0x10314d,_0x1eb8f8,_0x385d3a,_0xb66d,_0x2ff1e3,_0x547eb6,_0x1d40aa);break;case _0x5251('0xb'):dynamics365['cs'](_0x436013,_0x10314d,_0x1eb8f8,_0x385d3a,_0xb66d,_0x2ff1e3,_0x547eb6,_0x1d40aa);break;default:console[_0x5251('0x16')](_0x5251('0x1d'));}}else{_0x12a3f1=require(_0x5251('0x1e'))(_0x436013[_0x5251('0xf')]['toLowerCase']());_0x12a3f1[_0x5251('0x1f')]('[EXEC]',util[_0x5251('0x20')](_0x5251('0x21'),_0x436013[_0x5251('0xf')][_0x5251('0x10')](),_0x436013[_0x5251('0x13')]));}}else{_0x12a3f1=require(_0x5251('0x1e'))(_0x436013[_0x5251('0xf')]['toLowerCase']());_0x12a3f1[_0x5251('0x1f')](_0x5251('0x22'),util['format'](_0x5251('0x23'),_0x436013['data1'][_0x5251('0x10')](),_0x436013[_0x5251('0x11')]));}}else{}}catch(_0x29ee8f){console[_0x5251('0x1f')](_0x29ee8f);}}}}; \ No newline at end of file +var _0x8b8e=['log','EVENT\x20UNKNOWN','unmanaged','servicenow','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./sugarcrm','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','vtiger','freshsales','includes','data1','toLowerCase','data2','find','data3','queue','routeId','outbound'];(function(_0x3de99a,_0x20140b){var _0x3d9667=function(_0x18284c){while(--_0x18284c){_0x3de99a['push'](_0x3de99a['shift']());}};_0x3d9667(++_0x20140b);}(_0x8b8e,0x108));var _0xe8b8=function(_0x385835,_0x484804){_0x385835=_0x385835-0x0;var _0x3359db=_0x8b8e[_0x385835];return _0x3359db;};'use strict';var _=require(_0xe8b8('0x0'));var util=require('util');var zendesk=require(_0xe8b8('0x1'));var salesforce=require('./salesforce');var sugarcrm=require(_0xe8b8('0x2'));var freshdesk=require('./freshdesk');var zoho=require('./zoho');var desk=require(_0xe8b8('0x3'));var vtiger=require(_0xe8b8('0x4'));var servicenow=require(_0xe8b8('0x5'));var dynamics365=require(_0xe8b8('0x6'));var freshsales=require(_0xe8b8('0x7'));var integrations=[_0xe8b8('0x8'),_0xe8b8('0x9'),_0xe8b8('0xa'),_0xe8b8('0xb'),_0xe8b8('0xc'),'desk',_0xe8b8('0xd'),'dynamics365',_0xe8b8('0xe'),'servicenow'];exports['exec']=function(_0x2ccbeb,_0xcf1e01,_0x568241,_0x54eb14,_0x259a1a,_0x42bb8a){if(_0x568241){if(_[_0xe8b8('0xf')](integrations,_0x2ccbeb[_0xe8b8('0x10')][_0xe8b8('0x11')]())){try{var _0x298bae=null;var _0x3de76b='';var _0x11fb1a=_0x568241[_0x2ccbeb[_0xe8b8('0x10')][_0xe8b8('0x11')]()];if(_0x11fb1a){var _0x1c5062=_0x11fb1a[_0x2ccbeb[_0xe8b8('0x12')]];if(_0x1c5062){var _0x30bfc7=_[_0xe8b8('0x13')](_0x1c5062['Configurations'],{'id':parseInt(_0x2ccbeb[_0xe8b8('0x14')],0xa)});if(_0x30bfc7){if(_0x54eb14){if(_0x259a1a&&_0xcf1e01['queue']){_0x3de76b=_0xe8b8('0x15');}else if(_0xcf1e01[_0xe8b8('0x16')]){_0x3de76b=_0xe8b8('0x17');}else{console[_0xe8b8('0x18')](_0xe8b8('0x19'),_0xcf1e01);}}else{_0x3de76b=_0xe8b8('0x1a');}switch(_0x2ccbeb[_0xe8b8('0x10')][_0xe8b8('0x11')]()){case _0xe8b8('0x8'):zendesk[_0x3de76b](_0x2ccbeb,_0xcf1e01,_0x30bfc7,_0x54eb14,_0x259a1a,_0x1c5062,_0x42bb8a);break;case _0xe8b8('0x9'):salesforce[_0x3de76b](_0x2ccbeb,_0xcf1e01,_0x30bfc7,_0x54eb14,_0x259a1a,_0x1c5062,_0x42bb8a);break;case'sugarcrm':sugarcrm[_0x3de76b](_0x2ccbeb,_0xcf1e01,_0x30bfc7,_0x54eb14,_0x259a1a,_0x1c5062,_0x42bb8a);break;case _0xe8b8('0xb'):freshdesk[_0x3de76b](_0x2ccbeb,_0xcf1e01,_0x30bfc7,_0x54eb14,_0x259a1a,_0x1c5062,_0x42bb8a);break;case _0xe8b8('0xc'):zoho[_0x3de76b](_0x2ccbeb,_0xcf1e01,_0x30bfc7,_0x54eb14,_0x259a1a,_0x1c5062,_0x42bb8a);break;case'desk':desk[_0x3de76b](_0x2ccbeb,_0xcf1e01,_0x30bfc7,_0x54eb14,_0x259a1a,_0x1c5062,_0x42bb8a);break;case _0xe8b8('0xd'):vtiger[_0x3de76b](_0x2ccbeb,_0xcf1e01,_0x30bfc7,_0x54eb14,_0x259a1a,_0x1c5062,_0x42bb8a);break;case _0xe8b8('0xe'):freshsales['cs'](_0x2ccbeb,_0xcf1e01,_0x30bfc7,_0x54eb14,_0x259a1a,_0x1c5062,_0x42bb8a,_0x3de76b);break;case _0xe8b8('0x1b'):servicenow['cs'](_0x2ccbeb,_0xcf1e01,_0x30bfc7,_0x54eb14,_0x259a1a,_0x1c5062,_0x42bb8a,_0x3de76b);break;case _0xe8b8('0x1c'):dynamics365['cs'](_0x2ccbeb,_0xcf1e01,_0x30bfc7,_0x54eb14,_0x259a1a,_0x1c5062,_0x42bb8a,_0x3de76b);break;default:console[_0xe8b8('0x18')](_0xe8b8('0x1d'));}}else{_0x298bae=require(_0xe8b8('0x1e'))(_0x2ccbeb[_0xe8b8('0x10')][_0xe8b8('0x11')]());_0x298bae[_0xe8b8('0x1f')](_0xe8b8('0x20'),util[_0xe8b8('0x21')](_0xe8b8('0x22'),_0x2ccbeb[_0xe8b8('0x10')][_0xe8b8('0x11')](),_0x2ccbeb[_0xe8b8('0x14')]));}}else{_0x298bae=require(_0xe8b8('0x1e'))(_0x2ccbeb['data1']['toLowerCase']());_0x298bae['error'](_0xe8b8('0x20'),util['format'](_0xe8b8('0x23'),_0x2ccbeb['data1'][_0xe8b8('0x11')](),_0x2ccbeb[_0xe8b8('0x12')]));}}else{}}catch(_0x5e3fa2){console['error'](_0x5e3fa2);}}}}; \ 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 f2a9497..7f26252 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 _0xfc06=['[OUTBOUND]','catch','unmanaged','toUpperCase','isNil','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','emit','assign','getString','Subjects','Descriptions','ActivityDate','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhatId','ticketType','Case','ContactId','account','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','User','find','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','$or','Contact','execute','cloneDeep','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','length','merge','Phone','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Company','No\x20Company','forEach','includes','picklist','type','idField','toString','variable','variableName','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','clientSecret','login','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','instanceUrl'];(function(_0x155839,_0x3f679d){var _0x51d322=function(_0xf96e28){while(--_0xf96e28){_0x155839['push'](_0x155839['shift']());}};_0x51d322(++_0x3f679d);}(_0xfc06,0xfa));var _0x6fc0=function(_0x3236c8,_0x48b311){_0x3236c8=_0x3236c8-0x0;var _0x52dbb7=_0xfc06[_0x3236c8];return _0x52dbb7;};'use strict';var _=require(_0x6fc0('0x0'));var rp=require(_0x6fc0('0x1'));var moment=require('moment');var BPromise=require(_0x6fc0('0x2'));var md5=require(_0x6fc0('0x3'));var jsforce=require(_0x6fc0('0x4'));var util=require(_0x6fc0('0x5'));var Redis=require(_0x6fc0('0x6'));var intUtil=require('./util');var config=require(_0x6fc0('0x7'));var logger=require(_0x6fc0('0x8'))('salesforce');config[_0x6fc0('0x9')]=_[_0x6fc0('0xa')](config[_0x6fc0('0x9')],{'host':_0x6fc0('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6fc0('0x9')]));function emit(_0x1cc852,_0x10c1a2,_0x5d17b2){io['to'](_0x1cc852)[_0x6fc0('0xc')](_0x10c1a2,_0x5d17b2);}function getTicket(_0x1b9a6f,_0x4e4bdb,_0x39472d,_0x58689f,_0x46ca53,_0x11d7cd,_0x574d7f,_0x114200){var _0x20bc73=Object[_0x6fc0('0xd')]({},{'OwnerId':_0x4e4bdb['id'],'Subject':intUtil[_0x6fc0('0xe')](_0x58689f[_0x6fc0('0xf')],_0x46ca53,'\x20'),'Description':intUtil['getString'](_0x58689f[_0x6fc0('0x10')],_0x46ca53,'\x0a')},getCustomFields(_0x11d7cd,_0x46ca53));if(_0x39472d){if(_0x58689f['ticketType']==='Task'){_0x20bc73[_0x6fc0('0x11')]=moment['utc']();_0x20bc73[_0x6fc0('0x12')]=![];_0x20bc73[_0x6fc0('0x13')]=![];if(_0x39472d[_0x6fc0('0x14')]===_0x6fc0('0x15')||_0x39472d[_0x6fc0('0x14')]===_0x6fc0('0x16')){_0x20bc73['WhoId']=_0x39472d['id'];}else if(_0x39472d[_0x6fc0('0x14')]==='account'){_0x20bc73[_0x6fc0('0x17')]=_0x39472d['id'];}}else if(_0x58689f[_0x6fc0('0x18')]===_0x6fc0('0x19')){if(_0x39472d['endUserType']===_0x6fc0('0x15')){_0x20bc73[_0x6fc0('0x1a')]=_0x39472d['id'];}else if(_0x39472d[_0x6fc0('0x14')]===_0x6fc0('0x1b')){_0x20bc73['AccountId']=_0x39472d['id'];}else if(_0x39472d[_0x6fc0('0x14')]===_0x6fc0('0x16')&&_0x58689f[_0x6fc0('0x1c')]){_0x20bc73[_0x58689f['leadId']]=_0x39472d['id'];}else{logger[_0x6fc0('0x1d')](_0x6fc0('0x1e'));}}}return _0x574d7f[_0x6fc0('0x1f')](_0x58689f[_0x6fc0('0x18')])[_0x6fc0('0x20')](_0x20bc73);}function getUser(_0x58e466,_0x271406,_0x3b785e){if(!_['isNil'](_0x271406)&&intUtil['validateEmail'](_0x271406)){var _0x9a3af4={'Email':_0x271406};var _0x4fcda5={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3b785e['sobject'](_0x6fc0('0x21'))[_0x6fc0('0x22')](_0x9a3af4,_0x4fcda5)['execute']()['then'](function(_0x2fab2c){if(_0x2fab2c['length']){var _0x5ddd79=_[_0x6fc0('0x22')](_0x2fab2c,function(_0x535de0){return _0x535de0['Email']===_0x271406;});if(_0x5ddd79){logger[_0x6fc0('0x1d')](_0x6fc0('0x23'),_0x271406);return BPromise[_0x6fc0('0x24')]({'id':_0x5ddd79['Id'],'name':_0x5ddd79[_0x6fc0('0x25')]});}}else{logger['info'](_0x6fc0('0x26'),_0x271406);return _0x3b785e['identity']()[_0x6fc0('0x27')](function(_0x3b80f6){return BPromise[_0x6fc0('0x24')]({'id':_0x3b80f6[_0x6fc0('0x28')],'name':_0x3b80f6['display_name']});});}});}else{logger['info'](_0x6fc0('0x26'),_0x271406);return _0x3b785e['identity']()[_0x6fc0('0x27')](function(_0xacb36f){return BPromise[_0x6fc0('0x24')]({'id':_0xacb36f[_0x6fc0('0x28')],'name':_0xacb36f[_0x6fc0('0x29')]});});}}function getEndUser(_0x3b7177,_0x1a58dc,_0x33904d,_0x57b4ea,_0x5c30ae){var _0x6410c1={'$or':{'Phone':_0x57b4ea}};var _0x5d8b23={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x6fc0('0x24')]()[_0x6fc0('0x27')](function(){logger['info'](_0x6fc0('0x2a'),_0x57b4ea,_0x1a58dc['moduleSearch']);switch(_0x1a58dc[_0x6fc0('0x2b')]){case _0x6fc0('0x2c'):var _0x85dd61=_['cloneDeep'](_0x6410c1);if(_0x1a58dc[_0x6fc0('0x2d')]){var _0x21b167={};_0x21b167[_0x1a58dc[_0x6fc0('0x2d')]]=_0x57b4ea;_['merge'](_0x85dd61[_0x6fc0('0x2e')],_0x21b167);}return _0x5c30ae[_0x6fc0('0x1f')](_0x6fc0('0x2f'))[_0x6fc0('0x22')](_0x85dd61,_0x5d8b23)[_0x6fc0('0x30')]()[_0x6fc0('0x27')](function(_0x3c2968){if(_0x3c2968&&_0x3c2968['length']){return _0x3c2968;}else{var _0x3ada17=_[_0x6fc0('0x31')](_0x6410c1);if(_0x1a58dc[_0x6fc0('0x32')]){var _0x12e382={};_0x12e382[_0x1a58dc['additionalSearchLead']]=_0x57b4ea;_['merge'](_0x3ada17[_0x6fc0('0x2e')],_0x12e382);}return _0x5c30ae[_0x6fc0('0x1f')](_0x6fc0('0x33'))[_0x6fc0('0x22')](_0x3ada17,_0x5d8b23);}});case _0x6fc0('0x34'):var _0x4cc6c0=_[_0x6fc0('0x31')](_0x6410c1);if(_0x1a58dc[_0x6fc0('0x35')]){var _0x21b167={};_0x21b167[_0x1a58dc[_0x6fc0('0x35')]]=_0x57b4ea;_['merge'](_0x4cc6c0[_0x6fc0('0x2e')],_0x21b167);}return _0x5c30ae[_0x6fc0('0x1f')]('Account')['find'](_0x4cc6c0,_0x5d8b23)[_0x6fc0('0x30')]()[_0x6fc0('0x27')](function(_0x2c8fbb){if(_0x2c8fbb&&_0x2c8fbb[_0x6fc0('0x36')]){return _0x2c8fbb;}else{var _0x6a75=_[_0x6fc0('0x31')](_0x6410c1);if(_0x1a58dc[_0x6fc0('0x2d')]){var _0x523a49={};_0x523a49[_0x1a58dc[_0x6fc0('0x2d')]]=_0x57b4ea;_[_0x6fc0('0x37')](_0x6a75[_0x6fc0('0x2e')],_0x523a49);}return _0x5c30ae[_0x6fc0('0x1f')](_0x6fc0('0x2f'))[_0x6fc0('0x22')](_0x6a75,_0x5d8b23)[_0x6fc0('0x27')](function(_0x5821e1){if(_0x5821e1&&_0x5821e1[_0x6fc0('0x36')]){return _0x5821e1;}else{var _0x229892=_['cloneDeep'](_0x6410c1);if(_0x1a58dc['additionalSearchLead']){var _0x26fd01={};_0x26fd01[_0x1a58dc[_0x6fc0('0x32')]]=_0x57b4ea;_['merge'](_0x229892[_0x6fc0('0x2e')],_0x26fd01);}return _0x5c30ae[_0x6fc0('0x1f')]('Lead')[_0x6fc0('0x22')](_0x229892,_0x5d8b23);}});}});case _0x6fc0('0x15'):var _0x85dd61=_[_0x6fc0('0x31')](_0x6410c1);if(_0x1a58dc[_0x6fc0('0x2d')]){var _0x21b167={};_0x21b167[_0x1a58dc[_0x6fc0('0x2d')]]=_0x57b4ea;_[_0x6fc0('0x37')](_0x85dd61['$or'],_0x21b167);}return _0x5c30ae[_0x6fc0('0x1f')](_0x6fc0('0x2f'))[_0x6fc0('0x22')](_0x85dd61,_0x5d8b23)[_0x6fc0('0x30')]();case'lead':var _0x614acd=_[_0x6fc0('0x31')](_0x6410c1);if(_0x1a58dc[_0x6fc0('0x32')]){var _0x21b167={};_0x21b167[_0x1a58dc[_0x6fc0('0x32')]]=_0x57b4ea;_['merge'](_0x614acd[_0x6fc0('0x2e')],_0x21b167);}return _0x5c30ae['sobject']('Lead')[_0x6fc0('0x22')](_0x614acd,_0x5d8b23);case _0x6fc0('0x1b'):var _0x4cc6c0=_[_0x6fc0('0x31')](_0x6410c1);if(_0x1a58dc[_0x6fc0('0x35')]){var _0x21b167={};_0x21b167[_0x1a58dc['additionalSearchAccount']]=_0x57b4ea;_[_0x6fc0('0x37')](_0x4cc6c0[_0x6fc0('0x2e')],_0x21b167);}return _0x5c30ae[_0x6fc0('0x1f')]('Account')[_0x6fc0('0x22')](_0x4cc6c0,_0x5d8b23);default:return null;}})[_0x6fc0('0x27')](function(_0x57338b){if(_0x57338b&&_0x57338b[_0x6fc0('0x36')]){var _0x59a28a=_['first'](_0x57338b);if(_0x59a28a){return BPromise['resolve']({'id':_0x59a28a['Id'],'name':_0x59a28a[_0x6fc0('0x25')],'phone':_0x59a28a[_0x6fc0('0x38')],'endUserType':_0x59a28a['attributes']['type']['toLowerCase']()});}}})['then'](function(_0x128866){if(_0x128866){logger[_0x6fc0('0x1d')](_0x6fc0('0x39'),_0x128866[_0x6fc0('0x14')],_0x57b4ea);return BPromise[_0x6fc0('0x24')](_0x128866);}else{logger['info'](_0x6fc0('0x3a'),_0x57b4ea);var _0x3a9ab5={'Phone':_0x57b4ea};if(_0x1a58dc[_0x6fc0('0x3b')]){if(_0x1a58dc[_0x6fc0('0x3b')]===_0x6fc0('0x15')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x57b4ea,_0x1a58dc[_0x6fc0('0x3b')]);_0x3a9ab5['LastName']=_0x33904d!==_0x6fc0('0x3c')?_0x33904d:util['format'](_0x6fc0('0x3d'),_0x57b4ea);}else if(_0x1a58dc['moduleCreate']===_0x6fc0('0x16')){logger[_0x6fc0('0x1d')](_0x6fc0('0x3e'),_0x57b4ea,_0x1a58dc[_0x6fc0('0x3b')]);_0x3a9ab5[_0x6fc0('0x3f')]=_0x33904d!==''?_0x33904d:util[_0x6fc0('0x40')](_0x6fc0('0x3d'),_0x57b4ea);_0x3a9ab5[_0x6fc0('0x41')]=_0x6fc0('0x42');}else if(_0x1a58dc[_0x6fc0('0x3b')]===_0x6fc0('0x1b')){logger[_0x6fc0('0x1d')](_0x6fc0('0x3e'),_0x57b4ea,_0x1a58dc['moduleCreate']);_0x3a9ab5[_0x6fc0('0x25')]=_0x33904d!==_0x6fc0('0x3c')?_0x33904d:util['format'](_0x6fc0('0x3d'),_0x57b4ea);}else{return null;}}return _0x5c30ae[_0x6fc0('0x1f')](_['upperFirst'](_0x1a58dc[_0x6fc0('0x3b')]))[_0x6fc0('0x20')](_0x3a9ab5)[_0x6fc0('0x27')](function(_0x631303){return BPromise['resolve']({'id':_0x631303['id'],'endUserType':_0x1a58dc[_0x6fc0('0x3b')]});});}});}function getCustomFields(_0x20d169,_0x34663f){var _0x100692={};if(_0x20d169[_0x6fc0('0x36')]>0x0){_[_0x6fc0('0x43')](_0x20d169,function(_0xe09fc2){if(_[_0x6fc0('0x44')](['string',_0x6fc0('0x45')],_0xe09fc2[_0x6fc0('0x46')])&&_0xe09fc2[_0x6fc0('0x47')]){_0x100692[_0xe09fc2[_0x6fc0('0x47')]]=_0xe09fc2['content'][_0x6fc0('0x48')]();}else if(_0xe09fc2['type']===_0x6fc0('0x49')&&_0xe09fc2[_0x6fc0('0x4a')]&&_0xe09fc2[_0x6fc0('0x47')]){_0x34663f[_0xe09fc2[_0x6fc0('0x4a')]]&&(_0x100692[_0xe09fc2[_0x6fc0('0x47')]]=_0x34663f[_0xe09fc2[_0x6fc0('0x4a')]][_0x6fc0('0x48')]());}else if(_0xe09fc2['type']==='customVariable'&&_0xe09fc2[_0x6fc0('0x4b')]&&_0xe09fc2[_0x6fc0('0x4b')][_0x6fc0('0x4c')]&&_0xe09fc2[_0x6fc0('0x47')]){_0x34663f[_0xe09fc2[_0x6fc0('0x4b')][_0x6fc0('0x4c')][_0x6fc0('0x4d')]()]&&(_0x100692[_0xe09fc2['idField']]=_0x34663f[_0xe09fc2[_0x6fc0('0x4b')][_0x6fc0('0x4c')][_0x6fc0('0x4d')]()][_0x6fc0('0x48')]());}});}return _0x100692;}function getConnection(_0x20da2d){var _0xa9cebc=_0x20da2d[_0x6fc0('0x4e')][_0x6fc0('0x4f')](_0x20da2d[_0x6fc0('0x50')]);var _0x3a2259=new jsforce[(_0x6fc0('0x51'))]({'oauth2':{'loginUrl':_0x20da2d[_0x6fc0('0x52')]||'https://login.salesforce.com','clientId':_0x20da2d['clientId'],'clientSecret':_0x20da2d[_0x6fc0('0x53')]}});return _0x3a2259[_0x6fc0('0x54')](_0x20da2d['username'],_0xa9cebc)['then'](function(){logger[_0x6fc0('0x1d')]('Connection\x20established.');return _0x3a2259;});}exports[_0x6fc0('0x55')]=function(_0x312780,_0x20e2fc,_0xb8880d,_0x4de137,_0x389385,_0x478bfb){var _0xde51d3,_0x4cfa63,_0x19e7d9,_0x583d78;_0x478bfb[_0x6fc0('0x56')]=intUtil[_0x6fc0('0x57')](_0x478bfb['serverUrl']);_0x478bfb[_0x6fc0('0x52')]=intUtil[_0x6fc0('0x57')](_0x478bfb['remoteUri']);if(_0x389385&&_0x389385[_0x6fc0('0x58')]){logger[_0x6fc0('0x1d')](_0x6fc0('0x59'),'Recording\x20is\x20enabled!');_0x20e2fc['recordingURL']=util[_0x6fc0('0x40')](_0x6fc0('0x5a'),_0x478bfb[_0x6fc0('0x56')],_0x20e2fc[_0x6fc0('0x5b')],md5(_0x20e2fc[_0x6fc0('0x5b')]));}else{_0x20e2fc[_0x6fc0('0x5c')]='';}return getConnection(_0x478bfb)[_0x6fc0('0x27')](function(_0x4583cd){_0x583d78=_0x4583cd;return getUser(_0x478bfb,_0x4de137[_0x6fc0('0x5d')],_0x583d78);})[_0x6fc0('0x27')](function(_0x513ba4){_0xde51d3=_0x513ba4;return getEndUser(_0x478bfb,_0xb8880d,_0x20e2fc[_0x6fc0('0x5e')],_0x20e2fc[_0x6fc0('0x5f')],_0x583d78);})['then'](function(_0x2d669b){_0x4cfa63=_0x2d669b;return getTicket(_0x478bfb,_0xde51d3,_0x4cfa63,_0xb8880d,_0x20e2fc,_0xb8880d[_0x6fc0('0x60')],_0x583d78,_0x6fc0('0x55'));})[_0x6fc0('0x27')](function(_0x27eb75){_0x19e7d9=_0x27eb75;logger[_0x6fc0('0x1d')](_0x6fc0('0x61'),_0x19e7d9['id']);logger[_0x6fc0('0x1d')](_0x6fc0('0x62'),_0x19e7d9['id'],_0x4de137[_0x6fc0('0x4c')],_0x478bfb[_0x6fc0('0x46')]);switch(_0x478bfb[_0x6fc0('0x46')]){case'integrationTab':emit(util['format'](_0x6fc0('0x63'),_0x4de137[_0x6fc0('0x4c')]),_0x6fc0('0x64'),{'recordId':_0x19e7d9['id']});break;case _0x6fc0('0x65'):emit(util[_0x6fc0('0x40')]('user:%s',_0x4de137[_0x6fc0('0x4c')]),_0x6fc0('0x66'),{'uri':util[_0x6fc0('0x40')](_0x6fc0('0x67'),_0x583d78['instanceUrl'],_0x19e7d9['id'])});break;default:logger[_0x6fc0('0x68')](_0x6fc0('0x69'));}})['catch'](function(_0x1f82b6){logger['error'](_0x6fc0('0x59'),_0x1f82b6);});};exports['outbound']=function(_0x1c4bb9,_0x32a56d,_0x462532,_0x15278c,_0x387f71,_0x303ee5,_0x47b046){var _0x4cef67,_0x4f4d05,_0x2733af,_0x46b7eb;_0x303ee5['serverUrl']=intUtil[_0x6fc0('0x57')](_0x303ee5['serverUrl']);_0x303ee5['remoteUri']=intUtil[_0x6fc0('0x57')](_0x303ee5[_0x6fc0('0x52')]);if(_0x47b046&&_0x47b046[_0x6fc0('0x6a')]&&_0x47b046[_0x6fc0('0x6a')]!==_0x6fc0('0x6b')){logger[_0x6fc0('0x1d')]('[OUTBOUND]',_0x6fc0('0x6c'));_0x32a56d[_0x6fc0('0x5c')]=util[_0x6fc0('0x40')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x303ee5['serverUrl'],_0x32a56d['uniqueid'],md5(_0x32a56d[_0x6fc0('0x5b')]));}return getConnection(_0x303ee5)[_0x6fc0('0x27')](function(_0xd4832b){_0x46b7eb=_0xd4832b;return getUser(_0x303ee5,_0x15278c[_0x6fc0('0x5d')],_0x46b7eb);})['then'](function(_0x1a0a26){_0x4cef67=_0x1a0a26;return getEndUser(_0x303ee5,_0x462532,_0x32a56d['destcalleridname'],_0x32a56d[_0x6fc0('0x6d')],_0x46b7eb);})[_0x6fc0('0x27')](function(_0x1b46a9){_0x4f4d05=_0x1b46a9;return getTicket(_0x303ee5,_0x4cef67,_0x4f4d05,_0x462532,_0x32a56d,_0x462532[_0x6fc0('0x60')],_0x46b7eb,_0x6fc0('0x6e'));})[_0x6fc0('0x27')](function(_0x15cd56){_0x2733af=_0x15cd56;logger[_0x6fc0('0x1d')](_0x6fc0('0x6f'),_0x2733af['id']);logger[_0x6fc0('0x1d')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x2733af['id'],_0x15278c[_0x6fc0('0x4c')],_0x303ee5[_0x6fc0('0x46')]);switch(_0x303ee5[_0x6fc0('0x46')]){case'integrationTab':emit(util['format']('user:%s',_0x15278c['name']),_0x6fc0('0x64'),{'recordId':_0x2733af['id']});break;case _0x6fc0('0x65'):emit(util['format'](_0x6fc0('0x63'),_0x15278c['name']),_0x6fc0('0x66'),{'uri':util[_0x6fc0('0x40')](_0x6fc0('0x67'),_0x46b7eb[_0x6fc0('0x70')],_0x2733af['id'])});break;default:logger[_0x6fc0('0x68')](_0x6fc0('0x71'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x6fc0('0x72')](function(_0x1e6601){logger['error'](_0x6fc0('0x71'),_0x1e6601);});};exports[_0x6fc0('0x73')]=function(_0x17b210,_0x738d9d,_0x1f2b0f,_0xd06c94,_0x4d2d55,_0x4d4c75){var _0xa43bd1,_0x1bb086,_0x3b3ac2,_0x23b52e;_0x4d4c75[_0x6fc0('0x56')]=intUtil[_0x6fc0('0x57')](_0x4d4c75[_0x6fc0('0x56')]);_0x4d4c75['remoteUri']=intUtil['stripTrailingSlash'](_0x4d4c75[_0x6fc0('0x52')]);if(_0x4d2d55&&_0x4d2d55[_0x6fc0('0x58')]){logger[_0x6fc0('0x1d')]('['+_0x738d9d['lastevent'][_0x6fc0('0x74')]()+']',_0x6fc0('0x6c'));_0x738d9d[_0x6fc0('0x5c')]=util[_0x6fc0('0x40')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4d4c75[_0x6fc0('0x56')],_0x738d9d['uniqueid'],md5(_0x738d9d[_0x6fc0('0x5b')]));}else{_0x738d9d['recordingURL']='';}return getConnection(_0x4d4c75)[_0x6fc0('0x27')](function(_0x5e934e){_0x23b52e=_0x5e934e;if(!_[_0x6fc0('0x75')](_0xd06c94)){return getUser(_0x4d4c75,_0xd06c94[_0x6fc0('0x4c')],_0x23b52e);}else{return getUser(_0x4d4c75,null,_0x23b52e);}})[_0x6fc0('0x27')](function(_0xf31650){_0xa43bd1=_0xf31650;return getEndUser(_0x4d4c75,_0x1f2b0f,_0x738d9d[_0x6fc0('0x5e')],_0x738d9d[_0x6fc0('0x5f')],_0x23b52e);})[_0x6fc0('0x27')](function(_0x35e3e8){_0x1bb086=_0x35e3e8;return getTicket(_0x4d4c75,_0xa43bd1,_0x1bb086,_0x1f2b0f,_0x738d9d,_0x1f2b0f[_0x6fc0('0x60')],_0x23b52e);})['then'](function(_0xe3e4f6){_0x3b3ac2=_0xe3e4f6;logger['info']('['+_0x738d9d[_0x6fc0('0x76')][_0x6fc0('0x74')]()+_0x6fc0('0x77'),_0x3b3ac2['id']);logger['info']('['+_0x738d9d['lastevent'][_0x6fc0('0x74')]()+_0x6fc0('0x78'),_0x4d4c75[_0x6fc0('0x46')]);})[_0x6fc0('0x72')](function(_0x4210e7){logger[_0x6fc0('0x68')]('['+_0x738d9d['lastevent'][_0x6fc0('0x74')]()+']',_0x4210e7);});}; \ No newline at end of file +var _0xaf1d=['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','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase','calleridnum',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','Subjects','Descriptions','ticketType','Task','utc','IsRecurrence','contact','endUserType','account','WhatId','Case','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','validateEmail','User','find','then','length','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','resolve','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','additionalSearchContact','merge','$or','Contact','execute','cloneDeep','additionalSearchLead','account_contact_lead','Lead','additionalSearchAccount','Account','Phone','attributes','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','LastName','Company','No\x20Company','Caller\x20-\x20%s','upperFirst','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','Variable','name','password','concat','securityToken','remoteUri','clientId','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridname'];(function(_0x4d183d,_0x388268){var _0xf9fa89=function(_0x302c98){while(--_0x302c98){_0x4d183d['push'](_0x4d183d['shift']());}};_0xf9fa89(++_0x388268);}(_0xaf1d,0x195));var _0xdaf1=function(_0x407382,_0x526512){_0x407382=_0x407382-0x0;var _0x37670f=_0xaf1d[_0x407382];return _0x37670f;};'use strict';var _=require('lodash');var rp=require(_0xdaf1('0x0'));var moment=require(_0xdaf1('0x1'));var BPromise=require(_0xdaf1('0x2'));var md5=require('md5');var jsforce=require('jsforce');var util=require(_0xdaf1('0x3'));var Redis=require(_0xdaf1('0x4'));var intUtil=require(_0xdaf1('0x5'));var config=require(_0xdaf1('0x6'));var logger=require(_0xdaf1('0x7'))(_0xdaf1('0x8'));config[_0xdaf1('0x9')]=_[_0xdaf1('0xa')](config['redis'],{'host':_0xdaf1('0xb'),'port':0x18eb});var io=require(_0xdaf1('0xc'))(new Redis(config[_0xdaf1('0x9')]));function emit(_0x1041ca,_0x3b8a0a,_0x8a965c){io['to'](_0x1041ca)[_0xdaf1('0xd')](_0x3b8a0a,_0x8a965c);}function getTicket(_0x1b8ca8,_0x20d055,_0x1e6953,_0x463b17,_0x48503e,_0x4354d9,_0x110c83,_0x56a975){var _0x47abe7=Object[_0xdaf1('0xe')]({},{'OwnerId':_0x20d055['id'],'Subject':intUtil['getString'](_0x463b17[_0xdaf1('0xf')],_0x48503e,'\x20'),'Description':intUtil['getString'](_0x463b17[_0xdaf1('0x10')],_0x48503e,'\x0a')},getCustomFields(_0x4354d9,_0x48503e));if(_0x1e6953){if(_0x463b17[_0xdaf1('0x11')]===_0xdaf1('0x12')){_0x47abe7['ActivityDate']=moment[_0xdaf1('0x13')]();_0x47abe7['IsReminderSet']=![];_0x47abe7[_0xdaf1('0x14')]=![];if(_0x1e6953['endUserType']===_0xdaf1('0x15')||_0x1e6953[_0xdaf1('0x16')]==='lead'){_0x47abe7['WhoId']=_0x1e6953['id'];}else if(_0x1e6953[_0xdaf1('0x16')]===_0xdaf1('0x17')){_0x47abe7[_0xdaf1('0x18')]=_0x1e6953['id'];}}else if(_0x463b17['ticketType']===_0xdaf1('0x19')){if(_0x1e6953['endUserType']===_0xdaf1('0x15')){_0x47abe7['ContactId']=_0x1e6953['id'];}else if(_0x1e6953[_0xdaf1('0x16')]===_0xdaf1('0x17')){_0x47abe7['AccountId']=_0x1e6953['id'];}else if(_0x1e6953['endUserType']===_0xdaf1('0x1a')&&_0x463b17[_0xdaf1('0x1b')]){_0x47abe7[_0x463b17[_0xdaf1('0x1b')]]=_0x1e6953['id'];}else{logger[_0xdaf1('0x1c')](_0xdaf1('0x1d'));}}}return _0x110c83[_0xdaf1('0x1e')](_0x463b17['ticketType'])[_0xdaf1('0x1f')](_0x47abe7);}function getUser(_0x24b810,_0x45c41c,_0x5aa545){if(!_['isNil'](_0x45c41c)&&intUtil[_0xdaf1('0x20')](_0x45c41c)){var _0xc6e568={'Email':_0x45c41c};var _0x3b8f82={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5aa545[_0xdaf1('0x1e')](_0xdaf1('0x21'))[_0xdaf1('0x22')](_0xc6e568,_0x3b8f82)['execute']()[_0xdaf1('0x23')](function(_0x13f877){if(_0x13f877[_0xdaf1('0x24')]){var _0x5ccdd2=_['find'](_0x13f877,function(_0x2d8ac5){return _0x2d8ac5['Email']===_0x45c41c;});if(_0x5ccdd2){logger[_0xdaf1('0x1c')]('Agent\x20%s\x20found.',_0x45c41c);return BPromise['resolve']({'id':_0x5ccdd2['Id'],'name':_0x5ccdd2[_0xdaf1('0x25')]});}}else{logger[_0xdaf1('0x1c')](_0xdaf1('0x26'),_0x45c41c);return _0x5aa545[_0xdaf1('0x27')]()[_0xdaf1('0x23')](function(_0x2f64ce){return BPromise['resolve']({'id':_0x2f64ce['user_id'],'name':_0x2f64ce['display_name']});});}});}else{logger['info'](_0xdaf1('0x26'),_0x45c41c);return _0x5aa545[_0xdaf1('0x27')]()['then'](function(_0xf5180b){return BPromise['resolve']({'id':_0xf5180b[_0xdaf1('0x28')],'name':_0xf5180b[_0xdaf1('0x29')]});});}}function getEndUser(_0x1d066f,_0x49bedb,_0x2ab5c8,_0x1c81a7,_0x5b3f12){var _0x3e5936={'$or':{'Phone':_0x1c81a7}};var _0x1d5064={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xdaf1('0x2a')]()[_0xdaf1('0x23')](function(){logger[_0xdaf1('0x1c')](_0xdaf1('0x2b'),_0x1c81a7,_0x49bedb[_0xdaf1('0x2c')]);switch(_0x49bedb[_0xdaf1('0x2c')]){case'contact_lead':var _0x36aca3=_['cloneDeep'](_0x3e5936);if(_0x49bedb[_0xdaf1('0x2d')]){var _0x1e02af={};_0x1e02af[_0x49bedb[_0xdaf1('0x2d')]]=_0x1c81a7;_[_0xdaf1('0x2e')](_0x36aca3[_0xdaf1('0x2f')],_0x1e02af);}return _0x5b3f12[_0xdaf1('0x1e')](_0xdaf1('0x30'))[_0xdaf1('0x22')](_0x36aca3,_0x1d5064)[_0xdaf1('0x31')]()[_0xdaf1('0x23')](function(_0x201ca4){if(_0x201ca4&&_0x201ca4[_0xdaf1('0x24')]){return _0x201ca4;}else{var _0x24ba3c=_[_0xdaf1('0x32')](_0x3e5936);if(_0x49bedb[_0xdaf1('0x33')]){var _0x57a566={};_0x57a566[_0x49bedb[_0xdaf1('0x33')]]=_0x1c81a7;_[_0xdaf1('0x2e')](_0x24ba3c[_0xdaf1('0x2f')],_0x57a566);}return _0x5b3f12[_0xdaf1('0x1e')]('Lead')[_0xdaf1('0x22')](_0x24ba3c,_0x1d5064);}});case _0xdaf1('0x34'):var _0x112aca=_['cloneDeep'](_0x3e5936);if(_0x49bedb['additionalSearchAccount']){var _0x1e02af={};_0x1e02af[_0x49bedb['additionalSearchAccount']]=_0x1c81a7;_[_0xdaf1('0x2e')](_0x112aca['$or'],_0x1e02af);}return _0x5b3f12[_0xdaf1('0x1e')]('Account')[_0xdaf1('0x22')](_0x112aca,_0x1d5064)[_0xdaf1('0x31')]()['then'](function(_0x3f1769){if(_0x3f1769&&_0x3f1769[_0xdaf1('0x24')]){return _0x3f1769;}else{var _0x42ff8f=_[_0xdaf1('0x32')](_0x3e5936);if(_0x49bedb[_0xdaf1('0x2d')]){var _0x5dbf36={};_0x5dbf36[_0x49bedb[_0xdaf1('0x2d')]]=_0x1c81a7;_[_0xdaf1('0x2e')](_0x42ff8f[_0xdaf1('0x2f')],_0x5dbf36);}return _0x5b3f12[_0xdaf1('0x1e')](_0xdaf1('0x30'))[_0xdaf1('0x22')](_0x42ff8f,_0x1d5064)[_0xdaf1('0x23')](function(_0x2c8f22){if(_0x2c8f22&&_0x2c8f22[_0xdaf1('0x24')]){return _0x2c8f22;}else{var _0x1ca3ff=_['cloneDeep'](_0x3e5936);if(_0x49bedb[_0xdaf1('0x33')]){var _0x453c45={};_0x453c45[_0x49bedb[_0xdaf1('0x33')]]=_0x1c81a7;_['merge'](_0x1ca3ff['$or'],_0x453c45);}return _0x5b3f12[_0xdaf1('0x1e')](_0xdaf1('0x35'))[_0xdaf1('0x22')](_0x1ca3ff,_0x1d5064);}});}});case'contact':var _0x36aca3=_[_0xdaf1('0x32')](_0x3e5936);if(_0x49bedb[_0xdaf1('0x2d')]){var _0x1e02af={};_0x1e02af[_0x49bedb['additionalSearchContact']]=_0x1c81a7;_['merge'](_0x36aca3[_0xdaf1('0x2f')],_0x1e02af);}return _0x5b3f12[_0xdaf1('0x1e')](_0xdaf1('0x30'))[_0xdaf1('0x22')](_0x36aca3,_0x1d5064)[_0xdaf1('0x31')]();case'lead':var _0x49a576=_[_0xdaf1('0x32')](_0x3e5936);if(_0x49bedb[_0xdaf1('0x33')]){var _0x1e02af={};_0x1e02af[_0x49bedb['additionalSearchLead']]=_0x1c81a7;_[_0xdaf1('0x2e')](_0x49a576[_0xdaf1('0x2f')],_0x1e02af);}return _0x5b3f12[_0xdaf1('0x1e')](_0xdaf1('0x35'))['find'](_0x49a576,_0x1d5064);case _0xdaf1('0x17'):var _0x112aca=_[_0xdaf1('0x32')](_0x3e5936);if(_0x49bedb['additionalSearchAccount']){var _0x1e02af={};_0x1e02af[_0x49bedb[_0xdaf1('0x36')]]=_0x1c81a7;_[_0xdaf1('0x2e')](_0x112aca[_0xdaf1('0x2f')],_0x1e02af);}return _0x5b3f12[_0xdaf1('0x1e')](_0xdaf1('0x37'))[_0xdaf1('0x22')](_0x112aca,_0x1d5064);default:return null;}})[_0xdaf1('0x23')](function(_0x1d150b){if(_0x1d150b&&_0x1d150b[_0xdaf1('0x24')]){var _0x425d38=_['first'](_0x1d150b);if(_0x425d38){return BPromise[_0xdaf1('0x2a')]({'id':_0x425d38['Id'],'name':_0x425d38['Name'],'phone':_0x425d38[_0xdaf1('0x38')],'endUserType':_0x425d38[_0xdaf1('0x39')]['type'][_0xdaf1('0x3a')]()});}}})[_0xdaf1('0x23')](function(_0x4b48bf){if(_0x4b48bf){logger['info']('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x4b48bf[_0xdaf1('0x16')],_0x1c81a7);return BPromise[_0xdaf1('0x2a')](_0x4b48bf);}else{logger[_0xdaf1('0x1c')](_0xdaf1('0x3b'),_0x1c81a7);var _0x39161e={'Phone':_0x1c81a7};if(_0x49bedb[_0xdaf1('0x3c')]){if(_0x49bedb[_0xdaf1('0x3c')]===_0xdaf1('0x15')){logger[_0xdaf1('0x1c')](_0xdaf1('0x3d'),_0x1c81a7,_0x49bedb[_0xdaf1('0x3c')]);_0x39161e['LastName']=_0x2ab5c8!==_0xdaf1('0x3e')?_0x2ab5c8:util[_0xdaf1('0x3f')]('Caller\x20-\x20%s',_0x1c81a7);}else if(_0x49bedb['moduleCreate']===_0xdaf1('0x1a')){logger[_0xdaf1('0x1c')](_0xdaf1('0x3d'),_0x1c81a7,_0x49bedb[_0xdaf1('0x3c')]);_0x39161e[_0xdaf1('0x40')]=_0x2ab5c8!==_0xdaf1('0x3e')?_0x2ab5c8:util[_0xdaf1('0x3f')]('Caller\x20-\x20%s',_0x1c81a7);_0x39161e[_0xdaf1('0x41')]=_0xdaf1('0x42');}else if(_0x49bedb[_0xdaf1('0x3c')]===_0xdaf1('0x17')){logger[_0xdaf1('0x1c')](_0xdaf1('0x3d'),_0x1c81a7,_0x49bedb[_0xdaf1('0x3c')]);_0x39161e[_0xdaf1('0x25')]=_0x2ab5c8!==''?_0x2ab5c8:util[_0xdaf1('0x3f')](_0xdaf1('0x43'),_0x1c81a7);}else{return null;}}return _0x5b3f12[_0xdaf1('0x1e')](_[_0xdaf1('0x44')](_0x49bedb[_0xdaf1('0x3c')]))[_0xdaf1('0x1f')](_0x39161e)[_0xdaf1('0x23')](function(_0x43326e){return BPromise['resolve']({'id':_0x43326e['id'],'endUserType':_0x49bedb[_0xdaf1('0x3c')]});});}});}function getCustomFields(_0xf9a8e6,_0x4cfa1c){var _0x1627a6={};if(_0xf9a8e6[_0xdaf1('0x24')]>0x0){_[_0xdaf1('0x45')](_0xf9a8e6,function(_0x129d60){if(_[_0xdaf1('0x46')]([_0xdaf1('0x47'),_0xdaf1('0x48')],_0x129d60[_0xdaf1('0x49')])&&_0x129d60[_0xdaf1('0x4a')]){_0x1627a6[_0x129d60['idField']]=_0x129d60[_0xdaf1('0x4b')][_0xdaf1('0x4c')]();}else if(_0x129d60[_0xdaf1('0x49')]===_0xdaf1('0x4d')&&_0x129d60[_0xdaf1('0x4e')]&&_0x129d60['idField']){_0x4cfa1c[_0x129d60[_0xdaf1('0x4e')]]&&(_0x1627a6[_0x129d60[_0xdaf1('0x4a')]]=_0x4cfa1c[_0x129d60['variableName']][_0xdaf1('0x4c')]());}else if(_0x129d60[_0xdaf1('0x49')]==='customVariable'&&_0x129d60[_0xdaf1('0x4f')]&&_0x129d60[_0xdaf1('0x4f')][_0xdaf1('0x50')]&&_0x129d60[_0xdaf1('0x4a')]){_0x4cfa1c[_0x129d60[_0xdaf1('0x4f')][_0xdaf1('0x50')][_0xdaf1('0x3a')]()]&&(_0x1627a6[_0x129d60[_0xdaf1('0x4a')]]=_0x4cfa1c[_0x129d60[_0xdaf1('0x4f')][_0xdaf1('0x50')][_0xdaf1('0x3a')]()][_0xdaf1('0x4c')]());}});}return _0x1627a6;}function getConnection(_0x20aa44){var _0x4a3fd5=_0x20aa44[_0xdaf1('0x51')][_0xdaf1('0x52')](_0x20aa44[_0xdaf1('0x53')]);var _0x39e488=new jsforce['Connection']({'oauth2':{'loginUrl':_0x20aa44[_0xdaf1('0x54')]||'https://login.salesforce.com','clientId':_0x20aa44[_0xdaf1('0x55')],'clientSecret':_0x20aa44['clientSecret']}});return _0x39e488[_0xdaf1('0x56')](_0x20aa44[_0xdaf1('0x57')],_0x4a3fd5)[_0xdaf1('0x23')](function(){logger['info'](_0xdaf1('0x58'));return _0x39e488;});}exports[_0xdaf1('0x59')]=function(_0x163c09,_0xa0f9f2,_0x18bc4d,_0x3589da,_0x1e3fcf,_0x229fc1){var _0x2dff54,_0x1c36d1,_0x5acb86,_0x991fb4;_0x229fc1[_0xdaf1('0x5a')]=intUtil[_0xdaf1('0x5b')](_0x229fc1[_0xdaf1('0x5a')]);_0x229fc1[_0xdaf1('0x54')]=intUtil[_0xdaf1('0x5b')](_0x229fc1[_0xdaf1('0x54')]);if(_0x1e3fcf&&_0x1e3fcf[_0xdaf1('0x5c')]){logger[_0xdaf1('0x1c')](_0xdaf1('0x5d'),_0xdaf1('0x5e'));_0xa0f9f2[_0xdaf1('0x5f')]=util[_0xdaf1('0x3f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x229fc1[_0xdaf1('0x5a')],_0xa0f9f2[_0xdaf1('0x60')],md5(_0xa0f9f2[_0xdaf1('0x60')]));}else{_0xa0f9f2['recordingURL']='';}return getConnection(_0x229fc1)[_0xdaf1('0x23')](function(_0x38c339){_0x991fb4=_0x38c339;return getUser(_0x229fc1,_0x3589da[_0xdaf1('0x61')],_0x991fb4);})['then'](function(_0x7cc80d){_0x2dff54=_0x7cc80d;return getEndUser(_0x229fc1,_0x18bc4d,_0xa0f9f2[_0xdaf1('0x62')],_0xa0f9f2['calleridnum'],_0x991fb4);})['then'](function(_0x2b153e){_0x1c36d1=_0x2b153e;return getTicket(_0x229fc1,_0x2dff54,_0x1c36d1,_0x18bc4d,_0xa0f9f2,_0x18bc4d[_0xdaf1('0x63')],_0x991fb4,_0xdaf1('0x59'));})['then'](function(_0x2b4f4f){_0x5acb86=_0x2b4f4f;logger[_0xdaf1('0x1c')](_0xdaf1('0x64'),_0x5acb86['id']);logger[_0xdaf1('0x1c')](_0xdaf1('0x65'),_0x5acb86['id'],_0x3589da[_0xdaf1('0x50')],_0x229fc1[_0xdaf1('0x49')]);switch(_0x229fc1[_0xdaf1('0x49')]){case _0xdaf1('0x66'):emit(util['format'](_0xdaf1('0x67'),_0x3589da[_0xdaf1('0x50')]),_0xdaf1('0x68'),{'recordId':_0x5acb86['id']});break;case'newTab':emit(util[_0xdaf1('0x3f')](_0xdaf1('0x67'),_0x3589da[_0xdaf1('0x50')]),_0xdaf1('0x69'),{'uri':util['format']('%s/%s/e',_0x991fb4[_0xdaf1('0x6a')],_0x5acb86['id'])});break;default:logger[_0xdaf1('0x6b')](_0xdaf1('0x6c'));}})[_0xdaf1('0x6d')](function(_0x4cc5b2){logger['error'](_0xdaf1('0x5d'),_0x4cc5b2);});};exports[_0xdaf1('0x6e')]=function(_0x7736af,_0x1982fe,_0x29b6e7,_0x239f27,_0x81bdce,_0x88953f,_0x33cd66){var _0x48acb8,_0x547895,_0x2d10ad,_0x40ad5d;_0x88953f[_0xdaf1('0x5a')]=intUtil[_0xdaf1('0x5b')](_0x88953f[_0xdaf1('0x5a')]);_0x88953f[_0xdaf1('0x54')]=intUtil[_0xdaf1('0x5b')](_0x88953f['remoteUri']);if(_0x33cd66&&_0x33cd66[_0xdaf1('0x6f')]&&_0x33cd66[_0xdaf1('0x6f')]!==_0xdaf1('0x70')){logger[_0xdaf1('0x1c')](_0xdaf1('0x71'),_0xdaf1('0x5e'));_0x1982fe[_0xdaf1('0x5f')]=util['format'](_0xdaf1('0x72'),_0x88953f['serverUrl'],_0x1982fe[_0xdaf1('0x60')],md5(_0x1982fe[_0xdaf1('0x60')]));}return getConnection(_0x88953f)['then'](function(_0x4b9df8){_0x40ad5d=_0x4b9df8;return getUser(_0x88953f,_0x239f27[_0xdaf1('0x61')],_0x40ad5d);})[_0xdaf1('0x23')](function(_0x152bb9){_0x48acb8=_0x152bb9;return getEndUser(_0x88953f,_0x29b6e7,_0x1982fe[_0xdaf1('0x73')],_0x1982fe[_0xdaf1('0x74')],_0x40ad5d);})['then'](function(_0x43848f){_0x547895=_0x43848f;return getTicket(_0x88953f,_0x48acb8,_0x547895,_0x29b6e7,_0x1982fe,_0x29b6e7[_0xdaf1('0x63')],_0x40ad5d,_0xdaf1('0x6e'));})[_0xdaf1('0x23')](function(_0x5c5a74){_0x2d10ad=_0x5c5a74;logger['info'](_0xdaf1('0x75'),_0x2d10ad['id']);logger[_0xdaf1('0x1c')](_0xdaf1('0x76'),_0x2d10ad['id'],_0x239f27['name'],_0x88953f[_0xdaf1('0x49')]);switch(_0x88953f[_0xdaf1('0x49')]){case _0xdaf1('0x66'):emit(util[_0xdaf1('0x3f')](_0xdaf1('0x67'),_0x239f27[_0xdaf1('0x50')]),_0xdaf1('0x68'),{'recordId':_0x2d10ad['id']});break;case _0xdaf1('0x77'):emit(util[_0xdaf1('0x3f')](_0xdaf1('0x67'),_0x239f27['name']),_0xdaf1('0x69'),{'uri':util[_0xdaf1('0x3f')](_0xdaf1('0x78'),_0x40ad5d[_0xdaf1('0x6a')],_0x2d10ad['id'])});break;default:logger[_0xdaf1('0x6b')](_0xdaf1('0x71'),_0xdaf1('0x79'));}})[_0xdaf1('0x6d')](function(_0x522c84){logger[_0xdaf1('0x6b')](_0xdaf1('0x71'),_0x522c84);});};exports['unmanaged']=function(_0x49d8f4,_0xb24b6d,_0x476a42,_0x567147,_0x3368b5,_0x368923){var _0x4a77ad,_0x43a066,_0x30cb0e,_0x5d8017;_0x368923[_0xdaf1('0x5a')]=intUtil[_0xdaf1('0x5b')](_0x368923[_0xdaf1('0x5a')]);_0x368923[_0xdaf1('0x54')]=intUtil[_0xdaf1('0x5b')](_0x368923[_0xdaf1('0x54')]);if(_0x3368b5&&_0x3368b5[_0xdaf1('0x5c')]){logger[_0xdaf1('0x1c')]('['+_0xb24b6d[_0xdaf1('0x7a')][_0xdaf1('0x7b')]()+']',_0xdaf1('0x5e'));_0xb24b6d[_0xdaf1('0x5f')]=util[_0xdaf1('0x3f')](_0xdaf1('0x72'),_0x368923[_0xdaf1('0x5a')],_0xb24b6d['uniqueid'],md5(_0xb24b6d[_0xdaf1('0x60')]));}else{_0xb24b6d[_0xdaf1('0x5f')]='';}return getConnection(_0x368923)['then'](function(_0x48702a){_0x5d8017=_0x48702a;if(!_['isNil'](_0x567147)){return getUser(_0x368923,_0x567147[_0xdaf1('0x50')],_0x5d8017);}else{return getUser(_0x368923,null,_0x5d8017);}})['then'](function(_0x49a403){_0x4a77ad=_0x49a403;return getEndUser(_0x368923,_0x476a42,_0xb24b6d[_0xdaf1('0x62')],_0xb24b6d[_0xdaf1('0x7c')],_0x5d8017);})[_0xdaf1('0x23')](function(_0x103e6f){_0x43a066=_0x103e6f;return getTicket(_0x368923,_0x4a77ad,_0x43a066,_0x476a42,_0xb24b6d,_0x476a42['Fields'],_0x5d8017);})[_0xdaf1('0x23')](function(_0x555cf9){_0x30cb0e=_0x555cf9;logger[_0xdaf1('0x1c')]('['+_0xb24b6d[_0xdaf1('0x7a')][_0xdaf1('0x7b')]()+']\x20Ticket\x20%s\x20created.',_0x30cb0e['id']);logger[_0xdaf1('0x1c')]('['+_0xb24b6d[_0xdaf1('0x7a')][_0xdaf1('0x7b')]()+_0xdaf1('0x7d'),_0x368923[_0xdaf1('0x49')]);})['catch'](function(_0x3635be){logger[_0xdaf1('0x6b')]('['+_0xb24b6d['lastevent']['toUpperCase']()+']',_0x3635be);});}; \ 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 916331c..969ac9d 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 _0x9ba0=['calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','ioredis','./util','servicenow','redis','defaults','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','result','length','sys_id','info','],\x20getAdminUser\x20crm','error','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','active','userId','adminId','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','true','System','then','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','catch','includes','string','picklist','type','customField','nameField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','incident','assign','getString','Subjects',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','label_entry','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','stripTrailingSlash','serverUrl','format','%s/api/now/table/','remoteUri','isNil','email','destcalleridnum'];(function(_0x40d1b7,_0x514d11){var _0x39df83=function(_0x4b0018){while(--_0x4b0018){_0x40d1b7['push'](_0x40d1b7['shift']());}};_0x39df83(++_0x514d11);}(_0x9ba0,0xe9));var _0x09ba=function(_0x2c76f5,_0x1e87a6){_0x2c76f5=_0x2c76f5-0x0;var _0x1b450d=_0x9ba0[_0x2c76f5];return _0x1b450d;};'use strict';var _=require('lodash');var Promise=require(_0x09ba('0x0'));var rp=require(_0x09ba('0x1'));var util=require(_0x09ba('0x2'));var md5=require(_0x09ba('0x3'));var Redis=require(_0x09ba('0x4'));var intUtil=require(_0x09ba('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x09ba('0x6'));config[_0x09ba('0x7')]=_[_0x09ba('0x8')](config[_0x09ba('0x7')],{'host':_0x09ba('0x9'),'port':0x18eb});var io=require(_0x09ba('0xa'))(new Redis(config[_0x09ba('0x7')]));function getAdminUser(_0x21fd3e,_0x3f6099,_0x587663,_0x28cee3,_0x310777,_0x1e4ea1){return new Promise(function(_0x266e2e,_0x3a0084){var _0x12b8be={'method':'GET','uri':_0x28cee3+_0x09ba('0xb')+'&'+_0x310777+'&'+_0x1e4ea1,'auth':_0x3f6099,'json':!![]};return rp(_0x12b8be)['then'](function(_0x22d04c){if(_0x22d04c[_0x09ba('0xc')][_0x09ba('0xd')]>0x0){_0x587663['adminId']=_0x22d04c['result'][0x0][_0x09ba('0xe')];}logger[_0x09ba('0xf')]('['+[_0x21fd3e['toUpperCase']()]+_0x09ba('0x10'),_0x587663);_0x266e2e(_0x587663);})['catch'](function(_0x457073){logger[_0x09ba('0x11')]('['+[_0x21fd3e[_0x09ba('0x12')]()]+']',_0x457073[_0x09ba('0x13')]);_0x3a0084(_0x457073[_0x09ba('0x13')]);});});}function getUser(_0x1e8295,_0x32990a,_0x3f4939,_0x330cd4,_0x493626){return function(_0x215d0d){logger[_0x09ba('0xf')]('['+[_0x1e8295[_0x09ba('0x12')]()]+_0x09ba('0x14'),_0x215d0d);return new Promise(function(_0x3d1a99,_0x35d307){if(intUtil[_0x09ba('0x15')](_0x215d0d[_0x09ba('0x16')])){var _0x5eab5c={'method':_0x09ba('0x17'),'uri':_0x3f4939+_0x09ba('0x18')+_0x215d0d[_0x09ba('0x16')]+'&'+_0x330cd4+'&'+_0x493626,'auth':_0x32990a,'json':!![]};logger[_0x09ba('0xf')]('['+[_0x1e8295[_0x09ba('0x12')]()]+'],\x20getUser\x20rp\x20obj',_0x5eab5c);return rp(_0x5eab5c)['then'](function(_0x189e3f){logger[_0x09ba('0xf')]('['+[_0x1e8295[_0x09ba('0x12')]()]+_0x09ba('0x19'),_0x189e3f);if(_0x189e3f['result'][_0x09ba('0xd')]>0x0&&String(_0x189e3f['result'][0x0][_0x09ba('0x1a')])==='true'){_0x215d0d[_0x09ba('0x1b')]=_0x189e3f[_0x09ba('0xc')][0x0][_0x09ba('0xe')];}else{_0x215d0d[_0x09ba('0x1b')]=_0x215d0d[_0x09ba('0x1c')];_0x215d0d[_0x09ba('0x16')]=_0x215d0d[_0x09ba('0x1d')];}logger[_0x09ba('0xf')]('['+[_0x1e8295[_0x09ba('0x12')]()]+'],\x20getUser\x20crm',_0x215d0d);_0x3d1a99(_0x215d0d);})['catch'](function(_0x268816){logger['error']('['+[_0x1e8295[_0x09ba('0x12')]()]+']',_0x268816[_0x09ba('0x13')]);_0x35d307(_0x268816[_0x09ba('0x13')]);});}else{logger[_0x09ba('0xf')]('['+[_0x1e8295[_0x09ba('0x12')]()]+_0x09ba('0x1e'));_0x215d0d[_0x09ba('0x1b')]=_0x215d0d[_0x09ba('0x1c')];_0x215d0d[_0x09ba('0x16')]=_0x215d0d[_0x09ba('0x1d')];_0x3d1a99(_0x215d0d);}});};}function createEndUser(_0x48d02d,_0x591637,_0x4983a6,_0x237d86,_0x4b897e){logger[_0x09ba('0xf')]('['+[_0x48d02d[_0x09ba('0x12')]()]+_0x09ba('0x1f'),_0x4983a6);return new Promise(function(_0x465043,_0x21bc27){var _0xc70d54={'method':'POST','uri':_0x237d86+_0x09ba('0x20')+_0x4b897e,'body':{'user_name':_0x4983a6[_0x09ba('0x21')],'roles':_0x09ba('0x22'),'first_name':_0x4983a6[_0x09ba('0x21')],'active':_0x09ba('0x23'),'date_format':_0x09ba('0x24'),'phone':_0x4983a6[_0x09ba('0x21')]},'auth':_0x591637,'json':!![]};return rp(_0xc70d54)[_0x09ba('0x25')](function(_0x4ffcd2){logger[_0x09ba('0xf')]('['+[_0x48d02d['toUpperCase']()]+_0x09ba('0x26'),_0x4ffcd2[_0x09ba('0xc')]);_0x4983a6[_0x09ba('0x27')]=_0x4ffcd2[_0x09ba('0xc')][_0x09ba('0xe')];_0x465043(_0x4983a6);})['catch'](function(_0x42308f){logger[_0x09ba('0x11')]('['+[_0x48d02d[_0x09ba('0x12')]()]+']',_0x42308f['message']);_0x21bc27(_0x42308f[_0x09ba('0x13')]);});});}function getEndUser(_0x2ceb1e,_0x3e8186,_0x3ad091,_0x394860,_0x53b15c){return function(_0x3187d2){logger[_0x09ba('0xf')]('['+[_0x2ceb1e[_0x09ba('0x12')]()]+'],\x20getEndUser\x20input\x20crm',_0x3187d2);return new Promise(function(_0x12e9cd,_0x38ce9d){var _0x439fab={'method':_0x09ba('0x17'),'uri':_0x3ad091+'sys_user?sysparm_query=phone%3D'+_0x3187d2[_0x09ba('0x21')]+'&'+_0x394860+'&'+_0x53b15c,'auth':_0x3e8186,'json':!![]};return rp(_0x439fab)[_0x09ba('0x25')](function(_0x2a1486){if(_0x2a1486[_0x09ba('0xc')][_0x09ba('0xd')]>0x0){_0x3187d2[_0x09ba('0x27')]=_0x2a1486[_0x09ba('0xc')][0x0]['sys_id'];logger[_0x09ba('0xf')]('['+[_0x2ceb1e[_0x09ba('0x12')]()]+_0x09ba('0x28'),_0x3187d2);_0x12e9cd(_0x3187d2);}else{return createEndUser(_0x2ceb1e,_0x3e8186,_0x3187d2,_0x3ad091,_0x394860)[_0x09ba('0x25')](function(_0x6a0798){logger[_0x09ba('0xf')]('['+[_0x2ceb1e[_0x09ba('0x12')]()]+_0x09ba('0x29'),_0x6a0798);_0x12e9cd(_0x6a0798);});}})[_0x09ba('0x2a')](function(_0x5e908c){logger[_0x09ba('0x11')]('['+[_0x2ceb1e[_0x09ba('0x12')]()]+']',_0x5e908c[_0x09ba('0x13')]);_0x38ce9d(_0x5e908c['message']);});});};}function getCustomFields(_0x24ec94,_0x7bc1a4){var _0x32f37e={};if(_0x24ec94['length']>0x0){_['forEach'](_0x24ec94,function(_0x52bfa0){if(_[_0x09ba('0x2b')]([_0x09ba('0x2c'),_0x09ba('0x2d')],_0x52bfa0[_0x09ba('0x2e')])&&_0x52bfa0['nameField']&&!_0x52bfa0[_0x09ba('0x2f')]){_0x32f37e[_0x52bfa0[_0x09ba('0x30')][_0x09ba('0x31')]()]=_0x52bfa0[_0x09ba('0x32')][_0x09ba('0x33')]();}else if(_[_0x09ba('0x2b')](['string',_0x09ba('0x2d')],_0x52bfa0[_0x09ba('0x2e')])&&_0x52bfa0['idField']&&_0x52bfa0['customField']){_0x32f37e[_0x52bfa0[_0x09ba('0x34')][_0x09ba('0x31')]()]=_0x52bfa0[_0x09ba('0x32')]['toString']();}else if(_0x52bfa0[_0x09ba('0x2e')]===_0x09ba('0x35')&&_0x52bfa0[_0x09ba('0x36')]&&_0x52bfa0[_0x09ba('0x34')]&&_0x52bfa0[_0x09ba('0x2f')]){_0x32f37e[_0x52bfa0[_0x09ba('0x34')][_0x09ba('0x31')]()]=_0x7bc1a4[_0x52bfa0['variableName']][_0x09ba('0x33')]();}else if(_0x52bfa0[_0x09ba('0x2e')]===_0x09ba('0x37')&&_0x52bfa0[_0x09ba('0x38')]&&_0x52bfa0[_0x09ba('0x38')]['name']&&_0x52bfa0[_0x09ba('0x34')]&&_0x52bfa0[_0x09ba('0x2f')]){_0x32f37e[_0x52bfa0[_0x09ba('0x34')][_0x09ba('0x31')]()]=_0x7bc1a4[_0x52bfa0['Variable'][_0x09ba('0x39')][_0x09ba('0x31')]()]['toString']();}});}return _0x32f37e;}function getTicket(_0x575c25,_0x31d4d4,_0x392919,_0x2414c4,_0x2d495c,_0x6067c5){return function(_0x22fbd5){logger[_0x09ba('0xf')]('['+[_0x575c25['toUpperCase']()]+_0x09ba('0x3a'),_0x22fbd5);return new Promise(function(_0x520464,_0x6085ec){var _0x338e55=_0x575c25[_0x09ba('0x31')]()===_0x09ba('0x3b')?_0x22fbd5[_0x09ba('0x1b')]:_0x22fbd5[_0x09ba('0x27')];var _0x3e270e={'method':_0x09ba('0x3c'),'uri':_0x392919+_0x09ba('0x3d')+'?'+_0x6067c5,'body':Object[_0x09ba('0x3e')]({},{'active':_0x09ba('0x23'),'caller_id':_0x338e55,'assigned_to':_0x22fbd5[_0x09ba('0x1b')],'short_description':intUtil[_0x09ba('0x3f')](_0x2414c4[_0x09ba('0x40')],_0x2d495c,'\x20'),'description':intUtil['getString'](_0x2414c4['Descriptions'],_0x2d495c,'\x0a')},getCustomFields(_0x2414c4['Fields'],_0x2d495c)),'auth':_0x31d4d4,'json':!![]};return rp(_0x3e270e)[_0x09ba('0x25')](function(_0x55458e){logger[_0x09ba('0xf')]('['+[_0x575c25[_0x09ba('0x12')]()]+_0x09ba('0x41'),_0x55458e[_0x09ba('0xc')]);_0x22fbd5[_0x09ba('0x42')]=_0x55458e[_0x09ba('0xc')][_0x09ba('0xe')];_0x22fbd5[_0x09ba('0x43')]=_0x55458e[_0x09ba('0xc')][_0x09ba('0x44')];logger[_0x09ba('0xf')]('['+[_0x575c25[_0x09ba('0x12')]()]+']\x20getTicket\x20crm',_0x22fbd5);_0x520464(_0x22fbd5);})[_0x09ba('0x2a')](function(_0x29ba98){logger[_0x09ba('0x11')]('['+[_0x575c25['toUpperCase']()]+']',_0x29ba98[_0x09ba('0x13')]);_0x6085ec(_0x29ba98[_0x09ba('0x13')]);});});};}function createRemoteTag(_0x39dd35,_0x186609,_0x10f6ac,_0x105755){return new Promise(function(_0x73d18e,_0x5d030a){var _0x4e56b7={'method':_0x09ba('0x3c'),'uri':_0x10f6ac+_0x09ba('0x45')+'?'+_0x105755,'body':{'short_description':_0x39dd35,'global':!![],'active':!![],'name':_0x39dd35},'auth':_0x186609,'json':!![]};return rp(_0x4e56b7)[_0x09ba('0x25')](function(_0x311532){var _0x3b9e2c=_0x311532['result'][_0x09ba('0xe')];_0x73d18e(_0x3b9e2c);});});}function getRemoteTag(_0x3b2c85,_0x43f1d1,_0x28c101,_0x5dd500,_0x231fa7){return new Promise(function(_0x3a4d1a,_0xbd74d7){var _0x385187={'method':'GET','uri':_0x28c101+_0x09ba('0x45')+_0x09ba('0x46')+_0x3b2c85+'&'+_0x5dd500,'auth':_0x43f1d1,'json':!![]};return rp(_0x385187)[_0x09ba('0x25')](function(_0x2c06cc){if(_0x2c06cc['result'][_0x09ba('0xd')]>0x0){var _0xb81463=_0x2c06cc[_0x09ba('0xc')][0x0]['sys_id'];_0x3a4d1a(_0xb81463);}else{return createRemoteTag(_0x3b2c85,_0x43f1d1,_0x28c101,_0x5dd500)[_0x09ba('0x25')](function(_0x25a012){_0x3a4d1a(_0x25a012);});}});});}function assignTagToIncident(_0xd1da39,_0x4acb5c,_0x1784c8,_0x23b2eb,_0x160acb){return new Promise(function(_0x2072e1,_0x40ece7){var _0x2449c6={'method':'POST','uri':_0x1784c8+_0x09ba('0x47')+'?'+_0x160acb,'body':{'label':_0xd1da39,'table':_0x09ba('0x3d'),'id_type':'Incident','table_key':_0x23b2eb[_0x09ba('0x42')],'title':'Incident\x20-\x20'+_0x23b2eb[_0x09ba('0x43')],'id_display':_0x23b2eb[_0x09ba('0x43')]},'auth':_0x4acb5c,'json':!![]};return rp(_0x2449c6)['then'](function(_0x28d3e2){_0x2072e1();})['catch'](function(){_0x2072e1();});});}function manageTags(_0x59c22f,_0x10c4a7,_0x4ba002,_0x24fb69,_0x3beaf3,_0x47e5ad,_0x1ba1ab){return new Promise(function(_0x36ad2b,_0x8f09c8){var _0x59f9cf=[];_0x10c4a7[_0x09ba('0x48')](function(_0x4df7ed){_0x59f9cf[_0x09ba('0x49')](getRemoteTag(_0x4df7ed,_0x4ba002,_0x24fb69,_0x47e5ad,_0x1ba1ab));});return Promise[_0x09ba('0x4a')](_0x59f9cf)[_0x09ba('0x25')](function(_0x3c69a9){if(_0x3c69a9[_0x09ba('0xd')]){logger[_0x09ba('0xf')]('['+[_0x59c22f['toUpperCase']()]+_0x09ba('0x4b'),_0x3c69a9);var _0x2ac571=[];_0x3c69a9[_0x09ba('0x48')](function(_0x5de7ad){_0x2ac571[_0x09ba('0x49')](assignTagToIncident(_0x5de7ad,_0x4ba002,_0x24fb69,_0x3beaf3,_0x47e5ad));});return Promise[_0x09ba('0x4a')](_0x2ac571)[_0x09ba('0x25')](function(){_0x36ad2b();})['catch'](function(){_0x36ad2b();});}else{_0x36ad2b();}});});}function getTags(_0x3f14bd,_0x286204,_0x297de5,_0x33e1ab,_0x453261,_0x4b8bbd){return function(_0x466636){return new Promise(function(_0x450baa,_0x4f7079){var _0x243e63=[];var _0x246cc8=_0x33e1ab[_0x09ba('0x4c')];if(_0x246cc8&&_0x246cc8[_0x09ba('0xd')]>0x0){_0x243e63=_['map'](_0x246cc8,_0x09ba('0x39'));}if(_0x243e63[_0x09ba('0xd')]>0x0){return manageTags(_0x3f14bd,_0x243e63,_0x286204,_0x297de5,_0x466636,_0x453261,_0x4b8bbd)[_0x09ba('0x25')](function(){_0x450baa(_0x466636);});}else{_0x450baa(_0x466636);}});};}function emit(_0x392f64,_0x3ca268,_0xd80dba){var _0x1a57d0='%26sysparm_record_target%3Dincident'+_0x09ba('0x4d')+_0x09ba('0x4e')+_0x09ba('0x4f');var _0x1f2c9b={'uri':_0x392f64+_0x09ba('0x50')+_0xd80dba+_0x1a57d0};io['to'](util['format'](_0x09ba('0x51'),_0x3ca268))[_0x09ba('0x52')](_0x09ba('0x53'),_0x1f2c9b);}exports['cs']=function(_0x4f88bb,_0x57431d,_0x352023,_0x429d8a,_0x40f532,_0x149160,_0x564af2,_0x6d5459){var _0x1a8a5c={};var _0x3124cf={'user':_0x149160[_0x09ba('0x54')],'pass':_0x149160['password']};var _0x24f2ae=_0x09ba('0x55');var _0x486ee2='sysparm_display_value=true';_0x149160['remoteUri']=intUtil[_0x09ba('0x56')](_0x149160['remoteUri']);_0x149160[_0x09ba('0x57')]=intUtil[_0x09ba('0x56')](_0x149160[_0x09ba('0x57')]);var _0xbc3fb2=util[_0x09ba('0x58')](_0x09ba('0x59'),_0x149160[_0x09ba('0x5a')]);_0x1a8a5c[_0x09ba('0x16')]=!_[_0x09ba('0x5b')](_0x429d8a)?_0x429d8a[_0x09ba('0x5c')]:null;_0x1a8a5c[_0x09ba('0x1d')]=_0x149160[_0x09ba('0x5c')];_0x1a8a5c[_0x09ba('0x21')]=_0x6d5459[_0x09ba('0x31')]()===_0x09ba('0x3b')?_0x57431d[_0x09ba('0x5d')]:_0x57431d[_0x09ba('0x5e')];_0x1a8a5c[_0x09ba('0x5f')]=_0x6d5459===_0x09ba('0x60')||_0x6d5459===_0x09ba('0x61')?_0x09ba('0x60'):'outbound';var _0x147c0d=util[_0x09ba('0x58')](_0x09ba('0x62'),_0x149160[_0x09ba('0x57')],_0x57431d[_0x09ba('0x63')],md5(_0x57431d[_0x09ba('0x63')]));if(_0x40f532&&_0x40f532[_0x09ba('0x64')]){logger[_0x09ba('0xf')]('[QUEUE]','Recording\x20is\x20enabled!');_0x57431d[_0x09ba('0x65')]=_0x147c0d;}else if(_0x564af2&&_0x564af2[_0x09ba('0x66')]&&_0x564af2[_0x09ba('0x66')]!==_0x09ba('0x67')){logger[_0x09ba('0xf')](_0x09ba('0x68'),'Recording\x20is\x20enabled!');_0x57431d[_0x09ba('0x65')]=_0x147c0d;}else{_0x57431d['recordingURL']='';}return getAdminUser(_0x6d5459,_0x3124cf,_0x1a8a5c,_0xbc3fb2,_0x486ee2,_0x24f2ae)[_0x09ba('0x25')](getUser(_0x6d5459,_0x3124cf,_0xbc3fb2,_0x486ee2,_0x24f2ae))[_0x09ba('0x25')](getEndUser(_0x6d5459,_0x3124cf,_0xbc3fb2,_0x486ee2,_0x24f2ae))[_0x09ba('0x25')](getTicket(_0x6d5459,_0x3124cf,_0xbc3fb2,_0x352023,_0x57431d,_0x486ee2))[_0x09ba('0x25')](function(_0x52cd49){logger[_0x09ba('0xf')](util[_0x09ba('0x58')](_0x09ba('0x69'),_0x52cd49['ticketId']));logger[_0x09ba('0xf')](util['format']('call\x20direction:\x20%s',_0x6d5459));if(_0x6d5459!==_0x09ba('0x61')){logger[_0x09ba('0xf')]('['+[_0x6d5459['toUpperCase']()]+']',_0x09ba('0x6a'));emit(_0x149160['remoteUri'],_0x429d8a[_0x09ba('0x39')],_0x52cd49[_0x09ba('0x42')]);}})[_0x09ba('0x2a')](function(_0xf07ec7){logger['error']('['+[_0x6d5459[_0x09ba('0x12')]()]+_0x09ba('0x6b'),util[_0x09ba('0x6c')](_0xf07ec7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x40cd=['recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','sys_id','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','forEach','includes','string','type','nameField','customField','idField','toLowerCase','content','variable','variableName','toString','customVariable','Variable',']\x20getTicket\x20input\x20crm','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','name','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','username','password','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','isNil','email','outbound','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL'];(function(_0x2cd420,_0x45aad7){var _0x7d4081=function(_0xe17e00){while(--_0xe17e00){_0x2cd420['push'](_0x2cd420['shift']());}};_0x7d4081(++_0x45aad7);}(_0x40cd,0xe8));var _0xd40c=function(_0x486d35,_0x106f4e){_0x486d35=_0x486d35-0x0;var _0x56d8b5=_0x40cd[_0x486d35];return _0x56d8b5;};'use strict';var _=require(_0xd40c('0x0'));var Promise=require(_0xd40c('0x1'));var rp=require('request-promise');var util=require(_0xd40c('0x2'));var md5=require(_0xd40c('0x3'));var Redis=require(_0xd40c('0x4'));var intUtil=require(_0xd40c('0x5'));var config=require(_0xd40c('0x6'));var logger=require(_0xd40c('0x7'))('servicenow');config[_0xd40c('0x8')]=_[_0xd40c('0x9')](config[_0xd40c('0x8')],{'host':_0xd40c('0xa'),'port':0x18eb});var io=require(_0xd40c('0xb'))(new Redis(config[_0xd40c('0x8')]));function getAdminUser(_0x44279c,_0x211988,_0x1faf4a,_0x5c10ed,_0x214275,_0x586a18){return new Promise(function(_0x14bec6,_0x3a8593){var _0x496998={'method':'GET','uri':_0x5c10ed+_0xd40c('0xc')+'&'+_0x214275+'&'+_0x586a18,'auth':_0x211988,'json':!![]};return rp(_0x496998)[_0xd40c('0xd')](function(_0x470a27){if(_0x470a27[_0xd40c('0xe')][_0xd40c('0xf')]>0x0){_0x1faf4a[_0xd40c('0x10')]=_0x470a27[_0xd40c('0xe')][0x0]['sys_id'];}logger[_0xd40c('0x11')]('['+[_0x44279c[_0xd40c('0x12')]()]+_0xd40c('0x13'),_0x1faf4a);_0x14bec6(_0x1faf4a);})[_0xd40c('0x14')](function(_0x2f1ed4){logger[_0xd40c('0x15')]('['+[_0x44279c[_0xd40c('0x12')]()]+']',_0x2f1ed4[_0xd40c('0x16')]);_0x3a8593(_0x2f1ed4[_0xd40c('0x16')]);});});}function getUser(_0x4a988e,_0x3d477d,_0x2ba1c2,_0x2ca236,_0x8034ef){return function(_0xcd5613){logger[_0xd40c('0x11')]('['+[_0x4a988e[_0xd40c('0x12')]()]+_0xd40c('0x17'),_0xcd5613);return new Promise(function(_0x378bf0,_0x240eb8){if(intUtil[_0xd40c('0x18')](_0xcd5613[_0xd40c('0x19')])){var _0x1f8a96={'method':_0xd40c('0x1a'),'uri':_0x2ba1c2+_0xd40c('0x1b')+_0xcd5613['userEmail']+'&'+_0x2ca236+'&'+_0x8034ef,'auth':_0x3d477d,'json':!![]};logger[_0xd40c('0x11')]('['+[_0x4a988e[_0xd40c('0x12')]()]+_0xd40c('0x1c'),_0x1f8a96);return rp(_0x1f8a96)[_0xd40c('0xd')](function(_0x46c943){logger[_0xd40c('0x11')]('['+[_0x4a988e[_0xd40c('0x12')]()]+_0xd40c('0x1d'),_0x46c943);if(_0x46c943[_0xd40c('0xe')][_0xd40c('0xf')]>0x0&&String(_0x46c943[_0xd40c('0xe')][0x0][_0xd40c('0x1e')])===_0xd40c('0x1f')){_0xcd5613[_0xd40c('0x20')]=_0x46c943[_0xd40c('0xe')][0x0][_0xd40c('0x21')];}else{_0xcd5613['userId']=_0xcd5613['adminId'];_0xcd5613[_0xd40c('0x19')]=_0xcd5613[_0xd40c('0x22')];}logger[_0xd40c('0x11')]('['+[_0x4a988e[_0xd40c('0x12')]()]+_0xd40c('0x23'),_0xcd5613);_0x378bf0(_0xcd5613);})[_0xd40c('0x14')](function(_0x47f72b){logger[_0xd40c('0x15')]('['+[_0x4a988e['toUpperCase']()]+']',_0x47f72b[_0xd40c('0x16')]);_0x240eb8(_0x47f72b[_0xd40c('0x16')]);});}else{logger['info']('['+[_0x4a988e[_0xd40c('0x12')]()]+_0xd40c('0x24'));_0xcd5613[_0xd40c('0x20')]=_0xcd5613['adminId'];_0xcd5613[_0xd40c('0x19')]=_0xcd5613[_0xd40c('0x22')];_0x378bf0(_0xcd5613);}});};}function createEndUser(_0x537f51,_0x4d3e6d,_0x53b1f7,_0x5b0e3b,_0x249d8a){logger[_0xd40c('0x11')]('['+[_0x537f51[_0xd40c('0x12')]()]+_0xd40c('0x25'),_0x53b1f7);return new Promise(function(_0x3130fb,_0x4243d1){var _0x356bed={'method':_0xd40c('0x26'),'uri':_0x5b0e3b+_0xd40c('0x27')+_0x249d8a,'body':{'user_name':_0x53b1f7['endUserNumber'],'roles':'user','first_name':_0x53b1f7[_0xd40c('0x28')],'active':_0xd40c('0x1f'),'date_format':'System','phone':_0x53b1f7['endUserNumber']},'auth':_0x4d3e6d,'json':!![]};return rp(_0x356bed)[_0xd40c('0xd')](function(_0x4bc1bb){logger['info']('['+[_0x537f51[_0xd40c('0x12')]()]+'],\x20EndUser\x20schema',_0x4bc1bb[_0xd40c('0xe')]);_0x53b1f7[_0xd40c('0x29')]=_0x4bc1bb['result']['sys_id'];_0x3130fb(_0x53b1f7);})[_0xd40c('0x14')](function(_0x56638b){logger['error']('['+[_0x537f51[_0xd40c('0x12')]()]+']',_0x56638b['message']);_0x4243d1(_0x56638b['message']);});});}function getEndUser(_0x545780,_0x1a86e8,_0x17e768,_0x3db208,_0x586b37){return function(_0x2616db){logger[_0xd40c('0x11')]('['+[_0x545780[_0xd40c('0x12')]()]+_0xd40c('0x2a'),_0x2616db);return new Promise(function(_0x2d0bc7,_0x512f31){var _0xbbb399={'method':_0xd40c('0x1a'),'uri':_0x17e768+_0xd40c('0x2b')+_0x2616db[_0xd40c('0x28')]+'&'+_0x3db208+'&'+_0x586b37,'auth':_0x1a86e8,'json':!![]};return rp(_0xbbb399)[_0xd40c('0xd')](function(_0x23b99e){if(_0x23b99e[_0xd40c('0xe')]['length']>0x0){_0x2616db[_0xd40c('0x29')]=_0x23b99e['result'][0x0]['sys_id'];logger[_0xd40c('0x11')]('['+[_0x545780[_0xd40c('0x12')]()]+'],\x20getEndUser\x20crm',_0x2616db);_0x2d0bc7(_0x2616db);}else{return createEndUser(_0x545780,_0x1a86e8,_0x2616db,_0x17e768,_0x3db208)[_0xd40c('0xd')](function(_0x36600e){logger[_0xd40c('0x11')]('['+[_0x545780[_0xd40c('0x12')]()]+_0xd40c('0x2c'),_0x36600e);_0x2d0bc7(_0x36600e);});}})[_0xd40c('0x14')](function(_0x3bbcf1){logger[_0xd40c('0x15')]('['+[_0x545780['toUpperCase']()]+']',_0x3bbcf1['message']);_0x512f31(_0x3bbcf1[_0xd40c('0x16')]);});});};}function getCustomFields(_0x465fa7,_0x5e0aad){var _0xb07b5d={};if(_0x465fa7['length']>0x0){_[_0xd40c('0x2d')](_0x465fa7,function(_0x15499e){if(_[_0xd40c('0x2e')]([_0xd40c('0x2f'),'picklist'],_0x15499e[_0xd40c('0x30')])&&_0x15499e[_0xd40c('0x31')]&&!_0x15499e[_0xd40c('0x32')]){_0xb07b5d[_0x15499e['nameField']['toLowerCase']()]=_0x15499e['content']['toString']();}else if(_[_0xd40c('0x2e')]([_0xd40c('0x2f'),'picklist'],_0x15499e[_0xd40c('0x30')])&&_0x15499e[_0xd40c('0x33')]&&_0x15499e[_0xd40c('0x32')]){_0xb07b5d[_0x15499e[_0xd40c('0x33')][_0xd40c('0x34')]()]=_0x15499e[_0xd40c('0x35')]['toString']();}else if(_0x15499e['type']===_0xd40c('0x36')&&_0x15499e['variableName']&&_0x15499e[_0xd40c('0x33')]&&_0x15499e['customField']){_0xb07b5d[_0x15499e['idField'][_0xd40c('0x34')]()]=_0x5e0aad[_0x15499e[_0xd40c('0x37')]][_0xd40c('0x38')]();}else if(_0x15499e['type']===_0xd40c('0x39')&&_0x15499e['Variable']&&_0x15499e['Variable']['name']&&_0x15499e[_0xd40c('0x33')]&&_0x15499e[_0xd40c('0x32')]){_0xb07b5d[_0x15499e['idField'][_0xd40c('0x34')]()]=_0x5e0aad[_0x15499e[_0xd40c('0x3a')]['name']['toLowerCase']()][_0xd40c('0x38')]();}});}return _0xb07b5d;}function getTicket(_0x52afe5,_0x501553,_0x4b4e5a,_0x1af6c2,_0x265ba6,_0x402e52){return function(_0x1fbf9f){logger[_0xd40c('0x11')]('['+[_0x52afe5[_0xd40c('0x12')]()]+_0xd40c('0x3b'),_0x1fbf9f);return new Promise(function(_0x3e3dba,_0x11b12f){var _0x454c3f=_0x52afe5['toLowerCase']()==='outbound'?_0x1fbf9f[_0xd40c('0x20')]:_0x1fbf9f['endUserId'];var _0x692f5f={'method':_0xd40c('0x26'),'uri':_0x4b4e5a+_0xd40c('0x3c')+'?'+_0x402e52,'body':Object[_0xd40c('0x3d')]({},{'active':_0xd40c('0x1f'),'caller_id':_0x454c3f,'assigned_to':_0x1fbf9f[_0xd40c('0x20')],'short_description':intUtil[_0xd40c('0x3e')](_0x1af6c2['Subjects'],_0x265ba6,'\x20'),'description':intUtil[_0xd40c('0x3e')](_0x1af6c2[_0xd40c('0x3f')],_0x265ba6,'\x0a')},getCustomFields(_0x1af6c2[_0xd40c('0x40')],_0x265ba6)),'auth':_0x501553,'json':!![]};return rp(_0x692f5f)[_0xd40c('0xd')](function(_0x2aa6c6){logger[_0xd40c('0x11')]('['+[_0x52afe5[_0xd40c('0x12')]()]+_0xd40c('0x41'),_0x2aa6c6[_0xd40c('0xe')]);_0x1fbf9f[_0xd40c('0x42')]=_0x2aa6c6[_0xd40c('0xe')][_0xd40c('0x21')];_0x1fbf9f[_0xd40c('0x43')]=_0x2aa6c6[_0xd40c('0xe')][_0xd40c('0x44')];logger[_0xd40c('0x11')]('['+[_0x52afe5[_0xd40c('0x12')]()]+_0xd40c('0x45'),_0x1fbf9f);_0x3e3dba(_0x1fbf9f);})[_0xd40c('0x14')](function(_0x120b3b){logger[_0xd40c('0x15')]('['+[_0x52afe5[_0xd40c('0x12')]()]+']',_0x120b3b[_0xd40c('0x16')]);_0x11b12f(_0x120b3b['message']);});});};}function createRemoteTag(_0x22188e,_0x43fc15,_0x455e3e,_0x42286b){return new Promise(function(_0x432322,_0x416a22){var _0x43743f={'method':_0xd40c('0x26'),'uri':_0x455e3e+_0xd40c('0x46')+'?'+_0x42286b,'body':{'short_description':_0x22188e,'global':!![],'active':!![],'name':_0x22188e},'auth':_0x43fc15,'json':!![]};return rp(_0x43743f)[_0xd40c('0xd')](function(_0x171710){var _0x5187d0=_0x171710[_0xd40c('0xe')][_0xd40c('0x21')];_0x432322(_0x5187d0);});});}function getRemoteTag(_0x28b855,_0x3d547f,_0x583072,_0x3cb1af,_0x4aebd0){return new Promise(function(_0xdbe3fd,_0x176832){var _0x1dd04c={'method':_0xd40c('0x1a'),'uri':_0x583072+_0xd40c('0x46')+_0xd40c('0x47')+_0x28b855+'&'+_0x3cb1af,'auth':_0x3d547f,'json':!![]};return rp(_0x1dd04c)['then'](function(_0x4f4343){if(_0x4f4343[_0xd40c('0xe')]['length']>0x0){var _0x52b090=_0x4f4343[_0xd40c('0xe')][0x0][_0xd40c('0x21')];_0xdbe3fd(_0x52b090);}else{return createRemoteTag(_0x28b855,_0x3d547f,_0x583072,_0x3cb1af)[_0xd40c('0xd')](function(_0x449da8){_0xdbe3fd(_0x449da8);});}});});}function assignTagToIncident(_0x4bee06,_0x54ef99,_0x254c48,_0xff9adb,_0x344455){return new Promise(function(_0x4403c0,_0xdf25ed){var _0x4a1453={'method':'POST','uri':_0x254c48+'label_entry'+'?'+_0x344455,'body':{'label':_0x4bee06,'table':'incident','id_type':'Incident','table_key':_0xff9adb[_0xd40c('0x42')],'title':_0xd40c('0x48')+_0xff9adb[_0xd40c('0x43')],'id_display':_0xff9adb['ticketNumber']},'auth':_0x54ef99,'json':!![]};return rp(_0x4a1453)[_0xd40c('0xd')](function(_0x51bb0e){_0x4403c0();})['catch'](function(){_0x4403c0();});});}function manageTags(_0xc52cac,_0x3de444,_0x1d4d78,_0x379c34,_0x6f89a8,_0x34410b,_0x2a9fd3){return new Promise(function(_0x382c97,_0x3ee306){var _0x37741e=[];_0x3de444[_0xd40c('0x2d')](function(_0x22418a){_0x37741e[_0xd40c('0x49')](getRemoteTag(_0x22418a,_0x1d4d78,_0x379c34,_0x34410b,_0x2a9fd3));});return Promise['all'](_0x37741e)['then'](function(_0xe2e2f5){if(_0xe2e2f5[_0xd40c('0xf')]){logger['info']('['+[_0xc52cac['toUpperCase']()]+_0xd40c('0x4a'),_0xe2e2f5);var _0x3cf923=[];_0xe2e2f5[_0xd40c('0x2d')](function(_0x40b329){_0x3cf923['push'](assignTagToIncident(_0x40b329,_0x1d4d78,_0x379c34,_0x6f89a8,_0x34410b));});return Promise[_0xd40c('0x4b')](_0x3cf923)[_0xd40c('0xd')](function(){_0x382c97();})[_0xd40c('0x14')](function(){_0x382c97();});}else{_0x382c97();}});});}function getTags(_0x44d5de,_0x48a489,_0x19c375,_0x7900a5,_0x2fe541,_0x21fdf0){return function(_0x2478c8){return new Promise(function(_0x457870,_0x542a1c){var _0x3b23ba=[];var _0x2098ea=_0x7900a5[_0xd40c('0x4c')];if(_0x2098ea&&_0x2098ea['length']>0x0){_0x3b23ba=_['map'](_0x2098ea,_0xd40c('0x4d'));}if(_0x3b23ba[_0xd40c('0xf')]>0x0){return manageTags(_0x44d5de,_0x3b23ba,_0x48a489,_0x19c375,_0x2478c8,_0x2fe541,_0x21fdf0)[_0xd40c('0xd')](function(){_0x457870(_0x2478c8);});}else{_0x457870(_0x2478c8);}});};}function emit(_0x3ca655,_0x43aeb7,_0x4559b9){var _0x40e8ad='%26sysparm_record_target%3Dincident'+_0xd40c('0x4e')+_0xd40c('0x4f')+_0xd40c('0x50');var _0x532326={'uri':_0x3ca655+_0xd40c('0x51')+_0x4559b9+_0x40e8ad};io['to'](util[_0xd40c('0x52')](_0xd40c('0x53'),_0x43aeb7))[_0xd40c('0x54')]('trigger:browser:url',_0x532326);}exports['cs']=function(_0xafe3cb,_0x1f846c,_0x3df088,_0x246a0e,_0x45d95e,_0x29c2e6,_0x4469da,_0x32d661){var _0x12c6f1={};var _0x36de8e={'user':_0x29c2e6[_0xd40c('0x55')],'pass':_0x29c2e6[_0xd40c('0x56')]};var _0x1347a4='sysparm_limit=1';var _0x243d42=_0xd40c('0x57');_0x29c2e6['remoteUri']=intUtil[_0xd40c('0x58')](_0x29c2e6[_0xd40c('0x59')]);_0x29c2e6[_0xd40c('0x5a')]=intUtil['stripTrailingSlash'](_0x29c2e6['serverUrl']);var _0xfff6e5=util['format'](_0xd40c('0x5b'),_0x29c2e6[_0xd40c('0x59')]);_0x12c6f1[_0xd40c('0x19')]=!_[_0xd40c('0x5c')](_0x246a0e)?_0x246a0e[_0xd40c('0x5d')]:null;_0x12c6f1[_0xd40c('0x22')]=_0x29c2e6[_0xd40c('0x5d')];_0x12c6f1['endUserNumber']=_0x32d661['toLowerCase']()===_0xd40c('0x5e')?_0x1f846c['destcalleridnum']:_0x1f846c[_0xd40c('0x5f')];_0x12c6f1[_0xd40c('0x60')]=_0x32d661==='queue'||_0x32d661===_0xd40c('0x61')?_0xd40c('0x62'):'outbound';var _0xc053a6=util[_0xd40c('0x52')](_0xd40c('0x63'),_0x29c2e6[_0xd40c('0x5a')],_0x1f846c[_0xd40c('0x64')],md5(_0x1f846c[_0xd40c('0x64')]));if(_0x45d95e&&_0x45d95e['monitor_format']){logger['info'](_0xd40c('0x65'),_0xd40c('0x66'));_0x1f846c[_0xd40c('0x67')]=_0xc053a6;}else if(_0x4469da&&_0x4469da[_0xd40c('0x68')]&&_0x4469da[_0xd40c('0x68')]!==_0xd40c('0x69')){logger[_0xd40c('0x11')](_0xd40c('0x6a'),'Recording\x20is\x20enabled!');_0x1f846c[_0xd40c('0x67')]=_0xc053a6;}else{_0x1f846c[_0xd40c('0x67')]='';}return getAdminUser(_0x32d661,_0x36de8e,_0x12c6f1,_0xfff6e5,_0x243d42,_0x1347a4)[_0xd40c('0xd')](getUser(_0x32d661,_0x36de8e,_0xfff6e5,_0x243d42,_0x1347a4))[_0xd40c('0xd')](getEndUser(_0x32d661,_0x36de8e,_0xfff6e5,_0x243d42,_0x1347a4))[_0xd40c('0xd')](getTicket(_0x32d661,_0x36de8e,_0xfff6e5,_0x3df088,_0x1f846c,_0x243d42))[_0xd40c('0xd')](function(_0x4cf2db){logger['info'](util['format'](_0xd40c('0x6b'),_0x4cf2db[_0xd40c('0x42')]));logger[_0xd40c('0x11')](util['format'](_0xd40c('0x6c'),_0x32d661));if(_0x32d661!==_0xd40c('0x61')){logger[_0xd40c('0x11')]('['+[_0x32d661[_0xd40c('0x12')]()]+']',_0xd40c('0x6d'));emit(_0x29c2e6[_0xd40c('0x59')],_0x246a0e[_0xd40c('0x4d')],_0x4cf2db[_0xd40c('0x42')]);}})[_0xd40c('0x14')](function(_0x50263f){logger['error']('['+[_0x32d661[_0xd40c('0x12')]()]+_0xd40c('0x6e'),util[_0xd40c('0x6f')](_0x50263f,{'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 494ad32..d6ceef3 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 _0xac92=['trigger:browser:url','unmanaged','lastevent','toUpperCase','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','users','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','push','variableName','set_entry','JSON','stringify','Calls','format','Basic\x20%s','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','resolve','name_value_list','value','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','length','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','forEach','type','string','nameField','customField','content','idField','custom_fields','variable','customVariable','Variable','toLowerCase','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','queue','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','error','outbound','stripTrailingSlash','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Fields','Outbound','contacts','user:%s'];(function(_0x5de166,_0x27dfa8){var _0x42ec2=function(_0xbb6992){while(--_0xbb6992){_0x5de166['push'](_0x5de166['shift']());}};_0x42ec2(++_0x27dfa8);}(_0xac92,0x87));var _0x2ac9=function(_0x34ba74,_0x3edaa0){_0x34ba74=_0x34ba74-0x0;var _0x8c1e73=_0xac92[_0x34ba74];return _0x8c1e73;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require('bluebird');var md5=require(_0x2ac9('0x0'));var util=require(_0x2ac9('0x1'));var Redis=require(_0x2ac9('0x2'));var intUtil=require(_0x2ac9('0x3'));var config=require(_0x2ac9('0x4'));var logger=require(_0x2ac9('0x5'))(_0x2ac9('0x6'));config[_0x2ac9('0x7')]=_['defaults'](config[_0x2ac9('0x7')],{'host':_0x2ac9('0x8'),'port':0x18eb});var io=require(_0x2ac9('0x9'))(new Redis(config[_0x2ac9('0x7')]));var def={'method':_0x2ac9('0xa'),'json':!![]};function emit(_0x4506d8,_0x1851cc,_0xd529ee){io['to'](_0x4506d8)[_0x2ac9('0xb')](_0x1851cc,_0xd529ee);}function getTicket(_0x4de42c,_0x23044f,_0x577c9c,_0x4cc795,_0x20a581,_0x5d163d,_0x504c01,_0x731b03){logger[_0x2ac9('0xc')](_0x2ac9('0xd'));var _0x4e776c=new Date();var _0x2c25bf=[{'name':_0x2ac9('0xe'),'value':intUtil[_0x2ac9('0xf')](_0x4cc795[_0x2ac9('0x10')],_0x20a581,'\x20')},{'name':'assigned_user_id','value':_0x23044f['id']},{'name':_0x2ac9('0x11'),'value':_0x23044f['id']},{'name':_0x2ac9('0x12'),'value':intUtil['getString'](_0x4cc795[_0x2ac9('0x13')],_0x20a581,'\x0a')},{'name':_0x2ac9('0x14'),'value':_0x4e776c[_0x2ac9('0x15')]()[_0x2ac9('0x16')](0x0,0x13)[_0x2ac9('0x17')]('T','\x20')},{'name':_0x2ac9('0x18'),'value':'0'},{'name':_0x2ac9('0x19'),'value':'15'},{'name':_0x2ac9('0x1a'),'value':_0x577c9c['id']},{'name':_0x2ac9('0x1b'),'value':'Contacts'},{'name':_0x2ac9('0x1c'),'value':_0x577c9c[_0x2ac9('0xe')]},{'name':_0x2ac9('0x1d'),'value':_0x731b03}];if(_0x5d163d['length']){_['forEach'](_0x5d163d,function(_0x29690a){if(_0x20a581[_0x29690a['variableName']]){_0x2c25bf[_0x2ac9('0x1e')]({'name':_0x29690a['idField'],'value':_0x20a581[_0x29690a[_0x2ac9('0x1f')]]});}});}return request({'form':{'method':_0x2ac9('0x20'),'input_type':_0x2ac9('0x21'),'response_type':_0x2ac9('0x21'),'rest_data':JSON[_0x2ac9('0x22')]({'session':_0x504c01['id'],'module_name':_0x2ac9('0x23'),'name_value_list':_0x2c25bf})}});}function getAuth(_0x57f90e){return util[_0x2ac9('0x24')](_0x2ac9('0x25'),new Buffer(_0x57f90e['apiKey']+':X')[_0x2ac9('0x26')](_0x2ac9('0x27')));}function getServerInfo(_0x55cc91){return request({'form':{'method':_0x2ac9('0x28'),'input_type':'JSON','response_type':_0x2ac9('0x21'),'rest_data':JSON[_0x2ac9('0x22')]({'session':_0x55cc91['id']})}});}function getUser(_0x38edaa,_0x41dad6,_0x9a7078){if(!_[_0x2ac9('0x29')](_0x41dad6)){logger[_0x2ac9('0xc')](_0x2ac9('0x2a'),_0x41dad6);return request({'form':{'method':_0x2ac9('0x2b'),'input_type':_0x2ac9('0x21'),'response_type':'JSON','rest_data':JSON[_0x2ac9('0x22')]({'session':_0x9a7078['id'],'module_name':_0x2ac9('0x2c'),'query':util['format'](_0x2ac9('0x2d'),_0x41dad6),'order_by':'','offset':'0','select_fields':['id',_0x2ac9('0xe'),_0x2ac9('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x2ac9('0x2f')](function(_0x126fc3){if(_0x126fc3[_0x2ac9('0x30')]['length']){var _0x3d2946=_['find'](_0x126fc3[_0x2ac9('0x30')],function(_0x1e6114){return _0x1e6114['name_value_list'][_0x2ac9('0x2e')]['value']===_0x41dad6;});if(_0x3d2946){logger[_0x2ac9('0xc')]('Agent\x20found!');return BPromise[_0x2ac9('0x31')]({'id':_0x3d2946[_0x2ac9('0x32')]['id']['value'],'name':_0x3d2946['name_value_list'][_0x2ac9('0xe')][_0x2ac9('0x33')]});}}logger[_0x2ac9('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x2ac9('0x31')]({'id':_0x9a7078[_0x2ac9('0x32')]['user_id'][_0x2ac9('0x33')],'name':_0x9a7078['name_value_list'][_0x2ac9('0x2e')][_0x2ac9('0x33')]});});}else{logger[_0x2ac9('0xc')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x2ac9('0x31')]({'id':_0x9a7078['name_value_list'][_0x2ac9('0x34')]['value'],'name':_0x9a7078[_0x2ac9('0x32')][_0x2ac9('0x2e')]['value']});}}function getEndUser(_0x2b0933,_0x8a61aa,_0x5a6657,_0x1e22bc){logger[_0x2ac9('0xc')](_0x2ac9('0x35'),_0x5a6657);return request({'form':{'method':_0x2ac9('0x2b'),'input_type':_0x2ac9('0x21'),'response_type':_0x2ac9('0x21'),'rest_data':JSON[_0x2ac9('0x22')]({'session':_0x1e22bc['id'],'module_name':'Contacts','query':util['format'](_0x2ac9('0x36'),_0x5a6657),'order_by':'','offset':'0','select_fields':['id','name',_0x2ac9('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x2ac9('0x2f')](function(_0x3c553e){if(_0x3c553e['entry_list'][_0x2ac9('0x38')]){var _0x7488a3=_[_0x2ac9('0x39')](_0x3c553e[_0x2ac9('0x30')],function(_0x5512f4){return _0x5512f4[_0x2ac9('0x32')][_0x2ac9('0x37')][_0x2ac9('0x33')]===_0x5a6657;});if(_0x7488a3){logger['info'](_0x2ac9('0x3a'));return BPromise[_0x2ac9('0x31')]({'id':_0x7488a3['name_value_list']['id'][_0x2ac9('0x33')],'name':_0x7488a3[_0x2ac9('0x32')][_0x2ac9('0xe')]['value'],'phone':_0x7488a3[_0x2ac9('0x32')][_0x2ac9('0x37')][_0x2ac9('0x33')]});}}else{logger[_0x2ac9('0xc')](_0x2ac9('0x3b'));return request({'form':{'method':_0x2ac9('0x20'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x2ac9('0x22')]({'session':_0x1e22bc['id'],'module_name':_0x2ac9('0x3c'),'name_value_list':[{'name':_0x2ac9('0x3d'),'value':_0x8a61aa!==_0x2ac9('0x3e')?_0x8a61aa:util[_0x2ac9('0x24')](_0x2ac9('0x3f'),_0x5a6657)},{'name':_0x2ac9('0x37'),'value':_0x5a6657}]})}})[_0x2ac9('0x2f')](function(_0x87db74){logger[_0x2ac9('0xc')](_0x2ac9('0x40'));return BPromise[_0x2ac9('0x31')]({'id':_0x87db74['id'],'name':_0x87db74[_0x2ac9('0x30')][_0x2ac9('0x3d')][_0x2ac9('0x33')],'phone':_0x87db74[_0x2ac9('0x30')][_0x2ac9('0x37')][_0x2ac9('0x33')]});});}});}function request(_0x134378){logger[_0x2ac9('0x41')](_0x2ac9('0x42'),JSON[_0x2ac9('0x22')](_0x134378));return rp(_['merge'](def,_0x134378));}function getTags(_0x2f5848,_0x14958c){var _0xc6a4b8=[];if(_0x2f5848&&_0x2f5848[_0x2ac9('0x38')]>0x0){_0xc6a4b8=_['map'](_0x2f5848,_0x14958c);}return _0xc6a4b8;}function getCustomFields(_0x27563c,_0x133fbc){var _0x43c5c3=[];var _0x321f16={'custom_fields':[]};if(_0x27563c['length']>0x0){_[_0x2ac9('0x43')](_0x27563c,function(_0x5ced8b){if(_0x5ced8b[_0x2ac9('0x44')]===_0x2ac9('0x45')&&_0x5ced8b[_0x2ac9('0x46')]&&!_0x5ced8b[_0x2ac9('0x47')]){_0x321f16[_0x5ced8b[_0x2ac9('0x46')]['toLowerCase']()]=_0x5ced8b[_0x2ac9('0x48')][_0x2ac9('0x26')]();}else if(_0x5ced8b[_0x2ac9('0x44')]===_0x2ac9('0x45')&&_0x5ced8b[_0x2ac9('0x49')]&&_0x5ced8b['customField']){_0x321f16[_0x2ac9('0x4a')]['push']({'id':_0x5ced8b[_0x2ac9('0x49')],'value':_0x5ced8b['content'][_0x2ac9('0x26')]()});}else if(_0x5ced8b[_0x2ac9('0x44')]===_0x2ac9('0x4b')&&_0x5ced8b['variableName']&&_0x5ced8b[_0x2ac9('0x49')]&&_0x5ced8b[_0x2ac9('0x47')]){_0x133fbc[_0x5ced8b[_0x2ac9('0x1f')]]&&_0x321f16[_0x2ac9('0x4a')][_0x2ac9('0x1e')]({'id':_0x5ced8b[_0x2ac9('0x49')],'value':_0x133fbc[_0x5ced8b[_0x2ac9('0x1f')]][_0x2ac9('0x26')]()});}else if(_0x5ced8b[_0x2ac9('0x44')]===_0x2ac9('0x4c')&&_0x5ced8b['Variable']&&_0x5ced8b[_0x2ac9('0x4d')][_0x2ac9('0xe')]&&_0x5ced8b[_0x2ac9('0x49')]&&_0x5ced8b[_0x2ac9('0x47')]){_0x133fbc[_0x5ced8b[_0x2ac9('0x4d')][_0x2ac9('0xe')][_0x2ac9('0x4e')]()]&&_0x321f16[_0x2ac9('0x4a')][_0x2ac9('0x1e')]({'id':_0x5ced8b[_0x2ac9('0x49')],'value':_0x133fbc[_0x5ced8b[_0x2ac9('0x4d')][_0x2ac9('0xe')][_0x2ac9('0x4e')]()][_0x2ac9('0x26')]()});}});}return _0x321f16;}function getConnection(_0x68bf41){return request({'method':_0x2ac9('0xa'),'form':{'method':_0x2ac9('0x4f'),'input_type':_0x2ac9('0x21'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x68bf41[_0x2ac9('0x50')],'password':_0x68bf41[_0x2ac9('0x51')],'encryption':_0x2ac9('0x52')},'application':_0x2ac9('0x53')})}})[_0x2ac9('0x2f')](function(_0x48c93d){var _0xa1b75b=_0x48c93d;if(_0xa1b75b['id']){def[_0x2ac9('0x54')]=_0xa1b75b['id'];return BPromise[_0x2ac9('0x31')](_0xa1b75b);}else{throw new Error(util[_0x2ac9('0x24')]('Account\x20%d\x20is\x20not\x20valid',_0x68bf41['id']));}});}function setRelationship(_0xdb3c6b,_0x8b5bde,_0x496a50,_0x252e26){return request({'form':{'method':_0x2ac9('0x55'),'input_type':_0x2ac9('0x21'),'response_type':_0x2ac9('0x21'),'rest_data':JSON['stringify']({'session':_0xdb3c6b['id'],'module_name':_0x2ac9('0x23'),'module_id':_0x496a50['id'],'link_field_name':_0x252e26,'related_ids':[_0x8b5bde['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x2ac9('0x56')]=function(_0x23dd41,_0x21cbcb,_0x3b670a,_0x3970da,_0x32abe0,_0x25e515){var _0xd5906,_0x12b721,_0x31b91e,_0x9ace8c;_0x25e515[_0x2ac9('0x57')]=intUtil['stripTrailingSlash'](_0x25e515[_0x2ac9('0x57')]);_0x25e515[_0x2ac9('0x58')]=intUtil['stripTrailingSlash'](_0x25e515[_0x2ac9('0x58')]);def[_0x2ac9('0x59')]=util['format'](_0x2ac9('0x5a'),_0x25e515[_0x2ac9('0x57')]);if(_0x32abe0&&_0x32abe0[_0x2ac9('0x5b')]){logger[_0x2ac9('0xc')](_0x2ac9('0x5c'),_0x2ac9('0x5d'));_0x21cbcb[_0x2ac9('0x5e')]=util[_0x2ac9('0x24')](_0x2ac9('0x5f'),_0x25e515[_0x2ac9('0x58')],_0x21cbcb[_0x2ac9('0x60')],md5(_0x21cbcb[_0x2ac9('0x60')]));}else{_0x21cbcb[_0x2ac9('0x5e')]='';}return getConnection(_0x25e515)[_0x2ac9('0x2f')](function(_0x2d209d){_0x9ace8c=_0x2d209d;return getUser(_0x25e515,_0x3970da[_0x2ac9('0xe')],_0x9ace8c);})['then'](function(_0x3fd80d){_0xd5906=_0x3fd80d;logger[_0x2ac9('0xc')]('The\x20User\x20ID\x20is:',_0xd5906['id']);return getEndUser(_0x25e515,_0x21cbcb['calleridname'],_0x21cbcb['calleridnum'],_0x9ace8c);})['then'](function(_0x58cf49){_0x12b721=_0x58cf49;logger[_0x2ac9('0xc')]('The\x20Enduser\x20ID\x20is:',_0x12b721['id']);return getTicket(_0x25e515,_0xd5906,_0x12b721,_0x3b670a,_0x21cbcb,_0x3b670a['Fields'],_0x9ace8c,'Inbound');})[_0x2ac9('0x2f')](function(_0x3bf871){_0x31b91e=_0x3bf871;logger[_0x2ac9('0xc')](_0x2ac9('0x61'));logger[_0x2ac9('0xc')](_0x2ac9('0x62'),_0x31b91e['id']);return setRelationship(_0x9ace8c,_0xd5906,_0x31b91e,'users');})[_0x2ac9('0x2f')](function(){return setRelationship(_0x9ace8c,_0x12b721,_0x31b91e,'contacts');})[_0x2ac9('0x2f')](function(){return getServerInfo(_0x9ace8c);})[_0x2ac9('0x2f')](function(_0x1999c0){var _0x36cbd9=parseInt(_0x1999c0[_0x2ac9('0x63')][_0x2ac9('0x64')](0x0));var _0x3bd182=util['format'](_0x2ac9('0x65'),_0x25e515[_0x2ac9('0x57')],_0x31b91e['id']);if(_0x36cbd9>0x6){_0x3bd182=util['format'](_0x2ac9('0x66'),_0x25e515['remoteUri'],_0x31b91e['id']);}logger[_0x2ac9('0xc')](_0x2ac9('0x5c'),_0x2ac9('0x67'));emit(util[_0x2ac9('0x24')]('user:%s',_0x3970da[_0x2ac9('0xe')]),'trigger:browser:url',{'uri':_0x3bd182});})[_0x2ac9('0x68')](function(_0xf2c286){logger[_0x2ac9('0x69')](_0x2ac9('0x5c'),JSON[_0x2ac9('0x22')](_0xf2c286));});};exports[_0x2ac9('0x6a')]=function(_0x3c97cb,_0x37b4dc,_0xd05342,_0x360efd,_0x335cb4,_0x5cb24d,_0x41dff1){var _0xe22f67,_0x4a41ba,_0x38dd29,_0xab134;_0x5cb24d['remoteUri']=intUtil['stripTrailingSlash'](_0x5cb24d[_0x2ac9('0x57')]);_0x5cb24d[_0x2ac9('0x58')]=intUtil[_0x2ac9('0x6b')](_0x5cb24d[_0x2ac9('0x58')]);def[_0x2ac9('0x59')]=util[_0x2ac9('0x24')](_0x2ac9('0x5a'),_0x5cb24d[_0x2ac9('0x57')]);if(_0x41dff1&&_0x41dff1['recordingFormat']&&_0x41dff1['recordingFormat']!==_0x2ac9('0x6c')){logger[_0x2ac9('0xc')](_0x2ac9('0x6d'),'Recording\x20is\x20enabled!');_0x37b4dc[_0x2ac9('0x5e')]=util[_0x2ac9('0x24')](_0x2ac9('0x5f'),_0x5cb24d[_0x2ac9('0x58')],_0x37b4dc[_0x2ac9('0x60')],md5(_0x37b4dc[_0x2ac9('0x60')]));}return getConnection(_0x5cb24d)[_0x2ac9('0x2f')](function(_0x42b028){_0xab134=_0x42b028;return getUser(_0x5cb24d,_0x360efd['name'],_0xab134);})['then'](function(_0xb48eb1){_0xe22f67=_0xb48eb1;logger['info']('The\x20User\x20ID\x20is:',_0xe22f67['id']);return getEndUser(_0x5cb24d,_0x37b4dc[_0x2ac9('0x6e')],_0x37b4dc[_0x2ac9('0x6f')],_0xab134);})[_0x2ac9('0x2f')](function(_0x476285){_0x4a41ba=_0x476285;logger[_0x2ac9('0xc')](_0x2ac9('0x70'),_0x4a41ba['id']);return getTicket(_0x5cb24d,_0xe22f67,_0x4a41ba,_0xd05342,_0x37b4dc,_0xd05342[_0x2ac9('0x71')],_0xab134,_0x2ac9('0x72'));})[_0x2ac9('0x2f')](function(_0x490655){_0x38dd29=_0x490655;logger['info']('Ticket\x20created!');logger[_0x2ac9('0xc')](_0x2ac9('0x62'),_0x38dd29['id']);return setRelationship(_0xab134,_0xe22f67,_0x38dd29,'users');})[_0x2ac9('0x2f')](function(){return setRelationship(_0xab134,_0x4a41ba,_0x38dd29,_0x2ac9('0x73'));})[_0x2ac9('0x2f')](function(){return getServerInfo(_0xab134);})['then'](function(_0xb4c083){var _0x499843=parseInt(_0xb4c083[_0x2ac9('0x63')][_0x2ac9('0x64')](0x0));var _0x5ad97c=util[_0x2ac9('0x24')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x5cb24d['remoteUri'],_0x38dd29['id']);if(_0x499843>0x6){_0x5ad97c=util[_0x2ac9('0x24')](_0x2ac9('0x66'),_0x5cb24d[_0x2ac9('0x57')],_0x38dd29['id']);}logger[_0x2ac9('0xc')](_0x2ac9('0x6d'),_0x2ac9('0x67'));emit(util[_0x2ac9('0x24')](_0x2ac9('0x74'),_0x360efd[_0x2ac9('0xe')]),_0x2ac9('0x75'),{'uri':_0x5ad97c});})[_0x2ac9('0x68')](function(_0xae1535){logger['error'](_0x2ac9('0x6d'),JSON['stringify'](_0xae1535));});};exports[_0x2ac9('0x76')]=function(_0x262582,_0x1120da,_0xe430fc,_0x3ccb48,_0x45e551,_0x118e87){var _0x3b0579,_0x55d7a3,_0x3c909f,_0x5337c5;_0x118e87[_0x2ac9('0x57')]=intUtil['stripTrailingSlash'](_0x118e87[_0x2ac9('0x57')]);_0x118e87[_0x2ac9('0x58')]=intUtil[_0x2ac9('0x6b')](_0x118e87[_0x2ac9('0x58')]);def[_0x2ac9('0x59')]=util[_0x2ac9('0x24')](_0x2ac9('0x5a'),_0x118e87[_0x2ac9('0x57')]);if(_0x45e551&&_0x45e551['monitor_format']){logger[_0x2ac9('0xc')]('['+_0x1120da[_0x2ac9('0x77')][_0x2ac9('0x78')]()+']','Recording\x20is\x20enabled!');_0x1120da[_0x2ac9('0x5e')]=util[_0x2ac9('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x118e87[_0x2ac9('0x58')],_0x1120da['uniqueid'],md5(_0x1120da[_0x2ac9('0x60')]));}else{_0x1120da[_0x2ac9('0x5e')]='';}return getConnection(_0x118e87)[_0x2ac9('0x2f')](function(_0x11da77){_0x5337c5=_0x11da77;if(!_[_0x2ac9('0x29')](_0x3ccb48)){return getUser(_0x118e87,_0x3ccb48[_0x2ac9('0xe')],_0x5337c5);}else{return getUser(_0x118e87,null,_0x5337c5);}})[_0x2ac9('0x2f')](function(_0x5ea3fc){_0x3b0579=_0x5ea3fc;logger[_0x2ac9('0xc')](_0x2ac9('0x79'),_0x3b0579['id']);return getEndUser(_0x118e87,_0x1120da[_0x2ac9('0x7a')],_0x1120da[_0x2ac9('0x7b')],_0x5337c5);})['then'](function(_0x3a6601){_0x55d7a3=_0x3a6601;logger[_0x2ac9('0xc')](_0x2ac9('0x70'),_0x55d7a3['id']);return getTicket(_0x118e87,_0x3b0579,_0x55d7a3,_0xe430fc,_0x1120da,_0xe430fc['Fields'],_0x5337c5,_0x2ac9('0x7c'));})[_0x2ac9('0x2f')](function(_0x24b082){_0x3c909f=_0x24b082;logger['info']('Ticket\x20created!');logger[_0x2ac9('0xc')](_0x2ac9('0x62'),_0x3c909f['id']);return setRelationship(_0x5337c5,_0x3b0579,_0x3c909f,_0x2ac9('0x7d'));})[_0x2ac9('0x2f')](function(){return setRelationship(_0x5337c5,_0x55d7a3,_0x3c909f,_0x2ac9('0x73'));})[_0x2ac9('0x2f')](function(){return getServerInfo(_0x5337c5);})[_0x2ac9('0x68')](function(_0x10ba7f){logger[_0x2ac9('0x69')]('['+_0x1120da['lastevent']['toUpperCase']()+']',JSON[_0x2ac9('0x22')](_0x10ba7f));});}; \ No newline at end of file +var _0x80b0=['uri','recordingFormat','none','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','user:%s','catch','unmanaged','lastevent','toUpperCase','Fields','lodash','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','POST','emit','Creating\x20new\x20ticket...','name','getString','assigned_user_id','created_by','Descriptions','toISOString','slice','replace','duration_hours','parent_type','Contacts','parent_name','direction','length','forEach','variableName','idField','set_entry','JSON','format','apiKey','toString','base64','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','user_name','then','entry_list','name_value_list','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','find','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','stringify','Caller\x20-\x20%s','Enduser\x20created.','first_name','[HTTP]','map','string','customField','nameField','toLowerCase','content','type','custom_fields','push','customVariable','Variable','username','password','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','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','trigger:browser:url','error','outbound'];(function(_0x569311,_0x122db9){var _0x1f8338=function(_0x4d3b85){while(--_0x4d3b85){_0x569311['push'](_0x569311['shift']());}};_0x1f8338(++_0x122db9);}(_0x80b0,0x83));var _0x080b=function(_0x58dc64,_0x952c6e){_0x58dc64=_0x58dc64-0x0;var _0x585a1d=_0x80b0[_0x58dc64];return _0x585a1d;};'use strict';var _=require(_0x080b('0x0'));var rp=require('request-promise');var BPromise=require(_0x080b('0x1'));var md5=require('md5');var util=require(_0x080b('0x2'));var Redis=require(_0x080b('0x3'));var intUtil=require(_0x080b('0x4'));var config=require(_0x080b('0x5'));var logger=require(_0x080b('0x6'))(_0x080b('0x7'));config[_0x080b('0x8')]=_[_0x080b('0x9')](config[_0x080b('0x8')],{'host':_0x080b('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x080b('0x8')]));var def={'method':_0x080b('0xb'),'json':!![]};function emit(_0x4abf0c,_0xaf8adf,_0x238520){io['to'](_0x4abf0c)[_0x080b('0xc')](_0xaf8adf,_0x238520);}function getTicket(_0x21e6f3,_0x31bb5d,_0x2c0c9a,_0xce5218,_0x2ac442,_0x58369c,_0x3f268a,_0x110f70){logger['info'](_0x080b('0xd'));var _0x3c1750=new Date();var _0x29fe5e=[{'name':_0x080b('0xe'),'value':intUtil[_0x080b('0xf')](_0xce5218['Subjects'],_0x2ac442,'\x20')},{'name':_0x080b('0x10'),'value':_0x31bb5d['id']},{'name':_0x080b('0x11'),'value':_0x31bb5d['id']},{'name':'description','value':intUtil[_0x080b('0xf')](_0xce5218[_0x080b('0x12')],_0x2ac442,'\x0a')},{'name':'date_start','value':_0x3c1750[_0x080b('0x13')]()[_0x080b('0x14')](0x0,0x13)[_0x080b('0x15')]('T','\x20')},{'name':_0x080b('0x16'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0x2c0c9a['id']},{'name':_0x080b('0x17'),'value':_0x080b('0x18')},{'name':_0x080b('0x19'),'value':_0x2c0c9a[_0x080b('0xe')]},{'name':_0x080b('0x1a'),'value':_0x110f70}];if(_0x58369c[_0x080b('0x1b')]){_[_0x080b('0x1c')](_0x58369c,function(_0x46bb18){if(_0x2ac442[_0x46bb18[_0x080b('0x1d')]]){_0x29fe5e['push']({'name':_0x46bb18[_0x080b('0x1e')],'value':_0x2ac442[_0x46bb18[_0x080b('0x1d')]]});}});}return request({'form':{'method':_0x080b('0x1f'),'input_type':_0x080b('0x20'),'response_type':_0x080b('0x20'),'rest_data':JSON['stringify']({'session':_0x3f268a['id'],'module_name':'Calls','name_value_list':_0x29fe5e})}});}function getAuth(_0xa75475){return util[_0x080b('0x21')]('Basic\x20%s',new Buffer(_0xa75475[_0x080b('0x22')]+':X')[_0x080b('0x23')](_0x080b('0x24')));}function getServerInfo(_0xcd2cf6){return request({'form':{'method':'get_server_info','input_type':'JSON','response_type':_0x080b('0x20'),'rest_data':JSON['stringify']({'session':_0xcd2cf6['id']})}});}function getUser(_0x1c88b8,_0x57c333,_0x1f1fe5){if(!_[_0x080b('0x25')](_0x57c333)){logger[_0x080b('0x26')](_0x080b('0x27'),_0x57c333);return request({'form':{'method':_0x080b('0x28'),'input_type':'JSON','response_type':_0x080b('0x20'),'rest_data':JSON['stringify']({'session':_0x1f1fe5['id'],'module_name':_0x080b('0x29'),'query':util['format']('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x57c333),'order_by':'','offset':'0','select_fields':['id',_0x080b('0xe'),_0x080b('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x080b('0x2b')](function(_0x450eff){if(_0x450eff[_0x080b('0x2c')][_0x080b('0x1b')]){var _0x43f3d8=_['find'](_0x450eff[_0x080b('0x2c')],function(_0x1c3a49){return _0x1c3a49[_0x080b('0x2d')][_0x080b('0x2a')][_0x080b('0x2e')]===_0x57c333;});if(_0x43f3d8){logger[_0x080b('0x26')](_0x080b('0x2f'));return BPromise[_0x080b('0x30')]({'id':_0x43f3d8[_0x080b('0x2d')]['id'][_0x080b('0x2e')],'name':_0x43f3d8[_0x080b('0x2d')][_0x080b('0xe')]['value']});}}logger[_0x080b('0x26')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x080b('0x30')]({'id':_0x1f1fe5[_0x080b('0x2d')][_0x080b('0x31')][_0x080b('0x2e')],'name':_0x1f1fe5[_0x080b('0x2d')][_0x080b('0x2a')][_0x080b('0x2e')]});});}else{logger[_0x080b('0x26')](_0x080b('0x32'));return BPromise[_0x080b('0x30')]({'id':_0x1f1fe5['name_value_list']['user_id'][_0x080b('0x2e')],'name':_0x1f1fe5['name_value_list'][_0x080b('0x2a')][_0x080b('0x2e')]});}}function getEndUser(_0x599945,_0x3b29c6,_0x56676a,_0x3759a0){logger[_0x080b('0x26')](_0x080b('0x33'),_0x56676a);return request({'form':{'method':_0x080b('0x28'),'input_type':_0x080b('0x20'),'response_type':_0x080b('0x20'),'rest_data':JSON['stringify']({'session':_0x3759a0['id'],'module_name':_0x080b('0x18'),'query':util[_0x080b('0x21')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x56676a),'order_by':'','offset':'0','select_fields':['id',_0x080b('0xe'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x26e67f){if(_0x26e67f[_0x080b('0x2c')][_0x080b('0x1b')]){var _0x5b2570=_[_0x080b('0x34')](_0x26e67f[_0x080b('0x2c')],function(_0x249d5e){return _0x249d5e[_0x080b('0x2d')][_0x080b('0x35')][_0x080b('0x2e')]===_0x56676a;});if(_0x5b2570){logger[_0x080b('0x26')](_0x080b('0x36'));return BPromise[_0x080b('0x30')]({'id':_0x5b2570[_0x080b('0x2d')]['id'][_0x080b('0x2e')],'name':_0x5b2570[_0x080b('0x2d')][_0x080b('0xe')][_0x080b('0x2e')],'phone':_0x5b2570[_0x080b('0x2d')]['phone_home'][_0x080b('0x2e')]});}}else{logger[_0x080b('0x26')](_0x080b('0x37'));return request({'form':{'method':_0x080b('0x1f'),'input_type':_0x080b('0x20'),'response_type':_0x080b('0x20'),'rest_data':JSON[_0x080b('0x38')]({'session':_0x3759a0['id'],'module_name':'Contacts','name_value_list':[{'name':'first_name','value':_0x3b29c6!==''?_0x3b29c6:util['format'](_0x080b('0x39'),_0x56676a)},{'name':_0x080b('0x35'),'value':_0x56676a}]})}})[_0x080b('0x2b')](function(_0x141896){logger[_0x080b('0x26')](_0x080b('0x3a'));return BPromise[_0x080b('0x30')]({'id':_0x141896['id'],'name':_0x141896[_0x080b('0x2c')][_0x080b('0x3b')][_0x080b('0x2e')],'phone':_0x141896['entry_list'][_0x080b('0x35')][_0x080b('0x2e')]});});}});}function request(_0x201716){logger['debug'](_0x080b('0x3c'),JSON[_0x080b('0x38')](_0x201716));return rp(_['merge'](def,_0x201716));}function getTags(_0x25822d,_0x123fd8){var _0x113ce6=[];if(_0x25822d&&_0x25822d['length']>0x0){_0x113ce6=_[_0x080b('0x3d')](_0x25822d,_0x123fd8);}return _0x113ce6;}function getCustomFields(_0x403c44,_0x4b387e){var _0x5f18d9=[];var _0xd973fd={'custom_fields':[]};if(_0x403c44[_0x080b('0x1b')]>0x0){_[_0x080b('0x1c')](_0x403c44,function(_0x59a60b){if(_0x59a60b['type']===_0x080b('0x3e')&&_0x59a60b['nameField']&&!_0x59a60b[_0x080b('0x3f')]){_0xd973fd[_0x59a60b[_0x080b('0x40')][_0x080b('0x41')]()]=_0x59a60b[_0x080b('0x42')][_0x080b('0x23')]();}else if(_0x59a60b['type']==='string'&&_0x59a60b[_0x080b('0x1e')]&&_0x59a60b[_0x080b('0x3f')]){_0xd973fd['custom_fields']['push']({'id':_0x59a60b['idField'],'value':_0x59a60b[_0x080b('0x42')]['toString']()});}else if(_0x59a60b[_0x080b('0x43')]==='variable'&&_0x59a60b[_0x080b('0x1d')]&&_0x59a60b['idField']&&_0x59a60b[_0x080b('0x3f')]){_0x4b387e[_0x59a60b[_0x080b('0x1d')]]&&_0xd973fd[_0x080b('0x44')][_0x080b('0x45')]({'id':_0x59a60b[_0x080b('0x1e')],'value':_0x4b387e[_0x59a60b[_0x080b('0x1d')]][_0x080b('0x23')]()});}else if(_0x59a60b['type']===_0x080b('0x46')&&_0x59a60b['Variable']&&_0x59a60b[_0x080b('0x47')]['name']&&_0x59a60b['idField']&&_0x59a60b['customField']){_0x4b387e[_0x59a60b[_0x080b('0x47')][_0x080b('0xe')][_0x080b('0x41')]()]&&_0xd973fd[_0x080b('0x44')][_0x080b('0x45')]({'id':_0x59a60b['idField'],'value':_0x4b387e[_0x59a60b['Variable']['name'][_0x080b('0x41')]()]['toString']()});}});}return _0xd973fd;}function getConnection(_0x3e5349){return request({'method':_0x080b('0xb'),'form':{'method':'login','input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x3e5349[_0x080b('0x48')],'password':_0x3e5349[_0x080b('0x49')],'encryption':'PLAIN'},'application':_0x080b('0x4a')})}})[_0x080b('0x2b')](function(_0x3d5e28){var _0x2f9a29=_0x3d5e28;if(_0x2f9a29['id']){def['sessionID']=_0x2f9a29['id'];return BPromise[_0x080b('0x30')](_0x2f9a29);}else{throw new Error(util[_0x080b('0x21')](_0x080b('0x4b'),_0x3e5349['id']));}});}function setRelationship(_0x333ed4,_0x12e84e,_0x299ad6,_0x4b4fe2){return request({'form':{'method':'set_relationship','input_type':_0x080b('0x20'),'response_type':_0x080b('0x20'),'rest_data':JSON[_0x080b('0x38')]({'session':_0x333ed4['id'],'module_name':_0x080b('0x4c'),'module_id':_0x299ad6['id'],'link_field_name':_0x4b4fe2,'related_ids':[_0x12e84e['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x080b('0x4d')]=function(_0x3ad14a,_0x1bf98c,_0x3e3fdf,_0x2863ca,_0x546842,_0x4e65b8){var _0x1d28c0,_0x12d2db,_0x1e60ae,_0x523ad6;_0x4e65b8[_0x080b('0x4e')]=intUtil[_0x080b('0x4f')](_0x4e65b8['remoteUri']);_0x4e65b8['serverUrl']=intUtil['stripTrailingSlash'](_0x4e65b8[_0x080b('0x50')]);def['uri']=util[_0x080b('0x21')](_0x080b('0x51'),_0x4e65b8['remoteUri']);if(_0x546842&&_0x546842[_0x080b('0x52')]){logger[_0x080b('0x26')](_0x080b('0x53'),_0x080b('0x54'));_0x1bf98c['recordingURL']=util[_0x080b('0x21')](_0x080b('0x55'),_0x4e65b8[_0x080b('0x50')],_0x1bf98c[_0x080b('0x56')],md5(_0x1bf98c[_0x080b('0x56')]));}else{_0x1bf98c[_0x080b('0x57')]='';}return getConnection(_0x4e65b8)[_0x080b('0x2b')](function(_0x501d44){_0x523ad6=_0x501d44;return getUser(_0x4e65b8,_0x2863ca[_0x080b('0xe')],_0x523ad6);})['then'](function(_0xb07c79){_0x1d28c0=_0xb07c79;logger[_0x080b('0x26')]('The\x20User\x20ID\x20is:',_0x1d28c0['id']);return getEndUser(_0x4e65b8,_0x1bf98c[_0x080b('0x58')],_0x1bf98c[_0x080b('0x59')],_0x523ad6);})[_0x080b('0x2b')](function(_0x50b00a){_0x12d2db=_0x50b00a;logger['info'](_0x080b('0x5a'),_0x12d2db['id']);return getTicket(_0x4e65b8,_0x1d28c0,_0x12d2db,_0x3e3fdf,_0x1bf98c,_0x3e3fdf['Fields'],_0x523ad6,_0x080b('0x5b'));})['then'](function(_0x35daf3){_0x1e60ae=_0x35daf3;logger[_0x080b('0x26')](_0x080b('0x5c'));logger[_0x080b('0x26')](_0x080b('0x5d'),_0x1e60ae['id']);return setRelationship(_0x523ad6,_0x1d28c0,_0x1e60ae,_0x080b('0x5e'));})[_0x080b('0x2b')](function(){return setRelationship(_0x523ad6,_0x12d2db,_0x1e60ae,_0x080b('0x5f'));})[_0x080b('0x2b')](function(){return getServerInfo(_0x523ad6);})[_0x080b('0x2b')](function(_0x4ebeaf){var _0x551bb7=parseInt(_0x4ebeaf[_0x080b('0x60')][_0x080b('0x61')](0x0));var _0x4c9341=util[_0x080b('0x21')](_0x080b('0x62'),_0x4e65b8[_0x080b('0x4e')],_0x1e60ae['id']);if(_0x551bb7>0x6){_0x4c9341=util[_0x080b('0x21')](_0x080b('0x63'),_0x4e65b8[_0x080b('0x4e')],_0x1e60ae['id']);}logger[_0x080b('0x26')](_0x080b('0x53'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x080b('0x21')]('user:%s',_0x2863ca['name']),_0x080b('0x64'),{'uri':_0x4c9341});})['catch'](function(_0xce1e95){logger[_0x080b('0x65')]('[QUEUE]',JSON[_0x080b('0x38')](_0xce1e95));});};exports[_0x080b('0x66')]=function(_0x309953,_0x5088db,_0x3b2cc2,_0x442995,_0x18d6ce,_0x588120,_0x5d2047){var _0x1bef32,_0x2ec7f7,_0x242ce4,_0x578b52;_0x588120[_0x080b('0x4e')]=intUtil[_0x080b('0x4f')](_0x588120['remoteUri']);_0x588120['serverUrl']=intUtil[_0x080b('0x4f')](_0x588120[_0x080b('0x50')]);def[_0x080b('0x67')]=util[_0x080b('0x21')](_0x080b('0x51'),_0x588120[_0x080b('0x4e')]);if(_0x5d2047&&_0x5d2047['recordingFormat']&&_0x5d2047[_0x080b('0x68')]!==_0x080b('0x69')){logger[_0x080b('0x26')]('[OUTBOUND]',_0x080b('0x54'));_0x5088db[_0x080b('0x57')]=util[_0x080b('0x21')](_0x080b('0x55'),_0x588120[_0x080b('0x50')],_0x5088db[_0x080b('0x56')],md5(_0x5088db[_0x080b('0x56')]));}return getConnection(_0x588120)['then'](function(_0x4f6644){_0x578b52=_0x4f6644;return getUser(_0x588120,_0x442995[_0x080b('0xe')],_0x578b52);})[_0x080b('0x2b')](function(_0x198ba2){_0x1bef32=_0x198ba2;logger[_0x080b('0x26')](_0x080b('0x6a'),_0x1bef32['id']);return getEndUser(_0x588120,_0x5088db[_0x080b('0x6b')],_0x5088db[_0x080b('0x6c')],_0x578b52);})[_0x080b('0x2b')](function(_0x23a630){_0x2ec7f7=_0x23a630;logger[_0x080b('0x26')](_0x080b('0x5a'),_0x2ec7f7['id']);return getTicket(_0x588120,_0x1bef32,_0x2ec7f7,_0x3b2cc2,_0x5088db,_0x3b2cc2['Fields'],_0x578b52,_0x080b('0x6d'));})[_0x080b('0x2b')](function(_0x360357){_0x242ce4=_0x360357;logger[_0x080b('0x26')]('Ticket\x20created!');logger[_0x080b('0x26')]('The\x20Ticket\x20ID\x20is:',_0x242ce4['id']);return setRelationship(_0x578b52,_0x1bef32,_0x242ce4,_0x080b('0x5e'));})['then'](function(){return setRelationship(_0x578b52,_0x2ec7f7,_0x242ce4,'contacts');})['then'](function(){return getServerInfo(_0x578b52);})[_0x080b('0x2b')](function(_0x109df8){var _0x2ac459=parseInt(_0x109df8[_0x080b('0x60')][_0x080b('0x61')](0x0));var _0x573449=util[_0x080b('0x21')](_0x080b('0x62'),_0x588120['remoteUri'],_0x242ce4['id']);if(_0x2ac459>0x6){_0x573449=util[_0x080b('0x21')](_0x080b('0x63'),_0x588120[_0x080b('0x4e')],_0x242ce4['id']);}logger[_0x080b('0x26')](_0x080b('0x6e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x080b('0x21')](_0x080b('0x6f'),_0x442995[_0x080b('0xe')]),_0x080b('0x64'),{'uri':_0x573449});})[_0x080b('0x70')](function(_0x59e226){logger['error']('[OUTBOUND]',JSON[_0x080b('0x38')](_0x59e226));});};exports[_0x080b('0x71')]=function(_0x539497,_0xef44fd,_0x262e1d,_0xbc3de9,_0x4362f3,_0x2d72cd){var _0x4e2fbf,_0x353bd1,_0x41b84d,_0x52a21c;_0x2d72cd[_0x080b('0x4e')]=intUtil[_0x080b('0x4f')](_0x2d72cd[_0x080b('0x4e')]);_0x2d72cd['serverUrl']=intUtil[_0x080b('0x4f')](_0x2d72cd[_0x080b('0x50')]);def[_0x080b('0x67')]=util[_0x080b('0x21')](_0x080b('0x51'),_0x2d72cd[_0x080b('0x4e')]);if(_0x4362f3&&_0x4362f3['monitor_format']){logger['info']('['+_0xef44fd[_0x080b('0x72')][_0x080b('0x73')]()+']',_0x080b('0x54'));_0xef44fd[_0x080b('0x57')]=util[_0x080b('0x21')](_0x080b('0x55'),_0x2d72cd['serverUrl'],_0xef44fd[_0x080b('0x56')],md5(_0xef44fd['uniqueid']));}else{_0xef44fd[_0x080b('0x57')]='';}return getConnection(_0x2d72cd)[_0x080b('0x2b')](function(_0x42d405){_0x52a21c=_0x42d405;if(!_[_0x080b('0x25')](_0xbc3de9)){return getUser(_0x2d72cd,_0xbc3de9[_0x080b('0xe')],_0x52a21c);}else{return getUser(_0x2d72cd,null,_0x52a21c);}})[_0x080b('0x2b')](function(_0x3fae40){_0x4e2fbf=_0x3fae40;logger[_0x080b('0x26')](_0x080b('0x6a'),_0x4e2fbf['id']);return getEndUser(_0x2d72cd,_0xef44fd[_0x080b('0x58')],_0xef44fd['calleridnum'],_0x52a21c);})[_0x080b('0x2b')](function(_0x131c8d){_0x353bd1=_0x131c8d;logger['info'](_0x080b('0x5a'),_0x353bd1['id']);return getTicket(_0x2d72cd,_0x4e2fbf,_0x353bd1,_0x262e1d,_0xef44fd,_0x262e1d[_0x080b('0x74')],_0x52a21c,_0x080b('0x5b'));})[_0x080b('0x2b')](function(_0x2fd986){_0x41b84d=_0x2fd986;logger[_0x080b('0x26')](_0x080b('0x5c'));logger[_0x080b('0x26')](_0x080b('0x5d'),_0x41b84d['id']);return setRelationship(_0x52a21c,_0x4e2fbf,_0x41b84d,_0x080b('0x5e'));})['then'](function(){return setRelationship(_0x52a21c,_0x353bd1,_0x41b84d,_0x080b('0x5f'));})['then'](function(){return getServerInfo(_0x52a21c);})['catch'](function(_0x4e8e73){logger[_0x080b('0x65')]('['+_0xef44fd[_0x080b('0x72')][_0x080b('0x73')]()+']',JSON[_0x080b('0x38')](_0x4e8e73));});}; \ 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 1887492..9580353 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 _0x8569=['test','lodash','util','length','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','slice','substring','validateEmail','isNil'];(function(_0x1c3ab8,_0x9ba07f){var _0x2c7492=function(_0x10d74b){while(--_0x10d74b){_0x1c3ab8['push'](_0x1c3ab8['shift']());}};_0x2c7492(++_0x9ba07f);}(_0x8569,0x91));var _0x9856=function(_0x13e724,_0x296739){_0x13e724=_0x13e724-0x0;var _0x334a44=_0x8569[_0x13e724];return _0x334a44;};'use strict';var _=require(_0x9856('0x0'));var util=require(_0x9856('0x1'));exports['getString']=function(_0x39e1eb,_0x865041,_0x1ea06f){var _0x3e4fa9=[];if(_0x39e1eb[_0x9856('0x2')]>0x0){var _0x28a804=_['sortBy'](_0x39e1eb,['id']);for(var _0x4adc2e=0x0;_0x4adc2e<_0x28a804[_0x9856('0x2')];_0x4adc2e++){var _0x4e8669=_0x28a804[_0x4adc2e];if(_0x4e8669[_0x9856('0x3')]===_0x9856('0x4')){_0x3e4fa9[_0x9856('0x5')](_0x4e8669[_0x9856('0x6')]);}else if(_0x4e8669[_0x9856('0x3')]===_0x9856('0x7')&&_0x4e8669[_0x9856('0x8')]){_0x865041[_0x4e8669[_0x9856('0x8')]]&&_0x3e4fa9['push'](_0x865041[_0x4e8669[_0x9856('0x8')]][_0x9856('0x9')]());}else if(_0x4e8669[_0x9856('0x3')]===_0x9856('0xa')&&_0x4e8669[_0x9856('0xb')]&&_0x4e8669[_0x9856('0xb')][_0x9856('0xc')]){_0x865041[_0x4e8669[_0x9856('0xb')][_0x9856('0xc')]['toLowerCase']()]&&_0x3e4fa9[_0x9856('0x5')](_0x865041[_0x4e8669[_0x9856('0xb')][_0x9856('0xc')][_0x9856('0xd')]()]['toString']());}else if(_0x4e8669['type']===_0x9856('0xe')){if(_0x4e8669[_0x9856('0xf')]===_0x9856('0x4')&&_0x4e8669[_0x9856('0x10')]){_0x3e4fa9[_0x9856('0x5')](util[_0x9856('0x11')]('%s:\x20%s',_0x4e8669[_0x9856('0x10')],_0x4e8669['keyContent']));}else if(_0x4e8669[_0x9856('0xf')]===_0x9856('0x7')&&_0x4e8669[_0x9856('0x8')]&&_0x4e8669[_0x9856('0x10')]){_0x865041[_0x4e8669[_0x9856('0x8')]]&&_0x3e4fa9[_0x9856('0x5')](util[_0x9856('0x11')](_0x9856('0x12'),_0x4e8669[_0x9856('0x10')],_0x865041[_0x4e8669[_0x9856('0x8')]]));}else if(_0x4e8669[_0x9856('0xf')]==='customVariable'&&_0x4e8669[_0x9856('0xb')]&&_0x4e8669[_0x9856('0xb')]['name']&&_0x4e8669['key']){_0x865041[_0x4e8669[_0x9856('0xb')][_0x9856('0xc')][_0x9856('0xd')]()]&&_0x3e4fa9[_0x9856('0x5')](util[_0x9856('0x11')]('%s:\x20%s',_0x4e8669[_0x9856('0x10')],_0x865041[_0x4e8669[_0x9856('0xb')][_0x9856('0xc')][_0x9856('0xd')]()]));}}}}return _0x3e4fa9['join'](_0x1ea06f);};exports['stripTrailingSlash']=function(_0x5789a3){var _0x587677=_0x5789a3[_0x9856('0x13')](-0x1);if(_0x587677==='/'){_0x5789a3=_0x5789a3[_0x9856('0x14')](0x0,_0x5789a3['lastIndexOf'](_0x587677));}return _0x5789a3;};exports[_0x9856('0x15')]=function(_0x422230){if(!_[_0x9856('0x16')](_0x422230)&&_0x422230!==''){var _0x14dd72=/^(([^<>()\[\]\\.,;:\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 _0x14dd72[_0x9856('0x17')](String(_0x422230)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0xf024=['substring','lastIndexOf','validateEmail','isNil','getString','sortBy','length','string','push','content','type','variable','variableName','customVariable','Variable','name','toLowerCase','toString','keyValue','format','%s:\x20%s','key','keyContent','keyType','join','stripTrailingSlash'];(function(_0x47aa49,_0x572f84){var _0x302629=function(_0x295baf){while(--_0x295baf){_0x47aa49['push'](_0x47aa49['shift']());}};_0x302629(++_0x572f84);}(_0xf024,0x156));var _0x4f02=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xf024[_0x5f0089];return _0x193892;};'use strict';var _=require('lodash');var util=require('util');exports[_0x4f02('0x0')]=function(_0x3a1915,_0x5406b5,_0xf326e4){var _0x100a18=[];if(_0x3a1915['length']>0x0){var _0x467f11=_[_0x4f02('0x1')](_0x3a1915,['id']);for(var _0x18afc5=0x0;_0x18afc5<_0x467f11[_0x4f02('0x2')];_0x18afc5++){var _0x55fabc=_0x467f11[_0x18afc5];if(_0x55fabc['type']===_0x4f02('0x3')){_0x100a18[_0x4f02('0x4')](_0x55fabc[_0x4f02('0x5')]);}else if(_0x55fabc[_0x4f02('0x6')]===_0x4f02('0x7')&&_0x55fabc[_0x4f02('0x8')]){_0x5406b5[_0x55fabc[_0x4f02('0x8')]]&&_0x100a18[_0x4f02('0x4')](_0x5406b5[_0x55fabc[_0x4f02('0x8')]]['toString']());}else if(_0x55fabc['type']===_0x4f02('0x9')&&_0x55fabc[_0x4f02('0xa')]&&_0x55fabc[_0x4f02('0xa')]['name']){_0x5406b5[_0x55fabc[_0x4f02('0xa')][_0x4f02('0xb')]['toLowerCase']()]&&_0x100a18[_0x4f02('0x4')](_0x5406b5[_0x55fabc[_0x4f02('0xa')]['name'][_0x4f02('0xc')]()][_0x4f02('0xd')]());}else if(_0x55fabc[_0x4f02('0x6')]===_0x4f02('0xe')){if(_0x55fabc['keyType']===_0x4f02('0x3')&&_0x55fabc['key']){_0x100a18['push'](util[_0x4f02('0xf')](_0x4f02('0x10'),_0x55fabc[_0x4f02('0x11')],_0x55fabc[_0x4f02('0x12')]));}else if(_0x55fabc[_0x4f02('0x13')]===_0x4f02('0x7')&&_0x55fabc['variableName']&&_0x55fabc[_0x4f02('0x11')]){_0x5406b5[_0x55fabc[_0x4f02('0x8')]]&&_0x100a18[_0x4f02('0x4')](util[_0x4f02('0xf')](_0x4f02('0x10'),_0x55fabc[_0x4f02('0x11')],_0x5406b5[_0x55fabc[_0x4f02('0x8')]]));}else if(_0x55fabc['keyType']===_0x4f02('0x9')&&_0x55fabc[_0x4f02('0xa')]&&_0x55fabc['Variable'][_0x4f02('0xb')]&&_0x55fabc[_0x4f02('0x11')]){_0x5406b5[_0x55fabc['Variable'][_0x4f02('0xb')][_0x4f02('0xc')]()]&&_0x100a18[_0x4f02('0x4')](util[_0x4f02('0xf')](_0x4f02('0x10'),_0x55fabc['key'],_0x5406b5[_0x55fabc[_0x4f02('0xa')][_0x4f02('0xb')][_0x4f02('0xc')]()]));}}}}return _0x100a18[_0x4f02('0x14')](_0xf326e4);};exports[_0x4f02('0x15')]=function(_0x3cf7a7){var _0x379a91=_0x3cf7a7['slice'](-0x1);if(_0x379a91==='/'){_0x3cf7a7=_0x3cf7a7[_0x4f02('0x16')](0x0,_0x3cf7a7[_0x4f02('0x17')](_0x379a91));}return _0x3cf7a7;};exports[_0x4f02('0x18')]=function(_0x1bc5bf){if(!_[_0x4f02('0x19')](_0x1bc5bf)&&_0x1bc5bf!==''){var _0x28e5b5=/^(([^<>()\[\]\\.,;:\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 _0x28e5b5['test'](String(_0x1bc5bf)[_0x4f02('0xc')]());}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 818a7c0..ae8a18a 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(_0x48d2b7,_0x41e772){var _0x2e7b8c=function(_0x55fe20){while(--_0x55fe20){_0x48d2b7['push'](_0x48d2b7['shift']());}};_0x2e7b8c(++_0x41e772);}(_0xe706,0xa3));var _0x6e70=function(_0x5982a5,_0x3dc07b){_0x5982a5=_0x5982a5-0x0;var _0x159c80=_0xe706[_0x5982a5];return _0x159c80;};'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 _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x50db95,_0x52534d){var _0x1026bc=function(_0x500d17){while(--_0x500d17){_0x50db95['push'](_0x50db95['shift']());}};_0x1026bc(++_0x52534d);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 5412ed7..29de84f 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 _0xe90b=['results','filter','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','password','token','Basic\x20%s','toString','base64','[HTTP]','stringify','map','forEach','includes','picklist','nameField','customField','content','string','idField','custom_fields','push','variable','variableName','type','Variable','toLowerCase','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','integrationTab','[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','toUpperCase','calleridname','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','then','ticket','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','agent','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'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0xe90b,0x12f));var _0xbe90=function(_0x223461,_0x2bca70){_0x223461=_0x223461-0x0;var _0x4dbe0a=_0xe90b[_0x223461];return _0x4dbe0a;};'use strict';var _=require(_0xbe90('0x0'));var rp=require(_0xbe90('0x1'));var md5=require(_0xbe90('0x2'));var util=require(_0xbe90('0x3'));var Redis=require(_0xbe90('0x4'));var intUtil=require(_0xbe90('0x5'));var config=require(_0xbe90('0x6'));var logger=require(_0xbe90('0x7'))(_0xbe90('0x8'));config[_0xbe90('0x9')]=_[_0xbe90('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xbe90('0xb'))(new Redis(config[_0xbe90('0x9')]));function emit(_0x291c24,_0x35f4e9,_0x401c30){io['to'](_0x291c24)[_0xbe90('0xc')](_0x35f4e9,_0x401c30);}var headers={'Content-Type':_0xbe90('0xd'),'Accept':_0xbe90('0xd')};function getTicket(_0x215c77,_0x49cd27,_0xecd6f8,_0x936415,_0x3efdae){logger[_0xbe90('0xe')](_0xbe90('0xf'));return request({'uri':util[_0xbe90('0x10')](_0xbe90('0x11'),_0x215c77[_0xbe90('0x12')]),'method':_0xbe90('0x13'),'body':{'ticket':_[_0xbe90('0x14')]({'requester_id':_0xecd6f8['id'],'submitter_id':_0x49cd27?_0x49cd27['id']:undefined,'assignee_id':_0x49cd27?_0x49cd27['id']:undefined,'tags':getTags(_0x936415[_0xbe90('0x15')],_0xbe90('0x16')),'subject':intUtil[_0xbe90('0x17')](_0x936415[_0xbe90('0x18')],_0x3efdae,'\x20'),'description':intUtil['getString'](_0x936415[_0xbe90('0x19')],_0x3efdae,'\x0a'),'comment':{'public':![],'body':intUtil[_0xbe90('0x17')](_0x936415[_0xbe90('0x19')],_0x3efdae,'\x0a')}},getCustomFields(_0x936415['Fields'],_0x3efdae))}})[_0xbe90('0x1a')](function(_0x2d526b){logger[_0xbe90('0xe')]('Ticket\x20created!');return _0x2d526b[_0xbe90('0x1b')];});}function getUser(_0x216478,_0x276af0){if(intUtil['validateEmail'](_0x276af0)){logger[_0xbe90('0xe')]('Getting\x20agent\x20with\x20email',_0x276af0);return request({'uri':util['format'](_0xbe90('0x1c'),_0x216478['remoteUri']),'qs':{'query':util['format'](_0xbe90('0x1d'),_0x276af0)}})[_0xbe90('0x1a')](function(_0x4d8dfe){if(_0x4d8dfe[_0xbe90('0x1e')]){logger[_0xbe90('0xe')]('Agent\x20found!');return _[_0xbe90('0x1f')](_0x4d8dfe['results'],{'email':_0x276af0,'role':_0xbe90('0x20')});}else{logger[_0xbe90('0xe')](_0xbe90('0x21'));return request({'uri':util[_0xbe90('0x10')](_0xbe90('0x22'),_0x216478['remoteUri'])})[_0xbe90('0x1a')](function(_0x5da196){logger[_0xbe90('0xe')](_0xbe90('0x23'));return _0x5da196[_0xbe90('0x24')];});}});}else{logger['info'](_0xbe90('0x21'));return request({'uri':util['format'](_0xbe90('0x22'),_0x216478[_0xbe90('0x12')])})['then'](function(_0x2c442a){logger[_0xbe90('0xe')](_0xbe90('0x23'));return _0x2c442a[_0xbe90('0x24')];});}}function getEndUser(_0x45177c,_0x2ebb84,_0x313707){logger[_0xbe90('0xe')](_0xbe90('0x25'),_0x313707);return request({'uri':util[_0xbe90('0x10')](_0xbe90('0x1c'),_0x45177c[_0xbe90('0x12')]),'qs':{'query':util['format'](_0xbe90('0x26'),_0x313707)}})[_0xbe90('0x1a')](function(_0x2a8c9e){var _0x4aacab;if(_0x2a8c9e[_0xbe90('0x27')]['length']){_0x2a8c9e[_0xbe90('0x27')]=_[_0xbe90('0x28')](_0x2a8c9e[_0xbe90('0x27')],{'suspended':![],'role':_0xbe90('0x29')});if(_0x2a8c9e[_0xbe90('0x27')][_0xbe90('0x2a')]){_0x4aacab=_[_0xbe90('0x2b')](_0x2a8c9e[_0xbe90('0x27')]);}}if(_0x4aacab){logger[_0xbe90('0xe')](_0xbe90('0x2c'));return _0x4aacab;}else{logger[_0xbe90('0xe')](_0xbe90('0x2d'));return request({'uri':util[_0xbe90('0x10')](_0xbe90('0x2e'),_0x45177c[_0xbe90('0x12')]),'method':_0xbe90('0x13'),'body':{'user':{'role':'end-user','name':util[_0xbe90('0x10')](_0xbe90('0x2f'),_0x2ebb84||_0x313707),'phone':_0x313707}}})[_0xbe90('0x1a')](function(_0x37d9fe){logger['info'](_0xbe90('0x30'));return _0x37d9fe['user'];});}});}function getAuth(_0x5f5b6c){var _0x5df796;if(_0x5f5b6c[_0xbe90('0x31')]==='password'){_0x5df796=util[_0xbe90('0x10')](_0xbe90('0x32'),_0x5f5b6c[_0xbe90('0x33')],_0x5f5b6c[_0xbe90('0x34')]);}else if(_0x5f5b6c['authType']==='token'){_0x5df796=util[_0xbe90('0x10')]('%s/token:%s',_0x5f5b6c[_0xbe90('0x33')],_0x5f5b6c[_0xbe90('0x35')]);}return util['format'](_0xbe90('0x36'),new Buffer(_0x5df796)[_0xbe90('0x37')](_0xbe90('0x38')));}function request(_0x2a8ac7){logger['debug'](_0xbe90('0x39'),JSON[_0xbe90('0x3a')](_0x2a8ac7));return rp(_[_0xbe90('0xa')](_0x2a8ac7,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x47c5f6,_0x321872){var _0x3a3d7a=[];if(_0x47c5f6&&_0x47c5f6[_0xbe90('0x2a')]>0x0){_0x3a3d7a=_[_0xbe90('0x3b')](_0x47c5f6,_0x321872);}return _0x3a3d7a;}function getCustomFields(_0x41cafc,_0x5a36a1){var _0x21f1b6=[];var _0x26af0a={'custom_fields':[]};if(_0x41cafc[_0xbe90('0x2a')]>0x0){_[_0xbe90('0x3c')](_0x41cafc,function(_0x2cff87){if(_[_0xbe90('0x3d')](['string',_0xbe90('0x3e')],_0x2cff87['type'])&&_0x2cff87[_0xbe90('0x3f')]&&!_0x2cff87[_0xbe90('0x40')]){_0x26af0a[_0x2cff87['nameField']['toLowerCase']()]=_0x2cff87[_0xbe90('0x41')][_0xbe90('0x37')]();}else if(_[_0xbe90('0x3d')]([_0xbe90('0x42'),_0xbe90('0x3e')],_0x2cff87['type'])&&_0x2cff87[_0xbe90('0x43')]&&_0x2cff87['customField']){_0x26af0a[_0xbe90('0x44')][_0xbe90('0x45')]({'id':_0x2cff87[_0xbe90('0x43')],'value':_0x2cff87[_0xbe90('0x41')][_0xbe90('0x37')]()});}else if(_0x2cff87['type']===_0xbe90('0x46')&&_0x2cff87[_0xbe90('0x47')]&&_0x2cff87[_0xbe90('0x43')]&&_0x2cff87[_0xbe90('0x40')]){_0x5a36a1[_0x2cff87[_0xbe90('0x47')]]&&_0x26af0a[_0xbe90('0x44')][_0xbe90('0x45')]({'id':_0x2cff87[_0xbe90('0x43')],'value':_0x5a36a1[_0x2cff87[_0xbe90('0x47')]][_0xbe90('0x37')]()});}else if(_0x2cff87[_0xbe90('0x48')]==='customVariable'&&_0x2cff87[_0xbe90('0x49')]&&_0x2cff87[_0xbe90('0x49')][_0xbe90('0x16')]&&_0x2cff87[_0xbe90('0x43')]&&_0x2cff87['customField']){_0x5a36a1[_0x2cff87[_0xbe90('0x49')][_0xbe90('0x16')][_0xbe90('0x4a')]()]&&_0x26af0a[_0xbe90('0x44')][_0xbe90('0x45')]({'id':_0x2cff87[_0xbe90('0x43')],'value':_0x5a36a1[_0x2cff87[_0xbe90('0x49')][_0xbe90('0x16')][_0xbe90('0x4a')]()][_0xbe90('0x37')]()});}});}return _0x26af0a;}exports['queue']=function(_0x189e17,_0x339eeb,_0x49063f,_0x32a61f,_0x17d6dc,_0x1c364d){var _0x84d5cf,_0x16349c;_0x1c364d[_0xbe90('0x12')]=intUtil['stripTrailingSlash'](_0x1c364d[_0xbe90('0x12')]);_0x1c364d['serverUrl']=intUtil[_0xbe90('0x4b')](_0x1c364d[_0xbe90('0x4c')]);if(_0x17d6dc&&_0x17d6dc[_0xbe90('0x4d')]){logger['info']('[QUEUE]',_0xbe90('0x4e'));_0x339eeb[_0xbe90('0x4f')]=util[_0xbe90('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1c364d[_0xbe90('0x4c')],_0x339eeb[_0xbe90('0x50')],md5(_0x339eeb[_0xbe90('0x50')]));}else{_0x339eeb[_0xbe90('0x4f')]='';}headers[_0xbe90('0x51')]=getAuth(_0x1c364d);return getUser(_0x1c364d,_0x32a61f[_0xbe90('0x52')])[_0xbe90('0x1a')](function(_0x4f2879){_0x84d5cf=_0x4f2879;logger[_0xbe90('0xe')](_0xbe90('0x53'),_0x84d5cf['id']);return getEndUser(_0x1c364d,_0x339eeb['calleridname'],_0x339eeb[_0xbe90('0x54')]);})[_0xbe90('0x1a')](function(_0xa58b28){_0x16349c=_0xa58b28;logger[_0xbe90('0xe')](_0xbe90('0x55'),_0x16349c['id']);return getTicket(_0x1c364d,_0x84d5cf,_0x16349c,_0x49063f,_0x339eeb);})['then'](function(_0x1ef198){if(_0x1ef198){logger[_0xbe90('0xe')](_0xbe90('0x56'),_0x1ef198['id']);switch(_0x1c364d[_0xbe90('0x48')]){case'integrationTab':logger[_0xbe90('0xe')]('[QUEUE]',_0xbe90('0x57'));return request({'uri':util[_0xbe90('0x10')](_0xbe90('0x58'),_0x1c364d['remoteUri'],_0x84d5cf['id'],_0x1ef198['id']),'method':_0xbe90('0x13')});case _0xbe90('0x59'):logger[_0xbe90('0xe')](_0xbe90('0x5a'),_0xbe90('0x5b'));emit(util[_0xbe90('0x10')](_0xbe90('0x5c'),_0x32a61f[_0xbe90('0x16')]),_0xbe90('0x5d'),{'uri':util[_0xbe90('0x10')](_0xbe90('0x5e'),_0x1c364d[_0xbe90('0x12')][_0xbe90('0x5f')](_0xbe90('0x60'),''),_0x1ef198['id'])});break;default:logger[_0xbe90('0x61')](_0xbe90('0x5a'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x317034){logger[_0xbe90('0x61')](_0xbe90('0x62'),util[_0xbe90('0x63')](_0x317034,{'showHidden':!![],'depth':null}));});};exports[_0xbe90('0x64')]=function(_0x3a80ea,_0x3b2149,_0x45b03d,_0x34b05d,_0x42b6b5,_0x276f04,_0x3e36ed){var _0x441916,_0x151a05;_0x276f04[_0xbe90('0x12')]=intUtil['stripTrailingSlash'](_0x276f04[_0xbe90('0x12')]);_0x276f04[_0xbe90('0x4c')]=intUtil[_0xbe90('0x4b')](_0x276f04['serverUrl']);if(_0x3e36ed&&_0x3e36ed[_0xbe90('0x65')]&&_0x3e36ed[_0xbe90('0x65')]!=='none'){logger[_0xbe90('0xe')]('[OUTBOUND]',_0xbe90('0x4e'));_0x3b2149[_0xbe90('0x4f')]=util[_0xbe90('0x10')](_0xbe90('0x66'),_0x276f04[_0xbe90('0x4c')],_0x3b2149[_0xbe90('0x50')],md5(_0x3b2149[_0xbe90('0x50')]));}headers[_0xbe90('0x51')]=getAuth(_0x276f04);return getUser(_0x276f04,_0x34b05d['email'])[_0xbe90('0x1a')](function(_0xc26bca){_0x441916=_0xc26bca;logger[_0xbe90('0xe')]('The\x20User\x20ID\x20is:',_0x441916['id']);return getEndUser(_0x276f04,_0x3b2149[_0xbe90('0x67')],_0x3b2149[_0xbe90('0x68')]);})['then'](function(_0x388eaa){_0x151a05=_0x388eaa;logger[_0xbe90('0xe')](_0xbe90('0x55'),_0x151a05['id']);return getTicket(_0x276f04,_0x441916,_0x151a05,_0x45b03d,_0x3b2149);})[_0xbe90('0x1a')](function(_0x3e142e){if(_0x3e142e){logger[_0xbe90('0xe')]('The\x20Ticket\x20ID\x20is:',_0x3e142e['id']);switch(_0x276f04['type']){case _0xbe90('0x69'):logger['info']('[OUTBOUND]',_0xbe90('0x57'));return request({'uri':util[_0xbe90('0x10')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x276f04[_0xbe90('0x12')],_0x441916['id'],_0x3e142e['id']),'method':_0xbe90('0x13')});case _0xbe90('0x59'):logger['info'](_0xbe90('0x6a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xbe90('0x10')](_0xbe90('0x5c'),_0x34b05d[_0xbe90('0x16')]),_0xbe90('0x5d'),{'uri':util[_0xbe90('0x10')](_0xbe90('0x5e'),_0x276f04[_0xbe90('0x12')][_0xbe90('0x5f')](_0xbe90('0x60'),''),_0x3e142e['id'])});break;default:logger[_0xbe90('0x61')](_0xbe90('0x6a'),_0xbe90('0x6b'));}}})[_0xbe90('0x6c')](function(_0x474cc3){logger[_0xbe90('0x61')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xbe90('0x63')](_0x474cc3,{'showHidden':!![],'depth':null}));});};exports[_0xbe90('0x6d')]=function(_0x3a200e,_0x2b6dc2,_0x4e9c30,_0x31db65,_0x179b10,_0x2e21a7){var _0x47b3e1,_0x435635;_0x2e21a7[_0xbe90('0x12')]=intUtil['stripTrailingSlash'](_0x2e21a7[_0xbe90('0x12')]);_0x2e21a7['serverUrl']=intUtil['stripTrailingSlash'](_0x2e21a7[_0xbe90('0x4c')]);if(_0x179b10&&_0x179b10['monitor_format']){logger['info']('['+_0x2b6dc2[_0xbe90('0x6e')][_0xbe90('0x6f')]()+']','Recording\x20is\x20enabled!');_0x2b6dc2['recordingURL']=util['format'](_0xbe90('0x66'),_0x2e21a7[_0xbe90('0x4c')],_0x2b6dc2['uniqueid'],md5(_0x2b6dc2[_0xbe90('0x50')]));}else{_0x2b6dc2[_0xbe90('0x4f')]='';}headers[_0xbe90('0x51')]=getAuth(_0x2e21a7);return getUser(_0x2e21a7)[_0xbe90('0x1a')](function(_0x5a8450){_0x47b3e1=_0x5a8450;logger[_0xbe90('0xe')](_0xbe90('0x53'),_0x47b3e1['id']);return getEndUser(_0x2e21a7,_0x2b6dc2[_0xbe90('0x70')],_0x2b6dc2[_0xbe90('0x54')]);})[_0xbe90('0x1a')](function(_0x1244be){_0x435635=_0x1244be;logger[_0xbe90('0xe')]('The\x20Enduser\x20ID\x20is:',_0x435635['id']);return getTicket(_0x2e21a7,_0x47b3e1,_0x435635,_0x4e9c30,_0x2b6dc2);})[_0xbe90('0x1a')](function(_0x5a2987){if(_0x5a2987){logger[_0xbe90('0xe')]('The\x20Ticket\x20ID\x20is:',_0x5a2987['id']);}})['catch'](function(_0x22f018){logger[_0xbe90('0x61')]('['+_0x2b6dc2[_0xbe90('0x6e')]['toUpperCase']()+']'+_0xbe90('0x71'),util['inspect'](_0x22f018,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xf681=['customField','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','replace','error','lastevent','toUpperCase','lodash','request-promise','md5','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','application/json','format','%s/tickets.json','Tags','name','getString','Subjects','Fields','then','info','Ticket\x20created!','ticket','%s/search.json','remoteUri','count','Agent\x20found!','find','agent','%s/users/me.json','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','results','length','filter','end-user','first','Enduser\x20found!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s/token:%s','username','token','Basic\x20%s','toString','base64','debug','[HTTP]','GET','map','includes','string','picklist','type','nameField','toLowerCase','content','custom_fields','push','variableName','idField'];(function(_0x2a6cf3,_0x58b2a1){var _0x2fe922=function(_0x3c74e1){while(--_0x3c74e1){_0x2a6cf3['push'](_0x2a6cf3['shift']());}};_0x2fe922(++_0x58b2a1);}(_0xf681,0x1c8));var _0x1f68=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf681[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x1f68('0x0'));var rp=require(_0x1f68('0x1'));var md5=require(_0x1f68('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x1f68('0x3'));var logger=require(_0x1f68('0x4'))('zendesk');config[_0x1f68('0x5')]=_['defaults'](config['redis'],{'host':_0x1f68('0x6'),'port':0x18eb});var io=require(_0x1f68('0x7'))(new Redis(config[_0x1f68('0x5')]));function emit(_0x1b8647,_0x3dc73b,_0x1df072){io['to'](_0x1b8647)['emit'](_0x3dc73b,_0x1df072);}var headers={'Content-Type':_0x1f68('0x8'),'Accept':_0x1f68('0x8')};function getTicket(_0x2de0bf,_0xf512ae,_0x132516,_0x5d0851,_0x5a77f1){logger['info']('Creating\x20new\x20ticket...');return request({'uri':util[_0x1f68('0x9')](_0x1f68('0xa'),_0x2de0bf['remoteUri']),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0x132516['id'],'submitter_id':_0xf512ae?_0xf512ae['id']:undefined,'assignee_id':_0xf512ae?_0xf512ae['id']:undefined,'tags':getTags(_0x5d0851[_0x1f68('0xb')],_0x1f68('0xc')),'subject':intUtil[_0x1f68('0xd')](_0x5d0851[_0x1f68('0xe')],_0x5a77f1,'\x20'),'description':intUtil[_0x1f68('0xd')](_0x5d0851['Descriptions'],_0x5a77f1,'\x0a'),'comment':{'public':![],'body':intUtil[_0x1f68('0xd')](_0x5d0851['Descriptions'],_0x5a77f1,'\x0a')}},getCustomFields(_0x5d0851[_0x1f68('0xf')],_0x5a77f1))}})[_0x1f68('0x10')](function(_0x2ba95e){logger[_0x1f68('0x11')](_0x1f68('0x12'));return _0x2ba95e[_0x1f68('0x13')];});}function getUser(_0x43c515,_0x13dc7a){if(intUtil['validateEmail'](_0x13dc7a)){logger[_0x1f68('0x11')]('Getting\x20agent\x20with\x20email',_0x13dc7a);return request({'uri':util[_0x1f68('0x9')](_0x1f68('0x14'),_0x43c515[_0x1f68('0x15')]),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x13dc7a)}})[_0x1f68('0x10')](function(_0x107238){if(_0x107238[_0x1f68('0x16')]){logger[_0x1f68('0x11')](_0x1f68('0x17'));return _[_0x1f68('0x18')](_0x107238['results'],{'email':_0x13dc7a,'role':_0x1f68('0x19')});}else{logger[_0x1f68('0x11')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x1f68('0x9')](_0x1f68('0x1a'),_0x43c515[_0x1f68('0x15')])})[_0x1f68('0x10')](function(_0xdca3f5){logger[_0x1f68('0x11')]('Admin\x20account\x20selected.');return _0xdca3f5[_0x1f68('0x1b')];});}});}else{logger[_0x1f68('0x11')](_0x1f68('0x1c'));return request({'uri':util[_0x1f68('0x9')](_0x1f68('0x1a'),_0x43c515[_0x1f68('0x15')])})['then'](function(_0x4142fc){logger[_0x1f68('0x11')](_0x1f68('0x1d'));return _0x4142fc[_0x1f68('0x1b')];});}}function getEndUser(_0x352a21,_0x44ff8f,_0x2030ef){logger[_0x1f68('0x11')](_0x1f68('0x1e'),_0x2030ef);return request({'uri':util[_0x1f68('0x9')]('%s/search.json',_0x352a21[_0x1f68('0x15')]),'qs':{'query':util[_0x1f68('0x9')]('type:user\x20role:end-user\x20phone:%s',_0x2030ef)}})[_0x1f68('0x10')](function(_0x4e86e4){var _0x476f21;if(_0x4e86e4[_0x1f68('0x1f')][_0x1f68('0x20')]){_0x4e86e4[_0x1f68('0x1f')]=_[_0x1f68('0x21')](_0x4e86e4['results'],{'suspended':![],'role':_0x1f68('0x22')});if(_0x4e86e4[_0x1f68('0x1f')][_0x1f68('0x20')]){_0x476f21=_[_0x1f68('0x23')](_0x4e86e4[_0x1f68('0x1f')]);}}if(_0x476f21){logger['info'](_0x1f68('0x24'));return _0x476f21;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x1f68('0x9')](_0x1f68('0x25'),_0x352a21[_0x1f68('0x15')]),'method':_0x1f68('0x26'),'body':{'user':{'role':_0x1f68('0x22'),'name':util['format'](_0x1f68('0x27'),_0x44ff8f||_0x2030ef),'phone':_0x2030ef}}})[_0x1f68('0x10')](function(_0x5e9087){logger[_0x1f68('0x11')](_0x1f68('0x28'));return _0x5e9087[_0x1f68('0x1b')];});}});}function getAuth(_0x3ee257){var _0x406850;if(_0x3ee257[_0x1f68('0x29')]===_0x1f68('0x2a')){_0x406850=util[_0x1f68('0x9')]('%s:%s',_0x3ee257['username'],_0x3ee257['password']);}else if(_0x3ee257['authType']==='token'){_0x406850=util[_0x1f68('0x9')](_0x1f68('0x2b'),_0x3ee257[_0x1f68('0x2c')],_0x3ee257[_0x1f68('0x2d')]);}return util[_0x1f68('0x9')](_0x1f68('0x2e'),new Buffer(_0x406850)[_0x1f68('0x2f')](_0x1f68('0x30')));}function request(_0x22a953){logger[_0x1f68('0x31')](_0x1f68('0x32'),JSON['stringify'](_0x22a953));return rp(_['defaults'](_0x22a953,{'method':_0x1f68('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x5bf4df,_0x4e3d73){var _0x4cbb8b=[];if(_0x5bf4df&&_0x5bf4df['length']>0x0){_0x4cbb8b=_[_0x1f68('0x34')](_0x5bf4df,_0x4e3d73);}return _0x4cbb8b;}function getCustomFields(_0x7a7016,_0xda0e27){var _0x4cc70c=[];var _0x196216={'custom_fields':[]};if(_0x7a7016['length']>0x0){_['forEach'](_0x7a7016,function(_0x49e529){if(_[_0x1f68('0x35')]([_0x1f68('0x36'),_0x1f68('0x37')],_0x49e529[_0x1f68('0x38')])&&_0x49e529[_0x1f68('0x39')]&&!_0x49e529['customField']){_0x196216[_0x49e529[_0x1f68('0x39')][_0x1f68('0x3a')]()]=_0x49e529[_0x1f68('0x3b')][_0x1f68('0x2f')]();}else if(_[_0x1f68('0x35')]([_0x1f68('0x36'),_0x1f68('0x37')],_0x49e529['type'])&&_0x49e529['idField']&&_0x49e529['customField']){_0x196216[_0x1f68('0x3c')][_0x1f68('0x3d')]({'id':_0x49e529['idField'],'value':_0x49e529['content'][_0x1f68('0x2f')]()});}else if(_0x49e529[_0x1f68('0x38')]==='variable'&&_0x49e529[_0x1f68('0x3e')]&&_0x49e529[_0x1f68('0x3f')]&&_0x49e529[_0x1f68('0x40')]){_0xda0e27[_0x49e529[_0x1f68('0x3e')]]&&_0x196216['custom_fields'][_0x1f68('0x3d')]({'id':_0x49e529['idField'],'value':_0xda0e27[_0x49e529[_0x1f68('0x3e')]][_0x1f68('0x2f')]()});}else if(_0x49e529[_0x1f68('0x38')]===_0x1f68('0x41')&&_0x49e529['Variable']&&_0x49e529[_0x1f68('0x42')][_0x1f68('0xc')]&&_0x49e529[_0x1f68('0x3f')]&&_0x49e529[_0x1f68('0x40')]){_0xda0e27[_0x49e529[_0x1f68('0x42')]['name'][_0x1f68('0x3a')]()]&&_0x196216[_0x1f68('0x3c')][_0x1f68('0x3d')]({'id':_0x49e529[_0x1f68('0x3f')],'value':_0xda0e27[_0x49e529[_0x1f68('0x42')][_0x1f68('0xc')][_0x1f68('0x3a')]()][_0x1f68('0x2f')]()});}});}return _0x196216;}exports['queue']=function(_0x3b4e24,_0x19eb3f,_0x2ed86d,_0x54520f,_0x137768,_0x2d4d57){var _0x52b114,_0x4106ac;_0x2d4d57[_0x1f68('0x15')]=intUtil[_0x1f68('0x43')](_0x2d4d57[_0x1f68('0x15')]);_0x2d4d57['serverUrl']=intUtil['stripTrailingSlash'](_0x2d4d57[_0x1f68('0x44')]);if(_0x137768&&_0x137768[_0x1f68('0x45')]){logger[_0x1f68('0x11')]('[QUEUE]',_0x1f68('0x46'));_0x19eb3f[_0x1f68('0x47')]=util['format'](_0x1f68('0x48'),_0x2d4d57['serverUrl'],_0x19eb3f[_0x1f68('0x49')],md5(_0x19eb3f[_0x1f68('0x49')]));}else{_0x19eb3f[_0x1f68('0x47')]='';}headers[_0x1f68('0x4a')]=getAuth(_0x2d4d57);return getUser(_0x2d4d57,_0x54520f[_0x1f68('0x4b')])[_0x1f68('0x10')](function(_0xf90989){_0x52b114=_0xf90989;logger[_0x1f68('0x11')](_0x1f68('0x4c'),_0x52b114['id']);return getEndUser(_0x2d4d57,_0x19eb3f[_0x1f68('0x4d')],_0x19eb3f[_0x1f68('0x4e')]);})[_0x1f68('0x10')](function(_0xcd6c35){_0x4106ac=_0xcd6c35;logger[_0x1f68('0x11')]('The\x20Enduser\x20ID\x20is:',_0x4106ac['id']);return getTicket(_0x2d4d57,_0x52b114,_0x4106ac,_0x2ed86d,_0x19eb3f);})[_0x1f68('0x10')](function(_0x85fb51){if(_0x85fb51){logger[_0x1f68('0x11')](_0x1f68('0x4f'),_0x85fb51['id']);switch(_0x2d4d57['type']){case _0x1f68('0x50'):logger['info'](_0x1f68('0x51'),_0x1f68('0x52'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x2d4d57[_0x1f68('0x15')],_0x52b114['id'],_0x85fb51['id']),'method':'POST'});case _0x1f68('0x53'):logger[_0x1f68('0x11')](_0x1f68('0x51'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x1f68('0x9')](_0x1f68('0x54'),_0x54520f['name']),_0x1f68('0x55'),{'uri':util[_0x1f68('0x9')](_0x1f68('0x56'),_0x2d4d57[_0x1f68('0x15')]['replace'](_0x1f68('0x57'),''),_0x85fb51['id'])});break;default:logger['error']('[QUEUE]',_0x1f68('0x58'));}}})[_0x1f68('0x59')](function(_0x5eb99f){logger['error'](_0x1f68('0x5a'),util[_0x1f68('0x5b')](_0x5eb99f,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x3e1b91,_0x304e38,_0x32fc78,_0x2b30cd,_0x44c8da,_0x3be9e4,_0x335023){var _0x72fe80,_0x9e527;_0x3be9e4[_0x1f68('0x15')]=intUtil[_0x1f68('0x43')](_0x3be9e4['remoteUri']);_0x3be9e4[_0x1f68('0x44')]=intUtil[_0x1f68('0x43')](_0x3be9e4['serverUrl']);if(_0x335023&&_0x335023['recordingFormat']&&_0x335023[_0x1f68('0x5c')]!==_0x1f68('0x5d')){logger['info'](_0x1f68('0x5e'),'Recording\x20is\x20enabled!');_0x304e38[_0x1f68('0x47')]=util[_0x1f68('0x9')](_0x1f68('0x48'),_0x3be9e4['serverUrl'],_0x304e38[_0x1f68('0x49')],md5(_0x304e38[_0x1f68('0x49')]));}headers[_0x1f68('0x4a')]=getAuth(_0x3be9e4);return getUser(_0x3be9e4,_0x2b30cd[_0x1f68('0x4b')])[_0x1f68('0x10')](function(_0x3643b9){_0x72fe80=_0x3643b9;logger[_0x1f68('0x11')](_0x1f68('0x4c'),_0x72fe80['id']);return getEndUser(_0x3be9e4,_0x304e38[_0x1f68('0x5f')],_0x304e38[_0x1f68('0x60')]);})['then'](function(_0x5cce2e){_0x9e527=_0x5cce2e;logger[_0x1f68('0x11')](_0x1f68('0x61'),_0x9e527['id']);return getTicket(_0x3be9e4,_0x72fe80,_0x9e527,_0x32fc78,_0x304e38);})[_0x1f68('0x10')](function(_0x123ba3){if(_0x123ba3){logger[_0x1f68('0x11')](_0x1f68('0x4f'),_0x123ba3['id']);switch(_0x3be9e4['type']){case _0x1f68('0x50'):logger[_0x1f68('0x11')](_0x1f68('0x5e'),_0x1f68('0x52'));return request({'uri':util[_0x1f68('0x9')](_0x1f68('0x62'),_0x3be9e4['remoteUri'],_0x72fe80['id'],_0x123ba3['id']),'method':'POST'});case _0x1f68('0x53'):logger['info'](_0x1f68('0x5e'),_0x1f68('0x63'));emit(util[_0x1f68('0x9')]('user:%s',_0x2b30cd[_0x1f68('0xc')]),_0x1f68('0x55'),{'uri':util[_0x1f68('0x9')](_0x1f68('0x56'),_0x3be9e4['remoteUri'][_0x1f68('0x64')](_0x1f68('0x57'),''),_0x123ba3['id'])});break;default:logger[_0x1f68('0x65')](_0x1f68('0x5e'),_0x1f68('0x58'));}}})[_0x1f68('0x59')](function(_0x4f146f){logger['error']('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x4f146f,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x345903,_0x5eb6d9,_0x497289,_0x44d8de,_0x9dee07,_0x136510){var _0x2c697b,_0x37870f;_0x136510['remoteUri']=intUtil['stripTrailingSlash'](_0x136510['remoteUri']);_0x136510[_0x1f68('0x44')]=intUtil[_0x1f68('0x43')](_0x136510[_0x1f68('0x44')]);if(_0x9dee07&&_0x9dee07[_0x1f68('0x45')]){logger['info']('['+_0x5eb6d9[_0x1f68('0x66')][_0x1f68('0x67')]()+']',_0x1f68('0x46'));_0x5eb6d9['recordingURL']=util[_0x1f68('0x9')](_0x1f68('0x48'),_0x136510['serverUrl'],_0x5eb6d9[_0x1f68('0x49')],md5(_0x5eb6d9[_0x1f68('0x49')]));}else{_0x5eb6d9[_0x1f68('0x47')]='';}headers['Authorization']=getAuth(_0x136510);return getUser(_0x136510)['then'](function(_0x287492){_0x2c697b=_0x287492;logger['info']('The\x20User\x20ID\x20is:',_0x2c697b['id']);return getEndUser(_0x136510,_0x5eb6d9[_0x1f68('0x4d')],_0x5eb6d9[_0x1f68('0x4e')]);})[_0x1f68('0x10')](function(_0x27fcb4){_0x37870f=_0x27fcb4;logger[_0x1f68('0x11')]('The\x20Enduser\x20ID\x20is:',_0x37870f['id']);return getTicket(_0x136510,_0x2c697b,_0x37870f,_0x497289,_0x5eb6d9);})[_0x1f68('0x10')](function(_0x4147a6){if(_0x4147a6){logger[_0x1f68('0x11')](_0x1f68('0x4f'),_0x4147a6['id']);}})[_0x1f68('0x59')](function(_0x21acf7){logger[_0x1f68('0x65')]('['+_0x5eb6d9[_0x1f68('0x66')]['toUpperCase']()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x1f68('0x5b')](_0x21acf7,{'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 9045af2..d009417 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 _0xc36d=['https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','refresh_token','then','add','expires_in','seconds','catch','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','info','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','POST','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','error','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','nothing','lead','Creating\x20new\x20call...','Owner','administrator','Subject','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','utc','format','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','Inbound','merge','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','/downloads?type=uniqueid&token=','recordingURL','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','destcalleridnum','Outbound','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','lodash','request-promise','md5','util','./util','moment','bluebird','../../../../config/environment','zoho','redis','defaults','localhost','debug','stringify','length','forEach','string','picklist','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','split','isNil','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au'];(function(_0x283b33,_0x5192ca){var _0x5d5c0c=function(_0x243485){while(--_0x243485){_0x283b33['push'](_0x283b33['shift']());}};_0x5d5c0c(++_0x5192ca);}(_0xc36d,0x7d));var _0xdc36=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xc36d[_0x411add];return _0x238242;};'use strict';var _=require(_0xdc36('0x0'));var rp=require(_0xdc36('0x1'));var md5=require(_0xdc36('0x2'));var util=require(_0xdc36('0x3'));var intUtil=require(_0xdc36('0x4'));var moment=require(_0xdc36('0x5'));var Redis=require('ioredis');var BPromise=require(_0xdc36('0x6'));var config=require(_0xdc36('0x7'));var logger=require('../../../../config/logger')(_0xdc36('0x8'));config[_0xdc36('0x9')]=_[_0xdc36('0xa')](config[_0xdc36('0x9')],{'host':_0xdc36('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdc36('0x9')]));function emit(_0x456897,_0x2a0087,_0xdca7f7){io['to'](_0x456897)['emit'](_0x2a0087,_0xdca7f7);}function request(_0x20d00a){logger[_0xdc36('0xc')]('[HTTP]',JSON[_0xdc36('0xd')](_0x20d00a));return rp(_0x20d00a);}function getCustomFields(_0x1cb73d,_0x2483bd){var _0x4c0614={};if(_0x1cb73d[_0xdc36('0xe')]>0x0){_[_0xdc36('0xf')](_0x1cb73d,function(_0x4fda43){if(_['includes']([_0xdc36('0x10'),_0xdc36('0x11')],_0x4fda43[_0xdc36('0x12')])&&_0x4fda43[_0xdc36('0x13')]){_0x4c0614[_0x4fda43['idField']]=_0x4fda43[_0xdc36('0x14')][_0xdc36('0x15')]();}else if(_0x4fda43[_0xdc36('0x12')]===_0xdc36('0x16')&&_0x4fda43[_0xdc36('0x17')]&&_0x4fda43[_0xdc36('0x13')]&&_0x2483bd[_0x4fda43[_0xdc36('0x17')]]){_0x4c0614[_0x4fda43[_0xdc36('0x13')]]=_0x2483bd[_0x4fda43['variableName']][_0xdc36('0x15')]();}else if(_0x4fda43['type']==='customVariable'&&_0x4fda43['Variable']&&_0x4fda43[_0xdc36('0x18')][_0xdc36('0x19')]&&_0x4fda43['idField']&&_0x2483bd[_0x4fda43[_0xdc36('0x18')][_0xdc36('0x19')][_0xdc36('0x1a')]()]){_0x4c0614[_0x4fda43[_0xdc36('0x13')]]=_0x2483bd[_0x4fda43[_0xdc36('0x18')][_0xdc36('0x19')]['toLowerCase']()][_0xdc36('0x15')]();}});}return _0x4c0614;}function getName(_0x12d4bf){if(_0x12d4bf['indexOf']('\x20')>0x0){var _0x414953=_0x12d4bf[_0xdc36('0x1b')](/ (.+)/);if(_0x414953[0x1]){return _0x414953;}}return[_0x12d4bf,_0x12d4bf];}var accountsTokens={};function getAccessToken(_0x3f25f0){return new Promise(function(_0x5f15ef,_0x10aafb){if(!_[_0xdc36('0x1c')](accountsTokens[_0x3f25f0['id']])&&!_['isNil'](accountsTokens[_0x3f25f0['id']][_0xdc36('0x1d')])){if(moment()['isBefore'](accountsTokens[_0x3f25f0['id']]['expires_in'])){_0x5f15ef(accountsTokens[_0x3f25f0['id']][_0xdc36('0x1d')]);}}var _0x2b39a2;switch(_0x3f25f0[_0xdc36('0x1e')]){case'US':_0x2b39a2=_0xdc36('0x1f');break;case'AU':_0x2b39a2=_0xdc36('0x20');break;case'EU':_0x2b39a2=_0xdc36('0x21');break;case'IN':_0x2b39a2=_0xdc36('0x22');break;case'CN':_0x2b39a2=_0xdc36('0x23');break;default:_0x2b39a2='https://accounts.zoho.eu';break;}var _0x34057e={'method':'POST','uri':_0x2b39a2+_0xdc36('0x24'),'qs':{'refresh_token':_0x3f25f0[_0xdc36('0x25')],'client_id':_0x3f25f0[_0xdc36('0x26')],'client_secret':_0x3f25f0['clientSecret'],'grant_type':_0xdc36('0x27')},'json':!![]};return rp(_0x34057e)[_0xdc36('0x28')](function(_0x337091){accountsTokens[_0x3f25f0['id']]={'access_token':_0x337091['access_token'],'expires_in':moment()[_0xdc36('0x29')](_0x337091[_0xdc36('0x2a')],_0xdc36('0x2b'))};_0x5f15ef(_0x337091['access_token']);})[_0xdc36('0x2c')](function(_0x2dcef7){logger['error'](_0xdc36('0x2d'),_0x2dcef7[_0xdc36('0x2e')]);_0x10aafb(_0x2dcef7);});});}function getUser(_0x4ea2ad,_0x21151b,_0x5bba0b,_0x49bbf2){logger['info'](_0xdc36('0x2f'));return request({'method':_0xdc36('0x30'),'uri':util['format'](_0xdc36('0x31'),_0x21151b),'qs':{'type':_0xdc36('0x32')},'headers':{'Authorization':_0xdc36('0x33')+_0x4ea2ad},'json':!![]})['then'](function(_0x2a4451){if(_0x2a4451[_0xdc36('0x34')]){var _0x1d010c=-0x1;if(_[_0xdc36('0x35')](_0x2a4451[_0xdc36('0x34')])){if(!_[_0xdc36('0x1c')](_0x49bbf2)){_0x1d010c=_[_0xdc36('0x36')](_0x2a4451['users'],function(_0x16674c){return _0x16674c[_0xdc36('0x37')]===_0x49bbf2;});}if(_0x1d010c>=0x0){logger['info']('Agent\x20found!');}else{logger[_0xdc36('0x38')](_0xdc36('0x39'));_0x1d010c=_[_0xdc36('0x36')](_0x2a4451['users'],function(_0x521677){return _0x521677[_0xdc36('0x3a')][_0xdc36('0x19')]===_0xdc36('0x3b');});}return _0x2a4451[_0xdc36('0x34')][_0x1d010c];}else{if(_0x2a4451[_0xdc36('0x3c')][_0xdc36('0x3a')][_0xdc36('0x19')]===_0xdc36('0x3b')){logger[_0xdc36('0x38')](_0xdc36('0x39'));user=_0x2a4451[_0xdc36('0x3c')];return user;}else{logger['error'](_0xdc36('0x3d'),JSON[_0xdc36('0xd')](_0x2a4451));throw new Error(_0xdc36('0x3e')+JSON[_0xdc36('0xd')](_0x2a4451));}}}else{logger['error'](_0xdc36('0x3d'),JSON[_0xdc36('0xd')](_0x2a4451));throw new Error(_0xdc36('0x3e')+JSON[_0xdc36('0xd')](_0x2a4451));}})['catch'](function(_0x3c8bd5){console['error'](_0x3c8bd5);});}function getZohoUser(_0x4f82e7,_0x430c14){return new BPromise(function(_0x169c1e,_0x71ac57){request(_0x4f82e7)['then'](function(_0xde6ece){var _0x5abb6a=null;if(_0xde6ece){_0x5abb6a=_0xde6ece[_0xdc36('0x3f')][0x0];_0x5abb6a[_0xdc36('0x40')]=_0x430c14;}_0x169c1e(_0x5abb6a);})[_0xdc36('0x2c')](function(_0x54f0d4){_0x71ac57(_0x54f0d4);});});}function createEndUser(_0x34fe4d,_0x3394ca,_0xd98d42,_0x3da864,_0x50cf7b,_0x11e857){var _0xd98d42=getName(_0xd98d42);return request({'method':_0xdc36('0x41'),'uri':'https://www.zohoapis.'+_0x3394ca+'/crm/v2/'+_[_0xdc36('0x42')](_0x11e857[_0xdc36('0x43')])+'s','body':{'data':[{'Last_Name':_0xd98d42[0x1],'First_Name':_0xd98d42[0x0],'Phone':_0x3da864,'Owner':{'name':!_['isNil'](_0x50cf7b['role'][_0xdc36('0x19')])?_0x50cf7b[_0xdc36('0x44')][_0xdc36('0x19')]:!_[_0xdc36('0x1c')](_0x50cf7b[_0xdc36('0x45')])?_0x50cf7b[_0xdc36('0x45')]+'\x20'+_0x50cf7b[_0xdc36('0x46')]:_0x50cf7b[_0xdc36('0x46')],'id':_0x50cf7b['id']}}]},'headers':{'Authorization':_0xdc36('0x33')+_0x34fe4d},'json':!![]})[_0xdc36('0x28')](function(_0x1682df){if(_0x1682df&&_0x1682df[_0xdc36('0x3f')][0x0][_0xdc36('0x47')]===_0xdc36('0x48')){var _0x1f2604=_0x1682df[_0xdc36('0x3f')][0x0][_0xdc36('0x49')];_0x1f2604[_0xdc36('0x40')]=_[_0xdc36('0x42')](_0x11e857[_0xdc36('0x43')])+'s';return _0x1f2604;}logger[_0xdc36('0x4a')](_0xdc36('0x3d'),JSON[_0xdc36('0xd')](data));throw new Error(_0xdc36('0x4b')+JSON[_0xdc36('0xd')](data));})[_0xdc36('0x2c')](function(_0x557375){console[_0xdc36('0x4c')](_0xdc36('0x4d'),_0x557375);});}function getEndUser(_0x5485a1,_0x5a60e6,_0x3508c8,_0x4abae3,_0x177d9f,_0x51a276,_0x19c7fe){var _0x286de7={'method':_0xdc36('0x30'),'uri':'','headers':{'Authorization':_0xdc36('0x33')+_0x5485a1},'json':!![]};switch(_0x19c7fe[_0xdc36('0x4e')]){case _0xdc36('0x4f'):_0x286de7[_0xdc36('0x50')]=_0xdc36('0x51')+_0x5a60e6+_0xdc36('0x52')+_0x177d9f+'))';return getZohoUser(_0x286de7,_0xdc36('0x53'))[_0xdc36('0x28')](function(_0xd3e651){if(_0xd3e651)return _0xd3e651;_0x286de7[_0xdc36('0x50')]=_0xdc36('0x51')+_0x5a60e6+_0xdc36('0x54')+_0x177d9f+'))';return getZohoUser(_0x286de7,_0xdc36('0x55'))[_0xdc36('0x28')](function(_0x3399cc){if(_0x3399cc)return _0x3399cc;if(_0x19c7fe['moduleCreate']!='nothing'){return createEndUser(_0x5485a1,_0x5a60e6,_0x4abae3,_0x177d9f,_0x51a276,_0x19c7fe);}else{return{};}});});break;case _0xdc36('0x56'):_0x286de7[_0xdc36('0x50')]=_0xdc36('0x51')+_0x5a60e6+_0xdc36('0x52')+_0x177d9f+'))';return getZohoUser(_0x286de7,_0xdc36('0x53'))[_0xdc36('0x28')](function(_0x5ade8b){if(_0x5ade8b)return _0x5ade8b;if(_0x19c7fe[_0xdc36('0x43')]!=_0xdc36('0x57')){return createEndUser(_0x5485a1,_0x5a60e6,_0x4abae3,_0x177d9f,_0x51a276,_0x19c7fe);}else{return{};}});break;case _0xdc36('0x58'):_0x286de7['uri']=_0xdc36('0x51')+_0x5a60e6+_0xdc36('0x54')+_0x177d9f+'))';return getZohoUser(_0x286de7,_0xdc36('0x55'))[_0xdc36('0x28')](function(_0x3bfc00){if(_0x3bfc00)return _0x3bfc00;if(_0x19c7fe[_0xdc36('0x43')]!='nothing'){return createEndUser(_0x5485a1,_0x5a60e6,_0x4abae3,_0x177d9f,_0x51a276,_0x19c7fe);}else{return{};}});break;}}function getCall(_0x2f1707,_0x31b52c,_0x283df2,_0x18272a,_0x2d7201,_0x2b7319,_0x26775a,_0x225ffb){logger['info'](_0xdc36('0x59'));var _0x5bdc6={};_0x5bdc6[_0xdc36('0x5a')]={'name':!_[_0xdc36('0x1c')](_0x18272a[_0xdc36('0x44')][_0xdc36('0x19')])&&!_[_0xdc36('0x1c')](_0x18272a[_0xdc36('0x3a')]['name'])&&_0x18272a['profile'][_0xdc36('0x19')]===_0xdc36('0x5b')?_0x18272a['role'][_0xdc36('0x19')]:!_[_0xdc36('0x1c')](_0x18272a['first_name'])?_0x18272a['first_name']+'\x20'+_0x18272a[_0xdc36('0x46')]:_0x18272a['last_name'],'id':_0x18272a['id']};_0x5bdc6[_0xdc36('0x5c')]=intUtil['getString'](_0x2b7319[_0xdc36('0x5d')],_0x26775a,'\x20');_0x5bdc6['Description']=intUtil['getString'](_0x2b7319[_0xdc36('0x5e')],_0x26775a,'\x0a');if(_0x2d7201['enduserType']===_0xdc36('0x53')){_0x5bdc6[_0xdc36('0x5f')]={'name':!_[_0xdc36('0x1c')](_0x2d7201[_0xdc36('0x60')])?_0x2d7201[_0xdc36('0x60')]:!_['isNil'](_0x2d7201[_0xdc36('0x61')])?_0x2d7201[_0xdc36('0x61')]+'\x20'+_0x2d7201[_0xdc36('0x62')]:_0x2d7201['Last_Name'],'id':_0x2d7201['id']};}if(_0x2d7201['enduserType']===_0xdc36('0x55')){_0x5bdc6['What_Id']={'name':!_[_0xdc36('0x1c')](_0x2d7201[_0xdc36('0x60')])?_0x2d7201[_0xdc36('0x60')]:!_[_0xdc36('0x1c')](_0x2d7201['First_Name'])?_0x2d7201['First_Name']+'\x20'+_0x2d7201[_0xdc36('0x62')]:_0x2d7201[_0xdc36('0x62')],'id':_0x2d7201['id']};_0x5bdc6[_0xdc36('0x63')]=_[_0xdc36('0x42')](_0x2d7201[_0xdc36('0x40')]);}if(_0x26775a[_0xdc36('0x64')]){_0x5bdc6[_0xdc36('0x65')]=moment[_0xdc36('0x66')](parseInt(_0x26775a[_0xdc36('0x64')])*0x3e8)[_0xdc36('0x67')]('mm:ss');}else if(_0x26775a[_0xdc36('0x68')]&&_0x26775a['endtime']){_0x5bdc6[_0xdc36('0x65')]=moment[_0xdc36('0x66')](moment(_0x26775a[_0xdc36('0x69')],_0xdc36('0x6a'))[_0xdc36('0x6b')](moment(_0x26775a[_0xdc36('0x6c')],_0xdc36('0x6a'))))[_0xdc36('0x67')](_0xdc36('0x6d'));}switch(_0x26775a[_0xdc36('0x6e')]){case _0xdc36('0x6f'):_0x5bdc6[_0xdc36('0x70')]=_0xdc36('0x71');break;case _0xdc36('0x72'):case _0xdc36('0x73'):_0x5bdc6[_0xdc36('0x70')]=_0xdc36('0x74');break;case _0xdc36('0x75'):_0x5bdc6[_0xdc36('0x70')]=_0xdc36('0x76');break;case'abandoned':_0x5bdc6[_0xdc36('0x70')]=_0xdc36('0x77');break;case _0xdc36('0x78'):_0x5bdc6[_0xdc36('0x70')]=_0xdc36('0x79');default:}_0x5bdc6[_0xdc36('0x7a')]=(_0x225ffb==='outbound'?moment(_0x26775a[_0xdc36('0x6c')])[_0xdc36('0x67')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x26775a['agentcalledAt'])[_0xdc36('0x67')](_0xdc36('0x6a')))||moment()[_0xdc36('0x67')]('YYYY-MM-DDTHH:mm:ss');_0x5bdc6['Call_Type']=_0x225ffb||_0xdc36('0x7b');_0x5bdc6=_[_0xdc36('0x7c')](_0x5bdc6,getCustomFields(_0x2b7319['Fields'],_0x26775a));return request({'method':'POST','uri':_0xdc36('0x51')+_0x31b52c+_0xdc36('0x7d'),'headers':{'Authorization':_0xdc36('0x33')+_0x2f1707},'body':{'data':[_0x5bdc6]},'json':!![]})[_0xdc36('0x28')](function(_0x118c99){if(_0x118c99&&_0x118c99[_0xdc36('0x3f')][0x0][_0xdc36('0x47')]===_0xdc36('0x48')){logger['info'](_0xdc36('0x7e'));return{'id':_0x118c99['data'][0x0]['details']['id']};}})['catch'](function(_0x150515){logger[_0xdc36('0x38')](_0xdc36('0x7f'),_0x150515[_0xdc36('0x2e')]);console['log'](_0xdc36('0x7f'),_0x150515);});}exports[_0xdc36('0x80')]=function(_0x3c8aac,_0x1f4d20,_0xda6914,_0x481968,_0x4ff220,_0x48b13a){var _0x51148b,_0x277d13,_0x398272;_0x48b13a[_0xdc36('0x81')]=intUtil[_0xdc36('0x82')](_0x48b13a[_0xdc36('0x81')]);_0x48b13a[_0xdc36('0x83')]=intUtil[_0xdc36('0x82')](_0x48b13a[_0xdc36('0x83')]);if(_0x4ff220&&_0x4ff220[_0xdc36('0x84')]){logger['info'](_0xdc36('0x85'),_0xdc36('0x86'));_0x1f4d20['recordingURL']=_0x48b13a['serverUrl']+_0xdc36('0x87')+_0x1f4d20['uniqueid']+_0xdc36('0x88')+md5(_0x1f4d20['uniqueid']);}else{_0x1f4d20[_0xdc36('0x89')]='';}var _0x3667a2=_0x48b13a[_0xdc36('0x81')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x48b13a)['then'](function(_0x311024){_0x398272=_0x311024;return getUser(_0x398272,_0x3667a2,_0x48b13a,_0x481968[_0xdc36('0x37')]);})[_0xdc36('0x28')](function(_0x3a699d){_0x51148b=_0x3a699d;logger[_0xdc36('0x38')]('The\x20User\x20ID\x20is:',_0x51148b['id']);return getEndUser(_0x398272,_0x3667a2,_0x48b13a,_0x1f4d20[_0xdc36('0x8a')],_0x1f4d20[_0xdc36('0x8b')],_0x51148b,_0xda6914);})[_0xdc36('0x28')](function(_0x5eb18b){_0x277d13=_0x5eb18b;return getCall(_0x398272,_0x3667a2,_0x48b13a,_0x51148b,_0x277d13,_0xda6914,_0x1f4d20,'Inbound');})[_0xdc36('0x28')](function(_0x705e1e){if(_0x705e1e){logger[_0xdc36('0x38')](_0xdc36('0x8c'),_0x705e1e['id']);logger[_0xdc36('0x38')](_0xdc36('0x85'),_0xdc36('0x8d'));emit(util[_0xdc36('0x67')](_0xdc36('0x8e'),_0x481968[_0xdc36('0x19')]),'trigger:browser:url',{'uri':'https://crm.'+_0x48b13a['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x705e1e['id']});}})[_0xdc36('0x2c')](function(_0x329b49){logger[_0xdc36('0x4a')]('[QUEUE]',JSON[_0xdc36('0xd')](_0x329b49));});};exports[_0xdc36('0x8f')]=function(_0x26b38e,_0x192316,_0x594be6,_0x8822f1,_0x17ca8a,_0x111f62,_0x209cb6){var _0x81fdbf,_0xae33f3,_0x1d9196;_0x111f62[_0xdc36('0x81')]=intUtil[_0xdc36('0x82')](_0x111f62[_0xdc36('0x81')]);_0x111f62[_0xdc36('0x83')]=intUtil[_0xdc36('0x82')](_0x111f62['serverUrl']);if(_0x209cb6&&_0x209cb6[_0xdc36('0x90')]&&_0x209cb6[_0xdc36('0x90')]!==_0xdc36('0x91')){logger[_0xdc36('0x38')](_0xdc36('0x92'),'Recording\x20is\x20enabled!');_0x192316[_0xdc36('0x89')]=_0x111f62[_0xdc36('0x83')]+'/api/voice/recordings/'+_0x192316[_0xdc36('0x93')]+_0xdc36('0x88')+md5(_0x192316[_0xdc36('0x93')]);}var _0x4f99d1=_0x111f62[_0xdc36('0x81')]===_0xdc36('0x94')?'eu':_0xdc36('0x95');return getAccessToken(_0x111f62)[_0xdc36('0x28')](function(_0x137130){_0x1d9196=_0x137130;return getUser(_0x1d9196,_0x4f99d1,_0x111f62,_0x8822f1[_0xdc36('0x37')]);})[_0xdc36('0x28')](function(_0x202cac){_0x81fdbf=_0x202cac;logger['info'](_0xdc36('0x96'),_0x81fdbf['id']);return getEndUser(_0x1d9196,_0x4f99d1,_0x111f62,_0x192316['destcalleridname'],_0x192316[_0xdc36('0x97')],_0x81fdbf,_0x594be6);})[_0xdc36('0x28')](function(_0x3d2031){_0xae33f3=_0x3d2031;return getCall(_0x1d9196,_0x4f99d1,_0x111f62,_0x81fdbf,_0xae33f3,_0x594be6,_0x192316,_0xdc36('0x98'));})[_0xdc36('0x28')](function(_0x3920db){if(_0x3920db){logger[_0xdc36('0x38')]('The\x20Call\x20ID\x20is:',_0x3920db['id']);logger[_0xdc36('0x38')](_0xdc36('0x92'),_0xdc36('0x8d'));emit(util[_0xdc36('0x67')]('user:%s',_0x8822f1[_0xdc36('0x19')]),_0xdc36('0x99'),{'uri':_0xdc36('0x9a')+_0x111f62[_0xdc36('0x81')]+_0xdc36('0x9b')+_0x3920db['id']});}})['catch'](function(_0x4b7f8d){logger[_0xdc36('0x4a')](_0xdc36('0x92'),JSON['stringify'](_0x4b7f8d));});};exports[_0xdc36('0x9c')]=function(_0x10edfb,_0x41b0e0,_0x26fc14,_0x3d8aaf,_0x47d6ac,_0x3addfd){var _0xb72679,_0x564eb0,_0x29edce;_0x3addfd[_0xdc36('0x81')]=intUtil[_0xdc36('0x82')](_0x3addfd[_0xdc36('0x81')]);_0x3addfd[_0xdc36('0x83')]=intUtil[_0xdc36('0x82')](_0x3addfd[_0xdc36('0x83')]);if(_0x47d6ac&&_0x47d6ac['monitor_format']){logger[_0xdc36('0x38')]('['+_0x41b0e0[_0xdc36('0x6e')][_0xdc36('0x9d')]()+']',_0xdc36('0x86'));_0x41b0e0[_0xdc36('0x89')]=_0x3addfd['serverUrl']+_0xdc36('0x87')+_0x41b0e0[_0xdc36('0x93')]+'/downloads?type=uniqueid&token='+md5(_0x41b0e0[_0xdc36('0x93')]);}else{_0x41b0e0[_0xdc36('0x89')]='';}var _0x446dff=_0x3addfd[_0xdc36('0x81')]==='zoho.eu'?'eu':_0xdc36('0x95');return getAccessToken(_0x3addfd)['then'](function(_0x3424e4){_0x29edce=_0x3424e4;return getUser(_0x29edce,_0x446dff,_0x3addfd);})[_0xdc36('0x28')](function(_0x3b59e5){_0xb72679=_0x3b59e5;logger[_0xdc36('0x38')](_0xdc36('0x96'),_0xb72679['id']);return getEndUser(_0x29edce,_0x446dff,_0x3addfd,_0x41b0e0[_0xdc36('0x8a')],_0x41b0e0[_0xdc36('0x8b')],_0xb72679,_0x26fc14);})['then'](function(_0x992eb1){_0x564eb0=_0x992eb1;return getCall(_0x29edce,_0x446dff,_0x3addfd,_0xb72679,_0x564eb0,_0x26fc14,_0x41b0e0,_0xdc36('0x7b'));})[_0xdc36('0x28')](function(_0x41c710){if(_0x41c710){logger[_0xdc36('0x38')]('The\x20Call\x20ID\x20is:',_0x41c710['id']);}})[_0xdc36('0x2c')](function(_0x13f5b9){logger[_0xdc36('0x4a')]('['+_0x41b0e0[_0xdc36('0x6e')][_0xdc36('0x9d')]()+']',JSON[_0xdc36('0xd')](_0x13f5b9));});}; \ No newline at end of file +var _0x758e=['variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','isArrayLikeObject','findIndex','email','users','profile','Administrator','Using\x20the\x20admin\x20account!','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','startCase','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','Contacts','then','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Who_Id','Full_Name','First_Name','Last_Name','$se_module','Call_Duration','talktime','mm:ss','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','Call_Result','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','Fields','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','[OUTBOUND]','destcalleridnum','Outbound','unmanaged','monitor_format','toUpperCase','lodash','util','./util','moment','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','[HTTP]','stringify','forEach','includes','picklist','idField','content','toString','type'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x758e,0x1af));var _0xe758=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x758e[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xe758('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xe758('0x1'));var intUtil=require(_0xe758('0x2'));var moment=require(_0xe758('0x3'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0xe758('0x4'));var logger=require(_0xe758('0x5'))(_0xe758('0x6'));config[_0xe758('0x7')]=_['defaults'](config[_0xe758('0x7')],{'host':_0xe758('0x8'),'port':0x18eb});var io=require(_0xe758('0x9'))(new Redis(config['redis']));function emit(_0x4c03ba,_0x454ee0,_0x55601a){io['to'](_0x4c03ba)['emit'](_0x454ee0,_0x55601a);}function request(_0x4c16c3){logger['debug'](_0xe758('0xa'),JSON[_0xe758('0xb')](_0x4c16c3));return rp(_0x4c16c3);}function getCustomFields(_0xa84160,_0x4cdd20){var _0x3971f7={};if(_0xa84160['length']>0x0){_[_0xe758('0xc')](_0xa84160,function(_0x38131a){if(_[_0xe758('0xd')](['string',_0xe758('0xe')],_0x38131a['type'])&&_0x38131a[_0xe758('0xf')]){_0x3971f7[_0x38131a[_0xe758('0xf')]]=_0x38131a[_0xe758('0x10')][_0xe758('0x11')]();}else if(_0x38131a[_0xe758('0x12')]===_0xe758('0x13')&&_0x38131a[_0xe758('0x14')]&&_0x38131a[_0xe758('0xf')]&&_0x4cdd20[_0x38131a[_0xe758('0x14')]]){_0x3971f7[_0x38131a['idField']]=_0x4cdd20[_0x38131a[_0xe758('0x14')]]['toString']();}else if(_0x38131a['type']===_0xe758('0x15')&&_0x38131a[_0xe758('0x16')]&&_0x38131a['Variable']['name']&&_0x38131a[_0xe758('0xf')]&&_0x4cdd20[_0x38131a[_0xe758('0x16')][_0xe758('0x17')][_0xe758('0x18')]()]){_0x3971f7[_0x38131a[_0xe758('0xf')]]=_0x4cdd20[_0x38131a[_0xe758('0x16')]['name']['toLowerCase']()][_0xe758('0x11')]();}});}return _0x3971f7;}function getName(_0x2b5729){if(_0x2b5729[_0xe758('0x19')]('\x20')>0x0){var _0x1dc8fc=_0x2b5729[_0xe758('0x1a')](/ (.+)/);if(_0x1dc8fc[0x1]){return _0x1dc8fc;}}return[_0x2b5729,_0x2b5729];}var accountsTokens={};function getAccessToken(_0x4d35d3){return new Promise(function(_0x4eeb82,_0x2a490f){if(!_[_0xe758('0x1b')](accountsTokens[_0x4d35d3['id']])&&!_[_0xe758('0x1b')](accountsTokens[_0x4d35d3['id']][_0xe758('0x1c')])){if(moment()['isBefore'](accountsTokens[_0x4d35d3['id']][_0xe758('0x1d')])){_0x4eeb82(accountsTokens[_0x4d35d3['id']][_0xe758('0x1c')]);}}var _0x19373a;switch(_0x4d35d3[_0xe758('0x1e')]){case'US':_0x19373a=_0xe758('0x1f');break;case'AU':_0x19373a=_0xe758('0x20');break;case'EU':_0x19373a=_0xe758('0x21');break;case'IN':_0x19373a='https://accounts.zoho.in';break;case'CN':_0x19373a='https://accounts.zoho.com.cn';break;default:_0x19373a='https://accounts.zoho.eu';break;}var _0x4e3828={'method':_0xe758('0x22'),'uri':_0x19373a+_0xe758('0x23'),'qs':{'refresh_token':_0x4d35d3[_0xe758('0x24')],'client_id':_0x4d35d3[_0xe758('0x25')],'client_secret':_0x4d35d3['clientSecret'],'grant_type':_0xe758('0x26')},'json':!![]};return rp(_0x4e3828)['then'](function(_0x3bcdac){accountsTokens[_0x4d35d3['id']]={'access_token':_0x3bcdac['access_token'],'expires_in':moment()['add'](_0x3bcdac[_0xe758('0x1d')],_0xe758('0x27'))};_0x4eeb82(_0x3bcdac[_0xe758('0x1c')]);})[_0xe758('0x28')](function(_0x5d557b){logger[_0xe758('0x29')](_0xe758('0x2a'),_0x5d557b[_0xe758('0x2b')]);_0x2a490f(_0x5d557b);});});}function getUser(_0x1934d9,_0x52279e,_0x3a7e96,_0x596835){logger[_0xe758('0x2c')](_0xe758('0x2d'));return request({'method':_0xe758('0x2e'),'uri':util[_0xe758('0x2f')](_0xe758('0x30'),_0x52279e),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1934d9},'json':!![]})['then'](function(_0x450271){if(_0x450271['users']){var _0x44f767=-0x1;if(_[_0xe758('0x31')](_0x450271['users'])){if(!_['isNil'](_0x596835)){_0x44f767=_[_0xe758('0x32')](_0x450271['users'],function(_0xcd9e89){return _0xcd9e89[_0xe758('0x33')]===_0x596835;});}if(_0x44f767>=0x0){logger[_0xe758('0x2c')]('Agent\x20found!');}else{logger[_0xe758('0x2c')]('Using\x20the\x20admin\x20account!');_0x44f767=_[_0xe758('0x32')](_0x450271[_0xe758('0x34')],function(_0x5a01e1){return _0x5a01e1[_0xe758('0x35')][_0xe758('0x17')]===_0xe758('0x36');});}return _0x450271['users'][_0x44f767];}else{if(_0x450271['user'][_0xe758('0x35')]['name']===_0xe758('0x36')){logger[_0xe758('0x2c')](_0xe758('0x37'));user=_0x450271[_0xe758('0x38')];return user;}else{logger[_0xe758('0x29')](_0xe758('0x39'),JSON['stringify'](_0x450271));throw new Error(_0xe758('0x3a')+JSON['stringify'](_0x450271));}}}else{logger['error'](_0xe758('0x39'),JSON[_0xe758('0xb')](_0x450271));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xe758('0xb')](_0x450271));}})[_0xe758('0x28')](function(_0x473711){console['error'](_0x473711);});}function getZohoUser(_0x2a003b,_0x32457e){return new BPromise(function(_0x43403a,_0xaa0351){request(_0x2a003b)['then'](function(_0x1facc6){var _0x6f31e1=null;if(_0x1facc6){_0x6f31e1=_0x1facc6[_0xe758('0x3b')][0x0];_0x6f31e1[_0xe758('0x3c')]=_0x32457e;}_0x43403a(_0x6f31e1);})['catch'](function(_0x392e1a){_0xaa0351(_0x392e1a);});});}function createEndUser(_0x528b68,_0x50304f,_0x36e6e7,_0x28ecd9,_0x932fad,_0x57190e){var _0x36e6e7=getName(_0x36e6e7);return request({'method':_0xe758('0x22'),'uri':_0xe758('0x3d')+_0x50304f+_0xe758('0x3e')+_['startCase'](_0x57190e[_0xe758('0x3f')])+'s','body':{'data':[{'Last_Name':_0x36e6e7[0x1],'First_Name':_0x36e6e7[0x0],'Phone':_0x28ecd9,'Owner':{'name':!_[_0xe758('0x1b')](_0x932fad[_0xe758('0x40')][_0xe758('0x17')])?_0x932fad['role'][_0xe758('0x17')]:!_['isNil'](_0x932fad[_0xe758('0x41')])?_0x932fad[_0xe758('0x41')]+'\x20'+_0x932fad['last_name']:_0x932fad[_0xe758('0x42')],'id':_0x932fad['id']}}]},'headers':{'Authorization':_0xe758('0x43')+_0x528b68},'json':!![]})['then'](function(_0x42469a){if(_0x42469a&&_0x42469a[_0xe758('0x3b')][0x0][_0xe758('0x44')]===_0xe758('0x45')){var _0x1aec7b=_0x42469a[_0xe758('0x3b')][0x0][_0xe758('0x46')];_0x1aec7b[_0xe758('0x3c')]=_[_0xe758('0x47')](_0x57190e['moduleCreate'])+'s';return _0x1aec7b;}logger['error']('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error(_0xe758('0x48')+JSON[_0xe758('0xb')](data));})[_0xe758('0x28')](function(_0xb18ce1){console[_0xe758('0x49')](_0xe758('0x4a'),_0xb18ce1);});}function getEndUser(_0x5f5a88,_0x63b899,_0x1a29cd,_0x550903,_0x544993,_0x252000,_0x2d96d7){var _0x3d3d6f={'method':_0xe758('0x2e'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5f5a88},'json':!![]};switch(_0x2d96d7[_0xe758('0x4b')]){case _0xe758('0x4c'):_0x3d3d6f[_0xe758('0x4d')]='https://www.zohoapis.'+_0x63b899+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x544993+'))';return getZohoUser(_0x3d3d6f,_0xe758('0x4e'))[_0xe758('0x4f')](function(_0x26abce){if(_0x26abce)return _0x26abce;_0x3d3d6f[_0xe758('0x4d')]=_0xe758('0x3d')+_0x63b899+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x544993+'))';return getZohoUser(_0x3d3d6f,_0xe758('0x50'))[_0xe758('0x4f')](function(_0x58ebcc){if(_0x58ebcc)return _0x58ebcc;if(_0x2d96d7['moduleCreate']!=_0xe758('0x51')){return createEndUser(_0x5f5a88,_0x63b899,_0x550903,_0x544993,_0x252000,_0x2d96d7);}else{return{};}});});break;case _0xe758('0x52'):_0x3d3d6f['uri']=_0xe758('0x3d')+_0x63b899+_0xe758('0x53')+_0x544993+'))';return getZohoUser(_0x3d3d6f,_0xe758('0x4e'))['then'](function(_0x344bea){if(_0x344bea)return _0x344bea;if(_0x2d96d7[_0xe758('0x3f')]!='nothing'){return createEndUser(_0x5f5a88,_0x63b899,_0x550903,_0x544993,_0x252000,_0x2d96d7);}else{return{};}});break;case _0xe758('0x54'):_0x3d3d6f[_0xe758('0x4d')]='https://www.zohoapis.'+_0x63b899+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x544993+'))';return getZohoUser(_0x3d3d6f,_0xe758('0x50'))[_0xe758('0x4f')](function(_0x16bf26){if(_0x16bf26)return _0x16bf26;if(_0x2d96d7[_0xe758('0x3f')]!=_0xe758('0x51')){return createEndUser(_0x5f5a88,_0x63b899,_0x550903,_0x544993,_0x252000,_0x2d96d7);}else{return{};}});break;}}function getCall(_0x29bc4e,_0x158fb3,_0x1c8364,_0x5a0348,_0xb02e52,_0x457b5d,_0x30d61d,_0x5f50d8){logger['info'](_0xe758('0x55'));var _0x4d66a1={};_0x4d66a1[_0xe758('0x56')]={'name':!_[_0xe758('0x1b')](_0x5a0348['role'][_0xe758('0x17')])&&!_[_0xe758('0x1b')](_0x5a0348[_0xe758('0x35')][_0xe758('0x17')])&&_0x5a0348['profile'][_0xe758('0x17')]===_0xe758('0x57')?_0x5a0348['role'][_0xe758('0x17')]:!_['isNil'](_0x5a0348['first_name'])?_0x5a0348[_0xe758('0x41')]+'\x20'+_0x5a0348[_0xe758('0x42')]:_0x5a0348[_0xe758('0x42')],'id':_0x5a0348['id']};_0x4d66a1[_0xe758('0x58')]=intUtil[_0xe758('0x59')](_0x457b5d[_0xe758('0x5a')],_0x30d61d,'\x20');_0x4d66a1['Description']=intUtil[_0xe758('0x59')](_0x457b5d['Descriptions'],_0x30d61d,'\x0a');if(_0xb02e52[_0xe758('0x3c')]==='Contacts'){_0x4d66a1[_0xe758('0x5b')]={'name':!_[_0xe758('0x1b')](_0xb02e52[_0xe758('0x5c')])?_0xb02e52[_0xe758('0x5c')]:!_['isNil'](_0xb02e52[_0xe758('0x5d')])?_0xb02e52['First_Name']+'\x20'+_0xb02e52[_0xe758('0x5e')]:_0xb02e52['Last_Name'],'id':_0xb02e52['id']};}if(_0xb02e52[_0xe758('0x3c')]===_0xe758('0x50')){_0x4d66a1['What_Id']={'name':!_[_0xe758('0x1b')](_0xb02e52['Full_Name'])?_0xb02e52[_0xe758('0x5c')]:!_[_0xe758('0x1b')](_0xb02e52['First_Name'])?_0xb02e52[_0xe758('0x5d')]+'\x20'+_0xb02e52['Last_Name']:_0xb02e52[_0xe758('0x5e')],'id':_0xb02e52['id']};_0x4d66a1[_0xe758('0x5f')]=_[_0xe758('0x47')](_0xb02e52[_0xe758('0x3c')]);}if(_0x30d61d['talktime']){_0x4d66a1[_0xe758('0x60')]=moment['utc'](parseInt(_0x30d61d[_0xe758('0x61')])*0x3e8)[_0xe758('0x2f')](_0xe758('0x62'));}else if(_0x30d61d[_0xe758('0x63')]&&_0x30d61d[_0xe758('0x64')]){_0x4d66a1['Call_Duration']=moment[_0xe758('0x65')](moment(_0x30d61d[_0xe758('0x64')],_0xe758('0x66'))['diff'](moment(_0x30d61d[_0xe758('0x67')],'YYYY-MM-DDTHH:mm:ss')))[_0xe758('0x2f')](_0xe758('0x62'));}switch(_0x30d61d[_0xe758('0x68')]){case'called':_0x4d66a1[_0xe758('0x69')]='Called';break;case _0xe758('0x6a'):case _0xe758('0x6b'):_0x4d66a1[_0xe758('0x69')]=_0xe758('0x6c');break;case _0xe758('0x6d'):_0x4d66a1[_0xe758('0x69')]=_0xe758('0x6e');break;case _0xe758('0x6f'):_0x4d66a1[_0xe758('0x69')]=_0xe758('0x70');break;case _0xe758('0x71'):_0x4d66a1[_0xe758('0x69')]=_0xe758('0x72');default:}_0x4d66a1[_0xe758('0x73')]=(_0x5f50d8===_0xe758('0x74')?moment(_0x30d61d[_0xe758('0x67')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x30d61d['agentcalledAt'])[_0xe758('0x2f')](_0xe758('0x66')))||moment()[_0xe758('0x2f')](_0xe758('0x66'));_0x4d66a1[_0xe758('0x75')]=_0x5f50d8||_0xe758('0x76');_0x4d66a1=_[_0xe758('0x77')](_0x4d66a1,getCustomFields(_0x457b5d[_0xe758('0x78')],_0x30d61d));return request({'method':_0xe758('0x22'),'uri':_0xe758('0x3d')+_0x158fb3+'/crm/v2/Calls','headers':{'Authorization':_0xe758('0x43')+_0x29bc4e},'body':{'data':[_0x4d66a1]},'json':!![]})[_0xe758('0x4f')](function(_0x108758){if(_0x108758&&_0x108758[_0xe758('0x3b')][0x0][_0xe758('0x44')]===_0xe758('0x45')){logger[_0xe758('0x2c')](_0xe758('0x79'));return{'id':_0x108758['data'][0x0][_0xe758('0x46')]['id']};}})[_0xe758('0x28')](function(_0x53809b){logger[_0xe758('0x2c')]('err',_0x53809b[_0xe758('0x2b')]);console['log'](_0xe758('0x7a'),_0x53809b);});}exports[_0xe758('0x7b')]=function(_0x1d05ee,_0x259a78,_0x3aea99,_0x1268b4,_0x4e61e5,_0x463ae7){var _0x4411fa,_0x2abe24,_0x3aa291;_0x463ae7[_0xe758('0x7c')]=intUtil[_0xe758('0x7d')](_0x463ae7[_0xe758('0x7c')]);_0x463ae7[_0xe758('0x7e')]=intUtil[_0xe758('0x7d')](_0x463ae7[_0xe758('0x7e')]);if(_0x4e61e5&&_0x4e61e5['monitor_format']){logger[_0xe758('0x2c')]('[QUEUE]',_0xe758('0x7f'));_0x259a78[_0xe758('0x80')]=_0x463ae7['serverUrl']+_0xe758('0x81')+_0x259a78['uniqueid']+_0xe758('0x82')+md5(_0x259a78[_0xe758('0x83')]);}else{_0x259a78[_0xe758('0x80')]='';}var _0x405adf=_0x463ae7[_0xe758('0x7c')]===_0xe758('0x84')?'eu':_0xe758('0x85');return getAccessToken(_0x463ae7)[_0xe758('0x4f')](function(_0x2b8c69){_0x3aa291=_0x2b8c69;return getUser(_0x3aa291,_0x405adf,_0x463ae7,_0x1268b4[_0xe758('0x33')]);})['then'](function(_0x14c7d7){_0x4411fa=_0x14c7d7;logger[_0xe758('0x2c')](_0xe758('0x86'),_0x4411fa['id']);return getEndUser(_0x3aa291,_0x405adf,_0x463ae7,_0x259a78[_0xe758('0x87')],_0x259a78[_0xe758('0x88')],_0x4411fa,_0x3aea99);})[_0xe758('0x4f')](function(_0x4fb550){_0x2abe24=_0x4fb550;return getCall(_0x3aa291,_0x405adf,_0x463ae7,_0x4411fa,_0x2abe24,_0x3aea99,_0x259a78,_0xe758('0x76'));})[_0xe758('0x4f')](function(_0x3a41c2){if(_0x3a41c2){logger[_0xe758('0x2c')](_0xe758('0x89'),_0x3a41c2['id']);logger[_0xe758('0x2c')](_0xe758('0x8a'),_0xe758('0x8b'));emit(util[_0xe758('0x2f')](_0xe758('0x8c'),_0x1268b4['name']),'trigger:browser:url',{'uri':_0xe758('0x8d')+_0x463ae7['host']+_0xe758('0x8e')+_0x3a41c2['id']});}})[_0xe758('0x28')](function(_0x12da60){logger[_0xe758('0x29')](_0xe758('0x8a'),JSON[_0xe758('0xb')](_0x12da60));});};exports[_0xe758('0x74')]=function(_0x2f03d6,_0x269610,_0x440c46,_0x34412b,_0x329604,_0x2a190a,_0x955859){var _0x4cf9a7,_0x5559e3,_0x4d887a;_0x2a190a[_0xe758('0x7c')]=intUtil[_0xe758('0x7d')](_0x2a190a[_0xe758('0x7c')]);_0x2a190a[_0xe758('0x7e')]=intUtil[_0xe758('0x7d')](_0x2a190a[_0xe758('0x7e')]);if(_0x955859&&_0x955859['recordingFormat']&&_0x955859[_0xe758('0x8f')]!=='none'){logger[_0xe758('0x2c')](_0xe758('0x90'),_0xe758('0x7f'));_0x269610[_0xe758('0x80')]=_0x2a190a[_0xe758('0x7e')]+_0xe758('0x81')+_0x269610[_0xe758('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x269610[_0xe758('0x83')]);}var _0x3aedbe=_0x2a190a['host']===_0xe758('0x84')?'eu':'com';return getAccessToken(_0x2a190a)[_0xe758('0x4f')](function(_0x864cee){_0x4d887a=_0x864cee;return getUser(_0x4d887a,_0x3aedbe,_0x2a190a,_0x34412b[_0xe758('0x33')]);})[_0xe758('0x4f')](function(_0x21268b){_0x4cf9a7=_0x21268b;logger['info'](_0xe758('0x86'),_0x4cf9a7['id']);return getEndUser(_0x4d887a,_0x3aedbe,_0x2a190a,_0x269610['destcalleridname'],_0x269610[_0xe758('0x91')],_0x4cf9a7,_0x440c46);})[_0xe758('0x4f')](function(_0x16a134){_0x5559e3=_0x16a134;return getCall(_0x4d887a,_0x3aedbe,_0x2a190a,_0x4cf9a7,_0x5559e3,_0x440c46,_0x269610,_0xe758('0x92'));})[_0xe758('0x4f')](function(_0x5555b9){if(_0x5555b9){logger['info'](_0xe758('0x89'),_0x5555b9['id']);logger[_0xe758('0x2c')](_0xe758('0x90'),_0xe758('0x8b'));emit(util[_0xe758('0x2f')](_0xe758('0x8c'),_0x34412b[_0xe758('0x17')]),'trigger:browser:url',{'uri':_0xe758('0x8d')+_0x2a190a['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x5555b9['id']});}})[_0xe758('0x28')](function(_0x5c3465){logger[_0xe758('0x29')](_0xe758('0x90'),JSON[_0xe758('0xb')](_0x5c3465));});};exports[_0xe758('0x93')]=function(_0x5bd737,_0x4474b2,_0x3ab804,_0x5a7986,_0x36b59f,_0x373d24){var _0x43d9cd,_0x4c1b32,_0x1d8600;_0x373d24[_0xe758('0x7c')]=intUtil['stripTrailingSlash'](_0x373d24[_0xe758('0x7c')]);_0x373d24['serverUrl']=intUtil['stripTrailingSlash'](_0x373d24[_0xe758('0x7e')]);if(_0x36b59f&&_0x36b59f[_0xe758('0x94')]){logger[_0xe758('0x2c')]('['+_0x4474b2[_0xe758('0x68')][_0xe758('0x95')]()+']',_0xe758('0x7f'));_0x4474b2[_0xe758('0x80')]=_0x373d24[_0xe758('0x7e')]+_0xe758('0x81')+_0x4474b2[_0xe758('0x83')]+_0xe758('0x82')+md5(_0x4474b2[_0xe758('0x83')]);}else{_0x4474b2[_0xe758('0x80')]='';}var _0x57a702=_0x373d24['host']===_0xe758('0x84')?'eu':'com';return getAccessToken(_0x373d24)['then'](function(_0x401caa){_0x1d8600=_0x401caa;return getUser(_0x1d8600,_0x57a702,_0x373d24);})[_0xe758('0x4f')](function(_0x5127fa){_0x43d9cd=_0x5127fa;logger[_0xe758('0x2c')](_0xe758('0x86'),_0x43d9cd['id']);return getEndUser(_0x1d8600,_0x57a702,_0x373d24,_0x4474b2[_0xe758('0x87')],_0x4474b2['calleridnum'],_0x43d9cd,_0x3ab804);})[_0xe758('0x4f')](function(_0x3ce595){_0x4c1b32=_0x3ce595;return getCall(_0x1d8600,_0x57a702,_0x373d24,_0x43d9cd,_0x4c1b32,_0x3ab804,_0x4474b2,_0xe758('0x76'));})[_0xe758('0x4f')](function(_0x2ad7c2){if(_0x2ad7c2){logger['info'](_0xe758('0x89'),_0x2ad7c2['id']);}})[_0xe758('0x28')](function(_0x45be6e){logger[_0xe758('0x29')]('['+_0x4474b2[_0xe758('0x68')][_0xe758('0x95')]()+']',JSON['stringify'](_0x45be6e));});}; \ 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 144d943..e5573e0 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 _0x6de5=['info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache','data2','data3','render','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s'];(function(_0x4fff72,_0xfef5cf){var _0x12ef81=function(_0x1e6554){while(--_0x1e6554){_0x4fff72['push'](_0x4fff72['shift']());}};_0x12ef81(++_0xfef5cf);}(_0x6de5,0x1ed));var _0x56de=function(_0x1e5536,_0x27d111){_0x1e5536=_0x1e5536-0x0;var _0x251027=_0x6de5[_0x1e5536];return _0x251027;};'use strict';var util=require('util');var sh=require(_0x56de('0x0'));var Mustache=require(_0x56de('0x1'));var logger=require('../../../../config/logger')('trigger');exports['exec']=function(_0x5bb16,_0xfd876a){var _0x4c2cd6=_0x5bb16[_0x56de('0x2')]?_0x5bb16[_0x56de('0x2')]:'Script';var _0x364fd7=_0x5bb16[_0x56de('0x3')]?Mustache[_0x56de('0x4')](_0x5bb16[_0x56de('0x3')],_0xfd876a):_0xfd876a;sh['exec'](_0x364fd7,function(_0x52c888,_0x54bf7a,_0x18db41){if(_0x52c888!==0x0){logger[_0x56de('0x5')](util['format'](_0x56de('0x6'),_0x4c2cd6,_0x364fd7,_0x52c888,_0x18db41));}else{logger[_0x56de('0x7')](util[_0x56de('0x8')](_0x56de('0x9'),_0x4c2cd6,_0x364fd7,_0x54bf7a));}});}; \ No newline at end of file +var _0x6c74=['%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','mustache','../../../../config/logger','trigger','exec','data2','Script','data3','error','format'];(function(_0x5b2a20,_0x53a830){var _0x9d623a=function(_0x312009){while(--_0x312009){_0x5b2a20['push'](_0x5b2a20['shift']());}};_0x9d623a(++_0x53a830);}(_0x6c74,0x12e));var _0x46c7=function(_0x2d0bf6,_0x45cf09){_0x2d0bf6=_0x2d0bf6-0x0;var _0x552e9a=_0x6c74[_0x2d0bf6];return _0x552e9a;};'use strict';var util=require(_0x46c7('0x0'));var sh=require('shelljs');var Mustache=require(_0x46c7('0x1'));var logger=require(_0x46c7('0x2'))(_0x46c7('0x3'));exports[_0x46c7('0x4')]=function(_0x42513f,_0x9ba7b8){var _0x50fd89=_0x42513f[_0x46c7('0x5')]?_0x42513f['data2']:_0x46c7('0x6');var _0x3f828c=_0x42513f[_0x46c7('0x7')]?Mustache['render'](_0x42513f['data3'],_0x9ba7b8):_0x9ba7b8;sh[_0x46c7('0x4')](_0x3f828c,function(_0xeb7279,_0x497401,_0x2ac3ce){if(_0xeb7279!==0x0){logger[_0x46c7('0x8')](util[_0x46c7('0x9')](_0x46c7('0xa'),_0x50fd89,_0x3f828c,_0xeb7279,_0x2ac3ce));}else{logger[_0x46c7('0xb')](util[_0x46c7('0x9')](_0x46c7('0xc'),_0x50fd89,_0x3f828c,_0x497401));}});}; \ 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 639db0c..c892315 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 _0xf688=['data6','error','stack','toUpperCase','DELETE','POST','PUT','data7','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','format','then','isNil',',\x20request\x20body:\x20','object','stringify','data2','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','render','data5','number','headers','parse'];(function(_0x1beae1,_0x1981ac){var _0x99ab21=function(_0x409b2d){while(--_0x409b2d){_0x1beae1['push'](_0x1beae1['shift']());}};_0x99ab21(++_0x1981ac);}(_0xf688,0x9d));var _0x8f68=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf688[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0x8f68('0x0'));var util=require(_0x8f68('0x1'));var _=require(_0x8f68('0x2'));var Mustache=require(_0x8f68('0x3'));var logger=require(_0x8f68('0x4'))(_0x8f68('0x5'));exports[_0x8f68('0x6')]=function(_0x35ea7c,_0x336a7d){var _0x1c68c3,_0x4e0bff;var _0x53ca9f={'method':_0x35ea7c[_0x8f68('0x7')]['toUpperCase'](),'uri':Mustache[_0x8f68('0x8')](_0x35ea7c['data2'],_0x336a7d),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x35ea7c[_0x8f68('0x9')])===_0x8f68('0xa')&&parseInt(_0x35ea7c['data5'])>=0x1&&parseInt(_0x35ea7c[_0x8f68('0x9')])<=0xa?parseInt(_0x35ea7c[_0x8f68('0x9')])*0x3e8:0x5*0x3e8};try{_0x53ca9f[_0x8f68('0xb')]=_0x35ea7c['data6']?JSON[_0x8f68('0xc')](Mustache['render'](_0x35ea7c[_0x8f68('0xd')],_0x336a7d)):{};}catch(_0x410c5c){logger[_0x8f68('0xe')](_0x410c5c[_0x8f68('0xf')]);}switch(_0x35ea7c['data1'][_0x8f68('0x10')]()){case'GET':case _0x8f68('0x11'):_0x1c68c3=null;_0x53ca9f['qs']=_0x336a7d;break;case _0x8f68('0x12'):case _0x8f68('0x13'):if(_0x35ea7c[_0x8f68('0x14')]){try{_0x1c68c3=JSON[_0x8f68('0xc')](Mustache[_0x8f68('0x8')](_0x35ea7c[_0x8f68('0x14')],_0x336a7d));_0x53ca9f['body']=_0x1c68c3;}catch(_0x154845){logger[_0x8f68('0xe')](_0x154845[_0x8f68('0xf')]);logger['error'](_0x8f68('0x15'));}}else{_0x1c68c3=_0x336a7d;_0x53ca9f[_0x8f68('0x16')]=_0x1c68c3;}break;}logger[_0x8f68('0x17')](util[_0x8f68('0x18')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x35ea7c[_0x8f68('0x7')],_0x35ea7c['data2'],JSON['stringify'](_0x53ca9f)));rp(_0x53ca9f)[_0x8f68('0x19')](function(_0x403f07){_0x1c68c3=!_[_0x8f68('0x1a')](_0x1c68c3)?_0x8f68('0x1b')+_0x1c68c3:'';_0x4e0bff=typeof _0x403f07[_0x8f68('0x16')]===_0x8f68('0x1c')?JSON[_0x8f68('0x1d')](_0x403f07[_0x8f68('0x16')]):_0x403f07['body'];logger[_0x8f68('0x17')](util[_0x8f68('0x18')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x35ea7c[_0x8f68('0x7')],_0x35ea7c[_0x8f68('0x1e')],_0x403f07['statusCode'],_0x4e0bff));})[_0x8f68('0x1f')](function(_0x2b95a0){logger[_0x8f68('0xe')](util[_0x8f68('0x18')](_0x8f68('0x20'),_0x35ea7c[_0x8f68('0x7')],_0x35ea7c[_0x8f68('0x1e')],_0x2b95a0['statusCode'],_0x2b95a0[_0x8f68('0x21')],_0x2b95a0['message']));});}; \ No newline at end of file +var _0xf4a0=['render','data5','number','headers','data6','error','stack','GET','DELETE','POST','parse','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','isNil',',\x20request\x20body:\x20','object','info','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','message','request-promise','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xf4a0,0x1e7));var _0x0f4a=function(_0x326a32,_0x918aaa){_0x326a32=_0x326a32-0x0;var _0x31ffe6=_0xf4a0[_0x326a32];return _0x31ffe6;};'use strict';var rp=require(_0x0f4a('0x0'));var util=require('util');var _=require(_0x0f4a('0x1'));var Mustache=require(_0x0f4a('0x2'));var logger=require(_0x0f4a('0x3'))(_0x0f4a('0x4'));exports[_0x0f4a('0x5')]=function(_0x3095f9,_0x3cad01){var _0x10f36f,_0x2bdb3e;var _0x1e0ae3={'method':_0x3095f9[_0x0f4a('0x6')][_0x0f4a('0x7')](),'uri':Mustache[_0x0f4a('0x8')](_0x3095f9['data2'],_0x3cad01),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3095f9[_0x0f4a('0x9')])===_0x0f4a('0xa')&&parseInt(_0x3095f9['data5'])>=0x1&&parseInt(_0x3095f9[_0x0f4a('0x9')])<=0xa?parseInt(_0x3095f9[_0x0f4a('0x9')])*0x3e8:0x5*0x3e8};try{_0x1e0ae3[_0x0f4a('0xb')]=_0x3095f9[_0x0f4a('0xc')]?JSON['parse'](Mustache[_0x0f4a('0x8')](_0x3095f9[_0x0f4a('0xc')],_0x3cad01)):{};}catch(_0x578bfb){logger[_0x0f4a('0xd')](_0x578bfb[_0x0f4a('0xe')]);}switch(_0x3095f9[_0x0f4a('0x6')][_0x0f4a('0x7')]()){case _0x0f4a('0xf'):case _0x0f4a('0x10'):_0x10f36f=null;_0x1e0ae3['qs']=_0x3cad01;break;case _0x0f4a('0x11'):case'PUT':if(_0x3095f9['data7']){try{_0x10f36f=JSON[_0x0f4a('0x12')](Mustache[_0x0f4a('0x8')](_0x3095f9[_0x0f4a('0x13')],_0x3cad01));_0x1e0ae3[_0x0f4a('0x14')]=_0x10f36f;}catch(_0x3a3055){logger[_0x0f4a('0xd')](_0x3a3055[_0x0f4a('0xe')]);logger[_0x0f4a('0xd')](_0x0f4a('0x15'));}}else{_0x10f36f=_0x3cad01;_0x1e0ae3[_0x0f4a('0x14')]=_0x10f36f;}break;}logger['info'](util['format'](_0x0f4a('0x16'),_0x3095f9[_0x0f4a('0x6')],_0x3095f9[_0x0f4a('0x17')],JSON[_0x0f4a('0x18')](_0x1e0ae3)));rp(_0x1e0ae3)['then'](function(_0xd5db40){_0x10f36f=!_[_0x0f4a('0x19')](_0x10f36f)?_0x0f4a('0x1a')+_0x10f36f:'';_0x2bdb3e=typeof _0xd5db40['body']===_0x0f4a('0x1b')?JSON[_0x0f4a('0x18')](_0xd5db40[_0x0f4a('0x14')]):_0xd5db40[_0x0f4a('0x14')];logger[_0x0f4a('0x1c')](util[_0x0f4a('0x1d')](_0x0f4a('0x1e'),_0x3095f9[_0x0f4a('0x6')],_0x3095f9[_0x0f4a('0x17')],_0xd5db40[_0x0f4a('0x1f')],_0x2bdb3e));})['catch'](function(_0x1b063e){logger['error'](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x3095f9[_0x0f4a('0x6')],_0x3095f9[_0x0f4a('0x17')],_0x1b063e[_0x0f4a('0x1f')],_0x1b063e['name'],_0x1b063e[_0x0f4a('0x20')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index f687603..59ce487 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 _0x6d11=['../../config/logger','routing','client','http','Request','request','rpc','message','error','catch','exports','bluebird'];(function(_0x33fce5,_0x54df41){var _0x162e6e=function(_0x29def6){while(--_0x29def6){_0x33fce5['push'](_0x33fce5['shift']());}};_0x162e6e(++_0x54df41);}(_0x6d11,0x143));var _0x16d1=function(_0x15eeb3,_0xde4dcb){_0x15eeb3=_0x15eeb3-0x0;var _0x822e4b=_0x6d11[_0x15eeb3];return _0x822e4b;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x16d1('0x0'));var logger=require(_0x16d1('0x1'))(_0x16d1('0x2'));var client=jayson[_0x16d1('0x3')][_0x16d1('0x4')]({'port':0x2329});client[_0x16d1('0x5')]=function(_0x33ca57,_0x302bee){return new BPromise(function(_0x50517a,_0x33fc0e){return client[_0x16d1('0x6')](_0x33ca57,_0x302bee)['then'](function(_0x40302b){logger['debug'](_0x16d1('0x7'),_0x16d1('0x2'),_0x33ca57,_0x302bee,_0x40302b);if(_0x40302b['error']){logger['error']('rpc',_0x16d1('0x2'),_0x33ca57,_0x40302b['error'][_0x16d1('0x8')],_0x302bee);return _0x33fc0e(_0x40302b[_0x16d1('0x9')][_0x16d1('0x8')]);}else{return _0x50517a(_0x40302b['result']);}})[_0x16d1('0xa')](function(_0xc01253){logger['error'](_0x16d1('0x7'),_0x16d1('0x2'),_0x33ca57,_0xc01253,_0x302bee);return _0x33fc0e(_0xc01253);});});};module[_0x16d1('0xb')]=client; \ No newline at end of file +var _0x0e25=['http','then','debug','rpc','error','message','result','jayson/promise','bluebird','routing','client'];(function(_0x4f6e5e,_0x27cd66){var _0x5b0f60=function(_0x404642){while(--_0x404642){_0x4f6e5e['push'](_0x4f6e5e['shift']());}};_0x5b0f60(++_0x27cd66);}(_0x0e25,0x193));var _0x50e2=function(_0x584c0e,_0x325af2){_0x584c0e=_0x584c0e-0x0;var _0xc46984=_0x0e25[_0x584c0e];return _0xc46984;};'use strict';var jayson=require(_0x50e2('0x0'));var BPromise=require(_0x50e2('0x1'));var logger=require('../../config/logger')(_0x50e2('0x2'));var client=jayson[_0x50e2('0x3')][_0x50e2('0x4')]({'port':0x2329});client['Request']=function(_0x940fd2,_0x50487f){return new BPromise(function(_0x4b7240,_0x190beb){return client['request'](_0x940fd2,_0x50487f)[_0x50e2('0x5')](function(_0x1b240f){logger[_0x50e2('0x6')](_0x50e2('0x7'),'routing',_0x940fd2,_0x50487f,_0x1b240f);if(_0x1b240f['error']){logger[_0x50e2('0x8')](_0x50e2('0x7'),_0x50e2('0x2'),_0x940fd2,_0x1b240f['error']['message'],_0x50487f);return _0x190beb(_0x1b240f[_0x50e2('0x8')][_0x50e2('0x9')]);}else{return _0x4b7240(_0x1b240f[_0x50e2('0xa')]);}})['catch'](function(_0x4b21d2){logger['error'](_0x50e2('0x7'),_0x50e2('0x2'),_0x940fd2,_0x4b21d2,_0x50487f);return _0x190beb(_0x4b21d2);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 917c18b..a85d39c 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 _0x45a0=['catch','log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','getMailAccounts','initMailAccounts','then','refresh','mailAccounts','listen','getSettings','loginMailFrequency'];(function(_0x5aa17e,_0x517d62){var _0x2002ba=function(_0x33facd){while(--_0x33facd){_0x5aa17e['push'](_0x5aa17e['shift']());}};_0x2002ba(++_0x517d62);}(_0x45a0,0x1a2));var _0x045a=function(_0x495b8f,_0x50be88){_0x495b8f=_0x495b8f-0x0;var _0x3e7b90=_0x45a0[_0x495b8f];return _0x3e7b90;};'use strict';var BPromise=require(_0x045a('0x0'));var server=require(_0x045a('0x1'));var Realtime=require(_0x045a('0x2'));var EmailChannel=require(_0x045a('0x3'));var mailAccount=require(_0x045a('0x4'));var setting=require(_0x045a('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise['resolve']()['then'](mailAccount[_0x045a('0x6')]())['then'](realtime[_0x045a('0x7')]())[_0x045a('0x8')](function(){email[_0x045a('0x9')](realtime[_0x045a('0xa')]);return realtime;});}function main(){return server[_0x045a('0xb')](realtime,email)[_0x045a('0x8')](function(){return initRealtime();})['then'](function(){return setting[_0x045a('0xc')]();})[_0x045a('0x8')](function(_0x3d231f){return setInterval(initRealtime,_0x3d231f[_0x045a('0xd')]*0x3e8);})[_0x045a('0xe')](function(_0x2bc077){console[_0x045a('0xf')](_0x2bc077);});}main(); \ No newline at end of file +var _0xc4cf=['then','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','resolve','getMailAccounts'];(function(_0x44565e,_0x19e34){var _0x583604=function(_0xdf22e1){while(--_0xdf22e1){_0x44565e['push'](_0x44565e['shift']());}};_0x583604(++_0x19e34);}(_0xc4cf,0xc8));var _0xfc4c=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xc4cf[_0x525c7b];return _0x27b33e;};'use strict';var BPromise=require(_0xfc4c('0x0'));var server=require(_0xfc4c('0x1'));var Realtime=require(_0xfc4c('0x2'));var EmailChannel=require(_0xfc4c('0x3'));var mailAccount=require(_0xfc4c('0x4'));var setting=require(_0xfc4c('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0xfc4c('0x6')]()['then'](mailAccount[_0xfc4c('0x7')]())[_0xfc4c('0x8')](realtime['initMailAccounts']())['then'](function(){email[_0xfc4c('0x9')](realtime[_0xfc4c('0xa')]);return realtime;});}function main(){return server[_0xfc4c('0xb')](realtime,email)[_0xfc4c('0x8')](function(){return initRealtime();})['then'](function(){return setting[_0xfc4c('0xc')]();})[_0xfc4c('0x8')](function(_0x82baba){return setInterval(initRealtime,_0x82baba[_0xfc4c('0xd')]*0x3e8);})[_0xfc4c('0xe')](function(_0x2b188d){console[_0xfc4c('0xf')](_0x2b188d);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 7e1ac6b..9bc48ca 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 _0x795d=['../../../config/logger','email','redis','localhost','socket.io-emitter','./imap','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','key','active','Imap','status','messageStatus','total','isNil','stringify','md5','imapAccounts','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','handleImapEnd','error','handleImapError','disabled','connected','name','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','send','verifySmtp','Smtp','verify','exports','lodash','moment','bluebird','ioredis','../../../config/environment'];(function(_0x1ce438,_0x26d084){var _0x168bc0=function(_0x5d4f5a){while(--_0x5d4f5a){_0x1ce438['push'](_0x1ce438['shift']());}};_0x168bc0(++_0x26d084);}(_0x795d,0xd7));var _0xd795=function(_0x3fb354,_0x523e06){_0x3fb354=_0x3fb354-0x0;var _0x17589d=_0x795d[_0x3fb354];return _0x17589d;};'use strict';var _=require(_0xd795('0x0'));var moment=require(_0xd795('0x1'));var BPromise=require(_0xd795('0x2'));var md5=require('md5');var Redis=require(_0xd795('0x3'));var config=require(_0xd795('0x4'));var logger=require(_0xd795('0x5'))(_0xd795('0x6'));config[_0xd795('0x7')]=_['defaults'](config[_0xd795('0x7')],{'host':_0xd795('0x8'),'port':0x18eb});var io=require(_0xd795('0x9'))(new Redis(config[_0xd795('0x7')]));var EmailImap=require(_0xd795('0xa'));var EmailSmtp=require('./smtp');var mailAccount=require(_0xd795('0xb'));var md5Accounts={};function EmailChannel(_0x318e41){logger['info'](_0xd795('0xc'));this[_0xd795('0xd')]=_0x318e41[_0xd795('0xd')];this['imapAccounts']={};this[_0xd795('0xe')]=new EmailSmtp();}EmailChannel[_0xd795('0xf')][_0xd795('0x10')]=function(_0xa9ff6b){var _0x8fc872=this['mailAccounts'][_0xa9ff6b];var _0x51cc14={'id':_0x8fc872['id'],'name':_0x8fc872['name'],'key':_0x8fc872[_0xd795('0x11')],'active':_0x8fc872[_0xd795('0x12')],'Imap':{'status':_0x8fc872[_0xd795('0x13')][_0xd795('0x14')],'messageStatus':_0x8fc872[_0xd795('0x13')][_0xd795('0x15')],'total':_0x8fc872[_0xd795('0x13')][_0xd795('0x16')]}};if(_[_0xd795('0x17')](md5Accounts[_0xa9ff6b])){md5Accounts[_0xa9ff6b]={};}var _0x31dc0d=md5(JSON[_0xd795('0x18')](_0x51cc14));if(md5Accounts[_0xa9ff6b][_0xd795('0x19')]!==_0x31dc0d){md5Accounts[_0xa9ff6b]['md5']=_0x31dc0d;io[_0xd795('0x10')]('mailAccount:update',_0x51cc14);}};EmailChannel[_0xd795('0xf')]['refresh']=function(_0x270ac4){for(var _0x23d122 in _0x270ac4){if(_0x270ac4['hasOwnProperty'](_0x23d122)){if(_0x270ac4[_0x23d122][_0xd795('0x13')]&&_0x270ac4[_0x23d122][_0xd795('0x12')]){var _0x52acb7=_0x270ac4[_0x23d122][_0xd795('0x13')];if(!this[_0xd795('0x1a')][_0xd795('0x1b')](_0x52acb7['id'])){this[_0xd795('0x1a')][_0x52acb7['id']]=new EmailImap(_0x52acb7,_0x270ac4[_0x23d122][_0xd795('0x6')]);this[_0xd795('0x1a')][_0x52acb7['id']]['on'](_0xd795('0x1c'),this[_0xd795('0x1d')][_0xd795('0x1e')](this,_0x23d122));this['imapAccounts'][_0x52acb7['id']]['on'](_0xd795('0x6'),this[_0xd795('0x1f')][_0xd795('0x1e')](this,_0x23d122));this[_0xd795('0x1a')][_0x52acb7['id']]['on']('end',this[_0xd795('0x20')][_0xd795('0x1e')](this,_0x23d122));this[_0xd795('0x1a')][_0x52acb7['id']]['on'](_0xd795('0x21'),this[_0xd795('0x22')][_0xd795('0x1e')](this,_0x23d122));}}else{if(_[_0xd795('0x17')](this['mailAccounts'][_0x23d122][_0xd795('0x13')])){this[_0xd795('0xd')][_0x23d122][_0xd795('0x13')]={};}this['mailAccounts'][_0x23d122]['Imap']['status']=_0xd795('0x23');this[_0xd795('0xd')][_0x23d122][_0xd795('0x13')]['messageStatus']='';this[_0xd795('0x10')](_0x23d122);}}}};EmailChannel[_0xd795('0xf')][_0xd795('0x1d')]=function(_0x1d9f23,_0x4c42e9){if(this[_0xd795('0xd')][_0x1d9f23]){this['mailAccounts'][_0x1d9f23][_0xd795('0x13')][_0xd795('0x14')]=_0xd795('0x24');this[_0xd795('0xd')][_0x1d9f23][_0xd795('0x13')][_0xd795('0x15')]=_0x4c42e9[_0xd795('0x25')];if(_0x4c42e9[_0xd795('0x26')]){this[_0xd795('0xd')][_0x1d9f23]['Imap'][_0xd795('0x16')]=_0x4c42e9[_0xd795('0x26')]['total'];}return this[_0xd795('0x10')](_0x1d9f23);}};EmailChannel['prototype'][_0xd795('0x1f')]=function(_0x39cf05,_0x3b1702){logger[_0xd795('0x27')](_0xd795('0x28'),_0x3b1702[_0xd795('0x29')],_0x3b1702[_0xd795('0x2a')],_0x3b1702[_0xd795('0x2b')],_0x39cf05);if(this[_0xd795('0xd')][_0x39cf05]){return mailAccount[_0xd795('0x2c')](_0x39cf05,_0x3b1702)[_0xd795('0x2d')](function(_0x2038b5){if(_0x2038b5){logger[_0xd795('0x27')](_0xd795('0x2e'));}})[_0xd795('0x2f')](function(_0x81240a){logger[_0xd795('0x21')](_0xd795('0x30'),JSON['stringify'](_0x81240a));});}};EmailChannel['prototype'][_0xd795('0x20')]=function(_0x1a37b7){if(this[_0xd795('0xd')][_0x1a37b7]&&this[_0xd795('0xd')][_0x1a37b7][_0xd795('0x13')]){if(this[_0xd795('0x1a')][this[_0xd795('0xd')][_0x1a37b7][_0xd795('0x13')]['id']]){delete this[_0xd795('0x1a')][this[_0xd795('0xd')][_0x1a37b7]['Imap']['id']];}this[_0xd795('0xd')][_0x1a37b7][_0xd795('0x13')][_0xd795('0x31')]=moment();this[_0xd795('0x10')](_0x1a37b7);}};EmailChannel[_0xd795('0xf')][_0xd795('0x22')]=function(_0x5d5451,_0x2452bd){if(this['mailAccounts'][_0x5d5451]){this[_0xd795('0xd')][_0x5d5451]['Imap']['status']='error';this[_0xd795('0xd')][_0x5d5451]['Imap'][_0xd795('0x15')]=_0x2452bd;return this[_0xd795('0x10')](_0x5d5451);}};EmailChannel[_0xd795('0xf')]['sendMail']=function(_0x41930f,_0x172c04){return this[_0xd795('0xe')][_0xd795('0x32')](_0x41930f,_0x172c04);};EmailChannel[_0xd795('0xf')][_0xd795('0x33')]=function(_0x437c31){var _0x4f75a2=this;if(this[_0xd795('0xd')][_0x437c31['id']]){if(_[_0xd795('0x17')](this['mailAccounts'][_0x437c31['id']]['Smtp'])){this[_0xd795('0xd')][_0x437c31['id']][_0xd795('0x34')]={};}this[_0xd795('0xd')][_0x437c31['id']]['Smtp'][_0xd795('0x31')]=moment();return new BPromise(function(_0x317528,_0x133c52){return _0x4f75a2[_0xd795('0xe')][_0xd795('0x35')](_0x437c31)['then'](function(_0x3ec778){_0x4f75a2[_0xd795('0xd')][_0x437c31['id']][_0xd795('0x34')][_0xd795('0x14')]='verified';_0x4f75a2[_0xd795('0xd')][_0x437c31['id']][_0xd795('0x34')][_0xd795('0x15')]='';_0x4f75a2[_0xd795('0x10')](_0x437c31['id']);_0x317528(_0x3ec778);})[_0xd795('0x2f')](function(_0x31ffaf){_0x4f75a2[_0xd795('0xd')][_0x437c31['id']]['Smtp'][_0xd795('0x14')]='error';_0x4f75a2['mailAccounts'][_0x437c31['id']][_0xd795('0x34')][_0xd795('0x15')]=_0x31ffaf;_0x4f75a2[_0xd795('0x10')](_0x437c31['id']);_0x133c52(_0x31ffaf);});});}return this[_0xd795('0xe')][_0xd795('0x35')](_0x437c31);};module[_0xd795('0x36')]=EmailChannel; \ No newline at end of file +var _0x1b61=['then','info','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','prototype','sendMail','verifySmtp','verify','Smtp','lodash','bluebird','md5','ioredis','../../../config/environment','email','redis','defaults','localhost','./imap','../rpc/mailAccount','mailAccounts','imapAccounts','smtp','emit','key','Imap','status','total','mailAccount:update','hasOwnProperty','active','box','bind','end','handleImapEnd','error','handleImapError','isNil','disabled','messageStatus','handleImapBox','name','messages','handleImapEmail','firstName','from','notify'];(function(_0x3e4f74,_0x26ce71){var _0xd07d99=function(_0x2b09b0){while(--_0x2b09b0){_0x3e4f74['push'](_0x3e4f74['shift']());}};_0xd07d99(++_0x26ce71);}(_0x1b61,0xa2));var _0x11b6=function(_0x9117ad,_0x386be4){_0x9117ad=_0x9117ad-0x0;var _0x540f0c=_0x1b61[_0x9117ad];return _0x540f0c;};'use strict';var _=require(_0x11b6('0x0'));var moment=require('moment');var BPromise=require(_0x11b6('0x1'));var md5=require(_0x11b6('0x2'));var Redis=require(_0x11b6('0x3'));var config=require(_0x11b6('0x4'));var logger=require('../../../config/logger')(_0x11b6('0x5'));config[_0x11b6('0x6')]=_[_0x11b6('0x7')](config[_0x11b6('0x6')],{'host':_0x11b6('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x11b6('0x6')]));var EmailImap=require(_0x11b6('0x9'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x11b6('0xa'));var md5Accounts={};function EmailChannel(_0x5d97b2){logger['info']('start\x20email\x20channel');this[_0x11b6('0xb')]=_0x5d97b2['mailAccounts'];this[_0x11b6('0xc')]={};this[_0x11b6('0xd')]=new EmailSmtp();}EmailChannel['prototype'][_0x11b6('0xe')]=function(_0x3c9228){var _0x4ff6a0=this[_0x11b6('0xb')][_0x3c9228];var _0x39d433={'id':_0x4ff6a0['id'],'name':_0x4ff6a0['name'],'key':_0x4ff6a0[_0x11b6('0xf')],'active':_0x4ff6a0['active'],'Imap':{'status':_0x4ff6a0[_0x11b6('0x10')][_0x11b6('0x11')],'messageStatus':_0x4ff6a0[_0x11b6('0x10')]['messageStatus'],'total':_0x4ff6a0[_0x11b6('0x10')][_0x11b6('0x12')]}};if(_['isNil'](md5Accounts[_0x3c9228])){md5Accounts[_0x3c9228]={};}var _0x3b9249=md5(JSON['stringify'](_0x39d433));if(md5Accounts[_0x3c9228][_0x11b6('0x2')]!==_0x3b9249){md5Accounts[_0x3c9228][_0x11b6('0x2')]=_0x3b9249;io[_0x11b6('0xe')](_0x11b6('0x13'),_0x39d433);}};EmailChannel['prototype']['refresh']=function(_0xc8c31){for(var _0x443670 in _0xc8c31){if(_0xc8c31[_0x11b6('0x14')](_0x443670)){if(_0xc8c31[_0x443670]['Imap']&&_0xc8c31[_0x443670][_0x11b6('0x15')]){var _0x1cf1fd=_0xc8c31[_0x443670][_0x11b6('0x10')];if(!this[_0x11b6('0xc')][_0x11b6('0x14')](_0x1cf1fd['id'])){this[_0x11b6('0xc')][_0x1cf1fd['id']]=new EmailImap(_0x1cf1fd,_0xc8c31[_0x443670]['email']);this[_0x11b6('0xc')][_0x1cf1fd['id']]['on'](_0x11b6('0x16'),this['handleImapBox'][_0x11b6('0x17')](this,_0x443670));this['imapAccounts'][_0x1cf1fd['id']]['on'](_0x11b6('0x5'),this['handleImapEmail'][_0x11b6('0x17')](this,_0x443670));this[_0x11b6('0xc')][_0x1cf1fd['id']]['on'](_0x11b6('0x18'),this[_0x11b6('0x19')][_0x11b6('0x17')](this,_0x443670));this[_0x11b6('0xc')][_0x1cf1fd['id']]['on'](_0x11b6('0x1a'),this[_0x11b6('0x1b')]['bind'](this,_0x443670));}}else{if(_[_0x11b6('0x1c')](this['mailAccounts'][_0x443670][_0x11b6('0x10')])){this['mailAccounts'][_0x443670][_0x11b6('0x10')]={};}this['mailAccounts'][_0x443670]['Imap'][_0x11b6('0x11')]=_0x11b6('0x1d');this['mailAccounts'][_0x443670][_0x11b6('0x10')][_0x11b6('0x1e')]='';this[_0x11b6('0xe')](_0x443670);}}}};EmailChannel['prototype'][_0x11b6('0x1f')]=function(_0x346385,_0x3fdb19){if(this[_0x11b6('0xb')][_0x346385]){this[_0x11b6('0xb')][_0x346385]['Imap'][_0x11b6('0x11')]='connected';this[_0x11b6('0xb')][_0x346385]['Imap'][_0x11b6('0x1e')]=_0x3fdb19[_0x11b6('0x20')];if(_0x3fdb19[_0x11b6('0x21')]){this[_0x11b6('0xb')][_0x346385][_0x11b6('0x10')]['total']=_0x3fdb19[_0x11b6('0x21')][_0x11b6('0x12')];}return this[_0x11b6('0xe')](_0x346385);}};EmailChannel['prototype'][_0x11b6('0x22')]=function(_0xc5e30b,_0x126bc4){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x126bc4[_0x11b6('0x23')],_0x126bc4['lastName'],_0x126bc4[_0x11b6('0x24')],_0xc5e30b);if(this[_0x11b6('0xb')][_0xc5e30b]){return mailAccount[_0x11b6('0x25')](_0xc5e30b,_0x126bc4)[_0x11b6('0x26')](function(_0x26a3a0){if(_0x26a3a0){logger[_0x11b6('0x27')](_0x11b6('0x28'));}})[_0x11b6('0x29')](function(_0x5e7497){logger[_0x11b6('0x1a')](_0x11b6('0x2a'),JSON[_0x11b6('0x2b')](_0x5e7497));});}};EmailChannel['prototype'][_0x11b6('0x19')]=function(_0x57dc5b){if(this[_0x11b6('0xb')][_0x57dc5b]&&this[_0x11b6('0xb')][_0x57dc5b][_0x11b6('0x10')]){if(this[_0x11b6('0xc')][this[_0x11b6('0xb')][_0x57dc5b]['Imap']['id']]){delete this['imapAccounts'][this[_0x11b6('0xb')][_0x57dc5b]['Imap']['id']];}this[_0x11b6('0xb')][_0x57dc5b][_0x11b6('0x10')][_0x11b6('0x2c')]=moment();this[_0x11b6('0xe')](_0x57dc5b);}};EmailChannel[_0x11b6('0x2d')]['handleImapError']=function(_0x4759c1,_0x5e50d1){if(this[_0x11b6('0xb')][_0x4759c1]){this['mailAccounts'][_0x4759c1][_0x11b6('0x10')][_0x11b6('0x11')]=_0x11b6('0x1a');this[_0x11b6('0xb')][_0x4759c1][_0x11b6('0x10')][_0x11b6('0x1e')]=_0x5e50d1;return this[_0x11b6('0xe')](_0x4759c1);}};EmailChannel['prototype'][_0x11b6('0x2e')]=function(_0x362d4a,_0x190025){return this[_0x11b6('0xd')]['send'](_0x362d4a,_0x190025);};EmailChannel[_0x11b6('0x2d')][_0x11b6('0x2f')]=function(_0x25bbb2){var _0x395b87=this;if(this[_0x11b6('0xb')][_0x25bbb2['id']]){if(_[_0x11b6('0x1c')](this[_0x11b6('0xb')][_0x25bbb2['id']]['Smtp'])){this[_0x11b6('0xb')][_0x25bbb2['id']]['Smtp']={};}this[_0x11b6('0xb')][_0x25bbb2['id']]['Smtp'][_0x11b6('0x2c')]=moment();return new BPromise(function(_0x5b2ef7,_0x977daa){return _0x395b87['smtp'][_0x11b6('0x30')](_0x25bbb2)[_0x11b6('0x26')](function(_0x6c531f){_0x395b87[_0x11b6('0xb')][_0x25bbb2['id']]['Smtp'][_0x11b6('0x11')]='verified';_0x395b87[_0x11b6('0xb')][_0x25bbb2['id']][_0x11b6('0x31')]['messageStatus']='';_0x395b87[_0x11b6('0xe')](_0x25bbb2['id']);_0x5b2ef7(_0x6c531f);})['catch'](function(_0x50189f){_0x395b87[_0x11b6('0xb')][_0x25bbb2['id']][_0x11b6('0x31')][_0x11b6('0x11')]=_0x11b6('0x1a');_0x395b87['mailAccounts'][_0x25bbb2['id']]['Smtp'][_0x11b6('0x1e')]=_0x50189f;_0x395b87[_0x11b6('0xe')](_0x25bbb2['id']);_0x977daa(_0x50189f);});});}return this['smtp'][_0x11b6('0x30')](_0x25bbb2);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 48b69ad..21eae6f 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 _0x09c1=['mailparser','simpleParser','iconv','events','EventEmitter','../../../config/logger','email','mailbox','account','getAccount','once','ready','handleReady','bind','end','error','handleError','connect','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','port','tls','autotls','required','host','anonymous@xcally.com','handleOpenBox','emit','box','handleCloseBox','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchEnd','closeBox','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchError','stringify','textCode','hasOwnProperty','upperFirst','exports','util','imap','randomstring'];(function(_0x17c38b,_0x201c48){var _0x52e7a4=function(_0x2fa956){while(--_0x2fa956){_0x17c38b['push'](_0x17c38b['shift']());}};_0x52e7a4(++_0x201c48);}(_0x09c1,0xb1));var _0x109c=function(_0xe1f858,_0xb86c44){_0xe1f858=_0xe1f858-0x0;var _0x367af6=_0x09c1[_0xe1f858];return _0x367af6;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x109c('0x0'));var Imap=require(_0x109c('0x1'));var _=require('lodash');var rs=require(_0x109c('0x2'));var simpleParser=require(_0x109c('0x3'))[_0x109c('0x4')];var Iconv=require(_0x109c('0x5'))['Iconv'];var EventEmitter=require(_0x109c('0x6'))[_0x109c('0x7')];var utils=require('./utils');var logger=require(_0x109c('0x8'))(_0x109c('0x9'));function EmailImap(_0x21e68b,_0x5ab185){this[_0x109c('0xa')]='INBOX';this[_0x109c('0xb')]=this[_0x109c('0xc')](_0x21e68b,_0x5ab185);this['imap']=new Imap(this[_0x109c('0xb')]);this[_0x109c('0x1')][_0x109c('0xd')](_0x109c('0xe'),this[_0x109c('0xf')][_0x109c('0x10')](this));this[_0x109c('0x1')][_0x109c('0xd')](_0x109c('0x11'),this['handleEnd'][_0x109c('0x10')](this));this[_0x109c('0x1')]['on'](_0x109c('0x12'),this[_0x109c('0x13')][_0x109c('0x10')](this));this[_0x109c('0x1')][_0x109c('0x14')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x109c('0x15')][_0x109c('0xc')]=function(_0x135db6,_0x83a436){var _0x642c8f={'connTimeout':_0x135db6[_0x109c('0x16')]?_0x135db6[_0x109c('0x16')]*0x3e8:0x2710,'authTimeout':_0x135db6[_0x109c('0x17')]?_0x135db6[_0x109c('0x17')]*0x3e8:0x1388};if(_[_0x109c('0x18')](_0x135db6[_0x109c('0x19')])){if(_0x135db6[_0x109c('0x1a')]){_0x642c8f[_0x109c('0x1b')]=_0x135db6[_0x109c('0x1b')];_0x642c8f['password']=_0x135db6[_0x109c('0x1c')];}_0x642c8f['host']=_0x135db6['host'];_0x642c8f[_0x109c('0x1d')]=_0x135db6[_0x109c('0x1d')]||0x3e1;if(_0x135db6[_0x109c('0x1e')]){_0x642c8f['tls']=!![];}else{_0x642c8f['tls']=![];_0x642c8f[_0x109c('0x1f')]=_0x109c('0x20');}}else{_0x642c8f[_0x109c('0x1b')]=_0x135db6[_0x109c('0x1b')];_0x642c8f[_0x109c('0x1c')]=_0x135db6[_0x109c('0x1c')];_0x642c8f[_0x109c('0x21')]=utils['getHost'](_0x135db6[_0x109c('0x19')]);_0x642c8f['port']=0x3e1;_0x642c8f['tls']=!![];}_0x642c8f[_0x109c('0x9')]=_0x83a436||_0x135db6[_0x109c('0x1b')]||_0x109c('0x22');return _0x642c8f;};EmailImap[_0x109c('0x15')][_0x109c('0xf')]=function(){this[_0x109c('0x1')]['openBox'](this[_0x109c('0xa')],![],this[_0x109c('0x23')][_0x109c('0x10')](this));};EmailImap[_0x109c('0x15')]['handleOpenBox']=function(_0x4c7fec,_0x50687d){if(_0x4c7fec){this[_0x109c('0x13')](_0x4c7fec,!![]);}else{this[_0x109c('0x24')](_0x109c('0x25'),_0x50687d);this['readUnseen']();}};EmailImap[_0x109c('0x15')][_0x109c('0x26')]=function(_0x15f9e4){if(_0x15f9e4){this[_0x109c('0x13')](_0x15f9e4,!![]);}else{this[_0x109c('0x1')][_0x109c('0x11')]();}};EmailImap[_0x109c('0x15')][_0x109c('0x27')]=function(){this['imap'][_0x109c('0x28')]([_0x109c('0x29')],this[_0x109c('0x2a')][_0x109c('0x10')](this));};EmailImap['prototype'][_0x109c('0x2a')]=function(_0x24c7af,_0x1f756a){if(_0x24c7af){this[_0x109c('0x13')](_0x24c7af,!![]);}else{if(_0x1f756a[_0x109c('0x2b')]){try{var _0x2b422c=this[_0x109c('0x1')][_0x109c('0x2c')](_0x1f756a,{'bodies':'','markSeen':!![]});_0x2b422c['on']('message',this[_0x109c('0x2d')]['bind'](this));_0x2b422c[_0x109c('0xd')](_0x109c('0x12'),this['handleFetchError'][_0x109c('0x10')](this));_0x2b422c['once'](_0x109c('0x11'),this[_0x109c('0x2e')][_0x109c('0x10')](this));}catch(_0x4ebeb0){logger[_0x109c('0x12')](_0x4ebeb0);}}else{this['imap'][_0x109c('0x2f')](!![],this[_0x109c('0x26')][_0x109c('0x10')](this));}}};EmailImap['prototype'][_0x109c('0x2d')]=function(_0x3e0d4b,_0x58adfa){_0x3e0d4b['on'](_0x109c('0x30'),this[_0x109c('0x31')][_0x109c('0x10')](this));_0x3e0d4b[_0x109c('0xd')]('attributes',this[_0x109c('0x32')][_0x109c('0x10')](this));_0x3e0d4b[_0x109c('0xd')](_0x109c('0x11'),this[_0x109c('0x33')][_0x109c('0x10')](this));};EmailImap[_0x109c('0x15')][_0x109c('0x31')]=function(_0x4c156b,_0x3db97d){simpleParser(_0x4c156b,{'Iconv':Iconv},this[_0x109c('0x34')][_0x109c('0x10')](this));};EmailImap[_0x109c('0x15')]['handleMessageAttributes']=function(_0x26a343){};EmailImap[_0x109c('0x15')][_0x109c('0x33')]=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x5e1a76,_0x121c84){if(_0x5e1a76){logger[_0x109c('0x12')](_0x5e1a76);}else{var _0x41087b=this;utils[_0x109c('0x35')](this['account'],_0x121c84,function(_0x21b4f0){_0x41087b[_0x109c('0x24')](_0x109c('0x9'),_0x21b4f0);});}};EmailImap[_0x109c('0x15')][_0x109c('0x2e')]=function(){this[_0x109c('0x1')][_0x109c('0x2f')](!![],this[_0x109c('0x26')]['bind'](this));};EmailImap[_0x109c('0x15')][_0x109c('0x36')]=function(_0x5159e6){this[_0x109c('0x13')](_0x5159e6);this['imap']['closeBox'](!![],this[_0x109c('0x26')][_0x109c('0x10')](this));};EmailImap[_0x109c('0x15')]['handleEnd']=function(){this[_0x109c('0x24')]('end');};EmailImap[_0x109c('0x15')][_0x109c('0x13')]=function(_0x148938,_0x27953d){logger[_0x109c('0x12')](_0x109c('0x13'),this[_0x109c('0xb')][_0x109c('0x9')],JSON[_0x109c('0x37')](_0x148938));var _0x27358c='';if(_0x148938){if(_0x148938[_0x109c('0x38')]){_0x27358c=_0x148938['textCode'];}else{for(var _0x2f4d73 in _0x148938){if(_0x148938[_0x109c('0x39')](_0x2f4d73)){_0x27358c+=_[_0x109c('0x3a')](_0x2f4d73)+':\x20'+_0x148938[_0x2f4d73]+'\x0a';}}}}if(_0x27953d){this[_0x109c('0x1')][_0x109c('0x11')]();}else{this['emit'](_0x109c('0x12'),_0x27358c);this[_0x109c('0x24')](_0x109c('0x11'));}};module[_0x109c('0x3b')]=EmailImap; \ No newline at end of file +var _0xef17=['end','handleEnd','error','connect','authTimeout','service','user','password','host','port','tls','required','prototype','openBox','mailbox','handleOpenBox','handleError','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleSimpleParser','handleMessageEnd','parser','stringify','textCode','hasOwnProperty','upperFirst','exports','path','util','imap','randomstring','mailparser','simpleParser','iconv','Iconv','events','./utils','email','INBOX','account','getAccount','ready','handleReady','bind','once'];(function(_0x1aab45,_0xcd9db8){var _0x374e14=function(_0x5212bc){while(--_0x5212bc){_0x1aab45['push'](_0x1aab45['shift']());}};_0x374e14(++_0xcd9db8);}(_0xef17,0x1be));var _0x7ef1=function(_0x1affb0,_0x2cbc50){_0x1affb0=_0x1affb0-0x0;var _0x36eaa0=_0xef17[_0x1affb0];return _0x36eaa0;};'use strict';var fs=require('fs');var path=require(_0x7ef1('0x0'));var util=require(_0x7ef1('0x1'));var Imap=require(_0x7ef1('0x2'));var _=require('lodash');var rs=require(_0x7ef1('0x3'));var simpleParser=require(_0x7ef1('0x4'))[_0x7ef1('0x5')];var Iconv=require(_0x7ef1('0x6'))[_0x7ef1('0x7')];var EventEmitter=require(_0x7ef1('0x8'))['EventEmitter'];var utils=require(_0x7ef1('0x9'));var logger=require('../../../config/logger')(_0x7ef1('0xa'));function EmailImap(_0x109b59,_0x77785b){this['mailbox']=_0x7ef1('0xb');this[_0x7ef1('0xc')]=this[_0x7ef1('0xd')](_0x109b59,_0x77785b);this['imap']=new Imap(this[_0x7ef1('0xc')]);this[_0x7ef1('0x2')]['once'](_0x7ef1('0xe'),this[_0x7ef1('0xf')][_0x7ef1('0x10')](this));this['imap'][_0x7ef1('0x11')](_0x7ef1('0x12'),this[_0x7ef1('0x13')][_0x7ef1('0x10')](this));this[_0x7ef1('0x2')]['on'](_0x7ef1('0x14'),this['handleError'][_0x7ef1('0x10')](this));this[_0x7ef1('0x2')][_0x7ef1('0x15')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0x7ef1('0xd')]=function(_0xcf6617,_0x5775d4){var _0x1d23e6={'connTimeout':_0xcf6617['connTimeout']?_0xcf6617['connTimeout']*0x3e8:0x2710,'authTimeout':_0xcf6617[_0x7ef1('0x16')]?_0xcf6617[_0x7ef1('0x16')]*0x3e8:0x1388};if(_['isNil'](_0xcf6617[_0x7ef1('0x17')])){if(_0xcf6617['authentication']){_0x1d23e6[_0x7ef1('0x18')]=_0xcf6617['user'];_0x1d23e6[_0x7ef1('0x19')]=_0xcf6617[_0x7ef1('0x19')];}_0x1d23e6[_0x7ef1('0x1a')]=_0xcf6617[_0x7ef1('0x1a')];_0x1d23e6['port']=_0xcf6617[_0x7ef1('0x1b')]||0x3e1;if(_0xcf6617[_0x7ef1('0x1c')]){_0x1d23e6[_0x7ef1('0x1c')]=!![];}else{_0x1d23e6[_0x7ef1('0x1c')]=![];_0x1d23e6['autotls']=_0x7ef1('0x1d');}}else{_0x1d23e6[_0x7ef1('0x18')]=_0xcf6617[_0x7ef1('0x18')];_0x1d23e6[_0x7ef1('0x19')]=_0xcf6617[_0x7ef1('0x19')];_0x1d23e6[_0x7ef1('0x1a')]=utils['getHost'](_0xcf6617[_0x7ef1('0x17')]);_0x1d23e6[_0x7ef1('0x1b')]=0x3e1;_0x1d23e6[_0x7ef1('0x1c')]=!![];}_0x1d23e6['email']=_0x5775d4||_0xcf6617[_0x7ef1('0x18')]||'anonymous@xcally.com';return _0x1d23e6;};EmailImap[_0x7ef1('0x1e')][_0x7ef1('0xf')]=function(){this[_0x7ef1('0x2')][_0x7ef1('0x1f')](this[_0x7ef1('0x20')],![],this[_0x7ef1('0x21')]['bind'](this));};EmailImap[_0x7ef1('0x1e')][_0x7ef1('0x21')]=function(_0x3da6ea,_0x27418e){if(_0x3da6ea){this[_0x7ef1('0x22')](_0x3da6ea,!![]);}else{this[_0x7ef1('0x23')](_0x7ef1('0x24'),_0x27418e);this[_0x7ef1('0x25')]();}};EmailImap[_0x7ef1('0x1e')][_0x7ef1('0x26')]=function(_0x36379c){if(_0x36379c){this[_0x7ef1('0x22')](_0x36379c,!![]);}else{this['imap']['end']();}};EmailImap['prototype'][_0x7ef1('0x25')]=function(){this[_0x7ef1('0x2')][_0x7ef1('0x27')]([_0x7ef1('0x28')],this[_0x7ef1('0x29')][_0x7ef1('0x10')](this));};EmailImap[_0x7ef1('0x1e')]['handleReadUnseen']=function(_0x8d893b,_0x69aeb3){if(_0x8d893b){this[_0x7ef1('0x22')](_0x8d893b,!![]);}else{if(_0x69aeb3['length']){try{var _0x311ba6=this[_0x7ef1('0x2')][_0x7ef1('0x2a')](_0x69aeb3,{'bodies':'','markSeen':!![]});_0x311ba6['on']('message',this[_0x7ef1('0x2b')][_0x7ef1('0x10')](this));_0x311ba6[_0x7ef1('0x11')](_0x7ef1('0x14'),this[_0x7ef1('0x2c')]['bind'](this));_0x311ba6[_0x7ef1('0x11')](_0x7ef1('0x12'),this[_0x7ef1('0x2d')]['bind'](this));}catch(_0x563b40){logger['error'](_0x563b40);}}else{this[_0x7ef1('0x2')][_0x7ef1('0x2e')](!![],this[_0x7ef1('0x26')][_0x7ef1('0x10')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x4a3d2a,_0x4bde29){_0x4a3d2a['on'](_0x7ef1('0x2f'),this[_0x7ef1('0x30')][_0x7ef1('0x10')](this));_0x4a3d2a['once'](_0x7ef1('0x31'),this['handleMessageAttributes'][_0x7ef1('0x10')](this));_0x4a3d2a[_0x7ef1('0x11')](_0x7ef1('0x12'),this['handleMessageEnd']['bind'](this));};EmailImap[_0x7ef1('0x1e')]['handleMessageBody']=function(_0x347eb2,_0x47efa2){simpleParser(_0x347eb2,{'Iconv':Iconv},this[_0x7ef1('0x32')][_0x7ef1('0x10')](this));};EmailImap[_0x7ef1('0x1e')]['handleMessageAttributes']=function(_0x1b21a3){};EmailImap[_0x7ef1('0x1e')][_0x7ef1('0x33')]=function(){};EmailImap[_0x7ef1('0x1e')][_0x7ef1('0x32')]=function(_0xaa1939,_0x38425e){if(_0xaa1939){logger[_0x7ef1('0x14')](_0xaa1939);}else{var _0x103ffd=this;utils[_0x7ef1('0x34')](this[_0x7ef1('0xc')],_0x38425e,function(_0x5e3555){_0x103ffd[_0x7ef1('0x23')](_0x7ef1('0xa'),_0x5e3555);});}};EmailImap[_0x7ef1('0x1e')][_0x7ef1('0x2d')]=function(){this[_0x7ef1('0x2')][_0x7ef1('0x2e')](!![],this[_0x7ef1('0x26')]['bind'](this));};EmailImap[_0x7ef1('0x1e')][_0x7ef1('0x2c')]=function(_0x121510){this[_0x7ef1('0x22')](_0x121510);this[_0x7ef1('0x2')]['closeBox'](!![],this[_0x7ef1('0x26')][_0x7ef1('0x10')](this));};EmailImap[_0x7ef1('0x1e')][_0x7ef1('0x13')]=function(){this[_0x7ef1('0x23')](_0x7ef1('0x12'));};EmailImap[_0x7ef1('0x1e')][_0x7ef1('0x22')]=function(_0x3e2f5e,_0x1dab6c){logger['error']('handleError',this[_0x7ef1('0xc')]['email'],JSON[_0x7ef1('0x35')](_0x3e2f5e));var _0x2f67f5='';if(_0x3e2f5e){if(_0x3e2f5e[_0x7ef1('0x36')]){_0x2f67f5=_0x3e2f5e[_0x7ef1('0x36')];}else{for(var _0x5e3125 in _0x3e2f5e){if(_0x3e2f5e[_0x7ef1('0x37')](_0x5e3125)){_0x2f67f5+=_[_0x7ef1('0x38')](_0x5e3125)+':\x20'+_0x3e2f5e[_0x5e3125]+'\x0a';}}}}if(_0x1dab6c){this['imap']['end']();}else{this[_0x7ef1('0x23')](_0x7ef1('0x14'),_0x2f67f5);this[_0x7ef1('0x23')]('end');}};module[_0x7ef1('0x39')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 0517f91..8f3d9c9 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 _0x4727=['verify','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','send','createTransport','compile','toString'];(function(_0x1aef56,_0xf70a6d){var _0x3f5557=function(_0x5faf3d){while(--_0x5faf3d){_0x1aef56['push'](_0x1aef56['shift']());}};_0x3f5557(++_0xf70a6d);}(_0x4727,0x12e));var _0x7472=function(_0x5277fc,_0x269731){_0x5277fc=_0x5277fc-0x0;var _0x20c9cc=_0x4727[_0x5277fc];return _0x20c9cc;};'use strict';var nodemailer=require(_0x7472('0x0'));var BPromise=require(_0x7472('0x1'));var inlineBase64=require(_0x7472('0x2'));function EmailSmtp(){}EmailSmtp[_0x7472('0x3')][_0x7472('0x4')]=function(_0x54465c,_0xa6a549){return new BPromise(function(_0x95069e,_0xab62b5){var _0x4f174f=nodemailer[_0x7472('0x5')](_0x54465c);_0x4f174f['use'](_0x7472('0x6'),inlineBase64());_0x4f174f['sendMail'](_0xa6a549,function(_0x40c7ff,_0x35989e){if(_0x40c7ff){_0xab62b5(_0x40c7ff[_0x7472('0x7')]());}else{_0x95069e(_0x35989e);}});});};EmailSmtp[_0x7472('0x3')][_0x7472('0x8')]=function(_0x4f6ff3){return new BPromise(function(_0x5c503a,_0xe4cc22){var _0x17ec56=nodemailer[_0x7472('0x5')](_0x4f6ff3);_0x17ec56[_0x7472('0x8')](function(_0x438119,_0x4fc597){if(_0x438119){_0xe4cc22(_0x438119[_0x7472('0x7')]());}else{if(_0x4fc597){_0x5c503a(_0x4fc597);}else{_0xe4cc22('Not\x20verifired');}}});});};module[_0x7472('0x9')]=EmailSmtp; \ No newline at end of file +var _0x0427=['verify','Not\x20verifired','exports','nodemailer-plugin-inline-base64','send','createTransport','use','compile','sendMail','toString','prototype'];(function(_0x6123ec,_0x4cb6b6){var _0x3c2cfe=function(_0x1fb1c4){while(--_0x1fb1c4){_0x6123ec['push'](_0x6123ec['shift']());}};_0x3c2cfe(++_0x4cb6b6);}(_0x0427,0x1a5));var _0x7042=function(_0x509844,_0x23aaf7){_0x509844=_0x509844-0x0;var _0x47268c=_0x0427[_0x509844];return _0x47268c;};'use strict';var nodemailer=require('nodemailer');var BPromise=require('bluebird');var inlineBase64=require(_0x7042('0x0'));function EmailSmtp(){}EmailSmtp['prototype'][_0x7042('0x1')]=function(_0x45b8c1,_0x265344){return new BPromise(function(_0x4a47ce,_0x72d258){var _0xde1762=nodemailer[_0x7042('0x2')](_0x45b8c1);_0xde1762[_0x7042('0x3')](_0x7042('0x4'),inlineBase64());_0xde1762[_0x7042('0x5')](_0x265344,function(_0xaa5817,_0x52f923){if(_0xaa5817){_0x72d258(_0xaa5817[_0x7042('0x6')]());}else{_0x4a47ce(_0x52f923);}});});};EmailSmtp[_0x7042('0x7')][_0x7042('0x8')]=function(_0x35503e){return new BPromise(function(_0x4e7137,_0x53f5be){var _0x43cbdf=nodemailer[_0x7042('0x2')](_0x35503e);_0x43cbdf[_0x7042('0x8')](function(_0x1efb1,_0x54b363){if(_0x1efb1){_0x53f5be(_0x1efb1[_0x7042('0x6')]());}else{if(_0x54b363){_0x4e7137(_0x54b363);}else{_0x53f5be(_0x7042('0x9'));}}});});};module[_0x7042('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 95744d5..270e7fe 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 _0xd916=['YYYY-MM-DD\x20HH:mm:ss','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','

Empty\x20message

','Attachments','push','Title','Data','getHost','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util','../../../config/logger','email','head','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','join','Anonymous','value','pop','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x540ddd[_0x6d91('0x11')](0x0,-0x1)[_0x6d91('0x12')]('\x20'):_0x1c874c[_0x6d91('0xc')];}return _0x6d91('0x13');}function getLastName(_0x230468){var _0x12cc2b=_[_0x6d91('0x7')](_0x230468[_0x6d91('0x14')]);if(_0x12cc2b&&_0x12cc2b[_0x6d91('0xc')]){var _0x293e25=_0x12cc2b[_0x6d91('0xc')][_0x6d91('0xf')](/\s+/);return _0x293e25['length']>0x1?_0x293e25[_0x6d91('0x15')]():'';}return'';}function getMails(_0x33fbbe,_0x25debb){var _0x2143ac='';for(var _0x3602f3=0x0;_0x3602f3<_0x25debb[_0x6d91('0x14')]['length'];_0x3602f3+=0x1){if(_0x25debb[_0x6d91('0x14')][_0x3602f3]['address']!==_0x33fbbe){if(!_['isEmpty'](_0x2143ac)){_0x2143ac+=',';}_0x2143ac+=_0x25debb[_0x6d91('0x14')][_0x3602f3]['name']||_0x25debb[_0x6d91('0x14')][_0x3602f3]['address']||'';_0x2143ac+='\x20<';_0x2143ac+=_0x25debb['value'][_0x3602f3][_0x6d91('0x8')]?_0x25debb[_0x6d91('0x14')][_0x3602f3][_0x6d91('0x8')]:'anonymous'+random[_0x6d91('0xa')](0x6)+_0x6d91('0xb');_0x2143ac+='>';}}return _0x2143ac;}function parseEmail(_0x42e064,_0x95c65d,_0x1ad01b){if(_0x95c65d[_0x6d91('0x16')]){var _0x229612=/)<[^<]*)*<\/script>/gi;while(_0x229612[_0x6d91('0x17')](_0x95c65d[_0x6d91('0x16')])){_0x95c65d[_0x6d91('0x16')]=_0x95c65d[_0x6d91('0x16')][_0x6d91('0x18')](_0x229612,'');}if(_0x95c65d['html'][_0x6d91('0x19')](_0x6d91('0x1a'))){var _0x34ed05=[];_0x95c65d['attachments'][_0x6d91('0x1b')](_0x150907=>{_0x34ed05['push'](_0x150907[_0x6d91('0x1c')]);});var _0x72505e=/]+>/g;var _0x3ed163=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1269f4=_0x95c65d['html'][_0x6d91('0x18')](_0x3ed163,_0x6d91('0x1d'));var _0x1689f9=_0x1269f4['replace'](_0x72505e,_0x6d91('0x1e'));for(let _0x15e8ad=0x0;_0x15e8ad<_0x34ed05[_0x6d91('0x10')];_0x15e8ad++){var _0xb0c85f=_0x1689f9['replace'](_0x6d91('0x1e'),_0x6d91('0x1f')+_0x34ed05[_0x15e8ad]+_0x6d91('0x20'));_0x1689f9=_0xb0c85f;}_0x95c65d['html']=_0x1689f9;}_0x1ad01b[_0x6d91('0x21')]=_0x95c65d[_0x6d91('0x16')];}else{_0x1ad01b['body']=_0x95c65d[_0x6d91('0x22')];}if(_0x1ad01b['body']){_0x1ad01b['body']=_0x1ad01b['body'][_0x6d91('0x18')](/0x0){var _0x1e5543=[_0x6d91('0x32'),_0x6d91('0x33'),_0x6d91('0x34')];for(var _0x2698ad=0x0;_0x2698ad<_0x95c65d[_0x6d91('0x31')]['length'];_0x2698ad++){var _0x29bb35=_[_0x6d91('0xe')](_0x1e5543,_0x95c65d[_0x6d91('0x31')][_0x2698ad][_0x6d91('0x35')]);if(_0x29bb35>=0x0){_0x1ad01b['isAutoreply']=!![];}}}return _0x1ad01b;}exports['parser']=function(_0x4b0e2b,_0x4b9077,_0x58e271){var _0x2addcf={'from':getAddress(_0x4b9077['from']),'firstName':getFirstName(_0x4b9077['from']),'lastName':getLastName(_0x4b9077[_0x6d91('0x36')]),'mapKey':_0x6d91('0x6'),'message':{'from':getMails(_0x4b0e2b[_0x6d91('0x6')],_0x4b9077[_0x6d91('0x36')]),'to':_0x4b0e2b[_0x6d91('0x6')],'cc':'','subject':_0x4b9077['subject']||'','messageId':_0x4b9077['messageId'],'inReplyTo':_0x4b9077['inReplyTo'],'sentAt':moment(_0x4b9077[_0x6d91('0x37')])[_0x6d91('0x2c')](_0x6d91('0x38')),'attach':![],'attachments':[]}};if(!_0x4b9077['html']&&!_0x4b9077[_0x6d91('0x22')]){var _0x1d7430=_['filter'](_0x4b9077['attachments'],{'contentType':_0x6d91('0x39')});if(_0x1d7430[_0x6d91('0x10')]){logger[_0x6d91('0x3a')](util[_0x6d91('0x2c')](_0x6d91('0x3b'),_0x4b9077[_0x6d91('0x3c')]));tnef[_0x6d91('0x3d')](_['first'](_0x1d7430)['content'],function(_0x4054e2,_0x56359e){if(_0x56359e){_0x4b9077[_0x6d91('0x16')]=_0x56359e['BodyHTML']||_0x6d91('0x3e');if(_0x56359e[_0x6d91('0x3f')]){for(var _0x1dc298=0x0;_0x1dc298<_0x56359e[_0x6d91('0x3f')]['length'];_0x1dc298++){var _0x20a8fa=_0x56359e[_0x6d91('0x3f')][_0x1dc298];_0x2addcf[_0x6d91('0x24')][_0x6d91('0x28')][_0x6d91('0x40')]({'filename':_0x20a8fa[_0x6d91('0x41')],'content':Buffer[_0x6d91('0x36')](_0x20a8fa[_0x6d91('0x42')])});}}}_0x58e271(parseEmail(_0x4b0e2b,_0x4b9077,_0x2addcf));});}else{_0x4b9077['html']=_0x6d91('0x3e');_0x58e271(parseEmail(_0x4b0e2b,_0x4b9077,_0x2addcf));}}else{_0x58e271(parseEmail(_0x4b0e2b,_0x4b9077,_0x2addcf));}};exports[_0x6d91('0x43')]=function(_0x2219cc){switch(_0x2219cc){case'gmail':return _0x6d91('0x44');case _0x6d91('0x45'):return _0x6d91('0x46');case _0x6d91('0x47'):return'imap-mail.outlook.com';case _0x6d91('0x48'):return _0x6d91('0x49');}return _0x6d91('0x4a');}; \ No newline at end of file +var _0xc5b3=['application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','value','address','anonymous','generate','@xcally.com','head','name','substring','indexOf','split','length','slice','join','Anonymous','pop','isEmpty','test','html','replace','includes','attachments','forEach','push','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x2ce28d[_0x3c5b('0x13')](0x0,-0x1)[_0x3c5b('0x14')]('\x20'):_0x1d0174['name'];}return _0x3c5b('0x15');}function getLastName(_0x4769e3){var _0x1890d7=_[_0x3c5b('0xd')](_0x4769e3['value']);if(_0x1890d7&&_0x1890d7[_0x3c5b('0xe')]){var _0x5e5fbb=_0x1890d7[_0x3c5b('0xe')][_0x3c5b('0x11')](/\s+/);return _0x5e5fbb['length']>0x1?_0x5e5fbb[_0x3c5b('0x16')]():'';}return'';}function getMails(_0x88069a,_0x5d64cb){var _0x32c58e='';for(var _0x1cbe52=0x0;_0x1cbe52<_0x5d64cb[_0x3c5b('0x8')]['length'];_0x1cbe52+=0x1){if(_0x5d64cb[_0x3c5b('0x8')][_0x1cbe52]['address']!==_0x88069a){if(!_[_0x3c5b('0x17')](_0x32c58e)){_0x32c58e+=',';}_0x32c58e+=_0x5d64cb[_0x3c5b('0x8')][_0x1cbe52][_0x3c5b('0xe')]||_0x5d64cb[_0x3c5b('0x8')][_0x1cbe52][_0x3c5b('0x9')]||'';_0x32c58e+='\x20<';_0x32c58e+=_0x5d64cb[_0x3c5b('0x8')][_0x1cbe52]['address']?_0x5d64cb['value'][_0x1cbe52][_0x3c5b('0x9')]:'anonymous'+random[_0x3c5b('0xb')](0x6)+_0x3c5b('0xc');_0x32c58e+='>';}}return _0x32c58e;}function parseEmail(_0x135666,_0x4cb3d3,_0x3184e0){if(_0x4cb3d3['html']){var _0x2b7e4f=/)<[^<]*)*<\/script>/gi;while(_0x2b7e4f[_0x3c5b('0x18')](_0x4cb3d3[_0x3c5b('0x19')])){_0x4cb3d3[_0x3c5b('0x19')]=_0x4cb3d3[_0x3c5b('0x19')][_0x3c5b('0x1a')](_0x2b7e4f,'');}if(_0x4cb3d3[_0x3c5b('0x19')][_0x3c5b('0x1b')]('{_0x194692[_0x3c5b('0x1e')](_0x5c9b62['filename']);});var _0x5be530=/]+>/g;var _0x5a78c9=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4de3fa=_0x4cb3d3[_0x3c5b('0x19')][_0x3c5b('0x1a')](_0x5a78c9,_0x3c5b('0x1f'));var _0x51a77f=_0x4de3fa[_0x3c5b('0x1a')](_0x5be530,'_IMG');for(let _0x3548e9=0x0;_0x3548e9<_0x194692[_0x3c5b('0x12')];_0x3548e9++){var _0x1e0b84=_0x51a77f[_0x3c5b('0x1a')](_0x3c5b('0x20'),_0x3c5b('0x21')+_0x194692[_0x3548e9]+_0x3c5b('0x22'));_0x51a77f=_0x1e0b84;}_0x4cb3d3[_0x3c5b('0x19')]=_0x51a77f;}_0x3184e0[_0x3c5b('0x23')]=_0x4cb3d3['html'];}else{_0x3184e0[_0x3c5b('0x23')]=_0x4cb3d3[_0x3c5b('0x24')];}if(_0x3184e0[_0x3c5b('0x23')]){_0x3184e0[_0x3c5b('0x23')]=_0x3184e0[_0x3c5b('0x23')][_0x3c5b('0x1a')](/0x0){var _0x5110b2=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All',_0x3c5b('0x34')];for(var _0x4119e8=0x0;_0x4119e8<_0x4cb3d3[_0x3c5b('0x33')]['length'];_0x4119e8++){var _0x55a107=_[_0x3c5b('0x10')](_0x5110b2,_0x4cb3d3[_0x3c5b('0x33')][_0x4119e8]['line']);if(_0x55a107>=0x0){_0x3184e0[_0x3c5b('0x35')]=!![];}}}return _0x3184e0;}exports['parser']=function(_0x4feb0b,_0x27cb54,_0x7d1d35){var _0x2c149d={'from':getAddress(_0x27cb54[_0x3c5b('0x36')]),'firstName':getFirstName(_0x27cb54[_0x3c5b('0x36')]),'lastName':getLastName(_0x27cb54[_0x3c5b('0x36')]),'mapKey':_0x3c5b('0x7'),'message':{'from':getMails(_0x4feb0b[_0x3c5b('0x7')],_0x27cb54[_0x3c5b('0x36')]),'to':_0x4feb0b[_0x3c5b('0x7')],'cc':'','subject':_0x27cb54[_0x3c5b('0x37')]||'','messageId':_0x27cb54['messageId'],'inReplyTo':_0x27cb54[_0x3c5b('0x38')],'sentAt':moment(_0x27cb54['date'])[_0x3c5b('0x39')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x27cb54[_0x3c5b('0x19')]&&!_0x27cb54[_0x3c5b('0x24')]){var _0x4223f5=_[_0x3c5b('0x3a')](_0x27cb54[_0x3c5b('0x1c')],{'contentType':_0x3c5b('0x3b')});if(_0x4223f5[_0x3c5b('0x12')]){logger[_0x3c5b('0x3c')](util['format'](_0x3c5b('0x3d'),_0x27cb54[_0x3c5b('0x3e')]));tnef[_0x3c5b('0x3f')](_[_0x3c5b('0x40')](_0x4223f5)['content'],function(_0x32d71f,_0x34f7bd){if(_0x34f7bd){_0x27cb54[_0x3c5b('0x19')]=_0x34f7bd[_0x3c5b('0x41')]||_0x3c5b('0x42');if(_0x34f7bd[_0x3c5b('0x43')]){for(var _0x24d4f6=0x0;_0x24d4f6<_0x34f7bd[_0x3c5b('0x43')][_0x3c5b('0x12')];_0x24d4f6++){var _0x264ef9=_0x34f7bd[_0x3c5b('0x43')][_0x24d4f6];_0x2c149d[_0x3c5b('0x26')]['attachments']['push']({'filename':_0x264ef9[_0x3c5b('0x44')],'content':Buffer[_0x3c5b('0x36')](_0x264ef9[_0x3c5b('0x45')])});}}}_0x7d1d35(parseEmail(_0x4feb0b,_0x27cb54,_0x2c149d));});}else{_0x27cb54['html']=_0x3c5b('0x42');_0x7d1d35(parseEmail(_0x4feb0b,_0x27cb54,_0x2c149d));}}else{_0x7d1d35(parseEmail(_0x4feb0b,_0x27cb54,_0x2c149d));}};exports['getHost']=function(_0x9c0d0b){switch(_0x9c0d0b){case _0x3c5b('0x46'):return _0x3c5b('0x47');case _0x3c5b('0x48'):return _0x3c5b('0x49');case _0x3c5b('0x4a'):return _0x3c5b('0x4b');case _0x3c5b('0x4c'):return _0x3c5b('0x4d');}return _0x3c5b('0x4e');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 5266b61..67a1516 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 _0xe31b=['Smtp','lodash','name','key','SERV','active','Imap'];(function(_0x58d7a0,_0x5f547b){var _0xdaa1e4=function(_0x3e4855){while(--_0x3e4855){_0x58d7a0['push'](_0x58d7a0['shift']());}};_0xdaa1e4(++_0x5f547b);}(_0xe31b,0x1eb));var _0xbe31=function(_0x162b73,_0x128905){_0x162b73=_0x162b73-0x0;var _0x22e1b6=_0xe31b[_0x162b73];return _0x22e1b6;};'use strict';var _=require(_0xbe31('0x0'));function MailAccount(_0x1d3419){this['id']=_0x1d3419['id']||0x0;this[_0xbe31('0x1')]=_0x1d3419[_0xbe31('0x1')]||'Service';this[_0xbe31('0x2')]=_0x1d3419[_0xbe31('0x2')]||_0xbe31('0x3');this[_0xbe31('0x4')]=_0x1d3419['active']||![];this[_0xbe31('0x5')]=_0x1d3419[_0xbe31('0x5')]||[];this[_0xbe31('0x6')]=_0x1d3419['Smtp']||[];}module['exports']=MailAccount; \ No newline at end of file +var _0xa763=['name','key','SERV','active','Imap','exports'];(function(_0x538c70,_0x35531f){var _0x42ae01=function(_0x5c7368){while(--_0x5c7368){_0x538c70['push'](_0x538c70['shift']());}};_0x42ae01(++_0x35531f);}(_0xa763,0x13e));var _0x3a76=function(_0x355ce8,_0x5f1d0a){_0x355ce8=_0x355ce8-0x0;var _0x1db8b8=_0xa763[_0x355ce8];return _0x1db8b8;};'use strict';var _=require('lodash');function MailAccount(_0x1a2629){this['id']=_0x1a2629['id']||0x0;this[_0x3a76('0x0')]=_0x1a2629[_0x3a76('0x0')]||'Service';this[_0x3a76('0x1')]=_0x1a2629[_0x3a76('0x1')]||_0x3a76('0x2');this[_0x3a76('0x3')]=_0x1a2629[_0x3a76('0x3')]||![];this['Imap']=_0x1a2629[_0x3a76('0x4')]||[];this['Smtp']=_0x1a2629['Smtp']||[];}module[_0x3a76('0x5')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 8a5ed7f..778cc40 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 _0xb84c=['mergeFromDatabase','merge','exports','../model/mailAccount','mailAccounts','hasOwnProperty'];(function(_0x5d4181,_0x45b6d3){var _0x103f69=function(_0x17978b){while(--_0x17978b){_0x5d4181['push'](_0x5d4181['shift']());}};_0x103f69(++_0x45b6d3);}(_0xb84c,0x1cb));var _0xcb84=function(_0x21c0d3,_0x24e10c){_0x21c0d3=_0x21c0d3-0x0;var _0x5d5181=_0xb84c[_0x21c0d3];return _0x5d5181;};'use strict';var _=require('lodash');var MailAccount=require(_0xcb84('0x0'));var Realtime=function(){this[_0xcb84('0x1')]={};};function freeIsNotKey(_0x19fd99,_0x14f353,_0x4a9fdf){var _0x4d3b7f=_['mapKeys'](_0x19fd99,function(_0x24e892,_0x454b01){return _0x24e892[_0x4a9fdf];});for(var _0x572506 in _0x14f353){if(_0x14f353[_0xcb84('0x2')](_0x572506)){if(!_0x4d3b7f[_0x572506]){delete _0x14f353[_0x572506];}}}}Realtime['prototype'][_0xcb84('0x3')]=function(_0x1c671f,_0x51b432){for(var _0x556868 in _0x51b432){if(_0x1c671f[_0xcb84('0x2')](_0x556868)){_0x1c671f[_0x556868]=_0x51b432[_0x556868];}}};Realtime['prototype']['initMailAccounts']=function(){var _0x2bc2e8=this;return function(_0x2f9d48){if(_0x2f9d48){freeIsNotKey(_0x2f9d48,_0x2bc2e8[_0xcb84('0x1')],'id');for(var _0x3d9e44=0x0,_0x7e8f4b={},_0x5e64d3={};_0x3d9e44<_0x2f9d48['length'];_0x3d9e44+=0x1){_0x7e8f4b=_0x2f9d48[_0x3d9e44];if(_['isUndefined'](_0x2bc2e8[_0xcb84('0x1')][_0x7e8f4b['id']])){_0x2bc2e8[_0xcb84('0x1')][_0x7e8f4b['id']]=new MailAccount(_0x7e8f4b);}else{_[_0xcb84('0x4')](_0x2bc2e8[_0xcb84('0x1')][_0x7e8f4b['id']],_0x7e8f4b);}}}return _0x2bc2e8[_0xcb84('0x1')];};};module[_0xcb84('0x5')]=Realtime; \ No newline at end of file +var _0xec37=['../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','initMailAccounts','exports','lodash'];(function(_0x5934fe,_0x5d30eb){var _0x9c4e47=function(_0x52d9c3){while(--_0x52d9c3){_0x5934fe['push'](_0x5934fe['shift']());}};_0x9c4e47(++_0x5d30eb);}(_0xec37,0x11f));var _0x7ec3=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xec37[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x7ec3('0x0'));var MailAccount=require(_0x7ec3('0x1'));var Realtime=function(){this[_0x7ec3('0x2')]={};};function freeIsNotKey(_0x4b7f3c,_0x19a9e2,_0x39f835){var _0x54e1f3=_[_0x7ec3('0x3')](_0x4b7f3c,function(_0x907b0,_0x39c774){return _0x907b0[_0x39f835];});for(var _0x603433 in _0x19a9e2){if(_0x19a9e2[_0x7ec3('0x4')](_0x603433)){if(!_0x54e1f3[_0x603433]){delete _0x19a9e2[_0x603433];}}}}Realtime[_0x7ec3('0x5')]['mergeFromDatabase']=function(_0x434fda,_0x5e1a3f){for(var _0x1c7ff3 in _0x5e1a3f){if(_0x434fda[_0x7ec3('0x4')](_0x1c7ff3)){_0x434fda[_0x1c7ff3]=_0x5e1a3f[_0x1c7ff3];}}};Realtime[_0x7ec3('0x5')][_0x7ec3('0x6')]=function(){var _0x1f719e=this;return function(_0x5ca5b4){if(_0x5ca5b4){freeIsNotKey(_0x5ca5b4,_0x1f719e['mailAccounts'],'id');for(var _0x59e260=0x0,_0x577131={},_0x416488={};_0x59e260<_0x5ca5b4['length'];_0x59e260+=0x1){_0x577131=_0x5ca5b4[_0x59e260];if(_['isUndefined'](_0x1f719e['mailAccounts'][_0x577131['id']])){_0x1f719e[_0x7ec3('0x2')][_0x577131['id']]=new MailAccount(_0x577131);}else{_['merge'](_0x1f719e[_0x7ec3('0x2')][_0x577131['id']],_0x577131);}}}return _0x1f719e[_0x7ec3('0x2')];};};module[_0x7ec3('0x7')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 0611c62..54582e6 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 _0x3c85=['Request','GetMailAccount','email','active','key','TemplateId','MailServerIn','Imap','NotifyMailAccount','../client','getMailAccounts'];(function(_0x303918,_0x76ce5f){var _0x23f96e=function(_0x34adb8){while(--_0x34adb8){_0x303918['push'](_0x303918['shift']());}};_0x23f96e(++_0x76ce5f);}(_0x3c85,0x1a0));var _0x53c8=function(_0x203073,_0x405fb2){_0x203073=_0x203073-0x0;var _0x1f38d8=_0x3c85[_0x203073];return _0x1f38d8;};'use strict';var client=require(_0x53c8('0x0'));exports[_0x53c8('0x1')]=function(){return function(){return client[_0x53c8('0x2')](_0x53c8('0x3'),{'options':{'attributes':['id','name','service',_0x53c8('0x4'),_0x53c8('0x5'),_0x53c8('0x6'),'ListId',_0x53c8('0x7')],'raw':![],'include':[{'model':_0x53c8('0x8'),'as':_0x53c8('0x9')},{'model':'MailServerOut','as':'Smtp'}]},'log':'getMailAccount'});};};exports['notify']=function(_0x7d5c2a,_0x4de781){return client['Request'](_0x53c8('0xa'),{'account':{'id':_0x7d5c2a},'body':_0x4de781,'log':_0x53c8('0xa')});}; \ No newline at end of file +var _0x7e1d=['NotifyMailAccount','../client','GetMailAccount','name','service','email','active','key','TemplateId','MailServerIn','Imap','Smtp','getMailAccount','notify','Request'];(function(_0x4c6d4b,_0x51409b){var _0x53b282=function(_0xdea3e5){while(--_0xdea3e5){_0x4c6d4b['push'](_0x4c6d4b['shift']());}};_0x53b282(++_0x51409b);}(_0x7e1d,0x15a));var _0xd7e1=function(_0x3ea311,_0x568c4b){_0x3ea311=_0x3ea311-0x0;var _0x362de6=_0x7e1d[_0x3ea311];return _0x362de6;};'use strict';var client=require(_0xd7e1('0x0'));exports['getMailAccounts']=function(){return function(){return client['Request'](_0xd7e1('0x1'),{'options':{'attributes':['id',_0xd7e1('0x2'),_0xd7e1('0x3'),_0xd7e1('0x4'),_0xd7e1('0x5'),_0xd7e1('0x6'),'ListId',_0xd7e1('0x7')],'raw':![],'include':[{'model':_0xd7e1('0x8'),'as':_0xd7e1('0x9')},{'model':'MailServerOut','as':_0xd7e1('0xa')}]},'log':_0xd7e1('0xb')});};};exports[_0xd7e1('0xc')]=function(_0x3bcb45,_0x158be6){return client[_0xd7e1('0xd')](_0xd7e1('0xe'),{'account':{'id':_0x3bcb45},'body':_0x158be6,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index c6505df..43dd9a9 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 _0xf8ce=['../client','getSettings','Request','ShowSetting','loginMailFrequency','GetSettings'];(function(_0xdf4b51,_0x539e92){var _0x4ecc68=function(_0x415fc3){while(--_0x415fc3){_0xdf4b51['push'](_0xdf4b51['shift']());}};_0x4ecc68(++_0x539e92);}(_0xf8ce,0x8a));var _0xef8c=function(_0x4fef43,_0x35b63e){_0x4fef43=_0x4fef43-0x0;var _0x5f0217=_0xf8ce[_0x4fef43];return _0x5f0217;};'use strict';var client=require(_0xef8c('0x0'));exports[_0xef8c('0x1')]=function(){return client[_0xef8c('0x2')](_0xef8c('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xef8c('0x4')]},'log':_0xef8c('0x5')});}; \ No newline at end of file +var _0x6eb6=['getSettings','Request','loginMailFrequency','GetSettings','../client'];(function(_0x127c7b,_0x1f65e7){var _0x1708eb=function(_0x2033e5){while(--_0x2033e5){_0x127c7b['push'](_0x127c7b['shift']());}};_0x1708eb(++_0x1f65e7);}(_0x6eb6,0x1a3));var _0x66eb=function(_0x5e2b39,_0x400342){_0x5e2b39=_0x5e2b39-0x0;var _0x2a44a8=_0x6eb6[_0x5e2b39];return _0x2a44a8;};'use strict';var client=require(_0x66eb('0x0'));exports[_0x66eb('0x1')]=function(){return client[_0x66eb('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x66eb('0x3')]},'log':_0x66eb('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 2e1bc45..68ccb31 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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 a30df3c..253cc4a 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 _0x6144=['once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','express','sticky-session','../../config/environment','createServer','listen','port','socket.io','websocket','polling','redis','localhost','adapter','../../config/triggers','default','../../config/socketio','../../config/express','../../routes'];(function(_0x421cf8,_0x23152c){var _0x145c48=function(_0x565862){while(--_0x565862){_0x421cf8['push'](_0x421cf8['shift']());}};_0x145c48(++_0x23152c);}(_0x6144,0x192));var _0x4614=function(_0x38cccd,_0x133385){_0x38cccd=_0x38cccd-0x0;var _0xbeec3f=_0x6144[_0x38cccd];return _0xbeec3f;};'use strict';var _=require(_0x4614('0x0'));var http=require('http');var express=require(_0x4614('0x1'));var sticky=require(_0x4614('0x2'));var Redis=require('ioredis');var config=require(_0x4614('0x3'));var app=express();var server=http[_0x4614('0x4')](app);server['timeout']=0xdbba0;if(sticky[_0x4614('0x5')](server,config[_0x4614('0x6')])){var socketio=require(_0x4614('0x7'))(server,{'transports':[_0x4614('0x8'),_0x4614('0x9')]});config[_0x4614('0xa')]=_['defaults'](config[_0x4614('0xa')],{'host':_0x4614('0xb'),'port':0x18eb});socketio[_0x4614('0xc')](require('socket.io-redis')({'pubClient':new Redis(config[_0x4614('0xa')]),'subClient':new Redis(config['redis'])}));require(_0x4614('0xd'))[_0x4614('0xe')]();require(_0x4614('0xf'))[_0x4614('0xe')](socketio);require(_0x4614('0x10'))['default'](app);require(_0x4614('0x11'))[_0x4614('0xe')](app);}else{server[_0x4614('0x12')]('listening',function(){console[_0x4614('0x13')](_0x4614('0x14'),config[_0x4614('0x6')]);});}exports=module['exports']=app; \ No newline at end of file +var _0x0ac2=['default','../../config/socketio','../../config/express','../../routes','once','listening','log','exports','lodash','express','sticky-session','ioredis','createServer','timeout','listen','port','socket.io','websocket','polling','redis','defaults','localhost','socket.io-redis','../../config/triggers'];(function(_0x4a912c,_0x2027a2){var _0x29ffed=function(_0x3fa90d){while(--_0x3fa90d){_0x4a912c['push'](_0x4a912c['shift']());}};_0x29ffed(++_0x2027a2);}(_0x0ac2,0x68));var _0x20ac=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0ac2[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x20ac('0x0'));var http=require('http');var express=require(_0x20ac('0x1'));var sticky=require(_0x20ac('0x2'));var Redis=require(_0x20ac('0x3'));var config=require('../../config/environment');var app=express();var server=http[_0x20ac('0x4')](app);server[_0x20ac('0x5')]=0xdbba0;if(sticky[_0x20ac('0x6')](server,config[_0x20ac('0x7')])){var socketio=require(_0x20ac('0x8'))(server,{'transports':[_0x20ac('0x9'),_0x20ac('0xa')]});config[_0x20ac('0xb')]=_[_0x20ac('0xc')](config[_0x20ac('0xb')],{'host':_0x20ac('0xd'),'port':0x18eb});socketio['adapter'](require(_0x20ac('0xe'))({'pubClient':new Redis(config[_0x20ac('0xb')]),'subClient':new Redis(config[_0x20ac('0xb')])}));require(_0x20ac('0xf'))[_0x20ac('0x10')]();require(_0x20ac('0x11'))[_0x20ac('0x10')](socketio);require(_0x20ac('0x12'))['default'](app);require(_0x20ac('0x13'))[_0x20ac('0x10')](app);}else{server[_0x20ac('0x14')](_0x20ac('0x15'),function(){console[_0x20ac('0x16')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x20ac('0x7')]);});}exports=module[_0x20ac('0x17')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index e28af50..c6e1a53 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 _0x10db=['http','Request','request','debug','rpc','error','message','result','catch','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x10db,0x1ea));var _0xb10d=function(_0x4a61c3,_0x10e6a9){_0x4a61c3=_0x4a61c3-0x0;var _0x4efae5=_0x10db[_0x4a61c3];return _0x4efae5;};'use strict';var jayson=require(_0xb10d('0x0'));var BPromise=require(_0xb10d('0x1'));var logger=require(_0xb10d('0x2'))(_0xb10d('0x3'));var client=jayson['client'][_0xb10d('0x4')]({'port':0x2329});client[_0xb10d('0x5')]=function(_0x6d03f3,_0x47e110){return new BPromise(function(_0x5dcc8f,_0xf34972){return client[_0xb10d('0x6')](_0x6d03f3,_0x47e110)['then'](function(_0x27f22e){logger[_0xb10d('0x7')](_0xb10d('0x8'),_0xb10d('0x3'),_0x6d03f3,_0x47e110,_0x27f22e);if(_0x27f22e[_0xb10d('0x9')]){logger['error']('rpc','routing',_0x6d03f3,_0x27f22e[_0xb10d('0x9')]['message'],_0x47e110);return _0xf34972(_0x27f22e[_0xb10d('0x9')][_0xb10d('0xa')]);}else{return _0x5dcc8f(_0x27f22e[_0xb10d('0xb')]);}})[_0xb10d('0xc')](function(_0x1a87ad){logger[_0xb10d('0x9')](_0xb10d('0x8'),'routing',_0x6d03f3,_0x1a87ad,_0x47e110);return _0xf34972(_0x1a87ad);});});};module['exports']=client; \ No newline at end of file +var _0xef2d=['error','message','result','exports','jayson/promise','../../config/logger','routing','client','http','request','then','debug','rpc'];(function(_0x1aef65,_0x521e60){var _0x4a4594=function(_0x120020){while(--_0x120020){_0x1aef65['push'](_0x1aef65['shift']());}};_0x4a4594(++_0x521e60);}(_0xef2d,0x93));var _0xdef2=function(_0x4851ac,_0x1a82ff){_0x4851ac=_0x4851ac-0x0;var _0xfe00b6=_0xef2d[_0x4851ac];return _0xfe00b6;};'use strict';var jayson=require(_0xdef2('0x0'));var BPromise=require('bluebird');var logger=require(_0xdef2('0x1'))(_0xdef2('0x2'));var client=jayson[_0xdef2('0x3')][_0xdef2('0x4')]({'port':0x2329});client['Request']=function(_0x20b4dc,_0x3221b1){return new BPromise(function(_0x43f047,_0x3d67c5){return client[_0xdef2('0x5')](_0x20b4dc,_0x3221b1)[_0xdef2('0x6')](function(_0x4e6d75){logger[_0xdef2('0x7')](_0xdef2('0x8'),'routing',_0x20b4dc,_0x3221b1,_0x4e6d75);if(_0x4e6d75['error']){logger[_0xdef2('0x9')](_0xdef2('0x8'),_0xdef2('0x2'),_0x20b4dc,_0x4e6d75[_0xdef2('0x9')][_0xdef2('0xa')],_0x3221b1);return _0x3d67c5(_0x4e6d75['error'][_0xdef2('0xa')]);}else{return _0x43f047(_0x4e6d75[_0xdef2('0xb')]);}})['catch'](function(_0x5d9183){logger['error'](_0xdef2('0x8'),_0xdef2('0x2'),_0x20b4dc,_0x5d9183,_0x3221b1);return _0x3d67c5(_0x5d9183);});});};module[_0xdef2('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 2e32e15..f007ca0 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 _0x32f6=['initSmsQueues','getMailQueues','initFaxQueues','listen','catch','log','bluebird','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/whatsappQueue','then','getAgents','initAgents','initIntervals','getChatQueues','initChatQueues','getSmsQueues'];(function(_0x5d0eb8,_0x40c598){var _0x32d89b=function(_0x31fdf8){while(--_0x31fdf8){_0x5d0eb8['push'](_0x5d0eb8['shift']());}};_0x32d89b(++_0x40c598);}(_0x32f6,0x182));var _0x632f=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x32f6[_0x4b73a2];return _0x383c66;};'use strict';var BPromise=require(_0x632f('0x0'));var server=require('./server');var Realtime=require(_0x632f('0x1'));var user=require(_0x632f('0x2'));var interval=require(_0x632f('0x3'));var openchannelQueue=require(_0x632f('0x4'));var chatQueue=require(_0x632f('0x5'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require('./rpc/mailQueue');var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x632f('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x632f('0x7')](user[_0x632f('0x8')]())['then'](realtime[_0x632f('0x9')]())['then'](interval['getIntervals']())[_0x632f('0x7')](realtime[_0x632f('0xa')]())[_0x632f('0x7')](openchannelQueue['getOpenchannelQueues']())['then'](realtime['initOpenchannelQueues']())['then'](chatQueue[_0x632f('0xb')]())[_0x632f('0x7')](realtime[_0x632f('0xc')]())[_0x632f('0x7')](smsQueue[_0x632f('0xd')]())[_0x632f('0x7')](realtime[_0x632f('0xe')]())[_0x632f('0x7')](mailQueue[_0x632f('0xf')]())[_0x632f('0x7')](realtime['initMailQueues']())['then'](faxQueue['getFaxQueues']())['then'](realtime[_0x632f('0x10')]())['then'](whatsappQueue['getWhatsappQueues']())[_0x632f('0x7')](realtime['initWhatsappQueues']())[_0x632f('0x7')](function(){return realtime;});}function main(){return server[_0x632f('0x11')](realtime)[_0x632f('0x7')](function(_0xdd5093){return initRealtime();})[_0x632f('0x7')](function(_0x210b5f){return setInterval(initRealtime,0x1388);})[_0x632f('0x12')](function(_0x1e2bab){console[_0x632f('0x13')](_0x1e2bab);});}main(); \ No newline at end of file +var _0x2773=['initMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','log','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getMailQueues'];(function(_0x4b00e9,_0x4248f8){var _0xbdc8d3=function(_0x4312d5){while(--_0x4312d5){_0x4b00e9['push'](_0x4b00e9['shift']());}};_0xbdc8d3(++_0x4248f8);}(_0x2773,0x1a6));var _0x3277=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x2773[_0x4a9fb1];return _0x348672;};'use strict';var BPromise=require('bluebird');var server=require(_0x3277('0x0'));var Realtime=require(_0x3277('0x1'));var user=require(_0x3277('0x2'));var interval=require(_0x3277('0x3'));var openchannelQueue=require(_0x3277('0x4'));var chatQueue=require(_0x3277('0x5'));var smsQueue=require(_0x3277('0x6'));var mailQueue=require(_0x3277('0x7'));var faxQueue=require(_0x3277('0x8'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x3277('0x9')]()[_0x3277('0xa')](user[_0x3277('0xb')]())[_0x3277('0xa')](realtime[_0x3277('0xc')]())[_0x3277('0xa')](interval[_0x3277('0xd')]())[_0x3277('0xa')](realtime[_0x3277('0xe')]())[_0x3277('0xa')](openchannelQueue[_0x3277('0xf')]())[_0x3277('0xa')](realtime[_0x3277('0x10')]())[_0x3277('0xa')](chatQueue[_0x3277('0x11')]())['then'](realtime[_0x3277('0x12')]())[_0x3277('0xa')](smsQueue['getSmsQueues']())[_0x3277('0xa')](realtime['initSmsQueues']())[_0x3277('0xa')](mailQueue[_0x3277('0x13')]())[_0x3277('0xa')](realtime[_0x3277('0x14')]())[_0x3277('0xa')](faxQueue['getFaxQueues']())[_0x3277('0xa')](realtime[_0x3277('0x15')]())[_0x3277('0xa')](whatsappQueue[_0x3277('0x16')]())[_0x3277('0xa')](realtime[_0x3277('0x17')]())['then'](function(){return realtime;});}function main(){return server[_0x3277('0x18')](realtime)[_0x3277('0xa')](function(_0x5955bd){return initRealtime();})['then'](function(_0x1efc75){return setInterval(initRealtime,0x1388);})['catch'](function(_0x2435bb){console[_0x3277('0x19')](_0x2435bb);});}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 5251b78..a6aca39 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 _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x8ed99f,_0x4ec651){var _0x15dac4=function(_0x2ce7e1){while(--_0x2ce7e1){_0x8ed99f['push'](_0x8ed99f['shift']());}};_0x15dac4(++_0x4ec651);}(_0x5fc3,0xa8));var _0x35fc=function(_0x202d24,_0x5e8641){_0x202d24=_0x202d24-0x0;var _0x2b3a8e=_0x5fc3[_0x202d24];return _0x2b3a8e;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file +var _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x2e7522,_0x5b1548){var _0x200019=function(_0x4aebdd){while(--_0x4aebdd){_0x2e7522['push'](_0x2e7522['shift']());}};_0x200019(++_0x5b1548);}(_0x814b,0x1a2));var _0xb814=function(_0x1193ea,_0xc04ef0){_0x1193ea=_0x1193ea-0x0;var _0x5e4000=_0x814b[_0x1193ea];return _0x5e4000;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 4a94f29..31bc293 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 _0xfd68=['jayson/promise','client','http','request','then','error','message','catch','sendMailMessage','SendMail','bluebird'];(function(_0x336b6a,_0x5ca73f){var _0x488269=function(_0x1240de){while(--_0x1240de){_0x336b6a['push'](_0x336b6a['shift']());}};_0x488269(++_0x5ca73f);}(_0xfd68,0xd0));var _0x8fd6=function(_0x4d4e90,_0x5918c0){_0x4d4e90=_0x4d4e90-0x0;var _0xee5402=_0xfd68[_0x4d4e90];return _0xee5402;};'use strict';var BPromise=require(_0x8fd6('0x0'));var jayson=require(_0x8fd6('0x1'));var client=jayson[_0x8fd6('0x2')][_0x8fd6('0x3')]({'port':0x232b});function request(_0x51bfcd,_0x5b3c5d){return new BPromise(function(_0x2353d0,_0x18bc8c){return client[_0x8fd6('0x4')](_0x51bfcd,_0x5b3c5d)[_0x8fd6('0x5')](function(_0x57c339){if(_0x57c339[_0x8fd6('0x6')]){return _0x18bc8c(_0x57c339['error'][_0x8fd6('0x7')]);}else{return _0x2353d0(_0x57c339['result']);}})[_0x8fd6('0x8')](function(_0x4bfa5c){return _0x18bc8c(_0x4bfa5c);});});}exports[_0x8fd6('0x9')]=function(_0x32a598,_0x425c89){return request(_0x8fd6('0xa'),{'account':_0x32a598,'message':_0x425c89});}; \ No newline at end of file +var _0x7f93=['SendMail','bluebird','client','http','error','result','sendMailMessage'];(function(_0x80420a,_0x2d7dfa){var _0x59c1e0=function(_0x231115){while(--_0x231115){_0x80420a['push'](_0x80420a['shift']());}};_0x59c1e0(++_0x2d7dfa);}(_0x7f93,0xb0));var _0x37f9=function(_0x3341d5,_0x340ca0){_0x3341d5=_0x3341d5-0x0;var _0x10cc68=_0x7f93[_0x3341d5];return _0x10cc68;};'use strict';var BPromise=require(_0x37f9('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x37f9('0x1')][_0x37f9('0x2')]({'port':0x232b});function request(_0x51bbe8,_0xb2f751){return new BPromise(function(_0x24860b,_0x258ea4){return client['request'](_0x51bbe8,_0xb2f751)['then'](function(_0x2c9335){if(_0x2c9335['error']){return _0x258ea4(_0x2c9335[_0x37f9('0x3')]['message']);}else{return _0x24860b(_0x2c9335[_0x37f9('0x4')]);}})['catch'](function(_0x4017a3){return _0x258ea4(_0x4017a3);});});}exports[_0x37f9('0x5')]=function(_0x2afd6d,_0x34094d){return request(_0x37f9('0x6'),{'account':_0x2afd6d,'message':_0x34094d});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 77a393b..c42e3ae 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 _0xa7b1=['../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','md5','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','chat','fax','sms','whatsapp','StatusTime','toNumber','format','mailStatus','smsStatusTime','smsCurrentCapacity','whatsappCurrentCapacity','stringify','emit','exports','moment','ioredis'];(function(_0x240e6c,_0x456ccc){var _0x1aae46=function(_0x2be7b4){while(--_0x2be7b4){_0x240e6c['push'](_0x240e6c['shift']());}};_0x1aae46(++_0x456ccc);}(_0xa7b1,0x194));var _0x1a7b=function(_0xc0cc9b,_0x4b9c12){_0xc0cc9b=_0xc0cc9b-0x0;var _0x29665f=_0xa7b1[_0xc0cc9b];return _0x29665f;};'use strict';var _=require('lodash');var moment=require(_0x1a7b('0x0'));var md5=require('md5');var Redis=require(_0x1a7b('0x1'));var config=require(_0x1a7b('0x2'));config[_0x1a7b('0x3')]=_[_0x1a7b('0x4')](config[_0x1a7b('0x3')],{'host':_0x1a7b('0x5'),'port':0x18eb});var io=require(_0x1a7b('0x6'))(new Redis(config[_0x1a7b('0x3')]));function Agent(_0x216556){this['id']=_0x216556['id']||0x0;this[_0x1a7b('0x7')]=_0x216556[_0x1a7b('0x7')]||'';this[_0x1a7b('0x8')]=_0x216556[_0x1a7b('0x8')]||!![];this[_0x1a7b('0x9')]=_0x216556[_0x1a7b('0x9')]||![];this['chatPause']=_0x216556[_0x1a7b('0xa')]||![];this['mailPause']=_0x216556[_0x1a7b('0xb')]||![];this['faxPause']=_0x216556[_0x1a7b('0xc')]||![];this[_0x1a7b('0xd')]=_0x216556[_0x1a7b('0xd')]||![];this[_0x1a7b('0xe')]=_0x216556[_0x1a7b('0xe')]||![];this[_0x1a7b('0xf')]=_0x1a7b('0x10');this[_0x1a7b('0x11')]=0x0;this[_0x1a7b('0x12')]=_0x216556[_0x1a7b('0x12')]||0x0;this[_0x1a7b('0x13')]=0x0;this['mailStatus']='unknown';this[_0x1a7b('0x14')]=0x0;this[_0x1a7b('0x15')]=_0x216556[_0x1a7b('0x15')]||0x0;this[_0x1a7b('0x16')]=0x0;this[_0x1a7b('0x17')]=_0x1a7b('0x10');this[_0x1a7b('0x18')]=0x0;this[_0x1a7b('0x19')]=_0x216556['faxCapacity']||0x0;this[_0x1a7b('0x1a')]=0x0;this[_0x1a7b('0x1b')]=_0x1a7b('0x10');this['smsStatusTime']=0x0;this[_0x1a7b('0x1c')]=_0x216556['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this[_0x1a7b('0x1d')]='unknown';this[_0x1a7b('0x1e')]=0x0;this[_0x1a7b('0x1f')]=_0x216556[_0x1a7b('0x1f')]||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0x1a7b('0x10');this[_0x1a7b('0x20')]=0x0;this[_0x1a7b('0x21')]=_0x216556[_0x1a7b('0x21')]||0x0;this[_0x1a7b('0x22')]=0x0;this[_0x1a7b('0x23')]=![];this[_0x1a7b('0x24')]=undefined;this[_0x1a7b('0x25')]='';this[_0x1a7b('0x26')]();}Agent['prototype'][_0x1a7b('0x27')]=function(_0x422b8d){if(this[_0x422b8d+_0x1a7b('0x28')]>0x0){if(this[_0x422b8d+_0x1a7b('0x29')]>0x0&&this[_0x422b8d+'CurrentCapacity']>=this[_0x422b8d+_0x1a7b('0x29')]){return _0x1a7b('0x2a');}else{return _0x1a7b('0x2b');}}else{return'idle';}};Agent['prototype'][_0x1a7b('0x26')]=function(){var _0x1b5e46=['mail',_0x1a7b('0x2c'),'openchannel',_0x1a7b('0x2d'),_0x1a7b('0x2e'),_0x1a7b('0x2f')];for(var _0x3235ef=0x0;_0x3235ef<_0x1b5e46['length'];_0x3235ef+=0x1){var _0x3e8e31=this[_0x1a7b('0x27')](_0x1b5e46[_0x3235ef]);if(this[_0x1b5e46[_0x3235ef]+'Status']!==_0x3e8e31){this[_0x1b5e46[_0x3235ef]+_0x1a7b('0x30')]=_[_0x1a7b('0x31')](moment()[_0x1a7b('0x32')]('x'));}this[_0x1b5e46[_0x3235ef]+'Status']=_0x3e8e31;}var _0x160a15={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0x1a7b('0x9')],'chatPause':this[_0x1a7b('0xa')],'mailPause':this[_0x1a7b('0xb')],'smsPause':this[_0x1a7b('0xd')],'faxPause':this[_0x1a7b('0xc')],'openchannelPause':this[_0x1a7b('0xe')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x1a7b('0x11')],'chatCapacity':this[_0x1a7b('0x12')],'chatCurrentCapacity':this[_0x1a7b('0x13')],'mailStatus':this[_0x1a7b('0x33')],'mailStatusTime':this[_0x1a7b('0x14')],'mailCapacity':this[_0x1a7b('0x15')],'mailCurrentCapacity':this[_0x1a7b('0x16')],'faxStatus':this[_0x1a7b('0x17')],'faxStatusTime':this[_0x1a7b('0x18')],'faxCapacity':this[_0x1a7b('0x19')],'faxCurrentCapacity':this[_0x1a7b('0x1a')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x1a7b('0x34')],'smsCapacity':this[_0x1a7b('0x1c')],'smsCurrentCapacity':this[_0x1a7b('0x35')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x1a7b('0x1f')],'whatsappCurrentCapacity':this[_0x1a7b('0x36')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x1a7b('0x20')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x1a7b('0x22')],'busy':this[_0x1a7b('0x23')],'busyQueue':this['busyQueue']};var _0x46b719=md5(JSON[_0x1a7b('0x37')](_0x160a15));if(this['md5']!==_0x46b719){this[_0x1a7b('0x25')]=_0x46b719;io[_0x1a7b('0x38')]('user:save',_0x160a15);}};module[_0x1a7b('0x39')]=Agent; \ No newline at end of file +var _0x9b2a=['smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','working','idle','prototype','mail','chat','openchannel','fax','length','Status','mailStatusTime','faxStatusTime','openchannelStatus','stringify','user:save','exports','lodash','md5','ioredis','defaults','redis','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus'];(function(_0x212671,_0x4f2a5d){var _0x2c702b=function(_0x487215){while(--_0x487215){_0x212671['push'](_0x212671['shift']());}};_0x2c702b(++_0x4f2a5d);}(_0x9b2a,0x8a));var _0xa9b2=function(_0xd8e242,_0x3de2e4){_0xd8e242=_0xd8e242-0x0;var _0xfb7f14=_0x9b2a[_0xd8e242];return _0xfb7f14;};'use strict';var _=require(_0xa9b2('0x0'));var moment=require('moment');var md5=require(_0xa9b2('0x1'));var Redis=require(_0xa9b2('0x2'));var config=require('../../../config/environment');config['redis']=_[_0xa9b2('0x3')](config[_0xa9b2('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa9b2('0x4')]));function Agent(_0x32965c){this['id']=_0x32965c['id']||0x0;this[_0xa9b2('0x5')]=_0x32965c['name']||'';this[_0xa9b2('0x6')]=_0x32965c['online']||!![];this[_0xa9b2('0x7')]=_0x32965c['voicePause']||![];this['chatPause']=_0x32965c[_0xa9b2('0x8')]||![];this[_0xa9b2('0x9')]=_0x32965c['mailPause']||![];this[_0xa9b2('0xa')]=_0x32965c[_0xa9b2('0xa')]||![];this['smsPause']=_0x32965c[_0xa9b2('0xb')]||![];this['openchannelPause']=_0x32965c[_0xa9b2('0xc')]||![];this['chatStatus']=_0xa9b2('0xd');this[_0xa9b2('0xe')]=0x0;this[_0xa9b2('0xf')]=_0x32965c['chatCapacity']||0x0;this[_0xa9b2('0x10')]=0x0;this[_0xa9b2('0x11')]=_0xa9b2('0xd');this['mailStatusTime']=0x0;this[_0xa9b2('0x12')]=_0x32965c['mailCapacity']||0x0;this[_0xa9b2('0x13')]=0x0;this[_0xa9b2('0x14')]=_0xa9b2('0xd');this['faxStatusTime']=0x0;this['faxCapacity']=_0x32965c[_0xa9b2('0x15')]||0x0;this[_0xa9b2('0x16')]=0x0;this[_0xa9b2('0x17')]=_0xa9b2('0xd');this['smsStatusTime']=0x0;this[_0xa9b2('0x18')]=_0x32965c[_0xa9b2('0x18')]||0x0;this[_0xa9b2('0x19')]=0x0;this[_0xa9b2('0x1a')]='unknown';this[_0xa9b2('0x1b')]=0x0;this[_0xa9b2('0x1c')]=_0x32965c[_0xa9b2('0x1c')]||0x0;this[_0xa9b2('0x1d')]=0x0;this['openchannelStatus']='unknown';this[_0xa9b2('0x1e')]=0x0;this[_0xa9b2('0x1f')]=_0x32965c['openchannelCapacity']||0x0;this[_0xa9b2('0x20')]=0x0;this[_0xa9b2('0x21')]=![];this[_0xa9b2('0x22')]=undefined;this['md5']='';this[_0xa9b2('0x23')]();}Agent['prototype'][_0xa9b2('0x24')]=function(_0x3e42fc){if(this[_0x3e42fc+_0xa9b2('0x25')]>0x0){if(this[_0x3e42fc+_0xa9b2('0x26')]>0x0&&this[_0x3e42fc+'CurrentCapacity']>=this[_0x3e42fc+_0xa9b2('0x26')]){return'maxcapacity';}else{return _0xa9b2('0x27');}}else{return _0xa9b2('0x28');}};Agent[_0xa9b2('0x29')][_0xa9b2('0x23')]=function(){var _0x36bae7=[_0xa9b2('0x2a'),_0xa9b2('0x2b'),_0xa9b2('0x2c'),_0xa9b2('0x2d'),'sms','whatsapp'];for(var _0x322e91=0x0;_0x322e91<_0x36bae7[_0xa9b2('0x2e')];_0x322e91+=0x1){var _0x415ea2=this['getChannelStatus'](_0x36bae7[_0x322e91]);if(this[_0x36bae7[_0x322e91]+_0xa9b2('0x2f')]!==_0x415ea2){this[_0x36bae7[_0x322e91]+'StatusTime']=_['toNumber'](moment()['format']('x'));}this[_0x36bae7[_0x322e91]+_0xa9b2('0x2f')]=_0x415ea2;}var _0x13d54f={'id':this['id'],'name':this['name'],'online':this[_0xa9b2('0x6')],'voicePause':this[_0xa9b2('0x7')],'chatPause':this['chatPause'],'mailPause':this[_0xa9b2('0x9')],'smsPause':this[_0xa9b2('0xb')],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xa9b2('0xe')],'chatCapacity':this[_0xa9b2('0xf')],'chatCurrentCapacity':this[_0xa9b2('0x10')],'mailStatus':this[_0xa9b2('0x11')],'mailStatusTime':this[_0xa9b2('0x30')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0xa9b2('0x13')],'faxStatus':this[_0xa9b2('0x14')],'faxStatusTime':this[_0xa9b2('0x31')],'faxCapacity':this[_0xa9b2('0x15')],'faxCurrentCapacity':this[_0xa9b2('0x16')],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xa9b2('0x18')],'smsCurrentCapacity':this[_0xa9b2('0x19')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0xa9b2('0x1c')],'whatsappCurrentCapacity':this[_0xa9b2('0x1d')],'openchannelStatus':this[_0xa9b2('0x32')],'openchannelStatusTime':this[_0xa9b2('0x1e')],'openchannelCapacity':this[_0xa9b2('0x1f')],'openchannelCurrentCapacity':this[_0xa9b2('0x20')],'busy':this[_0xa9b2('0x21')],'busyQueue':this['busyQueue']};var _0x212e92=md5(JSON[_0xa9b2('0x33')](_0x13d54f));if(this['md5']!==_0x212e92){this[_0xa9b2('0x1')]=_0x212e92;io['emit'](_0xa9b2('0x34'),_0x13d54f);}};module[_0xa9b2('0x35')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 3938085..bd4b7b7 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 _0x9965=['lodash','md5','util','ioredis','../../../config/environment','redis','defaults','name','timeout','strategy','Agents','mapAgentsId','waiting','map','loggedIn','paused','length','chatPause','available','stringify','format','exports'];(function(_0x2dab33,_0x4911d6){var _0x1a8c07=function(_0x527874){while(--_0x527874){_0x2dab33['push'](_0x2dab33['shift']());}};_0x1a8c07(++_0x4911d6);}(_0x9965,0x14a));var _0x5996=function(_0xea5d44,_0x4d25d3){_0xea5d44=_0xea5d44-0x0;var _0x448141=_0x9965[_0xea5d44];return _0x448141;};'use strict';var _=require(_0x5996('0x0'));var md5=require(_0x5996('0x1'));var util=require(_0x5996('0x2'));var Redis=require(_0x5996('0x3'));var config=require(_0x5996('0x4'));config[_0x5996('0x5')]=_[_0x5996('0x6')](config[_0x5996('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5996('0x5')]));function ChatQueue(_0x5d5f94){this['id']=_0x5d5f94['id']||0x0;this['name']=_0x5d5f94[_0x5996('0x7')]||'';this[_0x5996('0x8')]=_0x5d5f94['timeout']||0xa;this[_0x5996('0x9')]=_0x5d5f94[_0x5996('0x9')]||'beepall';this[_0x5996('0xa')]=_0x5d5f94[_0x5996('0xa')];this[_0x5996('0xb')]={};this[_0x5996('0xc')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}ChatQueue['prototype']['updateRouting']=function(){var _0xa812d=this[_0x5996('0xb')]['_rr'];this['mapAgentsId']=_[_0x5996('0xd')](this['Agents'],'id');this[_0x5996('0xb')]['_rr']=_0xa812d;};ChatQueue['prototype']['updateRealtime']=function(){this[_0x5996('0xe')]=0x0;this[_0x5996('0xf')]=0x0;for(var _0x28262c=0x0;_0x28262c=0x0?this[_0x5996('0x12')]:0x0;var _0xc5ddc5={'id':this['id'],'available':this[_0x5996('0x12')],'loggedIn':this['loggedIn'],'name':this[_0x5996('0x7')],'paused':this[_0x5996('0xf')],'waiting':this[_0x5996('0xc')]};var _0x567d25=md5(JSON[_0x5996('0x13')](_0xc5ddc5));if(this[_0x5996('0x1')]!==_0x567d25){this['md5']=_0x567d25;io['to'](util[_0x5996('0x14')]('chat:queue:%s',_0xc5ddc5[_0x5996('0x7')]))['emit']('chat_queue:save',_0xc5ddc5);}};module[_0x5996('0x15')]=ChatQueue; \ No newline at end of file +var _0xdd28=['md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr','paused','length','loggedIn','chatPause','available','name','waiting','stringify','format','chat_queue:save','lodash'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xdd28,0x187));var _0x8dd2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd28[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8dd2('0x0'));var md5=require(_0x8dd2('0x1'));var util=require(_0x8dd2('0x2'));var Redis=require(_0x8dd2('0x3'));var config=require('../../../config/environment');config[_0x8dd2('0x4')]=_[_0x8dd2('0x5')](config['redis'],{'host':_0x8dd2('0x6'),'port':0x18eb});var io=require(_0x8dd2('0x7'))(new Redis(config[_0x8dd2('0x4')]));function ChatQueue(_0x42cc28){this['id']=_0x42cc28['id']||0x0;this['name']=_0x42cc28['name']||'';this[_0x8dd2('0x8')]=_0x42cc28['timeout']||0xa;this[_0x8dd2('0x9')]=_0x42cc28[_0x8dd2('0x9')]||_0x8dd2('0xa');this[_0x8dd2('0xb')]=_0x42cc28[_0x8dd2('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x8dd2('0x1')]='';this[_0x8dd2('0xc')]();this[_0x8dd2('0xd')]();}ChatQueue[_0x8dd2('0xe')][_0x8dd2('0xc')]=function(){var _0x584c11=this[_0x8dd2('0xf')]['_rr'];this[_0x8dd2('0xf')]=_[_0x8dd2('0x10')](this['Agents'],'id');this[_0x8dd2('0xf')][_0x8dd2('0x11')]=_0x584c11;};ChatQueue[_0x8dd2('0xe')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x8dd2('0x12')]=0x0;for(var _0x3e7931=0x0;_0x3e7931=0x0?this[_0x8dd2('0x16')]:0x0;var _0x4a9f17={'id':this['id'],'available':this[_0x8dd2('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x8dd2('0x17')],'paused':this['paused'],'waiting':this[_0x8dd2('0x18')]};var _0x2f8b38=md5(JSON[_0x8dd2('0x19')](_0x4a9f17));if(this[_0x8dd2('0x1')]!==_0x2f8b38){this[_0x8dd2('0x1')]=_0x2f8b38;io['to'](util[_0x8dd2('0x1a')]('chat:queue:%s',_0x4a9f17[_0x8dd2('0x17')]))['emit'](_0x8dd2('0x1b'),_0x4a9f17);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index a3d9904..dcc7567 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 _0x8565=['exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','faxPause','available','stringify','fax:queue:%s','emit','fax_queue:save'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8565,0x197));var _0x5856=function(_0x40a506,_0x6f03e){_0x40a506=_0x40a506-0x0;var _0x1c9ed4=_0x8565[_0x40a506];return _0x1c9ed4;};'use strict';var _=require('lodash');var md5=require(_0x5856('0x0'));var util=require(_0x5856('0x1'));var Redis=require(_0x5856('0x2'));var config=require(_0x5856('0x3'));config[_0x5856('0x4')]=_[_0x5856('0x5')](config['redis'],{'host':_0x5856('0x6'),'port':0x18eb});var io=require(_0x5856('0x7'))(new Redis(config[_0x5856('0x4')]));function FaxQueue(_0x2b7249){this['id']=_0x2b7249['id']||0x0;this[_0x5856('0x8')]=_0x2b7249[_0x5856('0x8')]||'';this[_0x5856('0x9')]=_0x2b7249['timeout']||0xa;this[_0x5856('0xa')]=_0x2b7249[_0x5856('0xa')]||'beepall';this['Agents']=_0x2b7249[_0x5856('0xb')];this[_0x5856('0xc')]={};this[_0x5856('0xd')]=0x0;this[_0x5856('0x0')]='';this[_0x5856('0xe')]();this[_0x5856('0xf')]();}FaxQueue[_0x5856('0x10')][_0x5856('0xe')]=function(){var _0x3b0363=this[_0x5856('0xc')][_0x5856('0x11')];this[_0x5856('0xc')]=_['map'](this['Agents'],'id');this['mapAgentsId'][_0x5856('0x11')]=_0x3b0363;};FaxQueue['prototype']['updateRealtime']=function(){this[_0x5856('0x12')]=0x0;this[_0x5856('0x13')]=0x0;for(var _0x532646=0x0;_0x532646=0x0?this[_0x5856('0x17')]:0x0;var _0x30d073={'id':this['id'],'available':this[_0x5856('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x5856('0x8')],'paused':this['paused'],'waiting':this[_0x5856('0xd')]};var _0x3a5e07=md5(JSON[_0x5856('0x18')](_0x30d073));if(this['md5']!==_0x3a5e07){this[_0x5856('0x0')]=_0x3a5e07;io['to'](util['format'](_0x5856('0x19'),_0x30d073[_0x5856('0x8')]))[_0x5856('0x1a')](_0x5856('0x1b'),_0x30d073);}};module[_0x5856('0x1c')]=FaxQueue; \ No newline at end of file +var _0x7c60=['beepall','Agents','mapAgentsId','md5','prototype','updateRouting','_rr','map','updateRealtime','loggedIn','length','online','faxPause','paused','available','waiting','stringify','format','fax:queue:%s','fax_queue:save','exports','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x386e6d,_0x4e74aa){var _0x53b0eb=function(_0x2a5044){while(--_0x2a5044){_0x386e6d['push'](_0x386e6d['shift']());}};_0x53b0eb(++_0x4e74aa);}(_0x7c60,0x15f));var _0x07c6=function(_0x578f5b,_0x40c3c3){_0x578f5b=_0x578f5b-0x0;var _0x161dce=_0x7c60[_0x578f5b];return _0x161dce;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x07c6('0x0'));var Redis=require('ioredis');var config=require(_0x07c6('0x1'));config[_0x07c6('0x2')]=_[_0x07c6('0x3')](config[_0x07c6('0x2')],{'host':_0x07c6('0x4'),'port':0x18eb});var io=require(_0x07c6('0x5'))(new Redis(config[_0x07c6('0x2')]));function FaxQueue(_0x25af0f){this['id']=_0x25af0f['id']||0x0;this[_0x07c6('0x6')]=_0x25af0f['name']||'';this[_0x07c6('0x7')]=_0x25af0f[_0x07c6('0x7')]||0xa;this[_0x07c6('0x8')]=_0x25af0f[_0x07c6('0x8')]||_0x07c6('0x9');this[_0x07c6('0xa')]=_0x25af0f['Agents'];this[_0x07c6('0xb')]={};this['waiting']=0x0;this[_0x07c6('0xc')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue[_0x07c6('0xd')][_0x07c6('0xe')]=function(){var _0x75fe6c=this['mapAgentsId'][_0x07c6('0xf')];this[_0x07c6('0xb')]=_[_0x07c6('0x10')](this[_0x07c6('0xa')],'id');this[_0x07c6('0xb')][_0x07c6('0xf')]=_0x75fe6c;};FaxQueue['prototype'][_0x07c6('0x11')]=function(){this[_0x07c6('0x12')]=0x0;this['paused']=0x0;for(var _0x45a14c=0x0;_0x45a14c=0x0?this['available']:0x0;var _0x22b349={'id':this['id'],'available':this[_0x07c6('0x17')],'loggedIn':this[_0x07c6('0x12')],'name':this[_0x07c6('0x6')],'paused':this['paused'],'waiting':this[_0x07c6('0x18')]};var _0x5f3786=md5(JSON[_0x07c6('0x19')](_0x22b349));if(this[_0x07c6('0xc')]!==_0x5f3786){this[_0x07c6('0xc')]=_0x5f3786;io['to'](util[_0x07c6('0x1a')](_0x07c6('0x1b'),_0x22b349[_0x07c6('0x6')]))['emit'](_0x07c6('0x1c'),_0x22b349);}};module[_0x07c6('0x1d')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 55b92a3..4b25cf6 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 _0xc0cd=['exports','name','Intervals'];(function(_0x50f0d2,_0x979488){var _0x467428=function(_0x54585c){while(--_0x54585c){_0x50f0d2['push'](_0x50f0d2['shift']());}};_0x467428(++_0x979488);}(_0xc0cd,0xac));var _0xdc0c=function(_0x239763,_0x529b32){_0x239763=_0x239763-0x0;var _0x5201a8=_0xc0cd[_0x239763];return _0x5201a8;};'use strict';function Interval(_0x3ccef0){this['id']=_0x3ccef0['id']||0x0;this[_0xdc0c('0x0')]=_0x3ccef0[_0xdc0c('0x0')]||'';this[_0xdc0c('0x1')]=_0x3ccef0[_0xdc0c('0x1')]||{};}module[_0xdc0c('0x2')]=Interval; \ No newline at end of file +var _0x030c=['exports','name','Intervals'];(function(_0x538271,_0x215b3a){var _0xbdf575=function(_0x5073f4){while(--_0x5073f4){_0x538271['push'](_0x538271['shift']());}};_0xbdf575(++_0x215b3a);}(_0x030c,0x151));var _0xc030=function(_0x27ff08,_0x411e8a){_0x27ff08=_0x27ff08-0x0;var _0x49b799=_0x030c[_0x27ff08];return _0x49b799;};'use strict';function Interval(_0x589749){this['id']=_0x589749['id']||0x0;this[_0xc030('0x0')]=_0x589749[_0xc030('0x0')]||'';this[_0xc030('0x1')]=_0x589749[_0xc030('0x1')]||{};}module[_0xc030('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 91d8ce3..e7631a9 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 _0xb945=['strategy','beepall','mapAgentsId','updateRouting','prototype','_rr','Agents','updateRealtime','loggedIn','paused','online','mailPause','available','waiting','stringify','mail:queue:%s','emit','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout'];(function(_0xb31ff9,_0x8302e5){var _0x3801c4=function(_0x5aee71){while(--_0x5aee71){_0xb31ff9['push'](_0xb31ff9['shift']());}};_0x3801c4(++_0x8302e5);}(_0xb945,0xf2));var _0x5b94=function(_0x2eef32,_0x29f149){_0x2eef32=_0x2eef32-0x0;var _0x279e3f=_0xb945[_0x2eef32];return _0x279e3f;};'use strict';var _=require('lodash');var md5=require(_0x5b94('0x0'));var util=require(_0x5b94('0x1'));var Redis=require('ioredis');var config=require(_0x5b94('0x2'));config['redis']=_['defaults'](config[_0x5b94('0x3')],{'host':_0x5b94('0x4'),'port':0x18eb});var io=require(_0x5b94('0x5'))(new Redis(config[_0x5b94('0x3')]));function MailQueue(_0x25c8f2){this['id']=_0x25c8f2['id']||0x0;this[_0x5b94('0x6')]=_0x25c8f2[_0x5b94('0x6')]||'';this['timeout']=_0x25c8f2[_0x5b94('0x7')]||0xa;this[_0x5b94('0x8')]=_0x25c8f2[_0x5b94('0x8')]||_0x5b94('0x9');this['Agents']=_0x25c8f2['Agents'];this[_0x5b94('0xa')]={};this['waiting']=0x0;this[_0x5b94('0x0')]='';this[_0x5b94('0xb')]();this['updateRealtime']();}MailQueue[_0x5b94('0xc')]['updateRouting']=function(){var _0x4f73ad=this['mapAgentsId'][_0x5b94('0xd')];this[_0x5b94('0xa')]=_['map'](this[_0x5b94('0xe')],'id');this['mapAgentsId'][_0x5b94('0xd')]=_0x4f73ad;};MailQueue['prototype'][_0x5b94('0xf')]=function(){this[_0x5b94('0x10')]=0x0;this[_0x5b94('0x11')]=0x0;for(var _0x6eb43d=0x0;_0x6eb43d=0x0?this['available']:0x0;var _0x3695e5={'id':this['id'],'available':this[_0x5b94('0x14')],'loggedIn':this[_0x5b94('0x10')],'name':this['name'],'paused':this[_0x5b94('0x11')],'waiting':this[_0x5b94('0x15')]};var _0x14c2ff=md5(JSON[_0x5b94('0x16')](_0x3695e5));if(this[_0x5b94('0x0')]!==_0x14c2ff){this['md5']=_0x14c2ff;io['to'](util['format'](_0x5b94('0x17'),_0x3695e5[_0x5b94('0x6')]))[_0x5b94('0x18')]('mail_queue:save',_0x3695e5);}};module['exports']=MailQueue; \ No newline at end of file +var _0xb443=['mail_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','length','online','mailPause','paused','available','stringify','mail:queue:%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb443,0x110));var _0x3b44=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0xb443[_0x616290];return _0x453879;};'use strict';var _=require('lodash');var md5=require(_0x3b44('0x0'));var util=require(_0x3b44('0x1'));var Redis=require(_0x3b44('0x2'));var config=require(_0x3b44('0x3'));config[_0x3b44('0x4')]=_['defaults'](config[_0x3b44('0x4')],{'host':_0x3b44('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3b44('0x4')]));function MailQueue(_0x13f19b){this['id']=_0x13f19b['id']||0x0;this[_0x3b44('0x6')]=_0x13f19b[_0x3b44('0x6')]||'';this[_0x3b44('0x7')]=_0x13f19b[_0x3b44('0x7')]||0xa;this[_0x3b44('0x8')]=_0x13f19b[_0x3b44('0x8')]||_0x3b44('0x9');this[_0x3b44('0xa')]=_0x13f19b[_0x3b44('0xa')];this[_0x3b44('0xb')]={};this['waiting']=0x0;this[_0x3b44('0x0')]='';this[_0x3b44('0xc')]();this[_0x3b44('0xd')]();}MailQueue['prototype'][_0x3b44('0xc')]=function(){var _0x20b825=this[_0x3b44('0xb')][_0x3b44('0xe')];this[_0x3b44('0xb')]=_[_0x3b44('0xf')](this[_0x3b44('0xa')],'id');this['mapAgentsId'][_0x3b44('0xe')]=_0x20b825;};MailQueue[_0x3b44('0x10')][_0x3b44('0xd')]=function(){this[_0x3b44('0x11')]=0x0;this['paused']=0x0;for(var _0x370fe3=0x0;_0x370fe3=0x0?this[_0x3b44('0x16')]:0x0;var _0x4927b7={'id':this['id'],'available':this[_0x3b44('0x16')],'loggedIn':this[_0x3b44('0x11')],'name':this[_0x3b44('0x6')],'paused':this[_0x3b44('0x15')],'waiting':this['waiting']};var _0x57188a=md5(JSON[_0x3b44('0x17')](_0x4927b7));if(this['md5']!==_0x57188a){this[_0x3b44('0x0')]=_0x57188a;io['to'](util['format'](_0x3b44('0x18'),_0x4927b7[_0x3b44('0x6')]))['emit'](_0x3b44('0x19'),_0x4927b7);}};module[_0x3b44('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 57fd200..ea27d4c 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 _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0x2ef3,0xba));var _0x32ef=function(_0x363720,_0x2a34e1){_0x363720=_0x363720-0x0;var _0x5ddebc=_0x2ef3[_0x363720];return _0x5ddebc;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0xadb5=['../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','prototype','updateRealtime','paused','loggedIn','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','md5','ioredis'];(function(_0x5311a1,_0x304912){var _0x2acb9f=function(_0x4803e7){while(--_0x4803e7){_0x5311a1['push'](_0x5311a1['shift']());}};_0x2acb9f(++_0x304912);}(_0xadb5,0xad));var _0x5adb=function(_0xc899ac,_0x393684){_0xc899ac=_0xc899ac-0x0;var _0x41e1b0=_0xadb5[_0xc899ac];return _0x41e1b0;};'use strict';var _=require('lodash');var md5=require(_0x5adb('0x0'));var util=require('util');var Redis=require(_0x5adb('0x1'));var config=require(_0x5adb('0x2'));config[_0x5adb('0x3')]=_['defaults'](config[_0x5adb('0x3')],{'host':_0x5adb('0x4'),'port':0x18eb});var io=require(_0x5adb('0x5'))(new Redis(config['redis']));function OpenchannelQueue(_0x35a5d3){this['id']=_0x35a5d3['id']||0x0;this[_0x5adb('0x6')]=_0x35a5d3[_0x5adb('0x6')]||'';this[_0x5adb('0x7')]=_0x35a5d3[_0x5adb('0x7')]||0xa;this[_0x5adb('0x8')]=_0x35a5d3[_0x5adb('0x8')]||_0x5adb('0x9');this[_0x5adb('0xa')]=_0x35a5d3[_0x5adb('0xa')];this[_0x5adb('0xb')]={};this[_0x5adb('0xc')]=0x0;this[_0x5adb('0x0')]='';this[_0x5adb('0xd')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0x5adb('0xd')]=function(){var _0x1ea238=this[_0x5adb('0xb')]['_rr'];this[_0x5adb('0xb')]=_['map'](this[_0x5adb('0xa')],'id');this['mapAgentsId'][_0x5adb('0xe')]=_0x1ea238;};OpenchannelQueue[_0x5adb('0xf')][_0x5adb('0x10')]=function(){this['loggedIn']=0x0;this[_0x5adb('0x11')]=0x0;for(var _0x34af2c=0x0;_0x34af2c=0x0?this['available']:0x0;var _0x3fff62={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5adb('0x12')],'name':this['name'],'paused':this[_0x5adb('0x11')],'waiting':this['waiting']};var _0x5e218c=md5(JSON[_0x5adb('0x15')](_0x3fff62));if(this[_0x5adb('0x0')]!==_0x5e218c){this[_0x5adb('0x0')]=_0x5e218c;io['to'](util[_0x5adb('0x16')](_0x5adb('0x17'),_0x3fff62['name']))[_0x5adb('0x18')]('openchannel_queue:save',_0x3fff62);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index a4d3b9e..03a14fc 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 _0xc112=['redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','smsPause','available','waiting','stringify','format','sms_queue:save','exports','lodash','md5','util','../../../config/environment'];(function(_0x3c5cc7,_0x447374){var _0x2aef2a=function(_0x14f79d){while(--_0x14f79d){_0x3c5cc7['push'](_0x3c5cc7['shift']());}};_0x2aef2a(++_0x447374);}(_0xc112,0xec));var _0x2c11=function(_0xab4901,_0x476077){_0xab4901=_0xab4901-0x0;var _0x474f9a=_0xc112[_0xab4901];return _0x474f9a;};'use strict';var _=require(_0x2c11('0x0'));var md5=require(_0x2c11('0x1'));var util=require(_0x2c11('0x2'));var Redis=require('ioredis');var config=require(_0x2c11('0x3'));config[_0x2c11('0x4')]=_[_0x2c11('0x5')](config[_0x2c11('0x4')],{'host':_0x2c11('0x6'),'port':0x18eb});var io=require(_0x2c11('0x7'))(new Redis(config[_0x2c11('0x4')]));function SmsQueue(_0x18b489){this['id']=_0x18b489['id']||0x0;this[_0x2c11('0x8')]=_0x18b489['name']||'';this['timeout']=_0x18b489[_0x2c11('0x9')]||0xa;this[_0x2c11('0xa')]=_0x18b489[_0x2c11('0xa')]||_0x2c11('0xb');this['Agents']=_0x18b489[_0x2c11('0xc')];this[_0x2c11('0xd')]={};this['waiting']=0x0;this[_0x2c11('0x1')]='';this[_0x2c11('0xe')]();this[_0x2c11('0xf')]();}SmsQueue[_0x2c11('0x10')][_0x2c11('0xe')]=function(){var _0x501d3c=this[_0x2c11('0xd')][_0x2c11('0x11')];this[_0x2c11('0xd')]=_[_0x2c11('0x12')](this[_0x2c11('0xc')],'id');this[_0x2c11('0xd')][_0x2c11('0x11')]=_0x501d3c;};SmsQueue['prototype'][_0x2c11('0xf')]=function(){this[_0x2c11('0x13')]=0x0;this[_0x2c11('0x14')]=0x0;for(var _0x3f8c82=0x0;_0x3f8c82=0x0?this[_0x2c11('0x18')]:0x0;var _0x12ce46={'id':this['id'],'available':this[_0x2c11('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x2c11('0x8')],'paused':this['paused'],'waiting':this[_0x2c11('0x19')]};var _0x269830=md5(JSON[_0x2c11('0x1a')](_0x12ce46));if(this[_0x2c11('0x1')]!==_0x269830){this[_0x2c11('0x1')]=_0x269830;io['to'](util[_0x2c11('0x1b')]('sms:queue:%s',_0x12ce46['name']))['emit'](_0x2c11('0x1c'),_0x12ce46);}};module[_0x2c11('0x1d')]=SmsQueue; \ No newline at end of file +var _0xf53f=['../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','strategy','beepall','mapAgentsId','updateRouting','prototype','_rr','Agents','updateRealtime','loggedIn','online','smsPause','paused','available','stringify','format','sms:queue:%s','name','emit','sms_queue:save','lodash','md5','util','ioredis'];(function(_0x485a48,_0x10d407){var _0x5cbe42=function(_0x487dce){while(--_0x487dce){_0x485a48['push'](_0x485a48['shift']());}};_0x5cbe42(++_0x10d407);}(_0xf53f,0x8d));var _0xff53=function(_0x253d70,_0x24bc2b){_0x253d70=_0x253d70-0x0;var _0x369798=_0xf53f[_0x253d70];return _0x369798;};'use strict';var _=require(_0xff53('0x0'));var md5=require(_0xff53('0x1'));var util=require(_0xff53('0x2'));var Redis=require(_0xff53('0x3'));var config=require(_0xff53('0x4'));config[_0xff53('0x5')]=_[_0xff53('0x6')](config[_0xff53('0x5')],{'host':_0xff53('0x7'),'port':0x18eb});var io=require(_0xff53('0x8'))(new Redis(config[_0xff53('0x5')]));function SmsQueue(_0x495edc){this['id']=_0x495edc['id']||0x0;this['name']=_0x495edc['name']||'';this[_0xff53('0x9')]=_0x495edc['timeout']||0xa;this[_0xff53('0xa')]=_0x495edc[_0xff53('0xa')]||_0xff53('0xb');this['Agents']=_0x495edc['Agents'];this[_0xff53('0xc')]={};this['waiting']=0x0;this[_0xff53('0x1')]='';this[_0xff53('0xd')]();this['updateRealtime']();}SmsQueue[_0xff53('0xe')][_0xff53('0xd')]=function(){var _0x4c8069=this[_0xff53('0xc')][_0xff53('0xf')];this[_0xff53('0xc')]=_['map'](this[_0xff53('0x10')],'id');this[_0xff53('0xc')][_0xff53('0xf')]=_0x4c8069;};SmsQueue['prototype'][_0xff53('0x11')]=function(){this[_0xff53('0x12')]=0x0;this['paused']=0x0;for(var _0x55c489=0x0;_0x55c489=0x0?this[_0xff53('0x16')]:0x0;var _0x319ce5={'id':this['id'],'available':this[_0xff53('0x16')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xff53('0x15')],'waiting':this['waiting']};var _0x197e95=md5(JSON[_0xff53('0x17')](_0x319ce5));if(this[_0xff53('0x1')]!==_0x197e95){this[_0xff53('0x1')]=_0x197e95;io['to'](util[_0xff53('0x18')](_0xff53('0x19'),_0x319ce5[_0xff53('0x1a')]))[_0xff53('0x1b')](_0xff53('0x1c'),_0x319ce5);}};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 8fb21c8..22416c0 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 _0x5c8e=['length','online','loggedIn','whatsappPause','available','format','emit','whatsapp_queue:save','lodash','md5','util','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','mapAgentsId','prototype','paused'];(function(_0x305c8f,_0xc5f7fb){var _0x5ddc30=function(_0x1aed6f){while(--_0x1aed6f){_0x305c8f['push'](_0x305c8f['shift']());}};_0x5ddc30(++_0xc5f7fb);}(_0x5c8e,0x1d0));var _0xe5c8=function(_0x5994d0,_0x30f90c){_0x5994d0=_0x5994d0-0x0;var _0x4c3258=_0x5c8e[_0x5994d0];return _0x4c3258;};'use strict';var _=require(_0xe5c8('0x0'));var md5=require(_0xe5c8('0x1'));var util=require(_0xe5c8('0x2'));var Redis=require(_0xe5c8('0x3'));var config=require('../../../config/environment');config[_0xe5c8('0x4')]=_['defaults'](config[_0xe5c8('0x4')],{'host':_0xe5c8('0x5'),'port':0x18eb});var io=require(_0xe5c8('0x6'))(new Redis(config[_0xe5c8('0x4')]));function WhatsappQueue(_0x40910b){this['id']=_0x40910b['id']||0x0;this[_0xe5c8('0x7')]=_0x40910b[_0xe5c8('0x7')]||'';this[_0xe5c8('0x8')]=_0x40910b[_0xe5c8('0x8')]||0xa;this[_0xe5c8('0x9')]=_0x40910b[_0xe5c8('0x9')]||'beepall';this[_0xe5c8('0xa')]=_0x40910b[_0xe5c8('0xa')];this['mapAgentsId']={};this[_0xe5c8('0xb')]=0x0;this['md5']='';this[_0xe5c8('0xc')]();this['updateRealtime']();}WhatsappQueue['prototype'][_0xe5c8('0xc')]=function(){var _0xb5f22a=this['mapAgentsId']['_rr'];this[_0xe5c8('0xd')]=_['map'](this[_0xe5c8('0xa')],'id');this[_0xe5c8('0xd')]['_rr']=_0xb5f22a;};WhatsappQueue[_0xe5c8('0xe')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xe5c8('0xf')]=0x0;for(var _0x33275e=0x0;_0x33275e=0x0?this['available']:0x0;var _0x58e452={'id':this['id'],'available':this[_0xe5c8('0x14')],'loggedIn':this[_0xe5c8('0x12')],'name':this[_0xe5c8('0x7')],'paused':this['paused'],'waiting':this[_0xe5c8('0xb')]};var _0x253930=md5(JSON['stringify'](_0x58e452));if(this[_0xe5c8('0x1')]!==_0x253930){this[_0xe5c8('0x1')]=_0x253930;io['to'](util[_0xe5c8('0x15')]('whatsapp:queue:%s',_0x58e452[_0xe5c8('0x7')]))[_0xe5c8('0x16')](_0xe5c8('0x17'),_0x58e452);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x91e6=['whatsapp_queue:save','exports','lodash','md5','util','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','map','mapAgentsId','loggedIn','paused','whatsappPause','available','stringify','emit'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x91e6,0x120));var _0x691e=function(_0x1c56fd,_0x274082){_0x1c56fd=_0x1c56fd-0x0;var _0x3638fe=_0x91e6[_0x1c56fd];return _0x3638fe;};'use strict';var _=require(_0x691e('0x0'));var md5=require(_0x691e('0x1'));var util=require(_0x691e('0x2'));var Redis=require('ioredis');var config=require(_0x691e('0x3'));config[_0x691e('0x4')]=_['defaults'](config[_0x691e('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x691e('0x5'))(new Redis(config[_0x691e('0x4')]));function WhatsappQueue(_0x3de176){this['id']=_0x3de176['id']||0x0;this[_0x691e('0x6')]=_0x3de176[_0x691e('0x6')]||'';this['timeout']=_0x3de176[_0x691e('0x7')]||0xa;this[_0x691e('0x8')]=_0x3de176[_0x691e('0x8')]||_0x691e('0x9');this['Agents']=_0x3de176[_0x691e('0xa')];this['mapAgentsId']={};this[_0x691e('0xb')]=0x0;this['md5']='';this[_0x691e('0xc')]();this[_0x691e('0xd')]();}WhatsappQueue[_0x691e('0xe')][_0x691e('0xc')]=function(){var _0x2c0f09=this['mapAgentsId'][_0x691e('0xf')];this['mapAgentsId']=_[_0x691e('0x10')](this[_0x691e('0xa')],'id');this[_0x691e('0x11')][_0x691e('0xf')]=_0x2c0f09;};WhatsappQueue[_0x691e('0xe')]['updateRealtime']=function(){this[_0x691e('0x12')]=0x0;this[_0x691e('0x13')]=0x0;for(var _0x2b27bc=0x0;_0x2b27bc=0x0?this[_0x691e('0x15')]:0x0;var _0x534f79={'id':this['id'],'available':this[_0x691e('0x15')],'loggedIn':this[_0x691e('0x12')],'name':this[_0x691e('0x6')],'paused':this[_0x691e('0x13')],'waiting':this['waiting']};var _0x2fd341=md5(JSON[_0x691e('0x16')](_0x534f79));if(this[_0x691e('0x1')]!==_0x2fd341){this['md5']=_0x2fd341;io['to'](util['format']('whatsapp:queue:%s',_0x534f79[_0x691e('0x6')]))[_0x691e('0x17')](_0x691e('0x18'),_0x534f79);}};module[_0x691e('0x19')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index f1a3327..d827442 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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 59a3de4..4d930bd 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 _0x86aa=['Request','UpdateChatInteraction','updateChatInteraction','addTagsToChatInteraction','../client','update'];(function(_0x51e4b0,_0xdeaf53){var _0x25d1fd=function(_0x48e235){while(--_0x48e235){_0x51e4b0['push'](_0x51e4b0['shift']());}};_0x25d1fd(++_0xdeaf53);}(_0x86aa,0x9a));var _0xa86a=function(_0x1eb43b,_0x288639){_0x1eb43b=_0x1eb43b-0x0;var _0x51d472=_0x86aa[_0x1eb43b];return _0x51d472;};'use strict';var client=require(_0xa86a('0x0'));exports[_0xa86a('0x1')]=function(_0x18470f,_0x474189){return client[_0xa86a('0x2')](_0xa86a('0x3'),{'body':_0x474189,'options':{'where':{'id':_0x18470f}},'log':_0xa86a('0x4')});};exports['addTags']=function(_0x3492fc,_0x3c550d){return client[_0xa86a('0x2')]('AddTagsToChatInteraction',{'body':_0x3c550d,'options':{'where':{'id':_0x3492fc}},'log':_0xa86a('0x5')});}; \ No newline at end of file +var _0xc81e=['updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','UpdateChatInteraction'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0xc81e,0xcf));var _0xec81=function(_0x705b98,_0x1c345b){_0x705b98=_0x705b98-0x0;var _0x47b72f=_0xc81e[_0x705b98];return _0x47b72f;};'use strict';var client=require(_0xec81('0x0'));exports[_0xec81('0x1')]=function(_0x5ab64f,_0x1aa846){return client['Request'](_0xec81('0x2'),{'body':_0x1aa846,'options':{'where':{'id':_0x5ab64f}},'log':_0xec81('0x3')});};exports[_0xec81('0x4')]=function(_0x1d998b,_0x3012fd){return client['Request'](_0xec81('0x5'),{'body':_0x3012fd,'options':{'where':{'id':_0x1d998b}},'log':_0xec81('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 317f74c..c59ff68 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 _0xc827=['../client','create','CreateChatMessage','createChatMessage'];(function(_0x4b28d7,_0x3f132c){var _0x5dd58d=function(_0x29905d){while(--_0x29905d){_0x4b28d7['push'](_0x4b28d7['shift']());}};_0x5dd58d(++_0x3f132c);}(_0xc827,0x128));var _0x7c82=function(_0x51677a,_0x33eff7){_0x51677a=_0x51677a-0x0;var _0x24b049=_0xc827[_0x51677a];return _0x24b049;};'use strict';var client=require(_0x7c82('0x0'));exports[_0x7c82('0x1')]=function(_0xce96b7){return client['Request'](_0x7c82('0x2'),{'body':_0xce96b7,'log':_0x7c82('0x3')});}; \ No newline at end of file +var _0x7970=['createChatMessage','../client','create','CreateChatMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7970,0x109));var _0x0797=function(_0x4d3965,_0xb1bc57){_0x4d3965=_0x4d3965-0x0;var _0x5e826b=_0x7970[_0x4d3965];return _0x5e826b;};'use strict';var client=require(_0x0797('0x0'));exports[_0x0797('0x1')]=function(_0x596f7e){return client['Request'](_0x0797('0x2'),{'body':_0x596f7e,'log':_0x0797('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 111ab0b..716d6f8 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 _0xd493=['timeout','Agents','name','getChatQueues','../client','Request','GetChatQueue'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd493,0x1bd));var _0x3d49=function(_0x1770bc,_0x2cf3b3){_0x1770bc=_0x1770bc-0x0;var _0xed850a=_0xd493[_0x1770bc];return _0xed850a;};'use strict';var client=require(_0x3d49('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x3d49('0x1')](_0x3d49('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x3d49('0x3'),'strategy'],'include':[{'model':'User','as':_0x3d49('0x4'),'attributes':['id',_0x3d49('0x5'),'online','chatPause']}]},'log':_0x3d49('0x6')});};}; \ No newline at end of file +var _0xf041=['GetChatQueue','name','timeout','User','getChatQueues','Request'];(function(_0x556370,_0x4016e6){var _0x549e06=function(_0x229bd4){while(--_0x229bd4){_0x556370['push'](_0x556370['shift']());}};_0x549e06(++_0x4016e6);}(_0xf041,0x15b));var _0x1f04=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf041[_0x321bb2];return _0x9c12ed;};'use strict';var client=require('../client');exports['getChatQueues']=function(){return function(){return client[_0x1f04('0x0')](_0x1f04('0x1'),{'options':{'raw':![],'attributes':['id',_0x1f04('0x2'),_0x1f04('0x3'),'strategy'],'include':[{'model':_0x1f04('0x4'),'as':'Agents','attributes':['id',_0x1f04('0x2'),'online','chatPause']}]},'log':_0x1f04('0x5')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 0a811ae..3f95424 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 _0xb575=['Request','UpdateChatQueueReport','DESC','../client','create'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0xb575,0xda));var _0x5b57=function(_0x2cc30d,_0x553831){_0x2cc30d=_0x2cc30d-0x0;var _0x172112=_0xb575[_0x2cc30d];return _0x172112;};'use strict';var client=require(_0x5b57('0x0'));exports[_0x5b57('0x1')]=function(_0x577f6b){return client[_0x5b57('0x2')]('CreateChatQueueReport',{'body':_0x577f6b,'log':'CreateChatQueueReport'});};exports['update']=function(_0x3e984f,_0x34ae8e){return client['Request'](_0x5b57('0x3'),{'body':_0x34ae8e,'options':{'where':{'uniqueid':_0x3e984f},'order':[['id',_0x5b57('0x4')]],'limit':0x1},'log':_0x5b57('0x3')});}; \ No newline at end of file +var _0x61a1=['DESC','../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x61a1,0x127));var _0x161a=function(_0x55ff79,_0x3d45e7){_0x55ff79=_0x55ff79-0x0;var _0x579067=_0x61a1[_0x55ff79];return _0x579067;};'use strict';var client=require(_0x161a('0x0'));exports[_0x161a('0x1')]=function(_0x1befc0){return client[_0x161a('0x2')](_0x161a('0x3'),{'body':_0x1befc0,'log':'CreateChatQueueReport'});};exports[_0x161a('0x4')]=function(_0x912651,_0x52aadb){return client[_0x161a('0x2')](_0x161a('0x5'),{'body':_0x52aadb,'options':{'where':{'uniqueid':_0x912651},'order':[['id',_0x161a('0x6')]],'limit':0x1},'log':_0x161a('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 2d75fcc..36c00ec 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x3f8a03,_0x319b9c){var _0x147fb2=function(_0x523c1c){while(--_0x523c1c){_0x3f8a03['push'](_0x3f8a03['shift']());}};_0x147fb2(++_0x319b9c);}(_0x7a54,0x106));var _0x47a5=function(_0x5c35cb,_0x5074f6){_0x5c35cb=_0x5c35cb-0x0;var _0x1a0f10=_0x7a54[_0x5c35cb];return _0x1a0f10;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0xbeefde,_0x31b267){var _0x49185a=function(_0x4eeaa1){while(--_0x4eeaa1){_0xbeefde['push'](_0xbeefde['shift']());}};_0x49185a(++_0x31b267);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 30b00e6..2575296 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 _0x86db=['../client','create','Request','CreateFaxMessage','createFaxMessage'];(function(_0x21178f,_0xc7e7a5){var _0x52cdfe=function(_0x1da7c4){while(--_0x1da7c4){_0x21178f['push'](_0x21178f['shift']());}};_0x52cdfe(++_0xc7e7a5);}(_0x86db,0x10e));var _0xb86d=function(_0x337216,_0x4184e2){_0x337216=_0x337216-0x0;var _0x113fdb=_0x86db[_0x337216];return _0x113fdb;};'use strict';var client=require(_0xb86d('0x0'));exports[_0xb86d('0x1')]=function(_0x3fdad2){return client[_0xb86d('0x2')](_0xb86d('0x3'),{'body':_0x3fdad2,'log':_0xb86d('0x4')});}; \ No newline at end of file +var _0xc004=['Request','CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x83609a,_0x4623de){var _0x3de3aa=function(_0x46d4e6){while(--_0x46d4e6){_0x83609a['push'](_0x83609a['shift']());}};_0x3de3aa(++_0x4623de);}(_0xc004,0xd0));var _0x4c00=function(_0x4953da,_0x5adaca){_0x4953da=_0x4953da-0x0;var _0x2d3780=_0xc004[_0x4953da];return _0x2d3780;};'use strict';var client=require(_0x4c00('0x0'));exports[_0x4c00('0x1')]=function(_0x4f4870){return client[_0x4c00('0x2')](_0x4c00('0x3'),{'body':_0x4f4870,'log':_0x4c00('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 8d13d23..f482144 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 _0xee4e=['name','timeout','strategy','User','Agents','faxPause','../client','getFaxQueues'];(function(_0x2e08dc,_0x539e2d){var _0x40c84f=function(_0x339691){while(--_0x339691){_0x2e08dc['push'](_0x2e08dc['shift']());}};_0x40c84f(++_0x539e2d);}(_0xee4e,0xf6));var _0xeee4=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xee4e[_0x2ec461];return _0x28603d;};'use strict';var client=require(_0xeee4('0x0'));exports[_0xeee4('0x1')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0xeee4('0x2'),_0xeee4('0x3'),_0xeee4('0x4')],'include':[{'model':_0xeee4('0x5'),'as':_0xeee4('0x6'),'attributes':['id',_0xeee4('0x2'),'online',_0xeee4('0x7')]}]},'log':_0xeee4('0x1')});};}; \ No newline at end of file +var _0xb9be=['faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User','Agents','online'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xb9be,0x182));var _0xeb9b=function(_0x506d2f,_0x5ab76e){_0x506d2f=_0x506d2f-0x0;var _0x101255=_0xb9be[_0x506d2f];return _0x101255;};'use strict';var client=require(_0xeb9b('0x0'));exports[_0xeb9b('0x1')]=function(){return function(){return client[_0xeb9b('0x2')](_0xeb9b('0x3'),{'options':{'raw':![],'attributes':['id',_0xeb9b('0x4'),_0xeb9b('0x5'),_0xeb9b('0x6')],'include':[{'model':_0xeb9b('0x7'),'as':_0xeb9b('0x8'),'attributes':['id',_0xeb9b('0x4'),_0xeb9b('0x9'),_0xeb9b('0xa')]}]},'log':_0xeb9b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 9b35278..0aa2c5b 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 _0xc687=['Request','CreateFaxQueueReport','UpdateFaxQueueReport','../client'];(function(_0x52beb2,_0xaf9dc9){var _0x3f2b2b=function(_0x49e2fe){while(--_0x49e2fe){_0x52beb2['push'](_0x52beb2['shift']());}};_0x3f2b2b(++_0xaf9dc9);}(_0xc687,0x16f));var _0x7c68=function(_0x68c6c9,_0x2d4c79){_0x68c6c9=_0x68c6c9-0x0;var _0xf39b75=_0xc687[_0x68c6c9];return _0xf39b75;};'use strict';var client=require(_0x7c68('0x0'));exports['create']=function(_0x4f1332){return client[_0x7c68('0x1')]('CreateFaxQueueReport',{'body':_0x4f1332,'log':_0x7c68('0x2')});};exports['update']=function(_0x1a829d,_0x1b10d8){return client[_0x7c68('0x1')]('UpdateFaxQueueReport',{'body':_0x1b10d8,'options':{'where':{'uniqueid':_0x1a829d},'order':[['id','DESC']],'limit':0x1},'log':_0x7c68('0x3')});}; \ No newline at end of file +var _0x7b12=['UpdateFaxQueueReport','DESC','../client','Request','CreateFaxQueueReport','update'];(function(_0x4f8b2b,_0x1dc8dd){var _0x2f230a=function(_0x232685){while(--_0x232685){_0x4f8b2b['push'](_0x4f8b2b['shift']());}};_0x2f230a(++_0x1dc8dd);}(_0x7b12,0x1e8));var _0x27b1=function(_0x245c9f,_0x1d9e8c){_0x245c9f=_0x245c9f-0x0;var _0x276b79=_0x7b12[_0x245c9f];return _0x276b79;};'use strict';var client=require(_0x27b1('0x0'));exports['create']=function(_0x3a1fd2){return client[_0x27b1('0x1')]('CreateFaxQueueReport',{'body':_0x3a1fd2,'log':_0x27b1('0x2')});};exports[_0x27b1('0x3')]=function(_0x435c7e,_0x446217){return client[_0x27b1('0x1')](_0x27b1('0x4'),{'body':_0x446217,'options':{'where':{'uniqueid':_0x435c7e},'order':[['id',_0x27b1('0x5')]],'limit':0x1},'log':_0x27b1('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 709e60e..742d4bb 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 _0x7517=['interval','../client','getIntervals','Request','GetInterval','name','Interval','Intervals'];(function(_0x1906e0,_0x45a2bf){var _0x5657a6=function(_0x27fa24){while(--_0x27fa24){_0x1906e0['push'](_0x1906e0['shift']());}};_0x5657a6(++_0x45a2bf);}(_0x7517,0x1d9));var _0x7751=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x7517[_0x24061a];return _0x82054e;};'use strict';var client=require(_0x7751('0x0'));exports[_0x7751('0x1')]=function(){return function(){return client[_0x7751('0x2')](_0x7751('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x7751('0x4')],'include':[{'model':_0x7751('0x5'),'as':_0x7751('0x6'),'attributes':['id',_0x7751('0x4'),_0x7751('0x7')]}]},'log':_0x7751('0x1')});};}; \ No newline at end of file +var _0xb606=['getIntervals','Request','Intervals','interval','../client'];(function(_0x28ccde,_0x1430d2){var _0x52ec3d=function(_0x36c83d){while(--_0x36c83d){_0x28ccde['push'](_0x28ccde['shift']());}};_0x52ec3d(++_0x1430d2);}(_0xb606,0x13f));var _0x6b60=function(_0x438fe1,_0x3308d5){_0x438fe1=_0x438fe1-0x0;var _0x3c8e1b=_0xb606[_0x438fe1];return _0x3c8e1b;};'use strict';var client=require(_0x6b60('0x0'));exports[_0x6b60('0x1')]=function(){return function(){return client[_0x6b60('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0x6b60('0x3'),'attributes':['id','name',_0x6b60('0x4')]}]},'log':_0x6b60('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 399221a..6e2ea1e 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 _0x28f2=['updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x36c3b8,_0x4d066a){var _0x2f37bb=function(_0x12e47d){while(--_0x12e47d){_0x36c3b8['push'](_0x36c3b8['shift']());}};_0x2f37bb(++_0x4d066a);}(_0x28f2,0x193));var _0x228f=function(_0x149c1f,_0x32c7bc){_0x149c1f=_0x149c1f-0x0;var _0x4ab341=_0x28f2[_0x149c1f];return _0x4ab341;};'use strict';var client=require(_0x228f('0x0'));exports[_0x228f('0x1')]=function(_0x108337,_0x2e5e0b){return client[_0x228f('0x2')]('UpdateMailInteraction',{'body':_0x2e5e0b,'options':{'where':{'id':_0x108337}},'log':_0x228f('0x3')});};exports[_0x228f('0x4')]=function(_0x79ed5f,_0x4303c3){return client[_0x228f('0x2')](_0x228f('0x5'),{'body':_0x4303c3,'options':{'where':{'id':_0x79ed5f}},'log':_0x228f('0x6')});}; \ No newline at end of file +var _0x896e=['update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','../client'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x896e,0x1e9));var _0xe896=function(_0x5d195c,_0xdff1cc){_0x5d195c=_0x5d195c-0x0;var _0xd12701=_0x896e[_0x5d195c];return _0xd12701;};'use strict';var client=require(_0xe896('0x0'));exports[_0xe896('0x1')]=function(_0x3feebe,_0x229b59){return client[_0xe896('0x2')](_0xe896('0x3'),{'body':_0x229b59,'options':{'where':{'id':_0x3feebe}},'log':_0xe896('0x4')});};exports[_0xe896('0x5')]=function(_0x3f85e5,_0x2d3521){return client[_0xe896('0x2')](_0xe896('0x6'),{'body':_0x2d3521,'options':{'where':{'id':_0x3f85e5}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 3d821c1..d7de50d 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 _0xcc3c=['createMailMessage','../client','create'];(function(_0x38eb2f,_0x3100d){var _0x3b165f=function(_0x16d834){while(--_0x16d834){_0x38eb2f['push'](_0x38eb2f['shift']());}};_0x3b165f(++_0x3100d);}(_0xcc3c,0x1f0));var _0xccc3=function(_0x2a05a0,_0x1e0ce2){_0x2a05a0=_0x2a05a0-0x0;var _0x3e70ae=_0xcc3c[_0x2a05a0];return _0x3e70ae;};'use strict';var client=require(_0xccc3('0x0'));exports[_0xccc3('0x1')]=function(_0x57b93b){return client['Request']('CreateMailMessage',{'body':_0x57b93b,'log':_0xccc3('0x2')});}; \ No newline at end of file +var _0x61b1=['Request','CreateMailMessage','../client'];(function(_0x19af51,_0x3834ac){var _0x997581=function(_0x4ba64c){while(--_0x4ba64c){_0x19af51['push'](_0x19af51['shift']());}};_0x997581(++_0x3834ac);}(_0x61b1,0x134));var _0x161b=function(_0x17723c,_0x1ea81d){_0x17723c=_0x17723c-0x0;var _0x1ffbf3=_0x61b1[_0x17723c];return _0x1ffbf3;};'use strict';var client=require(_0x161b('0x0'));exports['create']=function(_0x14f96c){return client[_0x161b('0x1')](_0x161b('0x2'),{'body':_0x14f96c,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index e326749..d618785 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 _0x4fa0=['GetMailQueue','timeout','strategy','User','name','online','mailPause','../client','getMailQueues','Request'];(function(_0x48271f,_0xc4f6d3){var _0x13eb5c=function(_0x1a4acd){while(--_0x1a4acd){_0x48271f['push'](_0x48271f['shift']());}};_0x13eb5c(++_0xc4f6d3);}(_0x4fa0,0x7f));var _0x04fa=function(_0xd8813a,_0x315766){_0xd8813a=_0xd8813a-0x0;var _0x487db6=_0x4fa0[_0xd8813a];return _0x487db6;};'use strict';var client=require(_0x04fa('0x0'));exports[_0x04fa('0x1')]=function(){return function(){return client[_0x04fa('0x2')](_0x04fa('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x04fa('0x4'),_0x04fa('0x5')],'include':[{'model':_0x04fa('0x6'),'as':'Agents','attributes':['id',_0x04fa('0x7'),_0x04fa('0x8'),_0x04fa('0x9')]}]},'log':_0x04fa('0x1')});};}; \ No newline at end of file +var _0xbfce=['mailPause','getMailQueues','Request','GetMailQueue','name','timeout','strategy','Agents'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0xbfce,0x161));var _0xebfc=function(_0xe196e5,_0x29a7a6){_0xe196e5=_0xe196e5-0x0;var _0xffdcb4=_0xbfce[_0xe196e5];return _0xffdcb4;};'use strict';var client=require('../client');exports[_0xebfc('0x0')]=function(){return function(){return client[_0xebfc('0x1')](_0xebfc('0x2'),{'options':{'raw':![],'attributes':['id',_0xebfc('0x3'),_0xebfc('0x4'),_0xebfc('0x5')],'include':[{'model':'User','as':_0xebfc('0x6'),'attributes':['id','name','online',_0xebfc('0x7')]}]},'log':_0xebfc('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index a634b61..79a5796 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 _0xff76=['DESC','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x3f0bc0,_0x30e570){var _0x1aca4c=function(_0x39cfd8){while(--_0x39cfd8){_0x3f0bc0['push'](_0x3f0bc0['shift']());}};_0x1aca4c(++_0x30e570);}(_0xff76,0x6d));var _0x6ff7=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xff76[_0x1035c1];return _0x308d67;};'use strict';var client=require('../client');exports[_0x6ff7('0x0')]=function(_0xd12a78){return client[_0x6ff7('0x1')](_0x6ff7('0x2'),{'body':_0xd12a78,'log':_0x6ff7('0x2')});};exports[_0x6ff7('0x3')]=function(_0x28b4ce,_0x1b827d){return client['Request'](_0x6ff7('0x4'),{'body':_0x1b827d,'options':{'where':{'uniqueid':_0x28b4ce},'order':[['id',_0x6ff7('0x5')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0xa9d2=['Request','update','UpdateMailQueueReport','DESC','create'];(function(_0x105919,_0x2c2689){var _0x527277=function(_0x4e482a){while(--_0x4e482a){_0x105919['push'](_0x105919['shift']());}};_0x527277(++_0x2c2689);}(_0xa9d2,0xdb));var _0x2a9d=function(_0x59bb42,_0xe5b9ef){_0x59bb42=_0x59bb42-0x0;var _0x84c39=_0xa9d2[_0x59bb42];return _0x84c39;};'use strict';var client=require('../client');exports[_0x2a9d('0x0')]=function(_0x60372c){return client[_0x2a9d('0x1')]('CreateMailQueueReport',{'body':_0x60372c,'log':'CreateMailQueueReport'});};exports[_0x2a9d('0x2')]=function(_0x3e4504,_0xa8ad2b){return client[_0x2a9d('0x1')](_0x2a9d('0x3'),{'body':_0xa8ad2b,'options':{'where':{'uniqueid':_0x3e4504},'order':[['id',_0x2a9d('0x4')]],'limit':0x1},'log':_0x2a9d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 9dff372..d3476de 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 _0x1c93=['AddTagsToOpenchannelInteraction','../client','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request'];(function(_0x11a383,_0x4e05ae){var _0x49f2bb=function(_0x52e0ee){while(--_0x52e0ee){_0x11a383['push'](_0x11a383['shift']());}};_0x49f2bb(++_0x4e05ae);}(_0x1c93,0x16d));var _0x31c9=function(_0x3b7780,_0x2658d3){_0x3b7780=_0x3b7780-0x0;var _0x564678=_0x1c93[_0x3b7780];return _0x564678;};'use strict';var client=require(_0x31c9('0x0'));exports[_0x31c9('0x1')]=function(_0x53b474,_0x25ad23){return client['Request'](_0x31c9('0x2'),{'body':_0x25ad23,'options':{'where':{'id':_0x53b474}},'log':_0x31c9('0x3')});};exports[_0x31c9('0x4')]=function(_0x36061f,_0x42ca93){return client[_0x31c9('0x5')](_0x31c9('0x6'),{'body':_0x42ca93,'options':{'where':{'id':_0x36061f}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x3dfe=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','Request'];(function(_0x41e588,_0x2bed38){var _0x438bb0=function(_0x3c73e1){while(--_0x3c73e1){_0x41e588['push'](_0x41e588['shift']());}};_0x438bb0(++_0x2bed38);}(_0x3dfe,0x19b));var _0xe3df=function(_0x15131b,_0x435e72){_0x15131b=_0x15131b-0x0;var _0x41921a=_0x3dfe[_0x15131b];return _0x41921a;};'use strict';var client=require(_0xe3df('0x0'));exports['update']=function(_0x1667e7,_0x1ceebd){return client[_0xe3df('0x1')](_0xe3df('0x2'),{'body':_0x1ceebd,'options':{'where':{'id':_0x1667e7}},'log':_0xe3df('0x3')});};exports[_0xe3df('0x4')]=function(_0x1d2e92,_0x2daad1){return client[_0xe3df('0x1')](_0xe3df('0x5'),{'body':_0x2daad1,'options':{'where':{'id':_0x1d2e92}},'log':_0xe3df('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 9501d07..4b8c963 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 _0x6106=['Request','CreateOpenchannelMessage'];(function(_0x526ab0,_0x4d2b04){var _0x16eb4b=function(_0x336def){while(--_0x336def){_0x526ab0['push'](_0x526ab0['shift']());}};_0x16eb4b(++_0x4d2b04);}(_0x6106,0x1ae));var _0x6610=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x6106[_0x1d24eb];return _0x1dc576;};'use strict';var client=require('../client');exports['create']=function(_0x2bfa34){return client[_0x6610('0x0')](_0x6610('0x1'),{'body':_0x2bfa34,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0x6156=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x1138cf,_0x540bf9){var _0x7d77e6=function(_0x2190af){while(--_0x2190af){_0x1138cf['push'](_0x1138cf['shift']());}};_0x7d77e6(++_0x540bf9);}(_0x6156,0x1e4));var _0x6615=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x6156[_0xdea41a];return _0x15d0d8;};'use strict';var client=require('../client');exports[_0x6615('0x0')]=function(_0x525d5e){return client[_0x6615('0x1')](_0x6615('0x2'),{'body':_0x525d5e,'log':_0x6615('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index f01db6b..d408a41 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 _0xd167=['name','timeout','strategy','User','online','openchannelPause','../client','getOpenchannelQueues','GetOpenchannelQueue'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd167,0xc3));var _0x7d16=function(_0x59ae2c,_0x41b79e){_0x59ae2c=_0x59ae2c-0x0;var _0x4c27ab=_0xd167[_0x59ae2c];return _0x4c27ab;};'use strict';var client=require(_0x7d16('0x0'));exports[_0x7d16('0x1')]=function(){return function(){return client['Request'](_0x7d16('0x2'),{'options':{'raw':![],'attributes':['id',_0x7d16('0x3'),_0x7d16('0x4'),_0x7d16('0x5')],'include':[{'model':_0x7d16('0x6'),'as':'Agents','attributes':['id','name',_0x7d16('0x7'),_0x7d16('0x8')]}]},'log':_0x7d16('0x1')});};}; \ No newline at end of file +var _0xe70c=['timeout','User','Agents','getOpenchannelQueues','../client','Request','name'];(function(_0x7816ac,_0x372d82){var _0x531068=function(_0x18525a){while(--_0x18525a){_0x7816ac['push'](_0x7816ac['shift']());}};_0x531068(++_0x372d82);}(_0xe70c,0x1a8));var _0xce70=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xe70c[_0x501510];return _0x1e6ee5;};'use strict';var client=require(_0xce70('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0xce70('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xce70('0x2'),_0xce70('0x3'),'strategy'],'include':[{'model':_0xce70('0x4'),'as':_0xce70('0x5'),'attributes':['id','name','online','openchannelPause']}]},'log':_0xce70('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index eab4207..3ba0b0d 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 _0x2b2a=['UpdateOpenchannelQueueReport','create','CreateOpenchannelQueueReport','DESC'];(function(_0x30b1e1,_0x22c111){var _0x148a80=function(_0x164864){while(--_0x164864){_0x30b1e1['push'](_0x30b1e1['shift']());}};_0x148a80(++_0x22c111);}(_0x2b2a,0x149));var _0xa2b2=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0x2b2a[_0x16629d];return _0x56ccee;};'use strict';var client=require('../client');exports[_0xa2b2('0x0')]=function(_0x1f9d32){return client['Request'](_0xa2b2('0x1'),{'body':_0x1f9d32,'log':'CreateOpenchannelQueueReport'});};exports['update']=function(_0x16e996,_0x7c415f){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x7c415f,'options':{'where':{'uniqueid':_0x16e996},'order':[['id',_0xa2b2('0x2')]],'limit':0x1},'log':_0xa2b2('0x3')});}; \ No newline at end of file +var _0xd0dc=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x1e1c5f,_0x4afc9e){var _0x587dab=function(_0x3c07a6){while(--_0x3c07a6){_0x1e1c5f['push'](_0x1e1c5f['shift']());}};_0x587dab(++_0x4afc9e);}(_0xd0dc,0x1c1));var _0xcd0d=function(_0x153e7d,_0x10a35f){_0x153e7d=_0x153e7d-0x0;var _0x3c22dd=_0xd0dc[_0x153e7d];return _0x3c22dd;};'use strict';var client=require(_0xcd0d('0x0'));exports['create']=function(_0x593e36){return client[_0xcd0d('0x1')](_0xcd0d('0x2'),{'body':_0x593e36,'log':_0xcd0d('0x2')});};exports[_0xcd0d('0x3')]=function(_0x3a5893,_0x1bd82d){return client[_0xcd0d('0x1')](_0xcd0d('0x4'),{'body':_0x1bd82d,'options':{'where':{'uniqueid':_0x3a5893},'order':[['id',_0xcd0d('0x5')]],'limit':0x1},'log':_0xcd0d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 95fd141..b106eb1 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 _0xb790=['addTagsToSmsInteraction','update','UpdateSmsInteraction','AddTagsToSmsInteraction'];(function(_0x276341,_0x4ff417){var _0x5f2f4c=function(_0x2eb105){while(--_0x2eb105){_0x276341['push'](_0x276341['shift']());}};_0x5f2f4c(++_0x4ff417);}(_0xb790,0xe5));var _0x0b79=function(_0x5502a7,_0x325618){_0x5502a7=_0x5502a7-0x0;var _0x3946fa=_0xb790[_0x5502a7];return _0x3946fa;};'use strict';var client=require('../client');exports[_0x0b79('0x0')]=function(_0x557e0e,_0x59dbe8){return client['Request'](_0x0b79('0x1'),{'body':_0x59dbe8,'options':{'where':{'id':_0x557e0e}},'log':'updateSmsInteraction'});};exports['addTags']=function(_0x2d75b0,_0x30b3fa){return client['Request'](_0x0b79('0x2'),{'body':_0x30b3fa,'options':{'where':{'id':_0x2d75b0}},'log':_0x0b79('0x3')});}; \ No newline at end of file +var _0xe647=['update','Request','UpdateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x45e7ee,_0x5137c5){var _0x2f2d0e=function(_0x1447df){while(--_0x1447df){_0x45e7ee['push'](_0x45e7ee['shift']());}};_0x2f2d0e(++_0x5137c5);}(_0xe647,0x16d));var _0x7e64=function(_0x1495a5,_0x157c45){_0x1495a5=_0x1495a5-0x0;var _0x4dae73=_0xe647[_0x1495a5];return _0x4dae73;};'use strict';var client=require(_0x7e64('0x0'));exports[_0x7e64('0x1')]=function(_0x54aaab,_0x41d99f){return client[_0x7e64('0x2')](_0x7e64('0x3'),{'body':_0x41d99f,'options':{'where':{'id':_0x54aaab}},'log':'updateSmsInteraction'});};exports['addTags']=function(_0x7ed710,_0x2e00b0){return client[_0x7e64('0x2')](_0x7e64('0x4'),{'body':_0x2e00b0,'options':{'where':{'id':_0x7ed710}},'log':_0x7e64('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index c86305c..81311cf 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 _0xf407=['createSmsMessage','create'];(function(_0x23f61f,_0x4e9219){var _0x8ece16=function(_0x4bd29e){while(--_0x4bd29e){_0x23f61f['push'](_0x23f61f['shift']());}};_0x8ece16(++_0x4e9219);}(_0xf407,0xd7));var _0x7f40=function(_0x45d151,_0x422a78){_0x45d151=_0x45d151-0x0;var _0x180a42=_0xf407[_0x45d151];return _0x180a42;};'use strict';var client=require('../client');exports[_0x7f40('0x0')]=function(_0x3ea823){return client['Request']('CreateSmsMessage',{'body':_0x3ea823,'log':_0x7f40('0x1')});}; \ No newline at end of file +var _0xcb8e=['createSmsMessage','../client','create'];(function(_0x465f5e,_0x49c5fe){var _0x1510e8=function(_0x36ec8a){while(--_0x36ec8a){_0x465f5e['push'](_0x465f5e['shift']());}};_0x1510e8(++_0x49c5fe);}(_0xcb8e,0xcd));var _0xecb8=function(_0x2c0af1,_0x4b5709){_0x2c0af1=_0x2c0af1-0x0;var _0x53fe48=_0xcb8e[_0x2c0af1];return _0x53fe48;};'use strict';var client=require(_0xecb8('0x0'));exports[_0xecb8('0x1')]=function(_0x32fb77){return client['Request']('CreateSmsMessage',{'body':_0x32fb77,'log':_0xecb8('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index f919990..3b00cf2 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 _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x211db9,_0x20224e){var _0x54aaf1=function(_0x55116c){while(--_0x55116c){_0x211db9['push'](_0x211db9['shift']());}};_0x54aaf1(++_0x20224e);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file +var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x4b0470,_0x38b9a5){var _0x241632=function(_0x4fbb19){while(--_0x4fbb19){_0x4b0470['push'](_0x4b0470['shift']());}};_0x241632(++_0x38b9a5);}(_0xb7e7,0x121));var _0x7b7e=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xb7e7[_0x580576];return _0x3f55a0;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 21f612a..b96dcf7 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 _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x1b07b7,_0x2552a5){var _0x5bd245=function(_0x4def49){while(--_0x4def49){_0x1b07b7['push'](_0x1b07b7['shift']());}};_0x5bd245(++_0x2552a5);}(_0x34e8,0x12c));var _0x834e=function(_0x300cc7,_0x23eea7){_0x300cc7=_0x300cc7-0x0;var _0x3ea8c8=_0x34e8[_0x300cc7];return _0x3ea8c8;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file +var _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x580999,_0x12b518){var _0x407f05=function(_0x139293){while(--_0x139293){_0x580999['push'](_0x580999['shift']());}};_0x407f05(++_0x12b518);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index b707fc7..40a7b5f 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(_0x424a6d,_0x205b32){var _0x97fe=function(_0x4d5600){while(--_0x4d5600){_0x424a6d['push'](_0x424a6d['shift']());}};_0x97fe(++_0x205b32);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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(_0x14f49d,_0x54b7a9){var _0x167a5d=function(_0x1b1050){while(--_0x1b1050){_0x14f49d['push'](_0x14f49d['shift']());}};_0x167a5d(++_0x54b7a9);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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 ba1d3f4..7dd8dcb 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 _0x8ad5=['AddTagsToWhatsappInteraction','../client','update','updateWhatsappInteraction','addTags','Request'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8ad5,0xf1));var _0x58ad=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x8ad5[_0x2bf141];return _0x48277b;};'use strict';var client=require(_0x58ad('0x0'));exports[_0x58ad('0x1')]=function(_0x114e73,_0x263210){return client['Request']('UpdateWhatsappInteraction',{'body':_0x263210,'options':{'where':{'id':_0x114e73}},'log':_0x58ad('0x2')});};exports[_0x58ad('0x3')]=function(_0x223e54,_0x22aba9){return client[_0x58ad('0x4')](_0x58ad('0x5'),{'body':_0x22aba9,'options':{'where':{'id':_0x223e54}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x4819=['addTagsToWhatsappInteraction','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0x5ae7ff,_0x323cbf){var _0x1a0d63=function(_0x2f26f7){while(--_0x2f26f7){_0x5ae7ff['push'](_0x5ae7ff['shift']());}};_0x1a0d63(++_0x323cbf);}(_0x4819,0xcd));var _0x9481=function(_0x14a79a,_0x281ce9){_0x14a79a=_0x14a79a-0x0;var _0x55d55b=_0x4819[_0x14a79a];return _0x55d55b;};'use strict';var client=require('../client');exports[_0x9481('0x0')]=function(_0x3307b0,_0xa9557a){return client[_0x9481('0x1')](_0x9481('0x2'),{'body':_0xa9557a,'options':{'where':{'id':_0x3307b0}},'log':_0x9481('0x3')});};exports[_0x9481('0x4')]=function(_0x14dc10,_0xc39edf){return client[_0x9481('0x1')]('AddTagsToWhatsappInteraction',{'body':_0xc39edf,'options':{'where':{'id':_0x14dc10}},'log':_0x9481('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 20bec18..90a333b 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 _0xa364=['CreateWhatsappMessage','create','Request'];(function(_0x349b6a,_0x496705){var _0x21097c=function(_0x2aaded){while(--_0x2aaded){_0x349b6a['push'](_0x349b6a['shift']());}};_0x21097c(++_0x496705);}(_0xa364,0xac));var _0x4a36=function(_0x541e9c,_0x336a06){_0x541e9c=_0x541e9c-0x0;var _0x16594c=_0xa364[_0x541e9c];return _0x16594c;};'use strict';var client=require('../client');exports[_0x4a36('0x0')]=function(_0x3d43c7){return client[_0x4a36('0x1')](_0x4a36('0x2'),{'body':_0x3d43c7,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x9f07=['createWhatsappMessage','../client','CreateWhatsappMessage'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x9f07,0x175));var _0x79f0=function(_0x3e4888,_0x4dcb89){_0x3e4888=_0x3e4888-0x0;var _0x2cec4c=_0x9f07[_0x3e4888];return _0x2cec4c;};'use strict';var client=require(_0x79f0('0x0'));exports['create']=function(_0x18e5bd){return client['Request'](_0x79f0('0x1'),{'body':_0x18e5bd,'log':_0x79f0('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 6217d1e..4228b52 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 _0x34c5=['getWhatsappQueues','GetWhatsappQueue','name','strategy','User','online','whatsappPause'];(function(_0x11946c,_0x12152c){var _0x383935=function(_0x61fce2){while(--_0x61fce2){_0x11946c['push'](_0x11946c['shift']());}};_0x383935(++_0x12152c);}(_0x34c5,0xc4));var _0x534c=function(_0x3ee611,_0x86e651){_0x3ee611=_0x3ee611-0x0;var _0x27a42f=_0x34c5[_0x3ee611];return _0x27a42f;};'use strict';var client=require('../client');exports[_0x534c('0x0')]=function(){return function(){return client['Request'](_0x534c('0x1'),{'options':{'raw':![],'attributes':['id',_0x534c('0x2'),'timeout',_0x534c('0x3')],'include':[{'model':_0x534c('0x4'),'as':'Agents','attributes':['id',_0x534c('0x2'),_0x534c('0x5'),_0x534c('0x6')]}]},'log':_0x534c('0x0')});};}; \ No newline at end of file +var _0xa70e=['whatsappPause','../client','getWhatsappQueues','Request','timeout','strategy','User','Agents','name'];(function(_0x15b8ea,_0x55dcf0){var _0x190fe1=function(_0x53ecea){while(--_0x53ecea){_0x15b8ea['push'](_0x15b8ea['shift']());}};_0x190fe1(++_0x55dcf0);}(_0xa70e,0x64));var _0xea70=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa70e[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xea70('0x0'));exports[_0xea70('0x1')]=function(){return function(){return client[_0xea70('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id','name',_0xea70('0x3'),_0xea70('0x4')],'include':[{'model':_0xea70('0x5'),'as':_0xea70('0x6'),'attributes':['id',_0xea70('0x7'),'online',_0xea70('0x8')]}]},'log':_0xea70('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 07cb72b..4cd2274 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 _0x0d92=['DESC','../client','Request','update','UpdateWhatsappQueueReport'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x0d92,0x6a));var _0x20d9=function(_0x2c1ec3,_0x391f8b){_0x2c1ec3=_0x2c1ec3-0x0;var _0x2f5a61=_0x0d92[_0x2c1ec3];return _0x2f5a61;};'use strict';var client=require(_0x20d9('0x0'));exports['create']=function(_0xd207c2){return client[_0x20d9('0x1')]('CreateWhatsappQueueReport',{'body':_0xd207c2,'log':'CreateWhatsappQueueReport'});};exports[_0x20d9('0x2')]=function(_0x35689a,_0x583013){return client['Request'](_0x20d9('0x3'),{'body':_0x583013,'options':{'where':{'uniqueid':_0x35689a},'order':[['id',_0x20d9('0x4')]],'limit':0x1},'log':_0x20d9('0x3')});}; \ No newline at end of file +var _0x83be=['UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport','update'];(function(_0x792894,_0x436789){var _0x290638=function(_0x3ce3c4){while(--_0x3ce3c4){_0x792894['push'](_0x792894['shift']());}};_0x290638(++_0x436789);}(_0x83be,0x160));var _0xe83b=function(_0x405637,_0x48918b){_0x405637=_0x405637-0x0;var _0x37d854=_0x83be[_0x405637];return _0x37d854;};'use strict';var client=require(_0xe83b('0x0'));exports[_0xe83b('0x1')]=function(_0x3aeada){return client[_0xe83b('0x2')]('CreateWhatsappQueueReport',{'body':_0x3aeada,'log':_0xe83b('0x3')});};exports[_0xe83b('0x4')]=function(_0x35fcbb,_0x2324e7){return client['Request'](_0xe83b('0x5'),{'body':_0x2324e7,'options':{'where':{'uniqueid':_0x35fcbb},'order':[['id',_0xe83b('0x6')]],'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 aa6087d..0807cf4 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 _0x7114=['lodash','util','seq-queue','../../../../config/logger','number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','toLowerCase','consequence','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','name','timeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate'];(function(_0xd9b610,_0x4b6b38){var _0x380873=function(_0x19ed74){while(--_0x19ed74){_0xd9b610['push'](_0xd9b610['shift']());}};_0x380873(++_0x4b6b38);}(_0x7114,0xd1));var _0x4711=function(_0x27b1ba,_0xb77706){_0x27b1ba=_0x27b1ba-0x0;var _0x3493eb=_0x7114[_0x27b1ba];return _0x3493eb;};'use strict';var schema=require(_0x4711('0x0'));var _=require(_0x4711('0x1'));var util=require(_0x4711('0x2'));var seqqueue=require(_0x4711('0x3'));var logger=require(_0x4711('0x4'))('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x4711('0x5'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x4d1f03,_0x54eae7,_0xde98c9){return logger[_0x4711('0x6')](util[_0x4711('0x7')](_0x4711('0x8'),_0x4d1f03,_0x54eae7['name'],_0xde98c9));}function handleFindAgent(_0x9b2b2a){return function(_0x1109b6){return _0x1109b6['name'][_0x4711('0x9')]()===_0x9b2b2a[_0x4711('0x9')]();};}exports[_0x4711('0xa')]=function(_0x49070b,_0x2b6eb6,_0x2fcd7e,_0x55bf61){return function(_0x3a9c2b){try{var _0x41da5d={'name':_0x2b6eb6[0x0],'timeout':_0x2b6eb6[0x1]};var _0x334a82=queue[_0x4711('0x0')](_0x41da5d,{'typecast':!![]});if(_0x334a82['length']){logger[_0x4711('0xb')](_0x4711('0xc'),_0x49070b,_[_0x4711('0xd')](_0x334a82,_0x4711('0xe'))[_0x4711('0xf')](',\x20'));_0x3a9c2b[_0x4711('0x10')]();}else{var _0x64a17b=_[_0x4711('0x11')](_0x2fcd7e[_0x4711('0x12')],handleFindAgent(_0x41da5d[_0x4711('0x13')]));if(_0x64a17b){var _0x4e1e34=(_0x41da5d[_0x4711('0x14')]||0xa)*0x3e8;var _0x3a4981,_0x4ede31;var _0x71b871=seqqueue['createQueue'](_0x4e1e34);_0x71b871['id']=_0x49070b;_0x71b871['atimeout']=_0x4e1e34;_0x71b871[_0x4711('0x15')]=_0x55bf61[_0x4711('0x15')];writeLog(_0x49070b,_0x64a17b,util[_0x4711('0x7')](_0x4711('0x16'),_0x4e1e34));_0x2fcd7e[_0x4711('0x17')][_0x49070b]['on'](_0x4711('0x18'),function(){logger[_0x4711('0x6')](_0x4711('0x19'),_0x49070b);clearTimeout(_0x4ede31);_0x4ede31=undefined;_0x71b871[_0x4711('0x1a')]();if(_0x2fcd7e[_0x4711('0x17')][_0x49070b]){delete _0x2fcd7e[_0x4711('0x17')][_0x49070b];}_0x3a9c2b['stop']();});_0x2fcd7e[_0x4711('0x17')][_0x49070b]['on'](_0x4711('0x1b'),function(){if(_0x2fcd7e[_0x4711('0x17')][_0x49070b]){delete _0x2fcd7e[_0x4711('0x17')][_0x49070b];}});_0x4ede31=setTimeout(function(){logger[_0x4711('0x6')](_0x4711('0x1c'),_0x49070b);clearTimeout(_0x4ede31);_0x71b871['close']();_0x3a9c2b[_0x4711('0x1d')]();},_0x4e1e34);strategy[_0x4711('0x1e')](_0x71b871,_0x64a17b,_0x2fcd7e,_0x55bf61);}else{logger[_0x4711('0xb')](_0x4711('0x1f'),_0x49070b,_0x41da5d[_0x4711('0x13')]);_0x3a9c2b[_0x4711('0x10')]();}}}catch(_0x38fbde){console[_0x4711('0x20')](_0x38fbde);logger[_0x4711('0xb')](_0x4711('0x21'),_0x49070b,_0x38fbde[_0x4711('0x22')]);_0x3a9c2b['stop']();}};}; \ No newline at end of file +var _0x1aad=['[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','join','find','agents','timeout','atimeout','channel','rules','end','stop','complete','[%s][AGENT]\x20ROUTING\x20END','close','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log'];(function(_0x95942,_0x85da80){var _0x6d7f81=function(_0x510549){while(--_0x510549){_0x95942['push'](_0x95942['shift']());}};_0x6d7f81(++_0x85da80);}(_0x1aad,0x1ca));var _0xd1aa=function(_0x533290,_0x31e3ae){_0x533290=_0x533290-0x0;var _0x23f13d=_0x1aad[_0x533290];return _0x23f13d;};'use strict';var schema=require(_0xd1aa('0x0'));var _=require(_0xd1aa('0x1'));var util=require(_0xd1aa('0x2'));var seqqueue=require(_0xd1aa('0x3'));var logger=require(_0xd1aa('0x4'))(_0xd1aa('0x5'));var strategy=require(_0xd1aa('0x6'));var queue=schema({'name':{'type':_0xd1aa('0x7'),'required':!![],'message':_0xd1aa('0x8')},'timeout':{'type':_0xd1aa('0x9'),'message':_0xd1aa('0xa')}});function writeLog(_0x4f7963,_0x604d93,_0x5785f7){return logger[_0xd1aa('0xb')](util[_0xd1aa('0xc')](_0xd1aa('0xd'),_0x4f7963,_0x604d93[_0xd1aa('0xe')],_0x5785f7));}function handleFindAgent(_0x1d548a){return function(_0x23c3b5){return _0x23c3b5[_0xd1aa('0xe')][_0xd1aa('0xf')]()===_0x1d548a[_0xd1aa('0xf')]();};}exports[_0xd1aa('0x10')]=function(_0x528d9c,_0x2e264a,_0x2f0b0a,_0x2cda7a){return function(_0x34cc94){try{var _0xc3b27a={'name':_0x2e264a[0x0],'timeout':_0x2e264a[0x1]};var _0x1fbba5=queue[_0xd1aa('0x0')](_0xc3b27a,{'typecast':!![]});if(_0x1fbba5[_0xd1aa('0x11')]){logger[_0xd1aa('0x12')](_0xd1aa('0x13'),_0x528d9c,_[_0xd1aa('0x14')](_0x1fbba5,'message')[_0xd1aa('0x15')](',\x20'));_0x34cc94['stop']();}else{var _0x13bf2f=_[_0xd1aa('0x16')](_0x2f0b0a[_0xd1aa('0x17')],handleFindAgent(_0xc3b27a[_0xd1aa('0xe')]));if(_0x13bf2f){var _0x30e587=(_0xc3b27a[_0xd1aa('0x18')]||0xa)*0x3e8;var _0x11e931,_0x100fd6;var _0x530074=seqqueue['createQueue'](_0x30e587);_0x530074['id']=_0x528d9c;_0x530074[_0xd1aa('0x19')]=_0x30e587;_0x530074[_0xd1aa('0x1a')]=_0x2cda7a[_0xd1aa('0x1a')];writeLog(_0x528d9c,_0x13bf2f,util[_0xd1aa('0xc')]('START:%s',_0x30e587));_0x2f0b0a[_0xd1aa('0x1b')][_0x528d9c]['on'](_0xd1aa('0x1c'),function(){logger[_0xd1aa('0xb')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x528d9c);clearTimeout(_0x100fd6);_0x100fd6=undefined;_0x530074['close']();if(_0x2f0b0a[_0xd1aa('0x1b')][_0x528d9c]){delete _0x2f0b0a[_0xd1aa('0x1b')][_0x528d9c];}_0x34cc94[_0xd1aa('0x1d')]();});_0x2f0b0a[_0xd1aa('0x1b')][_0x528d9c]['on'](_0xd1aa('0x1e'),function(){if(_0x2f0b0a[_0xd1aa('0x1b')][_0x528d9c]){delete _0x2f0b0a[_0xd1aa('0x1b')][_0x528d9c];}});_0x100fd6=setTimeout(function(){logger[_0xd1aa('0xb')](_0xd1aa('0x1f'),_0x528d9c);clearTimeout(_0x100fd6);_0x530074[_0xd1aa('0x20')]();_0x34cc94['next']();},_0x30e587);strategy[_0xd1aa('0x21')](_0x530074,_0x13bf2f,_0x2f0b0a,_0x2cda7a);}else{logger[_0xd1aa('0x12')](_0xd1aa('0x22'),_0x528d9c,_0xc3b27a[_0xd1aa('0xe')]);_0x34cc94[_0xd1aa('0x1d')]();}}}catch(_0x23efa1){console[_0xd1aa('0x23')](_0x23efa1);logger[_0xd1aa('0x12')](_0xd1aa('0x24'),_0x528d9c,_0x23efa1[_0xd1aa('0x25')]);_0x34cc94['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 695a371..4640cad 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 _0xe4ed=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','channel','sms','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','body','getMustacheRender','Message','create','then','[%s][AMAZONLEX]\x20%s','catch','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','next','amazonlex','providerName','providerResponse','stringify','dialogState','error','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage'];(function(_0x2c2838,_0x334032){var _0x24899a=function(_0x1a6b48){while(--_0x1a6b48){_0x2c2838['push'](_0x2c2838['shift']());}};_0x24899a(++_0x334032);}(_0xe4ed,0x192));var _0xde4e=function(_0x4de389,_0x1defd4){_0x4de389=_0x4de389-0x0;var _0x58aa68=_0xe4ed[_0x4de389];return _0x58aa68;};'use strict';var _=require(_0xde4e('0x0'));var moment=require(_0xde4e('0x1'));var AWS=require('aws-sdk');var utils=require(_0xde4e('0x2'));var logger=require(_0xde4e('0x3'))(_0xde4e('0x4'));var rpc={'chatMessage':require(_0xde4e('0x5')),'openchannelMessage':require(_0xde4e('0x6')),'mailMessage':require(_0xde4e('0x7')),'smsMessage':require(_0xde4e('0x8')),'faxMessage':require(_0xde4e('0x9')),'whatsappMessage':require(_0xde4e('0xa'))};exports[_0xde4e('0xb')]=function(_0x1c02b6,_0x274351){return function(_0x3b78bd){try{if(!_[_0xde4e('0xc')](this[_0xde4e('0xd')]['UserId'])){logger[_0xde4e('0xe')]('[%s][AMAZONLEX]\x20%s',_0x1c02b6,_0xde4e('0xf'));return _0x3b78bd['next']();}var _0x193227={'ContactId':this[_0xde4e('0x10')]['id'],'sentAt':moment()[_0xde4e('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0xde4e('0x12')]===_0xde4e('0x13')||this['channel']==='whatsapp'){_0x193227[_0xde4e('0x14')]=this[_0xde4e('0xd')][_0xde4e('0x14')];}var _0x44cc8e=this[_0xde4e('0x12')];if(_0x44cc8e===_0xde4e('0x15')){_0x193227[_0xde4e('0x16')]=this['account']['id'];}else{_0x193227[_[_0xde4e('0x17')](_0x44cc8e)+_0xde4e('0x18')]=this[_0xde4e('0x19')]['id'];}_0x193227[_['upperFirst'](_0x44cc8e)+_0xde4e('0x1a')]=this['interaction']['id'];if(this[_0xde4e('0xd')][_0xde4e('0x1b')]){var _0x4c0b17=_0x274351[0x4];if(!_['isEmpty'](_0x4c0b17)){_0x193227[_0xde4e('0x1c')]=utils[_0xde4e('0x1d')](_0x4c0b17,this);return rpc[_0x44cc8e+_0xde4e('0x1e')][_0xde4e('0x1f')](_0x193227)[_0xde4e('0x20')](function(_0x1f73ed){logger[_0xde4e('0xe')](_0xde4e('0x21'),_0x1c02b6,_0x193227[_0xde4e('0x1c')]);})[_0xde4e('0x22')](function(_0x352b0f){logger['error'](_0xde4e('0x21'),_0x1c02b6,JSON['stringify'](_0x352b0f));})[_0xde4e('0x23')](function(){logger[_0xde4e('0xe')](_0xde4e('0x24'),_0x1c02b6);_0x3b78bd[_0xde4e('0x25')]();});}else{logger[_0xde4e('0xe')](_0xde4e('0x26'),_0x1c02b6);_0x3b78bd[_0xde4e('0x25')]();}}else{var _0x52aa81=this;var _0x5187e2=new AWS[(_0xde4e('0x27'))]({'accessKeyId':_0x274351[0x0],'secretAccessKey':_0x274351[0x1],'region':_0x274351[0x2]});var _0x2d71d2={'botAlias':_0xde4e('0x28'),'botName':_0x274351[0x3],'inputText':this[_0xde4e('0x29')][_0xde4e('0x1c')],'userId':this['channel']+':'+this[_0xde4e('0xd')]['id'][_0xde4e('0x2a')]()};_0x5187e2[_0xde4e('0x2b')](_0x2d71d2,function(_0x30c85b,_0x2c46cc){if(_0x30c85b){logger['error']('[%s][AMAZONLEX]\x20%s',_0x1c02b6,_0x30c85b['message']);_0x3b78bd[_0xde4e('0x2c')]();}else if(_0x2c46cc&&_0x2c46cc[_0xde4e('0x29')]){_0x52aa81['body'][_0xde4e('0x2d')]=_0x2c46cc;_0x193227[_0xde4e('0x1c')]=_0x2c46cc[_0xde4e('0x29')];_0x193227[_0xde4e('0x2e')]='amazonlex';_0x193227[_0xde4e('0x2f')]=JSON[_0xde4e('0x30')](_0x2c46cc);return rpc[_0x44cc8e+_0xde4e('0x1e')][_0xde4e('0x1f')](_0x193227)[_0xde4e('0x20')](function(_0x25bfc1){logger[_0xde4e('0xe')](_0xde4e('0x21'),_0x1c02b6,_0x193227[_0xde4e('0x1c')]);if(_0x2c46cc[_0xde4e('0x31')]=='Failed'){_0x3b78bd[_0xde4e('0x2c')]();}else{_0x3b78bd[_0xde4e('0x25')]();}})['catch'](function(_0x61c467){logger[_0xde4e('0x32')](_0xde4e('0x21'),_0x1c02b6,JSON[_0xde4e('0x30')](_0x61c467));_0x3b78bd['next']();});}else{_0x3b78bd[_0xde4e('0x2c')]();}});}}catch(_0x456994){logger[_0xde4e('0x32')](_0xde4e('0x21'),_0x1c02b6,JSON['stringify'](_0x456994));_0x3b78bd[_0xde4e('0x25')]();}};}; \ No newline at end of file +var _0x810e=['interaction','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','out','channel','sms','phone','chat','ChatWebsiteId','upperFirst','created','isEmpty','body','getMustacheRender','then','catch','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','toString','postText','error','message','amazonlex','providerResponse','create','dialogState','Failed','lodash','aws-sdk','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil'];(function(_0xcfe8cc,_0xb83aeb){var _0x55ac53=function(_0x4067d4){while(--_0x4067d4){_0xcfe8cc['push'](_0xcfe8cc['shift']());}};_0x55ac53(++_0xb83aeb);}(_0x810e,0xfe));var _0xe810=function(_0x5c0997,_0x13422c){_0x5c0997=_0x5c0997-0x0;var _0x5d79e2=_0x810e[_0x5c0997];return _0x5d79e2;};'use strict';var _=require(_0xe810('0x0'));var moment=require('moment');var AWS=require(_0xe810('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0xe810('0x2')),'openchannelMessage':require(_0xe810('0x3')),'mailMessage':require(_0xe810('0x4')),'smsMessage':require(_0xe810('0x5')),'faxMessage':require(_0xe810('0x6')),'whatsappMessage':require(_0xe810('0x7'))};exports[_0xe810('0x8')]=function(_0x4e2f9a,_0x45a6d9){return function(_0x4df95e){try{if(!_[_0xe810('0x9')](this[_0xe810('0xa')]['UserId'])){logger['info'](_0xe810('0xb'),_0x4e2f9a,_0xe810('0xc'));return _0x4df95e[_0xe810('0xd')]();}var _0x327ac9={'ContactId':this['contact']['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xe810('0xe')};if(this[_0xe810('0xf')]===_0xe810('0x10')||this[_0xe810('0xf')]==='whatsapp'){_0x327ac9[_0xe810('0x11')]=this['interaction']['phone'];}var _0x1c6a69=this[_0xe810('0xf')];if(_0x1c6a69===_0xe810('0x12')){_0x327ac9[_0xe810('0x13')]=this['account']['id'];}else{_0x327ac9[_[_0xe810('0x14')](_0x1c6a69)+'AccountId']=this['account']['id'];}_0x327ac9[_[_0xe810('0x14')](_0x1c6a69)+'InteractionId']=this[_0xe810('0xa')]['id'];if(this[_0xe810('0xa')][_0xe810('0x15')]){var _0x255dba=_0x45a6d9[0x4];if(!_[_0xe810('0x16')](_0x255dba)){_0x327ac9[_0xe810('0x17')]=utils[_0xe810('0x18')](_0x255dba,this);return rpc[_0x1c6a69+'Message']['create'](_0x327ac9)[_0xe810('0x19')](function(_0x1da28e){logger['info'](_0xe810('0xb'),_0x4e2f9a,_0x327ac9['body']);})[_0xe810('0x1a')](function(_0x45fbf4){logger['error'](_0xe810('0xb'),_0x4e2f9a,JSON[_0xe810('0x1b')](_0x45fbf4));})[_0xe810('0x1c')](function(){logger['info'](_0xe810('0x1d'),_0x4e2f9a);_0x4df95e['stop']();});}else{logger[_0xe810('0x1e')](_0xe810('0x1f'),_0x4e2f9a);_0x4df95e[_0xe810('0x20')]();}}else{var _0xb03e24=this;var _0x57cc5a=new AWS[(_0xe810('0x21'))]({'accessKeyId':_0x45a6d9[0x0],'secretAccessKey':_0x45a6d9[0x1],'region':_0x45a6d9[0x2]});var _0xc1833e={'botAlias':_0xe810('0x22'),'botName':_0x45a6d9[0x3],'inputText':this['message']['body'],'userId':this[_0xe810('0xf')]+':'+this[_0xe810('0xa')]['id'][_0xe810('0x23')]()};_0x57cc5a[_0xe810('0x24')](_0xc1833e,function(_0x12a9e1,_0x4e74b2){if(_0x12a9e1){logger[_0xe810('0x25')](_0xe810('0xb'),_0x4e2f9a,_0x12a9e1[_0xe810('0x26')]);_0x4df95e[_0xe810('0xd')]();}else if(_0x4e74b2&&_0x4e74b2[_0xe810('0x26')]){_0xb03e24[_0xe810('0x17')][_0xe810('0x27')]=_0x4e74b2;_0x327ac9[_0xe810('0x17')]=_0x4e74b2[_0xe810('0x26')];_0x327ac9['providerName']=_0xe810('0x27');_0x327ac9[_0xe810('0x28')]=JSON[_0xe810('0x1b')](_0x4e74b2);return rpc[_0x1c6a69+'Message'][_0xe810('0x29')](_0x327ac9)[_0xe810('0x19')](function(_0x5208de){logger[_0xe810('0x1e')](_0xe810('0xb'),_0x4e2f9a,_0x327ac9['body']);if(_0x4e74b2[_0xe810('0x2a')]==_0xe810('0x2b')){_0x4df95e['next']();}else{_0x4df95e[_0xe810('0x20')]();}})[_0xe810('0x1a')](function(_0x4b5a4b){logger['error'](_0xe810('0xb'),_0x4e2f9a,JSON[_0xe810('0x1b')](_0x4b5a4b));_0x4df95e[_0xe810('0xd')]();});}else{_0x4df95e['next']();}});}}catch(_0x559638){logger[_0xe810('0x25')]('[%s][AMAZONLEX]\x20%s',_0x4e2f9a,JSON[_0xe810('0x1b')](_0x559638));_0x4df95e[_0xe810('0x20')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 7d8eaf8..0f62b6c 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 _0xbc62=['chat','account','upperFirst','AccountId','InteractionId','Message','Smtp','service','host','port','secure','authentication','auth','user','pass','messageId','html','','replace','','auto_reply','sendMailMessage','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','then','Interaction','update','catch','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','channel','mail','isAutoreply','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','out','body','getMustacheRender','message','from','phone','subject','Re:','Re:\x20'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xbc62,0x19b));var _0x2bc6=function(_0x278187,_0x1ba09f){_0x278187=_0x278187-0x0;var _0x11cb85=_0xbc62[_0x278187];return _0x11cb85;};'use strict';var _=require(_0x2bc6('0x0'));var moment=require(_0x2bc6('0x1'));var utils=require('./utils');var logger=require(_0x2bc6('0x2'))('routing');var rpc={'chatMessage':require(_0x2bc6('0x3')),'openchannelMessage':require(_0x2bc6('0x4')),'mailMessage':require(_0x2bc6('0x5')),'smsMessage':require(_0x2bc6('0x6')),'faxMessage':require(_0x2bc6('0x7')),'whatsappMessage':require(_0x2bc6('0x8')),'chatInteraction':require(_0x2bc6('0x9')),'openchannelInteraction':require(_0x2bc6('0xa')),'mailInteraction':require(_0x2bc6('0xb')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0x2bc6('0xc')),'whatsappInteraction':require(_0x2bc6('0xd'))};var mailRpc=require('../../mailRpc');exports[_0x2bc6('0xe')]=function(_0x110b74,_0x343e3b,_0x10e119,_0x5d8f67){return function(_0x5a8d79){try{var _0x3b3df6=this[_0x2bc6('0xf')];if(_0x3b3df6===_0x2bc6('0x10')&&_0x5d8f67['body'][_0x2bc6('0x11')]){logger[_0x2bc6('0x12')]('[%s][AUTOREPLY]\x20%s',_0x110b74,_0x2bc6('0x13'));return _0x5a8d79[_0x2bc6('0x14')]();}if(_0x343e3b[0x0]==='1'&&(_[_0x2bc6('0x15')](this[_0x2bc6('0x16')][_0x2bc6('0x17')])||!this[_0x2bc6('0x16')][_0x2bc6('0x17')])){logger['info'](_0x2bc6('0x18'),_0x110b74,'Autoreply\x20already\x20sent');return _0x5a8d79['next']();}if(_0x343e3b[0x0]==='2'&&this[_0x2bc6('0x16')][_0x2bc6('0x19')]){logger[_0x2bc6('0x12')](_0x2bc6('0x1a'),_0x110b74,_0x2bc6('0x1b'));return _0x5a8d79[_0x2bc6('0x14')]();}var _0xa67f45={'ContactId':this[_0x2bc6('0x1c')]['id'],'sentAt':moment()[_0x2bc6('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x2bc6('0x1e')};if(this[_0x2bc6('0xf')]==='mail'){_0xa67f45[_0x2bc6('0x1f')]=utils['getMustacheRender'](_0x343e3b[0x2],this);}else{_0xa67f45[_0x2bc6('0x1f')]=utils[_0x2bc6('0x20')](_0x343e3b[0x1],this);}if(this[_0x2bc6('0x21')]){_0xa67f45['to']=this[_0x2bc6('0x21')]['from']||'';if(this[_0x2bc6('0xf')]===_0x2bc6('0x10')&&_0x343e3b[0x1]==='1'){_0xa67f45['cc']=this[_0x2bc6('0x21')]['cc']||'';}_0xa67f45[_0x2bc6('0x22')]=this['message']['to']||'';_0xa67f45[_0x2bc6('0x23')]=this[_0x2bc6('0x21')][_0x2bc6('0x23')]||'';_0xa67f45['read']=!![];if(this[_0x2bc6('0x21')][_0x2bc6('0x24')]){_0xa67f45[_0x2bc6('0x24')]='';_0xa67f45[_0x2bc6('0x24')]+=_['startsWith'](this[_0x2bc6('0x21')][_0x2bc6('0x24')],_0x2bc6('0x25'))?'':_0x2bc6('0x26');_0xa67f45[_0x2bc6('0x24')]+=this['message'][_0x2bc6('0x24')];}}if(this[_0x2bc6('0xf')]===_0x2bc6('0x27')){_0xa67f45['ChatWebsiteId']=this[_0x2bc6('0x28')]['id'];}else{_0xa67f45[_[_0x2bc6('0x29')](this[_0x2bc6('0xf')])+_0x2bc6('0x2a')]=this[_0x2bc6('0x28')]['id'];}_0xa67f45[_[_0x2bc6('0x29')](this[_0x2bc6('0xf')])+_0x2bc6('0x2b')]=this[_0x2bc6('0x16')]['id'];var _0x902f67=this[_0x2bc6('0x16')];if(rpc[this[_0x2bc6('0xf')]+_0x2bc6('0x2c')]){if(this[_0x2bc6('0xf')]==='mail'){var _0x233be7={'tls':{'rejectUnauthorized':![]}};if(this[_0x2bc6('0x28')][_0x2bc6('0x2d')]['service']){_0x233be7[_0x2bc6('0x2e')]=this['account'][_0x2bc6('0x2d')][_0x2bc6('0x2e')];}else{_0x233be7[_0x2bc6('0x2f')]=this[_0x2bc6('0x28')][_0x2bc6('0x2d')]['host'];_0x233be7['port']=this[_0x2bc6('0x28')][_0x2bc6('0x2d')][_0x2bc6('0x30')];_0x233be7[_0x2bc6('0x31')]=this[_0x2bc6('0x28')]['Smtp'][_0x2bc6('0x31')];}if(this[_0x2bc6('0x28')]['Smtp'][_0x2bc6('0x32')]){_0x233be7[_0x2bc6('0x33')]={'user':this[_0x2bc6('0x28')][_0x2bc6('0x2d')][_0x2bc6('0x34')],'pass':this['account'][_0x2bc6('0x2d')][_0x2bc6('0x35')]};}_0xa67f45['inReplyTo']=this[_0x2bc6('0x21')][_0x2bc6('0x36')];_0xa67f45[_0x2bc6('0x37')]=_0x2bc6('0x38')+_[_0x2bc6('0x39')](_0xa67f45['body'],'','replace','','auto-replied','All','auto_reply','sendMailMessage','then','messageId','create','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','body','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','mail','getMustacheRender','message','from'];(function(_0x428c2a,_0x86699d){var _0x49b013=function(_0x53bff9){while(--_0x53bff9){_0x428c2a['push'](_0x428c2a['shift']());}};_0x49b013(++_0x86699d);}(_0x388d,0xc4));var _0xd388=function(_0xf08123,_0x5c3532){_0xf08123=_0xf08123-0x0;var _0x1af7d4=_0x388d[_0xf08123];return _0x1af7d4;};'use strict';var _=require('lodash');var moment=require('moment');var utils=require(_0xd388('0x0'));var logger=require(_0xd388('0x1'))(_0xd388('0x2'));var rpc={'chatMessage':require(_0xd388('0x3')),'openchannelMessage':require(_0xd388('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xd388('0x5')),'faxMessage':require(_0xd388('0x6')),'whatsappMessage':require(_0xd388('0x7')),'chatInteraction':require(_0xd388('0x8')),'openchannelInteraction':require(_0xd388('0x9')),'mailInteraction':require(_0xd388('0xa')),'smsInteraction':require(_0xd388('0xb')),'faxInteraction':require(_0xd388('0xc')),'whatsappInteraction':require(_0xd388('0xd'))};var mailRpc=require(_0xd388('0xe'));exports[_0xd388('0xf')]=function(_0xcf763a,_0xa86396,_0x53a747,_0x62c5a9){return function(_0x1b5d5f){try{var _0xb596fc=this['channel'];if(_0xb596fc==='mail'&&_0x62c5a9[_0xd388('0x10')]['isAutoreply']){logger[_0xd388('0x11')]('[%s][AUTOREPLY]\x20%s',_0xcf763a,_0xd388('0x12'));return _0x1b5d5f['next']();}if(_0xa86396[0x0]==='1'&&(_['isNil'](this[_0xd388('0x13')][_0xd388('0x14')])||!this[_0xd388('0x13')][_0xd388('0x14')])){logger[_0xd388('0x11')](_0xd388('0x15'),_0xcf763a,_0xd388('0x16'));return _0x1b5d5f[_0xd388('0x17')]();}if(_0xa86396[0x0]==='2'&&this['interaction'][_0xd388('0x18')]){logger['info'](_0xd388('0x19'),_0xcf763a,'One\x20Time\x20already\x20sent');return _0x1b5d5f['next']();}var _0x1c1911={'ContactId':this[_0xd388('0x1a')]['id'],'sentAt':moment()[_0xd388('0x1b')](_0xd388('0x1c')),'direction':_0xd388('0x1d')};if(this[_0xd388('0x1e')]===_0xd388('0x1f')){_0x1c1911['body']=utils[_0xd388('0x20')](_0xa86396[0x2],this);}else{_0x1c1911[_0xd388('0x10')]=utils[_0xd388('0x20')](_0xa86396[0x1],this);}if(this[_0xd388('0x21')]){_0x1c1911['to']=this['message'][_0xd388('0x22')]||'';if(this[_0xd388('0x1e')]==='mail'&&_0xa86396[0x1]==='1'){_0x1c1911['cc']=this[_0xd388('0x21')]['cc']||'';}_0x1c1911['from']=this[_0xd388('0x21')]['to']||'';_0x1c1911[_0xd388('0x23')]=this['message'][_0xd388('0x23')]||'';_0x1c1911[_0xd388('0x24')]=!![];if(this[_0xd388('0x21')][_0xd388('0x25')]){_0x1c1911[_0xd388('0x25')]='';_0x1c1911[_0xd388('0x25')]+=_[_0xd388('0x26')](this[_0xd388('0x21')][_0xd388('0x25')],'Re:')?'':'Re:\x20';_0x1c1911[_0xd388('0x25')]+=this[_0xd388('0x21')][_0xd388('0x25')];}}if(this['channel']===_0xd388('0x27')){_0x1c1911[_0xd388('0x28')]=this['account']['id'];}else{_0x1c1911[_[_0xd388('0x29')](this[_0xd388('0x1e')])+_0xd388('0x2a')]=this['account']['id'];}_0x1c1911[_[_0xd388('0x29')](this[_0xd388('0x1e')])+'InteractionId']=this[_0xd388('0x13')]['id'];var _0x47cad9=this[_0xd388('0x13')];if(rpc[this[_0xd388('0x1e')]+_0xd388('0x2b')]){if(this[_0xd388('0x1e')]==='mail'){var _0x3ef6c9={'tls':{'rejectUnauthorized':![]}};if(this[_0xd388('0x2c')][_0xd388('0x2d')][_0xd388('0x2e')]){_0x3ef6c9[_0xd388('0x2e')]=this[_0xd388('0x2c')]['Smtp']['service'];}else{_0x3ef6c9[_0xd388('0x2f')]=this[_0xd388('0x2c')][_0xd388('0x2d')][_0xd388('0x2f')];_0x3ef6c9[_0xd388('0x30')]=this['account'][_0xd388('0x2d')][_0xd388('0x30')];_0x3ef6c9[_0xd388('0x31')]=this[_0xd388('0x2c')][_0xd388('0x2d')][_0xd388('0x31')];}if(this[_0xd388('0x2c')][_0xd388('0x2d')][_0xd388('0x32')]){_0x3ef6c9[_0xd388('0x33')]={'user':this['account'][_0xd388('0x2d')][_0xd388('0x34')],'pass':this['account']['Smtp'][_0xd388('0x35')]};}_0x1c1911[_0xd388('0x36')]=this[_0xd388('0x21')]['messageId'];_0x1c1911[_0xd388('0x37')]=_0xd388('0x38')+_[_0xd388('0x39')](_0x1c1911[_0xd388('0x10')],_0xd388('0x3a'),']+(>|$)/g,''),'priorityTrue':_0x3b62da[0x1],'priorityFalse':_0x3b62da[0x2]};var _0x433c04=gotoif[_0xb7d0('0x0')](_0x14b672,{'typecast':!![]});if(_0x433c04['length']){logger[_0xb7d0('0x6')](_0xb7d0('0x7'),_0x2e92b5,_['map'](_0x433c04,_0xb7d0('0x8'))['join'](',\x20'));_0x59891f[_0xb7d0('0x9')]();}else{try{var _0x2a7cc3=eval('('+_0x14b672[_0xb7d0('0xa')]+')');var _0x3c3a1d=_0x2a7cc3?_0x14b672[_0xb7d0('0xb')]:_0x14b672[_0xb7d0('0xc')];logger[_0xb7d0('0xd')](_0xb7d0('0xe'),_0x2e92b5,_0x14b672['condition'],_0x2a7cc3,_0x3c3a1d||_0xb7d0('0xf'));if(_0x3c3a1d){var _0x4dfbb4=_['findIndex'](_0x59891f[_0xb7d0('0x10')](),{'p':_0x3c3a1d});if(_0x4dfbb4>=0x0){logger[_0xb7d0('0xd')](_0xb7d0('0x11'),_0x2e92b5,_0x3c3a1d||_0xb7d0('0xf'),_0x4dfbb4);_0x59891f[_0xb7d0('0xf')](_0x4dfbb4);}else{logger['info'](_0xb7d0('0x12'),_0x2e92b5,_0x3c3a1d||'next');_0x59891f[_0xb7d0('0x9')]();}}else{_0x59891f[_0xb7d0('0xf')]();}}catch(_0x4f2abe){logger[_0xb7d0('0x6')](_0xb7d0('0x13'),_0x2e92b5,_0x4f2abe['message']);_0x59891f[_0xb7d0('0x9')]();}}}catch(_0x38b9eb){logger[_0xb7d0('0x6')](_0xb7d0('0x7'),_0x2e92b5,JSON[_0xb7d0('0x14')](_0x38b9eb));_0x59891f[_0xb7d0('0x9')]();}};}; \ No newline at end of file +var _0xd5bb=['[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','routing','string','number','priority\x20true\x20is\x20a\x20number','consequence','fromString','replace','error','map','message','join','stop','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x1e5c16,_0x31b3f2){var _0x12b5c7=function(_0x54ddfb){while(--_0x54ddfb){_0x1e5c16['push'](_0x1e5c16['shift']());}};_0x12b5c7(++_0x31b3f2);}(_0xd5bb,0xd2));var _0xbd5b=function(_0x361b4f,_0x3a9c1d){_0x361b4f=_0x361b4f-0x0;var _0x62bb09=_0xd5bb[_0x361b4f];return _0x62bb09;};'use strict';var schema=require(_0xbd5b('0x0'));var _=require(_0xbd5b('0x1'));var htmlToText=require(_0xbd5b('0x2'));var utils=require(_0xbd5b('0x3'));var logger=require('../../../../config/logger')(_0xbd5b('0x4'));var gotoif=schema({'condition':{'type':_0xbd5b('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0xbd5b('0x6'),'message':_0xbd5b('0x7')},'priorityFalse':{'type':_0xbd5b('0x6'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0xbd5b('0x8')]=function(_0x562da7,_0x4d107f){return function(_0x2e06c3){try{var _0x5b0f28={'condition':htmlToText[_0xbd5b('0x9')](utils['getMustacheRender'](_0x4d107f[0x0],this),{'wordwrap':![]})[_0xbd5b('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4d107f[0x1],'priorityFalse':_0x4d107f[0x2]};var _0x3749fa=gotoif['validate'](_0x5b0f28,{'typecast':!![]});if(_0x3749fa['length']){logger[_0xbd5b('0xb')]('[%s][GOTOIF]\x20%s',_0x562da7,_[_0xbd5b('0xc')](_0x3749fa,_0xbd5b('0xd'))[_0xbd5b('0xe')](',\x20'));_0x2e06c3[_0xbd5b('0xf')]();}else{try{var _0x1c0dbc=eval('('+_0x5b0f28[_0xbd5b('0x10')]+')');var _0x3ec783=_0x1c0dbc?_0x5b0f28[_0xbd5b('0x11')]:_0x5b0f28[_0xbd5b('0x12')];logger['info'](_0xbd5b('0x13'),_0x562da7,_0x5b0f28[_0xbd5b('0x10')],_0x1c0dbc,_0x3ec783||_0xbd5b('0x14'));if(_0x3ec783){var _0x5c5752=_[_0xbd5b('0x15')](_0x2e06c3['rules'](),{'p':_0x3ec783});if(_0x5c5752>=0x0){logger[_0xbd5b('0x16')](_0xbd5b('0x17'),_0x562da7,_0x3ec783||_0xbd5b('0x14'),_0x5c5752);_0x2e06c3[_0xbd5b('0x14')](_0x5c5752);}else{logger[_0xbd5b('0x16')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x562da7,_0x3ec783||_0xbd5b('0x14'));_0x2e06c3[_0xbd5b('0xf')]();}}else{_0x2e06c3['next']();}}catch(_0x454ceb){logger[_0xbd5b('0xb')](_0xbd5b('0x18'),_0x562da7,_0x454ceb[_0xbd5b('0xd')]);_0x2e06c3[_0xbd5b('0xf')]();}}}catch(_0x3c3e60){logger[_0xbd5b('0xb')]('[%s][GOTOIF]\x20%s',_0x562da7,JSON[_0xbd5b('0x19')](_0x3c3e60));_0x2e06c3[_0xbd5b('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 5e6851a..c73ad3b 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 _0xc528=['join','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message'];(function(_0x14ead9,_0x410058){var _0x17bfe6=function(_0x419379){while(--_0x419379){_0x14ead9['push'](_0x14ead9['shift']());}};_0x17bfe6(++_0x410058);}(_0xc528,0xc3));var _0x8c52=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc528[_0x321bb2];return _0x9c12ed;};'use strict';var schema=require(_0x8c52('0x0'));var _=require(_0x8c52('0x1'));var logger=require(_0x8c52('0x2'))(_0x8c52('0x3'));var gotop=schema({'priority':{'type':_0x8c52('0x4'),'required':!![],'message':_0x8c52('0x5')}});exports[_0x8c52('0x6')]=function(_0x4664c9,_0x53ed50){return function(_0x3f9c01){try{var _0x80c39e={'priority':_0x53ed50[0x0]};var _0xc91ec2=gotop[_0x8c52('0x0')](_0x80c39e,{'typecast':!![]});if(_0xc91ec2[_0x8c52('0x7')]){logger[_0x8c52('0x8')](_0x8c52('0x9'),_0x4664c9,_[_0x8c52('0xa')](_0xc91ec2,_0x8c52('0xb'))[_0x8c52('0xc')](',\x20'));_0x3f9c01[_0x8c52('0xd')]();}else{logger['info'](_0x8c52('0xe'),_0x4664c9,_0x80c39e[_0x8c52('0xf')]);if(_0x80c39e['priority']){var _0x22a55b=_[_0x8c52('0x10')](_0x3f9c01[_0x8c52('0x11')](),{'p':_0x80c39e[_0x8c52('0xf')]});if(_0x22a55b>=0x0){logger[_0x8c52('0x12')](_0x8c52('0x13'),_0x4664c9,_0x80c39e[_0x8c52('0xf')]||_0x8c52('0x14'),_0x22a55b);_0x3f9c01[_0x8c52('0x14')](_0x22a55b);}else{logger['info'](_0x8c52('0x15'),_0x4664c9,_0x80c39e['priority']||_0x8c52('0x14'));_0x3f9c01[_0x8c52('0xd')]();}}else{_0x3f9c01[_0x8c52('0x14')]();}}}catch(_0x421399){logger[_0x8c52('0x8')]('[%s][GOTOP]\x20%s',_0x4664c9,JSON[_0x8c52('0x16')](_0x421399));_0x3f9c01[_0x8c52('0xd')]();}};}; \ No newline at end of file +var _0x505d=['map','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stop','validate','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','[%s][GOTOP]\x20%s'];(function(_0x48f880,_0x47ccea){var _0x13b7c6=function(_0x1251d9){while(--_0x1251d9){_0x48f880['push'](_0x48f880['shift']());}};_0x13b7c6(++_0x47ccea);}(_0x505d,0x180));var _0xd505=function(_0x1d1d09,_0x504d77){_0x1d1d09=_0x1d1d09-0x0;var _0x8827e=_0x505d[_0x1d1d09];return _0x8827e;};'use strict';var schema=require(_0xd505('0x0'));var _=require('lodash');var logger=require(_0xd505('0x1'))('routing');var gotop=schema({'priority':{'type':_0xd505('0x2'),'required':!![],'message':_0xd505('0x3')}});exports['consequence']=function(_0x4800f9,_0x3a8cf9){return function(_0x2796b5){try{var _0x78ee51={'priority':_0x3a8cf9[0x0]};var _0x2e5bdc=gotop['validate'](_0x78ee51,{'typecast':!![]});if(_0x2e5bdc[_0xd505('0x4')]){logger['error'](_0xd505('0x5'),_0x4800f9,_[_0xd505('0x6')](_0x2e5bdc,'message')['join'](',\x20'));_0x2796b5['stop']();}else{logger['info'](_0xd505('0x7'),_0x4800f9,_0x78ee51[_0xd505('0x8')]);if(_0x78ee51['priority']){var _0xe75f06=_[_0xd505('0x9')](_0x2796b5[_0xd505('0xa')](),{'p':_0x78ee51[_0xd505('0x8')]});if(_0xe75f06>=0x0){logger[_0xd505('0xb')](_0xd505('0xc'),_0x4800f9,_0x78ee51['priority']||_0xd505('0xd'),_0xe75f06);_0x2796b5[_0xd505('0xd')](_0xe75f06);}else{logger['info']('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x4800f9,_0x78ee51[_0xd505('0x8')]||_0xd505('0xd'));_0x2796b5[_0xd505('0xe')]();}}else{_0x2796b5[_0xd505('0xd')]();}}}catch(_0x70ef6f){logger['error'](_0xd505('0x5'),_0x4800f9,JSON['stringify'](_0x70ef6f));_0x2796b5[_0xd505('0xe')]();}};}; \ 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 f7daae8..dbdbb84 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 _0x21c9=['lodash','./utils','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','interaction','Message','create','then','info','next','catch','error','[%s][MESSAGE]\x20%s','stop'];(function(_0x2e616e,_0x42f760){var _0x5d3228=function(_0x1d1344){while(--_0x1d1344){_0x2e616e['push'](_0x2e616e['shift']());}};_0x5d3228(++_0x42f760);}(_0x21c9,0x19e));var _0x921c=function(_0x7cf6dc,_0x57e665){_0x7cf6dc=_0x7cf6dc-0x0;var _0x2f0153=_0x21c9[_0x7cf6dc];return _0x2f0153;};'use strict';var _=require(_0x921c('0x0'));var utils=require(_0x921c('0x1'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x921c('0x2')),'smsMessage':require(_0x921c('0x3')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x921c('0x4'))};exports[_0x921c('0x5')]=function(_0x1e6f48,_0x21cd81){return function(_0x4f7c16){try{var _0x1b0c84={'body':utils[_0x921c('0x6')](_0x21cd81[0x0],this),'ContactId':this['contact']['id']};if(this[_0x921c('0x7')]===_0x921c('0x8')){_0x1b0c84[_0x921c('0x9')]=this['account']['id'];}else{_0x1b0c84[_[_0x921c('0xa')](this['channel'])+_0x921c('0xb')]=this[_0x921c('0xc')]['id'];}_0x1b0c84[_[_0x921c('0xa')](this['channel'])+'InteractionId']=this[_0x921c('0xd')]['id'];if(rpc[this[_0x921c('0x7')]+_0x921c('0xe')]){return rpc[this[_0x921c('0x7')]+_0x921c('0xe')][_0x921c('0xf')](_0x1b0c84)[_0x921c('0x10')](function(_0x27c911){logger[_0x921c('0x11')]('[%s][MESSAGE]\x20%s',_0x1e6f48,_0x1b0c84['body']);_0x4f7c16[_0x921c('0x12')]();})[_0x921c('0x13')](function(_0x3844f4){logger[_0x921c('0x14')](_0x921c('0x15'),_0x1e6f48,JSON['stringify'](_0x3844f4));_0x4f7c16[_0x921c('0x16')]();});}}catch(_0xe10db5){logger['error'](_0x921c('0x15'),_0x1e6f48,JSON['stringify'](_0xe10db5));_0x4f7c16[_0x921c('0x16')]();}};}; \ No newline at end of file +var _0x27dd=['[%s][MESSAGE]\x20%s','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','consequence','getMustacheRender','contact','chat','account','AccountId','InteractionId','interaction','channel','Message','info','body','next','catch','stop','error'];(function(_0x21b2b5,_0x2836a9){var _0x496682=function(_0x4594ed){while(--_0x4594ed){_0x21b2b5['push'](_0x21b2b5['shift']());}};_0x496682(++_0x2836a9);}(_0x27dd,0x177));var _0xd27d=function(_0x4bb581,_0x6f7037){_0x4bb581=_0x4bb581-0x0;var _0x316bf5=_0x27dd[_0x4bb581];return _0x316bf5;};'use strict';var _=require(_0xd27d('0x0'));var utils=require('./utils');var logger=require(_0xd27d('0x1'))(_0xd27d('0x2'));var rpc={'chatMessage':require(_0xd27d('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xd27d('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xd27d('0x5')]=function(_0xf4f0c0,_0x57f9df){return function(_0x1485e7){try{var _0x2c917e={'body':utils[_0xd27d('0x6')](_0x57f9df[0x0],this),'ContactId':this[_0xd27d('0x7')]['id']};if(this['channel']===_0xd27d('0x8')){_0x2c917e['ChatWebsiteId']=this[_0xd27d('0x9')]['id'];}else{_0x2c917e[_['upperFirst'](this['channel'])+_0xd27d('0xa')]=this[_0xd27d('0x9')]['id'];}_0x2c917e[_['upperFirst'](this['channel'])+_0xd27d('0xb')]=this[_0xd27d('0xc')]['id'];if(rpc[this[_0xd27d('0xd')]+_0xd27d('0xe')]){return rpc[this[_0xd27d('0xd')]+'Message']['create'](_0x2c917e)['then'](function(_0x4925c7){logger[_0xd27d('0xf')]('[%s][MESSAGE]\x20%s',_0xf4f0c0,_0x2c917e[_0xd27d('0x10')]);_0x1485e7[_0xd27d('0x11')]();})[_0xd27d('0x12')](function(_0x55ee0c){logger['error']('[%s][MESSAGE]\x20%s',_0xf4f0c0,JSON['stringify'](_0x55ee0c));_0x1485e7[_0xd27d('0x13')]();});}}catch(_0x4b2a48){logger[_0xd27d('0x14')](_0xd27d('0x15'),_0xf4f0c0,JSON['stringify'](_0x4b2a48));_0x1485e7[_0xd27d('0x13')]();}};}; \ 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 76ed33a..cb1890d 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 _0xcb59=['next','error','[%s][NOOP]\x20%s','./utils','../../../../config/logger','routing','consequence','info','getMustacheRender'];(function(_0x4de5ea,_0x5d2f59){var _0x31a498=function(_0x54b6e1){while(--_0x54b6e1){_0x4de5ea['push'](_0x4de5ea['shift']());}};_0x31a498(++_0x5d2f59);}(_0xcb59,0x1a1));var _0x9cb5=function(_0x12a929,_0x2277e1){_0x12a929=_0x12a929-0x0;var _0xa6a4b=_0xcb59[_0x12a929];return _0xa6a4b;};'use strict';var utils=require(_0x9cb5('0x0'));var logger=require(_0x9cb5('0x1'))(_0x9cb5('0x2'));exports[_0x9cb5('0x3')]=function(_0x384060,_0xab7914){return function(_0x38e103){try{logger[_0x9cb5('0x4')]('[%s][NOOP]\x20%s',_0x384060,utils[_0x9cb5('0x5')](_0xab7914[0x0],this));_0x38e103[_0x9cb5('0x6')]();}catch(_0x426b9f){logger[_0x9cb5('0x7')](_0x9cb5('0x8'),_0x384060,JSON['stringify'](_0x426b9f));_0x38e103['stop']();}};}; \ No newline at end of file +var _0xc7e4=['[%s][NOOP]\x20%s','getMustacheRender','next','error','stop','./utils','../../../../config/logger','routing','consequence'];(function(_0x334d1e,_0x28a488){var _0x3b33ba=function(_0x25afca){while(--_0x25afca){_0x334d1e['push'](_0x334d1e['shift']());}};_0x3b33ba(++_0x28a488);}(_0xc7e4,0xcb));var _0x4c7e=function(_0x1a3ca2,_0xe144e7){_0x1a3ca2=_0x1a3ca2-0x0;var _0x30ea08=_0xc7e4[_0x1a3ca2];return _0x30ea08;};'use strict';var utils=require(_0x4c7e('0x0'));var logger=require(_0x4c7e('0x1'))(_0x4c7e('0x2'));exports[_0x4c7e('0x3')]=function(_0x1b17e0,_0x22bc47){return function(_0x3480b2){try{logger['info'](_0x4c7e('0x4'),_0x1b17e0,utils[_0x4c7e('0x5')](_0x22bc47[0x0],this));_0x3480b2[_0x4c7e('0x6')]();}catch(_0x697383){logger[_0x4c7e('0x7')](_0x4c7e('0x4'),_0x1b17e0,JSON['stringify'](_0x697383));_0x3480b2[_0x4c7e('0x8')]();}};}; \ 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 452a720..4163530 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 _0x0fda=['beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','util','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','queue_id','queue','from','joinAt','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','interaction','MessageId','message','AccountId','account','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','waiting','accepted','update','timeout','info','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','join','stop','Queues','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory'];(function(_0x54f945,_0x432453){var _0x239c4a=function(_0x1366ca){while(--_0x1366ca){_0x54f945['push'](_0x54f945['shift']());}};_0x239c4a(++_0x432453);}(_0x0fda,0x96));var _0xa0fd=function(_0x222c17,_0x4df58a){_0x222c17=_0x222c17-0x0;var _0x58f211=_0x0fda[_0x222c17];return _0x58f211;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0xa0fd('0x0'));var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require(_0xa0fd('0x1'));var config=require(_0xa0fd('0x2'));var logger=require(_0xa0fd('0x3'))(_0xa0fd('0x4'));var strategy=require('./strategy');config[_0xa0fd('0x5')]=_[_0xa0fd('0x6')](config['redis'],{'host':_0xa0fd('0x7'),'port':0x18eb});var io=require(_0xa0fd('0x8'))(new Redis(config[_0xa0fd('0x5')]));var attributes=['id',_0xa0fd('0x9'),'account',_0xa0fd('0xa'),_0xa0fd('0xb'),_0xa0fd('0xc')];function emit(_0x5b38a9,_0x4376a5,_0x71955c){io['to'](_0x5b38a9)[_0xa0fd('0xd')](_0x4376a5,_0x71955c);}function emitChannelQueueInteraction(_0x118e61,_0x5b4607,_0xcb4834,_0x3632f3,_0x3f07c8,_0x279918,_0x44fbd9,_0x22772a){var _0x497995=_[_0xa0fd('0xe')](_0xcb4834);_0x497995[_0xa0fd('0x9')]=_0x22772a;_0x497995[_0xa0fd('0xa')]=_0x5b4607;_0x497995['account']=_0x3632f3;_0x497995['id']=_0x3f07c8;if(_0x279918){_0x44fbd9[util[_0xa0fd('0xf')](_0xa0fd('0x10'),_0x118e61)][_0x3f07c8]=_[_0xa0fd('0x11')](_0x497995,attributes);}else{delete _0x44fbd9[util['format'](_0xa0fd('0x10'),_0x118e61)][_0x3f07c8];}emit(util[_0xa0fd('0xf')](_0xa0fd('0x12'),_0x118e61,_0x5b4607),util['format'](_0xa0fd('0x13'),_0x118e61,_0x279918?'save':_0xa0fd('0x14')),_[_0xa0fd('0x11')](_0x497995,attributes));}var rpc={'openchannelQueueReport':require(_0xa0fd('0x15')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xa0fd('0x16')),'faxQueueReport':require(_0xa0fd('0x17')),'whatsappQueueReport':require(_0xa0fd('0x18'))};var queue=schema({'name':{'type':_0xa0fd('0x19'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0xa0fd('0x1a')}});function startRouting(_0xe5fc2d,_0x364438,_0x402e75,_0x13912e){if(_0xe5fc2d&&_0x364438&&_0x402e75){_0x364438['waiting']+=0x1;var _0x1cca79={'uniqueid':_0xe5fc2d,'from':_0x402e75['body']?_0x402e75[_0xa0fd('0x1b')]['from']:'','joinAt':moment()[_0xa0fd('0xf')](_0xa0fd('0x1c')),'ContactId':_0x402e75[_0xa0fd('0x1d')]?_0x402e75['contact']['id']:null,'ListId':_0x402e75[_0xa0fd('0x1e')]?_0x402e75[_0xa0fd('0x1e')]['id']:null};_0x1cca79[_[_0xa0fd('0x1f')](_0x402e75[_0xa0fd('0x20')])+'QueueId']=_0x364438['id']||null;_0x1cca79[_[_0xa0fd('0x1f')](_0x402e75[_0xa0fd('0x20')])+'InteractionId']=_0x402e75[_0xa0fd('0x21')]?_0x402e75[_0xa0fd('0x21')]['id']:null;_0x1cca79[_['upperFirst'](_0x402e75[_0xa0fd('0x20')])+_0xa0fd('0x22')]=_0x402e75[_0xa0fd('0x23')]?_0x402e75[_0xa0fd('0x23')]['id']:null;_0x1cca79[_[_0xa0fd('0x1f')](_0x402e75['channel'])+(_0x402e75[_0xa0fd('0x20')]!=='chat'?_0xa0fd('0x24'):'WebsiteId')]=_0x402e75[_0xa0fd('0x25')]?_0x402e75[_0xa0fd('0x25')]['id']:null;logger['info'](util['format'](_0xa0fd('0x26'),_0xe5fc2d,_0x364438['name']));emitChannelQueueInteraction(_0x402e75['channel'],_0x364438[_0xa0fd('0x27')],_0x1cca79,_0x402e75[_0xa0fd('0x25')]['name'],_0x402e75[_0xa0fd('0x23')]['id'],!![],_0x13912e,_0x364438['id']);if(rpc[_0x402e75[_0xa0fd('0x20')]+_0xa0fd('0x28')]){return rpc[_0x402e75[_0xa0fd('0x20')]+_0xa0fd('0x28')][_0xa0fd('0x29')](_0x1cca79)[_0xa0fd('0x2a')](function(_0x302c37){logger[_0xa0fd('0x2b')]('create\x20queue\x20report');});}}}function stopRouting(_0x16a78a,_0x531aab,_0x4a865a,_0x536acf){if(_0x16a78a&&_0x531aab){_0x531aab[_0xa0fd('0x2c')]-=0x1;var _0x11257c={'leaveAt':moment()[_0xa0fd('0xf')](_0xa0fd('0x1c')),'acceptAt':moment()[_0xa0fd('0xf')](_0xa0fd('0x1c')),'reason':_0xa0fd('0x2d')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x16a78a,_0x531aab[_0xa0fd('0x27')]));emitChannelQueueInteraction(_0x4a865a[_0xa0fd('0x20')],_0x531aab[_0xa0fd('0x27')],_0x4a865a[_0xa0fd('0x1b')],_0x4a865a[_0xa0fd('0x25')]['name'],_0x4a865a[_0xa0fd('0x23')]['id'],![],_0x536acf,_0x531aab['id']);if(rpc[_0x4a865a[_0xa0fd('0x20')]+_0xa0fd('0x28')]){return rpc[_0x4a865a[_0xa0fd('0x20')]+_0xa0fd('0x28')][_0xa0fd('0x2e')](_0x16a78a,_0x11257c)[_0xa0fd('0x2a')](function(_0x1c2175){logger[_0xa0fd('0x2b')]('update\x20queue\x20report');});}}}function endRouting(_0x29fd34,_0x56bed9,_0x1920aa,_0x3b2efa){if(_0x29fd34&&_0x56bed9){_0x56bed9[_0xa0fd('0x2c')]-=0x1;var _0x28c821={'leaveAt':moment()[_0xa0fd('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0xa0fd('0x1c')),'reason':_0xa0fd('0x2f')};logger[_0xa0fd('0x30')](util[_0xa0fd('0xf')](_0xa0fd('0x31'),_0x29fd34,_0x56bed9[_0xa0fd('0x27')]));emitChannelQueueInteraction(_0x1920aa['channel'],_0x56bed9[_0xa0fd('0x27')],_0x1920aa['body'],_0x1920aa[_0xa0fd('0x25')][_0xa0fd('0x27')],_0x1920aa[_0xa0fd('0x23')]['id'],![],_0x3b2efa);if(rpc[_0x1920aa[_0xa0fd('0x20')]+_0xa0fd('0x28')]){return rpc[_0x1920aa[_0xa0fd('0x20')]+_0xa0fd('0x28')][_0xa0fd('0x2e')](_0x29fd34,_0x28c821)[_0xa0fd('0x2a')](function(_0x201fee){logger[_0xa0fd('0x2b')](_0xa0fd('0x32'));});}}}function handleFindQueue(_0x489836){return function(_0x2ca8a0){return _0x2ca8a0[_0xa0fd('0x27')][_0xa0fd('0x33')]()===_0x489836[_0xa0fd('0x33')]();};}exports[_0xa0fd('0x34')]=function(_0xf674f5,_0x41d455,_0x5680f6,_0x264b05){return function(_0x121edc){try{var _0x3a6d16={'name':_0x41d455[0x0],'timeout':_0x41d455[0x1]};var _0x24df1b=queue[_0xa0fd('0x35')](_0x3a6d16,{'typecast':!![]});if(_0x24df1b[_0xa0fd('0x36')]){logger[_0xa0fd('0x2b')](_0xa0fd('0x37'),_0xf674f5,_['map'](_0x24df1b,_0xa0fd('0x23'))[_0xa0fd('0x38')](',\x20'));_0x121edc[_0xa0fd('0x39')]();}else{var _0x2ab5bf=_['find'](_0x5680f6[_0x264b05['channel']+_0xa0fd('0x3a')],handleFindQueue(_0x3a6d16[_0xa0fd('0x27')]));if(_0x2ab5bf){startRouting(_0xf674f5,_0x2ab5bf,_0x264b05,_0x5680f6);var _0x3db530=(_0x2ab5bf['timeout']||0xa)*0x3e8;var _0x381b0f=(_0x3a6d16[_0xa0fd('0x2f')]||0x14)*0x3e8;var _0x2f0312,_0x3308ae;if(_0x3db530>_0x381b0f){_0x381b0f=_0x3db530;}var _0xec83b6=seqqueue['createQueue'](_0x3db530);_0xec83b6['id']=_0xf674f5;_0xec83b6[_0xa0fd('0x3b')]=_0x3db530;_0xec83b6['qtimeout']=_0x381b0f;_0xec83b6[_0xa0fd('0x20')]=_0x264b05[_0xa0fd('0x20')];_0x5680f6[_0xa0fd('0x3c')][_0xf674f5]['on'](_0xa0fd('0x3d'),function(){logger['info'](_0xa0fd('0x3e'),_0xf674f5);stopRouting(_0xf674f5,_0x2ab5bf,_0x264b05,_0x5680f6);clearTimeout(_0x2f0312);_0x2f0312=undefined;_0xec83b6[_0xa0fd('0x3f')](!![]);if(_0x5680f6[_0xa0fd('0x3c')][_0xf674f5]){delete _0x5680f6[_0xa0fd('0x3c')][_0xf674f5];}_0x121edc[_0xa0fd('0x39')]();});_0x5680f6['rules'][_0xf674f5]['on'](_0xa0fd('0x40'),function(){if(_0x5680f6[_0xa0fd('0x3c')][_0xf674f5]){delete _0x5680f6[_0xa0fd('0x3c')][_0xf674f5];}});_0x2f0312=setTimeout(function(){logger['info'](_0xa0fd('0x41'),_0xf674f5);endRouting(_0xf674f5,_0x2ab5bf,_0x264b05,_0x5680f6);clearTimeout(_0x2f0312);_0xec83b6[_0xa0fd('0x3f')](!![]);_0x121edc[_0xa0fd('0x42')]();},_0x381b0f);switch(_0x2ab5bf[_0xa0fd('0x43')]){case _0xa0fd('0x44'):strategy[_0xa0fd('0x44')](_0xec83b6,_0x2ab5bf,_0x5680f6,_0x264b05);break;default:strategy[_0xa0fd('0x45')](_0xec83b6,_0x2ab5bf,_0x5680f6,_0x264b05);}}else{logger[_0xa0fd('0x2b')](_0xa0fd('0x46'),_0xf674f5,_0x3a6d16[_0xa0fd('0x27')]);_0x121edc[_0xa0fd('0x39')]();}}}catch(_0x291dce){console[_0xa0fd('0x47')](_0x291dce);logger['error'](_0xa0fd('0x37'),_0xf674f5,_0x291dce[_0xa0fd('0x48')]);_0x121edc['stop']();}};}; \ No newline at end of file +var _0xe206=['atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','log','stack','lodash','util','seq-queue','moment','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','queue_id','from','joinAt','emit','clone','account','pick','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','upperFirst','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','waiting','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue'];(function(_0x47cc74,_0x4598df){var _0xdfe813=function(_0x291ca6){while(--_0x291ca6){_0x47cc74['push'](_0x47cc74['shift']());}};_0xdfe813(++_0x4598df);}(_0xe206,0x101));var _0x6e20=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xe206[_0xc4001c];return _0x49f7bc;};'use strict';var schema=require('validate');var _=require(_0x6e20('0x0'));var util=require(_0x6e20('0x1'));var seqqueue=require(_0x6e20('0x2'));var moment=require(_0x6e20('0x3'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x6e20('0x4'))(_0x6e20('0x5'));var strategy=require('./strategy');config[_0x6e20('0x6')]=_[_0x6e20('0x7')](config['redis'],{'host':_0x6e20('0x8'),'port':0x18eb});var io=require(_0x6e20('0x9'))(new Redis(config[_0x6e20('0x6')]));var attributes=['id',_0x6e20('0xa'),'account','queue',_0x6e20('0xb'),_0x6e20('0xc')];function emit(_0x35dbf0,_0x520dd0,_0x17fb38){io['to'](_0x35dbf0)[_0x6e20('0xd')](_0x520dd0,_0x17fb38);}function emitChannelQueueInteraction(_0xd8a7a5,_0x164d66,_0x10d113,_0x2827c6,_0x3f539e,_0x1cd9ba,_0x1cadd6,_0x56bf99){var _0x368057=_[_0x6e20('0xe')](_0x10d113);_0x368057[_0x6e20('0xa')]=_0x56bf99;_0x368057['queue']=_0x164d66;_0x368057[_0x6e20('0xf')]=_0x2827c6;_0x368057['id']=_0x3f539e;if(_0x1cd9ba){_0x1cadd6[util['format']('%sQueuesWaitingInteractions',_0xd8a7a5)][_0x3f539e]=_[_0x6e20('0x10')](_0x368057,attributes);}else{delete _0x1cadd6[util[_0x6e20('0x11')](_0x6e20('0x12'),_0xd8a7a5)][_0x3f539e];}emit(util[_0x6e20('0x11')](_0x6e20('0x13'),_0xd8a7a5,_0x164d66),util['format'](_0x6e20('0x14'),_0xd8a7a5,_0x1cd9ba?'save':_0x6e20('0x15')),_[_0x6e20('0x10')](_0x368057,attributes));}var rpc={'openchannelQueueReport':require(_0x6e20('0x16')),'mailQueueReport':require(_0x6e20('0x17')),'chatQueueReport':require(_0x6e20('0x18')),'smsQueueReport':require(_0x6e20('0x19')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x6e20('0x1a'))};var queue=schema({'name':{'type':_0x6e20('0x1b'),'required':!![],'message':_0x6e20('0x1c')},'timeout':{'type':'number','message':_0x6e20('0x1d')}});function startRouting(_0x132658,_0x2dd657,_0x54b22f,_0x384ff6){if(_0x132658&&_0x2dd657&&_0x54b22f){_0x2dd657['waiting']+=0x1;var _0x191016={'uniqueid':_0x132658,'from':_0x54b22f[_0x6e20('0x1e')]?_0x54b22f['body'][_0x6e20('0xb')]:'','joinAt':moment()['format'](_0x6e20('0x1f')),'ContactId':_0x54b22f['contact']?_0x54b22f[_0x6e20('0x20')]['id']:null,'ListId':_0x54b22f[_0x6e20('0x21')]?_0x54b22f['list']['id']:null};_0x191016[_['upperFirst'](_0x54b22f[_0x6e20('0x22')])+'QueueId']=_0x2dd657['id']||null;_0x191016[_[_0x6e20('0x23')](_0x54b22f[_0x6e20('0x22')])+_0x6e20('0x24')]=_0x54b22f[_0x6e20('0x25')]?_0x54b22f[_0x6e20('0x25')]['id']:null;_0x191016[_[_0x6e20('0x23')](_0x54b22f[_0x6e20('0x22')])+_0x6e20('0x26')]=_0x54b22f['message']?_0x54b22f[_0x6e20('0x27')]['id']:null;_0x191016[_[_0x6e20('0x23')](_0x54b22f[_0x6e20('0x22')])+(_0x54b22f[_0x6e20('0x22')]!==_0x6e20('0x28')?_0x6e20('0x29'):_0x6e20('0x2a'))]=_0x54b22f[_0x6e20('0xf')]?_0x54b22f[_0x6e20('0xf')]['id']:null;logger[_0x6e20('0x2b')](util[_0x6e20('0x11')](_0x6e20('0x2c'),_0x132658,_0x2dd657[_0x6e20('0x2d')]));emitChannelQueueInteraction(_0x54b22f[_0x6e20('0x22')],_0x2dd657[_0x6e20('0x2d')],_0x191016,_0x54b22f[_0x6e20('0xf')]['name'],_0x54b22f[_0x6e20('0x27')]['id'],!![],_0x384ff6,_0x2dd657['id']);if(rpc[_0x54b22f[_0x6e20('0x22')]+_0x6e20('0x2e')]){return rpc[_0x54b22f[_0x6e20('0x22')]+_0x6e20('0x2e')]['create'](_0x191016)[_0x6e20('0x2f')](function(_0x27b11a){logger[_0x6e20('0x30')](_0x6e20('0x31'));});}}}function stopRouting(_0x531787,_0x5e99ef,_0x591f1f,_0x49af5f){if(_0x531787&&_0x5e99ef){_0x5e99ef['waiting']-=0x1;var _0x19d4ca={'leaveAt':moment()[_0x6e20('0x11')](_0x6e20('0x1f')),'acceptAt':moment()[_0x6e20('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x6e20('0x32')};logger[_0x6e20('0x2b')](util[_0x6e20('0x11')](_0x6e20('0x33'),_0x531787,_0x5e99ef['name']));emitChannelQueueInteraction(_0x591f1f['channel'],_0x5e99ef['name'],_0x591f1f[_0x6e20('0x1e')],_0x591f1f['account'][_0x6e20('0x2d')],_0x591f1f[_0x6e20('0x27')]['id'],![],_0x49af5f,_0x5e99ef['id']);if(rpc[_0x591f1f[_0x6e20('0x22')]+_0x6e20('0x2e')]){return rpc[_0x591f1f[_0x6e20('0x22')]+_0x6e20('0x2e')][_0x6e20('0x34')](_0x531787,_0x19d4ca)[_0x6e20('0x2f')](function(_0x4095f6){logger[_0x6e20('0x30')]('update\x20queue\x20report');});}}}function endRouting(_0x51ab7f,_0x422cca,_0x3a7f1f,_0x1b710b){if(_0x51ab7f&&_0x422cca){_0x422cca[_0x6e20('0x35')]-=0x1;var _0x55450a={'leaveAt':moment()[_0x6e20('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x6e20('0x11')](_0x6e20('0x1f')),'reason':_0x6e20('0x36')};logger[_0x6e20('0x2b')](util['format'](_0x6e20('0x37'),_0x51ab7f,_0x422cca[_0x6e20('0x2d')]));emitChannelQueueInteraction(_0x3a7f1f[_0x6e20('0x22')],_0x422cca[_0x6e20('0x2d')],_0x3a7f1f['body'],_0x3a7f1f[_0x6e20('0xf')][_0x6e20('0x2d')],_0x3a7f1f['message']['id'],![],_0x1b710b);if(rpc[_0x3a7f1f[_0x6e20('0x22')]+_0x6e20('0x2e')]){return rpc[_0x3a7f1f[_0x6e20('0x22')]+_0x6e20('0x2e')][_0x6e20('0x34')](_0x51ab7f,_0x55450a)['catch'](function(_0x168b4b){logger[_0x6e20('0x30')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x3dad56){return function(_0x4dcc27){return _0x4dcc27[_0x6e20('0x2d')][_0x6e20('0x38')]()===_0x3dad56[_0x6e20('0x38')]();};}exports[_0x6e20('0x39')]=function(_0x45bd6c,_0x5c8972,_0x19a252,_0x190d15){return function(_0x3c1109){try{var _0x5502f3={'name':_0x5c8972[0x0],'timeout':_0x5c8972[0x1]};var _0x5e3752=queue[_0x6e20('0x3a')](_0x5502f3,{'typecast':!![]});if(_0x5e3752[_0x6e20('0x3b')]){logger[_0x6e20('0x30')](_0x6e20('0x3c'),_0x45bd6c,_[_0x6e20('0x3d')](_0x5e3752,_0x6e20('0x27'))[_0x6e20('0x3e')](',\x20'));_0x3c1109[_0x6e20('0x3f')]();}else{var _0x43a1ec=_[_0x6e20('0x40')](_0x19a252[_0x190d15[_0x6e20('0x22')]+_0x6e20('0x41')],handleFindQueue(_0x5502f3[_0x6e20('0x2d')]));if(_0x43a1ec){startRouting(_0x45bd6c,_0x43a1ec,_0x190d15,_0x19a252);var _0x5e9cf2=(_0x43a1ec['timeout']||0xa)*0x3e8;var _0x57aaca=(_0x5502f3[_0x6e20('0x36')]||0x14)*0x3e8;var _0x178cca,_0x48f831;if(_0x5e9cf2>_0x57aaca){_0x57aaca=_0x5e9cf2;}var _0x23101e=seqqueue[_0x6e20('0x42')](_0x5e9cf2);_0x23101e['id']=_0x45bd6c;_0x23101e[_0x6e20('0x43')]=_0x5e9cf2;_0x23101e[_0x6e20('0x44')]=_0x57aaca;_0x23101e[_0x6e20('0x22')]=_0x190d15[_0x6e20('0x22')];_0x19a252['rules'][_0x45bd6c]['on'](_0x6e20('0x45'),function(){logger[_0x6e20('0x2b')](_0x6e20('0x46'),_0x45bd6c);stopRouting(_0x45bd6c,_0x43a1ec,_0x190d15,_0x19a252);clearTimeout(_0x178cca);_0x178cca=undefined;_0x23101e[_0x6e20('0x47')](!![]);if(_0x19a252[_0x6e20('0x48')][_0x45bd6c]){delete _0x19a252[_0x6e20('0x48')][_0x45bd6c];}_0x3c1109[_0x6e20('0x3f')]();});_0x19a252[_0x6e20('0x48')][_0x45bd6c]['on'](_0x6e20('0x49'),function(){if(_0x19a252[_0x6e20('0x48')][_0x45bd6c]){delete _0x19a252['rules'][_0x45bd6c];}});_0x178cca=setTimeout(function(){logger[_0x6e20('0x2b')](_0x6e20('0x4a'),_0x45bd6c);endRouting(_0x45bd6c,_0x43a1ec,_0x190d15,_0x19a252);clearTimeout(_0x178cca);_0x23101e[_0x6e20('0x47')](!![]);_0x3c1109[_0x6e20('0x4b')]();},_0x57aaca);switch(_0x43a1ec[_0x6e20('0x4c')]){case _0x6e20('0x4d'):strategy[_0x6e20('0x4d')](_0x23101e,_0x43a1ec,_0x19a252,_0x190d15);break;default:strategy[_0x6e20('0x4e')](_0x23101e,_0x43a1ec,_0x19a252,_0x190d15);}}else{logger[_0x6e20('0x30')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x45bd6c,_0x5502f3[_0x6e20('0x2d')]);_0x3c1109['stop']();}}}catch(_0x130548){console[_0x6e20('0x4f')](_0x130548);logger[_0x6e20('0x30')](_0x6e20('0x3c'),_0x45bd6c,_0x130548[_0x6e20('0x50')]);_0x3c1109[_0x6e20('0x3f')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index aa9c79c..54b9e80 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 _0x4075=['hideNotification','STOP','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','handleTimeout','bind','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','agents','forcedOwnership','isAgentAvailable','channel','busy','showNotification','writeLog','RINGING',':FORCED','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s'];(function(_0x4dc67f,_0x5bd594){var _0x881dbf=function(_0x8b5bf9){while(--_0x8b5bf9){_0x4dc67f['push'](_0x4dc67f['shift']());}};_0x881dbf(++_0x5bd594);}(_0x4075,0x10a));var _0x5407=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x4075[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0x5407('0x0'));var uuid=require(_0x5407('0x1'));var util=require(_0x5407('0x2'));var logger=require(_0x5407('0x3'))(_0x5407('0x4'));var Agent=function(_0x596cba,_0x360e94,_0x1112e1,_0x3c297a){this[_0x5407('0x5')]=uuid['v4']();this[_0x5407('0x6')]=_0x596cba;this[_0x5407('0x7')]=_0x360e94;this[_0x5407('0x8')]=_0x1112e1;this[_0x5407('0x4')]=_0x3c297a;this[_0x5407('0x6')][_0x5407('0x9')](this[_0x5407('0xa')]['bind'](this),this[_0x5407('0xb')][_0x5407('0xc')](this));this['squeue']['on'](_0x5407('0xd'),this['handleTimeout'][_0x5407('0xc')](this));this[_0x5407('0x6')]['on'](_0x5407('0xe'),this[_0x5407('0xf')][_0x5407('0xc')](this));};Agent['prototype'][_0x5407('0x9')]=function(){this[_0x5407('0x6')][_0x5407('0x9')](this[_0x5407('0xa')]['bind'](this),this[_0x5407('0xb')]['bind'](this));};Agent[_0x5407('0x10')][_0x5407('0xf')]=function(){this['handleTimeout'](!![]);};Agent[_0x5407('0x10')][_0x5407('0xa')]=function(_0x40f193){logger[_0x5407('0x11')](_0x5407('0x12'),this['squeue']['id'],this[_0x5407('0x7')]['id']);if(_['isNil'](this[_0x5407('0x8')][_0x5407('0x13')][this[_0x5407('0x7')]['id']])){logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x5407('0x7')]['id']);setTimeout(this[_0x5407('0x9')][_0x5407('0xc')](this),0x3e8);}else{if(this[_0x5407('0x4')][_0x5407('0x14')]||util[_0x5407('0x15')](this[_0x5407('0x6')]['id'],this[_0x5407('0x8')][_0x5407('0x13')][this['agent']['id']],this[_0x5407('0x6')][_0x5407('0x16')],![])){this[_0x5407('0x8')]['agents'][this[_0x5407('0x7')]['id']][_0x5407('0x17')]=!![];this[_0x5407('0x8')][_0x5407('0x13')][this['agent']['id']]['busyQueue']=undefined;util[_0x5407('0x18')](this[_0x5407('0x5')],this[_0x5407('0x6')]['id'],this[_0x5407('0x8')][_0x5407('0x13')][this['agent']['id']],null,this[_0x5407('0x4')]);util[_0x5407('0x19')](this['squeue']['id'],this['realtime'][_0x5407('0x13')][this[_0x5407('0x7')]['id']],_0x5407('0x1a')+(this[_0x5407('0x4')][_0x5407('0x14')]?_0x5407('0x1b'):''));}else{logger[_0x5407('0x11')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x5407('0x6')]['id'],this[_0x5407('0x7')]['id']);setTimeout(this[_0x5407('0x9')][_0x5407('0xc')](this),0x3e8);}}};Agent[_0x5407('0x10')]['handleTimeout']=function(_0x2f1946){if(_[_0x5407('0x1c')](this[_0x5407('0x8')][_0x5407('0x13')][this[_0x5407('0x7')]['id']])){return logger[_0x5407('0x11')](_0x5407('0x1d'),this[_0x5407('0x6')]['id'],this[_0x5407('0x7')]['id']);}else{logger[_0x5407('0x11')](_0x5407('0x1e'),this[_0x5407('0x6')]['id'],this[_0x5407('0x7')]['id']);util[_0x5407('0x1f')](this[_0x5407('0x5')],this['squeue']['id'],this['realtime'][_0x5407('0x13')][this[_0x5407('0x7')]['id']],null,this[_0x5407('0x4')]);this['realtime'][_0x5407('0x13')][this[_0x5407('0x7')]['id']][_0x5407('0x17')]=![];this['realtime'][_0x5407('0x13')][this['agent']['id']]['busyQueue']=undefined;util[_0x5407('0x19')](this[_0x5407('0x6')]['id'],this[_0x5407('0x8')][_0x5407('0x13')][this['agent']['id']],_0x2f1946?_0x5407('0x20'):'TIMEOUT');}if(!_0x2f1946){setTimeout(this['push'][_0x5407('0xc')](this),0x3e8);}};function agent(_0x415eb3,_0x48ff59,_0x4d1f04,_0x25d426){return new Agent(_0x415eb3,_0x48ff59,_0x4d1f04,_0x25d426);}module['exports']=agent; \ No newline at end of file +var _0xf6bc=['exports','lodash','./util','routing','notificationId','agent','realtime','push','bind','handleTimeout','squeue','timeout','handleDrained','prototype','handleRun','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','info','forcedOwnership','isAgentAvailable','channel','busyQueue','writeLog','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','STOP'];(function(_0x1f0988,_0x299c68){var _0x3caf61=function(_0x454981){while(--_0x454981){_0x1f0988['push'](_0x1f0988['shift']());}};_0x3caf61(++_0x299c68);}(_0xf6bc,0x106));var _0xcf6b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf6bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcf6b('0x0'));var uuid=require('uuid');var util=require(_0xcf6b('0x1'));var logger=require('../../../../../config/logger')(_0xcf6b('0x2'));var Agent=function(_0x2bdfe1,_0x470401,_0x1a45d6,_0x787fbb){this[_0xcf6b('0x3')]=uuid['v4']();this['squeue']=_0x2bdfe1;this[_0xcf6b('0x4')]=_0x470401;this[_0xcf6b('0x5')]=_0x1a45d6;this[_0xcf6b('0x2')]=_0x787fbb;this['squeue'][_0xcf6b('0x6')](this['handleRun'][_0xcf6b('0x7')](this),this[_0xcf6b('0x8')][_0xcf6b('0x7')](this));this[_0xcf6b('0x9')]['on'](_0xcf6b('0xa'),this[_0xcf6b('0x8')][_0xcf6b('0x7')](this));this['squeue']['on']('drained',this[_0xcf6b('0xb')][_0xcf6b('0x7')](this));};Agent[_0xcf6b('0xc')][_0xcf6b('0x6')]=function(){this[_0xcf6b('0x9')][_0xcf6b('0x6')](this[_0xcf6b('0xd')][_0xcf6b('0x7')](this),this['handleTimeout'][_0xcf6b('0x7')](this));};Agent['prototype']['handleDrained']=function(){this[_0xcf6b('0x8')](!![]);};Agent[_0xcf6b('0xc')]['handleRun']=function(_0x5423c7){logger['info'](_0xcf6b('0xe'),this[_0xcf6b('0x9')]['id'],this[_0xcf6b('0x4')]['id']);if(_[_0xcf6b('0xf')](this[_0xcf6b('0x5')][_0xcf6b('0x10')][this['agent']['id']])){logger[_0xcf6b('0x11')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xcf6b('0x9')]['id'],this['agent']['id']);setTimeout(this[_0xcf6b('0x6')]['bind'](this),0x3e8);}else{if(this[_0xcf6b('0x2')][_0xcf6b('0x12')]||util[_0xcf6b('0x13')](this[_0xcf6b('0x9')]['id'],this[_0xcf6b('0x5')][_0xcf6b('0x10')][this['agent']['id']],this[_0xcf6b('0x9')][_0xcf6b('0x14')],![])){this['realtime']['agents'][this[_0xcf6b('0x4')]['id']]['busy']=!![];this['realtime']['agents'][this[_0xcf6b('0x4')]['id']][_0xcf6b('0x15')]=undefined;util['showNotification'](this[_0xcf6b('0x3')],this['squeue']['id'],this['realtime'][_0xcf6b('0x10')][this[_0xcf6b('0x4')]['id']],null,this['routing']);util[_0xcf6b('0x16')](this[_0xcf6b('0x9')]['id'],this[_0xcf6b('0x5')][_0xcf6b('0x10')][this[_0xcf6b('0x4')]['id']],'RINGING'+(this[_0xcf6b('0x2')]['forcedOwnership']?':FORCED':''));}else{logger[_0xcf6b('0x11')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0xcf6b('0x9')]['id'],this[_0xcf6b('0x4')]['id']);setTimeout(this[_0xcf6b('0x6')][_0xcf6b('0x7')](this),0x3e8);}}};Agent[_0xcf6b('0xc')][_0xcf6b('0x8')]=function(_0x638e47){if(_[_0xcf6b('0xf')](this[_0xcf6b('0x5')][_0xcf6b('0x10')][this[_0xcf6b('0x4')]['id']])){return logger['info'](_0xcf6b('0x17'),this[_0xcf6b('0x9')]['id'],this[_0xcf6b('0x4')]['id']);}else{logger['info'](_0xcf6b('0x18'),this['squeue']['id'],this[_0xcf6b('0x4')]['id']);util[_0xcf6b('0x19')](this[_0xcf6b('0x3')],this[_0xcf6b('0x9')]['id'],this['realtime'][_0xcf6b('0x10')][this[_0xcf6b('0x4')]['id']],null,this[_0xcf6b('0x2')]);this[_0xcf6b('0x5')]['agents'][this[_0xcf6b('0x4')]['id']][_0xcf6b('0x1a')]=![];this[_0xcf6b('0x5')][_0xcf6b('0x10')][this[_0xcf6b('0x4')]['id']][_0xcf6b('0x15')]=undefined;util['writeLog'](this['squeue']['id'],this[_0xcf6b('0x5')]['agents'][this[_0xcf6b('0x4')]['id']],_0x638e47?_0xcf6b('0x1b'):'TIMEOUT');}if(!_0x638e47){setTimeout(this[_0xcf6b('0x6')][_0xcf6b('0x7')](this),0x3e8);}};function agent(_0x471274,_0x2de3df,_0x507774,_0x481537){return new Agent(_0x471274,_0x2de3df,_0x507774,_0x481537);}module[_0xcf6b('0x1c')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 920b0b6..9e58269 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 _0x89c3=['RINGING','busy','busyQueue','name','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','queue','squeue','bind','handleTimeout','timeout','drained','prototype','push','handleRun','isNil','Agents','length','realtime','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x89c3,0xff));var _0x389c=function(_0x596470,_0x18c06c){_0x596470=_0x596470-0x0;var _0x16ff77=_0x89c3[_0x596470];return _0x16ff77;};'use strict';var _=require(_0x389c('0x0'));var uuid=require(_0x389c('0x1'));var util=require(_0x389c('0x2'));var logger=require(_0x389c('0x3'))(_0x389c('0x4'));var Beepall=function(_0x14c809,_0xab285b,_0x3a2fa4,_0x5c6c68){this[_0x389c('0x5')]=uuid['v4']();this['squeue']=_0x14c809;this[_0x389c('0x6')]=_0xab285b;this['realtime']=_0x3a2fa4;this['routing']=_0x5c6c68;this[_0x389c('0x7')]['push'](this['handleRun'][_0x389c('0x8')](this),this[_0x389c('0x9')][_0x389c('0x8')](this));this[_0x389c('0x7')]['on'](_0x389c('0xa'),this[_0x389c('0x9')][_0x389c('0x8')](this));this[_0x389c('0x7')]['on'](_0x389c('0xb'),this['handleDrained'][_0x389c('0x8')](this));};Beepall[_0x389c('0xc')][_0x389c('0xd')]=function(){this[_0x389c('0x7')][_0x389c('0xd')](this['handleRun']['bind'](this),this[_0x389c('0x9')][_0x389c('0x8')](this));};Beepall[_0x389c('0xc')]['handleDrained']=function(_0x3f2391){this['handleTimeout'](!![]);};Beepall[_0x389c('0xc')][_0x389c('0xe')]=function(_0x4d5de3){var _0x1687f2=!![];if(!_[_0x389c('0xf')](this[_0x389c('0x6')])&&!_['isNil'](this[_0x389c('0x6')][_0x389c('0x10')])&&this[_0x389c('0x6')][_0x389c('0x10')][_0x389c('0x11')]>0x0){for(var _0x555481=0x0,_0x5b6ef8;_0x5554810x0){for(var _0x2e053d=0x0,_0x4f2f44;_0x2e053d0x0&&_0x37465e[_0x2e633e+'CurrentCapacity']>=_0x37465e[_0x2e633e+_0x190b('0x21')]){writeLog(_0x4c0b6e,_0x37465e,_0x2e633e[_0x190b('0x22')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x190b('0x23')]=function(_0x1deea6,_0x5c89ab,_0xa9d6f7,_0x2c47ae,_0x359b4a){return sendNotification(!![],_0x1deea6,_0x5c89ab,_0xa9d6f7,_0x2c47ae,_0x359b4a);};exports['hideNotification']=function(_0x536d7b,_0x3730cc,_0x4d5f3f,_0x14be2c,_0x19e421){return sendNotification(![],_0x536d7b,_0x3730cc,_0x4d5f3f,_0x14be2c,_0x19e421);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x3f8a=['Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','showNotification','hideNotification','writeLog','lodash','util','../utils','mustache','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','emit','format','user:%s','name','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','message','save','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE'];(function(_0x5680d9,_0x35e00a){var _0x35fcf4=function(_0x513f4d){while(--_0x513f4d){_0x5680d9['push'](_0x5680d9['shift']());}};_0x35fcf4(++_0x35e00a);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x271060,_0x3f86b1){_0x271060=_0x271060-0x0;var _0x40540b=_0x3f8a[_0x271060];return _0x40540b;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var utils=require(_0xa3f8('0x2'));var Mustache=require(_0xa3f8('0x3'));var Redis=require('ioredis');var config=require(_0xa3f8('0x4'));var logger=require(_0xa3f8('0x5'))(_0xa3f8('0x6'));config[_0xa3f8('0x7')]=_[_0xa3f8('0x8')](config[_0xa3f8('0x7')],{'host':_0xa3f8('0x9'),'port':0x18eb});var io=require(_0xa3f8('0xa'))(new Redis(config[_0xa3f8('0x7')]));function emit(_0xf895d9,_0xcfea5,_0x268332){io['to'](_0xf895d9)[_0xa3f8('0xb')](_0xcfea5,_0x268332);}function sendNotification(_0x2448de,_0x2c89bb,_0x350935,_0xcdb0d4,_0x5c3288,_0x47496a){io['to'](util[_0xa3f8('0xc')](_0xa3f8('0xd'),_0xcdb0d4[_0xa3f8('0xe')]))['emit'](_0xa3f8('0xf'),_0xcdb0d4);var _0x26f0a0=_0x47496a||{};var _0x414bd7=_0x350935[_0xa3f8('0x10')]('.');var _0xd97ac9={'uniqueid':_0x2c89bb,'channel':_0x414bd7[0x0],'id':_0x414bd7[0x1],'title':_0x414bd7[0x0]+_0xa3f8('0x11'),'interactionId':_0x414bd7[0x2],'queue':_0x5c3288?_0x5c3288[_0xa3f8('0xe')]:null,'sound':_0x26f0a0[_0xa3f8('0x12')][_0xa3f8('0x13')],'shake':_0x26f0a0[_0xa3f8('0x12')][_0xa3f8('0x14')]};try{if(!_0x26f0a0[_0xa3f8('0x15')]){_0x26f0a0['body']={};}if(_0x5c3288){_0x26f0a0[_0xa3f8('0x15')][_0xa3f8('0x16')]=_0x5c3288;}else if(_0x26f0a0[_0xa3f8('0x15')][_0xa3f8('0x16')]){delete _0x26f0a0['body'][_0xa3f8('0x16')];}_0xd97ac9[_0xa3f8('0x17')]=utils[_0xa3f8('0x18')](_0x26f0a0[_0xa3f8('0x12')][_0xa3f8('0x19')],_0x26f0a0);}catch(_0x259efe){_0xd97ac9[_0xa3f8('0x17')]=_0xa3f8('0x1a');logger[_0xa3f8('0x1b')](util[_0xa3f8('0xc')]('[%s][QUEUE]\x20%s',_0x2c89bb,_0x259efe[_0xa3f8('0x1c')]));}io['to'](util['format'](_0xa3f8('0xd'),_0xcdb0d4[_0xa3f8('0xe')]))[_0xa3f8('0xb')](util[_0xa3f8('0xc')]('notification:%s',_0x2448de?_0xa3f8('0x1d'):'remove'),_0xd97ac9);}function writeLog(_0x43c393,_0x58336d,_0x4066bb){return logger[_0xa3f8('0x1e')](util[_0xa3f8('0xc')](_0xa3f8('0x1f'),_0x43c393,_0x58336d[_0xa3f8('0xe')],_0x4066bb));}exports[_0xa3f8('0x20')]=function(_0x187352,_0x490717,_0xae76ec,_0x4d0e72){if(_0x490717[_0xa3f8('0x21')]){writeLog(_0x187352,_0x490717,_0xa3f8('0x22'));return![];}if(!_0x490717[_0xa3f8('0x23')]){writeLog(_0x187352,_0x490717,_0xa3f8('0x24'));return![];}if(_0x490717[_0xae76ec+_0xa3f8('0x25')]){writeLog(_0x187352,_0x490717,_0xa3f8('0x26'));return![];}if(_0x4d0e72&&_0x490717[_0xa3f8('0x27')](_0xae76ec+_0xa3f8('0x28'))&&_0x490717[_0xa3f8('0x27')](_0xae76ec+_0xa3f8('0x29'))){if(_0x490717[_0xae76ec+'Capacity']>0x0&&_0x490717[_0xae76ec+_0xa3f8('0x29')]>=_0x490717[_0xae76ec+_0xa3f8('0x28')]){writeLog(_0x187352,_0x490717,_0xae76ec[_0xa3f8('0x2a')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xa3f8('0x2b')]=function(_0x57f6be,_0xbad6a6,_0x3a3746,_0x3c1128,_0x4ea213){return sendNotification(!![],_0x57f6be,_0xbad6a6,_0x3a3746,_0x3c1128,_0x4ea213);};exports[_0xa3f8('0x2c')]=function(_0x5e69e2,_0x21c57e,_0x4281ea,_0x226153,_0x406140){return sendNotification(![],_0x5e69e2,_0x21c57e,_0x4281ea,_0x226153,_0x406140);};exports[_0xa3f8('0x2d')]=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 fe774f1..4607eca 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 _0x2f42=['validate','shelljs','lodash','../../../../config/logger','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','isObject','stringify'];(function(_0x15ffd5,_0x1bf5de){var _0x170afa=function(_0x31916a){while(--_0x31916a){_0x15ffd5['push'](_0x15ffd5['shift']());}};_0x170afa(++_0x1bf5de);}(_0x2f42,0x90));var _0x22f4=function(_0x3f7f7d,_0x46069a){_0x3f7f7d=_0x3f7f7d-0x0;var _0x4a9038=_0x2f42[_0x3f7f7d];return _0x4a9038;};'use strict';var schema=require(_0x22f4('0x0'));var sh=require(_0x22f4('0x1'));var _=require(_0x22f4('0x2'));var utils=require('./utils');var logger=require(_0x22f4('0x3'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0x22f4('0x4')}});exports['consequence']=function(_0x3e9104,_0x458a9e){return function(_0x310bca){try{var _0x386042={'command':_0x458a9e[0x0]};var _0x1a9596=system[_0x22f4('0x0')](_0x386042,{'typecast':!![]});if(_0x1a9596[_0x22f4('0x5')]){logger[_0x22f4('0x6')](_0x22f4('0x7'),_0x3e9104,_['map'](_0x1a9596,_0x22f4('0x8'))[_0x22f4('0x9')](',\x20'));logger[_0x22f4('0xa')](_0x22f4('0xb'),_0x3e9104);_0x310bca[_0x22f4('0xc')]();}else{var _0x2f018b=this;var _0x4d948d=utils['getMustacheRender'](_0x458a9e[0x0],this);logger['info'](_0x22f4('0xd'),_0x3e9104,_0x4d948d);sh[_0x22f4('0xe')](_[_0x22f4('0xf')](_0x4d948d),function(_0x2df409,_0x5a6972){logger[_0x22f4('0xa')](_0x22f4('0x10'),_0x3e9104,_0x2df409);if(_0x2df409==0x0){var _0x3d97c8=_0x5a6972[_0x22f4('0x11')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x458a9e[0x1])||_[_0x22f4('0x12')](_0x458a9e[0x1])){logger[_0x22f4('0xa')](_0x22f4('0x13'),_0x3e9104);_0x2f018b['body'][_0x458a9e[0x1]]=_0x3d97c8;}else{logger[_0x22f4('0xa')](_0x22f4('0x14'),_0x3e9104,_0x458a9e[0x1],_0x3d97c8);_0x2f018b[_0x22f4('0x15')][_0x458a9e[0x1]]=_0x3d97c8;}}_0x310bca[_0x22f4('0xc')]();});}}catch(_0x1b7ddd){logger[_0x22f4('0x6')](_0x22f4('0x7'),_0x3e9104,_[_0x22f4('0x16')](_0x1b7ddd)?JSON[_0x22f4('0x17')](_0x1b7ddd):_0x1b7ddd);logger['info'](_0x22f4('0xb'),_0x3e9104);_0x310bca['next']();}};}; \ No newline at end of file +var _0x3280=['map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','next','isObject','stringify','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][SYSTEM]\x20%s'];(function(_0xba9ce3,_0xe1816d){var _0x580c36=function(_0x2140c9){while(--_0x2140c9){_0xba9ce3['push'](_0xba9ce3['shift']());}};_0x580c36(++_0xe1816d);}(_0x3280,0x17a));var _0x0328=function(_0x3ddc2e,_0xbe589f){_0x3ddc2e=_0x3ddc2e-0x0;var _0x5ab513=_0x3280[_0x3ddc2e];return _0x5ab513;};'use strict';var schema=require('validate');var sh=require(_0x0328('0x0'));var _=require(_0x0328('0x1'));var utils=require(_0x0328('0x2'));var logger=require(_0x0328('0x3'))(_0x0328('0x4'));var system=schema({'command':{'type':_0x0328('0x5'),'required':!![],'message':_0x0328('0x6')}});exports[_0x0328('0x7')]=function(_0x557b66,_0x46c439){return function(_0x1e66ed){try{var _0x47701f={'command':_0x46c439[0x0]};var _0x1cca1b=system[_0x0328('0x8')](_0x47701f,{'typecast':!![]});if(_0x1cca1b[_0x0328('0x9')]){logger[_0x0328('0xa')](_0x0328('0xb'),_0x557b66,_[_0x0328('0xc')](_0x1cca1b,_0x0328('0xd'))['join'](',\x20'));logger[_0x0328('0xe')](_0x0328('0xf'),_0x557b66);_0x1e66ed['next']();}else{var _0x3ec825=this;var _0xc8bfd9=utils['getMustacheRender'](_0x46c439[0x0],this);logger[_0x0328('0xe')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x557b66,_0xc8bfd9);sh['exec'](_[_0x0328('0x10')](_0xc8bfd9),function(_0x541554,_0x430a57){logger['info'](_0x0328('0x11'),_0x557b66,_0x541554);if(_0x541554==0x0){var _0x33c259=_0x430a57[_0x0328('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x0328('0x13')](_0x46c439[0x1])||_[_0x0328('0x14')](_0x46c439[0x1])){logger['info'](_0x0328('0x15'),_0x557b66);_0x3ec825[_0x0328('0x16')][_0x46c439[0x1]]=_0x33c259;}else{logger[_0x0328('0xe')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x557b66,_0x46c439[0x1],_0x33c259);_0x3ec825[_0x0328('0x16')][_0x46c439[0x1]]=_0x33c259;}}_0x1e66ed[_0x0328('0x17')]();});}}catch(_0x31f8e7){logger[_0x0328('0xa')](_0x0328('0xb'),_0x557b66,_[_0x0328('0x18')](_0x31f8e7)?JSON[_0x0328('0x19')](_0x31f8e7):_0x31f8e7);logger[_0x0328('0xe')](_0x0328('0xf'),_0x557b66);_0x1e66ed[_0x0328('0x17')]();}};}; \ 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 656dfdb..b0f40cf 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 _0x6821=['../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','[%s][TAG]\x20%s','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','validate','../../rpc/chatInteraction'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x6821,0xda));var _0x1682=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x6821[_0x38537f];return _0x141e23;};'use strict';var schema=require(_0x1682('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x1682('0x1')),'openchannelInteraction':require(_0x1682('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x1682('0x3')),'whatsappInteraction':require(_0x1682('0x4'))};var logger=require(_0x1682('0x5'))(_0x1682('0x6'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x1682('0x7')}});exports['consequence']=function(_0x96ffe,_0x49b960,_0x5a1bbd,_0x24ac32){return function(_0x3cec26){try{var _0x21d553={'tag':_0x49b960[0x0]};var _0x369196=tag[_0x1682('0x0')](_0x21d553,{'typecast':!![]});if(_0x369196['length']){logger[_0x1682('0x8')](_0x1682('0x9'),_0x96ffe,_['map'](_0x369196,'message')[_0x1682('0xa')](',\x20'));logger[_0x1682('0xb')](_0x1682('0xc'),_0x96ffe);_0x3cec26[_0x1682('0xd')]();}else{var _0x191d22={'ids':[_0x49b960[0x0]]};if(rpc[_0x24ac32[_0x1682('0xe')]+_0x1682('0xf')]){rpc[_0x24ac32['channel']+_0x1682('0xf')]['addTags'](_0x24ac32[_0x1682('0x10')]['id'],_0x191d22)[_0x1682('0x11')](function(_0x4fa2c7){logger['info'](_0x1682('0x12'),_0x96ffe,_0x49b960[0x1],_0x24ac32[_0x1682('0xe')],_0x24ac32[_0x1682('0x10')]['id']);})[_0x1682('0x13')](function(_0x1272bb){logger['error'](_0x1682('0x9'),_0x96ffe,JSON[_0x1682('0x14')](_0x1272bb));logger[_0x1682('0xb')](_0x1682('0xc'),_0x96ffe);})[_0x1682('0x15')](function(){_0x3cec26['next']();});}}}catch(_0x11e43b){logger[_0x1682('0x8')]('[%s][TAG]\x20%s',_0x96ffe,_['isObject'](_0x11e43b)?JSON['stringify'](_0x11e43b):_0x11e43b);logger[_0x1682('0xb')](_0x1682('0xc'),_0x96ffe);_0x3cec26[_0x1682('0xd')]();}};}; \ No newline at end of file +var _0x9e60=['lodash','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','[%s][TAG]\x20%s','finally','stringify','next','validate'];(function(_0x2e9e7a,_0x5b939a){var _0x1608b0=function(_0x2295b8){while(--_0x2295b8){_0x2e9e7a['push'](_0x2e9e7a['shift']());}};_0x1608b0(++_0x5b939a);}(_0x9e60,0x179));var _0x09e6=function(_0x30a9a7,_0x4e8b26){_0x30a9a7=_0x30a9a7-0x0;var _0x253ca6=_0x9e60[_0x30a9a7];return _0x253ca6;};'use strict';var schema=require(_0x09e6('0x0'));var _=require(_0x09e6('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x09e6('0x2')),'mailInteraction':require(_0x09e6('0x3')),'faxInteraction':require(_0x09e6('0x4')),'whatsappInteraction':require(_0x09e6('0x5'))};var logger=require(_0x09e6('0x6'))(_0x09e6('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x09e6('0x8')}});exports[_0x09e6('0x9')]=function(_0x4b5f8e,_0x1216cf,_0x5e4d1b,_0x2d2603){return function(_0x3c109c){try{var _0x4a50c2={'tag':_0x1216cf[0x0]};var _0x1ec4d2=tag[_0x09e6('0x0')](_0x4a50c2,{'typecast':!![]});if(_0x1ec4d2[_0x09e6('0xa')]){logger['error']('[%s][TAG]\x20%s',_0x4b5f8e,_[_0x09e6('0xb')](_0x1ec4d2,_0x09e6('0xc'))[_0x09e6('0xd')](',\x20'));logger[_0x09e6('0xe')](_0x09e6('0xf'),_0x4b5f8e);_0x3c109c['next']();}else{var _0x154f8f={'ids':[_0x1216cf[0x0]]};if(rpc[_0x2d2603[_0x09e6('0x10')]+_0x09e6('0x11')]){rpc[_0x2d2603['channel']+_0x09e6('0x11')]['addTags'](_0x2d2603[_0x09e6('0x12')]['id'],_0x154f8f)[_0x09e6('0x13')](function(_0x3ce0bc){logger['info'](_0x09e6('0x14'),_0x4b5f8e,_0x1216cf[0x1],_0x2d2603['channel'],_0x2d2603['interaction']['id']);})[_0x09e6('0x15')](function(_0x58e459){logger[_0x09e6('0x16')](_0x09e6('0x17'),_0x4b5f8e,JSON['stringify'](_0x58e459));logger['info'](_0x09e6('0xf'),_0x4b5f8e);})[_0x09e6('0x18')](function(){_0x3c109c['next']();});}}}catch(_0x351291){logger[_0x09e6('0x16')]('[%s][TAG]\x20%s',_0x4b5f8e,_['isObject'](_0x351291)?JSON[_0x09e6('0x19')](_0x351291):_0x351291);logger[_0x09e6('0xe')](_0x09e6('0xf'),_0x4b5f8e);_0x3c109c[_0x09e6('0x1a')]();}};}; \ 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 d108576..ce2f9d3 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x4b2bf4,_0xb17970){var _0x483c6a=function(_0x5315db){while(--_0x5315db){_0x4b2bf4['push'](_0x4b2bf4['shift']());}};_0x483c6a(++_0xb17970);}(_0xe706,0xa3));var _0x6e70=function(_0x353730,_0x504fdf){_0x353730=_0x353730-0x0;var _0x901b87=_0xe706[_0x353730];return _0x901b87;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xbaf0=['list','lodash','exports','render','merge','contact','message','account','interaction'];(function(_0x5ac676,_0x502b07){var _0x1b80ba=function(_0xa93984){while(--_0xa93984){_0x5ac676['push'](_0x5ac676['shift']());}};_0x1b80ba(++_0x502b07);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var Mustache=require('mustache');var _=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'getMustacheRender':function(_0x1e212d,_0x263f79){return Mustache[_0x0baf('0x2')](_0x1e212d,_[_0x0baf('0x3')](_0x263f79['body'],{'contact':_0x263f79[_0x0baf('0x4')],'message':_0x263f79[_0x0baf('0x5')],'account':_0x263f79[_0x0baf('0x6')],'interaction':_0x263f79[_0x0baf('0x7')],'list':_0x263f79[_0x0baf('0x8')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 01d25b8..0c49dba 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 _0xd56e=['smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','server','http','stringify','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','bluebird','../../../config/environment','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','interval','listen','rules','channel','message','interaction','isArray','applications','length','existsSync','join','app','toLowerCase','appdata','mail','push','slice','dialogflow','split','dialogflowv2','amazonlex','tag','TagId','./interval','intervals','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','execute','Applications\x20executed','matchPath','emit','complete','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues'];(function(_0x41b9b4,_0x4264ed){var _0x3241af=function(_0x215412){while(--_0x215412){_0x41b9b4['push'](_0x41b9b4['shift']());}};_0x3241af(++_0x4264ed);}(_0xd56e,0x1e8));var _0xed56=function(_0x1ba775,_0x3ab394){_0x1ba775=_0x1ba775-0x0;var _0x567163=_0xd56e[_0x1ba775];return _0x567163;};'use strict';var _=require(_0xed56('0x0'));var util=require(_0xed56('0x1'));var path=require(_0xed56('0x2'));var fs=require('fs');var jayson=require(_0xed56('0x3'));var BPromise=require(_0xed56('0x4'));var uuid=require('uuid');var config=require(_0xed56('0x5'));var logger=require('../../../config/logger')(_0xed56('0x6'));var rpc={'openchannelQueueReport':require(_0xed56('0x7')),'mailQueueReport':require(_0xed56('0x8')),'chatQueueReport':require(_0xed56('0x9')),'smsQueueReport':require(_0xed56('0xa')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xed56('0xb'))};var RuleEngine=require(_0xed56('0xc'));function getId(_0x3152d5,_0x369fb1,_0x5de9ac){return util[_0xed56('0xd')](_0xed56('0xe'),_0x3152d5,_0x369fb1||0x0,_0x5de9ac||0x0);}function getIntervals(_0x476c5c,_0x3259a8){var _0x57e63e=[];if(!_['isNil'](_0x3259a8[_0xed56('0xf')])&&!_[_0xed56('0x10')](_0x476c5c[_0x3259a8[_0xed56('0xf')]])&&!_[_0xed56('0x10')](_0x476c5c[_0x3259a8[_0xed56('0xf')]][_0xed56('0x11')])){_0x57e63e=_['map'](_0x476c5c[_0x3259a8[_0xed56('0xf')]][_0xed56('0x11')],_0xed56('0x12'));}else if(!_['isNil'](_0x3259a8[_0xed56('0x12')])){_0x57e63e=[_0x3259a8[_0xed56('0x12')]];}return _0x57e63e;}exports[_0xed56('0x13')]=function(_0x557964){_0x557964[_0xed56('0x14')]={};return new BPromise(function(_0x1420a6,_0x1480b0){var _0x3d190d={'Start':function(_0x27003d){var _0x23ba8c=this;return new Promise(function(_0x2935f5,_0x39a5bd){if(_0x27003d){try{var _0x32fba6=[];var _0x1d1a3b=getId(_0x27003d[_0xed56('0x15')],_0x27003d[_0xed56('0x16')]?_0x27003d[_0xed56('0x16')]['id']:0x0,_0x27003d[_0xed56('0x17')]?_0x27003d[_0xed56('0x17')]['id']:0x0);if(_0x27003d['applications']&&_[_0xed56('0x18')](_0x27003d[_0xed56('0x19')])&&_0x27003d[_0xed56('0x19')][_0xed56('0x1a')]){for(var _0x1450db=0x0;_0x1450db<_0x27003d['applications'][_0xed56('0x1a')];_0x1450db+=0x1){var _0x51c15a=_0x27003d[_0xed56('0x19')][_0x1450db];if(fs[_0xed56('0x1b')](path[_0xed56('0x1c')](__dirname,_0xed56('0x19'),_0x51c15a[_0xed56('0x1d')]+'.js'))){var _0x447460=[];switch(_0x51c15a['app'][_0xed56('0x1e')]()){case'autoreply':var _0x230507=_0x51c15a[_0xed56('0x1f')]['split'](',');if(_0x27003d[_0xed56('0x15')]===_0xed56('0x20')){_0x447460['push'](_0x230507[0x0]);_0x447460[_0xed56('0x21')](_0x230507[0x1]);_0x447460['push'](_0x230507['slice'](0x2,_0x230507[_0xed56('0x1a')])[_0xed56('0x1c')](','));}else{_0x447460[_0xed56('0x21')](_0x230507[0x0]);_0x447460[_0xed56('0x21')](_0x230507[_0xed56('0x22')](0x1,_0x230507['length'])[_0xed56('0x1c')](','));}break;case _0xed56('0x23'):var _0x330dc5=_0x51c15a[_0xed56('0x1f')][_0xed56('0x24')](',');_0x447460[_0xed56('0x21')](_0x330dc5[0x0]);_0x447460['push'](_0x330dc5[0x1]);_0x447460[_0xed56('0x21')](_0x330dc5[_0xed56('0x22')](0x2,_0x330dc5[_0xed56('0x1a')])['join'](','));break;case _0xed56('0x25'):var _0x515665=_0x51c15a[_0xed56('0x1f')][_0xed56('0x24')](',');_0x447460[_0xed56('0x21')](_0x515665[0x0]);_0x447460[_0xed56('0x21')](_0x515665[0x1]);_0x447460[_0xed56('0x21')](_0x515665[0x2]);_0x447460[_0xed56('0x21')](_0x515665[0x3]);_0x447460[_0xed56('0x21')](_0x515665[_0xed56('0x22')](0x4,_0x515665['length'])['join'](','));break;case _0xed56('0x26'):var _0x326664=_0x51c15a[_0xed56('0x1f')][_0xed56('0x24')](',');_0x447460[_0xed56('0x21')](_0x326664[0x0]);_0x447460[_0xed56('0x21')](_0x326664[0x1]);_0x447460[_0xed56('0x21')](_0x326664[0x2]);_0x447460[_0xed56('0x21')](_0x326664[0x3]);_0x447460['push'](_0x326664[_0xed56('0x22')](0x4,_0x326664['length'])['join'](','));break;case _0xed56('0x16'):_0x447460[_0xed56('0x21')](_0x51c15a['appdata']);break;case _0xed56('0x27'):_0x447460[_0xed56('0x21')](_0x51c15a[_0xed56('0x28')]);_0x447460[_0xed56('0x21')](_0x51c15a[_0xed56('0x1f')]);break;default:_0x447460=_['isNil'](_0x51c15a['appdata'])?[]:_0x51c15a[_0xed56('0x1f')][_0xed56('0x24')](',');}var _0x34a8a9={'id':util[_0xed56('0xd')]('%s:%s:%s',_0x1d1a3b,_0x51c15a['id'],_0x51c15a['app']),'condition':require(_0xed56('0x29'))['condition'](_0x1d1a3b,getIntervals(_0x557964[_0xed56('0x2a')],_0x51c15a),_0x557964),'consequence':require('./applications/'+_0x51c15a['app'])[_0xed56('0x2b')](_0x1d1a3b,_0x447460,_0x557964,_0x27003d),'p':_0x51c15a[_0xed56('0x2c')]||0x0};logger[_0xed56('0x2d')](_0xed56('0x2e'),_0x34a8a9['id'],_0xed56('0x2f'),getIntervals(_0x557964[_0xed56('0x2a')],_0x51c15a)['join'](_0xed56('0x30')));_0x32fba6['push'](_0x34a8a9);}else{logger[_0xed56('0x31')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xed56('0x1c')](__dirname,'applications',_0x51c15a[_0xed56('0x1d')]+'.js'));}}_0x557964['rules'][_0x1d1a3b]=new RuleEngine(_0x32fba6);_0x557964[_0xed56('0x14')][_0x1d1a3b][_0xed56('0x32')](_0x27003d,function(_0x30cdc9){logger[_0xed56('0x2d')](_0xed56('0x33'),JSON['stringify'](_0x30cdc9[_0xed56('0x34')]));if(_0x557964[_0xed56('0x14')][_0x1d1a3b]){_0x557964['rules'][_0x1d1a3b][_0xed56('0x35')](_0xed56('0x36'));}});return _0x2935f5({'code':0xc8,'message':_0x27003d});}else{logger[_0xed56('0x2d')](_0xed56('0x37'));return _0x2935f5({'code':0xc8,'message':_0x27003d});}}catch(_0x44f118){logger[_0xed56('0x31')](_0x44f118['stack']);return _0x39a5bd(_0x23ba8c['error'](0x1f4,_0x44f118));}}return _0x39a5bd(_0xed56('0x38'));});},'AcceptMessage':function(_0x4271be){var _0x3f9aea=this;return new Promise(function(_0x534bd8,_0x21da26){if(_0x4271be[_0xed56('0x39')]&&_0x4271be[_0xed56('0x39')]['id']){if(_0x557964[_0xed56('0x3a')][_0x4271be[_0xed56('0x39')]['id']]){_0x557964[_0xed56('0x3a')][_0x4271be['agent']['id']][_0xed56('0x3b')]=![];_0x557964[_0xed56('0x3a')][_0x4271be[_0xed56('0x39')]['id']][_0xed56('0x3c')]=undefined;}}if(_0x4271be[_0xed56('0x16')]&&_0x4271be['message']['id']){try{var _0x440b3d=getId(_0x4271be[_0xed56('0x15')],_0x4271be['message']?_0x4271be[_0xed56('0x16')]['id']:0x0,_0x4271be[_0xed56('0x17')]?_0x4271be['interaction']['id']:0x0);if(_0x557964[_0xed56('0x14')][_0x440b3d]){_0x557964['rules'][_0x440b3d][_0xed56('0x35')](_0xed56('0x3d'));if(rpc[_0x4271be[_0xed56('0x15')]+_0xed56('0x3e')]){rpc[_0x4271be['channel']+'QueueReport']['update'](_0x440b3d,{'UserId':_0x4271be[_0xed56('0x16')][_0xed56('0x3f')]})[_0xed56('0x40')](function(_0x2f0ac2){logger[_0xed56('0x31')](_0xed56('0x41'));});}}return _0x534bd8({'code':0xc8,'message':_0x4271be});}catch(_0x51dcad){logger[_0xed56('0x31')](_0x51dcad[_0xed56('0x42')]);return _0x21da26(_0x3f9aea[_0xed56('0x31')](0x1f4,_0x51dcad));}}logger[_0xed56('0x31')]('message\x20is\x20empty');return _0x21da26(_0x3f9aea[_0xed56('0x31')](0x1f4,_0xed56('0x43')));});},'RejectMessage':function(_0x132463){var _0x5a7165=this;return new Promise(function(_0x5dbc73,_0x3df53e){if(_0x132463[_0xed56('0x39')]&&_0x132463[_0xed56('0x39')]['id']){try{if(_0x557964[_0xed56('0x3a')][_0x132463[_0xed56('0x39')]['id']]){_0x557964[_0xed56('0x3a')][_0x132463[_0xed56('0x39')]['id']]['busy']=![];_0x557964[_0xed56('0x3a')][_0x132463[_0xed56('0x39')]['id']]['busyQueue']=undefined;}return _0x5dbc73({'code':0xc8,'message':_0x132463});}catch(_0x7f985d){logger['error'](_0x7f985d['stack']);return _0x3df53e(_0x5a7165[_0xed56('0x31')](0x1f4,_0x7f985d));}}logger[_0xed56('0x31')](_0xed56('0x43'));return _0x3df53e(_0x5a7165[_0xed56('0x31')](0x1f4,_0xed56('0x43')));});},'AbandonInteraction':function(_0xfff0b8){var _0x1eb783=this;return new Promise(function(_0x53d531,_0x154b62){if(_0xfff0b8[_0xed56('0x15')]&&_0xfff0b8[_0xed56('0x17')]&&_0xfff0b8[_0xed56('0x17')]['id']){try{var _0x50b8bd=getId(_0xfff0b8['channel'],_0xfff0b8[_0xed56('0x16')]?_0xfff0b8['message']['id']:0x0,_0xfff0b8['interaction']?_0xfff0b8['interaction']['id']:0x0);if(_0x557964[_0xed56('0x14')][_0x50b8bd]){_0x557964[_0xed56('0x14')][_0x50b8bd][_0xed56('0x35')]('end');}return _0x53d531({'code':0xc8,'message':_0xfff0b8});}catch(_0x3ea288){logger['error'](_0x3ea288[_0xed56('0x42')]);return _0x154b62(_0x1eb783[_0xed56('0x31')](0x1f4,_0x3ea288));}}logger[_0xed56('0x31')](_0xed56('0x43'));return _0x154b62(_0x1eb783[_0xed56('0x31')](0x1f4,_0xed56('0x43')));});},'AgentCapacity':function(_0x5b31ee){var _0x47ca4c=this;return new Promise(function(_0x39811d,_0x1398ec){if(_0x557964['agents'][_0xed56('0x44')](_0x5b31ee['id'])){for(var _0x2e83fb in _0x5b31ee[_0xed56('0x45')]){if(_0x5b31ee[_0xed56('0x45')][_0xed56('0x44')](_0x2e83fb)){if(_0x557964[_0xed56('0x3a')][_0x5b31ee['id']][_0xed56('0x44')](_0x2e83fb+_0xed56('0x46'))){_0x557964[_0xed56('0x3a')][_0x5b31ee['id']][_0x2e83fb+_0xed56('0x46')]=parseInt(_0x5b31ee[_0xed56('0x45')][_0x2e83fb],0xa);}}}_0x557964[_0xed56('0x3a')][_0x5b31ee['id']][_0xed56('0x47')]();return _0x39811d({'code':0xc8,'message':_0x557964['agents'][_0x5b31ee['id']]});}else{return _0x1398ec(_0x47ca4c[_0xed56('0x31')](0x1f4,_0xed56('0x48')));}});},'Agents':function(_0x2311fa){return new Promise(function(_0x566e4a,_0x241d45){var _0x248313=_[_0xed56('0x49')](_0x557964[_0xed56('0x3a')]);_0x566e4a({'count':_0x248313[_0xed56('0x1a')],'rows':_0x248313});});},'ChatQueues':function(_0x219336){return new Promise(function(_0x23609a,_0x2916ee){var _0x27424a=[];for(var _0x28f12f in _0x557964['chatQueues']){if(_0x557964[_0xed56('0x4a')][_0xed56('0x44')](_0x28f12f)){var _0x16f20f=_0x557964['chatQueues'][_0x28f12f];var _0x4eec9c={'id':_0x16f20f['id'],'available':_0x16f20f[_0xed56('0x4b')],'loggedIn':_0x16f20f[_0xed56('0x4c')],'name':_0x16f20f[_0xed56('0x4d')],'paused':_0x16f20f[_0xed56('0x4e')],'waiting':_0x16f20f[_0xed56('0x4f')]};_0x27424a[_0xed56('0x21')](_0x4eec9c);}}_0x23609a({'count':_0x27424a['length'],'rows':_0x27424a});});},'MailQueues':function(_0x453301){return new Promise(function(_0x1bc939,_0x23e5e5){var _0x1f6dbd=[];for(var _0x89c80 in _0x557964[_0xed56('0x50')]){if(_0x557964[_0xed56('0x50')]['hasOwnProperty'](_0x89c80)){var _0x1df44f=_0x557964[_0xed56('0x50')][_0x89c80];var _0x6898ec={'id':_0x1df44f['id'],'available':_0x1df44f[_0xed56('0x4b')],'loggedIn':_0x1df44f[_0xed56('0x4c')],'name':_0x1df44f[_0xed56('0x4d')],'paused':_0x1df44f[_0xed56('0x4e')],'waiting':_0x1df44f[_0xed56('0x4f')]};_0x1f6dbd[_0xed56('0x21')](_0x6898ec);}}_0x1bc939({'count':_0x1f6dbd[_0xed56('0x1a')],'rows':_0x1f6dbd});});},'OpenchannelQueues':function(_0x422001){return new Promise(function(_0x5bcbc1,_0x1e4e26){var _0x18b072=[];for(var _0x4c1939 in _0x557964['openchannelQueues']){if(_0x557964['openchannelQueues'][_0xed56('0x44')](_0x4c1939)){var _0x4359c0=_0x557964[_0xed56('0x51')][_0x4c1939];var _0x19eac7={'id':_0x4359c0['id'],'available':_0x4359c0[_0xed56('0x4b')],'loggedIn':_0x4359c0[_0xed56('0x4c')],'name':_0x4359c0[_0xed56('0x4d')],'paused':_0x4359c0[_0xed56('0x4e')],'waiting':_0x4359c0[_0xed56('0x4f')]};_0x18b072[_0xed56('0x21')](_0x19eac7);}}_0x5bcbc1({'count':_0x18b072['length'],'rows':_0x18b072});});},'SmsQueues':function(_0x3c7125){return new Promise(function(_0x29a5a5,_0x1eae7c){var _0x1cd061=[];for(var _0x2ee4ed in _0x557964['smsQueues']){if(_0x557964[_0xed56('0x52')][_0xed56('0x44')](_0x2ee4ed)){var _0x2ad635=_0x557964[_0xed56('0x52')][_0x2ee4ed];var _0x442f7e={'id':_0x2ad635['id'],'available':_0x2ad635[_0xed56('0x4b')],'loggedIn':_0x2ad635[_0xed56('0x4c')],'name':_0x2ad635['name'],'paused':_0x2ad635[_0xed56('0x4e')],'waiting':_0x2ad635[_0xed56('0x4f')]};_0x1cd061[_0xed56('0x21')](_0x442f7e);}}_0x29a5a5({'count':_0x1cd061['length'],'rows':_0x1cd061});});},'FaxQueues':function(_0x57d791){return new Promise(function(_0x16cd5d,_0x158701){var _0x3cdd65=[];for(var _0x4bfeb6 in _0x557964['faxQueues']){if(_0x557964['faxQueues']['hasOwnProperty'](_0x4bfeb6)){var _0x55b5bf=_0x557964[_0xed56('0x53')][_0x4bfeb6];var _0x12f587={'id':_0x55b5bf['id'],'available':_0x55b5bf['available'],'loggedIn':_0x55b5bf[_0xed56('0x4c')],'name':_0x55b5bf[_0xed56('0x4d')],'paused':_0x55b5bf[_0xed56('0x4e')],'waiting':_0x55b5bf['waiting']};_0x3cdd65[_0xed56('0x21')](_0x12f587);}}_0x16cd5d({'count':_0x3cdd65[_0xed56('0x1a')],'rows':_0x3cdd65});});},'WhatsappQueues':function(_0x15cc39){return new Promise(function(_0x234f27,_0x3a345b){var _0x2c0816=[];for(var _0x5b0272 in _0x557964[_0xed56('0x54')]){if(_0x557964['whatsappQueues']['hasOwnProperty'](_0x5b0272)){var _0x92e35a=_0x557964[_0xed56('0x54')][_0x5b0272];var _0x5eaff6={'id':_0x92e35a['id'],'available':_0x92e35a[_0xed56('0x4b')],'loggedIn':_0x92e35a[_0xed56('0x4c')],'name':_0x92e35a['name'],'paused':_0x92e35a[_0xed56('0x4e')],'waiting':_0x92e35a[_0xed56('0x4f')]};_0x2c0816[_0xed56('0x21')](_0x5eaff6);}}_0x234f27({'count':_0x2c0816[_0xed56('0x1a')],'rows':_0x2c0816});});},'ChatQueuesWaitingInteractions':function(_0x31e5b5){return new Promise(function(_0x46f065,_0x41d1f3){var _0x4ba3d0=_[_0xed56('0x49')](_0x557964[_0xed56('0x55')]);_0x46f065({'count':_0x4ba3d0[_0xed56('0x1a')],'rows':_0x4ba3d0});});},'MailQueuesWaitingInteractions':function(_0x56f0ac){return new Promise(function(_0x3ace92,_0x507675){var _0x38148b=_['values'](_0x557964[_0xed56('0x56')]);_0x3ace92({'count':_0x38148b[_0xed56('0x1a')],'rows':_0x38148b});});},'OpenchannelQueuesWaitingInteractions':function(_0x5e5f41){return new Promise(function(_0x4ce3a0,_0x5789bf){var _0x57f6bd=_[_0xed56('0x49')](_0x557964[_0xed56('0x57')]);_0x4ce3a0({'count':_0x57f6bd['length'],'rows':_0x57f6bd});});},'SmsQueuesWaitingInteractions':function(_0x513b67){return new Promise(function(_0x368107,_0x47db18){var _0x24360c=_[_0xed56('0x49')](_0x557964[_0xed56('0x58')]);_0x368107({'count':_0x24360c['length'],'rows':_0x24360c});});},'FaxQueuesWaitingInteractions':function(_0x25df63){return new Promise(function(_0x511da3,_0x3a6b2f){var _0x19e8e8=_['values'](_0x557964['faxQueuesWaitingInteractions']);_0x511da3({'count':_0x19e8e8[_0xed56('0x1a')],'rows':_0x19e8e8});});},'WhatsappQueuesWaitingInteractions':function(_0x45fe5f){return new Promise(function(_0x39be28,_0x38c95d){var _0x2c7a8e=_[_0xed56('0x49')](_0x557964['whatsappQueuesWaitingInteractions']);_0x39be28({'count':_0x2c7a8e[_0xed56('0x1a')],'rows':_0x2c7a8e});});}};var _0x21057c=jayson[_0xed56('0x59')](_0x3d190d)[_0xed56('0x5a')]();_0x21057c['on'](_0xed56('0x31'),function(_0x432801){logger['error'](JSON[_0xed56('0x5b')](_0x432801));return _0x1480b0(_0x432801);});_0x21057c[_0xed56('0x13')](0x232c,_0xed56('0x5c'),function(){console[_0xed56('0x5d')](_0xed56('0x5e'),0x232c);return _0x1420a6('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0xea30=['error','stack','routing\x20is\x20empty','agent','agents','busyQueue','channel','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','end','capacity','hasOwnProperty','CurrentCapacity','agent\x20not\x20found','chatQueues','available','loggedIn','name','paused','mailQueues','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','values','whatsappQueuesWaitingInteractions','server','http','stringify','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','bluebird','uuid','../../../config/environment','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','interval','listen','rules','message','interaction','applications','isArray','length','join','.js','app','toLowerCase','autoreply','appdata','split','mail','push','dialogflow','slice','dialogflowv2','amazonlex','tag','TagId','%s:%s:%s','condition','intervals','./applications/','consequence','info','Push\x20new\x20rule','on\x20interval','Please\x20create\x20a\x20new\x20file\x20under','matchPath','emit','complete'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xea30,0x1a6));var _0x0ea3=function(_0x3845b1,_0x7beff6){_0x3845b1=_0x3845b1-0x0;var _0x282430=_0xea30[_0x3845b1];return _0x282430;};'use strict';var _=require('lodash');var util=require(_0x0ea3('0x0'));var path=require('path');var fs=require('fs');var jayson=require(_0x0ea3('0x1'));var BPromise=require(_0x0ea3('0x2'));var uuid=require(_0x0ea3('0x3'));var config=require(_0x0ea3('0x4'));var logger=require('../../../config/logger')(_0x0ea3('0x5'));var rpc={'openchannelQueueReport':require(_0x0ea3('0x6')),'mailQueueReport':require(_0x0ea3('0x7')),'chatQueueReport':require(_0x0ea3('0x8')),'smsQueueReport':require(_0x0ea3('0x9')),'faxQueueReport':require(_0x0ea3('0xa')),'whatsappQueueReport':require(_0x0ea3('0xb'))};var RuleEngine=require(_0x0ea3('0xc'));function getId(_0x3e01df,_0x512be0,_0x3b728d){return util[_0x0ea3('0xd')](_0x0ea3('0xe'),_0x3e01df,_0x512be0||0x0,_0x3b728d||0x0);}function getIntervals(_0x5c60e2,_0x396f60){var _0x5c0fd8=[];if(!_['isNil'](_0x396f60[_0x0ea3('0xf')])&&!_[_0x0ea3('0x10')](_0x5c60e2[_0x396f60[_0x0ea3('0xf')]])&&!_[_0x0ea3('0x10')](_0x5c60e2[_0x396f60['IntervalId']][_0x0ea3('0x11')])){_0x5c0fd8=_['map'](_0x5c60e2[_0x396f60[_0x0ea3('0xf')]]['Intervals'],_0x0ea3('0x12'));}else if(!_['isNil'](_0x396f60[_0x0ea3('0x12')])){_0x5c0fd8=[_0x396f60['interval']];}return _0x5c0fd8;}exports[_0x0ea3('0x13')]=function(_0x49f68e){_0x49f68e[_0x0ea3('0x14')]={};return new BPromise(function(_0x1dcd1f,_0x37102a){var _0x3c0cf8={'Start':function(_0x1f4f74){var _0x391d3f=this;return new Promise(function(_0x3446dc,_0x4e0047){if(_0x1f4f74){try{var _0xee22a1=[];var _0x5bead7=getId(_0x1f4f74['channel'],_0x1f4f74[_0x0ea3('0x15')]?_0x1f4f74['message']['id']:0x0,_0x1f4f74[_0x0ea3('0x16')]?_0x1f4f74[_0x0ea3('0x16')]['id']:0x0);if(_0x1f4f74[_0x0ea3('0x17')]&&_[_0x0ea3('0x18')](_0x1f4f74['applications'])&&_0x1f4f74[_0x0ea3('0x17')]['length']){for(var _0x595cd8=0x0;_0x595cd8<_0x1f4f74[_0x0ea3('0x17')][_0x0ea3('0x19')];_0x595cd8+=0x1){var _0x52739b=_0x1f4f74[_0x0ea3('0x17')][_0x595cd8];if(fs['existsSync'](path[_0x0ea3('0x1a')](__dirname,'applications',_0x52739b['app']+_0x0ea3('0x1b')))){var _0x4dd874=[];switch(_0x52739b[_0x0ea3('0x1c')][_0x0ea3('0x1d')]()){case _0x0ea3('0x1e'):var _0x5298e6=_0x52739b[_0x0ea3('0x1f')][_0x0ea3('0x20')](',');if(_0x1f4f74['channel']===_0x0ea3('0x21')){_0x4dd874['push'](_0x5298e6[0x0]);_0x4dd874[_0x0ea3('0x22')](_0x5298e6[0x1]);_0x4dd874[_0x0ea3('0x22')](_0x5298e6['slice'](0x2,_0x5298e6[_0x0ea3('0x19')])[_0x0ea3('0x1a')](','));}else{_0x4dd874[_0x0ea3('0x22')](_0x5298e6[0x0]);_0x4dd874[_0x0ea3('0x22')](_0x5298e6['slice'](0x1,_0x5298e6[_0x0ea3('0x19')])[_0x0ea3('0x1a')](','));}break;case _0x0ea3('0x23'):var _0x558ea3=_0x52739b[_0x0ea3('0x1f')][_0x0ea3('0x20')](',');_0x4dd874[_0x0ea3('0x22')](_0x558ea3[0x0]);_0x4dd874['push'](_0x558ea3[0x1]);_0x4dd874[_0x0ea3('0x22')](_0x558ea3[_0x0ea3('0x24')](0x2,_0x558ea3[_0x0ea3('0x19')])['join'](','));break;case _0x0ea3('0x25'):var _0x2caad4=_0x52739b[_0x0ea3('0x1f')][_0x0ea3('0x20')](',');_0x4dd874['push'](_0x2caad4[0x0]);_0x4dd874[_0x0ea3('0x22')](_0x2caad4[0x1]);_0x4dd874[_0x0ea3('0x22')](_0x2caad4[0x2]);_0x4dd874[_0x0ea3('0x22')](_0x2caad4[0x3]);_0x4dd874[_0x0ea3('0x22')](_0x2caad4[_0x0ea3('0x24')](0x4,_0x2caad4[_0x0ea3('0x19')])[_0x0ea3('0x1a')](','));break;case _0x0ea3('0x26'):var _0x37640a=_0x52739b[_0x0ea3('0x1f')][_0x0ea3('0x20')](',');_0x4dd874[_0x0ea3('0x22')](_0x37640a[0x0]);_0x4dd874['push'](_0x37640a[0x1]);_0x4dd874[_0x0ea3('0x22')](_0x37640a[0x2]);_0x4dd874['push'](_0x37640a[0x3]);_0x4dd874[_0x0ea3('0x22')](_0x37640a[_0x0ea3('0x24')](0x4,_0x37640a[_0x0ea3('0x19')])[_0x0ea3('0x1a')](','));break;case _0x0ea3('0x15'):_0x4dd874[_0x0ea3('0x22')](_0x52739b['appdata']);break;case _0x0ea3('0x27'):_0x4dd874[_0x0ea3('0x22')](_0x52739b[_0x0ea3('0x28')]);_0x4dd874[_0x0ea3('0x22')](_0x52739b[_0x0ea3('0x1f')]);break;default:_0x4dd874=_[_0x0ea3('0x10')](_0x52739b[_0x0ea3('0x1f')])?[]:_0x52739b[_0x0ea3('0x1f')]['split'](',');}var _0x3aa601={'id':util[_0x0ea3('0xd')](_0x0ea3('0x29'),_0x5bead7,_0x52739b['id'],_0x52739b['app']),'condition':require('./interval')[_0x0ea3('0x2a')](_0x5bead7,getIntervals(_0x49f68e[_0x0ea3('0x2b')],_0x52739b),_0x49f68e),'consequence':require(_0x0ea3('0x2c')+_0x52739b[_0x0ea3('0x1c')])[_0x0ea3('0x2d')](_0x5bead7,_0x4dd874,_0x49f68e,_0x1f4f74),'p':_0x52739b['priority']||0x0};logger[_0x0ea3('0x2e')](_0x0ea3('0x2f'),_0x3aa601['id'],_0x0ea3('0x30'),getIntervals(_0x49f68e[_0x0ea3('0x2b')],_0x52739b)['join']('\x20|\x20'));_0xee22a1['push'](_0x3aa601);}else{logger['error'](_0x0ea3('0x31'),path[_0x0ea3('0x1a')](__dirname,_0x0ea3('0x17'),_0x52739b[_0x0ea3('0x1c')]+_0x0ea3('0x1b')));}}_0x49f68e['rules'][_0x5bead7]=new RuleEngine(_0xee22a1);_0x49f68e[_0x0ea3('0x14')][_0x5bead7]['execute'](_0x1f4f74,function(_0x39f12b){logger[_0x0ea3('0x2e')]('Applications\x20executed',JSON['stringify'](_0x39f12b[_0x0ea3('0x32')]));if(_0x49f68e[_0x0ea3('0x14')][_0x5bead7]){_0x49f68e[_0x0ea3('0x14')][_0x5bead7][_0x0ea3('0x33')](_0x0ea3('0x34'));}});return _0x3446dc({'code':0xc8,'message':_0x1f4f74});}else{logger[_0x0ea3('0x2e')]('No\x20applications\x20to\x20execute');return _0x3446dc({'code':0xc8,'message':_0x1f4f74});}}catch(_0x5e1199){logger[_0x0ea3('0x35')](_0x5e1199[_0x0ea3('0x36')]);return _0x4e0047(_0x391d3f[_0x0ea3('0x35')](0x1f4,_0x5e1199));}}return _0x4e0047(_0x0ea3('0x37'));});},'AcceptMessage':function(_0x462bd6){var _0x284668=this;return new Promise(function(_0xa6cc48,_0x1489b2){if(_0x462bd6[_0x0ea3('0x38')]&&_0x462bd6[_0x0ea3('0x38')]['id']){if(_0x49f68e[_0x0ea3('0x39')][_0x462bd6[_0x0ea3('0x38')]['id']]){_0x49f68e[_0x0ea3('0x39')][_0x462bd6[_0x0ea3('0x38')]['id']]['busy']=![];_0x49f68e[_0x0ea3('0x39')][_0x462bd6[_0x0ea3('0x38')]['id']][_0x0ea3('0x3a')]=undefined;}}if(_0x462bd6[_0x0ea3('0x15')]&&_0x462bd6[_0x0ea3('0x15')]['id']){try{var _0x5713c9=getId(_0x462bd6[_0x0ea3('0x3b')],_0x462bd6[_0x0ea3('0x15')]?_0x462bd6[_0x0ea3('0x15')]['id']:0x0,_0x462bd6[_0x0ea3('0x16')]?_0x462bd6[_0x0ea3('0x16')]['id']:0x0);if(_0x49f68e[_0x0ea3('0x14')][_0x5713c9]){_0x49f68e[_0x0ea3('0x14')][_0x5713c9][_0x0ea3('0x33')]('end');if(rpc[_0x462bd6['channel']+_0x0ea3('0x3c')]){rpc[_0x462bd6[_0x0ea3('0x3b')]+'QueueReport'][_0x0ea3('0x3d')](_0x5713c9,{'UserId':_0x462bd6[_0x0ea3('0x15')][_0x0ea3('0x3e')]})[_0x0ea3('0x3f')](function(_0x11e176){logger['error'](_0x0ea3('0x40'));});}}return _0xa6cc48({'code':0xc8,'message':_0x462bd6});}catch(_0x4ab885){logger[_0x0ea3('0x35')](_0x4ab885[_0x0ea3('0x36')]);return _0x1489b2(_0x284668[_0x0ea3('0x35')](0x1f4,_0x4ab885));}}logger[_0x0ea3('0x35')](_0x0ea3('0x41'));return _0x1489b2(_0x284668[_0x0ea3('0x35')](0x1f4,_0x0ea3('0x41')));});},'RejectMessage':function(_0x423c93){var _0x41c8ce=this;return new Promise(function(_0x2820b3,_0x2abf97){if(_0x423c93[_0x0ea3('0x38')]&&_0x423c93[_0x0ea3('0x38')]['id']){try{if(_0x49f68e[_0x0ea3('0x39')][_0x423c93[_0x0ea3('0x38')]['id']]){_0x49f68e['agents'][_0x423c93[_0x0ea3('0x38')]['id']][_0x0ea3('0x42')]=![];_0x49f68e[_0x0ea3('0x39')][_0x423c93[_0x0ea3('0x38')]['id']][_0x0ea3('0x3a')]=undefined;}return _0x2820b3({'code':0xc8,'message':_0x423c93});}catch(_0x1bbd2b){logger['error'](_0x1bbd2b[_0x0ea3('0x36')]);return _0x2abf97(_0x41c8ce[_0x0ea3('0x35')](0x1f4,_0x1bbd2b));}}logger[_0x0ea3('0x35')]('message\x20is\x20empty');return _0x2abf97(_0x41c8ce['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x30ae20){var _0x2d7a11=this;return new Promise(function(_0x4a3654,_0x309166){if(_0x30ae20[_0x0ea3('0x3b')]&&_0x30ae20[_0x0ea3('0x16')]&&_0x30ae20[_0x0ea3('0x16')]['id']){try{var _0x22456b=getId(_0x30ae20['channel'],_0x30ae20[_0x0ea3('0x15')]?_0x30ae20['message']['id']:0x0,_0x30ae20[_0x0ea3('0x16')]?_0x30ae20[_0x0ea3('0x16')]['id']:0x0);if(_0x49f68e[_0x0ea3('0x14')][_0x22456b]){_0x49f68e[_0x0ea3('0x14')][_0x22456b][_0x0ea3('0x33')](_0x0ea3('0x43'));}return _0x4a3654({'code':0xc8,'message':_0x30ae20});}catch(_0x57e783){logger['error'](_0x57e783[_0x0ea3('0x36')]);return _0x309166(_0x2d7a11['error'](0x1f4,_0x57e783));}}logger[_0x0ea3('0x35')](_0x0ea3('0x41'));return _0x309166(_0x2d7a11[_0x0ea3('0x35')](0x1f4,_0x0ea3('0x41')));});},'AgentCapacity':function(_0x183ea4){var _0x1aa124=this;return new Promise(function(_0x2ef8a2,_0xab91f5){if(_0x49f68e[_0x0ea3('0x39')]['hasOwnProperty'](_0x183ea4['id'])){for(var _0x30be78 in _0x183ea4[_0x0ea3('0x44')]){if(_0x183ea4[_0x0ea3('0x44')][_0x0ea3('0x45')](_0x30be78)){if(_0x49f68e['agents'][_0x183ea4['id']][_0x0ea3('0x45')](_0x30be78+_0x0ea3('0x46'))){_0x49f68e[_0x0ea3('0x39')][_0x183ea4['id']][_0x30be78+_0x0ea3('0x46')]=parseInt(_0x183ea4[_0x0ea3('0x44')][_0x30be78],0xa);}}}_0x49f68e[_0x0ea3('0x39')][_0x183ea4['id']]['updateRealtime']();return _0x2ef8a2({'code':0xc8,'message':_0x49f68e[_0x0ea3('0x39')][_0x183ea4['id']]});}else{return _0xab91f5(_0x1aa124[_0x0ea3('0x35')](0x1f4,_0x0ea3('0x47')));}});},'Agents':function(_0x1ae93c){return new Promise(function(_0x4bf5d3,_0x2fb263){var _0x356acb=_['values'](_0x49f68e[_0x0ea3('0x39')]);_0x4bf5d3({'count':_0x356acb['length'],'rows':_0x356acb});});},'ChatQueues':function(_0x43d499){return new Promise(function(_0x57e76a,_0xdeb137){var _0x158871=[];for(var _0xa6e3de in _0x49f68e[_0x0ea3('0x48')]){if(_0x49f68e[_0x0ea3('0x48')][_0x0ea3('0x45')](_0xa6e3de)){var _0x4ae15e=_0x49f68e[_0x0ea3('0x48')][_0xa6e3de];var _0x30cf27={'id':_0x4ae15e['id'],'available':_0x4ae15e[_0x0ea3('0x49')],'loggedIn':_0x4ae15e[_0x0ea3('0x4a')],'name':_0x4ae15e[_0x0ea3('0x4b')],'paused':_0x4ae15e[_0x0ea3('0x4c')],'waiting':_0x4ae15e['waiting']};_0x158871[_0x0ea3('0x22')](_0x30cf27);}}_0x57e76a({'count':_0x158871[_0x0ea3('0x19')],'rows':_0x158871});});},'MailQueues':function(_0x184ec9){return new Promise(function(_0x5e9d70,_0x2644cb){var _0x274bf2=[];for(var _0x2a4252 in _0x49f68e[_0x0ea3('0x4d')]){if(_0x49f68e['mailQueues'][_0x0ea3('0x45')](_0x2a4252)){var _0x46c783=_0x49f68e[_0x0ea3('0x4d')][_0x2a4252];var _0x1dfe99={'id':_0x46c783['id'],'available':_0x46c783[_0x0ea3('0x49')],'loggedIn':_0x46c783[_0x0ea3('0x4a')],'name':_0x46c783[_0x0ea3('0x4b')],'paused':_0x46c783[_0x0ea3('0x4c')],'waiting':_0x46c783[_0x0ea3('0x4e')]};_0x274bf2['push'](_0x1dfe99);}}_0x5e9d70({'count':_0x274bf2[_0x0ea3('0x19')],'rows':_0x274bf2});});},'OpenchannelQueues':function(_0x80ef8c){return new Promise(function(_0x37a185,_0x185750){var _0x4ffd34=[];for(var _0x56e529 in _0x49f68e[_0x0ea3('0x4f')]){if(_0x49f68e[_0x0ea3('0x4f')]['hasOwnProperty'](_0x56e529)){var _0x3ae424=_0x49f68e[_0x0ea3('0x4f')][_0x56e529];var _0x83ced8={'id':_0x3ae424['id'],'available':_0x3ae424[_0x0ea3('0x49')],'loggedIn':_0x3ae424[_0x0ea3('0x4a')],'name':_0x3ae424[_0x0ea3('0x4b')],'paused':_0x3ae424[_0x0ea3('0x4c')],'waiting':_0x3ae424[_0x0ea3('0x4e')]};_0x4ffd34['push'](_0x83ced8);}}_0x37a185({'count':_0x4ffd34[_0x0ea3('0x19')],'rows':_0x4ffd34});});},'SmsQueues':function(_0x59010a){return new Promise(function(_0x2e40c0,_0x375981){var _0xa1fb0d=[];for(var _0x32e565 in _0x49f68e['smsQueues']){if(_0x49f68e[_0x0ea3('0x50')]['hasOwnProperty'](_0x32e565)){var _0x23f32c=_0x49f68e['smsQueues'][_0x32e565];var _0x2efdf0={'id':_0x23f32c['id'],'available':_0x23f32c[_0x0ea3('0x49')],'loggedIn':_0x23f32c['loggedIn'],'name':_0x23f32c[_0x0ea3('0x4b')],'paused':_0x23f32c['paused'],'waiting':_0x23f32c[_0x0ea3('0x4e')]};_0xa1fb0d[_0x0ea3('0x22')](_0x2efdf0);}}_0x2e40c0({'count':_0xa1fb0d[_0x0ea3('0x19')],'rows':_0xa1fb0d});});},'FaxQueues':function(_0x534843){return new Promise(function(_0x145557,_0x4f81eb){var _0xe71b51=[];for(var _0x3de656 in _0x49f68e[_0x0ea3('0x51')]){if(_0x49f68e[_0x0ea3('0x51')]['hasOwnProperty'](_0x3de656)){var _0x558289=_0x49f68e[_0x0ea3('0x51')][_0x3de656];var _0x52c8b6={'id':_0x558289['id'],'available':_0x558289['available'],'loggedIn':_0x558289[_0x0ea3('0x4a')],'name':_0x558289['name'],'paused':_0x558289['paused'],'waiting':_0x558289[_0x0ea3('0x4e')]};_0xe71b51[_0x0ea3('0x22')](_0x52c8b6);}}_0x145557({'count':_0xe71b51['length'],'rows':_0xe71b51});});},'WhatsappQueues':function(_0x4faf12){return new Promise(function(_0x23b18b,_0x514989){var _0x13baf3=[];for(var _0x524243 in _0x49f68e[_0x0ea3('0x52')]){if(_0x49f68e['whatsappQueues'][_0x0ea3('0x45')](_0x524243)){var _0x120534=_0x49f68e[_0x0ea3('0x52')][_0x524243];var _0x1be7d3={'id':_0x120534['id'],'available':_0x120534[_0x0ea3('0x49')],'loggedIn':_0x120534[_0x0ea3('0x4a')],'name':_0x120534[_0x0ea3('0x4b')],'paused':_0x120534['paused'],'waiting':_0x120534['waiting']};_0x13baf3['push'](_0x1be7d3);}}_0x23b18b({'count':_0x13baf3[_0x0ea3('0x19')],'rows':_0x13baf3});});},'ChatQueuesWaitingInteractions':function(_0x1f514f){return new Promise(function(_0x481cbf,_0x6eb1e2){var _0x19286b=_['values'](_0x49f68e[_0x0ea3('0x53')]);_0x481cbf({'count':_0x19286b[_0x0ea3('0x19')],'rows':_0x19286b});});},'MailQueuesWaitingInteractions':function(_0x7c1f5b){return new Promise(function(_0x5b4ef8,_0x29dfbb){var _0x5f1979=_['values'](_0x49f68e['mailQueuesWaitingInteractions']);_0x5b4ef8({'count':_0x5f1979[_0x0ea3('0x19')],'rows':_0x5f1979});});},'OpenchannelQueuesWaitingInteractions':function(_0x587541){return new Promise(function(_0x47a830,_0x395511){var _0x4e5f9e=_['values'](_0x49f68e[_0x0ea3('0x54')]);_0x47a830({'count':_0x4e5f9e[_0x0ea3('0x19')],'rows':_0x4e5f9e});});},'SmsQueuesWaitingInteractions':function(_0x1cdafd){return new Promise(function(_0x45af96,_0x4b1b53){var _0x5a8d75=_['values'](_0x49f68e['smsQueuesWaitingInteractions']);_0x45af96({'count':_0x5a8d75[_0x0ea3('0x19')],'rows':_0x5a8d75});});},'FaxQueuesWaitingInteractions':function(_0x37817b){return new Promise(function(_0x33c6b9,_0x1ee3a0){var _0x42edd1=_['values'](_0x49f68e[_0x0ea3('0x55')]);_0x33c6b9({'count':_0x42edd1[_0x0ea3('0x19')],'rows':_0x42edd1});});},'WhatsappQueuesWaitingInteractions':function(_0x503d43){return new Promise(function(_0x554c6d,_0x27ad4d){var _0x327a83=_[_0x0ea3('0x56')](_0x49f68e[_0x0ea3('0x57')]);_0x554c6d({'count':_0x327a83['length'],'rows':_0x327a83});});}};var _0x160659=jayson[_0x0ea3('0x58')](_0x3c0cf8)[_0x0ea3('0x59')]();_0x160659['on']('error',function(_0x706e36){logger[_0x0ea3('0x35')](JSON[_0x0ea3('0x5a')](_0x706e36));return _0x37102a(_0x706e36);});_0x160659[_0x0ea3('0x13')](0x232c,_0x0ea3('0x5b'),function(){console[_0x0ea3('0x5c')](_0x0ea3('0x5d'),0x232c);return _0x1dcd1f(_0x0ea3('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 c845eda..09f2d8b 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 _0x3eac=['stop','length','push','Command','format','iftime\x20%s','message','indexOf','true','error','[%s][INTERVAL]\x20%s','all','then','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','log','stack','util','jayson/promise','lodash','../../../config/logger','routing','http','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED'];(function(_0x9cfe28,_0x1a335c){var _0x54a1d0=function(_0x46bc02){while(--_0x46bc02){_0x9cfe28['push'](_0x9cfe28['shift']());}};_0x54a1d0(++_0x1a335c);}(_0x3eac,0xec));var _0xc3ea=function(_0x2b5b44,_0x17189c){_0x2b5b44=_0x2b5b44-0x0;var _0x32cb66=_0x3eac[_0x2b5b44];return _0x32cb66;};'use strict';var util=require(_0xc3ea('0x0'));var BPromise=require('bluebird');var jayson=require(_0xc3ea('0x1'));var _=require(_0xc3ea('0x2'));var logger=require(_0xc3ea('0x3'))(_0xc3ea('0x4'));var client=jayson['client'][_0xc3ea('0x5')]({'port':0x232a});function request(_0x657849,_0x1c5c70){return new BPromise(function(_0x179172,_0x5d67b){return client['request'](_0x657849,_0x1c5c70)['then'](function(_0x5dcfd3){if(_0x5dcfd3['error']){return _0x5d67b(_0x5dcfd3['error']['message']);}else{return _0x179172(_0x5dcfd3[_0xc3ea('0x6')]);}})[_0xc3ea('0x7')](function(_0x19410b){return _0x5d67b(_0x19410b);});});}exports[_0xc3ea('0x8')]=function(_0x4a22e0,_0x3f7e90,_0x5d9780){return function(_0x596b4e){if(_0x5d9780['rules']&&!_0x5d9780[_0xc3ea('0x9')][_0x4a22e0]){logger[_0xc3ea('0xa')](_0xc3ea('0xb'),_0x4a22e0);return _0x596b4e[_0xc3ea('0xc')]();}var _0x3d1dfd=[];for(var _0x5e5060=0x0;_0x5e5060<_0x3f7e90[_0xc3ea('0xd')];_0x5e5060+=0x1){_0x3d1dfd[_0xc3ea('0xe')](request(_0xc3ea('0xf'),{'command':util[_0xc3ea('0x10')](_0xc3ea('0x11'),_0x3f7e90[_0x5e5060])})['then'](function(_0x426b2c){return _0x426b2c&&_0x426b2c[_0xc3ea('0x12')]&&_0x426b2c[_0xc3ea('0x12')][_0xc3ea('0x13')](_0xc3ea('0x14'))>=0x0?!![]:![];})[_0xc3ea('0x7')](function(_0x593184){logger[_0xc3ea('0x15')](_0xc3ea('0x16'),_0x4a22e0,_0x3f7e90[_0x5e5060]);}));}BPromise[_0xc3ea('0x17')](_0x3d1dfd)[_0xc3ea('0x18')](function(_0x27ff8d){var _0xdec520=_[_0xc3ea('0x19')](_0x27ff8d);logger[_0xc3ea('0xa')](_0xc3ea('0x1a'),_0x4a22e0,_0x3f7e90[_0xc3ea('0x1b')](_0xc3ea('0x1c')),_0xdec520);_0x596b4e['when'](_0xdec520);})[_0xc3ea('0x7')](function(_0x5da399){console[_0xc3ea('0x1d')](_0x5da399);logger[_0xc3ea('0x15')]('[%s][INTERVAL]\x20%s\x20%s',_0x4a22e0,_0x3f7e90[_0xc3ea('0x1b')](_0xc3ea('0x1c')),_0x5da399[_0xc3ea('0x1e')]);_0x596b4e[_0xc3ea('0xc')]();});};}; \ No newline at end of file +var _0xf23c=['\x20|\x20','when','log','join','jayson/promise','lodash','../../../config/logger','client','request','then','error','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','message','true','[%s][INTERVAL]\x20%s','some','info','[%s][INTERVAL]\x20%s\x20%s'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xf23c,0x112));var _0xcf23=function(_0x786e9,_0x1a029){_0x786e9=_0x786e9-0x0;var _0x1f891b=_0xf23c[_0x786e9];return _0x1f891b;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require(_0xcf23('0x0'));var _=require(_0xcf23('0x1'));var logger=require(_0xcf23('0x2'))('routing');var client=jayson[_0xcf23('0x3')]['http']({'port':0x232a});function request(_0x273ca5,_0x2e8abb){return new BPromise(function(_0x49d064,_0x401765){return client[_0xcf23('0x4')](_0x273ca5,_0x2e8abb)[_0xcf23('0x5')](function(_0x36bb93){if(_0x36bb93[_0xcf23('0x6')]){return _0x401765(_0x36bb93[_0xcf23('0x6')]['message']);}else{return _0x49d064(_0x36bb93['result']);}})[_0xcf23('0x7')](function(_0x30baf2){return _0x401765(_0x30baf2);});});}exports[_0xcf23('0x8')]=function(_0x144d4a,_0x2d6b2d,_0x4c0cf8){return function(_0x22e910){if(_0x4c0cf8[_0xcf23('0x9')]&&!_0x4c0cf8[_0xcf23('0x9')][_0x144d4a]){logger['info'](_0xcf23('0xa'),_0x144d4a);return _0x22e910[_0xcf23('0xb')]();}var _0x577409=[];for(var _0xcd580=0x0;_0xcd580<_0x2d6b2d[_0xcf23('0xc')];_0xcd580+=0x1){_0x577409[_0xcf23('0xd')](request(_0xcf23('0xe'),{'command':util[_0xcf23('0xf')](_0xcf23('0x10'),_0x2d6b2d[_0xcd580])})[_0xcf23('0x5')](function(_0x5997c3){return _0x5997c3&&_0x5997c3[_0xcf23('0x11')]&&_0x5997c3[_0xcf23('0x11')]['indexOf'](_0xcf23('0x12'))>=0x0?!![]:![];})[_0xcf23('0x7')](function(_0x5163c8){logger[_0xcf23('0x6')](_0xcf23('0x13'),_0x144d4a,_0x2d6b2d[_0xcd580]);}));}BPromise['all'](_0x577409)[_0xcf23('0x5')](function(_0x2b68db){var _0x19c8e2=_[_0xcf23('0x14')](_0x2b68db);logger[_0xcf23('0x15')](_0xcf23('0x16'),_0x144d4a,_0x2d6b2d['join'](_0xcf23('0x17')),_0x19c8e2);_0x22e910[_0xcf23('0x18')](_0x19c8e2);})[_0xcf23('0x7')](function(_0x3019e1){console[_0xcf23('0x19')](_0x3019e1);logger[_0xcf23('0x6')]('[%s][INTERVAL]\x20%s\x20%s',_0x144d4a,_0x2d6b2d[_0xcf23('0x1a')]('\x20|\x20'),_0x3019e1['stack']);_0x22e910[_0xcf23('0xb')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 8a1cabc..f74d315 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 _0xeffd=['secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','origtransfererexten','transferuniqueid','origtransfereruniqueid','transfereeuniqueid','clone','calleridname','secondtransfererexten','transfertargetuniqueid','agententerreason','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','agentcomplete','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','[%s][agents][agentcalled]','now','called','error','agentringnoanswer','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','push','[%s][agents][agentringnoanswer]','forIn','debug','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','talktime','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','isNil','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','transfer','transfertype','blind','extension','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfererlinkedid'];(function(_0x443e27,_0x25bdaa){var _0x5738f9=function(_0x184805){while(--_0x184805){_0x443e27['push'](_0x443e27['shift']());}};_0x5738f9(++_0x25bdaa);}(_0xeffd,0x6b));var _0xdeff=function(_0x57d5a1,_0x476764){_0x57d5a1=_0x57d5a1-0x0;var _0x506273=_0xeffd[_0x57d5a1];return _0x506273;};'use strict';var _=require(_0xdeff('0x0'));var util=require('util');var utils=require(_0xdeff('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0xd8f1d6,_0x281a05){utils[_0xdeff('0x2')](util[_0xdeff('0x3')](_0xdeff('0x4'),_0xd8f1d6[_0xdeff('0x5')],_0xd8f1d6[_0xdeff('0x6')],_0xd8f1d6[_0xdeff('0x7')],_0xd8f1d6[_0xdeff('0x8')],_0xd8f1d6[_0xdeff('0x9')],_0xd8f1d6[_0xdeff('0xa')],_0xd8f1d6[_0xdeff('0xb')],_0xd8f1d6[_0xdeff('0xc')]));if(_0xd8f1d6[_0xdeff('0x7')]){utils[_0xdeff('0xd')](_0xd8f1d6[_0xdeff('0x7')])['then'](function(_0x3ae201){if(_0x3ae201){_0xd8f1d6[_0xdeff('0xe')]=_0x3ae201[_0xdeff('0xe')];_0xd8f1d6['agentacw']=_0xd8f1d6[_0xdeff('0xf')]?_0x3ae201[_0xdeff('0x10')]:![];_0xd8f1d6[_0xdeff('0x11')]=_0xd8f1d6[_0xdeff('0x12')]?_0x3ae201[_0xdeff('0x13')]:0x0;}utils[_0xdeff('0x14')](_0xdeff('0x15'),_0xd8f1d6);});}else{utils[_0xdeff('0x14')]('CreateVoiceAgentReport',_0xd8f1d6);}if(_0x281a05){delete transfers[_0xd8f1d6[_0xdeff('0x5')]];}else{delete agents[_0xd8f1d6[_0xdeff('0x16')]];}}exports['agentcalled']=function(_0x2e614c){try{utils['debug'](util['format'](_0xdeff('0x17'),_0x2e614c[_0xdeff('0x5')]),_0x2e614c);agents[_0x2e614c[_0xdeff('0x16')]]=_0x2e614c;agents[_0x2e614c[_0xdeff('0x16')]]['agentcalledAt']=utils[_0xdeff('0x18')]();agents[_0x2e614c[_0xdeff('0x16')]][_0xdeff('0xc')]=_0xdeff('0x19');agents[_0x2e614c[_0xdeff('0x16')]][_0xdeff('0xb')]=null;agents[_0x2e614c['destuniqueid']]['connectedlinename']=null;utils[_0xdeff('0x2')](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x2e614c[_0xdeff('0x5')],agents[_0x2e614c[_0xdeff('0x16')]]['membername'],_0x2e614c[_0xdeff('0x16')]));}catch(_0x42e98e){utils[_0xdeff('0x1a')](util[_0xdeff('0x3')](_0xdeff('0x17'),_0x2e614c[_0xdeff('0x5')]),_0x42e98e);}};exports[_0xdeff('0x1b')]=function(_0x919c93){try{if(!_['isNil'](agents[_0x919c93['destuniqueid']])){utils['debug'](util[_0xdeff('0x3')]('[%s][agents][agentringnoanswer]',_0x919c93[_0xdeff('0x5')]),_0x919c93);utils[_0xdeff('0x2')](util['format'](_0xdeff('0x1c'),_0x919c93[_0xdeff('0x5')],agents[_0x919c93['destuniqueid']]['membername'],_0x919c93[_0xdeff('0x16')]));agents[_0x919c93[_0xdeff('0x16')]][_0xdeff('0x1b')]=!![];agents[_0x919c93[_0xdeff('0x16')]][_0xdeff('0x1d')]=utils['now']();agents[_0x919c93[_0xdeff('0x16')]][_0xdeff('0xc')]=_0xdeff('0x1e');agents[_0x919c93[_0xdeff('0x16')]][_0xdeff('0x1f')]=_0xdeff('0x1e');agents[_0x919c93[_0xdeff('0x16')]]['holdtime']=_0x919c93[_0xdeff('0x20')]?parseInt(_0x919c93[_0xdeff('0x20')])/0x3e8:0x0;agents[_0x919c93['destuniqueid']]['talktime']=0x0;unanswered[_0xdeff('0x21')](_0x919c93[_0xdeff('0x16')]);}}catch(_0x16b2d0){utils[_0xdeff('0x1a')](util[_0xdeff('0x3')](_0xdeff('0x22'),_0x919c93[_0xdeff('0x5')]),_0x16b2d0);}};exports['queuecallerabandon']=function(_0x331ddc){try{_[_0xdeff('0x23')](agents,function(_0x34e258,_0x5045b8){if(_0x34e258['uniqueid']==_0x331ddc[_0xdeff('0x5')]&&!_['includes'](unanswered,_0x34e258[_0xdeff('0x16')])){utils[_0xdeff('0x24')](util[_0xdeff('0x3')]('[%s][agents][queuecallerabandon]',_0x331ddc[_0xdeff('0x5')]),_0x331ddc);utils['info'](util['format'](_0xdeff('0x25'),_0x331ddc[_0xdeff('0x5')],_0x34e258[_0xdeff('0x8')],_0x34e258[_0xdeff('0x16')]));_0x34e258['agentringnoanswer']=!![];_0x34e258[_0xdeff('0x1d')]=utils[_0xdeff('0x18')]();_0x34e258[_0xdeff('0xc')]=_0xdeff('0x26');_0x34e258[_0xdeff('0x1f')]=_0xdeff('0x26');_0x34e258[_0xdeff('0x27')]=_0x331ddc['holdtime'];_0x34e258[_0xdeff('0x28')]=0x0;writeDB(_0x34e258);}});}catch(_0x5cef77){utils[_0xdeff('0x1a')](util[_0xdeff('0x3')](_0xdeff('0x29'),_0x331ddc[_0xdeff('0x5')]),_0x5cef77);}};exports[_0xdeff('0x2a')]=function(_0x965c5b){try{if(agents[_0x965c5b['destuniqueid']]){utils[_0xdeff('0x24')](util[_0xdeff('0x3')]('[%s][agents][agentconnect]',_0x965c5b[_0xdeff('0x5')]),_0x965c5b);utils[_0xdeff('0x2')](util[_0xdeff('0x3')](_0xdeff('0x2b'),_0x965c5b[_0xdeff('0x5')],agents[_0x965c5b[_0xdeff('0x16')]][_0xdeff('0x8')],_0x965c5b[_0xdeff('0x16')]));agents[_0x965c5b['destuniqueid']][_0xdeff('0x2c')]=utils['now']();agents[_0x965c5b[_0xdeff('0x16')]][_0xdeff('0xb')]=_0x965c5b[_0xdeff('0xb')];agents[_0x965c5b['destuniqueid']][_0xdeff('0x2d')]=_0x965c5b[_0xdeff('0x2d')];agents[_0x965c5b[_0xdeff('0x16')]][_0xdeff('0x27')]=_0x965c5b[_0xdeff('0x20')];agents[_0x965c5b['destuniqueid']][_0xdeff('0xc')]='connect';_[_0xdeff('0x23')](agents,function(_0x14f1d0,_0x518280){if(_0x14f1d0[_0xdeff('0x16')]!=_0x965c5b[_0xdeff('0x16')]&&_0x14f1d0[_0xdeff('0x5')]==_0x965c5b[_0xdeff('0x5')]){_0x14f1d0[_0xdeff('0x28')]=0x0;_0x14f1d0['holdtime']=_0x965c5b[_0xdeff('0x20')];_0x14f1d0[_0xdeff('0x1b')]=!![];_0x14f1d0[_0xdeff('0x1d')]=utils[_0xdeff('0x18')]();_0x14f1d0[_0xdeff('0xc')]='answered_elsewhere';_0x14f1d0['reason']=_0xdeff('0x2e');_0x14f1d0[_0xdeff('0x2f')]=_0x965c5b[_0xdeff('0x16')];_0x14f1d0[_0xdeff('0x30')]=_0x965c5b[_0xdeff('0x8')];writeDB(_0x14f1d0);}});}}catch(_0x289f70){utils[_0xdeff('0x1a')](util['format'](_0xdeff('0x31'),_0x965c5b[_0xdeff('0x5')]),_0x289f70);}};exports[_0xdeff('0xf')]=function(_0x54fa5b){try{if(!_[_0xdeff('0x32')](agents[_0x54fa5b[_0xdeff('0x16')]])){utils[_0xdeff('0x24')](util[_0xdeff('0x3')]('[%s][agents][agentcomplete]',_0x54fa5b[_0xdeff('0x5')]),_0x54fa5b);utils[_0xdeff('0x2')](util[_0xdeff('0x3')](_0xdeff('0x33'),_0x54fa5b[_0xdeff('0x5')],agents[_0x54fa5b[_0xdeff('0x16')]][_0xdeff('0x8')],_0x54fa5b[_0xdeff('0x16')]));agents[_0x54fa5b['destuniqueid']][_0xdeff('0xf')]=!![];agents[_0x54fa5b[_0xdeff('0x16')]][_0xdeff('0x34')]=utils[_0xdeff('0x18')]();agents[_0x54fa5b[_0xdeff('0x16')]]['talktime']=utils[_0xdeff('0x35')](agents[_0x54fa5b[_0xdeff('0x16')]][_0xdeff('0x34')],agents[_0x54fa5b[_0xdeff('0x16')]][_0xdeff('0x2c')]);agents[_0x54fa5b['destuniqueid']][_0xdeff('0x1f')]=_0x54fa5b['reason'];agents[_0x54fa5b[_0xdeff('0x16')]][_0xdeff('0xc')]=_0xdeff('0x36');writeDB(agents[_0x54fa5b[_0xdeff('0x16')]]);}}catch(_0xf58aa6){utils[_0xdeff('0x1a')](util['format']('[%s][agents][agentcomplete]',_0x54fa5b[_0xdeff('0x5')]),_0xf58aa6);}};exports[_0xdeff('0x37')]=function(_0x3dc206){try{if(!_['isNil'](agents[_0x3dc206['transfereruniqueid']])){utils[_0xdeff('0x24')](util[_0xdeff('0x3')]('[%s][agents][blindtransfer]',_0x3dc206[_0xdeff('0x5')]),_0x3dc206);utils[_0xdeff('0x2')](util[_0xdeff('0x3')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x3dc206[_0xdeff('0x5')],agents[_0x3dc206[_0xdeff('0x38')]][_0xdeff('0x8')],agents[_0x3dc206['transfereruniqueid']][_0xdeff('0x5')]));agents[_0x3dc206[_0xdeff('0x38')]][_0xdeff('0x39')]=!![];agents[_0x3dc206[_0xdeff('0x38')]][_0xdeff('0x3a')]=_0xdeff('0x3b');agents[_0x3dc206[_0xdeff('0x38')]]['transferexten']=_0x3dc206[_0xdeff('0x3c')];agents[_0x3dc206[_0xdeff('0x38')]]['transferuniqueid']=agents[_0x3dc206[_0xdeff('0x38')]][_0xdeff('0x5')];}}catch(_0x2967b4){utils[_0xdeff('0x1a')](util[_0xdeff('0x3')](_0xdeff('0x3d'),_0x3dc206[_0xdeff('0x5')]),_0x2967b4);}};exports[_0xdeff('0x3e')]=function(_0x5ca032){try{utils[_0xdeff('0x24')](util[_0xdeff('0x3')](_0xdeff('0x3f'),_0x5ca032['origtransfereruniqueid']),_0x5ca032);if(_0x5ca032['origtransfereruniqueid']==_0x5ca032[_0xdeff('0x40')]){if(!_[_0xdeff('0x32')](agents[_0x5ca032[_0xdeff('0x41')]])){utils[_0xdeff('0x2')](util[_0xdeff('0x3')](_0xdeff('0x42'),_0x5ca032['origtransfereruniqueid'],agents[_0x5ca032['secondtransfereruniqueid']][_0xdeff('0x8')]));agents[_0x5ca032[_0xdeff('0x41')]]['transfer']=!![];agents[_0x5ca032['secondtransfereruniqueid']][_0xdeff('0x3a')]=_0xdeff('0x43');agents[_0x5ca032['secondtransfereruniqueid']][_0xdeff('0x44')]=_0x5ca032[_0xdeff('0x45')];agents[_0x5ca032['secondtransfereruniqueid']][_0xdeff('0x46')]=_0x5ca032[_0xdeff('0x47')];}if(_0x5ca032['transfereeuniqueid']&&agents[_0x5ca032[_0xdeff('0x48')]]){agents[_0x5ca032[_0xdeff('0x48')]]['agententerreason']=0x1;transfers[_0x5ca032[_0xdeff('0x48')]]=_[_0xdeff('0x49')](agents[_0x5ca032[_0xdeff('0x48')]]);transfers[_0x5ca032['transfereeuniqueid']]['calleridnum']=agents[_0x5ca032[_0xdeff('0x41')]]['calleridnum'];transfers[_0x5ca032[_0xdeff('0x48')]][_0xdeff('0x4a')]=agents[_0x5ca032[_0xdeff('0x41')]][_0xdeff('0x4a')];transfers[_0x5ca032[_0xdeff('0x48')]]['agentcalledAt']=utils['now']();transfers[_0x5ca032[_0xdeff('0x48')]][_0xdeff('0x2c')]=utils[_0xdeff('0x18')]();transfers[_0x5ca032[_0xdeff('0x48')]][_0xdeff('0x27')]=0x0;transfers[_0x5ca032[_0xdeff('0x48')]]['agententerreason']=0x2;}}else if(_0x5ca032[_0xdeff('0x41')]==_0x5ca032['secondtransfererlinkedid']){if(!_[_0xdeff('0x32')](agents[_0x5ca032[_0xdeff('0x47')]])){utils[_0xdeff('0x2')](util[_0xdeff('0x3')](_0xdeff('0x42'),_0x5ca032[_0xdeff('0x47')],agents[_0x5ca032[_0xdeff('0x47')]][_0xdeff('0x8')]));agents[_0x5ca032[_0xdeff('0x47')]]['transfer']=!![];agents[_0x5ca032[_0xdeff('0x47')]]['transfertype']=_0xdeff('0x43');agents[_0x5ca032[_0xdeff('0x47')]]['transferexten']=_0x5ca032[_0xdeff('0x4b')];agents[_0x5ca032['origtransfereruniqueid']][_0xdeff('0x46')]=_0x5ca032['secondtransfereruniqueid'];}if(_0x5ca032['transfertargetuniqueid']&&agents[_0x5ca032[_0xdeff('0x4c')]]){agents[_0x5ca032[_0xdeff('0x4c')]]['agententerreason']=0x1;transfers[_0x5ca032[_0xdeff('0x4c')]]=_[_0xdeff('0x49')](agents[_0x5ca032[_0xdeff('0x4c')]]);transfers[_0x5ca032[_0xdeff('0x4c')]][_0xdeff('0xa')]=agents[_0x5ca032[_0xdeff('0x47')]][_0xdeff('0xa')];transfers[_0x5ca032[_0xdeff('0x4c')]][_0xdeff('0x4a')]=agents[_0x5ca032['origtransfereruniqueid']][_0xdeff('0x4a')];transfers[_0x5ca032[_0xdeff('0x4c')]]['agentcalledAt']=utils['now']();transfers[_0x5ca032[_0xdeff('0x4c')]][_0xdeff('0x2c')]=utils['now']();transfers[_0x5ca032[_0xdeff('0x4c')]][_0xdeff('0x27')]=0x0;transfers[_0x5ca032[_0xdeff('0x4c')]][_0xdeff('0x4d')]=0x2;}}}catch(_0x194eed){utils[_0xdeff('0x1a')](util[_0xdeff('0x3')](_0xdeff('0x3f'),_0x5ca032[_0xdeff('0x47')]),_0x194eed);}};exports[_0xdeff('0x4e')]=function(_0x5ab2c5){try{utils[_0xdeff('0x24')](util[_0xdeff('0x3')](_0xdeff('0x4f'),_0x5ab2c5[_0xdeff('0x5')]),_0x5ab2c5);if(agents[_0x5ab2c5[_0xdeff('0x5')]]&&agents[_0x5ab2c5['uniqueid']]['reason']==='timeout'){if(_0x5ab2c5[_0xdeff('0x50')]==='21'){agents[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0x1f')]=_0xdeff('0x51');agents[_0x5ab2c5['uniqueid']]['lastevent']=_0xdeff('0x51');}utils[_0xdeff('0x2')](util[_0xdeff('0x3')](_0xdeff('0x52'),_0x5ab2c5[_0xdeff('0x5')],agents[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0x8')],agents[_0x5ab2c5[_0xdeff('0x5')]]['reason'],agents[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0xc')]));writeDB(agents[_0x5ab2c5[_0xdeff('0x5')]]);var _0x452fd4=unanswered[_0xdeff('0x53')](_0x5ab2c5[_0xdeff('0x5')]);if(_0x452fd4>-0x1){unanswered[_0xdeff('0x54')](_0x452fd4,0x1);}}if(transfers[_0x5ab2c5[_0xdeff('0x5')]]){transfers[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0xf')]=!![];transfers[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0x34')]=utils['now']();transfers[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0x28')]=utils[_0xdeff('0x35')](transfers[_0x5ab2c5['uniqueid']][_0xdeff('0x34')],transfers[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0x2c')]);transfers[_0x5ab2c5[_0xdeff('0x5')]]['reason']=_0xdeff('0x55');transfers[_0x5ab2c5[_0xdeff('0x5')]]['lastevent']=_0xdeff('0x36');utils[_0xdeff('0x2')](util[_0xdeff('0x3')](_0xdeff('0x52'),_0x5ab2c5[_0xdeff('0x5')],transfers[_0x5ab2c5['uniqueid']][_0xdeff('0x8')],transfers[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0x1f')],transfers[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0xc')]));writeDB(transfers[_0x5ab2c5['uniqueid']],!![]);}if(agents[_0x5ab2c5[_0xdeff('0x5')]]&&agents[_0x5ab2c5[_0xdeff('0x5')]]['agentconnectAt']){agents[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0xf')]=!![];agents[_0x5ab2c5[_0xdeff('0x5')]]['agentcompleteAt']=utils[_0xdeff('0x18')]();agents[_0x5ab2c5[_0xdeff('0x5')]]['talktime']=utils[_0xdeff('0x35')](agents[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0x34')],agents[_0x5ab2c5[_0xdeff('0x5')]]['agentconnectAt']);agents[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0x1f')]=agents[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0x39')]?_0xdeff('0x39'):_0xdeff('0x55');agents[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0xc')]=_0xdeff('0x36');utils['info'](util[_0xdeff('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5ab2c5[_0xdeff('0x5')],agents[_0x5ab2c5['uniqueid']]['membername'],agents[_0x5ab2c5[_0xdeff('0x5')]][_0xdeff('0x1f')],agents[_0x5ab2c5['uniqueid']][_0xdeff('0xc')]));writeDB(agents[_0x5ab2c5[_0xdeff('0x5')]]);}}catch(_0xd49939){utils[_0xdeff('0x1a')](util['format'](_0xdeff('0x4f'),_0x5ab2c5[_0xdeff('0x5')]),_0xd49939);}}; \ 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(_0x37c67a,_0x2c906a){var _0x110b50=function(_0x1bac2c){while(--_0x1bac2c){_0x37c67a['push'](_0x37c67a['shift']());}};_0x110b50(++_0x2c906a);}(_0x0102,0x186));var _0x2010=function(_0xc53c7f,_0x152f27){_0xc53c7f=_0xc53c7f-0x0;var _0x2dd2da=_0x0102[_0xc53c7f];return _0x2dd2da;};'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 1cb9a95..584cc4a 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 _0x2be9=['substring','lastIndexOf','includes','noop','lastapplication','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','lastevent','accountcode','getUserByInternal','request','CreateVoiceCallReport','debug','format','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','error','newstate','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','channelstate','transfer','answertime','disposition','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','musiconholdstartAt','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','type','routeid','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','split'];(function(_0x6287b6,_0x5682e7){var _0x5d6be4=function(_0x3e3975){while(--_0x3e3975){_0x6287b6['push'](_0x6287b6['shift']());}};_0x5d6be4(++_0x5682e7);}(_0x2be9,0x146));var _0x92be=function(_0x56fbaa,_0x3bc5a6){_0x56fbaa=_0x56fbaa-0x0;var _0x49fbc1=_0x2be9[_0x56fbaa];return _0x49fbc1;};'use strict';var _=require(_0x92be('0x0'));var util=require(_0x92be('0x1'));var utils=require(_0x92be('0x2'));var transfers=require(_0x92be('0x3'));var dispositions=[_0x92be('0x4'),_0x92be('0x5'),_0x92be('0x5'),_0x92be('0x4'),_0x92be('0x4'),_0x92be('0x4'),_0x92be('0x6'),_0x92be('0x7'),'FAILED',_0x92be('0x5'),'FAILED'];var channels={};function writeDB(_0x862a2b){var _0x591218;if(transfers[_0x92be('0x8')][_0x862a2b['uniqueid']]){_0x591218=_0x862a2b[_0x92be('0x9')];_0x862a2b[_0x92be('0x9')]=transfers[_0x92be('0x8')][_0x862a2b['uniqueid']][_0x92be('0xa')];}utils[_0x92be('0xb')](util['format'](_0x92be('0xc'),_0x862a2b[_0x92be('0x9')],_0x862a2b[_0x92be('0xd')],_0x862a2b[_0x92be('0xe')],_0x862a2b[_0x92be('0xf')],_0x862a2b[_0x92be('0x10')],_0x862a2b[_0x92be('0x11')],_0x862a2b['connectedlinenum'],_0x862a2b[_0x92be('0x12')]));if(_0x862a2b[_0x92be('0x13')]){utils[_0x92be('0x14')](_0x862a2b[_0x92be('0x13')])['then'](function(_0x3ea774){if(_0x3ea774){_0x862a2b['UserId']=_0x3ea774['id'];}utils[_0x92be('0x15')](_0x92be('0x16'),_0x862a2b);});}else{utils[_0x92be('0x15')](_0x92be('0x16'),_0x862a2b);}if(channels[_0x862a2b[_0x92be('0x9')]]){delete channels[_0x862a2b['uniqueid']];}else if(_0x591218&&channels[_0x591218]){delete transfers[_0x92be('0x8')][_0x591218];delete channels[_0x591218];}}exports['newchannel']=function(_0x4f43bb){try{utils[_0x92be('0x17')](util[_0x92be('0x18')](_0x92be('0x19'),_0x4f43bb[_0x92be('0x9')]),_0x4f43bb);if(_0x4f43bb[_0x92be('0x9')]==_0x4f43bb[_0x92be('0x1a')]&&_0x4f43bb[_0x92be('0xd')]!='OutgoingSpoolFailed'){utils[_0x92be('0xb')](util['format'](_0x92be('0x1b'),_0x4f43bb[_0x92be('0x9')],_0x4f43bb['context'],_0x4f43bb[_0x92be('0x1c')]));channels[_0x4f43bb[_0x92be('0x9')]]={'uniqueid':_0x4f43bb[_0x92be('0x9')],'accountcode':_0x4f43bb[_0x92be('0x13')],'source':_0x4f43bb['calleridnum'],'destination':_0x4f43bb[_0x92be('0x1c')],'destinationcontext':_0x4f43bb[_0x92be('0x1d')],'channel':_0x4f43bb['channel'],'starttime':utils[_0x92be('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x92be('0x4'),'amaflags':'DOCUMENTATION'};}}catch(_0x4c3bf9){utils[_0x92be('0x1f')](util['format'](_0x92be('0x19'),_0x4f43bb[_0x92be('0x9')]),_0x4c3bf9);}};exports[_0x92be('0x20')]=function(_0x245c8b){try{utils[_0x92be('0x17')](util['format'](_0x92be('0x21'),_0x245c8b[_0x92be('0x9')]),_0x245c8b);if(!_[_0x92be('0x22')](channels[_0x245c8b[_0x92be('0x9')]])&&_0x245c8b['channelstate']==0x6){utils[_0x92be('0xb')](util[_0x92be('0x18')](_0x92be('0x23'),_0x245c8b[_0x92be('0x9')],_0x245c8b[_0x92be('0x1d')],_0x245c8b[_0x92be('0xd')]));if(_[_0x92be('0x22')](channels[_0x245c8b[_0x92be('0x9')]][_0x92be('0x24')])){channels[_0x245c8b['uniqueid']][_0x92be('0x24')]=utils[_0x92be('0x1e')]();}}else if(!_[_0x92be('0x22')](channels[_0x245c8b['linkedid']])&&_0x245c8b[_0x92be('0x25')]==0x6&&_0x245c8b[_0x92be('0x1d')]!=_0x92be('0x26')){utils[_0x92be('0xb')](util[_0x92be('0x18')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x245c8b[_0x92be('0x9')],_0x245c8b['linkedid'],_0x245c8b[_0x92be('0x1d')],_0x245c8b[_0x92be('0xd')]));channels[_0x245c8b[_0x92be('0x1a')]]['accountcode']=_0x245c8b[_0x92be('0x13')];channels[_0x245c8b[_0x92be('0x1a')]]['destinationchannel']=_0x245c8b[_0x92be('0xd')];if(_[_0x92be('0x22')](channels[_0x245c8b[_0x92be('0x1a')]][_0x92be('0x27')])){channels[_0x245c8b['linkedid']][_0x92be('0x27')]=utils[_0x92be('0x1e')]();}channels[_0x245c8b[_0x92be('0x1a')]][_0x92be('0x28')]=dispositions[_['toNumber'](_0x245c8b[_0x92be('0x25')])]||_0x92be('0x6');}}catch(_0x25948e){utils[_0x92be('0x1f')](util[_0x92be('0x18')]('[%s][calls][newstate]',_0x245c8b[_0x92be('0x9')]),_0x25948e);}};exports[_0x92be('0x29')]=function(_0x1cf30e){try{if(!_[_0x92be('0x22')](channels[_0x1cf30e[_0x92be('0x9')]])){utils[_0x92be('0x17')](util[_0x92be('0x18')](_0x92be('0x2a'),_0x1cf30e['uniqueid']),_0x1cf30e);if(_[_0x92be('0x22')](channels[_0x1cf30e['uniqueid']][_0x92be('0x2b')])){channels[_0x1cf30e[_0x92be('0x9')]]['callerid']=_0x1cf30e[_0x92be('0x2c')]+'\x20<'+_0x1cf30e[_0x92be('0x11')]+'>';}utils['info'](util[_0x92be('0x18')](_0x92be('0x2d'),_0x1cf30e[_0x92be('0x9')],channels[_0x1cf30e['uniqueid']]['callerid'],_0x1cf30e[_0x92be('0x2e')]));channels[_0x1cf30e['uniqueid']][_0x92be('0x2f')]=utils['now']();channels[_0x1cf30e['uniqueid']][_0x92be('0x30')]=utils[_0x92be('0x31')](channels[_0x1cf30e[_0x92be('0x9')]][_0x92be('0x2f')],channels[_0x1cf30e['uniqueid']]['starttime']);channels[_0x1cf30e[_0x92be('0x9')]][_0x92be('0x32')]=channels[_0x1cf30e[_0x92be('0x9')]][_0x92be('0x27')]?utils[_0x92be('0x31')](channels[_0x1cf30e['uniqueid']]['endtime'],channels[_0x1cf30e[_0x92be('0x9')]]['answertime']):0x0;writeDB(channels[_0x1cf30e[_0x92be('0x9')]]);}}catch(_0xa6d05b){utils[_0x92be('0x1f')](util[_0x92be('0x18')]('[%s][calls][hangup]',_0x1cf30e[_0x92be('0x9')]),_0xa6d05b);}};exports[_0x92be('0x33')]=function(_0x5b608c){try{if(!_[_0x92be('0x22')](channels[_0x5b608c[_0x92be('0x34')]])){utils['debug'](util[_0x92be('0x18')](_0x92be('0x35'),_0x5b608c[_0x92be('0x36')]),_0x5b608c);if(channels[_0x5b608c['localtwolinkedid']][_0x92be('0xd')]==_0x5b608c[_0x92be('0x37')]){utils[_0x92be('0xb')](util[_0x92be('0x18')](_0x92be('0x38'),_0x5b608c['origtransfereruniqueid'],_0x5b608c[_0x92be('0x34')],_0x5b608c[_0x92be('0x39')]));channels[_0x5b608c[_0x92be('0x34')]][_0x92be('0x3a')]=_0x5b608c[_0x92be('0x39')];channels[_0x5b608c[_0x92be('0x34')]][_0x92be('0x3b')]=_0x92be('0x3c');}else if(channels[_0x5b608c[_0x92be('0x34')]][_0x92be('0xd')]=_0x5b608c[_0x92be('0x3d')]){utils[_0x92be('0xb')](util[_0x92be('0x18')](_0x92be('0x38'),_0x5b608c[_0x92be('0x36')],_0x5b608c[_0x92be('0x34')],_0x5b608c[_0x92be('0x3e')]));channels[_0x5b608c[_0x92be('0x34')]][_0x92be('0x3a')]=_0x5b608c[_0x92be('0x3e')];channels[_0x5b608c[_0x92be('0x34')]][_0x92be('0x3b')]=_0x92be('0x3c');}}}catch(_0x363592){utils['error'](util[_0x92be('0x18')](_0x92be('0x35'),_0x5b608c[_0x92be('0x36')]),_0x363592);}};exports[_0x92be('0x3f')]=function(_0x3d4d5b){try{if(!_['isNil'](channels[_0x3d4d5b[_0x92be('0x9')]])){utils[_0x92be('0x17')](util['format'](_0x92be('0x40'),_0x3d4d5b['uniqueid']),_0x3d4d5b);channels[_0x3d4d5b['uniqueid']]['musiconholdstartAt']=utils['now']();utils[_0x92be('0xb')](util[_0x92be('0x18')](_0x92be('0x41'),_0x3d4d5b[_0x92be('0x9')],channels[_0x3d4d5b[_0x92be('0x9')]]['musiconholdstartAt']));}}catch(_0x5f19c3){utils['error'](util['format']('[%s][calls][musiconholdstart]',_0x3d4d5b['uniqueid']),_0x5f19c3);}};exports[_0x92be('0x42')]=function(_0x342b29){try{if(!_[_0x92be('0x22')](channels[_0x342b29[_0x92be('0x9')]])){utils['debug'](util[_0x92be('0x18')]('[%s][calls][musiconholdstop]',_0x342b29[_0x92be('0x9')]),_0x342b29);if(!_[_0x92be('0x22')](channels[_0x342b29[_0x92be('0x9')]][_0x92be('0x43')])){channels[_0x342b29[_0x92be('0x9')]][_0x92be('0x44')]+=utils[_0x92be('0x31')](utils[_0x92be('0x1e')](),channels[_0x342b29[_0x92be('0x9')]]['musiconholdstartAt']);utils[_0x92be('0xb')](util['format'](_0x92be('0x45'),_0x342b29[_0x92be('0x9')],channels[_0x342b29[_0x92be('0x9')]]['mohtime']));delete channels[_0x342b29['uniqueid']][_0x92be('0x43')];}}}catch(_0x8c7c40){utils[_0x92be('0x1f')](util[_0x92be('0x18')](_0x92be('0x46'),_0x342b29['uniqueid']),_0x8c7c40);}};exports[_0x92be('0x47')]=function(_0x1e977e){try{if(!_[_0x92be('0x22')](channels[_0x1e977e[_0x92be('0x9')]])){utils['debug'](util[_0x92be('0x18')](_0x92be('0x48'),_0x1e977e[_0x92be('0x9')]),_0x1e977e);if(!_[_0x92be('0x22')](_0x1e977e['variable'][_0x92be('0x49')])){utils[_0x92be('0xb')](util[_0x92be('0x18')](_0x92be('0x4a'),_0x1e977e[_0x92be('0x9')],_0x1e977e[_0x92be('0x4b')]));channels[_0x1e977e[_0x92be('0x9')]][_0x92be('0x4c')]=_0x1e977e['value'];}if(!_[_0x92be('0x22')](_0x1e977e[_0x92be('0x4d')]['xmd-phone'])){utils[_0x92be('0xb')](util[_0x92be('0x18')](_0x92be('0x4e'),_0x1e977e[_0x92be('0x9')],_0x1e977e[_0x92be('0x4b')]));channels[_0x1e977e[_0x92be('0x9')]][_0x92be('0x4f')]=_0x1e977e['value'];channels[_0x1e977e['uniqueid']][_0x92be('0x2b')]='\x22'+_0x1e977e[_0x92be('0x4b')]+_0x92be('0x50')+_0x1e977e[_0x92be('0x4b')]+'>';}if(!_[_0x92be('0x22')](_0x1e977e[_0x92be('0x4d')]['xmd-callerid-preview'])||!_['isNil'](_0x1e977e[_0x92be('0x4d')][_0x92be('0x51')])){utils[_0x92be('0xb')](util[_0x92be('0x18')](_0x92be('0x52'),_0x1e977e[_0x92be('0x9')],!_[_0x92be('0x22')](_0x1e977e[_0x92be('0x4d')][_0x92be('0x53')])?_0x92be('0x53'):'xmd-callerid',_0x1e977e[_0x92be('0x4b')]));channels[_0x1e977e[_0x92be('0x9')]][_0x92be('0x2b')]=_0x1e977e['value'];}if(!_[_0x92be('0x22')](_0x1e977e[_0x92be('0x4d')][_0x92be('0x54')])||!_[_0x92be('0x22')](_0x1e977e[_0x92be('0x4d')][_0x92be('0x55')])){utils[_0x92be('0xb')](util[_0x92be('0x18')](_0x92be('0x52'),_0x1e977e[_0x92be('0x9')],!_[_0x92be('0x22')](_0x1e977e[_0x92be('0x4d')][_0x92be('0x54')])?_0x92be('0x54'):_0x92be('0x55'),_0x1e977e[_0x92be('0x4b')]));channels[_0x1e977e[_0x92be('0x9')]]['lastapplication']=_0x92be('0x56');channels[_0x1e977e[_0x92be('0x9')]][_0x92be('0x57')]=_0x1e977e['value'];channels[_0x1e977e[_0x92be('0x9')]]['queue']=!![];}if(!_[_0x92be('0x22')](_0x1e977e[_0x92be('0x4d')][_0x92be('0x58')])){utils[_0x92be('0xb')](util[_0x92be('0x18')](_0x92be('0x59'),_0x1e977e['uniqueid'],_0x1e977e[_0x92be('0x4b')]));channels[_0x1e977e[_0x92be('0x9')]][_0x92be('0x5a')]=_0x1e977e[_0x92be('0x4b')];}if(!_[_0x92be('0x22')](_0x1e977e[_0x92be('0x4d')]['xmd-cdrtype'])){utils['info'](util[_0x92be('0x18')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x1e977e['uniqueid'],_0x1e977e[_0x92be('0x4b')]));channels[_0x1e977e['uniqueid']][_0x92be('0x5b')]=_0x1e977e[_0x92be('0x4b')];}if(!_['isNil'](_0x1e977e[_0x92be('0x4d')]['outboundrouteid'])){utils[_0x92be('0xb')](util[_0x92be('0x18')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x1e977e[_0x92be('0x9')],_0x1e977e[_0x92be('0x4b')]));channels[_0x1e977e[_0x92be('0x9')]][_0x92be('0x5c')]=_0x1e977e[_0x92be('0x4b')];}if(!_[_0x92be('0x22')](_0x1e977e[_0x92be('0x4d')][_0x92be('0x5d')])){utils[_0x92be('0xb')](util['format']('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x1e977e[_0x92be('0x9')],_0x1e977e[_0x92be('0x4b')]));channels[_0x1e977e[_0x92be('0x9')]][_0x92be('0x5d')]=_0x1e977e[_0x92be('0x4b')];}}}catch(_0x1a50bf){utils[_0x92be('0x1f')](util[_0x92be('0x18')](_0x92be('0x48'),_0x1e977e[_0x92be('0x9')]),_0x1a50bf);}};exports[_0x92be('0x5e')]=function(_0x1b72fe){try{if(!_[_0x92be('0x22')](channels[_0x1b72fe[_0x92be('0x9')]])){utils[_0x92be('0x17')](util[_0x92be('0x18')](_0x92be('0x5f'),_0x1b72fe['uniqueid']),_0x1b72fe);utils[_0x92be('0xb')](util[_0x92be('0x18')](_0x92be('0x60'),_0x1b72fe[_0x92be('0x9')],_0x1b72fe[_0x92be('0x61')],_0x1b72fe[_0x92be('0x62')]));if(_0x1b72fe[_0x92be('0x61')][_0x92be('0x63')]()==_0x92be('0x64')&&_['startsWith'](_0x1b72fe[_0x92be('0x62')]['toLowerCase'](),'cdr')){var _0x16b26c=_0x1b72fe['appdata'][_0x92be('0x65')]('=');var _0x2a34b3=_0x16b26c[0x0][_0x92be('0x66')](_0x16b26c[0x0][_0x92be('0x67')]('(')+0x1,_0x16b26c[0x0][_0x92be('0x67')](')'));var _0x78010e=_0x16b26c[0x1];channels[_0x1b72fe['uniqueid']][_0x2a34b3]=_0x78010e;}if(!_[_0x92be('0x68')]([_0x92be('0x29'),_0x92be('0x69'),'execif',_0x92be('0x64'),'gotoif'],_0x1b72fe[_0x92be('0x61')][_0x92be('0x63')]())){channels[_0x1b72fe[_0x92be('0x9')]][_0x92be('0x6a')]=_0x1b72fe[_0x92be('0x61')];channels[_0x1b72fe[_0x92be('0x9')]]['lastdata']=_0x1b72fe[_0x92be('0x62')];}}}catch(_0x5d4edb){utils[_0x92be('0x1f')](util['format'](_0x92be('0x5f'),_0x1b72fe[_0x92be('0x9')]),_0x5d4edb);}}; \ No newline at end of file +var _0x4d67=['includes','noop','execif','gotoif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','connectedlinenum','lastevent','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','accountcode','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','transfer','destinationchannel','answertime','toNumber','hangup','callerid','calleridnum','cause-txt','endtime','duration','starttime','billableseconds','diffTime','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][attendedtransfer]','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','split','substring','lastIndexOf'];(function(_0x7e55a4,_0x10ff38){var _0x1e152b=function(_0x58ec93){while(--_0x58ec93){_0x7e55a4['push'](_0x7e55a4['shift']());}};_0x1e152b(++_0x10ff38);}(_0x4d67,0xde));var _0x74d6=function(_0x5dca3b,_0x1fdac5){_0x5dca3b=_0x5dca3b-0x0;var _0x585514=_0x4d67[_0x5dca3b];return _0x585514;};'use strict';var _=require(_0x74d6('0x0'));var util=require(_0x74d6('0x1'));var utils=require(_0x74d6('0x2'));var transfers=require(_0x74d6('0x3'));var dispositions=[_0x74d6('0x4'),_0x74d6('0x5'),_0x74d6('0x5'),_0x74d6('0x4'),'NO\x20ANSWER','NO\x20ANSWER',_0x74d6('0x6'),_0x74d6('0x7'),_0x74d6('0x5'),'FAILED',_0x74d6('0x5')];var channels={};function writeDB(_0x2d509e){var _0x6c461d;if(transfers[_0x74d6('0x8')][_0x2d509e[_0x74d6('0x9')]]){_0x6c461d=_0x2d509e[_0x74d6('0x9')];_0x2d509e[_0x74d6('0x9')]=transfers['blinds'][_0x2d509e['uniqueid']][_0x74d6('0xa')];}utils[_0x74d6('0xb')](util[_0x74d6('0xc')](_0x74d6('0xd'),_0x2d509e['uniqueid'],_0x2d509e['channel'],_0x2d509e[_0x74d6('0xe')],_0x2d509e[_0x74d6('0xf')],_0x2d509e[_0x74d6('0x10')],_0x2d509e['calleridnum'],_0x2d509e[_0x74d6('0x11')],_0x2d509e[_0x74d6('0x12')]));if(_0x2d509e['accountcode']){utils['getUserByInternal'](_0x2d509e['accountcode'])[_0x74d6('0x13')](function(_0x93227c){if(_0x93227c){_0x2d509e[_0x74d6('0x14')]=_0x93227c['id'];}utils[_0x74d6('0x15')](_0x74d6('0x16'),_0x2d509e);});}else{utils[_0x74d6('0x15')]('CreateVoiceCallReport',_0x2d509e);}if(channels[_0x2d509e[_0x74d6('0x9')]]){delete channels[_0x2d509e[_0x74d6('0x9')]];}else if(_0x6c461d&&channels[_0x6c461d]){delete transfers[_0x74d6('0x8')][_0x6c461d];delete channels[_0x6c461d];}}exports[_0x74d6('0x17')]=function(_0x351f1d){try{utils[_0x74d6('0x18')](util['format'](_0x74d6('0x19'),_0x351f1d[_0x74d6('0x9')]),_0x351f1d);if(_0x351f1d['uniqueid']==_0x351f1d[_0x74d6('0x1a')]&&_0x351f1d[_0x74d6('0x1b')]!=_0x74d6('0x1c')){utils['info'](util['format'](_0x74d6('0x1d'),_0x351f1d[_0x74d6('0x9')],_0x351f1d[_0x74d6('0x1e')],_0x351f1d[_0x74d6('0x1f')]));channels[_0x351f1d[_0x74d6('0x9')]]={'uniqueid':_0x351f1d[_0x74d6('0x9')],'accountcode':_0x351f1d[_0x74d6('0x20')],'source':_0x351f1d['calleridnum'],'destination':_0x351f1d[_0x74d6('0x1f')],'destinationcontext':_0x351f1d[_0x74d6('0x1e')],'channel':_0x351f1d['channel'],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x74d6('0x4'),'amaflags':_0x74d6('0x21')};}}catch(_0x5dddc7){utils[_0x74d6('0x22')](util[_0x74d6('0xc')](_0x74d6('0x19'),_0x351f1d[_0x74d6('0x9')]),_0x5dddc7);}};exports[_0x74d6('0x23')]=function(_0x430f3f){try{utils[_0x74d6('0x18')](util[_0x74d6('0xc')](_0x74d6('0x24'),_0x430f3f[_0x74d6('0x9')]),_0x430f3f);if(!_[_0x74d6('0x25')](channels[_0x430f3f[_0x74d6('0x9')]])&&_0x430f3f[_0x74d6('0x26')]==0x6){utils['info'](util['format'](_0x74d6('0x27'),_0x430f3f['uniqueid'],_0x430f3f[_0x74d6('0x1e')],_0x430f3f[_0x74d6('0x1b')]));if(_[_0x74d6('0x25')](channels[_0x430f3f[_0x74d6('0x9')]][_0x74d6('0x28')])){channels[_0x430f3f[_0x74d6('0x9')]][_0x74d6('0x28')]=utils[_0x74d6('0x29')]();}}else if(!_[_0x74d6('0x25')](channels[_0x430f3f[_0x74d6('0x1a')]])&&_0x430f3f[_0x74d6('0x26')]==0x6&&_0x430f3f['context']!=_0x74d6('0x2a')){utils[_0x74d6('0xb')](util[_0x74d6('0xc')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x430f3f[_0x74d6('0x9')],_0x430f3f[_0x74d6('0x1a')],_0x430f3f[_0x74d6('0x1e')],_0x430f3f['channel']));channels[_0x430f3f[_0x74d6('0x1a')]][_0x74d6('0x20')]=_0x430f3f[_0x74d6('0x20')];channels[_0x430f3f['linkedid']][_0x74d6('0x2b')]=_0x430f3f[_0x74d6('0x1b')];if(_[_0x74d6('0x25')](channels[_0x430f3f[_0x74d6('0x1a')]]['answertime'])){channels[_0x430f3f[_0x74d6('0x1a')]][_0x74d6('0x2c')]=utils[_0x74d6('0x29')]();}channels[_0x430f3f[_0x74d6('0x1a')]]['disposition']=dispositions[_[_0x74d6('0x2d')](_0x430f3f['channelstate'])]||_0x74d6('0x6');}}catch(_0x57638b){utils[_0x74d6('0x22')](util[_0x74d6('0xc')](_0x74d6('0x24'),_0x430f3f['uniqueid']),_0x57638b);}};exports[_0x74d6('0x2e')]=function(_0x575c2a){try{if(!_[_0x74d6('0x25')](channels[_0x575c2a[_0x74d6('0x9')]])){utils['debug'](util['format']('[%s][calls][hangup]',_0x575c2a[_0x74d6('0x9')]),_0x575c2a);if(_[_0x74d6('0x25')](channels[_0x575c2a[_0x74d6('0x9')]][_0x74d6('0x2f')])){channels[_0x575c2a[_0x74d6('0x9')]]['callerid']=_0x575c2a['calleridname']+'\x20<'+_0x575c2a[_0x74d6('0x30')]+'>';}utils[_0x74d6('0xb')](util['format']('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x575c2a[_0x74d6('0x9')],channels[_0x575c2a[_0x74d6('0x9')]][_0x74d6('0x2f')],_0x575c2a[_0x74d6('0x31')]));channels[_0x575c2a['uniqueid']][_0x74d6('0x32')]=utils['now']();channels[_0x575c2a['uniqueid']][_0x74d6('0x33')]=utils['diffTime'](channels[_0x575c2a['uniqueid']][_0x74d6('0x32')],channels[_0x575c2a[_0x74d6('0x9')]][_0x74d6('0x34')]);channels[_0x575c2a[_0x74d6('0x9')]][_0x74d6('0x35')]=channels[_0x575c2a[_0x74d6('0x9')]][_0x74d6('0x2c')]?utils[_0x74d6('0x36')](channels[_0x575c2a[_0x74d6('0x9')]][_0x74d6('0x32')],channels[_0x575c2a[_0x74d6('0x9')]]['answertime']):0x0;writeDB(channels[_0x575c2a['uniqueid']]);}}catch(_0x3cca4b){utils[_0x74d6('0x22')](util[_0x74d6('0xc')](_0x74d6('0x37'),_0x575c2a[_0x74d6('0x9')]),_0x3cca4b);}};exports[_0x74d6('0x38')]=function(_0x316f75){try{if(!_['isNil'](channels[_0x316f75[_0x74d6('0x39')]])){utils[_0x74d6('0x18')](util[_0x74d6('0xc')]('[%s][calls][attendedtransfer]',_0x316f75['origtransfereruniqueid']),_0x316f75);if(channels[_0x316f75[_0x74d6('0x39')]]['channel']==_0x316f75[_0x74d6('0x3a')]){utils[_0x74d6('0xb')](util[_0x74d6('0xc')](_0x74d6('0x3b'),_0x316f75[_0x74d6('0x3c')],_0x316f75['localtwolinkedid'],_0x316f75['secondtransfererchannel']));channels[_0x316f75['localtwolinkedid']][_0x74d6('0x2b')]=_0x316f75[_0x74d6('0x3d')];channels[_0x316f75['localtwolinkedid']]['userfield']=_0x74d6('0x3e');}else if(channels[_0x316f75[_0x74d6('0x39')]][_0x74d6('0x1b')]=_0x316f75[_0x74d6('0x3f')]){utils[_0x74d6('0xb')](util[_0x74d6('0xc')](_0x74d6('0x3b'),_0x316f75[_0x74d6('0x3c')],_0x316f75['localtwolinkedid'],_0x316f75[_0x74d6('0x40')]));channels[_0x316f75[_0x74d6('0x39')]]['destinationchannel']=_0x316f75['origtransfererchannel'];channels[_0x316f75[_0x74d6('0x39')]]['userfield']='_attended';}}}catch(_0x33d197){utils[_0x74d6('0x22')](util[_0x74d6('0xc')](_0x74d6('0x41'),_0x316f75[_0x74d6('0x3c')]),_0x33d197);}};exports['musiconholdstart']=function(_0x4e3899){try{if(!_[_0x74d6('0x25')](channels[_0x4e3899['uniqueid']])){utils[_0x74d6('0x18')](util[_0x74d6('0xc')](_0x74d6('0x42'),_0x4e3899[_0x74d6('0x9')]),_0x4e3899);channels[_0x4e3899[_0x74d6('0x9')]][_0x74d6('0x43')]=utils[_0x74d6('0x29')]();utils[_0x74d6('0xb')](util[_0x74d6('0xc')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x4e3899[_0x74d6('0x9')],channels[_0x4e3899['uniqueid']][_0x74d6('0x43')]));}}catch(_0xfef324){utils[_0x74d6('0x22')](util[_0x74d6('0xc')]('[%s][calls][musiconholdstart]',_0x4e3899[_0x74d6('0x9')]),_0xfef324);}};exports['musiconholdstop']=function(_0x4115ee){try{if(!_['isNil'](channels[_0x4115ee[_0x74d6('0x9')]])){utils[_0x74d6('0x18')](util[_0x74d6('0xc')](_0x74d6('0x44'),_0x4115ee[_0x74d6('0x9')]),_0x4115ee);if(!_['isNil'](channels[_0x4115ee[_0x74d6('0x9')]][_0x74d6('0x43')])){channels[_0x4115ee[_0x74d6('0x9')]][_0x74d6('0x45')]+=utils[_0x74d6('0x36')](utils[_0x74d6('0x29')](),channels[_0x4115ee[_0x74d6('0x9')]]['musiconholdstartAt']);utils[_0x74d6('0xb')](util[_0x74d6('0xc')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x4115ee[_0x74d6('0x9')],channels[_0x4115ee['uniqueid']][_0x74d6('0x45')]));delete channels[_0x4115ee[_0x74d6('0x9')]][_0x74d6('0x43')];}}}catch(_0x5bbc9f){utils[_0x74d6('0x22')](util[_0x74d6('0xc')]('[%s][calls][musiconholdstop]',_0x4115ee[_0x74d6('0x9')]),_0x5bbc9f);}};exports[_0x74d6('0x46')]=function(_0x12e8c6){try{if(!_[_0x74d6('0x25')](channels[_0x12e8c6[_0x74d6('0x9')]])){utils[_0x74d6('0x18')](util[_0x74d6('0xc')](_0x74d6('0x47'),_0x12e8c6[_0x74d6('0x9')]),_0x12e8c6);if(!_[_0x74d6('0x25')](_0x12e8c6[_0x74d6('0x48')]['xmd-originatecalleridnum'])){utils[_0x74d6('0xb')](util[_0x74d6('0xc')](_0x74d6('0x49'),_0x12e8c6[_0x74d6('0x9')],_0x12e8c6[_0x74d6('0x4a')]));channels[_0x12e8c6[_0x74d6('0x9')]][_0x74d6('0x4b')]=_0x12e8c6['value'];}if(!_[_0x74d6('0x25')](_0x12e8c6[_0x74d6('0x48')]['xmd-phone'])){utils[_0x74d6('0xb')](util[_0x74d6('0xc')](_0x74d6('0x4c'),_0x12e8c6[_0x74d6('0x9')],_0x12e8c6[_0x74d6('0x4a')]));channels[_0x12e8c6[_0x74d6('0x9')]][_0x74d6('0x4d')]=_0x12e8c6[_0x74d6('0x4a')];channels[_0x12e8c6[_0x74d6('0x9')]]['callerid']='\x22'+_0x12e8c6[_0x74d6('0x4a')]+_0x74d6('0x4e')+_0x12e8c6[_0x74d6('0x4a')]+'>';}if(!_[_0x74d6('0x25')](_0x12e8c6[_0x74d6('0x48')][_0x74d6('0x4f')])||!_[_0x74d6('0x25')](_0x12e8c6[_0x74d6('0x48')][_0x74d6('0x50')])){utils[_0x74d6('0xb')](util[_0x74d6('0xc')](_0x74d6('0x51'),_0x12e8c6['uniqueid'],!_[_0x74d6('0x25')](_0x12e8c6[_0x74d6('0x48')][_0x74d6('0x4f')])?_0x74d6('0x4f'):_0x74d6('0x50'),_0x12e8c6[_0x74d6('0x4a')]));channels[_0x12e8c6[_0x74d6('0x9')]][_0x74d6('0x2f')]=_0x12e8c6[_0x74d6('0x4a')];}if(!_[_0x74d6('0x25')](_0x12e8c6[_0x74d6('0x48')][_0x74d6('0x52')])||!_['isNil'](_0x12e8c6[_0x74d6('0x48')][_0x74d6('0x53')])){utils[_0x74d6('0xb')](util['format'](_0x74d6('0x51'),_0x12e8c6['uniqueid'],!_['isNil'](_0x12e8c6[_0x74d6('0x48')]['xmd-queue'])?_0x74d6('0x52'):_0x74d6('0x53'),_0x12e8c6[_0x74d6('0x4a')]));channels[_0x12e8c6[_0x74d6('0x9')]][_0x74d6('0x54')]=_0x74d6('0x55');channels[_0x12e8c6[_0x74d6('0x9')]][_0x74d6('0x56')]=_0x12e8c6[_0x74d6('0x4a')];channels[_0x12e8c6[_0x74d6('0x9')]]['queue']=!![];}if(!_[_0x74d6('0x25')](_0x12e8c6['variable'][_0x74d6('0x57')])){utils[_0x74d6('0xb')](util[_0x74d6('0xc')](_0x74d6('0x58'),_0x12e8c6[_0x74d6('0x9')],_0x12e8c6['value']));channels[_0x12e8c6[_0x74d6('0x9')]][_0x74d6('0x59')]=_0x12e8c6[_0x74d6('0x4a')];}if(!_['isNil'](_0x12e8c6[_0x74d6('0x48')][_0x74d6('0x5a')])){utils['info'](util['format'](_0x74d6('0x5b'),_0x12e8c6['uniqueid'],_0x12e8c6[_0x74d6('0x4a')]));channels[_0x12e8c6['uniqueid']][_0x74d6('0x5c')]=_0x12e8c6['value'];}if(!_[_0x74d6('0x25')](_0x12e8c6[_0x74d6('0x48')]['outboundrouteid'])){utils['info'](util['format'](_0x74d6('0x5d'),_0x12e8c6['uniqueid'],_0x12e8c6['value']));channels[_0x12e8c6[_0x74d6('0x9')]][_0x74d6('0x5e')]=_0x12e8c6[_0x74d6('0x4a')];}if(!_[_0x74d6('0x25')](_0x12e8c6['variable']['sipcallid'])){utils[_0x74d6('0xb')](util[_0x74d6('0xc')](_0x74d6('0x5f'),_0x12e8c6['uniqueid'],_0x12e8c6['value']));channels[_0x12e8c6[_0x74d6('0x9')]][_0x74d6('0x60')]=_0x12e8c6[_0x74d6('0x4a')];}}}catch(_0x162199){utils[_0x74d6('0x22')](util['format'](_0x74d6('0x47'),_0x12e8c6[_0x74d6('0x9')]),_0x162199);}};exports[_0x74d6('0x61')]=function(_0x13cf3c){try{if(!_[_0x74d6('0x25')](channels[_0x13cf3c[_0x74d6('0x9')]])){utils[_0x74d6('0x18')](util[_0x74d6('0xc')](_0x74d6('0x62'),_0x13cf3c[_0x74d6('0x9')]),_0x13cf3c);utils[_0x74d6('0xb')](util[_0x74d6('0xc')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x13cf3c['uniqueid'],_0x13cf3c[_0x74d6('0x63')],_0x13cf3c[_0x74d6('0x64')]));if(_0x13cf3c['application']['toLowerCase']()=='set'&&_['startsWith'](_0x13cf3c['appdata'][_0x74d6('0x65')](),'cdr')){var _0x9cc05c=_0x13cf3c[_0x74d6('0x64')][_0x74d6('0x66')]('=');var _0x1e9565=_0x9cc05c[0x0][_0x74d6('0x67')](_0x9cc05c[0x0][_0x74d6('0x68')]('(')+0x1,_0x9cc05c[0x0]['lastIndexOf'](')'));var _0x18f64e=_0x9cc05c[0x1];channels[_0x13cf3c['uniqueid']][_0x1e9565]=_0x18f64e;}if(!_[_0x74d6('0x69')](['hangup',_0x74d6('0x6a'),_0x74d6('0x6b'),'set',_0x74d6('0x6c')],_0x13cf3c['application'][_0x74d6('0x65')]())){channels[_0x13cf3c['uniqueid']][_0x74d6('0x54')]=_0x13cf3c['application'];channels[_0x13cf3c[_0x74d6('0x9')]][_0x74d6('0x56')]=_0x13cf3c[_0x74d6('0x64')];}}}catch(_0x22b48f){utils['error'](util[_0x74d6('0xc')]('[%s][calls][newexten]',_0x13cf3c['uniqueid']),_0x22b48f);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 71b2ae8..7387065 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 _0x2de6=['[core]\x20close','info','error','[core]\x20error','close'];(function(_0x1541ba,_0x170e89){var _0x4ed360=function(_0x5110ce){while(--_0x5110ce){_0x1541ba['push'](_0x1541ba['shift']());}};_0x4ed360(++_0x170e89);}(_0x2de6,0x1a0));var _0x62de=function(_0x2ce01e,_0x59d603){_0x2ce01e=_0x2ce01e-0x0;var _0x14f6ba=_0x2de6[_0x2ce01e];return _0x14f6ba;};'use strict';var utils=require('./utils');exports['connect']=function(){utils[_0x62de('0x0')]('[core]\x20connected');};exports['shutdown']=function(){utils[_0x62de('0x0')]('[core]\x20shutdown');};exports['fullybooted']=function(){utils['info']('[core]\x20fullybooted');};exports[_0x62de('0x1')]=function(_0x3aafc6){utils[_0x62de('0x1')](_0x62de('0x2'),_0x3aafc6);};exports[_0x62de('0x3')]=function(){utils['info'](_0x62de('0x4'));};exports['managerevent']=function(_0x27deff){}; \ No newline at end of file +var _0x180e=['info','[core]\x20connected','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','close','[core]\x20close','connect'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0x180e,0xa1));var _0xe180=function(_0x412dd8,_0x355780){_0x412dd8=_0x412dd8-0x0;var _0x47b96=_0x180e[_0x412dd8];return _0x47b96;};'use strict';var utils=require('./utils');exports[_0xe180('0x0')]=function(){utils[_0xe180('0x1')](_0xe180('0x2'));};exports['shutdown']=function(){utils['info'](_0xe180('0x3'));};exports[_0xe180('0x4')]=function(){utils[_0xe180('0x1')](_0xe180('0x5'));};exports[_0xe180('0x6')]=function(_0xca2e1c){utils[_0xe180('0x6')]('[core]\x20error',_0xca2e1c);};exports[_0xe180('0x7')]=function(){utils[_0xe180('0x1')](_0xe180('0x8'));};exports['managerevent']=function(_0x1c5368){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index d65605e..02c5c1a 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 _0x2d7f=['application','appdata','toLowerCase','set','startsWith','cdr(routeid)','error','varset','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','isNil','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','dialstatus','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','lodash','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','uniqueid','[%s][dials][newexten]\x20application:%s\x20appdata:%s'];(function(_0x551c3b,_0xa3279c){var _0x472202=function(_0x29bb8c){while(--_0x29bb8c){_0x551c3b['push'](_0x551c3b['shift']());}};_0x472202(++_0xa3279c);}(_0x2d7f,0x1e5));var _0xf2d7=function(_0x232ba4,_0x1eb213){_0x232ba4=_0x232ba4-0x0;var _0x3849b2=_0x2d7f[_0x232ba4];return _0x3849b2;};'use strict';var _=require(_0xf2d7('0x0'));var util=require('util');var utils=require(_0xf2d7('0x1'));var dials={};function writeDB(_0x29eef7){utils[_0xf2d7('0x2')](util[_0xf2d7('0x3')](_0xf2d7('0x4'),_0x29eef7['uniqueid'],_0x29eef7[_0xf2d7('0x5')],_0x29eef7[_0xf2d7('0x6')],_0x29eef7[_0xf2d7('0x7')],_0x29eef7['connectedlinenum'],_0x29eef7['dialstatus']));utils[_0xf2d7('0x8')](_0xf2d7('0x9'),_0x29eef7);delete dials[_0x29eef7['uniqueid']];}exports[_0xf2d7('0xa')]=function(_0x557934){try{utils[_0xf2d7('0xb')](util['format'](_0xf2d7('0xc'),_0x557934[_0xf2d7('0xd')]),_0x557934);utils[_0xf2d7('0x2')](util[_0xf2d7('0x3')](_0xf2d7('0xe'),_0x557934['uniqueid'],_0x557934[_0xf2d7('0xf')],_0x557934[_0xf2d7('0x10')]));if(_0x557934[_0xf2d7('0xf')][_0xf2d7('0x11')]()==_0xf2d7('0x12')&&_[_0xf2d7('0x13')](_0x557934[_0xf2d7('0x10')]['toLowerCase'](),_0xf2d7('0x14'))){var _0x4d29b4=_0x557934[_0xf2d7('0x10')]['split']('=');dials[_0x557934[_0xf2d7('0xd')]]={'routeId':_0x4d29b4[0x1]};}}catch(_0xb49402){utils[_0xf2d7('0x15')](util[_0xf2d7('0x3')]('[%s][dials][newexten]',_0x557934['uniqueid']),_0xb49402);}};exports[_0xf2d7('0x16')]=function(_0x46d139){try{utils[_0xf2d7('0xb')](util[_0xf2d7('0x3')]('[%s][dials][varset]',_0x46d139[_0xf2d7('0xd')]),_0x46d139);if(!_['isNil'](_0x46d139['variable'][_0xf2d7('0x17')])){utils[_0xf2d7('0x2')](util['format'](_0xf2d7('0x18'),_0x46d139[_0xf2d7('0xd')],_0x46d139[_0xf2d7('0x19')]));dials[_0x46d139['uniqueid']]={'routeId':_0x46d139[_0xf2d7('0x19')]};}}catch(_0x1e6178){utils[_0xf2d7('0x15')](util[_0xf2d7('0x3')]('[%s][dials][varset]',_0x46d139[_0xf2d7('0xd')]),_0x1e6178);}};exports['dialbegin']=function(_0x3dc723){try{if(!_[_0xf2d7('0x1a')](dials[_0x3dc723[_0xf2d7('0xd')]])){utils[_0xf2d7('0xb')](util[_0xf2d7('0x3')](_0xf2d7('0x1b'),_0x3dc723['uniqueid']),_0x3dc723);dials[_0x3dc723['uniqueid']]=_[_0xf2d7('0x1c')](dials[_0x3dc723[_0xf2d7('0xd')]],_0x3dc723);dials[_0x3dc723[_0xf2d7('0xd')]][_0xf2d7('0x1d')]=utils[_0xf2d7('0x1e')]();dials[_0x3dc723[_0xf2d7('0xd')]][_0xf2d7('0x1f')]=_0xf2d7('0x20');utils[_0xf2d7('0x2')](util[_0xf2d7('0x3')](_0xf2d7('0x21'),_0x3dc723[_0xf2d7('0xd')],dials[_0x3dc723[_0xf2d7('0xd')]][_0xf2d7('0x1d')]));}}catch(_0x1d86e3){utils[_0xf2d7('0x15')](util[_0xf2d7('0x3')]('[%s][dials][dialbegin]',_0x3dc723[_0xf2d7('0xd')]),_0x1d86e3);}};exports[_0xf2d7('0x22')]=function(_0x18f3c4){try{if(!_[_0xf2d7('0x1a')](dials[_0x18f3c4[_0xf2d7('0xd')]])){utils[_0xf2d7('0xb')](util[_0xf2d7('0x3')]('[%s][dials][dialend]',_0x18f3c4[_0xf2d7('0xd')]),_0x18f3c4);dials[_0x18f3c4[_0xf2d7('0xd')]][_0xf2d7('0x23')]=_0x18f3c4['dialstatus'];if(_0x18f3c4[_0xf2d7('0x23')]==_0xf2d7('0x24')){dials[_0x18f3c4[_0xf2d7('0xd')]]=_[_0xf2d7('0x1c')](dials[_0x18f3c4[_0xf2d7('0xd')]],_0x18f3c4);dials[_0x18f3c4[_0xf2d7('0xd')]][_0xf2d7('0x25')]=utils['now']();dials[_0x18f3c4[_0xf2d7('0xd')]][_0xf2d7('0x1f')]=_0xf2d7('0x26');utils[_0xf2d7('0x2')](util['format'](_0xf2d7('0x27'),_0x18f3c4[_0xf2d7('0xd')],_0x18f3c4['dialstatus'],dials[_0x18f3c4['uniqueid']]['answertime']));}else{utils[_0xf2d7('0x2')](util['format'](_0xf2d7('0x28'),_0x18f3c4[_0xf2d7('0xd')],_0x18f3c4['dialstatus']));}}}catch(_0x3aafb4){utils[_0xf2d7('0x15')](util[_0xf2d7('0x3')](_0xf2d7('0x29'),_0x18f3c4[_0xf2d7('0xd')]),_0x3aafb4);}};exports['hangup']=function(_0x40c23c){try{if(!_[_0xf2d7('0x1a')](dials[_0x40c23c[_0xf2d7('0xd')]])){utils[_0xf2d7('0xb')](util[_0xf2d7('0x3')](_0xf2d7('0x2a'),_0x40c23c[_0xf2d7('0xd')]),_0x40c23c);utils[_0xf2d7('0x2')](util[_0xf2d7('0x3')](_0xf2d7('0x2b'),_0x40c23c[_0xf2d7('0xd')],_0x40c23c['calleridnum'],_0x40c23c[_0xf2d7('0x2c')],_0x40c23c[_0xf2d7('0x2d')]));dials[_0x40c23c[_0xf2d7('0xd')]]=_[_0xf2d7('0x1c')](dials[_0x40c23c['uniqueid']],{'endtime':utils[_0xf2d7('0x1e')](),'lastevent':_0xf2d7('0x2e')});dials[_0x40c23c[_0xf2d7('0xd')]][_0xf2d7('0x2f')]=utils[_0xf2d7('0x30')](dials[_0x40c23c['uniqueid']][_0xf2d7('0x31')],dials[_0x40c23c[_0xf2d7('0xd')]][_0xf2d7('0x1d')]);dials[_0x40c23c[_0xf2d7('0xd')]]['holdtime']=utils[_0xf2d7('0x30')](dials[_0x40c23c[_0xf2d7('0xd')]]['answertime']||dials[_0x40c23c[_0xf2d7('0xd')]]['endtime'],dials[_0x40c23c['uniqueid']][_0xf2d7('0x1d')]);dials[_0x40c23c[_0xf2d7('0xd')]]['billableseconds']=dials[_0x40c23c[_0xf2d7('0xd')]][_0xf2d7('0x25')]?utils[_0xf2d7('0x30')](dials[_0x40c23c[_0xf2d7('0xd')]]['endtime'],dials[_0x40c23c[_0xf2d7('0xd')]][_0xf2d7('0x25')]):0x0;writeDB(dials[_0x40c23c[_0xf2d7('0xd')]]);}}catch(_0x5393a7){utils[_0xf2d7('0x15')](util[_0xf2d7('0x3')](_0xf2d7('0x2a'),_0x40c23c['uniqueid']),_0x5393a7);}}; \ No newline at end of file +var _0x3e57=['[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','lastevent','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','diffTime','answertime','endtime','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','calleridnum','dialstatus','request','CreateVoiceDialReport','uniqueid','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','split','error','varset','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','assign','starttime','now','called'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x3e57,0xe8));var _0x73e5=function(_0x4ca333,_0x1218a3){_0x4ca333=_0x4ca333-0x0;var _0x13b2e1=_0x3e57[_0x4ca333];return _0x13b2e1;};'use strict';var _=require(_0x73e5('0x0'));var util=require(_0x73e5('0x1'));var utils=require(_0x73e5('0x2'));var dials={};function writeDB(_0x3827bc){utils[_0x73e5('0x3')](util[_0x73e5('0x4')](_0x73e5('0x5'),_0x3827bc['uniqueid'],_0x3827bc[_0x73e5('0x6')],_0x3827bc['dialstring'],_0x3827bc[_0x73e5('0x7')],_0x3827bc['connectedlinenum'],_0x3827bc[_0x73e5('0x8')]));utils[_0x73e5('0x9')](_0x73e5('0xa'),_0x3827bc);delete dials[_0x3827bc[_0x73e5('0xb')]];}exports['newexten']=function(_0x53a389){try{utils[_0x73e5('0xc')](util[_0x73e5('0x4')](_0x73e5('0xd'),_0x53a389[_0x73e5('0xb')]),_0x53a389);utils[_0x73e5('0x3')](util[_0x73e5('0x4')](_0x73e5('0xe'),_0x53a389[_0x73e5('0xb')],_0x53a389[_0x73e5('0xf')],_0x53a389[_0x73e5('0x10')]));if(_0x53a389[_0x73e5('0xf')][_0x73e5('0x11')]()=='set'&&_[_0x73e5('0x12')](_0x53a389[_0x73e5('0x10')][_0x73e5('0x11')](),'cdr(routeid)')){var _0x1f3377=_0x53a389[_0x73e5('0x10')][_0x73e5('0x13')]('=');dials[_0x53a389[_0x73e5('0xb')]]={'routeId':_0x1f3377[0x1]};}}catch(_0x3fbfde){utils[_0x73e5('0x14')](util[_0x73e5('0x4')](_0x73e5('0xd'),_0x53a389['uniqueid']),_0x3fbfde);}};exports[_0x73e5('0x15')]=function(_0x415326){try{utils[_0x73e5('0xc')](util['format']('[%s][dials][varset]',_0x415326[_0x73e5('0xb')]),_0x415326);if(!_[_0x73e5('0x16')](_0x415326[_0x73e5('0x17')][_0x73e5('0x18')])){utils[_0x73e5('0x3')](util[_0x73e5('0x4')](_0x73e5('0x19'),_0x415326[_0x73e5('0xb')],_0x415326['value']));dials[_0x415326[_0x73e5('0xb')]]={'routeId':_0x415326[_0x73e5('0x1a')]};}}catch(_0x555b1d){utils[_0x73e5('0x14')](util[_0x73e5('0x4')]('[%s][dials][varset]',_0x415326[_0x73e5('0xb')]),_0x555b1d);}};exports[_0x73e5('0x1b')]=function(_0x307564){try{if(!_[_0x73e5('0x16')](dials[_0x307564[_0x73e5('0xb')]])){utils[_0x73e5('0xc')](util[_0x73e5('0x4')]('[%s][dials][dialbegin]',_0x307564[_0x73e5('0xb')]),_0x307564);dials[_0x307564['uniqueid']]=_[_0x73e5('0x1c')](dials[_0x307564[_0x73e5('0xb')]],_0x307564);dials[_0x307564[_0x73e5('0xb')]][_0x73e5('0x1d')]=utils[_0x73e5('0x1e')]();dials[_0x307564[_0x73e5('0xb')]]['lastevent']=_0x73e5('0x1f');utils[_0x73e5('0x3')](util[_0x73e5('0x4')](_0x73e5('0x20'),_0x307564['uniqueid'],dials[_0x307564[_0x73e5('0xb')]]['starttime']));}}catch(_0x34cd62){utils['error'](util[_0x73e5('0x4')](_0x73e5('0x21'),_0x307564['uniqueid']),_0x34cd62);}};exports[_0x73e5('0x22')]=function(_0x52b043){try{if(!_[_0x73e5('0x16')](dials[_0x52b043[_0x73e5('0xb')]])){utils[_0x73e5('0xc')](util[_0x73e5('0x4')](_0x73e5('0x23'),_0x52b043[_0x73e5('0xb')]),_0x52b043);dials[_0x52b043[_0x73e5('0xb')]][_0x73e5('0x8')]=_0x52b043[_0x73e5('0x8')];if(_0x52b043[_0x73e5('0x8')]=='ANSWER'){dials[_0x52b043[_0x73e5('0xb')]]=_['assign'](dials[_0x52b043[_0x73e5('0xb')]],_0x52b043);dials[_0x52b043[_0x73e5('0xb')]]['answertime']=utils[_0x73e5('0x1e')]();dials[_0x52b043['uniqueid']][_0x73e5('0x24')]='connect';utils[_0x73e5('0x3')](util[_0x73e5('0x4')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x52b043[_0x73e5('0xb')],_0x52b043[_0x73e5('0x8')],dials[_0x52b043[_0x73e5('0xb')]]['answertime']));}else{utils[_0x73e5('0x3')](util[_0x73e5('0x4')]('[%s][dials][dialend]\x20dialstatus:%s',_0x52b043['uniqueid'],_0x52b043['dialstatus']));}}}catch(_0x4f2044){utils[_0x73e5('0x14')](util[_0x73e5('0x4')](_0x73e5('0x23'),_0x52b043['uniqueid']),_0x4f2044);}};exports['hangup']=function(_0x7811a8){try{if(!_[_0x73e5('0x16')](dials[_0x7811a8[_0x73e5('0xb')]])){utils[_0x73e5('0xc')](util['format'](_0x73e5('0x25'),_0x7811a8[_0x73e5('0xb')]),_0x7811a8);utils['info'](util[_0x73e5('0x4')](_0x73e5('0x26'),_0x7811a8[_0x73e5('0xb')],_0x7811a8['calleridnum'],_0x7811a8[_0x73e5('0x27')],_0x7811a8[_0x73e5('0x28')]));dials[_0x7811a8[_0x73e5('0xb')]]=_[_0x73e5('0x1c')](dials[_0x7811a8[_0x73e5('0xb')]],{'endtime':utils[_0x73e5('0x1e')](),'lastevent':'complete'});dials[_0x7811a8[_0x73e5('0xb')]]['duration']=utils[_0x73e5('0x29')](dials[_0x7811a8[_0x73e5('0xb')]]['endtime'],dials[_0x7811a8[_0x73e5('0xb')]][_0x73e5('0x1d')]);dials[_0x7811a8[_0x73e5('0xb')]]['holdtime']=utils[_0x73e5('0x29')](dials[_0x7811a8['uniqueid']][_0x73e5('0x2a')]||dials[_0x7811a8[_0x73e5('0xb')]][_0x73e5('0x2b')],dials[_0x7811a8[_0x73e5('0xb')]][_0x73e5('0x1d')]);dials[_0x7811a8['uniqueid']]['billableseconds']=dials[_0x7811a8['uniqueid']]['answertime']?utils['diffTime'](dials[_0x7811a8['uniqueid']]['endtime'],dials[_0x7811a8[_0x73e5('0xb')]][_0x73e5('0x2a')]):0x0;writeDB(dials[_0x7811a8[_0x73e5('0xb')]]);}}catch(_0x1a9a51){utils['error'](util[_0x73e5('0x4')](_0x73e5('0x25'),_0x7811a8[_0x73e5('0xb')]),_0x1a9a51);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 3c7d66b..db5dc6c 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 _0xbd6f=['musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','asterisk','password','keepConnected','xdr','disabled','info','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','format','[%s][index][devicestatechange]','device','devicestatechange','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0xbd6f,0x1b0));var _0xfbd6=function(_0x2a8c21,_0x163576){_0x2a8c21=_0x2a8c21-0x0;var _0x5f3061=_0xbd6f[_0x2a8c21];return _0x5f3061;};var AsteriskManager=require(_0xfbd6('0x0'));var config=require(_0xfbd6('0x1'));var utils=require(_0xfbd6('0x2'));var util=require(_0xfbd6('0x3'));var ami=new AsteriskManager(config[_0xfbd6('0x4')]['port'],config['asterisk']['ip'],config[_0xfbd6('0x4')]['username'],config['asterisk'][_0xfbd6('0x5')],!![]);ami[_0xfbd6('0x6')]();if(config[_0xfbd6('0x7')]&&config[_0xfbd6('0x7')][_0xfbd6('0x8')]){utils[_0xfbd6('0x9')]('XDR\x20DISABLED');}else{var agents=require(_0xfbd6('0xa'));var calls=require(_0xfbd6('0xb'));var queues=require(_0xfbd6('0xc'));var recordings=require(_0xfbd6('0xd'));var members=require(_0xfbd6('0xe'));var dials=require(_0xfbd6('0xf'));var transfers=require(_0xfbd6('0x10'));var core=require(_0xfbd6('0x11'));ami['on'](_0xfbd6('0x12'),core[_0xfbd6('0x12')]);ami['on'](_0xfbd6('0x13'),core[_0xfbd6('0x13')]);ami['on'](_0xfbd6('0x14'),core[_0xfbd6('0x14')]);ami['on'](_0xfbd6('0x15'),core[_0xfbd6('0x15')]);ami['on'](_0xfbd6('0x16'),core[_0xfbd6('0x16')]);ami['on'](_0xfbd6('0x17'),core['managerevent']);ami['on']('devicestatechange',function(_0x3984c7){try{utils['debug'](util[_0xfbd6('0x18')](_0xfbd6('0x19'),_0x3984c7[_0xfbd6('0x1a')]),_0x3984c7);members[_0xfbd6('0x1b')](_0x3984c7);}catch(_0x4b0644){utils[_0xfbd6('0x15')](util[_0xfbd6('0x18')](_0xfbd6('0x19'),_0x3984c7['device']),_0x4b0644);}});ami['on'](_0xfbd6('0x1c'),function(_0x2330cb){try{utils[_0xfbd6('0x1d')](util[_0xfbd6('0x18')](_0xfbd6('0x1e'),_0x2330cb[_0xfbd6('0x1f')]),_0x2330cb);agents[_0xfbd6('0x1c')](_0x2330cb);}catch(_0x139fa1){utils['error'](util[_0xfbd6('0x18')]('[%s][index][agentcalled]',_0x2330cb[_0xfbd6('0x1f')]),_0x139fa1);}});ami['on'](_0xfbd6('0x20'),function(_0x3a334d){try{utils[_0xfbd6('0x1d')](util[_0xfbd6('0x18')]('[%s][index][agentringnoanswer]',_0x3a334d[_0xfbd6('0x1f')]),_0x3a334d);agents[_0xfbd6('0x20')](_0x3a334d);}catch(_0x5304cd){utils[_0xfbd6('0x15')](util['format'](_0xfbd6('0x21'),_0x3a334d[_0xfbd6('0x1f')]),_0x5304cd);}});ami['on'](_0xfbd6('0x22'),function(_0x771034){try{utils[_0xfbd6('0x1d')](util['format'](_0xfbd6('0x23'),_0x771034[_0xfbd6('0x1f')]),_0x771034);agents[_0xfbd6('0x22')](_0x771034);queues['agentconnect'](_0x771034);}catch(_0x5d9ea2){utils[_0xfbd6('0x15')](util[_0xfbd6('0x18')](_0xfbd6('0x23'),_0x771034[_0xfbd6('0x1f')]),_0x5d9ea2);}});ami['on'](_0xfbd6('0x24'),function(_0x2188cf){try{utils['debug'](util[_0xfbd6('0x18')]('[%s][index][agentcomplete]',_0x2188cf[_0xfbd6('0x1f')]),_0x2188cf);agents['agentcomplete'](_0x2188cf);queues[_0xfbd6('0x24')](_0x2188cf);members[_0xfbd6('0x24')](_0x2188cf);}catch(_0x1f00be){utils[_0xfbd6('0x15')](util['format'](_0xfbd6('0x25'),_0x2188cf[_0xfbd6('0x1f')]),_0x1f00be);}});ami['on'](_0xfbd6('0x26'),function(_0x2f4297){try{utils['debug'](util[_0xfbd6('0x18')]('[%s][index][queuecallerabandon]',_0x2f4297[_0xfbd6('0x1f')]),_0x2f4297);agents[_0xfbd6('0x26')](_0x2f4297);queues[_0xfbd6('0x26')](_0x2f4297);}catch(_0x31bb17){utils[_0xfbd6('0x15')](util[_0xfbd6('0x18')](_0xfbd6('0x27'),_0x2f4297[_0xfbd6('0x1f')]),_0x31bb17);}});ami['on']('queuecallerjoin',function(_0x19cc95){try{utils[_0xfbd6('0x1d')](util[_0xfbd6('0x18')]('[%s][index][queuecallerjoin]',_0x19cc95[_0xfbd6('0x1f')]),_0x19cc95);queues['queuecallerjoin'](_0x19cc95);recordings['queuecallerjoin'](_0x19cc95);}catch(_0x5e959f){utils[_0xfbd6('0x15')](util['format']('[%s][index][queuecallerjoin]',_0x19cc95[_0xfbd6('0x1f')]),_0x5e959f);}});ami['on'](_0xfbd6('0x28'),function(_0x425d6e){try{utils[_0xfbd6('0x1d')](util[_0xfbd6('0x18')](_0xfbd6('0x29'),_0x425d6e[_0xfbd6('0x1f')]),_0x425d6e);queues[_0xfbd6('0x28')](_0x425d6e);}catch(_0x252d02){utils[_0xfbd6('0x15')](util[_0xfbd6('0x18')]('[%s][index][queuecallerleave]',_0x425d6e[_0xfbd6('0x1f')]),_0x252d02);}});ami['on']('musiconholdstart',function(_0x3a769f){try{utils[_0xfbd6('0x1d')](util[_0xfbd6('0x18')](_0xfbd6('0x2a'),_0x3a769f['uniqueid']),_0x3a769f);queues[_0xfbd6('0x2b')](_0x3a769f);calls['musiconholdstart'](_0x3a769f);}catch(_0x5e4d70){utils[_0xfbd6('0x15')](util[_0xfbd6('0x18')](_0xfbd6('0x2a'),_0x3a769f[_0xfbd6('0x1f')]),_0x5e4d70);}});ami['on'](_0xfbd6('0x2c'),function(_0x52d37d){try{utils[_0xfbd6('0x1d')](util[_0xfbd6('0x18')]('[%s][index][musiconholdstop]',_0x52d37d[_0xfbd6('0x1f')]),_0x52d37d);queues[_0xfbd6('0x2c')](_0x52d37d);calls[_0xfbd6('0x2c')](_0x52d37d);}catch(_0x3edb2e){utils['error'](util[_0xfbd6('0x18')](_0xfbd6('0x2d'),_0x52d37d[_0xfbd6('0x1f')]),_0x3edb2e);}});ami['on']('newstate',function(_0x15d533){try{utils[_0xfbd6('0x1d')](util[_0xfbd6('0x18')](_0xfbd6('0x2e'),_0x15d533[_0xfbd6('0x1f')]),_0x15d533);calls[_0xfbd6('0x2f')](_0x15d533);recordings[_0xfbd6('0x2f')](_0x15d533);}catch(_0x10dbec){utils[_0xfbd6('0x15')](util[_0xfbd6('0x18')](_0xfbd6('0x2e'),_0x15d533[_0xfbd6('0x1f')]),_0x10dbec);}});ami['on']('hangup',function(_0x564a3d){try{utils[_0xfbd6('0x1d')](util[_0xfbd6('0x18')](_0xfbd6('0x30'),_0x564a3d[_0xfbd6('0x1f')]),_0x564a3d);calls[_0xfbd6('0x31')](_0x564a3d);recordings[_0xfbd6('0x31')](_0x564a3d);dials[_0xfbd6('0x31')](_0x564a3d);agents[_0xfbd6('0x31')](_0x564a3d);queues[_0xfbd6('0x31')](_0x564a3d);}catch(_0x52618a){utils[_0xfbd6('0x15')](util[_0xfbd6('0x18')]('[%s][index][hangup]',_0x564a3d[_0xfbd6('0x1f')]),_0x52618a);}});ami['on'](_0xfbd6('0x32'),function(_0xb4794f){try{utils[_0xfbd6('0x1d')](util[_0xfbd6('0x18')](_0xfbd6('0x33'),_0xb4794f['uniqueid']),_0xb4794f);members[_0xfbd6('0x32')](_0xb4794f);}catch(_0x2ccd9c){utils[_0xfbd6('0x15')](util['format'](_0xfbd6('0x33'),_0xb4794f['uniqueid']),_0x2ccd9c);}});ami['on'](_0xfbd6('0x34'),function(_0x2015fd){try{utils['debug'](util[_0xfbd6('0x18')](_0xfbd6('0x35'),_0x2015fd[_0xfbd6('0x1f')]),_0x2015fd);queues[_0xfbd6('0x34')](_0x2015fd);agents[_0xfbd6('0x34')](_0x2015fd);transfers['blindtransfer'](_0x2015fd);}catch(_0x2fb3bd){utils[_0xfbd6('0x15')](util[_0xfbd6('0x18')](_0xfbd6('0x35'),_0x2015fd['uniqueid']),_0x2fb3bd);}});ami['on'](_0xfbd6('0x36'),function(_0x57aa4a){try{utils[_0xfbd6('0x1d')](util[_0xfbd6('0x18')](_0xfbd6('0x37'),_0x57aa4a[_0xfbd6('0x38')]),_0x57aa4a);queues[_0xfbd6('0x36')](_0x57aa4a);transfers[_0xfbd6('0x36')](_0x57aa4a);agents['attendedtransfer'](_0x57aa4a);calls[_0xfbd6('0x36')](_0x57aa4a);}catch(_0x133f2f){utils[_0xfbd6('0x15')](util['format'](_0xfbd6('0x37'),_0x57aa4a[_0xfbd6('0x38')]),_0x133f2f);}});ami['on'](_0xfbd6('0x39'),function(_0x20e684){try{utils[_0xfbd6('0x1d')](util[_0xfbd6('0x18')](_0xfbd6('0x3a'),_0x20e684['uniqueid']),_0x20e684);queues[_0xfbd6('0x39')](_0x20e684);recordings[_0xfbd6('0x39')](_0x20e684);calls[_0xfbd6('0x39')](_0x20e684);dials[_0xfbd6('0x39')](_0x20e684);}catch(_0xc2f36){utils['error'](util[_0xfbd6('0x18')](_0xfbd6('0x3a'),_0x20e684['uniqueid']),_0xc2f36);}});ami['on']('newexten',function(_0x2eca60){try{utils[_0xfbd6('0x1d')](util[_0xfbd6('0x18')](_0xfbd6('0x3b'),_0x2eca60[_0xfbd6('0x1f')]),_0x2eca60);calls[_0xfbd6('0x3c')](_0x2eca60);recordings[_0xfbd6('0x3c')](_0x2eca60);dials[_0xfbd6('0x3c')](_0x2eca60);}catch(_0x5149ae){utils['error'](util[_0xfbd6('0x18')]('[%s][index][newexten]',_0x2eca60['uniqueid']),_0x5149ae);}});ami['on'](_0xfbd6('0x3d'),function(_0x31fe41){try{utils[_0xfbd6('0x1d')](util[_0xfbd6('0x18')]('[%s][index][newchannel]',_0x31fe41[_0xfbd6('0x1f')]),_0x31fe41);calls[_0xfbd6('0x3d')](_0x31fe41);recordings['newchannel'](_0x31fe41);}catch(_0x5d8c65){utils[_0xfbd6('0x15')](util['format'](_0xfbd6('0x3e'),_0x31fe41['uniqueid']),_0x5d8c65);}});ami['on'](_0xfbd6('0x3f'),function(_0x22f184){try{utils['debug'](util['format'](_0xfbd6('0x40'),_0x22f184[_0xfbd6('0x1f')]),_0x22f184);dials[_0xfbd6('0x3f')](_0x22f184);}catch(_0x40d494){utils[_0xfbd6('0x15')](util[_0xfbd6('0x18')](_0xfbd6('0x41'),_0x22f184['uniqueid']),_0x40d494);}});ami['on'](_0xfbd6('0x42'),function(_0x1c2e95){try{utils[_0xfbd6('0x1d')](util['format'](_0xfbd6('0x43'),_0x1c2e95[_0xfbd6('0x1f')]),_0x1c2e95);dials[_0xfbd6('0x42')](_0x1c2e95);}catch(_0x17b908){utils[_0xfbd6('0x15')](util['format'](_0xfbd6('0x43'),_0x1c2e95[_0xfbd6('0x1f')]),_0x17b908);}});} \ No newline at end of file +var _0x2a6f=['format','[%s][index][devicestatechange]','device','debug','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','util','asterisk','username','xdr','disabled','info','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange'];(function(_0x4b79ad,_0x16d966){var _0x41a02c=function(_0x48d4c0){while(--_0x48d4c0){_0x4b79ad['push'](_0x4b79ad['shift']());}};_0x41a02c(++_0x16d966);}(_0x2a6f,0xdf));var _0xf2a6=function(_0x3cb142,_0x197877){_0x3cb142=_0x3cb142-0x0;var _0x42309e=_0x2a6f[_0x3cb142];return _0x42309e;};var AsteriskManager=require('asterisk-manager');var config=require(_0xf2a6('0x0'));var utils=require(_0xf2a6('0x1'));var util=require(_0xf2a6('0x2'));var ami=new AsteriskManager(config[_0xf2a6('0x3')]['port'],config[_0xf2a6('0x3')]['ip'],config[_0xf2a6('0x3')][_0xf2a6('0x4')],config[_0xf2a6('0x3')]['password'],!![]);ami['keepConnected']();if(config[_0xf2a6('0x5')]&&config[_0xf2a6('0x5')][_0xf2a6('0x6')]){utils[_0xf2a6('0x7')]('XDR\x20DISABLED');}else{var agents=require(_0xf2a6('0x8'));var calls=require(_0xf2a6('0x9'));var queues=require('./queues.controller');var recordings=require(_0xf2a6('0xa'));var members=require(_0xf2a6('0xb'));var dials=require(_0xf2a6('0xc'));var transfers=require('./transfers.controller');var core=require(_0xf2a6('0xd'));ami['on'](_0xf2a6('0xe'),core[_0xf2a6('0xe')]);ami['on'](_0xf2a6('0xf'),core[_0xf2a6('0xf')]);ami['on'](_0xf2a6('0x10'),core['fullybooted']);ami['on'](_0xf2a6('0x11'),core[_0xf2a6('0x11')]);ami['on'](_0xf2a6('0x12'),core[_0xf2a6('0x12')]);ami['on'](_0xf2a6('0x13'),core[_0xf2a6('0x13')]);ami['on'](_0xf2a6('0x14'),function(_0x291df1){try{utils['debug'](util[_0xf2a6('0x15')]('[%s][index][devicestatechange]',_0x291df1['device']),_0x291df1);members[_0xf2a6('0x14')](_0x291df1);}catch(_0x4bf19b){utils[_0xf2a6('0x11')](util[_0xf2a6('0x15')](_0xf2a6('0x16'),_0x291df1[_0xf2a6('0x17')]),_0x4bf19b);}});ami['on']('agentcalled',function(_0x3861f5){try{utils[_0xf2a6('0x18')](util[_0xf2a6('0x15')]('[%s][index][agentcalled]',_0x3861f5[_0xf2a6('0x19')]),_0x3861f5);agents['agentcalled'](_0x3861f5);}catch(_0x4357a9){utils[_0xf2a6('0x11')](util[_0xf2a6('0x15')]('[%s][index][agentcalled]',_0x3861f5[_0xf2a6('0x19')]),_0x4357a9);}});ami['on'](_0xf2a6('0x1a'),function(_0x329992){try{utils[_0xf2a6('0x18')](util['format'](_0xf2a6('0x1b'),_0x329992[_0xf2a6('0x19')]),_0x329992);agents[_0xf2a6('0x1a')](_0x329992);}catch(_0x24ea08){utils['error'](util[_0xf2a6('0x15')](_0xf2a6('0x1b'),_0x329992[_0xf2a6('0x19')]),_0x24ea08);}});ami['on']('agentconnect',function(_0x422494){try{utils[_0xf2a6('0x18')](util[_0xf2a6('0x15')]('[%s][index][agentconnect]',_0x422494[_0xf2a6('0x19')]),_0x422494);agents['agentconnect'](_0x422494);queues['agentconnect'](_0x422494);}catch(_0x4ab579){utils[_0xf2a6('0x11')](util[_0xf2a6('0x15')](_0xf2a6('0x1c'),_0x422494[_0xf2a6('0x19')]),_0x4ab579);}});ami['on']('agentcomplete',function(_0x3546f0){try{utils[_0xf2a6('0x18')](util['format'](_0xf2a6('0x1d'),_0x3546f0[_0xf2a6('0x19')]),_0x3546f0);agents[_0xf2a6('0x1e')](_0x3546f0);queues[_0xf2a6('0x1e')](_0x3546f0);members['agentcomplete'](_0x3546f0);}catch(_0x8d8742){utils['error'](util['format'](_0xf2a6('0x1d'),_0x3546f0['uniqueid']),_0x8d8742);}});ami['on'](_0xf2a6('0x1f'),function(_0x2ee574){try{utils[_0xf2a6('0x18')](util[_0xf2a6('0x15')](_0xf2a6('0x20'),_0x2ee574['uniqueid']),_0x2ee574);agents[_0xf2a6('0x1f')](_0x2ee574);queues['queuecallerabandon'](_0x2ee574);}catch(_0x33f952){utils[_0xf2a6('0x11')](util[_0xf2a6('0x15')]('[%s][index][queuecallerabandon]',_0x2ee574[_0xf2a6('0x19')]),_0x33f952);}});ami['on'](_0xf2a6('0x21'),function(_0x49cb87){try{utils[_0xf2a6('0x18')](util[_0xf2a6('0x15')](_0xf2a6('0x22'),_0x49cb87[_0xf2a6('0x19')]),_0x49cb87);queues[_0xf2a6('0x21')](_0x49cb87);recordings[_0xf2a6('0x21')](_0x49cb87);}catch(_0x41d672){utils[_0xf2a6('0x11')](util[_0xf2a6('0x15')](_0xf2a6('0x22'),_0x49cb87[_0xf2a6('0x19')]),_0x41d672);}});ami['on'](_0xf2a6('0x23'),function(_0x1b9ecf){try{utils[_0xf2a6('0x18')](util[_0xf2a6('0x15')](_0xf2a6('0x24'),_0x1b9ecf[_0xf2a6('0x19')]),_0x1b9ecf);queues[_0xf2a6('0x23')](_0x1b9ecf);}catch(_0x19b71c){utils['error'](util[_0xf2a6('0x15')]('[%s][index][queuecallerleave]',_0x1b9ecf['uniqueid']),_0x19b71c);}});ami['on']('musiconholdstart',function(_0x225fdd){try{utils[_0xf2a6('0x18')](util[_0xf2a6('0x15')](_0xf2a6('0x25'),_0x225fdd['uniqueid']),_0x225fdd);queues[_0xf2a6('0x26')](_0x225fdd);calls[_0xf2a6('0x26')](_0x225fdd);}catch(_0x40c1ac){utils[_0xf2a6('0x11')](util['format'](_0xf2a6('0x25'),_0x225fdd['uniqueid']),_0x40c1ac);}});ami['on'](_0xf2a6('0x27'),function(_0x9941db){try{utils[_0xf2a6('0x18')](util[_0xf2a6('0x15')]('[%s][index][musiconholdstop]',_0x9941db[_0xf2a6('0x19')]),_0x9941db);queues['musiconholdstop'](_0x9941db);calls[_0xf2a6('0x27')](_0x9941db);}catch(_0x3e9a72){utils[_0xf2a6('0x11')](util[_0xf2a6('0x15')](_0xf2a6('0x28'),_0x9941db[_0xf2a6('0x19')]),_0x3e9a72);}});ami['on'](_0xf2a6('0x29'),function(_0x23c47d){try{utils[_0xf2a6('0x18')](util[_0xf2a6('0x15')](_0xf2a6('0x2a'),_0x23c47d['uniqueid']),_0x23c47d);calls[_0xf2a6('0x29')](_0x23c47d);recordings[_0xf2a6('0x29')](_0x23c47d);}catch(_0x2d643a){utils['error'](util[_0xf2a6('0x15')](_0xf2a6('0x2a'),_0x23c47d[_0xf2a6('0x19')]),_0x2d643a);}});ami['on'](_0xf2a6('0x2b'),function(_0x332560){try{utils['debug'](util[_0xf2a6('0x15')](_0xf2a6('0x2c'),_0x332560[_0xf2a6('0x19')]),_0x332560);calls[_0xf2a6('0x2b')](_0x332560);recordings[_0xf2a6('0x2b')](_0x332560);dials[_0xf2a6('0x2b')](_0x332560);agents['hangup'](_0x332560);queues['hangup'](_0x332560);}catch(_0x2fbb18){utils[_0xf2a6('0x11')](util['format'](_0xf2a6('0x2c'),_0x332560[_0xf2a6('0x19')]),_0x2fbb18);}});ami['on'](_0xf2a6('0x2d'),function(_0x575550){try{utils[_0xf2a6('0x18')](util[_0xf2a6('0x15')]('[%s][index][cdr]',_0x575550[_0xf2a6('0x19')]),_0x575550);members[_0xf2a6('0x2d')](_0x575550);}catch(_0xc1d5e8){utils['error'](util[_0xf2a6('0x15')]('[%s][index][cdr]',_0x575550[_0xf2a6('0x19')]),_0xc1d5e8);}});ami['on'](_0xf2a6('0x2e'),function(_0x57efad){try{utils[_0xf2a6('0x18')](util['format'](_0xf2a6('0x2f'),_0x57efad['uniqueid']),_0x57efad);queues[_0xf2a6('0x2e')](_0x57efad);agents[_0xf2a6('0x2e')](_0x57efad);transfers[_0xf2a6('0x2e')](_0x57efad);}catch(_0x5b7d31){utils[_0xf2a6('0x11')](util[_0xf2a6('0x15')](_0xf2a6('0x2f'),_0x57efad[_0xf2a6('0x19')]),_0x5b7d31);}});ami['on']('attendedtransfer',function(_0x20bf07){try{utils[_0xf2a6('0x18')](util['format'](_0xf2a6('0x30'),_0x20bf07[_0xf2a6('0x31')]),_0x20bf07);queues[_0xf2a6('0x32')](_0x20bf07);transfers[_0xf2a6('0x32')](_0x20bf07);agents[_0xf2a6('0x32')](_0x20bf07);calls['attendedtransfer'](_0x20bf07);}catch(_0x3d94d6){utils[_0xf2a6('0x11')](util['format'](_0xf2a6('0x30'),_0x20bf07['origtransfereruniqueid']),_0x3d94d6);}});ami['on'](_0xf2a6('0x33'),function(_0x1b2ea6){try{utils[_0xf2a6('0x18')](util[_0xf2a6('0x15')](_0xf2a6('0x34'),_0x1b2ea6[_0xf2a6('0x19')]),_0x1b2ea6);queues[_0xf2a6('0x33')](_0x1b2ea6);recordings['varset'](_0x1b2ea6);calls['varset'](_0x1b2ea6);dials[_0xf2a6('0x33')](_0x1b2ea6);}catch(_0x241b37){utils[_0xf2a6('0x11')](util[_0xf2a6('0x15')](_0xf2a6('0x34'),_0x1b2ea6['uniqueid']),_0x241b37);}});ami['on'](_0xf2a6('0x35'),function(_0x2469a4){try{utils[_0xf2a6('0x18')](util[_0xf2a6('0x15')]('[%s][index][newexten]',_0x2469a4[_0xf2a6('0x19')]),_0x2469a4);calls[_0xf2a6('0x35')](_0x2469a4);recordings[_0xf2a6('0x35')](_0x2469a4);dials[_0xf2a6('0x35')](_0x2469a4);}catch(_0x20ee24){utils['error'](util[_0xf2a6('0x15')](_0xf2a6('0x36'),_0x2469a4[_0xf2a6('0x19')]),_0x20ee24);}});ami['on'](_0xf2a6('0x37'),function(_0x16808b){try{utils[_0xf2a6('0x18')](util[_0xf2a6('0x15')](_0xf2a6('0x38'),_0x16808b[_0xf2a6('0x19')]),_0x16808b);calls[_0xf2a6('0x37')](_0x16808b);recordings[_0xf2a6('0x37')](_0x16808b);}catch(_0x342deb){utils[_0xf2a6('0x11')](util[_0xf2a6('0x15')](_0xf2a6('0x38'),_0x16808b[_0xf2a6('0x19')]),_0x342deb);}});ami['on'](_0xf2a6('0x39'),function(_0x562286){try{utils[_0xf2a6('0x18')](util[_0xf2a6('0x15')]('[%s][index][dialbegin]',_0x562286[_0xf2a6('0x19')]),_0x562286);dials[_0xf2a6('0x39')](_0x562286);}catch(_0x486627){utils[_0xf2a6('0x11')](util['format'](_0xf2a6('0x3a'),_0x562286[_0xf2a6('0x19')]),_0x486627);}});ami['on'](_0xf2a6('0x3b'),function(_0x1d571e){try{utils[_0xf2a6('0x18')](util[_0xf2a6('0x15')](_0xf2a6('0x3c'),_0x1d571e[_0xf2a6('0x19')]),_0x1d571e);dials[_0xf2a6('0x3b')](_0x1d571e);}catch(_0x4490c0){utils[_0xf2a6('0x11')](util[_0xf2a6('0x15')]('[%s][index][dialend]',_0x1d571e['uniqueid']),_0x4490c0);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 7f49812..d055920 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 _0x757f=['getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','split','then','catch','error','[%s][members][writeDB]','some','startsWith','debug','[%s][members][devicestatechange]','device','state','INUSE','BUSY','TALKING','now','agent','NOT_INUSE','isNil','exitAt','enterAt','agentcomplete','queue','[%s][members][agentcomplete]','[%s][members][cdr]','channel','assign','data1','source','data3','destination','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','data2','membername','type'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x757f,0xee));var _0xf757=function(_0x412b2a,_0x11fb8a){_0x412b2a=_0x412b2a-0x0;var _0x5872e3=_0x757f[_0x412b2a];return _0x5872e3;};'use strict';var _=require(_0xf757('0x0'));var util=require('util');var utils=require(_0xf757('0x1'));var members={};var exclude=[_0xf757('0x2'),_0xf757('0x3')];function writeDB(_0x135d5e){utils[_0xf757('0x4')](util[_0xf757('0x5')](_0xf757('0x6'),_0x135d5e[_0xf757('0x7')],_0x135d5e[_0xf757('0x8')],_0x135d5e['channel'],_0x135d5e[_0xf757('0x9')],_0x135d5e[_0xf757('0xa')],_0x135d5e[_0xf757('0xb')]));if(_0x135d5e[_0xf757('0x8')]){utils[_0xf757('0xc')](_0x135d5e['interface'])['then'](function(_0x29f48c){if(_0x29f48c){_0x135d5e[_0xf757('0xa')]=_0x29f48c[_0xf757('0xd')];_0x135d5e[_0xf757('0xe')]=_0x29f48c['internal'];utils[_0xf757('0xf')](_0xf757('0x10'),_0x135d5e);}else{utils[_0xf757('0x11')](_0x135d5e[_0xf757('0x8')][_0xf757('0x12')]('/')[0x1])[_0xf757('0x13')](function(_0xbc9719){if(_0xbc9719){_0x135d5e[_0xf757('0xa')]=_0xbc9719[_0xf757('0xd')];_0x135d5e[_0xf757('0xe')]=_0xbc9719[_0xf757('0xe')];utils[_0xf757('0xf')](_0xf757('0x10'),_0x135d5e);}});}})[_0xf757('0x14')](function(_0x3dcfaa){utils[_0xf757('0x15')](util[_0xf757('0x5')](_0xf757('0x16'),_0x135d5e['uniqueid']),_0x3dcfaa);});}delete members[_0x135d5e[_0xf757('0x8')]];}function startsWith(_0x12fb35,_0x5c297e){return _[_0xf757('0x17')](_0x12fb35,function(_0x2b3540){return _[_0xf757('0x18')](_0x5c297e,_0x2b3540);});}exports['devicestatechange']=function(_0x1c5934){try{utils[_0xf757('0x19')](util[_0xf757('0x5')](_0xf757('0x1a'),members[_0x1c5934['device']]?members[_0x1c5934[_0xf757('0x1b')]][_0xf757('0x7')]:_0x1c5934[_0xf757('0x1b')]),_0x1c5934);utils[_0xf757('0x4')](util[_0xf757('0x5')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x1c5934['device']]?members[_0x1c5934[_0xf757('0x1b')]]['uniqueid']:_0x1c5934['device'],_0x1c5934[_0xf757('0x1c')],_0x1c5934[_0xf757('0x1b')]));switch(_0x1c5934['state']){case _0xf757('0x1d'):case _0xf757('0x1e'):if(!startsWith(exclude,_0x1c5934[_0xf757('0x1b')])){members[_0x1c5934[_0xf757('0x1b')]]={'channel':'voice','interface':_0x1c5934['device'],'type':_0xf757('0x1f'),'enterAt':utils[_0xf757('0x20')](),'role':_0xf757('0x21')};}break;case _0xf757('0x22'):if(!_[_0xf757('0x23')](members[_0x1c5934[_0xf757('0x1b')]])){members[_0x1c5934[_0xf757('0x1b')]][_0xf757('0x24')]=utils[_0xf757('0x20')]();members[_0x1c5934[_0xf757('0x1b')]]['duration']=utils['diffTime'](members[_0x1c5934[_0xf757('0x1b')]][_0xf757('0x24')],members[_0x1c5934[_0xf757('0x1b')]][_0xf757('0x25')]);if(members[_0x1c5934[_0xf757('0x1b')]][_0xf757('0x7')]){writeDB(members[_0x1c5934[_0xf757('0x1b')]]);}}break;default:break;}}catch(_0x180882){utils['error'](util['format'](_0xf757('0x1a'),members[_0x1c5934['device']]?members[_0x1c5934[_0xf757('0x1b')]]['uniqueid']:_0x1c5934[_0xf757('0x1b')]),_0x180882);}};exports[_0xf757('0x26')]=function(_0x52fea2){try{if(!_[_0xf757('0x23')](members[_0x52fea2[_0xf757('0x8')]])){utils[_0xf757('0x19')](util[_0xf757('0x5')]('[%s][members][agentcomplete]',_0x52fea2[_0xf757('0x7')]),_0x52fea2);utils['info'](util[_0xf757('0x5')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x52fea2[_0xf757('0x7')],_0x52fea2['interface'],_0x52fea2[_0xf757('0x27')]));members[_0x52fea2[_0xf757('0x8')]]=_['assign'](members[_0x52fea2[_0xf757('0x8')]],{'data4':_0x52fea2['queue'],'uniqueid':_0x52fea2[_0xf757('0x7')]});}}catch(_0x4a5e32){utils[_0xf757('0x15')](util[_0xf757('0x5')](_0xf757('0x28'),_0x52fea2[_0xf757('0x7')]),_0x4a5e32);}};exports['cdr']=function(_0x3fb69c){try{utils[_0xf757('0x19')](util[_0xf757('0x5')](_0xf757('0x29'),_0x3fb69c[_0xf757('0x7')]),_0x3fb69c);if(_0x3fb69c[_0xf757('0x2a')]){var _0xbb7cfd=_0x3fb69c[_0xf757('0x2a')][_0xf757('0x12')]('-')[0x0];if(!_['isNil'](members[_0xbb7cfd])){members[_0xbb7cfd]=_[_0xf757('0x2b')](members[_0xbb7cfd],{'data1':members[_0xbb7cfd][_0xf757('0x2c')]||_0x3fb69c[_0xf757('0xb')],'data2':members[_0xbb7cfd][_0xf757('0x9')]||_0x3fb69c[_0xf757('0x2d')],'data3':members[_0xbb7cfd][_0xf757('0x2e')]||_0x3fb69c[_0xf757('0x2f')],'uniqueid':members[_0xbb7cfd][_0xf757('0x7')]||_0x3fb69c[_0xf757('0x7')]});utils[_0xf757('0x4')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x3fb69c['uniqueid'],members[_0xbb7cfd]['data1'],members[_0xbb7cfd][_0xf757('0x9')],members[_0xbb7cfd][_0xf757('0x2e')]));if(members[_0xbb7cfd][_0xf757('0x24')]){writeDB(members[_0xbb7cfd]);}}}if(_0x3fb69c[_0xf757('0x30')]){var _0x3d06c3=_0x3fb69c['destinationchannel']['split']('-')[0x0];if(!_[_0xf757('0x23')](members[_0x3d06c3])){members[_0x3d06c3]=_[_0xf757('0x2b')](members[_0x3d06c3],{'data1':members[_0x3d06c3]['data1']||_0x3fb69c[_0xf757('0xb')],'data2':members[_0x3d06c3][_0xf757('0x9')]||_0x3fb69c['source'],'data3':members[_0x3d06c3][_0xf757('0x2e')]||_0x3fb69c[_0xf757('0x2f')],'uniqueid':members[_0x3d06c3][_0xf757('0x7')]||_0x3fb69c[_0xf757('0x7')]});utils['info'](util[_0xf757('0x5')](_0xf757('0x31'),_0x3fb69c[_0xf757('0x7')],members[_0x3d06c3][_0xf757('0x2c')],members[_0x3d06c3][_0xf757('0x9')],members[_0x3d06c3]['data3']));if(members[_0x3d06c3]['exitAt']){writeDB(members[_0x3d06c3]);}}}}catch(_0x3bcd45){utils[_0xf757('0x15')](util[_0xf757('0x5')](_0xf757('0x29'),_0x3fb69c[_0xf757('0x7')]),_0x3bcd45);}}; \ No newline at end of file +var _0x5d95=['destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','[%s][members][cdr]','lodash','util','Local/_attended@transfer','Queue:','info','format','channel','data2','interface','getUserByInterface','then','membername','internal','request','CreateMemberReport','getUserByName','split','catch','error','uniqueid','some','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','data1','type','source','destination','data3'];(function(_0x41b369,_0x29e21f){var _0x2af633=function(_0x588c87){while(--_0x588c87){_0x41b369['push'](_0x41b369['shift']());}};_0x2af633(++_0x29e21f);}(_0x5d95,0x161));var _0x55d9=function(_0x478b23,_0x4ee793){_0x478b23=_0x478b23-0x0;var _0x758196=_0x5d95[_0x478b23];return _0x758196;};'use strict';var _=require(_0x55d9('0x0'));var util=require(_0x55d9('0x1'));var utils=require('./utils');var members={};var exclude=[_0x55d9('0x2'),_0x55d9('0x3')];function writeDB(_0x29e725){utils[_0x55d9('0x4')](util[_0x55d9('0x5')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x29e725['uniqueid'],_0x29e725['interface'],_0x29e725[_0x55d9('0x6')],_0x29e725[_0x55d9('0x7')],_0x29e725['membername'],_0x29e725['type']));if(_0x29e725[_0x55d9('0x8')]){utils[_0x55d9('0x9')](_0x29e725['interface'])[_0x55d9('0xa')](function(_0x99d169){if(_0x99d169){_0x29e725[_0x55d9('0xb')]=_0x99d169['name'];_0x29e725[_0x55d9('0xc')]=_0x99d169[_0x55d9('0xc')];utils[_0x55d9('0xd')](_0x55d9('0xe'),_0x29e725);}else{utils[_0x55d9('0xf')](_0x29e725[_0x55d9('0x8')][_0x55d9('0x10')]('/')[0x1])[_0x55d9('0xa')](function(_0x7acd71){if(_0x7acd71){_0x29e725[_0x55d9('0xb')]=_0x7acd71['name'];_0x29e725[_0x55d9('0xc')]=_0x7acd71['internal'];utils[_0x55d9('0xd')](_0x55d9('0xe'),_0x29e725);}});}})[_0x55d9('0x11')](function(_0x11ad00){utils[_0x55d9('0x12')](util['format']('[%s][members][writeDB]',_0x29e725[_0x55d9('0x13')]),_0x11ad00);});}delete members[_0x29e725[_0x55d9('0x8')]];}function startsWith(_0xebfecb,_0x3fdd4b){return _[_0x55d9('0x14')](_0xebfecb,function(_0x46ae90){return _['startsWith'](_0x3fdd4b,_0x46ae90);});}exports['devicestatechange']=function(_0x373947){try{utils[_0x55d9('0x15')](util['format'](_0x55d9('0x16'),members[_0x373947[_0x55d9('0x17')]]?members[_0x373947[_0x55d9('0x17')]][_0x55d9('0x13')]:_0x373947[_0x55d9('0x17')]),_0x373947);utils[_0x55d9('0x4')](util['format'](_0x55d9('0x18'),members[_0x373947['device']]?members[_0x373947[_0x55d9('0x17')]]['uniqueid']:_0x373947['device'],_0x373947[_0x55d9('0x19')],_0x373947[_0x55d9('0x17')]));switch(_0x373947[_0x55d9('0x19')]){case _0x55d9('0x1a'):case _0x55d9('0x1b'):if(!startsWith(exclude,_0x373947['device'])){members[_0x373947['device']]={'channel':_0x55d9('0x1c'),'interface':_0x373947[_0x55d9('0x17')],'type':_0x55d9('0x1d'),'enterAt':utils[_0x55d9('0x1e')](),'role':'agent'};}break;case'NOT_INUSE':if(!_[_0x55d9('0x1f')](members[_0x373947[_0x55d9('0x17')]])){members[_0x373947['device']][_0x55d9('0x20')]=utils[_0x55d9('0x1e')]();members[_0x373947['device']][_0x55d9('0x21')]=utils[_0x55d9('0x22')](members[_0x373947[_0x55d9('0x17')]][_0x55d9('0x20')],members[_0x373947[_0x55d9('0x17')]][_0x55d9('0x23')]);if(members[_0x373947[_0x55d9('0x17')]]['uniqueid']){writeDB(members[_0x373947[_0x55d9('0x17')]]);}}break;default:break;}}catch(_0xe1394){utils[_0x55d9('0x12')](util[_0x55d9('0x5')]('[%s][members][devicestatechange]',members[_0x373947[_0x55d9('0x17')]]?members[_0x373947[_0x55d9('0x17')]][_0x55d9('0x13')]:_0x373947[_0x55d9('0x17')]),_0xe1394);}};exports[_0x55d9('0x24')]=function(_0x29008b){try{if(!_[_0x55d9('0x1f')](members[_0x29008b['interface']])){utils[_0x55d9('0x15')](util[_0x55d9('0x5')](_0x55d9('0x25'),_0x29008b[_0x55d9('0x13')]),_0x29008b);utils[_0x55d9('0x4')](util[_0x55d9('0x5')](_0x55d9('0x26'),_0x29008b['uniqueid'],_0x29008b[_0x55d9('0x8')],_0x29008b[_0x55d9('0x27')]));members[_0x29008b[_0x55d9('0x8')]]=_[_0x55d9('0x28')](members[_0x29008b[_0x55d9('0x8')]],{'data4':_0x29008b[_0x55d9('0x27')],'uniqueid':_0x29008b[_0x55d9('0x13')]});}}catch(_0x1f1c88){utils[_0x55d9('0x12')](util[_0x55d9('0x5')](_0x55d9('0x25'),_0x29008b['uniqueid']),_0x1f1c88);}};exports[_0x55d9('0x29')]=function(_0x2bbe84){try{utils[_0x55d9('0x15')](util[_0x55d9('0x5')]('[%s][members][cdr]',_0x2bbe84[_0x55d9('0x13')]),_0x2bbe84);if(_0x2bbe84[_0x55d9('0x6')]){var _0x552e8a=_0x2bbe84[_0x55d9('0x6')][_0x55d9('0x10')]('-')[0x0];if(!_[_0x55d9('0x1f')](members[_0x552e8a])){members[_0x552e8a]=_['assign'](members[_0x552e8a],{'data1':members[_0x552e8a][_0x55d9('0x2a')]||_0x2bbe84[_0x55d9('0x2b')],'data2':members[_0x552e8a][_0x55d9('0x7')]||_0x2bbe84[_0x55d9('0x2c')],'data3':members[_0x552e8a]['data3']||_0x2bbe84[_0x55d9('0x2d')],'uniqueid':members[_0x552e8a]['uniqueid']||_0x2bbe84['uniqueid']});utils[_0x55d9('0x4')](util[_0x55d9('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x2bbe84[_0x55d9('0x13')],members[_0x552e8a][_0x55d9('0x2a')],members[_0x552e8a]['data2'],members[_0x552e8a][_0x55d9('0x2e')]));if(members[_0x552e8a][_0x55d9('0x20')]){writeDB(members[_0x552e8a]);}}}if(_0x2bbe84[_0x55d9('0x2f')]){var _0x395865=_0x2bbe84[_0x55d9('0x2f')]['split']('-')[0x0];if(!_[_0x55d9('0x1f')](members[_0x395865])){members[_0x395865]=_['assign'](members[_0x395865],{'data1':members[_0x395865][_0x55d9('0x2a')]||_0x2bbe84[_0x55d9('0x2b')],'data2':members[_0x395865][_0x55d9('0x7')]||_0x2bbe84[_0x55d9('0x2c')],'data3':members[_0x395865][_0x55d9('0x2e')]||_0x2bbe84[_0x55d9('0x2d')],'uniqueid':members[_0x395865][_0x55d9('0x13')]||_0x2bbe84[_0x55d9('0x13')]});utils[_0x55d9('0x4')](util[_0x55d9('0x5')](_0x55d9('0x30'),_0x2bbe84['uniqueid'],members[_0x395865][_0x55d9('0x2a')],members[_0x395865]['data2'],members[_0x395865][_0x55d9('0x2e')]));if(members[_0x395865][_0x55d9('0x20')]){writeDB(members[_0x395865]);}}}}catch(_0x3b1fe3){utils[_0x55d9('0x12')](util['format'](_0x55d9('0x31'),_0x2bbe84[_0x55d9('0x13')]),_0x3b1fe3);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index a98908b..16895f9 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 _0x0f63=['accountcode','agentcomplete','[%s][queues][agentcomplete]','assigned','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDED','transferexten','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','transfertargetuniqueid','calleridname','queuecallerjoinAt','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','mohtime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','info','format','uniqueid','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','error','[%s][queues][hangup]','[%s][queues][varset]','variable','value','toUpperCase','queuecallerexitAt','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerabandonAt','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','queuecallerleave','holdtime','diffTime','count','connectedlinenum','connectedlinename','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode'];(function(_0x513d09,_0x5cd567){var _0x1b6eb9=function(_0x5d7baf){while(--_0x5d7baf){_0x513d09['push'](_0x513d09['shift']());}};_0x1b6eb9(++_0x5cd567);}(_0x0f63,0x94));var _0x30f6=function(_0x29a33d,_0x513e84){_0x29a33d=_0x29a33d-0x0;var _0x5479c3=_0x0f63[_0x29a33d];return _0x5479c3;};'use strict';var _=require(_0x30f6('0x0'));var util=require(_0x30f6('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x1d232a){utils[_0x30f6('0x2')](util[_0x30f6('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x1d232a[_0x30f6('0x4')],_0x1d232a[_0x30f6('0x5')],_0x1d232a[_0x30f6('0x6')],_0x1d232a[_0x30f6('0x7')],_0x1d232a[_0x30f6('0x8')],_0x1d232a['accountcode'],_0x1d232a[_0x30f6('0x9')]));if(_0x1d232a[_0x30f6('0x6')]){utils[_0x30f6('0xa')](_0x1d232a[_0x30f6('0x6')])[_0x30f6('0xb')](function(_0x2ba617){if(_0x2ba617){_0x1d232a[_0x30f6('0xc')]=_0x2ba617[_0x30f6('0xc')];}utils[_0x30f6('0xd')]('CreateVoiceQueueReport',_0x1d232a);});}else{utils['request'](_0x30f6('0xe'),_0x1d232a);}if(_0x1d232a[_0x30f6('0xf')]){delete queues[_0x1d232a[_0x30f6('0xf')]];}else{delete queues[_0x1d232a[_0x30f6('0x4')]];}}exports[_0x30f6('0x10')]=function(_0x42f6bd){try{utils[_0x30f6('0x11')](util['format']('[%s][queues][queuecallerjoin]',_0x42f6bd[_0x30f6('0x4')]),_0x42f6bd);utils['info'](util['format'](_0x30f6('0x12'),_0x42f6bd[_0x30f6('0x4')],_0x42f6bd[_0x30f6('0x6')],_0x42f6bd[_0x30f6('0x13')]));queues[_0x42f6bd[_0x30f6('0x4')]]=_[_0x30f6('0x14')](_0x42f6bd,{'originalposition':_0x42f6bd[_0x30f6('0x13')],'queuecallerjoinAt':utils[_0x30f6('0x15')](),'mohtime':0x0});}catch(_0x18155c){utils['error'](util['format']('[%s][queues][queuecallerjoin]',_0x42f6bd['uniqueid']),_0x18155c);}};exports[_0x30f6('0x16')]=function(_0x362855){try{if(!_[_0x30f6('0x17')](queues[_0x362855[_0x30f6('0x4')]])){utils[_0x30f6('0x11')](util[_0x30f6('0x3')]('[%s][queues][hangup]',_0x362855[_0x30f6('0x4')]),_0x362855);if(queues[_0x362855['uniqueid']][_0x30f6('0x18')]){if(!queues[_0x362855[_0x30f6('0x4')]][_0x30f6('0x19')]&&!queues[_0x362855[_0x30f6('0x4')]][_0x30f6('0x1a')]){queues[_0x362855['uniqueid']][_0x30f6('0x1b')]=!![];queues[_0x362855[_0x30f6('0x4')]][_0x30f6('0x1c')]=utils[_0x30f6('0x15')]();queues[_0x362855[_0x30f6('0x4')]]['queuecallerexitreason']=_0x30f6('0x1d');}utils[_0x30f6('0x2')](util[_0x30f6('0x3')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x362855[_0x30f6('0x4')],queues[_0x362855[_0x30f6('0x4')]][_0x30f6('0x1e')],queues[_0x362855[_0x30f6('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x362855['uniqueid']]);}else if(queues[_0x362855[_0x30f6('0x4')]][_0x30f6('0xf')]){utils['info'](util[_0x30f6('0x3')](_0x30f6('0x1f'),_0x362855[_0x30f6('0x4')],queues[_0x362855['uniqueid']][_0x30f6('0x1e')],queues[_0x362855[_0x30f6('0x4')]][_0x30f6('0xf')]));queues[queues[_0x362855[_0x30f6('0x4')]]['transfereduniqueid']]=queues[_0x362855[_0x30f6('0x4')]];queues[queues[_0x362855[_0x30f6('0x4')]][_0x30f6('0xf')]]['queuecallerenterreason']=0x2;delete queues[_0x362855[_0x30f6('0x4')]];}}}catch(_0x1a730e){utils[_0x30f6('0x20')](util['format'](_0x30f6('0x21'),_0x362855[_0x30f6('0x4')]),_0x1a730e);}};exports['varset']=function(_0xf891d9){try{utils[_0x30f6('0x11')](util['format'](_0x30f6('0x22'),_0xf891d9[_0x30f6('0x4')]),_0xf891d9);if(!_[_0x30f6('0x17')](_0xf891d9[_0x30f6('0x23')]['queuestatus'])&&_0xf891d9[_0x30f6('0x24')][_0x30f6('0x25')]()!=='CONTINUE'){if(!_[_0x30f6('0x17')](queues[_0xf891d9[_0x30f6('0x4')]])){queues[_0xf891d9[_0x30f6('0x4')]]['queuecallerabandon']=![];queues[_0xf891d9['uniqueid']]['queuecallerabandonAt']=null;queues[_0xf891d9[_0x30f6('0x4')]][_0x30f6('0x1a')]=!![];queues[_0xf891d9[_0x30f6('0x4')]][_0x30f6('0x26')]=utils['now']();queues[_0xf891d9[_0x30f6('0x4')]][_0x30f6('0x9')]=_0xf891d9[_0x30f6('0x24')][_0x30f6('0x25')]();utils[_0x30f6('0x2')](util[_0x30f6('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0xf891d9['uniqueid'],queues[_0xf891d9[_0x30f6('0x4')]]['name'],_0xf891d9[_0x30f6('0x24')],queues[_0xf891d9[_0x30f6('0x4')]][_0x30f6('0x9')]));writeDB(queues[_0xf891d9['uniqueid']]);}}else if(!_[_0x30f6('0x17')](_0xf891d9[_0x30f6('0x23')][_0x30f6('0x27')])){if(!_[_0x30f6('0x17')](queues[_0xf891d9[_0x30f6('0x4')]])&&!queues[_0xf891d9[_0x30f6('0x4')]][_0x30f6('0x19')]){queues[_0xf891d9[_0x30f6('0x4')]][_0x30f6('0x19')]=![];queues[_0xf891d9[_0x30f6('0x4')]]['queuecallerabandonAt']=null;queues[_0xf891d9[_0x30f6('0x4')]]['queuecallerexit']=!![];queues[_0xf891d9[_0x30f6('0x4')]][_0x30f6('0x26')]=utils[_0x30f6('0x15')]();queues[_0xf891d9[_0x30f6('0x4')]][_0x30f6('0x9')]='EXITWITHKEY';utils['info'](util[_0x30f6('0x3')](_0x30f6('0x28'),_0xf891d9[_0x30f6('0x4')],queues[_0xf891d9[_0x30f6('0x4')]][_0x30f6('0x1e')],_0xf891d9[_0x30f6('0x24')],queues[_0xf891d9[_0x30f6('0x4')]][_0x30f6('0x9')]));}}}catch(_0x1ee55d){utils[_0x30f6('0x20')](util[_0x30f6('0x3')](_0x30f6('0x22'),_0xf891d9['uniqueid']),_0x1ee55d);}};exports[_0x30f6('0x19')]=function(_0x2881e9){try{if(!_[_0x30f6('0x17')](queues[_0x2881e9[_0x30f6('0x4')]])){utils[_0x30f6('0x11')](util[_0x30f6('0x3')](_0x30f6('0x29'),_0x2881e9['uniqueid']),_0x2881e9);queues[_0x2881e9[_0x30f6('0x4')]]['queuecallerexit']=![];queues[_0x2881e9['uniqueid']][_0x30f6('0x26')]=null;queues[_0x2881e9[_0x30f6('0x4')]][_0x30f6('0x19')]=!![];queues[_0x2881e9[_0x30f6('0x4')]][_0x30f6('0x2a')]=utils[_0x30f6('0x15')]();queues[_0x2881e9['uniqueid']]['queuecallerexitreason']=_0x30f6('0x2b');utils['info'](util[_0x30f6('0x3')](_0x30f6('0x2c'),_0x2881e9[_0x30f6('0x4')],queues[_0x2881e9[_0x30f6('0x4')]][_0x30f6('0x1e')],queues[_0x2881e9[_0x30f6('0x4')]][_0x30f6('0x9')]));}}catch(_0xb1d974){utils[_0x30f6('0x20')](util[_0x30f6('0x3')](_0x30f6('0x29'),_0x2881e9[_0x30f6('0x4')]),_0xb1d974);}};exports['queuecallerleave']=function(_0x1f24f7){try{if(!_[_0x30f6('0x17')](queues[_0x1f24f7[_0x30f6('0x4')]])){utils[_0x30f6('0x11')](util['format'](_0x30f6('0x2d'),_0x1f24f7[_0x30f6('0x4')]),_0x1f24f7);utils[_0x30f6('0x2')](util[_0x30f6('0x3')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x1f24f7['uniqueid'],queues[_0x1f24f7['uniqueid']][_0x30f6('0x1e')],_0x1f24f7['connectedlinenum'],_0x1f24f7['connectedlinename']));queues[_0x1f24f7[_0x30f6('0x4')]][_0x30f6('0x2e')]=!![];queues[_0x1f24f7[_0x30f6('0x4')]]['queuecallerleaveAt']=utils[_0x30f6('0x15')]();queues[_0x1f24f7['uniqueid']][_0x30f6('0x2f')]=utils[_0x30f6('0x30')](queues[_0x1f24f7[_0x30f6('0x4')]][_0x30f6('0x18')],queues[_0x1f24f7[_0x30f6('0x4')]]['queuecallerjoinAt']);queues[_0x1f24f7[_0x30f6('0x4')]]['position']=_0x1f24f7[_0x30f6('0x13')];queues[_0x1f24f7[_0x30f6('0x4')]][_0x30f6('0x31')]=_0x1f24f7[_0x30f6('0x31')];queues[_0x1f24f7[_0x30f6('0x4')]][_0x30f6('0x32')]=_0x1f24f7['connectedlinenum'];queues[_0x1f24f7[_0x30f6('0x4')]][_0x30f6('0x33')]=_0x1f24f7[_0x30f6('0x33')];}}catch(_0x17368f){utils['error'](util[_0x30f6('0x3')](_0x30f6('0x2d'),_0x1f24f7['uniqueid']),_0x17368f);}};exports[_0x30f6('0x34')]=function(_0x5a8ce1){try{if(!_[_0x30f6('0x17')](queues[_0x5a8ce1[_0x30f6('0x4')]])){utils['debug'](util['format'](_0x30f6('0x35'),_0x5a8ce1['uniqueid']),_0x5a8ce1);utils[_0x30f6('0x2')](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x5a8ce1[_0x30f6('0x4')],queues[_0x5a8ce1[_0x30f6('0x4')]][_0x30f6('0x1e')],_0x5a8ce1[_0x30f6('0x36')],_0x5a8ce1[_0x30f6('0x37')]));queues[_0x5a8ce1[_0x30f6('0x4')]][_0x30f6('0x19')]=![];queues[_0x5a8ce1[_0x30f6('0x4')]]['queuecallerabandon']=![];queues[_0x5a8ce1[_0x30f6('0x4')]][_0x30f6('0x2a')]=null;queues[_0x5a8ce1[_0x30f6('0x4')]][_0x30f6('0x1a')]=![];queues[_0x5a8ce1[_0x30f6('0x4')]][_0x30f6('0x9')]=null;queues[_0x5a8ce1['uniqueid']][_0x30f6('0x26')]=null;queues[_0x5a8ce1[_0x30f6('0x4')]]['assigned']=!![];queues[_0x5a8ce1[_0x30f6('0x4')]][_0x30f6('0x38')]=_0x5a8ce1['destaccountcode'];queues[_0x5a8ce1[_0x30f6('0x4')]][_0x30f6('0x7')]=_0x5a8ce1[_0x30f6('0x36')];}}catch(_0x16cf9b){utils['error'](util[_0x30f6('0x3')]('[%s][queues][agentconnect]',_0x5a8ce1[_0x30f6('0x4')]),_0x16cf9b);}};exports[_0x30f6('0x39')]=function(_0xc49ed7){try{if(!_[_0x30f6('0x17')](queues[_0xc49ed7[_0x30f6('0x4')]])){if(queues[_0xc49ed7['uniqueid']][_0x30f6('0x18')]){utils[_0x30f6('0x11')](util[_0x30f6('0x3')](_0x30f6('0x3a'),_0xc49ed7[_0x30f6('0x4')]),_0xc49ed7);queues[_0xc49ed7['uniqueid']][_0x30f6('0x19')]=![];queues[_0xc49ed7['uniqueid']][_0x30f6('0x19')]=![];queues[_0xc49ed7[_0x30f6('0x4')]]['queuecallerabandonAt']=null;queues[_0xc49ed7[_0x30f6('0x4')]]['queuecallerexit']=![];queues[_0xc49ed7[_0x30f6('0x4')]][_0x30f6('0x26')]=null;queues[_0xc49ed7[_0x30f6('0x4')]][_0x30f6('0x3b')]=!![];queues[_0xc49ed7['uniqueid']][_0x30f6('0x7')]=_0xc49ed7[_0x30f6('0x36')];queues[_0xc49ed7[_0x30f6('0x4')]]['queuecallercomplete']=!![];queues[_0xc49ed7['uniqueid']][_0x30f6('0x1c')]=utils[_0x30f6('0x15')]();if(_0xc49ed7[_0x30f6('0x3c')]==_0x30f6('0x3d')){if(!queues[_0xc49ed7[_0x30f6('0x4')]]['transfer']){queues[_0xc49ed7['uniqueid']][_0x30f6('0x9')]=_0x30f6('0x3e');}}else{queues[_0xc49ed7['uniqueid']][_0x30f6('0x9')]=_0x30f6('0x3f')+_0xc49ed7[_0x30f6('0x3c')][_0x30f6('0x25')]();}utils['info'](util['format'](_0x30f6('0x40'),_0xc49ed7[_0x30f6('0x4')],queues[_0xc49ed7[_0x30f6('0x4')]]['name'],_0xc49ed7[_0x30f6('0x36')],queues[_0xc49ed7['uniqueid']][_0x30f6('0x9')]));writeDB(queues[_0xc49ed7['uniqueid']]);}}}catch(_0x217dfe){utils[_0x30f6('0x20')](util[_0x30f6('0x3')](_0x30f6('0x3a'),_0xc49ed7[_0x30f6('0x4')]),_0x217dfe);}};exports[_0x30f6('0x41')]=function(_0x5b7343){try{if(!_['isNil'](queues[_0x5b7343[_0x30f6('0x42')]])){utils['debug'](util['format'](_0x30f6('0x43'),_0x5b7343[_0x30f6('0x4')]),_0x5b7343);queues[_0x5b7343['transfereeuniqueid']][_0x30f6('0x3d')]=!![];queues[_0x5b7343[_0x30f6('0x42')]][_0x30f6('0x44')]=_0x30f6('0x45');queues[_0x5b7343[_0x30f6('0x42')]]['transferexten']=_0x5b7343[_0x30f6('0x46')];queues[_0x5b7343[_0x30f6('0x42')]][_0x30f6('0x47')]=_0x5b7343[_0x30f6('0x42')];queues[_0x5b7343[_0x30f6('0x42')]][_0x30f6('0x9')]=_0x30f6('0x48');utils['info'](util[_0x30f6('0x3')](_0x30f6('0x49'),_0x5b7343['uniqueid'],queues[_0x5b7343['transfereeuniqueid']]['name'],_0x5b7343[_0x30f6('0x42')],_0x5b7343[_0x30f6('0x46')]));}}catch(_0x5ad16c){utils['error'](util[_0x30f6('0x3')](_0x30f6('0x43'),_0x5b7343['uniqueid']),_0x5ad16c);}};exports[_0x30f6('0x4a')]=function(_0x47293a){try{utils['debug'](util[_0x30f6('0x3')]('[%s][queues][attendedtransfer]',_0x47293a[_0x30f6('0x4b')]),_0x47293a);if(_0x47293a['origtransfereruniqueid']==_0x47293a[_0x30f6('0x4c')]){if(!_[_0x30f6('0x17')](queues[_0x47293a[_0x30f6('0x4d')]])){utils[_0x30f6('0x2')](util[_0x30f6('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x47293a[_0x30f6('0x4b')],queues[_0x47293a[_0x30f6('0x4d')]][_0x30f6('0x1e')],_0x47293a[_0x30f6('0x4e')]));queues[_0x47293a[_0x30f6('0x4d')]]['transfer']=!![];queues[_0x47293a[_0x30f6('0x4d')]][_0x30f6('0x44')]=_0x30f6('0x4f');queues[_0x47293a[_0x30f6('0x4d')]][_0x30f6('0x50')]=_0x47293a[_0x30f6('0x4e')];queues[_0x47293a['secondtransfererlinkedid']][_0x30f6('0x47')]=_0x47293a['origtransfereruniqueid'];queues[_0x47293a[_0x30f6('0x4d')]][_0x30f6('0x9')]=_0x30f6('0x51');}if(!_[_0x30f6('0x17')](queues[_0x47293a[_0x30f6('0x4c')]])){if(_0x47293a[_0x30f6('0x52')]&&queues[_0x47293a['transfereelinkedid']]){queues[_0x47293a[_0x30f6('0x52')]][_0x30f6('0x53')]=0x1;queues[_0x47293a[_0x30f6('0x42')]]=_['clone'](queues[_0x47293a[_0x30f6('0x52')]]);queues[_0x47293a[_0x30f6('0x42')]][_0x30f6('0xf')]=_0x47293a[_0x30f6('0x54')];queues[_0x47293a[_0x30f6('0x42')]]['queuecallerenterreason']=0x2;queues[_0x47293a['transfereeuniqueid']][_0x30f6('0x8')]=queues[_0x47293a[_0x30f6('0x4d')]][_0x30f6('0x8')];queues[_0x47293a[_0x30f6('0x42')]][_0x30f6('0x55')]=queues[_0x47293a[_0x30f6('0x4d')]][_0x30f6('0x55')];queues[_0x47293a[_0x30f6('0x42')]][_0x30f6('0x56')]=utils['now']();queues[_0x47293a[_0x30f6('0x42')]][_0x30f6('0x18')]=utils['now']();queues[_0x47293a[_0x30f6('0x42')]][_0x30f6('0x2f')]=0x0;queues[_0x47293a[_0x30f6('0x42')]]['mohtime']=0x0;utils[_0x30f6('0x2')](util[_0x30f6('0x3')](_0x30f6('0x57'),_0x47293a[_0x30f6('0x4b')],queues[_0x47293a[_0x30f6('0x42')]][_0x30f6('0x1e')],queues[_0x47293a[_0x30f6('0x42')]][_0x30f6('0x8')],queues[_0x47293a['transfereeuniqueid']][_0x30f6('0x55')]));}else{utils[_0x30f6('0x2')](util['format'](_0x30f6('0x58'),_0x47293a[_0x30f6('0x4b')],queues[_0x47293a[_0x30f6('0x4c')]][_0x30f6('0x1e')],_0x47293a[_0x30f6('0x4d')]));queues[_0x47293a[_0x30f6('0x4c')]][_0x30f6('0xf')]=_0x47293a[_0x30f6('0x4d')];}}}else if(_0x47293a[_0x30f6('0x59')]==_0x47293a[_0x30f6('0x4d')]){if(!_[_0x30f6('0x17')](queues[_0x47293a[_0x30f6('0x4c')]])){utils[_0x30f6('0x2')](util[_0x30f6('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x47293a[_0x30f6('0x4b')],queues[_0x47293a['origtransfererlinkedid']][_0x30f6('0x1e')],_0x47293a[_0x30f6('0x59')],_0x47293a[_0x30f6('0x5a')]));queues[_0x47293a[_0x30f6('0x4c')]][_0x30f6('0x3d')]=!![];queues[_0x47293a['origtransfererlinkedid']][_0x30f6('0x44')]='ATTENDED';queues[_0x47293a[_0x30f6('0x4c')]][_0x30f6('0x50')]=_0x47293a[_0x30f6('0x5a')];queues[_0x47293a[_0x30f6('0x4c')]][_0x30f6('0x47')]=_0x47293a[_0x30f6('0x59')];queues[_0x47293a[_0x30f6('0x4c')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0x30f6('0x17')](queues[_0x47293a[_0x30f6('0x4d')]])){if(_0x47293a['transfertargetlinkedid']&&queues[_0x47293a[_0x30f6('0x5b')]]){queues[_0x47293a[_0x30f6('0x5b')]][_0x30f6('0x53')]=0x1;queues[_0x47293a['transfertargetuniqueid']]=_[_0x30f6('0x5c')](queues[_0x47293a[_0x30f6('0x5b')]]);queues[_0x47293a[_0x30f6('0x54')]][_0x30f6('0xf')]=_0x47293a[_0x30f6('0x54')];queues[_0x47293a[_0x30f6('0x54')]]['queuecallerenterreason']=0x2;queues[_0x47293a[_0x30f6('0x54')]][_0x30f6('0x8')]=queues[_0x47293a['origtransfererlinkedid']][_0x30f6('0x8')];queues[_0x47293a[_0x30f6('0x54')]][_0x30f6('0x55')]=queues[_0x47293a[_0x30f6('0x4c')]][_0x30f6('0x55')];queues[_0x47293a[_0x30f6('0x54')]][_0x30f6('0x56')]=utils[_0x30f6('0x15')]();queues[_0x47293a[_0x30f6('0x54')]][_0x30f6('0x18')]=utils['now']();queues[_0x47293a[_0x30f6('0x54')]]['holdtime']=0x0;queues[_0x47293a[_0x30f6('0x54')]]['mohtime']=0x0;utils[_0x30f6('0x2')](util[_0x30f6('0x3')](_0x30f6('0x5d'),_0x47293a[_0x30f6('0x4b')],queues[_0x47293a[_0x30f6('0x54')]][_0x30f6('0x1e')],queues[_0x47293a[_0x30f6('0x54')]][_0x30f6('0xf')],queues[_0x47293a[_0x30f6('0x54')]][_0x30f6('0x8')],queues[_0x47293a[_0x30f6('0x54')]]['calleridname']));}else{utils[_0x30f6('0x2')](util[_0x30f6('0x3')](_0x30f6('0x58'),_0x47293a[_0x30f6('0x4b')],queues[_0x47293a['secondtransfererlinkedid']][_0x30f6('0x1e')],_0x47293a[_0x30f6('0x4c')]));queues[_0x47293a[_0x30f6('0x4d')]][_0x30f6('0xf')]=_0x47293a['origtransfererlinkedid'];}}}}catch(_0x395fdb){utils[_0x30f6('0x20')](util[_0x30f6('0x3')](_0x30f6('0x5e'),_0x47293a[_0x30f6('0x4b')]),_0x395fdb);}};exports['musiconholdstart']=function(_0x2ec360){try{if(!_[_0x30f6('0x17')](queues[_0x2ec360['uniqueid']])){utils['debug'](util['format'](_0x30f6('0x5f'),_0x2ec360['uniqueid']),_0x2ec360);queues[_0x2ec360[_0x30f6('0x4')]][_0x30f6('0x60')]=utils[_0x30f6('0x15')]();utils[_0x30f6('0x2')](util['format'](_0x30f6('0x61'),_0x2ec360[_0x30f6('0x4')],queues[_0x2ec360[_0x30f6('0x4')]]['name'],queues[_0x2ec360[_0x30f6('0x4')]]['musiconholdstartAt']));}}catch(_0x121357){utils[_0x30f6('0x20')](util[_0x30f6('0x3')](_0x30f6('0x5f'),_0x2ec360[_0x30f6('0x4')]),_0x121357);}};exports[_0x30f6('0x62')]=function(_0x248601){try{if(!_[_0x30f6('0x17')](queues[_0x248601[_0x30f6('0x4')]])){if(!_[_0x30f6('0x17')](queues[_0x248601['uniqueid']][_0x30f6('0x60')])){utils[_0x30f6('0x11')](util['format'](_0x30f6('0x63'),_0x248601[_0x30f6('0x4')]),_0x248601);queues[_0x248601['uniqueid']][_0x30f6('0x64')]+=utils['diffTime'](utils[_0x30f6('0x15')](),queues[_0x248601[_0x30f6('0x4')]]['musiconholdstartAt']);utils['info'](util[_0x30f6('0x3')](_0x30f6('0x65'),_0x248601[_0x30f6('0x4')],queues[_0x248601['uniqueid']][_0x30f6('0x1e')],queues[_0x248601[_0x30f6('0x4')]][_0x30f6('0x64')]));delete queues[_0x248601[_0x30f6('0x4')]][_0x30f6('0x60')];}}}catch(_0x2b4eed){utils[_0x30f6('0x20')](util[_0x30f6('0x3')](_0x30f6('0x63'),_0x248601[_0x30f6('0x4')]),_0x2b4eed);}}; \ No newline at end of file +var _0xd35e=['agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','clone','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','util','./utils','format','uniqueid','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','queuestatus','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','connectedlinenum','holdtime','diffTime','count','connectedlinename','[%s][queues][queuecallerleave]','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','accountcode','destaccountcode'];(function(_0x363d28,_0x54258d){var _0x283e53=function(_0x274ddf){while(--_0x274ddf){_0x363d28['push'](_0x363d28['shift']());}};_0x283e53(++_0x54258d);}(_0xd35e,0x101));var _0xed35=function(_0x2a5262,_0x578588){_0x2a5262=_0x2a5262-0x0;var _0x483802=_0xd35e[_0x2a5262];return _0x483802;};'use strict';var _=require('lodash');var util=require(_0xed35('0x0'));var utils=require(_0xed35('0x1'));var queues={};function writeDB(_0x3ea9c2){utils['info'](util[_0xed35('0x2')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x3ea9c2[_0xed35('0x3')],_0x3ea9c2[_0xed35('0x4')],_0x3ea9c2[_0xed35('0x5')],_0x3ea9c2[_0xed35('0x6')],_0x3ea9c2[_0xed35('0x7')],_0x3ea9c2['accountcode'],_0x3ea9c2[_0xed35('0x8')]));if(_0x3ea9c2[_0xed35('0x5')]){utils[_0xed35('0x9')](_0x3ea9c2[_0xed35('0x5')])[_0xed35('0xa')](function(_0x291a9e){if(_0x291a9e){_0x3ea9c2[_0xed35('0xb')]=_0x291a9e[_0xed35('0xb')];}utils[_0xed35('0xc')](_0xed35('0xd'),_0x3ea9c2);});}else{utils[_0xed35('0xc')](_0xed35('0xd'),_0x3ea9c2);}if(_0x3ea9c2[_0xed35('0xe')]){delete queues[_0x3ea9c2[_0xed35('0xe')]];}else{delete queues[_0x3ea9c2[_0xed35('0x3')]];}}exports['queuecallerjoin']=function(_0x16dbc1){try{utils[_0xed35('0xf')](util[_0xed35('0x2')](_0xed35('0x10'),_0x16dbc1[_0xed35('0x3')]),_0x16dbc1);utils[_0xed35('0x11')](util[_0xed35('0x2')](_0xed35('0x12'),_0x16dbc1[_0xed35('0x3')],_0x16dbc1[_0xed35('0x5')],_0x16dbc1[_0xed35('0x13')]));queues[_0x16dbc1[_0xed35('0x3')]]=_[_0xed35('0x14')](_0x16dbc1,{'originalposition':_0x16dbc1[_0xed35('0x13')],'queuecallerjoinAt':utils[_0xed35('0x15')](),'mohtime':0x0});}catch(_0x55b2c9){utils[_0xed35('0x16')](util[_0xed35('0x2')](_0xed35('0x10'),_0x16dbc1[_0xed35('0x3')]),_0x55b2c9);}};exports[_0xed35('0x17')]=function(_0x383a29){try{if(!_[_0xed35('0x18')](queues[_0x383a29[_0xed35('0x3')]])){utils['debug'](util['format'](_0xed35('0x19'),_0x383a29[_0xed35('0x3')]),_0x383a29);if(queues[_0x383a29[_0xed35('0x3')]][_0xed35('0x1a')]){if(!queues[_0x383a29[_0xed35('0x3')]]['queuecallerabandon']&&!queues[_0x383a29['uniqueid']][_0xed35('0x1b')]){queues[_0x383a29[_0xed35('0x3')]][_0xed35('0x1c')]=!![];queues[_0x383a29['uniqueid']]['queuecallercompleteAt']=utils[_0xed35('0x15')]();queues[_0x383a29['uniqueid']][_0xed35('0x8')]=_0xed35('0x1d');}utils[_0xed35('0x11')](util['format'](_0xed35('0x1e'),_0x383a29[_0xed35('0x3')],queues[_0x383a29[_0xed35('0x3')]][_0xed35('0x1f')],queues[_0x383a29[_0xed35('0x3')]][_0xed35('0x8')]));writeDB(queues[_0x383a29[_0xed35('0x3')]]);}else if(queues[_0x383a29['uniqueid']][_0xed35('0xe')]){utils[_0xed35('0x11')](util[_0xed35('0x2')](_0xed35('0x20'),_0x383a29[_0xed35('0x3')],queues[_0x383a29[_0xed35('0x3')]]['name'],queues[_0x383a29['uniqueid']][_0xed35('0xe')]));queues[queues[_0x383a29[_0xed35('0x3')]]['transfereduniqueid']]=queues[_0x383a29['uniqueid']];queues[queues[_0x383a29[_0xed35('0x3')]][_0xed35('0xe')]][_0xed35('0x21')]=0x2;delete queues[_0x383a29[_0xed35('0x3')]];}}}catch(_0x4f8e5f){utils[_0xed35('0x16')](util['format'](_0xed35('0x19'),_0x383a29[_0xed35('0x3')]),_0x4f8e5f);}};exports[_0xed35('0x22')]=function(_0x319437){try{utils[_0xed35('0xf')](util['format'](_0xed35('0x23'),_0x319437[_0xed35('0x3')]),_0x319437);if(!_[_0xed35('0x18')](_0x319437['variable'][_0xed35('0x24')])&&_0x319437['value'][_0xed35('0x25')]()!==_0xed35('0x26')){if(!_['isNil'](queues[_0x319437[_0xed35('0x3')]])){queues[_0x319437[_0xed35('0x3')]][_0xed35('0x27')]=![];queues[_0x319437[_0xed35('0x3')]][_0xed35('0x28')]=null;queues[_0x319437[_0xed35('0x3')]][_0xed35('0x1b')]=!![];queues[_0x319437[_0xed35('0x3')]][_0xed35('0x29')]=utils[_0xed35('0x15')]();queues[_0x319437['uniqueid']]['queuecallerexitreason']=_0x319437[_0xed35('0x2a')][_0xed35('0x25')]();utils[_0xed35('0x11')](util[_0xed35('0x2')](_0xed35('0x2b'),_0x319437[_0xed35('0x3')],queues[_0x319437[_0xed35('0x3')]][_0xed35('0x1f')],_0x319437['value'],queues[_0x319437['uniqueid']][_0xed35('0x8')]));writeDB(queues[_0x319437[_0xed35('0x3')]]);}}else if(!_[_0xed35('0x18')](_0x319437[_0xed35('0x2c')][_0xed35('0x2d')])){if(!_[_0xed35('0x18')](queues[_0x319437[_0xed35('0x3')]])&&!queues[_0x319437[_0xed35('0x3')]][_0xed35('0x27')]){queues[_0x319437[_0xed35('0x3')]][_0xed35('0x27')]=![];queues[_0x319437[_0xed35('0x3')]][_0xed35('0x28')]=null;queues[_0x319437[_0xed35('0x3')]]['queuecallerexit']=!![];queues[_0x319437[_0xed35('0x3')]][_0xed35('0x29')]=utils[_0xed35('0x15')]();queues[_0x319437['uniqueid']][_0xed35('0x8')]=_0xed35('0x2e');utils[_0xed35('0x11')](util[_0xed35('0x2')](_0xed35('0x2f'),_0x319437['uniqueid'],queues[_0x319437[_0xed35('0x3')]][_0xed35('0x1f')],_0x319437[_0xed35('0x2a')],queues[_0x319437[_0xed35('0x3')]][_0xed35('0x8')]));}}}catch(_0x486506){utils['error'](util['format']('[%s][queues][varset]',_0x319437[_0xed35('0x3')]),_0x486506);}};exports[_0xed35('0x27')]=function(_0x142ee7){try{if(!_[_0xed35('0x18')](queues[_0x142ee7[_0xed35('0x3')]])){utils[_0xed35('0xf')](util[_0xed35('0x2')](_0xed35('0x30'),_0x142ee7[_0xed35('0x3')]),_0x142ee7);queues[_0x142ee7[_0xed35('0x3')]][_0xed35('0x1b')]=![];queues[_0x142ee7[_0xed35('0x3')]][_0xed35('0x29')]=null;queues[_0x142ee7['uniqueid']][_0xed35('0x27')]=!![];queues[_0x142ee7['uniqueid']]['queuecallerabandonAt']=utils[_0xed35('0x15')]();queues[_0x142ee7[_0xed35('0x3')]][_0xed35('0x8')]=_0xed35('0x31');utils[_0xed35('0x11')](util[_0xed35('0x2')](_0xed35('0x32'),_0x142ee7[_0xed35('0x3')],queues[_0x142ee7[_0xed35('0x3')]][_0xed35('0x1f')],queues[_0x142ee7[_0xed35('0x3')]][_0xed35('0x8')]));}}catch(_0x4eeccd){utils[_0xed35('0x16')](util[_0xed35('0x2')](_0xed35('0x30'),_0x142ee7[_0xed35('0x3')]),_0x4eeccd);}};exports[_0xed35('0x33')]=function(_0x902cd1){try{if(!_[_0xed35('0x18')](queues[_0x902cd1[_0xed35('0x3')]])){utils['debug'](util[_0xed35('0x2')]('[%s][queues][queuecallerleave]',_0x902cd1[_0xed35('0x3')]),_0x902cd1);utils[_0xed35('0x11')](util['format']('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x902cd1[_0xed35('0x3')],queues[_0x902cd1[_0xed35('0x3')]]['name'],_0x902cd1[_0xed35('0x34')],_0x902cd1['connectedlinename']));queues[_0x902cd1[_0xed35('0x3')]]['queuecallerleave']=!![];queues[_0x902cd1[_0xed35('0x3')]][_0xed35('0x1a')]=utils[_0xed35('0x15')]();queues[_0x902cd1['uniqueid']][_0xed35('0x35')]=utils[_0xed35('0x36')](queues[_0x902cd1[_0xed35('0x3')]][_0xed35('0x1a')],queues[_0x902cd1[_0xed35('0x3')]]['queuecallerjoinAt']);queues[_0x902cd1[_0xed35('0x3')]][_0xed35('0x13')]=_0x902cd1[_0xed35('0x13')];queues[_0x902cd1['uniqueid']][_0xed35('0x37')]=_0x902cd1[_0xed35('0x37')];queues[_0x902cd1['uniqueid']][_0xed35('0x34')]=_0x902cd1[_0xed35('0x34')];queues[_0x902cd1['uniqueid']][_0xed35('0x38')]=_0x902cd1[_0xed35('0x38')];}}catch(_0x18865d){utils[_0xed35('0x16')](util[_0xed35('0x2')](_0xed35('0x39'),_0x902cd1['uniqueid']),_0x18865d);}};exports['agentconnect']=function(_0x57403c){try{if(!_[_0xed35('0x18')](queues[_0x57403c[_0xed35('0x3')]])){utils[_0xed35('0xf')](util[_0xed35('0x2')](_0xed35('0x3a'),_0x57403c[_0xed35('0x3')]),_0x57403c);utils[_0xed35('0x11')](util[_0xed35('0x2')](_0xed35('0x3b'),_0x57403c['uniqueid'],queues[_0x57403c['uniqueid']][_0xed35('0x1f')],_0x57403c[_0xed35('0x3c')],_0x57403c['destaccountcode']));queues[_0x57403c[_0xed35('0x3')]][_0xed35('0x27')]=![];queues[_0x57403c['uniqueid']][_0xed35('0x27')]=![];queues[_0x57403c[_0xed35('0x3')]]['queuecallerabandonAt']=null;queues[_0x57403c[_0xed35('0x3')]][_0xed35('0x1b')]=![];queues[_0x57403c[_0xed35('0x3')]][_0xed35('0x8')]=null;queues[_0x57403c[_0xed35('0x3')]][_0xed35('0x29')]=null;queues[_0x57403c[_0xed35('0x3')]][_0xed35('0x3d')]=!![];queues[_0x57403c[_0xed35('0x3')]][_0xed35('0x3e')]=_0x57403c[_0xed35('0x3f')];queues[_0x57403c[_0xed35('0x3')]][_0xed35('0x6')]=_0x57403c[_0xed35('0x3c')];}}catch(_0x3e9d8f){utils[_0xed35('0x16')](util[_0xed35('0x2')]('[%s][queues][agentconnect]',_0x57403c[_0xed35('0x3')]),_0x3e9d8f);}};exports[_0xed35('0x40')]=function(_0xb2621d){try{if(!_[_0xed35('0x18')](queues[_0xb2621d[_0xed35('0x3')]])){if(queues[_0xb2621d[_0xed35('0x3')]][_0xed35('0x1a')]){utils[_0xed35('0xf')](util[_0xed35('0x2')](_0xed35('0x41'),_0xb2621d[_0xed35('0x3')]),_0xb2621d);queues[_0xb2621d[_0xed35('0x3')]]['queuecallerabandon']=![];queues[_0xb2621d[_0xed35('0x3')]][_0xed35('0x27')]=![];queues[_0xb2621d[_0xed35('0x3')]][_0xed35('0x28')]=null;queues[_0xb2621d[_0xed35('0x3')]]['queuecallerexit']=![];queues[_0xb2621d[_0xed35('0x3')]]['queuecallerexitAt']=null;queues[_0xb2621d[_0xed35('0x3')]]['assigned']=!![];queues[_0xb2621d[_0xed35('0x3')]][_0xed35('0x6')]=_0xb2621d[_0xed35('0x3c')];queues[_0xb2621d[_0xed35('0x3')]][_0xed35('0x1c')]=!![];queues[_0xb2621d[_0xed35('0x3')]]['queuecallercompleteAt']=utils[_0xed35('0x15')]();if(_0xb2621d[_0xed35('0x42')]=='transfer'){if(!queues[_0xb2621d['uniqueid']][_0xed35('0x43')]){queues[_0xb2621d['uniqueid']][_0xed35('0x8')]=_0xed35('0x44');}}else{queues[_0xb2621d['uniqueid']]['queuecallerexitreason']=_0xed35('0x45')+_0xb2621d[_0xed35('0x42')][_0xed35('0x25')]();}utils[_0xed35('0x11')](util[_0xed35('0x2')](_0xed35('0x46'),_0xb2621d[_0xed35('0x3')],queues[_0xb2621d[_0xed35('0x3')]][_0xed35('0x1f')],_0xb2621d[_0xed35('0x3c')],queues[_0xb2621d[_0xed35('0x3')]][_0xed35('0x8')]));writeDB(queues[_0xb2621d[_0xed35('0x3')]]);}}}catch(_0x306697){utils[_0xed35('0x16')](util[_0xed35('0x2')](_0xed35('0x41'),_0xb2621d[_0xed35('0x3')]),_0x306697);}};exports[_0xed35('0x47')]=function(_0x5ba16){try{if(!_[_0xed35('0x18')](queues[_0x5ba16['transfereeuniqueid']])){utils[_0xed35('0xf')](util['format'](_0xed35('0x48'),_0x5ba16[_0xed35('0x3')]),_0x5ba16);queues[_0x5ba16[_0xed35('0x49')]]['transfer']=!![];queues[_0x5ba16[_0xed35('0x49')]][_0xed35('0x4a')]=_0xed35('0x4b');queues[_0x5ba16['transfereeuniqueid']][_0xed35('0x4c')]=_0x5ba16[_0xed35('0x4d')];queues[_0x5ba16[_0xed35('0x49')]][_0xed35('0x4e')]=_0x5ba16[_0xed35('0x49')];queues[_0x5ba16['transfereeuniqueid']]['queuecallerexitreason']=_0xed35('0x4f');utils[_0xed35('0x11')](util[_0xed35('0x2')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x5ba16['uniqueid'],queues[_0x5ba16[_0xed35('0x49')]]['name'],_0x5ba16['transfereeuniqueid'],_0x5ba16['extension']));}}catch(_0x512135){utils[_0xed35('0x16')](util[_0xed35('0x2')](_0xed35('0x48'),_0x5ba16['uniqueid']),_0x512135);}};exports[_0xed35('0x50')]=function(_0x285ddf){try{utils[_0xed35('0xf')](util[_0xed35('0x2')](_0xed35('0x51'),_0x285ddf[_0xed35('0x52')]),_0x285ddf);if(_0x285ddf[_0xed35('0x52')]==_0x285ddf[_0xed35('0x53')]){if(!_[_0xed35('0x18')](queues[_0x285ddf[_0xed35('0x54')]])){utils[_0xed35('0x11')](util[_0xed35('0x2')](_0xed35('0x55'),_0x285ddf[_0xed35('0x52')],queues[_0x285ddf['secondtransfererlinkedid']][_0xed35('0x1f')],_0x285ddf[_0xed35('0x56')]));queues[_0x285ddf[_0xed35('0x54')]][_0xed35('0x43')]=!![];queues[_0x285ddf[_0xed35('0x54')]][_0xed35('0x4a')]=_0xed35('0x57');queues[_0x285ddf[_0xed35('0x54')]][_0xed35('0x4c')]=_0x285ddf['origtransfererexten'];queues[_0x285ddf[_0xed35('0x54')]][_0xed35('0x4e')]=_0x285ddf[_0xed35('0x52')];queues[_0x285ddf[_0xed35('0x54')]][_0xed35('0x8')]=_0xed35('0x58');}if(!_[_0xed35('0x18')](queues[_0x285ddf[_0xed35('0x53')]])){if(_0x285ddf[_0xed35('0x59')]&&queues[_0x285ddf[_0xed35('0x59')]]){queues[_0x285ddf[_0xed35('0x59')]][_0xed35('0x21')]=0x1;queues[_0x285ddf[_0xed35('0x49')]]=_['clone'](queues[_0x285ddf['transfereelinkedid']]);queues[_0x285ddf[_0xed35('0x49')]]['transfereduniqueid']=_0x285ddf['transfertargetuniqueid'];queues[_0x285ddf['transfereeuniqueid']][_0xed35('0x21')]=0x2;queues[_0x285ddf[_0xed35('0x49')]][_0xed35('0x7')]=queues[_0x285ddf[_0xed35('0x54')]][_0xed35('0x7')];queues[_0x285ddf[_0xed35('0x49')]]['calleridname']=queues[_0x285ddf[_0xed35('0x54')]][_0xed35('0x5a')];queues[_0x285ddf[_0xed35('0x49')]][_0xed35('0x5b')]=utils['now']();queues[_0x285ddf[_0xed35('0x49')]][_0xed35('0x1a')]=utils[_0xed35('0x15')]();queues[_0x285ddf[_0xed35('0x49')]]['holdtime']=0x0;queues[_0x285ddf[_0xed35('0x49')]][_0xed35('0x5c')]=0x0;utils[_0xed35('0x11')](util['format'](_0xed35('0x5d'),_0x285ddf[_0xed35('0x52')],queues[_0x285ddf[_0xed35('0x49')]][_0xed35('0x1f')],queues[_0x285ddf[_0xed35('0x49')]][_0xed35('0x7')],queues[_0x285ddf['transfereeuniqueid']][_0xed35('0x5a')]));}else{utils['info'](util[_0xed35('0x2')](_0xed35('0x5e'),_0x285ddf['origtransfereruniqueid'],queues[_0x285ddf[_0xed35('0x53')]][_0xed35('0x1f')],_0x285ddf[_0xed35('0x54')]));queues[_0x285ddf[_0xed35('0x53')]][_0xed35('0xe')]=_0x285ddf['secondtransfererlinkedid'];}}}else if(_0x285ddf[_0xed35('0x5f')]==_0x285ddf[_0xed35('0x54')]){if(!_[_0xed35('0x18')](queues[_0x285ddf[_0xed35('0x53')]])){utils['info'](util[_0xed35('0x2')](_0xed35('0x60'),_0x285ddf[_0xed35('0x52')],queues[_0x285ddf[_0xed35('0x53')]]['name'],_0x285ddf[_0xed35('0x5f')],_0x285ddf[_0xed35('0x61')]));queues[_0x285ddf['origtransfererlinkedid']][_0xed35('0x43')]=!![];queues[_0x285ddf[_0xed35('0x53')]][_0xed35('0x4a')]=_0xed35('0x57');queues[_0x285ddf[_0xed35('0x53')]]['transferexten']=_0x285ddf[_0xed35('0x61')];queues[_0x285ddf[_0xed35('0x53')]][_0xed35('0x4e')]=_0x285ddf[_0xed35('0x5f')];queues[_0x285ddf[_0xed35('0x53')]][_0xed35('0x8')]=_0xed35('0x58');}if(!_[_0xed35('0x18')](queues[_0x285ddf['secondtransfererlinkedid']])){if(_0x285ddf[_0xed35('0x62')]&&queues[_0x285ddf[_0xed35('0x62')]]){queues[_0x285ddf[_0xed35('0x62')]][_0xed35('0x21')]=0x1;queues[_0x285ddf[_0xed35('0x63')]]=_[_0xed35('0x64')](queues[_0x285ddf['transfertargetlinkedid']]);queues[_0x285ddf[_0xed35('0x63')]]['transfereduniqueid']=_0x285ddf[_0xed35('0x63')];queues[_0x285ddf[_0xed35('0x63')]][_0xed35('0x21')]=0x2;queues[_0x285ddf[_0xed35('0x63')]][_0xed35('0x7')]=queues[_0x285ddf[_0xed35('0x53')]]['calleridnum'];queues[_0x285ddf[_0xed35('0x63')]][_0xed35('0x5a')]=queues[_0x285ddf[_0xed35('0x53')]][_0xed35('0x5a')];queues[_0x285ddf[_0xed35('0x63')]][_0xed35('0x5b')]=utils[_0xed35('0x15')]();queues[_0x285ddf['transfertargetuniqueid']]['queuecallerleaveAt']=utils[_0xed35('0x15')]();queues[_0x285ddf[_0xed35('0x63')]]['holdtime']=0x0;queues[_0x285ddf['transfertargetuniqueid']][_0xed35('0x5c')]=0x0;utils[_0xed35('0x11')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x285ddf[_0xed35('0x52')],queues[_0x285ddf[_0xed35('0x63')]][_0xed35('0x1f')],queues[_0x285ddf[_0xed35('0x63')]][_0xed35('0xe')],queues[_0x285ddf[_0xed35('0x63')]][_0xed35('0x7')],queues[_0x285ddf[_0xed35('0x63')]][_0xed35('0x5a')]));}else{utils[_0xed35('0x11')](util[_0xed35('0x2')](_0xed35('0x5e'),_0x285ddf[_0xed35('0x52')],queues[_0x285ddf[_0xed35('0x54')]][_0xed35('0x1f')],_0x285ddf[_0xed35('0x53')]));queues[_0x285ddf[_0xed35('0x54')]][_0xed35('0xe')]=_0x285ddf['origtransfererlinkedid'];}}}}catch(_0x416266){utils['error'](util[_0xed35('0x2')](_0xed35('0x51'),_0x285ddf[_0xed35('0x52')]),_0x416266);}};exports[_0xed35('0x65')]=function(_0x1ed589){try{if(!_[_0xed35('0x18')](queues[_0x1ed589[_0xed35('0x3')]])){utils[_0xed35('0xf')](util['format'](_0xed35('0x66'),_0x1ed589[_0xed35('0x3')]),_0x1ed589);queues[_0x1ed589[_0xed35('0x3')]]['musiconholdstartAt']=utils['now']();utils[_0xed35('0x11')](util[_0xed35('0x2')](_0xed35('0x67'),_0x1ed589[_0xed35('0x3')],queues[_0x1ed589['uniqueid']][_0xed35('0x1f')],queues[_0x1ed589[_0xed35('0x3')]][_0xed35('0x68')]));}}catch(_0x76570f){utils['error'](util[_0xed35('0x2')](_0xed35('0x66'),_0x1ed589['uniqueid']),_0x76570f);}};exports['musiconholdstop']=function(_0x535804){try{if(!_[_0xed35('0x18')](queues[_0x535804[_0xed35('0x3')]])){if(!_[_0xed35('0x18')](queues[_0x535804[_0xed35('0x3')]][_0xed35('0x68')])){utils[_0xed35('0xf')](util[_0xed35('0x2')]('[%s][queues][musiconholdstop]',_0x535804[_0xed35('0x3')]),_0x535804);queues[_0x535804['uniqueid']][_0xed35('0x5c')]+=utils['diffTime'](utils[_0xed35('0x15')](),queues[_0x535804['uniqueid']][_0xed35('0x68')]);utils['info'](util['format'](_0xed35('0x69'),_0x535804[_0xed35('0x3')],queues[_0x535804['uniqueid']][_0xed35('0x1f')],queues[_0x535804[_0xed35('0x3')]][_0xed35('0x5c')]));delete queues[_0x535804['uniqueid']]['musiconholdstartAt'];}}}catch(_0x5447b2){utils[_0xed35('0x16')](util[_0xed35('0x2')](_0xed35('0x6a'),_0x535804[_0xed35('0x3')]),_0x5447b2);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 19a5d71..b61f5d8 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 _0x68b4=['getUserByInternal','membername','name','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','uniqueid','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','newstate','[%s][recordings][newstate]','isNil','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable','debug','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','type','outbound','connectedlinename','forEach','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','lodash','util','./utils','info','format','[%s][recordings][writeDB]','accountcode'];(function(_0x100682,_0x11afec){var _0xcb6e87=function(_0x3ef421){while(--_0x3ef421){_0x100682['push'](_0x100682['shift']());}};_0xcb6e87(++_0x11afec);}(_0x68b4,0xc2));var _0x468b=function(_0x340b4a,_0x5efbfd){_0x340b4a=_0x340b4a-0x0;var _0xfdf6eb=_0x68b4[_0x340b4a];return _0xfdf6eb;};'use strict';var _=require(_0x468b('0x0'));var util=require(_0x468b('0x1'));var utils=require(_0x468b('0x2'));var recordings={};function writeDB(_0x52fe6c){utils[_0x468b('0x3')](util[_0x468b('0x4')](_0x468b('0x5'),_0x52fe6c['uniqueid']));if(_0x52fe6c[_0x468b('0x6')]){utils[_0x468b('0x7')](_0x52fe6c['accountcode'])['then'](function(_0x75d102){if(_0x75d102){_0x52fe6c[_0x468b('0x8')]=_0x75d102[_0x468b('0x9')];_0x52fe6c[_0x468b('0xa')]=_0x75d102['id'];}utils[_0x468b('0xb')]('CreateVoiceRecording',_0x52fe6c);});}else{utils[_0x468b('0xb')](_0x468b('0xc'),_0x52fe6c);}}exports[_0x468b('0xd')]=function(_0x277560){try{utils['debug'](util[_0x468b('0x4')](_0x468b('0xe'),_0x277560[_0x468b('0xf')]),_0x277560);if(_0x277560[_0x468b('0xf')]==_0x277560[_0x468b('0x10')]){utils[_0x468b('0x3')](util[_0x468b('0x4')](_0x468b('0x11'),_0x277560[_0x468b('0xf')],_0x277560['context'],_0x277560[_0x468b('0x12')]));recordings[_0x277560['uniqueid']]={'uniqueid':_0x277560[_0x468b('0xf')],'accountcode':_0x277560[_0x468b('0x6')],'exten':_0x277560[_0x468b('0x12')],'context':_0x277560[_0x468b('0x13')],'channel':_0x277560[_0x468b('0x14')],'monitors':[]};}}catch(_0x2e64d9){utils['error'](util[_0x468b('0x4')](_0x468b('0xe'),_0x277560[_0x468b('0xf')]),_0x2e64d9);}};exports[_0x468b('0x15')]=function(_0x186c57){try{utils['debug'](util[_0x468b('0x4')](_0x468b('0x16'),_0x186c57[_0x468b('0xf')]),_0x186c57);if(!_[_0x468b('0x17')](recordings[_0x186c57['uniqueid']])&&_0x186c57[_0x468b('0x18')]==0x6){utils[_0x468b('0x3')](util[_0x468b('0x4')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x186c57['uniqueid'],_0x186c57[_0x468b('0x13')],_0x186c57[_0x468b('0x14')]));}else if(!_[_0x468b('0x17')](recordings[_0x186c57[_0x468b('0x10')]])&&_0x186c57['channelstate']==0x6&&_0x186c57[_0x468b('0x13')]!=_0x468b('0x19')){utils[_0x468b('0x3')](util[_0x468b('0x4')](_0x468b('0x1a'),_0x186c57[_0x468b('0xf')],_0x186c57[_0x468b('0x10')],_0x186c57[_0x468b('0x13')],_0x186c57[_0x468b('0x14')]));recordings[_0x186c57[_0x468b('0x10')]][_0x468b('0x6')]=_0x186c57[_0x468b('0x6')];}}catch(_0xfd8b14){utils[_0x468b('0x1b')](util[_0x468b('0x4')](_0x468b('0x16'),_0x186c57[_0x468b('0xf')]),_0xfd8b14);}};exports[_0x468b('0x1c')]=function(_0x167702){try{if(!_[_0x468b('0x17')](_0x167702[_0x468b('0x1d')])&&!_[_0x468b('0x17')](_0x167702[_0x468b('0x1d')]['mixmonitor_filename'])){utils[_0x468b('0x1e')](util[_0x468b('0x4')](_0x468b('0x1f'),_0x167702[_0x468b('0xf')]),_0x167702);utils[_0x468b('0x3')](util[_0x468b('0x4')](_0x468b('0x20'),_0x167702[_0x468b('0xf')],_0x167702['variable'],_0x167702[_0x468b('0x21')]));if(_[_0x468b('0x22')](_0x167702[_0x468b('0x21')],_0x468b('0x23'))){_0x167702[_0x468b('0x21')]=_0x167702[_0x468b('0x21')][_0x468b('0x24')](_0x468b('0x23'),_0x468b('0x25'));}if(recordings[_0x167702[_0x468b('0x10')]]){var _0x4de4bf=_[_0x468b('0x26')](recordings[_0x167702[_0x468b('0x10')]][_0x468b('0x27')],{'value':_0x167702[_0x468b('0x21')]});if(_['isNil'](_0x4de4bf)){recordings[_0x167702[_0x468b('0x10')]][_0x468b('0x27')][_0x468b('0x28')]({'value':_0x167702[_0x468b('0x21')]});}}}}catch(_0x3a04b8){utils[_0x468b('0x1b')](util['format'](_0x468b('0x1f'),_0x167702[_0x468b('0xf')]),_0x3a04b8);}};exports[_0x468b('0x29')]=function(_0x596c0e){try{if(!_[_0x468b('0x17')](recordings[_0x596c0e[_0x468b('0xf')]])){utils[_0x468b('0x1e')](util[_0x468b('0x4')](_0x468b('0x2a'),_0x596c0e[_0x468b('0xf')]),_0x596c0e);utils[_0x468b('0x3')](util[_0x468b('0x4')](_0x468b('0x2b'),_0x596c0e[_0x468b('0xf')],_0x596c0e[_0x468b('0x2c')],_0x596c0e[_0x468b('0x2d')],_0x596c0e[_0x468b('0x2e')]));recordings[_0x596c0e[_0x468b('0xf')]][_0x468b('0x2c')]=_0x596c0e[_0x468b('0x2c')];recordings[_0x596c0e[_0x468b('0xf')]]['calleridname']=_0x596c0e[_0x468b('0x2d')];recordings[_0x596c0e[_0x468b('0xf')]][_0x468b('0x2f')]=_0x596c0e[_0x468b('0x2f')];recordings[_0x596c0e[_0x468b('0xf')]]['connectedlinename']=_0x596c0e['connectedlinename'];if(recordings[_0x596c0e[_0x468b('0xf')]][_0x468b('0x30')]==_0x468b('0x31')&&recordings[_0x596c0e['uniqueid']][_0x468b('0x6')]){recordings[_0x596c0e['uniqueid']]['connectedlinenum']=recordings[_0x596c0e[_0x468b('0xf')]][_0x468b('0x6')];recordings[_0x596c0e[_0x468b('0xf')]][_0x468b('0x32')]='';}recordings[_0x596c0e['uniqueid']][_0x468b('0x27')][_0x468b('0x33')](function(_0x169e79){var _0x232d6a=_[_0x468b('0x34')](recordings[_0x596c0e['uniqueid']]);_0x232d6a[_0x468b('0x21')]=_0x169e79[_0x468b('0x21')];writeDB(_0x232d6a);});delete recordings[_0x596c0e[_0x468b('0xf')]];}}catch(_0x4f6967){utils['error'](util['format'](_0x468b('0x2a'),_0x596c0e[_0x468b('0xf')]),_0x4f6967);}};exports[_0x468b('0x35')]=function(_0x220161){try{if(!_[_0x468b('0x17')](recordings[_0x220161[_0x468b('0xf')]])){utils[_0x468b('0x1e')](util[_0x468b('0x4')]('[%s][recordings][newexten]',_0x220161[_0x468b('0xf')]),_0x220161);utils[_0x468b('0x3')](util[_0x468b('0x4')](_0x468b('0x36'),_0x220161[_0x468b('0xf')],_0x220161[_0x468b('0x37')],_0x220161[_0x468b('0x38')]));if(_0x220161[_0x468b('0x37')][_0x468b('0x39')]()==_0x468b('0x3a')&&_['startsWith'](_0x220161[_0x468b('0x38')]['toLowerCase'](),'cdr')){var _0x17d57b=_0x220161[_0x468b('0x38')][_0x468b('0x3b')]('=');var _0x1339bd=_0x17d57b[0x0][_0x468b('0x3c')](_0x17d57b[0x0][_0x468b('0x3d')]('(')+0x1,_0x17d57b[0x0][_0x468b('0x3d')](')'));var _0xc9ec2f=_0x17d57b[0x1];recordings[_0x220161[_0x468b('0xf')]][_0x1339bd]=_0xc9ec2f;}}}catch(_0x1e13c9){utils[_0x468b('0x1b')](util[_0x468b('0x4')](_0x468b('0x3e'),_0x220161['uniqueid']),_0x1e13c9);}};exports[_0x468b('0x3f')]=function(_0x19b801){try{if(!_[_0x468b('0x17')](recordings[_0x19b801['uniqueid']])){utils[_0x468b('0x1e')](util[_0x468b('0x4')]('[%s][recordings][queuecallerjoin]',_0x19b801[_0x468b('0xf')]),_0x19b801);utils['info'](util[_0x468b('0x4')](_0x468b('0x40'),_0x19b801[_0x468b('0xf')],_0x19b801[_0x468b('0x41')]));recordings[_0x19b801['uniqueid']][_0x468b('0x41')]=_0x19b801['queue'];}}catch(_0x2a9392){utils['error'](util[_0x468b('0x4')](_0x468b('0x42'),_0x19b801[_0x468b('0xf')]),_0x2a9392);}}; \ No newline at end of file +var _0xc078=['forEach','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','lodash','./utils','format','[%s][recordings][writeDB]','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','uniqueid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','variable','value','endsWith','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','cause-txt','calleridnum','calleridname','connectedlinenum','connectedlinename'];(function(_0x4b6c23,_0x590998){var _0x3f5877=function(_0x5ab3c6){while(--_0x5ab3c6){_0x4b6c23['push'](_0x4b6c23['shift']());}};_0x3f5877(++_0x590998);}(_0xc078,0x17b));var _0x8c07=function(_0x1e112d,_0x48864d){_0x1e112d=_0x1e112d-0x0;var _0x4c24ef=_0xc078[_0x1e112d];return _0x4c24ef;};'use strict';var _=require(_0x8c07('0x0'));var util=require('util');var utils=require(_0x8c07('0x1'));var recordings={};function writeDB(_0x77aa44){utils['info'](util[_0x8c07('0x2')](_0x8c07('0x3'),_0x77aa44['uniqueid']));if(_0x77aa44[_0x8c07('0x4')]){utils['getUserByInternal'](_0x77aa44[_0x8c07('0x4')])[_0x8c07('0x5')](function(_0x467fc7){if(_0x467fc7){_0x77aa44[_0x8c07('0x6')]=_0x467fc7[_0x8c07('0x7')];_0x77aa44[_0x8c07('0x8')]=_0x467fc7['id'];}utils[_0x8c07('0x9')](_0x8c07('0xa'),_0x77aa44);});}else{utils[_0x8c07('0x9')](_0x8c07('0xa'),_0x77aa44);}}exports[_0x8c07('0xb')]=function(_0x355eed){try{utils[_0x8c07('0xc')](util[_0x8c07('0x2')](_0x8c07('0xd'),_0x355eed[_0x8c07('0xe')]),_0x355eed);if(_0x355eed[_0x8c07('0xe')]==_0x355eed['linkedid']){utils[_0x8c07('0xf')](util['format'](_0x8c07('0x10'),_0x355eed['uniqueid'],_0x355eed[_0x8c07('0x11')],_0x355eed[_0x8c07('0x12')]));recordings[_0x355eed[_0x8c07('0xe')]]={'uniqueid':_0x355eed[_0x8c07('0xe')],'accountcode':_0x355eed['accountcode'],'exten':_0x355eed['exten'],'context':_0x355eed[_0x8c07('0x11')],'channel':_0x355eed[_0x8c07('0x13')],'monitors':[]};}}catch(_0x5366f6){utils['error'](util[_0x8c07('0x2')]('[%s][recordings][newchannel]',_0x355eed[_0x8c07('0xe')]),_0x5366f6);}};exports[_0x8c07('0x14')]=function(_0x2c92f2){try{utils[_0x8c07('0xc')](util[_0x8c07('0x2')](_0x8c07('0x15'),_0x2c92f2[_0x8c07('0xe')]),_0x2c92f2);if(!_[_0x8c07('0x16')](recordings[_0x2c92f2[_0x8c07('0xe')]])&&_0x2c92f2[_0x8c07('0x17')]==0x6){utils['info'](util['format'](_0x8c07('0x18'),_0x2c92f2[_0x8c07('0xe')],_0x2c92f2[_0x8c07('0x11')],_0x2c92f2[_0x8c07('0x13')]));}else if(!_[_0x8c07('0x16')](recordings[_0x2c92f2[_0x8c07('0x19')]])&&_0x2c92f2[_0x8c07('0x17')]==0x6&&_0x2c92f2[_0x8c07('0x11')]!=_0x8c07('0x1a')){utils['info'](util[_0x8c07('0x2')](_0x8c07('0x1b'),_0x2c92f2[_0x8c07('0xe')],_0x2c92f2[_0x8c07('0x19')],_0x2c92f2[_0x8c07('0x11')],_0x2c92f2[_0x8c07('0x13')]));recordings[_0x2c92f2[_0x8c07('0x19')]]['accountcode']=_0x2c92f2[_0x8c07('0x4')];}}catch(_0x2b8ce6){utils[_0x8c07('0x1c')](util[_0x8c07('0x2')]('[%s][recordings][newstate]',_0x2c92f2['uniqueid']),_0x2b8ce6);}};exports['varset']=function(_0x4d1776){try{if(!_[_0x8c07('0x16')](_0x4d1776['variable'])&&!_['isNil'](_0x4d1776['variable']['mixmonitor_filename'])){utils[_0x8c07('0xc')](util[_0x8c07('0x2')](_0x8c07('0x1d'),_0x4d1776[_0x8c07('0xe')]),_0x4d1776);utils[_0x8c07('0xf')](util['format'](_0x8c07('0x1e'),_0x4d1776[_0x8c07('0xe')],_0x4d1776[_0x8c07('0x1f')],_0x4d1776[_0x8c07('0x20')]));if(_[_0x8c07('0x21')](_0x4d1776[_0x8c07('0x20')],_0x8c07('0x22'))){_0x4d1776['value']=_0x4d1776[_0x8c07('0x20')][_0x8c07('0x23')](_0x8c07('0x22'),_0x8c07('0x24'));}if(recordings[_0x4d1776[_0x8c07('0x19')]]){var _0x1a2d9a=_[_0x8c07('0x25')](recordings[_0x4d1776[_0x8c07('0x19')]][_0x8c07('0x26')],{'value':_0x4d1776['value']});if(_[_0x8c07('0x16')](_0x1a2d9a)){recordings[_0x4d1776['linkedid']][_0x8c07('0x26')][_0x8c07('0x27')]({'value':_0x4d1776['value']});}}}}catch(_0x11a4ac){utils[_0x8c07('0x1c')](util[_0x8c07('0x2')](_0x8c07('0x1d'),_0x4d1776[_0x8c07('0xe')]),_0x11a4ac);}};exports[_0x8c07('0x28')]=function(_0x5e0df6){try{if(!_[_0x8c07('0x16')](recordings[_0x5e0df6['uniqueid']])){utils[_0x8c07('0xc')](util[_0x8c07('0x2')](_0x8c07('0x29'),_0x5e0df6[_0x8c07('0xe')]),_0x5e0df6);utils[_0x8c07('0xf')](util['format'](_0x8c07('0x2a'),_0x5e0df6['uniqueid'],_0x5e0df6['calleridnum'],_0x5e0df6['calleridname'],_0x5e0df6[_0x8c07('0x2b')]));recordings[_0x5e0df6[_0x8c07('0xe')]][_0x8c07('0x2c')]=_0x5e0df6[_0x8c07('0x2c')];recordings[_0x5e0df6[_0x8c07('0xe')]][_0x8c07('0x2d')]=_0x5e0df6[_0x8c07('0x2d')];recordings[_0x5e0df6['uniqueid']][_0x8c07('0x2e')]=_0x5e0df6['connectedlinenum'];recordings[_0x5e0df6[_0x8c07('0xe')]]['connectedlinename']=_0x5e0df6[_0x8c07('0x2f')];if(recordings[_0x5e0df6['uniqueid']]['type']=='outbound'&&recordings[_0x5e0df6[_0x8c07('0xe')]]['accountcode']){recordings[_0x5e0df6[_0x8c07('0xe')]]['connectedlinenum']=recordings[_0x5e0df6[_0x8c07('0xe')]][_0x8c07('0x4')];recordings[_0x5e0df6[_0x8c07('0xe')]][_0x8c07('0x2f')]='';}recordings[_0x5e0df6[_0x8c07('0xe')]][_0x8c07('0x26')][_0x8c07('0x30')](function(_0x3e46fd){var _0xd50078=_['clone'](recordings[_0x5e0df6[_0x8c07('0xe')]]);_0xd50078[_0x8c07('0x20')]=_0x3e46fd[_0x8c07('0x20')];writeDB(_0xd50078);});delete recordings[_0x5e0df6[_0x8c07('0xe')]];}}catch(_0x38f856){utils[_0x8c07('0x1c')](util[_0x8c07('0x2')]('[%s][recordings][hangup]',_0x5e0df6[_0x8c07('0xe')]),_0x38f856);}};exports[_0x8c07('0x31')]=function(_0x1e1524){try{if(!_[_0x8c07('0x16')](recordings[_0x1e1524[_0x8c07('0xe')]])){utils['debug'](util[_0x8c07('0x2')]('[%s][recordings][newexten]',_0x1e1524[_0x8c07('0xe')]),_0x1e1524);utils[_0x8c07('0xf')](util[_0x8c07('0x2')](_0x8c07('0x32'),_0x1e1524[_0x8c07('0xe')],_0x1e1524[_0x8c07('0x33')],_0x1e1524[_0x8c07('0x34')]));if(_0x1e1524['application'][_0x8c07('0x35')]()==_0x8c07('0x36')&&_['startsWith'](_0x1e1524[_0x8c07('0x34')][_0x8c07('0x35')](),_0x8c07('0x37'))){var _0x4bbdf6=_0x1e1524['appdata']['split']('=');var _0xeb07c4=_0x4bbdf6[0x0]['substring'](_0x4bbdf6[0x0]['lastIndexOf']('(')+0x1,_0x4bbdf6[0x0][_0x8c07('0x38')](')'));var _0x1f5c6d=_0x4bbdf6[0x1];recordings[_0x1e1524[_0x8c07('0xe')]][_0xeb07c4]=_0x1f5c6d;}}}catch(_0x3d5fbb){utils[_0x8c07('0x1c')](util[_0x8c07('0x2')](_0x8c07('0x39'),_0x1e1524['uniqueid']),_0x3d5fbb);}};exports[_0x8c07('0x3a')]=function(_0x44dc71){try{if(!_[_0x8c07('0x16')](recordings[_0x44dc71['uniqueid']])){utils[_0x8c07('0xc')](util[_0x8c07('0x2')](_0x8c07('0x3b'),_0x44dc71[_0x8c07('0xe')]),_0x44dc71);utils[_0x8c07('0xf')](util[_0x8c07('0x2')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x44dc71[_0x8c07('0xe')],_0x44dc71[_0x8c07('0x3c')]));recordings[_0x44dc71[_0x8c07('0xe')]][_0x8c07('0x3c')]=_0x44dc71[_0x8c07('0x3c')];}}catch(_0x29b38f){utils[_0x8c07('0x1c')](util['format'](_0x8c07('0x3b'),_0x44dc71[_0x8c07('0xe')]),_0x29b38f);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 2a2854c..e9e3878 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 _0x6cba=['origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransfererexten','attended','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','./utils','format','origtransfereruniqueid','uniqueid','type','request','blinds','debug','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign'];(function(_0x3bc9c9,_0xcaf226){var _0x5414b1=function(_0x2c35a7){while(--_0x2c35a7){_0x3bc9c9['push'](_0x3bc9c9['shift']());}};_0x5414b1(++_0xcaf226);}(_0x6cba,0x14f));var _0xa6cb=function(_0xdc6dcf,_0x4e9d7a){_0xdc6dcf=_0xdc6dcf-0x0;var _0x7cc8da=_0x6cba[_0xdc6dcf];return _0x7cc8da;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xa6cb('0x0'));function writeDB(_0x546a96){utils['info'](util[_0xa6cb('0x1')]('[%s][transfers][writeDB]\x20type:%s',_0x546a96['type']==='attended'?_0x546a96[_0xa6cb('0x2')]:_0x546a96[_0xa6cb('0x3')],_0x546a96[_0xa6cb('0x4')]));utils[_0xa6cb('0x5')]('CreateVoiceTransferReport',_0x546a96);}exports[_0xa6cb('0x6')]={};exports['blindtransfer']=function(_0x56ea84){try{utils[_0xa6cb('0x7')](util['format'](_0xa6cb('0x8'),_0x56ea84['uniqueid']),_0x56ea84);utils[_0xa6cb('0x9')](util[_0xa6cb('0x1')](_0xa6cb('0xa'),_0x56ea84[_0xa6cb('0x3')],_0x56ea84[_0xa6cb('0xb')],_0x56ea84[_0xa6cb('0xc')],_0x56ea84[_0xa6cb('0xd')],_0x56ea84[_0xa6cb('0xe')]));_0x56ea84['type']='blind';exports[_0xa6cb('0x6')][_0x56ea84[_0xa6cb('0xf')]]=_0x56ea84;writeDB(_0x56ea84);}catch(_0x358286){utils[_0xa6cb('0x10')](util[_0xa6cb('0x1')]('[%s][transfers][blindtransfer]',_0x56ea84[_0xa6cb('0x3')]),_0x358286);}};exports[_0xa6cb('0x11')]=function(_0x51f889){try{utils[_0xa6cb('0x7')](util['format'](_0xa6cb('0x12'),_0x51f889[_0xa6cb('0x2')]),_0x51f889);utils[_0xa6cb('0x9')](util[_0xa6cb('0x1')](_0xa6cb('0x13'),_0x51f889[_0xa6cb('0x2')],_0x51f889[_0xa6cb('0x14')],_0x51f889[_0xa6cb('0x15')],_0x51f889[_0xa6cb('0x16')],_0x51f889[_0xa6cb('0x17')]));_0x51f889=_[_0xa6cb('0x18')](_0x51f889,{'transfererchannel':_0x51f889[_0xa6cb('0x19')],'transferercalleridnum':_0x51f889[_0xa6cb('0x14')],'transferercalleridname':_0x51f889[_0xa6cb('0x15')],'transfererconnectedlinenum':_0x51f889[_0xa6cb('0x1a')],'transfererconnectedlinename':_0x51f889[_0xa6cb('0x1b')],'transfereraccountcode':_0x51f889[_0xa6cb('0x1c')],'transferercontext':_0x51f889[_0xa6cb('0x1d')],'transfererexten':_0x51f889[_0xa6cb('0x1e')],'transfererlinkedid':_0x51f889[_0xa6cb('0x1f')],'context':_0x51f889['origtransferercontext'],'extension':_0x51f889[_0xa6cb('0x20')],'type':_0xa6cb('0x21')});if(_['isNil'](_0x51f889['transfereechannel'])){_0x51f889=_['assign'](_0x51f889,{'transfereechannel':_0x51f889['transfertargetchannel'],'transfereecalleridnum':_0x51f889[_0xa6cb('0x16')],'transfereecalleridname':_0x51f889[_0xa6cb('0x17')],'transfereeconnectedlinenum':_0x51f889[_0xa6cb('0x22')],'transfereeconnectedlinename':_0x51f889[_0xa6cb('0x23')],'transfereeaccountcode':_0x51f889[_0xa6cb('0x24')],'transfereecontext':_0x51f889[_0xa6cb('0x25')],'transfereeexten':_0x51f889[_0xa6cb('0x26')],'transfereelinkedid':_0x51f889[_0xa6cb('0x27')]});}writeDB(_0x51f889);}catch(_0x352162){utils[_0xa6cb('0x10')](util[_0xa6cb('0x1')](_0xa6cb('0x12'),_0x51f889[_0xa6cb('0x2')]),_0x352162);}}; \ No newline at end of file +var _0xa08f=['[%s][transfers][attendedtransfer]','lodash','util','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','request','CreateVoiceTransferReport','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','uniqueid','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blinds','transfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransferercontext','isNil','transfereechannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','error'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0xa08f,0x141));var _0xfa08=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa08f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfa08('0x0'));var util=require(_0xfa08('0x1'));var utils=require('./utils');function writeDB(_0x1d606e){utils[_0xfa08('0x2')](util[_0xfa08('0x3')](_0xfa08('0x4'),_0x1d606e[_0xfa08('0x5')]===_0xfa08('0x6')?_0x1d606e[_0xfa08('0x7')]:_0x1d606e['uniqueid'],_0x1d606e['type']));utils[_0xfa08('0x8')](_0xfa08('0x9'),_0x1d606e);}exports['blinds']={};exports['blindtransfer']=function(_0x1c13a2){try{utils[_0xfa08('0xa')](util[_0xfa08('0x3')](_0xfa08('0xb'),_0x1c13a2['uniqueid']),_0x1c13a2);utils[_0xfa08('0x2')](util[_0xfa08('0x3')](_0xfa08('0xc'),_0x1c13a2[_0xfa08('0xd')],_0x1c13a2[_0xfa08('0xe')],_0x1c13a2['transferercalleridname'],_0x1c13a2[_0xfa08('0xf')],_0x1c13a2[_0xfa08('0x10')]));_0x1c13a2[_0xfa08('0x5')]='blind';exports[_0xfa08('0x11')][_0x1c13a2[_0xfa08('0x12')]]=_0x1c13a2;writeDB(_0x1c13a2);}catch(_0x9f84bd){utils['error'](util['format'](_0xfa08('0xb'),_0x1c13a2[_0xfa08('0xd')]),_0x9f84bd);}};exports['attendedtransfer']=function(_0x3cb6f0){try{utils[_0xfa08('0xa')](util[_0xfa08('0x3')]('[%s][transfers][attendedtransfer]',_0x3cb6f0[_0xfa08('0x7')]),_0x3cb6f0);utils[_0xfa08('0x2')](util[_0xfa08('0x3')](_0xfa08('0x13'),_0x3cb6f0[_0xfa08('0x7')],_0x3cb6f0[_0xfa08('0x14')],_0x3cb6f0[_0xfa08('0x15')],_0x3cb6f0[_0xfa08('0x16')],_0x3cb6f0['transfertargetcalleridname']));_0x3cb6f0=_[_0xfa08('0x17')](_0x3cb6f0,{'transfererchannel':_0x3cb6f0[_0xfa08('0x18')],'transferercalleridnum':_0x3cb6f0['origtransferercalleridnum'],'transferercalleridname':_0x3cb6f0[_0xfa08('0x15')],'transfererconnectedlinenum':_0x3cb6f0['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x3cb6f0[_0xfa08('0x19')],'transfereraccountcode':_0x3cb6f0[_0xfa08('0x1a')],'transferercontext':_0x3cb6f0[_0xfa08('0x1b')],'transfererexten':_0x3cb6f0['secondtransfererexten'],'transfererlinkedid':_0x3cb6f0[_0xfa08('0x1c')],'context':_0x3cb6f0[_0xfa08('0x1d')],'extension':_0x3cb6f0['origtransfererexten'],'type':'attended'});if(_[_0xfa08('0x1e')](_0x3cb6f0[_0xfa08('0x1f')])){_0x3cb6f0=_[_0xfa08('0x17')](_0x3cb6f0,{'transfereechannel':_0x3cb6f0['transfertargetchannel'],'transfereecalleridnum':_0x3cb6f0['transfertargetcalleridnum'],'transfereecalleridname':_0x3cb6f0[_0xfa08('0x20')],'transfereeconnectedlinenum':_0x3cb6f0[_0xfa08('0x21')],'transfereeconnectedlinename':_0x3cb6f0[_0xfa08('0x22')],'transfereeaccountcode':_0x3cb6f0[_0xfa08('0x23')],'transfereecontext':_0x3cb6f0[_0xfa08('0x24')],'transfereeexten':_0x3cb6f0['transfertargetexten'],'transfereelinkedid':_0x3cb6f0[_0xfa08('0x25')]});}writeDB(_0x3cb6f0);}catch(_0x4d255d){utils[_0xfa08('0x26')](util[_0xfa08('0x3')](_0xfa08('0x27'),_0x3cb6f0[_0xfa08('0x7')]),_0x4d255d);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index e9daffb..171f19b 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 _0xbcf5=['[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','seconds','diffTime','diff','sumTime','now','isBefore','bluebird','jayson/promise','moment','util','client','../../config/logger','xdr','info','inspect','debug','error','request','[utils][request]\x20name:%s','catch','GetUser','internal','interface','then','stringify','result','getUserByInternal','found','notfound','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName'];(function(_0x4c5878,_0x2d0034){var _0x14c6a7=function(_0x3fd8c4){while(--_0x3fd8c4){_0x4c5878['push'](_0x4c5878['shift']());}};_0x14c6a7(++_0x2d0034);}(_0xbcf5,0x1c6));var _0x5bcf=function(_0x10158e,_0x30f48f){_0x10158e=_0x10158e-0x0;var _0x5db35a=_0xbcf5[_0x10158e];return _0x5db35a;};'use strict';var BPromise=require(_0x5bcf('0x0'));var jayson=require(_0x5bcf('0x1'));var moment=require(_0x5bcf('0x2'));var util=require(_0x5bcf('0x3'));var client=jayson[_0x5bcf('0x4')]['http']({'port':0x2329});var logger=require(_0x5bcf('0x5'))(_0x5bcf('0x6'));exports['info']=function(_0x41619b,_0x5ee176){logger[_0x5bcf('0x7')](_0x41619b,_0x5ee176?util[_0x5bcf('0x8')](_0x5ee176,{'showHidden':![],'depth':null}):'');};exports[_0x5bcf('0x9')]=function(_0x3025ac,_0x7583b){logger['debug'](_0x3025ac,_0x7583b?util[_0x5bcf('0x8')](_0x7583b,{'showHidden':![],'depth':null}):'');};exports[_0x5bcf('0xa')]=function(_0x246751,_0x4a8b89){logger[_0x5bcf('0xa')](_0x246751,_0x4a8b89?util[_0x5bcf('0x8')](_0x4a8b89,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x54f95a,_0x6cd6b1){return client[_0x5bcf('0xb')](_0x54f95a,{'body':_0x6cd6b1})['then'](function(_0x108429){logger[_0x5bcf('0x9')](_0x5bcf('0xc'),_0x54f95a,_0x108429?util[_0x5bcf('0x8')](_0x108429,{'showHidden':![],'depth':null}):'');})[_0x5bcf('0xd')](function(_0x5ea908){logger[_0x5bcf('0xa')](_0x5bcf('0xc'),_0x54f95a,_0x5ea908?util[_0x5bcf('0x8')](_0x5ea908,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3897af){return client[_0x5bcf('0xb')](_0x5bcf('0xe'),{'options':{'raw':!![],'attributes':['id',_0x5bcf('0xf'),'name',_0x5bcf('0x10')],'where':_0x3897af,'limit':0x1}})[_0x5bcf('0x11')](function(_0x37af15){logger[_0x5bcf('0x9')]('[utils][getUser]\x20where:%s',JSON[_0x5bcf('0x12')](_0x3897af),_0x37af15?util[_0x5bcf('0x8')](_0x37af15,{'showHidden':![],'depth':null}):'');return _0x37af15[_0x5bcf('0x13')]['length']?_0x37af15[_0x5bcf('0x13')][0x0]:null;});}exports[_0x5bcf('0x14')]=function(_0x3d7ef5){return new BPromise(function(_0x31b143,_0x10d938){if(_0x3d7ef5){return getUser({'internal':_0x3d7ef5})[_0x5bcf('0x11')](function(_0x19fbd9){logger[_0x5bcf('0x7')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x3d7ef5,_0x19fbd9?_0x5bcf('0x15'):_0x5bcf('0x16'));return _0x31b143(_0x19fbd9);})[_0x5bcf('0xd')](function(_0x268e17){logger[_0x5bcf('0xa')]('[utils][getUserByInternal]',_0x268e17?util['inspect'](_0x268e17,{'showHidden':![],'depth':null}):'');return _0x31b143(null);});}return _0x31b143(null);});};exports['getUserByInterface']=function(_0x3e4f5a){return new BPromise(function(_0x4f1886,_0x5b632d){if(_0x3e4f5a){return getUser({'interface':_0x3e4f5a})[_0x5bcf('0x11')](function(_0x27d6fb){logger[_0x5bcf('0x7')](_0x5bcf('0x17'),_0x3e4f5a,_0x27d6fb?_0x5bcf('0x15'):'notfound');return _0x4f1886(_0x27d6fb);})['catch'](function(_0x53ec0e){logger[_0x5bcf('0xa')](_0x5bcf('0x18'),_0x53ec0e?util[_0x5bcf('0x8')](_0x53ec0e,{'showHidden':![],'depth':null}):'');return _0x4f1886(null);});}return _0x4f1886(null);});};exports[_0x5bcf('0x19')]=function(_0x5d0ce4){return new BPromise(function(_0x1f0ac1,_0x4f591c){if(_0x5d0ce4){return getUser({'name':_0x5d0ce4})['then'](function(_0x472489){logger[_0x5bcf('0x7')](_0x5bcf('0x1a'),_0x5d0ce4,_0x472489?'found':_0x5bcf('0x16'));return _0x1f0ac1(_0x472489);})[_0x5bcf('0xd')](function(_0x1c5945){logger[_0x5bcf('0xa')](_0x5bcf('0x1b'),_0x1c5945?util[_0x5bcf('0x8')](_0x1c5945,{'showHidden':![],'depth':null}):'');return _0x1f0ac1(null);});}return _0x1f0ac1(null);});};exports[_0x5bcf('0x1c')]=function(_0x16da40){return new BPromise(function(_0x32d46e,_0x126275){if(_0x16da40){return client[_0x5bcf('0xb')](_0x5bcf('0x1d'),{'options':{'raw':!![],'attributes':['id','name',_0x5bcf('0x1e'),_0x5bcf('0x1f'),_0x5bcf('0x20')],'where':{'name':_0x16da40},'limit':0x1}})['then'](function(_0x3d24dc){logger['debug'](_0x5bcf('0x21'),_0x16da40,_0x3d24dc?util[_0x5bcf('0x8')](_0x3d24dc,{'showHidden':![],'depth':null}):'');logger[_0x5bcf('0x7')](_0x5bcf('0x22'),_0x16da40,_0x3d24dc?'found':_0x5bcf('0x16'));return _0x32d46e(_0x3d24dc[_0x5bcf('0x13')][_0x5bcf('0x23')]?_0x3d24dc[_0x5bcf('0x13')][0x0]:null);})[_0x5bcf('0xd')](function(_0x11ed63){logger[_0x5bcf('0xa')](_0x5bcf('0x24'),_0x11ed63?util[_0x5bcf('0x8')](_0x11ed63,{'showHidden':![],'depth':null}):'');return _0x32d46e(null);});}return _0x32d46e(null);});};exports[_0x5bcf('0x25')]=function(_0x28341d,_0x48d3a4){return moment(_0x28341d)[_0x5bcf('0x26')](_0x48d3a4,'seconds')[_0x5bcf('0x27')](_0x5bcf('0x28'));};exports[_0x5bcf('0x29')]=function(_0x173807,_0x4b3aca){return moment(_0x173807)['subtract'](_0x4b3aca,_0x5bcf('0x2a'))['format'](_0x5bcf('0x28'));};exports[_0x5bcf('0x2b')]=function(_0x30939e,_0xc8de38){return moment(_0x30939e)[_0x5bcf('0x2c')](moment(_0xc8de38),_0x5bcf('0x2a'));};exports[_0x5bcf('0x2d')]=function(_0x32b62e,_0x1da2e1){return parseInt(_0x32b62e,0xa)+parseInt(_0x1da2e1,0xa);};exports[_0x5bcf('0x2e')]=function(){return moment()[_0x5bcf('0x27')](_0x5bcf('0x28'));};exports['isAfter']=function(_0x1165e1,_0xecdd2a){if(_0xecdd2a){return moment(_0x1165e1)['isAfter'](_0xecdd2a);}return!![];};exports[_0x5bcf('0x2f')]=function(_0x3a6fa8,_0xe15ac6){if(_0xe15ac6){return moment(_0x3a6fa8)[_0x5bcf('0x2f')](_0xe15ac6);}else if(_0x3a6fa8){return!![];}return![];}; \ No newline at end of file +var _0x81f8=['getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','isAfter','isBefore','bluebird','jayson/promise','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','catch','internal','name','[utils][getUser]\x20where:%s','stringify','result','length','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s'];(function(_0x188b52,_0x42017e){var _0x1ac963=function(_0x4de353){while(--_0x4de353){_0x188b52['push'](_0x188b52['shift']());}};_0x1ac963(++_0x42017e);}(_0x81f8,0x186));var _0x881f=function(_0x37bc4b,_0x4f3525){_0x37bc4b=_0x37bc4b-0x0;var _0x4599db=_0x81f8[_0x37bc4b];return _0x4599db;};'use strict';var BPromise=require(_0x881f('0x0'));var jayson=require(_0x881f('0x1'));var moment=require('moment');var util=require(_0x881f('0x2'));var client=jayson[_0x881f('0x3')][_0x881f('0x4')]({'port':0x2329});var logger=require(_0x881f('0x5'))(_0x881f('0x6'));exports['info']=function(_0x1c77c0,_0x3c26d3){logger[_0x881f('0x7')](_0x1c77c0,_0x3c26d3?util[_0x881f('0x8')](_0x3c26d3,{'showHidden':![],'depth':null}):'');};exports[_0x881f('0x9')]=function(_0x30b48c,_0x2d93bc){logger['debug'](_0x30b48c,_0x2d93bc?util['inspect'](_0x2d93bc,{'showHidden':![],'depth':null}):'');};exports[_0x881f('0xa')]=function(_0x2e9748,_0x493708){logger[_0x881f('0xa')](_0x2e9748,_0x493708?util[_0x881f('0x8')](_0x493708,{'showHidden':![],'depth':null}):'');};exports[_0x881f('0xb')]=function(_0x63d5a6,_0x56d967){return client['request'](_0x63d5a6,{'body':_0x56d967})[_0x881f('0xc')](function(_0x22907a){logger[_0x881f('0x9')]('[utils][request]\x20name:%s',_0x63d5a6,_0x22907a?util['inspect'](_0x22907a,{'showHidden':![],'depth':null}):'');})[_0x881f('0xd')](function(_0x422ee5){logger['error']('[utils][request]\x20name:%s',_0x63d5a6,_0x422ee5?util[_0x881f('0x8')](_0x422ee5,{'showHidden':![],'depth':null}):'');});};function getUser(_0x399146){return client[_0x881f('0xb')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x881f('0xe'),_0x881f('0xf'),'interface'],'where':_0x399146,'limit':0x1}})[_0x881f('0xc')](function(_0x3d9e50){logger['debug'](_0x881f('0x10'),JSON[_0x881f('0x11')](_0x399146),_0x3d9e50?util[_0x881f('0x8')](_0x3d9e50,{'showHidden':![],'depth':null}):'');return _0x3d9e50[_0x881f('0x12')][_0x881f('0x13')]?_0x3d9e50[_0x881f('0x12')][0x0]:null;});}exports['getUserByInternal']=function(_0x349c17){return new BPromise(function(_0x4f0540,_0x5d2955){if(_0x349c17){return getUser({'internal':_0x349c17})[_0x881f('0xc')](function(_0x123fbf){logger[_0x881f('0x7')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x349c17,_0x123fbf?_0x881f('0x14'):_0x881f('0x15'));return _0x4f0540(_0x123fbf);})['catch'](function(_0x954062){logger[_0x881f('0xa')](_0x881f('0x16'),_0x954062?util['inspect'](_0x954062,{'showHidden':![],'depth':null}):'');return _0x4f0540(null);});}return _0x4f0540(null);});};exports['getUserByInterface']=function(_0x38f7a7){return new BPromise(function(_0x100e7f,_0x161eea){if(_0x38f7a7){return getUser({'interface':_0x38f7a7})[_0x881f('0xc')](function(_0x4f43ee){logger[_0x881f('0x7')](_0x881f('0x17'),_0x38f7a7,_0x4f43ee?_0x881f('0x14'):'notfound');return _0x100e7f(_0x4f43ee);})[_0x881f('0xd')](function(_0x51bbb2){logger[_0x881f('0xa')]('[utils][getUserByInterface]',_0x51bbb2?util[_0x881f('0x8')](_0x51bbb2,{'showHidden':![],'depth':null}):'');return _0x100e7f(null);});}return _0x100e7f(null);});};exports[_0x881f('0x18')]=function(_0x2d6a34){return new BPromise(function(_0x341e3c,_0x5f39cc){if(_0x2d6a34){return getUser({'name':_0x2d6a34})[_0x881f('0xc')](function(_0xdfe89b){logger[_0x881f('0x7')](_0x881f('0x19'),_0x2d6a34,_0xdfe89b?_0x881f('0x14'):_0x881f('0x15'));return _0x341e3c(_0xdfe89b);})['catch'](function(_0x25a134){logger[_0x881f('0xa')](_0x881f('0x1a'),_0x25a134?util[_0x881f('0x8')](_0x25a134,{'showHidden':![],'depth':null}):'');return _0x341e3c(null);});}return _0x341e3c(null);});};exports[_0x881f('0x1b')]=function(_0x518ddb){return new BPromise(function(_0x56cc05,_0x40d75b){if(_0x518ddb){return client[_0x881f('0xb')](_0x881f('0x1c'),{'options':{'raw':!![],'attributes':['id','name',_0x881f('0x1d'),_0x881f('0x1e'),_0x881f('0x1f')],'where':{'name':_0x518ddb},'limit':0x1}})[_0x881f('0xc')](function(_0x4a17fd){logger[_0x881f('0x9')](_0x881f('0x20'),_0x518ddb,_0x4a17fd?util[_0x881f('0x8')](_0x4a17fd,{'showHidden':![],'depth':null}):'');logger[_0x881f('0x7')](_0x881f('0x21'),_0x518ddb,_0x4a17fd?_0x881f('0x14'):_0x881f('0x15'));return _0x56cc05(_0x4a17fd[_0x881f('0x12')]['length']?_0x4a17fd[_0x881f('0x12')][0x0]:null);})[_0x881f('0xd')](function(_0x16dcea){logger['error'](_0x881f('0x22'),_0x16dcea?util[_0x881f('0x8')](_0x16dcea,{'showHidden':![],'depth':null}):'');return _0x56cc05(null);});}return _0x56cc05(null);});};exports['addTime']=function(_0x28e64a,_0x368f4c){return moment(_0x28e64a)[_0x881f('0x23')](_0x368f4c,_0x881f('0x24'))[_0x881f('0x25')](_0x881f('0x26'));};exports[_0x881f('0x27')]=function(_0x38fc1d,_0x3d169d){return moment(_0x38fc1d)[_0x881f('0x28')](_0x3d169d,_0x881f('0x24'))['format'](_0x881f('0x26'));};exports[_0x881f('0x29')]=function(_0x4dcec2,_0x24006f){return moment(_0x4dcec2)[_0x881f('0x2a')](moment(_0x24006f),_0x881f('0x24'));};exports[_0x881f('0x2b')]=function(_0x2054ff,_0x4c0513){return parseInt(_0x2054ff,0xa)+parseInt(_0x4c0513,0xa);};exports['now']=function(){return moment()[_0x881f('0x25')](_0x881f('0x26'));};exports['isAfter']=function(_0x131416,_0x5af5de){if(_0x5af5de){return moment(_0x131416)[_0x881f('0x2c')](_0x5af5de);}return!![];};exports[_0x881f('0x2d')]=function(_0x3a858a,_0x207f3a){if(_0x207f3a){return moment(_0x3a858a)[_0x881f('0x2d')](_0x207f3a);}else if(_0x3a858a){return!![];}return![];}; \ No newline at end of file